From: support Date: Tue, 28 Mar 2023 09:26:35 +0000 (+0000) Subject: Built motion from commit d6d69adf.|2.6.33 X-Git-Url: http://repos.xcallymotion.com/base/%22https:/wiki.xcallymotion.com/display/XMV//%22?a=commitdiff_plain;h=87977a1b0bb9bbb7da1f5d284f3d898d8c44a308;p=motion2.git Built motion from commit d6d69adf.|2.6.33 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index c956f69..87dbaf3 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2023-03-28T08:48:44.376Z", + "time": "2023-03-28T09:17:06.964Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 4fe93b5..ae8e355 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2023-03-28T08:48:44.376Z", + "time": "2023-03-28T09:17:06.964Z", "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 f182ffa..9897251 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 _0x7ae5=['urlForward[body]','sequelize','exports','VIRTUAL','action','STRING','contactManager','integration','urlForward','browser','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT'];(function(_0x9b007,_0x416098){var _0x12f148=function(_0x3dfc0a){while(--_0x3dfc0a){_0x9b007['push'](_0x9b007['shift']());}};_0x12f148(++_0x416098);}(_0x7ae5,0x133));var _0x57ae=function(_0x329d59,_0xae2550){_0x329d59=_0x329d59-0x0;var _0x2ff3bb=_0x7ae5[_0x329d59];return _0x2ff3bb;};'use strict';var Sequelize=require(_0x57ae('0x0'));module[_0x57ae('0x1')]={'name':{'type':Sequelize[_0x57ae('0x2')],'get':function(_0xf2be0a){return this['getDataValue'](_0x57ae('0x3'));}},'action':{'type':Sequelize[_0x57ae('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x57ae('0x5'),_0x57ae('0x6'),'motionbar','jscripty',_0x57ae('0x7'),_0x57ae('0x8'),'bot',_0x57ae('0x9')]],'msg':_0x57ae('0xa')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0x57ae('0x4')](0x1000),'comment':_0x57ae('0xb')},'data2':{'type':Sequelize[_0x57ae('0x4')](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize[_0x57ae('0x4')](0x1000),'comment':_0x57ae('0xc')},'data4':{'type':Sequelize[_0x57ae('0x4')](0x1000),'comments':_0x57ae('0xd')},'data5':{'type':Sequelize[_0x57ae('0x4')](0x1000),'comments':_0x57ae('0xe')},'data6':{'type':Sequelize[_0x57ae('0x4')],'comments':_0x57ae('0xf')},'data7':{'type':Sequelize[_0x57ae('0x10')],'comments':_0x57ae('0x11')}}; \ No newline at end of file +var _0x9b25=['contactManager','motionbar','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','exports','getDataValue','action','STRING'];(function(_0x1780f8,_0x11ba93){var _0x33a410=function(_0x2a015f){while(--_0x2a015f){_0x1780f8['push'](_0x1780f8['shift']());}};_0x33a410(++_0x11ba93);}(_0x9b25,0x175));var _0x59b2=function(_0xbfe8e9,_0x5a8b43){_0xbfe8e9=_0xbfe8e9-0x0;var _0x2a278f=_0x9b25[_0xbfe8e9];return _0x2a278f;};'use strict';var Sequelize=require(_0x59b2('0x0'));module[_0x59b2('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0xed1df0){return this[_0x59b2('0x2')](_0x59b2('0x3'));}},'action':{'type':Sequelize[_0x59b2('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x59b2('0x5'),'integration',_0x59b2('0x6'),'jscripty','urlForward',_0x59b2('0x7'),_0x59b2('0x8'),_0x59b2('0x9')]],'msg':_0x59b2('0xa')}},'comment':_0x59b2('0xa')},'data1':{'type':Sequelize[_0x59b2('0x4')](0x1000),'comment':_0x59b2('0xb')},'data2':{'type':Sequelize[_0x59b2('0x4')](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0x59b2('0xc')},'data4':{'type':Sequelize['STRING'](0x1000),'comments':_0x59b2('0xd')},'data5':{'type':Sequelize[_0x59b2('0x4')](0x1000),'comments':_0x59b2('0xe')},'data6':{'type':Sequelize[_0x59b2('0x4')],'comments':_0x59b2('0xf')},'data7':{'type':Sequelize[_0x59b2('0x10')],'comments':_0x59b2('0x11')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 5f65063..e7451fb 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 _0xb34a=['limit','offset','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','body','Action','find','params','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined'];(function(_0x4bf96c,_0x4d24fd){var _0x281d09=function(_0x56538e){while(--_0x56538e){_0x4bf96c['push'](_0x4bf96c['shift']());}};_0x281d09(++_0x4d24fd);}(_0xb34a,0x1aa));var _0xab34=function(_0x56ea67,_0x255351){_0x56ea67=_0x56ea67-0x0;var _0x1958f7=_0xb34a[_0x56ea67];return _0x1958f7;};'use strict';var emlformat=require(_0xab34('0x0'));var rimraf=require(_0xab34('0x1'));var zipdir=require(_0xab34('0x2'));var jsonpatch=require(_0xab34('0x3'));var rp=require(_0xab34('0x4'));var moment=require(_0xab34('0x5'));var BPromise=require(_0xab34('0x6'));var Mustache=require(_0xab34('0x7'));var util=require(_0xab34('0x8'));var path=require(_0xab34('0x9'));var sox=require(_0xab34('0xa'));var csv=require(_0xab34('0xb'));var ejs=require(_0xab34('0xc'));var fs=require('fs');var fs_extra=require(_0xab34('0xd'));var _=require(_0xab34('0xe'));var squel=require('squel');var crypto=require(_0xab34('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xab34('0xb'));var querystring=require(_0xab34('0x10'));var Papa=require(_0xab34('0x11'));var Redis=require(_0xab34('0x12'));var authService=require(_0xab34('0x13'));var qs=require(_0xab34('0x14'));var as=require(_0xab34('0x15'));var hardwareService=require(_0xab34('0x16'));var logger=require(_0xab34('0x17'))(_0xab34('0x18'));var utils=require(_0xab34('0x19'));var config=require(_0xab34('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xab34('0x1b'))['db'];function respondWithStatusCode(_0x39e750,_0x14bc59){_0x14bc59=_0x14bc59||0xcc;return function(_0x2fb80e){if(_0x2fb80e){return _0x39e750[_0xab34('0x1c')](_0x14bc59);}return _0x39e750[_0xab34('0x1d')](_0x14bc59)[_0xab34('0x1e')]();};}function respondWithResult(_0x3aa0e3,_0x2a4017){_0x2a4017=_0x2a4017||0xc8;return function(_0x5dd407){if(_0x5dd407){return _0x3aa0e3[_0xab34('0x1d')](_0x2a4017)[_0xab34('0x1f')](_0x5dd407);}};}function respondWithFilteredResult(_0xe2168,_0x1ef9f1){return function(_0x2ec1ce){if(_0x2ec1ce){var _0x1ea169=typeof _0x1ef9f1['offset']===_0xab34('0x20')&&typeof _0x1ef9f1[_0xab34('0x21')]==='undefined';var _0x8804ca=_0x2ec1ce['count'];var _0x431e7d=_0x1ea169?0x0:_0x1ef9f1[_0xab34('0x22')];var _0x23def7=_0x1ea169?_0x2ec1ce['count']:_0x1ef9f1[_0xab34('0x22')]+_0x1ef9f1[_0xab34('0x21')];var _0x4d8661;if(_0x23def7>=_0x8804ca){_0x23def7=_0x8804ca;_0x4d8661=0xc8;}else{_0x4d8661=0xce;}_0xe2168[_0xab34('0x1d')](_0x4d8661);return _0xe2168['set'](_0xab34('0x23'),_0x431e7d+'-'+_0x23def7+'/'+_0x8804ca)[_0xab34('0x1f')](_0x2ec1ce);}return null;};}function patchUpdates(_0x60cbaf){return function(_0xc0eb35){try{jsonpatch[_0xab34('0x24')](_0xc0eb35,_0x60cbaf,!![]);}catch(_0x4305ad){return BPromise[_0xab34('0x25')](_0x4305ad);}return _0xc0eb35[_0xab34('0x26')]();};}function saveUpdates(_0x325853,_0x24b503){return function(_0xeb199c){if(_0xeb199c){return _0xeb199c[_0xab34('0x27')](_0x325853)[_0xab34('0x28')](function(_0x1f50b7){return _0x1f50b7;});}return null;};}function removeEntity(_0x2bfb1a,_0x26c82a){return function(_0x40ab27){if(_0x40ab27){return _0x40ab27[_0xab34('0x29')]()[_0xab34('0x28')](function(){_0x2bfb1a[_0xab34('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7a6f42,_0x4905fb){return function(_0x3c4f7c){if(!_0x3c4f7c){_0x7a6f42['sendStatus'](0x194);}return _0x3c4f7c;};}function handleError(_0x72ad3e,_0xc47c4b){_0xc47c4b=_0xc47c4b||0x1f4;return function(_0x369b12){logger[_0xab34('0x2a')](_0x369b12[_0xab34('0x2b')]);if(_0x369b12[_0xab34('0x2c')]){delete _0x369b12[_0xab34('0x2c')];}_0x72ad3e['status'](_0xc47c4b)[_0xab34('0x2d')](_0x369b12);};}exports['update']=function(_0xd6a0a,_0x25d27b){if(_0xd6a0a[_0xab34('0x2e')]['id']){delete _0xd6a0a[_0xab34('0x2e')]['id'];}return db[_0xab34('0x2f')][_0xab34('0x30')]({'where':{'id':_0xd6a0a[_0xab34('0x31')]['id']}})['then'](handleEntityNotFound(_0x25d27b,null))[_0xab34('0x28')](saveUpdates(_0xd6a0a[_0xab34('0x2e')],null))[_0xab34('0x28')](respondWithResult(_0x25d27b,null))['catch'](handleError(_0x25d27b,null));};exports[_0xab34('0x29')]=function(_0x44a5e8,_0x1c9b81){return db['Action']['find']({'where':{'id':_0x44a5e8[_0xab34('0x31')]['id']}})['then'](handleEntityNotFound(_0x1c9b81,null))['then'](removeEntity(_0x1c9b81,null))[_0xab34('0x32')](handleError(_0x1c9b81,null));}; \ No newline at end of file +var _0x4130=['params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','undefined','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','body','Action','find','catch'];(function(_0x4f51c9,_0x7d55fa){var _0x5e1d6b=function(_0x36e5b0){while(--_0x36e5b0){_0x4f51c9['push'](_0x4f51c9['shift']());}};_0x5e1d6b(++_0x7d55fa);}(_0x4130,0x1a8));var _0x0413=function(_0x5a5939,_0x5af371){_0x5a5939=_0x5a5939-0x0;var _0x336804=_0x4130[_0x5a5939];return _0x336804;};'use strict';var emlformat=require(_0x0413('0x0'));var rimraf=require(_0x0413('0x1'));var zipdir=require(_0x0413('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0413('0x3'));var moment=require(_0x0413('0x4'));var BPromise=require(_0x0413('0x5'));var Mustache=require(_0x0413('0x6'));var util=require(_0x0413('0x7'));var path=require(_0x0413('0x8'));var sox=require('sox');var csv=require(_0x0413('0x9'));var ejs=require(_0x0413('0xa'));var fs=require('fs');var fs_extra=require(_0x0413('0xb'));var _=require('lodash');var squel=require(_0x0413('0xc'));var crypto=require(_0x0413('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0413('0x9'));var querystring=require(_0x0413('0xe'));var Papa=require(_0x0413('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0413('0x10'));var logger=require(_0x0413('0x11'))(_0x0413('0x12'));var utils=require(_0x0413('0x13'));var config=require(_0x0413('0x14'));var licenseUtil=require(_0x0413('0x15'));var db=require(_0x0413('0x16'))['db'];function respondWithStatusCode(_0x3a704c,_0xcb1e70){_0xcb1e70=_0xcb1e70||0xcc;return function(_0x1c966e){if(_0x1c966e){return _0x3a704c[_0x0413('0x17')](_0xcb1e70);}return _0x3a704c['status'](_0xcb1e70)['end']();};}function respondWithResult(_0xfd7e13,_0x380e93){_0x380e93=_0x380e93||0xc8;return function(_0x368635){if(_0x368635){return _0xfd7e13[_0x0413('0x18')](_0x380e93)[_0x0413('0x19')](_0x368635);}};}function respondWithFilteredResult(_0x501d42,_0x232e86){return function(_0x41c548){if(_0x41c548){var _0xc6200e=typeof _0x232e86['offset']==='undefined'&&typeof _0x232e86[_0x0413('0x1a')]===_0x0413('0x1b');var _0x3a87b0=_0x41c548['count'];var _0x115429=_0xc6200e?0x0:_0x232e86[_0x0413('0x1c')];var _0x48d42a=_0xc6200e?_0x41c548[_0x0413('0x1d')]:_0x232e86[_0x0413('0x1c')]+_0x232e86[_0x0413('0x1a')];var _0x1ad095;if(_0x48d42a>=_0x3a87b0){_0x48d42a=_0x3a87b0;_0x1ad095=0xc8;}else{_0x1ad095=0xce;}_0x501d42[_0x0413('0x18')](_0x1ad095);return _0x501d42[_0x0413('0x1e')](_0x0413('0x1f'),_0x115429+'-'+_0x48d42a+'/'+_0x3a87b0)[_0x0413('0x19')](_0x41c548);}return null;};}function patchUpdates(_0x33969b){return function(_0x11024f){try{jsonpatch[_0x0413('0x20')](_0x11024f,_0x33969b,!![]);}catch(_0x3ebcaa){return BPromise[_0x0413('0x21')](_0x3ebcaa);}return _0x11024f[_0x0413('0x22')]();};}function saveUpdates(_0x1559ce,_0x50a481){return function(_0x2b50b9){if(_0x2b50b9){return _0x2b50b9[_0x0413('0x23')](_0x1559ce)[_0x0413('0x24')](function(_0x32e31b){return _0x32e31b;});}return null;};}function removeEntity(_0xb3f479,_0x23297d){return function(_0x7643d4){if(_0x7643d4){return _0x7643d4[_0x0413('0x25')]()[_0x0413('0x24')](function(){_0xb3f479[_0x0413('0x18')](0xcc)[_0x0413('0x26')]();});}};}function handleEntityNotFound(_0x175feb,_0x84d03a){return function(_0x45c541){if(!_0x45c541){_0x175feb[_0x0413('0x17')](0x194);}return _0x45c541;};}function handleError(_0x268be9,_0xf9bd31){_0xf9bd31=_0xf9bd31||0x1f4;return function(_0x21d191){logger[_0x0413('0x27')](_0x21d191['stack']);if(_0x21d191[_0x0413('0x28')]){delete _0x21d191['name'];}_0x268be9[_0x0413('0x18')](_0xf9bd31)[_0x0413('0x29')](_0x21d191);};}exports[_0x0413('0x23')]=function(_0x535051,_0x1ef9f4){if(_0x535051['body']['id']){delete _0x535051[_0x0413('0x2a')]['id'];}return db[_0x0413('0x2b')][_0x0413('0x2c')]({'where':{'id':_0x535051['params']['id']}})['then'](handleEntityNotFound(_0x1ef9f4,null))['then'](saveUpdates(_0x535051[_0x0413('0x2a')],null))[_0x0413('0x24')](respondWithResult(_0x1ef9f4,null))[_0x0413('0x2d')](handleError(_0x1ef9f4,null));};exports[_0x0413('0x25')]=function(_0x2e876a,_0xc374ab){return db['Action']['find']({'where':{'id':_0x2e876a[_0x0413('0x2e')]['id']}})[_0x0413('0x24')](handleEntityNotFound(_0xc374ab,null))[_0x0413('0x24')](removeEntity(_0xc374ab,null))[_0x0413('0x2d')](handleError(_0xc374ab,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 118c215..9d9546c 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 _0xd34c=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','tools_actions','lodash'];(function(_0x5ad753,_0x21bc14){var _0x55b69=function(_0x459144){while(--_0x459144){_0x5ad753['push'](_0x5ad753['shift']());}};_0x55b69(++_0x21bc14);}(_0xd34c,0x185));var _0xcd34=function(_0x53a154,_0x21ff77){_0x53a154=_0x53a154-0x0;var _0x18c240=_0xd34c[_0x53a154];return _0x18c240;};'use strict';var _=require(_0xcd34('0x0'));var util=require(_0xcd34('0x1'));var logger=require(_0xcd34('0x2'))(_0xcd34('0x3'));var moment=require(_0xcd34('0x4'));var BPromise=require(_0xcd34('0x5'));var rp=require(_0xcd34('0x6'));var fs=require('fs');var path=require(_0xcd34('0x7'));var rimraf=require(_0xcd34('0x8'));var config=require(_0xcd34('0x9'));var attributes=require('./action.attributes');module[_0xcd34('0xa')]=function(_0x2852e4,_0x4df05f){return _0x2852e4[_0xcd34('0xb')]('Action',attributes,{'tableName':_0xcd34('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9605=['define','Action','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./action.attributes'];(function(_0x3f3a34,_0x3456ef){var _0x27328b=function(_0x36cf83){while(--_0x36cf83){_0x3f3a34['push'](_0x3f3a34['shift']());}};_0x27328b(++_0x3456ef);}(_0x9605,0xde));var _0x5960=function(_0x18ff1f,_0x4cb2c0){_0x18ff1f=_0x18ff1f-0x0;var _0x3c67fa=_0x9605[_0x18ff1f];return _0x3c67fa;};'use strict';var _=require(_0x5960('0x0'));var util=require('util');var logger=require(_0x5960('0x1'))('api');var moment=require(_0x5960('0x2'));var BPromise=require(_0x5960('0x3'));var rp=require(_0x5960('0x4'));var fs=require('fs');var path=require(_0x5960('0x5'));var rimraf=require(_0x5960('0x6'));var config=require(_0x5960('0x7'));var attributes=require(_0x5960('0x8'));module['exports']=function(_0x57d502,_0x1e4248){return _0x57d502[_0x5960('0x9')](_0x5960('0xa'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index 0e9e55c..93d27d0 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 _0xabce=['util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0xab6372,_0x3daf3d){var _0x83504f=function(_0x121113){while(--_0x121113){_0xab6372['push'](_0xab6372['shift']());}};_0x83504f(++_0x3daf3d);}(_0xabce,0x103));var _0xeabc=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xabce[_0x54d4fe];return _0x1ab5bb;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var moment=require(_0xeabc('0x2'));var BPromise=require(_0xeabc('0x3'));var rs=require(_0xeabc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xeabc('0x5'));var logger=require(_0xeabc('0x6'))(_0xeabc('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xeabc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x229ba4,_0x52ede8,_0x3bdc29){return new BPromise(function(_0x9417af,_0x8434c5){return client['request'](_0x229ba4,_0x3bdc29)[_0xeabc('0x9')](function(_0x341f16){logger[_0xeabc('0xa')](_0xeabc('0xb'),_0x52ede8,_0xeabc('0xc'));logger[_0xeabc('0xd')](_0xeabc('0xe'),_0x52ede8,_0xeabc('0xc'),JSON[_0xeabc('0xf')](_0x341f16));if(_0x341f16[_0xeabc('0x10')]){if(_0x341f16[_0xeabc('0x10')][_0xeabc('0x11')]===0x1f4){logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);return _0x8434c5(_0x341f16['error'][_0xeabc('0x12')]);}logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16['error']['message']);return _0x9417af(_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);}else{logger[_0xeabc('0xa')]('Action,\x20%s,\x20%s',_0x52ede8,_0xeabc('0xc'));_0x9417af(_0x341f16[_0xeabc('0x13')]['message']);}})['catch'](function(_0x10fa8e){logger['error'](_0xeabc('0xb'),_0x52ede8,_0x10fa8e);_0x8434c5(_0x10fa8e);});});} \ No newline at end of file +var _0x7217=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Action,\x20%s,\x20%s','debug','Action,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x397cfb,_0xb8f317){var _0x15fed9=function(_0x3eba43){while(--_0x3eba43){_0x397cfb['push'](_0x397cfb['shift']());}};_0x15fed9(++_0xb8f317);}(_0x7217,0x19e));var _0x7721=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0x7217[_0x37c22c];return _0x119d79;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var moment=require(_0x7721('0x1'));var BPromise=require(_0x7721('0x2'));var rs=require(_0x7721('0x3'));var fs=require('fs');var Redis=require(_0x7721('0x4'));var db=require(_0x7721('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7721('0x6'));var config=require(_0x7721('0x7'));var jayson=require(_0x7721('0x8'));var client=jayson[_0x7721('0x9')][_0x7721('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf7ff37,_0x18ab6b,_0x21f680){return new BPromise(function(_0x225610,_0x2f99ed){return client[_0x7721('0xb')](_0xf7ff37,_0x21f680)[_0x7721('0xc')](function(_0xfa8835){logger[_0x7721('0xd')](_0x7721('0xe'),_0x18ab6b,'request\x20sent');logger[_0x7721('0xf')](_0x7721('0x10'),_0x18ab6b,_0x7721('0x11'),JSON[_0x7721('0x12')](_0xfa8835));if(_0xfa8835[_0x7721('0x13')]){if(_0xfa8835[_0x7721('0x13')][_0x7721('0x14')]===0x1f4){logger[_0x7721('0x13')]('Action,\x20%s,\x20%s',_0x18ab6b,_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);return _0x2f99ed(_0xfa8835['error'][_0x7721('0x15')]);}logger[_0x7721('0x13')](_0x7721('0xe'),_0x18ab6b,_0xfa8835[_0x7721('0x13')]['message']);return _0x225610(_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);}else{logger['info']('Action,\x20%s,\x20%s',_0x18ab6b,'request\x20sent');_0x225610(_0xfa8835[_0x7721('0x16')][_0x7721('0x15')]);}})[_0x7721('0x17')](function(_0x32550d){logger['error'](_0x7721('0xe'),_0x18ab6b,_0x32550d);_0x2f99ed(_0x32550d);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 9778cfa..db2260a 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 _0x934e=['put','/:id','isAuthenticated','update','destroy','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./action.controller'];(function(_0x5245bc,_0x55e740){var _0x2acb9a=function(_0x4fd1e6){while(--_0x4fd1e6){_0x5245bc['push'](_0x5245bc['shift']());}};_0x2acb9a(++_0x55e740);}(_0x934e,0x165));var _0xe934=function(_0xb0c93e,_0x4988ee){_0xb0c93e=_0xb0c93e-0x0;var _0x30c74b=_0x934e[_0xb0c93e];return _0x30c74b;};'use strict';var multer=require(_0xe934('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe934('0x1'));var express=require(_0xe934('0x2'));var router=express['Router']();var fs_extra=require(_0xe934('0x3'));var auth=require(_0xe934('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe934('0x5'));var controller=require(_0xe934('0x6'));router[_0xe934('0x7')](_0xe934('0x8'),auth[_0xe934('0x9')](),controller[_0xe934('0xa')]);router['delete'](_0xe934('0x8'),auth[_0xe934('0x9')](),controller[_0xe934('0xb')]);module[_0xe934('0xc')]=router; \ No newline at end of file +var _0x8246=['exports','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','./action.controller','put','isAuthenticated','delete','/:id','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8246,0x9d));var _0x6824=function(_0x32855c,_0x1733cb){_0x32855c=_0x32855c-0x0;var _0x783e1c=_0x8246[_0x32855c];return _0x783e1c;};'use strict';var multer=require(_0x6824('0x0'));var util=require(_0x6824('0x1'));var path=require('path');var timeout=require(_0x6824('0x2'));var express=require(_0x6824('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6824('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6824('0x5'));var controller=require(_0x6824('0x6'));router[_0x6824('0x7')]('/:id',auth[_0x6824('0x8')](),controller['update']);router[_0x6824('0x9')](_0x6824('0xa'),auth[_0x6824('0x8')](),controller[_0x6824('0xb')]);module[_0x6824('0xc')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 3c4d348..ae92a6a 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 _0xdbf5=['exports','STRING','TEXT'];(function(_0x54ebca,_0x5bc67e){var _0x5b432a=function(_0x441caa){while(--_0x441caa){_0x54ebca['push'](_0x54ebca['shift']());}};_0x5b432a(++_0x5bc67e);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x2d6d3b,_0x2fac6e){_0x2d6d3b=_0x2d6d3b-0x0;var _0x398948=_0xdbf5[_0x2d6d3b];return _0x398948;};'use strict';var Sequelize=require('sequelize');module[_0x5dbf('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x5dbf('0x1')]},'table':{'type':Sequelize[_0x5dbf('0x1')]},'conditions':{'type':Sequelize[_0x5dbf('0x2')]},'joins':{'type':Sequelize[_0x5dbf('0x2')]}}; \ No newline at end of file +var _0xda19=['exports','STRING','TEXT'];(function(_0x4a1195,_0x253862){var _0x360fa1=function(_0x207882){while(--_0x207882){_0x4a1195['push'](_0x4a1195['shift']());}};_0x360fa1(++_0x253862);}(_0xda19,0xd5));var _0x9da1=function(_0x152240,_0x4da254){_0x152240=_0x152240-0x0;var _0x48da00=_0xda19[_0x152240];return _0x48da00;};'use strict';var Sequelize=require('sequelize');module[_0x9da1('0x0')]={'name':{'type':Sequelize[_0x9da1('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x9da1('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x9da1('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index f7e9780..32046bd 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 _0x4034=['foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','join','cross_join','SUM(%s)','MIN(%s)','AVG(%s)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','operator','MetricId','output','web','randomstring','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','../../components/export/','savename','COUNT(*)','run','runReport','GROUP_CONCAT(%s)','Sequelize','DESC','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','lodash','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','dbH','status','end','json','limit','undefined','count','Content-Range','reject','save','then','destroy','get','CustomReports','error','stack','name','send','index','map','AnalyticCustomReport','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','filter','where','VIRTUAL','merge','options','includeAll','catch','keys','rawAttributes','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Reports','find','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','preview','left_join','right_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','HOUR(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','select','from','table','metric','replace','function','format','groupBy','orderBy','alias','joins','parse','includes','parentKey'];(function(_0x1d994b,_0x400019){var _0x5af338=function(_0x549672){while(--_0x549672){_0x1d994b['push'](_0x1d994b['shift']());}};_0x5af338(++_0x400019);}(_0x4034,0x166));var _0x4403=function(_0x2b441f,_0x249bac){_0x2b441f=_0x2b441f-0x0;var _0x1cc771=_0x4034[_0x2b441f];return _0x1cc771;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4403('0x0'));var zipdir=require(_0x4403('0x1'));var jsonpatch=require(_0x4403('0x2'));var rp=require('request-promise');var moment=require(_0x4403('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4403('0x4'));var util=require(_0x4403('0x5'));var path=require('path');var sox=require(_0x4403('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4403('0x7'));var squel=require('squel');var crypto=require(_0x4403('0x8'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4403('0x9'));var Redis=require(_0x4403('0xa'));var authService=require(_0x4403('0xb'));var qs=require(_0x4403('0xc'));var as=require(_0x4403('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4403('0xe'))(_0x4403('0xf'));var utils=require(_0x4403('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x4403('0x11'));var db=require(_0x4403('0x12'))['db'];var dbH=require(_0x4403('0x12'))[_0x4403('0x13')];function respondWithStatusCode(_0x1309d8,_0x48ee68){_0x48ee68=_0x48ee68||0xcc;return function(_0x192dc8){if(_0x192dc8){return _0x1309d8['sendStatus'](_0x48ee68);}return _0x1309d8[_0x4403('0x14')](_0x48ee68)[_0x4403('0x15')]();};}function respondWithResult(_0x4f7d51,_0x712752){_0x712752=_0x712752||0xc8;return function(_0x23148e){if(_0x23148e){return _0x4f7d51[_0x4403('0x14')](_0x712752)[_0x4403('0x16')](_0x23148e);}};}function respondWithFilteredResult(_0x339b67,_0xee64a6){return function(_0x1086fb){if(_0x1086fb){var _0x1a247b=typeof _0xee64a6['offset']==='undefined'&&typeof _0xee64a6[_0x4403('0x17')]===_0x4403('0x18');var _0x5ed2dc=_0x1086fb[_0x4403('0x19')];var _0x2be877=_0x1a247b?0x0:_0xee64a6['offset'];var _0x57bd36=_0x1a247b?_0x1086fb[_0x4403('0x19')]:_0xee64a6['offset']+_0xee64a6[_0x4403('0x17')];var _0x275d33;if(_0x57bd36>=_0x5ed2dc){_0x57bd36=_0x5ed2dc;_0x275d33=0xc8;}else{_0x275d33=0xce;}_0x339b67[_0x4403('0x14')](_0x275d33);return _0x339b67['set'](_0x4403('0x1a'),_0x2be877+'-'+_0x57bd36+'/'+_0x5ed2dc)[_0x4403('0x16')](_0x1086fb);}return null;};}function patchUpdates(_0x4d5fda){return function(_0x3d615b){try{jsonpatch['apply'](_0x3d615b,_0x4d5fda,!![]);}catch(_0x3f4b0b){return BPromise[_0x4403('0x1b')](_0x3f4b0b);}return _0x3d615b[_0x4403('0x1c')]();};}function saveUpdates(_0x11f975,_0x2f7809){return function(_0x22f964){if(_0x22f964){return _0x22f964['update'](_0x11f975)[_0x4403('0x1d')](function(_0x34a5e9){return _0x34a5e9;});}return null;};}function removeEntity(_0x2f8f91,_0x1c549a){return function(_0x132cf3){if(_0x132cf3){return _0x132cf3[_0x4403('0x1e')]()['then'](function(){var _0x5e4e60=_0x132cf3[_0x4403('0x1f')]({'plain':!![]});var _0x468db5=_0x4403('0x20');return db['UserProfileResource'][_0x4403('0x1e')]({'where':{'type':_0x468db5,'resourceId':_0x5e4e60['id']}})['then'](function(){return _0x132cf3;});})['then'](function(){_0x2f8f91['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ef7a6,_0x3d6c96){return function(_0x5998c6){if(!_0x5998c6){_0x4ef7a6['sendStatus'](0x194);}return _0x5998c6;};}function handleError(_0x4b2fe8,_0x24b8a5){_0x24b8a5=_0x24b8a5||0x1f4;return function(_0xf5a7f){logger[_0x4403('0x21')](_0xf5a7f[_0x4403('0x22')]);if(_0xf5a7f['name']){delete _0xf5a7f[_0x4403('0x23')];}_0x4b2fe8[_0x4403('0x14')](_0x24b8a5)[_0x4403('0x24')](_0xf5a7f);};}exports[_0x4403('0x25')]=function(_0x3edc56,_0x511eb6){var _0x4f7424={},_0x121a5c={},_0x104203={'count':0x0,'rows':[]};var _0x398ef0=_[_0x4403('0x26')](db[_0x4403('0x27')]['rawAttributes'],function(_0x5ec6a9){return{'name':_0x5ec6a9['fieldName'],'type':_0x5ec6a9[_0x4403('0x28')][_0x4403('0x29')]};});_0x121a5c[_0x4403('0x2a')]=_[_0x4403('0x26')](_0x398ef0,'name');_0x121a5c[_0x4403('0x2b')]=_['keys'](_0x3edc56[_0x4403('0x2b')]);_0x121a5c[_0x4403('0x2c')]=_[_0x4403('0x2d')](_0x121a5c[_0x4403('0x2a')],_0x121a5c[_0x4403('0x2b')]);_0x4f7424[_0x4403('0x2e')]=_['intersection'](_0x121a5c[_0x4403('0x2a')],qs[_0x4403('0x2f')](_0x3edc56[_0x4403('0x2b')][_0x4403('0x2f')]));_0x4f7424[_0x4403('0x2e')]=_0x4f7424['attributes'][_0x4403('0x30')]?_0x4f7424[_0x4403('0x2e')]:_0x121a5c[_0x4403('0x2a')];if(!_0x3edc56[_0x4403('0x2b')][_0x4403('0x31')](_0x4403('0x32'))){_0x4f7424[_0x4403('0x17')]=qs[_0x4403('0x17')](_0x3edc56['query'][_0x4403('0x17')]);_0x4f7424['offset']=qs[_0x4403('0x33')](_0x3edc56[_0x4403('0x2b')]['offset']);}_0x4f7424[_0x4403('0x34')]=qs[_0x4403('0x35')](_0x3edc56[_0x4403('0x2b')][_0x4403('0x35')]);_0x4f7424['where']=qs[_0x4403('0x2c')](_['pick'](_0x3edc56[_0x4403('0x2b')],_0x121a5c['filters']),_0x398ef0);if(_0x3edc56[_0x4403('0x2b')][_0x4403('0x36')]){_0x4f7424[_0x4403('0x37')]=_['merge'](_0x4f7424[_0x4403('0x37')],{'$or':_[_0x4403('0x26')](_0x398ef0,function(_0x2117b3){if(_0x2117b3[_0x4403('0x28')]!==_0x4403('0x38')){var _0x4d5b32={};_0x4d5b32[_0x2117b3[_0x4403('0x23')]]={'$like':'%'+_0x3edc56[_0x4403('0x2b')][_0x4403('0x36')]+'%'};return _0x4d5b32;}})});}_0x4f7424=_[_0x4403('0x39')]({},_0x4f7424,_0x3edc56[_0x4403('0x3a')]);var _0x51ce1b={'where':_0x4f7424[_0x4403('0x37')]};return db[_0x4403('0x27')][_0x4403('0x19')](_0x51ce1b)['then'](function(_0x574b28){_0x104203[_0x4403('0x19')]=_0x574b28;if(_0x3edc56[_0x4403('0x2b')][_0x4403('0x3b')]){_0x4f7424['include']=[{'all':!![]}];}return db['AnalyticCustomReport']['findAll'](_0x4f7424);})[_0x4403('0x1d')](function(_0x5d907d){_0x104203['rows']=_0x5d907d;return _0x104203;})[_0x4403('0x1d')](respondWithFilteredResult(_0x511eb6,_0x4f7424))[_0x4403('0x3c')](handleError(_0x511eb6,null));};exports['show']=function(_0x4d3b30,_0x17871c){var _0x9cecb5={'raw':![],'where':{'id':_0x4d3b30['params']['id']}},_0x245f4e={};_0x245f4e[_0x4403('0x2a')]=_[_0x4403('0x3d')](db[_0x4403('0x27')][_0x4403('0x3e')]);_0x245f4e[_0x4403('0x2b')]=_[_0x4403('0x3d')](_0x4d3b30['query']);_0x245f4e[_0x4403('0x2c')]=_['intersection'](_0x245f4e[_0x4403('0x2a')],_0x245f4e['query']);_0x9cecb5[_0x4403('0x2e')]=_[_0x4403('0x2d')](_0x245f4e[_0x4403('0x2a')],qs[_0x4403('0x2f')](_0x4d3b30[_0x4403('0x2b')][_0x4403('0x2f')]));_0x9cecb5['attributes']=_0x9cecb5[_0x4403('0x2e')][_0x4403('0x30')]?_0x9cecb5[_0x4403('0x2e')]:_0x245f4e[_0x4403('0x2a')];if(_0x4d3b30[_0x4403('0x2b')]['includeAll']){_0x9cecb5['include']=[{'all':!![]}];}_0x9cecb5=_['merge']({},_0x9cecb5,_0x4d3b30[_0x4403('0x3a')]);return db[_0x4403('0x27')]['find'](_0x9cecb5)[_0x4403('0x1d')](handleEntityNotFound(_0x17871c,null))[_0x4403('0x1d')](respondWithResult(_0x17871c,null))['catch'](handleError(_0x17871c,null));};exports[_0x4403('0x3f')]=function(_0x448845,_0x9cbcf7){return db['AnalyticCustomReport'][_0x4403('0x3f')](_0x448845[_0x4403('0x40')],{})[_0x4403('0x1d')](function(_0x244d3b){var _0x392972=_0x448845['user']['get']({'plain':!![]});if(!_0x392972)throw new Error(_0x4403('0x41'));if(_0x392972['role']===_0x4403('0x42')){var _0x2fa8a1=_0x244d3b[_0x4403('0x1f')]({'plain':!![]});var _0x102bc4=_0x4403('0x43');return db['UserProfileSection'][_0x4403('0x44')]({'where':{'name':_0x102bc4,'userProfileId':_0x392972['userProfileId']},'raw':!![]})[_0x4403('0x1d')](function(_0x1c0694){if(_0x1c0694&&_0x1c0694[_0x4403('0x45')]===0x0){return db[_0x4403('0x46')][_0x4403('0x3f')]({'name':_0x2fa8a1[_0x4403('0x23')],'resourceId':_0x2fa8a1['id'],'type':_0x4403('0x20'),'sectionId':_0x1c0694['id']},{})[_0x4403('0x1d')](function(){return _0x244d3b;});}else{return _0x244d3b;}})[_0x4403('0x3c')](function(_0x3138a3){logger[_0x4403('0x21')](_0x4403('0x47'),_0x3138a3);throw _0x3138a3;});}return _0x244d3b;})[_0x4403('0x1d')](respondWithResult(_0x9cbcf7,0xc9))['catch'](handleError(_0x9cbcf7,null));};exports[_0x4403('0x48')]=function(_0x1e28eb,_0x243619){if(_0x1e28eb[_0x4403('0x40')]['id']){delete _0x1e28eb[_0x4403('0x40')]['id'];}return db[_0x4403('0x27')][_0x4403('0x44')]({'where':{'id':_0x1e28eb['params']['id']}})[_0x4403('0x1d')](handleEntityNotFound(_0x243619,null))[_0x4403('0x1d')](saveUpdates(_0x1e28eb[_0x4403('0x40')],null))[_0x4403('0x1d')](respondWithResult(_0x243619,null))[_0x4403('0x3c')](handleError(_0x243619,null));};exports[_0x4403('0x1e')]=function(_0x181e47,_0x13f0bf){return db[_0x4403('0x27')]['find']({'where':{'id':_0x181e47[_0x4403('0x49')]['id']}})[_0x4403('0x1d')](handleEntityNotFound(_0x13f0bf,null))[_0x4403('0x1d')](removeEntity(_0x13f0bf,null))[_0x4403('0x3c')](handleError(_0x13f0bf,null));};exports[_0x4403('0x4a')]=function(_0x14453d,_0x38703c){var _0x47fa7b=0xa;var _0xc80a2c=['join',_0x4403('0x4b'),_0x4403('0x4c'),'cross_join'];var _0x907316={'SUM':'SUM(%s)','COUNT':_0x4403('0x4d'),'COUNT DISTINCT':_0x4403('0x4e'),'MAX':_0x4403('0x4f'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x4403('0x50'),'GROUP_CONCAT DESC':_0x4403('0x51')};var _0x597cf2={'SEC_TO_TIME':_0x4403('0x52'),'DATE':'DATE(%s)','HOUR':_0x4403('0x53'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1d3620=function(_0x253212){return!_['includes']([_0x4403('0x54'),_0x4403('0x55'),_0x4403('0x56'),_0x4403('0x57')],_0x253212);};var _0x4935a9=function(_0x83973b){if(!_0x83973b||!_0x83973b[_0x4403('0x58')]['length']){return'';}for(var _0x3343ab='(',_0xec83d6=0x0;_0xec83d6<_0x83973b['rules'][_0x4403('0x30')];_0xec83d6+=0x1){_0xec83d6>0x0&&(_0x3343ab+='\x20'+_0x83973b['operator']+'\x20');_0x3343ab+=_0x83973b[_0x4403('0x58')][_0xec83d6][_0x4403('0x59')]?_0x4935a9(_0x83973b['rules'][_0xec83d6][_0x4403('0x59')]):_0x83973b[_0x4403('0x58')][_0xec83d6][_0x4403('0x5a')]+'\x20'+_0x83973b[_0x4403('0x58')][_0xec83d6]['condition']+(_0x1d3620(_0x83973b[_0x4403('0x58')][_0xec83d6][_0x4403('0x5b')])?'\x20'+_0x83973b['rules'][_0xec83d6][_0x4403('0x5c')]:'');}return _0x3343ab+')';};var _0x5c9d7c={'where':{'id':_0x14453d[_0x4403('0x49')]['id']}},_0x19b872,_0x1d571f,_0x43305a,_0x38428d,_0x1ed127;_0x5c9d7c=_[_0x4403('0x39')]({},_0x5c9d7c,_0x14453d[_0x4403('0x3a')]);return db['AnalyticCustomReport'][_0x4403('0x44')](_0x5c9d7c)[_0x4403('0x1d')](function(_0x4b80f1){if(_0x4b80f1){_0x19b872=_0x4b80f1;return _0x4b80f1[_0x4403('0x5d')]();}return null;})[_0x4403('0x1d')](function(_0x205710){if(_0x205710){if(!_0x205710[_0x4403('0x30')]){throw new db['Sequelize'][(_0x4403('0x5e'))](_0x4403('0x5f'),0x193);}_0x1d571f=_0x205710;return db[_0x4403('0x60')][_0x4403('0x61')]({'raw':!![]});}return null;})['then'](function(_0x3bf115){if(_0x3bf115){_0x43305a=_[_0x4403('0x62')](_0x3bf115,'id');var _0x28f28f;var _0x58b3fc=squel[_0x4403('0x63')]();_0x58b3fc[_0x4403('0x64')](_0x19b872[_0x4403('0x65')]);for(var _0x47e14c=0x0;_0x47e14c<_0x1d571f[_0x4403('0x30')];_0x47e14c+=0x1){_0x28f28f=_0x1d571f[_0x47e14c]['MetricId']?_0x43305a[_0x1d571f[_0x47e14c]['MetricId']][_0x4403('0x66')]:_0x1d571f[_0x47e14c][_0x4403('0x5a')];_0x28f28f=_0x1d571f[_0x47e14c]['function']?_[_0x4403('0x67')](_0x907316[_0x1d571f[_0x47e14c][_0x4403('0x68')]],'%s',_0x28f28f):_0x28f28f;_0x28f28f=_0x1d571f[_0x47e14c][_0x4403('0x69')]?_[_0x4403('0x67')](_0x597cf2[_0x1d571f[_0x47e14c][_0x4403('0x69')]],'%s',_0x28f28f):_0x28f28f;if(_0x1d571f[_0x47e14c][_0x4403('0x6a')]){_0x58b3fc[_0x4403('0x59')](_0x28f28f);}_0x1d571f[_0x47e14c][_0x4403('0x6b')]&&_0x58b3fc['order'](_0x28f28f,_0x1d571f[_0x47e14c]['orderBy']==='DESC'?![]:!![]);_0x58b3fc[_0x4403('0x5a')](_0x28f28f,_0x1d571f[_0x47e14c][_0x4403('0x6c')]||_0x28f28f);}if(_0x19b872[_0x4403('0x6d')]){_0x19b872['joins']=JSON[_0x4403('0x6e')](_0x19b872[_0x4403('0x6d')]);for(var _0x58688f=0x0;_0x58688f<_0x19b872[_0x4403('0x6d')][_0x4403('0x30')];_0x58688f+=0x1){if(_0x19b872['joins'][_0x58688f][_0x4403('0x28')]&&_[_0x4403('0x6f')](_0xc80a2c,_0x19b872[_0x4403('0x6d')][_0x58688f]['type'])&&_0x19b872[_0x4403('0x6d')][_0x58688f][_0x4403('0x70')]&&_0x19b872[_0x4403('0x6d')][_0x58688f][_0x4403('0x71')]&&_0x19b872['joins'][_0x58688f][_0x4403('0x72')]){_0x58b3fc[_0x19b872[_0x4403('0x6d')][_0x58688f][_0x4403('0x28')]](_0x19b872['joins'][_0x58688f][_0x4403('0x71')],null,util[_0x4403('0x69')](_0x4403('0x73'),_0x19b872[_0x4403('0x65')],_0x19b872[_0x4403('0x6d')][_0x58688f][_0x4403('0x70')],_0x19b872[_0x4403('0x6d')][_0x58688f][_0x4403('0x71')],_0x19b872[_0x4403('0x6d')][_0x58688f][_0x4403('0x72')]));}}}if(_0x19b872[_0x4403('0x74')]){_0x19b872[_0x4403('0x74')]=JSON[_0x4403('0x6e')](_0x19b872[_0x4403('0x74')]);_0x58b3fc[_0x4403('0x37')](_0x4935a9(_0x19b872[_0x4403('0x74')][_0x4403('0x59')]));}_0x1ed127=_0x58b3fc[_0x4403('0x75')]();_0x58b3fc['limit'](_0x47fa7b);_0x58b3fc[_0x4403('0x33')](0x0);logger[_0x4403('0x76')](_0x4403('0x77'),_0x58b3fc['toString']());return dbH[_0x4403('0x78')][_0x4403('0x2b')](_0x58b3fc[_0x4403('0x79')](),{'type':dbH['sequelize'][_0x4403('0x7a')][_0x4403('0x7b')]});}})[_0x4403('0x1d')](respondWithResult(_0x38703c,null))[_0x4403('0x3c')](handleError(_0x38703c,null));};function runReport(_0x3a8bd7,_0x19101a,_0x1f2ba0){var _0x219810=_0x19101a['name'];var _0x401478=0xa;var _0x4abcf8=[_0x4403('0x7c'),'left_join','right_join',_0x4403('0x7d')];var _0x318132={'SUM':_0x4403('0x7e'),'COUNT':_0x4403('0x4d'),'COUNT DISTINCT':_0x4403('0x4e'),'MAX':_0x4403('0x4f'),'MIN':_0x4403('0x7f'),'AVG':_0x4403('0x80'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x4403('0x50'),'GROUP_CONCAT DESC':_0x4403('0x51')};var _0x25b6c5={'SEC_TO_TIME':_0x4403('0x52'),'DATE':_0x4403('0x81'),'HOUR':_0x4403('0x53'),'ROUND':_0x4403('0x82'),'UNIX_TIMESTAMP':_0x4403('0x83')};var _0x569501=function(_0x54226a){return!_[_0x4403('0x6f')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x4403('0x56'),_0x4403('0x57')],_0x54226a);};var _0x535a26=function(_0x37ce6b){if(!_0x37ce6b||!_0x37ce6b[_0x4403('0x58')][_0x4403('0x30')]){return'';}for(var _0x426ad8='(',_0x566e3a=0x0;_0x566e3a<_0x37ce6b['rules'][_0x4403('0x30')];_0x566e3a+=0x1){_0x566e3a>0x0&&(_0x426ad8+='\x20'+_0x37ce6b[_0x4403('0x84')]+'\x20');_0x426ad8+=_0x37ce6b[_0x4403('0x58')][_0x566e3a]['group']?_0x535a26(_0x37ce6b['rules'][_0x566e3a][_0x4403('0x59')]):_0x37ce6b[_0x4403('0x58')][_0x566e3a][_0x4403('0x5a')]+'\x20'+_0x37ce6b[_0x4403('0x58')][_0x566e3a][_0x4403('0x5b')]+(_0x569501(_0x37ce6b['rules'][_0x566e3a][_0x4403('0x5b')])?'\x20'+_0x37ce6b[_0x4403('0x58')][_0x566e3a]['value']:'');}return _0x426ad8+')';};var _0x194276={'where':{'id':_0x3a8bd7['id']}},_0x11165c,_0x15f8e0,_0x18cb29,_0x5ee8db,_0x4a430c;_0x194276=_[_0x4403('0x39')]({},_0x194276,_0x1f2ba0);return db['AnalyticCustomReport'][_0x4403('0x44')](_0x194276)[_0x4403('0x1d')](function(_0x2d345a){if(_0x2d345a){_0x11165c=_0x2d345a;return _0x2d345a[_0x4403('0x5d')]();}return null;})['then'](function(_0x11d125){if(_0x11d125){if(!_0x11d125[_0x4403('0x30')]){throw new db['Sequelize'][(_0x4403('0x5e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x15f8e0=_0x11d125;return db[_0x4403('0x60')][_0x4403('0x61')]({'raw':!![]});}return null;})['then'](function(_0x551e2d){if(_0x551e2d){_0x18cb29=_['keyBy'](_0x551e2d,'id');var _0x1da879;var _0x540211=squel[_0x4403('0x63')]();_0x540211[_0x4403('0x64')](_0x11165c[_0x4403('0x65')]);for(var _0x827bd9=0x0;_0x827bd9<_0x15f8e0[_0x4403('0x30')];_0x827bd9+=0x1){_0x1da879=_0x15f8e0[_0x827bd9][_0x4403('0x85')]?_0x18cb29[_0x15f8e0[_0x827bd9]['MetricId']][_0x4403('0x66')]:_0x15f8e0[_0x827bd9]['field'];_0x1da879=_0x15f8e0[_0x827bd9][_0x4403('0x68')]?_[_0x4403('0x67')](_0x318132[_0x15f8e0[_0x827bd9][_0x4403('0x68')]],'%s',_0x1da879):_0x1da879;_0x1da879=_0x15f8e0[_0x827bd9][_0x4403('0x69')]?_[_0x4403('0x67')](_0x25b6c5[_0x15f8e0[_0x827bd9][_0x4403('0x69')]],'%s',_0x1da879):_0x1da879;if(_0x15f8e0[_0x827bd9]['groupBy']){_0x540211[_0x4403('0x59')](_0x1da879);}_0x15f8e0[_0x827bd9][_0x4403('0x6b')]&&_0x540211[_0x4403('0x34')](_0x1da879,_0x15f8e0[_0x827bd9]['orderBy']==='DESC'?![]:!![]);_0x540211[_0x4403('0x5a')](_0x1da879,_0x15f8e0[_0x827bd9][_0x4403('0x6c')]||_0x1da879);}if(_0x11165c[_0x4403('0x6d')]){_0x11165c[_0x4403('0x6d')]=JSON[_0x4403('0x6e')](_0x11165c[_0x4403('0x6d')]);for(var _0x2255cb=0x0;_0x2255cb<_0x11165c['joins'][_0x4403('0x30')];_0x2255cb+=0x1){if(_0x11165c['joins'][_0x2255cb][_0x4403('0x28')]&&_[_0x4403('0x6f')](_0x4abcf8,_0x11165c['joins'][_0x2255cb][_0x4403('0x28')])&&_0x11165c[_0x4403('0x6d')][_0x2255cb]['parentKey']&&_0x11165c['joins'][_0x2255cb]['foreignTable']&&_0x11165c[_0x4403('0x6d')][_0x2255cb]['foreignKey']){_0x540211[_0x11165c[_0x4403('0x6d')][_0x2255cb][_0x4403('0x28')]](_0x11165c[_0x4403('0x6d')][_0x2255cb][_0x4403('0x71')],null,util[_0x4403('0x69')]('%s.%s\x20=\x20%s.%s',_0x11165c[_0x4403('0x65')],_0x11165c[_0x4403('0x6d')][_0x2255cb][_0x4403('0x70')],_0x11165c[_0x4403('0x6d')][_0x2255cb]['foreignTable'],_0x11165c[_0x4403('0x6d')][_0x2255cb]['foreignKey']));}}}if(_0x11165c[_0x4403('0x74')]){_0x11165c['conditions']=JSON['parse'](_0x11165c[_0x4403('0x74')]);_0x540211[_0x4403('0x37')](_0x535a26(_0x11165c['conditions'][_0x4403('0x59')]));}_0x4a430c=_0x540211[_0x4403('0x75')]();_0x540211['limit'](_0x401478);_0x540211['offset'](0x0);return;}})[_0x4403('0x1d')](function(){if(_0x19101a[_0x4403('0x86')]===_0x4403('0x87')){return null;}var _0x3cc0ac=_['merge'](_0x19101a,{'name':_0x19101a['fullPath']||_0x19101a[_0x4403('0x23')]||_0x11165c[_0x4403('0x23')],'basename':_0x219810,'savename':util[_0x4403('0x69')]('%s-%s.%s',_0x19101a[_0x4403('0x23')]||_0x11165c['name'],require(_0x4403('0x88'))[_0x4403('0x89')](0x4),_0x19101a[_0x4403('0x86')]||_0x4403('0x8a')),'reportId':_0x11165c['id'],'reportType':_0x4403('0x8b')});return db[_0x4403('0x8c')][_0x4403('0x3f')](_0x3cc0ac,{'raw':!![]});})[_0x4403('0x1d')](function(_0x52e0ad){if(_0x11165c['table']===_0x4403('0x8d')){_0x4a430c[_0x4403('0x37')](_0x11165c[_0x4403('0x65')]+_0x4403('0x8e'),_0x19101a[_0x4403('0x8f')],_0x19101a[_0x4403('0x90')]);}else{_0x4a430c['where'](_0x11165c[_0x4403('0x65')]+_0x4403('0x91'),_0x19101a[_0x4403('0x8f')],_0x19101a[_0x4403('0x90')]);}if(_0x52e0ad){logger[_0x4403('0x92')](_0x4403('0x93'),_0x4a430c[_0x4403('0x79')]());require(_0x4403('0x94'))['fork'](path['join'](__dirname,_0x4403('0x95'),_0x52e0ad['output']),[_0x52e0ad['id'],_0x4a430c[_0x4403('0x79')](),path[_0x4403('0x7c')](__dirname,'../../files/reports',_0x52e0ad[_0x4403('0x96')]),_0x219810]);return _0x52e0ad;}else{var _0x397b09=squel[_0x4403('0x63')]();_0x397b09[_0x4403('0x64')]('('+_0x4a430c[_0x4403('0x79')]()+')','countTable');_0x397b09['field'](_0x4403('0x97'),_0x4403('0x19'));_0x4a430c[_0x4403('0x17')](_0x19101a[_0x4403('0x17')]||_0x401478);_0x4a430c[_0x4403('0x33')](_0x19101a[_0x4403('0x33')]||0x0);return dbH[_0x4403('0x78')]['query'](_0x397b09['toString'](),{'type':dbH[_0x4403('0x78')][_0x4403('0x7a')][_0x4403('0x7b')]})[_0x4403('0x1d')](function(_0x514d93){if(!_0x514d93[_0x4403('0x30')]){_0x5ee8db=0x0;}else{_0x5ee8db=_0x514d93[0x0][_0x4403('0x19')]||0x0;}return dbH[_0x4403('0x78')][_0x4403('0x2b')](_0x4a430c[_0x4403('0x79')](),{'type':dbH[_0x4403('0x78')][_0x4403('0x7a')][_0x4403('0x7b')]});})[_0x4403('0x1d')](function(_0x121bd6){return{'rows':_0x121bd6||[],'count':_0x5ee8db};});}});}exports[_0x4403('0x98')]=function(_0x5e04e2,_0x3d3383){return runReport(_0x5e04e2[_0x4403('0x49')],_0x5e04e2['query'],_0x5e04e2[_0x4403('0x3a')])[_0x4403('0x1d')](respondWithResult(_0x3d3383,null))[_0x4403('0x3c')](handleError(_0x3d3383,null));};exports[_0x4403('0x99')]=runReport;exports[_0x4403('0x2b')]=function(_0x128e11,_0x4877e1){var _0x15f58b=0xa;var _0x4750c1=[_0x4403('0x7c'),_0x4403('0x4b'),_0x4403('0x4c'),'cross_join'];var _0x2d2ac3={'SUM':_0x4403('0x7e'),'COUNT':_0x4403('0x4d'),'COUNT DISTINCT':_0x4403('0x4e'),'MAX':_0x4403('0x4f'),'MIN':_0x4403('0x7f'),'AVG':_0x4403('0x80'),'GROUP_CONCAT':_0x4403('0x9a'),'GROUP_CONCAT ASC':_0x4403('0x50'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x1ba103={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x4403('0x81'),'HOUR':_0x4403('0x53'),'ROUND':_0x4403('0x82'),'UNIX_TIMESTAMP':_0x4403('0x83')};var _0x1dcb23=function(_0x25409b){return!_['includes']([_0x4403('0x54'),_0x4403('0x55'),'IS\x20EMPTY',_0x4403('0x57')],_0x25409b);};var _0x3ee747=function(_0x5be49c){if(!_0x5be49c||!_0x5be49c['rules'][_0x4403('0x30')]){return'';}for(var _0x5ee784='(',_0x313bc6=0x0;_0x313bc6<_0x5be49c['rules'][_0x4403('0x30')];_0x313bc6+=0x1){_0x313bc6>0x0&&(_0x5ee784+='\x20'+_0x5be49c[_0x4403('0x84')]+'\x20');_0x5ee784+=_0x5be49c['rules'][_0x313bc6][_0x4403('0x59')]?_0x3ee747(_0x5be49c[_0x4403('0x58')][_0x313bc6][_0x4403('0x59')]):_0x5be49c['rules'][_0x313bc6][_0x4403('0x5a')]+'\x20'+_0x5be49c[_0x4403('0x58')][_0x313bc6][_0x4403('0x5b')]+(_0x1dcb23(_0x5be49c[_0x4403('0x58')][_0x313bc6]['condition'])?'\x20'+_0x5be49c['rules'][_0x313bc6][_0x4403('0x5c')]:'');}return _0x5ee784+')';};var _0x50fa45={'where':{'id':_0x128e11[_0x4403('0x49')]['id']}},_0x16d70f,_0x1e690b,_0x1d41b0,_0x17a322,_0x1054af;_0x50fa45=_[_0x4403('0x39')]({},_0x50fa45,_0x128e11[_0x4403('0x3a')]);return db['AnalyticCustomReport']['find'](_0x50fa45)['then'](function(_0x1458e2){if(_0x1458e2){_0x16d70f=_0x1458e2;return _0x1458e2['getFields']();}return null;})[_0x4403('0x1d')](function(_0x2c4734){if(_0x2c4734){if(!_0x2c4734[_0x4403('0x30')]){throw new db[(_0x4403('0x9b'))]['ValidationErrorItem'](_0x4403('0x5f'),0x193);}_0x1e690b=_0x2c4734;return db[_0x4403('0x60')][_0x4403('0x61')]({'raw':!![]});}return null;})[_0x4403('0x1d')](function(_0x3523cd){if(_0x3523cd){_0x1d41b0=_['keyBy'](_0x3523cd,'id');var _0x15ca76;var _0x355ad7=squel[_0x4403('0x63')]();_0x355ad7[_0x4403('0x64')](_0x16d70f[_0x4403('0x65')]);for(var _0x4fe8a5=0x0;_0x4fe8a5<_0x1e690b[_0x4403('0x30')];_0x4fe8a5+=0x1){_0x15ca76=_0x1e690b[_0x4fe8a5][_0x4403('0x85')]?_0x1d41b0[_0x1e690b[_0x4fe8a5][_0x4403('0x85')]][_0x4403('0x66')]:_0x1e690b[_0x4fe8a5]['field'];_0x15ca76=_0x1e690b[_0x4fe8a5]['function']?_[_0x4403('0x67')](_0x2d2ac3[_0x1e690b[_0x4fe8a5][_0x4403('0x68')]],'%s',_0x15ca76):_0x15ca76;_0x15ca76=_0x1e690b[_0x4fe8a5][_0x4403('0x69')]?_[_0x4403('0x67')](_0x1ba103[_0x1e690b[_0x4fe8a5]['format']],'%s',_0x15ca76):_0x15ca76;if(_0x1e690b[_0x4fe8a5][_0x4403('0x6a')]){_0x355ad7[_0x4403('0x59')](_0x15ca76);}_0x1e690b[_0x4fe8a5][_0x4403('0x6b')]&&_0x355ad7[_0x4403('0x34')](_0x15ca76,_0x1e690b[_0x4fe8a5][_0x4403('0x6b')]===_0x4403('0x9c')?![]:!![]);_0x355ad7[_0x4403('0x5a')](_0x15ca76,_0x1e690b[_0x4fe8a5]['alias']||_0x15ca76);}if(_0x16d70f[_0x4403('0x6d')]){_0x16d70f[_0x4403('0x6d')]=JSON[_0x4403('0x6e')](_0x16d70f[_0x4403('0x6d')]);for(var _0x3c2c93=0x0;_0x3c2c93<_0x16d70f[_0x4403('0x6d')][_0x4403('0x30')];_0x3c2c93+=0x1){if(_0x16d70f['joins'][_0x3c2c93]['type']&&_[_0x4403('0x6f')](_0x4750c1,_0x16d70f['joins'][_0x3c2c93][_0x4403('0x28')])&&_0x16d70f[_0x4403('0x6d')][_0x3c2c93][_0x4403('0x70')]&&_0x16d70f[_0x4403('0x6d')][_0x3c2c93][_0x4403('0x71')]&&_0x16d70f[_0x4403('0x6d')][_0x3c2c93][_0x4403('0x72')]){_0x355ad7[_0x16d70f[_0x4403('0x6d')][_0x3c2c93][_0x4403('0x28')]](_0x16d70f['joins'][_0x3c2c93][_0x4403('0x71')],null,util[_0x4403('0x69')]('%s.%s\x20=\x20%s.%s',_0x16d70f[_0x4403('0x65')],_0x16d70f[_0x4403('0x6d')][_0x3c2c93]['parentKey'],_0x16d70f['joins'][_0x3c2c93][_0x4403('0x71')],_0x16d70f[_0x4403('0x6d')][_0x3c2c93]['foreignKey']));}}}if(_0x16d70f[_0x4403('0x74')]){_0x16d70f[_0x4403('0x74')]=JSON[_0x4403('0x6e')](_0x16d70f[_0x4403('0x74')]);_0x355ad7['where'](_0x3ee747(_0x16d70f[_0x4403('0x74')]['group']));}_0x1054af=_0x355ad7['clone']();_0x355ad7[_0x4403('0x17')](_0x15f58b);_0x355ad7[_0x4403('0x33')](0x0);logger[_0x4403('0x76')](_0x4403('0x77'),_0x355ad7[_0x4403('0x79')]());return dbH['sequelize'][_0x4403('0x2b')](_0x355ad7[_0x4403('0x79')](),{'type':dbH['sequelize'][_0x4403('0x7a')][_0x4403('0x7b')]});}})[_0x4403('0x1d')](function(){return{'sql':_0x1054af[_0x4403('0x79')]()};})['then'](respondWithResult(_0x4877e1,null))[_0x4403('0x3c')](handleError(_0x4877e1,null));}; \ No newline at end of file +var _0x0c74=['value','clone','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','startDate','fork','../../components/export/','countTable','COUNT(*)','run','runReport','MAX(%s)','AVG(%s)','UNIX_TIMESTAMP(%s)','debug','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','dbH','status','end','undefined','limit','offset','count','set','Content-Range','json','apply','reject','save','update','destroy','then','get','CustomReports','UserProfileResource','error','stack','name','send','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','parse','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','GROUP_CONCAT(%s)','IS\x20EMPTY'];(function(_0x38b14f,_0xd08fa8){var _0x22a324=function(_0x4bbb05){while(--_0x4bbb05){_0x38b14f['push'](_0x38b14f['shift']());}};_0x22a324(++_0xd08fa8);}(_0x0c74,0xc1));var _0x40c7=function(_0x1c60bd,_0x207c9b){_0x1c60bd=_0x1c60bd-0x0;var _0xc46ef9=_0x0c74[_0x1c60bd];return _0xc46ef9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x40c7('0x0'));var zipdir=require(_0x40c7('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x40c7('0x2'));var moment=require(_0x40c7('0x3'));var BPromise=require(_0x40c7('0x4'));var Mustache=require(_0x40c7('0x5'));var util=require('util');var path=require(_0x40c7('0x6'));var sox=require('sox');var csv=require(_0x40c7('0x7'));var ejs=require(_0x40c7('0x8'));var fs=require('fs');var fs_extra=require(_0x40c7('0x9'));var _=require('lodash');var squel=require(_0x40c7('0xa'));var crypto=require(_0x40c7('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x40c7('0xc'));var toCsv=require(_0x40c7('0x7'));var querystring=require(_0x40c7('0xd'));var Papa=require(_0x40c7('0xe'));var Redis=require(_0x40c7('0xf'));var authService=require(_0x40c7('0x10'));var qs=require(_0x40c7('0x11'));var as=require(_0x40c7('0x12'));var hardwareService=require(_0x40c7('0x13'));var logger=require(_0x40c7('0x14'))(_0x40c7('0x15'));var utils=require(_0x40c7('0x16'));var config=require(_0x40c7('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x40c7('0x18'))['db'];var dbH=require('../../mysqldb')[_0x40c7('0x19')];function respondWithStatusCode(_0x164c1,_0x3c86e8){_0x3c86e8=_0x3c86e8||0xcc;return function(_0x302ea4){if(_0x302ea4){return _0x164c1['sendStatus'](_0x3c86e8);}return _0x164c1[_0x40c7('0x1a')](_0x3c86e8)[_0x40c7('0x1b')]();};}function respondWithResult(_0x2bde2a,_0x32e6ca){_0x32e6ca=_0x32e6ca||0xc8;return function(_0x16a10f){if(_0x16a10f){return _0x2bde2a[_0x40c7('0x1a')](_0x32e6ca)['json'](_0x16a10f);}};}function respondWithFilteredResult(_0x586a75,_0x326b01){return function(_0x151697){if(_0x151697){var _0x54a863=typeof _0x326b01['offset']===_0x40c7('0x1c')&&typeof _0x326b01[_0x40c7('0x1d')]===_0x40c7('0x1c');var _0x2cd6f9=_0x151697['count'];var _0x41decf=_0x54a863?0x0:_0x326b01[_0x40c7('0x1e')];var _0x35eaee=_0x54a863?_0x151697[_0x40c7('0x1f')]:_0x326b01['offset']+_0x326b01['limit'];var _0x2b8df4;if(_0x35eaee>=_0x2cd6f9){_0x35eaee=_0x2cd6f9;_0x2b8df4=0xc8;}else{_0x2b8df4=0xce;}_0x586a75[_0x40c7('0x1a')](_0x2b8df4);return _0x586a75[_0x40c7('0x20')](_0x40c7('0x21'),_0x41decf+'-'+_0x35eaee+'/'+_0x2cd6f9)[_0x40c7('0x22')](_0x151697);}return null;};}function patchUpdates(_0x53decd){return function(_0x39b8cc){try{jsonpatch[_0x40c7('0x23')](_0x39b8cc,_0x53decd,!![]);}catch(_0x2eddf9){return BPromise[_0x40c7('0x24')](_0x2eddf9);}return _0x39b8cc[_0x40c7('0x25')]();};}function saveUpdates(_0x1b658b,_0xb8e270){return function(_0x2be352){if(_0x2be352){return _0x2be352[_0x40c7('0x26')](_0x1b658b)['then'](function(_0x1c8bfa){return _0x1c8bfa;});}return null;};}function removeEntity(_0x3b1ec2,_0x46ec11){return function(_0x28ba63){if(_0x28ba63){return _0x28ba63[_0x40c7('0x27')]()[_0x40c7('0x28')](function(){var _0xe0b88c=_0x28ba63[_0x40c7('0x29')]({'plain':!![]});var _0x26377c=_0x40c7('0x2a');return db[_0x40c7('0x2b')]['destroy']({'where':{'type':_0x26377c,'resourceId':_0xe0b88c['id']}})[_0x40c7('0x28')](function(){return _0x28ba63;});})[_0x40c7('0x28')](function(){_0x3b1ec2['status'](0xcc)[_0x40c7('0x1b')]();});}};}function handleEntityNotFound(_0x53cfe2,_0xb02519){return function(_0x52789a){if(!_0x52789a){_0x53cfe2['sendStatus'](0x194);}return _0x52789a;};}function handleError(_0x5e3306,_0x8e8964){_0x8e8964=_0x8e8964||0x1f4;return function(_0x2ef31f){logger[_0x40c7('0x2c')](_0x2ef31f[_0x40c7('0x2d')]);if(_0x2ef31f['name']){delete _0x2ef31f[_0x40c7('0x2e')];}_0x5e3306['status'](_0x8e8964)[_0x40c7('0x2f')](_0x2ef31f);};}exports['index']=function(_0x48ddcb,_0x56337f){var _0x3d179f={},_0x4cee00={},_0x2d588f={'count':0x0,'rows':[]};var _0x27cd86=_[_0x40c7('0x30')](db[_0x40c7('0x31')][_0x40c7('0x32')],function(_0x31906a){return{'name':_0x31906a[_0x40c7('0x33')],'type':_0x31906a[_0x40c7('0x34')][_0x40c7('0x35')]};});_0x4cee00[_0x40c7('0x36')]=_[_0x40c7('0x30')](_0x27cd86,_0x40c7('0x2e'));_0x4cee00['query']=_[_0x40c7('0x37')](_0x48ddcb[_0x40c7('0x38')]);_0x4cee00[_0x40c7('0x39')]=_[_0x40c7('0x3a')](_0x4cee00[_0x40c7('0x36')],_0x4cee00[_0x40c7('0x38')]);_0x3d179f[_0x40c7('0x3b')]=_[_0x40c7('0x3a')](_0x4cee00[_0x40c7('0x36')],qs[_0x40c7('0x3c')](_0x48ddcb[_0x40c7('0x38')]['fields']));_0x3d179f['attributes']=_0x3d179f['attributes'][_0x40c7('0x3d')]?_0x3d179f[_0x40c7('0x3b')]:_0x4cee00['model'];if(!_0x48ddcb[_0x40c7('0x38')][_0x40c7('0x3e')](_0x40c7('0x3f'))){_0x3d179f[_0x40c7('0x1d')]=qs[_0x40c7('0x1d')](_0x48ddcb[_0x40c7('0x38')][_0x40c7('0x1d')]);_0x3d179f[_0x40c7('0x1e')]=qs[_0x40c7('0x1e')](_0x48ddcb['query'][_0x40c7('0x1e')]);}_0x3d179f[_0x40c7('0x40')]=qs[_0x40c7('0x41')](_0x48ddcb[_0x40c7('0x38')][_0x40c7('0x41')]);_0x3d179f[_0x40c7('0x42')]=qs[_0x40c7('0x39')](_[_0x40c7('0x43')](_0x48ddcb['query'],_0x4cee00['filters']),_0x27cd86);if(_0x48ddcb[_0x40c7('0x38')][_0x40c7('0x44')]){_0x3d179f[_0x40c7('0x42')]=_[_0x40c7('0x45')](_0x3d179f[_0x40c7('0x42')],{'$or':_['map'](_0x27cd86,function(_0x4145f5){if(_0x4145f5['type']!==_0x40c7('0x46')){var _0x6c855c={};_0x6c855c[_0x4145f5[_0x40c7('0x2e')]]={'$like':'%'+_0x48ddcb['query']['filter']+'%'};return _0x6c855c;}})});}_0x3d179f=_[_0x40c7('0x45')]({},_0x3d179f,_0x48ddcb[_0x40c7('0x47')]);var _0x1e078f={'where':_0x3d179f[_0x40c7('0x42')]};return db[_0x40c7('0x31')][_0x40c7('0x1f')](_0x1e078f)[_0x40c7('0x28')](function(_0x26c16d){_0x2d588f[_0x40c7('0x1f')]=_0x26c16d;if(_0x48ddcb[_0x40c7('0x38')][_0x40c7('0x48')]){_0x3d179f[_0x40c7('0x49')]=[{'all':!![]}];}return db['AnalyticCustomReport'][_0x40c7('0x4a')](_0x3d179f);})[_0x40c7('0x28')](function(_0x4bf927){_0x2d588f[_0x40c7('0x4b')]=_0x4bf927;return _0x2d588f;})[_0x40c7('0x28')](respondWithFilteredResult(_0x56337f,_0x3d179f))[_0x40c7('0x4c')](handleError(_0x56337f,null));};exports[_0x40c7('0x4d')]=function(_0x28e2b2,_0x4d2cb9){var _0x1dbcc4={'raw':![],'where':{'id':_0x28e2b2[_0x40c7('0x4e')]['id']}},_0x3f266b={};_0x3f266b[_0x40c7('0x36')]=_['keys'](db[_0x40c7('0x31')]['rawAttributes']);_0x3f266b[_0x40c7('0x38')]=_['keys'](_0x28e2b2['query']);_0x3f266b['filters']=_[_0x40c7('0x3a')](_0x3f266b[_0x40c7('0x36')],_0x3f266b[_0x40c7('0x38')]);_0x1dbcc4[_0x40c7('0x3b')]=_['intersection'](_0x3f266b[_0x40c7('0x36')],qs['fields'](_0x28e2b2['query'][_0x40c7('0x3c')]));_0x1dbcc4[_0x40c7('0x3b')]=_0x1dbcc4[_0x40c7('0x3b')][_0x40c7('0x3d')]?_0x1dbcc4[_0x40c7('0x3b')]:_0x3f266b['model'];if(_0x28e2b2[_0x40c7('0x38')][_0x40c7('0x48')]){_0x1dbcc4['include']=[{'all':!![]}];}_0x1dbcc4=_[_0x40c7('0x45')]({},_0x1dbcc4,_0x28e2b2[_0x40c7('0x47')]);return db['AnalyticCustomReport'][_0x40c7('0x4f')](_0x1dbcc4)[_0x40c7('0x28')](handleEntityNotFound(_0x4d2cb9,null))['then'](respondWithResult(_0x4d2cb9,null))[_0x40c7('0x4c')](handleError(_0x4d2cb9,null));};exports['create']=function(_0x28fc4d,_0x3315c3){return db['AnalyticCustomReport']['create'](_0x28fc4d['body'],{})['then'](function(_0x5ad102){var _0x5735dc=_0x28fc4d[_0x40c7('0x50')]['get']({'plain':!![]});if(!_0x5735dc)throw new Error(_0x40c7('0x51'));if(_0x5735dc[_0x40c7('0x52')]===_0x40c7('0x50')){var _0x5e3433=_0x5ad102['get']({'plain':!![]});var _0x574803=_0x40c7('0x53');return db['UserProfileSection'][_0x40c7('0x4f')]({'where':{'name':_0x574803,'userProfileId':_0x5735dc[_0x40c7('0x54')]},'raw':!![]})[_0x40c7('0x28')](function(_0x8b1776){if(_0x8b1776&&_0x8b1776[_0x40c7('0x55')]===0x0){return db[_0x40c7('0x2b')][_0x40c7('0x56')]({'name':_0x5e3433[_0x40c7('0x2e')],'resourceId':_0x5e3433['id'],'type':_0x40c7('0x2a'),'sectionId':_0x8b1776['id']},{})['then'](function(){return _0x5ad102;});}else{return _0x5ad102;}})[_0x40c7('0x4c')](function(_0x1d911b){logger[_0x40c7('0x2c')](_0x40c7('0x57'),_0x1d911b);throw _0x1d911b;});}return _0x5ad102;})[_0x40c7('0x28')](respondWithResult(_0x3315c3,0xc9))['catch'](handleError(_0x3315c3,null));};exports[_0x40c7('0x26')]=function(_0x4c4d28,_0x507d76){if(_0x4c4d28[_0x40c7('0x58')]['id']){delete _0x4c4d28[_0x40c7('0x58')]['id'];}return db[_0x40c7('0x31')][_0x40c7('0x4f')]({'where':{'id':_0x4c4d28[_0x40c7('0x4e')]['id']}})[_0x40c7('0x28')](handleEntityNotFound(_0x507d76,null))[_0x40c7('0x28')](saveUpdates(_0x4c4d28['body'],null))[_0x40c7('0x28')](respondWithResult(_0x507d76,null))[_0x40c7('0x4c')](handleError(_0x507d76,null));};exports[_0x40c7('0x27')]=function(_0x28eb9b,_0x58c99d){return db['AnalyticCustomReport'][_0x40c7('0x4f')]({'where':{'id':_0x28eb9b['params']['id']}})[_0x40c7('0x28')](handleEntityNotFound(_0x58c99d,null))[_0x40c7('0x28')](removeEntity(_0x58c99d,null))[_0x40c7('0x4c')](handleError(_0x58c99d,null));};exports[_0x40c7('0x59')]=function(_0x15e596,_0x54f952){var _0x50d744=0xa;var _0xd82fba=[_0x40c7('0x5a'),_0x40c7('0x5b'),_0x40c7('0x5c'),_0x40c7('0x5d')];var _0x37c826={'SUM':_0x40c7('0x5e'),'COUNT':_0x40c7('0x5f'),'COUNT DISTINCT':_0x40c7('0x60'),'MAX':'MAX(%s)','MIN':_0x40c7('0x61'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x40c7('0x62'),'GROUP_CONCAT DESC':_0x40c7('0x63')};var _0x58ebb0={'SEC_TO_TIME':_0x40c7('0x64'),'DATE':_0x40c7('0x65'),'HOUR':_0x40c7('0x66'),'ROUND':_0x40c7('0x67'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1e93d2=function(_0xb1cfb8){return!_[_0x40c7('0x68')]([_0x40c7('0x69'),_0x40c7('0x6a'),'IS\x20EMPTY',_0x40c7('0x6b')],_0xb1cfb8);};var _0xe41013=function(_0xc379b3){if(!_0xc379b3||!_0xc379b3[_0x40c7('0x6c')]['length']){return'';}for(var _0x27677d='(',_0x4289bb=0x0;_0x4289bb<_0xc379b3[_0x40c7('0x6c')][_0x40c7('0x3d')];_0x4289bb+=0x1){_0x4289bb>0x0&&(_0x27677d+='\x20'+_0xc379b3[_0x40c7('0x6d')]+'\x20');_0x27677d+=_0xc379b3[_0x40c7('0x6c')][_0x4289bb][_0x40c7('0x6e')]?_0xe41013(_0xc379b3['rules'][_0x4289bb][_0x40c7('0x6e')]):_0xc379b3[_0x40c7('0x6c')][_0x4289bb][_0x40c7('0x6f')]+'\x20'+_0xc379b3[_0x40c7('0x6c')][_0x4289bb][_0x40c7('0x70')]+(_0x1e93d2(_0xc379b3[_0x40c7('0x6c')][_0x4289bb]['condition'])?'\x20'+_0xc379b3['rules'][_0x4289bb]['value']:'');}return _0x27677d+')';};var _0x53b854={'where':{'id':_0x15e596[_0x40c7('0x4e')]['id']}},_0x457cb0,_0x2c76da,_0x147506,_0x1557ef,_0x3dc9be;_0x53b854=_[_0x40c7('0x45')]({},_0x53b854,_0x15e596[_0x40c7('0x47')]);return db[_0x40c7('0x31')][_0x40c7('0x4f')](_0x53b854)['then'](function(_0x4745c7){if(_0x4745c7){_0x457cb0=_0x4745c7;return _0x4745c7[_0x40c7('0x71')]();}return null;})[_0x40c7('0x28')](function(_0x26951f){if(_0x26951f){if(!_0x26951f[_0x40c7('0x3d')]){throw new db[(_0x40c7('0x72'))][(_0x40c7('0x73'))](_0x40c7('0x74'),0x193);}_0x2c76da=_0x26951f;return db[_0x40c7('0x75')][_0x40c7('0x4a')]({'raw':!![]});}return null;})['then'](function(_0x553fb9){if(_0x553fb9){_0x147506=_[_0x40c7('0x76')](_0x553fb9,'id');var _0x2054aa;var _0x13ee44=squel[_0x40c7('0x77')]();_0x13ee44[_0x40c7('0x78')](_0x457cb0[_0x40c7('0x79')]);for(var _0x353b11=0x0;_0x353b11<_0x2c76da['length'];_0x353b11+=0x1){_0x2054aa=_0x2c76da[_0x353b11][_0x40c7('0x7a')]?_0x147506[_0x2c76da[_0x353b11][_0x40c7('0x7a')]][_0x40c7('0x7b')]:_0x2c76da[_0x353b11][_0x40c7('0x6f')];_0x2054aa=_0x2c76da[_0x353b11][_0x40c7('0x7c')]?_[_0x40c7('0x7d')](_0x37c826[_0x2c76da[_0x353b11]['function']],'%s',_0x2054aa):_0x2054aa;_0x2054aa=_0x2c76da[_0x353b11][_0x40c7('0x7e')]?_[_0x40c7('0x7d')](_0x58ebb0[_0x2c76da[_0x353b11][_0x40c7('0x7e')]],'%s',_0x2054aa):_0x2054aa;if(_0x2c76da[_0x353b11][_0x40c7('0x7f')]){_0x13ee44[_0x40c7('0x6e')](_0x2054aa);}_0x2c76da[_0x353b11][_0x40c7('0x80')]&&_0x13ee44[_0x40c7('0x40')](_0x2054aa,_0x2c76da[_0x353b11][_0x40c7('0x80')]===_0x40c7('0x81')?![]:!![]);_0x13ee44['field'](_0x2054aa,_0x2c76da[_0x353b11][_0x40c7('0x82')]||_0x2054aa);}if(_0x457cb0['joins']){_0x457cb0[_0x40c7('0x83')]=JSON['parse'](_0x457cb0[_0x40c7('0x83')]);for(var _0xd6184c=0x0;_0xd6184c<_0x457cb0['joins'][_0x40c7('0x3d')];_0xd6184c+=0x1){if(_0x457cb0[_0x40c7('0x83')][_0xd6184c][_0x40c7('0x34')]&&_[_0x40c7('0x68')](_0xd82fba,_0x457cb0[_0x40c7('0x83')][_0xd6184c][_0x40c7('0x34')])&&_0x457cb0[_0x40c7('0x83')][_0xd6184c][_0x40c7('0x84')]&&_0x457cb0[_0x40c7('0x83')][_0xd6184c][_0x40c7('0x85')]&&_0x457cb0[_0x40c7('0x83')][_0xd6184c][_0x40c7('0x86')]){_0x13ee44[_0x457cb0[_0x40c7('0x83')][_0xd6184c][_0x40c7('0x34')]](_0x457cb0['joins'][_0xd6184c]['foreignTable'],null,util[_0x40c7('0x7e')](_0x40c7('0x87'),_0x457cb0[_0x40c7('0x79')],_0x457cb0[_0x40c7('0x83')][_0xd6184c][_0x40c7('0x84')],_0x457cb0[_0x40c7('0x83')][_0xd6184c][_0x40c7('0x85')],_0x457cb0[_0x40c7('0x83')][_0xd6184c][_0x40c7('0x86')]));}}}if(_0x457cb0[_0x40c7('0x88')]){_0x457cb0[_0x40c7('0x88')]=JSON[_0x40c7('0x89')](_0x457cb0[_0x40c7('0x88')]);_0x13ee44['where'](_0xe41013(_0x457cb0[_0x40c7('0x88')][_0x40c7('0x6e')]));}_0x3dc9be=_0x13ee44['clone']();_0x13ee44[_0x40c7('0x1d')](_0x50d744);_0x13ee44['offset'](0x0);logger['debug'](_0x40c7('0x8a'),_0x13ee44[_0x40c7('0x8b')]());return dbH[_0x40c7('0x8c')][_0x40c7('0x38')](_0x13ee44[_0x40c7('0x8b')](),{'type':dbH[_0x40c7('0x8c')][_0x40c7('0x8d')][_0x40c7('0x8e')]});}})[_0x40c7('0x28')](respondWithResult(_0x54f952,null))[_0x40c7('0x4c')](handleError(_0x54f952,null));};function runReport(_0x46068d,_0x1bc791,_0x183f17){var _0xcc758e=_0x1bc791[_0x40c7('0x2e')];var _0x3b6310=0xa;var _0x5b1931=['join',_0x40c7('0x5b'),_0x40c7('0x5c'),_0x40c7('0x5d')];var _0x2d43e2={'SUM':_0x40c7('0x5e'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x40c7('0x60'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x40c7('0x8f'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x40c7('0x63')};var _0x550d87={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x40c7('0x65'),'HOUR':_0x40c7('0x66'),'ROUND':_0x40c7('0x67'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x34c1e9=function(_0x41f304){return!_[_0x40c7('0x68')]([_0x40c7('0x69'),'IS\x20NOT\x20NULL',_0x40c7('0x90'),'IS\x20NOT\x20EMPTY'],_0x41f304);};var _0x205753=function(_0x39c482){if(!_0x39c482||!_0x39c482['rules']['length']){return'';}for(var _0x1bd470='(',_0x2a1cdb=0x0;_0x2a1cdb<_0x39c482['rules']['length'];_0x2a1cdb+=0x1){_0x2a1cdb>0x0&&(_0x1bd470+='\x20'+_0x39c482['operator']+'\x20');_0x1bd470+=_0x39c482[_0x40c7('0x6c')][_0x2a1cdb][_0x40c7('0x6e')]?_0x205753(_0x39c482[_0x40c7('0x6c')][_0x2a1cdb][_0x40c7('0x6e')]):_0x39c482[_0x40c7('0x6c')][_0x2a1cdb]['field']+'\x20'+_0x39c482[_0x40c7('0x6c')][_0x2a1cdb]['condition']+(_0x34c1e9(_0x39c482[_0x40c7('0x6c')][_0x2a1cdb][_0x40c7('0x70')])?'\x20'+_0x39c482['rules'][_0x2a1cdb][_0x40c7('0x91')]:'');}return _0x1bd470+')';};var _0x2ae098={'where':{'id':_0x46068d['id']}},_0x3a179c,_0x1a33a2,_0x25ebfe,_0x433f0a,_0x3a2bc6;_0x2ae098=_[_0x40c7('0x45')]({},_0x2ae098,_0x183f17);return db['AnalyticCustomReport'][_0x40c7('0x4f')](_0x2ae098)[_0x40c7('0x28')](function(_0x5c60f1){if(_0x5c60f1){_0x3a179c=_0x5c60f1;return _0x5c60f1[_0x40c7('0x71')]();}return null;})['then'](function(_0x3d4b47){if(_0x3d4b47){if(!_0x3d4b47[_0x40c7('0x3d')]){throw new db['Sequelize'][(_0x40c7('0x73'))](_0x40c7('0x74'),0x193);}_0x1a33a2=_0x3d4b47;return db['AnalyticMetric'][_0x40c7('0x4a')]({'raw':!![]});}return null;})['then'](function(_0x207518){if(_0x207518){_0x25ebfe=_[_0x40c7('0x76')](_0x207518,'id');var _0x52c54c;var _0x3b989e=squel[_0x40c7('0x77')]();_0x3b989e[_0x40c7('0x78')](_0x3a179c[_0x40c7('0x79')]);for(var _0x348025=0x0;_0x348025<_0x1a33a2[_0x40c7('0x3d')];_0x348025+=0x1){_0x52c54c=_0x1a33a2[_0x348025][_0x40c7('0x7a')]?_0x25ebfe[_0x1a33a2[_0x348025][_0x40c7('0x7a')]][_0x40c7('0x7b')]:_0x1a33a2[_0x348025][_0x40c7('0x6f')];_0x52c54c=_0x1a33a2[_0x348025][_0x40c7('0x7c')]?_[_0x40c7('0x7d')](_0x2d43e2[_0x1a33a2[_0x348025]['function']],'%s',_0x52c54c):_0x52c54c;_0x52c54c=_0x1a33a2[_0x348025][_0x40c7('0x7e')]?_[_0x40c7('0x7d')](_0x550d87[_0x1a33a2[_0x348025][_0x40c7('0x7e')]],'%s',_0x52c54c):_0x52c54c;if(_0x1a33a2[_0x348025][_0x40c7('0x7f')]){_0x3b989e[_0x40c7('0x6e')](_0x52c54c);}_0x1a33a2[_0x348025]['orderBy']&&_0x3b989e[_0x40c7('0x40')](_0x52c54c,_0x1a33a2[_0x348025][_0x40c7('0x80')]===_0x40c7('0x81')?![]:!![]);_0x3b989e['field'](_0x52c54c,_0x1a33a2[_0x348025][_0x40c7('0x82')]||_0x52c54c);}if(_0x3a179c[_0x40c7('0x83')]){_0x3a179c[_0x40c7('0x83')]=JSON['parse'](_0x3a179c[_0x40c7('0x83')]);for(var _0x3c3e99=0x0;_0x3c3e99<_0x3a179c[_0x40c7('0x83')][_0x40c7('0x3d')];_0x3c3e99+=0x1){if(_0x3a179c[_0x40c7('0x83')][_0x3c3e99][_0x40c7('0x34')]&&_['includes'](_0x5b1931,_0x3a179c['joins'][_0x3c3e99][_0x40c7('0x34')])&&_0x3a179c[_0x40c7('0x83')][_0x3c3e99][_0x40c7('0x84')]&&_0x3a179c[_0x40c7('0x83')][_0x3c3e99][_0x40c7('0x85')]&&_0x3a179c['joins'][_0x3c3e99]['foreignKey']){_0x3b989e[_0x3a179c[_0x40c7('0x83')][_0x3c3e99]['type']](_0x3a179c[_0x40c7('0x83')][_0x3c3e99][_0x40c7('0x85')],null,util[_0x40c7('0x7e')](_0x40c7('0x87'),_0x3a179c[_0x40c7('0x79')],_0x3a179c['joins'][_0x3c3e99][_0x40c7('0x84')],_0x3a179c[_0x40c7('0x83')][_0x3c3e99][_0x40c7('0x85')],_0x3a179c[_0x40c7('0x83')][_0x3c3e99][_0x40c7('0x86')]));}}}if(_0x3a179c[_0x40c7('0x88')]){_0x3a179c[_0x40c7('0x88')]=JSON[_0x40c7('0x89')](_0x3a179c[_0x40c7('0x88')]);_0x3b989e[_0x40c7('0x42')](_0x205753(_0x3a179c[_0x40c7('0x88')][_0x40c7('0x6e')]));}_0x3a2bc6=_0x3b989e[_0x40c7('0x92')]();_0x3b989e[_0x40c7('0x1d')](_0x3b6310);_0x3b989e[_0x40c7('0x1e')](0x0);return;}})[_0x40c7('0x28')](function(){if(_0x1bc791[_0x40c7('0x93')]===_0x40c7('0x94')){return null;}var _0x14c8b9=_['merge'](_0x1bc791,{'name':_0x1bc791[_0x40c7('0x95')]||_0x1bc791[_0x40c7('0x2e')]||_0x3a179c[_0x40c7('0x2e')],'basename':_0xcc758e,'savename':util['format'](_0x40c7('0x96'),_0x1bc791[_0x40c7('0x2e')]||_0x3a179c[_0x40c7('0x2e')],require(_0x40c7('0x97'))[_0x40c7('0x98')](0x4),_0x1bc791[_0x40c7('0x93')]||_0x40c7('0x99')),'reportId':_0x3a179c['id'],'reportType':_0x40c7('0x9a')});return db[_0x40c7('0x9b')][_0x40c7('0x56')](_0x14c8b9,{'raw':!![]});})[_0x40c7('0x28')](function(_0x15afec){if(_0x3a179c[_0x40c7('0x79')]==='cdr'){_0x3a2bc6['where'](_0x3a179c[_0x40c7('0x79')]+_0x40c7('0x9c'),_0x1bc791['startDate'],_0x1bc791[_0x40c7('0x9d')]);}else{_0x3a2bc6[_0x40c7('0x42')](_0x3a179c['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x1bc791[_0x40c7('0x9e')],_0x1bc791['endDate']);}if(_0x15afec){logger['info']('Run\x20Query:',_0x3a2bc6[_0x40c7('0x8b')]());require('child_process')[_0x40c7('0x9f')](path[_0x40c7('0x5a')](__dirname,_0x40c7('0xa0'),_0x15afec['output']),[_0x15afec['id'],_0x3a2bc6[_0x40c7('0x8b')](),path['join'](__dirname,'../../files/reports',_0x15afec['savename']),_0xcc758e]);return _0x15afec;}else{var _0x392ce9=squel[_0x40c7('0x77')]();_0x392ce9['from']('('+_0x3a2bc6[_0x40c7('0x8b')]()+')',_0x40c7('0xa1'));_0x392ce9['field'](_0x40c7('0xa2'),_0x40c7('0x1f'));_0x3a2bc6[_0x40c7('0x1d')](_0x1bc791[_0x40c7('0x1d')]||_0x3b6310);_0x3a2bc6[_0x40c7('0x1e')](_0x1bc791[_0x40c7('0x1e')]||0x0);return dbH[_0x40c7('0x8c')][_0x40c7('0x38')](_0x392ce9[_0x40c7('0x8b')](),{'type':dbH['sequelize'][_0x40c7('0x8d')][_0x40c7('0x8e')]})[_0x40c7('0x28')](function(_0x18795d){if(!_0x18795d[_0x40c7('0x3d')]){_0x433f0a=0x0;}else{_0x433f0a=_0x18795d[0x0][_0x40c7('0x1f')]||0x0;}return dbH[_0x40c7('0x8c')][_0x40c7('0x38')](_0x3a2bc6[_0x40c7('0x8b')](),{'type':dbH['sequelize'][_0x40c7('0x8d')][_0x40c7('0x8e')]});})[_0x40c7('0x28')](function(_0x2a2ae8){return{'rows':_0x2a2ae8||[],'count':_0x433f0a};});}});}exports[_0x40c7('0xa3')]=function(_0x389e64,_0x399349){return runReport(_0x389e64[_0x40c7('0x4e')],_0x389e64[_0x40c7('0x38')],_0x389e64[_0x40c7('0x47')])[_0x40c7('0x28')](respondWithResult(_0x399349,null))[_0x40c7('0x4c')](handleError(_0x399349,null));};exports[_0x40c7('0xa4')]=runReport;exports[_0x40c7('0x38')]=function(_0x4d8c1f,_0x138f19){var _0x1c49e2=0xa;var _0x503267=[_0x40c7('0x5a'),_0x40c7('0x5b'),_0x40c7('0x5c'),_0x40c7('0x5d')];var _0x39fcc0={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x40c7('0x60'),'MAX':_0x40c7('0xa5'),'MIN':_0x40c7('0x61'),'AVG':_0x40c7('0xa6'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x40c7('0x62'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x12db73={'SEC_TO_TIME':_0x40c7('0x64'),'DATE':_0x40c7('0x65'),'HOUR':_0x40c7('0x66'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x40c7('0xa7')};var _0x255ddb=function(_0x18c899){return!_[_0x40c7('0x68')]([_0x40c7('0x69'),_0x40c7('0x6a'),_0x40c7('0x90'),'IS\x20NOT\x20EMPTY'],_0x18c899);};var _0x2b936c=function(_0x138ed3){if(!_0x138ed3||!_0x138ed3[_0x40c7('0x6c')][_0x40c7('0x3d')]){return'';}for(var _0x51ee73='(',_0x16572e=0x0;_0x16572e<_0x138ed3[_0x40c7('0x6c')]['length'];_0x16572e+=0x1){_0x16572e>0x0&&(_0x51ee73+='\x20'+_0x138ed3[_0x40c7('0x6d')]+'\x20');_0x51ee73+=_0x138ed3[_0x40c7('0x6c')][_0x16572e][_0x40c7('0x6e')]?_0x2b936c(_0x138ed3[_0x40c7('0x6c')][_0x16572e][_0x40c7('0x6e')]):_0x138ed3[_0x40c7('0x6c')][_0x16572e][_0x40c7('0x6f')]+'\x20'+_0x138ed3[_0x40c7('0x6c')][_0x16572e][_0x40c7('0x70')]+(_0x255ddb(_0x138ed3[_0x40c7('0x6c')][_0x16572e][_0x40c7('0x70')])?'\x20'+_0x138ed3[_0x40c7('0x6c')][_0x16572e][_0x40c7('0x91')]:'');}return _0x51ee73+')';};var _0x16e1fc={'where':{'id':_0x4d8c1f['params']['id']}},_0x5034ad,_0x4cdf28,_0x55e111,_0x4567fc,_0xeb3b6;_0x16e1fc=_[_0x40c7('0x45')]({},_0x16e1fc,_0x4d8c1f[_0x40c7('0x47')]);return db[_0x40c7('0x31')][_0x40c7('0x4f')](_0x16e1fc)[_0x40c7('0x28')](function(_0x3d4a6b){if(_0x3d4a6b){_0x5034ad=_0x3d4a6b;return _0x3d4a6b['getFields']();}return null;})[_0x40c7('0x28')](function(_0x3b6c1b){if(_0x3b6c1b){if(!_0x3b6c1b[_0x40c7('0x3d')]){throw new db['Sequelize'][(_0x40c7('0x73'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x4cdf28=_0x3b6c1b;return db['AnalyticMetric'][_0x40c7('0x4a')]({'raw':!![]});}return null;})[_0x40c7('0x28')](function(_0x557f06){if(_0x557f06){_0x55e111=_['keyBy'](_0x557f06,'id');var _0x1319ae;var _0x2e1407=squel[_0x40c7('0x77')]();_0x2e1407[_0x40c7('0x78')](_0x5034ad[_0x40c7('0x79')]);for(var _0x50c065=0x0;_0x50c065<_0x4cdf28[_0x40c7('0x3d')];_0x50c065+=0x1){_0x1319ae=_0x4cdf28[_0x50c065][_0x40c7('0x7a')]?_0x55e111[_0x4cdf28[_0x50c065][_0x40c7('0x7a')]][_0x40c7('0x7b')]:_0x4cdf28[_0x50c065][_0x40c7('0x6f')];_0x1319ae=_0x4cdf28[_0x50c065][_0x40c7('0x7c')]?_[_0x40c7('0x7d')](_0x39fcc0[_0x4cdf28[_0x50c065]['function']],'%s',_0x1319ae):_0x1319ae;_0x1319ae=_0x4cdf28[_0x50c065][_0x40c7('0x7e')]?_['replace'](_0x12db73[_0x4cdf28[_0x50c065]['format']],'%s',_0x1319ae):_0x1319ae;if(_0x4cdf28[_0x50c065][_0x40c7('0x7f')]){_0x2e1407[_0x40c7('0x6e')](_0x1319ae);}_0x4cdf28[_0x50c065][_0x40c7('0x80')]&&_0x2e1407[_0x40c7('0x40')](_0x1319ae,_0x4cdf28[_0x50c065][_0x40c7('0x80')]===_0x40c7('0x81')?![]:!![]);_0x2e1407[_0x40c7('0x6f')](_0x1319ae,_0x4cdf28[_0x50c065][_0x40c7('0x82')]||_0x1319ae);}if(_0x5034ad[_0x40c7('0x83')]){_0x5034ad[_0x40c7('0x83')]=JSON['parse'](_0x5034ad[_0x40c7('0x83')]);for(var _0x31c259=0x0;_0x31c259<_0x5034ad[_0x40c7('0x83')][_0x40c7('0x3d')];_0x31c259+=0x1){if(_0x5034ad[_0x40c7('0x83')][_0x31c259][_0x40c7('0x34')]&&_['includes'](_0x503267,_0x5034ad[_0x40c7('0x83')][_0x31c259][_0x40c7('0x34')])&&_0x5034ad['joins'][_0x31c259][_0x40c7('0x84')]&&_0x5034ad['joins'][_0x31c259][_0x40c7('0x85')]&&_0x5034ad['joins'][_0x31c259][_0x40c7('0x86')]){_0x2e1407[_0x5034ad['joins'][_0x31c259][_0x40c7('0x34')]](_0x5034ad[_0x40c7('0x83')][_0x31c259][_0x40c7('0x85')],null,util[_0x40c7('0x7e')]('%s.%s\x20=\x20%s.%s',_0x5034ad[_0x40c7('0x79')],_0x5034ad['joins'][_0x31c259][_0x40c7('0x84')],_0x5034ad[_0x40c7('0x83')][_0x31c259]['foreignTable'],_0x5034ad[_0x40c7('0x83')][_0x31c259][_0x40c7('0x86')]));}}}if(_0x5034ad[_0x40c7('0x88')]){_0x5034ad[_0x40c7('0x88')]=JSON['parse'](_0x5034ad[_0x40c7('0x88')]);_0x2e1407['where'](_0x2b936c(_0x5034ad['conditions'][_0x40c7('0x6e')]));}_0xeb3b6=_0x2e1407['clone']();_0x2e1407['limit'](_0x1c49e2);_0x2e1407[_0x40c7('0x1e')](0x0);logger[_0x40c7('0xa8')]('Limited\x20Query:',_0x2e1407[_0x40c7('0x8b')]());return dbH[_0x40c7('0x8c')]['query'](_0x2e1407[_0x40c7('0x8b')](),{'type':dbH[_0x40c7('0x8c')][_0x40c7('0x8d')][_0x40c7('0x8e')]});}})[_0x40c7('0x28')](function(){return{'sql':_0xeb3b6[_0x40c7('0x8b')]()};})[_0x40c7('0x28')](respondWithResult(_0x138f19,null))['catch'](handleError(_0x138f19,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 95feeb1..edf7764 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 _0xa4ef=['bluebird','request-promise','exports','define','AnalyticCustomReport','lodash','util','api'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0xa4ef,0x9d));var _0xfa4e=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xa4ef[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xfa4e('0x0'));var util=require(_0xfa4e('0x1'));var logger=require('../../config/logger')(_0xfa4e('0x2'));var moment=require('moment');var BPromise=require(_0xfa4e('0x3'));var rp=require(_0xfa4e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./analyticCustomReport.attributes');module[_0xfa4e('0x5')]=function(_0x8481c2,_0x406fd6){return _0x8481c2[_0xfa4e('0x6')](_0xfa4e('0x7'),attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0e11=['path','../../config/environment','./analyticCustomReport.attributes','analytics_custom_reports','../../config/logger','moment'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0x0e11,0xac));var _0x10e1=function(_0x2c14dc,_0xccf442){_0x2c14dc=_0x2c14dc-0x0;var _0x1f18e5=_0x0e11[_0x2c14dc];return _0x1f18e5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x10e1('0x0'))('api');var moment=require(_0x10e1('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x10e1('0x2'));var rimraf=require('rimraf');var config=require(_0x10e1('0x3'));var attributes=require(_0x10e1('0x4'));module['exports']=function(_0x3dfd3e,_0x45a19c){return _0x3dfd3e['define']('AnalyticCustomReport',attributes,{'tableName':_0x10e1('0x5'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index faca118..b81d571 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 _0x661f=['../../mysqldb','../../config/logger','../../config/environment','client','http','request','then','info','request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','AnalyticCustomReport,\x20%s,\x20%s','lodash','util','moment','randomstring','ioredis'];(function(_0x113775,_0x496335){var _0x110077=function(_0x34271e){while(--_0x34271e){_0x113775['push'](_0x113775['shift']());}};_0x110077(++_0x496335);}(_0x661f,0x73));var _0xf661=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x661f[_0x599f41];return _0x2e4d58;};'use strict';var _=require(_0xf661('0x0'));var util=require(_0xf661('0x1'));var moment=require(_0xf661('0x2'));var BPromise=require('bluebird');var rs=require(_0xf661('0x3'));var fs=require('fs');var Redis=require(_0xf661('0x4'));var db=require(_0xf661('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf661('0x6'))('rpc');var config=require(_0xf661('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf661('0x8')][_0xf661('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x593f7d,_0x400889,_0x346187){return new BPromise(function(_0xf2c128,_0x54cfec){return client[_0xf661('0xa')](_0x593f7d,_0x346187)[_0xf661('0xb')](function(_0xa866e1){logger[_0xf661('0xc')]('AnalyticCustomReport,\x20%s,\x20%s',_0x400889,_0xf661('0xd'));logger['debug'](_0xf661('0xe'),_0x400889,_0xf661('0xd'),JSON[_0xf661('0xf')](_0xa866e1));if(_0xa866e1[_0xf661('0x10')]){if(_0xa866e1[_0xf661('0x10')][_0xf661('0x11')]===0x1f4){logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x400889,_0xa866e1[_0xf661('0x10')]['message']);return _0x54cfec(_0xa866e1[_0xf661('0x10')][_0xf661('0x12')]);}logger[_0xf661('0x10')]('AnalyticCustomReport,\x20%s,\x20%s',_0x400889,_0xa866e1['error'][_0xf661('0x12')]);return _0xf2c128(_0xa866e1[_0xf661('0x10')][_0xf661('0x12')]);}else{logger[_0xf661('0xc')](_0xf661('0x13'),_0x400889,'request\x20sent');_0xf2c128(_0xa866e1['result'][_0xf661('0x12')]);}})['catch'](function(_0x32b5a2){logger[_0xf661('0x10')](_0xf661('0x13'),_0x400889,_0x32b5a2);_0x54cfec(_0x32b5a2);});});} \ No newline at end of file +var _0xc762=['jayson/promise','client','http','then','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc'];(function(_0x23f132,_0x5d919e){var _0x2b10bf=function(_0x396c0d){while(--_0x396c0d){_0x23f132['push'](_0x23f132['shift']());}};_0x2b10bf(++_0x5d919e);}(_0xc762,0x19d));var _0x2c76=function(_0x126f47,_0x2199e9){_0x126f47=_0x126f47-0x0;var _0x49508a=_0xc762[_0x126f47];return _0x49508a;};'use strict';var _=require(_0x2c76('0x0'));var util=require(_0x2c76('0x1'));var moment=require('moment');var BPromise=require(_0x2c76('0x2'));var rs=require(_0x2c76('0x3'));var fs=require('fs');var Redis=require(_0x2c76('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2c76('0x5'));var logger=require('../../config/logger')(_0x2c76('0x6'));var config=require('../../config/environment');var jayson=require(_0x2c76('0x7'));var client=jayson[_0x2c76('0x8')][_0x2c76('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x539f86,_0x214c57,_0x474187){return new BPromise(function(_0x3acafe,_0x321529){return client['request'](_0x539f86,_0x474187)[_0x2c76('0xa')](function(_0x5578d9){logger['info'](_0x2c76('0xb'),_0x214c57,_0x2c76('0xc'));logger[_0x2c76('0xd')](_0x2c76('0xe'),_0x214c57,'request\x20sent',JSON['stringify'](_0x5578d9));if(_0x5578d9['error']){if(_0x5578d9['error']['code']===0x1f4){logger[_0x2c76('0xf')](_0x2c76('0xb'),_0x214c57,_0x5578d9[_0x2c76('0xf')][_0x2c76('0x10')]);return _0x321529(_0x5578d9['error']['message']);}logger['error'](_0x2c76('0xb'),_0x214c57,_0x5578d9[_0x2c76('0xf')][_0x2c76('0x10')]);return _0x3acafe(_0x5578d9['error'][_0x2c76('0x10')]);}else{logger[_0x2c76('0x11')]('AnalyticCustomReport,\x20%s,\x20%s',_0x214c57,_0x2c76('0xc'));_0x3acafe(_0x5578d9[_0x2c76('0x12')][_0x2c76('0x10')]);}})[_0x2c76('0x13')](function(_0x2ca778){logger['error'](_0x2c76('0xb'),_0x214c57,_0x2ca778);_0x321529(_0x2ca778);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index ddebd5c..d180093 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 _0x4e6d=['path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','/:id/preview','preview','/:id/run','/:id/query','query','post','create','put','/:id','delete','exports','util'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x4e6d,0x92));var _0xd4e6=function(_0x363842,_0x369636){_0x363842=_0x363842-0x0;var _0x257bc2=_0x4e6d[_0x363842];return _0x257bc2;};'use strict';var multer=require('multer');var util=require(_0xd4e6('0x0'));var path=require(_0xd4e6('0x1'));var timeout=require('connect-timeout');var express=require(_0xd4e6('0x2'));var router=express[_0xd4e6('0x3')]();var fs_extra=require(_0xd4e6('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd4e6('0x5'));var config=require(_0xd4e6('0x6'));var controller=require('./analyticCustomReport.controller');router[_0xd4e6('0x7')]('/',auth[_0xd4e6('0x8')](),controller['index']);router['get']('/:id',auth[_0xd4e6('0x8')](),controller[_0xd4e6('0x9')]);router[_0xd4e6('0x7')](_0xd4e6('0xa'),auth[_0xd4e6('0x8')](),controller[_0xd4e6('0xb')]);router['get'](_0xd4e6('0xc'),auth[_0xd4e6('0x8')](),controller['run']);router['get'](_0xd4e6('0xd'),auth[_0xd4e6('0x8')](),controller[_0xd4e6('0xe')]);router[_0xd4e6('0xf')]('/',auth[_0xd4e6('0x8')](),controller[_0xd4e6('0x10')]);router[_0xd4e6('0x11')](_0xd4e6('0x12'),auth[_0xd4e6('0x8')](),controller['update']);router[_0xd4e6('0x13')](_0xd4e6('0x12'),auth[_0xd4e6('0x8')](),controller['destroy']);module[_0xd4e6('0x14')]=router; \ No newline at end of file +var _0x050b=['/:id/query','query','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','isAuthenticated','index','get','/:id','show','/:id/preview','preview','/:id/run','run'];(function(_0x35d753,_0x49b3d8){var _0x206b94=function(_0x7ddf74){while(--_0x7ddf74){_0x35d753['push'](_0x35d753['shift']());}};_0x206b94(++_0x49b3d8);}(_0x050b,0xc6));var _0xb050=function(_0x522d54,_0x30e08f){_0x522d54=_0x522d54-0x0;var _0x28eec0=_0x050b[_0x522d54];return _0x28eec0;};'use strict';var multer=require(_0xb050('0x0'));var util=require('util');var path=require(_0xb050('0x1'));var timeout=require(_0xb050('0x2'));var express=require(_0xb050('0x3'));var router=express[_0xb050('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb050('0x5'));var interaction=require(_0xb050('0x6'));var config=require(_0xb050('0x7'));var controller=require(_0xb050('0x8'));router['get']('/',auth[_0xb050('0x9')](),controller[_0xb050('0xa')]);router[_0xb050('0xb')](_0xb050('0xc'),auth['isAuthenticated'](),controller[_0xb050('0xd')]);router[_0xb050('0xb')](_0xb050('0xe'),auth[_0xb050('0x9')](),controller[_0xb050('0xf')]);router[_0xb050('0xb')](_0xb050('0x10'),auth[_0xb050('0x9')](),controller[_0xb050('0x11')]);router['get'](_0xb050('0x12'),auth[_0xb050('0x9')](),controller[_0xb050('0x13')]);router[_0xb050('0x14')]('/',auth[_0xb050('0x9')](),controller[_0xb050('0x15')]);router[_0xb050('0x16')]('/:id',auth[_0xb050('0x9')](),controller[_0xb050('0x17')]);router[_0xb050('0x18')](_0xb050('0xc'),auth[_0xb050('0x9')](),controller[_0xb050('0x19')]);module[_0xb050('0x1a')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 417a8d5..8be04e1 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 _0x7217=['sequelize','STRING','TEXT'];(function(_0x5ddd23,_0x38b636){var _0x15ebce=function(_0x3a0170){while(--_0x3a0170){_0x5ddd23['push'](_0x5ddd23['shift']());}};_0x15ebce(++_0x38b636);}(_0x7217,0x19e));var _0x7721=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x7217[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0x7721('0x0'));module['exports']={'name':{'type':Sequelize[_0x7721('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x7721('0x1')]},'parent':{'type':Sequelize[_0x7721('0x1')]},'table':{'type':Sequelize[_0x7721('0x1')]},'conditions':{'type':Sequelize[_0x7721('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xc4aa=['STRING','sequelize','exports'];(function(_0x3840fe,_0x4c9105){var _0xfbc02=function(_0x4796c1){while(--_0x4796c1){_0x3840fe['push'](_0x3840fe['shift']());}};_0xfbc02(++_0x4c9105);}(_0xc4aa,0x1b7));var _0xac4a=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xc4aa[_0xa148b7];return _0x51efd3;};'use strict';var Sequelize=require(_0xac4a('0x0'));module[_0xac4a('0x1')]={'name':{'type':Sequelize[_0xac4a('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xac4a('0x2')]},'parent':{'type':Sequelize[_0xac4a('0x2')]},'table':{'type':Sequelize[_0xac4a('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 2369cc6..dd5ecf3 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 _0x2675=['AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','VIRTUAL','merge','options','includeAll','include','catch','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','find','userProfileId','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','left_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','select','table','MetricId','metric','field','function','replace','format','groupBy','order','orderBy','DESC','joins','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','parse','clone','toString','sequelize','QueryTypes','right_join','SEC_TO_TIME(%s)','IS\x20EMPTY','Sequelize','keyBy','from','alias','output','randomstring','generate','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','child_process','fork','../../files/reports','savename','COUNT(*)','SELECT','run','runReport','MIN(%s)','debug','eml-format','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','get','DefaultReports','name','map'];(function(_0x4c5822,_0x4e552f){var _0x46b2ba=function(_0x20bce8){while(--_0x20bce8){_0x4c5822['push'](_0x4c5822['shift']());}};_0x46b2ba(++_0x4e552f);}(_0x2675,0x75));var _0x5267=function(_0x476f40,_0x3ab80e){_0x476f40=_0x476f40-0x0;var _0x263172=_0x2675[_0x476f40];return _0x263172;};'use strict';var emlformat=require(_0x5267('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5267('0x1'));var moment=require(_0x5267('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x5267('0x3'));var util=require(_0x5267('0x4'));var path=require('path');var sox=require(_0x5267('0x5'));var csv=require(_0x5267('0x6'));var ejs=require(_0x5267('0x7'));var fs=require('fs');var fs_extra=require(_0x5267('0x8'));var _=require(_0x5267('0x9'));var squel=require(_0x5267('0xa'));var crypto=require('crypto');var jsforce=require(_0x5267('0xb'));var deskjs=require(_0x5267('0xc'));var toCsv=require('to-csv');var querystring=require(_0x5267('0xd'));var Papa=require('papaparse');var Redis=require(_0x5267('0xe'));var authService=require(_0x5267('0xf'));var qs=require(_0x5267('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5267('0x11'));var logger=require('../../config/logger')(_0x5267('0x12'));var utils=require('../../config/utils');var config=require(_0x5267('0x13'));var licenseUtil=require(_0x5267('0x14'));var db=require(_0x5267('0x15'))['db'];var dbH=require(_0x5267('0x15'))[_0x5267('0x16')];function respondWithStatusCode(_0x1171b9,_0x20785c){_0x20785c=_0x20785c||0xcc;return function(_0x36dc17){if(_0x36dc17){return _0x1171b9[_0x5267('0x17')](_0x20785c);}return _0x1171b9[_0x5267('0x18')](_0x20785c)[_0x5267('0x19')]();};}function respondWithResult(_0x29349a,_0x3e2bab){_0x3e2bab=_0x3e2bab||0xc8;return function(_0x548040){if(_0x548040){return _0x29349a['status'](_0x3e2bab)[_0x5267('0x1a')](_0x548040);}};}function respondWithFilteredResult(_0x40d897,_0x38a147){return function(_0x3f5344){if(_0x3f5344){var _0x46b2c2=typeof _0x38a147[_0x5267('0x1b')]===_0x5267('0x1c')&&typeof _0x38a147[_0x5267('0x1d')]===_0x5267('0x1c');var _0xb1c97a=_0x3f5344[_0x5267('0x1e')];var _0x1ab03=_0x46b2c2?0x0:_0x38a147['offset'];var _0x18f32e=_0x46b2c2?_0x3f5344[_0x5267('0x1e')]:_0x38a147['offset']+_0x38a147[_0x5267('0x1d')];var _0x56733e;if(_0x18f32e>=_0xb1c97a){_0x18f32e=_0xb1c97a;_0x56733e=0xc8;}else{_0x56733e=0xce;}_0x40d897[_0x5267('0x18')](_0x56733e);return _0x40d897[_0x5267('0x1f')](_0x5267('0x20'),_0x1ab03+'-'+_0x18f32e+'/'+_0xb1c97a)[_0x5267('0x1a')](_0x3f5344);}return null;};}function patchUpdates(_0x5ca9c6){return function(_0x4dd637){try{jsonpatch[_0x5267('0x21')](_0x4dd637,_0x5ca9c6,!![]);}catch(_0x5aebdd){return BPromise[_0x5267('0x22')](_0x5aebdd);}return _0x4dd637[_0x5267('0x23')]();};}function saveUpdates(_0x3b53ac,_0x56dd95){return function(_0x499f19){if(_0x499f19){return _0x499f19['update'](_0x3b53ac)['then'](function(_0x5ea6a6){return _0x5ea6a6;});}return null;};}function removeEntity(_0x26c7f8,_0x399e64){return function(_0x2d761d){if(_0x2d761d){return _0x2d761d[_0x5267('0x24')]()[_0x5267('0x25')](function(){var _0x40d1be=_0x2d761d[_0x5267('0x26')]({'plain':!![]});var _0x220e03=_0x5267('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x220e03,'resourceId':_0x40d1be['id']}})[_0x5267('0x25')](function(){return _0x2d761d;});})[_0x5267('0x25')](function(){_0x26c7f8['status'](0xcc)[_0x5267('0x19')]();});}};}function handleEntityNotFound(_0x52504e,_0x4d7c2a){return function(_0x43e7e7){if(!_0x43e7e7){_0x52504e[_0x5267('0x17')](0x194);}return _0x43e7e7;};}function handleError(_0x1f33b7,_0x2d2ace){_0x2d2ace=_0x2d2ace||0x1f4;return function(_0x33c431){logger['error'](_0x33c431['stack']);if(_0x33c431[_0x5267('0x28')]){delete _0x33c431[_0x5267('0x28')];}_0x1f33b7[_0x5267('0x18')](_0x2d2ace)['send'](_0x33c431);};}exports['index']=function(_0xbe7922,_0x3ef2a8){var _0x1fa725={},_0x5bec7e={},_0x59b091={'count':0x0,'rows':[]};var _0x2249a1=_[_0x5267('0x29')](db[_0x5267('0x2a')][_0x5267('0x2b')],function(_0x5bbb83){return{'name':_0x5bbb83[_0x5267('0x2c')],'type':_0x5bbb83[_0x5267('0x2d')][_0x5267('0x2e')]};});_0x5bec7e[_0x5267('0x2f')]=_[_0x5267('0x29')](_0x2249a1,_0x5267('0x28'));_0x5bec7e[_0x5267('0x30')]=_[_0x5267('0x31')](_0xbe7922['query']);_0x5bec7e['filters']=_[_0x5267('0x32')](_0x5bec7e['model'],_0x5bec7e[_0x5267('0x30')]);_0x1fa725[_0x5267('0x33')]=_[_0x5267('0x32')](_0x5bec7e[_0x5267('0x2f')],qs['fields'](_0xbe7922[_0x5267('0x30')][_0x5267('0x34')]));_0x1fa725[_0x5267('0x33')]=_0x1fa725[_0x5267('0x33')][_0x5267('0x35')]?_0x1fa725[_0x5267('0x33')]:_0x5bec7e[_0x5267('0x2f')];if(!_0xbe7922[_0x5267('0x30')]['hasOwnProperty'](_0x5267('0x36'))){_0x1fa725['limit']=qs[_0x5267('0x1d')](_0xbe7922[_0x5267('0x30')][_0x5267('0x1d')]);_0x1fa725[_0x5267('0x1b')]=qs[_0x5267('0x1b')](_0xbe7922[_0x5267('0x30')][_0x5267('0x1b')]);}_0x1fa725['order']=qs[_0x5267('0x37')](_0xbe7922[_0x5267('0x30')][_0x5267('0x37')]);_0x1fa725[_0x5267('0x38')]=qs[_0x5267('0x39')](_[_0x5267('0x3a')](_0xbe7922[_0x5267('0x30')],_0x5bec7e['filters']),_0x2249a1);if(_0xbe7922[_0x5267('0x30')]['filter']){_0x1fa725[_0x5267('0x38')]=_['merge'](_0x1fa725['where'],{'$or':_['map'](_0x2249a1,function(_0x46bfcc){if(_0x46bfcc['type']!==_0x5267('0x3b')){var _0x146476={};_0x146476[_0x46bfcc[_0x5267('0x28')]]={'$like':'%'+_0xbe7922[_0x5267('0x30')]['filter']+'%'};return _0x146476;}})});}_0x1fa725=_[_0x5267('0x3c')]({},_0x1fa725,_0xbe7922[_0x5267('0x3d')]);var _0x588edf={'where':_0x1fa725['where']};return db[_0x5267('0x2a')]['count'](_0x588edf)[_0x5267('0x25')](function(_0x1cf94a){_0x59b091[_0x5267('0x1e')]=_0x1cf94a;if(_0xbe7922[_0x5267('0x30')][_0x5267('0x3e')]){_0x1fa725[_0x5267('0x3f')]=[{'all':!![]}];}return db[_0x5267('0x2a')]['findAll'](_0x1fa725);})['then'](function(_0x28ea4a){_0x59b091['rows']=_0x28ea4a;return _0x59b091;})[_0x5267('0x25')](respondWithFilteredResult(_0x3ef2a8,_0x1fa725))[_0x5267('0x40')](handleError(_0x3ef2a8,null));};exports['show']=function(_0x1fa925,_0xc764cd){var _0x299a13={'raw':!![],'where':{'id':_0x1fa925[_0x5267('0x41')]['id']}},_0x161fed={};_0x161fed[_0x5267('0x2f')]=_[_0x5267('0x31')](db[_0x5267('0x2a')][_0x5267('0x2b')]);_0x161fed['query']=_[_0x5267('0x31')](_0x1fa925[_0x5267('0x30')]);_0x161fed[_0x5267('0x39')]=_[_0x5267('0x32')](_0x161fed[_0x5267('0x2f')],_0x161fed['query']);_0x299a13[_0x5267('0x33')]=_['intersection'](_0x161fed[_0x5267('0x2f')],qs['fields'](_0x1fa925['query'][_0x5267('0x34')]));_0x299a13['attributes']=_0x299a13[_0x5267('0x33')][_0x5267('0x35')]?_0x299a13[_0x5267('0x33')]:_0x161fed[_0x5267('0x2f')];if(_0x1fa925['query'][_0x5267('0x3e')]){_0x299a13['include']=[{'all':!![]}];}_0x299a13=_['merge']({},_0x299a13,_0x1fa925[_0x5267('0x3d')]);return db[_0x5267('0x2a')]['find'](_0x299a13)['then'](handleEntityNotFound(_0xc764cd,null))[_0x5267('0x25')](respondWithResult(_0xc764cd,null))[_0x5267('0x40')](handleError(_0xc764cd,null));};exports[_0x5267('0x42')]=function(_0x1b5a7e,_0x1c2803){return db[_0x5267('0x2a')][_0x5267('0x42')](_0x1b5a7e[_0x5267('0x43')],{})[_0x5267('0x25')](function(_0x2cfe09){var _0x21b040=_0x1b5a7e[_0x5267('0x44')][_0x5267('0x26')]({'plain':!![]});if(!_0x21b040)throw new Error(_0x5267('0x45'));if(_0x21b040['role']===_0x5267('0x44')){var _0x466d46=_0x2cfe09[_0x5267('0x26')]({'plain':!![]});var _0x4f0148=_0x5267('0x46');return db[_0x5267('0x47')][_0x5267('0x48')]({'where':{'name':_0x4f0148,'userProfileId':_0x21b040[_0x5267('0x49')]},'raw':!![]})[_0x5267('0x25')](function(_0x1457cf){if(_0x1457cf&&_0x1457cf['autoAssociation']===0x0){return db[_0x5267('0x4a')]['create']({'name':_0x466d46[_0x5267('0x28')],'resourceId':_0x466d46['id'],'type':_0x5267('0x27'),'sectionId':_0x1457cf['id']},{})[_0x5267('0x25')](function(){return _0x2cfe09;});}else{return _0x2cfe09;}})[_0x5267('0x40')](function(_0x91b932){logger[_0x5267('0x4b')](_0x5267('0x4c'),_0x91b932);throw _0x91b932;});}return _0x2cfe09;})['then'](respondWithResult(_0x1c2803,0xc9))['catch'](handleError(_0x1c2803,null));};exports[_0x5267('0x4d')]=function(_0x15b5c9,_0x566b6f){if(_0x15b5c9[_0x5267('0x43')]['id']){delete _0x15b5c9['body']['id'];}return db['AnalyticDefaultReport'][_0x5267('0x48')]({'where':{'id':_0x15b5c9[_0x5267('0x41')]['id']}})[_0x5267('0x25')](handleEntityNotFound(_0x566b6f,null))[_0x5267('0x25')](saveUpdates(_0x15b5c9[_0x5267('0x43')],null))[_0x5267('0x25')](respondWithResult(_0x566b6f,null))[_0x5267('0x40')](handleError(_0x566b6f,null));};exports[_0x5267('0x24')]=function(_0xf0b5a9,_0x43d254){return db['AnalyticDefaultReport'][_0x5267('0x48')]({'where':{'id':_0xf0b5a9[_0x5267('0x41')]['id']}})[_0x5267('0x25')](handleEntityNotFound(_0x43d254,null))[_0x5267('0x25')](removeEntity(_0x43d254,null))[_0x5267('0x40')](handleError(_0x43d254,null));};exports[_0x5267('0x4e')]=function(_0x552211,_0x195575){var _0x5ad1ce=0xa;var _0x1522d6=[_0x5267('0x4f'),_0x5267('0x50'),'right_join',_0x5267('0x51')];var _0x161dab={'SUM':_0x5267('0x52'),'COUNT':_0x5267('0x53'),'COUNT DISTINCT':_0x5267('0x54'),'MAX':_0x5267('0x55'),'MIN':'MIN(%s)','AVG':_0x5267('0x56'),'GROUP_CONCAT':_0x5267('0x57'),'GROUP_CONCAT ASC':_0x5267('0x58'),'GROUP_CONCAT DESC':_0x5267('0x59')};var _0x51220c={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x5267('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0x5267('0x5b'),'UNIX_TIMESTAMP':_0x5267('0x5c')};var _0x4e3771=function(_0x489780){return!_[_0x5267('0x5d')]([_0x5267('0x5e'),_0x5267('0x5f'),'IS\x20EMPTY',_0x5267('0x60')],_0x489780);};var _0xc88193=function(_0x293e61){if(!_0x293e61||!_0x293e61[_0x5267('0x61')]['length']){return'';}for(var _0x5a87b5='(',_0x540ab8=0x0;_0x540ab8<_0x293e61[_0x5267('0x61')][_0x5267('0x35')];_0x540ab8+=0x1){_0x540ab8>0x0&&(_0x5a87b5+='\x20'+_0x293e61[_0x5267('0x62')]+'\x20');_0x5a87b5+=_0x293e61[_0x5267('0x61')][_0x540ab8][_0x5267('0x63')]?_0xc88193(_0x293e61[_0x5267('0x61')][_0x540ab8][_0x5267('0x63')]):_0x293e61[_0x5267('0x61')][_0x540ab8]['field']+'\x20'+_0x293e61[_0x5267('0x61')][_0x540ab8][_0x5267('0x64')]+(_0x4e3771(_0x293e61['rules'][_0x540ab8][_0x5267('0x64')])?'\x20'+_0x293e61[_0x5267('0x61')][_0x540ab8][_0x5267('0x65')]:'');}return _0x5a87b5+')';};var _0x1b6dd7={'where':{'id':_0x552211[_0x5267('0x41')]['id']}},_0x19adf5,_0xde1ecd,_0x4915f4,_0x2ca259,_0x726410;_0x1b6dd7=_[_0x5267('0x3c')]({},_0x1b6dd7,_0x552211[_0x5267('0x3d')]);return db[_0x5267('0x2a')]['find'](_0x1b6dd7)[_0x5267('0x25')](function(_0x87465){if(_0x87465){_0x19adf5=_0x87465;return _0x87465[_0x5267('0x66')]();}return null;})[_0x5267('0x25')](function(_0x1a4016){if(_0x1a4016){if(!_0x1a4016[_0x5267('0x35')]){throw new db['Sequelize'][(_0x5267('0x67'))](_0x5267('0x68'),0x193);}_0xde1ecd=_0x1a4016;return db[_0x5267('0x69')][_0x5267('0x6a')]({'raw':!![]});}return null;})['then'](function(_0x516e6e){if(_0x516e6e){_0x4915f4=_['keyBy'](_0x516e6e,'id');var _0x910f97;var _0x5cca85=squel[_0x5267('0x6b')]();_0x5cca85['from'](_0x19adf5[_0x5267('0x6c')]);for(var _0x1150ba=0x0;_0x1150ba<_0xde1ecd[_0x5267('0x35')];_0x1150ba+=0x1){_0x910f97=_0xde1ecd[_0x1150ba][_0x5267('0x6d')]?_0x4915f4[_0xde1ecd[_0x1150ba][_0x5267('0x6d')]][_0x5267('0x6e')]:_0xde1ecd[_0x1150ba][_0x5267('0x6f')];_0x910f97=_0xde1ecd[_0x1150ba][_0x5267('0x70')]?_['replace'](_0x161dab[_0xde1ecd[_0x1150ba]['function']],'%s',_0x910f97):_0x910f97;_0x910f97=_0xde1ecd[_0x1150ba]['format']?_[_0x5267('0x71')](_0x51220c[_0xde1ecd[_0x1150ba][_0x5267('0x72')]],'%s',_0x910f97):_0x910f97;if(_0xde1ecd[_0x1150ba][_0x5267('0x73')]){_0x5cca85[_0x5267('0x63')](_0x910f97);}_0xde1ecd[_0x1150ba]['orderBy']&&_0x5cca85[_0x5267('0x74')](_0x910f97,_0xde1ecd[_0x1150ba][_0x5267('0x75')]===_0x5267('0x76')?![]:!![]);_0x5cca85[_0x5267('0x6f')](_0x910f97,_0xde1ecd[_0x1150ba]['alias']||_0x910f97);}if(_0x19adf5[_0x5267('0x77')]){_0x19adf5[_0x5267('0x77')]=JSON['parse'](_0x19adf5[_0x5267('0x77')]);for(var _0x268805=0x0;_0x268805<_0x19adf5['joins']['length'];_0x268805+=0x1){if(_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x2d')]&&_['includes'](_0x1522d6,_0x19adf5['joins'][_0x268805][_0x5267('0x2d')])&&_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x78')]&&_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x79')]&&_0x19adf5['joins'][_0x268805][_0x5267('0x7a')]){_0x5cca85[_0x19adf5[_0x5267('0x77')][_0x268805]['type']](_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x79')],null,util[_0x5267('0x72')](_0x5267('0x7b'),_0x19adf5[_0x5267('0x6c')],_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x78')],_0x19adf5[_0x5267('0x77')][_0x268805]['foreignTable'],_0x19adf5['joins'][_0x268805][_0x5267('0x7a')]));}}}if(_0x19adf5[_0x5267('0x7c')]){_0x19adf5[_0x5267('0x7c')]=JSON[_0x5267('0x7d')](_0x19adf5['conditions']);_0x5cca85[_0x5267('0x38')](_0xc88193(_0x19adf5['conditions'][_0x5267('0x63')]));}_0x726410=_0x5cca85[_0x5267('0x7e')]();_0x5cca85[_0x5267('0x1d')](_0x5ad1ce);_0x5cca85[_0x5267('0x1b')](0x0);logger['debug']('Limited\x20Query:',_0x5cca85[_0x5267('0x7f')]());return dbH[_0x5267('0x80')][_0x5267('0x30')](_0x5cca85[_0x5267('0x7f')](),{'type':dbH[_0x5267('0x80')][_0x5267('0x81')]['SELECT']});}})[_0x5267('0x25')](respondWithResult(_0x195575,null))['catch'](handleError(_0x195575,null));};function runReport(_0x418a03,_0x5b8026,_0x2c2b95){var _0x20888d=_0x5b8026[_0x5267('0x28')];var _0x87aa90=0xa;var _0x164cc1=[_0x5267('0x4f'),_0x5267('0x50'),_0x5267('0x82'),_0x5267('0x51')];var _0x28e4b6={'SUM':_0x5267('0x52'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x5267('0x54'),'MAX':_0x5267('0x55'),'MIN':'MIN(%s)','AVG':_0x5267('0x56'),'GROUP_CONCAT':_0x5267('0x57'),'GROUP_CONCAT ASC':_0x5267('0x58'),'GROUP_CONCAT DESC':_0x5267('0x59')};var _0xd18795={'SEC_TO_TIME':_0x5267('0x83'),'DATE':_0x5267('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0x5267('0x5b'),'UNIX_TIMESTAMP':_0x5267('0x5c')};var _0x2543a4=function(_0x2feea8){return!_[_0x5267('0x5d')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x5267('0x84'),_0x5267('0x60')],_0x2feea8);};var _0x199ff6=function(_0xbf36fb){if(!_0xbf36fb||!_0xbf36fb['rules'][_0x5267('0x35')]){return'';}for(var _0x3cc775='(',_0x2630f2=0x0;_0x2630f2<_0xbf36fb[_0x5267('0x61')][_0x5267('0x35')];_0x2630f2+=0x1){_0x2630f2>0x0&&(_0x3cc775+='\x20'+_0xbf36fb[_0x5267('0x62')]+'\x20');_0x3cc775+=_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x63')]?_0x199ff6(_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x63')]):_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x6f')]+'\x20'+_0xbf36fb[_0x5267('0x61')][_0x2630f2]['condition']+(_0x2543a4(_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x64')])?'\x20'+_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x65')]:'');}return _0x3cc775+')';};var _0x447b5f={'where':{'id':_0x418a03['id']}},_0x25ce90,_0x257c69,_0x160c9c,_0x42694a,_0x11a2f4;_0x447b5f=_[_0x5267('0x3c')]({},_0x447b5f,_0x2c2b95);return db[_0x5267('0x2a')][_0x5267('0x48')](_0x447b5f)[_0x5267('0x25')](function(_0x35c3b7){if(_0x35c3b7){_0x25ce90=_0x35c3b7;return _0x35c3b7[_0x5267('0x66')]();}return null;})[_0x5267('0x25')](function(_0x35a4a3){if(_0x35a4a3){if(!_0x35a4a3[_0x5267('0x35')]){throw new db[(_0x5267('0x85'))][(_0x5267('0x67'))](_0x5267('0x68'),0x193);}_0x257c69=_0x35a4a3;return db[_0x5267('0x69')]['findAll']({'raw':!![]});}return null;})[_0x5267('0x25')](function(_0x318393){if(_0x318393){_0x160c9c=_[_0x5267('0x86')](_0x318393,'id');var _0x405eb4;var _0x38f5b7=squel['select']();_0x38f5b7[_0x5267('0x87')](_0x25ce90[_0x5267('0x6c')]);for(var _0x4c68cd=0x0;_0x4c68cd<_0x257c69['length'];_0x4c68cd+=0x1){_0x405eb4=_0x257c69[_0x4c68cd]['MetricId']?_0x160c9c[_0x257c69[_0x4c68cd][_0x5267('0x6d')]]['metric']:_0x257c69[_0x4c68cd][_0x5267('0x6f')];_0x405eb4=_0x257c69[_0x4c68cd]['function']?_['replace'](_0x28e4b6[_0x257c69[_0x4c68cd][_0x5267('0x70')]],'%s',_0x405eb4):_0x405eb4;_0x405eb4=_0x257c69[_0x4c68cd][_0x5267('0x72')]?_[_0x5267('0x71')](_0xd18795[_0x257c69[_0x4c68cd][_0x5267('0x72')]],'%s',_0x405eb4):_0x405eb4;if(_0x257c69[_0x4c68cd][_0x5267('0x73')]){_0x38f5b7['group'](_0x405eb4);}_0x257c69[_0x4c68cd]['orderBy']&&_0x38f5b7[_0x5267('0x74')](_0x405eb4,_0x257c69[_0x4c68cd][_0x5267('0x75')]===_0x5267('0x76')?![]:!![]);_0x38f5b7[_0x5267('0x6f')](_0x405eb4,_0x257c69[_0x4c68cd][_0x5267('0x88')]||_0x405eb4);}if(_0x25ce90['joins']){_0x25ce90[_0x5267('0x77')]=JSON['parse'](_0x25ce90['joins']);for(var _0x3dfd8d=0x0;_0x3dfd8d<_0x25ce90['joins']['length'];_0x3dfd8d+=0x1){if(_0x25ce90[_0x5267('0x77')][_0x3dfd8d][_0x5267('0x2d')]&&_['includes'](_0x164cc1,_0x25ce90['joins'][_0x3dfd8d]['type'])&&_0x25ce90[_0x5267('0x77')][_0x3dfd8d]['parentKey']&&_0x25ce90[_0x5267('0x77')][_0x3dfd8d]['foreignTable']&&_0x25ce90[_0x5267('0x77')][_0x3dfd8d][_0x5267('0x7a')]){_0x38f5b7[_0x25ce90['joins'][_0x3dfd8d][_0x5267('0x2d')]](_0x25ce90[_0x5267('0x77')][_0x3dfd8d][_0x5267('0x79')],null,util[_0x5267('0x72')](_0x5267('0x7b'),_0x25ce90[_0x5267('0x6c')],_0x25ce90['joins'][_0x3dfd8d]['parentKey'],_0x25ce90[_0x5267('0x77')][_0x3dfd8d]['foreignTable'],_0x25ce90['joins'][_0x3dfd8d][_0x5267('0x7a')]));}}}if(_0x25ce90['conditions']){_0x25ce90[_0x5267('0x7c')]=JSON['parse'](_0x25ce90[_0x5267('0x7c')]);_0x38f5b7['where'](_0x199ff6(_0x25ce90[_0x5267('0x7c')][_0x5267('0x63')]));}_0x11a2f4=_0x38f5b7[_0x5267('0x7e')]();_0x38f5b7[_0x5267('0x1d')](_0x87aa90);_0x38f5b7[_0x5267('0x1b')](0x0);return;}})[_0x5267('0x25')](function(){if(_0x5b8026[_0x5267('0x89')]==='web'){return null;}var _0x4df99f=_[_0x5267('0x3c')](_0x5b8026,{'name':_0x5b8026['fullPath']||_0x5b8026['name']||_0x25ce90['name'],'basename':_0x20888d,'savename':util['format']('%s-%s.%s',_0x5b8026['name']||_0x25ce90[_0x5267('0x28')],require(_0x5267('0x8a'))[_0x5267('0x8b')](0x4),_0x5b8026[_0x5267('0x89')]||_0x5267('0x8c')),'reportId':_0x25ce90['id'],'reportType':_0x5267('0x8d')});return db[_0x5267('0x8e')][_0x5267('0x42')](_0x4df99f,{'raw':!![]});})['then'](function(_0x5df23d){if(_0x25ce90['table']===_0x5267('0x8f')){_0x11a2f4[_0x5267('0x38')](_0x25ce90['table']+_0x5267('0x90'),_0x5b8026[_0x5267('0x91')],_0x5b8026[_0x5267('0x92')]);}else{_0x11a2f4[_0x5267('0x38')](_0x25ce90['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x5b8026[_0x5267('0x91')],_0x5b8026[_0x5267('0x92')]);}if(_0x5df23d){logger[_0x5267('0x93')](_0x5267('0x94'),_0x11a2f4[_0x5267('0x7f')]());require(_0x5267('0x95'))[_0x5267('0x96')](path['join'](__dirname,'../../components/export/',_0x5df23d['output']),[_0x5df23d['id'],_0x11a2f4[_0x5267('0x7f')](),path[_0x5267('0x4f')](__dirname,_0x5267('0x97'),_0x5df23d[_0x5267('0x98')]),_0x20888d]);return _0x5df23d;}else{var _0x190ef4=squel[_0x5267('0x6b')]();_0x190ef4['from']('('+_0x11a2f4[_0x5267('0x7f')]()+')','countTable');_0x190ef4[_0x5267('0x6f')](_0x5267('0x99'),_0x5267('0x1e'));_0x11a2f4[_0x5267('0x1d')](_0x5b8026[_0x5267('0x1d')]||_0x87aa90);_0x11a2f4['offset'](_0x5b8026[_0x5267('0x1b')]||0x0);return dbH[_0x5267('0x80')][_0x5267('0x30')](_0x190ef4['toString'](),{'type':dbH['sequelize']['QueryTypes'][_0x5267('0x9a')]})[_0x5267('0x25')](function(_0x1be763){if(!_0x1be763[_0x5267('0x35')]){_0x42694a=0x0;}else{_0x42694a=_0x1be763[0x0]['count']||0x0;}return dbH['sequelize'][_0x5267('0x30')](_0x11a2f4[_0x5267('0x7f')](),{'type':dbH['sequelize'][_0x5267('0x81')][_0x5267('0x9a')]});})['then'](function(_0x5005b3){return{'rows':_0x5005b3||[],'count':_0x42694a};});}});}exports[_0x5267('0x9b')]=function(_0x11a6f4,_0x5a16ee){return runReport(_0x11a6f4[_0x5267('0x41')],_0x11a6f4[_0x5267('0x30')],_0x11a6f4[_0x5267('0x3d')])[_0x5267('0x25')](respondWithResult(_0x5a16ee,null))[_0x5267('0x40')](handleError(_0x5a16ee,null));};exports[_0x5267('0x9c')]=runReport;exports[_0x5267('0x30')]=function(_0x1e9651,_0x66da7a){var _0x54b582=0xa;var _0x4e4724=[_0x5267('0x4f'),'left_join',_0x5267('0x82'),_0x5267('0x51')];var _0x2722f9={'SUM':_0x5267('0x52'),'COUNT':_0x5267('0x53'),'COUNT DISTINCT':_0x5267('0x54'),'MAX':_0x5267('0x55'),'MIN':_0x5267('0x9d'),'AVG':_0x5267('0x56'),'GROUP_CONCAT':_0x5267('0x57'),'GROUP_CONCAT ASC':_0x5267('0x58'),'GROUP_CONCAT DESC':_0x5267('0x59')};var _0x5909b3={'SEC_TO_TIME':_0x5267('0x83'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x5267('0x5b'),'UNIX_TIMESTAMP':_0x5267('0x5c')};var _0x1d7987=function(_0x59efe1){return!_[_0x5267('0x5d')]([_0x5267('0x5e'),_0x5267('0x5f'),_0x5267('0x84'),_0x5267('0x60')],_0x59efe1);};var _0x46c79e=function(_0xcfba51){if(!_0xcfba51||!_0xcfba51[_0x5267('0x61')][_0x5267('0x35')]){return'';}for(var _0x3c5516='(',_0x1e8367=0x0;_0x1e8367<_0xcfba51[_0x5267('0x61')]['length'];_0x1e8367+=0x1){_0x1e8367>0x0&&(_0x3c5516+='\x20'+_0xcfba51[_0x5267('0x62')]+'\x20');_0x3c5516+=_0xcfba51[_0x5267('0x61')][_0x1e8367]['group']?_0x46c79e(_0xcfba51[_0x5267('0x61')][_0x1e8367][_0x5267('0x63')]):_0xcfba51[_0x5267('0x61')][_0x1e8367][_0x5267('0x6f')]+'\x20'+_0xcfba51['rules'][_0x1e8367][_0x5267('0x64')]+(_0x1d7987(_0xcfba51[_0x5267('0x61')][_0x1e8367][_0x5267('0x64')])?'\x20'+_0xcfba51['rules'][_0x1e8367][_0x5267('0x65')]:'');}return _0x3c5516+')';};var _0x19935d={'where':{'id':_0x1e9651[_0x5267('0x41')]['id']}},_0x3102e0,_0x2d215e,_0xc0af94,_0x178080,_0x3485ab;_0x19935d=_[_0x5267('0x3c')]({},_0x19935d,_0x1e9651['options']);return db[_0x5267('0x2a')][_0x5267('0x48')](_0x19935d)['then'](function(_0x17d2d4){if(_0x17d2d4){_0x3102e0=_0x17d2d4;return _0x17d2d4['getFields']();}return null;})[_0x5267('0x25')](function(_0x4c5a26){if(_0x4c5a26){if(!_0x4c5a26[_0x5267('0x35')]){throw new db[(_0x5267('0x85'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2d215e=_0x4c5a26;return db[_0x5267('0x69')][_0x5267('0x6a')]({'raw':!![]});}return null;})[_0x5267('0x25')](function(_0x1a0883){if(_0x1a0883){_0xc0af94=_[_0x5267('0x86')](_0x1a0883,'id');var _0x501da6;var _0x3dcf73=squel['select']();_0x3dcf73['from'](_0x3102e0['table']);for(var _0x1ded05=0x0;_0x1ded05<_0x2d215e[_0x5267('0x35')];_0x1ded05+=0x1){_0x501da6=_0x2d215e[_0x1ded05][_0x5267('0x6d')]?_0xc0af94[_0x2d215e[_0x1ded05][_0x5267('0x6d')]][_0x5267('0x6e')]:_0x2d215e[_0x1ded05][_0x5267('0x6f')];_0x501da6=_0x2d215e[_0x1ded05][_0x5267('0x70')]?_['replace'](_0x2722f9[_0x2d215e[_0x1ded05]['function']],'%s',_0x501da6):_0x501da6;_0x501da6=_0x2d215e[_0x1ded05][_0x5267('0x72')]?_[_0x5267('0x71')](_0x5909b3[_0x2d215e[_0x1ded05][_0x5267('0x72')]],'%s',_0x501da6):_0x501da6;if(_0x2d215e[_0x1ded05][_0x5267('0x73')]){_0x3dcf73[_0x5267('0x63')](_0x501da6);}_0x2d215e[_0x1ded05]['orderBy']&&_0x3dcf73[_0x5267('0x74')](_0x501da6,_0x2d215e[_0x1ded05][_0x5267('0x75')]===_0x5267('0x76')?![]:!![]);_0x3dcf73[_0x5267('0x6f')](_0x501da6,_0x2d215e[_0x1ded05][_0x5267('0x88')]||_0x501da6);}if(_0x3102e0['joins']){_0x3102e0[_0x5267('0x77')]=JSON[_0x5267('0x7d')](_0x3102e0[_0x5267('0x77')]);for(var _0x4bfafd=0x0;_0x4bfafd<_0x3102e0[_0x5267('0x77')]['length'];_0x4bfafd+=0x1){if(_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x2d')]&&_['includes'](_0x4e4724,_0x3102e0[_0x5267('0x77')][_0x4bfafd]['type'])&&_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x78')]&&_0x3102e0['joins'][_0x4bfafd][_0x5267('0x79')]&&_0x3102e0[_0x5267('0x77')][_0x4bfafd]['foreignKey']){_0x3dcf73[_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x2d')]](_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x79')],null,util[_0x5267('0x72')]('%s.%s\x20=\x20%s.%s',_0x3102e0['table'],_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x78')],_0x3102e0['joins'][_0x4bfafd][_0x5267('0x79')],_0x3102e0['joins'][_0x4bfafd][_0x5267('0x7a')]));}}}if(_0x3102e0[_0x5267('0x7c')]){_0x3102e0[_0x5267('0x7c')]=JSON[_0x5267('0x7d')](_0x3102e0[_0x5267('0x7c')]);_0x3dcf73[_0x5267('0x38')](_0x46c79e(_0x3102e0[_0x5267('0x7c')][_0x5267('0x63')]));}_0x3485ab=_0x3dcf73[_0x5267('0x7e')]();_0x3dcf73[_0x5267('0x1d')](_0x54b582);_0x3dcf73[_0x5267('0x1b')](0x0);logger[_0x5267('0x9e')]('Limited\x20Query:',_0x3dcf73[_0x5267('0x7f')]());return dbH[_0x5267('0x80')][_0x5267('0x30')](_0x3dcf73[_0x5267('0x7f')](),{'type':dbH[_0x5267('0x80')][_0x5267('0x81')][_0x5267('0x9a')]});}})[_0x5267('0x25')](function(){return{'sql':_0x3485ab[_0x5267('0x7f')]()};})[_0x5267('0x25')](respondWithResult(_0x66da7a,null))[_0x5267('0x40')](handleError(_0x66da7a,null));}; \ No newline at end of file +var _0xda19=['ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','field','function','replace','groupBy','orderBy','order','alias','joins','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','left_join','HOUR(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20EMPTY','operator','Sequelize','metric','format','DESC','parse','parentKey','web','output','csv','default','AnalyticExtractedReport','cdr','startDate','endDate','info','Run\x20Query:','child_process','fork','../../files/reports','savename','countTable','run','runReport','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','dbH','status','json','offset','undefined','limit','count','set','apply','update','then','DefaultReports','destroy','end','error','stack','name','send','map','AnalyticDefaultReport','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','type','VIRTUAL','merge','includeAll','include','findAll','show','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','group','condition','value','options','find','getFields'];(function(_0x347ea8,_0x2ac098){var _0x2e83f4=function(_0x430d5f){while(--_0x430d5f){_0x347ea8['push'](_0x347ea8['shift']());}};_0x2e83f4(++_0x2ac098);}(_0xda19,0xd5));var _0x9da1=function(_0x2df852,_0x1bba56){_0x2df852=_0x2df852-0x0;var _0x539ff8=_0xda19[_0x2df852];return _0x539ff8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9da1('0x0'));var zipdir=require(_0x9da1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9da1('0x2'));var moment=require('moment');var BPromise=require(_0x9da1('0x3'));var Mustache=require('mustache');var util=require(_0x9da1('0x4'));var path=require(_0x9da1('0x5'));var sox=require(_0x9da1('0x6'));var csv=require(_0x9da1('0x7'));var ejs=require(_0x9da1('0x8'));var fs=require('fs');var fs_extra=require(_0x9da1('0x9'));var _=require(_0x9da1('0xa'));var squel=require(_0x9da1('0xb'));var crypto=require(_0x9da1('0xc'));var jsforce=require(_0x9da1('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9da1('0xe'));var Redis=require('ioredis');var authService=require(_0x9da1('0xf'));var qs=require(_0x9da1('0x10'));var as=require(_0x9da1('0x11'));var hardwareService=require(_0x9da1('0x12'));var logger=require(_0x9da1('0x13'))(_0x9da1('0x14'));var utils=require(_0x9da1('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9da1('0x16'))['db'];var dbH=require('../../mysqldb')[_0x9da1('0x17')];function respondWithStatusCode(_0x1d93f8,_0xd2d225){_0xd2d225=_0xd2d225||0xcc;return function(_0x1ffa2a){if(_0x1ffa2a){return _0x1d93f8['sendStatus'](_0xd2d225);}return _0x1d93f8[_0x9da1('0x18')](_0xd2d225)['end']();};}function respondWithResult(_0x4d17e1,_0x40ba9d){_0x40ba9d=_0x40ba9d||0xc8;return function(_0x479ccd){if(_0x479ccd){return _0x4d17e1[_0x9da1('0x18')](_0x40ba9d)[_0x9da1('0x19')](_0x479ccd);}};}function respondWithFilteredResult(_0x37653d,_0x1a1a6b){return function(_0x7f1a64){if(_0x7f1a64){var _0x514d8e=typeof _0x1a1a6b[_0x9da1('0x1a')]===_0x9da1('0x1b')&&typeof _0x1a1a6b[_0x9da1('0x1c')]===_0x9da1('0x1b');var _0xfb278d=_0x7f1a64[_0x9da1('0x1d')];var _0x497676=_0x514d8e?0x0:_0x1a1a6b['offset'];var _0x17205d=_0x514d8e?_0x7f1a64[_0x9da1('0x1d')]:_0x1a1a6b[_0x9da1('0x1a')]+_0x1a1a6b[_0x9da1('0x1c')];var _0x40a967;if(_0x17205d>=_0xfb278d){_0x17205d=_0xfb278d;_0x40a967=0xc8;}else{_0x40a967=0xce;}_0x37653d[_0x9da1('0x18')](_0x40a967);return _0x37653d[_0x9da1('0x1e')]('Content-Range',_0x497676+'-'+_0x17205d+'/'+_0xfb278d)[_0x9da1('0x19')](_0x7f1a64);}return null;};}function patchUpdates(_0x554845){return function(_0x9c3b37){try{jsonpatch[_0x9da1('0x1f')](_0x9c3b37,_0x554845,!![]);}catch(_0x1fc065){return BPromise['reject'](_0x1fc065);}return _0x9c3b37['save']();};}function saveUpdates(_0x14793b,_0x3e6f85){return function(_0x16ee0c){if(_0x16ee0c){return _0x16ee0c[_0x9da1('0x20')](_0x14793b)[_0x9da1('0x21')](function(_0x165b73){return _0x165b73;});}return null;};}function removeEntity(_0x4c60aa,_0x2413fe){return function(_0x3bfa40){if(_0x3bfa40){return _0x3bfa40['destroy']()[_0x9da1('0x21')](function(){var _0x3f5680=_0x3bfa40['get']({'plain':!![]});var _0x2fd49c=_0x9da1('0x22');return db['UserProfileResource'][_0x9da1('0x23')]({'where':{'type':_0x2fd49c,'resourceId':_0x3f5680['id']}})[_0x9da1('0x21')](function(){return _0x3bfa40;});})['then'](function(){_0x4c60aa['status'](0xcc)[_0x9da1('0x24')]();});}};}function handleEntityNotFound(_0x47055e,_0x5eca5b){return function(_0x27c6e2){if(!_0x27c6e2){_0x47055e['sendStatus'](0x194);}return _0x27c6e2;};}function handleError(_0x5a6f2d,_0x5a59c2){_0x5a59c2=_0x5a59c2||0x1f4;return function(_0x31b826){logger[_0x9da1('0x25')](_0x31b826[_0x9da1('0x26')]);if(_0x31b826[_0x9da1('0x27')]){delete _0x31b826[_0x9da1('0x27')];}_0x5a6f2d['status'](_0x5a59c2)[_0x9da1('0x28')](_0x31b826);};}exports['index']=function(_0x1feae0,_0x235ced){var _0x5b38b3={},_0xc29ba8={},_0x2eb48f={'count':0x0,'rows':[]};var _0x4f318b=_[_0x9da1('0x29')](db[_0x9da1('0x2a')][_0x9da1('0x2b')],function(_0x2b2b48){return{'name':_0x2b2b48['fieldName'],'type':_0x2b2b48['type'][_0x9da1('0x2c')]};});_0xc29ba8[_0x9da1('0x2d')]=_[_0x9da1('0x29')](_0x4f318b,_0x9da1('0x27'));_0xc29ba8[_0x9da1('0x2e')]=_['keys'](_0x1feae0[_0x9da1('0x2e')]);_0xc29ba8[_0x9da1('0x2f')]=_[_0x9da1('0x30')](_0xc29ba8[_0x9da1('0x2d')],_0xc29ba8[_0x9da1('0x2e')]);_0x5b38b3[_0x9da1('0x31')]=_['intersection'](_0xc29ba8[_0x9da1('0x2d')],qs['fields'](_0x1feae0['query'][_0x9da1('0x32')]));_0x5b38b3['attributes']=_0x5b38b3[_0x9da1('0x31')][_0x9da1('0x33')]?_0x5b38b3[_0x9da1('0x31')]:_0xc29ba8[_0x9da1('0x2d')];if(!_0x1feae0[_0x9da1('0x2e')][_0x9da1('0x34')](_0x9da1('0x35'))){_0x5b38b3[_0x9da1('0x1c')]=qs['limit'](_0x1feae0[_0x9da1('0x2e')]['limit']);_0x5b38b3[_0x9da1('0x1a')]=qs['offset'](_0x1feae0['query'][_0x9da1('0x1a')]);}_0x5b38b3['order']=qs[_0x9da1('0x36')](_0x1feae0[_0x9da1('0x2e')]['sort']);_0x5b38b3[_0x9da1('0x37')]=qs[_0x9da1('0x2f')](_[_0x9da1('0x38')](_0x1feae0[_0x9da1('0x2e')],_0xc29ba8['filters']),_0x4f318b);if(_0x1feae0[_0x9da1('0x2e')]['filter']){_0x5b38b3[_0x9da1('0x37')]=_['merge'](_0x5b38b3[_0x9da1('0x37')],{'$or':_[_0x9da1('0x29')](_0x4f318b,function(_0x58e165){if(_0x58e165[_0x9da1('0x39')]!==_0x9da1('0x3a')){var _0x394acf={};_0x394acf[_0x58e165['name']]={'$like':'%'+_0x1feae0['query']['filter']+'%'};return _0x394acf;}})});}_0x5b38b3=_[_0x9da1('0x3b')]({},_0x5b38b3,_0x1feae0['options']);var _0x5b215c={'where':_0x5b38b3[_0x9da1('0x37')]};return db[_0x9da1('0x2a')][_0x9da1('0x1d')](_0x5b215c)['then'](function(_0x42dbd8){_0x2eb48f[_0x9da1('0x1d')]=_0x42dbd8;if(_0x1feae0[_0x9da1('0x2e')][_0x9da1('0x3c')]){_0x5b38b3[_0x9da1('0x3d')]=[{'all':!![]}];}return db[_0x9da1('0x2a')][_0x9da1('0x3e')](_0x5b38b3);})['then'](function(_0x467350){_0x2eb48f['rows']=_0x467350;return _0x2eb48f;})[_0x9da1('0x21')](respondWithFilteredResult(_0x235ced,_0x5b38b3))['catch'](handleError(_0x235ced,null));};exports[_0x9da1('0x3f')]=function(_0x40d848,_0x599211){var _0x265366={'raw':!![],'where':{'id':_0x40d848['params']['id']}},_0xfeec5f={};_0xfeec5f[_0x9da1('0x2d')]=_['keys'](db[_0x9da1('0x2a')][_0x9da1('0x2b')]);_0xfeec5f['query']=_['keys'](_0x40d848[_0x9da1('0x2e')]);_0xfeec5f[_0x9da1('0x2f')]=_[_0x9da1('0x30')](_0xfeec5f[_0x9da1('0x2d')],_0xfeec5f[_0x9da1('0x2e')]);_0x265366[_0x9da1('0x31')]=_[_0x9da1('0x30')](_0xfeec5f[_0x9da1('0x2d')],qs['fields'](_0x40d848[_0x9da1('0x2e')][_0x9da1('0x32')]));_0x265366[_0x9da1('0x31')]=_0x265366['attributes'][_0x9da1('0x33')]?_0x265366[_0x9da1('0x31')]:_0xfeec5f[_0x9da1('0x2d')];if(_0x40d848['query'][_0x9da1('0x3c')]){_0x265366[_0x9da1('0x3d')]=[{'all':!![]}];}_0x265366=_[_0x9da1('0x3b')]({},_0x265366,_0x40d848['options']);return db[_0x9da1('0x2a')]['find'](_0x265366)['then'](handleEntityNotFound(_0x599211,null))[_0x9da1('0x21')](respondWithResult(_0x599211,null))[_0x9da1('0x40')](handleError(_0x599211,null));};exports['create']=function(_0x712d10,_0x2066d2){return db['AnalyticDefaultReport'][_0x9da1('0x41')](_0x712d10[_0x9da1('0x42')],{})[_0x9da1('0x21')](function(_0x3a529d){var _0x4780ca=_0x712d10[_0x9da1('0x43')][_0x9da1('0x44')]({'plain':!![]});if(!_0x4780ca)throw new Error(_0x9da1('0x45'));if(_0x4780ca[_0x9da1('0x46')]==='user'){var _0x147c65=_0x3a529d[_0x9da1('0x44')]({'plain':!![]});var _0x34a203=_0x9da1('0x47');return db['UserProfileSection']['find']({'where':{'name':_0x34a203,'userProfileId':_0x4780ca[_0x9da1('0x48')]},'raw':!![]})[_0x9da1('0x21')](function(_0x3870dd){if(_0x3870dd&&_0x3870dd[_0x9da1('0x49')]===0x0){return db[_0x9da1('0x4a')][_0x9da1('0x41')]({'name':_0x147c65[_0x9da1('0x27')],'resourceId':_0x147c65['id'],'type':_0x9da1('0x22'),'sectionId':_0x3870dd['id']},{})[_0x9da1('0x21')](function(){return _0x3a529d;});}else{return _0x3a529d;}})[_0x9da1('0x40')](function(_0x868167){logger[_0x9da1('0x25')](_0x9da1('0x4b'),_0x868167);throw _0x868167;});}return _0x3a529d;})[_0x9da1('0x21')](respondWithResult(_0x2066d2,0xc9))['catch'](handleError(_0x2066d2,null));};exports[_0x9da1('0x20')]=function(_0x1fbb5d,_0x4d241a){if(_0x1fbb5d[_0x9da1('0x42')]['id']){delete _0x1fbb5d['body']['id'];}return db[_0x9da1('0x2a')]['find']({'where':{'id':_0x1fbb5d[_0x9da1('0x4c')]['id']}})[_0x9da1('0x21')](handleEntityNotFound(_0x4d241a,null))[_0x9da1('0x21')](saveUpdates(_0x1fbb5d[_0x9da1('0x42')],null))[_0x9da1('0x21')](respondWithResult(_0x4d241a,null))[_0x9da1('0x40')](handleError(_0x4d241a,null));};exports[_0x9da1('0x23')]=function(_0x343b05,_0x170351){return db[_0x9da1('0x2a')]['find']({'where':{'id':_0x343b05[_0x9da1('0x4c')]['id']}})[_0x9da1('0x21')](handleEntityNotFound(_0x170351,null))[_0x9da1('0x21')](removeEntity(_0x170351,null))[_0x9da1('0x40')](handleError(_0x170351,null));};exports[_0x9da1('0x4d')]=function(_0x4607a9,_0x2020d0){var _0x3c01c3=0xa;var _0xfa8d3f=[_0x9da1('0x4e'),'left_join',_0x9da1('0x4f'),_0x9da1('0x50')];var _0x5bda2a={'SUM':_0x9da1('0x51'),'COUNT':_0x9da1('0x52'),'COUNT DISTINCT':_0x9da1('0x53'),'MAX':_0x9da1('0x54'),'MIN':_0x9da1('0x55'),'AVG':_0x9da1('0x56'),'GROUP_CONCAT':_0x9da1('0x57'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x9da1('0x58')};var _0xc27b00={'SEC_TO_TIME':_0x9da1('0x59'),'DATE':_0x9da1('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0x9da1('0x5b'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x27ac84=function(_0x10ebc9){return!_[_0x9da1('0x5c')]([_0x9da1('0x5d'),_0x9da1('0x5e'),_0x9da1('0x5f'),'IS\x20NOT\x20EMPTY'],_0x10ebc9);};var _0x5f5dc2=function(_0x454a68){if(!_0x454a68||!_0x454a68['rules']['length']){return'';}for(var _0x5b4a05='(',_0x6f86c3=0x0;_0x6f86c3<_0x454a68['rules'][_0x9da1('0x33')];_0x6f86c3+=0x1){_0x6f86c3>0x0&&(_0x5b4a05+='\x20'+_0x454a68['operator']+'\x20');_0x5b4a05+=_0x454a68[_0x9da1('0x60')][_0x6f86c3][_0x9da1('0x61')]?_0x5f5dc2(_0x454a68['rules'][_0x6f86c3][_0x9da1('0x61')]):_0x454a68[_0x9da1('0x60')][_0x6f86c3]['field']+'\x20'+_0x454a68[_0x9da1('0x60')][_0x6f86c3][_0x9da1('0x62')]+(_0x27ac84(_0x454a68['rules'][_0x6f86c3]['condition'])?'\x20'+_0x454a68[_0x9da1('0x60')][_0x6f86c3][_0x9da1('0x63')]:'');}return _0x5b4a05+')';};var _0x21d00c={'where':{'id':_0x4607a9['params']['id']}},_0x3ca531,_0x236b01,_0x44d7fe,_0x5cb102,_0x3d2c25;_0x21d00c=_['merge']({},_0x21d00c,_0x4607a9[_0x9da1('0x64')]);return db[_0x9da1('0x2a')][_0x9da1('0x65')](_0x21d00c)[_0x9da1('0x21')](function(_0x3382b1){if(_0x3382b1){_0x3ca531=_0x3382b1;return _0x3382b1[_0x9da1('0x66')]();}return null;})[_0x9da1('0x21')](function(_0x1f2a4b){if(_0x1f2a4b){if(!_0x1f2a4b[_0x9da1('0x33')]){throw new db['Sequelize'][(_0x9da1('0x67'))](_0x9da1('0x68'),0x193);}_0x236b01=_0x1f2a4b;return db[_0x9da1('0x69')][_0x9da1('0x3e')]({'raw':!![]});}return null;})[_0x9da1('0x21')](function(_0x491fcb){if(_0x491fcb){_0x44d7fe=_[_0x9da1('0x6a')](_0x491fcb,'id');var _0x13fadd;var _0x419f78=squel[_0x9da1('0x6b')]();_0x419f78[_0x9da1('0x6c')](_0x3ca531[_0x9da1('0x6d')]);for(var _0x55a6d2=0x0;_0x55a6d2<_0x236b01[_0x9da1('0x33')];_0x55a6d2+=0x1){_0x13fadd=_0x236b01[_0x55a6d2]['MetricId']?_0x44d7fe[_0x236b01[_0x55a6d2][_0x9da1('0x6e')]]['metric']:_0x236b01[_0x55a6d2][_0x9da1('0x6f')];_0x13fadd=_0x236b01[_0x55a6d2][_0x9da1('0x70')]?_[_0x9da1('0x71')](_0x5bda2a[_0x236b01[_0x55a6d2][_0x9da1('0x70')]],'%s',_0x13fadd):_0x13fadd;_0x13fadd=_0x236b01[_0x55a6d2]['format']?_['replace'](_0xc27b00[_0x236b01[_0x55a6d2]['format']],'%s',_0x13fadd):_0x13fadd;if(_0x236b01[_0x55a6d2][_0x9da1('0x72')]){_0x419f78[_0x9da1('0x61')](_0x13fadd);}_0x236b01[_0x55a6d2][_0x9da1('0x73')]&&_0x419f78[_0x9da1('0x74')](_0x13fadd,_0x236b01[_0x55a6d2]['orderBy']==='DESC'?![]:!![]);_0x419f78[_0x9da1('0x6f')](_0x13fadd,_0x236b01[_0x55a6d2][_0x9da1('0x75')]||_0x13fadd);}if(_0x3ca531[_0x9da1('0x76')]){_0x3ca531['joins']=JSON['parse'](_0x3ca531[_0x9da1('0x76')]);for(var _0x1deb93=0x0;_0x1deb93<_0x3ca531[_0x9da1('0x76')]['length'];_0x1deb93+=0x1){if(_0x3ca531['joins'][_0x1deb93][_0x9da1('0x39')]&&_[_0x9da1('0x5c')](_0xfa8d3f,_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x39')])&&_0x3ca531[_0x9da1('0x76')][_0x1deb93]['parentKey']&&_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x77')]&&_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x78')]){_0x419f78[_0x3ca531['joins'][_0x1deb93][_0x9da1('0x39')]](_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x77')],null,util['format'](_0x9da1('0x79'),_0x3ca531[_0x9da1('0x6d')],_0x3ca531[_0x9da1('0x76')][_0x1deb93]['parentKey'],_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x77')],_0x3ca531['joins'][_0x1deb93][_0x9da1('0x78')]));}}}if(_0x3ca531['conditions']){_0x3ca531[_0x9da1('0x7a')]=JSON['parse'](_0x3ca531[_0x9da1('0x7a')]);_0x419f78[_0x9da1('0x37')](_0x5f5dc2(_0x3ca531[_0x9da1('0x7a')][_0x9da1('0x61')]));}_0x3d2c25=_0x419f78[_0x9da1('0x7b')]();_0x419f78[_0x9da1('0x1c')](_0x3c01c3);_0x419f78[_0x9da1('0x1a')](0x0);logger[_0x9da1('0x7c')](_0x9da1('0x7d'),_0x419f78[_0x9da1('0x7e')]());return dbH[_0x9da1('0x7f')][_0x9da1('0x2e')](_0x419f78[_0x9da1('0x7e')](),{'type':dbH['sequelize'][_0x9da1('0x80')][_0x9da1('0x81')]});}})[_0x9da1('0x21')](respondWithResult(_0x2020d0,null))[_0x9da1('0x40')](handleError(_0x2020d0,null));};function runReport(_0x162597,_0x4f39bc,_0x1ca102){var _0x2eb5e6=_0x4f39bc['name'];var _0x4a4cda=0xa;var _0x84f8d8=[_0x9da1('0x4e'),_0x9da1('0x82'),_0x9da1('0x4f'),_0x9da1('0x50')];var _0x4701b3={'SUM':_0x9da1('0x51'),'COUNT':_0x9da1('0x52'),'COUNT DISTINCT':_0x9da1('0x53'),'MAX':_0x9da1('0x54'),'MIN':_0x9da1('0x55'),'AVG':_0x9da1('0x56'),'GROUP_CONCAT':_0x9da1('0x57'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x9da1('0x58')};var _0x3a0a84={'SEC_TO_TIME':_0x9da1('0x59'),'DATE':_0x9da1('0x5a'),'HOUR':_0x9da1('0x83'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x9da1('0x84')};var _0x354c5a=function(_0x53ab6a){return!_[_0x9da1('0x5c')](['IS\x20NULL',_0x9da1('0x5e'),'IS\x20EMPTY',_0x9da1('0x85')],_0x53ab6a);};var _0x106bd9=function(_0x347cb8){if(!_0x347cb8||!_0x347cb8[_0x9da1('0x60')][_0x9da1('0x33')]){return'';}for(var _0x3e331a='(',_0x1f785c=0x0;_0x1f785c<_0x347cb8[_0x9da1('0x60')][_0x9da1('0x33')];_0x1f785c+=0x1){_0x1f785c>0x0&&(_0x3e331a+='\x20'+_0x347cb8[_0x9da1('0x86')]+'\x20');_0x3e331a+=_0x347cb8[_0x9da1('0x60')][_0x1f785c][_0x9da1('0x61')]?_0x106bd9(_0x347cb8['rules'][_0x1f785c][_0x9da1('0x61')]):_0x347cb8[_0x9da1('0x60')][_0x1f785c][_0x9da1('0x6f')]+'\x20'+_0x347cb8[_0x9da1('0x60')][_0x1f785c][_0x9da1('0x62')]+(_0x354c5a(_0x347cb8[_0x9da1('0x60')][_0x1f785c]['condition'])?'\x20'+_0x347cb8['rules'][_0x1f785c][_0x9da1('0x63')]:'');}return _0x3e331a+')';};var _0xdecc82={'where':{'id':_0x162597['id']}},_0xe12dd7,_0x4cd85f,_0x4bf74c,_0x28335d,_0x175b4b;_0xdecc82=_[_0x9da1('0x3b')]({},_0xdecc82,_0x1ca102);return db[_0x9da1('0x2a')][_0x9da1('0x65')](_0xdecc82)[_0x9da1('0x21')](function(_0x5561f0){if(_0x5561f0){_0xe12dd7=_0x5561f0;return _0x5561f0[_0x9da1('0x66')]();}return null;})[_0x9da1('0x21')](function(_0x5a64fd){if(_0x5a64fd){if(!_0x5a64fd['length']){throw new db[(_0x9da1('0x87'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x4cd85f=_0x5a64fd;return db[_0x9da1('0x69')][_0x9da1('0x3e')]({'raw':!![]});}return null;})[_0x9da1('0x21')](function(_0x18ae08){if(_0x18ae08){_0x4bf74c=_[_0x9da1('0x6a')](_0x18ae08,'id');var _0x30065d;var _0x40a2ef=squel[_0x9da1('0x6b')]();_0x40a2ef['from'](_0xe12dd7['table']);for(var _0xd10ba4=0x0;_0xd10ba4<_0x4cd85f[_0x9da1('0x33')];_0xd10ba4+=0x1){_0x30065d=_0x4cd85f[_0xd10ba4][_0x9da1('0x6e')]?_0x4bf74c[_0x4cd85f[_0xd10ba4][_0x9da1('0x6e')]][_0x9da1('0x88')]:_0x4cd85f[_0xd10ba4][_0x9da1('0x6f')];_0x30065d=_0x4cd85f[_0xd10ba4][_0x9da1('0x70')]?_[_0x9da1('0x71')](_0x4701b3[_0x4cd85f[_0xd10ba4]['function']],'%s',_0x30065d):_0x30065d;_0x30065d=_0x4cd85f[_0xd10ba4][_0x9da1('0x89')]?_['replace'](_0x3a0a84[_0x4cd85f[_0xd10ba4][_0x9da1('0x89')]],'%s',_0x30065d):_0x30065d;if(_0x4cd85f[_0xd10ba4][_0x9da1('0x72')]){_0x40a2ef[_0x9da1('0x61')](_0x30065d);}_0x4cd85f[_0xd10ba4][_0x9da1('0x73')]&&_0x40a2ef[_0x9da1('0x74')](_0x30065d,_0x4cd85f[_0xd10ba4][_0x9da1('0x73')]===_0x9da1('0x8a')?![]:!![]);_0x40a2ef['field'](_0x30065d,_0x4cd85f[_0xd10ba4][_0x9da1('0x75')]||_0x30065d);}if(_0xe12dd7['joins']){_0xe12dd7[_0x9da1('0x76')]=JSON[_0x9da1('0x8b')](_0xe12dd7[_0x9da1('0x76')]);for(var _0x22b679=0x0;_0x22b679<_0xe12dd7['joins'][_0x9da1('0x33')];_0x22b679+=0x1){if(_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x39')]&&_[_0x9da1('0x5c')](_0x84f8d8,_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x39')])&&_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x8c')]&&_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x77')]&&_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x78')]){_0x40a2ef[_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x39')]](_0xe12dd7['joins'][_0x22b679][_0x9da1('0x77')],null,util['format'](_0x9da1('0x79'),_0xe12dd7['table'],_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x8c')],_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x77')],_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x78')]));}}}if(_0xe12dd7[_0x9da1('0x7a')]){_0xe12dd7[_0x9da1('0x7a')]=JSON['parse'](_0xe12dd7[_0x9da1('0x7a')]);_0x40a2ef[_0x9da1('0x37')](_0x106bd9(_0xe12dd7['conditions'][_0x9da1('0x61')]));}_0x175b4b=_0x40a2ef[_0x9da1('0x7b')]();_0x40a2ef[_0x9da1('0x1c')](_0x4a4cda);_0x40a2ef['offset'](0x0);return;}})['then'](function(){if(_0x4f39bc['output']===_0x9da1('0x8d')){return null;}var _0x3b17aa=_[_0x9da1('0x3b')](_0x4f39bc,{'name':_0x4f39bc['fullPath']||_0x4f39bc['name']||_0xe12dd7[_0x9da1('0x27')],'basename':_0x2eb5e6,'savename':util[_0x9da1('0x89')]('%s-%s.%s',_0x4f39bc[_0x9da1('0x27')]||_0xe12dd7['name'],require('randomstring')['generate'](0x4),_0x4f39bc[_0x9da1('0x8e')]||_0x9da1('0x8f')),'reportId':_0xe12dd7['id'],'reportType':_0x9da1('0x90')});return db[_0x9da1('0x91')][_0x9da1('0x41')](_0x3b17aa,{'raw':!![]});})[_0x9da1('0x21')](function(_0x2aac99){if(_0xe12dd7[_0x9da1('0x6d')]===_0x9da1('0x92')){_0x175b4b[_0x9da1('0x37')](_0xe12dd7[_0x9da1('0x6d')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x4f39bc['startDate'],_0x4f39bc['endDate']);}else{_0x175b4b[_0x9da1('0x37')](_0xe12dd7[_0x9da1('0x6d')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x4f39bc[_0x9da1('0x93')],_0x4f39bc[_0x9da1('0x94')]);}if(_0x2aac99){logger[_0x9da1('0x95')](_0x9da1('0x96'),_0x175b4b[_0x9da1('0x7e')]());require(_0x9da1('0x97'))[_0x9da1('0x98')](path[_0x9da1('0x4e')](__dirname,'../../components/export/',_0x2aac99[_0x9da1('0x8e')]),[_0x2aac99['id'],_0x175b4b[_0x9da1('0x7e')](),path[_0x9da1('0x4e')](__dirname,_0x9da1('0x99'),_0x2aac99[_0x9da1('0x9a')]),_0x2eb5e6]);return _0x2aac99;}else{var _0x5ad3f8=squel[_0x9da1('0x6b')]();_0x5ad3f8['from']('('+_0x175b4b[_0x9da1('0x7e')]()+')',_0x9da1('0x9b'));_0x5ad3f8[_0x9da1('0x6f')]('COUNT(*)','count');_0x175b4b[_0x9da1('0x1c')](_0x4f39bc[_0x9da1('0x1c')]||_0x4a4cda);_0x175b4b[_0x9da1('0x1a')](_0x4f39bc['offset']||0x0);return dbH[_0x9da1('0x7f')][_0x9da1('0x2e')](_0x5ad3f8['toString'](),{'type':dbH[_0x9da1('0x7f')][_0x9da1('0x80')]['SELECT']})['then'](function(_0x489b3f){if(!_0x489b3f[_0x9da1('0x33')]){_0x28335d=0x0;}else{_0x28335d=_0x489b3f[0x0]['count']||0x0;}return dbH[_0x9da1('0x7f')][_0x9da1('0x2e')](_0x175b4b[_0x9da1('0x7e')](),{'type':dbH[_0x9da1('0x7f')][_0x9da1('0x80')][_0x9da1('0x81')]});})['then'](function(_0x355a71){return{'rows':_0x355a71||[],'count':_0x28335d};});}});}exports[_0x9da1('0x9c')]=function(_0x492e1a,_0x449a17){return runReport(_0x492e1a[_0x9da1('0x4c')],_0x492e1a[_0x9da1('0x2e')],_0x492e1a[_0x9da1('0x64')])['then'](respondWithResult(_0x449a17,null))[_0x9da1('0x40')](handleError(_0x449a17,null));};exports[_0x9da1('0x9d')]=runReport;exports[_0x9da1('0x2e')]=function(_0x8280a9,_0x374754){var _0x1e466a=0xa;var _0x3f9133=[_0x9da1('0x4e'),'left_join',_0x9da1('0x4f'),'cross_join'];var _0x3dd3e0={'SUM':_0x9da1('0x51'),'COUNT':_0x9da1('0x52'),'COUNT DISTINCT':_0x9da1('0x53'),'MAX':_0x9da1('0x54'),'MIN':_0x9da1('0x55'),'AVG':_0x9da1('0x56'),'GROUP_CONCAT':_0x9da1('0x57'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x9da1('0x58')};var _0x52e4a6={'SEC_TO_TIME':_0x9da1('0x59'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x9da1('0x5b'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x4aa903=function(_0x55d7f2){return!_['includes'](['IS\x20NULL',_0x9da1('0x5e'),_0x9da1('0x5f'),_0x9da1('0x85')],_0x55d7f2);};var _0x3212ad=function(_0x5ac65b){if(!_0x5ac65b||!_0x5ac65b[_0x9da1('0x60')][_0x9da1('0x33')]){return'';}for(var _0x21a99d='(',_0xd19a7c=0x0;_0xd19a7c<_0x5ac65b[_0x9da1('0x60')][_0x9da1('0x33')];_0xd19a7c+=0x1){_0xd19a7c>0x0&&(_0x21a99d+='\x20'+_0x5ac65b[_0x9da1('0x86')]+'\x20');_0x21a99d+=_0x5ac65b[_0x9da1('0x60')][_0xd19a7c][_0x9da1('0x61')]?_0x3212ad(_0x5ac65b[_0x9da1('0x60')][_0xd19a7c][_0x9da1('0x61')]):_0x5ac65b['rules'][_0xd19a7c][_0x9da1('0x6f')]+'\x20'+_0x5ac65b[_0x9da1('0x60')][_0xd19a7c]['condition']+(_0x4aa903(_0x5ac65b['rules'][_0xd19a7c][_0x9da1('0x62')])?'\x20'+_0x5ac65b[_0x9da1('0x60')][_0xd19a7c][_0x9da1('0x63')]:'');}return _0x21a99d+')';};var _0xb14af1={'where':{'id':_0x8280a9[_0x9da1('0x4c')]['id']}},_0x245566,_0x5b2591,_0x3c51e3,_0x54b83d,_0x23bf86;_0xb14af1=_['merge']({},_0xb14af1,_0x8280a9[_0x9da1('0x64')]);return db[_0x9da1('0x2a')][_0x9da1('0x65')](_0xb14af1)[_0x9da1('0x21')](function(_0x4bb140){if(_0x4bb140){_0x245566=_0x4bb140;return _0x4bb140[_0x9da1('0x66')]();}return null;})['then'](function(_0x47cbdd){if(_0x47cbdd){if(!_0x47cbdd['length']){throw new db[(_0x9da1('0x87'))][(_0x9da1('0x67'))](_0x9da1('0x68'),0x193);}_0x5b2591=_0x47cbdd;return db['AnalyticMetric'][_0x9da1('0x3e')]({'raw':!![]});}return null;})[_0x9da1('0x21')](function(_0x5e1e24){if(_0x5e1e24){_0x3c51e3=_[_0x9da1('0x6a')](_0x5e1e24,'id');var _0x49ddec;var _0x407218=squel['select']();_0x407218['from'](_0x245566['table']);for(var _0x316fee=0x0;_0x316fee<_0x5b2591['length'];_0x316fee+=0x1){_0x49ddec=_0x5b2591[_0x316fee][_0x9da1('0x6e')]?_0x3c51e3[_0x5b2591[_0x316fee][_0x9da1('0x6e')]]['metric']:_0x5b2591[_0x316fee]['field'];_0x49ddec=_0x5b2591[_0x316fee][_0x9da1('0x70')]?_['replace'](_0x3dd3e0[_0x5b2591[_0x316fee][_0x9da1('0x70')]],'%s',_0x49ddec):_0x49ddec;_0x49ddec=_0x5b2591[_0x316fee][_0x9da1('0x89')]?_['replace'](_0x52e4a6[_0x5b2591[_0x316fee]['format']],'%s',_0x49ddec):_0x49ddec;if(_0x5b2591[_0x316fee][_0x9da1('0x72')]){_0x407218[_0x9da1('0x61')](_0x49ddec);}_0x5b2591[_0x316fee][_0x9da1('0x73')]&&_0x407218[_0x9da1('0x74')](_0x49ddec,_0x5b2591[_0x316fee]['orderBy']==='DESC'?![]:!![]);_0x407218[_0x9da1('0x6f')](_0x49ddec,_0x5b2591[_0x316fee][_0x9da1('0x75')]||_0x49ddec);}if(_0x245566[_0x9da1('0x76')]){_0x245566[_0x9da1('0x76')]=JSON[_0x9da1('0x8b')](_0x245566['joins']);for(var _0x56ec7d=0x0;_0x56ec7d<_0x245566[_0x9da1('0x76')][_0x9da1('0x33')];_0x56ec7d+=0x1){if(_0x245566['joins'][_0x56ec7d][_0x9da1('0x39')]&&_['includes'](_0x3f9133,_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x39')])&&_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x8c')]&&_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x77')]&&_0x245566['joins'][_0x56ec7d][_0x9da1('0x78')]){_0x407218[_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x39')]](_0x245566[_0x9da1('0x76')][_0x56ec7d]['foreignTable'],null,util[_0x9da1('0x89')](_0x9da1('0x79'),_0x245566[_0x9da1('0x6d')],_0x245566['joins'][_0x56ec7d]['parentKey'],_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x77')],_0x245566['joins'][_0x56ec7d]['foreignKey']));}}}if(_0x245566[_0x9da1('0x7a')]){_0x245566[_0x9da1('0x7a')]=JSON[_0x9da1('0x8b')](_0x245566[_0x9da1('0x7a')]);_0x407218[_0x9da1('0x37')](_0x3212ad(_0x245566['conditions'][_0x9da1('0x61')]));}_0x23bf86=_0x407218['clone']();_0x407218[_0x9da1('0x1c')](_0x1e466a);_0x407218[_0x9da1('0x1a')](0x0);logger[_0x9da1('0x7c')](_0x9da1('0x7d'),_0x407218['toString']());return dbH['sequelize'][_0x9da1('0x2e')](_0x407218[_0x9da1('0x7e')](),{'type':dbH[_0x9da1('0x7f')][_0x9da1('0x80')][_0x9da1('0x81')]});}})[_0x9da1('0x21')](function(){return{'sql':_0x23bf86['toString']()};})[_0x9da1('0x21')](respondWithResult(_0x374754,null))[_0x9da1('0x40')](handleError(_0x374754,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index bc6e601..b60eb38 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 _0x73b3=['../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','moment','bluebird','path','rimraf'];(function(_0x53c26d,_0x4ad64e){var _0x5727d6=function(_0x3be8c5){while(--_0x3be8c5){_0x53c26d['push'](_0x53c26d['shift']());}};_0x5727d6(++_0x4ad64e);}(_0x73b3,0xa0));var _0x373b=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0x73b3[_0x2576d7];return _0x16a08c;};'use strict';var _=require(_0x373b('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x373b('0x1'));var BPromise=require(_0x373b('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x373b('0x3'));var rimraf=require(_0x373b('0x4'));var config=require(_0x373b('0x5'));var attributes=require(_0x373b('0x6'));module[_0x373b('0x7')]=function(_0x3d5d06,_0x47fee7){return _0x3d5d06[_0x373b('0x8')](_0x373b('0x9'),attributes,{'tableName':_0x373b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7fe0=['request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','api','moment','bluebird'];(function(_0x38b02e,_0x5177cf){var _0x5cd622=function(_0x251d79){while(--_0x251d79){_0x38b02e['push'](_0x38b02e['shift']());}};_0x5cd622(++_0x5177cf);}(_0x7fe0,0xb1));var _0x07fe=function(_0x3bb12e,_0x5ebafa){_0x3bb12e=_0x3bb12e-0x0;var _0x536b9a=_0x7fe0[_0x3bb12e];return _0x536b9a;};'use strict';var _=require(_0x07fe('0x0'));var util=require(_0x07fe('0x1'));var logger=require('../../config/logger')(_0x07fe('0x2'));var moment=require(_0x07fe('0x3'));var BPromise=require(_0x07fe('0x4'));var rp=require(_0x07fe('0x5'));var fs=require('fs');var path=require(_0x07fe('0x6'));var rimraf=require(_0x07fe('0x7'));var config=require(_0x07fe('0x8'));var attributes=require(_0x07fe('0x9'));module[_0x07fe('0xa')]=function(_0x450ac1,_0x154a0a){return _0x450ac1[_0x07fe('0xb')](_0x07fe('0xc'),attributes,{'tableName':_0x07fe('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index b02476d..d8bc02b 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 _0x5b18=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','then','info','AnalyticDefaultReport,\x20%s,\x20%s','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x40dabf,_0x1b7cd9){var _0x14544f=function(_0x248e26){while(--_0x248e26){_0x40dabf['push'](_0x40dabf['shift']());}};_0x14544f(++_0x1b7cd9);}(_0x5b18,0xb2));var _0x85b1=function(_0x5756f8,_0x22b6d5){_0x5756f8=_0x5756f8-0x0;var _0x3bb749=_0x5b18[_0x5756f8];return _0x3bb749;};'use strict';var _=require(_0x85b1('0x0'));var util=require('util');var moment=require(_0x85b1('0x1'));var BPromise=require(_0x85b1('0x2'));var rs=require(_0x85b1('0x3'));var fs=require('fs');var Redis=require(_0x85b1('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x85b1('0x5'))(_0x85b1('0x6'));var config=require(_0x85b1('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x85b1('0x8')][_0x85b1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x595800,_0x394d14,_0x5470a1){return new BPromise(function(_0x293847,_0x33d21d){return client['request'](_0x595800,_0x5470a1)[_0x85b1('0xa')](function(_0x3eed96){logger[_0x85b1('0xb')](_0x85b1('0xc'),_0x394d14,'request\x20sent');logger[_0x85b1('0xd')](_0x85b1('0xe'),_0x394d14,_0x85b1('0xf'),JSON[_0x85b1('0x10')](_0x3eed96));if(_0x3eed96[_0x85b1('0x11')]){if(_0x3eed96[_0x85b1('0x11')][_0x85b1('0x12')]===0x1f4){logger[_0x85b1('0x11')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x394d14,_0x3eed96[_0x85b1('0x11')]['message']);return _0x33d21d(_0x3eed96[_0x85b1('0x11')]['message']);}logger[_0x85b1('0x11')](_0x85b1('0xc'),_0x394d14,_0x3eed96[_0x85b1('0x11')][_0x85b1('0x13')]);return _0x293847(_0x3eed96['error'][_0x85b1('0x13')]);}else{logger[_0x85b1('0xb')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x394d14,'request\x20sent');_0x293847(_0x3eed96[_0x85b1('0x14')][_0x85b1('0x13')]);}})[_0x85b1('0x15')](function(_0x12688c){logger[_0x85b1('0x11')](_0x85b1('0xc'),_0x394d14,_0x12688c);_0x33d21d(_0x12688c);});});} \ No newline at end of file +var _0xadd6=['info','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','AnalyticDefaultReport,\x20%s,\x20%s','debug','request\x20sent','error','code','message'];(function(_0x4c1a15,_0x36abe4){var _0x195acb=function(_0x1104ee){while(--_0x1104ee){_0x4c1a15['push'](_0x4c1a15['shift']());}};_0x195acb(++_0x36abe4);}(_0xadd6,0x75));var _0x6add=function(_0x35e290,_0x1156b1){_0x35e290=_0x35e290-0x0;var _0x19dd62=_0xadd6[_0x35e290];return _0x19dd62;};'use strict';var _=require(_0x6add('0x0'));var util=require('util');var moment=require(_0x6add('0x1'));var BPromise=require('bluebird');var rs=require(_0x6add('0x2'));var fs=require('fs');var Redis=require(_0x6add('0x3'));var db=require(_0x6add('0x4'))['db'];var utils=require(_0x6add('0x5'));var logger=require('../../config/logger')(_0x6add('0x6'));var config=require(_0x6add('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6add('0x8')][_0x6add('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x14570d,_0x465e11,_0x5ac775){return new BPromise(function(_0x4ec15f,_0x35b981){return client['request'](_0x14570d,_0x5ac775)['then'](function(_0x5df483){logger['info'](_0x6add('0xa'),_0x465e11,'request\x20sent');logger[_0x6add('0xb')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x465e11,_0x6add('0xc'),JSON['stringify'](_0x5df483));if(_0x5df483[_0x6add('0xd')]){if(_0x5df483[_0x6add('0xd')][_0x6add('0xe')]===0x1f4){logger[_0x6add('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x465e11,_0x5df483[_0x6add('0xd')][_0x6add('0xf')]);return _0x35b981(_0x5df483[_0x6add('0xd')][_0x6add('0xf')]);}logger[_0x6add('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x465e11,_0x5df483['error'][_0x6add('0xf')]);return _0x4ec15f(_0x5df483['error'][_0x6add('0xf')]);}else{logger[_0x6add('0x10')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x465e11,_0x6add('0xc'));_0x4ec15f(_0x5df483[_0x6add('0x11')][_0x6add('0xf')]);}})[_0x6add('0x12')](function(_0x196974){logger[_0x6add('0xd')](_0x6add('0xa'),_0x465e11,_0x196974);_0x35b981(_0x196974);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index fae4bf8..a9fc632 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 _0x2b1b=['preview','/:id/run','run','/:id/query','query','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../config/environment','./analyticDefaultReport.controller','get','/:id','isAuthenticated','/:id/preview'];(function(_0x201042,_0x50bd0a){var _0x17f363=function(_0x4d7519){while(--_0x4d7519){_0x201042['push'](_0x201042['shift']());}};_0x17f363(++_0x50bd0a);}(_0x2b1b,0x11f));var _0xb2b1=function(_0x1803c9,_0x4c7457){_0x1803c9=_0x1803c9-0x0;var _0x3b9840=_0x2b1b[_0x1803c9];return _0x3b9840;};'use strict';var multer=require(_0xb2b1('0x0'));var util=require(_0xb2b1('0x1'));var path=require(_0xb2b1('0x2'));var timeout=require('connect-timeout');var express=require(_0xb2b1('0x3'));var router=express[_0xb2b1('0x4')]();var fs_extra=require(_0xb2b1('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb2b1('0x6'));var controller=require(_0xb2b1('0x7'));router[_0xb2b1('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb2b1('0x8')](_0xb2b1('0x9'),auth[_0xb2b1('0xa')](),controller['show']);router['get'](_0xb2b1('0xb'),auth[_0xb2b1('0xa')](),controller[_0xb2b1('0xc')]);router[_0xb2b1('0x8')](_0xb2b1('0xd'),auth[_0xb2b1('0xa')](),controller[_0xb2b1('0xe')]);router[_0xb2b1('0x8')](_0xb2b1('0xf'),auth['isAuthenticated'](),controller[_0xb2b1('0x10')]);router['post']('/',auth[_0xb2b1('0xa')](),controller[_0xb2b1('0x11')]);router[_0xb2b1('0x12')](_0xb2b1('0x9'),auth[_0xb2b1('0xa')](),controller[_0xb2b1('0x13')]);router[_0xb2b1('0x14')](_0xb2b1('0x9'),auth[_0xb2b1('0xa')](),controller[_0xb2b1('0x15')]);module[_0xb2b1('0x16')]=router; \ No newline at end of file +var _0x3600=['/:id/run','run','/:id/query','query','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','/:id','show'];(function(_0x851fe,_0x25657a){var _0x2778ac=function(_0x3f94a7){while(--_0x3f94a7){_0x851fe['push'](_0x851fe['shift']());}};_0x2778ac(++_0x25657a);}(_0x3600,0x142));var _0x0360=function(_0x5b3906,_0x44dd0b){_0x5b3906=_0x5b3906-0x0;var _0x1c5844=_0x3600[_0x5b3906];return _0x1c5844;};'use strict';var multer=require(_0x0360('0x0'));var util=require(_0x0360('0x1'));var path=require(_0x0360('0x2'));var timeout=require(_0x0360('0x3'));var express=require(_0x0360('0x4'));var router=express[_0x0360('0x5')]();var fs_extra=require(_0x0360('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x0360('0x7'));var config=require(_0x0360('0x8'));var controller=require(_0x0360('0x9'));router[_0x0360('0xa')]('/',auth[_0x0360('0xb')](),controller['index']);router[_0x0360('0xa')](_0x0360('0xc'),auth[_0x0360('0xb')](),controller[_0x0360('0xd')]);router[_0x0360('0xa')]('/:id/preview',auth[_0x0360('0xb')](),controller['preview']);router[_0x0360('0xa')](_0x0360('0xe'),auth[_0x0360('0xb')](),controller[_0x0360('0xf')]);router['get'](_0x0360('0x10'),auth[_0x0360('0xb')](),controller[_0x0360('0x11')]);router[_0x0360('0x12')]('/',auth[_0x0360('0xb')](),controller[_0x0360('0x13')]);router['put']('/:id',auth[_0x0360('0xb')](),controller[_0x0360('0x14')]);router[_0x0360('0x15')](_0x0360('0xc'),auth[_0x0360('0xb')](),controller[_0x0360('0x16')]);module[_0x0360('0x17')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 795afd0..7d65b0b 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 _0x727a=['manual','scheduled','INTEGER','moment','STRING','ENUM','csv','pdf','xlsx','DATE','Loading'];(function(_0x3b53d7,_0x2f2095){var _0x513d11=function(_0x369829){while(--_0x369829){_0x3b53d7['push'](_0x3b53d7['shift']());}};_0x513d11(++_0x2f2095);}(_0x727a,0x1e7));var _0xa727=function(_0x1860ee,_0x23372a){_0x1860ee=_0x1860ee-0x0;var _0x4d798d=_0x727a[_0x1860ee];return _0x4d798d;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xa727('0x0'));module['exports']={'name':{'type':Sequelize[_0xa727('0x1')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0xa727('0x2')](_0xa727('0x3'),_0xa727('0x4'),_0xa727('0x5')),'allowNull':![],'defaultValue':_0xa727('0x3')},'savename':{'type':Sequelize[_0xa727('0x1')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0xa727('0x6')]},'status':{'type':Sequelize[_0xa727('0x1')],'defaultValue':_0xa727('0x7')},'type':{'type':Sequelize[_0xa727('0x2')](_0xa727('0x8'),_0xa727('0x9')),'allowNull':![],'defaultValue':_0xa727('0x8')},'reportId':{'type':Sequelize[_0xa727('0xa')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0xa727('0x1')]}}; \ No newline at end of file +var _0x1a03=['exports','STRING','csv','pdf','xlsx','DATE','ENUM','manual','UNSIGNED','moment'];(function(_0x5965c7,_0x1ab31d){var _0x111855=function(_0x2b7ced){while(--_0x2b7ced){_0x5965c7['push'](_0x5965c7['shift']());}};_0x111855(++_0x1ab31d);}(_0x1a03,0x149));var _0x31a0=function(_0x403f5f,_0x283f67){_0x403f5f=_0x403f5f-0x0;var _0x15b1cd=_0x1a03[_0x403f5f];return _0x15b1cd;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x31a0('0x0'));module[_0x31a0('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0x31a0('0x2')],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0x31a0('0x3'),_0x31a0('0x4'),_0x31a0('0x5')),'allowNull':![],'defaultValue':_0x31a0('0x3')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0x31a0('0x6')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0x31a0('0x2')],'defaultValue':'Loading'},'type':{'type':Sequelize[_0x31a0('0x7')]('manual','scheduled'),'allowNull':![],'defaultValue':_0x31a0('0x8')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0x31a0('0x9')]},'reportType':{'type':Sequelize[_0x31a0('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 7c9fca9..7f358d0 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 _0xd021=['index','map','AnalyticExtractedReport','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','pick','where','VIRTUAL','filter','merge','options','includeAll','include','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','basename','savename','output','existsSync','join','root','Sequelize','Report\x20not\x20found\x20or\x20empty','exists','download','format','%s.%s','toLowerCase','eml-format','rimraf','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/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','get','ExtractedReports','UserProfileResource','destroy','error','name','send'];(function(_0x5babb8,_0x453b94){var _0x4a2829=function(_0x40c8ff){while(--_0x40c8ff){_0x5babb8['push'](_0x5babb8['shift']());}};_0x4a2829(++_0x453b94);}(_0xd021,0x1ae));var _0x1d02=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd021[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x1d02('0x0'));var rimraf=require(_0x1d02('0x1'));var zipdir=require(_0x1d02('0x2'));var jsonpatch=require(_0x1d02('0x3'));var rp=require('request-promise');var moment=require(_0x1d02('0x4'));var BPromise=require(_0x1d02('0x5'));var Mustache=require(_0x1d02('0x6'));var util=require(_0x1d02('0x7'));var path=require(_0x1d02('0x8'));var sox=require(_0x1d02('0x9'));var csv=require(_0x1d02('0xa'));var ejs=require(_0x1d02('0xb'));var fs=require('fs');var fs_extra=require(_0x1d02('0xc'));var _=require('lodash');var squel=require(_0x1d02('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1d02('0xa'));var querystring=require(_0x1d02('0xe'));var Papa=require(_0x1d02('0xf'));var Redis=require(_0x1d02('0x10'));var authService=require(_0x1d02('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x1d02('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1d02('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x1d02('0x14'));var licenseUtil=require(_0x1d02('0x15'));var db=require(_0x1d02('0x16'))['db'];function respondWithStatusCode(_0x51c275,_0x15e5eb){_0x15e5eb=_0x15e5eb||0xcc;return function(_0x147f82){if(_0x147f82){return _0x51c275[_0x1d02('0x17')](_0x15e5eb);}return _0x51c275[_0x1d02('0x18')](_0x15e5eb)[_0x1d02('0x19')]();};}function respondWithResult(_0x5b99b1,_0x580758){_0x580758=_0x580758||0xc8;return function(_0x2ad6b8){if(_0x2ad6b8){return _0x5b99b1[_0x1d02('0x18')](_0x580758)[_0x1d02('0x1a')](_0x2ad6b8);}};}function respondWithFilteredResult(_0x429523,_0x1a110c){return function(_0x35108b){if(_0x35108b){var _0x2aa24c=typeof _0x1a110c[_0x1d02('0x1b')]===_0x1d02('0x1c')&&typeof _0x1a110c['limit']===_0x1d02('0x1c');var _0x3374d9=_0x35108b['count'];var _0x465633=_0x2aa24c?0x0:_0x1a110c[_0x1d02('0x1b')];var _0x531f05=_0x2aa24c?_0x35108b[_0x1d02('0x1d')]:_0x1a110c[_0x1d02('0x1b')]+_0x1a110c[_0x1d02('0x1e')];var _0x1359a8;if(_0x531f05>=_0x3374d9){_0x531f05=_0x3374d9;_0x1359a8=0xc8;}else{_0x1359a8=0xce;}_0x429523[_0x1d02('0x18')](_0x1359a8);return _0x429523[_0x1d02('0x1f')](_0x1d02('0x20'),_0x465633+'-'+_0x531f05+'/'+_0x3374d9)[_0x1d02('0x1a')](_0x35108b);}return null;};}function patchUpdates(_0x5c13b2){return function(_0x1b39f9){try{jsonpatch[_0x1d02('0x21')](_0x1b39f9,_0x5c13b2,!![]);}catch(_0x3cd07e){return BPromise[_0x1d02('0x22')](_0x3cd07e);}return _0x1b39f9[_0x1d02('0x23')]();};}function saveUpdates(_0x5e4f9e,_0x40a629){return function(_0x34532e){if(_0x34532e){return _0x34532e[_0x1d02('0x24')](_0x5e4f9e)[_0x1d02('0x25')](function(_0x5017b2){return _0x5017b2;});}return null;};}function removeEntity(_0x24f517,_0x3dbc99){return function(_0x2f2a0b){if(_0x2f2a0b){return _0x2f2a0b['destroy']()[_0x1d02('0x25')](function(){var _0x186d6c=_0x2f2a0b[_0x1d02('0x26')]({'plain':!![]});var _0x2cd7e8=_0x1d02('0x27');return db[_0x1d02('0x28')][_0x1d02('0x29')]({'where':{'type':_0x2cd7e8,'resourceId':_0x186d6c['id']}})[_0x1d02('0x25')](function(){return _0x2f2a0b;});})['then'](function(){_0x24f517[_0x1d02('0x18')](0xcc)[_0x1d02('0x19')]();});}};}function handleEntityNotFound(_0x20a89e,_0x468567){return function(_0x102739){if(!_0x102739){_0x20a89e[_0x1d02('0x17')](0x194);}return _0x102739;};}function handleError(_0x4804c4,_0x2cf7fd){_0x2cf7fd=_0x2cf7fd||0x1f4;return function(_0x46a352){logger[_0x1d02('0x2a')](_0x46a352['stack']);if(_0x46a352[_0x1d02('0x2b')]){delete _0x46a352[_0x1d02('0x2b')];}_0x4804c4[_0x1d02('0x18')](_0x2cf7fd)[_0x1d02('0x2c')](_0x46a352);};}exports[_0x1d02('0x2d')]=function(_0x220699,_0x4b1b7b){var _0x3caab8={},_0x19f14e={},_0x63c9cd={'count':0x0,'rows':[]};var _0x376bfc=_[_0x1d02('0x2e')](db[_0x1d02('0x2f')]['rawAttributes'],function(_0x3b2624){return{'name':_0x3b2624[_0x1d02('0x30')],'type':_0x3b2624[_0x1d02('0x31')][_0x1d02('0x32')]};});_0x19f14e['model']=_['map'](_0x376bfc,_0x1d02('0x2b'));_0x19f14e[_0x1d02('0x33')]=_[_0x1d02('0x34')](_0x220699[_0x1d02('0x33')]);_0x19f14e[_0x1d02('0x35')]=_[_0x1d02('0x36')](_0x19f14e[_0x1d02('0x37')],_0x19f14e['query']);_0x3caab8['attributes']=_[_0x1d02('0x36')](_0x19f14e['model'],qs[_0x1d02('0x38')](_0x220699[_0x1d02('0x33')][_0x1d02('0x38')]));_0x3caab8[_0x1d02('0x39')]=_0x3caab8[_0x1d02('0x39')][_0x1d02('0x3a')]?_0x3caab8['attributes']:_0x19f14e['model'];if(!_0x220699['query'][_0x1d02('0x3b')]('nolimit')){_0x3caab8[_0x1d02('0x1e')]=qs[_0x1d02('0x1e')](_0x220699[_0x1d02('0x33')]['limit']);_0x3caab8[_0x1d02('0x1b')]=qs[_0x1d02('0x1b')](_0x220699[_0x1d02('0x33')][_0x1d02('0x1b')]);}_0x3caab8[_0x1d02('0x3c')]=qs[_0x1d02('0x3d')](_0x220699[_0x1d02('0x33')]['sort']);_0x3caab8['where']=qs['filters'](_[_0x1d02('0x3e')](_0x220699['query'],_0x19f14e[_0x1d02('0x35')]),_0x376bfc);if(_0x220699['query']['filter']){_0x3caab8[_0x1d02('0x3f')]=_['merge'](_0x3caab8[_0x1d02('0x3f')],{'$or':_[_0x1d02('0x2e')](_0x376bfc,function(_0x55692d){if(_0x55692d['type']!==_0x1d02('0x40')){var _0x76a023={};_0x76a023[_0x55692d[_0x1d02('0x2b')]]={'$like':'%'+_0x220699[_0x1d02('0x33')][_0x1d02('0x41')]+'%'};return _0x76a023;}})});}_0x3caab8=_[_0x1d02('0x42')]({},_0x3caab8,_0x220699[_0x1d02('0x43')]);var _0x28c646={'where':_0x3caab8[_0x1d02('0x3f')]};return db[_0x1d02('0x2f')][_0x1d02('0x1d')](_0x28c646)[_0x1d02('0x25')](function(_0x546a84){_0x63c9cd[_0x1d02('0x1d')]=_0x546a84;if(_0x220699['query'][_0x1d02('0x44')]){_0x3caab8[_0x1d02('0x45')]=[{'all':!![]}];}return db[_0x1d02('0x2f')]['findAll'](_0x3caab8);})[_0x1d02('0x25')](function(_0x58cd5d){_0x63c9cd['rows']=_0x58cd5d;return _0x63c9cd;})[_0x1d02('0x25')](respondWithFilteredResult(_0x4b1b7b,_0x3caab8))[_0x1d02('0x46')](handleError(_0x4b1b7b,null));};exports[_0x1d02('0x47')]=function(_0x4cb2d9,_0x49756e){var _0x56c94={'raw':!![],'where':{'id':_0x4cb2d9[_0x1d02('0x48')]['id']}},_0x5027ce={};_0x5027ce[_0x1d02('0x37')]=_[_0x1d02('0x34')](db[_0x1d02('0x2f')]['rawAttributes']);_0x5027ce[_0x1d02('0x33')]=_[_0x1d02('0x34')](_0x4cb2d9[_0x1d02('0x33')]);_0x5027ce[_0x1d02('0x35')]=_[_0x1d02('0x36')](_0x5027ce[_0x1d02('0x37')],_0x5027ce[_0x1d02('0x33')]);_0x56c94[_0x1d02('0x39')]=_[_0x1d02('0x36')](_0x5027ce['model'],qs[_0x1d02('0x38')](_0x4cb2d9[_0x1d02('0x33')][_0x1d02('0x38')]));_0x56c94[_0x1d02('0x39')]=_0x56c94[_0x1d02('0x39')][_0x1d02('0x3a')]?_0x56c94['attributes']:_0x5027ce['model'];if(_0x4cb2d9['query']['includeAll']){_0x56c94[_0x1d02('0x45')]=[{'all':!![]}];}_0x56c94=_['merge']({},_0x56c94,_0x4cb2d9[_0x1d02('0x43')]);return db['AnalyticExtractedReport'][_0x1d02('0x49')](_0x56c94)[_0x1d02('0x25')](handleEntityNotFound(_0x49756e,null))[_0x1d02('0x25')](respondWithResult(_0x49756e,null))[_0x1d02('0x46')](handleError(_0x49756e,null));};exports[_0x1d02('0x4a')]=function(_0x1f859e,_0x27980f){return db[_0x1d02('0x2f')][_0x1d02('0x4a')](_0x1f859e[_0x1d02('0x4b')],{})['then'](function(_0x2dfef9){var _0xdf9384=_0x1f859e[_0x1d02('0x4c')][_0x1d02('0x26')]({'plain':!![]});if(!_0xdf9384)throw new Error(_0x1d02('0x4d'));if(_0xdf9384[_0x1d02('0x4e')]===_0x1d02('0x4c')){var _0x3e992a=_0x2dfef9['get']({'plain':!![]});var _0x339b10=_0x1d02('0x27');return db['UserProfileSection'][_0x1d02('0x49')]({'where':{'name':_0x339b10,'userProfileId':_0xdf9384[_0x1d02('0x4f')]},'raw':!![]})[_0x1d02('0x25')](function(_0x50cbfc){if(_0x50cbfc&&_0x50cbfc[_0x1d02('0x50')]===0x0){return db[_0x1d02('0x28')]['create']({'name':_0x3e992a['name'],'resourceId':_0x3e992a['id'],'type':_0x50cbfc[_0x1d02('0x2b')],'sectionId':_0x50cbfc['id']},{})[_0x1d02('0x25')](function(){return _0x2dfef9;});}else{return _0x2dfef9;}})[_0x1d02('0x46')](function(_0x82b379){logger[_0x1d02('0x2a')](_0x1d02('0x51'),_0x82b379);throw _0x82b379;});}return _0x2dfef9;})[_0x1d02('0x25')](respondWithResult(_0x27980f,0xc9))[_0x1d02('0x46')](handleError(_0x27980f,null));};exports[_0x1d02('0x24')]=function(_0x5f4ed2,_0x591244){if(_0x5f4ed2[_0x1d02('0x4b')]['id']){delete _0x5f4ed2[_0x1d02('0x4b')]['id'];}return db['AnalyticExtractedReport'][_0x1d02('0x49')]({'where':{'id':_0x5f4ed2[_0x1d02('0x48')]['id']}})[_0x1d02('0x25')](handleEntityNotFound(_0x591244,null))[_0x1d02('0x25')](saveUpdates(_0x5f4ed2[_0x1d02('0x4b')],null))['then'](respondWithResult(_0x591244,null))[_0x1d02('0x46')](handleError(_0x591244,null));};exports[_0x1d02('0x29')]=function(_0x53a226,_0x37243c){return db['AnalyticExtractedReport'][_0x1d02('0x49')]({'where':{'id':_0x53a226[_0x1d02('0x48')]['id']}})[_0x1d02('0x25')](handleEntityNotFound(_0x37243c,null))[_0x1d02('0x25')](removeEntity(_0x37243c,null))['catch'](handleError(_0x37243c,null));};exports['download']=function(_0x4bf798,_0x2cf86c,_0x562a26){return db[_0x1d02('0x2f')]['find']({'where':{'id':_0x4bf798[_0x1d02('0x48')]['id']},'attributes':['name',_0x1d02('0x52'),_0x1d02('0x53'),_0x1d02('0x54')],'raw':!![]})[_0x1d02('0x25')](handleEntityNotFound(_0x2cf86c,null))[_0x1d02('0x25')](function(_0x230d73){if(_0x230d73){if(!fs[_0x1d02('0x55')](path[_0x1d02('0x56')](config[_0x1d02('0x57')],'server/files/reports',_0x230d73['savename']))){throw new db[(_0x1d02('0x58'))]['ValidationError'](_0x1d02('0x59'));}if(_0x4bf798[_0x1d02('0x33')][_0x1d02('0x5a')]){return _0x2cf86c['sendStatus'](0xc8);}return _0x2cf86c[_0x1d02('0x5b')](path[_0x1d02('0x56')](config[_0x1d02('0x57')],'server/files/reports',_0x230d73['savename']),util[_0x1d02('0x5c')](_0x1d02('0x5d'),_0x230d73['basename']||_0x230d73['name'],_0x230d73['output'][_0x1d02('0x5e')]()));}})[_0x1d02('0x46')](handleError(_0x2cf86c,null));}; \ No newline at end of file +var _0x606c=['eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','ExtractedReports','UserProfileResource','error','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','order','sort','where','filters','filter','merge','options','include','findAll','length','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','destroy','download','output','existsSync','join','root','server/files/reports','savename','ValidationError','Report\x20not\x20found\x20or\x20empty','format','%s.%s','basename','toLowerCase'];(function(_0x5233d4,_0x323ed8){var _0x1b7f4f=function(_0x1b41b4){while(--_0x1b41b4){_0x5233d4['push'](_0x5233d4['shift']());}};_0x1b7f4f(++_0x323ed8);}(_0x606c,0x16c));var _0xc606=function(_0x12b83d,_0x4bcec7){_0x12b83d=_0x12b83d-0x0;var _0x1fd39d=_0x606c[_0x12b83d];return _0x1fd39d;};'use strict';var emlformat=require(_0xc606('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc606('0x1'));var jsonpatch=require(_0xc606('0x2'));var rp=require(_0xc606('0x3'));var moment=require(_0xc606('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc606('0x5'));var util=require('util');var path=require(_0xc606('0x6'));var sox=require(_0xc606('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc606('0x8'));var squel=require('squel');var crypto=require(_0xc606('0x9'));var jsforce=require(_0xc606('0xa'));var deskjs=require(_0xc606('0xb'));var toCsv=require(_0xc606('0xc'));var querystring=require('querystring');var Papa=require(_0xc606('0xd'));var Redis=require(_0xc606('0xe'));var authService=require(_0xc606('0xf'));var qs=require(_0xc606('0x10'));var as=require(_0xc606('0x11'));var hardwareService=require(_0xc606('0x12'));var logger=require('../../config/logger')(_0xc606('0x13'));var utils=require(_0xc606('0x14'));var config=require(_0xc606('0x15'));var licenseUtil=require(_0xc606('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1305e1,_0x9f6164){_0x9f6164=_0x9f6164||0xcc;return function(_0x338e43){if(_0x338e43){return _0x1305e1[_0xc606('0x17')](_0x9f6164);}return _0x1305e1[_0xc606('0x18')](_0x9f6164)[_0xc606('0x19')]();};}function respondWithResult(_0x4e7cf3,_0x35249d){_0x35249d=_0x35249d||0xc8;return function(_0x228e0a){if(_0x228e0a){return _0x4e7cf3[_0xc606('0x18')](_0x35249d)[_0xc606('0x1a')](_0x228e0a);}};}function respondWithFilteredResult(_0x20c4ec,_0x502420){return function(_0x1da617){if(_0x1da617){var _0x51d26c=typeof _0x502420[_0xc606('0x1b')]==='undefined'&&typeof _0x502420[_0xc606('0x1c')]===_0xc606('0x1d');var _0x3c53d3=_0x1da617[_0xc606('0x1e')];var _0xbaed22=_0x51d26c?0x0:_0x502420[_0xc606('0x1b')];var _0x3d04e1=_0x51d26c?_0x1da617[_0xc606('0x1e')]:_0x502420[_0xc606('0x1b')]+_0x502420[_0xc606('0x1c')];var _0x2ed9dd;if(_0x3d04e1>=_0x3c53d3){_0x3d04e1=_0x3c53d3;_0x2ed9dd=0xc8;}else{_0x2ed9dd=0xce;}_0x20c4ec[_0xc606('0x18')](_0x2ed9dd);return _0x20c4ec[_0xc606('0x1f')]('Content-Range',_0xbaed22+'-'+_0x3d04e1+'/'+_0x3c53d3)['json'](_0x1da617);}return null;};}function patchUpdates(_0x424b1e){return function(_0x58216c){try{jsonpatch[_0xc606('0x20')](_0x58216c,_0x424b1e,!![]);}catch(_0x461a9b){return BPromise[_0xc606('0x21')](_0x461a9b);}return _0x58216c[_0xc606('0x22')]();};}function saveUpdates(_0x5192d6,_0x4c6575){return function(_0x13b8c0){if(_0x13b8c0){return _0x13b8c0[_0xc606('0x23')](_0x5192d6)['then'](function(_0x34320b){return _0x34320b;});}return null;};}function removeEntity(_0x4da495,_0x54c1b9){return function(_0x35ec90){if(_0x35ec90){return _0x35ec90['destroy']()[_0xc606('0x24')](function(){var _0x3fdfcd=_0x35ec90['get']({'plain':!![]});var _0x2e434a=_0xc606('0x25');return db[_0xc606('0x26')]['destroy']({'where':{'type':_0x2e434a,'resourceId':_0x3fdfcd['id']}})['then'](function(){return _0x35ec90;});})['then'](function(){_0x4da495['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3fd144,_0x13e5a6){return function(_0x3563f6){if(!_0x3563f6){_0x3fd144[_0xc606('0x17')](0x194);}return _0x3563f6;};}function handleError(_0x5131da,_0x4aacd6){_0x4aacd6=_0x4aacd6||0x1f4;return function(_0x2df772){logger[_0xc606('0x27')](_0x2df772['stack']);if(_0x2df772[_0xc606('0x28')]){delete _0x2df772[_0xc606('0x28')];}_0x5131da[_0xc606('0x18')](_0x4aacd6)[_0xc606('0x29')](_0x2df772);};}exports[_0xc606('0x2a')]=function(_0x5558c8,_0x22bb47){var _0x5413f6={},_0x3829ee={},_0x2e1c9a={'count':0x0,'rows':[]};var _0x57ccae=_[_0xc606('0x2b')](db[_0xc606('0x2c')][_0xc606('0x2d')],function(_0x39c5a1){return{'name':_0x39c5a1[_0xc606('0x2e')],'type':_0x39c5a1[_0xc606('0x2f')]['key']};});_0x3829ee[_0xc606('0x30')]=_[_0xc606('0x2b')](_0x57ccae,_0xc606('0x28'));_0x3829ee[_0xc606('0x31')]=_[_0xc606('0x32')](_0x5558c8[_0xc606('0x31')]);_0x3829ee['filters']=_[_0xc606('0x33')](_0x3829ee[_0xc606('0x30')],_0x3829ee['query']);_0x5413f6[_0xc606('0x34')]=_['intersection'](_0x3829ee[_0xc606('0x30')],qs[_0xc606('0x35')](_0x5558c8[_0xc606('0x31')]['fields']));_0x5413f6[_0xc606('0x34')]=_0x5413f6['attributes']['length']?_0x5413f6[_0xc606('0x34')]:_0x3829ee[_0xc606('0x30')];if(!_0x5558c8[_0xc606('0x31')]['hasOwnProperty']('nolimit')){_0x5413f6[_0xc606('0x1c')]=qs[_0xc606('0x1c')](_0x5558c8['query'][_0xc606('0x1c')]);_0x5413f6['offset']=qs['offset'](_0x5558c8[_0xc606('0x31')][_0xc606('0x1b')]);}_0x5413f6[_0xc606('0x36')]=qs['sort'](_0x5558c8['query'][_0xc606('0x37')]);_0x5413f6[_0xc606('0x38')]=qs[_0xc606('0x39')](_['pick'](_0x5558c8[_0xc606('0x31')],_0x3829ee[_0xc606('0x39')]),_0x57ccae);if(_0x5558c8[_0xc606('0x31')][_0xc606('0x3a')]){_0x5413f6[_0xc606('0x38')]=_[_0xc606('0x3b')](_0x5413f6[_0xc606('0x38')],{'$or':_[_0xc606('0x2b')](_0x57ccae,function(_0x3c1963){if(_0x3c1963[_0xc606('0x2f')]!=='VIRTUAL'){var _0x6c5930={};_0x6c5930[_0x3c1963[_0xc606('0x28')]]={'$like':'%'+_0x5558c8[_0xc606('0x31')][_0xc606('0x3a')]+'%'};return _0x6c5930;}})});}_0x5413f6=_[_0xc606('0x3b')]({},_0x5413f6,_0x5558c8[_0xc606('0x3c')]);var _0x56fd1b={'where':_0x5413f6[_0xc606('0x38')]};return db[_0xc606('0x2c')][_0xc606('0x1e')](_0x56fd1b)['then'](function(_0x45b98d){_0x2e1c9a['count']=_0x45b98d;if(_0x5558c8[_0xc606('0x31')]['includeAll']){_0x5413f6[_0xc606('0x3d')]=[{'all':!![]}];}return db[_0xc606('0x2c')][_0xc606('0x3e')](_0x5413f6);})['then'](function(_0x1d78d6){_0x2e1c9a['rows']=_0x1d78d6;return _0x2e1c9a;})[_0xc606('0x24')](respondWithFilteredResult(_0x22bb47,_0x5413f6))['catch'](handleError(_0x22bb47,null));};exports['show']=function(_0x3c93c7,_0x4ec9b6){var _0x25d2fe={'raw':!![],'where':{'id':_0x3c93c7['params']['id']}},_0x15acbd={};_0x15acbd[_0xc606('0x30')]=_['keys'](db[_0xc606('0x2c')]['rawAttributes']);_0x15acbd['query']=_[_0xc606('0x32')](_0x3c93c7['query']);_0x15acbd[_0xc606('0x39')]=_[_0xc606('0x33')](_0x15acbd['model'],_0x15acbd[_0xc606('0x31')]);_0x25d2fe[_0xc606('0x34')]=_[_0xc606('0x33')](_0x15acbd['model'],qs[_0xc606('0x35')](_0x3c93c7[_0xc606('0x31')][_0xc606('0x35')]));_0x25d2fe['attributes']=_0x25d2fe[_0xc606('0x34')][_0xc606('0x3f')]?_0x25d2fe['attributes']:_0x15acbd[_0xc606('0x30')];if(_0x3c93c7['query'][_0xc606('0x40')]){_0x25d2fe[_0xc606('0x3d')]=[{'all':!![]}];}_0x25d2fe=_[_0xc606('0x3b')]({},_0x25d2fe,_0x3c93c7[_0xc606('0x3c')]);return db[_0xc606('0x2c')][_0xc606('0x41')](_0x25d2fe)[_0xc606('0x24')](handleEntityNotFound(_0x4ec9b6,null))[_0xc606('0x24')](respondWithResult(_0x4ec9b6,null))[_0xc606('0x42')](handleError(_0x4ec9b6,null));};exports[_0xc606('0x43')]=function(_0x4ef4cf,_0x479669){return db[_0xc606('0x2c')][_0xc606('0x43')](_0x4ef4cf[_0xc606('0x44')],{})[_0xc606('0x24')](function(_0x353e46){var _0x2b6793=_0x4ef4cf[_0xc606('0x45')]['get']({'plain':!![]});if(!_0x2b6793)throw new Error(_0xc606('0x46'));if(_0x2b6793[_0xc606('0x47')]===_0xc606('0x45')){var _0x131ceb=_0x353e46[_0xc606('0x48')]({'plain':!![]});var _0x58e081=_0xc606('0x25');return db[_0xc606('0x49')]['find']({'where':{'name':_0x58e081,'userProfileId':_0x2b6793[_0xc606('0x4a')]},'raw':!![]})[_0xc606('0x24')](function(_0x89704){if(_0x89704&&_0x89704['autoAssociation']===0x0){return db[_0xc606('0x26')][_0xc606('0x43')]({'name':_0x131ceb[_0xc606('0x28')],'resourceId':_0x131ceb['id'],'type':_0x89704['name'],'sectionId':_0x89704['id']},{})[_0xc606('0x24')](function(){return _0x353e46;});}else{return _0x353e46;}})[_0xc606('0x42')](function(_0x1d6f3c){logger['error'](_0xc606('0x4b'),_0x1d6f3c);throw _0x1d6f3c;});}return _0x353e46;})[_0xc606('0x24')](respondWithResult(_0x479669,0xc9))[_0xc606('0x42')](handleError(_0x479669,null));};exports[_0xc606('0x23')]=function(_0x1a9a97,_0x1549b8){if(_0x1a9a97[_0xc606('0x44')]['id']){delete _0x1a9a97[_0xc606('0x44')]['id'];}return db['AnalyticExtractedReport'][_0xc606('0x41')]({'where':{'id':_0x1a9a97[_0xc606('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1549b8,null))[_0xc606('0x24')](saveUpdates(_0x1a9a97[_0xc606('0x44')],null))[_0xc606('0x24')](respondWithResult(_0x1549b8,null))['catch'](handleError(_0x1549b8,null));};exports[_0xc606('0x4d')]=function(_0x17fba7,_0xe0b8cf){return db[_0xc606('0x2c')][_0xc606('0x41')]({'where':{'id':_0x17fba7['params']['id']}})[_0xc606('0x24')](handleEntityNotFound(_0xe0b8cf,null))['then'](removeEntity(_0xe0b8cf,null))['catch'](handleError(_0xe0b8cf,null));};exports[_0xc606('0x4e')]=function(_0x5a3146,_0xdac000,_0x344420){return db[_0xc606('0x2c')][_0xc606('0x41')]({'where':{'id':_0x5a3146[_0xc606('0x4c')]['id']},'attributes':[_0xc606('0x28'),'basename','savename',_0xc606('0x4f')],'raw':!![]})[_0xc606('0x24')](handleEntityNotFound(_0xdac000,null))[_0xc606('0x24')](function(_0x353583){if(_0x353583){if(!fs[_0xc606('0x50')](path[_0xc606('0x51')](config[_0xc606('0x52')],_0xc606('0x53'),_0x353583[_0xc606('0x54')]))){throw new db['Sequelize'][(_0xc606('0x55'))](_0xc606('0x56'));}if(_0x5a3146['query']['exists']){return _0xdac000[_0xc606('0x17')](0xc8);}return _0xdac000['download'](path['join'](config['root'],_0xc606('0x53'),_0x353583[_0xc606('0x54')]),util[_0xc606('0x57')](_0xc606('0x58'),_0x353583[_0xc606('0x59')]||_0x353583[_0xc606('0x28')],_0x353583['output'][_0xc606('0x5a')]()));}})[_0xc606('0x42')](handleError(_0xdac000,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 63bb1bd..146311c 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 _0xb774=['lodash','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','analytics_extracted_reports'];(function(_0x6106d8,_0x67937c){var _0x8a8fe8=function(_0x77027d){while(--_0x77027d){_0x6106d8['push'](_0x6106d8['shift']());}};_0x8a8fe8(++_0x67937c);}(_0xb774,0x18c));var _0x4b77=function(_0x48f0a5,_0x157aca){_0x48f0a5=_0x48f0a5-0x0;var _0x469cf9=_0xb774[_0x48f0a5];return _0x469cf9;};'use strict';var _=require(_0x4b77('0x0'));var util=require('util');var logger=require(_0x4b77('0x1'))(_0x4b77('0x2'));var moment=require('moment');var BPromise=require(_0x4b77('0x3'));var rp=require(_0x4b77('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4b77('0x5'));var config=require(_0x4b77('0x6'));var attributes=require(_0x4b77('0x7'));module[_0x4b77('0x8')]=function(_0x4880ae,_0x12ae85){return _0x4880ae[_0x4b77('0x9')](_0x4b77('0xa'),attributes,{'tableName':_0x4b77('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6567=['moment','bluebird','request-promise','rimraf','../../config/environment','./analyticExtractedReport.attributes','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','../../config/logger','api'];(function(_0x1e2072,_0x145d84){var _0x1a72ce=function(_0xd30383){while(--_0xd30383){_0x1e2072['push'](_0x1e2072['shift']());}};_0x1a72ce(++_0x145d84);}(_0x6567,0x168));var _0x7656=function(_0xfacbc8,_0x3cf35b){_0xfacbc8=_0xfacbc8-0x0;var _0x512376=_0x6567[_0xfacbc8];return _0x512376;};'use strict';var _=require(_0x7656('0x0'));var util=require(_0x7656('0x1'));var logger=require(_0x7656('0x2'))(_0x7656('0x3'));var moment=require(_0x7656('0x4'));var BPromise=require(_0x7656('0x5'));var rp=require(_0x7656('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7656('0x7'));var config=require(_0x7656('0x8'));var attributes=require(_0x7656('0x9'));module['exports']=function(_0x3b9092,_0x19e3d3){return _0x3b9092[_0x7656('0xa')](_0x7656('0xb'),attributes,{'tableName':_0x7656('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index 833f202..d09f2a0 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 _0xd237=['client','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x4d11a2,_0xc058dc){var _0x3f64bb=function(_0x3ce929){while(--_0x3ce929){_0x4d11a2['push'](_0x4d11a2['shift']());}};_0x3f64bb(++_0xc058dc);}(_0xd237,0x14f));var _0x7d23=function(_0x2853ab,_0x8acdcb){_0x2853ab=_0x2853ab-0x0;var _0x335454=_0xd237[_0x2853ab];return _0x335454;};'use strict';var _=require(_0x7d23('0x0'));var util=require(_0x7d23('0x1'));var moment=require(_0x7d23('0x2'));var BPromise=require(_0x7d23('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7d23('0x4'));var db=require(_0x7d23('0x5'))['db'];var utils=require(_0x7d23('0x6'));var logger=require(_0x7d23('0x7'))(_0x7d23('0x8'));var config=require(_0x7d23('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7d23('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5ca126,_0x48358f,_0xc43371){return new BPromise(function(_0x42c334,_0x6ce28d){return client[_0x7d23('0xb')](_0x5ca126,_0xc43371)[_0x7d23('0xc')](function(_0x23f1d6){logger[_0x7d23('0xd')](_0x7d23('0xe'),_0x48358f,'request\x20sent');logger[_0x7d23('0xf')](_0x7d23('0x10'),_0x48358f,_0x7d23('0x11'),JSON['stringify'](_0x23f1d6));if(_0x23f1d6[_0x7d23('0x12')]){if(_0x23f1d6['error'][_0x7d23('0x13')]===0x1f4){logger[_0x7d23('0x12')](_0x7d23('0xe'),_0x48358f,_0x23f1d6[_0x7d23('0x12')][_0x7d23('0x14')]);return _0x6ce28d(_0x23f1d6[_0x7d23('0x12')][_0x7d23('0x14')]);}logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x48358f,_0x23f1d6[_0x7d23('0x12')][_0x7d23('0x14')]);return _0x42c334(_0x23f1d6[_0x7d23('0x12')][_0x7d23('0x14')]);}else{logger['info'](_0x7d23('0xe'),_0x48358f,'request\x20sent');_0x42c334(_0x23f1d6[_0x7d23('0x15')]['message']);}})[_0x7d23('0x16')](function(_0x46a35b){logger[_0x7d23('0x12')](_0x7d23('0xe'),_0x48358f,_0x46a35b);_0x6ce28d(_0x46a35b);});});} \ No newline at end of file +var _0xcc98=['info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0xcc98,0xb2));var _0x8cc9=function(_0x382492,_0x2b8cde){_0x382492=_0x382492-0x0;var _0xbaaf9d=_0xcc98[_0x382492];return _0xbaaf9d;};'use strict';var _=require(_0x8cc9('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x8cc9('0x1'));var rs=require(_0x8cc9('0x2'));var fs=require('fs');var Redis=require(_0x8cc9('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8cc9('0x4'))(_0x8cc9('0x5'));var config=require(_0x8cc9('0x6'));var jayson=require(_0x8cc9('0x7'));var client=jayson[_0x8cc9('0x8')][_0x8cc9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3cd59d,_0x365276,_0x189baa){return new BPromise(function(_0x13b48c,_0x167350){return client['request'](_0x3cd59d,_0x189baa)[_0x8cc9('0xa')](function(_0xeabd12){logger[_0x8cc9('0xb')](_0x8cc9('0xc'),_0x365276,_0x8cc9('0xd'));logger['debug'](_0x8cc9('0xe'),_0x365276,_0x8cc9('0xd'),JSON[_0x8cc9('0xf')](_0xeabd12));if(_0xeabd12[_0x8cc9('0x10')]){if(_0xeabd12[_0x8cc9('0x10')][_0x8cc9('0x11')]===0x1f4){logger[_0x8cc9('0x10')](_0x8cc9('0xc'),_0x365276,_0xeabd12[_0x8cc9('0x10')][_0x8cc9('0x12')]);return _0x167350(_0xeabd12['error'][_0x8cc9('0x12')]);}logger[_0x8cc9('0x10')](_0x8cc9('0xc'),_0x365276,_0xeabd12[_0x8cc9('0x10')][_0x8cc9('0x12')]);return _0x13b48c(_0xeabd12['error']['message']);}else{logger[_0x8cc9('0xb')](_0x8cc9('0xc'),_0x365276,_0x8cc9('0xd'));_0x13b48c(_0xeabd12[_0x8cc9('0x13')][_0x8cc9('0x12')]);}})[_0x8cc9('0x14')](function(_0x2ad65f){logger[_0x8cc9('0x10')](_0x8cc9('0xc'),_0x365276,_0x2ad65f);_0x167350(_0x2ad65f);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 6934905..a5fc1a4 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 _0x85c8=['../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','index','get','/:id','isAuthenticated','show','/:id/download','download','delete','destroy','multer','path','express','Router','fs-extra'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x85c8,0x13f));var _0x885c=function(_0x35c2d1,_0xc18ad8){_0x35c2d1=_0x35c2d1-0x0;var _0x3e1104=_0x85c8[_0x35c2d1];return _0x3e1104;};'use strict';var multer=require(_0x885c('0x0'));var util=require('util');var path=require(_0x885c('0x1'));var timeout=require('connect-timeout');var express=require(_0x885c('0x2'));var router=express[_0x885c('0x3')]();var fs_extra=require(_0x885c('0x4'));var auth=require(_0x885c('0x5'));var interaction=require(_0x885c('0x6'));var config=require(_0x885c('0x7'));var controller=require(_0x885c('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x885c('0x9')]);router[_0x885c('0xa')](_0x885c('0xb'),auth[_0x885c('0xc')](),controller[_0x885c('0xd')]);router[_0x885c('0xa')](_0x885c('0xe'),auth['isAuthenticated'](),controller[_0x885c('0xf')]);router['post']('/',auth[_0x885c('0xc')](),controller['create']);router['put'](_0x885c('0xb'),auth[_0x885c('0xc')](),controller['update']);router[_0x885c('0x10')]('/:id',auth[_0x885c('0xc')](),controller[_0x885c('0x11')]);module['exports']=router; \ No newline at end of file +var _0xade5=['../../config/environment','get','index','/:id','show','/:id/download','isAuthenticated','download','post','create','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x7ad6cb,_0xffee6c){var _0x22a0ba=function(_0x47f291){while(--_0x47f291){_0x7ad6cb['push'](_0x7ad6cb['shift']());}};_0x22a0ba(++_0xffee6c);}(_0xade5,0x172));var _0x5ade=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xade5[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x5ade('0x0'));var util=require(_0x5ade('0x1'));var path=require(_0x5ade('0x2'));var timeout=require(_0x5ade('0x3'));var express=require(_0x5ade('0x4'));var router=express[_0x5ade('0x5')]();var fs_extra=require(_0x5ade('0x6'));var auth=require(_0x5ade('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x5ade('0x8'));var controller=require('./analyticExtractedReport.controller');router[_0x5ade('0x9')]('/',auth['isAuthenticated'](),controller[_0x5ade('0xa')]);router['get'](_0x5ade('0xb'),auth['isAuthenticated'](),controller[_0x5ade('0xc')]);router['get'](_0x5ade('0xd'),auth[_0x5ade('0xe')](),controller[_0x5ade('0xf')]);router[_0x5ade('0x10')]('/',auth[_0x5ade('0xe')](),controller[_0x5ade('0x11')]);router['put'](_0x5ade('0xb'),auth['isAuthenticated'](),controller[_0x5ade('0x12')]);router[_0x5ade('0x13')](_0x5ade('0xb'),auth[_0x5ade('0xe')](),controller['destroy']);module[_0x5ade('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 15073aa..8f5b37a 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 _0xb916=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x4562bb,_0x5a8f8d){var _0x110188=function(_0x48aa24){while(--_0x48aa24){_0x4562bb['push'](_0x4562bb['shift']());}};_0x110188(++_0x5a8f8d);}(_0xb916,0x131));var _0x6b91=function(_0x46884f,_0x2b5c5a){_0x46884f=_0x46884f-0x0;var _0x78c6c0=_0xb916[_0x46884f];return _0x78c6c0;};'use strict';var Sequelize=require(_0x6b91('0x0'));module[_0x6b91('0x1')]={'field':{'type':Sequelize[_0x6b91('0x2')]},'alias':{'type':Sequelize[_0x6b91('0x3')]},'function':{'type':Sequelize[_0x6b91('0x3')]},'format':{'type':Sequelize[_0x6b91('0x3')]},'groupBy':{'type':Sequelize[_0x6b91('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x6b91('0x3')]},'custom':{'type':Sequelize[_0x6b91('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x2fd8=['sequelize','TEXT','STRING'];(function(_0x41a127,_0x546a15){var _0x526801=function(_0x3a936d){while(--_0x3a936d){_0x41a127['push'](_0x41a127['shift']());}};_0x526801(++_0x546a15);}(_0x2fd8,0xc3));var _0x82fd=function(_0x412cf9,_0x1a4932){_0x412cf9=_0x412cf9-0x0;var _0x9d24e4=_0x2fd8[_0x412cf9];return _0x9d24e4;};'use strict';var Sequelize=require(_0x82fd('0x0'));module['exports']={'field':{'type':Sequelize[_0x82fd('0x1')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x82fd('0x2')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x82fd('0x2')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 16c9e18..3a22be6 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 _0x47a9=['rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','error','stack','name','status','send','index','map','AnalyticFieldReport','fieldName','type','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','length','options','create','body','bulkCreate','update','find','destroy','ids','addFields','findOne','eml-format'];(function(_0x18a794,_0x335c63){var _0x4fadaa=function(_0x49b618){while(--_0x49b618){_0x18a794['push'](_0x18a794['shift']());}};_0x4fadaa(++_0x335c63);}(_0x47a9,0x9b));var _0x947a=function(_0x4dcaaf,_0x39bf5f){_0x4dcaaf=_0x4dcaaf-0x0;var _0x5c6fa2=_0x47a9[_0x4dcaaf];return _0x5c6fa2;};'use strict';var emlformat=require(_0x947a('0x0'));var rimraf=require(_0x947a('0x1'));var zipdir=require(_0x947a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x947a('0x3'));var moment=require(_0x947a('0x4'));var BPromise=require(_0x947a('0x5'));var Mustache=require('mustache');var util=require(_0x947a('0x6'));var path=require(_0x947a('0x7'));var sox=require(_0x947a('0x8'));var csv=require(_0x947a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x947a('0xa'));var _=require(_0x947a('0xb'));var squel=require(_0x947a('0xc'));var crypto=require('crypto');var jsforce=require(_0x947a('0xd'));var deskjs=require(_0x947a('0xe'));var toCsv=require(_0x947a('0x9'));var querystring=require(_0x947a('0xf'));var Papa=require(_0x947a('0x10'));var Redis=require('ioredis');var authService=require(_0x947a('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x947a('0x12'));var logger=require(_0x947a('0x13'))(_0x947a('0x14'));var utils=require(_0x947a('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3e0134,_0x29a24a){_0x29a24a=_0x29a24a||0xcc;return function(_0x18c83e){if(_0x18c83e){return _0x3e0134[_0x947a('0x16')](_0x29a24a);}return _0x3e0134['status'](_0x29a24a)[_0x947a('0x17')]();};}function respondWithResult(_0x14c11a,_0x5d5a2b){_0x5d5a2b=_0x5d5a2b||0xc8;return function(_0x238742){if(_0x238742){return _0x14c11a['status'](_0x5d5a2b)[_0x947a('0x18')](_0x238742);}};}function respondWithFilteredResult(_0x3b3207,_0x368161){return function(_0x4516fa){if(_0x4516fa){var _0x12bb41=typeof _0x368161[_0x947a('0x19')]===_0x947a('0x1a')&&typeof _0x368161['limit']===_0x947a('0x1a');var _0x2ad5f2=_0x4516fa[_0x947a('0x1b')];var _0x512298=_0x12bb41?0x0:_0x368161[_0x947a('0x19')];var _0x110906=_0x12bb41?_0x4516fa[_0x947a('0x1b')]:_0x368161[_0x947a('0x19')]+_0x368161[_0x947a('0x1c')];var _0x3c4086;if(_0x110906>=_0x2ad5f2){_0x110906=_0x2ad5f2;_0x3c4086=0xc8;}else{_0x3c4086=0xce;}_0x3b3207['status'](_0x3c4086);return _0x3b3207[_0x947a('0x1d')](_0x947a('0x1e'),_0x512298+'-'+_0x110906+'/'+_0x2ad5f2)[_0x947a('0x18')](_0x4516fa);}return null;};}function patchUpdates(_0x3ba1a2){return function(_0x57e6e2){try{jsonpatch[_0x947a('0x1f')](_0x57e6e2,_0x3ba1a2,!![]);}catch(_0x45834c){return BPromise[_0x947a('0x20')](_0x45834c);}return _0x57e6e2[_0x947a('0x21')]();};}function saveUpdates(_0x518764,_0x214f5c){return function(_0x5e056d){if(_0x5e056d){return _0x5e056d['update'](_0x518764)['then'](function(_0x5dbde2){return _0x5dbde2;});}return null;};}function removeEntity(_0x1d9ebb,_0x397501){return function(_0x4741c1){if(_0x4741c1){return _0x4741c1['destroy']()[_0x947a('0x22')](function(){_0x1d9ebb['status'](0xcc)[_0x947a('0x17')]();});}};}function handleEntityNotFound(_0x20d021,_0x5274f2){return function(_0x519a15){if(!_0x519a15){_0x20d021[_0x947a('0x16')](0x194);}return _0x519a15;};}function handleError(_0x36060d,_0x17336b){_0x17336b=_0x17336b||0x1f4;return function(_0x212bc5){logger[_0x947a('0x23')](_0x212bc5[_0x947a('0x24')]);if(_0x212bc5[_0x947a('0x25')]){delete _0x212bc5[_0x947a('0x25')];}_0x36060d[_0x947a('0x26')](_0x17336b)[_0x947a('0x27')](_0x212bc5);};}exports[_0x947a('0x28')]=function(_0x143e00,_0x544312){var _0x3163c7={},_0x59ce3b={},_0x25305d={'count':0x0,'rows':[]};var _0x1633fe=_[_0x947a('0x29')](db[_0x947a('0x2a')]['rawAttributes'],function(_0x54bb38){return{'name':_0x54bb38[_0x947a('0x2b')],'type':_0x54bb38[_0x947a('0x2c')]['key']};});_0x59ce3b['model']=_['map'](_0x1633fe,_0x947a('0x25'));_0x59ce3b[_0x947a('0x2d')]=_[_0x947a('0x2e')](_0x143e00[_0x947a('0x2d')]);_0x59ce3b[_0x947a('0x2f')]=_[_0x947a('0x30')](_0x59ce3b[_0x947a('0x31')],_0x59ce3b[_0x947a('0x2d')]);_0x3163c7['attributes']=_['intersection'](_0x59ce3b[_0x947a('0x31')],qs[_0x947a('0x32')](_0x143e00[_0x947a('0x2d')]['fields']));_0x3163c7[_0x947a('0x33')]=_0x3163c7[_0x947a('0x33')]['length']?_0x3163c7[_0x947a('0x33')]:_0x59ce3b['model'];if(!_0x143e00['query'][_0x947a('0x34')]('nolimit')){_0x3163c7[_0x947a('0x1c')]=qs[_0x947a('0x1c')](_0x143e00['query'][_0x947a('0x1c')]);_0x3163c7[_0x947a('0x19')]=qs[_0x947a('0x19')](_0x143e00[_0x947a('0x2d')][_0x947a('0x19')]);}_0x3163c7[_0x947a('0x35')]=qs[_0x947a('0x36')](_0x143e00[_0x947a('0x2d')][_0x947a('0x36')]);_0x3163c7[_0x947a('0x37')]=qs['filters'](_[_0x947a('0x38')](_0x143e00['query'],_0x59ce3b[_0x947a('0x2f')]),_0x1633fe);if(_0x143e00[_0x947a('0x2d')][_0x947a('0x39')]){_0x3163c7[_0x947a('0x37')]=_['merge'](_0x3163c7[_0x947a('0x37')],{'$or':_[_0x947a('0x29')](_0x1633fe,function(_0xb8311d){if(_0xb8311d[_0x947a('0x2c')]!==_0x947a('0x3a')){var _0x52f150={};_0x52f150[_0xb8311d[_0x947a('0x25')]]={'$like':'%'+_0x143e00[_0x947a('0x2d')][_0x947a('0x39')]+'%'};return _0x52f150;}})});}_0x3163c7=_[_0x947a('0x3b')]({},_0x3163c7,_0x143e00['options']);var _0x54b91c={'where':_0x3163c7['where']};return db[_0x947a('0x2a')]['count'](_0x54b91c)['then'](function(_0x148df9){_0x25305d[_0x947a('0x1b')]=_0x148df9;if(_0x143e00[_0x947a('0x2d')][_0x947a('0x3c')]){_0x3163c7[_0x947a('0x3d')]=[{'all':!![]}];}return db['AnalyticFieldReport'][_0x947a('0x3e')](_0x3163c7);})[_0x947a('0x22')](function(_0x5b5e26){_0x25305d[_0x947a('0x3f')]=_0x5b5e26;return _0x25305d;})['then'](respondWithFilteredResult(_0x544312,_0x3163c7))[_0x947a('0x40')](handleError(_0x544312,null));};exports[_0x947a('0x41')]=function(_0x1e82cc,_0x419d41){var _0x1d8a57={'raw':![],'where':{'id':_0x1e82cc[_0x947a('0x42')]['id']}},_0x1bf8cb={};_0x1bf8cb[_0x947a('0x31')]=_[_0x947a('0x2e')](db[_0x947a('0x2a')]['rawAttributes']);_0x1bf8cb[_0x947a('0x2d')]=_['keys'](_0x1e82cc[_0x947a('0x2d')]);_0x1bf8cb[_0x947a('0x2f')]=_['intersection'](_0x1bf8cb[_0x947a('0x31')],_0x1bf8cb[_0x947a('0x2d')]);_0x1d8a57[_0x947a('0x33')]=_[_0x947a('0x30')](_0x1bf8cb['model'],qs[_0x947a('0x32')](_0x1e82cc[_0x947a('0x2d')][_0x947a('0x32')]));_0x1d8a57[_0x947a('0x33')]=_0x1d8a57[_0x947a('0x33')][_0x947a('0x43')]?_0x1d8a57[_0x947a('0x33')]:_0x1bf8cb['model'];if(_0x1e82cc[_0x947a('0x2d')][_0x947a('0x3c')]){_0x1d8a57[_0x947a('0x3d')]=[{'all':!![]}];}_0x1d8a57=_[_0x947a('0x3b')]({},_0x1d8a57,_0x1e82cc[_0x947a('0x44')]);return db[_0x947a('0x2a')]['find'](_0x1d8a57)[_0x947a('0x22')](handleEntityNotFound(_0x419d41,null))[_0x947a('0x22')](respondWithResult(_0x419d41,null))[_0x947a('0x40')](handleError(_0x419d41,null));};exports[_0x947a('0x45')]=function(_0x39c745,_0x3a7551){return db[_0x947a('0x2a')][_0x947a('0x45')](_0x39c745[_0x947a('0x46')],{})[_0x947a('0x22')](respondWithResult(_0x3a7551,0xc9))[_0x947a('0x40')](handleError(_0x3a7551,null));};exports[_0x947a('0x47')]=function(_0x3054c7,_0x5adf05){return db[_0x947a('0x2a')]['bulkCreate'](_0x3054c7[_0x947a('0x46')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x5adf05,0xc9))[_0x947a('0x40')](handleError(_0x5adf05,null));};exports[_0x947a('0x48')]=function(_0x3f6377,_0x5150eb){if(_0x3f6377[_0x947a('0x46')]['id']){delete _0x3f6377[_0x947a('0x46')]['id'];}return db[_0x947a('0x2a')][_0x947a('0x49')]({'where':{'id':_0x3f6377['params']['id']}})[_0x947a('0x22')](handleEntityNotFound(_0x5150eb,null))[_0x947a('0x22')](saveUpdates(_0x3f6377[_0x947a('0x46')],null))['then'](respondWithResult(_0x5150eb,null))[_0x947a('0x40')](handleError(_0x5150eb,null));};exports[_0x947a('0x4a')]=function(_0x270b9f,_0x4cd0ed){return db[_0x947a('0x2a')][_0x947a('0x49')]({'where':{'id':_0x270b9f[_0x947a('0x42')]['id']}})['then'](handleEntityNotFound(_0x4cd0ed,null))[_0x947a('0x22')](removeEntity(_0x4cd0ed,null))[_0x947a('0x40')](handleError(_0x4cd0ed,null));};exports['bulkDestroy']=function(_0x368d71,_0x248f5b){return db[_0x947a('0x2a')][_0x947a('0x4a')]({'where':{'id':_0x368d71[_0x947a('0x2d')][_0x947a('0x4b')]||[]},'raw':![],'individualHooks':!![]})[_0x947a('0x22')](respondWithResult(_0x248f5b,0xcc))[_0x947a('0x40')](handleError(_0x248f5b,null));};exports[_0x947a('0x4c')]=function(_0x4f4dfa,_0x4faadd,_0x2883ba){return db['AnalyticCustomReport'][_0x947a('0x4d')]({'where':{'id':_0x4f4dfa['params']['id']}})[_0x947a('0x22')](handleEntityNotFound(_0x4faadd,null))['then'](function(_0x2a3ce7){if(_0x2a3ce7){return db['sequelize']['transaction'](function(_0x5d65a5){return db[_0x947a('0x2a')]['destroy']({'where':{'CustomReportId':_0x4f4dfa[_0x947a('0x42')]['id']},'transaction':_0x5d65a5})['then'](function(_0x5436ac){var _0xc8cbfc=_['map'](_0x4f4dfa[_0x947a('0x46')],function(_0x31579e){delete _0x31579e['id'];_0x31579e['CustomReportId']=_0x4f4dfa[_0x947a('0x42')]['id'];return _0x31579e;});return db[_0x947a('0x2a')][_0x947a('0x47')](_0xc8cbfc,{'transaction':_0x5d65a5});});})['then'](function(){return db[_0x947a('0x2a')]['findAll']({'where':{'CustomReportId':_0x4f4dfa[_0x947a('0x42')]['id']}});});}})[_0x947a('0x22')](respondWithResult(_0x4faadd,null))['catch'](handleError(_0x4faadd,null));}; \ No newline at end of file +var _0x91cd=['end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','error','stack','name','send','index','rawAttributes','type','key','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','merge','AnalyticFieldReport','then','includeAll','include','findAll','catch','show','length','options','find','create','body','bulkCreate','params','destroy','bulkDestroy','ids','addFields','AnalyticCustomReport','sequelize','transaction','CustomReportId','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x48f94e,_0x62515d){var _0x25be89=function(_0x37bdd4){while(--_0x37bdd4){_0x48f94e['push'](_0x48f94e['shift']());}};_0x25be89(++_0x62515d);}(_0x91cd,0x12d));var _0xd91c=function(_0x4dbba7,_0x34d6d1){_0x4dbba7=_0x4dbba7-0x0;var _0x43ef83=_0x91cd[_0x4dbba7];return _0x43ef83;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd91c('0x0'));var zipdir=require(_0xd91c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd91c('0x2'));var moment=require(_0xd91c('0x3'));var BPromise=require(_0xd91c('0x4'));var Mustache=require('mustache');var util=require(_0xd91c('0x5'));var path=require('path');var sox=require(_0xd91c('0x6'));var csv=require(_0xd91c('0x7'));var ejs=require(_0xd91c('0x8'));var fs=require('fs');var fs_extra=require(_0xd91c('0x9'));var _=require(_0xd91c('0xa'));var squel=require(_0xd91c('0xb'));var crypto=require(_0xd91c('0xc'));var jsforce=require(_0xd91c('0xd'));var deskjs=require(_0xd91c('0xe'));var toCsv=require(_0xd91c('0x7'));var querystring=require('querystring');var Papa=require(_0xd91c('0xf'));var Redis=require(_0xd91c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xd91c('0x11'));var as=require(_0xd91c('0x12'));var hardwareService=require(_0xd91c('0x13'));var logger=require(_0xd91c('0x14'))(_0xd91c('0x15'));var utils=require('../../config/utils');var config=require(_0xd91c('0x16'));var licenseUtil=require(_0xd91c('0x17'));var db=require(_0xd91c('0x18'))['db'];function respondWithStatusCode(_0xa62588,_0x1a8263){_0x1a8263=_0x1a8263||0xcc;return function(_0x47fc56){if(_0x47fc56){return _0xa62588[_0xd91c('0x19')](_0x1a8263);}return _0xa62588[_0xd91c('0x1a')](_0x1a8263)[_0xd91c('0x1b')]();};}function respondWithResult(_0x5a9a34,_0x321d51){_0x321d51=_0x321d51||0xc8;return function(_0x43a300){if(_0x43a300){return _0x5a9a34[_0xd91c('0x1a')](_0x321d51)[_0xd91c('0x1c')](_0x43a300);}};}function respondWithFilteredResult(_0x445732,_0x43f01a){return function(_0x1f749a){if(_0x1f749a){var _0xf83191=typeof _0x43f01a[_0xd91c('0x1d')]===_0xd91c('0x1e')&&typeof _0x43f01a[_0xd91c('0x1f')]===_0xd91c('0x1e');var _0x2494c6=_0x1f749a[_0xd91c('0x20')];var _0x56fef=_0xf83191?0x0:_0x43f01a[_0xd91c('0x1d')];var _0x53ca16=_0xf83191?_0x1f749a[_0xd91c('0x20')]:_0x43f01a[_0xd91c('0x1d')]+_0x43f01a[_0xd91c('0x1f')];var _0x2c3317;if(_0x53ca16>=_0x2494c6){_0x53ca16=_0x2494c6;_0x2c3317=0xc8;}else{_0x2c3317=0xce;}_0x445732['status'](_0x2c3317);return _0x445732[_0xd91c('0x21')](_0xd91c('0x22'),_0x56fef+'-'+_0x53ca16+'/'+_0x2494c6)['json'](_0x1f749a);}return null;};}function patchUpdates(_0x13e6f0){return function(_0x43a577){try{jsonpatch[_0xd91c('0x23')](_0x43a577,_0x13e6f0,!![]);}catch(_0x5b48f1){return BPromise[_0xd91c('0x24')](_0x5b48f1);}return _0x43a577[_0xd91c('0x25')]();};}function saveUpdates(_0x38895a,_0x53a6bc){return function(_0x22b0d4){if(_0x22b0d4){return _0x22b0d4[_0xd91c('0x26')](_0x38895a)['then'](function(_0x149399){return _0x149399;});}return null;};}function removeEntity(_0x3f976d,_0x3fc434){return function(_0x42b4e3){if(_0x42b4e3){return _0x42b4e3['destroy']()['then'](function(){_0x3f976d['status'](0xcc)[_0xd91c('0x1b')]();});}};}function handleEntityNotFound(_0x105097,_0x32c93e){return function(_0x3a16c4){if(!_0x3a16c4){_0x105097[_0xd91c('0x19')](0x194);}return _0x3a16c4;};}function handleError(_0x39ffc2,_0x20e06e){_0x20e06e=_0x20e06e||0x1f4;return function(_0x3a430d){logger[_0xd91c('0x27')](_0x3a430d[_0xd91c('0x28')]);if(_0x3a430d[_0xd91c('0x29')]){delete _0x3a430d['name'];}_0x39ffc2[_0xd91c('0x1a')](_0x20e06e)[_0xd91c('0x2a')](_0x3a430d);};}exports[_0xd91c('0x2b')]=function(_0x40091c,_0x1606cd){var _0x47d829={},_0x1492b7={},_0x4c3284={'count':0x0,'rows':[]};var _0x523582=_['map'](db['AnalyticFieldReport'][_0xd91c('0x2c')],function(_0x100fda){return{'name':_0x100fda['fieldName'],'type':_0x100fda[_0xd91c('0x2d')][_0xd91c('0x2e')]};});_0x1492b7[_0xd91c('0x2f')]=_[_0xd91c('0x30')](_0x523582,'name');_0x1492b7['query']=_[_0xd91c('0x31')](_0x40091c[_0xd91c('0x32')]);_0x1492b7[_0xd91c('0x33')]=_[_0xd91c('0x34')](_0x1492b7[_0xd91c('0x2f')],_0x1492b7[_0xd91c('0x32')]);_0x47d829[_0xd91c('0x35')]=_['intersection'](_0x1492b7['model'],qs[_0xd91c('0x36')](_0x40091c['query'][_0xd91c('0x36')]));_0x47d829[_0xd91c('0x35')]=_0x47d829[_0xd91c('0x35')]['length']?_0x47d829[_0xd91c('0x35')]:_0x1492b7['model'];if(!_0x40091c[_0xd91c('0x32')][_0xd91c('0x37')]('nolimit')){_0x47d829[_0xd91c('0x1f')]=qs[_0xd91c('0x1f')](_0x40091c[_0xd91c('0x32')][_0xd91c('0x1f')]);_0x47d829[_0xd91c('0x1d')]=qs[_0xd91c('0x1d')](_0x40091c[_0xd91c('0x32')][_0xd91c('0x1d')]);}_0x47d829['order']=qs[_0xd91c('0x38')](_0x40091c[_0xd91c('0x32')]['sort']);_0x47d829[_0xd91c('0x39')]=qs[_0xd91c('0x33')](_[_0xd91c('0x3a')](_0x40091c[_0xd91c('0x32')],_0x1492b7[_0xd91c('0x33')]),_0x523582);if(_0x40091c[_0xd91c('0x32')]['filter']){_0x47d829[_0xd91c('0x39')]=_[_0xd91c('0x3b')](_0x47d829[_0xd91c('0x39')],{'$or':_['map'](_0x523582,function(_0x286f1c){if(_0x286f1c['type']!=='VIRTUAL'){var _0x3188b6={};_0x3188b6[_0x286f1c[_0xd91c('0x29')]]={'$like':'%'+_0x40091c['query']['filter']+'%'};return _0x3188b6;}})});}_0x47d829=_['merge']({},_0x47d829,_0x40091c['options']);var _0x15659f={'where':_0x47d829[_0xd91c('0x39')]};return db[_0xd91c('0x3c')]['count'](_0x15659f)[_0xd91c('0x3d')](function(_0x5f01a3){_0x4c3284[_0xd91c('0x20')]=_0x5f01a3;if(_0x40091c[_0xd91c('0x32')][_0xd91c('0x3e')]){_0x47d829[_0xd91c('0x3f')]=[{'all':!![]}];}return db[_0xd91c('0x3c')][_0xd91c('0x40')](_0x47d829);})[_0xd91c('0x3d')](function(_0x1ce662){_0x4c3284['rows']=_0x1ce662;return _0x4c3284;})['then'](respondWithFilteredResult(_0x1606cd,_0x47d829))[_0xd91c('0x41')](handleError(_0x1606cd,null));};exports[_0xd91c('0x42')]=function(_0x1af82c,_0x452811){var _0x5862fb={'raw':![],'where':{'id':_0x1af82c['params']['id']}},_0x4730d8={};_0x4730d8[_0xd91c('0x2f')]=_[_0xd91c('0x31')](db[_0xd91c('0x3c')][_0xd91c('0x2c')]);_0x4730d8[_0xd91c('0x32')]=_['keys'](_0x1af82c['query']);_0x4730d8[_0xd91c('0x33')]=_['intersection'](_0x4730d8[_0xd91c('0x2f')],_0x4730d8[_0xd91c('0x32')]);_0x5862fb['attributes']=_[_0xd91c('0x34')](_0x4730d8[_0xd91c('0x2f')],qs[_0xd91c('0x36')](_0x1af82c[_0xd91c('0x32')][_0xd91c('0x36')]));_0x5862fb[_0xd91c('0x35')]=_0x5862fb[_0xd91c('0x35')][_0xd91c('0x43')]?_0x5862fb[_0xd91c('0x35')]:_0x4730d8[_0xd91c('0x2f')];if(_0x1af82c[_0xd91c('0x32')][_0xd91c('0x3e')]){_0x5862fb[_0xd91c('0x3f')]=[{'all':!![]}];}_0x5862fb=_['merge']({},_0x5862fb,_0x1af82c[_0xd91c('0x44')]);return db['AnalyticFieldReport'][_0xd91c('0x45')](_0x5862fb)['then'](handleEntityNotFound(_0x452811,null))[_0xd91c('0x3d')](respondWithResult(_0x452811,null))['catch'](handleError(_0x452811,null));};exports[_0xd91c('0x46')]=function(_0x2194cf,_0x56ae1){return db[_0xd91c('0x3c')][_0xd91c('0x46')](_0x2194cf[_0xd91c('0x47')],{})[_0xd91c('0x3d')](respondWithResult(_0x56ae1,0xc9))[_0xd91c('0x41')](handleError(_0x56ae1,null));};exports[_0xd91c('0x48')]=function(_0x1dedaf,_0x2f7baa){return db[_0xd91c('0x3c')][_0xd91c('0x48')](_0x1dedaf[_0xd91c('0x47')],{'raw':![],'individualHooks':!![]})[_0xd91c('0x3d')](respondWithResult(_0x2f7baa,0xc9))['catch'](handleError(_0x2f7baa,null));};exports['update']=function(_0x4871db,_0x51daab){if(_0x4871db['body']['id']){delete _0x4871db[_0xd91c('0x47')]['id'];}return db[_0xd91c('0x3c')][_0xd91c('0x45')]({'where':{'id':_0x4871db[_0xd91c('0x49')]['id']}})[_0xd91c('0x3d')](handleEntityNotFound(_0x51daab,null))[_0xd91c('0x3d')](saveUpdates(_0x4871db[_0xd91c('0x47')],null))['then'](respondWithResult(_0x51daab,null))[_0xd91c('0x41')](handleError(_0x51daab,null));};exports[_0xd91c('0x4a')]=function(_0x21c1d9,_0x2ef4a4){return db['AnalyticFieldReport']['find']({'where':{'id':_0x21c1d9[_0xd91c('0x49')]['id']}})[_0xd91c('0x3d')](handleEntityNotFound(_0x2ef4a4,null))[_0xd91c('0x3d')](removeEntity(_0x2ef4a4,null))['catch'](handleError(_0x2ef4a4,null));};exports[_0xd91c('0x4b')]=function(_0x10a734,_0x302211){return db[_0xd91c('0x3c')][_0xd91c('0x4a')]({'where':{'id':_0x10a734[_0xd91c('0x32')][_0xd91c('0x4c')]||[]},'raw':![],'individualHooks':!![]})[_0xd91c('0x3d')](respondWithResult(_0x302211,0xcc))['catch'](handleError(_0x302211,null));};exports[_0xd91c('0x4d')]=function(_0x20b0ed,_0x2a60ed,_0x24518b){return db[_0xd91c('0x4e')]['findOne']({'where':{'id':_0x20b0ed[_0xd91c('0x49')]['id']}})[_0xd91c('0x3d')](handleEntityNotFound(_0x2a60ed,null))[_0xd91c('0x3d')](function(_0x1c5af2){if(_0x1c5af2){return db[_0xd91c('0x4f')][_0xd91c('0x50')](function(_0x1ca515){return db[_0xd91c('0x3c')][_0xd91c('0x4a')]({'where':{'CustomReportId':_0x20b0ed[_0xd91c('0x49')]['id']},'transaction':_0x1ca515})[_0xd91c('0x3d')](function(_0x1db69a){var _0x55a5f6=_[_0xd91c('0x30')](_0x20b0ed[_0xd91c('0x47')],function(_0x476591){delete _0x476591['id'];_0x476591[_0xd91c('0x51')]=_0x20b0ed[_0xd91c('0x49')]['id'];return _0x476591;});return db[_0xd91c('0x3c')][_0xd91c('0x48')](_0x55a5f6,{'transaction':_0x1ca515});});})[_0xd91c('0x3d')](function(){return db['AnalyticFieldReport'][_0xd91c('0x40')]({'where':{'CustomReportId':_0x20b0ed[_0xd91c('0x49')]['id']}});});}})[_0xd91c('0x3d')](respondWithResult(_0x2a60ed,null))[_0xd91c('0x41')](handleError(_0x2a60ed,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 8d659c7..a509dbe 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 _0x8041=['bluebird','rimraf','../../config/environment','./analyticFieldReport.attributes','define','analytics_report_fields','../../config/logger','api'];(function(_0x25d2fb,_0x18a774){var _0x1ded53=function(_0x4c0715){while(--_0x4c0715){_0x25d2fb['push'](_0x25d2fb['shift']());}};_0x1ded53(++_0x18a774);}(_0x8041,0x17e));var _0x1804=function(_0xf99553,_0x52f679){_0xf99553=_0xf99553-0x0;var _0x10a965=_0x8041[_0xf99553];return _0x10a965;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1804('0x0'))(_0x1804('0x1'));var moment=require('moment');var BPromise=require(_0x1804('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1804('0x3'));var config=require(_0x1804('0x4'));var attributes=require(_0x1804('0x5'));module['exports']=function(_0x8bb39a,_0x26c319){return _0x8bb39a[_0x1804('0x6')]('AnalyticFieldReport',attributes,{'tableName':_0x1804('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd204=['exports','define','AnalyticFieldReport','analytics_report_fields','lodash','util','bluebird','rimraf','./analyticFieldReport.attributes'];(function(_0x26996f,_0x295984){var _0x3ab19c=function(_0x2a86d2){while(--_0x2a86d2){_0x26996f['push'](_0x26996f['shift']());}};_0x3ab19c(++_0x295984);}(_0xd204,0x1ea));var _0x4d20=function(_0x1854ef,_0x4fe295){_0x1854ef=_0x1854ef-0x0;var _0x4cbe36=_0xd204[_0x1854ef];return _0x4cbe36;};'use strict';var _=require(_0x4d20('0x0'));var util=require(_0x4d20('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x4d20('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4d20('0x3'));var config=require('../../config/environment');var attributes=require(_0x4d20('0x4'));module[_0x4d20('0x5')]=function(_0x3379bb,_0x265a10){return _0x3379bb[_0x4d20('0x6')](_0x4d20('0x7'),attributes,{'tableName':_0x4d20('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index e645883..4e487a6 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 _0x23fa=['error','code','message','request\x20sent','catch','lodash','moment','bluebird','randomstring','../../mysqldb','rpc','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s'];(function(_0x2beb43,_0x1188d6){var _0x540848=function(_0x126b57){while(--_0x126b57){_0x2beb43['push'](_0x2beb43['shift']());}};_0x540848(++_0x1188d6);}(_0x23fa,0x9e));var _0xa23f=function(_0xc2f834,_0x5e49d8){_0xc2f834=_0xc2f834-0x0;var _0x34668f=_0x23fa[_0xc2f834];return _0x34668f;};'use strict';var _=require(_0xa23f('0x0'));var util=require('util');var moment=require(_0xa23f('0x1'));var BPromise=require(_0xa23f('0x2'));var rs=require(_0xa23f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa23f('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa23f('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5712d8,_0x13ca67,_0x23213d){return new BPromise(function(_0x5b9355,_0x3bac43){return client[_0xa23f('0x6')](_0x5712d8,_0x23213d)[_0xa23f('0x7')](function(_0x2c18d3){logger[_0xa23f('0x8')](_0xa23f('0x9'),_0x13ca67,'request\x20sent');logger[_0xa23f('0xa')](_0xa23f('0xb'),_0x13ca67,'request\x20sent',JSON['stringify'](_0x2c18d3));if(_0x2c18d3[_0xa23f('0xc')]){if(_0x2c18d3[_0xa23f('0xc')][_0xa23f('0xd')]===0x1f4){logger[_0xa23f('0xc')](_0xa23f('0x9'),_0x13ca67,_0x2c18d3[_0xa23f('0xc')][_0xa23f('0xe')]);return _0x3bac43(_0x2c18d3[_0xa23f('0xc')][_0xa23f('0xe')]);}logger[_0xa23f('0xc')](_0xa23f('0x9'),_0x13ca67,_0x2c18d3[_0xa23f('0xc')]['message']);return _0x5b9355(_0x2c18d3['error'][_0xa23f('0xe')]);}else{logger[_0xa23f('0x8')]('AnalyticFieldReport,\x20%s,\x20%s',_0x13ca67,_0xa23f('0xf'));_0x5b9355(_0x2c18d3['result'][_0xa23f('0xe')]);}})[_0xa23f('0x10')](function(_0x22cd15){logger[_0xa23f('0xc')](_0xa23f('0x9'),_0x13ca67,_0x22cd15);_0x3bac43(_0x22cd15);});});} \ No newline at end of file +var _0x35f0=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x35f0,0x80));var _0x035f=function(_0x27183b,_0x4f8348){_0x27183b=_0x27183b-0x0;var _0x5a5f9f=_0x35f0[_0x27183b];return _0x5a5f9f;};'use strict';var _=require(_0x035f('0x0'));var util=require('util');var moment=require(_0x035f('0x1'));var BPromise=require(_0x035f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x035f('0x3'));var db=require(_0x035f('0x4'))['db'];var utils=require(_0x035f('0x5'));var logger=require(_0x035f('0x6'))(_0x035f('0x7'));var config=require('../../config/environment');var jayson=require(_0x035f('0x8'));var client=jayson[_0x035f('0x9')][_0x035f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3320f4,_0x793abe,_0x5b1ec4){return new BPromise(function(_0x4f0890,_0x449b99){return client['request'](_0x3320f4,_0x5b1ec4)['then'](function(_0x4d8e47){logger[_0x035f('0xb')](_0x035f('0xc'),_0x793abe,_0x035f('0xd'));logger[_0x035f('0xe')](_0x035f('0xf'),_0x793abe,'request\x20sent',JSON[_0x035f('0x10')](_0x4d8e47));if(_0x4d8e47['error']){if(_0x4d8e47[_0x035f('0x11')][_0x035f('0x12')]===0x1f4){logger[_0x035f('0x11')](_0x035f('0xc'),_0x793abe,_0x4d8e47['error'][_0x035f('0x13')]);return _0x449b99(_0x4d8e47[_0x035f('0x11')][_0x035f('0x13')]);}logger[_0x035f('0x11')](_0x035f('0xc'),_0x793abe,_0x4d8e47[_0x035f('0x11')][_0x035f('0x13')]);return _0x4f0890(_0x4d8e47[_0x035f('0x11')][_0x035f('0x13')]);}else{logger['info'](_0x035f('0xc'),_0x793abe,'request\x20sent');_0x4f0890(_0x4d8e47[_0x035f('0x14')][_0x035f('0x13')]);}})[_0x035f('0x15')](function(_0x78ede1){logger[_0x035f('0x11')](_0x035f('0xc'),_0x793abe,_0x78ede1);_0x449b99(_0x78ede1);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 1efb529..1791f4d 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(_0xfb0ebf,_0x2efd36){var _0x44639e=function(_0x5839ee){while(--_0x5839ee){_0xfb0ebf['push'](_0xfb0ebf['shift']());}};_0x44639e(++_0x2efd36);}(_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('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(_0x2b3a60,_0x146ec1){var _0xd21365=function(_0x59ad5a){while(--_0x59ad5a){_0x2b3a60['push'](_0x2b3a60['shift']());}};_0xd21365(++_0x146ec1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0a9e('0xb')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xb')](_0x0a9e('0xf'),auth['isAuthenticated'](),controller['addFields']);router['put']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);module[_0x0a9e('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index f14c453..c7fdc8e 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 _0xb458=['name','TEXT','sequelize','exports','STRING'];(function(_0x18f396,_0x174d17){var _0x3ba532=function(_0x2bc92f){while(--_0x2bc92f){_0x18f396['push'](_0x18f396['shift']());}};_0x3ba532(++_0x174d17);}(_0xb458,0xca));var _0x8b45=function(_0x5275e1,_0x11eae6){_0x5275e1=_0x5275e1-0x0;var _0x334a15=_0xb458[_0x5275e1];return _0x334a15;};'use strict';var Sequelize=require(_0x8b45('0x0'));module[_0x8b45('0x1')]={'name':{'type':Sequelize[_0x8b45('0x2')],'allowNull':![],'unique':_0x8b45('0x3')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0x8b45('0x4')]},'description':{'type':Sequelize[_0x8b45('0x2')]}}; \ No newline at end of file +var _0xa74f=['STRING','TEXT'];(function(_0x3d1f60,_0x166b36){var _0x4f68ec=function(_0xd8d6f0){while(--_0xd8d6f0){_0x3d1f60['push'](_0x3d1f60['shift']());}};_0x4f68ec(++_0x166b36);}(_0xa74f,0x9a));var _0xfa74=function(_0x424357,_0x9ebe3e){_0x424357=_0x424357-0x0;var _0x29c68e=_0xa74f[_0x424357];return _0x29c68e;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xfa74('0x0')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0xfa74('0x1')]},'description':{'type':Sequelize[_0xfa74('0x0')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index d08480d..080d1a3 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 _0xd6d6=['includeAll','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Metrics','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','VIRTUAL','options','include','AnalyticMetric','rows','show'];(function(_0x400423,_0x192af9){var _0x337e55=function(_0x397bd2){while(--_0x397bd2){_0x400423['push'](_0x400423['shift']());}};_0x337e55(++_0x192af9);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x44ad88,_0xc510c7){_0x44ad88=_0x44ad88-0x0;var _0x1d42ec=_0xd6d6[_0x44ad88];return _0x1d42ec;};'use strict';var emlformat=require(_0x6d6d('0x0'));var rimraf=require(_0x6d6d('0x1'));var zipdir=require(_0x6d6d('0x2'));var jsonpatch=require(_0x6d6d('0x3'));var rp=require('request-promise');var moment=require(_0x6d6d('0x4'));var BPromise=require(_0x6d6d('0x5'));var Mustache=require(_0x6d6d('0x6'));var util=require(_0x6d6d('0x7'));var path=require(_0x6d6d('0x8'));var sox=require(_0x6d6d('0x9'));var csv=require(_0x6d6d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6d6d('0xb'));var _=require(_0x6d6d('0xc'));var squel=require(_0x6d6d('0xd'));var crypto=require(_0x6d6d('0xe'));var jsforce=require(_0x6d6d('0xf'));var deskjs=require(_0x6d6d('0x10'));var toCsv=require(_0x6d6d('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6d6d('0x11'));var authService=require(_0x6d6d('0x12'));var qs=require(_0x6d6d('0x13'));var as=require(_0x6d6d('0x14'));var hardwareService=require(_0x6d6d('0x15'));var logger=require('../../config/logger')(_0x6d6d('0x16'));var utils=require(_0x6d6d('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6d6d('0x18'))['db'];function respondWithStatusCode(_0x32146d,_0xe61c36){_0xe61c36=_0xe61c36||0xcc;return function(_0x3f8542){if(_0x3f8542){return _0x32146d[_0x6d6d('0x19')](_0xe61c36);}return _0x32146d[_0x6d6d('0x1a')](_0xe61c36)[_0x6d6d('0x1b')]();};}function respondWithResult(_0x2cb2dd,_0x5f4154){_0x5f4154=_0x5f4154||0xc8;return function(_0xd09ea7){if(_0xd09ea7){return _0x2cb2dd[_0x6d6d('0x1a')](_0x5f4154)[_0x6d6d('0x1c')](_0xd09ea7);}};}function respondWithFilteredResult(_0xa3b05d,_0x29cbd8){return function(_0x5d80c0){if(_0x5d80c0){var _0x2e6fdb=typeof _0x29cbd8['offset']===_0x6d6d('0x1d')&&typeof _0x29cbd8[_0x6d6d('0x1e')]===_0x6d6d('0x1d');var _0x4bb3d1=_0x5d80c0['count'];var _0x9e1e18=_0x2e6fdb?0x0:_0x29cbd8[_0x6d6d('0x1f')];var _0x2b59d4=_0x2e6fdb?_0x5d80c0[_0x6d6d('0x20')]:_0x29cbd8['offset']+_0x29cbd8['limit'];var _0x474873;if(_0x2b59d4>=_0x4bb3d1){_0x2b59d4=_0x4bb3d1;_0x474873=0xc8;}else{_0x474873=0xce;}_0xa3b05d['status'](_0x474873);return _0xa3b05d[_0x6d6d('0x21')](_0x6d6d('0x22'),_0x9e1e18+'-'+_0x2b59d4+'/'+_0x4bb3d1)[_0x6d6d('0x1c')](_0x5d80c0);}return null;};}function patchUpdates(_0x450352){return function(_0x40d35b){try{jsonpatch[_0x6d6d('0x23')](_0x40d35b,_0x450352,!![]);}catch(_0x164c67){return BPromise[_0x6d6d('0x24')](_0x164c67);}return _0x40d35b[_0x6d6d('0x25')]();};}function saveUpdates(_0x6f64e3,_0x24b10d){return function(_0x6e58e3){if(_0x6e58e3){return _0x6e58e3[_0x6d6d('0x26')](_0x6f64e3)[_0x6d6d('0x27')](function(_0x1f7f88){return _0x1f7f88;});}return null;};}function removeEntity(_0x25a02e,_0xced622){return function(_0x583b10){if(_0x583b10){return _0x583b10[_0x6d6d('0x28')]()[_0x6d6d('0x27')](function(){var _0x99f7d6=_0x583b10[_0x6d6d('0x29')]({'plain':!![]});var _0xf0df7f=_0x6d6d('0x2a');return db['UserProfileResource'][_0x6d6d('0x28')]({'where':{'type':_0xf0df7f,'resourceId':_0x99f7d6['id']}})[_0x6d6d('0x27')](function(){return _0x583b10;});})[_0x6d6d('0x27')](function(){_0x25a02e[_0x6d6d('0x1a')](0xcc)[_0x6d6d('0x1b')]();});}};}function handleEntityNotFound(_0x408f98,_0x3641fc){return function(_0x4a57a1){if(!_0x4a57a1){_0x408f98[_0x6d6d('0x19')](0x194);}return _0x4a57a1;};}function handleError(_0x9595d8,_0x51bd68){_0x51bd68=_0x51bd68||0x1f4;return function(_0x553645){logger[_0x6d6d('0x2b')](_0x553645[_0x6d6d('0x2c')]);if(_0x553645[_0x6d6d('0x2d')]){delete _0x553645['name'];}_0x9595d8[_0x6d6d('0x1a')](_0x51bd68)[_0x6d6d('0x2e')](_0x553645);};}exports[_0x6d6d('0x2f')]=function(_0x1c8340,_0x64d1f7){var _0x428c17={},_0xdda3f2={},_0x359cfd={'count':0x0,'rows':[]};var _0x6c4741=_[_0x6d6d('0x30')](db['AnalyticMetric'][_0x6d6d('0x31')],function(_0x4f1fc5){return{'name':_0x4f1fc5[_0x6d6d('0x32')],'type':_0x4f1fc5[_0x6d6d('0x33')][_0x6d6d('0x34')]};});_0xdda3f2[_0x6d6d('0x35')]=_['map'](_0x6c4741,_0x6d6d('0x2d'));_0xdda3f2['query']=_[_0x6d6d('0x36')](_0x1c8340[_0x6d6d('0x37')]);_0xdda3f2['filters']=_[_0x6d6d('0x38')](_0xdda3f2[_0x6d6d('0x35')],_0xdda3f2[_0x6d6d('0x37')]);_0x428c17[_0x6d6d('0x39')]=_[_0x6d6d('0x38')](_0xdda3f2[_0x6d6d('0x35')],qs[_0x6d6d('0x3a')](_0x1c8340[_0x6d6d('0x37')][_0x6d6d('0x3a')]));_0x428c17[_0x6d6d('0x39')]=_0x428c17[_0x6d6d('0x39')][_0x6d6d('0x3b')]?_0x428c17[_0x6d6d('0x39')]:_0xdda3f2[_0x6d6d('0x35')];if(!_0x1c8340['query'][_0x6d6d('0x3c')](_0x6d6d('0x3d'))){_0x428c17[_0x6d6d('0x1e')]=qs[_0x6d6d('0x1e')](_0x1c8340['query']['limit']);_0x428c17[_0x6d6d('0x1f')]=qs[_0x6d6d('0x1f')](_0x1c8340[_0x6d6d('0x37')]['offset']);}_0x428c17[_0x6d6d('0x3e')]=qs[_0x6d6d('0x3f')](_0x1c8340[_0x6d6d('0x37')][_0x6d6d('0x3f')]);_0x428c17['where']=qs['filters'](_['pick'](_0x1c8340[_0x6d6d('0x37')],_0xdda3f2[_0x6d6d('0x40')]),_0x6c4741);if(_0x1c8340[_0x6d6d('0x37')][_0x6d6d('0x41')]){_0x428c17['where']=_[_0x6d6d('0x42')](_0x428c17[_0x6d6d('0x43')],{'$or':_[_0x6d6d('0x30')](_0x6c4741,function(_0x3c6d23){if(_0x3c6d23[_0x6d6d('0x33')]!==_0x6d6d('0x44')){var _0x4b457d={};_0x4b457d[_0x3c6d23[_0x6d6d('0x2d')]]={'$like':'%'+_0x1c8340[_0x6d6d('0x37')][_0x6d6d('0x41')]+'%'};return _0x4b457d;}})});}_0x428c17=_[_0x6d6d('0x42')]({},_0x428c17,_0x1c8340[_0x6d6d('0x45')]);var _0x3e27b7={'where':_0x428c17[_0x6d6d('0x43')]};return db['AnalyticMetric'][_0x6d6d('0x20')](_0x3e27b7)[_0x6d6d('0x27')](function(_0x16e177){_0x359cfd[_0x6d6d('0x20')]=_0x16e177;if(_0x1c8340[_0x6d6d('0x37')]['includeAll']){_0x428c17[_0x6d6d('0x46')]=[{'all':!![]}];}return db[_0x6d6d('0x47')]['findAll'](_0x428c17);})[_0x6d6d('0x27')](function(_0x50dc17){_0x359cfd[_0x6d6d('0x48')]=_0x50dc17;return _0x359cfd;})[_0x6d6d('0x27')](respondWithFilteredResult(_0x64d1f7,_0x428c17))['catch'](handleError(_0x64d1f7,null));};exports[_0x6d6d('0x49')]=function(_0x3324ec,_0x252cbe){var _0x4041f3={'raw':!![],'where':{'id':_0x3324ec['params']['id']}},_0xf7ea0d={};_0xf7ea0d['model']=_[_0x6d6d('0x36')](db['AnalyticMetric']['rawAttributes']);_0xf7ea0d[_0x6d6d('0x37')]=_[_0x6d6d('0x36')](_0x3324ec[_0x6d6d('0x37')]);_0xf7ea0d['filters']=_[_0x6d6d('0x38')](_0xf7ea0d['model'],_0xf7ea0d[_0x6d6d('0x37')]);_0x4041f3[_0x6d6d('0x39')]=_[_0x6d6d('0x38')](_0xf7ea0d[_0x6d6d('0x35')],qs[_0x6d6d('0x3a')](_0x3324ec[_0x6d6d('0x37')][_0x6d6d('0x3a')]));_0x4041f3['attributes']=_0x4041f3[_0x6d6d('0x39')][_0x6d6d('0x3b')]?_0x4041f3[_0x6d6d('0x39')]:_0xf7ea0d[_0x6d6d('0x35')];if(_0x3324ec[_0x6d6d('0x37')][_0x6d6d('0x4a')]){_0x4041f3[_0x6d6d('0x46')]=[{'all':!![]}];}_0x4041f3=_[_0x6d6d('0x42')]({},_0x4041f3,_0x3324ec[_0x6d6d('0x45')]);return db['AnalyticMetric']['find'](_0x4041f3)[_0x6d6d('0x27')](handleEntityNotFound(_0x252cbe,null))[_0x6d6d('0x27')](respondWithResult(_0x252cbe,null))[_0x6d6d('0x4b')](handleError(_0x252cbe,null));};exports[_0x6d6d('0x4c')]=function(_0xe2a20e,_0x492834){return db[_0x6d6d('0x47')][_0x6d6d('0x4c')](_0xe2a20e[_0x6d6d('0x4d')],{})[_0x6d6d('0x27')](function(_0x2ee917){var _0x23c2db=_0xe2a20e[_0x6d6d('0x4e')][_0x6d6d('0x29')]({'plain':!![]});if(!_0x23c2db)throw new Error(_0x6d6d('0x4f'));if(_0x23c2db[_0x6d6d('0x50')]===_0x6d6d('0x4e')){var _0x175e26=_0x2ee917['get']({'plain':!![]});var _0x190786=_0x6d6d('0x2a');return db[_0x6d6d('0x51')][_0x6d6d('0x52')]({'where':{'name':_0x190786,'userProfileId':_0x23c2db[_0x6d6d('0x53')]},'raw':!![]})['then'](function(_0x38c307){if(_0x38c307&&_0x38c307[_0x6d6d('0x54')]===0x0){return db[_0x6d6d('0x55')]['create']({'name':_0x175e26['name'],'resourceId':_0x175e26['id'],'type':_0x38c307[_0x6d6d('0x2d')],'sectionId':_0x38c307['id']},{})['then'](function(){return _0x2ee917;});}else{return _0x2ee917;}})[_0x6d6d('0x4b')](function(_0x995fe2){logger[_0x6d6d('0x2b')](_0x6d6d('0x56'),_0x995fe2);throw _0x995fe2;});}return _0x2ee917;})[_0x6d6d('0x27')](respondWithResult(_0x492834,0xc9))[_0x6d6d('0x4b')](handleError(_0x492834,null));};exports[_0x6d6d('0x26')]=function(_0x26c23a,_0x1a8f33){if(_0x26c23a[_0x6d6d('0x4d')]['id']){delete _0x26c23a['body']['id'];}return db[_0x6d6d('0x47')][_0x6d6d('0x52')]({'where':{'id':_0x26c23a[_0x6d6d('0x57')]['id']}})[_0x6d6d('0x27')](handleEntityNotFound(_0x1a8f33,null))[_0x6d6d('0x27')](saveUpdates(_0x26c23a[_0x6d6d('0x4d')],null))[_0x6d6d('0x27')](respondWithResult(_0x1a8f33,null))['catch'](handleError(_0x1a8f33,null));};exports['destroy']=function(_0x3ad9b0,_0x122865){return db['AnalyticMetric'][_0x6d6d('0x52')]({'where':{'id':_0x3ad9b0[_0x6d6d('0x57')]['id']}})[_0x6d6d('0x27')](handleEntityNotFound(_0x122865,null))[_0x6d6d('0x27')](removeEntity(_0x122865,null))[_0x6d6d('0x4b')](handleError(_0x122865,null));}; \ No newline at end of file +var _0xdc97=['mustache','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','update','then','get','destroy','sendStatus','error','stack','name','send','AnalyticMetric','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','length','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','includeAll','findAll','rows','catch','params','keys','fields','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Metrics','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','eml-format','rimraf','zip-dir','request-promise','bluebird'];(function(_0x17259a,_0x44b48f){var _0x1ed9cd=function(_0x1f216a){while(--_0x1f216a){_0x17259a['push'](_0x17259a['shift']());}};_0x1ed9cd(++_0x44b48f);}(_0xdc97,0x13b));var _0x7dc9=function(_0x129b3a,_0x32828f){_0x129b3a=_0x129b3a-0x0;var _0x52ee3c=_0xdc97[_0x129b3a];return _0x52ee3c;};'use strict';var emlformat=require(_0x7dc9('0x0'));var rimraf=require(_0x7dc9('0x1'));var zipdir=require(_0x7dc9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7dc9('0x3'));var moment=require('moment');var BPromise=require(_0x7dc9('0x4'));var Mustache=require(_0x7dc9('0x5'));var util=require('util');var path=require(_0x7dc9('0x6'));var sox=require(_0x7dc9('0x7'));var csv=require(_0x7dc9('0x8'));var ejs=require(_0x7dc9('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7dc9('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7dc9('0xb'));var deskjs=require(_0x7dc9('0xc'));var toCsv=require(_0x7dc9('0x8'));var querystring=require(_0x7dc9('0xd'));var Papa=require(_0x7dc9('0xe'));var Redis=require('ioredis');var authService=require(_0x7dc9('0xf'));var qs=require(_0x7dc9('0x10'));var as=require(_0x7dc9('0x11'));var hardwareService=require(_0x7dc9('0x12'));var logger=require(_0x7dc9('0x13'))(_0x7dc9('0x14'));var utils=require(_0x7dc9('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x599ef1,_0x94c75a){_0x94c75a=_0x94c75a||0xcc;return function(_0x14e5db){if(_0x14e5db){return _0x599ef1['sendStatus'](_0x94c75a);}return _0x599ef1[_0x7dc9('0x16')](_0x94c75a)[_0x7dc9('0x17')]();};}function respondWithResult(_0xaadf2,_0xf37bc7){_0xf37bc7=_0xf37bc7||0xc8;return function(_0x31d43d){if(_0x31d43d){return _0xaadf2[_0x7dc9('0x16')](_0xf37bc7)['json'](_0x31d43d);}};}function respondWithFilteredResult(_0x3a54f2,_0x278191){return function(_0x1b0aa1){if(_0x1b0aa1){var _0x442819=typeof _0x278191[_0x7dc9('0x18')]===_0x7dc9('0x19')&&typeof _0x278191[_0x7dc9('0x1a')]===_0x7dc9('0x19');var _0x4778d5=_0x1b0aa1['count'];var _0x22577e=_0x442819?0x0:_0x278191['offset'];var _0x1f5906=_0x442819?_0x1b0aa1[_0x7dc9('0x1b')]:_0x278191['offset']+_0x278191[_0x7dc9('0x1a')];var _0x3b738a;if(_0x1f5906>=_0x4778d5){_0x1f5906=_0x4778d5;_0x3b738a=0xc8;}else{_0x3b738a=0xce;}_0x3a54f2[_0x7dc9('0x16')](_0x3b738a);return _0x3a54f2[_0x7dc9('0x1c')](_0x7dc9('0x1d'),_0x22577e+'-'+_0x1f5906+'/'+_0x4778d5)[_0x7dc9('0x1e')](_0x1b0aa1);}return null;};}function patchUpdates(_0x2dad65){return function(_0x2895f5){try{jsonpatch[_0x7dc9('0x1f')](_0x2895f5,_0x2dad65,!![]);}catch(_0x2b38d6){return BPromise['reject'](_0x2b38d6);}return _0x2895f5['save']();};}function saveUpdates(_0x12954f,_0x5981e2){return function(_0x596e0f){if(_0x596e0f){return _0x596e0f[_0x7dc9('0x20')](_0x12954f)[_0x7dc9('0x21')](function(_0x5e9525){return _0x5e9525;});}return null;};}function removeEntity(_0xffc080,_0x43d31f){return function(_0x41110a){if(_0x41110a){return _0x41110a['destroy']()[_0x7dc9('0x21')](function(){var _0x1e3a8d=_0x41110a[_0x7dc9('0x22')]({'plain':!![]});var _0x55a482='Metrics';return db['UserProfileResource'][_0x7dc9('0x23')]({'where':{'type':_0x55a482,'resourceId':_0x1e3a8d['id']}})[_0x7dc9('0x21')](function(){return _0x41110a;});})['then'](function(){_0xffc080['status'](0xcc)[_0x7dc9('0x17')]();});}};}function handleEntityNotFound(_0x5afb7d,_0x2d22eb){return function(_0x1c690b){if(!_0x1c690b){_0x5afb7d[_0x7dc9('0x24')](0x194);}return _0x1c690b;};}function handleError(_0x3e4102,_0xa2aaa9){_0xa2aaa9=_0xa2aaa9||0x1f4;return function(_0x450124){logger[_0x7dc9('0x25')](_0x450124[_0x7dc9('0x26')]);if(_0x450124[_0x7dc9('0x27')]){delete _0x450124[_0x7dc9('0x27')];}_0x3e4102[_0x7dc9('0x16')](_0xa2aaa9)[_0x7dc9('0x28')](_0x450124);};}exports['index']=function(_0x4e929c,_0x513dd6){var _0x49a4a5={},_0x4a68f0={},_0x553a03={'count':0x0,'rows':[]};var _0x58c4e8=_['map'](db[_0x7dc9('0x29')][_0x7dc9('0x2a')],function(_0x29dcef){return{'name':_0x29dcef[_0x7dc9('0x2b')],'type':_0x29dcef[_0x7dc9('0x2c')][_0x7dc9('0x2d')]};});_0x4a68f0['model']=_['map'](_0x58c4e8,'name');_0x4a68f0[_0x7dc9('0x2e')]=_['keys'](_0x4e929c[_0x7dc9('0x2e')]);_0x4a68f0[_0x7dc9('0x2f')]=_[_0x7dc9('0x30')](_0x4a68f0[_0x7dc9('0x31')],_0x4a68f0[_0x7dc9('0x2e')]);_0x49a4a5[_0x7dc9('0x32')]=_[_0x7dc9('0x30')](_0x4a68f0[_0x7dc9('0x31')],qs['fields'](_0x4e929c[_0x7dc9('0x2e')]['fields']));_0x49a4a5[_0x7dc9('0x32')]=_0x49a4a5[_0x7dc9('0x32')][_0x7dc9('0x33')]?_0x49a4a5[_0x7dc9('0x32')]:_0x4a68f0['model'];if(!_0x4e929c[_0x7dc9('0x2e')]['hasOwnProperty'](_0x7dc9('0x34'))){_0x49a4a5['limit']=qs['limit'](_0x4e929c[_0x7dc9('0x2e')][_0x7dc9('0x1a')]);_0x49a4a5[_0x7dc9('0x18')]=qs[_0x7dc9('0x18')](_0x4e929c['query'][_0x7dc9('0x18')]);}_0x49a4a5[_0x7dc9('0x35')]=qs[_0x7dc9('0x36')](_0x4e929c[_0x7dc9('0x2e')][_0x7dc9('0x36')]);_0x49a4a5[_0x7dc9('0x37')]=qs[_0x7dc9('0x2f')](_[_0x7dc9('0x38')](_0x4e929c[_0x7dc9('0x2e')],_0x4a68f0[_0x7dc9('0x2f')]),_0x58c4e8);if(_0x4e929c[_0x7dc9('0x2e')][_0x7dc9('0x39')]){_0x49a4a5['where']=_[_0x7dc9('0x3a')](_0x49a4a5[_0x7dc9('0x37')],{'$or':_[_0x7dc9('0x3b')](_0x58c4e8,function(_0xfd2612){if(_0xfd2612['type']!==_0x7dc9('0x3c')){var _0x89db0e={};_0x89db0e[_0xfd2612[_0x7dc9('0x27')]]={'$like':'%'+_0x4e929c[_0x7dc9('0x2e')][_0x7dc9('0x39')]+'%'};return _0x89db0e;}})});}_0x49a4a5=_[_0x7dc9('0x3a')]({},_0x49a4a5,_0x4e929c['options']);var _0x553230={'where':_0x49a4a5[_0x7dc9('0x37')]};return db[_0x7dc9('0x29')]['count'](_0x553230)[_0x7dc9('0x21')](function(_0x4a37ec){_0x553a03[_0x7dc9('0x1b')]=_0x4a37ec;if(_0x4e929c[_0x7dc9('0x2e')][_0x7dc9('0x3d')]){_0x49a4a5['include']=[{'all':!![]}];}return db[_0x7dc9('0x29')][_0x7dc9('0x3e')](_0x49a4a5);})[_0x7dc9('0x21')](function(_0x95513c){_0x553a03[_0x7dc9('0x3f')]=_0x95513c;return _0x553a03;})[_0x7dc9('0x21')](respondWithFilteredResult(_0x513dd6,_0x49a4a5))[_0x7dc9('0x40')](handleError(_0x513dd6,null));};exports['show']=function(_0x187aa6,_0x4f29b2){var _0x52d883={'raw':!![],'where':{'id':_0x187aa6[_0x7dc9('0x41')]['id']}},_0xcced6c={};_0xcced6c[_0x7dc9('0x31')]=_[_0x7dc9('0x42')](db[_0x7dc9('0x29')][_0x7dc9('0x2a')]);_0xcced6c[_0x7dc9('0x2e')]=_[_0x7dc9('0x42')](_0x187aa6[_0x7dc9('0x2e')]);_0xcced6c['filters']=_[_0x7dc9('0x30')](_0xcced6c[_0x7dc9('0x31')],_0xcced6c[_0x7dc9('0x2e')]);_0x52d883[_0x7dc9('0x32')]=_[_0x7dc9('0x30')](_0xcced6c[_0x7dc9('0x31')],qs['fields'](_0x187aa6[_0x7dc9('0x2e')][_0x7dc9('0x43')]));_0x52d883['attributes']=_0x52d883[_0x7dc9('0x32')][_0x7dc9('0x33')]?_0x52d883[_0x7dc9('0x32')]:_0xcced6c['model'];if(_0x187aa6[_0x7dc9('0x2e')]['includeAll']){_0x52d883['include']=[{'all':!![]}];}_0x52d883=_[_0x7dc9('0x3a')]({},_0x52d883,_0x187aa6[_0x7dc9('0x44')]);return db[_0x7dc9('0x29')]['find'](_0x52d883)['then'](handleEntityNotFound(_0x4f29b2,null))[_0x7dc9('0x21')](respondWithResult(_0x4f29b2,null))['catch'](handleError(_0x4f29b2,null));};exports[_0x7dc9('0x45')]=function(_0x4ab558,_0x5e2d59){return db[_0x7dc9('0x29')][_0x7dc9('0x45')](_0x4ab558[_0x7dc9('0x46')],{})[_0x7dc9('0x21')](function(_0x414bf4){var _0x113087=_0x4ab558[_0x7dc9('0x47')][_0x7dc9('0x22')]({'plain':!![]});if(!_0x113087)throw new Error(_0x7dc9('0x48'));if(_0x113087[_0x7dc9('0x49')]===_0x7dc9('0x47')){var _0x13580b=_0x414bf4[_0x7dc9('0x22')]({'plain':!![]});var _0x59be9b=_0x7dc9('0x4a');return db['UserProfileSection']['find']({'where':{'name':_0x59be9b,'userProfileId':_0x113087[_0x7dc9('0x4b')]},'raw':!![]})[_0x7dc9('0x21')](function(_0x40e382){if(_0x40e382&&_0x40e382[_0x7dc9('0x4c')]===0x0){return db[_0x7dc9('0x4d')]['create']({'name':_0x13580b[_0x7dc9('0x27')],'resourceId':_0x13580b['id'],'type':_0x40e382[_0x7dc9('0x27')],'sectionId':_0x40e382['id']},{})[_0x7dc9('0x21')](function(){return _0x414bf4;});}else{return _0x414bf4;}})['catch'](function(_0x341909){logger[_0x7dc9('0x25')](_0x7dc9('0x4e'),_0x341909);throw _0x341909;});}return _0x414bf4;})[_0x7dc9('0x21')](respondWithResult(_0x5e2d59,0xc9))[_0x7dc9('0x40')](handleError(_0x5e2d59,null));};exports[_0x7dc9('0x20')]=function(_0x593132,_0x366b8b){if(_0x593132[_0x7dc9('0x46')]['id']){delete _0x593132[_0x7dc9('0x46')]['id'];}return db[_0x7dc9('0x29')][_0x7dc9('0x4f')]({'where':{'id':_0x593132[_0x7dc9('0x41')]['id']}})[_0x7dc9('0x21')](handleEntityNotFound(_0x366b8b,null))[_0x7dc9('0x21')](saveUpdates(_0x593132[_0x7dc9('0x46')],null))[_0x7dc9('0x21')](respondWithResult(_0x366b8b,null))[_0x7dc9('0x40')](handleError(_0x366b8b,null));};exports[_0x7dc9('0x23')]=function(_0x4fec6e,_0x1767b6){return db[_0x7dc9('0x29')][_0x7dc9('0x4f')]({'where':{'id':_0x4fec6e[_0x7dc9('0x41')]['id']}})[_0x7dc9('0x21')](handleEntityNotFound(_0x1767b6,null))['then'](removeEntity(_0x1767b6,null))[_0x7dc9('0x40')](handleError(_0x1767b6,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index ae25dc6..07013cb 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 _0x71ad=['api','bluebird','request-promise','rimraf','exports','define','AnalyticMetric','analytics_metrics','lodash','util'];(function(_0x118b6e,_0x48b5fc){var _0x33be58=function(_0x56567e){while(--_0x56567e){_0x118b6e['push'](_0x118b6e['shift']());}};_0x33be58(++_0x48b5fc);}(_0x71ad,0xee));var _0xd71a=function(_0x4e95b2,_0x113282){_0x4e95b2=_0x4e95b2-0x0;var _0x8f4beb=_0x71ad[_0x4e95b2];return _0x8f4beb;};'use strict';var _=require(_0xd71a('0x0'));var util=require(_0xd71a('0x1'));var logger=require('../../config/logger')(_0xd71a('0x2'));var moment=require('moment');var BPromise=require(_0xd71a('0x3'));var rp=require(_0xd71a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd71a('0x5'));var config=require('../../config/environment');var attributes=require('./analyticMetric.attributes');module[_0xd71a('0x6')]=function(_0x5ec697,_0x1e0701){return _0x5ec697[_0xd71a('0x7')](_0xd71a('0x8'),attributes,{'tableName':_0xd71a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6869=['rimraf','../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric','lodash','util','../../config/logger','moment','path'];(function(_0x4f310a,_0x2a5f79){var _0x3c7876=function(_0x4fcb41){while(--_0x4fcb41){_0x4f310a['push'](_0x4f310a['shift']());}};_0x3c7876(++_0x2a5f79);}(_0x6869,0xe2));var _0x9686=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x6869[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x9686('0x0'));var util=require(_0x9686('0x1'));var logger=require(_0x9686('0x2'))('api');var moment=require(_0x9686('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9686('0x4'));var rimraf=require(_0x9686('0x5'));var config=require(_0x9686('0x6'));var attributes=require(_0x9686('0x7'));module[_0x9686('0x8')]=function(_0x4a0657,_0x35591e){return _0x4a0657[_0x9686('0x9')](_0x9686('0xa'),attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 0d4ad5c..eab39ad 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 _0x62c1=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','error'];(function(_0x5c2a5d,_0x2caf3e){var _0x14e902=function(_0x17a915){while(--_0x17a915){_0x5c2a5d['push'](_0x5c2a5d['shift']());}};_0x14e902(++_0x2caf3e);}(_0x62c1,0x190));var _0x162c=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x62c1[_0x465028];return _0xb783d4;};'use strict';var _=require(_0x162c('0x0'));var util=require(_0x162c('0x1'));var moment=require(_0x162c('0x2'));var BPromise=require(_0x162c('0x3'));var rs=require(_0x162c('0x4'));var fs=require('fs');var Redis=require(_0x162c('0x5'));var db=require(_0x162c('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x162c('0x7'));var jayson=require(_0x162c('0x8'));var client=jayson[_0x162c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x238800,_0x48016f,_0x19e1ae){return new BPromise(function(_0x17dfe3,_0x33f3b6){return client[_0x162c('0xa')](_0x238800,_0x19e1ae)[_0x162c('0xb')](function(_0x3fbcd1){logger[_0x162c('0xc')](_0x162c('0xd'),_0x48016f,_0x162c('0xe'));logger[_0x162c('0xf')](_0x162c('0x10'),_0x48016f,_0x162c('0xe'),JSON['stringify'](_0x3fbcd1));if(_0x3fbcd1[_0x162c('0x11')]){if(_0x3fbcd1[_0x162c('0x11')][_0x162c('0x12')]===0x1f4){logger[_0x162c('0x11')]('AnalyticMetric,\x20%s,\x20%s',_0x48016f,_0x3fbcd1[_0x162c('0x11')][_0x162c('0x13')]);return _0x33f3b6(_0x3fbcd1[_0x162c('0x11')][_0x162c('0x13')]);}logger[_0x162c('0x11')](_0x162c('0xd'),_0x48016f,_0x3fbcd1[_0x162c('0x11')]['message']);return _0x17dfe3(_0x3fbcd1['error'][_0x162c('0x13')]);}else{logger[_0x162c('0xc')](_0x162c('0xd'),_0x48016f,_0x162c('0xe'));_0x17dfe3(_0x3fbcd1[_0x162c('0x14')][_0x162c('0x13')]);}})[_0x162c('0x15')](function(_0x268312){logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x48016f,_0x268312);_0x33f3b6(_0x268312);});});} \ No newline at end of file +var _0x9c50=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment'];(function(_0x12b207,_0x3d4861){var _0x217e94=function(_0x4873f1){while(--_0x4873f1){_0x12b207['push'](_0x12b207['shift']());}};_0x217e94(++_0x3d4861);}(_0x9c50,0x67));var _0x09c5=function(_0x4156eb,_0x17ec35){_0x4156eb=_0x4156eb-0x0;var _0x4e6c64=_0x9c50[_0x4156eb];return _0x4e6c64;};'use strict';var _=require('lodash');var util=require(_0x09c5('0x0'));var moment=require(_0x09c5('0x1'));var BPromise=require(_0x09c5('0x2'));var rs=require(_0x09c5('0x3'));var fs=require('fs');var Redis=require(_0x09c5('0x4'));var db=require(_0x09c5('0x5'))['db'];var utils=require(_0x09c5('0x6'));var logger=require(_0x09c5('0x7'))(_0x09c5('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x09c5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1e211e,_0x4d1f00,_0x264bbb){return new BPromise(function(_0x18f886,_0x3286b7){return client[_0x09c5('0xa')](_0x1e211e,_0x264bbb)['then'](function(_0x4fdf97){logger[_0x09c5('0xb')](_0x09c5('0xc'),_0x4d1f00,_0x09c5('0xd'));logger[_0x09c5('0xe')](_0x09c5('0xf'),_0x4d1f00,_0x09c5('0xd'),JSON['stringify'](_0x4fdf97));if(_0x4fdf97[_0x09c5('0x10')]){if(_0x4fdf97[_0x09c5('0x10')][_0x09c5('0x11')]===0x1f4){logger[_0x09c5('0x10')](_0x09c5('0xc'),_0x4d1f00,_0x4fdf97[_0x09c5('0x10')][_0x09c5('0x12')]);return _0x3286b7(_0x4fdf97[_0x09c5('0x10')][_0x09c5('0x12')]);}logger[_0x09c5('0x10')](_0x09c5('0xc'),_0x4d1f00,_0x4fdf97['error'][_0x09c5('0x12')]);return _0x18f886(_0x4fdf97['error']['message']);}else{logger['info'](_0x09c5('0xc'),_0x4d1f00,_0x09c5('0xd'));_0x18f886(_0x4fdf97[_0x09c5('0x13')][_0x09c5('0x12')]);}})[_0x09c5('0x14')](function(_0x1fa006){logger['error'](_0x09c5('0xc'),_0x4d1f00,_0x1fa006);_0x3286b7(_0x1fa006);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index cb596a6..4620235 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 _0x2e8a=['update','delete','/:id','exports','util','path','express','Router','../../components/auth/service','isAuthenticated','index','get','show','post','put'];(function(_0x4364f6,_0x1d165b){var _0x5a37ab=function(_0x9feb8c){while(--_0x9feb8c){_0x4364f6['push'](_0x4364f6['shift']());}};_0x5a37ab(++_0x1d165b);}(_0x2e8a,0xc7));var _0xa2e8=function(_0x8f7d2b,_0x1bebaf){_0x8f7d2b=_0x8f7d2b-0x0;var _0x13c298=_0x2e8a[_0x8f7d2b];return _0x13c298;};'use strict';var multer=require('multer');var util=require(_0xa2e8('0x0'));var path=require(_0xa2e8('0x1'));var timeout=require('connect-timeout');var express=require(_0xa2e8('0x2'));var router=express[_0xa2e8('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa2e8('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./analyticMetric.controller');router['get']('/',auth[_0xa2e8('0x5')](),controller[_0xa2e8('0x6')]);router[_0xa2e8('0x7')]('/:id',auth[_0xa2e8('0x5')](),controller[_0xa2e8('0x8')]);router[_0xa2e8('0x9')]('/',auth[_0xa2e8('0x5')](),controller['create']);router[_0xa2e8('0xa')]('/:id',auth[_0xa2e8('0x5')](),controller[_0xa2e8('0xb')]);router[_0xa2e8('0xc')](_0xa2e8('0xd'),auth[_0xa2e8('0x5')](),controller['destroy']);module[_0xa2e8('0xe')]=router; \ No newline at end of file +var _0x5395=['index','/:id','post','create','put','destroy','multer','path','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated'];(function(_0x7457fe,_0x564a5e){var _0x57a6e4=function(_0x566577){while(--_0x566577){_0x7457fe['push'](_0x7457fe['shift']());}};_0x57a6e4(++_0x564a5e);}(_0x5395,0x150));var _0x5539=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x5395[_0x8c43de];return _0xa6591b;};'use strict';var multer=require(_0x5539('0x0'));var util=require('util');var path=require(_0x5539('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5539('0x2')]();var fs_extra=require(_0x5539('0x3'));var auth=require(_0x5539('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5539('0x5'));var controller=require(_0x5539('0x6'));router[_0x5539('0x7')]('/',auth[_0x5539('0x8')](),controller[_0x5539('0x9')]);router[_0x5539('0x7')](_0x5539('0xa'),auth[_0x5539('0x8')](),controller['show']);router[_0x5539('0xb')]('/',auth[_0x5539('0x8')](),controller[_0x5539('0xc')]);router[_0x5539('0xd')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x5539('0xa'),auth['isAuthenticated'](),controller[_0x5539('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index b999686..866825c 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 _0x944b=['exports','sequelize'];(function(_0x3825a8,_0x2ce1a2){var _0xabc9bc=function(_0x101073){while(--_0x101073){_0x3825a8['push'](_0x3825a8['shift']());}};_0xabc9bc(++_0x2ce1a2);}(_0x944b,0xc3));var _0xb944=function(_0x1c2d8b,_0x5d091b){_0x1c2d8b=_0x1c2d8b-0x0;var _0xb90fca=_0x944b[_0x1c2d8b];return _0xb90fca;};'use strict';var Sequelize=require(_0xb944('0x0'));module[_0xb944('0x1')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file +var _0xa690=['sequelize','TEXT'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xa690,0xc4));var _0x0a69=function(_0x3c858f,_0x235201){_0x3c858f=_0x3c858f-0x0;var _0x198090=_0xa690[_0x3c858f];return _0x198090;};'use strict';var Sequelize=require(_0x0a69('0x0'));module['exports']={'tree':{'type':Sequelize[_0x0a69('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index aefd773..cc54aad 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 _0x433c=['hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','params','options','find','catch','create','body','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','name','send','index','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields'];(function(_0x401128,_0x285722){var _0x2890e8=function(_0xb9b465){while(--_0xb9b465){_0x401128['push'](_0x401128['shift']());}};_0x2890e8(++_0x285722);}(_0x433c,0x1cf));var _0xc433=function(_0x213ed5,_0x26712a){_0x213ed5=_0x213ed5-0x0;var _0x191514=_0x433c[_0x213ed5];return _0x191514;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc433('0x0'));var zipdir=require(_0xc433('0x1'));var jsonpatch=require(_0xc433('0x2'));var rp=require('request-promise');var moment=require(_0xc433('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc433('0x4'));var util=require(_0xc433('0x5'));var path=require('path');var sox=require(_0xc433('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc433('0x7'));var _=require('lodash');var squel=require(_0xc433('0x8'));var crypto=require(_0xc433('0x9'));var jsforce=require(_0xc433('0xa'));var deskjs=require(_0xc433('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc433('0xc'));var Redis=require(_0xc433('0xd'));var authService=require(_0xc433('0xe'));var qs=require(_0xc433('0xf'));var as=require(_0xc433('0x10'));var hardwareService=require(_0xc433('0x11'));var logger=require(_0xc433('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xc433('0x13'));var licenseUtil=require(_0xc433('0x14'));var db=require(_0xc433('0x15'))['db'];function respondWithStatusCode(_0x43b490,_0x2b9383){_0x2b9383=_0x2b9383||0xcc;return function(_0x39e487){if(_0x39e487){return _0x43b490[_0xc433('0x16')](_0x2b9383);}return _0x43b490[_0xc433('0x17')](_0x2b9383)[_0xc433('0x18')]();};}function respondWithResult(_0x15ca54,_0x214cea){_0x214cea=_0x214cea||0xc8;return function(_0x2f9b6c){if(_0x2f9b6c){return _0x15ca54['status'](_0x214cea)[_0xc433('0x19')](_0x2f9b6c);}};}function respondWithFilteredResult(_0x34a77e,_0x335e40){return function(_0x7b70a7){if(_0x7b70a7){var _0x233c5f=typeof _0x335e40['offset']===_0xc433('0x1a')&&typeof _0x335e40['limit']===_0xc433('0x1a');var _0x42af0f=_0x7b70a7[_0xc433('0x1b')];var _0x244176=_0x233c5f?0x0:_0x335e40[_0xc433('0x1c')];var _0x18f85d=_0x233c5f?_0x7b70a7[_0xc433('0x1b')]:_0x335e40[_0xc433('0x1c')]+_0x335e40[_0xc433('0x1d')];var _0x13cca6;if(_0x18f85d>=_0x42af0f){_0x18f85d=_0x42af0f;_0x13cca6=0xc8;}else{_0x13cca6=0xce;}_0x34a77e['status'](_0x13cca6);return _0x34a77e[_0xc433('0x1e')](_0xc433('0x1f'),_0x244176+'-'+_0x18f85d+'/'+_0x42af0f)[_0xc433('0x19')](_0x7b70a7);}return null;};}function patchUpdates(_0x76ccd0){return function(_0x5e18ad){try{jsonpatch[_0xc433('0x20')](_0x5e18ad,_0x76ccd0,!![]);}catch(_0x30cb56){return BPromise[_0xc433('0x21')](_0x30cb56);}return _0x5e18ad[_0xc433('0x22')]();};}function saveUpdates(_0x4ee802,_0xe5b524){return function(_0x280706){if(_0x280706){return _0x280706[_0xc433('0x23')](_0x4ee802)['then'](function(_0x32d2c7){return _0x32d2c7;});}return null;};}function removeEntity(_0x47d852,_0x443b32){return function(_0x31a974){if(_0x31a974){return _0x31a974[_0xc433('0x24')]()[_0xc433('0x25')](function(){_0x47d852[_0xc433('0x17')](0xcc)[_0xc433('0x18')]();});}};}function handleEntityNotFound(_0x4fc646,_0x7e67bd){return function(_0x388a12){if(!_0x388a12){_0x4fc646[_0xc433('0x16')](0x194);}return _0x388a12;};}function handleError(_0x307157,_0x368241){_0x368241=_0x368241||0x1f4;return function(_0x51fc36){logger[_0xc433('0x26')](_0x51fc36['stack']);if(_0x51fc36[_0xc433('0x27')]){delete _0x51fc36['name'];}_0x307157['status'](_0x368241)[_0xc433('0x28')](_0x51fc36);};}exports[_0xc433('0x29')]=function(_0x400fa7,_0x4d3826){var _0x6d7ed={},_0x53f9d9={},_0x52aca0={'count':0x0,'rows':[]};var _0x24c960=_['map'](db[_0xc433('0x2a')][_0xc433('0x2b')],function(_0x119efd){return{'name':_0x119efd[_0xc433('0x2c')],'type':_0x119efd[_0xc433('0x2d')][_0xc433('0x2e')]};});_0x53f9d9[_0xc433('0x2f')]=_[_0xc433('0x30')](_0x24c960,'name');_0x53f9d9['query']=_[_0xc433('0x31')](_0x400fa7[_0xc433('0x32')]);_0x53f9d9[_0xc433('0x33')]=_[_0xc433('0x34')](_0x53f9d9[_0xc433('0x2f')],_0x53f9d9['query']);_0x6d7ed[_0xc433('0x35')]=_[_0xc433('0x34')](_0x53f9d9[_0xc433('0x2f')],qs[_0xc433('0x36')](_0x400fa7[_0xc433('0x32')][_0xc433('0x36')]));_0x6d7ed[_0xc433('0x35')]=_0x6d7ed['attributes']['length']?_0x6d7ed[_0xc433('0x35')]:_0x53f9d9[_0xc433('0x2f')];if(!_0x400fa7[_0xc433('0x32')][_0xc433('0x37')](_0xc433('0x38'))){_0x6d7ed['limit']=qs[_0xc433('0x1d')](_0x400fa7['query']['limit']);_0x6d7ed[_0xc433('0x1c')]=qs['offset'](_0x400fa7[_0xc433('0x32')]['offset']);}_0x6d7ed[_0xc433('0x39')]=qs[_0xc433('0x3a')](_0x400fa7[_0xc433('0x32')][_0xc433('0x3a')]);_0x6d7ed[_0xc433('0x3b')]=qs[_0xc433('0x33')](_[_0xc433('0x3c')](_0x400fa7[_0xc433('0x32')],_0x53f9d9['filters']),_0x24c960);if(_0x400fa7[_0xc433('0x32')][_0xc433('0x3d')]){_0x6d7ed[_0xc433('0x3b')]=_[_0xc433('0x3e')](_0x6d7ed[_0xc433('0x3b')],{'$or':_[_0xc433('0x30')](_0x24c960,function(_0x2d8ef9){if(_0x2d8ef9['type']!==_0xc433('0x3f')){var _0x532665={};_0x532665[_0x2d8ef9[_0xc433('0x27')]]={'$like':'%'+_0x400fa7[_0xc433('0x32')][_0xc433('0x3d')]+'%'};return _0x532665;}})});}_0x6d7ed=_[_0xc433('0x3e')]({},_0x6d7ed,_0x400fa7['options']);var _0x2e2d31={'where':_0x6d7ed[_0xc433('0x3b')]};return db[_0xc433('0x2a')][_0xc433('0x1b')](_0x2e2d31)[_0xc433('0x25')](function(_0x298d3a){_0x52aca0[_0xc433('0x1b')]=_0x298d3a;if(_0x400fa7[_0xc433('0x32')][_0xc433('0x40')]){_0x6d7ed[_0xc433('0x41')]=[{'all':!![]}];}return db[_0xc433('0x2a')][_0xc433('0x42')](_0x6d7ed);})[_0xc433('0x25')](function(_0x22c4c6){_0x52aca0[_0xc433('0x43')]=_0x22c4c6;return _0x52aca0;})[_0xc433('0x25')](respondWithFilteredResult(_0x4d3826,_0x6d7ed))['catch'](handleError(_0x4d3826,null));};exports['show']=function(_0x188301,_0x115429){var _0x341b48={'raw':!![],'where':{'id':_0x188301[_0xc433('0x44')]['id']}},_0x20264c={};_0x20264c['model']=_['keys'](db['AnalyticTreeReport'][_0xc433('0x2b')]);_0x20264c[_0xc433('0x32')]=_[_0xc433('0x31')](_0x188301[_0xc433('0x32')]);_0x20264c[_0xc433('0x33')]=_[_0xc433('0x34')](_0x20264c[_0xc433('0x2f')],_0x20264c['query']);_0x341b48[_0xc433('0x35')]=_[_0xc433('0x34')](_0x20264c[_0xc433('0x2f')],qs[_0xc433('0x36')](_0x188301['query'][_0xc433('0x36')]));_0x341b48['attributes']=_0x341b48[_0xc433('0x35')]['length']?_0x341b48[_0xc433('0x35')]:_0x20264c[_0xc433('0x2f')];if(_0x188301[_0xc433('0x32')]['includeAll']){_0x341b48['include']=[{'all':!![]}];}_0x341b48=_[_0xc433('0x3e')]({},_0x341b48,_0x188301[_0xc433('0x45')]);return db[_0xc433('0x2a')][_0xc433('0x46')](_0x341b48)[_0xc433('0x25')](handleEntityNotFound(_0x115429,null))['then'](respondWithResult(_0x115429,null))[_0xc433('0x47')](handleError(_0x115429,null));};exports[_0xc433('0x48')]=function(_0x4aec44,_0x477df9){return db[_0xc433('0x2a')]['create'](_0x4aec44[_0xc433('0x49')],{})[_0xc433('0x25')](respondWithResult(_0x477df9,0xc9))[_0xc433('0x47')](handleError(_0x477df9,null));};exports[_0xc433('0x23')]=function(_0x108e7d,_0x1335ed){if(_0x108e7d[_0xc433('0x49')]['id']){delete _0x108e7d[_0xc433('0x49')]['id'];}return db['AnalyticTreeReport'][_0xc433('0x46')]({'where':{'id':_0x108e7d[_0xc433('0x44')]['id']}})[_0xc433('0x25')](handleEntityNotFound(_0x1335ed,null))['then'](saveUpdates(_0x108e7d['body'],null))[_0xc433('0x25')](respondWithResult(_0x1335ed,null))[_0xc433('0x47')](handleError(_0x1335ed,null));};exports[_0xc433('0x24')]=function(_0x1cefb2,_0x468173){return db[_0xc433('0x2a')][_0xc433('0x46')]({'where':{'id':_0x1cefb2['params']['id']}})['then'](handleEntityNotFound(_0x468173,null))[_0xc433('0x25')](removeEntity(_0x468173,null))[_0xc433('0x47')](handleError(_0x468173,null));}; \ No newline at end of file +var _0xa6dc=['params','length','options','find','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','util','path','sox','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','type','VIRTUAL','filter','includeAll','include','findAll','show'];(function(_0x4f5eb1,_0x3ababf){var _0x14bcb1=function(_0x105091){while(--_0x105091){_0x4f5eb1['push'](_0x4f5eb1['shift']());}};_0x14bcb1(++_0x3ababf);}(_0xa6dc,0x11e));var _0xca6d=function(_0x371bd7,_0x27a8c7){_0x371bd7=_0x371bd7-0x0;var _0x54b744=_0xa6dc[_0x371bd7];return _0x54b744;};'use strict';var emlformat=require(_0xca6d('0x0'));var rimraf=require(_0xca6d('0x1'));var zipdir=require(_0xca6d('0x2'));var jsonpatch=require(_0xca6d('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xca6d('0x4'));var path=require(_0xca6d('0x5'));var sox=require(_0xca6d('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xca6d('0x7'));var _=require(_0xca6d('0x8'));var squel=require('squel');var crypto=require(_0xca6d('0x9'));var jsforce=require(_0xca6d('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xca6d('0xb'));var querystring=require(_0xca6d('0xc'));var Papa=require(_0xca6d('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xca6d('0xe'));var as=require(_0xca6d('0xf'));var hardwareService=require(_0xca6d('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0xca6d('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xca6d('0x12'));var db=require(_0xca6d('0x13'))['db'];function respondWithStatusCode(_0x314b98,_0x2224ca){_0x2224ca=_0x2224ca||0xcc;return function(_0x41c433){if(_0x41c433){return _0x314b98[_0xca6d('0x14')](_0x2224ca);}return _0x314b98['status'](_0x2224ca)[_0xca6d('0x15')]();};}function respondWithResult(_0x3b2063,_0x2f9bf5){_0x2f9bf5=_0x2f9bf5||0xc8;return function(_0x298df0){if(_0x298df0){return _0x3b2063[_0xca6d('0x16')](_0x2f9bf5)[_0xca6d('0x17')](_0x298df0);}};}function respondWithFilteredResult(_0x533f72,_0x5464ab){return function(_0x3baab7){if(_0x3baab7){var _0x16f54a=typeof _0x5464ab[_0xca6d('0x18')]==='undefined'&&typeof _0x5464ab[_0xca6d('0x19')]===_0xca6d('0x1a');var _0x172de0=_0x3baab7['count'];var _0x540422=_0x16f54a?0x0:_0x5464ab[_0xca6d('0x18')];var _0x35b91f=_0x16f54a?_0x3baab7[_0xca6d('0x1b')]:_0x5464ab[_0xca6d('0x18')]+_0x5464ab[_0xca6d('0x19')];var _0x1e9aeb;if(_0x35b91f>=_0x172de0){_0x35b91f=_0x172de0;_0x1e9aeb=0xc8;}else{_0x1e9aeb=0xce;}_0x533f72[_0xca6d('0x16')](_0x1e9aeb);return _0x533f72['set'](_0xca6d('0x1c'),_0x540422+'-'+_0x35b91f+'/'+_0x172de0)[_0xca6d('0x17')](_0x3baab7);}return null;};}function patchUpdates(_0x1b0f7e){return function(_0x32cf01){try{jsonpatch[_0xca6d('0x1d')](_0x32cf01,_0x1b0f7e,!![]);}catch(_0x1f7c08){return BPromise[_0xca6d('0x1e')](_0x1f7c08);}return _0x32cf01[_0xca6d('0x1f')]();};}function saveUpdates(_0x485280,_0x1ecabc){return function(_0x5bdf90){if(_0x5bdf90){return _0x5bdf90[_0xca6d('0x20')](_0x485280)[_0xca6d('0x21')](function(_0x2e0577){return _0x2e0577;});}return null;};}function removeEntity(_0x15c980,_0xb199de){return function(_0x163f31){if(_0x163f31){return _0x163f31['destroy']()[_0xca6d('0x21')](function(){_0x15c980[_0xca6d('0x16')](0xcc)[_0xca6d('0x15')]();});}};}function handleEntityNotFound(_0x499aa7,_0x5acb38){return function(_0x4d1be7){if(!_0x4d1be7){_0x499aa7[_0xca6d('0x14')](0x194);}return _0x4d1be7;};}function handleError(_0x1b6f66,_0x3b91b0){_0x3b91b0=_0x3b91b0||0x1f4;return function(_0x4cda46){logger[_0xca6d('0x22')](_0x4cda46[_0xca6d('0x23')]);if(_0x4cda46[_0xca6d('0x24')]){delete _0x4cda46['name'];}_0x1b6f66[_0xca6d('0x16')](_0x3b91b0)[_0xca6d('0x25')](_0x4cda46);};}exports[_0xca6d('0x26')]=function(_0x506689,_0x225c9d){var _0x24265c={},_0x1a3f09={},_0x3ef101={'count':0x0,'rows':[]};var _0x5d0391=_[_0xca6d('0x27')](db[_0xca6d('0x28')][_0xca6d('0x29')],function(_0x3fef4f){return{'name':_0x3fef4f[_0xca6d('0x2a')],'type':_0x3fef4f['type'][_0xca6d('0x2b')]};});_0x1a3f09[_0xca6d('0x2c')]=_[_0xca6d('0x27')](_0x5d0391,'name');_0x1a3f09[_0xca6d('0x2d')]=_[_0xca6d('0x2e')](_0x506689['query']);_0x1a3f09[_0xca6d('0x2f')]=_[_0xca6d('0x30')](_0x1a3f09[_0xca6d('0x2c')],_0x1a3f09['query']);_0x24265c[_0xca6d('0x31')]=_[_0xca6d('0x30')](_0x1a3f09[_0xca6d('0x2c')],qs[_0xca6d('0x32')](_0x506689[_0xca6d('0x2d')][_0xca6d('0x32')]));_0x24265c[_0xca6d('0x31')]=_0x24265c[_0xca6d('0x31')]['length']?_0x24265c['attributes']:_0x1a3f09[_0xca6d('0x2c')];if(!_0x506689['query'][_0xca6d('0x33')]('nolimit')){_0x24265c['limit']=qs[_0xca6d('0x19')](_0x506689['query'][_0xca6d('0x19')]);_0x24265c[_0xca6d('0x18')]=qs['offset'](_0x506689[_0xca6d('0x2d')][_0xca6d('0x18')]);}_0x24265c[_0xca6d('0x34')]=qs['sort'](_0x506689[_0xca6d('0x2d')][_0xca6d('0x35')]);_0x24265c[_0xca6d('0x36')]=qs[_0xca6d('0x2f')](_[_0xca6d('0x37')](_0x506689[_0xca6d('0x2d')],_0x1a3f09[_0xca6d('0x2f')]),_0x5d0391);if(_0x506689['query']['filter']){_0x24265c['where']=_[_0xca6d('0x38')](_0x24265c[_0xca6d('0x36')],{'$or':_[_0xca6d('0x27')](_0x5d0391,function(_0x4b447b){if(_0x4b447b[_0xca6d('0x39')]!==_0xca6d('0x3a')){var _0x54208b={};_0x54208b[_0x4b447b[_0xca6d('0x24')]]={'$like':'%'+_0x506689[_0xca6d('0x2d')][_0xca6d('0x3b')]+'%'};return _0x54208b;}})});}_0x24265c=_[_0xca6d('0x38')]({},_0x24265c,_0x506689['options']);var _0x22e335={'where':_0x24265c[_0xca6d('0x36')]};return db[_0xca6d('0x28')]['count'](_0x22e335)['then'](function(_0x12ab55){_0x3ef101['count']=_0x12ab55;if(_0x506689[_0xca6d('0x2d')][_0xca6d('0x3c')]){_0x24265c[_0xca6d('0x3d')]=[{'all':!![]}];}return db[_0xca6d('0x28')][_0xca6d('0x3e')](_0x24265c);})['then'](function(_0x50028a){_0x3ef101['rows']=_0x50028a;return _0x3ef101;})[_0xca6d('0x21')](respondWithFilteredResult(_0x225c9d,_0x24265c))['catch'](handleError(_0x225c9d,null));};exports[_0xca6d('0x3f')]=function(_0x1c888c,_0x23eb75){var _0x5eddf3={'raw':!![],'where':{'id':_0x1c888c[_0xca6d('0x40')]['id']}},_0x192f24={};_0x192f24['model']=_[_0xca6d('0x2e')](db[_0xca6d('0x28')][_0xca6d('0x29')]);_0x192f24[_0xca6d('0x2d')]=_[_0xca6d('0x2e')](_0x1c888c[_0xca6d('0x2d')]);_0x192f24[_0xca6d('0x2f')]=_[_0xca6d('0x30')](_0x192f24[_0xca6d('0x2c')],_0x192f24['query']);_0x5eddf3[_0xca6d('0x31')]=_['intersection'](_0x192f24[_0xca6d('0x2c')],qs[_0xca6d('0x32')](_0x1c888c['query'][_0xca6d('0x32')]));_0x5eddf3[_0xca6d('0x31')]=_0x5eddf3['attributes'][_0xca6d('0x41')]?_0x5eddf3[_0xca6d('0x31')]:_0x192f24[_0xca6d('0x2c')];if(_0x1c888c[_0xca6d('0x2d')][_0xca6d('0x3c')]){_0x5eddf3['include']=[{'all':!![]}];}_0x5eddf3=_['merge']({},_0x5eddf3,_0x1c888c[_0xca6d('0x42')]);return db[_0xca6d('0x28')][_0xca6d('0x43')](_0x5eddf3)['then'](handleEntityNotFound(_0x23eb75,null))[_0xca6d('0x21')](respondWithResult(_0x23eb75,null))['catch'](handleError(_0x23eb75,null));};exports['create']=function(_0x4eba59,_0x41e0d9){return db[_0xca6d('0x28')]['create'](_0x4eba59[_0xca6d('0x44')],{})['then'](respondWithResult(_0x41e0d9,0xc9))['catch'](handleError(_0x41e0d9,null));};exports[_0xca6d('0x20')]=function(_0x2df1eb,_0x34cf4b){if(_0x2df1eb[_0xca6d('0x44')]['id']){delete _0x2df1eb[_0xca6d('0x44')]['id'];}return db[_0xca6d('0x28')]['find']({'where':{'id':_0x2df1eb[_0xca6d('0x40')]['id']}})['then'](handleEntityNotFound(_0x34cf4b,null))[_0xca6d('0x21')](saveUpdates(_0x2df1eb[_0xca6d('0x44')],null))[_0xca6d('0x21')](respondWithResult(_0x34cf4b,null))[_0xca6d('0x45')](handleError(_0x34cf4b,null));};exports['destroy']=function(_0x4656a5,_0xc4658){return db['AnalyticTreeReport'][_0xca6d('0x43')]({'where':{'id':_0x4656a5[_0xca6d('0x40')]['id']}})[_0xca6d('0x21')](handleEntityNotFound(_0xc4658,null))[_0xca6d('0x21')](removeEntity(_0xc4658,null))[_0xca6d('0x45')](handleError(_0xc4658,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 30ad489..59601ba 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 _0xec9d=['../../config/environment','./analyticTreeReport.attributes','exports','AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x194f13,_0x39e6b3){var _0x31efc4=function(_0x29b124){while(--_0x29b124){_0x194f13['push'](_0x194f13['shift']());}};_0x31efc4(++_0x39e6b3);}(_0xec9d,0x155));var _0xdec9=function(_0x14e6de,_0x293358){_0x14e6de=_0x14e6de-0x0;var _0xc157fc=_0xec9d[_0x14e6de];return _0xc157fc;};'use strict';var _=require(_0xdec9('0x0'));var util=require(_0xdec9('0x1'));var logger=require(_0xdec9('0x2'))(_0xdec9('0x3'));var moment=require(_0xdec9('0x4'));var BPromise=require(_0xdec9('0x5'));var rp=require(_0xdec9('0x6'));var fs=require('fs');var path=require(_0xdec9('0x7'));var rimraf=require(_0xdec9('0x8'));var config=require(_0xdec9('0x9'));var attributes=require(_0xdec9('0xa'));module[_0xdec9('0xb')]=function(_0x168578,_0xf0577e){return _0x168578['define'](_0xdec9('0xc'),attributes,{'tableName':_0xdec9('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb586=['define','AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports'];(function(_0x42cca6,_0x5b96e0){var _0x1c4d12=function(_0xf0f7ba){while(--_0xf0f7ba){_0x42cca6['push'](_0x42cca6['shift']());}};_0x1c4d12(++_0x5b96e0);}(_0xb586,0x8a));var _0x6b58=function(_0x5bf420,_0x2d068d){_0x5bf420=_0x5bf420-0x0;var _0x1c5255=_0xb586[_0x5bf420];return _0x1c5255;};'use strict';var _=require(_0x6b58('0x0'));var util=require(_0x6b58('0x1'));var logger=require(_0x6b58('0x2'))(_0x6b58('0x3'));var moment=require(_0x6b58('0x4'));var BPromise=require(_0x6b58('0x5'));var rp=require(_0x6b58('0x6'));var fs=require('fs');var path=require(_0x6b58('0x7'));var rimraf=require(_0x6b58('0x8'));var config=require(_0x6b58('0x9'));var attributes=require(_0x6b58('0xa'));module[_0x6b58('0xb')]=function(_0x5adeec,_0x2f2a0b){return _0x5adeec[_0x6b58('0xc')](_0x6b58('0xd'),attributes,{'tableName':_0x6b58('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index 3d5f967..ec9d8b5 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 _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(_0x535cd9,_0x331c5d){var _0x21dde4=function(_0x4132f7){while(--_0x4132f7){_0x535cd9['push'](_0x535cd9['shift']());}};_0x21dde4(++_0x331c5d);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xc4aa[_0x53ccf2];return _0x5a2964;};'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 +var _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x22b47c,_0x5568b5){var _0x29d752=function(_0x443a64){while(--_0x443a64){_0x22b47c['push'](_0x22b47c['shift']());}};_0x29d752(++_0x5568b5);}(_0xdb28,0x106));var _0x8db2=function(_0x4be889,_0x191f81){_0x4be889=_0x4be889-0x0;var _0x3d7067=_0xdb28[_0x4be889];return _0x3d7067;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index e35044c..09ee15a 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 _0xa1f1=['Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','multer','path','connect-timeout','express'];(function(_0x4733d3,_0x454290){var _0x1b9a44=function(_0x1a93bb){while(--_0x1a93bb){_0x4733d3['push'](_0x4733d3['shift']());}};_0x1b9a44(++_0x454290);}(_0xa1f1,0x18b));var _0x1a1f=function(_0x19159a,_0x1cb5c3){_0x19159a=_0x19159a-0x0;var _0xa677f4=_0xa1f1[_0x19159a];return _0xa677f4;};'use strict';var multer=require(_0x1a1f('0x0'));var util=require('util');var path=require(_0x1a1f('0x1'));var timeout=require(_0x1a1f('0x2'));var express=require(_0x1a1f('0x3'));var router=express[_0x1a1f('0x4')]();var fs_extra=require(_0x1a1f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1a1f('0x6'));var config=require(_0x1a1f('0x7'));var controller=require(_0x1a1f('0x8'));router[_0x1a1f('0x9')]('/',auth[_0x1a1f('0xa')](),controller[_0x1a1f('0xb')]);router[_0x1a1f('0x9')](_0x1a1f('0xc'),auth[_0x1a1f('0xa')](),controller[_0x1a1f('0xd')]);router[_0x1a1f('0xe')]('/',auth[_0x1a1f('0xa')](),controller[_0x1a1f('0xf')]);router[_0x1a1f('0x10')](_0x1a1f('0xc'),auth[_0x1a1f('0xa')](),controller[_0x1a1f('0x11')]);router[_0x1a1f('0x12')]('/:id',auth[_0x1a1f('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xba99=['update','delete','/:id','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','show','post','create','put'];(function(_0x57a51c,_0x55bcea){var _0x573a22=function(_0x17e475){while(--_0x17e475){_0x57a51c['push'](_0x57a51c['shift']());}};_0x573a22(++_0x55bcea);}(_0xba99,0x1cf));var _0x9ba9=function(_0x23a477,_0x36bd86){_0x23a477=_0x23a477-0x0;var _0x1a6fb2=_0xba99[_0x23a477];return _0x1a6fb2;};'use strict';var multer=require(_0x9ba9('0x0'));var util=require('util');var path=require(_0x9ba9('0x1'));var timeout=require(_0x9ba9('0x2'));var express=require(_0x9ba9('0x3'));var router=express[_0x9ba9('0x4')]();var fs_extra=require(_0x9ba9('0x5'));var auth=require(_0x9ba9('0x6'));var interaction=require(_0x9ba9('0x7'));var config=require(_0x9ba9('0x8'));var controller=require(_0x9ba9('0x9'));router[_0x9ba9('0xa')]('/',auth[_0x9ba9('0xb')](),controller[_0x9ba9('0xc')]);router[_0x9ba9('0xa')]('/:id',auth[_0x9ba9('0xb')](),controller[_0x9ba9('0xd')]);router[_0x9ba9('0xe')]('/',auth[_0x9ba9('0xb')](),controller[_0x9ba9('0xf')]);router[_0x9ba9('0x10')]('/:id',auth[_0x9ba9('0xb')](),controller[_0x9ba9('0x11')]);router[_0x9ba9('0x12')](_0x9ba9('0x13'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 126aa7d..b696283 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 _0x14ee=['STRING','sequelize'];(function(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0x14ee,0x115));var _0xe14e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x14ee[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xe14e('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0xe14e('0x1')]},'type':{'type':Sequelize[_0xe14e('0x1')]}}; \ No newline at end of file +var _0x86dd=['exports','STRING'];(function(_0x168900,_0x3a06f2){var _0x3f3845=function(_0x33164b){while(--_0x33164b){_0x168900['push'](_0x168900['shift']());}};_0x3f3845(++_0x3a06f2);}(_0x86dd,0x1ee));var _0xd86d=function(_0x11a0b1,_0x12a2f9){_0x11a0b1=_0x11a0b1-0x0;var _0x5ac291=_0x86dd[_0x11a0b1];return _0x5ac291;};'use strict';var Sequelize=require('sequelize');module[_0xd86d('0x0')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0xd86d('0x1')]},'type':{'type':Sequelize[_0xd86d('0x1')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 585f6e7..a0ae660 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 _0xd8da=['ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','name','send','index','map','Attachment','rawAttributes','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','params','clone','length','find','get','omit','createdAt','updatedAt','body','create','file','basename','filename','mimetype','download','root','server/files/attachments/','offline-chat/','join','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv'];(function(_0x24b8f7,_0x583957){var _0x7776c0=function(_0x12478e){while(--_0x12478e){_0x24b8f7['push'](_0x24b8f7['shift']());}};_0x7776c0(++_0x583957);}(_0xd8da,0xac));var _0xad8d=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0xd8da[_0xd1d19a];return _0x52a79d;};'use strict';var emlformat=require(_0xad8d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xad8d('0x1'));var jsonpatch=require(_0xad8d('0x2'));var rp=require(_0xad8d('0x3'));var moment=require(_0xad8d('0x4'));var BPromise=require(_0xad8d('0x5'));var Mustache=require(_0xad8d('0x6'));var util=require(_0xad8d('0x7'));var path=require(_0xad8d('0x8'));var sox=require('sox');var csv=require(_0xad8d('0x9'));var ejs=require(_0xad8d('0xa'));var fs=require('fs');var fs_extra=require(_0xad8d('0xb'));var _=require('lodash');var squel=require(_0xad8d('0xc'));var crypto=require(_0xad8d('0xd'));var jsforce=require(_0xad8d('0xe'));var deskjs=require(_0xad8d('0xf'));var toCsv=require('to-csv');var querystring=require(_0xad8d('0x10'));var Papa=require(_0xad8d('0x11'));var Redis=require(_0xad8d('0x12'));var authService=require(_0xad8d('0x13'));var qs=require(_0xad8d('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xad8d('0x15'));var logger=require(_0xad8d('0x16'))(_0xad8d('0x17'));var utils=require(_0xad8d('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xad8d('0x19'));var db=require(_0xad8d('0x1a'))['db'];function respondWithStatusCode(_0x3f1248,_0x5cd1d1){_0x5cd1d1=_0x5cd1d1||0xcc;return function(_0x445a76){if(_0x445a76){return _0x3f1248[_0xad8d('0x1b')](_0x5cd1d1);}return _0x3f1248['status'](_0x5cd1d1)[_0xad8d('0x1c')]();};}function respondWithResult(_0x2dcfa8,_0xe8854){_0xe8854=_0xe8854||0xc8;return function(_0x1d1a2d){if(_0x1d1a2d){return _0x2dcfa8[_0xad8d('0x1d')](_0xe8854)[_0xad8d('0x1e')](_0x1d1a2d);}};}function respondWithFilteredResult(_0x177201,_0x32f4c2){return function(_0x39a88f){if(_0x39a88f){var _0x88c62e=typeof _0x32f4c2[_0xad8d('0x1f')]===_0xad8d('0x20')&&typeof _0x32f4c2[_0xad8d('0x21')]===_0xad8d('0x20');var _0x3581fa=_0x39a88f[_0xad8d('0x22')];var _0x34ea56=_0x88c62e?0x0:_0x32f4c2[_0xad8d('0x1f')];var _0x326c77=_0x88c62e?_0x39a88f[_0xad8d('0x22')]:_0x32f4c2[_0xad8d('0x1f')]+_0x32f4c2[_0xad8d('0x21')];var _0x2e52e8;if(_0x326c77>=_0x3581fa){_0x326c77=_0x3581fa;_0x2e52e8=0xc8;}else{_0x2e52e8=0xce;}_0x177201[_0xad8d('0x1d')](_0x2e52e8);return _0x177201[_0xad8d('0x23')](_0xad8d('0x24'),_0x34ea56+'-'+_0x326c77+'/'+_0x3581fa)[_0xad8d('0x1e')](_0x39a88f);}return null;};}function patchUpdates(_0x2af45d){return function(_0x440a70){try{jsonpatch[_0xad8d('0x25')](_0x440a70,_0x2af45d,!![]);}catch(_0x3a4b3c){return BPromise[_0xad8d('0x26')](_0x3a4b3c);}return _0x440a70[_0xad8d('0x27')]();};}function saveUpdates(_0x2dd141,_0x4ca29c){return function(_0x1bbffe){if(_0x1bbffe){return _0x1bbffe['update'](_0x2dd141)[_0xad8d('0x28')](function(_0xb8ef70){return _0xb8ef70;});}return null;};}function removeEntity(_0x30a635,_0x545a93){return function(_0x54679d){if(_0x54679d){return _0x54679d[_0xad8d('0x29')]()['then'](function(){_0x30a635[_0xad8d('0x1d')](0xcc)[_0xad8d('0x1c')]();});}};}function handleEntityNotFound(_0x5cd9e6,_0x1a8d77){return function(_0x5a6bdc){if(!_0x5a6bdc){_0x5cd9e6[_0xad8d('0x1b')](0x194);}return _0x5a6bdc;};}function handleError(_0x214456,_0x5445dd){_0x5445dd=_0x5445dd||0x1f4;return function(_0x2db65d){logger[_0xad8d('0x2a')](_0x2db65d['stack']);if(_0x2db65d[_0xad8d('0x2b')]){delete _0x2db65d[_0xad8d('0x2b')];}_0x214456[_0xad8d('0x1d')](_0x5445dd)[_0xad8d('0x2c')](_0x2db65d);};}exports[_0xad8d('0x2d')]=function(_0x481f69,_0x53ebf2){var _0x5ea3e9={},_0x2af1d8={},_0x52ac3e={'count':0x0,'rows':[]};var _0x343c87=_[_0xad8d('0x2e')](db[_0xad8d('0x2f')][_0xad8d('0x30')],function(_0x44e871){return{'name':_0x44e871['fieldName'],'type':_0x44e871['type']['key']};});_0x2af1d8[_0xad8d('0x31')]=_['map'](_0x343c87,_0xad8d('0x2b'));_0x2af1d8['query']=_[_0xad8d('0x32')](_0x481f69[_0xad8d('0x33')]);_0x2af1d8[_0xad8d('0x34')]=_[_0xad8d('0x35')](_0x2af1d8[_0xad8d('0x31')],_0x2af1d8[_0xad8d('0x33')]);_0x5ea3e9[_0xad8d('0x36')]=_[_0xad8d('0x35')](_0x2af1d8['model'],qs[_0xad8d('0x37')](_0x481f69[_0xad8d('0x33')][_0xad8d('0x37')]));_0x5ea3e9[_0xad8d('0x36')]=_0x5ea3e9[_0xad8d('0x36')]['length']?_0x5ea3e9[_0xad8d('0x36')]:_0x2af1d8[_0xad8d('0x31')];if(!_0x481f69[_0xad8d('0x33')][_0xad8d('0x38')](_0xad8d('0x39'))){_0x5ea3e9[_0xad8d('0x21')]=qs['limit'](_0x481f69['query'][_0xad8d('0x21')]);_0x5ea3e9[_0xad8d('0x1f')]=qs[_0xad8d('0x1f')](_0x481f69[_0xad8d('0x33')][_0xad8d('0x1f')]);}_0x5ea3e9[_0xad8d('0x3a')]=qs[_0xad8d('0x3b')](_0x481f69[_0xad8d('0x33')][_0xad8d('0x3b')]);_0x5ea3e9[_0xad8d('0x3c')]=qs['filters'](_[_0xad8d('0x3d')](_0x481f69[_0xad8d('0x33')],_0x2af1d8[_0xad8d('0x34')]),_0x343c87);if(_0x481f69[_0xad8d('0x33')][_0xad8d('0x3e')]){_0x5ea3e9[_0xad8d('0x3c')]=_[_0xad8d('0x3f')](_0x5ea3e9[_0xad8d('0x3c')],{'$or':_[_0xad8d('0x2e')](_0x343c87,function(_0x35f2c6){if(_0x35f2c6[_0xad8d('0x40')]!=='VIRTUAL'){var _0x36b6c3={};_0x36b6c3[_0x35f2c6[_0xad8d('0x2b')]]={'$like':'%'+_0x481f69[_0xad8d('0x33')][_0xad8d('0x3e')]+'%'};return _0x36b6c3;}})});}_0x5ea3e9=_[_0xad8d('0x3f')]({},_0x5ea3e9,_0x481f69[_0xad8d('0x41')]);var _0x43d0ee={'where':_0x5ea3e9[_0xad8d('0x3c')]};return db[_0xad8d('0x2f')][_0xad8d('0x22')](_0x43d0ee)['then'](function(_0x46c79c){_0x52ac3e[_0xad8d('0x22')]=_0x46c79c;if(_0x481f69[_0xad8d('0x33')][_0xad8d('0x42')]){_0x5ea3e9[_0xad8d('0x43')]=[{'all':!![]}];}return db['Attachment'][_0xad8d('0x44')](_0x5ea3e9);})[_0xad8d('0x28')](function(_0xa8016c){_0x52ac3e[_0xad8d('0x45')]=_0xa8016c;return _0x52ac3e;})[_0xad8d('0x28')](respondWithFilteredResult(_0x53ebf2,_0x5ea3e9))[_0xad8d('0x46')](handleError(_0x53ebf2,null));};exports[_0xad8d('0x47')]=function(_0x1f805f,_0x40e7a2){var _0x41a33c={'raw':!![],'where':{'id':_0x1f805f[_0xad8d('0x48')]['id']}},_0x4d69f3={};_0x4d69f3[_0xad8d('0x31')]=_[_0xad8d('0x32')](db[_0xad8d('0x2f')]['rawAttributes']);_0x4d69f3['query']=_['keys'](_0x1f805f[_0xad8d('0x33')]);_0x4d69f3[_0xad8d('0x34')]=_[_0xad8d('0x35')](_0x4d69f3[_0xad8d('0x31')],_0x4d69f3[_0xad8d('0x33')]);_0x41a33c[_0xad8d('0x36')]=_['intersection'](_0x4d69f3['model'],qs[_0xad8d('0x37')](_0x1f805f[_0xad8d('0x33')][_0xad8d('0x37')]));_0x41a33c['attributes']=_0x41a33c['attributes']['length']?_0x41a33c[_0xad8d('0x36')]:_0x4d69f3[_0xad8d('0x31')];if(_0x1f805f[_0xad8d('0x33')][_0xad8d('0x42')]){_0x41a33c['include']=[{'all':!![]}];}_0x41a33c=_['merge']({},_0x41a33c,_0x1f805f[_0xad8d('0x41')]);return db[_0xad8d('0x2f')]['find'](_0x41a33c)[_0xad8d('0x28')](handleEntityNotFound(_0x40e7a2,null))[_0xad8d('0x28')](respondWithResult(_0x40e7a2,null))[_0xad8d('0x46')](handleError(_0x40e7a2,null));};exports[_0xad8d('0x49')]=function(_0x3d1280,_0x478d10){var _0x3f54f8={'where':{'id':_0x3d1280[_0xad8d('0x48')]['id']}},_0xf07e4b={};_0xf07e4b[_0xad8d('0x31')]=_[_0xad8d('0x32')](db[_0xad8d('0x2f')]['rawAttributes']);_0x3f54f8[_0xad8d('0x36')]=_[_0xad8d('0x35')](_0xf07e4b[_0xad8d('0x31')],qs[_0xad8d('0x37')](_0x3d1280[_0xad8d('0x33')]['fields']));_0x3f54f8[_0xad8d('0x36')]=_0x3f54f8['attributes'][_0xad8d('0x4a')]?_0x3f54f8[_0xad8d('0x36')]:_0xf07e4b['model'];if(_0x3d1280[_0xad8d('0x33')]['includeAll']){_0x3f54f8[_0xad8d('0x43')]=[{'all':!![]}];}_0x3f54f8=_[_0xad8d('0x3f')]({},_0x3f54f8,_0x3d1280[_0xad8d('0x41')]);return db[_0xad8d('0x2f')][_0xad8d('0x4b')](_0x3f54f8)[_0xad8d('0x28')](handleEntityNotFound(_0x478d10,null))['then'](function(_0xbcdf6b){if(_0xbcdf6b){var _0x1c07fe=_0xbcdf6b[_0xad8d('0x4c')]({'plain':!![]});_0x1c07fe=qs[_0xad8d('0x4d')](_0x1c07fe,['id',_0xad8d('0x4e'),_0xad8d('0x4f')]);_0x3d1280[_0xad8d('0x50')]=_['omit'](_0x3d1280[_0xad8d('0x50')],['id',_0xad8d('0x4e'),_0xad8d('0x4f')]);return db[_0xad8d('0x2f')][_0xad8d('0x51')](_[_0xad8d('0x3f')](_0x1c07fe,_0x3d1280['body']),{'include':_0x3d1280[_0xad8d('0x33')][_0xad8d('0x42')]?[{'all':!![]}]:undefined});}})[_0xad8d('0x28')](respondWithResult(_0x478d10,0xc9))[_0xad8d('0x46')](handleError(_0x478d10,null));};exports['update']=function(_0x3919ea,_0x511f6d){if(_0x3919ea[_0xad8d('0x50')]['id']){delete _0x3919ea[_0xad8d('0x50')]['id'];}return db['Attachment'][_0xad8d('0x4b')]({'where':{'id':_0x3919ea[_0xad8d('0x48')]['id']}})['then'](handleEntityNotFound(_0x511f6d,null))['then'](saveUpdates(_0x3919ea[_0xad8d('0x50')],null))['then'](respondWithResult(_0x511f6d,null))[_0xad8d('0x46')](handleError(_0x511f6d,null));};exports[_0xad8d('0x29')]=function(_0x1b6d17,_0x40548f){return db['Attachment'][_0xad8d('0x4b')]({'where':{'id':_0x1b6d17[_0xad8d('0x48')]['id']}})[_0xad8d('0x28')](handleEntityNotFound(_0x40548f,null))[_0xad8d('0x28')](removeEntity(_0x40548f,null))['catch'](handleError(_0x40548f,null));};exports[_0xad8d('0x51')]=function(_0x541aa5,_0x3e9a73,_0x59c428){_0x541aa5[_0xad8d('0x50')]['name']=_0x541aa5[_0xad8d('0x52')]['originalname'];_0x541aa5[_0xad8d('0x50')][_0xad8d('0x53')]=_0x541aa5[_0xad8d('0x52')][_0xad8d('0x54')];_0x541aa5[_0xad8d('0x50')][_0xad8d('0x40')]=_0x541aa5['file'][_0xad8d('0x55')];return db['Attachment'][_0xad8d('0x51')](_0x541aa5[_0xad8d('0x50')])[_0xad8d('0x28')](respondWithResult(_0x3e9a73,0xc9))[_0xad8d('0x46')](handleError(_0x3e9a73,null));};exports[_0xad8d('0x56')]=function(_0x2d2877,_0x5c5918,_0x4ac956){return db[_0xad8d('0x2f')]['findOne']({'where':{'id':_0x2d2877[_0xad8d('0x48')]['id']},'raw':!![]})[_0xad8d('0x28')](handleEntityNotFound(_0x5c5918,null))[_0xad8d('0x28')](function(_0x351297){if(_0x351297){var _0x516389=_0x351297['ChatOfflineMessageId']!==null;var _0xc817e0=path['join'](config[_0xad8d('0x57')],_0xad8d('0x58'));if(_0x516389){_0xc817e0=path['join'](_0xc817e0,_0xad8d('0x59'));}var _0x6e777b=path[_0xad8d('0x5a')](_0xc817e0,_0x351297[_0xad8d('0x53')]);return _0x5c5918['download'](_0x6e777b);}})[_0xad8d('0x46')](handleError(_0x5c5918,null));}; \ No newline at end of file +var _0x2f54=['end','json','offset','undefined','limit','count','set','apply','save','then','destroy','stack','send','index','rawAttributes','fieldName','type','key','model','map','name','query','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','Attachment','findAll','catch','show','params','keys','length','includeAll','include','merge','options','find','clone','get','omit','updatedAt','body','createdAt','create','update','file','originalname','basename','filename','mimetype','findOne','root','server/files/attachments/','join','download','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/utils','../../mysqldb','sendStatus','status'];(function(_0x2db12b,_0x30ab1d){var _0x20990b=function(_0x589477){while(--_0x589477){_0x2db12b['push'](_0x2db12b['shift']());}};_0x20990b(++_0x30ab1d);}(_0x2f54,0x197));var _0x42f5=function(_0x5ee748,_0x552a2b){_0x5ee748=_0x5ee748-0x0;var _0x36da37=_0x2f54[_0x5ee748];return _0x36da37;};'use strict';var emlformat=require(_0x42f5('0x0'));var rimraf=require(_0x42f5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x42f5('0x2'));var moment=require('moment');var BPromise=require(_0x42f5('0x3'));var Mustache=require(_0x42f5('0x4'));var util=require(_0x42f5('0x5'));var path=require(_0x42f5('0x6'));var sox=require(_0x42f5('0x7'));var csv=require(_0x42f5('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x42f5('0x9'));var squel=require(_0x42f5('0xa'));var crypto=require(_0x42f5('0xb'));var jsforce=require(_0x42f5('0xc'));var deskjs=require(_0x42f5('0xd'));var toCsv=require('to-csv');var querystring=require(_0x42f5('0xe'));var Papa=require(_0x42f5('0xf'));var Redis=require(_0x42f5('0x10'));var authService=require(_0x42f5('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x42f5('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x42f5('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x42f5('0x14'))['db'];function respondWithStatusCode(_0x1ffb2c,_0x18158b){_0x18158b=_0x18158b||0xcc;return function(_0x2fda62){if(_0x2fda62){return _0x1ffb2c[_0x42f5('0x15')](_0x18158b);}return _0x1ffb2c[_0x42f5('0x16')](_0x18158b)[_0x42f5('0x17')]();};}function respondWithResult(_0x4f9d0e,_0x5b0fac){_0x5b0fac=_0x5b0fac||0xc8;return function(_0x2a3976){if(_0x2a3976){return _0x4f9d0e[_0x42f5('0x16')](_0x5b0fac)[_0x42f5('0x18')](_0x2a3976);}};}function respondWithFilteredResult(_0x12e4c5,_0x53f794){return function(_0x20a442){if(_0x20a442){var _0x3b7d36=typeof _0x53f794[_0x42f5('0x19')]===_0x42f5('0x1a')&&typeof _0x53f794[_0x42f5('0x1b')]===_0x42f5('0x1a');var _0x38a237=_0x20a442[_0x42f5('0x1c')];var _0x30d2c7=_0x3b7d36?0x0:_0x53f794[_0x42f5('0x19')];var _0xef75f8=_0x3b7d36?_0x20a442[_0x42f5('0x1c')]:_0x53f794[_0x42f5('0x19')]+_0x53f794[_0x42f5('0x1b')];var _0x1b8c12;if(_0xef75f8>=_0x38a237){_0xef75f8=_0x38a237;_0x1b8c12=0xc8;}else{_0x1b8c12=0xce;}_0x12e4c5[_0x42f5('0x16')](_0x1b8c12);return _0x12e4c5[_0x42f5('0x1d')]('Content-Range',_0x30d2c7+'-'+_0xef75f8+'/'+_0x38a237)['json'](_0x20a442);}return null;};}function patchUpdates(_0x245701){return function(_0xede24e){try{jsonpatch[_0x42f5('0x1e')](_0xede24e,_0x245701,!![]);}catch(_0x445130){return BPromise['reject'](_0x445130);}return _0xede24e[_0x42f5('0x1f')]();};}function saveUpdates(_0x433c00,_0x497363){return function(_0x42f6e4){if(_0x42f6e4){return _0x42f6e4['update'](_0x433c00)[_0x42f5('0x20')](function(_0x1f3ece){return _0x1f3ece;});}return null;};}function removeEntity(_0x4e275d,_0x38ff24){return function(_0x5ac26b){if(_0x5ac26b){return _0x5ac26b[_0x42f5('0x21')]()[_0x42f5('0x20')](function(){_0x4e275d[_0x42f5('0x16')](0xcc)[_0x42f5('0x17')]();});}};}function handleEntityNotFound(_0x50d577,_0x1b9387){return function(_0xf5d7e0){if(!_0xf5d7e0){_0x50d577[_0x42f5('0x15')](0x194);}return _0xf5d7e0;};}function handleError(_0x1cd2f0,_0x32ef05){_0x32ef05=_0x32ef05||0x1f4;return function(_0x4e43b0){logger['error'](_0x4e43b0[_0x42f5('0x22')]);if(_0x4e43b0['name']){delete _0x4e43b0['name'];}_0x1cd2f0[_0x42f5('0x16')](_0x32ef05)[_0x42f5('0x23')](_0x4e43b0);};}exports[_0x42f5('0x24')]=function(_0x45b504,_0x2c4d50){var _0x220d51={},_0x2920b1={},_0x5a7c2a={'count':0x0,'rows':[]};var _0x35c57c=_['map'](db['Attachment'][_0x42f5('0x25')],function(_0xc7d89){return{'name':_0xc7d89[_0x42f5('0x26')],'type':_0xc7d89[_0x42f5('0x27')][_0x42f5('0x28')]};});_0x2920b1[_0x42f5('0x29')]=_[_0x42f5('0x2a')](_0x35c57c,_0x42f5('0x2b'));_0x2920b1['query']=_['keys'](_0x45b504[_0x42f5('0x2c')]);_0x2920b1['filters']=_['intersection'](_0x2920b1['model'],_0x2920b1[_0x42f5('0x2c')]);_0x220d51[_0x42f5('0x2d')]=_[_0x42f5('0x2e')](_0x2920b1['model'],qs[_0x42f5('0x2f')](_0x45b504[_0x42f5('0x2c')][_0x42f5('0x2f')]));_0x220d51[_0x42f5('0x2d')]=_0x220d51['attributes']['length']?_0x220d51[_0x42f5('0x2d')]:_0x2920b1['model'];if(!_0x45b504[_0x42f5('0x2c')][_0x42f5('0x30')](_0x42f5('0x31'))){_0x220d51[_0x42f5('0x1b')]=qs[_0x42f5('0x1b')](_0x45b504['query']['limit']);_0x220d51['offset']=qs['offset'](_0x45b504['query']['offset']);}_0x220d51[_0x42f5('0x32')]=qs[_0x42f5('0x33')](_0x45b504[_0x42f5('0x2c')][_0x42f5('0x33')]);_0x220d51[_0x42f5('0x34')]=qs[_0x42f5('0x35')](_['pick'](_0x45b504[_0x42f5('0x2c')],_0x2920b1[_0x42f5('0x35')]),_0x35c57c);if(_0x45b504[_0x42f5('0x2c')][_0x42f5('0x36')]){_0x220d51[_0x42f5('0x34')]=_['merge'](_0x220d51['where'],{'$or':_[_0x42f5('0x2a')](_0x35c57c,function(_0xbcd444){if(_0xbcd444['type']!==_0x42f5('0x37')){var _0x3335a1={};_0x3335a1[_0xbcd444[_0x42f5('0x2b')]]={'$like':'%'+_0x45b504[_0x42f5('0x2c')][_0x42f5('0x36')]+'%'};return _0x3335a1;}})});}_0x220d51=_['merge']({},_0x220d51,_0x45b504['options']);var _0x22fff2={'where':_0x220d51[_0x42f5('0x34')]};return db[_0x42f5('0x38')][_0x42f5('0x1c')](_0x22fff2)[_0x42f5('0x20')](function(_0x42218e){_0x5a7c2a[_0x42f5('0x1c')]=_0x42218e;if(_0x45b504[_0x42f5('0x2c')]['includeAll']){_0x220d51['include']=[{'all':!![]}];}return db['Attachment'][_0x42f5('0x39')](_0x220d51);})[_0x42f5('0x20')](function(_0x2c9bb3){_0x5a7c2a['rows']=_0x2c9bb3;return _0x5a7c2a;})[_0x42f5('0x20')](respondWithFilteredResult(_0x2c4d50,_0x220d51))[_0x42f5('0x3a')](handleError(_0x2c4d50,null));};exports[_0x42f5('0x3b')]=function(_0x4d9ddb,_0x4a9c2d){var _0x4e7381={'raw':!![],'where':{'id':_0x4d9ddb[_0x42f5('0x3c')]['id']}},_0xba5293={};_0xba5293[_0x42f5('0x29')]=_['keys'](db[_0x42f5('0x38')][_0x42f5('0x25')]);_0xba5293[_0x42f5('0x2c')]=_[_0x42f5('0x3d')](_0x4d9ddb[_0x42f5('0x2c')]);_0xba5293[_0x42f5('0x35')]=_['intersection'](_0xba5293[_0x42f5('0x29')],_0xba5293[_0x42f5('0x2c')]);_0x4e7381[_0x42f5('0x2d')]=_[_0x42f5('0x2e')](_0xba5293[_0x42f5('0x29')],qs[_0x42f5('0x2f')](_0x4d9ddb[_0x42f5('0x2c')][_0x42f5('0x2f')]));_0x4e7381['attributes']=_0x4e7381[_0x42f5('0x2d')][_0x42f5('0x3e')]?_0x4e7381[_0x42f5('0x2d')]:_0xba5293[_0x42f5('0x29')];if(_0x4d9ddb[_0x42f5('0x2c')][_0x42f5('0x3f')]){_0x4e7381[_0x42f5('0x40')]=[{'all':!![]}];}_0x4e7381=_[_0x42f5('0x41')]({},_0x4e7381,_0x4d9ddb[_0x42f5('0x42')]);return db[_0x42f5('0x38')][_0x42f5('0x43')](_0x4e7381)['then'](handleEntityNotFound(_0x4a9c2d,null))[_0x42f5('0x20')](respondWithResult(_0x4a9c2d,null))[_0x42f5('0x3a')](handleError(_0x4a9c2d,null));};exports[_0x42f5('0x44')]=function(_0x48625f,_0x18c8b4){var _0x1370ee={'where':{'id':_0x48625f[_0x42f5('0x3c')]['id']}},_0x36b62b={};_0x36b62b[_0x42f5('0x29')]=_['keys'](db[_0x42f5('0x38')]['rawAttributes']);_0x1370ee['attributes']=_[_0x42f5('0x2e')](_0x36b62b[_0x42f5('0x29')],qs[_0x42f5('0x2f')](_0x48625f[_0x42f5('0x2c')][_0x42f5('0x2f')]));_0x1370ee[_0x42f5('0x2d')]=_0x1370ee[_0x42f5('0x2d')][_0x42f5('0x3e')]?_0x1370ee[_0x42f5('0x2d')]:_0x36b62b[_0x42f5('0x29')];if(_0x48625f[_0x42f5('0x2c')][_0x42f5('0x3f')]){_0x1370ee['include']=[{'all':!![]}];}_0x1370ee=_[_0x42f5('0x41')]({},_0x1370ee,_0x48625f[_0x42f5('0x42')]);return db[_0x42f5('0x38')][_0x42f5('0x43')](_0x1370ee)[_0x42f5('0x20')](handleEntityNotFound(_0x18c8b4,null))['then'](function(_0x4c56d1){if(_0x4c56d1){var _0x2c8977=_0x4c56d1[_0x42f5('0x45')]({'plain':!![]});_0x2c8977=qs[_0x42f5('0x46')](_0x2c8977,['id','createdAt',_0x42f5('0x47')]);_0x48625f[_0x42f5('0x48')]=_[_0x42f5('0x46')](_0x48625f[_0x42f5('0x48')],['id',_0x42f5('0x49'),'updatedAt']);return db['Attachment'][_0x42f5('0x4a')](_[_0x42f5('0x41')](_0x2c8977,_0x48625f[_0x42f5('0x48')]),{'include':_0x48625f[_0x42f5('0x2c')][_0x42f5('0x3f')]?[{'all':!![]}]:undefined});}})[_0x42f5('0x20')](respondWithResult(_0x18c8b4,0xc9))[_0x42f5('0x3a')](handleError(_0x18c8b4,null));};exports[_0x42f5('0x4b')]=function(_0x42cb32,_0x44960d){if(_0x42cb32[_0x42f5('0x48')]['id']){delete _0x42cb32['body']['id'];}return db[_0x42f5('0x38')]['find']({'where':{'id':_0x42cb32[_0x42f5('0x3c')]['id']}})[_0x42f5('0x20')](handleEntityNotFound(_0x44960d,null))[_0x42f5('0x20')](saveUpdates(_0x42cb32['body'],null))[_0x42f5('0x20')](respondWithResult(_0x44960d,null))[_0x42f5('0x3a')](handleError(_0x44960d,null));};exports[_0x42f5('0x21')]=function(_0x3402aa,_0x3184c3){return db[_0x42f5('0x38')][_0x42f5('0x43')]({'where':{'id':_0x3402aa[_0x42f5('0x3c')]['id']}})['then'](handleEntityNotFound(_0x3184c3,null))[_0x42f5('0x20')](removeEntity(_0x3184c3,null))['catch'](handleError(_0x3184c3,null));};exports['create']=function(_0x40f64a,_0x151573,_0x16d94e){_0x40f64a[_0x42f5('0x48')]['name']=_0x40f64a[_0x42f5('0x4c')][_0x42f5('0x4d')];_0x40f64a[_0x42f5('0x48')][_0x42f5('0x4e')]=_0x40f64a[_0x42f5('0x4c')][_0x42f5('0x4f')];_0x40f64a[_0x42f5('0x48')][_0x42f5('0x27')]=_0x40f64a[_0x42f5('0x4c')][_0x42f5('0x50')];return db[_0x42f5('0x38')][_0x42f5('0x4a')](_0x40f64a[_0x42f5('0x48')])[_0x42f5('0x20')](respondWithResult(_0x151573,0xc9))[_0x42f5('0x3a')](handleError(_0x151573,null));};exports['download']=function(_0x1c2ba5,_0x1ab3a5,_0x197ed6){return db['Attachment'][_0x42f5('0x51')]({'where':{'id':_0x1c2ba5[_0x42f5('0x3c')]['id']},'raw':!![]})[_0x42f5('0x20')](handleEntityNotFound(_0x1ab3a5,null))[_0x42f5('0x20')](function(_0x520f16){if(_0x520f16){var _0x381217=_0x520f16['ChatOfflineMessageId']!==null;var _0x533295=path['join'](config[_0x42f5('0x52')],_0x42f5('0x53'));if(_0x381217){_0x533295=path[_0x42f5('0x54')](_0x533295,'offline-chat/');}var _0x1a7731=path[_0x42f5('0x54')](_0x533295,_0x520f16[_0x42f5('0x4e')]);return _0x1ab3a5[_0x42f5('0x55')](_0x1a7731);}})[_0x42f5('0x3a')](handleError(_0x1ab3a5,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 4108a51..95bf8c7 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 _0x9bdc=['request-promise','./attachment.attributes','exports','define','attachments','lodash','util','../../config/logger','api','bluebird'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0x9bdc,0x9b));var _0xc9bd=function(_0x582974,_0xb6918c){_0x582974=_0x582974-0x0;var _0x5a1914=_0x9bdc[_0x582974];return _0x5a1914;};'use strict';var _=require(_0xc9bd('0x0'));var util=require(_0xc9bd('0x1'));var logger=require(_0xc9bd('0x2'))(_0xc9bd('0x3'));var moment=require('moment');var BPromise=require(_0xc9bd('0x4'));var rp=require(_0xc9bd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc9bd('0x6'));module[_0xc9bd('0x7')]=function(_0x2d0335,_0x570a3d){return _0x2d0335[_0xc9bd('0x8')]('Attachment',attributes,{'tableName':_0xc9bd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbb64=['util','moment','bluebird','request-promise','../../config/environment','./attachment.attributes','define','Attachment','lodash'];(function(_0x52f1a7,_0x4da82f){var _0x227c86=function(_0x1e8686){while(--_0x1e8686){_0x52f1a7['push'](_0x52f1a7['shift']());}};_0x227c86(++_0x4da82f);}(_0xbb64,0x1dc));var _0x4bb6=function(_0x27bc7b,_0xb3a76d){_0x27bc7b=_0x27bc7b-0x0;var _0x348d71=_0xbb64[_0x27bc7b];return _0x348d71;};'use strict';var _=require(_0x4bb6('0x0'));var util=require(_0x4bb6('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x4bb6('0x2'));var BPromise=require(_0x4bb6('0x3'));var rp=require(_0x4bb6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4bb6('0x5'));var attributes=require(_0x4bb6('0x6'));module['exports']=function(_0x59ac41,_0x5d59f1){return _0x59ac41[_0x4bb6('0x7')](_0x4bb6('0x8'),attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index 5b40065..7564502 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 _0x8aa7=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateAttachment','Attachment','create','body','options','raw','stringify','util','moment','bluebird','randomstring'];(function(_0x3c90df,_0x249ce5){var _0x15c7a6=function(_0x33c960){while(--_0x33c960){_0x3c90df['push'](_0x3c90df['shift']());}};_0x15c7a6(++_0x249ce5);}(_0x8aa7,0xb6));var _0x78aa=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x8aa7[_0x5f09c5];return _0x426ad9;};'use strict';var _=require('lodash');var util=require(_0x78aa('0x0'));var moment=require(_0x78aa('0x1'));var BPromise=require(_0x78aa('0x2'));var rs=require(_0x78aa('0x3'));var fs=require('fs');var Redis=require(_0x78aa('0x4'));var db=require(_0x78aa('0x5'))['db'];var utils=require(_0x78aa('0x6'));var logger=require('../../config/logger')(_0x78aa('0x7'));var config=require(_0x78aa('0x8'));var jayson=require(_0x78aa('0x9'));var client=jayson[_0x78aa('0xa')][_0x78aa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x369ee7,_0x462a9a,_0xa79008){return new BPromise(function(_0x2368ac,_0x460488){return client[_0x78aa('0xc')](_0x369ee7,_0xa79008)[_0x78aa('0xd')](function(_0x45d377){logger[_0x78aa('0xe')](_0x78aa('0xf'),_0x462a9a,_0x78aa('0x10'));logger[_0x78aa('0x11')](_0x78aa('0x12'),_0x462a9a,_0x78aa('0x10'),JSON['stringify'](_0x45d377));if(_0x45d377['error']){if(_0x45d377[_0x78aa('0x13')][_0x78aa('0x14')]===0x1f4){logger['error'](_0x78aa('0xf'),_0x462a9a,_0x45d377[_0x78aa('0x13')][_0x78aa('0x15')]);return _0x460488(_0x45d377[_0x78aa('0x13')][_0x78aa('0x15')]);}logger['error'](_0x78aa('0xf'),_0x462a9a,_0x45d377[_0x78aa('0x13')][_0x78aa('0x15')]);return _0x2368ac(_0x45d377[_0x78aa('0x13')][_0x78aa('0x15')]);}else{logger['info'](_0x78aa('0xf'),_0x462a9a,_0x78aa('0x10'));_0x2368ac(_0x45d377[_0x78aa('0x16')][_0x78aa('0x15')]);}})[_0x78aa('0x17')](function(_0x2897f8){logger['error']('Attachment,\x20%s,\x20%s',_0x462a9a,_0x2897f8);_0x460488(_0x2897f8);});});}exports[_0x78aa('0x18')]=function(_0x345e4d){var _0xc316d9=this;return new Promise(function(_0x4207b0,_0x9879bf){return db[_0x78aa('0x19')][_0x78aa('0x1a')](_0x345e4d[_0x78aa('0x1b')],{'raw':_0x345e4d[_0x78aa('0x1c')]?_0x345e4d[_0x78aa('0x1c')][_0x78aa('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x18c60d){logger[_0x78aa('0xe')]('CreateAttachment',_0x345e4d);logger[_0x78aa('0x11')](_0x78aa('0x18'),_0x345e4d,JSON[_0x78aa('0x1e')](_0x18c60d));_0x4207b0(_0x18c60d);})['catch'](function(_0x5a9dbf){logger[_0x78aa('0x13')](_0x78aa('0x18'),_0x5a9dbf['message'],_0x345e4d);_0x9879bf(_0xc316d9[_0x78aa('0x13')](0x1f4,_0x5a9dbf[_0x78aa('0x15')]));});});}; \ No newline at end of file +var _0xe13e=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Attachment,\x20%s,\x20%s','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','CreateAttachment','Attachment','body','options','raw','moment','bluebird'];(function(_0x580ff5,_0xd4a51a){var _0x2ea54f=function(_0xa7771c){while(--_0xa7771c){_0x580ff5['push'](_0x580ff5['shift']());}};_0x2ea54f(++_0xd4a51a);}(_0xe13e,0xde));var _0xee13=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe13e[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xee13('0x0'));var BPromise=require(_0xee13('0x1'));var rs=require(_0xee13('0x2'));var fs=require('fs');var Redis=require(_0xee13('0x3'));var db=require(_0xee13('0x4'))['db'];var utils=require(_0xee13('0x5'));var logger=require(_0xee13('0x6'))(_0xee13('0x7'));var config=require(_0xee13('0x8'));var jayson=require(_0xee13('0x9'));var client=jayson[_0xee13('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x8f606d,_0x3ae6e2,_0xfdb836){return new BPromise(function(_0x64ee02,_0x4810bd){return client[_0xee13('0xb')](_0x8f606d,_0xfdb836)[_0xee13('0xc')](function(_0x1cc55b){logger[_0xee13('0xd')](_0xee13('0xe'),_0x3ae6e2,'request\x20sent');logger[_0xee13('0xf')](_0xee13('0x10'),_0x3ae6e2,'request\x20sent',JSON[_0xee13('0x11')](_0x1cc55b));if(_0x1cc55b['error']){if(_0x1cc55b['error']['code']===0x1f4){logger[_0xee13('0x12')]('Attachment,\x20%s,\x20%s',_0x3ae6e2,_0x1cc55b[_0xee13('0x12')][_0xee13('0x13')]);return _0x4810bd(_0x1cc55b[_0xee13('0x12')][_0xee13('0x13')]);}logger[_0xee13('0x12')](_0xee13('0xe'),_0x3ae6e2,_0x1cc55b[_0xee13('0x12')]['message']);return _0x64ee02(_0x1cc55b[_0xee13('0x12')][_0xee13('0x13')]);}else{logger[_0xee13('0xd')]('Attachment,\x20%s,\x20%s',_0x3ae6e2,_0xee13('0x14'));_0x64ee02(_0x1cc55b[_0xee13('0x15')]['message']);}})[_0xee13('0x16')](function(_0xcd1482){logger[_0xee13('0x12')](_0xee13('0xe'),_0x3ae6e2,_0xcd1482);_0x4810bd(_0xcd1482);});});}exports[_0xee13('0x17')]=function(_0x3a5819){var _0xd353d0=this;return new Promise(function(_0x33bd9c,_0x3806b0){return db[_0xee13('0x18')]['create'](_0x3a5819[_0xee13('0x19')],{'raw':_0x3a5819[_0xee13('0x1a')]?_0x3a5819['options'][_0xee13('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x17e664){logger['info'](_0xee13('0x17'),_0x3a5819);logger[_0xee13('0xf')]('CreateAttachment',_0x3a5819,JSON[_0xee13('0x11')](_0x17e664));_0x33bd9c(_0x17e664);})[_0xee13('0x16')](function(_0x3f9dfd){logger[_0xee13('0x12')](_0xee13('0x17'),_0x3f9dfd['message'],_0x3a5819);_0x3806b0(_0xd353d0[_0xee13('0x12')](0x1f4,_0x3f9dfd[_0xee13('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 66790de..cbc5888 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 _0x5f2f=['show','/:id/download','download','post','/:id/clone','clone','root','server/files/attachments/','format','now','originalname','replace','single','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./attachment.controller','get','isAuthenticated','index','/:id'];(function(_0x605a77,_0x38ccfe){var _0x225ce7=function(_0x36672e){while(--_0x36672e){_0x605a77['push'](_0x605a77['shift']());}};_0x225ce7(++_0x38ccfe);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4fb32f,_0x39f177){_0x4fb32f=_0x4fb32f-0x0;var _0x2fd978=_0x5f2f[_0x4fb32f];return _0x2fd978;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')](_0xf5f2('0x11'),auth['isAuthenticated'](),controller[_0xf5f2('0x12')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x53fb33,_0xa7e1a6,_0x151aba){_0x151aba(null,path['join'](config[_0xf5f2('0x13')],_0xf5f2('0x14')));},'filename':function(_0x331482,_0x3f2997,_0x59bb6c){_0x59bb6c(null,util[_0xf5f2('0x15')]('%s-%s',Date[_0xf5f2('0x16')](),_0x3f2997[_0xf5f2('0x17')][_0xf5f2('0x18')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xf5f2('0x10')]('/',upload[_0xf5f2('0x19')]('file'),controller[_0xf5f2('0x1a')]);router[_0xf5f2('0x1b')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1c')]);router[_0xf5f2('0x1d')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1e')]);module[_0xf5f2('0x1f')]=router; \ No newline at end of file +var _0x0b0e=['/:id/clone','clone','diskStorage','join','server/files/attachments/','format','now','originalname','replace','single','create','/:id','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','isAuthenticated','index','show','/:id/download','post'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0x0b0e,0x187));var _0xe0b0=function(_0x12aba8,_0x40a036){_0x12aba8=_0x12aba8-0x0;var _0x2aac66=_0x0b0e[_0x12aba8];return _0x2aac66;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['download']);router[_0xe0b0('0xe')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x10')]);var upload=multer({'storage':multer[_0xe0b0('0x11')]({'destination':function(_0x574d96,_0x399320,_0x2cdad2){_0x2cdad2(null,path[_0xe0b0('0x12')](config['root'],_0xe0b0('0x13')));},'filename':function(_0x1c358a,_0x3cc19a,_0x45f914){_0x45f914(null,util[_0xe0b0('0x14')]('%s-%s',Date[_0xe0b0('0x15')](),_0x3cc19a[_0xe0b0('0x16')][_0xe0b0('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xe0b0('0xe')]('/',upload[_0xe0b0('0x18')]('file'),controller[_0xe0b0('0x19')]);router['put'](_0xe0b0('0x1a'),auth[_0xe0b0('0xa')](),controller['update']);router[_0xe0b0('0x1b')]('/:id',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index cd779a2..7c268ad 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 _0xffbd=['api','undefined','activedirectory','baseDN','url','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','adSsoEnabled','blockDuration','name','password','salt','role','blocked','online','admin','user','then','disabled','blockedAt','add','minutes','clearBlockUser','getLicense','catch','status','send','message','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','use','passport-local','Strategy','moment','activedirectory2','util','../../mysqldb','../../config/environment','../../config/logger'];(function(_0x21badd,_0x4362cb){var _0x5850aa=function(_0x146d41){while(--_0x146d41){_0x21badd['push'](_0x21badd['shift']());}};_0x5850aa(++_0x4362cb);}(_0xffbd,0x170));var _0xdffb=function(_0x2e4a0f,_0x3a9bb6){_0x2e4a0f=_0x2e4a0f-0x0;var _0x25a3cd=_0xffbd[_0x2e4a0f];return _0x25a3cd;};'use strict';var passport=require('passport');var LocalStrategy=require(_0xdffb('0x0'))[_0xdffb('0x1')];var moment=require(_0xdffb('0x2'));var ActiveDirectory=require(_0xdffb('0x3'));var BPromise=require('bluebird');var util=require(_0xdffb('0x4'));var db=require(_0xdffb('0x5'))['db'];var authService=require('../../components/auth/service');var utils=require('../../config/utils');var config=require(_0xdffb('0x6'));var logger=require(_0xdffb('0x7'))(_0xdffb('0x8'));function isActiveDirectoryConfigured(_0x305f3e){var _0x3b6dd4=![];if(typeof _0x305f3e['activedirectory']!==_0xdffb('0x9')){_0x3b6dd4=_0x305f3e[_0xdffb('0xa')][_0xdffb('0xb')]&&_0x305f3e[_0xdffb('0xa')][_0xdffb('0xc')]&&_0x305f3e[_0xdffb('0xa')][_0xdffb('0xd')];}return _0x3b6dd4;}function adAuthenticate(_0x3d1d98,_0x577331,_0x4bded3){return new BPromise(function(_0x56b869,_0x496ea8){try{var _0x4f09bc=new ActiveDirectory(_0x3d1d98);_0x4f09bc[_0xdffb('0xe')](_0x577331,_0x4bded3,function(_0x31b05f,_0x57e843){if(_0x31b05f){logger[_0xdffb('0xf')](_0xdffb('0x10'),_0x577331,util[_0xdffb('0x11')](_0x31b05f,{'showHidden':![],'depth':null}));_0x496ea8(_0xdffb('0x12'));}else if(!_0x57e843){logger[_0xdffb('0xf')](_0xdffb('0x13'),_0x577331);_0x496ea8('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x56b869(_0x57e843);}});}catch(_0x744a61){_0x496ea8(_0x744a61);}});}function ActiveDirectoryAuthenticate(_0x1d9c12,_0x479900,_0x8456cb,_0x2e2d64){var _0x278b5e,_0x84bc0a;if(!isActiveDirectoryConfigured(config)){logger[_0xdffb('0xf')](_0xdffb('0x14'),_0x479900);return _0x2e2d64(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0xdffb('0x15'),_0xdffb('0x16')],'raw':!![]})['then'](function(_0x3c1b56){_0x278b5e=_0x3c1b56;if(!_0x278b5e[_0xdffb('0x15')]){logger[_0xdffb('0xf')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled',_0x479900);throw new Error(_0xdffb('0x12'));}return _0x1d9c12['findOne']({'attributes':['id',_0xdffb('0x17'),_0xdffb('0x18'),_0xdffb('0x19'),_0xdffb('0x1a'),'disabled',_0xdffb('0x1b'),'blockedAt',_0xdffb('0x1c')],'where':{'name':_0x479900,'role':{'$or':[_0xdffb('0x1d'),_0xdffb('0x1e'),'agent']},'adSsoEnabled':!![]}});})[_0xdffb('0x1f')](function(_0x368bb7){if(!_0x368bb7||_0x368bb7&&_0x368bb7[_0xdffb('0x17')]!==_0x479900){throw new Error(_0xdffb('0x12'));}_0x84bc0a=_0x368bb7;var _0x480c9c=_0x84bc0a[_0xdffb('0x17')]+'@'+config[_0xdffb('0xa')][_0xdffb('0xd')];return adAuthenticate(config[_0xdffb('0xa')],_0x480c9c,_0x8456cb);})[_0xdffb('0x1f')](function(_0x3517fe){if(_0x84bc0a[_0xdffb('0x20')]){throw new Error(_0xdffb('0x12'));}if(_0x278b5e[_0xdffb('0x16')]>0x0){if(_0x84bc0a[_0xdffb('0x1b')]){if(moment(_0x84bc0a[_0xdffb('0x21')])[_0xdffb('0x22')](_0x278b5e[_0xdffb('0x16')],_0xdffb('0x23'))>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils[_0xdffb('0x24')](_0x84bc0a,0x0,![],null)[_0xdffb('0x1f')](function(){return utils[_0xdffb('0x25')](_0x84bc0a);})[_0xdffb('0x1f')](function(){return _0x2e2d64(null,_0x84bc0a);});}else{return utils['getLicense'](_0x84bc0a)[_0xdffb('0x1f')](function(){return _0x2e2d64(null,_0x84bc0a);});}}else{return utils['getLicense'](_0x84bc0a)['then'](function(){return _0x2e2d64(null,_0x84bc0a);});}})[_0xdffb('0x26')](function(_0x46742b){return _0x2e2d64(null,![],_0x46742b);});}function handleError(_0x56f35c,_0x493bbe,_0x3c1166){return _0x56f35c[_0xdffb('0x27')](_0x493bbe||0x1f4)[_0xdffb('0x28')]({'message':_0x3c1166?_0x3c1166[_0xdffb('0x29')]||_0x3c1166:''});}exports['login']=function(_0x3636e6,_0x5b92ec,_0x5946dd){passport[_0xdffb('0xe')](_0xdffb('0x2a'),function(_0x5649fa,_0x1a0226,_0x57a0cb){var _0x5558cc=_0x5649fa||_0x57a0cb;if(_0x5558cc){return handleError(_0x5b92ec,0x191,_0x5558cc);}if(!_0x1a0226){return handleError(_0x5b92ec,0x194,{'message':_0xdffb('0x2b')});}else{var _0x10ad55={'payload':{'id':_0x1a0226['id'],'role':_0x1a0226[_0xdffb('0x1a')]},'options':{'expiresIn':0x15180}};return authService[_0xdffb('0x2c')](_0x10ad55)['then'](function(_0x2d598e){_0x5b92ec[_0xdffb('0x2d')]({'id':_0x1a0226['id'],'token':_0x2d598e,'statusCall':'','isAlreadyLogged':_0x1a0226[_0xdffb('0x1c')]});});}})(_0x3636e6,_0x5b92ec,_0x5946dd);};passport[_0xdffb('0x2e')](_0xdffb('0x2a'),new LocalStrategy({'usernameField':_0xdffb('0x17'),'passwordField':_0xdffb('0x18')},function(_0x238d25,_0x166a3b,_0x107288){return ActiveDirectoryAuthenticate(db['User'],_0x238d25,_0x166a3b,_0x107288);})); \ No newline at end of file +var _0x8d5d=['adSsoEnabled','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','password','role','disabled','blockedAt','online','admin','user','agent','blocked','add','minutes','clearBlockUser','getLicense','catch','status','message','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','use','name','User','passport','passport-local','Strategy','moment','bluebird','util','../../mysqldb','../../config/utils','../../config/environment','api','undefined','activedirectory','url','authenticate','error','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','blockDuration','then'];(function(_0x5f4b36,_0x18cb34){var _0x4765ec=function(_0x2a6c85){while(--_0x2a6c85){_0x5f4b36['push'](_0x5f4b36['shift']());}};_0x4765ec(++_0x18cb34);}(_0x8d5d,0x10e));var _0xd8d5=function(_0x5bb3f0,_0x263eea){_0x5bb3f0=_0x5bb3f0-0x0;var _0x4a3015=_0x8d5d[_0x5bb3f0];return _0x4a3015;};'use strict';var passport=require(_0xd8d5('0x0'));var LocalStrategy=require(_0xd8d5('0x1'))[_0xd8d5('0x2')];var moment=require(_0xd8d5('0x3'));var ActiveDirectory=require('activedirectory2');var BPromise=require(_0xd8d5('0x4'));var util=require(_0xd8d5('0x5'));var db=require(_0xd8d5('0x6'))['db'];var authService=require('../../components/auth/service');var utils=require(_0xd8d5('0x7'));var config=require(_0xd8d5('0x8'));var logger=require('../../config/logger')(_0xd8d5('0x9'));function isActiveDirectoryConfigured(_0x144466){var _0x56d620=![];if(typeof _0x144466['activedirectory']!==_0xd8d5('0xa')){_0x56d620=_0x144466[_0xd8d5('0xb')]['baseDN']&&_0x144466[_0xd8d5('0xb')][_0xd8d5('0xc')]&&_0x144466[_0xd8d5('0xb')]['domain'];}return _0x56d620;}function adAuthenticate(_0x3aab7f,_0x4f6f51,_0x7e3601){return new BPromise(function(_0x3423ba,_0x5ad02c){try{var _0x2c5efa=new ActiveDirectory(_0x3aab7f);_0x2c5efa[_0xd8d5('0xd')](_0x4f6f51,_0x7e3601,function(_0x45a0f4,_0x31ebe6){if(_0x45a0f4){logger[_0xd8d5('0xe')](_0xd8d5('0xf'),_0x4f6f51,util[_0xd8d5('0x10')](_0x45a0f4,{'showHidden':![],'depth':null}));_0x5ad02c(_0xd8d5('0x11'));}else if(!_0x31ebe6){logger[_0xd8d5('0xe')](_0xd8d5('0x12'),_0x4f6f51);_0x5ad02c(_0xd8d5('0x11'));}else{_0x3423ba(_0x31ebe6);}});}catch(_0x4bca58){_0x5ad02c(_0x4bca58);}});}function ActiveDirectoryAuthenticate(_0x507dd3,_0x5b0b8a,_0x37ae00,_0x327417){var _0x2e5c3f,_0x115852;if(!isActiveDirectoryConfigured(config)){logger['error'](_0xd8d5('0x13'),_0x5b0b8a);return _0x327417(null,![],{'message':_0xd8d5('0x11')});}return db[_0xd8d5('0x14')][_0xd8d5('0x15')]({'where':{'id':0x1},'attributes':['adSsoEnabled',_0xd8d5('0x16')],'raw':!![]})[_0xd8d5('0x17')](function(_0x4d28ae){_0x2e5c3f=_0x4d28ae;if(!_0x2e5c3f[_0xd8d5('0x18')]){logger[_0xd8d5('0xe')](_0xd8d5('0x19'),_0x5b0b8a);throw new Error(_0xd8d5('0x11'));}return _0x507dd3[_0xd8d5('0x15')]({'attributes':['id','name',_0xd8d5('0x1a'),'salt',_0xd8d5('0x1b'),_0xd8d5('0x1c'),'blocked',_0xd8d5('0x1d'),_0xd8d5('0x1e')],'where':{'name':_0x5b0b8a,'role':{'$or':[_0xd8d5('0x1f'),_0xd8d5('0x20'),_0xd8d5('0x21')]},'adSsoEnabled':!![]}});})[_0xd8d5('0x17')](function(_0xdf5921){if(!_0xdf5921||_0xdf5921&&_0xdf5921['name']!==_0x5b0b8a){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}_0x115852=_0xdf5921;var _0x4c8d98=_0x115852['name']+'@'+config['activedirectory']['domain'];return adAuthenticate(config[_0xd8d5('0xb')],_0x4c8d98,_0x37ae00);})[_0xd8d5('0x17')](function(_0x12c113){if(_0x115852['disabled']){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x2e5c3f[_0xd8d5('0x16')]>0x0){if(_0x115852[_0xd8d5('0x22')]){if(moment(_0x115852[_0xd8d5('0x1d')])[_0xd8d5('0x23')](_0x2e5c3f['blockDuration'],_0xd8d5('0x24'))>moment()){throw new Error(_0xd8d5('0x11'));}return utils[_0xd8d5('0x25')](_0x115852,0x0,![],null)[_0xd8d5('0x17')](function(){return utils[_0xd8d5('0x26')](_0x115852);})[_0xd8d5('0x17')](function(){return _0x327417(null,_0x115852);});}else{return utils['getLicense'](_0x115852)['then'](function(){return _0x327417(null,_0x115852);});}}else{return utils[_0xd8d5('0x26')](_0x115852)['then'](function(){return _0x327417(null,_0x115852);});}})[_0xd8d5('0x27')](function(_0x51e77b){return _0x327417(null,![],_0x51e77b);});}function handleError(_0x444f5b,_0x4238c3,_0x54d56b){return _0x444f5b[_0xd8d5('0x28')](_0x4238c3||0x1f4)['send']({'message':_0x54d56b?_0x54d56b[_0xd8d5('0x29')]||_0x54d56b:''});}exports[_0xd8d5('0x2a')]=function(_0x5a5335,_0x2daee2,_0x379737){passport[_0xd8d5('0xd')](_0xd8d5('0x2b'),function(_0x2c24e3,_0x5ad95e,_0x1326ad){var _0x29a93b=_0x2c24e3||_0x1326ad;if(_0x29a93b){return handleError(_0x2daee2,0x191,_0x29a93b);}if(!_0x5ad95e){return handleError(_0x2daee2,0x194,{'message':_0xd8d5('0x2c')});}else{var _0x4481d6={'payload':{'id':_0x5ad95e['id'],'role':_0x5ad95e[_0xd8d5('0x1b')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x4481d6)[_0xd8d5('0x17')](function(_0x100270){_0x2daee2[_0xd8d5('0x2d')]({'id':_0x5ad95e['id'],'token':_0x100270,'statusCall':'','isAlreadyLogged':_0x5ad95e[_0xd8d5('0x1e')]});});}})(_0x5a5335,_0x2daee2,_0x379737);};passport[_0xd8d5('0x2e')]('ad-login',new LocalStrategy({'usernameField':_0xd8d5('0x2f'),'passwordField':_0xd8d5('0x1a')},function(_0x2c2c50,_0x56a25f,_0x13f18a){return ActiveDirectoryAuthenticate(db[_0xd8d5('0x30')],_0x2c2c50,_0x56a25f,_0x13f18a);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index a33e79d..0790430 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 _0x7e66=['Router','exports','express'];(function(_0x1150d0,_0x24f90e){var _0x48a927=function(_0x502654){while(--_0x502654){_0x1150d0['push'](_0x1150d0['shift']());}};_0x48a927(++_0x24f90e);}(_0x7e66,0xe9));var _0x67e6=function(_0x5dc6b6,_0x4771c5){_0x5dc6b6=_0x5dc6b6-0x0;var _0x4eb7e8=_0x7e66[_0x5dc6b6];return _0x4eb7e8;};'use strict';var express=require(_0x67e6('0x0'));var router=express[_0x67e6('0x1')]();var controller=require('./authActiveDirectory.controller');router['post']('/',controller['login']);module[_0x67e6('0x2')]=router; \ No newline at end of file +var _0x7cf7=['Router','./authActiveDirectory.controller','post','login','express'];(function(_0x13a201,_0x54bc68){var _0x1c2040=function(_0xaeca05){while(--_0xaeca05){_0x13a201['push'](_0x13a201['shift']());}};_0x1c2040(++_0x54bc68);}(_0x7cf7,0x1b2));var _0x77cf=function(_0x21ed11,_0x4ff1f7){_0x21ed11=_0x21ed11-0x0;var _0x126e3=_0x7cf7[_0x21ed11];return _0x126e3;};'use strict';var express=require(_0x77cf('0x0'));var router=express[_0x77cf('0x1')]();var controller=require(_0x77cf('0x2'));router[_0x77cf('0x3')]('/',controller[_0x77cf('0x4')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 22c3509..f6b181c 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x1780fb,_0xf933a4){var _0x2d1059=function(_0xfc88a0){while(--_0xfc88a0){_0x1780fb['push'](_0x1780fb['shift']());}};_0x2d1059(++_0xf933a4);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file +var _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x52d837,_0x385684){var _0x46890e=function(_0x3045d7){while(--_0x3045d7){_0x52d837['push'](_0x52d837['shift']());}};_0x46890e(++_0x385684);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 4b4cd7e..f1aec19 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 _0x45c9=['passport','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','login','/callback','isMiddleware','setTokenCookie','exports'];(function(_0x1ecf17,_0x2724d4){var _0x485a9e=function(_0x18773e){while(--_0x18773e){_0x1ecf17['push'](_0x1ecf17['shift']());}};_0x485a9e(++_0x2724d4);}(_0x45c9,0x96));var _0x945c=function(_0x93ab9b,_0x3e80ef){_0x93ab9b=_0x93ab9b-0x0;var _0x4e6b76=_0x45c9[_0x93ab9b];return _0x4e6b76;};'use strict';var express=require('express');var passport=require(_0x945c('0x0'));var router=express['Router']();var controller=require(_0x945c('0x1'));var userController=require(_0x945c('0x2'));var authService=require(_0x945c('0x3'));router[_0x945c('0x4')]('/',controller[_0x945c('0x5')]);router['get'](_0x945c('0x6'),controller['callback'],authService[_0x945c('0x7')],userController[_0x945c('0x5')],authService[_0x945c('0x8')]);module[_0x945c('0x9')]=router; \ No newline at end of file +var _0x26b7=['Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','login','/callback','callback','isMiddleware','setTokenCookie','exports','express','passport'];(function(_0x343e89,_0x9ca261){var _0x1c3623=function(_0x25410f){while(--_0x25410f){_0x343e89['push'](_0x343e89['shift']());}};_0x1c3623(++_0x9ca261);}(_0x26b7,0x16a));var _0x726b=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x26b7[_0x465a0c];return _0x1e202e;};'use strict';var express=require(_0x726b('0x0'));var passport=require(_0x726b('0x1'));var router=express[_0x726b('0x2')]();var controller=require(_0x726b('0x3'));var userController=require(_0x726b('0x4'));var authService=require(_0x726b('0x5'));router[_0x726b('0x6')]('/',controller[_0x726b('0x7')]);router[_0x726b('0x6')](_0x726b('0x8'),controller[_0x726b('0x9')],authService[_0x726b('0xa')],userController['login'],authService[_0x726b('0xb')]);module[_0x726b('0xc')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 70089d3..0641f07 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 _0x83bb=['message','send','login','authenticate','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','online','forgot','body','Email\x20parameter\x20is\x20missing','email','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','status','Reset\x20Email\x20sent!','reset','now','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','validatePasswordHistory','resetPasswordToken','use','local-login','util','passport','passport-local','Strategy','lodash','randomstring','../../mysqldb','client','http','Setting','findOne','then','name','password','salt','role','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','allowedLoginAttempts','blockDuration','add','clearBlockUser','minutes','getLicense','catch','find','MailServerOut','CloudProvider','getSmtpOptions','format','Smtp','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!'];(function(_0x3e8741,_0x40b2ad){var _0x8b0d66=function(_0x2c25ff){while(--_0x2c25ff){_0x3e8741['push'](_0x3e8741['shift']());}};_0x8b0d66(++_0x40b2ad);}(_0x83bb,0x1b7));var _0xb83b=function(_0xb05ed,_0x38964c){_0xb05ed=_0xb05ed-0x0;var _0x4ce84f=_0x83bb[_0xb05ed];return _0x4ce84f;};'use strict';var util=require(_0xb83b('0x0'));var passport=require(_0xb83b('0x1'));var LocalStrategy=require(_0xb83b('0x2'))[_0xb83b('0x3')];var jayson=require('jayson/promise');var _=require(_0xb83b('0x4'));var rs=require(_0xb83b('0x5'));var moment=require('moment');var db=require(_0xb83b('0x6'))['db'];var authService=require('../../components/auth/service');var utils=require('../../config/utils');var client=jayson[_0xb83b('0x7')][_0xb83b('0x8')]({'port':0x232b});function localAuthenticate(_0x292adb,_0x5c6dc9,_0x272d74,_0x1bb235){var _0x3ad566,_0x28049f;return db[_0xb83b('0x9')][_0xb83b('0xa')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]})[_0xb83b('0xb')](function(_0x48ec89){_0x3ad566=_0x48ec89;return _0x292adb['findOne']({'attributes':['id',_0xb83b('0xc'),_0xb83b('0xd'),_0xb83b('0xe'),_0xb83b('0xf'),_0xb83b('0x10'),_0xb83b('0x11'),_0xb83b('0x12'),_0xb83b('0x13')],'where':{'name':_0x5c6dc9,'role':{'$or':[_0xb83b('0x14'),_0xb83b('0x15'),_0xb83b('0x16')]}}});})[_0xb83b('0xb')](function(_0x1d0912){if(!_0x1d0912||_0x1d0912&&_0x1d0912[_0xb83b('0xc')]!==_0x5c6dc9){throw new Error(_0xb83b('0x17'));}else{_0x28049f=_0x1d0912;return _0x28049f;}})[_0xb83b('0xb')](function(){_0x28049f['authenticate'](_0x272d74,function(_0x510f88,_0x6147ff){var _0x4704a4=_0x28049f[_0xb83b('0x13')]+0x1;if(_0x510f88){return _0x1bb235(_0x510f88);}else if(!_0x6147ff){if(_0x28049f[_0xb83b('0x10')]){return _0x1bb235(null,![],{'message':_0xb83b('0x17')});}else if(_0x3ad566[_0xb83b('0x18')]>0x0){if(_0x28049f[_0xb83b('0x11')]){if(_0x3ad566[_0xb83b('0x19')]>0x0){if(moment(_0x28049f[_0xb83b('0x12')])[_0xb83b('0x1a')](_0x3ad566[_0xb83b('0x19')],'minutes')>moment()){return _0x1bb235(null,![],{'message':_0xb83b('0x17')});}else{return utils[_0xb83b('0x1b')](_0x28049f,_0x4704a4,![],null)[_0xb83b('0xb')](function(){return _0x1bb235(null,![],{'message':_0xb83b('0x17')});});}}else{return _0x1bb235(null,![],{'message':_0xb83b('0x17')});}}else{if(_0x4704a4>=_0x3ad566[_0xb83b('0x18')]){return utils[_0xb83b('0x1b')](_0x28049f,0x0,!![],moment())[_0xb83b('0xb')](function(){return _0x1bb235(null,![],{'message':_0xb83b('0x17')});});}else{return utils[_0xb83b('0x1b')](_0x28049f,_0x4704a4,![],null)[_0xb83b('0xb')](function(){return _0x1bb235(null,![],{'message':_0xb83b('0x17')});});}}}else{return _0x1bb235(null,![],{'message':_0xb83b('0x17')});}}else{if(_0x28049f[_0xb83b('0x10')]){return _0x1bb235(null,![],{'message':_0xb83b('0x17')});}else if(_0x3ad566[_0xb83b('0x18')]>0x0){if(_0x28049f['blocked']){if(_0x3ad566[_0xb83b('0x19')]>0x0){if(moment(_0x28049f[_0xb83b('0x12')])['add'](_0x3ad566[_0xb83b('0x19')],_0xb83b('0x1c'))>moment()){return _0x1bb235(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xb83b('0x1b')](_0x28049f,0x0,![],null)[_0xb83b('0xb')](function(){return utils['getLicense'](_0x28049f);})[_0xb83b('0xb')](function(){return _0x1bb235(null,_0x28049f);});}}else{return _0x1bb235(null,![],{'message':_0xb83b('0x17')});}}else{return utils[_0xb83b('0x1b')](_0x28049f,0x0,![],null)['then'](function(){return utils[_0xb83b('0x1d')](_0x28049f);})[_0xb83b('0xb')](function(){return _0x1bb235(null,_0x28049f);})[_0xb83b('0x1e')](function(_0x2b508b){return _0x1bb235(null,![],_0x2b508b);});}}else{if(_0x28049f[_0xb83b('0x11')]){return _0x1bb235(null,![],{'message':_0xb83b('0x17')});}else{return utils[_0xb83b('0x1d')](_0x28049f)[_0xb83b('0xb')](function(){return _0x1bb235(null,_0x28049f);});}}}});})[_0xb83b('0x1e')](function(_0x491b47){return _0x1bb235(null,![],_0x491b47);});}function sendServiceMail(_0x595d32){return db['MailAccount'][_0xb83b('0x1f')]({'where':{'service':!![]},'attributes':['id','name','email'],'include':[{'model':db[_0xb83b('0x20')],'as':'Smtp','include':[{'model':db[_0xb83b('0x21')],'as':_0xb83b('0x21')}]}]})[_0xb83b('0xb')](function(_0x5805e3){if(!_0x5805e3){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0xf67228=_0x5805e3[_0xb83b('0x22')]();var _0x3c393a={'account':_0xf67228,'message':_['merge']({'from':util[_0xb83b('0x23')]('\x22%s\x22\x20<%s>',_0x5805e3[_0xb83b('0xc')],_0x5805e3['email']||_0x5805e3[_0xb83b('0x24')]['user'])},_0x595d32)};return client[_0xb83b('0x25')](_0xb83b('0x26'),_0x3c393a);})[_0xb83b('0xb')](function(_0x13939d){if(_0x13939d[_0xb83b('0x27')]){throw new Error(util[_0xb83b('0x23')](_0xb83b('0x28'),_0x13939d['error'][_0xb83b('0x29')]||JSON['stringify'](_0x13939d[_0xb83b('0x27')])));}return!![];});}function handleError(_0x5cffc4,_0xdc32fe,_0x992ef6){return _0x5cffc4['status'](_0xdc32fe||0x1f4)[_0xb83b('0x2a')]({'message':_0x992ef6?_0x992ef6['message']||_0x992ef6:''});}exports[_0xb83b('0x2b')]=function(_0x3a568a,_0x41b7bd,_0x46f6df){passport[_0xb83b('0x2c')]('local-login',function(_0x5831cc,_0x167ec2,_0x1b7aac){var _0x2ffd48=_0x5831cc||_0x1b7aac;if(_0x2ffd48){return handleError(_0x41b7bd,0x191,_0x2ffd48);}if(!_0x167ec2){return handleError(_0x41b7bd,0x194,{'message':_0xb83b('0x2d')});}else{var _0x1adb0b={'payload':{'id':_0x167ec2['id'],'role':_0x167ec2['role']},'options':{'expiresIn':0x15180}};return authService[_0xb83b('0x2e')](_0x1adb0b)[_0xb83b('0xb')](function(_0x3a6c3b){_0x41b7bd['json']({'id':_0x167ec2['id'],'token':_0x3a6c3b,'statusCall':'','isAlreadyLogged':_0x167ec2[_0xb83b('0x2f')]});});}})(_0x3a568a,_0x41b7bd,_0x46f6df);};exports[_0xb83b('0x30')]=function(_0x248d39,_0x555546){if(!_0x248d39[_0xb83b('0x31')]['email']){return handleError(_0x555546,0x1f4,{'message':_0xb83b('0x32')});}var _0x42552a=rs['generate']();_0x248d39[_0xb83b('0x31')]['email']=_0x248d39['body'][_0xb83b('0x33')][_0xb83b('0x34')]()[_0xb83b('0x35')]();var _0x307e63;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0xb83b('0x18'),_0xb83b('0x19')],'raw':!![]})['then'](function(_0x5c0ac9){_0x307e63=_0x5c0ac9;return db[_0xb83b('0x36')]['find']({'where':{'email':_0x248d39['body'][_0xb83b('0x33')]}});})['then'](function(_0x5c0e6d){if(!_0x5c0e6d){throw new Error(_0xb83b('0x37'));}if(_0x5c0e6d['disabled']){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x5c0e6d['blocked']){if(moment(_0x5c0e6d['blockedAt'])['add'](_0x307e63['blockDuration'],_0xb83b('0x1c'))>moment()){throw new Error(_0xb83b('0x38'));}else{_0x5c0e6d[_0xb83b('0x11')]=![];_0x5c0e6d[_0xb83b('0x12')]=null;}}_0x5c0e6d['resetPasswordToken']=_0x42552a;_0x5c0e6d['resetPasswordExpires']=Date['now']()+0x36ee80;return _0x5c0e6d[_0xb83b('0x39')]();})[_0xb83b('0xb')](function(){return sendServiceMail({'to':_0x248d39[_0xb83b('0x31')][_0xb83b('0x33')],'subject':_0xb83b('0x3a'),'text':_0xb83b('0x3b')+_0xb83b('0x3c')+_0xb83b('0x3d')+_0x248d39[_0xb83b('0x3e')][_0xb83b('0x3f')]+_0xb83b('0x40')+_0x42552a+'\x0a\x0a'+_0xb83b('0x41')});})['then'](function(){_0x555546[_0xb83b('0x42')](0xc8)['send']({'message':_0xb83b('0x43')});})[_0xb83b('0x1e')](function(_0x4a3be9){return handleError(_0x555546,0x1f4,_0x4a3be9);});};exports[_0xb83b('0x44')]=function(_0x16ba19,_0x58ead1){return db['User'][_0xb83b('0x1f')]({'where':{'resetPasswordToken':_0x16ba19['params']['token'],'resetPasswordExpires':{'$gt':Date[_0xb83b('0x45')]()}}})[_0xb83b('0xb')](function(_0x207e95){if(!_0x207e95){throw new Error(_0xb83b('0x46'));}return db[_0xb83b('0x9')][_0xb83b('0xa')]({'attributes':['id',_0xb83b('0x47'),_0xb83b('0x48'),_0xb83b('0x49')]})[_0xb83b('0xb')](function(_0x128326){if(_0x128326['securePassword'])authService[_0xb83b('0x4a')](_0x16ba19[_0xb83b('0x31')][_0xb83b('0xd')]);if(!_0x128326[_0xb83b('0x48')]||!_0x207e95[_0xb83b('0x4b')])return _0x207e95;authService[_0xb83b('0x4c')](_0x16ba19['body'][_0xb83b('0xd')],_0x207e95[_0xb83b('0x4b')],_0x128326['passwordHistoryLimit']);return _0x207e95;})[_0xb83b('0xb')](function(){_0x207e95[_0xb83b('0xd')]=_0x16ba19[_0xb83b('0x31')][_0xb83b('0xd')];_0x207e95[_0xb83b('0x4d')]=null;_0x207e95['resetPasswordExpires']=null;return _0x207e95[_0xb83b('0x39')]();});})[_0xb83b('0xb')](function(){_0x58ead1[_0xb83b('0x42')](0xc8)[_0xb83b('0x2a')]({'message':'Password\x20reset!'});})[_0xb83b('0x1e')](function(_0x387635){return handleError(_0x58ead1,0x1f4,_0x387635);});};passport[_0xb83b('0x4e')](_0xb83b('0x4f'),new LocalStrategy({'usernameField':_0xb83b('0xc'),'passwordField':_0xb83b('0xd')},function(_0x2a8ee1,_0x2230dc,_0x8ae610){return localAuthenticate(db['User'],_0x2a8ee1,_0x2230dc,_0x8ae610);})); \ No newline at end of file +var _0xa7ba=['token','now','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','password','previousPasswords','validatePasswordHistory','Password\x20reset!','use','util','Strategy','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','client','http','Setting','allowedLoginAttempts','blockDuration','name','role','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','then','authenticate','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','minutes','clearBlockUser','add','getLicense','catch','MailAccount','find','email','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','merge','format','\x22%s\x22\x20<%s>','request','SendMail','message','stringify','error','status','send','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','findOne','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','save','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset'];(function(_0x34b87f,_0x28aef2){var _0x449805=function(_0x3735b7){while(--_0x3735b7){_0x34b87f['push'](_0x34b87f['shift']());}};_0x449805(++_0x28aef2);}(_0xa7ba,0x1aa));var _0xaa7b=function(_0x3a683a,_0x353ce3){_0x3a683a=_0x3a683a-0x0;var _0x8e4b97=_0xa7ba[_0x3a683a];return _0x8e4b97;};'use strict';var util=require(_0xaa7b('0x0'));var passport=require('passport');var LocalStrategy=require('passport-local')[_0xaa7b('0x1')];var jayson=require(_0xaa7b('0x2'));var _=require(_0xaa7b('0x3'));var rs=require(_0xaa7b('0x4'));var moment=require(_0xaa7b('0x5'));var db=require(_0xaa7b('0x6'))['db'];var authService=require(_0xaa7b('0x7'));var utils=require('../../config/utils');var client=jayson[_0xaa7b('0x8')][_0xaa7b('0x9')]({'port':0x232b});function localAuthenticate(_0x2bca95,_0x3bfd84,_0x45e5fa,_0x592e92){var _0x54274e,_0x4b6b99;return db[_0xaa7b('0xa')]['findOne']({'where':{'id':0x1},'attributes':[_0xaa7b('0xb'),_0xaa7b('0xc')],'raw':!![]})['then'](function(_0x1c8dc0){_0x54274e=_0x1c8dc0;return _0x2bca95['findOne']({'attributes':['id',_0xaa7b('0xd'),'password','salt',_0xaa7b('0xe'),_0xaa7b('0xf'),_0xaa7b('0x10'),_0xaa7b('0x11'),_0xaa7b('0x12')],'where':{'name':_0x3bfd84,'role':{'$or':[_0xaa7b('0x13'),_0xaa7b('0x14'),_0xaa7b('0x15')]}}});})[_0xaa7b('0x16')](function(_0x5300cf){if(!_0x5300cf||_0x5300cf&&_0x5300cf[_0xaa7b('0xd')]!==_0x3bfd84){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x4b6b99=_0x5300cf;return _0x4b6b99;}})[_0xaa7b('0x16')](function(){_0x4b6b99[_0xaa7b('0x17')](_0x45e5fa,function(_0x384bbf,_0xc35dfa){var _0x1e59c2=_0x4b6b99[_0xaa7b('0x12')]+0x1;if(_0x384bbf){return _0x592e92(_0x384bbf);}else if(!_0xc35dfa){if(_0x4b6b99['disabled']){return _0x592e92(null,![],{'message':_0xaa7b('0x18')});}else if(_0x54274e[_0xaa7b('0xb')]>0x0){if(_0x4b6b99[_0xaa7b('0x10')]){if(_0x54274e[_0xaa7b('0xc')]>0x0){if(moment(_0x4b6b99[_0xaa7b('0x11')])['add'](_0x54274e[_0xaa7b('0xc')],_0xaa7b('0x19'))>moment()){return _0x592e92(null,![],{'message':_0xaa7b('0x18')});}else{return utils['clearBlockUser'](_0x4b6b99,_0x1e59c2,![],null)[_0xaa7b('0x16')](function(){return _0x592e92(null,![],{'message':_0xaa7b('0x18')});});}}else{return _0x592e92(null,![],{'message':_0xaa7b('0x18')});}}else{if(_0x1e59c2>=_0x54274e['allowedLoginAttempts']){return utils[_0xaa7b('0x1a')](_0x4b6b99,0x0,!![],moment())[_0xaa7b('0x16')](function(){return _0x592e92(null,![],{'message':_0xaa7b('0x18')});});}else{return utils[_0xaa7b('0x1a')](_0x4b6b99,_0x1e59c2,![],null)[_0xaa7b('0x16')](function(){return _0x592e92(null,![],{'message':_0xaa7b('0x18')});});}}}else{return _0x592e92(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x4b6b99[_0xaa7b('0xf')]){return _0x592e92(null,![],{'message':_0xaa7b('0x18')});}else if(_0x54274e['allowedLoginAttempts']>0x0){if(_0x4b6b99[_0xaa7b('0x10')]){if(_0x54274e[_0xaa7b('0xc')]>0x0){if(moment(_0x4b6b99[_0xaa7b('0x11')])[_0xaa7b('0x1b')](_0x54274e[_0xaa7b('0xc')],_0xaa7b('0x19'))>moment()){return _0x592e92(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xaa7b('0x1a')](_0x4b6b99,0x0,![],null)[_0xaa7b('0x16')](function(){return utils['getLicense'](_0x4b6b99);})[_0xaa7b('0x16')](function(){return _0x592e92(null,_0x4b6b99);});}}else{return _0x592e92(null,![],{'message':_0xaa7b('0x18')});}}else{return utils[_0xaa7b('0x1a')](_0x4b6b99,0x0,![],null)['then'](function(){return utils[_0xaa7b('0x1c')](_0x4b6b99);})['then'](function(){return _0x592e92(null,_0x4b6b99);})[_0xaa7b('0x1d')](function(_0x3865d7){return _0x592e92(null,![],_0x3865d7);});}}else{if(_0x4b6b99[_0xaa7b('0x10')]){return _0x592e92(null,![],{'message':_0xaa7b('0x18')});}else{return utils[_0xaa7b('0x1c')](_0x4b6b99)['then'](function(){return _0x592e92(null,_0x4b6b99);});}}}});})[_0xaa7b('0x1d')](function(_0x439cb0){return _0x592e92(null,![],_0x439cb0);});}function sendServiceMail(_0x5efae7){return db[_0xaa7b('0x1e')][_0xaa7b('0x1f')]({'where':{'service':!![]},'attributes':['id','name',_0xaa7b('0x20')],'include':[{'model':db['MailServerOut'],'as':_0xaa7b('0x21'),'include':[{'model':db[_0xaa7b('0x22')],'as':'CloudProvider'}]}]})['then'](function(_0x38b9d3){if(!_0x38b9d3){throw new Error(_0xaa7b('0x23'));}var _0x452917=_0x38b9d3['getSmtpOptions']();var _0x5195e2={'account':_0x452917,'message':_[_0xaa7b('0x24')]({'from':util[_0xaa7b('0x25')](_0xaa7b('0x26'),_0x38b9d3['name'],_0x38b9d3[_0xaa7b('0x20')]||_0x38b9d3[_0xaa7b('0x21')]['user'])},_0x5efae7)};return client[_0xaa7b('0x27')](_0xaa7b('0x28'),_0x5195e2);})['then'](function(_0x4f4c80){if(_0x4f4c80['error']){throw new Error(util[_0xaa7b('0x25')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x4f4c80['error'][_0xaa7b('0x29')]||JSON[_0xaa7b('0x2a')](_0x4f4c80[_0xaa7b('0x2b')])));}return!![];});}function handleError(_0x354e4f,_0x148fce,_0x30b0d5){return _0x354e4f[_0xaa7b('0x2c')](_0x148fce||0x1f4)[_0xaa7b('0x2d')]({'message':_0x30b0d5?_0x30b0d5['message']||_0x30b0d5:''});}exports['login']=function(_0xe2550e,_0x3a8ee1,_0x918ba){passport[_0xaa7b('0x17')](_0xaa7b('0x2e'),function(_0x52f5f0,_0x3f70a0,_0xe28a50){var _0x3ce630=_0x52f5f0||_0xe28a50;if(_0x3ce630){return handleError(_0x3a8ee1,0x191,_0x3ce630);}if(!_0x3f70a0){return handleError(_0x3a8ee1,0x194,{'message':_0xaa7b('0x2f')});}else{var _0x4c8f1a={'payload':{'id':_0x3f70a0['id'],'role':_0x3f70a0[_0xaa7b('0xe')]},'options':{'expiresIn':0x15180}};return authService[_0xaa7b('0x30')](_0x4c8f1a)[_0xaa7b('0x16')](function(_0x375bac){_0x3a8ee1[_0xaa7b('0x31')]({'id':_0x3f70a0['id'],'token':_0x375bac,'statusCall':'','isAlreadyLogged':_0x3f70a0[_0xaa7b('0x32')]});});}})(_0xe2550e,_0x3a8ee1,_0x918ba);};exports[_0xaa7b('0x33')]=function(_0x154000,_0x116372){if(!_0x154000[_0xaa7b('0x34')][_0xaa7b('0x20')]){return handleError(_0x116372,0x1f4,{'message':_0xaa7b('0x35')});}var _0x347e62=rs[_0xaa7b('0x36')]();_0x154000[_0xaa7b('0x34')][_0xaa7b('0x20')]=_0x154000['body'][_0xaa7b('0x20')][_0xaa7b('0x37')]()[_0xaa7b('0x38')]();var _0x1ac325;return db[_0xaa7b('0xa')][_0xaa7b('0x39')]({'where':{'id':0x1},'attributes':[_0xaa7b('0xb'),_0xaa7b('0xc')],'raw':!![]})[_0xaa7b('0x16')](function(_0x19f591){_0x1ac325=_0x19f591;return db[_0xaa7b('0x3a')][_0xaa7b('0x1f')]({'where':{'email':_0x154000[_0xaa7b('0x34')][_0xaa7b('0x20')]}});})[_0xaa7b('0x16')](function(_0x2d7a45){if(!_0x2d7a45){throw new Error(_0xaa7b('0x3b'));}if(_0x2d7a45[_0xaa7b('0xf')]){throw new Error(_0xaa7b('0x3c'));}if(_0x2d7a45['blocked']){if(moment(_0x2d7a45[_0xaa7b('0x11')])[_0xaa7b('0x1b')](_0x1ac325[_0xaa7b('0xc')],'minutes')>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x2d7a45[_0xaa7b('0x10')]=![];_0x2d7a45[_0xaa7b('0x11')]=null;}}_0x2d7a45[_0xaa7b('0x3d')]=_0x347e62;_0x2d7a45[_0xaa7b('0x3e')]=Date['now']()+0x36ee80;return _0x2d7a45[_0xaa7b('0x3f')]();})[_0xaa7b('0x16')](function(){return sendServiceMail({'to':_0x154000[_0xaa7b('0x34')]['email'],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0xaa7b('0x40')+_0xaa7b('0x41')+_0xaa7b('0x42')+_0x154000['headers'][_0xaa7b('0x43')]+_0xaa7b('0x44')+_0x347e62+'\x0a\x0a'+_0xaa7b('0x45')});})[_0xaa7b('0x16')](function(){_0x116372[_0xaa7b('0x2c')](0xc8)[_0xaa7b('0x2d')]({'message':_0xaa7b('0x46')});})[_0xaa7b('0x1d')](function(_0x41cd22){return handleError(_0x116372,0x1f4,_0x41cd22);});};exports[_0xaa7b('0x47')]=function(_0x22bd7b,_0x1e3927){return db[_0xaa7b('0x3a')]['find']({'where':{'resetPasswordToken':_0x22bd7b['params'][_0xaa7b('0x48')],'resetPasswordExpires':{'$gt':Date[_0xaa7b('0x49')]()}}})[_0xaa7b('0x16')](function(_0x46d39c){if(!_0x46d39c){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db[_0xaa7b('0xa')]['findOne']({'attributes':['id',_0xaa7b('0x4a'),_0xaa7b('0x4b'),_0xaa7b('0x4c')]})['then'](function(_0x12a215){if(_0x12a215[_0xaa7b('0x4a')])authService[_0xaa7b('0x4d')](_0x22bd7b[_0xaa7b('0x34')][_0xaa7b('0x4e')]);if(!_0x12a215[_0xaa7b('0x4b')]||!_0x46d39c[_0xaa7b('0x4f')])return _0x46d39c;authService[_0xaa7b('0x50')](_0x22bd7b[_0xaa7b('0x34')][_0xaa7b('0x4e')],_0x46d39c['previousPasswords'],_0x12a215[_0xaa7b('0x4c')]);return _0x46d39c;})[_0xaa7b('0x16')](function(){_0x46d39c[_0xaa7b('0x4e')]=_0x22bd7b[_0xaa7b('0x34')][_0xaa7b('0x4e')];_0x46d39c[_0xaa7b('0x3d')]=null;_0x46d39c[_0xaa7b('0x3e')]=null;return _0x46d39c['save']();});})[_0xaa7b('0x16')](function(){_0x1e3927[_0xaa7b('0x2c')](0xc8)[_0xaa7b('0x2d')]({'message':_0xaa7b('0x51')});})[_0xaa7b('0x1d')](function(_0x50dc81){return handleError(_0x1e3927,0x1f4,_0x50dc81);});};passport[_0xaa7b('0x52')](_0xaa7b('0x2e'),new LocalStrategy({'usernameField':_0xaa7b('0xd'),'passwordField':'password'},function(_0x369ed1,_0x2e702e,_0x9478cb){return localAuthenticate(db['User'],_0x369ed1,_0x2e702e,_0x9478cb);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 9185a9e..436bb8f 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 _0x602b=['/reset/:token','reset','exports','Router','post','/forgot','forgot'];(function(_0x5a27fe,_0x43993b){var _0x121c88=function(_0x2aff1f){while(--_0x2aff1f){_0x5a27fe['push'](_0x5a27fe['shift']());}};_0x121c88(++_0x43993b);}(_0x602b,0x14c));var _0xb602=function(_0x4d3770,_0x1adea9){_0x4d3770=_0x4d3770-0x0;var _0x443579=_0x602b[_0x4d3770];return _0x443579;};'use strict';var express=require('express');var router=express[_0xb602('0x0')]();var controller=require('./authLocal.controller');router['post']('/',controller['login']);router[_0xb602('0x1')](_0xb602('0x2'),controller[_0xb602('0x3')]);router[_0xb602('0x1')](_0xb602('0x4'),controller[_0xb602('0x5')]);module[_0xb602('0x6')]=router; \ No newline at end of file +var _0xe48a=['Router','./authLocal.controller','post','login','/forgot','/reset/:token','reset'];(function(_0x323d87,_0x4ef3f9){var _0x5e8f74=function(_0x185735){while(--_0x185735){_0x323d87['push'](_0x323d87['shift']());}};_0x5e8f74(++_0x4ef3f9);}(_0xe48a,0x1e3));var _0xae48=function(_0xf43cb,_0x465374){_0xf43cb=_0xf43cb-0x0;var _0x14e869=_0xe48a[_0xf43cb];return _0x14e869;};'use strict';var express=require('express');var router=express[_0xae48('0x0')]();var controller=require(_0xae48('0x1'));router[_0xae48('0x2')]('/',controller[_0xae48('0x3')]);router[_0xae48('0x2')](_0xae48('0x4'),controller['forgot']);router['post'](_0xae48('0x5'),controller[_0xae48('0x6')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 551eda0..39d2a12 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 _0x3223=['exports','STRING','BOOLEAN','INTEGER','sequelize'];(function(_0x3e7b39,_0x2c2110){var _0x4ad001=function(_0x3fd134){while(--_0x3fd134){_0x3e7b39['push'](_0x3e7b39['shift']());}};_0x4ad001(++_0x2c2110);}(_0x3223,0xbd));var _0x3322=function(_0x3106eb,_0x165c89){_0x3106eb=_0x3106eb-0x0;var _0x16369e=_0x3223[_0x3106eb];return _0x16369e;};'use strict';var Sequelize=require(_0x3322('0x0'));module[_0x3322('0x1')]={'name':{'type':Sequelize[_0x3322('0x2')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3322('0x2')]},'status':{'type':Sequelize[_0x3322('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x3322('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0xee69=['INTEGER','sequelize','exports','STRING','BOOLEAN'];(function(_0x2aa997,_0x35e10a){var _0x279a25=function(_0x45d656){while(--_0x45d656){_0x2aa997['push'](_0x2aa997['shift']());}};_0x279a25(++_0x35e10a);}(_0xee69,0x92));var _0x9ee6=function(_0x1327c6,_0x5ccd76){_0x1327c6=_0x1327c6-0x0;var _0x2cadd2=_0xee69[_0x1327c6];return _0x2cadd2;};'use strict';var Sequelize=require(_0x9ee6('0x0'));module[_0x9ee6('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0x9ee6('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x9ee6('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x9ee6('0x4')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index a06b2a0..529f4bc 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 _0x9ada=['path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','stack','name','index','map','Automation','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','destroy','addConditions','Condition','ids','omit','getConditions','order','addActions','getActions','findOne','Action','pick','nolimit','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util'];(function(_0xde78f8,_0x19713c){var _0x1c2ec9=function(_0x33d448){while(--_0x33d448){_0xde78f8['push'](_0xde78f8['shift']());}};_0x1c2ec9(++_0x19713c);}(_0x9ada,0xa9));var _0xa9ad=function(_0x1667c2,_0x50a7c4){_0x1667c2=_0x1667c2-0x0;var _0x142d18=_0x9ada[_0x1667c2];return _0x142d18;};'use strict';var emlformat=require(_0xa9ad('0x0'));var rimraf=require(_0xa9ad('0x1'));var zipdir=require(_0xa9ad('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa9ad('0x3'));var moment=require(_0xa9ad('0x4'));var BPromise=require(_0xa9ad('0x5'));var Mustache=require('mustache');var util=require(_0xa9ad('0x6'));var path=require(_0xa9ad('0x7'));var sox=require(_0xa9ad('0x8'));var csv=require(_0xa9ad('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa9ad('0xa'));var _=require(_0xa9ad('0xb'));var squel=require(_0xa9ad('0xc'));var crypto=require(_0xa9ad('0xd'));var jsforce=require(_0xa9ad('0xe'));var deskjs=require(_0xa9ad('0xf'));var toCsv=require('to-csv');var querystring=require(_0xa9ad('0x10'));var Papa=require(_0xa9ad('0x11'));var Redis=require(_0xa9ad('0x12'));var authService=require(_0xa9ad('0x13'));var qs=require(_0xa9ad('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa9ad('0x15'));var logger=require(_0xa9ad('0x16'))(_0xa9ad('0x17'));var utils=require(_0xa9ad('0x18'));var config=require(_0xa9ad('0x19'));var licenseUtil=require(_0xa9ad('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x152292,_0x544055){_0x544055=_0x544055||0xcc;return function(_0x173698){if(_0x173698){return _0x152292[_0xa9ad('0x1b')](_0x544055);}return _0x152292[_0xa9ad('0x1c')](_0x544055)[_0xa9ad('0x1d')]();};}function respondWithResult(_0x445171,_0x3284f2){_0x3284f2=_0x3284f2||0xc8;return function(_0x319306){if(_0x319306){return _0x445171[_0xa9ad('0x1c')](_0x3284f2)[_0xa9ad('0x1e')](_0x319306);}};}function respondWithFilteredResult(_0x4e0bb1,_0x48c87f){return function(_0x2e22d1){if(_0x2e22d1){var _0x2428f7=typeof _0x48c87f[_0xa9ad('0x1f')]===_0xa9ad('0x20')&&typeof _0x48c87f[_0xa9ad('0x21')]===_0xa9ad('0x20');var _0x3fa6ec=_0x2e22d1[_0xa9ad('0x22')];var _0x3421dc=_0x2428f7?0x0:_0x48c87f['offset'];var _0x403df3=_0x2428f7?_0x2e22d1[_0xa9ad('0x22')]:_0x48c87f['offset']+_0x48c87f[_0xa9ad('0x21')];var _0x5bf1f7;if(_0x403df3>=_0x3fa6ec){_0x403df3=_0x3fa6ec;_0x5bf1f7=0xc8;}else{_0x5bf1f7=0xce;}_0x4e0bb1[_0xa9ad('0x1c')](_0x5bf1f7);return _0x4e0bb1[_0xa9ad('0x23')](_0xa9ad('0x24'),_0x3421dc+'-'+_0x403df3+'/'+_0x3fa6ec)['json'](_0x2e22d1);}return null;};}function patchUpdates(_0x3c7b06){return function(_0x5d1d63){try{jsonpatch['apply'](_0x5d1d63,_0x3c7b06,!![]);}catch(_0x94bd78){return BPromise[_0xa9ad('0x25')](_0x94bd78);}return _0x5d1d63[_0xa9ad('0x26')]();};}function saveUpdates(_0x39f7e9,_0x1997f2){return function(_0x576d6a){if(_0x576d6a){return _0x576d6a[_0xa9ad('0x27')](_0x39f7e9)['then'](function(_0x214a71){return _0x214a71;});}return null;};}function removeEntity(_0x48c41b,_0xc4536f){return function(_0x4a2ab2){if(_0x4a2ab2){return _0x4a2ab2['destroy']()[_0xa9ad('0x28')](function(){_0x48c41b[_0xa9ad('0x1c')](0xcc)[_0xa9ad('0x1d')]();});}};}function handleEntityNotFound(_0x56a374,_0x566004){return function(_0x19daec){if(!_0x19daec){_0x56a374['sendStatus'](0x194);}return _0x19daec;};}function handleError(_0x12b95e,_0x418705){_0x418705=_0x418705||0x1f4;return function(_0x512bd0){logger[_0xa9ad('0x29')](_0x512bd0[_0xa9ad('0x2a')]);if(_0x512bd0[_0xa9ad('0x2b')]){delete _0x512bd0[_0xa9ad('0x2b')];}_0x12b95e[_0xa9ad('0x1c')](_0x418705)['send'](_0x512bd0);};}exports[_0xa9ad('0x2c')]=function(_0x54ef05,_0x514a21){var _0x28dcd2={},_0x4d0118={},_0x3fa31b={'count':0x0,'rows':[]};var _0x6ec464=_[_0xa9ad('0x2d')](db[_0xa9ad('0x2e')]['rawAttributes'],function(_0x22f870){return{'name':_0x22f870['fieldName'],'type':_0x22f870['type'][_0xa9ad('0x2f')]};});_0x4d0118[_0xa9ad('0x30')]=_[_0xa9ad('0x2d')](_0x6ec464,_0xa9ad('0x2b'));_0x4d0118[_0xa9ad('0x31')]=_[_0xa9ad('0x32')](_0x54ef05['query']);_0x4d0118['filters']=_[_0xa9ad('0x33')](_0x4d0118['model'],_0x4d0118[_0xa9ad('0x31')]);_0x28dcd2[_0xa9ad('0x34')]=_[_0xa9ad('0x33')](_0x4d0118[_0xa9ad('0x30')],qs[_0xa9ad('0x35')](_0x54ef05[_0xa9ad('0x31')][_0xa9ad('0x35')]));_0x28dcd2[_0xa9ad('0x34')]=_0x28dcd2['attributes'][_0xa9ad('0x36')]?_0x28dcd2[_0xa9ad('0x34')]:_0x4d0118[_0xa9ad('0x30')];if(!_0x54ef05[_0xa9ad('0x31')][_0xa9ad('0x37')]('nolimit')){_0x28dcd2[_0xa9ad('0x21')]=qs[_0xa9ad('0x21')](_0x54ef05['query'][_0xa9ad('0x21')]);_0x28dcd2[_0xa9ad('0x1f')]=qs[_0xa9ad('0x1f')](_0x54ef05['query'][_0xa9ad('0x1f')]);}_0x28dcd2['order']=qs['sort'](_0x54ef05[_0xa9ad('0x31')][_0xa9ad('0x38')]);_0x28dcd2[_0xa9ad('0x39')]=qs[_0xa9ad('0x3a')](_['pick'](_0x54ef05['query'],_0x4d0118[_0xa9ad('0x3a')]),_0x6ec464);if(_0x54ef05['query'][_0xa9ad('0x3b')]){_0x28dcd2['where']=_[_0xa9ad('0x3c')](_0x28dcd2['where'],{'$or':_[_0xa9ad('0x2d')](_0x6ec464,function(_0x1e68a0){if(_0x1e68a0[_0xa9ad('0x3d')]!==_0xa9ad('0x3e')){var _0x5f3818={};_0x5f3818[_0x1e68a0[_0xa9ad('0x2b')]]={'$like':'%'+_0x54ef05[_0xa9ad('0x31')][_0xa9ad('0x3b')]+'%'};return _0x5f3818;}})});}_0x28dcd2=_[_0xa9ad('0x3c')]({},_0x28dcd2,_0x54ef05[_0xa9ad('0x3f')]);var _0x1155c3={'where':_0x28dcd2['where']};return db[_0xa9ad('0x2e')]['count'](_0x1155c3)[_0xa9ad('0x28')](function(_0x2c6d17){_0x3fa31b['count']=_0x2c6d17;if(_0x54ef05[_0xa9ad('0x31')][_0xa9ad('0x40')]){_0x28dcd2['include']=[{'all':!![]}];}return db['Automation'][_0xa9ad('0x41')](_0x28dcd2);})[_0xa9ad('0x28')](function(_0x7c372d){_0x3fa31b[_0xa9ad('0x42')]=_0x7c372d;return _0x3fa31b;})['then'](respondWithFilteredResult(_0x514a21,_0x28dcd2))[_0xa9ad('0x43')](handleError(_0x514a21,null));};exports[_0xa9ad('0x44')]=function(_0x145ad2,_0x425069){var _0x4924fc={'raw':![],'where':{'id':_0x145ad2[_0xa9ad('0x45')]['id']}},_0x71f21d={};_0x71f21d['model']=_['keys'](db[_0xa9ad('0x2e')][_0xa9ad('0x46')]);_0x71f21d[_0xa9ad('0x31')]=_[_0xa9ad('0x32')](_0x145ad2[_0xa9ad('0x31')]);_0x71f21d[_0xa9ad('0x3a')]=_[_0xa9ad('0x33')](_0x71f21d[_0xa9ad('0x30')],_0x71f21d[_0xa9ad('0x31')]);_0x4924fc[_0xa9ad('0x34')]=_[_0xa9ad('0x33')](_0x71f21d[_0xa9ad('0x30')],qs['fields'](_0x145ad2[_0xa9ad('0x31')][_0xa9ad('0x35')]));_0x4924fc['attributes']=_0x4924fc['attributes'][_0xa9ad('0x36')]?_0x4924fc[_0xa9ad('0x34')]:_0x71f21d[_0xa9ad('0x30')];if(_0x145ad2[_0xa9ad('0x31')][_0xa9ad('0x40')]){_0x4924fc[_0xa9ad('0x47')]=[{'all':!![]}];}_0x4924fc=_[_0xa9ad('0x3c')]({},_0x4924fc,_0x145ad2[_0xa9ad('0x3f')]);return db[_0xa9ad('0x2e')][_0xa9ad('0x48')](_0x4924fc)[_0xa9ad('0x28')](handleEntityNotFound(_0x425069,null))[_0xa9ad('0x28')](respondWithResult(_0x425069,null))[_0xa9ad('0x43')](handleError(_0x425069,null));};exports[_0xa9ad('0x49')]=function(_0x82059d,_0x15d5d1){return db[_0xa9ad('0x2e')][_0xa9ad('0x49')](_0x82059d[_0xa9ad('0x4a')],{})['then'](respondWithResult(_0x15d5d1,0xc9))[_0xa9ad('0x43')](handleError(_0x15d5d1,null));};exports[_0xa9ad('0x27')]=function(_0x3d9de6,_0x56f0bd){if(_0x3d9de6[_0xa9ad('0x4a')]['id']){delete _0x3d9de6[_0xa9ad('0x4a')]['id'];}return db[_0xa9ad('0x2e')][_0xa9ad('0x48')]({'where':{'id':_0x3d9de6[_0xa9ad('0x45')]['id']}})['then'](handleEntityNotFound(_0x56f0bd,null))[_0xa9ad('0x28')](saveUpdates(_0x3d9de6[_0xa9ad('0x4a')],null))[_0xa9ad('0x28')](respondWithResult(_0x56f0bd,null))['catch'](handleError(_0x56f0bd,null));};exports[_0xa9ad('0x4b')]=function(_0x4f4059,_0x422104){return db[_0xa9ad('0x2e')]['find']({'where':{'id':_0x4f4059['params']['id']}})[_0xa9ad('0x28')](handleEntityNotFound(_0x422104,null))[_0xa9ad('0x28')](removeEntity(_0x422104,null))[_0xa9ad('0x43')](handleError(_0x422104,null));};exports[_0xa9ad('0x4c')]=function(_0x193b85,_0x2c1862,_0x3ba4f5){return db[_0xa9ad('0x4d')][_0xa9ad('0x48')]({'where':{'id':_0x193b85[_0xa9ad('0x45')]['id']}})[_0xa9ad('0x28')](handleEntityNotFound(_0x2c1862,null))['then'](function(_0x5f0815){if(_0x5f0815){return _0x5f0815[_0xa9ad('0x4c')](_0x193b85[_0xa9ad('0x4a')][_0xa9ad('0x4e')],_[_0xa9ad('0x4f')](_0x193b85[_0xa9ad('0x4a')],['ids','id'])||{});}})[_0xa9ad('0x28')](respondWithResult(_0x2c1862,null))['catch'](handleError(_0x2c1862,null));};exports[_0xa9ad('0x50')]=function(_0x48b7f5,_0x5ddb6d,_0x159bbf){var _0x321401={};var _0x358ea7={};var _0x10ab7c;var _0x401ccd;return db[_0xa9ad('0x2e')]['findOne']({'where':{'id':_0x48b7f5['params']['id']}})['then'](handleEntityNotFound(_0x5ddb6d,null))[_0xa9ad('0x28')](function(_0x84e05){if(_0x84e05){_0x10ab7c=_0x84e05;_0x358ea7[_0xa9ad('0x30')]=_[_0xa9ad('0x32')](db[_0xa9ad('0x4d')][_0xa9ad('0x46')]);_0x358ea7['query']=_[_0xa9ad('0x32')](_0x48b7f5['query']);_0x358ea7[_0xa9ad('0x3a')]=_['intersection'](_0x358ea7[_0xa9ad('0x30')],_0x358ea7[_0xa9ad('0x31')]);_0x321401[_0xa9ad('0x34')]=_[_0xa9ad('0x33')](_0x358ea7[_0xa9ad('0x30')],qs[_0xa9ad('0x35')](_0x48b7f5[_0xa9ad('0x31')][_0xa9ad('0x35')]));_0x321401[_0xa9ad('0x34')]=_0x321401[_0xa9ad('0x34')][_0xa9ad('0x36')]?_0x321401[_0xa9ad('0x34')]:_0x358ea7['model'];_0x321401[_0xa9ad('0x51')]=qs[_0xa9ad('0x38')](_0x48b7f5[_0xa9ad('0x31')][_0xa9ad('0x38')]);_0x321401[_0xa9ad('0x39')]=qs[_0xa9ad('0x3a')](_['pick'](_0x48b7f5[_0xa9ad('0x31')],_0x358ea7[_0xa9ad('0x3a')]));if(_0x48b7f5['query'][_0xa9ad('0x3b')]){_0x321401[_0xa9ad('0x39')]=_['merge'](_0x321401['where'],{'$or':_['map'](_0x321401[_0xa9ad('0x34')],function(_0x687bce){var _0x110c68={};_0x110c68[_0x687bce]={'$like':'%'+_0x48b7f5[_0xa9ad('0x31')][_0xa9ad('0x3b')]+'%'};return _0x110c68;})});}_0x321401=_[_0xa9ad('0x3c')]({},_0x321401,_0x48b7f5['options']);return _0x10ab7c[_0xa9ad('0x50')](_0x321401);}})[_0xa9ad('0x28')](function(_0x435a73){if(_0x435a73){_0x401ccd=_0x435a73['length'];if(!_0x48b7f5['query'][_0xa9ad('0x37')]('nolimit')){_0x321401['limit']=qs[_0xa9ad('0x21')](_0x48b7f5[_0xa9ad('0x31')]['limit']);_0x321401[_0xa9ad('0x1f')]=qs['offset'](_0x48b7f5[_0xa9ad('0x31')][_0xa9ad('0x1f')]);}return _0x10ab7c[_0xa9ad('0x50')](_0x321401);}})[_0xa9ad('0x28')](function(_0x30bb5a){if(_0x30bb5a){return _0x30bb5a?{'count':_0x401ccd,'rows':_0x30bb5a}:null;}})['then'](respondWithResult(_0x5ddb6d,null))[_0xa9ad('0x43')](handleError(_0x5ddb6d,null));};exports[_0xa9ad('0x52')]=function(_0x1aea29,_0x5a7b9e,_0x1e95fc){return db['Action'][_0xa9ad('0x48')]({'where':{'id':_0x1aea29[_0xa9ad('0x45')]['id']}})[_0xa9ad('0x28')](handleEntityNotFound(_0x5a7b9e,null))[_0xa9ad('0x28')](function(_0x1b572e){if(_0x1b572e){return _0x1b572e[_0xa9ad('0x52')](_0x1aea29['body'][_0xa9ad('0x4e')],_[_0xa9ad('0x4f')](_0x1aea29['body'],[_0xa9ad('0x4e'),'id'])||{});}})[_0xa9ad('0x28')](respondWithResult(_0x5a7b9e,null))['catch'](handleError(_0x5a7b9e,null));};exports[_0xa9ad('0x53')]=function(_0x51babc,_0x4e651b,_0x1c7767){var _0x53bf8a={};var _0x5625f0={};var _0x5164a7;var _0x1df631;return db[_0xa9ad('0x2e')][_0xa9ad('0x54')]({'where':{'id':_0x51babc[_0xa9ad('0x45')]['id']}})[_0xa9ad('0x28')](handleEntityNotFound(_0x4e651b,null))['then'](function(_0x4a72cd){if(_0x4a72cd){_0x5164a7=_0x4a72cd;_0x5625f0['model']=_[_0xa9ad('0x32')](db[_0xa9ad('0x55')][_0xa9ad('0x46')]);_0x5625f0[_0xa9ad('0x31')]=_[_0xa9ad('0x32')](_0x51babc[_0xa9ad('0x31')]);_0x5625f0[_0xa9ad('0x3a')]=_[_0xa9ad('0x33')](_0x5625f0[_0xa9ad('0x30')],_0x5625f0[_0xa9ad('0x31')]);_0x53bf8a[_0xa9ad('0x34')]=_[_0xa9ad('0x33')](_0x5625f0[_0xa9ad('0x30')],qs['fields'](_0x51babc[_0xa9ad('0x31')]['fields']));_0x53bf8a[_0xa9ad('0x34')]=_0x53bf8a[_0xa9ad('0x34')]['length']?_0x53bf8a[_0xa9ad('0x34')]:_0x5625f0[_0xa9ad('0x30')];_0x53bf8a[_0xa9ad('0x51')]=qs[_0xa9ad('0x38')](_0x51babc['query'][_0xa9ad('0x38')]);_0x53bf8a['where']=qs[_0xa9ad('0x3a')](_[_0xa9ad('0x56')](_0x51babc[_0xa9ad('0x31')],_0x5625f0[_0xa9ad('0x3a')]));if(_0x51babc['query'][_0xa9ad('0x3b')]){_0x53bf8a['where']=_[_0xa9ad('0x3c')](_0x53bf8a[_0xa9ad('0x39')],{'$or':_[_0xa9ad('0x2d')](_0x53bf8a[_0xa9ad('0x34')],function(_0x826f62){var _0x51d21b={};_0x51d21b[_0x826f62]={'$like':'%'+_0x51babc['query'][_0xa9ad('0x3b')]+'%'};return _0x51d21b;})});}_0x53bf8a=_[_0xa9ad('0x3c')]({},_0x53bf8a,_0x51babc[_0xa9ad('0x3f')]);return _0x5164a7['getActions'](_0x53bf8a);}})[_0xa9ad('0x28')](function(_0x13c60c){if(_0x13c60c){_0x1df631=_0x13c60c['length'];if(!_0x51babc[_0xa9ad('0x31')]['hasOwnProperty'](_0xa9ad('0x57'))){_0x53bf8a[_0xa9ad('0x21')]=qs['limit'](_0x51babc[_0xa9ad('0x31')][_0xa9ad('0x21')]);_0x53bf8a[_0xa9ad('0x1f')]=qs[_0xa9ad('0x1f')](_0x51babc[_0xa9ad('0x31')]['offset']);}return _0x5164a7[_0xa9ad('0x53')](_0x53bf8a);}})['then'](function(_0xd4d300){if(_0xd4d300){return _0xd4d300?{'count':_0x1df631,'rows':_0xd4d300}:null;}})[_0xa9ad('0x28')](respondWithResult(_0x4e651b,null))[_0xa9ad('0x43')](handleError(_0x4e651b,null));}; \ No newline at end of file +var _0xbd66=['key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','include','findAll','rows','show','params','includeAll','find','catch','create','body','update','Condition','addConditions','ids','getConditions','findOne','rawAttributes','order','addActions','Action','omit','getActions','rimraf','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','then','destroy','error','stack','name','send','map','Automation','fieldName','type'];(function(_0x1b4b23,_0x5dd6d6){var _0x2a325b=function(_0x175462){while(--_0x175462){_0x1b4b23['push'](_0x1b4b23['shift']());}};_0x2a325b(++_0x5dd6d6);}(_0xbd66,0x177));var _0x6bd6=function(_0x55e12b,_0x3bbb99){_0x55e12b=_0x55e12b-0x0;var _0x507b79=_0xbd66[_0x55e12b];return _0x507b79;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6bd6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6bd6('0x1'));var moment=require(_0x6bd6('0x2'));var BPromise=require(_0x6bd6('0x3'));var Mustache=require(_0x6bd6('0x4'));var util=require('util');var path=require(_0x6bd6('0x5'));var sox=require(_0x6bd6('0x6'));var csv=require('to-csv');var ejs=require(_0x6bd6('0x7'));var fs=require('fs');var fs_extra=require(_0x6bd6('0x8'));var _=require(_0x6bd6('0x9'));var squel=require(_0x6bd6('0xa'));var crypto=require(_0x6bd6('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6bd6('0xc'));var querystring=require('querystring');var Papa=require(_0x6bd6('0xd'));var Redis=require(_0x6bd6('0xe'));var authService=require(_0x6bd6('0xf'));var qs=require(_0x6bd6('0x10'));var as=require(_0x6bd6('0x11'));var hardwareService=require(_0x6bd6('0x12'));var logger=require(_0x6bd6('0x13'))(_0x6bd6('0x14'));var utils=require(_0x6bd6('0x15'));var config=require(_0x6bd6('0x16'));var licenseUtil=require(_0x6bd6('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1bccfd,_0x305a90){_0x305a90=_0x305a90||0xcc;return function(_0x1272db){if(_0x1272db){return _0x1bccfd[_0x6bd6('0x18')](_0x305a90);}return _0x1bccfd['status'](_0x305a90)[_0x6bd6('0x19')]();};}function respondWithResult(_0x1f7973,_0x4157ab){_0x4157ab=_0x4157ab||0xc8;return function(_0x3befd3){if(_0x3befd3){return _0x1f7973[_0x6bd6('0x1a')](_0x4157ab)[_0x6bd6('0x1b')](_0x3befd3);}};}function respondWithFilteredResult(_0x3a4b3c,_0x3cfd0f){return function(_0xd1cd14){if(_0xd1cd14){var _0x5a877b=typeof _0x3cfd0f[_0x6bd6('0x1c')]===_0x6bd6('0x1d')&&typeof _0x3cfd0f[_0x6bd6('0x1e')]===_0x6bd6('0x1d');var _0x328cbd=_0xd1cd14[_0x6bd6('0x1f')];var _0x2adb33=_0x5a877b?0x0:_0x3cfd0f[_0x6bd6('0x1c')];var _0x31173b=_0x5a877b?_0xd1cd14['count']:_0x3cfd0f[_0x6bd6('0x1c')]+_0x3cfd0f['limit'];var _0xa31c8f;if(_0x31173b>=_0x328cbd){_0x31173b=_0x328cbd;_0xa31c8f=0xc8;}else{_0xa31c8f=0xce;}_0x3a4b3c['status'](_0xa31c8f);return _0x3a4b3c[_0x6bd6('0x20')](_0x6bd6('0x21'),_0x2adb33+'-'+_0x31173b+'/'+_0x328cbd)['json'](_0xd1cd14);}return null;};}function patchUpdates(_0xbacccf){return function(_0x67243d){try{jsonpatch[_0x6bd6('0x22')](_0x67243d,_0xbacccf,!![]);}catch(_0x47ad83){return BPromise['reject'](_0x47ad83);}return _0x67243d['save']();};}function saveUpdates(_0x8e9b11,_0x16683d){return function(_0x294c09){if(_0x294c09){return _0x294c09['update'](_0x8e9b11)[_0x6bd6('0x23')](function(_0x2eb33e){return _0x2eb33e;});}return null;};}function removeEntity(_0x236fa4,_0x12392e){return function(_0x1dc809){if(_0x1dc809){return _0x1dc809[_0x6bd6('0x24')]()['then'](function(){_0x236fa4['status'](0xcc)[_0x6bd6('0x19')]();});}};}function handleEntityNotFound(_0x3f43d4,_0x4c5d25){return function(_0xcceb51){if(!_0xcceb51){_0x3f43d4[_0x6bd6('0x18')](0x194);}return _0xcceb51;};}function handleError(_0x195c26,_0x2971aa){_0x2971aa=_0x2971aa||0x1f4;return function(_0x34721f){logger[_0x6bd6('0x25')](_0x34721f[_0x6bd6('0x26')]);if(_0x34721f[_0x6bd6('0x27')]){delete _0x34721f[_0x6bd6('0x27')];}_0x195c26['status'](_0x2971aa)[_0x6bd6('0x28')](_0x34721f);};}exports['index']=function(_0x366f12,_0x52a656){var _0x23aa16={},_0x437447={},_0xd657f7={'count':0x0,'rows':[]};var _0x28a608=_[_0x6bd6('0x29')](db[_0x6bd6('0x2a')]['rawAttributes'],function(_0x5c8346){return{'name':_0x5c8346[_0x6bd6('0x2b')],'type':_0x5c8346[_0x6bd6('0x2c')][_0x6bd6('0x2d')]};});_0x437447[_0x6bd6('0x2e')]=_[_0x6bd6('0x29')](_0x28a608,_0x6bd6('0x27'));_0x437447[_0x6bd6('0x2f')]=_[_0x6bd6('0x30')](_0x366f12[_0x6bd6('0x2f')]);_0x437447[_0x6bd6('0x31')]=_[_0x6bd6('0x32')](_0x437447[_0x6bd6('0x2e')],_0x437447[_0x6bd6('0x2f')]);_0x23aa16[_0x6bd6('0x33')]=_['intersection'](_0x437447[_0x6bd6('0x2e')],qs['fields'](_0x366f12[_0x6bd6('0x2f')][_0x6bd6('0x34')]));_0x23aa16[_0x6bd6('0x33')]=_0x23aa16['attributes'][_0x6bd6('0x35')]?_0x23aa16['attributes']:_0x437447[_0x6bd6('0x2e')];if(!_0x366f12[_0x6bd6('0x2f')][_0x6bd6('0x36')](_0x6bd6('0x37'))){_0x23aa16[_0x6bd6('0x1e')]=qs[_0x6bd6('0x1e')](_0x366f12[_0x6bd6('0x2f')]['limit']);_0x23aa16[_0x6bd6('0x1c')]=qs[_0x6bd6('0x1c')](_0x366f12[_0x6bd6('0x2f')][_0x6bd6('0x1c')]);}_0x23aa16['order']=qs['sort'](_0x366f12[_0x6bd6('0x2f')][_0x6bd6('0x38')]);_0x23aa16[_0x6bd6('0x39')]=qs['filters'](_[_0x6bd6('0x3a')](_0x366f12[_0x6bd6('0x2f')],_0x437447[_0x6bd6('0x31')]),_0x28a608);if(_0x366f12[_0x6bd6('0x2f')][_0x6bd6('0x3b')]){_0x23aa16[_0x6bd6('0x39')]=_[_0x6bd6('0x3c')](_0x23aa16[_0x6bd6('0x39')],{'$or':_['map'](_0x28a608,function(_0x355946){if(_0x355946[_0x6bd6('0x2c')]!=='VIRTUAL'){var _0x91849e={};_0x91849e[_0x355946[_0x6bd6('0x27')]]={'$like':'%'+_0x366f12[_0x6bd6('0x2f')][_0x6bd6('0x3b')]+'%'};return _0x91849e;}})});}_0x23aa16=_[_0x6bd6('0x3c')]({},_0x23aa16,_0x366f12[_0x6bd6('0x3d')]);var _0x56ab41={'where':_0x23aa16[_0x6bd6('0x39')]};return db[_0x6bd6('0x2a')][_0x6bd6('0x1f')](_0x56ab41)[_0x6bd6('0x23')](function(_0x1bf5ba){_0xd657f7[_0x6bd6('0x1f')]=_0x1bf5ba;if(_0x366f12[_0x6bd6('0x2f')]['includeAll']){_0x23aa16[_0x6bd6('0x3e')]=[{'all':!![]}];}return db[_0x6bd6('0x2a')][_0x6bd6('0x3f')](_0x23aa16);})['then'](function(_0x2b3ac8){_0xd657f7[_0x6bd6('0x40')]=_0x2b3ac8;return _0xd657f7;})[_0x6bd6('0x23')](respondWithFilteredResult(_0x52a656,_0x23aa16))['catch'](handleError(_0x52a656,null));};exports[_0x6bd6('0x41')]=function(_0x98f6f0,_0x1b67ea){var _0x67ccaa={'raw':![],'where':{'id':_0x98f6f0[_0x6bd6('0x42')]['id']}},_0xb118fb={};_0xb118fb[_0x6bd6('0x2e')]=_['keys'](db[_0x6bd6('0x2a')]['rawAttributes']);_0xb118fb['query']=_[_0x6bd6('0x30')](_0x98f6f0[_0x6bd6('0x2f')]);_0xb118fb[_0x6bd6('0x31')]=_[_0x6bd6('0x32')](_0xb118fb['model'],_0xb118fb['query']);_0x67ccaa[_0x6bd6('0x33')]=_[_0x6bd6('0x32')](_0xb118fb[_0x6bd6('0x2e')],qs[_0x6bd6('0x34')](_0x98f6f0[_0x6bd6('0x2f')]['fields']));_0x67ccaa[_0x6bd6('0x33')]=_0x67ccaa[_0x6bd6('0x33')]['length']?_0x67ccaa[_0x6bd6('0x33')]:_0xb118fb['model'];if(_0x98f6f0[_0x6bd6('0x2f')][_0x6bd6('0x43')]){_0x67ccaa[_0x6bd6('0x3e')]=[{'all':!![]}];}_0x67ccaa=_[_0x6bd6('0x3c')]({},_0x67ccaa,_0x98f6f0['options']);return db[_0x6bd6('0x2a')][_0x6bd6('0x44')](_0x67ccaa)[_0x6bd6('0x23')](handleEntityNotFound(_0x1b67ea,null))[_0x6bd6('0x23')](respondWithResult(_0x1b67ea,null))[_0x6bd6('0x45')](handleError(_0x1b67ea,null));};exports['create']=function(_0x36f23b,_0x8cbe){return db[_0x6bd6('0x2a')][_0x6bd6('0x46')](_0x36f23b[_0x6bd6('0x47')],{})[_0x6bd6('0x23')](respondWithResult(_0x8cbe,0xc9))['catch'](handleError(_0x8cbe,null));};exports[_0x6bd6('0x48')]=function(_0x36226b,_0x4aee5e){if(_0x36226b[_0x6bd6('0x47')]['id']){delete _0x36226b[_0x6bd6('0x47')]['id'];}return db[_0x6bd6('0x2a')][_0x6bd6('0x44')]({'where':{'id':_0x36226b['params']['id']}})['then'](handleEntityNotFound(_0x4aee5e,null))['then'](saveUpdates(_0x36226b[_0x6bd6('0x47')],null))[_0x6bd6('0x23')](respondWithResult(_0x4aee5e,null))['catch'](handleError(_0x4aee5e,null));};exports[_0x6bd6('0x24')]=function(_0x114aad,_0x521042){return db['Automation']['find']({'where':{'id':_0x114aad[_0x6bd6('0x42')]['id']}})[_0x6bd6('0x23')](handleEntityNotFound(_0x521042,null))[_0x6bd6('0x23')](removeEntity(_0x521042,null))[_0x6bd6('0x45')](handleError(_0x521042,null));};exports['addConditions']=function(_0x16d0f8,_0x5e8fb6,_0x36d4c6){return db[_0x6bd6('0x49')][_0x6bd6('0x44')]({'where':{'id':_0x16d0f8[_0x6bd6('0x42')]['id']}})[_0x6bd6('0x23')](handleEntityNotFound(_0x5e8fb6,null))['then'](function(_0x495aba){if(_0x495aba){return _0x495aba[_0x6bd6('0x4a')](_0x16d0f8['body'][_0x6bd6('0x4b')],_['omit'](_0x16d0f8[_0x6bd6('0x47')],[_0x6bd6('0x4b'),'id'])||{});}})[_0x6bd6('0x23')](respondWithResult(_0x5e8fb6,null))[_0x6bd6('0x45')](handleError(_0x5e8fb6,null));};exports[_0x6bd6('0x4c')]=function(_0x4fd146,_0xe540a1,_0x5335a4){var _0x18db85={};var _0x21ddbc={};var _0x2dbbb1;var _0x2af209;return db['Automation'][_0x6bd6('0x4d')]({'where':{'id':_0x4fd146['params']['id']}})[_0x6bd6('0x23')](handleEntityNotFound(_0xe540a1,null))[_0x6bd6('0x23')](function(_0x400aa6){if(_0x400aa6){_0x2dbbb1=_0x400aa6;_0x21ddbc[_0x6bd6('0x2e')]=_[_0x6bd6('0x30')](db['Condition'][_0x6bd6('0x4e')]);_0x21ddbc[_0x6bd6('0x2f')]=_[_0x6bd6('0x30')](_0x4fd146[_0x6bd6('0x2f')]);_0x21ddbc['filters']=_[_0x6bd6('0x32')](_0x21ddbc[_0x6bd6('0x2e')],_0x21ddbc[_0x6bd6('0x2f')]);_0x18db85[_0x6bd6('0x33')]=_[_0x6bd6('0x32')](_0x21ddbc[_0x6bd6('0x2e')],qs[_0x6bd6('0x34')](_0x4fd146[_0x6bd6('0x2f')][_0x6bd6('0x34')]));_0x18db85['attributes']=_0x18db85[_0x6bd6('0x33')][_0x6bd6('0x35')]?_0x18db85[_0x6bd6('0x33')]:_0x21ddbc[_0x6bd6('0x2e')];_0x18db85[_0x6bd6('0x4f')]=qs[_0x6bd6('0x38')](_0x4fd146[_0x6bd6('0x2f')][_0x6bd6('0x38')]);_0x18db85['where']=qs[_0x6bd6('0x31')](_[_0x6bd6('0x3a')](_0x4fd146[_0x6bd6('0x2f')],_0x21ddbc[_0x6bd6('0x31')]));if(_0x4fd146['query'][_0x6bd6('0x3b')]){_0x18db85[_0x6bd6('0x39')]=_[_0x6bd6('0x3c')](_0x18db85['where'],{'$or':_[_0x6bd6('0x29')](_0x18db85[_0x6bd6('0x33')],function(_0x53f2a6){var _0x39b60b={};_0x39b60b[_0x53f2a6]={'$like':'%'+_0x4fd146[_0x6bd6('0x2f')][_0x6bd6('0x3b')]+'%'};return _0x39b60b;})});}_0x18db85=_[_0x6bd6('0x3c')]({},_0x18db85,_0x4fd146[_0x6bd6('0x3d')]);return _0x2dbbb1[_0x6bd6('0x4c')](_0x18db85);}})['then'](function(_0x3a82d0){if(_0x3a82d0){_0x2af209=_0x3a82d0[_0x6bd6('0x35')];if(!_0x4fd146[_0x6bd6('0x2f')][_0x6bd6('0x36')](_0x6bd6('0x37'))){_0x18db85['limit']=qs[_0x6bd6('0x1e')](_0x4fd146[_0x6bd6('0x2f')][_0x6bd6('0x1e')]);_0x18db85[_0x6bd6('0x1c')]=qs[_0x6bd6('0x1c')](_0x4fd146[_0x6bd6('0x2f')][_0x6bd6('0x1c')]);}return _0x2dbbb1['getConditions'](_0x18db85);}})['then'](function(_0x2002af){if(_0x2002af){return _0x2002af?{'count':_0x2af209,'rows':_0x2002af}:null;}})[_0x6bd6('0x23')](respondWithResult(_0xe540a1,null))[_0x6bd6('0x45')](handleError(_0xe540a1,null));};exports[_0x6bd6('0x50')]=function(_0x2602ee,_0x15503b,_0x30b2c2){return db[_0x6bd6('0x51')][_0x6bd6('0x44')]({'where':{'id':_0x2602ee[_0x6bd6('0x42')]['id']}})[_0x6bd6('0x23')](handleEntityNotFound(_0x15503b,null))[_0x6bd6('0x23')](function(_0x201c92){if(_0x201c92){return _0x201c92['addActions'](_0x2602ee[_0x6bd6('0x47')][_0x6bd6('0x4b')],_[_0x6bd6('0x52')](_0x2602ee[_0x6bd6('0x47')],[_0x6bd6('0x4b'),'id'])||{});}})['then'](respondWithResult(_0x15503b,null))[_0x6bd6('0x45')](handleError(_0x15503b,null));};exports[_0x6bd6('0x53')]=function(_0x10ae88,_0xeb87ed,_0x571467){var _0x38cb96={};var _0x3bb52d={};var _0x1a2d93;var _0x252f13;return db[_0x6bd6('0x2a')]['findOne']({'where':{'id':_0x10ae88[_0x6bd6('0x42')]['id']}})[_0x6bd6('0x23')](handleEntityNotFound(_0xeb87ed,null))[_0x6bd6('0x23')](function(_0x3706da){if(_0x3706da){_0x1a2d93=_0x3706da;_0x3bb52d[_0x6bd6('0x2e')]=_[_0x6bd6('0x30')](db[_0x6bd6('0x51')][_0x6bd6('0x4e')]);_0x3bb52d[_0x6bd6('0x2f')]=_[_0x6bd6('0x30')](_0x10ae88['query']);_0x3bb52d[_0x6bd6('0x31')]=_[_0x6bd6('0x32')](_0x3bb52d[_0x6bd6('0x2e')],_0x3bb52d[_0x6bd6('0x2f')]);_0x38cb96[_0x6bd6('0x33')]=_[_0x6bd6('0x32')](_0x3bb52d['model'],qs[_0x6bd6('0x34')](_0x10ae88['query'][_0x6bd6('0x34')]));_0x38cb96['attributes']=_0x38cb96[_0x6bd6('0x33')][_0x6bd6('0x35')]?_0x38cb96['attributes']:_0x3bb52d['model'];_0x38cb96['order']=qs[_0x6bd6('0x38')](_0x10ae88[_0x6bd6('0x2f')][_0x6bd6('0x38')]);_0x38cb96[_0x6bd6('0x39')]=qs[_0x6bd6('0x31')](_[_0x6bd6('0x3a')](_0x10ae88[_0x6bd6('0x2f')],_0x3bb52d['filters']));if(_0x10ae88['query']['filter']){_0x38cb96[_0x6bd6('0x39')]=_['merge'](_0x38cb96['where'],{'$or':_[_0x6bd6('0x29')](_0x38cb96[_0x6bd6('0x33')],function(_0x43c648){var _0x519671={};_0x519671[_0x43c648]={'$like':'%'+_0x10ae88[_0x6bd6('0x2f')][_0x6bd6('0x3b')]+'%'};return _0x519671;})});}_0x38cb96=_[_0x6bd6('0x3c')]({},_0x38cb96,_0x10ae88[_0x6bd6('0x3d')]);return _0x1a2d93['getActions'](_0x38cb96);}})[_0x6bd6('0x23')](function(_0x441f04){if(_0x441f04){_0x252f13=_0x441f04[_0x6bd6('0x35')];if(!_0x10ae88[_0x6bd6('0x2f')][_0x6bd6('0x36')](_0x6bd6('0x37'))){_0x38cb96[_0x6bd6('0x1e')]=qs['limit'](_0x10ae88['query'][_0x6bd6('0x1e')]);_0x38cb96['offset']=qs[_0x6bd6('0x1c')](_0x10ae88[_0x6bd6('0x2f')][_0x6bd6('0x1c')]);}return _0x1a2d93[_0x6bd6('0x53')](_0x38cb96);}})[_0x6bd6('0x23')](function(_0x2f7303){if(_0x2f7303){return _0x2f7303?{'count':_0x252f13,'rows':_0x2f7303}:null;}})[_0x6bd6('0x23')](respondWithResult(_0xeb87ed,null))[_0x6bd6('0x45')](handleError(_0xeb87ed,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index f617eb0..4ee136b 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 _0x2aa9=['rimraf','../../config/environment','./automation.attributes','exports','define','tools_automations','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x1778e1,_0x3e1727){var _0x2bc4c6=function(_0x359c65){while(--_0x359c65){_0x1778e1['push'](_0x1778e1['shift']());}};_0x2bc4c6(++_0x3e1727);}(_0x2aa9,0x117));var _0x92aa=function(_0x525596,_0x64e4a8){_0x525596=_0x525596-0x0;var _0x5c6fb1=_0x2aa9[_0x525596];return _0x5c6fb1;};'use strict';var _=require(_0x92aa('0x0'));var util=require(_0x92aa('0x1'));var logger=require('../../config/logger')(_0x92aa('0x2'));var moment=require(_0x92aa('0x3'));var BPromise=require(_0x92aa('0x4'));var rp=require(_0x92aa('0x5'));var fs=require('fs');var path=require(_0x92aa('0x6'));var rimraf=require(_0x92aa('0x7'));var config=require(_0x92aa('0x8'));var attributes=require(_0x92aa('0x9'));module[_0x92aa('0xa')]=function(_0x1bb2e3,_0x3103c6){return _0x1bb2e3[_0x92aa('0xb')]('Automation',attributes,{'tableName':_0x92aa('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4686=['rimraf','./automation.attributes','exports','define','Automation','tools_automations','lodash','../../config/logger','api','bluebird','path'];(function(_0x2c924f,_0x46d106){var _0x483508=function(_0x528609){while(--_0x528609){_0x2c924f['push'](_0x2c924f['shift']());}};_0x483508(++_0x46d106);}(_0x4686,0x171));var _0x6468=function(_0x49d58d,_0x4e0f67){_0x49d58d=_0x49d58d-0x0;var _0x350063=_0x4686[_0x49d58d];return _0x350063;};'use strict';var _=require(_0x6468('0x0'));var util=require('util');var logger=require(_0x6468('0x1'))(_0x6468('0x2'));var moment=require('moment');var BPromise=require(_0x6468('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6468('0x4'));var rimraf=require(_0x6468('0x5'));var config=require('../../config/environment');var attributes=require(_0x6468('0x6'));module[_0x6468('0x7')]=function(_0x48bc9d,_0x50a7c3){return _0x48bc9d[_0x6468('0x8')](_0x6468('0x9'),attributes,{'tableName':_0x6468('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index a91575c..07f4093 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 _0x09df=['rpc','../../config/environment','request','then','info','request\x20sent','debug','error','code','Automation,\x20%s,\x20%s','message','lodash','util','bluebird','../../mysqldb'];(function(_0x558b60,_0x55ac48){var _0x2dcea6=function(_0x185eb0){while(--_0x185eb0){_0x558b60['push'](_0x558b60['shift']());}};_0x2dcea6(++_0x55ac48);}(_0x09df,0x164));var _0xf09d=function(_0x4ed4d2,_0x47acf7){_0x4ed4d2=_0x4ed4d2-0x0;var _0x15ae2e=_0x09df[_0x4ed4d2];return _0x15ae2e;};'use strict';var _=require(_0xf09d('0x0'));var util=require(_0xf09d('0x1'));var moment=require('moment');var BPromise=require(_0xf09d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf09d('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf09d('0x4'));var config=require(_0xf09d('0x5'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x284a42,_0x48b82f,_0x28c91c){return new BPromise(function(_0x2555c7,_0x2f1810){return client[_0xf09d('0x6')](_0x284a42,_0x28c91c)[_0xf09d('0x7')](function(_0x2a59a8){logger[_0xf09d('0x8')]('Automation,\x20%s,\x20%s',_0x48b82f,_0xf09d('0x9'));logger[_0xf09d('0xa')]('Automation,\x20%s,\x20%s,\x20%s',_0x48b82f,_0xf09d('0x9'),JSON['stringify'](_0x2a59a8));if(_0x2a59a8[_0xf09d('0xb')]){if(_0x2a59a8[_0xf09d('0xb')][_0xf09d('0xc')]===0x1f4){logger[_0xf09d('0xb')](_0xf09d('0xd'),_0x48b82f,_0x2a59a8[_0xf09d('0xb')][_0xf09d('0xe')]);return _0x2f1810(_0x2a59a8[_0xf09d('0xb')][_0xf09d('0xe')]);}logger['error'](_0xf09d('0xd'),_0x48b82f,_0x2a59a8[_0xf09d('0xb')][_0xf09d('0xe')]);return _0x2555c7(_0x2a59a8['error']['message']);}else{logger[_0xf09d('0x8')](_0xf09d('0xd'),_0x48b82f,_0xf09d('0x9'));_0x2555c7(_0x2a59a8['result'][_0xf09d('0xe')]);}})['catch'](function(_0x3614f7){logger[_0xf09d('0xb')](_0xf09d('0xd'),_0x48b82f,_0x3614f7);_0x2f1810(_0x3614f7);});});} \ No newline at end of file +var _0x20d6=['request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Automation,\x20%s,\x20%s'];(function(_0x456551,_0x4c9050){var _0x1af692=function(_0x2dabdd){while(--_0x2dabdd){_0x456551['push'](_0x456551['shift']());}};_0x1af692(++_0x4c9050);}(_0x20d6,0x1b8));var _0x620d=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x20d6[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x620d('0x0'));var util=require(_0x620d('0x1'));var moment=require(_0x620d('0x2'));var BPromise=require(_0x620d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x620d('0x4'));var db=require(_0x620d('0x5'))['db'];var utils=require(_0x620d('0x6'));var logger=require(_0x620d('0x7'))(_0x620d('0x8'));var config=require(_0x620d('0x9'));var jayson=require(_0x620d('0xa'));var client=jayson[_0x620d('0xb')][_0x620d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3aa4f3,_0x260d43,_0x52657f){return new BPromise(function(_0x3d93af,_0x478aeb){return client['request'](_0x3aa4f3,_0x52657f)[_0x620d('0xd')](function(_0x473790){logger[_0x620d('0xe')](_0x620d('0xf'),_0x260d43,_0x620d('0x10'));logger[_0x620d('0x11')]('Automation,\x20%s,\x20%s,\x20%s',_0x260d43,_0x620d('0x10'),JSON[_0x620d('0x12')](_0x473790));if(_0x473790['error']){if(_0x473790[_0x620d('0x13')][_0x620d('0x14')]===0x1f4){logger[_0x620d('0x13')](_0x620d('0xf'),_0x260d43,_0x473790[_0x620d('0x13')][_0x620d('0x15')]);return _0x478aeb(_0x473790[_0x620d('0x13')][_0x620d('0x15')]);}logger['error'](_0x620d('0xf'),_0x260d43,_0x473790[_0x620d('0x13')][_0x620d('0x15')]);return _0x3d93af(_0x473790[_0x620d('0x13')][_0x620d('0x15')]);}else{logger['info']('Automation,\x20%s,\x20%s',_0x260d43,'request\x20sent');_0x3d93af(_0x473790[_0x620d('0x16')]['message']);}})[_0x620d('0x17')](function(_0x20a91e){logger[_0x620d('0x13')](_0x620d('0xf'),_0x260d43,_0x20a91e);_0x478aeb(_0x20a91e);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index b4a3965..891d10e 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 _0x5697=['express','./automation.controller','get','/:id','isAuthenticated','show','/:id/conditions','getConditions','/:id/actions','getActions','post','create','addActions','put','update','delete','exports','multer','path','connect-timeout'];(function(_0x47d91e,_0x3e5da9){var _0x1be66b=function(_0x3fd2ca){while(--_0x3fd2ca){_0x47d91e['push'](_0x47d91e['shift']());}};_0x1be66b(++_0x3e5da9);}(_0x5697,0x1b5));var _0x7569=function(_0x56b886,_0x1ff474){_0x56b886=_0x56b886-0x0;var _0x164baf=_0x5697[_0x56b886];return _0x164baf;};'use strict';var multer=require(_0x7569('0x0'));var util=require('util');var path=require(_0x7569('0x1'));var timeout=require(_0x7569('0x2'));var express=require(_0x7569('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7569('0x4'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x7569('0x5')](_0x7569('0x6'),auth[_0x7569('0x7')](),controller[_0x7569('0x8')]);router[_0x7569('0x5')](_0x7569('0x9'),auth['isAuthenticated'](),controller[_0x7569('0xa')]);router['get'](_0x7569('0xb'),auth[_0x7569('0x7')](),controller[_0x7569('0xc')]);router[_0x7569('0xd')]('/',auth[_0x7569('0x7')](),controller[_0x7569('0xe')]);router[_0x7569('0xd')](_0x7569('0x9'),auth[_0x7569('0x7')](),controller['addConditions']);router[_0x7569('0xd')](_0x7569('0xb'),auth[_0x7569('0x7')](),controller[_0x7569('0xf')]);router[_0x7569('0x10')](_0x7569('0x6'),auth['isAuthenticated'](),controller[_0x7569('0x11')]);router[_0x7569('0x12')](_0x7569('0x6'),auth[_0x7569('0x7')](),controller['destroy']);module[_0x7569('0x13')]=router; \ No newline at end of file +var _0x710b=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','/:id','show','getConditions','getActions','post','create','addConditions','/:id/actions','put','update','destroy','multer'];(function(_0x5ee3d4,_0x40da86){var _0x7f69d=function(_0x969be8){while(--_0x969be8){_0x5ee3d4['push'](_0x5ee3d4['shift']());}};_0x7f69d(++_0x40da86);}(_0x710b,0x110));var _0xb710=function(_0x469d01,_0x18c899){_0x469d01=_0x469d01-0x0;var _0x5078d3=_0x710b[_0x469d01];return _0x5078d3;};'use strict';var multer=require(_0xb710('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb710('0x1'));var express=require(_0xb710('0x2'));var router=express[_0xb710('0x3')]();var fs_extra=require(_0xb710('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb710('0x5'));var config=require(_0xb710('0x6'));var controller=require(_0xb710('0x7'));router[_0xb710('0x8')]('/',auth[_0xb710('0x9')](),controller['index']);router[_0xb710('0x8')](_0xb710('0xa'),auth['isAuthenticated'](),controller[_0xb710('0xb')]);router[_0xb710('0x8')]('/:id/conditions',auth[_0xb710('0x9')](),controller[_0xb710('0xc')]);router['get']('/:id/actions',auth[_0xb710('0x9')](),controller[_0xb710('0xd')]);router[_0xb710('0xe')]('/',auth['isAuthenticated'](),controller[_0xb710('0xf')]);router[_0xb710('0xe')]('/:id/conditions',auth[_0xb710('0x9')](),controller[_0xb710('0x10')]);router[_0xb710('0xe')](_0xb710('0x11'),auth[_0xb710('0x9')](),controller['addActions']);router[_0xb710('0x12')](_0xb710('0xa'),auth[_0xb710('0x9')](),controller[_0xb710('0x13')]);router['delete'](_0xb710('0xa'),auth[_0xb710('0x9')](),controller[_0xb710('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index e5e760a..6f9b33e 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 _0xbb29=['AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','STRING','#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)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x1eac2e,_0x6bce0c){var _0x11dd63=function(_0x24a38f){while(--_0x24a38f){_0x1eac2e['push'](_0x1eac2e['shift']());}};_0x11dd63(++_0x6bce0c);}(_0xbb29,0x6d));var _0x9bb2=function(_0x249ede,_0x13d74a){_0x249ede=_0x249ede-0x0;var _0xa4c823=_0xbb29[_0x249ede];return _0xa4c823;};'use strict';var Sequelize=require(_0x9bb2('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x9bb2('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x9bb2('0x2')](_0x9bb2('0x3')),'allowNull':![],'defaultValue':_0x9bb2('0x3')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x9bb2('0x4')],'defaultValue':0x0,'comment':_0x9bb2('0x5')},'limitCalls':{'type':Sequelize[_0x9bb2('0x6')](0x4)[_0x9bb2('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x9bb2('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0x9bb2('0x9')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x9bb2('0x9')]},'dialOriginateTimeout':{'type':Sequelize[_0x9bb2('0x6')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x9bb2('0x6')](0x3)[_0x9bb2('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9bb2('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x9bb2('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9bb2('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0x9bb2('0x6')](0x3)[_0x9bb2('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9bb2('0xc')},'dialBusyRetryFrequency':{'type':Sequelize[_0x9bb2('0x6')](0x5)[_0x9bb2('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x9bb2('0x7')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x9bb2('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9bb2('0xd')},'dialGlobalMaxRetry':{'type':Sequelize[_0x9bb2('0x6')](0x3)[_0x9bb2('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x9bb2('0x9')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x9bb2('0x9')],'defaultValue':_0x9bb2('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0x9bb2('0x2')](_0x9bb2('0xf'),_0x9bb2('0x10'),_0x9bb2('0x11')),'defaultValue':_0x9bb2('0xf')},'dialAMDActive':{'type':Sequelize[_0x9bb2('0x4')],'defaultValue':0x0,'comment':_0x9bb2('0x12')},'dialAMDInitialSilence':{'type':Sequelize[_0x9bb2('0x6')](0x9)[_0x9bb2('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x9bb2('0x13')},'dialAMDGreeting':{'type':Sequelize[_0x9bb2('0x6')](0x9)[_0x9bb2('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x9bb2('0x14')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x9bb2('0x6')](0x9)[_0x9bb2('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x9bb2('0x15')},'dialAMDMinWordLength':{'type':Sequelize[_0x9bb2('0x6')](0x9)[_0x9bb2('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x9bb2('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x9bb2('0x6')](0x9)[_0x9bb2('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x9bb2('0x6')](0x9)[_0x9bb2('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x9bb2('0x17')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x9bb2('0x18')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x9bb2('0x6')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0x9bb2('0x2')](_0x9bb2('0x19'),'ASC'),'defaultValue':_0x9bb2('0x19')},'dialPrefix':{'type':Sequelize[_0x9bb2('0x9')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x9bb2('0x6')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x9bb2('0x1a')},'dialCutDigit':{'type':Sequelize[_0x9bb2('0x6')](0x3)[_0x9bb2('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x9bb2('0x1b')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x9bb2('0x6')](0x3)[_0x9bb2('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9bb2('0x1c')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x9bb2('0x6')](0x5)[_0x9bb2('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9bb2('0x1d')},'dialDropMaxRetry':{'type':Sequelize[_0x9bb2('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9bb2('0x1e')},'dialDropRetryFrequency':{'type':Sequelize[_0x9bb2('0x6')](0x5)[_0x9bb2('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9bb2('0x1f')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x9bb2('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x9bb2('0x6')](0x5)[_0x9bb2('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9bb2('0x20')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x9bb2('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9bb2('0x21')},'dialMachineRetryFrequency':{'type':Sequelize[_0x9bb2('0x6')](0x5)[_0x9bb2('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9bb2('0x22')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x9bb2('0x6')](0x3)[_0x9bb2('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x9bb2('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9bb2('0x23')}}; \ No newline at end of file +var _0x4240=['#Machine\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','exports','STRING','ENUM','ivr','Active/Disactive\x20Campaign','INTEGER','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','UNSIGNED','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','BOOLEAN','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x4240,0x10c));var _0x0424=function(_0x112ed0,_0x737772){_0x112ed0=_0x112ed0-0x0;var _0x197bc7=_0x4240[_0x112ed0];return _0x197bc7;};'use strict';var Sequelize=require('sequelize');module[_0x0424('0x0')]={'name':{'type':Sequelize[_0x0424('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x0424('0x2')](_0x0424('0x3')),'allowNull':![],'defaultValue':_0x0424('0x3')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x0424('0x4')},'limitCalls':{'type':Sequelize[_0x0424('0x5')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x0424('0x6')},'dialOriginateCallerIdName':{'type':Sequelize[_0x0424('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x0424('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x0424('0x5')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0424('0x7')},'dialCongestionMaxRetry':{'type':Sequelize[_0x0424('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0424('0x8')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x0424('0x5')](0x5)[_0x0424('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0424('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0x0424('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0424('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0x0424('0x5')](0x5)[_0x0424('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0424('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x0424('0x5')](0x3)[_0x0424('0x9')],'defaultValue':0x3,'comment':_0x0424('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x0424('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0424('0xe')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0424('0x9')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x0424('0xf')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x0424('0x1')],'defaultValue':_0x0424('0x10')},'dialCheckDuplicateType':{'type':Sequelize[_0x0424('0x2')](_0x0424('0x11'),_0x0424('0x12'),'onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x0424('0x13')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x0424('0x5')](0x9)[_0x0424('0x9')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x0424('0x14')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x0424('0x9')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x0424('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x0424('0x5')](0x9)[_0x0424('0x9')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x0424('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x0424('0x5')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0424('0x17')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x0424('0x9')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x0424('0x18')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x0424('0x5')](0x9)[_0x0424('0x9')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x0424('0x19')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x0424('0x5')](0x5)[_0x0424('0x9')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x0424('0x1a')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x0424('0x5')](0x9)[_0x0424('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0424('0x1b')},'dialOrderByScheduledAt':{'type':Sequelize[_0x0424('0x2')](_0x0424('0x1c'),_0x0424('0x1d')),'defaultValue':_0x0424('0x1c')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x0424('0x5')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x0424('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x0424('0x5')](0x3)[_0x0424('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0424('0x1e')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x0424('0x5')](0x5)[_0x0424('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0424('0x1f')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0424('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0424('0x20')},'dialDropRetryFrequency':{'type':Sequelize[_0x0424('0x5')](0x5)[_0x0424('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0424('0x21')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x0424('0x5')](0x3)[_0x0424('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0424('0x22')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x0424('0x5')](0x5)[_0x0424('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0424('0x23')},'dialMachineMaxRetry':{'type':Sequelize[_0x0424('0x5')](0x3)[_0x0424('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0424('0x24')},'dialMachineRetryFrequency':{'type':Sequelize[_0x0424('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x0424('0x5')](0x3)[_0x0424('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x0424('0x5')](0x5)[_0x0424('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0424('0x25')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 5200464..0c2a092 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 _0x1eba=['COALESCE(phone,\x27\x27)','CampaignId\x20=\x20?','into','cm_contacts','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.item','ci.OrderBY','cm_contact_has_items','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','CmList','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','limit','count','set','Content-Range','reject','save','update','then','destroy','get','IvrCampaigns','UserProfileResource','sendStatus','error','stack','name','index','map','Campaign','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','keys','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','UserProfileSection','getHoppers','findOne','CmHopper','nolimit','CampaignId','getHopperHistories','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','createdAt','select','field','NOW()','CmListId','toString','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','cm_hopper_final'];(function(_0x24fdf4,_0x171979){var _0xf45e83=function(_0x1c9d98){while(--_0x1c9d98){_0x24fdf4['push'](_0x24fdf4['shift']());}};_0xf45e83(++_0x171979);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x1526e1,_0x5ed5a5){_0x1526e1=_0x1526e1-0x0;var _0x249a1e=_0x1eba[_0x1526e1];return _0x249a1e;};'use strict';var emlformat=require(_0xa1eb('0x0'));var rimraf=require(_0xa1eb('0x1'));var zipdir=require(_0xa1eb('0x2'));var jsonpatch=require(_0xa1eb('0x3'));var rp=require(_0xa1eb('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa1eb('0x5'));var util=require(_0xa1eb('0x6'));var path=require(_0xa1eb('0x7'));var sox=require(_0xa1eb('0x8'));var csv=require(_0xa1eb('0x9'));var ejs=require(_0xa1eb('0xa'));var fs=require('fs');var fs_extra=require(_0xa1eb('0xb'));var _=require(_0xa1eb('0xc'));var squel=require(_0xa1eb('0xd'));var crypto=require(_0xa1eb('0xe'));var jsforce=require(_0xa1eb('0xf'));var deskjs=require(_0xa1eb('0x10'));var toCsv=require('to-csv');var querystring=require(_0xa1eb('0x11'));var Papa=require('papaparse');var Redis=require(_0xa1eb('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xa1eb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa1eb('0x14'));var logger=require('../../config/logger')(_0xa1eb('0x15'));var utils=require(_0xa1eb('0x16'));var config=require(_0xa1eb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xa1eb('0x18'))['db'];function respondWithStatusCode(_0x39b4a3,_0x5df92d){_0x5df92d=_0x5df92d||0xcc;return function(_0x16a623){if(_0x16a623){return _0x39b4a3['sendStatus'](_0x5df92d);}return _0x39b4a3['status'](_0x5df92d)[_0xa1eb('0x19')]();};}function respondWithResult(_0x4c7983,_0x25d058){_0x25d058=_0x25d058||0xc8;return function(_0x2178e2){if(_0x2178e2){return _0x4c7983[_0xa1eb('0x1a')](_0x25d058)[_0xa1eb('0x1b')](_0x2178e2);}};}function respondWithFilteredResult(_0x3cd675,_0x44f37d){return function(_0x1c858c){if(_0x1c858c){var _0x45d6dd=typeof _0x44f37d[_0xa1eb('0x1c')]==='undefined'&&typeof _0x44f37d[_0xa1eb('0x1d')]==='undefined';var _0x1401ef=_0x1c858c[_0xa1eb('0x1e')];var _0x33c4e3=_0x45d6dd?0x0:_0x44f37d[_0xa1eb('0x1c')];var _0x49bfaa=_0x45d6dd?_0x1c858c[_0xa1eb('0x1e')]:_0x44f37d[_0xa1eb('0x1c')]+_0x44f37d[_0xa1eb('0x1d')];var _0xcf45c1;if(_0x49bfaa>=_0x1401ef){_0x49bfaa=_0x1401ef;_0xcf45c1=0xc8;}else{_0xcf45c1=0xce;}_0x3cd675[_0xa1eb('0x1a')](_0xcf45c1);return _0x3cd675[_0xa1eb('0x1f')](_0xa1eb('0x20'),_0x33c4e3+'-'+_0x49bfaa+'/'+_0x1401ef)[_0xa1eb('0x1b')](_0x1c858c);}return null;};}function patchUpdates(_0x4fc14a){return function(_0x137e2c){try{jsonpatch['apply'](_0x137e2c,_0x4fc14a,!![]);}catch(_0x2258d1){return BPromise[_0xa1eb('0x21')](_0x2258d1);}return _0x137e2c[_0xa1eb('0x22')]();};}function saveUpdates(_0x250f99,_0x5e7a34){return function(_0x539634){if(_0x539634){return _0x539634[_0xa1eb('0x23')](_0x250f99)[_0xa1eb('0x24')](function(_0x5b0903){return _0x5b0903;});}return null;};}function removeEntity(_0x437b2a,_0x250728){return function(_0x258d3a){if(_0x258d3a){return _0x258d3a[_0xa1eb('0x25')]()[_0xa1eb('0x24')](function(){var _0x1c59e1=_0x258d3a[_0xa1eb('0x26')]({'plain':!![]});var _0x364b1c=_0xa1eb('0x27');return db[_0xa1eb('0x28')][_0xa1eb('0x25')]({'where':{'type':_0x364b1c,'resourceId':_0x1c59e1['id']}})[_0xa1eb('0x24')](function(){return _0x258d3a;});})['then'](function(){_0x437b2a[_0xa1eb('0x1a')](0xcc)[_0xa1eb('0x19')]();});}};}function handleEntityNotFound(_0x491f37,_0x2680c0){return function(_0x4e2aa7){if(!_0x4e2aa7){_0x491f37[_0xa1eb('0x29')](0x194);}return _0x4e2aa7;};}function handleError(_0x2d31d1,_0x53a890){_0x53a890=_0x53a890||0x1f4;return function(_0x45ff0d){logger[_0xa1eb('0x2a')](_0x45ff0d[_0xa1eb('0x2b')]);if(_0x45ff0d['name']){delete _0x45ff0d[_0xa1eb('0x2c')];}_0x2d31d1[_0xa1eb('0x1a')](_0x53a890)['send'](_0x45ff0d);};}exports[_0xa1eb('0x2d')]=function(_0xb27bf9,_0x401510){var _0x2e281a={},_0x5a6544={},_0x52f9c7={'count':0x0,'rows':[]};var _0x9d49d8=_[_0xa1eb('0x2e')](db[_0xa1eb('0x2f')][_0xa1eb('0x30')],function(_0x383e26){return{'name':_0x383e26[_0xa1eb('0x31')],'type':_0x383e26[_0xa1eb('0x32')][_0xa1eb('0x33')]};});_0x5a6544[_0xa1eb('0x34')]=_[_0xa1eb('0x2e')](_0x9d49d8,_0xa1eb('0x2c'));_0x5a6544['query']=_['keys'](_0xb27bf9[_0xa1eb('0x35')]);_0x5a6544[_0xa1eb('0x36')]=_[_0xa1eb('0x37')](_0x5a6544[_0xa1eb('0x34')],_0x5a6544[_0xa1eb('0x35')]);_0x2e281a['attributes']=_['intersection'](_0x5a6544[_0xa1eb('0x34')],qs[_0xa1eb('0x38')](_0xb27bf9['query']['fields']));_0x2e281a[_0xa1eb('0x39')]=_0x2e281a['attributes'][_0xa1eb('0x3a')]?_0x2e281a['attributes']:_0x5a6544[_0xa1eb('0x34')];if(!_0xb27bf9[_0xa1eb('0x35')][_0xa1eb('0x3b')]('nolimit')){_0x2e281a[_0xa1eb('0x1d')]=qs[_0xa1eb('0x1d')](_0xb27bf9[_0xa1eb('0x35')]['limit']);_0x2e281a[_0xa1eb('0x1c')]=qs[_0xa1eb('0x1c')](_0xb27bf9[_0xa1eb('0x35')][_0xa1eb('0x1c')]);}_0x2e281a[_0xa1eb('0x3c')]=qs['sort'](_0xb27bf9[_0xa1eb('0x35')][_0xa1eb('0x3d')]);_0x2e281a[_0xa1eb('0x3e')]=qs[_0xa1eb('0x36')](_[_0xa1eb('0x3f')](_0xb27bf9[_0xa1eb('0x35')],_0x5a6544[_0xa1eb('0x36')]),_0x9d49d8);if(_0xb27bf9[_0xa1eb('0x35')]['filter']){_0x2e281a[_0xa1eb('0x3e')]=_[_0xa1eb('0x40')](_0x2e281a[_0xa1eb('0x3e')],{'$or':_[_0xa1eb('0x2e')](_0x9d49d8,function(_0x1c390c){if(_0x1c390c['type']!==_0xa1eb('0x41')){var _0x3d28dc={};_0x3d28dc[_0x1c390c[_0xa1eb('0x2c')]]={'$like':'%'+_0xb27bf9['query'][_0xa1eb('0x42')]+'%'};return _0x3d28dc;}})});}_0x2e281a=_[_0xa1eb('0x40')]({},_0x2e281a,_0xb27bf9[_0xa1eb('0x43')]);var _0x13ced7={'where':_0x2e281a[_0xa1eb('0x3e')]};return db[_0xa1eb('0x2f')][_0xa1eb('0x1e')](_0x13ced7)['then'](function(_0x3c8713){_0x52f9c7[_0xa1eb('0x1e')]=_0x3c8713;if(_0xb27bf9['query'][_0xa1eb('0x44')]){_0x2e281a['include']=[{'all':!![]}];}return db[_0xa1eb('0x2f')][_0xa1eb('0x45')](_0x2e281a);})[_0xa1eb('0x24')](function(_0x361675){_0x52f9c7[_0xa1eb('0x46')]=_0x361675;return _0x52f9c7;})[_0xa1eb('0x24')](respondWithFilteredResult(_0x401510,_0x2e281a))[_0xa1eb('0x47')](handleError(_0x401510,null));};exports[_0xa1eb('0x48')]=function(_0x9c297d,_0x44a2de){var _0xd5b217={'raw':![],'where':{'id':_0x9c297d[_0xa1eb('0x49')]['id']}},_0x3c4690={};_0x3c4690[_0xa1eb('0x34')]=_[_0xa1eb('0x4a')](db[_0xa1eb('0x2f')]['rawAttributes']);_0x3c4690[_0xa1eb('0x35')]=_['keys'](_0x9c297d[_0xa1eb('0x35')]);_0x3c4690[_0xa1eb('0x36')]=_['intersection'](_0x3c4690['model'],_0x3c4690[_0xa1eb('0x35')]);_0xd5b217[_0xa1eb('0x39')]=_[_0xa1eb('0x37')](_0x3c4690['model'],qs[_0xa1eb('0x38')](_0x9c297d[_0xa1eb('0x35')][_0xa1eb('0x38')]));_0xd5b217[_0xa1eb('0x39')]=_0xd5b217[_0xa1eb('0x39')][_0xa1eb('0x3a')]?_0xd5b217[_0xa1eb('0x39')]:_0x3c4690[_0xa1eb('0x34')];if(_0x9c297d[_0xa1eb('0x35')][_0xa1eb('0x44')]){_0xd5b217[_0xa1eb('0x4b')]=[{'all':!![]}];}_0xd5b217=_[_0xa1eb('0x40')]({},_0xd5b217,_0x9c297d[_0xa1eb('0x43')]);return db[_0xa1eb('0x2f')]['find'](_0xd5b217)[_0xa1eb('0x24')](handleEntityNotFound(_0x44a2de,null))[_0xa1eb('0x24')](respondWithResult(_0x44a2de,null))[_0xa1eb('0x47')](handleError(_0x44a2de,null));};exports[_0xa1eb('0x4c')]=function(_0x2b0cbf,_0x12dfd4){return db[_0xa1eb('0x2f')]['create'](_0x2b0cbf[_0xa1eb('0x4d')],{})[_0xa1eb('0x24')](function(_0x27021a){var _0x10a6da=_0x2b0cbf[_0xa1eb('0x4e')][_0xa1eb('0x26')]({'plain':!![]});if(!_0x10a6da)throw new Error(_0xa1eb('0x4f'));if(_0x10a6da[_0xa1eb('0x50')]===_0xa1eb('0x4e')){var _0x4f7c05=_0x27021a[_0xa1eb('0x26')]({'plain':!![]});var _0x5c3db1=_0xa1eb('0x27');return db['UserProfileSection'][_0xa1eb('0x51')]({'where':{'name':_0x5c3db1,'userProfileId':_0x10a6da[_0xa1eb('0x52')]},'raw':!![]})[_0xa1eb('0x24')](function(_0x5cc25e){if(_0x5cc25e&&_0x5cc25e[_0xa1eb('0x53')]===0x0){return db[_0xa1eb('0x28')]['create']({'name':_0x4f7c05[_0xa1eb('0x2c')],'resourceId':_0x4f7c05['id'],'type':_0x5cc25e[_0xa1eb('0x2c')],'sectionId':_0x5cc25e['id']},{})[_0xa1eb('0x24')](function(){return _0x27021a;});}else{return _0x27021a;}})[_0xa1eb('0x47')](function(_0x11cc84){logger[_0xa1eb('0x2a')](_0xa1eb('0x54'),_0x11cc84);throw _0x11cc84;});}return _0x27021a;})[_0xa1eb('0x24')](respondWithResult(_0x12dfd4,0xc9))[_0xa1eb('0x47')](handleError(_0x12dfd4,null));};exports[_0xa1eb('0x55')]=function(_0x42519b,_0x4391be){var _0x159a19={'where':{'id':_0x42519b[_0xa1eb('0x49')]['id']}},_0x260c4a={};_0x260c4a[_0xa1eb('0x34')]=_[_0xa1eb('0x4a')](db['Campaign'][_0xa1eb('0x30')]);_0x159a19[_0xa1eb('0x39')]=_[_0xa1eb('0x37')](_0x260c4a[_0xa1eb('0x34')],qs[_0xa1eb('0x38')](_0x42519b[_0xa1eb('0x35')]['fields']));_0x159a19[_0xa1eb('0x39')]=_0x159a19[_0xa1eb('0x39')][_0xa1eb('0x3a')]?_0x159a19[_0xa1eb('0x39')]:_0x260c4a[_0xa1eb('0x34')];if(_0x42519b[_0xa1eb('0x35')][_0xa1eb('0x44')]){_0x159a19['include']=[{'all':!![]}];}_0x159a19=_[_0xa1eb('0x40')]({},_0x159a19,_0x42519b[_0xa1eb('0x43')]);return db[_0xa1eb('0x2f')][_0xa1eb('0x51')](_0x159a19)['then'](handleEntityNotFound(_0x4391be,null))['then'](function(_0x58ca4e){if(_0x58ca4e){var _0x5673fa=_0x58ca4e[_0xa1eb('0x26')]({'plain':!![]});_0x5673fa=qs[_0xa1eb('0x56')](_0x5673fa,['id','createdAt',_0xa1eb('0x57')]);_0x42519b[_0xa1eb('0x4d')]=_[_0xa1eb('0x56')](_0x42519b[_0xa1eb('0x4d')],['id','createdAt','updatedAt']);return db[_0xa1eb('0x2f')][_0xa1eb('0x4c')](_[_0xa1eb('0x40')](_0x5673fa,_0x42519b[_0xa1eb('0x4d')]),{'include':_0x42519b[_0xa1eb('0x35')][_0xa1eb('0x44')]?[{'all':!![]}]:undefined})['then'](function(_0x532dfa){var _0x43f223=_0x42519b['user'][_0xa1eb('0x26')]({'plain':!![]});if(!_0x43f223)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x43f223[_0xa1eb('0x50')]===_0xa1eb('0x4e')){var _0x59aee1=_0x532dfa[_0xa1eb('0x26')]({'plain':!![]});var _0xf48372='IvrCampaigns';return db[_0xa1eb('0x58')][_0xa1eb('0x51')]({'where':{'name':_0xf48372,'userProfileId':_0x43f223[_0xa1eb('0x52')]},'raw':!![]})['then'](function(_0x9799d3){if(_0x9799d3&&_0x9799d3[_0xa1eb('0x53')]===0x0){return db['UserProfileResource'][_0xa1eb('0x4c')]({'name':_0x59aee1[_0xa1eb('0x2c')],'resourceId':_0x59aee1['id'],'type':_0x9799d3[_0xa1eb('0x2c')],'sectionId':_0x9799d3['id']},{})['then'](function(){return _0x532dfa;});}else{return _0x532dfa;}})[_0xa1eb('0x47')](function(_0x5aa916){logger[_0xa1eb('0x2a')](_0xa1eb('0x54'),_0x5aa916);throw _0x5aa916;});}return _0x532dfa;});}})[_0xa1eb('0x24')](respondWithResult(_0x4391be,0xc9))[_0xa1eb('0x47')](handleError(_0x4391be,null));};exports[_0xa1eb('0x23')]=function(_0x48f49d,_0x2aba03){if(_0x48f49d[_0xa1eb('0x4d')]['id']){delete _0x48f49d[_0xa1eb('0x4d')]['id'];}return db['Campaign'][_0xa1eb('0x51')]({'where':{'id':_0x48f49d['params']['id']}})['then'](handleEntityNotFound(_0x2aba03,null))['then'](saveUpdates(_0x48f49d['body'],null))[_0xa1eb('0x24')](respondWithResult(_0x2aba03,null))[_0xa1eb('0x47')](handleError(_0x2aba03,null));};exports[_0xa1eb('0x25')]=function(_0x4039de,_0x149de3){return db[_0xa1eb('0x2f')][_0xa1eb('0x51')]({'where':{'id':_0x4039de[_0xa1eb('0x49')]['id']}})[_0xa1eb('0x24')](handleEntityNotFound(_0x149de3,null))[_0xa1eb('0x24')](removeEntity(_0x149de3,null))['catch'](handleError(_0x149de3,null));};exports[_0xa1eb('0x59')]=function(_0x1d1c91,_0x46207c,_0x1f9418){var _0x1a9afe={'raw':!![],'where':{}};var _0x4593f6={};var _0x4bf3c9={'count':0x0,'rows':[]};return db[_0xa1eb('0x2f')][_0xa1eb('0x5a')]({'where':{'id':_0x1d1c91[_0xa1eb('0x49')]['id']}})['then'](handleEntityNotFound(_0x46207c,null))[_0xa1eb('0x24')](function(_0x11a74e){if(_0x11a74e){_0x4593f6[_0xa1eb('0x34')]=_[_0xa1eb('0x4a')](db[_0xa1eb('0x5b')]['rawAttributes']);_0x4593f6[_0xa1eb('0x35')]=_['keys'](_0x1d1c91[_0xa1eb('0x35')]);_0x4593f6['filters']=_[_0xa1eb('0x37')](_0x4593f6[_0xa1eb('0x34')],_0x4593f6[_0xa1eb('0x35')]);_0x1a9afe[_0xa1eb('0x39')]=_['intersection'](_0x4593f6[_0xa1eb('0x34')],qs[_0xa1eb('0x38')](_0x1d1c91[_0xa1eb('0x35')][_0xa1eb('0x38')]));_0x1a9afe['attributes']=_0x1a9afe[_0xa1eb('0x39')][_0xa1eb('0x3a')]?_0x1a9afe[_0xa1eb('0x39')]:_0x4593f6[_0xa1eb('0x34')];if(!_0x1d1c91[_0xa1eb('0x35')][_0xa1eb('0x3b')](_0xa1eb('0x5c'))){_0x1a9afe[_0xa1eb('0x1d')]=qs[_0xa1eb('0x1d')](_0x1d1c91['query']['limit']);_0x1a9afe['offset']=qs[_0xa1eb('0x1c')](_0x1d1c91['query'][_0xa1eb('0x1c')]);}_0x1a9afe[_0xa1eb('0x3c')]=qs['sort'](_0x1d1c91['query'][_0xa1eb('0x3d')]);_0x1a9afe[_0xa1eb('0x3e')]=qs[_0xa1eb('0x36')](_[_0xa1eb('0x3f')](_0x1d1c91[_0xa1eb('0x35')],_0x4593f6['filters']));_0x1a9afe['where'][_0xa1eb('0x5d')]=_0x11a74e['id'];if(_0x1d1c91[_0xa1eb('0x35')][_0xa1eb('0x42')]){_0x1a9afe[_0xa1eb('0x3e')]=_['merge'](_0x1a9afe[_0xa1eb('0x3e')],{'$or':_[_0xa1eb('0x2e')](_0x1a9afe[_0xa1eb('0x39')],function(_0x4050d6){var _0x3863ce={};_0x3863ce[_0x4050d6]={'$like':'%'+_0x1d1c91[_0xa1eb('0x35')][_0xa1eb('0x42')]+'%'};return _0x3863ce;})});}_0x1a9afe=_[_0xa1eb('0x40')]({},_0x1a9afe,_0x1d1c91[_0xa1eb('0x43')]);return db[_0xa1eb('0x5b')][_0xa1eb('0x1e')]({'where':_0x1a9afe['where']})[_0xa1eb('0x24')](function(_0x3c027a){_0x4bf3c9[_0xa1eb('0x1e')]=_0x3c027a;if(_0x1d1c91[_0xa1eb('0x35')][_0xa1eb('0x44')]){_0x1a9afe[_0xa1eb('0x4b')]=[{'all':!![]}];}return db['CmHopper'][_0xa1eb('0x45')](_0x1a9afe);})[_0xa1eb('0x24')](function(_0x2ff1fb){_0x4bf3c9[_0xa1eb('0x46')]=_0x2ff1fb;return _0x4bf3c9;});}})['then'](respondWithFilteredResult(_0x46207c,_0x1a9afe))['catch'](handleError(_0x46207c,null));};exports[_0xa1eb('0x5e')]=function(_0x5e0cd5,_0x2bd903,_0x2ca83a){var _0x518261={'raw':!![],'where':{}};var _0x2f9822={};var _0x1b01f9={'count':0x0,'rows':[]};return db['Campaign'][_0xa1eb('0x5a')]({'where':{'id':_0x5e0cd5[_0xa1eb('0x49')]['id']}})[_0xa1eb('0x24')](handleEntityNotFound(_0x2bd903,null))[_0xa1eb('0x24')](function(_0x3d9034){if(_0x3d9034){_0x2f9822[_0xa1eb('0x34')]=_[_0xa1eb('0x4a')](db[_0xa1eb('0x5f')][_0xa1eb('0x30')]);_0x2f9822[_0xa1eb('0x35')]=_[_0xa1eb('0x4a')](_0x5e0cd5['query']);_0x2f9822[_0xa1eb('0x36')]=_[_0xa1eb('0x37')](_0x2f9822[_0xa1eb('0x34')],_0x2f9822[_0xa1eb('0x35')]);_0x518261['attributes']=_[_0xa1eb('0x37')](_0x2f9822[_0xa1eb('0x34')],qs[_0xa1eb('0x38')](_0x5e0cd5['query'][_0xa1eb('0x38')]));_0x518261[_0xa1eb('0x39')]=_0x518261[_0xa1eb('0x39')]['length']?_0x518261[_0xa1eb('0x39')]:_0x2f9822['model'];if(!_0x5e0cd5[_0xa1eb('0x35')][_0xa1eb('0x3b')](_0xa1eb('0x5c'))){_0x518261[_0xa1eb('0x1d')]=qs[_0xa1eb('0x1d')](_0x5e0cd5[_0xa1eb('0x35')][_0xa1eb('0x1d')]);_0x518261[_0xa1eb('0x1c')]=qs['offset'](_0x5e0cd5[_0xa1eb('0x35')][_0xa1eb('0x1c')]);}_0x518261[_0xa1eb('0x3c')]=qs[_0xa1eb('0x3d')](_0x5e0cd5[_0xa1eb('0x35')]['sort']);_0x518261[_0xa1eb('0x3e')]=qs[_0xa1eb('0x36')](_['pick'](_0x5e0cd5[_0xa1eb('0x35')],_0x2f9822['filters']));_0x518261['where'][_0xa1eb('0x5d')]=_0x3d9034['id'];if(_0x5e0cd5[_0xa1eb('0x35')]['filter']){_0x518261[_0xa1eb('0x3e')]=_[_0xa1eb('0x40')](_0x518261['where'],{'$or':_[_0xa1eb('0x2e')](_0x518261[_0xa1eb('0x39')],function(_0x4d2598){var _0x4d75a8={};_0x4d75a8[_0x4d2598]={'$like':'%'+_0x5e0cd5[_0xa1eb('0x35')]['filter']+'%'};return _0x4d75a8;})});}_0x518261=_[_0xa1eb('0x40')]({},_0x518261,_0x5e0cd5[_0xa1eb('0x43')]);return db[_0xa1eb('0x5f')][_0xa1eb('0x1e')]({'where':_0x518261[_0xa1eb('0x3e')]})[_0xa1eb('0x24')](function(_0x4d589f){_0x1b01f9[_0xa1eb('0x1e')]=_0x4d589f;if(_0x5e0cd5['query'][_0xa1eb('0x44')]){_0x518261[_0xa1eb('0x4b')]=[{'all':!![]}];}return db[_0xa1eb('0x5f')][_0xa1eb('0x45')](_0x518261);})[_0xa1eb('0x24')](function(_0x2e85dd){_0x1b01f9[_0xa1eb('0x46')]=_0x2e85dd;return _0x1b01f9;});}})['then'](respondWithFilteredResult(_0x2bd903,_0x518261))[_0xa1eb('0x47')](handleError(_0x2bd903,null));};exports['getHopperFinals']=function(_0x5594b5,_0x44d29c,_0xd72914){var _0x456ddb={'raw':!![],'where':{}};var _0x559d58={};var _0x14eff1={'count':0x0,'rows':[]};return db[_0xa1eb('0x2f')]['findOne']({'where':{'id':_0x5594b5[_0xa1eb('0x49')]['id']}})['then'](handleEntityNotFound(_0x44d29c,null))[_0xa1eb('0x24')](function(_0x52863d){if(_0x52863d){_0x559d58[_0xa1eb('0x34')]=_[_0xa1eb('0x4a')](db['CmHopperFinal']['rawAttributes']);_0x559d58[_0xa1eb('0x35')]=_[_0xa1eb('0x4a')](_0x5594b5[_0xa1eb('0x35')]);_0x559d58[_0xa1eb('0x36')]=_[_0xa1eb('0x37')](_0x559d58[_0xa1eb('0x34')],_0x559d58[_0xa1eb('0x35')]);_0x456ddb[_0xa1eb('0x39')]=_[_0xa1eb('0x37')](_0x559d58[_0xa1eb('0x34')],qs[_0xa1eb('0x38')](_0x5594b5[_0xa1eb('0x35')][_0xa1eb('0x38')]));_0x456ddb[_0xa1eb('0x39')]=_0x456ddb[_0xa1eb('0x39')]['length']?_0x456ddb[_0xa1eb('0x39')]:_0x559d58[_0xa1eb('0x34')];if(!_0x5594b5['query'][_0xa1eb('0x3b')]('nolimit')){_0x456ddb[_0xa1eb('0x1d')]=qs[_0xa1eb('0x1d')](_0x5594b5[_0xa1eb('0x35')]['limit']);_0x456ddb[_0xa1eb('0x1c')]=qs[_0xa1eb('0x1c')](_0x5594b5[_0xa1eb('0x35')][_0xa1eb('0x1c')]);}_0x456ddb['order']=qs[_0xa1eb('0x3d')](_0x5594b5['query'][_0xa1eb('0x3d')]);_0x456ddb[_0xa1eb('0x3e')]=qs[_0xa1eb('0x36')](_[_0xa1eb('0x3f')](_0x5594b5[_0xa1eb('0x35')],_0x559d58[_0xa1eb('0x36')]));_0x456ddb[_0xa1eb('0x3e')][_0xa1eb('0x5d')]=_0x52863d['id'];if(_0x5594b5['query'][_0xa1eb('0x42')]){_0x456ddb[_0xa1eb('0x3e')]=_[_0xa1eb('0x40')](_0x456ddb[_0xa1eb('0x3e')],{'$or':_[_0xa1eb('0x2e')](_0x456ddb[_0xa1eb('0x39')],function(_0x215d28){var _0x8d8091={};_0x8d8091[_0x215d28]={'$like':'%'+_0x5594b5[_0xa1eb('0x35')][_0xa1eb('0x42')]+'%'};return _0x8d8091;})});}_0x456ddb=_[_0xa1eb('0x40')]({},_0x456ddb,_0x5594b5[_0xa1eb('0x43')]);return db[_0xa1eb('0x60')][_0xa1eb('0x1e')]({'where':_0x456ddb['where']})[_0xa1eb('0x24')](function(_0x1bb3ae){_0x14eff1['count']=_0x1bb3ae;if(_0x5594b5['query'][_0xa1eb('0x44')]){_0x456ddb[_0xa1eb('0x4b')]=[{'all':!![]}];}return db[_0xa1eb('0x60')][_0xa1eb('0x45')](_0x456ddb);})['then'](function(_0x402acb){_0x14eff1['rows']=_0x402acb;return _0x14eff1;});}})[_0xa1eb('0x24')](respondWithFilteredResult(_0x44d29c,_0x456ddb))[_0xa1eb('0x47')](handleError(_0x44d29c,null));};exports[_0xa1eb('0x61')]=function(_0xdb596f,_0x33a90e,_0x36b2df){var _0x33d180={'raw':!![],'where':{}};var _0x47e820={};var _0x4df201={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0xdb596f[_0xa1eb('0x49')]['id']}})['then'](handleEntityNotFound(_0x33a90e,null))[_0xa1eb('0x24')](function(_0x2c97f8){if(_0x2c97f8){_0x47e820[_0xa1eb('0x34')]=_[_0xa1eb('0x4a')](db[_0xa1eb('0x62')][_0xa1eb('0x30')]);_0x47e820[_0xa1eb('0x35')]=_[_0xa1eb('0x4a')](_0xdb596f[_0xa1eb('0x35')]);_0x47e820[_0xa1eb('0x36')]=_[_0xa1eb('0x37')](_0x47e820[_0xa1eb('0x34')],_0x47e820[_0xa1eb('0x35')]);_0x33d180[_0xa1eb('0x39')]=_[_0xa1eb('0x37')](_0x47e820['model'],qs[_0xa1eb('0x38')](_0xdb596f['query'][_0xa1eb('0x38')]));_0x33d180[_0xa1eb('0x39')]=_0x33d180['attributes']['length']?_0x33d180[_0xa1eb('0x39')]:_0x47e820[_0xa1eb('0x34')];if(!_0xdb596f[_0xa1eb('0x35')][_0xa1eb('0x3b')](_0xa1eb('0x5c'))){_0x33d180[_0xa1eb('0x1d')]=qs['limit'](_0xdb596f[_0xa1eb('0x35')][_0xa1eb('0x1d')]);_0x33d180[_0xa1eb('0x1c')]=qs[_0xa1eb('0x1c')](_0xdb596f[_0xa1eb('0x35')][_0xa1eb('0x1c')]);}_0x33d180[_0xa1eb('0x3c')]=qs['sort'](_0xdb596f[_0xa1eb('0x35')][_0xa1eb('0x3d')]);_0x33d180['where']=qs['filters'](_[_0xa1eb('0x3f')](_0xdb596f['query'],_0x47e820['filters']));_0x33d180[_0xa1eb('0x3e')]['CampaignId']=_0x2c97f8['id'];if(_0xdb596f[_0xa1eb('0x35')][_0xa1eb('0x42')]){_0x33d180['where']=_[_0xa1eb('0x40')](_0x33d180[_0xa1eb('0x3e')],{'$or':_[_0xa1eb('0x2e')](_0x33d180[_0xa1eb('0x39')],function(_0x4f535b){var _0x21b450={};_0x21b450[_0x4f535b]={'$like':'%'+_0xdb596f[_0xa1eb('0x35')][_0xa1eb('0x42')]+'%'};return _0x21b450;})});}_0x33d180=_[_0xa1eb('0x40')]({},_0x33d180,_0xdb596f[_0xa1eb('0x43')]);return db['CmHopperBlack']['count']({'where':_0x33d180['where']})[_0xa1eb('0x24')](function(_0x2ce42f){_0x4df201[_0xa1eb('0x1e')]=_0x2ce42f;if(_0xdb596f[_0xa1eb('0x35')][_0xa1eb('0x44')]){_0x33d180[_0xa1eb('0x4b')]=[{'all':!![]}];}return db[_0xa1eb('0x62')][_0xa1eb('0x45')](_0x33d180);})[_0xa1eb('0x24')](function(_0x34e1ae){_0x4df201[_0xa1eb('0x46')]=_0x34e1ae;return _0x4df201;});}})[_0xa1eb('0x24')](respondWithFilteredResult(_0x33a90e,_0x33d180))[_0xa1eb('0x47')](handleError(_0x33a90e,null));};exports[_0xa1eb('0x63')]=function(_0x16622a,_0x644b33,_0x460abc){var _0x5d78fe={};var _0x33e541={};var _0x14c4c3;var _0x5988ef;return db[_0xa1eb('0x2f')][_0xa1eb('0x5a')]({'where':{'id':_0x16622a[_0xa1eb('0x49')]['id']}})[_0xa1eb('0x24')](handleEntityNotFound(_0x644b33,null))[_0xa1eb('0x24')](function(_0x4d15c6){if(_0x4d15c6){_0x14c4c3=_0x4d15c6;_0x33e541['model']=_[_0xa1eb('0x4a')](db['CmList'][_0xa1eb('0x30')]);_0x33e541[_0xa1eb('0x35')]=_['keys'](_0x16622a['query']);_0x33e541['filters']=_[_0xa1eb('0x37')](_0x33e541['model'],_0x33e541[_0xa1eb('0x35')]);_0x5d78fe[_0xa1eb('0x39')]=_[_0xa1eb('0x37')](_0x33e541[_0xa1eb('0x34')],qs[_0xa1eb('0x38')](_0x16622a[_0xa1eb('0x35')][_0xa1eb('0x38')]));_0x5d78fe['attributes']=_0x5d78fe[_0xa1eb('0x39')][_0xa1eb('0x3a')]?_0x5d78fe[_0xa1eb('0x39')]:_0x33e541['model'];_0x5d78fe['order']=qs[_0xa1eb('0x3d')](_0x16622a[_0xa1eb('0x35')][_0xa1eb('0x3d')]);_0x5d78fe[_0xa1eb('0x3e')]=qs[_0xa1eb('0x36')](_['pick'](_0x16622a[_0xa1eb('0x35')],_0x33e541['filters']));if(_0x16622a[_0xa1eb('0x35')][_0xa1eb('0x42')]){_0x5d78fe[_0xa1eb('0x3e')]=_[_0xa1eb('0x40')](_0x5d78fe['where'],{'$or':_[_0xa1eb('0x2e')](_0x5d78fe[_0xa1eb('0x39')],function(_0x35e0f5){var _0x45f906={};_0x45f906[_0x35e0f5]={'$like':'%'+_0x16622a[_0xa1eb('0x35')]['filter']+'%'};return _0x45f906;})});}_0x5d78fe=_[_0xa1eb('0x40')]({},_0x5d78fe,_0x16622a[_0xa1eb('0x43')]);return _0x14c4c3[_0xa1eb('0x63')](_0x5d78fe);}})['then'](function(_0x13cf02){if(_0x13cf02){_0x5988ef=_0x13cf02[_0xa1eb('0x3a')];if(!_0x16622a['query'][_0xa1eb('0x3b')](_0xa1eb('0x5c'))){_0x5d78fe[_0xa1eb('0x1d')]=qs[_0xa1eb('0x1d')](_0x16622a[_0xa1eb('0x35')][_0xa1eb('0x1d')]);_0x5d78fe[_0xa1eb('0x1c')]=qs[_0xa1eb('0x1c')](_0x16622a[_0xa1eb('0x35')]['offset']);}return _0x14c4c3[_0xa1eb('0x63')](_0x5d78fe);}})[_0xa1eb('0x24')](function(_0x188f2f){if(_0x188f2f){return _0x188f2f?{'count':_0x5988ef,'rows':_0x188f2f}:null;}})[_0xa1eb('0x24')](respondWithResult(_0x644b33,null))[_0xa1eb('0x47')](handleError(_0x644b33,null));};exports[_0xa1eb('0x64')]=function(_0x1c08f3,_0x57b29c,_0x450f96){var _0x5c8665,_0x509bdd;var _0x9b8e68=[];var _0x107c29=moment()[_0xa1eb('0x65')](_0xa1eb('0x66'));return db['Campaign']['find']({'where':{'id':_0x1c08f3[_0xa1eb('0x49')]['id']}})[_0xa1eb('0x24')](handleEntityNotFound(_0x57b29c,null))[_0xa1eb('0x24')](function(_0x238508){if(_0x238508){_0x509bdd=_0x238508;return _0x238508[_0xa1eb('0x64')](_0x1c08f3[_0xa1eb('0x4d')][_0xa1eb('0x67')],_['omit'](_0x1c08f3[_0xa1eb('0x4d')],['ids','id'])||{});}return null;})[_0xa1eb('0x68')](function(_0x53b5bc){var _0x7a2630;var _0x262ff1;_0x5c8665=_0x53b5bc||[];var _0x1c9a2b=[];if(_0x53b5bc){for(var _0x1a63a1=0x0;_0x1a63a1<_0x53b5bc[_0xa1eb('0x3a')];_0x1a63a1+=0x1){var _0x23f7d5=_0x53b5bc[_0x1a63a1][_0xa1eb('0x26')]({'plain':!![]});_0x509bdd[_0xa1eb('0x69')]=_0x1c08f3[_0xa1eb('0x4d')][_0xa1eb('0x69')]?_0x1c08f3[_0xa1eb('0x4d')]['dialCheckDuplicateType']:_0x509bdd[_0xa1eb('0x69')];switch(_0x509bdd[_0xa1eb('0x69')]){case _0xa1eb('0x6a'):_0x7a2630=squel[_0xa1eb('0x6b')]()['into'](_0xa1eb('0x6c'))[_0xa1eb('0x6d')]([_0xa1eb('0x6e'),_0xa1eb('0x6f'),_0xa1eb('0x70'),_0xa1eb('0x71'),'CampaignId',_0xa1eb('0x72'),_0xa1eb('0x57')],squel[_0xa1eb('0x73')]()[_0xa1eb('0x74')]('phone',_0xa1eb('0x6e'))[_0xa1eb('0x74')](_0xa1eb('0x75'),'scheduledAt')['field']('id',_0xa1eb('0x70'))[_0xa1eb('0x74')](_0x23f7d5[_0xa1eb('0x76')][_0xa1eb('0x77')](),_0xa1eb('0x71'))[_0xa1eb('0x74')](_0x1c08f3[_0xa1eb('0x49')]['id'][_0xa1eb('0x77')](),_0xa1eb('0x5d'))[_0xa1eb('0x74')]('\x27'+_0x107c29+'\x27','createdAt')[_0xa1eb('0x74')]('\x27'+_0x107c29+'\x27',_0xa1eb('0x57'))[_0xa1eb('0x78')]('cm_contacts')[_0xa1eb('0x3e')](_0xa1eb('0x79'))[_0xa1eb('0x3e')](_0xa1eb('0x7a'),_0x23f7d5[_0xa1eb('0x76')][_0xa1eb('0x77')]())[_0xa1eb('0x3e')](_0xa1eb('0x7b'))[_0xa1eb('0x3e')]('phone\x20NOT\x20IN\x20(?)',squel[_0xa1eb('0x73')]()['field']('COALESCE(calleridnum,\x27\x27)')[_0xa1eb('0x78')](_0xa1eb('0x7c'))[_0xa1eb('0x3e')]('CampaignId\x20=\x20?',_0x1c08f3['params']['id'][_0xa1eb('0x77')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xa1eb('0x74')](_0xa1eb('0x7d'))['from'](_0xa1eb('0x6c'))['where'](_0xa1eb('0x7e'),_0x1c08f3[_0xa1eb('0x49')]['id']['toString']())))[_0xa1eb('0x77')]();break;case'onlyIfOpen':_0x7a2630=squel[_0xa1eb('0x6b')]()[_0xa1eb('0x7f')](_0xa1eb('0x6c'))[_0xa1eb('0x6d')](['phone',_0xa1eb('0x6f'),_0xa1eb('0x70'),_0xa1eb('0x71'),'CampaignId',_0xa1eb('0x72'),_0xa1eb('0x57')],squel['select']()['field']('phone',_0xa1eb('0x6e'))[_0xa1eb('0x74')]('NOW()',_0xa1eb('0x6f'))[_0xa1eb('0x74')]('id',_0xa1eb('0x70'))['field'](_0x23f7d5[_0xa1eb('0x76')][_0xa1eb('0x77')](),'ListId')[_0xa1eb('0x74')](_0x1c08f3[_0xa1eb('0x49')]['id'][_0xa1eb('0x77')](),_0xa1eb('0x5d'))[_0xa1eb('0x74')]('\x27'+_0x107c29+'\x27',_0xa1eb('0x72'))[_0xa1eb('0x74')]('\x27'+_0x107c29+'\x27',_0xa1eb('0x57'))[_0xa1eb('0x78')](_0xa1eb('0x80'))[_0xa1eb('0x3e')](_0xa1eb('0x79'))[_0xa1eb('0x3e')](_0xa1eb('0x7a'),_0x23f7d5[_0xa1eb('0x76')]['toString']())[_0xa1eb('0x3e')](_0xa1eb('0x7b'))[_0xa1eb('0x3e')]('phone\x20NOT\x20IN\x20(?)',squel[_0xa1eb('0x73')]()[_0xa1eb('0x74')]('COALESCE(phone,\x27\x27)')[_0xa1eb('0x78')](_0xa1eb('0x6c'))[_0xa1eb('0x3e')](_0xa1eb('0x7e'),_0x1c08f3[_0xa1eb('0x49')]['id'][_0xa1eb('0x77')]())))[_0xa1eb('0x77')]();break;default:_0x7a2630=squel[_0xa1eb('0x6b')]()[_0xa1eb('0x7f')](_0xa1eb('0x6c'))['fromQuery'](['phone',_0xa1eb('0x6f'),_0xa1eb('0x70'),_0xa1eb('0x71'),'CampaignId',_0xa1eb('0x72'),_0xa1eb('0x57')],squel[_0xa1eb('0x73')]()[_0xa1eb('0x74')](_0xa1eb('0x6e'),_0xa1eb('0x6e'))[_0xa1eb('0x74')](_0xa1eb('0x75'),_0xa1eb('0x6f'))[_0xa1eb('0x74')]('id','ContactId')['field'](_0x23f7d5['CmListId'][_0xa1eb('0x77')](),_0xa1eb('0x71'))[_0xa1eb('0x74')](_0x1c08f3[_0xa1eb('0x49')]['id'][_0xa1eb('0x77')](),_0xa1eb('0x5d'))[_0xa1eb('0x74')]('\x27'+_0x107c29+'\x27',_0xa1eb('0x72'))[_0xa1eb('0x74')]('\x27'+_0x107c29+'\x27',_0xa1eb('0x57'))[_0xa1eb('0x78')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0xa1eb('0x3e')](_0xa1eb('0x7a'),_0x23f7d5[_0xa1eb('0x76')]['toString']())[_0xa1eb('0x3e')]('phone\x20IS\x20NOT\x20NULL'))['toString']();}_0x262ff1=squel[_0xa1eb('0x6b')]()[_0xa1eb('0x7f')](_0xa1eb('0x81'))[_0xa1eb('0x6d')]([_0xa1eb('0x82'),_0xa1eb('0x6f'),_0xa1eb('0x6e'),_0xa1eb('0x83'),_0xa1eb('0x72'),_0xa1eb('0x57')],squel['select']()['field'](_0xa1eb('0x84'),'id')[_0xa1eb('0x74')](_0xa1eb('0x75'),'scheduledAt')[_0xa1eb('0x74')](_0xa1eb('0x85'),_0xa1eb('0x6e'))[_0xa1eb('0x74')](_0xa1eb('0x86'),_0xa1eb('0x83'))[_0xa1eb('0x74')]('\x27'+_0x107c29+'\x27','createdAt')[_0xa1eb('0x74')]('\x27'+_0x107c29+'\x27',_0xa1eb('0x57'))[_0xa1eb('0x78')](_0xa1eb('0x87'),'ci')['join'](_0xa1eb('0x6c'),'h',_0xa1eb('0x88'))[_0xa1eb('0x3e')](_0xa1eb('0x89'),_0x23f7d5['CmListId'][_0xa1eb('0x77')]())['where'](_0xa1eb('0x8a'),_0x1c08f3[_0xa1eb('0x49')]['id']['toString']())['where'](_0xa1eb('0x8b'),_0x107c29))['toString']();_0x1c9a2b[_0xa1eb('0x8c')](db[_0xa1eb('0x8d')][_0xa1eb('0x35')](_0x7a2630));_0x9b8e68['push'](db[_0xa1eb('0x8d')][_0xa1eb('0x35')](_0x262ff1));}return BPromise['all'](_0x1c9a2b);}})['then'](function(){return BPromise[_0xa1eb('0x8e')](_0x9b8e68);})[_0xa1eb('0x24')](function(){return _0x5c8665;})['then'](respondWithResult(_0x57b29c,null))[_0xa1eb('0x47')](handleError(_0x57b29c,null));};exports[_0xa1eb('0x8f')]=function(_0x32ddbb,_0x14f9e1,_0x479ea4){return db[_0xa1eb('0x2f')]['find']({'where':{'id':_0x32ddbb[_0xa1eb('0x49')]['id']}})['then'](handleEntityNotFound(_0x14f9e1,null))[_0xa1eb('0x24')](function(_0x3307ca){if(_0x3307ca){return _0x3307ca[_0xa1eb('0x8f')](_0x32ddbb[_0xa1eb('0x35')][_0xa1eb('0x67')]);}})[_0xa1eb('0x24')](function(_0x1ac7ac){if(_0x1ac7ac){return db[_0xa1eb('0x5b')][_0xa1eb('0x25')]({'where':{'ListId':_0x32ddbb[_0xa1eb('0x35')][_0xa1eb('0x67')],'CampaignId':_0x32ddbb['params']['id']}})[_0xa1eb('0x24')](function(){return _0x1ac7ac;});}})[_0xa1eb('0x24')](respondWithStatusCode(_0x14f9e1,null))[_0xa1eb('0x47')](handleError(_0x14f9e1,null));};exports['getBlackLists']=function(_0x1675ae,_0x11661b,_0x3cde48){var _0x34241b={};var _0x5980e8={};var _0x2147f9;var _0x70f16b;return db[_0xa1eb('0x2f')][_0xa1eb('0x5a')]({'where':{'id':_0x1675ae[_0xa1eb('0x49')]['id']}})[_0xa1eb('0x24')](handleEntityNotFound(_0x11661b,null))['then'](function(_0x50c7fb){if(_0x50c7fb){_0x2147f9=_0x50c7fb;_0x5980e8[_0xa1eb('0x34')]=_[_0xa1eb('0x4a')](db[_0xa1eb('0x90')][_0xa1eb('0x30')]);_0x5980e8[_0xa1eb('0x35')]=_['keys'](_0x1675ae[_0xa1eb('0x35')]);_0x5980e8['filters']=_[_0xa1eb('0x37')](_0x5980e8[_0xa1eb('0x34')],_0x5980e8[_0xa1eb('0x35')]);_0x34241b[_0xa1eb('0x39')]=_['intersection'](_0x5980e8[_0xa1eb('0x34')],qs[_0xa1eb('0x38')](_0x1675ae[_0xa1eb('0x35')]['fields']));_0x34241b['attributes']=_0x34241b['attributes'][_0xa1eb('0x3a')]?_0x34241b[_0xa1eb('0x39')]:_0x5980e8['model'];_0x34241b[_0xa1eb('0x3c')]=qs['sort'](_0x1675ae[_0xa1eb('0x35')][_0xa1eb('0x3d')]);_0x34241b[_0xa1eb('0x3e')]=qs[_0xa1eb('0x36')](_[_0xa1eb('0x3f')](_0x1675ae['query'],_0x5980e8[_0xa1eb('0x36')]));if(_0x1675ae[_0xa1eb('0x35')][_0xa1eb('0x42')]){_0x34241b[_0xa1eb('0x3e')]=_[_0xa1eb('0x40')](_0x34241b[_0xa1eb('0x3e')],{'$or':_[_0xa1eb('0x2e')](_0x34241b[_0xa1eb('0x39')],function(_0x3d58f8){var _0x50fa4f={};_0x50fa4f[_0x3d58f8]={'$like':'%'+_0x1675ae[_0xa1eb('0x35')][_0xa1eb('0x42')]+'%'};return _0x50fa4f;})});}_0x34241b=_['merge']({},_0x34241b,_0x1675ae[_0xa1eb('0x43')]);return _0x2147f9[_0xa1eb('0x91')](_0x34241b);}})[_0xa1eb('0x24')](function(_0x584478){if(_0x584478){_0x70f16b=_0x584478[_0xa1eb('0x3a')];if(!_0x1675ae['query'][_0xa1eb('0x3b')](_0xa1eb('0x5c'))){_0x34241b[_0xa1eb('0x1d')]=qs[_0xa1eb('0x1d')](_0x1675ae[_0xa1eb('0x35')][_0xa1eb('0x1d')]);_0x34241b[_0xa1eb('0x1c')]=qs[_0xa1eb('0x1c')](_0x1675ae[_0xa1eb('0x35')][_0xa1eb('0x1c')]);}return _0x2147f9[_0xa1eb('0x91')](_0x34241b);}})[_0xa1eb('0x24')](function(_0x1e2b6c){if(_0x1e2b6c){return _0x1e2b6c?{'count':_0x70f16b,'rows':_0x1e2b6c}:null;}})[_0xa1eb('0x24')](respondWithResult(_0x11661b,null))[_0xa1eb('0x47')](handleError(_0x11661b,null));};exports[_0xa1eb('0x92')]=function(_0x5a1166,_0x2d0eb3,_0x474ec1){var _0x2f0cb5,_0x4167c2;var _0x57eb4c=[];var _0x560705=moment()[_0xa1eb('0x65')](_0xa1eb('0x66'));return db[_0xa1eb('0x2f')][_0xa1eb('0x51')]({'where':{'id':_0x5a1166[_0xa1eb('0x49')]['id']}})[_0xa1eb('0x24')](handleEntityNotFound(_0x2d0eb3,null))[_0xa1eb('0x24')](function(_0xcb765f){if(_0xcb765f){_0x4167c2=_0xcb765f;return _0xcb765f[_0xa1eb('0x92')](_0x5a1166[_0xa1eb('0x4d')][_0xa1eb('0x67')],_[_0xa1eb('0x56')](_0x5a1166['body'],['ids','id'])||{});}return null;})[_0xa1eb('0x68')](function(_0x5739ed){var _0xe7518a;var _0xaadb24;_0x2f0cb5=_0x5739ed||[];var _0x3161c0=[];if(_0x5739ed){for(var _0x3220c7=0x0;_0x3220c7<_0x5739ed[_0xa1eb('0x3a')];_0x3220c7+=0x1){var _0x37d951=_0x5739ed[_0x3220c7]['get']({'plain':!![]});_0xe7518a=squel[_0xa1eb('0x6b')]()[_0xa1eb('0x7f')](_0xa1eb('0x93'))['fromQuery']([_0xa1eb('0x6e'),_0xa1eb('0x70'),_0xa1eb('0x71'),_0xa1eb('0x5d'),_0xa1eb('0x72'),_0xa1eb('0x57')],squel[_0xa1eb('0x73')]()[_0xa1eb('0x74')]('phone',_0xa1eb('0x6e'))[_0xa1eb('0x74')]('id',_0xa1eb('0x70'))['field'](_0x37d951[_0xa1eb('0x76')][_0xa1eb('0x77')](),'ListId')[_0xa1eb('0x74')](_0x5a1166[_0xa1eb('0x49')]['id'][_0xa1eb('0x77')](),_0xa1eb('0x5d'))['field'](_0xa1eb('0x75'),'createdAt')['field'](_0xa1eb('0x75'),_0xa1eb('0x57'))[_0xa1eb('0x78')](_0xa1eb('0x80'))[_0xa1eb('0x3e')](_0xa1eb('0x79'))['where']('ListId\x20=\x20?',_0x37d951[_0xa1eb('0x76')][_0xa1eb('0x77')]())[_0xa1eb('0x3e')]('phone\x20IS\x20NOT\x20NULL'))['toString']();_0x3161c0['push'](db[_0xa1eb('0x8d')][_0xa1eb('0x35')](_0xe7518a));}return BPromise[_0xa1eb('0x8e')](_0x3161c0);}})[_0xa1eb('0x24')](function(){return _0x2f0cb5;})[_0xa1eb('0x24')](respondWithResult(_0x2d0eb3,null))[_0xa1eb('0x47')](handleError(_0x2d0eb3,null));};exports[_0xa1eb('0x94')]=function(_0x1c8d24,_0x48b2a9,_0x6e4fa1){return db[_0xa1eb('0x2f')]['find']({'where':{'id':_0x1c8d24['params']['id']}})['then'](handleEntityNotFound(_0x48b2a9,null))['then'](function(_0x93d325){if(_0x93d325){return _0x93d325[_0xa1eb('0x94')](_0x1c8d24[_0xa1eb('0x35')][_0xa1eb('0x67')]);}})['then'](function(_0x11455c){if(_0x11455c){return db[_0xa1eb('0x62')][_0xa1eb('0x25')]({'where':{'ListId':_0x1c8d24[_0xa1eb('0x35')][_0xa1eb('0x67')],'CampaignId':_0x1c8d24[_0xa1eb('0x49')]['id']}})[_0xa1eb('0x24')](function(){return _0x11455c;});}})[_0xa1eb('0x24')](respondWithStatusCode(_0x48b2a9,null))[_0xa1eb('0x47')](handleError(_0x48b2a9,null));}; \ No newline at end of file +var _0x486e=['cm_contacts','toString','phone\x20NOT\x20IN\x20(?)','select','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','into','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','ListId\x20=\x20?','cm_hopper_additional_phones','OrderBy','ci.OrderBY','join','h.ContactId\x20=\x20ci.CmContactId','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','spread','cm_hopper_black','removeBlackLists','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','apply','reject','save','then','destroy','IvrCampaigns','UserProfileResource','error','stack','name','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','fields','length','nolimit','order','sort','pick','where','VIRTUAL','merge','options','Campaign','includeAll','findAll','rows','catch','show','intersection','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','include','omit','createdAt','updatedAt','params','getHoppers','findOne','hasOwnProperty','CampaignId','filter','CmHopper','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','format','YYYY-MM-DD\x20HH:mm:ss','ids','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','field','NOW()','CmListId','from'];(function(_0xf855a1,_0x420a35){var _0x9ed54c=function(_0x15d8dd){while(--_0x15d8dd){_0xf855a1['push'](_0xf855a1['shift']());}};_0x9ed54c(++_0x420a35);}(_0x486e,0xb2));var _0xe486=function(_0x252cf9,_0x5221f9){_0x252cf9=_0x252cf9-0x0;var _0x1eb966=_0x486e[_0x252cf9];return _0x1eb966;};'use strict';var emlformat=require(_0xe486('0x0'));var rimraf=require(_0xe486('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe486('0x2'));var rp=require(_0xe486('0x3'));var moment=require(_0xe486('0x4'));var BPromise=require(_0xe486('0x5'));var Mustache=require(_0xe486('0x6'));var util=require(_0xe486('0x7'));var path=require(_0xe486('0x8'));var sox=require(_0xe486('0x9'));var csv=require(_0xe486('0xa'));var ejs=require(_0xe486('0xb'));var fs=require('fs');var fs_extra=require(_0xe486('0xc'));var _=require('lodash');var squel=require(_0xe486('0xd'));var crypto=require(_0xe486('0xe'));var jsforce=require(_0xe486('0xf'));var deskjs=require(_0xe486('0x10'));var toCsv=require(_0xe486('0xa'));var querystring=require(_0xe486('0x11'));var Papa=require(_0xe486('0x12'));var Redis=require(_0xe486('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe486('0x14'));var hardwareService=require(_0xe486('0x15'));var logger=require(_0xe486('0x16'))(_0xe486('0x17'));var utils=require(_0xe486('0x18'));var config=require(_0xe486('0x19'));var licenseUtil=require(_0xe486('0x1a'));var db=require(_0xe486('0x1b'))['db'];function respondWithStatusCode(_0x372057,_0x530344){_0x530344=_0x530344||0xcc;return function(_0x5a1aad){if(_0x5a1aad){return _0x372057[_0xe486('0x1c')](_0x530344);}return _0x372057[_0xe486('0x1d')](_0x530344)[_0xe486('0x1e')]();};}function respondWithResult(_0x564a6f,_0x5ddb65){_0x5ddb65=_0x5ddb65||0xc8;return function(_0x339746){if(_0x339746){return _0x564a6f['status'](_0x5ddb65)[_0xe486('0x1f')](_0x339746);}};}function respondWithFilteredResult(_0x3da621,_0x4a0259){return function(_0x355002){if(_0x355002){var _0x5016f0=typeof _0x4a0259['offset']===_0xe486('0x20')&&typeof _0x4a0259[_0xe486('0x21')]==='undefined';var _0x3d983b=_0x355002['count'];var _0x25e946=_0x5016f0?0x0:_0x4a0259[_0xe486('0x22')];var _0x5d209a=_0x5016f0?_0x355002[_0xe486('0x23')]:_0x4a0259[_0xe486('0x22')]+_0x4a0259['limit'];var _0xf0697f;if(_0x5d209a>=_0x3d983b){_0x5d209a=_0x3d983b;_0xf0697f=0xc8;}else{_0xf0697f=0xce;}_0x3da621[_0xe486('0x1d')](_0xf0697f);return _0x3da621[_0xe486('0x24')]('Content-Range',_0x25e946+'-'+_0x5d209a+'/'+_0x3d983b)[_0xe486('0x1f')](_0x355002);}return null;};}function patchUpdates(_0x301344){return function(_0x2c34e3){try{jsonpatch[_0xe486('0x25')](_0x2c34e3,_0x301344,!![]);}catch(_0x4650bf){return BPromise[_0xe486('0x26')](_0x4650bf);}return _0x2c34e3[_0xe486('0x27')]();};}function saveUpdates(_0xdc43f0,_0x5b61cc){return function(_0x22efff){if(_0x22efff){return _0x22efff['update'](_0xdc43f0)[_0xe486('0x28')](function(_0x50ae4c){return _0x50ae4c;});}return null;};}function removeEntity(_0x3020e7,_0x47a811){return function(_0x39113f){if(_0x39113f){return _0x39113f[_0xe486('0x29')]()[_0xe486('0x28')](function(){var _0x9f77fc=_0x39113f['get']({'plain':!![]});var _0x2e7182=_0xe486('0x2a');return db[_0xe486('0x2b')][_0xe486('0x29')]({'where':{'type':_0x2e7182,'resourceId':_0x9f77fc['id']}})[_0xe486('0x28')](function(){return _0x39113f;});})[_0xe486('0x28')](function(){_0x3020e7['status'](0xcc)[_0xe486('0x1e')]();});}};}function handleEntityNotFound(_0x2b08d0,_0x502b4c){return function(_0x87ece6){if(!_0x87ece6){_0x2b08d0['sendStatus'](0x194);}return _0x87ece6;};}function handleError(_0x48ab9f,_0x4ecdac){_0x4ecdac=_0x4ecdac||0x1f4;return function(_0x361b51){logger[_0xe486('0x2c')](_0x361b51[_0xe486('0x2d')]);if(_0x361b51['name']){delete _0x361b51[_0xe486('0x2e')];}_0x48ab9f['status'](_0x4ecdac)['send'](_0x361b51);};}exports[_0xe486('0x2f')]=function(_0x1c6d22,_0x22a1c9){var _0x2fc3a7={},_0x39f3f9={},_0x70e1bb={'count':0x0,'rows':[]};var _0x39b179=_['map'](db['Campaign'][_0xe486('0x30')],function(_0x5f3b54){return{'name':_0x5f3b54[_0xe486('0x31')],'type':_0x5f3b54[_0xe486('0x32')][_0xe486('0x33')]};});_0x39f3f9[_0xe486('0x34')]=_[_0xe486('0x35')](_0x39b179,'name');_0x39f3f9[_0xe486('0x36')]=_[_0xe486('0x37')](_0x1c6d22[_0xe486('0x36')]);_0x39f3f9[_0xe486('0x38')]=_['intersection'](_0x39f3f9[_0xe486('0x34')],_0x39f3f9[_0xe486('0x36')]);_0x2fc3a7[_0xe486('0x39')]=_['intersection'](_0x39f3f9[_0xe486('0x34')],qs[_0xe486('0x3a')](_0x1c6d22[_0xe486('0x36')][_0xe486('0x3a')]));_0x2fc3a7['attributes']=_0x2fc3a7[_0xe486('0x39')][_0xe486('0x3b')]?_0x2fc3a7[_0xe486('0x39')]:_0x39f3f9[_0xe486('0x34')];if(!_0x1c6d22['query']['hasOwnProperty'](_0xe486('0x3c'))){_0x2fc3a7[_0xe486('0x21')]=qs[_0xe486('0x21')](_0x1c6d22[_0xe486('0x36')]['limit']);_0x2fc3a7[_0xe486('0x22')]=qs[_0xe486('0x22')](_0x1c6d22[_0xe486('0x36')]['offset']);}_0x2fc3a7[_0xe486('0x3d')]=qs[_0xe486('0x3e')](_0x1c6d22[_0xe486('0x36')][_0xe486('0x3e')]);_0x2fc3a7['where']=qs['filters'](_[_0xe486('0x3f')](_0x1c6d22[_0xe486('0x36')],_0x39f3f9[_0xe486('0x38')]),_0x39b179);if(_0x1c6d22[_0xe486('0x36')]['filter']){_0x2fc3a7[_0xe486('0x40')]=_['merge'](_0x2fc3a7[_0xe486('0x40')],{'$or':_[_0xe486('0x35')](_0x39b179,function(_0xecdc73){if(_0xecdc73[_0xe486('0x32')]!==_0xe486('0x41')){var _0x178fcc={};_0x178fcc[_0xecdc73['name']]={'$like':'%'+_0x1c6d22[_0xe486('0x36')]['filter']+'%'};return _0x178fcc;}})});}_0x2fc3a7=_[_0xe486('0x42')]({},_0x2fc3a7,_0x1c6d22[_0xe486('0x43')]);var _0x1ba5e3={'where':_0x2fc3a7['where']};return db[_0xe486('0x44')]['count'](_0x1ba5e3)[_0xe486('0x28')](function(_0x22c5d2){_0x70e1bb[_0xe486('0x23')]=_0x22c5d2;if(_0x1c6d22['query'][_0xe486('0x45')]){_0x2fc3a7['include']=[{'all':!![]}];}return db[_0xe486('0x44')][_0xe486('0x46')](_0x2fc3a7);})['then'](function(_0x312a3a){_0x70e1bb[_0xe486('0x47')]=_0x312a3a;return _0x70e1bb;})[_0xe486('0x28')](respondWithFilteredResult(_0x22a1c9,_0x2fc3a7))[_0xe486('0x48')](handleError(_0x22a1c9,null));};exports[_0xe486('0x49')]=function(_0x9d6953,_0x5c4c9c){var _0x20b6b5={'raw':![],'where':{'id':_0x9d6953['params']['id']}},_0x45c705={};_0x45c705[_0xe486('0x34')]=_['keys'](db[_0xe486('0x44')][_0xe486('0x30')]);_0x45c705['query']=_[_0xe486('0x37')](_0x9d6953[_0xe486('0x36')]);_0x45c705[_0xe486('0x38')]=_['intersection'](_0x45c705[_0xe486('0x34')],_0x45c705[_0xe486('0x36')]);_0x20b6b5[_0xe486('0x39')]=_[_0xe486('0x4a')](_0x45c705['model'],qs[_0xe486('0x3a')](_0x9d6953[_0xe486('0x36')][_0xe486('0x3a')]));_0x20b6b5[_0xe486('0x39')]=_0x20b6b5[_0xe486('0x39')][_0xe486('0x3b')]?_0x20b6b5[_0xe486('0x39')]:_0x45c705['model'];if(_0x9d6953[_0xe486('0x36')][_0xe486('0x45')]){_0x20b6b5['include']=[{'all':!![]}];}_0x20b6b5=_[_0xe486('0x42')]({},_0x20b6b5,_0x9d6953[_0xe486('0x43')]);return db['Campaign'][_0xe486('0x4b')](_0x20b6b5)[_0xe486('0x28')](handleEntityNotFound(_0x5c4c9c,null))[_0xe486('0x28')](respondWithResult(_0x5c4c9c,null))[_0xe486('0x48')](handleError(_0x5c4c9c,null));};exports[_0xe486('0x4c')]=function(_0x10b115,_0x43f2da){return db['Campaign'][_0xe486('0x4c')](_0x10b115[_0xe486('0x4d')],{})['then'](function(_0x3bc7dd){var _0x26e8c5=_0x10b115[_0xe486('0x4e')][_0xe486('0x4f')]({'plain':!![]});if(!_0x26e8c5)throw new Error(_0xe486('0x50'));if(_0x26e8c5[_0xe486('0x51')]==='user'){var _0x1c8ad5=_0x3bc7dd[_0xe486('0x4f')]({'plain':!![]});var _0x4e781c=_0xe486('0x2a');return db[_0xe486('0x52')][_0xe486('0x4b')]({'where':{'name':_0x4e781c,'userProfileId':_0x26e8c5[_0xe486('0x53')]},'raw':!![]})[_0xe486('0x28')](function(_0x319585){if(_0x319585&&_0x319585[_0xe486('0x54')]===0x0){return db[_0xe486('0x2b')][_0xe486('0x4c')]({'name':_0x1c8ad5[_0xe486('0x2e')],'resourceId':_0x1c8ad5['id'],'type':_0x319585['name'],'sectionId':_0x319585['id']},{})[_0xe486('0x28')](function(){return _0x3bc7dd;});}else{return _0x3bc7dd;}})[_0xe486('0x48')](function(_0x3c9cf2){logger[_0xe486('0x2c')](_0xe486('0x55'),_0x3c9cf2);throw _0x3c9cf2;});}return _0x3bc7dd;})[_0xe486('0x28')](respondWithResult(_0x43f2da,0xc9))['catch'](handleError(_0x43f2da,null));};exports[_0xe486('0x56')]=function(_0x1592d5,_0x4df7c6){var _0x31e57a={'where':{'id':_0x1592d5['params']['id']}},_0x4de708={};_0x4de708[_0xe486('0x34')]=_[_0xe486('0x37')](db[_0xe486('0x44')]['rawAttributes']);_0x31e57a[_0xe486('0x39')]=_['intersection'](_0x4de708[_0xe486('0x34')],qs['fields'](_0x1592d5[_0xe486('0x36')]['fields']));_0x31e57a['attributes']=_0x31e57a['attributes'][_0xe486('0x3b')]?_0x31e57a[_0xe486('0x39')]:_0x4de708[_0xe486('0x34')];if(_0x1592d5[_0xe486('0x36')][_0xe486('0x45')]){_0x31e57a[_0xe486('0x57')]=[{'all':!![]}];}_0x31e57a=_['merge']({},_0x31e57a,_0x1592d5['options']);return db[_0xe486('0x44')]['find'](_0x31e57a)[_0xe486('0x28')](handleEntityNotFound(_0x4df7c6,null))[_0xe486('0x28')](function(_0x1b96f1){if(_0x1b96f1){var _0x50732c=_0x1b96f1['get']({'plain':!![]});_0x50732c=qs[_0xe486('0x58')](_0x50732c,['id',_0xe486('0x59'),_0xe486('0x5a')]);_0x1592d5[_0xe486('0x4d')]=_[_0xe486('0x58')](_0x1592d5[_0xe486('0x4d')],['id',_0xe486('0x59'),_0xe486('0x5a')]);return db[_0xe486('0x44')]['create'](_['merge'](_0x50732c,_0x1592d5[_0xe486('0x4d')]),{'include':_0x1592d5[_0xe486('0x36')][_0xe486('0x45')]?[{'all':!![]}]:undefined})[_0xe486('0x28')](function(_0x358bce){var _0x2ec277=_0x1592d5['user']['get']({'plain':!![]});if(!_0x2ec277)throw new Error(_0xe486('0x50'));if(_0x2ec277[_0xe486('0x51')]===_0xe486('0x4e')){var _0x148bad=_0x358bce[_0xe486('0x4f')]({'plain':!![]});var _0x33f2f6='IvrCampaigns';return db[_0xe486('0x52')][_0xe486('0x4b')]({'where':{'name':_0x33f2f6,'userProfileId':_0x2ec277[_0xe486('0x53')]},'raw':!![]})[_0xe486('0x28')](function(_0x512d18){if(_0x512d18&&_0x512d18[_0xe486('0x54')]===0x0){return db[_0xe486('0x2b')]['create']({'name':_0x148bad[_0xe486('0x2e')],'resourceId':_0x148bad['id'],'type':_0x512d18[_0xe486('0x2e')],'sectionId':_0x512d18['id']},{})[_0xe486('0x28')](function(){return _0x358bce;});}else{return _0x358bce;}})[_0xe486('0x48')](function(_0x4feeb5){logger[_0xe486('0x2c')](_0xe486('0x55'),_0x4feeb5);throw _0x4feeb5;});}return _0x358bce;});}})[_0xe486('0x28')](respondWithResult(_0x4df7c6,0xc9))[_0xe486('0x48')](handleError(_0x4df7c6,null));};exports['update']=function(_0x39a093,_0x290dc1){if(_0x39a093[_0xe486('0x4d')]['id']){delete _0x39a093[_0xe486('0x4d')]['id'];}return db[_0xe486('0x44')][_0xe486('0x4b')]({'where':{'id':_0x39a093[_0xe486('0x5b')]['id']}})[_0xe486('0x28')](handleEntityNotFound(_0x290dc1,null))['then'](saveUpdates(_0x39a093[_0xe486('0x4d')],null))[_0xe486('0x28')](respondWithResult(_0x290dc1,null))[_0xe486('0x48')](handleError(_0x290dc1,null));};exports[_0xe486('0x29')]=function(_0x8f0b78,_0x276742){return db['Campaign']['find']({'where':{'id':_0x8f0b78[_0xe486('0x5b')]['id']}})['then'](handleEntityNotFound(_0x276742,null))[_0xe486('0x28')](removeEntity(_0x276742,null))[_0xe486('0x48')](handleError(_0x276742,null));};exports[_0xe486('0x5c')]=function(_0x1dfdc0,_0x2bec02,_0x22b50d){var _0x696632={'raw':!![],'where':{}};var _0x183700={};var _0x12863d={'count':0x0,'rows':[]};return db[_0xe486('0x44')][_0xe486('0x5d')]({'where':{'id':_0x1dfdc0[_0xe486('0x5b')]['id']}})[_0xe486('0x28')](handleEntityNotFound(_0x2bec02,null))[_0xe486('0x28')](function(_0x333a1f){if(_0x333a1f){_0x183700['model']=_['keys'](db['CmHopper'][_0xe486('0x30')]);_0x183700[_0xe486('0x36')]=_['keys'](_0x1dfdc0[_0xe486('0x36')]);_0x183700[_0xe486('0x38')]=_['intersection'](_0x183700['model'],_0x183700[_0xe486('0x36')]);_0x696632[_0xe486('0x39')]=_['intersection'](_0x183700['model'],qs[_0xe486('0x3a')](_0x1dfdc0[_0xe486('0x36')][_0xe486('0x3a')]));_0x696632[_0xe486('0x39')]=_0x696632['attributes'][_0xe486('0x3b')]?_0x696632[_0xe486('0x39')]:_0x183700[_0xe486('0x34')];if(!_0x1dfdc0[_0xe486('0x36')][_0xe486('0x5e')]('nolimit')){_0x696632[_0xe486('0x21')]=qs[_0xe486('0x21')](_0x1dfdc0[_0xe486('0x36')]['limit']);_0x696632[_0xe486('0x22')]=qs[_0xe486('0x22')](_0x1dfdc0['query'][_0xe486('0x22')]);}_0x696632[_0xe486('0x3d')]=qs['sort'](_0x1dfdc0['query'][_0xe486('0x3e')]);_0x696632[_0xe486('0x40')]=qs[_0xe486('0x38')](_[_0xe486('0x3f')](_0x1dfdc0[_0xe486('0x36')],_0x183700[_0xe486('0x38')]));_0x696632[_0xe486('0x40')][_0xe486('0x5f')]=_0x333a1f['id'];if(_0x1dfdc0['query'][_0xe486('0x60')]){_0x696632['where']=_[_0xe486('0x42')](_0x696632['where'],{'$or':_[_0xe486('0x35')](_0x696632[_0xe486('0x39')],function(_0x193204){var _0x403cb1={};_0x403cb1[_0x193204]={'$like':'%'+_0x1dfdc0[_0xe486('0x36')]['filter']+'%'};return _0x403cb1;})});}_0x696632=_[_0xe486('0x42')]({},_0x696632,_0x1dfdc0[_0xe486('0x43')]);return db[_0xe486('0x61')][_0xe486('0x23')]({'where':_0x696632['where']})[_0xe486('0x28')](function(_0x43a082){_0x12863d['count']=_0x43a082;if(_0x1dfdc0['query']['includeAll']){_0x696632[_0xe486('0x57')]=[{'all':!![]}];}return db['CmHopper'][_0xe486('0x46')](_0x696632);})[_0xe486('0x28')](function(_0x17f9c9){_0x12863d['rows']=_0x17f9c9;return _0x12863d;});}})[_0xe486('0x28')](respondWithFilteredResult(_0x2bec02,_0x696632))[_0xe486('0x48')](handleError(_0x2bec02,null));};exports[_0xe486('0x62')]=function(_0x1c092d,_0x4ea43e,_0x341960){var _0x2f28f5={'raw':!![],'where':{}};var _0x351154={};var _0x394eca={'count':0x0,'rows':[]};return db[_0xe486('0x44')][_0xe486('0x5d')]({'where':{'id':_0x1c092d[_0xe486('0x5b')]['id']}})['then'](handleEntityNotFound(_0x4ea43e,null))[_0xe486('0x28')](function(_0x3603d2){if(_0x3603d2){_0x351154[_0xe486('0x34')]=_[_0xe486('0x37')](db[_0xe486('0x63')]['rawAttributes']);_0x351154['query']=_[_0xe486('0x37')](_0x1c092d[_0xe486('0x36')]);_0x351154[_0xe486('0x38')]=_[_0xe486('0x4a')](_0x351154[_0xe486('0x34')],_0x351154[_0xe486('0x36')]);_0x2f28f5[_0xe486('0x39')]=_['intersection'](_0x351154[_0xe486('0x34')],qs[_0xe486('0x3a')](_0x1c092d[_0xe486('0x36')]['fields']));_0x2f28f5[_0xe486('0x39')]=_0x2f28f5[_0xe486('0x39')][_0xe486('0x3b')]?_0x2f28f5[_0xe486('0x39')]:_0x351154[_0xe486('0x34')];if(!_0x1c092d[_0xe486('0x36')][_0xe486('0x5e')](_0xe486('0x3c'))){_0x2f28f5[_0xe486('0x21')]=qs[_0xe486('0x21')](_0x1c092d[_0xe486('0x36')][_0xe486('0x21')]);_0x2f28f5[_0xe486('0x22')]=qs[_0xe486('0x22')](_0x1c092d[_0xe486('0x36')]['offset']);}_0x2f28f5[_0xe486('0x3d')]=qs[_0xe486('0x3e')](_0x1c092d[_0xe486('0x36')][_0xe486('0x3e')]);_0x2f28f5[_0xe486('0x40')]=qs[_0xe486('0x38')](_[_0xe486('0x3f')](_0x1c092d[_0xe486('0x36')],_0x351154[_0xe486('0x38')]));_0x2f28f5[_0xe486('0x40')][_0xe486('0x5f')]=_0x3603d2['id'];if(_0x1c092d[_0xe486('0x36')][_0xe486('0x60')]){_0x2f28f5[_0xe486('0x40')]=_[_0xe486('0x42')](_0x2f28f5[_0xe486('0x40')],{'$or':_[_0xe486('0x35')](_0x2f28f5['attributes'],function(_0x4d0144){var _0x540206={};_0x540206[_0x4d0144]={'$like':'%'+_0x1c092d[_0xe486('0x36')][_0xe486('0x60')]+'%'};return _0x540206;})});}_0x2f28f5=_['merge']({},_0x2f28f5,_0x1c092d[_0xe486('0x43')]);return db[_0xe486('0x63')]['count']({'where':_0x2f28f5[_0xe486('0x40')]})[_0xe486('0x28')](function(_0x2b16ed){_0x394eca[_0xe486('0x23')]=_0x2b16ed;if(_0x1c092d[_0xe486('0x36')][_0xe486('0x45')]){_0x2f28f5[_0xe486('0x57')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xe486('0x46')](_0x2f28f5);})[_0xe486('0x28')](function(_0x10678b){_0x394eca['rows']=_0x10678b;return _0x394eca;});}})[_0xe486('0x28')](respondWithFilteredResult(_0x4ea43e,_0x2f28f5))[_0xe486('0x48')](handleError(_0x4ea43e,null));};exports[_0xe486('0x64')]=function(_0x3e2a12,_0x5b6052,_0x14bd14){var _0x63f070={'raw':!![],'where':{}};var _0xd82fd4={};var _0x13b8ec={'count':0x0,'rows':[]};return db[_0xe486('0x44')][_0xe486('0x5d')]({'where':{'id':_0x3e2a12[_0xe486('0x5b')]['id']}})[_0xe486('0x28')](handleEntityNotFound(_0x5b6052,null))[_0xe486('0x28')](function(_0x3e15e1){if(_0x3e15e1){_0xd82fd4[_0xe486('0x34')]=_[_0xe486('0x37')](db['CmHopperFinal'][_0xe486('0x30')]);_0xd82fd4[_0xe486('0x36')]=_[_0xe486('0x37')](_0x3e2a12['query']);_0xd82fd4[_0xe486('0x38')]=_[_0xe486('0x4a')](_0xd82fd4['model'],_0xd82fd4[_0xe486('0x36')]);_0x63f070[_0xe486('0x39')]=_[_0xe486('0x4a')](_0xd82fd4[_0xe486('0x34')],qs[_0xe486('0x3a')](_0x3e2a12[_0xe486('0x36')]['fields']));_0x63f070[_0xe486('0x39')]=_0x63f070['attributes'][_0xe486('0x3b')]?_0x63f070[_0xe486('0x39')]:_0xd82fd4[_0xe486('0x34')];if(!_0x3e2a12['query'][_0xe486('0x5e')](_0xe486('0x3c'))){_0x63f070[_0xe486('0x21')]=qs[_0xe486('0x21')](_0x3e2a12[_0xe486('0x36')][_0xe486('0x21')]);_0x63f070[_0xe486('0x22')]=qs[_0xe486('0x22')](_0x3e2a12[_0xe486('0x36')][_0xe486('0x22')]);}_0x63f070[_0xe486('0x3d')]=qs[_0xe486('0x3e')](_0x3e2a12[_0xe486('0x36')][_0xe486('0x3e')]);_0x63f070[_0xe486('0x40')]=qs[_0xe486('0x38')](_[_0xe486('0x3f')](_0x3e2a12[_0xe486('0x36')],_0xd82fd4['filters']));_0x63f070[_0xe486('0x40')][_0xe486('0x5f')]=_0x3e15e1['id'];if(_0x3e2a12['query'][_0xe486('0x60')]){_0x63f070[_0xe486('0x40')]=_[_0xe486('0x42')](_0x63f070['where'],{'$or':_[_0xe486('0x35')](_0x63f070['attributes'],function(_0x37c8c8){var _0x4537e3={};_0x4537e3[_0x37c8c8]={'$like':'%'+_0x3e2a12['query'][_0xe486('0x60')]+'%'};return _0x4537e3;})});}_0x63f070=_[_0xe486('0x42')]({},_0x63f070,_0x3e2a12['options']);return db[_0xe486('0x65')][_0xe486('0x23')]({'where':_0x63f070['where']})[_0xe486('0x28')](function(_0x20e28c){_0x13b8ec['count']=_0x20e28c;if(_0x3e2a12[_0xe486('0x36')][_0xe486('0x45')]){_0x63f070[_0xe486('0x57')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xe486('0x46')](_0x63f070);})[_0xe486('0x28')](function(_0x216ea8){_0x13b8ec['rows']=_0x216ea8;return _0x13b8ec;});}})[_0xe486('0x28')](respondWithFilteredResult(_0x5b6052,_0x63f070))[_0xe486('0x48')](handleError(_0x5b6052,null));};exports[_0xe486('0x66')]=function(_0x31f489,_0x1ef654,_0x2c583f){var _0x4ebc75={'raw':!![],'where':{}};var _0x1b0f9d={};var _0x57fe91={'count':0x0,'rows':[]};return db[_0xe486('0x44')]['findOne']({'where':{'id':_0x31f489['params']['id']}})[_0xe486('0x28')](handleEntityNotFound(_0x1ef654,null))['then'](function(_0x44b4af){if(_0x44b4af){_0x1b0f9d[_0xe486('0x34')]=_[_0xe486('0x37')](db[_0xe486('0x67')][_0xe486('0x30')]);_0x1b0f9d[_0xe486('0x36')]=_[_0xe486('0x37')](_0x31f489[_0xe486('0x36')]);_0x1b0f9d[_0xe486('0x38')]=_['intersection'](_0x1b0f9d[_0xe486('0x34')],_0x1b0f9d['query']);_0x4ebc75[_0xe486('0x39')]=_[_0xe486('0x4a')](_0x1b0f9d[_0xe486('0x34')],qs[_0xe486('0x3a')](_0x31f489[_0xe486('0x36')][_0xe486('0x3a')]));_0x4ebc75[_0xe486('0x39')]=_0x4ebc75['attributes'][_0xe486('0x3b')]?_0x4ebc75[_0xe486('0x39')]:_0x1b0f9d[_0xe486('0x34')];if(!_0x31f489[_0xe486('0x36')]['hasOwnProperty'](_0xe486('0x3c'))){_0x4ebc75[_0xe486('0x21')]=qs['limit'](_0x31f489[_0xe486('0x36')][_0xe486('0x21')]);_0x4ebc75[_0xe486('0x22')]=qs[_0xe486('0x22')](_0x31f489['query']['offset']);}_0x4ebc75[_0xe486('0x3d')]=qs[_0xe486('0x3e')](_0x31f489[_0xe486('0x36')]['sort']);_0x4ebc75['where']=qs['filters'](_[_0xe486('0x3f')](_0x31f489['query'],_0x1b0f9d[_0xe486('0x38')]));_0x4ebc75[_0xe486('0x40')][_0xe486('0x5f')]=_0x44b4af['id'];if(_0x31f489[_0xe486('0x36')][_0xe486('0x60')]){_0x4ebc75[_0xe486('0x40')]=_[_0xe486('0x42')](_0x4ebc75[_0xe486('0x40')],{'$or':_[_0xe486('0x35')](_0x4ebc75['attributes'],function(_0x521de9){var _0x15ac77={};_0x15ac77[_0x521de9]={'$like':'%'+_0x31f489[_0xe486('0x36')][_0xe486('0x60')]+'%'};return _0x15ac77;})});}_0x4ebc75=_[_0xe486('0x42')]({},_0x4ebc75,_0x31f489[_0xe486('0x43')]);return db[_0xe486('0x67')][_0xe486('0x23')]({'where':_0x4ebc75[_0xe486('0x40')]})['then'](function(_0x379e25){_0x57fe91[_0xe486('0x23')]=_0x379e25;if(_0x31f489['query'][_0xe486('0x45')]){_0x4ebc75[_0xe486('0x57')]=[{'all':!![]}];}return db[_0xe486('0x67')][_0xe486('0x46')](_0x4ebc75);})['then'](function(_0x512151){_0x57fe91[_0xe486('0x47')]=_0x512151;return _0x57fe91;});}})[_0xe486('0x28')](respondWithFilteredResult(_0x1ef654,_0x4ebc75))[_0xe486('0x48')](handleError(_0x1ef654,null));};exports[_0xe486('0x68')]=function(_0x27dbdd,_0x3775c8,_0x5d1e03){var _0x5dbec8={};var _0x884f99={};var _0x1d0271;var _0x178857;return db[_0xe486('0x44')][_0xe486('0x5d')]({'where':{'id':_0x27dbdd['params']['id']}})[_0xe486('0x28')](handleEntityNotFound(_0x3775c8,null))[_0xe486('0x28')](function(_0x4867f9){if(_0x4867f9){_0x1d0271=_0x4867f9;_0x884f99[_0xe486('0x34')]=_[_0xe486('0x37')](db[_0xe486('0x69')][_0xe486('0x30')]);_0x884f99[_0xe486('0x36')]=_[_0xe486('0x37')](_0x27dbdd[_0xe486('0x36')]);_0x884f99[_0xe486('0x38')]=_[_0xe486('0x4a')](_0x884f99[_0xe486('0x34')],_0x884f99[_0xe486('0x36')]);_0x5dbec8[_0xe486('0x39')]=_[_0xe486('0x4a')](_0x884f99[_0xe486('0x34')],qs[_0xe486('0x3a')](_0x27dbdd[_0xe486('0x36')][_0xe486('0x3a')]));_0x5dbec8['attributes']=_0x5dbec8[_0xe486('0x39')][_0xe486('0x3b')]?_0x5dbec8['attributes']:_0x884f99[_0xe486('0x34')];_0x5dbec8[_0xe486('0x3d')]=qs['sort'](_0x27dbdd[_0xe486('0x36')][_0xe486('0x3e')]);_0x5dbec8['where']=qs['filters'](_[_0xe486('0x3f')](_0x27dbdd[_0xe486('0x36')],_0x884f99[_0xe486('0x38')]));if(_0x27dbdd[_0xe486('0x36')][_0xe486('0x60')]){_0x5dbec8[_0xe486('0x40')]=_['merge'](_0x5dbec8[_0xe486('0x40')],{'$or':_[_0xe486('0x35')](_0x5dbec8[_0xe486('0x39')],function(_0x2d57a7){var _0x46fd1b={};_0x46fd1b[_0x2d57a7]={'$like':'%'+_0x27dbdd['query']['filter']+'%'};return _0x46fd1b;})});}_0x5dbec8=_[_0xe486('0x42')]({},_0x5dbec8,_0x27dbdd[_0xe486('0x43')]);return _0x1d0271['getLists'](_0x5dbec8);}})[_0xe486('0x28')](function(_0xaa4f8){if(_0xaa4f8){_0x178857=_0xaa4f8[_0xe486('0x3b')];if(!_0x27dbdd[_0xe486('0x36')]['hasOwnProperty'](_0xe486('0x3c'))){_0x5dbec8[_0xe486('0x21')]=qs[_0xe486('0x21')](_0x27dbdd[_0xe486('0x36')][_0xe486('0x21')]);_0x5dbec8[_0xe486('0x22')]=qs[_0xe486('0x22')](_0x27dbdd[_0xe486('0x36')][_0xe486('0x22')]);}return _0x1d0271[_0xe486('0x68')](_0x5dbec8);}})[_0xe486('0x28')](function(_0x364af4){if(_0x364af4){return _0x364af4?{'count':_0x178857,'rows':_0x364af4}:null;}})[_0xe486('0x28')](respondWithResult(_0x3775c8,null))[_0xe486('0x48')](handleError(_0x3775c8,null));};exports['addLists']=function(_0x506598,_0x5a2dd0,_0x37fc31){var _0x2f25ed,_0x414e50;var _0x4e2250=[];var _0x491543=moment()[_0xe486('0x6a')](_0xe486('0x6b'));return db[_0xe486('0x44')][_0xe486('0x4b')]({'where':{'id':_0x506598[_0xe486('0x5b')]['id']}})[_0xe486('0x28')](handleEntityNotFound(_0x5a2dd0,null))[_0xe486('0x28')](function(_0xf214d8){if(_0xf214d8){_0x414e50=_0xf214d8;return _0xf214d8['addLists'](_0x506598['body'][_0xe486('0x6c')],_[_0xe486('0x58')](_0x506598[_0xe486('0x4d')],[_0xe486('0x6c'),'id'])||{});}return null;})['spread'](function(_0x1289e5){var _0x439f75;var _0x7bf3ff;_0x2f25ed=_0x1289e5||[];var _0x369b45=[];if(_0x1289e5){for(var _0x14d9ed=0x0;_0x14d9ed<_0x1289e5[_0xe486('0x3b')];_0x14d9ed+=0x1){var _0x1f953d=_0x1289e5[_0x14d9ed][_0xe486('0x4f')]({'plain':!![]});_0x414e50['dialCheckDuplicateType']=_0x506598[_0xe486('0x4d')]['dialCheckDuplicateType']?_0x506598[_0xe486('0x4d')]['dialCheckDuplicateType']:_0x414e50[_0xe486('0x6d')];switch(_0x414e50['dialCheckDuplicateType']){case _0xe486('0x6e'):_0x439f75=squel[_0xe486('0x6f')]()['into'](_0xe486('0x70'))[_0xe486('0x71')]([_0xe486('0x72'),_0xe486('0x73'),_0xe486('0x74'),_0xe486('0x75'),_0xe486('0x5f'),_0xe486('0x59'),'updatedAt'],squel['select']()[_0xe486('0x76')](_0xe486('0x72'),_0xe486('0x72'))[_0xe486('0x76')](_0xe486('0x77'),_0xe486('0x73'))[_0xe486('0x76')]('id',_0xe486('0x74'))['field'](_0x1f953d[_0xe486('0x78')]['toString'](),_0xe486('0x75'))[_0xe486('0x76')](_0x506598[_0xe486('0x5b')]['id']['toString'](),'CampaignId')['field']('\x27'+_0x491543+'\x27',_0xe486('0x59'))[_0xe486('0x76')]('\x27'+_0x491543+'\x27',_0xe486('0x5a'))[_0xe486('0x79')](_0xe486('0x7a'))[_0xe486('0x40')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',_0x1f953d[_0xe486('0x78')][_0xe486('0x7b')]())['where']('phone\x20IS\x20NOT\x20NULL')[_0xe486('0x40')](_0xe486('0x7c'),squel[_0xe486('0x7d')]()[_0xe486('0x76')](_0xe486('0x7e'))[_0xe486('0x79')](_0xe486('0x7f'))[_0xe486('0x40')](_0xe486('0x80'),_0x506598[_0xe486('0x5b')]['id'][_0xe486('0x7b')]()))[_0xe486('0x40')](_0xe486('0x7c'),squel[_0xe486('0x7d')]()[_0xe486('0x76')](_0xe486('0x81'))[_0xe486('0x79')](_0xe486('0x70'))[_0xe486('0x40')](_0xe486('0x80'),_0x506598[_0xe486('0x5b')]['id']['toString']())))[_0xe486('0x7b')]();break;case _0xe486('0x82'):_0x439f75=squel['insert']()[_0xe486('0x83')](_0xe486('0x70'))[_0xe486('0x71')]([_0xe486('0x72'),'scheduledAt','ContactId','ListId','CampaignId',_0xe486('0x59'),_0xe486('0x5a')],squel[_0xe486('0x7d')]()[_0xe486('0x76')](_0xe486('0x72'),_0xe486('0x72'))[_0xe486('0x76')]('NOW()',_0xe486('0x73'))[_0xe486('0x76')]('id',_0xe486('0x74'))[_0xe486('0x76')](_0x1f953d[_0xe486('0x78')]['toString'](),_0xe486('0x75'))['field'](_0x506598['params']['id'][_0xe486('0x7b')](),_0xe486('0x5f'))[_0xe486('0x76')]('\x27'+_0x491543+'\x27',_0xe486('0x59'))[_0xe486('0x76')]('\x27'+_0x491543+'\x27',_0xe486('0x5a'))[_0xe486('0x79')](_0xe486('0x7a'))[_0xe486('0x40')](_0xe486('0x84'))[_0xe486('0x40')]('ListId\x20=\x20?',_0x1f953d[_0xe486('0x78')][_0xe486('0x7b')]())['where'](_0xe486('0x85'))['where'](_0xe486('0x7c'),squel[_0xe486('0x7d')]()[_0xe486('0x76')]('COALESCE(phone,\x27\x27)')[_0xe486('0x79')](_0xe486('0x70'))['where'](_0xe486('0x80'),_0x506598[_0xe486('0x5b')]['id'][_0xe486('0x7b')]())))[_0xe486('0x7b')]();break;default:_0x439f75=squel[_0xe486('0x6f')]()[_0xe486('0x83')]('cm_hopper')[_0xe486('0x71')](['phone',_0xe486('0x73'),_0xe486('0x74'),'ListId',_0xe486('0x5f'),_0xe486('0x59'),_0xe486('0x5a')],squel[_0xe486('0x7d')]()[_0xe486('0x76')](_0xe486('0x72'),'phone')[_0xe486('0x76')](_0xe486('0x77'),_0xe486('0x73'))['field']('id',_0xe486('0x74'))[_0xe486('0x76')](_0x1f953d[_0xe486('0x78')]['toString'](),_0xe486('0x75'))[_0xe486('0x76')](_0x506598[_0xe486('0x5b')]['id'][_0xe486('0x7b')](),_0xe486('0x5f'))[_0xe486('0x76')]('\x27'+_0x491543+'\x27',_0xe486('0x59'))[_0xe486('0x76')]('\x27'+_0x491543+'\x27',_0xe486('0x5a'))[_0xe486('0x79')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0xe486('0x40')](_0xe486('0x86'),_0x1f953d[_0xe486('0x78')][_0xe486('0x7b')]())[_0xe486('0x40')](_0xe486('0x85')))[_0xe486('0x7b')]();}_0x7bf3ff=squel[_0xe486('0x6f')]()[_0xe486('0x83')](_0xe486('0x87'))[_0xe486('0x71')](['cmHopperId',_0xe486('0x73'),_0xe486('0x72'),_0xe486('0x88'),_0xe486('0x59'),_0xe486('0x5a')],squel['select']()[_0xe486('0x76')]('h.id','id')[_0xe486('0x76')]('NOW()','scheduledAt')[_0xe486('0x76')]('ci.item',_0xe486('0x72'))[_0xe486('0x76')](_0xe486('0x89'),_0xe486('0x88'))[_0xe486('0x76')]('\x27'+_0x491543+'\x27','createdAt')[_0xe486('0x76')]('\x27'+_0x491543+'\x27','updatedAt')[_0xe486('0x79')]('cm_contact_has_items','ci')[_0xe486('0x8a')]('cm_hopper','h',_0xe486('0x8b'))[_0xe486('0x40')]('h.ListId\x20=\x20?',_0x1f953d[_0xe486('0x78')]['toString']())[_0xe486('0x40')](_0xe486('0x8c'),_0x506598[_0xe486('0x5b')]['id'][_0xe486('0x7b')]())['where'](_0xe486('0x8d'),_0x491543))['toString']();_0x369b45[_0xe486('0x8e')](db[_0xe486('0x8f')][_0xe486('0x36')](_0x439f75));_0x4e2250[_0xe486('0x8e')](db[_0xe486('0x8f')][_0xe486('0x36')](_0x7bf3ff));}return BPromise[_0xe486('0x90')](_0x369b45);}})[_0xe486('0x28')](function(){return BPromise[_0xe486('0x90')](_0x4e2250);})[_0xe486('0x28')](function(){return _0x2f25ed;})[_0xe486('0x28')](respondWithResult(_0x5a2dd0,null))[_0xe486('0x48')](handleError(_0x5a2dd0,null));};exports[_0xe486('0x91')]=function(_0x319924,_0x11fc68,_0x36f91f){return db[_0xe486('0x44')][_0xe486('0x4b')]({'where':{'id':_0x319924['params']['id']}})[_0xe486('0x28')](handleEntityNotFound(_0x11fc68,null))[_0xe486('0x28')](function(_0x382cdd){if(_0x382cdd){return _0x382cdd[_0xe486('0x91')](_0x319924[_0xe486('0x36')][_0xe486('0x6c')]);}})['then'](function(_0x4c032d){if(_0x4c032d){return db[_0xe486('0x61')]['destroy']({'where':{'ListId':_0x319924[_0xe486('0x36')][_0xe486('0x6c')],'CampaignId':_0x319924['params']['id']}})['then'](function(){return _0x4c032d;});}})[_0xe486('0x28')](respondWithStatusCode(_0x11fc68,null))['catch'](handleError(_0x11fc68,null));};exports[_0xe486('0x92')]=function(_0x40e0f3,_0x53b45d,_0x1a804d){var _0x23c08a={};var _0x42379b={};var _0xeb13bf;var _0x4314a8;return db[_0xe486('0x44')][_0xe486('0x5d')]({'where':{'id':_0x40e0f3[_0xe486('0x5b')]['id']}})['then'](handleEntityNotFound(_0x53b45d,null))['then'](function(_0x660778){if(_0x660778){_0xeb13bf=_0x660778;_0x42379b['model']=_[_0xe486('0x37')](db[_0xe486('0x69')]['rawAttributes']);_0x42379b[_0xe486('0x36')]=_[_0xe486('0x37')](_0x40e0f3['query']);_0x42379b[_0xe486('0x38')]=_[_0xe486('0x4a')](_0x42379b[_0xe486('0x34')],_0x42379b[_0xe486('0x36')]);_0x23c08a[_0xe486('0x39')]=_[_0xe486('0x4a')](_0x42379b[_0xe486('0x34')],qs[_0xe486('0x3a')](_0x40e0f3[_0xe486('0x36')][_0xe486('0x3a')]));_0x23c08a[_0xe486('0x39')]=_0x23c08a['attributes']['length']?_0x23c08a[_0xe486('0x39')]:_0x42379b[_0xe486('0x34')];_0x23c08a[_0xe486('0x3d')]=qs[_0xe486('0x3e')](_0x40e0f3[_0xe486('0x36')][_0xe486('0x3e')]);_0x23c08a[_0xe486('0x40')]=qs[_0xe486('0x38')](_['pick'](_0x40e0f3[_0xe486('0x36')],_0x42379b[_0xe486('0x38')]));if(_0x40e0f3[_0xe486('0x36')][_0xe486('0x60')]){_0x23c08a[_0xe486('0x40')]=_[_0xe486('0x42')](_0x23c08a[_0xe486('0x40')],{'$or':_[_0xe486('0x35')](_0x23c08a[_0xe486('0x39')],function(_0x2e8d19){var _0x8bc29c={};_0x8bc29c[_0x2e8d19]={'$like':'%'+_0x40e0f3[_0xe486('0x36')]['filter']+'%'};return _0x8bc29c;})});}_0x23c08a=_[_0xe486('0x42')]({},_0x23c08a,_0x40e0f3['options']);return _0xeb13bf['getBlackLists'](_0x23c08a);}})[_0xe486('0x28')](function(_0x2ca599){if(_0x2ca599){_0x4314a8=_0x2ca599['length'];if(!_0x40e0f3[_0xe486('0x36')][_0xe486('0x5e')](_0xe486('0x3c'))){_0x23c08a[_0xe486('0x21')]=qs['limit'](_0x40e0f3[_0xe486('0x36')]['limit']);_0x23c08a[_0xe486('0x22')]=qs[_0xe486('0x22')](_0x40e0f3[_0xe486('0x36')][_0xe486('0x22')]);}return _0xeb13bf['getBlackLists'](_0x23c08a);}})[_0xe486('0x28')](function(_0x2b863d){if(_0x2b863d){return _0x2b863d?{'count':_0x4314a8,'rows':_0x2b863d}:null;}})[_0xe486('0x28')](respondWithResult(_0x53b45d,null))[_0xe486('0x48')](handleError(_0x53b45d,null));};exports['addBlackLists']=function(_0x501d3f,_0x9c7f9b,_0x1fe136){var _0x248db2,_0xba5703;var _0x250045=[];var _0x4f874d=moment()[_0xe486('0x6a')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0xe486('0x44')][_0xe486('0x4b')]({'where':{'id':_0x501d3f[_0xe486('0x5b')]['id']}})[_0xe486('0x28')](handleEntityNotFound(_0x9c7f9b,null))['then'](function(_0x73e5c5){if(_0x73e5c5){_0xba5703=_0x73e5c5;return _0x73e5c5['addBlackLists'](_0x501d3f[_0xe486('0x4d')]['ids'],_[_0xe486('0x58')](_0x501d3f[_0xe486('0x4d')],[_0xe486('0x6c'),'id'])||{});}return null;})[_0xe486('0x93')](function(_0x4dddb2){var _0x2fbc7c;var _0x2bfd7c;_0x248db2=_0x4dddb2||[];var _0x2ec0d7=[];if(_0x4dddb2){for(var _0x10b6b9=0x0;_0x10b6b9<_0x4dddb2[_0xe486('0x3b')];_0x10b6b9+=0x1){var _0x3d2c9c=_0x4dddb2[_0x10b6b9]['get']({'plain':!![]});_0x2fbc7c=squel['insert']()[_0xe486('0x83')](_0xe486('0x94'))[_0xe486('0x71')]([_0xe486('0x72'),_0xe486('0x74'),_0xe486('0x75'),_0xe486('0x5f'),_0xe486('0x59'),_0xe486('0x5a')],squel[_0xe486('0x7d')]()[_0xe486('0x76')](_0xe486('0x72'),_0xe486('0x72'))['field']('id','ContactId')[_0xe486('0x76')](_0x3d2c9c[_0xe486('0x78')][_0xe486('0x7b')](),'ListId')['field'](_0x501d3f['params']['id']['toString'](),_0xe486('0x5f'))['field'](_0xe486('0x77'),'createdAt')[_0xe486('0x76')](_0xe486('0x77'),_0xe486('0x5a'))[_0xe486('0x79')](_0xe486('0x7a'))['where'](_0xe486('0x84'))[_0xe486('0x40')]('ListId\x20=\x20?',_0x3d2c9c[_0xe486('0x78')][_0xe486('0x7b')]())[_0xe486('0x40')](_0xe486('0x85')))[_0xe486('0x7b')]();_0x2ec0d7[_0xe486('0x8e')](db[_0xe486('0x8f')][_0xe486('0x36')](_0x2fbc7c));}return BPromise[_0xe486('0x90')](_0x2ec0d7);}})[_0xe486('0x28')](function(){return _0x248db2;})[_0xe486('0x28')](respondWithResult(_0x9c7f9b,null))['catch'](handleError(_0x9c7f9b,null));};exports[_0xe486('0x95')]=function(_0x5b6077,_0x4e28c6,_0x32d8ba){return db['Campaign']['find']({'where':{'id':_0x5b6077[_0xe486('0x5b')]['id']}})[_0xe486('0x28')](handleEntityNotFound(_0x4e28c6,null))[_0xe486('0x28')](function(_0xc7e200){if(_0xc7e200){return _0xc7e200[_0xe486('0x95')](_0x5b6077[_0xe486('0x36')][_0xe486('0x6c')]);}})[_0xe486('0x28')](function(_0x2a9cb9){if(_0x2a9cb9){return db[_0xe486('0x67')]['destroy']({'where':{'ListId':_0x5b6077[_0xe486('0x36')]['ids'],'CampaignId':_0x5b6077[_0xe486('0x5b')]['id']}})['then'](function(){return _0x2a9cb9;});}})[_0xe486('0x28')](respondWithStatusCode(_0x4e28c6,null))[_0xe486('0x48')](handleError(_0x4e28c6,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index f022b86..3995c6d 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','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(_0x4cc79a,_0xf85adc){var _0x176af9=function(_0x44ebcb){while(--_0x44ebcb){_0x4cc79a['push'](_0x4cc79a['shift']());}};_0x176af9(++_0xf85adc);}(_0x7a54,0x106));var _0x47a5=function(_0x3f32f8,_0x55bcb2){_0x3f32f8=_0x3f32f8-0x0;var _0x5cb275=_0x7a54[_0x3f32f8];return _0x5cb275;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 8ea7fbb..16117d2 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 _0x6822=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Campaign,\x20%s,\x20%s,\x20%s','request\x20sent','error','Campaign,\x20%s,\x20%s','message','catch','GetCampaign','Campaign','findAll','options','raw','where','attributes','include','map','model','then','debug','stringify'];(function(_0x1686c9,_0x57aca1){var _0x5961dd=function(_0xddb41d){while(--_0xddb41d){_0x1686c9['push'](_0x1686c9['shift']());}};_0x5961dd(++_0x57aca1);}(_0x6822,0x18c));var _0x2682=function(_0xc61f1a,_0x1fff20){_0xc61f1a=_0xc61f1a-0x0;var _0x5f5de=_0x6822[_0xc61f1a];return _0x5f5de;};'use strict';var _=require('lodash');var util=require(_0x2682('0x0'));var moment=require(_0x2682('0x1'));var BPromise=require(_0x2682('0x2'));var rs=require(_0x2682('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2682('0x4'))['db'];var utils=require(_0x2682('0x5'));var logger=require(_0x2682('0x6'))(_0x2682('0x7'));var config=require(_0x2682('0x8'));var jayson=require(_0x2682('0x9'));var client=jayson[_0x2682('0xa')][_0x2682('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x35f55b,_0x3f706c,_0x4242c5){return new BPromise(function(_0x1a1307,_0x303fe4){return client[_0x2682('0xc')](_0x35f55b,_0x4242c5)['then'](function(_0x3e72bc){logger[_0x2682('0xd')]('Campaign,\x20%s,\x20%s',_0x3f706c,'request\x20sent');logger['debug'](_0x2682('0xe'),_0x3f706c,_0x2682('0xf'),JSON['stringify'](_0x3e72bc));if(_0x3e72bc[_0x2682('0x10')]){if(_0x3e72bc[_0x2682('0x10')]['code']===0x1f4){logger[_0x2682('0x10')](_0x2682('0x11'),_0x3f706c,_0x3e72bc[_0x2682('0x10')][_0x2682('0x12')]);return _0x303fe4(_0x3e72bc[_0x2682('0x10')][_0x2682('0x12')]);}logger[_0x2682('0x10')](_0x2682('0x11'),_0x3f706c,_0x3e72bc[_0x2682('0x10')][_0x2682('0x12')]);return _0x1a1307(_0x3e72bc[_0x2682('0x10')][_0x2682('0x12')]);}else{logger[_0x2682('0xd')](_0x2682('0x11'),_0x3f706c,_0x2682('0xf'));_0x1a1307(_0x3e72bc['result']['message']);}})[_0x2682('0x13')](function(_0x2b1ed2){logger[_0x2682('0x10')]('Campaign,\x20%s,\x20%s',_0x3f706c,_0x2b1ed2);_0x303fe4(_0x2b1ed2);});});}exports[_0x2682('0x14')]=function(_0x494946){var _0x498424=this;return new Promise(function(_0x19391e,_0x3d2b43){return db[_0x2682('0x15')][_0x2682('0x16')]({'raw':_0x494946[_0x2682('0x17')]?_0x494946['options'][_0x2682('0x18')]===undefined?!![]:![]:!![],'where':_0x494946['options']?_0x494946[_0x2682('0x17')][_0x2682('0x19')]||null:null,'attributes':_0x494946[_0x2682('0x17')]?_0x494946[_0x2682('0x17')][_0x2682('0x1a')]||null:null,'limit':_0x494946[_0x2682('0x17')]?_0x494946[_0x2682('0x17')]['limit']||null:null,'include':_0x494946['options']?_0x494946['options'][_0x2682('0x1b')]?_[_0x2682('0x1c')](_0x494946['options'][_0x2682('0x1b')],function(_0x35aa4c){return{'model':db[_0x35aa4c[_0x2682('0x1d')]],'as':_0x35aa4c['as'],'attributes':_0x35aa4c[_0x2682('0x1a')],'include':_0x35aa4c['include']?_[_0x2682('0x1c')](_0x35aa4c[_0x2682('0x1b')],function(_0x361791){return{'model':db[_0x361791[_0x2682('0x1d')]],'as':_0x361791['as'],'attributes':_0x361791[_0x2682('0x1a')],'include':_0x361791[_0x2682('0x1b')]?_['map'](_0x361791['include'],function(_0x48eee6){return{'model':db[_0x48eee6['model']],'as':_0x48eee6['as'],'attributes':_0x48eee6[_0x2682('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x2682('0x1e')](function(_0x3eff92){logger[_0x2682('0xd')](_0x2682('0x14'),_0x494946);logger[_0x2682('0x1f')](_0x2682('0x14'),_0x494946,JSON[_0x2682('0x20')](_0x3eff92));_0x19391e(_0x3eff92);})['catch'](function(_0x9384b5){logger[_0x2682('0x10')]('GetCampaign',_0x9384b5[_0x2682('0x12')],_0x494946);_0x3d2b43(_0x498424[_0x2682('0x10')](0x1f4,_0x9384b5[_0x2682('0x12')]));});});}; \ No newline at end of file +var _0xf675=['../../config/environment','jayson/promise','client','http','request','then','Campaign,\x20%s,\x20%s','request\x20sent','debug','error','message','info','result','catch','GetCampaign','Campaign','findAll','options','raw','where','attributes','limit','include','map','model','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1c77e7,_0x520524){var _0x45b345=function(_0x4e9a95){while(--_0x4e9a95){_0x1c77e7['push'](_0x1c77e7['shift']());}};_0x45b345(++_0x520524);}(_0xf675,0x199));var _0x5f67=function(_0x297eea,_0x5060be){_0x297eea=_0x297eea-0x0;var _0x1c42d2=_0xf675[_0x297eea];return _0x1c42d2;};'use strict';var _=require(_0x5f67('0x0'));var util=require(_0x5f67('0x1'));var moment=require(_0x5f67('0x2'));var BPromise=require('bluebird');var rs=require(_0x5f67('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5f67('0x4'))['db'];var utils=require(_0x5f67('0x5'));var logger=require(_0x5f67('0x6'))('rpc');var config=require(_0x5f67('0x7'));var jayson=require(_0x5f67('0x8'));var client=jayson[_0x5f67('0x9')][_0x5f67('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5b67eb,_0xc71a7,_0x121d19){return new BPromise(function(_0x55efcd,_0x5749f5){return client[_0x5f67('0xb')](_0x5b67eb,_0x121d19)[_0x5f67('0xc')](function(_0x530ef1){logger['info'](_0x5f67('0xd'),_0xc71a7,_0x5f67('0xe'));logger[_0x5f67('0xf')]('Campaign,\x20%s,\x20%s,\x20%s',_0xc71a7,'request\x20sent',JSON['stringify'](_0x530ef1));if(_0x530ef1[_0x5f67('0x10')]){if(_0x530ef1[_0x5f67('0x10')]['code']===0x1f4){logger[_0x5f67('0x10')]('Campaign,\x20%s,\x20%s',_0xc71a7,_0x530ef1[_0x5f67('0x10')]['message']);return _0x5749f5(_0x530ef1[_0x5f67('0x10')][_0x5f67('0x11')]);}logger[_0x5f67('0x10')]('Campaign,\x20%s,\x20%s',_0xc71a7,_0x530ef1[_0x5f67('0x10')]['message']);return _0x55efcd(_0x530ef1[_0x5f67('0x10')]['message']);}else{logger[_0x5f67('0x12')]('Campaign,\x20%s,\x20%s',_0xc71a7,_0x5f67('0xe'));_0x55efcd(_0x530ef1[_0x5f67('0x13')][_0x5f67('0x11')]);}})[_0x5f67('0x14')](function(_0x444ee5){logger[_0x5f67('0x10')](_0x5f67('0xd'),_0xc71a7,_0x444ee5);_0x5749f5(_0x444ee5);});});}exports[_0x5f67('0x15')]=function(_0xc539c6){var _0x8f3bd6=this;return new Promise(function(_0x5275d6,_0x5bc956){return db[_0x5f67('0x16')][_0x5f67('0x17')]({'raw':_0xc539c6['options']?_0xc539c6[_0x5f67('0x18')][_0x5f67('0x19')]===undefined?!![]:![]:!![],'where':_0xc539c6[_0x5f67('0x18')]?_0xc539c6[_0x5f67('0x18')][_0x5f67('0x1a')]||null:null,'attributes':_0xc539c6[_0x5f67('0x18')]?_0xc539c6[_0x5f67('0x18')][_0x5f67('0x1b')]||null:null,'limit':_0xc539c6[_0x5f67('0x18')]?_0xc539c6[_0x5f67('0x18')][_0x5f67('0x1c')]||null:null,'include':_0xc539c6[_0x5f67('0x18')]?_0xc539c6['options'][_0x5f67('0x1d')]?_[_0x5f67('0x1e')](_0xc539c6[_0x5f67('0x18')]['include'],function(_0x537b39){return{'model':db[_0x537b39[_0x5f67('0x1f')]],'as':_0x537b39['as'],'attributes':_0x537b39[_0x5f67('0x1b')],'include':_0x537b39['include']?_[_0x5f67('0x1e')](_0x537b39[_0x5f67('0x1d')],function(_0x241d17){return{'model':db[_0x241d17[_0x5f67('0x1f')]],'as':_0x241d17['as'],'attributes':_0x241d17['attributes'],'include':_0x241d17[_0x5f67('0x1d')]?_['map'](_0x241d17[_0x5f67('0x1d')],function(_0x167601){return{'model':db[_0x167601['model']],'as':_0x167601['as'],'attributes':_0x167601[_0x5f67('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x5f67('0xc')](function(_0x57f373){logger['info'](_0x5f67('0x15'),_0xc539c6);logger[_0x5f67('0xf')](_0x5f67('0x15'),_0xc539c6,JSON['stringify'](_0x57f373));_0x5275d6(_0x57f373);})[_0x5f67('0x14')](function(_0xd36b79){logger['error'](_0x5f67('0x15'),_0xd36b79[_0x5f67('0x11')],_0xc539c6);_0x5bc956(_0x8f3bd6['error'](0x1f4,_0xd36b79[_0x5f67('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 8477520..480a36a 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 _0x1352=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','show','/:id/hoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','getHopperBlacks','/:id/lists','getBlackLists','post','create','/:id/clone','clone','addLists','/:id/blacklists','addBlackLists','put','/:id','update','delete','destroy','removeLists','removeBlackLists','exports','multer','util'];(function(_0x34ce9c,_0x101034){var _0x4a82fa=function(_0x5a033f){while(--_0x5a033f){_0x34ce9c['push'](_0x34ce9c['shift']());}};_0x4a82fa(++_0x101034);}(_0x1352,0x17a));var _0x2135=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0x1352[_0x173d7e];return _0x2220d6;};'use strict';var multer=require(_0x2135('0x0'));var util=require(_0x2135('0x1'));var path=require(_0x2135('0x2'));var timeout=require(_0x2135('0x3'));var express=require(_0x2135('0x4'));var router=express[_0x2135('0x5')]();var fs_extra=require(_0x2135('0x6'));var auth=require(_0x2135('0x7'));var interaction=require(_0x2135('0x8'));var config=require(_0x2135('0x9'));var controller=require(_0x2135('0xa'));router[_0x2135('0xb')]('/',auth[_0x2135('0xc')](),controller[_0x2135('0xd')]);router[_0x2135('0xb')]('/:id',auth[_0x2135('0xc')](),controller[_0x2135('0xe')]);router['get'](_0x2135('0xf'),auth[_0x2135('0xc')](),controller['getHoppers']);router[_0x2135('0xb')](_0x2135('0x10'),auth[_0x2135('0xc')](),controller[_0x2135('0x11')]);router[_0x2135('0xb')](_0x2135('0x12'),auth[_0x2135('0xc')](),controller[_0x2135('0x13')]);router[_0x2135('0xb')]('/:id/hopper_black',auth['isAuthenticated'](),controller[_0x2135('0x14')]);router[_0x2135('0xb')](_0x2135('0x15'),auth[_0x2135('0xc')](),controller['getLists']);router[_0x2135('0xb')]('/:id/blacklists',auth[_0x2135('0xc')](),controller[_0x2135('0x16')]);router[_0x2135('0x17')]('/',auth[_0x2135('0xc')](),controller[_0x2135('0x18')]);router[_0x2135('0x17')](_0x2135('0x19'),auth[_0x2135('0xc')](),controller[_0x2135('0x1a')]);router[_0x2135('0x17')]('/:id/lists',auth['isAuthenticated'](),controller[_0x2135('0x1b')]);router[_0x2135('0x17')](_0x2135('0x1c'),auth['isAuthenticated'](),controller[_0x2135('0x1d')]);router[_0x2135('0x1e')](_0x2135('0x1f'),auth[_0x2135('0xc')](),controller[_0x2135('0x20')]);router[_0x2135('0x21')]('/:id',auth[_0x2135('0xc')](),controller[_0x2135('0x22')]);router[_0x2135('0x21')](_0x2135('0x15'),auth[_0x2135('0xc')](),controller[_0x2135('0x23')]);router[_0x2135('0x21')](_0x2135('0x1c'),auth[_0x2135('0xc')](),controller[_0x2135('0x24')]);module[_0x2135('0x25')]=router; \ No newline at end of file +var _0xca04=['path','Router','fs-extra','../../config/environment','./campaign.controller','index','/:id','show','get','/:id/hoppers','isAuthenticated','getHoppers','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','create','post','/:id/clone','clone','addLists','addBlackLists','put','update','delete','destroy','removeLists','removeBlackLists','exports','multer'];(function(_0x12c4fe,_0x3f2d61){var _0x56b681=function(_0x3f3605){while(--_0x3f3605){_0x12c4fe['push'](_0x12c4fe['shift']());}};_0x56b681(++_0x3f2d61);}(_0xca04,0xa4));var _0x4ca0=function(_0x109e60,_0x1634ac){_0x109e60=_0x109e60-0x0;var _0x4b239d=_0xca04[_0x109e60];return _0x4b239d;};'use strict';var multer=require(_0x4ca0('0x0'));var util=require('util');var path=require(_0x4ca0('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4ca0('0x2')]();var fs_extra=require(_0x4ca0('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4ca0('0x4'));var controller=require(_0x4ca0('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x4ca0('0x6')]);router['get'](_0x4ca0('0x7'),auth['isAuthenticated'](),controller[_0x4ca0('0x8')]);router[_0x4ca0('0x9')](_0x4ca0('0xa'),auth[_0x4ca0('0xb')](),controller[_0x4ca0('0xc')]);router[_0x4ca0('0x9')]('/:id/hopper_histories',auth['isAuthenticated'](),controller[_0x4ca0('0xd')]);router[_0x4ca0('0x9')](_0x4ca0('0xe'),auth[_0x4ca0('0xb')](),controller['getHopperFinals']);router[_0x4ca0('0x9')](_0x4ca0('0xf'),auth[_0x4ca0('0xb')](),controller[_0x4ca0('0x10')]);router[_0x4ca0('0x9')](_0x4ca0('0x11'),auth[_0x4ca0('0xb')](),controller[_0x4ca0('0x12')]);router[_0x4ca0('0x9')](_0x4ca0('0x13'),auth[_0x4ca0('0xb')](),controller['getBlackLists']);router['post']('/',auth[_0x4ca0('0xb')](),controller[_0x4ca0('0x14')]);router[_0x4ca0('0x15')](_0x4ca0('0x16'),auth[_0x4ca0('0xb')](),controller[_0x4ca0('0x17')]);router[_0x4ca0('0x15')]('/:id/lists',auth[_0x4ca0('0xb')](),controller[_0x4ca0('0x18')]);router['post'](_0x4ca0('0x13'),auth[_0x4ca0('0xb')](),controller[_0x4ca0('0x19')]);router[_0x4ca0('0x1a')](_0x4ca0('0x7'),auth['isAuthenticated'](),controller[_0x4ca0('0x1b')]);router[_0x4ca0('0x1c')]('/:id',auth[_0x4ca0('0xb')](),controller[_0x4ca0('0x1d')]);router[_0x4ca0('0x1c')](_0x4ca0('0x11'),auth[_0x4ca0('0xb')](),controller[_0x4ca0('0x1e')]);router[_0x4ca0('0x1c')](_0x4ca0('0x13'),auth[_0x4ca0('0xb')](),controller[_0x4ca0('0x1f')]);module[_0x4ca0('0x20')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index d7e76e3..056eac9 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 _0x17be=['VIRTUAL','key','sequelize','exports','STRING','TEXT','medium'];(function(_0x14b60e,_0x5bcdad){var _0xb7c345=function(_0x3fb27d){while(--_0x3fb27d){_0x14b60e['push'](_0x14b60e['shift']());}};_0xb7c345(++_0x5bcdad);}(_0x17be,0x136));var _0xe17b=function(_0x3902fd,_0x5ab635){_0x3902fd=_0x3902fd-0x0;var _0x1e0990=_0x17be[_0x3902fd];return _0x1e0990;};'use strict';var Sequelize=require(_0xe17b('0x0'));module[_0xe17b('0x1')]={'key':{'type':Sequelize[_0xe17b('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0xe17b('0x3')],'length':_0xe17b('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0xe17b('0x2')]},'name':{'type':Sequelize[_0xe17b('0x5')],'get':function(){return this['getDataValue'](_0xe17b('0x6'));}}}; \ No newline at end of file +var _0xafa9=['medium','VIRTUAL','sequelize','exports','TEXT'];(function(_0x4c5fff,_0x50d286){var _0x2bd2da=function(_0x57f1ba){while(--_0x57f1ba){_0x4c5fff['push'](_0x4c5fff['shift']());}};_0x2bd2da(++_0x50d286);}(_0xafa9,0x15b));var _0x9afa=function(_0x5bb1e9,_0x15f025){_0x5bb1e9=_0x5bb1e9-0x0;var _0x262c24=_0xafa9[_0x5bb1e9];return _0x262c24;};'use strict';var Sequelize=require(_0x9afa('0x0'));module[_0x9afa('0x1')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x9afa('0x2')],'length':_0x9afa('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x9afa('0x4')],'get':function(){return this['getDataValue']('key');}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 8ba665f..a5013d8 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 _0x6533=['hasOwnProperty','order','sort','where','pick','filter','merge','options','CannedAnswer','includeAll','include','findAll','rows','catch','params','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','reject','save','update','then','destroy','get','CannedAnswers','UserProfileResource','error','send','rawAttributes','type','key','model','map','name','query','keys','filters','intersection','attributes','fields','length'];(function(_0x283973,_0x2eecfd){var _0x1d927f=function(_0x5d501e){while(--_0x5d501e){_0x283973['push'](_0x283973['shift']());}};_0x1d927f(++_0x2eecfd);}(_0x6533,0x127));var _0x3653=function(_0x40e681,_0x39999a){_0x40e681=_0x40e681-0x0;var _0x8528d2=_0x6533[_0x40e681];return _0x8528d2;};'use strict';var emlformat=require(_0x3653('0x0'));var rimraf=require(_0x3653('0x1'));var zipdir=require(_0x3653('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3653('0x3'));var moment=require('moment');var BPromise=require(_0x3653('0x4'));var Mustache=require(_0x3653('0x5'));var util=require('util');var path=require(_0x3653('0x6'));var sox=require(_0x3653('0x7'));var csv=require(_0x3653('0x8'));var ejs=require(_0x3653('0x9'));var fs=require('fs');var fs_extra=require(_0x3653('0xa'));var _=require(_0x3653('0xb'));var squel=require(_0x3653('0xc'));var crypto=require(_0x3653('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3653('0xe'));var toCsv=require(_0x3653('0x8'));var querystring=require(_0x3653('0xf'));var Papa=require(_0x3653('0x10'));var Redis=require(_0x3653('0x11'));var authService=require(_0x3653('0x12'));var qs=require(_0x3653('0x13'));var as=require(_0x3653('0x14'));var hardwareService=require(_0x3653('0x15'));var logger=require(_0x3653('0x16'))(_0x3653('0x17'));var utils=require('../../config/utils');var config=require(_0x3653('0x18'));var licenseUtil=require(_0x3653('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x42452f,_0x7896a4){_0x7896a4=_0x7896a4||0xcc;return function(_0x7bfff6){if(_0x7bfff6){return _0x42452f[_0x3653('0x1a')](_0x7896a4);}return _0x42452f[_0x3653('0x1b')](_0x7896a4)[_0x3653('0x1c')]();};}function respondWithResult(_0x56e99b,_0x53147b){_0x53147b=_0x53147b||0xc8;return function(_0x287170){if(_0x287170){return _0x56e99b[_0x3653('0x1b')](_0x53147b)[_0x3653('0x1d')](_0x287170);}};}function respondWithFilteredResult(_0x390892,_0x2cda51){return function(_0x4b936e){if(_0x4b936e){var _0x2f0a86=typeof _0x2cda51[_0x3653('0x1e')]===_0x3653('0x1f')&&typeof _0x2cda51[_0x3653('0x20')]==='undefined';var _0x2201c7=_0x4b936e[_0x3653('0x21')];var _0x109884=_0x2f0a86?0x0:_0x2cda51['offset'];var _0x2d835d=_0x2f0a86?_0x4b936e[_0x3653('0x21')]:_0x2cda51[_0x3653('0x1e')]+_0x2cda51[_0x3653('0x20')];var _0x17e2b4;if(_0x2d835d>=_0x2201c7){_0x2d835d=_0x2201c7;_0x17e2b4=0xc8;}else{_0x17e2b4=0xce;}_0x390892[_0x3653('0x1b')](_0x17e2b4);return _0x390892['set']('Content-Range',_0x109884+'-'+_0x2d835d+'/'+_0x2201c7)['json'](_0x4b936e);}return null;};}function patchUpdates(_0x597efc){return function(_0x335a39){try{jsonpatch['apply'](_0x335a39,_0x597efc,!![]);}catch(_0x22f592){return BPromise[_0x3653('0x22')](_0x22f592);}return _0x335a39[_0x3653('0x23')]();};}function saveUpdates(_0xe1c5c2,_0x39dca9){return function(_0x25219c){if(_0x25219c){return _0x25219c[_0x3653('0x24')](_0xe1c5c2)[_0x3653('0x25')](function(_0x4f1386){return _0x4f1386;});}return null;};}function removeEntity(_0x4e5a3b,_0x62a475){return function(_0x111f94){if(_0x111f94){return _0x111f94[_0x3653('0x26')]()['then'](function(){var _0x2999a0=_0x111f94[_0x3653('0x27')]({'plain':!![]});var _0x14e683=_0x3653('0x28');return db[_0x3653('0x29')][_0x3653('0x26')]({'where':{'type':_0x14e683,'resourceId':_0x2999a0['id']}})[_0x3653('0x25')](function(){return _0x111f94;});})[_0x3653('0x25')](function(){_0x4e5a3b[_0x3653('0x1b')](0xcc)[_0x3653('0x1c')]();});}};}function handleEntityNotFound(_0x232974,_0x2d79f7){return function(_0x4aa435){if(!_0x4aa435){_0x232974['sendStatus'](0x194);}return _0x4aa435;};}function handleError(_0x135a4b,_0x24f90d){_0x24f90d=_0x24f90d||0x1f4;return function(_0x3de48b){logger[_0x3653('0x2a')](_0x3de48b['stack']);if(_0x3de48b['name']){delete _0x3de48b['name'];}_0x135a4b[_0x3653('0x1b')](_0x24f90d)[_0x3653('0x2b')](_0x3de48b);};}exports['index']=function(_0x539f62,_0x55e516){var _0x167b5c={},_0x169f1f={},_0x516771={'count':0x0,'rows':[]};var _0xb14bac=_['map'](db['CannedAnswer'][_0x3653('0x2c')],function(_0x4dad81){return{'name':_0x4dad81['fieldName'],'type':_0x4dad81[_0x3653('0x2d')][_0x3653('0x2e')]};});_0x169f1f[_0x3653('0x2f')]=_[_0x3653('0x30')](_0xb14bac,_0x3653('0x31'));_0x169f1f[_0x3653('0x32')]=_[_0x3653('0x33')](_0x539f62['query']);_0x169f1f[_0x3653('0x34')]=_[_0x3653('0x35')](_0x169f1f['model'],_0x169f1f[_0x3653('0x32')]);_0x167b5c[_0x3653('0x36')]=_[_0x3653('0x35')](_0x169f1f[_0x3653('0x2f')],qs['fields'](_0x539f62[_0x3653('0x32')][_0x3653('0x37')]));_0x167b5c[_0x3653('0x36')]=_0x167b5c[_0x3653('0x36')][_0x3653('0x38')]?_0x167b5c['attributes']:_0x169f1f[_0x3653('0x2f')];if(!_0x539f62[_0x3653('0x32')][_0x3653('0x39')]('nolimit')){_0x167b5c['limit']=qs[_0x3653('0x20')](_0x539f62[_0x3653('0x32')]['limit']);_0x167b5c[_0x3653('0x1e')]=qs[_0x3653('0x1e')](_0x539f62['query']['offset']);}_0x167b5c[_0x3653('0x3a')]=qs[_0x3653('0x3b')](_0x539f62[_0x3653('0x32')][_0x3653('0x3b')]);_0x167b5c[_0x3653('0x3c')]=qs[_0x3653('0x34')](_[_0x3653('0x3d')](_0x539f62['query'],_0x169f1f[_0x3653('0x34')]),_0xb14bac);if(_0x539f62[_0x3653('0x32')][_0x3653('0x3e')]){_0x167b5c[_0x3653('0x3c')]=_[_0x3653('0x3f')](_0x167b5c['where'],{'$or':[{'key':{'$like':'%'+_0x539f62[_0x3653('0x32')][_0x3653('0x3e')]+'%'}},{'value':{'$like':'%'+_0x539f62[_0x3653('0x32')][_0x3653('0x3e')]+'%'}}]});}_0x167b5c=_[_0x3653('0x3f')]({},_0x167b5c,_0x539f62[_0x3653('0x40')]);var _0x38dd77={'where':_0x167b5c[_0x3653('0x3c')]};return db[_0x3653('0x41')][_0x3653('0x21')](_0x38dd77)['then'](function(_0x3dbdd0){_0x516771[_0x3653('0x21')]=_0x3dbdd0;if(_0x539f62['query'][_0x3653('0x42')]){_0x167b5c[_0x3653('0x43')]=[{'all':!![]}];}return db[_0x3653('0x41')][_0x3653('0x44')](_0x167b5c);})[_0x3653('0x25')](function(_0x58ef01){_0x516771[_0x3653('0x45')]=_0x58ef01;return _0x516771;})[_0x3653('0x25')](respondWithFilteredResult(_0x55e516,_0x167b5c))[_0x3653('0x46')](handleError(_0x55e516,null));};exports['show']=function(_0x28da23,_0x4b2ee5){var _0x432e4c={'raw':!![],'where':{'id':_0x28da23[_0x3653('0x47')]['id']}},_0x57f8d4={};_0x57f8d4[_0x3653('0x2f')]=_[_0x3653('0x33')](db[_0x3653('0x41')][_0x3653('0x2c')]);_0x57f8d4[_0x3653('0x32')]=_[_0x3653('0x33')](_0x28da23[_0x3653('0x32')]);_0x57f8d4[_0x3653('0x34')]=_[_0x3653('0x35')](_0x57f8d4[_0x3653('0x2f')],_0x57f8d4[_0x3653('0x32')]);_0x432e4c[_0x3653('0x36')]=_[_0x3653('0x35')](_0x57f8d4[_0x3653('0x2f')],qs[_0x3653('0x37')](_0x28da23[_0x3653('0x32')]['fields']));_0x432e4c[_0x3653('0x36')]=_0x432e4c['attributes']['length']?_0x432e4c['attributes']:_0x57f8d4[_0x3653('0x2f')];if(_0x28da23[_0x3653('0x32')]['includeAll']){_0x432e4c[_0x3653('0x43')]=[{'all':!![]}];}_0x432e4c=_['merge']({},_0x432e4c,_0x28da23['options']);return db['CannedAnswer'][_0x3653('0x48')](_0x432e4c)['then'](handleEntityNotFound(_0x4b2ee5,null))[_0x3653('0x25')](respondWithResult(_0x4b2ee5,null))['catch'](handleError(_0x4b2ee5,null));};exports[_0x3653('0x24')]=function(_0x3f917f,_0x1b8790){if(_0x3f917f['body']['id']){delete _0x3f917f[_0x3653('0x49')]['id'];}return db[_0x3653('0x41')]['find']({'where':{'id':_0x3f917f[_0x3653('0x47')]['id']}})[_0x3653('0x25')](handleEntityNotFound(_0x1b8790,null))[_0x3653('0x25')](saveUpdates(_0x3f917f[_0x3653('0x49')],null))['then'](respondWithResult(_0x1b8790,null))['catch'](handleError(_0x1b8790,null));};exports[_0x3653('0x26')]=function(_0xd82c24,_0x1c7657){return db['CannedAnswer'][_0x3653('0x48')]({'where':{'id':_0xd82c24['params']['id']}})[_0x3653('0x25')](handleEntityNotFound(_0x1c7657,null))['then'](removeEntity(_0x1c7657,null))[_0x3653('0x46')](handleError(_0x1c7657,null));};exports[_0x3653('0x4a')]=function(_0x589d8e,_0xb605bf){var _0x282711={'key':_0x589d8e[_0x3653('0x49')][_0x3653('0x2e')]};if(_0x589d8e[_0x3653('0x49')]['MailAccountId']){_0x282711[_0x3653('0x4b')]=_0x589d8e['body'][_0x3653('0x4b')];}else if(_0x589d8e[_0x3653('0x49')][_0x3653('0x4c')]){_0x282711[_0x3653('0x4c')]=_0x589d8e[_0x3653('0x49')][_0x3653('0x4c')];}else if(_0x589d8e[_0x3653('0x49')][_0x3653('0x4d')]){_0x282711['OpenchannelAccountId']=_0x589d8e[_0x3653('0x49')]['OpenchannelAccountId'];}else if(_0x589d8e[_0x3653('0x49')][_0x3653('0x4e')]){_0x282711[_0x3653('0x4e')]=_0x589d8e[_0x3653('0x49')][_0x3653('0x4e')];}return db['CannedAnswer'][_0x3653('0x48')]({'where':_0x282711})[_0x3653('0x25')](function(_0xb39d03){if(_0xb39d03){throw new db[(_0x3653('0x4f'))][(_0x3653('0x50'))](_0x3653('0x51'));}return db[_0x3653('0x41')][_0x3653('0x4a')](_0x589d8e['body']);})[_0x3653('0x25')](function(_0x3b6163){var _0x1fbd65=_0x589d8e[_0x3653('0x52')][_0x3653('0x27')]({'plain':!![]});if(!_0x1fbd65)throw new Error(_0x3653('0x53'));if(_0x1fbd65[_0x3653('0x54')]===_0x3653('0x52')){var _0x20151e=_0x3b6163[_0x3653('0x27')]({'plain':!![]});return db[_0x3653('0x55')][_0x3653('0x48')]({'where':{'name':_0x3653('0x28'),'userProfileId':_0x1fbd65['userProfileId']},'raw':!![]})[_0x3653('0x25')](function(_0x317d17){if(_0x317d17&&_0x317d17[_0x3653('0x56')]===0x0){return db[_0x3653('0x29')][_0x3653('0x4a')]({'name':_0x20151e[_0x3653('0x31')],'resourceId':_0x20151e['id'],'type':_0x317d17[_0x3653('0x31')],'sectionId':_0x317d17['id']},{})[_0x3653('0x25')](function(){return _0x3b6163;});}else{return _0x3b6163;}})[_0x3653('0x46')](function(_0x1d2493){logger[_0x3653('0x2a')](_0x3653('0x57'),_0x1d2493);throw _0x1d2493;});}return _0x3b6163;})[_0x3653('0x25')](respondWithResult(_0xb605bf,0xc9))['catch'](handleError(_0xb605bf,null));}; \ No newline at end of file +var _0x8de5=['fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','sort','where','filter','merge','options','findAll','catch','show','params','length','includeAll','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','find','Sequelize','ValidationError','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','CannedAnswers','UserProfileResource','stack','name','send','index','map','CannedAnswer','rawAttributes'];(function(_0x5c78d9,_0x2736c7){var _0x69ae1f=function(_0x4b31ac){while(--_0x4b31ac){_0x5c78d9['push'](_0x5c78d9['shift']());}};_0x69ae1f(++_0x2736c7);}(_0x8de5,0x1e1));var _0x58de=function(_0x31c115,_0x571962){_0x31c115=_0x31c115-0x0;var _0x3b7834=_0x8de5[_0x31c115];return _0x3b7834;};'use strict';var emlformat=require(_0x58de('0x0'));var rimraf=require(_0x58de('0x1'));var zipdir=require(_0x58de('0x2'));var jsonpatch=require(_0x58de('0x3'));var rp=require(_0x58de('0x4'));var moment=require(_0x58de('0x5'));var BPromise=require(_0x58de('0x6'));var Mustache=require(_0x58de('0x7'));var util=require(_0x58de('0x8'));var path=require(_0x58de('0x9'));var sox=require(_0x58de('0xa'));var csv=require('to-csv');var ejs=require(_0x58de('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x58de('0xc'));var squel=require(_0x58de('0xd'));var crypto=require(_0x58de('0xe'));var jsforce=require(_0x58de('0xf'));var deskjs=require(_0x58de('0x10'));var toCsv=require(_0x58de('0x11'));var querystring=require(_0x58de('0x12'));var Papa=require('papaparse');var Redis=require(_0x58de('0x13'));var authService=require(_0x58de('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x58de('0x15'));var hardwareService=require(_0x58de('0x16'));var logger=require(_0x58de('0x17'))(_0x58de('0x18'));var utils=require('../../config/utils');var config=require(_0x58de('0x19'));var licenseUtil=require(_0x58de('0x1a'));var db=require(_0x58de('0x1b'))['db'];function respondWithStatusCode(_0x31804c,_0x3b4b86){_0x3b4b86=_0x3b4b86||0xcc;return function(_0x92b35){if(_0x92b35){return _0x31804c[_0x58de('0x1c')](_0x3b4b86);}return _0x31804c[_0x58de('0x1d')](_0x3b4b86)[_0x58de('0x1e')]();};}function respondWithResult(_0x3b5ace,_0x567a80){_0x567a80=_0x567a80||0xc8;return function(_0x41f465){if(_0x41f465){return _0x3b5ace['status'](_0x567a80)[_0x58de('0x1f')](_0x41f465);}};}function respondWithFilteredResult(_0x22d1c3,_0x6f72a3){return function(_0x13cdb9){if(_0x13cdb9){var _0x720a38=typeof _0x6f72a3[_0x58de('0x20')]===_0x58de('0x21')&&typeof _0x6f72a3[_0x58de('0x22')]===_0x58de('0x21');var _0x55364e=_0x13cdb9[_0x58de('0x23')];var _0x53eb78=_0x720a38?0x0:_0x6f72a3[_0x58de('0x20')];var _0x819ad=_0x720a38?_0x13cdb9[_0x58de('0x23')]:_0x6f72a3[_0x58de('0x20')]+_0x6f72a3[_0x58de('0x22')];var _0x41ce69;if(_0x819ad>=_0x55364e){_0x819ad=_0x55364e;_0x41ce69=0xc8;}else{_0x41ce69=0xce;}_0x22d1c3['status'](_0x41ce69);return _0x22d1c3[_0x58de('0x24')](_0x58de('0x25'),_0x53eb78+'-'+_0x819ad+'/'+_0x55364e)['json'](_0x13cdb9);}return null;};}function patchUpdates(_0x48b823){return function(_0x3046f1){try{jsonpatch[_0x58de('0x26')](_0x3046f1,_0x48b823,!![]);}catch(_0x15c64c){return BPromise[_0x58de('0x27')](_0x15c64c);}return _0x3046f1[_0x58de('0x28')]();};}function saveUpdates(_0x286a76,_0x4e71be){return function(_0x5097c4){if(_0x5097c4){return _0x5097c4[_0x58de('0x29')](_0x286a76)[_0x58de('0x2a')](function(_0x4ca3a7){return _0x4ca3a7;});}return null;};}function removeEntity(_0x3ef53f,_0x5d3b44){return function(_0x3b8068){if(_0x3b8068){return _0x3b8068[_0x58de('0x2b')]()['then'](function(){var _0x61b6a7=_0x3b8068['get']({'plain':!![]});var _0x2b7c00=_0x58de('0x2c');return db[_0x58de('0x2d')][_0x58de('0x2b')]({'where':{'type':_0x2b7c00,'resourceId':_0x61b6a7['id']}})[_0x58de('0x2a')](function(){return _0x3b8068;});})[_0x58de('0x2a')](function(){_0x3ef53f[_0x58de('0x1d')](0xcc)[_0x58de('0x1e')]();});}};}function handleEntityNotFound(_0x314416,_0x3dadfc){return function(_0x117969){if(!_0x117969){_0x314416[_0x58de('0x1c')](0x194);}return _0x117969;};}function handleError(_0x2aa607,_0x2e79e0){_0x2e79e0=_0x2e79e0||0x1f4;return function(_0x1ad98a){logger['error'](_0x1ad98a[_0x58de('0x2e')]);if(_0x1ad98a[_0x58de('0x2f')]){delete _0x1ad98a[_0x58de('0x2f')];}_0x2aa607[_0x58de('0x1d')](_0x2e79e0)[_0x58de('0x30')](_0x1ad98a);};}exports[_0x58de('0x31')]=function(_0x534b9c,_0x2a7baa){var _0x2933fb={},_0x5774dd={},_0x14e7c3={'count':0x0,'rows':[]};var _0x4ca5a2=_[_0x58de('0x32')](db[_0x58de('0x33')][_0x58de('0x34')],function(_0x295081){return{'name':_0x295081[_0x58de('0x35')],'type':_0x295081[_0x58de('0x36')][_0x58de('0x37')]};});_0x5774dd[_0x58de('0x38')]=_[_0x58de('0x32')](_0x4ca5a2,_0x58de('0x2f'));_0x5774dd[_0x58de('0x39')]=_[_0x58de('0x3a')](_0x534b9c[_0x58de('0x39')]);_0x5774dd[_0x58de('0x3b')]=_[_0x58de('0x3c')](_0x5774dd[_0x58de('0x38')],_0x5774dd[_0x58de('0x39')]);_0x2933fb['attributes']=_['intersection'](_0x5774dd[_0x58de('0x38')],qs[_0x58de('0x3d')](_0x534b9c[_0x58de('0x39')][_0x58de('0x3d')]));_0x2933fb[_0x58de('0x3e')]=_0x2933fb['attributes']['length']?_0x2933fb[_0x58de('0x3e')]:_0x5774dd[_0x58de('0x38')];if(!_0x534b9c['query']['hasOwnProperty']('nolimit')){_0x2933fb[_0x58de('0x22')]=qs[_0x58de('0x22')](_0x534b9c[_0x58de('0x39')][_0x58de('0x22')]);_0x2933fb[_0x58de('0x20')]=qs[_0x58de('0x20')](_0x534b9c[_0x58de('0x39')][_0x58de('0x20')]);}_0x2933fb['order']=qs['sort'](_0x534b9c[_0x58de('0x39')][_0x58de('0x3f')]);_0x2933fb[_0x58de('0x40')]=qs['filters'](_['pick'](_0x534b9c['query'],_0x5774dd[_0x58de('0x3b')]),_0x4ca5a2);if(_0x534b9c['query'][_0x58de('0x41')]){_0x2933fb[_0x58de('0x40')]=_[_0x58de('0x42')](_0x2933fb[_0x58de('0x40')],{'$or':[{'key':{'$like':'%'+_0x534b9c[_0x58de('0x39')][_0x58de('0x41')]+'%'}},{'value':{'$like':'%'+_0x534b9c[_0x58de('0x39')]['filter']+'%'}}]});}_0x2933fb=_['merge']({},_0x2933fb,_0x534b9c[_0x58de('0x43')]);var _0x5814bd={'where':_0x2933fb[_0x58de('0x40')]};return db['CannedAnswer']['count'](_0x5814bd)['then'](function(_0x51fce6){_0x14e7c3[_0x58de('0x23')]=_0x51fce6;if(_0x534b9c['query']['includeAll']){_0x2933fb['include']=[{'all':!![]}];}return db[_0x58de('0x33')][_0x58de('0x44')](_0x2933fb);})[_0x58de('0x2a')](function(_0x30eb4b){_0x14e7c3['rows']=_0x30eb4b;return _0x14e7c3;})[_0x58de('0x2a')](respondWithFilteredResult(_0x2a7baa,_0x2933fb))[_0x58de('0x45')](handleError(_0x2a7baa,null));};exports[_0x58de('0x46')]=function(_0x3a6726,_0x3db979){var _0x2e842b={'raw':!![],'where':{'id':_0x3a6726[_0x58de('0x47')]['id']}},_0x51dad2={};_0x51dad2['model']=_[_0x58de('0x3a')](db['CannedAnswer'][_0x58de('0x34')]);_0x51dad2['query']=_[_0x58de('0x3a')](_0x3a6726['query']);_0x51dad2['filters']=_[_0x58de('0x3c')](_0x51dad2['model'],_0x51dad2[_0x58de('0x39')]);_0x2e842b['attributes']=_[_0x58de('0x3c')](_0x51dad2[_0x58de('0x38')],qs[_0x58de('0x3d')](_0x3a6726[_0x58de('0x39')][_0x58de('0x3d')]));_0x2e842b['attributes']=_0x2e842b[_0x58de('0x3e')][_0x58de('0x48')]?_0x2e842b[_0x58de('0x3e')]:_0x51dad2[_0x58de('0x38')];if(_0x3a6726['query'][_0x58de('0x49')]){_0x2e842b['include']=[{'all':!![]}];}_0x2e842b=_['merge']({},_0x2e842b,_0x3a6726[_0x58de('0x43')]);return db[_0x58de('0x33')]['find'](_0x2e842b)['then'](handleEntityNotFound(_0x3db979,null))[_0x58de('0x2a')](respondWithResult(_0x3db979,null))[_0x58de('0x45')](handleError(_0x3db979,null));};exports[_0x58de('0x29')]=function(_0x4806dc,_0x265248){if(_0x4806dc[_0x58de('0x4a')]['id']){delete _0x4806dc[_0x58de('0x4a')]['id'];}return db['CannedAnswer']['find']({'where':{'id':_0x4806dc[_0x58de('0x47')]['id']}})[_0x58de('0x2a')](handleEntityNotFound(_0x265248,null))[_0x58de('0x2a')](saveUpdates(_0x4806dc[_0x58de('0x4a')],null))[_0x58de('0x2a')](respondWithResult(_0x265248,null))['catch'](handleError(_0x265248,null));};exports[_0x58de('0x2b')]=function(_0x254323,_0x4eed10){return db[_0x58de('0x33')]['find']({'where':{'id':_0x254323[_0x58de('0x47')]['id']}})[_0x58de('0x2a')](handleEntityNotFound(_0x4eed10,null))[_0x58de('0x2a')](removeEntity(_0x4eed10,null))[_0x58de('0x45')](handleError(_0x4eed10,null));};exports[_0x58de('0x4b')]=function(_0x244611,_0x5a6b62){var _0xf7b558={'key':_0x244611[_0x58de('0x4a')][_0x58de('0x37')]};if(_0x244611[_0x58de('0x4a')][_0x58de('0x4c')]){_0xf7b558[_0x58de('0x4c')]=_0x244611[_0x58de('0x4a')]['MailAccountId'];}else if(_0x244611[_0x58de('0x4a')]['SmsAccountId']){_0xf7b558[_0x58de('0x4d')]=_0x244611[_0x58de('0x4a')][_0x58de('0x4d')];}else if(_0x244611[_0x58de('0x4a')][_0x58de('0x4e')]){_0xf7b558['OpenchannelAccountId']=_0x244611[_0x58de('0x4a')]['OpenchannelAccountId'];}else if(_0x244611['body'][_0x58de('0x4f')]){_0xf7b558['ChatWebsiteId']=_0x244611[_0x58de('0x4a')][_0x58de('0x4f')];}return db[_0x58de('0x33')][_0x58de('0x50')]({'where':_0xf7b558})[_0x58de('0x2a')](function(_0x1f1c0e){if(_0x1f1c0e){throw new db[(_0x58de('0x51'))][(_0x58de('0x52'))]('The\x20inserted\x20key\x20already\x20exists.');}return db[_0x58de('0x33')][_0x58de('0x4b')](_0x244611[_0x58de('0x4a')]);})[_0x58de('0x2a')](function(_0x305f38){var _0x15f28a=_0x244611[_0x58de('0x53')][_0x58de('0x54')]({'plain':!![]});if(!_0x15f28a)throw new Error(_0x58de('0x55'));if(_0x15f28a[_0x58de('0x56')]===_0x58de('0x53')){var _0x309551=_0x305f38[_0x58de('0x54')]({'plain':!![]});return db[_0x58de('0x57')][_0x58de('0x50')]({'where':{'name':_0x58de('0x2c'),'userProfileId':_0x15f28a[_0x58de('0x58')]},'raw':!![]})['then'](function(_0x5eab15){if(_0x5eab15&&_0x5eab15['autoAssociation']===0x0){return db[_0x58de('0x2d')]['create']({'name':_0x309551[_0x58de('0x2f')],'resourceId':_0x309551['id'],'type':_0x5eab15['name'],'sectionId':_0x5eab15['id']},{})[_0x58de('0x2a')](function(){return _0x305f38;});}else{return _0x305f38;}})[_0x58de('0x45')](function(_0xf2f903){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xf2f903);throw _0xf2f903;});}return _0x305f38;})[_0x58de('0x2a')](respondWithResult(_0x5a6b62,0xc9))[_0x58de('0x45')](handleError(_0x5a6b62,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 0ade65b..a709f16 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 _0xe171=['utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','define','CannedAnswer','utf8mb4'];(function(_0x5680f9,_0x4e96a8){var _0x1dd746=function(_0x284ce4){while(--_0x284ce4){_0x5680f9['push'](_0x5680f9['shift']());}};_0x1dd746(++_0x4e96a8);}(_0xe171,0xeb));var _0x1e17=function(_0x570d20,_0x185c1a){_0x570d20=_0x570d20-0x0;var _0x5872a8=_0xe171[_0x570d20];return _0x5872a8;};'use strict';var _=require(_0x1e17('0x0'));var util=require('util');var logger=require(_0x1e17('0x1'))(_0x1e17('0x2'));var moment=require(_0x1e17('0x3'));var BPromise=require('bluebird');var rp=require(_0x1e17('0x4'));var fs=require('fs');var path=require(_0x1e17('0x5'));var rimraf=require(_0x1e17('0x6'));var config=require(_0x1e17('0x7'));var attributes=require(_0x1e17('0x8'));module['exports']=function(_0x364dae,_0x5b14ad){return _0x364dae[_0x1e17('0x9')](_0x1e17('0xa'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1e17('0xb'),'collate':_0x1e17('0xc')});}; \ No newline at end of file +var _0xcb8e=['request-promise','rimraf','../../config/environment','exports','define','CannedAnswer','tools_canned_answers','lodash','../../config/logger','api','moment','bluebird'];(function(_0x291717,_0x54b354){var _0x5d1e50=function(_0x4309ac){while(--_0x4309ac){_0x291717['push'](_0x291717['shift']());}};_0x5d1e50(++_0x54b354);}(_0xcb8e,0x1f3));var _0xecb8=function(_0x511ef8,_0x485338){_0x511ef8=_0x511ef8-0x0;var _0x1bbc3f=_0xcb8e[_0x511ef8];return _0x1bbc3f;};'use strict';var _=require(_0xecb8('0x0'));var util=require('util');var logger=require(_0xecb8('0x1'))(_0xecb8('0x2'));var moment=require(_0xecb8('0x3'));var BPromise=require(_0xecb8('0x4'));var rp=require(_0xecb8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xecb8('0x6'));var config=require(_0xecb8('0x7'));var attributes=require('./cannedAnswer.attributes');module[_0xecb8('0x8')]=function(_0x2e1101,_0x3a2100){return _0x2e1101[_0xecb8('0x9')](_0xecb8('0xa'),attributes,{'tableName':_0xecb8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 80927c4..ddb254c 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(_0xefd8a0,_0x286b7b){var _0x4c4897=function(_0x7793ac){while(--_0x7793ac){_0xefd8a0['push'](_0xefd8a0['shift']());}};_0x4c4897(++_0x286b7b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'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(_0x44b714,_0x46e6e8){var _0x66fd8b=function(_0x11056c){while(--_0x11056c){_0x44b714['push'](_0x44b714['shift']());}};_0x66fd8b(++_0x46e6e8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index 7d7dfc6..63b765e 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 _0x3599=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cannedAnswer.controller','index','isAuthenticated','create','/:id','update','delete','destroy'];(function(_0x57b3df,_0x445081){var _0x206656=function(_0x16aeb3){while(--_0x16aeb3){_0x57b3df['push'](_0x57b3df['shift']());}};_0x206656(++_0x445081);}(_0x3599,0x170));var _0x9359=function(_0x58b0c9,_0x372df0){_0x58b0c9=_0x58b0c9-0x0;var _0x227a49=_0x3599[_0x58b0c9];return _0x227a49;};'use strict';var multer=require(_0x9359('0x0'));var util=require('util');var path=require(_0x9359('0x1'));var timeout=require(_0x9359('0x2'));var express=require(_0x9359('0x3'));var router=express[_0x9359('0x4')]();var fs_extra=require(_0x9359('0x5'));var auth=require(_0x9359('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9359('0x7'));var controller=require(_0x9359('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x9359('0x9')]);router['get']('/:id',auth[_0x9359('0xa')](),controller['show']);router['post']('/',auth[_0x9359('0xa')](),controller[_0x9359('0xb')]);router['put'](_0x9359('0xc'),auth[_0x9359('0xa')](),controller[_0x9359('0xd')]);router[_0x9359('0xe')](_0x9359('0xc'),auth[_0x9359('0xa')](),controller[_0x9359('0xf')]);module['exports']=router; \ No newline at end of file +var _0xf655=['isAuthenticated','index','get','show','post','put','delete','/:id','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cannedAnswer.controller'];(function(_0x2bdf17,_0x6d8f38){var _0xdde346=function(_0x2dfbe3){while(--_0x2dfbe3){_0x2bdf17['push'](_0x2bdf17['shift']());}};_0xdde346(++_0x6d8f38);}(_0xf655,0x199));var _0x5f65=function(_0x5239e2,_0x5e0d5b){_0x5239e2=_0x5239e2-0x0;var _0x1f6a59=_0xf655[_0x5239e2];return _0x1f6a59;};'use strict';var multer=require(_0x5f65('0x0'));var util=require(_0x5f65('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5f65('0x2')]();var fs_extra=require(_0x5f65('0x3'));var auth=require(_0x5f65('0x4'));var interaction=require(_0x5f65('0x5'));var config=require('../../config/environment');var controller=require(_0x5f65('0x6'));router['get']('/',auth[_0x5f65('0x7')](),controller[_0x5f65('0x8')]);router[_0x5f65('0x9')]('/:id',auth[_0x5f65('0x7')](),controller[_0x5f65('0xa')]);router[_0x5f65('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5f65('0xc')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x5f65('0xd')](_0x5f65('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x5f65('0xf')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index be3b147..886342f 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 _0x402f=['DATE','STRING','INTEGER','sequelize'];(function(_0x20e43f,_0x3a9a95){var _0xa76f8=function(_0x225db6){while(--_0x225db6){_0x20e43f['push'](_0x20e43f['shift']());}};_0xa76f8(++_0x3a9a95);}(_0x402f,0x6f));var _0xf402=function(_0x308c2e,_0x21ba44){_0x308c2e=_0x308c2e-0x0;var _0x2ef55d=_0x402f[_0x308c2e];return _0x2ef55d;};'use strict';var Sequelize=require(_0xf402('0x0'));module['exports']={'calldate':{'type':Sequelize[_0xf402('0x1')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0xf402('0x2')]},'dst':{'type':Sequelize[_0xf402('0x2')]},'dcontext':{'type':Sequelize[_0xf402('0x2')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0xf402('0x2')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xf402('0x2')]},'duration':{'type':Sequelize[_0xf402('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xf402('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xf402('0x2')]},'amaflags':{'type':Sequelize[_0xf402('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xf402('0x2')]},'linkedid':{'type':Sequelize[_0xf402('0x2')]},'sequence':{'type':Sequelize[_0xf402('0x2')]},'peeraccount':{'type':Sequelize[_0xf402('0x2')]},'type':{'type':Sequelize[_0xf402('0x2')]},'tag':{'type':Sequelize[_0xf402('0x2')]}}; \ No newline at end of file +var _0xee5b=['sequelize','DATE','1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x59513e,_0x15eec4){var _0x469a1b=function(_0x3a4dc7){while(--_0x3a4dc7){_0x59513e['push'](_0x59513e['shift']());}};_0x469a1b(++_0x15eec4);}(_0xee5b,0x1f4));var _0xbee5=function(_0x34ea19,_0x4a8ffe){_0x34ea19=_0x34ea19-0x0;var _0x31e059=_0xee5b[_0x34ea19];return _0x31e059;};'use strict';var Sequelize=require(_0xbee5('0x0'));module['exports']={'calldate':{'type':Sequelize[_0xbee5('0x1')],'allowNull':![],'defaultValue':_0xbee5('0x2')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0xbee5('0x3')]},'dst':{'type':Sequelize[_0xbee5('0x3')]},'dcontext':{'type':Sequelize[_0xbee5('0x3')]},'channel':{'type':Sequelize[_0xbee5('0x3')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xbee5('0x3')]},'duration':{'type':Sequelize[_0xbee5('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xbee5('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xbee5('0x3')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0xbee5('0x3')]},'peeraccount':{'type':Sequelize[_0xbee5('0x3')]},'type':{'type':Sequelize[_0xbee5('0x3')]},'tag':{'type':Sequelize[_0xbee5('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 7cb340f..9395ba1 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 _0x6b8f=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','rows','catch','show','params','keys','find','create','body','describe','rimraf','fast-json-patch','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','apply','reject','save','update','destroy','then','end','name','send','index','map','Cdr','rawAttributes','fieldName','type','key','query','filters','intersection','model'];(function(_0x2df413,_0x5303ae){var _0x1f5133=function(_0xb2347c){while(--_0xb2347c){_0x2df413['push'](_0x2df413['shift']());}};_0x1f5133(++_0x5303ae);}(_0x6b8f,0x1bc));var _0xf6b8=function(_0x302da8,_0x32ad49){_0x302da8=_0x302da8-0x0;var _0x456c5d=_0x6b8f[_0x302da8];return _0x456c5d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf6b8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf6b8('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf6b8('0x2'));var Mustache=require(_0xf6b8('0x3'));var util=require('util');var path=require(_0xf6b8('0x4'));var sox=require(_0xf6b8('0x5'));var csv=require(_0xf6b8('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf6b8('0x7'));var _=require(_0xf6b8('0x8'));var squel=require(_0xf6b8('0x9'));var crypto=require(_0xf6b8('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf6b8('0x6'));var querystring=require('querystring');var Papa=require(_0xf6b8('0xb'));var Redis=require(_0xf6b8('0xc'));var authService=require(_0xf6b8('0xd'));var qs=require(_0xf6b8('0xe'));var as=require(_0xf6b8('0xf'));var hardwareService=require(_0xf6b8('0x10'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xf6b8('0x11'));var licenseUtil=require(_0xf6b8('0x12'));var db=require(_0xf6b8('0x13'))['db'];function respondWithStatusCode(_0x1d96b9,_0x5a6118){_0x5a6118=_0x5a6118||0xcc;return function(_0x4e5235){if(_0x4e5235){return _0x1d96b9[_0xf6b8('0x14')](_0x5a6118);}return _0x1d96b9[_0xf6b8('0x15')](_0x5a6118)['end']();};}function respondWithResult(_0xfcecc9,_0x2db10c){_0x2db10c=_0x2db10c||0xc8;return function(_0x454d8a){if(_0x454d8a){return _0xfcecc9['status'](_0x2db10c)[_0xf6b8('0x16')](_0x454d8a);}};}function respondWithFilteredResult(_0x53d744,_0x410345){return function(_0x1ee041){if(_0x1ee041){var _0x2e1748=typeof _0x410345[_0xf6b8('0x17')]===_0xf6b8('0x18')&&typeof _0x410345['limit']==='undefined';var _0x3bb9ae=_0x1ee041['count'];var _0x3cf63c=_0x2e1748?0x0:_0x410345[_0xf6b8('0x17')];var _0x4a93a8=_0x2e1748?_0x1ee041['count']:_0x410345[_0xf6b8('0x17')]+_0x410345[_0xf6b8('0x19')];var _0x3081db;if(_0x4a93a8>=_0x3bb9ae){_0x4a93a8=_0x3bb9ae;_0x3081db=0xc8;}else{_0x3081db=0xce;}_0x53d744[_0xf6b8('0x15')](_0x3081db);return _0x53d744['set']('Content-Range',_0x3cf63c+'-'+_0x4a93a8+'/'+_0x3bb9ae)['json'](_0x1ee041);}return null;};}function patchUpdates(_0x3298a4){return function(_0x2a8195){try{jsonpatch[_0xf6b8('0x1a')](_0x2a8195,_0x3298a4,!![]);}catch(_0x56b48a){return BPromise[_0xf6b8('0x1b')](_0x56b48a);}return _0x2a8195[_0xf6b8('0x1c')]();};}function saveUpdates(_0x3d2c57,_0x9c660c){return function(_0x5dd616){if(_0x5dd616){return _0x5dd616[_0xf6b8('0x1d')](_0x3d2c57)['then'](function(_0x22c52d){return _0x22c52d;});}return null;};}function removeEntity(_0x2b5bd3,_0x13a451){return function(_0x4127c9){if(_0x4127c9){return _0x4127c9[_0xf6b8('0x1e')]()[_0xf6b8('0x1f')](function(){_0x2b5bd3['status'](0xcc)[_0xf6b8('0x20')]();});}};}function handleEntityNotFound(_0x1ebfea,_0x4815f7){return function(_0x205d6c){if(!_0x205d6c){_0x1ebfea[_0xf6b8('0x14')](0x194);}return _0x205d6c;};}function handleError(_0x324057,_0xd5ebb5){_0xd5ebb5=_0xd5ebb5||0x1f4;return function(_0x3365b8){logger['error'](_0x3365b8['stack']);if(_0x3365b8[_0xf6b8('0x21')]){delete _0x3365b8[_0xf6b8('0x21')];}_0x324057['status'](_0xd5ebb5)[_0xf6b8('0x22')](_0x3365b8);};}exports[_0xf6b8('0x23')]=function(_0x888319,_0x5a7f55){var _0x458935={},_0xc958f4={},_0x511896={'count':0x0,'rows':[]};var _0x309f04=_[_0xf6b8('0x24')](db[_0xf6b8('0x25')][_0xf6b8('0x26')],function(_0x51ffcf){return{'name':_0x51ffcf[_0xf6b8('0x27')],'type':_0x51ffcf[_0xf6b8('0x28')][_0xf6b8('0x29')]};});_0xc958f4['model']=_[_0xf6b8('0x24')](_0x309f04,_0xf6b8('0x21'));_0xc958f4[_0xf6b8('0x2a')]=_['keys'](_0x888319[_0xf6b8('0x2a')]);_0xc958f4[_0xf6b8('0x2b')]=_[_0xf6b8('0x2c')](_0xc958f4[_0xf6b8('0x2d')],_0xc958f4['query']);_0x458935[_0xf6b8('0x2e')]=_[_0xf6b8('0x2c')](_0xc958f4[_0xf6b8('0x2d')],qs['fields'](_0x888319['query'][_0xf6b8('0x2f')]));_0x458935[_0xf6b8('0x2e')]=_0x458935[_0xf6b8('0x2e')][_0xf6b8('0x30')]?_0x458935[_0xf6b8('0x2e')]:_0xc958f4[_0xf6b8('0x2d')];if(!_0x888319[_0xf6b8('0x2a')][_0xf6b8('0x31')](_0xf6b8('0x32'))){_0x458935[_0xf6b8('0x19')]=qs[_0xf6b8('0x19')](_0x888319[_0xf6b8('0x2a')][_0xf6b8('0x19')]);_0x458935[_0xf6b8('0x17')]=qs[_0xf6b8('0x17')](_0x888319[_0xf6b8('0x2a')][_0xf6b8('0x17')]);}_0x458935[_0xf6b8('0x33')]=qs['sort'](_0x888319['query'][_0xf6b8('0x34')]);_0x458935[_0xf6b8('0x35')]=qs[_0xf6b8('0x2b')](_[_0xf6b8('0x36')](_0x888319[_0xf6b8('0x2a')],_0xc958f4[_0xf6b8('0x2b')]),_0x309f04);if(_0x888319[_0xf6b8('0x2a')][_0xf6b8('0x37')]){_0x458935[_0xf6b8('0x35')]=_[_0xf6b8('0x38')](_0x458935[_0xf6b8('0x35')],{'$or':_[_0xf6b8('0x24')](_0x309f04,function(_0x4a8c49){if(_0x4a8c49[_0xf6b8('0x28')]!==_0xf6b8('0x39')){var _0x5d26ad={};_0x5d26ad[_0x4a8c49[_0xf6b8('0x21')]]={'$like':'%'+_0x888319[_0xf6b8('0x2a')][_0xf6b8('0x37')]+'%'};return _0x5d26ad;}})});}_0x458935=_[_0xf6b8('0x38')]({},_0x458935,_0x888319[_0xf6b8('0x3a')]);var _0x87a4ee={'where':_0x458935[_0xf6b8('0x35')]};return db[_0xf6b8('0x25')][_0xf6b8('0x3b')](_0x87a4ee)[_0xf6b8('0x1f')](function(_0x15a63b){_0x511896[_0xf6b8('0x3b')]=_0x15a63b;if(_0x888319[_0xf6b8('0x2a')][_0xf6b8('0x3c')]){_0x458935['include']=[{'all':!![]}];}return db['Cdr']['findAll'](_0x458935);})[_0xf6b8('0x1f')](function(_0x2c68f5){_0x511896[_0xf6b8('0x3d')]=_0x2c68f5;return _0x511896;})[_0xf6b8('0x1f')](respondWithFilteredResult(_0x5a7f55,_0x458935))[_0xf6b8('0x3e')](handleError(_0x5a7f55,null));};exports[_0xf6b8('0x3f')]=function(_0x1390dc,_0x48f4cb){var _0x1f5e72={'raw':!![],'where':{'id':_0x1390dc[_0xf6b8('0x40')]['id']}},_0x5086d9={};_0x5086d9[_0xf6b8('0x2d')]=_[_0xf6b8('0x41')](db[_0xf6b8('0x25')][_0xf6b8('0x26')]);_0x5086d9['query']=_[_0xf6b8('0x41')](_0x1390dc[_0xf6b8('0x2a')]);_0x5086d9[_0xf6b8('0x2b')]=_[_0xf6b8('0x2c')](_0x5086d9[_0xf6b8('0x2d')],_0x5086d9['query']);_0x1f5e72[_0xf6b8('0x2e')]=_[_0xf6b8('0x2c')](_0x5086d9[_0xf6b8('0x2d')],qs['fields'](_0x1390dc['query'][_0xf6b8('0x2f')]));_0x1f5e72[_0xf6b8('0x2e')]=_0x1f5e72[_0xf6b8('0x2e')][_0xf6b8('0x30')]?_0x1f5e72['attributes']:_0x5086d9['model'];if(_0x1390dc['query'][_0xf6b8('0x3c')]){_0x1f5e72['include']=[{'all':!![]}];}_0x1f5e72=_[_0xf6b8('0x38')]({},_0x1f5e72,_0x1390dc[_0xf6b8('0x3a')]);return db[_0xf6b8('0x25')][_0xf6b8('0x42')](_0x1f5e72)[_0xf6b8('0x1f')](handleEntityNotFound(_0x48f4cb,null))[_0xf6b8('0x1f')](respondWithResult(_0x48f4cb,null))[_0xf6b8('0x3e')](handleError(_0x48f4cb,null));};exports[_0xf6b8('0x43')]=function(_0x394a34,_0x597511){return db[_0xf6b8('0x25')]['create'](_0x394a34[_0xf6b8('0x44')],{})[_0xf6b8('0x1f')](respondWithResult(_0x597511,0xc9))[_0xf6b8('0x3e')](handleError(_0x597511,null));};exports[_0xf6b8('0x1d')]=function(_0x1abf17,_0x291845){if(_0x1abf17[_0xf6b8('0x44')]['id']){delete _0x1abf17['body']['id'];}return db[_0xf6b8('0x25')][_0xf6b8('0x42')]({'where':{'id':_0x1abf17[_0xf6b8('0x40')]['id']}})[_0xf6b8('0x1f')](handleEntityNotFound(_0x291845,null))['then'](saveUpdates(_0x1abf17[_0xf6b8('0x44')],null))[_0xf6b8('0x1f')](respondWithResult(_0x291845,null))['catch'](handleError(_0x291845,null));};exports[_0xf6b8('0x1e')]=function(_0x143164,_0x392582){return db[_0xf6b8('0x25')][_0xf6b8('0x42')]({'where':{'id':_0x143164['params']['id']}})[_0xf6b8('0x1f')](handleEntityNotFound(_0x392582,null))[_0xf6b8('0x1f')](removeEntity(_0x392582,null))['catch'](handleError(_0x392582,null));};exports['describe']=function(_0x55c392,_0x22c1eb){return db[_0xf6b8('0x25')][_0xf6b8('0x45')]()[_0xf6b8('0x1f')](respondWithResult(_0x22c1eb,null))['catch'](handleError(_0x22c1eb,null));}; \ No newline at end of file +var _0xb138=['filters','pick','VIRTUAL','merge','includeAll','include','rows','catch','show','params','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','Cdr','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','sort','where'];(function(_0x2ec0b7,_0x1931c){var _0x44b5a7=function(_0x5285de){while(--_0x5285de){_0x2ec0b7['push'](_0x2ec0b7['shift']());}};_0x44b5a7(++_0x1931c);}(_0xb138,0x1dd));var _0x8b13=function(_0x39ff9c,_0x35d13a){_0x39ff9c=_0x39ff9c-0x0;var _0x4ff2d2=_0xb138[_0x39ff9c];return _0x4ff2d2;};'use strict';var emlformat=require(_0x8b13('0x0'));var rimraf=require(_0x8b13('0x1'));var zipdir=require(_0x8b13('0x2'));var jsonpatch=require(_0x8b13('0x3'));var rp=require(_0x8b13('0x4'));var moment=require(_0x8b13('0x5'));var BPromise=require(_0x8b13('0x6'));var Mustache=require('mustache');var util=require(_0x8b13('0x7'));var path=require(_0x8b13('0x8'));var sox=require(_0x8b13('0x9'));var csv=require('to-csv');var ejs=require(_0x8b13('0xa'));var fs=require('fs');var fs_extra=require(_0x8b13('0xb'));var _=require('lodash');var squel=require(_0x8b13('0xc'));var crypto=require(_0x8b13('0xd'));var jsforce=require(_0x8b13('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x8b13('0xf'));var querystring=require(_0x8b13('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8b13('0x11'));var qs=require(_0x8b13('0x12'));var as=require(_0x8b13('0x13'));var hardwareService=require(_0x8b13('0x14'));var logger=require(_0x8b13('0x15'))('api');var utils=require(_0x8b13('0x16'));var config=require(_0x8b13('0x17'));var licenseUtil=require(_0x8b13('0x18'));var db=require(_0x8b13('0x19'))['db'];function respondWithStatusCode(_0xb227e0,_0x1893b1){_0x1893b1=_0x1893b1||0xcc;return function(_0x58f97e){if(_0x58f97e){return _0xb227e0['sendStatus'](_0x1893b1);}return _0xb227e0[_0x8b13('0x1a')](_0x1893b1)[_0x8b13('0x1b')]();};}function respondWithResult(_0x5f12b5,_0x51a935){_0x51a935=_0x51a935||0xc8;return function(_0x479773){if(_0x479773){return _0x5f12b5[_0x8b13('0x1a')](_0x51a935)[_0x8b13('0x1c')](_0x479773);}};}function respondWithFilteredResult(_0xf29086,_0x2c615a){return function(_0x13f956){if(_0x13f956){var _0x542357=typeof _0x2c615a[_0x8b13('0x1d')]===_0x8b13('0x1e')&&typeof _0x2c615a[_0x8b13('0x1f')]===_0x8b13('0x1e');var _0x3eed21=_0x13f956[_0x8b13('0x20')];var _0x10fbde=_0x542357?0x0:_0x2c615a[_0x8b13('0x1d')];var _0x4989d3=_0x542357?_0x13f956['count']:_0x2c615a[_0x8b13('0x1d')]+_0x2c615a[_0x8b13('0x1f')];var _0x14a8ac;if(_0x4989d3>=_0x3eed21){_0x4989d3=_0x3eed21;_0x14a8ac=0xc8;}else{_0x14a8ac=0xce;}_0xf29086[_0x8b13('0x1a')](_0x14a8ac);return _0xf29086[_0x8b13('0x21')](_0x8b13('0x22'),_0x10fbde+'-'+_0x4989d3+'/'+_0x3eed21)['json'](_0x13f956);}return null;};}function patchUpdates(_0x1e8a48){return function(_0x3c4d4f){try{jsonpatch[_0x8b13('0x23')](_0x3c4d4f,_0x1e8a48,!![]);}catch(_0x54a309){return BPromise['reject'](_0x54a309);}return _0x3c4d4f[_0x8b13('0x24')]();};}function saveUpdates(_0xcb7621,_0x4f9902){return function(_0x3187ed){if(_0x3187ed){return _0x3187ed[_0x8b13('0x25')](_0xcb7621)[_0x8b13('0x26')](function(_0x213280){return _0x213280;});}return null;};}function removeEntity(_0xc05d5c,_0x583639){return function(_0x339271){if(_0x339271){return _0x339271[_0x8b13('0x27')]()['then'](function(){_0xc05d5c[_0x8b13('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x420772,_0x325d68){return function(_0x54786a){if(!_0x54786a){_0x420772[_0x8b13('0x28')](0x194);}return _0x54786a;};}function handleError(_0x3223d8,_0x4f8e58){_0x4f8e58=_0x4f8e58||0x1f4;return function(_0x134c5e){logger[_0x8b13('0x29')](_0x134c5e[_0x8b13('0x2a')]);if(_0x134c5e[_0x8b13('0x2b')]){delete _0x134c5e[_0x8b13('0x2b')];}_0x3223d8['status'](_0x4f8e58)[_0x8b13('0x2c')](_0x134c5e);};}exports[_0x8b13('0x2d')]=function(_0x3475d8,_0x1511bf){var _0x114b01={},_0x2bb51d={},_0x5ab161={'count':0x0,'rows':[]};var _0x35fdca=_[_0x8b13('0x2e')](db[_0x8b13('0x2f')][_0x8b13('0x30')],function(_0x23fde7){return{'name':_0x23fde7[_0x8b13('0x31')],'type':_0x23fde7[_0x8b13('0x32')][_0x8b13('0x33')]};});_0x2bb51d[_0x8b13('0x34')]=_['map'](_0x35fdca,_0x8b13('0x2b'));_0x2bb51d[_0x8b13('0x35')]=_[_0x8b13('0x36')](_0x3475d8[_0x8b13('0x35')]);_0x2bb51d['filters']=_['intersection'](_0x2bb51d[_0x8b13('0x34')],_0x2bb51d['query']);_0x114b01['attributes']=_[_0x8b13('0x37')](_0x2bb51d['model'],qs[_0x8b13('0x38')](_0x3475d8[_0x8b13('0x35')][_0x8b13('0x38')]));_0x114b01[_0x8b13('0x39')]=_0x114b01[_0x8b13('0x39')][_0x8b13('0x3a')]?_0x114b01[_0x8b13('0x39')]:_0x2bb51d[_0x8b13('0x34')];if(!_0x3475d8[_0x8b13('0x35')][_0x8b13('0x3b')]('nolimit')){_0x114b01[_0x8b13('0x1f')]=qs[_0x8b13('0x1f')](_0x3475d8[_0x8b13('0x35')][_0x8b13('0x1f')]);_0x114b01[_0x8b13('0x1d')]=qs[_0x8b13('0x1d')](_0x3475d8[_0x8b13('0x35')][_0x8b13('0x1d')]);}_0x114b01['order']=qs[_0x8b13('0x3c')](_0x3475d8['query'][_0x8b13('0x3c')]);_0x114b01[_0x8b13('0x3d')]=qs[_0x8b13('0x3e')](_[_0x8b13('0x3f')](_0x3475d8[_0x8b13('0x35')],_0x2bb51d[_0x8b13('0x3e')]),_0x35fdca);if(_0x3475d8['query']['filter']){_0x114b01[_0x8b13('0x3d')]=_['merge'](_0x114b01[_0x8b13('0x3d')],{'$or':_['map'](_0x35fdca,function(_0x590a23){if(_0x590a23[_0x8b13('0x32')]!==_0x8b13('0x40')){var _0x2bc877={};_0x2bc877[_0x590a23[_0x8b13('0x2b')]]={'$like':'%'+_0x3475d8['query']['filter']+'%'};return _0x2bc877;}})});}_0x114b01=_[_0x8b13('0x41')]({},_0x114b01,_0x3475d8['options']);var _0x6ba2f3={'where':_0x114b01[_0x8b13('0x3d')]};return db['Cdr'][_0x8b13('0x20')](_0x6ba2f3)[_0x8b13('0x26')](function(_0x35c1d6){_0x5ab161[_0x8b13('0x20')]=_0x35c1d6;if(_0x3475d8[_0x8b13('0x35')][_0x8b13('0x42')]){_0x114b01[_0x8b13('0x43')]=[{'all':!![]}];}return db['Cdr']['findAll'](_0x114b01);})['then'](function(_0x3eb3c5){_0x5ab161[_0x8b13('0x44')]=_0x3eb3c5;return _0x5ab161;})[_0x8b13('0x26')](respondWithFilteredResult(_0x1511bf,_0x114b01))[_0x8b13('0x45')](handleError(_0x1511bf,null));};exports[_0x8b13('0x46')]=function(_0x271507,_0x492f7d){var _0x4342db={'raw':!![],'where':{'id':_0x271507[_0x8b13('0x47')]['id']}},_0x50e535={};_0x50e535['model']=_[_0x8b13('0x36')](db[_0x8b13('0x2f')][_0x8b13('0x30')]);_0x50e535[_0x8b13('0x35')]=_[_0x8b13('0x36')](_0x271507[_0x8b13('0x35')]);_0x50e535[_0x8b13('0x3e')]=_['intersection'](_0x50e535['model'],_0x50e535['query']);_0x4342db[_0x8b13('0x39')]=_[_0x8b13('0x37')](_0x50e535[_0x8b13('0x34')],qs[_0x8b13('0x38')](_0x271507['query']['fields']));_0x4342db[_0x8b13('0x39')]=_0x4342db['attributes'][_0x8b13('0x3a')]?_0x4342db[_0x8b13('0x39')]:_0x50e535[_0x8b13('0x34')];if(_0x271507[_0x8b13('0x35')][_0x8b13('0x42')]){_0x4342db['include']=[{'all':!![]}];}_0x4342db=_[_0x8b13('0x41')]({},_0x4342db,_0x271507[_0x8b13('0x48')]);return db[_0x8b13('0x2f')][_0x8b13('0x49')](_0x4342db)[_0x8b13('0x26')](handleEntityNotFound(_0x492f7d,null))[_0x8b13('0x26')](respondWithResult(_0x492f7d,null))[_0x8b13('0x45')](handleError(_0x492f7d,null));};exports[_0x8b13('0x4a')]=function(_0x3e192b,_0x518298){return db[_0x8b13('0x2f')]['create'](_0x3e192b[_0x8b13('0x4b')],{})[_0x8b13('0x26')](respondWithResult(_0x518298,0xc9))[_0x8b13('0x45')](handleError(_0x518298,null));};exports['update']=function(_0x148efb,_0x35f612){if(_0x148efb[_0x8b13('0x4b')]['id']){delete _0x148efb[_0x8b13('0x4b')]['id'];}return db[_0x8b13('0x2f')][_0x8b13('0x49')]({'where':{'id':_0x148efb[_0x8b13('0x47')]['id']}})['then'](handleEntityNotFound(_0x35f612,null))[_0x8b13('0x26')](saveUpdates(_0x148efb['body'],null))[_0x8b13('0x26')](respondWithResult(_0x35f612,null))[_0x8b13('0x45')](handleError(_0x35f612,null));};exports[_0x8b13('0x27')]=function(_0x435867,_0x2be640){return db[_0x8b13('0x2f')][_0x8b13('0x49')]({'where':{'id':_0x435867[_0x8b13('0x47')]['id']}})[_0x8b13('0x26')](handleEntityNotFound(_0x2be640,null))[_0x8b13('0x26')](removeEntity(_0x2be640,null))[_0x8b13('0x45')](handleError(_0x2be640,null));};exports[_0x8b13('0x4c')]=function(_0xd55f3b,_0x2bdfae){return db[_0x8b13('0x2f')][_0x8b13('0x4c')]()[_0x8b13('0x26')](respondWithResult(_0x2bdfae,null))['catch'](handleError(_0x2bdfae,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index bcbf1fd..e5f94ef 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x480361,_0x24e86d){var _0x347d09=function(_0x5ff02d){while(--_0x5ff02d){_0x480361['push'](_0x480361['shift']());}};_0x347d09(++_0x24e86d);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x3d5cd9,_0x16db35){var _0x116080=function(_0x4c80fc){while(--_0x4c80fc){_0x3d5cd9['push'](_0x3d5cd9['shift']());}};_0x116080(++_0x16db35);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 2b1ead3..0affbb7 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 _0x1f6d=['http','request','then','Cdr,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0x1f6d,0x19a));var _0xd1f6=function(_0x18860c,_0x4af1bb){_0x18860c=_0x18860c-0x0;var _0x51f126=_0x1f6d[_0x18860c];return _0x51f126;};'use strict';var _=require(_0xd1f6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd1f6('0x1'));var rs=require(_0xd1f6('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd1f6('0x3'))['db'];var utils=require(_0xd1f6('0x4'));var logger=require('../../config/logger')(_0xd1f6('0x5'));var config=require(_0xd1f6('0x6'));var jayson=require(_0xd1f6('0x7'));var client=jayson['client'][_0xd1f6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x17030b,_0x5116be,_0x1bca2f){return new BPromise(function(_0x508c05,_0x4cf19b){return client[_0xd1f6('0x9')](_0x17030b,_0x1bca2f)[_0xd1f6('0xa')](function(_0x26916b){logger['info'](_0xd1f6('0xb'),_0x5116be,_0xd1f6('0xc'));logger[_0xd1f6('0xd')]('Cdr,\x20%s,\x20%s,\x20%s',_0x5116be,_0xd1f6('0xc'),JSON[_0xd1f6('0xe')](_0x26916b));if(_0x26916b[_0xd1f6('0xf')]){if(_0x26916b[_0xd1f6('0xf')][_0xd1f6('0x10')]===0x1f4){logger[_0xd1f6('0xf')](_0xd1f6('0xb'),_0x5116be,_0x26916b['error'][_0xd1f6('0x11')]);return _0x4cf19b(_0x26916b[_0xd1f6('0xf')][_0xd1f6('0x11')]);}logger[_0xd1f6('0xf')](_0xd1f6('0xb'),_0x5116be,_0x26916b[_0xd1f6('0xf')][_0xd1f6('0x11')]);return _0x508c05(_0x26916b[_0xd1f6('0xf')][_0xd1f6('0x11')]);}else{logger['info'](_0xd1f6('0xb'),_0x5116be,_0xd1f6('0xc'));_0x508c05(_0x26916b['result'][_0xd1f6('0x11')]);}})[_0xd1f6('0x12')](function(_0x19c060){logger[_0xd1f6('0xf')](_0xd1f6('0xb'),_0x5116be,_0x19c060);_0x4cf19b(_0x19c060);});});} \ No newline at end of file +var _0x5b4c=['bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','then','info','Cdr,\x20%s,\x20%s','debug','request\x20sent','error','code','message','catch','lodash','util','moment'];(function(_0x52967f,_0x5a463d){var _0x5e671f=function(_0x2b3dbb){while(--_0x2b3dbb){_0x52967f['push'](_0x52967f['shift']());}};_0x5e671f(++_0x5a463d);}(_0x5b4c,0xb1));var _0xc5b4=function(_0x14e704,_0x2ae9f4){_0x14e704=_0x14e704-0x0;var _0x2ff43b=_0x5b4c[_0x14e704];return _0x2ff43b;};'use strict';var _=require(_0xc5b4('0x0'));var util=require(_0xc5b4('0x1'));var moment=require(_0xc5b4('0x2'));var BPromise=require(_0xc5b4('0x3'));var rs=require(_0xc5b4('0x4'));var fs=require('fs');var Redis=require(_0xc5b4('0x5'));var db=require(_0xc5b4('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc5b4('0x7'));var config=require('../../config/environment');var jayson=require(_0xc5b4('0x8'));var client=jayson[_0xc5b4('0x9')][_0xc5b4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x522f38,_0x148217,_0x3633c1){return new BPromise(function(_0xa5acc,_0x598210){return client['request'](_0x522f38,_0x3633c1)[_0xc5b4('0xb')](function(_0x93c855){logger[_0xc5b4('0xc')](_0xc5b4('0xd'),_0x148217,'request\x20sent');logger[_0xc5b4('0xe')]('Cdr,\x20%s,\x20%s,\x20%s',_0x148217,_0xc5b4('0xf'),JSON['stringify'](_0x93c855));if(_0x93c855[_0xc5b4('0x10')]){if(_0x93c855['error'][_0xc5b4('0x11')]===0x1f4){logger['error'](_0xc5b4('0xd'),_0x148217,_0x93c855[_0xc5b4('0x10')][_0xc5b4('0x12')]);return _0x598210(_0x93c855[_0xc5b4('0x10')]['message']);}logger[_0xc5b4('0x10')](_0xc5b4('0xd'),_0x148217,_0x93c855[_0xc5b4('0x10')][_0xc5b4('0x12')]);return _0xa5acc(_0x93c855[_0xc5b4('0x10')][_0xc5b4('0x12')]);}else{logger['info'](_0xc5b4('0xd'),_0x148217,'request\x20sent');_0xa5acc(_0x93c855['result'][_0xc5b4('0x12')]);}})[_0xc5b4('0x13')](function(_0x47dddd){logger[_0xc5b4('0x10')](_0xc5b4('0xd'),_0x148217,_0x47dddd);_0x598210(_0x47dddd);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 350f858..7d2518e 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(_0x8a969d,_0x339d9f){var _0x1d8dc7=function(_0x283ec0){while(--_0x283ec0){_0x8a969d['push'](_0x8a969d['shift']());}};_0x1d8dc7(++_0x339d9f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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(_0x1e8972,_0x12b85d){var _0x353f33=function(_0x16f1da){while(--_0x16f1da){_0x1e8972['push'](_0x1e8972['shift']());}};_0x353f33(++_0x12b85d);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 822361e..5f1a7c3 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 _0xfb7f=['TEXT','*,*,*,*','sequelize','exports','STRING','noop'];(function(_0xef8146,_0x459c34){var _0x5a6cb0=function(_0x2f84ec){while(--_0x2f84ec){_0xef8146['push'](_0xef8146['shift']());}};_0x5a6cb0(++_0x459c34);}(_0xfb7f,0x1a6));var _0xffb7=function(_0x2405a8,_0x453e33){_0x2405a8=_0x2405a8-0x0;var _0x2b31a3=_0xfb7f[_0x2405a8];return _0x2b31a3;};'use strict';var Sequelize=require(_0xffb7('0x0'));module[_0xffb7('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xffb7('0x2')],'allowNull':![],'defaultValue':_0xffb7('0x3')},'appdata':{'type':Sequelize[_0xffb7('0x4')]()},'description':{'type':Sequelize[_0xffb7('0x2')]},'interval':{'type':Sequelize[_0xffb7('0x2')],'defaultValue':_0xffb7('0x5')}}; \ No newline at end of file +var _0x439c=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x355ce8,_0x5f1d0a){var _0x1db8b8=function(_0x277eb2){while(--_0x277eb2){_0x355ce8['push'](_0x355ce8['shift']());}};_0x1db8b8(++_0x5f1d0a);}(_0x439c,0xbb));var _0xc439=function(_0x7f31fe,_0x28e264){_0x7f31fe=_0x7f31fe-0x0;var _0x1bbdff=_0x439c[_0x7f31fe];return _0x1bbdff;};'use strict';var Sequelize=require(_0xc439('0x0'));module[_0xc439('0x1')]={'priority':{'type':Sequelize[_0xc439('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xc439('0x3')],'allowNull':![],'defaultValue':_0xc439('0x4')},'appdata':{'type':Sequelize[_0xc439('0x5')]()},'description':{'type':Sequelize[_0xc439('0x3')]},'interval':{'type':Sequelize[_0xc439('0x3')],'defaultValue':_0xc439('0x6')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 13a12d9..1443739 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 _0xaf1d=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','show','params','model','rawAttributes','query','keys','filters','intersection','attributes','fields','include','merge','find','catch','body','ChatApplication','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','jsforce','querystring','papaparse'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaf1d,0x9f));var _0xdaf1=function(_0x53bdff,_0x377d10){_0x53bdff=_0x53bdff-0x0;var _0x43fdbf=_0xaf1d[_0x53bdff];return _0x43fdbf;};'use strict';var emlformat=require(_0xdaf1('0x0'));var rimraf=require(_0xdaf1('0x1'));var zipdir=require(_0xdaf1('0x2'));var jsonpatch=require(_0xdaf1('0x3'));var rp=require('request-promise');var moment=require(_0xdaf1('0x4'));var BPromise=require(_0xdaf1('0x5'));var Mustache=require('mustache');var util=require(_0xdaf1('0x6'));var path=require(_0xdaf1('0x7'));var sox=require(_0xdaf1('0x8'));var csv=require(_0xdaf1('0x9'));var ejs=require(_0xdaf1('0xa'));var fs=require('fs');var fs_extra=require(_0xdaf1('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xdaf1('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xdaf1('0xd'));var Papa=require(_0xdaf1('0xe'));var Redis=require(_0xdaf1('0xf'));var authService=require(_0xdaf1('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xdaf1('0x11'));var hardwareService=require(_0xdaf1('0x12'));var logger=require(_0xdaf1('0x13'))(_0xdaf1('0x14'));var utils=require(_0xdaf1('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xdaf1('0x16'));var db=require(_0xdaf1('0x17'))['db'];function respondWithStatusCode(_0x260c4b,_0x112c60){_0x112c60=_0x112c60||0xcc;return function(_0x3543e1){if(_0x3543e1){return _0x260c4b[_0xdaf1('0x18')](_0x112c60);}return _0x260c4b[_0xdaf1('0x19')](_0x112c60)[_0xdaf1('0x1a')]();};}function respondWithResult(_0x9a5ec6,_0x7393af){_0x7393af=_0x7393af||0xc8;return function(_0x2add26){if(_0x2add26){return _0x9a5ec6[_0xdaf1('0x19')](_0x7393af)[_0xdaf1('0x1b')](_0x2add26);}};}function respondWithFilteredResult(_0x4ed852,_0x506590){return function(_0x2e98d4){if(_0x2e98d4){var _0x562534=typeof _0x506590[_0xdaf1('0x1c')]==='undefined'&&typeof _0x506590[_0xdaf1('0x1d')]===_0xdaf1('0x1e');var _0xc1141c=_0x2e98d4['count'];var _0x1dd985=_0x562534?0x0:_0x506590['offset'];var _0x4896c1=_0x562534?_0x2e98d4[_0xdaf1('0x1f')]:_0x506590[_0xdaf1('0x1c')]+_0x506590[_0xdaf1('0x1d')];var _0x36792f;if(_0x4896c1>=_0xc1141c){_0x4896c1=_0xc1141c;_0x36792f=0xc8;}else{_0x36792f=0xce;}_0x4ed852['status'](_0x36792f);return _0x4ed852['set'](_0xdaf1('0x20'),_0x1dd985+'-'+_0x4896c1+'/'+_0xc1141c)[_0xdaf1('0x1b')](_0x2e98d4);}return null;};}function patchUpdates(_0x37b377){return function(_0x5030e5){try{jsonpatch[_0xdaf1('0x21')](_0x5030e5,_0x37b377,!![]);}catch(_0x2e776d){return BPromise[_0xdaf1('0x22')](_0x2e776d);}return _0x5030e5[_0xdaf1('0x23')]();};}function saveUpdates(_0x77d6c6,_0x110e33){return function(_0x446c5b){if(_0x446c5b){return _0x446c5b[_0xdaf1('0x24')](_0x77d6c6)[_0xdaf1('0x25')](function(_0x28916c){return _0x28916c;});}return null;};}function removeEntity(_0x56b426,_0x1f97e4){return function(_0x41b020){if(_0x41b020){return _0x41b020[_0xdaf1('0x26')]()['then'](function(){_0x56b426['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x556bd8,_0x2e6bf4){return function(_0x10c286){if(!_0x10c286){_0x556bd8['sendStatus'](0x194);}return _0x10c286;};}function handleError(_0x997245,_0x3c2166){_0x3c2166=_0x3c2166||0x1f4;return function(_0x3125d7){logger['error'](_0x3125d7[_0xdaf1('0x27')]);if(_0x3125d7[_0xdaf1('0x28')]){delete _0x3125d7['name'];}_0x997245[_0xdaf1('0x19')](_0x3c2166)[_0xdaf1('0x29')](_0x3125d7);};}exports[_0xdaf1('0x2a')]=function(_0x3892ae,_0x6731f6){var _0x16f6e0={'raw':!![],'where':{'id':_0x3892ae[_0xdaf1('0x2b')]['id']}},_0x520500={};_0x520500[_0xdaf1('0x2c')]=_['keys'](db['ChatApplication'][_0xdaf1('0x2d')]);_0x520500[_0xdaf1('0x2e')]=_[_0xdaf1('0x2f')](_0x3892ae['query']);_0x520500[_0xdaf1('0x30')]=_[_0xdaf1('0x31')](_0x520500[_0xdaf1('0x2c')],_0x520500[_0xdaf1('0x2e')]);_0x16f6e0[_0xdaf1('0x32')]=_['intersection'](_0x520500[_0xdaf1('0x2c')],qs[_0xdaf1('0x33')](_0x3892ae[_0xdaf1('0x2e')]['fields']));_0x16f6e0['attributes']=_0x16f6e0[_0xdaf1('0x32')]['length']?_0x16f6e0[_0xdaf1('0x32')]:_0x520500[_0xdaf1('0x2c')];if(_0x3892ae[_0xdaf1('0x2e')]['includeAll']){_0x16f6e0[_0xdaf1('0x34')]=[{'all':!![]}];}_0x16f6e0=_[_0xdaf1('0x35')]({},_0x16f6e0,_0x3892ae['options']);return db['ChatApplication'][_0xdaf1('0x36')](_0x16f6e0)[_0xdaf1('0x25')](handleEntityNotFound(_0x6731f6,null))['then'](respondWithResult(_0x6731f6,null))[_0xdaf1('0x37')](handleError(_0x6731f6,null));};exports[_0xdaf1('0x24')]=function(_0x318565,_0x57b9ca){if(_0x318565[_0xdaf1('0x38')]['id']){delete _0x318565[_0xdaf1('0x38')]['id'];}return db[_0xdaf1('0x39')][_0xdaf1('0x36')]({'where':{'id':_0x318565['params']['id']}})[_0xdaf1('0x25')](handleEntityNotFound(_0x57b9ca,null))[_0xdaf1('0x25')](saveUpdates(_0x318565[_0xdaf1('0x38')],null))[_0xdaf1('0x25')](respondWithResult(_0x57b9ca,null))[_0xdaf1('0x37')](handleError(_0x57b9ca,null));};exports['destroy']=function(_0x219551,_0x20dee8){return db[_0xdaf1('0x39')]['find']({'where':{'id':_0x219551[_0xdaf1('0x2b')]['id']}})['then'](handleEntityNotFound(_0x20dee8,null))[_0xdaf1('0x25')](removeEntity(_0x20dee8,null))[_0xdaf1('0x37')](handleError(_0x20dee8,null));}; \ No newline at end of file +var _0x6a24=['error','stack','name','send','show','params','model','keys','ChatApplication','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','crypto','jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy'];(function(_0x26addd,_0x255a1e){var _0x13a6b2=function(_0xb4d373){while(--_0xb4d373){_0x26addd['push'](_0x26addd['shift']());}};_0x13a6b2(++_0x255a1e);}(_0x6a24,0xd1));var _0x46a2=function(_0xe4fe77,_0xd8330e){_0xe4fe77=_0xe4fe77-0x0;var _0xeb8cd6=_0x6a24[_0xe4fe77];return _0xeb8cd6;};'use strict';var emlformat=require(_0x46a2('0x0'));var rimraf=require(_0x46a2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x46a2('0x2'));var rp=require(_0x46a2('0x3'));var moment=require(_0x46a2('0x4'));var BPromise=require(_0x46a2('0x5'));var Mustache=require(_0x46a2('0x6'));var util=require('util');var path=require(_0x46a2('0x7'));var sox=require(_0x46a2('0x8'));var csv=require('to-csv');var ejs=require(_0x46a2('0x9'));var fs=require('fs');var fs_extra=require(_0x46a2('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x46a2('0xb'));var jsforce=require(_0x46a2('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x46a2('0xd'));var querystring=require('querystring');var Papa=require(_0x46a2('0xe'));var Redis=require('ioredis');var authService=require(_0x46a2('0xf'));var qs=require(_0x46a2('0x10'));var as=require(_0x46a2('0x11'));var hardwareService=require(_0x46a2('0x12'));var logger=require(_0x46a2('0x13'))(_0x46a2('0x14'));var utils=require(_0x46a2('0x15'));var config=require(_0x46a2('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x403282,_0x18e584){_0x18e584=_0x18e584||0xcc;return function(_0x5c5d10){if(_0x5c5d10){return _0x403282[_0x46a2('0x17')](_0x18e584);}return _0x403282[_0x46a2('0x18')](_0x18e584)[_0x46a2('0x19')]();};}function respondWithResult(_0x18a038,_0xddc328){_0xddc328=_0xddc328||0xc8;return function(_0x2fd383){if(_0x2fd383){return _0x18a038[_0x46a2('0x18')](_0xddc328)[_0x46a2('0x1a')](_0x2fd383);}};}function respondWithFilteredResult(_0x577591,_0x4a7e7a){return function(_0x3c81e8){if(_0x3c81e8){var _0x2deb20=typeof _0x4a7e7a['offset']===_0x46a2('0x1b')&&typeof _0x4a7e7a[_0x46a2('0x1c')]==='undefined';var _0xa2eb96=_0x3c81e8[_0x46a2('0x1d')];var _0x577f18=_0x2deb20?0x0:_0x4a7e7a[_0x46a2('0x1e')];var _0x24f75f=_0x2deb20?_0x3c81e8['count']:_0x4a7e7a[_0x46a2('0x1e')]+_0x4a7e7a[_0x46a2('0x1c')];var _0x5144c7;if(_0x24f75f>=_0xa2eb96){_0x24f75f=_0xa2eb96;_0x5144c7=0xc8;}else{_0x5144c7=0xce;}_0x577591[_0x46a2('0x18')](_0x5144c7);return _0x577591[_0x46a2('0x1f')](_0x46a2('0x20'),_0x577f18+'-'+_0x24f75f+'/'+_0xa2eb96)[_0x46a2('0x1a')](_0x3c81e8);}return null;};}function patchUpdates(_0x202294){return function(_0x2d65c2){try{jsonpatch[_0x46a2('0x21')](_0x2d65c2,_0x202294,!![]);}catch(_0x473cfb){return BPromise[_0x46a2('0x22')](_0x473cfb);}return _0x2d65c2[_0x46a2('0x23')]();};}function saveUpdates(_0x5c7586,_0xa37d90){return function(_0x504b9e){if(_0x504b9e){return _0x504b9e[_0x46a2('0x24')](_0x5c7586)[_0x46a2('0x25')](function(_0x511ff6){return _0x511ff6;});}return null;};}function removeEntity(_0x43dc69,_0x15e5bb){return function(_0x233c4e){if(_0x233c4e){return _0x233c4e[_0x46a2('0x26')]()['then'](function(){_0x43dc69[_0x46a2('0x18')](0xcc)[_0x46a2('0x19')]();});}};}function handleEntityNotFound(_0x1e48f5,_0x297158){return function(_0x74bb6a){if(!_0x74bb6a){_0x1e48f5[_0x46a2('0x17')](0x194);}return _0x74bb6a;};}function handleError(_0x3e9554,_0xfa9e13){_0xfa9e13=_0xfa9e13||0x1f4;return function(_0x218f1c){logger[_0x46a2('0x27')](_0x218f1c[_0x46a2('0x28')]);if(_0x218f1c['name']){delete _0x218f1c[_0x46a2('0x29')];}_0x3e9554[_0x46a2('0x18')](_0xfa9e13)[_0x46a2('0x2a')](_0x218f1c);};}exports[_0x46a2('0x2b')]=function(_0x435155,_0x33f42a){var _0x577fd2={'raw':!![],'where':{'id':_0x435155[_0x46a2('0x2c')]['id']}},_0x185647={};_0x185647[_0x46a2('0x2d')]=_[_0x46a2('0x2e')](db[_0x46a2('0x2f')][_0x46a2('0x30')]);_0x185647[_0x46a2('0x31')]=_['keys'](_0x435155[_0x46a2('0x31')]);_0x185647[_0x46a2('0x32')]=_[_0x46a2('0x33')](_0x185647[_0x46a2('0x2d')],_0x185647[_0x46a2('0x31')]);_0x577fd2[_0x46a2('0x34')]=_[_0x46a2('0x33')](_0x185647[_0x46a2('0x2d')],qs[_0x46a2('0x35')](_0x435155['query'][_0x46a2('0x35')]));_0x577fd2[_0x46a2('0x34')]=_0x577fd2[_0x46a2('0x34')][_0x46a2('0x36')]?_0x577fd2[_0x46a2('0x34')]:_0x185647['model'];if(_0x435155['query'][_0x46a2('0x37')]){_0x577fd2[_0x46a2('0x38')]=[{'all':!![]}];}_0x577fd2=_[_0x46a2('0x39')]({},_0x577fd2,_0x435155[_0x46a2('0x3a')]);return db[_0x46a2('0x2f')][_0x46a2('0x3b')](_0x577fd2)['then'](handleEntityNotFound(_0x33f42a,null))['then'](respondWithResult(_0x33f42a,null))[_0x46a2('0x3c')](handleError(_0x33f42a,null));};exports['update']=function(_0x462374,_0x3fe076){if(_0x462374[_0x46a2('0x3d')]['id']){delete _0x462374[_0x46a2('0x3d')]['id'];}return db['ChatApplication'][_0x46a2('0x3b')]({'where':{'id':_0x462374[_0x46a2('0x2c')]['id']}})[_0x46a2('0x25')](handleEntityNotFound(_0x3fe076,null))[_0x46a2('0x25')](saveUpdates(_0x462374['body'],null))[_0x46a2('0x25')](respondWithResult(_0x3fe076,null))[_0x46a2('0x3c')](handleError(_0x3fe076,null));};exports[_0x46a2('0x26')]=function(_0x1cff82,_0x4fa161){return db[_0x46a2('0x2f')]['find']({'where':{'id':_0x1cff82[_0x46a2('0x2c')]['id']}})['then'](handleEntityNotFound(_0x4fa161,null))[_0x46a2('0x25')](removeEntity(_0x4fa161,null))[_0x46a2('0x3c')](handleError(_0x4fa161,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 394dcec..ce5fa92 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 _0x6db1=['ChatApplication','chat_applications','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','exports','define'];(function(_0x10a3b5,_0x195ca5){var _0x4c1604=function(_0x3e073c){while(--_0x3e073c){_0x10a3b5['push'](_0x10a3b5['shift']());}};_0x4c1604(++_0x195ca5);}(_0x6db1,0x13e));var _0x16db=function(_0x38d83c,_0x589bd0){_0x38d83c=_0x38d83c-0x0;var _0x38c3bb=_0x6db1[_0x38d83c];return _0x38c3bb;};'use strict';var _=require(_0x16db('0x0'));var util=require(_0x16db('0x1'));var logger=require(_0x16db('0x2'))(_0x16db('0x3'));var moment=require(_0x16db('0x4'));var BPromise=require(_0x16db('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x16db('0x6'));var rimraf=require(_0x16db('0x7'));var config=require(_0x16db('0x8'));var attributes=require(_0x16db('0x9'));module[_0x16db('0xa')]=function(_0x1cf88f,_0x38b8af){return _0x1cf88f[_0x16db('0xb')](_0x16db('0xc'),attributes,{'tableName':_0x16db('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x16db('0xe'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x67c7=['bluebird','request-promise','path','../../config/environment','./chatApplication.attributes','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment'];(function(_0x32290e,_0x1a0749){var _0x12762f=function(_0x2b1d2b){while(--_0x2b1d2b){_0x32290e['push'](_0x32290e['shift']());}};_0x12762f(++_0x1a0749);}(_0x67c7,0x172));var _0x767c=function(_0xa599e2,_0x3046be){_0xa599e2=_0xa599e2-0x0;var _0x122f49=_0x67c7[_0xa599e2];return _0x122f49;};'use strict';var _=require(_0x767c('0x0'));var util=require(_0x767c('0x1'));var logger=require(_0x767c('0x2'))(_0x767c('0x3'));var moment=require(_0x767c('0x4'));var BPromise=require(_0x767c('0x5'));var rp=require(_0x767c('0x6'));var fs=require('fs');var path=require(_0x767c('0x7'));var rimraf=require('rimraf');var config=require(_0x767c('0x8'));var attributes=require(_0x767c('0x9'));module['exports']=function(_0x116f27,_0xf3bf74){return _0x116f27[_0x767c('0xa')](_0x767c('0xb'),attributes,{'tableName':_0x767c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x767c('0xd'),'collate':_0x767c('0xe')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index dd597ec..b011bab 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 _0x65a4=['jayson/promise','client','http','request','then','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','error','ChatApplication,\x20%s,\x20%s','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0xacc326,_0x56bc9f){var _0x37143f=function(_0x12526a){while(--_0x12526a){_0xacc326['push'](_0xacc326['shift']());}};_0x37143f(++_0x56bc9f);}(_0x65a4,0xf4));var _0x465a=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x65a4[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x465a('0x0'));var util=require('util');var moment=require(_0x465a('0x1'));var BPromise=require(_0x465a('0x2'));var rs=require(_0x465a('0x3'));var fs=require('fs');var Redis=require(_0x465a('0x4'));var db=require(_0x465a('0x5'))['db'];var utils=require(_0x465a('0x6'));var logger=require('../../config/logger')(_0x465a('0x7'));var config=require('../../config/environment');var jayson=require(_0x465a('0x8'));var client=jayson[_0x465a('0x9')][_0x465a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x31cf34,_0x343dc6,_0x3706ff){return new BPromise(function(_0xfcfeaa,_0x48ce11){return client[_0x465a('0xb')](_0x31cf34,_0x3706ff)[_0x465a('0xc')](function(_0x1c9eb5){logger['info']('ChatApplication,\x20%s,\x20%s',_0x343dc6,_0x465a('0xd'));logger['debug'](_0x465a('0xe'),_0x343dc6,_0x465a('0xd'),JSON['stringify'](_0x1c9eb5));if(_0x1c9eb5[_0x465a('0xf')]){if(_0x1c9eb5[_0x465a('0xf')]['code']===0x1f4){logger[_0x465a('0xf')](_0x465a('0x10'),_0x343dc6,_0x1c9eb5[_0x465a('0xf')][_0x465a('0x11')]);return _0x48ce11(_0x1c9eb5[_0x465a('0xf')][_0x465a('0x11')]);}logger[_0x465a('0xf')](_0x465a('0x10'),_0x343dc6,_0x1c9eb5[_0x465a('0xf')][_0x465a('0x11')]);return _0xfcfeaa(_0x1c9eb5[_0x465a('0xf')][_0x465a('0x11')]);}else{logger[_0x465a('0x12')](_0x465a('0x10'),_0x343dc6,_0x465a('0xd'));_0xfcfeaa(_0x1c9eb5[_0x465a('0x13')]['message']);}})[_0x465a('0x14')](function(_0x3d80b4){logger[_0x465a('0xf')](_0x465a('0x10'),_0x343dc6,_0x3d80b4);_0x48ce11(_0x3d80b4);});});} \ No newline at end of file +var _0xb599=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x249935,_0x2c405d){var _0x305bb0=function(_0x4fe26f){while(--_0x4fe26f){_0x249935['push'](_0x249935['shift']());}};_0x305bb0(++_0x2c405d);}(_0xb599,0x6e));var _0x9b59=function(_0x2d1817,_0x10589e){_0x2d1817=_0x2d1817-0x0;var _0x130746=_0xb599[_0x2d1817];return _0x130746;};'use strict';var _=require('lodash');var util=require(_0x9b59('0x0'));var moment=require(_0x9b59('0x1'));var BPromise=require(_0x9b59('0x2'));var rs=require(_0x9b59('0x3'));var fs=require('fs');var Redis=require(_0x9b59('0x4'));var db=require(_0x9b59('0x5'))['db'];var utils=require(_0x9b59('0x6'));var logger=require(_0x9b59('0x7'))(_0x9b59('0x8'));var config=require(_0x9b59('0x9'));var jayson=require(_0x9b59('0xa'));var client=jayson[_0x9b59('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xef7f55,_0x170f99,_0x2b5c11){return new BPromise(function(_0x140b37,_0x499f73){return client['request'](_0xef7f55,_0x2b5c11)[_0x9b59('0xc')](function(_0xf5cd5f){logger[_0x9b59('0xd')](_0x9b59('0xe'),_0x170f99,_0x9b59('0xf'));logger['debug']('ChatApplication,\x20%s,\x20%s,\x20%s',_0x170f99,'request\x20sent',JSON[_0x9b59('0x10')](_0xf5cd5f));if(_0xf5cd5f[_0x9b59('0x11')]){if(_0xf5cd5f[_0x9b59('0x11')][_0x9b59('0x12')]===0x1f4){logger[_0x9b59('0x11')](_0x9b59('0xe'),_0x170f99,_0xf5cd5f[_0x9b59('0x11')][_0x9b59('0x13')]);return _0x499f73(_0xf5cd5f['error'][_0x9b59('0x13')]);}logger[_0x9b59('0x11')](_0x9b59('0xe'),_0x170f99,_0xf5cd5f[_0x9b59('0x11')]['message']);return _0x140b37(_0xf5cd5f['error']['message']);}else{logger[_0x9b59('0xd')](_0x9b59('0xe'),_0x170f99,_0x9b59('0xf'));_0x140b37(_0xf5cd5f[_0x9b59('0x14')][_0x9b59('0x13')]);}})[_0x9b59('0x15')](function(_0x31700a){logger['error'](_0x9b59('0xe'),_0x170f99,_0x31700a);_0x499f73(_0x31700a);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 1818210..ff8209f 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 _0x8514=['destroy','exports','multer','util','path','express','Router','../../config/environment','./chatApplication.controller','get','isAuthenticated','put','/:id','delete'];(function(_0x196c4e,_0xb8263e){var _0x1fabb6=function(_0x35ba45){while(--_0x35ba45){_0x196c4e['push'](_0x196c4e['shift']());}};_0x1fabb6(++_0xb8263e);}(_0x8514,0x1a6));var _0x4851=function(_0x48afc5,_0x16647a){_0x48afc5=_0x48afc5-0x0;var _0x14a9b1=_0x8514[_0x48afc5];return _0x14a9b1;};'use strict';var multer=require(_0x4851('0x0'));var util=require(_0x4851('0x1'));var path=require(_0x4851('0x2'));var timeout=require('connect-timeout');var express=require(_0x4851('0x3'));var router=express[_0x4851('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4851('0x5'));var controller=require(_0x4851('0x6'));router[_0x4851('0x7')]('/:id',auth[_0x4851('0x8')](),controller['show']);router[_0x4851('0x9')](_0x4851('0xa'),auth[_0x4851('0x8')](),controller['update']);router[_0x4851('0xb')]('/:id',auth[_0x4851('0x8')](),controller[_0x4851('0xc')]);module[_0x4851('0xd')]=router; \ No newline at end of file +var _0x95f7=['../../components/auth/service','../../components/interaction/service','./chatApplication.controller','get','/:id','isAuthenticated','show','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x5825be,_0x1c8318){var _0x5b7559=function(_0x115086){while(--_0x115086){_0x5825be['push'](_0x5825be['shift']());}};_0x5b7559(++_0x1c8318);}(_0x95f7,0x1a2));var _0x795f=function(_0x7e1895,_0x11758a){_0x7e1895=_0x7e1895-0x0;var _0x5b5320=_0x95f7[_0x7e1895];return _0x5b5320;};'use strict';var multer=require(_0x795f('0x0'));var util=require(_0x795f('0x1'));var path=require(_0x795f('0x2'));var timeout=require(_0x795f('0x3'));var express=require(_0x795f('0x4'));var router=express[_0x795f('0x5')]();var fs_extra=require(_0x795f('0x6'));var auth=require(_0x795f('0x7'));var interaction=require(_0x795f('0x8'));var config=require('../../config/environment');var controller=require(_0x795f('0x9'));router[_0x795f('0xa')](_0x795f('0xb'),auth[_0x795f('0xc')](),controller[_0x795f('0xd')]);router['put'](_0x795f('0xb'),auth[_0x795f('0xc')](),controller[_0x795f('0xe')]);router[_0x795f('0xf')](_0x795f('0xb'),auth[_0x795f('0xc')](),controller[_0x795f('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index f3ee131..b5c9881 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 _0xfaee=['BOOLEAN','sequelize','exports','STRING'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0xfaee,0x15d));var _0xefae=function(_0x53cc66,_0x5162fc){_0x53cc66=_0x53cc66-0x0;var _0x6effae=_0xfaee[_0x53cc66];return _0x6effae;};'use strict';var Sequelize=require(_0xefae('0x0'));module[_0xefae('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xefae('0x2')]},'write':{'type':Sequelize[_0xefae('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x0018=['STRING','BOOLEAN','sequelize','exports'];(function(_0x4e3c21,_0x286f50){var _0x50250d=function(_0x401f37){while(--_0x401f37){_0x4e3c21['push'](_0x4e3c21['shift']());}};_0x50250d(++_0x286f50);}(_0x0018,0x1aa));var _0x8001=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x0018[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0x8001('0x0'));module[_0x8001('0x1')]={'name':{'type':Sequelize[_0x8001('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x8001('0x2')]},'write':{'type':Sequelize[_0x8001('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 31a94b6..ecde9af 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 _0x53ec=['catch','body','params','describe','ChatInternalMessage','user','addMembers','ids','omit','findOne','User','rawAttributes','order','options','getMembers','nolimit','removeMembers','addMessage','ChatGroupId','create','getMessages','$gte','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','name','send','ChatGroup','fieldName','type','key','map','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','sort','filters','pick','filter','where','VIRTUAL','merge','includeAll','include','rows','show','find'];(function(_0x1b6546,_0x4d8b88){var _0x365e23=function(_0x480707){while(--_0x480707){_0x1b6546['push'](_0x1b6546['shift']());}};_0x365e23(++_0x4d8b88);}(_0x53ec,0x147));var _0xc53e=function(_0x2577d9,_0x8f2f28){_0x2577d9=_0x2577d9-0x0;var _0x36fe58=_0x53ec[_0x2577d9];return _0x36fe58;};'use strict';var emlformat=require(_0xc53e('0x0'));var rimraf=require(_0xc53e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc53e('0x2'));var rp=require(_0xc53e('0x3'));var moment=require('moment');var BPromise=require(_0xc53e('0x4'));var Mustache=require(_0xc53e('0x5'));var util=require(_0xc53e('0x6'));var path=require(_0xc53e('0x7'));var sox=require(_0xc53e('0x8'));var csv=require(_0xc53e('0x9'));var ejs=require(_0xc53e('0xa'));var fs=require('fs');var fs_extra=require(_0xc53e('0xb'));var _=require(_0xc53e('0xc'));var squel=require(_0xc53e('0xd'));var crypto=require(_0xc53e('0xe'));var jsforce=require(_0xc53e('0xf'));var deskjs=require(_0xc53e('0x10'));var toCsv=require(_0xc53e('0x9'));var querystring=require(_0xc53e('0x11'));var Papa=require(_0xc53e('0x12'));var Redis=require(_0xc53e('0x13'));var authService=require(_0xc53e('0x14'));var qs=require(_0xc53e('0x15'));var as=require(_0xc53e('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc53e('0x17'))(_0xc53e('0x18'));var utils=require(_0xc53e('0x19'));var config=require(_0xc53e('0x1a'));var licenseUtil=require(_0xc53e('0x1b'));var db=require(_0xc53e('0x1c'))['db'];config[_0xc53e('0x1d')]=_['defaults'](config[_0xc53e('0x1d')],{'host':_0xc53e('0x1e'),'port':0x18eb});var socket=require(_0xc53e('0x1f'))(new Redis(config['redis']));require(_0xc53e('0x20'))[_0xc53e('0x21')](socket);function respondWithStatusCode(_0x3003c9,_0x200bec){_0x200bec=_0x200bec||0xcc;return function(_0x10a1f7){if(_0x10a1f7){return _0x3003c9[_0xc53e('0x22')](_0x200bec);}return _0x3003c9[_0xc53e('0x23')](_0x200bec)[_0xc53e('0x24')]();};}function respondWithResult(_0x212f1a,_0xf0ec5e){_0xf0ec5e=_0xf0ec5e||0xc8;return function(_0x3a46b9){if(_0x3a46b9){return _0x212f1a[_0xc53e('0x23')](_0xf0ec5e)[_0xc53e('0x25')](_0x3a46b9);}};}function respondWithFilteredResult(_0x31c675,_0x424f5f){return function(_0x376c7f){if(_0x376c7f){var _0x391876=typeof _0x424f5f[_0xc53e('0x26')]===_0xc53e('0x27')&&typeof _0x424f5f[_0xc53e('0x28')]===_0xc53e('0x27');var _0x3e3904=_0x376c7f[_0xc53e('0x29')];var _0x45ac06=_0x391876?0x0:_0x424f5f[_0xc53e('0x26')];var _0x4ec45a=_0x391876?_0x376c7f['count']:_0x424f5f[_0xc53e('0x26')]+_0x424f5f['limit'];var _0x4d3e7a;if(_0x4ec45a>=_0x3e3904){_0x4ec45a=_0x3e3904;_0x4d3e7a=0xc8;}else{_0x4d3e7a=0xce;}_0x31c675['status'](_0x4d3e7a);return _0x31c675[_0xc53e('0x2a')](_0xc53e('0x2b'),_0x45ac06+'-'+_0x4ec45a+'/'+_0x3e3904)[_0xc53e('0x25')](_0x376c7f);}return null;};}function patchUpdates(_0xcbe7a6){return function(_0x241415){try{jsonpatch[_0xc53e('0x2c')](_0x241415,_0xcbe7a6,!![]);}catch(_0x144878){return BPromise[_0xc53e('0x2d')](_0x144878);}return _0x241415['save']();};}function saveUpdates(_0x499a87,_0x5714d6){return function(_0x5716a9){if(_0x5716a9){return _0x5716a9[_0xc53e('0x2e')](_0x499a87)[_0xc53e('0x2f')](function(_0x174d69){return _0x174d69;});}return null;};}function removeEntity(_0x8fa090,_0x269369){return function(_0x389bee){if(_0x389bee){return _0x389bee[_0xc53e('0x30')]()[_0xc53e('0x2f')](function(){_0x8fa090[_0xc53e('0x23')](0xcc)[_0xc53e('0x24')]();});}};}function handleEntityNotFound(_0xa1906a,_0x3a0f25){return function(_0x2c4d3e){if(!_0x2c4d3e){_0xa1906a[_0xc53e('0x22')](0x194);}return _0x2c4d3e;};}function handleError(_0xcbc1c2,_0x3768a5){_0x3768a5=_0x3768a5||0x1f4;return function(_0x58c9e9){logger[_0xc53e('0x31')](_0x58c9e9['stack']);if(_0x58c9e9[_0xc53e('0x32')]){delete _0x58c9e9[_0xc53e('0x32')];}_0xcbc1c2[_0xc53e('0x23')](_0x3768a5)[_0xc53e('0x33')](_0x58c9e9);};}exports['index']=function(_0x4ad03a,_0x2a9408){var _0xc2e202={},_0x53c3d0={},_0x5cf0aa={'count':0x0,'rows':[]};var _0x526c73=_['map'](db[_0xc53e('0x34')]['rawAttributes'],function(_0x17add7){return{'name':_0x17add7[_0xc53e('0x35')],'type':_0x17add7[_0xc53e('0x36')][_0xc53e('0x37')]};});_0x53c3d0['model']=_[_0xc53e('0x38')](_0x526c73,_0xc53e('0x32'));_0x53c3d0[_0xc53e('0x39')]=_[_0xc53e('0x3a')](_0x4ad03a[_0xc53e('0x39')]);_0x53c3d0['filters']=_['intersection'](_0x53c3d0[_0xc53e('0x3b')],_0x53c3d0[_0xc53e('0x39')]);_0xc2e202[_0xc53e('0x3c')]=_[_0xc53e('0x3d')](_0x53c3d0[_0xc53e('0x3b')],qs[_0xc53e('0x3e')](_0x4ad03a['query'][_0xc53e('0x3e')]));_0xc2e202['attributes']=_0xc2e202[_0xc53e('0x3c')][_0xc53e('0x3f')]?_0xc2e202[_0xc53e('0x3c')]:_0x53c3d0['model'];if(!_0x4ad03a['query'][_0xc53e('0x40')]('nolimit')){_0xc2e202[_0xc53e('0x28')]=qs[_0xc53e('0x28')](_0x4ad03a['query'][_0xc53e('0x28')]);_0xc2e202[_0xc53e('0x26')]=qs[_0xc53e('0x26')](_0x4ad03a[_0xc53e('0x39')][_0xc53e('0x26')]);}_0xc2e202['order']=qs[_0xc53e('0x41')](_0x4ad03a[_0xc53e('0x39')]['sort']);_0xc2e202['where']=qs[_0xc53e('0x42')](_[_0xc53e('0x43')](_0x4ad03a[_0xc53e('0x39')],_0x53c3d0['filters']),_0x526c73);if(_0x4ad03a[_0xc53e('0x39')][_0xc53e('0x44')]){_0xc2e202[_0xc53e('0x45')]=_['merge'](_0xc2e202['where'],{'$or':_[_0xc53e('0x38')](_0x526c73,function(_0x2c0f36){if(_0x2c0f36['type']!==_0xc53e('0x46')){var _0x19fae9={};_0x19fae9[_0x2c0f36[_0xc53e('0x32')]]={'$like':'%'+_0x4ad03a[_0xc53e('0x39')]['filter']+'%'};return _0x19fae9;}})});}_0xc2e202=_[_0xc53e('0x47')]({},_0xc2e202,_0x4ad03a['options']);var _0x341fec={'where':_0xc2e202[_0xc53e('0x45')]};return db[_0xc53e('0x34')][_0xc53e('0x29')](_0x341fec)[_0xc53e('0x2f')](function(_0x513d7d){_0x5cf0aa[_0xc53e('0x29')]=_0x513d7d;if(_0x4ad03a[_0xc53e('0x39')][_0xc53e('0x48')]){_0xc2e202[_0xc53e('0x49')]=[{'all':!![]}];}return db[_0xc53e('0x34')]['findAll'](_0xc2e202);})[_0xc53e('0x2f')](function(_0x3154a6){_0x5cf0aa[_0xc53e('0x4a')]=_0x3154a6;return _0x5cf0aa;})[_0xc53e('0x2f')](respondWithFilteredResult(_0x2a9408,_0xc2e202))['catch'](handleError(_0x2a9408,null));};exports[_0xc53e('0x4b')]=function(_0x332a76,_0xa167f9){var _0x1b3cc4={'raw':!![],'where':{'id':_0x332a76['params']['id']}},_0x59333e={};_0x59333e[_0xc53e('0x3b')]=_['keys'](db[_0xc53e('0x34')]['rawAttributes']);_0x59333e[_0xc53e('0x39')]=_['keys'](_0x332a76['query']);_0x59333e[_0xc53e('0x42')]=_[_0xc53e('0x3d')](_0x59333e[_0xc53e('0x3b')],_0x59333e[_0xc53e('0x39')]);_0x1b3cc4['attributes']=_[_0xc53e('0x3d')](_0x59333e['model'],qs[_0xc53e('0x3e')](_0x332a76['query'][_0xc53e('0x3e')]));_0x1b3cc4[_0xc53e('0x3c')]=_0x1b3cc4[_0xc53e('0x3c')][_0xc53e('0x3f')]?_0x1b3cc4[_0xc53e('0x3c')]:_0x59333e[_0xc53e('0x3b')];if(_0x332a76['query']['includeAll']){_0x1b3cc4[_0xc53e('0x49')]=[{'all':!![]}];}_0x1b3cc4=_[_0xc53e('0x47')]({},_0x1b3cc4,_0x332a76['options']);return db[_0xc53e('0x34')][_0xc53e('0x4c')](_0x1b3cc4)[_0xc53e('0x2f')](handleEntityNotFound(_0xa167f9,null))[_0xc53e('0x2f')](respondWithResult(_0xa167f9,null))[_0xc53e('0x4d')](handleError(_0xa167f9,null));};exports['create']=function(_0x4fb84a,_0x3ce123){return db[_0xc53e('0x34')]['create'](_0x4fb84a[_0xc53e('0x4e')],{})[_0xc53e('0x2f')](respondWithResult(_0x3ce123,0xc9))[_0xc53e('0x4d')](handleError(_0x3ce123,null));};exports[_0xc53e('0x2e')]=function(_0xdcb289,_0x86b286){if(_0xdcb289['body']['id']){delete _0xdcb289[_0xc53e('0x4e')]['id'];}return db[_0xc53e('0x34')][_0xc53e('0x4c')]({'where':{'id':_0xdcb289[_0xc53e('0x4f')]['id']}})['then'](handleEntityNotFound(_0x86b286,null))['then'](saveUpdates(_0xdcb289[_0xc53e('0x4e')],null))[_0xc53e('0x2f')](respondWithResult(_0x86b286,null))[_0xc53e('0x4d')](handleError(_0x86b286,null));};exports['destroy']=function(_0x37951c,_0x43f827){return db[_0xc53e('0x34')]['find']({'where':{'id':_0x37951c['params']['id']}})[_0xc53e('0x2f')](handleEntityNotFound(_0x43f827,null))[_0xc53e('0x2f')](removeEntity(_0x43f827,null))[_0xc53e('0x4d')](handleError(_0x43f827,null));};exports[_0xc53e('0x50')]=function(_0x1892f6,_0x36c7d5){return db['ChatGroup'][_0xc53e('0x50')]()[_0xc53e('0x2f')](respondWithResult(_0x36c7d5,null))['catch'](handleError(_0x36c7d5,null));};exports['getUnread']=function(_0x2bcc0c,_0x28c826,_0x2b8e80){return db[_0xc53e('0x51')][_0xc53e('0x29')]({'where':{'ChatGroupId':_0x2bcc0c[_0xc53e('0x4f')]['id'],'ToId':_0x2bcc0c[_0xc53e('0x52')]['id'],'read':![]}})['then'](function(_0x71a06a){return{'id':_['toInteger'](_0x2bcc0c[_0xc53e('0x4f')]['id']),'count':_0x71a06a};})['then'](respondWithResult(_0x28c826,null))[_0xc53e('0x4d')](handleError(_0x28c826,null));};exports[_0xc53e('0x53')]=function(_0x27f297,_0x2b5a89,_0x4a9692){return db[_0xc53e('0x34')]['find']({'where':{'id':_0x27f297[_0xc53e('0x4f')]['id']}})['then'](handleEntityNotFound(_0x2b5a89,null))[_0xc53e('0x2f')](function(_0x2cc666){if(_0x2cc666){return _0x2cc666['addMembers'](_0x27f297[_0xc53e('0x4e')][_0xc53e('0x54')],_[_0xc53e('0x55')](_0x27f297[_0xc53e('0x4e')],['ids','id'])||{});}})[_0xc53e('0x2f')](respondWithResult(_0x2b5a89,null))['catch'](handleError(_0x2b5a89,null));};exports['getMembers']=function(_0x3a34a3,_0x5107bd,_0x45479c){var _0x4c42d5={};var _0xb4c23e={};var _0x465ea7;var _0x21f726;return db[_0xc53e('0x34')][_0xc53e('0x56')]({'where':{'id':_0x3a34a3[_0xc53e('0x4f')]['id']}})['then'](handleEntityNotFound(_0x5107bd,null))[_0xc53e('0x2f')](function(_0x15725a){if(_0x15725a){_0x465ea7=_0x15725a;_0xb4c23e[_0xc53e('0x3b')]=_[_0xc53e('0x3a')](db[_0xc53e('0x57')][_0xc53e('0x58')]);_0xb4c23e[_0xc53e('0x39')]=_['keys'](_0x3a34a3['query']);_0xb4c23e['filters']=_[_0xc53e('0x3d')](_0xb4c23e[_0xc53e('0x3b')],_0xb4c23e[_0xc53e('0x39')]);_0x4c42d5[_0xc53e('0x3c')]=_[_0xc53e('0x3d')](_0xb4c23e['model'],qs[_0xc53e('0x3e')](_0x3a34a3[_0xc53e('0x39')][_0xc53e('0x3e')]));_0x4c42d5[_0xc53e('0x3c')]=_0x4c42d5[_0xc53e('0x3c')]['length']?_0x4c42d5['attributes']:_0xb4c23e[_0xc53e('0x3b')];_0x4c42d5[_0xc53e('0x59')]=qs['sort'](_0x3a34a3['query'][_0xc53e('0x41')]);_0x4c42d5[_0xc53e('0x45')]=qs['filters'](_[_0xc53e('0x43')](_0x3a34a3[_0xc53e('0x39')],_0xb4c23e[_0xc53e('0x42')]));if(_0x3a34a3[_0xc53e('0x39')]['filter']){_0x4c42d5['where']=_[_0xc53e('0x47')](_0x4c42d5[_0xc53e('0x45')],{'$or':_[_0xc53e('0x38')](_0x4c42d5['attributes'],function(_0x25fb94){var _0x297f12={};_0x297f12[_0x25fb94]={'$like':'%'+_0x3a34a3[_0xc53e('0x39')][_0xc53e('0x44')]+'%'};return _0x297f12;})});}_0x4c42d5=_[_0xc53e('0x47')]({},_0x4c42d5,_0x3a34a3[_0xc53e('0x5a')]);return _0x465ea7[_0xc53e('0x5b')](_0x4c42d5);}})[_0xc53e('0x2f')](function(_0x19169a){if(_0x19169a){_0x21f726=_0x19169a[_0xc53e('0x3f')];if(!_0x3a34a3['query'][_0xc53e('0x40')](_0xc53e('0x5c'))){_0x4c42d5[_0xc53e('0x28')]=qs['limit'](_0x3a34a3[_0xc53e('0x39')]['limit']);_0x4c42d5[_0xc53e('0x26')]=qs[_0xc53e('0x26')](_0x3a34a3[_0xc53e('0x39')][_0xc53e('0x26')]);}return _0x465ea7[_0xc53e('0x5b')](_0x4c42d5);}})[_0xc53e('0x2f')](function(_0x285705){if(_0x285705){return _0x285705?{'count':_0x21f726,'rows':_0x285705}:null;}})[_0xc53e('0x2f')](respondWithResult(_0x5107bd,null))[_0xc53e('0x4d')](handleError(_0x5107bd,null));};exports[_0xc53e('0x5d')]=function(_0xee7c16,_0x4bf468,_0x1a000f){return db[_0xc53e('0x34')][_0xc53e('0x4c')]({'where':{'id':_0xee7c16[_0xc53e('0x4f')]['id']}})[_0xc53e('0x2f')](handleEntityNotFound(_0x4bf468,null))[_0xc53e('0x2f')](function(_0x3e9599){if(_0x3e9599){return _0x3e9599[_0xc53e('0x5d')](_0xee7c16[_0xc53e('0x39')][_0xc53e('0x54')]);}})[_0xc53e('0x2f')](respondWithStatusCode(_0x4bf468,null))[_0xc53e('0x4d')](handleError(_0x4bf468,null));};exports[_0xc53e('0x5e')]=function(_0x6d3960,_0x33e708,_0x4d224f){if(_0x6d3960[_0xc53e('0x4e')]['id']){delete _0x6d3960[_0xc53e('0x4e')]['id'];}return db[_0xc53e('0x34')]['find']({'where':{'id':_0x6d3960[_0xc53e('0x4f')]['id']}})['then'](handleEntityNotFound(_0x33e708,null))[_0xc53e('0x2f')](function(_0x4f72f8){if(_0x4f72f8){_0x6d3960[_0xc53e('0x4e')][_0xc53e('0x5f')]=_0x4f72f8['id'];return db[_0xc53e('0x51')][_0xc53e('0x60')](_0x6d3960[_0xc53e('0x4e')]);}})['then'](respondWithResult(_0x33e708,null))[_0xc53e('0x4d')](handleError(_0x33e708,null));};exports[_0xc53e('0x61')]=function(_0x3f38e1,_0x15a33c,_0x5941c0){var _0x32a9e9={};var _0x7edffd={};var _0x5c5db8;var _0x290017;return db[_0xc53e('0x34')][_0xc53e('0x56')]({'where':{'id':_0x3f38e1[_0xc53e('0x4f')]['id']}})[_0xc53e('0x2f')](handleEntityNotFound(_0x15a33c,null))[_0xc53e('0x2f')](function(_0x281d20){if(_0x281d20){_0x5c5db8=_0x281d20;_0x7edffd[_0xc53e('0x3b')]=_[_0xc53e('0x3a')](db[_0xc53e('0x51')][_0xc53e('0x58')]);_0x7edffd[_0xc53e('0x39')]=_[_0xc53e('0x3a')](_0x3f38e1[_0xc53e('0x39')]);_0x7edffd[_0xc53e('0x42')]=_[_0xc53e('0x3d')](_0x7edffd['model'],_0x7edffd[_0xc53e('0x39')]);_0x32a9e9['attributes']=_[_0xc53e('0x3d')](_0x7edffd['model'],qs[_0xc53e('0x3e')](_0x3f38e1[_0xc53e('0x39')][_0xc53e('0x3e')]));_0x32a9e9[_0xc53e('0x3c')]=_0x32a9e9[_0xc53e('0x3c')][_0xc53e('0x3f')]?_0x32a9e9['attributes']:_0x7edffd[_0xc53e('0x3b')];_0x32a9e9[_0xc53e('0x59')]=qs[_0xc53e('0x41')](_0x3f38e1['query'][_0xc53e('0x41')]);_0x32a9e9['where']=qs['filters'](_['pick'](_0x3f38e1['query'],_0x7edffd[_0xc53e('0x42')]));if(_0x3f38e1['query'][_0xc53e('0x44')]){_0x32a9e9[_0xc53e('0x45')]=_[_0xc53e('0x47')](_0x32a9e9[_0xc53e('0x45')],{'$or':_[_0xc53e('0x38')](_0x32a9e9[_0xc53e('0x3c')],function(_0x3028de){var _0x4e4743={};_0x4e4743[_0x3028de]={'$like':'%'+_0x3f38e1['query'][_0xc53e('0x44')]+'%'};return _0x4e4743;})});}if(_0x3f38e1[_0xc53e('0x39')][_0xc53e('0x62')]){var _0x5166ac=_0x3f38e1[_0xc53e('0x39')][_0xc53e('0x62')]['split'](',');var _0x242782={};_0x242782[_0x5166ac[0x0]]={'$gte':moment(_0x5166ac[0x1])[_0xc53e('0x63')](_0xc53e('0x64'))};_0x32a9e9[_0xc53e('0x45')]=_['merge'](_0x32a9e9[_0xc53e('0x45')],_0x242782);}_0x32a9e9=_[_0xc53e('0x47')]({},_0x32a9e9,_0x3f38e1[_0xc53e('0x5a')]);return _0x5c5db8[_0xc53e('0x61')](_0x32a9e9);}})[_0xc53e('0x2f')](function(_0x465623){if(_0x465623){_0x290017=_0x465623[_0xc53e('0x3f')];if(!_0x3f38e1['query'][_0xc53e('0x40')](_0xc53e('0x5c'))){_0x32a9e9['limit']=qs[_0xc53e('0x28')](_0x3f38e1['query'][_0xc53e('0x28')]);_0x32a9e9[_0xc53e('0x26')]=qs[_0xc53e('0x26')](_0x3f38e1[_0xc53e('0x39')][_0xc53e('0x26')]);}return _0x5c5db8[_0xc53e('0x61')](_0x32a9e9);}})['then'](function(_0x103920){if(_0x103920){return _0x103920?{'count':_0x290017,'rows':_0x103920}:null;}})['then'](respondWithResult(_0x15a33c,null))[_0xc53e('0x4d')](handleError(_0x15a33c,null));}; \ No newline at end of file +var _0x1a2e=['addMembers','omit','getMembers','findOne','User','pick','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./chatGroup.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','then','error','stack','name','send','index','map','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','includeAll','include','ChatGroup','findAll','rows','show','rawAttributes','find','create','catch','body','params','destroy','getUnread','ChatInternalMessage','user','toInteger'];(function(_0x4634ac,_0x540b17){var _0x34baf5=function(_0x4c7a22){while(--_0x4c7a22){_0x4634ac['push'](_0x4634ac['shift']());}};_0x34baf5(++_0x540b17);}(_0x1a2e,0x19e));var _0xe1a2=function(_0x22f373,_0xfe4768){_0x22f373=_0x22f373-0x0;var _0x1da590=_0x1a2e[_0x22f373];return _0x1da590;};'use strict';var emlformat=require(_0xe1a2('0x0'));var rimraf=require(_0xe1a2('0x1'));var zipdir=require(_0xe1a2('0x2'));var jsonpatch=require(_0xe1a2('0x3'));var rp=require(_0xe1a2('0x4'));var moment=require(_0xe1a2('0x5'));var BPromise=require(_0xe1a2('0x6'));var Mustache=require(_0xe1a2('0x7'));var util=require('util');var path=require('path');var sox=require(_0xe1a2('0x8'));var csv=require(_0xe1a2('0x9'));var ejs=require(_0xe1a2('0xa'));var fs=require('fs');var fs_extra=require(_0xe1a2('0xb'));var _=require(_0xe1a2('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe1a2('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe1a2('0xe'));var Papa=require('papaparse');var Redis=require(_0xe1a2('0xf'));var authService=require(_0xe1a2('0x10'));var qs=require(_0xe1a2('0x11'));var as=require(_0xe1a2('0x12'));var hardwareService=require(_0xe1a2('0x13'));var logger=require(_0xe1a2('0x14'))(_0xe1a2('0x15'));var utils=require(_0xe1a2('0x16'));var config=require(_0xe1a2('0x17'));var licenseUtil=require(_0xe1a2('0x18'));var db=require('../../mysqldb')['db'];config[_0xe1a2('0x19')]=_[_0xe1a2('0x1a')](config[_0xe1a2('0x19')],{'host':_0xe1a2('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe1a2('0x19')]));require(_0xe1a2('0x1c'))[_0xe1a2('0x1d')](socket);function respondWithStatusCode(_0x5ac147,_0x4cf4d1){_0x4cf4d1=_0x4cf4d1||0xcc;return function(_0x499cd9){if(_0x499cd9){return _0x5ac147[_0xe1a2('0x1e')](_0x4cf4d1);}return _0x5ac147[_0xe1a2('0x1f')](_0x4cf4d1)[_0xe1a2('0x20')]();};}function respondWithResult(_0x19f642,_0x33a5cf){_0x33a5cf=_0x33a5cf||0xc8;return function(_0xd1cc51){if(_0xd1cc51){return _0x19f642[_0xe1a2('0x1f')](_0x33a5cf)['json'](_0xd1cc51);}};}function respondWithFilteredResult(_0x4fb369,_0xbf5ff4){return function(_0x340853){if(_0x340853){var _0x21d42b=typeof _0xbf5ff4[_0xe1a2('0x21')]===_0xe1a2('0x22')&&typeof _0xbf5ff4[_0xe1a2('0x23')]===_0xe1a2('0x22');var _0x20ea68=_0x340853['count'];var _0x2c7f23=_0x21d42b?0x0:_0xbf5ff4[_0xe1a2('0x21')];var _0x496027=_0x21d42b?_0x340853[_0xe1a2('0x24')]:_0xbf5ff4[_0xe1a2('0x21')]+_0xbf5ff4[_0xe1a2('0x23')];var _0x34ae71;if(_0x496027>=_0x20ea68){_0x496027=_0x20ea68;_0x34ae71=0xc8;}else{_0x34ae71=0xce;}_0x4fb369['status'](_0x34ae71);return _0x4fb369[_0xe1a2('0x25')]('Content-Range',_0x2c7f23+'-'+_0x496027+'/'+_0x20ea68)[_0xe1a2('0x26')](_0x340853);}return null;};}function patchUpdates(_0x54e300){return function(_0xb20dcc){try{jsonpatch[_0xe1a2('0x27')](_0xb20dcc,_0x54e300,!![]);}catch(_0x1c679b){return BPromise[_0xe1a2('0x28')](_0x1c679b);}return _0xb20dcc[_0xe1a2('0x29')]();};}function saveUpdates(_0x5e7ee6,_0x53addc){return function(_0x560fa1){if(_0x560fa1){return _0x560fa1[_0xe1a2('0x2a')](_0x5e7ee6)[_0xe1a2('0x2b')](function(_0x23431b){return _0x23431b;});}return null;};}function removeEntity(_0x130f21,_0x17a2f6){return function(_0x1d7608){if(_0x1d7608){return _0x1d7608['destroy']()['then'](function(){_0x130f21[_0xe1a2('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x53fdb6,_0x2034ed){return function(_0x5922b7){if(!_0x5922b7){_0x53fdb6[_0xe1a2('0x1e')](0x194);}return _0x5922b7;};}function handleError(_0x13f410,_0x146a25){_0x146a25=_0x146a25||0x1f4;return function(_0xb14844){logger[_0xe1a2('0x2c')](_0xb14844[_0xe1a2('0x2d')]);if(_0xb14844[_0xe1a2('0x2e')]){delete _0xb14844[_0xe1a2('0x2e')];}_0x13f410[_0xe1a2('0x1f')](_0x146a25)[_0xe1a2('0x2f')](_0xb14844);};}exports[_0xe1a2('0x30')]=function(_0x47b86a,_0x2b0385){var _0x5601ff={},_0x393cbb={},_0x30998d={'count':0x0,'rows':[]};var _0x18403e=_[_0xe1a2('0x31')](db['ChatGroup']['rawAttributes'],function(_0x1d7b03){return{'name':_0x1d7b03[_0xe1a2('0x32')],'type':_0x1d7b03[_0xe1a2('0x33')][_0xe1a2('0x34')]};});_0x393cbb['model']=_[_0xe1a2('0x31')](_0x18403e,_0xe1a2('0x2e'));_0x393cbb[_0xe1a2('0x35')]=_[_0xe1a2('0x36')](_0x47b86a['query']);_0x393cbb[_0xe1a2('0x37')]=_['intersection'](_0x393cbb[_0xe1a2('0x38')],_0x393cbb[_0xe1a2('0x35')]);_0x5601ff[_0xe1a2('0x39')]=_[_0xe1a2('0x3a')](_0x393cbb[_0xe1a2('0x38')],qs[_0xe1a2('0x3b')](_0x47b86a[_0xe1a2('0x35')][_0xe1a2('0x3b')]));_0x5601ff[_0xe1a2('0x39')]=_0x5601ff[_0xe1a2('0x39')][_0xe1a2('0x3c')]?_0x5601ff[_0xe1a2('0x39')]:_0x393cbb[_0xe1a2('0x38')];if(!_0x47b86a[_0xe1a2('0x35')][_0xe1a2('0x3d')](_0xe1a2('0x3e'))){_0x5601ff[_0xe1a2('0x23')]=qs[_0xe1a2('0x23')](_0x47b86a[_0xe1a2('0x35')]['limit']);_0x5601ff['offset']=qs[_0xe1a2('0x21')](_0x47b86a[_0xe1a2('0x35')][_0xe1a2('0x21')]);}_0x5601ff[_0xe1a2('0x3f')]=qs[_0xe1a2('0x40')](_0x47b86a[_0xe1a2('0x35')][_0xe1a2('0x40')]);_0x5601ff['where']=qs[_0xe1a2('0x37')](_['pick'](_0x47b86a[_0xe1a2('0x35')],_0x393cbb[_0xe1a2('0x37')]),_0x18403e);if(_0x47b86a[_0xe1a2('0x35')][_0xe1a2('0x41')]){_0x5601ff[_0xe1a2('0x42')]=_[_0xe1a2('0x43')](_0x5601ff[_0xe1a2('0x42')],{'$or':_[_0xe1a2('0x31')](_0x18403e,function(_0x2b0f0f){if(_0x2b0f0f[_0xe1a2('0x33')]!=='VIRTUAL'){var _0x1e8db7={};_0x1e8db7[_0x2b0f0f[_0xe1a2('0x2e')]]={'$like':'%'+_0x47b86a[_0xe1a2('0x35')]['filter']+'%'};return _0x1e8db7;}})});}_0x5601ff=_[_0xe1a2('0x43')]({},_0x5601ff,_0x47b86a[_0xe1a2('0x44')]);var _0x41a156={'where':_0x5601ff[_0xe1a2('0x42')]};return db['ChatGroup'][_0xe1a2('0x24')](_0x41a156)[_0xe1a2('0x2b')](function(_0x302f){_0x30998d[_0xe1a2('0x24')]=_0x302f;if(_0x47b86a[_0xe1a2('0x35')][_0xe1a2('0x45')]){_0x5601ff[_0xe1a2('0x46')]=[{'all':!![]}];}return db[_0xe1a2('0x47')][_0xe1a2('0x48')](_0x5601ff);})[_0xe1a2('0x2b')](function(_0x8ed0da){_0x30998d[_0xe1a2('0x49')]=_0x8ed0da;return _0x30998d;})[_0xe1a2('0x2b')](respondWithFilteredResult(_0x2b0385,_0x5601ff))['catch'](handleError(_0x2b0385,null));};exports[_0xe1a2('0x4a')]=function(_0x292ee1,_0x5abfa5){var _0x31dd26={'raw':!![],'where':{'id':_0x292ee1['params']['id']}},_0x2dc026={};_0x2dc026[_0xe1a2('0x38')]=_[_0xe1a2('0x36')](db[_0xe1a2('0x47')][_0xe1a2('0x4b')]);_0x2dc026[_0xe1a2('0x35')]=_[_0xe1a2('0x36')](_0x292ee1[_0xe1a2('0x35')]);_0x2dc026[_0xe1a2('0x37')]=_[_0xe1a2('0x3a')](_0x2dc026['model'],_0x2dc026[_0xe1a2('0x35')]);_0x31dd26[_0xe1a2('0x39')]=_['intersection'](_0x2dc026[_0xe1a2('0x38')],qs[_0xe1a2('0x3b')](_0x292ee1['query'][_0xe1a2('0x3b')]));_0x31dd26[_0xe1a2('0x39')]=_0x31dd26['attributes']['length']?_0x31dd26['attributes']:_0x2dc026[_0xe1a2('0x38')];if(_0x292ee1[_0xe1a2('0x35')][_0xe1a2('0x45')]){_0x31dd26[_0xe1a2('0x46')]=[{'all':!![]}];}_0x31dd26=_[_0xe1a2('0x43')]({},_0x31dd26,_0x292ee1['options']);return db[_0xe1a2('0x47')][_0xe1a2('0x4c')](_0x31dd26)[_0xe1a2('0x2b')](handleEntityNotFound(_0x5abfa5,null))['then'](respondWithResult(_0x5abfa5,null))['catch'](handleError(_0x5abfa5,null));};exports[_0xe1a2('0x4d')]=function(_0x203df2,_0x50c3ed){return db[_0xe1a2('0x47')][_0xe1a2('0x4d')](_0x203df2['body'],{})[_0xe1a2('0x2b')](respondWithResult(_0x50c3ed,0xc9))[_0xe1a2('0x4e')](handleError(_0x50c3ed,null));};exports[_0xe1a2('0x2a')]=function(_0x494690,_0x4eb9ef){if(_0x494690[_0xe1a2('0x4f')]['id']){delete _0x494690['body']['id'];}return db[_0xe1a2('0x47')]['find']({'where':{'id':_0x494690[_0xe1a2('0x50')]['id']}})[_0xe1a2('0x2b')](handleEntityNotFound(_0x4eb9ef,null))[_0xe1a2('0x2b')](saveUpdates(_0x494690[_0xe1a2('0x4f')],null))[_0xe1a2('0x2b')](respondWithResult(_0x4eb9ef,null))['catch'](handleError(_0x4eb9ef,null));};exports[_0xe1a2('0x51')]=function(_0x33e501,_0x1cb45a){return db[_0xe1a2('0x47')][_0xe1a2('0x4c')]({'where':{'id':_0x33e501[_0xe1a2('0x50')]['id']}})[_0xe1a2('0x2b')](handleEntityNotFound(_0x1cb45a,null))[_0xe1a2('0x2b')](removeEntity(_0x1cb45a,null))[_0xe1a2('0x4e')](handleError(_0x1cb45a,null));};exports['describe']=function(_0x1ed659,_0x3f953e){return db[_0xe1a2('0x47')]['describe']()[_0xe1a2('0x2b')](respondWithResult(_0x3f953e,null))[_0xe1a2('0x4e')](handleError(_0x3f953e,null));};exports[_0xe1a2('0x52')]=function(_0x5cfe72,_0x1264e9,_0x3e61a9){return db[_0xe1a2('0x53')][_0xe1a2('0x24')]({'where':{'ChatGroupId':_0x5cfe72[_0xe1a2('0x50')]['id'],'ToId':_0x5cfe72[_0xe1a2('0x54')]['id'],'read':![]}})[_0xe1a2('0x2b')](function(_0x18246b){return{'id':_[_0xe1a2('0x55')](_0x5cfe72[_0xe1a2('0x50')]['id']),'count':_0x18246b};})[_0xe1a2('0x2b')](respondWithResult(_0x1264e9,null))['catch'](handleError(_0x1264e9,null));};exports[_0xe1a2('0x56')]=function(_0x4768d5,_0x50459e,_0x19ede3){return db['ChatGroup'][_0xe1a2('0x4c')]({'where':{'id':_0x4768d5[_0xe1a2('0x50')]['id']}})[_0xe1a2('0x2b')](handleEntityNotFound(_0x50459e,null))[_0xe1a2('0x2b')](function(_0x2076e0){if(_0x2076e0){return _0x2076e0['addMembers'](_0x4768d5['body']['ids'],_[_0xe1a2('0x57')](_0x4768d5[_0xe1a2('0x4f')],['ids','id'])||{});}})['then'](respondWithResult(_0x50459e,null))[_0xe1a2('0x4e')](handleError(_0x50459e,null));};exports[_0xe1a2('0x58')]=function(_0x4dcd17,_0x36a808,_0xcebe3){var _0x3a1e07={};var _0x4df061={};var _0xa4612d;var _0x5949ba;return db[_0xe1a2('0x47')][_0xe1a2('0x59')]({'where':{'id':_0x4dcd17[_0xe1a2('0x50')]['id']}})[_0xe1a2('0x2b')](handleEntityNotFound(_0x36a808,null))[_0xe1a2('0x2b')](function(_0x270b83){if(_0x270b83){_0xa4612d=_0x270b83;_0x4df061[_0xe1a2('0x38')]=_[_0xe1a2('0x36')](db[_0xe1a2('0x5a')][_0xe1a2('0x4b')]);_0x4df061[_0xe1a2('0x35')]=_[_0xe1a2('0x36')](_0x4dcd17[_0xe1a2('0x35')]);_0x4df061[_0xe1a2('0x37')]=_['intersection'](_0x4df061['model'],_0x4df061[_0xe1a2('0x35')]);_0x3a1e07[_0xe1a2('0x39')]=_['intersection'](_0x4df061['model'],qs['fields'](_0x4dcd17['query'][_0xe1a2('0x3b')]));_0x3a1e07['attributes']=_0x3a1e07[_0xe1a2('0x39')][_0xe1a2('0x3c')]?_0x3a1e07[_0xe1a2('0x39')]:_0x4df061[_0xe1a2('0x38')];_0x3a1e07[_0xe1a2('0x3f')]=qs[_0xe1a2('0x40')](_0x4dcd17['query'][_0xe1a2('0x40')]);_0x3a1e07[_0xe1a2('0x42')]=qs[_0xe1a2('0x37')](_[_0xe1a2('0x5b')](_0x4dcd17[_0xe1a2('0x35')],_0x4df061[_0xe1a2('0x37')]));if(_0x4dcd17[_0xe1a2('0x35')][_0xe1a2('0x41')]){_0x3a1e07[_0xe1a2('0x42')]=_[_0xe1a2('0x43')](_0x3a1e07[_0xe1a2('0x42')],{'$or':_[_0xe1a2('0x31')](_0x3a1e07[_0xe1a2('0x39')],function(_0x1ff9ff){var _0x5c1505={};_0x5c1505[_0x1ff9ff]={'$like':'%'+_0x4dcd17[_0xe1a2('0x35')][_0xe1a2('0x41')]+'%'};return _0x5c1505;})});}_0x3a1e07=_[_0xe1a2('0x43')]({},_0x3a1e07,_0x4dcd17['options']);return _0xa4612d['getMembers'](_0x3a1e07);}})[_0xe1a2('0x2b')](function(_0x336ac7){if(_0x336ac7){_0x5949ba=_0x336ac7['length'];if(!_0x4dcd17[_0xe1a2('0x35')][_0xe1a2('0x3d')](_0xe1a2('0x3e'))){_0x3a1e07['limit']=qs[_0xe1a2('0x23')](_0x4dcd17[_0xe1a2('0x35')][_0xe1a2('0x23')]);_0x3a1e07[_0xe1a2('0x21')]=qs[_0xe1a2('0x21')](_0x4dcd17[_0xe1a2('0x35')][_0xe1a2('0x21')]);}return _0xa4612d[_0xe1a2('0x58')](_0x3a1e07);}})[_0xe1a2('0x2b')](function(_0x3c95d9){if(_0x3c95d9){return _0x3c95d9?{'count':_0x5949ba,'rows':_0x3c95d9}:null;}})[_0xe1a2('0x2b')](respondWithResult(_0x36a808,null))[_0xe1a2('0x4e')](handleError(_0x36a808,null));};exports[_0xe1a2('0x5c')]=function(_0x55e162,_0xdbdfbd,_0x342350){return db[_0xe1a2('0x47')][_0xe1a2('0x4c')]({'where':{'id':_0x55e162[_0xe1a2('0x50')]['id']}})[_0xe1a2('0x2b')](handleEntityNotFound(_0xdbdfbd,null))[_0xe1a2('0x2b')](function(_0xd0fcf1){if(_0xd0fcf1){return _0xd0fcf1[_0xe1a2('0x5c')](_0x55e162[_0xe1a2('0x35')]['ids']);}})[_0xe1a2('0x2b')](respondWithStatusCode(_0xdbdfbd,null))[_0xe1a2('0x4e')](handleError(_0xdbdfbd,null));};exports[_0xe1a2('0x5d')]=function(_0x1cdc4d,_0x22282a,_0x4a0ff6){if(_0x1cdc4d[_0xe1a2('0x4f')]['id']){delete _0x1cdc4d[_0xe1a2('0x4f')]['id'];}return db[_0xe1a2('0x47')]['find']({'where':{'id':_0x1cdc4d[_0xe1a2('0x50')]['id']}})[_0xe1a2('0x2b')](handleEntityNotFound(_0x22282a,null))['then'](function(_0x3cadf3){if(_0x3cadf3){_0x1cdc4d['body'][_0xe1a2('0x5e')]=_0x3cadf3['id'];return db[_0xe1a2('0x53')]['create'](_0x1cdc4d[_0xe1a2('0x4f')]);}})[_0xe1a2('0x2b')](respondWithResult(_0x22282a,null))[_0xe1a2('0x4e')](handleError(_0x22282a,null));};exports[_0xe1a2('0x5f')]=function(_0x240be3,_0x5d1021,_0x53107f){var _0x4b00b7={};var _0xc98fbe={};var _0x57d502;var _0x2246ac;return db[_0xe1a2('0x47')]['findOne']({'where':{'id':_0x240be3[_0xe1a2('0x50')]['id']}})['then'](handleEntityNotFound(_0x5d1021,null))[_0xe1a2('0x2b')](function(_0xabf1d3){if(_0xabf1d3){_0x57d502=_0xabf1d3;_0xc98fbe[_0xe1a2('0x38')]=_[_0xe1a2('0x36')](db[_0xe1a2('0x53')][_0xe1a2('0x4b')]);_0xc98fbe[_0xe1a2('0x35')]=_[_0xe1a2('0x36')](_0x240be3[_0xe1a2('0x35')]);_0xc98fbe[_0xe1a2('0x37')]=_['intersection'](_0xc98fbe['model'],_0xc98fbe[_0xe1a2('0x35')]);_0x4b00b7[_0xe1a2('0x39')]=_['intersection'](_0xc98fbe[_0xe1a2('0x38')],qs[_0xe1a2('0x3b')](_0x240be3[_0xe1a2('0x35')][_0xe1a2('0x3b')]));_0x4b00b7[_0xe1a2('0x39')]=_0x4b00b7['attributes']['length']?_0x4b00b7['attributes']:_0xc98fbe[_0xe1a2('0x38')];_0x4b00b7[_0xe1a2('0x3f')]=qs[_0xe1a2('0x40')](_0x240be3['query'][_0xe1a2('0x40')]);_0x4b00b7[_0xe1a2('0x42')]=qs[_0xe1a2('0x37')](_[_0xe1a2('0x5b')](_0x240be3['query'],_0xc98fbe[_0xe1a2('0x37')]));if(_0x240be3[_0xe1a2('0x35')][_0xe1a2('0x41')]){_0x4b00b7[_0xe1a2('0x42')]=_[_0xe1a2('0x43')](_0x4b00b7[_0xe1a2('0x42')],{'$or':_[_0xe1a2('0x31')](_0x4b00b7[_0xe1a2('0x39')],function(_0x5c2824){var _0x28d504={};_0x28d504[_0x5c2824]={'$like':'%'+_0x240be3[_0xe1a2('0x35')][_0xe1a2('0x41')]+'%'};return _0x28d504;})});}if(_0x240be3['query']['$gte']){var _0x3d0da1=_0x240be3[_0xe1a2('0x35')][_0xe1a2('0x60')][_0xe1a2('0x61')](',');var _0x26c8fa={};_0x26c8fa[_0x3d0da1[0x0]]={'$gte':moment(_0x3d0da1[0x1])[_0xe1a2('0x62')](_0xe1a2('0x63'))};_0x4b00b7[_0xe1a2('0x42')]=_[_0xe1a2('0x43')](_0x4b00b7['where'],_0x26c8fa);}_0x4b00b7=_['merge']({},_0x4b00b7,_0x240be3[_0xe1a2('0x44')]);return _0x57d502[_0xe1a2('0x5f')](_0x4b00b7);}})[_0xe1a2('0x2b')](function(_0x2609e9){if(_0x2609e9){_0x2246ac=_0x2609e9[_0xe1a2('0x3c')];if(!_0x240be3[_0xe1a2('0x35')][_0xe1a2('0x3d')](_0xe1a2('0x3e'))){_0x4b00b7['limit']=qs[_0xe1a2('0x23')](_0x240be3[_0xe1a2('0x35')][_0xe1a2('0x23')]);_0x4b00b7[_0xe1a2('0x21')]=qs[_0xe1a2('0x21')](_0x240be3['query'][_0xe1a2('0x21')]);}return _0x57d502[_0xe1a2('0x5f')](_0x4b00b7);}})[_0xe1a2('0x2b')](function(_0x276797){if(_0x276797){return _0x276797?{'count':_0x2246ac,'rows':_0x276797}:null;}})[_0xe1a2('0x2b')](respondWithResult(_0x5d1021,null))[_0xe1a2('0x4e')](handleError(_0x5d1021,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 8bd557c..bed7fc6 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 _0x9632=['exports','events','../../mysqldb','ChatGroup','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x57f993,_0x32a645){var _0x2703d6=function(_0x563777){while(--_0x563777){_0x57f993['push'](_0x57f993['shift']());}};_0x2703d6(++_0x32a645);}(_0x9632,0x109));var _0x2963=function(_0x456e6c,_0x505c52){_0x456e6c=_0x456e6c-0x0;var _0x373dcc=_0x9632[_0x456e6c];return _0x373dcc;};'use strict';var EventEmitter=require(_0x2963('0x0'));var ChatGroup=require(_0x2963('0x1'))['db'][_0x2963('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x2963('0x3')](0x0);var events={'afterCreate':_0x2963('0x4'),'afterUpdate':_0x2963('0x5'),'afterDestroy':_0x2963('0x6')};function emitEvent(_0x5f5833){return function(_0x4aa47c,_0x7e629f,_0x263ab9){ChatGroupEvents[_0x2963('0x7')](_0x5f5833+':'+_0x4aa47c['id'],_0x4aa47c);ChatGroupEvents[_0x2963('0x7')](_0x5f5833,_0x4aa47c);_0x263ab9(null);};}for(var e in events){if(events[_0x2963('0x8')](e)){var event=events[e];ChatGroup[_0x2963('0x9')](e,emitEvent(event));}}module[_0x2963('0xa')]=ChatGroupEvents; \ No newline at end of file +var _0xb5bf=['hasOwnProperty','hook','exports','events','../../mysqldb','ChatGroup','save','remove','emit'];(function(_0x444c84,_0x4f2b54){var _0x5c1fc5=function(_0x45636b){while(--_0x45636b){_0x444c84['push'](_0x444c84['shift']());}};_0x5c1fc5(++_0x4f2b54);}(_0xb5bf,0x1d7));var _0xfb5b=function(_0x9c2427,_0x17c865){_0x9c2427=_0x9c2427-0x0;var _0x51984f=_0xb5bf[_0x9c2427];return _0x51984f;};'use strict';var EventEmitter=require(_0xfb5b('0x0'));var ChatGroup=require(_0xfb5b('0x1'))['db'][_0xfb5b('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfb5b('0x3'),'afterUpdate':'update','afterDestroy':_0xfb5b('0x4')};function emitEvent(_0x315c48){return function(_0x2e8dd6,_0x72f94d,_0x23dfaf){ChatGroupEvents[_0xfb5b('0x5')](_0x315c48+':'+_0x2e8dd6['id'],_0x2e8dd6);ChatGroupEvents['emit'](_0x315c48,_0x2e8dd6);_0x23dfaf(null);};}for(var e in events){if(events[_0xfb5b('0x6')](e)){var event=events[e];ChatGroup[_0xfb5b('0x7')](e,emitEvent(event));}}module[_0xfb5b('0x8')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 2c0158a..13de016 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 _0x9d2b=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatGroup.attributes','define','ChatGroup','chat_groups','lodash','util'];(function(_0x550e29,_0x4047f){var _0x3515b6=function(_0x303fe2){while(--_0x303fe2){_0x550e29['push'](_0x550e29['shift']());}};_0x3515b6(++_0x4047f);}(_0x9d2b,0x15c));var _0xb9d2=function(_0x4b7e4d,_0x82d2ab){_0x4b7e4d=_0x4b7e4d-0x0;var _0x38d6af=_0x9d2b[_0x4b7e4d];return _0x38d6af;};'use strict';var _=require(_0xb9d2('0x0'));var util=require(_0xb9d2('0x1'));var logger=require(_0xb9d2('0x2'))(_0xb9d2('0x3'));var moment=require(_0xb9d2('0x4'));var BPromise=require(_0xb9d2('0x5'));var rp=require(_0xb9d2('0x6'));var fs=require('fs');var path=require(_0xb9d2('0x7'));var rimraf=require(_0xb9d2('0x8'));var config=require(_0xb9d2('0x9'));var attributes=require(_0xb9d2('0xa'));module['exports']=function(_0xe5a8cf,_0x2cca48){return _0xe5a8cf[_0xb9d2('0xb')](_0xb9d2('0xc'),attributes,{'tableName':_0xb9d2('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8b76=['./chatGroup.attributes','define','ChatGroup','chat_groups','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8b76,0x1c0));var _0x68b7=function(_0x398306,_0x560fd1){_0x398306=_0x398306-0x0;var _0x42644b=_0x8b76[_0x398306];return _0x42644b;};'use strict';var _=require(_0x68b7('0x0'));var util=require('util');var logger=require(_0x68b7('0x1'))(_0x68b7('0x2'));var moment=require(_0x68b7('0x3'));var BPromise=require(_0x68b7('0x4'));var rp=require(_0x68b7('0x5'));var fs=require('fs');var path=require(_0x68b7('0x6'));var rimraf=require('rimraf');var config=require(_0x68b7('0x7'));var attributes=require(_0x68b7('0x8'));module['exports']=function(_0x421c31,_0x175961){return _0x421c31[_0x68b7('0x9')](_0x68b7('0xa'),attributes,{'tableName':_0x68b7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index 4e553c0..fc33b4c 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 _0x1a8f=['then','info','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatGroup,\x20%s,\x20%s','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','register','request'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x1a8f,0x87));var _0xf1a8=function(_0x481ff7,_0x2b6ebb){_0x481ff7=_0x481ff7-0x0;var _0x1c1573=_0x1a8f[_0x481ff7];return _0x1c1573;};'use strict';var _=require(_0xf1a8('0x0'));var util=require('util');var moment=require(_0xf1a8('0x1'));var BPromise=require(_0xf1a8('0x2'));var rs=require(_0xf1a8('0x3'));var fs=require('fs');var Redis=require(_0xf1a8('0x4'));var db=require(_0xf1a8('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xf1a8('0x6'));var client=jayson[_0xf1a8('0x7')][_0xf1a8('0x8')]({'port':0x232a});config['redis']=_[_0xf1a8('0x9')](config['redis'],{'host':_0xf1a8('0xa'),'port':0x18eb});var socket=require(_0xf1a8('0xb'))(new Redis(config[_0xf1a8('0xc')]));require('./chatGroup.socket')[_0xf1a8('0xd')](socket);function respondWithRpcPromise(_0x5012c6,_0x6915e2,_0x4d567f){return new BPromise(function(_0x1f2595,_0x3ff385){return client[_0xf1a8('0xe')](_0x5012c6,_0x4d567f)[_0xf1a8('0xf')](function(_0x49e1e1){logger[_0xf1a8('0x10')]('ChatGroup,\x20%s,\x20%s',_0x6915e2,_0xf1a8('0x11'));logger['debug'](_0xf1a8('0x12'),_0x6915e2,_0xf1a8('0x11'),JSON[_0xf1a8('0x13')](_0x49e1e1));if(_0x49e1e1[_0xf1a8('0x14')]){if(_0x49e1e1[_0xf1a8('0x14')][_0xf1a8('0x15')]===0x1f4){logger[_0xf1a8('0x14')](_0xf1a8('0x16'),_0x6915e2,_0x49e1e1[_0xf1a8('0x14')]['message']);return _0x3ff385(_0x49e1e1[_0xf1a8('0x14')][_0xf1a8('0x17')]);}logger[_0xf1a8('0x14')](_0xf1a8('0x16'),_0x6915e2,_0x49e1e1[_0xf1a8('0x14')][_0xf1a8('0x17')]);return _0x1f2595(_0x49e1e1[_0xf1a8('0x14')][_0xf1a8('0x17')]);}else{logger[_0xf1a8('0x10')](_0xf1a8('0x16'),_0x6915e2,_0xf1a8('0x11'));_0x1f2595(_0x49e1e1[_0xf1a8('0x18')][_0xf1a8('0x17')]);}})['catch'](function(_0x159d9d){logger[_0xf1a8('0x14')](_0xf1a8('0x16'),_0x6915e2,_0x159d9d);_0x3ff385(_0x159d9d);});});} \ No newline at end of file +var _0xaf3e=['util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','error','code','ChatGroup,\x20%s,\x20%s','message','catch','lodash'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xaf3e,0xcf));var _0xeaf3=function(_0x4defd6,_0x37bbd3){_0x4defd6=_0x4defd6-0x0;var _0x4c9276=_0xaf3e[_0x4defd6];return _0x4c9276;};'use strict';var _=require(_0xeaf3('0x0'));var util=require(_0xeaf3('0x1'));var moment=require('moment');var BPromise=require(_0xeaf3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeaf3('0x3'));var db=require(_0xeaf3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xeaf3('0x5'))(_0xeaf3('0x6'));var config=require(_0xeaf3('0x7'));var jayson=require(_0xeaf3('0x8'));var client=jayson[_0xeaf3('0x9')]['http']({'port':0x232a});config[_0xeaf3('0xa')]=_[_0xeaf3('0xb')](config[_0xeaf3('0xa')],{'host':_0xeaf3('0xc'),'port':0x18eb});var socket=require(_0xeaf3('0xd'))(new Redis(config[_0xeaf3('0xa')]));require('./chatGroup.socket')[_0xeaf3('0xe')](socket);function respondWithRpcPromise(_0x48bcf7,_0x5eb9d,_0x37a947){return new BPromise(function(_0xc0a479,_0x5c21aa){return client[_0xeaf3('0xf')](_0x48bcf7,_0x37a947)[_0xeaf3('0x10')](function(_0x596ea8){logger[_0xeaf3('0x11')]('ChatGroup,\x20%s,\x20%s',_0x5eb9d,_0xeaf3('0x12'));logger[_0xeaf3('0x13')](_0xeaf3('0x14'),_0x5eb9d,_0xeaf3('0x12'),JSON['stringify'](_0x596ea8));if(_0x596ea8[_0xeaf3('0x15')]){if(_0x596ea8[_0xeaf3('0x15')][_0xeaf3('0x16')]===0x1f4){logger[_0xeaf3('0x15')]('ChatGroup,\x20%s,\x20%s',_0x5eb9d,_0x596ea8[_0xeaf3('0x15')]['message']);return _0x5c21aa(_0x596ea8[_0xeaf3('0x15')]['message']);}logger['error'](_0xeaf3('0x17'),_0x5eb9d,_0x596ea8[_0xeaf3('0x15')][_0xeaf3('0x18')]);return _0xc0a479(_0x596ea8[_0xeaf3('0x15')][_0xeaf3('0x18')]);}else{logger[_0xeaf3('0x11')]('ChatGroup,\x20%s,\x20%s',_0x5eb9d,_0xeaf3('0x12'));_0xc0a479(_0x596ea8['result'][_0xeaf3('0x18')]);}})[_0xeaf3('0x19')](function(_0x48e609){logger[_0xeaf3('0x15')](_0xeaf3('0x17'),_0x5eb9d,_0x48e609);_0x5c21aa(_0x48e609);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 04c737f..1e3a5e7 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 _0x40ba=['length','chatGroup:','./chatGroup.events','save','remove','update','emit','removeListener','register'];(function(_0x56a3bb,_0x4af1a2){var _0xe712b8=function(_0x1bd238){while(--_0x1bd238){_0x56a3bb['push'](_0x56a3bb['shift']());}};_0xe712b8(++_0x4af1a2);}(_0x40ba,0xad));var _0xa40b=function(_0x4fdc46,_0x2a3759){_0x4fdc46=_0x4fdc46-0x0;var _0x2c178a=_0x40ba[_0x4fdc46];return _0x2c178a;};'use strict';var ChatGroupEvents=require(_0xa40b('0x0'));var events=[_0xa40b('0x1'),_0xa40b('0x2'),_0xa40b('0x3')];function createListener(_0x237741,_0x24c05b){return function(_0x3c0ea2){_0x24c05b[_0xa40b('0x4')](_0x237741,_0x3c0ea2);};}function removeListener(_0x33a3e7,_0x107f5b){return function(){ChatGroupEvents[_0xa40b('0x5')](_0x33a3e7,_0x107f5b);};}exports[_0xa40b('0x6')]=function(_0x3d777a){for(var _0x24cfc2=0x0,_0x5a6eee=events[_0xa40b('0x7')];_0x24cfc2<_0x5a6eee;_0x24cfc2++){var _0x161276=events[_0x24cfc2];var _0x510cc9=createListener(_0xa40b('0x8')+_0x161276,_0x3d777a);ChatGroupEvents['on'](_0x161276,_0x510cc9);}}; \ No newline at end of file +var _0xbb20=['register','chatGroup:','save','remove','update','removeListener'];(function(_0x129f0e,_0x47b168){var _0x365540=function(_0x4a9cb0){while(--_0x4a9cb0){_0x129f0e['push'](_0x129f0e['shift']());}};_0x365540(++_0x47b168);}(_0xbb20,0x152));var _0x0bb2=function(_0x4b03a7,_0x49698b){_0x4b03a7=_0x4b03a7-0x0;var _0x644e66=_0xbb20[_0x4b03a7];return _0x644e66;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0x0bb2('0x0'),_0x0bb2('0x1'),_0x0bb2('0x2')];function createListener(_0x148fde,_0x5ba338){return function(_0x3e0362){_0x5ba338['emit'](_0x148fde,_0x3e0362);};}function removeListener(_0x3b86f3,_0x5de495){return function(){ChatGroupEvents[_0x0bb2('0x3')](_0x3b86f3,_0x5de495);};}exports[_0x0bb2('0x4')]=function(_0x963831){for(var _0x4a3cac=0x0,_0xebdd98=events['length'];_0x4a3cac<_0xebdd98;_0x4a3cac++){var _0x4b4fcc=events[_0x4a3cac];var _0x5470ac=createListener(_0x0bb2('0x5')+_0x4b4fcc,_0x963831);ChatGroupEvents['on'](_0x4b4fcc,_0x5470ac);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 1e30228..7ded9c8 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 _0x7ccd=['exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','index','/describe','isAuthenticated','describe','getUnread','getMembers','/:id/messages','getMessages','post','addMembers','addMessage','put','/:id','update','delete','removeMembers'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7ccd,0x139));var _0xd7cc=function(_0x2dc81b,_0x2063ae){_0x2dc81b=_0x2dc81b-0x0;var _0x3a2946=_0x7ccd[_0x2dc81b];return _0x3a2946;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd7cc('0x0'));var timeout=require(_0xd7cc('0x1'));var express=require(_0xd7cc('0x2'));var router=express[_0xd7cc('0x3')]();var fs_extra=require(_0xd7cc('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd7cc('0x5'));var config=require(_0xd7cc('0x6'));var controller=require(_0xd7cc('0x7'));router[_0xd7cc('0x8')]('/',auth['isAuthenticated'](),controller[_0xd7cc('0x9')]);router[_0xd7cc('0x8')](_0xd7cc('0xa'),auth[_0xd7cc('0xb')](),controller[_0xd7cc('0xc')]);router[_0xd7cc('0x8')]('/:id',auth[_0xd7cc('0xb')](),controller['show']);router[_0xd7cc('0x8')]('/:id/unread',auth[_0xd7cc('0xb')](),controller[_0xd7cc('0xd')]);router[_0xd7cc('0x8')]('/:id/members',auth[_0xd7cc('0xb')](),controller[_0xd7cc('0xe')]);router['get'](_0xd7cc('0xf'),auth[_0xd7cc('0xb')](),controller[_0xd7cc('0x10')]);router[_0xd7cc('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd7cc('0x11')]('/:id/members',auth['isAuthenticated'](),controller[_0xd7cc('0x12')]);router[_0xd7cc('0x11')]('/:id/messages',auth['isAuthenticated'](),controller[_0xd7cc('0x13')]);router[_0xd7cc('0x14')](_0xd7cc('0x15'),auth[_0xd7cc('0xb')](),controller[_0xd7cc('0x16')]);router[_0xd7cc('0x17')](_0xd7cc('0x15'),auth['isAuthenticated'](),controller['destroy']);router['delete']('/:id/members',auth[_0xd7cc('0xb')](),controller[_0xd7cc('0x18')]);module[_0xd7cc('0x19')]=router; \ No newline at end of file +var _0xd27d=['show','/:id/unread','/:id/members','getMembers','/:id/messages','post','addMessage','update','delete','destroy','removeMembers','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./chatGroup.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x50357c,_0x1cca99){var _0x18338e=function(_0x447e73){while(--_0x447e73){_0x50357c['push'](_0x50357c['shift']());}};_0x18338e(++_0x1cca99);}(_0xd27d,0x144));var _0xdd27=function(_0xd344ef,_0x132b5f){_0xd344ef=_0xd344ef-0x0;var _0x50a171=_0xd27d[_0xd344ef];return _0x50a171;};'use strict';var multer=require('multer');var util=require(_0xdd27('0x0'));var path=require(_0xdd27('0x1'));var timeout=require(_0xdd27('0x2'));var express=require(_0xdd27('0x3'));var router=express['Router']();var fs_extra=require(_0xdd27('0x4'));var auth=require(_0xdd27('0x5'));var interaction=require(_0xdd27('0x6'));var config=require('../../config/environment');var controller=require(_0xdd27('0x7'));router[_0xdd27('0x8')]('/',auth[_0xdd27('0x9')](),controller[_0xdd27('0xa')]);router[_0xdd27('0x8')](_0xdd27('0xb'),auth[_0xdd27('0x9')](),controller[_0xdd27('0xc')]);router[_0xdd27('0x8')](_0xdd27('0xd'),auth['isAuthenticated'](),controller[_0xdd27('0xe')]);router[_0xdd27('0x8')](_0xdd27('0xf'),auth[_0xdd27('0x9')](),controller['getUnread']);router[_0xdd27('0x8')](_0xdd27('0x10'),auth['isAuthenticated'](),controller[_0xdd27('0x11')]);router[_0xdd27('0x8')](_0xdd27('0x12'),auth[_0xdd27('0x9')](),controller['getMessages']);router[_0xdd27('0x13')]('/',auth[_0xdd27('0x9')](),controller['create']);router[_0xdd27('0x13')]('/:id/members',auth[_0xdd27('0x9')](),controller['addMembers']);router[_0xdd27('0x13')](_0xdd27('0x12'),auth[_0xdd27('0x9')](),controller[_0xdd27('0x14')]);router['put']('/:id',auth[_0xdd27('0x9')](),controller[_0xdd27('0x15')]);router[_0xdd27('0x16')](_0xdd27('0xd'),auth[_0xdd27('0x9')](),controller[_0xdd27('0x17')]);router['delete'](_0xdd27('0x10'),auth[_0xdd27('0x9')](),controller[_0xdd27('0x18')]);module[_0xdd27('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index d4bf4be..28b9404 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 _0x83d8=['STRING','DATE','out','exports','BOOLEAN','INTEGER','ENUM','star','TEXT'];(function(_0x232cb8,_0x390d88){var _0x319ea0=function(_0x3395aa){while(--_0x3395aa){_0x232cb8['push'](_0x232cb8['shift']());}};_0x319ea0(++_0x390d88);}(_0x83d8,0xdb));var _0x883d=function(_0x1bb727,_0xfaa60e){_0x1bb727=_0x1bb727-0x0;var _0x2001d5=_0x83d8[_0x1bb727];return _0x2001d5;};'use strict';var Sequelize=require('sequelize');module[_0x883d('0x0')]={'closed':{'type':Sequelize[_0x883d('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x883d('0x2')]},'ratingType':{'type':Sequelize[_0x883d('0x3')](_0x883d('0x4'),'thumb'),'defaultValue':_0x883d('0x4')},'ratingMessage':{'type':Sequelize[_0x883d('0x5')]},'pathTranscript':{'type':Sequelize[_0x883d('0x5')]},'mailTranscript':{'type':Sequelize[_0x883d('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x883d('0x7')]},'disposition':{'type':Sequelize[_0x883d('0x6')]},'secondDisposition':{'type':Sequelize[_0x883d('0x6')]},'thirdDisposition':{'type':Sequelize[_0x883d('0x6')]},'note':{'type':Sequelize[_0x883d('0x6')]},'browserName':{'type':Sequelize[_0x883d('0x6')]},'browserVersion':{'type':Sequelize[_0x883d('0x6')]},'osName':{'type':Sequelize[_0x883d('0x6')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0x883d('0x6')]},'deviceVendor':{'type':Sequelize[_0x883d('0x6')]},'deviceType':{'type':Sequelize[_0x883d('0x6')]},'referer':{'type':Sequelize[_0x883d('0x5')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x883d('0x5')]('long')},'read1stAt':{'type':Sequelize[_0x883d('0x7')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x883d('0x3')]('in',_0x883d('0x8')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0x883d('0x6')]},'vidaooSessionId':{'type':Sequelize[_0x883d('0x5')]},'autoreplyExecuted':{'type':Sequelize[_0x883d('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x883d('0x2')]}}; \ No newline at end of file +var _0x8870=['sequelize','exports','INTEGER','ENUM','thumb','star','TEXT','STRING','DATE','long','BOOLEAN'];(function(_0x4acfd2,_0x5b9374){var _0x12afbe=function(_0x5bc178){while(--_0x5bc178){_0x4acfd2['push'](_0x4acfd2['shift']());}};_0x12afbe(++_0x5b9374);}(_0x8870,0xfd));var _0x0887=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x8870[_0x16b9ed];return _0x66b1f8;};'use strict';var Sequelize=require(_0x0887('0x0'));module[_0x0887('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x0887('0x2')]},'ratingType':{'type':Sequelize[_0x0887('0x3')]('star',_0x0887('0x4')),'defaultValue':_0x0887('0x5')},'ratingMessage':{'type':Sequelize[_0x0887('0x6')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0x0887('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x0887('0x8')]},'disposition':{'type':Sequelize[_0x0887('0x7')]},'secondDisposition':{'type':Sequelize[_0x0887('0x7')]},'thirdDisposition':{'type':Sequelize[_0x0887('0x7')]},'note':{'type':Sequelize[_0x0887('0x7')]},'browserName':{'type':Sequelize[_0x0887('0x7')]},'browserVersion':{'type':Sequelize[_0x0887('0x7')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x0887('0x7')]},'deviceModel':{'type':Sequelize[_0x0887('0x7')]},'deviceVendor':{'type':Sequelize[_0x0887('0x7')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0x0887('0x7')]},'formData':{'type':Sequelize['TEXT'](_0x0887('0x9'))},'read1stAt':{'type':Sequelize[_0x0887('0x8')]},'lastMsgAt':{'type':Sequelize[_0x0887('0x8')]},'lastMsgDirection':{'type':Sequelize[_0x0887('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0x0887('0x7')]},'vidaooSessionId':{'type':Sequelize[_0x0887('0x6')]},'autoreplyExecuted':{'type':Sequelize[_0x0887('0xa')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x0887('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index d732194..126b873 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 _0x1e57=['merge','body','contact','agent','interaction','account','index','rawAttributes','fieldName','type','key','query','user','show','params','model','ChatInteraction','keys','filters','intersection','attributes','fields','length','includeAll','include','options','find','create','describe','createVidaooSession','ChatWebsite','findOne','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','fullname','email','isNull','follow','parse','metadata','Sequelize','ValidationError','Error\x20in\x20Vidaoo\x20configuration','out','Unable\x20to\x20create\x20Vidaoo\x20session','customUpdate','CmContact','Contact','abandonInteraction,\x20%s,\x20%s,\x20%s','abandon','entity\x20not\x20found','UserId','closed','disposition','AbandonInteraction','attachmentUpload','file','filename','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','ChatOfflineMessageId','root','server/files/attachments/','join','offline-chat/','basename','download','close','mailTranscript','server/files/chat/upload/','format','now','pathTranscript','ChatMessage','User','ContactId','Messages','%s%d','agentAlias','customer','Visitor','website_alias','System','alias','agent_fullname','createdAt','MM/DD/YYYY\x20HH:mm:ss','secret','appendFileSync','MailServerOut','CloudProvider','Smtp','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','nolimit','order','sort','where','pick','filter','split','count','findAll','rows','getMyMessages','hasOwnProperty','ChatInteractionId','map','includeAgent','push','addTags','setTags','omit','spread','emit','chatInteractionTags:save','unix','toString','files','tmp','server','attachments','lastName','direction','read','Account','get','Owner','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','referer','customerIp','customerPort','tail','existsSync','createReadStream','pipe','createWriteStream','firstName','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','Chat','err','unlinkSync','rimraf','request-promise','bluebird','mustache','util','path','ejs','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./chatInteraction.socket','register','jayson/promise','client','http','request','then','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','info','result','catch','sendStatus','end','status','json','offset','undefined','limit','set','update','destroy','stack','name','send','render'];(function(_0x5de70d,_0x10a712){var _0x353b67=function(_0x3c10fd){while(--_0x3c10fd){_0x5de70d['push'](_0x5de70d['shift']());}};_0x353b67(++_0x10a712);}(_0x1e57,0x176));var _0x71e5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1e57[_0x3dd15e];return _0x231fd0;};'use strict';var rimraf=require(_0x71e5('0x0'));var zipdir=require('zip-dir');var rp=require(_0x71e5('0x1'));var moment=require('moment');var BPromise=require(_0x71e5('0x2'));var Mustache=require(_0x71e5('0x3'));var util=require(_0x71e5('0x4'));var path=require(_0x71e5('0x5'));var ejs=require(_0x71e5('0x6'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x71e5('0x7'));var interaction=require(_0x71e5('0x8'));var qs=require('../../components/parsers/qs');var pdf=require(_0x71e5('0x9'));var logger=require(_0x71e5('0xa'))(_0x71e5('0xb'));var config=require(_0x71e5('0xc'));var db=require(_0x71e5('0xd'))['db'];config['redis']=_[_0x71e5('0xe')](config['redis'],{'host':_0x71e5('0xf'),'port':0x18eb});var socket=require(_0x71e5('0x10'))(new Redis(config[_0x71e5('0x11')]));require(_0x71e5('0x12'))[_0x71e5('0x13')](socket);var jayson=require(_0x71e5('0x14'));var client=jayson[_0x71e5('0x15')][_0x71e5('0x16')]({'port':0x232b});var client9004=jayson[_0x71e5('0x15')][_0x71e5('0x16')]({'port':0x232c});function respondWithRpcPromise(_0x270996,_0x2aba45,_0x2cd72f,_0x9f8a17){return new BPromise(function(_0x112224,_0x44428b){var _0xe1c02d=_0x9f8a17||client;return _0xe1c02d[_0x71e5('0x17')](_0x270996,_0x2cd72f)[_0x71e5('0x18')](function(_0x497b8a){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x2aba45,_0x71e5('0x19'));logger[_0x71e5('0x1a')](_0x71e5('0x1b'),_0x2aba45,_0x71e5('0x19'),JSON[_0x71e5('0x1c')](_0x497b8a));if(_0x497b8a[_0x71e5('0x1d')]){if(_0x497b8a[_0x71e5('0x1d')][_0x71e5('0x1e')]===0x1f4){logger[_0x71e5('0x1d')](_0x71e5('0x1f'),_0x2aba45,_0x497b8a['error'][_0x71e5('0x20')]);return _0x44428b(_0x497b8a[_0x71e5('0x1d')]['message']);}logger['error'](_0x71e5('0x1f'),_0x2aba45,_0x497b8a[_0x71e5('0x1d')][_0x71e5('0x20')]);return _0x112224(_0x497b8a[_0x71e5('0x1d')][_0x71e5('0x20')]);}else{logger[_0x71e5('0x21')](_0x71e5('0x1f'),_0x2aba45,'request\x20sent');_0x112224(_0x497b8a[_0x71e5('0x22')][_0x71e5('0x20')]);}})[_0x71e5('0x23')](function(_0x3bb7ed){logger[_0x71e5('0x1d')]('ChatInteraction,\x20%s,\x20%s',_0x2aba45,_0x3bb7ed);_0x44428b(_0x3bb7ed);});});}function respondWithStatusCode(_0x5933f4,_0x1c93af){_0x1c93af=_0x1c93af||0xcc;return function(_0x14354f){if(_0x14354f){return _0x5933f4[_0x71e5('0x24')](_0x1c93af);}return _0x5933f4['status'](_0x1c93af)[_0x71e5('0x25')]();};}function respondWithResult(_0x530055,_0x191b6a){_0x191b6a=_0x191b6a||0xc8;return function(_0x2e0f46){if(_0x2e0f46){return _0x530055[_0x71e5('0x26')](_0x191b6a)[_0x71e5('0x27')](_0x2e0f46);}};}function respondWithFilteredResult(_0x48adfb,_0x5e79d8){return function(_0x26e390){if(_0x26e390){var _0x2dbe5b=typeof _0x5e79d8[_0x71e5('0x28')]===_0x71e5('0x29')&&typeof _0x5e79d8[_0x71e5('0x2a')]===_0x71e5('0x29');var _0x1e4a78=_0x26e390['count'];var _0x546b9e=_0x2dbe5b?0x0:_0x5e79d8[_0x71e5('0x28')];var _0x228c71=_0x2dbe5b?_0x26e390['count']:_0x5e79d8[_0x71e5('0x28')]+_0x5e79d8[_0x71e5('0x2a')];var _0x277661;if(_0x228c71>=_0x1e4a78){_0x228c71=_0x1e4a78;_0x277661=0xc8;}else{_0x277661=0xce;}_0x48adfb['status'](_0x277661);return _0x48adfb[_0x71e5('0x2b')]('Content-Range',_0x546b9e+'-'+_0x228c71+'/'+_0x1e4a78)[_0x71e5('0x27')](_0x26e390);}return null;};}function saveUpdates(_0x19e505){return function(_0x5cac91){if(_0x5cac91){return _0x5cac91[_0x71e5('0x2c')](_0x19e505)[_0x71e5('0x18')](function(_0x2f0606){return _0x2f0606;});}return null;};}function removeEntity(_0xb599e3){return function(_0x4c57b5){if(_0x4c57b5){return _0x4c57b5[_0x71e5('0x2d')]()[_0x71e5('0x18')](function(){_0xb599e3['status'](0xcc)[_0x71e5('0x25')]();});}};}function handleEntityNotFound(_0x4e97b0){return function(_0x4fa967){if(!_0x4fa967){_0x4e97b0['sendStatus'](0x194);}return _0x4fa967;};}function handleError(_0x5172ff,_0x25c5f5){_0x25c5f5=_0x25c5f5||0x1f4;return function(_0x4c41c7){logger[_0x71e5('0x1d')](_0x4c41c7[_0x71e5('0x2e')]);if(_0x4c41c7[_0x71e5('0x2f')]){delete _0x4c41c7[_0x71e5('0x2f')];}_0x5172ff[_0x71e5('0x26')](_0x25c5f5)[_0x71e5('0x30')](_0x4c41c7);};}function getMustacheRender(_0x536539,_0x18886e){return Mustache[_0x71e5('0x31')](_0x536539,_[_0x71e5('0x32')](_0x18886e[_0x71e5('0x33')],{'contact':_0x18886e[_0x71e5('0x34')],'message':_0x18886e[_0x71e5('0x20')],'agent':_0x18886e[_0x71e5('0x35')],'interaction':_0x18886e[_0x71e5('0x36')],'account':_0x18886e[_0x71e5('0x37')]}))||'';}exports[_0x71e5('0x38')]=function(_0x19cac3,_0x3f842a){var _0x57778b={};var _0x2a65ee=_['map'](db['ChatInteraction'][_0x71e5('0x39')],function(_0xced590){return{'name':_0xced590[_0x71e5('0x3a')],'type':_0xced590[_0x71e5('0x3b')][_0x71e5('0x3c')]};});_0x57778b=qs['getOptions'](_0x2a65ee,_0x19cac3);return interaction['findAll']('chat',_0x19cac3[_0x71e5('0x3d')],_0x19cac3[_0x71e5('0x3e')],_0x57778b,_0x2a65ee)['then'](respondWithFilteredResult(_0x3f842a,_0x57778b))['catch'](handleError(_0x3f842a,null));};exports[_0x71e5('0x3f')]=function(_0x16d766,_0x2c7d6a){var _0xbe7065={'raw':![],'where':{'id':_0x16d766[_0x71e5('0x40')]['id']}},_0xf6aa2={};_0xf6aa2[_0x71e5('0x41')]=_['keys'](db[_0x71e5('0x42')][_0x71e5('0x39')]);_0xf6aa2[_0x71e5('0x3d')]=_[_0x71e5('0x43')](_0x16d766[_0x71e5('0x3d')]);_0xf6aa2[_0x71e5('0x44')]=_[_0x71e5('0x45')](_0xf6aa2['model'],_0xf6aa2[_0x71e5('0x3d')]);_0xbe7065[_0x71e5('0x46')]=_[_0x71e5('0x45')](_0xf6aa2[_0x71e5('0x41')],qs[_0x71e5('0x47')](_0x16d766[_0x71e5('0x3d')][_0x71e5('0x47')]));_0xbe7065[_0x71e5('0x46')]=_0xbe7065[_0x71e5('0x46')][_0x71e5('0x48')]?_0xbe7065['attributes']:_0xf6aa2[_0x71e5('0x41')];if(_0x16d766['query'][_0x71e5('0x49')]){_0xbe7065[_0x71e5('0x4a')]=[{'all':!![]}];}_0xbe7065=_[_0x71e5('0x32')]({},_0xbe7065,_0x16d766[_0x71e5('0x4b')]);return db[_0x71e5('0x42')][_0x71e5('0x4c')](_0xbe7065)[_0x71e5('0x18')](handleEntityNotFound(_0x2c7d6a,null))[_0x71e5('0x18')](respondWithResult(_0x2c7d6a,null))[_0x71e5('0x23')](handleError(_0x2c7d6a,null));};exports[_0x71e5('0x4d')]=function(_0xe2e8af,_0x5e90ab){return db[_0x71e5('0x42')][_0x71e5('0x4d')](_0xe2e8af[_0x71e5('0x33')],{})[_0x71e5('0x18')](respondWithResult(_0x5e90ab,0xc9))[_0x71e5('0x23')](handleError(_0x5e90ab,null));};exports[_0x71e5('0x2c')]=function(_0x5591af,_0xfb96c6){if(_0x5591af['body']['id']){delete _0x5591af['body']['id'];}return db[_0x71e5('0x42')][_0x71e5('0x4c')]({'where':{'id':_0x5591af[_0x71e5('0x40')]['id']}})[_0x71e5('0x18')](handleEntityNotFound(_0xfb96c6,null))[_0x71e5('0x18')](saveUpdates(_0x5591af['body'],null))[_0x71e5('0x18')](respondWithResult(_0xfb96c6,null))[_0x71e5('0x23')](handleError(_0xfb96c6,null));};exports[_0x71e5('0x2d')]=function(_0x83071d,_0x3fe793){return db['ChatInteraction']['find']({'where':{'id':_0x83071d[_0x71e5('0x40')]['id']}})[_0x71e5('0x18')](handleEntityNotFound(_0x3fe793,null))[_0x71e5('0x18')](removeEntity(_0x3fe793,null))[_0x71e5('0x23')](handleError(_0x3fe793,null));};exports['describe']=function(_0x1890ea,_0x2f3db6){return db[_0x71e5('0x42')][_0x71e5('0x4e')]()['then'](respondWithResult(_0x2f3db6,null))[_0x71e5('0x23')](handleError(_0x2f3db6,null));};exports[_0x71e5('0x4f')]=function(_0x15176b,_0x4b9252){var _0x1aedc6=_0x15176b['params']['id'];var _0x4ee2e2;var _0x5ce4a9;var _0x45c5ef;return db[_0x71e5('0x42')]['findOne']({'where':{'id':_0x1aedc6}})[_0x71e5('0x18')](function(_0x4f33d9){_0x4ee2e2=_0x4f33d9;return db[_0x71e5('0x50')][_0x71e5('0x51')]({'where':{'id':_0x4f33d9[_0x71e5('0x52')]},'attributes':['id',_0x71e5('0x53'),_0x71e5('0x54'),_0x71e5('0x55'),_0x71e5('0x56'),_0x71e5('0x57')],'raw':!![]});})[_0x71e5('0x18')](function(_0xb0c6da){if(_0xb0c6da&&_0xb0c6da['vidaooApiKey']&&_0xb0c6da[_0x71e5('0x54')]){_0x5ce4a9=_0xb0c6da;var _0x43a50b={'interaction':{'id':_0x1aedc6},'agent':{'id':_0x15176b[_0x71e5('0x3e')]['id'],'name':_0x15176b[_0x71e5('0x3e')][_0x71e5('0x2f')],'fullname':_0x15176b[_0x71e5('0x3e')][_0x71e5('0x58')],'email':_0x15176b[_0x71e5('0x3e')][_0x71e5('0x59')]},'contact':_0x15176b[_0x71e5('0x33')][_0x71e5('0x34')],'account':_0x15176b['body'][_0x71e5('0x37')]};var _0x23d852={'rejectUnauthorized':![],'method':'POST','url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0xb0c6da[_0x71e5('0x53')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x15176b[_0x71e5('0x3e')][_0x71e5('0x59')]],'buttons':null,'topic':_0x5ce4a9[_0x71e5('0x55')],'note':_[_0x71e5('0x5a')](_0x5ce4a9[_0x71e5('0x56')])?null:getMustacheRender(_0x5ce4a9['vidaooNote'],_0x43a50b),'metadata':null},'redirect':_0x71e5('0x5b'),'json':!![]};try{if(!_['isNull'](_0x5ce4a9[_0x71e5('0x57')])){var _0x2b4d72=getMustacheRender(_0x5ce4a9[_0x71e5('0x57')],_0x43a50b);var _0x10d835=JSON[_0x71e5('0x5c')](_0x2b4d72);_0x23d852[_0x71e5('0x33')][_0x71e5('0x5d')]=_0x10d835;}}catch(_0x44fbd7){throw new db[(_0x71e5('0x5e'))][(_0x71e5('0x5f'))]('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x23d852);}else{throw new db[(_0x71e5('0x5e'))][(_0x71e5('0x5f'))](_0x71e5('0x60'));}})[_0x71e5('0x18')](function(_0x549b2c){_0x45c5ef=_0x549b2c;if(_0x45c5ef['id']){var _0x6c6af5={'body':_0x45c5ef['join_url'],'ChatWebsiteId':_0x5ce4a9['id'],'ChatInteractionId':_0x4ee2e2['id'],'direction':_0x71e5('0x61'),'UserId':_0x15176b['user']['id']};return db['ChatMessage'][_0x71e5('0x4d')](_0x6c6af5,{});}else{throw new db[(_0x71e5('0x5e'))][(_0x71e5('0x5f'))](_0x71e5('0x62'));}})[_0x71e5('0x18')](function(){return _0x4ee2e2['updateAttributes']({'vidaooSessionId':_0x45c5ef['id']});})[_0x71e5('0x18')](respondWithResult(_0x4b9252,null))[_0x71e5('0x23')](handleError(_0x4b9252,null));};exports[_0x71e5('0x63')]=function(_0x224957,_0x153705){if(_0x224957[_0x71e5('0x33')]['id']){delete _0x224957[_0x71e5('0x33')]['id'];}return db[_0x71e5('0x42')][_0x71e5('0x4c')]({'where':{'id':_0x224957[_0x71e5('0x40')]['id']},'include':[{'model':db[_0x71e5('0x64')],'as':_0x71e5('0x65')}]})[_0x71e5('0x18')](handleEntityNotFound(_0x153705,null))['then'](saveUpdates(_0x224957[_0x71e5('0x33')],null))['then'](respondWithResult(_0x153705,null))[_0x71e5('0x23')](handleError(_0x153705,null));};exports['abandon']=function(_0x2cc560,_0x59e009){if(_0x2cc560['body']['id']){delete _0x2cc560[_0x71e5('0x33')]['id'];}return db[_0x71e5('0x42')][_0x71e5('0x4c')]({'where':{'id':_0x2cc560[_0x71e5('0x40')]['id']}})['then'](function(_0x4f37b0){if(!_0x4f37b0){logger[_0x71e5('0x1d')](_0x71e5('0x66'),_0x71e5('0x67'),0x194,_0x71e5('0x68'));_0x59e009[_0x71e5('0x24')](0x194);}else{if(_0x4f37b0[_0x71e5('0x69')]){throw new db[(_0x71e5('0x5e'))][(_0x71e5('0x5f'))]('Interaction\x20already\x20assigned');}}return _0x4f37b0;})['then'](function(_0x33d1ac){if(_0x33d1ac){return _0x33d1ac['update']({'closed':_0x2cc560['body'][_0x71e5('0x6a')],'disposition':_0x2cc560['body'][_0x71e5('0x6b')]})[_0x71e5('0x18')](function(_0x4dc408){return _0x4dc408;});}})[_0x71e5('0x18')](function(){return respondWithRpcPromise(_0x71e5('0x6c'),_0x71e5('0x67'),_0x2cc560[_0x71e5('0x33')],client9004);})[_0x71e5('0x18')](respondWithResult(_0x59e009,null))[_0x71e5('0x23')](handleError(_0x59e009,null));};exports[_0x71e5('0x6d')]=function(_0x4e8b14,_0x2fa04b){_0x4e8b14[_0x71e5('0x33')]['name']=_0x4e8b14['file']['originalname'];_0x4e8b14[_0x71e5('0x33')]['basename']=_0x4e8b14[_0x71e5('0x6e')][_0x71e5('0x6f')];_0x4e8b14[_0x71e5('0x33')][_0x71e5('0x3b')]=_0x4e8b14['file'][_0x71e5('0x70')];return db[_0x71e5('0x71')][_0x71e5('0x4d')](_0x4e8b14['body'])['then'](respondWithResult(_0x2fa04b,0xc9))['catch'](handleError(_0x2fa04b,null));};exports[_0x71e5('0x72')]=function(_0x32dca8,_0x96715e){return db[_0x71e5('0x42')][_0x71e5('0x51')]({'where':{'id':_0x32dca8['params']['id']},'raw':!![]})[_0x71e5('0x18')](handleEntityNotFound(_0x96715e,null))[_0x71e5('0x18')](function(_0xaf2a6b){if(_0xaf2a6b){if(_0xaf2a6b[_0x71e5('0x6a')]){return _0x96715e['status'](0x193)['json']({'status':0x193,'message':_0x71e5('0x73')});}return db[_0x71e5('0x71')][_0x71e5('0x51')]({'where':{'id':_0x32dca8[_0x71e5('0x3d')][_0x71e5('0x74')]},'raw':!![]})[_0x71e5('0x18')](handleEntityNotFound(_0x96715e,null));}})[_0x71e5('0x18')](function(_0x3b5954){if(_0x3b5954){var _0x4c7911=_0x3b5954[_0x71e5('0x75')]!==null;var _0x24de54=path['join'](config[_0x71e5('0x76')],_0x71e5('0x77'));if(_0x4c7911){_0x24de54=path[_0x71e5('0x78')](_0x24de54,_0x71e5('0x79'));}var _0x25f15d=path[_0x71e5('0x78')](_0x24de54,_0x3b5954[_0x71e5('0x7a')]);return _0x96715e[_0x71e5('0x7b')](_0x25f15d);}})[_0x71e5('0x23')](handleError(_0x96715e,null));};exports[_0x71e5('0x7c')]=function(_0x1a59a2,_0x19d322){var _0x11f0fe=null;var _0x363353=null;var _0x2eff54=null;if(_0x1a59a2[_0x71e5('0x33')]['id']){delete _0x1a59a2['body']['id'];}if(_0x1a59a2[_0x71e5('0x33')][_0x71e5('0x7d')]){_0x2eff54=path['join'](config[_0x71e5('0x76')],_0x71e5('0x7e'),util[_0x71e5('0x7f')]('transcript-%s.txt',Date[_0x71e5('0x80')]()));_0x1a59a2[_0x71e5('0x33')][_0x71e5('0x81')]=_0x2eff54;}return db[_0x71e5('0x42')][_0x71e5('0x4c')]({'where':{'id':_0x1a59a2[_0x71e5('0x40')]['id']},'include':[{'model':db[_0x71e5('0x82')],'as':'Messages','include':[{'model':db[_0x71e5('0x83')],'as':_0x71e5('0x83')}]}]})[_0x71e5('0x18')](handleEntityNotFound(_0x19d322,null))['then'](saveUpdates(_0x1a59a2[_0x71e5('0x33')],null))[_0x71e5('0x18')](function(_0x38529d){if(_0x38529d){_0x11f0fe=_0x38529d;return db[_0x71e5('0x50')][_0x71e5('0x4c')]({'where':{'id':_0x11f0fe[_0x71e5('0x52')]}});}})[_0x71e5('0x18')](function(_0x412d2b){if(_0x412d2b){_0x363353=_0x412d2b;return db[_0x71e5('0x64')]['find']({'where':{'id':_0x11f0fe[_0x71e5('0x84')]}});}})[_0x71e5('0x18')](function(_0x18a97c){if(_0x18a97c){if(_0x2eff54){var _0xaf3434=null;for(var _0x34b3f4=0x1;_0x34b3f4<_0x11f0fe['Messages'][_0x71e5('0x48')];++_0x34b3f4){_0xaf3434=_0x11f0fe[_0x71e5('0x85')][_0x34b3f4];var _0x28e099=_0xaf3434[_0x71e5('0x69')]?util['format'](_0x71e5('0x86'),_0x363353[_0x71e5('0x87')],_0xaf3434[_0x71e5('0x69')]):'System';var _0x57dfa4=_0x1a59a2['body'][_0x71e5('0x88')]||util[_0x71e5('0x7f')]('%s%d',_0x71e5('0x89'),_0xaf3434[_0x71e5('0x84')]);switch(_0x363353['agentIdentifier']){case _0x71e5('0x8a'):_0x28e099=_0xaf3434[_0x71e5('0x69')]?util[_0x71e5('0x7f')]('%s%d',_0x363353[_0x71e5('0x87')],_0xaf3434[_0x71e5('0x69')]):_0x71e5('0x8b');break;case'agent_alias':_0x28e099=_0xaf3434[_0x71e5('0x69')]?_0xaf3434['User'][_0x71e5('0x8c')]||_0xaf3434[_0x71e5('0x83')]['fullname']:_0x71e5('0x8b');break;case _0x71e5('0x8d'):_0x28e099=_0xaf3434[_0x71e5('0x69')]?_0xaf3434[_0x71e5('0x83')][_0x71e5('0x58')]:_0x71e5('0x8b');break;default:_0x28e099=_0xaf3434[_0x71e5('0x69')]?util[_0x71e5('0x7f')](_0x71e5('0x86'),_0x363353['agentAlias'],_0xaf3434[_0x71e5('0x69')]):'System';}var _0x26a9cc=util[_0x71e5('0x7f')]('[%s]\x20%s:\x20%s\x0a',moment(_0xaf3434[_0x71e5('0x8e')])[_0x71e5('0x7f')](_0x71e5('0x8f')),_0xaf3434['direction']==='in'?_0x57dfa4:_0x28e099,_0xaf3434[_0x71e5('0x33')]);if(!_0xaf3434[_0x71e5('0x90')]){fs[_0x71e5('0x91')](_0x2eff54,_0x26a9cc);}}return db['MailAccount'][_0x71e5('0x51')]({'where':{'service':!![]},'include':[{'model':db[_0x71e5('0x92')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x71e5('0x93')],'as':_0x71e5('0x93'),'raw':!![]}]}]});}}})[_0x71e5('0x18')](function(_0x6eea2){if(!_0x6eea2||!_0x6eea2[_0x71e5('0x94')]||!_0x1a59a2['body'])return _0x11f0fe;var _0x362fb2=_0x6eea2['getSmtpOptions']();return respondWithRpcPromise(_0x71e5('0x95'),_0x71e5('0x96'),{'account':_0x362fb2,'message':{'from':util[_0x71e5('0x7f')](_0x71e5('0x97'),_0x6eea2['name'],_0x6eea2[_0x71e5('0x59')]||_0x6eea2[_0x71e5('0x94')][_0x71e5('0x3e')]),'to':_0x1a59a2['body']['mailTranscript'],'subject':_0x71e5('0x98'),'text':util[_0x71e5('0x7f')](_0x71e5('0x99'),_0x1a59a2['body'][_0x71e5('0x7d')]),'attachments':[{'path':_0x2eff54}]}})[_0x71e5('0x18')](function(){return _0x11f0fe;})[_0x71e5('0x23')](function(_0x5f0622){logger['error'](_0x5f0622);});})[_0x71e5('0x18')](respondWithStatusCode(_0x19d322,0xc8))[_0x71e5('0x23')](handleError(_0x19d322,null));};exports[_0x71e5('0x9a')]=function(_0x3dabf0,_0x5cfa0d){return db[_0x71e5('0x82')]['find']({'where':{'id':_0x3dabf0['params']['id']}})[_0x71e5('0x18')](handleEntityNotFound(_0x5cfa0d,null))[_0x71e5('0x18')](function(_0x2567cc){if(_0x2567cc){return _0x2567cc['addMessage'](_0x3dabf0[_0x71e5('0x33')][_0x71e5('0x9b')],_['omit'](_0x3dabf0[_0x71e5('0x33')],['ids','id'])||{});}})['then'](respondWithResult(_0x5cfa0d,null))['catch'](handleError(_0x5cfa0d,null));};exports[_0x71e5('0x9c')]=function(_0x5b6893,_0x333bff){var _0x1ca46c={'raw':![],'where':{}};var _0x4867d0={};var _0x2c9f65={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x71e5('0x51')]({'where':{'id':_0x5b6893['params']['id']}})[_0x71e5('0x18')](handleEntityNotFound(_0x333bff,null))[_0x71e5('0x18')](function(_0x2368b8){if(_0x2368b8){_0x4867d0[_0x71e5('0x41')]=_['keys'](db[_0x71e5('0x82')][_0x71e5('0x39')]);_0x4867d0['query']=_[_0x71e5('0x43')](_0x5b6893[_0x71e5('0x3d')]);_0x4867d0[_0x71e5('0x44')]=_[_0x71e5('0x45')](_0x4867d0['model'],_0x4867d0[_0x71e5('0x3d')]);_0x1ca46c[_0x71e5('0x46')]=_[_0x71e5('0x45')](_0x4867d0[_0x71e5('0x41')],qs[_0x71e5('0x47')](_0x5b6893[_0x71e5('0x3d')][_0x71e5('0x47')]));_0x1ca46c[_0x71e5('0x46')]=_0x1ca46c[_0x71e5('0x46')][_0x71e5('0x48')]?_0x1ca46c[_0x71e5('0x46')]:_0x4867d0[_0x71e5('0x41')];if(!_0x5b6893[_0x71e5('0x3d')]['hasOwnProperty'](_0x71e5('0x9d'))){_0x1ca46c[_0x71e5('0x2a')]=qs['limit'](_0x5b6893[_0x71e5('0x3d')][_0x71e5('0x2a')]);_0x1ca46c['offset']=qs['offset'](_0x5b6893[_0x71e5('0x3d')][_0x71e5('0x28')]);}_0x1ca46c[_0x71e5('0x9e')]=qs[_0x71e5('0x9f')](_0x5b6893[_0x71e5('0x3d')]['sort']);_0x1ca46c[_0x71e5('0xa0')]=qs[_0x71e5('0x44')](_[_0x71e5('0xa1')](_0x5b6893[_0x71e5('0x3d')],_0x4867d0[_0x71e5('0x44')]));_0x1ca46c['where']['ChatInteractionId']=_0x2368b8['id'];if(_0x5b6893[_0x71e5('0x3d')]['filter']){_0x1ca46c[_0x71e5('0xa0')]=_[_0x71e5('0x32')](_0x1ca46c[_0x71e5('0xa0')],{'$or':_['map'](_0x1ca46c[_0x71e5('0x46')],function(_0xb6ae1b){var _0x3057b6={};_0x3057b6[_0xb6ae1b]={'$like':'%'+_0x5b6893[_0x71e5('0x3d')][_0x71e5('0xa2')]+'%'};return _0x3057b6;})});}if(_0x5b6893['query']['$gte']){var _0x2cd393=_0x5b6893['query']['$gte'][_0x71e5('0xa3')](',');var _0x18554b={};_0x18554b[_0x2cd393[0x0]]={'$gte':moment(_0x2cd393[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x1ca46c[_0x71e5('0xa0')]=_[_0x71e5('0x32')](_0x1ca46c[_0x71e5('0xa0')],_0x18554b);}_0x1ca46c=_[_0x71e5('0x32')]({},_0x1ca46c,_0x5b6893['options']);return db[_0x71e5('0x82')][_0x71e5('0xa4')]({'where':_0x1ca46c[_0x71e5('0xa0')]})[_0x71e5('0x18')](function(_0x409854){_0x2c9f65[_0x71e5('0xa4')]=_0x409854;if(_0x5b6893[_0x71e5('0x3d')][_0x71e5('0x49')]){_0x1ca46c['include']=[{'all':!![]}];}return db[_0x71e5('0x82')][_0x71e5('0xa5')](_0x1ca46c);})[_0x71e5('0x18')](function(_0x98c6c2){_0x2c9f65[_0x71e5('0xa6')]=_0x98c6c2;return _0x2c9f65;});}})[_0x71e5('0x18')](respondWithFilteredResult(_0x333bff,_0x1ca46c))[_0x71e5('0x23')](handleError(_0x333bff,null));};exports[_0x71e5('0xa7')]=function(_0x224e2f,_0x5465b0){var _0x37a26a={'where':{}},_0x5f2ff9={},_0x39a0dc={'count':0x0,'rows':[]};return db['ChatInteraction']['findOne']({'where':{'id':_0x224e2f[_0x71e5('0x40')]['id']}})[_0x71e5('0x18')](handleEntityNotFound(_0x5465b0,null))['then'](function(_0x3b1ec2){if(_0x3b1ec2){_0x5f2ff9[_0x71e5('0x41')]=_['keys'](db[_0x71e5('0x82')][_0x71e5('0x39')]);_0x5f2ff9['query']=_[_0x71e5('0x43')](_0x224e2f['query']);_0x5f2ff9[_0x71e5('0x44')]=_[_0x71e5('0x45')](_0x5f2ff9[_0x71e5('0x41')],_0x5f2ff9[_0x71e5('0x3d')]);_0x37a26a[_0x71e5('0x46')]=_[_0x71e5('0x45')](_0x5f2ff9[_0x71e5('0x41')],qs[_0x71e5('0x47')](_0x224e2f['query'][_0x71e5('0x47')]));_0x37a26a[_0x71e5('0x46')]=_0x37a26a['attributes'][_0x71e5('0x48')]?_0x37a26a['attributes']:_0x5f2ff9[_0x71e5('0x41')];if(!_0x224e2f['query'][_0x71e5('0xa8')]('nolimit')){_0x37a26a['limit']=qs['limit'](_0x224e2f['query'][_0x71e5('0x2a')]);_0x37a26a[_0x71e5('0x28')]=qs[_0x71e5('0x28')](_0x224e2f[_0x71e5('0x3d')][_0x71e5('0x28')]);}_0x37a26a[_0x71e5('0x9e')]=qs[_0x71e5('0x9f')](_0x224e2f[_0x71e5('0x3d')][_0x71e5('0x9f')]);_0x37a26a['where']=qs['filters'](_['pick'](_0x224e2f[_0x71e5('0x3d')],_0x5f2ff9[_0x71e5('0x44')]));_0x37a26a[_0x71e5('0xa0')][_0x71e5('0xa9')]=_0x3b1ec2['id'];if(_0x224e2f[_0x71e5('0x3d')][_0x71e5('0xa2')]){_0x37a26a['where']=_[_0x71e5('0x32')](_0x37a26a[_0x71e5('0xa0')],{'$or':_[_0x71e5('0xaa')](_0x37a26a['attributes'],function(_0x419383){var _0x37b5b4={};_0x37b5b4[_0x419383]={'$like':'%'+_0x224e2f[_0x71e5('0x3d')]['filter']+'%'};return _0x37b5b4;})});}_0x37a26a[_0x71e5('0xa0')][_0x71e5('0x90')]=![];if(_0x224e2f[_0x71e5('0x3d')]['id']){_0x37a26a[_0x71e5('0xa0')]['id']={'$gt':_0x224e2f['query']['id']};}_0x37a26a=_[_0x71e5('0x32')]({},_0x37a26a,_0x224e2f[_0x71e5('0x4b')]);return db[_0x71e5('0x82')]['count']({'where':_0x37a26a['where']})[_0x71e5('0x18')](function(_0x382afb){_0x39a0dc['count']=_0x382afb;_0x37a26a[_0x71e5('0x4a')]=[];if(_0x224e2f[_0x71e5('0x3d')][_0x71e5('0xab')]){_0x37a26a[_0x71e5('0x4a')][_0x71e5('0xac')]({'model':db[_0x71e5('0x83')],'as':_0x71e5('0x83'),'attributes':['id',_0x71e5('0x58'),_0x71e5('0x8c')]});}if(_0x224e2f[_0x71e5('0x3d')]['includeAll']){_0x37a26a['include']=[{'all':!![]}];}return db['ChatMessage'][_0x71e5('0xa5')](_0x37a26a);})[_0x71e5('0x18')](function(_0x37241e){_0x39a0dc['rows']=_0x37241e;return _0x39a0dc;});}})[_0x71e5('0x18')](respondWithFilteredResult(_0x5465b0,_0x37a26a))['catch'](handleError(_0x5465b0,null));};exports[_0x71e5('0xad')]=function(_0x327ea5,_0x423db6){return db[_0x71e5('0x42')][_0x71e5('0x4c')]({'where':{'id':_0x327ea5[_0x71e5('0x40')]['id']}})[_0x71e5('0x18')](handleEntityNotFound(_0x423db6,null))['then'](function(_0x880549){if(_0x880549){return _0x880549[_0x71e5('0xae')](_0x327ea5[_0x71e5('0x33')][_0x71e5('0x9b')],_[_0x71e5('0xaf')](_0x327ea5[_0x71e5('0x33')],[_0x71e5('0x9b'),'id'])||{})[_0x71e5('0xb0')](function(){return db['Tag']['findAll']({'attributes':['id',_0x71e5('0x2f'),'color'],'where':{'id':_0x327ea5[_0x71e5('0x33')]['ids']}});})['then'](function(_0x231df3){socket[_0x71e5('0xb1')](_0x71e5('0xb2'),{'id':Number(_0x327ea5[_0x71e5('0x40')]['id']),'tags':_0x231df3||[]});return{'id':Number(_0x327ea5[_0x71e5('0x40')]['id']),'tags':_0x231df3||[]};});}})[_0x71e5('0x18')](respondWithResult(_0x423db6,null))[_0x71e5('0x23')](handleError(_0x423db6,null));};exports['removeTags']=function(_0x32d996,_0x3dedf6){return db[_0x71e5('0x42')][_0x71e5('0x4c')]({'where':{'id':_0x32d996['params']['id']}})['then'](handleEntityNotFound(_0x3dedf6,null))[_0x71e5('0x18')](function(_0x3691b6){if(_0x3691b6){return _0x3691b6['removeTags'](_0x32d996[_0x71e5('0x3d')][_0x71e5('0x9b')]);}})[_0x71e5('0x18')](respondWithStatusCode(_0x3dedf6,null))[_0x71e5('0x23')](handleError(_0x3dedf6,null));};exports[_0x71e5('0x7b')]=function(_0x1cfc06,_0x2d2aef){var _0x59114c=moment()[_0x71e5('0xb3')]()[_0x71e5('0xb4')]();var _0x3f7829=path['join'](config[_0x71e5('0x76')],'server',_0x71e5('0xb5'),_0x71e5('0xb6'));var _0x418a90=path[_0x71e5('0x78')](config['root'],_0x71e5('0xb7'),_0x71e5('0xb5'),_0x71e5('0xb8'));var _0x2e1514=path[_0x71e5('0x78')](_0x3f7829,_0x59114c);var _0x309b42=util[_0x71e5('0x7f')]('transcript-%d-%s.zip',_0x1cfc06[_0x71e5('0x40')]['id'],_0x59114c);var _0x22def5=path['join'](_0x3f7829,_0x309b42);var _0x4cde8d=[];_0x4cde8d[_0x71e5('0xac')]({'model':db['User'],'as':_0x71e5('0x83'),'attributes':['id',_0x71e5('0x58')],'raw':!![]});_0x4cde8d[_0x71e5('0xac')]({'model':db[_0x71e5('0x64')],'as':_0x71e5('0x65'),'attributes':['id','firstName',_0x71e5('0xb9')],'raw':!![]});if(_0x1cfc06[_0x71e5('0x3d')][_0x71e5('0xb8')]){_0x4cde8d[_0x71e5('0xac')]({'model':db['Attachment'],'as':_0x71e5('0x71'),'raw':!![]});}var _0x4a7edc=[{'model':db['ChatMessage'],'as':_0x71e5('0x85'),'attributes':['id',_0x71e5('0x33'),_0x71e5('0x8e'),_0x71e5('0xba'),_0x71e5('0x90'),_0x71e5('0xbb')],'include':_0x4cde8d}];_0x4a7edc[_0x71e5('0xac')]({'model':db[_0x71e5('0x50')],'as':_0x71e5('0xbc'),'attributes':['id',_0x71e5('0x2f')]});_0x4a7edc['push']({'model':db[_0x71e5('0x83')],'as':'Owner','attributes':['id',_0x71e5('0x58')]});return db[_0x71e5('0x42')][_0x71e5('0x4c')]({'where':{'id':_0x1cfc06['params']['id']},'include':_0x4a7edc})[_0x71e5('0x18')](handleEntityNotFound(_0x2d2aef,null))[_0x71e5('0x18')](function(_0x35b069){if(_0x35b069){var _0x4d4c27=_0x35b069[_0x71e5('0xbd')]({'plain':!![]});fs['mkdirSync'](_0x2e1514);var _0x86e45e={'channel':'Chat','account':_0x4d4c27[_0x71e5('0xbc')]['name'],'agent':_0x4d4c27[_0x71e5('0xbe')]?_0x4d4c27[_0x71e5('0xbe')][_0x71e5('0x58')]:_0x71e5('0xbf'),'createdAt':moment(_0x4d4c27[_0x71e5('0x8e')])[_0x71e5('0x7f')](_0x71e5('0xc0'))[_0x71e5('0xb4')](),'closedAt':_0x4d4c27[_0x71e5('0x6a')]?moment(_0x4d4c27[_0x71e5('0xc1')])[_0x71e5('0x7f')](_0x71e5('0xc0'))[_0x71e5('0xb4')]():'','disposition':_0x4d4c27[_0x71e5('0x6b')],'chatInfo':{'browser':_0x4d4c27['browserName'],'os':_0x4d4c27['osName'],'referer':_0x4d4c27[_0x71e5('0xc2')],'customerIp':_0x4d4c27[_0x71e5('0xc3')],'customerPort':_0x4d4c27[_0x71e5('0xc4')]?_0x4d4c27[_0x71e5('0xc4')]:_0x71e5('0xbf')},'messages':_(_0x4d4c27[_0x71e5('0x85')])[_0x71e5('0xc5')]()[_0x71e5('0xa2')]({'secret':![]})['map'](function(_0x565e16){if(_0x565e16[_0x71e5('0x71')]){var _0x2b0554=path[_0x71e5('0x78')](_0x418a90,_0x565e16[_0x71e5('0x71')]['basename']);if(fs[_0x71e5('0xc6')](_0x2b0554)){fs[_0x71e5('0xc7')](_0x2b0554)[_0x71e5('0xc8')](fs[_0x71e5('0xc9')](path[_0x71e5('0x78')](_0x2e1514,_0x565e16[_0x71e5('0x71')][_0x71e5('0x7a')])));}}return{'date':moment(_0x565e16[_0x71e5('0x8e')])['format'](_0x71e5('0xc0'))['toString'](),'sender':_0x565e16[_0x71e5('0xba')]==='out'?_0x565e16['User']?_0x565e16[_0x71e5('0x83')][_0x71e5('0x58')]:'System':_0x565e16[_0x71e5('0x65')][_0x71e5('0xca')]+(_0x565e16[_0x71e5('0x65')][_0x71e5('0xb9')]?'\x20'+_0x565e16[_0x71e5('0x65')][_0x71e5('0xb9')]:''),'body':_0x565e16[_0x71e5('0x71')]?_0x565e16['Attachment'][_0x71e5('0x7a')]:_0x565e16['body'],'direction':_0x565e16[_0x71e5('0xba')]===_0x71e5('0x61')?'A':'C','secret':_0x565e16[_0x71e5('0x90')],'read':_0x565e16['read'],'attachment':_0x565e16[_0x71e5('0x71')]};})[_0x71e5('0xcb')]()};return ejs[_0x71e5('0xcc')](path[_0x71e5('0x78')](config[_0x71e5('0x76')],_0x71e5('0xb7'),_0x71e5('0xcd'),_0x71e5('0xce')),{'interaction':_0x86e45e})['then'](function(_0x4242a4){var _0x2840c8=path[_0x71e5('0x78')](_0x2e1514,_0x71e5('0xcf')+_0x4d4c27['id']+'-'+_0x59114c+_0x71e5('0xd0'));var _0x33b1aa={'path':_0x2840c8,'channel':_0x71e5('0xd1'),'interactionId':_0x4d4c27['id']};return pdf['createPdfFromHTML'](_0x4242a4,_0x33b1aa);})['then'](function(){return new Promise(function(_0xdece94,_0x350663){zipdir(_0x2e1514,{'saveTo':_0x22def5},function(_0x561dc9,_0xc59af6){if(_0x561dc9)return _0x350663(_0x561dc9);return _0xdece94(_0xc59af6);});})[_0x71e5('0x18')](function(){return new BPromise(function(_0x1384af,_0x53b25f){rimraf(_0x2e1514,function(_0xe85a5c){if(_0xe85a5c)_0x53b25f(_0xe85a5c);return _0x1384af();});});})['then'](function(){return _0x2d2aef[_0x71e5('0x7b')](_0x22def5,_0x309b42,function(_0x3c583a){if(_0x3c583a){logger[_0x71e5('0x1d')](_0x71e5('0xd2'),_0x3c583a);}else{fs[_0x71e5('0xd3')](_0x22def5);}});});});}else{return _0x2d2aef[_0x71e5('0x24')](0xc8);}})[_0x71e5('0x23')](handleError(_0x2d2aef,null));}; \ No newline at end of file +var _0x5595=['browserName','osName','referer','customerIp','customerPort','N.A.','tail','existsSync','createReadStream','firstName','value','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','rimraf','mustache','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../mysqldb','redis','defaults','socket.io-emitter','./chatInteraction.socket','register','http','client','request','then','info','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','destroy','stack','name','send','render','merge','contact','interaction','index','map','ChatInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','chat','user','show','params','model','keys','query','filters','intersection','attributes','fields','length','includeAll','options','find','create','body','update','describe','createVidaooSession','ChatWebsite','ChatWebsiteId','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','account','POST','https://api-vidaoo.xcally.com/api/v1/meetings','vidaooApiKey','email','isNull','follow','parse','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','out','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','Contact','abandon','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','attachmentUpload','file','basename','filename','mimetype','Attachment','findOne','Unauthorized','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','close','server/files/chat/upload/','format','transcript-%s.txt','now','Messages','User','ContactId','%s%d','agentAlias','System','Visitor','agentIdentifier','website_alias','agent_alias','alias','fullname','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','MailAccount','MailServerOut','CloudProvider','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ChatMessage','ids','getMessages','hasOwnProperty','nolimit','order','sort','where','pick','ChatInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','include','rows','getMyMessages','secret','push','addTags','setTags','Tag','color','emit','chatInteractionTags:save','removeTags','unix','server','tmp','files','attachments','transcript-%d-%s.zip','lastName','read','Account','get','mkdirSync','Chat','Owner','closedAt','toString'];(function(_0x2d5a9d,_0x499b8c){var _0x40fd1f=function(_0x3ec2ef){while(--_0x3ec2ef){_0x2d5a9d['push'](_0x2d5a9d['shift']());}};_0x40fd1f(++_0x499b8c);}(_0x5595,0xe4));var _0x5559=function(_0x5c8020,_0x1f3a3a){_0x5c8020=_0x5c8020-0x0;var _0x4c835a=_0x5595[_0x5c8020];return _0x4c835a;};'use strict';var rimraf=require(_0x5559('0x0'));var zipdir=require('zip-dir');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5559('0x1'));var util=require('util');var path=require('path');var ejs=require(_0x5559('0x2'));var fs=require('fs');var _=require(_0x5559('0x3'));var Redis=require(_0x5559('0x4'));var interaction=require(_0x5559('0x5'));var qs=require(_0x5559('0x6'));var pdf=require(_0x5559('0x7'));var logger=require(_0x5559('0x8'))(_0x5559('0x9'));var config=require('../../config/environment');var db=require(_0x5559('0xa'))['db'];config[_0x5559('0xb')]=_[_0x5559('0xc')](config[_0x5559('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x5559('0xd'))(new Redis(config[_0x5559('0xb')]));require(_0x5559('0xe'))[_0x5559('0xf')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x5559('0x10')]({'port':0x232b});var client9004=jayson[_0x5559('0x11')]['http']({'port':0x232c});function respondWithRpcPromise(_0x2208e4,_0x289a04,_0x284fd7,_0x3f9c73){return new BPromise(function(_0x35e478,_0x548f14){var _0x314ae2=_0x3f9c73||client;return _0x314ae2[_0x5559('0x12')](_0x2208e4,_0x284fd7)[_0x5559('0x13')](function(_0x4276ce){logger[_0x5559('0x14')]('ChatInteraction,\x20%s,\x20%s',_0x289a04,_0x5559('0x15'));logger['debug'](_0x5559('0x16'),_0x289a04,_0x5559('0x15'),JSON[_0x5559('0x17')](_0x4276ce));if(_0x4276ce[_0x5559('0x18')]){if(_0x4276ce[_0x5559('0x18')][_0x5559('0x19')]===0x1f4){logger['error'](_0x5559('0x1a'),_0x289a04,_0x4276ce[_0x5559('0x18')][_0x5559('0x1b')]);return _0x548f14(_0x4276ce['error'][_0x5559('0x1b')]);}logger['error']('ChatInteraction,\x20%s,\x20%s',_0x289a04,_0x4276ce['error'][_0x5559('0x1b')]);return _0x35e478(_0x4276ce[_0x5559('0x18')][_0x5559('0x1b')]);}else{logger[_0x5559('0x14')](_0x5559('0x1a'),_0x289a04,_0x5559('0x15'));_0x35e478(_0x4276ce[_0x5559('0x1c')][_0x5559('0x1b')]);}})[_0x5559('0x1d')](function(_0x3d1075){logger[_0x5559('0x18')](_0x5559('0x1a'),_0x289a04,_0x3d1075);_0x548f14(_0x3d1075);});});}function respondWithStatusCode(_0x389147,_0x4a942a){_0x4a942a=_0x4a942a||0xcc;return function(_0x30d2aa){if(_0x30d2aa){return _0x389147[_0x5559('0x1e')](_0x4a942a);}return _0x389147[_0x5559('0x1f')](_0x4a942a)[_0x5559('0x20')]();};}function respondWithResult(_0x2aa819,_0x1bed36){_0x1bed36=_0x1bed36||0xc8;return function(_0x1426e7){if(_0x1426e7){return _0x2aa819[_0x5559('0x1f')](_0x1bed36)[_0x5559('0x21')](_0x1426e7);}};}function respondWithFilteredResult(_0x21412e,_0x4bf08b){return function(_0x58e391){if(_0x58e391){var _0x4cb2ad=typeof _0x4bf08b[_0x5559('0x22')]===_0x5559('0x23')&&typeof _0x4bf08b[_0x5559('0x24')]===_0x5559('0x23');var _0x146861=_0x58e391[_0x5559('0x25')];var _0x3798e0=_0x4cb2ad?0x0:_0x4bf08b[_0x5559('0x22')];var _0x5e9392=_0x4cb2ad?_0x58e391[_0x5559('0x25')]:_0x4bf08b[_0x5559('0x22')]+_0x4bf08b[_0x5559('0x24')];var _0x25ca5e;if(_0x5e9392>=_0x146861){_0x5e9392=_0x146861;_0x25ca5e=0xc8;}else{_0x25ca5e=0xce;}_0x21412e[_0x5559('0x1f')](_0x25ca5e);return _0x21412e[_0x5559('0x26')](_0x5559('0x27'),_0x3798e0+'-'+_0x5e9392+'/'+_0x146861)['json'](_0x58e391);}return null;};}function saveUpdates(_0x32f113){return function(_0x4e732c){if(_0x4e732c){return _0x4e732c['update'](_0x32f113)['then'](function(_0x2bcc72){return _0x2bcc72;});}return null;};}function removeEntity(_0x3e6a8c){return function(_0x2a9567){if(_0x2a9567){return _0x2a9567[_0x5559('0x28')]()[_0x5559('0x13')](function(){_0x3e6a8c[_0x5559('0x1f')](0xcc)[_0x5559('0x20')]();});}};}function handleEntityNotFound(_0x4fa5f5){return function(_0x4b3631){if(!_0x4b3631){_0x4fa5f5[_0x5559('0x1e')](0x194);}return _0x4b3631;};}function handleError(_0x2ca821,_0x1fcf7a){_0x1fcf7a=_0x1fcf7a||0x1f4;return function(_0x425419){logger[_0x5559('0x18')](_0x425419[_0x5559('0x29')]);if(_0x425419[_0x5559('0x2a')]){delete _0x425419[_0x5559('0x2a')];}_0x2ca821['status'](_0x1fcf7a)[_0x5559('0x2b')](_0x425419);};}function getMustacheRender(_0x22b96d,_0x2b9301){return Mustache[_0x5559('0x2c')](_0x22b96d,_[_0x5559('0x2d')](_0x2b9301['body'],{'contact':_0x2b9301[_0x5559('0x2e')],'message':_0x2b9301[_0x5559('0x1b')],'agent':_0x2b9301['agent'],'interaction':_0x2b9301[_0x5559('0x2f')],'account':_0x2b9301['account']}))||'';}exports[_0x5559('0x30')]=function(_0x4e27a7,_0x3d25df){var _0x3d2f59={};var _0x1cc3ad=_[_0x5559('0x31')](db[_0x5559('0x32')][_0x5559('0x33')],function(_0x9c7a49){return{'name':_0x9c7a49[_0x5559('0x34')],'type':_0x9c7a49[_0x5559('0x35')][_0x5559('0x36')]};});_0x3d2f59=qs[_0x5559('0x37')](_0x1cc3ad,_0x4e27a7);return interaction[_0x5559('0x38')](_0x5559('0x39'),_0x4e27a7['query'],_0x4e27a7[_0x5559('0x3a')],_0x3d2f59,_0x1cc3ad)['then'](respondWithFilteredResult(_0x3d25df,_0x3d2f59))[_0x5559('0x1d')](handleError(_0x3d25df,null));};exports[_0x5559('0x3b')]=function(_0x5bfe2e,_0x5a7846){var _0x3301e8={'raw':![],'where':{'id':_0x5bfe2e[_0x5559('0x3c')]['id']}},_0x42a221={};_0x42a221[_0x5559('0x3d')]=_[_0x5559('0x3e')](db[_0x5559('0x32')][_0x5559('0x33')]);_0x42a221[_0x5559('0x3f')]=_[_0x5559('0x3e')](_0x5bfe2e['query']);_0x42a221[_0x5559('0x40')]=_[_0x5559('0x41')](_0x42a221[_0x5559('0x3d')],_0x42a221[_0x5559('0x3f')]);_0x3301e8[_0x5559('0x42')]=_['intersection'](_0x42a221['model'],qs[_0x5559('0x43')](_0x5bfe2e[_0x5559('0x3f')]['fields']));_0x3301e8[_0x5559('0x42')]=_0x3301e8[_0x5559('0x42')][_0x5559('0x44')]?_0x3301e8[_0x5559('0x42')]:_0x42a221[_0x5559('0x3d')];if(_0x5bfe2e['query'][_0x5559('0x45')]){_0x3301e8['include']=[{'all':!![]}];}_0x3301e8=_[_0x5559('0x2d')]({},_0x3301e8,_0x5bfe2e[_0x5559('0x46')]);return db[_0x5559('0x32')][_0x5559('0x47')](_0x3301e8)[_0x5559('0x13')](handleEntityNotFound(_0x5a7846,null))['then'](respondWithResult(_0x5a7846,null))['catch'](handleError(_0x5a7846,null));};exports[_0x5559('0x48')]=function(_0x417e3d,_0x280e8a){return db[_0x5559('0x32')]['create'](_0x417e3d[_0x5559('0x49')],{})['then'](respondWithResult(_0x280e8a,0xc9))[_0x5559('0x1d')](handleError(_0x280e8a,null));};exports[_0x5559('0x4a')]=function(_0x2d917a,_0x2c9d0){if(_0x2d917a[_0x5559('0x49')]['id']){delete _0x2d917a[_0x5559('0x49')]['id'];}return db[_0x5559('0x32')][_0x5559('0x47')]({'where':{'id':_0x2d917a[_0x5559('0x3c')]['id']}})[_0x5559('0x13')](handleEntityNotFound(_0x2c9d0,null))[_0x5559('0x13')](saveUpdates(_0x2d917a['body'],null))['then'](respondWithResult(_0x2c9d0,null))[_0x5559('0x1d')](handleError(_0x2c9d0,null));};exports[_0x5559('0x28')]=function(_0x1ed677,_0xb7b56b){return db[_0x5559('0x32')][_0x5559('0x47')]({'where':{'id':_0x1ed677[_0x5559('0x3c')]['id']}})['then'](handleEntityNotFound(_0xb7b56b,null))[_0x5559('0x13')](removeEntity(_0xb7b56b,null))[_0x5559('0x1d')](handleError(_0xb7b56b,null));};exports[_0x5559('0x4b')]=function(_0xf0d8f9,_0x184ba1){return db[_0x5559('0x32')][_0x5559('0x4b')]()[_0x5559('0x13')](respondWithResult(_0x184ba1,null))[_0x5559('0x1d')](handleError(_0x184ba1,null));};exports[_0x5559('0x4c')]=function(_0x216bb6,_0x2d7aeb){var _0x469bc3=_0x216bb6[_0x5559('0x3c')]['id'];var _0x6e8db0;var _0x4d08e6;var _0x5c9bfe;return db[_0x5559('0x32')]['findOne']({'where':{'id':_0x469bc3}})['then'](function(_0x1d1b17){_0x6e8db0=_0x1d1b17;return db[_0x5559('0x4d')]['findOne']({'where':{'id':_0x1d1b17[_0x5559('0x4e')]},'attributes':['id','vidaooApiKey',_0x5559('0x4f'),_0x5559('0x50'),_0x5559('0x51'),_0x5559('0x52')],'raw':!![]});})['then'](function(_0x2b5207){if(_0x2b5207&&_0x2b5207['vidaooApiKey']&&_0x2b5207[_0x5559('0x4f')]){_0x4d08e6=_0x2b5207;var _0x5de5e3={'interaction':{'id':_0x469bc3},'agent':{'id':_0x216bb6[_0x5559('0x3a')]['id'],'name':_0x216bb6[_0x5559('0x3a')][_0x5559('0x2a')],'fullname':_0x216bb6[_0x5559('0x3a')]['fullname'],'email':_0x216bb6['user']['email']},'contact':_0x216bb6[_0x5559('0x49')]['contact'],'account':_0x216bb6['body'][_0x5559('0x53')]};var _0x138302={'rejectUnauthorized':![],'method':_0x5559('0x54'),'url':_0x5559('0x55'),'headers':{'X-APIKEY':_0x2b5207[_0x5559('0x56')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x216bb6[_0x5559('0x3a')][_0x5559('0x57')]],'buttons':null,'topic':_0x4d08e6[_0x5559('0x50')],'note':_[_0x5559('0x58')](_0x4d08e6[_0x5559('0x51')])?null:getMustacheRender(_0x4d08e6[_0x5559('0x51')],_0x5de5e3),'metadata':null},'redirect':_0x5559('0x59'),'json':!![]};try{if(!_[_0x5559('0x58')](_0x4d08e6[_0x5559('0x52')])){var _0x2d8f88=getMustacheRender(_0x4d08e6[_0x5559('0x52')],_0x5de5e3);var _0x2143f6=JSON[_0x5559('0x5a')](_0x2d8f88);_0x138302[_0x5559('0x49')][_0x5559('0x5b')]=_0x2143f6;}}catch(_0x361080){throw new db[(_0x5559('0x5c'))][(_0x5559('0x5d'))](_0x5559('0x5e'));}return rp(_0x138302);}else{throw new db['Sequelize'][(_0x5559('0x5d'))]('Error\x20in\x20Vidaoo\x20configuration');}})[_0x5559('0x13')](function(_0x4b7995){_0x5c9bfe=_0x4b7995;if(_0x5c9bfe['id']){var _0x1c0b96={'body':_0x5c9bfe['join_url'],'ChatWebsiteId':_0x4d08e6['id'],'ChatInteractionId':_0x6e8db0['id'],'direction':_0x5559('0x5f'),'UserId':_0x216bb6[_0x5559('0x3a')]['id']};return db['ChatMessage']['create'](_0x1c0b96,{});}else{throw new db[(_0x5559('0x5c'))][(_0x5559('0x5d'))](_0x5559('0x60'));}})[_0x5559('0x13')](function(){return _0x6e8db0[_0x5559('0x61')]({'vidaooSessionId':_0x5c9bfe['id']});})[_0x5559('0x13')](respondWithResult(_0x2d7aeb,null))[_0x5559('0x1d')](handleError(_0x2d7aeb,null));};exports[_0x5559('0x62')]=function(_0x2a603b,_0x2057b7){if(_0x2a603b['body']['id']){delete _0x2a603b[_0x5559('0x49')]['id'];}return db[_0x5559('0x32')][_0x5559('0x47')]({'where':{'id':_0x2a603b[_0x5559('0x3c')]['id']},'include':[{'model':db[_0x5559('0x63')],'as':_0x5559('0x64')}]})[_0x5559('0x13')](handleEntityNotFound(_0x2057b7,null))[_0x5559('0x13')](saveUpdates(_0x2a603b[_0x5559('0x49')],null))[_0x5559('0x13')](respondWithResult(_0x2057b7,null))[_0x5559('0x1d')](handleError(_0x2057b7,null));};exports[_0x5559('0x65')]=function(_0x3d2f11,_0x2d29f7){if(_0x3d2f11[_0x5559('0x49')]['id']){delete _0x3d2f11[_0x5559('0x49')]['id'];}return db[_0x5559('0x32')][_0x5559('0x47')]({'where':{'id':_0x3d2f11[_0x5559('0x3c')]['id']}})[_0x5559('0x13')](function(_0x142134){if(!_0x142134){logger[_0x5559('0x18')]('abandonInteraction,\x20%s,\x20%s,\x20%s','abandon',0x194,_0x5559('0x66'));_0x2d29f7[_0x5559('0x1e')](0x194);}else{if(_0x142134[_0x5559('0x67')]){throw new db[(_0x5559('0x5c'))][(_0x5559('0x5d'))](_0x5559('0x68'));}}return _0x142134;})[_0x5559('0x13')](function(_0x2675cf){if(_0x2675cf){return _0x2675cf[_0x5559('0x4a')]({'closed':_0x3d2f11[_0x5559('0x49')][_0x5559('0x69')],'disposition':_0x3d2f11[_0x5559('0x49')][_0x5559('0x6a')]})[_0x5559('0x13')](function(_0x18c649){return _0x18c649;});}})[_0x5559('0x13')](function(){return respondWithRpcPromise(_0x5559('0x6b'),'abandon',_0x3d2f11[_0x5559('0x49')],client9004);})[_0x5559('0x13')](respondWithResult(_0x2d29f7,null))[_0x5559('0x1d')](handleError(_0x2d29f7,null));};exports[_0x5559('0x6c')]=function(_0x18717d,_0x3665ce){_0x18717d[_0x5559('0x49')][_0x5559('0x2a')]=_0x18717d[_0x5559('0x6d')]['originalname'];_0x18717d[_0x5559('0x49')][_0x5559('0x6e')]=_0x18717d[_0x5559('0x6d')][_0x5559('0x6f')];_0x18717d[_0x5559('0x49')][_0x5559('0x35')]=_0x18717d[_0x5559('0x6d')][_0x5559('0x70')];return db[_0x5559('0x71')]['create'](_0x18717d[_0x5559('0x49')])[_0x5559('0x13')](respondWithResult(_0x3665ce,0xc9))[_0x5559('0x1d')](handleError(_0x3665ce,null));};exports['attachmentDownload']=function(_0x4164a5,_0x38e299){return db['ChatInteraction'][_0x5559('0x72')]({'where':{'id':_0x4164a5['params']['id']},'raw':!![]})[_0x5559('0x13')](handleEntityNotFound(_0x38e299,null))[_0x5559('0x13')](function(_0x5663fa){if(_0x5663fa){if(_0x5663fa[_0x5559('0x69')]){return _0x38e299[_0x5559('0x1f')](0x193)[_0x5559('0x21')]({'status':0x193,'message':_0x5559('0x73')});}return db[_0x5559('0x71')][_0x5559('0x72')]({'where':{'id':_0x4164a5['query']['attachId']},'raw':!![]})[_0x5559('0x13')](handleEntityNotFound(_0x38e299,null));}})[_0x5559('0x13')](function(_0x56f4b7){if(_0x56f4b7){var _0x1cd61d=_0x56f4b7[_0x5559('0x74')]!==null;var _0x240a97=path[_0x5559('0x75')](config[_0x5559('0x76')],_0x5559('0x77'));if(_0x1cd61d){_0x240a97=path[_0x5559('0x75')](_0x240a97,_0x5559('0x78'));}var _0x220fb9=path['join'](_0x240a97,_0x56f4b7[_0x5559('0x6e')]);return _0x38e299[_0x5559('0x79')](_0x220fb9);}})[_0x5559('0x1d')](handleError(_0x38e299,null));};exports[_0x5559('0x7a')]=function(_0x225576,_0x55d912){var _0x26a487=null;var _0x4ce132=null;var _0x563ec1=null;if(_0x225576[_0x5559('0x49')]['id']){delete _0x225576[_0x5559('0x49')]['id'];}if(_0x225576[_0x5559('0x49')]['mailTranscript']){_0x563ec1=path[_0x5559('0x75')](config[_0x5559('0x76')],_0x5559('0x7b'),util[_0x5559('0x7c')](_0x5559('0x7d'),Date[_0x5559('0x7e')]()));_0x225576['body']['pathTranscript']=_0x563ec1;}return db['ChatInteraction'][_0x5559('0x47')]({'where':{'id':_0x225576[_0x5559('0x3c')]['id']},'include':[{'model':db['ChatMessage'],'as':_0x5559('0x7f'),'include':[{'model':db[_0x5559('0x80')],'as':_0x5559('0x80')}]}]})[_0x5559('0x13')](handleEntityNotFound(_0x55d912,null))[_0x5559('0x13')](saveUpdates(_0x225576[_0x5559('0x49')],null))[_0x5559('0x13')](function(_0x31f4e3){if(_0x31f4e3){_0x26a487=_0x31f4e3;return db['ChatWebsite'][_0x5559('0x47')]({'where':{'id':_0x26a487[_0x5559('0x4e')]}});}})[_0x5559('0x13')](function(_0x167280){if(_0x167280){_0x4ce132=_0x167280;return db[_0x5559('0x63')][_0x5559('0x47')]({'where':{'id':_0x26a487[_0x5559('0x81')]}});}})[_0x5559('0x13')](function(_0x3718cd){if(_0x3718cd){if(_0x563ec1){var _0x2b2452=null;for(var _0x1dab61=0x1;_0x1dab61<_0x26a487[_0x5559('0x7f')]['length'];++_0x1dab61){_0x2b2452=_0x26a487[_0x5559('0x7f')][_0x1dab61];var _0x42b29c=_0x2b2452[_0x5559('0x67')]?util[_0x5559('0x7c')](_0x5559('0x82'),_0x4ce132[_0x5559('0x83')],_0x2b2452[_0x5559('0x67')]):_0x5559('0x84');var _0xed2e2c=_0x225576[_0x5559('0x49')]['customer']||util[_0x5559('0x7c')](_0x5559('0x82'),_0x5559('0x85'),_0x2b2452[_0x5559('0x81')]);switch(_0x4ce132[_0x5559('0x86')]){case _0x5559('0x87'):_0x42b29c=_0x2b2452['UserId']?util[_0x5559('0x7c')]('%s%d',_0x4ce132[_0x5559('0x83')],_0x2b2452[_0x5559('0x67')]):_0x5559('0x84');break;case _0x5559('0x88'):_0x42b29c=_0x2b2452[_0x5559('0x67')]?_0x2b2452[_0x5559('0x80')][_0x5559('0x89')]||_0x2b2452['User'][_0x5559('0x8a')]:'System';break;case'agent_fullname':_0x42b29c=_0x2b2452[_0x5559('0x67')]?_0x2b2452['User'][_0x5559('0x8a')]:'System';break;default:_0x42b29c=_0x2b2452[_0x5559('0x67')]?util[_0x5559('0x7c')](_0x5559('0x82'),_0x4ce132[_0x5559('0x83')],_0x2b2452[_0x5559('0x67')]):_0x5559('0x84');}var _0x4909d6=util['format']('[%s]\x20%s:\x20%s\x0a',moment(_0x2b2452[_0x5559('0x8b')])[_0x5559('0x7c')](_0x5559('0x8c')),_0x2b2452[_0x5559('0x8d')]==='in'?_0xed2e2c:_0x42b29c,_0x2b2452['body']);if(!_0x2b2452['secret']){fs['appendFileSync'](_0x563ec1,_0x4909d6);}}return db[_0x5559('0x8e')][_0x5559('0x72')]({'where':{'service':!![]},'include':[{'model':db[_0x5559('0x8f')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x5559('0x90')],'as':_0x5559('0x90'),'raw':!![]}]}]});}}})[_0x5559('0x13')](function(_0x5c59f7){if(!_0x5c59f7||!_0x5c59f7['Smtp']||!_0x225576[_0x5559('0x49')])return _0x26a487;var _0x655f0b=_0x5c59f7['getSmtpOptions']();return respondWithRpcPromise(_0x5559('0x91'),_0x5559('0x92'),{'account':_0x655f0b,'message':{'from':util[_0x5559('0x7c')](_0x5559('0x93'),_0x5c59f7[_0x5559('0x2a')],_0x5c59f7[_0x5559('0x57')]||_0x5c59f7['Smtp'][_0x5559('0x3a')]),'to':_0x225576[_0x5559('0x49')]['mailTranscript'],'subject':_0x5559('0x94'),'text':util['format'](_0x5559('0x95'),_0x225576[_0x5559('0x49')]['mailTranscript']),'attachments':[{'path':_0x563ec1}]}})[_0x5559('0x13')](function(){return _0x26a487;})['catch'](function(_0x2aa9e3){logger['error'](_0x2aa9e3);});})['then'](respondWithStatusCode(_0x55d912,0xc8))[_0x5559('0x1d')](handleError(_0x55d912,null));};exports[_0x5559('0x96')]=function(_0x5c6c38,_0x3aee72){return db[_0x5559('0x97')][_0x5559('0x47')]({'where':{'id':_0x5c6c38[_0x5559('0x3c')]['id']}})[_0x5559('0x13')](handleEntityNotFound(_0x3aee72,null))[_0x5559('0x13')](function(_0x335125){if(_0x335125){return _0x335125[_0x5559('0x96')](_0x5c6c38[_0x5559('0x49')][_0x5559('0x98')],_['omit'](_0x5c6c38[_0x5559('0x49')],['ids','id'])||{});}})[_0x5559('0x13')](respondWithResult(_0x3aee72,null))['catch'](handleError(_0x3aee72,null));};exports[_0x5559('0x99')]=function(_0xeff41b,_0x18cd36){var _0x470c36={'raw':![],'where':{}};var _0x5a28c7={};var _0x1e23e0={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x5559('0x72')]({'where':{'id':_0xeff41b[_0x5559('0x3c')]['id']}})[_0x5559('0x13')](handleEntityNotFound(_0x18cd36,null))[_0x5559('0x13')](function(_0x5250b5){if(_0x5250b5){_0x5a28c7[_0x5559('0x3d')]=_[_0x5559('0x3e')](db[_0x5559('0x97')][_0x5559('0x33')]);_0x5a28c7[_0x5559('0x3f')]=_[_0x5559('0x3e')](_0xeff41b['query']);_0x5a28c7[_0x5559('0x40')]=_['intersection'](_0x5a28c7['model'],_0x5a28c7[_0x5559('0x3f')]);_0x470c36[_0x5559('0x42')]=_[_0x5559('0x41')](_0x5a28c7[_0x5559('0x3d')],qs[_0x5559('0x43')](_0xeff41b[_0x5559('0x3f')][_0x5559('0x43')]));_0x470c36[_0x5559('0x42')]=_0x470c36['attributes'][_0x5559('0x44')]?_0x470c36[_0x5559('0x42')]:_0x5a28c7['model'];if(!_0xeff41b[_0x5559('0x3f')][_0x5559('0x9a')](_0x5559('0x9b'))){_0x470c36[_0x5559('0x24')]=qs[_0x5559('0x24')](_0xeff41b['query']['limit']);_0x470c36[_0x5559('0x22')]=qs[_0x5559('0x22')](_0xeff41b[_0x5559('0x3f')][_0x5559('0x22')]);}_0x470c36[_0x5559('0x9c')]=qs[_0x5559('0x9d')](_0xeff41b[_0x5559('0x3f')]['sort']);_0x470c36[_0x5559('0x9e')]=qs[_0x5559('0x40')](_[_0x5559('0x9f')](_0xeff41b[_0x5559('0x3f')],_0x5a28c7[_0x5559('0x40')]));_0x470c36[_0x5559('0x9e')][_0x5559('0xa0')]=_0x5250b5['id'];if(_0xeff41b[_0x5559('0x3f')][_0x5559('0xa1')]){_0x470c36['where']=_[_0x5559('0x2d')](_0x470c36[_0x5559('0x9e')],{'$or':_[_0x5559('0x31')](_0x470c36[_0x5559('0x42')],function(_0x203407){var _0x2933f2={};_0x2933f2[_0x203407]={'$like':'%'+_0xeff41b[_0x5559('0x3f')]['filter']+'%'};return _0x2933f2;})});}if(_0xeff41b['query'][_0x5559('0xa2')]){var _0x296887=_0xeff41b['query']['$gte'][_0x5559('0xa3')](',');var _0xecd74a={};_0xecd74a[_0x296887[0x0]]={'$gte':moment(_0x296887[0x1])[_0x5559('0x7c')](_0x5559('0xa4'))};_0x470c36[_0x5559('0x9e')]=_[_0x5559('0x2d')](_0x470c36['where'],_0xecd74a);}_0x470c36=_[_0x5559('0x2d')]({},_0x470c36,_0xeff41b[_0x5559('0x46')]);return db['ChatMessage']['count']({'where':_0x470c36[_0x5559('0x9e')]})[_0x5559('0x13')](function(_0x39d217){_0x1e23e0['count']=_0x39d217;if(_0xeff41b['query'][_0x5559('0x45')]){_0x470c36[_0x5559('0xa5')]=[{'all':!![]}];}return db[_0x5559('0x97')][_0x5559('0x38')](_0x470c36);})['then'](function(_0x20f926){_0x1e23e0[_0x5559('0xa6')]=_0x20f926;return _0x1e23e0;});}})[_0x5559('0x13')](respondWithFilteredResult(_0x18cd36,_0x470c36))[_0x5559('0x1d')](handleError(_0x18cd36,null));};exports[_0x5559('0xa7')]=function(_0x376f19,_0x1144c4){var _0x330dfc={'where':{}},_0x5398ab={},_0x1a04ee={'count':0x0,'rows':[]};return db[_0x5559('0x32')][_0x5559('0x72')]({'where':{'id':_0x376f19[_0x5559('0x3c')]['id']}})[_0x5559('0x13')](handleEntityNotFound(_0x1144c4,null))[_0x5559('0x13')](function(_0x5ccb79){if(_0x5ccb79){_0x5398ab['model']=_[_0x5559('0x3e')](db['ChatMessage'][_0x5559('0x33')]);_0x5398ab[_0x5559('0x3f')]=_[_0x5559('0x3e')](_0x376f19[_0x5559('0x3f')]);_0x5398ab[_0x5559('0x40')]=_[_0x5559('0x41')](_0x5398ab['model'],_0x5398ab[_0x5559('0x3f')]);_0x330dfc['attributes']=_[_0x5559('0x41')](_0x5398ab[_0x5559('0x3d')],qs[_0x5559('0x43')](_0x376f19['query'][_0x5559('0x43')]));_0x330dfc[_0x5559('0x42')]=_0x330dfc[_0x5559('0x42')]['length']?_0x330dfc[_0x5559('0x42')]:_0x5398ab['model'];if(!_0x376f19[_0x5559('0x3f')][_0x5559('0x9a')]('nolimit')){_0x330dfc[_0x5559('0x24')]=qs['limit'](_0x376f19[_0x5559('0x3f')][_0x5559('0x24')]);_0x330dfc[_0x5559('0x22')]=qs[_0x5559('0x22')](_0x376f19[_0x5559('0x3f')]['offset']);}_0x330dfc[_0x5559('0x9c')]=qs[_0x5559('0x9d')](_0x376f19['query']['sort']);_0x330dfc[_0x5559('0x9e')]=qs[_0x5559('0x40')](_['pick'](_0x376f19['query'],_0x5398ab[_0x5559('0x40')]));_0x330dfc['where'][_0x5559('0xa0')]=_0x5ccb79['id'];if(_0x376f19[_0x5559('0x3f')]['filter']){_0x330dfc[_0x5559('0x9e')]=_[_0x5559('0x2d')](_0x330dfc[_0x5559('0x9e')],{'$or':_['map'](_0x330dfc[_0x5559('0x42')],function(_0x4c7869){var _0x53e0ef={};_0x53e0ef[_0x4c7869]={'$like':'%'+_0x376f19[_0x5559('0x3f')]['filter']+'%'};return _0x53e0ef;})});}_0x330dfc[_0x5559('0x9e')][_0x5559('0xa8')]=![];if(_0x376f19[_0x5559('0x3f')]['id']){_0x330dfc[_0x5559('0x9e')]['id']={'$gt':_0x376f19[_0x5559('0x3f')]['id']};}_0x330dfc=_[_0x5559('0x2d')]({},_0x330dfc,_0x376f19['options']);return db[_0x5559('0x97')][_0x5559('0x25')]({'where':_0x330dfc[_0x5559('0x9e')]})['then'](function(_0x7fb6e1){_0x1a04ee[_0x5559('0x25')]=_0x7fb6e1;_0x330dfc['include']=[];if(_0x376f19['query']['includeAgent']){_0x330dfc['include'][_0x5559('0xa9')]({'model':db[_0x5559('0x80')],'as':_0x5559('0x80'),'attributes':['id',_0x5559('0x8a'),'alias']});}if(_0x376f19[_0x5559('0x3f')][_0x5559('0x45')]){_0x330dfc[_0x5559('0xa5')]=[{'all':!![]}];}return db[_0x5559('0x97')][_0x5559('0x38')](_0x330dfc);})[_0x5559('0x13')](function(_0x5376f5){_0x1a04ee[_0x5559('0xa6')]=_0x5376f5;return _0x1a04ee;});}})[_0x5559('0x13')](respondWithFilteredResult(_0x1144c4,_0x330dfc))[_0x5559('0x1d')](handleError(_0x1144c4,null));};exports[_0x5559('0xaa')]=function(_0x1f5fe2,_0x38f282){return db[_0x5559('0x32')][_0x5559('0x47')]({'where':{'id':_0x1f5fe2[_0x5559('0x3c')]['id']}})['then'](handleEntityNotFound(_0x38f282,null))[_0x5559('0x13')](function(_0x482d26){if(_0x482d26){return _0x482d26[_0x5559('0xab')](_0x1f5fe2[_0x5559('0x49')]['ids'],_['omit'](_0x1f5fe2['body'],[_0x5559('0x98'),'id'])||{})['spread'](function(){return db[_0x5559('0xac')][_0x5559('0x38')]({'attributes':['id',_0x5559('0x2a'),_0x5559('0xad')],'where':{'id':_0x1f5fe2[_0x5559('0x49')][_0x5559('0x98')]}});})[_0x5559('0x13')](function(_0x56a7fb){socket[_0x5559('0xae')](_0x5559('0xaf'),{'id':Number(_0x1f5fe2[_0x5559('0x3c')]['id']),'tags':_0x56a7fb||[]});return{'id':Number(_0x1f5fe2['params']['id']),'tags':_0x56a7fb||[]};});}})[_0x5559('0x13')](respondWithResult(_0x38f282,null))[_0x5559('0x1d')](handleError(_0x38f282,null));};exports[_0x5559('0xb0')]=function(_0x3b80eb,_0x476305){return db['ChatInteraction'][_0x5559('0x47')]({'where':{'id':_0x3b80eb[_0x5559('0x3c')]['id']}})[_0x5559('0x13')](handleEntityNotFound(_0x476305,null))[_0x5559('0x13')](function(_0x3c4e32){if(_0x3c4e32){return _0x3c4e32[_0x5559('0xb0')](_0x3b80eb[_0x5559('0x3f')][_0x5559('0x98')]);}})['then'](respondWithStatusCode(_0x476305,null))['catch'](handleError(_0x476305,null));};exports[_0x5559('0x79')]=function(_0x4c1e72,_0x22223d){var _0x52850a=moment()[_0x5559('0xb1')]()['toString']();var _0x2285ef=path[_0x5559('0x75')](config[_0x5559('0x76')],_0x5559('0xb2'),'files',_0x5559('0xb3'));var _0x2c3458=path[_0x5559('0x75')](config[_0x5559('0x76')],_0x5559('0xb2'),_0x5559('0xb4'),_0x5559('0xb5'));var _0x87671b=path['join'](_0x2285ef,_0x52850a);var _0x137db3=util[_0x5559('0x7c')](_0x5559('0xb6'),_0x4c1e72['params']['id'],_0x52850a);var _0x3ad6d8=path[_0x5559('0x75')](_0x2285ef,_0x137db3);var _0x26ca43=[];_0x26ca43[_0x5559('0xa9')]({'model':db[_0x5559('0x80')],'as':_0x5559('0x80'),'attributes':['id',_0x5559('0x8a')],'raw':!![]});_0x26ca43[_0x5559('0xa9')]({'model':db[_0x5559('0x63')],'as':'Contact','attributes':['id','firstName',_0x5559('0xb7')],'raw':!![]});if(_0x4c1e72[_0x5559('0x3f')][_0x5559('0xb5')]){_0x26ca43['push']({'model':db[_0x5559('0x71')],'as':_0x5559('0x71'),'raw':!![]});}var _0x11871e=[{'model':db[_0x5559('0x97')],'as':'Messages','attributes':['id',_0x5559('0x49'),_0x5559('0x8b'),_0x5559('0x8d'),'secret',_0x5559('0xb8')],'include':_0x26ca43}];_0x11871e[_0x5559('0xa9')]({'model':db['ChatWebsite'],'as':_0x5559('0xb9'),'attributes':['id',_0x5559('0x2a')]});_0x11871e[_0x5559('0xa9')]({'model':db[_0x5559('0x80')],'as':'Owner','attributes':['id',_0x5559('0x8a')]});return db[_0x5559('0x32')][_0x5559('0x47')]({'where':{'id':_0x4c1e72[_0x5559('0x3c')]['id']},'include':_0x11871e})['then'](handleEntityNotFound(_0x22223d,null))[_0x5559('0x13')](function(_0x38d71f){if(_0x38d71f){var _0x2bc3ca=_0x38d71f[_0x5559('0xba')]({'plain':!![]});fs[_0x5559('0xbb')](_0x87671b);var _0x2f57cd={'channel':_0x5559('0xbc'),'account':_0x2bc3ca[_0x5559('0xb9')]['name'],'agent':_0x2bc3ca['Owner']?_0x2bc3ca[_0x5559('0xbd')][_0x5559('0x8a')]:'N.A.','createdAt':moment(_0x2bc3ca[_0x5559('0x8b')])[_0x5559('0x7c')](_0x5559('0xa4'))['toString'](),'closedAt':_0x2bc3ca[_0x5559('0x69')]?moment(_0x2bc3ca[_0x5559('0xbe')])[_0x5559('0x7c')](_0x5559('0xa4'))[_0x5559('0xbf')]():'','disposition':_0x2bc3ca[_0x5559('0x6a')],'chatInfo':{'browser':_0x2bc3ca[_0x5559('0xc0')],'os':_0x2bc3ca[_0x5559('0xc1')],'referer':_0x2bc3ca[_0x5559('0xc2')],'customerIp':_0x2bc3ca[_0x5559('0xc3')],'customerPort':_0x2bc3ca[_0x5559('0xc4')]?_0x2bc3ca[_0x5559('0xc4')]:_0x5559('0xc5')},'messages':_(_0x2bc3ca['Messages'])[_0x5559('0xc6')]()[_0x5559('0xa1')]({'secret':![]})['map'](function(_0x47cf76){if(_0x47cf76[_0x5559('0x71')]){var _0x4a2b7c=path['join'](_0x2c3458,_0x47cf76['Attachment'][_0x5559('0x6e')]);if(fs[_0x5559('0xc7')](_0x4a2b7c)){fs[_0x5559('0xc8')](_0x4a2b7c)['pipe'](fs['createWriteStream'](path[_0x5559('0x75')](_0x87671b,_0x47cf76[_0x5559('0x71')][_0x5559('0x6e')])));}}return{'date':moment(_0x47cf76[_0x5559('0x8b')])[_0x5559('0x7c')](_0x5559('0xa4'))[_0x5559('0xbf')](),'sender':_0x47cf76[_0x5559('0x8d')]===_0x5559('0x5f')?_0x47cf76[_0x5559('0x80')]?_0x47cf76[_0x5559('0x80')][_0x5559('0x8a')]:_0x5559('0x84'):_0x47cf76['Contact'][_0x5559('0xc9')]+(_0x47cf76['Contact']['lastName']?'\x20'+_0x47cf76[_0x5559('0x64')][_0x5559('0xb7')]:''),'body':_0x47cf76[_0x5559('0x71')]?_0x47cf76[_0x5559('0x71')][_0x5559('0x6e')]:_0x47cf76[_0x5559('0x49')],'direction':_0x47cf76[_0x5559('0x8d')]===_0x5559('0x5f')?'A':'C','secret':_0x47cf76[_0x5559('0xa8')],'read':_0x47cf76[_0x5559('0xb8')],'attachment':_0x47cf76[_0x5559('0x71')]};})[_0x5559('0xca')]()};return ejs['renderFile'](path[_0x5559('0x75')](config[_0x5559('0x76')],_0x5559('0xb2'),_0x5559('0xcb'),_0x5559('0xcc')),{'interaction':_0x2f57cd})['then'](function(_0x4e87d0){var _0x62bc7a=path[_0x5559('0x75')](_0x87671b,_0x5559('0xcd')+_0x2bc3ca['id']+'-'+_0x52850a+_0x5559('0xce'));var _0x2749d0={'path':_0x62bc7a,'channel':_0x5559('0xbc'),'interactionId':_0x2bc3ca['id']};return pdf[_0x5559('0xcf')](_0x4e87d0,_0x2749d0);})[_0x5559('0x13')](function(){return new Promise(function(_0x27dae7,_0x548a9f){zipdir(_0x87671b,{'saveTo':_0x3ad6d8},function(_0x214e80,_0x35ea2c){if(_0x214e80)return _0x548a9f(_0x214e80);return _0x27dae7(_0x35ea2c);});})['then'](function(){return new BPromise(function(_0x141bce,_0x3c417f){rimraf(_0x87671b,function(_0x503bf6){if(_0x503bf6)_0x3c417f(_0x503bf6);return _0x141bce();});});})[_0x5559('0x13')](function(){return _0x22223d[_0x5559('0x79')](_0x3ad6d8,_0x137db3,function(_0x432c95){if(_0x432c95){logger[_0x5559('0x18')](_0x5559('0xd0'),_0x432c95);}else{fs[_0x5559('0xd1')](_0x3ad6d8);}});});});}else{return _0x22223d['sendStatus'](0xc8);}})[_0x5559('0x1d')](handleError(_0x22223d,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index e4d8fed..f5ae0eb 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 _0x7538=['emit','catch','hasOwnProperty','exports','events','../../mysqldb','ChatMessage','setMaxListeners','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages'];(function(_0x31ab90,_0x145a96){var _0x2d6123=function(_0x2bf73f){while(--_0x2bf73f){_0x31ab90['push'](_0x31ab90['shift']());}};_0x2d6123(++_0x145a96);}(_0x7538,0x103));var _0x8753=function(_0x3bdb09,_0x2f1fb7){_0x3bdb09=_0x3bdb09-0x0;var _0x5f3ec7=_0x7538[_0x3bdb09];return _0x5f3ec7;};'use strict';var EventEmitter=require(_0x8753('0x0'));var ChatInteraction=require(_0x8753('0x1'))['db']['ChatInteraction'];var ChatMessage=require('../../mysqldb')['db'][_0x8753('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x8753('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8753('0x4'),'afterDestroy':_0x8753('0x5')};function emitEvent(_0x2e3fbb){return function(_0x326f55,_0x13465d,_0x36981e){_0x326f55[_0x8753('0x6')]({'attributes':['id'],'raw':!![]})[_0x8753('0x7')](function(_0x28533e){_0x326f55[_0x8753('0x8')](_0x8753('0x9'),_0x28533e[_0x8753('0xa')](function(_0x54eefe){return{'id':_0x54eefe['id']};}));return ChatMessage[_0x8753('0xb')]({'where':{'ChatInteractionId':_0x326f55['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x13d7bc){_0x326f55[_0x8753('0x8')](_0x8753('0xc'),_0x13d7bc['length']);ChatInteractionEvents[_0x8753('0xd')](_0x2e3fbb+':'+_0x326f55['id'],_0x326f55);ChatInteractionEvents[_0x8753('0xd')](_0x2e3fbb,_0x326f55);_0x36981e(null);})[_0x8753('0xe')](_0x36981e(null));};}for(var e in events){if(events[_0x8753('0xf')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0x8753('0x10')]=ChatInteractionEvents; \ No newline at end of file +var _0x3562=['getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hook','exports','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','update','remove'];(function(_0x21be1a,_0x598997){var _0x2f2ab5=function(_0x3be34b){while(--_0x3be34b){_0x21be1a['push'](_0x21be1a['shift']());}};_0x2f2ab5(++_0x598997);}(_0x3562,0x19b));var _0x2356=function(_0x59df9c,_0x5668b9){_0x59df9c=_0x59df9c-0x0;var _0x248b8a=_0x3562[_0x59df9c];return _0x248b8a;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0x2356('0x0'))['db'][_0x2356('0x1')];var ChatMessage=require(_0x2356('0x0'))['db'][_0x2356('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x2356('0x3')](0x0);var events={'afterCreate':_0x2356('0x4'),'afterUpdate':_0x2356('0x5'),'afterDestroy':_0x2356('0x6')};function emitEvent(_0x3b7fcd){return function(_0x43e75a,_0x1bbf6a,_0x57a4b2){_0x43e75a[_0x2356('0x7')]({'attributes':['id'],'raw':!![]})[_0x2356('0x8')](function(_0x4e5da1){_0x43e75a[_0x2356('0x9')](_0x2356('0xa'),_0x4e5da1[_0x2356('0xb')](function(_0x371e38){return{'id':_0x371e38['id']};}));return ChatMessage[_0x2356('0xc')]({'where':{'ChatInteractionId':_0x43e75a['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x8ad3cc){_0x43e75a[_0x2356('0x9')](_0x2356('0xd'),_0x8ad3cc[_0x2356('0xe')]);ChatInteractionEvents[_0x2356('0xf')](_0x3b7fcd+':'+_0x43e75a['id'],_0x43e75a);ChatInteractionEvents[_0x2356('0xf')](_0x3b7fcd,_0x43e75a);_0x57a4b2(null);})[_0x2356('0x10')](_0x57a4b2(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0x2356('0x11')](e,emitEvent(event));}}module[_0x2356('0x12')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 9e14121..4836f62 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 _0x533e=['format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','changed','closedAt'];(function(_0x56ab8f,_0x320fea){var _0x25442a=function(_0x34e64f){while(--_0x34e64f){_0x56ab8f['push'](_0x56ab8f['shift']());}};_0x25442a(++_0x320fea);}(_0x533e,0x134));var _0xe533=function(_0x443468,_0x5c8c24){_0x443468=_0x443468-0x0;var _0xb723f=_0x533e[_0x443468];return _0xb723f;};'use strict';var _=require(_0xe533('0x0'));var util=require(_0xe533('0x1'));var logger=require(_0xe533('0x2'))(_0xe533('0x3'));var moment=require(_0xe533('0x4'));var BPromise=require(_0xe533('0x5'));var rp=require(_0xe533('0x6'));var fs=require('fs');var path=require(_0xe533('0x7'));var rimraf=require('rimraf');var config=require(_0xe533('0x8'));var attributes=require(_0xe533('0x9'));module[_0xe533('0xa')]=function(_0x4a33d5,_0x53b4bc){return _0x4a33d5[_0xe533('0xb')](_0xe533('0xc'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2721a6,_0x49f3c5,_0xe6bdd5){if(_0x2721a6[_0xe533('0xd')]('closed')){_0x2721a6[_0xe533('0xe')]=moment()[_0xe533('0xf')](_0xe533('0x10'));}_0xe6bdd5(null,_0x2721a6);}},'charset':_0xe533('0x11'),'collate':_0xe533('0x12')});}; \ No newline at end of file +var _0x78b2=['exports','ChatInteraction','chat_interactions','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./chatInteraction.attributes'];(function(_0x450689,_0x3b857c){var _0x46ffb0=function(_0x5d3679){while(--_0x5d3679){_0x450689['push'](_0x450689['shift']());}};_0x46ffb0(++_0x3b857c);}(_0x78b2,0x1b9));var _0x278b=function(_0x15dd6b,_0x156756){_0x15dd6b=_0x15dd6b-0x0;var _0x531461=_0x78b2[_0x15dd6b];return _0x531461;};'use strict';var _=require(_0x278b('0x0'));var util=require(_0x278b('0x1'));var logger=require(_0x278b('0x2'))('api');var moment=require(_0x278b('0x3'));var BPromise=require(_0x278b('0x4'));var rp=require(_0x278b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x278b('0x6'));var config=require(_0x278b('0x7'));var attributes=require(_0x278b('0x8'));module[_0x278b('0x9')]=function(_0x18a402,_0x4090cc){return _0x18a402['define'](_0x278b('0xa'),attributes,{'tableName':_0x278b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5a06e6,_0x5b1ede,_0x26132d){if(_0x5a06e6['changed'](_0x278b('0xc'))){_0x5a06e6['closedAt']=moment()[_0x278b('0xd')](_0x278b('0xe'));}_0x26132d(null,_0x5a06e6);}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index dd3bf06..7bd582e 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 _0xe758=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','limit','AddTagsToChatInteraction','find','addTags','omit','stringify','AddTags','util'];(function(_0x47bc5e,_0x6fc500){var _0x323a59=function(_0x32df89){while(--_0x32df89){_0x47bc5e['push'](_0x47bc5e['shift']());}};_0x323a59(++_0x6fc500);}(_0xe758,0x11e));var _0x8e75=function(_0x1c043c,_0x3e5802){_0x1c043c=_0x1c043c-0x0;var _0x37929d=_0xe758[_0x1c043c];return _0x37929d;};'use strict';var _=require('lodash');var util=require(_0x8e75('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8e75('0x1'));var fs=require('fs');var Redis=require(_0x8e75('0x2'));var db=require(_0x8e75('0x3'))['db'];var utils=require(_0x8e75('0x4'));var logger=require(_0x8e75('0x5'))(_0x8e75('0x6'));var config=require(_0x8e75('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8e75('0x8')][_0x8e75('0x9')]({'port':0x232a});config[_0x8e75('0xa')]=_[_0x8e75('0xb')](config[_0x8e75('0xa')],{'host':_0x8e75('0xc'),'port':0x18eb});var socket=require(_0x8e75('0xd'))(new Redis(config[_0x8e75('0xa')]));require(_0x8e75('0xe'))[_0x8e75('0xf')](socket);function respondWithRpcPromise(_0x2cf30b,_0x2c2ff2,_0x45e116){return new BPromise(function(_0x37baa0,_0x1e1a80){return client[_0x8e75('0x10')](_0x2cf30b,_0x45e116)[_0x8e75('0x11')](function(_0x7f2119){logger[_0x8e75('0x12')](_0x8e75('0x13'),_0x2c2ff2,_0x8e75('0x14'));logger[_0x8e75('0x15')](_0x8e75('0x16'),_0x2c2ff2,_0x8e75('0x14'),JSON['stringify'](_0x7f2119));if(_0x7f2119[_0x8e75('0x17')]){if(_0x7f2119['error'][_0x8e75('0x18')]===0x1f4){logger[_0x8e75('0x17')](_0x8e75('0x13'),_0x2c2ff2,_0x7f2119[_0x8e75('0x17')]['message']);return _0x1e1a80(_0x7f2119[_0x8e75('0x17')][_0x8e75('0x19')]);}logger['error']('ChatInteraction,\x20%s,\x20%s',_0x2c2ff2,_0x7f2119['error']['message']);return _0x37baa0(_0x7f2119[_0x8e75('0x17')]['message']);}else{logger[_0x8e75('0x12')](_0x8e75('0x13'),_0x2c2ff2,'request\x20sent');_0x37baa0(_0x7f2119['result'][_0x8e75('0x19')]);}})[_0x8e75('0x1a')](function(_0x4ba0e3){logger[_0x8e75('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x2c2ff2,_0x4ba0e3);_0x1e1a80(_0x4ba0e3);});});}exports[_0x8e75('0x1b')]=function(_0x9601dc){var _0x291e89=this;return new Promise(function(_0x2648bf,_0x3cd161){return db[_0x8e75('0x1c')][_0x8e75('0x1d')](_0x9601dc[_0x8e75('0x1e')],{'raw':_0x9601dc[_0x8e75('0x1f')]?_0x9601dc[_0x8e75('0x1f')][_0x8e75('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x9601dc[_0x8e75('0x1f')]?_0x9601dc[_0x8e75('0x1f')][_0x8e75('0x21')]||null:null,'attributes':_0x9601dc[_0x8e75('0x1f')]?_0x9601dc[_0x8e75('0x1f')]['attributes']||null:null,'limit':_0x9601dc['options']?_0x9601dc[_0x8e75('0x1f')][_0x8e75('0x22')]||null:null})['then'](function(_0x57e4b4){logger[_0x8e75('0x12')](_0x8e75('0x1b'),_0x9601dc);logger['debug']('UpdateChatInteraction',_0x9601dc,JSON['stringify'](_0x57e4b4));_0x2648bf(_0x57e4b4);})[_0x8e75('0x1a')](function(_0x1370c2){logger[_0x8e75('0x17')]('UpdateChatInteraction',_0x1370c2[_0x8e75('0x19')],_0x9601dc);_0x3cd161(_0x291e89['error'](0x1f4,_0x1370c2['message']));});});};exports[_0x8e75('0x23')]=function(_0x4fdb1e){return new Promise(function(_0x44d24b,_0x50b8d){return db[_0x8e75('0x1c')][_0x8e75('0x24')]({'where':_0x4fdb1e['options']?_0x4fdb1e[_0x8e75('0x1f')]['where']||null:null})[_0x8e75('0x11')](function(_0x225fa0){if(_0x225fa0){return _0x225fa0[_0x8e75('0x25')](_0x4fdb1e[_0x8e75('0x1e')]['ids'],_[_0x8e75('0x26')](_0x4fdb1e[_0x8e75('0x1e')],['ids','id'])||{});}})['spread'](function(_0x201bbf){logger[_0x8e75('0x12')]('AddTags',_0x4fdb1e);logger[_0x8e75('0x15')]('AddTags',_0x4fdb1e,JSON[_0x8e75('0x27')](_0x201bbf));_0x44d24b(_0x201bbf);})[_0x8e75('0x1a')](function(_0x51d61d){logger[_0x8e75('0x17')](_0x8e75('0x28'),_0x51d61d[_0x8e75('0x19')],_0x4fdb1e);_0x50b8d(_this[_0x8e75('0x17')](0x1f4,_0x51d61d['message']));});});}; \ No newline at end of file +var _0x70bd=['options','raw','where','limit','debug','stringify','AddTagsToChatInteraction','ChatInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','request','then','info','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','ChatInteraction,\x20%s,\x20%s','catch','UpdateChatInteraction','body'];(function(_0x35f342,_0x1f91e5){var _0x4e6b42=function(_0x54194d){while(--_0x54194d){_0x35f342['push'](_0x35f342['shift']());}};_0x4e6b42(++_0x1f91e5);}(_0x70bd,0x191));var _0xd70b=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x70bd[_0x5bd426];return _0x23a7eb;};'use strict';var _=require(_0xd70b('0x0'));var util=require(_0xd70b('0x1'));var moment=require(_0xd70b('0x2'));var BPromise=require('bluebird');var rs=require(_0xd70b('0x3'));var fs=require('fs');var Redis=require(_0xd70b('0x4'));var db=require(_0xd70b('0x5'))['db'];var utils=require(_0xd70b('0x6'));var logger=require('../../config/logger')(_0xd70b('0x7'));var config=require(_0xd70b('0x8'));var jayson=require(_0xd70b('0x9'));var client=jayson[_0xd70b('0xa')][_0xd70b('0xb')]({'port':0x232a});config[_0xd70b('0xc')]=_['defaults'](config[_0xd70b('0xc')],{'host':_0xd70b('0xd'),'port':0x18eb});var socket=require(_0xd70b('0xe'))(new Redis(config[_0xd70b('0xc')]));require(_0xd70b('0xf'))[_0xd70b('0x10')](socket);function respondWithRpcPromise(_0x447e4a,_0x3b4ade,_0x5517bd){return new BPromise(function(_0x816cce,_0x3de935){return client[_0xd70b('0x11')](_0x447e4a,_0x5517bd)[_0xd70b('0x12')](function(_0x3c90ba){logger[_0xd70b('0x13')]('ChatInteraction,\x20%s,\x20%s',_0x3b4ade,_0xd70b('0x14'));logger['debug'](_0xd70b('0x15'),_0x3b4ade,_0xd70b('0x14'),JSON['stringify'](_0x3c90ba));if(_0x3c90ba[_0xd70b('0x16')]){if(_0x3c90ba['error'][_0xd70b('0x17')]===0x1f4){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x3b4ade,_0x3c90ba['error'][_0xd70b('0x18')]);return _0x3de935(_0x3c90ba[_0xd70b('0x16')][_0xd70b('0x18')]);}logger[_0xd70b('0x16')](_0xd70b('0x19'),_0x3b4ade,_0x3c90ba[_0xd70b('0x16')][_0xd70b('0x18')]);return _0x816cce(_0x3c90ba[_0xd70b('0x16')]['message']);}else{logger['info']('ChatInteraction,\x20%s,\x20%s',_0x3b4ade,_0xd70b('0x14'));_0x816cce(_0x3c90ba['result'][_0xd70b('0x18')]);}})[_0xd70b('0x1a')](function(_0x1c73ad){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x3b4ade,_0x1c73ad);_0x3de935(_0x1c73ad);});});}exports[_0xd70b('0x1b')]=function(_0x507f47){var _0x67ea74=this;return new Promise(function(_0x5f5f38,_0x31b971){return db['ChatInteraction']['update'](_0x507f47[_0xd70b('0x1c')],{'raw':_0x507f47[_0xd70b('0x1d')]?_0x507f47[_0xd70b('0x1d')][_0xd70b('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x507f47[_0xd70b('0x1d')]?_0x507f47[_0xd70b('0x1d')][_0xd70b('0x1f')]||null:null,'attributes':_0x507f47[_0xd70b('0x1d')]?_0x507f47['options']['attributes']||null:null,'limit':_0x507f47['options']?_0x507f47[_0xd70b('0x1d')][_0xd70b('0x20')]||null:null})[_0xd70b('0x12')](function(_0xe04978){logger[_0xd70b('0x13')](_0xd70b('0x1b'),_0x507f47);logger[_0xd70b('0x21')](_0xd70b('0x1b'),_0x507f47,JSON[_0xd70b('0x22')](_0xe04978));_0x5f5f38(_0xe04978);})[_0xd70b('0x1a')](function(_0x42dea6){logger[_0xd70b('0x16')](_0xd70b('0x1b'),_0x42dea6['message'],_0x507f47);_0x31b971(_0x67ea74['error'](0x1f4,_0x42dea6['message']));});});};exports[_0xd70b('0x23')]=function(_0x327012){return new Promise(function(_0x1ffb00,_0xfd4503){return db[_0xd70b('0x24')][_0xd70b('0x25')]({'where':_0x327012[_0xd70b('0x1d')]?_0x327012[_0xd70b('0x1d')][_0xd70b('0x1f')]||null:null})[_0xd70b('0x12')](function(_0x3ed0ef){if(_0x3ed0ef){return _0x3ed0ef[_0xd70b('0x26')](_0x327012[_0xd70b('0x1c')][_0xd70b('0x27')],_[_0xd70b('0x28')](_0x327012[_0xd70b('0x1c')],[_0xd70b('0x27'),'id'])||{});}})[_0xd70b('0x29')](function(_0x2890e2){logger[_0xd70b('0x13')](_0xd70b('0x2a'),_0x327012);logger['debug'](_0xd70b('0x2a'),_0x327012,JSON[_0xd70b('0x22')](_0x2890e2));_0x1ffb00(_0x2890e2);})[_0xd70b('0x1a')](function(_0xb2d753){logger[_0xd70b('0x16')]('AddTags',_0xb2d753[_0xd70b('0x18')],_0x327012);_0xfd4503(_this['error'](0x1f4,_0xb2d753['message']));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index b5ad79b..99d1228 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 _0xec61=['register','length','chatInteraction:','./chatInteraction.events','save','remove','update','emit','removeListener'];(function(_0x1147ab,_0x10e72b){var _0x55cb5a=function(_0x364bd6){while(--_0x364bd6){_0x1147ab['push'](_0x1147ab['shift']());}};_0x55cb5a(++_0x10e72b);}(_0xec61,0x66));var _0x1ec6=function(_0x42a78b,_0x36d6b1){_0x42a78b=_0x42a78b-0x0;var _0x2270f6=_0xec61[_0x42a78b];return _0x2270f6;};'use strict';var ChatInteractionEvents=require(_0x1ec6('0x0'));var events=[_0x1ec6('0x1'),_0x1ec6('0x2'),_0x1ec6('0x3')];function createListener(_0xe3ddbf,_0x2e0014){return function(_0x1814a2){_0x2e0014[_0x1ec6('0x4')](_0xe3ddbf,_0x1814a2);};}function removeListener(_0xc6eb03,_0x3bc11a){return function(){ChatInteractionEvents[_0x1ec6('0x5')](_0xc6eb03,_0x3bc11a);};}exports[_0x1ec6('0x6')]=function(_0xd27618){for(var _0x3b470f=0x0,_0x8d7732=events[_0x1ec6('0x7')];_0x3b470f<_0x8d7732;_0x3b470f++){var _0x24043f=events[_0x3b470f];var _0x48457f=createListener(_0x1ec6('0x8')+_0x24043f,_0xd27618);ChatInteractionEvents['on'](_0x24043f,_0x48457f);}}; \ No newline at end of file +var _0xe784=['length','./chatInteraction.events','save','remove','update','emit','removeListener','register'];(function(_0xcec18a,_0x663b4f){var _0x52d111=function(_0x23a999){while(--_0x23a999){_0xcec18a['push'](_0xcec18a['shift']());}};_0x52d111(++_0x663b4f);}(_0xe784,0x1b9));var _0x4e78=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0xe784[_0x1e4360];return _0x31e6b4;};'use strict';var ChatInteractionEvents=require(_0x4e78('0x0'));var events=[_0x4e78('0x1'),_0x4e78('0x2'),_0x4e78('0x3')];function createListener(_0x44558a,_0x4d424b){return function(_0x3f2ad7){_0x4d424b[_0x4e78('0x4')](_0x44558a,_0x3f2ad7);};}function removeListener(_0x9e71c7,_0x2faac3){return function(){ChatInteractionEvents[_0x4e78('0x5')](_0x9e71c7,_0x2faac3);};}exports[_0x4e78('0x6')]=function(_0x5901b2){for(var _0x312472=0x0,_0x5dcadd=events[_0x4e78('0x7')];_0x312472<_0x5dcadd;_0x312472++){var _0xda6372=events[_0x312472];var _0x4aec57=createListener('chatInteraction:'+_0xda6372,_0x5901b2);ChatInteractionEvents['on'](_0xda6372,_0x4aec57);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index dd0f9d1..d4b7812 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 _0xf939=['../../config/environment','get','isAuthenticated','index','/describe','describe','isChatInteractionAuthorized','show','/:id/attachment_download','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','post','/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/','format','now','originalname','single','file','tracked','chat','chatinteraction:addtags','addTags','put','chatinteraction:update','update','/:id/custom_update','customUpdate','abandon','/:id/close','close','delete','/:id','chatinteraction:destroy','destroy','removeTags','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xf939,0x164));var _0x9f93=function(_0x511284,_0x37603d){_0x511284=_0x511284-0x0;var _0x5126cc=_0xf939[_0x511284];return _0x5126cc;};'use strict';var multer=require(_0x9f93('0x0'));var util=require(_0x9f93('0x1'));var path=require('path');var timeout=require(_0x9f93('0x2'));var express=require(_0x9f93('0x3'));var router=express[_0x9f93('0x4')]();var fs_extra=require(_0x9f93('0x5'));var auth=require(_0x9f93('0x6'));var interaction=require(_0x9f93('0x7'));var config=require(_0x9f93('0x8'));var controller=require('./chatInteraction.controller');router[_0x9f93('0x9')]('/',auth[_0x9f93('0xa')](),controller[_0x9f93('0xb')]);router[_0x9f93('0x9')](_0x9f93('0xc'),auth['isAuthenticated'](),controller[_0x9f93('0xd')]);router['get']('/:id',auth[_0x9f93('0xe')](),controller[_0x9f93('0xf')]);router[_0x9f93('0x9')](_0x9f93('0x10'),auth['isChatInteractionAuthorized'](),controller['attachmentDownload']);router[_0x9f93('0x9')](_0x9f93('0x11'),auth[_0x9f93('0xa')](),controller[_0x9f93('0x12')]);router['get'](_0x9f93('0x13'),auth[_0x9f93('0xe')](),controller[_0x9f93('0x14')]);router[_0x9f93('0x9')](_0x9f93('0x15'),auth[_0x9f93('0xa')](),controller['download']);router['post']('/',auth[_0x9f93('0xa')](),controller['create']);router[_0x9f93('0x16')](_0x9f93('0x17'),auth[_0x9f93('0xa')](),controller[_0x9f93('0x18')]);var upload=multer({'storage':multer[_0x9f93('0x19')]({'destination':function(_0x4acd13,_0x506db6,_0x3e6fa1){_0x3e6fa1(null,path[_0x9f93('0x1a')](config[_0x9f93('0x1b')],_0x9f93('0x1c')));},'filename':function(_0x3e1858,_0x1a5cdf,_0x5c8b70){_0x5c8b70(null,util[_0x9f93('0x1d')]('%s-%s',Date[_0x9f93('0x1e')](),_0x1a5cdf[_0x9f93('0x1f')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post']('/:id/attachment_upload',upload[_0x9f93('0x20')](_0x9f93('0x21')),controller['attachmentUpload']);router[_0x9f93('0x16')](_0x9f93('0x11'),auth[_0x9f93('0xe')](),controller['addMessage']);router[_0x9f93('0x16')]('/:id/tags',auth[_0x9f93('0xa')](),interaction[_0x9f93('0x22')](_0x9f93('0x23'),_0x9f93('0x24')),controller[_0x9f93('0x25')]);router[_0x9f93('0x26')]('/:id',auth[_0x9f93('0xa')](),interaction[_0x9f93('0x22')](_0x9f93('0x23'),_0x9f93('0x27')),controller[_0x9f93('0x28')]);router[_0x9f93('0x26')](_0x9f93('0x29'),controller[_0x9f93('0x2a')]);router['put']('/:id/abandon',auth[_0x9f93('0xe')](),controller[_0x9f93('0x2b')]);router[_0x9f93('0x26')](_0x9f93('0x2c'),controller[_0x9f93('0x2d')]);router[_0x9f93('0x2e')](_0x9f93('0x2f'),auth[_0x9f93('0xa')](),interaction[_0x9f93('0x22')](_0x9f93('0x23'),_0x9f93('0x30')),controller[_0x9f93('0x31')]);router[_0x9f93('0x2e')]('/:id/tags',auth[_0x9f93('0xa')](),controller[_0x9f93('0x32')]);module[_0x9f93('0x33')]=router; \ No newline at end of file +var _0x9aca=['single','file','attachmentUpload','addMessage','/:id/tags','chat','chatinteraction:addtags','addTags','put','tracked','chatinteraction:update','update','/:id/custom_update','abandon','close','chatinteraction:destroy','destroy','delete','removeTags','exports','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./chatInteraction.controller','isAuthenticated','index','/describe','describe','get','/:id','show','/:id/attachment_download','isChatInteractionAuthorized','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','create','post','/:id/vidaoo','createVidaooSession','diskStorage','root','%s-%s','originalname','replace','/:id/attachment_upload'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x9aca,0x118));var _0xa9ac=function(_0x475ac5,_0x30737c){_0x475ac5=_0x475ac5-0x0;var _0x1e5e19=_0x9aca[_0x475ac5];return _0x1e5e19;};'use strict';var multer=require('multer');var util=require(_0xa9ac('0x0'));var path=require('path');var timeout=require(_0xa9ac('0x1'));var express=require('express');var router=express[_0xa9ac('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xa9ac('0x3'));var interaction=require(_0xa9ac('0x4'));var config=require('../../config/environment');var controller=require(_0xa9ac('0x5'));router['get']('/',auth[_0xa9ac('0x6')](),controller[_0xa9ac('0x7')]);router['get'](_0xa9ac('0x8'),auth['isAuthenticated'](),controller[_0xa9ac('0x9')]);router[_0xa9ac('0xa')](_0xa9ac('0xb'),auth['isChatInteractionAuthorized'](),controller[_0xa9ac('0xc')]);router[_0xa9ac('0xa')](_0xa9ac('0xd'),auth[_0xa9ac('0xe')](),controller[_0xa9ac('0xf')]);router[_0xa9ac('0xa')](_0xa9ac('0x10'),auth['isAuthenticated'](),controller[_0xa9ac('0x11')]);router[_0xa9ac('0xa')](_0xa9ac('0x12'),auth[_0xa9ac('0xe')](),controller[_0xa9ac('0x13')]);router[_0xa9ac('0xa')](_0xa9ac('0x14'),auth[_0xa9ac('0x6')](),controller[_0xa9ac('0x15')]);router['post']('/',auth[_0xa9ac('0x6')](),controller[_0xa9ac('0x16')]);router[_0xa9ac('0x17')](_0xa9ac('0x18'),auth[_0xa9ac('0x6')](),controller[_0xa9ac('0x19')]);var upload=multer({'storage':multer[_0xa9ac('0x1a')]({'destination':function(_0x5aa2b2,_0x380e34,_0x431efa){_0x431efa(null,path['join'](config[_0xa9ac('0x1b')],'server/files/attachments/'));},'filename':function(_0x193d94,_0x1e2263,_0xd45629){_0xd45629(null,util['format'](_0xa9ac('0x1c'),Date['now'](),_0x1e2263[_0xa9ac('0x1d')][_0xa9ac('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0xa9ac('0x1f'),upload[_0xa9ac('0x20')](_0xa9ac('0x21')),controller[_0xa9ac('0x22')]);router['post']('/:id/messages',auth[_0xa9ac('0xe')](),controller[_0xa9ac('0x23')]);router['post'](_0xa9ac('0x24'),auth[_0xa9ac('0x6')](),interaction['tracked'](_0xa9ac('0x25'),_0xa9ac('0x26')),controller[_0xa9ac('0x27')]);router[_0xa9ac('0x28')]('/:id',auth['isAuthenticated'](),interaction[_0xa9ac('0x29')](_0xa9ac('0x25'),_0xa9ac('0x2a')),controller[_0xa9ac('0x2b')]);router[_0xa9ac('0x28')](_0xa9ac('0x2c'),controller['customUpdate']);router[_0xa9ac('0x28')]('/:id/abandon',auth[_0xa9ac('0xe')](),controller[_0xa9ac('0x2d')]);router[_0xa9ac('0x28')]('/:id/close',controller[_0xa9ac('0x2e')]);router['delete']('/:id',auth[_0xa9ac('0x6')](),interaction[_0xa9ac('0x29')](_0xa9ac('0x25'),_0xa9ac('0x2f')),controller[_0xa9ac('0x30')]);router[_0xa9ac('0x31')](_0xa9ac('0x24'),auth[_0xa9ac('0x6')](),controller[_0xa9ac('0x32')]);module[_0xa9ac('0x33')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index b56ad2c..703700a 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 _0x34b6=['medium','BOOLEAN','INTEGER','sequelize','TEXT'];(function(_0x4b9ac1,_0x597aba){var _0x5e116e=function(_0xa5e0d0){while(--_0xa5e0d0){_0x4b9ac1['push'](_0x4b9ac1['shift']());}};_0x5e116e(++_0x597aba);}(_0x34b6,0xda));var _0x634b=function(_0x179e41,_0x3f91fb){_0x179e41=_0x179e41-0x0;var _0x3ba133=_0x34b6[_0x179e41];return _0x3ba133;};'use strict';var Sequelize=require(_0x634b('0x0'));module['exports']={'body':{'type':Sequelize[_0x634b('0x1')](_0x634b('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x634b('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x634b('0x4')]}}; \ No newline at end of file +var _0xd01f=['exports','TEXT','medium','sequelize'];(function(_0x56bd4c,_0x3cd91d){var _0x462287=function(_0x3f982c){while(--_0x3f982c){_0x56bd4c['push'](_0x56bd4c['shift']());}};_0x462287(++_0x3cd91d);}(_0xd01f,0x1cf));var _0xfd01=function(_0x1cb45d,_0x46aa83){_0x1cb45d=_0x1cb45d-0x0;var _0x3ea23c=_0xd01f[_0x1cb45d];return _0x3ea23c;};'use strict';var Sequelize=require(_0xfd01('0x0'));module[_0xfd01('0x1')]={'body':{'type':Sequelize[_0xfd01('0x2')](_0xfd01('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 54cb7c9..9a84261 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 _0xa8cd=['apply','reject','save','destroy','then','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','ChatInternalMessage','includeAll','include','findAll','rows','show','params','keys','options','catch','body','update','find','describe','get','messages','lastMessageAt','createdAt','lastMessage','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin','user','fullname','role','userpic','online','lastLoginAt','allowmessenger','showWebBar','VoiceQueue','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','push','FromId','read','-createdAt','all','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x5b062e,_0x18210e){var _0x1ab2b3=function(_0x290cf5){while(--_0x290cf5){_0x5b062e['push'](_0x5b062e['shift']());}};_0x1ab2b3(++_0x18210e);}(_0xa8cd,0x19c));var _0xda8c=function(_0x2a8860,_0x2da926){_0x2a8860=_0x2a8860-0x0;var _0x2f47a4=_0xa8cd[_0x2a8860];return _0x2f47a4;};'use strict';var emlformat=require(_0xda8c('0x0'));var rimraf=require(_0xda8c('0x1'));var zipdir=require(_0xda8c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xda8c('0x3'));var BPromise=require(_0xda8c('0x4'));var Mustache=require('mustache');var util=require(_0xda8c('0x5'));var path=require(_0xda8c('0x6'));var sox=require(_0xda8c('0x7'));var csv=require(_0xda8c('0x8'));var ejs=require(_0xda8c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xda8c('0xa'));var squel=require(_0xda8c('0xb'));var crypto=require(_0xda8c('0xc'));var jsforce=require(_0xda8c('0xd'));var deskjs=require(_0xda8c('0xe'));var toCsv=require('to-csv');var querystring=require(_0xda8c('0xf'));var Papa=require(_0xda8c('0x10'));var Redis=require(_0xda8c('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xda8c('0x12'));var as=require(_0xda8c('0x13'));var hardwareService=require(_0xda8c('0x14'));var logger=require(_0xda8c('0x15'))('api');var utils=require(_0xda8c('0x16'));var config=require(_0xda8c('0x17'));var licenseUtil=require(_0xda8c('0x18'));var db=require(_0xda8c('0x19'))['db'];config[_0xda8c('0x1a')]=_['defaults'](config['redis'],{'host':_0xda8c('0x1b'),'port':0x18eb});var socket=require(_0xda8c('0x1c'))(new Redis(config[_0xda8c('0x1a')]));require('./chatInternalMessage.socket')[_0xda8c('0x1d')](socket);function respondWithStatusCode(_0x4c1a85,_0x27bc8f){_0x27bc8f=_0x27bc8f||0xcc;return function(_0x34accc){if(_0x34accc){return _0x4c1a85[_0xda8c('0x1e')](_0x27bc8f);}return _0x4c1a85[_0xda8c('0x1f')](_0x27bc8f)[_0xda8c('0x20')]();};}function respondWithResult(_0x3834a1,_0x51d651){_0x51d651=_0x51d651||0xc8;return function(_0x4392be){if(_0x4392be){return _0x3834a1[_0xda8c('0x1f')](_0x51d651)[_0xda8c('0x21')](_0x4392be);}};}function respondWithFilteredResult(_0x1700a7,_0x48ecac){return function(_0x5565a3){if(_0x5565a3){var _0x222f7c=typeof _0x48ecac[_0xda8c('0x22')]===_0xda8c('0x23')&&typeof _0x48ecac[_0xda8c('0x24')]===_0xda8c('0x23');var _0x1302f3=_0x5565a3[_0xda8c('0x25')];var _0x3e1c41=_0x222f7c?0x0:_0x48ecac[_0xda8c('0x22')];var _0xa46fa7=_0x222f7c?_0x5565a3[_0xda8c('0x25')]:_0x48ecac['offset']+_0x48ecac[_0xda8c('0x24')];var _0xa2b57a;if(_0xa46fa7>=_0x1302f3){_0xa46fa7=_0x1302f3;_0xa2b57a=0xc8;}else{_0xa2b57a=0xce;}_0x1700a7[_0xda8c('0x1f')](_0xa2b57a);return _0x1700a7[_0xda8c('0x26')](_0xda8c('0x27'),_0x3e1c41+'-'+_0xa46fa7+'/'+_0x1302f3)[_0xda8c('0x21')](_0x5565a3);}return null;};}function patchUpdates(_0x565486){return function(_0x39c3c2){try{jsonpatch[_0xda8c('0x28')](_0x39c3c2,_0x565486,!![]);}catch(_0x52c95e){return BPromise[_0xda8c('0x29')](_0x52c95e);}return _0x39c3c2[_0xda8c('0x2a')]();};}function saveUpdates(_0x31328d,_0x34807a){return function(_0x589054){if(_0x589054){return _0x589054['update'](_0x31328d)['then'](function(_0x55b257){return _0x55b257;});}return null;};}function removeEntity(_0x1addd7,_0x27f7d2){return function(_0x49a266){if(_0x49a266){return _0x49a266[_0xda8c('0x2b')]()[_0xda8c('0x2c')](function(){_0x1addd7['status'](0xcc)[_0xda8c('0x20')]();});}};}function handleEntityNotFound(_0x261df3,_0x56cf7c){return function(_0x898970){if(!_0x898970){_0x261df3[_0xda8c('0x1e')](0x194);}return _0x898970;};}function handleError(_0x411aff,_0x30916b){_0x30916b=_0x30916b||0x1f4;return function(_0x103fd3){logger[_0xda8c('0x2d')](_0x103fd3[_0xda8c('0x2e')]);if(_0x103fd3[_0xda8c('0x2f')]){delete _0x103fd3[_0xda8c('0x2f')];}_0x411aff[_0xda8c('0x1f')](_0x30916b)[_0xda8c('0x30')](_0x103fd3);};}exports['index']=function(_0x5f5b7b,_0x2c0a18){var _0x28c737={},_0x434870={},_0x73a538={'count':0x0,'rows':[]};var _0x19ca01=_[_0xda8c('0x31')](db['ChatInternalMessage'][_0xda8c('0x32')],function(_0x56e80c){return{'name':_0x56e80c[_0xda8c('0x33')],'type':_0x56e80c[_0xda8c('0x34')][_0xda8c('0x35')]};});_0x434870[_0xda8c('0x36')]=_['map'](_0x19ca01,'name');_0x434870[_0xda8c('0x37')]=_['keys'](_0x5f5b7b[_0xda8c('0x37')]);_0x434870[_0xda8c('0x38')]=_[_0xda8c('0x39')](_0x434870[_0xda8c('0x36')],_0x434870[_0xda8c('0x37')]);_0x28c737[_0xda8c('0x3a')]=_[_0xda8c('0x39')](_0x434870[_0xda8c('0x36')],qs[_0xda8c('0x3b')](_0x5f5b7b['query'][_0xda8c('0x3b')]));_0x28c737[_0xda8c('0x3a')]=_0x28c737[_0xda8c('0x3a')][_0xda8c('0x3c')]?_0x28c737[_0xda8c('0x3a')]:_0x434870[_0xda8c('0x36')];if(!_0x5f5b7b[_0xda8c('0x37')][_0xda8c('0x3d')](_0xda8c('0x3e'))){_0x28c737[_0xda8c('0x24')]=qs[_0xda8c('0x24')](_0x5f5b7b[_0xda8c('0x37')]['limit']);_0x28c737[_0xda8c('0x22')]=qs[_0xda8c('0x22')](_0x5f5b7b[_0xda8c('0x37')]['offset']);}_0x28c737[_0xda8c('0x3f')]=qs[_0xda8c('0x40')](_0x5f5b7b[_0xda8c('0x37')][_0xda8c('0x40')]);_0x28c737[_0xda8c('0x41')]=qs[_0xda8c('0x38')](_['pick'](_0x5f5b7b[_0xda8c('0x37')],_0x434870['filters']),_0x19ca01);if(_0x5f5b7b[_0xda8c('0x37')][_0xda8c('0x42')]){_0x28c737['where']=_[_0xda8c('0x43')](_0x28c737[_0xda8c('0x41')],{'$or':_[_0xda8c('0x31')](_0x19ca01,function(_0x5db995){if(_0x5db995['type']!=='VIRTUAL'){var _0xdf37a6={};_0xdf37a6[_0x5db995[_0xda8c('0x2f')]]={'$like':'%'+_0x5f5b7b[_0xda8c('0x37')][_0xda8c('0x42')]+'%'};return _0xdf37a6;}})});}_0x28c737=_['merge']({},_0x28c737,_0x5f5b7b['options']);var _0x2d50f6={'where':_0x28c737[_0xda8c('0x41')]};return db[_0xda8c('0x44')][_0xda8c('0x25')](_0x2d50f6)[_0xda8c('0x2c')](function(_0x3ad2f7){_0x73a538[_0xda8c('0x25')]=_0x3ad2f7;if(_0x5f5b7b[_0xda8c('0x37')][_0xda8c('0x45')]){_0x28c737[_0xda8c('0x46')]=[{'all':!![]}];}return db[_0xda8c('0x44')][_0xda8c('0x47')](_0x28c737);})[_0xda8c('0x2c')](function(_0x334cdc){_0x73a538[_0xda8c('0x48')]=_0x334cdc;return _0x73a538;})['then'](respondWithFilteredResult(_0x2c0a18,_0x28c737))['catch'](handleError(_0x2c0a18,null));};exports[_0xda8c('0x49')]=function(_0x2829d9,_0x8a4f2a){var _0x4c8f45={'raw':!![],'where':{'id':_0x2829d9[_0xda8c('0x4a')]['id']}},_0xea6f65={};_0xea6f65[_0xda8c('0x36')]=_[_0xda8c('0x4b')](db[_0xda8c('0x44')][_0xda8c('0x32')]);_0xea6f65[_0xda8c('0x37')]=_[_0xda8c('0x4b')](_0x2829d9['query']);_0xea6f65[_0xda8c('0x38')]=_[_0xda8c('0x39')](_0xea6f65[_0xda8c('0x36')],_0xea6f65['query']);_0x4c8f45[_0xda8c('0x3a')]=_[_0xda8c('0x39')](_0xea6f65['model'],qs['fields'](_0x2829d9[_0xda8c('0x37')][_0xda8c('0x3b')]));_0x4c8f45[_0xda8c('0x3a')]=_0x4c8f45[_0xda8c('0x3a')]['length']?_0x4c8f45[_0xda8c('0x3a')]:_0xea6f65[_0xda8c('0x36')];if(_0x2829d9['query'][_0xda8c('0x45')]){_0x4c8f45[_0xda8c('0x46')]=[{'all':!![]}];}_0x4c8f45=_['merge']({},_0x4c8f45,_0x2829d9[_0xda8c('0x4c')]);return db[_0xda8c('0x44')]['find'](_0x4c8f45)[_0xda8c('0x2c')](handleEntityNotFound(_0x8a4f2a,null))[_0xda8c('0x2c')](respondWithResult(_0x8a4f2a,null))[_0xda8c('0x4d')](handleError(_0x8a4f2a,null));};exports['create']=function(_0x3bda0c,_0x2e6edd){return db[_0xda8c('0x44')]['create'](_0x3bda0c[_0xda8c('0x4e')],{})[_0xda8c('0x2c')](respondWithResult(_0x2e6edd,0xc9))[_0xda8c('0x4d')](handleError(_0x2e6edd,null));};exports[_0xda8c('0x4f')]=function(_0x126c95,_0x1778dc){if(_0x126c95['body']['id']){delete _0x126c95[_0xda8c('0x4e')]['id'];}return db['ChatInternalMessage']['find']({'where':{'id':_0x126c95[_0xda8c('0x4a')]['id']}})[_0xda8c('0x2c')](handleEntityNotFound(_0x1778dc,null))[_0xda8c('0x2c')](saveUpdates(_0x126c95[_0xda8c('0x4e')],null))['then'](respondWithResult(_0x1778dc,null))[_0xda8c('0x4d')](handleError(_0x1778dc,null));};exports[_0xda8c('0x2b')]=function(_0x10de26,_0x36cb3a){return db[_0xda8c('0x44')][_0xda8c('0x50')]({'where':{'id':_0x10de26['params']['id']}})[_0xda8c('0x2c')](handleEntityNotFound(_0x36cb3a,null))[_0xda8c('0x2c')](removeEntity(_0x36cb3a,null))[_0xda8c('0x4d')](handleError(_0x36cb3a,null));};exports[_0xda8c('0x51')]=function(_0x567c47,_0x15555c){return db[_0xda8c('0x44')][_0xda8c('0x51')]()[_0xda8c('0x2c')](respondWithResult(_0x15555c,null))[_0xda8c('0x4d')](handleError(_0x15555c,null));};function wrapUser(_0x3c9834){return function(_0x182b38){var _0x57076c=_0x3c9834[_0xda8c('0x52')]({'plain':!![]});_0x57076c[_0xda8c('0x53')]=[];if(_0x182b38){_0x57076c[_0xda8c('0x54')]=_0x182b38[_0xda8c('0x55')];_0x57076c[_0xda8c('0x56')]=_0x182b38;}else{_0x57076c[_0xda8c('0x54')]=moment(0x0)['format'](_0xda8c('0x57'));_0x57076c['lastMessage']={};}return _0x57076c;};}exports[_0xda8c('0x58')]=function(_0x4511cf,_0x3197b3,_0x26d822){var _0x546a9d=[];return db[_0xda8c('0x59')]['findAll']({'where':{'role':[_0xda8c('0x5a'),_0xda8c('0x5b'),_0xda8c('0x5c')]},'attributes':['id',_0xda8c('0x5d'),_0xda8c('0x2f'),_0xda8c('0x5e'),_0xda8c('0x5f'),'internal',_0xda8c('0x60'),_0xda8c('0x61'),_0xda8c('0x62'),_0xda8c('0x63')],'order':qs[_0xda8c('0x40')]('-online'),'include':[{'model':db[_0xda8c('0x64')],'as':'VoiceQueues','attributes':['id',_0xda8c('0x2f'),_0xda8c('0x34')],'through':{'attributes':[]}}]})[_0xda8c('0x2c')](function(_0x5def58){if(_0x5def58){var _0x45e6af=_0x4511cf[_0xda8c('0x5c')][_0xda8c('0x52')]({'plain':!![]});if(!_0x45e6af)throw new Error(_0xda8c('0x65'));if(_0x45e6af[_0xda8c('0x5e')]===_0xda8c('0x5c')){return db[_0xda8c('0x66')]['find']({'where':{'name':_0xda8c('0x67'),'userProfileId':_0x45e6af[_0xda8c('0x68')]},'raw':!![]})[_0xda8c('0x2c')](function(_0x29cb36){if(_0x29cb36){if(_0x29cb36[_0xda8c('0x69')]===0x0){return db[_0xda8c('0x6a')]['findAll']({'where':{'sectionId':_0x29cb36['id']},'raw':!![]})['then'](function(_0x8b9283){var _0x45d42d=[];if(_[_0xda8c('0x6b')](_0x8b9283)){_0x45d42d=_[_0xda8c('0x42')](_0x5def58,function(_0x2f9847){if(_0x2f9847['role']!==_0xda8c('0x5a')){return _0x2f9847;}});return _0x45d42d;}else{for(var _0x55eb5b=0x0;_0x55eb5b<_0x5def58[_0xda8c('0x3c')];_0x55eb5b++){var _0x234ba2=_0x5def58[_0x55eb5b];if(_0x234ba2['role']===_0xda8c('0x5a')){var _0x1e4a2a=_['find'](_0x8b9283,function(_0xfcb99c){return _0xfcb99c['resourceId']===_0x234ba2['id'];});if(_0x1e4a2a)_0x45d42d[_0xda8c('0x6c')](_0x234ba2);}else{_0x45d42d[_0xda8c('0x6c')](_0x234ba2);}}return _0x45d42d;}});}else{return _0x5def58;}}else{var _0x192a8=_[_0xda8c('0x42')](_0x5def58,function(_0x301f4e){if(_0x301f4e[_0xda8c('0x5e')]!==_0xda8c('0x5a')){return _0x301f4e;}});return _0x192a8;}});}else{return _0x5def58;}}})[_0xda8c('0x2c')](function(_0x3c84fa){var _0x7ec189=[];if(_0x3c84fa){_0x546a9d=_0x3c84fa;for(var _0x4222f0=0x0;_0x4222f0<_0x3c84fa['length'];_0x4222f0+=0x1){_0x546a9d[_0x4222f0][_0xda8c('0x53')]=[];_0x7ec189[_0xda8c('0x6c')](db[_0xda8c('0x44')][_0xda8c('0x50')]({'where':{'FromId':[_0x4511cf['user']['id'],_0x3c84fa[_0x4222f0]['id']],'ToId':[_0x4511cf[_0xda8c('0x5c')]['id'],_0x3c84fa[_0x4222f0]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0xda8c('0x6d'),'ToId',_0xda8c('0x6e'),_0xda8c('0x4e')],'order':qs[_0xda8c('0x40')](_0xda8c('0x6f')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xda8c('0x2c')](wrapUser(_0x3c84fa[_0x4222f0])));}return BPromise[_0xda8c('0x70')](_0x7ec189);}return[];})[_0xda8c('0x2c')](function(_0x2cb7a2){return{'rows':_0x2cb7a2,'count':_0x2cb7a2[_0xda8c('0x3c')]};})['then'](respondWithResult(_0x3197b3,null))[_0xda8c('0x4d')](handleError(_0x3197b3,null));}; \ No newline at end of file +var _0xbc68=['User','agent','admin','user','userpic','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Agents','autoAssociation','UserProfileResource','isEmpty','resourceId','push','createdAt','FromId','read','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','status','offset','undefined','limit','set','Content-Range','apply','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','keys','query','attributes','intersection','fields','length','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','ChatInternalMessage','count','findAll','rows','catch','show','params','include','create','body','find','describe','get','messages','lastMessage','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x2a4813,_0x1c9e07){var _0x75858e=function(_0x1a48d9){while(--_0x1a48d9){_0x2a4813['push'](_0x2a4813['shift']());}};_0x75858e(++_0x1c9e07);}(_0xbc68,0x155));var _0x8bc6=function(_0x4d3016,_0x3351a0){_0x4d3016=_0x4d3016-0x0;var _0x20057c=_0xbc68[_0x4d3016];return _0x20057c;};'use strict';var emlformat=require(_0x8bc6('0x0'));var rimraf=require(_0x8bc6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8bc6('0x2'));var moment=require('moment');var BPromise=require(_0x8bc6('0x3'));var Mustache=require(_0x8bc6('0x4'));var util=require(_0x8bc6('0x5'));var path=require(_0x8bc6('0x6'));var sox=require(_0x8bc6('0x7'));var csv=require(_0x8bc6('0x8'));var ejs=require(_0x8bc6('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8bc6('0xa'));var squel=require(_0x8bc6('0xb'));var crypto=require(_0x8bc6('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8bc6('0xd'));var toCsv=require('to-csv');var querystring=require(_0x8bc6('0xe'));var Papa=require(_0x8bc6('0xf'));var Redis=require(_0x8bc6('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8bc6('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8bc6('0x12'))(_0x8bc6('0x13'));var utils=require(_0x8bc6('0x14'));var config=require(_0x8bc6('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x8bc6('0x16'))['db'];config[_0x8bc6('0x17')]=_[_0x8bc6('0x18')](config['redis'],{'host':_0x8bc6('0x19'),'port':0x18eb});var socket=require(_0x8bc6('0x1a'))(new Redis(config[_0x8bc6('0x17')]));require(_0x8bc6('0x1b'))[_0x8bc6('0x1c')](socket);function respondWithStatusCode(_0x559a88,_0x2786e0){_0x2786e0=_0x2786e0||0xcc;return function(_0x3e8366){if(_0x3e8366){return _0x559a88['sendStatus'](_0x2786e0);}return _0x559a88[_0x8bc6('0x1d')](_0x2786e0)['end']();};}function respondWithResult(_0x28cb2a,_0x3ef1ed){_0x3ef1ed=_0x3ef1ed||0xc8;return function(_0x14816c){if(_0x14816c){return _0x28cb2a[_0x8bc6('0x1d')](_0x3ef1ed)['json'](_0x14816c);}};}function respondWithFilteredResult(_0x17c09f,_0x108043){return function(_0x3a5c8e){if(_0x3a5c8e){var _0x41dae0=typeof _0x108043[_0x8bc6('0x1e')]===_0x8bc6('0x1f')&&typeof _0x108043[_0x8bc6('0x20')]===_0x8bc6('0x1f');var _0x2d7805=_0x3a5c8e['count'];var _0x90bf59=_0x41dae0?0x0:_0x108043[_0x8bc6('0x1e')];var _0x5bbc8e=_0x41dae0?_0x3a5c8e['count']:_0x108043[_0x8bc6('0x1e')]+_0x108043[_0x8bc6('0x20')];var _0x7fbb55;if(_0x5bbc8e>=_0x2d7805){_0x5bbc8e=_0x2d7805;_0x7fbb55=0xc8;}else{_0x7fbb55=0xce;}_0x17c09f[_0x8bc6('0x1d')](_0x7fbb55);return _0x17c09f[_0x8bc6('0x21')](_0x8bc6('0x22'),_0x90bf59+'-'+_0x5bbc8e+'/'+_0x2d7805)['json'](_0x3a5c8e);}return null;};}function patchUpdates(_0xdfd7cf){return function(_0x3cf819){try{jsonpatch[_0x8bc6('0x23')](_0x3cf819,_0xdfd7cf,!![]);}catch(_0x351606){return BPromise['reject'](_0x351606);}return _0x3cf819[_0x8bc6('0x24')]();};}function saveUpdates(_0xa90f66,_0xa04593){return function(_0x121d02){if(_0x121d02){return _0x121d02[_0x8bc6('0x25')](_0xa90f66)[_0x8bc6('0x26')](function(_0x185716){return _0x185716;});}return null;};}function removeEntity(_0x4bdde9,_0x4d1e7d){return function(_0x25d326){if(_0x25d326){return _0x25d326[_0x8bc6('0x27')]()[_0x8bc6('0x26')](function(){_0x4bdde9[_0x8bc6('0x1d')](0xcc)[_0x8bc6('0x28')]();});}};}function handleEntityNotFound(_0x541ad9,_0x4bdd87){return function(_0x24330d){if(!_0x24330d){_0x541ad9[_0x8bc6('0x29')](0x194);}return _0x24330d;};}function handleError(_0x478ea6,_0x523784){_0x523784=_0x523784||0x1f4;return function(_0x109844){logger[_0x8bc6('0x2a')](_0x109844[_0x8bc6('0x2b')]);if(_0x109844[_0x8bc6('0x2c')]){delete _0x109844[_0x8bc6('0x2c')];}_0x478ea6['status'](_0x523784)[_0x8bc6('0x2d')](_0x109844);};}exports[_0x8bc6('0x2e')]=function(_0x76c48d,_0x1a6853){var _0x186768={},_0x4fbcce={},_0x46810c={'count':0x0,'rows':[]};var _0x156871=_[_0x8bc6('0x2f')](db['ChatInternalMessage'][_0x8bc6('0x30')],function(_0x32719a){return{'name':_0x32719a[_0x8bc6('0x31')],'type':_0x32719a[_0x8bc6('0x32')]['key']};});_0x4fbcce[_0x8bc6('0x33')]=_['map'](_0x156871,_0x8bc6('0x2c'));_0x4fbcce['query']=_[_0x8bc6('0x34')](_0x76c48d[_0x8bc6('0x35')]);_0x4fbcce['filters']=_['intersection'](_0x4fbcce['model'],_0x4fbcce[_0x8bc6('0x35')]);_0x186768[_0x8bc6('0x36')]=_[_0x8bc6('0x37')](_0x4fbcce[_0x8bc6('0x33')],qs[_0x8bc6('0x38')](_0x76c48d[_0x8bc6('0x35')][_0x8bc6('0x38')]));_0x186768['attributes']=_0x186768[_0x8bc6('0x36')][_0x8bc6('0x39')]?_0x186768[_0x8bc6('0x36')]:_0x4fbcce['model'];if(!_0x76c48d[_0x8bc6('0x35')]['hasOwnProperty']('nolimit')){_0x186768[_0x8bc6('0x20')]=qs['limit'](_0x76c48d['query'][_0x8bc6('0x20')]);_0x186768['offset']=qs['offset'](_0x76c48d['query'][_0x8bc6('0x1e')]);}_0x186768[_0x8bc6('0x3a')]=qs[_0x8bc6('0x3b')](_0x76c48d[_0x8bc6('0x35')]['sort']);_0x186768[_0x8bc6('0x3c')]=qs[_0x8bc6('0x3d')](_[_0x8bc6('0x3e')](_0x76c48d['query'],_0x4fbcce[_0x8bc6('0x3d')]),_0x156871);if(_0x76c48d[_0x8bc6('0x35')][_0x8bc6('0x3f')]){_0x186768[_0x8bc6('0x3c')]=_['merge'](_0x186768[_0x8bc6('0x3c')],{'$or':_[_0x8bc6('0x2f')](_0x156871,function(_0x22ed3a){if(_0x22ed3a[_0x8bc6('0x32')]!==_0x8bc6('0x40')){var _0x4ac7b7={};_0x4ac7b7[_0x22ed3a[_0x8bc6('0x2c')]]={'$like':'%'+_0x76c48d[_0x8bc6('0x35')]['filter']+'%'};return _0x4ac7b7;}})});}_0x186768=_[_0x8bc6('0x41')]({},_0x186768,_0x76c48d[_0x8bc6('0x42')]);var _0x52c915={'where':_0x186768['where']};return db[_0x8bc6('0x43')]['count'](_0x52c915)['then'](function(_0x110b6f){_0x46810c[_0x8bc6('0x44')]=_0x110b6f;if(_0x76c48d[_0x8bc6('0x35')]['includeAll']){_0x186768['include']=[{'all':!![]}];}return db['ChatInternalMessage'][_0x8bc6('0x45')](_0x186768);})[_0x8bc6('0x26')](function(_0xc3b6e){_0x46810c[_0x8bc6('0x46')]=_0xc3b6e;return _0x46810c;})[_0x8bc6('0x26')](respondWithFilteredResult(_0x1a6853,_0x186768))[_0x8bc6('0x47')](handleError(_0x1a6853,null));};exports[_0x8bc6('0x48')]=function(_0xa3a962,_0x257370){var _0x222a66={'raw':!![],'where':{'id':_0xa3a962[_0x8bc6('0x49')]['id']}},_0x134ef3={};_0x134ef3[_0x8bc6('0x33')]=_[_0x8bc6('0x34')](db[_0x8bc6('0x43')][_0x8bc6('0x30')]);_0x134ef3[_0x8bc6('0x35')]=_[_0x8bc6('0x34')](_0xa3a962[_0x8bc6('0x35')]);_0x134ef3[_0x8bc6('0x3d')]=_[_0x8bc6('0x37')](_0x134ef3['model'],_0x134ef3[_0x8bc6('0x35')]);_0x222a66['attributes']=_['intersection'](_0x134ef3[_0x8bc6('0x33')],qs['fields'](_0xa3a962[_0x8bc6('0x35')][_0x8bc6('0x38')]));_0x222a66[_0x8bc6('0x36')]=_0x222a66['attributes']['length']?_0x222a66['attributes']:_0x134ef3[_0x8bc6('0x33')];if(_0xa3a962['query']['includeAll']){_0x222a66[_0x8bc6('0x4a')]=[{'all':!![]}];}_0x222a66=_[_0x8bc6('0x41')]({},_0x222a66,_0xa3a962[_0x8bc6('0x42')]);return db[_0x8bc6('0x43')]['find'](_0x222a66)[_0x8bc6('0x26')](handleEntityNotFound(_0x257370,null))['then'](respondWithResult(_0x257370,null))['catch'](handleError(_0x257370,null));};exports[_0x8bc6('0x4b')]=function(_0x5114ea,_0x58e778){return db[_0x8bc6('0x43')][_0x8bc6('0x4b')](_0x5114ea[_0x8bc6('0x4c')],{})[_0x8bc6('0x26')](respondWithResult(_0x58e778,0xc9))['catch'](handleError(_0x58e778,null));};exports[_0x8bc6('0x25')]=function(_0x372501,_0x10389e){if(_0x372501['body']['id']){delete _0x372501['body']['id'];}return db[_0x8bc6('0x43')][_0x8bc6('0x4d')]({'where':{'id':_0x372501[_0x8bc6('0x49')]['id']}})[_0x8bc6('0x26')](handleEntityNotFound(_0x10389e,null))['then'](saveUpdates(_0x372501[_0x8bc6('0x4c')],null))[_0x8bc6('0x26')](respondWithResult(_0x10389e,null))['catch'](handleError(_0x10389e,null));};exports[_0x8bc6('0x27')]=function(_0x1f12bb,_0x5447cd){return db[_0x8bc6('0x43')][_0x8bc6('0x4d')]({'where':{'id':_0x1f12bb[_0x8bc6('0x49')]['id']}})[_0x8bc6('0x26')](handleEntityNotFound(_0x5447cd,null))[_0x8bc6('0x26')](removeEntity(_0x5447cd,null))['catch'](handleError(_0x5447cd,null));};exports[_0x8bc6('0x4e')]=function(_0x1c3429,_0x43dc59){return db[_0x8bc6('0x43')][_0x8bc6('0x4e')]()[_0x8bc6('0x26')](respondWithResult(_0x43dc59,null))['catch'](handleError(_0x43dc59,null));};function wrapUser(_0x184eff){return function(_0x140721){var _0xb6d743=_0x184eff[_0x8bc6('0x4f')]({'plain':!![]});_0xb6d743[_0x8bc6('0x50')]=[];if(_0x140721){_0xb6d743['lastMessageAt']=_0x140721['createdAt'];_0xb6d743[_0x8bc6('0x51')]=_0x140721;}else{_0xb6d743['lastMessageAt']=moment(0x0)['format'](_0x8bc6('0x52'));_0xb6d743['lastMessage']={};}return _0xb6d743;};}exports['getUsers']=function(_0x1f2952,_0xf3e194,_0x4c5f4f){var _0xc06c98=[];return db[_0x8bc6('0x53')]['findAll']({'where':{'role':[_0x8bc6('0x54'),_0x8bc6('0x55'),_0x8bc6('0x56')]},'attributes':['id','fullname',_0x8bc6('0x2c'),'role',_0x8bc6('0x57'),'internal','online',_0x8bc6('0x58'),_0x8bc6('0x59'),_0x8bc6('0x5a')],'order':qs[_0x8bc6('0x3b')](_0x8bc6('0x5b')),'include':[{'model':db[_0x8bc6('0x5c')],'as':_0x8bc6('0x5d'),'attributes':['id',_0x8bc6('0x2c'),_0x8bc6('0x32')],'through':{'attributes':[]}}]})[_0x8bc6('0x26')](function(_0x423bed){if(_0x423bed){var _0x29cc64=_0x1f2952[_0x8bc6('0x56')]['get']({'plain':!![]});if(!_0x29cc64)throw new Error(_0x8bc6('0x5e'));if(_0x29cc64[_0x8bc6('0x5f')]===_0x8bc6('0x56')){return db[_0x8bc6('0x60')]['find']({'where':{'name':_0x8bc6('0x61'),'userProfileId':_0x29cc64['userProfileId']},'raw':!![]})[_0x8bc6('0x26')](function(_0x2484e9){if(_0x2484e9){if(_0x2484e9[_0x8bc6('0x62')]===0x0){return db[_0x8bc6('0x63')][_0x8bc6('0x45')]({'where':{'sectionId':_0x2484e9['id']},'raw':!![]})[_0x8bc6('0x26')](function(_0x337cfd){var _0x8b57a1=[];if(_[_0x8bc6('0x64')](_0x337cfd)){_0x8b57a1=_[_0x8bc6('0x3f')](_0x423bed,function(_0x5ed501){if(_0x5ed501[_0x8bc6('0x5f')]!==_0x8bc6('0x54')){return _0x5ed501;}});return _0x8b57a1;}else{for(var _0x2b2de5=0x0;_0x2b2de5<_0x423bed[_0x8bc6('0x39')];_0x2b2de5++){var _0x16f762=_0x423bed[_0x2b2de5];if(_0x16f762['role']===_0x8bc6('0x54')){var _0x1a54f0=_[_0x8bc6('0x4d')](_0x337cfd,function(_0x14868e){return _0x14868e[_0x8bc6('0x65')]===_0x16f762['id'];});if(_0x1a54f0)_0x8b57a1['push'](_0x16f762);}else{_0x8b57a1[_0x8bc6('0x66')](_0x16f762);}}return _0x8b57a1;}});}else{return _0x423bed;}}else{var _0x32caef=_[_0x8bc6('0x3f')](_0x423bed,function(_0x2f6a23){if(_0x2f6a23[_0x8bc6('0x5f')]!==_0x8bc6('0x54')){return _0x2f6a23;}});return _0x32caef;}});}else{return _0x423bed;}}})[_0x8bc6('0x26')](function(_0x5d18f1){var _0x35168c=[];if(_0x5d18f1){_0xc06c98=_0x5d18f1;for(var _0x2681c3=0x0;_0x2681c3<_0x5d18f1[_0x8bc6('0x39')];_0x2681c3+=0x1){_0xc06c98[_0x2681c3][_0x8bc6('0x50')]=[];_0x35168c[_0x8bc6('0x66')](db[_0x8bc6('0x43')][_0x8bc6('0x4d')]({'where':{'FromId':[_0x1f2952['user']['id'],_0x5d18f1[_0x2681c3]['id']],'ToId':[_0x1f2952['user']['id'],_0x5d18f1[_0x2681c3]['id']],'ChatGroupId':null},'attributes':['id',_0x8bc6('0x67'),_0x8bc6('0x68'),'ToId',_0x8bc6('0x69'),_0x8bc6('0x4c')],'order':qs['sort']('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x5d18f1[_0x2681c3])));}return BPromise['all'](_0x35168c);}return[];})[_0x8bc6('0x26')](function(_0x4eff6){return{'rows':_0x4eff6,'count':_0x4eff6[_0x8bc6('0x39')]};})[_0x8bc6('0x26')](respondWithResult(_0xf3e194,null))['catch'](handleError(_0xf3e194,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 7268708..f251414 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 _0x0b7f=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners'];(function(_0x38f6aa,_0x32503d){var _0xaa2345=function(_0x446e06){while(--_0x446e06){_0x38f6aa['push'](_0x38f6aa['shift']());}};_0xaa2345(++_0x32503d);}(_0x0b7f,0x115));var _0xf0b7=function(_0x787d44,_0x36fea9){_0x787d44=_0x787d44-0x0;var _0x1c1430=_0x0b7f[_0x787d44];return _0x1c1430;};'use strict';var EventEmitter=require(_0xf0b7('0x0'));var ChatInternalMessage=require(_0xf0b7('0x1'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xf0b7('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf0b7('0x3'),'afterDestroy':_0xf0b7('0x4')};function emitEvent(_0x20e3e8){return function(_0x4cd257,_0x5c4ce8,_0x28d608){ChatInternalMessageEvents[_0xf0b7('0x5')](_0x20e3e8+':'+_0x4cd257['id'],_0x4cd257);ChatInternalMessageEvents[_0xf0b7('0x5')](_0x20e3e8,_0x4cd257);_0x28d608(null);};}for(var e in events){if(events[_0xf0b7('0x6')](e)){var event=events[e];ChatInternalMessage[_0xf0b7('0x7')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file +var _0xf5ff=['setMaxListeners','save','emit','exports','events','ChatInternalMessage'];(function(_0x8bb2ba,_0x1d2097){var _0x2464c5=function(_0x1baee4){while(--_0x1baee4){_0x8bb2ba['push'](_0x8bb2ba['shift']());}};_0x2464c5(++_0x1d2097);}(_0xf5ff,0xbe));var _0xff5f=function(_0xc60eb5,_0x59eea4){_0xc60eb5=_0xc60eb5-0x0;var _0x3c5554=_0xf5ff[_0xc60eb5];return _0x3c5554;};'use strict';var EventEmitter=require(_0xff5f('0x0'));var ChatInternalMessage=require('../../mysqldb')['db'][_0xff5f('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xff5f('0x2')](0x0);var events={'afterCreate':_0xff5f('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x592538){return function(_0x7f44f2,_0x1cc84f,_0x4606a2){ChatInternalMessageEvents[_0xff5f('0x4')](_0x592538+':'+_0x7f44f2['id'],_0x7f44f2);ChatInternalMessageEvents[_0xff5f('0x4')](_0x592538,_0x7f44f2);_0x4606a2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0xff5f('0x5')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index d9f9e28..de6e50f 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 _0x38e4=['path','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x38e4,0xa9));var _0x438e=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x38e4[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0x438e('0x0'));var util=require(_0x438e('0x1'));var logger=require(_0x438e('0x2'))(_0x438e('0x3'));var moment=require(_0x438e('0x4'));var BPromise=require(_0x438e('0x5'));var rp=require(_0x438e('0x6'));var fs=require('fs');var path=require(_0x438e('0x7'));var rimraf=require(_0x438e('0x8'));var config=require(_0x438e('0x9'));var attributes=require(_0x438e('0xa'));module[_0x438e('0xb')]=function(_0xa30574,_0x38df29){return _0xa30574[_0x438e('0xc')]('ChatInternalMessage',attributes,{'tableName':_0x438e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x438e('0xe'),'collate':_0x438e('0xf')});}; \ No newline at end of file +var _0x58be=['rimraf','../../config/environment','./chatInternalMessage.attributes','define','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','request-promise','path'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x58be,0x158));var _0xe58b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x58be[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xe58b('0x0'));var util=require(_0xe58b('0x1'));var logger=require('../../config/logger')(_0xe58b('0x2'));var moment=require(_0xe58b('0x3'));var BPromise=require('bluebird');var rp=require(_0xe58b('0x4'));var fs=require('fs');var path=require(_0xe58b('0x5'));var rimraf=require(_0xe58b('0x6'));var config=require(_0xe58b('0x7'));var attributes=require(_0xe58b('0x8'));module['exports']=function(_0x1f1237,_0x4cdbe9){return _0x1f1237[_0xe58b('0x9')](_0xe58b('0xa'),attributes,{'tableName':_0xe58b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe58b('0xc'),'collate':_0xe58b('0xd')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 422f4a8..9ac1786 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 _0x2908=['redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','then','info','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','ChatInternalMessage,\x20%s,\x20%s','result','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','client'];(function(_0x337972,_0x1f1182){var _0x4b3f58=function(_0x254827){while(--_0x254827){_0x337972['push'](_0x337972['shift']());}};_0x4b3f58(++_0x1f1182);}(_0x2908,0x1ef));var _0x8290=function(_0x36310d,_0x5e3999){_0x36310d=_0x36310d-0x0;var _0x3d622d=_0x2908[_0x36310d];return _0x3d622d;};'use strict';var _=require(_0x8290('0x0'));var util=require(_0x8290('0x1'));var moment=require(_0x8290('0x2'));var BPromise=require(_0x8290('0x3'));var rs=require(_0x8290('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8290('0x5'));var logger=require('../../config/logger')(_0x8290('0x6'));var config=require(_0x8290('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8290('0x8')]['http']({'port':0x232a});config[_0x8290('0x9')]=_[_0x8290('0xa')](config['redis'],{'host':_0x8290('0xb'),'port':0x18eb});var socket=require(_0x8290('0xc'))(new Redis(config[_0x8290('0x9')]));require(_0x8290('0xd'))['register'](socket);function respondWithRpcPromise(_0x21fca1,_0x46e0c9,_0x2b0c6a){return new BPromise(function(_0x46fb6b,_0x226edc){return client['request'](_0x21fca1,_0x2b0c6a)[_0x8290('0xe')](function(_0x3037b8){logger[_0x8290('0xf')]('ChatInternalMessage,\x20%s,\x20%s',_0x46e0c9,'request\x20sent');logger['debug'](_0x8290('0x10'),_0x46e0c9,_0x8290('0x11'),JSON[_0x8290('0x12')](_0x3037b8));if(_0x3037b8[_0x8290('0x13')]){if(_0x3037b8[_0x8290('0x13')][_0x8290('0x14')]===0x1f4){logger[_0x8290('0x13')]('ChatInternalMessage,\x20%s,\x20%s',_0x46e0c9,_0x3037b8[_0x8290('0x13')][_0x8290('0x15')]);return _0x226edc(_0x3037b8[_0x8290('0x13')][_0x8290('0x15')]);}logger['error'](_0x8290('0x16'),_0x46e0c9,_0x3037b8[_0x8290('0x13')][_0x8290('0x15')]);return _0x46fb6b(_0x3037b8['error'][_0x8290('0x15')]);}else{logger[_0x8290('0xf')](_0x8290('0x16'),_0x46e0c9,_0x8290('0x11'));_0x46fb6b(_0x3037b8[_0x8290('0x17')][_0x8290('0x15')]);}})['catch'](function(_0x4caf0c){logger[_0x8290('0x13')](_0x8290('0x16'),_0x46e0c9,_0x4caf0c);_0x226edc(_0x4caf0c);});});} \ No newline at end of file +var _0x0b31=['then','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','request'];(function(_0x4ed32d,_0x327695){var _0xf624df=function(_0x29518c){while(--_0x29518c){_0x4ed32d['push'](_0x4ed32d['shift']());}};_0xf624df(++_0x327695);}(_0x0b31,0x1a2));var _0x10b3=function(_0x59f15c,_0x24bf17){_0x59f15c=_0x59f15c-0x0;var _0xfb1050=_0x0b31[_0x59f15c];return _0xfb1050;};'use strict';var _=require(_0x10b3('0x0'));var util=require(_0x10b3('0x1'));var moment=require(_0x10b3('0x2'));var BPromise=require('bluebird');var rs=require(_0x10b3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x10b3('0x4'));var logger=require(_0x10b3('0x5'))(_0x10b3('0x6'));var config=require(_0x10b3('0x7'));var jayson=require(_0x10b3('0x8'));var client=jayson[_0x10b3('0x9')][_0x10b3('0xa')]({'port':0x232a});config[_0x10b3('0xb')]=_[_0x10b3('0xc')](config['redis'],{'host':_0x10b3('0xd'),'port':0x18eb});var socket=require(_0x10b3('0xe'))(new Redis(config[_0x10b3('0xb')]));require(_0x10b3('0xf'))['register'](socket);function respondWithRpcPromise(_0x1fd8a6,_0x38c841,_0x5dc288){return new BPromise(function(_0x133c70,_0x43aaf2){return client[_0x10b3('0x10')](_0x1fd8a6,_0x5dc288)[_0x10b3('0x11')](function(_0x3341e4){logger['info'](_0x10b3('0x12'),_0x38c841,_0x10b3('0x13'));logger[_0x10b3('0x14')](_0x10b3('0x15'),_0x38c841,'request\x20sent',JSON[_0x10b3('0x16')](_0x3341e4));if(_0x3341e4[_0x10b3('0x17')]){if(_0x3341e4[_0x10b3('0x17')][_0x10b3('0x18')]===0x1f4){logger[_0x10b3('0x17')](_0x10b3('0x12'),_0x38c841,_0x3341e4[_0x10b3('0x17')][_0x10b3('0x19')]);return _0x43aaf2(_0x3341e4['error']['message']);}logger['error'](_0x10b3('0x12'),_0x38c841,_0x3341e4['error'][_0x10b3('0x19')]);return _0x133c70(_0x3341e4[_0x10b3('0x17')]['message']);}else{logger[_0x10b3('0x1a')](_0x10b3('0x12'),_0x38c841,'request\x20sent');_0x133c70(_0x3341e4[_0x10b3('0x1b')][_0x10b3('0x19')]);}})[_0x10b3('0x1c')](function(_0x19e3fe){logger['error'](_0x10b3('0x12'),_0x38c841,_0x19e3fe);_0x43aaf2(_0x19e3fe);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 11b6f89..0d4bfdc 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 _0x24fc=['save','remove','emit','removeListener','register','length','chatInternalMessage:','./chatInternalMessage.events'];(function(_0x6a6b3,_0x4c48ee){var _0x13e9c9=function(_0x240d62){while(--_0x240d62){_0x6a6b3['push'](_0x6a6b3['shift']());}};_0x13e9c9(++_0x4c48ee);}(_0x24fc,0xb7));var _0xc24f=function(_0x42b9e5,_0x32d2f9){_0x42b9e5=_0x42b9e5-0x0;var _0x2f76e2=_0x24fc[_0x42b9e5];return _0x2f76e2;};'use strict';var ChatInternalMessageEvents=require(_0xc24f('0x0'));var events=[_0xc24f('0x1'),_0xc24f('0x2'),'update'];function createListener(_0x3f1e58,_0x5b1f98){return function(_0x14ed8d){_0x5b1f98[_0xc24f('0x3')](_0x3f1e58,_0x14ed8d);};}function removeListener(_0x51dd06,_0x525ab7){return function(){ChatInternalMessageEvents[_0xc24f('0x4')](_0x51dd06,_0x525ab7);};}exports[_0xc24f('0x5')]=function(_0x31738f){for(var _0x33d669=0x0,_0x59eb17=events[_0xc24f('0x6')];_0x33d669<_0x59eb17;_0x33d669++){var _0x4b0291=events[_0x33d669];var _0x623e8f=createListener(_0xc24f('0x7')+_0x4b0291,_0x31738f);ChatInternalMessageEvents['on'](_0x4b0291,_0x623e8f);}}; \ No newline at end of file +var _0xfc00=['emit','removeListener','register','length','chatInternalMessage:','./chatInternalMessage.events','remove','update'];(function(_0x237a26,_0x4d9a41){var _0x2b12c9=function(_0x4103f5){while(--_0x4103f5){_0x237a26['push'](_0x237a26['shift']());}};_0x2b12c9(++_0x4d9a41);}(_0xfc00,0x1d5));var _0x0fc0=function(_0x3826ad,_0x49a30d){_0x3826ad=_0x3826ad-0x0;var _0x17b900=_0xfc00[_0x3826ad];return _0x17b900;};'use strict';var ChatInternalMessageEvents=require(_0x0fc0('0x0'));var events=['save',_0x0fc0('0x1'),_0x0fc0('0x2')];function createListener(_0xcc99d7,_0xa5cc2){return function(_0x5e49dd){_0xa5cc2[_0x0fc0('0x3')](_0xcc99d7,_0x5e49dd);};}function removeListener(_0x9b95e5,_0x3832bb){return function(){ChatInternalMessageEvents[_0x0fc0('0x4')](_0x9b95e5,_0x3832bb);};}exports[_0x0fc0('0x5')]=function(_0x582b65){for(var _0x4b540a=0x0,_0x43e07f=events[_0x0fc0('0x6')];_0x4b540a<_0x43e07f;_0x4b540a++){var _0x42942d=events[_0x4b540a];var _0xe0939d=createListener(_0x0fc0('0x7')+_0x42942d,_0x582b65);ChatInternalMessageEvents['on'](_0x42942d,_0xe0939d);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 17a3edc..ef909c8 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 _0x9bb1=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','describe','/users','getUsers','/:id','show','post','create','update','delete'];(function(_0x122424,_0x518a79){var _0x2a1679=function(_0x4ddd83){while(--_0x4ddd83){_0x122424['push'](_0x122424['shift']());}};_0x2a1679(++_0x518a79);}(_0x9bb1,0x152));var _0x19bb=function(_0x2bd9cd,_0x2887d5){_0x2bd9cd=_0x2bd9cd-0x0;var _0x23453b=_0x9bb1[_0x2bd9cd];return _0x23453b;};'use strict';var multer=require(_0x19bb('0x0'));var util=require(_0x19bb('0x1'));var path=require(_0x19bb('0x2'));var timeout=require(_0x19bb('0x3'));var express=require(_0x19bb('0x4'));var router=express[_0x19bb('0x5')]();var fs_extra=require(_0x19bb('0x6'));var auth=require(_0x19bb('0x7'));var interaction=require(_0x19bb('0x8'));var config=require(_0x19bb('0x9'));var controller=require(_0x19bb('0xa'));router[_0x19bb('0xb')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth[_0x19bb('0xc')](),controller[_0x19bb('0xd')]);router[_0x19bb('0xb')](_0x19bb('0xe'),auth[_0x19bb('0xc')](),controller[_0x19bb('0xf')]);router[_0x19bb('0xb')](_0x19bb('0x10'),auth[_0x19bb('0xc')](),controller[_0x19bb('0x11')]);router[_0x19bb('0x12')]('/',auth[_0x19bb('0xc')](),controller[_0x19bb('0x13')]);router['put'](_0x19bb('0x10'),controller[_0x19bb('0x14')]);router[_0x19bb('0x15')](_0x19bb('0x10'),auth[_0x19bb('0xc')](),controller[_0x19bb('0x16')]);module[_0x19bb('0x17')]=router; \ No newline at end of file +var _0xfe8d=['/:id','show','post','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','./chatInternalMessage.controller','get','isAuthenticated','/describe','describe','/users','getUsers'];(function(_0x2bd7ef,_0x279212){var _0x42e78a=function(_0x1369d4){while(--_0x1369d4){_0x2bd7ef['push'](_0x2bd7ef['shift']());}};_0x42e78a(++_0x279212);}(_0xfe8d,0x15b));var _0xdfe8=function(_0x3f98a7,_0x2230ae){_0x3f98a7=_0x3f98a7-0x0;var _0x190227=_0xfe8d[_0x3f98a7];return _0x190227;};'use strict';var multer=require(_0xdfe8('0x0'));var util=require(_0xdfe8('0x1'));var path=require('path');var timeout=require(_0xdfe8('0x2'));var express=require(_0xdfe8('0x3'));var router=express[_0xdfe8('0x4')]();var fs_extra=require(_0xdfe8('0x5'));var auth=require(_0xdfe8('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xdfe8('0x7'));router[_0xdfe8('0x8')]('/',auth[_0xdfe8('0x9')](),controller['index']);router['get'](_0xdfe8('0xa'),auth[_0xdfe8('0x9')](),controller[_0xdfe8('0xb')]);router[_0xdfe8('0x8')](_0xdfe8('0xc'),auth[_0xdfe8('0x9')](),controller[_0xdfe8('0xd')]);router[_0xdfe8('0x8')](_0xdfe8('0xe'),auth[_0xdfe8('0x9')](),controller[_0xdfe8('0xf')]);router[_0xdfe8('0x10')]('/',auth[_0xdfe8('0x9')](),controller['create']);router['put'](_0xdfe8('0xe'),controller['update']);router[_0xdfe8('0x11')](_0xdfe8('0xe'),auth[_0xdfe8('0x9')](),controller['destroy']);module[_0xdfe8('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index d2f26d5..89096bb 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 _0x7633=['DATE','STRING','sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x5da535,_0x9c65ae){var _0x54c87e=function(_0x876261){while(--_0x876261){_0x5da535['push'](_0x5da535['shift']());}};_0x54c87e(++_0x9c65ae);}(_0x7633,0x1c4));var _0x3763=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x7633[_0x160c73];return _0xd9302;};'use strict';var Sequelize=require(_0x3763('0x0'));module[_0x3763('0x1')]={'body':{'type':Sequelize[_0x3763('0x2')](_0x3763('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x3763('0x4')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x3763('0x5')]('in',_0x3763('0x6')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x3763('0x7')]},'providerName':{'type':Sequelize[_0x3763('0x8')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x6f59=['BOOLEAN','ENUM','out','DATE','STRING','sequelize','exports','TEXT','medium'];(function(_0x4a74e,_0x51c3e2){var _0x527e45=function(_0x204fd6){while(--_0x204fd6){_0x4a74e['push'](_0x4a74e['shift']());}};_0x527e45(++_0x51c3e2);}(_0x6f59,0x1be));var _0x96f5=function(_0x575d29,_0x45a14c){_0x575d29=_0x575d29-0x0;var _0x236d7b=_0x6f59[_0x575d29];return _0x236d7b;};'use strict';var Sequelize=require(_0x96f5('0x0'));module[_0x96f5('0x1')]={'body':{'type':Sequelize[_0x96f5('0x2')](_0x96f5('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x96f5('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x96f5('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x96f5('0x5')]('in',_0x96f5('0x6')),'defaultValue':_0x96f5('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0x96f5('0x7')]},'providerName':{'type':Sequelize[_0x96f5('0x8')]},'providerResponse':{'type':Sequelize[_0x96f5('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 44efc57..961ae93 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 _0xeae9=['accept','chat','acceptMessage','reject','UserId','user','agent','get','ChatInteraction','ChatInteractionId','role','interaction','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','parse','formData','util','lodash','../../components/interaction/service','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','chat-interactions','request','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','status','json','offset','undefined','limit','count','set','update','then','destroy','end','sendStatus','name','send','index','rawAttributes','type','model','map','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','merge','VIRTUAL','options','where','ChatMessage','includeAll','include','findAll','rows','show','params','fields','find','create','body','describe'];(function(_0x370254,_0x4acf36){var _0xa00514=function(_0xc8da84){while(--_0xc8da84){_0x370254['push'](_0x370254['shift']());}};_0xa00514(++_0x4acf36);}(_0xeae9,0x8b));var _0x9eae=function(_0x95c465,_0x1f7f82){_0x95c465=_0x95c465-0x0;var _0x386c2d=_0xeae9[_0x95c465];return _0x386c2d;};'use strict';var util=require(_0x9eae('0x0'));var _=require(_0x9eae('0x1'));var Redis=require('ioredis');var interactionService=require(_0x9eae('0x2'));var qs=require('../../components/parsers/qs');var logger=require(_0x9eae('0x3'))(_0x9eae('0x4'));var config=require(_0x9eae('0x5'));var db=require(_0x9eae('0x6'))['db'];config[_0x9eae('0x7')]=_[_0x9eae('0x8')](config[_0x9eae('0x7')],{'host':_0x9eae('0x9'),'port':0x18eb});var socket=require(_0x9eae('0xa'))(new Redis(config[_0x9eae('0x7')]));require(_0x9eae('0xb'))[_0x9eae('0xc')](socket);var jayson=require(_0x9eae('0xd'));var client=jayson[_0x9eae('0xe')][_0x9eae('0xf')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});var interaction_log=require(_0x9eae('0x3'))(_0x9eae('0x10'));function respondWithRpcPromise(_0x274dd2,_0x5dde5a,_0x673249,_0x23e67c){return new Promise(function(_0x22fbd5,_0x219c10){var _0x390fc6=_0x23e67c||client;return _0x390fc6[_0x9eae('0x11')](_0x274dd2,_0x673249)['then'](function(_0x5f1392){logger[_0x9eae('0x12')](_0x9eae('0x13'),_0x5dde5a,_0x9eae('0x14'));logger[_0x9eae('0x15')](_0x9eae('0x16'),_0x5dde5a,'request\x20sent',JSON[_0x9eae('0x17')](_0x5f1392));if(_0x5f1392['error']){if(_0x5f1392['error'][_0x9eae('0x18')]===0x1f4){logger[_0x9eae('0x19')]('ChatMessage,\x20%s,\x20%s',_0x5dde5a,_0x5f1392[_0x9eae('0x19')][_0x9eae('0x1a')]);return _0x219c10(_0x5f1392[_0x9eae('0x19')]['message']);}logger['error'](_0x9eae('0x13'),_0x5dde5a,_0x5f1392[_0x9eae('0x19')]['message']);return _0x22fbd5(_0x5f1392[_0x9eae('0x19')]['message']);}else{logger['info'](_0x9eae('0x13'),_0x5dde5a,_0x9eae('0x14'));_0x22fbd5(_0x5f1392[_0x9eae('0x1b')][_0x9eae('0x1a')]);}})[_0x9eae('0x1c')](function(_0x5005e9){logger[_0x9eae('0x19')](_0x9eae('0x13'),_0x5dde5a,_0x5005e9);_0x219c10(_0x5005e9);});});}function respondWithResult(_0x281cdc,_0x372378){_0x372378=_0x372378||0xc8;return function(_0x1e959e){if(_0x1e959e){return _0x281cdc[_0x9eae('0x1d')](_0x372378)[_0x9eae('0x1e')](_0x1e959e);}};}function respondWithFilteredResult(_0x2ee489,_0x42a002){return function(_0x16c921){if(_0x16c921){var _0x3ce277=typeof _0x42a002[_0x9eae('0x1f')]===_0x9eae('0x20')&&typeof _0x42a002[_0x9eae('0x21')]==='undefined';var _0x13ee00=_0x16c921[_0x9eae('0x22')];var _0x4cf256=_0x3ce277?0x0:_0x42a002[_0x9eae('0x1f')];var _0x408223=_0x3ce277?_0x16c921['count']:_0x42a002[_0x9eae('0x1f')]+_0x42a002[_0x9eae('0x21')];var _0x257068;if(_0x408223>=_0x13ee00){_0x408223=_0x13ee00;_0x257068=0xc8;}else{_0x257068=0xce;}_0x2ee489[_0x9eae('0x1d')](_0x257068);return _0x2ee489[_0x9eae('0x23')]('Content-Range',_0x4cf256+'-'+_0x408223+'/'+_0x13ee00)[_0x9eae('0x1e')](_0x16c921);}return null;};}function saveUpdates(_0x5122ae){return function(_0x57f2ca){if(_0x57f2ca){return _0x57f2ca[_0x9eae('0x24')](_0x5122ae)[_0x9eae('0x25')](function(_0x2eea02){return _0x2eea02;});}return null;};}function removeEntity(_0x5b333e){return function(_0x15afd1){if(_0x15afd1){return _0x15afd1[_0x9eae('0x26')]()[_0x9eae('0x25')](function(){_0x5b333e[_0x9eae('0x1d')](0xcc)[_0x9eae('0x27')]();});}};}function handleEntityNotFound(_0x5c942d){return function(_0x3803a2){if(!_0x3803a2){_0x5c942d[_0x9eae('0x28')](0x194);}return _0x3803a2;};}function handleError(_0x2f6eda,_0x5f073b){_0x5f073b=_0x5f073b||0x1f4;return function(_0x5c0932){logger[_0x9eae('0x19')](_0x5c0932['stack']);if(_0x5c0932[_0x9eae('0x29')]){delete _0x5c0932[_0x9eae('0x29')];}_0x2f6eda[_0x9eae('0x1d')](_0x5f073b)[_0x9eae('0x2a')](_0x5c0932);};}exports[_0x9eae('0x2b')]=function(_0x1349b3,_0x514e1d){var _0x30dd56={},_0x261ff8={},_0x1d9450={'count':0x0,'rows':[]};var _0x5a4937=_['map'](db['ChatMessage'][_0x9eae('0x2c')],function(_0x3146f1){return{'name':_0x3146f1['fieldName'],'type':_0x3146f1[_0x9eae('0x2d')]['key']};});_0x261ff8[_0x9eae('0x2e')]=_[_0x9eae('0x2f')](_0x5a4937,_0x9eae('0x29'));_0x261ff8['query']=_[_0x9eae('0x30')](_0x1349b3[_0x9eae('0x31')]);_0x261ff8[_0x9eae('0x32')]=_[_0x9eae('0x33')](_0x261ff8[_0x9eae('0x2e')],_0x261ff8[_0x9eae('0x31')]);_0x30dd56[_0x9eae('0x34')]=_['intersection'](_0x261ff8[_0x9eae('0x2e')],qs['fields'](_0x1349b3['query']['fields']));_0x30dd56[_0x9eae('0x34')]=_0x30dd56[_0x9eae('0x34')][_0x9eae('0x35')]?_0x30dd56[_0x9eae('0x34')]:_0x261ff8[_0x9eae('0x2e')];if(!_0x1349b3[_0x9eae('0x31')][_0x9eae('0x36')](_0x9eae('0x37'))){_0x30dd56['limit']=qs['limit'](_0x1349b3[_0x9eae('0x31')][_0x9eae('0x21')]);_0x30dd56[_0x9eae('0x1f')]=qs[_0x9eae('0x1f')](_0x1349b3[_0x9eae('0x31')][_0x9eae('0x1f')]);}_0x30dd56['order']=qs['sort'](_0x1349b3[_0x9eae('0x31')][_0x9eae('0x38')]);_0x30dd56['where']=qs[_0x9eae('0x32')](_[_0x9eae('0x39')](_0x1349b3['query'],_0x261ff8[_0x9eae('0x32')]),_0x5a4937);if(_0x1349b3[_0x9eae('0x31')][_0x9eae('0x3a')]){_0x30dd56['where']=_[_0x9eae('0x3b')](_0x30dd56['where'],{'$or':_[_0x9eae('0x2f')](_0x5a4937,function(_0x31273c){if(_0x31273c['type']!==_0x9eae('0x3c')){var _0x338dd0={};_0x338dd0[_0x31273c[_0x9eae('0x29')]]={'$like':'%'+_0x1349b3['query']['filter']+'%'};return _0x338dd0;}})});}_0x30dd56=_[_0x9eae('0x3b')]({},_0x30dd56,_0x1349b3[_0x9eae('0x3d')]);var _0x507451={'where':_0x30dd56[_0x9eae('0x3e')]};return db[_0x9eae('0x3f')][_0x9eae('0x22')](_0x507451)[_0x9eae('0x25')](function(_0xccaaca){_0x1d9450[_0x9eae('0x22')]=_0xccaaca;if(_0x1349b3['query'][_0x9eae('0x40')]){_0x30dd56[_0x9eae('0x41')]=[{'all':!![]}];}return db[_0x9eae('0x3f')][_0x9eae('0x42')](_0x30dd56);})[_0x9eae('0x25')](function(_0x342545){_0x1d9450[_0x9eae('0x43')]=_0x342545;return _0x1d9450;})[_0x9eae('0x25')](respondWithFilteredResult(_0x514e1d,_0x30dd56))[_0x9eae('0x1c')](handleError(_0x514e1d,null));};exports[_0x9eae('0x44')]=function(_0xca54fa,_0x46a2cb){var _0xedd896={'raw':!![],'where':{'id':_0xca54fa[_0x9eae('0x45')]['id']}},_0x346cc6={};_0x346cc6[_0x9eae('0x2e')]=_[_0x9eae('0x30')](db[_0x9eae('0x3f')][_0x9eae('0x2c')]);_0x346cc6[_0x9eae('0x31')]=_[_0x9eae('0x30')](_0xca54fa[_0x9eae('0x31')]);_0x346cc6[_0x9eae('0x32')]=_['intersection'](_0x346cc6['model'],_0x346cc6[_0x9eae('0x31')]);_0xedd896[_0x9eae('0x34')]=_[_0x9eae('0x33')](_0x346cc6[_0x9eae('0x2e')],qs[_0x9eae('0x46')](_0xca54fa[_0x9eae('0x31')][_0x9eae('0x46')]));_0xedd896[_0x9eae('0x34')]=_0xedd896[_0x9eae('0x34')]['length']?_0xedd896[_0x9eae('0x34')]:_0x346cc6[_0x9eae('0x2e')];if(_0xca54fa[_0x9eae('0x31')][_0x9eae('0x40')]){_0xedd896[_0x9eae('0x41')]=[{'all':!![]}];}_0xedd896=_[_0x9eae('0x3b')]({},_0xedd896,_0xca54fa[_0x9eae('0x3d')]);return db['ChatMessage'][_0x9eae('0x47')](_0xedd896)[_0x9eae('0x25')](handleEntityNotFound(_0x46a2cb,null))['then'](respondWithResult(_0x46a2cb,null))[_0x9eae('0x1c')](handleError(_0x46a2cb,null));};exports['create']=function(_0x1d2237,_0x1f1ba0){return db[_0x9eae('0x3f')][_0x9eae('0x48')](_0x1d2237[_0x9eae('0x49')],{})[_0x9eae('0x25')](respondWithResult(_0x1f1ba0,0xc9))[_0x9eae('0x1c')](handleError(_0x1f1ba0,null));};exports[_0x9eae('0x24')]=function(_0x2ea0c4,_0x3f585f){if(_0x2ea0c4[_0x9eae('0x49')]['id']){delete _0x2ea0c4[_0x9eae('0x49')]['id'];}return db[_0x9eae('0x3f')][_0x9eae('0x47')]({'where':{'id':_0x2ea0c4[_0x9eae('0x45')]['id']}})[_0x9eae('0x25')](handleEntityNotFound(_0x3f585f,null))['then'](saveUpdates(_0x2ea0c4[_0x9eae('0x49')],null))[_0x9eae('0x25')](respondWithResult(_0x3f585f,null))[_0x9eae('0x1c')](handleError(_0x3f585f,null));};exports[_0x9eae('0x26')]=function(_0x17d9e4,_0x42c8ce){return db['ChatMessage'][_0x9eae('0x47')]({'where':{'id':_0x17d9e4['params']['id']}})[_0x9eae('0x25')](handleEntityNotFound(_0x42c8ce,null))[_0x9eae('0x25')](removeEntity(_0x42c8ce,null))[_0x9eae('0x1c')](handleError(_0x42c8ce,null));};exports[_0x9eae('0x4a')]=function(_0x3656b2,_0x4f6f5e){return db['ChatMessage'][_0x9eae('0x4a')]()[_0x9eae('0x25')](respondWithResult(_0x4f6f5e,null))[_0x9eae('0x1c')](handleError(_0x4f6f5e,null));};exports[_0x9eae('0x4b')]=function(_0x4bd2cf,_0xec3b8f){var _0x2ad351=_0x9eae('0x4c');return interactionService[_0x9eae('0x4d')](_0x4bd2cf,_0x2ad351)['then'](respondWithResult(_0xec3b8f,null))['catch'](handleError(_0xec3b8f,null));};exports[_0x9eae('0x4e')]=function(_0x14850d,_0x26916f){var _0x2fabb9={'agent':{},'channel':_0x9eae('0x4c')};if(_0x14850d[_0x9eae('0x49')]['id']){delete _0x14850d[_0x9eae('0x49')]['id'];}_0x14850d[_0x9eae('0x49')][_0x9eae('0x4f')]=_0x14850d[_0x9eae('0x49')]['UserId']||_0x14850d[_0x9eae('0x50')]['id'];_0x2fabb9[_0x9eae('0x51')]['id']=_0x14850d[_0x9eae('0x49')][_0x9eae('0x4f')];return db[_0x9eae('0x3f')]['find']({'where':{'id':_0x14850d[_0x9eae('0x45')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x26916f,null))[_0x9eae('0x25')](function(_0x4ca826){if(_0x4ca826){_0x2fabb9[_0x9eae('0x1a')]=_0x4ca826[_0x9eae('0x52')]({'plain':!![]});return db[_0x9eae('0x53')][_0x9eae('0x47')]({'where':{'id':_0x4ca826[_0x9eae('0x54')]}});}return null;})[_0x9eae('0x25')](handleEntityNotFound(_0x26916f,null))[_0x9eae('0x25')](function(_0x5d0cdd){if(_0x5d0cdd){_0x2fabb9['interaction']=_0x5d0cdd[_0x9eae('0x52')]({'plain':!![]});interaction_log['info']('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x14850d['user']['id'],_0x14850d[_0x9eae('0x50')]['name'],_0x14850d[_0x9eae('0x50')][_0x9eae('0x55')],_0x2fabb9[_0x9eae('0x56')]['id'],_0x14850d[_0x9eae('0x49')]?JSON[_0x9eae('0x17')](_0x14850d['body']):'null');return respondWithRpcPromise(_0x9eae('0x57'),_0x9eae('0x58'),_0x2fabb9);}return null;})[_0x9eae('0x25')](function(_0x1fe1c9){var _0xeff7f9=_0x9eae('0x59')+_0x1fe1c9[_0x9eae('0x1a')][_0x9eae('0x5a')];return db[_0x9eae('0x5b')][_0x9eae('0x31')](_0xeff7f9,{'type':db['Sequelize'][_0x9eae('0x5c')][_0x9eae('0x5d')],'raw':!![]})[_0x9eae('0x25')](function(_0x59b89e){return _0x59b89e;});})[_0x9eae('0x25')](function(_0x1a89e5){if(_0x1a89e5){_0x2fabb9[_0x9eae('0x1a')][_0x9eae('0x5e')]=_0x1a89e5[0x0];if(!_0x14850d['body'][_0x9eae('0x4f')])return;return db[_0x9eae('0x5f')][_0x9eae('0x47')]({'where':{'id':_0x14850d['body']['UserId'],'role':_0x9eae('0x51')},'attributes':['id','name',_0x9eae('0x60'),_0x9eae('0x61'),_0x9eae('0x62')],'raw':!![]});}return null;})['then'](function(_0x40cca8){if(!_0x40cca8)return null;_0x2fabb9[_0x9eae('0x1a')]['agent']=_0x40cca8;return _0x2fabb9;})[_0x9eae('0x25')](function(_0x5428dd){if(_0x5428dd){_0x5428dd[_0x9eae('0x1a')][_0x9eae('0x63')]=util['format'](_0x9eae('0x64'),_0x14850d[_0x9eae('0x50')][_0x9eae('0x29')]);_0x5428dd[_0x9eae('0x1a')][_0x9eae('0x65')]=_0x2fabb9[_0x9eae('0x65')];_0x5428dd['message'][_0x9eae('0x66')]=_0x2fabb9[_0x9eae('0x65')];_0x5428dd['message'][_0x9eae('0x67')]=_0x9eae('0x4e');respondWithRpcPromise(_0x9eae('0x68'),'EventManager',{'event':'rejectmessage','message':_[_0x9eae('0x3b')](_0x2fabb9[_0x9eae('0x1a')],JSON[_0x9eae('0x69')](_0x2fabb9[_0x9eae('0x56')][_0x9eae('0x6a')]))},client9002);return _0x2fabb9;}return null;})[_0x9eae('0x25')](respondWithResult(_0x26916f,null))[_0x9eae('0x1c')](handleError(_0x26916f,null));}; \ No newline at end of file +var _0xfe9f=['UserId','user','get','ChatInteraction','ChatInteractionId','interaction','role','null','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','contact','agent','fullname','internal','interface','format','channel','motionChannel','formData','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','./chatMessage.socket','register','jayson/promise','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','status','json','offset','undefined','limit','count','set','Content-Range','destroy','end','sendStatus','name','send','index','map','ChatMessage','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','show','params','rawAttributes','options','find','create','body','update','describe','accept','acceptMessage','reject'];(function(_0x2e2a99,_0x38d7dd){var _0x38a24f=function(_0x1ae082){while(--_0x1ae082){_0x2e2a99['push'](_0x2e2a99['shift']());}};_0x38a24f(++_0x38d7dd);}(_0xfe9f,0x1a6));var _0xffe9=function(_0x2756f9,_0x5519f5){_0x2756f9=_0x2756f9-0x0;var _0x2dad62=_0xfe9f[_0x2756f9];return _0x2dad62;};'use strict';var util=require('util');var _=require(_0xffe9('0x0'));var Redis=require(_0xffe9('0x1'));var interactionService=require(_0xffe9('0x2'));var qs=require(_0xffe9('0x3'));var logger=require(_0xffe9('0x4'))(_0xffe9('0x5'));var config=require(_0xffe9('0x6'));var db=require('../../mysqldb')['db'];config[_0xffe9('0x7')]=_[_0xffe9('0x8')](config[_0xffe9('0x7')],{'host':_0xffe9('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xffe9('0x7')]));require(_0xffe9('0xa'))[_0xffe9('0xb')](socket);var jayson=require(_0xffe9('0xc'));var client=jayson[_0xffe9('0xd')][_0xffe9('0xe')]({'port':0x232c});var client9002=jayson['client'][_0xffe9('0xe')]({'port':0x232a});var interaction_log=require('../../config/logger')('chat-interactions');function respondWithRpcPromise(_0x2fa821,_0x903c2e,_0x28c656,_0x19dce3){return new Promise(function(_0x5463bf,_0x52ed56){var _0xcad036=_0x19dce3||client;return _0xcad036[_0xffe9('0xf')](_0x2fa821,_0x28c656)[_0xffe9('0x10')](function(_0x1e18ef){logger[_0xffe9('0x11')](_0xffe9('0x12'),_0x903c2e,'request\x20sent');logger[_0xffe9('0x13')](_0xffe9('0x14'),_0x903c2e,'request\x20sent',JSON[_0xffe9('0x15')](_0x1e18ef));if(_0x1e18ef[_0xffe9('0x16')]){if(_0x1e18ef[_0xffe9('0x16')][_0xffe9('0x17')]===0x1f4){logger['error'](_0xffe9('0x12'),_0x903c2e,_0x1e18ef[_0xffe9('0x16')][_0xffe9('0x18')]);return _0x52ed56(_0x1e18ef['error']['message']);}logger[_0xffe9('0x16')]('ChatMessage,\x20%s,\x20%s',_0x903c2e,_0x1e18ef[_0xffe9('0x16')][_0xffe9('0x18')]);return _0x5463bf(_0x1e18ef[_0xffe9('0x16')][_0xffe9('0x18')]);}else{logger[_0xffe9('0x11')]('ChatMessage,\x20%s,\x20%s',_0x903c2e,_0xffe9('0x19'));_0x5463bf(_0x1e18ef[_0xffe9('0x1a')]['message']);}})[_0xffe9('0x1b')](function(_0x5e19cd){logger[_0xffe9('0x16')](_0xffe9('0x12'),_0x903c2e,_0x5e19cd);_0x52ed56(_0x5e19cd);});});}function respondWithResult(_0x4fbad9,_0x3a0c2d){_0x3a0c2d=_0x3a0c2d||0xc8;return function(_0x3433d6){if(_0x3433d6){return _0x4fbad9[_0xffe9('0x1c')](_0x3a0c2d)[_0xffe9('0x1d')](_0x3433d6);}};}function respondWithFilteredResult(_0x46dacc,_0x14bb0a){return function(_0x4d7b76){if(_0x4d7b76){var _0x308f96=typeof _0x14bb0a[_0xffe9('0x1e')]===_0xffe9('0x1f')&&typeof _0x14bb0a[_0xffe9('0x20')]==='undefined';var _0x35d086=_0x4d7b76[_0xffe9('0x21')];var _0x2d5004=_0x308f96?0x0:_0x14bb0a[_0xffe9('0x1e')];var _0x407f45=_0x308f96?_0x4d7b76[_0xffe9('0x21')]:_0x14bb0a[_0xffe9('0x1e')]+_0x14bb0a[_0xffe9('0x20')];var _0x480c06;if(_0x407f45>=_0x35d086){_0x407f45=_0x35d086;_0x480c06=0xc8;}else{_0x480c06=0xce;}_0x46dacc[_0xffe9('0x1c')](_0x480c06);return _0x46dacc[_0xffe9('0x22')](_0xffe9('0x23'),_0x2d5004+'-'+_0x407f45+'/'+_0x35d086)[_0xffe9('0x1d')](_0x4d7b76);}return null;};}function saveUpdates(_0x193077){return function(_0x2bd8e2){if(_0x2bd8e2){return _0x2bd8e2['update'](_0x193077)[_0xffe9('0x10')](function(_0x53f53b){return _0x53f53b;});}return null;};}function removeEntity(_0x133d8c){return function(_0x11ce63){if(_0x11ce63){return _0x11ce63[_0xffe9('0x24')]()[_0xffe9('0x10')](function(){_0x133d8c[_0xffe9('0x1c')](0xcc)[_0xffe9('0x25')]();});}};}function handleEntityNotFound(_0x5c3d76){return function(_0x384a54){if(!_0x384a54){_0x5c3d76[_0xffe9('0x26')](0x194);}return _0x384a54;};}function handleError(_0x5b482e,_0x2e28e6){_0x2e28e6=_0x2e28e6||0x1f4;return function(_0x58c39b){logger[_0xffe9('0x16')](_0x58c39b['stack']);if(_0x58c39b[_0xffe9('0x27')]){delete _0x58c39b[_0xffe9('0x27')];}_0x5b482e[_0xffe9('0x1c')](_0x2e28e6)[_0xffe9('0x28')](_0x58c39b);};}exports[_0xffe9('0x29')]=function(_0xea2802,_0x1e0397){var _0x329c27={},_0xe7b9f1={},_0x3a56fa={'count':0x0,'rows':[]};var _0x320afa=_[_0xffe9('0x2a')](db[_0xffe9('0x2b')]['rawAttributes'],function(_0x5616c4){return{'name':_0x5616c4[_0xffe9('0x2c')],'type':_0x5616c4[_0xffe9('0x2d')][_0xffe9('0x2e')]};});_0xe7b9f1[_0xffe9('0x2f')]=_['map'](_0x320afa,_0xffe9('0x27'));_0xe7b9f1['query']=_[_0xffe9('0x30')](_0xea2802[_0xffe9('0x31')]);_0xe7b9f1[_0xffe9('0x32')]=_[_0xffe9('0x33')](_0xe7b9f1[_0xffe9('0x2f')],_0xe7b9f1[_0xffe9('0x31')]);_0x329c27[_0xffe9('0x34')]=_['intersection'](_0xe7b9f1[_0xffe9('0x2f')],qs[_0xffe9('0x35')](_0xea2802[_0xffe9('0x31')]['fields']));_0x329c27[_0xffe9('0x34')]=_0x329c27[_0xffe9('0x34')][_0xffe9('0x36')]?_0x329c27[_0xffe9('0x34')]:_0xe7b9f1['model'];if(!_0xea2802[_0xffe9('0x31')][_0xffe9('0x37')]('nolimit')){_0x329c27['limit']=qs[_0xffe9('0x20')](_0xea2802['query'][_0xffe9('0x20')]);_0x329c27[_0xffe9('0x1e')]=qs[_0xffe9('0x1e')](_0xea2802[_0xffe9('0x31')][_0xffe9('0x1e')]);}_0x329c27[_0xffe9('0x38')]=qs[_0xffe9('0x39')](_0xea2802[_0xffe9('0x31')][_0xffe9('0x39')]);_0x329c27[_0xffe9('0x3a')]=qs[_0xffe9('0x32')](_[_0xffe9('0x3b')](_0xea2802[_0xffe9('0x31')],_0xe7b9f1[_0xffe9('0x32')]),_0x320afa);if(_0xea2802[_0xffe9('0x31')][_0xffe9('0x3c')]){_0x329c27[_0xffe9('0x3a')]=_['merge'](_0x329c27[_0xffe9('0x3a')],{'$or':_[_0xffe9('0x2a')](_0x320afa,function(_0x402aca){if(_0x402aca['type']!==_0xffe9('0x3d')){var _0x22412f={};_0x22412f[_0x402aca[_0xffe9('0x27')]]={'$like':'%'+_0xea2802['query']['filter']+'%'};return _0x22412f;}})});}_0x329c27=_['merge']({},_0x329c27,_0xea2802['options']);var _0x5af17c={'where':_0x329c27['where']};return db[_0xffe9('0x2b')][_0xffe9('0x21')](_0x5af17c)[_0xffe9('0x10')](function(_0x2c9374){_0x3a56fa['count']=_0x2c9374;if(_0xea2802[_0xffe9('0x31')][_0xffe9('0x3e')]){_0x329c27[_0xffe9('0x3f')]=[{'all':!![]}];}return db[_0xffe9('0x2b')][_0xffe9('0x40')](_0x329c27);})[_0xffe9('0x10')](function(_0x1d8c6e){_0x3a56fa[_0xffe9('0x41')]=_0x1d8c6e;return _0x3a56fa;})[_0xffe9('0x10')](respondWithFilteredResult(_0x1e0397,_0x329c27))[_0xffe9('0x1b')](handleError(_0x1e0397,null));};exports[_0xffe9('0x42')]=function(_0x379194,_0x2629e0){var _0x5d2c0f={'raw':!![],'where':{'id':_0x379194[_0xffe9('0x43')]['id']}},_0x45041a={};_0x45041a[_0xffe9('0x2f')]=_[_0xffe9('0x30')](db[_0xffe9('0x2b')][_0xffe9('0x44')]);_0x45041a[_0xffe9('0x31')]=_['keys'](_0x379194[_0xffe9('0x31')]);_0x45041a['filters']=_[_0xffe9('0x33')](_0x45041a[_0xffe9('0x2f')],_0x45041a[_0xffe9('0x31')]);_0x5d2c0f[_0xffe9('0x34')]=_['intersection'](_0x45041a[_0xffe9('0x2f')],qs['fields'](_0x379194['query'][_0xffe9('0x35')]));_0x5d2c0f['attributes']=_0x5d2c0f['attributes']['length']?_0x5d2c0f[_0xffe9('0x34')]:_0x45041a[_0xffe9('0x2f')];if(_0x379194[_0xffe9('0x31')][_0xffe9('0x3e')]){_0x5d2c0f[_0xffe9('0x3f')]=[{'all':!![]}];}_0x5d2c0f=_['merge']({},_0x5d2c0f,_0x379194[_0xffe9('0x45')]);return db[_0xffe9('0x2b')][_0xffe9('0x46')](_0x5d2c0f)[_0xffe9('0x10')](handleEntityNotFound(_0x2629e0,null))[_0xffe9('0x10')](respondWithResult(_0x2629e0,null))[_0xffe9('0x1b')](handleError(_0x2629e0,null));};exports[_0xffe9('0x47')]=function(_0x3fbf1f,_0x420099){return db[_0xffe9('0x2b')][_0xffe9('0x47')](_0x3fbf1f[_0xffe9('0x48')],{})[_0xffe9('0x10')](respondWithResult(_0x420099,0xc9))[_0xffe9('0x1b')](handleError(_0x420099,null));};exports[_0xffe9('0x49')]=function(_0x4a3303,_0x410f99){if(_0x4a3303[_0xffe9('0x48')]['id']){delete _0x4a3303[_0xffe9('0x48')]['id'];}return db[_0xffe9('0x2b')][_0xffe9('0x46')]({'where':{'id':_0x4a3303[_0xffe9('0x43')]['id']}})[_0xffe9('0x10')](handleEntityNotFound(_0x410f99,null))[_0xffe9('0x10')](saveUpdates(_0x4a3303[_0xffe9('0x48')],null))[_0xffe9('0x10')](respondWithResult(_0x410f99,null))['catch'](handleError(_0x410f99,null));};exports[_0xffe9('0x24')]=function(_0x20548a,_0xe1e51f){return db['ChatMessage']['find']({'where':{'id':_0x20548a[_0xffe9('0x43')]['id']}})['then'](handleEntityNotFound(_0xe1e51f,null))['then'](removeEntity(_0xe1e51f,null))['catch'](handleError(_0xe1e51f,null));};exports[_0xffe9('0x4a')]=function(_0x2a15ad,_0x49eecb){return db['ChatMessage']['describe']()[_0xffe9('0x10')](respondWithResult(_0x49eecb,null))[_0xffe9('0x1b')](handleError(_0x49eecb,null));};exports[_0xffe9('0x4b')]=function(_0x4ad57c,_0x534448){var _0x223926='chat';return interactionService[_0xffe9('0x4c')](_0x4ad57c,_0x223926)['then'](respondWithResult(_0x534448,null))['catch'](handleError(_0x534448,null));};exports[_0xffe9('0x4d')]=function(_0x58167e,_0x1a92ef){var _0x1cb4cb={'agent':{},'channel':'chat'};if(_0x58167e['body']['id']){delete _0x58167e[_0xffe9('0x48')]['id'];}_0x58167e[_0xffe9('0x48')][_0xffe9('0x4e')]=_0x58167e['body']['UserId']||_0x58167e[_0xffe9('0x4f')]['id'];_0x1cb4cb['agent']['id']=_0x58167e[_0xffe9('0x48')][_0xffe9('0x4e')];return db[_0xffe9('0x2b')][_0xffe9('0x46')]({'where':{'id':_0x58167e[_0xffe9('0x43')]['id'],'UserId':null}})[_0xffe9('0x10')](handleEntityNotFound(_0x1a92ef,null))[_0xffe9('0x10')](function(_0x3aae2c){if(_0x3aae2c){_0x1cb4cb[_0xffe9('0x18')]=_0x3aae2c[_0xffe9('0x50')]({'plain':!![]});return db[_0xffe9('0x51')]['find']({'where':{'id':_0x3aae2c[_0xffe9('0x52')]}});}return null;})[_0xffe9('0x10')](handleEntityNotFound(_0x1a92ef,null))['then'](function(_0x3c6a6b){if(_0x3c6a6b){_0x1cb4cb[_0xffe9('0x53')]=_0x3c6a6b['get']({'plain':!![]});interaction_log['info']('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x58167e[_0xffe9('0x4f')]['id'],_0x58167e[_0xffe9('0x4f')][_0xffe9('0x27')],_0x58167e[_0xffe9('0x4f')][_0xffe9('0x54')],_0x1cb4cb[_0xffe9('0x53')]['id'],_0x58167e[_0xffe9('0x48')]?JSON[_0xffe9('0x15')](_0x58167e[_0xffe9('0x48')]):_0xffe9('0x55'));return respondWithRpcPromise(_0xffe9('0x56'),'rejectMessage',_0x1cb4cb);}return null;})[_0xffe9('0x10')](function(_0x4ab3f7){var _0x19afc8=_0xffe9('0x57')+_0x4ab3f7['message'][_0xffe9('0x58')];return db['sequelize']['query'](_0x19afc8,{'type':db[_0xffe9('0x59')][_0xffe9('0x5a')]['SELECT'],'raw':!![]})[_0xffe9('0x10')](function(_0x346888){return _0x346888;});})['then'](function(_0x312ef7){if(_0x312ef7){_0x1cb4cb['message'][_0xffe9('0x5b')]=_0x312ef7[0x0];if(!_0x58167e[_0xffe9('0x48')]['UserId'])return;return db['User'][_0xffe9('0x46')]({'where':{'id':_0x58167e[_0xffe9('0x48')][_0xffe9('0x4e')],'role':_0xffe9('0x5c')},'attributes':['id',_0xffe9('0x27'),_0xffe9('0x5d'),'email',_0xffe9('0x5e')],'raw':!![]});}return null;})['then'](function(_0x3b609b){if(!_0x3b609b)return null;_0x1cb4cb[_0xffe9('0x18')][_0xffe9('0x5c')]=_0x3b609b;return _0x1cb4cb;})[_0xffe9('0x10')](function(_0x1501db){if(_0x1501db){_0x1501db[_0xffe9('0x18')][_0xffe9('0x5f')]=util[_0xffe9('0x60')]('SIP/%s',_0x58167e[_0xffe9('0x4f')][_0xffe9('0x27')]);_0x1501db[_0xffe9('0x18')][_0xffe9('0x61')]=_0x1cb4cb[_0xffe9('0x61')];_0x1501db[_0xffe9('0x18')][_0xffe9('0x62')]=_0x1cb4cb['channel'];_0x1501db[_0xffe9('0x18')]['event']=_0xffe9('0x4d');respondWithRpcPromise('EventManager','EventManager',{'event':'rejectmessage','message':_['merge'](_0x1cb4cb[_0xffe9('0x18')],JSON['parse'](_0x1cb4cb[_0xffe9('0x53')][_0xffe9('0x63')]))},client9002);return _0x1cb4cb;}return null;})[_0xffe9('0x10')](respondWithResult(_0x1a92ef,null))['catch'](handleError(_0x1a92ef,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 12632ed..a671353 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 _0x10f0=['../../mysqldb','ChatMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x1c4409,_0x3b2e8f){var _0x356d8f=function(_0xae43bf){while(--_0xae43bf){_0x1c4409['push'](_0x1c4409['shift']());}};_0x356d8f(++_0x3b2e8f);}(_0x10f0,0x1ad));var _0x010f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x10f0[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0x010f('0x0'));var ChatMessage=require(_0x010f('0x1'))['db'][_0x010f('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x010f('0x3')](0x0);var events={'afterCreate':_0x010f('0x4'),'afterUpdate':_0x010f('0x5'),'afterDestroy':_0x010f('0x6')};function emitEvent(_0x593446){return function(_0x17b65d,_0x297fe3,_0x172316){ChatMessageEvents[_0x010f('0x7')](_0x593446+':'+_0x17b65d['id'],_0x17b65d);ChatMessageEvents[_0x010f('0x7')](_0x593446,_0x17b65d);_0x172316(null);};}for(var e in events){if(events[_0x010f('0x8')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0x010f('0x9')]=ChatMessageEvents; \ No newline at end of file +var _0xaf6f=['emit','hasOwnProperty','exports','ChatMessage','save','update'];(function(_0xfbe06e,_0x2fb7ab){var _0x24e5b6=function(_0x48569f){while(--_0x48569f){_0xfbe06e['push'](_0xfbe06e['shift']());}};_0x24e5b6(++_0x2fb7ab);}(_0xaf6f,0x12f));var _0xfaf6=function(_0x3fe9a5,_0x5d6fb7){_0x3fe9a5=_0x3fe9a5-0x0;var _0x61444e=_0xaf6f[_0x3fe9a5];return _0x61444e;};'use strict';var EventEmitter=require('events');var ChatMessage=require('../../mysqldb')['db'][_0xfaf6('0x0')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfaf6('0x1'),'afterUpdate':_0xfaf6('0x2'),'afterDestroy':'remove'};function emitEvent(_0x177ddb){return function(_0x3f6a74,_0x5be592,_0x278f8b){ChatMessageEvents[_0xfaf6('0x3')](_0x177ddb+':'+_0x3f6a74['id'],_0x3f6a74);ChatMessageEvents[_0xfaf6('0x3')](_0x177ddb,_0x3f6a74);_0x278f8b(null);};}for(var e in events){if(events[_0xfaf6('0x4')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0xfaf6('0x5')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 655ac27..d6c5055 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 _0xa2cf=['rimraf','./chatMessage.attributes','exports','define','chat_messages','FULLTEXT','models','get','direction','isNil','findOne','ChatInteractionId','update','createdAt','toLowerCase','catch','error','utf8mb4','lodash','util','api','moment','bluebird','request-promise'];(function(_0x20645f,_0x5688f0){var _0xf0485b=function(_0x4220af){while(--_0x4220af){_0x20645f['push'](_0x20645f['shift']());}};_0xf0485b(++_0x5688f0);}(_0xa2cf,0x162));var _0xfa2c=function(_0x107c87,_0x366dfe){_0x107c87=_0x107c87-0x0;var _0x13795f=_0xa2cf[_0x107c87];return _0x13795f;};'use strict';var _=require(_0xfa2c('0x0'));var util=require(_0xfa2c('0x1'));var logger=require('../../config/logger')(_0xfa2c('0x2'));var moment=require(_0xfa2c('0x3'));var BPromise=require(_0xfa2c('0x4'));var rp=require(_0xfa2c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfa2c('0x6'));var config=require('../../config/environment');var attributes=require(_0xfa2c('0x7'));module[_0xfa2c('0x8')]=function(_0x47b668,_0x490734){return _0x47b668[_0xfa2c('0x9')]('ChatMessage',attributes,{'tableName':_0xfa2c('0xa'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':['body'],'type':_0xfa2c('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x45bab3,_0x32e7e7,_0x9a0c8e){var _0x43cdde=_0x47b668[_0xfa2c('0xc')];var _0x3ccdc9=_0x45bab3[_0xfa2c('0xd')]({'plain':!![]});if(_0x3ccdc9[_0xfa2c('0xe')]['toLowerCase']()==='in'||_0x3ccdc9[_0xfa2c('0xe')]['toLowerCase']()==='out'&&!_0x3ccdc9['secret']&&!_[_0xfa2c('0xf')](_0x3ccdc9['UserId'])){_0x43cdde['ChatInteraction'][_0xfa2c('0x10')]({'where':{'id':_0x3ccdc9[_0xfa2c('0x11')]}})['then'](function(_0x2d544f){if(_0x2d544f){_0x2d544f[_0xfa2c('0x12')]({'lastMsgAt':_0x3ccdc9[_0xfa2c('0x13')],'lastMsgDirection':_0x3ccdc9[_0xfa2c('0xe')][_0xfa2c('0x14')]()});}})[_0xfa2c('0x15')](function(_0x3b09ef){console[_0xfa2c('0x16')](_0x3b09ef);});}_0x9a0c8e();}},'charset':_0xfa2c('0x17'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x73d8=['direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction','findOne','then','update','createdAt','catch','error','lodash','util','api','bluebird','request-promise','path','./chatMessage.attributes','exports','define','ChatMessage','fti_chat_messages','body','FULLTEXT','models','get'];(function(_0x1e7701,_0x13fd0f){var _0x3ab707=function(_0x3c5242){while(--_0x3c5242){_0x1e7701['push'](_0x1e7701['shift']());}};_0x3ab707(++_0x13fd0f);}(_0x73d8,0x109));var _0x873d=function(_0x2f5ff2,_0x5b7e4b){_0x2f5ff2=_0x2f5ff2-0x0;var _0x1d9564=_0x73d8[_0x2f5ff2];return _0x1d9564;};'use strict';var _=require(_0x873d('0x0'));var util=require(_0x873d('0x1'));var logger=require('../../config/logger')(_0x873d('0x2'));var moment=require('moment');var BPromise=require(_0x873d('0x3'));var rp=require(_0x873d('0x4'));var fs=require('fs');var path=require(_0x873d('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x873d('0x6'));module[_0x873d('0x7')]=function(_0x460222,_0x14e988){return _0x460222[_0x873d('0x8')](_0x873d('0x9'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':_0x873d('0xa'),'fields':[_0x873d('0xb')],'type':_0x873d('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x38d40f,_0x208068,_0x321257){var _0xb25f=_0x460222[_0x873d('0xd')];var _0x252092=_0x38d40f[_0x873d('0xe')]({'plain':!![]});if(_0x252092[_0x873d('0xf')][_0x873d('0x10')]()==='in'||_0x252092['direction'][_0x873d('0x10')]()===_0x873d('0x11')&&!_0x252092[_0x873d('0x12')]&&!_[_0x873d('0x13')](_0x252092[_0x873d('0x14')])){_0xb25f[_0x873d('0x15')][_0x873d('0x16')]({'where':{'id':_0x252092['ChatInteractionId']}})[_0x873d('0x17')](function(_0x57c11b){if(_0x57c11b){_0x57c11b[_0x873d('0x18')]({'lastMsgAt':_0x252092[_0x873d('0x19')],'lastMsgDirection':_0x252092[_0x873d('0xf')][_0x873d('0x10')]()});}})[_0x873d('0x1a')](function(_0x2ceb11){console[_0x873d('0x1b')](_0x2ceb11);});}_0x321257();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 2261238..d26cd06 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 _0x7d6f=['raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','redis','defaults','localhost','./chatMessage.socket','register','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','ChatMessage','create','body','options'];(function(_0x5389e4,_0x4d98b2){var _0x521efc=function(_0x285e3f){while(--_0x285e3f){_0x5389e4['push'](_0x5389e4['shift']());}};_0x521efc(++_0x4d98b2);}(_0x7d6f,0x194));var _0xf7d6=function(_0x3ce0ae,_0x2f0041){_0x3ce0ae=_0x3ce0ae-0x0;var _0x150999=_0x7d6f[_0x3ce0ae];return _0x150999;};'use strict';var _=require(_0xf7d6('0x0'));var util=require(_0xf7d6('0x1'));var moment=require(_0xf7d6('0x2'));var BPromise=require(_0xf7d6('0x3'));var rs=require(_0xf7d6('0x4'));var fs=require('fs');var Redis=require(_0xf7d6('0x5'));var db=require(_0xf7d6('0x6'))['db'];var utils=require(_0xf7d6('0x7'));var logger=require(_0xf7d6('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf7d6('0x9'));var client=jayson['client'][_0xf7d6('0xa')]({'port':0x232a});config[_0xf7d6('0xb')]=_[_0xf7d6('0xc')](config['redis'],{'host':_0xf7d6('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf7d6('0xb')]));require(_0xf7d6('0xe'))[_0xf7d6('0xf')](socket);function respondWithRpcPromise(_0x4e1fa8,_0x2c2981,_0x2c9da9){return new BPromise(function(_0x159897,_0x1ab4c1){return client['request'](_0x4e1fa8,_0x2c9da9)['then'](function(_0x4d91f7){logger[_0xf7d6('0x10')](_0xf7d6('0x11'),_0x2c2981,_0xf7d6('0x12'));logger[_0xf7d6('0x13')](_0xf7d6('0x14'),_0x2c2981,_0xf7d6('0x12'),JSON[_0xf7d6('0x15')](_0x4d91f7));if(_0x4d91f7[_0xf7d6('0x16')]){if(_0x4d91f7[_0xf7d6('0x16')][_0xf7d6('0x17')]===0x1f4){logger[_0xf7d6('0x16')](_0xf7d6('0x11'),_0x2c2981,_0x4d91f7[_0xf7d6('0x16')][_0xf7d6('0x18')]);return _0x1ab4c1(_0x4d91f7[_0xf7d6('0x16')]['message']);}logger[_0xf7d6('0x16')](_0xf7d6('0x11'),_0x2c2981,_0x4d91f7['error'][_0xf7d6('0x18')]);return _0x159897(_0x4d91f7['error'][_0xf7d6('0x18')]);}else{logger['info']('ChatMessage,\x20%s,\x20%s',_0x2c2981,_0xf7d6('0x12'));_0x159897(_0x4d91f7['result'][_0xf7d6('0x18')]);}})[_0xf7d6('0x19')](function(_0x1f8478){logger[_0xf7d6('0x16')](_0xf7d6('0x11'),_0x2c2981,_0x1f8478);_0x1ab4c1(_0x1f8478);});});}exports['CreateChatMessage']=function(_0x25d25){var _0x394468=this;return new Promise(function(_0x5228a0,_0x24ef09){return db[_0xf7d6('0x1a')][_0xf7d6('0x1b')](_0x25d25[_0xf7d6('0x1c')],{'raw':_0x25d25[_0xf7d6('0x1d')]?_0x25d25['options'][_0xf7d6('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x54ce16){logger[_0xf7d6('0x10')]('CreateChatMessage',_0x25d25);logger['debug']('CreateChatMessage',_0x25d25,JSON[_0xf7d6('0x15')](_0x54ce16));_0x5228a0(_0x54ce16);})[_0xf7d6('0x19')](function(_0x14552a){logger[_0xf7d6('0x16')]('CreateChatMessage',_0x14552a['message'],_0x25d25);_0x24ef09(_0x394468[_0xf7d6('0x16')](0x1f4,_0x14552a['message']));});});}; \ No newline at end of file +var _0xcf3b=['result','catch','ChatMessage','create','options','raw','CreateChatMessage','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','defaults','redis','localhost','socket.io-emitter','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xcf3b,0x7f));var _0xbcf3=function(_0x93b175,_0x448d4c){_0x93b175=_0x93b175-0x0;var _0x5f2532=_0xcf3b[_0x93b175];return _0x5f2532;};'use strict';var _=require('lodash');var util=require(_0xbcf3('0x0'));var moment=require(_0xbcf3('0x1'));var BPromise=require(_0xbcf3('0x2'));var rs=require(_0xbcf3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbcf3('0x4'))['db'];var utils=require(_0xbcf3('0x5'));var logger=require(_0xbcf3('0x6'))(_0xbcf3('0x7'));var config=require(_0xbcf3('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xbcf3('0x9')]['http']({'port':0x232a});config['redis']=_[_0xbcf3('0xa')](config[_0xbcf3('0xb')],{'host':_0xbcf3('0xc'),'port':0x18eb});var socket=require(_0xbcf3('0xd'))(new Redis(config[_0xbcf3('0xb')]));require('./chatMessage.socket')['register'](socket);function respondWithRpcPromise(_0x5181bf,_0x33a0df,_0x4a4660){return new BPromise(function(_0x27de0f,_0x2a5526){return client['request'](_0x5181bf,_0x4a4660)[_0xbcf3('0xe')](function(_0x561fe7){logger[_0xbcf3('0xf')](_0xbcf3('0x10'),_0x33a0df,_0xbcf3('0x11'));logger[_0xbcf3('0x12')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x33a0df,'request\x20sent',JSON[_0xbcf3('0x13')](_0x561fe7));if(_0x561fe7['error']){if(_0x561fe7[_0xbcf3('0x14')][_0xbcf3('0x15')]===0x1f4){logger['error']('ChatMessage,\x20%s,\x20%s',_0x33a0df,_0x561fe7[_0xbcf3('0x14')][_0xbcf3('0x16')]);return _0x2a5526(_0x561fe7['error'][_0xbcf3('0x16')]);}logger[_0xbcf3('0x14')](_0xbcf3('0x10'),_0x33a0df,_0x561fe7[_0xbcf3('0x14')][_0xbcf3('0x16')]);return _0x27de0f(_0x561fe7[_0xbcf3('0x14')]['message']);}else{logger[_0xbcf3('0xf')]('ChatMessage,\x20%s,\x20%s',_0x33a0df,_0xbcf3('0x11'));_0x27de0f(_0x561fe7[_0xbcf3('0x17')][_0xbcf3('0x16')]);}})[_0xbcf3('0x18')](function(_0x355f0d){logger[_0xbcf3('0x14')](_0xbcf3('0x10'),_0x33a0df,_0x355f0d);_0x2a5526(_0x355f0d);});});}exports['CreateChatMessage']=function(_0x55f3f4){var _0x5093b3=this;return new Promise(function(_0xf5b359,_0x428e6e){return db[_0xbcf3('0x19')][_0xbcf3('0x1a')](_0x55f3f4['body'],{'raw':_0x55f3f4['options']?_0x55f3f4[_0xbcf3('0x1b')][_0xbcf3('0x1c')]===undefined?!![]:![]:!![]})[_0xbcf3('0xe')](function(_0x22c0c2){logger['info']('CreateChatMessage',_0x55f3f4);logger[_0xbcf3('0x12')]('CreateChatMessage',_0x55f3f4,JSON[_0xbcf3('0x13')](_0x22c0c2));_0xf5b359(_0x22c0c2);})['catch'](function(_0x49dcb9){logger[_0xbcf3('0x14')](_0xbcf3('0x1d'),_0x49dcb9['message'],_0x55f3f4);_0x428e6e(_0x5093b3[_0xbcf3('0x14')](0x1f4,_0x49dcb9[_0xbcf3('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 5242fa7..6bc4db1 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 _0x7923=['register','length','chatMessage:','./chatMessage.events','save','remove','update'];(function(_0x79c6de,_0x10de94){var _0x321a56=function(_0x2e313e){while(--_0x2e313e){_0x79c6de['push'](_0x79c6de['shift']());}};_0x321a56(++_0x10de94);}(_0x7923,0x8f));var _0x3792=function(_0x4716b0,_0x167fe7){_0x4716b0=_0x4716b0-0x0;var _0x3d59c1=_0x7923[_0x4716b0];return _0x3d59c1;};'use strict';var ChatMessageEvents=require(_0x3792('0x0'));var events=[_0x3792('0x1'),_0x3792('0x2'),_0x3792('0x3')];function createListener(_0xfd3952,_0xf88b72){return function(_0x3bdefe){_0xf88b72['emit'](_0xfd3952,_0x3bdefe);};}function removeListener(_0x21134d,_0x51d334){return function(){ChatMessageEvents['removeListener'](_0x21134d,_0x51d334);};}exports[_0x3792('0x4')]=function(_0x4f98c6){for(var _0x326cc2=0x0,_0x18b993=events[_0x3792('0x5')];_0x326cc2<_0x18b993;_0x326cc2++){var _0x5b55f8=events[_0x326cc2];var _0x5b453a=createListener(_0x3792('0x6')+_0x5b55f8,_0x4f98c6);ChatMessageEvents['on'](_0x5b55f8,_0x5b453a);}}; \ No newline at end of file +var _0x88d5=['remove','update','emit','removeListener','register','chatMessage:','./chatMessage.events','save'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x88d5,0x76));var _0x588d=function(_0x35ad07,_0x4b6cc4){_0x35ad07=_0x35ad07-0x0;var _0x5346ee=_0x88d5[_0x35ad07];return _0x5346ee;};'use strict';var ChatMessageEvents=require(_0x588d('0x0'));var events=[_0x588d('0x1'),_0x588d('0x2'),_0x588d('0x3')];function createListener(_0x315178,_0x5372b1){return function(_0xe46c98){_0x5372b1[_0x588d('0x4')](_0x315178,_0xe46c98);};}function removeListener(_0x504b52,_0x474e79){return function(){ChatMessageEvents[_0x588d('0x5')](_0x504b52,_0x474e79);};}exports[_0x588d('0x6')]=function(_0x1b193f){for(var _0xecfb11=0x0,_0x413748=events['length'];_0xecfb11<_0x413748;_0xecfb11++){var _0x57699a=events[_0xecfb11];var _0x41ddf3=createListener(_0x588d('0x7')+_0x57699a,_0x1b193f);ChatMessageEvents['on'](_0x57699a,_0x41ddf3);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index bf85d9c..e7f3884 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 _0x8309=['put','/:id/accept','reject','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./chatMessage.controller','index','get','/describe','isAuthenticated','show','post','tracked','chatmessage:create','create','/:id','update'];(function(_0x1a51a1,_0x56d77b){var _0x127d55=function(_0x4f6800){while(--_0x4f6800){_0x1a51a1['push'](_0x1a51a1['shift']());}};_0x127d55(++_0x56d77b);}(_0x8309,0x17c));var _0x9830=function(_0x2c1ab8,_0x21ced6){_0x2c1ab8=_0x2c1ab8-0x0;var _0x535c24=_0x8309[_0x2c1ab8];return _0x535c24;};'use strict';var multer=require(_0x9830('0x0'));var util=require(_0x9830('0x1'));var path=require(_0x9830('0x2'));var timeout=require(_0x9830('0x3'));var express=require(_0x9830('0x4'));var router=express[_0x9830('0x5')]();var fs_extra=require(_0x9830('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9830('0x7'));var controller=require(_0x9830('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x9830('0x9')]);router[_0x9830('0xa')](_0x9830('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x9830('0xa')]('/:id',auth[_0x9830('0xc')](),controller[_0x9830('0xd')]);router[_0x9830('0xe')]('/',auth[_0x9830('0xc')](),interaction[_0x9830('0xf')]('chat',_0x9830('0x10')),controller[_0x9830('0x11')]);router['put'](_0x9830('0x12'),controller[_0x9830('0x13')]);router[_0x9830('0x14')](_0x9830('0x15'),auth[_0x9830('0xc')](),controller['accept']);router[_0x9830('0x14')]('/:id/reject',auth['isAuthenticated'](),controller[_0x9830('0x16')]);router['delete'](_0x9830('0x12'),auth[_0x9830('0xc')](),controller[_0x9830('0x17')]);module[_0x9830('0x18')]=router; \ No newline at end of file +var _0xa86d=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','show','post','tracked','chatmessage:create','create','put','/:id','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','path'];(function(_0x48f590,_0x4cd55b){var _0x1afde4=function(_0x2b19c3){while(--_0x2b19c3){_0x48f590['push'](_0x48f590['shift']());}};_0x1afde4(++_0x4cd55b);}(_0xa86d,0x8a));var _0xda86=function(_0x1d46de,_0x3dd47f){_0x1d46de=_0x1d46de-0x0;var _0x4516e5=_0xa86d[_0x1d46de];return _0x4516e5;};'use strict';var multer=require(_0xda86('0x0'));var util=require('util');var path=require(_0xda86('0x1'));var timeout=require(_0xda86('0x2'));var express=require(_0xda86('0x3'));var router=express[_0xda86('0x4')]();var fs_extra=require(_0xda86('0x5'));var auth=require(_0xda86('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xda86('0x7'));var controller=require(_0xda86('0x8'));router[_0xda86('0x9')]('/',auth[_0xda86('0xa')](),controller[_0xda86('0xb')]);router[_0xda86('0x9')](_0xda86('0xc'),auth[_0xda86('0xa')](),controller[_0xda86('0xd')]);router[_0xda86('0x9')]('/:id',auth[_0xda86('0xa')](),controller[_0xda86('0xe')]);router[_0xda86('0xf')]('/',auth[_0xda86('0xa')](),interaction[_0xda86('0x10')]('chat',_0xda86('0x11')),controller[_0xda86('0x12')]);router[_0xda86('0x13')](_0xda86('0x14'),controller['update']);router['put'](_0xda86('0x15'),auth['isAuthenticated'](),controller[_0xda86('0x16')]);router[_0xda86('0x13')](_0xda86('0x17'),auth['isAuthenticated'](),controller[_0xda86('0x18')]);router[_0xda86('0x19')](_0xda86('0x14'),auth[_0xda86('0xa')](),controller[_0xda86('0x1a')]);module[_0xda86('0x1b')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 6240840..eb4bb86 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 _0xb10b=['medium','sequelize','TEXT'];(function(_0x1dfe92,_0x4960a4){var _0x15d6b0=function(_0x1675f1){while(--_0x1675f1){_0x1dfe92['push'](_0x1dfe92['shift']());}};_0x15d6b0(++_0x4960a4);}(_0xb10b,0x12a));var _0xbb10=function(_0x4e1926,_0x2415d6){_0x4e1926=_0x4e1926-0x0;var _0x85fa41=_0xb10b[_0x4e1926];return _0x85fa41;};'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 +var _0xadb5=['medium','TEXT','exports'];(function(_0x149e88,_0x264145){var _0x26a5a6=function(_0x489294){while(--_0x489294){_0x149e88['push'](_0x149e88['shift']());}};_0x26a5a6(++_0x264145);}(_0xadb5,0xad));var _0x5adb=function(_0x4f158e,_0x3910bd){_0x4f158e=_0x4f158e-0x0;var _0x52ad37=_0xadb5[_0x4f158e];return _0x52ad37;};'use strict';var Sequelize=require('sequelize');module[_0x5adb('0x0')]={'body':{'type':Sequelize['TEXT'](_0x5adb('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x5adb('0x2')](_0x5adb('0x1')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index e87e9c1..24dee62 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(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0x7a54,0x106));var _0x47a5=function(_0x4abcef,_0xbcf2d7){_0x4abcef=_0x4abcef-0x0;var _0x3e4ebc=_0x7a54[_0x4abcef];return _0x3e4ebc;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file +var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x424a9a,_0x2dd9af){var _0xa7831c=function(_0x512534){while(--_0x512534){_0x424a9a['push'](_0x424a9a['shift']());}};_0xa7831c(++_0x2dd9af);}(_0x7a54,0x106));var _0x47a5=function(_0x48dfab,_0x539679){_0x48dfab=_0x48dfab-0x0;var _0x2fa30f=_0x7a54[_0x48dfab];return _0x2fa30f;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index 489426e..38ef9b3 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 _0xc7dd=['exports','events','../../mysqldb','setMaxListeners','remove','hasOwnProperty'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0xc7dd,0x15d));var _0xdc7d=function(_0x311aad,_0x54d658){_0x311aad=_0x311aad-0x0;var _0x1779bd=_0xc7dd[_0x311aad];return _0x1779bd;};'use strict';var EventEmitter=require(_0xdc7d('0x0'));var ChatOfflineMessage=require(_0xdc7d('0x1'))['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0xdc7d('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xdc7d('0x3')};function emitEvent(_0x2b0318){return function(_0x4bc843,_0x24f3e7,_0x84a50){ChatOfflineMessageEvents['emit'](_0x2b0318+':'+_0x4bc843['id'],_0x4bc843);ChatOfflineMessageEvents['emit'](_0x2b0318,_0x4bc843);_0x84a50(null);};}for(var e in events){if(events[_0xdc7d('0x4')](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module[_0xdc7d('0x5')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0x9dbe=['save','update','remove','emit','events','../../mysqldb','ChatOfflineMessage','setMaxListeners'];(function(_0x1244c6,_0x4770d0){var _0x1e0a72=function(_0x61ba95){while(--_0x61ba95){_0x1244c6['push'](_0x1244c6['shift']());}};_0x1e0a72(++_0x4770d0);}(_0x9dbe,0x174));var _0xe9db=function(_0x465089,_0x823030){_0x465089=_0x465089-0x0;var _0x3c47ba=_0x9dbe[_0x465089];return _0x3c47ba;};'use strict';var EventEmitter=require(_0xe9db('0x0'));var ChatOfflineMessage=require(_0xe9db('0x1'))['db'][_0xe9db('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0xe9db('0x3')](0x0);var events={'afterCreate':_0xe9db('0x4'),'afterUpdate':_0xe9db('0x5'),'afterDestroy':_0xe9db('0x6')};function emitEvent(_0x383073){return function(_0x1ff6a5,_0x117f8f,_0x383196){ChatOfflineMessageEvents[_0xe9db('0x7')](_0x383073+':'+_0x1ff6a5['id'],_0x1ff6a5);ChatOfflineMessageEvents[_0xe9db('0x7')](_0x383073,_0x1ff6a5);_0x383196(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module['exports']=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index dda2d63..48df32a 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 _0xd47d=['ChatOfflineMessage','utf8mb4','utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports'];(function(_0x1a6519,_0x395572){var _0x300b42=function(_0x24b243){while(--_0x24b243){_0x1a6519['push'](_0x1a6519['shift']());}};_0x300b42(++_0x395572);}(_0xd47d,0x1c5));var _0xdd47=function(_0x2307fa,_0x266e5e){_0x2307fa=_0x2307fa-0x0;var _0x496486=_0xd47d[_0x2307fa];return _0x496486;};'use strict';var attributes=require(_0xdd47('0x0'));module[_0xdd47('0x1')]=function(_0x341c88){return _0x341c88['define'](_0xdd47('0x2'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xdd47('0x3'),'collate':_0xdd47('0x4')});}; \ No newline at end of file +var _0x8406=['chat_offline_messages','./chatOfflineMessage.attributes','exports','define'];(function(_0x19c14f,_0x262416){var _0x4bdba3=function(_0x3f18f4){while(--_0x3f18f4){_0x19c14f['push'](_0x19c14f['shift']());}};_0x4bdba3(++_0x262416);}(_0x8406,0x18d));var _0x6840=function(_0x1870ed,_0x44b070){_0x1870ed=_0x1870ed-0x0;var _0x495d32=_0x8406[_0x1870ed];return _0x495d32;};'use strict';var attributes=require(_0x6840('0x0'));module[_0x6840('0x1')]=function(_0x3c3022){return _0x3c3022[_0x6840('0x2')]('ChatOfflineMessage',attributes,{'tableName':_0x6840('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 87615cf..dc68984 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 _0xdfe7=['../../config/environment','client','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x56ee15,_0x1effd1){var _0x94991f=function(_0x5018fa){while(--_0x5018fa){_0x56ee15['push'](_0x56ee15['shift']());}};_0x94991f(++_0x1effd1);}(_0xdfe7,0xc8));var _0x7dfe=function(_0x2ec81f,_0x34004c){_0x2ec81f=_0x2ec81f-0x0;var _0x1039ce=_0xdfe7[_0x2ec81f];return _0x1039ce;};'use strict';var _=require('lodash');var util=require(_0x7dfe('0x0'));var moment=require(_0x7dfe('0x1'));var BPromise=require('bluebird');var rs=require(_0x7dfe('0x2'));var fs=require('fs');var Redis=require(_0x7dfe('0x3'));var db=require(_0x7dfe('0x4'))['db'];var utils=require(_0x7dfe('0x5'));var logger=require('../../config/logger')(_0x7dfe('0x6'));var config=require(_0x7dfe('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7dfe('0x8')][_0x7dfe('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x23d0c1,_0x2163fc,_0x56d67e){return new BPromise(function(_0x3fc0a0,_0x37705a){return client[_0x7dfe('0xa')](_0x23d0c1,_0x56d67e)[_0x7dfe('0xb')](function(_0x52040d){logger[_0x7dfe('0xc')](_0x7dfe('0xd'),_0x2163fc,_0x7dfe('0xe'));logger[_0x7dfe('0xf')](_0x7dfe('0x10'),_0x2163fc,'request\x20sent',JSON[_0x7dfe('0x11')](_0x52040d));if(_0x52040d[_0x7dfe('0x12')]){if(_0x52040d[_0x7dfe('0x12')][_0x7dfe('0x13')]===0x1f4){logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x2163fc,_0x52040d[_0x7dfe('0x12')]['message']);return _0x37705a(_0x52040d['error'][_0x7dfe('0x14')]);}logger['error'](_0x7dfe('0xd'),_0x2163fc,_0x52040d[_0x7dfe('0x12')][_0x7dfe('0x14')]);return _0x3fc0a0(_0x52040d['error'][_0x7dfe('0x14')]);}else{logger[_0x7dfe('0xc')](_0x7dfe('0xd'),_0x2163fc,_0x7dfe('0xe'));_0x3fc0a0(_0x52040d[_0x7dfe('0x15')][_0x7dfe('0x14')]);}})[_0x7dfe('0x16')](function(_0x225fef){logger[_0x7dfe('0x12')](_0x7dfe('0xd'),_0x2163fc,_0x225fef);_0x37705a(_0x225fef);});});} \ No newline at end of file +var _0xcbd2=['catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x50f157,_0x280833){var _0x7e0178=function(_0x14eaf1){while(--_0x14eaf1){_0x50f157['push'](_0x50f157['shift']());}};_0x7e0178(++_0x280833);}(_0xcbd2,0xb9));var _0x2cbd=function(_0x45c48f,_0x4aa891){_0x45c48f=_0x45c48f-0x0;var _0xaf5037=_0xcbd2[_0x45c48f];return _0xaf5037;};'use strict';var _=require(_0x2cbd('0x0'));var util=require(_0x2cbd('0x1'));var moment=require(_0x2cbd('0x2'));var BPromise=require(_0x2cbd('0x3'));var rs=require(_0x2cbd('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2cbd('0x5'))['db'];var utils=require(_0x2cbd('0x6'));var logger=require(_0x2cbd('0x7'))(_0x2cbd('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2cbd('0x9')][_0x2cbd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2233f3,_0x27aa9f,_0x39dc17){return new BPromise(function(_0x4b35b0,_0x1dac7c){return client[_0x2cbd('0xb')](_0x2233f3,_0x39dc17)[_0x2cbd('0xc')](function(_0x2cfd1e){logger[_0x2cbd('0xd')](_0x2cbd('0xe'),_0x27aa9f,_0x2cbd('0xf'));logger[_0x2cbd('0x10')](_0x2cbd('0x11'),_0x27aa9f,_0x2cbd('0xf'),JSON['stringify'](_0x2cfd1e));if(_0x2cfd1e[_0x2cbd('0x12')]){if(_0x2cfd1e[_0x2cbd('0x12')][_0x2cbd('0x13')]===0x1f4){logger[_0x2cbd('0x12')]('ChatOfflineMessage,\x20%s,\x20%s',_0x27aa9f,_0x2cfd1e[_0x2cbd('0x12')][_0x2cbd('0x14')]);return _0x1dac7c(_0x2cfd1e[_0x2cbd('0x12')][_0x2cbd('0x14')]);}logger[_0x2cbd('0x12')](_0x2cbd('0xe'),_0x27aa9f,_0x2cfd1e['error']['message']);return _0x4b35b0(_0x2cfd1e['error']['message']);}else{logger[_0x2cbd('0xd')](_0x2cbd('0xe'),_0x27aa9f,_0x2cbd('0xf'));_0x4b35b0(_0x2cfd1e[_0x2cbd('0x15')]['message']);}})[_0x2cbd('0x16')](function(_0x5df532){logger[_0x2cbd('0x12')](_0x2cbd('0xe'),_0x27aa9f,_0x5df532);_0x1dac7c(_0x5df532);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 3da28ff..1cd2573 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 _0xb2a1=['put','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','describe','/:id','post'];(function(_0x13c147,_0x2f9e09){var _0x494688=function(_0x47941a){while(--_0x47941a){_0x13c147['push'](_0x13c147['shift']());}};_0x494688(++_0x2f9e09);}(_0xb2a1,0x121));var _0x1b2a=function(_0x301fa3,_0x438b73){_0x301fa3=_0x301fa3-0x0;var _0x28a9d6=_0xb2a1[_0x301fa3];return _0x28a9d6;};'use strict';var multer=require('multer');var util=require(_0x1b2a('0x0'));var path=require(_0x1b2a('0x1'));var timeout=require(_0x1b2a('0x2'));var express=require(_0x1b2a('0x3'));var router=express[_0x1b2a('0x4')]();var fs_extra=require(_0x1b2a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1b2a('0x6'));var config=require(_0x1b2a('0x7'));var controller=require(_0x1b2a('0x8'));router[_0x1b2a('0x9')]('/',auth[_0x1b2a('0xa')](),controller[_0x1b2a('0xb')]);router[_0x1b2a('0x9')]('/describe',auth[_0x1b2a('0xa')](),controller[_0x1b2a('0xc')]);router[_0x1b2a('0x9')](_0x1b2a('0xd'),auth[_0x1b2a('0xa')](),controller['show']);router[_0x1b2a('0xe')]('/',auth[_0x1b2a('0xa')](),controller['create']);router[_0x1b2a('0xf')](_0x1b2a('0xd'),auth[_0x1b2a('0xa')](),controller['update']);router[_0x1b2a('0x10')](_0x1b2a('0xd'),auth[_0x1b2a('0xa')](),controller[_0x1b2a('0x11')]);module[_0x1b2a('0x12')]=router; \ No newline at end of file +var _0x8728=['../../components/auth/service','get','isAuthenticated','/describe','describe','show','post','create','put','/:id','delete','destroy','exports','multer','util','express','Router','fs-extra'];(function(_0x58ff61,_0x3f18cc){var _0x7eaddc=function(_0x40eb3c){while(--_0x40eb3c){_0x58ff61['push'](_0x58ff61['shift']());}};_0x7eaddc(++_0x3f18cc);}(_0x8728,0x12d));var _0x8872=function(_0x55b06f,_0xedbba2){_0x55b06f=_0x55b06f-0x0;var _0x5b2bcb=_0x8728[_0x55b06f];return _0x5b2bcb;};'use strict';var multer=require(_0x8872('0x0'));var util=require(_0x8872('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8872('0x2'));var router=express[_0x8872('0x3')]();var fs_extra=require(_0x8872('0x4'));var auth=require(_0x8872('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./chatOfflineMessage.controller');router[_0x8872('0x6')]('/',auth[_0x8872('0x7')](),controller['index']);router[_0x8872('0x6')](_0x8872('0x8'),auth['isAuthenticated'](),controller[_0x8872('0x9')]);router[_0x8872('0x6')]('/:id',auth[_0x8872('0x7')](),controller[_0x8872('0xa')]);router[_0x8872('0xb')]('/',auth[_0x8872('0x7')](),controller[_0x8872('0xc')]);router[_0x8872('0xd')](_0x8872('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x8872('0xf')](_0x8872('0xe'),auth[_0x8872('0x7')](),controller[_0x8872('0x10')]);module[_0x8872('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 0ea4f98..406aad2 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 _0xfad6=['sequelize','exports','timeout','mouseOver','STRING','INTEGER'];(function(_0x3501fc,_0x9cd204){var _0x4a0a3e=function(_0x14bf41){while(--_0x14bf41){_0x3501fc['push'](_0x3501fc['shift']());}};_0x4a0a3e(++_0x9cd204);}(_0xfad6,0xe4));var _0x6fad=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfad6[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x6fad('0x0'));module[_0x6fad('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM']('mouseOver',_0x6fad('0x2')),'defaultValue':_0x6fad('0x3')},'selector':{'type':Sequelize[_0x6fad('0x4')]},'timeout':{'type':Sequelize[_0x6fad('0x5')]}}; \ No newline at end of file +var _0x3f90=['exports','STRING','ENUM','mouseOver','timeout','INTEGER','sequelize'];(function(_0x182282,_0x4ba450){var _0x1362ab=function(_0x2b8f8d){while(--_0x2b8f8d){_0x182282['push'](_0x182282['shift']());}};_0x1362ab(++_0x4ba450);}(_0x3f90,0xd1));var _0x03f9=function(_0x543749,_0xcb3921){_0x543749=_0x543749-0x0;var _0x558041=_0x3f90[_0x543749];return _0x558041;};'use strict';var Sequelize=require(_0x03f9('0x0'));module[_0x03f9('0x1')]={'name':{'type':Sequelize[_0x03f9('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x03f9('0x3')](_0x03f9('0x4'),_0x03f9('0x5')),'defaultValue':_0x03f9('0x4')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x03f9('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index d35c9c8..0d28cd9 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 _0x6726=['path','sox','to-csv','ejs','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','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','update','then','destroy','sendStatus','error','name','params','keys','rawAttributes','query','filters','model','intersection','fields','attributes','length','include','options','ChatProactiveAction','find','catch','body','rimraf','zip-dir','request-promise','moment','mustache'];(function(_0x21ee8a,_0x1a705c){var _0x5125f4=function(_0x45cef0){while(--_0x45cef0){_0x21ee8a['push'](_0x21ee8a['shift']());}};_0x5125f4(++_0x1a705c);}(_0x6726,0xdb));var _0x6672=function(_0x5a1a51,_0x144c79){_0x5a1a51=_0x5a1a51-0x0;var _0x47edd7=_0x6726[_0x5a1a51];return _0x47edd7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6672('0x0'));var zipdir=require(_0x6672('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6672('0x2'));var moment=require(_0x6672('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6672('0x4'));var util=require('util');var path=require(_0x6672('0x5'));var sox=require(_0x6672('0x6'));var csv=require(_0x6672('0x7'));var ejs=require(_0x6672('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6672('0x9'));var squel=require(_0x6672('0xa'));var crypto=require(_0x6672('0xb'));var jsforce=require(_0x6672('0xc'));var deskjs=require(_0x6672('0xd'));var toCsv=require(_0x6672('0x7'));var querystring=require(_0x6672('0xe'));var Papa=require(_0x6672('0xf'));var Redis=require(_0x6672('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x6672('0x11'));var as=require(_0x6672('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6672('0x13'))(_0x6672('0x14'));var utils=require(_0x6672('0x15'));var config=require(_0x6672('0x16'));var licenseUtil=require(_0x6672('0x17'));var db=require(_0x6672('0x18'))['db'];function respondWithStatusCode(_0x182b77,_0x2dbf18){_0x2dbf18=_0x2dbf18||0xcc;return function(_0x2ec0bd){if(_0x2ec0bd){return _0x182b77['sendStatus'](_0x2dbf18);}return _0x182b77[_0x6672('0x19')](_0x2dbf18)[_0x6672('0x1a')]();};}function respondWithResult(_0x3e45de,_0x40f310){_0x40f310=_0x40f310||0xc8;return function(_0x1e3eb0){if(_0x1e3eb0){return _0x3e45de[_0x6672('0x19')](_0x40f310)[_0x6672('0x1b')](_0x1e3eb0);}};}function respondWithFilteredResult(_0x514097,_0xbf2cce){return function(_0x3261c9){if(_0x3261c9){var _0x46b6cb=typeof _0xbf2cce[_0x6672('0x1c')]===_0x6672('0x1d')&&typeof _0xbf2cce[_0x6672('0x1e')]===_0x6672('0x1d');var _0x184a79=_0x3261c9['count'];var _0x1a6d2a=_0x46b6cb?0x0:_0xbf2cce[_0x6672('0x1c')];var _0x344300=_0x46b6cb?_0x3261c9[_0x6672('0x1f')]:_0xbf2cce['offset']+_0xbf2cce[_0x6672('0x1e')];var _0x52b617;if(_0x344300>=_0x184a79){_0x344300=_0x184a79;_0x52b617=0xc8;}else{_0x52b617=0xce;}_0x514097[_0x6672('0x19')](_0x52b617);return _0x514097['set'](_0x6672('0x20'),_0x1a6d2a+'-'+_0x344300+'/'+_0x184a79)[_0x6672('0x1b')](_0x3261c9);}return null;};}function patchUpdates(_0x50e8c2){return function(_0x636fed){try{jsonpatch[_0x6672('0x21')](_0x636fed,_0x50e8c2,!![]);}catch(_0x3c23d5){return BPromise['reject'](_0x3c23d5);}return _0x636fed['save']();};}function saveUpdates(_0x1b221c,_0x12fa16){return function(_0x255212){if(_0x255212){return _0x255212[_0x6672('0x22')](_0x1b221c)[_0x6672('0x23')](function(_0xd2d057){return _0xd2d057;});}return null;};}function removeEntity(_0x35e285,_0x124bb5){return function(_0x1252de){if(_0x1252de){return _0x1252de[_0x6672('0x24')]()[_0x6672('0x23')](function(){_0x35e285[_0x6672('0x19')](0xcc)[_0x6672('0x1a')]();});}};}function handleEntityNotFound(_0x1c2886,_0x387614){return function(_0x37e76e){if(!_0x37e76e){_0x1c2886[_0x6672('0x25')](0x194);}return _0x37e76e;};}function handleError(_0x19d58c,_0x1f4c29){_0x1f4c29=_0x1f4c29||0x1f4;return function(_0x4ed516){logger[_0x6672('0x26')](_0x4ed516['stack']);if(_0x4ed516[_0x6672('0x27')]){delete _0x4ed516['name'];}_0x19d58c[_0x6672('0x19')](_0x1f4c29)['send'](_0x4ed516);};}exports['show']=function(_0x4fcd14,_0x302306){var _0x39da71={'raw':!![],'where':{'id':_0x4fcd14[_0x6672('0x28')]['id']}},_0x2a3e42={};_0x2a3e42['model']=_[_0x6672('0x29')](db['ChatProactiveAction'][_0x6672('0x2a')]);_0x2a3e42[_0x6672('0x2b')]=_[_0x6672('0x29')](_0x4fcd14['query']);_0x2a3e42[_0x6672('0x2c')]=_['intersection'](_0x2a3e42[_0x6672('0x2d')],_0x2a3e42['query']);_0x39da71['attributes']=_[_0x6672('0x2e')](_0x2a3e42[_0x6672('0x2d')],qs[_0x6672('0x2f')](_0x4fcd14[_0x6672('0x2b')][_0x6672('0x2f')]));_0x39da71[_0x6672('0x30')]=_0x39da71[_0x6672('0x30')][_0x6672('0x31')]?_0x39da71[_0x6672('0x30')]:_0x2a3e42[_0x6672('0x2d')];if(_0x4fcd14[_0x6672('0x2b')]['includeAll']){_0x39da71[_0x6672('0x32')]=[{'all':!![]}];}_0x39da71=_['merge']({},_0x39da71,_0x4fcd14[_0x6672('0x33')]);return db[_0x6672('0x34')][_0x6672('0x35')](_0x39da71)['then'](handleEntityNotFound(_0x302306,null))[_0x6672('0x23')](respondWithResult(_0x302306,null))[_0x6672('0x36')](handleError(_0x302306,null));};exports['create']=function(_0x4c5849,_0x4fbe1a){return db['ChatProactiveAction']['create'](_0x4c5849['body'],{})['then'](respondWithResult(_0x4fbe1a,0xc9))[_0x6672('0x36')](handleError(_0x4fbe1a,null));};exports[_0x6672('0x22')]=function(_0x21571e,_0x3da7b8){if(_0x21571e[_0x6672('0x37')]['id']){delete _0x21571e['body']['id'];}return db[_0x6672('0x34')][_0x6672('0x35')]({'where':{'id':_0x21571e['params']['id']}})[_0x6672('0x23')](handleEntityNotFound(_0x3da7b8,null))['then'](saveUpdates(_0x21571e[_0x6672('0x37')],null))['then'](respondWithResult(_0x3da7b8,null))['catch'](handleError(_0x3da7b8,null));};exports[_0x6672('0x24')]=function(_0x2856be,_0x53a382){return db[_0x6672('0x34')]['find']({'where':{'id':_0x2856be[_0x6672('0x28')]['id']}})[_0x6672('0x23')](handleEntityNotFound(_0x53a382,null))[_0x6672('0x23')](removeEntity(_0x53a382,null))['catch'](handleError(_0x53a382,null));}; \ No newline at end of file +var _0xafdd=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send','params','model','query','keys','intersection','attributes','fields','includeAll','include','merge','ChatProactiveAction','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js'];(function(_0x2fc673,_0x522af0){var _0x21d6e2=function(_0x38356e){while(--_0x38356e){_0x2fc673['push'](_0x2fc673['shift']());}};_0x21d6e2(++_0x522af0);}(_0xafdd,0x19a));var _0xdafd=function(_0x1ffa41,_0xc3996b){_0x1ffa41=_0x1ffa41-0x0;var _0x1f3a1a=_0xafdd[_0x1ffa41];return _0x1f3a1a;};'use strict';var emlformat=require(_0xdafd('0x0'));var rimraf=require(_0xdafd('0x1'));var zipdir=require(_0xdafd('0x2'));var jsonpatch=require(_0xdafd('0x3'));var rp=require(_0xdafd('0x4'));var moment=require(_0xdafd('0x5'));var BPromise=require(_0xdafd('0x6'));var Mustache=require(_0xdafd('0x7'));var util=require('util');var path=require(_0xdafd('0x8'));var sox=require(_0xdafd('0x9'));var csv=require(_0xdafd('0xa'));var ejs=require(_0xdafd('0xb'));var fs=require('fs');var fs_extra=require(_0xdafd('0xc'));var _=require(_0xdafd('0xd'));var squel=require(_0xdafd('0xe'));var crypto=require('crypto');var jsforce=require(_0xdafd('0xf'));var deskjs=require(_0xdafd('0x10'));var toCsv=require(_0xdafd('0xa'));var querystring=require('querystring');var Papa=require(_0xdafd('0x11'));var Redis=require(_0xdafd('0x12'));var authService=require(_0xdafd('0x13'));var qs=require(_0xdafd('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdafd('0x15'));var logger=require(_0xdafd('0x16'))(_0xdafd('0x17'));var utils=require(_0xdafd('0x18'));var config=require(_0xdafd('0x19'));var licenseUtil=require(_0xdafd('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x166176,_0x594f47){_0x594f47=_0x594f47||0xcc;return function(_0x553508){if(_0x553508){return _0x166176[_0xdafd('0x1b')](_0x594f47);}return _0x166176[_0xdafd('0x1c')](_0x594f47)['end']();};}function respondWithResult(_0x43a716,_0x490382){_0x490382=_0x490382||0xc8;return function(_0x4b09da){if(_0x4b09da){return _0x43a716[_0xdafd('0x1c')](_0x490382)[_0xdafd('0x1d')](_0x4b09da);}};}function respondWithFilteredResult(_0x583b1d,_0x267bfc){return function(_0x186379){if(_0x186379){var _0x496515=typeof _0x267bfc[_0xdafd('0x1e')]===_0xdafd('0x1f')&&typeof _0x267bfc[_0xdafd('0x20')]==='undefined';var _0xb382ca=_0x186379[_0xdafd('0x21')];var _0x4fc3a4=_0x496515?0x0:_0x267bfc['offset'];var _0x2569b2=_0x496515?_0x186379['count']:_0x267bfc[_0xdafd('0x1e')]+_0x267bfc[_0xdafd('0x20')];var _0x1e64d3;if(_0x2569b2>=_0xb382ca){_0x2569b2=_0xb382ca;_0x1e64d3=0xc8;}else{_0x1e64d3=0xce;}_0x583b1d[_0xdafd('0x1c')](_0x1e64d3);return _0x583b1d[_0xdafd('0x22')](_0xdafd('0x23'),_0x4fc3a4+'-'+_0x2569b2+'/'+_0xb382ca)[_0xdafd('0x1d')](_0x186379);}return null;};}function patchUpdates(_0x42e0f9){return function(_0x8480a8){try{jsonpatch[_0xdafd('0x24')](_0x8480a8,_0x42e0f9,!![]);}catch(_0xee767e){return BPromise[_0xdafd('0x25')](_0xee767e);}return _0x8480a8[_0xdafd('0x26')]();};}function saveUpdates(_0xf4a521,_0x491d96){return function(_0x230495){if(_0x230495){return _0x230495['update'](_0xf4a521)[_0xdafd('0x27')](function(_0x5e96cc){return _0x5e96cc;});}return null;};}function removeEntity(_0x439bbf,_0x35ef78){return function(_0x7f10f6){if(_0x7f10f6){return _0x7f10f6[_0xdafd('0x28')]()[_0xdafd('0x27')](function(){_0x439bbf[_0xdafd('0x1c')](0xcc)[_0xdafd('0x29')]();});}};}function handleEntityNotFound(_0x30cba9,_0x3846dd){return function(_0x5cd11d){if(!_0x5cd11d){_0x30cba9[_0xdafd('0x1b')](0x194);}return _0x5cd11d;};}function handleError(_0x2ab575,_0x18554c){_0x18554c=_0x18554c||0x1f4;return function(_0x1feb5b){logger[_0xdafd('0x2a')](_0x1feb5b[_0xdafd('0x2b')]);if(_0x1feb5b[_0xdafd('0x2c')]){delete _0x1feb5b[_0xdafd('0x2c')];}_0x2ab575[_0xdafd('0x1c')](_0x18554c)[_0xdafd('0x2d')](_0x1feb5b);};}exports['show']=function(_0x243182,_0x14626b){var _0x13ab81={'raw':!![],'where':{'id':_0x243182[_0xdafd('0x2e')]['id']}},_0x249743={};_0x249743[_0xdafd('0x2f')]=_['keys'](db['ChatProactiveAction']['rawAttributes']);_0x249743[_0xdafd('0x30')]=_[_0xdafd('0x31')](_0x243182['query']);_0x249743['filters']=_[_0xdafd('0x32')](_0x249743[_0xdafd('0x2f')],_0x249743[_0xdafd('0x30')]);_0x13ab81[_0xdafd('0x33')]=_[_0xdafd('0x32')](_0x249743[_0xdafd('0x2f')],qs[_0xdafd('0x34')](_0x243182['query'][_0xdafd('0x34')]));_0x13ab81[_0xdafd('0x33')]=_0x13ab81[_0xdafd('0x33')]['length']?_0x13ab81[_0xdafd('0x33')]:_0x249743[_0xdafd('0x2f')];if(_0x243182['query'][_0xdafd('0x35')]){_0x13ab81[_0xdafd('0x36')]=[{'all':!![]}];}_0x13ab81=_[_0xdafd('0x37')]({},_0x13ab81,_0x243182['options']);return db[_0xdafd('0x38')][_0xdafd('0x39')](_0x13ab81)[_0xdafd('0x27')](handleEntityNotFound(_0x14626b,null))[_0xdafd('0x27')](respondWithResult(_0x14626b,null))[_0xdafd('0x3a')](handleError(_0x14626b,null));};exports[_0xdafd('0x3b')]=function(_0x3bda9b,_0x5dc9f2){return db[_0xdafd('0x38')][_0xdafd('0x3b')](_0x3bda9b[_0xdafd('0x3c')],{})[_0xdafd('0x27')](respondWithResult(_0x5dc9f2,0xc9))[_0xdafd('0x3a')](handleError(_0x5dc9f2,null));};exports['update']=function(_0x386cf6,_0x21d724){if(_0x386cf6['body']['id']){delete _0x386cf6[_0xdafd('0x3c')]['id'];}return db[_0xdafd('0x38')][_0xdafd('0x39')]({'where':{'id':_0x386cf6[_0xdafd('0x2e')]['id']}})[_0xdafd('0x27')](handleEntityNotFound(_0x21d724,null))[_0xdafd('0x27')](saveUpdates(_0x386cf6[_0xdafd('0x3c')],null))[_0xdafd('0x27')](respondWithResult(_0x21d724,null))[_0xdafd('0x3a')](handleError(_0x21d724,null));};exports[_0xdafd('0x28')]=function(_0x787d7c,_0x245163){return db[_0xdafd('0x38')][_0xdafd('0x39')]({'where':{'id':_0x787d7c[_0xdafd('0x2e')]['id']}})[_0xdafd('0x27')](handleEntityNotFound(_0x245163,null))[_0xdafd('0x27')](removeEntity(_0x245163,null))[_0xdafd('0x3a')](handleError(_0x245163,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 0924258..008ccd7 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 _0x49c9=['bluebird','request-promise','path','./chatProactiveAction.attributes','exports','ChatProactiveAction','lodash','util','../../config/logger','api','moment'];(function(_0x5f04e5,_0x4cebe8){var _0x1703ab=function(_0x4d6d30){while(--_0x4d6d30){_0x5f04e5['push'](_0x5f04e5['shift']());}};_0x1703ab(++_0x4cebe8);}(_0x49c9,0x1be));var _0x949c=function(_0x236d94,_0x2ca004){_0x236d94=_0x236d94-0x0;var _0x51506f=_0x49c9[_0x236d94];return _0x51506f;};'use strict';var _=require(_0x949c('0x0'));var util=require(_0x949c('0x1'));var logger=require(_0x949c('0x2'))(_0x949c('0x3'));var moment=require(_0x949c('0x4'));var BPromise=require(_0x949c('0x5'));var rp=require(_0x949c('0x6'));var fs=require('fs');var path=require(_0x949c('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x949c('0x8'));module[_0x949c('0x9')]=function(_0x3e7e41,_0x53ff8a){return _0x3e7e41['define'](_0x949c('0xa'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdf81=['bluebird','request-promise','path','rimraf','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger','api'];(function(_0x433919,_0x4b106a){var _0x192c9f=function(_0x153f4a){while(--_0x153f4a){_0x433919['push'](_0x433919['shift']());}};_0x192c9f(++_0x4b106a);}(_0xdf81,0xcc));var _0x1df8=function(_0x4b73a2,_0x40b5fe){_0x4b73a2=_0x4b73a2-0x0;var _0x383c66=_0xdf81[_0x4b73a2];return _0x383c66;};'use strict';var _=require(_0x1df8('0x0'));var util=require(_0x1df8('0x1'));var logger=require(_0x1df8('0x2'))(_0x1df8('0x3'));var moment=require('moment');var BPromise=require(_0x1df8('0x4'));var rp=require(_0x1df8('0x5'));var fs=require('fs');var path=require(_0x1df8('0x6'));var rimraf=require(_0x1df8('0x7'));var config=require('../../config/environment');var attributes=require(_0x1df8('0x8'));module[_0x1df8('0x9')]=function(_0x23971d,_0xc7a571){return _0x23971d[_0x1df8('0xa')](_0x1df8('0xb'),attributes,{'tableName':_0x1df8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index 5f6de20..f994b15 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 _0x5ecd=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatProactiveAction,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x5ecd,0x18a));var _0xd5ec=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5ecd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd5ec('0x0'));var util=require(_0xd5ec('0x1'));var moment=require(_0xd5ec('0x2'));var BPromise=require(_0xd5ec('0x3'));var rs=require(_0xd5ec('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd5ec('0x5'))['db'];var utils=require(_0xd5ec('0x6'));var logger=require(_0xd5ec('0x7'))(_0xd5ec('0x8'));var config=require(_0xd5ec('0x9'));var jayson=require(_0xd5ec('0xa'));var client=jayson[_0xd5ec('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x157d1b,_0x28c324,_0x3b666a){return new BPromise(function(_0xedd40d,_0x213bb2){return client[_0xd5ec('0xc')](_0x157d1b,_0x3b666a)[_0xd5ec('0xd')](function(_0x6591a3){logger[_0xd5ec('0xe')]('ChatProactiveAction,\x20%s,\x20%s',_0x28c324,_0xd5ec('0xf'));logger[_0xd5ec('0x10')](_0xd5ec('0x11'),_0x28c324,_0xd5ec('0xf'),JSON[_0xd5ec('0x12')](_0x6591a3));if(_0x6591a3[_0xd5ec('0x13')]){if(_0x6591a3['error'][_0xd5ec('0x14')]===0x1f4){logger[_0xd5ec('0x13')](_0xd5ec('0x15'),_0x28c324,_0x6591a3['error'][_0xd5ec('0x16')]);return _0x213bb2(_0x6591a3['error'][_0xd5ec('0x16')]);}logger[_0xd5ec('0x13')](_0xd5ec('0x15'),_0x28c324,_0x6591a3[_0xd5ec('0x13')][_0xd5ec('0x16')]);return _0xedd40d(_0x6591a3[_0xd5ec('0x13')][_0xd5ec('0x16')]);}else{logger[_0xd5ec('0xe')](_0xd5ec('0x15'),_0x28c324,_0xd5ec('0xf'));_0xedd40d(_0x6591a3[_0xd5ec('0x17')][_0xd5ec('0x16')]);}})[_0xd5ec('0x18')](function(_0x1bef54){logger[_0xd5ec('0x13')]('ChatProactiveAction,\x20%s,\x20%s',_0x28c324,_0x1bef54);_0x213bb2(_0x1bef54);});});} \ No newline at end of file +var _0xa818=['request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s'];(function(_0x3877c1,_0x238c29){var _0x59056a=function(_0x3567cd){while(--_0x3567cd){_0x3877c1['push'](_0x3877c1['shift']());}};_0x59056a(++_0x238c29);}(_0xa818,0x64));var _0x8a81=function(_0x3daa8c,_0x388a87){_0x3daa8c=_0x3daa8c-0x0;var _0x2b1bd7=_0xa818[_0x3daa8c];return _0x2b1bd7;};'use strict';var _=require('lodash');var util=require(_0x8a81('0x0'));var moment=require(_0x8a81('0x1'));var BPromise=require(_0x8a81('0x2'));var rs=require(_0x8a81('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8a81('0x4'))['db'];var utils=require(_0x8a81('0x5'));var logger=require(_0x8a81('0x6'))(_0x8a81('0x7'));var config=require(_0x8a81('0x8'));var jayson=require(_0x8a81('0x9'));var client=jayson['client'][_0x8a81('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2a0cd9,_0x15025d,_0x35eb10){return new BPromise(function(_0x1a364a,_0x5e65d5){return client[_0x8a81('0xb')](_0x2a0cd9,_0x35eb10)[_0x8a81('0xc')](function(_0x55be3a){logger[_0x8a81('0xd')](_0x8a81('0xe'),_0x15025d,_0x8a81('0xf'));logger[_0x8a81('0x10')](_0x8a81('0x11'),_0x15025d,_0x8a81('0xf'),JSON[_0x8a81('0x12')](_0x55be3a));if(_0x55be3a[_0x8a81('0x13')]){if(_0x55be3a[_0x8a81('0x13')]['code']===0x1f4){logger['error'](_0x8a81('0xe'),_0x15025d,_0x55be3a[_0x8a81('0x13')][_0x8a81('0x14')]);return _0x5e65d5(_0x55be3a[_0x8a81('0x13')][_0x8a81('0x14')]);}logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x15025d,_0x55be3a[_0x8a81('0x13')][_0x8a81('0x14')]);return _0x1a364a(_0x55be3a[_0x8a81('0x13')]['message']);}else{logger[_0x8a81('0xd')](_0x8a81('0xe'),_0x15025d,_0x8a81('0xf'));_0x1a364a(_0x55be3a[_0x8a81('0x15')]['message']);}})[_0x8a81('0x16')](function(_0x269f5c){logger[_0x8a81('0x13')](_0x8a81('0xe'),_0x15025d,_0x269f5c);_0x5e65d5(_0x269f5c);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index c1c50d7..ac5a1de 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(_0x36067f,_0xba548e){var _0x44f0b3=function(_0x1954af){while(--_0x1954af){_0x36067f['push'](_0x36067f['shift']());}};_0x44f0b3(++_0xba548e);}(_0x4819,0xcd));var _0x9481=function(_0x1a547e,_0x5917d3){_0x1a547e=_0x1a547e-0x0;var _0x5ebdaf=_0x4819[_0x1a547e];return _0x5ebdaf;};'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 _0x7fbe=['show','post','create','put','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated'];(function(_0x1ead47,_0x47766a){var _0x8cbbbc=function(_0x2a20fb){while(--_0x2a20fb){_0x1ead47['push'](_0x1ead47['shift']());}};_0x8cbbbc(++_0x47766a);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x35c718,_0x33a696){_0x35c718=_0x35c718-0x0;var _0x5c3099=_0x7fbe[_0x35c718];return _0x5c3099;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7fb('0x0'));var timeout=require(_0xe7fb('0x1'));var express=require(_0xe7fb('0x2'));var router=express[_0xe7fb('0x3')]();var fs_extra=require(_0xe7fb('0x4'));var auth=require(_0xe7fb('0x5'));var interaction=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var controller=require(_0xe7fb('0x8'));router[_0xe7fb('0x9')](_0xe7fb('0xa'),auth[_0xe7fb('0xb')](),controller[_0xe7fb('0xc')]);router[_0xe7fb('0xd')]('/',auth['isAuthenticated'](),controller[_0xe7fb('0xe')]);router[_0xe7fb('0xf')](_0xe7fb('0xa'),auth[_0xe7fb('0xb')](),controller['update']);router['delete'](_0xe7fb('0xa'),auth[_0xe7fb('0xb')](),controller[_0xe7fb('0x10')]);module[_0xe7fb('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 9df13ae..4538dd9 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 _0x0537=['INTEGER','rrmemory','beepall','sequelize','exports','STRING','name'];(function(_0x443308,_0x1bdf81){var _0x4cc59c=function(_0x35a992){while(--_0x35a992){_0x443308['push'](_0x443308['shift']());}};_0x4cc59c(++_0x1bdf81);}(_0x0537,0x1d1));var _0x7053=function(_0x5538b3,_0x402023){_0x5538b3=_0x5538b3-0x0;var _0x43ddfe=_0x0537[_0x5538b3];return _0x43ddfe;};'use strict';var Sequelize=require(_0x7053('0x0'));module[_0x7053('0x1')]={'name':{'type':Sequelize[_0x7053('0x2')],'unique':_0x7053('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x7053('0x2')]},'timeout':{'type':Sequelize[_0x7053('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x7053('0x5'),_0x7053('0x6'),'roundrobin')}}; \ No newline at end of file +var _0xfe38=['exports','STRING','name','ENUM','rrmemory','sequelize'];(function(_0x5d0430,_0x15cc32){var _0x4d964c=function(_0x392cbf){while(--_0x392cbf){_0x5d0430['push'](_0x5d0430['shift']());}};_0x4d964c(++_0x15cc32);}(_0xfe38,0x18b));var _0x8fe3=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xfe38[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x8fe3('0x0'));module[_0x8fe3('0x1')]={'name':{'type':Sequelize[_0x8fe3('0x2')],'unique':_0x8fe3('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8fe3('0x4')](_0x8fe3('0x5'),'beepall','roundrobin')}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index a3d9b06..14ef097 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 _0x8541=['every','TeamId','includes','all','union','value','transaction','ids','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','isArray','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','socket.io-emitter','./chatQueue.socket','end','status','json','offset','undefined','limit','set','Content-Range','update','then','destroy','get','ChatQueues','sendStatus','error','stack','name','ChatQueue','rawAttributes','fieldName','getOptions','count','include','query','findAll','catch','show','params','keys','intersection','model','attributes','fields','length','includeAll','merge','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','describe','getMembers','findOne','UserChatQueue','filters','hasOwnProperty','nolimit','order','sort','where','filter','User','findAndCountAll','map','chatPause','createdAt','rows','format','SIP','getTeams','Team','pick','addTeams','Agents','online','voicePause','interface','flatMap','sequelize','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','select','tq.TeamId','from','team_has_chat_queues','user_has_teams','ChatQueueId\x20=\x20?','clone','push','toString','SELECT'];(function(_0x5b5b2f,_0x59f174){var _0x274e33=function(_0x2a2342){while(--_0x2a2342){_0x5b5b2f['push'](_0x5b5b2f['shift']());}};_0x274e33(++_0x59f174);}(_0x8541,0xfd));var _0x1854=function(_0x1c7117,_0x1c3af2){_0x1c7117=_0x1c7117-0x0;var _0x5d3c3c=_0x8541[_0x1c7117];return _0x5d3c3c;};'use strict';var BPromise=require(_0x1854('0x0'));var util=require(_0x1854('0x1'));var _=require(_0x1854('0x2'));var squel=require(_0x1854('0x3'));var Redis=require(_0x1854('0x4'));var qs=require(_0x1854('0x5'));var logger=require(_0x1854('0x6'))(_0x1854('0x7'));var config=require('../../config/environment');var db=require(_0x1854('0x8'))['db'];config[_0x1854('0x9')]=_[_0x1854('0xa')](config[_0x1854('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x1854('0xb'))(new Redis(config[_0x1854('0x9')]));require(_0x1854('0xc'))['register'](socket);function respondWithStatusCode(_0x52d767,_0x16c963){_0x16c963=_0x16c963||0xcc;return function(_0xf4cff6){if(_0xf4cff6){return _0x52d767['sendStatus'](_0x16c963);}return _0x52d767['status'](_0x16c963)[_0x1854('0xd')]();};}function respondWithResult(_0x407443,_0x1bc02b){_0x1bc02b=_0x1bc02b||0xc8;return function(_0x54f658){if(_0x54f658){return _0x407443[_0x1854('0xe')](_0x1bc02b)[_0x1854('0xf')](_0x54f658);}};}function respondWithFilteredResult(_0x1ed32f,_0x2a0cf9){return function(_0x24cfdc){if(_0x24cfdc){var _0x35b770=typeof _0x2a0cf9[_0x1854('0x10')]===_0x1854('0x11')&&typeof _0x2a0cf9[_0x1854('0x12')]==='undefined';var _0x17c8ec=_0x24cfdc['count'];var _0x1ae8ed=_0x35b770?0x0:_0x2a0cf9[_0x1854('0x10')];var _0x503b1e=_0x35b770?_0x24cfdc['count']:_0x2a0cf9[_0x1854('0x10')]+_0x2a0cf9[_0x1854('0x12')];var _0x47a3ff;if(_0x503b1e>=_0x17c8ec){_0x503b1e=_0x17c8ec;_0x47a3ff=0xc8;}else{_0x47a3ff=0xce;}_0x1ed32f[_0x1854('0xe')](_0x47a3ff);return _0x1ed32f[_0x1854('0x13')](_0x1854('0x14'),_0x1ae8ed+'-'+_0x503b1e+'/'+_0x17c8ec)[_0x1854('0xf')](_0x24cfdc);}return null;};}function saveUpdates(_0x1cc594){return function(_0x1b1f9a){if(_0x1b1f9a){return _0x1b1f9a[_0x1854('0x15')](_0x1cc594)[_0x1854('0x16')](function(_0x3abf5d){return _0x3abf5d;});}return null;};}function removeEntity(_0xf5f0b5){return function(_0x5ea653){if(_0x5ea653){return _0x5ea653[_0x1854('0x17')]()[_0x1854('0x16')](function(){var _0xb4bd91=_0x5ea653[_0x1854('0x18')]({'plain':!![]});var _0x4cd4c6=_0x1854('0x19');return db['UserProfileResource'][_0x1854('0x17')]({'where':{'type':_0x4cd4c6,'resourceId':_0xb4bd91['id']}})['then'](function(){return _0x5ea653;});})[_0x1854('0x16')](function(){_0xf5f0b5['status'](0xcc)[_0x1854('0xd')]();});}};}function handleEntityNotFound(_0x1b9ada){return function(_0x1217be){if(!_0x1217be){_0x1b9ada[_0x1854('0x1a')](0x194);}return _0x1217be;};}function handleError(_0x4f8f03,_0x292900){_0x292900=_0x292900||0x1f4;return function(_0x5c6853){logger[_0x1854('0x1b')](_0x5c6853[_0x1854('0x1c')]);if(_0x5c6853[_0x1854('0x1d')]){delete _0x5c6853['name'];}_0x4f8f03['status'](_0x292900)['send'](_0x5c6853);};}exports['index']=function(_0x376db6,_0x6b9f83){var _0x29cdbe={};var _0x397a2c={'count':0x0,'rows':[]};var _0xafc05d=_['map'](db[_0x1854('0x1e')][_0x1854('0x1f')],function(_0x8c7b68){return{'name':_0x8c7b68[_0x1854('0x20')],'type':_0x8c7b68['type']['key']};});_0x29cdbe=qs[_0x1854('0x21')](_0xafc05d,_0x376db6);var _0x23b75c={'where':_0x29cdbe['where']};return db[_0x1854('0x1e')][_0x1854('0x22')](_0x23b75c)['then'](function(_0x208c85){_0x397a2c[_0x1854('0x22')]=_0x208c85;_0x29cdbe[_0x1854('0x23')]=qs['include'](_0x376db6[_0x1854('0x24')]);return db[_0x1854('0x1e')][_0x1854('0x25')](_0x29cdbe);})[_0x1854('0x16')](function(_0x149980){_0x397a2c['rows']=_0x149980;return _0x397a2c;})[_0x1854('0x16')](respondWithFilteredResult(_0x6b9f83,_0x29cdbe))[_0x1854('0x26')](handleError(_0x6b9f83,null));};exports[_0x1854('0x27')]=function(_0x424a95,_0xf9933f){var _0x49f013={'raw':!![],'where':{'id':_0x424a95[_0x1854('0x28')]['id']}},_0x5481c9={};_0x5481c9['model']=_[_0x1854('0x29')](db['ChatQueue'][_0x1854('0x1f')]);_0x5481c9[_0x1854('0x24')]=_[_0x1854('0x29')](_0x424a95[_0x1854('0x24')]);_0x5481c9['filters']=_[_0x1854('0x2a')](_0x5481c9[_0x1854('0x2b')],_0x5481c9[_0x1854('0x24')]);_0x49f013[_0x1854('0x2c')]=_[_0x1854('0x2a')](_0x5481c9[_0x1854('0x2b')],qs['fields'](_0x424a95[_0x1854('0x24')][_0x1854('0x2d')]));_0x49f013['attributes']=_0x49f013[_0x1854('0x2c')][_0x1854('0x2e')]?_0x49f013[_0x1854('0x2c')]:_0x5481c9[_0x1854('0x2b')];if(_0x424a95[_0x1854('0x24')][_0x1854('0x2f')]){_0x49f013[_0x1854('0x23')]=[{'all':!![]}];}_0x49f013=_[_0x1854('0x30')]({},_0x49f013,_0x424a95[_0x1854('0x31')]);return db[_0x1854('0x1e')][_0x1854('0x32')](_0x49f013)[_0x1854('0x16')](handleEntityNotFound(_0xf9933f,null))[_0x1854('0x16')](respondWithResult(_0xf9933f,null))[_0x1854('0x26')](handleError(_0xf9933f,null));};exports[_0x1854('0x33')]=function(_0x5e2ace,_0x28c966){return db[_0x1854('0x1e')][_0x1854('0x33')](_0x5e2ace[_0x1854('0x34')],{})['then'](function(_0x45a5fb){var _0x1cb58b=_0x5e2ace['user'][_0x1854('0x18')]({'plain':!![]});if(!_0x1cb58b)throw new Error(_0x1854('0x35'));if(_0x1cb58b['role']===_0x1854('0x36')){var _0x3b3b22=_0x45a5fb['get']({'plain':!![]});var _0x2de7d7=_0x1854('0x19');return db[_0x1854('0x37')]['find']({'where':{'name':_0x2de7d7,'userProfileId':_0x1cb58b[_0x1854('0x38')]},'raw':!![]})[_0x1854('0x16')](function(_0xc828e1){if(_0xc828e1&&_0xc828e1[_0x1854('0x39')]===0x0){return db[_0x1854('0x3a')]['create']({'name':_0x3b3b22[_0x1854('0x1d')],'resourceId':_0x3b3b22['id'],'type':_0xc828e1[_0x1854('0x1d')],'sectionId':_0xc828e1['id']},{})[_0x1854('0x16')](function(){return _0x45a5fb;});}else{return _0x45a5fb;}})[_0x1854('0x26')](function(_0x41b783){logger[_0x1854('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x41b783);throw _0x41b783;});}return _0x45a5fb;})['then'](respondWithResult(_0x28c966,0xc9))[_0x1854('0x26')](handleError(_0x28c966,null));};exports[_0x1854('0x15')]=function(_0x19b435,_0x4b6f49){if(_0x19b435['body']['id']){delete _0x19b435[_0x1854('0x34')]['id'];}return db[_0x1854('0x1e')][_0x1854('0x32')]({'where':{'id':_0x19b435[_0x1854('0x28')]['id']}})[_0x1854('0x16')](handleEntityNotFound(_0x4b6f49,null))[_0x1854('0x16')](saveUpdates(_0x19b435[_0x1854('0x34')],null))[_0x1854('0x16')](respondWithResult(_0x4b6f49,null))['catch'](handleError(_0x4b6f49,null));};exports[_0x1854('0x17')]=function(_0x17dfb8,_0x198c62){return db[_0x1854('0x1e')][_0x1854('0x32')]({'where':{'id':_0x17dfb8[_0x1854('0x28')]['id']}})[_0x1854('0x16')](handleEntityNotFound(_0x198c62,null))[_0x1854('0x16')](removeEntity(_0x198c62,null))[_0x1854('0x26')](handleError(_0x198c62,null));};exports[_0x1854('0x3b')]=function(_0xfc8eee,_0x356e25){return db[_0x1854('0x1e')][_0x1854('0x3b')]()[_0x1854('0x16')](respondWithResult(_0x356e25,null))[_0x1854('0x26')](handleError(_0x356e25,null));};exports[_0x1854('0x3c')]=function(_0x4b8b2f,_0x324617){var _0x28f680={'raw':!![],'where':{}},_0x30c8d0={},_0x59dba7;return db[_0x1854('0x1e')][_0x1854('0x3d')]({'where':{'id':_0x4b8b2f['params']['id']}})[_0x1854('0x16')](handleEntityNotFound(_0x324617,null))[_0x1854('0x16')](function(_0xb72c65){if(_0xb72c65){_0x59dba7=_0xb72c65[_0x1854('0x18')]({'plain':!![]});_0x30c8d0['model']=_['keys'](db[_0x1854('0x3e')]['rawAttributes']);_0x30c8d0['query']=_[_0x1854('0x29')](_0x4b8b2f[_0x1854('0x24')]);_0x30c8d0[_0x1854('0x3f')]=_[_0x1854('0x2a')](_0x30c8d0[_0x1854('0x2b')],_0x30c8d0[_0x1854('0x24')]);_0x28f680[_0x1854('0x2c')]=_[_0x1854('0x2a')](_0x30c8d0[_0x1854('0x2b')],qs[_0x1854('0x2d')](_0x4b8b2f[_0x1854('0x24')]['fields']));_0x28f680['attributes']=_0x28f680[_0x1854('0x2c')][_0x1854('0x2e')]?_0x28f680[_0x1854('0x2c')]:_0x30c8d0[_0x1854('0x2b')];if(!_0x4b8b2f[_0x1854('0x24')][_0x1854('0x40')](_0x1854('0x41'))){_0x28f680[_0x1854('0x12')]=qs[_0x1854('0x12')](_0x4b8b2f[_0x1854('0x24')][_0x1854('0x12')]);_0x28f680[_0x1854('0x10')]=qs['offset'](_0x4b8b2f[_0x1854('0x24')][_0x1854('0x10')]);}_0x28f680[_0x1854('0x42')]=qs[_0x1854('0x43')](_0x4b8b2f[_0x1854('0x24')]['sort']);_0x28f680[_0x1854('0x44')]=qs['filters'](_['pick'](_0x4b8b2f[_0x1854('0x24')],_0x30c8d0['filters']));_0x28f680[_0x1854('0x44')]['ChatQueueId']=_0xb72c65['id'];if(_0x4b8b2f['query'][_0x1854('0x45')]){_0x28f680[_0x1854('0x44')]=_[_0x1854('0x30')](_0x28f680['where'],{'$or':_['map'](_0x28f680[_0x1854('0x2c')],function(_0x5c33b1){var _0x4af719={};_0x4af719[_0x5c33b1]={'$like':'%'+_0x4b8b2f['query']['filter']+'%'};return _0x4af719;})});}_0x28f680=_[_0x1854('0x30')]({},_0x28f680,_0x4b8b2f[_0x1854('0x31')]);return db[_0x1854('0x3e')]['findAll'](_0x28f680);}})['then'](function(_0x7e1602){if(_0x7e1602){return db[_0x1854('0x46')][_0x1854('0x47')]({'where':{'id':_[_0x1854('0x48')](_0x7e1602,'UserId'),'role':'agent'},'attributes':['id',_0x1854('0x1d'),_0x1854('0x49'),'updatedAt',_0x1854('0x4a')]});}})[_0x1854('0x16')](function(_0x124784){if(_0x124784){return{'count':_0x124784[_0x1854('0x22')],'rows':_[_0x1854('0x48')](_0x124784[_0x1854('0x4b')],function(_0xdbdecd){return{'membername':_0xdbdecd[_0x1854('0x1d')],'UserId':_0xdbdecd['id'],'queue_name':_0x59dba7[_0x1854('0x1d')],'ChatQueueId':_0x59dba7['id'],'interface':util[_0x1854('0x4c')]('%s/%s',_0x1854('0x4d'),_0xdbdecd[_0x1854('0x1d')]),'penalty':0x0,'paused':_0xdbdecd['chatPause'],'createdAt':_0xdbdecd['createdAt'],'updatedAt':_0xdbdecd['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x1854('0x16')](respondWithFilteredResult(_0x324617,_0x28f680))['catch'](handleError(_0x324617,null));};exports[_0x1854('0x4e')]=function(_0x1cf437,_0x1f0473){var _0x1e3c71={};var _0x183c44={};var _0x3e0cdd;var _0x111440;return db['ChatQueue'][_0x1854('0x3d')]({'where':{'id':_0x1cf437[_0x1854('0x28')]['id']}})['then'](handleEntityNotFound(_0x1f0473,null))[_0x1854('0x16')](function(_0x5b147e){if(_0x5b147e){_0x3e0cdd=_0x5b147e;_0x183c44[_0x1854('0x2b')]=_[_0x1854('0x29')](db[_0x1854('0x4f')][_0x1854('0x1f')]);_0x183c44['query']=_[_0x1854('0x29')](_0x1cf437[_0x1854('0x24')]);_0x183c44[_0x1854('0x3f')]=_['intersection'](_0x183c44[_0x1854('0x2b')],_0x183c44[_0x1854('0x24')]);_0x1e3c71[_0x1854('0x2c')]=_[_0x1854('0x2a')](_0x183c44['model'],qs['fields'](_0x1cf437[_0x1854('0x24')][_0x1854('0x2d')]));_0x1e3c71[_0x1854('0x2c')]=_0x1e3c71['attributes']['length']?_0x1e3c71[_0x1854('0x2c')]:_0x183c44['model'];_0x1e3c71['order']=qs[_0x1854('0x43')](_0x1cf437[_0x1854('0x24')]['sort']);_0x1e3c71['where']=qs[_0x1854('0x3f')](_[_0x1854('0x50')](_0x1cf437[_0x1854('0x24')],_0x183c44[_0x1854('0x3f')]));if(_0x1cf437[_0x1854('0x24')][_0x1854('0x45')]){_0x1e3c71[_0x1854('0x44')]=_[_0x1854('0x30')](_0x1e3c71[_0x1854('0x44')],{'$or':_[_0x1854('0x48')](_0x1e3c71[_0x1854('0x2c')],function(_0x3276ed){var _0x11f559={};_0x11f559[_0x3276ed]={'$like':'%'+_0x1cf437[_0x1854('0x24')][_0x1854('0x45')]+'%'};return _0x11f559;})});}_0x1e3c71=_[_0x1854('0x30')]({},_0x1e3c71,_0x1cf437[_0x1854('0x31')]);return _0x3e0cdd['getTeams'](_0x1e3c71);}})[_0x1854('0x16')](function(_0x3dd654){if(_0x3dd654){_0x111440=_0x3dd654[_0x1854('0x2e')];if(!_0x1cf437['query']['hasOwnProperty'](_0x1854('0x41'))){_0x1e3c71['limit']=qs[_0x1854('0x12')](_0x1cf437[_0x1854('0x24')][_0x1854('0x12')]);_0x1e3c71[_0x1854('0x10')]=qs[_0x1854('0x10')](_0x1cf437['query'][_0x1854('0x10')]);}return _0x3e0cdd[_0x1854('0x4e')](_0x1e3c71);}})['then'](function(_0x2c874e){if(_0x2c874e){return _0x2c874e?{'count':_0x111440,'rows':_0x2c874e}:null;}})[_0x1854('0x16')](respondWithResult(_0x1f0473,null))[_0x1854('0x26')](handleError(_0x1f0473,null));};exports[_0x1854('0x51')]=function(_0x17ec30,_0x333136){var _0x524923=_0x17ec30[_0x1854('0x34')]['ids'];return db[_0x1854('0x4f')][_0x1854('0x25')]({'where':{'id':_0x524923},'attributes':['id'],'include':[{'model':db['User'],'as':_0x1854('0x52'),'attributes':['id',_0x1854('0x1d'),_0x1854('0x53'),_0x1854('0x54'),_0x1854('0x55')],'raw':!![]}]})[_0x1854('0x16')](function(_0x358b86){if(_0x358b86){var _0x4ae7f5=_[_0x1854('0x56')](_0x358b86,function(_0xda9fea){var _0xa1ae1a=_0xda9fea[_0x1854('0x18')]({'plain':!![]});return _0xa1ae1a[_0x1854('0x52')];});return db[_0x1854('0x1e')][_0x1854('0x32')]({'where':{'id':_0x17ec30[_0x1854('0x28')]['id']}})[_0x1854('0x16')](function(_0x535bd9){return db[_0x1854('0x57')]['transaction'](function(_0x1f4c17){return _0x535bd9[_0x1854('0x51')](_0x524923,{'transaction':_0x1f4c17})[_0x1854('0x16')](function(){return BPromise[_0x1854('0x58')](_0x4ae7f5,function(_0x14e30b){return db[_0x1854('0x3e')][_0x1854('0x59')]({'where':{'UserId':_0x14e30b['id'],'ChatQueueId':_0x17ec30[_0x1854('0x28')]['id']},'transaction':_0x1f4c17});});})[_0x1854('0x16')](function(){_0x4ae7f5[_0x1854('0x5a')](function(_0x2edb1a){socket[_0x1854('0x5b')](_0x1854('0x5c'),{'UserId':_0x2edb1a['id'],'ChatQueueId':_0x535bd9['id']});});});});});}})[_0x1854('0x16')](respondWithStatusCode(_0x333136,null))[_0x1854('0x26')](handleError(_0x333136,null));};exports[_0x1854('0x5d')]=function(_0x1c4485,_0x30b6d2){return db[_0x1854('0x4f')][_0x1854('0x25')]({'where':{'id':_0x1c4485[_0x1854('0x24')]['ids']},'attributes':['id'],'include':[{'model':db[_0x1854('0x46')],'as':_0x1854('0x52'),'attributes':['id'],'raw':!![]}]})[_0x1854('0x16')](handleEntityNotFound(_0x30b6d2,null))[_0x1854('0x16')](function(_0x510df3){var _0x145332=_['map'](_0x510df3,'id');var _0x399ccf=[];var _0x3a4c26=[];var _0x78508a=squel[_0x1854('0x5e')]();_0x78508a['field'](_0x1854('0x5f'))[_0x1854('0x60')](_0x1854('0x61'),'tq')['join'](_0x1854('0x62'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x1854('0x63'),_0x1c4485[_0x1854('0x28')]['id']);for(var _0x14a4ef=0x0;_0x14a4ef<_0x510df3[_0x1854('0x2e')];_0x14a4ef+=0x1){let _0x841532=_0x510df3[_0x14a4ef];for(var _0x139de6=0x0;_0x139de6<_0x841532[_0x1854('0x52')][_0x1854('0x2e')];_0x139de6+=0x1){let _0x233420=_0x841532[_0x1854('0x52')][_0x139de6];var _0xe1ed60=_0x78508a[_0x1854('0x64')]();_0xe1ed60[_0x1854('0x44')]('ut.UserId\x20=\x20?',_0x233420['id']);_0x3a4c26[_0x1854('0x65')](db[_0x1854('0x57')][_0x1854('0x24')](_0xe1ed60[_0x1854('0x66')](),{'type':db[_0x1854('0x57')]['QueryTypes'][_0x1854('0x67')]})['then'](function(_0x3711d0){if(_0x3711d0['length']===0x1){return _0x233420['id'];}else{var _0x178927=_[_0x1854('0x68')](_['map'](_0x3711d0,_0x1854('0x69')),function(_0x395e50){return _[_0x1854('0x6a')](_0x145332,_0x395e50);});if(_0x178927){return _0x233420['id'];}}}));}}return BPromise[_0x1854('0x6b')](_0x3a4c26)[_0x1854('0x16')](function(_0x265264){_0x399ccf=_(_0x399ccf)[_0x1854('0x6c')](_0x265264)['compact']()[_0x1854('0x6d')]();return db['ChatQueue'][_0x1854('0x32')]({'where':{'id':_0x1c4485[_0x1854('0x28')]['id']}})[_0x1854('0x16')](function(_0x3ab765){return db[_0x1854('0x57')][_0x1854('0x6e')](function(_0x2147cd){return _0x3ab765[_0x1854('0x5d')](_0x1c4485[_0x1854('0x24')][_0x1854('0x6f')],{'transaction':_0x2147cd})[_0x1854('0x16')](function(){if(!_[_0x1854('0x70')](_0x399ccf)){return _0x3ab765[_0x1854('0x71')](_0x399ccf,{'transaction':_0x2147cd});}})['then'](function(){_0x399ccf[_0x1854('0x5a')](function(_0x5eb1f5){socket[_0x1854('0x5b')](_0x1854('0x72'),{'UserId':_0x5eb1f5,'ChatQueueId':_0x3ab765['id']});});});});});});})[_0x1854('0x16')](respondWithStatusCode(_0x30b6d2,null))[_0x1854('0x26')](handleError(_0x30b6d2,null));};exports[_0x1854('0x73')]=function(_0x31c472,_0x5bc0f5){return db['ChatQueue'][_0x1854('0x32')]({'where':{'id':_0x31c472[_0x1854('0x28')]['id']}})[_0x1854('0x16')](handleEntityNotFound(_0x5bc0f5,null))['then'](function(_0x38366a){if(_0x38366a){return _0x38366a['addAgents'](_0x31c472[_0x1854('0x34')]['ids'],_[_0x1854('0x74')](_0x31c472[_0x1854('0x34')],[_0x1854('0x6f'),'id'])||{})['spread'](function(_0x5ada4a){for(var _0x59ccaa=0x0;_0x59ccaa<_0x31c472[_0x1854('0x34')][_0x1854('0x6f')][_0x1854('0x2e')];_0x59ccaa+=0x1){socket[_0x1854('0x5b')](_0x1854('0x5c'),{'UserId':Number(_0x31c472[_0x1854('0x34')][_0x1854('0x6f')][_0x59ccaa]),'ChatQueueId':Number(_0x31c472[_0x1854('0x28')]['id'])});}return _0x5ada4a;});}})[_0x1854('0x16')](respondWithResult(_0x5bc0f5,null))[_0x1854('0x26')](handleError(_0x5bc0f5,null));};exports['removeAgents']=function(_0x263e74,_0x378e1e){return db[_0x1854('0x1e')][_0x1854('0x32')]({'where':{'id':_0x263e74[_0x1854('0x28')]['id']}})[_0x1854('0x16')](handleEntityNotFound(_0x378e1e,null))[_0x1854('0x16')](function(_0x5aa113){if(_0x5aa113){return _0x5aa113[_0x1854('0x71')](_0x263e74[_0x1854('0x24')][_0x1854('0x6f')])[_0x1854('0x16')](function(){if(_[_0x1854('0x75')](_0x263e74[_0x1854('0x24')][_0x1854('0x6f')])){for(var _0x1c3ea0=0x0;_0x1c3ea0<_0x263e74[_0x1854('0x24')]['ids'][_0x1854('0x2e')];_0x1c3ea0+=0x1){socket['emit']('userChatQueue:remove',{'UserId':Number(_0x263e74[_0x1854('0x24')][_0x1854('0x6f')][_0x1c3ea0]),'ChatQueueId':Number(_0x263e74[_0x1854('0x28')]['id'])});}}else{socket[_0x1854('0x5b')](_0x1854('0x72'),{'UserId':Number(_0x263e74[_0x1854('0x24')][_0x1854('0x6f')]),'ChatQueueId':Number(_0x263e74[_0x1854('0x28')]['id'])});}});}})[_0x1854('0x16')](respondWithStatusCode(_0x378e1e,null))['catch'](handleError(_0x378e1e,null));};exports['getAgents']=function(_0x45d2ec,_0x36e2ec){var _0x287bb3={};var _0xad9589={};var _0x525017;var _0x23a6be;return db[_0x1854('0x1e')]['findOne']({'where':{'id':_0x45d2ec['params']['id']}})[_0x1854('0x16')](handleEntityNotFound(_0x36e2ec,null))[_0x1854('0x16')](function(_0x4960bc){if(_0x4960bc){_0x525017=_0x4960bc;_0xad9589[_0x1854('0x2b')]=_[_0x1854('0x29')](db['User'][_0x1854('0x1f')]);_0xad9589[_0x1854('0x24')]=_[_0x1854('0x29')](_0x45d2ec[_0x1854('0x24')]);_0xad9589[_0x1854('0x3f')]=_[_0x1854('0x2a')](_0xad9589[_0x1854('0x2b')],_0xad9589[_0x1854('0x24')]);_0x287bb3[_0x1854('0x2c')]=_[_0x1854('0x2a')](_0xad9589[_0x1854('0x2b')],qs[_0x1854('0x2d')](_0x45d2ec[_0x1854('0x24')][_0x1854('0x2d')]));_0x287bb3[_0x1854('0x2c')]=_0x287bb3[_0x1854('0x2c')][_0x1854('0x2e')]?_0x287bb3['attributes']:_0xad9589[_0x1854('0x2b')];_0x287bb3[_0x1854('0x42')]=qs[_0x1854('0x43')](_0x45d2ec[_0x1854('0x24')][_0x1854('0x43')]);_0x287bb3['where']=qs['filters'](_['pick'](_0x45d2ec['query'],_0xad9589['filters']));if(_0x45d2ec[_0x1854('0x24')][_0x1854('0x45')]){_0x287bb3[_0x1854('0x44')]=_['merge'](_0x287bb3[_0x1854('0x44')],{'$or':_[_0x1854('0x48')](_0x287bb3[_0x1854('0x2c')],function(_0x560f73){var _0x6eb3b8={};_0x6eb3b8[_0x560f73]={'$like':'%'+_0x45d2ec[_0x1854('0x24')][_0x1854('0x45')]+'%'};return _0x6eb3b8;})});}_0x287bb3=_[_0x1854('0x30')]({},_0x287bb3,_0x45d2ec[_0x1854('0x31')]);return _0x525017[_0x1854('0x76')](_0x287bb3);}})[_0x1854('0x16')](function(_0x2a32a7){if(_0x2a32a7){_0x23a6be=_0x2a32a7['length'];if(!_0x45d2ec[_0x1854('0x24')][_0x1854('0x40')](_0x1854('0x41'))){_0x287bb3[_0x1854('0x12')]=qs['limit'](_0x45d2ec[_0x1854('0x24')][_0x1854('0x12')]);_0x287bb3['offset']=qs['offset'](_0x45d2ec['query']['offset']);}return _0x525017[_0x1854('0x76')](_0x287bb3);}})[_0x1854('0x16')](function(_0x5963e8){if(_0x5963e8){return _0x5963e8?{'count':_0x23a6be,'rows':_0x5963e8}:null;}})['then'](respondWithResult(_0x36e2ec,null))[_0x1854('0x26')](handleError(_0x36e2ec,null));}; \ No newline at end of file +var _0x2f4a=['../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','update','then','destroy','get','ChatQueues','UserProfileResource','error','name','send','index','map','rawAttributes','fieldName','type','key','getOptions','where','ChatQueue','include','query','findAll','rows','catch','show','params','model','intersection','attributes','fields','length','includeAll','options','find','create','body','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','keys','filters','hasOwnProperty','nolimit','order','sort','ChatQueueId','filter','merge','UserChatQueue','User','findAndCountAll','agent','chatPause','updatedAt','format','SIP','createdAt','getTeams','findOne','pick','addTeams','ids','Team','Agents','voicePause','interface','flatMap','sequelize','findOrCreate','forEach','emit','removeTeams','field','tq.TeamId','from','team_has_chat_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','push','toString','SELECT','every','includes','all','union','compact','value','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','userChatQueue:save','isArray','getAgents','util','lodash','squel'];(function(_0xa0cb20,_0x1c18ef){var _0x2cc906=function(_0x4db98b){while(--_0x4db98b){_0xa0cb20['push'](_0xa0cb20['shift']());}};_0x2cc906(++_0x1c18ef);}(_0x2f4a,0x75));var _0xa2f4=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x2f4a[_0x513aa5];return _0x1a1a7c;};'use strict';var BPromise=require('bluebird');var util=require(_0xa2f4('0x0'));var _=require(_0xa2f4('0x1'));var squel=require(_0xa2f4('0x2'));var Redis=require('ioredis');var qs=require(_0xa2f4('0x3'));var logger=require(_0xa2f4('0x4'))(_0xa2f4('0x5'));var config=require(_0xa2f4('0x6'));var db=require(_0xa2f4('0x7'))['db'];config[_0xa2f4('0x8')]=_[_0xa2f4('0x9')](config['redis'],{'host':_0xa2f4('0xa'),'port':0x18eb});var socket=require(_0xa2f4('0xb'))(new Redis(config[_0xa2f4('0x8')]));require('./chatQueue.socket')[_0xa2f4('0xc')](socket);function respondWithStatusCode(_0x3d76cb,_0x210083){_0x210083=_0x210083||0xcc;return function(_0x596cb1){if(_0x596cb1){return _0x3d76cb[_0xa2f4('0xd')](_0x210083);}return _0x3d76cb[_0xa2f4('0xe')](_0x210083)[_0xa2f4('0xf')]();};}function respondWithResult(_0x58f4fd,_0x277fc0){_0x277fc0=_0x277fc0||0xc8;return function(_0x210e3a){if(_0x210e3a){return _0x58f4fd[_0xa2f4('0xe')](_0x277fc0)[_0xa2f4('0x10')](_0x210e3a);}};}function respondWithFilteredResult(_0x386050,_0x39b47a){return function(_0x55e812){if(_0x55e812){var _0x15b2b9=typeof _0x39b47a['offset']==='undefined'&&typeof _0x39b47a[_0xa2f4('0x11')]===_0xa2f4('0x12');var _0x12c0ca=_0x55e812[_0xa2f4('0x13')];var _0x9e8adc=_0x15b2b9?0x0:_0x39b47a[_0xa2f4('0x14')];var _0x2eaa36=_0x15b2b9?_0x55e812['count']:_0x39b47a[_0xa2f4('0x14')]+_0x39b47a[_0xa2f4('0x11')];var _0x11b64c;if(_0x2eaa36>=_0x12c0ca){_0x2eaa36=_0x12c0ca;_0x11b64c=0xc8;}else{_0x11b64c=0xce;}_0x386050['status'](_0x11b64c);return _0x386050['set'](_0xa2f4('0x15'),_0x9e8adc+'-'+_0x2eaa36+'/'+_0x12c0ca)[_0xa2f4('0x10')](_0x55e812);}return null;};}function saveUpdates(_0x13ee36){return function(_0xc305ed){if(_0xc305ed){return _0xc305ed[_0xa2f4('0x16')](_0x13ee36)[_0xa2f4('0x17')](function(_0x36bd06){return _0x36bd06;});}return null;};}function removeEntity(_0x1892fc){return function(_0x35cba5){if(_0x35cba5){return _0x35cba5[_0xa2f4('0x18')]()[_0xa2f4('0x17')](function(){var _0x554f6b=_0x35cba5[_0xa2f4('0x19')]({'plain':!![]});var _0x1d1ee2=_0xa2f4('0x1a');return db[_0xa2f4('0x1b')][_0xa2f4('0x18')]({'where':{'type':_0x1d1ee2,'resourceId':_0x554f6b['id']}})[_0xa2f4('0x17')](function(){return _0x35cba5;});})[_0xa2f4('0x17')](function(){_0x1892fc['status'](0xcc)[_0xa2f4('0xf')]();});}};}function handleEntityNotFound(_0x937460){return function(_0x435f71){if(!_0x435f71){_0x937460['sendStatus'](0x194);}return _0x435f71;};}function handleError(_0x44e0f4,_0x362b76){_0x362b76=_0x362b76||0x1f4;return function(_0x4ce83f){logger[_0xa2f4('0x1c')](_0x4ce83f['stack']);if(_0x4ce83f[_0xa2f4('0x1d')]){delete _0x4ce83f[_0xa2f4('0x1d')];}_0x44e0f4[_0xa2f4('0xe')](_0x362b76)[_0xa2f4('0x1e')](_0x4ce83f);};}exports[_0xa2f4('0x1f')]=function(_0x535add,_0x8d7e33){var _0x583258={};var _0x2293b7={'count':0x0,'rows':[]};var _0x56f4b2=_[_0xa2f4('0x20')](db['ChatQueue'][_0xa2f4('0x21')],function(_0x262c45){return{'name':_0x262c45[_0xa2f4('0x22')],'type':_0x262c45[_0xa2f4('0x23')][_0xa2f4('0x24')]};});_0x583258=qs[_0xa2f4('0x25')](_0x56f4b2,_0x535add);var _0x5da497={'where':_0x583258[_0xa2f4('0x26')]};return db[_0xa2f4('0x27')][_0xa2f4('0x13')](_0x5da497)[_0xa2f4('0x17')](function(_0x204fcd){_0x2293b7['count']=_0x204fcd;_0x583258['include']=qs[_0xa2f4('0x28')](_0x535add[_0xa2f4('0x29')]);return db[_0xa2f4('0x27')][_0xa2f4('0x2a')](_0x583258);})[_0xa2f4('0x17')](function(_0x27a4e8){_0x2293b7[_0xa2f4('0x2b')]=_0x27a4e8;return _0x2293b7;})['then'](respondWithFilteredResult(_0x8d7e33,_0x583258))[_0xa2f4('0x2c')](handleError(_0x8d7e33,null));};exports[_0xa2f4('0x2d')]=function(_0x148e03,_0xcdbed7){var _0x414f8a={'raw':!![],'where':{'id':_0x148e03[_0xa2f4('0x2e')]['id']}},_0x3c7b5e={};_0x3c7b5e[_0xa2f4('0x2f')]=_['keys'](db[_0xa2f4('0x27')]['rawAttributes']);_0x3c7b5e[_0xa2f4('0x29')]=_['keys'](_0x148e03['query']);_0x3c7b5e['filters']=_[_0xa2f4('0x30')](_0x3c7b5e[_0xa2f4('0x2f')],_0x3c7b5e['query']);_0x414f8a[_0xa2f4('0x31')]=_[_0xa2f4('0x30')](_0x3c7b5e[_0xa2f4('0x2f')],qs['fields'](_0x148e03[_0xa2f4('0x29')][_0xa2f4('0x32')]));_0x414f8a[_0xa2f4('0x31')]=_0x414f8a[_0xa2f4('0x31')][_0xa2f4('0x33')]?_0x414f8a[_0xa2f4('0x31')]:_0x3c7b5e[_0xa2f4('0x2f')];if(_0x148e03['query'][_0xa2f4('0x34')]){_0x414f8a[_0xa2f4('0x28')]=[{'all':!![]}];}_0x414f8a=_['merge']({},_0x414f8a,_0x148e03[_0xa2f4('0x35')]);return db[_0xa2f4('0x27')][_0xa2f4('0x36')](_0x414f8a)[_0xa2f4('0x17')](handleEntityNotFound(_0xcdbed7,null))['then'](respondWithResult(_0xcdbed7,null))[_0xa2f4('0x2c')](handleError(_0xcdbed7,null));};exports[_0xa2f4('0x37')]=function(_0x5025e1,_0x5d00e4){return db['ChatQueue']['create'](_0x5025e1[_0xa2f4('0x38')],{})['then'](function(_0xcd8457){var _0x4f6170=_0x5025e1[_0xa2f4('0x39')][_0xa2f4('0x19')]({'plain':!![]});if(!_0x4f6170)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4f6170[_0xa2f4('0x3a')]===_0xa2f4('0x39')){var _0x2b838c=_0xcd8457['get']({'plain':!![]});var _0x57e76b='ChatQueues';return db['UserProfileSection'][_0xa2f4('0x36')]({'where':{'name':_0x57e76b,'userProfileId':_0x4f6170[_0xa2f4('0x3b')]},'raw':!![]})[_0xa2f4('0x17')](function(_0x27f4d9){if(_0x27f4d9&&_0x27f4d9[_0xa2f4('0x3c')]===0x0){return db[_0xa2f4('0x1b')]['create']({'name':_0x2b838c['name'],'resourceId':_0x2b838c['id'],'type':_0x27f4d9['name'],'sectionId':_0x27f4d9['id']},{})['then'](function(){return _0xcd8457;});}else{return _0xcd8457;}})['catch'](function(_0x16b52f){logger['error'](_0xa2f4('0x3d'),_0x16b52f);throw _0x16b52f;});}return _0xcd8457;})[_0xa2f4('0x17')](respondWithResult(_0x5d00e4,0xc9))[_0xa2f4('0x2c')](handleError(_0x5d00e4,null));};exports[_0xa2f4('0x16')]=function(_0x203044,_0x519ac0){if(_0x203044['body']['id']){delete _0x203044[_0xa2f4('0x38')]['id'];}return db[_0xa2f4('0x27')]['find']({'where':{'id':_0x203044['params']['id']}})[_0xa2f4('0x17')](handleEntityNotFound(_0x519ac0,null))['then'](saveUpdates(_0x203044[_0xa2f4('0x38')],null))[_0xa2f4('0x17')](respondWithResult(_0x519ac0,null))[_0xa2f4('0x2c')](handleError(_0x519ac0,null));};exports['destroy']=function(_0xdcb383,_0x7b6fd5){return db[_0xa2f4('0x27')]['find']({'where':{'id':_0xdcb383[_0xa2f4('0x2e')]['id']}})[_0xa2f4('0x17')](handleEntityNotFound(_0x7b6fd5,null))['then'](removeEntity(_0x7b6fd5,null))[_0xa2f4('0x2c')](handleError(_0x7b6fd5,null));};exports['describe']=function(_0x140c86,_0x414575){return db[_0xa2f4('0x27')][_0xa2f4('0x3e')]()['then'](respondWithResult(_0x414575,null))[_0xa2f4('0x2c')](handleError(_0x414575,null));};exports[_0xa2f4('0x3f')]=function(_0xafcd9b,_0x31aa38){var _0x1267f7={'raw':!![],'where':{}},_0x23cae8={},_0xd77187;return db[_0xa2f4('0x27')]['findOne']({'where':{'id':_0xafcd9b['params']['id']}})['then'](handleEntityNotFound(_0x31aa38,null))[_0xa2f4('0x17')](function(_0x2fb8f1){if(_0x2fb8f1){_0xd77187=_0x2fb8f1[_0xa2f4('0x19')]({'plain':!![]});_0x23cae8['model']=_[_0xa2f4('0x40')](db['UserChatQueue'][_0xa2f4('0x21')]);_0x23cae8[_0xa2f4('0x29')]=_['keys'](_0xafcd9b['query']);_0x23cae8[_0xa2f4('0x41')]=_[_0xa2f4('0x30')](_0x23cae8[_0xa2f4('0x2f')],_0x23cae8[_0xa2f4('0x29')]);_0x1267f7[_0xa2f4('0x31')]=_['intersection'](_0x23cae8[_0xa2f4('0x2f')],qs[_0xa2f4('0x32')](_0xafcd9b['query'][_0xa2f4('0x32')]));_0x1267f7['attributes']=_0x1267f7['attributes'][_0xa2f4('0x33')]?_0x1267f7[_0xa2f4('0x31')]:_0x23cae8[_0xa2f4('0x2f')];if(!_0xafcd9b[_0xa2f4('0x29')][_0xa2f4('0x42')](_0xa2f4('0x43'))){_0x1267f7[_0xa2f4('0x11')]=qs['limit'](_0xafcd9b[_0xa2f4('0x29')][_0xa2f4('0x11')]);_0x1267f7[_0xa2f4('0x14')]=qs[_0xa2f4('0x14')](_0xafcd9b[_0xa2f4('0x29')][_0xa2f4('0x14')]);}_0x1267f7[_0xa2f4('0x44')]=qs[_0xa2f4('0x45')](_0xafcd9b['query'][_0xa2f4('0x45')]);_0x1267f7['where']=qs[_0xa2f4('0x41')](_['pick'](_0xafcd9b['query'],_0x23cae8[_0xa2f4('0x41')]));_0x1267f7[_0xa2f4('0x26')][_0xa2f4('0x46')]=_0x2fb8f1['id'];if(_0xafcd9b[_0xa2f4('0x29')][_0xa2f4('0x47')]){_0x1267f7[_0xa2f4('0x26')]=_[_0xa2f4('0x48')](_0x1267f7[_0xa2f4('0x26')],{'$or':_[_0xa2f4('0x20')](_0x1267f7['attributes'],function(_0x54286b){var _0x1a04e1={};_0x1a04e1[_0x54286b]={'$like':'%'+_0xafcd9b[_0xa2f4('0x29')]['filter']+'%'};return _0x1a04e1;})});}_0x1267f7=_[_0xa2f4('0x48')]({},_0x1267f7,_0xafcd9b['options']);return db[_0xa2f4('0x49')][_0xa2f4('0x2a')](_0x1267f7);}})[_0xa2f4('0x17')](function(_0x5095fe){if(_0x5095fe){return db[_0xa2f4('0x4a')][_0xa2f4('0x4b')]({'where':{'id':_['map'](_0x5095fe,'UserId'),'role':_0xa2f4('0x4c')},'attributes':['id',_0xa2f4('0x1d'),_0xa2f4('0x4d'),_0xa2f4('0x4e'),'createdAt']});}})[_0xa2f4('0x17')](function(_0x2f8255){if(_0x2f8255){return{'count':_0x2f8255[_0xa2f4('0x13')],'rows':_[_0xa2f4('0x20')](_0x2f8255[_0xa2f4('0x2b')],function(_0x599044){return{'membername':_0x599044[_0xa2f4('0x1d')],'UserId':_0x599044['id'],'queue_name':_0xd77187['name'],'ChatQueueId':_0xd77187['id'],'interface':util[_0xa2f4('0x4f')]('%s/%s',_0xa2f4('0x50'),_0x599044[_0xa2f4('0x1d')]),'penalty':0x0,'paused':_0x599044['chatPause'],'createdAt':_0x599044[_0xa2f4('0x51')],'updatedAt':_0x599044[_0xa2f4('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x31aa38,_0x1267f7))[_0xa2f4('0x2c')](handleError(_0x31aa38,null));};exports[_0xa2f4('0x52')]=function(_0x5aa3e0,_0x145ec0){var _0x297fa8={};var _0x27b71a={};var _0x19cdb5;var _0x4e97f0;return db[_0xa2f4('0x27')][_0xa2f4('0x53')]({'where':{'id':_0x5aa3e0[_0xa2f4('0x2e')]['id']}})['then'](handleEntityNotFound(_0x145ec0,null))[_0xa2f4('0x17')](function(_0x144fb4){if(_0x144fb4){_0x19cdb5=_0x144fb4;_0x27b71a['model']=_['keys'](db['Team'][_0xa2f4('0x21')]);_0x27b71a[_0xa2f4('0x29')]=_['keys'](_0x5aa3e0[_0xa2f4('0x29')]);_0x27b71a[_0xa2f4('0x41')]=_[_0xa2f4('0x30')](_0x27b71a[_0xa2f4('0x2f')],_0x27b71a[_0xa2f4('0x29')]);_0x297fa8[_0xa2f4('0x31')]=_[_0xa2f4('0x30')](_0x27b71a[_0xa2f4('0x2f')],qs[_0xa2f4('0x32')](_0x5aa3e0['query']['fields']));_0x297fa8[_0xa2f4('0x31')]=_0x297fa8[_0xa2f4('0x31')][_0xa2f4('0x33')]?_0x297fa8[_0xa2f4('0x31')]:_0x27b71a[_0xa2f4('0x2f')];_0x297fa8[_0xa2f4('0x44')]=qs[_0xa2f4('0x45')](_0x5aa3e0['query'][_0xa2f4('0x45')]);_0x297fa8['where']=qs['filters'](_[_0xa2f4('0x54')](_0x5aa3e0[_0xa2f4('0x29')],_0x27b71a['filters']));if(_0x5aa3e0[_0xa2f4('0x29')][_0xa2f4('0x47')]){_0x297fa8['where']=_[_0xa2f4('0x48')](_0x297fa8['where'],{'$or':_['map'](_0x297fa8[_0xa2f4('0x31')],function(_0x4dc930){var _0x4dcce2={};_0x4dcce2[_0x4dc930]={'$like':'%'+_0x5aa3e0[_0xa2f4('0x29')][_0xa2f4('0x47')]+'%'};return _0x4dcce2;})});}_0x297fa8=_[_0xa2f4('0x48')]({},_0x297fa8,_0x5aa3e0[_0xa2f4('0x35')]);return _0x19cdb5[_0xa2f4('0x52')](_0x297fa8);}})[_0xa2f4('0x17')](function(_0x5b23ec){if(_0x5b23ec){_0x4e97f0=_0x5b23ec[_0xa2f4('0x33')];if(!_0x5aa3e0[_0xa2f4('0x29')][_0xa2f4('0x42')](_0xa2f4('0x43'))){_0x297fa8[_0xa2f4('0x11')]=qs['limit'](_0x5aa3e0[_0xa2f4('0x29')][_0xa2f4('0x11')]);_0x297fa8[_0xa2f4('0x14')]=qs[_0xa2f4('0x14')](_0x5aa3e0['query']['offset']);}return _0x19cdb5[_0xa2f4('0x52')](_0x297fa8);}})['then'](function(_0x523d62){if(_0x523d62){return _0x523d62?{'count':_0x4e97f0,'rows':_0x523d62}:null;}})['then'](respondWithResult(_0x145ec0,null))[_0xa2f4('0x2c')](handleError(_0x145ec0,null));};exports[_0xa2f4('0x55')]=function(_0x208a5b,_0x1c37c0){var _0x306e75=_0x208a5b['body'][_0xa2f4('0x56')];return db[_0xa2f4('0x57')][_0xa2f4('0x2a')]({'where':{'id':_0x306e75},'attributes':['id'],'include':[{'model':db[_0xa2f4('0x4a')],'as':_0xa2f4('0x58'),'attributes':['id',_0xa2f4('0x1d'),'online',_0xa2f4('0x59'),_0xa2f4('0x5a')],'raw':!![]}]})[_0xa2f4('0x17')](function(_0x5ee101){if(_0x5ee101){var _0x4222fb=_[_0xa2f4('0x5b')](_0x5ee101,function(_0x229aee){var _0x5b9999=_0x229aee[_0xa2f4('0x19')]({'plain':!![]});return _0x5b9999[_0xa2f4('0x58')];});return db['ChatQueue'][_0xa2f4('0x36')]({'where':{'id':_0x208a5b[_0xa2f4('0x2e')]['id']}})[_0xa2f4('0x17')](function(_0x57cb53){return db[_0xa2f4('0x5c')]['transaction'](function(_0x2b5106){return _0x57cb53[_0xa2f4('0x55')](_0x306e75,{'transaction':_0x2b5106})['then'](function(){return BPromise['each'](_0x4222fb,function(_0x1c4ac7){return db['UserChatQueue'][_0xa2f4('0x5d')]({'where':{'UserId':_0x1c4ac7['id'],'ChatQueueId':_0x208a5b[_0xa2f4('0x2e')]['id']},'transaction':_0x2b5106});});})[_0xa2f4('0x17')](function(){_0x4222fb[_0xa2f4('0x5e')](function(_0x58d784){socket[_0xa2f4('0x5f')]('userChatQueue:save',{'UserId':_0x58d784['id'],'ChatQueueId':_0x57cb53['id']});});});});});}})[_0xa2f4('0x17')](respondWithStatusCode(_0x1c37c0,null))[_0xa2f4('0x2c')](handleError(_0x1c37c0,null));};exports[_0xa2f4('0x60')]=function(_0x57494d,_0x2f913c){return db[_0xa2f4('0x57')][_0xa2f4('0x2a')]({'where':{'id':_0x57494d['query'][_0xa2f4('0x56')]},'attributes':['id'],'include':[{'model':db[_0xa2f4('0x4a')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xa2f4('0x17')](handleEntityNotFound(_0x2f913c,null))[_0xa2f4('0x17')](function(_0x26f5ec){var _0x1c6d5f=_[_0xa2f4('0x20')](_0x26f5ec,'id');var _0x47181e=[];var _0x210f99=[];var _0x193f11=squel['select']();_0x193f11[_0xa2f4('0x61')](_0xa2f4('0x62'))[_0xa2f4('0x63')](_0xa2f4('0x64'),'tq')['join'](_0xa2f4('0x65'),'ut',_0xa2f4('0x66'))[_0xa2f4('0x26')]('ChatQueueId\x20=\x20?',_0x57494d[_0xa2f4('0x2e')]['id']);for(var _0x539d28=0x0;_0x539d28<_0x26f5ec[_0xa2f4('0x33')];_0x539d28+=0x1){let _0x266b29=_0x26f5ec[_0x539d28];for(var _0x221db3=0x0;_0x221db3<_0x266b29['Agents'][_0xa2f4('0x33')];_0x221db3+=0x1){let _0x1772a1=_0x266b29['Agents'][_0x221db3];var _0x30e899=_0x193f11['clone']();_0x30e899[_0xa2f4('0x26')]('ut.UserId\x20=\x20?',_0x1772a1['id']);_0x210f99[_0xa2f4('0x67')](db['sequelize'][_0xa2f4('0x29')](_0x30e899[_0xa2f4('0x68')](),{'type':db[_0xa2f4('0x5c')]['QueryTypes'][_0xa2f4('0x69')]})[_0xa2f4('0x17')](function(_0x450ae5){if(_0x450ae5[_0xa2f4('0x33')]===0x1){return _0x1772a1['id'];}else{var _0x17b26f=_[_0xa2f4('0x6a')](_['map'](_0x450ae5,'TeamId'),function(_0x3ad792){return _[_0xa2f4('0x6b')](_0x1c6d5f,_0x3ad792);});if(_0x17b26f){return _0x1772a1['id'];}}}));}}return BPromise[_0xa2f4('0x6c')](_0x210f99)[_0xa2f4('0x17')](function(_0x5d0b69){_0x47181e=_(_0x47181e)[_0xa2f4('0x6d')](_0x5d0b69)[_0xa2f4('0x6e')]()[_0xa2f4('0x6f')]();return db['ChatQueue']['find']({'where':{'id':_0x57494d['params']['id']}})[_0xa2f4('0x17')](function(_0x40ef2b){return db[_0xa2f4('0x5c')]['transaction'](function(_0x41aec5){return _0x40ef2b[_0xa2f4('0x60')](_0x57494d[_0xa2f4('0x29')][_0xa2f4('0x56')],{'transaction':_0x41aec5})['then'](function(){if(!_[_0xa2f4('0x70')](_0x47181e)){return _0x40ef2b[_0xa2f4('0x71')](_0x47181e,{'transaction':_0x41aec5});}})[_0xa2f4('0x17')](function(){_0x47181e['forEach'](function(_0x3cb1e2){socket[_0xa2f4('0x5f')](_0xa2f4('0x72'),{'UserId':_0x3cb1e2,'ChatQueueId':_0x40ef2b['id']});});});});});});})[_0xa2f4('0x17')](respondWithStatusCode(_0x2f913c,null))['catch'](handleError(_0x2f913c,null));};exports[_0xa2f4('0x73')]=function(_0x5c42c6,_0x3ffa7a){return db['ChatQueue']['find']({'where':{'id':_0x5c42c6['params']['id']}})[_0xa2f4('0x17')](handleEntityNotFound(_0x3ffa7a,null))['then'](function(_0x259f14){if(_0x259f14){return _0x259f14['addAgents'](_0x5c42c6[_0xa2f4('0x38')][_0xa2f4('0x56')],_[_0xa2f4('0x74')](_0x5c42c6[_0xa2f4('0x38')],['ids','id'])||{})['spread'](function(_0x1727fe){for(var _0x417142=0x0;_0x417142<_0x5c42c6[_0xa2f4('0x38')]['ids'][_0xa2f4('0x33')];_0x417142+=0x1){socket[_0xa2f4('0x5f')](_0xa2f4('0x75'),{'UserId':Number(_0x5c42c6[_0xa2f4('0x38')][_0xa2f4('0x56')][_0x417142]),'ChatQueueId':Number(_0x5c42c6['params']['id'])});}return _0x1727fe;});}})[_0xa2f4('0x17')](respondWithResult(_0x3ffa7a,null))[_0xa2f4('0x2c')](handleError(_0x3ffa7a,null));};exports['removeAgents']=function(_0x273660,_0x5b9223){return db[_0xa2f4('0x27')][_0xa2f4('0x36')]({'where':{'id':_0x273660[_0xa2f4('0x2e')]['id']}})[_0xa2f4('0x17')](handleEntityNotFound(_0x5b9223,null))[_0xa2f4('0x17')](function(_0x1e83e0){if(_0x1e83e0){return _0x1e83e0['removeAgents'](_0x273660[_0xa2f4('0x29')][_0xa2f4('0x56')])[_0xa2f4('0x17')](function(){if(_[_0xa2f4('0x76')](_0x273660[_0xa2f4('0x29')]['ids'])){for(var _0x20ba23=0x0;_0x20ba23<_0x273660[_0xa2f4('0x29')][_0xa2f4('0x56')][_0xa2f4('0x33')];_0x20ba23+=0x1){socket[_0xa2f4('0x5f')](_0xa2f4('0x72'),{'UserId':Number(_0x273660['query'][_0xa2f4('0x56')][_0x20ba23]),'ChatQueueId':Number(_0x273660[_0xa2f4('0x2e')]['id'])});}}else{socket[_0xa2f4('0x5f')](_0xa2f4('0x72'),{'UserId':Number(_0x273660[_0xa2f4('0x29')]['ids']),'ChatQueueId':Number(_0x273660[_0xa2f4('0x2e')]['id'])});}});}})[_0xa2f4('0x17')](respondWithStatusCode(_0x5b9223,null))['catch'](handleError(_0x5b9223,null));};exports[_0xa2f4('0x77')]=function(_0x2b2971,_0x5ec331){var _0x871d2b={};var _0x1829b6={};var _0x76f82d;var _0x560d73;return db['ChatQueue'][_0xa2f4('0x53')]({'where':{'id':_0x2b2971['params']['id']}})[_0xa2f4('0x17')](handleEntityNotFound(_0x5ec331,null))['then'](function(_0x845768){if(_0x845768){_0x76f82d=_0x845768;_0x1829b6['model']=_[_0xa2f4('0x40')](db[_0xa2f4('0x4a')][_0xa2f4('0x21')]);_0x1829b6[_0xa2f4('0x29')]=_['keys'](_0x2b2971[_0xa2f4('0x29')]);_0x1829b6[_0xa2f4('0x41')]=_[_0xa2f4('0x30')](_0x1829b6['model'],_0x1829b6[_0xa2f4('0x29')]);_0x871d2b[_0xa2f4('0x31')]=_[_0xa2f4('0x30')](_0x1829b6['model'],qs[_0xa2f4('0x32')](_0x2b2971['query'][_0xa2f4('0x32')]));_0x871d2b['attributes']=_0x871d2b[_0xa2f4('0x31')]['length']?_0x871d2b['attributes']:_0x1829b6[_0xa2f4('0x2f')];_0x871d2b['order']=qs['sort'](_0x2b2971['query'][_0xa2f4('0x45')]);_0x871d2b[_0xa2f4('0x26')]=qs['filters'](_[_0xa2f4('0x54')](_0x2b2971[_0xa2f4('0x29')],_0x1829b6[_0xa2f4('0x41')]));if(_0x2b2971[_0xa2f4('0x29')][_0xa2f4('0x47')]){_0x871d2b[_0xa2f4('0x26')]=_['merge'](_0x871d2b[_0xa2f4('0x26')],{'$or':_[_0xa2f4('0x20')](_0x871d2b[_0xa2f4('0x31')],function(_0x4eb1c6){var _0x2b598d={};_0x2b598d[_0x4eb1c6]={'$like':'%'+_0x2b2971[_0xa2f4('0x29')][_0xa2f4('0x47')]+'%'};return _0x2b598d;})});}_0x871d2b=_[_0xa2f4('0x48')]({},_0x871d2b,_0x2b2971[_0xa2f4('0x35')]);return _0x76f82d['getAgents'](_0x871d2b);}})['then'](function(_0x528e8a){if(_0x528e8a){_0x560d73=_0x528e8a['length'];if(!_0x2b2971[_0xa2f4('0x29')][_0xa2f4('0x42')](_0xa2f4('0x43'))){_0x871d2b[_0xa2f4('0x11')]=qs[_0xa2f4('0x11')](_0x2b2971[_0xa2f4('0x29')]['limit']);_0x871d2b[_0xa2f4('0x14')]=qs['offset'](_0x2b2971[_0xa2f4('0x29')]['offset']);}return _0x76f82d['getAgents'](_0x871d2b);}})['then'](function(_0x353945){if(_0x353945){return _0x353945?{'count':_0x560d73,'rows':_0x353945}:null;}})[_0xa2f4('0x17')](respondWithResult(_0x5ec331,null))[_0xa2f4('0x2c')](handleError(_0x5ec331,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 215c031..6c9c2bd 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 _0xd056=['hook','exports','../../mysqldb','ChatQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x5ac257,_0x5b60ad){var _0x4e0118=function(_0x31a28e){while(--_0x31a28e){_0x5ac257['push'](_0x5ac257['shift']());}};_0x4e0118(++_0x5b60ad);}(_0xd056,0x142));var _0x6d05=function(_0x138a70,_0x50cb30){_0x138a70=_0x138a70-0x0;var _0x505885=_0xd056[_0x138a70];return _0x505885;};'use strict';var EventEmitter=require('events');var ChatQueue=require(_0x6d05('0x0'))['db'][_0x6d05('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x6d05('0x2')](0x0);var events={'afterCreate':_0x6d05('0x3'),'afterUpdate':_0x6d05('0x4'),'afterDestroy':_0x6d05('0x5')};function emitEvent(_0x463830){return function(_0x55a338,_0x439ee9,_0x1367e9){ChatQueueEvents[_0x6d05('0x6')](_0x463830+':'+_0x55a338['id'],_0x55a338);ChatQueueEvents[_0x6d05('0x6')](_0x463830,_0x55a338);_0x1367e9(null);};}for(var e in events){if(events[_0x6d05('0x7')](e)){var event=events[e];ChatQueue[_0x6d05('0x8')](e,emitEvent(event));}}module[_0x6d05('0x9')]=ChatQueueEvents; \ No newline at end of file +var _0x9959=['hasOwnProperty','hook','events','ChatQueue','save','remove','emit'];(function(_0x49d744,_0x56323a){var _0xeef931=function(_0x30c8bc){while(--_0x30c8bc){_0x49d744['push'](_0x49d744['shift']());}};_0xeef931(++_0x56323a);}(_0x9959,0x1c2));var _0x9995=function(_0x423aa2,_0x2f3be3){_0x423aa2=_0x423aa2-0x0;var _0x4953fa=_0x9959[_0x423aa2];return _0x4953fa;};'use strict';var EventEmitter=require(_0x9995('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0x9995('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9995('0x2'),'afterUpdate':'update','afterDestroy':_0x9995('0x3')};function emitEvent(_0x34fadd){return function(_0x4aeb64,_0x20e0f7,_0x486730){ChatQueueEvents[_0x9995('0x4')](_0x34fadd+':'+_0x4aeb64['id'],_0x4aeb64);ChatQueueEvents[_0x9995('0x4')](_0x34fadd,_0x4aeb64);_0x486730(null);};}for(var e in events){if(events[_0x9995('0x5')](e)){var event=events[e];ChatQueue[_0x9995('0x6')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index d5fadc9..ff9362a 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 _0xa733=['bluebird','request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa733,0x9a));var _0x3a73=function(_0x2b2375,_0x31530b){_0x2b2375=_0x2b2375-0x0;var _0x258f3a=_0xa733[_0x2b2375];return _0x258f3a;};'use strict';var _=require('lodash');var util=require(_0x3a73('0x0'));var logger=require(_0x3a73('0x1'))('api');var moment=require('moment');var BPromise=require(_0x3a73('0x2'));var rp=require(_0x3a73('0x3'));var fs=require('fs');var path=require(_0x3a73('0x4'));var rimraf=require(_0x3a73('0x5'));var config=require(_0x3a73('0x6'));var attributes=require(_0x3a73('0x7'));module[_0x3a73('0x8')]=function(_0x223cdc,_0x113dbe){return _0x223cdc[_0x3a73('0x9')](_0x3a73('0xa'),attributes,{'tableName':_0x3a73('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3a21=['path','rimraf','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x24c7f7,_0x2bb77a){var _0x25604f=function(_0x418d16){while(--_0x418d16){_0x24c7f7['push'](_0x24c7f7['shift']());}};_0x25604f(++_0x2bb77a);}(_0x3a21,0x112));var _0x13a2=function(_0x2dd514,_0x4dc961){_0x2dd514=_0x2dd514-0x0;var _0x185a5f=_0x3a21[_0x2dd514];return _0x185a5f;};'use strict';var _=require(_0x13a2('0x0'));var util=require('util');var logger=require(_0x13a2('0x1'))(_0x13a2('0x2'));var moment=require(_0x13a2('0x3'));var BPromise=require(_0x13a2('0x4'));var rp=require(_0x13a2('0x5'));var fs=require('fs');var path=require(_0x13a2('0x6'));var rimraf=require(_0x13a2('0x7'));var config=require(_0x13a2('0x8'));var attributes=require(_0x13a2('0x9'));module[_0x13a2('0xa')]=function(_0x4a5d9a,_0x2d4def){return _0x4a5d9a[_0x13a2('0xb')](_0x13a2('0xc'),attributes,{'tableName':_0x13a2('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index b51a14c..23b07c5 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 _0xb875=['localhost','socket.io-emitter','./chatQueue.socket','then','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetChatQueue','ChatQueue','options','raw','where','attributes','limit','map','include','model','catch','ShowChatQueue','lodash','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x48766b,_0x3fe640){var _0x1e5b04=function(_0x52205e){while(--_0x52205e){_0x48766b['push'](_0x48766b['shift']());}};_0x1e5b04(++_0x3fe640);}(_0xb875,0x167));var _0x5b87=function(_0x3a7cae,_0xfa58d){_0x3a7cae=_0x3a7cae-0x0;var _0x3a0869=_0xb875[_0x3a7cae];return _0x3a0869;};'use strict';var _=require(_0x5b87('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5b87('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5b87('0x2'))['db'];var utils=require(_0x5b87('0x3'));var logger=require('../../config/logger')(_0x5b87('0x4'));var config=require(_0x5b87('0x5'));var jayson=require(_0x5b87('0x6'));var client=jayson[_0x5b87('0x7')][_0x5b87('0x8')]({'port':0x232a});config[_0x5b87('0x9')]=_[_0x5b87('0xa')](config[_0x5b87('0x9')],{'host':_0x5b87('0xb'),'port':0x18eb});var socket=require(_0x5b87('0xc'))(new Redis(config['redis']));require(_0x5b87('0xd'))['register'](socket);function respondWithRpcPromise(_0x32d5fc,_0x394cd2,_0x131314){return new BPromise(function(_0x22af59,_0x508c10){return client['request'](_0x32d5fc,_0x131314)[_0x5b87('0xe')](function(_0x42af88){logger['info'](_0x5b87('0xf'),_0x394cd2,_0x5b87('0x10'));logger[_0x5b87('0x11')](_0x5b87('0x12'),_0x394cd2,_0x5b87('0x10'),JSON[_0x5b87('0x13')](_0x42af88));if(_0x42af88[_0x5b87('0x14')]){if(_0x42af88[_0x5b87('0x14')][_0x5b87('0x15')]===0x1f4){logger['error'](_0x5b87('0xf'),_0x394cd2,_0x42af88['error'][_0x5b87('0x16')]);return _0x508c10(_0x42af88[_0x5b87('0x14')]['message']);}logger['error'](_0x5b87('0xf'),_0x394cd2,_0x42af88['error'][_0x5b87('0x16')]);return _0x22af59(_0x42af88[_0x5b87('0x14')][_0x5b87('0x16')]);}else{logger[_0x5b87('0x17')](_0x5b87('0xf'),_0x394cd2,_0x5b87('0x10'));_0x22af59(_0x42af88[_0x5b87('0x18')]['message']);}})['catch'](function(_0x4d9b3b){logger['error'](_0x5b87('0xf'),_0x394cd2,_0x4d9b3b);_0x508c10(_0x4d9b3b);});});}exports[_0x5b87('0x19')]=function(_0x382157){var _0x1b46cc=this;return new Promise(function(_0x17c6be,_0x5491ec){return db[_0x5b87('0x1a')]['findAll']({'raw':_0x382157['options']?_0x382157[_0x5b87('0x1b')][_0x5b87('0x1c')]===undefined?!![]:![]:!![],'where':_0x382157['options']?_0x382157[_0x5b87('0x1b')][_0x5b87('0x1d')]||null:null,'attributes':_0x382157[_0x5b87('0x1b')]?_0x382157[_0x5b87('0x1b')][_0x5b87('0x1e')]||null:null,'limit':_0x382157[_0x5b87('0x1b')]?_0x382157[_0x5b87('0x1b')][_0x5b87('0x1f')]||null:null,'include':_0x382157[_0x5b87('0x1b')]?_0x382157[_0x5b87('0x1b')]['include']?_[_0x5b87('0x20')](_0x382157[_0x5b87('0x1b')][_0x5b87('0x21')],function(_0x19d2d4){return{'model':db[_0x19d2d4[_0x5b87('0x22')]],'as':_0x19d2d4['as'],'attributes':_0x19d2d4[_0x5b87('0x1e')],'include':_0x19d2d4[_0x5b87('0x21')]?_[_0x5b87('0x20')](_0x19d2d4[_0x5b87('0x21')],function(_0x1b01f1){return{'model':db[_0x1b01f1[_0x5b87('0x22')]],'as':_0x1b01f1['as'],'attributes':_0x1b01f1['attributes'],'include':_0x1b01f1['include']?_[_0x5b87('0x20')](_0x1b01f1['include'],function(_0x706a59){return{'model':db[_0x706a59[_0x5b87('0x22')]],'as':_0x706a59['as'],'attributes':_0x706a59['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x43c0a0){logger[_0x5b87('0x17')](_0x5b87('0x19'),_0x382157);logger[_0x5b87('0x11')](_0x5b87('0x19'),_0x382157,JSON['stringify'](_0x43c0a0));_0x17c6be(_0x43c0a0);})[_0x5b87('0x23')](function(_0x3d41ad){logger['error'](_0x5b87('0x19'),_0x3d41ad['message'],_0x382157);_0x5491ec(_0x1b46cc[_0x5b87('0x14')](0x1f4,_0x3d41ad[_0x5b87('0x16')]));});});};exports[_0x5b87('0x24')]=function(_0x4f1ea5){var _0x22d559=this;return new Promise(function(_0x17e3e3,_0x218752){return db[_0x5b87('0x1a')]['find']({'raw':_0x4f1ea5['options']?_0x4f1ea5['options'][_0x5b87('0x1c')]===undefined?!![]:![]:!![],'where':_0x4f1ea5['options']?_0x4f1ea5[_0x5b87('0x1b')]['where']||null:null,'attributes':_0x4f1ea5[_0x5b87('0x1b')]?_0x4f1ea5[_0x5b87('0x1b')]['attributes']||null:null,'include':_0x4f1ea5[_0x5b87('0x1b')]?_0x4f1ea5[_0x5b87('0x1b')][_0x5b87('0x21')]?_[_0x5b87('0x20')](_0x4f1ea5['options'][_0x5b87('0x21')],function(_0xfb83bf){return{'model':db[_0xfb83bf[_0x5b87('0x22')]],'as':_0xfb83bf['as'],'attributes':_0xfb83bf[_0x5b87('0x1e')],'include':_0xfb83bf[_0x5b87('0x21')]?_[_0x5b87('0x20')](_0xfb83bf[_0x5b87('0x21')],function(_0x3afa0d){return{'model':db[_0x3afa0d[_0x5b87('0x22')]],'as':_0x3afa0d['as'],'attributes':_0x3afa0d[_0x5b87('0x1e')],'include':_0x3afa0d[_0x5b87('0x21')]?_['map'](_0x3afa0d[_0x5b87('0x21')],function(_0x50acf8){return{'model':db[_0x50acf8[_0x5b87('0x22')]],'as':_0x50acf8['as'],'attributes':_0x50acf8[_0x5b87('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x5b87('0xe')](function(_0x4e03fd){logger[_0x5b87('0x17')](_0x5b87('0x24'),_0x4f1ea5);logger[_0x5b87('0x11')](_0x5b87('0x24'),_0x4f1ea5,JSON[_0x5b87('0x13')](_0x4e03fd));_0x17e3e3(_0x4e03fd);})[_0x5b87('0x23')](function(_0x50e944){logger[_0x5b87('0x14')](_0x5b87('0x24'),_0x50e944['message'],_0x4f1ea5);_0x218752(_0x22d559[_0x5b87('0x14')](0x1f4,_0x50e944[_0x5b87('0x16')]));});});}; \ No newline at end of file +var _0xc1bd=['options','raw','where','limit','map','include','model','attributes','ShowChatQueue','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','then','info','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetChatQueue','ChatQueue','findAll'];(function(_0x3e3f62,_0x2d53bb){var _0x1debd7=function(_0x5cc1d8){while(--_0x5cc1d8){_0x3e3f62['push'](_0x3e3f62['shift']());}};_0x1debd7(++_0x2d53bb);}(_0xc1bd,0xd2));var _0xdc1b=function(_0x24f387,_0x13d380){_0x24f387=_0x24f387-0x0;var _0x160b4c=_0xc1bd[_0x24f387];return _0x160b4c;};'use strict';var _=require('lodash');var util=require(_0xdc1b('0x0'));var moment=require(_0xdc1b('0x1'));var BPromise=require(_0xdc1b('0x2'));var rs=require(_0xdc1b('0x3'));var fs=require('fs');var Redis=require(_0xdc1b('0x4'));var db=require(_0xdc1b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdc1b('0x6'))(_0xdc1b('0x7'));var config=require('../../config/environment');var jayson=require(_0xdc1b('0x8'));var client=jayson[_0xdc1b('0x9')][_0xdc1b('0xa')]({'port':0x232a});config['redis']=_[_0xdc1b('0xb')](config[_0xdc1b('0xc')],{'host':_0xdc1b('0xd'),'port':0x18eb});var socket=require(_0xdc1b('0xe'))(new Redis(config[_0xdc1b('0xc')]));require('./chatQueue.socket')[_0xdc1b('0xf')](socket);function respondWithRpcPromise(_0x371699,_0xfdd9e9,_0x3ff980){return new BPromise(function(_0x52d17c,_0x112d8b){return client['request'](_0x371699,_0x3ff980)[_0xdc1b('0x10')](function(_0x3ab1c2){logger[_0xdc1b('0x11')](_0xdc1b('0x12'),_0xfdd9e9,'request\x20sent');logger[_0xdc1b('0x13')](_0xdc1b('0x14'),_0xfdd9e9,_0xdc1b('0x15'),JSON[_0xdc1b('0x16')](_0x3ab1c2));if(_0x3ab1c2[_0xdc1b('0x17')]){if(_0x3ab1c2[_0xdc1b('0x17')]['code']===0x1f4){logger[_0xdc1b('0x17')](_0xdc1b('0x12'),_0xfdd9e9,_0x3ab1c2['error']['message']);return _0x112d8b(_0x3ab1c2[_0xdc1b('0x17')][_0xdc1b('0x18')]);}logger['error'](_0xdc1b('0x12'),_0xfdd9e9,_0x3ab1c2[_0xdc1b('0x17')][_0xdc1b('0x18')]);return _0x52d17c(_0x3ab1c2[_0xdc1b('0x17')][_0xdc1b('0x18')]);}else{logger[_0xdc1b('0x11')]('ChatQueue,\x20%s,\x20%s',_0xfdd9e9,_0xdc1b('0x15'));_0x52d17c(_0x3ab1c2[_0xdc1b('0x19')][_0xdc1b('0x18')]);}})[_0xdc1b('0x1a')](function(_0x54598c){logger[_0xdc1b('0x17')](_0xdc1b('0x12'),_0xfdd9e9,_0x54598c);_0x112d8b(_0x54598c);});});}exports[_0xdc1b('0x1b')]=function(_0x5a6c91){var _0x4d8d41=this;return new Promise(function(_0x5ad463,_0x4d71e2){return db[_0xdc1b('0x1c')][_0xdc1b('0x1d')]({'raw':_0x5a6c91[_0xdc1b('0x1e')]?_0x5a6c91['options'][_0xdc1b('0x1f')]===undefined?!![]:![]:!![],'where':_0x5a6c91[_0xdc1b('0x1e')]?_0x5a6c91['options'][_0xdc1b('0x20')]||null:null,'attributes':_0x5a6c91['options']?_0x5a6c91['options']['attributes']||null:null,'limit':_0x5a6c91[_0xdc1b('0x1e')]?_0x5a6c91[_0xdc1b('0x1e')][_0xdc1b('0x21')]||null:null,'include':_0x5a6c91[_0xdc1b('0x1e')]?_0x5a6c91[_0xdc1b('0x1e')]['include']?_[_0xdc1b('0x22')](_0x5a6c91[_0xdc1b('0x1e')][_0xdc1b('0x23')],function(_0x36ab40){return{'model':db[_0x36ab40[_0xdc1b('0x24')]],'as':_0x36ab40['as'],'attributes':_0x36ab40[_0xdc1b('0x25')],'include':_0x36ab40[_0xdc1b('0x23')]?_[_0xdc1b('0x22')](_0x36ab40['include'],function(_0x48728d){return{'model':db[_0x48728d[_0xdc1b('0x24')]],'as':_0x48728d['as'],'attributes':_0x48728d[_0xdc1b('0x25')],'include':_0x48728d[_0xdc1b('0x23')]?_[_0xdc1b('0x22')](_0x48728d[_0xdc1b('0x23')],function(_0x3163c2){return{'model':db[_0x3163c2[_0xdc1b('0x24')]],'as':_0x3163c2['as'],'attributes':_0x3163c2[_0xdc1b('0x25')]};}):[]};}):[]};}):[]:[]})[_0xdc1b('0x10')](function(_0x2e976f){logger[_0xdc1b('0x11')](_0xdc1b('0x1b'),_0x5a6c91);logger[_0xdc1b('0x13')](_0xdc1b('0x1b'),_0x5a6c91,JSON[_0xdc1b('0x16')](_0x2e976f));_0x5ad463(_0x2e976f);})[_0xdc1b('0x1a')](function(_0x4532d6){logger[_0xdc1b('0x17')]('GetChatQueue',_0x4532d6[_0xdc1b('0x18')],_0x5a6c91);_0x4d71e2(_0x4d8d41[_0xdc1b('0x17')](0x1f4,_0x4532d6[_0xdc1b('0x18')]));});});};exports[_0xdc1b('0x26')]=function(_0x21a498){var _0x22290f=this;return new Promise(function(_0x2efc3d,_0x2f6bb3){return db[_0xdc1b('0x1c')][_0xdc1b('0x27')]({'raw':_0x21a498[_0xdc1b('0x1e')]?_0x21a498[_0xdc1b('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x21a498[_0xdc1b('0x1e')]?_0x21a498[_0xdc1b('0x1e')]['where']||null:null,'attributes':_0x21a498[_0xdc1b('0x1e')]?_0x21a498[_0xdc1b('0x1e')][_0xdc1b('0x25')]||null:null,'include':_0x21a498[_0xdc1b('0x1e')]?_0x21a498['options']['include']?_[_0xdc1b('0x22')](_0x21a498[_0xdc1b('0x1e')][_0xdc1b('0x23')],function(_0x1a71af){return{'model':db[_0x1a71af['model']],'as':_0x1a71af['as'],'attributes':_0x1a71af[_0xdc1b('0x25')],'include':_0x1a71af[_0xdc1b('0x23')]?_[_0xdc1b('0x22')](_0x1a71af['include'],function(_0x10692d){return{'model':db[_0x10692d[_0xdc1b('0x24')]],'as':_0x10692d['as'],'attributes':_0x10692d[_0xdc1b('0x25')],'include':_0x10692d[_0xdc1b('0x23')]?_['map'](_0x10692d[_0xdc1b('0x23')],function(_0xe4ea08){return{'model':db[_0xe4ea08['model']],'as':_0xe4ea08['as'],'attributes':_0xe4ea08['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x575dd6){logger[_0xdc1b('0x11')]('ShowChatQueue',_0x21a498);logger[_0xdc1b('0x13')]('ShowChatQueue',_0x21a498,JSON[_0xdc1b('0x16')](_0x575dd6));_0x2efc3d(_0x575dd6);})['catch'](function(_0x29be93){logger[_0xdc1b('0x17')]('ShowChatQueue',_0x29be93[_0xdc1b('0x18')],_0x21a498);_0x2f6bb3(_0x22290f[_0xdc1b('0x17')](0x1f4,_0x29be93[_0xdc1b('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index ffd097f..a6b0729 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 _0x008c=['./chatQueue.events','save','remove','update','emit','removeListener','register','chatQueue:'];(function(_0xa6b5b9,_0x1e4e0a){var _0x2ea6d7=function(_0x52eba9){while(--_0x52eba9){_0xa6b5b9['push'](_0xa6b5b9['shift']());}};_0x2ea6d7(++_0x1e4e0a);}(_0x008c,0x188));var _0xc008=function(_0x404eff,_0x4ef653){_0x404eff=_0x404eff-0x0;var _0x46cc25=_0x008c[_0x404eff];return _0x46cc25;};'use strict';var ChatQueueEvents=require(_0xc008('0x0'));var events=[_0xc008('0x1'),_0xc008('0x2'),_0xc008('0x3')];function createListener(_0x1d119a,_0x544fdf){return function(_0x3641af){_0x544fdf[_0xc008('0x4')](_0x1d119a,_0x3641af);};}function removeListener(_0x10b33c,_0x163bd9){return function(){ChatQueueEvents[_0xc008('0x5')](_0x10b33c,_0x163bd9);};}exports[_0xc008('0x6')]=function(_0x13aa7){for(var _0x39bb5e=0x0,_0x9c8cb2=events['length'];_0x39bb5e<_0x9c8cb2;_0x39bb5e++){var _0x428fa9=events[_0x39bb5e];var _0x5aa09b=createListener(_0xc008('0x7')+_0x428fa9,_0x13aa7);ChatQueueEvents['on'](_0x428fa9,_0x5aa09b);}}; \ No newline at end of file +var _0x7a2c=['chatQueue:','./chatQueue.events','remove','update','emit','register'];(function(_0x1c1e8c,_0x51a59b){var _0x23a5df=function(_0x25bb87){while(--_0x25bb87){_0x1c1e8c['push'](_0x1c1e8c['shift']());}};_0x23a5df(++_0x51a59b);}(_0x7a2c,0x17b));var _0xc7a2=function(_0x12ddfb,_0x5e7808){_0x12ddfb=_0x12ddfb-0x0;var _0x712d01=_0x7a2c[_0x12ddfb];return _0x712d01;};'use strict';var ChatQueueEvents=require(_0xc7a2('0x0'));var events=['save',_0xc7a2('0x1'),_0xc7a2('0x2')];function createListener(_0x409ec5,_0x26fb61){return function(_0x44d702){_0x26fb61[_0xc7a2('0x3')](_0x409ec5,_0x44d702);};}function removeListener(_0x3f2b0d,_0x34cd60){return function(){ChatQueueEvents['removeListener'](_0x3f2b0d,_0x34cd60);};}exports[_0xc7a2('0x4')]=function(_0x1ddbae){for(var _0x5f334e=0x0,_0x481430=events['length'];_0x5f334e<_0x481430;_0x5f334e++){var _0x1dd150=events[_0x5f334e];var _0x3de428=createListener(_0xc7a2('0x5')+_0x1dd150,_0x1ddbae);ChatQueueEvents['on'](_0x1dd150,_0x3de428);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 8ad25ef..7c09fe2 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 _0xe14b=['/describe','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','removeAgents','exports','multer','util','express','Router','../../components/auth/service','./chatQueue.controller','get','isAuthenticated','index'];(function(_0x1ee91b,_0x2156d8){var _0x32ce3a=function(_0x520630){while(--_0x520630){_0x1ee91b['push'](_0x1ee91b['shift']());}};_0x32ce3a(++_0x2156d8);}(_0xe14b,0x93));var _0xbe14=function(_0x396531,_0x245582){_0x396531=_0x396531-0x0;var _0x1ef51a=_0xe14b[_0x396531];return _0x1ef51a;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['describe']);router['get']('/:id',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router[_0xbe14('0x6')](_0xbe14('0xb'),auth['isAuthenticated'](),controller['getMembers']);router[_0xbe14('0x6')](_0xbe14('0xc'),auth['isAuthenticated'](),controller[_0xbe14('0xd')]);router[_0xbe14('0x6')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xf')]);router[_0xbe14('0x10')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x11')]);router[_0xbe14('0x10')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x12')]);router[_0xbe14('0x10')]('/:id/users',auth['isAuthenticated'](),controller[_0xbe14('0x13')]);router[_0xbe14('0x14')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller['update']);router[_0xbe14('0x16')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x17')]);router[_0xbe14('0x16')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller['removeTeams']);router[_0xbe14('0x16')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x18')]);module[_0xbe14('0x19')]=router; \ No newline at end of file +var _0x814b=['/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','removeTeams','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x52d8b9,_0xe54454){var _0x126b5b=function(_0x43d8c8){while(--_0x43d8c8){_0x52d8b9['push'](_0x52d8b9['shift']());}};_0x126b5b(++_0xe54454);}(_0x814b,0x1a2));var _0xb814=function(_0x50aa2e,_0xfbd6f0){_0x50aa2e=_0x50aa2e-0x0;var _0x5e07f0=_0x814b[_0x50aa2e];return _0x5e07f0;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xa')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0xa')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0xa')](_0xb814('0x12'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);router['get'](_0xb814('0x14'),auth[_0xb814('0xb')](),controller[_0xb814('0x15')]);router[_0xb814('0x16')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0x17')]);router[_0xb814('0x16')](_0xb814('0x12'),auth[_0xb814('0xb')](),controller[_0xb814('0x18')]);router[_0xb814('0x16')](_0xb814('0x14'),auth[_0xb814('0xb')](),controller[_0xb814('0x19')]);router[_0xb814('0x1a')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0x1b')]);router[_0xb814('0x1c')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller['destroy']);router[_0xb814('0x1c')]('/:id/teams',auth[_0xb814('0xb')](),controller[_0xb814('0x1d')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xb814('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index e6cb31c..a4d6e8d 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 _0xd939=['moment','sequelize','STRING','DATE'];(function(_0x3be2d0,_0x3fd9b4){var _0xfc5ccf=function(_0x35f134){while(--_0x35f134){_0x3be2d0['push'](_0x3be2d0['shift']());}};_0xfc5ccf(++_0x3fd9b4);}(_0xd939,0x1b4));var _0x9d93=function(_0x178856,_0x41f045){_0x178856=_0x178856-0x0;var _0x3c7fe7=_0xd939[_0x178856];return _0x3c7fe7;};'use strict';var moment=require(_0x9d93('0x0'));var Sequelize=require(_0x9d93('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x9d93('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x9d93('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x9d93('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5612=['moment','sequelize','exports','STRING','DATE'];(function(_0x53e82b,_0x1c3157){var _0x482bec=function(_0x2ded11){while(--_0x2ded11){_0x53e82b['push'](_0x53e82b['shift']());}};_0x482bec(++_0x1c3157);}(_0x5612,0x19a));var _0x2561=function(_0x976d1a,_0x1d45b3){_0x976d1a=_0x976d1a-0x0;var _0x4dc6b2=_0x5612[_0x976d1a];return _0x4dc6b2;};'use strict';var moment=require(_0x2561('0x0'));var Sequelize=require(_0x2561('0x1'));module[_0x2561('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x2561('0x3')]},'joinAt':{'type':Sequelize[_0x2561('0x4')]},'leaveAt':{'type':Sequelize[_0x2561('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x2561('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index d3400eb..5e84b03 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 _0x4cfd=['destroy','params','describe','eml-format','rimraf','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/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','end','sendStatus','stack','send','map','ChatQueueReport','fieldName','type','name','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','options','includeAll','include','show','rawAttributes','find','catch','create','body'];(function(_0x350796,_0x1bf21f){var _0x126f19=function(_0x4d7591){while(--_0x4d7591){_0x350796['push'](_0x350796['shift']());}};_0x126f19(++_0x1bf21f);}(_0x4cfd,0x170));var _0xd4cf=function(_0x2e913b,_0x4b7071){_0x2e913b=_0x2e913b-0x0;var _0x173899=_0x4cfd[_0x2e913b];return _0x173899;};'use strict';var emlformat=require(_0xd4cf('0x0'));var rimraf=require(_0xd4cf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd4cf('0x2'));var rp=require(_0xd4cf('0x3'));var moment=require(_0xd4cf('0x4'));var BPromise=require(_0xd4cf('0x5'));var Mustache=require(_0xd4cf('0x6'));var util=require(_0xd4cf('0x7'));var path=require('path');var sox=require(_0xd4cf('0x8'));var csv=require(_0xd4cf('0x9'));var ejs=require(_0xd4cf('0xa'));var fs=require('fs');var fs_extra=require(_0xd4cf('0xb'));var _=require(_0xd4cf('0xc'));var squel=require(_0xd4cf('0xd'));var crypto=require('crypto');var jsforce=require(_0xd4cf('0xe'));var deskjs=require(_0xd4cf('0xf'));var toCsv=require(_0xd4cf('0x9'));var querystring=require(_0xd4cf('0x10'));var Papa=require(_0xd4cf('0x11'));var Redis=require(_0xd4cf('0x12'));var authService=require(_0xd4cf('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xd4cf('0x14'));var hardwareService=require(_0xd4cf('0x15'));var logger=require(_0xd4cf('0x16'))(_0xd4cf('0x17'));var utils=require(_0xd4cf('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xd4cf('0x19'))['db'];function respondWithStatusCode(_0x294c99,_0x544065){_0x544065=_0x544065||0xcc;return function(_0x3ff2db){if(_0x3ff2db){return _0x294c99['sendStatus'](_0x544065);}return _0x294c99[_0xd4cf('0x1a')](_0x544065)['end']();};}function respondWithResult(_0x330630,_0xa597cd){_0xa597cd=_0xa597cd||0xc8;return function(_0x51c61e){if(_0x51c61e){return _0x330630[_0xd4cf('0x1a')](_0xa597cd)[_0xd4cf('0x1b')](_0x51c61e);}};}function respondWithFilteredResult(_0x2f8607,_0x13c0a1){return function(_0x44abd7){if(_0x44abd7){var _0x2ff69e=typeof _0x13c0a1['offset']===_0xd4cf('0x1c')&&typeof _0x13c0a1[_0xd4cf('0x1d')]===_0xd4cf('0x1c');var _0x11b06a=_0x44abd7[_0xd4cf('0x1e')];var _0x3e749d=_0x2ff69e?0x0:_0x13c0a1[_0xd4cf('0x1f')];var _0x1df3e0=_0x2ff69e?_0x44abd7[_0xd4cf('0x1e')]:_0x13c0a1[_0xd4cf('0x1f')]+_0x13c0a1[_0xd4cf('0x1d')];var _0x540e2b;if(_0x1df3e0>=_0x11b06a){_0x1df3e0=_0x11b06a;_0x540e2b=0xc8;}else{_0x540e2b=0xce;}_0x2f8607[_0xd4cf('0x1a')](_0x540e2b);return _0x2f8607[_0xd4cf('0x20')](_0xd4cf('0x21'),_0x3e749d+'-'+_0x1df3e0+'/'+_0x11b06a)[_0xd4cf('0x1b')](_0x44abd7);}return null;};}function patchUpdates(_0x1caa70){return function(_0x2bef15){try{jsonpatch[_0xd4cf('0x22')](_0x2bef15,_0x1caa70,!![]);}catch(_0x5338dc){return BPromise[_0xd4cf('0x23')](_0x5338dc);}return _0x2bef15['save']();};}function saveUpdates(_0x4ec111,_0x10f6a7){return function(_0x3dbe6d){if(_0x3dbe6d){return _0x3dbe6d[_0xd4cf('0x24')](_0x4ec111)[_0xd4cf('0x25')](function(_0x2fe806){return _0x2fe806;});}return null;};}function removeEntity(_0x40c251,_0x54aaab){return function(_0x14c159){if(_0x14c159){return _0x14c159['destroy']()[_0xd4cf('0x25')](function(){_0x40c251[_0xd4cf('0x1a')](0xcc)[_0xd4cf('0x26')]();});}};}function handleEntityNotFound(_0x4c1896,_0x5266aa){return function(_0x52c21b){if(!_0x52c21b){_0x4c1896[_0xd4cf('0x27')](0x194);}return _0x52c21b;};}function handleError(_0x413317,_0x4fd6ea){_0x4fd6ea=_0x4fd6ea||0x1f4;return function(_0x59c215){logger['error'](_0x59c215[_0xd4cf('0x28')]);if(_0x59c215['name']){delete _0x59c215['name'];}_0x413317['status'](_0x4fd6ea)[_0xd4cf('0x29')](_0x59c215);};}exports['index']=function(_0xd08f38,_0xa9ae56){var _0x2459f4={},_0x3b507f={},_0x45943d={'count':0x0,'rows':[]};var _0x2183c1=_[_0xd4cf('0x2a')](db[_0xd4cf('0x2b')]['rawAttributes'],function(_0x1c6ae5){return{'name':_0x1c6ae5[_0xd4cf('0x2c')],'type':_0x1c6ae5[_0xd4cf('0x2d')]['key']};});_0x3b507f['model']=_[_0xd4cf('0x2a')](_0x2183c1,_0xd4cf('0x2e'));_0x3b507f[_0xd4cf('0x2f')]=_[_0xd4cf('0x30')](_0xd08f38[_0xd4cf('0x2f')]);_0x3b507f[_0xd4cf('0x31')]=_[_0xd4cf('0x32')](_0x3b507f[_0xd4cf('0x33')],_0x3b507f['query']);_0x2459f4[_0xd4cf('0x34')]=_[_0xd4cf('0x32')](_0x3b507f[_0xd4cf('0x33')],qs[_0xd4cf('0x35')](_0xd08f38[_0xd4cf('0x2f')][_0xd4cf('0x35')]));_0x2459f4[_0xd4cf('0x34')]=_0x2459f4[_0xd4cf('0x34')][_0xd4cf('0x36')]?_0x2459f4[_0xd4cf('0x34')]:_0x3b507f[_0xd4cf('0x33')];if(!_0xd08f38[_0xd4cf('0x2f')][_0xd4cf('0x37')]('nolimit')){_0x2459f4['limit']=qs[_0xd4cf('0x1d')](_0xd08f38[_0xd4cf('0x2f')][_0xd4cf('0x1d')]);_0x2459f4[_0xd4cf('0x1f')]=qs[_0xd4cf('0x1f')](_0xd08f38[_0xd4cf('0x2f')][_0xd4cf('0x1f')]);}_0x2459f4[_0xd4cf('0x38')]=qs['sort'](_0xd08f38[_0xd4cf('0x2f')][_0xd4cf('0x39')]);_0x2459f4[_0xd4cf('0x3a')]=qs['filters'](_['pick'](_0xd08f38[_0xd4cf('0x2f')],_0x3b507f[_0xd4cf('0x31')]),_0x2183c1);if(_0xd08f38[_0xd4cf('0x2f')][_0xd4cf('0x3b')]){_0x2459f4['where']=_[_0xd4cf('0x3c')](_0x2459f4[_0xd4cf('0x3a')],{'$or':_[_0xd4cf('0x2a')](_0x2183c1,function(_0x222669){if(_0x222669['type']!=='VIRTUAL'){var _0x4aeaa8={};_0x4aeaa8[_0x222669[_0xd4cf('0x2e')]]={'$like':'%'+_0xd08f38[_0xd4cf('0x2f')][_0xd4cf('0x3b')]+'%'};return _0x4aeaa8;}})});}_0x2459f4=_[_0xd4cf('0x3c')]({},_0x2459f4,_0xd08f38[_0xd4cf('0x3d')]);var _0x17a8ee={'where':_0x2459f4[_0xd4cf('0x3a')]};return db[_0xd4cf('0x2b')]['count'](_0x17a8ee)['then'](function(_0x52fa6b){_0x45943d[_0xd4cf('0x1e')]=_0x52fa6b;if(_0xd08f38['query'][_0xd4cf('0x3e')]){_0x2459f4[_0xd4cf('0x3f')]=[{'all':!![]}];}return db[_0xd4cf('0x2b')]['findAll'](_0x2459f4);})[_0xd4cf('0x25')](function(_0x1ee4e2){_0x45943d['rows']=_0x1ee4e2;return _0x45943d;})[_0xd4cf('0x25')](respondWithFilteredResult(_0xa9ae56,_0x2459f4))['catch'](handleError(_0xa9ae56,null));};exports[_0xd4cf('0x40')]=function(_0x4b6da5,_0x4541db){var _0x476b2d={'raw':!![],'where':{'id':_0x4b6da5['params']['id']}},_0x4b874e={};_0x4b874e['model']=_[_0xd4cf('0x30')](db[_0xd4cf('0x2b')][_0xd4cf('0x41')]);_0x4b874e[_0xd4cf('0x2f')]=_[_0xd4cf('0x30')](_0x4b6da5[_0xd4cf('0x2f')]);_0x4b874e['filters']=_[_0xd4cf('0x32')](_0x4b874e[_0xd4cf('0x33')],_0x4b874e[_0xd4cf('0x2f')]);_0x476b2d[_0xd4cf('0x34')]=_['intersection'](_0x4b874e[_0xd4cf('0x33')],qs['fields'](_0x4b6da5[_0xd4cf('0x2f')][_0xd4cf('0x35')]));_0x476b2d['attributes']=_0x476b2d['attributes'][_0xd4cf('0x36')]?_0x476b2d[_0xd4cf('0x34')]:_0x4b874e['model'];if(_0x4b6da5[_0xd4cf('0x2f')][_0xd4cf('0x3e')]){_0x476b2d[_0xd4cf('0x3f')]=[{'all':!![]}];}_0x476b2d=_[_0xd4cf('0x3c')]({},_0x476b2d,_0x4b6da5[_0xd4cf('0x3d')]);return db['ChatQueueReport'][_0xd4cf('0x42')](_0x476b2d)[_0xd4cf('0x25')](handleEntityNotFound(_0x4541db,null))[_0xd4cf('0x25')](respondWithResult(_0x4541db,null))[_0xd4cf('0x43')](handleError(_0x4541db,null));};exports[_0xd4cf('0x44')]=function(_0x1a547a,_0x55504f){return db[_0xd4cf('0x2b')][_0xd4cf('0x44')](_0x1a547a[_0xd4cf('0x45')],{})[_0xd4cf('0x25')](respondWithResult(_0x55504f,0xc9))[_0xd4cf('0x43')](handleError(_0x55504f,null));};exports[_0xd4cf('0x24')]=function(_0x14af9f,_0x532c7b){if(_0x14af9f[_0xd4cf('0x45')]['id']){delete _0x14af9f[_0xd4cf('0x45')]['id'];}return db[_0xd4cf('0x2b')][_0xd4cf('0x42')]({'where':{'id':_0x14af9f['params']['id']}})[_0xd4cf('0x25')](handleEntityNotFound(_0x532c7b,null))[_0xd4cf('0x25')](saveUpdates(_0x14af9f[_0xd4cf('0x45')],null))[_0xd4cf('0x25')](respondWithResult(_0x532c7b,null))[_0xd4cf('0x43')](handleError(_0x532c7b,null));};exports[_0xd4cf('0x46')]=function(_0xe69dbf,_0x4fd5e0){return db['ChatQueueReport']['find']({'where':{'id':_0xe69dbf[_0xd4cf('0x47')]['id']}})[_0xd4cf('0x25')](handleEntityNotFound(_0x4fd5e0,null))[_0xd4cf('0x25')](removeEntity(_0x4fd5e0,null))[_0xd4cf('0x43')](handleError(_0x4fd5e0,null));};exports[_0xd4cf('0x48')]=function(_0x4934a0,_0x54bb75){return db[_0xd4cf('0x2b')]['describe']()[_0xd4cf('0x25')](respondWithResult(_0x54bb75,null))[_0xd4cf('0x43')](handleError(_0x54bb75,null));}; \ No newline at end of file +var _0xdbb9=['map','ChatQueueReport','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','update','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','save','then','destroy','stack','name','index'];(function(_0x372215,_0x4700f1){var _0x5ebeba=function(_0x28e54b){while(--_0x28e54b){_0x372215['push'](_0x372215['shift']());}};_0x5ebeba(++_0x4700f1);}(_0xdbb9,0xf9));var _0x9dbb=function(_0x416152,_0x2e5f33){_0x416152=_0x416152-0x0;var _0x10586d=_0xdbb9[_0x416152];return _0x10586d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9dbb('0x0'));var zipdir=require(_0x9dbb('0x1'));var jsonpatch=require(_0x9dbb('0x2'));var rp=require(_0x9dbb('0x3'));var moment=require('moment');var BPromise=require(_0x9dbb('0x4'));var Mustache=require(_0x9dbb('0x5'));var util=require(_0x9dbb('0x6'));var path=require(_0x9dbb('0x7'));var sox=require(_0x9dbb('0x8'));var csv=require(_0x9dbb('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9dbb('0xa'));var crypto=require(_0x9dbb('0xb'));var jsforce=require(_0x9dbb('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9dbb('0xd'));var Papa=require(_0x9dbb('0xe'));var Redis=require(_0x9dbb('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x9dbb('0x10'));var as=require(_0x9dbb('0x11'));var hardwareService=require(_0x9dbb('0x12'));var logger=require(_0x9dbb('0x13'))('api');var utils=require(_0x9dbb('0x14'));var config=require(_0x9dbb('0x15'));var licenseUtil=require(_0x9dbb('0x16'));var db=require(_0x9dbb('0x17'))['db'];function respondWithStatusCode(_0x3fe0bd,_0x4468e8){_0x4468e8=_0x4468e8||0xcc;return function(_0x382cc6){if(_0x382cc6){return _0x3fe0bd[_0x9dbb('0x18')](_0x4468e8);}return _0x3fe0bd[_0x9dbb('0x19')](_0x4468e8)[_0x9dbb('0x1a')]();};}function respondWithResult(_0x293028,_0x2c36d3){_0x2c36d3=_0x2c36d3||0xc8;return function(_0x24b20b){if(_0x24b20b){return _0x293028[_0x9dbb('0x19')](_0x2c36d3)[_0x9dbb('0x1b')](_0x24b20b);}};}function respondWithFilteredResult(_0x464df5,_0x528110){return function(_0x1366b2){if(_0x1366b2){var _0x30add1=typeof _0x528110[_0x9dbb('0x1c')]===_0x9dbb('0x1d')&&typeof _0x528110[_0x9dbb('0x1e')]==='undefined';var _0x382d61=_0x1366b2[_0x9dbb('0x1f')];var _0x2383cf=_0x30add1?0x0:_0x528110[_0x9dbb('0x1c')];var _0x45c6f5=_0x30add1?_0x1366b2['count']:_0x528110[_0x9dbb('0x1c')]+_0x528110['limit'];var _0x3de435;if(_0x45c6f5>=_0x382d61){_0x45c6f5=_0x382d61;_0x3de435=0xc8;}else{_0x3de435=0xce;}_0x464df5['status'](_0x3de435);return _0x464df5[_0x9dbb('0x20')]('Content-Range',_0x2383cf+'-'+_0x45c6f5+'/'+_0x382d61)[_0x9dbb('0x1b')](_0x1366b2);}return null;};}function patchUpdates(_0x192eb5){return function(_0x188c75){try{jsonpatch['apply'](_0x188c75,_0x192eb5,!![]);}catch(_0x50e5e3){return BPromise['reject'](_0x50e5e3);}return _0x188c75[_0x9dbb('0x21')]();};}function saveUpdates(_0x35c136,_0x48bb65){return function(_0x4a07ef){if(_0x4a07ef){return _0x4a07ef['update'](_0x35c136)[_0x9dbb('0x22')](function(_0x245d12){return _0x245d12;});}return null;};}function removeEntity(_0x10c06a,_0x55e2ef){return function(_0x1f30ec){if(_0x1f30ec){return _0x1f30ec[_0x9dbb('0x23')]()[_0x9dbb('0x22')](function(){_0x10c06a[_0x9dbb('0x19')](0xcc)[_0x9dbb('0x1a')]();});}};}function handleEntityNotFound(_0x3e51ca,_0x668f7b){return function(_0x187486){if(!_0x187486){_0x3e51ca[_0x9dbb('0x18')](0x194);}return _0x187486;};}function handleError(_0x127742,_0x25614a){_0x25614a=_0x25614a||0x1f4;return function(_0x27a6f6){logger['error'](_0x27a6f6[_0x9dbb('0x24')]);if(_0x27a6f6['name']){delete _0x27a6f6[_0x9dbb('0x25')];}_0x127742[_0x9dbb('0x19')](_0x25614a)['send'](_0x27a6f6);};}exports[_0x9dbb('0x26')]=function(_0x4ebd57,_0x4b5ce1){var _0x589f63={},_0x25555c={},_0x3578b3={'count':0x0,'rows':[]};var _0x491324=_[_0x9dbb('0x27')](db[_0x9dbb('0x28')]['rawAttributes'],function(_0x71692a){return{'name':_0x71692a[_0x9dbb('0x29')],'type':_0x71692a[_0x9dbb('0x2a')]['key']};});_0x25555c[_0x9dbb('0x2b')]=_['map'](_0x491324,_0x9dbb('0x25'));_0x25555c[_0x9dbb('0x2c')]=_[_0x9dbb('0x2d')](_0x4ebd57[_0x9dbb('0x2c')]);_0x25555c[_0x9dbb('0x2e')]=_[_0x9dbb('0x2f')](_0x25555c[_0x9dbb('0x2b')],_0x25555c[_0x9dbb('0x2c')]);_0x589f63[_0x9dbb('0x30')]=_[_0x9dbb('0x2f')](_0x25555c[_0x9dbb('0x2b')],qs['fields'](_0x4ebd57[_0x9dbb('0x2c')][_0x9dbb('0x31')]));_0x589f63[_0x9dbb('0x30')]=_0x589f63[_0x9dbb('0x30')][_0x9dbb('0x32')]?_0x589f63[_0x9dbb('0x30')]:_0x25555c[_0x9dbb('0x2b')];if(!_0x4ebd57[_0x9dbb('0x2c')][_0x9dbb('0x33')](_0x9dbb('0x34'))){_0x589f63[_0x9dbb('0x1e')]=qs[_0x9dbb('0x1e')](_0x4ebd57[_0x9dbb('0x2c')][_0x9dbb('0x1e')]);_0x589f63[_0x9dbb('0x1c')]=qs[_0x9dbb('0x1c')](_0x4ebd57[_0x9dbb('0x2c')]['offset']);}_0x589f63[_0x9dbb('0x35')]=qs[_0x9dbb('0x36')](_0x4ebd57[_0x9dbb('0x2c')]['sort']);_0x589f63[_0x9dbb('0x37')]=qs[_0x9dbb('0x2e')](_[_0x9dbb('0x38')](_0x4ebd57[_0x9dbb('0x2c')],_0x25555c[_0x9dbb('0x2e')]),_0x491324);if(_0x4ebd57[_0x9dbb('0x2c')]['filter']){_0x589f63[_0x9dbb('0x37')]=_['merge'](_0x589f63[_0x9dbb('0x37')],{'$or':_[_0x9dbb('0x27')](_0x491324,function(_0xa3bc3){if(_0xa3bc3[_0x9dbb('0x2a')]!=='VIRTUAL'){var _0x1a5eeb={};_0x1a5eeb[_0xa3bc3['name']]={'$like':'%'+_0x4ebd57[_0x9dbb('0x2c')]['filter']+'%'};return _0x1a5eeb;}})});}_0x589f63=_[_0x9dbb('0x39')]({},_0x589f63,_0x4ebd57[_0x9dbb('0x3a')]);var _0x34524e={'where':_0x589f63[_0x9dbb('0x37')]};return db[_0x9dbb('0x28')]['count'](_0x34524e)[_0x9dbb('0x22')](function(_0x59eea1){_0x3578b3[_0x9dbb('0x1f')]=_0x59eea1;if(_0x4ebd57[_0x9dbb('0x2c')][_0x9dbb('0x3b')]){_0x589f63[_0x9dbb('0x3c')]=[{'all':!![]}];}return db[_0x9dbb('0x28')][_0x9dbb('0x3d')](_0x589f63);})[_0x9dbb('0x22')](function(_0x49e63f){_0x3578b3[_0x9dbb('0x3e')]=_0x49e63f;return _0x3578b3;})['then'](respondWithFilteredResult(_0x4b5ce1,_0x589f63))[_0x9dbb('0x3f')](handleError(_0x4b5ce1,null));};exports[_0x9dbb('0x40')]=function(_0x34c114,_0x104ec5){var _0x490833={'raw':!![],'where':{'id':_0x34c114['params']['id']}},_0x2f99ed={};_0x2f99ed[_0x9dbb('0x2b')]=_['keys'](db[_0x9dbb('0x28')][_0x9dbb('0x41')]);_0x2f99ed['query']=_['keys'](_0x34c114[_0x9dbb('0x2c')]);_0x2f99ed[_0x9dbb('0x2e')]=_[_0x9dbb('0x2f')](_0x2f99ed[_0x9dbb('0x2b')],_0x2f99ed[_0x9dbb('0x2c')]);_0x490833[_0x9dbb('0x30')]=_[_0x9dbb('0x2f')](_0x2f99ed[_0x9dbb('0x2b')],qs[_0x9dbb('0x31')](_0x34c114['query'][_0x9dbb('0x31')]));_0x490833['attributes']=_0x490833[_0x9dbb('0x30')][_0x9dbb('0x32')]?_0x490833[_0x9dbb('0x30')]:_0x2f99ed[_0x9dbb('0x2b')];if(_0x34c114['query'][_0x9dbb('0x3b')]){_0x490833['include']=[{'all':!![]}];}_0x490833=_['merge']({},_0x490833,_0x34c114[_0x9dbb('0x3a')]);return db[_0x9dbb('0x28')][_0x9dbb('0x42')](_0x490833)[_0x9dbb('0x22')](handleEntityNotFound(_0x104ec5,null))[_0x9dbb('0x22')](respondWithResult(_0x104ec5,null))[_0x9dbb('0x3f')](handleError(_0x104ec5,null));};exports['create']=function(_0x202235,_0x56d319){return db[_0x9dbb('0x28')][_0x9dbb('0x43')](_0x202235[_0x9dbb('0x44')],{})[_0x9dbb('0x22')](respondWithResult(_0x56d319,0xc9))[_0x9dbb('0x3f')](handleError(_0x56d319,null));};exports[_0x9dbb('0x45')]=function(_0x34304a,_0x31c532){if(_0x34304a['body']['id']){delete _0x34304a[_0x9dbb('0x44')]['id'];}return db['ChatQueueReport'][_0x9dbb('0x42')]({'where':{'id':_0x34304a[_0x9dbb('0x46')]['id']}})['then'](handleEntityNotFound(_0x31c532,null))[_0x9dbb('0x22')](saveUpdates(_0x34304a['body'],null))['then'](respondWithResult(_0x31c532,null))['catch'](handleError(_0x31c532,null));};exports[_0x9dbb('0x23')]=function(_0x3c19bb,_0x5c398b){return db[_0x9dbb('0x28')]['find']({'where':{'id':_0x3c19bb[_0x9dbb('0x46')]['id']}})[_0x9dbb('0x22')](handleEntityNotFound(_0x5c398b,null))[_0x9dbb('0x22')](removeEntity(_0x5c398b,null))[_0x9dbb('0x3f')](handleError(_0x5c398b,null));};exports[_0x9dbb('0x47')]=function(_0x6a6f55,_0x56ac9a){return db['ChatQueueReport'][_0x9dbb('0x47')]()[_0x9dbb('0x22')](respondWithResult(_0x56ac9a,null))['catch'](handleError(_0x56ac9a,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index e4029fc..555deda 100644 --- a/server/api/chatQueueReport/chatQueueReport.model.js +++ b/server/api/chatQueueReport/chatQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['define','ChatQueueReport','report_chat_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports'];(function(_0x3f7e78,_0x208acb){var _0x41c9a8=function(_0x1e3de7){while(--_0x1e3de7){_0x3f7e78['push'](_0x3f7e78['shift']());}};_0x41c9a8(++_0x208acb);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xbaf0[_0x5ddb1c];return _0x354adc;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','define','ChatQueueReport','uniqueid','lodash'];(function(_0x5c2dfc,_0x17f2f7){var _0x3827b1=function(_0xc6524f){while(--_0xc6524f){_0x5c2dfc['push'](_0x5c2dfc['shift']());}};_0x3827b1(++_0x17f2f7);}(_0xb7e7,0x121));var _0x7b7e=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0xb7e7[_0x16d10f];return _0x50c823;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'report_chat_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index d02acb7..7ea2217 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 _0x1661=['code','error','message','result','catch','ChatQueueReport','body','raw','then','CreateChatQueueReport','UpdateChatQueueReport','options','where','attributes','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x551b09,_0x1f9903){var _0x82db98=function(_0x10d796){while(--_0x10d796){_0x551b09['push'](_0x551b09['shift']());}};_0x82db98(++_0x1f9903);}(_0x1661,0x6b));var _0x1166=function(_0x174f72,_0x1862ce){_0x174f72=_0x174f72-0x0;var _0x5ba695=_0x1661[_0x174f72];return _0x5ba695;};'use strict';var _=require(_0x1166('0x0'));var util=require(_0x1166('0x1'));var moment=require(_0x1166('0x2'));var BPromise=require(_0x1166('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1166('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1166('0x5'))(_0x1166('0x6'));var config=require(_0x1166('0x7'));var jayson=require(_0x1166('0x8'));var client=jayson[_0x1166('0x9')][_0x1166('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5117f5,_0x1e9630,_0x448388){return new BPromise(function(_0x20cd95,_0x59fa31){return client[_0x1166('0xb')](_0x5117f5,_0x448388)['then'](function(_0xbc89d7){logger[_0x1166('0xc')](_0x1166('0xd'),_0x1e9630,_0x1166('0xe'));logger[_0x1166('0xf')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x1e9630,_0x1166('0xe'),JSON[_0x1166('0x10')](_0xbc89d7));if(_0xbc89d7['error']){if(_0xbc89d7['error'][_0x1166('0x11')]===0x1f4){logger[_0x1166('0x12')](_0x1166('0xd'),_0x1e9630,_0xbc89d7[_0x1166('0x12')][_0x1166('0x13')]);return _0x59fa31(_0xbc89d7[_0x1166('0x12')][_0x1166('0x13')]);}logger[_0x1166('0x12')](_0x1166('0xd'),_0x1e9630,_0xbc89d7[_0x1166('0x12')][_0x1166('0x13')]);return _0x20cd95(_0xbc89d7[_0x1166('0x12')][_0x1166('0x13')]);}else{logger[_0x1166('0xc')]('ChatQueueReport,\x20%s,\x20%s',_0x1e9630,'request\x20sent');_0x20cd95(_0xbc89d7[_0x1166('0x14')]['message']);}})[_0x1166('0x15')](function(_0x49a770){logger[_0x1166('0x12')](_0x1166('0xd'),_0x1e9630,_0x49a770);_0x59fa31(_0x49a770);});});}exports['CreateChatQueueReport']=function(_0x4878ac){var _0x46ddcc=this;return new Promise(function(_0x51a977,_0xe316bc){return db[_0x1166('0x16')]['create'](_0x4878ac[_0x1166('0x17')],{'raw':_0x4878ac['options']?_0x4878ac['options'][_0x1166('0x18')]===undefined?!![]:![]:!![]})[_0x1166('0x19')](function(_0x23337f){logger[_0x1166('0xc')](_0x1166('0x1a'),_0x4878ac);logger['debug'](_0x1166('0x1a'),_0x4878ac,JSON['stringify'](_0x23337f));_0x51a977(_0x23337f);})['catch'](function(_0x28b59e){logger[_0x1166('0x12')]('CreateChatQueueReport',_0x28b59e[_0x1166('0x13')],_0x4878ac);_0xe316bc(_0x46ddcc[_0x1166('0x12')](0x1f4,_0x28b59e[_0x1166('0x13')]));});});};exports[_0x1166('0x1b')]=function(_0x12fa8a){var _0x18e8e4=this;return new Promise(function(_0x7da14,_0x143577){return db[_0x1166('0x16')]['update'](_0x12fa8a[_0x1166('0x17')],{'raw':_0x12fa8a[_0x1166('0x1c')]?_0x12fa8a[_0x1166('0x1c')][_0x1166('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x12fa8a['options']?_0x12fa8a[_0x1166('0x1c')][_0x1166('0x1d')]||null:null,'attributes':_0x12fa8a[_0x1166('0x1c')]?_0x12fa8a[_0x1166('0x1c')][_0x1166('0x1e')]||null:null,'limit':_0x12fa8a[_0x1166('0x1c')]?_0x12fa8a[_0x1166('0x1c')]['limit']||null:null})[_0x1166('0x19')](function(_0x4abb5e){logger['info']('UpdateChatQueueReport',_0x12fa8a);logger[_0x1166('0xf')](_0x1166('0x1b'),_0x12fa8a,JSON[_0x1166('0x10')](_0x4abb5e));_0x7da14(_0x4abb5e);})[_0x1166('0x15')](function(_0x3df5d3){logger[_0x1166('0x12')](_0x1166('0x1b'),_0x3df5d3[_0x1166('0x13')],_0x12fa8a);_0x143577(_0x18e8e4[_0x1166('0x12')](0x1f4,_0x3df5d3[_0x1166('0x13')]));});});}; \ No newline at end of file +var _0xa68a=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','debug','catch','UpdateChatQueueReport','update','where','attributes','limit','lodash','util','moment'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xa68a,0x1ad));var _0xaa68=function(_0x567dcd,_0x2f6e5d){_0x567dcd=_0x567dcd-0x0;var _0x38879d=_0xa68a[_0x567dcd];return _0x38879d;};'use strict';var _=require(_0xaa68('0x0'));var util=require(_0xaa68('0x1'));var moment=require(_0xaa68('0x2'));var BPromise=require(_0xaa68('0x3'));var rs=require(_0xaa68('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaa68('0x5'))['db'];var utils=require(_0xaa68('0x6'));var logger=require(_0xaa68('0x7'))(_0xaa68('0x8'));var config=require(_0xaa68('0x9'));var jayson=require(_0xaa68('0xa'));var client=jayson[_0xaa68('0xb')][_0xaa68('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x259b21,_0x5c2479,_0x3813a8){return new BPromise(function(_0x9f10f5,_0x20edd4){return client['request'](_0x259b21,_0x3813a8)[_0xaa68('0xd')](function(_0x20ceee){logger[_0xaa68('0xe')](_0xaa68('0xf'),_0x5c2479,_0xaa68('0x10'));logger['debug'](_0xaa68('0x11'),_0x5c2479,_0xaa68('0x10'),JSON[_0xaa68('0x12')](_0x20ceee));if(_0x20ceee[_0xaa68('0x13')]){if(_0x20ceee[_0xaa68('0x13')][_0xaa68('0x14')]===0x1f4){logger['error'](_0xaa68('0xf'),_0x5c2479,_0x20ceee[_0xaa68('0x13')][_0xaa68('0x15')]);return _0x20edd4(_0x20ceee[_0xaa68('0x13')][_0xaa68('0x15')]);}logger[_0xaa68('0x13')](_0xaa68('0xf'),_0x5c2479,_0x20ceee['error'][_0xaa68('0x15')]);return _0x9f10f5(_0x20ceee['error'][_0xaa68('0x15')]);}else{logger['info']('ChatQueueReport,\x20%s,\x20%s',_0x5c2479,_0xaa68('0x10'));_0x9f10f5(_0x20ceee[_0xaa68('0x16')]['message']);}})['catch'](function(_0x3a1f81){logger[_0xaa68('0x13')](_0xaa68('0xf'),_0x5c2479,_0x3a1f81);_0x20edd4(_0x3a1f81);});});}exports[_0xaa68('0x17')]=function(_0xd79686){var _0x30c143=this;return new Promise(function(_0x2e45ad,_0x4af7e4){return db[_0xaa68('0x18')][_0xaa68('0x19')](_0xd79686[_0xaa68('0x1a')],{'raw':_0xd79686[_0xaa68('0x1b')]?_0xd79686[_0xaa68('0x1b')][_0xaa68('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x1d748f){logger['info'](_0xaa68('0x17'),_0xd79686);logger[_0xaa68('0x1d')](_0xaa68('0x17'),_0xd79686,JSON[_0xaa68('0x12')](_0x1d748f));_0x2e45ad(_0x1d748f);})[_0xaa68('0x1e')](function(_0x43fb4){logger[_0xaa68('0x13')]('CreateChatQueueReport',_0x43fb4[_0xaa68('0x15')],_0xd79686);_0x4af7e4(_0x30c143[_0xaa68('0x13')](0x1f4,_0x43fb4[_0xaa68('0x15')]));});});};exports[_0xaa68('0x1f')]=function(_0x2d6d4c){var _0x583e00=this;return new Promise(function(_0x23298e,_0x5a50dd){return db['ChatQueueReport'][_0xaa68('0x20')](_0x2d6d4c[_0xaa68('0x1a')],{'raw':_0x2d6d4c[_0xaa68('0x1b')]?_0x2d6d4c[_0xaa68('0x1b')][_0xaa68('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d6d4c[_0xaa68('0x1b')]?_0x2d6d4c[_0xaa68('0x1b')][_0xaa68('0x21')]||null:null,'attributes':_0x2d6d4c['options']?_0x2d6d4c[_0xaa68('0x1b')][_0xaa68('0x22')]||null:null,'limit':_0x2d6d4c[_0xaa68('0x1b')]?_0x2d6d4c['options'][_0xaa68('0x23')]||null:null})[_0xaa68('0xd')](function(_0xddea5d){logger['info'](_0xaa68('0x1f'),_0x2d6d4c);logger[_0xaa68('0x1d')](_0xaa68('0x1f'),_0x2d6d4c,JSON[_0xaa68('0x12')](_0xddea5d));_0x23298e(_0xddea5d);})[_0xaa68('0x1e')](function(_0x5f0066){logger[_0xaa68('0x13')](_0xaa68('0x1f'),_0x5f0066[_0xaa68('0x15')],_0x2d6d4c);_0x5a50dd(_0x583e00[_0xaa68('0x13')](0x1f4,_0x5f0066[_0xaa68('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 950f133..e6174dd 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 _0x920a=['express','Router','../../components/auth/service','../../components/interaction/service','./chatQueueReport.controller','get','/describe','isAuthenticated','describe','/:id','show','post','put','update','delete','util','path'];(function(_0xc3eadb,_0x3e52d){var _0x4ea0d7=function(_0x287701){while(--_0x287701){_0xc3eadb['push'](_0xc3eadb['shift']());}};_0x4ea0d7(++_0x3e52d);}(_0x920a,0x196));var _0xa920=function(_0x556f2b,_0x4dec29){_0x556f2b=_0x556f2b-0x0;var _0x41363c=_0x920a[_0x556f2b];return _0x41363c;};'use strict';var multer=require('multer');var util=require(_0xa920('0x0'));var path=require(_0xa920('0x1'));var timeout=require('connect-timeout');var express=require(_0xa920('0x2'));var router=express[_0xa920('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa920('0x4'));var interaction=require(_0xa920('0x5'));var config=require('../../config/environment');var controller=require(_0xa920('0x6'));router[_0xa920('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa920('0x7')](_0xa920('0x8'),auth[_0xa920('0x9')](),controller[_0xa920('0xa')]);router['get'](_0xa920('0xb'),auth[_0xa920('0x9')](),controller[_0xa920('0xc')]);router[_0xa920('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa920('0xe')]('/:id',auth[_0xa920('0x9')](),controller[_0xa920('0xf')]);router[_0xa920('0x10')](_0xa920('0xb'),auth[_0xa920('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x4a83=['destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x4a83,0xd3));var _0x34a8=function(_0x360296,_0xcd6f97){_0x360296=_0x360296-0x0;var _0x20b06d=_0x4a83[_0x360296];return _0x20b06d;};'use strict';var multer=require(_0x34a8('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x34a8('0x1'));var express=require(_0x34a8('0x2'));var router=express[_0x34a8('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x34a8('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x34a8('0x5'));var controller=require('./chatQueueReport.controller');router[_0x34a8('0x6')]('/',auth[_0x34a8('0x7')](),controller[_0x34a8('0x8')]);router[_0x34a8('0x6')](_0x34a8('0x9'),auth[_0x34a8('0x7')](),controller[_0x34a8('0xa')]);router[_0x34a8('0x6')](_0x34a8('0xb'),auth[_0x34a8('0x7')](),controller['show']);router[_0x34a8('0xc')]('/',auth[_0x34a8('0x7')](),controller[_0x34a8('0xd')]);router[_0x34a8('0xe')](_0x34a8('0xb'),auth[_0x34a8('0x7')](),controller[_0x34a8('0xf')]);router[_0x34a8('0x10')]('/:id',auth[_0x34a8('0x7')](),controller[_0x34a8('0x11')]);module[_0x34a8('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 016ec25..0d5cd1f 100644 --- a/server/api/chatTransferReport/chatTransferReport.attributes.js +++ b/server/api/chatTransferReport/chatTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x322a71,_0x45ff25){var _0x4e8a01=function(_0x150695){while(--_0x150695){_0x322a71['push'](_0x322a71['shift']());}};_0x4e8a01(++_0x45ff25);}(_0xaa88,0x137));var _0x8aa8=function(_0x4aac5a,_0x15b04c){_0x4aac5a=_0x4aac5a-0x0;var _0x42e7bc=_0xaa88[_0x4aac5a];return _0x42e7bc;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file +var _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x1ecae9,_0x3d5fb9){var _0x5518e1=function(_0x1fcef5){while(--_0x1fcef5){_0x1ecae9['push'](_0x1ecae9['shift']());}};_0x5518e1(++_0x3d5fb9);}(_0x9c44,0x178));var _0x49c4=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x9c44[_0x36c5b0];return _0xf19333;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index cb23bda..4f2120d 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 _0xfbd1=['count','set','Content-Range','apply','then','stack','name','index','map','ChatTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','include','create','update','body','destroy','find','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit'];(function(_0x2e3f5c,_0xb30165){var _0x265cb6=function(_0x59b41c){while(--_0x59b41c){_0x2e3f5c['push'](_0x2e3f5c['shift']());}};_0x265cb6(++_0xb30165);}(_0xfbd1,0x1ef));var _0x1fbd=function(_0x3113b1,_0x42646c){_0x3113b1=_0x3113b1-0x0;var _0x4d45a8=_0xfbd1[_0x3113b1];return _0x4d45a8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1fbd('0x0'));var jsonpatch=require(_0x1fbd('0x1'));var rp=require(_0x1fbd('0x2'));var moment=require(_0x1fbd('0x3'));var BPromise=require(_0x1fbd('0x4'));var Mustache=require(_0x1fbd('0x5'));var util=require(_0x1fbd('0x6'));var path=require(_0x1fbd('0x7'));var sox=require(_0x1fbd('0x8'));var csv=require(_0x1fbd('0x9'));var ejs=require(_0x1fbd('0xa'));var fs=require('fs');var fs_extra=require(_0x1fbd('0xb'));var _=require(_0x1fbd('0xc'));var squel=require(_0x1fbd('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1fbd('0x9'));var querystring=require(_0x1fbd('0xe'));var Papa=require('papaparse');var Redis=require(_0x1fbd('0xf'));var authService=require(_0x1fbd('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x1fbd('0x11'));var hardwareService=require(_0x1fbd('0x12'));var logger=require('../../config/logger')(_0x1fbd('0x13'));var utils=require(_0x1fbd('0x14'));var config=require(_0x1fbd('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x1fbd('0x16'))['db'];function respondWithStatusCode(_0x2e5cb0,_0x2f9dcf){_0x2f9dcf=_0x2f9dcf||0xcc;return function(_0xa39474){if(_0xa39474){return _0x2e5cb0[_0x1fbd('0x17')](_0x2f9dcf);}return _0x2e5cb0[_0x1fbd('0x18')](_0x2f9dcf)[_0x1fbd('0x19')]();};}function respondWithResult(_0xfd90e3,_0x2eaae7){_0x2eaae7=_0x2eaae7||0xc8;return function(_0x2710c2){if(_0x2710c2){return _0xfd90e3['status'](_0x2eaae7)[_0x1fbd('0x1a')](_0x2710c2);}};}function respondWithFilteredResult(_0x239325,_0x3e99a2){return function(_0x5df031){if(_0x5df031){var _0x3a5fd=typeof _0x3e99a2[_0x1fbd('0x1b')]===_0x1fbd('0x1c')&&typeof _0x3e99a2[_0x1fbd('0x1d')]===_0x1fbd('0x1c');var _0x4cbc40=_0x5df031[_0x1fbd('0x1e')];var _0x1a3101=_0x3a5fd?0x0:_0x3e99a2[_0x1fbd('0x1b')];var _0x37c4ec=_0x3a5fd?_0x5df031['count']:_0x3e99a2[_0x1fbd('0x1b')]+_0x3e99a2[_0x1fbd('0x1d')];var _0x37ff40;if(_0x37c4ec>=_0x4cbc40){_0x37c4ec=_0x4cbc40;_0x37ff40=0xc8;}else{_0x37ff40=0xce;}_0x239325[_0x1fbd('0x18')](_0x37ff40);return _0x239325[_0x1fbd('0x1f')](_0x1fbd('0x20'),_0x1a3101+'-'+_0x37c4ec+'/'+_0x4cbc40)[_0x1fbd('0x1a')](_0x5df031);}return null;};}function patchUpdates(_0x1faf7c){return function(_0x410ea2){try{jsonpatch[_0x1fbd('0x21')](_0x410ea2,_0x1faf7c,!![]);}catch(_0x155369){return BPromise['reject'](_0x155369);}return _0x410ea2['save']();};}function saveUpdates(_0x31b645,_0x538874){return function(_0x361974){if(_0x361974){return _0x361974['update'](_0x31b645)[_0x1fbd('0x22')](function(_0x3da8c1){return _0x3da8c1;});}return null;};}function removeEntity(_0x276868,_0x1ad8cf){return function(_0x4856eb){if(_0x4856eb){return _0x4856eb['destroy']()[_0x1fbd('0x22')](function(){_0x276868['status'](0xcc)[_0x1fbd('0x19')]();});}};}function handleEntityNotFound(_0x38714e,_0x3d2c73){return function(_0x16dbb2){if(!_0x16dbb2){_0x38714e['sendStatus'](0x194);}return _0x16dbb2;};}function handleError(_0x54573c,_0x2355f5){_0x2355f5=_0x2355f5||0x1f4;return function(_0x191687){logger['error'](_0x191687[_0x1fbd('0x23')]);if(_0x191687['name']){delete _0x191687[_0x1fbd('0x24')];}_0x54573c[_0x1fbd('0x18')](_0x2355f5)['send'](_0x191687);};}exports[_0x1fbd('0x25')]=function(_0x51fa1d,_0x48ee7b){var _0x2d3456={},_0x1a5f69={},_0x46f7a5={'count':0x0,'rows':[]};var _0x48c229=_[_0x1fbd('0x26')](db[_0x1fbd('0x27')][_0x1fbd('0x28')],function(_0x4f4b97){return{'name':_0x4f4b97[_0x1fbd('0x29')],'type':_0x4f4b97[_0x1fbd('0x2a')][_0x1fbd('0x2b')]};});_0x1a5f69[_0x1fbd('0x2c')]=_[_0x1fbd('0x26')](_0x48c229,_0x1fbd('0x24'));_0x1a5f69[_0x1fbd('0x2d')]=_[_0x1fbd('0x2e')](_0x51fa1d[_0x1fbd('0x2d')]);_0x1a5f69[_0x1fbd('0x2f')]=_[_0x1fbd('0x30')](_0x1a5f69['model'],_0x1a5f69[_0x1fbd('0x2d')]);_0x2d3456[_0x1fbd('0x31')]=_[_0x1fbd('0x30')](_0x1a5f69['model'],qs[_0x1fbd('0x32')](_0x51fa1d['query'][_0x1fbd('0x32')]));_0x2d3456['attributes']=_0x2d3456['attributes'][_0x1fbd('0x33')]?_0x2d3456[_0x1fbd('0x31')]:_0x1a5f69[_0x1fbd('0x2c')];if(!_0x51fa1d[_0x1fbd('0x2d')][_0x1fbd('0x34')](_0x1fbd('0x35'))){_0x2d3456[_0x1fbd('0x1d')]=qs[_0x1fbd('0x1d')](_0x51fa1d[_0x1fbd('0x2d')]['limit']);_0x2d3456[_0x1fbd('0x1b')]=qs['offset'](_0x51fa1d[_0x1fbd('0x2d')][_0x1fbd('0x1b')]);}_0x2d3456[_0x1fbd('0x36')]=qs[_0x1fbd('0x37')](_0x51fa1d[_0x1fbd('0x2d')][_0x1fbd('0x37')]);_0x2d3456['where']=qs[_0x1fbd('0x2f')](_[_0x1fbd('0x38')](_0x51fa1d[_0x1fbd('0x2d')],_0x1a5f69[_0x1fbd('0x2f')]),_0x48c229);if(_0x51fa1d[_0x1fbd('0x2d')][_0x1fbd('0x39')]){_0x2d3456[_0x1fbd('0x3a')]=_['merge'](_0x2d3456[_0x1fbd('0x3a')],{'$or':_[_0x1fbd('0x26')](_0x48c229,function(_0x50d6f9){if(_0x50d6f9[_0x1fbd('0x2a')]!==_0x1fbd('0x3b')){var _0x2204d6={};_0x2204d6[_0x50d6f9[_0x1fbd('0x24')]]={'$like':'%'+_0x51fa1d[_0x1fbd('0x2d')][_0x1fbd('0x39')]+'%'};return _0x2204d6;}})});}_0x2d3456=_[_0x1fbd('0x3c')]({},_0x2d3456,_0x51fa1d[_0x1fbd('0x3d')]);var _0x3a2188={'where':_0x2d3456[_0x1fbd('0x3a')]};return db[_0x1fbd('0x27')]['count'](_0x3a2188)[_0x1fbd('0x22')](function(_0x4684ea){_0x46f7a5[_0x1fbd('0x1e')]=_0x4684ea;if(_0x51fa1d[_0x1fbd('0x2d')][_0x1fbd('0x3e')]){_0x2d3456['include']=[{'all':!![]}];}return db['ChatTransferReport'][_0x1fbd('0x3f')](_0x2d3456);})['then'](function(_0x39cd96){_0x46f7a5[_0x1fbd('0x40')]=_0x39cd96;return _0x46f7a5;})[_0x1fbd('0x22')](respondWithFilteredResult(_0x48ee7b,_0x2d3456))[_0x1fbd('0x41')](handleError(_0x48ee7b,null));};exports[_0x1fbd('0x42')]=function(_0x3e9eca,_0x2745cd){var _0x126cef={'raw':!![],'where':{'id':_0x3e9eca[_0x1fbd('0x43')]['id']}},_0x54575e={};_0x54575e['model']=_['keys'](db[_0x1fbd('0x27')][_0x1fbd('0x28')]);_0x54575e[_0x1fbd('0x2d')]=_[_0x1fbd('0x2e')](_0x3e9eca[_0x1fbd('0x2d')]);_0x54575e[_0x1fbd('0x2f')]=_['intersection'](_0x54575e[_0x1fbd('0x2c')],_0x54575e['query']);_0x126cef[_0x1fbd('0x31')]=_[_0x1fbd('0x30')](_0x54575e['model'],qs[_0x1fbd('0x32')](_0x3e9eca[_0x1fbd('0x2d')][_0x1fbd('0x32')]));_0x126cef['attributes']=_0x126cef[_0x1fbd('0x31')]['length']?_0x126cef[_0x1fbd('0x31')]:_0x54575e[_0x1fbd('0x2c')];if(_0x3e9eca[_0x1fbd('0x2d')]['includeAll']){_0x126cef[_0x1fbd('0x44')]=[{'all':!![]}];}_0x126cef=_[_0x1fbd('0x3c')]({},_0x126cef,_0x3e9eca[_0x1fbd('0x3d')]);return db[_0x1fbd('0x27')]['find'](_0x126cef)[_0x1fbd('0x22')](handleEntityNotFound(_0x2745cd,null))[_0x1fbd('0x22')](respondWithResult(_0x2745cd,null))[_0x1fbd('0x41')](handleError(_0x2745cd,null));};exports[_0x1fbd('0x45')]=function(_0x546034,_0x5cf16b){return db[_0x1fbd('0x27')]['create'](_0x546034['body'],{})[_0x1fbd('0x22')](respondWithResult(_0x5cf16b,0xc9))[_0x1fbd('0x41')](handleError(_0x5cf16b,null));};exports[_0x1fbd('0x46')]=function(_0xa0434d,_0x4e5eca){if(_0xa0434d['body']['id']){delete _0xa0434d[_0x1fbd('0x47')]['id'];}return db[_0x1fbd('0x27')]['find']({'where':{'id':_0xa0434d[_0x1fbd('0x43')]['id']}})['then'](handleEntityNotFound(_0x4e5eca,null))[_0x1fbd('0x22')](saveUpdates(_0xa0434d[_0x1fbd('0x47')],null))['then'](respondWithResult(_0x4e5eca,null))[_0x1fbd('0x41')](handleError(_0x4e5eca,null));};exports[_0x1fbd('0x48')]=function(_0x53b79e,_0x2bb49f){return db['ChatTransferReport'][_0x1fbd('0x49')]({'where':{'id':_0x53b79e[_0x1fbd('0x43')]['id']}})[_0x1fbd('0x22')](handleEntityNotFound(_0x2bb49f,null))[_0x1fbd('0x22')](removeEntity(_0x2bb49f,null))[_0x1fbd('0x41')](handleError(_0x2bb49f,null));};exports[_0x1fbd('0x4a')]=function(_0x164661,_0x115503){return db[_0x1fbd('0x27')][_0x1fbd('0x4a')]()[_0x1fbd('0x22')](respondWithResult(_0x115503,null))['catch'](handleError(_0x115503,null));}; \ No newline at end of file +var _0x3785=['fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','merge','find','create','body','describe','eml-format','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','name','send','ChatTransferReport','rawAttributes'];(function(_0x51bc84,_0x519320){var _0x3a953e=function(_0x568464){while(--_0x568464){_0x51bc84['push'](_0x51bc84['shift']());}};_0x3a953e(++_0x519320);}(_0x3785,0x68));var _0x5378=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0x3785[_0x3e112d];return _0x531c31;};'use strict';var emlformat=require(_0x5378('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5378('0x1'));var rp=require(_0x5378('0x2'));var moment=require(_0x5378('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5378('0x4'));var path=require(_0x5378('0x5'));var sox=require('sox');var csv=require(_0x5378('0x6'));var ejs=require(_0x5378('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5378('0x8'));var squel=require(_0x5378('0x9'));var crypto=require(_0x5378('0xa'));var jsforce=require(_0x5378('0xb'));var deskjs=require(_0x5378('0xc'));var toCsv=require(_0x5378('0x6'));var querystring=require(_0x5378('0xd'));var Papa=require('papaparse');var Redis=require(_0x5378('0xe'));var authService=require(_0x5378('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x5378('0x10'));var hardwareService=require(_0x5378('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x5378('0x12'));var config=require(_0x5378('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x5378('0x14'))['db'];function respondWithStatusCode(_0x2f75e2,_0x313698){_0x313698=_0x313698||0xcc;return function(_0x552947){if(_0x552947){return _0x2f75e2[_0x5378('0x15')](_0x313698);}return _0x2f75e2[_0x5378('0x16')](_0x313698)[_0x5378('0x17')]();};}function respondWithResult(_0x232546,_0xdc60be){_0xdc60be=_0xdc60be||0xc8;return function(_0x276572){if(_0x276572){return _0x232546[_0x5378('0x16')](_0xdc60be)['json'](_0x276572);}};}function respondWithFilteredResult(_0x1fe46e,_0x49bceb){return function(_0x36a055){if(_0x36a055){var _0x4357a9=typeof _0x49bceb[_0x5378('0x18')]===_0x5378('0x19')&&typeof _0x49bceb['limit']===_0x5378('0x19');var _0x2f6719=_0x36a055[_0x5378('0x1a')];var _0x20acfd=_0x4357a9?0x0:_0x49bceb[_0x5378('0x18')];var _0x4bf39d=_0x4357a9?_0x36a055[_0x5378('0x1a')]:_0x49bceb['offset']+_0x49bceb[_0x5378('0x1b')];var _0x59b105;if(_0x4bf39d>=_0x2f6719){_0x4bf39d=_0x2f6719;_0x59b105=0xc8;}else{_0x59b105=0xce;}_0x1fe46e['status'](_0x59b105);return _0x1fe46e[_0x5378('0x1c')](_0x5378('0x1d'),_0x20acfd+'-'+_0x4bf39d+'/'+_0x2f6719)['json'](_0x36a055);}return null;};}function patchUpdates(_0xd0ce08){return function(_0x5b776a){try{jsonpatch[_0x5378('0x1e')](_0x5b776a,_0xd0ce08,!![]);}catch(_0x485a42){return BPromise[_0x5378('0x1f')](_0x485a42);}return _0x5b776a[_0x5378('0x20')]();};}function saveUpdates(_0x3dde7b,_0x4e22a9){return function(_0x425bbb){if(_0x425bbb){return _0x425bbb[_0x5378('0x21')](_0x3dde7b)['then'](function(_0x1c847d){return _0x1c847d;});}return null;};}function removeEntity(_0x120a64,_0x1eaa87){return function(_0x4682b0){if(_0x4682b0){return _0x4682b0[_0x5378('0x22')]()[_0x5378('0x23')](function(){_0x120a64[_0x5378('0x16')](0xcc)[_0x5378('0x17')]();});}};}function handleEntityNotFound(_0x46de2a,_0x576bc4){return function(_0x559c22){if(!_0x559c22){_0x46de2a[_0x5378('0x15')](0x194);}return _0x559c22;};}function handleError(_0x32df3e,_0x12b3f7){_0x12b3f7=_0x12b3f7||0x1f4;return function(_0xc34567){logger['error'](_0xc34567['stack']);if(_0xc34567[_0x5378('0x24')]){delete _0xc34567[_0x5378('0x24')];}_0x32df3e[_0x5378('0x16')](_0x12b3f7)[_0x5378('0x25')](_0xc34567);};}exports['index']=function(_0x53f98d,_0x3aa678){var _0x2df665={},_0x4b2b0d={},_0x585603={'count':0x0,'rows':[]};var _0x13529c=_['map'](db[_0x5378('0x26')][_0x5378('0x27')],function(_0x2dc627){return{'name':_0x2dc627[_0x5378('0x28')],'type':_0x2dc627[_0x5378('0x29')][_0x5378('0x2a')]};});_0x4b2b0d[_0x5378('0x2b')]=_[_0x5378('0x2c')](_0x13529c,_0x5378('0x24'));_0x4b2b0d[_0x5378('0x2d')]=_[_0x5378('0x2e')](_0x53f98d[_0x5378('0x2d')]);_0x4b2b0d[_0x5378('0x2f')]=_[_0x5378('0x30')](_0x4b2b0d[_0x5378('0x2b')],_0x4b2b0d[_0x5378('0x2d')]);_0x2df665['attributes']=_[_0x5378('0x30')](_0x4b2b0d['model'],qs['fields'](_0x53f98d[_0x5378('0x2d')][_0x5378('0x31')]));_0x2df665[_0x5378('0x32')]=_0x2df665[_0x5378('0x32')][_0x5378('0x33')]?_0x2df665['attributes']:_0x4b2b0d[_0x5378('0x2b')];if(!_0x53f98d['query'][_0x5378('0x34')](_0x5378('0x35'))){_0x2df665[_0x5378('0x1b')]=qs[_0x5378('0x1b')](_0x53f98d[_0x5378('0x2d')]['limit']);_0x2df665[_0x5378('0x18')]=qs[_0x5378('0x18')](_0x53f98d[_0x5378('0x2d')][_0x5378('0x18')]);}_0x2df665['order']=qs[_0x5378('0x36')](_0x53f98d[_0x5378('0x2d')][_0x5378('0x36')]);_0x2df665[_0x5378('0x37')]=qs[_0x5378('0x2f')](_[_0x5378('0x38')](_0x53f98d[_0x5378('0x2d')],_0x4b2b0d[_0x5378('0x2f')]),_0x13529c);if(_0x53f98d[_0x5378('0x2d')][_0x5378('0x39')]){_0x2df665[_0x5378('0x37')]=_['merge'](_0x2df665[_0x5378('0x37')],{'$or':_[_0x5378('0x2c')](_0x13529c,function(_0x231682){if(_0x231682['type']!==_0x5378('0x3a')){var _0x1b62bd={};_0x1b62bd[_0x231682[_0x5378('0x24')]]={'$like':'%'+_0x53f98d[_0x5378('0x2d')]['filter']+'%'};return _0x1b62bd;}})});}_0x2df665=_['merge']({},_0x2df665,_0x53f98d[_0x5378('0x3b')]);var _0x168e3e={'where':_0x2df665['where']};return db[_0x5378('0x26')][_0x5378('0x1a')](_0x168e3e)[_0x5378('0x23')](function(_0x1d1446){_0x585603['count']=_0x1d1446;if(_0x53f98d[_0x5378('0x2d')][_0x5378('0x3c')]){_0x2df665[_0x5378('0x3d')]=[{'all':!![]}];}return db['ChatTransferReport'][_0x5378('0x3e')](_0x2df665);})[_0x5378('0x23')](function(_0x3207bc){_0x585603[_0x5378('0x3f')]=_0x3207bc;return _0x585603;})[_0x5378('0x23')](respondWithFilteredResult(_0x3aa678,_0x2df665))[_0x5378('0x40')](handleError(_0x3aa678,null));};exports[_0x5378('0x41')]=function(_0x302c3c,_0x53e2c0){var _0x15d210={'raw':!![],'where':{'id':_0x302c3c[_0x5378('0x42')]['id']}},_0x2faae6={};_0x2faae6[_0x5378('0x2b')]=_[_0x5378('0x2e')](db['ChatTransferReport']['rawAttributes']);_0x2faae6[_0x5378('0x2d')]=_['keys'](_0x302c3c[_0x5378('0x2d')]);_0x2faae6['filters']=_[_0x5378('0x30')](_0x2faae6[_0x5378('0x2b')],_0x2faae6[_0x5378('0x2d')]);_0x15d210[_0x5378('0x32')]=_[_0x5378('0x30')](_0x2faae6[_0x5378('0x2b')],qs[_0x5378('0x31')](_0x302c3c['query'][_0x5378('0x31')]));_0x15d210[_0x5378('0x32')]=_0x15d210['attributes'][_0x5378('0x33')]?_0x15d210[_0x5378('0x32')]:_0x2faae6[_0x5378('0x2b')];if(_0x302c3c['query']['includeAll']){_0x15d210['include']=[{'all':!![]}];}_0x15d210=_[_0x5378('0x43')]({},_0x15d210,_0x302c3c[_0x5378('0x3b')]);return db['ChatTransferReport'][_0x5378('0x44')](_0x15d210)['then'](handleEntityNotFound(_0x53e2c0,null))[_0x5378('0x23')](respondWithResult(_0x53e2c0,null))[_0x5378('0x40')](handleError(_0x53e2c0,null));};exports[_0x5378('0x45')]=function(_0x41b9f4,_0x135090){return db[_0x5378('0x26')]['create'](_0x41b9f4[_0x5378('0x46')],{})[_0x5378('0x23')](respondWithResult(_0x135090,0xc9))[_0x5378('0x40')](handleError(_0x135090,null));};exports[_0x5378('0x21')]=function(_0x47fe14,_0x343c08){if(_0x47fe14[_0x5378('0x46')]['id']){delete _0x47fe14[_0x5378('0x46')]['id'];}return db['ChatTransferReport']['find']({'where':{'id':_0x47fe14[_0x5378('0x42')]['id']}})[_0x5378('0x23')](handleEntityNotFound(_0x343c08,null))[_0x5378('0x23')](saveUpdates(_0x47fe14[_0x5378('0x46')],null))[_0x5378('0x23')](respondWithResult(_0x343c08,null))[_0x5378('0x40')](handleError(_0x343c08,null));};exports['destroy']=function(_0x247fe3,_0x1f26a6){return db['ChatTransferReport'][_0x5378('0x44')]({'where':{'id':_0x247fe3[_0x5378('0x42')]['id']}})[_0x5378('0x23')](handleEntityNotFound(_0x1f26a6,null))['then'](removeEntity(_0x1f26a6,null))['catch'](handleError(_0x1f26a6,null));};exports[_0x5378('0x47')]=function(_0x3a7961,_0x50aa0c){return db['ChatTransferReport'][_0x5378('0x47')]()[_0x5378('0x23')](respondWithResult(_0x50aa0c,null))[_0x5378('0x40')](handleError(_0x50aa0c,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index cefd166..0842a63 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 _0xab09=['moment','bluebird','path','rimraf','../../config/environment','exports','define','report_chat_transfer','uniqueid','lodash','util','../../config/logger','api'];(function(_0x39bf66,_0x35c96c){var _0x431030=function(_0x4328ac){while(--_0x4328ac){_0x39bf66['push'](_0x39bf66['shift']());}};_0x431030(++_0x35c96c);}(_0xab09,0x1c3));var _0x9ab0=function(_0x32ad69,_0x518f0c){_0x32ad69=_0x32ad69-0x0;var _0x1062ef=_0xab09[_0x32ad69];return _0x1062ef;};'use strict';var _=require(_0x9ab0('0x0'));var util=require(_0x9ab0('0x1'));var logger=require(_0x9ab0('0x2'))(_0x9ab0('0x3'));var moment=require(_0x9ab0('0x4'));var BPromise=require(_0x9ab0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9ab0('0x6'));var rimraf=require(_0x9ab0('0x7'));var config=require(_0x9ab0('0x8'));var attributes=require('./chatTransferReport.attributes');module[_0x9ab0('0x9')]=function(_0x2a2689,_0x662e2a){return _0x2a2689[_0x9ab0('0xa')]('ChatTransferReport',attributes,{'tableName':_0x9ab0('0xb'),'paranoid':![],'indexes':[{'name':_0x9ab0('0xc'),'fields':[_0x9ab0('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x96d0=['../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x523adf,_0x3e1620){var _0x283870=function(_0xa0e816){while(--_0xa0e816){_0x523adf['push'](_0x523adf['shift']());}};_0x283870(++_0x3e1620);}(_0x96d0,0xcd));var _0x096d=function(_0x26fdc8,_0x2f70c1){_0x26fdc8=_0x26fdc8-0x0;var _0x574ebd=_0x96d0[_0x26fdc8];return _0x574ebd;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x096d('0x0'))(_0x096d('0x1'));var moment=require(_0x096d('0x2'));var BPromise=require(_0x096d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x096d('0x4'));var attributes=require(_0x096d('0x5'));module[_0x096d('0x6')]=function(_0x338b4e,_0x430794){return _0x338b4e[_0x096d('0x7')](_0x096d('0x8'),attributes,{'tableName':_0x096d('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x096d('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 822c702..3f6a4ad 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 _0xd5c4=['error','ChatTransferReport,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xd5c4,0x124));var _0x4d5c=function(_0x55abfc,_0x1918d9){_0x55abfc=_0x55abfc-0x0;var _0x1086bc=_0xd5c4[_0x55abfc];return _0x1086bc;};'use strict';var _=require(_0x4d5c('0x0'));var util=require(_0x4d5c('0x1'));var moment=require(_0x4d5c('0x2'));var BPromise=require(_0x4d5c('0x3'));var rs=require(_0x4d5c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4d5c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4d5c('0x6'))('rpc');var config=require(_0x4d5c('0x7'));var jayson=require(_0x4d5c('0x8'));var client=jayson[_0x4d5c('0x9')][_0x4d5c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5e850d,_0x25e3ba,_0x129141){return new BPromise(function(_0x240c3c,_0x9d59f3){return client[_0x4d5c('0xb')](_0x5e850d,_0x129141)[_0x4d5c('0xc')](function(_0x2825dc){logger['info']('ChatTransferReport,\x20%s,\x20%s',_0x25e3ba,_0x4d5c('0xd'));logger[_0x4d5c('0xe')](_0x4d5c('0xf'),_0x25e3ba,_0x4d5c('0xd'),JSON['stringify'](_0x2825dc));if(_0x2825dc['error']){if(_0x2825dc[_0x4d5c('0x10')]['code']===0x1f4){logger[_0x4d5c('0x10')](_0x4d5c('0x11'),_0x25e3ba,_0x2825dc[_0x4d5c('0x10')][_0x4d5c('0x12')]);return _0x9d59f3(_0x2825dc['error']['message']);}logger[_0x4d5c('0x10')]('ChatTransferReport,\x20%s,\x20%s',_0x25e3ba,_0x2825dc[_0x4d5c('0x10')][_0x4d5c('0x12')]);return _0x240c3c(_0x2825dc[_0x4d5c('0x10')][_0x4d5c('0x12')]);}else{logger[_0x4d5c('0x13')](_0x4d5c('0x11'),_0x25e3ba,_0x4d5c('0xd'));_0x240c3c(_0x2825dc[_0x4d5c('0x14')][_0x4d5c('0x12')]);}})[_0x4d5c('0x15')](function(_0x4099b2){logger[_0x4d5c('0x10')](_0x4d5c('0x11'),_0x25e3ba,_0x4099b2);_0x9d59f3(_0x4099b2);});});} \ No newline at end of file +var _0xe23a=['util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatTransferReport,\x20%s,\x20%s','catch','lodash'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xe23a,0xaf));var _0xae23=function(_0x2c0dc0,_0x19900d){_0x2c0dc0=_0x2c0dc0-0x0;var _0x4c0990=_0xe23a[_0x2c0dc0];return _0x4c0990;};'use strict';var _=require(_0xae23('0x0'));var util=require(_0xae23('0x1'));var moment=require(_0xae23('0x2'));var BPromise=require(_0xae23('0x3'));var rs=require(_0xae23('0x4'));var fs=require('fs');var Redis=require(_0xae23('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xae23('0x6'));var config=require(_0xae23('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xae23('0x8')][_0xae23('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x23e41d,_0x4c3794,_0x5b3b72){return new BPromise(function(_0xb6640c,_0x3e2bb1){return client[_0xae23('0xa')](_0x23e41d,_0x5b3b72)[_0xae23('0xb')](function(_0x2134be){logger[_0xae23('0xc')]('ChatTransferReport,\x20%s,\x20%s',_0x4c3794,_0xae23('0xd'));logger[_0xae23('0xe')](_0xae23('0xf'),_0x4c3794,_0xae23('0xd'),JSON[_0xae23('0x10')](_0x2134be));if(_0x2134be[_0xae23('0x11')]){if(_0x2134be['error'][_0xae23('0x12')]===0x1f4){logger[_0xae23('0x11')]('ChatTransferReport,\x20%s,\x20%s',_0x4c3794,_0x2134be[_0xae23('0x11')][_0xae23('0x13')]);return _0x3e2bb1(_0x2134be[_0xae23('0x11')]['message']);}logger[_0xae23('0x11')](_0xae23('0x14'),_0x4c3794,_0x2134be['error'][_0xae23('0x13')]);return _0xb6640c(_0x2134be[_0xae23('0x11')][_0xae23('0x13')]);}else{logger[_0xae23('0xc')](_0xae23('0x14'),_0x4c3794,'request\x20sent');_0xb6640c(_0x2134be['result']['message']);}})[_0xae23('0x15')](function(_0x38f8e1){logger[_0xae23('0x11')](_0xae23('0x14'),_0x4c3794,_0x38f8e1);_0x3e2bb1(_0x38f8e1);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index b35edc4..f07bf1f 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 _0xf123=['destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./chatTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf123,0x123));var _0x3f12=function(_0x189d3c,_0x5efebf){_0x189d3c=_0x189d3c-0x0;var _0x485959=_0xf123[_0x189d3c];return _0x485959;};'use strict';var multer=require(_0x3f12('0x0'));var util=require(_0x3f12('0x1'));var path=require('path');var timeout=require(_0x3f12('0x2'));var express=require('express');var router=express[_0x3f12('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3f12('0x4'));var interaction=require(_0x3f12('0x5'));var config=require('../../config/environment');var controller=require(_0x3f12('0x6'));router[_0x3f12('0x7')]('/',auth[_0x3f12('0x8')](),controller[_0x3f12('0x9')]);router[_0x3f12('0x7')](_0x3f12('0xa'),auth[_0x3f12('0x8')](),controller[_0x3f12('0xb')]);router[_0x3f12('0x7')](_0x3f12('0xc'),auth[_0x3f12('0x8')](),controller[_0x3f12('0xd')]);router['post']('/',auth[_0x3f12('0x8')](),controller[_0x3f12('0xe')]);router['put'](_0x3f12('0xc'),auth[_0x3f12('0x8')](),controller['update']);router['delete'](_0x3f12('0xc'),auth[_0x3f12('0x8')](),controller[_0x3f12('0xf')]);module[_0x3f12('0x10')]=router; \ No newline at end of file +var _0xa99c=['/:id','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatTransferReport.controller','get','index','/describe','isAuthenticated','describe','post'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0xa99c,0x15a));var _0xca99=function(_0x368f76,_0x136ee8){_0x368f76=_0x368f76-0x0;var _0x86935e=_0xa99c[_0x368f76];return _0x86935e;};'use strict';var multer=require(_0xca99('0x0'));var util=require(_0xca99('0x1'));var path=require('path');var timeout=require(_0xca99('0x2'));var express=require(_0xca99('0x3'));var router=express[_0xca99('0x4')]();var fs_extra=require(_0xca99('0x5'));var auth=require(_0xca99('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xca99('0x7'));var controller=require(_0xca99('0x8'));router[_0xca99('0x9')]('/',auth['isAuthenticated'](),controller[_0xca99('0xa')]);router[_0xca99('0x9')](_0xca99('0xb'),auth[_0xca99('0xc')](),controller[_0xca99('0xd')]);router[_0xca99('0x9')]('/:id',auth[_0xca99('0xc')](),controller['show']);router[_0xca99('0xe')]('/',auth[_0xca99('0xc')](),controller['create']);router['put'](_0xca99('0xf'),auth['isAuthenticated'](),controller['update']);router[_0xca99('0x10')](_0xca99('0xf'),auth[_0xca99('0xc')](),controller[_0xca99('0x11')]);module[_0xca99('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index b03ed86..f80dad1 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 _0x59a2=['textarea','Comments','offlineForm','setDataValue','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','System','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','squared','rounded','We\x20are\x20here!','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Skip','Feedback','thumb','star','stringify','input','text','name','getDataValue','parse','onlineForm'];(function(_0x4f8912,_0x209a3d){var _0xe17e9d=function(_0x486ba7){while(--_0x486ba7){_0x4f8912['push'](_0x4f8912['shift']());}};_0xe17e9d(++_0x209a3d);}(_0x59a2,0x1ee));var _0x259a=function(_0x25efb8,_0x2ebd12){_0x25efb8=_0x25efb8-0x0;var _0x44de2a=_0x59a2[_0x25efb8];return _0x44de2a;};'use strict';var Sequelize=require(_0x259a('0x0'));var rs=require(_0x259a('0x1'));module[_0x259a('0x2')]={'name':{'type':Sequelize[_0x259a('0x3')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x259a('0x4')},'description':{'type':Sequelize[_0x259a('0x3')]},'mapKey':{'type':Sequelize[_0x259a('0x3')],'defaultValue':_0x259a('0x5')},'mapKeyOffline':{'type':Sequelize[_0x259a('0x3')],'defaultValue':_0x259a('0x5')},'key':{'type':Sequelize[_0x259a('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x259a('0x3')],'defaultValue':_0x259a('0x6')},'customerAlias':{'type':Sequelize[_0x259a('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x259a('0x3')],'allowNull':![],'defaultValue':_0x259a('0x7'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x259a('0x3')],'allowNull':![],'defaultValue':_0x259a('0x8'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x259a('0x3')],'allowNull':![],'defaultValue':_0x259a('0x8'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x259a('0x9')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x259a('0x3')]},'animation':{'type':Sequelize[_0x259a('0xa')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x259a('0xb')]('rounded',_0x259a('0xc')),'defaultValue':_0x259a('0xd')},'header_online':{'type':Sequelize[_0x259a('0x3')],'defaultValue':_0x259a('0xe')},'start_chat_button':{'type':Sequelize[_0x259a('0x3')],'defaultValue':_0x259a('0xf')},'offline_chat_button':{'type':Sequelize[_0x259a('0x3')],'defaultValue':_0x259a('0x10')},'header_offline':{'type':Sequelize[_0x259a('0x3')],'defaultValue':_0x259a('0x11')},'download_transcript':{'type':Sequelize[_0x259a('0xa')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x259a('0x3')],'defaultValue':_0x259a('0x12')},'defaultWhiteLabel':{'type':Sequelize[_0x259a('0xa')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x259a('0x13')]},'closingQuestion':{'type':Sequelize[_0x259a('0x3')],'defaultValue':_0x259a('0x14')},'formSubmitSuccessMessage':{'type':Sequelize[_0x259a('0x3')],'defaultValue':_0x259a('0x15')},'formSubmitFailureMessage':{'type':Sequelize[_0x259a('0x3')],'defaultValue':_0x259a('0x16')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0x259a('0x17')},'placeholderMessage':{'type':Sequelize[_0x259a('0x3')],'defaultValue':_0x259a('0x18')},'closingMessage':{'type':Sequelize[_0x259a('0x3')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0x259a('0x3')],'defaultValue':_0x259a('0x10')},'skipMessageButton':{'type':Sequelize[_0x259a('0x3')],'defaultValue':_0x259a('0x19')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x259a('0xa')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x259a('0xa')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x259a('0xa')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x259a('0x3')],'defaultValue':_0x259a('0x1a')},'ratingType':{'type':Sequelize[_0x259a('0xb')]('star',_0x259a('0x1b')),'defaultValue':_0x259a('0x1c')},'ratingStarsNumber':{'type':Sequelize[_0x259a('0x9')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x259a('0x13')],'defaultValue':function(){return JSON[_0x259a('0x1d')]({'items':[{'type':_0x259a('0x1e'),'variable':null,'config':{'placeholder':'name','type':_0x259a('0x1f'),'required':!![]},'props':{'title':_0x259a('0x20'),'helpText':''}},{'type':_0x259a('0x1e'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x259a('0x5'),'type':_0x259a('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x259a('0x21')]('onlineForm')?JSON[_0x259a('0x22')](this[_0x259a('0x21')](_0x259a('0x23'))):{};},'set':function(_0x4cd9bb){return this['setDataValue']('onlineForm',JSON[_0x259a('0x1d')](_0x4cd9bb));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x259a('0x1d')]({'items':[{'type':'input','props':{'title':_0x259a('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x259a('0x5'),'type':'email'},'variable':null},{'type':_0x259a('0x24'),'config':{'placeholder':_0x259a('0x25')},'props':{'title':'Comments','helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0x259a('0x21')](_0x259a('0x26'))?JSON[_0x259a('0x22')](this[_0x259a('0x21')]('offlineForm')):{};},'set':function(_0x4d87e0){return this[_0x259a('0x27')](_0x259a('0x26'),JSON[_0x259a('0x1d')](_0x4d87e0));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0x259a('0xa')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x259a('0xa')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x259a('0x3')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x259a('0x3')]},'waitingTitle':{'type':Sequelize[_0x259a('0x3')],'defaultValue':_0x259a('0x28')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x259a('0x29')},'offlineMessageSubject':{'type':Sequelize[_0x259a('0x3')],'defaultValue':_0x259a('0x2a')},'offlineMessageBody':{'type':Sequelize[_0x259a('0x3')],'defaultValue':_0x259a('0x2b')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0x259a('0x3')],'defaultValue':_0x259a('0x19')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x259a('0x10')},'enableCustomerAttachment':{'type':Sequelize[_0x259a('0xa')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x259a('0xa')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x259a('0x13')]},'showAgentAvatar':{'type':Sequelize[_0x259a('0xa')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x259a('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x259a('0x2c');}},'notificationSound':{'type':Sequelize[_0x259a('0xa')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x259a('0xa')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x259a('0xa')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x259a('0x3')],'defaultValue':_0x259a('0x2d')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0x259a('0x2e')},'verticalAlignment':{'type':Sequelize[_0x259a('0x9')],'defaultValue':0x1e},'labelText':{'type':Sequelize['STRING'],'defaultValue':_0x259a('0x2f')},'messagesAlignment':{'type':Sequelize[_0x259a('0x3')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0x259a('0x13')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x259a('0x9')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x259a('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x259a('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x259a('0x3')],'defaultValue':_0x259a('0x30')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x259a('0x9')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x259a('0xa')],'defaultValue':![],'comment':_0x259a('0x31'),'set':function(_0xe4766d){if(!_0xe4766d)this[_0x259a('0x27')](_0x259a('0x32'),null);this['setDataValue'](_0x259a('0x33'),_0xe4766d);}},'vidaooEscalation':{'type':Sequelize[_0x259a('0xa')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x259a('0x3')]},'vidaooTopic':{'type':Sequelize[_0x259a('0x3')],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize[_0x259a('0x3')],'defaultValue':function(){return _0x259a('0x34');}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x259a('0xa')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x5617=['Chat','Send','Contact\x20us','INTEGER','Powered\x20by\x20xCALLY','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','ENUM','star','thumb','TEXT','stringify','input','name','onlineForm','setDataValue','Comments','getDataValue','offlineForm','parse','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','bottom_right','CHAT','alternate','#fafafa','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','address','email','Agent','#011F6A','#ffffff','BOOLEAN','rounded','squared','We\x20are\x20here!'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x5617,0x13d));var _0x7561=function(_0xa3400,_0x3a980a){_0xa3400=_0xa3400-0x0;var _0x33dba2=_0x5617[_0xa3400];return _0x33dba2;};'use strict';var Sequelize=require(_0x7561('0x0'));var rs=require(_0x7561('0x1'));module[_0x7561('0x2')]={'name':{'type':Sequelize[_0x7561('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0x7561('0x3')],'allowNull':![],'unique':_0x7561('0x4')},'description':{'type':Sequelize[_0x7561('0x3')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0x7561('0x5')},'mapKeyOffline':{'type':Sequelize[_0x7561('0x3')],'defaultValue':_0x7561('0x5')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x7561('0x3')],'defaultValue':_0x7561('0x6')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0x7561('0x3')],'allowNull':![],'defaultValue':_0x7561('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x7561('0x3')],'allowNull':![],'defaultValue':_0x7561('0x7'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x7561('0x3')],'allowNull':![],'defaultValue':_0x7561('0x8'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x7561('0x3')],'allowNull':![],'defaultValue':_0x7561('0x8'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0x7561('0x3')]},'animation':{'type':Sequelize[_0x7561('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0x7561('0xa'),_0x7561('0xb')),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0x7561('0x3')],'defaultValue':_0x7561('0xc')},'start_chat_button':{'type':Sequelize[_0x7561('0x3')],'defaultValue':_0x7561('0xd')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x7561('0xe')},'header_offline':{'type':Sequelize[_0x7561('0x3')],'defaultValue':_0x7561('0xf')},'download_transcript':{'type':Sequelize[_0x7561('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x7561('0x10')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x7561('0x3')],'defaultValue':_0x7561('0x11')},'defaultWhiteLabel':{'type':Sequelize[_0x7561('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0x7561('0x3')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0x7561('0x12')},'formSubmitFailureMessage':{'type':Sequelize[_0x7561('0x3')],'defaultValue':_0x7561('0x13')},'noteTitle':{'type':Sequelize[_0x7561('0x3')],'defaultValue':_0x7561('0x14')},'placeholderMessage':{'type':Sequelize[_0x7561('0x3')],'defaultValue':_0x7561('0x15')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x7561('0x16')},'closingMessageButton':{'type':Sequelize[_0x7561('0x3')],'defaultValue':_0x7561('0xe')},'skipMessageButton':{'type':Sequelize[_0x7561('0x3')],'defaultValue':_0x7561('0x17')},'conditionAgreement':{'type':Sequelize[_0x7561('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x7561('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x7561('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x7561('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x7561('0x3')],'defaultValue':_0x7561('0x18')},'ratingType':{'type':Sequelize[_0x7561('0x19')](_0x7561('0x1a'),_0x7561('0x1b')),'defaultValue':_0x7561('0x1a')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x7561('0x1c')],'defaultValue':function(){return JSON[_0x7561('0x1d')]({'items':[{'type':_0x7561('0x1e'),'variable':null,'config':{'placeholder':_0x7561('0x1f'),'type':'text','required':!![]},'props':{'title':_0x7561('0x1f'),'helpText':''}},{'type':'input','props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x7561('0x5'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x7561('0x20'))?JSON['parse'](this['getDataValue'](_0x7561('0x20'))):{};},'set':function(_0x2b7061){return this[_0x7561('0x21')](_0x7561('0x20'),JSON[_0x7561('0x1d')](_0x2b7061));}},'offlineForm':{'type':Sequelize[_0x7561('0x1c')],'defaultValue':function(){return JSON[_0x7561('0x1d')]({'items':[{'type':_0x7561('0x1e'),'props':{'title':_0x7561('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x7561('0x5'),'type':'email'},'variable':null},{'type':'textarea','config':{'placeholder':'Comments'},'props':{'title':_0x7561('0x22'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0x7561('0x23')](_0x7561('0x24'))?JSON[_0x7561('0x25')](this['getDataValue'](_0x7561('0x24'))):{};},'set':function(_0x476ff3){return this[_0x7561('0x21')](_0x7561('0x24'),JSON['stringify'](_0x476ff3));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x7561('0x26')]();}},'autoclose':{'type':Sequelize[_0x7561('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x7561('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0x7561('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x7561('0x3')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0x7561('0x27')},'waitingMessage':{'type':Sequelize[_0x7561('0x3')],'defaultValue':_0x7561('0x28')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0x7561('0x29')},'offlineMessageBody':{'type':Sequelize[_0x7561('0x3')],'defaultValue':_0x7561('0x2a')},'enableUnmanagedNote':{'type':Sequelize[_0x7561('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x7561('0x2b')},'skipUnmanaged':{'type':Sequelize[_0x7561('0x3')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0x7561('0x3')],'defaultValue':_0x7561('0xe')},'enableCustomerAttachment':{'type':Sequelize[_0x7561('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x7561('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x7561('0x1c')]},'showAgentAvatar':{'type':Sequelize[_0x7561('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x7561('0x3')]},'notificationTemplate':{'type':Sequelize[_0x7561('0x1c')],'defaultValue':function(){return _0x7561('0x2c');}},'notificationSound':{'type':Sequelize[_0x7561('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x7561('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0x7561('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x7561('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0x7561('0x2d')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize['STRING'],'defaultValue':_0x7561('0x2e')},'messagesAlignment':{'type':Sequelize[_0x7561('0x3')],'defaultValue':_0x7561('0x2f')},'defaultTitle':{'type':Sequelize[_0x7561('0x3')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0x7561('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x7561('0x30'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x7561('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7561('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x7561('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0x7561('0x1c')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x7561('0x31')},'mandatoryDisposition':{'type':Sequelize[_0x7561('0x9')],'defaultValue':![],'comment':_0x7561('0x32'),'set':function(_0x4d30ba){if(!_0x4d30ba)this[_0x7561('0x21')](_0x7561('0x33'),null);this[_0x7561('0x21')](_0x7561('0x34'),_0x4d30ba);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x7561('0x3')]},'vidaooTopic':{'type':Sequelize[_0x7561('0x3')],'allowNull':![],'defaultValue':_0x7561('0x35')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0x7561('0x36');}},'vidaooMetadata':{'type':Sequelize[_0x7561('0x1c')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x7561('0x9')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x7561('0x1c')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 74e9ff2..c0516ec 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 _0x5c12=['sequelize','transaction','Attachment','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOffline','getSmtpOptions','sendMail','email','user','offlineMessageSubject','mimetype','subjectOffline','toPairsIn','mapValues','Chat','NotifyMailAccount','notifyMail','remove','addInteraction','omit','getInteractions','hasOwnProperty','Contact','fullname','internal','Tag','Tags','tag','getSnippet','interval','getProactiveActions','getLicense','virtual','increment','chatLicenseExceeded','ifTime','server/files/chat/iframe.ejs','3.13.0','origin','http://localhost:9000','address','testWebsiteWithWildcard','remote','x-real-ip','connection','remoteAddress','alignment','color','labelText','textColor','textButtonColor','color_button','hideWhenOffline','IntervalId','addApplications','Transaction','ISOLATION_LEVELS','ChatApplication','finally','getApplications','chatProactiveAction','getFields','online','false','items','fromKey','ChatOfflineMessage','Attachments','addAgents','userChatWebsite:save','removeAgents','isArray','emit','getAgents','util','path','fs-extra','lodash','querystring','html-to-text','ioredis','jayson/promise','../../components/parsers/qs','api','../../config/environment','../../errors/api','APINotFoundError','APIOutOfIntervalError','handleError','APIConflictError','./helpers/wildcard-expressions','url','URL','../../mysqldb','defaults','redis','socket.io-emitter','./chatWebsite.socket','register','client','http','request','info','request\x20sent','debug','error','code','message','ChatWebsite,\x20%s,\x20%s','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','then','destroy','get','ChatWebsites','stack','name','send','user-agent-parser','setUA','user-agent','cf-connecting-ip','x-forwarded-for','first','split','firstName','x-real-port','referer','browser','version','unknown','model','device','vendor','type','stringify','index','mandatoryDispositionPause','map','ChatWebsite','fieldName','key','query','keys','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','rawAttributes','includeAll','create','body','forEach','trim','testWildcardValidity','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression','find','Pause','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','order','removeDispositions','addAnswer','CannedAnswer','removeAnswers','ids','addLogo','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','addSystemAvatar','systemAvatar','getLogo','root','server/files/images/logos/default_logo.svg','../../config/license/util','custom','isNil','join','server/files/images/logos/','download','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','showCustomerAvatar','customerAvatar','existsSync','getSystemAvatar','Interval','resolve','timezone','notify','chat','from','From\x20is\x20mandatory','mapKey','MapKey\x20is\x20mandatory','Body\x20is\x20mandatory','customerIp','CmContact','No\x20available\x20attributes','createdAt','includes','updatedAt','CompanyId','ListId','Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20','CmList','List','Contacts','DESC','Intervals','format','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','applications','orderBy','priority','asc','account','Applications','list','headers','threadId','ChatInteraction','closed','Writing\x20on\x20closed\x20interaction','externalUrl','ContactId','interaction','contact','lastName','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','UserId','User','unshift','agent','waitForTheAssignedAgent','queueId','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','offline','files','no\x20available\x20attributes','difference','Sequelize','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','spread','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','originalname','server','attachments','offline-chat','basename','openNewInteraction'];(function(_0x11df3e,_0x21249e){var _0x5139c4=function(_0x5d8f55){while(--_0x5d8f55){_0x11df3e['push'](_0x11df3e['shift']());}};_0x5139c4(++_0x21249e);}(_0x5c12,0x188));var _0x25c1=function(_0x2a7b50,_0x545d55){_0x2a7b50=_0x2a7b50-0x0;var _0x4224c9=_0x5c12[_0x2a7b50];return _0x4224c9;};'use strict';var Mustache=require('mustache');var util=require(_0x25c1('0x0'));var path=require(_0x25c1('0x1'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x25c1('0x2'));var _=require(_0x25c1('0x3'));var querystring=require(_0x25c1('0x4'));var htmlToText=require(_0x25c1('0x5'));var Redis=require(_0x25c1('0x6'));var jayson=require(_0x25c1('0x7'));var qs=require(_0x25c1('0x8'));var logger=require('../../config/logger')(_0x25c1('0x9'));var config=require(_0x25c1('0xa'));var APIBadRequestError=require(_0x25c1('0xb'))['APIBadRequestError'];var APINotFoundError=require('../../errors/api')[_0x25c1('0xc')];var APIOutOfIntervalError=require(_0x25c1('0xb'))[_0x25c1('0xd')];var APIHandleError=require(_0x25c1('0xb'))[_0x25c1('0xe')];var APIConflictError=require('../../errors/api')[_0x25c1('0xf')];var wildcardUtils=require(_0x25c1('0x10'));var URL=require(_0x25c1('0x11'))[_0x25c1('0x12')];var db=require(_0x25c1('0x13'))['db'];config['redis']=_[_0x25c1('0x14')](config[_0x25c1('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x25c1('0x16'))(new Redis(config[_0x25c1('0x15')]));require(_0x25c1('0x17'))[_0x25c1('0x18')](socket);var client=jayson['client']['http']({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});var client9003=jayson[_0x25c1('0x19')][_0x25c1('0x1a')]({'port':0x232b});var client9001=jayson[_0x25c1('0x19')][_0x25c1('0x1a')]({'port':0x2329});function respondWithRpcPromise(_0x17a032,_0x4ea926,_0x4638f0,_0x55b62d){return new Promise(function(_0x5d631e,_0x5b852a){var _0x284712=_0x55b62d||client;return _0x284712[_0x25c1('0x1b')](_0x17a032,_0x4638f0)['then'](function(_0x4c55e7){logger[_0x25c1('0x1c')]('ChatWebsite,\x20%s,\x20%s',_0x4ea926,_0x25c1('0x1d'));logger[_0x25c1('0x1e')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x4ea926,'request\x20sent',JSON['stringify'](_0x4c55e7));if(_0x4c55e7[_0x25c1('0x1f')]){if(_0x4c55e7[_0x25c1('0x1f')][_0x25c1('0x20')]===0x1f4){logger[_0x25c1('0x1f')]('ChatWebsite,\x20%s,\x20%s',_0x4ea926,_0x4c55e7[_0x25c1('0x1f')][_0x25c1('0x21')]);return _0x5b852a(_0x4c55e7[_0x25c1('0x1f')][_0x25c1('0x21')]);}logger['error']('ChatWebsite,\x20%s,\x20%s',_0x4ea926,_0x4c55e7[_0x25c1('0x1f')][_0x25c1('0x21')]);return _0x5d631e(_0x4c55e7[_0x25c1('0x1f')][_0x25c1('0x21')]);}else{logger[_0x25c1('0x1c')](_0x25c1('0x22'),_0x4ea926,_0x25c1('0x1d'));_0x5d631e(_0x4c55e7[_0x25c1('0x23')][_0x25c1('0x21')]);}})[_0x25c1('0x24')](function(_0x2f78dd){logger[_0x25c1('0x1f')](_0x25c1('0x22'),_0x4ea926,_0x2f78dd);_0x5b852a(_0x2f78dd);});});}function respondWithStatusCode(_0x4915cc,_0x2dadae){_0x2dadae=_0x2dadae||0xcc;return function(_0x20dbb9){if(_0x20dbb9){return _0x4915cc[_0x25c1('0x25')](_0x2dadae);}return _0x4915cc[_0x25c1('0x26')](_0x2dadae)[_0x25c1('0x27')]();};}function respondWithResult(_0x326a5f,_0x5ad776){_0x5ad776=_0x5ad776||0xc8;return function(_0x17c924){if(_0x17c924){return _0x326a5f[_0x25c1('0x26')](_0x5ad776)[_0x25c1('0x28')](_0x17c924);}};}function respondWithFilteredResult(_0x38c1d5,_0x11c0ae){return function(_0x193a68){if(_0x193a68){var _0x5c56ab=typeof _0x11c0ae[_0x25c1('0x29')]==='undefined'&&typeof _0x11c0ae[_0x25c1('0x2a')]===_0x25c1('0x2b');var _0x2c42b9=_0x193a68[_0x25c1('0x2c')];var _0x2e80b5=_0x5c56ab?0x0:_0x11c0ae[_0x25c1('0x29')];var _0x1fd4e3=_0x5c56ab?_0x193a68[_0x25c1('0x2c')]:_0x11c0ae[_0x25c1('0x29')]+_0x11c0ae['limit'];var _0xa46f98;if(_0x1fd4e3>=_0x2c42b9){_0x1fd4e3=_0x2c42b9;_0xa46f98=0xc8;}else{_0xa46f98=0xce;}_0x38c1d5['status'](_0xa46f98);return _0x38c1d5['set'](_0x25c1('0x2d'),_0x2e80b5+'-'+_0x1fd4e3+'/'+_0x2c42b9)[_0x25c1('0x28')](_0x193a68);}return null;};}function saveUpdates(_0x4ef790){return function(_0x173f3e){if(_0x173f3e){return _0x173f3e['update'](_0x4ef790)[_0x25c1('0x2e')](function(_0x4834b3){return _0x4834b3;});}return null;};}function removeEntity(_0x1084b8){return function(_0x7f1e7a){if(_0x7f1e7a){return _0x7f1e7a[_0x25c1('0x2f')]()[_0x25c1('0x2e')](function(){var _0x1d4afc=_0x7f1e7a[_0x25c1('0x30')]({'plain':!![]});var _0x461d23=_0x25c1('0x31');return db['UserProfileResource'][_0x25c1('0x2f')]({'where':{'type':_0x461d23,'resourceId':_0x1d4afc['id']}})['then'](function(){return _0x7f1e7a;});})[_0x25c1('0x2e')](function(){_0x1084b8['status'](0xcc)[_0x25c1('0x27')]();});}};}function handleEntityNotFound(_0x1917e6){return function(_0x18f10c){if(!_0x18f10c){_0x1917e6[_0x25c1('0x25')](0x194);}return _0x18f10c;};}function handleError(_0x390083,_0x92184a){_0x92184a=_0x92184a||0x1f4;return function(_0x35e632){logger[_0x25c1('0x1f')](_0x35e632[_0x25c1('0x32')]);if(_0x35e632[_0x25c1('0x33')]){delete _0x35e632[_0x25c1('0x33')];}_0x390083[_0x25c1('0x26')](_0x92184a)[_0x25c1('0x34')](_0x35e632);};}function createInteractionObject(_0x1b6e92,_0x266f3b,_0x14288b,_0x349aef){var _0x30b1d7=require(_0x25c1('0x35'));var _0x357385=new _0x30b1d7();var _0x5c6d45=_0x357385[_0x25c1('0x36')](_0x14288b[_0x25c1('0x37')])['getResult']();var _0x32ab98=_0x266f3b['customerIp'];if(_0x14288b[_0x25c1('0x38')]){_0x32ab98=_0x14288b['cf-connecting-ip'];}else if(_0x14288b[_0x25c1('0x39')]){_0x32ab98=_[_0x25c1('0x3a')](_0x14288b[_0x25c1('0x39')][_0x25c1('0x3b')](','));}return{'ContactId':_0x349aef['id'],'ChatWebsiteId':_0x1b6e92,'from':(_0x349aef[_0x25c1('0x3c')]||'')+'\x20'+(_0x349aef['lastName']||''),'customerIp':_0x32ab98,'customerPort':_0x14288b[_0x25c1('0x3d')]?_0x14288b['x-real-port']:null,'referer':_0x266f3b[_0x25c1('0x3e')],'browserName':_0x5c6d45[_0x25c1('0x3f')][_0x25c1('0x33')]&&_0x5c6d45[_0x25c1('0x3f')]['version']?util['format']('%s\x20%s',_0x5c6d45[_0x25c1('0x3f')][_0x25c1('0x33')],_0x5c6d45['browser'][_0x25c1('0x40')]):'unknown','browserVersion':_0x5c6d45[_0x25c1('0x3f')][_0x25c1('0x40')]||_0x25c1('0x41'),'osName':util['format']('%s\x20%s',_0x5c6d45['os']['name'],_0x5c6d45['os'][_0x25c1('0x40')]),'osVersion':_0x5c6d45['os'][_0x25c1('0x40')],'deviceModel':_0x5c6d45['device'][_0x25c1('0x42')]&&_0x5c6d45[_0x25c1('0x43')][_0x25c1('0x44')]?util['format']('%s\x20%s\x20%s',_0x5c6d45['device']['model'],_0x5c6d45[_0x25c1('0x43')][_0x25c1('0x44')],_0x5c6d45['device'][_0x25c1('0x45')]):null,'deviceVendor':_0x5c6d45[_0x25c1('0x43')][_0x25c1('0x44')],'deviceType':_0x5c6d45[_0x25c1('0x43')][_0x25c1('0x45')],'formData':JSON[_0x25c1('0x46')](_0x266f3b)};}exports[_0x25c1('0x47')]=function(_0x552174,_0x545934){var _0x28fc89={'include':[{'model':db['Pause'],'as':_0x25c1('0x48')}]},_0x43d96a={},_0x389547={'count':0x0,'rows':[]};var _0x1c95e5=_[_0x25c1('0x49')](db[_0x25c1('0x4a')]['rawAttributes'],function(_0xb87cf1){return{'name':_0xb87cf1[_0x25c1('0x4b')],'type':_0xb87cf1[_0x25c1('0x45')][_0x25c1('0x4c')]};});_0x43d96a['model']=_['map'](_0x1c95e5,_0x25c1('0x33'));_0x43d96a[_0x25c1('0x4d')]=_[_0x25c1('0x4e')](_0x552174[_0x25c1('0x4d')]);_0x43d96a['filters']=_[_0x25c1('0x4f')](_0x43d96a[_0x25c1('0x42')],_0x43d96a['query']);_0x28fc89[_0x25c1('0x50')]=_[_0x25c1('0x4f')](_0x43d96a[_0x25c1('0x42')],qs[_0x25c1('0x51')](_0x552174['query']['fields']));_0x28fc89[_0x25c1('0x50')]=_0x28fc89[_0x25c1('0x50')][_0x25c1('0x52')]?_0x28fc89['attributes']:_0x43d96a[_0x25c1('0x42')];if(!_0x552174[_0x25c1('0x4d')]['hasOwnProperty'](_0x25c1('0x53'))){_0x28fc89[_0x25c1('0x2a')]=qs[_0x25c1('0x2a')](_0x552174[_0x25c1('0x4d')][_0x25c1('0x2a')]);_0x28fc89[_0x25c1('0x29')]=qs[_0x25c1('0x29')](_0x552174['query']['offset']);}_0x28fc89['order']=qs[_0x25c1('0x54')](_0x552174['query'][_0x25c1('0x54')]);_0x28fc89[_0x25c1('0x55')]=qs[_0x25c1('0x56')](_[_0x25c1('0x57')](_0x552174[_0x25c1('0x4d')],_0x43d96a[_0x25c1('0x56')]),_0x1c95e5);if(_0x552174['query'][_0x25c1('0x58')]){_0x28fc89[_0x25c1('0x55')]=_[_0x25c1('0x59')](_0x28fc89[_0x25c1('0x55')],{'$or':_[_0x25c1('0x49')](_0x1c95e5,function(_0xed718b){if(_0xed718b['type']!==_0x25c1('0x5a')){var _0x2e741f={};_0x2e741f[_0xed718b[_0x25c1('0x33')]]={'$like':'%'+_0x552174[_0x25c1('0x4d')][_0x25c1('0x58')]+'%'};return _0x2e741f;}})});}_0x28fc89=_['merge']({},_0x28fc89,_0x552174[_0x25c1('0x5b')]);var _0x3df219={'where':_0x28fc89['where']};return db[_0x25c1('0x4a')][_0x25c1('0x2c')](_0x3df219)[_0x25c1('0x2e')](function(_0x24c71a){_0x389547[_0x25c1('0x2c')]=_0x24c71a;if(_0x552174[_0x25c1('0x4d')]['includeAll']){_0x28fc89[_0x25c1('0x5c')]=[{'all':!![]}];}return db[_0x25c1('0x4a')][_0x25c1('0x5d')](_0x28fc89);})[_0x25c1('0x2e')](function(_0x286800){_0x389547[_0x25c1('0x5e')]=_0x286800;return _0x389547;})[_0x25c1('0x2e')](respondWithFilteredResult(_0x545934,_0x28fc89))[_0x25c1('0x24')](handleError(_0x545934,null));};exports[_0x25c1('0x5f')]=function(_0x455607,_0x270d67){var _0x2d9e6b={'raw':![],'where':{'id':_0x455607[_0x25c1('0x60')]['id']},'include':[{'model':db['Pause'],'as':_0x25c1('0x48')}]},_0x3ff0fa={};_0x3ff0fa[_0x25c1('0x42')]=_[_0x25c1('0x4e')](db[_0x25c1('0x4a')][_0x25c1('0x61')]);_0x3ff0fa[_0x25c1('0x4d')]=_[_0x25c1('0x4e')](_0x455607['query']);_0x3ff0fa[_0x25c1('0x56')]=_['intersection'](_0x3ff0fa[_0x25c1('0x42')],_0x3ff0fa[_0x25c1('0x4d')]);_0x2d9e6b[_0x25c1('0x50')]=_[_0x25c1('0x4f')](_0x3ff0fa[_0x25c1('0x42')],qs[_0x25c1('0x51')](_0x455607[_0x25c1('0x4d')][_0x25c1('0x51')]));_0x2d9e6b['attributes']=_0x2d9e6b[_0x25c1('0x50')][_0x25c1('0x52')]?_0x2d9e6b[_0x25c1('0x50')]:_0x3ff0fa[_0x25c1('0x42')];if(_0x455607[_0x25c1('0x4d')][_0x25c1('0x62')]){_0x2d9e6b[_0x25c1('0x5c')]=[{'all':!![]}];}_0x2d9e6b=_['merge']({},_0x2d9e6b,_0x455607[_0x25c1('0x5b')]);return db['ChatWebsite']['find'](_0x2d9e6b)['then'](handleEntityNotFound(_0x270d67,null))[_0x25c1('0x2e')](respondWithResult(_0x270d67,null))[_0x25c1('0x24')](handleError(_0x270d67,null));};exports[_0x25c1('0x63')]=function(_0x15cd6d,_0x45724c){var _0x58c743=null;_0x15cd6d[_0x25c1('0x64')]['address'][_0x25c1('0x3b')](',')[_0x25c1('0x65')](_0x2029ac=>{if(_0x2029ac[_0x25c1('0x66')]()!==''&&!wildcardUtils[_0x25c1('0x67')](_0x2029ac[_0x25c1('0x66')]())){_0x58c743=new APIBadRequestError('\x22'+_0x2029ac[_0x25c1('0x66')]()+'\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression');}});if(_0x58c743){return handleError(_0x45724c,null)(_0x58c743);}return db[_0x25c1('0x4a')][_0x25c1('0x63')](_0x15cd6d[_0x25c1('0x64')],{})[_0x25c1('0x2e')](function(_0x242149){var _0x425f3e=_0x15cd6d['user'][_0x25c1('0x30')]({'plain':!![]});if(!_0x425f3e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x425f3e[_0x25c1('0x68')]==='user'){var _0x588b5f=_0x242149[_0x25c1('0x30')]({'plain':!![]});var _0x58fd37='ChatWebsites';return db['UserProfileSection']['find']({'where':{'name':_0x58fd37,'userProfileId':_0x425f3e[_0x25c1('0x69')]},'raw':!![]})['then'](function(_0x11aafa){if(_0x11aafa&&_0x11aafa[_0x25c1('0x6a')]===0x0){return db[_0x25c1('0x6b')][_0x25c1('0x63')]({'name':_0x588b5f['name'],'resourceId':_0x588b5f['id'],'type':_0x11aafa['name'],'sectionId':_0x11aafa['id']},{})[_0x25c1('0x2e')](function(){return _0x242149;});}else{return _0x242149;}})[_0x25c1('0x24')](function(_0x5df07e){logger[_0x25c1('0x1f')](_0x25c1('0x6c'),_0x5df07e);throw _0x5df07e;});}return _0x242149;})[_0x25c1('0x2e')](respondWithResult(_0x45724c,0xc9))['catch'](handleError(_0x45724c,null));};exports[_0x25c1('0x6d')]=function(_0x48ecff,_0x21df62){var _0x1b501d=null;_0x48ecff[_0x25c1('0x64')]['address'][_0x25c1('0x3b')](',')[_0x25c1('0x65')](_0x2a3aad=>{if(_0x2a3aad['trim']()!==''&&!wildcardUtils[_0x25c1('0x67')](_0x2a3aad[_0x25c1('0x66')]())){_0x1b501d=new APIBadRequestError('\x22'+_0x2a3aad[_0x25c1('0x66')]()+_0x25c1('0x6e'));}});if(_0x1b501d){return handleError(_0x21df62,null)(_0x1b501d);}if(_0x48ecff[_0x25c1('0x64')]['id']){delete _0x48ecff[_0x25c1('0x64')]['id'];}return db[_0x25c1('0x4a')][_0x25c1('0x6f')]({'where':{'id':_0x48ecff[_0x25c1('0x60')]['id']},'include':[{'model':db[_0x25c1('0x70')],'as':_0x25c1('0x48')}]})[_0x25c1('0x2e')](handleEntityNotFound(_0x21df62,null))[_0x25c1('0x2e')](saveUpdates(_0x48ecff[_0x25c1('0x64')],null))['then'](respondWithResult(_0x21df62,null))[_0x25c1('0x24')](handleError(_0x21df62,null));};exports[_0x25c1('0x2f')]=function(_0x138376,_0x35792c){return db[_0x25c1('0x4a')][_0x25c1('0x6f')]({'where':{'id':_0x138376[_0x25c1('0x60')]['id']}})[_0x25c1('0x2e')](handleEntityNotFound(_0x35792c,null))[_0x25c1('0x2e')](removeEntity(_0x35792c,null))[_0x25c1('0x24')](handleError(_0x35792c,null));};exports[_0x25c1('0x71')]=function(_0x5bd027,_0x1a1a02){return db['ChatWebsite'][_0x25c1('0x71')]()[_0x25c1('0x2e')](respondWithResult(_0x1a1a02,null))['catch'](handleError(_0x1a1a02,null));};exports[_0x25c1('0x72')]=function(_0x13755b,_0x833e8f){if(_0x13755b['body']['id']){delete _0x13755b[_0x25c1('0x64')]['id'];}return db[_0x25c1('0x4a')]['find']({'where':{'id':_0x13755b[_0x25c1('0x60')]['id']}})[_0x25c1('0x2e')](handleEntityNotFound(_0x833e8f,null))[_0x25c1('0x2e')](function(_0x50ce85){if(_0x50ce85){_0x13755b[_0x25c1('0x64')][_0x25c1('0x73')]=_0x50ce85['id'];return db[_0x25c1('0x74')][_0x25c1('0x63')](_0x13755b['body']);}})[_0x25c1('0x2e')](respondWithResult(_0x833e8f,null))['catch'](handleError(_0x833e8f,null));};exports[_0x25c1('0x75')]=function(_0x35153c,_0x48e3bc){var _0x41e5c5={'raw':![],'where':{}};var _0x5f55c1={};var _0x3e14e6={'count':0x0,'rows':[]};return db[_0x25c1('0x4a')][_0x25c1('0x76')]({'where':{'id':_0x35153c[_0x25c1('0x60')]['id']}})[_0x25c1('0x2e')](handleEntityNotFound(_0x48e3bc,null))[_0x25c1('0x2e')](function(_0xed1dc5){if(_0xed1dc5){_0x5f55c1['model']=_['keys'](db[_0x25c1('0x74')][_0x25c1('0x61')]);_0x5f55c1['query']=_[_0x25c1('0x4e')](_0x35153c[_0x25c1('0x4d')]);_0x5f55c1[_0x25c1('0x56')]=_['intersection'](_0x5f55c1['model'],_0x5f55c1[_0x25c1('0x4d')]);_0x41e5c5['attributes']=_[_0x25c1('0x4f')](_0x5f55c1[_0x25c1('0x42')],qs[_0x25c1('0x51')](_0x35153c[_0x25c1('0x4d')]['fields']));_0x41e5c5['attributes']=_0x41e5c5[_0x25c1('0x50')]['length']?_0x41e5c5[_0x25c1('0x50')]:_0x5f55c1[_0x25c1('0x42')];if(!_0x35153c[_0x25c1('0x4d')]['hasOwnProperty'](_0x25c1('0x53'))){_0x41e5c5[_0x25c1('0x2a')]=qs[_0x25c1('0x2a')](_0x35153c[_0x25c1('0x4d')][_0x25c1('0x2a')]);_0x41e5c5[_0x25c1('0x29')]=qs[_0x25c1('0x29')](_0x35153c[_0x25c1('0x4d')][_0x25c1('0x29')]);}_0x41e5c5[_0x25c1('0x77')]=qs[_0x25c1('0x54')](_0x35153c['query'][_0x25c1('0x54')]);_0x41e5c5['where']=qs[_0x25c1('0x56')](_[_0x25c1('0x57')](_0x35153c[_0x25c1('0x4d')],_0x5f55c1[_0x25c1('0x56')]));_0x41e5c5[_0x25c1('0x55')][_0x25c1('0x73')]=_0xed1dc5['id'];if(_0x35153c[_0x25c1('0x4d')]['filter']){_0x41e5c5['where']=_[_0x25c1('0x59')](_0x41e5c5['where'],{'$or':_['map'](_0x41e5c5[_0x25c1('0x50')],function(_0x20c41d){var _0x21f642={};_0x21f642[_0x20c41d]={'$like':'%'+_0x35153c[_0x25c1('0x4d')][_0x25c1('0x58')]+'%'};return _0x21f642;})});}_0x41e5c5=_[_0x25c1('0x59')]({},_0x41e5c5,_0x35153c['options']);return db[_0x25c1('0x74')][_0x25c1('0x2c')]({'where':_0x41e5c5[_0x25c1('0x55')]})[_0x25c1('0x2e')](function(_0x4a3b87){_0x3e14e6[_0x25c1('0x2c')]=_0x4a3b87;if(_0x35153c[_0x25c1('0x4d')][_0x25c1('0x62')]){_0x41e5c5[_0x25c1('0x5c')]=[{'all':!![]}];}return db['Disposition'][_0x25c1('0x5d')](_0x41e5c5);})[_0x25c1('0x2e')](function(_0x27bdf6){_0x3e14e6[_0x25c1('0x5e')]=_0x27bdf6;return _0x3e14e6;});}})[_0x25c1('0x2e')](respondWithFilteredResult(_0x48e3bc,_0x41e5c5))['catch'](handleError(_0x48e3bc,null));};exports[_0x25c1('0x78')]=function(_0x4a79a0,_0x174af3){return db['ChatWebsite'][_0x25c1('0x6f')]({'where':{'id':_0x4a79a0[_0x25c1('0x60')]['id']}})[_0x25c1('0x2e')](handleEntityNotFound(_0x174af3,null))['then'](function(_0x3e1429){if(_0x3e1429){return _0x3e1429['removeDispositions'](_0x4a79a0[_0x25c1('0x4d')]['ids']);}})[_0x25c1('0x2e')](respondWithStatusCode(_0x174af3,null))[_0x25c1('0x24')](handleError(_0x174af3,null));};exports[_0x25c1('0x79')]=function(_0x137725,_0x40b950){if(_0x137725[_0x25c1('0x64')]['id']){delete _0x137725['body']['id'];}return db[_0x25c1('0x4a')][_0x25c1('0x6f')]({'where':{'id':_0x137725[_0x25c1('0x60')]['id']}})['then'](handleEntityNotFound(_0x40b950,null))['then'](function(_0xfa8a4c){if(_0xfa8a4c){_0x137725[_0x25c1('0x64')][_0x25c1('0x73')]=_0xfa8a4c['id'];return db[_0x25c1('0x7a')][_0x25c1('0x63')](_0x137725[_0x25c1('0x64')]);}})[_0x25c1('0x2e')](respondWithResult(_0x40b950,null))['catch'](handleError(_0x40b950,null));};exports['getAnswers']=function(_0x5aabfa,_0x513f6a){var _0x14c05a={'raw':![],'where':{}};var _0xc68a7f={};var _0x158120={'count':0x0,'rows':[]};return db[_0x25c1('0x4a')][_0x25c1('0x76')]({'where':{'id':_0x5aabfa[_0x25c1('0x60')]['id']}})[_0x25c1('0x2e')](handleEntityNotFound(_0x513f6a,null))[_0x25c1('0x2e')](function(_0x23463e){if(_0x23463e){_0xc68a7f[_0x25c1('0x42')]=_[_0x25c1('0x4e')](db[_0x25c1('0x7a')][_0x25c1('0x61')]);_0xc68a7f[_0x25c1('0x4d')]=_[_0x25c1('0x4e')](_0x5aabfa['query']);_0xc68a7f[_0x25c1('0x56')]=_[_0x25c1('0x4f')](_0xc68a7f['model'],_0xc68a7f[_0x25c1('0x4d')]);_0x14c05a[_0x25c1('0x50')]=_['intersection'](_0xc68a7f['model'],qs['fields'](_0x5aabfa['query'][_0x25c1('0x51')]));_0x14c05a[_0x25c1('0x50')]=_0x14c05a[_0x25c1('0x50')]['length']?_0x14c05a[_0x25c1('0x50')]:_0xc68a7f[_0x25c1('0x42')];if(!_0x5aabfa[_0x25c1('0x4d')]['hasOwnProperty'](_0x25c1('0x53'))){_0x14c05a[_0x25c1('0x2a')]=qs['limit'](_0x5aabfa[_0x25c1('0x4d')][_0x25c1('0x2a')]);_0x14c05a[_0x25c1('0x29')]=qs[_0x25c1('0x29')](_0x5aabfa[_0x25c1('0x4d')]['offset']);}_0x14c05a[_0x25c1('0x77')]=qs[_0x25c1('0x54')](_0x5aabfa['query'][_0x25c1('0x54')]);_0x14c05a[_0x25c1('0x55')]=qs[_0x25c1('0x56')](_[_0x25c1('0x57')](_0x5aabfa[_0x25c1('0x4d')],_0xc68a7f[_0x25c1('0x56')]));_0x14c05a[_0x25c1('0x55')][_0x25c1('0x73')]=_0x23463e['id'];if(_0x5aabfa[_0x25c1('0x4d')]['filter']){_0x14c05a[_0x25c1('0x55')]=_[_0x25c1('0x59')](_0x14c05a[_0x25c1('0x55')],{'$or':_[_0x25c1('0x49')](_0x14c05a['attributes'],function(_0x2dcbb8){var _0x36c50a={};_0x36c50a[_0x2dcbb8]={'$like':'%'+_0x5aabfa[_0x25c1('0x4d')][_0x25c1('0x58')]+'%'};return _0x36c50a;})});}_0x14c05a=_[_0x25c1('0x59')]({},_0x14c05a,_0x5aabfa[_0x25c1('0x5b')]);return db[_0x25c1('0x7a')][_0x25c1('0x2c')]({'where':_0x14c05a['where']})[_0x25c1('0x2e')](function(_0x4c4207){_0x158120[_0x25c1('0x2c')]=_0x4c4207;if(_0x5aabfa[_0x25c1('0x4d')][_0x25c1('0x62')]){_0x14c05a[_0x25c1('0x5c')]=[{'all':!![]}];}return db[_0x25c1('0x7a')][_0x25c1('0x5d')](_0x14c05a);})['then'](function(_0x307a83){_0x158120[_0x25c1('0x5e')]=_0x307a83;return _0x158120;});}})['then'](respondWithFilteredResult(_0x513f6a,_0x14c05a))[_0x25c1('0x24')](handleError(_0x513f6a,null));};exports[_0x25c1('0x7b')]=function(_0x33e71d,_0x1925a4){return db[_0x25c1('0x4a')][_0x25c1('0x6f')]({'where':{'id':_0x33e71d[_0x25c1('0x60')]['id']}})[_0x25c1('0x2e')](handleEntityNotFound(_0x1925a4,null))[_0x25c1('0x2e')](function(_0x438486){if(_0x438486){return _0x438486[_0x25c1('0x7b')](_0x33e71d['query'][_0x25c1('0x7c')]);}})[_0x25c1('0x2e')](respondWithStatusCode(_0x1925a4,null))['catch'](handleError(_0x1925a4,null));};exports[_0x25c1('0x7d')]=function(_0x629ba6,_0x21de80){_0x629ba6[_0x25c1('0x64')][_0x25c1('0x7e')]=_0x629ba6[_0x25c1('0x7f')][_0x25c1('0x80')];return db[_0x25c1('0x4a')][_0x25c1('0x6f')]({'where':{'id':_0x629ba6[_0x25c1('0x60')]['id']}})['then'](handleEntityNotFound(_0x21de80,null))[_0x25c1('0x2e')](saveUpdates(_0x629ba6['body'],null))[_0x25c1('0x2e')](respondWithResult(_0x21de80,null))[_0x25c1('0x24')](handleError(_0x21de80,null));};exports[_0x25c1('0x81')]=function(_0x3bf69f,_0x47897e){_0x3bf69f[_0x25c1('0x64')][_0x25c1('0x82')]=_0x3bf69f[_0x25c1('0x7f')][_0x25c1('0x80')];return db['ChatWebsite']['find']({'where':{'id':_0x3bf69f['params']['id']}})[_0x25c1('0x2e')](handleEntityNotFound(_0x47897e,null))[_0x25c1('0x2e')](saveUpdates(_0x3bf69f[_0x25c1('0x64')],null))[_0x25c1('0x2e')](respondWithResult(_0x47897e,null))[_0x25c1('0x24')](handleError(_0x47897e,null));};exports[_0x25c1('0x83')]=function(_0x360415,_0x4af1db){_0x360415[_0x25c1('0x64')]['customerAvatar']=_0x360415['file'][_0x25c1('0x80')];return db[_0x25c1('0x4a')][_0x25c1('0x6f')]({'where':{'id':_0x360415[_0x25c1('0x60')]['id']}})[_0x25c1('0x2e')](handleEntityNotFound(_0x4af1db,null))[_0x25c1('0x2e')](saveUpdates(_0x360415[_0x25c1('0x64')],null))[_0x25c1('0x2e')](respondWithResult(_0x4af1db,null))[_0x25c1('0x24')](handleError(_0x4af1db,null));};exports[_0x25c1('0x84')]=function(_0x53259d,_0x58a64a){_0x53259d[_0x25c1('0x64')][_0x25c1('0x85')]=_0x53259d['file'][_0x25c1('0x80')];return db[_0x25c1('0x4a')]['find']({'where':{'id':_0x53259d[_0x25c1('0x60')]['id']}})[_0x25c1('0x2e')](handleEntityNotFound(_0x58a64a,null))[_0x25c1('0x2e')](saveUpdates(_0x53259d[_0x25c1('0x64')],null))[_0x25c1('0x2e')](respondWithResult(_0x58a64a,null))[_0x25c1('0x24')](handleError(_0x58a64a,null));};exports[_0x25c1('0x86')]=function(_0xc165a,_0x475aa2){var _0x349d97=path['join'](config[_0x25c1('0x87')],_0x25c1('0x88'));var _0x30bd45={'where':{'id':_0xc165a['params']['id']},'attributes':['id',_0x25c1('0x7e')],'raw':!![]};var _0x158a0f=![];return require(_0x25c1('0x89'))['getLicense']()[_0x25c1('0x2e')](function(_0x1894a6){if(_0x1894a6){_0x158a0f=_0x1894a6[_0x25c1('0x8a')];}})[_0x25c1('0x2e')](function(){return db[_0x25c1('0x4a')][_0x25c1('0x6f')](_0x30bd45);})['then'](handleEntityNotFound(_0x475aa2,null))[_0x25c1('0x2e')](function(_0x10e4ca){if(_0x10e4ca){if(!_[_0x25c1('0x8b')](_0x10e4ca[_0x25c1('0x7e')])){if(fs['existsSync'](path[_0x25c1('0x8c')](config[_0x25c1('0x87')],_0x25c1('0x8d'),_0x10e4ca[_0x25c1('0x7e')]))&&_0x158a0f){_0x349d97=path[_0x25c1('0x8c')](config[_0x25c1('0x87')],_0x25c1('0x8d'),_0x10e4ca[_0x25c1('0x7e')]);}}return _0x475aa2[_0x25c1('0x8e')](_0x349d97);}})[_0x25c1('0x24')](handleError(_0x475aa2,null));};exports['getAvatar']=function(_0x10abc4,_0x2ecac3){var _0x2fa46e=path[_0x25c1('0x8c')](config[_0x25c1('0x87')],_0x25c1('0x8f'));var _0x5f1c08={'where':{'id':_0x10abc4['params']['id']},'attributes':['id',_0x25c1('0x82')],'raw':!![]};return db[_0x25c1('0x4a')][_0x25c1('0x6f')](_0x5f1c08)[_0x25c1('0x2e')](handleEntityNotFound(_0x2ecac3,null))[_0x25c1('0x2e')](function(_0x2ed32a){if(_0x2ed32a){if(!_['isNil'](_0x2ed32a['agentAvatar'])){if(fs['existsSync'](path[_0x25c1('0x8c')](config[_0x25c1('0x87')],_0x25c1('0x90'),_0x2ed32a['agentAvatar']))){_0x2fa46e=path[_0x25c1('0x8c')](config[_0x25c1('0x87')],_0x25c1('0x90'),_0x2ed32a[_0x25c1('0x82')]);}}return _0x2ecac3[_0x25c1('0x8e')](_0x2fa46e);}})[_0x25c1('0x24')](handleError(_0x2ecac3,null));};exports[_0x25c1('0x91')]=function(_0x34c639,_0x412bb7){var _0x110385=path[_0x25c1('0x8c')](config[_0x25c1('0x87')],'server/files/images/avatars/customer_avatar.png');var _0x1f934f={'where':{'id':_0x34c639[_0x25c1('0x60')]['id']},'attributes':['id','customerAvatar',_0x25c1('0x92')],'raw':!![]};return db[_0x25c1('0x4a')][_0x25c1('0x6f')](_0x1f934f)[_0x25c1('0x2e')](handleEntityNotFound(_0x412bb7,null))[_0x25c1('0x2e')](function(_0x51dffd){if(_0x51dffd){if(!_[_0x25c1('0x8b')](_0x51dffd[_0x25c1('0x93')])){if(fs[_0x25c1('0x94')](path[_0x25c1('0x8c')](config['root'],_0x25c1('0x90'),_0x51dffd['customerAvatar']))&&_0x51dffd[_0x25c1('0x92')]){_0x110385=path[_0x25c1('0x8c')](config[_0x25c1('0x87')],'server/files/images/avatars/',_0x51dffd[_0x25c1('0x93')]);}}return _0x412bb7[_0x25c1('0x8e')](_0x110385);}})[_0x25c1('0x24')](handleError(_0x412bb7,null));};exports[_0x25c1('0x95')]=function(_0x385ffe,_0x230f47){var _0x2e18b5=path[_0x25c1('0x8c')](config[_0x25c1('0x87')],'server/files/images/avatars/system_avatar.png');var _0xbbce83={'where':{'id':_0x385ffe[_0x25c1('0x60')]['id']},'attributes':['id',_0x25c1('0x85')],'raw':!![]};return db[_0x25c1('0x4a')][_0x25c1('0x6f')](_0xbbce83)['then'](handleEntityNotFound(_0x230f47,null))[_0x25c1('0x2e')](function(_0xc402d1){if(_0xc402d1){if(!_[_0x25c1('0x8b')](_0xc402d1['systemAvatar'])){if(fs[_0x25c1('0x94')](path[_0x25c1('0x8c')](config[_0x25c1('0x87')],'server/files/images/avatars/',_0xc402d1['systemAvatar']))){_0x2e18b5=path['join'](config[_0x25c1('0x87')],_0x25c1('0x90'),_0xc402d1[_0x25c1('0x85')]);}}return _0x230f47[_0x25c1('0x8e')](_0x2e18b5);}})[_0x25c1('0x24')](handleError(_0x230f47,null));};function checkWebsiteInterval(_0x13d48c){var _0x468312=_0x13d48c[_0x25c1('0x96')];if(!_0x468312){return Promise[_0x25c1('0x97')](_0x13d48c);}var _0x4a436d=_0x13d48c[_0x25c1('0x98')]||undefined;return _0x468312['ifTime'](_0x4a436d)['then'](function(_0x355e71){if(!_0x355e71){throw new APIOutOfIntervalError();}return _0x13d48c;});}exports[_0x25c1('0x99')]=function(_0x17d6dd,_0x762495){var _0x3a5e79={'body':_0x17d6dd['body'],'channel':_0x25c1('0x9a')};var _0x5ae7d3=[];var _0x3a9e3b=[];var _0x287f68={};var _0x1055b7=![];if(_0x17d6dd[_0x25c1('0x64')]['id']){delete _0x17d6dd['body']['id'];}if(_['isNil'](_0x17d6dd[_0x25c1('0x64')][_0x25c1('0x9b')])){throw new APIBadRequestError(_0x25c1('0x9c'));}if(_['isNil'](_0x17d6dd['body'][_0x25c1('0x9d')])){throw new APIBadRequestError(_0x25c1('0x9e'));}if(_['isEmpty'](_0x17d6dd[_0x25c1('0x64')][_0x25c1('0x64')])){throw new APIBadRequestError(_0x25c1('0x9f'));}var _0x33f8ee=_0x17d6dd[_0x25c1('0x64')][_0x25c1('0xa0')]&&_0x17d6dd[_0x25c1('0x64')][_0x25c1('0x3e')];return db[_0x25c1('0xa1')][_0x25c1('0x71')]()[_0x25c1('0x2e')](function(_0x3675c2){if(!_0x3675c2){throw new Error(_0x25c1('0xa2'));}_0x5ae7d3=Object[_0x25c1('0x4e')](_0x3675c2)['filter'](function(_0x38e111){return![_0x25c1('0xa3'),'updatedAt'][_0x25c1('0xa4')](_0x38e111);});_0x3a9e3b=Object['keys'](_0x3675c2)[_0x25c1('0x58')](function(_0x4370b2){return!['createdAt',_0x25c1('0xa5'),_0x25c1('0xa6'),_0x25c1('0xa7')][_0x25c1('0xa4')](_0x4370b2);});if(!_[_0x25c1('0xa4')](_0x3a9e3b,_0x17d6dd['body'][_0x25c1('0x9d')])){throw new APIBadRequestError(_0x25c1('0xa8')+_0x3a9e3b[_0x25c1('0x8c')](',\x20'));}_0x287f68[_0x17d6dd[_0x25c1('0x64')]['mapKey']]=_0x17d6dd[_0x25c1('0x64')][_0x25c1('0x9b')];})[_0x25c1('0x2e')](function(){return db['ChatWebsite'][_0x25c1('0x6f')]({'where':{'id':_0x17d6dd[_0x25c1('0x60')]['id']},'include':[{'model':db[_0x25c1('0xa9')],'as':_0x25c1('0xaa'),'include':[{'model':db[_0x25c1('0xa1')],'as':_0x25c1('0xab'),'where':_0x287f68,'limit':0x1,'order':[[_0x25c1('0xa5'),_0x25c1('0xac')]]}]},{'model':db['ChatApplication'],'as':'Applications'},{'model':db['Interval'],'as':_0x25c1('0x96'),'include':[{'model':db[_0x25c1('0x96')],'as':_0x25c1('0xad'),'attributes':['id','interval'],'raw':!![]}]}]});})[_0x25c1('0x2e')](function(_0x9069a2){if(!_0x9069a2){throw new APINotFoundError(util[_0x25c1('0xae')](_0x25c1('0xaf'),_0x17d6dd[_0x25c1('0x60')]['id']));}if(_0x33f8ee){return checkWebsiteInterval(_0x9069a2);}return _0x9069a2;})[_0x25c1('0x2e')](function(_0x764652){_0x3a5e79['account']=_0x764652;_0x3a5e79[_0x25c1('0xb0')]=_[_0x25c1('0xb1')](_0x764652['Applications'],[_0x25c1('0xb2')],[_0x25c1('0xb3')]);if(_0x3a5e79[_0x25c1('0xb4')][_0x25c1('0xb5')]){delete _0x3a5e79[_0x25c1('0xb4')][_0x25c1('0xb5')];}_0x3a5e79[_0x25c1('0xb6')]=_0x764652[_0x25c1('0xaa')]||{'id':_0x764652[_0x25c1('0xa7')]};if(_0x3a5e79[_0x25c1('0xb6')]&&_0x3a5e79[_0x25c1('0xb6')][_0x25c1('0xab')][_0x25c1('0x52')]){return _0x3a5e79[_0x25c1('0xb6')][_0x25c1('0xab')][0x0];}var _0x5d8f18=_['defaults'](_0x17d6dd[_0x25c1('0x64')],{'firstName':_0x17d6dd[_0x25c1('0x64')]['from'],'ListId':_0x764652[_0x25c1('0xa7')]});_0x5d8f18[_0x17d6dd[_0x25c1('0x64')][_0x25c1('0x9d')]]=_0x17d6dd['body'][_0x25c1('0x9b')];return db[_0x25c1('0xa1')][_0x25c1('0x63')](_0x5d8f18,{'fields':_0x5ae7d3,'raw':!![]});})[_0x25c1('0x2e')](function(_0x1a0354){_0x3a5e79['contact']=_0x1a0354;var _0x2e6dfd=createInteractionObject(_0x17d6dd[_0x25c1('0x60')]['id'],_0x17d6dd[_0x25c1('0x64')],_0x17d6dd[_0x25c1('0xb7')],_0x1a0354);var _0x4fa88e={'ChatWebsiteId':_0x17d6dd['params']['id']};if(_0x17d6dd['body']['threadId']){_0x4fa88e[_0x25c1('0xb8')]=_0x17d6dd['body'][_0x25c1('0xb8')];_0x4fa88e['closed']=![];return db[_0x25c1('0xb9')][_0x25c1('0x6f')]({'where':_0x4fa88e})[_0x25c1('0x2e')](function(_0x12a17f){var _0x2c2395=_0x17d6dd[_0x25c1('0x64')][_0x25c1('0xa0')]&&_0x17d6dd['body']['referer'];if(_0x12a17f){_0x1055b7=!![];return _0x12a17f;}else if(!_0x2c2395&&_0x12a17f&&_0x12a17f[_0x25c1('0xba')]){throw new APIConflictError(_0x25c1('0xbb'));}_0x2e6dfd[_0x25c1('0xb8')]=_0x17d6dd[_0x25c1('0x64')][_0x25c1('0xb8')];_0x2e6dfd['externalUrl']=_0x17d6dd['body'][_0x25c1('0xbc')];return db[_0x25c1('0xb9')][_0x25c1('0x63')](_0x2e6dfd);});}_0x4fa88e[_0x25c1('0xbd')]=_0x1a0354['id'];if(_0x17d6dd[_0x25c1('0x64')][_0x25c1('0xbe')]&&_0x17d6dd[_0x25c1('0x64')][_0x25c1('0xbe')]['id']){_0x4fa88e['id']=_0x17d6dd[_0x25c1('0x64')][_0x25c1('0xbe')]['id'];return db[_0x25c1('0xb9')][_0x25c1('0x6f')]({'where':_0x4fa88e})['then'](function(_0x396ed5){var _0x30e70a=_0x17d6dd['body'][_0x25c1('0xa0')]&&_0x17d6dd[_0x25c1('0x64')][_0x25c1('0x3e')];if(!_0x30e70a&&_0x396ed5&&_0x396ed5[_0x25c1('0xba')]){throw new APIConflictError('Writing\x20on\x20closed\x20interaction');}else if(_0x396ed5){_0x1055b7=!![];return _0x396ed5;}else{return db[_0x25c1('0xb9')]['create'](_0x2e6dfd);}});}return db['ChatInteraction'][_0x25c1('0x63')](_0x2e6dfd);})[_0x25c1('0x2e')](function(_0x567ea4){if(!_0x1055b7){return _0x567ea4;}var _0x569b69={'from':(_0x3a5e79[_0x25c1('0xbf')][_0x25c1('0x3c')]||'')+'\x20'+(_0x3a5e79[_0x25c1('0xbf')][_0x25c1('0xc0')]||'')};if(_0x17d6dd[_0x25c1('0x64')]['threadId']&&_0x17d6dd[_0x25c1('0x64')][_0x25c1('0xc1')]&&_0x17d6dd['body']['threadId']!=_0x17d6dd[_0x25c1('0x64')][_0x25c1('0xc1')]){_0x569b69[_0x25c1('0xb8')]=_0x17d6dd[_0x25c1('0x64')][_0x25c1('0xc1')];}return _0x567ea4[_0x25c1('0x6d')](_0x569b69);})[_0x25c1('0x2e')](function(_0x573382){_0x3a5e79[_0x25c1('0xbe')]=_0x573382[_0x25c1('0x30')]({'plain':!![]});_0x3a5e79[_0x25c1('0xbe')][_0x25c1('0xc2')]=!_0x1055b7;if(_0x3a5e79[_0x25c1('0xbe')][_0x25c1('0xc2')]){if(_0x3a5e79[_0x25c1('0xb4')][_0x25c1('0xc3')]){_0x3a5e79[_0x25c1('0xb0')][_0x25c1('0xc4')]({'id':0x0,'priority':_0x3a5e79[_0x25c1('0xb0')][_0x25c1('0x52')]+0x1,'app':_0x25c1('0xc5'),'appdata':_0x25c1('0xc6'),'interval':_0x25c1('0xc7')});}}return db[_0x25c1('0xc8')][_0x25c1('0x63')]({'body':_0x17d6dd[_0x25c1('0x64')]['body'],'ChatWebsiteId':_0x17d6dd[_0x25c1('0x60')]['id'],'ChatInteractionId':_0x573382['id'],'direction':'in','ContactId':_0x3a5e79['contact']['id'],'AttachmentId':_0x17d6dd[_0x25c1('0x64')]['AttachmentId']});})['then'](function(_0x56d4ca){_0x3a5e79['message']=_0x56d4ca;if(!_0x3a5e79[_0x25c1('0xbe')][_0x25c1('0xc9')]){return;}return db[_0x25c1('0xca')]['find']({'attributes':['id','name'],'where':{'id':_0x3a5e79[_0x25c1('0xbe')][_0x25c1('0xc9')]}});})['then'](function(_0x29d6f7){if(_0x29d6f7){_0x3a5e79[_0x25c1('0xb0')][_0x25c1('0xcb')]({'id':0x0,'priority':0x0,'app':_0x25c1('0xcc'),'appdata':_0x29d6f7[_0x25c1('0x33')]+','+(_0x3a5e79[_0x25c1('0xb4')][_0x25c1('0xcd')]||0xa),'interval':_0x25c1('0xc7')});_0x3a5e79['forcedOwnership']=!![];}if(!_0x3a5e79[_0x25c1('0xbe')][_0x25c1('0xce')]){return;}return db['ChatQueue']['find']({'attributes':['id','name'],'where':{'id':_0x3a5e79[_0x25c1('0xbe')][_0x25c1('0xce')]}});})[_0x25c1('0x2e')](function(_0x1d8202){if(_0x1d8202){_0x3a5e79[_0x25c1('0xb0')]['unshift']({'id':0x0,'priority':0x1,'app':_0x25c1('0xcf'),'appdata':_0x1d8202[_0x25c1('0x33')]+','+(_0x3a5e79['account'][_0x25c1('0xd0')]||0x12c),'interval':_0x25c1('0xc7')});}return respondWithRpcPromise(_0x25c1('0xd1'),_0x25c1('0xd2'),_0x3a5e79);})[_0x25c1('0x2e')](function(_0x4bf7b2){respondWithRpcPromise(_0x25c1('0xd3'),_0x25c1('0xd3'),{'event':_0x25c1('0x99'),'message':_0x4bf7b2},client9002);return _0x4bf7b2;})[_0x25c1('0x2e')](respondWithResult(_0x762495,null))[_0x25c1('0x24')](APIHandleError(_0x762495));};exports[_0x25c1('0xd4')]=function(_0x10a363,_0x271769){var _0x4642e2,_0x56ed52,_0x116fc4;var _0x485b8e=[];var _0x2b5af0={};var _0x4f0eca=_0x10a363[_0x25c1('0xd5')]||[];var _0x3a5a6e=[];var _0xcb437e;return db[_0x25c1('0xa1')][_0x25c1('0x71')]()[_0x25c1('0x2e')](function(_0x255cc4){if(!_0x255cc4){throw new db['Sequelize']['ValidationError'](_0x25c1('0xd6'));}_0x485b8e=_[_0x25c1('0xd7')](_[_0x25c1('0x4e')](_0x255cc4),['createdAt',_0x25c1('0xa5'),_0x25c1('0xa6'),'ListId']);if(_0x10a363[_0x25c1('0x64')]['id']){delete _0x10a363[_0x25c1('0x64')]['id'];}if(_[_0x25c1('0x8b')](_0x10a363[_0x25c1('0x64')][_0x25c1('0x9b')])){throw _0x271769[_0x25c1('0x26')](0x1f4)['send'](new db[(_0x25c1('0xd8'))][(_0x25c1('0xd9'))](_0x25c1('0xda')));}if(_[_0x25c1('0x8b')](_0x10a363[_0x25c1('0x64')][_0x25c1('0x64')])||_0x10a363[_0x25c1('0x64')][_0x25c1('0x64')]===''){throw _0x271769[_0x25c1('0x26')](0x1f4)[_0x25c1('0x34')](new db[(_0x25c1('0xd8'))][(_0x25c1('0xd9'))](_0x25c1('0xdb')));}if(_[_0x25c1('0x8b')](_0x10a363[_0x25c1('0x64')][_0x25c1('0xdc')])){throw _0x271769[_0x25c1('0x26')](0x1f4)[_0x25c1('0x34')](new db[(_0x25c1('0xd8'))][(_0x25c1('0xd9'))](_0x25c1('0xdd')+_0x485b8e));}if(!_[_0x25c1('0xa4')](_0x485b8e,_0x10a363['body'][_0x25c1('0xdc')])){throw _0x271769['status'](0x1f4)['send'](new db[(_0x25c1('0xd8'))][(_0x25c1('0xd9'))](_0x25c1('0xde')+_0x485b8e));}_0x2b5af0[_0x10a363[_0x25c1('0x64')]['mapKeyOffline']]=_0x10a363[_0x25c1('0x64')][_0x25c1('0x9b')];})[_0x25c1('0x2e')](function(){return db[_0x25c1('0x4a')][_0x25c1('0x6f')]({'where':{'id':_0x10a363[_0x25c1('0x60')]['id']},'include':[{'model':db[_0x25c1('0xa9')],'as':_0x25c1('0xaa')},{'model':db[_0x25c1('0xdf')],'as':_0x25c1('0xdf')}]});})[_0x25c1('0x2e')](handleEntityNotFound(_0x271769,null))[_0x25c1('0x2e')](function(_0x2df80b){if(_0x2df80b&&_0x2df80b[_0x25c1('0xaa')]){_0x56ed52=_0x2df80b;var _0x4bda5a=_['defaults'](_0x10a363['body'],{'firstName':_0x10a363[_0x25c1('0x64')][_0x25c1('0x9b')],'phone':_0x10a363['body'][_0x25c1('0x9b')],'ListId':_0x2df80b[_0x25c1('0xa7')]});_0x4bda5a[_0x10a363[_0x25c1('0x64')][_0x25c1('0xdc')]]=_0x10a363[_0x25c1('0x64')]['from'];return db[_0x25c1('0xa1')][_0x25c1('0xe0')]({'where':_0x2b5af0,'defaults':_0x4bda5a});}})[_0x25c1('0xe1')](function(_0x3e1cda){if(_0x3e1cda){_0x116fc4=_0x3e1cda;var _0x4c5ccd=fs[_0x25c1('0xe2')](path[_0x25c1('0x8c')](config[_0x25c1('0x87')],_0x25c1('0xe3')),_0x25c1('0xe4'));var _0x2b4f5c=ejs[_0x25c1('0xe5')](_0x4c5ccd,{'body':_[_0x25c1('0xe6')](_0x10a363[_0x25c1('0x64')][_0x25c1('0x64')]),'bodyTitle':_0x56ed52[_0x25c1('0xe7')]});return db['ChatOfflineMessage'][_0x25c1('0x63')]({'body':_0x2b4f5c,'plainBody':htmlToText['fromString'](_0x2b4f5c),'ContactId':_0x3e1cda['id'],'ChatWebsiteId':_0x56ed52['id']});}})[_0x25c1('0x2e')](function(_0x1895c0){_0xcb437e=_0x1895c0;if(_0x4f0eca[_0x25c1('0x52')]){var _0x31fc7f=_0x4f0eca[_0x25c1('0x49')](function(_0x490a5a){return{'name':_0x490a5a[_0x25c1('0xe8')],'basename':_0x490a5a[_0x25c1('0x80')],'type':_0x490a5a['mimetype'],'ChatOfflineMessageId':_0x1895c0['id']};});_0x3a5a6e=_0x31fc7f[_0x25c1('0x49')](_0x794186=>{var _0x369eae={'filename':_0x794186[_0x25c1('0x33')],'path':path[_0x25c1('0x8c')](config[_0x25c1('0x87')],_0x25c1('0xe9'),_0x25c1('0xd5'),_0x25c1('0xea'),_0x25c1('0xeb'),_0x794186[_0x25c1('0xec')])};return _0x369eae;});if(!_0x56ed52[_0x25c1('0xed')]){return db[_0x25c1('0xee')][_0x25c1('0xef')](function(_0x4c09c0){return db[_0x25c1('0xf0')][_0x25c1('0xf1')](_0x31fc7f,{'transaction':_0x4c09c0});});}}})['then'](function(){if(_0xcb437e){_0x4642e2=_0xcb437e;return db[_0x25c1('0xdf')][_0x25c1('0x76')]({'where':{'service':!![]},'include':[{'model':db[_0x25c1('0xf2')],'as':_0x25c1('0xf3'),'raw':!![],'include':[{'model':db[_0x25c1('0xf4')],'as':'CloudProvider','raw':!![]}]}]});}})[_0x25c1('0x2e')](function(_0x50a1a4){if(_0x50a1a4&&_0x50a1a4['Smtp']&&_0x56ed52[_0x25c1('0xf5')]&&_0x56ed52['forwardOfflineAddress']){var _0xba0af6=_0x50a1a4[_0x25c1('0xf6')]();return respondWithRpcPromise('SendMail',_0x25c1('0xf7'),{'account':_0xba0af6,'message':{'from':util[_0x25c1('0xae')]('\x22%s\x22\x20<%s>',_0x50a1a4[_0x25c1('0x33')],_0x50a1a4[_0x25c1('0xf8')]||_0x50a1a4[_0x25c1('0xf3')][_0x25c1('0xf9')]),'to':_0x56ed52['forwardOfflineAddress'],'subject':_0x56ed52[_0x25c1('0xfa')],'html':_0x4642e2[_0x25c1('0x64')],'attachments':_0x3a5a6e}},client9003)[_0x25c1('0x2e')](function(){return _0x4642e2;})[_0x25c1('0x24')](function(_0x1477c8){logger[_0x25c1('0x1f')](_0x1477c8);});}})[_0x25c1('0x2e')](function(){if(_0x56ed52&&_0x56ed52[_0x25c1('0xed')]&&_0x56ed52['MailAccountId']){var _0x5184d1=[];if(_0x4f0eca[_0x25c1('0x52')]){_0x5184d1=_0x4f0eca[_0x25c1('0x49')](function(_0x2fc71c){return{'name':_0x2fc71c[_0x25c1('0xe8')],'basename':_0x2fc71c[_0x25c1('0x80')],'type':_0x2fc71c[_0x25c1('0xfb')],'ChatOfflineMessageId':_0xcb437e['id']};});}var _0x27835b;if(!_[_0x25c1('0x8b')](_0x56ed52[_0x25c1('0xfc')])){var _0x12cc47=_['map'](_0x10a363['body'],function(_0x2b87d2){return _0x2b87d2;});var _0x507407=_[_0x25c1('0xfd')](_0x12cc47)[0x0];var _0x46f4a3=_[_0x25c1('0xfe')](_0x507407,function(_0x52a22e){return _0x52a22e;});_0x27835b=_0x46f4a3[0x1][_0x56ed52[_0x25c1('0xfc')]];}var _0x35b5c8={'from':_0x116fc4['email'],'firstName':_0x116fc4[_0x25c1('0x3c')],'lastName':_0x116fc4['lastName'],'mapKey':_0x25c1('0xf8'),'message':{'from':_0x116fc4[_0x25c1('0xf8')],'to':_0x56ed52[_0x25c1('0xdf')][_0x25c1('0xf8')],'cc':'','subject':_[_0x25c1('0x8b')](_0x27835b)?_0x56ed52[_0x25c1('0xfa')]:_0x27835b,'messageId':'','sentAt':new Date(),'attach':_0x5184d1['length'],'attachments':_0x5184d1,'originChannel':_0x25c1('0xff'),'ChatWebsiteId':_0x56ed52['id'],'ChatOfflineMessageId':_0x4642e2['id'],'originTo':_0x56ed52[_0x25c1('0xdf')]['email']},'body':_0x4642e2[_0x25c1('0x64')]};var _0x291897={'account':{'id':_0x56ed52['MailAccountId']},'body':_0x35b5c8,'log':_0x25c1('0x100')};return respondWithRpcPromise('NotifyMailAccount',_0x25c1('0x101'),_0x291897,client9001)[_0x25c1('0x2e')](function(){return _0x4642e2;})[_0x25c1('0x24')](function(_0xaa68f5){logger['error'](_0xaa68f5);});}return;})['then'](function(){if(_0x4642e2){return _0x4642e2;}})['then'](respondWithResult(_0x271769,null))['catch'](function(){for(var _0x1f978d of _0x4f0eca){var _0x3a5243=path[_0x25c1('0x8c')](config[_0x25c1('0x87')],'server',_0x25c1('0xd5'),_0x25c1('0xea'),_0x25c1('0xeb'),_0x1f978d[_0x25c1('0x80')]);fs_extra[_0x25c1('0x102')](_0x3a5243)[_0x25c1('0x24')](function(_0x7b4c19){logger['error']('Could\x20not\x20remove\x20attachment\x20file',_0x3a5243,_0x7b4c19);});}});};exports['addInteraction']=function(_0x4b8da9,_0x39b8f9){return db['ChatInteraction'][_0x25c1('0x6f')]({'where':{'id':_0x4b8da9[_0x25c1('0x60')]['id']}})[_0x25c1('0x2e')](handleEntityNotFound(_0x39b8f9,null))['then'](function(_0x2b0a1e){if(_0x2b0a1e){return _0x2b0a1e[_0x25c1('0x103')](_0x4b8da9['body'][_0x25c1('0x7c')],_[_0x25c1('0x104')](_0x4b8da9['body'],[_0x25c1('0x7c'),'id'])||{});}})['then'](respondWithResult(_0x39b8f9,null))[_0x25c1('0x24')](handleError(_0x39b8f9,null));};exports[_0x25c1('0x105')]=function(_0x343078,_0x50dc41){var _0x35b676={'raw':![],'where':{}};var _0x49fbe9={};var _0x33d84b={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x25c1('0x76')]({'where':{'id':_0x343078[_0x25c1('0x60')]['id']}})['then'](handleEntityNotFound(_0x50dc41,null))[_0x25c1('0x2e')](function(_0x44041f){if(_0x44041f){_0x49fbe9[_0x25c1('0x42')]=_[_0x25c1('0x4e')](db[_0x25c1('0xb9')][_0x25c1('0x61')]);_0x49fbe9[_0x25c1('0x4d')]=_['keys'](_0x343078[_0x25c1('0x4d')]);_0x49fbe9[_0x25c1('0x56')]=_[_0x25c1('0x4f')](_0x49fbe9[_0x25c1('0x42')],_0x49fbe9[_0x25c1('0x4d')]);_0x35b676['attributes']=_[_0x25c1('0x4f')](_0x49fbe9['model'],qs[_0x25c1('0x51')](_0x343078[_0x25c1('0x4d')][_0x25c1('0x51')]));_0x35b676[_0x25c1('0x50')]=_0x35b676[_0x25c1('0x50')][_0x25c1('0x52')]?_0x35b676['attributes']:_0x49fbe9[_0x25c1('0x42')];if(!_0x343078[_0x25c1('0x4d')][_0x25c1('0x106')](_0x25c1('0x53'))){_0x35b676[_0x25c1('0x2a')]=qs[_0x25c1('0x2a')](_0x343078[_0x25c1('0x4d')]['limit']);_0x35b676[_0x25c1('0x29')]=qs['offset'](_0x343078[_0x25c1('0x4d')][_0x25c1('0x29')]);}_0x35b676['order']=qs[_0x25c1('0x54')](_0x343078[_0x25c1('0x4d')]['sort']);_0x35b676[_0x25c1('0x55')]=qs[_0x25c1('0x56')](_['pick'](_0x343078[_0x25c1('0x4d')],_0x49fbe9[_0x25c1('0x56')]));_0x35b676['where'][_0x25c1('0x73')]=_0x44041f['id'];if(_0x343078[_0x25c1('0x4d')][_0x25c1('0x58')]){_0x35b676[_0x25c1('0x55')]=_[_0x25c1('0x59')](_0x35b676[_0x25c1('0x55')],{'$or':_[_0x25c1('0x49')](_0x35b676[_0x25c1('0x50')],function(_0x1547ac){var _0x15fc82={};_0x15fc82[_0x1547ac]={'$like':'%'+_0x343078[_0x25c1('0x4d')][_0x25c1('0x58')]+'%'};return _0x15fc82;})});}_0x35b676=_[_0x25c1('0x59')]({},_0x35b676,_0x343078[_0x25c1('0x5b')]);return db[_0x25c1('0xb9')]['count']({'where':_0x35b676[_0x25c1('0x55')]})[_0x25c1('0x2e')](function(_0x4ad924){_0x33d84b['count']=_0x4ad924;if(_0x343078['query'][_0x25c1('0x62')]){_0x35b676['include']=[{'model':db['CmContact'],'as':_0x25c1('0x107'),'required':![]},{'model':db[_0x25c1('0xca')],'as':'Owner','attributes':[_0x25c1('0x33'),_0x25c1('0x108'),_0x25c1('0x109')],'required':![]},{'model':db[_0x25c1('0x10a')],'as':_0x25c1('0x10b'),'attributes':['id',_0x25c1('0x33'),'color'],'where':_0x343078[_0x25c1('0x4d')][_0x25c1('0x10c')]?{'id':_0x343078[_0x25c1('0x4d')][_0x25c1('0x10c')]}:undefined,'required':_0x343078[_0x25c1('0x4d')][_0x25c1('0x10c')]?!![]:![]}];}return db['ChatInteraction']['findAll'](_0x35b676);})['then'](function(_0x49f80c){_0x33d84b[_0x25c1('0x5e')]=_0x49f80c;return _0x33d84b;});}})['then'](respondWithFilteredResult(_0x50dc41,_0x35b676))['catch'](handleError(_0x50dc41,null));};exports[_0x25c1('0x10d')]=function(_0x2bb12a,_0x3c3585){var _0x4e7aa3=0x0;var _0x3c38ec=0x0;var _0x105c50=![];var _0x1ac4d3;var _0x21739f;return db[_0x25c1('0x4a')][_0x25c1('0x6f')]({'where':{'id':_0x2bb12a[_0x25c1('0x60')]['id']},'include':[{'model':db[_0x25c1('0x96')],'as':_0x25c1('0x96'),'include':[{'model':db['Interval'],'as':'Intervals','attributes':['id',_0x25c1('0x10e')]}]}]})[_0x25c1('0x2e')](handleEntityNotFound(_0x3c3585,null))[_0x25c1('0x2e')](function(_0x552128){if(_0x552128){_0x1ac4d3=_0x552128;return _0x552128[_0x25c1('0x10f')]({'raw':!![]});}})[_0x25c1('0x2e')](function(_0x529e3d){if(_0x1ac4d3){if(_0x529e3d){_0x21739f=_0x529e3d;}}return require(_0x25c1('0x89'))[_0x25c1('0x110')]();})[_0x25c1('0x2e')](function(_0x3670f1){if(_0x3670f1){_0x3c38ec=_0x3670f1[_0x25c1('0x111')];_0x105c50=_0x3670f1[_0x25c1('0x8a')];}})[_0x25c1('0x2e')](function(){return db['ChatInteraction'][_0x25c1('0x2c')]({'where':{'closed':![]}});})[_0x25c1('0x2e')](function(_0x475d48){_0x4e7aa3=_0x475d48;if(_0x3c38ec&&_0x475d48>_0x3c38ec){return db['License'][_0x25c1('0x76')]({'where':{'id':0x1}})[_0x25c1('0x2e')](function(_0x1d1789){if(_0x1d1789){_0x1d1789[_0x25c1('0x112')](_0x25c1('0x113'));}});}})[_0x25c1('0x2e')](function(){var _0xbf3d09=_0x1ac4d3[_0x25c1('0x96')];var _0x45e89a=_0x1ac4d3[_0x25c1('0x98')]||undefined;return _0xbf3d09?_0xbf3d09[_0x25c1('0x114')](_0x45e89a):!![];})[_0x25c1('0x2e')](function(_0x2b7be1){var _0x38b295=fs[_0x25c1('0xe2')](path[_0x25c1('0x8c')](config[_0x25c1('0x87')],_0x25c1('0x115')),_0x25c1('0xe4'));var _0x347946=_0x25c1('0x116');var _0x3d3a22=![];var _0xdd2b64,_0x425131;if(_0x2bb12a[_0x25c1('0xb7')][_0x25c1('0x3e')]){_0xdd2b64=new URL(_0x2bb12a['headers']['referer'])[_0x25c1('0x117')];}else if(_0x2bb12a[_0x25c1('0xb7')][_0x25c1('0x117')]){_0xdd2b64=new URL(_0x2bb12a[_0x25c1('0xb7')]['origin'])[_0x25c1('0x117')];}else{_0xdd2b64=_0x25c1('0x118');}_0x425131=typeof _0x1ac4d3[_0x25c1('0x119')][_0x25c1('0x3b')](',')[_0x25c1('0x6f')](function(_0x4d3e9b){return wildcardUtils[_0x25c1('0x11a')](_0x4d3e9b,_0xdd2b64);})!=='undefined';var _0x137f7b={'chatVersion':_0x347946,'chatWebsiteAddressOrigin':_0x425131?_0xdd2b64:_0x1ac4d3[_0x25c1('0x119')],'remote':_0x1ac4d3[_0x25c1('0x11b')],'query':querystring[_0x25c1('0x46')](_[_0x25c1('0x59')](_0x1ac4d3[_0x25c1('0x30')]({'plain':!![]}),{'customerIp':_0x2bb12a[_0x25c1('0xb7')][_0x25c1('0x39')]||_0x2bb12a[_0x25c1('0xb7')][_0x25c1('0x11c')]||_0x2bb12a[_0x25c1('0x11d')][_0x25c1('0x11e')]||_0x2bb12a['ip'],'referer':_0x2bb12a[_0x25c1('0xb7')][_0x25c1('0x3e')],'openedInteractions':_0x4e7aa3,'maxInteractions':_0x3c38ec,'virtual':_0x105c50[_0x25c1('0x111')],'online':_0x2b7be1,'custom':_0x105c50,'address':_0x425131?_0xdd2b64:null}))['replace'](/'/g,'\x5c\x27')};_0x3c3585['send'](ejs[_0x25c1('0xe5')](Mustache[_0x25c1('0xe5')](_0x38b295,_0x137f7b),{'proactiveActions':_0x21739f,'alignment':_0x1ac4d3[_0x25c1('0x11f')],'verticalAlignment':_0x1ac4d3['verticalAlignment'],'div_color':_0x1ac4d3[_0x25c1('0x120')],'labelText':_0x1ac4d3[_0x25c1('0x121')],'text_color':_0x1ac4d3[_0x25c1('0x122')],'text_button_color':_0x1ac4d3[_0x25c1('0x123')],'button_color':_0x1ac4d3[_0x25c1('0x124')],'background_color':_0x1ac4d3['backgroundColor'],'hideWhenOffline':_0x1ac4d3[_0x25c1('0x125')],'intervalId':_0x1ac4d3[_0x25c1('0x126')],'isDevelopment':_0x3d3a22,'chatVersion':_0x347946}));})[_0x25c1('0x24')](handleError(_0x3c3585,null));};exports[_0x25c1('0x127')]=function(_0x24c0e1,_0x3cb379){var _0x1b9df7=_0x24c0e1[_0x25c1('0x60')]['id'];var _0x2e788d=_0x24c0e1['body'];var _0x19371f=0xc8;var _0x60c433=null;return db[_0x25c1('0xee')][_0x25c1('0xef')]({'isolationLevel':db['sequelize'][_0x25c1('0x128')][_0x25c1('0x129')]['READ_COMMITTED']},function(_0x3f8ccf){return db[_0x25c1('0x4a')][_0x25c1('0x76')]({'where':{'id':_0x1b9df7},'transaction':_0x3f8ccf})[_0x25c1('0x2e')](function(_0x1b9807){if(_0x1b9807){return db[_0x25c1('0x12a')][_0x25c1('0x2f')]({'where':{'ChatWebsiteId':_0x1b9df7},'transaction':_0x3f8ccf})[_0x25c1('0x2e')](function(){var _0x3011a3=_['map'](_0x2e788d,function(_0x3cee4c){_0x3cee4c[_0x25c1('0x73')]=_0x1b9df7;return _0x3cee4c;});return db[_0x25c1('0x12a')][_0x25c1('0xf1')](_0x3011a3,{'transaction':_0x3f8ccf});});}else{_0x19371f=0x194;_0x60c433=[];}});})[_0x25c1('0x2e')](function(){if(_0x19371f!==0x194){return db[_0x25c1('0x12a')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x1b9df7},'order':'priority'})[_0x25c1('0x2e')](function(_0x5158c6){_0x60c433=_0x5158c6;});}})[_0x25c1('0x24')](function(_0xfecf83){_0x19371f=0x1f4;logger['error'](_0xfecf83['stack']);if(_0xfecf83[_0x25c1('0x33')]){delete _0xfecf83['name'];}_0x60c433=_0xfecf83;})[_0x25c1('0x12b')](function(){if(_0x60c433===null){_0x3cb379[_0x25c1('0x25')](_0x19371f);}else{if(_0x19371f===0x1f4){_0x3cb379['status'](_0x19371f)[_0x25c1('0x34')](_0x60c433);}else{_0x3cb379[_0x25c1('0x26')](_0x19371f)[_0x25c1('0x28')](_0x60c433);}}});};exports[_0x25c1('0x12c')]=function(_0x12e92f,_0x5c619c){var _0x1bb98d={};var _0x3beb87={};var _0x159849;var _0x336d03;return db['ChatWebsite'][_0x25c1('0x76')]({'where':{'id':_0x12e92f[_0x25c1('0x60')]['id']}})['then'](handleEntityNotFound(_0x5c619c,null))['then'](function(_0x3e97d4){if(_0x3e97d4){_0x159849=_0x3e97d4;_0x3beb87[_0x25c1('0x42')]=_['keys'](db[_0x25c1('0x12a')][_0x25c1('0x61')]);_0x3beb87[_0x25c1('0x4d')]=_['keys'](_0x12e92f[_0x25c1('0x4d')]);_0x3beb87[_0x25c1('0x56')]=_[_0x25c1('0x4f')](_0x3beb87[_0x25c1('0x42')],_0x3beb87['query']);_0x1bb98d[_0x25c1('0x50')]=_[_0x25c1('0x4f')](_0x3beb87['model'],qs[_0x25c1('0x51')](_0x12e92f[_0x25c1('0x4d')][_0x25c1('0x51')]));_0x1bb98d[_0x25c1('0x50')]=_0x1bb98d[_0x25c1('0x50')][_0x25c1('0x52')]?_0x1bb98d[_0x25c1('0x50')]:_0x3beb87['model'];_0x1bb98d['order']=qs[_0x25c1('0x54')](_0x12e92f[_0x25c1('0x4d')][_0x25c1('0x54')]);_0x1bb98d[_0x25c1('0x55')]=qs[_0x25c1('0x56')](_[_0x25c1('0x57')](_0x12e92f[_0x25c1('0x4d')],_0x3beb87[_0x25c1('0x56')]));if(_0x12e92f[_0x25c1('0x4d')][_0x25c1('0x58')]){_0x1bb98d[_0x25c1('0x55')]=_[_0x25c1('0x59')](_0x1bb98d[_0x25c1('0x55')],{'$or':_['map'](_0x1bb98d[_0x25c1('0x50')],function(_0xd47cf6){var _0x1bc04a={};_0x1bc04a[_0xd47cf6]={'$like':'%'+_0x12e92f[_0x25c1('0x4d')][_0x25c1('0x58')]+'%'};return _0x1bc04a;})});}_0x1bb98d=_['merge']({},_0x1bb98d,_0x12e92f[_0x25c1('0x5b')]);return _0x159849['getApplications'](_0x1bb98d);}})[_0x25c1('0x2e')](function(_0x48b0da){if(_0x48b0da){_0x336d03=_0x48b0da[_0x25c1('0x52')];if(!_0x12e92f['query'][_0x25c1('0x106')]('nolimit')){_0x1bb98d[_0x25c1('0x2a')]=qs['limit'](_0x12e92f[_0x25c1('0x4d')]['limit']);_0x1bb98d[_0x25c1('0x29')]=qs[_0x25c1('0x29')](_0x12e92f[_0x25c1('0x4d')][_0x25c1('0x29')]);}return _0x159849[_0x25c1('0x12c')](_0x1bb98d);}})[_0x25c1('0x2e')](function(_0x7d40d){if(_0x7d40d){return _0x7d40d?{'count':_0x336d03,'rows':_0x7d40d}:null;}})[_0x25c1('0x2e')](respondWithResult(_0x5c619c,null))[_0x25c1('0x24')](handleError(_0x5c619c,null));};exports['addProactiveActions']=function(_0x4c051b,_0x438d00){return db[_0x25c1('0x12d')][_0x25c1('0x6f')]({'where':{'id':_0x4c051b[_0x25c1('0x60')]['id']}})['then'](handleEntityNotFound(_0x438d00,null))[_0x25c1('0x2e')](function(_0x7cca8a){if(_0x7cca8a){return _0x7cca8a['addProactiveActions'](_0x4c051b[_0x25c1('0x64')][_0x25c1('0x7c')],_[_0x25c1('0x104')](_0x4c051b[_0x25c1('0x64')],[_0x25c1('0x7c'),'id'])||{});}})[_0x25c1('0x2e')](respondWithResult(_0x438d00,null))[_0x25c1('0x24')](handleError(_0x438d00,null));};exports[_0x25c1('0x10f')]=function(_0x1bfd85,_0x4f5b1d){var _0x25a834={};var _0x2bd187={};var _0x449871;var _0x508a31;return db[_0x25c1('0x4a')][_0x25c1('0x76')]({'where':{'id':_0x1bfd85['params']['id']}})[_0x25c1('0x2e')](handleEntityNotFound(_0x4f5b1d,null))[_0x25c1('0x2e')](function(_0x2ea33b){if(_0x2ea33b){_0x449871=_0x2ea33b;_0x2bd187[_0x25c1('0x42')]=_['keys'](db['ChatProactiveAction'][_0x25c1('0x61')]);_0x2bd187[_0x25c1('0x4d')]=_[_0x25c1('0x4e')](_0x1bfd85[_0x25c1('0x4d')]);_0x2bd187[_0x25c1('0x56')]=_[_0x25c1('0x4f')](_0x2bd187[_0x25c1('0x42')],_0x2bd187[_0x25c1('0x4d')]);_0x25a834['attributes']=_['intersection'](_0x2bd187[_0x25c1('0x42')],qs['fields'](_0x1bfd85[_0x25c1('0x4d')][_0x25c1('0x51')]));_0x25a834['attributes']=_0x25a834[_0x25c1('0x50')][_0x25c1('0x52')]?_0x25a834[_0x25c1('0x50')]:_0x2bd187['model'];_0x25a834['order']=qs[_0x25c1('0x54')](_0x1bfd85[_0x25c1('0x4d')][_0x25c1('0x54')]);_0x25a834['where']=qs[_0x25c1('0x56')](_[_0x25c1('0x57')](_0x1bfd85[_0x25c1('0x4d')],_0x2bd187[_0x25c1('0x56')]));if(_0x1bfd85['query'][_0x25c1('0x58')]){_0x25a834['where']=_['merge'](_0x25a834[_0x25c1('0x55')],{'$or':_['map'](_0x25a834[_0x25c1('0x50')],function(_0x3d68d2){var _0x48e005={};_0x48e005[_0x3d68d2]={'$like':'%'+_0x1bfd85[_0x25c1('0x4d')]['filter']+'%'};return _0x48e005;})});}_0x25a834=_[_0x25c1('0x59')]({},_0x25a834,_0x1bfd85[_0x25c1('0x5b')]);return _0x449871['getProactiveActions'](_0x25a834);}})[_0x25c1('0x2e')](function(_0x4bd350){if(_0x4bd350){_0x508a31=_0x4bd350[_0x25c1('0x52')];if(!_0x1bfd85[_0x25c1('0x4d')][_0x25c1('0x106')](_0x25c1('0x53'))){_0x25a834['limit']=qs[_0x25c1('0x2a')](_0x1bfd85['query'][_0x25c1('0x2a')]);_0x25a834[_0x25c1('0x29')]=qs[_0x25c1('0x29')](_0x1bfd85[_0x25c1('0x4d')]['offset']);}return _0x449871['getProactiveActions'](_0x25a834);}})[_0x25c1('0x2e')](function(_0x675a30){if(_0x675a30){return _0x675a30?{'count':_0x508a31,'rows':_0x675a30}:null;}})[_0x25c1('0x2e')](respondWithResult(_0x4f5b1d,null))['catch'](handleError(_0x4f5b1d,null));};exports[_0x25c1('0x12e')]=function(_0x3c70f2,_0x12a251){var _0x25cca3=_0x3c70f2[_0x25c1('0x4d')][_0x25c1('0x12f')]===_0x25c1('0x130')?'offlineForm':'onlineForm';return db['ChatWebsite']['find']({'attributes':['id',_0x25cca3],'where':{'id':_0x3c70f2[_0x25c1('0x60')]['id']}})[_0x25c1('0x2e')](handleEntityNotFound(_0x12a251,null))[_0x25c1('0x2e')](function(_0x326c5f){if(_0x326c5f){var _0xd4a070=_0x326c5f[_0x25cca3];var _0xc71cbe=_0xd4a070&&_0xd4a070[_0x25c1('0x131')]?_0xd4a070[_0x25c1('0x131')]:[];_0x12a251['send']({'fromKey':_['isNil'](_0xd4a070[_0x25c1('0x132')])?undefined:_0xd4a070[_0x25c1('0x132')],'count':_0xc71cbe[_0x25c1('0x52')],'rows':_0xc71cbe});}})[_0x25c1('0x24')](handleError(_0x12a251,null));};exports['getOfflineMessages']=function(_0x1fcb09,_0x639cf5){var _0x2f2258={'raw':![],'where':{}};var _0x4ac0d0={};var _0x4b029f={'count':0x0,'rows':[]};return db[_0x25c1('0x4a')][_0x25c1('0x76')]({'where':{'id':_0x1fcb09[_0x25c1('0x60')]['id']}})['then'](handleEntityNotFound(_0x639cf5,null))[_0x25c1('0x2e')](function(_0x45d76e){if(_0x45d76e){_0x4ac0d0[_0x25c1('0x42')]=_[_0x25c1('0x4e')](db[_0x25c1('0x133')][_0x25c1('0x61')]);_0x4ac0d0['query']=_[_0x25c1('0x4e')](_0x1fcb09[_0x25c1('0x4d')]);_0x4ac0d0[_0x25c1('0x56')]=_[_0x25c1('0x4f')](_0x4ac0d0['model'],_0x4ac0d0[_0x25c1('0x4d')]);_0x2f2258[_0x25c1('0x50')]=_[_0x25c1('0x4f')](_0x4ac0d0[_0x25c1('0x42')],qs[_0x25c1('0x51')](_0x1fcb09['query'][_0x25c1('0x51')]));_0x2f2258['attributes']=_0x2f2258[_0x25c1('0x50')][_0x25c1('0x52')]?_0x2f2258[_0x25c1('0x50')]:_0x4ac0d0[_0x25c1('0x42')];if(!_0x1fcb09[_0x25c1('0x4d')]['hasOwnProperty'](_0x25c1('0x53'))){_0x2f2258[_0x25c1('0x2a')]=qs[_0x25c1('0x2a')](_0x1fcb09[_0x25c1('0x4d')][_0x25c1('0x2a')]);_0x2f2258[_0x25c1('0x29')]=qs[_0x25c1('0x29')](_0x1fcb09['query'][_0x25c1('0x29')]);}_0x2f2258[_0x25c1('0x77')]=qs[_0x25c1('0x54')](_0x1fcb09[_0x25c1('0x4d')][_0x25c1('0x54')]);_0x2f2258[_0x25c1('0x55')]=qs[_0x25c1('0x56')](_[_0x25c1('0x57')](_0x1fcb09[_0x25c1('0x4d')],_0x4ac0d0[_0x25c1('0x56')]));_0x2f2258[_0x25c1('0x55')][_0x25c1('0x73')]=_0x45d76e['id'];if(_0x1fcb09['query'][_0x25c1('0x58')]){_0x2f2258[_0x25c1('0x55')]=_[_0x25c1('0x59')](_0x2f2258[_0x25c1('0x55')],{'$or':_[_0x25c1('0x49')](_0x2f2258[_0x25c1('0x50')],function(_0x1eda47){var _0x4a4c39={};_0x4a4c39[_0x1eda47]={'$like':'%'+_0x1fcb09[_0x25c1('0x4d')][_0x25c1('0x58')]+'%'};return _0x4a4c39;})});}_0x2f2258=_[_0x25c1('0x59')]({},_0x2f2258,_0x1fcb09[_0x25c1('0x5b')]);return db['ChatOfflineMessage'][_0x25c1('0x2c')]({'where':_0x2f2258[_0x25c1('0x55')]})[_0x25c1('0x2e')](function(_0x458089){_0x4b029f[_0x25c1('0x2c')]=_0x458089;if(_0x1fcb09[_0x25c1('0x4d')][_0x25c1('0x62')]){_0x2f2258['include']=[{'all':!![]}];}else{_0x2f2258[_0x25c1('0x5c')]=[{'model':db[_0x25c1('0xa1')],'as':_0x25c1('0x107'),'required':![]},{'model':db[_0x25c1('0xf0')],'as':_0x25c1('0x134'),'required':![]}];}return db[_0x25c1('0x133')][_0x25c1('0x5d')](_0x2f2258);})[_0x25c1('0x2e')](function(_0x226f36){_0x4b029f[_0x25c1('0x5e')]=_0x226f36;return _0x4b029f;});}})[_0x25c1('0x2e')](respondWithFilteredResult(_0x639cf5,_0x2f2258))[_0x25c1('0x24')](handleError(_0x639cf5,null));};exports[_0x25c1('0x135')]=function(_0x172f7b,_0x395c16){return db['ChatWebsite']['find']({'where':{'id':_0x172f7b[_0x25c1('0x60')]['id']}})[_0x25c1('0x2e')](handleEntityNotFound(_0x395c16,null))['then'](function(_0x476493){if(_0x476493){return _0x476493[_0x25c1('0x135')](_0x172f7b[_0x25c1('0x64')][_0x25c1('0x7c')],_[_0x25c1('0x104')](_0x172f7b[_0x25c1('0x64')],[_0x25c1('0x7c'),'id'])||{})[_0x25c1('0xe1')](function(_0x29cff){for(var _0x497d81=0x0;_0x497d81<_0x172f7b[_0x25c1('0x64')][_0x25c1('0x7c')]['length'];_0x497d81+=0x1){socket['emit'](_0x25c1('0x136'),{'UserId':Number(_0x172f7b[_0x25c1('0x64')]['ids'][_0x497d81]),'ChatWebsiteId':Number(_0x172f7b[_0x25c1('0x60')]['id'])});}return _0x29cff;});}})[_0x25c1('0x2e')](respondWithResult(_0x395c16,null))[_0x25c1('0x24')](handleError(_0x395c16,null));};exports[_0x25c1('0x137')]=function(_0x2f0ba0,_0x2f585b){return db[_0x25c1('0x4a')][_0x25c1('0x6f')]({'where':{'id':_0x2f0ba0[_0x25c1('0x60')]['id']}})[_0x25c1('0x2e')](handleEntityNotFound(_0x2f585b,null))['then'](function(_0x290d71){if(_0x290d71){return _0x290d71[_0x25c1('0x137')](_0x2f0ba0[_0x25c1('0x4d')]['ids'])[_0x25c1('0x2e')](function(){if(_[_0x25c1('0x138')](_0x2f0ba0[_0x25c1('0x4d')][_0x25c1('0x7c')])){for(var _0x5eec9e=0x0;_0x5eec9e<_0x2f0ba0[_0x25c1('0x4d')]['ids'][_0x25c1('0x52')];_0x5eec9e+=0x1){socket[_0x25c1('0x139')]('userChatWebsite:remove',{'UserId':Number(_0x2f0ba0[_0x25c1('0x4d')][_0x25c1('0x7c')][_0x5eec9e]),'ChatWebsiteId':Number(_0x2f0ba0['params']['id'])});}}else{socket['emit']('userChatWebsite:remove',{'UserId':Number(_0x2f0ba0[_0x25c1('0x4d')]['ids']),'ChatWebsiteId':Number(_0x2f0ba0[_0x25c1('0x60')]['id'])});}});}})['then'](respondWithStatusCode(_0x2f585b,null))[_0x25c1('0x24')](handleError(_0x2f585b,null));};exports[_0x25c1('0x13a')]=function(_0x4c02da,_0x26ed1f){var _0x201581={};var _0x34fdf5={};var _0x2cdcb5;var _0x1f0cf6;return db[_0x25c1('0x4a')][_0x25c1('0x76')]({'where':{'id':_0x4c02da[_0x25c1('0x60')]['id']}})[_0x25c1('0x2e')](handleEntityNotFound(_0x26ed1f,null))['then'](function(_0x370cb2){if(_0x370cb2){_0x2cdcb5=_0x370cb2;_0x34fdf5['model']=_['keys'](db['User']['rawAttributes']);_0x34fdf5[_0x25c1('0x4d')]=_[_0x25c1('0x4e')](_0x4c02da[_0x25c1('0x4d')]);_0x34fdf5[_0x25c1('0x56')]=_[_0x25c1('0x4f')](_0x34fdf5[_0x25c1('0x42')],_0x34fdf5[_0x25c1('0x4d')]);_0x201581['attributes']=_[_0x25c1('0x4f')](_0x34fdf5[_0x25c1('0x42')],qs[_0x25c1('0x51')](_0x4c02da[_0x25c1('0x4d')]['fields']));_0x201581[_0x25c1('0x50')]=_0x201581[_0x25c1('0x50')][_0x25c1('0x52')]?_0x201581[_0x25c1('0x50')]:_0x34fdf5[_0x25c1('0x42')];_0x201581['order']=qs['sort'](_0x4c02da[_0x25c1('0x4d')][_0x25c1('0x54')]);_0x201581['where']=qs[_0x25c1('0x56')](_[_0x25c1('0x57')](_0x4c02da[_0x25c1('0x4d')],_0x34fdf5[_0x25c1('0x56')]));if(_0x4c02da[_0x25c1('0x4d')]['filter']){_0x201581[_0x25c1('0x55')]=_[_0x25c1('0x59')](_0x201581['where'],{'$or':_[_0x25c1('0x49')](_0x201581[_0x25c1('0x50')],function(_0x198673){var _0x5c288e={};_0x5c288e[_0x198673]={'$like':'%'+_0x4c02da['query'][_0x25c1('0x58')]+'%'};return _0x5c288e;})});}_0x201581=_[_0x25c1('0x59')]({},_0x201581,_0x4c02da[_0x25c1('0x5b')]);return _0x2cdcb5[_0x25c1('0x13a')](_0x201581);}})[_0x25c1('0x2e')](function(_0xba65bb){if(_0xba65bb){_0x1f0cf6=_0xba65bb['length'];if(!_0x4c02da['query'][_0x25c1('0x106')](_0x25c1('0x53'))){_0x201581[_0x25c1('0x2a')]=qs[_0x25c1('0x2a')](_0x4c02da[_0x25c1('0x4d')]['limit']);_0x201581[_0x25c1('0x29')]=qs['offset'](_0x4c02da[_0x25c1('0x4d')][_0x25c1('0x29')]);}return _0x2cdcb5[_0x25c1('0x13a')](_0x201581);}})[_0x25c1('0x2e')](function(_0x32f3cb){if(_0x32f3cb){return _0x32f3cb?{'count':_0x1f0cf6,'rows':_0x32f3cb}:null;}})['then'](respondWithResult(_0x26ed1f,null))['catch'](handleError(_0x26ed1f,null));}; \ No newline at end of file +var _0x4c4e=['color_button','backgroundColor','hideWhenOffline','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','finally','getApplications','addProactiveActions','chatProactiveAction','omit','getProactiveActions','ChatProactiveAction','false','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','removeAgents','isArray','emit','getAgents','mustache','path','ejs','fs-extra','querystring','html-to-text','ioredis','../../components/parsers/qs','api','../../config/environment','../../errors/api','APIBadRequestError','APINotFoundError','APIOutOfIntervalError','APIConflictError','./helpers/wildcard-expressions','url','URL','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','http','client','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','status','undefined','limit','count','offset','Content-Range','json','update','destroy','get','ChatWebsites','UserProfileResource','end','sendStatus','stack','name','send','user-agent-parser','setUA','user-agent','getResult','cf-connecting-ip','first','x-forwarded-for','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','model','%s\x20%s\x20%s','vendor','type','index','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','key','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','show','params','intersection','body','split','forEach','trim','\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','testWildcardValidity','Pause','describe','addDisposition','Disposition','getDispositions','findOne','ChatWebsiteId','rows','removeDispositions','ids','addAnswer','CannedAnswer','nolimit','removeAnswers','addLogo','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','systemAvatar','getLogo','join','root','sitepic','../../config/license/util','getLicense','custom','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','isNil','server/files/images/avatars/','getCustomerAvatar','showCustomerAvatar','server/files/images/avatars/system_avatar.png','resolve','ifTime','notify','chat','from','From\x20is\x20mandatory','isEmpty','customerIp','CmContact','No\x20available\x20attributes','createdAt','updatedAt','includes','CompanyId','ListId','Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20','CmList','List','Contacts','DESC','ChatApplication','Applications','Interval','Intervals','interval','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','account','applications','orderBy','priority','asc','mapKey','contact','headers','threadId','closed','ChatInteraction','Writing\x20on\x20closed\x20interaction','externalUrl','ContactId','interaction','messageId','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','UserId','User','unshift','waitForTheAssignedAgent','forcedOwnership','queueId','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','offline','files','ValidationError','no\x20available\x20attributes','difference','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','spread','readFileSync','utf8','render','toPairs','ChatOfflineMessage','fromString','originalname','mimetype','server','attachments','offline-chat','basename','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOffline','getSmtpOptions','sendMail','\x22%s\x22\x20<%s>','email','forwardOfflineAddress','offlineMessageSubject','subjectOffline','toPairsIn','mapValues','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','getInteractions','Contact','Owner','Tag','Tags','color','tag','findAll','getSnippet','virtual','License','increment','chatLicenseExceeded','server/files/chat/iframe.ejs','origin','http://localhost:9000','address','testWebsiteWithWildcard','remote','x-real-ip','connection','remoteAddress','replace','alignment','verticalAlignment','labelText','textButtonColor'];(function(_0x5201dc,_0x1824ac){var _0x1e3a33=function(_0xca6856){while(--_0xca6856){_0x5201dc['push'](_0x5201dc['shift']());}};_0x1e3a33(++_0x1824ac);}(_0x4c4e,0x152));var _0xe4c4=function(_0x4182ad,_0x80b112){_0x4182ad=_0x4182ad-0x0;var _0x3809d6=_0x4c4e[_0x4182ad];return _0x3809d6;};'use strict';var Mustache=require(_0xe4c4('0x0'));var util=require('util');var path=require(_0xe4c4('0x1'));var ejs=require(_0xe4c4('0x2'));var fs=require('fs');var fs_extra=require(_0xe4c4('0x3'));var _=require('lodash');var querystring=require(_0xe4c4('0x4'));var htmlToText=require(_0xe4c4('0x5'));var Redis=require(_0xe4c4('0x6'));var jayson=require('jayson/promise');var qs=require(_0xe4c4('0x7'));var logger=require('../../config/logger')(_0xe4c4('0x8'));var config=require(_0xe4c4('0x9'));var APIBadRequestError=require(_0xe4c4('0xa'))[_0xe4c4('0xb')];var APINotFoundError=require(_0xe4c4('0xa'))[_0xe4c4('0xc')];var APIOutOfIntervalError=require(_0xe4c4('0xa'))[_0xe4c4('0xd')];var APIHandleError=require('../../errors/api')['handleError'];var APIConflictError=require(_0xe4c4('0xa'))[_0xe4c4('0xe')];var wildcardUtils=require(_0xe4c4('0xf'));var URL=require(_0xe4c4('0x10'))[_0xe4c4('0x11')];var db=require(_0xe4c4('0x12'))['db'];config['redis']=_[_0xe4c4('0x13')](config[_0xe4c4('0x14')],{'host':_0xe4c4('0x15'),'port':0x18eb});var socket=require(_0xe4c4('0x16'))(new Redis(config['redis']));require(_0xe4c4('0x17'))[_0xe4c4('0x18')](socket);var client=jayson['client'][_0xe4c4('0x19')]({'port':0x232c});var client9002=jayson[_0xe4c4('0x1a')]['http']({'port':0x232a});var client9003=jayson[_0xe4c4('0x1a')][_0xe4c4('0x19')]({'port':0x232b});var client9001=jayson['client'][_0xe4c4('0x19')]({'port':0x2329});function respondWithRpcPromise(_0x465c9b,_0x26ea05,_0x40a36e,_0x19e59b){return new Promise(function(_0x882be2,_0x1f637e){var _0x1038cb=_0x19e59b||client;return _0x1038cb[_0xe4c4('0x1b')](_0x465c9b,_0x40a36e)[_0xe4c4('0x1c')](function(_0x23b7e6){logger[_0xe4c4('0x1d')](_0xe4c4('0x1e'),_0x26ea05,_0xe4c4('0x1f'));logger[_0xe4c4('0x20')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x26ea05,_0xe4c4('0x1f'),JSON[_0xe4c4('0x21')](_0x23b7e6));if(_0x23b7e6[_0xe4c4('0x22')]){if(_0x23b7e6[_0xe4c4('0x22')]['code']===0x1f4){logger[_0xe4c4('0x22')](_0xe4c4('0x1e'),_0x26ea05,_0x23b7e6[_0xe4c4('0x22')][_0xe4c4('0x23')]);return _0x1f637e(_0x23b7e6[_0xe4c4('0x22')][_0xe4c4('0x23')]);}logger[_0xe4c4('0x22')](_0xe4c4('0x1e'),_0x26ea05,_0x23b7e6[_0xe4c4('0x22')][_0xe4c4('0x23')]);return _0x882be2(_0x23b7e6[_0xe4c4('0x22')][_0xe4c4('0x23')]);}else{logger[_0xe4c4('0x1d')](_0xe4c4('0x1e'),_0x26ea05,_0xe4c4('0x1f'));_0x882be2(_0x23b7e6['result']['message']);}})[_0xe4c4('0x24')](function(_0x4dc8cc){logger[_0xe4c4('0x22')]('ChatWebsite,\x20%s,\x20%s',_0x26ea05,_0x4dc8cc);_0x1f637e(_0x4dc8cc);});});}function respondWithStatusCode(_0x3adfcb,_0x5efc4c){_0x5efc4c=_0x5efc4c||0xcc;return function(_0x34d667){if(_0x34d667){return _0x3adfcb['sendStatus'](_0x5efc4c);}return _0x3adfcb[_0xe4c4('0x25')](_0x5efc4c)['end']();};}function respondWithResult(_0x5a2adb,_0x4cea1f){_0x4cea1f=_0x4cea1f||0xc8;return function(_0x5d66ab){if(_0x5d66ab){return _0x5a2adb[_0xe4c4('0x25')](_0x4cea1f)['json'](_0x5d66ab);}};}function respondWithFilteredResult(_0x5b5ea5,_0xe2c1b4){return function(_0x11deab){if(_0x11deab){var _0x4bb911=typeof _0xe2c1b4['offset']===_0xe4c4('0x26')&&typeof _0xe2c1b4[_0xe4c4('0x27')]==='undefined';var _0x158432=_0x11deab[_0xe4c4('0x28')];var _0x3f60fc=_0x4bb911?0x0:_0xe2c1b4['offset'];var _0x5d49fd=_0x4bb911?_0x11deab[_0xe4c4('0x28')]:_0xe2c1b4[_0xe4c4('0x29')]+_0xe2c1b4[_0xe4c4('0x27')];var _0x237dd6;if(_0x5d49fd>=_0x158432){_0x5d49fd=_0x158432;_0x237dd6=0xc8;}else{_0x237dd6=0xce;}_0x5b5ea5['status'](_0x237dd6);return _0x5b5ea5['set'](_0xe4c4('0x2a'),_0x3f60fc+'-'+_0x5d49fd+'/'+_0x158432)[_0xe4c4('0x2b')](_0x11deab);}return null;};}function saveUpdates(_0x5d0ba5){return function(_0x3e18e1){if(_0x3e18e1){return _0x3e18e1[_0xe4c4('0x2c')](_0x5d0ba5)[_0xe4c4('0x1c')](function(_0x59b5d1){return _0x59b5d1;});}return null;};}function removeEntity(_0x137f40){return function(_0x5976bc){if(_0x5976bc){return _0x5976bc[_0xe4c4('0x2d')]()[_0xe4c4('0x1c')](function(){var _0x3bb6cf=_0x5976bc[_0xe4c4('0x2e')]({'plain':!![]});var _0x2bd5c1=_0xe4c4('0x2f');return db[_0xe4c4('0x30')][_0xe4c4('0x2d')]({'where':{'type':_0x2bd5c1,'resourceId':_0x3bb6cf['id']}})[_0xe4c4('0x1c')](function(){return _0x5976bc;});})[_0xe4c4('0x1c')](function(){_0x137f40[_0xe4c4('0x25')](0xcc)[_0xe4c4('0x31')]();});}};}function handleEntityNotFound(_0x5cc2a8){return function(_0x21fce3){if(!_0x21fce3){_0x5cc2a8[_0xe4c4('0x32')](0x194);}return _0x21fce3;};}function handleError(_0x3d598a,_0x518018){_0x518018=_0x518018||0x1f4;return function(_0xac6cb4){logger[_0xe4c4('0x22')](_0xac6cb4[_0xe4c4('0x33')]);if(_0xac6cb4['name']){delete _0xac6cb4[_0xe4c4('0x34')];}_0x3d598a[_0xe4c4('0x25')](_0x518018)[_0xe4c4('0x35')](_0xac6cb4);};}function createInteractionObject(_0x1de955,_0x413ec9,_0x10f243,_0x2f8a21){var _0x44f4eb=require(_0xe4c4('0x36'));var _0x8b5bf3=new _0x44f4eb();var _0x5bb519=_0x8b5bf3[_0xe4c4('0x37')](_0x10f243[_0xe4c4('0x38')])[_0xe4c4('0x39')]();var _0x3c16a5=_0x413ec9['customerIp'];if(_0x10f243[_0xe4c4('0x3a')]){_0x3c16a5=_0x10f243[_0xe4c4('0x3a')];}else if(_0x10f243['x-forwarded-for']){_0x3c16a5=_[_0xe4c4('0x3b')](_0x10f243[_0xe4c4('0x3c')]['split'](','));}return{'ContactId':_0x2f8a21['id'],'ChatWebsiteId':_0x1de955,'from':(_0x2f8a21[_0xe4c4('0x3d')]||'')+'\x20'+(_0x2f8a21[_0xe4c4('0x3e')]||''),'customerIp':_0x3c16a5,'customerPort':_0x10f243[_0xe4c4('0x3f')]?_0x10f243[_0xe4c4('0x3f')]:null,'referer':_0x413ec9[_0xe4c4('0x40')],'browserName':_0x5bb519[_0xe4c4('0x41')][_0xe4c4('0x34')]&&_0x5bb519[_0xe4c4('0x41')][_0xe4c4('0x42')]?util[_0xe4c4('0x43')](_0xe4c4('0x44'),_0x5bb519[_0xe4c4('0x41')]['name'],_0x5bb519[_0xe4c4('0x41')][_0xe4c4('0x42')]):_0xe4c4('0x45'),'browserVersion':_0x5bb519[_0xe4c4('0x41')][_0xe4c4('0x42')]||_0xe4c4('0x45'),'osName':util['format'](_0xe4c4('0x44'),_0x5bb519['os']['name'],_0x5bb519['os'][_0xe4c4('0x42')]),'osVersion':_0x5bb519['os'][_0xe4c4('0x42')],'deviceModel':_0x5bb519[_0xe4c4('0x46')][_0xe4c4('0x47')]&&_0x5bb519[_0xe4c4('0x46')]['vendor']?util['format'](_0xe4c4('0x48'),_0x5bb519[_0xe4c4('0x46')][_0xe4c4('0x47')],_0x5bb519['device'][_0xe4c4('0x49')],_0x5bb519[_0xe4c4('0x46')][_0xe4c4('0x4a')]):null,'deviceVendor':_0x5bb519[_0xe4c4('0x46')]['vendor'],'deviceType':_0x5bb519[_0xe4c4('0x46')][_0xe4c4('0x4a')],'formData':JSON[_0xe4c4('0x21')](_0x413ec9)};}exports[_0xe4c4('0x4b')]=function(_0x6bf1ee,_0x1e459e){var _0x1eda5e={'include':[{'model':db['Pause'],'as':_0xe4c4('0x4c')}]},_0x176712={},_0x3ee4db={'count':0x0,'rows':[]};var _0x5d9b27=_[_0xe4c4('0x4d')](db[_0xe4c4('0x4e')][_0xe4c4('0x4f')],function(_0x15e595){return{'name':_0x15e595[_0xe4c4('0x50')],'type':_0x15e595[_0xe4c4('0x4a')][_0xe4c4('0x51')]};});_0x176712[_0xe4c4('0x47')]=_[_0xe4c4('0x4d')](_0x5d9b27,_0xe4c4('0x34'));_0x176712[_0xe4c4('0x52')]=_[_0xe4c4('0x53')](_0x6bf1ee[_0xe4c4('0x52')]);_0x176712[_0xe4c4('0x54')]=_['intersection'](_0x176712['model'],_0x176712[_0xe4c4('0x52')]);_0x1eda5e[_0xe4c4('0x55')]=_['intersection'](_0x176712[_0xe4c4('0x47')],qs[_0xe4c4('0x56')](_0x6bf1ee[_0xe4c4('0x52')][_0xe4c4('0x56')]));_0x1eda5e[_0xe4c4('0x55')]=_0x1eda5e['attributes'][_0xe4c4('0x57')]?_0x1eda5e[_0xe4c4('0x55')]:_0x176712['model'];if(!_0x6bf1ee[_0xe4c4('0x52')][_0xe4c4('0x58')]('nolimit')){_0x1eda5e[_0xe4c4('0x27')]=qs['limit'](_0x6bf1ee[_0xe4c4('0x52')][_0xe4c4('0x27')]);_0x1eda5e[_0xe4c4('0x29')]=qs[_0xe4c4('0x29')](_0x6bf1ee[_0xe4c4('0x52')]['offset']);}_0x1eda5e[_0xe4c4('0x59')]=qs[_0xe4c4('0x5a')](_0x6bf1ee[_0xe4c4('0x52')][_0xe4c4('0x5a')]);_0x1eda5e[_0xe4c4('0x5b')]=qs[_0xe4c4('0x54')](_[_0xe4c4('0x5c')](_0x6bf1ee[_0xe4c4('0x52')],_0x176712[_0xe4c4('0x54')]),_0x5d9b27);if(_0x6bf1ee[_0xe4c4('0x52')][_0xe4c4('0x5d')]){_0x1eda5e[_0xe4c4('0x5b')]=_[_0xe4c4('0x5e')](_0x1eda5e[_0xe4c4('0x5b')],{'$or':_[_0xe4c4('0x4d')](_0x5d9b27,function(_0x338cf5){if(_0x338cf5['type']!==_0xe4c4('0x5f')){var _0x4a2ae9={};_0x4a2ae9[_0x338cf5[_0xe4c4('0x34')]]={'$like':'%'+_0x6bf1ee['query'][_0xe4c4('0x5d')]+'%'};return _0x4a2ae9;}})});}_0x1eda5e=_[_0xe4c4('0x5e')]({},_0x1eda5e,_0x6bf1ee[_0xe4c4('0x60')]);var _0x512ca9={'where':_0x1eda5e[_0xe4c4('0x5b')]};return db['ChatWebsite'][_0xe4c4('0x28')](_0x512ca9)[_0xe4c4('0x1c')](function(_0x1cef48){_0x3ee4db['count']=_0x1cef48;if(_0x6bf1ee['query'][_0xe4c4('0x61')]){_0x1eda5e[_0xe4c4('0x62')]=[{'all':!![]}];}return db[_0xe4c4('0x4e')]['findAll'](_0x1eda5e);})[_0xe4c4('0x1c')](function(_0x5c45f8){_0x3ee4db['rows']=_0x5c45f8;return _0x3ee4db;})['then'](respondWithFilteredResult(_0x1e459e,_0x1eda5e))['catch'](handleError(_0x1e459e,null));};exports[_0xe4c4('0x63')]=function(_0x3a06da,_0x1d89ff){var _0x2ea066={'raw':![],'where':{'id':_0x3a06da[_0xe4c4('0x64')]['id']},'include':[{'model':db['Pause'],'as':_0xe4c4('0x4c')}]},_0x4456e8={};_0x4456e8[_0xe4c4('0x47')]=_[_0xe4c4('0x53')](db[_0xe4c4('0x4e')][_0xe4c4('0x4f')]);_0x4456e8[_0xe4c4('0x52')]=_['keys'](_0x3a06da['query']);_0x4456e8[_0xe4c4('0x54')]=_[_0xe4c4('0x65')](_0x4456e8[_0xe4c4('0x47')],_0x4456e8[_0xe4c4('0x52')]);_0x2ea066[_0xe4c4('0x55')]=_[_0xe4c4('0x65')](_0x4456e8[_0xe4c4('0x47')],qs[_0xe4c4('0x56')](_0x3a06da[_0xe4c4('0x52')]['fields']));_0x2ea066['attributes']=_0x2ea066[_0xe4c4('0x55')]['length']?_0x2ea066[_0xe4c4('0x55')]:_0x4456e8[_0xe4c4('0x47')];if(_0x3a06da[_0xe4c4('0x52')]['includeAll']){_0x2ea066[_0xe4c4('0x62')]=[{'all':!![]}];}_0x2ea066=_['merge']({},_0x2ea066,_0x3a06da[_0xe4c4('0x60')]);return db['ChatWebsite']['find'](_0x2ea066)[_0xe4c4('0x1c')](handleEntityNotFound(_0x1d89ff,null))[_0xe4c4('0x1c')](respondWithResult(_0x1d89ff,null))[_0xe4c4('0x24')](handleError(_0x1d89ff,null));};exports['create']=function(_0x57e38e,_0x4879f9){var _0x1f91f4=null;_0x57e38e[_0xe4c4('0x66')]['address'][_0xe4c4('0x67')](',')[_0xe4c4('0x68')](_0x11115a=>{if(_0x11115a['trim']()!==''&&!wildcardUtils['testWildcardValidity'](_0x11115a[_0xe4c4('0x69')]())){_0x1f91f4=new APIBadRequestError('\x22'+_0x11115a[_0xe4c4('0x69')]()+_0xe4c4('0x6a'));}});if(_0x1f91f4){return handleError(_0x4879f9,null)(_0x1f91f4);}return db[_0xe4c4('0x4e')][_0xe4c4('0x6b')](_0x57e38e[_0xe4c4('0x66')],{})['then'](function(_0x38dd83){var _0x1bddd5=_0x57e38e[_0xe4c4('0x6c')]['get']({'plain':!![]});if(!_0x1bddd5)throw new Error(_0xe4c4('0x6d'));if(_0x1bddd5[_0xe4c4('0x6e')]===_0xe4c4('0x6c')){var _0x57998c=_0x38dd83['get']({'plain':!![]});var _0x2043a8='ChatWebsites';return db['UserProfileSection'][_0xe4c4('0x6f')]({'where':{'name':_0x2043a8,'userProfileId':_0x1bddd5[_0xe4c4('0x70')]},'raw':!![]})[_0xe4c4('0x1c')](function(_0x49d80b){if(_0x49d80b&&_0x49d80b[_0xe4c4('0x71')]===0x0){return db[_0xe4c4('0x30')][_0xe4c4('0x6b')]({'name':_0x57998c[_0xe4c4('0x34')],'resourceId':_0x57998c['id'],'type':_0x49d80b['name'],'sectionId':_0x49d80b['id']},{})[_0xe4c4('0x1c')](function(){return _0x38dd83;});}else{return _0x38dd83;}})[_0xe4c4('0x24')](function(_0x4bb16e){logger['error'](_0xe4c4('0x72'),_0x4bb16e);throw _0x4bb16e;});}return _0x38dd83;})[_0xe4c4('0x1c')](respondWithResult(_0x4879f9,0xc9))[_0xe4c4('0x24')](handleError(_0x4879f9,null));};exports[_0xe4c4('0x2c')]=function(_0x54c386,_0x369ecc){var _0x25e84f=null;_0x54c386[_0xe4c4('0x66')]['address']['split'](',')[_0xe4c4('0x68')](_0x2be1d8=>{if(_0x2be1d8[_0xe4c4('0x69')]()!==''&&!wildcardUtils[_0xe4c4('0x73')](_0x2be1d8['trim']())){_0x25e84f=new APIBadRequestError('\x22'+_0x2be1d8['trim']()+_0xe4c4('0x6a'));}});if(_0x25e84f){return handleError(_0x369ecc,null)(_0x25e84f);}if(_0x54c386[_0xe4c4('0x66')]['id']){delete _0x54c386[_0xe4c4('0x66')]['id'];}return db[_0xe4c4('0x4e')][_0xe4c4('0x6f')]({'where':{'id':_0x54c386['params']['id']},'include':[{'model':db[_0xe4c4('0x74')],'as':'mandatoryDispositionPause'}]})[_0xe4c4('0x1c')](handleEntityNotFound(_0x369ecc,null))[_0xe4c4('0x1c')](saveUpdates(_0x54c386['body'],null))['then'](respondWithResult(_0x369ecc,null))[_0xe4c4('0x24')](handleError(_0x369ecc,null));};exports[_0xe4c4('0x2d')]=function(_0x250bb8,_0x1f880f){return db[_0xe4c4('0x4e')]['find']({'where':{'id':_0x250bb8['params']['id']}})['then'](handleEntityNotFound(_0x1f880f,null))[_0xe4c4('0x1c')](removeEntity(_0x1f880f,null))[_0xe4c4('0x24')](handleError(_0x1f880f,null));};exports['describe']=function(_0x203f11,_0x11faa3){return db[_0xe4c4('0x4e')][_0xe4c4('0x75')]()['then'](respondWithResult(_0x11faa3,null))['catch'](handleError(_0x11faa3,null));};exports[_0xe4c4('0x76')]=function(_0x32f019,_0x5ad3f5){if(_0x32f019[_0xe4c4('0x66')]['id']){delete _0x32f019[_0xe4c4('0x66')]['id'];}return db[_0xe4c4('0x4e')][_0xe4c4('0x6f')]({'where':{'id':_0x32f019['params']['id']}})[_0xe4c4('0x1c')](handleEntityNotFound(_0x5ad3f5,null))[_0xe4c4('0x1c')](function(_0x4e848c){if(_0x4e848c){_0x32f019[_0xe4c4('0x66')]['ChatWebsiteId']=_0x4e848c['id'];return db[_0xe4c4('0x77')][_0xe4c4('0x6b')](_0x32f019[_0xe4c4('0x66')]);}})[_0xe4c4('0x1c')](respondWithResult(_0x5ad3f5,null))['catch'](handleError(_0x5ad3f5,null));};exports[_0xe4c4('0x78')]=function(_0x209fa2,_0x4f3263){var _0x48e089={'raw':![],'where':{}};var _0x1cbf25={};var _0x3547d5={'count':0x0,'rows':[]};return db[_0xe4c4('0x4e')][_0xe4c4('0x79')]({'where':{'id':_0x209fa2[_0xe4c4('0x64')]['id']}})[_0xe4c4('0x1c')](handleEntityNotFound(_0x4f3263,null))[_0xe4c4('0x1c')](function(_0xa3f3b7){if(_0xa3f3b7){_0x1cbf25['model']=_['keys'](db[_0xe4c4('0x77')][_0xe4c4('0x4f')]);_0x1cbf25[_0xe4c4('0x52')]=_[_0xe4c4('0x53')](_0x209fa2[_0xe4c4('0x52')]);_0x1cbf25['filters']=_[_0xe4c4('0x65')](_0x1cbf25[_0xe4c4('0x47')],_0x1cbf25[_0xe4c4('0x52')]);_0x48e089[_0xe4c4('0x55')]=_[_0xe4c4('0x65')](_0x1cbf25[_0xe4c4('0x47')],qs[_0xe4c4('0x56')](_0x209fa2[_0xe4c4('0x52')][_0xe4c4('0x56')]));_0x48e089[_0xe4c4('0x55')]=_0x48e089[_0xe4c4('0x55')][_0xe4c4('0x57')]?_0x48e089[_0xe4c4('0x55')]:_0x1cbf25[_0xe4c4('0x47')];if(!_0x209fa2[_0xe4c4('0x52')][_0xe4c4('0x58')]('nolimit')){_0x48e089['limit']=qs[_0xe4c4('0x27')](_0x209fa2['query'][_0xe4c4('0x27')]);_0x48e089[_0xe4c4('0x29')]=qs[_0xe4c4('0x29')](_0x209fa2[_0xe4c4('0x52')][_0xe4c4('0x29')]);}_0x48e089[_0xe4c4('0x59')]=qs[_0xe4c4('0x5a')](_0x209fa2[_0xe4c4('0x52')][_0xe4c4('0x5a')]);_0x48e089[_0xe4c4('0x5b')]=qs[_0xe4c4('0x54')](_[_0xe4c4('0x5c')](_0x209fa2[_0xe4c4('0x52')],_0x1cbf25['filters']));_0x48e089[_0xe4c4('0x5b')][_0xe4c4('0x7a')]=_0xa3f3b7['id'];if(_0x209fa2[_0xe4c4('0x52')][_0xe4c4('0x5d')]){_0x48e089[_0xe4c4('0x5b')]=_['merge'](_0x48e089[_0xe4c4('0x5b')],{'$or':_[_0xe4c4('0x4d')](_0x48e089['attributes'],function(_0x143ed6){var _0x32d704={};_0x32d704[_0x143ed6]={'$like':'%'+_0x209fa2['query']['filter']+'%'};return _0x32d704;})});}_0x48e089=_['merge']({},_0x48e089,_0x209fa2[_0xe4c4('0x60')]);return db['Disposition'][_0xe4c4('0x28')]({'where':_0x48e089[_0xe4c4('0x5b')]})[_0xe4c4('0x1c')](function(_0x5dc059){_0x3547d5[_0xe4c4('0x28')]=_0x5dc059;if(_0x209fa2[_0xe4c4('0x52')][_0xe4c4('0x61')]){_0x48e089['include']=[{'all':!![]}];}return db['Disposition']['findAll'](_0x48e089);})[_0xe4c4('0x1c')](function(_0x1cf5d1){_0x3547d5[_0xe4c4('0x7b')]=_0x1cf5d1;return _0x3547d5;});}})['then'](respondWithFilteredResult(_0x4f3263,_0x48e089))[_0xe4c4('0x24')](handleError(_0x4f3263,null));};exports[_0xe4c4('0x7c')]=function(_0x3abfbc,_0x16d2af){return db[_0xe4c4('0x4e')]['find']({'where':{'id':_0x3abfbc[_0xe4c4('0x64')]['id']}})[_0xe4c4('0x1c')](handleEntityNotFound(_0x16d2af,null))[_0xe4c4('0x1c')](function(_0x54a2ef){if(_0x54a2ef){return _0x54a2ef[_0xe4c4('0x7c')](_0x3abfbc[_0xe4c4('0x52')][_0xe4c4('0x7d')]);}})['then'](respondWithStatusCode(_0x16d2af,null))[_0xe4c4('0x24')](handleError(_0x16d2af,null));};exports[_0xe4c4('0x7e')]=function(_0x47d67d,_0x36c0e5){if(_0x47d67d[_0xe4c4('0x66')]['id']){delete _0x47d67d[_0xe4c4('0x66')]['id'];}return db[_0xe4c4('0x4e')][_0xe4c4('0x6f')]({'where':{'id':_0x47d67d[_0xe4c4('0x64')]['id']}})[_0xe4c4('0x1c')](handleEntityNotFound(_0x36c0e5,null))['then'](function(_0x54abc3){if(_0x54abc3){_0x47d67d[_0xe4c4('0x66')][_0xe4c4('0x7a')]=_0x54abc3['id'];return db[_0xe4c4('0x7f')][_0xe4c4('0x6b')](_0x47d67d[_0xe4c4('0x66')]);}})['then'](respondWithResult(_0x36c0e5,null))[_0xe4c4('0x24')](handleError(_0x36c0e5,null));};exports['getAnswers']=function(_0x133576,_0x44a173){var _0x3cfed6={'raw':![],'where':{}};var _0x582c12={};var _0x562aeb={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xe4c4('0x79')]({'where':{'id':_0x133576[_0xe4c4('0x64')]['id']}})[_0xe4c4('0x1c')](handleEntityNotFound(_0x44a173,null))[_0xe4c4('0x1c')](function(_0x551d45){if(_0x551d45){_0x582c12[_0xe4c4('0x47')]=_[_0xe4c4('0x53')](db[_0xe4c4('0x7f')][_0xe4c4('0x4f')]);_0x582c12['query']=_[_0xe4c4('0x53')](_0x133576[_0xe4c4('0x52')]);_0x582c12['filters']=_['intersection'](_0x582c12['model'],_0x582c12[_0xe4c4('0x52')]);_0x3cfed6[_0xe4c4('0x55')]=_[_0xe4c4('0x65')](_0x582c12[_0xe4c4('0x47')],qs[_0xe4c4('0x56')](_0x133576[_0xe4c4('0x52')][_0xe4c4('0x56')]));_0x3cfed6[_0xe4c4('0x55')]=_0x3cfed6[_0xe4c4('0x55')][_0xe4c4('0x57')]?_0x3cfed6['attributes']:_0x582c12['model'];if(!_0x133576[_0xe4c4('0x52')][_0xe4c4('0x58')](_0xe4c4('0x80'))){_0x3cfed6['limit']=qs[_0xe4c4('0x27')](_0x133576[_0xe4c4('0x52')]['limit']);_0x3cfed6[_0xe4c4('0x29')]=qs['offset'](_0x133576[_0xe4c4('0x52')]['offset']);}_0x3cfed6[_0xe4c4('0x59')]=qs[_0xe4c4('0x5a')](_0x133576[_0xe4c4('0x52')][_0xe4c4('0x5a')]);_0x3cfed6[_0xe4c4('0x5b')]=qs['filters'](_['pick'](_0x133576[_0xe4c4('0x52')],_0x582c12['filters']));_0x3cfed6[_0xe4c4('0x5b')][_0xe4c4('0x7a')]=_0x551d45['id'];if(_0x133576[_0xe4c4('0x52')]['filter']){_0x3cfed6[_0xe4c4('0x5b')]=_['merge'](_0x3cfed6[_0xe4c4('0x5b')],{'$or':_['map'](_0x3cfed6['attributes'],function(_0x2fb74b){var _0x38aac8={};_0x38aac8[_0x2fb74b]={'$like':'%'+_0x133576[_0xe4c4('0x52')]['filter']+'%'};return _0x38aac8;})});}_0x3cfed6=_[_0xe4c4('0x5e')]({},_0x3cfed6,_0x133576[_0xe4c4('0x60')]);return db[_0xe4c4('0x7f')][_0xe4c4('0x28')]({'where':_0x3cfed6['where']})[_0xe4c4('0x1c')](function(_0x323dda){_0x562aeb[_0xe4c4('0x28')]=_0x323dda;if(_0x133576[_0xe4c4('0x52')]['includeAll']){_0x3cfed6['include']=[{'all':!![]}];}return db[_0xe4c4('0x7f')]['findAll'](_0x3cfed6);})[_0xe4c4('0x1c')](function(_0x4bde1c){_0x562aeb[_0xe4c4('0x7b')]=_0x4bde1c;return _0x562aeb;});}})[_0xe4c4('0x1c')](respondWithFilteredResult(_0x44a173,_0x3cfed6))['catch'](handleError(_0x44a173,null));};exports[_0xe4c4('0x81')]=function(_0x203bbf,_0x2072f2){return db[_0xe4c4('0x4e')]['find']({'where':{'id':_0x203bbf[_0xe4c4('0x64')]['id']}})['then'](handleEntityNotFound(_0x2072f2,null))['then'](function(_0x520297){if(_0x520297){return _0x520297['removeAnswers'](_0x203bbf[_0xe4c4('0x52')][_0xe4c4('0x7d')]);}})['then'](respondWithStatusCode(_0x2072f2,null))[_0xe4c4('0x24')](handleError(_0x2072f2,null));};exports[_0xe4c4('0x82')]=function(_0x2b7ebd,_0x311dda){_0x2b7ebd['body']['sitepic']=_0x2b7ebd[_0xe4c4('0x83')][_0xe4c4('0x84')];return db[_0xe4c4('0x4e')][_0xe4c4('0x6f')]({'where':{'id':_0x2b7ebd['params']['id']}})[_0xe4c4('0x1c')](handleEntityNotFound(_0x311dda,null))[_0xe4c4('0x1c')](saveUpdates(_0x2b7ebd[_0xe4c4('0x66')],null))['then'](respondWithResult(_0x311dda,null))[_0xe4c4('0x24')](handleError(_0x311dda,null));};exports[_0xe4c4('0x85')]=function(_0x435e7e,_0x34c5c9){_0x435e7e[_0xe4c4('0x66')][_0xe4c4('0x86')]=_0x435e7e[_0xe4c4('0x83')][_0xe4c4('0x84')];return db['ChatWebsite'][_0xe4c4('0x6f')]({'where':{'id':_0x435e7e[_0xe4c4('0x64')]['id']}})[_0xe4c4('0x1c')](handleEntityNotFound(_0x34c5c9,null))['then'](saveUpdates(_0x435e7e[_0xe4c4('0x66')],null))[_0xe4c4('0x1c')](respondWithResult(_0x34c5c9,null))['catch'](handleError(_0x34c5c9,null));};exports[_0xe4c4('0x87')]=function(_0x49535a,_0x5cf0b3){_0x49535a[_0xe4c4('0x66')][_0xe4c4('0x88')]=_0x49535a[_0xe4c4('0x83')]['filename'];return db[_0xe4c4('0x4e')]['find']({'where':{'id':_0x49535a[_0xe4c4('0x64')]['id']}})[_0xe4c4('0x1c')](handleEntityNotFound(_0x5cf0b3,null))[_0xe4c4('0x1c')](saveUpdates(_0x49535a[_0xe4c4('0x66')],null))[_0xe4c4('0x1c')](respondWithResult(_0x5cf0b3,null))[_0xe4c4('0x24')](handleError(_0x5cf0b3,null));};exports['addSystemAvatar']=function(_0x34baa7,_0x38226e){_0x34baa7[_0xe4c4('0x66')][_0xe4c4('0x89')]=_0x34baa7[_0xe4c4('0x83')][_0xe4c4('0x84')];return db['ChatWebsite'][_0xe4c4('0x6f')]({'where':{'id':_0x34baa7[_0xe4c4('0x64')]['id']}})['then'](handleEntityNotFound(_0x38226e,null))[_0xe4c4('0x1c')](saveUpdates(_0x34baa7[_0xe4c4('0x66')],null))['then'](respondWithResult(_0x38226e,null))[_0xe4c4('0x24')](handleError(_0x38226e,null));};exports[_0xe4c4('0x8a')]=function(_0x4ff9b8,_0x6d730e){var _0x2e0157=path[_0xe4c4('0x8b')](config[_0xe4c4('0x8c')],'server/files/images/logos/default_logo.svg');var _0x270ad7={'where':{'id':_0x4ff9b8[_0xe4c4('0x64')]['id']},'attributes':['id',_0xe4c4('0x8d')],'raw':!![]};var _0x2d8891=![];return require(_0xe4c4('0x8e'))[_0xe4c4('0x8f')]()[_0xe4c4('0x1c')](function(_0x452db2){if(_0x452db2){_0x2d8891=_0x452db2[_0xe4c4('0x90')];}})['then'](function(){return db['ChatWebsite']['find'](_0x270ad7);})[_0xe4c4('0x1c')](handleEntityNotFound(_0x6d730e,null))[_0xe4c4('0x1c')](function(_0x1fba21){if(_0x1fba21){if(!_['isNil'](_0x1fba21[_0xe4c4('0x8d')])){if(fs[_0xe4c4('0x91')](path[_0xe4c4('0x8b')](config[_0xe4c4('0x8c')],_0xe4c4('0x92'),_0x1fba21[_0xe4c4('0x8d')]))&&_0x2d8891){_0x2e0157=path[_0xe4c4('0x8b')](config[_0xe4c4('0x8c')],_0xe4c4('0x92'),_0x1fba21['sitepic']);}}return _0x6d730e[_0xe4c4('0x93')](_0x2e0157);}})[_0xe4c4('0x24')](handleError(_0x6d730e,null));};exports[_0xe4c4('0x94')]=function(_0x408dab,_0x26d412){var _0x249246=path[_0xe4c4('0x8b')](config[_0xe4c4('0x8c')],_0xe4c4('0x95'));var _0x3a5fde={'where':{'id':_0x408dab[_0xe4c4('0x64')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0xe4c4('0x4e')][_0xe4c4('0x6f')](_0x3a5fde)['then'](handleEntityNotFound(_0x26d412,null))[_0xe4c4('0x1c')](function(_0x11e8bb){if(_0x11e8bb){if(!_[_0xe4c4('0x96')](_0x11e8bb[_0xe4c4('0x86')])){if(fs[_0xe4c4('0x91')](path['join'](config['root'],_0xe4c4('0x97'),_0x11e8bb[_0xe4c4('0x86')]))){_0x249246=path[_0xe4c4('0x8b')](config[_0xe4c4('0x8c')],_0xe4c4('0x97'),_0x11e8bb['agentAvatar']);}}return _0x26d412['download'](_0x249246);}})[_0xe4c4('0x24')](handleError(_0x26d412,null));};exports[_0xe4c4('0x98')]=function(_0x1a8895,_0x1ab570){var _0x2d1d44=path[_0xe4c4('0x8b')](config['root'],'server/files/images/avatars/customer_avatar.png');var _0x5c2d8e={'where':{'id':_0x1a8895[_0xe4c4('0x64')]['id']},'attributes':['id','customerAvatar',_0xe4c4('0x99')],'raw':!![]};return db[_0xe4c4('0x4e')][_0xe4c4('0x6f')](_0x5c2d8e)[_0xe4c4('0x1c')](handleEntityNotFound(_0x1ab570,null))[_0xe4c4('0x1c')](function(_0x3c703b){if(_0x3c703b){if(!_['isNil'](_0x3c703b['customerAvatar'])){if(fs[_0xe4c4('0x91')](path[_0xe4c4('0x8b')](config[_0xe4c4('0x8c')],'server/files/images/avatars/',_0x3c703b[_0xe4c4('0x88')]))&&_0x3c703b[_0xe4c4('0x99')]){_0x2d1d44=path[_0xe4c4('0x8b')](config[_0xe4c4('0x8c')],'server/files/images/avatars/',_0x3c703b[_0xe4c4('0x88')]);}}return _0x1ab570[_0xe4c4('0x93')](_0x2d1d44);}})[_0xe4c4('0x24')](handleError(_0x1ab570,null));};exports['getSystemAvatar']=function(_0xc40381,_0x4e3287){var _0x2d7441=path[_0xe4c4('0x8b')](config[_0xe4c4('0x8c')],_0xe4c4('0x9a'));var _0x16b4aa={'where':{'id':_0xc40381[_0xe4c4('0x64')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0xe4c4('0x4e')][_0xe4c4('0x6f')](_0x16b4aa)[_0xe4c4('0x1c')](handleEntityNotFound(_0x4e3287,null))[_0xe4c4('0x1c')](function(_0x5c6509){if(_0x5c6509){if(!_[_0xe4c4('0x96')](_0x5c6509['systemAvatar'])){if(fs['existsSync'](path[_0xe4c4('0x8b')](config['root'],'server/files/images/avatars/',_0x5c6509[_0xe4c4('0x89')]))){_0x2d7441=path[_0xe4c4('0x8b')](config['root'],_0xe4c4('0x97'),_0x5c6509[_0xe4c4('0x89')]);}}return _0x4e3287[_0xe4c4('0x93')](_0x2d7441);}})[_0xe4c4('0x24')](handleError(_0x4e3287,null));};function checkWebsiteInterval(_0x530b01){var _0x45a14f=_0x530b01['Interval'];if(!_0x45a14f){return Promise[_0xe4c4('0x9b')](_0x530b01);}var _0x503a34=_0x530b01['timezone']||undefined;return _0x45a14f[_0xe4c4('0x9c')](_0x503a34)['then'](function(_0x4a45bf){if(!_0x4a45bf){throw new APIOutOfIntervalError();}return _0x530b01;});}exports[_0xe4c4('0x9d')]=function(_0x451f30,_0x1f7c17){var _0xcc2474={'body':_0x451f30[_0xe4c4('0x66')],'channel':_0xe4c4('0x9e')};var _0x27e90b=[];var _0x5a1e7e=[];var _0x4833f7={};var _0x230de7=![];if(_0x451f30['body']['id']){delete _0x451f30[_0xe4c4('0x66')]['id'];}if(_[_0xe4c4('0x96')](_0x451f30[_0xe4c4('0x66')][_0xe4c4('0x9f')])){throw new APIBadRequestError(_0xe4c4('0xa0'));}if(_[_0xe4c4('0x96')](_0x451f30[_0xe4c4('0x66')]['mapKey'])){throw new APIBadRequestError('MapKey\x20is\x20mandatory');}if(_[_0xe4c4('0xa1')](_0x451f30['body']['body'])){throw new APIBadRequestError('Body\x20is\x20mandatory');}var _0x48bdf0=_0x451f30['body'][_0xe4c4('0xa2')]&&_0x451f30[_0xe4c4('0x66')][_0xe4c4('0x40')];return db[_0xe4c4('0xa3')][_0xe4c4('0x75')]()[_0xe4c4('0x1c')](function(_0xfee08a){if(!_0xfee08a){throw new Error(_0xe4c4('0xa4'));}_0x27e90b=Object['keys'](_0xfee08a)['filter'](function(_0x44ef17){return![_0xe4c4('0xa5'),_0xe4c4('0xa6')][_0xe4c4('0xa7')](_0x44ef17);});_0x5a1e7e=Object[_0xe4c4('0x53')](_0xfee08a)[_0xe4c4('0x5d')](function(_0x3ffe55){return![_0xe4c4('0xa5'),_0xe4c4('0xa6'),_0xe4c4('0xa8'),_0xe4c4('0xa9')][_0xe4c4('0xa7')](_0x3ffe55);});if(!_['includes'](_0x5a1e7e,_0x451f30['body']['mapKey'])){throw new APIBadRequestError(_0xe4c4('0xaa')+_0x5a1e7e[_0xe4c4('0x8b')](',\x20'));}_0x4833f7[_0x451f30[_0xe4c4('0x66')]['mapKey']]=_0x451f30['body'][_0xe4c4('0x9f')];})[_0xe4c4('0x1c')](function(){return db['ChatWebsite']['find']({'where':{'id':_0x451f30[_0xe4c4('0x64')]['id']},'include':[{'model':db[_0xe4c4('0xab')],'as':_0xe4c4('0xac'),'include':[{'model':db[_0xe4c4('0xa3')],'as':_0xe4c4('0xad'),'where':_0x4833f7,'limit':0x1,'order':[['updatedAt',_0xe4c4('0xae')]]}]},{'model':db[_0xe4c4('0xaf')],'as':_0xe4c4('0xb0')},{'model':db[_0xe4c4('0xb1')],'as':_0xe4c4('0xb1'),'include':[{'model':db['Interval'],'as':_0xe4c4('0xb2'),'attributes':['id',_0xe4c4('0xb3')],'raw':!![]}]}]});})[_0xe4c4('0x1c')](function(_0x39992d){if(!_0x39992d){throw new APINotFoundError(util[_0xe4c4('0x43')](_0xe4c4('0xb4'),_0x451f30[_0xe4c4('0x64')]['id']));}if(_0x48bdf0){return checkWebsiteInterval(_0x39992d);}return _0x39992d;})[_0xe4c4('0x1c')](function(_0x4956f5){_0xcc2474[_0xe4c4('0xb5')]=_0x4956f5;_0xcc2474[_0xe4c4('0xb6')]=_[_0xe4c4('0xb7')](_0x4956f5[_0xe4c4('0xb0')],[_0xe4c4('0xb8')],[_0xe4c4('0xb9')]);if(_0xcc2474[_0xe4c4('0xb5')][_0xe4c4('0xb0')]){delete _0xcc2474[_0xe4c4('0xb5')][_0xe4c4('0xb0')];}_0xcc2474['list']=_0x4956f5[_0xe4c4('0xac')]||{'id':_0x4956f5[_0xe4c4('0xa9')]};if(_0xcc2474['list']&&_0xcc2474['list'][_0xe4c4('0xad')][_0xe4c4('0x57')]){return _0xcc2474['list']['Contacts'][0x0];}var _0xd99041=_[_0xe4c4('0x13')](_0x451f30['body'],{'firstName':_0x451f30[_0xe4c4('0x66')][_0xe4c4('0x9f')],'ListId':_0x4956f5[_0xe4c4('0xa9')]});_0xd99041[_0x451f30[_0xe4c4('0x66')][_0xe4c4('0xba')]]=_0x451f30[_0xe4c4('0x66')][_0xe4c4('0x9f')];return db[_0xe4c4('0xa3')][_0xe4c4('0x6b')](_0xd99041,{'fields':_0x27e90b,'raw':!![]});})['then'](function(_0x2b660c){_0xcc2474[_0xe4c4('0xbb')]=_0x2b660c;var _0x57bfe4=createInteractionObject(_0x451f30[_0xe4c4('0x64')]['id'],_0x451f30[_0xe4c4('0x66')],_0x451f30[_0xe4c4('0xbc')],_0x2b660c);var _0x1e0825={'ChatWebsiteId':_0x451f30[_0xe4c4('0x64')]['id']};if(_0x451f30[_0xe4c4('0x66')][_0xe4c4('0xbd')]){_0x1e0825[_0xe4c4('0xbd')]=_0x451f30['body']['threadId'];_0x1e0825[_0xe4c4('0xbe')]=![];return db[_0xe4c4('0xbf')]['find']({'where':_0x1e0825})['then'](function(_0x203918){var _0x2409a1=_0x451f30[_0xe4c4('0x66')][_0xe4c4('0xa2')]&&_0x451f30[_0xe4c4('0x66')]['referer'];if(_0x203918){_0x230de7=!![];return _0x203918;}else if(!_0x2409a1&&_0x203918&&_0x203918[_0xe4c4('0xbe')]){throw new APIConflictError(_0xe4c4('0xc0'));}_0x57bfe4['threadId']=_0x451f30[_0xe4c4('0x66')][_0xe4c4('0xbd')];_0x57bfe4['externalUrl']=_0x451f30[_0xe4c4('0x66')][_0xe4c4('0xc1')];return db[_0xe4c4('0xbf')]['create'](_0x57bfe4);});}_0x1e0825[_0xe4c4('0xc2')]=_0x2b660c['id'];if(_0x451f30['body'][_0xe4c4('0xc3')]&&_0x451f30[_0xe4c4('0x66')][_0xe4c4('0xc3')]['id']){_0x1e0825['id']=_0x451f30['body'][_0xe4c4('0xc3')]['id'];return db[_0xe4c4('0xbf')][_0xe4c4('0x6f')]({'where':_0x1e0825})[_0xe4c4('0x1c')](function(_0x18b728){var _0x4066a0=_0x451f30[_0xe4c4('0x66')][_0xe4c4('0xa2')]&&_0x451f30[_0xe4c4('0x66')][_0xe4c4('0x40')];if(!_0x4066a0&&_0x18b728&&_0x18b728['closed']){throw new APIConflictError(_0xe4c4('0xc0'));}else if(_0x18b728){_0x230de7=!![];return _0x18b728;}else{return db[_0xe4c4('0xbf')][_0xe4c4('0x6b')](_0x57bfe4);}});}return db[_0xe4c4('0xbf')][_0xe4c4('0x6b')](_0x57bfe4);})[_0xe4c4('0x1c')](function(_0x3414f3){if(!_0x230de7){return _0x3414f3;}var _0x1966f6={'from':(_0xcc2474[_0xe4c4('0xbb')]['firstName']||'')+'\x20'+(_0xcc2474[_0xe4c4('0xbb')][_0xe4c4('0x3e')]||'')};if(_0x451f30[_0xe4c4('0x66')][_0xe4c4('0xbd')]&&_0x451f30[_0xe4c4('0x66')][_0xe4c4('0xc4')]&&_0x451f30[_0xe4c4('0x66')][_0xe4c4('0xbd')]!=_0x451f30[_0xe4c4('0x66')][_0xe4c4('0xc4')]){_0x1966f6[_0xe4c4('0xbd')]=_0x451f30[_0xe4c4('0x66')]['messageId'];}return _0x3414f3['update'](_0x1966f6);})['then'](function(_0x3e1c4a){_0xcc2474[_0xe4c4('0xc3')]=_0x3e1c4a['get']({'plain':!![]});_0xcc2474['interaction']['created']=!_0x230de7;if(_0xcc2474[_0xe4c4('0xc3')]['created']){if(_0xcc2474[_0xe4c4('0xb5')][_0xe4c4('0xc5')]){_0xcc2474[_0xe4c4('0xb6')][_0xe4c4('0xc6')]({'id':0x0,'priority':_0xcc2474[_0xe4c4('0xb6')][_0xe4c4('0x57')]+0x1,'app':_0xe4c4('0xc7'),'appdata':_0xe4c4('0xc8'),'interval':_0xe4c4('0xc9')});}}return db[_0xe4c4('0xca')][_0xe4c4('0x6b')]({'body':_0x451f30[_0xe4c4('0x66')][_0xe4c4('0x66')],'ChatWebsiteId':_0x451f30[_0xe4c4('0x64')]['id'],'ChatInteractionId':_0x3e1c4a['id'],'direction':'in','ContactId':_0xcc2474[_0xe4c4('0xbb')]['id'],'AttachmentId':_0x451f30[_0xe4c4('0x66')]['AttachmentId']});})[_0xe4c4('0x1c')](function(_0x12333a){_0xcc2474['message']=_0x12333a;if(!_0xcc2474[_0xe4c4('0xc3')][_0xe4c4('0xcb')]){return;}return db[_0xe4c4('0xcc')][_0xe4c4('0x6f')]({'attributes':['id',_0xe4c4('0x34')],'where':{'id':_0xcc2474[_0xe4c4('0xc3')][_0xe4c4('0xcb')]}});})[_0xe4c4('0x1c')](function(_0x5ea042){if(_0x5ea042){_0xcc2474['applications'][_0xe4c4('0xcd')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x5ea042['name']+','+(_0xcc2474[_0xe4c4('0xb5')][_0xe4c4('0xce')]||0xa),'interval':_0xe4c4('0xc9')});_0xcc2474[_0xe4c4('0xcf')]=!![];}if(!_0xcc2474[_0xe4c4('0xc3')]['queueId']){return;}return db['ChatQueue'][_0xe4c4('0x6f')]({'attributes':['id',_0xe4c4('0x34')],'where':{'id':_0xcc2474[_0xe4c4('0xc3')][_0xe4c4('0xd0')]}});})[_0xe4c4('0x1c')](function(_0x211371){if(_0x211371){_0xcc2474['applications'][_0xe4c4('0xcd')]({'id':0x0,'priority':0x1,'app':_0xe4c4('0xd1'),'appdata':_0x211371[_0xe4c4('0x34')]+','+(_0xcc2474[_0xe4c4('0xb5')][_0xe4c4('0xd2')]||0x12c),'interval':_0xe4c4('0xc9')});}return respondWithRpcPromise(_0xe4c4('0xd3'),_0xe4c4('0xd4'),_0xcc2474);})[_0xe4c4('0x1c')](function(_0xe396a6){respondWithRpcPromise(_0xe4c4('0xd5'),_0xe4c4('0xd5'),{'event':_0xe4c4('0x9d'),'message':_0xe396a6},client9002);return _0xe396a6;})[_0xe4c4('0x1c')](respondWithResult(_0x1f7c17,null))[_0xe4c4('0x24')](APIHandleError(_0x1f7c17));};exports[_0xe4c4('0xd6')]=function(_0x2aa16e,_0x3f6e8d){var _0x51cd04,_0x23e102,_0x18973e;var _0x3651ec=[];var _0x50371={};var _0x20de1b=_0x2aa16e[_0xe4c4('0xd7')]||[];var _0x5a34fe=[];var _0x29ac6c;return db[_0xe4c4('0xa3')][_0xe4c4('0x75')]()['then'](function(_0x4b1e34){if(!_0x4b1e34){throw new db['Sequelize'][(_0xe4c4('0xd8'))](_0xe4c4('0xd9'));}_0x3651ec=_[_0xe4c4('0xda')](_[_0xe4c4('0x53')](_0x4b1e34),[_0xe4c4('0xa5'),'updatedAt','CompanyId',_0xe4c4('0xa9')]);if(_0x2aa16e[_0xe4c4('0x66')]['id']){delete _0x2aa16e[_0xe4c4('0x66')]['id'];}if(_['isNil'](_0x2aa16e[_0xe4c4('0x66')][_0xe4c4('0x9f')])){throw _0x3f6e8d[_0xe4c4('0x25')](0x1f4)['send'](new db[(_0xe4c4('0xdb'))]['ValidationError']('from\x20is\x20mandatory'));}if(_[_0xe4c4('0x96')](_0x2aa16e['body'][_0xe4c4('0x66')])||_0x2aa16e[_0xe4c4('0x66')][_0xe4c4('0x66')]===''){throw _0x3f6e8d['status'](0x1f4)[_0xe4c4('0x35')](new db[(_0xe4c4('0xdb'))][(_0xe4c4('0xd8'))](_0xe4c4('0xdc')));}if(_[_0xe4c4('0x96')](_0x2aa16e[_0xe4c4('0x66')][_0xe4c4('0xdd')])){throw _0x3f6e8d[_0xe4c4('0x25')](0x1f4)[_0xe4c4('0x35')](new db[(_0xe4c4('0xdb'))][(_0xe4c4('0xd8'))](_0xe4c4('0xde')+_0x3651ec));}if(!_['includes'](_0x3651ec,_0x2aa16e[_0xe4c4('0x66')][_0xe4c4('0xdd')])){throw _0x3f6e8d[_0xe4c4('0x25')](0x1f4)[_0xe4c4('0x35')](new db[(_0xe4c4('0xdb'))]['ValidationError'](_0xe4c4('0xdf')+_0x3651ec));}_0x50371[_0x2aa16e[_0xe4c4('0x66')][_0xe4c4('0xdd')]]=_0x2aa16e['body'][_0xe4c4('0x9f')];})[_0xe4c4('0x1c')](function(){return db[_0xe4c4('0x4e')][_0xe4c4('0x6f')]({'where':{'id':_0x2aa16e[_0xe4c4('0x64')]['id']},'include':[{'model':db[_0xe4c4('0xab')],'as':_0xe4c4('0xac')},{'model':db[_0xe4c4('0xe0')],'as':_0xe4c4('0xe0')}]});})['then'](handleEntityNotFound(_0x3f6e8d,null))[_0xe4c4('0x1c')](function(_0x21cc1a){if(_0x21cc1a&&_0x21cc1a[_0xe4c4('0xac')]){_0x23e102=_0x21cc1a;var _0x41c0dc=_[_0xe4c4('0x13')](_0x2aa16e[_0xe4c4('0x66')],{'firstName':_0x2aa16e['body'][_0xe4c4('0x9f')],'phone':_0x2aa16e[_0xe4c4('0x66')][_0xe4c4('0x9f')],'ListId':_0x21cc1a['ListId']});_0x41c0dc[_0x2aa16e[_0xe4c4('0x66')][_0xe4c4('0xdd')]]=_0x2aa16e[_0xe4c4('0x66')]['from'];return db['CmContact'][_0xe4c4('0xe1')]({'where':_0x50371,'defaults':_0x41c0dc});}})[_0xe4c4('0xe2')](function(_0x3e4571){if(_0x3e4571){_0x18973e=_0x3e4571;var _0x5ea70c=fs[_0xe4c4('0xe3')](path[_0xe4c4('0x8b')](config[_0xe4c4('0x8c')],'server/files/templates/chatOfflineMessage.ejs'),_0xe4c4('0xe4'));var _0x23d5d5=ejs[_0xe4c4('0xe5')](_0x5ea70c,{'body':_[_0xe4c4('0xe6')](_0x2aa16e[_0xe4c4('0x66')][_0xe4c4('0x66')]),'bodyTitle':_0x23e102['offlineMessageBody']});return db[_0xe4c4('0xe7')][_0xe4c4('0x6b')]({'body':_0x23d5d5,'plainBody':htmlToText[_0xe4c4('0xe8')](_0x23d5d5),'ContactId':_0x3e4571['id'],'ChatWebsiteId':_0x23e102['id']});}})[_0xe4c4('0x1c')](function(_0x134833){_0x29ac6c=_0x134833;if(_0x20de1b[_0xe4c4('0x57')]){var _0x1dd21c=_0x20de1b[_0xe4c4('0x4d')](function(_0x3d8da1){return{'name':_0x3d8da1[_0xe4c4('0xe9')],'basename':_0x3d8da1['filename'],'type':_0x3d8da1[_0xe4c4('0xea')],'ChatOfflineMessageId':_0x134833['id']};});_0x5a34fe=_0x1dd21c['map'](_0x1ac10e=>{var _0x50cb2b={'filename':_0x1ac10e[_0xe4c4('0x34')],'path':path['join'](config['root'],_0xe4c4('0xeb'),_0xe4c4('0xd7'),_0xe4c4('0xec'),_0xe4c4('0xed'),_0x1ac10e[_0xe4c4('0xee')])};return _0x50cb2b;});if(!_0x23e102[_0xe4c4('0xef')]){return db[_0xe4c4('0xf0')][_0xe4c4('0xf1')](function(_0x5ed12d){return db[_0xe4c4('0xf2')][_0xe4c4('0xf3')](_0x1dd21c,{'transaction':_0x5ed12d});});}}})[_0xe4c4('0x1c')](function(){if(_0x29ac6c){_0x51cd04=_0x29ac6c;return db[_0xe4c4('0xe0')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0xe4c4('0xf4')],'as':_0xe4c4('0xf5'),'raw':!![],'include':[{'model':db[_0xe4c4('0xf6')],'as':'CloudProvider','raw':!![]}]}]});}})[_0xe4c4('0x1c')](function(_0x2a7374){if(_0x2a7374&&_0x2a7374['Smtp']&&_0x23e102[_0xe4c4('0xf7')]&&_0x23e102['forwardOfflineAddress']){var _0x2ebef7=_0x2a7374[_0xe4c4('0xf8')]();return respondWithRpcPromise('SendMail',_0xe4c4('0xf9'),{'account':_0x2ebef7,'message':{'from':util[_0xe4c4('0x43')](_0xe4c4('0xfa'),_0x2a7374[_0xe4c4('0x34')],_0x2a7374[_0xe4c4('0xfb')]||_0x2a7374[_0xe4c4('0xf5')][_0xe4c4('0x6c')]),'to':_0x23e102[_0xe4c4('0xfc')],'subject':_0x23e102[_0xe4c4('0xfd')],'html':_0x51cd04[_0xe4c4('0x66')],'attachments':_0x5a34fe}},client9003)[_0xe4c4('0x1c')](function(){return _0x51cd04;})[_0xe4c4('0x24')](function(_0x307198){logger[_0xe4c4('0x22')](_0x307198);});}})[_0xe4c4('0x1c')](function(){if(_0x23e102&&_0x23e102[_0xe4c4('0xef')]&&_0x23e102['MailAccountId']){var _0x555318=[];if(_0x20de1b[_0xe4c4('0x57')]){_0x555318=_0x20de1b[_0xe4c4('0x4d')](function(_0x4d7fea){return{'name':_0x4d7fea[_0xe4c4('0xe9')],'basename':_0x4d7fea['filename'],'type':_0x4d7fea[_0xe4c4('0xea')],'ChatOfflineMessageId':_0x29ac6c['id']};});}var _0x4f78a6;if(!_[_0xe4c4('0x96')](_0x23e102[_0xe4c4('0xfe')])){var _0x290c62=_[_0xe4c4('0x4d')](_0x2aa16e[_0xe4c4('0x66')],function(_0x1e88dc){return _0x1e88dc;});var _0x1caed0=_[_0xe4c4('0xff')](_0x290c62)[0x0];var _0x6fd02e=_[_0xe4c4('0x100')](_0x1caed0,function(_0x55cfe3){return _0x55cfe3;});_0x4f78a6=_0x6fd02e[0x1][_0x23e102[_0xe4c4('0xfe')]];}var _0x550c69={'from':_0x18973e[_0xe4c4('0xfb')],'firstName':_0x18973e[_0xe4c4('0x3d')],'lastName':_0x18973e[_0xe4c4('0x3e')],'mapKey':_0xe4c4('0xfb'),'message':{'from':_0x18973e[_0xe4c4('0xfb')],'to':_0x23e102[_0xe4c4('0xe0')][_0xe4c4('0xfb')],'cc':'','subject':_[_0xe4c4('0x96')](_0x4f78a6)?_0x23e102[_0xe4c4('0xfd')]:_0x4f78a6,'messageId':'','sentAt':new Date(),'attach':_0x555318[_0xe4c4('0x57')],'attachments':_0x555318,'originChannel':'Chat','ChatWebsiteId':_0x23e102['id'],'ChatOfflineMessageId':_0x51cd04['id'],'originTo':_0x23e102['MailAccount']['email']},'body':_0x51cd04[_0xe4c4('0x66')]};var _0x2391a1={'account':{'id':_0x23e102['MailAccountId']},'body':_0x550c69,'log':'NotifyMailAccount'};return respondWithRpcPromise('NotifyMailAccount',_0xe4c4('0x101'),_0x2391a1,client9001)[_0xe4c4('0x1c')](function(){return _0x51cd04;})[_0xe4c4('0x24')](function(_0xda9160){logger[_0xe4c4('0x22')](_0xda9160);});}return;})[_0xe4c4('0x1c')](function(){if(_0x51cd04){return _0x51cd04;}})['then'](respondWithResult(_0x3f6e8d,null))[_0xe4c4('0x24')](function(){for(var _0x54b014 of _0x20de1b){var _0x340fd7=path[_0xe4c4('0x8b')](config['root'],_0xe4c4('0xeb'),_0xe4c4('0xd7'),_0xe4c4('0xec'),_0xe4c4('0xed'),_0x54b014[_0xe4c4('0x84')]);fs_extra[_0xe4c4('0x102')](_0x340fd7)[_0xe4c4('0x24')](function(_0x32cbd2){logger[_0xe4c4('0x22')](_0xe4c4('0x103'),_0x340fd7,_0x32cbd2);});}});};exports['addInteraction']=function(_0x536ff2,_0x2f71b7){return db['ChatInteraction']['find']({'where':{'id':_0x536ff2[_0xe4c4('0x64')]['id']}})[_0xe4c4('0x1c')](handleEntityNotFound(_0x2f71b7,null))[_0xe4c4('0x1c')](function(_0x3fcff1){if(_0x3fcff1){return _0x3fcff1[_0xe4c4('0x104')](_0x536ff2[_0xe4c4('0x66')][_0xe4c4('0x7d')],_['omit'](_0x536ff2[_0xe4c4('0x66')],[_0xe4c4('0x7d'),'id'])||{});}})['then'](respondWithResult(_0x2f71b7,null))[_0xe4c4('0x24')](handleError(_0x2f71b7,null));};exports[_0xe4c4('0x105')]=function(_0xf5aec6,_0x510361){var _0x16c203={'raw':![],'where':{}};var _0x289144={};var _0x112034={'count':0x0,'rows':[]};return db[_0xe4c4('0x4e')][_0xe4c4('0x79')]({'where':{'id':_0xf5aec6['params']['id']}})['then'](handleEntityNotFound(_0x510361,null))[_0xe4c4('0x1c')](function(_0x51b9a1){if(_0x51b9a1){_0x289144[_0xe4c4('0x47')]=_[_0xe4c4('0x53')](db[_0xe4c4('0xbf')]['rawAttributes']);_0x289144['query']=_[_0xe4c4('0x53')](_0xf5aec6[_0xe4c4('0x52')]);_0x289144['filters']=_[_0xe4c4('0x65')](_0x289144[_0xe4c4('0x47')],_0x289144[_0xe4c4('0x52')]);_0x16c203[_0xe4c4('0x55')]=_[_0xe4c4('0x65')](_0x289144[_0xe4c4('0x47')],qs[_0xe4c4('0x56')](_0xf5aec6[_0xe4c4('0x52')][_0xe4c4('0x56')]));_0x16c203[_0xe4c4('0x55')]=_0x16c203[_0xe4c4('0x55')]['length']?_0x16c203[_0xe4c4('0x55')]:_0x289144[_0xe4c4('0x47')];if(!_0xf5aec6['query']['hasOwnProperty'](_0xe4c4('0x80'))){_0x16c203['limit']=qs[_0xe4c4('0x27')](_0xf5aec6[_0xe4c4('0x52')]['limit']);_0x16c203[_0xe4c4('0x29')]=qs[_0xe4c4('0x29')](_0xf5aec6[_0xe4c4('0x52')][_0xe4c4('0x29')]);}_0x16c203['order']=qs[_0xe4c4('0x5a')](_0xf5aec6[_0xe4c4('0x52')][_0xe4c4('0x5a')]);_0x16c203[_0xe4c4('0x5b')]=qs[_0xe4c4('0x54')](_[_0xe4c4('0x5c')](_0xf5aec6['query'],_0x289144['filters']));_0x16c203['where'][_0xe4c4('0x7a')]=_0x51b9a1['id'];if(_0xf5aec6[_0xe4c4('0x52')][_0xe4c4('0x5d')]){_0x16c203['where']=_['merge'](_0x16c203['where'],{'$or':_[_0xe4c4('0x4d')](_0x16c203[_0xe4c4('0x55')],function(_0x33bf97){var _0x36eb7b={};_0x36eb7b[_0x33bf97]={'$like':'%'+_0xf5aec6[_0xe4c4('0x52')]['filter']+'%'};return _0x36eb7b;})});}_0x16c203=_[_0xe4c4('0x5e')]({},_0x16c203,_0xf5aec6[_0xe4c4('0x60')]);return db[_0xe4c4('0xbf')][_0xe4c4('0x28')]({'where':_0x16c203[_0xe4c4('0x5b')]})[_0xe4c4('0x1c')](function(_0x28fbe4){_0x112034[_0xe4c4('0x28')]=_0x28fbe4;if(_0xf5aec6[_0xe4c4('0x52')][_0xe4c4('0x61')]){_0x16c203[_0xe4c4('0x62')]=[{'model':db['CmContact'],'as':_0xe4c4('0x106'),'required':![]},{'model':db[_0xe4c4('0xcc')],'as':_0xe4c4('0x107'),'attributes':[_0xe4c4('0x34'),'fullname','internal'],'required':![]},{'model':db[_0xe4c4('0x108')],'as':_0xe4c4('0x109'),'attributes':['id','name',_0xe4c4('0x10a')],'where':_0xf5aec6['query']['tag']?{'id':_0xf5aec6[_0xe4c4('0x52')]['tag']}:undefined,'required':_0xf5aec6[_0xe4c4('0x52')][_0xe4c4('0x10b')]?!![]:![]}];}return db[_0xe4c4('0xbf')][_0xe4c4('0x10c')](_0x16c203);})['then'](function(_0x159193){_0x112034[_0xe4c4('0x7b')]=_0x159193;return _0x112034;});}})[_0xe4c4('0x1c')](respondWithFilteredResult(_0x510361,_0x16c203))[_0xe4c4('0x24')](handleError(_0x510361,null));};exports[_0xe4c4('0x10d')]=function(_0x4c5d8b,_0x152415){var _0x448614=0x0;var _0x2a117c=0x0;var _0x12a8bb=![];var _0x56c6e5;var _0x23e05d;return db[_0xe4c4('0x4e')][_0xe4c4('0x6f')]({'where':{'id':_0x4c5d8b[_0xe4c4('0x64')]['id']},'include':[{'model':db['Interval'],'as':_0xe4c4('0xb1'),'include':[{'model':db[_0xe4c4('0xb1')],'as':'Intervals','attributes':['id','interval']}]}]})['then'](handleEntityNotFound(_0x152415,null))[_0xe4c4('0x1c')](function(_0x2d4e9d){if(_0x2d4e9d){_0x56c6e5=_0x2d4e9d;return _0x2d4e9d['getProactiveActions']({'raw':!![]});}})[_0xe4c4('0x1c')](function(_0x20f141){if(_0x56c6e5){if(_0x20f141){_0x23e05d=_0x20f141;}}return require(_0xe4c4('0x8e'))['getLicense']();})[_0xe4c4('0x1c')](function(_0x11822e){if(_0x11822e){_0x2a117c=_0x11822e[_0xe4c4('0x10e')];_0x12a8bb=_0x11822e['custom'];}})[_0xe4c4('0x1c')](function(){return db[_0xe4c4('0xbf')][_0xe4c4('0x28')]({'where':{'closed':![]}});})[_0xe4c4('0x1c')](function(_0x3dfbde){_0x448614=_0x3dfbde;if(_0x2a117c&&_0x3dfbde>_0x2a117c){return db[_0xe4c4('0x10f')]['findOne']({'where':{'id':0x1}})[_0xe4c4('0x1c')](function(_0x337c98){if(_0x337c98){_0x337c98[_0xe4c4('0x110')](_0xe4c4('0x111'));}});}})[_0xe4c4('0x1c')](function(){var _0x2f0bba=_0x56c6e5['Interval'];var _0xbbf169=_0x56c6e5['timezone']||undefined;return _0x2f0bba?_0x2f0bba[_0xe4c4('0x9c')](_0xbbf169):!![];})[_0xe4c4('0x1c')](function(_0x24123b){var _0x20525b=fs[_0xe4c4('0xe3')](path[_0xe4c4('0x8b')](config[_0xe4c4('0x8c')],_0xe4c4('0x112')),_0xe4c4('0xe4'));var _0x317e9c='3.13.0';var _0x49a26c=![];var _0x356750,_0xa27893;if(_0x4c5d8b[_0xe4c4('0xbc')][_0xe4c4('0x40')]){_0x356750=new URL(_0x4c5d8b[_0xe4c4('0xbc')][_0xe4c4('0x40')])['origin'];}else if(_0x4c5d8b[_0xe4c4('0xbc')][_0xe4c4('0x113')]){_0x356750=new URL(_0x4c5d8b[_0xe4c4('0xbc')][_0xe4c4('0x113')])[_0xe4c4('0x113')];}else{_0x356750=_0xe4c4('0x114');}_0xa27893=typeof _0x56c6e5[_0xe4c4('0x115')][_0xe4c4('0x67')](',')['find'](function(_0x425371){return wildcardUtils[_0xe4c4('0x116')](_0x425371,_0x356750);})!==_0xe4c4('0x26');var _0x24a913={'chatVersion':_0x317e9c,'chatWebsiteAddressOrigin':_0xa27893?_0x356750:_0x56c6e5[_0xe4c4('0x115')],'remote':_0x56c6e5[_0xe4c4('0x117')],'query':querystring[_0xe4c4('0x21')](_[_0xe4c4('0x5e')](_0x56c6e5[_0xe4c4('0x2e')]({'plain':!![]}),{'customerIp':_0x4c5d8b[_0xe4c4('0xbc')]['x-forwarded-for']||_0x4c5d8b['headers'][_0xe4c4('0x118')]||_0x4c5d8b[_0xe4c4('0x119')][_0xe4c4('0x11a')]||_0x4c5d8b['ip'],'referer':_0x4c5d8b[_0xe4c4('0xbc')]['referer'],'openedInteractions':_0x448614,'maxInteractions':_0x2a117c,'virtual':_0x12a8bb[_0xe4c4('0x10e')],'online':_0x24123b,'custom':_0x12a8bb,'address':_0xa27893?_0x356750:null}))[_0xe4c4('0x11b')](/'/g,'\x5c\x27')};_0x152415['send'](ejs[_0xe4c4('0xe5')](Mustache['render'](_0x20525b,_0x24a913),{'proactiveActions':_0x23e05d,'alignment':_0x56c6e5[_0xe4c4('0x11c')],'verticalAlignment':_0x56c6e5[_0xe4c4('0x11d')],'div_color':_0x56c6e5[_0xe4c4('0x10a')],'labelText':_0x56c6e5[_0xe4c4('0x11e')],'text_color':_0x56c6e5['textColor'],'text_button_color':_0x56c6e5[_0xe4c4('0x11f')],'button_color':_0x56c6e5[_0xe4c4('0x120')],'background_color':_0x56c6e5[_0xe4c4('0x121')],'hideWhenOffline':_0x56c6e5[_0xe4c4('0x122')],'intervalId':_0x56c6e5['IntervalId'],'isDevelopment':_0x49a26c,'chatVersion':_0x317e9c}));})['catch'](handleError(_0x152415,null));};exports['addApplications']=function(_0x126005,_0xb96ce3){var _0x2ea9db=_0x126005[_0xe4c4('0x64')]['id'];var _0x5e7645=_0x126005[_0xe4c4('0x66')];var _0x4cbd84=0xc8;var _0x5b643f=null;return db[_0xe4c4('0xf0')][_0xe4c4('0xf1')]({'isolationLevel':db['sequelize'][_0xe4c4('0x123')][_0xe4c4('0x124')][_0xe4c4('0x125')]},function(_0x1d38b5){return db[_0xe4c4('0x4e')][_0xe4c4('0x79')]({'where':{'id':_0x2ea9db},'transaction':_0x1d38b5})[_0xe4c4('0x1c')](function(_0x208072){if(_0x208072){return db['ChatApplication'][_0xe4c4('0x2d')]({'where':{'ChatWebsiteId':_0x2ea9db},'transaction':_0x1d38b5})[_0xe4c4('0x1c')](function(){var _0x4755ae=_[_0xe4c4('0x4d')](_0x5e7645,function(_0xe41510){_0xe41510['ChatWebsiteId']=_0x2ea9db;return _0xe41510;});return db[_0xe4c4('0xaf')][_0xe4c4('0xf3')](_0x4755ae,{'transaction':_0x1d38b5});});}else{_0x4cbd84=0x194;_0x5b643f=[];}});})[_0xe4c4('0x1c')](function(){if(_0x4cbd84!==0x194){return db[_0xe4c4('0xaf')][_0xe4c4('0x126')]({'where':{'ChatWebsiteId':_0x2ea9db},'order':_0xe4c4('0xb8')})[_0xe4c4('0x1c')](function(_0x5eb819){_0x5b643f=_0x5eb819;});}})['catch'](function(_0x20fda7){_0x4cbd84=0x1f4;logger[_0xe4c4('0x22')](_0x20fda7[_0xe4c4('0x33')]);if(_0x20fda7[_0xe4c4('0x34')]){delete _0x20fda7[_0xe4c4('0x34')];}_0x5b643f=_0x20fda7;})[_0xe4c4('0x127')](function(){if(_0x5b643f===null){_0xb96ce3[_0xe4c4('0x32')](_0x4cbd84);}else{if(_0x4cbd84===0x1f4){_0xb96ce3[_0xe4c4('0x25')](_0x4cbd84)[_0xe4c4('0x35')](_0x5b643f);}else{_0xb96ce3[_0xe4c4('0x25')](_0x4cbd84)[_0xe4c4('0x2b')](_0x5b643f);}}});};exports[_0xe4c4('0x128')]=function(_0xa09e1a,_0x38b6e8){var _0x12b809={};var _0x3aff06={};var _0x4cf50f;var _0x494ed6;return db['ChatWebsite']['findOne']({'where':{'id':_0xa09e1a['params']['id']}})['then'](handleEntityNotFound(_0x38b6e8,null))[_0xe4c4('0x1c')](function(_0x2bda6e){if(_0x2bda6e){_0x4cf50f=_0x2bda6e;_0x3aff06[_0xe4c4('0x47')]=_['keys'](db[_0xe4c4('0xaf')][_0xe4c4('0x4f')]);_0x3aff06[_0xe4c4('0x52')]=_[_0xe4c4('0x53')](_0xa09e1a[_0xe4c4('0x52')]);_0x3aff06['filters']=_[_0xe4c4('0x65')](_0x3aff06[_0xe4c4('0x47')],_0x3aff06['query']);_0x12b809[_0xe4c4('0x55')]=_['intersection'](_0x3aff06['model'],qs[_0xe4c4('0x56')](_0xa09e1a[_0xe4c4('0x52')][_0xe4c4('0x56')]));_0x12b809['attributes']=_0x12b809['attributes'][_0xe4c4('0x57')]?_0x12b809['attributes']:_0x3aff06['model'];_0x12b809['order']=qs[_0xe4c4('0x5a')](_0xa09e1a['query']['sort']);_0x12b809[_0xe4c4('0x5b')]=qs[_0xe4c4('0x54')](_[_0xe4c4('0x5c')](_0xa09e1a[_0xe4c4('0x52')],_0x3aff06[_0xe4c4('0x54')]));if(_0xa09e1a['query'][_0xe4c4('0x5d')]){_0x12b809[_0xe4c4('0x5b')]=_[_0xe4c4('0x5e')](_0x12b809[_0xe4c4('0x5b')],{'$or':_[_0xe4c4('0x4d')](_0x12b809['attributes'],function(_0xd23315){var _0x31a65a={};_0x31a65a[_0xd23315]={'$like':'%'+_0xa09e1a[_0xe4c4('0x52')]['filter']+'%'};return _0x31a65a;})});}_0x12b809=_['merge']({},_0x12b809,_0xa09e1a[_0xe4c4('0x60')]);return _0x4cf50f[_0xe4c4('0x128')](_0x12b809);}})[_0xe4c4('0x1c')](function(_0x2f2a4b){if(_0x2f2a4b){_0x494ed6=_0x2f2a4b[_0xe4c4('0x57')];if(!_0xa09e1a['query'][_0xe4c4('0x58')](_0xe4c4('0x80'))){_0x12b809[_0xe4c4('0x27')]=qs['limit'](_0xa09e1a[_0xe4c4('0x52')][_0xe4c4('0x27')]);_0x12b809[_0xe4c4('0x29')]=qs[_0xe4c4('0x29')](_0xa09e1a['query'][_0xe4c4('0x29')]);}return _0x4cf50f[_0xe4c4('0x128')](_0x12b809);}})[_0xe4c4('0x1c')](function(_0xe5c907){if(_0xe5c907){return _0xe5c907?{'count':_0x494ed6,'rows':_0xe5c907}:null;}})[_0xe4c4('0x1c')](respondWithResult(_0x38b6e8,null))[_0xe4c4('0x24')](handleError(_0x38b6e8,null));};exports[_0xe4c4('0x129')]=function(_0x2cb743,_0x532964){return db[_0xe4c4('0x12a')][_0xe4c4('0x6f')]({'where':{'id':_0x2cb743['params']['id']}})['then'](handleEntityNotFound(_0x532964,null))['then'](function(_0x32a888){if(_0x32a888){return _0x32a888['addProactiveActions'](_0x2cb743[_0xe4c4('0x66')][_0xe4c4('0x7d')],_[_0xe4c4('0x12b')](_0x2cb743[_0xe4c4('0x66')],[_0xe4c4('0x7d'),'id'])||{});}})[_0xe4c4('0x1c')](respondWithResult(_0x532964,null))[_0xe4c4('0x24')](handleError(_0x532964,null));};exports[_0xe4c4('0x12c')]=function(_0x5ea4a1,_0x398b00){var _0x1227c={};var _0x3169dd={};var _0x2ec4b0;var _0x20a4a6;return db['ChatWebsite'][_0xe4c4('0x79')]({'where':{'id':_0x5ea4a1[_0xe4c4('0x64')]['id']}})[_0xe4c4('0x1c')](handleEntityNotFound(_0x398b00,null))[_0xe4c4('0x1c')](function(_0x5af309){if(_0x5af309){_0x2ec4b0=_0x5af309;_0x3169dd[_0xe4c4('0x47')]=_[_0xe4c4('0x53')](db[_0xe4c4('0x12d')]['rawAttributes']);_0x3169dd['query']=_[_0xe4c4('0x53')](_0x5ea4a1[_0xe4c4('0x52')]);_0x3169dd[_0xe4c4('0x54')]=_[_0xe4c4('0x65')](_0x3169dd[_0xe4c4('0x47')],_0x3169dd[_0xe4c4('0x52')]);_0x1227c[_0xe4c4('0x55')]=_[_0xe4c4('0x65')](_0x3169dd[_0xe4c4('0x47')],qs['fields'](_0x5ea4a1[_0xe4c4('0x52')]['fields']));_0x1227c[_0xe4c4('0x55')]=_0x1227c[_0xe4c4('0x55')][_0xe4c4('0x57')]?_0x1227c['attributes']:_0x3169dd[_0xe4c4('0x47')];_0x1227c['order']=qs['sort'](_0x5ea4a1['query'][_0xe4c4('0x5a')]);_0x1227c['where']=qs[_0xe4c4('0x54')](_[_0xe4c4('0x5c')](_0x5ea4a1[_0xe4c4('0x52')],_0x3169dd['filters']));if(_0x5ea4a1['query']['filter']){_0x1227c[_0xe4c4('0x5b')]=_['merge'](_0x1227c[_0xe4c4('0x5b')],{'$or':_[_0xe4c4('0x4d')](_0x1227c[_0xe4c4('0x55')],function(_0x318271){var _0x393e92={};_0x393e92[_0x318271]={'$like':'%'+_0x5ea4a1[_0xe4c4('0x52')]['filter']+'%'};return _0x393e92;})});}_0x1227c=_['merge']({},_0x1227c,_0x5ea4a1['options']);return _0x2ec4b0['getProactiveActions'](_0x1227c);}})[_0xe4c4('0x1c')](function(_0x157422){if(_0x157422){_0x20a4a6=_0x157422[_0xe4c4('0x57')];if(!_0x5ea4a1['query'][_0xe4c4('0x58')](_0xe4c4('0x80'))){_0x1227c[_0xe4c4('0x27')]=qs[_0xe4c4('0x27')](_0x5ea4a1[_0xe4c4('0x52')]['limit']);_0x1227c[_0xe4c4('0x29')]=qs['offset'](_0x5ea4a1[_0xe4c4('0x52')][_0xe4c4('0x29')]);}return _0x2ec4b0[_0xe4c4('0x12c')](_0x1227c);}})[_0xe4c4('0x1c')](function(_0x19985e){if(_0x19985e){return _0x19985e?{'count':_0x20a4a6,'rows':_0x19985e}:null;}})[_0xe4c4('0x1c')](respondWithResult(_0x398b00,null))[_0xe4c4('0x24')](handleError(_0x398b00,null));};exports['getFields']=function(_0x163d02,_0x214f2c){var _0x409b67=_0x163d02[_0xe4c4('0x52')]['online']===_0xe4c4('0x12e')?'offlineForm':_0xe4c4('0x12f');return db[_0xe4c4('0x4e')][_0xe4c4('0x6f')]({'attributes':['id',_0x409b67],'where':{'id':_0x163d02['params']['id']}})[_0xe4c4('0x1c')](handleEntityNotFound(_0x214f2c,null))['then'](function(_0x57c62a){if(_0x57c62a){var _0x5369cf=_0x57c62a[_0x409b67];var _0x37e72d=_0x5369cf&&_0x5369cf[_0xe4c4('0x130')]?_0x5369cf[_0xe4c4('0x130')]:[];_0x214f2c[_0xe4c4('0x35')]({'fromKey':_[_0xe4c4('0x96')](_0x5369cf[_0xe4c4('0x131')])?undefined:_0x5369cf[_0xe4c4('0x131')],'count':_0x37e72d[_0xe4c4('0x57')],'rows':_0x37e72d});}})[_0xe4c4('0x24')](handleError(_0x214f2c,null));};exports[_0xe4c4('0x132')]=function(_0x481af5,_0x6536c0){var _0x41b65a={'raw':![],'where':{}};var _0x3082={};var _0x10aaa={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xe4c4('0x79')]({'where':{'id':_0x481af5[_0xe4c4('0x64')]['id']}})[_0xe4c4('0x1c')](handleEntityNotFound(_0x6536c0,null))[_0xe4c4('0x1c')](function(_0x4cfffa){if(_0x4cfffa){_0x3082[_0xe4c4('0x47')]=_['keys'](db['ChatOfflineMessage'][_0xe4c4('0x4f')]);_0x3082[_0xe4c4('0x52')]=_['keys'](_0x481af5[_0xe4c4('0x52')]);_0x3082[_0xe4c4('0x54')]=_[_0xe4c4('0x65')](_0x3082[_0xe4c4('0x47')],_0x3082[_0xe4c4('0x52')]);_0x41b65a[_0xe4c4('0x55')]=_[_0xe4c4('0x65')](_0x3082[_0xe4c4('0x47')],qs[_0xe4c4('0x56')](_0x481af5['query']['fields']));_0x41b65a['attributes']=_0x41b65a[_0xe4c4('0x55')][_0xe4c4('0x57')]?_0x41b65a[_0xe4c4('0x55')]:_0x3082[_0xe4c4('0x47')];if(!_0x481af5['query'][_0xe4c4('0x58')](_0xe4c4('0x80'))){_0x41b65a['limit']=qs[_0xe4c4('0x27')](_0x481af5[_0xe4c4('0x52')][_0xe4c4('0x27')]);_0x41b65a['offset']=qs[_0xe4c4('0x29')](_0x481af5[_0xe4c4('0x52')][_0xe4c4('0x29')]);}_0x41b65a[_0xe4c4('0x59')]=qs['sort'](_0x481af5[_0xe4c4('0x52')][_0xe4c4('0x5a')]);_0x41b65a[_0xe4c4('0x5b')]=qs[_0xe4c4('0x54')](_[_0xe4c4('0x5c')](_0x481af5[_0xe4c4('0x52')],_0x3082[_0xe4c4('0x54')]));_0x41b65a[_0xe4c4('0x5b')][_0xe4c4('0x7a')]=_0x4cfffa['id'];if(_0x481af5[_0xe4c4('0x52')][_0xe4c4('0x5d')]){_0x41b65a[_0xe4c4('0x5b')]=_['merge'](_0x41b65a[_0xe4c4('0x5b')],{'$or':_[_0xe4c4('0x4d')](_0x41b65a[_0xe4c4('0x55')],function(_0x41f839){var _0x4d79b2={};_0x4d79b2[_0x41f839]={'$like':'%'+_0x481af5[_0xe4c4('0x52')][_0xe4c4('0x5d')]+'%'};return _0x4d79b2;})});}_0x41b65a=_[_0xe4c4('0x5e')]({},_0x41b65a,_0x481af5[_0xe4c4('0x60')]);return db[_0xe4c4('0xe7')][_0xe4c4('0x28')]({'where':_0x41b65a[_0xe4c4('0x5b')]})[_0xe4c4('0x1c')](function(_0x153150){_0x10aaa[_0xe4c4('0x28')]=_0x153150;if(_0x481af5[_0xe4c4('0x52')][_0xe4c4('0x61')]){_0x41b65a[_0xe4c4('0x62')]=[{'all':!![]}];}else{_0x41b65a['include']=[{'model':db[_0xe4c4('0xa3')],'as':_0xe4c4('0x106'),'required':![]},{'model':db[_0xe4c4('0xf2')],'as':_0xe4c4('0x133'),'required':![]}];}return db[_0xe4c4('0xe7')][_0xe4c4('0x10c')](_0x41b65a);})[_0xe4c4('0x1c')](function(_0x35e938){_0x10aaa[_0xe4c4('0x7b')]=_0x35e938;return _0x10aaa;});}})[_0xe4c4('0x1c')](respondWithFilteredResult(_0x6536c0,_0x41b65a))[_0xe4c4('0x24')](handleError(_0x6536c0,null));};exports['addAgents']=function(_0x256ef6,_0x392ae0){return db[_0xe4c4('0x4e')][_0xe4c4('0x6f')]({'where':{'id':_0x256ef6['params']['id']}})[_0xe4c4('0x1c')](handleEntityNotFound(_0x392ae0,null))[_0xe4c4('0x1c')](function(_0x34167a){if(_0x34167a){return _0x34167a[_0xe4c4('0x134')](_0x256ef6[_0xe4c4('0x66')]['ids'],_['omit'](_0x256ef6['body'],[_0xe4c4('0x7d'),'id'])||{})[_0xe4c4('0xe2')](function(_0x1be484){for(var _0x307beb=0x0;_0x307beb<_0x256ef6['body'][_0xe4c4('0x7d')]['length'];_0x307beb+=0x1){socket['emit']('userChatWebsite:save',{'UserId':Number(_0x256ef6['body'][_0xe4c4('0x7d')][_0x307beb]),'ChatWebsiteId':Number(_0x256ef6[_0xe4c4('0x64')]['id'])});}return _0x1be484;});}})[_0xe4c4('0x1c')](respondWithResult(_0x392ae0,null))[_0xe4c4('0x24')](handleError(_0x392ae0,null));};exports[_0xe4c4('0x135')]=function(_0x443ddb,_0x701cee){return db['ChatWebsite'][_0xe4c4('0x6f')]({'where':{'id':_0x443ddb[_0xe4c4('0x64')]['id']}})[_0xe4c4('0x1c')](handleEntityNotFound(_0x701cee,null))[_0xe4c4('0x1c')](function(_0x592bdc){if(_0x592bdc){return _0x592bdc[_0xe4c4('0x135')](_0x443ddb[_0xe4c4('0x52')][_0xe4c4('0x7d')])['then'](function(){if(_[_0xe4c4('0x136')](_0x443ddb[_0xe4c4('0x52')][_0xe4c4('0x7d')])){for(var _0x2d0d03=0x0;_0x2d0d03<_0x443ddb['query']['ids'][_0xe4c4('0x57')];_0x2d0d03+=0x1){socket['emit']('userChatWebsite:remove',{'UserId':Number(_0x443ddb['query']['ids'][_0x2d0d03]),'ChatWebsiteId':Number(_0x443ddb[_0xe4c4('0x64')]['id'])});}}else{socket[_0xe4c4('0x137')]('userChatWebsite:remove',{'UserId':Number(_0x443ddb[_0xe4c4('0x52')][_0xe4c4('0x7d')]),'ChatWebsiteId':Number(_0x443ddb['params']['id'])});}});}})[_0xe4c4('0x1c')](respondWithStatusCode(_0x701cee,null))[_0xe4c4('0x24')](handleError(_0x701cee,null));};exports[_0xe4c4('0x138')]=function(_0x7a58c6,_0x530584){var _0x2e66c1={};var _0x36660e={};var _0x560404;var _0x49af45;return db[_0xe4c4('0x4e')][_0xe4c4('0x79')]({'where':{'id':_0x7a58c6[_0xe4c4('0x64')]['id']}})[_0xe4c4('0x1c')](handleEntityNotFound(_0x530584,null))[_0xe4c4('0x1c')](function(_0x4fdbb3){if(_0x4fdbb3){_0x560404=_0x4fdbb3;_0x36660e[_0xe4c4('0x47')]=_[_0xe4c4('0x53')](db[_0xe4c4('0xcc')][_0xe4c4('0x4f')]);_0x36660e[_0xe4c4('0x52')]=_[_0xe4c4('0x53')](_0x7a58c6[_0xe4c4('0x52')]);_0x36660e['filters']=_['intersection'](_0x36660e[_0xe4c4('0x47')],_0x36660e[_0xe4c4('0x52')]);_0x2e66c1[_0xe4c4('0x55')]=_[_0xe4c4('0x65')](_0x36660e['model'],qs[_0xe4c4('0x56')](_0x7a58c6[_0xe4c4('0x52')][_0xe4c4('0x56')]));_0x2e66c1['attributes']=_0x2e66c1['attributes']['length']?_0x2e66c1[_0xe4c4('0x55')]:_0x36660e[_0xe4c4('0x47')];_0x2e66c1[_0xe4c4('0x59')]=qs[_0xe4c4('0x5a')](_0x7a58c6[_0xe4c4('0x52')][_0xe4c4('0x5a')]);_0x2e66c1[_0xe4c4('0x5b')]=qs[_0xe4c4('0x54')](_[_0xe4c4('0x5c')](_0x7a58c6['query'],_0x36660e[_0xe4c4('0x54')]));if(_0x7a58c6[_0xe4c4('0x52')][_0xe4c4('0x5d')]){_0x2e66c1[_0xe4c4('0x5b')]=_['merge'](_0x2e66c1['where'],{'$or':_['map'](_0x2e66c1[_0xe4c4('0x55')],function(_0x30c149){var _0x1ab071={};_0x1ab071[_0x30c149]={'$like':'%'+_0x7a58c6[_0xe4c4('0x52')][_0xe4c4('0x5d')]+'%'};return _0x1ab071;})});}_0x2e66c1=_[_0xe4c4('0x5e')]({},_0x2e66c1,_0x7a58c6['options']);return _0x560404[_0xe4c4('0x138')](_0x2e66c1);}})['then'](function(_0x5e01f9){if(_0x5e01f9){_0x49af45=_0x5e01f9[_0xe4c4('0x57')];if(!_0x7a58c6[_0xe4c4('0x52')][_0xe4c4('0x58')]('nolimit')){_0x2e66c1[_0xe4c4('0x27')]=qs[_0xe4c4('0x27')](_0x7a58c6[_0xe4c4('0x52')][_0xe4c4('0x27')]);_0x2e66c1[_0xe4c4('0x29')]=qs[_0xe4c4('0x29')](_0x7a58c6['query'][_0xe4c4('0x29')]);}return _0x560404[_0xe4c4('0x138')](_0x2e66c1);}})[_0xe4c4('0x1c')](function(_0x405627){if(_0x405627){return _0x405627?{'count':_0x49af45,'rows':_0x405627}:null;}})['then'](respondWithResult(_0x530584,null))['catch'](handleError(_0x530584,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 6553e18..1d3930f 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 _0x207c=['hook','exports','../../mysqldb','ChatWebsite','setMaxListeners','save','update','remove','hasOwnProperty'];(function(_0x8ae98b,_0x155f88){var _0xc30bd4=function(_0x5ca462){while(--_0x5ca462){_0x8ae98b['push'](_0x8ae98b['shift']());}};_0xc30bd4(++_0x155f88);}(_0x207c,0x1e8));var _0xc207=function(_0x3fbb91,_0x5ec106){_0x3fbb91=_0x3fbb91-0x0;var _0x3eb213=_0x207c[_0x3fbb91];return _0x3eb213;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0xc207('0x0'))['db'][_0xc207('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xc207('0x2')](0x0);var events={'afterCreate':_0xc207('0x3'),'afterUpdate':_0xc207('0x4'),'afterDestroy':_0xc207('0x5')};function emitEvent(_0x1dd107){return function(_0x4b9daa,_0x38ff02,_0x59bc89){ChatWebsiteEvents['emit'](_0x1dd107+':'+_0x4b9daa['id'],_0x4b9daa);ChatWebsiteEvents['emit'](_0x1dd107,_0x4b9daa);_0x59bc89(null);};}for(var e in events){if(events[_0xc207('0x6')](e)){var event=events[e];ChatWebsite[_0xc207('0x7')](e,emitEvent(event));}}module[_0xc207('0x8')]=ChatWebsiteEvents; \ No newline at end of file +var _0x861c=['../../mysqldb','ChatWebsite','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x56d9b5,_0x1db06e){var _0x24829b=function(_0x19e839){while(--_0x19e839){_0x56d9b5['push'](_0x56d9b5['shift']());}};_0x24829b(++_0x1db06e);}(_0x861c,0xdb));var _0xc861=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x861c[_0x21a9d9];return _0x46adce;};'use strict';var EventEmitter=require(_0xc861('0x0'));var ChatWebsite=require(_0xc861('0x1'))['db'][_0xc861('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xc861('0x3')](0x0);var events={'afterCreate':_0xc861('0x4'),'afterUpdate':_0xc861('0x5'),'afterDestroy':_0xc861('0x6')};function emitEvent(_0x683b83){return function(_0x28ed01,_0xc70070,_0x2690f9){ChatWebsiteEvents[_0xc861('0x7')](_0x683b83+':'+_0x28ed01['id'],_0x28ed01);ChatWebsiteEvents['emit'](_0x683b83,_0x28ed01);_0x2690f9(null);};}for(var e in events){if(events[_0xc861('0x8')](e)){var event=events[e];ChatWebsite[_0xc861('0x9')](e,emitEvent(event));}}module[_0xc861('0xa')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index e297a02..550b93c 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 _0xaa82=['chat_websites','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','define'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0xaa82,0x1e1));var _0x2aa8=function(_0x59afc0,_0x5d46b9){_0x59afc0=_0x59afc0-0x0;var _0x2d4e1a=_0xaa82[_0x59afc0];return _0x2d4e1a;};'use strict';var _=require(_0x2aa8('0x0'));var util=require('util');var logger=require(_0x2aa8('0x1'))(_0x2aa8('0x2'));var moment=require(_0x2aa8('0x3'));var BPromise=require('bluebird');var rp=require(_0x2aa8('0x4'));var fs=require('fs');var path=require(_0x2aa8('0x5'));var rimraf=require(_0x2aa8('0x6'));var config=require(_0x2aa8('0x7'));var attributes=require(_0x2aa8('0x8'));module[_0x2aa8('0x9')]=function(_0xbb176d,_0x32ba0e){return _0xbb176d[_0x2aa8('0xa')]('ChatWebsite',attributes,{'tableName':_0x2aa8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x895b=['exports','define','ChatWebsite','chat_websites','lodash','util','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x47bcbc,_0x4edd2a){var _0x29421a=function(_0x20e70f){while(--_0x20e70f){_0x47bcbc['push'](_0x47bcbc['shift']());}};_0x29421a(++_0x4edd2a);}(_0x895b,0x138));var _0xb895=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x895b[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0xb895('0x0'));var util=require(_0xb895('0x1'));var logger=require('../../config/logger')(_0xb895('0x2'));var moment=require(_0xb895('0x3'));var BPromise=require('bluebird');var rp=require(_0xb895('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb895('0x5'));var config=require(_0xb895('0x6'));var attributes=require('./chatWebsite.attributes');module[_0xb895('0x7')]=function(_0x2af6d8,_0x1f18bd){return _0x2af6d8[_0xb895('0x8')](_0xb895('0x9'),attributes,{'tableName':_0xb895('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index ab25ae3..83c9b4a 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 _0x02a7=['jayson/promise','http','redis','defaults','localhost','./chatWebsite.socket','register','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','error','message','info','result','catch','lodash','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x1ab60d,_0x4a4260){var _0x3c52b8=function(_0x3d1e7b){while(--_0x3d1e7b){_0x1ab60d['push'](_0x1ab60d['shift']());}};_0x3c52b8(++_0x4a4260);}(_0x02a7,0x16a));var _0x702a=function(_0x4b85de,_0x137569){_0x4b85de=_0x4b85de-0x0;var _0x1df244=_0x02a7[_0x4b85de];return _0x1df244;};'use strict';var _=require(_0x702a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x702a('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x702a('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x702a('0x3'))(_0x702a('0x4'));var config=require(_0x702a('0x5'));var jayson=require(_0x702a('0x6'));var client=jayson['client'][_0x702a('0x7')]({'port':0x232a});config[_0x702a('0x8')]=_[_0x702a('0x9')](config[_0x702a('0x8')],{'host':_0x702a('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x702a('0x8')]));require(_0x702a('0xb'))[_0x702a('0xc')](socket);function respondWithRpcPromise(_0x2feb13,_0x1015ba,_0x508601){return new BPromise(function(_0x241c4b,_0x2fa187){return client[_0x702a('0xd')](_0x2feb13,_0x508601)[_0x702a('0xe')](function(_0xb29ae4){logger['info'](_0x702a('0xf'),_0x1015ba,_0x702a('0x10'));logger[_0x702a('0x11')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x1015ba,_0x702a('0x10'),JSON['stringify'](_0xb29ae4));if(_0xb29ae4[_0x702a('0x12')]){if(_0xb29ae4[_0x702a('0x12')]['code']===0x1f4){logger[_0x702a('0x12')]('ChatWebsite,\x20%s,\x20%s',_0x1015ba,_0xb29ae4[_0x702a('0x12')]['message']);return _0x2fa187(_0xb29ae4[_0x702a('0x12')][_0x702a('0x13')]);}logger[_0x702a('0x12')](_0x702a('0xf'),_0x1015ba,_0xb29ae4['error'][_0x702a('0x13')]);return _0x241c4b(_0xb29ae4['error'][_0x702a('0x13')]);}else{logger[_0x702a('0x14')](_0x702a('0xf'),_0x1015ba,_0x702a('0x10'));_0x241c4b(_0xb29ae4[_0x702a('0x15')][_0x702a('0x13')]);}})[_0x702a('0x16')](function(_0x4235c9){logger['error'](_0x702a('0xf'),_0x1015ba,_0x4235c9);_0x2fa187(_0x4235c9);});});} \ No newline at end of file +var _0x9f4e=['request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s'];(function(_0x2c5505,_0x2a7c7a){var _0x331581=function(_0xeb7147){while(--_0xeb7147){_0x2c5505['push'](_0x2c5505['shift']());}};_0x331581(++_0x2a7c7a);}(_0x9f4e,0x1d1));var _0xe9f4=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0x9f4e[_0x1c546c];return _0x2cc384;};'use strict';var _=require(_0xe9f4('0x0'));var util=require(_0xe9f4('0x1'));var moment=require(_0xe9f4('0x2'));var BPromise=require(_0xe9f4('0x3'));var rs=require(_0xe9f4('0x4'));var fs=require('fs');var Redis=require(_0xe9f4('0x5'));var db=require(_0xe9f4('0x6'))['db'];var utils=require(_0xe9f4('0x7'));var logger=require(_0xe9f4('0x8'))('rpc');var config=require(_0xe9f4('0x9'));var jayson=require(_0xe9f4('0xa'));var client=jayson[_0xe9f4('0xb')]['http']({'port':0x232a});config[_0xe9f4('0xc')]=_[_0xe9f4('0xd')](config[_0xe9f4('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xe9f4('0xe'))(new Redis(config[_0xe9f4('0xc')]));require(_0xe9f4('0xf'))[_0xe9f4('0x10')](socket);function respondWithRpcPromise(_0x402d8d,_0x322378,_0x16fb3f){return new BPromise(function(_0xf9140e,_0x28e29c){return client[_0xe9f4('0x11')](_0x402d8d,_0x16fb3f)[_0xe9f4('0x12')](function(_0xe8939f){logger[_0xe9f4('0x13')](_0xe9f4('0x14'),_0x322378,_0xe9f4('0x15'));logger['debug']('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x322378,'request\x20sent',JSON[_0xe9f4('0x16')](_0xe8939f));if(_0xe8939f[_0xe9f4('0x17')]){if(_0xe8939f[_0xe9f4('0x17')][_0xe9f4('0x18')]===0x1f4){logger[_0xe9f4('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x322378,_0xe8939f[_0xe9f4('0x17')]['message']);return _0x28e29c(_0xe8939f['error'][_0xe9f4('0x19')]);}logger['error']('ChatWebsite,\x20%s,\x20%s',_0x322378,_0xe8939f[_0xe9f4('0x17')]['message']);return _0xf9140e(_0xe8939f[_0xe9f4('0x17')]['message']);}else{logger[_0xe9f4('0x13')](_0xe9f4('0x14'),_0x322378,_0xe9f4('0x15'));_0xf9140e(_0xe8939f[_0xe9f4('0x1a')][_0xe9f4('0x19')]);}})['catch'](function(_0x1e3bb2){logger[_0xe9f4('0x17')](_0xe9f4('0x14'),_0x322378,_0x1e3bb2);_0x28e29c(_0x1e3bb2);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index cccf068..3808d92 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 _0xb320=['emit','removeListener','register','length','./chatWebsite.events','save','remove','update'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xb320,0x1ac));var _0x0b32=function(_0x56a871,_0x18b7fe){_0x56a871=_0x56a871-0x0;var _0x124954=_0xb320[_0x56a871];return _0x124954;};'use strict';var ChatWebsiteEvents=require(_0x0b32('0x0'));var events=[_0x0b32('0x1'),_0x0b32('0x2'),_0x0b32('0x3')];function createListener(_0x41bcb6,_0x216b4f){return function(_0x3e6582){_0x216b4f[_0x0b32('0x4')](_0x41bcb6,_0x3e6582);};}function removeListener(_0x4338d9,_0x44c23b){return function(){ChatWebsiteEvents[_0x0b32('0x5')](_0x4338d9,_0x44c23b);};}exports[_0x0b32('0x6')]=function(_0x58842c){for(var _0x2c589f=0x0,_0x57b62e=events[_0x0b32('0x7')];_0x2c589f<_0x57b62e;_0x2c589f++){var _0x4636c6=events[_0x2c589f];var _0x396340=createListener('chatWebsite:'+_0x4636c6,_0x58842c);ChatWebsiteEvents['on'](_0x4636c6,_0x396340);}}; \ No newline at end of file +var _0x4777=['./chatWebsite.events','remove','update','emit','removeListener','register','length'];(function(_0x4023e2,_0xd2597d){var _0x347129=function(_0x4db2fc){while(--_0x4db2fc){_0x4023e2['push'](_0x4023e2['shift']());}};_0x347129(++_0xd2597d);}(_0x4777,0x15e));var _0x7477=function(_0x31a576,_0x424419){_0x31a576=_0x31a576-0x0;var _0x30b1d3=_0x4777[_0x31a576];return _0x30b1d3;};'use strict';var ChatWebsiteEvents=require(_0x7477('0x0'));var events=['save',_0x7477('0x1'),_0x7477('0x2')];function createListener(_0x75a8bb,_0x496a2d){return function(_0x543437){_0x496a2d[_0x7477('0x3')](_0x75a8bb,_0x543437);};}function removeListener(_0x53ac44,_0x5f1aa2){return function(){ChatWebsiteEvents[_0x7477('0x4')](_0x53ac44,_0x5f1aa2);};}exports[_0x7477('0x5')]=function(_0xec1a4e){for(var _0x1667e1=0x0,_0x2c979d=events[_0x7477('0x6')];_0x1667e1<_0x2c979d;_0x1667e1++){var _0x258e5b=events[_0x1667e1];var _0x5afc82=createListener('chatWebsite:'+_0x258e5b,_0xec1a4e);ChatWebsiteEvents['on'](_0x258e5b,_0x5afc82);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/helpers/wildcard-expressions.js b/server/api/chatWebsite/helpers/wildcard-expressions.js index 657bde9..fcdef75 100644 --- a/server/api/chatWebsite/helpers/wildcard-expressions.js +++ b/server/api/chatWebsite/helpers/wildcard-expressions.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb422=['([\x5cw]+)','URL','replace','trim'];(function(_0x46567b,_0x3445e9){var _0x496280=function(_0xedacf2){while(--_0xedacf2){_0x46567b['push'](_0x46567b['shift']());}};_0x496280(++_0x3445e9);}(_0xb422,0x85));var _0x2b42=function(_0x1b1604,_0x368535){_0x1b1604=_0x1b1604-0x0;var _0x57918d=_0xb422[_0x1b1604];return _0x57918d;};var escapeRegExp=require('../../../utils/misc')['escapeRegExp'];var URL=require('url')[_0x2b42('0x0')];function testWildcardValidity(_0x5df79b){var _0x51ff45=!![];try{new URL(_0x5df79b[_0x2b42('0x1')]('*','localhost'));}catch(_0x14330f){_0x51ff45=![];}return _0x51ff45&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)['test'](_0x5df79b);}function testWebsiteWithWildcard(_0x1b469f,_0x5d0f67){var _0x406d93;var _0x1a0fbe=escapeRegExp(_0x1b469f[_0x2b42('0x2')]()['replace'](/\/$/,''))[_0x2b42('0x1')]('\x5c*',_0x2b42('0x3'));try{new URL(_0x1b469f[_0x2b42('0x1')]('\x5c*','localhost'));_0x406d93=new RegExp(_0x1a0fbe)['test'](_0x5d0f67);}catch(_0x4174e8){_0x406d93=![];}return _0x406d93;}module['exports']={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity}; \ No newline at end of file +var _0x524e=['replace','localhost','test','trim','([\x5cw]+)','exports','url','URL'];(function(_0xcf4ad9,_0x3a0633){var _0x17e368=function(_0x3a6448){while(--_0x3a6448){_0xcf4ad9['push'](_0xcf4ad9['shift']());}};_0x17e368(++_0x3a0633);}(_0x524e,0x15e));var _0xe524=function(_0x4d874e,_0x453c11){_0x4d874e=_0x4d874e-0x0;var _0x280e26=_0x524e[_0x4d874e];return _0x280e26;};var escapeRegExp=require('../../../utils/misc')['escapeRegExp'];var URL=require(_0xe524('0x0'))[_0xe524('0x1')];function testWildcardValidity(_0xc5f6b5){var _0x29e619=!![];try{new URL(_0xc5f6b5[_0xe524('0x2')]('*',_0xe524('0x3')));}catch(_0xabd694){_0x29e619=![];}return _0x29e619&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)[_0xe524('0x4')](_0xc5f6b5);}function testWebsiteWithWildcard(_0x10d37a,_0x110cff){var _0x4f75d6;var _0xaaeaa9=escapeRegExp(_0x10d37a[_0xe524('0x5')]()[_0xe524('0x2')](/\/$/,''))['replace']('\x5c*',_0xe524('0x6'));try{new URL(_0x10d37a[_0xe524('0x2')]('\x5c*',_0xe524('0x3')));_0x4f75d6=new RegExp(_0xaaeaa9)[_0xe524('0x4')](_0x110cff);}catch(_0x991924){_0x4f75d6=![];}return _0x4f75d6;}module[_0xe524('0x7')]={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 2ea176b..01142f0 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 _0x0fde=['/:id/users','getAgents','post','create','/:id/dispositions','addDisposition','diskStorage','join','root','format','%s-%s','now','originalname','single','addLogo','server/files/images/avatars/','file','addSystemAvatar','attachments','offline-chat','ensureDir','replace','extname','/:id/offline','any','offline','/:id/applications','addProactiveActions','addAgents','put','update','delete','/:id','removeDispositions','/:id/canned_answers','removeAgents','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','./chatWebsite.controller','get','isAuthenticated','/describe','describe','getDispositions','getAnswers','getLogo','getAvatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','/:id/snippet','getSnippet','getApplications','/:id/proactive_actions','getProactiveActions','getFields','getOfflineMessages'];(function(_0x8ce506,_0x517f30){var _0x23c8e5=function(_0x1d048e){while(--_0x1d048e){_0x8ce506['push'](_0x8ce506['shift']());}};_0x23c8e5(++_0x517f30);}(_0x0fde,0x64));var _0xe0fd=function(_0x16ac66,_0x5d6dc3){_0x16ac66=_0x16ac66-0x0;var _0x32e972=_0x0fde[_0x16ac66];return _0x32e972;};'use strict';var multer=require(_0xe0fd('0x0'));var util=require(_0xe0fd('0x1'));var path=require(_0xe0fd('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe0fd('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xe0fd('0x4'));var interaction=require(_0xe0fd('0x5'));var config=require('../../config/environment');var controller=require(_0xe0fd('0x6'));router[_0xe0fd('0x7')]('/',auth[_0xe0fd('0x8')](),controller['index']);router['get'](_0xe0fd('0x9'),auth[_0xe0fd('0x8')](),controller[_0xe0fd('0xa')]);router[_0xe0fd('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router['get']('/:id/dispositions',auth[_0xe0fd('0x8')](),controller[_0xe0fd('0xb')]);router[_0xe0fd('0x7')]('/:id/canned_answers',auth[_0xe0fd('0x8')](),controller[_0xe0fd('0xc')]);router[_0xe0fd('0x7')]('/:id/logo',controller[_0xe0fd('0xd')]);router[_0xe0fd('0x7')]('/:id/avatar',controller[_0xe0fd('0xe')]);router['get']('/:id/customer_avatar',controller[_0xe0fd('0xf')]);router[_0xe0fd('0x7')](_0xe0fd('0x10'),controller[_0xe0fd('0x11')]);router[_0xe0fd('0x7')](_0xe0fd('0x12'),auth[_0xe0fd('0x8')](),controller['getInteractions']);router[_0xe0fd('0x7')](_0xe0fd('0x13'),controller[_0xe0fd('0x14')]);router[_0xe0fd('0x7')]('/:id/applications',auth[_0xe0fd('0x8')](),controller[_0xe0fd('0x15')]);router[_0xe0fd('0x7')](_0xe0fd('0x16'),auth[_0xe0fd('0x8')](),controller[_0xe0fd('0x17')]);router[_0xe0fd('0x7')]('/:id/fields',controller[_0xe0fd('0x18')]);router[_0xe0fd('0x7')]('/:id/offline_messages',auth[_0xe0fd('0x8')](),controller[_0xe0fd('0x19')]);router[_0xe0fd('0x7')](_0xe0fd('0x1a'),auth[_0xe0fd('0x8')](),controller[_0xe0fd('0x1b')]);router[_0xe0fd('0x1c')]('/',auth[_0xe0fd('0x8')](),controller[_0xe0fd('0x1d')]);router['post'](_0xe0fd('0x1e'),auth[_0xe0fd('0x8')](),controller[_0xe0fd('0x1f')]);router[_0xe0fd('0x1c')]('/:id/canned_answers',auth[_0xe0fd('0x8')](),controller['addAnswer']);var upload=multer({'storage':multer[_0xe0fd('0x20')]({'destination':function(_0x4dad24,_0x359974,_0x344d1c){_0x344d1c(null,path[_0xe0fd('0x21')](config[_0xe0fd('0x22')],'server/files/images/logos/'));},'filename':function(_0x3e3580,_0x2acfec,_0x560bd6){_0x560bd6(null,util[_0xe0fd('0x23')](_0xe0fd('0x24'),Date[_0xe0fd('0x25')](),_0x2acfec[_0xe0fd('0x26')]));}})});router[_0xe0fd('0x1c')]('/:id/logo',upload[_0xe0fd('0x27')]('file'),controller[_0xe0fd('0x28')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x136d7a,_0x1d3bb0,_0x17baec){_0x17baec(null,path[_0xe0fd('0x21')](config[_0xe0fd('0x22')],_0xe0fd('0x29')));},'filename':function(_0xc70ed3,_0x4e28be,_0x508102){_0x508102(null,util[_0xe0fd('0x23')]('%s-%s',Date['now'](),_0x4e28be[_0xe0fd('0x26')]));}})});router['post']('/:id/avatar',upload[_0xe0fd('0x27')](_0xe0fd('0x2a')),controller['addAvatar']);var upload=multer({'storage':multer[_0xe0fd('0x20')]({'destination':function(_0x11ed49,_0x3449aa,_0x5e8326){_0x5e8326(null,path[_0xe0fd('0x21')](config['root'],_0xe0fd('0x29')));},'filename':function(_0x109067,_0x711661,_0x45b4cb){_0x45b4cb(null,util[_0xe0fd('0x23')]('%s-%s',Date[_0xe0fd('0x25')](),_0x711661['originalname']));}})});router[_0xe0fd('0x1c')]('/:id/customer_avatar',upload[_0xe0fd('0x27')](_0xe0fd('0x2a')),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0xe0fd('0x20')]({'destination':function(_0x576f18,_0x1b054f,_0x4b80d8){_0x4b80d8(null,path['join'](config['root'],_0xe0fd('0x29')));},'filename':function(_0x18e2a3,_0x4f1434,_0xa62c0a){_0xa62c0a(null,util[_0xe0fd('0x23')](_0xe0fd('0x24'),Date[_0xe0fd('0x25')](),_0x4f1434[_0xe0fd('0x26')]));}})});router[_0xe0fd('0x1c')](_0xe0fd('0x10'),upload[_0xe0fd('0x27')](_0xe0fd('0x2a')),controller[_0xe0fd('0x2b')]);router['post']('/:id/notify',controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0xe0fd('0x20')]({'destination':function(_0x3e578b,_0x3d399e,_0x29aab5){const _0x302883=path['join'](config[_0xe0fd('0x22')],'server/files',_0xe0fd('0x2c'),_0xe0fd('0x2d'));fs_extra[_0xe0fd('0x2e')](_0x302883,function(){_0x29aab5(null,_0x302883);});},'filename':function(_0x1ca3c7,_0x34ee7c,_0x11d341){const _0x46f69b=_0x34ee7c[_0xe0fd('0x26')][_0xe0fd('0x2f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x76388a=path[_0xe0fd('0x30')](_0x46f69b);const _0x31a400=Date['now']()+'-'+_0x46f69b[_0xe0fd('0x2f')](_0x76388a,'')+_0x76388a;_0x11d341(null,_0x31a400);}})});router['post'](_0xe0fd('0x31'),offlineUploadMulter[_0xe0fd('0x32')](),controller[_0xe0fd('0x33')]);router['post'](_0xe0fd('0x12'),auth['isAuthenticated'](),controller['addInteraction']);router[_0xe0fd('0x1c')](_0xe0fd('0x34'),auth[_0xe0fd('0x8')](),controller['addApplications']);router['post'](_0xe0fd('0x16'),auth['isAuthenticated'](),controller[_0xe0fd('0x35')]);router[_0xe0fd('0x1c')]('/:id/users',auth[_0xe0fd('0x8')](),controller[_0xe0fd('0x36')]);router[_0xe0fd('0x37')]('/:id',auth[_0xe0fd('0x8')](),controller[_0xe0fd('0x38')]);router[_0xe0fd('0x39')](_0xe0fd('0x3a'),auth[_0xe0fd('0x8')](),controller['destroy']);router[_0xe0fd('0x39')](_0xe0fd('0x1e'),auth[_0xe0fd('0x8')](),controller[_0xe0fd('0x3b')]);router[_0xe0fd('0x39')](_0xe0fd('0x3c'),auth[_0xe0fd('0x8')](),controller['removeAnswers']);router[_0xe0fd('0x39')](_0xe0fd('0x1a'),auth[_0xe0fd('0x8')](),controller[_0xe0fd('0x3d')]);module[_0xe0fd('0x3e')]=router; \ No newline at end of file +var _0xdeec=['format','%s-%s','originalname','single','diskStorage','root','server/files/images/avatars/','now','file','addCustomerAvatar','/:id/system_avatar','notify','server/files','attachments','offline-chat','ensureDir','extname','replace','/:id/offline','any','offline','/:id/interactions','addInteraction','addApplications','/:id/proactive_actions','addAgents','put','/:id','update','delete','destroy','removeAnswers','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatWebsite.controller','isAuthenticated','get','describe','show','/:id/dispositions','/:id/canned_answers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','getSystemAvatar','getInteractions','/:id/snippet','/:id/applications','getApplications','getProactiveActions','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','create','post','addDisposition','join'];(function(_0x1b5a05,_0x2c80de){var _0x347931=function(_0xd39454){while(--_0xd39454){_0x1b5a05['push'](_0x1b5a05['shift']());}};_0x347931(++_0x2c80de);}(_0xdeec,0xf0));var _0xcdee=function(_0x1d3ff1,_0x56d009){_0x1d3ff1=_0x1d3ff1-0x0;var _0x5a0a4a=_0xdeec[_0x1d3ff1];return _0x5a0a4a;};'use strict';var multer=require('multer');var util=require(_0xcdee('0x0'));var path=require(_0xcdee('0x1'));var timeout=require(_0xcdee('0x2'));var express=require(_0xcdee('0x3'));var router=express[_0xcdee('0x4')]();var fs_extra=require(_0xcdee('0x5'));var auth=require(_0xcdee('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xcdee('0x7'));var controller=require(_0xcdee('0x8'));router['get']('/',auth[_0xcdee('0x9')](),controller['index']);router[_0xcdee('0xa')]('/describe',auth['isAuthenticated'](),controller[_0xcdee('0xb')]);router[_0xcdee('0xa')]('/:id',auth[_0xcdee('0x9')](),controller[_0xcdee('0xc')]);router[_0xcdee('0xa')](_0xcdee('0xd'),auth[_0xcdee('0x9')](),controller['getDispositions']);router[_0xcdee('0xa')](_0xcdee('0xe'),auth[_0xcdee('0x9')](),controller['getAnswers']);router[_0xcdee('0xa')](_0xcdee('0xf'),controller[_0xcdee('0x10')]);router[_0xcdee('0xa')](_0xcdee('0x11'),controller[_0xcdee('0x12')]);router[_0xcdee('0xa')](_0xcdee('0x13'),controller[_0xcdee('0x14')]);router[_0xcdee('0xa')]('/:id/system_avatar',controller[_0xcdee('0x15')]);router[_0xcdee('0xa')]('/:id/interactions',auth[_0xcdee('0x9')](),controller[_0xcdee('0x16')]);router['get'](_0xcdee('0x17'),controller['getSnippet']);router[_0xcdee('0xa')](_0xcdee('0x18'),auth[_0xcdee('0x9')](),controller[_0xcdee('0x19')]);router['get']('/:id/proactive_actions',auth[_0xcdee('0x9')](),controller[_0xcdee('0x1a')]);router[_0xcdee('0xa')]('/:id/fields',controller[_0xcdee('0x1b')]);router[_0xcdee('0xa')](_0xcdee('0x1c'),auth[_0xcdee('0x9')](),controller[_0xcdee('0x1d')]);router[_0xcdee('0xa')](_0xcdee('0x1e'),auth['isAuthenticated'](),controller[_0xcdee('0x1f')]);router['post']('/',auth[_0xcdee('0x9')](),controller[_0xcdee('0x20')]);router[_0xcdee('0x21')](_0xcdee('0xd'),auth[_0xcdee('0x9')](),controller[_0xcdee('0x22')]);router[_0xcdee('0x21')](_0xcdee('0xe'),auth['isAuthenticated'](),controller['addAnswer']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3f97b6,_0x3383e9,_0x398d96){_0x398d96(null,path[_0xcdee('0x23')](config['root'],'server/files/images/logos/'));},'filename':function(_0xaaceb0,_0x2d82fd,_0x4c5b82){_0x4c5b82(null,util[_0xcdee('0x24')](_0xcdee('0x25'),Date['now'](),_0x2d82fd[_0xcdee('0x26')]));}})});router['post']('/:id/logo',upload[_0xcdee('0x27')]('file'),controller['addLogo']);var upload=multer({'storage':multer[_0xcdee('0x28')]({'destination':function(_0x2f28ab,_0x1d0440,_0x3e4b19){_0x3e4b19(null,path[_0xcdee('0x23')](config[_0xcdee('0x29')],_0xcdee('0x2a')));},'filename':function(_0x5e3d13,_0x2af17d,_0x4a8f85){_0x4a8f85(null,util[_0xcdee('0x24')](_0xcdee('0x25'),Date[_0xcdee('0x2b')](),_0x2af17d['originalname']));}})});router[_0xcdee('0x21')](_0xcdee('0x11'),upload[_0xcdee('0x27')]('file'),controller['addAvatar']);var upload=multer({'storage':multer[_0xcdee('0x28')]({'destination':function(_0x40d96a,_0x142995,_0x40e42f){_0x40e42f(null,path[_0xcdee('0x23')](config[_0xcdee('0x29')],'server/files/images/avatars/'));},'filename':function(_0x2f07e8,_0x198f6f,_0x3d08b6){_0x3d08b6(null,util['format'](_0xcdee('0x25'),Date[_0xcdee('0x2b')](),_0x198f6f[_0xcdee('0x26')]));}})});router[_0xcdee('0x21')](_0xcdee('0x13'),upload[_0xcdee('0x27')](_0xcdee('0x2c')),controller[_0xcdee('0x2d')]);var upload=multer({'storage':multer[_0xcdee('0x28')]({'destination':function(_0x5379a2,_0x176c38,_0x4a1ad4){_0x4a1ad4(null,path['join'](config[_0xcdee('0x29')],_0xcdee('0x2a')));},'filename':function(_0x5182ee,_0x9d7e2a,_0x297adc){_0x297adc(null,util['format'](_0xcdee('0x25'),Date[_0xcdee('0x2b')](),_0x9d7e2a[_0xcdee('0x26')]));}})});router[_0xcdee('0x21')](_0xcdee('0x2e'),upload[_0xcdee('0x27')](_0xcdee('0x2c')),controller['addSystemAvatar']);router[_0xcdee('0x21')]('/:id/notify',controller[_0xcdee('0x2f')]);const offlineUploadMulter=multer({'storage':multer[_0xcdee('0x28')]({'destination':function(_0x305b88,_0x23016d,_0x468da8){const _0x2846fe=path[_0xcdee('0x23')](config[_0xcdee('0x29')],_0xcdee('0x30'),_0xcdee('0x31'),_0xcdee('0x32'));fs_extra[_0xcdee('0x33')](_0x2846fe,function(){_0x468da8(null,_0x2846fe);});},'filename':function(_0x20dac5,_0x52b7e8,_0x3013fc){const _0x38a095=_0x52b7e8[_0xcdee('0x26')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x4afa52=path[_0xcdee('0x34')](_0x38a095);const _0x3dd7a3=Date[_0xcdee('0x2b')]()+'-'+_0x38a095[_0xcdee('0x35')](_0x4afa52,'')+_0x4afa52;_0x3013fc(null,_0x3dd7a3);}})});router[_0xcdee('0x21')](_0xcdee('0x36'),offlineUploadMulter[_0xcdee('0x37')](),controller[_0xcdee('0x38')]);router['post'](_0xcdee('0x39'),auth[_0xcdee('0x9')](),controller[_0xcdee('0x3a')]);router[_0xcdee('0x21')](_0xcdee('0x18'),auth[_0xcdee('0x9')](),controller[_0xcdee('0x3b')]);router['post'](_0xcdee('0x3c'),auth[_0xcdee('0x9')](),controller['addProactiveActions']);router[_0xcdee('0x21')](_0xcdee('0x1e'),auth[_0xcdee('0x9')](),controller[_0xcdee('0x3d')]);router[_0xcdee('0x3e')](_0xcdee('0x3f'),auth[_0xcdee('0x9')](),controller[_0xcdee('0x40')]);router[_0xcdee('0x41')](_0xcdee('0x3f'),auth[_0xcdee('0x9')](),controller[_0xcdee('0x42')]);router[_0xcdee('0x41')](_0xcdee('0xd'),auth[_0xcdee('0x9')](),controller['removeDispositions']);router[_0xcdee('0x41')]('/:id/canned_answers',auth[_0xcdee('0x9')](),controller[_0xcdee('0x43')]);router[_0xcdee('0x41')](_0xcdee('0x1e'),auth[_0xcdee('0x9')](),controller['removeAgents']);module[_0xcdee('0x44')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index b01c233..85dd059 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 _0x1481=['production','app','get','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','use','isAuthenticated','beaver-logger/server','express','../components/auth/service','../config/environment','Router','env'];(function(_0x321781,_0x585793){var _0x1eacdc=function(_0x4f1695){while(--_0x4f1695){_0x321781['push'](_0x321781['shift']());}};_0x1eacdc(++_0x585793);}(_0x1481,0x6a));var _0x1148=function(_0x128c49,_0x4e77c6){_0x128c49=_0x128c49-0x0;var _0x5b9d42=_0x1481[_0x128c49];return _0x5b9d42;};var beaverLogger=require(_0x1148('0x0'));var express=require(_0x1148('0x1'));var auth=require(_0x1148('0x2'));var config=require(_0x1148('0x3'));var router=express[_0x1148('0x4')]();var isProduction=config[_0x1148('0x5')]===_0x1148('0x6')||![];function clientSideLogs(_0x319261,_0x428414,_0x4f6500){var _0x217ca5=_0x319261[_0x1148('0x7')][_0x1148('0x8')]('client-side-logger');if(!_0x217ca5){throw new Error(_0x1148('0x9'));}return beaverLogger[_0x1148('0xa')]({'uri':_0x1148('0xb'),'logger':_0x217ca5,'enableCors':!isProduction})(_0x319261,_0x428414,_0x4f6500);}router[_0x1148('0xc')](auth[_0x1148('0xd')](),clientSideLogs);module['exports']=router; \ No newline at end of file +var _0x8300=['app','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','use','isAuthenticated','../components/auth/service','../config/environment','Router','env'];(function(_0x42515e,_0x8a595c){var _0x76ed34=function(_0x14aba4){while(--_0x14aba4){_0x42515e['push'](_0x42515e['shift']());}};_0x76ed34(++_0x8a595c);}(_0x8300,0x74));var _0x0830=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x8300[_0x4a9fb1];return _0x348672;};var beaverLogger=require('beaver-logger/server');var express=require('express');var auth=require(_0x0830('0x0'));var config=require(_0x0830('0x1'));var router=express[_0x0830('0x2')]();var isProduction=config[_0x0830('0x3')]==='production'||![];function clientSideLogs(_0x2e69c1,_0x6d48f7,_0x1728c1){var _0x44b231=_0x2e69c1[_0x0830('0x4')]['get'](_0x0830('0x5'));if(!_0x44b231){throw new Error(_0x0830('0x6'));}return beaverLogger[_0x0830('0x7')]({'uri':'/client-logs','logger':_0x44b231,'enableCors':!isProduction})(_0x2e69c1,_0x6d48f7,_0x1728c1);}router[_0x0830('0x8')](auth[_0x0830('0x9')](),clientSideLogs);module['exports']=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 4dfe73e..692fa54 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 _0x190a=['AmazonAWS','Google','MicrosoftAzure','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','MicrosoftAzure\x20=>\x20access_token','TEXT','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','exports','STRING','ENUM'];(function(_0x7ed9e9,_0x35fb5d){var _0x383437=function(_0x496ea0){while(--_0x496ea0){_0x7ed9e9['push'](_0x7ed9e9['shift']());}};_0x383437(++_0x35fb5d);}(_0x190a,0x174));var _0xa190=function(_0x377fd1,_0x252296){_0x377fd1=_0x377fd1-0x0;var _0x4457dd=_0x190a[_0x377fd1];return _0x4457dd;};'use strict';var Sequelize=require('sequelize');module[_0xa190('0x0')]={'name':{'type':Sequelize[_0xa190('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xa190('0x2')](_0xa190('0x3'),_0xa190('0x4'),_0xa190('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xa190('0x2')](_0xa190('0x6'),_0xa190('0x7'))},'data1':{'type':Sequelize[_0xa190('0x1')],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize[_0xa190('0x1')],'comment':_0xa190('0x8')},'data3':{'type':Sequelize[_0xa190('0x1')],'comment':_0xa190('0x9')},'data4':{'type':Sequelize[_0xa190('0x1')],'comment':_0xa190('0xa')},'data5':{'type':Sequelize['TEXT'],'comment':_0xa190('0xb')},'data6':{'type':Sequelize[_0xa190('0xc')],'comment':_0xa190('0xd')},'data7':{'type':Sequelize['TEXT'],'comment':_0xa190('0xe')}}; \ No newline at end of file +var _0x512b=['Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','STRING','ENUM','AmazonAWS','Outlook365'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x512b,0xeb));var _0xb512=function(_0x3a8a4b,_0x4828ce){_0x3a8a4b=_0x3a8a4b-0x0;var _0x66f046=_0x512b[_0x3a8a4b];return _0x66f046;};'use strict';var Sequelize=require(_0xb512('0x0'));module['exports']={'name':{'type':Sequelize[_0xb512('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xb512('0x2')](_0xb512('0x3'),'Google','MicrosoftAzure'),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0xb512('0x4'),_0xb512('0x5'))},'data1':{'type':Sequelize[_0xb512('0x1')],'comment':_0xb512('0x6')},'data2':{'type':Sequelize[_0xb512('0x1')],'comment':_0xb512('0x7')},'data3':{'type':Sequelize[_0xb512('0x1')],'comment':_0xb512('0x8')},'data4':{'type':Sequelize[_0xb512('0x1')],'comment':_0xb512('0x9')},'data5':{'type':Sequelize[_0xb512('0xa')],'comment':'MicrosoftAzure\x20=>\x20access_token'},'data6':{'type':Sequelize[_0xb512('0xa')],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize['TEXT'],'comment':_0xb512('0xb')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 1a6895e..2cb026d 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 _0xc24f=['index','map','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','nolimit','order','sort','where','filters','merge','VIRTUAL','options','CloudProvider','includeAll','findAll','service','MicrosoftAzure','data3','catch','show','params','keys','include','find','decryptString','create','Name\x20parameter\x20not\x20specified','body','Service\x20parameter\x20not\x20specified','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','oauth2MicrosoftAuthorize','findOne','get','state','Invalid\x20state\x20parameter','parse','from','base64','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','access_token','data6','emit','microsoftAuthorization:success','microsoftAuthorization:error','message','stringify','ioredis','../../components/parsers/qs','../../components/encryptor','api','../../mysqldb','./cloudProvider.oauth','redis','socket.io-emitter','sendStatus','end','status','json','offset','undefined','limit','count','set','update','then','error','stack','name','send','padEnd','slice'];(function(_0x3e29df,_0x42fdf8){var _0x3e3ba9=function(_0x47ccb0){while(--_0x47ccb0){_0x3e29df['push'](_0x3e29df['shift']());}};_0x3e3ba9(++_0x42fdf8);}(_0xc24f,0x95));var _0xfc24=function(_0x90a029,_0x51e6b1){_0x90a029=_0x90a029-0x0;var _0xe30212=_0xc24f[_0x90a029];return _0xe30212;};'use strict';var _=require('lodash');var Redis=require(_0xfc24('0x0'));var qs=require(_0xfc24('0x1'));var encryptor=require(_0xfc24('0x2'));var config=require('../../config/environment');var logger=require('../../config/logger')(_0xfc24('0x3'));var db=require(_0xfc24('0x4'))['db'];var oauth=require(_0xfc24('0x5'));config[_0xfc24('0x6')]=_['defaults'](config[_0xfc24('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0xfc24('0x7'))(new Redis(config['redis']));var redis=new Redis(config[_0xfc24('0x6')]);function respondWithStatusCode(_0x48e475,_0x38c35f){_0x38c35f=_0x38c35f||0xcc;return function(_0x40a4ad){if(_0x40a4ad){return _0x48e475[_0xfc24('0x8')](_0x38c35f);}return _0x48e475['status'](_0x38c35f)[_0xfc24('0x9')]();};}function respondWithResult(_0x190df5,_0x3ab18c){_0x3ab18c=_0x3ab18c||0xc8;return function(_0x35ab8d){if(_0x35ab8d){return _0x190df5[_0xfc24('0xa')](_0x3ab18c)[_0xfc24('0xb')](_0x35ab8d);}};}function respondWithFilteredResult(_0xc8685,_0x562744){return function(_0xa24470){if(_0xa24470){var _0x262c65=typeof _0x562744[_0xfc24('0xc')]===_0xfc24('0xd')&&typeof _0x562744[_0xfc24('0xe')]===_0xfc24('0xd');var _0x55b8e3=_0xa24470['count'];var _0x532990=_0x262c65?0x0:_0x562744[_0xfc24('0xc')];var _0x25bf3b=_0x262c65?_0xa24470[_0xfc24('0xf')]:_0x562744['offset']+_0x562744['limit'];var _0x407448;if(_0x25bf3b>=_0x55b8e3){_0x25bf3b=_0x55b8e3;_0x407448=0xc8;}else{_0x407448=0xce;}_0xc8685[_0xfc24('0xa')](_0x407448);return _0xc8685[_0xfc24('0x10')]('Content-Range',_0x532990+'-'+_0x25bf3b+'/'+_0x55b8e3)[_0xfc24('0xb')](_0xa24470);}return null;};}function saveUpdates(_0x1e181f){return function(_0x4dc69d){if(_0x4dc69d){return _0x4dc69d[_0xfc24('0x11')](_0x1e181f)[_0xfc24('0x12')](function(_0x4209d7){return _0x4209d7;});}return null;};}function removeEntity(_0xdc7e7c){return function(_0x58d6f5){if(_0x58d6f5){return _0x58d6f5['destroy']()[_0xfc24('0x12')](function(){_0xdc7e7c[_0xfc24('0xa')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5bed2c){return function(_0x16f434){if(!_0x16f434){_0x5bed2c[_0xfc24('0x8')](0x194);}return _0x16f434;};}function handleError(_0x592ab3,_0x7f54bf){_0x7f54bf=_0x7f54bf||0x1f4;return function(_0x3ec3f7){logger[_0xfc24('0x13')](_0x3ec3f7[_0xfc24('0x14')]);if(_0x3ec3f7[_0xfc24('0x15')]){delete _0x3ec3f7['name'];}_0x592ab3[_0xfc24('0xa')](_0x7f54bf)[_0xfc24('0x16')](_0x3ec3f7);};}function maskClientSecret(_0xb890d9){return _[_0xfc24('0x17')](_0xb890d9[_0xfc24('0x18')](0x0,0x3),0x14,'*');}exports[_0xfc24('0x19')]=function(_0x5ab4a0,_0x1a1f8c){var _0xb2983e={},_0x385132={},_0x169778={'count':0x0,'rows':[]};var _0x4a8c95=_[_0xfc24('0x1a')](db['CloudProvider'][_0xfc24('0x1b')],function(_0x7dc29f){return{'name':_0x7dc29f[_0xfc24('0x1c')],'type':_0x7dc29f[_0xfc24('0x1d')][_0xfc24('0x1e')]};});_0x385132[_0xfc24('0x1f')]=_[_0xfc24('0x1a')](_0x4a8c95,_0xfc24('0x15'));_0x385132['query']=_['keys'](_0x5ab4a0[_0xfc24('0x20')]);_0x385132['filters']=_[_0xfc24('0x21')](_0x385132[_0xfc24('0x1f')],_0x385132[_0xfc24('0x20')]);_0xb2983e['attributes']=_[_0xfc24('0x21')](_0x385132[_0xfc24('0x1f')],qs['fields'](_0x5ab4a0[_0xfc24('0x20')][_0xfc24('0x22')]));_0xb2983e[_0xfc24('0x23')]=_0xb2983e['attributes'][_0xfc24('0x24')]?_0xb2983e[_0xfc24('0x23')]:_0x385132[_0xfc24('0x1f')];if(!_0x5ab4a0[_0xfc24('0x20')]['hasOwnProperty'](_0xfc24('0x25'))){_0xb2983e[_0xfc24('0xe')]=qs[_0xfc24('0xe')](_0x5ab4a0[_0xfc24('0x20')]['limit']);_0xb2983e['offset']=qs['offset'](_0x5ab4a0[_0xfc24('0x20')]['offset']);}_0xb2983e[_0xfc24('0x26')]=qs['sort'](_0x5ab4a0[_0xfc24('0x20')][_0xfc24('0x27')]);_0xb2983e[_0xfc24('0x28')]=qs['filters'](_['pick'](_0x5ab4a0[_0xfc24('0x20')],_0x385132[_0xfc24('0x29')]),_0x4a8c95);if(_0x5ab4a0[_0xfc24('0x20')]['filter']){_0xb2983e[_0xfc24('0x28')]=_[_0xfc24('0x2a')](_0xb2983e['where'],{'$or':_[_0xfc24('0x1a')](_0x4a8c95,function(_0x2f2268){if(_0x2f2268[_0xfc24('0x1d')]!==_0xfc24('0x2b')){var _0x5605cc={};_0x5605cc[_0x2f2268[_0xfc24('0x15')]]={'$like':'%'+_0x5ab4a0[_0xfc24('0x20')]['filter']+'%'};return _0x5605cc;}})});}_0xb2983e=_[_0xfc24('0x2a')]({},_0xb2983e,_0x5ab4a0[_0xfc24('0x2c')]);var _0x50e938={'where':_0xb2983e[_0xfc24('0x28')]};return db[_0xfc24('0x2d')][_0xfc24('0xf')](_0x50e938)[_0xfc24('0x12')](function(_0xafed1d){_0x169778[_0xfc24('0xf')]=_0xafed1d;if(_0x5ab4a0[_0xfc24('0x20')][_0xfc24('0x2e')]){_0xb2983e['include']=[{'all':!![]}];}return db[_0xfc24('0x2d')][_0xfc24('0x2f')](_0xb2983e);})[_0xfc24('0x12')](function(_0x9e6ed9){_0x169778['rows']=_[_0xfc24('0x1a')](_0x9e6ed9,function(_0xe6a284){if(_0xe6a284[_0xfc24('0x30')]===_0xfc24('0x31')){var _0x517e67=encryptor['decryptString'](_0xe6a284['data3']);_0xe6a284[_0xfc24('0x32')]=maskClientSecret(_0x517e67);}return _0xe6a284;});return _0x169778;})[_0xfc24('0x12')](respondWithFilteredResult(_0x1a1f8c,_0xb2983e))[_0xfc24('0x33')](handleError(_0x1a1f8c,null));};exports[_0xfc24('0x34')]=function(_0xb628b5,_0x196c36){var _0x156676={'raw':!![],'where':{'id':_0xb628b5[_0xfc24('0x35')]['id']}},_0x25eb62={};_0x25eb62[_0xfc24('0x1f')]=_[_0xfc24('0x36')](db['CloudProvider'][_0xfc24('0x1b')]);_0x25eb62[_0xfc24('0x20')]=_[_0xfc24('0x36')](_0xb628b5[_0xfc24('0x20')]);_0x25eb62[_0xfc24('0x29')]=_[_0xfc24('0x21')](_0x25eb62[_0xfc24('0x1f')],_0x25eb62[_0xfc24('0x20')]);_0x156676[_0xfc24('0x23')]=_[_0xfc24('0x21')](_0x25eb62[_0xfc24('0x1f')],qs[_0xfc24('0x22')](_0xb628b5['query'][_0xfc24('0x22')]));_0x156676['attributes']=_0x156676['attributes']['length']?_0x156676['attributes']:_0x25eb62['model'];if(_0xb628b5['query'][_0xfc24('0x2e')]){_0x156676[_0xfc24('0x37')]=[{'all':!![]}];}_0x156676=_[_0xfc24('0x2a')]({},_0x156676,_0xb628b5['options']);return db[_0xfc24('0x2d')][_0xfc24('0x38')](_0x156676)[_0xfc24('0x12')](handleEntityNotFound(_0x196c36,null))[_0xfc24('0x12')](function(_0x33dd38){if(_0x33dd38[_0xfc24('0x30')]===_0xfc24('0x31')){var _0x3828d1=encryptor[_0xfc24('0x39')](_0x33dd38[_0xfc24('0x32')]);_0x33dd38[_0xfc24('0x32')]=maskClientSecret(_0x3828d1);}return _0x33dd38;})[_0xfc24('0x12')](respondWithResult(_0x196c36,null))[_0xfc24('0x33')](handleError(_0x196c36,null));};exports[_0xfc24('0x3a')]=function(_0x557732,_0x40d5ab){if(!_0x557732['body'][_0xfc24('0x15')])throw new Error(_0xfc24('0x3b'));if(!_0x557732[_0xfc24('0x3c')][_0xfc24('0x30')])throw new Error(_0xfc24('0x3d'));var _0x2fa800=db[_0xfc24('0x2d')][_0xfc24('0x1b')]['service']['values'];if(!_0x2fa800[_0xfc24('0x3e')](_0x557732['body'][_0xfc24('0x30')]))throw new Error(_0xfc24('0x3f')+_0x2fa800[_0xfc24('0x40')](',\x20'));if(_0x557732['body'][_0xfc24('0x30')]===_0xfc24('0x31')&&_0x557732[_0xfc24('0x3c')][_0xfc24('0x32')]){_0x557732[_0xfc24('0x3c')][_0xfc24('0x32')]=encryptor['encryptString'](_0x557732[_0xfc24('0x3c')][_0xfc24('0x32')]);}return db[_0xfc24('0x2d')]['create'](_0x557732[_0xfc24('0x3c')],{})[_0xfc24('0x12')](respondWithResult(_0x40d5ab,0xc9))[_0xfc24('0x33')](handleError(_0x40d5ab,null));};exports['update']=function(_0x21e16,_0x3200fc){if(_0x21e16[_0xfc24('0x3c')]['id']){delete _0x21e16[_0xfc24('0x3c')]['id'];}return db[_0xfc24('0x2d')][_0xfc24('0x38')]({'where':{'id':_0x21e16[_0xfc24('0x35')]['id']}})['then'](handleEntityNotFound(_0x3200fc,null))[_0xfc24('0x12')](function(_0x4b73a1){if(_0x4b73a1[_0xfc24('0x30')]===_0xfc24('0x31')&&_0x21e16[_0xfc24('0x3c')][_0xfc24('0x32')]){_0x21e16[_0xfc24('0x3c')]['data3']=encryptor['encryptString'](_0x21e16['body'][_0xfc24('0x32')]);}return _0x4b73a1;})[_0xfc24('0x12')](saveUpdates(_0x21e16[_0xfc24('0x3c')],null))['then'](respondWithResult(_0x3200fc,null))['catch'](handleError(_0x3200fc,null));};exports['destroy']=function(_0x5a8679,_0x494f36){return db[_0xfc24('0x2d')][_0xfc24('0x38')]({'where':{'id':_0x5a8679[_0xfc24('0x35')]['id']}})[_0xfc24('0x12')](handleEntityNotFound(_0x494f36,null))[_0xfc24('0x12')](removeEntity(_0x494f36,null))[_0xfc24('0x33')](handleError(_0x494f36,null));};exports[_0xfc24('0x41')]=function(_0x3389bd,_0x5e6892){return db['CloudProvider'][_0xfc24('0x42')]({'where':{'id':_0x3389bd['params']['id']},'raw':!![]})[_0xfc24('0x12')](function(_0x241202){if(!_0x241202)return _0x5e6892[_0xfc24('0x8')](0x194);return{'url':oauth['generateMicrosoftAuthorizationUrl'](_0x241202,_0x3389bd['user']['id'])};})[_0xfc24('0x12')](respondWithResult(_0x5e6892,null))[_0xfc24('0x33')](handleError(_0x5e6892,null));};exports['oauth2MicrosoftCallback']=function(_0x39070c,_0x15cbd3){var _0x45f2d6=_0x39070c[_0xfc24('0x3c')];var _0x35df6b;var _0x910cb;if(_0x45f2d6[_0xfc24('0x13')])throw _0x45f2d6;redis[_0xfc24('0x43')](_0x45f2d6[_0xfc24('0x44')])['then'](function(_0xc57dbf){if(!_0xc57dbf)throw new Error(_0xfc24('0x45'));_0x35df6b=JSON[_0xfc24('0x46')](_0xc57dbf);var _0x33d46c=Buffer[_0xfc24('0x47')](_0x45f2d6[_0xfc24('0x44')],_0xfc24('0x48'))['toString']('ascii');_0x910cb=JSON[_0xfc24('0x46')](_0x33d46c);if(!oauth[_0xfc24('0x49')](_0x45f2d6[_0xfc24('0x4a')],_0x35df6b[_0xfc24('0x4b')]))throw new Error(_0xfc24('0x4c'));redis[_0xfc24('0x4d')](_0x45f2d6[_0xfc24('0x44')]);return oauth[_0xfc24('0x4e')](_0x45f2d6[_0xfc24('0x4f')],_0x35df6b);})['then'](function(_0x74ece6){_0x35df6b['data5']=_0x74ece6[_0xfc24('0x50')];_0x35df6b['data6']=_0x74ece6['refresh_token'];return db[_0xfc24('0x2d')][_0xfc24('0x11')]({'data5':_0x35df6b['data5'],'data6':_0x35df6b[_0xfc24('0x51')]},{'where':{'id':_0x35df6b['id']}});})[_0xfc24('0x12')](function(){oauth['startRefreshInterval'](_0x35df6b);socket[_0xfc24('0x52')](_0xfc24('0x53'),{'id':_0x910cb['id']});return;})['then'](respondWithStatusCode(_0x15cbd3,null))[_0xfc24('0x33')](function(_0x4203a8){if(_0x910cb){socket[_0xfc24('0x52')](_0xfc24('0x54'),{'id':_0x910cb['id']});}if(!_0x35df6b){logger['error']('Invalid\x20authentication\x20state\x20parameter',_0x4203a8);return _0x15cbd3[_0xfc24('0xa')](0x1f4)[_0xfc24('0x16')](_0x4203a8[_0xfc24('0x55')]);}logger[_0xfc24('0x13')]('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s',_0x35df6b['id'],JSON[_0xfc24('0x56')](_0x4203a8));});}; \ No newline at end of file +var _0x8621=['Invalid\x20authentication\x20state\x20parameter','send','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/encryptor','../../config/environment','../../config/logger','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','offset','undefined','limit','count','Content-Range','json','update','destroy','then','status','end','stack','name','slice','map','CloudProvider','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','options','includeAll','rows','service','MicrosoftAzure','data3','catch','show','params','decryptString','Name\x20parameter\x20not\x20specified','body','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','create','find','findOne','user','oauth2MicrosoftCallback','error','state','Invalid\x20state\x20parameter','parse','from','base64','isValidIdToken','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','access_token','data6','refresh_token','data5','startRefreshInterval','emit','microsoftAuthorization:error'];(function(_0x2c3739,_0x19b190){var _0x23196d=function(_0x26d937){while(--_0x26d937){_0x2c3739['push'](_0x2c3739['shift']());}};_0x23196d(++_0x19b190);}(_0x8621,0x1c2));var _0x1862=function(_0x4588d8,_0xbdb8d2){_0x4588d8=_0x4588d8-0x0;var _0x2c33dc=_0x8621[_0x4588d8];return _0x2c33dc;};'use strict';var _=require(_0x1862('0x0'));var Redis=require(_0x1862('0x1'));var qs=require('../../components/parsers/qs');var encryptor=require(_0x1862('0x2'));var config=require(_0x1862('0x3'));var logger=require(_0x1862('0x4'))('api');var db=require(_0x1862('0x5'))['db'];var oauth=require('./cloudProvider.oauth');config[_0x1862('0x6')]=_[_0x1862('0x7')](config[_0x1862('0x6')],{'host':_0x1862('0x8'),'port':0x18eb});var socket=require(_0x1862('0x9'))(new Redis(config['redis']));var redis=new Redis(config['redis']);function respondWithStatusCode(_0x27d068,_0x1f1cf6){_0x1f1cf6=_0x1f1cf6||0xcc;return function(_0x2da952){if(_0x2da952){return _0x27d068[_0x1862('0xa')](_0x1f1cf6);}return _0x27d068['status'](_0x1f1cf6)['end']();};}function respondWithResult(_0x182610,_0x275600){_0x275600=_0x275600||0xc8;return function(_0x563f5b){if(_0x563f5b){return _0x182610['status'](_0x275600)['json'](_0x563f5b);}};}function respondWithFilteredResult(_0x594e0f,_0x21beab){return function(_0x4ee74a){if(_0x4ee74a){var _0x2c2669=typeof _0x21beab[_0x1862('0xb')]===_0x1862('0xc')&&typeof _0x21beab[_0x1862('0xd')]===_0x1862('0xc');var _0x578f91=_0x4ee74a[_0x1862('0xe')];var _0x2e30e0=_0x2c2669?0x0:_0x21beab['offset'];var _0x363406=_0x2c2669?_0x4ee74a[_0x1862('0xe')]:_0x21beab[_0x1862('0xb')]+_0x21beab[_0x1862('0xd')];var _0x1250cc;if(_0x363406>=_0x578f91){_0x363406=_0x578f91;_0x1250cc=0xc8;}else{_0x1250cc=0xce;}_0x594e0f['status'](_0x1250cc);return _0x594e0f['set'](_0x1862('0xf'),_0x2e30e0+'-'+_0x363406+'/'+_0x578f91)[_0x1862('0x10')](_0x4ee74a);}return null;};}function saveUpdates(_0x4d6783){return function(_0x2c88d8){if(_0x2c88d8){return _0x2c88d8[_0x1862('0x11')](_0x4d6783)['then'](function(_0x1d7eb4){return _0x1d7eb4;});}return null;};}function removeEntity(_0x169112){return function(_0x432402){if(_0x432402){return _0x432402[_0x1862('0x12')]()[_0x1862('0x13')](function(){_0x169112[_0x1862('0x14')](0xcc)[_0x1862('0x15')]();});}};}function handleEntityNotFound(_0x29d629){return function(_0x1f1a7f){if(!_0x1f1a7f){_0x29d629[_0x1862('0xa')](0x194);}return _0x1f1a7f;};}function handleError(_0x4813ff,_0x3ab015){_0x3ab015=_0x3ab015||0x1f4;return function(_0x1a3098){logger['error'](_0x1a3098[_0x1862('0x16')]);if(_0x1a3098[_0x1862('0x17')]){delete _0x1a3098[_0x1862('0x17')];}_0x4813ff['status'](_0x3ab015)['send'](_0x1a3098);};}function maskClientSecret(_0x4d9d7a){return _['padEnd'](_0x4d9d7a[_0x1862('0x18')](0x0,0x3),0x14,'*');}exports['index']=function(_0x6b7fe8,_0x166949){var _0x4ba207={},_0x364d3f={},_0x5505be={'count':0x0,'rows':[]};var _0x10c478=_[_0x1862('0x19')](db[_0x1862('0x1a')][_0x1862('0x1b')],function(_0x2a8841){return{'name':_0x2a8841['fieldName'],'type':_0x2a8841[_0x1862('0x1c')][_0x1862('0x1d')]};});_0x364d3f[_0x1862('0x1e')]=_[_0x1862('0x19')](_0x10c478,_0x1862('0x17'));_0x364d3f['query']=_[_0x1862('0x1f')](_0x6b7fe8[_0x1862('0x20')]);_0x364d3f[_0x1862('0x21')]=_[_0x1862('0x22')](_0x364d3f['model'],_0x364d3f[_0x1862('0x20')]);_0x4ba207[_0x1862('0x23')]=_[_0x1862('0x22')](_0x364d3f[_0x1862('0x1e')],qs['fields'](_0x6b7fe8[_0x1862('0x20')][_0x1862('0x24')]));_0x4ba207['attributes']=_0x4ba207[_0x1862('0x23')][_0x1862('0x25')]?_0x4ba207[_0x1862('0x23')]:_0x364d3f[_0x1862('0x1e')];if(!_0x6b7fe8[_0x1862('0x20')]['hasOwnProperty'](_0x1862('0x26'))){_0x4ba207[_0x1862('0xd')]=qs[_0x1862('0xd')](_0x6b7fe8[_0x1862('0x20')][_0x1862('0xd')]);_0x4ba207[_0x1862('0xb')]=qs[_0x1862('0xb')](_0x6b7fe8['query'][_0x1862('0xb')]);}_0x4ba207[_0x1862('0x27')]=qs[_0x1862('0x28')](_0x6b7fe8[_0x1862('0x20')][_0x1862('0x28')]);_0x4ba207['where']=qs[_0x1862('0x21')](_[_0x1862('0x29')](_0x6b7fe8[_0x1862('0x20')],_0x364d3f[_0x1862('0x21')]),_0x10c478);if(_0x6b7fe8[_0x1862('0x20')][_0x1862('0x2a')]){_0x4ba207['where']=_['merge'](_0x4ba207[_0x1862('0x2b')],{'$or':_[_0x1862('0x19')](_0x10c478,function(_0x1873b0){if(_0x1873b0['type']!=='VIRTUAL'){var _0x5c9e3d={};_0x5c9e3d[_0x1873b0[_0x1862('0x17')]]={'$like':'%'+_0x6b7fe8['query']['filter']+'%'};return _0x5c9e3d;}})});}_0x4ba207=_['merge']({},_0x4ba207,_0x6b7fe8[_0x1862('0x2c')]);var _0x4fa1ba={'where':_0x4ba207['where']};return db[_0x1862('0x1a')][_0x1862('0xe')](_0x4fa1ba)[_0x1862('0x13')](function(_0x31a9e8){_0x5505be[_0x1862('0xe')]=_0x31a9e8;if(_0x6b7fe8[_0x1862('0x20')][_0x1862('0x2d')]){_0x4ba207['include']=[{'all':!![]}];}return db[_0x1862('0x1a')]['findAll'](_0x4ba207);})[_0x1862('0x13')](function(_0x42b402){_0x5505be[_0x1862('0x2e')]=_[_0x1862('0x19')](_0x42b402,function(_0xd8d37e){if(_0xd8d37e[_0x1862('0x2f')]===_0x1862('0x30')){var _0x4141fa=encryptor['decryptString'](_0xd8d37e[_0x1862('0x31')]);_0xd8d37e['data3']=maskClientSecret(_0x4141fa);}return _0xd8d37e;});return _0x5505be;})[_0x1862('0x13')](respondWithFilteredResult(_0x166949,_0x4ba207))[_0x1862('0x32')](handleError(_0x166949,null));};exports[_0x1862('0x33')]=function(_0x4520fd,_0x20e8ee){var _0x215feb={'raw':!![],'where':{'id':_0x4520fd[_0x1862('0x34')]['id']}},_0x2f79e3={};_0x2f79e3['model']=_['keys'](db[_0x1862('0x1a')]['rawAttributes']);_0x2f79e3['query']=_['keys'](_0x4520fd['query']);_0x2f79e3['filters']=_[_0x1862('0x22')](_0x2f79e3['model'],_0x2f79e3[_0x1862('0x20')]);_0x215feb[_0x1862('0x23')]=_[_0x1862('0x22')](_0x2f79e3[_0x1862('0x1e')],qs[_0x1862('0x24')](_0x4520fd[_0x1862('0x20')][_0x1862('0x24')]));_0x215feb[_0x1862('0x23')]=_0x215feb['attributes'][_0x1862('0x25')]?_0x215feb['attributes']:_0x2f79e3['model'];if(_0x4520fd[_0x1862('0x20')][_0x1862('0x2d')]){_0x215feb['include']=[{'all':!![]}];}_0x215feb=_['merge']({},_0x215feb,_0x4520fd[_0x1862('0x2c')]);return db[_0x1862('0x1a')]['find'](_0x215feb)['then'](handleEntityNotFound(_0x20e8ee,null))[_0x1862('0x13')](function(_0x364203){if(_0x364203['service']===_0x1862('0x30')){var _0x201845=encryptor[_0x1862('0x35')](_0x364203[_0x1862('0x31')]);_0x364203[_0x1862('0x31')]=maskClientSecret(_0x201845);}return _0x364203;})[_0x1862('0x13')](respondWithResult(_0x20e8ee,null))[_0x1862('0x32')](handleError(_0x20e8ee,null));};exports['create']=function(_0x5ceb5a,_0x27862f){if(!_0x5ceb5a['body']['name'])throw new Error(_0x1862('0x36'));if(!_0x5ceb5a[_0x1862('0x37')][_0x1862('0x2f')])throw new Error('Service\x20parameter\x20not\x20specified');var _0x273650=db[_0x1862('0x1a')][_0x1862('0x1b')][_0x1862('0x2f')][_0x1862('0x38')];if(!_0x273650[_0x1862('0x39')](_0x5ceb5a['body'][_0x1862('0x2f')]))throw new Error(_0x1862('0x3a')+_0x273650[_0x1862('0x3b')](',\x20'));if(_0x5ceb5a[_0x1862('0x37')][_0x1862('0x2f')]==='MicrosoftAzure'&&_0x5ceb5a['body']['data3']){_0x5ceb5a['body'][_0x1862('0x31')]=encryptor[_0x1862('0x3c')](_0x5ceb5a[_0x1862('0x37')]['data3']);}return db[_0x1862('0x1a')][_0x1862('0x3d')](_0x5ceb5a[_0x1862('0x37')],{})[_0x1862('0x13')](respondWithResult(_0x27862f,0xc9))[_0x1862('0x32')](handleError(_0x27862f,null));};exports[_0x1862('0x11')]=function(_0x19328a,_0x2cca58){if(_0x19328a[_0x1862('0x37')]['id']){delete _0x19328a[_0x1862('0x37')]['id'];}return db[_0x1862('0x1a')][_0x1862('0x3e')]({'where':{'id':_0x19328a[_0x1862('0x34')]['id']}})[_0x1862('0x13')](handleEntityNotFound(_0x2cca58,null))[_0x1862('0x13')](function(_0xdeede){if(_0xdeede[_0x1862('0x2f')]===_0x1862('0x30')&&_0x19328a[_0x1862('0x37')]['data3']){_0x19328a['body'][_0x1862('0x31')]=encryptor[_0x1862('0x3c')](_0x19328a[_0x1862('0x37')][_0x1862('0x31')]);}return _0xdeede;})['then'](saveUpdates(_0x19328a['body'],null))[_0x1862('0x13')](respondWithResult(_0x2cca58,null))['catch'](handleError(_0x2cca58,null));};exports['destroy']=function(_0x2d87f1,_0x4c9eab){return db['CloudProvider'][_0x1862('0x3e')]({'where':{'id':_0x2d87f1[_0x1862('0x34')]['id']}})[_0x1862('0x13')](handleEntityNotFound(_0x4c9eab,null))[_0x1862('0x13')](removeEntity(_0x4c9eab,null))[_0x1862('0x32')](handleError(_0x4c9eab,null));};exports['oauth2MicrosoftAuthorize']=function(_0x39c051,_0x5b8d85){return db['CloudProvider'][_0x1862('0x3f')]({'where':{'id':_0x39c051[_0x1862('0x34')]['id']},'raw':!![]})['then'](function(_0x16c2c8){if(!_0x16c2c8)return _0x5b8d85[_0x1862('0xa')](0x194);return{'url':oauth['generateMicrosoftAuthorizationUrl'](_0x16c2c8,_0x39c051[_0x1862('0x40')]['id'])};})['then'](respondWithResult(_0x5b8d85,null))['catch'](handleError(_0x5b8d85,null));};exports[_0x1862('0x41')]=function(_0x346046,_0x55e15b){var _0x22c33c=_0x346046[_0x1862('0x37')];var _0x1792f1;var _0x1605b4;if(_0x22c33c[_0x1862('0x42')])throw _0x22c33c;redis['get'](_0x22c33c[_0x1862('0x43')])[_0x1862('0x13')](function(_0x2c1dbb){if(!_0x2c1dbb)throw new Error(_0x1862('0x44'));_0x1792f1=JSON[_0x1862('0x45')](_0x2c1dbb);var _0x4bc1e6=Buffer[_0x1862('0x46')](_0x22c33c[_0x1862('0x43')],_0x1862('0x47'))['toString']('ascii');_0x1605b4=JSON[_0x1862('0x45')](_0x4bc1e6);if(!oauth[_0x1862('0x48')](_0x22c33c['id_token'],_0x1792f1['oauth2Claims']))throw new Error(_0x1862('0x49'));redis[_0x1862('0x4a')](_0x22c33c[_0x1862('0x43')]);return oauth[_0x1862('0x4b')](_0x22c33c[_0x1862('0x4c')],_0x1792f1);})[_0x1862('0x13')](function(_0x53061d){_0x1792f1['data5']=_0x53061d[_0x1862('0x4d')];_0x1792f1[_0x1862('0x4e')]=_0x53061d[_0x1862('0x4f')];return db['CloudProvider'][_0x1862('0x11')]({'data5':_0x1792f1[_0x1862('0x50')],'data6':_0x1792f1['data6']},{'where':{'id':_0x1792f1['id']}});})[_0x1862('0x13')](function(){oauth[_0x1862('0x51')](_0x1792f1);socket[_0x1862('0x52')]('microsoftAuthorization:success',{'id':_0x1605b4['id']});return;})[_0x1862('0x13')](respondWithStatusCode(_0x55e15b,null))[_0x1862('0x32')](function(_0x52e56b){if(_0x1605b4){socket[_0x1862('0x52')](_0x1862('0x53'),{'id':_0x1605b4['id']});}if(!_0x1792f1){logger[_0x1862('0x42')](_0x1862('0x54'),_0x52e56b);return _0x55e15b[_0x1862('0x14')](0x1f4)[_0x1862('0x55')](_0x52e56b[_0x1862('0x56')]);}logger['error'](_0x1862('0x57'),_0x1792f1['id'],JSON[_0x1862('0x58')](_0x52e56b));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 2691209..5012dc6 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 _0x0137=['../../config/environment','./cloudProvider.attributes','exports','define','CloudProvider','lodash','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x4de9df,_0x1d5c49){var _0x58b88b=function(_0xc08be7){while(--_0xc08be7){_0x4de9df['push'](_0x4de9df['shift']());}};_0x58b88b(++_0x1d5c49);}(_0x0137,0xc5));var _0x7013=function(_0x485539,_0x5491b7){_0x485539=_0x485539-0x0;var _0x2d3d75=_0x0137[_0x485539];return _0x2d3d75;};'use strict';var _=require(_0x7013('0x0'));var util=require('util');var logger=require(_0x7013('0x1'))(_0x7013('0x2'));var moment=require(_0x7013('0x3'));var BPromise=require('bluebird');var rp=require(_0x7013('0x4'));var fs=require('fs');var path=require(_0x7013('0x5'));var rimraf=require(_0x7013('0x6'));var config=require(_0x7013('0x7'));var attributes=require(_0x7013('0x8'));module[_0x7013('0x9')]=function(_0x9e752c,_0x560bd1){return _0x9e752c[_0x7013('0xa')](_0x7013('0xb'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2c31=['../../config/logger','moment','bluebird','request-promise','rimraf','./cloudProvider.attributes','exports','define','CloudProvider','lodash','util'];(function(_0x5e9a69,_0x40c0ec){var _0x5979c8=function(_0x293da2){while(--_0x293da2){_0x5e9a69['push'](_0x5e9a69['shift']());}};_0x5979c8(++_0x40c0ec);}(_0x2c31,0x132));var _0x12c3=function(_0x4caeda,_0x427222){_0x4caeda=_0x4caeda-0x0;var _0x2ce18b=_0x2c31[_0x4caeda];return _0x2ce18b;};'use strict';var _=require(_0x12c3('0x0'));var util=require(_0x12c3('0x1'));var logger=require(_0x12c3('0x2'))('api');var moment=require(_0x12c3('0x3'));var BPromise=require(_0x12c3('0x4'));var rp=require(_0x12c3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x12c3('0x6'));var config=require('../../config/environment');var attributes=require(_0x12c3('0x7'));module[_0x12c3('0x8')]=function(_0x2a7b5c,_0x367d4f){return _0x2a7b5c[_0x12c3('0x9')](_0x12c3('0xa'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.oauth.js b/server/api/cloudProvider/cloudProvider.oauth.js index 9aa3edc..e08dcec 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 _0x7e1b=['email','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','offline_access','/authorize','/token','type','Dynamics365','push','data7','/.default','join','Outlook365','replace','{TENANT_ID}','data2','code','id_token','stringify','toString','randomBytes','client_id','data1','redirect_uri','data4','form_post','scope','state','nonce','prompt','login','map','key','value','oauth2Claims','oauth2/','set','decode','iss','issuer','aud','audience','isAfter','unix','exp','resolve','then','data3','CloudProvider','findOne','refresh_token','data6','decryptString','POST','data5','access_token','update','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','moment','ioredis','request-promise','../../components/encryptor','../../config/environment','api','redis','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile'];(function(_0x532d2d,_0x5d33ce){var _0x1da8d1=function(_0x1bd1c7){while(--_0x1bd1c7){_0x532d2d['push'](_0x532d2d['shift']());}};_0x1da8d1(++_0x5d33ce);}(_0x7e1b,0x1d9));var _0xb7e1=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x7e1b[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0xb7e1('0x0'));var crypto=require(_0xb7e1('0x1'));var jwt=require('jsonwebtoken');var moment=require(_0xb7e1('0x2'));var Redis=require(_0xb7e1('0x3'));var rp=require(_0xb7e1('0x4'));var util=require('util');var encryptor=require(_0xb7e1('0x5'));var config=require(_0xb7e1('0x6'));var logger=require('../../config/logger')(_0xb7e1('0x7'));var schedule=require('../../config/schedule/cloud-provider');var db=require('../../mysqldb')['db'];config[_0xb7e1('0x8')]=_['defaults'](config[_0xb7e1('0x8')],{'host':_0xb7e1('0x9'),'port':0x18eb});var redis=new Redis(config[_0xb7e1('0x8')]);var MICROSOFT_AUTH_URL=_0xb7e1('0xa');var AZURE_AUTH_SCOPES={'Outlook365':[_0xb7e1('0xb'),_0xb7e1('0xc'),_0xb7e1('0xd'),'offline_access',_0xb7e1('0xe'),_0xb7e1('0xf'),_0xb7e1('0x10')],'Dynamics365':[_0xb7e1('0xb'),_0xb7e1('0x11')]};var MICROSOFT_AUTH_ENDPOINT=_0xb7e1('0x12');var MICROSOFT_TOKEN_ENDPOINT=_0xb7e1('0x13');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x430516){var _0x4af17e=_['map'](AZURE_AUTH_SCOPES[_0x430516[_0xb7e1('0x14')]]);if(_0x430516[_0xb7e1('0x14')]===_0xb7e1('0x15'))_0x4af17e[_0xb7e1('0x16')](_0x430516[_0xb7e1('0x17')]+_0xb7e1('0x18'));return _0x4af17e[_0xb7e1('0x19')]('\x20');}function getAccessTokenScope(_0x51dac5){if(_0x51dac5['type']===_0xb7e1('0x1a'))return _0xb7e1('0xe');if(_0x51dac5[_0xb7e1('0x14')]===_0xb7e1('0x15'))return _0x51dac5[_0xb7e1('0x17')]+_0xb7e1('0x18');}function generateMicrosoftAuthorizationUrl(_0x44ccce,_0x2c0c15){var _0x49742c=MICROSOFT_AUTH_URL[_0xb7e1('0x1b')](_0xb7e1('0x1c'),_0x44ccce[_0xb7e1('0x1d')]);var _0x162eca=[_0xb7e1('0x1e'),_0xb7e1('0x1f')];var _0x190b0e=Buffer['from'](JSON[_0xb7e1('0x20')]({'id':_0x2c0c15}))[_0xb7e1('0x21')]('base64');var _0x269990=crypto[_0xb7e1('0x22')](0x10)[_0xb7e1('0x21')]('hex');var _0x1d3124=getAuthorizationScopes(_0x44ccce);var _0x14e250=[{'key':_0xb7e1('0x23'),'value':_0x44ccce[_0xb7e1('0x24')]},{'key':'response_type','value':encodeURIComponent(_0x162eca[_0xb7e1('0x19')]('\x20'))},{'key':_0xb7e1('0x25'),'value':_0x44ccce[_0xb7e1('0x26')]},{'key':'response_mode','value':_0xb7e1('0x27')},{'key':_0xb7e1('0x28'),'value':encodeURIComponent(_0x1d3124)},{'key':_0xb7e1('0x29'),'value':_0x190b0e},{'key':_0xb7e1('0x2a'),'value':_0x269990},{'key':_0xb7e1('0x2b'),'value':_0xb7e1('0x2c')}];var _0x1b267b=_0x49742c+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xb7e1('0x2d')](_0x14e250,function(_0x377360){return _0x377360[_0xb7e1('0x2e')]+'='+_0x377360[_0xb7e1('0x2f')];})['join']('&');_0x44ccce[_0xb7e1('0x30')]={'issuer':_0x49742c[_0xb7e1('0x1b')](_0xb7e1('0x31'),''),'audience':_0x44ccce[_0xb7e1('0x24')],'state':_0x190b0e,'nonce':_0x269990};redis[_0xb7e1('0x32')](_0x190b0e,JSON[_0xb7e1('0x20')](_0x44ccce));return _0x1b267b;}function isValidIdToken(_0x330b9c,_0x1c405e){try{var _0x546008=jwt[_0xb7e1('0x33')](_0x330b9c,{'complete':!![]});var _0x3411d8=_0x546008['payload'];if(_0x3411d8[_0xb7e1('0x34')]!==_0x1c405e[_0xb7e1('0x35')])return![];if(_0x3411d8[_0xb7e1('0x36')]!==_0x1c405e[_0xb7e1('0x37')])return![];if(_0x3411d8[_0xb7e1('0x2a')]!==_0x1c405e[_0xb7e1('0x2a')])return![];if(moment()[_0xb7e1('0x38')](moment[_0xb7e1('0x39')](_0x3411d8[_0xb7e1('0x3a')])))return![];return!![];}catch(_0x586166){throw _0x586166;}}function refreshOauth2MicrosoftAccessToken(_0x380647){return Promise[_0xb7e1('0x3b')]()[_0xb7e1('0x3c')](function(){if(_0x380647[_0xb7e1('0x3d')])return _0x380647;return db[_0xb7e1('0x3e')][_0xb7e1('0x3f')]({'where':{'id':_0x380647['id']},'raw':!![]});})[_0xb7e1('0x3c')](function(_0x407fb4){var _0x42d868={'grant_type':_0xb7e1('0x40'),'refresh_token':_0x407fb4[_0xb7e1('0x41')],'scope':getAccessTokenScope(_0x407fb4),'redirect_uri':_0x407fb4[_0xb7e1('0x26')],'client_id':_0x407fb4[_0xb7e1('0x24')],'client_secret':encryptor[_0xb7e1('0x42')](_0x407fb4[_0xb7e1('0x3d')])};var _0x464cb2={'method':_0xb7e1('0x43'),'uri':MICROSOFT_AUTH_URL[_0xb7e1('0x1b')]('{TENANT_ID}',_0x407fb4['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x42d868,'json':!![]};return rp(_0x464cb2);})[_0xb7e1('0x3c')](function(_0x1ad22e){_0x380647[_0xb7e1('0x44')]=_0x1ad22e[_0xb7e1('0x45')];_0x380647[_0xb7e1('0x41')]=_0x1ad22e[_0xb7e1('0x40')];return db[_0xb7e1('0x3e')][_0xb7e1('0x46')]({'data5':_0x380647[_0xb7e1('0x44')],'data6':_0x380647['data6']},{'where':{'id':_0x380647['id']}});})[_0xb7e1('0x3c')](function(){return _0x380647;})[_0xb7e1('0x47')](function(_0xe21849){logger[_0xb7e1('0x48')](_0xb7e1('0x49'),_0x380647['id'],_0xe21849);});}function getOauth2MicrosoftAccessToken(_0x2535c2,_0x2740b1){var _0x371b62={'grant_type':_0xb7e1('0x4a'),'code':_0x2535c2,'scope':getAccessTokenScope(_0x2740b1),'redirect_uri':_0x2740b1[_0xb7e1('0x26')],'client_id':_0x2740b1[_0xb7e1('0x24')],'client_secret':encryptor['decryptString'](_0x2740b1[_0xb7e1('0x3d')])};var _0x4b0a05={'method':_0xb7e1('0x43'),'uri':MICROSOFT_AUTH_URL['replace'](_0xb7e1('0x1c'),_0x2740b1['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x371b62,'json':!![]};return rp(_0x4b0a05);}function startRefreshInterval(_0x5917cb){var _0x5b877c=schedule[_0xb7e1('0x4b')];if(_0x5b877c[_0x5917cb['id']])clearInterval(_0x5b877c[_0x5917cb['id']]);_0x5b877c[_0x5917cb['id']]=setInterval(refreshOauth2MicrosoftAccessToken['bind'](this,{'id':_0x5917cb['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x5b877c;}function startAllRefreshIntervals(){return db[_0xb7e1('0x3e')][_0xb7e1('0x4c')]({'where':{'data6':{'$ne':null}},'raw':!![]})['then'](function(_0x34f9bf){var _0x5c850f=_0x34f9bf['map'](function(_0x504a22){return refreshOauth2MicrosoftAccessToken(_0x504a22)[_0xb7e1('0x3c')](function(_0x5b3e1d){startRefreshInterval(_0x5b3e1d);});});return Promise[_0xb7e1('0x4d')](_0x5c850f);})[_0xb7e1('0x47')](function(_0x55e763){var _0x575250=_0x55e763?util[_0xb7e1('0x4e')](_0x55e763,{'showHidden':![],'depth':null}):'';logger[_0xb7e1('0x48')](_0xb7e1('0x4f'),_0x575250);});}module[_0xb7e1('0x50')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x12c0=['https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','/token','map','type','push','data7','Outlook365','Dynamics365','replace','data2','id_token','from','stringify','toString','base64','data1','response_type','join','redirect_uri','data4','response_mode','form_post','state','nonce','prompt','login','key','value','oauth2Claims','oauth2/','set','aud','audience','isAfter','unix','exp','resolve','data3','findOne','then','refresh_token','decryptString','{TENANT_ID}','data5','access_token','update','data6','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','POST','intervals','bind','CloudProvider','findAll','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','crypto','moment','request-promise','../../config/environment','../../config/logger','api','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','email','offline_access'];(function(_0x136532,_0x5a6219){var _0x1c8a04=function(_0x3c07ae){while(--_0x3c07ae){_0x136532['push'](_0x136532['shift']());}};_0x1c8a04(++_0x5a6219);}(_0x12c0,0x172));var _0x012c=function(_0x578d9e,_0x17f9fb){_0x578d9e=_0x578d9e-0x0;var _0x717f26=_0x12c0[_0x578d9e];return _0x717f26;};'use strict';var _=require(_0x012c('0x0'));var crypto=require(_0x012c('0x1'));var jwt=require('jsonwebtoken');var moment=require(_0x012c('0x2'));var Redis=require('ioredis');var rp=require(_0x012c('0x3'));var util=require('util');var encryptor=require('../../components/encryptor');var config=require(_0x012c('0x4'));var logger=require(_0x012c('0x5'))(_0x012c('0x6'));var schedule=require('../../config/schedule/cloud-provider');var db=require('../../mysqldb')['db'];config[_0x012c('0x7')]=_[_0x012c('0x8')](config[_0x012c('0x7')],{'host':_0x012c('0x9'),'port':0x18eb});var redis=new Redis(config[_0x012c('0x7')]);var MICROSOFT_AUTH_URL=_0x012c('0xa');var AZURE_AUTH_SCOPES={'Outlook365':[_0x012c('0xb'),_0x012c('0xc'),_0x012c('0xd'),_0x012c('0xe'),_0x012c('0xf'),_0x012c('0x10'),_0x012c('0x11')],'Dynamics365':['openid','offline_access']};var MICROSOFT_AUTH_ENDPOINT=_0x012c('0x12');var MICROSOFT_TOKEN_ENDPOINT=_0x012c('0x13');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x1fc134){var _0x133b76=_[_0x012c('0x14')](AZURE_AUTH_SCOPES[_0x1fc134[_0x012c('0x15')]]);if(_0x1fc134[_0x012c('0x15')]==='Dynamics365')_0x133b76[_0x012c('0x16')](_0x1fc134[_0x012c('0x17')]+'/.default');return _0x133b76['join']('\x20');}function getAccessTokenScope(_0x56ecf2){if(_0x56ecf2[_0x012c('0x15')]===_0x012c('0x18'))return _0x012c('0xf');if(_0x56ecf2[_0x012c('0x15')]===_0x012c('0x19'))return _0x56ecf2[_0x012c('0x17')]+'/.default';}function generateMicrosoftAuthorizationUrl(_0x52ed29,_0x1048e4){var _0x97584a=MICROSOFT_AUTH_URL[_0x012c('0x1a')]('{TENANT_ID}',_0x52ed29[_0x012c('0x1b')]);var _0x3f2a1e=['code',_0x012c('0x1c')];var _0xf6f329=Buffer[_0x012c('0x1d')](JSON[_0x012c('0x1e')]({'id':_0x1048e4}))[_0x012c('0x1f')](_0x012c('0x20'));var _0x393fcf=crypto['randomBytes'](0x10)[_0x012c('0x1f')]('hex');var _0x3f87a5=getAuthorizationScopes(_0x52ed29);var _0x2d3f9b=[{'key':'client_id','value':_0x52ed29[_0x012c('0x21')]},{'key':_0x012c('0x22'),'value':encodeURIComponent(_0x3f2a1e[_0x012c('0x23')]('\x20'))},{'key':_0x012c('0x24'),'value':_0x52ed29[_0x012c('0x25')]},{'key':_0x012c('0x26'),'value':_0x012c('0x27')},{'key':'scope','value':encodeURIComponent(_0x3f87a5)},{'key':_0x012c('0x28'),'value':_0xf6f329},{'key':_0x012c('0x29'),'value':_0x393fcf},{'key':_0x012c('0x2a'),'value':_0x012c('0x2b')}];var _0x1e8620=_0x97584a+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0x2d3f9b,function(_0x300f2f){return _0x300f2f[_0x012c('0x2c')]+'='+_0x300f2f[_0x012c('0x2d')];})[_0x012c('0x23')]('&');_0x52ed29[_0x012c('0x2e')]={'issuer':_0x97584a[_0x012c('0x1a')](_0x012c('0x2f'),''),'audience':_0x52ed29['data1'],'state':_0xf6f329,'nonce':_0x393fcf};redis[_0x012c('0x30')](_0xf6f329,JSON[_0x012c('0x1e')](_0x52ed29));return _0x1e8620;}function isValidIdToken(_0x313eae,_0xcc0661){try{var _0x44d241=jwt['decode'](_0x313eae,{'complete':!![]});var _0x36dcde=_0x44d241['payload'];if(_0x36dcde['iss']!==_0xcc0661['issuer'])return![];if(_0x36dcde[_0x012c('0x31')]!==_0xcc0661[_0x012c('0x32')])return![];if(_0x36dcde[_0x012c('0x29')]!==_0xcc0661[_0x012c('0x29')])return![];if(moment()[_0x012c('0x33')](moment[_0x012c('0x34')](_0x36dcde[_0x012c('0x35')])))return![];return!![];}catch(_0x48fce8){throw _0x48fce8;}}function refreshOauth2MicrosoftAccessToken(_0x385b71){return Promise[_0x012c('0x36')]()['then'](function(){if(_0x385b71[_0x012c('0x37')])return _0x385b71;return db['CloudProvider'][_0x012c('0x38')]({'where':{'id':_0x385b71['id']},'raw':!![]});})[_0x012c('0x39')](function(_0x34b221){var _0x15e998={'grant_type':_0x012c('0x3a'),'refresh_token':_0x34b221['data6'],'scope':getAccessTokenScope(_0x34b221),'redirect_uri':_0x34b221['data4'],'client_id':_0x34b221[_0x012c('0x21')],'client_secret':encryptor[_0x012c('0x3b')](_0x34b221['data3'])};var _0x4da511={'method':'POST','uri':MICROSOFT_AUTH_URL['replace'](_0x012c('0x3c'),_0x34b221[_0x012c('0x1b')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x15e998,'json':!![]};return rp(_0x4da511);})[_0x012c('0x39')](function(_0xeda1c6){_0x385b71[_0x012c('0x3d')]=_0xeda1c6[_0x012c('0x3e')];_0x385b71['data6']=_0xeda1c6[_0x012c('0x3a')];return db['CloudProvider'][_0x012c('0x3f')]({'data5':_0x385b71[_0x012c('0x3d')],'data6':_0x385b71[_0x012c('0x40')]},{'where':{'id':_0x385b71['id']}});})[_0x012c('0x39')](function(){return _0x385b71;})[_0x012c('0x41')](function(_0x15a84c){logger[_0x012c('0x42')](_0x012c('0x43'),_0x385b71['id'],_0x15a84c);});}function getOauth2MicrosoftAccessToken(_0x572d6f,_0x3616c5){var _0x4136ea={'grant_type':'authorization_code','code':_0x572d6f,'scope':getAccessTokenScope(_0x3616c5),'redirect_uri':_0x3616c5['data4'],'client_id':_0x3616c5[_0x012c('0x21')],'client_secret':encryptor[_0x012c('0x3b')](_0x3616c5[_0x012c('0x37')])};var _0x4a3489={'method':_0x012c('0x44'),'uri':MICROSOFT_AUTH_URL[_0x012c('0x1a')](_0x012c('0x3c'),_0x3616c5['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x4136ea,'json':!![]};return rp(_0x4a3489);}function startRefreshInterval(_0x1a140f){var _0x4f7101=schedule[_0x012c('0x45')];if(_0x4f7101[_0x1a140f['id']])clearInterval(_0x4f7101[_0x1a140f['id']]);_0x4f7101[_0x1a140f['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x012c('0x46')](this,{'id':_0x1a140f['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x012c('0x45')]=_0x4f7101;}function startAllRefreshIntervals(){return db[_0x012c('0x47')][_0x012c('0x48')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x012c('0x39')](function(_0x402007){var _0x168871=_0x402007[_0x012c('0x14')](function(_0x42f3b0){return refreshOauth2MicrosoftAccessToken(_0x42f3b0)[_0x012c('0x39')](function(_0x58bf2b){startRefreshInterval(_0x58bf2b);});});return Promise[_0x012c('0x49')](_0x168871);})[_0x012c('0x41')](function(_0x18cb06){var _0x56c7ee=_0x18cb06?util[_0x012c('0x4a')](_0x18cb06,{'showHidden':![],'depth':null}):'';logger[_0x012c('0x42')](_0x012c('0x4b'),_0x56c7ee);});}module[_0x012c('0x4c')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index 202f7a4..b5cdb0b 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 _0xa701=['rpc','../../config/environment','jayson/promise','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','util','moment','ioredis','../../config/logger'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xa701,0xd4));var _0x1a70=function(_0x4c4560,_0x56a797){_0x4c4560=_0x4c4560-0x0;var _0x313b56=_0xa701[_0x4c4560];return _0x313b56;};'use strict';var _=require('lodash');var util=require(_0x1a70('0x0'));var moment=require(_0x1a70('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1a70('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1a70('0x3'))(_0x1a70('0x4'));var config=require(_0x1a70('0x5'));var jayson=require(_0x1a70('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1c700b,_0x191a56,_0x1e5432){return new BPromise(function(_0x85bfd0,_0x1dd89b){return client[_0x1a70('0x7')](_0x1c700b,_0x1e5432)[_0x1a70('0x8')](function(_0x55b5e2){logger[_0x1a70('0x9')](_0x1a70('0xa'),_0x191a56,_0x1a70('0xb'));logger[_0x1a70('0xc')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x191a56,_0x1a70('0xb'),JSON[_0x1a70('0xd')](_0x55b5e2));if(_0x55b5e2[_0x1a70('0xe')]){if(_0x55b5e2['error']['code']===0x1f4){logger[_0x1a70('0xe')]('CloudProvider,\x20%s,\x20%s',_0x191a56,_0x55b5e2[_0x1a70('0xe')]['message']);return _0x1dd89b(_0x55b5e2[_0x1a70('0xe')]['message']);}logger[_0x1a70('0xe')]('CloudProvider,\x20%s,\x20%s',_0x191a56,_0x55b5e2[_0x1a70('0xe')][_0x1a70('0xf')]);return _0x85bfd0(_0x55b5e2[_0x1a70('0xe')][_0x1a70('0xf')]);}else{logger[_0x1a70('0x9')]('CloudProvider,\x20%s,\x20%s',_0x191a56,'request\x20sent');_0x85bfd0(_0x55b5e2[_0x1a70('0x10')]['message']);}})[_0x1a70('0x11')](function(_0x3d8745){logger['error'](_0x1a70('0xa'),_0x191a56,_0x3d8745);_0x1dd89b(_0x3d8745);});});} \ No newline at end of file +var _0xa809=['error','message','info','result','catch','util','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x224ad4,_0x4db500){var _0x22a5d9=function(_0x233515){while(--_0x233515){_0x224ad4['push'](_0x224ad4['shift']());}};_0x22a5d9(++_0x4db500);}(_0xa809,0x1f3));var _0x9a80=function(_0x1d070d,_0x44b1dc){_0x1d070d=_0x1d070d-0x0;var _0x150d9f=_0xa809[_0x1d070d];return _0x150d9f;};'use strict';var _=require('lodash');var util=require(_0x9a80('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9a80('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9a80('0x2'))(_0x9a80('0x3'));var config=require(_0x9a80('0x4'));var jayson=require(_0x9a80('0x5'));var client=jayson['client'][_0x9a80('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x504ba8,_0x17b704,_0x286ac5){return new BPromise(function(_0x4ea507,_0x1ef67a){return client[_0x9a80('0x7')](_0x504ba8,_0x286ac5)[_0x9a80('0x8')](function(_0x269ee2){logger['info'](_0x9a80('0x9'),_0x17b704,_0x9a80('0xa'));logger[_0x9a80('0xb')](_0x9a80('0xc'),_0x17b704,_0x9a80('0xa'),JSON[_0x9a80('0xd')](_0x269ee2));if(_0x269ee2[_0x9a80('0xe')]){if(_0x269ee2[_0x9a80('0xe')]['code']===0x1f4){logger[_0x9a80('0xe')](_0x9a80('0x9'),_0x17b704,_0x269ee2[_0x9a80('0xe')][_0x9a80('0xf')]);return _0x1ef67a(_0x269ee2[_0x9a80('0xe')][_0x9a80('0xf')]);}logger[_0x9a80('0xe')](_0x9a80('0x9'),_0x17b704,_0x269ee2['error'][_0x9a80('0xf')]);return _0x4ea507(_0x269ee2['error'][_0x9a80('0xf')]);}else{logger[_0x9a80('0x10')](_0x9a80('0x9'),_0x17b704,'request\x20sent');_0x4ea507(_0x269ee2[_0x9a80('0x11')][_0x9a80('0xf')]);}})[_0x9a80('0x12')](function(_0x12ecee){logger[_0x9a80('0xe')]('CloudProvider,\x20%s,\x20%s',_0x17b704,_0x12ecee);_0x1ef67a(_0x12ecee);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 250e28e..bcb5a44 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 _0x7a54=['isAuthenticated','/:id','show','post','create','delete','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback','exports','express','Router','../../components/auth/service','get'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x7a54,0x106));var _0x47a5=function(_0x3e97dc,_0x1149f5){_0x3e97dc=_0x3e97dc-0x0;var _0xa601db=_0x7a54[_0x3e97dc];return _0xa601db;};'use strict';var express=require(_0x47a5('0x0'));var router=express[_0x47a5('0x1')]();var auth=require(_0x47a5('0x2'));var controller=require('./cloudProvider.controller');router[_0x47a5('0x3')]('/',auth[_0x47a5('0x4')](),controller['index']);router[_0x47a5('0x3')](_0x47a5('0x5'),auth[_0x47a5('0x4')](),controller[_0x47a5('0x6')]);router[_0x47a5('0x7')]('/',auth['isAuthenticated'](),controller[_0x47a5('0x8')]);router['put'](_0x47a5('0x5'),auth[_0x47a5('0x4')](),controller['update']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x47a5('0x3')](_0x47a5('0xa'),auth['isAuthenticated'](),controller[_0x47a5('0xb')]);router['post']('/oauth2/microsoft/callback',controller[_0x47a5('0xc')]);module[_0x47a5('0xd')]=router; \ No newline at end of file +var _0x1261=['/:id','show','create','put','update','delete','/:id/oauth2/microsoft/authorize/','post','exports','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index'];(function(_0x56c70f,_0x4e4493){var _0x3812ed=function(_0x25460f){while(--_0x25460f){_0x56c70f['push'](_0x56c70f['shift']());}};_0x3812ed(++_0x4e4493);}(_0x1261,0x144));var _0x1126=function(_0x2dd976,_0x1b5dc4){_0x2dd976=_0x2dd976-0x0;var _0x2265fd=_0x1261[_0x2dd976];return _0x2265fd;};'use strict';var express=require('express');var router=express[_0x1126('0x0')]();var auth=require(_0x1126('0x1'));var controller=require(_0x1126('0x2'));router[_0x1126('0x3')]('/',auth[_0x1126('0x4')](),controller[_0x1126('0x5')]);router[_0x1126('0x3')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller[_0x1126('0x7')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1126('0x8')]);router[_0x1126('0x9')]('/:id',auth[_0x1126('0x4')](),controller[_0x1126('0xa')]);router[_0x1126('0xb')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller['destroy']);router[_0x1126('0x3')](_0x1126('0xc'),auth[_0x1126('0x4')](),controller['oauth2MicrosoftAuthorize']);router[_0x1126('0xd')]('/oauth2/microsoft/callback',controller['oauth2MicrosoftCallback']);module[_0x1126('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index d185cdf..c5304f1 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 _0x673e=['exports','name','STRING'];(function(_0x1d83e7,_0x36adda){var _0x3cd567=function(_0x2b6cfe){while(--_0x2b6cfe){_0x1d83e7['push'](_0x1d83e7['shift']());}};_0x3cd567(++_0x36adda);}(_0x673e,0x1c8));var _0xe673=function(_0x16c084,_0x9cd758){_0x16c084=_0x16c084-0x0;var _0x435b66=_0x673e[_0x16c084];return _0x435b66;};'use strict';var Sequelize=require('sequelize');module[_0xe673('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xe673('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xe673('0x2')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0xe673('0x2')]},'phone':{'type':Sequelize[_0xe673('0x2')]},'fax':{'type':Sequelize[_0xe673('0x2')]},'type':{'type':Sequelize[_0xe673('0x2')]},'street':{'type':Sequelize[_0xe673('0x2')]},'postalCode':{'type':Sequelize[_0xe673('0x2')]},'city':{'type':Sequelize[_0xe673('0x2')]},'country':{'type':Sequelize[_0xe673('0x2')]},'email':{'type':Sequelize[_0xe673('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xe673('0x2')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0xe673('0x2')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0xe673('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x605c=['exports','STRING','name','sequelize'];(function(_0x3f0fa8,_0x5173be){var _0x51a920=function(_0x52f0f6){while(--_0x52f0f6){_0x3f0fa8['push'](_0x3f0fa8['shift']());}};_0x51a920(++_0x5173be);}(_0x605c,0x1db));var _0xc605=function(_0x1e0c05,_0x2f76dc){_0x1e0c05=_0x1e0c05-0x0;var _0x423b89=_0x605c[_0x1e0c05];return _0x423b89;};'use strict';var Sequelize=require(_0xc605('0x0'));module[_0xc605('0x1')]={'name':{'type':Sequelize[_0xc605('0x2')],'unique':_0xc605('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xc605('0x2')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0xc605('0x2')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xc605('0x2')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xc605('0x2')]},'postalCode':{'type':Sequelize[_0xc605('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xc605('0x2')]},'email':{'type':Sequelize[_0xc605('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0xc605('0x2')]},'sCity':{'type':Sequelize[_0xc605('0x2')]},'sCountry':{'type':Sequelize[_0xc605('0x2')]},'description':{'type':Sequelize[_0xc605('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 7363628..bfd6c1d 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 _0xae34=['CmContact','ids','omit','getContacts','rawAttributes','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','update','then','Companies','destroy','error','name','send','index','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','includeAll','include','CmCompany','findAll','catch','show','params','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addContacts'];(function(_0x1109e8,_0xc364e7){var _0x1a217f=function(_0x3f2563){while(--_0x3f2563){_0x1109e8['push'](_0x1109e8['shift']());}};_0x1a217f(++_0xc364e7);}(_0xae34,0x104));var _0x4ae3=function(_0x2688cf,_0x5dfc42){_0x2688cf=_0x2688cf-0x0;var _0x441144=_0xae34[_0x2688cf];return _0x441144;};'use strict';var emlformat=require(_0x4ae3('0x0'));var rimraf=require(_0x4ae3('0x1'));var zipdir=require(_0x4ae3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4ae3('0x3'));var moment=require(_0x4ae3('0x4'));var BPromise=require(_0x4ae3('0x5'));var Mustache=require(_0x4ae3('0x6'));var util=require(_0x4ae3('0x7'));var path=require(_0x4ae3('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4ae3('0x9'));var fs=require('fs');var fs_extra=require(_0x4ae3('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4ae3('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4ae3('0xc'));var Redis=require(_0x4ae3('0xd'));var authService=require(_0x4ae3('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x4ae3('0xf'));var hardwareService=require(_0x4ae3('0x10'));var logger=require('../../config/logger')(_0x4ae3('0x11'));var utils=require(_0x4ae3('0x12'));var config=require(_0x4ae3('0x13'));var licenseUtil=require(_0x4ae3('0x14'));var db=require(_0x4ae3('0x15'))['db'];function respondWithStatusCode(_0x34429e,_0x24183b){_0x24183b=_0x24183b||0xcc;return function(_0x4bc4be){if(_0x4bc4be){return _0x34429e[_0x4ae3('0x16')](_0x24183b);}return _0x34429e['status'](_0x24183b)[_0x4ae3('0x17')]();};}function respondWithResult(_0xf348d4,_0x132dce){_0x132dce=_0x132dce||0xc8;return function(_0x28e9fd){if(_0x28e9fd){return _0xf348d4[_0x4ae3('0x18')](_0x132dce)[_0x4ae3('0x19')](_0x28e9fd);}};}function respondWithFilteredResult(_0x120e2b,_0x478836){return function(_0x413394){if(_0x413394){var _0x512138=typeof _0x478836[_0x4ae3('0x1a')]==='undefined'&&typeof _0x478836[_0x4ae3('0x1b')]===_0x4ae3('0x1c');var _0x311b6a=_0x413394[_0x4ae3('0x1d')];var _0x1e5d70=_0x512138?0x0:_0x478836['offset'];var _0x2eb6dc=_0x512138?_0x413394['count']:_0x478836[_0x4ae3('0x1a')]+_0x478836[_0x4ae3('0x1b')];var _0x593c3f;if(_0x2eb6dc>=_0x311b6a){_0x2eb6dc=_0x311b6a;_0x593c3f=0xc8;}else{_0x593c3f=0xce;}_0x120e2b[_0x4ae3('0x18')](_0x593c3f);return _0x120e2b[_0x4ae3('0x1e')](_0x4ae3('0x1f'),_0x1e5d70+'-'+_0x2eb6dc+'/'+_0x311b6a)[_0x4ae3('0x19')](_0x413394);}return null;};}function patchUpdates(_0xdb8179){return function(_0x5bdbb3){try{jsonpatch[_0x4ae3('0x20')](_0x5bdbb3,_0xdb8179,!![]);}catch(_0xe3e3de){return BPromise['reject'](_0xe3e3de);}return _0x5bdbb3['save']();};}function saveUpdates(_0x55c4e1,_0x30a55f){return function(_0x410a82){if(_0x410a82){return _0x410a82[_0x4ae3('0x21')](_0x55c4e1)['then'](function(_0x349302){return _0x349302;});}return null;};}function removeEntity(_0x32e0a1,_0x367c2e){return function(_0x2a39a8){if(_0x2a39a8){return _0x2a39a8['destroy']()[_0x4ae3('0x22')](function(){var _0x3b6afc=_0x2a39a8['get']({'plain':!![]});var _0x1662a8=_0x4ae3('0x23');return db['UserProfileResource'][_0x4ae3('0x24')]({'where':{'type':_0x1662a8,'resourceId':_0x3b6afc['id']}})[_0x4ae3('0x22')](function(){return _0x2a39a8;});})[_0x4ae3('0x22')](function(){_0x32e0a1[_0x4ae3('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f1f06,_0x5331eb){return function(_0x202b9a){if(!_0x202b9a){_0x4f1f06[_0x4ae3('0x16')](0x194);}return _0x202b9a;};}function handleError(_0x5c5a18,_0x3b0bb5){_0x3b0bb5=_0x3b0bb5||0x1f4;return function(_0x46c835){logger[_0x4ae3('0x25')](_0x46c835['stack']);if(_0x46c835[_0x4ae3('0x26')]){delete _0x46c835[_0x4ae3('0x26')];}_0x5c5a18[_0x4ae3('0x18')](_0x3b0bb5)[_0x4ae3('0x27')](_0x46c835);};}exports[_0x4ae3('0x28')]=function(_0x3e6b3f,_0x4c5e47){var _0x23ba17={},_0x5cf6a6={},_0x998fbf={'count':0x0,'rows':[]};return db['CmCompany']['describe']()['then'](function(_0x6f9421){_0x5cf6a6[_0x4ae3('0x29')]=_[_0x4ae3('0x2a')](_0x6f9421);_0x5cf6a6[_0x4ae3('0x2b')]=_['keys'](_0x3e6b3f[_0x4ae3('0x2b')]);_0x5cf6a6[_0x4ae3('0x2c')]=_[_0x4ae3('0x2d')](_0x5cf6a6[_0x4ae3('0x29')],_0x5cf6a6['query']);_0x23ba17[_0x4ae3('0x2e')]=_[_0x4ae3('0x2d')](_0x5cf6a6[_0x4ae3('0x29')],qs[_0x4ae3('0x2f')](_0x3e6b3f[_0x4ae3('0x2b')][_0x4ae3('0x2f')]));_0x23ba17[_0x4ae3('0x2e')]=_0x23ba17[_0x4ae3('0x2e')][_0x4ae3('0x30')]?_0x23ba17[_0x4ae3('0x2e')]:_0x5cf6a6[_0x4ae3('0x29')];if(!_0x3e6b3f[_0x4ae3('0x2b')][_0x4ae3('0x31')](_0x4ae3('0x32'))){_0x23ba17[_0x4ae3('0x1b')]=qs['limit'](_0x3e6b3f[_0x4ae3('0x2b')][_0x4ae3('0x1b')]);_0x23ba17[_0x4ae3('0x1a')]=qs[_0x4ae3('0x1a')](_0x3e6b3f[_0x4ae3('0x2b')][_0x4ae3('0x1a')]);}_0x23ba17[_0x4ae3('0x33')]=qs['sort'](_0x3e6b3f[_0x4ae3('0x2b')][_0x4ae3('0x34')]);_0x23ba17[_0x4ae3('0x35')]=qs[_0x4ae3('0x2c')](_[_0x4ae3('0x36')](_0x3e6b3f[_0x4ae3('0x2b')],_0x5cf6a6[_0x4ae3('0x2c')]),_0x6f9421);if(_0x3e6b3f[_0x4ae3('0x2b')][_0x4ae3('0x37')]){_0x23ba17[_0x4ae3('0x35')]=_[_0x4ae3('0x38')](_0x23ba17[_0x4ae3('0x35')],{'$or':_[_0x4ae3('0x39')](_0x23ba17['attributes'],function(_0x39c82f){var _0x4ac8ca={};_0x4ac8ca[_0x39c82f]={'$like':'%'+_0x3e6b3f[_0x4ae3('0x2b')][_0x4ae3('0x37')]+'%'};return _0x4ac8ca;})});}_0x23ba17=_[_0x4ae3('0x38')]({},_0x23ba17,_0x3e6b3f['options']);var _0x2a9657={'where':_0x23ba17[_0x4ae3('0x35')]};return db['CmCompany'][_0x4ae3('0x1d')](_0x2a9657)[_0x4ae3('0x22')](function(_0x2e65b8){_0x998fbf[_0x4ae3('0x1d')]=_0x2e65b8;if(_0x3e6b3f[_0x4ae3('0x2b')][_0x4ae3('0x3a')]){_0x23ba17[_0x4ae3('0x3b')]=[{'all':!![]}];}return db[_0x4ae3('0x3c')][_0x4ae3('0x3d')](_0x23ba17);})[_0x4ae3('0x22')](function(_0x373f19){_0x998fbf['rows']=_0x373f19;return _0x998fbf;})[_0x4ae3('0x22')](respondWithFilteredResult(_0x4c5e47,_0x23ba17))[_0x4ae3('0x3e')](handleError(_0x4c5e47,null));})[_0x4ae3('0x3e')](handleError(_0x4c5e47,null));};exports[_0x4ae3('0x3f')]=function(_0x4446f7,_0x2851db){var _0x15dc50={'raw':![],'where':{'id':_0x4446f7[_0x4ae3('0x40')]['id']}},_0x5b6553={};_0x5b6553[_0x4ae3('0x29')]=_[_0x4ae3('0x2a')](db['CmCompany']['rawAttributes']);_0x5b6553[_0x4ae3('0x2b')]=_[_0x4ae3('0x2a')](_0x4446f7[_0x4ae3('0x2b')]);_0x5b6553[_0x4ae3('0x2c')]=_[_0x4ae3('0x2d')](_0x5b6553[_0x4ae3('0x29')],_0x5b6553[_0x4ae3('0x2b')]);_0x15dc50['attributes']=_[_0x4ae3('0x2d')](_0x5b6553[_0x4ae3('0x29')],qs['fields'](_0x4446f7[_0x4ae3('0x2b')][_0x4ae3('0x2f')]));_0x15dc50[_0x4ae3('0x2e')]=_0x15dc50[_0x4ae3('0x2e')][_0x4ae3('0x30')]?_0x15dc50[_0x4ae3('0x2e')]:_0x5b6553['model'];if(_0x4446f7[_0x4ae3('0x2b')][_0x4ae3('0x3a')]){_0x15dc50[_0x4ae3('0x3b')]=[{'all':!![]}];}_0x15dc50=_[_0x4ae3('0x38')]({},_0x15dc50,_0x4446f7[_0x4ae3('0x41')]);return db[_0x4ae3('0x3c')][_0x4ae3('0x42')](_0x15dc50)[_0x4ae3('0x22')](handleEntityNotFound(_0x2851db,null))['then'](respondWithResult(_0x2851db,null))[_0x4ae3('0x3e')](handleError(_0x2851db,null));};exports['create']=function(_0x1e8c4a,_0x36e44b){return db[_0x4ae3('0x3c')][_0x4ae3('0x43')](_0x1e8c4a['body'],{})[_0x4ae3('0x22')](function(_0x20b01b){var _0x224f69=_0x1e8c4a[_0x4ae3('0x44')]['get']({'plain':!![]});if(!_0x224f69)throw new Error(_0x4ae3('0x45'));if(_0x224f69[_0x4ae3('0x46')]===_0x4ae3('0x44')){var _0x19259e=_0x20b01b[_0x4ae3('0x47')]({'plain':!![]});var _0x5f3914='Companies';return db[_0x4ae3('0x48')][_0x4ae3('0x42')]({'where':{'name':_0x5f3914,'userProfileId':_0x224f69[_0x4ae3('0x49')]},'raw':!![]})[_0x4ae3('0x22')](function(_0x291b16){if(_0x291b16&&_0x291b16[_0x4ae3('0x4a')]===0x0){return db[_0x4ae3('0x4b')][_0x4ae3('0x43')]({'name':_0x19259e['name'],'resourceId':_0x19259e['id'],'type':_0x291b16[_0x4ae3('0x26')],'sectionId':_0x291b16['id']},{})[_0x4ae3('0x22')](function(){return _0x20b01b;});}else{return _0x20b01b;}})[_0x4ae3('0x3e')](function(_0x44f7c1){logger[_0x4ae3('0x25')](_0x4ae3('0x4c'),_0x44f7c1);throw _0x44f7c1;});}return _0x20b01b;})[_0x4ae3('0x22')](respondWithResult(_0x36e44b,0xc9))[_0x4ae3('0x3e')](handleError(_0x36e44b,null));};exports['update']=function(_0x2aab4a,_0x2ed188){if(_0x2aab4a[_0x4ae3('0x4d')]['id']){delete _0x2aab4a['body']['id'];}return db[_0x4ae3('0x3c')][_0x4ae3('0x42')]({'where':{'id':_0x2aab4a[_0x4ae3('0x40')]['id']}})[_0x4ae3('0x22')](handleEntityNotFound(_0x2ed188,null))[_0x4ae3('0x22')](saveUpdates(_0x2aab4a[_0x4ae3('0x4d')],null))[_0x4ae3('0x22')](respondWithResult(_0x2ed188,null))['catch'](handleError(_0x2ed188,null));};exports['destroy']=function(_0x23ff58,_0x3a26e3){return db[_0x4ae3('0x3c')][_0x4ae3('0x42')]({'where':{'id':_0x23ff58[_0x4ae3('0x40')]['id']}})[_0x4ae3('0x22')](handleEntityNotFound(_0x3a26e3,null))[_0x4ae3('0x22')](removeEntity(_0x3a26e3,null))['catch'](handleError(_0x3a26e3,null));};exports[_0x4ae3('0x4e')]=function(_0x598c4e,_0x4a39a5){return db['CmCompany'][_0x4ae3('0x4e')]()[_0x4ae3('0x22')](respondWithResult(_0x4a39a5,null))[_0x4ae3('0x3e')](handleError(_0x4a39a5,null));};exports[_0x4ae3('0x4f')]=function(_0x483a91,_0x31e9b5,_0x54669b){return db[_0x4ae3('0x50')][_0x4ae3('0x42')]({'where':{'id':_0x483a91[_0x4ae3('0x40')]['id']}})['then'](handleEntityNotFound(_0x31e9b5,null))[_0x4ae3('0x22')](function(_0x2139e7){if(_0x2139e7){return _0x2139e7[_0x4ae3('0x4f')](_0x483a91[_0x4ae3('0x4d')][_0x4ae3('0x51')],_[_0x4ae3('0x52')](_0x483a91['body'],[_0x4ae3('0x51'),'id'])||{});}})[_0x4ae3('0x22')](respondWithResult(_0x31e9b5,null))[_0x4ae3('0x3e')](handleError(_0x31e9b5,null));};exports[_0x4ae3('0x53')]=function(_0x3e9714,_0x503e21,_0x40c903){var _0x4f0fdc={};var _0x356c14={};var _0x47f9e8;var _0x19d700;return db[_0x4ae3('0x3c')]['findOne']({'where':{'id':_0x3e9714[_0x4ae3('0x40')]['id']}})[_0x4ae3('0x22')](handleEntityNotFound(_0x503e21,null))['then'](function(_0x1748bd){if(_0x1748bd){_0x47f9e8=_0x1748bd;_0x356c14[_0x4ae3('0x29')]=_[_0x4ae3('0x2a')](db[_0x4ae3('0x50')][_0x4ae3('0x54')]);_0x356c14[_0x4ae3('0x2b')]=_[_0x4ae3('0x2a')](_0x3e9714[_0x4ae3('0x2b')]);_0x356c14[_0x4ae3('0x2c')]=_[_0x4ae3('0x2d')](_0x356c14[_0x4ae3('0x29')],_0x356c14[_0x4ae3('0x2b')]);_0x4f0fdc['attributes']=_[_0x4ae3('0x2d')](_0x356c14['model'],qs[_0x4ae3('0x2f')](_0x3e9714[_0x4ae3('0x2b')][_0x4ae3('0x2f')]));_0x4f0fdc[_0x4ae3('0x2e')]=_0x4f0fdc[_0x4ae3('0x2e')]['length']?_0x4f0fdc[_0x4ae3('0x2e')]:_0x356c14[_0x4ae3('0x29')];_0x4f0fdc[_0x4ae3('0x33')]=qs[_0x4ae3('0x34')](_0x3e9714[_0x4ae3('0x2b')][_0x4ae3('0x34')]);_0x4f0fdc[_0x4ae3('0x35')]=qs[_0x4ae3('0x2c')](_[_0x4ae3('0x36')](_0x3e9714['query'],_0x356c14['filters']));if(_0x3e9714['query'][_0x4ae3('0x37')]){_0x4f0fdc[_0x4ae3('0x35')]=_[_0x4ae3('0x38')](_0x4f0fdc[_0x4ae3('0x35')],{'$or':_[_0x4ae3('0x39')](_0x4f0fdc[_0x4ae3('0x2e')],function(_0x2cb2a3){var _0x524d00={};_0x524d00[_0x2cb2a3]={'$like':'%'+_0x3e9714[_0x4ae3('0x2b')][_0x4ae3('0x37')]+'%'};return _0x524d00;})});}_0x4f0fdc=_[_0x4ae3('0x38')]({},_0x4f0fdc,_0x3e9714[_0x4ae3('0x41')]);return _0x47f9e8[_0x4ae3('0x53')](_0x4f0fdc);}})[_0x4ae3('0x22')](function(_0x432645){if(_0x432645){_0x19d700=_0x432645['length'];if(!_0x3e9714[_0x4ae3('0x2b')]['hasOwnProperty'](_0x4ae3('0x32'))){_0x4f0fdc[_0x4ae3('0x1b')]=qs[_0x4ae3('0x1b')](_0x3e9714['query'][_0x4ae3('0x1b')]);_0x4f0fdc[_0x4ae3('0x1a')]=qs[_0x4ae3('0x1a')](_0x3e9714[_0x4ae3('0x2b')][_0x4ae3('0x1a')]);}return _0x47f9e8[_0x4ae3('0x53')](_0x4f0fdc);}})['then'](function(_0x2fee01){if(_0x2fee01){return _0x2fee01?{'count':_0x19d700,'rows':_0x2fee01}:null;}})[_0x4ae3('0x22')](respondWithResult(_0x503e21,null))[_0x4ae3('0x3e')](handleError(_0x503e21,null));}; \ No newline at end of file +var _0xfe44=['limit','count','set','Content-Range','apply','save','update','then','get','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','describe','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','offset','sort','pick','merge','where','options','include','CmCompany','findAll','rows','catch','show','params','rawAttributes','length','includeAll','find','create','body','user','role','Companies','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','CmContact','ids','omit','order','filter','map','getContacts','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined'];(function(_0x134832,_0x4ec0f2){var _0x603c62=function(_0x4ae9f1){while(--_0x4ae9f1){_0x134832['push'](_0x134832['shift']());}};_0x603c62(++_0x4ec0f2);}(_0xfe44,0xf0));var _0x4fe4=function(_0x2f263c,_0x19cf6d){_0x2f263c=_0x2f263c-0x0;var _0x203e23=_0xfe44[_0x2f263c];return _0x203e23;};'use strict';var emlformat=require(_0x4fe4('0x0'));var rimraf=require(_0x4fe4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4fe4('0x2'));var rp=require(_0x4fe4('0x3'));var moment=require(_0x4fe4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4fe4('0x5'));var util=require(_0x4fe4('0x6'));var path=require(_0x4fe4('0x7'));var sox=require(_0x4fe4('0x8'));var csv=require('to-csv');var ejs=require(_0x4fe4('0x9'));var fs=require('fs');var fs_extra=require(_0x4fe4('0xa'));var _=require(_0x4fe4('0xb'));var squel=require(_0x4fe4('0xc'));var crypto=require('crypto');var jsforce=require(_0x4fe4('0xd'));var deskjs=require(_0x4fe4('0xe'));var toCsv=require(_0x4fe4('0xf'));var querystring=require(_0x4fe4('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4fe4('0x11'));var qs=require(_0x4fe4('0x12'));var as=require(_0x4fe4('0x13'));var hardwareService=require(_0x4fe4('0x14'));var logger=require(_0x4fe4('0x15'))('api');var utils=require(_0x4fe4('0x16'));var config=require(_0x4fe4('0x17'));var licenseUtil=require(_0x4fe4('0x18'));var db=require(_0x4fe4('0x19'))['db'];function respondWithStatusCode(_0x2316e9,_0x739028){_0x739028=_0x739028||0xcc;return function(_0x50fe0f){if(_0x50fe0f){return _0x2316e9['sendStatus'](_0x739028);}return _0x2316e9[_0x4fe4('0x1a')](_0x739028)[_0x4fe4('0x1b')]();};}function respondWithResult(_0x3b6689,_0x1981be){_0x1981be=_0x1981be||0xc8;return function(_0x2598ac){if(_0x2598ac){return _0x3b6689[_0x4fe4('0x1a')](_0x1981be)[_0x4fe4('0x1c')](_0x2598ac);}};}function respondWithFilteredResult(_0x512cec,_0x317ff8){return function(_0x38b701){if(_0x38b701){var _0x322f50=typeof _0x317ff8['offset']===_0x4fe4('0x1d')&&typeof _0x317ff8[_0x4fe4('0x1e')]===_0x4fe4('0x1d');var _0x511c53=_0x38b701[_0x4fe4('0x1f')];var _0x345a1e=_0x322f50?0x0:_0x317ff8['offset'];var _0x18efb6=_0x322f50?_0x38b701['count']:_0x317ff8['offset']+_0x317ff8['limit'];var _0x5b9edf;if(_0x18efb6>=_0x511c53){_0x18efb6=_0x511c53;_0x5b9edf=0xc8;}else{_0x5b9edf=0xce;}_0x512cec[_0x4fe4('0x1a')](_0x5b9edf);return _0x512cec[_0x4fe4('0x20')](_0x4fe4('0x21'),_0x345a1e+'-'+_0x18efb6+'/'+_0x511c53)[_0x4fe4('0x1c')](_0x38b701);}return null;};}function patchUpdates(_0x52dc78){return function(_0x1bd1fd){try{jsonpatch[_0x4fe4('0x22')](_0x1bd1fd,_0x52dc78,!![]);}catch(_0x4b69e6){return BPromise['reject'](_0x4b69e6);}return _0x1bd1fd[_0x4fe4('0x23')]();};}function saveUpdates(_0x247a19,_0x17f100){return function(_0xd7b20d){if(_0xd7b20d){return _0xd7b20d[_0x4fe4('0x24')](_0x247a19)[_0x4fe4('0x25')](function(_0x4666ce){return _0x4666ce;});}return null;};}function removeEntity(_0x2db868,_0x9b3f82){return function(_0x256fcd){if(_0x256fcd){return _0x256fcd['destroy']()['then'](function(){var _0x2fc31f=_0x256fcd[_0x4fe4('0x26')]({'plain':!![]});var _0x352656='Companies';return db[_0x4fe4('0x27')][_0x4fe4('0x28')]({'where':{'type':_0x352656,'resourceId':_0x2fc31f['id']}})[_0x4fe4('0x25')](function(){return _0x256fcd;});})[_0x4fe4('0x25')](function(){_0x2db868['status'](0xcc)[_0x4fe4('0x1b')]();});}};}function handleEntityNotFound(_0x552f00,_0xd65cb0){return function(_0x3b34c2){if(!_0x3b34c2){_0x552f00[_0x4fe4('0x29')](0x194);}return _0x3b34c2;};}function handleError(_0x1880f6,_0xa52cc6){_0xa52cc6=_0xa52cc6||0x1f4;return function(_0x315e9c){logger[_0x4fe4('0x2a')](_0x315e9c[_0x4fe4('0x2b')]);if(_0x315e9c[_0x4fe4('0x2c')]){delete _0x315e9c['name'];}_0x1880f6[_0x4fe4('0x1a')](_0xa52cc6)[_0x4fe4('0x2d')](_0x315e9c);};}exports[_0x4fe4('0x2e')]=function(_0x4f95d1,_0x5cf1ab){var _0x40247d={},_0x2a30ce={},_0x519fc8={'count':0x0,'rows':[]};return db['CmCompany'][_0x4fe4('0x2f')]()[_0x4fe4('0x25')](function(_0x50c0d8){_0x2a30ce[_0x4fe4('0x30')]=_[_0x4fe4('0x31')](_0x50c0d8);_0x2a30ce[_0x4fe4('0x32')]=_[_0x4fe4('0x31')](_0x4f95d1[_0x4fe4('0x32')]);_0x2a30ce[_0x4fe4('0x33')]=_['intersection'](_0x2a30ce[_0x4fe4('0x30')],_0x2a30ce[_0x4fe4('0x32')]);_0x40247d[_0x4fe4('0x34')]=_[_0x4fe4('0x35')](_0x2a30ce['model'],qs[_0x4fe4('0x36')](_0x4f95d1[_0x4fe4('0x32')][_0x4fe4('0x36')]));_0x40247d[_0x4fe4('0x34')]=_0x40247d[_0x4fe4('0x34')]['length']?_0x40247d[_0x4fe4('0x34')]:_0x2a30ce[_0x4fe4('0x30')];if(!_0x4f95d1[_0x4fe4('0x32')][_0x4fe4('0x37')](_0x4fe4('0x38'))){_0x40247d['limit']=qs[_0x4fe4('0x1e')](_0x4f95d1[_0x4fe4('0x32')][_0x4fe4('0x1e')]);_0x40247d[_0x4fe4('0x39')]=qs['offset'](_0x4f95d1[_0x4fe4('0x32')]['offset']);}_0x40247d['order']=qs[_0x4fe4('0x3a')](_0x4f95d1[_0x4fe4('0x32')]['sort']);_0x40247d['where']=qs[_0x4fe4('0x33')](_[_0x4fe4('0x3b')](_0x4f95d1[_0x4fe4('0x32')],_0x2a30ce[_0x4fe4('0x33')]),_0x50c0d8);if(_0x4f95d1['query']['filter']){_0x40247d['where']=_[_0x4fe4('0x3c')](_0x40247d[_0x4fe4('0x3d')],{'$or':_['map'](_0x40247d[_0x4fe4('0x34')],function(_0x3c080d){var _0x2fe4c6={};_0x2fe4c6[_0x3c080d]={'$like':'%'+_0x4f95d1[_0x4fe4('0x32')]['filter']+'%'};return _0x2fe4c6;})});}_0x40247d=_[_0x4fe4('0x3c')]({},_0x40247d,_0x4f95d1[_0x4fe4('0x3e')]);var _0x5120da={'where':_0x40247d[_0x4fe4('0x3d')]};return db['CmCompany'][_0x4fe4('0x1f')](_0x5120da)['then'](function(_0x2ff17b){_0x519fc8[_0x4fe4('0x1f')]=_0x2ff17b;if(_0x4f95d1[_0x4fe4('0x32')]['includeAll']){_0x40247d[_0x4fe4('0x3f')]=[{'all':!![]}];}return db[_0x4fe4('0x40')][_0x4fe4('0x41')](_0x40247d);})[_0x4fe4('0x25')](function(_0x3ad85e){_0x519fc8[_0x4fe4('0x42')]=_0x3ad85e;return _0x519fc8;})[_0x4fe4('0x25')](respondWithFilteredResult(_0x5cf1ab,_0x40247d))[_0x4fe4('0x43')](handleError(_0x5cf1ab,null));})[_0x4fe4('0x43')](handleError(_0x5cf1ab,null));};exports[_0x4fe4('0x44')]=function(_0x39a04b,_0x346127){var _0x5ab324={'raw':![],'where':{'id':_0x39a04b[_0x4fe4('0x45')]['id']}},_0x1e9b0d={};_0x1e9b0d[_0x4fe4('0x30')]=_['keys'](db[_0x4fe4('0x40')][_0x4fe4('0x46')]);_0x1e9b0d[_0x4fe4('0x32')]=_[_0x4fe4('0x31')](_0x39a04b[_0x4fe4('0x32')]);_0x1e9b0d[_0x4fe4('0x33')]=_[_0x4fe4('0x35')](_0x1e9b0d[_0x4fe4('0x30')],_0x1e9b0d['query']);_0x5ab324['attributes']=_[_0x4fe4('0x35')](_0x1e9b0d[_0x4fe4('0x30')],qs[_0x4fe4('0x36')](_0x39a04b[_0x4fe4('0x32')]['fields']));_0x5ab324[_0x4fe4('0x34')]=_0x5ab324[_0x4fe4('0x34')][_0x4fe4('0x47')]?_0x5ab324['attributes']:_0x1e9b0d[_0x4fe4('0x30')];if(_0x39a04b[_0x4fe4('0x32')][_0x4fe4('0x48')]){_0x5ab324[_0x4fe4('0x3f')]=[{'all':!![]}];}_0x5ab324=_[_0x4fe4('0x3c')]({},_0x5ab324,_0x39a04b[_0x4fe4('0x3e')]);return db[_0x4fe4('0x40')][_0x4fe4('0x49')](_0x5ab324)[_0x4fe4('0x25')](handleEntityNotFound(_0x346127,null))['then'](respondWithResult(_0x346127,null))[_0x4fe4('0x43')](handleError(_0x346127,null));};exports[_0x4fe4('0x4a')]=function(_0x56783c,_0x35b6cd){return db[_0x4fe4('0x40')][_0x4fe4('0x4a')](_0x56783c[_0x4fe4('0x4b')],{})[_0x4fe4('0x25')](function(_0x545202){var _0x57ad3e=_0x56783c[_0x4fe4('0x4c')][_0x4fe4('0x26')]({'plain':!![]});if(!_0x57ad3e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x57ad3e[_0x4fe4('0x4d')]===_0x4fe4('0x4c')){var _0x1441c7=_0x545202[_0x4fe4('0x26')]({'plain':!![]});var _0x4c6c86=_0x4fe4('0x4e');return db[_0x4fe4('0x4f')][_0x4fe4('0x49')]({'where':{'name':_0x4c6c86,'userProfileId':_0x57ad3e[_0x4fe4('0x50')]},'raw':!![]})[_0x4fe4('0x25')](function(_0x5124c1){if(_0x5124c1&&_0x5124c1['autoAssociation']===0x0){return db[_0x4fe4('0x27')]['create']({'name':_0x1441c7['name'],'resourceId':_0x1441c7['id'],'type':_0x5124c1[_0x4fe4('0x2c')],'sectionId':_0x5124c1['id']},{})[_0x4fe4('0x25')](function(){return _0x545202;});}else{return _0x545202;}})[_0x4fe4('0x43')](function(_0x4c5385){logger[_0x4fe4('0x2a')](_0x4fe4('0x51'),_0x4c5385);throw _0x4c5385;});}return _0x545202;})[_0x4fe4('0x25')](respondWithResult(_0x35b6cd,0xc9))['catch'](handleError(_0x35b6cd,null));};exports[_0x4fe4('0x24')]=function(_0xe968f9,_0x11b20e){if(_0xe968f9[_0x4fe4('0x4b')]['id']){delete _0xe968f9[_0x4fe4('0x4b')]['id'];}return db[_0x4fe4('0x40')][_0x4fe4('0x49')]({'where':{'id':_0xe968f9[_0x4fe4('0x45')]['id']}})['then'](handleEntityNotFound(_0x11b20e,null))['then'](saveUpdates(_0xe968f9['body'],null))[_0x4fe4('0x25')](respondWithResult(_0x11b20e,null))[_0x4fe4('0x43')](handleError(_0x11b20e,null));};exports[_0x4fe4('0x28')]=function(_0x42ad1e,_0x4ef8cb){return db[_0x4fe4('0x40')]['find']({'where':{'id':_0x42ad1e[_0x4fe4('0x45')]['id']}})[_0x4fe4('0x25')](handleEntityNotFound(_0x4ef8cb,null))[_0x4fe4('0x25')](removeEntity(_0x4ef8cb,null))[_0x4fe4('0x43')](handleError(_0x4ef8cb,null));};exports[_0x4fe4('0x2f')]=function(_0x1a4472,_0x523871){return db[_0x4fe4('0x40')][_0x4fe4('0x2f')]()[_0x4fe4('0x25')](respondWithResult(_0x523871,null))[_0x4fe4('0x43')](handleError(_0x523871,null));};exports[_0x4fe4('0x52')]=function(_0x7d21cf,_0x37111e,_0x36e091){return db[_0x4fe4('0x53')][_0x4fe4('0x49')]({'where':{'id':_0x7d21cf[_0x4fe4('0x45')]['id']}})[_0x4fe4('0x25')](handleEntityNotFound(_0x37111e,null))[_0x4fe4('0x25')](function(_0x1fc911){if(_0x1fc911){return _0x1fc911[_0x4fe4('0x52')](_0x7d21cf[_0x4fe4('0x4b')][_0x4fe4('0x54')],_[_0x4fe4('0x55')](_0x7d21cf[_0x4fe4('0x4b')],[_0x4fe4('0x54'),'id'])||{});}})['then'](respondWithResult(_0x37111e,null))[_0x4fe4('0x43')](handleError(_0x37111e,null));};exports['getContacts']=function(_0x24cfe3,_0x41ebe1,_0x1a5895){var _0x28ab1c={};var _0x25a2d0={};var _0x4b42a4;var _0x36eef8;return db[_0x4fe4('0x40')]['findOne']({'where':{'id':_0x24cfe3[_0x4fe4('0x45')]['id']}})[_0x4fe4('0x25')](handleEntityNotFound(_0x41ebe1,null))['then'](function(_0x2cbba1){if(_0x2cbba1){_0x4b42a4=_0x2cbba1;_0x25a2d0[_0x4fe4('0x30')]=_['keys'](db[_0x4fe4('0x53')][_0x4fe4('0x46')]);_0x25a2d0[_0x4fe4('0x32')]=_['keys'](_0x24cfe3[_0x4fe4('0x32')]);_0x25a2d0[_0x4fe4('0x33')]=_[_0x4fe4('0x35')](_0x25a2d0[_0x4fe4('0x30')],_0x25a2d0[_0x4fe4('0x32')]);_0x28ab1c[_0x4fe4('0x34')]=_[_0x4fe4('0x35')](_0x25a2d0[_0x4fe4('0x30')],qs[_0x4fe4('0x36')](_0x24cfe3[_0x4fe4('0x32')][_0x4fe4('0x36')]));_0x28ab1c['attributes']=_0x28ab1c[_0x4fe4('0x34')][_0x4fe4('0x47')]?_0x28ab1c[_0x4fe4('0x34')]:_0x25a2d0['model'];_0x28ab1c[_0x4fe4('0x56')]=qs[_0x4fe4('0x3a')](_0x24cfe3[_0x4fe4('0x32')][_0x4fe4('0x3a')]);_0x28ab1c['where']=qs[_0x4fe4('0x33')](_[_0x4fe4('0x3b')](_0x24cfe3['query'],_0x25a2d0[_0x4fe4('0x33')]));if(_0x24cfe3[_0x4fe4('0x32')][_0x4fe4('0x57')]){_0x28ab1c['where']=_['merge'](_0x28ab1c[_0x4fe4('0x3d')],{'$or':_[_0x4fe4('0x58')](_0x28ab1c['attributes'],function(_0x45c47b){var _0x20e538={};_0x20e538[_0x45c47b]={'$like':'%'+_0x24cfe3[_0x4fe4('0x32')][_0x4fe4('0x57')]+'%'};return _0x20e538;})});}_0x28ab1c=_['merge']({},_0x28ab1c,_0x24cfe3[_0x4fe4('0x3e')]);return _0x4b42a4[_0x4fe4('0x59')](_0x28ab1c);}})['then'](function(_0x10ceb3){if(_0x10ceb3){_0x36eef8=_0x10ceb3[_0x4fe4('0x47')];if(!_0x24cfe3[_0x4fe4('0x32')][_0x4fe4('0x37')](_0x4fe4('0x38'))){_0x28ab1c[_0x4fe4('0x1e')]=qs['limit'](_0x24cfe3[_0x4fe4('0x32')][_0x4fe4('0x1e')]);_0x28ab1c[_0x4fe4('0x39')]=qs[_0x4fe4('0x39')](_0x24cfe3['query'][_0x4fe4('0x39')]);}return _0x4b42a4[_0x4fe4('0x59')](_0x28ab1c);}})[_0x4fe4('0x25')](function(_0x4590d5){if(_0x4590d5){return _0x4590d5?{'count':_0x36eef8,'rows':_0x4590d5}:null;}})[_0x4fe4('0x25')](respondWithResult(_0x41ebe1,null))[_0x4fe4('0x43')](handleError(_0x41ebe1,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 6f1e610..de3596a 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 _0xf355=['api','moment','bluebird','request-promise','path','rimraf','./cmCompany.attributes','define','CmCompany','lodash'];(function(_0x1eafae,_0x581257){var _0x37cc60=function(_0x4b4aad){while(--_0x4b4aad){_0x1eafae['push'](_0x1eafae['shift']());}};_0x37cc60(++_0x581257);}(_0xf355,0x17b));var _0x5f35=function(_0x2411ea,_0x4e2188){_0x2411ea=_0x2411ea-0x0;var _0x4b9644=_0xf355[_0x2411ea];return _0x4b9644;};'use strict';var _=require(_0x5f35('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5f35('0x1'));var moment=require(_0x5f35('0x2'));var BPromise=require(_0x5f35('0x3'));var rp=require(_0x5f35('0x4'));var fs=require('fs');var path=require(_0x5f35('0x5'));var rimraf=require(_0x5f35('0x6'));var config=require('../../config/environment');var attributes=require(_0x5f35('0x7'));module['exports']=function(_0x2363c0,_0xbee771){return _0x2363c0[_0x5f35('0x8')](_0x5f35('0x9'),attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1591=['exports','define','cm_companies','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmCompany.attributes'];(function(_0x238b73,_0x5df76f){var _0x5966d9=function(_0x57802d){while(--_0x57802d){_0x238b73['push'](_0x238b73['shift']());}};_0x5966d9(++_0x5df76f);}(_0x1591,0x162));var _0x1159=function(_0x3958fe,_0x3c6605){_0x3958fe=_0x3958fe-0x0;var _0x1f27d6=_0x1591[_0x3958fe];return _0x1f27d6;};'use strict';var _=require(_0x1159('0x0'));var util=require(_0x1159('0x1'));var logger=require(_0x1159('0x2'))(_0x1159('0x3'));var moment=require('moment');var BPromise=require(_0x1159('0x4'));var rp=require(_0x1159('0x5'));var fs=require('fs');var path=require(_0x1159('0x6'));var rimraf=require(_0x1159('0x7'));var config=require(_0x1159('0x8'));var attributes=require(_0x1159('0x9'));module[_0x1159('0xa')]=function(_0x217a06,_0x3e672a){return _0x217a06[_0x1159('0xb')]('CmCompany',attributes,{'tableName':_0x1159('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index 4c89e00..4571a3d 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 _0xe90e=['info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then'];(function(_0x4f1050,_0xaceeab){var _0x1cc2cf=function(_0x325cef){while(--_0x325cef){_0x4f1050['push'](_0x4f1050['shift']());}};_0x1cc2cf(++_0xaceeab);}(_0xe90e,0x1c0));var _0xee90=function(_0x1d619,_0x51f2b5){_0x1d619=_0x1d619-0x0;var _0x330693=_0xe90e[_0x1d619];return _0x330693;};'use strict';var _=require(_0xee90('0x0'));var util=require('util');var moment=require(_0xee90('0x1'));var BPromise=require(_0xee90('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xee90('0x3'));var db=require(_0xee90('0x4'))['db'];var utils=require(_0xee90('0x5'));var logger=require(_0xee90('0x6'))(_0xee90('0x7'));var config=require('../../config/environment');var jayson=require(_0xee90('0x8'));var client=jayson[_0xee90('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xab031d,_0x58350d,_0x25d765){return new BPromise(function(_0x56e6d1,_0x30ceb0){return client[_0xee90('0xa')](_0xab031d,_0x25d765)[_0xee90('0xb')](function(_0x1b98af){logger[_0xee90('0xc')](_0xee90('0xd'),_0x58350d,_0xee90('0xe'));logger[_0xee90('0xf')](_0xee90('0x10'),_0x58350d,_0xee90('0xe'),JSON['stringify'](_0x1b98af));if(_0x1b98af[_0xee90('0x11')]){if(_0x1b98af[_0xee90('0x11')]['code']===0x1f4){logger['error'](_0xee90('0xd'),_0x58350d,_0x1b98af[_0xee90('0x11')]['message']);return _0x30ceb0(_0x1b98af[_0xee90('0x11')][_0xee90('0x12')]);}logger[_0xee90('0x11')](_0xee90('0xd'),_0x58350d,_0x1b98af['error'][_0xee90('0x12')]);return _0x56e6d1(_0x1b98af[_0xee90('0x11')][_0xee90('0x12')]);}else{logger[_0xee90('0xc')](_0xee90('0xd'),_0x58350d,_0xee90('0xe'));_0x56e6d1(_0x1b98af['result'][_0xee90('0x12')]);}})[_0xee90('0x13')](function(_0x4e423f){logger[_0xee90('0x11')](_0xee90('0xd'),_0x58350d,_0x4e423f);_0x30ceb0(_0x4e423f);});});} \ No newline at end of file +var _0xc8bd=['CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','CmCompany,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x21e8a3,_0x1e2514){var _0x1c14da=function(_0xfda92f){while(--_0xfda92f){_0x21e8a3['push'](_0x21e8a3['shift']());}};_0x1c14da(++_0x1e2514);}(_0xc8bd,0xa8));var _0xdc8b=function(_0x386247,_0x5dcfa9){_0x386247=_0x386247-0x0;var _0x3abf65=_0xc8bd[_0x386247];return _0x3abf65;};'use strict';var _=require('lodash');var util=require(_0xdc8b('0x0'));var moment=require('moment');var BPromise=require(_0xdc8b('0x1'));var rs=require(_0xdc8b('0x2'));var fs=require('fs');var Redis=require(_0xdc8b('0x3'));var db=require(_0xdc8b('0x4'))['db'];var utils=require(_0xdc8b('0x5'));var logger=require('../../config/logger')(_0xdc8b('0x6'));var config=require(_0xdc8b('0x7'));var jayson=require(_0xdc8b('0x8'));var client=jayson[_0xdc8b('0x9')][_0xdc8b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x274666,_0x3d10c9,_0x260369){return new BPromise(function(_0xc4d2e2,_0x43be17){return client[_0xdc8b('0xb')](_0x274666,_0x260369)[_0xdc8b('0xc')](function(_0x4426e0){logger['info'](_0xdc8b('0xd'),_0x3d10c9,_0xdc8b('0xe'));logger[_0xdc8b('0xf')](_0xdc8b('0x10'),_0x3d10c9,_0xdc8b('0xe'),JSON[_0xdc8b('0x11')](_0x4426e0));if(_0x4426e0[_0xdc8b('0x12')]){if(_0x4426e0[_0xdc8b('0x12')][_0xdc8b('0x13')]===0x1f4){logger[_0xdc8b('0x12')]('CmCompany,\x20%s,\x20%s',_0x3d10c9,_0x4426e0[_0xdc8b('0x12')][_0xdc8b('0x14')]);return _0x43be17(_0x4426e0['error']['message']);}logger[_0xdc8b('0x12')](_0xdc8b('0xd'),_0x3d10c9,_0x4426e0[_0xdc8b('0x12')][_0xdc8b('0x14')]);return _0xc4d2e2(_0x4426e0[_0xdc8b('0x12')]['message']);}else{logger[_0xdc8b('0x15')](_0xdc8b('0xd'),_0x3d10c9,'request\x20sent');_0xc4d2e2(_0x4426e0['result'][_0xdc8b('0x14')]);}})[_0xdc8b('0x16')](function(_0x3e1563){logger[_0xdc8b('0x12')](_0xdc8b('0xd'),_0x3d10c9,_0x3e1563);_0x43be17(_0x3e1563);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index fe6d0b5..3e169c9 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 _0x8a0b=['/:id','show','/:id/contacts','getContacts','create','post','put','delete','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','index','get','isAuthenticated'];(function(_0x85a7e,_0x2b6e2c){var _0x2e9266=function(_0x1d3bb7){while(--_0x1d3bb7){_0x85a7e['push'](_0x85a7e['shift']());}};_0x2e9266(++_0x2b6e2c);}(_0x8a0b,0x9c));var _0xb8a0=function(_0xf7f04c,_0x15c148){_0xf7f04c=_0xf7f04c-0x0;var _0x7094ba=_0x8a0b[_0xf7f04c];return _0x7094ba;};'use strict';var multer=require('multer');var util=require(_0xb8a0('0x0'));var path=require(_0xb8a0('0x1'));var timeout=require('connect-timeout');var express=require(_0xb8a0('0x2'));var router=express[_0xb8a0('0x3')]();var fs_extra=require(_0xb8a0('0x4'));var auth=require(_0xb8a0('0x5'));var interaction=require(_0xb8a0('0x6'));var config=require(_0xb8a0('0x7'));var controller=require(_0xb8a0('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xb8a0('0x9')]);router[_0xb8a0('0xa')]('/describe',auth[_0xb8a0('0xb')](),controller['describe']);router[_0xb8a0('0xa')](_0xb8a0('0xc'),auth[_0xb8a0('0xb')](),controller[_0xb8a0('0xd')]);router[_0xb8a0('0xa')](_0xb8a0('0xe'),auth[_0xb8a0('0xb')](),controller[_0xb8a0('0xf')]);router['post']('/',auth[_0xb8a0('0xb')](),controller[_0xb8a0('0x10')]);router[_0xb8a0('0x11')]('/:id/contacts',auth[_0xb8a0('0xb')](),controller['addContacts']);router[_0xb8a0('0x12')]('/:id',auth[_0xb8a0('0xb')](),controller['update']);router[_0xb8a0('0x13')](_0xb8a0('0xc'),auth[_0xb8a0('0xb')](),controller['destroy']);module[_0xb8a0('0x14')]=router; \ No newline at end of file +var _0xfd6d=['../../components/auth/service','../../components/interaction/service','./cmCompany.controller','index','/describe','isAuthenticated','get','/:id','show','getContacts','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x1a209f,_0x1b35e6){var _0x376b56=function(_0x5ed729){while(--_0x5ed729){_0x1a209f['push'](_0x1a209f['shift']());}};_0x376b56(++_0x1b35e6);}(_0xfd6d,0xb9));var _0xdfd6=function(_0x295729,_0xce308){_0x295729=_0x295729-0x0;var _0x4da443=_0xfd6d[_0x295729];return _0x4da443;};'use strict';var multer=require(_0xdfd6('0x0'));var util=require(_0xdfd6('0x1'));var path=require(_0xdfd6('0x2'));var timeout=require(_0xdfd6('0x3'));var express=require(_0xdfd6('0x4'));var router=express[_0xdfd6('0x5')]();var fs_extra=require(_0xdfd6('0x6'));var auth=require(_0xdfd6('0x7'));var interaction=require(_0xdfd6('0x8'));var config=require('../../config/environment');var controller=require(_0xdfd6('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xdfd6('0xa')]);router['get'](_0xdfd6('0xb'),auth[_0xdfd6('0xc')](),controller['describe']);router[_0xdfd6('0xd')](_0xdfd6('0xe'),auth[_0xdfd6('0xc')](),controller[_0xdfd6('0xf')]);router[_0xdfd6('0xd')]('/:id/contacts',auth['isAuthenticated'](),controller[_0xdfd6('0x10')]);router[_0xdfd6('0x11')]('/',auth['isAuthenticated'](),controller[_0xdfd6('0x12')]);router[_0xdfd6('0x11')]('/:id/contacts',auth[_0xdfd6('0xc')](),controller['addContacts']);router[_0xdfd6('0x13')](_0xdfd6('0xe'),auth[_0xdfd6('0xc')](),controller[_0xdfd6('0x14')]);router[_0xdfd6('0x15')]('/:id',auth[_0xdfd6('0xc')](),controller[_0xdfd6('0x16')]);module[_0xdfd6('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 2ad30a7..aed5633 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 _0xcb81=['UNSIGNED','NOW','lodash','STRING','INTEGER'];(function(_0x46bc6e,_0x1b2c3b){var _0xef4298=function(_0x4526bb){while(--_0x4526bb){_0x46bc6e['push'](_0x46bc6e['shift']());}};_0xef4298(++_0x1b2c3b);}(_0xcb81,0xfc));var _0x1cb8=function(_0x1e03a6,_0xf0349){_0x1e03a6=_0x1e03a6-0x0;var _0x295b64=_0xcb81[_0x1e03a6];return _0x295b64;};'use strict';var _=require(_0x1cb8('0x0'));var Sequelize=require('sequelize');module['exports']={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x1cb8('0x1')]},'dateOfBirth':{'type':Sequelize[_0x1cb8('0x1')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x1cb8('0x1')]},'fax':{'type':Sequelize[_0x1cb8('0x1')]},'email':{'type':Sequelize[_0x1cb8('0x1')]},'url':{'type':Sequelize[_0x1cb8('0x1')]},'facebook':{'type':Sequelize[_0x1cb8('0x1')]},'fb_data':{'type':Sequelize[_0x1cb8('0x1')]},'twitter':{'type':Sequelize[_0x1cb8('0x1')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0x1cb8('0x1')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0x1cb8('0x1')]},'wechat':{'type':Sequelize[_0x1cb8('0x1')]},'telegram':{'type':Sequelize[_0x1cb8('0x1')]},'UserId':{'type':Sequelize[_0x1cb8('0x2')]},'AdditionalPhones':{'type':Sequelize[_0x1cb8('0x1')]},'priority':{'type':Sequelize[_0x1cb8('0x2')](0x2)[_0x1cb8('0x3')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0x1cb8('0x4')]},'dialTimezone':{'type':Sequelize[_0x1cb8('0x1')]},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xba1e=['lodash','sequelize','exports','STRING','INTEGER','UNSIGNED','DATE'];(function(_0x5d07e1,_0x418799){var _0x21617f=function(_0x3e8068){while(--_0x3e8068){_0x5d07e1['push'](_0x5d07e1['shift']());}};_0x21617f(++_0x418799);}(_0xba1e,0x12d));var _0xeba1=function(_0x5d1b11,_0x48c8c6){_0x5d1b11=_0x5d1b11-0x0;var _0x1ad2b5=_0xba1e[_0x5d1b11];return _0x1ad2b5;};'use strict';var _=require(_0xeba1('0x0'));var Sequelize=require(_0xeba1('0x1'));module[_0xeba1('0x2')]={'firstName':{'type':Sequelize[_0xeba1('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0xeba1('0x3')]},'street':{'type':Sequelize[_0xeba1('0x3')]},'postalCode':{'type':Sequelize[_0xeba1('0x3')]},'city':{'type':Sequelize[_0xeba1('0x3')]},'country':{'type':Sequelize[_0xeba1('0x3')]},'dateOfBirth':{'type':Sequelize[_0xeba1('0x3')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0xeba1('0x3')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xeba1('0x3')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0xeba1('0x3')]},'fb_data':{'type':Sequelize[_0xeba1('0x3')]},'twitter':{'type':Sequelize[_0xeba1('0x3')]},'skype':{'type':Sequelize[_0xeba1('0x3')]},'teams':{'type':Sequelize[_0xeba1('0x3')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0xeba1('0x3')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize['INTEGER']},'AdditionalPhones':{'type':Sequelize[_0xeba1('0x3')]},'priority':{'type':Sequelize[_0xeba1('0x4')](0x2)[_0xeba1('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xeba1('0x6')],'defaultValue':Sequelize['NOW']},'dialTimezone':{'type':Sequelize[_0xeba1('0x3')]},'utcOffset':{'type':Sequelize[_0xeba1('0x4')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index caa00d1..75ebd89 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 _0x5f98=['status','json','undefined','limit','count','offset','Content-Range','update','then','destroy','end','sendStatus','error','stack','name','index','describe','findAll','query','user','catch','tags','keys','cf_','columnName','analytics','CmCustomField','displayName','alias','custom','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','hasOwnProperty','body','CmContact','from','length','get','mergeWith','isArray','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','ChatInteraction','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','create','join','dialTimezone','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','where','push','ListId','findOrCreate','all','show','find','color','tag','CmContactHasItem','Phones','params','ContactItemType','ItemType','sequelize','Phones.OrderBy','$and','omit','map','format','cf_%d','isNil','isEmpty','table','cm_contacts','setFields','text','values','phone','getTags','findOne','model','filters','intersection','fields','attributes','sort','pick','filter','merge','nolimit','setTags','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','PHONE','literal','CmHopperId','`ItemType`.OrderBy','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','rawAttributes','order','ContactId','options','includeAll','include','rows','getHopperHistories','CmHopperHistory','getHopperFinals','getJscriptySessions','uploadCsv','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','chmodSync','0777','child_process','fork','CompanyId','File\x20uploaded\x20correctly!','path','meta','import','User','agent','No\x20ListId\x20specified','binding','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','pid','exit','error\x20child\x20process','importUpdates','../../components/import/cm/csvUpdates','getJourney','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','includes','channel','toLowerCase','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','type','source','destination','callerid','endtime','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','DESC','findAndCountAll','fullname','startCase','closed','closedAt','secondDisposition','thirdDisposition','key','Tag','Tags','customerIp','customerPort','deviceModel','ratingMessage','ratingType','ratingValue','referer','mail','subject','substatus','Interaction','Owner','flatten','sortBy','reverse','moment','util','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/environment/shared','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','register'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x5f98,0x1de));var _0x85f9=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0x5f98[_0x243b2f];return _0xcb3c2d;};'use strict';var moment=require(_0x85f9('0x0'));var BPromise=require('bluebird');var util=require(_0x85f9('0x1'));var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require(_0x85f9('0x2'));var Papa=require('papaparse');var Redis=require(_0x85f9('0x3'));var contacts=require('../../components/contacts');var qs=require(_0x85f9('0x4'));var logger=require(_0x85f9('0x5'))(_0x85f9('0x6'));var config=require(_0x85f9('0x7'));var shared=require(_0x85f9('0x8'));var db=require(_0x85f9('0x9'))['db'];config[_0x85f9('0xa')]=_[_0x85f9('0xb')](config[_0x85f9('0xa')],{'host':_0x85f9('0xc'),'port':0x18eb});var socket=require(_0x85f9('0xd'))(new Redis(config[_0x85f9('0xa')]));require(_0x85f9('0xe'))[_0x85f9('0xf')](socket);function respondWithResult(_0x11ca1d,_0x547827){_0x547827=_0x547827||0xc8;return function(_0x210451){if(_0x210451){return _0x11ca1d[_0x85f9('0x10')](_0x547827)[_0x85f9('0x11')](_0x210451);}};}function respondWithFilteredResult(_0x497fcb,_0x3b3dc5){return function(_0x442d4f){if(_0x442d4f){var _0x4f52f2=typeof _0x3b3dc5['offset']===_0x85f9('0x12')&&typeof _0x3b3dc5[_0x85f9('0x13')]===_0x85f9('0x12');var _0x3aee2f=_0x442d4f[_0x85f9('0x14')];var _0x3b9113=_0x4f52f2?0x0:_0x3b3dc5[_0x85f9('0x15')];var _0x3d474c=_0x4f52f2?_0x442d4f[_0x85f9('0x14')]:_0x3b3dc5[_0x85f9('0x15')]+_0x3b3dc5[_0x85f9('0x13')];var _0x3fb579;if(_0x3d474c>=_0x3aee2f){_0x3d474c=_0x3aee2f;_0x3fb579=0xc8;}else{_0x3fb579=0xce;}_0x497fcb['status'](_0x3fb579);return _0x497fcb['set'](_0x85f9('0x16'),_0x3b9113+'-'+_0x3d474c+'/'+_0x3aee2f)[_0x85f9('0x11')](_0x442d4f);}return null;};}function saveUpdates(_0x332eaf){return function(_0x3f6601){if(_0x3f6601){return _0x3f6601[_0x85f9('0x17')](_0x332eaf)[_0x85f9('0x18')](function(_0x389145){return _0x389145;});}return null;};}function removeEntity(_0x23a5e5){return function(_0x7990cb){if(_0x7990cb){return _0x7990cb[_0x85f9('0x19')]()['then'](function(){_0x23a5e5[_0x85f9('0x10')](0xcc)[_0x85f9('0x1a')]();});}};}function handleEntityNotFound(_0x3ef23e){return function(_0x4dfc91){if(!_0x4dfc91){_0x3ef23e[_0x85f9('0x1b')](0x194);}return _0x4dfc91;};}function handleError(_0x1f6752,_0x5b3ced){_0x5b3ced=_0x5b3ced||0x1f4;return function(_0x3f6cfd){logger[_0x85f9('0x1c')](_0x3f6cfd[_0x85f9('0x1d')]);if(_0x3f6cfd[_0x85f9('0x1e')]){delete _0x3f6cfd[_0x85f9('0x1e')];}_0x1f6752[_0x85f9('0x10')](_0x5b3ced)['send'](_0x3f6cfd);};}exports[_0x85f9('0x1f')]=function(_0x1fd340,_0x23c266){var _0x3b71c8={};return contacts[_0x85f9('0x20')]()[_0x85f9('0x18')](function(_0xa5c08){_0x3b71c8=qs['getOptions'](_0xa5c08,_0x1fd340);return contacts[_0x85f9('0x21')](_0x1fd340[_0x85f9('0x22')],_0x1fd340[_0x85f9('0x23')],_0x3b71c8,_0xa5c08);})[_0x85f9('0x18')](respondWithFilteredResult(_0x23c266,_0x3b71c8))[_0x85f9('0x24')](handleError(_0x23c266,null));};exports[_0x85f9('0x19')]=function(_0x5220cc,_0x402efb){return db['CmContact']['find']({'where':{'id':_0x5220cc['params']['id']}})[_0x85f9('0x18')](handleEntityNotFound(_0x402efb,null))[_0x85f9('0x18')](removeEntity(_0x402efb,null))[_0x85f9('0x24')](handleError(_0x402efb,null));};exports[_0x85f9('0x20')]=function(_0xfbad82,_0x11dc61){return db['CmContact'][_0x85f9('0x20')]()['then'](function(_0x120bea){delete _0x120bea[_0x85f9('0x25')];for(var _0x25bd5f=0x0;_0x25bd5f0x0){return new Promise(function(_0x64ecb8){var _0x40e516=[];for(var _0x5311fd=0x0;_0x5311fd<_0x2779d0[_0x85f9('0x35')];_0x5311fd++){_0x40e516['push'](insertAdditionalPhones(_0x2779d0[_0x5311fd]['contact'],_0x2779d0[_0x5311fd][_0x85f9('0x56')]));}Promise[_0x85f9('0x5e')](_0x40e516)[_0x85f9('0x18')](function(){_0x64ecb8(0x1);});})[_0x85f9('0x18')](function(){return{'success':_0xca83a6,'failure':_0x1c0453,'duplicates':_0x2e2981};});}else{return{'success':_0xca83a6,'failure':_0x1c0453,'duplicates':_0x2e2981};}}})[_0x85f9('0x18')](respondWithResult(_0x1a052e,0xc9))['catch'](handleError(_0x1a052e,null));};exports[_0x85f9('0x5f')]=function(_0x5155b6,_0x26bfb2){var _0x51d50a;return db[_0x85f9('0x33')][_0x85f9('0x20')]()[_0x85f9('0x18')](function(_0x4b80d5){return db[_0x85f9('0x33')][_0x85f9('0x60')]({'where':{'id':_0x5155b6['params']['id']},'include':[{'model':db['Tag'],'as':'Tags','attributes':['id',_0x85f9('0x1e'),_0x85f9('0x61')],'required':_0x5155b6[_0x85f9('0x22')][_0x85f9('0x62')]?!![]:![]},{'model':db[_0x85f9('0x63')],'as':_0x85f9('0x64'),'where':{'CmContactId':_0x5155b6[_0x85f9('0x65')]['id']},'required':![],'include':[{'model':db[_0x85f9('0x66')],'as':_0x85f9('0x67')}]}],'order':[db[_0x85f9('0x68')]['literal'](_0x85f9('0x69'))],'attributes':_[_0x85f9('0x26')](_0x4b80d5)});})['then'](function(_0x5c77d3){if(!_['isNil'](_0x5c77d3)){_0x51d50a=_0x5c77d3[_0x85f9('0x36')]({'plain':!![]});var _0x7e6df7={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x5c77d3&&_0x5c77d3[_0x85f9('0x5c')]){if(_0x5c77d3['ListId']){_0x7e6df7[_0x85f9('0x5a')][_0x85f9('0x6a')][_0x85f9('0x5b')]({'ListId':{'$ne':_0x5c77d3['ListId']}});}}return db[_0x85f9('0x2a')][_0x85f9('0x21')](_0x7e6df7);}})[_0x85f9('0x18')](function(_0x2c6571){if(!_['isNil'](_0x2c6571)){return _[_0x85f9('0x6b')](_0x51d50a,_[_0x85f9('0x6c')](_0x2c6571,function(_0x1be5a6){return util[_0x85f9('0x6d')](_0x85f9('0x6e'),_0x1be5a6['id']);}));}})[_0x85f9('0x18')](handleEntityNotFound(_0x26bfb2,null))[_0x85f9('0x18')](respondWithResult(_0x26bfb2,null))[_0x85f9('0x24')](handleError(_0x26bfb2,null));};exports[_0x85f9('0x17')]=function(_0x4af0e0,_0x14249e){var _0x5666e4;if(_0x4af0e0['body']['id']){delete _0x4af0e0[_0x85f9('0x32')]['id'];}if(!_[_0x85f9('0x6f')](_0x4af0e0[_0x85f9('0x32')][_0x85f9('0x53')])){var _0x52bc48=_0x4af0e0[_0x85f9('0x32')][_0x85f9('0x53')];if(!_[_0x85f9('0x6f')](shared['timezones'][_0x52bc48]))_0x4af0e0['body'][_0x85f9('0x55')]=shared[_0x85f9('0x54')][_0x52bc48]['utcOffset'];}return db['CmContact'][_0x85f9('0x60')]({'where':{'id':_0x4af0e0[_0x85f9('0x65')]['id']}})[_0x85f9('0x18')](handleEntityNotFound(_0x14249e,null))[_0x85f9('0x18')](saveUpdates(_0x4af0e0[_0x85f9('0x32')],null))['then'](function(_0x1e3c84){_0x5666e4=_0x1e3c84;var _0x56c914={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x1e3c84&&_0x1e3c84[_0x85f9('0x5c')]){if(_0x1e3c84[_0x85f9('0x5c')]){_0x56c914[_0x85f9('0x5a')][_0x85f9('0x6a')][_0x85f9('0x5b')]({'ListId':{'$ne':_0x1e3c84[_0x85f9('0x5c')]}});}}return db[_0x85f9('0x2a')]['findAll'](_0x56c914);})[_0x85f9('0x18')](function(_0x1b2d01){if(_0x1b2d01){return _[_0x85f9('0x6b')](_['pickBy'](_0x4af0e0['body'],function(_0x13c241,_0x273252){return _['startsWith'](_0x273252,_0x85f9('0x27'));}),_[_0x85f9('0x6c')](_0x1b2d01,function(_0x467d83){return util[_0x85f9('0x6d')](_0x85f9('0x6e'),_0x467d83['id']);}));}})[_0x85f9('0x18')](function(_0x3b82b1){if(_0x3b82b1&&!_[_0x85f9('0x70')](_0x3b82b1)){var _0x302024=squel['update']()[_0x85f9('0x71')](_0x85f9('0x72'))[_0x85f9('0x73')](_0x3b82b1)[_0x85f9('0x5a')]('id\x20=\x20?',_0x4af0e0['params']['id'])['toParam']();return db[_0x85f9('0x68')][_0x85f9('0x22')](_0x302024[_0x85f9('0x74')],{'replacements':_0x302024[_0x85f9('0x75')]});}})[_0x85f9('0x18')](function(){if(_0x4af0e0[_0x85f9('0x32')][_0x85f9('0x76')]&&_0x5666e4){return db[_0x85f9('0x39')][_0x85f9('0x17')]({'phone':_0x4af0e0[_0x85f9('0x32')]['phone'],'OrderBy':0x0},{'where':{'ContactId':_0x5666e4['id']}});}})[_0x85f9('0x18')](function(){return _0x5666e4;})[_0x85f9('0x18')](respondWithResult(_0x14249e,null))['catch'](handleError(_0x14249e,null));};exports[_0x85f9('0x77')]=function(_0x13bbec,_0x1723a9){var _0x332213={};var _0x53bf79={};var _0x3dd555;var _0x1cc47d;return db['CmContact'][_0x85f9('0x78')]({'where':{'id':_0x13bbec[_0x85f9('0x65')]['id']}})[_0x85f9('0x18')](handleEntityNotFound(_0x1723a9,null))[_0x85f9('0x18')](function(_0x220aba){if(_0x220aba){_0x3dd555=_0x220aba;_0x53bf79[_0x85f9('0x79')]=_[_0x85f9('0x26')](db['Tag']['rawAttributes']);_0x53bf79[_0x85f9('0x22')]=_['keys'](_0x13bbec['query']);_0x53bf79[_0x85f9('0x7a')]=_[_0x85f9('0x7b')](_0x53bf79['model'],_0x53bf79['query']);_0x332213['attributes']=_[_0x85f9('0x7b')](_0x53bf79[_0x85f9('0x79')],qs[_0x85f9('0x7c')](_0x13bbec[_0x85f9('0x22')][_0x85f9('0x7c')]));_0x332213[_0x85f9('0x7d')]=_0x332213[_0x85f9('0x7d')]['length']?_0x332213[_0x85f9('0x7d')]:_0x53bf79[_0x85f9('0x79')];_0x332213['order']=qs[_0x85f9('0x7e')](_0x13bbec['query']['sort']);_0x332213[_0x85f9('0x5a')]=qs[_0x85f9('0x7a')](_[_0x85f9('0x7f')](_0x13bbec[_0x85f9('0x22')],_0x53bf79[_0x85f9('0x7a')]));if(_0x13bbec[_0x85f9('0x22')][_0x85f9('0x80')]){_0x332213[_0x85f9('0x5a')]=_[_0x85f9('0x81')](_0x332213[_0x85f9('0x5a')],{'$or':_[_0x85f9('0x6c')](_0x332213[_0x85f9('0x7d')],function(_0xb90a3a){var _0x4151f8={};_0x4151f8[_0xb90a3a]={'$like':'%'+_0x13bbec[_0x85f9('0x22')][_0x85f9('0x80')]+'%'};return _0x4151f8;})});}_0x332213=_[_0x85f9('0x81')]({},_0x332213,_0x13bbec['options']);return _0x3dd555[_0x85f9('0x77')](_0x332213);}})['then'](function(_0x2db84b){if(_0x2db84b){_0x1cc47d=_0x2db84b[_0x85f9('0x35')];if(!_0x13bbec[_0x85f9('0x22')][_0x85f9('0x31')](_0x85f9('0x82'))){_0x332213['limit']=qs['limit'](_0x13bbec[_0x85f9('0x22')][_0x85f9('0x13')]);_0x332213[_0x85f9('0x15')]=qs[_0x85f9('0x15')](_0x13bbec[_0x85f9('0x22')]['offset']);}return _0x3dd555[_0x85f9('0x77')](_0x332213);}})[_0x85f9('0x18')](function(_0x4fc5ec){if(_0x4fc5ec){return _0x4fc5ec?{'count':_0x1cc47d,'rows':_0x4fc5ec}:null;}})[_0x85f9('0x18')](respondWithResult(_0x1723a9,null))[_0x85f9('0x24')](handleError(_0x1723a9,null));};exports['setTags']=function(_0x2985bf,_0x198928){if(_0x2985bf[_0x85f9('0x32')]['id']){delete _0x2985bf[_0x85f9('0x32')]['id'];}return db[_0x85f9('0x33')]['findOne']({'where':{'id':_0x2985bf[_0x85f9('0x65')]['id']}})[_0x85f9('0x18')](handleEntityNotFound(_0x198928,null))[_0x85f9('0x18')](function(_0x58f7b2){if(_0x58f7b2){return _0x58f7b2[_0x85f9('0x83')](_0x2985bf[_0x85f9('0x32')]['ids']||[]);}return null;})['then'](respondWithResult(_0x198928,null))['catch'](handleError(_0x198928,null));};exports[_0x85f9('0x84')]=function(_0x565026,_0x1a3d23){var _0x1f38ff=[];_0x1f38ff[_0x85f9('0x5b')](addAdditionalPhones(_0x565026[_0x85f9('0x32')]));Promise['all'](_0x1f38ff)['then'](function(){_0x1f38ff=[];_0x1f38ff[_0x85f9('0x5b')](deleteCmHopperPhones(_0x565026[_0x85f9('0x32')]['id']));_0x1f38ff[_0x85f9('0x5b')](addCmHopperPhones(_0x565026[_0x85f9('0x32')]['id']));Promise['all'](_0x1f38ff)[_0x85f9('0x18')](function(){return[0x1];})[_0x85f9('0x18')](respondWithResult(_0x1a3d23,null));});};function addAdditionalPhones(_0x5494d5){var _0x2d31a;return new Promise(function(_0x37f02e){return db[_0x85f9('0x63')][_0x85f9('0x19')]({'where':{'CmContactId':_0x5494d5['id']}})[_0x85f9('0x18')](function(){db['ContactItemType'][_0x85f9('0x21')]({'raw':!![],'attributes':['id',_0x85f9('0x85')]})[_0x85f9('0x18')](function(_0x736f26){var _0x59f74f=[];for(var _0x4e6319=0x0;_0x4e6319<_0x5494d5[_0x85f9('0x86')][_0x85f9('0x35')];_0x4e6319++){var _0x8cfaaa=_0x5494d5[_0x85f9('0x87')]?_[_0x85f9('0x6f')](_0x5494d5['item_types'][_0x4e6319])?'':_0x5494d5[_0x85f9('0x87')][_0x4e6319]:_0x5494d5[_0x85f9('0x86')][_0x4e6319][_0x85f9('0x88')]?_0x5494d5['items'][_0x4e6319][_0x85f9('0x88')]:'';var _0x112887=_[_0x85f9('0x6f')](_0x5494d5[_0x85f9('0x86')][_0x4e6319][_0x85f9('0x89')])?'':_0x5494d5[_0x85f9('0x86')][_0x4e6319]['description'];var _0x58cd10=_0x8cfaaa+':'+_0x5494d5[_0x85f9('0x86')][_0x4e6319][_0x85f9('0x76')]+'§'+_0x112887;if(_[_0x85f9('0x6f')](_0x2d31a))_0x2d31a=_0x58cd10;else _0x2d31a+=';'+_0x58cd10;var _0x4a75e3=null;var _0xe10e65=null;if(_0x5494d5[_0x85f9('0x87')]){if(!_[_0x85f9('0x6f')](_0x5494d5[_0x85f9('0x87')][_0x4e6319])){_0xe10e65=_[_0x85f9('0x60')](_0x736f26,function(_0x41aa70){return _0x41aa70['id']===_0x5494d5[_0x85f9('0x87')][_0x4e6319];});if(!_[_0x85f9('0x6f')](_0xe10e65)){_0x4a75e3=_0xe10e65[_0x85f9('0x85')];}}}else{if(!_['isNil'](_0x5494d5[_0x85f9('0x86')][_0x4e6319])){_0xe10e65=_[_0x85f9('0x60')](_0x736f26,function(_0x3b0ec3){return _0x3b0ec3['id']===_0x5494d5[_0x85f9('0x86')][_0x4e6319]['ItemTypeId'];});if(!_[_0x85f9('0x6f')](_0xe10e65)){_0x4a75e3=_0x4e6319;}}}if(_['isNil'](_0x4a75e3)){_0x4a75e3=0x64;}_0x59f74f[_0x85f9('0x5b')](addAdditionalPhone(_0x5494d5['id'],_0x5494d5['items'][_0x4e6319]['phone'],_0x5494d5[_0x85f9('0x87')]?_[_0x85f9('0x6f')](_0x5494d5[_0x85f9('0x87')][_0x4e6319])?null:_0x5494d5['item_types'][_0x4e6319]:_0x5494d5[_0x85f9('0x86')][_0x4e6319][_0x85f9('0x88')]?_0x5494d5[_0x85f9('0x86')][_0x4e6319]['ItemTypeId']:null,_0x4a75e3,_0x112887));}Promise[_0x85f9('0x5e')](_0x59f74f)[_0x85f9('0x18')](function(){db['CmContact'][_0x85f9('0x17')]({'AdditionalPhones':_0x2d31a},{'where':{'id':_0x5494d5['id']}})[_0x85f9('0x18')](function(){_0x37f02e(0x1);});});});});});}function addAdditionalPhone(_0x506c0b,_0x2d4d42,_0x3276ba,_0x241e63,_0x6a762a){return db['CmContactHasItem']['find']({'where':{'CmContactId':_0x506c0b,'item':_0x2d4d42}})[_0x85f9('0x18')](function(_0xcd5966){if(_0xcd5966)logger[_0x85f9('0x2e')]('contact\x20phone\x20exists',_0xcd5966);else{db[_0x85f9('0x63')][_0x85f9('0x51')]({'CmContactId':_0x506c0b,'item':_0x2d4d42,'ItemTypeId':_0x3276ba,'OrderBy':_0x241e63,'ItemClass':_0x85f9('0x8a'),'description':_0x6a762a});}});}function deleteCmHopperPhones(_0x5a45bd){return new Promise(function(_0x11ef55){return db['CmHopper']['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x5a45bd}})[_0x85f9('0x18')](function(_0x1cc2b5){db['CmHopperAdditionalPhone'][_0x85f9('0x19')]({'where':{'CmHopperId':{'$in':_[_0x85f9('0x6c')](_0x1cc2b5,'id')}}});})[_0x85f9('0x18')](function(){_0x11ef55(0x1);});});}function addCmHopperPhones(_0x15fd04){return new Promise(function(_0x5d76fe){return db['CmHopper'][_0x85f9('0x21')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x15fd04}})[_0x85f9('0x18')](function(_0x4ecf4b){var _0x4b7112=[];_[_0x85f9('0x6c')](_0x4ecf4b,function(_0x27ffad){_0x4b7112[_0x85f9('0x5b')](createCmHopperPhone(_0x15fd04,_0x27ffad['id']));});Promise[_0x85f9('0x5e')](_0x4b7112)[_0x85f9('0x18')](function(){_0x5d76fe(0x1);});});});}function createCmHopperPhone(_0x364907,_0x587232){return new Promise(function(_0x3e67b2){db[_0x85f9('0x63')][_0x85f9('0x21')]({'raw':!![],'attributes':['item',_0x85f9('0x85')],'where':{'CmContactId':_0x364907,'ItemClass':_0x85f9('0x8a')},'include':[{'model':db[_0x85f9('0x66')],'attributes':[_0x85f9('0x85')],'as':_0x85f9('0x67')}],'order':['OrderBy',db[_0x85f9('0x68')][_0x85f9('0x8b')]('`ItemType`.OrderBy')]})[_0x85f9('0x18')](function(_0x383cee){var _0x50c987=0x1;var _0x1dac40=_[_0x85f9('0x6c')](_0x383cee,function(_0x7036cb){_0x7036cb[_0x85f9('0x8c')]=_0x587232;_0x7036cb[_0x85f9('0x76')]=_0x7036cb['item'];_0x7036cb[_0x85f9('0x85')]=_0x50c987;delete _0x7036cb['ItemType.OrderBy'];_0x50c987=_0x50c987+0x1;return _0x7036cb;});return db['CmHopperAdditionalPhone'][_0x85f9('0x57')](_0x1dac40,{});})[_0x85f9('0x18')](function(){_0x3e67b2(0x1);});});}function insertAdditionalPhones(_0x4b7bce,_0x275768){return new Promise(function(_0x5795e7){var _0x1eab9e=[];for(var _0x560194=0x0;_0x560194<_0x275768['length'];_0x560194++){var _0x292fd0=_0x275768[_0x560194];_0x1eab9e[_0x85f9('0x5b')](parseContactItemType(_0x292fd0));}Promise[_0x85f9('0x5e')](_0x1eab9e)[_0x85f9('0x18')](function(){var _0x7c679a={'id':_0x4b7bce['id'],'items':_0x275768};return addAdditionalPhones(_0x7c679a)['then'](function(){return addCmHopperPhones(_0x4b7bce['id']);});})['then'](function(){_0x5795e7(_0x4b7bce);});});}function parseContactItemType(_0x26dc87){return new Promise(function(_0x35326f){if(_0x26dc87['hasOwnProperty']('ItemTypeId')){_0x35326f(_0x26dc87);}else{return db['ContactItemType']['find']({'where':{'name':_0x26dc87[_0x85f9('0x67')]}})['then'](function(_0x439510){if(_[_0x85f9('0x6f')](_0x439510))_0x26dc87['ItemTypeId']=null;else _0x26dc87[_0x85f9('0x88')]=_0x439510['id'];_0x35326f(_0x26dc87);});}});}exports['getAdditionalPhones']=function(_0x4069b8,_0x2e0ff1){return db[_0x85f9('0x63')][_0x85f9('0x21')]({'raw':!![],'where':{'CmContactId':_0x4069b8['params']['id'],'ItemClass':_0x85f9('0x8a')},'include':[{'model':db[_0x85f9('0x66')],'as':_0x85f9('0x67')}],'order':[[_0x85f9('0x85')],[db['sequelize'][_0x85f9('0x8b')](_0x85f9('0x8d'))]]})['then'](function(_0x1fdb73){return _0x1fdb73;})[_0x85f9('0x18')](respondWithResult(_0x2e0ff1,null))[_0x85f9('0x24')](handleError(_0x2e0ff1,null));};exports[_0x85f9('0x8e')]=function(_0x187208,_0x856191){return db[_0x85f9('0x63')]['findAll']({'raw':!![],'where':{'CmContactId':_0x187208[_0x85f9('0x32')][_0x85f9('0x8f')]}})['then'](function(_0x5ef1bc){var _0x3d336b=_[_0x85f9('0x6c')](_0x5ef1bc,function(_0x46c7cc){_0x46c7cc[_0x85f9('0x90')]=_0x187208[_0x85f9('0x32')]['toContactId'];return _0x46c7cc;});return db[_0x85f9('0x63')][_0x85f9('0x57')](_0x3d336b,{});})[_0x85f9('0x18')](function(){return addCmHopperPhones(_0x187208[_0x85f9('0x32')][_0x85f9('0x91')]);})[_0x85f9('0x18')](function(){return['ok'];})[_0x85f9('0x18')](respondWithResult(_0x856191,null))[_0x85f9('0x24')](handleError(_0x856191,null));};exports['rescheduleAdditionalPhones']=function(_0x1de9b4,_0x5c116d){var _0x348a3a=[];_0x348a3a[_0x85f9('0x5b')](createCmHopperPhone(_0x1de9b4[_0x85f9('0x32')]['id'],_0x1de9b4[_0x85f9('0x32')]['hopperId']));Promise[_0x85f9('0x5e')](_0x348a3a)[_0x85f9('0x18')](function(){return[0x1];})[_0x85f9('0x18')](respondWithResult(_0x5c116d,null));};exports['getHoppers']=function(_0x28d460,_0x32ca0c){var _0x502a0a={'raw':![],'where':{}};var _0x5ed7c4={};var _0x2c446a={'count':0x0,'rows':[]};return db[_0x85f9('0x33')][_0x85f9('0x78')]({'where':{'id':_0x28d460[_0x85f9('0x65')]['id']}})[_0x85f9('0x18')](handleEntityNotFound(_0x32ca0c,null))[_0x85f9('0x18')](function(_0xa0fe57){if(_0xa0fe57){_0x5ed7c4[_0x85f9('0x79')]=_['keys'](db[_0x85f9('0x39')][_0x85f9('0x92')]);_0x5ed7c4['query']=_[_0x85f9('0x26')](_0x28d460[_0x85f9('0x22')]);_0x5ed7c4[_0x85f9('0x7a')]=_['intersection'](_0x5ed7c4['model'],_0x5ed7c4[_0x85f9('0x22')]);_0x502a0a[_0x85f9('0x7d')]=_[_0x85f9('0x7b')](_0x5ed7c4[_0x85f9('0x79')],qs[_0x85f9('0x7c')](_0x28d460['query'][_0x85f9('0x7c')]));_0x502a0a[_0x85f9('0x7d')]=_0x502a0a['attributes'][_0x85f9('0x35')]?_0x502a0a['attributes']:_0x5ed7c4['model'];if(!_0x28d460[_0x85f9('0x22')][_0x85f9('0x31')]('nolimit')){_0x502a0a[_0x85f9('0x13')]=qs[_0x85f9('0x13')](_0x28d460[_0x85f9('0x22')]['limit']);_0x502a0a['offset']=qs['offset'](_0x28d460[_0x85f9('0x22')][_0x85f9('0x15')]);}_0x502a0a[_0x85f9('0x93')]=qs['sort'](_0x28d460[_0x85f9('0x22')]['sort']);_0x502a0a[_0x85f9('0x5a')]=qs[_0x85f9('0x7a')](_[_0x85f9('0x7f')](_0x28d460[_0x85f9('0x22')],_0x5ed7c4[_0x85f9('0x7a')]));_0x502a0a[_0x85f9('0x5a')][_0x85f9('0x94')]=_0xa0fe57['id'];if(_0x28d460[_0x85f9('0x22')]['filter']){_0x502a0a[_0x85f9('0x5a')]=_[_0x85f9('0x81')](_0x502a0a[_0x85f9('0x5a')],{'$or':_[_0x85f9('0x6c')](_0x502a0a[_0x85f9('0x7d')],function(_0x278728){var _0x5e3025={};_0x5e3025[_0x278728]={'$like':'%'+_0x28d460['query'][_0x85f9('0x80')]+'%'};return _0x5e3025;})});}_0x502a0a=_['merge']({},_0x502a0a,_0x28d460[_0x85f9('0x95')]);return db[_0x85f9('0x39')][_0x85f9('0x14')]({'where':_0x502a0a['where']})[_0x85f9('0x18')](function(_0x2edb20){_0x2c446a['count']=_0x2edb20;if(_0x28d460[_0x85f9('0x22')][_0x85f9('0x96')]){_0x502a0a[_0x85f9('0x97')]=[{'all':!![]}];}return db[_0x85f9('0x39')][_0x85f9('0x21')](_0x502a0a);})[_0x85f9('0x18')](function(_0x1fd5e4){_0x2c446a[_0x85f9('0x98')]=_0x1fd5e4;return _0x2c446a;});}})[_0x85f9('0x18')](respondWithFilteredResult(_0x32ca0c,_0x502a0a))['catch'](handleError(_0x32ca0c,null));};exports[_0x85f9('0x99')]=function(_0x28d778,_0x20a41c){var _0x3c46bd={'raw':!![],'where':{}};var _0x3b8419={};var _0x1eb521={'count':0x0,'rows':[]};return db[_0x85f9('0x33')][_0x85f9('0x78')]({'where':{'id':_0x28d778['params']['id']}})['then'](handleEntityNotFound(_0x20a41c,null))['then'](function(_0x4bfad0){if(_0x4bfad0){_0x3b8419[_0x85f9('0x79')]=_[_0x85f9('0x26')](db[_0x85f9('0x9a')]['rawAttributes']);_0x3b8419[_0x85f9('0x22')]=_['keys'](_0x28d778['query']);_0x3b8419[_0x85f9('0x7a')]=_[_0x85f9('0x7b')](_0x3b8419[_0x85f9('0x79')],_0x3b8419['query']);_0x3c46bd[_0x85f9('0x7d')]=_[_0x85f9('0x7b')](_0x3b8419[_0x85f9('0x79')],qs[_0x85f9('0x7c')](_0x28d778['query']['fields']));_0x3c46bd[_0x85f9('0x7d')]=_0x3c46bd[_0x85f9('0x7d')][_0x85f9('0x35')]?_0x3c46bd[_0x85f9('0x7d')]:_0x3b8419['model'];if(!_0x28d778[_0x85f9('0x22')][_0x85f9('0x31')]('nolimit')){_0x3c46bd[_0x85f9('0x13')]=qs[_0x85f9('0x13')](_0x28d778[_0x85f9('0x22')][_0x85f9('0x13')]);_0x3c46bd['offset']=qs[_0x85f9('0x15')](_0x28d778[_0x85f9('0x22')]['offset']);}_0x3c46bd['order']=qs[_0x85f9('0x7e')](_0x28d778[_0x85f9('0x22')][_0x85f9('0x7e')]);_0x3c46bd['where']=qs[_0x85f9('0x7a')](_['pick'](_0x28d778[_0x85f9('0x22')],_0x3b8419['filters']));_0x3c46bd['where'][_0x85f9('0x94')]=_0x4bfad0['id'];if(_0x28d778[_0x85f9('0x22')]['filter']){_0x3c46bd[_0x85f9('0x5a')]=_[_0x85f9('0x81')](_0x3c46bd[_0x85f9('0x5a')],{'$or':_['map'](_0x3c46bd['attributes'],function(_0x35e6e4){var _0x50fc78={};_0x50fc78[_0x35e6e4]={'$like':'%'+_0x28d778[_0x85f9('0x22')][_0x85f9('0x80')]+'%'};return _0x50fc78;})});}_0x3c46bd=_['merge']({},_0x3c46bd,_0x28d778[_0x85f9('0x95')]);return db['CmHopperHistory']['count']({'where':_0x3c46bd[_0x85f9('0x5a')]})['then'](function(_0x3470ff){_0x1eb521[_0x85f9('0x14')]=_0x3470ff;if(_0x28d778['query'][_0x85f9('0x96')]){_0x3c46bd['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x85f9('0x21')](_0x3c46bd);})[_0x85f9('0x18')](function(_0x374a8d){_0x1eb521[_0x85f9('0x98')]=_0x374a8d;return _0x1eb521;});}})[_0x85f9('0x18')](respondWithFilteredResult(_0x20a41c,_0x3c46bd))[_0x85f9('0x24')](handleError(_0x20a41c,null));};exports[_0x85f9('0x9b')]=function(_0x402a1f,_0x19c9f1){var _0x156359={'raw':!![],'where':{}};var _0x4b70ae={};var _0x53b335={'count':0x0,'rows':[]};return db['CmContact'][_0x85f9('0x78')]({'where':{'id':_0x402a1f['params']['id']}})[_0x85f9('0x18')](handleEntityNotFound(_0x19c9f1,null))['then'](function(_0x40a988){if(_0x40a988){_0x4b70ae[_0x85f9('0x79')]=_['keys'](db['CmHopperFinal']['rawAttributes']);_0x4b70ae[_0x85f9('0x22')]=_[_0x85f9('0x26')](_0x402a1f[_0x85f9('0x22')]);_0x4b70ae['filters']=_['intersection'](_0x4b70ae[_0x85f9('0x79')],_0x4b70ae[_0x85f9('0x22')]);_0x156359['attributes']=_[_0x85f9('0x7b')](_0x4b70ae['model'],qs[_0x85f9('0x7c')](_0x402a1f[_0x85f9('0x22')]['fields']));_0x156359[_0x85f9('0x7d')]=_0x156359[_0x85f9('0x7d')][_0x85f9('0x35')]?_0x156359[_0x85f9('0x7d')]:_0x4b70ae[_0x85f9('0x79')];if(!_0x402a1f[_0x85f9('0x22')]['hasOwnProperty'](_0x85f9('0x82'))){_0x156359[_0x85f9('0x13')]=qs[_0x85f9('0x13')](_0x402a1f[_0x85f9('0x22')][_0x85f9('0x13')]);_0x156359[_0x85f9('0x15')]=qs[_0x85f9('0x15')](_0x402a1f[_0x85f9('0x22')][_0x85f9('0x15')]);}_0x156359[_0x85f9('0x93')]=qs[_0x85f9('0x7e')](_0x402a1f[_0x85f9('0x22')]['sort']);_0x156359[_0x85f9('0x5a')]=qs[_0x85f9('0x7a')](_[_0x85f9('0x7f')](_0x402a1f[_0x85f9('0x22')],_0x4b70ae[_0x85f9('0x7a')]));_0x156359[_0x85f9('0x5a')][_0x85f9('0x94')]=_0x40a988['id'];if(_0x402a1f[_0x85f9('0x22')][_0x85f9('0x80')]){_0x156359[_0x85f9('0x5a')]=_[_0x85f9('0x81')](_0x156359[_0x85f9('0x5a')],{'$or':_['map'](_0x156359[_0x85f9('0x7d')],function(_0x43f558){var _0x45f711={};_0x45f711[_0x43f558]={'$like':'%'+_0x402a1f[_0x85f9('0x22')][_0x85f9('0x80')]+'%'};return _0x45f711;})});}_0x156359=_[_0x85f9('0x81')]({},_0x156359,_0x402a1f[_0x85f9('0x95')]);return db['CmHopperFinal'][_0x85f9('0x14')]({'where':_0x156359['where']})[_0x85f9('0x18')](function(_0x53d818){_0x53b335[_0x85f9('0x14')]=_0x53d818;if(_0x402a1f['query'][_0x85f9('0x96')]){_0x156359[_0x85f9('0x97')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x85f9('0x21')](_0x156359);})[_0x85f9('0x18')](function(_0x41442b){_0x53b335['rows']=_0x41442b;return _0x53b335;});}})['then'](respondWithFilteredResult(_0x19c9f1,_0x156359))[_0x85f9('0x24')](handleError(_0x19c9f1,null));};exports[_0x85f9('0x9c')]=function(_0xfbc21d,_0xf2e939){var _0x2a34db={'raw':!![],'where':{}};var _0x15982f={};var _0x19c6d3={'count':0x0,'rows':[]};return db['CmContact'][_0x85f9('0x78')]({'where':{'id':_0xfbc21d[_0x85f9('0x65')]['id']}})[_0x85f9('0x18')](handleEntityNotFound(_0xf2e939,null))['then'](function(_0x375a1c){if(_0x375a1c){_0x15982f['model']=_[_0x85f9('0x26')](db[_0x85f9('0x4e')][_0x85f9('0x92')]);_0x15982f[_0x85f9('0x22')]=_[_0x85f9('0x26')](_0xfbc21d[_0x85f9('0x22')]);_0x15982f[_0x85f9('0x7a')]=_[_0x85f9('0x7b')](_0x15982f[_0x85f9('0x79')],_0x15982f['query']);_0x2a34db[_0x85f9('0x7d')]=_['intersection'](_0x15982f[_0x85f9('0x79')],qs[_0x85f9('0x7c')](_0xfbc21d[_0x85f9('0x22')][_0x85f9('0x7c')]));_0x2a34db[_0x85f9('0x7d')]=_0x2a34db[_0x85f9('0x7d')][_0x85f9('0x35')]?_0x2a34db[_0x85f9('0x7d')]:_0x15982f[_0x85f9('0x79')];if(!_0xfbc21d[_0x85f9('0x22')][_0x85f9('0x31')](_0x85f9('0x82'))){_0x2a34db[_0x85f9('0x13')]=qs['limit'](_0xfbc21d[_0x85f9('0x22')][_0x85f9('0x13')]);_0x2a34db[_0x85f9('0x15')]=qs[_0x85f9('0x15')](_0xfbc21d[_0x85f9('0x22')][_0x85f9('0x15')]);}_0x2a34db[_0x85f9('0x93')]=qs[_0x85f9('0x7e')](_0xfbc21d['query'][_0x85f9('0x7e')]);_0x2a34db[_0x85f9('0x5a')]=qs[_0x85f9('0x7a')](_[_0x85f9('0x7f')](_0xfbc21d[_0x85f9('0x22')],_0x15982f['filters']));_0x2a34db[_0x85f9('0x5a')]['ContactId']=_0x375a1c['id'];if(_0xfbc21d[_0x85f9('0x22')][_0x85f9('0x80')]){_0x2a34db[_0x85f9('0x5a')]=_[_0x85f9('0x81')](_0x2a34db[_0x85f9('0x5a')],{'$or':_[_0x85f9('0x6c')](_0x2a34db[_0x85f9('0x7d')],function(_0x4f7bdd){var _0x39b169={};_0x39b169[_0x4f7bdd]={'$like':'%'+_0xfbc21d[_0x85f9('0x22')]['filter']+'%'};return _0x39b169;})});}_0x2a34db=_[_0x85f9('0x81')]({},_0x2a34db,_0xfbc21d[_0x85f9('0x95')]);return db[_0x85f9('0x4e')][_0x85f9('0x14')]({'where':_0x2a34db[_0x85f9('0x5a')]})['then'](function(_0x253150){_0x19c6d3[_0x85f9('0x14')]=_0x253150;if(_0xfbc21d[_0x85f9('0x22')]['includeAll']){_0x2a34db['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x85f9('0x21')](_0x2a34db);})[_0x85f9('0x18')](function(_0xb006ee){_0x19c6d3[_0x85f9('0x98')]=_0xb006ee;return _0x19c6d3;});}})[_0x85f9('0x18')](respondWithFilteredResult(_0xf2e939,_0x2a34db))[_0x85f9('0x24')](handleError(_0xf2e939,null));};exports[_0x85f9('0x9d')]=function(_0x4bb839,_0x2a49bc){try{if(!_0x4bb839[_0x85f9('0x32')]['ListId']){throw new Error('No\x20ListId\x20specified');}if(!_0x4bb839[_0x85f9('0x32')][_0x85f9('0x9e')]){throw new Error(_0x85f9('0x9f'));}if(!_0x4bb839['body'][_0x85f9('0xa0')]){throw new Error(_0x85f9('0xa1'));}if(!_0x4bb839['body'][_0x85f9('0xa2')]){throw new Error(_0x85f9('0xa3'));}var _0x131a3c=_0x4bb839[_0x85f9('0x32')]['binding_keys'][_0x85f9('0xa4')](',');var _0x107b0b=_0x4bb839['body'][_0x85f9('0xa0')][_0x85f9('0xa4')](',');if(!_0x131a3c[_0x85f9('0x35')]||!_0x107b0b[_0x85f9('0x35')]||_0x131a3c[_0x85f9('0x35')]!==_0x107b0b[_0x85f9('0x35')]){throw new Error(_0x85f9('0xa5'));}_0x4bb839[_0x85f9('0x32')]['fields']=_[_0x85f9('0xa6')](_0x131a3c,_0x107b0b);if(!_0x4bb839[_0x85f9('0x32')][_0x85f9('0x7c')][_0x85f9('0x76')]){throw new Error(_0x85f9('0xa7'));}if(!_0x4bb839['body'][_0x85f9('0x7c')][_0x85f9('0xa8')]){throw new Error(_0x85f9('0xa9'));}var _0x200560=path[_0x85f9('0x52')](config[_0x85f9('0xaa')],_0x85f9('0xab'),_0x4bb839[_0x85f9('0xac')][_0x85f9('0xad')]);fs[_0x85f9('0xae')](_0x200560,parseInt(_0x85f9('0xaf'),0x8));var _0x252127=require(_0x85f9('0xb0'))[_0x85f9('0xb1')](path[_0x85f9('0x52')](__dirname,'../../components/import/cm/csv'),[_0x200560,_0x4bb839['body'][_0x85f9('0x9e')],_0x4bb839[_0x85f9('0x32')][_0x85f9('0xa0')],_0x4bb839[_0x85f9('0x32')][_0x85f9('0x5c')],_0x4bb839[_0x85f9('0x32')][_0x85f9('0xb2')],_0x4bb839[_0x85f9('0x32')][_0x85f9('0x59')],_0x4bb839[_0x85f9('0x32')][_0x85f9('0xa2')]]);return _0x2a49bc['status'](0xc8)[_0x85f9('0x11')]({'message':_0x85f9('0xb3'),'pid':_0x252127['pid']});}catch(_0x46711d){return _0x2a49bc[_0x85f9('0x10')](0x1f4)['send'](_0x46711d);}};exports['upload']=function(_0x48c127,_0x1a9c08){var _0x2143df=fs['createReadStream'](_0x48c127['file'][_0x85f9('0xb4')]);Papa['parse'](_0x2143df,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x5c3e90){return _0x1a9c08[_0x85f9('0x10')](0xc8)[_0x85f9('0x11')]({'file':_0x48c127[_0x85f9('0xac')],'fields':_0x5c3e90[_0x85f9('0xb5')][_0x85f9('0x7c')]});}});};exports[_0x85f9('0xb6')]=function(_0x2733d0,_0x12c375){return db[_0x85f9('0xb7')][_0x85f9('0x21')]({'raw':!![],'attributes':['id'],'where':{'role':_0x85f9('0xb8')}})[_0x85f9('0x18')](function(_0x364f6e){var _0xe4e89=![];if(!_0x2733d0[_0x85f9('0x32')][_0x85f9('0x5c')]){throw new Error(_0x85f9('0xb9'));}if(!_0x2733d0[_0x85f9('0x32')][_0x85f9('0xba')][_0x85f9('0x76')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x2733d0[_0x85f9('0x32')]['binding'][_0x85f9('0xa8')]){throw new Error(_0x85f9('0xa9'));}if(!_0x2733d0[_0x85f9('0x32')][_0x85f9('0xa2')]){throw new Error(_0x85f9('0xa3'));}var _0x3c4ab5=require(_0x85f9('0xb0'))[_0x85f9('0xb1')](path[_0x85f9('0x52')](__dirname,_0x85f9('0xbb')),[_0x2733d0[_0x85f9('0x65')]['id'],JSON['stringify'](_0x2733d0[_0x85f9('0x32')]),JSON[_0x85f9('0xbc')](_0x364f6e)]);_0x3c4ab5['on'](_0x85f9('0xbd'),function(){_0xe4e89=!![];return _0x12c375[_0x85f9('0x10')](0xc8)['json']({'message':_0x85f9('0xbe'),'pid':_0x3c4ab5[_0x85f9('0xbf')]});});_0x3c4ab5['on'](_0x85f9('0xc0'),function(_0x3836d9){if(_0x3836d9&&!_0xe4e89){return _0x12c375[_0x85f9('0x10')](0x1f4)[_0x85f9('0x11')]({'message':_0x85f9('0xc1'),'pid':_0x3c4ab5[_0x85f9('0xbf')]});}});})[_0x85f9('0x24')](handleError(_0x12c375,null));};exports[_0x85f9('0xc2')]=function(_0xdc48f0,_0x20c7ac){return db[_0x85f9('0xb7')][_0x85f9('0x21')]({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})[_0x85f9('0x18')](function(_0x11b7c3){var _0x38ef14=![];if(!_0xdc48f0[_0x85f9('0x32')][_0x85f9('0x5c')]){throw new Error(_0x85f9('0xb9'));}if(!_0xdc48f0[_0x85f9('0x32')]['binding'][_0x85f9('0x76')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0xdc48f0[_0x85f9('0x32')]['binding'][_0x85f9('0xa8')]){throw new Error(_0x85f9('0xa9'));}if(!_0xdc48f0[_0x85f9('0x32')][_0x85f9('0xa2')]){throw new Error(_0x85f9('0xa3'));}var _0x24002b=require(_0x85f9('0xb0'))[_0x85f9('0xb1')](path[_0x85f9('0x52')](__dirname,_0x85f9('0xc3')),[_0xdc48f0['params']['id'],JSON[_0x85f9('0xbc')](_0xdc48f0[_0x85f9('0x32')]),JSON[_0x85f9('0xbc')](_0x11b7c3)]);_0x24002b['on'](_0x85f9('0xbd'),function(){_0x38ef14=!![];return _0x20c7ac['status'](0xc8)[_0x85f9('0x11')]({'message':_0x85f9('0xbe'),'pid':_0x24002b[_0x85f9('0xbf')]});});_0x24002b['on'](_0x85f9('0xc0'),function(_0x577074){if(_0x577074&&!_0x38ef14){return _0x20c7ac[_0x85f9('0x10')](0x1f4)[_0x85f9('0x11')]({'message':_0x85f9('0xc1'),'pid':_0x24002b[_0x85f9('0xbf')]});}});})[_0x85f9('0x24')](handleError(_0x20c7ac,null));};exports[_0x85f9('0xc4')]=function(_0x441350,_0x54a115){var _0x5caeab=['mail',_0x85f9('0xc5'),_0x85f9('0xc6'),_0x85f9('0xc7'),_0x85f9('0xc8'),_0x85f9('0xc9'),_0x85f9('0xca')];var _0x1e5de6={'offset':0x0,'order':qs[_0x85f9('0x7e')](_0x85f9('0xcb'))},_0x10a213={'count':0x0,'rows':[]};Promise['resolve']()[_0x85f9('0x18')](function(){if(_0x441350[_0x85f9('0x22')]['channel']){if(!_[_0x85f9('0xcc')](_0x5caeab,_0x441350[_0x85f9('0x22')][_0x85f9('0xcd')][_0x85f9('0xce')]())){throw new Error('Invalid\x20channel');}_0x5caeab=[_0x441350[_0x85f9('0x22')][_0x85f9('0xcd')]['toLowerCase']()];}if(_0x441350[_0x85f9('0x22')][_0x85f9('0xcf')]){try{var _0x293d57=JSON['parse'](_0x441350[_0x85f9('0x22')][_0x85f9('0xcf')]);if(!moment(_0x293d57[_0x85f9('0x34')])[_0x85f9('0xd0')]()){throw new Error(_0x85f9('0xd1'));}if(!moment(_0x293d57['to'])[_0x85f9('0xd0')]()){throw new Error('Invalid\x20date\x20for\x20range\x20to\x20filter');}}catch(_0x2ed1ca){throw new Error('Invalid\x20createdAt\x20filter');}}if(!_0x441350[_0x85f9('0x22')][_0x85f9('0x31')]('nolimit')){_0x1e5de6[_0x85f9('0x13')]=qs['limit'](_0x441350['query'][_0x85f9('0x13')]||0xa);_0x1e5de6['offset']=qs[_0x85f9('0x15')](_0x441350['query'][_0x85f9('0x15')]);}var _0xa81b0d=_0x5caeab['map'](function(_0x1fe203){if(_0x1fe203===_0x85f9('0xca')){var _0x5cb60f={'attributes':['id','uniqueid',_0x85f9('0xd2'),_0x85f9('0xd3'),_0x85f9('0xd4'),_0x85f9('0xd5'),'starttime',_0x85f9('0xd6'),'duration',_0x85f9('0xd7'),_0x85f9('0xd8'),_0x85f9('0xd9'),_0x85f9('0xda'),_0x85f9('0xdb'),_0x85f9('0xdc')],'where':{'ContactId':_0x441350[_0x85f9('0x65')]['id']},'include':[{'model':db['User'],'as':_0x85f9('0xb7'),'attributes':['id',_0x85f9('0x1e'),'fullname',_0x85f9('0x2c')]}],'order':[[_0x85f9('0xd8'),_0x85f9('0xdd')]]};if(_0x441350['query'][_0x85f9('0xcf')]){_0x5cb60f[_0x85f9('0x5a')][_0x85f9('0xd8')]={'$gte':_0x293d57[_0x85f9('0x34')],'$lte':_0x293d57['to']};}return db['VoiceCallReport'][_0x85f9('0xde')](_0x5cb60f)[_0x85f9('0x18')](function(_0x3f2ee5){_0x10a213[_0x85f9('0x14')]+=_0x3f2ee5[_0x85f9('0x14')];return _[_0x85f9('0x6c')](_0x3f2ee5['rows'],function(_0x4530ef){var _0x1c2523=_0x4530ef['get']({'plain':!![]});_0x1c2523[_0x85f9('0xcd')]=_0x1fe203;if(_0x1c2523[_0x85f9('0xb7')]){_0x1c2523[_0x85f9('0xb7')]={'id':_0x1c2523[_0x85f9('0xb7')]['id'],'name':_0x1c2523[_0x85f9('0xb7')][_0x85f9('0x1e')],'fullname':_0x1c2523['User'][_0x85f9('0xdf')],'alias':_0x1c2523['User'][_0x85f9('0x2c')]};}return _0x1c2523;});});}else{var _0x24c2ba=_[_0x85f9('0xe0')](_0x1fe203)+(_0x1fe203==='chat'?'Website':'Account');var _0x2fb110={'attributes':['id',_0x85f9('0xe1'),_0x85f9('0xe2'),_0x85f9('0xd8'),_0x85f9('0xd7'),'disposition',_0x85f9('0xe3'),_0x85f9('0xe4'),'UserId',_0x24c2ba+'Id'],'where':{'ContactId':_0x441350['params']['id']},'include':[{'model':db[_0x24c2ba],'as':'Account','attributes':['id',_0x85f9('0x1e'),_0x85f9('0xe5')]},{'model':db[_0x85f9('0xb7')],'as':'Owner','attributes':['id',_0x85f9('0x1e'),'fullname']},{'model':db[_0x85f9('0xe6')],'as':_0x85f9('0xe7'),'attributes':['id',_0x85f9('0x1e'),_0x85f9('0x61')],'through':{'attributes':[]}}],'order':[[_0x85f9('0xd8'),'DESC']]};if(_0x441350[_0x85f9('0x22')][_0x85f9('0xcf')]){_0x2fb110['where']['createdAt']={'$gte':_0x293d57[_0x85f9('0x34')],'$lte':_0x293d57['to']};}switch(_0x1fe203){case _0x85f9('0xc5'):_0x2fb110[_0x85f9('0x7d')][_0x85f9('0x5b')]('browserName',_0x85f9('0xe8'),_0x85f9('0xe9'),_0x85f9('0xea'),'osName',_0x85f9('0xeb'),_0x85f9('0xec'),_0x85f9('0xed'),_0x85f9('0xee'));break;case _0x85f9('0xef'):_0x2fb110[_0x85f9('0x7d')][_0x85f9('0x5b')](_0x85f9('0xf0'),_0x85f9('0xf1'));break;case _0x85f9('0xc7'):_0x2fb110[_0x85f9('0x7d')][_0x85f9('0x5b')]('externalUrl','threadId');break;}return db[_['startCase'](_0x1fe203)+_0x85f9('0xf2')][_0x85f9('0xde')](_0x2fb110)[_0x85f9('0x18')](function(_0x1f584b){_0x10a213['count']+=_0x1f584b[_0x85f9('0x14')];return _[_0x85f9('0x6c')](_0x1f584b[_0x85f9('0x98')],function(_0x276334){var _0x59f36e=_0x276334[_0x85f9('0x36')]({'plain':!![]});_0x59f36e[_0x85f9('0xcd')]=_0x1fe203;if(_0x59f36e['Owner']){_0x59f36e[_0x85f9('0xf3')]={'id':_0x59f36e['Owner']['id'],'name':_0x59f36e[_0x85f9('0xf3')]['name'],'fullname':_0x59f36e[_0x85f9('0xf3')][_0x85f9('0xdf')]};}return _0x59f36e;});});}});return Promise[_0x85f9('0x5e')](_0xa81b0d);})[_0x85f9('0x18')](function(_0x21d0d5){return _(_0x21d0d5)[_0x85f9('0xf4')]()[_0x85f9('0xf5')]('createdAt')[_0x85f9('0xf6')]()['value']();})[_0x85f9('0x18')](function(_0xc64960){_0x10a213[_0x85f9('0x98')]=_0x1e5de6[_0x85f9('0x13')]?_0xc64960['slice'](_0x1e5de6['offset'],_0x1e5de6[_0x85f9('0x15')]+_0x1e5de6[_0x85f9('0x13')]):_0xc64960;return _0x10a213;})['then'](respondWithFilteredResult(_0x54a115,_0x1e5de6))[_0x85f9('0x24')](handleError(_0x54a115,null));}; \ No newline at end of file +var _0xcd9b=['contact\x20phone\x20exists','CmHopper','item','PHONE','sequelize','literal','CmHopperId','ItemType.OrderBy','CmHopperAdditionalPhone','getAdditionalPhones','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','hopperId','getHoppers','pick','ContactId','includeAll','include','nolimit','rows','getJscriptySessions','uploadCsv','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','0777','child_process','fork','../../components/import/cm/csv','binding_keys','CompanyId','File\x20uploaded\x20correctly!','pid','upload','createReadStream','parse','meta','import','User','agent','No\x20ListId\x20specified','../../components/import/cm/csv2','stringify','start\x20child\x20process\x20correctly!','error\x20child\x20process','importUpdates','binding','getJourney','sms','openchannel','fax','voice','resolve','channel','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20createdAt\x20filter','source','destination','starttime','duration','note','createdAt','userDisposition','userThirdDisposition','UserId','fullname','DESC','startCase','chat','Website','closed','secondDisposition','thirdDisposition','Account','key','Owner','Tags','browserName','customerIp','deviceModel','ratingMessage','ratingType','ratingValue','mail','substatus','externalUrl','threadId','Interaction','findAndCountAll','reverse','slice','moment','bluebird','util','path','lodash','ioredis','../../components/contacts','../../components/parsers/qs','api','../../config/environment/shared','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','status','json','offset','undefined','count','limit','set','Content-Range','then','destroy','end','sendStatus','error','name','index','describe','getOptions','findAll','query','user','catch','CmContact','params','tags','keys','length','startsWith','cf_','columnName','displayName','CmCustomField','alias','custom','type','info','forEach','hasOwnProperty','merge','body','from','get','isArray','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','ChatMessage','ChatOfflineMessage','MailMessage','MailInteraction','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','isNil','dialTimezone','timezones','utcOffset','additionalPhones','duplicates','where','$or','push','ListId','findOrCreate','contact','find','Tag','tag','ItemType','Phones.OrderBy','$and','map','cf_%d','omit','pickBy','isEmpty','table','cm_contacts','setFields','id\x20=\x20?','toParam','text','values','phone','getTags','rawAttributes','filters','intersection','model','attributes','fields','order','sort','filter','options','setTags','findOne','setAdditionalPhones','all','ContactItemType','item_types','items','ItemTypeId','description','OrderBy'];(function(_0x4a8491,_0x5dd897){var _0x3c05b3=function(_0x2a7e6e){while(--_0x2a7e6e){_0x4a8491['push'](_0x4a8491['shift']());}};_0x3c05b3(++_0x5dd897);}(_0xcd9b,0x6c));var _0xbcd9=function(_0x21241e,_0x118d5f){_0x21241e=_0x21241e-0x0;var _0x225c31=_0xcd9b[_0x21241e];return _0x225c31;};'use strict';var moment=require(_0xbcd9('0x0'));var BPromise=require(_0xbcd9('0x1'));var util=require(_0xbcd9('0x2'));var path=require(_0xbcd9('0x3'));var fs=require('fs');var _=require(_0xbcd9('0x4'));var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0xbcd9('0x5'));var contacts=require(_0xbcd9('0x6'));var qs=require(_0xbcd9('0x7'));var logger=require('../../config/logger')(_0xbcd9('0x8'));var config=require('../../config/environment');var shared=require(_0xbcd9('0x9'));var db=require(_0xbcd9('0xa'))['db'];config[_0xbcd9('0xb')]=_[_0xbcd9('0xc')](config[_0xbcd9('0xb')],{'host':_0xbcd9('0xd'),'port':0x18eb});var socket=require(_0xbcd9('0xe'))(new Redis(config['redis']));require(_0xbcd9('0xf'))['register'](socket);function respondWithResult(_0x34de97,_0x1b2d5a){_0x1b2d5a=_0x1b2d5a||0xc8;return function(_0x2bd25e){if(_0x2bd25e){return _0x34de97[_0xbcd9('0x10')](_0x1b2d5a)[_0xbcd9('0x11')](_0x2bd25e);}};}function respondWithFilteredResult(_0x5e827e,_0x5b7ac5){return function(_0x18c330){if(_0x18c330){var _0x33dec3=typeof _0x5b7ac5[_0xbcd9('0x12')]==='undefined'&&typeof _0x5b7ac5['limit']===_0xbcd9('0x13');var _0x4c80a3=_0x18c330['count'];var _0x326b65=_0x33dec3?0x0:_0x5b7ac5['offset'];var _0x41a7e5=_0x33dec3?_0x18c330[_0xbcd9('0x14')]:_0x5b7ac5[_0xbcd9('0x12')]+_0x5b7ac5[_0xbcd9('0x15')];var _0x32e0ef;if(_0x41a7e5>=_0x4c80a3){_0x41a7e5=_0x4c80a3;_0x32e0ef=0xc8;}else{_0x32e0ef=0xce;}_0x5e827e['status'](_0x32e0ef);return _0x5e827e[_0xbcd9('0x16')](_0xbcd9('0x17'),_0x326b65+'-'+_0x41a7e5+'/'+_0x4c80a3)['json'](_0x18c330);}return null;};}function saveUpdates(_0x234395){return function(_0x1c4ca1){if(_0x1c4ca1){return _0x1c4ca1['update'](_0x234395)[_0xbcd9('0x18')](function(_0x27a227){return _0x27a227;});}return null;};}function removeEntity(_0x425dcc){return function(_0x23b9ba){if(_0x23b9ba){return _0x23b9ba[_0xbcd9('0x19')]()['then'](function(){_0x425dcc['status'](0xcc)[_0xbcd9('0x1a')]();});}};}function handleEntityNotFound(_0xb93db8){return function(_0x5be3b0){if(!_0x5be3b0){_0xb93db8[_0xbcd9('0x1b')](0x194);}return _0x5be3b0;};}function handleError(_0x3511c5,_0x4adfbf){_0x4adfbf=_0x4adfbf||0x1f4;return function(_0x2f8b55){logger[_0xbcd9('0x1c')](_0x2f8b55['stack']);if(_0x2f8b55[_0xbcd9('0x1d')]){delete _0x2f8b55[_0xbcd9('0x1d')];}_0x3511c5['status'](_0x4adfbf)['send'](_0x2f8b55);};}exports[_0xbcd9('0x1e')]=function(_0x1de82a,_0xbb551c){var _0x3c0a9e={};return contacts[_0xbcd9('0x1f')]()[_0xbcd9('0x18')](function(_0x328aff){_0x3c0a9e=qs[_0xbcd9('0x20')](_0x328aff,_0x1de82a);return contacts[_0xbcd9('0x21')](_0x1de82a[_0xbcd9('0x22')],_0x1de82a[_0xbcd9('0x23')],_0x3c0a9e,_0x328aff);})[_0xbcd9('0x18')](respondWithFilteredResult(_0xbb551c,_0x3c0a9e))[_0xbcd9('0x24')](handleError(_0xbb551c,null));};exports[_0xbcd9('0x19')]=function(_0x3e74ec,_0x58ad47){return db[_0xbcd9('0x25')]['find']({'where':{'id':_0x3e74ec[_0xbcd9('0x26')]['id']}})['then'](handleEntityNotFound(_0x58ad47,null))[_0xbcd9('0x18')](removeEntity(_0x58ad47,null))[_0xbcd9('0x24')](handleError(_0x58ad47,null));};exports[_0xbcd9('0x1f')]=function(_0x3c8da7,_0x2b3ca3){return db['CmContact'][_0xbcd9('0x1f')]()[_0xbcd9('0x18')](function(_0x1bc150){delete _0x1bc150[_0xbcd9('0x27')];for(var _0x52c065=0x0;_0x52c0650x0){return new Promise(function(_0x578785){var _0x361f78=[];for(var _0x329bd9=0x0;_0x329bd9<_0x53a0ab[_0xbcd9('0x29')];_0x329bd9++){_0x361f78[_0xbcd9('0x62')](insertAdditionalPhones(_0x53a0ab[_0x329bd9][_0xbcd9('0x65')],_0x53a0ab[_0x329bd9][_0xbcd9('0x5e')]));}Promise['all'](_0x361f78)[_0xbcd9('0x18')](function(){_0x578785(0x1);});})['then'](function(){return{'success':_0x51e189,'failure':_0x9fcbba,'duplicates':_0x121959};});}else{return{'success':_0x51e189,'failure':_0x9fcbba,'duplicates':_0x121959};}}})['then'](respondWithResult(_0x496b3b,0xc9))[_0xbcd9('0x24')](handleError(_0x496b3b,null));};exports['show']=function(_0x1738b3,_0x272230){var _0x1394f5;return db['CmContact'][_0xbcd9('0x1f')]()[_0xbcd9('0x18')](function(_0x4781ae){return db[_0xbcd9('0x25')][_0xbcd9('0x66')]({'where':{'id':_0x1738b3['params']['id']},'include':[{'model':db[_0xbcd9('0x67')],'as':'Tags','attributes':['id','name','color'],'required':_0x1738b3[_0xbcd9('0x22')][_0xbcd9('0x68')]?!![]:![]},{'model':db[_0xbcd9('0x4c')],'as':'Phones','where':{'CmContactId':_0x1738b3[_0xbcd9('0x26')]['id']},'required':![],'include':[{'model':db['ContactItemType'],'as':_0xbcd9('0x69')}]}],'order':[db['sequelize']['literal'](_0xbcd9('0x6a'))],'attributes':_[_0xbcd9('0x28')](_0x4781ae)});})[_0xbcd9('0x18')](function(_0x220031){if(!_[_0xbcd9('0x5a')](_0x220031)){_0x1394f5=_0x220031[_0xbcd9('0x38')]({'plain':!![]});var _0x58ca9a={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x220031&&_0x220031['ListId']){if(_0x220031['ListId']){_0x58ca9a[_0xbcd9('0x60')][_0xbcd9('0x6b')]['push']({'ListId':{'$ne':_0x220031['ListId']}});}}return db[_0xbcd9('0x2e')][_0xbcd9('0x21')](_0x58ca9a);}})[_0xbcd9('0x18')](function(_0x575eb4){if(!_['isNil'](_0x575eb4)){return _['omit'](_0x1394f5,_[_0xbcd9('0x6c')](_0x575eb4,function(_0x3f50f8){return util['format'](_0xbcd9('0x6d'),_0x3f50f8['id']);}));}})[_0xbcd9('0x18')](handleEntityNotFound(_0x272230,null))[_0xbcd9('0x18')](respondWithResult(_0x272230,null))['catch'](handleError(_0x272230,null));};exports['update']=function(_0x4ad3e3,_0x22a723){var _0x4d8d34;if(_0x4ad3e3['body']['id']){delete _0x4ad3e3[_0xbcd9('0x36')]['id'];}if(!_[_0xbcd9('0x5a')](_0x4ad3e3['body'][_0xbcd9('0x5b')])){var _0x2c2403=_0x4ad3e3[_0xbcd9('0x36')][_0xbcd9('0x5b')];if(!_[_0xbcd9('0x5a')](shared[_0xbcd9('0x5c')][_0x2c2403]))_0x4ad3e3[_0xbcd9('0x36')]['utcOffset']=shared['timezones'][_0x2c2403]['utcOffset'];}return db[_0xbcd9('0x25')][_0xbcd9('0x66')]({'where':{'id':_0x4ad3e3[_0xbcd9('0x26')]['id']}})[_0xbcd9('0x18')](handleEntityNotFound(_0x22a723,null))[_0xbcd9('0x18')](saveUpdates(_0x4ad3e3[_0xbcd9('0x36')],null))[_0xbcd9('0x18')](function(_0x15654e){_0x4d8d34=_0x15654e;var _0x129279={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x15654e&&_0x15654e[_0xbcd9('0x63')]){if(_0x15654e['ListId']){_0x129279[_0xbcd9('0x60')][_0xbcd9('0x6b')]['push']({'ListId':{'$ne':_0x15654e[_0xbcd9('0x63')]}});}}return db[_0xbcd9('0x2e')]['findAll'](_0x129279);})[_0xbcd9('0x18')](function(_0xe20d15){if(_0xe20d15){return _[_0xbcd9('0x6e')](_[_0xbcd9('0x6f')](_0x4ad3e3[_0xbcd9('0x36')],function(_0x4cd36d,_0xbc88d5){return _[_0xbcd9('0x2a')](_0xbc88d5,_0xbcd9('0x2b'));}),_[_0xbcd9('0x6c')](_0xe20d15,function(_0x3744fa){return util['format'](_0xbcd9('0x6d'),_0x3744fa['id']);}));}})['then'](function(_0x1b9617){if(_0x1b9617&&!_[_0xbcd9('0x70')](_0x1b9617)){var _0xbe5459=squel['update']()[_0xbcd9('0x71')](_0xbcd9('0x72'))[_0xbcd9('0x73')](_0x1b9617)[_0xbcd9('0x60')](_0xbcd9('0x74'),_0x4ad3e3[_0xbcd9('0x26')]['id'])[_0xbcd9('0x75')]();return db['sequelize'][_0xbcd9('0x22')](_0xbe5459[_0xbcd9('0x76')],{'replacements':_0xbe5459[_0xbcd9('0x77')]});}})[_0xbcd9('0x18')](function(){if(_0x4ad3e3['body'][_0xbcd9('0x78')]&&_0x4d8d34){return db['CmHopper'][_0xbcd9('0x41')]({'phone':_0x4ad3e3['body'][_0xbcd9('0x78')],'OrderBy':0x0},{'where':{'ContactId':_0x4d8d34['id']}});}})[_0xbcd9('0x18')](function(){return _0x4d8d34;})['then'](respondWithResult(_0x22a723,null))[_0xbcd9('0x24')](handleError(_0x22a723,null));};exports[_0xbcd9('0x79')]=function(_0x12a57d,_0x41aeeb){var _0x38bef2={};var _0x28fc17={};var _0x17a4e6;var _0x6fdb6d;return db[_0xbcd9('0x25')]['findOne']({'where':{'id':_0x12a57d['params']['id']}})[_0xbcd9('0x18')](handleEntityNotFound(_0x41aeeb,null))[_0xbcd9('0x18')](function(_0x4b9049){if(_0x4b9049){_0x17a4e6=_0x4b9049;_0x28fc17['model']=_['keys'](db['Tag'][_0xbcd9('0x7a')]);_0x28fc17[_0xbcd9('0x22')]=_[_0xbcd9('0x28')](_0x12a57d['query']);_0x28fc17[_0xbcd9('0x7b')]=_[_0xbcd9('0x7c')](_0x28fc17[_0xbcd9('0x7d')],_0x28fc17[_0xbcd9('0x22')]);_0x38bef2[_0xbcd9('0x7e')]=_[_0xbcd9('0x7c')](_0x28fc17[_0xbcd9('0x7d')],qs[_0xbcd9('0x7f')](_0x12a57d['query']['fields']));_0x38bef2[_0xbcd9('0x7e')]=_0x38bef2[_0xbcd9('0x7e')][_0xbcd9('0x29')]?_0x38bef2[_0xbcd9('0x7e')]:_0x28fc17[_0xbcd9('0x7d')];_0x38bef2[_0xbcd9('0x80')]=qs[_0xbcd9('0x81')](_0x12a57d['query'][_0xbcd9('0x81')]);_0x38bef2[_0xbcd9('0x60')]=qs[_0xbcd9('0x7b')](_['pick'](_0x12a57d[_0xbcd9('0x22')],_0x28fc17[_0xbcd9('0x7b')]));if(_0x12a57d[_0xbcd9('0x22')][_0xbcd9('0x82')]){_0x38bef2['where']=_[_0xbcd9('0x35')](_0x38bef2[_0xbcd9('0x60')],{'$or':_['map'](_0x38bef2[_0xbcd9('0x7e')],function(_0x4994af){var _0x2c0105={};_0x2c0105[_0x4994af]={'$like':'%'+_0x12a57d['query'][_0xbcd9('0x82')]+'%'};return _0x2c0105;})});}_0x38bef2=_[_0xbcd9('0x35')]({},_0x38bef2,_0x12a57d[_0xbcd9('0x83')]);return _0x17a4e6[_0xbcd9('0x79')](_0x38bef2);}})['then'](function(_0x2be1b5){if(_0x2be1b5){_0x6fdb6d=_0x2be1b5['length'];if(!_0x12a57d[_0xbcd9('0x22')]['hasOwnProperty']('nolimit')){_0x38bef2[_0xbcd9('0x15')]=qs[_0xbcd9('0x15')](_0x12a57d[_0xbcd9('0x22')][_0xbcd9('0x15')]);_0x38bef2['offset']=qs[_0xbcd9('0x12')](_0x12a57d['query']['offset']);}return _0x17a4e6[_0xbcd9('0x79')](_0x38bef2);}})[_0xbcd9('0x18')](function(_0x4eb0d7){if(_0x4eb0d7){return _0x4eb0d7?{'count':_0x6fdb6d,'rows':_0x4eb0d7}:null;}})[_0xbcd9('0x18')](respondWithResult(_0x41aeeb,null))[_0xbcd9('0x24')](handleError(_0x41aeeb,null));};exports[_0xbcd9('0x84')]=function(_0x1eadf9,_0x300cf2){if(_0x1eadf9[_0xbcd9('0x36')]['id']){delete _0x1eadf9[_0xbcd9('0x36')]['id'];}return db[_0xbcd9('0x25')][_0xbcd9('0x85')]({'where':{'id':_0x1eadf9[_0xbcd9('0x26')]['id']}})['then'](handleEntityNotFound(_0x300cf2,null))['then'](function(_0x15e04a){if(_0x15e04a){return _0x15e04a['setTags'](_0x1eadf9[_0xbcd9('0x36')]['ids']||[]);}return null;})['then'](respondWithResult(_0x300cf2,null))[_0xbcd9('0x24')](handleError(_0x300cf2,null));};exports[_0xbcd9('0x86')]=function(_0x493e29,_0x42fb87){var _0x2c242d=[];_0x2c242d[_0xbcd9('0x62')](addAdditionalPhones(_0x493e29[_0xbcd9('0x36')]));Promise[_0xbcd9('0x87')](_0x2c242d)[_0xbcd9('0x18')](function(){_0x2c242d=[];_0x2c242d[_0xbcd9('0x62')](deleteCmHopperPhones(_0x493e29[_0xbcd9('0x36')]['id']));_0x2c242d[_0xbcd9('0x62')](addCmHopperPhones(_0x493e29[_0xbcd9('0x36')]['id']));Promise['all'](_0x2c242d)[_0xbcd9('0x18')](function(){return[0x1];})[_0xbcd9('0x18')](respondWithResult(_0x42fb87,null));});};function addAdditionalPhones(_0x3d3a3b){var _0x337f94;return new Promise(function(_0x1fc584){return db['CmContactHasItem'][_0xbcd9('0x19')]({'where':{'CmContactId':_0x3d3a3b['id']}})[_0xbcd9('0x18')](function(){db[_0xbcd9('0x88')]['findAll']({'raw':!![],'attributes':['id','OrderBy']})[_0xbcd9('0x18')](function(_0x20db31){var _0x12438d=[];for(var _0x4b6a66=0x0;_0x4b6a66<_0x3d3a3b['items'][_0xbcd9('0x29')];_0x4b6a66++){var _0x3e115d=_0x3d3a3b[_0xbcd9('0x89')]?_[_0xbcd9('0x5a')](_0x3d3a3b[_0xbcd9('0x89')][_0x4b6a66])?'':_0x3d3a3b[_0xbcd9('0x89')][_0x4b6a66]:_0x3d3a3b[_0xbcd9('0x8a')][_0x4b6a66][_0xbcd9('0x8b')]?_0x3d3a3b['items'][_0x4b6a66][_0xbcd9('0x8b')]:'';var _0xdda2cc=_[_0xbcd9('0x5a')](_0x3d3a3b[_0xbcd9('0x8a')][_0x4b6a66][_0xbcd9('0x8c')])?'':_0x3d3a3b[_0xbcd9('0x8a')][_0x4b6a66]['description'];var _0xc1fb14=_0x3e115d+':'+_0x3d3a3b[_0xbcd9('0x8a')][_0x4b6a66]['phone']+'§'+_0xdda2cc;if(_[_0xbcd9('0x5a')](_0x337f94))_0x337f94=_0xc1fb14;else _0x337f94+=';'+_0xc1fb14;var _0x205a2f=null;var _0x13aa25=null;if(_0x3d3a3b[_0xbcd9('0x89')]){if(!_[_0xbcd9('0x5a')](_0x3d3a3b[_0xbcd9('0x89')][_0x4b6a66])){_0x13aa25=_[_0xbcd9('0x66')](_0x20db31,function(_0x3b5f6c){return _0x3b5f6c['id']===_0x3d3a3b[_0xbcd9('0x89')][_0x4b6a66];});if(!_[_0xbcd9('0x5a')](_0x13aa25)){_0x205a2f=_0x13aa25[_0xbcd9('0x8d')];}}}else{if(!_['isNil'](_0x3d3a3b[_0xbcd9('0x8a')][_0x4b6a66])){_0x13aa25=_[_0xbcd9('0x66')](_0x20db31,function(_0x48d71b){return _0x48d71b['id']===_0x3d3a3b[_0xbcd9('0x8a')][_0x4b6a66][_0xbcd9('0x8b')];});if(!_[_0xbcd9('0x5a')](_0x13aa25)){_0x205a2f=_0x4b6a66;}}}if(_[_0xbcd9('0x5a')](_0x205a2f)){_0x205a2f=0x64;}_0x12438d[_0xbcd9('0x62')](addAdditionalPhone(_0x3d3a3b['id'],_0x3d3a3b['items'][_0x4b6a66]['phone'],_0x3d3a3b['item_types']?_['isNil'](_0x3d3a3b['item_types'][_0x4b6a66])?null:_0x3d3a3b[_0xbcd9('0x89')][_0x4b6a66]:_0x3d3a3b[_0xbcd9('0x8a')][_0x4b6a66][_0xbcd9('0x8b')]?_0x3d3a3b[_0xbcd9('0x8a')][_0x4b6a66][_0xbcd9('0x8b')]:null,_0x205a2f,_0xdda2cc));}Promise[_0xbcd9('0x87')](_0x12438d)[_0xbcd9('0x18')](function(){db[_0xbcd9('0x25')][_0xbcd9('0x41')]({'AdditionalPhones':_0x337f94},{'where':{'id':_0x3d3a3b['id']}})[_0xbcd9('0x18')](function(){_0x1fc584(0x1);});});});});});}function addAdditionalPhone(_0x4ea992,_0x2c85a7,_0x10640b,_0x241dd0,_0x5f5bbb){return db[_0xbcd9('0x4c')][_0xbcd9('0x66')]({'where':{'CmContactId':_0x4ea992,'item':_0x2c85a7}})[_0xbcd9('0x18')](function(_0x30243e){if(_0x30243e)logger[_0xbcd9('0x32')](_0xbcd9('0x8e'),_0x30243e);else{db[_0xbcd9('0x4c')]['create']({'CmContactId':_0x4ea992,'item':_0x2c85a7,'ItemTypeId':_0x10640b,'OrderBy':_0x241dd0,'ItemClass':'PHONE','description':_0x5f5bbb});}});}function deleteCmHopperPhones(_0x4c5cee){return new Promise(function(_0x2a87cb){return db['CmHopper'][_0xbcd9('0x21')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x4c5cee}})['then'](function(_0xb52500){db['CmHopperAdditionalPhone'][_0xbcd9('0x19')]({'where':{'CmHopperId':{'$in':_['map'](_0xb52500,'id')}}});})[_0xbcd9('0x18')](function(){_0x2a87cb(0x1);});});}function addCmHopperPhones(_0x2ce382){return new Promise(function(_0x4fb0b7){return db[_0xbcd9('0x8f')][_0xbcd9('0x21')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x2ce382}})[_0xbcd9('0x18')](function(_0x2f3416){var _0x5a853c=[];_[_0xbcd9('0x6c')](_0x2f3416,function(_0x5901c9){_0x5a853c[_0xbcd9('0x62')](createCmHopperPhone(_0x2ce382,_0x5901c9['id']));});Promise['all'](_0x5a853c)[_0xbcd9('0x18')](function(){_0x4fb0b7(0x1);});});});}function createCmHopperPhone(_0x57a5ff,_0x160762){return new Promise(function(_0x346356){db[_0xbcd9('0x4c')][_0xbcd9('0x21')]({'raw':!![],'attributes':[_0xbcd9('0x90'),_0xbcd9('0x8d')],'where':{'CmContactId':_0x57a5ff,'ItemClass':_0xbcd9('0x91')},'include':[{'model':db[_0xbcd9('0x88')],'attributes':[_0xbcd9('0x8d')],'as':_0xbcd9('0x69')}],'order':[_0xbcd9('0x8d'),db[_0xbcd9('0x92')][_0xbcd9('0x93')]('`ItemType`.OrderBy')]})[_0xbcd9('0x18')](function(_0x2a3d25){var _0xea4e47=0x1;var _0x3737d2=_['map'](_0x2a3d25,function(_0x1d9b33){_0x1d9b33[_0xbcd9('0x94')]=_0x160762;_0x1d9b33['phone']=_0x1d9b33[_0xbcd9('0x90')];_0x1d9b33['OrderBy']=_0xea4e47;delete _0x1d9b33[_0xbcd9('0x95')];_0xea4e47=_0xea4e47+0x1;return _0x1d9b33;});return db[_0xbcd9('0x96')]['bulkCreate'](_0x3737d2,{});})['then'](function(){_0x346356(0x1);});});}function insertAdditionalPhones(_0x5a01f7,_0x503898){return new Promise(function(_0x57c0e7){var _0x4c9a87=[];for(var _0x1e1836=0x0;_0x1e1836<_0x503898['length'];_0x1e1836++){var _0x4d5c14=_0x503898[_0x1e1836];_0x4c9a87[_0xbcd9('0x62')](parseContactItemType(_0x4d5c14));}Promise['all'](_0x4c9a87)[_0xbcd9('0x18')](function(){var _0x2c80ec={'id':_0x5a01f7['id'],'items':_0x503898};return addAdditionalPhones(_0x2c80ec)['then'](function(){return addCmHopperPhones(_0x5a01f7['id']);});})[_0xbcd9('0x18')](function(){_0x57c0e7(_0x5a01f7);});});}function parseContactItemType(_0x764f69){return new Promise(function(_0x2f139b){if(_0x764f69[_0xbcd9('0x34')]('ItemTypeId')){_0x2f139b(_0x764f69);}else{return db[_0xbcd9('0x88')][_0xbcd9('0x66')]({'where':{'name':_0x764f69[_0xbcd9('0x69')]}})['then'](function(_0x5be25c){if(_[_0xbcd9('0x5a')](_0x5be25c))_0x764f69[_0xbcd9('0x8b')]=null;else _0x764f69['ItemTypeId']=_0x5be25c['id'];_0x2f139b(_0x764f69);});}});}exports[_0xbcd9('0x97')]=function(_0x1129c5,_0x510751){return db[_0xbcd9('0x4c')][_0xbcd9('0x21')]({'raw':!![],'where':{'CmContactId':_0x1129c5[_0xbcd9('0x26')]['id'],'ItemClass':_0xbcd9('0x91')},'include':[{'model':db['ContactItemType'],'as':'ItemType'}],'order':[[_0xbcd9('0x8d')],[db[_0xbcd9('0x92')][_0xbcd9('0x93')]('`ItemType`.OrderBy')]]})[_0xbcd9('0x18')](function(_0x380cc2){return _0x380cc2;})['then'](respondWithResult(_0x510751,null))['catch'](handleError(_0x510751,null));};exports[_0xbcd9('0x98')]=function(_0xc8c27,_0x547b7b){return db[_0xbcd9('0x4c')][_0xbcd9('0x21')]({'raw':!![],'where':{'CmContactId':_0xc8c27[_0xbcd9('0x36')][_0xbcd9('0x99')]}})[_0xbcd9('0x18')](function(_0x43fbfb){var _0x3ce31d=_[_0xbcd9('0x6c')](_0x43fbfb,function(_0x27b807){_0x27b807[_0xbcd9('0x9a')]=_0xc8c27['body'][_0xbcd9('0x9b')];return _0x27b807;});return db['CmContactHasItem']['bulkCreate'](_0x3ce31d,{});})['then'](function(){return addCmHopperPhones(_0xc8c27['body'][_0xbcd9('0x9b')]);})[_0xbcd9('0x18')](function(){return['ok'];})[_0xbcd9('0x18')](respondWithResult(_0x547b7b,null))[_0xbcd9('0x24')](handleError(_0x547b7b,null));};exports['rescheduleAdditionalPhones']=function(_0x4deb46,_0xe32498){var _0x54e0b5=[];_0x54e0b5[_0xbcd9('0x62')](createCmHopperPhone(_0x4deb46['body']['id'],_0x4deb46[_0xbcd9('0x36')][_0xbcd9('0x9c')]));Promise['all'](_0x54e0b5)['then'](function(){return[0x1];})[_0xbcd9('0x18')](respondWithResult(_0xe32498,null));};exports[_0xbcd9('0x9d')]=function(_0x196108,_0x12719b){var _0xc970c4={'raw':![],'where':{}};var _0x398991={};var _0x297bbe={'count':0x0,'rows':[]};return db[_0xbcd9('0x25')][_0xbcd9('0x85')]({'where':{'id':_0x196108['params']['id']}})['then'](handleEntityNotFound(_0x12719b,null))[_0xbcd9('0x18')](function(_0x4b4fbf){if(_0x4b4fbf){_0x398991[_0xbcd9('0x7d')]=_[_0xbcd9('0x28')](db[_0xbcd9('0x8f')][_0xbcd9('0x7a')]);_0x398991['query']=_[_0xbcd9('0x28')](_0x196108[_0xbcd9('0x22')]);_0x398991['filters']=_[_0xbcd9('0x7c')](_0x398991[_0xbcd9('0x7d')],_0x398991[_0xbcd9('0x22')]);_0xc970c4[_0xbcd9('0x7e')]=_[_0xbcd9('0x7c')](_0x398991[_0xbcd9('0x7d')],qs[_0xbcd9('0x7f')](_0x196108[_0xbcd9('0x22')][_0xbcd9('0x7f')]));_0xc970c4[_0xbcd9('0x7e')]=_0xc970c4[_0xbcd9('0x7e')][_0xbcd9('0x29')]?_0xc970c4[_0xbcd9('0x7e')]:_0x398991[_0xbcd9('0x7d')];if(!_0x196108['query'][_0xbcd9('0x34')]('nolimit')){_0xc970c4[_0xbcd9('0x15')]=qs[_0xbcd9('0x15')](_0x196108['query'][_0xbcd9('0x15')]);_0xc970c4['offset']=qs[_0xbcd9('0x12')](_0x196108[_0xbcd9('0x22')][_0xbcd9('0x12')]);}_0xc970c4[_0xbcd9('0x80')]=qs[_0xbcd9('0x81')](_0x196108[_0xbcd9('0x22')]['sort']);_0xc970c4[_0xbcd9('0x60')]=qs[_0xbcd9('0x7b')](_[_0xbcd9('0x9e')](_0x196108[_0xbcd9('0x22')],_0x398991['filters']));_0xc970c4[_0xbcd9('0x60')][_0xbcd9('0x9f')]=_0x4b4fbf['id'];if(_0x196108[_0xbcd9('0x22')]['filter']){_0xc970c4['where']=_[_0xbcd9('0x35')](_0xc970c4[_0xbcd9('0x60')],{'$or':_[_0xbcd9('0x6c')](_0xc970c4[_0xbcd9('0x7e')],function(_0x15c533){var _0x1b53d5={};_0x1b53d5[_0x15c533]={'$like':'%'+_0x196108[_0xbcd9('0x22')]['filter']+'%'};return _0x1b53d5;})});}_0xc970c4=_['merge']({},_0xc970c4,_0x196108[_0xbcd9('0x83')]);return db[_0xbcd9('0x8f')]['count']({'where':_0xc970c4['where']})['then'](function(_0x8c0fbc){_0x297bbe[_0xbcd9('0x14')]=_0x8c0fbc;if(_0x196108['query'][_0xbcd9('0xa0')]){_0xc970c4[_0xbcd9('0xa1')]=[{'all':!![]}];}return db[_0xbcd9('0x8f')]['findAll'](_0xc970c4);})[_0xbcd9('0x18')](function(_0x149614){_0x297bbe['rows']=_0x149614;return _0x297bbe;});}})[_0xbcd9('0x18')](respondWithFilteredResult(_0x12719b,_0xc970c4))['catch'](handleError(_0x12719b,null));};exports['getHopperHistories']=function(_0x555ffe,_0x34493b){var _0x854027={'raw':!![],'where':{}};var _0x830a0f={};var _0x42284f={'count':0x0,'rows':[]};return db[_0xbcd9('0x25')][_0xbcd9('0x85')]({'where':{'id':_0x555ffe[_0xbcd9('0x26')]['id']}})['then'](handleEntityNotFound(_0x34493b,null))[_0xbcd9('0x18')](function(_0x2f35fc){if(_0x2f35fc){_0x830a0f[_0xbcd9('0x7d')]=_['keys'](db[_0xbcd9('0x4e')][_0xbcd9('0x7a')]);_0x830a0f[_0xbcd9('0x22')]=_[_0xbcd9('0x28')](_0x555ffe['query']);_0x830a0f[_0xbcd9('0x7b')]=_['intersection'](_0x830a0f[_0xbcd9('0x7d')],_0x830a0f[_0xbcd9('0x22')]);_0x854027[_0xbcd9('0x7e')]=_[_0xbcd9('0x7c')](_0x830a0f[_0xbcd9('0x7d')],qs[_0xbcd9('0x7f')](_0x555ffe[_0xbcd9('0x22')][_0xbcd9('0x7f')]));_0x854027[_0xbcd9('0x7e')]=_0x854027['attributes']['length']?_0x854027['attributes']:_0x830a0f['model'];if(!_0x555ffe[_0xbcd9('0x22')]['hasOwnProperty'](_0xbcd9('0xa2'))){_0x854027[_0xbcd9('0x15')]=qs[_0xbcd9('0x15')](_0x555ffe[_0xbcd9('0x22')][_0xbcd9('0x15')]);_0x854027['offset']=qs[_0xbcd9('0x12')](_0x555ffe[_0xbcd9('0x22')][_0xbcd9('0x12')]);}_0x854027['order']=qs['sort'](_0x555ffe[_0xbcd9('0x22')]['sort']);_0x854027['where']=qs[_0xbcd9('0x7b')](_[_0xbcd9('0x9e')](_0x555ffe['query'],_0x830a0f[_0xbcd9('0x7b')]));_0x854027[_0xbcd9('0x60')][_0xbcd9('0x9f')]=_0x2f35fc['id'];if(_0x555ffe[_0xbcd9('0x22')]['filter']){_0x854027[_0xbcd9('0x60')]=_[_0xbcd9('0x35')](_0x854027[_0xbcd9('0x60')],{'$or':_[_0xbcd9('0x6c')](_0x854027[_0xbcd9('0x7e')],function(_0x4cc4dc){var _0x479c55={};_0x479c55[_0x4cc4dc]={'$like':'%'+_0x555ffe[_0xbcd9('0x22')]['filter']+'%'};return _0x479c55;})});}_0x854027=_[_0xbcd9('0x35')]({},_0x854027,_0x555ffe[_0xbcd9('0x83')]);return db[_0xbcd9('0x4e')][_0xbcd9('0x14')]({'where':_0x854027[_0xbcd9('0x60')]})[_0xbcd9('0x18')](function(_0x123b76){_0x42284f[_0xbcd9('0x14')]=_0x123b76;if(_0x555ffe[_0xbcd9('0x22')][_0xbcd9('0xa0')]){_0x854027[_0xbcd9('0xa1')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xbcd9('0x21')](_0x854027);})[_0xbcd9('0x18')](function(_0x208a67){_0x42284f[_0xbcd9('0xa3')]=_0x208a67;return _0x42284f;});}})[_0xbcd9('0x18')](respondWithFilteredResult(_0x34493b,_0x854027))[_0xbcd9('0x24')](handleError(_0x34493b,null));};exports['getHopperFinals']=function(_0x653263,_0x29361b){var _0x547e0c={'raw':!![],'where':{}};var _0x5012cf={};var _0x3fe75c={'count':0x0,'rows':[]};return db[_0xbcd9('0x25')]['findOne']({'where':{'id':_0x653263[_0xbcd9('0x26')]['id']}})[_0xbcd9('0x18')](handleEntityNotFound(_0x29361b,null))[_0xbcd9('0x18')](function(_0x1e488f){if(_0x1e488f){_0x5012cf[_0xbcd9('0x7d')]=_[_0xbcd9('0x28')](db[_0xbcd9('0x4d')][_0xbcd9('0x7a')]);_0x5012cf[_0xbcd9('0x22')]=_[_0xbcd9('0x28')](_0x653263['query']);_0x5012cf[_0xbcd9('0x7b')]=_[_0xbcd9('0x7c')](_0x5012cf[_0xbcd9('0x7d')],_0x5012cf['query']);_0x547e0c['attributes']=_[_0xbcd9('0x7c')](_0x5012cf['model'],qs[_0xbcd9('0x7f')](_0x653263[_0xbcd9('0x22')]['fields']));_0x547e0c[_0xbcd9('0x7e')]=_0x547e0c[_0xbcd9('0x7e')][_0xbcd9('0x29')]?_0x547e0c[_0xbcd9('0x7e')]:_0x5012cf[_0xbcd9('0x7d')];if(!_0x653263[_0xbcd9('0x22')][_0xbcd9('0x34')]('nolimit')){_0x547e0c[_0xbcd9('0x15')]=qs[_0xbcd9('0x15')](_0x653263['query'][_0xbcd9('0x15')]);_0x547e0c['offset']=qs[_0xbcd9('0x12')](_0x653263[_0xbcd9('0x22')]['offset']);}_0x547e0c[_0xbcd9('0x80')]=qs['sort'](_0x653263[_0xbcd9('0x22')][_0xbcd9('0x81')]);_0x547e0c['where']=qs[_0xbcd9('0x7b')](_[_0xbcd9('0x9e')](_0x653263[_0xbcd9('0x22')],_0x5012cf[_0xbcd9('0x7b')]));_0x547e0c['where'][_0xbcd9('0x9f')]=_0x1e488f['id'];if(_0x653263[_0xbcd9('0x22')][_0xbcd9('0x82')]){_0x547e0c['where']=_['merge'](_0x547e0c[_0xbcd9('0x60')],{'$or':_[_0xbcd9('0x6c')](_0x547e0c[_0xbcd9('0x7e')],function(_0xaf7a82){var _0x57cdeb={};_0x57cdeb[_0xaf7a82]={'$like':'%'+_0x653263[_0xbcd9('0x22')][_0xbcd9('0x82')]+'%'};return _0x57cdeb;})});}_0x547e0c=_[_0xbcd9('0x35')]({},_0x547e0c,_0x653263[_0xbcd9('0x83')]);return db['CmHopperFinal'][_0xbcd9('0x14')]({'where':_0x547e0c['where']})[_0xbcd9('0x18')](function(_0x818f3d){_0x3fe75c[_0xbcd9('0x14')]=_0x818f3d;if(_0x653263[_0xbcd9('0x22')][_0xbcd9('0xa0')]){_0x547e0c[_0xbcd9('0xa1')]=[{'all':!![]}];}return db[_0xbcd9('0x4d')][_0xbcd9('0x21')](_0x547e0c);})['then'](function(_0x46ae5b){_0x3fe75c[_0xbcd9('0xa3')]=_0x46ae5b;return _0x3fe75c;});}})[_0xbcd9('0x18')](respondWithFilteredResult(_0x29361b,_0x547e0c))['catch'](handleError(_0x29361b,null));};exports[_0xbcd9('0xa4')]=function(_0x4bc7b2,_0x39aa6e){var _0x142c03={'raw':!![],'where':{}};var _0x3ee803={};var _0x5e67a2={'count':0x0,'rows':[]};return db[_0xbcd9('0x25')][_0xbcd9('0x85')]({'where':{'id':_0x4bc7b2[_0xbcd9('0x26')]['id']}})['then'](handleEntityNotFound(_0x39aa6e,null))[_0xbcd9('0x18')](function(_0x449342){if(_0x449342){_0x3ee803['model']=_[_0xbcd9('0x28')](db[_0xbcd9('0x56')]['rawAttributes']);_0x3ee803[_0xbcd9('0x22')]=_['keys'](_0x4bc7b2['query']);_0x3ee803[_0xbcd9('0x7b')]=_[_0xbcd9('0x7c')](_0x3ee803[_0xbcd9('0x7d')],_0x3ee803[_0xbcd9('0x22')]);_0x142c03['attributes']=_[_0xbcd9('0x7c')](_0x3ee803[_0xbcd9('0x7d')],qs[_0xbcd9('0x7f')](_0x4bc7b2[_0xbcd9('0x22')]['fields']));_0x142c03[_0xbcd9('0x7e')]=_0x142c03[_0xbcd9('0x7e')][_0xbcd9('0x29')]?_0x142c03[_0xbcd9('0x7e')]:_0x3ee803[_0xbcd9('0x7d')];if(!_0x4bc7b2[_0xbcd9('0x22')]['hasOwnProperty'](_0xbcd9('0xa2'))){_0x142c03[_0xbcd9('0x15')]=qs['limit'](_0x4bc7b2[_0xbcd9('0x22')][_0xbcd9('0x15')]);_0x142c03['offset']=qs['offset'](_0x4bc7b2[_0xbcd9('0x22')]['offset']);}_0x142c03['order']=qs[_0xbcd9('0x81')](_0x4bc7b2[_0xbcd9('0x22')][_0xbcd9('0x81')]);_0x142c03[_0xbcd9('0x60')]=qs[_0xbcd9('0x7b')](_[_0xbcd9('0x9e')](_0x4bc7b2['query'],_0x3ee803[_0xbcd9('0x7b')]));_0x142c03['where'][_0xbcd9('0x9f')]=_0x449342['id'];if(_0x4bc7b2[_0xbcd9('0x22')][_0xbcd9('0x82')]){_0x142c03['where']=_[_0xbcd9('0x35')](_0x142c03['where'],{'$or':_[_0xbcd9('0x6c')](_0x142c03[_0xbcd9('0x7e')],function(_0x467cac){var _0x18d4be={};_0x18d4be[_0x467cac]={'$like':'%'+_0x4bc7b2[_0xbcd9('0x22')][_0xbcd9('0x82')]+'%'};return _0x18d4be;})});}_0x142c03=_[_0xbcd9('0x35')]({},_0x142c03,_0x4bc7b2['options']);return db['JscriptySessionReport'][_0xbcd9('0x14')]({'where':_0x142c03[_0xbcd9('0x60')]})['then'](function(_0x2cd3ae){_0x5e67a2[_0xbcd9('0x14')]=_0x2cd3ae;if(_0x4bc7b2[_0xbcd9('0x22')]['includeAll']){_0x142c03[_0xbcd9('0xa1')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0xbcd9('0x21')](_0x142c03);})[_0xbcd9('0x18')](function(_0x3cacb9){_0x5e67a2[_0xbcd9('0xa3')]=_0x3cacb9;return _0x5e67a2;});}})[_0xbcd9('0x18')](respondWithFilteredResult(_0x39aa6e,_0x142c03))[_0xbcd9('0x24')](handleError(_0x39aa6e,null));};exports[_0xbcd9('0xa5')]=function(_0x58926c,_0x12bf99){try{if(!_0x58926c['body'][_0xbcd9('0x63')]){throw new Error('No\x20ListId\x20specified');}if(!_0x58926c['body']['binding_keys']){throw new Error(_0xbcd9('0xa6'));}if(!_0x58926c[_0xbcd9('0x36')][_0xbcd9('0xa7')]){throw new Error(_0xbcd9('0xa8'));}if(!_0x58926c['body'][_0xbcd9('0xa9')]){throw new Error(_0xbcd9('0xaa'));}var _0x2e1717=_0x58926c[_0xbcd9('0x36')]['binding_keys'][_0xbcd9('0xab')](',');var _0x1f6f72=_0x58926c['body'][_0xbcd9('0xa7')]['split'](',');if(!_0x2e1717[_0xbcd9('0x29')]||!_0x1f6f72[_0xbcd9('0x29')]||_0x2e1717[_0xbcd9('0x29')]!==_0x1f6f72[_0xbcd9('0x29')]){throw new Error(_0xbcd9('0xac'));}_0x58926c[_0xbcd9('0x36')][_0xbcd9('0x7f')]=_[_0xbcd9('0xad')](_0x2e1717,_0x1f6f72);if(!_0x58926c[_0xbcd9('0x36')][_0xbcd9('0x7f')][_0xbcd9('0x78')]){throw new Error(_0xbcd9('0xae'));}if(!_0x58926c[_0xbcd9('0x36')][_0xbcd9('0x7f')][_0xbcd9('0xaf')]){throw new Error(_0xbcd9('0xb0'));}var _0x54b927=path[_0xbcd9('0x3a')](config[_0xbcd9('0xb1')],_0xbcd9('0xb2'),_0x58926c[_0xbcd9('0xb3')]['filename']);fs['chmodSync'](_0x54b927,parseInt(_0xbcd9('0xb4'),0x8));var _0x5473da=require(_0xbcd9('0xb5'))[_0xbcd9('0xb6')](path[_0xbcd9('0x3a')](__dirname,_0xbcd9('0xb7')),[_0x54b927,_0x58926c[_0xbcd9('0x36')][_0xbcd9('0xb8')],_0x58926c[_0xbcd9('0x36')][_0xbcd9('0xa7')],_0x58926c[_0xbcd9('0x36')]['ListId'],_0x58926c[_0xbcd9('0x36')][_0xbcd9('0xb9')],_0x58926c[_0xbcd9('0x36')][_0xbcd9('0x5f')],_0x58926c[_0xbcd9('0x36')][_0xbcd9('0xa9')]]);return _0x12bf99[_0xbcd9('0x10')](0xc8)[_0xbcd9('0x11')]({'message':_0xbcd9('0xba'),'pid':_0x5473da[_0xbcd9('0xbb')]});}catch(_0x259efe){return _0x12bf99[_0xbcd9('0x10')](0x1f4)['send'](_0x259efe);}};exports[_0xbcd9('0xbc')]=function(_0x4ed03a,_0x266371){var _0x4a4304=fs[_0xbcd9('0xbd')](_0x4ed03a[_0xbcd9('0xb3')][_0xbcd9('0x3')]);Papa[_0xbcd9('0xbe')](_0x4a4304,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x3cc6c3){return _0x266371[_0xbcd9('0x10')](0xc8)[_0xbcd9('0x11')]({'file':_0x4ed03a['file'],'fields':_0x3cc6c3[_0xbcd9('0xbf')]['fields']});}});};exports[_0xbcd9('0xc0')]=function(_0x240e0c,_0x44246){return db[_0xbcd9('0xc1')][_0xbcd9('0x21')]({'raw':!![],'attributes':['id'],'where':{'role':_0xbcd9('0xc2')}})[_0xbcd9('0x18')](function(_0x3eda32){var _0x5ecb4a=![];if(!_0x240e0c[_0xbcd9('0x36')][_0xbcd9('0x63')]){throw new Error(_0xbcd9('0xc3'));}if(!_0x240e0c[_0xbcd9('0x36')]['binding'][_0xbcd9('0x78')]){throw new Error(_0xbcd9('0xae'));}if(!_0x240e0c[_0xbcd9('0x36')]['binding'][_0xbcd9('0xaf')]){throw new Error(_0xbcd9('0xb0'));}if(!_0x240e0c['body'][_0xbcd9('0xa9')]){throw new Error(_0xbcd9('0xaa'));}var _0x5cf637=require(_0xbcd9('0xb5'))[_0xbcd9('0xb6')](path[_0xbcd9('0x3a')](__dirname,_0xbcd9('0xc4')),[_0x240e0c[_0xbcd9('0x26')]['id'],JSON[_0xbcd9('0xc5')](_0x240e0c['body']),JSON[_0xbcd9('0xc5')](_0x3eda32)]);_0x5cf637['on']('message',function(){_0x5ecb4a=!![];return _0x44246[_0xbcd9('0x10')](0xc8)['json']({'message':_0xbcd9('0xc6'),'pid':_0x5cf637[_0xbcd9('0xbb')]});});_0x5cf637['on']('exit',function(_0x2f01d9){if(_0x2f01d9&&!_0x5ecb4a){return _0x44246[_0xbcd9('0x10')](0x1f4)[_0xbcd9('0x11')]({'message':_0xbcd9('0xc7'),'pid':_0x5cf637['pid']});}});})[_0xbcd9('0x24')](handleError(_0x44246,null));};exports[_0xbcd9('0xc8')]=function(_0x1474ba,_0x2b4832){return db[_0xbcd9('0xc1')][_0xbcd9('0x21')]({'raw':!![],'attributes':['id'],'where':{'role':_0xbcd9('0xc2')}})[_0xbcd9('0x18')](function(_0x21eed6){var _0x2d24a5=![];if(!_0x1474ba[_0xbcd9('0x36')][_0xbcd9('0x63')]){throw new Error(_0xbcd9('0xc3'));}if(!_0x1474ba[_0xbcd9('0x36')][_0xbcd9('0xc9')][_0xbcd9('0x78')]){throw new Error(_0xbcd9('0xae'));}if(!_0x1474ba[_0xbcd9('0x36')]['binding']['firstName']){throw new Error(_0xbcd9('0xb0'));}if(!_0x1474ba['body']['socket_timestamp']){throw new Error(_0xbcd9('0xaa'));}var _0x24b9ac=require('child_process')['fork'](path['join'](__dirname,'../../components/import/cm/csvUpdates'),[_0x1474ba[_0xbcd9('0x26')]['id'],JSON[_0xbcd9('0xc5')](_0x1474ba[_0xbcd9('0x36')]),JSON[_0xbcd9('0xc5')](_0x21eed6)]);_0x24b9ac['on']('message',function(){_0x2d24a5=!![];return _0x2b4832['status'](0xc8)['json']({'message':_0xbcd9('0xc6'),'pid':_0x24b9ac[_0xbcd9('0xbb')]});});_0x24b9ac['on']('exit',function(_0x2016ab){if(_0x2016ab&&!_0x2d24a5){return _0x2b4832[_0xbcd9('0x10')](0x1f4)['json']({'message':_0xbcd9('0xc7'),'pid':_0x24b9ac[_0xbcd9('0xbb')]});}});})['catch'](handleError(_0x2b4832,null));};exports[_0xbcd9('0xca')]=function(_0xef4b69,_0x582055){var _0x365b67=['mail','chat',_0xbcd9('0xcb'),_0xbcd9('0xcc'),_0xbcd9('0xcd'),'whatsapp',_0xbcd9('0xce')];var _0x218cab={'offset':0x0,'order':qs[_0xbcd9('0x81')]('-createdAt')},_0x56f91a={'count':0x0,'rows':[]};Promise[_0xbcd9('0xcf')]()[_0xbcd9('0x18')](function(){if(_0xef4b69[_0xbcd9('0x22')]['channel']){if(!_['includes'](_0x365b67,_0xef4b69[_0xbcd9('0x22')][_0xbcd9('0xd0')][_0xbcd9('0xd1')]())){throw new Error(_0xbcd9('0xd2'));}_0x365b67=[_0xef4b69[_0xbcd9('0x22')][_0xbcd9('0xd0')][_0xbcd9('0xd1')]()];}if(_0xef4b69[_0xbcd9('0x22')][_0xbcd9('0xd3')]){try{var _0x53c67e=JSON[_0xbcd9('0xbe')](_0xef4b69['query'][_0xbcd9('0xd3')]);if(!moment(_0x53c67e[_0xbcd9('0x37')])[_0xbcd9('0xd4')]()){throw new Error(_0xbcd9('0xd5'));}if(!moment(_0x53c67e['to'])['isValid']()){throw new Error('Invalid\x20date\x20for\x20range\x20to\x20filter');}}catch(_0x178ec5){throw new Error(_0xbcd9('0xd6'));}}if(!_0xef4b69[_0xbcd9('0x22')][_0xbcd9('0x34')]('nolimit')){_0x218cab[_0xbcd9('0x15')]=qs[_0xbcd9('0x15')](_0xef4b69[_0xbcd9('0x22')][_0xbcd9('0x15')]||0xa);_0x218cab[_0xbcd9('0x12')]=qs[_0xbcd9('0x12')](_0xef4b69[_0xbcd9('0x22')][_0xbcd9('0x12')]);}var _0x4ae996=_0x365b67[_0xbcd9('0x6c')](function(_0x4dbf63){if(_0x4dbf63===_0xbcd9('0xce')){var _0x56f921={'attributes':['id','uniqueid','type',_0xbcd9('0xd7'),_0xbcd9('0xd8'),'callerid',_0xbcd9('0xd9'),'endtime',_0xbcd9('0xda'),_0xbcd9('0xdb'),_0xbcd9('0xdc'),_0xbcd9('0xdd'),'userSecondDisposition',_0xbcd9('0xde'),_0xbcd9('0xdf')],'where':{'ContactId':_0xef4b69['params']['id']},'include':[{'model':db[_0xbcd9('0xc1')],'as':_0xbcd9('0xc1'),'attributes':['id',_0xbcd9('0x1d'),_0xbcd9('0xe0'),_0xbcd9('0x2f')]}],'order':[[_0xbcd9('0xdc'),_0xbcd9('0xe1')]]};if(_0xef4b69[_0xbcd9('0x22')]['range']){_0x56f921[_0xbcd9('0x60')]['createdAt']={'$gte':_0x53c67e[_0xbcd9('0x37')],'$lte':_0x53c67e['to']};}return db[_0xbcd9('0x50')]['findAndCountAll'](_0x56f921)[_0xbcd9('0x18')](function(_0x20c984){_0x56f91a[_0xbcd9('0x14')]+=_0x20c984[_0xbcd9('0x14')];return _[_0xbcd9('0x6c')](_0x20c984['rows'],function(_0xa8794d){var _0x3a44fd=_0xa8794d[_0xbcd9('0x38')]({'plain':!![]});_0x3a44fd[_0xbcd9('0xd0')]=_0x4dbf63;if(_0x3a44fd[_0xbcd9('0xc1')]){_0x3a44fd['User']={'id':_0x3a44fd[_0xbcd9('0xc1')]['id'],'name':_0x3a44fd[_0xbcd9('0xc1')][_0xbcd9('0x1d')],'fullname':_0x3a44fd[_0xbcd9('0xc1')][_0xbcd9('0xe0')],'alias':_0x3a44fd['User'][_0xbcd9('0x2f')]};}return _0x3a44fd;});});}else{var _0x36742a=_[_0xbcd9('0xe2')](_0x4dbf63)+(_0x4dbf63===_0xbcd9('0xe3')?_0xbcd9('0xe4'):'Account');var _0x30394f={'attributes':['id',_0xbcd9('0xe5'),'closedAt',_0xbcd9('0xdc'),_0xbcd9('0xdb'),'disposition',_0xbcd9('0xe6'),_0xbcd9('0xe7'),_0xbcd9('0xdf'),_0x36742a+'Id'],'where':{'ContactId':_0xef4b69[_0xbcd9('0x26')]['id']},'include':[{'model':db[_0x36742a],'as':_0xbcd9('0xe8'),'attributes':['id','name',_0xbcd9('0xe9')]},{'model':db[_0xbcd9('0xc1')],'as':_0xbcd9('0xea'),'attributes':['id',_0xbcd9('0x1d'),'fullname']},{'model':db['Tag'],'as':_0xbcd9('0xeb'),'attributes':['id',_0xbcd9('0x1d'),'color'],'through':{'attributes':[]}}],'order':[[_0xbcd9('0xdc'),_0xbcd9('0xe1')]]};if(_0xef4b69['query'][_0xbcd9('0xd3')]){_0x30394f[_0xbcd9('0x60')][_0xbcd9('0xdc')]={'$gte':_0x53c67e[_0xbcd9('0x37')],'$lte':_0x53c67e['to']};}switch(_0x4dbf63){case _0xbcd9('0xe3'):_0x30394f[_0xbcd9('0x7e')][_0xbcd9('0x62')](_0xbcd9('0xec'),_0xbcd9('0xed'),'customerPort',_0xbcd9('0xee'),'osName',_0xbcd9('0xef'),_0xbcd9('0xf0'),_0xbcd9('0xf1'),'referer');break;case _0xbcd9('0xf2'):_0x30394f[_0xbcd9('0x7e')][_0xbcd9('0x62')]('subject',_0xbcd9('0xf3'));break;case'openchannel':_0x30394f[_0xbcd9('0x7e')]['push'](_0xbcd9('0xf4'),_0xbcd9('0xf5'));break;}return db[_[_0xbcd9('0xe2')](_0x4dbf63)+_0xbcd9('0xf6')][_0xbcd9('0xf7')](_0x30394f)[_0xbcd9('0x18')](function(_0x217141){_0x56f91a[_0xbcd9('0x14')]+=_0x217141[_0xbcd9('0x14')];return _[_0xbcd9('0x6c')](_0x217141[_0xbcd9('0xa3')],function(_0x2bf626){var _0x47ca15=_0x2bf626[_0xbcd9('0x38')]({'plain':!![]});_0x47ca15['channel']=_0x4dbf63;if(_0x47ca15['Owner']){_0x47ca15['Owner']={'id':_0x47ca15['Owner']['id'],'name':_0x47ca15[_0xbcd9('0xea')][_0xbcd9('0x1d')],'fullname':_0x47ca15['Owner'][_0xbcd9('0xe0')]};}return _0x47ca15;});});}});return Promise[_0xbcd9('0x87')](_0x4ae996);})['then'](function(_0x3c6bc5){return _(_0x3c6bc5)['flatten']()['sortBy']('createdAt')[_0xbcd9('0xf8')]()['value']();})[_0xbcd9('0x18')](function(_0x533bad){_0x56f91a[_0xbcd9('0xa3')]=_0x218cab[_0xbcd9('0x15')]?_0x533bad[_0xbcd9('0xf9')](_0x218cab[_0xbcd9('0x12')],_0x218cab['offset']+_0x218cab[_0xbcd9('0x15')]):_0x533bad;return _0x56f91a;})[_0xbcd9('0x18')](respondWithFilteredResult(_0x582055,_0x218cab))['catch'](handleError(_0x582055,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 315df7e..270e792 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 _0x7c9a=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmContact','save','update'];(function(_0x5b1c43,_0x1491b1){var _0x396f4f=function(_0x1ea922){while(--_0x1ea922){_0x5b1c43['push'](_0x5b1c43['shift']());}};_0x396f4f(++_0x1491b1);}(_0x7c9a,0x14f));var _0xa7c9=function(_0x582340,_0x185c84){_0x582340=_0x582340-0x0;var _0x1e4e12=_0x7c9a[_0x582340];return _0x1e4e12;};'use strict';var EventEmitter=require(_0xa7c9('0x0'));var CmContact=require(_0xa7c9('0x1'))['db'][_0xa7c9('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa7c9('0x3'),'afterUpdate':_0xa7c9('0x4'),'afterDestroy':_0xa7c9('0x5')};function emitEvent(_0x4d6947){return function(_0x3739ec,_0x341ff9,_0xdb622e){CmContactEvents['emit'](_0x4d6947+':'+_0x3739ec['id'],_0x3739ec);CmContactEvents[_0xa7c9('0x6')](_0x4d6947,_0x3739ec);_0xdb622e(null);};}for(var e in events){if(events[_0xa7c9('0x7')](e)){var event=events[e];CmContact[_0xa7c9('0x8')](e,emitEvent(event));}}module[_0xa7c9('0x9')]=CmContactEvents; \ No newline at end of file +var _0x975f=['exports','events','CmContact','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x4859bc,_0x11cbcb){var _0x5e20a8=function(_0x1e7766){while(--_0x1e7766){_0x4859bc['push'](_0x4859bc['shift']());}};_0x5e20a8(++_0x11cbcb);}(_0x975f,0x191));var _0xf975=function(_0x35b7d4,_0x5a5c43){_0x35b7d4=_0x35b7d4-0x0;var _0x4e8cee=_0x975f[_0x35b7d4];return _0x4e8cee;};'use strict';var EventEmitter=require(_0xf975('0x0'));var CmContact=require('../../mysqldb')['db'][_0xf975('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents[_0xf975('0x2')](0x0);var events={'afterCreate':_0xf975('0x3'),'afterUpdate':_0xf975('0x4'),'afterDestroy':_0xf975('0x5')};function emitEvent(_0x3791a1){return function(_0x521979,_0x9b38d1,_0x3fdb26){CmContactEvents['emit'](_0x3791a1+':'+_0x521979['id'],_0x521979);CmContactEvents[_0xf975('0x6')](_0x3791a1,_0x521979);_0x3fdb26(null);};}for(var e in events){if(events[_0xf975('0x7')](e)){var event=events[e];CmContact[_0xf975('0x8')](e,emitEvent(event));}}module[_0xf975('0x9')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index 7393faa..3c134b3 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 _0x55a0=['[OnlyIfOpen]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','always','onlyIfOpen','findAll','dialCheckDuplicateType','CmList','Lists','map','all','outbound','CmHopperBlack','BlackLists','exports','define','CmContact','cm_contacts','firstName','lastName','mobile','fax','FULLTEXT','models','get','error','catch','[cmContact][afterCreate]','message','isEmpty','destroy','ContactId','push','[CmContact][afterDestroy][Succesfull]','inspect','lodash','../../config/logger','api','moment','../../config/environment/shared','Campaign','scheduledat','format','isNil','dialTimezone','resolve','findOne','then','timezones','utcOffset','add','minutes','YYYY-MM-DD\x20HH:mm:ss','phone','ListId','priority','callbackUniqueid','assign','CmHopper','[Always]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','\x20in\x20Campaign\x20with\x20id\x20','CmHopperFinal','[Always]\x20Hopper\x20Final\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','CampaignId','VoiceQueueId','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x55a0,0x1a1));var _0x055a=function(_0x12bdd1,_0x15abbc){_0x12bdd1=_0x12bdd1-0x0;var _0x4ad209=_0x55a0[_0x12bdd1];return _0x4ad209;};'use strict';var _=require(_0x055a('0x0'));var util=require('util');var logger=require(_0x055a('0x1'))(_0x055a('0x2'));var moment=require(_0x055a('0x3'));var shared=require(_0x055a('0x4'));var attributes=require('./cmContact.attributes');function getTimezoneCallbackAt(_0x2cb996,_0xc87786,_0x2578bb,_0x46f783){var _0x18a308=_0x46f783?_0x055a('0x5'):'VoiceQueue';var _0x4804c6=_0x2578bb[_0x055a('0x6')]?_0x2578bb['scheduledat']:moment()[_0x055a('0x7')]('YYYY-MM-DD\x20HH:mm:ss');if(_[_0x055a('0x8')](_0x2578bb[_0x055a('0x9')])){return Promise[_0x055a('0xa')](_0x4804c6);}return _0x2cb996[_0x18a308][_0x055a('0xb')]({'where':{'id':_0xc87786}})[_0x055a('0xc')](function(_0xda368a){if(_['isNil'](_0xda368a)||_[_0x055a('0x8')](_0xda368a[_0x055a('0x9')])){return Promise[_0x055a('0xa')](_0x4804c6);}var _0x407f03=shared[_0x055a('0xd')];var _0x3439fa=_0x407f03[_0xda368a[_0x055a('0x9')]];var _0xec00c4=_0x407f03[_0x2578bb[_0x055a('0x9')]];if(_[_0x055a('0x8')](_0x3439fa)&&_['isNil'](_0xec00c4)){return Promise[_0x055a('0xa')](_0x4804c6);}var _0x276c30=_0x3439fa[_0x055a('0xe')]-_0xec00c4[_0x055a('0xe')];var _0x4dc4a3=_0x2578bb[_0x055a('0x6')]?_0x2578bb['scheduledat']:moment();_0x4804c6=moment(_0x4dc4a3)[_0x055a('0xf')](_0x276c30,_0x055a('0x10'))[_0x055a('0x7')](_0x055a('0x11'));return Promise[_0x055a('0xa')](_0x4804c6);});}function getNewHopperPayload(_0x96267e){return{'phone':_0x96267e[_0x055a('0x12')],'ContactId':_0x96267e['id'],'ListId':_0x96267e[_0x055a('0x13')],'scheduledat':_0x96267e[_0x055a('0x6')]?_0x96267e[_0x055a('0x6')]:moment()[_0x055a('0x7')](_0x055a('0x11')),'priority':_0x96267e[_0x055a('0x14')]?_0x96267e[_0x055a('0x14')]:0x2,'callback':_0x96267e[_0x055a('0x15')]?!![]:![],'callbackuniqueid':_0x96267e[_0x055a('0x15')]?_0x96267e[_0x055a('0x15')]:undefined,'callbackat':_0x96267e[_0x055a('0x15')]?moment()[_0x055a('0x7')]('YYYY-MM-DD\x20HH:mm:ss'):undefined};}function handleAlwaysCheckDuplicate(_0x1c1d10,_0x5c2165,_0x3a4f8e,_0x31b904){var _0x205403={'phone':_0x3a4f8e[_0x055a('0x12')]};var _0x3c8c21={'calleridnum':_0x3a4f8e[_0x055a('0x12')]};if(_0x31b904){Object[_0x055a('0x16')](_0x205403,{'CampaignId':_0x5c2165['id']});Object[_0x055a('0x16')](_0x3c8c21,{'CampaignId':_0x5c2165['id']});}else{Object['assign'](_0x205403,{'VoiceQueueId':_0x5c2165['id']});Object['assign'](_0x3c8c21,{'VoiceQueueId':_0x5c2165['id']});}return _0x1c1d10[_0x055a('0x17')][_0x055a('0xb')]({'where':_0x205403})[_0x055a('0xc')](function(_0x2916c3){if(_0x2916c3){throw new Error(_0x055a('0x18')+_0x3a4f8e[_0x055a('0x12')]+_0x055a('0x19')+_0x5c2165['id']);}return _0x1c1d10[_0x055a('0x1a')][_0x055a('0xb')]({'where':_0x3c8c21});})[_0x055a('0xc')](function(_0x281840){if(_0x281840){throw new Error(_0x055a('0x1b')+_0x3a4f8e[_0x055a('0x12')]+_0x055a('0x19')+_0x5c2165['id']);}var _0x3d4bd7=getNewHopperPayload(_0x3a4f8e);if(_0x31b904){_0x3d4bd7[_0x055a('0x1c')]=_0x5c2165['id'];}else{_0x3d4bd7[_0x055a('0x1d')]=_0x5c2165['id'];}return _0x1c1d10['CmHopper'][_0x055a('0x1e')](_0x3d4bd7);});}function handleOnlyIfOpenCheckDuplicate(_0xf9c115,_0x17c5f2,_0x1c6e06,_0x484d41){var _0xe0e22a={'phone':_0x1c6e06[_0x055a('0x12')]};if(_0x484d41){Object['assign'](_0xe0e22a,{'CampaignId':_0x17c5f2['id']});}else{Object[_0x055a('0x16')](_0xe0e22a,{'VoiceQueueId':_0x17c5f2['id']});}return _0xf9c115[_0x055a('0x17')][_0x055a('0xb')]({'where':_0xe0e22a})[_0x055a('0xc')](function(_0x33eab8){if(_0x33eab8){throw new Error(_0x055a('0x1f')+_0x1c6e06['phone']+_0x055a('0x19')+_0x17c5f2['id']);}var _0x3540d4=getNewHopperPayload(_0x1c6e06);if(_0x484d41){_0x3540d4[_0x055a('0x1c')]=_0x17c5f2['id'];}else{_0x3540d4[_0x055a('0x1d')]=_0x17c5f2['id'];}return _0xf9c115[_0x055a('0x17')][_0x055a('0x1e')](_0x3540d4);});}function handleNeverCheckDuplicate(_0x322780,_0x4f7209,_0x204d87){var _0x2c5cfb=getNewHopperPayload(_0x204d87);_0x2c5cfb[_0x055a('0x1d')]=_0x4f7209['id'];return _0x322780[_0x055a('0x17')]['create'](_0x2c5cfb);}function handleCheckDuplicate(_0x1a345a,_0x3e7d96,_0x428ea5,_0x2b9de7){return getTimezoneCallbackAt(_0x1a345a,_0x3e7d96,_0x428ea5,_0x2b9de7)['then'](function(_0x15d96e){_0x428ea5[_0x055a('0x6')]=_0x15d96e;switch(_0x3e7d96['dialCheckDuplicateType']){case _0x055a('0x20'):return handleAlwaysCheckDuplicate(_0x1a345a,_0x3e7d96,_0x428ea5,_0x2b9de7);case _0x055a('0x21'):return handleOnlyIfOpenCheckDuplicate(_0x1a345a,_0x3e7d96,_0x428ea5,_0x2b9de7);default:return handleNeverCheckDuplicate(_0x1a345a,_0x3e7d96,_0x428ea5);}});}function createHopperForVoiceQueues(_0x41d4bb,_0x3ce416){return _0x41d4bb['VoiceQueue'][_0x055a('0x22')]({'where':{'type':'outbound'},'attributes':['id',_0x055a('0x23'),_0x055a('0x9')],'include':[{'model':_0x41d4bb[_0x055a('0x24')],'as':_0x055a('0x25'),'where':{'id':_0x3ce416[_0x055a('0x13')]}}],'raw':!![]})[_0x055a('0xc')](function(_0x27cee0){var _0x172c46=_0x27cee0[_0x055a('0x26')](function(_0x4e8792){return handleCheckDuplicate(_0x41d4bb,_0x4e8792,_0x3ce416,![]);});return Promise['all'](_0x172c46);});}function createHopperForCampaigns(_0x1d02d4,_0x44006d){return _0x1d02d4['Campaign']['findAll']({'attributes':['id',_0x055a('0x23'),'dialTimezone'],'include':[{'model':_0x1d02d4[_0x055a('0x24')],'as':_0x055a('0x25'),'where':{'id':_0x44006d[_0x055a('0x13')]}}],'raw':!![]})[_0x055a('0xc')](function(_0x925f02){var _0x5386b2=_0x925f02[_0x055a('0x26')](function(_0x5d6f90){return handleCheckDuplicate(_0x1d02d4,_0x5d6f90,_0x44006d,!![]);});return Promise[_0x055a('0x27')](_0x5386b2);});}function createHopperBlackForVoiceQueues(_0x8ec60a,_0x3889cd){return _0x8ec60a['VoiceQueue'][_0x055a('0x22')]({'where':{'type':_0x055a('0x28')},'attributes':['id'],'include':[{'model':_0x8ec60a[_0x055a('0x24')],'as':'BlackLists','where':{'id':_0x3889cd['ListId']}}],'raw':!![]})['then'](function(_0x4d0271){var _0x278381=_0x4d0271['map'](function(_0x1d35d7){return _0x8ec60a[_0x055a('0x29')]['create']({'phone':_0x3889cd['phone'],'ContactId':_0x3889cd['id'],'ListId':_0x3889cd[_0x055a('0x13')],'VoiceQueueId':_0x1d35d7['id']});});return Promise['all'](_0x278381);});}function createHopperBlackForCampaigns(_0xcb75f9,_0xe2929c){return _0xcb75f9['Campaign'][_0x055a('0x22')]({'attributes':['id'],'include':[{'model':_0xcb75f9['CmList'],'as':_0x055a('0x2a'),'where':{'id':_0xe2929c['ListId']}}],'raw':!![]})[_0x055a('0xc')](function(_0x369d2d){var _0x5975b9=_0x369d2d[_0x055a('0x26')](function(_0x390b9d){return _0xcb75f9[_0x055a('0x29')][_0x055a('0x1e')]({'phone':_0xe2929c[_0x055a('0x12')],'ContactId':_0xe2929c['id'],'ListId':_0xe2929c['ListId'],'CampaignId':_0x390b9d['id']});});return Promise[_0x055a('0x27')](_0x5975b9);});}module[_0x055a('0x2b')]=function(_0x38a2ac){return _0x38a2ac[_0x055a('0x2c')](_0x055a('0x2d'),attributes,{'tableName':_0x055a('0x2e'),'paranoid':!![],'indexes':[{'name':_0x055a('0x12'),'fields':[_0x055a('0x12')]},{'name':'fti_cm_contacts','fields':[_0x055a('0x2f'),_0x055a('0x30'),'phone',_0x055a('0x31'),_0x055a('0x32'),'email'],'type':_0x055a('0x33')}],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci','hooks':{'afterCreate':function(_0x101db1,_0x4daa0f,_0x310e0c){var _0x2fdca7=_0x38a2ac[_0x055a('0x34')];var _0x1d2676=_0x101db1[_0x055a('0x35')]({'plain':!![]});if(!_0x1d2676[_0x055a('0x13')]){logger[_0x055a('0x36')]('[cmContact][afterCreate]\x20List\x20not\x20found\x20for\x20contact\x20with\x20id\x20'+_0x1d2676['id']);return _0x310e0c();}if(!_0x1d2676[_0x055a('0x12')]){return _0x310e0c();}return createHopperForVoiceQueues(_0x2fdca7,_0x1d2676)[_0x055a('0xc')](function(){return createHopperBlackForVoiceQueues(_0x2fdca7,_0x1d2676);})[_0x055a('0xc')](function(){return createHopperForCampaigns(_0x2fdca7,_0x1d2676);})[_0x055a('0xc')](function(){return createHopperBlackForCampaigns(_0x2fdca7,_0x1d2676);})['then'](function(){return _0x310e0c();})[_0x055a('0x37')](function(_0x368a77){logger[_0x055a('0x36')](_0x055a('0x38'),_0x368a77[_0x055a('0x39')]);_0x310e0c();});},'afterDestroy':function(_0x3ea0c9,_0x18582f,_0x40e655){var _0x58bba6=_0x38a2ac[_0x055a('0x34')];var _0x2f2566=_0x3ea0c9[_0x055a('0x35')]({'plain':!![]});return _0x58bba6['CmHopper']['findAll']({'raw':!![],'where':{'ListId':_0x2f2566['ListId'],'ContactId':_0x2f2566['id']}})[_0x055a('0xc')](function(_0x4afea0){if(!_[_0x055a('0x3a')](_0x4afea0)){var _0x11d07b=[];for(var _0x249b58=0x0;_0x249b58<_0x4afea0['length'];_0x249b58+=0x1){var _0x562806=_0x58bba6[_0x055a('0x17')][_0x055a('0x3b')]({'where':{'ListId':_0x4afea0[_0x249b58][_0x055a('0x13')],'ContactId':_0x4afea0[_0x249b58][_0x055a('0x3c')],'VoiceQueueId':_0x4afea0[_0x249b58][_0x055a('0x1d')],'CampaignId':_0x4afea0[_0x249b58][_0x055a('0x1c')]}});_0x11d07b[_0x055a('0x3d')](_0x562806);}return Promise['all'](_0x11d07b);}})['then'](function(_0x28a5eb){logger['info'](_0x055a('0x3e'),util[_0x055a('0x3f')](_0x28a5eb,{'showHidden':![],'depth':null}));_0x40e655();})[_0x055a('0x37')](function(_0x5665c6){logger[_0x055a('0x36')]('[CmContact][afterDestroy][Error]',util[_0x055a('0x3f')](_0x5665c6,{'showHidden':![],'depth':null}));_0x40e655(_0x5665c6);});}}});}; \ No newline at end of file +var _0x02c4=['utf8mb4','utf8mb4_unicode_ci','[cmContact][afterCreate]\x20List\x20not\x20found\x20for\x20contact\x20with\x20id\x20','catch','error','message','models','get','length','destroy','ContactId','push','info','inspect','util','../../config/logger','api','moment','./cmContact.attributes','Campaign','VoiceQueue','scheduledat','YYYY-MM-DD\x20HH:mm:ss','dialTimezone','resolve','findOne','isNil','utcOffset','minutes','format','phone','priority','callbackUniqueid','assign','CmHopper','then','[Always]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','\x20in\x20Campaign\x20with\x20id\x20','CmHopperFinal','[Always]\x20Hopper\x20Final\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','CampaignId','VoiceQueueId','create','[OnlyIfOpen]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','dialCheckDuplicateType','always','outbound','CmList','Lists','ListId','all','map','findAll','BlackLists','CmHopperBlack','exports','define','CmContact','cm_contacts','fti_cm_contacts','firstName','lastName','mobile','fax','email'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x02c4,0x153));var _0x402c=function(_0xf77783,_0x1c93f4){_0xf77783=_0xf77783-0x0;var _0x1fc9cf=_0x02c4[_0xf77783];return _0x1fc9cf;};'use strict';var _=require('lodash');var util=require(_0x402c('0x0'));var logger=require(_0x402c('0x1'))(_0x402c('0x2'));var moment=require(_0x402c('0x3'));var shared=require('../../config/environment/shared');var attributes=require(_0x402c('0x4'));function getTimezoneCallbackAt(_0x3d96b9,_0x5d7cdc,_0x18b42c,_0x8a4463){var _0x1b68d3=_0x8a4463?_0x402c('0x5'):_0x402c('0x6');var _0x4f9dd1=_0x18b42c[_0x402c('0x7')]?_0x18b42c[_0x402c('0x7')]:moment()['format'](_0x402c('0x8'));if(_['isNil'](_0x18b42c[_0x402c('0x9')])){return Promise[_0x402c('0xa')](_0x4f9dd1);}return _0x3d96b9[_0x1b68d3][_0x402c('0xb')]({'where':{'id':_0x5d7cdc}})['then'](function(_0x461aaa){if(_[_0x402c('0xc')](_0x461aaa)||_[_0x402c('0xc')](_0x461aaa[_0x402c('0x9')])){return Promise[_0x402c('0xa')](_0x4f9dd1);}var _0x447926=shared['timezones'];var _0xd4e815=_0x447926[_0x461aaa[_0x402c('0x9')]];var _0x513773=_0x447926[_0x18b42c['dialTimezone']];if(_[_0x402c('0xc')](_0xd4e815)&&_[_0x402c('0xc')](_0x513773)){return Promise[_0x402c('0xa')](_0x4f9dd1);}var _0x8cc716=_0xd4e815[_0x402c('0xd')]-_0x513773[_0x402c('0xd')];var _0x5e4c18=_0x18b42c[_0x402c('0x7')]?_0x18b42c[_0x402c('0x7')]:moment();_0x4f9dd1=moment(_0x5e4c18)['add'](_0x8cc716,_0x402c('0xe'))[_0x402c('0xf')](_0x402c('0x8'));return Promise['resolve'](_0x4f9dd1);});}function getNewHopperPayload(_0x486084){return{'phone':_0x486084[_0x402c('0x10')],'ContactId':_0x486084['id'],'ListId':_0x486084['ListId'],'scheduledat':_0x486084['scheduledat']?_0x486084[_0x402c('0x7')]:moment()[_0x402c('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x486084[_0x402c('0x11')]?_0x486084[_0x402c('0x11')]:0x2,'callback':_0x486084[_0x402c('0x12')]?!![]:![],'callbackuniqueid':_0x486084['callbackUniqueid']?_0x486084[_0x402c('0x12')]:undefined,'callbackat':_0x486084[_0x402c('0x12')]?moment()[_0x402c('0xf')]('YYYY-MM-DD\x20HH:mm:ss'):undefined};}function handleAlwaysCheckDuplicate(_0x257697,_0x33277e,_0xe33e8e,_0x1a2d9a){var _0x4b5fce={'phone':_0xe33e8e[_0x402c('0x10')]};var _0x440e0a={'calleridnum':_0xe33e8e[_0x402c('0x10')]};if(_0x1a2d9a){Object[_0x402c('0x13')](_0x4b5fce,{'CampaignId':_0x33277e['id']});Object['assign'](_0x440e0a,{'CampaignId':_0x33277e['id']});}else{Object[_0x402c('0x13')](_0x4b5fce,{'VoiceQueueId':_0x33277e['id']});Object['assign'](_0x440e0a,{'VoiceQueueId':_0x33277e['id']});}return _0x257697[_0x402c('0x14')][_0x402c('0xb')]({'where':_0x4b5fce})[_0x402c('0x15')](function(_0x129bec){if(_0x129bec){throw new Error(_0x402c('0x16')+_0xe33e8e[_0x402c('0x10')]+_0x402c('0x17')+_0x33277e['id']);}return _0x257697[_0x402c('0x18')][_0x402c('0xb')]({'where':_0x440e0a});})[_0x402c('0x15')](function(_0x29e98d){if(_0x29e98d){throw new Error(_0x402c('0x19')+_0xe33e8e[_0x402c('0x10')]+_0x402c('0x17')+_0x33277e['id']);}var _0x122b09=getNewHopperPayload(_0xe33e8e);if(_0x1a2d9a){_0x122b09[_0x402c('0x1a')]=_0x33277e['id'];}else{_0x122b09[_0x402c('0x1b')]=_0x33277e['id'];}return _0x257697['CmHopper'][_0x402c('0x1c')](_0x122b09);});}function handleOnlyIfOpenCheckDuplicate(_0x2c3e30,_0x124f84,_0x2e7cf3,_0x47349d){var _0xbcbd91={'phone':_0x2e7cf3[_0x402c('0x10')]};if(_0x47349d){Object['assign'](_0xbcbd91,{'CampaignId':_0x124f84['id']});}else{Object['assign'](_0xbcbd91,{'VoiceQueueId':_0x124f84['id']});}return _0x2c3e30['CmHopper'][_0x402c('0xb')]({'where':_0xbcbd91})[_0x402c('0x15')](function(_0x28fc64){if(_0x28fc64){throw new Error(_0x402c('0x1d')+_0x2e7cf3[_0x402c('0x10')]+'\x20in\x20Campaign\x20with\x20id\x20'+_0x124f84['id']);}var _0x367864=getNewHopperPayload(_0x2e7cf3);if(_0x47349d){_0x367864[_0x402c('0x1a')]=_0x124f84['id'];}else{_0x367864['VoiceQueueId']=_0x124f84['id'];}return _0x2c3e30['CmHopper'][_0x402c('0x1c')](_0x367864);});}function handleNeverCheckDuplicate(_0x416ca8,_0x11fbcb,_0x1786af){var _0x4175e2=getNewHopperPayload(_0x1786af);_0x4175e2['VoiceQueueId']=_0x11fbcb['id'];return _0x416ca8[_0x402c('0x14')][_0x402c('0x1c')](_0x4175e2);}function handleCheckDuplicate(_0x3bf3f6,_0x88d34e,_0x61ddad,_0x8dc7c7){return getTimezoneCallbackAt(_0x3bf3f6,_0x88d34e,_0x61ddad,_0x8dc7c7)[_0x402c('0x15')](function(_0x19b851){_0x61ddad[_0x402c('0x7')]=_0x19b851;switch(_0x88d34e[_0x402c('0x1e')]){case _0x402c('0x1f'):return handleAlwaysCheckDuplicate(_0x3bf3f6,_0x88d34e,_0x61ddad,_0x8dc7c7);case'onlyIfOpen':return handleOnlyIfOpenCheckDuplicate(_0x3bf3f6,_0x88d34e,_0x61ddad,_0x8dc7c7);default:return handleNeverCheckDuplicate(_0x3bf3f6,_0x88d34e,_0x61ddad);}});}function createHopperForVoiceQueues(_0x447900,_0x236158){return _0x447900[_0x402c('0x6')]['findAll']({'where':{'type':_0x402c('0x20')},'attributes':['id',_0x402c('0x1e'),_0x402c('0x9')],'include':[{'model':_0x447900[_0x402c('0x21')],'as':_0x402c('0x22'),'where':{'id':_0x236158[_0x402c('0x23')]}}],'raw':!![]})[_0x402c('0x15')](function(_0x19bb25){var _0xa46fdd=_0x19bb25['map'](function(_0x1c8390){return handleCheckDuplicate(_0x447900,_0x1c8390,_0x236158,![]);});return Promise[_0x402c('0x24')](_0xa46fdd);});}function createHopperForCampaigns(_0x31993d,_0x2cb863){return _0x31993d['Campaign']['findAll']({'attributes':['id','dialCheckDuplicateType',_0x402c('0x9')],'include':[{'model':_0x31993d[_0x402c('0x21')],'as':_0x402c('0x22'),'where':{'id':_0x2cb863[_0x402c('0x23')]}}],'raw':!![]})[_0x402c('0x15')](function(_0x56faee){var _0xee0cdf=_0x56faee[_0x402c('0x25')](function(_0x5ee5c2){return handleCheckDuplicate(_0x31993d,_0x5ee5c2,_0x2cb863,!![]);});return Promise['all'](_0xee0cdf);});}function createHopperBlackForVoiceQueues(_0x3831ca,_0x18fe10){return _0x3831ca[_0x402c('0x6')][_0x402c('0x26')]({'where':{'type':_0x402c('0x20')},'attributes':['id'],'include':[{'model':_0x3831ca[_0x402c('0x21')],'as':_0x402c('0x27'),'where':{'id':_0x18fe10[_0x402c('0x23')]}}],'raw':!![]})[_0x402c('0x15')](function(_0x39a806){var _0x531f77=_0x39a806[_0x402c('0x25')](function(_0x584dbd){return _0x3831ca[_0x402c('0x28')][_0x402c('0x1c')]({'phone':_0x18fe10[_0x402c('0x10')],'ContactId':_0x18fe10['id'],'ListId':_0x18fe10[_0x402c('0x23')],'VoiceQueueId':_0x584dbd['id']});});return Promise[_0x402c('0x24')](_0x531f77);});}function createHopperBlackForCampaigns(_0x2f8184,_0x57488d){return _0x2f8184['Campaign'][_0x402c('0x26')]({'attributes':['id'],'include':[{'model':_0x2f8184['CmList'],'as':_0x402c('0x27'),'where':{'id':_0x57488d[_0x402c('0x23')]}}],'raw':!![]})[_0x402c('0x15')](function(_0x1161d2){var _0x58af4d=_0x1161d2[_0x402c('0x25')](function(_0x284051){return _0x2f8184[_0x402c('0x28')]['create']({'phone':_0x57488d['phone'],'ContactId':_0x57488d['id'],'ListId':_0x57488d[_0x402c('0x23')],'CampaignId':_0x284051['id']});});return Promise[_0x402c('0x24')](_0x58af4d);});}module[_0x402c('0x29')]=function(_0x45f7db){return _0x45f7db[_0x402c('0x2a')](_0x402c('0x2b'),attributes,{'tableName':_0x402c('0x2c'),'paranoid':!![],'indexes':[{'name':_0x402c('0x10'),'fields':[_0x402c('0x10')]},{'name':_0x402c('0x2d'),'fields':[_0x402c('0x2e'),_0x402c('0x2f'),'phone',_0x402c('0x30'),_0x402c('0x31'),_0x402c('0x32')],'type':'FULLTEXT'}],'timestamps':!![],'charset':_0x402c('0x33'),'collate':_0x402c('0x34'),'hooks':{'afterCreate':function(_0x86d164,_0x2d8e90,_0x6b3e87){var _0x24607b=_0x45f7db['models'];var _0x3d2edb=_0x86d164['get']({'plain':!![]});if(!_0x3d2edb[_0x402c('0x23')]){logger['error'](_0x402c('0x35')+_0x3d2edb['id']);return _0x6b3e87();}if(!_0x3d2edb[_0x402c('0x10')]){return _0x6b3e87();}return createHopperForVoiceQueues(_0x24607b,_0x3d2edb)[_0x402c('0x15')](function(){return createHopperBlackForVoiceQueues(_0x24607b,_0x3d2edb);})[_0x402c('0x15')](function(){return createHopperForCampaigns(_0x24607b,_0x3d2edb);})[_0x402c('0x15')](function(){return createHopperBlackForCampaigns(_0x24607b,_0x3d2edb);})[_0x402c('0x15')](function(){return _0x6b3e87();})[_0x402c('0x36')](function(_0x156028){logger[_0x402c('0x37')]('[cmContact][afterCreate]',_0x156028[_0x402c('0x38')]);_0x6b3e87();});},'afterDestroy':function(_0x35697d,_0x303ab4,_0x2ac058){var _0x1022f2=_0x45f7db[_0x402c('0x39')];var _0x5e54ae=_0x35697d[_0x402c('0x3a')]({'plain':!![]});return _0x1022f2[_0x402c('0x14')][_0x402c('0x26')]({'raw':!![],'where':{'ListId':_0x5e54ae['ListId'],'ContactId':_0x5e54ae['id']}})[_0x402c('0x15')](function(_0x2f7a93){if(!_['isEmpty'](_0x2f7a93)){var _0x4fe4f5=[];for(var _0x4d9575=0x0;_0x4d9575<_0x2f7a93[_0x402c('0x3b')];_0x4d9575+=0x1){var _0x2352d3=_0x1022f2[_0x402c('0x14')][_0x402c('0x3c')]({'where':{'ListId':_0x2f7a93[_0x4d9575][_0x402c('0x23')],'ContactId':_0x2f7a93[_0x4d9575][_0x402c('0x3d')],'VoiceQueueId':_0x2f7a93[_0x4d9575][_0x402c('0x1b')],'CampaignId':_0x2f7a93[_0x4d9575][_0x402c('0x1a')]}});_0x4fe4f5[_0x402c('0x3e')](_0x2352d3);}return Promise['all'](_0x4fe4f5);}})[_0x402c('0x15')](function(_0x6c5753){logger[_0x402c('0x3f')]('[CmContact][afterDestroy][Succesfull]',util[_0x402c('0x40')](_0x6c5753,{'showHidden':![],'depth':null}));_0x2ac058();})[_0x402c('0x36')](function(_0x23df0){logger['error']('[CmContact][afterDestroy][Error]',util[_0x402c('0x40')](_0x23df0,{'showHidden':![],'depth':null}));_0x2ac058(_0x23df0);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 6980aa3..fe5435b 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 _0x9957=['include','model','length','CmContactHasItem','find','ListId','Contact','isNil','CmContactId','CmContact','catch','CreateCmContact','create','body','keys','startsWith','cf_','table','cm_contacts','set','where','id\x20=\x20?','toString','sequelize','query','lodash','util','moment','bluebird','ioredis','squel','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./cmContact.socket','register','request','then','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','GetCmContact','findAll','options','raw','attributes','limit','map'];(function(_0x5ddb74,_0x288e05){var _0x2321df=function(_0x5dfe5f){while(--_0x5dfe5f){_0x5ddb74['push'](_0x5ddb74['shift']());}};_0x2321df(++_0x288e05);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var squel=require(_0x7995('0x5'));var db=require(_0x7995('0x6'))['db'];var utils=require(_0x7995('0x7'));var logger=require('../../config/logger')(_0x7995('0x8'));var config=require(_0x7995('0x9'));var jayson=require(_0x7995('0xa'));var client=jayson[_0x7995('0xb')][_0x7995('0xc')]({'port':0x232a});config[_0x7995('0xd')]=_['defaults'](config[_0x7995('0xd')],{'host':_0x7995('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7995('0xd')]));require(_0x7995('0xf'))[_0x7995('0x10')](socket);function respondWithRpcPromise(_0x35b5fe,_0x3c1d19,_0x1e400a){return new BPromise(function(_0x341672,_0x524f7b){return client[_0x7995('0x11')](_0x35b5fe,_0x1e400a)[_0x7995('0x12')](function(_0x581f22){logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));logger[_0x7995('0x16')](_0x7995('0x17'),_0x3c1d19,_0x7995('0x15'),JSON[_0x7995('0x18')](_0x581f22));if(_0x581f22['error']){if(_0x581f22['error'][_0x7995('0x19')]===0x1f4){logger[_0x7995('0x1a')](_0x7995('0x14'),_0x3c1d19,_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);return _0x524f7b(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}logger[_0x7995('0x1a')]('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x581f22[_0x7995('0x1a')]['message']);return _0x341672(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}else{logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));_0x341672(_0x581f22[_0x7995('0x1c')]['message']);}})['catch'](function(_0x2536c8){logger['error']('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x2536c8);_0x524f7b(_0x2536c8);});});}exports[_0x7995('0x1d')]=function(_0x3d463e){var _0x4cbe10=this;return new Promise(function(_0x3a9b54,_0x51f276){return db['CmContact'][_0x7995('0x1e')]({'raw':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![],'where':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['where']||null:null,'attributes':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x21')]||null:null,'limit':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x22')]||null:null,'include':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['include']?_[_0x7995('0x23')](_0x3d463e[_0x7995('0x1f')][_0x7995('0x24')],function(_0x268ce7){return{'model':db[_0x268ce7[_0x7995('0x25')]],'as':_0x268ce7['as'],'attributes':_0x268ce7[_0x7995('0x21')],'include':_0x268ce7['include']?_[_0x7995('0x23')](_0x268ce7['include'],function(_0x229742){return{'model':db[_0x229742[_0x7995('0x25')]],'as':_0x229742['as'],'attributes':_0x229742[_0x7995('0x21')],'include':_0x229742[_0x7995('0x24')]?_[_0x7995('0x23')](_0x229742['include'],function(_0x9b2a15){return{'model':db[_0x9b2a15['model']],'as':_0x9b2a15['as'],'attributes':_0x9b2a15[_0x7995('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7995('0x12')](function(_0x4253e5){logger['info']('GetCmContact',_0x3d463e);logger['debug'](_0x7995('0x1d'),_0x3d463e,JSON[_0x7995('0x18')](_0x4253e5));if(_0x4253e5[_0x7995('0x26')]==0x0){return db[_0x7995('0x27')][_0x7995('0x28')]({'raw':!![],'where':{'item':_0x3d463e[_0x7995('0x1f')]['phone']},'include':[{'model':db['CmContact'],'where':{'ListId':_0x3d463e[_0x7995('0x1f')]['where'][_0x7995('0x29')],'deletedAt':{'$eq':null}},'as':_0x7995('0x2a')}]})[_0x7995('0x12')](function(_0x1e9fa4){if(_[_0x7995('0x2b')](_0x1e9fa4)){_0x3a9b54(_0x4253e5);}else{var _0x510841=_0x1e9fa4[_0x7995('0x2c')];return db[_0x7995('0x2d')]['findAll']({'raw':!![],'where':{'id':_0x510841},'attributes':_0x3d463e['options']?_0x3d463e['options'][_0x7995('0x21')]||null:null})[_0x7995('0x12')](function(_0x4a176f){_0x3a9b54(_0x4a176f);});}});}else{_0x3a9b54(_0x4253e5);}})[_0x7995('0x2e')](function(_0x51b95d){logger[_0x7995('0x1a')](_0x7995('0x1d'),_0x51b95d[_0x7995('0x1b')],_0x3d463e);_0x51f276(_0x4cbe10['error'](0x1f4,_0x51b95d['message']));});});};exports[_0x7995('0x2f')]=function(_0x5e67fe){var _0x5d2428=this;return new Promise(function(_0x3e99cd,_0xe328b1){return db['CmContact'][_0x7995('0x30')](_0x5e67fe[_0x7995('0x31')],{'raw':_0x5e67fe[_0x7995('0x1f')]?_0x5e67fe[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x2d4285){var _0x242713;for(var _0xf612e6=0x0;_0xf612e6{}\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(_0x3782eb,_0x5e1813){var _0x18f430=function(_0x11a008){while(--_0x11a008){_0x3782eb['push'](_0x3782eb['shift']());}};_0x18f430(++_0x5e1813);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'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 953afc8..fe3ab9b 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 _0x3098=['exports','INTEGER','STRING','PHONE','sequelize'];(function(_0x1c8c28,_0x3ee093){var _0x1f59b4=function(_0x29bcc0){while(--_0x29bcc0){_0x1c8c28['push'](_0x1c8c28['shift']());}};_0x1f59b4(++_0x3ee093);}(_0x3098,0x86));var _0x8309=function(_0xd21fe7,_0x225a39){_0xd21fe7=_0xd21fe7-0x0;var _0x14d570=_0x3098[_0xd21fe7];return _0x14d570;};'use strict';var Sequelize=require(_0x8309('0x0'));module[_0x8309('0x1')]={'CmContactId':{'type':Sequelize[_0x8309('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0x8309('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x8309('0x3')],'defaultValue':_0x8309('0x4')},'OrderBy':{'type':Sequelize[_0x8309('0x2')],'defaultValue':null},'description':{'type':Sequelize[_0x8309('0x3')],'defaultValue':null}}; \ No newline at end of file +var _0xb2b3=['INTEGER','STRING','PHONE','sequelize','exports'];(function(_0x5554ad,_0x415364){var _0x1405f2=function(_0x32c8a1){while(--_0x32c8a1){_0x5554ad['push'](_0x5554ad['shift']());}};_0x1405f2(++_0x415364);}(_0xb2b3,0x71));var _0x3b2b=function(_0x10f5ec,_0x2e7a97){_0x10f5ec=_0x10f5ec-0x0;var _0x49cc9d=_0xb2b3[_0x10f5ec];return _0x49cc9d;};'use strict';var Sequelize=require(_0x3b2b('0x0'));module[_0x3b2b('0x1')]={'CmContactId':{'type':Sequelize[_0x3b2b('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0x3b2b('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x3b2b('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x3b2b('0x3')],'defaultValue':_0x3b2b('0x4')},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':null},'description':{'type':Sequelize[_0x3b2b('0x3')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index 1a15037..bae46f5 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 _0x355a=['eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','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','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','CmContactHasItems','UserProfileResource','error','stack','name','send','index','map','CmContactHasItem','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0x355a,0xa6));var _0xa355=function(_0x321543,_0x47fc87){_0x321543=_0x321543-0x0;var _0x47ffc8=_0x355a[_0x321543];return _0x47ffc8;};'use strict';var emlformat=require(_0xa355('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa355('0x1'));var jsonpatch=require(_0xa355('0x2'));var rp=require(_0xa355('0x3'));var moment=require(_0xa355('0x4'));var BPromise=require(_0xa355('0x5'));var Mustache=require(_0xa355('0x6'));var util=require('util');var path=require(_0xa355('0x7'));var sox=require(_0xa355('0x8'));var csv=require(_0xa355('0x9'));var ejs=require(_0xa355('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa355('0xb'));var squel=require(_0xa355('0xc'));var crypto=require(_0xa355('0xd'));var jsforce=require(_0xa355('0xe'));var deskjs=require(_0xa355('0xf'));var toCsv=require(_0xa355('0x9'));var querystring=require(_0xa355('0x10'));var Papa=require(_0xa355('0x11'));var Redis=require('ioredis');var authService=require(_0xa355('0x12'));var qs=require(_0xa355('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa355('0x14'));var logger=require(_0xa355('0x15'))('api');var utils=require(_0xa355('0x16'));var config=require(_0xa355('0x17'));var licenseUtil=require(_0xa355('0x18'));var db=require(_0xa355('0x19'))['db'];function respondWithStatusCode(_0x425ef8,_0x118669){_0x118669=_0x118669||0xcc;return function(_0x30706a){if(_0x30706a){return _0x425ef8[_0xa355('0x1a')](_0x118669);}return _0x425ef8[_0xa355('0x1b')](_0x118669)[_0xa355('0x1c')]();};}function respondWithResult(_0x5a94e7,_0xee41a2){_0xee41a2=_0xee41a2||0xc8;return function(_0x195295){if(_0x195295){return _0x5a94e7[_0xa355('0x1b')](_0xee41a2)[_0xa355('0x1d')](_0x195295);}};}function respondWithFilteredResult(_0x43508a,_0x56443e){return function(_0x516cb8){if(_0x516cb8){var _0x3077bf=typeof _0x56443e[_0xa355('0x1e')]===_0xa355('0x1f')&&typeof _0x56443e[_0xa355('0x20')]===_0xa355('0x1f');var _0x520c92=_0x516cb8[_0xa355('0x21')];var _0x558858=_0x3077bf?0x0:_0x56443e['offset'];var _0x3b16eb=_0x3077bf?_0x516cb8[_0xa355('0x21')]:_0x56443e[_0xa355('0x1e')]+_0x56443e[_0xa355('0x20')];var _0x487ce0;if(_0x3b16eb>=_0x520c92){_0x3b16eb=_0x520c92;_0x487ce0=0xc8;}else{_0x487ce0=0xce;}_0x43508a[_0xa355('0x1b')](_0x487ce0);return _0x43508a[_0xa355('0x22')](_0xa355('0x23'),_0x558858+'-'+_0x3b16eb+'/'+_0x520c92)[_0xa355('0x1d')](_0x516cb8);}return null;};}function patchUpdates(_0x51af35){return function(_0x3fdfc9){try{jsonpatch[_0xa355('0x24')](_0x3fdfc9,_0x51af35,!![]);}catch(_0x1e49a0){return BPromise['reject'](_0x1e49a0);}return _0x3fdfc9['save']();};}function saveUpdates(_0x254af1,_0x3c4c78){return function(_0x2973f8){if(_0x2973f8){return _0x2973f8[_0xa355('0x25')](_0x254af1)[_0xa355('0x26')](function(_0x447d28){return _0x447d28;});}return null;};}function removeEntity(_0xef0c31,_0x5849ed){return function(_0x559da8){if(_0x559da8){return _0x559da8[_0xa355('0x27')]()[_0xa355('0x26')](function(){var _0x5b6e49=_0x559da8['get']({'plain':!![]});var _0x33216a=_0xa355('0x28');return db[_0xa355('0x29')]['destroy']({'where':{'type':_0x33216a,'resourceId':_0x5b6e49['id']}})[_0xa355('0x26')](function(){return _0x559da8;});})[_0xa355('0x26')](function(){_0xef0c31['status'](0xcc)[_0xa355('0x1c')]();});}};}function handleEntityNotFound(_0x6ebdb2,_0x5b7d71){return function(_0x3e18aa){if(!_0x3e18aa){_0x6ebdb2[_0xa355('0x1a')](0x194);}return _0x3e18aa;};}function handleError(_0x16fb53,_0x406b5a){_0x406b5a=_0x406b5a||0x1f4;return function(_0x2dfacc){logger[_0xa355('0x2a')](_0x2dfacc[_0xa355('0x2b')]);if(_0x2dfacc[_0xa355('0x2c')]){delete _0x2dfacc[_0xa355('0x2c')];}_0x16fb53[_0xa355('0x1b')](_0x406b5a)[_0xa355('0x2d')](_0x2dfacc);};}exports[_0xa355('0x2e')]=function(_0x5a0a16,_0x12b789){var _0x194f4e={},_0x4afcd5={},_0x4eca37={'count':0x0,'rows':[]};var _0x3402ba=_[_0xa355('0x2f')](db[_0xa355('0x30')][_0xa355('0x31')],function(_0x4e097e){return{'name':_0x4e097e[_0xa355('0x32')],'type':_0x4e097e[_0xa355('0x33')]['key']};});_0x4afcd5[_0xa355('0x34')]=_[_0xa355('0x2f')](_0x3402ba,_0xa355('0x2c'));_0x4afcd5[_0xa355('0x35')]=_[_0xa355('0x36')](_0x5a0a16[_0xa355('0x35')]);_0x4afcd5[_0xa355('0x37')]=_[_0xa355('0x38')](_0x4afcd5[_0xa355('0x34')],_0x4afcd5['query']);_0x194f4e[_0xa355('0x39')]=_[_0xa355('0x38')](_0x4afcd5[_0xa355('0x34')],qs[_0xa355('0x3a')](_0x5a0a16[_0xa355('0x35')][_0xa355('0x3a')]));_0x194f4e[_0xa355('0x39')]=_0x194f4e[_0xa355('0x39')][_0xa355('0x3b')]?_0x194f4e['attributes']:_0x4afcd5[_0xa355('0x34')];if(!_0x5a0a16['query']['hasOwnProperty'](_0xa355('0x3c'))){_0x194f4e[_0xa355('0x20')]=qs[_0xa355('0x20')](_0x5a0a16['query']['limit']);_0x194f4e[_0xa355('0x1e')]=qs[_0xa355('0x1e')](_0x5a0a16[_0xa355('0x35')]['offset']);}_0x194f4e['order']=qs['sort'](_0x5a0a16[_0xa355('0x35')]['sort']);_0x194f4e[_0xa355('0x3d')]=qs[_0xa355('0x37')](_['pick'](_0x5a0a16[_0xa355('0x35')],_0x4afcd5[_0xa355('0x37')]),_0x3402ba);if(_0x5a0a16[_0xa355('0x35')][_0xa355('0x3e')]){_0x194f4e[_0xa355('0x3d')]=_[_0xa355('0x3f')](_0x194f4e[_0xa355('0x3d')],{'$or':_[_0xa355('0x2f')](_0x3402ba,function(_0xd6a229){if(_0xd6a229[_0xa355('0x33')]!==_0xa355('0x40')){var _0x2806a8={};_0x2806a8[_0xd6a229['name']]={'$like':'%'+_0x5a0a16[_0xa355('0x35')][_0xa355('0x3e')]+'%'};return _0x2806a8;}})});}_0x194f4e=_[_0xa355('0x3f')]({},_0x194f4e,_0x5a0a16[_0xa355('0x41')]);var _0x3e8b57={'where':_0x194f4e[_0xa355('0x3d')]};return db[_0xa355('0x30')][_0xa355('0x21')](_0x3e8b57)[_0xa355('0x26')](function(_0x7ffd09){_0x4eca37[_0xa355('0x21')]=_0x7ffd09;if(_0x5a0a16[_0xa355('0x35')]['includeAll']){_0x194f4e[_0xa355('0x42')]=[{'all':!![]}];}return db[_0xa355('0x30')][_0xa355('0x43')](_0x194f4e);})['then'](function(_0x52d1b5){_0x4eca37[_0xa355('0x44')]=_0x52d1b5;return _0x4eca37;})['then'](respondWithFilteredResult(_0x12b789,_0x194f4e))[_0xa355('0x45')](handleError(_0x12b789,null));};exports[_0xa355('0x46')]=function(_0x49efc1,_0x3f0643){var _0x1ce1d0={'raw':!![],'where':{'id':_0x49efc1[_0xa355('0x47')]['id']}},_0x2c90ed={};_0x2c90ed[_0xa355('0x34')]=_['keys'](db[_0xa355('0x30')][_0xa355('0x31')]);_0x2c90ed[_0xa355('0x35')]=_[_0xa355('0x36')](_0x49efc1[_0xa355('0x35')]);_0x2c90ed[_0xa355('0x37')]=_[_0xa355('0x38')](_0x2c90ed[_0xa355('0x34')],_0x2c90ed['query']);_0x1ce1d0[_0xa355('0x39')]=_['intersection'](_0x2c90ed[_0xa355('0x34')],qs['fields'](_0x49efc1[_0xa355('0x35')][_0xa355('0x3a')]));_0x1ce1d0[_0xa355('0x39')]=_0x1ce1d0['attributes'][_0xa355('0x3b')]?_0x1ce1d0[_0xa355('0x39')]:_0x2c90ed[_0xa355('0x34')];if(_0x49efc1['query'][_0xa355('0x48')]){_0x1ce1d0[_0xa355('0x42')]=[{'all':!![]}];}_0x1ce1d0=_[_0xa355('0x3f')]({},_0x1ce1d0,_0x49efc1[_0xa355('0x41')]);return db[_0xa355('0x30')][_0xa355('0x49')](_0x1ce1d0)[_0xa355('0x26')](handleEntityNotFound(_0x3f0643,null))[_0xa355('0x26')](respondWithResult(_0x3f0643,null))[_0xa355('0x45')](handleError(_0x3f0643,null));};exports['create']=function(_0x3c576c,_0x507f40){return db['CmContactHasItem'][_0xa355('0x4a')](_0x3c576c[_0xa355('0x4b')],{})[_0xa355('0x26')](function(_0x5ce5b8){var _0x4425f0=_0x3c576c[_0xa355('0x4c')][_0xa355('0x4d')]({'plain':!![]});if(!_0x4425f0)throw new Error(_0xa355('0x4e'));if(_0x4425f0[_0xa355('0x4f')]===_0xa355('0x4c')){var _0x3fc1b4=_0x5ce5b8[_0xa355('0x4d')]({'plain':!![]});var _0x549162=_0xa355('0x28');return db[_0xa355('0x50')]['find']({'where':{'name':_0x549162,'userProfileId':_0x4425f0['userProfileId']},'raw':!![]})[_0xa355('0x26')](function(_0x4d18c8){if(_0x4d18c8&&_0x4d18c8[_0xa355('0x51')]===0x0){return db[_0xa355('0x29')][_0xa355('0x4a')]({'name':_0x3fc1b4['name'],'resourceId':_0x3fc1b4['id'],'type':_0x4d18c8[_0xa355('0x2c')],'sectionId':_0x4d18c8['id']},{})[_0xa355('0x26')](function(){return _0x5ce5b8;});}else{return _0x5ce5b8;}})[_0xa355('0x45')](function(_0x6d1144){logger['error'](_0xa355('0x52'),_0x6d1144);throw _0x6d1144;});}return _0x5ce5b8;})[_0xa355('0x26')](respondWithResult(_0x507f40,0xc9))['catch'](handleError(_0x507f40,null));};exports['update']=function(_0x332028,_0x22b890){if(_0x332028[_0xa355('0x4b')]['id']){delete _0x332028[_0xa355('0x4b')]['id'];}return db[_0xa355('0x30')][_0xa355('0x49')]({'where':{'id':_0x332028[_0xa355('0x47')]['id']}})[_0xa355('0x26')](handleEntityNotFound(_0x22b890,null))['then'](saveUpdates(_0x332028[_0xa355('0x4b')],null))[_0xa355('0x26')](respondWithResult(_0x22b890,null))['catch'](handleError(_0x22b890,null));};exports['destroy']=function(_0xcefc70,_0x570692){return db[_0xa355('0x30')]['find']({'where':{'id':_0xcefc70[_0xa355('0x47')]['id']}})[_0xa355('0x26')](handleEntityNotFound(_0x570692,null))[_0xa355('0x26')](removeEntity(_0x570692,null))['catch'](handleError(_0x570692,null));}; \ No newline at end of file +var _0xad25=['includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CmContactHasItems','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','sendStatus','status','offset','limit','count','set','Content-Range','json','apply','reject','update','then','get','UserProfileResource','destroy','end','error','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','CmContactHasItem','rows','show','params'];(function(_0x154fda,_0x35676d){var _0x53c355=function(_0x4bd6df){while(--_0x4bd6df){_0x154fda['push'](_0x154fda['shift']());}};_0x53c355(++_0x35676d);}(_0xad25,0x161));var _0x5ad2=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0xad25[_0x4ae6ef];return _0x3cbb4e;};'use strict';var emlformat=require(_0x5ad2('0x0'));var rimraf=require(_0x5ad2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5ad2('0x2'));var rp=require(_0x5ad2('0x3'));var moment=require(_0x5ad2('0x4'));var BPromise=require(_0x5ad2('0x5'));var Mustache=require(_0x5ad2('0x6'));var util=require(_0x5ad2('0x7'));var path=require(_0x5ad2('0x8'));var sox=require(_0x5ad2('0x9'));var csv=require(_0x5ad2('0xa'));var ejs=require(_0x5ad2('0xb'));var fs=require('fs');var fs_extra=require(_0x5ad2('0xc'));var _=require(_0x5ad2('0xd'));var squel=require(_0x5ad2('0xe'));var crypto=require(_0x5ad2('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5ad2('0xa'));var querystring=require(_0x5ad2('0x10'));var Papa=require(_0x5ad2('0x11'));var Redis=require(_0x5ad2('0x12'));var authService=require(_0x5ad2('0x13'));var qs=require(_0x5ad2('0x14'));var as=require(_0x5ad2('0x15'));var hardwareService=require(_0x5ad2('0x16'));var logger=require('../../config/logger')(_0x5ad2('0x17'));var utils=require(_0x5ad2('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x12ea78,_0x1943c0){_0x1943c0=_0x1943c0||0xcc;return function(_0x587600){if(_0x587600){return _0x12ea78[_0x5ad2('0x19')](_0x1943c0);}return _0x12ea78[_0x5ad2('0x1a')](_0x1943c0)['end']();};}function respondWithResult(_0x3a2c98,_0x3bb439){_0x3bb439=_0x3bb439||0xc8;return function(_0x53c11a){if(_0x53c11a){return _0x3a2c98[_0x5ad2('0x1a')](_0x3bb439)['json'](_0x53c11a);}};}function respondWithFilteredResult(_0x229ea7,_0x16cfde){return function(_0x3e8189){if(_0x3e8189){var _0x355a7e=typeof _0x16cfde[_0x5ad2('0x1b')]==='undefined'&&typeof _0x16cfde[_0x5ad2('0x1c')]==='undefined';var _0x1bc735=_0x3e8189[_0x5ad2('0x1d')];var _0x2beefa=_0x355a7e?0x0:_0x16cfde[_0x5ad2('0x1b')];var _0x1ed24e=_0x355a7e?_0x3e8189['count']:_0x16cfde[_0x5ad2('0x1b')]+_0x16cfde[_0x5ad2('0x1c')];var _0x21e8f1;if(_0x1ed24e>=_0x1bc735){_0x1ed24e=_0x1bc735;_0x21e8f1=0xc8;}else{_0x21e8f1=0xce;}_0x229ea7[_0x5ad2('0x1a')](_0x21e8f1);return _0x229ea7[_0x5ad2('0x1e')](_0x5ad2('0x1f'),_0x2beefa+'-'+_0x1ed24e+'/'+_0x1bc735)[_0x5ad2('0x20')](_0x3e8189);}return null;};}function patchUpdates(_0x1ed06b){return function(_0x14f3b4){try{jsonpatch[_0x5ad2('0x21')](_0x14f3b4,_0x1ed06b,!![]);}catch(_0x29de51){return BPromise[_0x5ad2('0x22')](_0x29de51);}return _0x14f3b4['save']();};}function saveUpdates(_0x36e9c0,_0x5243e7){return function(_0x61415d){if(_0x61415d){return _0x61415d[_0x5ad2('0x23')](_0x36e9c0)[_0x5ad2('0x24')](function(_0x44dab3){return _0x44dab3;});}return null;};}function removeEntity(_0x5daece,_0x4b7f88){return function(_0x47632d){if(_0x47632d){return _0x47632d['destroy']()['then'](function(){var _0x50a20c=_0x47632d[_0x5ad2('0x25')]({'plain':!![]});var _0x8419d6='CmContactHasItems';return db[_0x5ad2('0x26')][_0x5ad2('0x27')]({'where':{'type':_0x8419d6,'resourceId':_0x50a20c['id']}})[_0x5ad2('0x24')](function(){return _0x47632d;});})['then'](function(){_0x5daece[_0x5ad2('0x1a')](0xcc)[_0x5ad2('0x28')]();});}};}function handleEntityNotFound(_0x3b0450,_0x21f238){return function(_0x5d9742){if(!_0x5d9742){_0x3b0450['sendStatus'](0x194);}return _0x5d9742;};}function handleError(_0x194984,_0x211a36){_0x211a36=_0x211a36||0x1f4;return function(_0x1d35f9){logger[_0x5ad2('0x29')](_0x1d35f9['stack']);if(_0x1d35f9[_0x5ad2('0x2a')]){delete _0x1d35f9[_0x5ad2('0x2a')];}_0x194984[_0x5ad2('0x1a')](_0x211a36)[_0x5ad2('0x2b')](_0x1d35f9);};}exports['index']=function(_0x4335a6,_0x533721){var _0x25ce4b={},_0x11d7c3={},_0x21ca7c={'count':0x0,'rows':[]};var _0x12978f=_[_0x5ad2('0x2c')](db['CmContactHasItem'][_0x5ad2('0x2d')],function(_0x22e71d){return{'name':_0x22e71d[_0x5ad2('0x2e')],'type':_0x22e71d[_0x5ad2('0x2f')][_0x5ad2('0x30')]};});_0x11d7c3[_0x5ad2('0x31')]=_[_0x5ad2('0x2c')](_0x12978f,_0x5ad2('0x2a'));_0x11d7c3[_0x5ad2('0x32')]=_[_0x5ad2('0x33')](_0x4335a6[_0x5ad2('0x32')]);_0x11d7c3['filters']=_[_0x5ad2('0x34')](_0x11d7c3['model'],_0x11d7c3[_0x5ad2('0x32')]);_0x25ce4b['attributes']=_[_0x5ad2('0x34')](_0x11d7c3['model'],qs[_0x5ad2('0x35')](_0x4335a6['query'][_0x5ad2('0x35')]));_0x25ce4b[_0x5ad2('0x36')]=_0x25ce4b[_0x5ad2('0x36')][_0x5ad2('0x37')]?_0x25ce4b[_0x5ad2('0x36')]:_0x11d7c3[_0x5ad2('0x31')];if(!_0x4335a6['query'][_0x5ad2('0x38')](_0x5ad2('0x39'))){_0x25ce4b['limit']=qs['limit'](_0x4335a6['query'][_0x5ad2('0x1c')]);_0x25ce4b[_0x5ad2('0x1b')]=qs[_0x5ad2('0x1b')](_0x4335a6[_0x5ad2('0x32')][_0x5ad2('0x1b')]);}_0x25ce4b[_0x5ad2('0x3a')]=qs[_0x5ad2('0x3b')](_0x4335a6['query'][_0x5ad2('0x3b')]);_0x25ce4b[_0x5ad2('0x3c')]=qs[_0x5ad2('0x3d')](_[_0x5ad2('0x3e')](_0x4335a6[_0x5ad2('0x32')],_0x11d7c3[_0x5ad2('0x3d')]),_0x12978f);if(_0x4335a6['query'][_0x5ad2('0x3f')]){_0x25ce4b[_0x5ad2('0x3c')]=_[_0x5ad2('0x40')](_0x25ce4b[_0x5ad2('0x3c')],{'$or':_[_0x5ad2('0x2c')](_0x12978f,function(_0x36e010){if(_0x36e010[_0x5ad2('0x2f')]!==_0x5ad2('0x41')){var _0x1f0dc6={};_0x1f0dc6[_0x36e010[_0x5ad2('0x2a')]]={'$like':'%'+_0x4335a6[_0x5ad2('0x32')]['filter']+'%'};return _0x1f0dc6;}})});}_0x25ce4b=_[_0x5ad2('0x40')]({},_0x25ce4b,_0x4335a6[_0x5ad2('0x42')]);var _0x16c8a7={'where':_0x25ce4b['where']};return db['CmContactHasItem'][_0x5ad2('0x1d')](_0x16c8a7)[_0x5ad2('0x24')](function(_0x5b0aa8){_0x21ca7c['count']=_0x5b0aa8;if(_0x4335a6[_0x5ad2('0x32')]['includeAll']){_0x25ce4b[_0x5ad2('0x43')]=[{'all':!![]}];}return db[_0x5ad2('0x44')]['findAll'](_0x25ce4b);})['then'](function(_0x4f6bbb){_0x21ca7c[_0x5ad2('0x45')]=_0x4f6bbb;return _0x21ca7c;})[_0x5ad2('0x24')](respondWithFilteredResult(_0x533721,_0x25ce4b))['catch'](handleError(_0x533721,null));};exports[_0x5ad2('0x46')]=function(_0x5212df,_0x21d505){var _0x546afd={'raw':!![],'where':{'id':_0x5212df[_0x5ad2('0x47')]['id']}},_0x2706ad={};_0x2706ad[_0x5ad2('0x31')]=_['keys'](db[_0x5ad2('0x44')][_0x5ad2('0x2d')]);_0x2706ad['query']=_[_0x5ad2('0x33')](_0x5212df[_0x5ad2('0x32')]);_0x2706ad[_0x5ad2('0x3d')]=_[_0x5ad2('0x34')](_0x2706ad[_0x5ad2('0x31')],_0x2706ad[_0x5ad2('0x32')]);_0x546afd['attributes']=_[_0x5ad2('0x34')](_0x2706ad[_0x5ad2('0x31')],qs['fields'](_0x5212df[_0x5ad2('0x32')][_0x5ad2('0x35')]));_0x546afd[_0x5ad2('0x36')]=_0x546afd[_0x5ad2('0x36')][_0x5ad2('0x37')]?_0x546afd[_0x5ad2('0x36')]:_0x2706ad[_0x5ad2('0x31')];if(_0x5212df[_0x5ad2('0x32')][_0x5ad2('0x48')]){_0x546afd[_0x5ad2('0x43')]=[{'all':!![]}];}_0x546afd=_['merge']({},_0x546afd,_0x5212df[_0x5ad2('0x42')]);return db[_0x5ad2('0x44')][_0x5ad2('0x49')](_0x546afd)['then'](handleEntityNotFound(_0x21d505,null))['then'](respondWithResult(_0x21d505,null))[_0x5ad2('0x4a')](handleError(_0x21d505,null));};exports[_0x5ad2('0x4b')]=function(_0x282bbf,_0x165e53){return db['CmContactHasItem']['create'](_0x282bbf[_0x5ad2('0x4c')],{})['then'](function(_0x2dac4c){var _0x2b7d9d=_0x282bbf[_0x5ad2('0x4d')][_0x5ad2('0x25')]({'plain':!![]});if(!_0x2b7d9d)throw new Error(_0x5ad2('0x4e'));if(_0x2b7d9d[_0x5ad2('0x4f')]==='user'){var _0x3a6706=_0x2dac4c[_0x5ad2('0x25')]({'plain':!![]});var _0xa462d3=_0x5ad2('0x50');return db[_0x5ad2('0x51')][_0x5ad2('0x49')]({'where':{'name':_0xa462d3,'userProfileId':_0x2b7d9d[_0x5ad2('0x52')]},'raw':!![]})[_0x5ad2('0x24')](function(_0x248104){if(_0x248104&&_0x248104[_0x5ad2('0x53')]===0x0){return db[_0x5ad2('0x26')][_0x5ad2('0x4b')]({'name':_0x3a6706['name'],'resourceId':_0x3a6706['id'],'type':_0x248104[_0x5ad2('0x2a')],'sectionId':_0x248104['id']},{})[_0x5ad2('0x24')](function(){return _0x2dac4c;});}else{return _0x2dac4c;}})['catch'](function(_0x1140f6){logger[_0x5ad2('0x29')](_0x5ad2('0x54'),_0x1140f6);throw _0x1140f6;});}return _0x2dac4c;})['then'](respondWithResult(_0x165e53,0xc9))['catch'](handleError(_0x165e53,null));};exports[_0x5ad2('0x23')]=function(_0x25cee7,_0x598315){if(_0x25cee7[_0x5ad2('0x4c')]['id']){delete _0x25cee7[_0x5ad2('0x4c')]['id'];}return db[_0x5ad2('0x44')][_0x5ad2('0x49')]({'where':{'id':_0x25cee7[_0x5ad2('0x47')]['id']}})[_0x5ad2('0x24')](handleEntityNotFound(_0x598315,null))[_0x5ad2('0x24')](saveUpdates(_0x25cee7[_0x5ad2('0x4c')],null))[_0x5ad2('0x24')](respondWithResult(_0x598315,null))[_0x5ad2('0x4a')](handleError(_0x598315,null));};exports[_0x5ad2('0x27')]=function(_0x55a55c,_0x302cc4){return db[_0x5ad2('0x44')][_0x5ad2('0x49')]({'where':{'id':_0x55a55c[_0x5ad2('0x47')]['id']}})[_0x5ad2('0x24')](handleEntityNotFound(_0x302cc4,null))[_0x5ad2('0x24')](removeEntity(_0x302cc4,null))[_0x5ad2('0x4a')](handleError(_0x302cc4,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 7750b75..eb8e59d 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 _0xb386=['cm_contact_has_items','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./cmContactHasItem.attributes','exports','define','CmContactHasItem'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0xb386,0x1bb));var _0x6b38=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xb386[_0x1928c9];return _0x51b5fb;};'use strict';var _=require(_0x6b38('0x0'));var util=require(_0x6b38('0x1'));var logger=require(_0x6b38('0x2'))(_0x6b38('0x3'));var moment=require(_0x6b38('0x4'));var BPromise=require(_0x6b38('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6b38('0x6'));var config=require(_0x6b38('0x7'));var attributes=require(_0x6b38('0x8'));module[_0x6b38('0x9')]=function(_0x2a4f09,_0x1778d4){return _0x2a4f09[_0x6b38('0xa')](_0x6b38('0xb'),attributes,{'tableName':_0x6b38('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x69b0=['lodash','../../config/logger','api','moment','path','rimraf','./cmContactHasItem.attributes','cm_contact_has_items'];(function(_0x3826ad,_0x49a30d){var _0x17b900=function(_0x38474f){while(--_0x38474f){_0x3826ad['push'](_0x3826ad['shift']());}};_0x17b900(++_0x49a30d);}(_0x69b0,0x170));var _0x069b=function(_0x57f100,_0xa53aca){_0x57f100=_0x57f100-0x0;var _0x4cac01=_0x69b0[_0x57f100];return _0x4cac01;};'use strict';var _=require(_0x069b('0x0'));var util=require('util');var logger=require(_0x069b('0x1'))(_0x069b('0x2'));var moment=require(_0x069b('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x069b('0x4'));var rimraf=require(_0x069b('0x5'));var config=require('../../config/environment');var attributes=require(_0x069b('0x6'));module['exports']=function(_0x5daba8,_0x32d943){return _0x5daba8['define']('CmContactHasItem',attributes,{'tableName':_0x069b('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index a6fe3e5..04d27e2 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 _0x8f5a=['CmContactHasItem,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','info','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x8e015d,_0x49893f){var _0x5c5653=function(_0x1e2abb){while(--_0x1e2abb){_0x8e015d['push'](_0x8e015d['shift']());}};_0x5c5653(++_0x49893f);}(_0x8f5a,0xe0));var _0xa8f5=function(_0x3e5c8f,_0x171c0a){_0x3e5c8f=_0x3e5c8f-0x0;var _0xbc9c20=_0x8f5a[_0x3e5c8f];return _0xbc9c20;};'use strict';var _=require(_0xa8f5('0x0'));var util=require(_0xa8f5('0x1'));var moment=require(_0xa8f5('0x2'));var BPromise=require('bluebird');var rs=require(_0xa8f5('0x3'));var fs=require('fs');var Redis=require(_0xa8f5('0x4'));var db=require(_0xa8f5('0x5'))['db'];var utils=require(_0xa8f5('0x6'));var logger=require('../../config/logger')(_0xa8f5('0x7'));var config=require(_0xa8f5('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa8f5('0x9')][_0xa8f5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x36beaa,_0x1bcf2c,_0x502847){return new BPromise(function(_0x59eabb,_0x14f67b){return client['request'](_0x36beaa,_0x502847)[_0xa8f5('0xb')](function(_0x26185e){logger[_0xa8f5('0xc')]('CmContactHasItem,\x20%s,\x20%s',_0x1bcf2c,_0xa8f5('0xd'));logger[_0xa8f5('0xe')](_0xa8f5('0xf'),_0x1bcf2c,_0xa8f5('0xd'),JSON['stringify'](_0x26185e));if(_0x26185e[_0xa8f5('0x10')]){if(_0x26185e['error'][_0xa8f5('0x11')]===0x1f4){logger[_0xa8f5('0x10')](_0xa8f5('0x12'),_0x1bcf2c,_0x26185e[_0xa8f5('0x10')][_0xa8f5('0x13')]);return _0x14f67b(_0x26185e[_0xa8f5('0x10')][_0xa8f5('0x13')]);}logger['error']('CmContactHasItem,\x20%s,\x20%s',_0x1bcf2c,_0x26185e[_0xa8f5('0x10')]['message']);return _0x59eabb(_0x26185e['error'][_0xa8f5('0x13')]);}else{logger[_0xa8f5('0xc')](_0xa8f5('0x12'),_0x1bcf2c,_0xa8f5('0xd'));_0x59eabb(_0x26185e[_0xa8f5('0x14')][_0xa8f5('0x13')]);}})[_0xa8f5('0x15')](function(_0x3bfc59){logger['error'](_0xa8f5('0x12'),_0x1bcf2c,_0x3bfc59);_0x14f67b(_0x3bfc59);});});} \ No newline at end of file +var _0x5e38=['CmContactHasItem,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','CmContactHasItem,\x20%s,\x20%s','message','result','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','debug'];(function(_0x491f42,_0x550f4c){var _0x318eb2=function(_0x5ac70f){while(--_0x5ac70f){_0x491f42['push'](_0x491f42['shift']());}};_0x318eb2(++_0x550f4c);}(_0x5e38,0x6b));var _0x85e3=function(_0x12e365,_0x2d4aa0){_0x12e365=_0x12e365-0x0;var _0x36d6d6=_0x5e38[_0x12e365];return _0x36d6d6;};'use strict';var _=require(_0x85e3('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x85e3('0x1'));var fs=require('fs');var Redis=require(_0x85e3('0x2'));var db=require(_0x85e3('0x3'))['db'];var utils=require(_0x85e3('0x4'));var logger=require(_0x85e3('0x5'))(_0x85e3('0x6'));var config=require(_0x85e3('0x7'));var jayson=require(_0x85e3('0x8'));var client=jayson[_0x85e3('0x9')][_0x85e3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1749b1,_0x43cd31,_0x1180e5){return new BPromise(function(_0x111f14,_0x48654c){return client['request'](_0x1749b1,_0x1180e5)['then'](function(_0x33cc0a){logger[_0x85e3('0xb')]('CmContactHasItem,\x20%s,\x20%s',_0x43cd31,'request\x20sent');logger[_0x85e3('0xc')](_0x85e3('0xd'),_0x43cd31,_0x85e3('0xe'),JSON['stringify'](_0x33cc0a));if(_0x33cc0a[_0x85e3('0xf')]){if(_0x33cc0a[_0x85e3('0xf')][_0x85e3('0x10')]===0x1f4){logger[_0x85e3('0xf')](_0x85e3('0x11'),_0x43cd31,_0x33cc0a[_0x85e3('0xf')]['message']);return _0x48654c(_0x33cc0a[_0x85e3('0xf')]['message']);}logger[_0x85e3('0xf')](_0x85e3('0x11'),_0x43cd31,_0x33cc0a[_0x85e3('0xf')][_0x85e3('0x12')]);return _0x111f14(_0x33cc0a[_0x85e3('0xf')][_0x85e3('0x12')]);}else{logger[_0x85e3('0xb')]('CmContactHasItem,\x20%s,\x20%s',_0x43cd31,_0x85e3('0xe'));_0x111f14(_0x33cc0a[_0x85e3('0x13')]['message']);}})['catch'](function(_0x5ede2c){logger[_0x85e3('0xf')](_0x85e3('0x11'),_0x43cd31,_0x5ede2c);_0x48654c(_0x5ede2c);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 1c842c0..2f7f7b9 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 _0x4600=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','isAuthenticated','/:id','show','post','create','put','update','delete','destroy'];(function(_0xa8883,_0x1f107f){var _0x479426=function(_0x4e56b9){while(--_0x4e56b9){_0xa8883['push'](_0xa8883['shift']());}};_0x479426(++_0x1f107f);}(_0x4600,0x191));var _0x0460=function(_0x4ba112,_0x25021c){_0x4ba112=_0x4ba112-0x0;var _0x7edcb9=_0x4600[_0x4ba112];return _0x7edcb9;};'use strict';var multer=require(_0x0460('0x0'));var util=require(_0x0460('0x1'));var path=require(_0x0460('0x2'));var timeout=require(_0x0460('0x3'));var express=require('express');var router=express[_0x0460('0x4')]();var fs_extra=require(_0x0460('0x5'));var auth=require(_0x0460('0x6'));var interaction=require(_0x0460('0x7'));var config=require(_0x0460('0x8'));var controller=require(_0x0460('0x9'));router['get']('/',auth[_0x0460('0xa')](),controller['index']);router['get'](_0x0460('0xb'),auth[_0x0460('0xa')](),controller[_0x0460('0xc')]);router[_0x0460('0xd')]('/',auth[_0x0460('0xa')](),controller[_0x0460('0xe')]);router[_0x0460('0xf')](_0x0460('0xb'),auth[_0x0460('0xa')](),controller[_0x0460('0x10')]);router[_0x0460('0x11')](_0x0460('0xb'),auth['isAuthenticated'](),controller[_0x0460('0x12')]);module[_0x0460('0x13')]=router; \ No newline at end of file +var _0x5837=['destroy','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmContactHasItem.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete'];(function(_0x112fe3,_0x16b642){var _0x1ec903=function(_0x1539eb){while(--_0x1539eb){_0x112fe3['push'](_0x112fe3['shift']());}};_0x1ec903(++_0x16b642);}(_0x5837,0x16a));var _0x7583=function(_0x377217,_0x26b013){_0x377217=_0x377217-0x0;var _0x26258d=_0x5837[_0x377217];return _0x26258d;};'use strict';var multer=require('multer');var util=require(_0x7583('0x0'));var path=require(_0x7583('0x1'));var timeout=require(_0x7583('0x2'));var express=require('express');var router=express[_0x7583('0x3')]();var fs_extra=require(_0x7583('0x4'));var auth=require(_0x7583('0x5'));var interaction=require(_0x7583('0x6'));var config=require('../../config/environment');var controller=require(_0x7583('0x7'));router['get']('/',auth[_0x7583('0x8')](),controller[_0x7583('0x9')]);router[_0x7583('0xa')](_0x7583('0xb'),auth[_0x7583('0x8')](),controller[_0x7583('0xc')]);router[_0x7583('0xd')]('/',auth['isAuthenticated'](),controller[_0x7583('0xe')]);router[_0x7583('0xf')]('/:id',auth[_0x7583('0x8')](),controller[_0x7583('0x10')]);router[_0x7583('0x11')](_0x7583('0xb'),auth[_0x7583('0x8')](),controller[_0x7583('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index f42c818..fdc7c26 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 _0x796f=['STRING','setDataValue','name','TEXT','long','type','select','values','isArray','stringify','BOOLEAN','ENUM','voice','sequelize','lodash','exports','getDataValue','alias'];(function(_0x162ab4,_0x578437){var _0x410f69=function(_0x350bfc){while(--_0x350bfc){_0x162ab4['push'](_0x162ab4['shift']());}};_0x410f69(++_0x578437);}(_0x796f,0xd3));var _0xf796=function(_0x406123,_0x20da0b){_0x406123=_0x406123-0x0;var _0x2e079e=_0x796f[_0x406123];return _0x2e079e;};'use strict';var Sequelize=require(_0xf796('0x0'));var _=require(_0xf796('0x1'));module[_0xf796('0x2')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x144012){return this[_0xf796('0x3')](_0xf796('0x4'));}},'alias':{'type':Sequelize[_0xf796('0x5')],'allowNull':![],'set':function(_0x348c64){this[_0xf796('0x6')](_0xf796('0x4'),_0x348c64?_0x348c64:this[_0xf796('0x3')](_0xf796('0x7')));}},'type':{'type':Sequelize[_0xf796('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0xf796('0x8')](_0xf796('0x9')),'get':function(){if(this[_0xf796('0x3')](_0xf796('0xa'))===_0xf796('0xb')){return JSON['parse'](this[_0xf796('0x3')](_0xf796('0xc')));}else{return this[_0xf796('0x3')](_0xf796('0xc'));}},'set':function(_0x202dff){if(Array[_0xf796('0xd')](_0x202dff)){this[_0xf796('0x6')](_0xf796('0xc'),JSON[_0xf796('0xe')](_0x202dff));}else{this[_0xf796('0x6')](_0xf796('0xc'),_0x202dff);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xf796('0xf')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xf796('0x10')](_0xf796('0x11'))}}; \ No newline at end of file +var _0x4c72=['name','STRING','TEXT','long','parse','values','stringify','BOOLEAN','ENUM','voice','exports','getDataValue','setDataValue','alias'];(function(_0x3ccc2b,_0x42df9d){var _0x27723e=function(_0x39b3e1){while(--_0x39b3e1){_0x3ccc2b['push'](_0x3ccc2b['shift']());}};_0x27723e(++_0x42df9d);}(_0x4c72,0x7a));var _0x24c7=function(_0x2303d5,_0x58022f){_0x2303d5=_0x2303d5-0x0;var _0x706c85=_0x4c72[_0x2303d5];return _0x706c85;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');module[_0x24c7('0x0')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x19d95e){return this[_0x24c7('0x1')]('alias');}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x15d984){this[_0x24c7('0x2')](_0x24c7('0x3'),_0x15d984?_0x15d984:this[_0x24c7('0x1')](_0x24c7('0x4')));}},'type':{'type':Sequelize[_0x24c7('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0x24c7('0x6')](_0x24c7('0x7')),'get':function(){if(this[_0x24c7('0x1')]('type')==='select'){return JSON[_0x24c7('0x8')](this['getDataValue'](_0x24c7('0x9')));}else{return this[_0x24c7('0x1')]('values');}},'set':function(_0x360993){if(Array['isArray'](_0x360993)){this[_0x24c7('0x2')](_0x24c7('0x9'),JSON[_0x24c7('0xa')](_0x360993));}else{this[_0x24c7('0x2')](_0x24c7('0x9'),_0x360993);}}},'required':{'type':Sequelize[_0x24c7('0xb')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0x24c7('0xc')](_0x24c7('0xd'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index ab9d7de..1c86db6 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 _0x9fd3=['count','set','Content-Range','json','apply','reject','update','then','destroy','error','name','send','index','map','CmCustomField','fieldName','type','key','query','keys','filters','intersection','fields','attributes','model','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','include','rows','show','params','rawAttributes','length','includeAll','find','catch','body','create','sequelize','Sequelize','TEXT','text','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','format','cf_%d','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x9fd3,0x141));var _0x39fd=function(_0x6419c0,_0xc09705){_0x6419c0=_0x6419c0-0x0;var _0x20a52f=_0x9fd3[_0x6419c0];return _0x20a52f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x39fd('0x0'));var zipdir=require(_0x39fd('0x1'));var jsonpatch=require(_0x39fd('0x2'));var rp=require('request-promise');var moment=require(_0x39fd('0x3'));var BPromise=require(_0x39fd('0x4'));var Mustache=require(_0x39fd('0x5'));var util=require(_0x39fd('0x6'));var path=require(_0x39fd('0x7'));var sox=require(_0x39fd('0x8'));var csv=require(_0x39fd('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x39fd('0xa'));var _=require(_0x39fd('0xb'));var squel=require(_0x39fd('0xc'));var crypto=require(_0x39fd('0xd'));var jsforce=require(_0x39fd('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x39fd('0x9'));var querystring=require('querystring');var Papa=require(_0x39fd('0xf'));var Redis=require(_0x39fd('0x10'));var authService=require(_0x39fd('0x11'));var qs=require(_0x39fd('0x12'));var as=require(_0x39fd('0x13'));var hardwareService=require(_0x39fd('0x14'));var logger=require(_0x39fd('0x15'))('api');var utils=require(_0x39fd('0x16'));var config=require(_0x39fd('0x17'));var licenseUtil=require(_0x39fd('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x177b7a,_0x3462b2){_0x3462b2=_0x3462b2||0xcc;return function(_0x5b186c){if(_0x5b186c){return _0x177b7a[_0x39fd('0x19')](_0x3462b2);}return _0x177b7a[_0x39fd('0x1a')](_0x3462b2)[_0x39fd('0x1b')]();};}function respondWithResult(_0x4fe325,_0x3532e6){_0x3532e6=_0x3532e6||0xc8;return function(_0x4ee5e1){if(_0x4ee5e1){return _0x4fe325[_0x39fd('0x1a')](_0x3532e6)['json'](_0x4ee5e1);}};}function respondWithFilteredResult(_0x4ca8d8,_0x5604bf){return function(_0xcf5f74){if(_0xcf5f74){var _0x490f41=typeof _0x5604bf[_0x39fd('0x1c')]===_0x39fd('0x1d')&&typeof _0x5604bf[_0x39fd('0x1e')]==='undefined';var _0x99665e=_0xcf5f74['count'];var _0x4c018d=_0x490f41?0x0:_0x5604bf[_0x39fd('0x1c')];var _0x23bfa2=_0x490f41?_0xcf5f74[_0x39fd('0x1f')]:_0x5604bf[_0x39fd('0x1c')]+_0x5604bf[_0x39fd('0x1e')];var _0x3c8fa8;if(_0x23bfa2>=_0x99665e){_0x23bfa2=_0x99665e;_0x3c8fa8=0xc8;}else{_0x3c8fa8=0xce;}_0x4ca8d8[_0x39fd('0x1a')](_0x3c8fa8);return _0x4ca8d8[_0x39fd('0x20')](_0x39fd('0x21'),_0x4c018d+'-'+_0x23bfa2+'/'+_0x99665e)[_0x39fd('0x22')](_0xcf5f74);}return null;};}function patchUpdates(_0x2d5cc8){return function(_0x50d77e){try{jsonpatch[_0x39fd('0x23')](_0x50d77e,_0x2d5cc8,!![]);}catch(_0x6ea82a){return BPromise[_0x39fd('0x24')](_0x6ea82a);}return _0x50d77e['save']();};}function saveUpdates(_0x2e149d,_0x16c1cd){return function(_0x1c88d1){if(_0x1c88d1){return _0x1c88d1[_0x39fd('0x25')](_0x2e149d)[_0x39fd('0x26')](function(_0x221552){return _0x221552;});}return null;};}function removeEntity(_0x46ff02,_0x47b41b){return function(_0x46f03a){if(_0x46f03a){return _0x46f03a[_0x39fd('0x27')]()[_0x39fd('0x26')](function(){_0x46ff02[_0x39fd('0x1a')](0xcc)[_0x39fd('0x1b')]();});}};}function handleEntityNotFound(_0x241bff,_0x46c5cd){return function(_0x4f9023){if(!_0x4f9023){_0x241bff[_0x39fd('0x19')](0x194);}return _0x4f9023;};}function handleError(_0x49c33e,_0x2b573e){_0x2b573e=_0x2b573e||0x1f4;return function(_0x54a0d0){logger[_0x39fd('0x28')](_0x54a0d0['stack']);if(_0x54a0d0[_0x39fd('0x29')]){delete _0x54a0d0[_0x39fd('0x29')];}_0x49c33e[_0x39fd('0x1a')](_0x2b573e)[_0x39fd('0x2a')](_0x54a0d0);};}exports[_0x39fd('0x2b')]=function(_0x2d62e7,_0x234eff){var _0x4c7786={},_0xff3326={},_0x25c739={'count':0x0,'rows':[]};var _0x14d9f3=_[_0x39fd('0x2c')](db[_0x39fd('0x2d')]['rawAttributes'],function(_0x47b965){return{'name':_0x47b965[_0x39fd('0x2e')],'type':_0x47b965[_0x39fd('0x2f')][_0x39fd('0x30')]};});_0xff3326['model']=_['differenceBy'](_[_0x39fd('0x2c')](_0x14d9f3,_0x39fd('0x29')),[_0x39fd('0x29')]);_0xff3326[_0x39fd('0x31')]=_[_0x39fd('0x32')](_0x2d62e7[_0x39fd('0x31')]);_0xff3326[_0x39fd('0x33')]=_[_0x39fd('0x34')](_0xff3326['model'],_0xff3326[_0x39fd('0x31')]);_0x4c7786['attributes']=_[_0x39fd('0x34')](_0xff3326['model'],qs[_0x39fd('0x35')](_0x2d62e7['query']['fields']));_0x4c7786[_0x39fd('0x36')]=_0x4c7786[_0x39fd('0x36')]['length']?_0x4c7786[_0x39fd('0x36')]:_0xff3326[_0x39fd('0x37')];if(!_0x2d62e7[_0x39fd('0x31')][_0x39fd('0x38')](_0x39fd('0x39'))){_0x4c7786['limit']=qs[_0x39fd('0x1e')](_0x2d62e7[_0x39fd('0x31')]['limit']);_0x4c7786['offset']=qs['offset'](_0x2d62e7['query'][_0x39fd('0x1c')]);}_0x4c7786[_0x39fd('0x3a')]=qs[_0x39fd('0x3b')](_0x2d62e7[_0x39fd('0x31')]['sort']);_0x4c7786[_0x39fd('0x3c')]=qs['filters'](_['pick'](_0x2d62e7[_0x39fd('0x31')],_0xff3326[_0x39fd('0x33')]),_0x14d9f3);if(_0x2d62e7[_0x39fd('0x31')]['filter']){_0x4c7786[_0x39fd('0x3c')]=_[_0x39fd('0x3d')](_0x4c7786['where'],{'$or':_[_0x39fd('0x2c')](_0x14d9f3,function(_0x23dd74){if(_0x23dd74[_0x39fd('0x2f')]!==_0x39fd('0x3e')){var _0x5c0c62={};_0x5c0c62[_0x23dd74[_0x39fd('0x29')]]={'$like':'%'+_0x2d62e7[_0x39fd('0x31')][_0x39fd('0x3f')]+'%'};return _0x5c0c62;}})});}_0x4c7786=_['merge']({},_0x4c7786,_0x2d62e7[_0x39fd('0x40')]);var _0x1597f7={'where':_0x4c7786[_0x39fd('0x3c')]};return db[_0x39fd('0x2d')][_0x39fd('0x1f')](_0x1597f7)[_0x39fd('0x26')](function(_0x6abfb5){_0x25c739[_0x39fd('0x1f')]=_0x6abfb5;if(_0x2d62e7[_0x39fd('0x31')]['includeAll']){_0x4c7786[_0x39fd('0x41')]=[{'all':!![]}];}return db[_0x39fd('0x2d')]['findAll'](_0x4c7786);})['then'](function(_0x5c3c8f){_0x25c739[_0x39fd('0x42')]=_0x5c3c8f;return _0x25c739;})['then'](respondWithFilteredResult(_0x234eff,_0x4c7786))['catch'](handleError(_0x234eff,null));};exports[_0x39fd('0x43')]=function(_0x3dfba8,_0x5221bd){var _0x437712={'raw':!![],'where':{'id':_0x3dfba8[_0x39fd('0x44')]['id']}},_0x815dbd={};_0x815dbd[_0x39fd('0x37')]=_['keys'](db['CmCustomField'][_0x39fd('0x45')]);_0x815dbd['query']=_[_0x39fd('0x32')](_0x3dfba8[_0x39fd('0x31')]);_0x815dbd['filters']=_['intersection'](_0x815dbd[_0x39fd('0x37')],_0x815dbd[_0x39fd('0x31')]);_0x437712[_0x39fd('0x36')]=_['intersection'](_0x815dbd[_0x39fd('0x37')],qs[_0x39fd('0x35')](_0x3dfba8[_0x39fd('0x31')][_0x39fd('0x35')]));_0x437712[_0x39fd('0x36')]=_0x437712[_0x39fd('0x36')][_0x39fd('0x46')]?_0x437712[_0x39fd('0x36')]:_0x815dbd['model'];if(_0x3dfba8[_0x39fd('0x31')][_0x39fd('0x47')]){_0x437712[_0x39fd('0x41')]=[{'all':!![]}];}_0x437712=_['merge']({},_0x437712,_0x3dfba8['options']);return db['CmCustomField'][_0x39fd('0x48')](_0x437712)[_0x39fd('0x26')](handleEntityNotFound(_0x5221bd,null))[_0x39fd('0x26')](respondWithResult(_0x5221bd,null))[_0x39fd('0x49')](handleError(_0x5221bd,null));};exports['update']=function(_0x32d8c6,_0x45fe7e){if(_0x32d8c6[_0x39fd('0x4a')]['id']){delete _0x32d8c6[_0x39fd('0x4a')]['id'];}return db[_0x39fd('0x2d')]['find']({'where':{'id':_0x32d8c6[_0x39fd('0x44')]['id']}})['then'](handleEntityNotFound(_0x45fe7e,null))[_0x39fd('0x26')](saveUpdates(_0x32d8c6[_0x39fd('0x4a')],null))[_0x39fd('0x26')](respondWithResult(_0x45fe7e,null))['catch'](handleError(_0x45fe7e,null));};exports[_0x39fd('0x27')]=function(_0x4254cf,_0x47b2eb){return db[_0x39fd('0x2d')][_0x39fd('0x48')]({'where':{'id':_0x4254cf['params']['id']}})['then'](handleEntityNotFound(_0x47b2eb,null))['then'](removeEntity(_0x47b2eb,null))[_0x39fd('0x49')](handleError(_0x47b2eb,null));};exports[_0x39fd('0x4b')]=function(_0x3d4791,_0x2c05a0){var _0x2cb0c7;return db[_0x39fd('0x4c')]['transaction'](function(_0x7f4340){return db[_0x39fd('0x2d')][_0x39fd('0x4b')](_0x3d4791[_0x39fd('0x4a')],{'transaction':_0x7f4340})['then'](function(_0x535ef3){_0x2cb0c7=_0x535ef3;var _0x3882af={'type':db[_0x39fd('0x4d')][_0x39fd('0x4e')],'transaction':_0x7f4340};switch(_0x3d4791[_0x39fd('0x4a')]['type']){case _0x39fd('0x4f'):_0x3882af[_0x39fd('0x2f')]=db[_0x39fd('0x4d')][_0x39fd('0x4e')];break;case'number':_0x3882af[_0x39fd('0x2f')]=db[_0x39fd('0x4d')]['INTEGER'];break;case _0x39fd('0x50'):_0x3882af[_0x39fd('0x2f')]=db['Sequelize'][_0x39fd('0x51')];_0x3882af[_0x39fd('0x52')]=![];break;default:}return db[_0x39fd('0x4c')][_0x39fd('0x53')][_0x39fd('0x54')](_0x39fd('0x55'),util[_0x39fd('0x56')](_0x39fd('0x57'),_0x2cb0c7['id']),_0x3882af);})[_0x39fd('0x26')](function(){return _0x2cb0c7;});})[_0x39fd('0x26')](respondWithResult(_0x2c05a0,0xc9))[_0x39fd('0x49')](handleError(_0x2c05a0,null));}; \ No newline at end of file +var _0x1d42=['fieldName','type','query','filters','intersection','model','attributes','length','nolimit','order','pick','filter','where','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','catch','params','keys','fields','find','update','body','destroy','create','sequelize','transaction','Sequelize','TEXT','number','INTEGER','switch','BOOLEAN','defaultValue','cm_contacts','format','zip-dir','fast-json-patch','request-promise','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','save','then','error','stack','name','index','map','CmCustomField','rawAttributes'];(function(_0x42bfb7,_0x25a3ec){var _0x5c497d=function(_0x48e83e){while(--_0x48e83e){_0x42bfb7['push'](_0x42bfb7['shift']());}};_0x5c497d(++_0x25a3ec);}(_0x1d42,0x11f));var _0x21d4=function(_0x22074d,_0x33df85){_0x22074d=_0x22074d-0x0;var _0x3a24ce=_0x1d42[_0x22074d];return _0x3a24ce;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x21d4('0x0'));var jsonpatch=require(_0x21d4('0x1'));var rp=require(_0x21d4('0x2'));var moment=require('moment');var BPromise=require(_0x21d4('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x21d4('0x4'));var csv=require(_0x21d4('0x5'));var ejs=require(_0x21d4('0x6'));var fs=require('fs');var fs_extra=require(_0x21d4('0x7'));var _=require(_0x21d4('0x8'));var squel=require(_0x21d4('0x9'));var crypto=require(_0x21d4('0xa'));var jsforce=require(_0x21d4('0xb'));var deskjs=require(_0x21d4('0xc'));var toCsv=require(_0x21d4('0x5'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x21d4('0xd'));var authService=require(_0x21d4('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x21d4('0xf'));var logger=require(_0x21d4('0x10'))(_0x21d4('0x11'));var utils=require(_0x21d4('0x12'));var config=require(_0x21d4('0x13'));var licenseUtil=require(_0x21d4('0x14'));var db=require(_0x21d4('0x15'))['db'];function respondWithStatusCode(_0x48d5d8,_0x1fce36){_0x1fce36=_0x1fce36||0xcc;return function(_0x743893){if(_0x743893){return _0x48d5d8[_0x21d4('0x16')](_0x1fce36);}return _0x48d5d8[_0x21d4('0x17')](_0x1fce36)[_0x21d4('0x18')]();};}function respondWithResult(_0x3d23d3,_0x4c39a1){_0x4c39a1=_0x4c39a1||0xc8;return function(_0x2e2967){if(_0x2e2967){return _0x3d23d3[_0x21d4('0x17')](_0x4c39a1)[_0x21d4('0x19')](_0x2e2967);}};}function respondWithFilteredResult(_0x3ee338,_0x2785bb){return function(_0xcb673){if(_0xcb673){var _0x475626=typeof _0x2785bb[_0x21d4('0x1a')]===_0x21d4('0x1b')&&typeof _0x2785bb[_0x21d4('0x1c')]===_0x21d4('0x1b');var _0x1b46a4=_0xcb673['count'];var _0x42cce5=_0x475626?0x0:_0x2785bb[_0x21d4('0x1a')];var _0x5002c9=_0x475626?_0xcb673['count']:_0x2785bb[_0x21d4('0x1a')]+_0x2785bb[_0x21d4('0x1c')];var _0x335fba;if(_0x5002c9>=_0x1b46a4){_0x5002c9=_0x1b46a4;_0x335fba=0xc8;}else{_0x335fba=0xce;}_0x3ee338[_0x21d4('0x17')](_0x335fba);return _0x3ee338[_0x21d4('0x1d')](_0x21d4('0x1e'),_0x42cce5+'-'+_0x5002c9+'/'+_0x1b46a4)[_0x21d4('0x19')](_0xcb673);}return null;};}function patchUpdates(_0x59dcae){return function(_0x4701ef){try{jsonpatch[_0x21d4('0x1f')](_0x4701ef,_0x59dcae,!![]);}catch(_0x18f661){return BPromise['reject'](_0x18f661);}return _0x4701ef[_0x21d4('0x20')]();};}function saveUpdates(_0x109862,_0x43e7fa){return function(_0x5e817b){if(_0x5e817b){return _0x5e817b['update'](_0x109862)[_0x21d4('0x21')](function(_0x2dacf1){return _0x2dacf1;});}return null;};}function removeEntity(_0x27b10f,_0x1ca4d1){return function(_0xdbbaec){if(_0xdbbaec){return _0xdbbaec['destroy']()[_0x21d4('0x21')](function(){_0x27b10f[_0x21d4('0x17')](0xcc)[_0x21d4('0x18')]();});}};}function handleEntityNotFound(_0x921fee,_0x5bcf13){return function(_0x3e7a8f){if(!_0x3e7a8f){_0x921fee['sendStatus'](0x194);}return _0x3e7a8f;};}function handleError(_0x5b7f95,_0x193241){_0x193241=_0x193241||0x1f4;return function(_0x25455c){logger[_0x21d4('0x22')](_0x25455c[_0x21d4('0x23')]);if(_0x25455c['name']){delete _0x25455c[_0x21d4('0x24')];}_0x5b7f95[_0x21d4('0x17')](_0x193241)['send'](_0x25455c);};}exports[_0x21d4('0x25')]=function(_0x47c64c,_0x468b23){var _0x28e0ed={},_0x1b7bbb={},_0x46bee5={'count':0x0,'rows':[]};var _0x66c780=_[_0x21d4('0x26')](db[_0x21d4('0x27')][_0x21d4('0x28')],function(_0x220476){return{'name':_0x220476[_0x21d4('0x29')],'type':_0x220476[_0x21d4('0x2a')]['key']};});_0x1b7bbb['model']=_['differenceBy'](_[_0x21d4('0x26')](_0x66c780,_0x21d4('0x24')),['name']);_0x1b7bbb[_0x21d4('0x2b')]=_['keys'](_0x47c64c[_0x21d4('0x2b')]);_0x1b7bbb[_0x21d4('0x2c')]=_[_0x21d4('0x2d')](_0x1b7bbb[_0x21d4('0x2e')],_0x1b7bbb['query']);_0x28e0ed[_0x21d4('0x2f')]=_[_0x21d4('0x2d')](_0x1b7bbb[_0x21d4('0x2e')],qs['fields'](_0x47c64c[_0x21d4('0x2b')]['fields']));_0x28e0ed[_0x21d4('0x2f')]=_0x28e0ed[_0x21d4('0x2f')][_0x21d4('0x30')]?_0x28e0ed['attributes']:_0x1b7bbb[_0x21d4('0x2e')];if(!_0x47c64c['query']['hasOwnProperty'](_0x21d4('0x31'))){_0x28e0ed[_0x21d4('0x1c')]=qs[_0x21d4('0x1c')](_0x47c64c['query'][_0x21d4('0x1c')]);_0x28e0ed[_0x21d4('0x1a')]=qs[_0x21d4('0x1a')](_0x47c64c['query']['offset']);}_0x28e0ed[_0x21d4('0x32')]=qs['sort'](_0x47c64c[_0x21d4('0x2b')]['sort']);_0x28e0ed['where']=qs[_0x21d4('0x2c')](_[_0x21d4('0x33')](_0x47c64c[_0x21d4('0x2b')],_0x1b7bbb[_0x21d4('0x2c')]),_0x66c780);if(_0x47c64c['query'][_0x21d4('0x34')]){_0x28e0ed[_0x21d4('0x35')]=_['merge'](_0x28e0ed[_0x21d4('0x35')],{'$or':_['map'](_0x66c780,function(_0x154b8b){if(_0x154b8b['type']!==_0x21d4('0x36')){var _0x425eee={};_0x425eee[_0x154b8b['name']]={'$like':'%'+_0x47c64c[_0x21d4('0x2b')][_0x21d4('0x34')]+'%'};return _0x425eee;}})});}_0x28e0ed=_[_0x21d4('0x37')]({},_0x28e0ed,_0x47c64c[_0x21d4('0x38')]);var _0x5a8bba={'where':_0x28e0ed['where']};return db[_0x21d4('0x27')][_0x21d4('0x39')](_0x5a8bba)[_0x21d4('0x21')](function(_0x3cc87d){_0x46bee5[_0x21d4('0x39')]=_0x3cc87d;if(_0x47c64c[_0x21d4('0x2b')][_0x21d4('0x3a')]){_0x28e0ed[_0x21d4('0x3b')]=[{'all':!![]}];}return db[_0x21d4('0x27')][_0x21d4('0x3c')](_0x28e0ed);})[_0x21d4('0x21')](function(_0x16fffa){_0x46bee5[_0x21d4('0x3d')]=_0x16fffa;return _0x46bee5;})[_0x21d4('0x21')](respondWithFilteredResult(_0x468b23,_0x28e0ed))[_0x21d4('0x3e')](handleError(_0x468b23,null));};exports['show']=function(_0xcbe9c1,_0x11ad8c){var _0x347585={'raw':!![],'where':{'id':_0xcbe9c1[_0x21d4('0x3f')]['id']}},_0x36ef86={};_0x36ef86[_0x21d4('0x2e')]=_[_0x21d4('0x40')](db[_0x21d4('0x27')]['rawAttributes']);_0x36ef86['query']=_[_0x21d4('0x40')](_0xcbe9c1['query']);_0x36ef86[_0x21d4('0x2c')]=_[_0x21d4('0x2d')](_0x36ef86[_0x21d4('0x2e')],_0x36ef86['query']);_0x347585[_0x21d4('0x2f')]=_['intersection'](_0x36ef86['model'],qs[_0x21d4('0x41')](_0xcbe9c1['query'][_0x21d4('0x41')]));_0x347585['attributes']=_0x347585[_0x21d4('0x2f')][_0x21d4('0x30')]?_0x347585[_0x21d4('0x2f')]:_0x36ef86['model'];if(_0xcbe9c1[_0x21d4('0x2b')][_0x21d4('0x3a')]){_0x347585[_0x21d4('0x3b')]=[{'all':!![]}];}_0x347585=_[_0x21d4('0x37')]({},_0x347585,_0xcbe9c1[_0x21d4('0x38')]);return db[_0x21d4('0x27')][_0x21d4('0x42')](_0x347585)[_0x21d4('0x21')](handleEntityNotFound(_0x11ad8c,null))[_0x21d4('0x21')](respondWithResult(_0x11ad8c,null))[_0x21d4('0x3e')](handleError(_0x11ad8c,null));};exports[_0x21d4('0x43')]=function(_0x35003a,_0x23b7b1){if(_0x35003a['body']['id']){delete _0x35003a[_0x21d4('0x44')]['id'];}return db[_0x21d4('0x27')]['find']({'where':{'id':_0x35003a[_0x21d4('0x3f')]['id']}})[_0x21d4('0x21')](handleEntityNotFound(_0x23b7b1,null))['then'](saveUpdates(_0x35003a['body'],null))[_0x21d4('0x21')](respondWithResult(_0x23b7b1,null))['catch'](handleError(_0x23b7b1,null));};exports[_0x21d4('0x45')]=function(_0x3544c8,_0x12c8fb){return db[_0x21d4('0x27')][_0x21d4('0x42')]({'where':{'id':_0x3544c8[_0x21d4('0x3f')]['id']}})['then'](handleEntityNotFound(_0x12c8fb,null))[_0x21d4('0x21')](removeEntity(_0x12c8fb,null))['catch'](handleError(_0x12c8fb,null));};exports[_0x21d4('0x46')]=function(_0x42032e,_0x18af8f){var _0xae25a5;return db[_0x21d4('0x47')][_0x21d4('0x48')](function(_0x425a33){return db['CmCustomField'][_0x21d4('0x46')](_0x42032e[_0x21d4('0x44')],{'transaction':_0x425a33})[_0x21d4('0x21')](function(_0xb419c1){_0xae25a5=_0xb419c1;var _0x24ca37={'type':db[_0x21d4('0x49')][_0x21d4('0x4a')],'transaction':_0x425a33};switch(_0x42032e[_0x21d4('0x44')][_0x21d4('0x2a')]){case'text':_0x24ca37['type']=db[_0x21d4('0x49')][_0x21d4('0x4a')];break;case _0x21d4('0x4b'):_0x24ca37[_0x21d4('0x2a')]=db[_0x21d4('0x49')][_0x21d4('0x4c')];break;case _0x21d4('0x4d'):_0x24ca37['type']=db['Sequelize'][_0x21d4('0x4e')];_0x24ca37[_0x21d4('0x4f')]=![];break;default:}return db[_0x21d4('0x47')]['queryInterface']['addColumn'](_0x21d4('0x50'),util[_0x21d4('0x51')]('cf_%d',_0xae25a5['id']),_0x24ca37);})[_0x21d4('0x21')](function(){return _0xae25a5;});})[_0x21d4('0x21')](respondWithResult(_0x18af8f,0xc9))['catch'](handleError(_0x18af8f,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 349c24c..63e8f22 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 _0xc49f=['exports','define','CmCustomField','cm_custom_fields','lodash','../../config/logger','api','bluebird','rimraf','./cmCustomField.attributes'];(function(_0x44c340,_0x575719){var _0x2cd080=function(_0x1109ea){while(--_0x1109ea){_0x44c340['push'](_0x44c340['shift']());}};_0x2cd080(++_0x575719);}(_0xc49f,0x108));var _0xfc49=function(_0x542ce8,_0x475277){_0x542ce8=_0x542ce8-0x0;var _0x2409eb=_0xc49f[_0x542ce8];return _0x2409eb;};'use strict';var _=require(_0xfc49('0x0'));var util=require('util');var logger=require(_0xfc49('0x1'))(_0xfc49('0x2'));var moment=require('moment');var BPromise=require(_0xfc49('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xfc49('0x4'));var config=require('../../config/environment');var attributes=require(_0xfc49('0x5'));module[_0xfc49('0x6')]=function(_0x4bfaca,_0x219626){return _0x4bfaca[_0xfc49('0x7')](_0xfc49('0x8'),attributes,{'tableName':_0xfc49('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5a76=['rimraf','../../config/environment','./cmCustomField.attributes','exports','define','cm_custom_fields','lodash','util','../../config/logger','bluebird','request-promise','path'];(function(_0x55e0f9,_0x467637){var _0x41d3ca=function(_0x159017){while(--_0x159017){_0x55e0f9['push'](_0x55e0f9['shift']());}};_0x41d3ca(++_0x467637);}(_0x5a76,0x96));var _0x65a7=function(_0xba29e8,_0x30af74){_0xba29e8=_0xba29e8-0x0;var _0x561406=_0x5a76[_0xba29e8];return _0x561406;};'use strict';var _=require(_0x65a7('0x0'));var util=require(_0x65a7('0x1'));var logger=require(_0x65a7('0x2'))('api');var moment=require('moment');var BPromise=require(_0x65a7('0x3'));var rp=require(_0x65a7('0x4'));var fs=require('fs');var path=require(_0x65a7('0x5'));var rimraf=require(_0x65a7('0x6'));var config=require(_0x65a7('0x7'));var attributes=require(_0x65a7('0x8'));module[_0x65a7('0x9')]=function(_0x252930,_0x2683a6){return _0x252930[_0x65a7('0xa')]('CmCustomField',attributes,{'tableName':_0x65a7('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index 10bdaf8..ea956fb 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 _0xf087=['CmCustomField,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x529e13,_0x232c89){var _0x275b55=function(_0x420d4f){while(--_0x420d4f){_0x529e13['push'](_0x529e13['shift']());}};_0x275b55(++_0x232c89);}(_0xf087,0x198));var _0x7f08=function(_0x4cdd6e,_0x542cd2){_0x4cdd6e=_0x4cdd6e-0x0;var _0x130abf=_0xf087[_0x4cdd6e];return _0x130abf;};'use strict';var _=require(_0x7f08('0x0'));var util=require(_0x7f08('0x1'));var moment=require(_0x7f08('0x2'));var BPromise=require(_0x7f08('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7f08('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7f08('0x5'));var logger=require(_0x7f08('0x6'))(_0x7f08('0x7'));var config=require(_0x7f08('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7f08('0x9')][_0x7f08('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x8fde10,_0x4fd6b6,_0x1a41e8){return new BPromise(function(_0x7f470a,_0x150a2f){return client[_0x7f08('0xb')](_0x8fde10,_0x1a41e8)['then'](function(_0x168860){logger['info'](_0x7f08('0xc'),_0x4fd6b6,_0x7f08('0xd'));logger[_0x7f08('0xe')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x4fd6b6,_0x7f08('0xd'),JSON[_0x7f08('0xf')](_0x168860));if(_0x168860['error']){if(_0x168860['error'][_0x7f08('0x10')]===0x1f4){logger[_0x7f08('0x11')](_0x7f08('0xc'),_0x4fd6b6,_0x168860[_0x7f08('0x11')]['message']);return _0x150a2f(_0x168860[_0x7f08('0x11')][_0x7f08('0x12')]);}logger['error'](_0x7f08('0xc'),_0x4fd6b6,_0x168860[_0x7f08('0x11')][_0x7f08('0x12')]);return _0x7f470a(_0x168860[_0x7f08('0x11')][_0x7f08('0x12')]);}else{logger['info']('CmCustomField,\x20%s,\x20%s',_0x4fd6b6,_0x7f08('0xd'));_0x7f470a(_0x168860[_0x7f08('0x13')]['message']);}})[_0x7f08('0x14')](function(_0x1d52d5){logger[_0x7f08('0x11')](_0x7f08('0xc'),_0x4fd6b6,_0x1d52d5);_0x150a2f(_0x1d52d5);});});} \ No newline at end of file +var _0x5f06=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x135c3b,_0x2024c2){var _0x2b67d6=function(_0x43e38a){while(--_0x43e38a){_0x135c3b['push'](_0x135c3b['shift']());}};_0x2b67d6(++_0x2024c2);}(_0x5f06,0x17a));var _0x65f0=function(_0x3aa5f3,_0x9ae1d8){_0x3aa5f3=_0x3aa5f3-0x0;var _0x434feb=_0x5f06[_0x3aa5f3];return _0x434feb;};'use strict';var _=require(_0x65f0('0x0'));var util=require(_0x65f0('0x1'));var moment=require(_0x65f0('0x2'));var BPromise=require(_0x65f0('0x3'));var rs=require(_0x65f0('0x4'));var fs=require('fs');var Redis=require(_0x65f0('0x5'));var db=require(_0x65f0('0x6'))['db'];var utils=require(_0x65f0('0x7'));var logger=require('../../config/logger')(_0x65f0('0x8'));var config=require(_0x65f0('0x9'));var jayson=require(_0x65f0('0xa'));var client=jayson[_0x65f0('0xb')][_0x65f0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x49b617,_0x450347,_0x3bd1a1){return new BPromise(function(_0xf31d00,_0x5b2485){return client[_0x65f0('0xd')](_0x49b617,_0x3bd1a1)['then'](function(_0x114fa4){logger[_0x65f0('0xe')](_0x65f0('0xf'),_0x450347,_0x65f0('0x10'));logger[_0x65f0('0x11')](_0x65f0('0x12'),_0x450347,_0x65f0('0x10'),JSON['stringify'](_0x114fa4));if(_0x114fa4[_0x65f0('0x13')]){if(_0x114fa4[_0x65f0('0x13')][_0x65f0('0x14')]===0x1f4){logger[_0x65f0('0x13')]('CmCustomField,\x20%s,\x20%s',_0x450347,_0x114fa4[_0x65f0('0x13')][_0x65f0('0x15')]);return _0x5b2485(_0x114fa4[_0x65f0('0x13')]['message']);}logger[_0x65f0('0x13')](_0x65f0('0xf'),_0x450347,_0x114fa4[_0x65f0('0x13')][_0x65f0('0x15')]);return _0xf31d00(_0x114fa4[_0x65f0('0x13')][_0x65f0('0x15')]);}else{logger[_0x65f0('0xe')]('CmCustomField,\x20%s,\x20%s',_0x450347,_0x65f0('0x10'));_0xf31d00(_0x114fa4[_0x65f0('0x16')][_0x65f0('0x15')]);}})[_0x65f0('0x17')](function(_0x211090){logger[_0x65f0('0x13')](_0x65f0('0xf'),_0x450347,_0x211090);_0x5b2485(_0x211090);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index d57e560..d0ea9c5 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 _0x28e3=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','show','post','create','/:id','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x28e3,0x106));var _0x328e=function(_0x2b5513,_0x3fe5cd){_0x2b5513=_0x2b5513-0x0;var _0x578fd2=_0x28e3[_0x2b5513];return _0x578fd2;};'use strict';var multer=require(_0x328e('0x0'));var util=require(_0x328e('0x1'));var path=require(_0x328e('0x2'));var timeout=require(_0x328e('0x3'));var express=require('express');var router=express[_0x328e('0x4')]();var fs_extra=require(_0x328e('0x5'));var auth=require(_0x328e('0x6'));var interaction=require(_0x328e('0x7'));var config=require(_0x328e('0x8'));var controller=require(_0x328e('0x9'));router[_0x328e('0xa')]('/',auth[_0x328e('0xb')](),controller['index']);router['get']('/:id',auth[_0x328e('0xb')](),controller[_0x328e('0xc')]);router[_0x328e('0xd')]('/',auth[_0x328e('0xb')](),controller[_0x328e('0xe')]);router['put'](_0x328e('0xf'),auth[_0x328e('0xb')](),controller[_0x328e('0x10')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x328e('0x11')]);module[_0x328e('0x12')]=router; \ No newline at end of file +var _0x83e3=['../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x4e13b4,_0x142ae4){var _0x5bd42f=function(_0xdf11d4){while(--_0xdf11d4){_0x4e13b4['push'](_0x4e13b4['shift']());}};_0x5bd42f(++_0x142ae4);}(_0x83e3,0xc1));var _0x383e=function(_0x472917,_0x34d079){_0x472917=_0x472917-0x0;var _0x2fffae=_0x83e3[_0x472917];return _0x2fffae;};'use strict';var multer=require(_0x383e('0x0'));var util=require(_0x383e('0x1'));var path=require(_0x383e('0x2'));var timeout=require(_0x383e('0x3'));var express=require(_0x383e('0x4'));var router=express[_0x383e('0x5')]();var fs_extra=require(_0x383e('0x6'));var auth=require(_0x383e('0x7'));var interaction=require(_0x383e('0x8'));var config=require(_0x383e('0x9'));var controller=require('./cmCustomField.controller');router['get']('/',auth[_0x383e('0xa')](),controller[_0x383e('0xb')]);router[_0x383e('0xc')](_0x383e('0xd'),auth['isAuthenticated'](),controller[_0x383e('0xe')]);router[_0x383e('0xf')]('/',auth[_0x383e('0xa')](),controller['create']);router[_0x383e('0x10')](_0x383e('0xd'),auth[_0x383e('0xa')](),controller[_0x383e('0x11')]);router[_0x383e('0x12')](_0x383e('0xd'),auth[_0x383e('0xa')](),controller[_0x383e('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 85e78c4..5373bb7 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 _0xe526=['BOOLEAN','DATE','YYYY-MM-DD\x20HH:mm:ss','INTEGER','STRING','UNSIGNED','contactListQueue','sequelize'];(function(_0x3b803f,_0x5bfa02){var _0x1cf048=function(_0x5dd411){while(--_0x5dd411){_0x3b803f['push'](_0x3b803f['shift']());}};_0x1cf048(++_0x5bfa02);}(_0xe526,0xaf));var _0x6e52=function(_0xe67fb6,_0x55f75c){_0xe67fb6=_0xe67fb6-0x0;var _0x5f1cc9=_0xe526[_0xe67fb6];return _0x5f1cc9;};'use strict';var moment=require('moment');var Sequelize=require(_0x6e52('0x0'));module['exports']={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0x6e52('0x1')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x6e52('0x2')],'defaultValue':moment()['format'](_0x6e52('0x3'))},'countbusyretry':{'type':Sequelize[_0x6e52('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x6e52('0x4')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x6e52('0x1')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x6e52('0x5')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x6e52('0x2')]},'priority':{'type':Sequelize[_0x6e52('0x4')](0x2)[_0x6e52('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x6e52('0x1')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x6e52('0x4')],'unique':_0x6e52('0x7')},'ListId':{'type':Sequelize[_0x6e52('0x4')],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0x6e52('0x4')]},'VoiceQueueId':{'type':Sequelize[_0x6e52('0x4')],'unique':_0x6e52('0x7')},'CampaignId':{'type':Sequelize[_0x6e52('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x6e52('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x6e52('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x6e52('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x6e52('0x4')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x6e52('0x4')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x6e52('0x5')]},'recallmeNotifiedDate':{'type':Sequelize[_0x6e52('0x2')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x410c=['YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','moment','sequelize','STRING','BOOLEAN','DATE','format'];(function(_0x4089fd,_0x421e8b){var _0x37e76e=function(_0x53d3af){while(--_0x53d3af){_0x4089fd['push'](_0x4089fd['shift']());}};_0x37e76e(++_0x421e8b);}(_0x410c,0xe0));var _0xc410=function(_0x5f2324,_0x1f8e32){_0x5f2324=_0x5f2324-0x0;var _0x326b8f=_0x410c[_0x5f2324];return _0x326b8f;};'use strict';var moment=require(_0xc410('0x0'));var Sequelize=require(_0xc410('0x1'));module['exports']={'phone':{'type':Sequelize[_0xc410('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0xc410('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xc410('0x4')],'defaultValue':moment()[_0xc410('0x5')](_0xc410('0x6'))},'countbusyretry':{'type':Sequelize[_0xc410('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xc410('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xc410('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize['INTEGER'](0x2)[_0xc410('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xc410('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0xc410('0x9')},'ListId':{'type':Sequelize[_0xc410('0x7')],'unique':_0xc410('0x9')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0xc410('0x7')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0xc410('0x7')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xc410('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xc410('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xc410('0x7')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0xc410('0x7')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xc410('0x2')]},'recallmeNotifiedDate':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index b8fb248..f462936 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 _0x80d9=['$iLike','$notILike','$contains','$contained','$any','attributes','model','fields','length','hasOwnProperty','where','merge','VIRTUAL','include','findAll','rows','catch','show','includeAll','options','find','create','body','params','describe','destroy','VoiceQueueId','CampaignId','omit','createdAt','updatedAt','state','statedesc','membername','user','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','firstName','lastName','isNil','calleridname','finally','CmHopperAdditionalPhone','end','getPreview','CmContact','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','transaction','filter','direction','prev','isEmpty','hopperIds','ASC','scheduledAt','DESC','sequelize','COALESCE(CmHopper.UserId,\x200)\x20ASC','priority','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','recallme','LOCK','UPDATE','Contact','CmCompany','List','VoiceQueue','Queue','dialActive','getPreviewRecall','scheduledat','Company','CmList','getVoiceQueues','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','entity\x20not\x20found','timezones','push','utcOffset','json','getTimezone','moment','../../components/parsers/qs','../../config/logger','api','../../mysqldb','status','offset','undefined','limit','count','Content-Range','update','then','sendStatus','error','stack','name','index','map','CmHopper','rawAttributes','fieldName','type','keys','query','filters','intersection','$and','$gt','$ne','$eq','$not','$between','$notIn','$like','$notLike'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x80d9,0x15c));var _0x980d=function(_0x56443d,_0x59150c){_0x56443d=_0x56443d-0x0;var _0x241220=_0x80d9[_0x56443d];return _0x241220;};'use strict';var moment=require(_0x980d('0x0'));var _=require('lodash');var qs=require(_0x980d('0x1'));var logger=require(_0x980d('0x2'))(_0x980d('0x3'));var shared=require('../../config/environment');var db=require(_0x980d('0x4'))['db'];function respondWithResult(_0x3a9d1e,_0x38d1b9){_0x38d1b9=_0x38d1b9||0xc8;return function(_0x279d93){if(_0x279d93){return _0x3a9d1e[_0x980d('0x5')](_0x38d1b9)['json'](_0x279d93);}};}function respondWithFilteredResult(_0x4c3533,_0x2fd4b9){return function(_0x50854e){if(_0x50854e){var _0x5d9eb0=typeof _0x2fd4b9[_0x980d('0x6')]===_0x980d('0x7')&&typeof _0x2fd4b9[_0x980d('0x8')]===_0x980d('0x7');var _0x3b1043=_0x50854e[_0x980d('0x9')];var _0x1c4589=_0x5d9eb0?0x0:_0x2fd4b9['offset'];var _0x55b479=_0x5d9eb0?_0x50854e['count']:_0x2fd4b9[_0x980d('0x6')]+_0x2fd4b9[_0x980d('0x8')];var _0x4a9536;if(_0x55b479>=_0x3b1043){_0x55b479=_0x3b1043;_0x4a9536=0xc8;}else{_0x4a9536=0xce;}_0x4c3533[_0x980d('0x5')](_0x4a9536);return _0x4c3533['set'](_0x980d('0xa'),_0x1c4589+'-'+_0x55b479+'/'+_0x3b1043)['json'](_0x50854e);}return null;};}function saveUpdates(_0xc0168a,_0x19cb9b){return function(_0x171a61){if(_0x171a61){return _0x171a61[_0x980d('0xb')](_0xc0168a)[_0x980d('0xc')](function(_0x18469c){return _0x18469c;});}return null;};}function handleEntityNotFound(_0x109ddf,_0x3a317b){return function(_0x5f524e){if(!_0x5f524e){_0x109ddf[_0x980d('0xd')](0x194);}return _0x5f524e;};}function handleError(_0x138882,_0x3fc5f7){_0x3fc5f7=_0x3fc5f7||0x1f4;return function(_0x3846bd){logger[_0x980d('0xe')](_0x3846bd[_0x980d('0xf')]);if(_0x3846bd['name']){delete _0x3846bd[_0x980d('0x10')];}_0x138882[_0x980d('0x5')](_0x3fc5f7)['send'](_0x3846bd);};}exports[_0x980d('0x11')]=function(_0x4e9d73,_0x23f64c){var _0x1bc7e4={},_0x39192b={},_0x3c06c5={'count':0x0,'rows':[]};var _0x2a9ce4=_[_0x980d('0x12')](db[_0x980d('0x13')][_0x980d('0x14')],function(_0xa59cc9){return{'name':_0xa59cc9[_0x980d('0x15')],'type':_0xa59cc9[_0x980d('0x16')]['key']};});_0x39192b['model']=_[_0x980d('0x12')](_0x2a9ce4,'name');_0x39192b['query']=_[_0x980d('0x17')](_0x4e9d73[_0x980d('0x18')]);_0x39192b[_0x980d('0x19')]=_[_0x980d('0x1a')](_0x39192b['model'],_0x39192b['query']);_0x39192b[_0x980d('0x19')]=_['concat'](_0x39192b[_0x980d('0x19')],[_0x980d('0x1b'),'$or',_0x980d('0x1c'),'$gte','$lt','$lte',_0x980d('0x1d'),_0x980d('0x1e'),_0x980d('0x1f'),_0x980d('0x20'),'$notBetween','$in',_0x980d('0x21'),_0x980d('0x22'),_0x980d('0x23'),_0x980d('0x24'),_0x980d('0x25'),'$like','$overlap',_0x980d('0x26'),_0x980d('0x27'),_0x980d('0x28')]);_0x1bc7e4[_0x980d('0x29')]=_[_0x980d('0x1a')](_0x39192b[_0x980d('0x2a')],qs['fields'](_0x4e9d73[_0x980d('0x18')][_0x980d('0x2b')]));_0x1bc7e4[_0x980d('0x29')]=_0x1bc7e4[_0x980d('0x29')][_0x980d('0x2c')]?_0x1bc7e4[_0x980d('0x29')]:_0x39192b[_0x980d('0x2a')];if(!_0x4e9d73[_0x980d('0x18')][_0x980d('0x2d')]('nolimit')){_0x1bc7e4[_0x980d('0x8')]=qs[_0x980d('0x8')](_0x4e9d73[_0x980d('0x18')]['limit']);_0x1bc7e4['offset']=qs[_0x980d('0x6')](_0x4e9d73['query'][_0x980d('0x6')]);}_0x1bc7e4['order']=qs['sort'](_0x4e9d73['query']['sort']);_0x1bc7e4['where']=qs['filters'](_['pick'](_0x4e9d73[_0x980d('0x18')],_0x39192b[_0x980d('0x19')]),_0x2a9ce4);if(_0x4e9d73[_0x980d('0x18')]['filter']){_0x1bc7e4[_0x980d('0x2e')]=_[_0x980d('0x2f')](_0x1bc7e4[_0x980d('0x2e')],{'$or':_[_0x980d('0x12')](_0x2a9ce4,function(_0x120bf1){if(_0x120bf1[_0x980d('0x16')]!==_0x980d('0x30')){var _0x56b08e={};_0x56b08e[_0x120bf1[_0x980d('0x10')]]={'$like':'%'+_0x4e9d73[_0x980d('0x18')]['filter']+'%'};return _0x56b08e;}})});}_0x1bc7e4=_[_0x980d('0x2f')]({},_0x1bc7e4,_0x4e9d73['options']);var _0x293f7d={'where':_0x1bc7e4[_0x980d('0x2e')]};return db[_0x980d('0x13')]['count'](_0x293f7d)['then'](function(_0x5d5903){_0x3c06c5[_0x980d('0x9')]=_0x5d5903;if(_0x4e9d73['query']['includeAll']){_0x1bc7e4[_0x980d('0x31')]=[{'all':!![]}];}return db[_0x980d('0x13')][_0x980d('0x32')](_0x1bc7e4);})['then'](function(_0x41174b){_0x3c06c5[_0x980d('0x33')]=_0x41174b;return _0x3c06c5;})[_0x980d('0xc')](respondWithFilteredResult(_0x23f64c,_0x1bc7e4))[_0x980d('0x34')](handleError(_0x23f64c,null));};exports[_0x980d('0x35')]=function(_0x4e2aac,_0x5a8515){var _0x18f844={'raw':!![],'where':{'id':_0x4e2aac['params']['id']}},_0x5d356d={};_0x5d356d['model']=_['keys'](db[_0x980d('0x13')][_0x980d('0x14')]);_0x5d356d[_0x980d('0x18')]=_['keys'](_0x4e2aac[_0x980d('0x18')]);_0x5d356d[_0x980d('0x19')]=_[_0x980d('0x1a')](_0x5d356d[_0x980d('0x2a')],_0x5d356d[_0x980d('0x18')]);_0x18f844[_0x980d('0x29')]=_[_0x980d('0x1a')](_0x5d356d['model'],qs[_0x980d('0x2b')](_0x4e2aac[_0x980d('0x18')][_0x980d('0x2b')]));_0x18f844['attributes']=_0x18f844[_0x980d('0x29')][_0x980d('0x2c')]?_0x18f844[_0x980d('0x29')]:_0x5d356d[_0x980d('0x2a')];if(_0x4e2aac[_0x980d('0x18')][_0x980d('0x36')]){_0x18f844[_0x980d('0x31')]=[{'all':!![]}];}_0x18f844=_['merge']({},_0x18f844,_0x4e2aac[_0x980d('0x37')]);return db['CmHopper'][_0x980d('0x38')](_0x18f844)[_0x980d('0xc')](handleEntityNotFound(_0x5a8515,null))[_0x980d('0xc')](respondWithResult(_0x5a8515,null))[_0x980d('0x34')](handleError(_0x5a8515,null));};exports[_0x980d('0x39')]=function(_0x20479d,_0x31581d){return db[_0x980d('0x13')]['create'](_0x20479d['body'],{})[_0x980d('0xc')](respondWithResult(_0x31581d,0xc9))[_0x980d('0x34')](handleError(_0x31581d,null));};exports[_0x980d('0xb')]=function(_0x3ee5e1,_0x1d724a){if(_0x3ee5e1['body']['id']){delete _0x3ee5e1[_0x980d('0x3a')]['id'];}return db[_0x980d('0x13')]['find']({'where':{'id':_0x3ee5e1[_0x980d('0x3b')]['id']}})[_0x980d('0xc')](handleEntityNotFound(_0x1d724a,null))[_0x980d('0xc')](saveUpdates(_0x3ee5e1[_0x980d('0x3a')],null))[_0x980d('0xc')](respondWithResult(_0x1d724a,null))[_0x980d('0x34')](handleError(_0x1d724a,null));};exports[_0x980d('0x3c')]=function(_0x135c26,_0x7515ac){return db['CmHopper'][_0x980d('0x3c')]()[_0x980d('0xc')](respondWithResult(_0x7515ac,null))[_0x980d('0x34')](handleError(_0x7515ac,null));};exports[_0x980d('0x3d')]=function(_0x2e18c6,_0x7d0acf){var _0x2e6cdf;var _0x4f0a6e=_0x2e18c6[_0x980d('0x3b')]['id'];return db['CmHopper'][_0x980d('0x38')]({'where':{'id':_0x2e18c6[_0x980d('0x3b')]['id']}})[_0x980d('0xc')](handleEntityNotFound(_0x7d0acf,null))[_0x980d('0xc')](function(_0xb1d509){if(_0xb1d509){return _0xb1d509['destroy']()[_0x980d('0xc')](function(_0x448b3c){return _0x448b3c;});}})[_0x980d('0xc')](function(_0x12c1ea){_0x2e6cdf=_0x12c1ea;if(_0x12c1ea){if(_0x12c1ea[_0x980d('0x3e')]||_0x12c1ea[_0x980d('0x3f')]){return db[_0x12c1ea[_0x980d('0x3e')]?'VoiceQueue':'Campaign']['find']({'where':{'id':_0x12c1ea['VoiceQueueId']?_0x12c1ea[_0x980d('0x3e')]:_0x12c1ea[_0x980d('0x3f')]},'attributes':['id',_0x980d('0x10')],'raw':!![]});}}})[_0x980d('0xc')](function(_0x177bb2){var _0x316f6c={};if(_0x177bb2){_['merge'](_0x316f6c,_[_0x980d('0x40')](_0x2e6cdf['dataValues'],[_0x980d('0x41'),_0x980d('0x42'),'id']));_0x316f6c[_0x980d('0x43')]=0x15;_0x316f6c[_0x980d('0x44')]='deleted';_0x316f6c['campaign']=_0x177bb2[_0x980d('0x10')];_0x316f6c[_0x980d('0x45')]=_0x2e18c6[_0x980d('0x46')]['name'];_0x316f6c['UserId']=_0x2e18c6[_0x980d('0x46')]['id'];_0x316f6c['deleted']=!![];_0x316f6c[_0x980d('0x47')]=moment()[_0x980d('0x48')](_0x980d('0x49'));_0x316f6c[_0x980d('0x4a')]=_0x2e6cdf[_0x980d('0x4b')];_0x316f6c[_0x980d('0x4c')]=_0x2e6cdf[_0x980d('0x3e')]?_0x980d('0x4d'):'ivr';return db['CmContact'][_0x980d('0x38')]({'where':{'id':_0x316f6c['ContactId']},'attributes':[_0x980d('0x4e'),_0x980d('0x4f')]})['then'](function(_0x2b28e4){if(!_[_0x980d('0x50')](_0x7d0acf)&&!_[_0x980d('0x50')](_0x2b28e4[_0x980d('0x4e')])){_0x316f6c['calleridname']=_0x2b28e4[_0x980d('0x4e')];if(!_['isNil'](_0x2b28e4['lastName'])){_0x316f6c[_0x980d('0x51')]+='\x20'+_0x2b28e4['lastName'];}}})[_0x980d('0x52')](function(){return db['CmHopperFinal'][_0x980d('0x39')](_0x316f6c);});}})[_0x980d('0xc')](function(_0x5a74e5){return db[_0x980d('0x53')][_0x980d('0x3d')]({'where':{'CmHopperId':_0x4f0a6e}});})[_0x980d('0xc')](function(){return _0x7d0acf[_0x980d('0x5')](0xcc)[_0x980d('0x54')]();})[_0x980d('0x34')](handleError(_0x7d0acf,null));};exports[_0x980d('0x55')]=function(_0x3b5008,_0x3190b4){var _0x6df3f7=[];return db[_0x980d('0x56')][_0x980d('0x3c')]()['then'](function(_0x5416f1){_0x6df3f7=_['keys'](_0x5416f1);return _0x3b5008[_0x980d('0x46')]['getVoiceQueues']({'where':{'type':_0x980d('0x57'),'dialActive':!![],'dialMethod':_0x980d('0x58')},'attributes':['id',_0x980d('0x59'),_0x980d('0x5a')],'raw':!![]});})['then'](function(_0x395a95){if(_0x395a95&&_0x395a95[_0x980d('0x2c')]){return db['sequelize'][_0x980d('0x5b')](function(_0x5aebee){var _0x39dd5b={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x980d('0x12')](_0x395a95,'id')},'$or':[{'UserId':null},{'UserId':_0x3b5008[_0x980d('0x46')]['id']}]};var _0x3e6234={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x395a95)[_0x980d('0x5c')](['dialPreviewAutoRecallMe',0x0])[_0x980d('0x12')]('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x3b5008['user']['id']}]};var _0x3fa7be={'$or':[_0x39dd5b,_0x3e6234]};var _0x360944=[];if(_0x3b5008[_0x980d('0x3a')][_0x980d('0x5d')]&&_0x3b5008[_0x980d('0x3a')][_0x980d('0x5d')]===_0x980d('0x5e')){if(!_[_0x980d('0x5f')](_0x3b5008[_0x980d('0x3a')][_0x980d('0x60')])){_0x3fa7be['id']={'$in':_0x3b5008['body'][_0x980d('0x60')]};}_0x360944=[['priority',_0x980d('0x61')],[_0x980d('0x62'),_0x395a95[0x0]['dialOrderByScheduledAt']===_0x980d('0x61')?_0x980d('0x63'):_0x980d('0x61')],db[_0x980d('0x64')]['literal'](_0x980d('0x65')),['id',_0x980d('0x63')]];}else{if(!_[_0x980d('0x5f')](_0x3b5008[_0x980d('0x3a')][_0x980d('0x60')])){_0x3fa7be['id']={'$notIn':_0x3b5008[_0x980d('0x3a')][_0x980d('0x60')]};}_0x360944=[[_0x980d('0x66'),_0x980d('0x63')],[_0x980d('0x62'),_0x395a95[0x0]['dialOrderByScheduledAt']],db[_0x980d('0x64')][_0x980d('0x67')](_0x980d('0x68')),['id',_0x980d('0x61')]];}return db[_0x980d('0x13')][_0x980d('0x69')]({'attributes':['id','scheduledat','phone',_0x980d('0x6a')],'where':_0x3fa7be,'order':_0x360944,'transaction':_0x5aebee,'lock':_0x5aebee[_0x980d('0x6b')][_0x980d('0x6c')],'include':[{'model':db[_0x980d('0x56')],'as':_0x980d('0x6d'),'attributes':_0x6df3f7,'include':[{'model':db[_0x980d('0x6e')],'as':'Company','attributes':['id','name']}]},{'model':db['CmList'],'as':_0x980d('0x6f'),'attributes':['id','name']},{'model':db[_0x980d('0x70')],'as':_0x980d('0x71'),'attributes':['id',_0x980d('0x10'),_0x980d('0x72')]}]})['then'](function(_0x4996f3){if(_0x4996f3){return _0x4996f3[_0x980d('0xb')]({'UserId':_0x3b5008['user']['id']},{'transaction':_0x5aebee});}});});}})[_0x980d('0xc')](handleEntityNotFound(_0x3190b4,null))[_0x980d('0xc')](respondWithResult(_0x3190b4,null))[_0x980d('0x34')](handleError(_0x3190b4,null));};exports[_0x980d('0x73')]=function(_0x579623,_0x32540e,_0x569c2d){var _0x2e2fe1=[];var _0x30e444=_0x579623[_0x980d('0x3b')]['id'];var _0xd56320=_0x579623['user']['id'];return db[_0x980d('0x56')][_0x980d('0x3c')]()[_0x980d('0xc')](function(_0xe2df60){_0x2e2fe1=_[_0x980d('0x17')](_0xe2df60);return db[_0x980d('0x64')]['transaction'](function(_0x313f04){const _0x40bc31={'id':_0x30e444};return db['CmHopper'][_0x980d('0x69')]({'attributes':['id',_0x980d('0x74'),'recallme'],'where':_0x40bc31,'transaction':_0x313f04,'lock':_0x313f04['LOCK']['UPDATE'],'include':[{'model':db[_0x980d('0x56')],'as':_0x980d('0x6d'),'attributes':_0x2e2fe1,'include':[{'model':db[_0x980d('0x6e')],'as':_0x980d('0x75'),'attributes':['id',_0x980d('0x10')]}]},{'model':db[_0x980d('0x76')],'as':_0x980d('0x6f'),'attributes':['id',_0x980d('0x10')]},{'model':db[_0x980d('0x70')],'as':_0x980d('0x71'),'attributes':['id','name',_0x980d('0x72')]}]})[_0x980d('0xc')](function(_0x1543a8){if(_0x1543a8){return _0x1543a8[_0x980d('0xb')]({'UserId':_0xd56320},{'transaction':_0x313f04});}});});})[_0x980d('0xc')](handleEntityNotFound(_0x32540e,null))[_0x980d('0xc')](respondWithResult(_0x32540e,null))['catch'](handleError(_0x32540e,null));};exports['getOpenContacts']=function(_0x358fc8,_0x232828){return _0x358fc8['user'][_0x980d('0x77')]({'where':{'type':_0x980d('0x57'),'dialActive':!![],'dialMethod':_0x980d('0x58')},'attributes':['id'],'raw':!![]})[_0x980d('0xc')](function(_0x9691){if(_0x9691&&_0x9691[_0x980d('0x2c')]){return db['CmHopper'][_0x980d('0x9')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x980d('0x48')](_0x980d('0x49'))},'VoiceQueueId':{'$in':_[_0x980d('0x12')](_0x9691,'id')},'$or':[{'UserId':null},{'UserId':_0x358fc8['user']['id']}]}});}return 0x0;})[_0x980d('0xc')](function(_0x495d56){if(!_['isNil'](_0x495d56)&&_['isNumber'](_0x495d56)){return _0x232828[_0x980d('0x5')](0xc8)['json']({'contacts':_0x495d56});}else{logger[_0x980d('0xe')](_0x980d('0x78'),_0x980d('0x79'),0x194,_0x980d('0x7a'));_0x232828[_0x980d('0xd')](0x194);}})[_0x980d('0x34')](handleError(_0x232828,null));};exports['getTimezones']=function(_0x1cce28,_0x6b83e9){var _0x5ea5e4=shared[_0x980d('0x7b')];var _0x573c58=[];_['map'](_0x5ea5e4,function(_0x336709){_0x573c58[_0x980d('0x7c')]({'id':_0x336709[_0x980d('0x10')],'name':_0x336709[_0x980d('0x10')],'utcOffset':_0x336709[_0x980d('0x7d')]});});return _0x6b83e9[_0x980d('0x5')](0xc8)[_0x980d('0x7e')]({'tz':_0x573c58});};exports[_0x980d('0x7f')]=function(_0x15c87b,_0x3517bd){var _0x28dbea=shared[_0x980d('0x7b')];var _0x1e14c5={};if(!_[_0x980d('0x50')](_0x28dbea[_0x15c87b['body']['id']]))_0x1e14c5=_0x28dbea[_0x15c87b[_0x980d('0x3a')]['id']];return _0x3517bd['status'](0xc8)['json'](_0x1e14c5);}; \ No newline at end of file +var _0x4873=['VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','campaign','membername','UserId','user','deletedat','format','calleridnum','phone','queue','ivr','CmContact','ContactId','firstName','isNil','calleridname','lastName','CmHopperFinal','end','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','sequelize','YYYY-MM-DD\x20HH:mm:ss','value','direction','prev','hopperIds','priority','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','isEmpty','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','recallme','UPDATE','Contact','Company','CmList','Queue','getPreviewRecall','transaction','scheduledat','LOCK','CmCompany','dialActive','getOpenContacts','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','timezones','push','utcOffset','getTimezone','moment','lodash','../../components/parsers/qs','api','status','json','offset','undefined','limit','count','Content-Range','update','then','sendStatus','error','stack','name','send','index','CmHopper','fieldName','type','key','model','map','query','keys','filters','intersection','concat','$gt','$gte','$lt','$lte','$eq','$not','$notBetween','$in','$notLike','$iLike','$notILike','$like','$overlap','$contains','$contained','$any','attributes','fields','length','hasOwnProperty','nolimit','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','describe','destroy'];(function(_0x4ea69d,_0x290f53){var _0x5318e0=function(_0x18e081){while(--_0x18e081){_0x4ea69d['push'](_0x4ea69d['shift']());}};_0x5318e0(++_0x290f53);}(_0x4873,0x1df));var _0x3487=function(_0x4d5bd1,_0x2c32f4){_0x4d5bd1=_0x4d5bd1-0x0;var _0x467750=_0x4873[_0x4d5bd1];return _0x467750;};'use strict';var moment=require(_0x3487('0x0'));var _=require(_0x3487('0x1'));var qs=require(_0x3487('0x2'));var logger=require('../../config/logger')(_0x3487('0x3'));var shared=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithResult(_0x24ca51,_0xbc64e7){_0xbc64e7=_0xbc64e7||0xc8;return function(_0x54ff70){if(_0x54ff70){return _0x24ca51[_0x3487('0x4')](_0xbc64e7)[_0x3487('0x5')](_0x54ff70);}};}function respondWithFilteredResult(_0xbe12a4,_0x2611dc){return function(_0x193589){if(_0x193589){var _0x4a2407=typeof _0x2611dc[_0x3487('0x6')]===_0x3487('0x7')&&typeof _0x2611dc[_0x3487('0x8')]===_0x3487('0x7');var _0x17b90c=_0x193589['count'];var _0x365727=_0x4a2407?0x0:_0x2611dc['offset'];var _0x1a5a7a=_0x4a2407?_0x193589[_0x3487('0x9')]:_0x2611dc['offset']+_0x2611dc['limit'];var _0x43a64c;if(_0x1a5a7a>=_0x17b90c){_0x1a5a7a=_0x17b90c;_0x43a64c=0xc8;}else{_0x43a64c=0xce;}_0xbe12a4[_0x3487('0x4')](_0x43a64c);return _0xbe12a4['set'](_0x3487('0xa'),_0x365727+'-'+_0x1a5a7a+'/'+_0x17b90c)['json'](_0x193589);}return null;};}function saveUpdates(_0x557d64,_0x395774){return function(_0x1be2e0){if(_0x1be2e0){return _0x1be2e0[_0x3487('0xb')](_0x557d64)[_0x3487('0xc')](function(_0x8d7a3c){return _0x8d7a3c;});}return null;};}function handleEntityNotFound(_0x1e468b,_0x4fbd63){return function(_0x23ce3b){if(!_0x23ce3b){_0x1e468b[_0x3487('0xd')](0x194);}return _0x23ce3b;};}function handleError(_0x1b2b2b,_0x4f79f0){_0x4f79f0=_0x4f79f0||0x1f4;return function(_0x156e80){logger[_0x3487('0xe')](_0x156e80[_0x3487('0xf')]);if(_0x156e80[_0x3487('0x10')]){delete _0x156e80[_0x3487('0x10')];}_0x1b2b2b[_0x3487('0x4')](_0x4f79f0)[_0x3487('0x11')](_0x156e80);};}exports[_0x3487('0x12')]=function(_0x320894,_0x2fa630){var _0x3576ca={},_0x41795b={},_0xd56d94={'count':0x0,'rows':[]};var _0x382e33=_['map'](db[_0x3487('0x13')]['rawAttributes'],function(_0x2fd2e8){return{'name':_0x2fd2e8[_0x3487('0x14')],'type':_0x2fd2e8[_0x3487('0x15')][_0x3487('0x16')]};});_0x41795b[_0x3487('0x17')]=_[_0x3487('0x18')](_0x382e33,'name');_0x41795b[_0x3487('0x19')]=_[_0x3487('0x1a')](_0x320894[_0x3487('0x19')]);_0x41795b[_0x3487('0x1b')]=_[_0x3487('0x1c')](_0x41795b[_0x3487('0x17')],_0x41795b['query']);_0x41795b[_0x3487('0x1b')]=_[_0x3487('0x1d')](_0x41795b[_0x3487('0x1b')],['$and','$or',_0x3487('0x1e'),_0x3487('0x1f'),_0x3487('0x20'),_0x3487('0x21'),'$ne',_0x3487('0x22'),_0x3487('0x23'),'$between',_0x3487('0x24'),_0x3487('0x25'),'$notIn','$like',_0x3487('0x26'),_0x3487('0x27'),_0x3487('0x28'),_0x3487('0x29'),_0x3487('0x2a'),_0x3487('0x2b'),_0x3487('0x2c'),_0x3487('0x2d')]);_0x3576ca[_0x3487('0x2e')]=_[_0x3487('0x1c')](_0x41795b[_0x3487('0x17')],qs['fields'](_0x320894['query'][_0x3487('0x2f')]));_0x3576ca[_0x3487('0x2e')]=_0x3576ca['attributes'][_0x3487('0x30')]?_0x3576ca[_0x3487('0x2e')]:_0x41795b['model'];if(!_0x320894['query'][_0x3487('0x31')](_0x3487('0x32'))){_0x3576ca[_0x3487('0x8')]=qs['limit'](_0x320894[_0x3487('0x19')]['limit']);_0x3576ca['offset']=qs['offset'](_0x320894[_0x3487('0x19')][_0x3487('0x6')]);}_0x3576ca['order']=qs['sort'](_0x320894[_0x3487('0x19')]['sort']);_0x3576ca['where']=qs[_0x3487('0x1b')](_[_0x3487('0x33')](_0x320894[_0x3487('0x19')],_0x41795b['filters']),_0x382e33);if(_0x320894[_0x3487('0x19')][_0x3487('0x34')]){_0x3576ca[_0x3487('0x35')]=_[_0x3487('0x36')](_0x3576ca['where'],{'$or':_[_0x3487('0x18')](_0x382e33,function(_0x159e41){if(_0x159e41['type']!==_0x3487('0x37')){var _0x325a3a={};_0x325a3a[_0x159e41[_0x3487('0x10')]]={'$like':'%'+_0x320894[_0x3487('0x19')][_0x3487('0x34')]+'%'};return _0x325a3a;}})});}_0x3576ca=_[_0x3487('0x36')]({},_0x3576ca,_0x320894[_0x3487('0x38')]);var _0x299172={'where':_0x3576ca[_0x3487('0x35')]};return db['CmHopper'][_0x3487('0x9')](_0x299172)[_0x3487('0xc')](function(_0x49e6af){_0xd56d94['count']=_0x49e6af;if(_0x320894[_0x3487('0x19')][_0x3487('0x39')]){_0x3576ca[_0x3487('0x3a')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x3576ca);})['then'](function(_0x35e4ea){_0xd56d94[_0x3487('0x3b')]=_0x35e4ea;return _0xd56d94;})['then'](respondWithFilteredResult(_0x2fa630,_0x3576ca))[_0x3487('0x3c')](handleError(_0x2fa630,null));};exports[_0x3487('0x3d')]=function(_0x36a3c7,_0x331185){var _0x106393={'raw':!![],'where':{'id':_0x36a3c7[_0x3487('0x3e')]['id']}},_0xdf2a9e={};_0xdf2a9e[_0x3487('0x17')]=_[_0x3487('0x1a')](db['CmHopper'][_0x3487('0x3f')]);_0xdf2a9e[_0x3487('0x19')]=_['keys'](_0x36a3c7['query']);_0xdf2a9e[_0x3487('0x1b')]=_['intersection'](_0xdf2a9e['model'],_0xdf2a9e[_0x3487('0x19')]);_0x106393['attributes']=_['intersection'](_0xdf2a9e[_0x3487('0x17')],qs[_0x3487('0x2f')](_0x36a3c7['query']['fields']));_0x106393[_0x3487('0x2e')]=_0x106393[_0x3487('0x2e')]['length']?_0x106393[_0x3487('0x2e')]:_0xdf2a9e[_0x3487('0x17')];if(_0x36a3c7['query'][_0x3487('0x39')]){_0x106393[_0x3487('0x3a')]=[{'all':!![]}];}_0x106393=_[_0x3487('0x36')]({},_0x106393,_0x36a3c7['options']);return db[_0x3487('0x13')][_0x3487('0x40')](_0x106393)[_0x3487('0xc')](handleEntityNotFound(_0x331185,null))[_0x3487('0xc')](respondWithResult(_0x331185,null))[_0x3487('0x3c')](handleError(_0x331185,null));};exports[_0x3487('0x41')]=function(_0x25f049,_0x125550){return db['CmHopper'][_0x3487('0x41')](_0x25f049[_0x3487('0x42')],{})[_0x3487('0xc')](respondWithResult(_0x125550,0xc9))[_0x3487('0x3c')](handleError(_0x125550,null));};exports[_0x3487('0xb')]=function(_0x31e766,_0x324ebb){if(_0x31e766[_0x3487('0x42')]['id']){delete _0x31e766['body']['id'];}return db['CmHopper'][_0x3487('0x40')]({'where':{'id':_0x31e766[_0x3487('0x3e')]['id']}})[_0x3487('0xc')](handleEntityNotFound(_0x324ebb,null))[_0x3487('0xc')](saveUpdates(_0x31e766['body'],null))['then'](respondWithResult(_0x324ebb,null))[_0x3487('0x3c')](handleError(_0x324ebb,null));};exports[_0x3487('0x43')]=function(_0x3fe91f,_0x21a40e){return db[_0x3487('0x13')][_0x3487('0x43')]()[_0x3487('0xc')](respondWithResult(_0x21a40e,null))[_0x3487('0x3c')](handleError(_0x21a40e,null));};exports['destroy']=function(_0x585a44,_0x320351){var _0x6865a5;var _0x58e50c=_0x585a44[_0x3487('0x3e')]['id'];return db['CmHopper']['find']({'where':{'id':_0x585a44[_0x3487('0x3e')]['id']}})[_0x3487('0xc')](handleEntityNotFound(_0x320351,null))['then'](function(_0x8591e5){if(_0x8591e5){return _0x8591e5[_0x3487('0x44')]()[_0x3487('0xc')](function(_0x4ab5f8){return _0x4ab5f8;});}})[_0x3487('0xc')](function(_0x56b3fa){_0x6865a5=_0x56b3fa;if(_0x56b3fa){if(_0x56b3fa[_0x3487('0x45')]||_0x56b3fa[_0x3487('0x46')]){return db[_0x56b3fa['VoiceQueueId']?_0x3487('0x47'):_0x3487('0x48')][_0x3487('0x40')]({'where':{'id':_0x56b3fa[_0x3487('0x45')]?_0x56b3fa[_0x3487('0x45')]:_0x56b3fa[_0x3487('0x46')]},'attributes':['id',_0x3487('0x10')],'raw':!![]});}}})['then'](function(_0x212002){var _0x414695={};if(_0x212002){_['merge'](_0x414695,_[_0x3487('0x49')](_0x6865a5[_0x3487('0x4a')],[_0x3487('0x4b'),_0x3487('0x4c'),'id']));_0x414695[_0x3487('0x4d')]=0x15;_0x414695[_0x3487('0x4e')]=_0x3487('0x4f');_0x414695[_0x3487('0x50')]=_0x212002[_0x3487('0x10')];_0x414695[_0x3487('0x51')]=_0x585a44['user'][_0x3487('0x10')];_0x414695[_0x3487('0x52')]=_0x585a44[_0x3487('0x53')]['id'];_0x414695[_0x3487('0x4f')]=!![];_0x414695[_0x3487('0x54')]=moment()[_0x3487('0x55')]('YYYY-MM-DD\x20HH:mm:ss');_0x414695[_0x3487('0x56')]=_0x6865a5[_0x3487('0x57')];_0x414695['campaigntype']=_0x6865a5['VoiceQueueId']?_0x3487('0x58'):_0x3487('0x59');return db[_0x3487('0x5a')][_0x3487('0x40')]({'where':{'id':_0x414695[_0x3487('0x5b')]},'attributes':[_0x3487('0x5c'),'lastName']})['then'](function(_0x417250){if(!_[_0x3487('0x5d')](_0x320351)&&!_['isNil'](_0x417250[_0x3487('0x5c')])){_0x414695[_0x3487('0x5e')]=_0x417250[_0x3487('0x5c')];if(!_['isNil'](_0x417250[_0x3487('0x5f')])){_0x414695[_0x3487('0x5e')]+='\x20'+_0x417250['lastName'];}}})['finally'](function(){return db[_0x3487('0x60')][_0x3487('0x41')](_0x414695);});}})[_0x3487('0xc')](function(_0x1e9b34){return db['CmHopperAdditionalPhone'][_0x3487('0x44')]({'where':{'CmHopperId':_0x58e50c}});})[_0x3487('0xc')](function(){return _0x320351[_0x3487('0x4')](0xcc)[_0x3487('0x61')]();})['catch'](handleError(_0x320351,null));};exports['getPreview']=function(_0x11f008,_0x5b3a71){var _0x347a8c=[];return db[_0x3487('0x5a')][_0x3487('0x43')]()[_0x3487('0xc')](function(_0xc985b6){_0x347a8c=_[_0x3487('0x1a')](_0xc985b6);return _0x11f008[_0x3487('0x53')][_0x3487('0x62')]({'where':{'type':_0x3487('0x63'),'dialActive':!![],'dialMethod':_0x3487('0x64')},'attributes':['id',_0x3487('0x65'),'dialPreviewAutoRecallMe'],'raw':!![]});})[_0x3487('0xc')](function(_0x1dbff1){if(_0x1dbff1&&_0x1dbff1['length']){return db[_0x3487('0x66')]['transaction'](function(_0x55f6c1){var _0x2e724d={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x3487('0x55')](_0x3487('0x67'))},'VoiceQueueId':{'$in':_[_0x3487('0x18')](_0x1dbff1,'id')},'$or':[{'UserId':null},{'UserId':_0x11f008[_0x3487('0x53')]['id']}]};var _0x2dcfd2={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x1dbff1)[_0x3487('0x34')](['dialPreviewAutoRecallMe',0x0])[_0x3487('0x18')]('id')[_0x3487('0x68')]()},'$or':[{'UserId':null},{'UserId':_0x11f008[_0x3487('0x53')]['id']}]};var _0x347616={'$or':[_0x2e724d,_0x2dcfd2]};var _0x1612e5=[];if(_0x11f008[_0x3487('0x42')][_0x3487('0x69')]&&_0x11f008[_0x3487('0x42')][_0x3487('0x69')]===_0x3487('0x6a')){if(!_['isEmpty'](_0x11f008['body'][_0x3487('0x6b')])){_0x347616['id']={'$in':_0x11f008['body'][_0x3487('0x6b')]};}_0x1612e5=[[_0x3487('0x6c'),_0x3487('0x6d')],[_0x3487('0x6e'),_0x1dbff1[0x0]['dialOrderByScheduledAt']===_0x3487('0x6d')?_0x3487('0x6f'):_0x3487('0x6d')],db[_0x3487('0x66')][_0x3487('0x70')](_0x3487('0x71')),['id','DESC']];}else{if(!_[_0x3487('0x72')](_0x11f008[_0x3487('0x42')]['hopperIds'])){_0x347616['id']={'$notIn':_0x11f008[_0x3487('0x42')][_0x3487('0x6b')]};}_0x1612e5=[[_0x3487('0x6c'),_0x3487('0x6f')],[_0x3487('0x6e'),_0x1dbff1[0x0][_0x3487('0x65')]],db[_0x3487('0x66')][_0x3487('0x70')](_0x3487('0x73')),['id',_0x3487('0x6d')]];}return db['CmHopper'][_0x3487('0x74')]({'attributes':['id','scheduledat','phone',_0x3487('0x75')],'where':_0x347616,'order':_0x1612e5,'transaction':_0x55f6c1,'lock':_0x55f6c1['LOCK'][_0x3487('0x76')],'include':[{'model':db[_0x3487('0x5a')],'as':_0x3487('0x77'),'attributes':_0x347a8c,'include':[{'model':db['CmCompany'],'as':_0x3487('0x78'),'attributes':['id',_0x3487('0x10')]}]},{'model':db[_0x3487('0x79')],'as':'List','attributes':['id',_0x3487('0x10')]},{'model':db[_0x3487('0x47')],'as':_0x3487('0x7a'),'attributes':['id','name','dialActive']}]})[_0x3487('0xc')](function(_0xd2e056){if(_0xd2e056){return _0xd2e056[_0x3487('0xb')]({'UserId':_0x11f008[_0x3487('0x53')]['id']},{'transaction':_0x55f6c1});}});});}})[_0x3487('0xc')](handleEntityNotFound(_0x5b3a71,null))[_0x3487('0xc')](respondWithResult(_0x5b3a71,null))[_0x3487('0x3c')](handleError(_0x5b3a71,null));};exports[_0x3487('0x7b')]=function(_0x2544fd,_0xd482a,_0x43631d){var _0x15e31c=[];var _0x226b97=_0x2544fd[_0x3487('0x3e')]['id'];var _0x7d80f=_0x2544fd[_0x3487('0x53')]['id'];return db[_0x3487('0x5a')][_0x3487('0x43')]()[_0x3487('0xc')](function(_0x50af7b){_0x15e31c=_[_0x3487('0x1a')](_0x50af7b);return db[_0x3487('0x66')][_0x3487('0x7c')](function(_0x9bbb2e){const _0x23cba6={'id':_0x226b97};return db['CmHopper']['findOne']({'attributes':['id',_0x3487('0x7d'),_0x3487('0x75')],'where':_0x23cba6,'transaction':_0x9bbb2e,'lock':_0x9bbb2e[_0x3487('0x7e')][_0x3487('0x76')],'include':[{'model':db[_0x3487('0x5a')],'as':_0x3487('0x77'),'attributes':_0x15e31c,'include':[{'model':db[_0x3487('0x7f')],'as':'Company','attributes':['id',_0x3487('0x10')]}]},{'model':db['CmList'],'as':'List','attributes':['id',_0x3487('0x10')]},{'model':db[_0x3487('0x47')],'as':_0x3487('0x7a'),'attributes':['id',_0x3487('0x10'),_0x3487('0x80')]}]})[_0x3487('0xc')](function(_0x3f9321){if(_0x3f9321){return _0x3f9321[_0x3487('0xb')]({'UserId':_0x7d80f},{'transaction':_0x9bbb2e});}});});})[_0x3487('0xc')](handleEntityNotFound(_0xd482a,null))[_0x3487('0xc')](respondWithResult(_0xd482a,null))[_0x3487('0x3c')](handleError(_0xd482a,null));};exports[_0x3487('0x81')]=function(_0xd45305,_0x11d40c){return _0xd45305[_0x3487('0x53')]['getVoiceQueues']({'where':{'type':_0x3487('0x63'),'dialActive':!![],'dialMethod':_0x3487('0x64')},'attributes':['id'],'raw':!![]})[_0x3487('0xc')](function(_0x37ede7){if(_0x37ede7&&_0x37ede7['length']){return db['CmHopper']['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x3487('0x55')](_0x3487('0x67'))},'VoiceQueueId':{'$in':_[_0x3487('0x18')](_0x37ede7,'id')},'$or':[{'UserId':null},{'UserId':_0xd45305[_0x3487('0x53')]['id']}]}});}return 0x0;})[_0x3487('0xc')](function(_0x4dead7){if(!_[_0x3487('0x5d')](_0x4dead7)&&_['isNumber'](_0x4dead7)){return _0x11d40c[_0x3487('0x4')](0xc8)[_0x3487('0x5')]({'contacts':_0x4dead7});}else{logger[_0x3487('0xe')](_0x3487('0x82'),_0x3487('0x81'),0x194,_0x3487('0x83'));_0x11d40c[_0x3487('0xd')](0x194);}})['catch'](handleError(_0x11d40c,null));};exports[_0x3487('0x84')]=function(_0x459292,_0xc5346){var _0xc6e8ff=shared[_0x3487('0x85')];var _0xff0526=[];_[_0x3487('0x18')](_0xc6e8ff,function(_0xcb5c41){_0xff0526[_0x3487('0x86')]({'id':_0xcb5c41[_0x3487('0x10')],'name':_0xcb5c41[_0x3487('0x10')],'utcOffset':_0xcb5c41[_0x3487('0x87')]});});return _0xc5346['status'](0xc8)['json']({'tz':_0xff0526});};exports[_0x3487('0x88')]=function(_0x3188e9,_0xcfb667){var _0x3abde2=shared[_0x3487('0x85')];var _0x5759bc={};if(!_['isNil'](_0x3abde2[_0x3188e9[_0x3487('0x42')]['id']]))_0x5759bc=_0x3abde2[_0x3188e9['body']['id']];return _0xcfb667[_0x3487('0x4')](0xc8)[_0x3487('0x5')](_0x5759bc);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index d87b0f7..bc11e93 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 _0xc4aa=['define','CmHopper','cm_hopper','phone','priority','lodash','util','../../config/logger','api','moment','bluebird','../../config/environment','./cmHopper.attributes','exports'];(function(_0x308129,_0x8d7121){var _0x3f3df1=function(_0x59bf85){while(--_0x59bf85){_0x308129['push'](_0x308129['shift']());}};_0x3f3df1(++_0x8d7121);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0xc4aa[_0x5c2e3e];return _0x53f64a;};'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':'scheduledat','fields':['scheduledat']},{'name':_0xac4a('0xc'),'fields':[_0xac4a('0xc')]},{'name':_0xac4a('0xd'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file +var _0x2a07=['api','moment','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger'];(function(_0x4b1012,_0x1415eb){var _0x23d715=function(_0x25f330){while(--_0x25f330){_0x4b1012['push'](_0x4b1012['shift']());}};_0x23d715(++_0x1415eb);}(_0x2a07,0x74));var _0x72a0=function(_0xe2b8fc,_0x3ec76a){_0xe2b8fc=_0xe2b8fc-0x0;var _0x1bfefb=_0x2a07[_0xe2b8fc];return _0x1bfefb;};'use strict';var _=require(_0x72a0('0x0'));var util=require(_0x72a0('0x1'));var logger=require(_0x72a0('0x2'))(_0x72a0('0x3'));var moment=require(_0x72a0('0x4'));var BPromise=require('bluebird');var rp=require(_0x72a0('0x5'));var fs=require('fs');var path=require(_0x72a0('0x6'));var rimraf=require(_0x72a0('0x7'));var config=require(_0x72a0('0x8'));var attributes=require(_0x72a0('0x9'));module[_0x72a0('0xa')]=function(_0x3ccf6d,_0x20dab9){return _0x3ccf6d[_0x72a0('0xb')](_0x72a0('0xc'),attributes,{'tableName':_0x72a0('0xd'),'paranoid':![],'indexes':[{'name':_0x72a0('0xe'),'fields':[_0x72a0('0xe')]},{'name':_0x72a0('0xf'),'fields':[_0x72a0('0xf')]},{'name':_0x72a0('0x10'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index d17d6cd..b8fcb31 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 _0xe667=['map','model','then','info','debug','stringify','catch','error','message','ShowCmHopper','find','CreateCmHopper','body','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','GetContactDialer','CmContact','describe','transaction','order','LOCK','UPDATE','User','voicePause','length','push','includes','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','destroy','CountReScheduled','COUNT','sequelize','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','contactsRescheduled','GetContactRecallMe','GetCmHopperPreview','Contact','findOne','phone','dialTimezone','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','Agent','name','CmList','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','limit','include'];(function(_0x45e92c,_0x36ff1e){var _0xc17495=function(_0x1b70b3){while(--_0x1b70b3){_0x45e92c['push'](_0x45e92c['shift']());}};_0xc17495(++_0x36ff1e);}(_0xe667,0x17c));var _0x7e66=function(_0x1157cf,_0x26ee4e){_0x1157cf=_0x1157cf-0x0;var _0x3aec10=_0xe667[_0x1157cf];return _0x3aec10;};'use strict';var _=require('lodash');var util=require(_0x7e66('0x0'));var moment=require(_0x7e66('0x1'));var BPromise=require(_0x7e66('0x2'));var db=require(_0x7e66('0x3'))['db'];var logger=require(_0x7e66('0x4'))(_0x7e66('0x5'));exports[_0x7e66('0x6')]=function(_0x354f57){var _0x176db3=this;return new Promise(function(_0x2f8f0b,_0x1cea2d){return db[_0x7e66('0x7')][_0x7e66('0x8')]({'raw':_0x354f57[_0x7e66('0x9')]?_0x354f57[_0x7e66('0x9')][_0x7e66('0xa')]===undefined?!![]:![]:!![],'where':_0x354f57[_0x7e66('0x9')]?_0x354f57['options'][_0x7e66('0xb')]||null:null,'attributes':_0x354f57[_0x7e66('0x9')]?_0x354f57[_0x7e66('0x9')][_0x7e66('0xc')]||null:null,'limit':_0x354f57[_0x7e66('0x9')]?_0x354f57['options'][_0x7e66('0xd')]||null:null,'include':_0x354f57[_0x7e66('0x9')]?_0x354f57[_0x7e66('0x9')]['include']?_['map'](_0x354f57['options'][_0x7e66('0xe')],function(_0x7755cd){return{'model':db[_0x7755cd['model']],'as':_0x7755cd['as'],'attributes':_0x7755cd['attributes'],'include':_0x7755cd[_0x7e66('0xe')]?_[_0x7e66('0xf')](_0x7755cd[_0x7e66('0xe')],function(_0x5ace51){return{'model':db[_0x5ace51[_0x7e66('0x10')]],'as':_0x5ace51['as'],'attributes':_0x5ace51[_0x7e66('0xc')],'include':_0x5ace51[_0x7e66('0xe')]?_[_0x7e66('0xf')](_0x5ace51['include'],function(_0x1990f3){return{'model':db[_0x1990f3['model']],'as':_0x1990f3['as'],'attributes':_0x1990f3[_0x7e66('0xc')]};}):[]};}):[]};}):[]:[]})[_0x7e66('0x11')](function(_0x1062f7){logger[_0x7e66('0x12')]('GetCmHopper',_0x354f57);logger[_0x7e66('0x13')](_0x7e66('0x6'),_0x354f57,JSON[_0x7e66('0x14')](_0x1062f7));_0x2f8f0b(_0x1062f7);})[_0x7e66('0x15')](function(_0x7f42d8){logger[_0x7e66('0x16')](_0x7e66('0x6'),_0x7f42d8['message'],_0x354f57);_0x1cea2d(_0x176db3[_0x7e66('0x16')](0x1f4,_0x7f42d8[_0x7e66('0x17')]));});});};exports[_0x7e66('0x18')]=function(_0x506e98){var _0x3f2b67=this;return new Promise(function(_0x1626d0,_0x2db212){return db[_0x7e66('0x7')][_0x7e66('0x19')]({'raw':_0x506e98[_0x7e66('0x9')]?_0x506e98[_0x7e66('0x9')][_0x7e66('0xa')]===undefined?!![]:![]:!![],'where':_0x506e98[_0x7e66('0x9')]?_0x506e98[_0x7e66('0x9')][_0x7e66('0xb')]||null:null,'attributes':_0x506e98[_0x7e66('0x9')]?_0x506e98['options'][_0x7e66('0xc')]||null:null,'include':_0x506e98['options']?_0x506e98[_0x7e66('0x9')][_0x7e66('0xe')]?_[_0x7e66('0xf')](_0x506e98[_0x7e66('0x9')]['include'],function(_0x16aab2){return{'model':db[_0x16aab2[_0x7e66('0x10')]],'as':_0x16aab2['as'],'attributes':_0x16aab2[_0x7e66('0xc')],'include':_0x16aab2[_0x7e66('0xe')]?_[_0x7e66('0xf')](_0x16aab2[_0x7e66('0xe')],function(_0x3fc5ff){return{'model':db[_0x3fc5ff['model']],'as':_0x3fc5ff['as'],'attributes':_0x3fc5ff[_0x7e66('0xc')],'include':_0x3fc5ff['include']?_[_0x7e66('0xf')](_0x3fc5ff[_0x7e66('0xe')],function(_0x434364){return{'model':db[_0x434364[_0x7e66('0x10')]],'as':_0x434364['as'],'attributes':_0x434364[_0x7e66('0xc')]};}):[]};}):[]};}):[]:[]})[_0x7e66('0x11')](function(_0x58aa97){logger['info'](_0x7e66('0x18'),_0x506e98);logger[_0x7e66('0x13')]('ShowCmHopper',_0x506e98,JSON['stringify'](_0x58aa97));_0x1626d0(_0x58aa97);})['catch'](function(_0x136cb3){logger['error'](_0x7e66('0x18'),_0x136cb3[_0x7e66('0x17')],_0x506e98);_0x2db212(_0x3f2b67[_0x7e66('0x16')](0x1f4,_0x136cb3[_0x7e66('0x17')]));});});};exports[_0x7e66('0x1a')]=function(_0x47c777){var _0x58ec29=this;return new Promise(function(_0x281e12,_0x14956e){return db['CmHopper']['create'](_0x47c777[_0x7e66('0x1b')],{'raw':_0x47c777[_0x7e66('0x9')]?_0x47c777[_0x7e66('0x9')][_0x7e66('0xa')]===undefined?!![]:![]:!![]})[_0x7e66('0x11')](function(_0x22341a){logger[_0x7e66('0x12')](_0x7e66('0x1a'),_0x47c777);logger[_0x7e66('0x13')](_0x7e66('0x1a'),_0x47c777,JSON[_0x7e66('0x14')](_0x22341a));_0x281e12(_0x22341a);})[_0x7e66('0x15')](function(_0x35ae55){logger[_0x7e66('0x16')](_0x7e66('0x1a'),_0x35ae55[_0x7e66('0x17')],_0x47c777);_0x14956e(_0x58ec29[_0x7e66('0x16')](0x1f4,_0x35ae55[_0x7e66('0x17')]));});});};exports[_0x7e66('0x1c')]=function(_0xf41807){var _0x4d9b72=this;return new Promise(function(_0x13ce35,_0x2d1d8c){return db[_0x7e66('0x7')][_0x7e66('0x1d')](_0xf41807[_0x7e66('0x1b')],{'raw':_0xf41807[_0x7e66('0x9')]?_0xf41807[_0x7e66('0x9')][_0x7e66('0xa')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf41807[_0x7e66('0x9')]?_0xf41807[_0x7e66('0x9')][_0x7e66('0xb')]||null:null,'attributes':_0xf41807['options']?_0xf41807['options'][_0x7e66('0xc')]||null:null,'limit':_0xf41807[_0x7e66('0x9')]?_0xf41807[_0x7e66('0x9')]['limit']||null:null})['then'](function(_0xd73bb9){logger[_0x7e66('0x12')](_0x7e66('0x1c'),_0xf41807);logger[_0x7e66('0x12')](_0x7e66('0x1e'),JSON[_0x7e66('0x14')](_0xf41807[_0x7e66('0x9')][_0x7e66('0xb')]),_0xf41807[_0x7e66('0x1b')][_0x7e66('0x1f')]);logger[_0x7e66('0x13')]('UpdateCmHopper',_0xf41807,JSON[_0x7e66('0x14')](_0xd73bb9));_0x13ce35(_0xd73bb9);})[_0x7e66('0x15')](function(_0x38931d){logger[_0x7e66('0x16')]('UpdateCmHopper',_0x38931d[_0x7e66('0x17')],_0xf41807);_0x2d1d8c(_0x4d9b72[_0x7e66('0x16')](0x1f4,_0x38931d[_0x7e66('0x17')]));});});};exports[_0x7e66('0x20')]=function(_0x585596){var _0x43e959=this;return new Promise(function(_0x37f5ee,_0x169fba){return db[_0x7e66('0x7')]['destroy']({'where':_0x585596[_0x7e66('0x9')]?_0x585596['options'][_0x7e66('0xb')]||null:null})[_0x7e66('0x11')](function(_0x1445f4){logger['info']('DestroyCmHopper',_0x585596);logger[_0x7e66('0x13')]('DestroyCmHopper',_0x585596,JSON[_0x7e66('0x14')](_0x1445f4));_0x37f5ee(_0x1445f4);})[_0x7e66('0x15')](function(_0x309a21){logger['error'](_0x7e66('0x20'),_0x309a21[_0x7e66('0x17')],_0x585596);_0x169fba(_0x43e959[_0x7e66('0x16')](0x1f4,_0x309a21[_0x7e66('0x17')]));});});};exports[_0x7e66('0x21')]=function(_0x3696b9){var _0x59ae81=this;return new Promise(function(_0xd48a35,_0x682857){return db[_0x7e66('0x22')][_0x7e66('0x23')]()[_0x7e66('0x11')](function(_0xdc1e7c){return db['sequelize'][_0x7e66('0x24')](function(_0x5b5ce8){return db[_0x7e66('0x7')][_0x7e66('0x8')]({'where':_0x3696b9['options']?_0x3696b9[_0x7e66('0x9')][_0x7e66('0xb')]||null:null,'attributes':_0x3696b9[_0x7e66('0x9')]?_0x3696b9['options'][_0x7e66('0xc')]||null:null,'limit':_0x3696b9[_0x7e66('0x9')]?_0x3696b9[_0x7e66('0x9')][_0x7e66('0xd')]||null:null,'order':_0x3696b9['options']?_0x3696b9[_0x7e66('0x9')][_0x7e66('0x25')]||null:null,'transaction':_0x5b5ce8,'lock':_0x5b5ce8[_0x7e66('0x26')][_0x7e66('0x27')],'include':[{'model':db[_0x7e66('0x22')],'as':'Contact','attributes':_['keys'](_0xdc1e7c)},{'model':db[_0x7e66('0x28')],'as':'Agent','attributes':['id','name',_0x7e66('0x29')]}]})[_0x7e66('0x11')](function(_0x56fec9){var _0x1edbe7=[];var _0x1c199a=[];for(var _0x127232=0x0;_0x127232<_0x56fec9[_0x7e66('0x2a')];_0x127232+=0x1){var _0x19facd=_0x56fec9[_0x127232]['UserId'];if(_0x19facd===null){_0x1edbe7[_0x7e66('0x2b')](_0x56fec9[_0x127232][_0x7e66('0x1d')](_0x3696b9[_0x7e66('0x1b')],{'transaction':_0x5b5ce8}));}else if(!_0x1c199a[_0x7e66('0x2c')](_0x19facd)){_0x1c199a[_0x7e66('0x2b')](_0x19facd);_0x1edbe7['push'](_0x56fec9[_0x127232][_0x7e66('0x1d')](_0x3696b9[_0x7e66('0x1b')],{'transaction':_0x5b5ce8}));}}return BPromise[_0x7e66('0x2d')](_0x1edbe7);});})[_0x7e66('0x11')](function(_0x1e7c04){logger[_0x7e66('0x12')](_0x7e66('0x21'),_0x3696b9);if(_0x1e7c04[_0x7e66('0x2a')]>0x0){logger[_0x7e66('0x12')](_0x7e66('0x2e'),_0x1e7c04[0x0][_0x7e66('0x2f')]['id'],_0x1e7c04[0x0]['dataValues'][_0x7e66('0x30')],_0x1e7c04[0x0][_0x7e66('0x2f')][_0x7e66('0x1f')]);}logger[_0x7e66('0x13')](_0x7e66('0x21'),_0x3696b9,JSON[_0x7e66('0x14')](_0x1e7c04));_0xd48a35(_0x1e7c04);})[_0x7e66('0x15')](function(_0x48483f){logger[_0x7e66('0x16')]('GetContactDialer',_0x48483f[_0x7e66('0x17')],_0x3696b9);_0x682857(_0x59ae81[_0x7e66('0x16')](0x1f4,_0x48483f[_0x7e66('0x17')]));});});});};exports[_0x7e66('0x31')]=function(_0x234f82){var _0x504229=this;return new Promise(function(_0x1d3e05,_0x59e084){return db['sequelize']['transaction'](function(_0x115838){return db['CmHopperFinal']['create'](_0x234f82['body'],{'raw':_0x234f82[_0x7e66('0x9')]?_0x234f82[_0x7e66('0x9')][_0x7e66('0xa')]===undefined?!![]:![]:!![],'transaction':_0x115838})['then'](function(){logger[_0x7e66('0x12')](_0x7e66('0x32'),JSON[_0x7e66('0x14')](_0x234f82[_0x7e66('0x9')][_0x7e66('0xb')]),_0x234f82[_0x7e66('0x9')]['where'][_0x7e66('0x1f')]);return db[_0x7e66('0x7')][_0x7e66('0x33')]({'where':_0x234f82['options']?_0x234f82['options'][_0x7e66('0xb')]||null:null,'transaction':_0x115838});});})[_0x7e66('0x11')](function(_0x4ae480){logger['info'](_0x7e66('0x31'),_0x234f82);logger[_0x7e66('0x13')](_0x7e66('0x31'),_0x234f82,JSON[_0x7e66('0x14')](_0x4ae480));_0x1d3e05(_0x4ae480);})['catch'](function(_0x315d0b){logger[_0x7e66('0x16')]('MoveContactManagedDialer',_0x315d0b[_0x7e66('0x17')],_0x234f82);_0x59e084(_0x504229[_0x7e66('0x16')](0x1f4,_0x315d0b[_0x7e66('0x17')]));});});};exports[_0x7e66('0x34')]=function(_0x192b94){var _0x7b9e6e=this;return new Promise(function(_0x2acef0,_0x1c707d){return db[_0x7e66('0x7')][_0x7e66('0x8')]({'raw':_0x192b94[_0x7e66('0x9')]?_0x192b94['options'][_0x7e66('0xa')]===undefined?!![]:![]:!![],'where':_0x192b94['options']?_0x192b94['options'][_0x7e66('0xb')]||null:null,'attributes':[[db['sequelize']['fn'](_0x7e66('0x35'),db[_0x7e66('0x36')]['fn']('IF',db[_0x7e66('0x36')][_0x7e66('0x37')](_0x7e66('0x38')+util[_0x7e66('0x39')](_0x7e66('0x3a'),moment()[_0x7e66('0x39')](_0x7e66('0x3b')))+'\x20,\x201,\x20null'))),_0x7e66('0x3c')]]})['then'](function(_0xa448a1){logger['info']('CountReScheduled',_0x192b94);logger[_0x7e66('0x13')](_0x7e66('0x34'),_0x192b94,JSON[_0x7e66('0x14')](_0xa448a1));_0x2acef0(_0xa448a1);})['catch'](function(_0xfb3b0c){logger['error']('CountReScheduled',_0xfb3b0c['message'],_0x192b94);_0x1c707d(_0x7b9e6e['error'](0x1f4,_0xfb3b0c[_0x7e66('0x17')]));});});};exports[_0x7e66('0x3d')]=function(_0x127c89){var _0x21642a=this;return new Promise(function(_0xbd3a51,_0x19b78e){return db[_0x7e66('0x22')][_0x7e66('0x23')]()[_0x7e66('0x11')](function(){return db[_0x7e66('0x36')]['transaction'](function(_0x4d46fc){return db['CmHopper'][_0x7e66('0x8')]({'where':_0x127c89['options']?_0x127c89[_0x7e66('0x9')][_0x7e66('0xb')]||null:null,'attributes':_0x127c89[_0x7e66('0x9')]?_0x127c89[_0x7e66('0x9')][_0x7e66('0xc')]||null:null,'limit':0x1,'order':_0x127c89[_0x7e66('0x9')]?_0x127c89[_0x7e66('0x9')][_0x7e66('0x25')]||null:null,'group':db[_0x7e66('0x7')]['UserId'],'transaction':_0x4d46fc,'lock':_0x4d46fc[_0x7e66('0x26')][_0x7e66('0x27')],'include':_0x127c89[_0x7e66('0x9')]?_0x127c89['options']['include']?_['map'](_0x127c89[_0x7e66('0x9')][_0x7e66('0xe')],function(_0xc2ecb3){return{'model':db[_0xc2ecb3[_0x7e66('0x10')]],'as':_0xc2ecb3['as'],'attributes':_0xc2ecb3[_0x7e66('0xc')],'include':_0xc2ecb3[_0x7e66('0xe')]?_[_0x7e66('0xf')](_0xc2ecb3[_0x7e66('0xe')],function(_0x2b7478){return{'model':db[_0x2b7478[_0x7e66('0x10')]],'as':_0x2b7478['as'],'attributes':_0x2b7478[_0x7e66('0xc')],'include':_0x2b7478[_0x7e66('0xe')]?_[_0x7e66('0xf')](_0x2b7478[_0x7e66('0xe')],function(_0x4fe5fa){return{'model':db[_0x4fe5fa['model']],'as':_0x4fe5fa['as'],'attributes':_0x4fe5fa['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3c9736){var _0x3322c2=[];for(var _0x1dccf0=0x0;_0x1dccf0<_0x3c9736['length'];_0x1dccf0+=0x1){_0x3322c2[_0x7e66('0x2b')](_0x3c9736[_0x1dccf0][_0x7e66('0x1d')](_0x127c89['body'],{'transaction':_0x4d46fc}));}return BPromise[_0x7e66('0x2d')](_0x3322c2);});})[_0x7e66('0x11')](function(_0x429480){logger[_0x7e66('0x12')](_0x7e66('0x3d'),_0x127c89);logger[_0x7e66('0x13')]('GetContactRecallMe',_0x127c89,JSON['stringify'](_0x429480));_0xbd3a51(_0x429480);})[_0x7e66('0x15')](function(_0x341fc3){logger[_0x7e66('0x16')]('GetContactRecallMe',_0x341fc3[_0x7e66('0x17')],_0x127c89);_0x19b78e(_0x21642a[_0x7e66('0x16')](0x1f4,_0x341fc3[_0x7e66('0x17')]));});});});};exports[_0x7e66('0x3e')]=function(_0x522d1a){var _0x3bafe7=this;return new Promise(function(_0x486a1b,_0x18efb2){db[_0x7e66('0x22')][_0x7e66('0x23')]()['then'](function(_0x2498eb){return db[_0x7e66('0x7')]['findAll']({'raw':_0x522d1a[_0x7e66('0x9')]?_0x522d1a[_0x7e66('0x9')][_0x7e66('0xa')]===undefined?!![]:![]:!![],'where':_0x522d1a[_0x7e66('0x9')]?_0x522d1a[_0x7e66('0x9')][_0x7e66('0xb')]||null:null,'attributes':_0x522d1a[_0x7e66('0x9')]?_0x522d1a[_0x7e66('0x9')][_0x7e66('0xc')]||null:null,'limit':_0x522d1a[_0x7e66('0x9')]?_0x522d1a[_0x7e66('0x9')][_0x7e66('0xd')]||null:null,'include':_0x522d1a[_0x7e66('0x9')]?_0x522d1a[_0x7e66('0x9')][_0x7e66('0xe')]?_[_0x7e66('0xf')](_0x522d1a[_0x7e66('0x9')][_0x7e66('0xe')],function(_0x34ef2e){return{'model':db[_0x34ef2e[_0x7e66('0x10')]],'as':_0x34ef2e['as'],'attributes':_0x34ef2e['as']===_0x7e66('0x3f')?_['keys'](_0x2498eb):_0x34ef2e[_0x7e66('0xc')],'include':_0x34ef2e[_0x7e66('0xe')]?_[_0x7e66('0xf')](_0x34ef2e['include'],function(_0x527dc9){return{'model':db[_0x527dc9[_0x7e66('0x10')]],'as':_0x527dc9['as'],'attributes':_0x527dc9[_0x7e66('0xc')],'include':_0x527dc9[_0x7e66('0xe')]?_[_0x7e66('0xf')](_0x527dc9[_0x7e66('0xe')],function(_0x592cbc){return{'model':db[_0x592cbc[_0x7e66('0x10')]],'as':_0x592cbc['as'],'attributes':_0x592cbc['attributes']};}):[]};}):[]};}):[]:[]})[_0x7e66('0x11')](function(_0x1b6e27){logger[_0x7e66('0x12')](_0x7e66('0x6'),_0x522d1a);logger[_0x7e66('0x13')](_0x7e66('0x6'),_0x522d1a,JSON[_0x7e66('0x14')](_0x1b6e27));_0x486a1b(_0x1b6e27);})['catch'](function(_0x47e076){logger[_0x7e66('0x16')](_0x7e66('0x6'),_0x47e076[_0x7e66('0x17')],_0x522d1a);_0x18efb2(_0x3bafe7[_0x7e66('0x16')](0x1f4,_0x47e076[_0x7e66('0x17')]));});});});};exports['GetContactByPhone']=function(_0x2f597c){var _0x873546=this;return new Promise(function(_0x14cb89,_0x31db22){return db[_0x7e66('0x22')][_0x7e66('0x40')]({'raw':!![],'where':{'phone':_0x2f597c[_0x7e66('0x9')][_0x7e66('0xb')][_0x7e66('0x41')]},'attributes':['id',_0x7e66('0x42')],'order':[['id','DESC']]})[_0x7e66('0x11')](function(_0xaa676f){logger[_0x7e66('0x12')](_0x7e66('0x43'),_0x2f597c);logger[_0x7e66('0x13')](_0x7e66('0x43'),_0x2f597c,JSON[_0x7e66('0x14')](_0xaa676f));_0x14cb89(_0xaa676f);})[_0x7e66('0x15')](function(_0xcd8a22){logger[_0x7e66('0x16')]('getContactByPhone',_0xcd8a22[_0x7e66('0x17')],_0x2f597c);_0x31db22(_0x873546[_0x7e66('0x16')](0x1f4,_0xcd8a22[_0x7e66('0x17')]));});});};exports['ResetActiveCalls']=function(_0xd66a13){var _0x28b93c=this;return new Promise(function(_0x57072b,_0x2ba205){return db[_0x7e66('0x36')][_0x7e66('0x24')](function(_0x455aaf){var _0x4ac133=_0xd66a13[_0x7e66('0x9')]&&_0xd66a13[_0x7e66('0x9')][_0x7e66('0xb')]?_0xd66a13[_0x7e66('0x9')]['where']:{};return db['CmHopper'][_0x7e66('0x1d')](_0xd66a13[_0x7e66('0x1b')],{'where':_0x4ac133,'transaction':_0x455aaf})[_0x7e66('0x11')](function(_0xc708f4){logger[_0x7e66('0x12')]('ResetActiveCalls',_0xd66a13);logger['debug']('ResetActiveCalls',_0xd66a13,JSON['stringify'](_0xc708f4));_0x57072b(_0xc708f4);})['catch'](function(_0xec4ea9){logger[_0x7e66('0x16')](_0x7e66('0x44'),_0xec4ea9[_0x7e66('0x17')],_0xd66a13);_0x2ba205(_0x28b93c['error'](0x1f4,_0xec4ea9[_0x7e66('0x17')]));});});});};exports[_0x7e66('0x45')]=function(_0x3c19a7){var _0x42624e=this;var _0x51b491=_0x3c19a7[_0x7e66('0x1b')][_0x7e66('0xb')][_0x7e66('0x46')];var _0x4d643f=_0x3c19a7[_0x7e66('0x1b')][_0x7e66('0xb')][_0x7e66('0x47')];var _0x55478e=_0x3c19a7[_0x7e66('0x1b')][_0x7e66('0xb')][_0x7e66('0x48')];return new Promise(function(_0x425267,_0x1b77f1){return db[_0x7e66('0x7')][_0x7e66('0x8')]({'where':{'voiceQueueId':{'$in':_0x51b491},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x7e66('0x36')][_0x7e66('0x37')](_0x7e66('0x49')+_0x4d643f+_0x7e66('0x4a')),'$gt':db[_0x7e66('0x36')][_0x7e66('0x37')](_0x7e66('0x4b'))}},'UserId':{'$in':_0x55478e}},'include':[{'model':db[_0x7e66('0x22')],'as':'Contact'},{'model':db[_0x7e66('0x28')],'as':_0x7e66('0x4c'),'attributes':['id',_0x7e66('0x4d'),_0x7e66('0x29')]},{'model':db[_0x7e66('0x4e')],'as':'List'}]})[_0x7e66('0x11')](function(_0x148d8e){if(_0x148d8e[_0x7e66('0x2a')]>0x0){return db[_0x7e66('0x36')][_0x7e66('0x24')](function(_0x1ddc6b){return db[_0x7e66('0x7')][_0x7e66('0x1d')]({'recallmeNotifiedDate':db[_0x7e66('0x36')]['literal'](_0x7e66('0x4b'))},{'where':{'id':{'$in':_['map'](_0x148d8e,'id')}},'transaction':_0x1ddc6b})[_0x7e66('0x11')](function(){_0x425267(_0x148d8e);})[_0x7e66('0x15')](function(_0x47636b){logger['error'](_0x7e66('0x45'),_0x47636b[_0x7e66('0x17')],_0x3c19a7);_0x1b77f1(_0x42624e[_0x7e66('0x16')](0x1f4,_0x47636b[_0x7e66('0x17')]));});})['catch'](function(_0x30d365){logger[_0x7e66('0x16')](_0x7e66('0x45'),_0x30d365['message'],_0x3c19a7);_0x1b77f1(_0x42624e[_0x7e66('0x16')](0x1f4,_0x30d365[_0x7e66('0x17')]));});}else{_0x425267(_0x148d8e);}});});}; \ No newline at end of file +var _0x9cbb=['active','MoveContactManagedDialer','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','contactsRescheduled','GetContactRecallMe','GetCmHopperPreview','Contact','keys','GetContactByPhone','findOne','phone','dialTimezone','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','CmList','List','lodash','util','moment','bluebird','../../mysqldb','CmHopper','findAll','options','raw','where','attributes','limit','include','model','map','then','info','GetCmHopper','debug','stringify','catch','error','message','ShowCmHopper','find','CreateCmHopper','create','body','UpdateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','transaction','LOCK','User','Agent','name','voicePause','length','UserId','push','includes','update','all','dataValues'];(function(_0x2cc9e7,_0x45296b){var _0x4dda3d=function(_0x1df912){while(--_0x1df912){_0x2cc9e7['push'](_0x2cc9e7['shift']());}};_0x4dda3d(++_0x45296b);}(_0x9cbb,0x103));var _0xb9cb=function(_0x7a377e,_0x3b2067){_0x7a377e=_0x7a377e-0x0;var _0x4308c7=_0x9cbb[_0x7a377e];return _0x4308c7;};'use strict';var _=require(_0xb9cb('0x0'));var util=require(_0xb9cb('0x1'));var moment=require(_0xb9cb('0x2'));var BPromise=require(_0xb9cb('0x3'));var db=require(_0xb9cb('0x4'))['db'];var logger=require('../../config/logger')('rpc');exports['GetCmHopper']=function(_0x14d0d){var _0xc5c49d=this;return new Promise(function(_0x53da30,_0x53bc5a){return db[_0xb9cb('0x5')][_0xb9cb('0x6')]({'raw':_0x14d0d[_0xb9cb('0x7')]?_0x14d0d[_0xb9cb('0x7')][_0xb9cb('0x8')]===undefined?!![]:![]:!![],'where':_0x14d0d[_0xb9cb('0x7')]?_0x14d0d['options'][_0xb9cb('0x9')]||null:null,'attributes':_0x14d0d[_0xb9cb('0x7')]?_0x14d0d[_0xb9cb('0x7')][_0xb9cb('0xa')]||null:null,'limit':_0x14d0d[_0xb9cb('0x7')]?_0x14d0d[_0xb9cb('0x7')][_0xb9cb('0xb')]||null:null,'include':_0x14d0d[_0xb9cb('0x7')]?_0x14d0d[_0xb9cb('0x7')][_0xb9cb('0xc')]?_['map'](_0x14d0d[_0xb9cb('0x7')][_0xb9cb('0xc')],function(_0x158d78){return{'model':db[_0x158d78[_0xb9cb('0xd')]],'as':_0x158d78['as'],'attributes':_0x158d78[_0xb9cb('0xa')],'include':_0x158d78[_0xb9cb('0xc')]?_[_0xb9cb('0xe')](_0x158d78[_0xb9cb('0xc')],function(_0xd130f1){return{'model':db[_0xd130f1['model']],'as':_0xd130f1['as'],'attributes':_0xd130f1[_0xb9cb('0xa')],'include':_0xd130f1[_0xb9cb('0xc')]?_['map'](_0xd130f1[_0xb9cb('0xc')],function(_0x23d496){return{'model':db[_0x23d496[_0xb9cb('0xd')]],'as':_0x23d496['as'],'attributes':_0x23d496[_0xb9cb('0xa')]};}):[]};}):[]};}):[]:[]})[_0xb9cb('0xf')](function(_0x41c806){logger[_0xb9cb('0x10')](_0xb9cb('0x11'),_0x14d0d);logger[_0xb9cb('0x12')](_0xb9cb('0x11'),_0x14d0d,JSON[_0xb9cb('0x13')](_0x41c806));_0x53da30(_0x41c806);})[_0xb9cb('0x14')](function(_0x45fcc0){logger[_0xb9cb('0x15')](_0xb9cb('0x11'),_0x45fcc0[_0xb9cb('0x16')],_0x14d0d);_0x53bc5a(_0xc5c49d[_0xb9cb('0x15')](0x1f4,_0x45fcc0[_0xb9cb('0x16')]));});});};exports[_0xb9cb('0x17')]=function(_0x22a60a){var _0x7cb20e=this;return new Promise(function(_0x3b4642,_0x54f351){return db['CmHopper'][_0xb9cb('0x18')]({'raw':_0x22a60a[_0xb9cb('0x7')]?_0x22a60a['options']['raw']===undefined?!![]:![]:!![],'where':_0x22a60a[_0xb9cb('0x7')]?_0x22a60a[_0xb9cb('0x7')][_0xb9cb('0x9')]||null:null,'attributes':_0x22a60a[_0xb9cb('0x7')]?_0x22a60a[_0xb9cb('0x7')]['attributes']||null:null,'include':_0x22a60a[_0xb9cb('0x7')]?_0x22a60a[_0xb9cb('0x7')]['include']?_['map'](_0x22a60a[_0xb9cb('0x7')]['include'],function(_0x1530bf){return{'model':db[_0x1530bf['model']],'as':_0x1530bf['as'],'attributes':_0x1530bf[_0xb9cb('0xa')],'include':_0x1530bf[_0xb9cb('0xc')]?_[_0xb9cb('0xe')](_0x1530bf[_0xb9cb('0xc')],function(_0xc21508){return{'model':db[_0xc21508[_0xb9cb('0xd')]],'as':_0xc21508['as'],'attributes':_0xc21508['attributes'],'include':_0xc21508[_0xb9cb('0xc')]?_[_0xb9cb('0xe')](_0xc21508[_0xb9cb('0xc')],function(_0x5cb09d){return{'model':db[_0x5cb09d['model']],'as':_0x5cb09d['as'],'attributes':_0x5cb09d[_0xb9cb('0xa')]};}):[]};}):[]};}):[]:[]})[_0xb9cb('0xf')](function(_0x5bba0e){logger[_0xb9cb('0x10')](_0xb9cb('0x17'),_0x22a60a);logger[_0xb9cb('0x12')]('ShowCmHopper',_0x22a60a,JSON[_0xb9cb('0x13')](_0x5bba0e));_0x3b4642(_0x5bba0e);})[_0xb9cb('0x14')](function(_0x544864){logger[_0xb9cb('0x15')](_0xb9cb('0x17'),_0x544864[_0xb9cb('0x16')],_0x22a60a);_0x54f351(_0x7cb20e[_0xb9cb('0x15')](0x1f4,_0x544864[_0xb9cb('0x16')]));});});};exports[_0xb9cb('0x19')]=function(_0x415366){var _0x48101e=this;return new Promise(function(_0x1467e9,_0x4f3301){return db[_0xb9cb('0x5')][_0xb9cb('0x1a')](_0x415366['body'],{'raw':_0x415366[_0xb9cb('0x7')]?_0x415366[_0xb9cb('0x7')][_0xb9cb('0x8')]===undefined?!![]:![]:!![]})[_0xb9cb('0xf')](function(_0x31cd86){logger['info'](_0xb9cb('0x19'),_0x415366);logger[_0xb9cb('0x12')](_0xb9cb('0x19'),_0x415366,JSON[_0xb9cb('0x13')](_0x31cd86));_0x1467e9(_0x31cd86);})[_0xb9cb('0x14')](function(_0x3e0c4b){logger[_0xb9cb('0x15')](_0xb9cb('0x19'),_0x3e0c4b['message'],_0x415366);_0x4f3301(_0x48101e[_0xb9cb('0x15')](0x1f4,_0x3e0c4b[_0xb9cb('0x16')]));});});};exports['UpdateCmHopper']=function(_0x3bf3c8){var _0x4dc6a7=this;return new Promise(function(_0x2949cd,_0x4fa891){return db[_0xb9cb('0x5')]['update'](_0x3bf3c8[_0xb9cb('0x1b')],{'raw':_0x3bf3c8[_0xb9cb('0x7')]?_0x3bf3c8[_0xb9cb('0x7')][_0xb9cb('0x8')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3bf3c8[_0xb9cb('0x7')]?_0x3bf3c8[_0xb9cb('0x7')][_0xb9cb('0x9')]||null:null,'attributes':_0x3bf3c8[_0xb9cb('0x7')]?_0x3bf3c8['options']['attributes']||null:null,'limit':_0x3bf3c8[_0xb9cb('0x7')]?_0x3bf3c8[_0xb9cb('0x7')][_0xb9cb('0xb')]||null:null})[_0xb9cb('0xf')](function(_0x4ae581){logger[_0xb9cb('0x10')](_0xb9cb('0x1c'),_0x3bf3c8);logger[_0xb9cb('0x10')](_0xb9cb('0x1d'),JSON['stringify'](_0x3bf3c8[_0xb9cb('0x7')][_0xb9cb('0x9')]),_0x3bf3c8[_0xb9cb('0x1b')]['active']);logger[_0xb9cb('0x12')](_0xb9cb('0x1c'),_0x3bf3c8,JSON[_0xb9cb('0x13')](_0x4ae581));_0x2949cd(_0x4ae581);})[_0xb9cb('0x14')](function(_0x1c73ca){logger[_0xb9cb('0x15')]('UpdateCmHopper',_0x1c73ca[_0xb9cb('0x16')],_0x3bf3c8);_0x4fa891(_0x4dc6a7[_0xb9cb('0x15')](0x1f4,_0x1c73ca[_0xb9cb('0x16')]));});});};exports[_0xb9cb('0x1e')]=function(_0x518e6b){var _0x2a30f4=this;return new Promise(function(_0x3c9cd8,_0xf8f88){return db['CmHopper'][_0xb9cb('0x1f')]({'where':_0x518e6b[_0xb9cb('0x7')]?_0x518e6b['options'][_0xb9cb('0x9')]||null:null})['then'](function(_0x572e69){logger['info'](_0xb9cb('0x1e'),_0x518e6b);logger['debug']('DestroyCmHopper',_0x518e6b,JSON[_0xb9cb('0x13')](_0x572e69));_0x3c9cd8(_0x572e69);})[_0xb9cb('0x14')](function(_0x3acb39){logger[_0xb9cb('0x15')](_0xb9cb('0x1e'),_0x3acb39['message'],_0x518e6b);_0xf8f88(_0x2a30f4[_0xb9cb('0x15')](0x1f4,_0x3acb39[_0xb9cb('0x16')]));});});};exports[_0xb9cb('0x20')]=function(_0x209c63){var _0x470b6a=this;return new Promise(function(_0x244a4e,_0x245d2a){return db[_0xb9cb('0x21')][_0xb9cb('0x22')]()[_0xb9cb('0xf')](function(_0x1c7c67){return db[_0xb9cb('0x23')][_0xb9cb('0x24')](function(_0x4221fd){return db['CmHopper'][_0xb9cb('0x6')]({'where':_0x209c63[_0xb9cb('0x7')]?_0x209c63[_0xb9cb('0x7')][_0xb9cb('0x9')]||null:null,'attributes':_0x209c63[_0xb9cb('0x7')]?_0x209c63[_0xb9cb('0x7')][_0xb9cb('0xa')]||null:null,'limit':_0x209c63[_0xb9cb('0x7')]?_0x209c63[_0xb9cb('0x7')][_0xb9cb('0xb')]||null:null,'order':_0x209c63[_0xb9cb('0x7')]?_0x209c63[_0xb9cb('0x7')]['order']||null:null,'transaction':_0x4221fd,'lock':_0x4221fd[_0xb9cb('0x25')]['UPDATE'],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_['keys'](_0x1c7c67)},{'model':db[_0xb9cb('0x26')],'as':_0xb9cb('0x27'),'attributes':['id',_0xb9cb('0x28'),_0xb9cb('0x29')]}]})[_0xb9cb('0xf')](function(_0x587b8a){var _0x12d0fc=[];var _0x3a57f1=[];for(var _0x481b66=0x0;_0x481b66<_0x587b8a[_0xb9cb('0x2a')];_0x481b66+=0x1){var _0x5ee668=_0x587b8a[_0x481b66][_0xb9cb('0x2b')];if(_0x5ee668===null){_0x12d0fc[_0xb9cb('0x2c')](_0x587b8a[_0x481b66]['update'](_0x209c63[_0xb9cb('0x1b')],{'transaction':_0x4221fd}));}else if(!_0x3a57f1[_0xb9cb('0x2d')](_0x5ee668)){_0x3a57f1[_0xb9cb('0x2c')](_0x5ee668);_0x12d0fc[_0xb9cb('0x2c')](_0x587b8a[_0x481b66][_0xb9cb('0x2e')](_0x209c63[_0xb9cb('0x1b')],{'transaction':_0x4221fd}));}}return BPromise[_0xb9cb('0x2f')](_0x12d0fc);});})[_0xb9cb('0xf')](function(_0x1f12bf){logger[_0xb9cb('0x10')](_0xb9cb('0x20'),_0x209c63);if(_0x1f12bf[_0xb9cb('0x2a')]>0x0){logger[_0xb9cb('0x10')]('GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]',_0x1f12bf[0x0][_0xb9cb('0x30')]['id'],_0x1f12bf[0x0][_0xb9cb('0x30')]['ContactId'],_0x1f12bf[0x0][_0xb9cb('0x30')][_0xb9cb('0x31')]);}logger[_0xb9cb('0x12')](_0xb9cb('0x20'),_0x209c63,JSON['stringify'](_0x1f12bf));_0x244a4e(_0x1f12bf);})[_0xb9cb('0x14')](function(_0x13be5){logger[_0xb9cb('0x15')](_0xb9cb('0x20'),_0x13be5[_0xb9cb('0x16')],_0x209c63);_0x245d2a(_0x470b6a[_0xb9cb('0x15')](0x1f4,_0x13be5[_0xb9cb('0x16')]));});});});};exports[_0xb9cb('0x32')]=function(_0x152a58){var _0x78cd15=this;return new Promise(function(_0x3e60a3,_0x59227f){return db['sequelize'][_0xb9cb('0x24')](function(_0x5b9002){return db[_0xb9cb('0x33')][_0xb9cb('0x1a')](_0x152a58['body'],{'raw':_0x152a58[_0xb9cb('0x7')]?_0x152a58['options']['raw']===undefined?!![]:![]:!![],'transaction':_0x5b9002})[_0xb9cb('0xf')](function(){logger[_0xb9cb('0x10')](_0xb9cb('0x34'),JSON[_0xb9cb('0x13')](_0x152a58[_0xb9cb('0x7')][_0xb9cb('0x9')]),_0x152a58[_0xb9cb('0x7')][_0xb9cb('0x9')][_0xb9cb('0x31')]);return db[_0xb9cb('0x5')][_0xb9cb('0x1f')]({'where':_0x152a58['options']?_0x152a58[_0xb9cb('0x7')]['where']||null:null,'transaction':_0x5b9002});});})[_0xb9cb('0xf')](function(_0x4b6589){logger[_0xb9cb('0x10')](_0xb9cb('0x32'),_0x152a58);logger[_0xb9cb('0x12')](_0xb9cb('0x32'),_0x152a58,JSON[_0xb9cb('0x13')](_0x4b6589));_0x3e60a3(_0x4b6589);})[_0xb9cb('0x14')](function(_0x295954){logger['error']('MoveContactManagedDialer',_0x295954[_0xb9cb('0x16')],_0x152a58);_0x59227f(_0x78cd15[_0xb9cb('0x15')](0x1f4,_0x295954[_0xb9cb('0x16')]));});});};exports[_0xb9cb('0x35')]=function(_0x1a14cb){var _0x2778a8=this;return new Promise(function(_0x3c32be,_0x1d921d){return db['CmHopper'][_0xb9cb('0x6')]({'raw':_0x1a14cb[_0xb9cb('0x7')]?_0x1a14cb[_0xb9cb('0x7')]['raw']===undefined?!![]:![]:!![],'where':_0x1a14cb[_0xb9cb('0x7')]?_0x1a14cb[_0xb9cb('0x7')]['where']||null:null,'attributes':[[db[_0xb9cb('0x23')]['fn'](_0xb9cb('0x36'),db[_0xb9cb('0x23')]['fn']('IF',db[_0xb9cb('0x23')][_0xb9cb('0x37')](_0xb9cb('0x38')+util['format']('\x22%s\x22',moment()[_0xb9cb('0x39')]('YYYY-MM-DD\x20HH:mm:ss'))+'\x20,\x201,\x20null'))),_0xb9cb('0x3a')]]})[_0xb9cb('0xf')](function(_0x58b291){logger[_0xb9cb('0x10')]('CountReScheduled',_0x1a14cb);logger[_0xb9cb('0x12')](_0xb9cb('0x35'),_0x1a14cb,JSON[_0xb9cb('0x13')](_0x58b291));_0x3c32be(_0x58b291);})['catch'](function(_0x35a160){logger['error'](_0xb9cb('0x35'),_0x35a160['message'],_0x1a14cb);_0x1d921d(_0x2778a8[_0xb9cb('0x15')](0x1f4,_0x35a160[_0xb9cb('0x16')]));});});};exports[_0xb9cb('0x3b')]=function(_0x599840){var _0x98f044=this;return new Promise(function(_0x28144c,_0x4de841){return db[_0xb9cb('0x21')][_0xb9cb('0x22')]()[_0xb9cb('0xf')](function(){return db[_0xb9cb('0x23')][_0xb9cb('0x24')](function(_0x5ec850){return db[_0xb9cb('0x5')][_0xb9cb('0x6')]({'where':_0x599840['options']?_0x599840[_0xb9cb('0x7')][_0xb9cb('0x9')]||null:null,'attributes':_0x599840[_0xb9cb('0x7')]?_0x599840[_0xb9cb('0x7')][_0xb9cb('0xa')]||null:null,'limit':0x1,'order':_0x599840['options']?_0x599840[_0xb9cb('0x7')]['order']||null:null,'group':db['CmHopper'][_0xb9cb('0x2b')],'transaction':_0x5ec850,'lock':_0x5ec850[_0xb9cb('0x25')]['UPDATE'],'include':_0x599840[_0xb9cb('0x7')]?_0x599840[_0xb9cb('0x7')][_0xb9cb('0xc')]?_[_0xb9cb('0xe')](_0x599840['options'][_0xb9cb('0xc')],function(_0x44647e){return{'model':db[_0x44647e[_0xb9cb('0xd')]],'as':_0x44647e['as'],'attributes':_0x44647e[_0xb9cb('0xa')],'include':_0x44647e['include']?_[_0xb9cb('0xe')](_0x44647e[_0xb9cb('0xc')],function(_0x216635){return{'model':db[_0x216635[_0xb9cb('0xd')]],'as':_0x216635['as'],'attributes':_0x216635[_0xb9cb('0xa')],'include':_0x216635[_0xb9cb('0xc')]?_[_0xb9cb('0xe')](_0x216635[_0xb9cb('0xc')],function(_0x9b4c38){return{'model':db[_0x9b4c38[_0xb9cb('0xd')]],'as':_0x9b4c38['as'],'attributes':_0x9b4c38['attributes']};}):[]};}):[]};}):[]:[]})[_0xb9cb('0xf')](function(_0x552e4c){var _0x57e0fd=[];for(var _0x37e738=0x0;_0x37e738<_0x552e4c[_0xb9cb('0x2a')];_0x37e738+=0x1){_0x57e0fd[_0xb9cb('0x2c')](_0x552e4c[_0x37e738][_0xb9cb('0x2e')](_0x599840[_0xb9cb('0x1b')],{'transaction':_0x5ec850}));}return BPromise[_0xb9cb('0x2f')](_0x57e0fd);});})[_0xb9cb('0xf')](function(_0x4781e7){logger[_0xb9cb('0x10')](_0xb9cb('0x3b'),_0x599840);logger[_0xb9cb('0x12')](_0xb9cb('0x3b'),_0x599840,JSON[_0xb9cb('0x13')](_0x4781e7));_0x28144c(_0x4781e7);})['catch'](function(_0x142593){logger[_0xb9cb('0x15')]('GetContactRecallMe',_0x142593[_0xb9cb('0x16')],_0x599840);_0x4de841(_0x98f044['error'](0x1f4,_0x142593['message']));});});});};exports[_0xb9cb('0x3c')]=function(_0x391260){var _0x5bc47b=this;return new Promise(function(_0x2de7de,_0x9986a4){db[_0xb9cb('0x21')][_0xb9cb('0x22')]()['then'](function(_0x2c3564){return db['CmHopper'][_0xb9cb('0x6')]({'raw':_0x391260[_0xb9cb('0x7')]?_0x391260[_0xb9cb('0x7')]['raw']===undefined?!![]:![]:!![],'where':_0x391260[_0xb9cb('0x7')]?_0x391260[_0xb9cb('0x7')][_0xb9cb('0x9')]||null:null,'attributes':_0x391260[_0xb9cb('0x7')]?_0x391260['options'][_0xb9cb('0xa')]||null:null,'limit':_0x391260[_0xb9cb('0x7')]?_0x391260['options'][_0xb9cb('0xb')]||null:null,'include':_0x391260[_0xb9cb('0x7')]?_0x391260[_0xb9cb('0x7')][_0xb9cb('0xc')]?_[_0xb9cb('0xe')](_0x391260[_0xb9cb('0x7')]['include'],function(_0x4201f1){return{'model':db[_0x4201f1[_0xb9cb('0xd')]],'as':_0x4201f1['as'],'attributes':_0x4201f1['as']===_0xb9cb('0x3d')?_[_0xb9cb('0x3e')](_0x2c3564):_0x4201f1[_0xb9cb('0xa')],'include':_0x4201f1[_0xb9cb('0xc')]?_['map'](_0x4201f1[_0xb9cb('0xc')],function(_0x39d0e8){return{'model':db[_0x39d0e8[_0xb9cb('0xd')]],'as':_0x39d0e8['as'],'attributes':_0x39d0e8['attributes'],'include':_0x39d0e8[_0xb9cb('0xc')]?_[_0xb9cb('0xe')](_0x39d0e8[_0xb9cb('0xc')],function(_0x44d41f){return{'model':db[_0x44d41f[_0xb9cb('0xd')]],'as':_0x44d41f['as'],'attributes':_0x44d41f[_0xb9cb('0xa')]};}):[]};}):[]};}):[]:[]})[_0xb9cb('0xf')](function(_0x4fd06){logger[_0xb9cb('0x10')]('GetCmHopper',_0x391260);logger[_0xb9cb('0x12')](_0xb9cb('0x11'),_0x391260,JSON['stringify'](_0x4fd06));_0x2de7de(_0x4fd06);})['catch'](function(_0x5f144d){logger[_0xb9cb('0x15')](_0xb9cb('0x11'),_0x5f144d[_0xb9cb('0x16')],_0x391260);_0x9986a4(_0x5bc47b[_0xb9cb('0x15')](0x1f4,_0x5f144d[_0xb9cb('0x16')]));});});});};exports[_0xb9cb('0x3f')]=function(_0xe06e35){var _0x5d8474=this;return new Promise(function(_0x338122,_0x580275){return db['CmContact'][_0xb9cb('0x40')]({'raw':!![],'where':{'phone':_0xe06e35[_0xb9cb('0x7')][_0xb9cb('0x9')][_0xb9cb('0x41')]},'attributes':['id',_0xb9cb('0x42')],'order':[['id','DESC']]})[_0xb9cb('0xf')](function(_0xbcbc6b){logger[_0xb9cb('0x10')](_0xb9cb('0x43'),_0xe06e35);logger['debug'](_0xb9cb('0x43'),_0xe06e35,JSON['stringify'](_0xbcbc6b));_0x338122(_0xbcbc6b);})[_0xb9cb('0x14')](function(_0x3c695f){logger[_0xb9cb('0x15')](_0xb9cb('0x43'),_0x3c695f[_0xb9cb('0x16')],_0xe06e35);_0x580275(_0x5d8474[_0xb9cb('0x15')](0x1f4,_0x3c695f[_0xb9cb('0x16')]));});});};exports[_0xb9cb('0x44')]=function(_0x171b1e){var _0x855def=this;return new Promise(function(_0x1e5ca8,_0x457ac7){return db[_0xb9cb('0x23')][_0xb9cb('0x24')](function(_0x148cd7){var _0x2af781=_0x171b1e[_0xb9cb('0x7')]&&_0x171b1e[_0xb9cb('0x7')][_0xb9cb('0x9')]?_0x171b1e[_0xb9cb('0x7')][_0xb9cb('0x9')]:{};return db['CmHopper']['update'](_0x171b1e[_0xb9cb('0x1b')],{'where':_0x2af781,'transaction':_0x148cd7})[_0xb9cb('0xf')](function(_0x427590){logger[_0xb9cb('0x10')](_0xb9cb('0x44'),_0x171b1e);logger[_0xb9cb('0x12')](_0xb9cb('0x44'),_0x171b1e,JSON[_0xb9cb('0x13')](_0x427590));_0x1e5ca8(_0x427590);})[_0xb9cb('0x14')](function(_0x282011){logger[_0xb9cb('0x15')](_0xb9cb('0x44'),_0x282011[_0xb9cb('0x16')],_0x171b1e);_0x457ac7(_0x855def[_0xb9cb('0x15')](0x1f4,_0x282011[_0xb9cb('0x16')]));});});});};exports[_0xb9cb('0x45')]=function(_0x40092c){var _0x52a90d=this;var _0x5d1c82=_0x40092c[_0xb9cb('0x1b')]['where']['voiceQueueIds'];var _0x5e0257=_0x40092c['body'][_0xb9cb('0x9')][_0xb9cb('0x46')];var _0x561e19=_0x40092c[_0xb9cb('0x1b')][_0xb9cb('0x9')][_0xb9cb('0x47')];return new Promise(function(_0x3388d2,_0xae24a1){return db[_0xb9cb('0x5')][_0xb9cb('0x6')]({'where':{'voiceQueueId':{'$in':_0x5d1c82},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xb9cb('0x23')][_0xb9cb('0x37')](_0xb9cb('0x48')+_0x5e0257+_0xb9cb('0x49')),'$gt':db[_0xb9cb('0x23')][_0xb9cb('0x37')](_0xb9cb('0x4a'))}},'UserId':{'$in':_0x561e19}},'include':[{'model':db[_0xb9cb('0x21')],'as':'Contact'},{'model':db['User'],'as':_0xb9cb('0x27'),'attributes':['id',_0xb9cb('0x28'),_0xb9cb('0x29')]},{'model':db[_0xb9cb('0x4b')],'as':_0xb9cb('0x4c')}]})[_0xb9cb('0xf')](function(_0x2f4207){if(_0x2f4207[_0xb9cb('0x2a')]>0x0){return db[_0xb9cb('0x23')][_0xb9cb('0x24')](function(_0x34dd56){return db[_0xb9cb('0x5')]['update']({'recallmeNotifiedDate':db[_0xb9cb('0x23')][_0xb9cb('0x37')](_0xb9cb('0x4a'))},{'where':{'id':{'$in':_[_0xb9cb('0xe')](_0x2f4207,'id')}},'transaction':_0x34dd56})[_0xb9cb('0xf')](function(){_0x3388d2(_0x2f4207);})[_0xb9cb('0x14')](function(_0x2857e7){logger[_0xb9cb('0x15')](_0xb9cb('0x45'),_0x2857e7['message'],_0x40092c);_0xae24a1(_0x52a90d[_0xb9cb('0x15')](0x1f4,_0x2857e7['message']));});})['catch'](function(_0x50007c){logger[_0xb9cb('0x15')](_0xb9cb('0x45'),_0x50007c[_0xb9cb('0x16')],_0x40092c);_0xae24a1(_0x52a90d[_0xb9cb('0x15')](0x1f4,_0x50007c[_0xb9cb('0x16')]));});}else{_0x3388d2(_0x2f4207);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 6e8ebdd..ac1a5b9 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 _0xa706=['show','/:id/previewrecall','getPreviewRecall','post','create','/preview','getPreview','/timezone','getTimezone','put','update','delete','destroy','exports','express','Router','../../components/auth/service','./cmHopper.controller','get','index','/opencontacts','getOpenContacts','isAuthenticated','getTimezones','/:id'];(function(_0x12d6c2,_0x409bc8){var _0x1c9825=function(_0x569f66){while(--_0x569f66){_0x12d6c2['push'](_0x12d6c2['shift']());}};_0x1c9825(++_0x409bc8);}(_0xa706,0xa4));var _0x6a70=function(_0x4e5f74,_0x1edc00){_0x4e5f74=_0x4e5f74-0x0;var _0x5cdaf0=_0xa706[_0x4e5f74];return _0x5cdaf0;};'use strict';var express=require(_0x6a70('0x0'));var router=express[_0x6a70('0x1')]();var auth=require(_0x6a70('0x2'));var controller=require(_0x6a70('0x3'));router[_0x6a70('0x4')]('/',auth['isAuthenticated'](),controller[_0x6a70('0x5')]);router[_0x6a70('0x4')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x6a70('0x4')](_0x6a70('0x6'),auth['isAuthenticated'](),controller[_0x6a70('0x7')]);router[_0x6a70('0x4')]('/timezones',auth[_0x6a70('0x8')](),controller[_0x6a70('0x9')]);router[_0x6a70('0x4')](_0x6a70('0xa'),auth['isAuthenticated'](),controller[_0x6a70('0xb')]);router[_0x6a70('0x4')](_0x6a70('0xc'),auth['isAuthenticated'](),controller[_0x6a70('0xd')]);router[_0x6a70('0xe')]('/',auth[_0x6a70('0x8')](),controller[_0x6a70('0xf')]);router[_0x6a70('0xe')](_0x6a70('0x10'),auth[_0x6a70('0x8')](),controller[_0x6a70('0x11')]);router[_0x6a70('0xe')](_0x6a70('0x12'),auth[_0x6a70('0x8')](),controller[_0x6a70('0x13')]);router[_0x6a70('0x14')]('/:id',auth[_0x6a70('0x8')](),controller[_0x6a70('0x15')]);router[_0x6a70('0x16')](_0x6a70('0xa'),auth[_0x6a70('0x8')](),controller[_0x6a70('0x17')]);module[_0x6a70('0x18')]=router; \ No newline at end of file +var _0x9ef0=['express','Router','../../components/auth/service','get','/describe','describe','/opencontacts','isAuthenticated','/timezones','getTimezones','/:id','show','/:id/previewrecall','getPreviewRecall','post','/timezone','getTimezone','put','update','delete','destroy','exports'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x9ef0,0x14a));var _0x09ef=function(_0x1901ab,_0x53801c){_0x1901ab=_0x1901ab-0x0;var _0xfb38dc=_0x9ef0[_0x1901ab];return _0xfb38dc;};'use strict';var express=require(_0x09ef('0x0'));var router=express[_0x09ef('0x1')]();var auth=require(_0x09ef('0x2'));var controller=require('./cmHopper.controller');router[_0x09ef('0x3')]('/',auth['isAuthenticated'](),controller['index']);router[_0x09ef('0x3')](_0x09ef('0x4'),auth['isAuthenticated'](),controller[_0x09ef('0x5')]);router[_0x09ef('0x3')](_0x09ef('0x6'),auth[_0x09ef('0x7')](),controller['getOpenContacts']);router[_0x09ef('0x3')](_0x09ef('0x8'),auth[_0x09ef('0x7')](),controller[_0x09ef('0x9')]);router[_0x09ef('0x3')](_0x09ef('0xa'),auth['isAuthenticated'](),controller[_0x09ef('0xb')]);router[_0x09ef('0x3')](_0x09ef('0xc'),auth[_0x09ef('0x7')](),controller[_0x09ef('0xd')]);router[_0x09ef('0xe')]('/',auth[_0x09ef('0x7')](),controller['create']);router['post']('/preview',auth['isAuthenticated'](),controller['getPreview']);router['post'](_0x09ef('0xf'),auth[_0x09ef('0x7')](),controller[_0x09ef('0x10')]);router[_0x09ef('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x09ef('0x12')]);router[_0x09ef('0x13')](_0x09ef('0xa'),auth['isAuthenticated'](),controller[_0x09ef('0x14')]);module[_0x09ef('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 19ded30..720032a 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 _0xc49c=['INTEGER','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','moment','sequelize','exports'];(function(_0x306e30,_0x107fe3){var _0x247281=function(_0x2930a9){while(--_0x2930a9){_0x306e30['push'](_0x306e30['shift']());}};_0x247281(++_0x107fe3);}(_0xc49c,0x125));var _0xcc49=function(_0x4e8821,_0x291712){_0x4e8821=_0x4e8821-0x0;var _0x19520d=_0xc49c[_0x4e8821];return _0x19520d;};'use strict';var moment=require(_0xcc49('0x0'));var Sequelize=require(_0xcc49('0x1'));module[_0xcc49('0x2')]={'CmHopperId':{'type':Sequelize[_0xcc49('0x3')]},'phone':{'type':Sequelize[_0xcc49('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xcc49('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xcc49('0x5')],'defaultValue':moment()[_0xcc49('0x6')](_0xcc49('0x7'))},'countbusyretry':{'type':Sequelize[_0xcc49('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xcc49('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xcc49('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xcc49('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xcc49('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x55d6=['INTEGER','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x13bf8e,_0x4f4621){var _0xe3bbd5=function(_0x5463c6){while(--_0x5463c6){_0x13bf8e['push'](_0x13bf8e['shift']());}};_0xe3bbd5(++_0x4f4621);}(_0x55d6,0x15c));var _0x655d=function(_0x11db5a,_0x22b33){_0x11db5a=_0x11db5a-0x0;var _0xf872f3=_0x55d6[_0x11db5a];return _0xf872f3;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'CmHopperId':{'type':Sequelize[_0x655d('0x0')]},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x655d('0x1')],'defaultValue':moment()[_0x655d('0x2')](_0x655d('0x3'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x655d('0x0')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x655d('0x0')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x655d('0x0')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x655d('0x0')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x655d('0x0')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index 9a8dc0a..cadaf42 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 _0x4a23=['attributes','intersection','fields','length','model','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','rimraf','zip-dir','fast-json-patch','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','destroy','then','get','CmHopperAdditionalPhones','UserProfileResource','end','error','stack','name','index','map','CmHopperAdditionalPhone','rawAttributes','key','query','keys'];(function(_0x21bfab,_0x2fee48){var _0x4db318=function(_0x10396d){while(--_0x10396d){_0x21bfab['push'](_0x21bfab['shift']());}};_0x4db318(++_0x2fee48);}(_0x4a23,0x6f));var _0x34a2=function(_0x4c9371,_0x4ea641){_0x4c9371=_0x4c9371-0x0;var _0x1f3c41=_0x4a23[_0x4c9371];return _0x1f3c41;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x34a2('0x0'));var zipdir=require(_0x34a2('0x1'));var jsonpatch=require(_0x34a2('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x34a2('0x3'));var Mustache=require('mustache');var util=require(_0x34a2('0x4'));var path=require('path');var sox=require(_0x34a2('0x5'));var csv=require(_0x34a2('0x6'));var ejs=require(_0x34a2('0x7'));var fs=require('fs');var fs_extra=require(_0x34a2('0x8'));var _=require(_0x34a2('0x9'));var squel=require(_0x34a2('0xa'));var crypto=require(_0x34a2('0xb'));var jsforce=require(_0x34a2('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x34a2('0x6'));var querystring=require(_0x34a2('0xd'));var Papa=require(_0x34a2('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x34a2('0xf'));var hardwareService=require(_0x34a2('0x10'));var logger=require(_0x34a2('0x11'))(_0x34a2('0x12'));var utils=require(_0x34a2('0x13'));var config=require(_0x34a2('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x54d0b6,_0xe7cee0){_0xe7cee0=_0xe7cee0||0xcc;return function(_0x315bbb){if(_0x315bbb){return _0x54d0b6[_0x34a2('0x15')](_0xe7cee0);}return _0x54d0b6['status'](_0xe7cee0)['end']();};}function respondWithResult(_0x3297f7,_0x2b99c9){_0x2b99c9=_0x2b99c9||0xc8;return function(_0xa09e6f){if(_0xa09e6f){return _0x3297f7[_0x34a2('0x16')](_0x2b99c9)[_0x34a2('0x17')](_0xa09e6f);}};}function respondWithFilteredResult(_0x5ca39a,_0x279f7c){return function(_0x35e7fd){if(_0x35e7fd){var _0x2e466e=typeof _0x279f7c['offset']===_0x34a2('0x18')&&typeof _0x279f7c[_0x34a2('0x19')]===_0x34a2('0x18');var _0x474726=_0x35e7fd[_0x34a2('0x1a')];var _0x4a9104=_0x2e466e?0x0:_0x279f7c[_0x34a2('0x1b')];var _0x1146e1=_0x2e466e?_0x35e7fd['count']:_0x279f7c['offset']+_0x279f7c[_0x34a2('0x19')];var _0x4298e8;if(_0x1146e1>=_0x474726){_0x1146e1=_0x474726;_0x4298e8=0xc8;}else{_0x4298e8=0xce;}_0x5ca39a[_0x34a2('0x16')](_0x4298e8);return _0x5ca39a[_0x34a2('0x1c')](_0x34a2('0x1d'),_0x4a9104+'-'+_0x1146e1+'/'+_0x474726)[_0x34a2('0x17')](_0x35e7fd);}return null;};}function patchUpdates(_0x43941d){return function(_0x1b542f){try{jsonpatch[_0x34a2('0x1e')](_0x1b542f,_0x43941d,!![]);}catch(_0x2fff36){return BPromise[_0x34a2('0x1f')](_0x2fff36);}return _0x1b542f[_0x34a2('0x20')]();};}function saveUpdates(_0x5f1392,_0x31954e){return function(_0x145264){if(_0x145264){return _0x145264['update'](_0x5f1392)['then'](function(_0x5e4ae1){return _0x5e4ae1;});}return null;};}function removeEntity(_0x57687b,_0x8aacfc){return function(_0x135f0f){if(_0x135f0f){return _0x135f0f[_0x34a2('0x21')]()[_0x34a2('0x22')](function(){var _0x272671=_0x135f0f[_0x34a2('0x23')]({'plain':!![]});var _0x7f8f77=_0x34a2('0x24');return db[_0x34a2('0x25')][_0x34a2('0x21')]({'where':{'type':_0x7f8f77,'resourceId':_0x272671['id']}})[_0x34a2('0x22')](function(){return _0x135f0f;});})[_0x34a2('0x22')](function(){_0x57687b[_0x34a2('0x16')](0xcc)[_0x34a2('0x26')]();});}};}function handleEntityNotFound(_0x12825a,_0xde2cbd){return function(_0x152a8d){if(!_0x152a8d){_0x12825a[_0x34a2('0x15')](0x194);}return _0x152a8d;};}function handleError(_0x336cb5,_0x5ced61){_0x5ced61=_0x5ced61||0x1f4;return function(_0x3f6276){logger[_0x34a2('0x27')](_0x3f6276[_0x34a2('0x28')]);if(_0x3f6276[_0x34a2('0x29')]){delete _0x3f6276['name'];}_0x336cb5[_0x34a2('0x16')](_0x5ced61)['send'](_0x3f6276);};}exports[_0x34a2('0x2a')]=function(_0x4cd16f,_0x2136c5){var _0x5dc857={},_0x4f0029={},_0x1af305={'count':0x0,'rows':[]};var _0x2f5cea=_[_0x34a2('0x2b')](db[_0x34a2('0x2c')][_0x34a2('0x2d')],function(_0x9f7cb9){return{'name':_0x9f7cb9['fieldName'],'type':_0x9f7cb9['type'][_0x34a2('0x2e')]};});_0x4f0029['model']=_[_0x34a2('0x2b')](_0x2f5cea,'name');_0x4f0029[_0x34a2('0x2f')]=_[_0x34a2('0x30')](_0x4cd16f['query']);_0x4f0029['filters']=_['intersection'](_0x4f0029['model'],_0x4f0029[_0x34a2('0x2f')]);_0x5dc857[_0x34a2('0x31')]=_[_0x34a2('0x32')](_0x4f0029['model'],qs[_0x34a2('0x33')](_0x4cd16f['query'][_0x34a2('0x33')]));_0x5dc857[_0x34a2('0x31')]=_0x5dc857[_0x34a2('0x31')][_0x34a2('0x34')]?_0x5dc857['attributes']:_0x4f0029[_0x34a2('0x35')];if(!_0x4cd16f[_0x34a2('0x2f')][_0x34a2('0x36')](_0x34a2('0x37'))){_0x5dc857[_0x34a2('0x19')]=qs['limit'](_0x4cd16f['query'][_0x34a2('0x19')]);_0x5dc857[_0x34a2('0x1b')]=qs['offset'](_0x4cd16f[_0x34a2('0x2f')][_0x34a2('0x1b')]);}_0x5dc857[_0x34a2('0x38')]=qs[_0x34a2('0x39')](_0x4cd16f[_0x34a2('0x2f')][_0x34a2('0x39')]);_0x5dc857[_0x34a2('0x3a')]=qs['filters'](_[_0x34a2('0x3b')](_0x4cd16f['query'],_0x4f0029['filters']),_0x2f5cea);if(_0x4cd16f[_0x34a2('0x2f')][_0x34a2('0x3c')]){_0x5dc857[_0x34a2('0x3a')]=_[_0x34a2('0x3d')](_0x5dc857['where'],{'$or':_[_0x34a2('0x2b')](_0x2f5cea,function(_0x31f99f){if(_0x31f99f[_0x34a2('0x3e')]!==_0x34a2('0x3f')){var _0x4f86f1={};_0x4f86f1[_0x31f99f[_0x34a2('0x29')]]={'$like':'%'+_0x4cd16f['query'][_0x34a2('0x3c')]+'%'};return _0x4f86f1;}})});}_0x5dc857=_[_0x34a2('0x3d')]({},_0x5dc857,_0x4cd16f[_0x34a2('0x40')]);var _0x54d1f4={'where':_0x5dc857['where']};return db[_0x34a2('0x2c')][_0x34a2('0x1a')](_0x54d1f4)[_0x34a2('0x22')](function(_0x477199){_0x1af305['count']=_0x477199;if(_0x4cd16f[_0x34a2('0x2f')][_0x34a2('0x41')]){_0x5dc857[_0x34a2('0x42')]=[{'all':!![]}];}return db[_0x34a2('0x2c')]['findAll'](_0x5dc857);})[_0x34a2('0x22')](function(_0x10020b){_0x1af305[_0x34a2('0x43')]=_0x10020b;return _0x1af305;})['then'](respondWithFilteredResult(_0x2136c5,_0x5dc857))[_0x34a2('0x44')](handleError(_0x2136c5,null));};exports[_0x34a2('0x45')]=function(_0x44f3d6,_0x8e75c4){var _0x5b7b18={'raw':!![],'where':{'id':_0x44f3d6[_0x34a2('0x46')]['id']}},_0x5669ac={};_0x5669ac[_0x34a2('0x35')]=_[_0x34a2('0x30')](db[_0x34a2('0x2c')][_0x34a2('0x2d')]);_0x5669ac[_0x34a2('0x2f')]=_['keys'](_0x44f3d6[_0x34a2('0x2f')]);_0x5669ac['filters']=_[_0x34a2('0x32')](_0x5669ac[_0x34a2('0x35')],_0x5669ac[_0x34a2('0x2f')]);_0x5b7b18[_0x34a2('0x31')]=_[_0x34a2('0x32')](_0x5669ac[_0x34a2('0x35')],qs['fields'](_0x44f3d6['query'][_0x34a2('0x33')]));_0x5b7b18[_0x34a2('0x31')]=_0x5b7b18['attributes']['length']?_0x5b7b18[_0x34a2('0x31')]:_0x5669ac[_0x34a2('0x35')];if(_0x44f3d6[_0x34a2('0x2f')][_0x34a2('0x41')]){_0x5b7b18[_0x34a2('0x42')]=[{'all':!![]}];}_0x5b7b18=_[_0x34a2('0x3d')]({},_0x5b7b18,_0x44f3d6['options']);return db[_0x34a2('0x2c')][_0x34a2('0x47')](_0x5b7b18)[_0x34a2('0x22')](handleEntityNotFound(_0x8e75c4,null))['then'](respondWithResult(_0x8e75c4,null))[_0x34a2('0x44')](handleError(_0x8e75c4,null));};exports['create']=function(_0x37f9cb,_0x4f8bb7){return db[_0x34a2('0x2c')][_0x34a2('0x48')](_0x37f9cb['body'],{})[_0x34a2('0x22')](function(_0x4c8c16){var _0x562ddb=_0x37f9cb[_0x34a2('0x49')][_0x34a2('0x23')]({'plain':!![]});if(!_0x562ddb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x562ddb['role']==='user'){var _0x61da8a=_0x4c8c16['get']({'plain':!![]});var _0x5d7505='CmHopperAdditionalPhones';return db[_0x34a2('0x4a')][_0x34a2('0x47')]({'where':{'name':_0x5d7505,'userProfileId':_0x562ddb[_0x34a2('0x4b')]},'raw':!![]})[_0x34a2('0x22')](function(_0x5b8737){if(_0x5b8737&&_0x5b8737[_0x34a2('0x4c')]===0x0){return db[_0x34a2('0x25')][_0x34a2('0x48')]({'name':_0x61da8a[_0x34a2('0x29')],'resourceId':_0x61da8a['id'],'type':_0x5b8737['name'],'sectionId':_0x5b8737['id']},{})['then'](function(){return _0x4c8c16;});}else{return _0x4c8c16;}})[_0x34a2('0x44')](function(_0x7f392a){logger[_0x34a2('0x27')](_0x34a2('0x4d'),_0x7f392a);throw _0x7f392a;});}return _0x4c8c16;})['then'](respondWithResult(_0x4f8bb7,0xc9))[_0x34a2('0x44')](handleError(_0x4f8bb7,null));};exports[_0x34a2('0x4e')]=function(_0x2cd8d7,_0x70f9e1){if(_0x2cd8d7[_0x34a2('0x4f')]['id']){delete _0x2cd8d7[_0x34a2('0x4f')]['id'];}return db['CmHopperAdditionalPhone']['find']({'where':{'id':_0x2cd8d7[_0x34a2('0x46')]['id']}})['then'](handleEntityNotFound(_0x70f9e1,null))['then'](saveUpdates(_0x2cd8d7['body'],null))[_0x34a2('0x22')](respondWithResult(_0x70f9e1,null))[_0x34a2('0x44')](handleError(_0x70f9e1,null));};exports[_0x34a2('0x21')]=function(_0xccb87f,_0x505e02){return db[_0x34a2('0x2c')][_0x34a2('0x47')]({'where':{'id':_0xccb87f[_0x34a2('0x46')]['id']}})[_0x34a2('0x22')](handleEntityNotFound(_0x505e02,null))['then'](removeEntity(_0x505e02,null))['catch'](handleError(_0x505e02,null));}; \ No newline at end of file +var _0xfa12=['fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','show','params','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CmHopperAdditionalPhones','UserProfileSection','userProfileId','autoAssociation','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','reject','save','update','destroy','then','get','UserProfileResource','error','name','send','map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes'];(function(_0x49afd5,_0x4593cd){var _0x5d0d91=function(_0x2e5011){while(--_0x2e5011){_0x49afd5['push'](_0x49afd5['shift']());}};_0x5d0d91(++_0x4593cd);}(_0xfa12,0x1c4));var _0x2fa1=function(_0x1d2414,_0x23164a){_0x1d2414=_0x1d2414-0x0;var _0x5e01c6=_0xfa12[_0x1d2414];return _0x5e01c6;};'use strict';var emlformat=require(_0x2fa1('0x0'));var rimraf=require(_0x2fa1('0x1'));var zipdir=require(_0x2fa1('0x2'));var jsonpatch=require(_0x2fa1('0x3'));var rp=require(_0x2fa1('0x4'));var moment=require(_0x2fa1('0x5'));var BPromise=require(_0x2fa1('0x6'));var Mustache=require(_0x2fa1('0x7'));var util=require(_0x2fa1('0x8'));var path=require(_0x2fa1('0x9'));var sox=require(_0x2fa1('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2fa1('0xb'));var _=require(_0x2fa1('0xc'));var squel=require('squel');var crypto=require(_0x2fa1('0xd'));var jsforce=require(_0x2fa1('0xe'));var deskjs=require(_0x2fa1('0xf'));var toCsv=require('to-csv');var querystring=require(_0x2fa1('0x10'));var Papa=require(_0x2fa1('0x11'));var Redis=require(_0x2fa1('0x12'));var authService=require(_0x2fa1('0x13'));var qs=require(_0x2fa1('0x14'));var as=require(_0x2fa1('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2fa1('0x16'))(_0x2fa1('0x17'));var utils=require(_0x2fa1('0x18'));var config=require(_0x2fa1('0x19'));var licenseUtil=require(_0x2fa1('0x1a'));var db=require(_0x2fa1('0x1b'))['db'];function respondWithStatusCode(_0x20f3e5,_0x1ef2c7){_0x1ef2c7=_0x1ef2c7||0xcc;return function(_0x3c98c2){if(_0x3c98c2){return _0x20f3e5[_0x2fa1('0x1c')](_0x1ef2c7);}return _0x20f3e5[_0x2fa1('0x1d')](_0x1ef2c7)[_0x2fa1('0x1e')]();};}function respondWithResult(_0xb30633,_0x35bfb5){_0x35bfb5=_0x35bfb5||0xc8;return function(_0x4bcef1){if(_0x4bcef1){return _0xb30633['status'](_0x35bfb5)[_0x2fa1('0x1f')](_0x4bcef1);}};}function respondWithFilteredResult(_0x212563,_0x128894){return function(_0x2e1788){if(_0x2e1788){var _0x58a387=typeof _0x128894[_0x2fa1('0x20')]==='undefined'&&typeof _0x128894[_0x2fa1('0x21')]===_0x2fa1('0x22');var _0x51632f=_0x2e1788['count'];var _0x3415f7=_0x58a387?0x0:_0x128894[_0x2fa1('0x20')];var _0x2a36cd=_0x58a387?_0x2e1788[_0x2fa1('0x23')]:_0x128894[_0x2fa1('0x20')]+_0x128894['limit'];var _0x393f23;if(_0x2a36cd>=_0x51632f){_0x2a36cd=_0x51632f;_0x393f23=0xc8;}else{_0x393f23=0xce;}_0x212563['status'](_0x393f23);return _0x212563['set']('Content-Range',_0x3415f7+'-'+_0x2a36cd+'/'+_0x51632f)['json'](_0x2e1788);}return null;};}function patchUpdates(_0x56f69c){return function(_0x2ba281){try{jsonpatch['apply'](_0x2ba281,_0x56f69c,!![]);}catch(_0x1cc3f4){return BPromise[_0x2fa1('0x24')](_0x1cc3f4);}return _0x2ba281[_0x2fa1('0x25')]();};}function saveUpdates(_0x373e4d,_0xae8b6b){return function(_0x314bf5){if(_0x314bf5){return _0x314bf5[_0x2fa1('0x26')](_0x373e4d)['then'](function(_0x59c9e0){return _0x59c9e0;});}return null;};}function removeEntity(_0x27cbee,_0x58a52e){return function(_0x2120ac){if(_0x2120ac){return _0x2120ac[_0x2fa1('0x27')]()[_0x2fa1('0x28')](function(){var _0x3aef36=_0x2120ac[_0x2fa1('0x29')]({'plain':!![]});var _0x3f79c0='CmHopperAdditionalPhones';return db[_0x2fa1('0x2a')][_0x2fa1('0x27')]({'where':{'type':_0x3f79c0,'resourceId':_0x3aef36['id']}})[_0x2fa1('0x28')](function(){return _0x2120ac;});})[_0x2fa1('0x28')](function(){_0x27cbee[_0x2fa1('0x1d')](0xcc)[_0x2fa1('0x1e')]();});}};}function handleEntityNotFound(_0x440b7b,_0x218bd4){return function(_0x3c676f){if(!_0x3c676f){_0x440b7b['sendStatus'](0x194);}return _0x3c676f;};}function handleError(_0x3e75b2,_0x206a7b){_0x206a7b=_0x206a7b||0x1f4;return function(_0xb0409e){logger[_0x2fa1('0x2b')](_0xb0409e['stack']);if(_0xb0409e[_0x2fa1('0x2c')]){delete _0xb0409e[_0x2fa1('0x2c')];}_0x3e75b2['status'](_0x206a7b)[_0x2fa1('0x2d')](_0xb0409e);};}exports['index']=function(_0x590db6,_0x2f082a){var _0x1fd279={},_0x478c57={},_0x2b7409={'count':0x0,'rows':[]};var _0x9eca2d=_[_0x2fa1('0x2e')](db[_0x2fa1('0x2f')][_0x2fa1('0x30')],function(_0x29f79e){return{'name':_0x29f79e[_0x2fa1('0x31')],'type':_0x29f79e[_0x2fa1('0x32')][_0x2fa1('0x33')]};});_0x478c57['model']=_[_0x2fa1('0x2e')](_0x9eca2d,_0x2fa1('0x2c'));_0x478c57[_0x2fa1('0x34')]=_[_0x2fa1('0x35')](_0x590db6['query']);_0x478c57[_0x2fa1('0x36')]=_[_0x2fa1('0x37')](_0x478c57[_0x2fa1('0x38')],_0x478c57[_0x2fa1('0x34')]);_0x1fd279[_0x2fa1('0x39')]=_['intersection'](_0x478c57[_0x2fa1('0x38')],qs[_0x2fa1('0x3a')](_0x590db6[_0x2fa1('0x34')]['fields']));_0x1fd279[_0x2fa1('0x39')]=_0x1fd279['attributes'][_0x2fa1('0x3b')]?_0x1fd279[_0x2fa1('0x39')]:_0x478c57[_0x2fa1('0x38')];if(!_0x590db6[_0x2fa1('0x34')][_0x2fa1('0x3c')](_0x2fa1('0x3d'))){_0x1fd279[_0x2fa1('0x21')]=qs[_0x2fa1('0x21')](_0x590db6[_0x2fa1('0x34')][_0x2fa1('0x21')]);_0x1fd279[_0x2fa1('0x20')]=qs[_0x2fa1('0x20')](_0x590db6['query'][_0x2fa1('0x20')]);}_0x1fd279['order']=qs[_0x2fa1('0x3e')](_0x590db6[_0x2fa1('0x34')][_0x2fa1('0x3e')]);_0x1fd279[_0x2fa1('0x3f')]=qs[_0x2fa1('0x36')](_[_0x2fa1('0x40')](_0x590db6[_0x2fa1('0x34')],_0x478c57[_0x2fa1('0x36')]),_0x9eca2d);if(_0x590db6[_0x2fa1('0x34')][_0x2fa1('0x41')]){_0x1fd279[_0x2fa1('0x3f')]=_['merge'](_0x1fd279[_0x2fa1('0x3f')],{'$or':_[_0x2fa1('0x2e')](_0x9eca2d,function(_0x214859){if(_0x214859['type']!==_0x2fa1('0x42')){var _0x251bb7={};_0x251bb7[_0x214859['name']]={'$like':'%'+_0x590db6['query'][_0x2fa1('0x41')]+'%'};return _0x251bb7;}})});}_0x1fd279=_[_0x2fa1('0x43')]({},_0x1fd279,_0x590db6[_0x2fa1('0x44')]);var _0x15d463={'where':_0x1fd279[_0x2fa1('0x3f')]};return db[_0x2fa1('0x2f')][_0x2fa1('0x23')](_0x15d463)['then'](function(_0xd5048){_0x2b7409[_0x2fa1('0x23')]=_0xd5048;if(_0x590db6[_0x2fa1('0x34')]['includeAll']){_0x1fd279[_0x2fa1('0x45')]=[{'all':!![]}];}return db['CmHopperAdditionalPhone'][_0x2fa1('0x46')](_0x1fd279);})[_0x2fa1('0x28')](function(_0x1db711){_0x2b7409['rows']=_0x1db711;return _0x2b7409;})[_0x2fa1('0x28')](respondWithFilteredResult(_0x2f082a,_0x1fd279))['catch'](handleError(_0x2f082a,null));};exports[_0x2fa1('0x47')]=function(_0x5cf907,_0x11ed15){var _0x512046={'raw':!![],'where':{'id':_0x5cf907[_0x2fa1('0x48')]['id']}},_0x515eb9={};_0x515eb9['model']=_[_0x2fa1('0x35')](db['CmHopperAdditionalPhone']['rawAttributes']);_0x515eb9['query']=_[_0x2fa1('0x35')](_0x5cf907[_0x2fa1('0x34')]);_0x515eb9[_0x2fa1('0x36')]=_[_0x2fa1('0x37')](_0x515eb9[_0x2fa1('0x38')],_0x515eb9[_0x2fa1('0x34')]);_0x512046['attributes']=_[_0x2fa1('0x37')](_0x515eb9[_0x2fa1('0x38')],qs['fields'](_0x5cf907[_0x2fa1('0x34')][_0x2fa1('0x3a')]));_0x512046[_0x2fa1('0x39')]=_0x512046['attributes'][_0x2fa1('0x3b')]?_0x512046[_0x2fa1('0x39')]:_0x515eb9[_0x2fa1('0x38')];if(_0x5cf907[_0x2fa1('0x34')][_0x2fa1('0x49')]){_0x512046['include']=[{'all':!![]}];}_0x512046=_[_0x2fa1('0x43')]({},_0x512046,_0x5cf907[_0x2fa1('0x44')]);return db[_0x2fa1('0x2f')][_0x2fa1('0x4a')](_0x512046)['then'](handleEntityNotFound(_0x11ed15,null))[_0x2fa1('0x28')](respondWithResult(_0x11ed15,null))[_0x2fa1('0x4b')](handleError(_0x11ed15,null));};exports['create']=function(_0x3c39c8,_0x7bfbea){return db[_0x2fa1('0x2f')][_0x2fa1('0x4c')](_0x3c39c8[_0x2fa1('0x4d')],{})['then'](function(_0x5bcc4a){var _0x1405d5=_0x3c39c8[_0x2fa1('0x4e')]['get']({'plain':!![]});if(!_0x1405d5)throw new Error(_0x2fa1('0x4f'));if(_0x1405d5[_0x2fa1('0x50')]==='user'){var _0x145251=_0x5bcc4a[_0x2fa1('0x29')]({'plain':!![]});var _0x2d4a50=_0x2fa1('0x51');return db[_0x2fa1('0x52')][_0x2fa1('0x4a')]({'where':{'name':_0x2d4a50,'userProfileId':_0x1405d5[_0x2fa1('0x53')]},'raw':!![]})[_0x2fa1('0x28')](function(_0x418c3c){if(_0x418c3c&&_0x418c3c[_0x2fa1('0x54')]===0x0){return db[_0x2fa1('0x2a')]['create']({'name':_0x145251['name'],'resourceId':_0x145251['id'],'type':_0x418c3c[_0x2fa1('0x2c')],'sectionId':_0x418c3c['id']},{})[_0x2fa1('0x28')](function(){return _0x5bcc4a;});}else{return _0x5bcc4a;}})[_0x2fa1('0x4b')](function(_0x43ff24){logger[_0x2fa1('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x43ff24);throw _0x43ff24;});}return _0x5bcc4a;})[_0x2fa1('0x28')](respondWithResult(_0x7bfbea,0xc9))[_0x2fa1('0x4b')](handleError(_0x7bfbea,null));};exports[_0x2fa1('0x26')]=function(_0x26fc44,_0xc9b4cd){if(_0x26fc44[_0x2fa1('0x4d')]['id']){delete _0x26fc44[_0x2fa1('0x4d')]['id'];}return db[_0x2fa1('0x2f')][_0x2fa1('0x4a')]({'where':{'id':_0x26fc44[_0x2fa1('0x48')]['id']}})[_0x2fa1('0x28')](handleEntityNotFound(_0xc9b4cd,null))[_0x2fa1('0x28')](saveUpdates(_0x26fc44[_0x2fa1('0x4d')],null))[_0x2fa1('0x28')](respondWithResult(_0xc9b4cd,null))['catch'](handleError(_0xc9b4cd,null));};exports['destroy']=function(_0x2d1ffc,_0xb0192d){return db['CmHopperAdditionalPhone'][_0x2fa1('0x4a')]({'where':{'id':_0x2d1ffc[_0x2fa1('0x48')]['id']}})[_0x2fa1('0x28')](handleEntityNotFound(_0xb0192d,null))[_0x2fa1('0x28')](removeEntity(_0xb0192d,null))['catch'](handleError(_0xb0192d,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index a87f22b..0213c68 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 _0x1b50=['request-promise','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','define','cm_hopper_additional_phones','util','../../config/logger','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1b50,0x10a));var _0x01b5=function(_0x25bbdd,_0x4137ed){_0x25bbdd=_0x25bbdd-0x0;var _0x20ec55=_0x1b50[_0x25bbdd];return _0x20ec55;};'use strict';var _=require('lodash');var util=require(_0x01b5('0x0'));var logger=require(_0x01b5('0x1'))('api');var moment=require(_0x01b5('0x2'));var BPromise=require(_0x01b5('0x3'));var rp=require(_0x01b5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x01b5('0x5'));var attributes=require(_0x01b5('0x6'));module[_0x01b5('0x7')]=function(_0x3e6b51,_0x704d8c){return _0x3e6b51[_0x01b5('0x8')]('CmHopperAdditionalPhone',attributes,{'tableName':_0x01b5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6c18=['CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','exports'];(function(_0x7bc5e8,_0x116927){var _0x374b1b=function(_0x4c33bc){while(--_0x4c33bc){_0x7bc5e8['push'](_0x7bc5e8['shift']());}};_0x374b1b(++_0x116927);}(_0x6c18,0x195));var _0x86c1=function(_0x2514db,_0x209fa3){_0x2514db=_0x2514db-0x0;var _0x56436e=_0x6c18[_0x2514db];return _0x56436e;};'use strict';var _=require(_0x86c1('0x0'));var util=require(_0x86c1('0x1'));var logger=require(_0x86c1('0x2'))(_0x86c1('0x3'));var moment=require(_0x86c1('0x4'));var BPromise=require(_0x86c1('0x5'));var rp=require(_0x86c1('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x86c1('0x7'));var config=require(_0x86c1('0x8'));var attributes=require(_0x86c1('0x9'));module[_0x86c1('0xa')]=function(_0xdae7,_0x1cf2dc){return _0xdae7['define'](_0x86c1('0xb'),attributes,{'tableName':_0x86c1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index c23fc4d..90de2d8 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 _0x7ef1=['transaction','update','activateAdditionalPhone','IncrementPreviewCounters','field','util','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CmHopper','body','ContactId','ListId','CampaignId','CmHopperAdditionalPhone','OrderBy','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','dialGlobalMaxRetry','findOne','ASC','countcongestionretry','countabandonedretry','countagentrejectretry','entity','VerifyAdditionalPhones','SwapAdditionalPhones','VoiceQueueId','duration','waitTime','scheduledat','add','minutes','isNil','phone','countmachineretry','createdAt','updatedAt','sequelize'];(function(_0xec1dd5,_0x244c31){var _0x494ef1=function(_0x711c36){while(--_0x711c36){_0xec1dd5['push'](_0xec1dd5['shift']());}};_0x494ef1(++_0x244c31);}(_0x7ef1,0x77));var _0x17ef=function(_0x3cde12,_0x32e88e){_0x3cde12=_0x3cde12-0x0;var _0x4e9bd1=_0x7ef1[_0x3cde12];return _0x4e9bd1;};'use strict';var _=require('lodash');var util=require(_0x17ef('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x17ef('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x17ef('0x2'))['db'];var utils=require(_0x17ef('0x3'));var logger=require('../../config/logger')(_0x17ef('0x4'));var config=require(_0x17ef('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x17ef('0x6')][_0x17ef('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3594d6,_0x2a3789,_0x1d4b1c){return new BPromise(function(_0x53cabf,_0x5b9a95){return client[_0x17ef('0x8')](_0x3594d6,_0x1d4b1c)[_0x17ef('0x9')](function(_0x32cddb){logger[_0x17ef('0xa')](_0x17ef('0xb'),_0x2a3789,_0x17ef('0xc'));logger['debug'](_0x17ef('0xd'),_0x2a3789,'request\x20sent',JSON[_0x17ef('0xe')](_0x32cddb));if(_0x32cddb[_0x17ef('0xf')]){if(_0x32cddb[_0x17ef('0xf')][_0x17ef('0x10')]===0x1f4){logger[_0x17ef('0xf')](_0x17ef('0xb'),_0x2a3789,_0x32cddb[_0x17ef('0xf')]['message']);return _0x5b9a95(_0x32cddb['error'][_0x17ef('0x11')]);}logger['error'](_0x17ef('0xb'),_0x2a3789,_0x32cddb[_0x17ef('0xf')][_0x17ef('0x11')]);return _0x53cabf(_0x32cddb['error'][_0x17ef('0x11')]);}else{logger[_0x17ef('0xa')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x2a3789,_0x17ef('0xc'));_0x53cabf(_0x32cddb[_0x17ef('0x12')][_0x17ef('0x11')]);}})[_0x17ef('0x13')](function(_0x1963e2){logger[_0x17ef('0xf')](_0x17ef('0xb'),_0x2a3789,_0x1963e2);_0x5b9a95(_0x1963e2);});});}exports['VerifyAdditionalPhones']=function(_0x3b15fb){var _0x48fdeb=this;return new Promise(function(_0x159ebc,_0x2e7cab){return db[_0x17ef('0x14')]['findOne']({'raw':!![],'where':{'ContactId':_0x3b15fb[_0x17ef('0x15')][_0x17ef('0x16')],'ListId':_0x3b15fb[_0x17ef('0x15')][_0x17ef('0x17')],'VoiceQueueId':_0x3b15fb['body']['VoiceQueueId']===undefined?null:_0x3b15fb[_0x17ef('0x15')]['VoiceQueueId'],'CampaignId':_0x3b15fb[_0x17ef('0x15')][_0x17ef('0x18')]===undefined?null:_0x3b15fb[_0x17ef('0x15')][_0x17ef('0x18')]}})[_0x17ef('0x9')](function(_0x75f82c){if(_0x75f82c!=null){return db[_0x17ef('0x19')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x75f82c['id'],'OrderBy':{'$gt':_0x75f82c[_0x17ef('0x1a')]}},'order':[[_0x17ef('0x1a'),'ASC']]})[_0x17ef('0x9')](function(_0x5ec89e){var _0x18e0b9=0x0;if(_0x5ec89e){if(_0x5ec89e[_0x17ef('0x1b')]+_0x5ec89e['countcongestionretry']+_0x5ec89e[_0x17ef('0x1c')]+_0x5ec89e[_0x17ef('0x1d')]+_0x5ec89e[_0x17ef('0x1e')]+_0x5ec89e['countabandonedretry']+_0x5ec89e['countmachineretry']+_0x5ec89e['countagentrejectretry']<_0x3b15fb['entity'][_0x17ef('0x1f')])_0x18e0b9=0x1;_0x159ebc({'additional':_0x18e0b9});}else{return db[_0x17ef('0x19')][_0x17ef('0x20')]({'raw':!![],'where':{'CmHopperId':_0x75f82c['id']},'order':[['OrderBy',_0x17ef('0x21')]]})[_0x17ef('0x9')](function(_0xbb113c){var _0x32237b=0x0;if(_0xbb113c){if(_0xbb113c[_0x17ef('0x1b')]+_0xbb113c[_0x17ef('0x22')]+_0xbb113c[_0x17ef('0x1c')]+_0xbb113c['countnosuchnumberretry']+_0xbb113c[_0x17ef('0x1e')]+_0xbb113c[_0x17ef('0x23')]+_0xbb113c['countmachineretry']+_0xbb113c[_0x17ef('0x24')]<_0x3b15fb[_0x17ef('0x25')][_0x17ef('0x1f')])_0x32237b=0x1;_0x159ebc({'additional':_0x32237b});}else{_0x159ebc({'additional':0x0});}})['catch'](function(_0x11cefe){logger[_0x17ef('0xf')](_0x17ef('0x26'),_0x11cefe[_0x17ef('0x11')]);_0x2e7cab(_0x48fdeb[_0x17ef('0xf')](0x1f4,_0x11cefe[_0x17ef('0x11')]));});}})[_0x17ef('0x13')](function(_0x4f1ae7){logger[_0x17ef('0xf')]('VerifyAdditionalPhones',_0x4f1ae7[_0x17ef('0x11')]);_0x2e7cab(_0x48fdeb['error'](0x1f4,_0x4f1ae7[_0x17ef('0x11')]));});}else _0x159ebc({'additional':0x0});});});};exports[_0x17ef('0x27')]=function(_0x4345aa){var _0x10d6f9=this;return new Promise(function(_0x5a503d,_0x18a09c){return db[_0x17ef('0x14')][_0x17ef('0x20')]({'raw':!![],'where':{'ContactId':_0x4345aa[_0x17ef('0x15')][_0x17ef('0x16')],'ListId':_0x4345aa[_0x17ef('0x15')][_0x17ef('0x17')],'VoiceQueueId':_0x4345aa['body'][_0x17ef('0x28')]===undefined?null:_0x4345aa['body']['VoiceQueueId'],'CampaignId':_0x4345aa[_0x17ef('0x15')][_0x17ef('0x18')]===undefined?null:_0x4345aa[_0x17ef('0x15')]['CampaignId']}})[_0x17ef('0x9')](function(_0x3fbd13){if(_0x3fbd13!=null){return db['CmHopperAdditionalPhone'][_0x17ef('0x20')]({'raw':!![],'where':{'CmHopperId':_0x3fbd13['id'],'OrderBy':{'$gte':_0x3fbd13[_0x17ef('0x1a')]}},'order':[['OrderBy',_0x17ef('0x21')]]})[_0x17ef('0x9')](function(_0x183ff5){if(_0x183ff5)return activateAdditionalPhone(_0x3fbd13,_0x4345aa['body'],_0x183ff5,_0x4345aa[_0x17ef('0x29')],_0x4345aa['waitTime'])[_0x17ef('0x9')](function(_0x39ffe6){_0x5a503d(_0x39ffe6);});else{return db[_0x17ef('0x19')][_0x17ef('0x20')]({'raw':!![],'where':{'CmHopperId':_0x3fbd13['id']},'order':[['OrderBy','ASC']]})['then'](function(_0x5ee055){if(_0x5ee055)return activateAdditionalPhone(_0x3fbd13,_0x4345aa['body'],_0x5ee055,_0x4345aa['duration'],_0x4345aa[_0x17ef('0x2a')])[_0x17ef('0x9')](function(_0x4eef6c){_0x5a503d(_0x4eef6c);});else{_0x5a503d({'id':_0x3fbd13['id'],'phone':''});}})[_0x17ef('0x13')](function(_0x5e9efe){logger[_0x17ef('0xf')]('VerifyAdditionalPhones',_0x5e9efe[_0x17ef('0x11')]);_0x18a09c(_0x10d6f9[_0x17ef('0xf')](0x1f4,_0x5e9efe[_0x17ef('0x11')]));});}})['catch'](function(_0x279153){logger[_0x17ef('0xf')](_0x17ef('0x26'),_0x279153['message']);_0x18a09c(_0x10d6f9[_0x17ef('0xf')](0x1f4,_0x279153[_0x17ef('0x11')]));});}else _0x5a503d(0x1);});});};function activateAdditionalPhone(_0x53cd05,_0x59e4df,_0x1a19e1,_0x3168a4,_0x2ea42b){return new Promise(function(_0x31bf82,_0x2f2e39){var _0xc84c8e;if(_['isNil'](_0x1a19e1[_0x17ef('0x2b')])){_0x1a19e1[_0x17ef('0x2b')]=moment();}if(moment()>moment(_0x1a19e1[_0x17ef('0x2b')])){_0xc84c8e=moment()[_0x17ef('0x2c')](_0x2ea42b||0x3,_0x17ef('0x2d'));}else{if(_0x1a19e1[_0x17ef('0x1a')]==0x0){_0xc84c8e=moment(_0x1a19e1[_0x17ef('0x2b')]);}else{_0xc84c8e=moment()[_0x17ef('0x2c')](_0x2ea42b||0x3,_0x17ef('0x2d'));}}if(_[_0x17ef('0x2e')](_0xc84c8e)){_0xc84c8e=moment()[_0x17ef('0x2c')](_0x2ea42b||0x3,_0x17ef('0x2d'));}var _0x5a4ef1={'phone':_0x53cd05[_0x17ef('0x2f')],'active':0x0,'OrderBy':_[_0x17ef('0x2e')](_0x53cd05['OrderBy'])?0x0:_0x53cd05[_0x17ef('0x1a')],'scheduledat':moment()[_0x17ef('0x2c')](_0x3168a4||0x1,'minutes'),'countbusyretry':_0x59e4df[_0x17ef('0x1b')],'countcongestionretry':_0x59e4df[_0x17ef('0x22')],'countnoanswerretry':_0x59e4df[_0x17ef('0x1c')],'countnosuchnumberretry':_0x59e4df[_0x17ef('0x1d')],'countdropretry':_0x59e4df['countdropretry'],'countabandonedretry':_0x59e4df['countabandonedretry'],'countmachineretry':_0x59e4df[_0x17ef('0x30')],'countagentrejectretry':_0x59e4df[_0x17ef('0x24')],'createdAt':_0x59e4df[_0x17ef('0x31')],'updatedAt':_0x59e4df[_0x17ef('0x32')]};var _0x373ded={'CmHopperId':_0x53cd05['id'],'phone':_0x1a19e1[_0x17ef('0x2f')],'active':0x0,'OrderBy':_['isNil'](_0x1a19e1[_0x17ef('0x1a')])?0x0:_0x1a19e1[_0x17ef('0x1a')],'scheduledat':_0xc84c8e,'countbusyretry':_0x1a19e1[_0x17ef('0x1b')],'countcongestionretry':_0x1a19e1[_0x17ef('0x22')],'countnoanswerretry':_0x1a19e1[_0x17ef('0x1c')],'countnosuchnumberretry':_0x1a19e1[_0x17ef('0x1d')],'countdropretry':_0x1a19e1['countdropretry'],'countabandonedretry':_0x1a19e1['countabandonedretry'],'countmachineretry':_0x1a19e1[_0x17ef('0x30')],'countagentrejectretry':_0x1a19e1['countagentrejectretry'],'createdAt':_0x1a19e1['createdAt'],'updatedAt':_0x1a19e1[_0x17ef('0x32')]};return db[_0x17ef('0x33')][_0x17ef('0x34')](function(_0x3f57c5){return db[_0x17ef('0x19')]['update'](_0x5a4ef1,{'where':{'id':_0x1a19e1['id']}},{'transaction':_0x3f57c5})[_0x17ef('0x9')](function(){return db['CmHopper'][_0x17ef('0x35')](_0x373ded,{'where':{'id':_0x53cd05['id']}},{'transaction':_0x3f57c5});});})[_0x17ef('0x9')](function(_0x12aaed){_0x31bf82({'id':_0x53cd05['id'],'phone':_0x1a19e1[_0x17ef('0x2f')]});})[_0x17ef('0x13')](function(_0x4efee5){logger[_0x17ef('0xf')](_0x17ef('0x36'),_0x4efee5[_0x17ef('0x11')]);_0x2f2e39({'error':_0x4efee5[_0x17ef('0x11')]});});});}exports[_0x17ef('0x37')]=function(_0x242b98){var _0x434756=this;return new Promise(function(_0x3f9dc4,_0x306d7a){return db['CmHopper'][_0x17ef('0x35')](_0x242b98[_0x17ef('0x15')][_0x17ef('0x38')],{'where':{'id':_0x242b98[_0x17ef('0x15')]['id']}})[_0x17ef('0x9')](function(_0x2a1a26){_0x3f9dc4(_0x2a1a26);})[_0x17ef('0x13')](function(_0x183dd1){logger[_0x17ef('0xf')](_0x17ef('0x37'),_0x183dd1[_0x17ef('0x11')]);_0x306d7a(_0x434756[_0x17ef('0xf')](0x1f4,_0x183dd1['message']));});});}; \ No newline at end of file +var _0x69f4=['then','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','VerifyAdditionalPhones','body','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','findOne','countdropretry','SwapAdditionalPhones','CmHopper','ContactId','duration','isNil','scheduledat','minutes','add','phone','createdAt','updatedAt','transaction','update','activateAdditionalPhone','IncrementPreviewCounters','field','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2e73b5,_0x26ed09){var _0x244dc6=function(_0x2f9186){while(--_0x2f9186){_0x2e73b5['push'](_0x2e73b5['shift']());}};_0x244dc6(++_0x26ed09);}(_0x69f4,0xa1));var _0x469f=function(_0x5a8a4d,_0x299752){_0x5a8a4d=_0x5a8a4d-0x0;var _0x4c69c5=_0x69f4[_0x5a8a4d];return _0x4c69c5;};'use strict';var _=require(_0x469f('0x0'));var util=require('util');var moment=require(_0x469f('0x1'));var BPromise=require('bluebird');var rs=require(_0x469f('0x2'));var fs=require('fs');var Redis=require(_0x469f('0x3'));var db=require(_0x469f('0x4'))['db'];var utils=require(_0x469f('0x5'));var logger=require(_0x469f('0x6'))(_0x469f('0x7'));var config=require(_0x469f('0x8'));var jayson=require(_0x469f('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x51e68c,_0x16ac65,_0x205c96){return new BPromise(function(_0x3f12d8,_0xf2f1bc){return client['request'](_0x51e68c,_0x205c96)[_0x469f('0xa')](function(_0xf4b5b0){logger['info'](_0x469f('0xb'),_0x16ac65,_0x469f('0xc'));logger[_0x469f('0xd')](_0x469f('0xe'),_0x16ac65,_0x469f('0xc'),JSON[_0x469f('0xf')](_0xf4b5b0));if(_0xf4b5b0[_0x469f('0x10')]){if(_0xf4b5b0[_0x469f('0x10')][_0x469f('0x11')]===0x1f4){logger[_0x469f('0x10')](_0x469f('0xb'),_0x16ac65,_0xf4b5b0[_0x469f('0x10')][_0x469f('0x12')]);return _0xf2f1bc(_0xf4b5b0['error'][_0x469f('0x12')]);}logger[_0x469f('0x10')](_0x469f('0xb'),_0x16ac65,_0xf4b5b0[_0x469f('0x10')][_0x469f('0x12')]);return _0x3f12d8(_0xf4b5b0[_0x469f('0x10')][_0x469f('0x12')]);}else{logger[_0x469f('0x13')](_0x469f('0xb'),_0x16ac65,_0x469f('0xc'));_0x3f12d8(_0xf4b5b0[_0x469f('0x14')]['message']);}})[_0x469f('0x15')](function(_0xd169d0){logger[_0x469f('0x10')](_0x469f('0xb'),_0x16ac65,_0xd169d0);_0xf2f1bc(_0xd169d0);});});}exports[_0x469f('0x16')]=function(_0xd1fe6c){var _0x58f2e5=this;return new Promise(function(_0x4725ce,_0x21056c){return db['CmHopper']['findOne']({'raw':!![],'where':{'ContactId':_0xd1fe6c['body']['ContactId'],'ListId':_0xd1fe6c[_0x469f('0x17')][_0x469f('0x18')],'VoiceQueueId':_0xd1fe6c['body']['VoiceQueueId']===undefined?null:_0xd1fe6c[_0x469f('0x17')][_0x469f('0x19')],'CampaignId':_0xd1fe6c[_0x469f('0x17')][_0x469f('0x1a')]===undefined?null:_0xd1fe6c[_0x469f('0x17')]['CampaignId']}})[_0x469f('0xa')](function(_0x5aad5b){if(_0x5aad5b!=null){return db[_0x469f('0x1b')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x5aad5b['id'],'OrderBy':{'$gt':_0x5aad5b['OrderBy']}},'order':[[_0x469f('0x1c'),_0x469f('0x1d')]]})['then'](function(_0x31122a){var _0x515322=0x0;if(_0x31122a){if(_0x31122a[_0x469f('0x1e')]+_0x31122a[_0x469f('0x1f')]+_0x31122a[_0x469f('0x20')]+_0x31122a[_0x469f('0x21')]+_0x31122a['countdropretry']+_0x31122a[_0x469f('0x22')]+_0x31122a[_0x469f('0x23')]+_0x31122a[_0x469f('0x24')]<_0xd1fe6c[_0x469f('0x25')][_0x469f('0x26')])_0x515322=0x1;_0x4725ce({'additional':_0x515322});}else{return db[_0x469f('0x1b')][_0x469f('0x27')]({'raw':!![],'where':{'CmHopperId':_0x5aad5b['id']},'order':[[_0x469f('0x1c'),_0x469f('0x1d')]]})['then'](function(_0x4c3a92){var _0x453ea0=0x0;if(_0x4c3a92){if(_0x4c3a92['countbusyretry']+_0x4c3a92[_0x469f('0x1f')]+_0x4c3a92['countnoanswerretry']+_0x4c3a92['countnosuchnumberretry']+_0x4c3a92[_0x469f('0x28')]+_0x4c3a92[_0x469f('0x22')]+_0x4c3a92[_0x469f('0x23')]+_0x4c3a92[_0x469f('0x24')]<_0xd1fe6c[_0x469f('0x25')]['dialGlobalMaxRetry'])_0x453ea0=0x1;_0x4725ce({'additional':_0x453ea0});}else{_0x4725ce({'additional':0x0});}})[_0x469f('0x15')](function(_0x2eb27b){logger[_0x469f('0x10')](_0x469f('0x16'),_0x2eb27b[_0x469f('0x12')]);_0x21056c(_0x58f2e5[_0x469f('0x10')](0x1f4,_0x2eb27b[_0x469f('0x12')]));});}})[_0x469f('0x15')](function(_0x410861){logger[_0x469f('0x10')]('VerifyAdditionalPhones',_0x410861[_0x469f('0x12')]);_0x21056c(_0x58f2e5[_0x469f('0x10')](0x1f4,_0x410861[_0x469f('0x12')]));});}else _0x4725ce({'additional':0x0});});});};exports[_0x469f('0x29')]=function(_0x3ef793){var _0x34c7c7=this;return new Promise(function(_0x35d65,_0xf4abd9){return db[_0x469f('0x2a')][_0x469f('0x27')]({'raw':!![],'where':{'ContactId':_0x3ef793[_0x469f('0x17')][_0x469f('0x2b')],'ListId':_0x3ef793[_0x469f('0x17')][_0x469f('0x18')],'VoiceQueueId':_0x3ef793[_0x469f('0x17')][_0x469f('0x19')]===undefined?null:_0x3ef793[_0x469f('0x17')][_0x469f('0x19')],'CampaignId':_0x3ef793[_0x469f('0x17')][_0x469f('0x1a')]===undefined?null:_0x3ef793['body'][_0x469f('0x1a')]}})[_0x469f('0xa')](function(_0x464bd0){if(_0x464bd0!=null){return db['CmHopperAdditionalPhone'][_0x469f('0x27')]({'raw':!![],'where':{'CmHopperId':_0x464bd0['id'],'OrderBy':{'$gte':_0x464bd0[_0x469f('0x1c')]}},'order':[[_0x469f('0x1c'),_0x469f('0x1d')]]})[_0x469f('0xa')](function(_0x31a2f4){if(_0x31a2f4)return activateAdditionalPhone(_0x464bd0,_0x3ef793[_0x469f('0x17')],_0x31a2f4,_0x3ef793[_0x469f('0x2c')],_0x3ef793['waitTime'])[_0x469f('0xa')](function(_0x196c42){_0x35d65(_0x196c42);});else{return db[_0x469f('0x1b')][_0x469f('0x27')]({'raw':!![],'where':{'CmHopperId':_0x464bd0['id']},'order':[['OrderBy',_0x469f('0x1d')]]})[_0x469f('0xa')](function(_0xd83c24){if(_0xd83c24)return activateAdditionalPhone(_0x464bd0,_0x3ef793[_0x469f('0x17')],_0xd83c24,_0x3ef793[_0x469f('0x2c')],_0x3ef793['waitTime'])[_0x469f('0xa')](function(_0x1a368d){_0x35d65(_0x1a368d);});else{_0x35d65({'id':_0x464bd0['id'],'phone':''});}})['catch'](function(_0x541401){logger[_0x469f('0x10')]('VerifyAdditionalPhones',_0x541401[_0x469f('0x12')]);_0xf4abd9(_0x34c7c7[_0x469f('0x10')](0x1f4,_0x541401['message']));});}})[_0x469f('0x15')](function(_0x1c121b){logger[_0x469f('0x10')](_0x469f('0x16'),_0x1c121b[_0x469f('0x12')]);_0xf4abd9(_0x34c7c7[_0x469f('0x10')](0x1f4,_0x1c121b['message']));});}else _0x35d65(0x1);});});};function activateAdditionalPhone(_0x11d85b,_0x12f3da,_0x125bb0,_0x48a735,_0x3742a5){return new Promise(function(_0x5373f0,_0x1f1531){var _0x4b8243;if(_[_0x469f('0x2d')](_0x125bb0['scheduledat'])){_0x125bb0[_0x469f('0x2e')]=moment();}if(moment()>moment(_0x125bb0['scheduledat'])){_0x4b8243=moment()['add'](_0x3742a5||0x3,_0x469f('0x2f'));}else{if(_0x125bb0['OrderBy']==0x0){_0x4b8243=moment(_0x125bb0[_0x469f('0x2e')]);}else{_0x4b8243=moment()[_0x469f('0x30')](_0x3742a5||0x3,_0x469f('0x2f'));}}if(_[_0x469f('0x2d')](_0x4b8243)){_0x4b8243=moment()[_0x469f('0x30')](_0x3742a5||0x3,_0x469f('0x2f'));}var _0x55a252={'phone':_0x11d85b[_0x469f('0x31')],'active':0x0,'OrderBy':_[_0x469f('0x2d')](_0x11d85b[_0x469f('0x1c')])?0x0:_0x11d85b[_0x469f('0x1c')],'scheduledat':moment()[_0x469f('0x30')](_0x48a735||0x1,_0x469f('0x2f')),'countbusyretry':_0x12f3da[_0x469f('0x1e')],'countcongestionretry':_0x12f3da[_0x469f('0x1f')],'countnoanswerretry':_0x12f3da[_0x469f('0x20')],'countnosuchnumberretry':_0x12f3da['countnosuchnumberretry'],'countdropretry':_0x12f3da['countdropretry'],'countabandonedretry':_0x12f3da[_0x469f('0x22')],'countmachineretry':_0x12f3da['countmachineretry'],'countagentrejectretry':_0x12f3da[_0x469f('0x24')],'createdAt':_0x12f3da[_0x469f('0x32')],'updatedAt':_0x12f3da[_0x469f('0x33')]};var _0x5be6c1={'CmHopperId':_0x11d85b['id'],'phone':_0x125bb0[_0x469f('0x31')],'active':0x0,'OrderBy':_[_0x469f('0x2d')](_0x125bb0['OrderBy'])?0x0:_0x125bb0[_0x469f('0x1c')],'scheduledat':_0x4b8243,'countbusyretry':_0x125bb0['countbusyretry'],'countcongestionretry':_0x125bb0[_0x469f('0x1f')],'countnoanswerretry':_0x125bb0[_0x469f('0x20')],'countnosuchnumberretry':_0x125bb0[_0x469f('0x21')],'countdropretry':_0x125bb0[_0x469f('0x28')],'countabandonedretry':_0x125bb0['countabandonedretry'],'countmachineretry':_0x125bb0['countmachineretry'],'countagentrejectretry':_0x125bb0[_0x469f('0x24')],'createdAt':_0x125bb0['createdAt'],'updatedAt':_0x125bb0['updatedAt']};return db['sequelize'][_0x469f('0x34')](function(_0x349cee){return db[_0x469f('0x1b')][_0x469f('0x35')](_0x55a252,{'where':{'id':_0x125bb0['id']}},{'transaction':_0x349cee})[_0x469f('0xa')](function(){return db['CmHopper'][_0x469f('0x35')](_0x5be6c1,{'where':{'id':_0x11d85b['id']}},{'transaction':_0x349cee});});})[_0x469f('0xa')](function(_0x2830b3){_0x5373f0({'id':_0x11d85b['id'],'phone':_0x125bb0[_0x469f('0x31')]});})['catch'](function(_0x4d67c5){logger['error'](_0x469f('0x36'),_0x4d67c5['message']);_0x1f1531({'error':_0x4d67c5['message']});});});}exports[_0x469f('0x37')]=function(_0x405c14){var _0x4e8289=this;return new Promise(function(_0x37aa27,_0x424708){return db[_0x469f('0x2a')][_0x469f('0x35')](_0x405c14[_0x469f('0x17')][_0x469f('0x38')],{'where':{'id':_0x405c14['body']['id']}})[_0x469f('0xa')](function(_0xbb4e1c){_0x37aa27(_0xbb4e1c);})[_0x469f('0x15')](function(_0x1d3da0){logger[_0x469f('0x10')](_0x469f('0x37'),_0x1d3da0[_0x469f('0x12')]);_0x424708(_0x4e8289[_0x469f('0x10')](0x1f4,_0x1d3da0[_0x469f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index c16a048..63bf4df 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 _0x7759=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','show','post','put','/:id','update','delete','destroy','multer'];(function(_0x1d30f0,_0x172f04){var _0x2da23a=function(_0x529f4d){while(--_0x529f4d){_0x1d30f0['push'](_0x1d30f0['shift']());}};_0x2da23a(++_0x172f04);}(_0x7759,0x143));var _0x9775=function(_0x17a1a6,_0x372dd8){_0x17a1a6=_0x17a1a6-0x0;var _0x2613db=_0x7759[_0x17a1a6];return _0x2613db;};'use strict';var multer=require(_0x9775('0x0'));var util=require('util');var path=require(_0x9775('0x1'));var timeout=require(_0x9775('0x2'));var express=require(_0x9775('0x3'));var router=express[_0x9775('0x4')]();var fs_extra=require(_0x9775('0x5'));var auth=require(_0x9775('0x6'));var interaction=require(_0x9775('0x7'));var config=require(_0x9775('0x8'));var controller=require('./cmHopperAdditionalPhone.controller');router['get']('/',auth[_0x9775('0x9')](),controller['index']);router[_0x9775('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x9775('0xb')]);router[_0x9775('0xc')]('/',auth[_0x9775('0x9')](),controller['create']);router[_0x9775('0xd')](_0x9775('0xe'),auth[_0x9775('0x9')](),controller[_0x9775('0xf')]);router[_0x9775('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x9775('0x11')]);module['exports']=router; \ No newline at end of file +var _0xe924=['../../config/environment','./cmHopperAdditionalPhone.controller','isAuthenticated','get','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3d9557,_0x5d09d2){var _0x359ff8=function(_0x784fa){while(--_0x784fa){_0x3d9557['push'](_0x3d9557['shift']());}};_0x359ff8(++_0x5d09d2);}(_0xe924,0x141));var _0x4e92=function(_0x315b7f,_0x2d1dc9){_0x315b7f=_0x315b7f-0x0;var _0x3fe840=_0xe924[_0x315b7f];return _0x3fe840;};'use strict';var multer=require(_0x4e92('0x0'));var util=require(_0x4e92('0x1'));var path=require(_0x4e92('0x2'));var timeout=require(_0x4e92('0x3'));var express=require(_0x4e92('0x4'));var router=express[_0x4e92('0x5')]();var fs_extra=require(_0x4e92('0x6'));var auth=require(_0x4e92('0x7'));var interaction=require(_0x4e92('0x8'));var config=require(_0x4e92('0x9'));var controller=require(_0x4e92('0xa'));router['get']('/',auth[_0x4e92('0xb')](),controller['index']);router[_0x4e92('0xc')](_0x4e92('0xd'),auth[_0x4e92('0xb')](),controller[_0x4e92('0xe')]);router[_0x4e92('0xf')]('/',auth[_0x4e92('0xb')](),controller[_0x4e92('0x10')]);router[_0x4e92('0x11')](_0x4e92('0xd'),auth[_0x4e92('0xb')](),controller[_0x4e92('0x12')]);router[_0x4e92('0x13')]('/:id',auth[_0x4e92('0xb')](),controller[_0x4e92('0x14')]);module[_0x4e92('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 96416f3..c56ebf6 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 _0x323e=['INTEGER','contactListQueue','moment','sequelize','exports','STRING'];(function(_0x53ed98,_0x4500e3){var _0x5b3d9d=function(_0x4050a1){while(--_0x4050a1){_0x53ed98['push'](_0x53ed98['shift']());}};_0x5b3d9d(++_0x4500e3);}(_0x323e,0x188));var _0xe323=function(_0x1c238f,_0x36012b){_0x1c238f=_0x1c238f-0x0;var _0x344288=_0x323e[_0x1c238f];return _0x344288;};'use strict';var moment=require(_0xe323('0x0'));var Sequelize=require(_0xe323('0x1'));module[_0xe323('0x2')]={'phone':{'type':Sequelize[_0xe323('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xe323('0x4')],'unique':_0xe323('0x5')},'ListId':{'type':Sequelize[_0xe323('0x4')],'unique':_0xe323('0x5')},'VoiceQueueId':{'type':Sequelize[_0xe323('0x4')],'unique':_0xe323('0x5')}}; \ No newline at end of file +var _0x04f1=['INTEGER','moment','sequelize','exports','contactListQueue'];(function(_0x121dbb,_0x12b350){var _0x53ce97=function(_0x4586cc){while(--_0x4586cc){_0x121dbb['push'](_0x121dbb['shift']());}};_0x53ce97(++_0x12b350);}(_0x04f1,0x92));var _0x104f=function(_0x2af009,_0x5432ee){_0x2af009=_0x2af009-0x0;var _0x46d15f=_0x04f1[_0x2af009];return _0x46d15f;};'use strict';var moment=require(_0x104f('0x0'));var Sequelize=require(_0x104f('0x1'));module[_0x104f('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x104f('0x3')},'ListId':{'type':Sequelize[_0x104f('0x4')],'unique':_0x104f('0x3')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 25866e6..7a5ddbc 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 _0x3f21=['sendStatus','status','end','json','undefined','limit','count','offset','set','apply','save','update','destroy','then','error','stack','name','index','map','rawAttributes','fieldName','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','VIRTUAL','filter','options','CmHopperBlack','includeAll','rows','catch','show','params','keys','include','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x5a7618,_0x3f44c2){var _0x12dc65=function(_0x3cc4cd){while(--_0x3cc4cd){_0x5a7618['push'](_0x5a7618['shift']());}};_0x12dc65(++_0x3f44c2);}(_0x3f21,0x7b));var _0x13f2=function(_0x3aa56b,_0x44ea4f){_0x3aa56b=_0x3aa56b-0x0;var _0x24736c=_0x3f21[_0x3aa56b];return _0x24736c;};'use strict';var emlformat=require(_0x13f2('0x0'));var rimraf=require(_0x13f2('0x1'));var zipdir=require(_0x13f2('0x2'));var jsonpatch=require(_0x13f2('0x3'));var rp=require('request-promise');var moment=require(_0x13f2('0x4'));var BPromise=require(_0x13f2('0x5'));var Mustache=require(_0x13f2('0x6'));var util=require(_0x13f2('0x7'));var path=require(_0x13f2('0x8'));var sox=require(_0x13f2('0x9'));var csv=require(_0x13f2('0xa'));var ejs=require(_0x13f2('0xb'));var fs=require('fs');var fs_extra=require(_0x13f2('0xc'));var _=require(_0x13f2('0xd'));var squel=require(_0x13f2('0xe'));var crypto=require(_0x13f2('0xf'));var jsforce=require(_0x13f2('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x13f2('0x11'));var Papa=require(_0x13f2('0x12'));var Redis=require(_0x13f2('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x13f2('0x14'));var as=require(_0x13f2('0x15'));var hardwareService=require(_0x13f2('0x16'));var logger=require(_0x13f2('0x17'))(_0x13f2('0x18'));var utils=require(_0x13f2('0x19'));var config=require(_0x13f2('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c4411,_0x32ff83){_0x32ff83=_0x32ff83||0xcc;return function(_0x1d9d75){if(_0x1d9d75){return _0x4c4411[_0x13f2('0x1b')](_0x32ff83);}return _0x4c4411[_0x13f2('0x1c')](_0x32ff83)[_0x13f2('0x1d')]();};}function respondWithResult(_0x5acd51,_0x3bbaea){_0x3bbaea=_0x3bbaea||0xc8;return function(_0x229104){if(_0x229104){return _0x5acd51[_0x13f2('0x1c')](_0x3bbaea)[_0x13f2('0x1e')](_0x229104);}};}function respondWithFilteredResult(_0x9bf8b4,_0x5c643c){return function(_0x13c6fe){if(_0x13c6fe){var _0x9beeaa=typeof _0x5c643c['offset']===_0x13f2('0x1f')&&typeof _0x5c643c[_0x13f2('0x20')]===_0x13f2('0x1f');var _0x4e32ea=_0x13c6fe['count'];var _0x5ae41e=_0x9beeaa?0x0:_0x5c643c['offset'];var _0xe4627e=_0x9beeaa?_0x13c6fe[_0x13f2('0x21')]:_0x5c643c[_0x13f2('0x22')]+_0x5c643c[_0x13f2('0x20')];var _0x560168;if(_0xe4627e>=_0x4e32ea){_0xe4627e=_0x4e32ea;_0x560168=0xc8;}else{_0x560168=0xce;}_0x9bf8b4[_0x13f2('0x1c')](_0x560168);return _0x9bf8b4[_0x13f2('0x23')]('Content-Range',_0x5ae41e+'-'+_0xe4627e+'/'+_0x4e32ea)['json'](_0x13c6fe);}return null;};}function patchUpdates(_0x3c53f8){return function(_0x2255ff){try{jsonpatch[_0x13f2('0x24')](_0x2255ff,_0x3c53f8,!![]);}catch(_0x33ef74){return BPromise['reject'](_0x33ef74);}return _0x2255ff[_0x13f2('0x25')]();};}function saveUpdates(_0x4eeb0f,_0x473680){return function(_0x470547){if(_0x470547){return _0x470547[_0x13f2('0x26')](_0x4eeb0f)['then'](function(_0xdaafd0){return _0xdaafd0;});}return null;};}function removeEntity(_0x22cf18,_0x9d1f4d){return function(_0x4d1466){if(_0x4d1466){return _0x4d1466[_0x13f2('0x27')]()[_0x13f2('0x28')](function(){_0x22cf18[_0x13f2('0x1c')](0xcc)[_0x13f2('0x1d')]();});}};}function handleEntityNotFound(_0x358b98,_0x435b17){return function(_0x3f30b9){if(!_0x3f30b9){_0x358b98['sendStatus'](0x194);}return _0x3f30b9;};}function handleError(_0x487e5b,_0x4ada07){_0x4ada07=_0x4ada07||0x1f4;return function(_0x6e9bb7){logger[_0x13f2('0x29')](_0x6e9bb7[_0x13f2('0x2a')]);if(_0x6e9bb7[_0x13f2('0x2b')]){delete _0x6e9bb7[_0x13f2('0x2b')];}_0x487e5b['status'](_0x4ada07)['send'](_0x6e9bb7);};}exports[_0x13f2('0x2c')]=function(_0x27a8ff,_0x481db4){var _0x335994={},_0x384b57={},_0x25b111={'count':0x0,'rows':[]};var _0x53cfd3=_[_0x13f2('0x2d')](db['CmHopperBlack'][_0x13f2('0x2e')],function(_0x283db9){return{'name':_0x283db9[_0x13f2('0x2f')],'type':_0x283db9['type']['key']};});_0x384b57[_0x13f2('0x30')]=_[_0x13f2('0x2d')](_0x53cfd3,_0x13f2('0x2b'));_0x384b57[_0x13f2('0x31')]=_['keys'](_0x27a8ff[_0x13f2('0x31')]);_0x384b57['filters']=_[_0x13f2('0x32')](_0x384b57[_0x13f2('0x30')],_0x384b57[_0x13f2('0x31')]);_0x335994[_0x13f2('0x33')]=_['intersection'](_0x384b57[_0x13f2('0x30')],qs[_0x13f2('0x34')](_0x27a8ff['query'][_0x13f2('0x34')]));_0x335994[_0x13f2('0x33')]=_0x335994[_0x13f2('0x33')][_0x13f2('0x35')]?_0x335994['attributes']:_0x384b57[_0x13f2('0x30')];if(!_0x27a8ff['query'][_0x13f2('0x36')](_0x13f2('0x37'))){_0x335994[_0x13f2('0x20')]=qs[_0x13f2('0x20')](_0x27a8ff[_0x13f2('0x31')]['limit']);_0x335994[_0x13f2('0x22')]=qs['offset'](_0x27a8ff['query']['offset']);}_0x335994[_0x13f2('0x38')]=qs[_0x13f2('0x39')](_0x27a8ff['query']['sort']);_0x335994['where']=qs[_0x13f2('0x3a')](_[_0x13f2('0x3b')](_0x27a8ff[_0x13f2('0x31')],_0x384b57[_0x13f2('0x3a')]),_0x53cfd3);if(_0x27a8ff[_0x13f2('0x31')]['filter']){_0x335994[_0x13f2('0x3c')]=_['merge'](_0x335994[_0x13f2('0x3c')],{'$or':_['map'](_0x53cfd3,function(_0x1480df){if(_0x1480df['type']!==_0x13f2('0x3d')){var _0x227b8b={};_0x227b8b[_0x1480df[_0x13f2('0x2b')]]={'$like':'%'+_0x27a8ff[_0x13f2('0x31')][_0x13f2('0x3e')]+'%'};return _0x227b8b;}})});}_0x335994=_['merge']({},_0x335994,_0x27a8ff[_0x13f2('0x3f')]);var _0x262523={'where':_0x335994[_0x13f2('0x3c')]};return db[_0x13f2('0x40')][_0x13f2('0x21')](_0x262523)['then'](function(_0x35432f){_0x25b111['count']=_0x35432f;if(_0x27a8ff['query'][_0x13f2('0x41')]){_0x335994['include']=[{'all':!![]}];}return db[_0x13f2('0x40')]['findAll'](_0x335994);})[_0x13f2('0x28')](function(_0x4d3a75){_0x25b111[_0x13f2('0x42')]=_0x4d3a75;return _0x25b111;})['then'](respondWithFilteredResult(_0x481db4,_0x335994))[_0x13f2('0x43')](handleError(_0x481db4,null));};exports[_0x13f2('0x44')]=function(_0x151c23,_0x4f7135){var _0x2887da={'raw':!![],'where':{'id':_0x151c23[_0x13f2('0x45')]['id']}},_0x32b76a={};_0x32b76a[_0x13f2('0x30')]=_[_0x13f2('0x46')](db[_0x13f2('0x40')][_0x13f2('0x2e')]);_0x32b76a[_0x13f2('0x31')]=_[_0x13f2('0x46')](_0x151c23[_0x13f2('0x31')]);_0x32b76a[_0x13f2('0x3a')]=_[_0x13f2('0x32')](_0x32b76a[_0x13f2('0x30')],_0x32b76a[_0x13f2('0x31')]);_0x2887da[_0x13f2('0x33')]=_[_0x13f2('0x32')](_0x32b76a[_0x13f2('0x30')],qs[_0x13f2('0x34')](_0x151c23[_0x13f2('0x31')][_0x13f2('0x34')]));_0x2887da['attributes']=_0x2887da[_0x13f2('0x33')][_0x13f2('0x35')]?_0x2887da[_0x13f2('0x33')]:_0x32b76a[_0x13f2('0x30')];if(_0x151c23[_0x13f2('0x31')][_0x13f2('0x41')]){_0x2887da[_0x13f2('0x47')]=[{'all':!![]}];}_0x2887da=_['merge']({},_0x2887da,_0x151c23['options']);return db['CmHopperBlack'][_0x13f2('0x48')](_0x2887da)[_0x13f2('0x28')](handleEntityNotFound(_0x4f7135,null))[_0x13f2('0x28')](respondWithResult(_0x4f7135,null))['catch'](handleError(_0x4f7135,null));};exports['update']=function(_0x363f33,_0x5971a0){if(_0x363f33['body']['id']){delete _0x363f33[_0x13f2('0x49')]['id'];}return db['CmHopperBlack'][_0x13f2('0x48')]({'where':{'id':_0x363f33[_0x13f2('0x45')]['id']}})[_0x13f2('0x28')](handleEntityNotFound(_0x5971a0,null))['then'](saveUpdates(_0x363f33[_0x13f2('0x49')],null))[_0x13f2('0x28')](respondWithResult(_0x5971a0,null))['catch'](handleError(_0x5971a0,null));};exports['destroy']=function(_0x20b9a8,_0x3870af){return db['CmHopperBlack'][_0x13f2('0x48')]({'where':{'id':_0x20b9a8['params']['id']}})[_0x13f2('0x28')](handleEntityNotFound(_0x3870af,null))[_0x13f2('0x28')](removeEntity(_0x3870af,null))[_0x13f2('0x43')](handleError(_0x3870af,null));};exports['describe']=function(_0x274f70,_0x1eca11){return db[_0x13f2('0x40')][_0x13f2('0x4a')]()[_0x13f2('0x28')](respondWithResult(_0x1eca11,null))['catch'](handleError(_0x1eca11,null));}; \ No newline at end of file +var _0x5c36=['name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','params','find','catch','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','error','stack'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5c36,0x1d1));var _0x65c3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5c36[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x65c3('0x0'));var jsonpatch=require(_0x65c3('0x1'));var rp=require(_0x65c3('0x2'));var moment=require(_0x65c3('0x3'));var BPromise=require(_0x65c3('0x4'));var Mustache=require('mustache');var util=require(_0x65c3('0x5'));var path=require(_0x65c3('0x6'));var sox=require(_0x65c3('0x7'));var csv=require(_0x65c3('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x65c3('0x9'));var squel=require(_0x65c3('0xa'));var crypto=require(_0x65c3('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x65c3('0x8'));var querystring=require(_0x65c3('0xc'));var Papa=require(_0x65c3('0xd'));var Redis=require(_0x65c3('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x65c3('0xf'));var as=require(_0x65c3('0x10'));var hardwareService=require(_0x65c3('0x11'));var logger=require(_0x65c3('0x12'))(_0x65c3('0x13'));var utils=require(_0x65c3('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x65c3('0x15'));var db=require(_0x65c3('0x16'))['db'];function respondWithStatusCode(_0x349b03,_0x5afc37){_0x5afc37=_0x5afc37||0xcc;return function(_0x2f54ef){if(_0x2f54ef){return _0x349b03[_0x65c3('0x17')](_0x5afc37);}return _0x349b03[_0x65c3('0x18')](_0x5afc37)['end']();};}function respondWithResult(_0x223e29,_0x146db5){_0x146db5=_0x146db5||0xc8;return function(_0x2b2381){if(_0x2b2381){return _0x223e29['status'](_0x146db5)['json'](_0x2b2381);}};}function respondWithFilteredResult(_0x4712cf,_0x36fbf6){return function(_0x12be12){if(_0x12be12){var _0x4c9a7b=typeof _0x36fbf6[_0x65c3('0x19')]===_0x65c3('0x1a')&&typeof _0x36fbf6[_0x65c3('0x1b')]===_0x65c3('0x1a');var _0x5efdea=_0x12be12[_0x65c3('0x1c')];var _0x2a7bc1=_0x4c9a7b?0x0:_0x36fbf6[_0x65c3('0x19')];var _0x266847=_0x4c9a7b?_0x12be12['count']:_0x36fbf6['offset']+_0x36fbf6[_0x65c3('0x1b')];var _0x31670e;if(_0x266847>=_0x5efdea){_0x266847=_0x5efdea;_0x31670e=0xc8;}else{_0x31670e=0xce;}_0x4712cf[_0x65c3('0x18')](_0x31670e);return _0x4712cf[_0x65c3('0x1d')](_0x65c3('0x1e'),_0x2a7bc1+'-'+_0x266847+'/'+_0x5efdea)[_0x65c3('0x1f')](_0x12be12);}return null;};}function patchUpdates(_0x582bac){return function(_0x1ff354){try{jsonpatch[_0x65c3('0x20')](_0x1ff354,_0x582bac,!![]);}catch(_0x4ac1b4){return BPromise[_0x65c3('0x21')](_0x4ac1b4);}return _0x1ff354['save']();};}function saveUpdates(_0x2a256d,_0x5fd38){return function(_0x41f969){if(_0x41f969){return _0x41f969[_0x65c3('0x22')](_0x2a256d)[_0x65c3('0x23')](function(_0x191ce2){return _0x191ce2;});}return null;};}function removeEntity(_0x233fe1,_0x3488a1){return function(_0x578bb3){if(_0x578bb3){return _0x578bb3[_0x65c3('0x24')]()[_0x65c3('0x23')](function(){_0x233fe1[_0x65c3('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x264647,_0x2ac060){return function(_0x3d7b49){if(!_0x3d7b49){_0x264647[_0x65c3('0x17')](0x194);}return _0x3d7b49;};}function handleError(_0x2cedc9,_0x396ca5){_0x396ca5=_0x396ca5||0x1f4;return function(_0x1c191e){logger[_0x65c3('0x25')](_0x1c191e[_0x65c3('0x26')]);if(_0x1c191e[_0x65c3('0x27')]){delete _0x1c191e[_0x65c3('0x27')];}_0x2cedc9[_0x65c3('0x18')](_0x396ca5)[_0x65c3('0x28')](_0x1c191e);};}exports[_0x65c3('0x29')]=function(_0x12efa7,_0x55e38c){var _0x5e97bc={},_0x3c5571={},_0x18945a={'count':0x0,'rows':[]};var _0xb04283=_[_0x65c3('0x2a')](db[_0x65c3('0x2b')][_0x65c3('0x2c')],function(_0x32f340){return{'name':_0x32f340[_0x65c3('0x2d')],'type':_0x32f340[_0x65c3('0x2e')][_0x65c3('0x2f')]};});_0x3c5571['model']=_['map'](_0xb04283,'name');_0x3c5571[_0x65c3('0x30')]=_[_0x65c3('0x31')](_0x12efa7['query']);_0x3c5571[_0x65c3('0x32')]=_[_0x65c3('0x33')](_0x3c5571[_0x65c3('0x34')],_0x3c5571['query']);_0x5e97bc[_0x65c3('0x35')]=_[_0x65c3('0x33')](_0x3c5571[_0x65c3('0x34')],qs['fields'](_0x12efa7[_0x65c3('0x30')][_0x65c3('0x36')]));_0x5e97bc[_0x65c3('0x35')]=_0x5e97bc[_0x65c3('0x35')][_0x65c3('0x37')]?_0x5e97bc[_0x65c3('0x35')]:_0x3c5571['model'];if(!_0x12efa7[_0x65c3('0x30')][_0x65c3('0x38')](_0x65c3('0x39'))){_0x5e97bc[_0x65c3('0x1b')]=qs[_0x65c3('0x1b')](_0x12efa7['query'][_0x65c3('0x1b')]);_0x5e97bc[_0x65c3('0x19')]=qs[_0x65c3('0x19')](_0x12efa7[_0x65c3('0x30')][_0x65c3('0x19')]);}_0x5e97bc['order']=qs['sort'](_0x12efa7[_0x65c3('0x30')][_0x65c3('0x3a')]);_0x5e97bc[_0x65c3('0x3b')]=qs[_0x65c3('0x32')](_[_0x65c3('0x3c')](_0x12efa7[_0x65c3('0x30')],_0x3c5571[_0x65c3('0x32')]),_0xb04283);if(_0x12efa7[_0x65c3('0x30')][_0x65c3('0x3d')]){_0x5e97bc[_0x65c3('0x3b')]=_[_0x65c3('0x3e')](_0x5e97bc['where'],{'$or':_['map'](_0xb04283,function(_0x4bf8b1){if(_0x4bf8b1['type']!==_0x65c3('0x3f')){var _0x5f1d04={};_0x5f1d04[_0x4bf8b1[_0x65c3('0x27')]]={'$like':'%'+_0x12efa7[_0x65c3('0x30')][_0x65c3('0x3d')]+'%'};return _0x5f1d04;}})});}_0x5e97bc=_[_0x65c3('0x3e')]({},_0x5e97bc,_0x12efa7[_0x65c3('0x40')]);var _0x2d8a1d={'where':_0x5e97bc[_0x65c3('0x3b')]};return db[_0x65c3('0x2b')][_0x65c3('0x1c')](_0x2d8a1d)['then'](function(_0x1877ae){_0x18945a[_0x65c3('0x1c')]=_0x1877ae;if(_0x12efa7['query'][_0x65c3('0x41')]){_0x5e97bc['include']=[{'all':!![]}];}return db[_0x65c3('0x2b')][_0x65c3('0x42')](_0x5e97bc);})[_0x65c3('0x23')](function(_0x5beb38){_0x18945a[_0x65c3('0x43')]=_0x5beb38;return _0x18945a;})[_0x65c3('0x23')](respondWithFilteredResult(_0x55e38c,_0x5e97bc))['catch'](handleError(_0x55e38c,null));};exports['show']=function(_0x4c7d1e,_0x4ebadb){var _0x22c0a6={'raw':!![],'where':{'id':_0x4c7d1e[_0x65c3('0x44')]['id']}},_0x3237ed={};_0x3237ed['model']=_['keys'](db[_0x65c3('0x2b')][_0x65c3('0x2c')]);_0x3237ed['query']=_[_0x65c3('0x31')](_0x4c7d1e[_0x65c3('0x30')]);_0x3237ed['filters']=_[_0x65c3('0x33')](_0x3237ed['model'],_0x3237ed[_0x65c3('0x30')]);_0x22c0a6['attributes']=_[_0x65c3('0x33')](_0x3237ed['model'],qs['fields'](_0x4c7d1e[_0x65c3('0x30')]['fields']));_0x22c0a6[_0x65c3('0x35')]=_0x22c0a6[_0x65c3('0x35')][_0x65c3('0x37')]?_0x22c0a6['attributes']:_0x3237ed[_0x65c3('0x34')];if(_0x4c7d1e[_0x65c3('0x30')][_0x65c3('0x41')]){_0x22c0a6['include']=[{'all':!![]}];}_0x22c0a6=_[_0x65c3('0x3e')]({},_0x22c0a6,_0x4c7d1e[_0x65c3('0x40')]);return db[_0x65c3('0x2b')][_0x65c3('0x45')](_0x22c0a6)[_0x65c3('0x23')](handleEntityNotFound(_0x4ebadb,null))[_0x65c3('0x23')](respondWithResult(_0x4ebadb,null))[_0x65c3('0x46')](handleError(_0x4ebadb,null));};exports['update']=function(_0x406d89,_0x6d9307){if(_0x406d89['body']['id']){delete _0x406d89['body']['id'];}return db[_0x65c3('0x2b')][_0x65c3('0x45')]({'where':{'id':_0x406d89[_0x65c3('0x44')]['id']}})[_0x65c3('0x23')](handleEntityNotFound(_0x6d9307,null))[_0x65c3('0x23')](saveUpdates(_0x406d89['body'],null))[_0x65c3('0x23')](respondWithResult(_0x6d9307,null))[_0x65c3('0x46')](handleError(_0x6d9307,null));};exports['destroy']=function(_0x1685cd,_0x50a16f){return db[_0x65c3('0x2b')][_0x65c3('0x45')]({'where':{'id':_0x1685cd[_0x65c3('0x44')]['id']}})[_0x65c3('0x23')](handleEntityNotFound(_0x50a16f,null))[_0x65c3('0x23')](removeEntity(_0x50a16f,null))[_0x65c3('0x46')](handleError(_0x50a16f,null));};exports[_0x65c3('0x47')]=function(_0x2dbccf,_0x30a8ba){return db[_0x65c3('0x2b')]['describe']()[_0x65c3('0x23')](respondWithResult(_0x30a8ba,null))[_0x65c3('0x46')](handleError(_0x30a8ba,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 7458b80..96c332a 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 _0x73cf=['CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x311d45,_0xad8766){var _0x55ba6e=function(_0x4c17f5){while(--_0x4c17f5){_0x311d45['push'](_0x311d45['shift']());}};_0x55ba6e(++_0xad8766);}(_0x73cf,0x18e));var _0xf73c=function(_0x5e36d1,_0x471178){_0x5e36d1=_0x5e36d1-0x0;var _0x950b9e=_0x73cf[_0x5e36d1];return _0x950b9e;};'use strict';var _=require(_0xf73c('0x0'));var util=require(_0xf73c('0x1'));var logger=require(_0xf73c('0x2'))(_0xf73c('0x3'));var moment=require(_0xf73c('0x4'));var BPromise=require(_0xf73c('0x5'));var rp=require(_0xf73c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf73c('0x7'));var config=require(_0xf73c('0x8'));var attributes=require('./cmHopperBlack.attributes');module['exports']=function(_0x15539c,_0x2d0360){return _0x15539c['define'](_0xf73c('0x9'),attributes,{'tableName':_0xf73c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc1e0=['exports','define','CmHopperBlack','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x20cde4,_0x11d490){var _0x591fa3=function(_0x27b956){while(--_0x27b956){_0x20cde4['push'](_0x20cde4['shift']());}};_0x591fa3(++_0x11d490);}(_0xc1e0,0xd4));var _0x0c1e=function(_0x4b8b74,_0x1e5dc3){_0x4b8b74=_0x4b8b74-0x0;var _0x12e5b0=_0xc1e0[_0x4b8b74];return _0x12e5b0;};'use strict';var _=require('lodash');var util=require(_0x0c1e('0x0'));var logger=require(_0x0c1e('0x1'))(_0x0c1e('0x2'));var moment=require(_0x0c1e('0x3'));var BPromise=require(_0x0c1e('0x4'));var rp=require(_0x0c1e('0x5'));var fs=require('fs');var path=require(_0x0c1e('0x6'));var rimraf=require(_0x0c1e('0x7'));var config=require('../../config/environment');var attributes=require('./cmHopperBlack.attributes');module[_0x0c1e('0x8')]=function(_0x2c63ed,_0x158032){return _0x2c63ed[_0x0c1e('0x9')](_0x0c1e('0xa'),attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index 72bc6b4..b7a0c1f 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 _0x8141=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','error','code','message','info','GetCmHopperBlack','findAll','options','raw','where','attributes','include','map','model','catch','UpdateCmHopperBlack','CmHopperBlack','limit','destroy','DestroyCmHopperBlack','stringify','lodash','util','moment','bluebird'];(function(_0xd95342,_0xb75bf6){var _0x54d694=function(_0x1190c1){while(--_0x1190c1){_0xd95342['push'](_0xd95342['shift']());}};_0x54d694(++_0xb75bf6);}(_0x8141,0xff));var _0x1814=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8141[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x1814('0x0'));var util=require(_0x1814('0x1'));var moment=require(_0x1814('0x2'));var BPromise=require(_0x1814('0x3'));var rs=require(_0x1814('0x4'));var fs=require('fs');var Redis=require(_0x1814('0x5'));var db=require(_0x1814('0x6'))['db'];var utils=require(_0x1814('0x7'));var logger=require(_0x1814('0x8'))(_0x1814('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1814('0xa')][_0x1814('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5507ed,_0x454647,_0x377389){return new BPromise(function(_0x39850c,_0x27a181){return client['request'](_0x5507ed,_0x377389)[_0x1814('0xc')](function(_0x395de0){logger['info'](_0x1814('0xd'),_0x454647,_0x1814('0xe'));logger[_0x1814('0xf')](_0x1814('0x10'),_0x454647,_0x1814('0xe'),JSON['stringify'](_0x395de0));if(_0x395de0[_0x1814('0x11')]){if(_0x395de0[_0x1814('0x11')][_0x1814('0x12')]===0x1f4){logger['error'](_0x1814('0xd'),_0x454647,_0x395de0[_0x1814('0x11')][_0x1814('0x13')]);return _0x27a181(_0x395de0[_0x1814('0x11')]['message']);}logger[_0x1814('0x11')](_0x1814('0xd'),_0x454647,_0x395de0[_0x1814('0x11')]['message']);return _0x39850c(_0x395de0[_0x1814('0x11')][_0x1814('0x13')]);}else{logger[_0x1814('0x14')](_0x1814('0xd'),_0x454647,_0x1814('0xe'));_0x39850c(_0x395de0['result']['message']);}})['catch'](function(_0x38ab6a){logger['error'](_0x1814('0xd'),_0x454647,_0x38ab6a);_0x27a181(_0x38ab6a);});});}exports[_0x1814('0x15')]=function(_0x63144){var _0xeba8fe=this;return new Promise(function(_0x545c64,_0xb07cb3){return db['CmHopperBlack'][_0x1814('0x16')]({'raw':_0x63144[_0x1814('0x17')]?_0x63144[_0x1814('0x17')][_0x1814('0x18')]===undefined?!![]:![]:!![],'where':_0x63144['options']?_0x63144[_0x1814('0x17')][_0x1814('0x19')]||null:null,'attributes':_0x63144[_0x1814('0x17')]?_0x63144[_0x1814('0x17')][_0x1814('0x1a')]||null:null,'limit':_0x63144['options']?_0x63144['options']['limit']||null:null,'include':_0x63144['options']?_0x63144[_0x1814('0x17')][_0x1814('0x1b')]?_[_0x1814('0x1c')](_0x63144[_0x1814('0x17')][_0x1814('0x1b')],function(_0x382f62){return{'model':db[_0x382f62[_0x1814('0x1d')]],'as':_0x382f62['as'],'attributes':_0x382f62[_0x1814('0x1a')],'include':_0x382f62['include']?_[_0x1814('0x1c')](_0x382f62[_0x1814('0x1b')],function(_0x2becf0){return{'model':db[_0x2becf0[_0x1814('0x1d')]],'as':_0x2becf0['as'],'attributes':_0x2becf0[_0x1814('0x1a')],'include':_0x2becf0[_0x1814('0x1b')]?_['map'](_0x2becf0['include'],function(_0x5214ad){return{'model':db[_0x5214ad[_0x1814('0x1d')]],'as':_0x5214ad['as'],'attributes':_0x5214ad['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xc186a1){logger[_0x1814('0x14')](_0x1814('0x15'),_0x63144);logger[_0x1814('0xf')](_0x1814('0x15'),_0x63144,JSON['stringify'](_0xc186a1));_0x545c64(_0xc186a1);})[_0x1814('0x1e')](function(_0x2e744c){logger[_0x1814('0x11')]('GetCmHopperBlack',_0x2e744c[_0x1814('0x13')],_0x63144);_0xb07cb3(_0xeba8fe[_0x1814('0x11')](0x1f4,_0x2e744c[_0x1814('0x13')]));});});};exports[_0x1814('0x1f')]=function(_0x1a52c4){var _0x4c0892=this;return new Promise(function(_0x10f4c5,_0x59a746){return db[_0x1814('0x20')]['update'](_0x1a52c4['body'],{'raw':_0x1a52c4[_0x1814('0x17')]?_0x1a52c4[_0x1814('0x17')][_0x1814('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1a52c4[_0x1814('0x17')]?_0x1a52c4[_0x1814('0x17')][_0x1814('0x19')]||null:null,'attributes':_0x1a52c4[_0x1814('0x17')]?_0x1a52c4['options']['attributes']||null:null,'limit':_0x1a52c4['options']?_0x1a52c4['options'][_0x1814('0x21')]||null:null})['then'](function(_0x535be0){logger[_0x1814('0x14')](_0x1814('0x1f'),_0x1a52c4);logger[_0x1814('0xf')](_0x1814('0x1f'),_0x1a52c4,JSON['stringify'](_0x535be0));_0x10f4c5(_0x535be0);})[_0x1814('0x1e')](function(_0x83a747){logger['error'](_0x1814('0x1f'),_0x83a747[_0x1814('0x13')],_0x1a52c4);_0x59a746(_0x4c0892[_0x1814('0x11')](0x1f4,_0x83a747[_0x1814('0x13')]));});});};exports['DestroyCmHopperBlack']=function(_0x525668){var _0x5b785f=this;return new Promise(function(_0x42e64f,_0x2ebce6){return db[_0x1814('0x20')][_0x1814('0x22')]({'where':_0x525668[_0x1814('0x17')]?_0x525668['options']['where']||null:null})[_0x1814('0xc')](function(_0x469a31){logger[_0x1814('0x14')](_0x1814('0x23'),_0x525668);logger['debug'](_0x1814('0x23'),_0x525668,JSON[_0x1814('0x24')](_0x469a31));_0x42e64f(_0x469a31);})[_0x1814('0x1e')](function(_0x340e6b){logger[_0x1814('0x11')]('DestroyCmHopperBlack',_0x340e6b['message'],_0x525668);_0x2ebce6(_0x5b785f[_0x1814('0x11')](0x1f4,_0x340e6b[_0x1814('0x13')]));});});}; \ No newline at end of file +var _0x178f=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetCmHopperBlack','findAll','options','raw','attributes','include','map','model','update','body','limit','UpdateCmHopperBlack','DestroyCmHopperBlack','destroy','where','lodash','util','moment','bluebird'];(function(_0x2048b2,_0xd4ea20){var _0x241e52=function(_0x5e071b){while(--_0x5e071b){_0x2048b2['push'](_0x2048b2['shift']());}};_0x241e52(++_0xd4ea20);}(_0x178f,0x182));var _0xf178=function(_0x4ed912,_0x9b2b92){_0x4ed912=_0x4ed912-0x0;var _0x379b20=_0x178f[_0x4ed912];return _0x379b20;};'use strict';var _=require(_0xf178('0x0'));var util=require(_0xf178('0x1'));var moment=require(_0xf178('0x2'));var BPromise=require(_0xf178('0x3'));var rs=require(_0xf178('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf178('0x5'))['db'];var utils=require(_0xf178('0x6'));var logger=require(_0xf178('0x7'))(_0xf178('0x8'));var config=require(_0xf178('0x9'));var jayson=require(_0xf178('0xa'));var client=jayson[_0xf178('0xb')][_0xf178('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x23fcb1,_0x12ffdf,_0x130fe0){return new BPromise(function(_0x133ab2,_0x1ada51){return client[_0xf178('0xd')](_0x23fcb1,_0x130fe0)[_0xf178('0xe')](function(_0x4a837a){logger[_0xf178('0xf')](_0xf178('0x10'),_0x12ffdf,_0xf178('0x11'));logger[_0xf178('0x12')](_0xf178('0x13'),_0x12ffdf,_0xf178('0x11'),JSON[_0xf178('0x14')](_0x4a837a));if(_0x4a837a[_0xf178('0x15')]){if(_0x4a837a[_0xf178('0x15')]['code']===0x1f4){logger[_0xf178('0x15')](_0xf178('0x10'),_0x12ffdf,_0x4a837a[_0xf178('0x15')][_0xf178('0x16')]);return _0x1ada51(_0x4a837a[_0xf178('0x15')][_0xf178('0x16')]);}logger[_0xf178('0x15')]('CmHopperBlack,\x20%s,\x20%s',_0x12ffdf,_0x4a837a[_0xf178('0x15')][_0xf178('0x16')]);return _0x133ab2(_0x4a837a[_0xf178('0x15')][_0xf178('0x16')]);}else{logger[_0xf178('0xf')]('CmHopperBlack,\x20%s,\x20%s',_0x12ffdf,'request\x20sent');_0x133ab2(_0x4a837a['result'][_0xf178('0x16')]);}})[_0xf178('0x17')](function(_0x2728f9){logger[_0xf178('0x15')](_0xf178('0x10'),_0x12ffdf,_0x2728f9);_0x1ada51(_0x2728f9);});});}exports[_0xf178('0x18')]=function(_0x519dd9){var _0x3e7807=this;return new Promise(function(_0x12fb39,_0xd68eb1){return db['CmHopperBlack'][_0xf178('0x19')]({'raw':_0x519dd9[_0xf178('0x1a')]?_0x519dd9[_0xf178('0x1a')][_0xf178('0x1b')]===undefined?!![]:![]:!![],'where':_0x519dd9[_0xf178('0x1a')]?_0x519dd9[_0xf178('0x1a')]['where']||null:null,'attributes':_0x519dd9[_0xf178('0x1a')]?_0x519dd9[_0xf178('0x1a')][_0xf178('0x1c')]||null:null,'limit':_0x519dd9[_0xf178('0x1a')]?_0x519dd9[_0xf178('0x1a')]['limit']||null:null,'include':_0x519dd9[_0xf178('0x1a')]?_0x519dd9[_0xf178('0x1a')][_0xf178('0x1d')]?_[_0xf178('0x1e')](_0x519dd9[_0xf178('0x1a')][_0xf178('0x1d')],function(_0x1cb11c){return{'model':db[_0x1cb11c[_0xf178('0x1f')]],'as':_0x1cb11c['as'],'attributes':_0x1cb11c[_0xf178('0x1c')],'include':_0x1cb11c['include']?_[_0xf178('0x1e')](_0x1cb11c[_0xf178('0x1d')],function(_0x57b141){return{'model':db[_0x57b141[_0xf178('0x1f')]],'as':_0x57b141['as'],'attributes':_0x57b141[_0xf178('0x1c')],'include':_0x57b141[_0xf178('0x1d')]?_[_0xf178('0x1e')](_0x57b141['include'],function(_0x3dc1fe){return{'model':db[_0x3dc1fe[_0xf178('0x1f')]],'as':_0x3dc1fe['as'],'attributes':_0x3dc1fe[_0xf178('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xf178('0xe')](function(_0x2cbaee){logger[_0xf178('0xf')](_0xf178('0x18'),_0x519dd9);logger[_0xf178('0x12')](_0xf178('0x18'),_0x519dd9,JSON[_0xf178('0x14')](_0x2cbaee));_0x12fb39(_0x2cbaee);})['catch'](function(_0x3a0b00){logger[_0xf178('0x15')](_0xf178('0x18'),_0x3a0b00['message'],_0x519dd9);_0xd68eb1(_0x3e7807['error'](0x1f4,_0x3a0b00[_0xf178('0x16')]));});});};exports['UpdateCmHopperBlack']=function(_0x243f4f){var _0x42429c=this;return new Promise(function(_0x55b509,_0x5bfcd9){return db['CmHopperBlack'][_0xf178('0x20')](_0x243f4f[_0xf178('0x21')],{'raw':_0x243f4f[_0xf178('0x1a')]?_0x243f4f[_0xf178('0x1a')][_0xf178('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x243f4f[_0xf178('0x1a')]?_0x243f4f['options']['where']||null:null,'attributes':_0x243f4f[_0xf178('0x1a')]?_0x243f4f[_0xf178('0x1a')][_0xf178('0x1c')]||null:null,'limit':_0x243f4f['options']?_0x243f4f[_0xf178('0x1a')][_0xf178('0x22')]||null:null})['then'](function(_0x655285){logger['info'](_0xf178('0x23'),_0x243f4f);logger['debug']('UpdateCmHopperBlack',_0x243f4f,JSON[_0xf178('0x14')](_0x655285));_0x55b509(_0x655285);})[_0xf178('0x17')](function(_0x5a457c){logger[_0xf178('0x15')](_0xf178('0x23'),_0x5a457c[_0xf178('0x16')],_0x243f4f);_0x5bfcd9(_0x42429c['error'](0x1f4,_0x5a457c[_0xf178('0x16')]));});});};exports[_0xf178('0x24')]=function(_0x5025c5){var _0x165522=this;return new Promise(function(_0x1a503e,_0x4d67d8){return db['CmHopperBlack'][_0xf178('0x25')]({'where':_0x5025c5[_0xf178('0x1a')]?_0x5025c5[_0xf178('0x1a')][_0xf178('0x26')]||null:null})['then'](function(_0x116ca6){logger[_0xf178('0xf')](_0xf178('0x24'),_0x5025c5);logger[_0xf178('0x12')](_0xf178('0x24'),_0x5025c5,JSON[_0xf178('0x14')](_0x116ca6));_0x1a503e(_0x116ca6);})[_0xf178('0x17')](function(_0x1e14fd){logger[_0xf178('0x15')]('DestroyCmHopperBlack',_0x1e14fd[_0xf178('0x16')],_0x5025c5);_0x4d67d8(_0x165522[_0xf178('0x15')](0x1f4,_0x1e14fd[_0xf178('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index a19155d..1b8e8a4 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 _0xb145=['update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','describe','/:id','show','put'];(function(_0x5716b2,_0x4c2f1a){var _0x2dd657=function(_0x5a2651){while(--_0x5a2651){_0x5716b2['push'](_0x5716b2['shift']());}};_0x2dd657(++_0x4c2f1a);}(_0xb145,0xa3));var _0x5b14=function(_0x5cf046,_0x17778c){_0x5cf046=_0x5cf046-0x0;var _0x42c854=_0xb145[_0x5cf046];return _0x42c854;};'use strict';var multer=require('multer');var util=require(_0x5b14('0x0'));var path=require(_0x5b14('0x1'));var timeout=require(_0x5b14('0x2'));var express=require(_0x5b14('0x3'));var router=express[_0x5b14('0x4')]();var fs_extra=require(_0x5b14('0x5'));var auth=require(_0x5b14('0x6'));var interaction=require(_0x5b14('0x7'));var config=require('../../config/environment');var controller=require(_0x5b14('0x8'));router[_0x5b14('0x9')]('/',auth[_0x5b14('0xa')](),controller[_0x5b14('0xb')]);router['get'](_0x5b14('0xc'),auth[_0x5b14('0xa')](),controller[_0x5b14('0xd')]);router[_0x5b14('0x9')](_0x5b14('0xe'),auth['isAuthenticated'](),controller[_0x5b14('0xf')]);router[_0x5b14('0x10')]('/:id',auth[_0x5b14('0xa')](),controller[_0x5b14('0x11')]);router[_0x5b14('0x12')](_0x5b14('0xe'),auth[_0x5b14('0xa')](),controller['destroy']);module[_0x5b14('0x13')]=router; \ No newline at end of file +var _0xa46e=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','index','isAuthenticated','describe','/:id','update','destroy','multer','util'];(function(_0xcdf752,_0x51b609){var _0x21448e=function(_0xa516b4){while(--_0xa516b4){_0xcdf752['push'](_0xcdf752['shift']());}};_0x21448e(++_0x51b609);}(_0xa46e,0x8a));var _0xea46=function(_0x2b5513,_0x3fe5cd){_0x2b5513=_0x2b5513-0x0;var _0x578fd2=_0xa46e[_0x2b5513];return _0x578fd2;};'use strict';var multer=require(_0xea46('0x0'));var util=require(_0xea46('0x1'));var path=require('path');var timeout=require(_0xea46('0x2'));var express=require(_0xea46('0x3'));var router=express[_0xea46('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xea46('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xea46('0x6'));var controller=require('./cmHopperBlack.controller');router[_0xea46('0x7')]('/',auth['isAuthenticated'](),controller[_0xea46('0x8')]);router[_0xea46('0x7')]('/describe',auth[_0xea46('0x9')](),controller[_0xea46('0xa')]);router[_0xea46('0x7')](_0xea46('0xb'),auth[_0xea46('0x9')](),controller['show']);router['put']('/:id',auth[_0xea46('0x9')](),controller[_0xea46('0xc')]);router['delete'](_0xea46('0xb'),auth[_0xea46('0x9')](),controller[_0xea46('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index c5516fb..940643a 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 _0xb876=['setDataValue','followuptime','diff','seconds','BOOLEAN','moment','exports','INTEGER','STRING','DATE','getDataValue','endtime'];(function(_0x3c2c86,_0x2088f8){var _0x3c427d=function(_0x4c4c30){while(--_0x4c4c30){_0x3c2c86['push'](_0x3c2c86['shift']());}};_0x3c427d(++_0x2088f8);}(_0xb876,0x161));var _0x6b87=function(_0x67f04d,_0x451fa6){_0x67f04d=_0x67f04d-0x0;var _0x520a6e=_0xb876[_0x67f04d];return _0x520a6e;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x6b87('0x0'));module[_0x6b87('0x1')]={'state':{'type':Sequelize[_0x6b87('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x6b87('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x6b87('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x6b87('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x6b87('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x6b87('0x3')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x6b87('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x6b87('0x4')]},'responsetime':{'type':Sequelize[_0x6b87('0x4')]},'answertime':{'type':Sequelize[_0x6b87('0x4')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x6b87('0x4')]},'ringtime':{'type':Sequelize[_0x6b87('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x6b87('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x6b87('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x6b87('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x6b87('0x3')]},'membername':{'type':Sequelize[_0x6b87('0x3')]},'reason':{'type':Sequelize[_0x6b87('0x3')]},'disposition':{'type':Sequelize[_0x6b87('0x3')]},'secondDisposition':{'type':Sequelize[_0x6b87('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0x6b87('0x4')],'set':function(_0x2baad8){var _0x4b562e=this[_0x6b87('0x5')](_0x6b87('0x6'));if(_0x4b562e&&_0x2baad8){this[_0x6b87('0x7')](_0x6b87('0x8'),moment(_0x2baad8)[_0x6b87('0x9')](moment(_0x4b562e),_0x6b87('0xa')));}}},'amd':{'type':Sequelize[_0x6b87('0xb')],'defaultValue':![]},'fax':{'type':Sequelize[_0x6b87('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x6b87('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x6b87('0x4')]},'callback':{'type':Sequelize[_0x6b87('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x6b87('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x6b87('0x4')]},'deleted':{'type':Sequelize[_0x6b87('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x6b87('0x4')]},'recallme':{'type':Sequelize[_0x6b87('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x6b87('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x6b87('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x6b87('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x6b87('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x6b87('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x6b87('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb994=['setDataValue','followuptime','BOOLEAN','sequelize','moment','exports','STRING','DATE','INTEGER','getDataValue','endtime'];(function(_0xcd0918,_0x56bdf9){var _0x250704=function(_0x56788e){while(--_0x56788e){_0xcd0918['push'](_0xcd0918['shift']());}};_0x250704(++_0x56bdf9);}(_0xb994,0x16e));var _0x4b99=function(_0x36bb53,_0x3174ff){_0x36bb53=_0x36bb53-0x0;var _0x2ca6e6=_0xb994[_0x36bb53];return _0x2ca6e6;};'use strict';var Sequelize=require(_0x4b99('0x0'));var moment=require(_0x4b99('0x1'));module[_0x4b99('0x2')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x4b99('0x3')]},'scheduledat':{'type':Sequelize[_0x4b99('0x4')]},'countbusyretry':{'type':Sequelize[_0x4b99('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x4b99('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x4b99('0x5')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x4b99('0x5')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x4b99('0x3')]},'originatecalleridname':{'type':Sequelize[_0x4b99('0x3')]},'calleridnum':{'type':Sequelize[_0x4b99('0x3')]},'calleridname':{'type':Sequelize[_0x4b99('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x4b99('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x4b99('0x4')]},'endtime':{'type':Sequelize[_0x4b99('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x4b99('0x5')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x4b99('0x5')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x4b99('0x5')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x4b99('0x3')]},'campaign':{'type':Sequelize[_0x4b99('0x3')]},'campaigntype':{'type':Sequelize[_0x4b99('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x4b99('0x3')]},'disposition':{'type':Sequelize[_0x4b99('0x3')]},'secondDisposition':{'type':Sequelize[_0x4b99('0x3')]},'thirdDisposition':{'type':Sequelize[_0x4b99('0x3')]},'dispositionat':{'type':Sequelize[_0x4b99('0x4')],'set':function(_0x2d5034){var _0x5b1ac2=this[_0x4b99('0x6')](_0x4b99('0x7'));if(_0x5b1ac2&&_0x2d5034){this[_0x4b99('0x8')](_0x4b99('0x9'),moment(_0x2d5034)['diff'](moment(_0x5b1ac2),'seconds'));}}},'amd':{'type':Sequelize[_0x4b99('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0x4b99('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x4b99('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x4b99('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0x4b99('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x4b99('0x4')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0x4b99('0x4')]},'recallme':{'type':Sequelize[_0x4b99('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0x4b99('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x4b99('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x4b99('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x4b99('0x5')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index d446a0e..e7551fb 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 _0x2ef3=['params','keys','describe','uniqueid','body','find','countContactsQueueCampaignHopperFinal','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','COUNT','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','countContactsIvrCampaignHopperFinal','noAnswerContacts','busyContacts','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','answeringMachine','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','createdAt','updatedAt','field','NOW()','VoiceQueueId','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','select','from','calleridnum','state\x20=\x204','group','Campaign','ListId','CampaignId','ANY_VALUE(calleridnum)','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','CampaignId\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','CmHopper','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','CmHopperFinal','then','includeAll','include','findAll','catch','show'];(function(_0x25e53c,_0x31b73c){var _0x53a78a=function(_0x1224d8){while(--_0x1224d8){_0x25e53c['push'](_0x25e53c['shift']());}};_0x53a78a(++_0x31b73c);}(_0x2ef3,0xba));var _0x32ef=function(_0x373afe,_0x4841f3){_0x373afe=_0x373afe-0x0;var _0x4decea=_0x2ef3[_0x373afe];return _0x4decea;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5106,_0x49d590){_0x49d590=_0x49d590||0xcc;return function(_0x3e98df){if(_0x3e98df){return _0x1a5106[_0x32ef('0x18')](_0x49d590);}return _0x1a5106['status'](_0x49d590)['end']();};}function respondWithResult(_0x19ce1,_0x4d8009){_0x4d8009=_0x4d8009||0xc8;return function(_0x326fce){if(_0x326fce){return _0x19ce1[_0x32ef('0x19')](_0x4d8009)[_0x32ef('0x1a')](_0x326fce);}};}function respondWithFilteredResult(_0x54c7f5,_0x57aff1){return function(_0x55bf0b){if(_0x55bf0b){var _0x531e30=typeof _0x57aff1[_0x32ef('0x1b')]===_0x32ef('0x1c')&&typeof _0x57aff1[_0x32ef('0x1d')]==='undefined';var _0x5d559b=_0x55bf0b[_0x32ef('0x1e')];var _0x1a9476=_0x531e30?0x0:_0x57aff1[_0x32ef('0x1b')];var _0x57863c=_0x531e30?_0x55bf0b[_0x32ef('0x1e')]:_0x57aff1[_0x32ef('0x1b')]+_0x57aff1['limit'];var _0x304505;if(_0x57863c>=_0x5d559b){_0x57863c=_0x5d559b;_0x304505=0xc8;}else{_0x304505=0xce;}_0x54c7f5[_0x32ef('0x19')](_0x304505);return _0x54c7f5[_0x32ef('0x1f')](_0x32ef('0x20'),_0x1a9476+'-'+_0x57863c+'/'+_0x5d559b)[_0x32ef('0x1a')](_0x55bf0b);}return null;};}function patchUpdates(_0x3aec05){return function(_0x4de441){try{jsonpatch[_0x32ef('0x21')](_0x4de441,_0x3aec05,!![]);}catch(_0x5cc3ef){return BPromise[_0x32ef('0x22')](_0x5cc3ef);}return _0x4de441[_0x32ef('0x23')]();};}function saveUpdates(_0x49f2d8,_0x1af371){return function(_0x97780){if(_0x97780){return _0x97780[_0x32ef('0x24')](_0x49f2d8)['then'](function(_0x57f5e5){return _0x57f5e5;});}return null;};}function removeEntity(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(_0x225feb){return _0x225feb['destroy']()['then'](function(){_0x22f2d7[_0x32ef('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a412,_0x278495){return function(_0x14d4b3){if(!_0x14d4b3){_0x51a412[_0x32ef('0x18')](0x194);}return _0x14d4b3;};}function handleError(_0x1dbe98,_0x15ce54){_0x15ce54=_0x15ce54||0x1f4;return function(_0x234175){logger[_0x32ef('0x25')](_0x234175[_0x32ef('0x26')]);if(_0x234175[_0x32ef('0x27')]){delete _0x234175[_0x32ef('0x27')];}_0x1dbe98[_0x32ef('0x19')](_0x15ce54)[_0x32ef('0x28')](_0x234175);};}exports['index']=function(_0xd65fde,_0x2f5d06){var _0x5a04cd={},_0x12de1a={},_0x3c569d={'count':0x0,'rows':[]};var _0x30b250=_[_0x32ef('0x29')](db['CmHopperFinal'][_0x32ef('0x2a')],function(_0x22bf86){return{'name':_0x22bf86[_0x32ef('0x2b')],'type':_0x22bf86[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x12de1a[_0x32ef('0x2e')]=_[_0x32ef('0x29')](_0x30b250,'name');_0x12de1a[_0x32ef('0x2f')]=_['keys'](_0xd65fde[_0x32ef('0x2f')]);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x12de1a[_0x32ef('0x2e')],_0x12de1a[_0x32ef('0x2f')]);_0x5a04cd[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x12de1a[_0x32ef('0x2e')],qs['fields'](_0xd65fde['query'][_0x32ef('0x33')]));_0x5a04cd['attributes']=_0x5a04cd[_0x32ef('0x31')][_0x32ef('0x34')]?_0x5a04cd[_0x32ef('0x31')]:_0x12de1a[_0x32ef('0x2e')];if(!_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x35')]('nolimit')){_0x5a04cd['limit']=qs['limit'](_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x5a04cd[_0x32ef('0x1b')]=qs['offset'](_0xd65fde['query'][_0x32ef('0x1b')]);}_0x5a04cd[_0x32ef('0x36')]=qs[_0x32ef('0x37')](_0xd65fde['query']['sort']);_0x5a04cd[_0x32ef('0x38')]=qs[_0x32ef('0x30')](_[_0x32ef('0x39')](_0xd65fde[_0x32ef('0x2f')],_0x12de1a[_0x32ef('0x30')]),_0x30b250);if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]){_0x5a04cd[_0x32ef('0x38')]=_[_0x32ef('0x3b')](_0x5a04cd['where'],{'$or':_[_0x32ef('0x29')](_0x30b250,function(_0x36e374){if(_0x36e374[_0x32ef('0x2c')]!=='VIRTUAL'){var _0x365125={};_0x365125[_0x36e374[_0x32ef('0x27')]]={'$like':'%'+_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]+'%'};return _0x365125;}})});}_0x5a04cd=_[_0x32ef('0x3b')]({},_0x5a04cd,_0xd65fde[_0x32ef('0x3c')]);var _0x256c40={'where':_0x5a04cd[_0x32ef('0x38')]};return db[_0x32ef('0x3d')][_0x32ef('0x1e')](_0x256c40)[_0x32ef('0x3e')](function(_0x4615b4){_0x3c569d['count']=_0x4615b4;if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5a04cd[_0x32ef('0x40')]=[{'all':!![]}];}return db[_0x32ef('0x3d')][_0x32ef('0x41')](_0x5a04cd);})[_0x32ef('0x3e')](function(_0x3c0e44){_0x3c569d['rows']=_0x3c0e44;return _0x3c569d;})['then'](respondWithFilteredResult(_0x2f5d06,_0x5a04cd))[_0x32ef('0x42')](handleError(_0x2f5d06,null));};exports[_0x32ef('0x43')]=function(_0x2a33dd,_0x765c63){var _0x5dca14={'raw':!![],'where':{'id':_0x2a33dd[_0x32ef('0x44')]['id']}},_0x2901a1={};_0x2901a1['model']=_[_0x32ef('0x45')](db['CmHopperFinal'][_0x32ef('0x2a')]);_0x2901a1[_0x32ef('0x2f')]=_[_0x32ef('0x45')](_0x2a33dd[_0x32ef('0x2f')]);_0x2901a1[_0x32ef('0x30')]=_[_0x32ef('0x32')](_0x2901a1[_0x32ef('0x2e')],_0x2901a1[_0x32ef('0x2f')]);_0x5dca14[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x2901a1['model'],qs[_0x32ef('0x33')](_0x2a33dd['query'][_0x32ef('0x33')]));_0x5dca14[_0x32ef('0x31')]=_0x5dca14[_0x32ef('0x31')]['length']?_0x5dca14[_0x32ef('0x31')]:_0x2901a1[_0x32ef('0x2e')];if(_0x2a33dd[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5dca14[_0x32ef('0x40')]=[{'all':!![]}];}_0x5dca14=_[_0x32ef('0x3b')]({},_0x5dca14,_0x2a33dd[_0x32ef('0x3c')]);return db['CmHopperFinal']['find'](_0x5dca14)[_0x32ef('0x3e')](handleEntityNotFound(_0x765c63,null))[_0x32ef('0x3e')](respondWithResult(_0x765c63,null))[_0x32ef('0x42')](handleError(_0x765c63,null));};exports[_0x32ef('0x46')]=function(_0x209361,_0xd67dc9){return db[_0x32ef('0x3d')][_0x32ef('0x46')]()[_0x32ef('0x3e')](respondWithResult(_0xd67dc9,null))[_0x32ef('0x42')](handleError(_0xd67dc9,null));};exports[_0x32ef('0x24')]=function(_0x30ad49,_0x36a65c){if(_0x30ad49['body'][_0x32ef('0x47')]){delete _0x30ad49[_0x32ef('0x48')][_0x32ef('0x47')];}return db[_0x32ef('0x3d')][_0x32ef('0x49')]({'where':{'uniqueid':_0x30ad49[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x36a65c,null))[_0x32ef('0x3e')](saveUpdates(_0x30ad49[_0x32ef('0x48')],null))[_0x32ef('0x3e')](respondWithResult(_0x36a65c,null))[_0x32ef('0x42')](handleError(_0x36a65c,null));};exports[_0x32ef('0x4a')]=function(_0x272377,_0x326445,_0x307ac8){return db[_0x32ef('0x3d')][_0x32ef('0x41')]({'raw':![],'where':{'VoiceQueueId':_0x272377[_0x32ef('0x44')]['id']},'attributes':[[db['sequelize']['fn']('COUNT',db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')][_0x32ef('0x4c')](_0x32ef('0x4d')))),_0x32ef('0x4e')],[db[_0x32ef('0x4b')]['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')][_0x32ef('0x4c')](_0x32ef('0x50')))),'noAnswerContacts'],[db[_0x32ef('0x4b')]['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')][_0x32ef('0x4c')](_0x32ef('0x51')))),'busyContacts'],[db[_0x32ef('0x4b')]['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db['sequelize'][_0x32ef('0x4c')]('`state`\x20=\x208,\x201,\x20null'))),_0x32ef('0x52')],[db[_0x32ef('0x4b')]['fn']('COUNT',db[_0x32ef('0x4b')]['fn']('IF',db['sequelize'][_0x32ef('0x4c')](_0x32ef('0x53')))),_0x32ef('0x54')],[db[_0x32ef('0x4b')]['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x32ef('0x55')],[db['sequelize']['fn']('COUNT',db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')][_0x32ef('0x4c')](_0x32ef('0x56')))),_0x32ef('0x57')],[db[_0x32ef('0x4b')]['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')][_0x32ef('0x4c')]('`state`\x20=\x2019,\x201,\x20null'))),'answeringMachine']]})[_0x32ef('0x3e')](handleEntityNotFound(_0x326445,null))[_0x32ef('0x3e')](respondWithResult(_0x326445,null))['catch'](handleError(_0x326445,null));};exports[_0x32ef('0x58')]=function(_0x12e1ef,_0x2b5703,_0x49c245){return db[_0x32ef('0x3d')][_0x32ef('0x41')]({'raw':![],'where':{'CampaignId':_0x12e1ef[_0x32ef('0x44')]['id']},'attributes':[[db['sequelize']['fn']('COUNT',db[_0x32ef('0x4b')]['fn']('IF',db['sequelize'][_0x32ef('0x4c')]('`state`\x20=\x200,\x201,\x20null'))),'noSuchContacts'],[db[_0x32ef('0x4b')]['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db['sequelize'][_0x32ef('0x4c')](_0x32ef('0x50')))),_0x32ef('0x59')],[db['sequelize']['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db['sequelize']['literal'](_0x32ef('0x51')))),_0x32ef('0x5a')],[db[_0x32ef('0x4b')]['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')]['literal'](_0x32ef('0x5b')))),_0x32ef('0x52')],[db[_0x32ef('0x4b')]['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')][_0x32ef('0x4c')](_0x32ef('0x53')))),_0x32ef('0x54')],[db['sequelize']['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')][_0x32ef('0x4c')](_0x32ef('0x5c')))),'abandonedContacts'],[db['sequelize']['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')][_0x32ef('0x4c')](_0x32ef('0x56')))),'reCallContacts'],[db[_0x32ef('0x4b')]['fn']('COUNT',db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')]['literal']('`state`\x20=\x2019,\x201,\x20null'))),_0x32ef('0x5d')]]})[_0x32ef('0x3e')](handleEntityNotFound(_0x2b5703,null))[_0x32ef('0x3e')](respondWithResult(_0x2b5703,null))['catch'](handleError(_0x2b5703,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x3b4a8e,_0x5edd29,_0x7d2c3a){return db[_0x32ef('0x5e')]['find']({'where':{'id':_0x3b4a8e[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x5edd29,null))[_0x32ef('0x3e')](function(_0xd7a78){var _0x9df27c;if(_0xd7a78){_0x9df27c=squel[_0x32ef('0x5f')]()[_0x32ef('0x60')](_0x32ef('0x61'))[_0x32ef('0x62')]([_0x32ef('0x63'),_0x32ef('0x64'),_0x32ef('0x65'),'ListId','VoiceQueueId',_0x32ef('0x66'),_0x32ef('0x67')],squel['select']()[_0x32ef('0x68')]('ANY_VALUE(calleridnum)',_0x32ef('0x63'))[_0x32ef('0x68')](_0x32ef('0x69'),'scheduledAt')[_0x32ef('0x68')]('ANY_VALUE(ContactId)',_0x32ef('0x65'))[_0x32ef('0x68')]('ANY_VALUE(ListId)','ListId')[_0x32ef('0x68')]('ANY_VALUE(VoiceQueueId)',_0x32ef('0x6a'))['field'](_0x32ef('0x69'),_0x32ef('0x66'))[_0x32ef('0x68')]('NOW()','updatedAt')['from'](_0x32ef('0x6b'))['where'](_0x32ef('0x6c'),_0x3b4a8e[_0x32ef('0x44')]['id'][_0x32ef('0x6d')]())[_0x32ef('0x38')](_0x32ef('0x6e'),_0x3b4a8e[_0x32ef('0x48')]['state'][_0x32ef('0x6d')]())['where']('calleridnum\x20IS\x20NOT\x20NULL')[_0x32ef('0x38')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x32ef('0x6f')]()[_0x32ef('0x68')]('phone')[_0x32ef('0x70')](_0x32ef('0x61'))[_0x32ef('0x38')](_0x32ef('0x6c'),_0x3b4a8e[_0x32ef('0x44')]['id'][_0x32ef('0x6d')]()))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x32ef('0x6f')]()['field'](_0x32ef('0x71'))[_0x32ef('0x70')](_0x32ef('0x6b'))[_0x32ef('0x38')](_0x32ef('0x6c'),_0x3b4a8e[_0x32ef('0x44')]['id']['toString']())[_0x32ef('0x38')](_0x32ef('0x72')))[_0x32ef('0x73')](_0x32ef('0x65')))[_0x32ef('0x6d')]();return db['sequelize']['query'](_0x9df27c);}return[];})[_0x32ef('0x3e')](respondWithResult(_0x5edd29,null))[_0x32ef('0x42')](handleError(_0x5edd29,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x211fb1,_0x2e333d,_0x338578){return db[_0x32ef('0x74')][_0x32ef('0x49')]({'where':{'id':_0x211fb1[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x2e333d,null))[_0x32ef('0x3e')](function(_0x353641){var _0x54e65d;if(_0x353641){_0x54e65d=squel[_0x32ef('0x5f')]()[_0x32ef('0x60')]('cm_hopper')[_0x32ef('0x62')](['phone',_0x32ef('0x64'),'ContactId',_0x32ef('0x75'),_0x32ef('0x76'),_0x32ef('0x66'),_0x32ef('0x67')],squel['select']()[_0x32ef('0x68')](_0x32ef('0x77'),_0x32ef('0x63'))['field']('NOW()','scheduledAt')[_0x32ef('0x68')](_0x32ef('0x78'),_0x32ef('0x65'))[_0x32ef('0x68')](_0x32ef('0x79'),'ListId')[_0x32ef('0x68')]('ANY_VALUE(CampaignId)',_0x32ef('0x76'))[_0x32ef('0x68')](_0x32ef('0x69'),'createdAt')[_0x32ef('0x68')](_0x32ef('0x69'),_0x32ef('0x67'))[_0x32ef('0x70')](_0x32ef('0x6b'))['where'](_0x32ef('0x7a'),_0x211fb1['params']['id'][_0x32ef('0x6d')]())[_0x32ef('0x38')]('state\x20=\x20?',_0x211fb1['body'][_0x32ef('0x7b')][_0x32ef('0x6d')]())[_0x32ef('0x38')](_0x32ef('0x7c'))['where'](_0x32ef('0x7d'),squel['select']()['field'](_0x32ef('0x63'))['from'](_0x32ef('0x61'))[_0x32ef('0x38')](_0x32ef('0x7a'),_0x211fb1['params']['id']['toString']()))[_0x32ef('0x38')](_0x32ef('0x7d'),squel[_0x32ef('0x6f')]()[_0x32ef('0x68')](_0x32ef('0x71'))[_0x32ef('0x70')](_0x32ef('0x6b'))['where'](_0x32ef('0x7a'),_0x211fb1[_0x32ef('0x44')]['id'][_0x32ef('0x6d')]())[_0x32ef('0x38')]('state\x20=\x204'))['group'](_0x32ef('0x65')))['toString']();return db[_0x32ef('0x4b')][_0x32ef('0x2f')](_0x54e65d);}return[];})['then'](respondWithResult(_0x2e333d,null))['catch'](handleError(_0x2e333d,null));};exports['checkContactHopper']=function(_0x201675,_0x33f6c3,_0xa53375){return db[_0x32ef('0x7e')]['findOne']({'where':{'VoiceQueueId':_0x201675[_0x32ef('0x48')][_0x32ef('0x6a')],'CampaignId':_0x201675[_0x32ef('0x48')]['CampaignId'],'ContactId':_0x201675[_0x32ef('0x48')]['ContactId']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x33f6c3,null))[_0x32ef('0x3e')](function(_0x5f4890){if(_0x5f4890){return _0x5f4890;}return null;})['then'](respondWithResult(_0x33f6c3,null))[_0x32ef('0x42')](handleError(_0x33f6c3,null));}; \ No newline at end of file +var _0x6d38=['calleridnum\x20IS\x20NOT\x20NULL','CmHopper','findOne','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','save','update','then','stack','name','send','index','map','CmHopperFinal','rawAttributes','type','key','model','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','keys','filters','intersection','describe','catch','body','uniqueid','find','params','countContactsQueueCampaignHopperFinal','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','COUNT','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','busyContacts','`state`\x20=\x208,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','moveContactsQueueCampaignHopperFinal','insert','into','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(VoiceQueueId)','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','from','calleridnum\x20NOT\x20IN\x20(?)','state\x20=\x204','group','Campaign','cm_hopper','CampaignId','ANY_VALUE(ListId)','CampaignId\x20=\x20?','state'];(function(_0x105d2c,_0x901fb4){var _0x3df304=function(_0xc9ac4d){while(--_0xc9ac4d){_0x105d2c['push'](_0x105d2c['shift']());}};_0x3df304(++_0x901fb4);}(_0x6d38,0x1ef));var _0x86d3=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x6d38[_0x3e5086];return _0xfeb102;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x86d3('0x0'));var zipdir=require(_0x86d3('0x1'));var jsonpatch=require(_0x86d3('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x86d3('0x3'));var Mustache=require('mustache');var util=require(_0x86d3('0x4'));var path=require(_0x86d3('0x5'));var sox=require(_0x86d3('0x6'));var csv=require('to-csv');var ejs=require(_0x86d3('0x7'));var fs=require('fs');var fs_extra=require(_0x86d3('0x8'));var _=require(_0x86d3('0x9'));var squel=require(_0x86d3('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x86d3('0xb'));var toCsv=require(_0x86d3('0xc'));var querystring=require(_0x86d3('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x86d3('0xe'));var qs=require(_0x86d3('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x86d3('0x10'))(_0x86d3('0x11'));var utils=require('../../config/utils');var config=require(_0x86d3('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x86d3('0x13'))['db'];function respondWithStatusCode(_0x7d4d2e,_0x440a55){_0x440a55=_0x440a55||0xcc;return function(_0x26d64c){if(_0x26d64c){return _0x7d4d2e[_0x86d3('0x14')](_0x440a55);}return _0x7d4d2e[_0x86d3('0x15')](_0x440a55)[_0x86d3('0x16')]();};}function respondWithResult(_0x12ef4a,_0x5ce2ff){_0x5ce2ff=_0x5ce2ff||0xc8;return function(_0x1c1ba8){if(_0x1c1ba8){return _0x12ef4a[_0x86d3('0x15')](_0x5ce2ff)[_0x86d3('0x17')](_0x1c1ba8);}};}function respondWithFilteredResult(_0x207f6f,_0x1ea535){return function(_0x34fb3b){if(_0x34fb3b){var _0x1ff008=typeof _0x1ea535[_0x86d3('0x18')]==='undefined'&&typeof _0x1ea535[_0x86d3('0x19')]===_0x86d3('0x1a');var _0x431b3f=_0x34fb3b[_0x86d3('0x1b')];var _0x46feec=_0x1ff008?0x0:_0x1ea535[_0x86d3('0x18')];var _0x33e459=_0x1ff008?_0x34fb3b[_0x86d3('0x1b')]:_0x1ea535[_0x86d3('0x18')]+_0x1ea535['limit'];var _0x191ba5;if(_0x33e459>=_0x431b3f){_0x33e459=_0x431b3f;_0x191ba5=0xc8;}else{_0x191ba5=0xce;}_0x207f6f['status'](_0x191ba5);return _0x207f6f[_0x86d3('0x1c')]('Content-Range',_0x46feec+'-'+_0x33e459+'/'+_0x431b3f)['json'](_0x34fb3b);}return null;};}function patchUpdates(_0x41486a){return function(_0x1edb6d){try{jsonpatch[_0x86d3('0x1d')](_0x1edb6d,_0x41486a,!![]);}catch(_0x1720ae){return BPromise['reject'](_0x1720ae);}return _0x1edb6d[_0x86d3('0x1e')]();};}function saveUpdates(_0x55e1c3,_0x36e0fa){return function(_0x3fdf67){if(_0x3fdf67){return _0x3fdf67[_0x86d3('0x1f')](_0x55e1c3)['then'](function(_0x39d819){return _0x39d819;});}return null;};}function removeEntity(_0x72b3d4,_0x1fa4ac){return function(_0x4bf5b8){if(_0x4bf5b8){return _0x4bf5b8['destroy']()[_0x86d3('0x20')](function(){_0x72b3d4['status'](0xcc)[_0x86d3('0x16')]();});}};}function handleEntityNotFound(_0x1bea5e,_0x3dfecd){return function(_0x3c5fe4){if(!_0x3c5fe4){_0x1bea5e['sendStatus'](0x194);}return _0x3c5fe4;};}function handleError(_0x481077,_0x3359e4){_0x3359e4=_0x3359e4||0x1f4;return function(_0x611764){logger['error'](_0x611764[_0x86d3('0x21')]);if(_0x611764['name']){delete _0x611764[_0x86d3('0x22')];}_0x481077[_0x86d3('0x15')](_0x3359e4)[_0x86d3('0x23')](_0x611764);};}exports[_0x86d3('0x24')]=function(_0x11a6fd,_0x14c9ff){var _0x1f203e={},_0x35d708={},_0x303f13={'count':0x0,'rows':[]};var _0x44dacf=_[_0x86d3('0x25')](db[_0x86d3('0x26')][_0x86d3('0x27')],function(_0x28c25e){return{'name':_0x28c25e['fieldName'],'type':_0x28c25e[_0x86d3('0x28')][_0x86d3('0x29')]};});_0x35d708[_0x86d3('0x2a')]=_[_0x86d3('0x25')](_0x44dacf,_0x86d3('0x22'));_0x35d708[_0x86d3('0x2b')]=_['keys'](_0x11a6fd[_0x86d3('0x2b')]);_0x35d708['filters']=_['intersection'](_0x35d708[_0x86d3('0x2a')],_0x35d708[_0x86d3('0x2b')]);_0x1f203e[_0x86d3('0x2c')]=_['intersection'](_0x35d708[_0x86d3('0x2a')],qs[_0x86d3('0x2d')](_0x11a6fd['query'][_0x86d3('0x2d')]));_0x1f203e[_0x86d3('0x2c')]=_0x1f203e[_0x86d3('0x2c')][_0x86d3('0x2e')]?_0x1f203e[_0x86d3('0x2c')]:_0x35d708[_0x86d3('0x2a')];if(!_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x2f')]('nolimit')){_0x1f203e['limit']=qs['limit'](_0x11a6fd[_0x86d3('0x2b')]['limit']);_0x1f203e[_0x86d3('0x18')]=qs['offset'](_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x18')]);}_0x1f203e[_0x86d3('0x30')]=qs[_0x86d3('0x31')](_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x31')]);_0x1f203e[_0x86d3('0x32')]=qs['filters'](_[_0x86d3('0x33')](_0x11a6fd[_0x86d3('0x2b')],_0x35d708['filters']),_0x44dacf);if(_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x34')]){_0x1f203e[_0x86d3('0x32')]=_[_0x86d3('0x35')](_0x1f203e['where'],{'$or':_[_0x86d3('0x25')](_0x44dacf,function(_0x42ac0d){if(_0x42ac0d[_0x86d3('0x28')]!=='VIRTUAL'){var _0x5762ca={};_0x5762ca[_0x42ac0d[_0x86d3('0x22')]]={'$like':'%'+_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x34')]+'%'};return _0x5762ca;}})});}_0x1f203e=_[_0x86d3('0x35')]({},_0x1f203e,_0x11a6fd[_0x86d3('0x36')]);var _0x3666fc={'where':_0x1f203e[_0x86d3('0x32')]};return db['CmHopperFinal'][_0x86d3('0x1b')](_0x3666fc)[_0x86d3('0x20')](function(_0x2bdc67){_0x303f13[_0x86d3('0x1b')]=_0x2bdc67;if(_0x11a6fd['query'][_0x86d3('0x37')]){_0x1f203e[_0x86d3('0x38')]=[{'all':!![]}];}return db[_0x86d3('0x26')][_0x86d3('0x39')](_0x1f203e);})['then'](function(_0x587747){_0x303f13[_0x86d3('0x3a')]=_0x587747;return _0x303f13;})['then'](respondWithFilteredResult(_0x14c9ff,_0x1f203e))['catch'](handleError(_0x14c9ff,null));};exports[_0x86d3('0x3b')]=function(_0x1385fc,_0x43490a){var _0x35d6fe={'raw':!![],'where':{'id':_0x1385fc['params']['id']}},_0x23ef72={};_0x23ef72[_0x86d3('0x2a')]=_[_0x86d3('0x3c')](db[_0x86d3('0x26')]['rawAttributes']);_0x23ef72[_0x86d3('0x2b')]=_[_0x86d3('0x3c')](_0x1385fc['query']);_0x23ef72[_0x86d3('0x3d')]=_[_0x86d3('0x3e')](_0x23ef72['model'],_0x23ef72['query']);_0x35d6fe['attributes']=_[_0x86d3('0x3e')](_0x23ef72[_0x86d3('0x2a')],qs[_0x86d3('0x2d')](_0x1385fc[_0x86d3('0x2b')][_0x86d3('0x2d')]));_0x35d6fe[_0x86d3('0x2c')]=_0x35d6fe['attributes'][_0x86d3('0x2e')]?_0x35d6fe[_0x86d3('0x2c')]:_0x23ef72['model'];if(_0x1385fc[_0x86d3('0x2b')][_0x86d3('0x37')]){_0x35d6fe[_0x86d3('0x38')]=[{'all':!![]}];}_0x35d6fe=_[_0x86d3('0x35')]({},_0x35d6fe,_0x1385fc[_0x86d3('0x36')]);return db[_0x86d3('0x26')]['find'](_0x35d6fe)[_0x86d3('0x20')](handleEntityNotFound(_0x43490a,null))[_0x86d3('0x20')](respondWithResult(_0x43490a,null))['catch'](handleError(_0x43490a,null));};exports[_0x86d3('0x3f')]=function(_0x412d0e,_0xd20863){return db[_0x86d3('0x26')][_0x86d3('0x3f')]()['then'](respondWithResult(_0xd20863,null))[_0x86d3('0x40')](handleError(_0xd20863,null));};exports[_0x86d3('0x1f')]=function(_0x3226b5,_0x14fa58){if(_0x3226b5[_0x86d3('0x41')][_0x86d3('0x42')]){delete _0x3226b5[_0x86d3('0x41')][_0x86d3('0x42')];}return db[_0x86d3('0x26')][_0x86d3('0x43')]({'where':{'uniqueid':_0x3226b5[_0x86d3('0x44')]['id']}})[_0x86d3('0x20')](handleEntityNotFound(_0x14fa58,null))['then'](saveUpdates(_0x3226b5[_0x86d3('0x41')],null))[_0x86d3('0x20')](respondWithResult(_0x14fa58,null))['catch'](handleError(_0x14fa58,null));};exports[_0x86d3('0x45')]=function(_0x23a6ee,_0x197047,_0x2e9af5){return db[_0x86d3('0x26')][_0x86d3('0x39')]({'raw':![],'where':{'VoiceQueueId':_0x23a6ee['params']['id']},'attributes':[[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x86d3('0x46')][_0x86d3('0x47')](_0x86d3('0x48')))),_0x86d3('0x49')],[db[_0x86d3('0x46')]['fn'](_0x86d3('0x4a'),db[_0x86d3('0x46')]['fn']('IF',db['sequelize'][_0x86d3('0x47')](_0x86d3('0x4b')))),_0x86d3('0x4c')],[db[_0x86d3('0x46')]['fn'](_0x86d3('0x4a'),db[_0x86d3('0x46')]['fn']('IF',db[_0x86d3('0x46')]['literal'](_0x86d3('0x4d')))),'busyContacts'],[db[_0x86d3('0x46')]['fn'](_0x86d3('0x4a'),db[_0x86d3('0x46')]['fn']('IF',db[_0x86d3('0x46')][_0x86d3('0x47')]('`state`\x20=\x208,\x201,\x20null'))),_0x86d3('0x4e')],[db[_0x86d3('0x46')]['fn'](_0x86d3('0x4a'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x86d3('0x4f')))),'dropContacts'],[db[_0x86d3('0x46')]['fn'](_0x86d3('0x4a'),db[_0x86d3('0x46')]['fn']('IF',db[_0x86d3('0x46')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),'abandonedContacts'],[db[_0x86d3('0x46')]['fn'](_0x86d3('0x4a'),db['sequelize']['fn']('IF',db[_0x86d3('0x46')][_0x86d3('0x47')](_0x86d3('0x50')))),_0x86d3('0x51')],[db[_0x86d3('0x46')]['fn']('COUNT',db[_0x86d3('0x46')]['fn']('IF',db[_0x86d3('0x46')][_0x86d3('0x47')](_0x86d3('0x52')))),'answeringMachine']]})[_0x86d3('0x20')](handleEntityNotFound(_0x197047,null))[_0x86d3('0x20')](respondWithResult(_0x197047,null))['catch'](handleError(_0x197047,null));};exports[_0x86d3('0x53')]=function(_0x416428,_0x15cdd0,_0x29bdee){return db[_0x86d3('0x26')][_0x86d3('0x39')]({'raw':![],'where':{'CampaignId':_0x416428[_0x86d3('0x44')]['id']},'attributes':[[db['sequelize']['fn']('COUNT',db[_0x86d3('0x46')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x200,\x201,\x20null'))),_0x86d3('0x49')],[db['sequelize']['fn'](_0x86d3('0x4a'),db['sequelize']['fn']('IF',db[_0x86d3('0x46')][_0x86d3('0x47')](_0x86d3('0x4b')))),'noAnswerContacts'],[db['sequelize']['fn'](_0x86d3('0x4a'),db[_0x86d3('0x46')]['fn']('IF',db[_0x86d3('0x46')][_0x86d3('0x47')](_0x86d3('0x4d')))),_0x86d3('0x54')],[db[_0x86d3('0x46')]['fn'](_0x86d3('0x4a'),db[_0x86d3('0x46')]['fn']('IF',db[_0x86d3('0x46')][_0x86d3('0x47')](_0x86d3('0x55')))),_0x86d3('0x4e')],[db[_0x86d3('0x46')]['fn'](_0x86d3('0x4a'),db[_0x86d3('0x46')]['fn']('IF',db[_0x86d3('0x46')][_0x86d3('0x47')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x86d3('0x56')],[db[_0x86d3('0x46')]['fn'](_0x86d3('0x4a'),db['sequelize']['fn']('IF',db[_0x86d3('0x46')][_0x86d3('0x47')](_0x86d3('0x57')))),_0x86d3('0x58')],[db['sequelize']['fn'](_0x86d3('0x4a'),db['sequelize']['fn']('IF',db[_0x86d3('0x46')][_0x86d3('0x47')](_0x86d3('0x50')))),_0x86d3('0x51')],[db[_0x86d3('0x46')]['fn']('COUNT',db[_0x86d3('0x46')]['fn']('IF',db['sequelize'][_0x86d3('0x47')](_0x86d3('0x52')))),'answeringMachine']]})[_0x86d3('0x20')](handleEntityNotFound(_0x15cdd0,null))[_0x86d3('0x20')](respondWithResult(_0x15cdd0,null))[_0x86d3('0x40')](handleError(_0x15cdd0,null));};exports[_0x86d3('0x59')]=function(_0x308fed,_0x1c966a,_0x379799){return db['VoiceQueue'][_0x86d3('0x43')]({'where':{'id':_0x308fed[_0x86d3('0x44')]['id']}})[_0x86d3('0x20')](handleEntityNotFound(_0x1c966a,null))[_0x86d3('0x20')](function(_0x46e356){var _0x47f72e;if(_0x46e356){_0x47f72e=squel[_0x86d3('0x5a')]()[_0x86d3('0x5b')]('cm_hopper')[_0x86d3('0x5c')]([_0x86d3('0x5d'),_0x86d3('0x5e'),_0x86d3('0x5f'),_0x86d3('0x60'),_0x86d3('0x61'),_0x86d3('0x62'),_0x86d3('0x63')],squel[_0x86d3('0x64')]()[_0x86d3('0x65')](_0x86d3('0x66'),_0x86d3('0x5d'))[_0x86d3('0x65')](_0x86d3('0x67'),'scheduledAt')[_0x86d3('0x65')](_0x86d3('0x68'),_0x86d3('0x5f'))[_0x86d3('0x65')]('ANY_VALUE(ListId)',_0x86d3('0x60'))[_0x86d3('0x65')](_0x86d3('0x69'),_0x86d3('0x61'))['field']('NOW()',_0x86d3('0x62'))['field'](_0x86d3('0x67'),'updatedAt')['from'](_0x86d3('0x6a'))[_0x86d3('0x32')](_0x86d3('0x6b'),_0x308fed[_0x86d3('0x44')]['id'][_0x86d3('0x6c')]())['where'](_0x86d3('0x6d'),_0x308fed[_0x86d3('0x41')]['state'][_0x86d3('0x6c')]())[_0x86d3('0x32')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x86d3('0x32')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x86d3('0x64')]()['field']('phone')[_0x86d3('0x6e')]('cm_hopper')[_0x86d3('0x32')](_0x86d3('0x6b'),_0x308fed[_0x86d3('0x44')]['id'][_0x86d3('0x6c')]()))[_0x86d3('0x32')](_0x86d3('0x6f'),squel[_0x86d3('0x64')]()[_0x86d3('0x65')]('calleridnum')[_0x86d3('0x6e')](_0x86d3('0x6a'))[_0x86d3('0x32')](_0x86d3('0x6b'),_0x308fed[_0x86d3('0x44')]['id']['toString']())[_0x86d3('0x32')](_0x86d3('0x70')))[_0x86d3('0x71')](_0x86d3('0x5f')))[_0x86d3('0x6c')]();return db[_0x86d3('0x46')][_0x86d3('0x2b')](_0x47f72e);}return[];})['then'](respondWithResult(_0x1c966a,null))[_0x86d3('0x40')](handleError(_0x1c966a,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0xca2e0,_0x596b1d,_0x5a22ca){return db[_0x86d3('0x72')][_0x86d3('0x43')]({'where':{'id':_0xca2e0['params']['id']}})[_0x86d3('0x20')](handleEntityNotFound(_0x596b1d,null))[_0x86d3('0x20')](function(_0x879a8b){var _0x1c1384;if(_0x879a8b){_0x1c1384=squel[_0x86d3('0x5a')]()[_0x86d3('0x5b')](_0x86d3('0x73'))['fromQuery'](['phone',_0x86d3('0x5e'),_0x86d3('0x5f'),_0x86d3('0x60'),_0x86d3('0x74'),_0x86d3('0x62'),_0x86d3('0x63')],squel['select']()[_0x86d3('0x65')](_0x86d3('0x66'),_0x86d3('0x5d'))[_0x86d3('0x65')](_0x86d3('0x67'),_0x86d3('0x5e'))[_0x86d3('0x65')](_0x86d3('0x68'),_0x86d3('0x5f'))['field'](_0x86d3('0x75'),_0x86d3('0x60'))['field']('ANY_VALUE(CampaignId)',_0x86d3('0x74'))[_0x86d3('0x65')](_0x86d3('0x67'),'createdAt')[_0x86d3('0x65')](_0x86d3('0x67'),_0x86d3('0x63'))[_0x86d3('0x6e')](_0x86d3('0x6a'))['where'](_0x86d3('0x76'),_0xca2e0[_0x86d3('0x44')]['id']['toString']())[_0x86d3('0x32')](_0x86d3('0x6d'),_0xca2e0[_0x86d3('0x41')][_0x86d3('0x77')]['toString']())[_0x86d3('0x32')](_0x86d3('0x78'))[_0x86d3('0x32')](_0x86d3('0x6f'),squel[_0x86d3('0x64')]()['field'](_0x86d3('0x5d'))[_0x86d3('0x6e')](_0x86d3('0x73'))[_0x86d3('0x32')](_0x86d3('0x76'),_0xca2e0[_0x86d3('0x44')]['id'][_0x86d3('0x6c')]()))[_0x86d3('0x32')](_0x86d3('0x6f'),squel[_0x86d3('0x64')]()['field']('calleridnum')[_0x86d3('0x6e')](_0x86d3('0x6a'))['where'](_0x86d3('0x76'),_0xca2e0[_0x86d3('0x44')]['id'][_0x86d3('0x6c')]())[_0x86d3('0x32')](_0x86d3('0x70')))[_0x86d3('0x71')](_0x86d3('0x5f')))[_0x86d3('0x6c')]();return db[_0x86d3('0x46')]['query'](_0x1c1384);}return[];})['then'](respondWithResult(_0x596b1d,null))['catch'](handleError(_0x596b1d,null));};exports['checkContactHopper']=function(_0xad83bf,_0x2514c1,_0x28a509){return db[_0x86d3('0x79')][_0x86d3('0x7a')]({'where':{'VoiceQueueId':_0xad83bf[_0x86d3('0x41')][_0x86d3('0x61')],'CampaignId':_0xad83bf['body'][_0x86d3('0x74')],'ContactId':_0xad83bf[_0x86d3('0x41')][_0x86d3('0x5f')]}})[_0x86d3('0x20')](handleEntityNotFound(_0x2514c1,null))['then'](function(_0xe239b5){if(_0xe239b5){return _0xe239b5;}return null;})['then'](respondWithResult(_0x2514c1,null))[_0x86d3('0x40')](handleError(_0x2514c1,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 3a1efb4..babb012 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 _0x8442=['util','../../config/logger','request-promise','rimraf','../../config/environment','exports','define','cm_hopper_final','calleridnum','uniqueid','lodash'];(function(_0x223aef,_0x166283){var _0x2c4b17=function(_0x385c10){while(--_0x385c10){_0x223aef['push'](_0x223aef['shift']());}};_0x2c4b17(++_0x166283);}(_0x8442,0xfc));var _0x2844=function(_0x4a5668,_0x14c9a7){_0x4a5668=_0x4a5668-0x0;var _0x5ce0b3=_0x8442[_0x4a5668];return _0x5ce0b3;};'use strict';var _=require(_0x2844('0x0'));var util=require(_0x2844('0x1'));var logger=require(_0x2844('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2844('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2844('0x4'));var config=require(_0x2844('0x5'));var attributes=require('./cmHopperFinal.attributes');module[_0x2844('0x6')]=function(_0x20c428,_0x16a73a){return _0x20c428[_0x2844('0x7')]('CmHopperFinal',attributes,{'tableName':_0x2844('0x8'),'paranoid':![],'indexes':[{'name':_0x2844('0x9'),'fields':[_0x2844('0x9')]},{'name':_0x2844('0xa'),'fields':[_0x2844('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x56ca=['exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','./cmHopperFinal.attributes'];(function(_0x594e11,_0x28f652){var _0x5418ad=function(_0x5dcfa7){while(--_0x5dcfa7){_0x594e11['push'](_0x594e11['shift']());}};_0x5418ad(++_0x28f652);}(_0x56ca,0x164));var _0xa56c=function(_0x15f3b3,_0x45b4bf){_0x15f3b3=_0x15f3b3-0x0;var _0x346fa8=_0x56ca[_0x15f3b3];return _0x346fa8;};'use strict';var _=require(_0xa56c('0x0'));var util=require(_0xa56c('0x1'));var logger=require(_0xa56c('0x2'))(_0xa56c('0x3'));var moment=require(_0xa56c('0x4'));var BPromise=require('bluebird');var rp=require(_0xa56c('0x5'));var fs=require('fs');var path=require(_0xa56c('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa56c('0x7'));module[_0xa56c('0x8')]=function(_0x36c0c2,_0x25acbe){return _0x36c0c2[_0xa56c('0x9')](_0xa56c('0xa'),attributes,{'tableName':_0xa56c('0xb'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0xa56c('0xc')]},{'name':'uniqueid','fields':[_0xa56c('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 4792c79..2aeb7f3 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(_0x355ccb,_0x28f17e){var _0x3085a4=function(_0x1e7cc0){while(--_0x1e7cc0){_0x355ccb['push'](_0x355ccb['shift']());}};_0x3085a4(++_0x28f17e);}(_0xb10b,0x12a));var _0xbb10=function(_0x3f807d,_0x32a3b1){_0x3f807d=_0x3f807d-0x0;var _0x45ad62=_0xb10b[_0x3f807d];return _0x45ad62;};'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 _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x2988bb,_0x4e4c36){var _0xc0046b=function(_0x48db26){while(--_0x48db26){_0x2988bb['push'](_0x2988bb['shift']());}};_0xc0046b(++_0x4e4c36);}(_0x7a54,0x106));var _0x47a5=function(_0x22b440,_0x51d358){_0x22b440=_0x22b440-0x0;var _0x1fd4fb=_0x7a54[_0x22b440];return _0x1fd4fb;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 5b16c4d..72ae035 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 _0x3e58=['../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','describe','/:id','countContactsQueueCampaignHopperFinal','countContactsIvrCampaignHopperFinal','post','/voice/campaign/moveContacts/:id','checkContactHopper','put','update','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x245a1b,_0x4ed794){var _0x2a9438=function(_0x45f077){while(--_0x45f077){_0x245a1b['push'](_0x245a1b['shift']());}};_0x2a9438(++_0x4ed794);}(_0x3e58,0x1dc));var _0x83e5=function(_0x5de214,_0x107e9d){_0x5de214=_0x5de214-0x0;var _0x4df627=_0x3e58[_0x5de214];return _0x4df627;};'use strict';var multer=require(_0x83e5('0x0'));var util=require(_0x83e5('0x1'));var path=require(_0x83e5('0x2'));var timeout=require('connect-timeout');var express=require(_0x83e5('0x3'));var router=express[_0x83e5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x83e5('0x5'));var interaction=require(_0x83e5('0x6'));var config=require(_0x83e5('0x7'));var controller=require(_0x83e5('0x8'));router[_0x83e5('0x9')]('/',auth[_0x83e5('0xa')](),controller['index']);router[_0x83e5('0x9')]('/describe',auth[_0x83e5('0xa')](),controller[_0x83e5('0xb')]);router[_0x83e5('0x9')](_0x83e5('0xc'),auth[_0x83e5('0xa')](),controller['show']);router[_0x83e5('0x9')]('/voice/queue/countAttributes/:id',auth['isAuthenticated'](),controller[_0x83e5('0xd')]);router[_0x83e5('0x9')]('/campaign/countAttributes/:id',auth['isAuthenticated'](),controller[_0x83e5('0xe')]);router[_0x83e5('0xf')]('/voice/queue/moveContacts/:id',auth[_0x83e5('0xa')](),controller['moveContactsQueueCampaignHopperFinal']);router[_0x83e5('0xf')](_0x83e5('0x10'),auth['isAuthenticated'](),controller['moveContactsIvrCampaignHopperFinal']);router['post']('/checkContactHopper',auth[_0x83e5('0xa')](),controller[_0x83e5('0x11')]);router[_0x83e5('0x12')]('/:id',auth[_0x83e5('0xa')](),controller[_0x83e5('0x13')]);module[_0x83e5('0x14')]=router; \ No newline at end of file +var _0x63d6=['show','/voice/queue/countAttributes/:id','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','update','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x1894fb,_0x221595){var _0x5ae526=function(_0x1bed91){while(--_0x1bed91){_0x1894fb['push'](_0x1894fb['shift']());}};_0x5ae526(++_0x221595);}(_0x63d6,0xae));var _0x663d=function(_0x51ca88,_0xba668){_0x51ca88=_0x51ca88-0x0;var _0x4bfd03=_0x63d6[_0x51ca88];return _0x4bfd03;};'use strict';var multer=require(_0x663d('0x0'));var util=require(_0x663d('0x1'));var path=require(_0x663d('0x2'));var timeout=require(_0x663d('0x3'));var express=require(_0x663d('0x4'));var router=express['Router']();var fs_extra=require(_0x663d('0x5'));var auth=require(_0x663d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x663d('0x7'));var controller=require(_0x663d('0x8'));router[_0x663d('0x9')]('/',auth[_0x663d('0xa')](),controller[_0x663d('0xb')]);router[_0x663d('0x9')](_0x663d('0xc'),auth['isAuthenticated'](),controller[_0x663d('0xd')]);router[_0x663d('0x9')](_0x663d('0xe'),auth[_0x663d('0xa')](),controller[_0x663d('0xf')]);router[_0x663d('0x9')](_0x663d('0x10'),auth[_0x663d('0xa')](),controller['countContactsQueueCampaignHopperFinal']);router['get'](_0x663d('0x11'),auth['isAuthenticated'](),controller[_0x663d('0x12')]);router[_0x663d('0x13')](_0x663d('0x14'),auth['isAuthenticated'](),controller['moveContactsQueueCampaignHopperFinal']);router[_0x663d('0x13')](_0x663d('0x15'),auth[_0x663d('0xa')](),controller[_0x663d('0x16')]);router[_0x663d('0x13')](_0x663d('0x17'),auth[_0x663d('0xa')](),controller[_0x663d('0x18')]);router[_0x663d('0x19')](_0x663d('0xe'),auth[_0x663d('0xa')](),controller[_0x663d('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 591db55..aea408d 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 _0x682b=['BOOLEAN','sequelize','exports','STRING','INTEGER','DATE'];(function(_0x322682,_0x343b96){var _0x239466=function(_0x4382a6){while(--_0x4382a6){_0x322682['push'](_0x322682['shift']());}};_0x239466(++_0x343b96);}(_0x682b,0x1e1));var _0xb682=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x682b[_0x36eaaa];return _0x461349;};'use strict';var Sequelize=require(_0xb682('0x0'));module[_0xb682('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xb682('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0xb682('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xb682('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xb682('0x2')]},'originatecalleridnum':{'type':Sequelize[_0xb682('0x2')]},'originatecalleridname':{'type':Sequelize[_0xb682('0x2')]},'calleridnum':{'type':Sequelize[_0xb682('0x2')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xb682('0x4')]},'responsetime':{'type':Sequelize[_0xb682('0x4')]},'answertime':{'type':Sequelize[_0xb682('0x4')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xb682('0x4')]},'ringtime':{'type':Sequelize[_0xb682('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xb682('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0xb682('0x2')]},'campaigntype':{'type':Sequelize[_0xb682('0x2')]},'membername':{'type':Sequelize[_0xb682('0x2')]},'reason':{'type':Sequelize[_0xb682('0x2')]},'amd':{'type':Sequelize[_0xb682('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0xb682('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0xb682('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xb682('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xb682('0x4')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0xb682('0x4')]},'edited':{'type':Sequelize[_0xb682('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xb682('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xb682('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xb682('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xb682('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xb682('0x3')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xb682('0x2')]}}; \ No newline at end of file +var _0x0966=['BOOLEAN','sequelize','exports','STRING','INTEGER','DATE'];(function(_0x568764,_0x2cd535){var _0x2245a4=function(_0x554be0){while(--_0x554be0){_0x568764['push'](_0x568764['shift']());}};_0x2245a4(++_0x2cd535);}(_0x0966,0x9d));var _0x6096=function(_0x33156b,_0x42aaef){_0x33156b=_0x33156b-0x0;var _0x14ea8a=_0x0966[_0x33156b];return _0x14ea8a;};'use strict';var Sequelize=require(_0x6096('0x0'));module[_0x6096('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x6096('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x6096('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x6096('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x6096('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x6096('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x6096('0x2')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x6096('0x2')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x6096('0x4')]},'responsetime':{'type':Sequelize[_0x6096('0x4')]},'answertime':{'type':Sequelize[_0x6096('0x4')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x6096('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x6096('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x6096('0x2')]},'campaign':{'type':Sequelize[_0x6096('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0x6096('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x6096('0x5')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x6096('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x6096('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x6096('0x4')]},'edited':{'type':Sequelize[_0x6096('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x6096('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x6096('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x6096('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x6096('0x3')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x6096('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 97b7eb7..4174902 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 _0xd280=['options','includeAll','include','findAll','rows','catch','params','rawAttributes','fields','length','find','create','body','describe','uniqueid','eml-format','zip-dir','fast-json-patch','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','end','error','index','map','CmHopperHistory','type','key','name','query','keys','filters','intersection','model','attributes','hasOwnProperty','sort','where','filter','merge','VIRTUAL'];(function(_0x27fe26,_0x3b8ca7){var _0x4fcb35=function(_0x35e0ae){while(--_0x35e0ae){_0x27fe26['push'](_0x27fe26['shift']());}};_0x4fcb35(++_0x3b8ca7);}(_0xd280,0xe4));var _0x0d28=function(_0x55decc,_0x112aa4){_0x55decc=_0x55decc-0x0;var _0x10ec8a=_0xd280[_0x55decc];return _0x10ec8a;};'use strict';var emlformat=require(_0x0d28('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0d28('0x1'));var jsonpatch=require(_0x0d28('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0d28('0x3'));var Mustache=require(_0x0d28('0x4'));var util=require('util');var path=require(_0x0d28('0x5'));var sox=require('sox');var csv=require(_0x0d28('0x6'));var ejs=require(_0x0d28('0x7'));var fs=require('fs');var fs_extra=require(_0x0d28('0x8'));var _=require(_0x0d28('0x9'));var squel=require('squel');var crypto=require(_0x0d28('0xa'));var jsforce=require(_0x0d28('0xb'));var deskjs=require(_0x0d28('0xc'));var toCsv=require(_0x0d28('0x6'));var querystring=require('querystring');var Papa=require(_0x0d28('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0d28('0xe'));var as=require(_0x0d28('0xf'));var hardwareService=require(_0x0d28('0x10'));var logger=require(_0x0d28('0x11'))('api');var utils=require(_0x0d28('0x12'));var config=require(_0x0d28('0x13'));var licenseUtil=require(_0x0d28('0x14'));var db=require(_0x0d28('0x15'))['db'];function respondWithStatusCode(_0x489cb1,_0x5636e5){_0x5636e5=_0x5636e5||0xcc;return function(_0x1dc505){if(_0x1dc505){return _0x489cb1[_0x0d28('0x16')](_0x5636e5);}return _0x489cb1[_0x0d28('0x17')](_0x5636e5)['end']();};}function respondWithResult(_0x371ad8,_0x5af013){_0x5af013=_0x5af013||0xc8;return function(_0x4e84fd){if(_0x4e84fd){return _0x371ad8[_0x0d28('0x17')](_0x5af013)[_0x0d28('0x18')](_0x4e84fd);}};}function respondWithFilteredResult(_0x552dc4,_0x29b543){return function(_0x50c37a){if(_0x50c37a){var _0xe4fe59=typeof _0x29b543['offset']===_0x0d28('0x19')&&typeof _0x29b543['limit']===_0x0d28('0x19');var _0x2dcc02=_0x50c37a[_0x0d28('0x1a')];var _0x44b827=_0xe4fe59?0x0:_0x29b543['offset'];var _0x22aec8=_0xe4fe59?_0x50c37a['count']:_0x29b543[_0x0d28('0x1b')]+_0x29b543[_0x0d28('0x1c')];var _0xe5c17d;if(_0x22aec8>=_0x2dcc02){_0x22aec8=_0x2dcc02;_0xe5c17d=0xc8;}else{_0xe5c17d=0xce;}_0x552dc4[_0x0d28('0x17')](_0xe5c17d);return _0x552dc4[_0x0d28('0x1d')](_0x0d28('0x1e'),_0x44b827+'-'+_0x22aec8+'/'+_0x2dcc02)[_0x0d28('0x18')](_0x50c37a);}return null;};}function patchUpdates(_0x12704c){return function(_0xfd9a26){try{jsonpatch[_0x0d28('0x1f')](_0xfd9a26,_0x12704c,!![]);}catch(_0x2f9d8c){return BPromise[_0x0d28('0x20')](_0x2f9d8c);}return _0xfd9a26[_0x0d28('0x21')]();};}function saveUpdates(_0x4b48a6,_0x3ed5ab){return function(_0x498dd2){if(_0x498dd2){return _0x498dd2['update'](_0x4b48a6)[_0x0d28('0x22')](function(_0x2fd9a1){return _0x2fd9a1;});}return null;};}function removeEntity(_0x158d46,_0x4e9d50){return function(_0x1353f2){if(_0x1353f2){return _0x1353f2[_0x0d28('0x23')]()[_0x0d28('0x22')](function(){_0x158d46[_0x0d28('0x17')](0xcc)[_0x0d28('0x24')]();});}};}function handleEntityNotFound(_0x4daf99,_0x17f340){return function(_0x507709){if(!_0x507709){_0x4daf99[_0x0d28('0x16')](0x194);}return _0x507709;};}function handleError(_0x3a2029,_0x3b6eeb){_0x3b6eeb=_0x3b6eeb||0x1f4;return function(_0x33cf7e){logger[_0x0d28('0x25')](_0x33cf7e['stack']);if(_0x33cf7e['name']){delete _0x33cf7e['name'];}_0x3a2029['status'](_0x3b6eeb)['send'](_0x33cf7e);};}exports[_0x0d28('0x26')]=function(_0x60563f,_0x575e1c){var _0x438b48={},_0x2863fa={},_0x2fa3a4={'count':0x0,'rows':[]};var _0x5a9a72=_[_0x0d28('0x27')](db[_0x0d28('0x28')]['rawAttributes'],function(_0x123ab5){return{'name':_0x123ab5['fieldName'],'type':_0x123ab5[_0x0d28('0x29')][_0x0d28('0x2a')]};});_0x2863fa['model']=_[_0x0d28('0x27')](_0x5a9a72,_0x0d28('0x2b'));_0x2863fa[_0x0d28('0x2c')]=_[_0x0d28('0x2d')](_0x60563f['query']);_0x2863fa[_0x0d28('0x2e')]=_[_0x0d28('0x2f')](_0x2863fa[_0x0d28('0x30')],_0x2863fa[_0x0d28('0x2c')]);_0x438b48[_0x0d28('0x31')]=_[_0x0d28('0x2f')](_0x2863fa[_0x0d28('0x30')],qs['fields'](_0x60563f[_0x0d28('0x2c')]['fields']));_0x438b48[_0x0d28('0x31')]=_0x438b48[_0x0d28('0x31')]['length']?_0x438b48['attributes']:_0x2863fa[_0x0d28('0x30')];if(!_0x60563f[_0x0d28('0x2c')][_0x0d28('0x32')]('nolimit')){_0x438b48[_0x0d28('0x1c')]=qs[_0x0d28('0x1c')](_0x60563f['query'][_0x0d28('0x1c')]);_0x438b48['offset']=qs[_0x0d28('0x1b')](_0x60563f[_0x0d28('0x2c')][_0x0d28('0x1b')]);}_0x438b48['order']=qs['sort'](_0x60563f[_0x0d28('0x2c')][_0x0d28('0x33')]);_0x438b48[_0x0d28('0x34')]=qs[_0x0d28('0x2e')](_['pick'](_0x60563f[_0x0d28('0x2c')],_0x2863fa[_0x0d28('0x2e')]),_0x5a9a72);if(_0x60563f['query'][_0x0d28('0x35')]){_0x438b48[_0x0d28('0x34')]=_[_0x0d28('0x36')](_0x438b48[_0x0d28('0x34')],{'$or':_[_0x0d28('0x27')](_0x5a9a72,function(_0x3d12b3){if(_0x3d12b3[_0x0d28('0x29')]!==_0x0d28('0x37')){var _0x5beafb={};_0x5beafb[_0x3d12b3[_0x0d28('0x2b')]]={'$like':'%'+_0x60563f[_0x0d28('0x2c')][_0x0d28('0x35')]+'%'};return _0x5beafb;}})});}_0x438b48=_[_0x0d28('0x36')]({},_0x438b48,_0x60563f[_0x0d28('0x38')]);var _0x1dc0a6={'where':_0x438b48[_0x0d28('0x34')]};return db['CmHopperHistory'][_0x0d28('0x1a')](_0x1dc0a6)[_0x0d28('0x22')](function(_0x4e8661){_0x2fa3a4['count']=_0x4e8661;if(_0x60563f[_0x0d28('0x2c')][_0x0d28('0x39')]){_0x438b48[_0x0d28('0x3a')]=[{'all':!![]}];}return db[_0x0d28('0x28')][_0x0d28('0x3b')](_0x438b48);})[_0x0d28('0x22')](function(_0x39d97b){_0x2fa3a4[_0x0d28('0x3c')]=_0x39d97b;return _0x2fa3a4;})[_0x0d28('0x22')](respondWithFilteredResult(_0x575e1c,_0x438b48))[_0x0d28('0x3d')](handleError(_0x575e1c,null));};exports['show']=function(_0x2dc644,_0x1df728){var _0x574e91={'raw':!![],'where':{'id':_0x2dc644[_0x0d28('0x3e')]['id']}},_0x2eb494={};_0x2eb494['model']=_['keys'](db[_0x0d28('0x28')][_0x0d28('0x3f')]);_0x2eb494['query']=_[_0x0d28('0x2d')](_0x2dc644[_0x0d28('0x2c')]);_0x2eb494[_0x0d28('0x2e')]=_[_0x0d28('0x2f')](_0x2eb494[_0x0d28('0x30')],_0x2eb494['query']);_0x574e91[_0x0d28('0x31')]=_[_0x0d28('0x2f')](_0x2eb494[_0x0d28('0x30')],qs['fields'](_0x2dc644['query'][_0x0d28('0x40')]));_0x574e91['attributes']=_0x574e91[_0x0d28('0x31')][_0x0d28('0x41')]?_0x574e91[_0x0d28('0x31')]:_0x2eb494[_0x0d28('0x30')];if(_0x2dc644[_0x0d28('0x2c')][_0x0d28('0x39')]){_0x574e91[_0x0d28('0x3a')]=[{'all':!![]}];}_0x574e91=_[_0x0d28('0x36')]({},_0x574e91,_0x2dc644[_0x0d28('0x38')]);return db['CmHopperHistory'][_0x0d28('0x42')](_0x574e91)[_0x0d28('0x22')](handleEntityNotFound(_0x1df728,null))[_0x0d28('0x22')](respondWithResult(_0x1df728,null))[_0x0d28('0x3d')](handleError(_0x1df728,null));};exports[_0x0d28('0x43')]=function(_0x5c9f45,_0x32468f){return db[_0x0d28('0x28')]['create'](_0x5c9f45[_0x0d28('0x44')],{})[_0x0d28('0x22')](respondWithResult(_0x32468f,0xc9))[_0x0d28('0x3d')](handleError(_0x32468f,null));};exports[_0x0d28('0x45')]=function(_0x4fa9b4,_0x417937){return db[_0x0d28('0x28')]['describe']()[_0x0d28('0x22')](respondWithResult(_0x417937,null))[_0x0d28('0x3d')](handleError(_0x417937,null));};exports['update']=function(_0x3cd3f5,_0x385048){if(_0x3cd3f5['body'][_0x0d28('0x46')]){delete _0x3cd3f5[_0x0d28('0x44')][_0x0d28('0x46')];}return db['CmHopperHistory'][_0x0d28('0x42')]({'where':{'uniqueid':_0x3cd3f5[_0x0d28('0x3e')]['id']}})[_0x0d28('0x22')](handleEntityNotFound(_0x385048,null))[_0x0d28('0x22')](saveUpdates(_0x3cd3f5[_0x0d28('0x44')],null))[_0x0d28('0x22')](respondWithResult(_0x385048,null))[_0x0d28('0x3d')](handleError(_0x385048,null));}; \ No newline at end of file +var _0x41a5=['sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','end','error','stack','name','send','index','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','CmHopperHistory','then','findAll','params','keys','includeAll','include','find','create','body','catch','describe','uniqueid','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x85b8b0,_0x4acd53){var _0x4675e4=function(_0x452a8f){while(--_0x452a8f){_0x85b8b0['push'](_0x85b8b0['shift']());}};_0x4675e4(++_0x4acd53);}(_0x41a5,0x1c4));var _0x541a=function(_0x886b04,_0x4598b3){_0x886b04=_0x886b04-0x0;var _0x18e6c2=_0x41a5[_0x886b04];return _0x18e6c2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x541a('0x0'));var zipdir=require(_0x541a('0x1'));var jsonpatch=require(_0x541a('0x2'));var rp=require(_0x541a('0x3'));var moment=require(_0x541a('0x4'));var BPromise=require(_0x541a('0x5'));var Mustache=require(_0x541a('0x6'));var util=require('util');var path=require(_0x541a('0x7'));var sox=require(_0x541a('0x8'));var csv=require(_0x541a('0x9'));var ejs=require(_0x541a('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x541a('0xb'));var squel=require(_0x541a('0xc'));var crypto=require(_0x541a('0xd'));var jsforce=require(_0x541a('0xe'));var deskjs=require(_0x541a('0xf'));var toCsv=require(_0x541a('0x9'));var querystring=require(_0x541a('0x10'));var Papa=require(_0x541a('0x11'));var Redis=require(_0x541a('0x12'));var authService=require(_0x541a('0x13'));var qs=require(_0x541a('0x14'));var as=require(_0x541a('0x15'));var hardwareService=require(_0x541a('0x16'));var logger=require(_0x541a('0x17'))(_0x541a('0x18'));var utils=require('../../config/utils');var config=require(_0x541a('0x19'));var licenseUtil=require(_0x541a('0x1a'));var db=require(_0x541a('0x1b'))['db'];function respondWithStatusCode(_0xde04bd,_0x4b41e4){_0x4b41e4=_0x4b41e4||0xcc;return function(_0x2fc620){if(_0x2fc620){return _0xde04bd[_0x541a('0x1c')](_0x4b41e4);}return _0xde04bd[_0x541a('0x1d')](_0x4b41e4)['end']();};}function respondWithResult(_0x4a6aae,_0x277c1c){_0x277c1c=_0x277c1c||0xc8;return function(_0x133fbd){if(_0x133fbd){return _0x4a6aae[_0x541a('0x1d')](_0x277c1c)[_0x541a('0x1e')](_0x133fbd);}};}function respondWithFilteredResult(_0x9f1736,_0xf8a482){return function(_0x3d53f6){if(_0x3d53f6){var _0x5e97c5=typeof _0xf8a482[_0x541a('0x1f')]===_0x541a('0x20')&&typeof _0xf8a482['limit']==='undefined';var _0x5aaf44=_0x3d53f6[_0x541a('0x21')];var _0x41c0af=_0x5e97c5?0x0:_0xf8a482[_0x541a('0x1f')];var _0x230320=_0x5e97c5?_0x3d53f6['count']:_0xf8a482[_0x541a('0x1f')]+_0xf8a482[_0x541a('0x22')];var _0x56af4b;if(_0x230320>=_0x5aaf44){_0x230320=_0x5aaf44;_0x56af4b=0xc8;}else{_0x56af4b=0xce;}_0x9f1736[_0x541a('0x1d')](_0x56af4b);return _0x9f1736[_0x541a('0x23')](_0x541a('0x24'),_0x41c0af+'-'+_0x230320+'/'+_0x5aaf44)[_0x541a('0x1e')](_0x3d53f6);}return null;};}function patchUpdates(_0x3d7c54){return function(_0x441533){try{jsonpatch[_0x541a('0x25')](_0x441533,_0x3d7c54,!![]);}catch(_0x2b21ed){return BPromise[_0x541a('0x26')](_0x2b21ed);}return _0x441533[_0x541a('0x27')]();};}function saveUpdates(_0x1880e4,_0x31e16b){return function(_0x3d821b){if(_0x3d821b){return _0x3d821b[_0x541a('0x28')](_0x1880e4)['then'](function(_0x3839dd){return _0x3839dd;});}return null;};}function removeEntity(_0x5ad3f2,_0x52ff47){return function(_0x2c48e4){if(_0x2c48e4){return _0x2c48e4[_0x541a('0x29')]()['then'](function(){_0x5ad3f2['status'](0xcc)[_0x541a('0x2a')]();});}};}function handleEntityNotFound(_0x331790,_0xf35646){return function(_0x47aec8){if(!_0x47aec8){_0x331790['sendStatus'](0x194);}return _0x47aec8;};}function handleError(_0x468720,_0x4be253){_0x4be253=_0x4be253||0x1f4;return function(_0x5d2b18){logger[_0x541a('0x2b')](_0x5d2b18[_0x541a('0x2c')]);if(_0x5d2b18[_0x541a('0x2d')]){delete _0x5d2b18['name'];}_0x468720[_0x541a('0x1d')](_0x4be253)[_0x541a('0x2e')](_0x5d2b18);};}exports[_0x541a('0x2f')]=function(_0x5f4aa0,_0x3aa3f0){var _0x59281b={},_0x3ca187={},_0xb9bb73={'count':0x0,'rows':[]};var _0xde6759=_[_0x541a('0x30')](db['CmHopperHistory'][_0x541a('0x31')],function(_0x4462fe){return{'name':_0x4462fe['fieldName'],'type':_0x4462fe[_0x541a('0x32')][_0x541a('0x33')]};});_0x3ca187[_0x541a('0x34')]=_[_0x541a('0x30')](_0xde6759,_0x541a('0x2d'));_0x3ca187[_0x541a('0x35')]=_['keys'](_0x5f4aa0['query']);_0x3ca187[_0x541a('0x36')]=_[_0x541a('0x37')](_0x3ca187[_0x541a('0x34')],_0x3ca187[_0x541a('0x35')]);_0x59281b[_0x541a('0x38')]=_[_0x541a('0x37')](_0x3ca187['model'],qs[_0x541a('0x39')](_0x5f4aa0[_0x541a('0x35')][_0x541a('0x39')]));_0x59281b[_0x541a('0x38')]=_0x59281b['attributes'][_0x541a('0x3a')]?_0x59281b[_0x541a('0x38')]:_0x3ca187[_0x541a('0x34')];if(!_0x5f4aa0[_0x541a('0x35')]['hasOwnProperty'](_0x541a('0x3b'))){_0x59281b[_0x541a('0x22')]=qs['limit'](_0x5f4aa0[_0x541a('0x35')]['limit']);_0x59281b[_0x541a('0x1f')]=qs[_0x541a('0x1f')](_0x5f4aa0[_0x541a('0x35')][_0x541a('0x1f')]);}_0x59281b[_0x541a('0x3c')]=qs[_0x541a('0x3d')](_0x5f4aa0[_0x541a('0x35')]['sort']);_0x59281b[_0x541a('0x3e')]=qs[_0x541a('0x36')](_[_0x541a('0x3f')](_0x5f4aa0['query'],_0x3ca187[_0x541a('0x36')]),_0xde6759);if(_0x5f4aa0[_0x541a('0x35')][_0x541a('0x40')]){_0x59281b[_0x541a('0x3e')]=_[_0x541a('0x41')](_0x59281b['where'],{'$or':_[_0x541a('0x30')](_0xde6759,function(_0x268c7f){if(_0x268c7f['type']!==_0x541a('0x42')){var _0x13aa2b={};_0x13aa2b[_0x268c7f['name']]={'$like':'%'+_0x5f4aa0[_0x541a('0x35')][_0x541a('0x40')]+'%'};return _0x13aa2b;}})});}_0x59281b=_[_0x541a('0x41')]({},_0x59281b,_0x5f4aa0['options']);var _0x5411f4={'where':_0x59281b[_0x541a('0x3e')]};return db[_0x541a('0x43')]['count'](_0x5411f4)[_0x541a('0x44')](function(_0x29f754){_0xb9bb73['count']=_0x29f754;if(_0x5f4aa0[_0x541a('0x35')]['includeAll']){_0x59281b['include']=[{'all':!![]}];}return db[_0x541a('0x43')][_0x541a('0x45')](_0x59281b);})[_0x541a('0x44')](function(_0x261a16){_0xb9bb73['rows']=_0x261a16;return _0xb9bb73;})[_0x541a('0x44')](respondWithFilteredResult(_0x3aa3f0,_0x59281b))['catch'](handleError(_0x3aa3f0,null));};exports['show']=function(_0x16c881,_0x371ce4){var _0x5a0a21={'raw':!![],'where':{'id':_0x16c881[_0x541a('0x46')]['id']}},_0x59e474={};_0x59e474[_0x541a('0x34')]=_[_0x541a('0x47')](db[_0x541a('0x43')]['rawAttributes']);_0x59e474[_0x541a('0x35')]=_[_0x541a('0x47')](_0x16c881[_0x541a('0x35')]);_0x59e474[_0x541a('0x36')]=_[_0x541a('0x37')](_0x59e474[_0x541a('0x34')],_0x59e474[_0x541a('0x35')]);_0x5a0a21['attributes']=_[_0x541a('0x37')](_0x59e474[_0x541a('0x34')],qs[_0x541a('0x39')](_0x16c881['query'][_0x541a('0x39')]));_0x5a0a21[_0x541a('0x38')]=_0x5a0a21[_0x541a('0x38')][_0x541a('0x3a')]?_0x5a0a21[_0x541a('0x38')]:_0x59e474[_0x541a('0x34')];if(_0x16c881[_0x541a('0x35')][_0x541a('0x48')]){_0x5a0a21[_0x541a('0x49')]=[{'all':!![]}];}_0x5a0a21=_[_0x541a('0x41')]({},_0x5a0a21,_0x16c881['options']);return db[_0x541a('0x43')][_0x541a('0x4a')](_0x5a0a21)[_0x541a('0x44')](handleEntityNotFound(_0x371ce4,null))[_0x541a('0x44')](respondWithResult(_0x371ce4,null))['catch'](handleError(_0x371ce4,null));};exports[_0x541a('0x4b')]=function(_0x38d46b,_0x1b4a55){return db[_0x541a('0x43')]['create'](_0x38d46b[_0x541a('0x4c')],{})[_0x541a('0x44')](respondWithResult(_0x1b4a55,0xc9))[_0x541a('0x4d')](handleError(_0x1b4a55,null));};exports[_0x541a('0x4e')]=function(_0x1cff5b,_0x18d732){return db[_0x541a('0x43')][_0x541a('0x4e')]()[_0x541a('0x44')](respondWithResult(_0x18d732,null))['catch'](handleError(_0x18d732,null));};exports[_0x541a('0x28')]=function(_0x4a9a5b,_0x1540c0){if(_0x4a9a5b['body'][_0x541a('0x4f')]){delete _0x4a9a5b[_0x541a('0x4c')][_0x541a('0x4f')];}return db['CmHopperHistory'][_0x541a('0x4a')]({'where':{'uniqueid':_0x4a9a5b[_0x541a('0x46')]['id']}})[_0x541a('0x44')](handleEntityNotFound(_0x1540c0,null))[_0x541a('0x44')](saveUpdates(_0x4a9a5b[_0x541a('0x4c')],null))['then'](respondWithResult(_0x1540c0,null))[_0x541a('0x4d')](handleError(_0x1540c0,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index c3434da..bc7bfb4 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 _0xc113=['path','rimraf','./cmHopperHistory.attributes','exports','define','CmHopperHistory','endtime','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5037ab,_0x43209e){var _0x512adb=function(_0x261783){while(--_0x261783){_0x5037ab['push'](_0x5037ab['shift']());}};_0x512adb(++_0x43209e);}(_0xc113,0x1ab));var _0x3c11=function(_0x599f6b,_0x32d98e){_0x599f6b=_0x599f6b-0x0;var _0x42aaea=_0xc113[_0x599f6b];return _0x42aaea;};'use strict';var _=require(_0x3c11('0x0'));var util=require(_0x3c11('0x1'));var logger=require(_0x3c11('0x2'))(_0x3c11('0x3'));var moment=require(_0x3c11('0x4'));var BPromise=require(_0x3c11('0x5'));var rp=require(_0x3c11('0x6'));var fs=require('fs');var path=require(_0x3c11('0x7'));var rimraf=require(_0x3c11('0x8'));var config=require('../../config/environment');var attributes=require(_0x3c11('0x9'));module[_0x3c11('0xa')]=function(_0x595e66,_0x3dd753){return _0x595e66[_0x3c11('0xb')](_0x3c11('0xc'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0x3c11('0xd'),'fields':['endtime']},{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x23db=['util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash'];(function(_0x56773f,_0x7551bd){var _0x596e73=function(_0x15d824){while(--_0x15d824){_0x56773f['push'](_0x56773f['shift']());}};_0x596e73(++_0x7551bd);}(_0x23db,0x141));var _0xb23d=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x23db[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0xb23d('0x0'));var util=require(_0xb23d('0x1'));var logger=require(_0xb23d('0x2'))(_0xb23d('0x3'));var moment=require(_0xb23d('0x4'));var BPromise=require(_0xb23d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb23d('0x6'));var config=require(_0xb23d('0x7'));var attributes=require('./cmHopperHistory.attributes');module[_0xb23d('0x8')]=function(_0x3a2ba6,_0x105811){return _0x3a2ba6[_0xb23d('0x9')](_0xb23d('0xa'),attributes,{'tableName':_0xb23d('0xb'),'paranoid':![],'indexes':[{'name':_0xb23d('0xc'),'fields':[_0xb23d('0xc')]},{'name':_0xb23d('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 5d47970..2d30200 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 _0x5fbd=['where','COUNT','sequelize','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','raw','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundUnknownCallsDay','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundReCallsDay','campaign','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','col','ivrAnswerCallsDay','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','CmHopperHistory,\x20%s,\x20%s','message','result','catch','CmHopperHistory','create','options','then','CreateCmHopperHistory','AvgHandleTime','findAll'];(function(_0x19f061,_0x3f77a5){var _0x799486=function(_0x3243ae){while(--_0x3243ae){_0x19f061['push'](_0x19f061['shift']());}};_0x799486(++_0x3f77a5);}(_0x5fbd,0xea));var _0xd5fb=function(_0x24ccda,_0x1c3018){_0x24ccda=_0x24ccda-0x0;var _0x383213=_0x5fbd[_0x24ccda];return _0x383213;};'use strict';var _=require(_0xd5fb('0x0'));var util=require(_0xd5fb('0x1'));var moment=require(_0xd5fb('0x2'));var BPromise=require(_0xd5fb('0x3'));var rs=require(_0xd5fb('0x4'));var fs=require('fs');var Redis=require(_0xd5fb('0x5'));var db=require(_0xd5fb('0x6'))['db'];var utils=require(_0xd5fb('0x7'));var logger=require(_0xd5fb('0x8'))('rpc');var config=require(_0xd5fb('0x9'));var jayson=require(_0xd5fb('0xa'));var client=jayson[_0xd5fb('0xb')][_0xd5fb('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1f278d,_0x210c1c,_0x43c5d4){return new BPromise(function(_0x557a4d,_0x877a3f){return client['request'](_0x1f278d,_0x43c5d4)['then'](function(_0x57453b){logger[_0xd5fb('0xd')]('CmHopperHistory,\x20%s,\x20%s',_0x210c1c,_0xd5fb('0xe'));logger[_0xd5fb('0xf')](_0xd5fb('0x10'),_0x210c1c,_0xd5fb('0xe'),JSON[_0xd5fb('0x11')](_0x57453b));if(_0x57453b[_0xd5fb('0x12')]){if(_0x57453b['error']['code']===0x1f4){logger[_0xd5fb('0x12')](_0xd5fb('0x13'),_0x210c1c,_0x57453b[_0xd5fb('0x12')]['message']);return _0x877a3f(_0x57453b[_0xd5fb('0x12')][_0xd5fb('0x14')]);}logger[_0xd5fb('0x12')]('CmHopperHistory,\x20%s,\x20%s',_0x210c1c,_0x57453b[_0xd5fb('0x12')]['message']);return _0x557a4d(_0x57453b['error']['message']);}else{logger[_0xd5fb('0xd')]('CmHopperHistory,\x20%s,\x20%s',_0x210c1c,_0xd5fb('0xe'));_0x557a4d(_0x57453b[_0xd5fb('0x15')]['message']);}})[_0xd5fb('0x16')](function(_0x5e5450){logger[_0xd5fb('0x12')](_0xd5fb('0x13'),_0x210c1c,_0x5e5450);_0x877a3f(_0x5e5450);});});}exports['CreateCmHopperHistory']=function(_0x5d7d1e){var _0x38b209=this;return new Promise(function(_0x10a655,_0x524a24){return db[_0xd5fb('0x17')][_0xd5fb('0x18')](_0x5d7d1e['body'],{'raw':_0x5d7d1e[_0xd5fb('0x19')]?_0x5d7d1e[_0xd5fb('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xd5fb('0x1a')](function(_0x4083b3){logger['info'](_0xd5fb('0x1b'),_0x5d7d1e);logger[_0xd5fb('0xf')]('CreateCmHopperHistory',_0x5d7d1e,JSON[_0xd5fb('0x11')](_0x4083b3));_0x10a655(_0x4083b3);})[_0xd5fb('0x16')](function(_0x51d417){logger[_0xd5fb('0x12')]('CreateCmHopperHistory',_0x51d417[_0xd5fb('0x14')],_0x5d7d1e);_0x524a24(_0x38b209['error'](0x1f4,_0x51d417[_0xd5fb('0x14')]));});});};exports[_0xd5fb('0x1c')]=function(_0x10926c){var _0x5a9e52=this;return new Promise(function(_0x3ad4fd,_0x3ef78d){return db[_0xd5fb('0x17')][_0xd5fb('0x1d')]({'raw':_0x10926c[_0xd5fb('0x19')]?_0x10926c[_0xd5fb('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x10926c[_0xd5fb('0x19')]?_0x10926c['options'][_0xd5fb('0x1e')]||null:null,'attributes':[[db['sequelize']['fn'](_0xd5fb('0x1f'),db[_0xd5fb('0x20')]['col']('id')),_0xd5fb('0x21')],[db[_0xd5fb('0x20')]['fn']('COUNT',db[_0xd5fb('0x20')]['fn']('IF',db[_0xd5fb('0x20')][_0xd5fb('0x22')](_0xd5fb('0x23')))),_0xd5fb('0x24')],[db[_0xd5fb('0x20')]['fn'](_0xd5fb('0x1f'),db[_0xd5fb('0x20')]['fn']('IF',db[_0xd5fb('0x20')][_0xd5fb('0x22')](_0xd5fb('0x25')))),_0xd5fb('0x26')],[db[_0xd5fb('0x20')]['fn'](_0xd5fb('0x1f'),db['sequelize']['fn']('IF',db[_0xd5fb('0x20')][_0xd5fb('0x22')]('`state`\x20=\x2011,\x201,\x20null'))),'predictiveIntervalDroppedCallsCallersExit'],[db['sequelize']['fn'](_0xd5fb('0x27'),db['sequelize']['fn']('IF',db['sequelize'][_0xd5fb('0x22')](_0xd5fb('0x28')))),_0xd5fb('0x29')],[db[_0xd5fb('0x20')]['fn'](_0xd5fb('0x27'),db['sequelize']['fn']('IF',db[_0xd5fb('0x20')][_0xd5fb('0x22')](_0xd5fb('0x2a')))),_0xd5fb('0x2b')]]})[_0xd5fb('0x1a')](function(_0x43f887){logger[_0xd5fb('0xd')](_0xd5fb('0x1c'),_0x10926c);logger[_0xd5fb('0xf')](_0xd5fb('0x1c'),_0x10926c,JSON['stringify'](_0x43f887));_0x3ad4fd(_0x43f887);})[_0xd5fb('0x16')](function(_0x22ff7d){logger['error'](_0xd5fb('0x1c'),_0x22ff7d['message'],_0x10926c);_0x3ef78d(_0x5a9e52[_0xd5fb('0x12')](0x1f4,_0x22ff7d[_0xd5fb('0x14')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x25db47){var _0x4cff2b=this;return new Promise(function(_0x1bca5c,_0x5144c6){return db['CmHopperHistory'][_0xd5fb('0x1d')]({'raw':_0x25db47[_0xd5fb('0x19')]?_0x25db47[_0xd5fb('0x19')][_0xd5fb('0x2c')]===undefined?!![]:![]:!![],'where':_0x25db47[_0xd5fb('0x19')]?_0x25db47[_0xd5fb('0x19')][_0xd5fb('0x1e')]||null:null,'attributes':[['campaign',_0xd5fb('0x2d')],[db['sequelize']['fn'](_0xd5fb('0x1f'),db[_0xd5fb('0x20')]['fn']('IF',db[_0xd5fb('0x20')][_0xd5fb('0x22')](_0xd5fb('0x2e')))),_0xd5fb('0x2f')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xd5fb('0x20')][_0xd5fb('0x22')]('`state`\x20=\x203,\x201,\x20null'))),_0xd5fb('0x30')],[db['sequelize']['fn']('COUNT',db[_0xd5fb('0x20')]['fn']('IF',db[_0xd5fb('0x20')]['literal'](_0xd5fb('0x23')))),_0xd5fb('0x31')],[db[_0xd5fb('0x20')]['fn'](_0xd5fb('0x1f'),db[_0xd5fb('0x20')]['fn']('IF',db[_0xd5fb('0x20')]['literal']('`state`\x20=\x205,\x201,\x20null'))),'outboundBusyCallsDay'],[db['sequelize']['fn'](_0xd5fb('0x1f'),db[_0xd5fb('0x20')]['fn']('IF',db['sequelize']['literal'](_0xd5fb('0x32')))),_0xd5fb('0x33')],[db[_0xd5fb('0x20')]['fn'](_0xd5fb('0x1f'),db[_0xd5fb('0x20')]['fn']('IF',db['sequelize'][_0xd5fb('0x22')](_0xd5fb('0x34')))),_0xd5fb('0x35')],[db['sequelize']['fn'](_0xd5fb('0x1f'),db[_0xd5fb('0x20')]['fn']('IF',db[_0xd5fb('0x20')][_0xd5fb('0x22')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xd5fb('0x36')],[db[_0xd5fb('0x20')]['fn'](_0xd5fb('0x1f'),db[_0xd5fb('0x20')]['fn']('IF',db[_0xd5fb('0x20')][_0xd5fb('0x22')]('`state`\x20=\x2012,\x201,\x20null'))),_0xd5fb('0x37')],[db[_0xd5fb('0x20')]['fn'](_0xd5fb('0x1f'),db[_0xd5fb('0x20')]['fn']('IF',db[_0xd5fb('0x20')]['literal']('`state`\x20=\x2013,\x201,\x20null'))),'outboundBlacklistCallsDay'],[db['sequelize']['fn'](_0xd5fb('0x1f'),db[_0xd5fb('0x20')]['fn']('IF',db[_0xd5fb('0x20')]['literal']('`state`\x20=\x2014,\x201,\x20null'))),'outboundOriginateFailureCallsDay'],[db['sequelize']['fn'](_0xd5fb('0x1f'),db[_0xd5fb('0x20')]['fn']('IF',db[_0xd5fb('0x20')][_0xd5fb('0x22')]('`state`\x20=\x2018,\x201,\x20null'))),_0xd5fb('0x38')],[db[_0xd5fb('0x20')]['fn'](_0xd5fb('0x1f'),db[_0xd5fb('0x20')]['fn']('IF',db['sequelize'][_0xd5fb('0x22')](_0xd5fb('0x39')))),_0xd5fb('0x3a')],[db[_0xd5fb('0x20')]['fn']('COUNT',db[_0xd5fb('0x20')]['fn']('IF',db['sequelize'][_0xd5fb('0x22')](_0xd5fb('0x3b')))),_0xd5fb('0x38')],[db[_0xd5fb('0x20')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xd5fb('0x22')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0xd5fb('0x3c')]],'group':[_0xd5fb('0x3d')]})['then'](function(_0x13cd7c){logger[_0xd5fb('0xd')](_0xd5fb('0x3e'),_0x25db47);logger[_0xd5fb('0xf')](_0xd5fb('0x3e'),_0x25db47,JSON[_0xd5fb('0x11')](_0x13cd7c));_0x1bca5c(_0x13cd7c);})[_0xd5fb('0x16')](function(_0x1e8d24){logger[_0xd5fb('0x12')](_0xd5fb('0x3e'),_0x1e8d24['message'],_0x25db47);_0x5144c6(_0x4cff2b[_0xd5fb('0x12')](0x1f4,_0x1e8d24[_0xd5fb('0x14')]));});});};exports[_0xd5fb('0x3f')]=function(_0x750c99){var _0x165114=this;return new Promise(function(_0x42155d,_0x38d77a){return db[_0xd5fb('0x17')]['findAll']({'raw':_0x750c99[_0xd5fb('0x19')]?_0x750c99[_0xd5fb('0x19')][_0xd5fb('0x2c')]===undefined?!![]:![]:!![],'where':_0x750c99[_0xd5fb('0x19')]?_0x750c99[_0xd5fb('0x19')][_0xd5fb('0x1e')]||null:null,'attributes':[['campaign',_0xd5fb('0x2d')],[db['sequelize']['fn']('COUNT',db['sequelize'][_0xd5fb('0x40')]('id')),'ivrTotalCallsDays'],[db[_0xd5fb('0x20')]['fn'](_0xd5fb('0x1f'),db[_0xd5fb('0x20')]['fn']('IF',db[_0xd5fb('0x20')]['literal']('`state`\x20=\x204,\x201,\x20null'))),_0xd5fb('0x41')]],'group':['campaign']})['then'](function(_0x1f4b57){logger[_0xd5fb('0xd')](_0xd5fb('0x3f'),_0x750c99);logger['debug'](_0xd5fb('0x3f'),_0x750c99,JSON['stringify'](_0x1f4b57));_0x42155d(_0x1f4b57);})[_0xd5fb('0x16')](function(_0x44e242){logger[_0xd5fb('0x12')](_0xd5fb('0x3f'),_0x44e242['message'],_0x750c99);_0x38d77a(_0x165114[_0xd5fb('0x12')](0x1f4,_0x44e242[_0xd5fb('0x14')]));});});}; \ No newline at end of file +var _0xde2c=['code','message','info','result','catch','CmHopperHistory','create','body','options','raw','stringify','CreateCmHopperHistory','AvgHandleTime','findAll','where','sequelize','col','predictiveIntervalTotalCalls','COUNT','literal','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','`state`\x20=\x204,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','outboundRejectCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','error'];(function(_0x16d130,_0x313337){var _0x3467a6=function(_0x3ebd6c){while(--_0x3ebd6c){_0x16d130['push'](_0x16d130['shift']());}};_0x3467a6(++_0x313337);}(_0xde2c,0x7f));var _0xcde2=function(_0x4849f6,_0x104836){_0x4849f6=_0x4849f6-0x0;var _0x1a3dcd=_0xde2c[_0x4849f6];return _0x1a3dcd;};'use strict';var _=require(_0xcde2('0x0'));var util=require(_0xcde2('0x1'));var moment=require(_0xcde2('0x2'));var BPromise=require(_0xcde2('0x3'));var rs=require(_0xcde2('0x4'));var fs=require('fs');var Redis=require(_0xcde2('0x5'));var db=require(_0xcde2('0x6'))['db'];var utils=require(_0xcde2('0x7'));var logger=require('../../config/logger')(_0xcde2('0x8'));var config=require(_0xcde2('0x9'));var jayson=require(_0xcde2('0xa'));var client=jayson[_0xcde2('0xb')][_0xcde2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x53c558,_0x2b27ef,_0x385e83){return new BPromise(function(_0x9c7036,_0x544235){return client['request'](_0x53c558,_0x385e83)[_0xcde2('0xd')](function(_0x1c8b3c){logger['info'](_0xcde2('0xe'),_0x2b27ef,_0xcde2('0xf'));logger[_0xcde2('0x10')](_0xcde2('0x11'),_0x2b27ef,'request\x20sent',JSON['stringify'](_0x1c8b3c));if(_0x1c8b3c[_0xcde2('0x12')]){if(_0x1c8b3c[_0xcde2('0x12')][_0xcde2('0x13')]===0x1f4){logger[_0xcde2('0x12')](_0xcde2('0xe'),_0x2b27ef,_0x1c8b3c[_0xcde2('0x12')]['message']);return _0x544235(_0x1c8b3c[_0xcde2('0x12')]['message']);}logger[_0xcde2('0x12')]('CmHopperHistory,\x20%s,\x20%s',_0x2b27ef,_0x1c8b3c['error'][_0xcde2('0x14')]);return _0x9c7036(_0x1c8b3c[_0xcde2('0x12')][_0xcde2('0x14')]);}else{logger[_0xcde2('0x15')](_0xcde2('0xe'),_0x2b27ef,'request\x20sent');_0x9c7036(_0x1c8b3c[_0xcde2('0x16')]['message']);}})[_0xcde2('0x17')](function(_0x198840){logger[_0xcde2('0x12')](_0xcde2('0xe'),_0x2b27ef,_0x198840);_0x544235(_0x198840);});});}exports['CreateCmHopperHistory']=function(_0x4fd5aa){var _0x4fe586=this;return new Promise(function(_0x2b4468,_0x582e84){return db[_0xcde2('0x18')][_0xcde2('0x19')](_0x4fd5aa[_0xcde2('0x1a')],{'raw':_0x4fd5aa['options']?_0x4fd5aa[_0xcde2('0x1b')][_0xcde2('0x1c')]===undefined?!![]:![]:!![]})[_0xcde2('0xd')](function(_0x3c1d7e){logger[_0xcde2('0x15')]('CreateCmHopperHistory',_0x4fd5aa);logger['debug']('CreateCmHopperHistory',_0x4fd5aa,JSON[_0xcde2('0x1d')](_0x3c1d7e));_0x2b4468(_0x3c1d7e);})[_0xcde2('0x17')](function(_0x2c9562){logger[_0xcde2('0x12')](_0xcde2('0x1e'),_0x2c9562['message'],_0x4fd5aa);_0x582e84(_0x4fe586[_0xcde2('0x12')](0x1f4,_0x2c9562['message']));});});};exports[_0xcde2('0x1f')]=function(_0xb2123c){var _0x26d18e=this;return new Promise(function(_0x48b598,_0x593aa4){return db[_0xcde2('0x18')][_0xcde2('0x20')]({'raw':_0xb2123c[_0xcde2('0x1b')]?_0xb2123c[_0xcde2('0x1b')][_0xcde2('0x1c')]===undefined?!![]:![]:!![],'where':_0xb2123c['options']?_0xb2123c[_0xcde2('0x1b')][_0xcde2('0x21')]||null:null,'attributes':[[db[_0xcde2('0x22')]['fn']('COUNT',db[_0xcde2('0x22')][_0xcde2('0x23')]('id')),_0xcde2('0x24')],[db[_0xcde2('0x22')]['fn'](_0xcde2('0x25'),db[_0xcde2('0x22')]['fn']('IF',db[_0xcde2('0x22')][_0xcde2('0x26')]('`state`\x20=\x204,\x201,\x20null'))),_0xcde2('0x27')],[db['sequelize']['fn'](_0xcde2('0x25'),db[_0xcde2('0x22')]['fn']('IF',db[_0xcde2('0x22')]['literal'](_0xcde2('0x28')))),_0xcde2('0x29')],[db['sequelize']['fn'](_0xcde2('0x25'),db[_0xcde2('0x22')]['fn']('IF',db[_0xcde2('0x22')][_0xcde2('0x26')](_0xcde2('0x2a')))),_0xcde2('0x2b')],[db[_0xcde2('0x22')]['fn'](_0xcde2('0x2c'),db['sequelize']['fn']('IF',db[_0xcde2('0x22')][_0xcde2('0x26')](_0xcde2('0x2d')))),_0xcde2('0x2e')],[db['sequelize']['fn'](_0xcde2('0x2c'),db[_0xcde2('0x22')]['fn']('IF',db[_0xcde2('0x22')][_0xcde2('0x26')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0xcde2('0x2f')]]})[_0xcde2('0xd')](function(_0x29e3e0){logger[_0xcde2('0x15')]('AvgHandleTime',_0xb2123c);logger[_0xcde2('0x10')](_0xcde2('0x1f'),_0xb2123c,JSON[_0xcde2('0x1d')](_0x29e3e0));_0x48b598(_0x29e3e0);})[_0xcde2('0x17')](function(_0x1646a6){logger['error'](_0xcde2('0x1f'),_0x1646a6[_0xcde2('0x14')],_0xb2123c);_0x593aa4(_0x26d18e[_0xcde2('0x12')](0x1f4,_0x1646a6[_0xcde2('0x14')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x542246){var _0x1fc8a6=this;return new Promise(function(_0x360247,_0x40e1e2){return db[_0xcde2('0x18')][_0xcde2('0x20')]({'raw':_0x542246[_0xcde2('0x1b')]?_0x542246[_0xcde2('0x1b')][_0xcde2('0x1c')]===undefined?!![]:![]:!![],'where':_0x542246[_0xcde2('0x1b')]?_0x542246['options'][_0xcde2('0x21')]||null:null,'attributes':[[_0xcde2('0x30'),_0xcde2('0x31')],[db[_0xcde2('0x22')]['fn'](_0xcde2('0x25'),db['sequelize']['fn']('IF',db['sequelize'][_0xcde2('0x26')](_0xcde2('0x32')))),_0xcde2('0x33')],[db[_0xcde2('0x22')]['fn'](_0xcde2('0x25'),db[_0xcde2('0x22')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x203,\x201,\x20null'))),_0xcde2('0x34')],[db[_0xcde2('0x22')]['fn'](_0xcde2('0x25'),db[_0xcde2('0x22')]['fn']('IF',db[_0xcde2('0x22')][_0xcde2('0x26')](_0xcde2('0x35')))),'outboundAnswerCallsDay'],[db['sequelize']['fn'](_0xcde2('0x25'),db['sequelize']['fn']('IF',db[_0xcde2('0x22')]['literal'](_0xcde2('0x36')))),_0xcde2('0x37')],[db[_0xcde2('0x22')]['fn']('COUNT',db[_0xcde2('0x22')]['fn']('IF',db['sequelize'][_0xcde2('0x26')](_0xcde2('0x38')))),_0xcde2('0x39')],[db[_0xcde2('0x22')]['fn'](_0xcde2('0x25'),db[_0xcde2('0x22')]['fn']('IF',db['sequelize']['literal'](_0xcde2('0x3a')))),'outboundDropCallsDayTimeout'],[db['sequelize']['fn'](_0xcde2('0x25'),db['sequelize']['fn']('IF',db[_0xcde2('0x22')][_0xcde2('0x26')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xcde2('0x3b')],[db['sequelize']['fn']('COUNT',db[_0xcde2('0x22')]['fn']('IF',db[_0xcde2('0x22')]['literal'](_0xcde2('0x3c')))),'outboundUnknownCallsDay'],[db[_0xcde2('0x22')]['fn'](_0xcde2('0x25'),db[_0xcde2('0x22')]['fn']('IF',db[_0xcde2('0x22')][_0xcde2('0x26')]('`state`\x20=\x2013,\x201,\x20null'))),_0xcde2('0x3d')],[db[_0xcde2('0x22')]['fn'](_0xcde2('0x25'),db[_0xcde2('0x22')]['fn']('IF',db['sequelize']['literal'](_0xcde2('0x3e')))),'outboundOriginateFailureCallsDay'],[db[_0xcde2('0x22')]['fn'](_0xcde2('0x25'),db[_0xcde2('0x22')]['fn']('IF',db[_0xcde2('0x22')][_0xcde2('0x26')](_0xcde2('0x3f')))),'outboundRejectCallsDay'],[db[_0xcde2('0x22')]['fn']('COUNT',db[_0xcde2('0x22')]['fn']('IF',db['sequelize'][_0xcde2('0x26')](_0xcde2('0x40')))),_0xcde2('0x41')],[db[_0xcde2('0x22')]['fn'](_0xcde2('0x25'),db[_0xcde2('0x22')]['fn']('IF',db['sequelize'][_0xcde2('0x26')]('`state`\x20=\x2020,\x201,\x20null'))),_0xcde2('0x42')],[db[_0xcde2('0x22')]['fn'](_0xcde2('0x25'),db[_0xcde2('0x22')]['fn']('IF',db[_0xcde2('0x22')][_0xcde2('0x26')](_0xcde2('0x43')))),_0xcde2('0x44')]],'group':[_0xcde2('0x30')]})[_0xcde2('0xd')](function(_0x3c5a17){logger[_0xcde2('0x15')]('GetVoiceQueueHopperHistory',_0x542246);logger['debug']('GetVoiceQueueHopperHistory',_0x542246,JSON[_0xcde2('0x1d')](_0x3c5a17));_0x360247(_0x3c5a17);})['catch'](function(_0x1751dd){logger[_0xcde2('0x12')](_0xcde2('0x45'),_0x1751dd['message'],_0x542246);_0x40e1e2(_0x1fc8a6[_0xcde2('0x12')](0x1f4,_0x1751dd['message']));});});};exports[_0xcde2('0x46')]=function(_0x5585a9){var _0x1085d2=this;return new Promise(function(_0x10d6ab,_0x50d2bf){return db[_0xcde2('0x18')]['findAll']({'raw':_0x5585a9['options']?_0x5585a9[_0xcde2('0x1b')][_0xcde2('0x1c')]===undefined?!![]:![]:!![],'where':_0x5585a9[_0xcde2('0x1b')]?_0x5585a9[_0xcde2('0x1b')][_0xcde2('0x21')]||null:null,'attributes':[[_0xcde2('0x30'),'name'],[db[_0xcde2('0x22')]['fn'](_0xcde2('0x25'),db[_0xcde2('0x22')][_0xcde2('0x23')]('id')),_0xcde2('0x47')],[db[_0xcde2('0x22')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xcde2('0x22')][_0xcde2('0x26')](_0xcde2('0x35')))),_0xcde2('0x48')]],'group':['campaign']})[_0xcde2('0xd')](function(_0x345210){logger[_0xcde2('0x15')](_0xcde2('0x46'),_0x5585a9);logger[_0xcde2('0x10')](_0xcde2('0x46'),_0x5585a9,JSON['stringify'](_0x345210));_0x10d6ab(_0x345210);})[_0xcde2('0x17')](function(_0x3b9e2d){logger['error'](_0xcde2('0x46'),_0x3b9e2d[_0xcde2('0x14')],_0x5585a9);_0x50d2bf(_0x1085d2[_0xcde2('0x12')](0x1f4,_0x3b9e2d[_0xcde2('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 64a90cb..046cc44 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 _0xe425=['create','put','update','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','describe','/:id','show'];(function(_0x288d38,_0x6e6623){var _0x25cb55=function(_0x316f1d){while(--_0x316f1d){_0x288d38['push'](_0x288d38['shift']());}};_0x25cb55(++_0x6e6623);}(_0xe425,0xbe));var _0x5e42=function(_0x27c201,_0xd947bf){_0x27c201=_0x27c201-0x0;var _0x3cabde=_0xe425[_0x27c201];return _0x3cabde;};'use strict';var multer=require('multer');var util=require(_0x5e42('0x0'));var path=require(_0x5e42('0x1'));var timeout=require('connect-timeout');var express=require(_0x5e42('0x2'));var router=express['Router']();var fs_extra=require(_0x5e42('0x3'));var auth=require(_0x5e42('0x4'));var interaction=require(_0x5e42('0x5'));var config=require(_0x5e42('0x6'));var controller=require(_0x5e42('0x7'));router[_0x5e42('0x8')]('/',auth[_0x5e42('0x9')](),controller[_0x5e42('0xa')]);router[_0x5e42('0x8')]('/describe',auth[_0x5e42('0x9')](),controller[_0x5e42('0xb')]);router[_0x5e42('0x8')](_0x5e42('0xc'),auth[_0x5e42('0x9')](),controller[_0x5e42('0xd')]);router['post']('/',auth[_0x5e42('0x9')](),controller[_0x5e42('0xe')]);router[_0x5e42('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x5e42('0x10')]);module['exports']=router; \ No newline at end of file +var _0xd677=['./cmHopperHistory.controller','get','isAuthenticated','index','describe','/:id','show','create','update','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xd677,0xac));var _0x7d67=function(_0x2aead8,_0x13bd4a){_0x2aead8=_0x2aead8-0x0;var _0x291f35=_0xd677[_0x2aead8];return _0x291f35;};'use strict';var multer=require(_0x7d67('0x0'));var util=require(_0x7d67('0x1'));var path=require('path');var timeout=require(_0x7d67('0x2'));var express=require(_0x7d67('0x3'));var router=express[_0x7d67('0x4')]();var fs_extra=require(_0x7d67('0x5'));var auth=require(_0x7d67('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7d67('0x7'));var controller=require(_0x7d67('0x8'));router[_0x7d67('0x9')]('/',auth[_0x7d67('0xa')](),controller[_0x7d67('0xb')]);router[_0x7d67('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x7d67('0xc')]);router[_0x7d67('0x9')](_0x7d67('0xd'),auth[_0x7d67('0xa')](),controller[_0x7d67('0xe')]);router['post']('/',auth[_0x7d67('0xa')](),controller[_0x7d67('0xf')]);router['put'](_0x7d67('0xd'),auth[_0x7d67('0xa')](),controller[_0x7d67('0x10')]);module[_0x7d67('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 1607418..4ad2841 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 _0x3de0=['STRING','name','sequelize'];(function(_0x3ce71c,_0x2dee52){var _0xa256a1=function(_0x564101){while(--_0x564101){_0x3ce71c['push'](_0x3ce71c['shift']());}};_0xa256a1(++_0x2dee52);}(_0x3de0,0x143));var _0x03de=function(_0x43cc94,_0x5e7f07){_0x43cc94=_0x43cc94-0x0;var _0x4da82e=_0x3de0[_0x43cc94];return _0x4da82e;};'use strict';var Sequelize=require(_0x03de('0x0'));module['exports']={'name':{'type':Sequelize[_0x03de('0x1')],'unique':_0x03de('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0x03de('0x1')]}}; \ No newline at end of file +var _0x1de4=['sequelize','exports','STRING','name'];(function(_0x4ec846,_0x2adf8d){var _0x59a9f5=function(_0x15043a){while(--_0x15043a){_0x4ec846['push'](_0x4ec846['shift']());}};_0x59a9f5(++_0x2adf8d);}(_0x1de4,0x94));var _0x41de=function(_0x2c0b5c,_0x2de2b0){_0x2c0b5c=_0x2c0b5c-0x0;var _0x331c54=_0x1de4[_0x2c0b5c];return _0x331c54;};'use strict';var Sequelize=require(_0x41de('0x0'));module[_0x41de('0x1')]={'name':{'type':Sequelize[_0x41de('0x2')],'unique':_0x41de('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0x41de('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 24e5799..b54d555 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 _0xdd52=['getContactsCsv','ContactItemType','OrderBy','alias','select','from','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','c.cf_','customField_','item','cm_contact_has_items','CmContactId\x20=\x20c.id','additionalPhone_','ItemTypeId\x20=\x20?','description_additionalPhone_','toString','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','addCustomField','findOne','sequelize','addCustomFields','text','Sequelize','TEXT','INTEGER','switch','defaultValue','queryInterface','addColumn','cm_contacts','cf_%s','getCustomFields','getGlobalCustomFields','findAndCountAll','addAgents','ids','spread','userCmList:save','removeAgents','emit','userCmList:remove','getAgents','User','info','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./cmList.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','then','destroy','get','Lists','UserProfileResource','name','send','index','CmList','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','map','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','addDisposition','ListId','getDispositions','nolimit','merge','Disposition','rows','removeDispositions','addContacts','CmContact','describe','tags','isArray','join','push','each','omit','success','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','format','cf_%d','raw'];(function(_0x3412e0,_0x5c4e4f){var _0x479b68=function(_0x23028d){while(--_0x23028d){_0x3412e0['push'](_0x3412e0['shift']());}};_0x479b68(++_0x5c4e4f);}(_0xdd52,0xe2));var _0x2dd5=function(_0x505f3d,_0x11dede){_0x505f3d=_0x505f3d-0x0;var _0x2de304=_0xdd52[_0x505f3d];return _0x2de304;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2dd5('0x0'));var rp=require(_0x2dd5('0x1'));var moment=require(_0x2dd5('0x2'));var BPromise=require(_0x2dd5('0x3'));var Mustache=require(_0x2dd5('0x4'));var util=require('util');var path=require(_0x2dd5('0x5'));var sox=require(_0x2dd5('0x6'));var csv=require(_0x2dd5('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2dd5('0x8'));var _=require(_0x2dd5('0x9'));var squel=require(_0x2dd5('0xa'));var crypto=require(_0x2dd5('0xb'));var jsforce=require(_0x2dd5('0xc'));var deskjs=require(_0x2dd5('0xd'));var toCsv=require(_0x2dd5('0x7'));var querystring=require(_0x2dd5('0xe'));var Papa=require(_0x2dd5('0xf'));var Redis=require(_0x2dd5('0x10'));var authService=require(_0x2dd5('0x11'));var qs=require(_0x2dd5('0x12'));var as=require(_0x2dd5('0x13'));var hardwareService=require(_0x2dd5('0x14'));var logger=require(_0x2dd5('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x2dd5('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x2dd5('0x17'))['db'];var csv_results;config['redis']=_[_0x2dd5('0x18')](config['redis'],{'host':_0x2dd5('0x19'),'port':0x18eb});var socket=require(_0x2dd5('0x1a'))(new Redis(config[_0x2dd5('0x1b')]));require(_0x2dd5('0x1c'))[_0x2dd5('0x1d')](socket);function respondWithStatusCode(_0x2600d3,_0x320ba6){_0x320ba6=_0x320ba6||0xcc;return function(_0x31828c){if(_0x31828c){return _0x2600d3[_0x2dd5('0x1e')](_0x320ba6);}return _0x2600d3[_0x2dd5('0x1f')](_0x320ba6)[_0x2dd5('0x20')]();};}function respondWithResult(_0x1106a8,_0x1a64b4){_0x1a64b4=_0x1a64b4||0xc8;return function(_0x51ade1){if(_0x51ade1){return _0x1106a8[_0x2dd5('0x1f')](_0x1a64b4)[_0x2dd5('0x21')](_0x51ade1);}};}function respondWithFilteredResult(_0x1bfc49,_0x39170a){return function(_0x2384d3){if(_0x2384d3){var _0x585f36=typeof _0x39170a[_0x2dd5('0x22')]===_0x2dd5('0x23')&&typeof _0x39170a['limit']==='undefined';var _0x3b4899=_0x2384d3[_0x2dd5('0x24')];var _0x4054c0=_0x585f36?0x0:_0x39170a[_0x2dd5('0x22')];var _0x25750e=_0x585f36?_0x2384d3['count']:_0x39170a[_0x2dd5('0x22')]+_0x39170a[_0x2dd5('0x25')];var _0x3b3c50;if(_0x25750e>=_0x3b4899){_0x25750e=_0x3b4899;_0x3b3c50=0xc8;}else{_0x3b3c50=0xce;}_0x1bfc49['status'](_0x3b3c50);return _0x1bfc49[_0x2dd5('0x26')](_0x2dd5('0x27'),_0x4054c0+'-'+_0x25750e+'/'+_0x3b4899)[_0x2dd5('0x21')](_0x2384d3);}return null;};}function patchUpdates(_0x1e6b06){return function(_0x11f1a7){try{jsonpatch['apply'](_0x11f1a7,_0x1e6b06,!![]);}catch(_0x469aa2){return BPromise[_0x2dd5('0x28')](_0x469aa2);}return _0x11f1a7[_0x2dd5('0x29')]();};}function saveUpdates(_0x431bf3,_0x180fa5){return function(_0x19b42b){if(_0x19b42b){return _0x19b42b['update'](_0x431bf3)[_0x2dd5('0x2a')](function(_0x13dc2c){return _0x13dc2c;});}return null;};}function removeEntity(_0x50d75d,_0x8bcc0){return function(_0x560cd2){if(_0x560cd2){return _0x560cd2[_0x2dd5('0x2b')]()[_0x2dd5('0x2a')](function(){var _0x1c191f=_0x560cd2[_0x2dd5('0x2c')]({'plain':!![]});var _0x5e2aad=_0x2dd5('0x2d');return db[_0x2dd5('0x2e')][_0x2dd5('0x2b')]({'where':{'type':_0x5e2aad,'resourceId':_0x1c191f['id']}})[_0x2dd5('0x2a')](function(){return _0x560cd2;});})[_0x2dd5('0x2a')](function(){_0x50d75d[_0x2dd5('0x1f')](0xcc)[_0x2dd5('0x20')]();});}};}function handleEntityNotFound(_0x367082,_0x2c864e){return function(_0x4b2c14){if(!_0x4b2c14){_0x367082['sendStatus'](0x194);}return _0x4b2c14;};}function handleError(_0x50094a,_0x354a28){_0x354a28=_0x354a28||0x1f4;return function(_0x3fe42b){logger['error'](_0x3fe42b['stack']);if(_0x3fe42b['name']){delete _0x3fe42b[_0x2dd5('0x2f')];}_0x50094a['status'](_0x354a28)[_0x2dd5('0x30')](_0x3fe42b);};}exports[_0x2dd5('0x31')]=function(_0x51af94,_0x569b78){var _0x34d604={},_0x306f6a={},_0x5d38ff={'count':0x0,'rows':[]};var _0x7c4bff=_['map'](db[_0x2dd5('0x32')][_0x2dd5('0x33')],function(_0x42bb86){return{'name':_0x42bb86[_0x2dd5('0x34')],'type':_0x42bb86[_0x2dd5('0x35')]['key']};});_0x306f6a[_0x2dd5('0x36')]=_['map'](_0x7c4bff,'name');_0x306f6a[_0x2dd5('0x37')]=_[_0x2dd5('0x38')](_0x51af94[_0x2dd5('0x37')]);_0x306f6a['filters']=_[_0x2dd5('0x39')](_0x306f6a['model'],_0x306f6a[_0x2dd5('0x37')]);_0x34d604['attributes']=_[_0x2dd5('0x39')](_0x306f6a[_0x2dd5('0x36')],qs[_0x2dd5('0x3a')](_0x51af94[_0x2dd5('0x37')][_0x2dd5('0x3a')]));_0x34d604[_0x2dd5('0x3b')]=_0x34d604[_0x2dd5('0x3b')][_0x2dd5('0x3c')]?_0x34d604['attributes']:_0x306f6a[_0x2dd5('0x36')];if(!_0x51af94[_0x2dd5('0x37')][_0x2dd5('0x3d')]('nolimit')){_0x34d604['limit']=qs[_0x2dd5('0x25')](_0x51af94[_0x2dd5('0x37')][_0x2dd5('0x25')]);_0x34d604['offset']=qs[_0x2dd5('0x22')](_0x51af94[_0x2dd5('0x37')][_0x2dd5('0x22')]);}_0x34d604[_0x2dd5('0x3e')]=qs[_0x2dd5('0x3f')](_0x51af94[_0x2dd5('0x37')][_0x2dd5('0x3f')]);_0x34d604[_0x2dd5('0x40')]=qs[_0x2dd5('0x41')](_[_0x2dd5('0x42')](_0x51af94['query'],_0x306f6a[_0x2dd5('0x41')]),_0x7c4bff);if(_0x51af94[_0x2dd5('0x37')]['filter']){_0x34d604[_0x2dd5('0x40')]=_['merge'](_0x34d604[_0x2dd5('0x40')],{'$or':_[_0x2dd5('0x43')](_0x7c4bff,function(_0x2f5ad6){if(_0x2f5ad6[_0x2dd5('0x35')]!==_0x2dd5('0x44')){var _0x4dcf6d={};_0x4dcf6d[_0x2f5ad6[_0x2dd5('0x2f')]]={'$like':'%'+_0x51af94[_0x2dd5('0x37')][_0x2dd5('0x45')]+'%'};return _0x4dcf6d;}})});}_0x34d604=_['merge']({},_0x34d604,_0x51af94[_0x2dd5('0x46')]);var _0x783879={'where':_0x34d604[_0x2dd5('0x40')]};return db[_0x2dd5('0x32')][_0x2dd5('0x24')](_0x783879)[_0x2dd5('0x2a')](function(_0x1ab3ad){_0x5d38ff[_0x2dd5('0x24')]=_0x1ab3ad;if(_0x51af94[_0x2dd5('0x37')][_0x2dd5('0x47')]){_0x34d604[_0x2dd5('0x48')]=[{'all':!![]}];}return db[_0x2dd5('0x32')][_0x2dd5('0x49')](_0x34d604);})[_0x2dd5('0x2a')](function(_0x25edd2){_0x5d38ff['rows']=_0x25edd2;return _0x5d38ff;})[_0x2dd5('0x2a')](respondWithFilteredResult(_0x569b78,_0x34d604))[_0x2dd5('0x4a')](handleError(_0x569b78,null));};exports[_0x2dd5('0x4b')]=function(_0x56420d,_0x6af0ca){var _0x431fad={'raw':![],'where':{'id':_0x56420d['params']['id']}},_0x5140d8={};_0x5140d8[_0x2dd5('0x36')]=_['keys'](db[_0x2dd5('0x32')]['rawAttributes']);_0x5140d8[_0x2dd5('0x37')]=_[_0x2dd5('0x38')](_0x56420d[_0x2dd5('0x37')]);_0x5140d8['filters']=_[_0x2dd5('0x39')](_0x5140d8[_0x2dd5('0x36')],_0x5140d8['query']);_0x431fad[_0x2dd5('0x3b')]=_[_0x2dd5('0x39')](_0x5140d8[_0x2dd5('0x36')],qs[_0x2dd5('0x3a')](_0x56420d[_0x2dd5('0x37')][_0x2dd5('0x3a')]));_0x431fad['attributes']=_0x431fad['attributes'][_0x2dd5('0x3c')]?_0x431fad[_0x2dd5('0x3b')]:_0x5140d8[_0x2dd5('0x36')];if(_0x56420d[_0x2dd5('0x37')][_0x2dd5('0x47')]){_0x431fad[_0x2dd5('0x48')]=[{'all':!![]}];}_0x431fad=_['merge']({},_0x431fad,_0x56420d['options']);return db['CmList'][_0x2dd5('0x4c')](_0x431fad)['then'](handleEntityNotFound(_0x6af0ca,null))[_0x2dd5('0x2a')](respondWithResult(_0x6af0ca,null))[_0x2dd5('0x4a')](handleError(_0x6af0ca,null));};exports[_0x2dd5('0x4d')]=function(_0xa9369b,_0x2ba5e9){return db[_0x2dd5('0x32')][_0x2dd5('0x4d')](_0xa9369b[_0x2dd5('0x4e')],{})['then'](function(_0xee1140){var _0x5ab91b=_0xa9369b[_0x2dd5('0x4f')]['get']({'plain':!![]});if(!_0x5ab91b)throw new Error(_0x2dd5('0x50'));if(_0x5ab91b['role']==='user'){var _0xbeea70=_0xee1140[_0x2dd5('0x2c')]({'plain':!![]});var _0x22f3e7='Lists';return db[_0x2dd5('0x51')][_0x2dd5('0x4c')]({'where':{'name':_0x22f3e7,'userProfileId':_0x5ab91b['userProfileId']},'raw':!![]})[_0x2dd5('0x2a')](function(_0x1aebd6){if(_0x1aebd6&&_0x1aebd6['autoAssociation']===0x0){return db[_0x2dd5('0x2e')][_0x2dd5('0x4d')]({'name':_0xbeea70[_0x2dd5('0x2f')],'resourceId':_0xbeea70['id'],'type':_0x1aebd6[_0x2dd5('0x2f')],'sectionId':_0x1aebd6['id']},{})[_0x2dd5('0x2a')](function(){return _0xee1140;});}else{return _0xee1140;}})[_0x2dd5('0x4a')](function(_0x2ad09b){logger[_0x2dd5('0x52')](_0x2dd5('0x53'),_0x2ad09b);throw _0x2ad09b;});}return _0xee1140;})[_0x2dd5('0x2a')](respondWithResult(_0x2ba5e9,0xc9))[_0x2dd5('0x4a')](handleError(_0x2ba5e9,null));};exports[_0x2dd5('0x54')]=function(_0x455c06,_0x4a87eb){if(_0x455c06[_0x2dd5('0x4e')]['id']){delete _0x455c06[_0x2dd5('0x4e')]['id'];}return db['CmList'][_0x2dd5('0x4c')]({'where':{'id':_0x455c06[_0x2dd5('0x55')]['id']}})[_0x2dd5('0x2a')](handleEntityNotFound(_0x4a87eb,null))[_0x2dd5('0x2a')](saveUpdates(_0x455c06['body'],null))[_0x2dd5('0x2a')](respondWithResult(_0x4a87eb,null))[_0x2dd5('0x4a')](handleError(_0x4a87eb,null));};exports[_0x2dd5('0x2b')]=function(_0x50fa0b,_0x18eac8){return db['CmList'][_0x2dd5('0x4c')]({'where':{'id':_0x50fa0b['params']['id']}})[_0x2dd5('0x2a')](handleEntityNotFound(_0x18eac8,null))[_0x2dd5('0x2a')](removeEntity(_0x18eac8,null))[_0x2dd5('0x4a')](handleError(_0x18eac8,null));};exports['describe']=function(_0x161a4e,_0x5a010b){return db[_0x2dd5('0x32')]['describe']()[_0x2dd5('0x2a')](respondWithResult(_0x5a010b,null))[_0x2dd5('0x4a')](handleError(_0x5a010b,null));};exports[_0x2dd5('0x56')]=function(_0x249945,_0x39b3ca,_0x530806){if(_0x249945[_0x2dd5('0x4e')]['id']){delete _0x249945[_0x2dd5('0x4e')]['id'];}return db[_0x2dd5('0x32')]['find']({'where':{'id':_0x249945[_0x2dd5('0x55')]['id']}})[_0x2dd5('0x2a')](handleEntityNotFound(_0x39b3ca,null))[_0x2dd5('0x2a')](function(_0x316156){if(_0x316156){_0x249945[_0x2dd5('0x4e')][_0x2dd5('0x57')]=_0x316156['id'];return db['Disposition'][_0x2dd5('0x4d')](_0x249945[_0x2dd5('0x4e')]);}})[_0x2dd5('0x2a')](respondWithResult(_0x39b3ca,null))['catch'](handleError(_0x39b3ca,null));};exports[_0x2dd5('0x58')]=function(_0x21823f,_0x2cfdc3,_0x1bf904){var _0x548008={'raw':![],'where':{}};var _0x4dc1c1={};var _0xd11648={'count':0x0,'rows':[]};return db[_0x2dd5('0x32')]['findOne']({'where':{'id':_0x21823f[_0x2dd5('0x55')]['id']}})[_0x2dd5('0x2a')](handleEntityNotFound(_0x2cfdc3,null))['then'](function(_0x402293){if(_0x402293){_0x4dc1c1[_0x2dd5('0x36')]=_[_0x2dd5('0x38')](db['Disposition'][_0x2dd5('0x33')]);_0x4dc1c1[_0x2dd5('0x37')]=_[_0x2dd5('0x38')](_0x21823f['query']);_0x4dc1c1[_0x2dd5('0x41')]=_[_0x2dd5('0x39')](_0x4dc1c1[_0x2dd5('0x36')],_0x4dc1c1['query']);_0x548008[_0x2dd5('0x3b')]=_[_0x2dd5('0x39')](_0x4dc1c1[_0x2dd5('0x36')],qs[_0x2dd5('0x3a')](_0x21823f[_0x2dd5('0x37')]['fields']));_0x548008[_0x2dd5('0x3b')]=_0x548008['attributes'][_0x2dd5('0x3c')]?_0x548008[_0x2dd5('0x3b')]:_0x4dc1c1['model'];if(!_0x21823f[_0x2dd5('0x37')][_0x2dd5('0x3d')](_0x2dd5('0x59'))){_0x548008[_0x2dd5('0x25')]=qs[_0x2dd5('0x25')](_0x21823f['query']['limit']);_0x548008[_0x2dd5('0x22')]=qs[_0x2dd5('0x22')](_0x21823f[_0x2dd5('0x37')][_0x2dd5('0x22')]);}_0x548008['order']=qs[_0x2dd5('0x3f')](_0x21823f['query']['sort']);_0x548008[_0x2dd5('0x40')]=qs['filters'](_[_0x2dd5('0x42')](_0x21823f[_0x2dd5('0x37')],_0x4dc1c1[_0x2dd5('0x41')]));_0x548008[_0x2dd5('0x40')][_0x2dd5('0x57')]=_0x402293['id'];if(_0x21823f[_0x2dd5('0x37')][_0x2dd5('0x45')]){_0x548008[_0x2dd5('0x40')]=_[_0x2dd5('0x5a')](_0x548008['where'],{'$or':_[_0x2dd5('0x43')](_0x548008[_0x2dd5('0x3b')],function(_0x386ee8){var _0x45d726={};_0x45d726[_0x386ee8]={'$like':'%'+_0x21823f['query'][_0x2dd5('0x45')]+'%'};return _0x45d726;})});}_0x548008=_['merge']({},_0x548008,_0x21823f[_0x2dd5('0x46')]);return db[_0x2dd5('0x5b')]['count']({'where':_0x548008[_0x2dd5('0x40')]})[_0x2dd5('0x2a')](function(_0x1e7e43){_0xd11648[_0x2dd5('0x24')]=_0x1e7e43;if(_0x21823f[_0x2dd5('0x37')][_0x2dd5('0x47')]){_0x548008[_0x2dd5('0x48')]=[{'all':!![]}];}return db[_0x2dd5('0x5b')][_0x2dd5('0x49')](_0x548008);})['then'](function(_0x1b1c56){_0xd11648[_0x2dd5('0x5c')]=_0x1b1c56;return _0xd11648;});}})['then'](respondWithFilteredResult(_0x2cfdc3,_0x548008))[_0x2dd5('0x4a')](handleError(_0x2cfdc3,null));};exports[_0x2dd5('0x5d')]=function(_0x30b6d7,_0x395f74,_0x252803){return db[_0x2dd5('0x32')][_0x2dd5('0x4c')]({'where':{'id':_0x30b6d7[_0x2dd5('0x55')]['id']}})[_0x2dd5('0x2a')](handleEntityNotFound(_0x395f74,null))['then'](function(_0x4ef20d){if(_0x4ef20d){return _0x4ef20d[_0x2dd5('0x5d')](_0x30b6d7[_0x2dd5('0x37')]['ids']);}})['then'](respondWithStatusCode(_0x395f74,null))[_0x2dd5('0x4a')](handleError(_0x395f74,null));};exports[_0x2dd5('0x5e')]=function(_0x1c97e0,_0x55ae51,_0x15d68e){return db[_0x2dd5('0x32')][_0x2dd5('0x4c')]({'where':{'id':_0x1c97e0[_0x2dd5('0x55')]['id']}})['then'](handleEntityNotFound(_0x55ae51,null))[_0x2dd5('0x2a')](function(_0x3c2d1c){if(_0x3c2d1c){var _0x268f49=[];var _0x1ebf89={'success':[],'errors':[]};return db[_0x2dd5('0x5f')][_0x2dd5('0x60')]()[_0x2dd5('0x2a')](function(_0x5d6275){if(_0x1c97e0[_0x2dd5('0x4e')][_0x2dd5('0x61')]&&_[_0x2dd5('0x62')](_0x1c97e0[_0x2dd5('0x4e')][_0x2dd5('0x61')])){if(_0x1c97e0[_0x2dd5('0x4e')]['tags'][_0x2dd5('0x3c')]){_0x1c97e0[_0x2dd5('0x4e')][_0x2dd5('0x61')]=_0x1c97e0['body'][_0x2dd5('0x61')][_0x2dd5('0x63')](';')+';';}else{_0x1c97e0[_0x2dd5('0x4e')][_0x2dd5('0x61')]=null;}}else{_0x1c97e0[_0x2dd5('0x4e')][_0x2dd5('0x61')]=null;}if(_0x1c97e0['body']&&_['isArray'](_0x1c97e0[_0x2dd5('0x4e')])){for(var _0x24b297=0x0;_0x24b297<_0x1c97e0['body'][_0x2dd5('0x3c')];_0x24b297+=0x1){_0x1c97e0['body'][_0x24b297]['ListId']=_0x1c97e0['params']['id'];_0x268f49[_0x2dd5('0x64')](_0x1c97e0[_0x2dd5('0x4e')][_0x24b297]);}return BPromise[_0x2dd5('0x65')](_0x268f49,function(_0x4eeb1a){return db[_0x2dd5('0x5f')]['create'](_[_0x2dd5('0x66')](_0x4eeb1a,['ids','id'])||{},{'fields':_[_0x2dd5('0x38')](_0x5d6275),'raw':!![]})[_0x2dd5('0x2a')](function(_0x21d963){_0x1ebf89[_0x2dd5('0x67')][_0x2dd5('0x64')](_0x21d963[_0x2dd5('0x68')]);})['catch'](function(_0x44a299){_0x1ebf89[_0x2dd5('0x69')]['push']({'data':_0x4eeb1a,'error':_0x44a299[_0x2dd5('0x6a')]});});})['then'](function(_0x228332){return _0x1ebf89;})[_0x2dd5('0x4a')](function(_0x3a6269){return _0x3a6269;});}else{_0x55ae51[_0x2dd5('0x1f')](0x190)[_0x2dd5('0x21')]({'message':_0x2dd5('0x6b')});}});}})[_0x2dd5('0x2a')](respondWithResult(_0x55ae51,null))[_0x2dd5('0x4a')](handleError(_0x55ae51,null));};exports[_0x2dd5('0x6c')]=function(_0x38f97f,_0x1252e2,_0x35ce9f){var _0xb77f4b;return db[_0x2dd5('0x32')][_0x2dd5('0x4c')]({'where':{'id':_0x38f97f['params']['id']},'include':[{'model':db[_0x2dd5('0x6d')],'as':_0x2dd5('0x6e')}]})[_0x2dd5('0x2a')](handleEntityNotFound(_0x1252e2,null))['then'](function(_0x4ad6d4){if(_0x4ad6d4){_0xb77f4b=_0x4ad6d4;return db[_0x2dd5('0x5f')][_0x2dd5('0x33')];}})['then'](function(_0x395f37){if(_0x395f37){var _0x34ee15={};var _0x1c3ab9={};_0x1c3ab9[_0x2dd5('0x36')]=_['concat'](_[_0x2dd5('0x38')](_0x395f37),_['map'](_0xb77f4b['CustomFields'],function(_0x1beccb){return util[_0x2dd5('0x6f')](_0x2dd5('0x70'),_0x1beccb['id']);}));_0x1c3ab9[_0x2dd5('0x37')]=_[_0x2dd5('0x38')](_0x38f97f[_0x2dd5('0x37')]);_0x1c3ab9[_0x2dd5('0x41')]=_['intersection'](_0x1c3ab9['model'],_0x1c3ab9[_0x2dd5('0x37')]);_0x34ee15[_0x2dd5('0x3b')]=_[_0x2dd5('0x39')](_0x1c3ab9['model'],qs['fields'](_0x38f97f[_0x2dd5('0x37')][_0x2dd5('0x3a')]));_0x34ee15[_0x2dd5('0x3b')]=_0x34ee15[_0x2dd5('0x3b')][_0x2dd5('0x3c')]?_0x34ee15['attributes']:_0x1c3ab9['model'];if(!_0x38f97f[_0x2dd5('0x37')][_0x2dd5('0x3d')](_0x2dd5('0x59'))){_0x34ee15[_0x2dd5('0x25')]=qs['limit'](_0x38f97f[_0x2dd5('0x37')]['limit']);_0x34ee15[_0x2dd5('0x22')]=qs[_0x2dd5('0x22')](_0x38f97f['query'][_0x2dd5('0x22')]);}_0x34ee15['order']=qs[_0x2dd5('0x3f')](_0x38f97f['query']['sort']);_0x34ee15['where']=qs[_0x2dd5('0x41')](_[_0x2dd5('0x42')](_0x38f97f[_0x2dd5('0x37')],_0x1c3ab9['filters']));_0x34ee15[_0x2dd5('0x71')]=!![];if(_0x38f97f['query'][_0x2dd5('0x45')]){_0x34ee15[_0x2dd5('0x40')]=_[_0x2dd5('0x5a')](_0x34ee15[_0x2dd5('0x40')],{'$or':_['map'](_0x34ee15[_0x2dd5('0x3b')],function(_0x4a4cc1){var _0x49f976={};_0x49f976[_0x4a4cc1]={'$like':'%'+_0x38f97f[_0x2dd5('0x37')][_0x2dd5('0x45')]+'%'};return _0x49f976;})});}_0x34ee15=_[_0x2dd5('0x5a')]({},_0x34ee15,_0x38f97f[_0x2dd5('0x46')]);return _0xb77f4b['getContacts'](_0x34ee15);}})[_0x2dd5('0x2a')](respondWithResult(_0x1252e2,null))[_0x2dd5('0x4a')](handleError(_0x1252e2,null));};exports[_0x2dd5('0x72')]=function(_0x393f15,_0x5d9a22,_0x3e0a52){var _0x4af41f;var _0x4de8bb;var _0x1543fd;var _0x543f45=_0x393f15['params']['id'];csv_results=[];return db[_0x2dd5('0x73')][_0x2dd5('0x49')]({'attributes':['id',_0x2dd5('0x2f')],'raw':!![],'order':[_0x2dd5('0x74')]})[_0x2dd5('0x2a')](function(_0x160268){_0x4af41f=_0x160268;var _0x36a22d=_[_0x2dd5('0x38')](db['CmContact'][_0x2dd5('0x33')]);return db[_0x2dd5('0x6d')]['findAll']({'raw':!![],'attributes':['id',_0x2dd5('0x75')]})[_0x2dd5('0x2a')](function(_0x2f7408){_0x4de8bb=_0x2f7408;var _0x572175=squel[_0x2dd5('0x76')]()[_0x2dd5('0x3a')](_0x36a22d)[_0x2dd5('0x77')]('cm_contacts','c')[_0x2dd5('0x40')](_0x2dd5('0x78'),_0x543f45)['where'](_0x2dd5('0x79'))[_0x2dd5('0x7a')]();for(var _0x11da34=0x0;_0x11da34<_0x4de8bb[_0x2dd5('0x3c')];_0x11da34++){_0x572175[_0x2dd5('0x7b')](_0x2dd5('0x7c')+_0x4de8bb[_0x11da34]['id'],_0x2dd5('0x7d')+_0x4de8bb[_0x11da34][_0x2dd5('0x75')]);}for(var _0x11da34=0x0;_0x11da34<_0x4af41f[_0x2dd5('0x3c')];_0x11da34++){_0x572175['field'](squel[_0x2dd5('0x76')]()[_0x2dd5('0x7b')](_0x2dd5('0x7e'))[_0x2dd5('0x77')](_0x2dd5('0x7f'))[_0x2dd5('0x40')]('ItemTypeId\x20=\x20?',_0x4af41f[_0x11da34]['id'])[_0x2dd5('0x40')](_0x2dd5('0x80')),_0x2dd5('0x81')+_0x4af41f[_0x11da34][_0x2dd5('0x2f')]);_0x572175[_0x2dd5('0x7b')](squel[_0x2dd5('0x76')]()[_0x2dd5('0x7b')]('description')[_0x2dd5('0x77')](_0x2dd5('0x7f'))[_0x2dd5('0x40')](_0x2dd5('0x82'),_0x4af41f[_0x11da34]['id'])[_0x2dd5('0x40')](_0x2dd5('0x80')),_0x2dd5('0x83')+_0x4af41f[_0x11da34]['name']);}var _0x3395e1=[];_0x3395e1[_0x2dd5('0x64')](_0x572175[_0x2dd5('0x84')]());BPromise['each'](_0x3395e1,handleQuery)['then'](function(_0x3d9775){handleQuery(_0x572175[_0x2dd5('0x84')]());var _0x4d324d=csv_results[0x0];if(!_['isEmpty'](_0x4d324d)){var _0x2974e7=toCsv(_0x4d324d);var _0x22df70=Date[_0x2dd5('0x85')]();fs[_0x2dd5('0x86')](util[_0x2dd5('0x6f')](_0x2dd5('0x87'),_0x543f45,_0x22df70),_0x2974e7);_0x5d9a22[_0x2dd5('0x88')](_0x2dd5('0x89'),_0x2dd5('0x8a')+util['format'](_0x2dd5('0x8b'),_0x543f45,_0x22df70));_0x5d9a22[_0x2dd5('0x88')](_0x2dd5('0x8c'),_0x2dd5('0x8d'));return _0x5d9a22[_0x2dd5('0x8e')](util['format'](_0x2dd5('0x87'),_0x543f45,_0x22df70));}else{return _0x5d9a22[_0x2dd5('0x1e')](0xcc);}});});});};exports[_0x2dd5('0x8f')]=function(_0x111221,_0x19c22b,_0xd55f54){var _0x4e4c89;delete _0x111221[_0x2dd5('0x4e')]['id'];return db[_0x2dd5('0x32')][_0x2dd5('0x90')]({'where':{'id':_0x111221[_0x2dd5('0x55')]['id']}})[_0x2dd5('0x2a')](handleEntityNotFound(_0x19c22b,null))['then'](function(_0x54f8fa){if(_0x54f8fa){return db[_0x2dd5('0x91')]['transaction'](function(_0x1d56bc){return db[_0x2dd5('0x6d')][_0x2dd5('0x4d')](_0x111221[_0x2dd5('0x4e')],{'transaction':_0x1d56bc})[_0x2dd5('0x2a')](function(_0x8b263b){_0x4e4c89=_0x8b263b;return _0x54f8fa[_0x2dd5('0x92')](_0x8b263b,{'transaction':_0x1d56bc});})['then'](function(){var _0x47c25c={'type':db['Sequelize']['TEXT'],'transaction':_0x1d56bc};switch(_0x111221['body'][_0x2dd5('0x35')]){case _0x2dd5('0x93'):_0x47c25c[_0x2dd5('0x35')]=db[_0x2dd5('0x94')][_0x2dd5('0x95')];break;case'number':_0x47c25c[_0x2dd5('0x35')]=db['Sequelize'][_0x2dd5('0x96')];break;case _0x2dd5('0x97'):_0x47c25c[_0x2dd5('0x35')]=db['Sequelize']['BOOLEAN'];_0x47c25c[_0x2dd5('0x98')]=![];break;default:}return db[_0x2dd5('0x91')][_0x2dd5('0x99')][_0x2dd5('0x9a')](_0x2dd5('0x9b'),util['format'](_0x2dd5('0x9c'),_0x4e4c89['id']),_0x47c25c);})[_0x2dd5('0x2a')](function(){return _0x4e4c89;});});}})[_0x2dd5('0x2a')](respondWithResult(_0x19c22b,null))[_0x2dd5('0x4a')](handleError(_0x19c22b,null));};exports[_0x2dd5('0x9d')]=function(_0x163212,_0x40d1ed,_0x1e22e9){var _0x24cff6={};var _0x1b11f6={};var _0x2fb7e8;var _0x1e5df4;return db[_0x2dd5('0x32')][_0x2dd5('0x90')]({'where':{'id':_0x163212[_0x2dd5('0x55')]['id']}})['then'](handleEntityNotFound(_0x40d1ed,null))[_0x2dd5('0x2a')](function(_0x6810a1){if(_0x6810a1){_0x2fb7e8=_0x6810a1;_0x1b11f6[_0x2dd5('0x36')]=_[_0x2dd5('0x38')](db[_0x2dd5('0x6d')][_0x2dd5('0x33')]);_0x1b11f6['query']=_['keys'](_0x163212[_0x2dd5('0x37')]);_0x1b11f6[_0x2dd5('0x41')]=_[_0x2dd5('0x39')](_0x1b11f6['model'],_0x1b11f6[_0x2dd5('0x37')]);_0x24cff6[_0x2dd5('0x3b')]=_[_0x2dd5('0x39')](_0x1b11f6[_0x2dd5('0x36')],qs['fields'](_0x163212['query']['fields']));_0x24cff6['attributes']=_0x24cff6['attributes'][_0x2dd5('0x3c')]?_0x24cff6[_0x2dd5('0x3b')]:_0x1b11f6[_0x2dd5('0x36')];_0x24cff6[_0x2dd5('0x3e')]=qs[_0x2dd5('0x3f')](_0x163212[_0x2dd5('0x37')][_0x2dd5('0x3f')]);_0x24cff6[_0x2dd5('0x40')]=qs[_0x2dd5('0x41')](_['pick'](_0x163212['query'],_0x1b11f6[_0x2dd5('0x41')]));_0x24cff6['where']=_['merge'](_0x24cff6[_0x2dd5('0x40')],{'$or':[{'ListId':_0x6810a1['id']},{'ListId':null}]});if(_0x163212[_0x2dd5('0x37')][_0x2dd5('0x45')]){_0x24cff6[_0x2dd5('0x40')]=_[_0x2dd5('0x5a')](_0x24cff6[_0x2dd5('0x40')],{'$or':_[_0x2dd5('0x43')](_0x24cff6['attributes'],function(_0x438a26){var _0x2913e9={};_0x2913e9[_0x438a26]={'$like':'%'+_0x163212[_0x2dd5('0x37')][_0x2dd5('0x45')]+'%'};return _0x2913e9;})});}_0x24cff6=_[_0x2dd5('0x5a')]({},_0x24cff6,_0x163212[_0x2dd5('0x46')]);return db[_0x2dd5('0x6d')]['findAndCountAll'](_0x24cff6);}})[_0x2dd5('0x2a')](respondWithResult(_0x40d1ed,null))['catch'](handleError(_0x40d1ed,null));};exports[_0x2dd5('0x9e')]=function(_0x4faa4b,_0x57e4c7){return db[_0x2dd5('0x6d')][_0x2dd5('0x9f')]({'where':{'ListId':null}})['then'](handleEntityNotFound(_0x57e4c7,null))[_0x2dd5('0x2a')](function(_0x2a6d3a){return _0x2a6d3a;})[_0x2dd5('0x2a')](respondWithResult(_0x57e4c7,null))[_0x2dd5('0x4a')](handleError(_0x57e4c7,null));};exports[_0x2dd5('0xa0')]=function(_0x177759,_0x55ea88,_0x3b3754){return db['CmList'][_0x2dd5('0x4c')]({'where':{'id':_0x177759[_0x2dd5('0x55')]['id']}})[_0x2dd5('0x2a')](handleEntityNotFound(_0x55ea88,null))['then'](function(_0x22f2bc){if(_0x22f2bc){return _0x22f2bc[_0x2dd5('0xa0')](_0x177759[_0x2dd5('0x4e')]['ids'],_['omit'](_0x177759[_0x2dd5('0x4e')],[_0x2dd5('0xa1'),'id'])||{})[_0x2dd5('0xa2')](function(_0x5ca61e){for(var _0x4695d8=0x0;_0x4695d8<_0x177759[_0x2dd5('0x4e')][_0x2dd5('0xa1')]['length'];_0x4695d8+=0x1){socket['emit'](_0x2dd5('0xa3'),{'UserId':Number(_0x177759[_0x2dd5('0x4e')][_0x2dd5('0xa1')][_0x4695d8]),'CmListId':Number(_0x177759['params']['id'])});}return _0x5ca61e;});}})[_0x2dd5('0x2a')](respondWithResult(_0x55ea88,null))['catch'](handleError(_0x55ea88,null));};exports[_0x2dd5('0xa4')]=function(_0x353b4e,_0x5b6411,_0x57c101){return db['CmList']['find']({'where':{'id':_0x353b4e[_0x2dd5('0x55')]['id']}})[_0x2dd5('0x2a')](handleEntityNotFound(_0x5b6411,null))['then'](function(_0x448065){if(_0x448065){return _0x448065[_0x2dd5('0xa4')](_0x353b4e[_0x2dd5('0x37')]['ids'])[_0x2dd5('0x2a')](function(){if(_['isArray'](_0x353b4e[_0x2dd5('0x37')]['ids'])){for(var _0x21181d=0x0;_0x21181d<_0x353b4e['query'][_0x2dd5('0xa1')][_0x2dd5('0x3c')];_0x21181d+=0x1){socket[_0x2dd5('0xa5')](_0x2dd5('0xa6'),{'UserId':Number(_0x353b4e['query']['ids'][_0x21181d]),'CmListId':Number(_0x353b4e[_0x2dd5('0x55')]['id'])});}}else{socket[_0x2dd5('0xa5')](_0x2dd5('0xa6'),{'UserId':Number(_0x353b4e[_0x2dd5('0x37')][_0x2dd5('0xa1')]),'CmListId':Number(_0x353b4e[_0x2dd5('0x55')]['id'])});}});}})[_0x2dd5('0x2a')](respondWithStatusCode(_0x5b6411,null))['catch'](handleError(_0x5b6411,null));};exports[_0x2dd5('0xa7')]=function(_0xf66b0b,_0x2aebe8,_0x544739){var _0x31a218={};var _0x28b7df={};var _0x174ae6;var _0x14e8c8;return db[_0x2dd5('0x32')][_0x2dd5('0x90')]({'where':{'id':_0xf66b0b[_0x2dd5('0x55')]['id']}})[_0x2dd5('0x2a')](handleEntityNotFound(_0x2aebe8,null))[_0x2dd5('0x2a')](function(_0x299a56){if(_0x299a56){_0x174ae6=_0x299a56;_0x28b7df['model']=_[_0x2dd5('0x38')](db[_0x2dd5('0xa8')][_0x2dd5('0x33')]);_0x28b7df['query']=_[_0x2dd5('0x38')](_0xf66b0b['query']);_0x28b7df[_0x2dd5('0x41')]=_[_0x2dd5('0x39')](_0x28b7df[_0x2dd5('0x36')],_0x28b7df['query']);_0x31a218[_0x2dd5('0x3b')]=_['intersection'](_0x28b7df[_0x2dd5('0x36')],qs[_0x2dd5('0x3a')](_0xf66b0b[_0x2dd5('0x37')][_0x2dd5('0x3a')]));_0x31a218['attributes']=_0x31a218[_0x2dd5('0x3b')]['length']?_0x31a218[_0x2dd5('0x3b')]:_0x28b7df[_0x2dd5('0x36')];_0x31a218[_0x2dd5('0x3e')]=qs[_0x2dd5('0x3f')](_0xf66b0b[_0x2dd5('0x37')][_0x2dd5('0x3f')]);_0x31a218['where']=qs[_0x2dd5('0x41')](_[_0x2dd5('0x42')](_0xf66b0b[_0x2dd5('0x37')],_0x28b7df[_0x2dd5('0x41')]));if(_0xf66b0b[_0x2dd5('0x37')][_0x2dd5('0x45')]){_0x31a218[_0x2dd5('0x40')]=_[_0x2dd5('0x5a')](_0x31a218[_0x2dd5('0x40')],{'$or':_['map'](_0x31a218[_0x2dd5('0x3b')],function(_0x130328){var _0x20f88a={};_0x20f88a[_0x130328]={'$like':'%'+_0xf66b0b[_0x2dd5('0x37')][_0x2dd5('0x45')]+'%'};return _0x20f88a;})});}_0x31a218=_[_0x2dd5('0x5a')]({},_0x31a218,_0xf66b0b[_0x2dd5('0x46')]);return _0x174ae6[_0x2dd5('0xa7')](_0x31a218);}})[_0x2dd5('0x2a')](function(_0x125573){if(_0x125573){_0x14e8c8=_0x125573[_0x2dd5('0x3c')];if(!_0xf66b0b[_0x2dd5('0x37')][_0x2dd5('0x3d')](_0x2dd5('0x59'))){_0x31a218['limit']=qs[_0x2dd5('0x25')](_0xf66b0b[_0x2dd5('0x37')][_0x2dd5('0x25')]);_0x31a218[_0x2dd5('0x22')]=qs[_0x2dd5('0x22')](_0xf66b0b[_0x2dd5('0x37')]['offset']);}return _0x174ae6[_0x2dd5('0xa7')](_0x31a218);}})[_0x2dd5('0x2a')](function(_0x1446d7){if(_0x1446d7){return _0x1446d7?{'count':_0x14e8c8,'rows':_0x1446d7}:null;}})['then'](respondWithResult(_0x2aebe8,null))[_0x2dd5('0x4a')](handleError(_0x2aebe8,null));};function handleQuery(_0x427b3d){logger[_0x2dd5('0xa9')](_0x427b3d);return db[_0x2dd5('0x91')][_0x2dd5('0x37')](_0x427b3d)[_0x2dd5('0xa2')](function(_0x351b66){csv_results[_0x2dd5('0x64')](_0x351b66);})[_0x2dd5('0x4a')](function(_0x1f0042){logger[_0x2dd5('0x52')](_0x1f0042[_0x2dd5('0x6a')]);});} \ No newline at end of file +var _0x1814=['redis','localhost','socket.io-emitter','./cmList.socket','register','status','end','json','offset','limit','undefined','count','set','apply','reject','update','then','destroy','get','Lists','UserProfileResource','sendStatus','error','stack','name','send','index','CmList','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','ListId','getDispositions','findOne','hasOwnProperty','nolimit','Disposition','removeDispositions','ids','addContacts','CmContact','tags','join','each','success','dataValues','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','cf_%d','raw','getContactsCsv','OrderBy','alias','select','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','c.cf_','item','cm_contact_has_items','ItemTypeId\x20=\x20?','description','CmContactId\x20=\x20c.id','description_additionalPhone_','push','toString','isEmpty','writeFileSync','format','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Content-type','text/csv','addCustomField','sequelize','transaction','TEXT','Sequelize','number','INTEGER','BOOLEAN','defaultValue','queryInterface','addColumn','cf_%s','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','omit','spread','emit','userCmList:save','removeAgents','isArray','userCmList:remove','User','getAgents','info','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','defaults'];(function(_0x55f6c6,_0xf65f12){var _0x46ed6c=function(_0x106ca5){while(--_0x106ca5){_0x55f6c6['push'](_0x55f6c6['shift']());}};_0x46ed6c(++_0xf65f12);}(_0x1814,0x139));var _0x4181=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1814[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x4181('0x0'));var rimraf=require(_0x4181('0x1'));var zipdir=require(_0x4181('0x2'));var jsonpatch=require(_0x4181('0x3'));var rp=require(_0x4181('0x4'));var moment=require(_0x4181('0x5'));var BPromise=require(_0x4181('0x6'));var Mustache=require(_0x4181('0x7'));var util=require(_0x4181('0x8'));var path=require(_0x4181('0x9'));var sox=require(_0x4181('0xa'));var csv=require(_0x4181('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4181('0xc'));var _=require(_0x4181('0xd'));var squel=require('squel');var crypto=require(_0x4181('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4181('0xb'));var querystring=require(_0x4181('0xf'));var Papa=require('papaparse');var Redis=require(_0x4181('0x10'));var authService=require(_0x4181('0x11'));var qs=require(_0x4181('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4181('0x13'));var logger=require(_0x4181('0x14'))(_0x4181('0x15'));var utils=require(_0x4181('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4181('0x17'))['db'];var csv_results;config['redis']=_[_0x4181('0x18')](config[_0x4181('0x19')],{'host':_0x4181('0x1a'),'port':0x18eb});var socket=require(_0x4181('0x1b'))(new Redis(config[_0x4181('0x19')]));require(_0x4181('0x1c'))[_0x4181('0x1d')](socket);function respondWithStatusCode(_0x87d49d,_0x2b5370){_0x2b5370=_0x2b5370||0xcc;return function(_0x3450a2){if(_0x3450a2){return _0x87d49d['sendStatus'](_0x2b5370);}return _0x87d49d[_0x4181('0x1e')](_0x2b5370)[_0x4181('0x1f')]();};}function respondWithResult(_0x33da65,_0x1d6874){_0x1d6874=_0x1d6874||0xc8;return function(_0x34b2d5){if(_0x34b2d5){return _0x33da65['status'](_0x1d6874)[_0x4181('0x20')](_0x34b2d5);}};}function respondWithFilteredResult(_0x2c2c5b,_0x3b2c95){return function(_0x53b2b8){if(_0x53b2b8){var _0x20ee4f=typeof _0x3b2c95[_0x4181('0x21')]==='undefined'&&typeof _0x3b2c95[_0x4181('0x22')]===_0x4181('0x23');var _0x42b34f=_0x53b2b8['count'];var _0x5916cd=_0x20ee4f?0x0:_0x3b2c95[_0x4181('0x21')];var _0x230d74=_0x20ee4f?_0x53b2b8[_0x4181('0x24')]:_0x3b2c95['offset']+_0x3b2c95[_0x4181('0x22')];var _0x333719;if(_0x230d74>=_0x42b34f){_0x230d74=_0x42b34f;_0x333719=0xc8;}else{_0x333719=0xce;}_0x2c2c5b[_0x4181('0x1e')](_0x333719);return _0x2c2c5b[_0x4181('0x25')]('Content-Range',_0x5916cd+'-'+_0x230d74+'/'+_0x42b34f)[_0x4181('0x20')](_0x53b2b8);}return null;};}function patchUpdates(_0x5c2b47){return function(_0x356688){try{jsonpatch[_0x4181('0x26')](_0x356688,_0x5c2b47,!![]);}catch(_0x6d4f44){return BPromise[_0x4181('0x27')](_0x6d4f44);}return _0x356688['save']();};}function saveUpdates(_0x19ed5a,_0x1d18b3){return function(_0x1f6fea){if(_0x1f6fea){return _0x1f6fea[_0x4181('0x28')](_0x19ed5a)[_0x4181('0x29')](function(_0x157450){return _0x157450;});}return null;};}function removeEntity(_0x1d8bdd,_0x4e83dc){return function(_0x4c8e90){if(_0x4c8e90){return _0x4c8e90[_0x4181('0x2a')]()[_0x4181('0x29')](function(){var _0x4a9610=_0x4c8e90[_0x4181('0x2b')]({'plain':!![]});var _0x3f29f8=_0x4181('0x2c');return db[_0x4181('0x2d')][_0x4181('0x2a')]({'where':{'type':_0x3f29f8,'resourceId':_0x4a9610['id']}})['then'](function(){return _0x4c8e90;});})['then'](function(){_0x1d8bdd[_0x4181('0x1e')](0xcc)[_0x4181('0x1f')]();});}};}function handleEntityNotFound(_0x332dc9,_0x30c62e){return function(_0x100deb){if(!_0x100deb){_0x332dc9[_0x4181('0x2e')](0x194);}return _0x100deb;};}function handleError(_0x50b5d4,_0x360f71){_0x360f71=_0x360f71||0x1f4;return function(_0x5bfd0b){logger[_0x4181('0x2f')](_0x5bfd0b[_0x4181('0x30')]);if(_0x5bfd0b[_0x4181('0x31')]){delete _0x5bfd0b['name'];}_0x50b5d4['status'](_0x360f71)[_0x4181('0x32')](_0x5bfd0b);};}exports[_0x4181('0x33')]=function(_0xb935f0,_0x2a407f){var _0x44e07c={},_0x5aa375={},_0x426f2a={'count':0x0,'rows':[]};var _0x4bb5f0=_['map'](db[_0x4181('0x34')][_0x4181('0x35')],function(_0x4251bf){return{'name':_0x4251bf[_0x4181('0x36')],'type':_0x4251bf[_0x4181('0x37')][_0x4181('0x38')]};});_0x5aa375[_0x4181('0x39')]=_[_0x4181('0x3a')](_0x4bb5f0,_0x4181('0x31'));_0x5aa375[_0x4181('0x3b')]=_[_0x4181('0x3c')](_0xb935f0['query']);_0x5aa375[_0x4181('0x3d')]=_[_0x4181('0x3e')](_0x5aa375[_0x4181('0x39')],_0x5aa375[_0x4181('0x3b')]);_0x44e07c[_0x4181('0x3f')]=_[_0x4181('0x3e')](_0x5aa375[_0x4181('0x39')],qs[_0x4181('0x40')](_0xb935f0[_0x4181('0x3b')][_0x4181('0x40')]));_0x44e07c[_0x4181('0x3f')]=_0x44e07c[_0x4181('0x3f')][_0x4181('0x41')]?_0x44e07c[_0x4181('0x3f')]:_0x5aa375[_0x4181('0x39')];if(!_0xb935f0['query']['hasOwnProperty']('nolimit')){_0x44e07c[_0x4181('0x22')]=qs[_0x4181('0x22')](_0xb935f0[_0x4181('0x3b')][_0x4181('0x22')]);_0x44e07c['offset']=qs[_0x4181('0x21')](_0xb935f0['query']['offset']);}_0x44e07c[_0x4181('0x42')]=qs[_0x4181('0x43')](_0xb935f0[_0x4181('0x3b')]['sort']);_0x44e07c[_0x4181('0x44')]=qs[_0x4181('0x3d')](_[_0x4181('0x45')](_0xb935f0[_0x4181('0x3b')],_0x5aa375[_0x4181('0x3d')]),_0x4bb5f0);if(_0xb935f0[_0x4181('0x3b')][_0x4181('0x46')]){_0x44e07c['where']=_[_0x4181('0x47')](_0x44e07c[_0x4181('0x44')],{'$or':_[_0x4181('0x3a')](_0x4bb5f0,function(_0x1f9b68){if(_0x1f9b68['type']!==_0x4181('0x48')){var _0x3561ae={};_0x3561ae[_0x1f9b68[_0x4181('0x31')]]={'$like':'%'+_0xb935f0[_0x4181('0x3b')][_0x4181('0x46')]+'%'};return _0x3561ae;}})});}_0x44e07c=_[_0x4181('0x47')]({},_0x44e07c,_0xb935f0[_0x4181('0x49')]);var _0x3454b5={'where':_0x44e07c['where']};return db[_0x4181('0x34')][_0x4181('0x24')](_0x3454b5)[_0x4181('0x29')](function(_0x17548a){_0x426f2a[_0x4181('0x24')]=_0x17548a;if(_0xb935f0[_0x4181('0x3b')][_0x4181('0x4a')]){_0x44e07c[_0x4181('0x4b')]=[{'all':!![]}];}return db['CmList'][_0x4181('0x4c')](_0x44e07c);})[_0x4181('0x29')](function(_0x58bb14){_0x426f2a[_0x4181('0x4d')]=_0x58bb14;return _0x426f2a;})[_0x4181('0x29')](respondWithFilteredResult(_0x2a407f,_0x44e07c))[_0x4181('0x4e')](handleError(_0x2a407f,null));};exports[_0x4181('0x4f')]=function(_0x7129c0,_0x1f371e){var _0x2df8d7={'raw':![],'where':{'id':_0x7129c0['params']['id']}},_0x357cd1={};_0x357cd1['model']=_['keys'](db[_0x4181('0x34')][_0x4181('0x35')]);_0x357cd1[_0x4181('0x3b')]=_['keys'](_0x7129c0[_0x4181('0x3b')]);_0x357cd1[_0x4181('0x3d')]=_[_0x4181('0x3e')](_0x357cd1[_0x4181('0x39')],_0x357cd1[_0x4181('0x3b')]);_0x2df8d7[_0x4181('0x3f')]=_[_0x4181('0x3e')](_0x357cd1[_0x4181('0x39')],qs['fields'](_0x7129c0[_0x4181('0x3b')][_0x4181('0x40')]));_0x2df8d7[_0x4181('0x3f')]=_0x2df8d7[_0x4181('0x3f')][_0x4181('0x41')]?_0x2df8d7[_0x4181('0x3f')]:_0x357cd1[_0x4181('0x39')];if(_0x7129c0['query'][_0x4181('0x4a')]){_0x2df8d7[_0x4181('0x4b')]=[{'all':!![]}];}_0x2df8d7=_[_0x4181('0x47')]({},_0x2df8d7,_0x7129c0[_0x4181('0x49')]);return db[_0x4181('0x34')][_0x4181('0x50')](_0x2df8d7)['then'](handleEntityNotFound(_0x1f371e,null))[_0x4181('0x29')](respondWithResult(_0x1f371e,null))[_0x4181('0x4e')](handleError(_0x1f371e,null));};exports[_0x4181('0x51')]=function(_0x133262,_0x3bec8c){return db['CmList']['create'](_0x133262[_0x4181('0x52')],{})[_0x4181('0x29')](function(_0x39d096){var _0x49cf04=_0x133262[_0x4181('0x53')][_0x4181('0x2b')]({'plain':!![]});if(!_0x49cf04)throw new Error(_0x4181('0x54'));if(_0x49cf04[_0x4181('0x55')]===_0x4181('0x53')){var _0x54e8d9=_0x39d096[_0x4181('0x2b')]({'plain':!![]});var _0x19188b='Lists';return db[_0x4181('0x56')][_0x4181('0x50')]({'where':{'name':_0x19188b,'userProfileId':_0x49cf04[_0x4181('0x57')]},'raw':!![]})[_0x4181('0x29')](function(_0x594417){if(_0x594417&&_0x594417[_0x4181('0x58')]===0x0){return db[_0x4181('0x2d')]['create']({'name':_0x54e8d9[_0x4181('0x31')],'resourceId':_0x54e8d9['id'],'type':_0x594417[_0x4181('0x31')],'sectionId':_0x594417['id']},{})[_0x4181('0x29')](function(){return _0x39d096;});}else{return _0x39d096;}})[_0x4181('0x4e')](function(_0x17c80c){logger['error'](_0x4181('0x59'),_0x17c80c);throw _0x17c80c;});}return _0x39d096;})[_0x4181('0x29')](respondWithResult(_0x3bec8c,0xc9))[_0x4181('0x4e')](handleError(_0x3bec8c,null));};exports['update']=function(_0x4c5656,_0x23f1b5){if(_0x4c5656['body']['id']){delete _0x4c5656['body']['id'];}return db[_0x4181('0x34')][_0x4181('0x50')]({'where':{'id':_0x4c5656[_0x4181('0x5a')]['id']}})['then'](handleEntityNotFound(_0x23f1b5,null))[_0x4181('0x29')](saveUpdates(_0x4c5656[_0x4181('0x52')],null))[_0x4181('0x29')](respondWithResult(_0x23f1b5,null))[_0x4181('0x4e')](handleError(_0x23f1b5,null));};exports[_0x4181('0x2a')]=function(_0x4119ef,_0x416ab9){return db[_0x4181('0x34')]['find']({'where':{'id':_0x4119ef[_0x4181('0x5a')]['id']}})[_0x4181('0x29')](handleEntityNotFound(_0x416ab9,null))[_0x4181('0x29')](removeEntity(_0x416ab9,null))[_0x4181('0x4e')](handleError(_0x416ab9,null));};exports[_0x4181('0x5b')]=function(_0x45f96d,_0x4465a9){return db[_0x4181('0x34')]['describe']()[_0x4181('0x29')](respondWithResult(_0x4465a9,null))['catch'](handleError(_0x4465a9,null));};exports['addDisposition']=function(_0x2709a0,_0x97bd11,_0x3ce45e){if(_0x2709a0[_0x4181('0x52')]['id']){delete _0x2709a0[_0x4181('0x52')]['id'];}return db['CmList'][_0x4181('0x50')]({'where':{'id':_0x2709a0[_0x4181('0x5a')]['id']}})[_0x4181('0x29')](handleEntityNotFound(_0x97bd11,null))[_0x4181('0x29')](function(_0x3687ea){if(_0x3687ea){_0x2709a0[_0x4181('0x52')][_0x4181('0x5c')]=_0x3687ea['id'];return db['Disposition'][_0x4181('0x51')](_0x2709a0[_0x4181('0x52')]);}})['then'](respondWithResult(_0x97bd11,null))['catch'](handleError(_0x97bd11,null));};exports[_0x4181('0x5d')]=function(_0x8e6e63,_0x4eb102,_0x7ac12c){var _0x37a594={'raw':![],'where':{}};var _0x4d5e9c={};var _0x41f4c5={'count':0x0,'rows':[]};return db[_0x4181('0x34')][_0x4181('0x5e')]({'where':{'id':_0x8e6e63[_0x4181('0x5a')]['id']}})['then'](handleEntityNotFound(_0x4eb102,null))[_0x4181('0x29')](function(_0xb8e1e5){if(_0xb8e1e5){_0x4d5e9c[_0x4181('0x39')]=_[_0x4181('0x3c')](db['Disposition'][_0x4181('0x35')]);_0x4d5e9c[_0x4181('0x3b')]=_[_0x4181('0x3c')](_0x8e6e63[_0x4181('0x3b')]);_0x4d5e9c[_0x4181('0x3d')]=_[_0x4181('0x3e')](_0x4d5e9c[_0x4181('0x39')],_0x4d5e9c[_0x4181('0x3b')]);_0x37a594[_0x4181('0x3f')]=_[_0x4181('0x3e')](_0x4d5e9c[_0x4181('0x39')],qs['fields'](_0x8e6e63[_0x4181('0x3b')][_0x4181('0x40')]));_0x37a594[_0x4181('0x3f')]=_0x37a594[_0x4181('0x3f')][_0x4181('0x41')]?_0x37a594[_0x4181('0x3f')]:_0x4d5e9c[_0x4181('0x39')];if(!_0x8e6e63[_0x4181('0x3b')][_0x4181('0x5f')](_0x4181('0x60'))){_0x37a594['limit']=qs[_0x4181('0x22')](_0x8e6e63[_0x4181('0x3b')]['limit']);_0x37a594[_0x4181('0x21')]=qs[_0x4181('0x21')](_0x8e6e63[_0x4181('0x3b')][_0x4181('0x21')]);}_0x37a594[_0x4181('0x42')]=qs['sort'](_0x8e6e63[_0x4181('0x3b')][_0x4181('0x43')]);_0x37a594['where']=qs[_0x4181('0x3d')](_[_0x4181('0x45')](_0x8e6e63[_0x4181('0x3b')],_0x4d5e9c[_0x4181('0x3d')]));_0x37a594[_0x4181('0x44')][_0x4181('0x5c')]=_0xb8e1e5['id'];if(_0x8e6e63['query'][_0x4181('0x46')]){_0x37a594[_0x4181('0x44')]=_[_0x4181('0x47')](_0x37a594[_0x4181('0x44')],{'$or':_[_0x4181('0x3a')](_0x37a594['attributes'],function(_0x76dbc9){var _0x149fdf={};_0x149fdf[_0x76dbc9]={'$like':'%'+_0x8e6e63[_0x4181('0x3b')][_0x4181('0x46')]+'%'};return _0x149fdf;})});}_0x37a594=_[_0x4181('0x47')]({},_0x37a594,_0x8e6e63[_0x4181('0x49')]);return db[_0x4181('0x61')]['count']({'where':_0x37a594['where']})[_0x4181('0x29')](function(_0x203fd9){_0x41f4c5['count']=_0x203fd9;if(_0x8e6e63[_0x4181('0x3b')][_0x4181('0x4a')]){_0x37a594[_0x4181('0x4b')]=[{'all':!![]}];}return db[_0x4181('0x61')]['findAll'](_0x37a594);})['then'](function(_0x3efaf5){_0x41f4c5[_0x4181('0x4d')]=_0x3efaf5;return _0x41f4c5;});}})[_0x4181('0x29')](respondWithFilteredResult(_0x4eb102,_0x37a594))[_0x4181('0x4e')](handleError(_0x4eb102,null));};exports['removeDispositions']=function(_0x372885,_0x4ed780,_0x4ec329){return db['CmList'][_0x4181('0x50')]({'where':{'id':_0x372885[_0x4181('0x5a')]['id']}})[_0x4181('0x29')](handleEntityNotFound(_0x4ed780,null))[_0x4181('0x29')](function(_0x31d6b4){if(_0x31d6b4){return _0x31d6b4[_0x4181('0x62')](_0x372885[_0x4181('0x3b')][_0x4181('0x63')]);}})[_0x4181('0x29')](respondWithStatusCode(_0x4ed780,null))[_0x4181('0x4e')](handleError(_0x4ed780,null));};exports[_0x4181('0x64')]=function(_0x3d21ce,_0x22afc5,_0x119f02){return db[_0x4181('0x34')]['find']({'where':{'id':_0x3d21ce[_0x4181('0x5a')]['id']}})[_0x4181('0x29')](handleEntityNotFound(_0x22afc5,null))[_0x4181('0x29')](function(_0x489e33){if(_0x489e33){var _0x4067ab=[];var _0x151c7e={'success':[],'errors':[]};return db[_0x4181('0x65')][_0x4181('0x5b')]()['then'](function(_0x537653){if(_0x3d21ce['body'][_0x4181('0x66')]&&_['isArray'](_0x3d21ce['body'][_0x4181('0x66')])){if(_0x3d21ce[_0x4181('0x52')][_0x4181('0x66')][_0x4181('0x41')]){_0x3d21ce['body'][_0x4181('0x66')]=_0x3d21ce[_0x4181('0x52')][_0x4181('0x66')][_0x4181('0x67')](';')+';';}else{_0x3d21ce['body'][_0x4181('0x66')]=null;}}else{_0x3d21ce[_0x4181('0x52')][_0x4181('0x66')]=null;}if(_0x3d21ce[_0x4181('0x52')]&&_['isArray'](_0x3d21ce[_0x4181('0x52')])){for(var _0x4ca343=0x0;_0x4ca343<_0x3d21ce[_0x4181('0x52')][_0x4181('0x41')];_0x4ca343+=0x1){_0x3d21ce[_0x4181('0x52')][_0x4ca343]['ListId']=_0x3d21ce[_0x4181('0x5a')]['id'];_0x4067ab['push'](_0x3d21ce[_0x4181('0x52')][_0x4ca343]);}return BPromise[_0x4181('0x68')](_0x4067ab,function(_0x49cfcf){return db[_0x4181('0x65')]['create'](_['omit'](_0x49cfcf,['ids','id'])||{},{'fields':_[_0x4181('0x3c')](_0x537653),'raw':!![]})[_0x4181('0x29')](function(_0x461668){_0x151c7e[_0x4181('0x69')]['push'](_0x461668[_0x4181('0x6a')]);})['catch'](function(_0x102357){_0x151c7e['errors']['push']({'data':_0x49cfcf,'error':_0x102357[_0x4181('0x6b')]});});})['then'](function(_0xdd08a){return _0x151c7e;})['catch'](function(_0x182e24){return _0x182e24;});}else{_0x22afc5[_0x4181('0x1e')](0x190)['json']({'message':_0x4181('0x6c')});}});}})['then'](respondWithResult(_0x22afc5,null))['catch'](handleError(_0x22afc5,null));};exports[_0x4181('0x6d')]=function(_0xf91dc8,_0xed0fcd,_0x5ae1b7){var _0x36c307;return db[_0x4181('0x34')][_0x4181('0x50')]({'where':{'id':_0xf91dc8[_0x4181('0x5a')]['id']},'include':[{'model':db[_0x4181('0x6e')],'as':_0x4181('0x6f')}]})[_0x4181('0x29')](handleEntityNotFound(_0xed0fcd,null))[_0x4181('0x29')](function(_0x1ccfe8){if(_0x1ccfe8){_0x36c307=_0x1ccfe8;return db[_0x4181('0x65')][_0x4181('0x35')];}})[_0x4181('0x29')](function(_0x495f6d){if(_0x495f6d){var _0x1cbf8a={};var _0x4fb74b={};_0x4fb74b[_0x4181('0x39')]=_[_0x4181('0x70')](_[_0x4181('0x3c')](_0x495f6d),_[_0x4181('0x3a')](_0x36c307[_0x4181('0x6f')],function(_0x588d0c){return util['format'](_0x4181('0x71'),_0x588d0c['id']);}));_0x4fb74b[_0x4181('0x3b')]=_[_0x4181('0x3c')](_0xf91dc8[_0x4181('0x3b')]);_0x4fb74b[_0x4181('0x3d')]=_[_0x4181('0x3e')](_0x4fb74b[_0x4181('0x39')],_0x4fb74b[_0x4181('0x3b')]);_0x1cbf8a['attributes']=_[_0x4181('0x3e')](_0x4fb74b[_0x4181('0x39')],qs['fields'](_0xf91dc8[_0x4181('0x3b')][_0x4181('0x40')]));_0x1cbf8a[_0x4181('0x3f')]=_0x1cbf8a['attributes']['length']?_0x1cbf8a[_0x4181('0x3f')]:_0x4fb74b[_0x4181('0x39')];if(!_0xf91dc8[_0x4181('0x3b')]['hasOwnProperty']('nolimit')){_0x1cbf8a[_0x4181('0x22')]=qs[_0x4181('0x22')](_0xf91dc8['query']['limit']);_0x1cbf8a[_0x4181('0x21')]=qs['offset'](_0xf91dc8[_0x4181('0x3b')][_0x4181('0x21')]);}_0x1cbf8a[_0x4181('0x42')]=qs[_0x4181('0x43')](_0xf91dc8[_0x4181('0x3b')]['sort']);_0x1cbf8a['where']=qs[_0x4181('0x3d')](_[_0x4181('0x45')](_0xf91dc8[_0x4181('0x3b')],_0x4fb74b[_0x4181('0x3d')]));_0x1cbf8a[_0x4181('0x72')]=!![];if(_0xf91dc8[_0x4181('0x3b')][_0x4181('0x46')]){_0x1cbf8a['where']=_['merge'](_0x1cbf8a[_0x4181('0x44')],{'$or':_['map'](_0x1cbf8a['attributes'],function(_0x2453af){var _0x304b79={};_0x304b79[_0x2453af]={'$like':'%'+_0xf91dc8[_0x4181('0x3b')][_0x4181('0x46')]+'%'};return _0x304b79;})});}_0x1cbf8a=_[_0x4181('0x47')]({},_0x1cbf8a,_0xf91dc8[_0x4181('0x49')]);return _0x36c307[_0x4181('0x6d')](_0x1cbf8a);}})[_0x4181('0x29')](respondWithResult(_0xed0fcd,null))['catch'](handleError(_0xed0fcd,null));};exports[_0x4181('0x73')]=function(_0x5db80c,_0x36eba6,_0x574a7f){var _0x1c2d07;var _0x5effb3;var _0x177a82;var _0x487046=_0x5db80c[_0x4181('0x5a')]['id'];csv_results=[];return db['ContactItemType']['findAll']({'attributes':['id',_0x4181('0x31')],'raw':!![],'order':[_0x4181('0x74')]})['then'](function(_0x484650){_0x1c2d07=_0x484650;var _0x1376c1=_[_0x4181('0x3c')](db['CmContact'][_0x4181('0x35')]);return db[_0x4181('0x6e')][_0x4181('0x4c')]({'raw':!![],'attributes':['id',_0x4181('0x75')]})[_0x4181('0x29')](function(_0x4167db){_0x5effb3=_0x4167db;var _0x4d4a0e=squel[_0x4181('0x76')]()['fields'](_0x1376c1)[_0x4181('0x77')](_0x4181('0x78'),'c')['where'](_0x4181('0x79'),_0x487046)[_0x4181('0x44')](_0x4181('0x7a'))[_0x4181('0x7b')]();for(var _0x17828e=0x0;_0x17828e<_0x5effb3[_0x4181('0x41')];_0x17828e++){_0x4d4a0e[_0x4181('0x7c')](_0x4181('0x7d')+_0x5effb3[_0x17828e]['id'],'customField_'+_0x5effb3[_0x17828e][_0x4181('0x75')]);}for(var _0x17828e=0x0;_0x17828e<_0x1c2d07[_0x4181('0x41')];_0x17828e++){_0x4d4a0e[_0x4181('0x7c')](squel[_0x4181('0x76')]()['field'](_0x4181('0x7e'))[_0x4181('0x77')](_0x4181('0x7f'))[_0x4181('0x44')](_0x4181('0x80'),_0x1c2d07[_0x17828e]['id'])[_0x4181('0x44')]('CmContactId\x20=\x20c.id'),'additionalPhone_'+_0x1c2d07[_0x17828e][_0x4181('0x31')]);_0x4d4a0e['field'](squel[_0x4181('0x76')]()[_0x4181('0x7c')](_0x4181('0x81'))[_0x4181('0x77')](_0x4181('0x7f'))['where'](_0x4181('0x80'),_0x1c2d07[_0x17828e]['id'])[_0x4181('0x44')](_0x4181('0x82')),_0x4181('0x83')+_0x1c2d07[_0x17828e][_0x4181('0x31')]);}var _0x876a76=[];_0x876a76[_0x4181('0x84')](_0x4d4a0e['toString']());BPromise['each'](_0x876a76,handleQuery)['then'](function(_0x1eaac6){handleQuery(_0x4d4a0e[_0x4181('0x85')]());var _0x30751f=csv_results[0x0];if(!_[_0x4181('0x86')](_0x30751f)){var _0x25e498=toCsv(_0x30751f);var _0xbdc758=Date['now']();fs[_0x4181('0x87')](util[_0x4181('0x88')](_0x4181('0x89'),_0x487046,_0xbdc758),_0x25e498);_0x36eba6[_0x4181('0x8a')](_0x4181('0x8b'),_0x4181('0x8c')+util['format']('list_%d_%s.csv',_0x487046,_0xbdc758));_0x36eba6[_0x4181('0x8a')](_0x4181('0x8d'),_0x4181('0x8e'));return _0x36eba6['download'](util[_0x4181('0x88')](_0x4181('0x89'),_0x487046,_0xbdc758));}else{return _0x36eba6[_0x4181('0x2e')](0xcc);}});});});};exports[_0x4181('0x8f')]=function(_0x70db5f,_0x5e4302,_0x13f9c6){var _0x1097de;delete _0x70db5f[_0x4181('0x52')]['id'];return db[_0x4181('0x34')][_0x4181('0x5e')]({'where':{'id':_0x70db5f[_0x4181('0x5a')]['id']}})[_0x4181('0x29')](handleEntityNotFound(_0x5e4302,null))[_0x4181('0x29')](function(_0x417d6e){if(_0x417d6e){return db[_0x4181('0x90')][_0x4181('0x91')](function(_0x3e416d){return db[_0x4181('0x6e')]['create'](_0x70db5f[_0x4181('0x52')],{'transaction':_0x3e416d})[_0x4181('0x29')](function(_0xf6b03c){_0x1097de=_0xf6b03c;return _0x417d6e['addCustomFields'](_0xf6b03c,{'transaction':_0x3e416d});})['then'](function(){var _0x195da4={'type':db['Sequelize'][_0x4181('0x92')],'transaction':_0x3e416d};switch(_0x70db5f[_0x4181('0x52')][_0x4181('0x37')]){case'text':_0x195da4[_0x4181('0x37')]=db[_0x4181('0x93')]['TEXT'];break;case _0x4181('0x94'):_0x195da4[_0x4181('0x37')]=db['Sequelize'][_0x4181('0x95')];break;case'switch':_0x195da4[_0x4181('0x37')]=db[_0x4181('0x93')][_0x4181('0x96')];_0x195da4[_0x4181('0x97')]=![];break;default:}return db[_0x4181('0x90')][_0x4181('0x98')][_0x4181('0x99')](_0x4181('0x78'),util[_0x4181('0x88')](_0x4181('0x9a'),_0x1097de['id']),_0x195da4);})[_0x4181('0x29')](function(){return _0x1097de;});});}})[_0x4181('0x29')](respondWithResult(_0x5e4302,null))[_0x4181('0x4e')](handleError(_0x5e4302,null));};exports[_0x4181('0x9b')]=function(_0x4e59df,_0x360163,_0x2b1b31){var _0xd926df={};var _0x21ce40={};var _0x219842;var _0x4ab1bf;return db[_0x4181('0x34')]['findOne']({'where':{'id':_0x4e59df[_0x4181('0x5a')]['id']}})['then'](handleEntityNotFound(_0x360163,null))[_0x4181('0x29')](function(_0x54a8ee){if(_0x54a8ee){_0x219842=_0x54a8ee;_0x21ce40[_0x4181('0x39')]=_[_0x4181('0x3c')](db[_0x4181('0x6e')][_0x4181('0x35')]);_0x21ce40[_0x4181('0x3b')]=_[_0x4181('0x3c')](_0x4e59df[_0x4181('0x3b')]);_0x21ce40['filters']=_[_0x4181('0x3e')](_0x21ce40[_0x4181('0x39')],_0x21ce40['query']);_0xd926df['attributes']=_[_0x4181('0x3e')](_0x21ce40['model'],qs[_0x4181('0x40')](_0x4e59df[_0x4181('0x3b')][_0x4181('0x40')]));_0xd926df[_0x4181('0x3f')]=_0xd926df['attributes']['length']?_0xd926df[_0x4181('0x3f')]:_0x21ce40['model'];_0xd926df['order']=qs['sort'](_0x4e59df[_0x4181('0x3b')][_0x4181('0x43')]);_0xd926df[_0x4181('0x44')]=qs['filters'](_[_0x4181('0x45')](_0x4e59df['query'],_0x21ce40[_0x4181('0x3d')]));_0xd926df['where']=_[_0x4181('0x47')](_0xd926df[_0x4181('0x44')],{'$or':[{'ListId':_0x54a8ee['id']},{'ListId':null}]});if(_0x4e59df[_0x4181('0x3b')][_0x4181('0x46')]){_0xd926df[_0x4181('0x44')]=_[_0x4181('0x47')](_0xd926df[_0x4181('0x44')],{'$or':_[_0x4181('0x3a')](_0xd926df['attributes'],function(_0x56390a){var _0x3b7c8e={};_0x3b7c8e[_0x56390a]={'$like':'%'+_0x4e59df[_0x4181('0x3b')][_0x4181('0x46')]+'%'};return _0x3b7c8e;})});}_0xd926df=_[_0x4181('0x47')]({},_0xd926df,_0x4e59df['options']);return db[_0x4181('0x6e')][_0x4181('0x9c')](_0xd926df);}})[_0x4181('0x29')](respondWithResult(_0x360163,null))[_0x4181('0x4e')](handleError(_0x360163,null));};exports[_0x4181('0x9d')]=function(_0x257469,_0xbb4ff){return db['CmCustomField']['findAndCountAll']({'where':{'ListId':null}})['then'](handleEntityNotFound(_0xbb4ff,null))[_0x4181('0x29')](function(_0x275d82){return _0x275d82;})[_0x4181('0x29')](respondWithResult(_0xbb4ff,null))[_0x4181('0x4e')](handleError(_0xbb4ff,null));};exports[_0x4181('0x9e')]=function(_0x8a71d6,_0x4163a1,_0x4a720c){return db[_0x4181('0x34')][_0x4181('0x50')]({'where':{'id':_0x8a71d6['params']['id']}})[_0x4181('0x29')](handleEntityNotFound(_0x4163a1,null))[_0x4181('0x29')](function(_0xe49bf2){if(_0xe49bf2){return _0xe49bf2['addAgents'](_0x8a71d6[_0x4181('0x52')][_0x4181('0x63')],_[_0x4181('0x9f')](_0x8a71d6[_0x4181('0x52')],[_0x4181('0x63'),'id'])||{})[_0x4181('0xa0')](function(_0x2fbfb4){for(var _0x26c7c8=0x0;_0x26c7c8<_0x8a71d6[_0x4181('0x52')][_0x4181('0x63')][_0x4181('0x41')];_0x26c7c8+=0x1){socket[_0x4181('0xa1')](_0x4181('0xa2'),{'UserId':Number(_0x8a71d6[_0x4181('0x52')][_0x4181('0x63')][_0x26c7c8]),'CmListId':Number(_0x8a71d6[_0x4181('0x5a')]['id'])});}return _0x2fbfb4;});}})['then'](respondWithResult(_0x4163a1,null))[_0x4181('0x4e')](handleError(_0x4163a1,null));};exports[_0x4181('0xa3')]=function(_0x1e383d,_0xf2fc65,_0x22aba5){return db['CmList'][_0x4181('0x50')]({'where':{'id':_0x1e383d['params']['id']}})['then'](handleEntityNotFound(_0xf2fc65,null))[_0x4181('0x29')](function(_0x39817d){if(_0x39817d){return _0x39817d[_0x4181('0xa3')](_0x1e383d[_0x4181('0x3b')][_0x4181('0x63')])['then'](function(){if(_[_0x4181('0xa4')](_0x1e383d[_0x4181('0x3b')][_0x4181('0x63')])){for(var _0x8d432f=0x0;_0x8d432f<_0x1e383d[_0x4181('0x3b')][_0x4181('0x63')][_0x4181('0x41')];_0x8d432f+=0x1){socket[_0x4181('0xa1')](_0x4181('0xa5'),{'UserId':Number(_0x1e383d[_0x4181('0x3b')]['ids'][_0x8d432f]),'CmListId':Number(_0x1e383d['params']['id'])});}}else{socket[_0x4181('0xa1')](_0x4181('0xa5'),{'UserId':Number(_0x1e383d[_0x4181('0x3b')][_0x4181('0x63')]),'CmListId':Number(_0x1e383d[_0x4181('0x5a')]['id'])});}});}})[_0x4181('0x29')](respondWithStatusCode(_0xf2fc65,null))[_0x4181('0x4e')](handleError(_0xf2fc65,null));};exports['getAgents']=function(_0x134d84,_0x3b5538,_0x2d5080){var _0x552cc8={};var _0x563fa1={};var _0xea8d8a;var _0x2519fd;return db[_0x4181('0x34')][_0x4181('0x5e')]({'where':{'id':_0x134d84[_0x4181('0x5a')]['id']}})[_0x4181('0x29')](handleEntityNotFound(_0x3b5538,null))['then'](function(_0x1e0c14){if(_0x1e0c14){_0xea8d8a=_0x1e0c14;_0x563fa1['model']=_[_0x4181('0x3c')](db[_0x4181('0xa6')][_0x4181('0x35')]);_0x563fa1['query']=_[_0x4181('0x3c')](_0x134d84['query']);_0x563fa1[_0x4181('0x3d')]=_[_0x4181('0x3e')](_0x563fa1[_0x4181('0x39')],_0x563fa1['query']);_0x552cc8[_0x4181('0x3f')]=_[_0x4181('0x3e')](_0x563fa1['model'],qs[_0x4181('0x40')](_0x134d84[_0x4181('0x3b')]['fields']));_0x552cc8['attributes']=_0x552cc8[_0x4181('0x3f')]['length']?_0x552cc8[_0x4181('0x3f')]:_0x563fa1[_0x4181('0x39')];_0x552cc8['order']=qs[_0x4181('0x43')](_0x134d84[_0x4181('0x3b')][_0x4181('0x43')]);_0x552cc8['where']=qs['filters'](_['pick'](_0x134d84['query'],_0x563fa1[_0x4181('0x3d')]));if(_0x134d84[_0x4181('0x3b')][_0x4181('0x46')]){_0x552cc8[_0x4181('0x44')]=_['merge'](_0x552cc8[_0x4181('0x44')],{'$or':_['map'](_0x552cc8['attributes'],function(_0x380301){var _0x4d63de={};_0x4d63de[_0x380301]={'$like':'%'+_0x134d84[_0x4181('0x3b')][_0x4181('0x46')]+'%'};return _0x4d63de;})});}_0x552cc8=_[_0x4181('0x47')]({},_0x552cc8,_0x134d84[_0x4181('0x49')]);return _0xea8d8a['getAgents'](_0x552cc8);}})[_0x4181('0x29')](function(_0x125a6e){if(_0x125a6e){_0x2519fd=_0x125a6e[_0x4181('0x41')];if(!_0x134d84[_0x4181('0x3b')][_0x4181('0x5f')](_0x4181('0x60'))){_0x552cc8[_0x4181('0x22')]=qs[_0x4181('0x22')](_0x134d84['query']['limit']);_0x552cc8[_0x4181('0x21')]=qs[_0x4181('0x21')](_0x134d84[_0x4181('0x3b')]['offset']);}return _0xea8d8a[_0x4181('0xa7')](_0x552cc8);}})[_0x4181('0x29')](function(_0x229736){if(_0x229736){return _0x229736?{'count':_0x2519fd,'rows':_0x229736}:null;}})[_0x4181('0x29')](respondWithResult(_0x3b5538,null))[_0x4181('0x4e')](handleError(_0x3b5538,null));};function handleQuery(_0x5367f6){logger[_0x4181('0xa8')](_0x5367f6);return db[_0x4181('0x90')][_0x4181('0x3b')](_0x5367f6)['spread'](function(_0x5aee82){csv_results[_0x4181('0x84')](_0x5aee82);})['catch'](function(_0x2a436a){logger[_0x4181('0x2f')](_0x2a436a[_0x4181('0x6b')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 4eeabf7..8b5a5d4 100644 --- a/server/api/cmList/cmList.events.js +++ b/server/api/cmList/cmList.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['update','emit','hook','exports','events','../../mysqldb','CmList','setMaxListeners','save'];(function(_0x1946ec,_0x27c21b){var _0x2e3bb3=function(_0x51023d){while(--_0x51023d){_0x1946ec['push'](_0x1946ec['shift']());}};_0x2e3bb3(++_0x27c21b);}(_0x814b,0x1a2));var _0xb814=function(_0x5cf3c0,_0x4363c1){_0x5cf3c0=_0x5cf3c0-0x0;var _0x39a680=_0x814b[_0x5cf3c0];return _0x39a680;};'use strict';var EventEmitter=require(_0xb814('0x0'));var CmList=require(_0xb814('0x1'))['db'][_0xb814('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0xb814('0x3')](0x0);var events={'afterCreate':_0xb814('0x4'),'afterUpdate':_0xb814('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38c21a){return function(_0x3e1e9,_0x258866,_0x4237bc){CmListEvents[_0xb814('0x6')](_0x38c21a+':'+_0x3e1e9['id'],_0x3e1e9);CmListEvents[_0xb814('0x6')](_0x38c21a,_0x3e1e9);_0x4237bc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xb814('0x7')](e,emitEvent(event));}}module[_0xb814('0x8')]=CmListEvents; \ No newline at end of file +var _0xe14b=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','emit'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe14b,0x93));var _0xbe14=function(_0x4a4a08,_0x53088f){_0x4a4a08=_0x4a4a08-0x0;var _0x119551=_0xe14b[_0x4a4a08];return _0x119551;};'use strict';var EventEmitter=require(_0xbe14('0x0'));var CmList=require(_0xbe14('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbe14('0x2'),'afterUpdate':_0xbe14('0x3'),'afterDestroy':'remove'};function emitEvent(_0x7d3665){return function(_0x5ce8fb,_0x496c04,_0x1833e3){CmListEvents[_0xbe14('0x4')](_0x7d3665+':'+_0x5ce8fb['id'],_0x5ce8fb);CmListEvents[_0xbe14('0x4')](_0x7d3665,_0x5ce8fb);_0x1833e3(null);};}for(var e in events){if(events[_0xbe14('0x5')](e)){var event=events[e];CmList[_0xbe14('0x6')](e,emitEvent(event));}}module[_0xbe14('0x7')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index bde7a26..3cc3cff 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 _0x0bb5=['define','CmList','cm_lists','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports'];(function(_0x231473,_0x33b93e){var _0x16d666=function(_0x35ed3a){while(--_0x35ed3a){_0x231473['push'](_0x231473['shift']());}};_0x16d666(++_0x33b93e);}(_0x0bb5,0x148));var _0x50bb=function(_0x295e79,_0x3f1d1e){_0x295e79=_0x295e79-0x0;var _0xdf11ea=_0x0bb5[_0x295e79];return _0xdf11ea;};'use strict';var _=require(_0x50bb('0x0'));var util=require(_0x50bb('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x50bb('0x2'));var BPromise=require(_0x50bb('0x3'));var rp=require(_0x50bb('0x4'));var fs=require('fs');var path=require(_0x50bb('0x5'));var rimraf=require(_0x50bb('0x6'));var config=require(_0x50bb('0x7'));var attributes=require(_0x50bb('0x8'));module[_0x50bb('0x9')]=function(_0x4e6093,_0x4a105c){return _0x4e6093[_0x50bb('0xa')](_0x50bb('0xb'),attributes,{'tableName':_0x50bb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xac4a=['lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./cmList.attributes','define','cm_lists'];(function(_0x26ac67,_0x1f77bf){var _0x2d7f2e=function(_0x5b3768){while(--_0x5b3768){_0x26ac67['push'](_0x26ac67['shift']());}};_0x2d7f2e(++_0x1f77bf);}(_0xac4a,0x13f));var _0xaac4=function(_0xedaa6d,_0x110cea){_0xedaa6d=_0xedaa6d-0x0;var _0x5326fa=_0xac4a[_0xedaa6d];return _0x5326fa;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var logger=require(_0xaac4('0x2'))(_0xaac4('0x3'));var moment=require(_0xaac4('0x4'));var BPromise=require(_0xaac4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xaac4('0x6'));var config=require(_0xaac4('0x7'));var attributes=require(_0xaac4('0x8'));module['exports']=function(_0x1283a5,_0x53d03a){return _0x1283a5[_0xaac4('0x9')]('CmList',attributes,{'tableName':_0xaac4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 28ba329..c8f5adc 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 _0x8773=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','request','info','request\x20sent','stringify','error','CmList,\x20%s,\x20%s','message','catch','lodash','util'];(function(_0x139c81,_0x23ad5e){var _0x218480=function(_0x4978a6){while(--_0x4978a6){_0x139c81['push'](_0x139c81['shift']());}};_0x218480(++_0x23ad5e);}(_0x8773,0x193));var _0x3877=function(_0x32b954,_0x4b6b16){_0x32b954=_0x32b954-0x0;var _0x66d5ca=_0x8773[_0x32b954];return _0x66d5ca;};'use strict';var _=require(_0x3877('0x0'));var util=require(_0x3877('0x1'));var moment=require(_0x3877('0x2'));var BPromise=require(_0x3877('0x3'));var rs=require(_0x3877('0x4'));var fs=require('fs');var Redis=require(_0x3877('0x5'));var db=require(_0x3877('0x6'))['db'];var utils=require(_0x3877('0x7'));var logger=require(_0x3877('0x8'))(_0x3877('0x9'));var config=require(_0x3877('0xa'));var jayson=require(_0x3877('0xb'));var client=jayson[_0x3877('0xc')]['http']({'port':0x232a});config[_0x3877('0xd')]=_[_0x3877('0xe')](config[_0x3877('0xd')],{'host':_0x3877('0xf'),'port':0x18eb});var socket=require(_0x3877('0x10'))(new Redis(config[_0x3877('0xd')]));require(_0x3877('0x11'))[_0x3877('0x12')](socket);function respondWithRpcPromise(_0x399f14,_0xb2adde,_0x26e4f9){return new BPromise(function(_0x813e4,_0x142689){return client[_0x3877('0x13')](_0x399f14,_0x26e4f9)['then'](function(_0xf3c9db){logger[_0x3877('0x14')]('CmList,\x20%s,\x20%s',_0xb2adde,_0x3877('0x15'));logger['debug']('CmList,\x20%s,\x20%s,\x20%s',_0xb2adde,_0x3877('0x15'),JSON[_0x3877('0x16')](_0xf3c9db));if(_0xf3c9db[_0x3877('0x17')]){if(_0xf3c9db[_0x3877('0x17')]['code']===0x1f4){logger[_0x3877('0x17')](_0x3877('0x18'),_0xb2adde,_0xf3c9db['error'][_0x3877('0x19')]);return _0x142689(_0xf3c9db[_0x3877('0x17')][_0x3877('0x19')]);}logger[_0x3877('0x17')]('CmList,\x20%s,\x20%s',_0xb2adde,_0xf3c9db[_0x3877('0x17')]['message']);return _0x813e4(_0xf3c9db['error'][_0x3877('0x19')]);}else{logger[_0x3877('0x14')]('CmList,\x20%s,\x20%s',_0xb2adde,'request\x20sent');_0x813e4(_0xf3c9db['result']['message']);}})[_0x3877('0x1a')](function(_0xbc8a68){logger[_0x3877('0x17')](_0x3877('0x18'),_0xb2adde,_0xbc8a68);_0x142689(_0xbc8a68);});});} \ No newline at end of file +var _0x4481=['http','redis','socket.io-emitter','./cmList.socket','register','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise'];(function(_0x17e3c4,_0x821010){var _0x2211b9=function(_0x33ab42){while(--_0x33ab42){_0x17e3c4['push'](_0x17e3c4['shift']());}};_0x2211b9(++_0x821010);}(_0x4481,0x17d));var _0x1448=function(_0x26b4c4,_0x3822ca){_0x26b4c4=_0x26b4c4-0x0;var _0x2d22c7=_0x4481[_0x26b4c4];return _0x2d22c7;};'use strict';var _=require(_0x1448('0x0'));var util=require(_0x1448('0x1'));var moment=require(_0x1448('0x2'));var BPromise=require('bluebird');var rs=require(_0x1448('0x3'));var fs=require('fs');var Redis=require(_0x1448('0x4'));var db=require(_0x1448('0x5'))['db'];var utils=require(_0x1448('0x6'));var logger=require(_0x1448('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1448('0x8'));var client=jayson['client'][_0x1448('0x9')]({'port':0x232a});config[_0x1448('0xa')]=_['defaults'](config[_0x1448('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x1448('0xb'))(new Redis(config[_0x1448('0xa')]));require(_0x1448('0xc'))[_0x1448('0xd')](socket);function respondWithRpcPromise(_0x56d3d2,_0x57eb1c,_0x4d2729){return new BPromise(function(_0x48f1b4,_0x356ae7){return client[_0x1448('0xe')](_0x56d3d2,_0x4d2729)[_0x1448('0xf')](function(_0x4f87a0){logger[_0x1448('0x10')](_0x1448('0x11'),_0x57eb1c,_0x1448('0x12'));logger[_0x1448('0x13')]('CmList,\x20%s,\x20%s,\x20%s',_0x57eb1c,_0x1448('0x12'),JSON[_0x1448('0x14')](_0x4f87a0));if(_0x4f87a0[_0x1448('0x15')]){if(_0x4f87a0['error'][_0x1448('0x16')]===0x1f4){logger[_0x1448('0x15')](_0x1448('0x11'),_0x57eb1c,_0x4f87a0[_0x1448('0x15')][_0x1448('0x17')]);return _0x356ae7(_0x4f87a0[_0x1448('0x15')]['message']);}logger[_0x1448('0x15')](_0x1448('0x11'),_0x57eb1c,_0x4f87a0['error'][_0x1448('0x17')]);return _0x48f1b4(_0x4f87a0[_0x1448('0x15')][_0x1448('0x17')]);}else{logger['info'](_0x1448('0x11'),_0x57eb1c,_0x1448('0x12'));_0x48f1b4(_0x4f87a0[_0x1448('0x18')][_0x1448('0x17')]);}})[_0x1448('0x19')](function(_0x31ddbc){logger['error'](_0x1448('0x11'),_0x57eb1c,_0x31ddbc);_0x356ae7(_0x31ddbc);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 36d39a6..27e683e 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 _0x5496=['update','emit','removeListener','register','cmList:','./cmList.events','save','remove'];(function(_0xcc7e73,_0x157288){var _0x2914bf=function(_0x7fda5c){while(--_0x7fda5c){_0xcc7e73['push'](_0xcc7e73['shift']());}};_0x2914bf(++_0x157288);}(_0x5496,0x185));var _0x6549=function(_0x3b20ff,_0x1d5ae7){_0x3b20ff=_0x3b20ff-0x0;var _0x4a6d51=_0x5496[_0x3b20ff];return _0x4a6d51;};'use strict';var CmListEvents=require(_0x6549('0x0'));var events=[_0x6549('0x1'),_0x6549('0x2'),_0x6549('0x3')];function createListener(_0x38d1a4,_0x15543e){return function(_0x12f65e){_0x15543e[_0x6549('0x4')](_0x38d1a4,_0x12f65e);};}function removeListener(_0x4f600e,_0x1480e9){return function(){CmListEvents[_0x6549('0x5')](_0x4f600e,_0x1480e9);};}exports[_0x6549('0x6')]=function(_0x230e63){for(var _0x28bba3=0x0,_0x3a106c=events['length'];_0x28bba3<_0x3a106c;_0x28bba3++){var _0x5431d4=events[_0x28bba3];var _0x15c580=createListener(_0x6549('0x7')+_0x5431d4,_0x230e63);CmListEvents['on'](_0x5431d4,_0x15c580);}}; \ No newline at end of file +var _0x5e9a=['removeListener','length','./cmList.events','save','remove','update','emit'];(function(_0x2abff3,_0x5c0302){var _0x5c5dc7=function(_0x451902){while(--_0x451902){_0x2abff3['push'](_0x2abff3['shift']());}};_0x5c5dc7(++_0x5c0302);}(_0x5e9a,0x160));var _0xa5e9=function(_0x2a5e24,_0x3dbc35){_0x2a5e24=_0x2a5e24-0x0;var _0x2b46b6=_0x5e9a[_0x2a5e24];return _0x2b46b6;};'use strict';var CmListEvents=require(_0xa5e9('0x0'));var events=[_0xa5e9('0x1'),_0xa5e9('0x2'),_0xa5e9('0x3')];function createListener(_0x52ba10,_0x57dc89){return function(_0xf69a09){_0x57dc89[_0xa5e9('0x4')](_0x52ba10,_0xf69a09);};}function removeListener(_0xf7a614,_0x53ebc9){return function(){CmListEvents[_0xa5e9('0x5')](_0xf7a614,_0x53ebc9);};}exports['register']=function(_0x55ec0b){for(var _0x126d09=0x0,_0x251e1c=events[_0xa5e9('0x6')];_0x126d09<_0x251e1c;_0x126d09++){var _0x4ed83e=events[_0x126d09];var _0x4b9613=createListener('cmList:'+_0x4ed83e,_0x55ec0b);CmListEvents['on'](_0x4ed83e,_0x4b9613);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 9e2f0ff..3673654 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 _0xe0e7=['addContacts','addCustomField','addAgents','put','/:id','update','delete','destroy','removeDispositions','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmList.controller','get','index','/describe','describe','/global_fields','getGlobalCustomFields','isAuthenticated','show','/:id/dispositions','/:id/contacts','/:id/contacts/csv','getContactsCsv','/:id/fields','/:id/users','getAgents','create','post'];(function(_0x93bdcb,_0x3812fa){var _0x3affd9=function(_0x3f8b8e){while(--_0x3f8b8e){_0x93bdcb['push'](_0x93bdcb['shift']());}};_0x3affd9(++_0x3812fa);}(_0xe0e7,0x1a2));var _0x7e0e=function(_0x1fb6ff,_0x474709){_0x1fb6ff=_0x1fb6ff-0x0;var _0x339f61=_0xe0e7[_0x1fb6ff];return _0x339f61;};'use strict';var multer=require('multer');var util=require(_0x7e0e('0x0'));var path=require(_0x7e0e('0x1'));var timeout=require(_0x7e0e('0x2'));var express=require(_0x7e0e('0x3'));var router=express[_0x7e0e('0x4')]();var fs_extra=require(_0x7e0e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7e0e('0x6'));var config=require(_0x7e0e('0x7'));var controller=require(_0x7e0e('0x8'));router[_0x7e0e('0x9')]('/',auth['isAuthenticated'](),controller[_0x7e0e('0xa')]);router[_0x7e0e('0x9')](_0x7e0e('0xb'),auth['isAuthenticated'](),controller[_0x7e0e('0xc')]);router['get'](_0x7e0e('0xd'),auth['isAuthenticated'](),controller[_0x7e0e('0xe')]);router['get']('/:id',auth[_0x7e0e('0xf')](),controller[_0x7e0e('0x10')]);router[_0x7e0e('0x9')](_0x7e0e('0x11'),auth['isAuthenticated'](),controller['getDispositions']);router[_0x7e0e('0x9')](_0x7e0e('0x12'),auth[_0x7e0e('0xf')](),controller['getContacts']);router[_0x7e0e('0x9')](_0x7e0e('0x13'),auth['isAuthenticated'](),controller[_0x7e0e('0x14')]);router[_0x7e0e('0x9')](_0x7e0e('0x15'),auth[_0x7e0e('0xf')](),controller['getCustomFields']);router[_0x7e0e('0x9')](_0x7e0e('0x16'),auth[_0x7e0e('0xf')](),controller[_0x7e0e('0x17')]);router['post']('/',auth['isAuthenticated'](),controller[_0x7e0e('0x18')]);router[_0x7e0e('0x19')](_0x7e0e('0x11'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x7e0e('0x19')](_0x7e0e('0x12'),auth[_0x7e0e('0xf')](),controller[_0x7e0e('0x1a')]);router[_0x7e0e('0x19')]('/:id/fields',auth[_0x7e0e('0xf')](),controller[_0x7e0e('0x1b')]);router[_0x7e0e('0x19')](_0x7e0e('0x16'),auth[_0x7e0e('0xf')](),controller[_0x7e0e('0x1c')]);router[_0x7e0e('0x1d')](_0x7e0e('0x1e'),auth[_0x7e0e('0xf')](),controller[_0x7e0e('0x1f')]);router[_0x7e0e('0x20')](_0x7e0e('0x1e'),auth[_0x7e0e('0xf')](),controller[_0x7e0e('0x21')]);router[_0x7e0e('0x20')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x7e0e('0x22')]);router[_0x7e0e('0x20')]('/:id/users',auth[_0x7e0e('0xf')](),controller[_0x7e0e('0x23')]);module[_0x7e0e('0x24')]=router; \ No newline at end of file +var _0xc16b=['getContacts','getContactsCsv','/:id/users','getAgents','post','create','addDisposition','/:id/contacts','addContacts','/:id/fields','addCustomField','update','delete','removeDispositions','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./cmList.controller','get','isAuthenticated','index','describe','/global_fields','getGlobalCustomFields','/:id','show','/:id/dispositions','getDispositions'];(function(_0x596a66,_0x2c3471){var _0x37343d=function(_0x4f76ce){while(--_0x4f76ce){_0x596a66['push'](_0x596a66['shift']());}};_0x37343d(++_0x2c3471);}(_0xc16b,0x76));var _0xbc16=function(_0x261860,_0x5405da){_0x261860=_0x261860-0x0;var _0x1e6d76=_0xc16b[_0x261860];return _0x1e6d76;};'use strict';var multer=require(_0xbc16('0x0'));var util=require(_0xbc16('0x1'));var path=require(_0xbc16('0x2'));var timeout=require(_0xbc16('0x3'));var express=require(_0xbc16('0x4'));var router=express[_0xbc16('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xbc16('0x6'));var controller=require(_0xbc16('0x7'));router[_0xbc16('0x8')]('/',auth[_0xbc16('0x9')](),controller[_0xbc16('0xa')]);router[_0xbc16('0x8')]('/describe',auth[_0xbc16('0x9')](),controller[_0xbc16('0xb')]);router[_0xbc16('0x8')](_0xbc16('0xc'),auth['isAuthenticated'](),controller[_0xbc16('0xd')]);router[_0xbc16('0x8')](_0xbc16('0xe'),auth['isAuthenticated'](),controller[_0xbc16('0xf')]);router[_0xbc16('0x8')](_0xbc16('0x10'),auth[_0xbc16('0x9')](),controller[_0xbc16('0x11')]);router[_0xbc16('0x8')]('/:id/contacts',auth[_0xbc16('0x9')](),controller[_0xbc16('0x12')]);router['get']('/:id/contacts/csv',auth[_0xbc16('0x9')](),controller[_0xbc16('0x13')]);router['get']('/:id/fields',auth[_0xbc16('0x9')](),controller['getCustomFields']);router[_0xbc16('0x8')](_0xbc16('0x14'),auth[_0xbc16('0x9')](),controller[_0xbc16('0x15')]);router[_0xbc16('0x16')]('/',auth[_0xbc16('0x9')](),controller[_0xbc16('0x17')]);router['post'](_0xbc16('0x10'),auth[_0xbc16('0x9')](),controller[_0xbc16('0x18')]);router[_0xbc16('0x16')](_0xbc16('0x19'),auth[_0xbc16('0x9')](),controller[_0xbc16('0x1a')]);router[_0xbc16('0x16')](_0xbc16('0x1b'),auth[_0xbc16('0x9')](),controller[_0xbc16('0x1c')]);router[_0xbc16('0x16')]('/:id/users',auth[_0xbc16('0x9')](),controller['addAgents']);router['put'](_0xbc16('0xe'),auth[_0xbc16('0x9')](),controller[_0xbc16('0x1d')]);router[_0xbc16('0x1e')](_0xbc16('0xe'),auth[_0xbc16('0x9')](),controller['destroy']);router[_0xbc16('0x1e')](_0xbc16('0x10'),auth['isAuthenticated'](),controller[_0xbc16('0x1f')]);router['delete'](_0xbc16('0x14'),auth[_0xbc16('0x9')](),controller[_0xbc16('0x20')]);module[_0xbc16('0x21')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index a400e03..be01518 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 _0xce77=['STRING','sequelize','exports','VIRTUAL','field'];(function(_0x30cd40,_0x1c9839){var _0x3d173b=function(_0x2e4562){while(--_0x2e4562){_0x30cd40['push'](_0x30cd40['shift']());}};_0x3d173b(++_0x1c9839);}(_0xce77,0x97));var _0x7ce7=function(_0x2552fa,_0x4c8c20){_0x2552fa=_0x2552fa-0x0;var _0x345f00=_0xce77[_0x2552fa];return _0x345f00;};'use strict';var Sequelize=require(_0x7ce7('0x0'));module[_0x7ce7('0x1')]={'name':{'type':Sequelize[_0x7ce7('0x2')],'get':function(_0x2174ea){return this['getDataValue'](_0x7ce7('0x3'));}},'field':{'type':Sequelize[_0x7ce7('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x7ce7('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x7ce7('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0x50f0=['exports','getDataValue','field','STRING'];(function(_0x38d399,_0x2263b4){var _0x2e275b=function(_0x44a59e){while(--_0x44a59e){_0x38d399['push'](_0x38d399['shift']());}};_0x2e275b(++_0x2263b4);}(_0x50f0,0xb0));var _0x050f=function(_0x11f5ff,_0xa0ef18){_0x11f5ff=_0x11f5ff-0x0;var _0x46eefb=_0x50f0[_0x11f5ff];return _0x46eefb;};'use strict';var Sequelize=require('sequelize');module[_0x050f('0x0')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x342f69){return this[_0x050f('0x1')](_0x050f('0x2'));}},'field':{'type':Sequelize[_0x050f('0x3')],'allowNull':![]},'operator':{'type':Sequelize[_0x050f('0x3')],'allowNull':![]},'value':{'type':Sequelize[_0x050f('0x3')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index b0beb87..1b7a2cd 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x407194,_0x3a6c2c){var _0x1b9946=function(_0x2c234b){while(--_0x2c234b){_0x407194['push'](_0x407194['shift']());}};_0x1b9946(++_0x3a6c2c);}(_0x7a54,0x106));var _0x47a5=function(_0x493067,_0x46895c){_0x493067=_0x493067-0x0;var _0x4dbbc7=_0x7a54[_0x493067];return _0x4dbbc7;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file +var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x27151,_0x1e7605){var _0x3bdd70=function(_0x3a8657){while(--_0x3a8657){_0x27151['push'](_0x27151['shift']());}};_0x3bdd70(++_0x1e7605);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 47a11f7..3fb9ae3 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 _0x03e3=['rimraf','./condition.attributes','exports','define','Condition','tools_conditions','util','api','moment','bluebird','path'];(function(_0x593564,_0x43583f){var _0x211a89=function(_0x40afd6){while(--_0x40afd6){_0x593564['push'](_0x593564['shift']());}};_0x211a89(++_0x43583f);}(_0x03e3,0x192));var _0x303e=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x03e3[_0x16b9ed];return _0x66b1f8;};'use strict';var _=require('lodash');var util=require(_0x303e('0x0'));var logger=require('../../config/logger')(_0x303e('0x1'));var moment=require(_0x303e('0x2'));var BPromise=require(_0x303e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x303e('0x4'));var rimraf=require(_0x303e('0x5'));var config=require('../../config/environment');var attributes=require(_0x303e('0x6'));module[_0x303e('0x7')]=function(_0x4a6b8f,_0x279f2c){return _0x4a6b8f[_0x303e('0x8')](_0x303e('0x9'),attributes,{'tableName':_0x303e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0860=['moment','bluebird','path','rimraf','../../config/environment','./condition.attributes','exports','define','Condition','../../config/logger','api'];(function(_0xc0c22,_0x468c5d){var _0xeb2318=function(_0x2fcdfd){while(--_0x2fcdfd){_0xc0c22['push'](_0xc0c22['shift']());}};_0xeb2318(++_0x468c5d);}(_0x0860,0xc4));var _0x0086=function(_0x4277ac,_0x2e758e){_0x4277ac=_0x4277ac-0x0;var _0x131cef=_0x0860[_0x4277ac];return _0x131cef;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0086('0x0'))(_0x0086('0x1'));var moment=require(_0x0086('0x2'));var BPromise=require(_0x0086('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0086('0x4'));var rimraf=require(_0x0086('0x5'));var config=require(_0x0086('0x6'));var attributes=require(_0x0086('0x7'));module[_0x0086('0x8')]=function(_0x4fd1f9,_0x153b7b){return _0x4fd1f9[_0x0086('0x9')](_0x0086('0xa'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index a3e63d3..dad0242 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 _0xca4e=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','error','code','Condition,\x20%s,\x20%s','message','info','result'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0xca4e,0x69));var _0xeca4=function(_0x2bf3a1,_0xdeadbd){_0x2bf3a1=_0x2bf3a1-0x0;var _0x57d6d8=_0xca4e[_0x2bf3a1];return _0x57d6d8;};'use strict';var _=require(_0xeca4('0x0'));var util=require(_0xeca4('0x1'));var moment=require(_0xeca4('0x2'));var BPromise=require(_0xeca4('0x3'));var rs=require(_0xeca4('0x4'));var fs=require('fs');var Redis=require(_0xeca4('0x5'));var db=require(_0xeca4('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xeca4('0x7'));var config=require(_0xeca4('0x8'));var jayson=require(_0xeca4('0x9'));var client=jayson['client'][_0xeca4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5b92b1,_0x2525ff,_0x5e6bdd){return new BPromise(function(_0x193eb9,_0x586475){return client[_0xeca4('0xb')](_0x5b92b1,_0x5e6bdd)[_0xeca4('0xc')](function(_0x4e93c1){logger['info']('Condition,\x20%s,\x20%s',_0x2525ff,_0xeca4('0xd'));logger[_0xeca4('0xe')]('Condition,\x20%s,\x20%s,\x20%s',_0x2525ff,_0xeca4('0xd'),JSON['stringify'](_0x4e93c1));if(_0x4e93c1[_0xeca4('0xf')]){if(_0x4e93c1[_0xeca4('0xf')][_0xeca4('0x10')]===0x1f4){logger['error'](_0xeca4('0x11'),_0x2525ff,_0x4e93c1['error']['message']);return _0x586475(_0x4e93c1[_0xeca4('0xf')]['message']);}logger[_0xeca4('0xf')](_0xeca4('0x11'),_0x2525ff,_0x4e93c1[_0xeca4('0xf')][_0xeca4('0x12')]);return _0x193eb9(_0x4e93c1[_0xeca4('0xf')][_0xeca4('0x12')]);}else{logger[_0xeca4('0x13')](_0xeca4('0x11'),_0x2525ff,'request\x20sent');_0x193eb9(_0x4e93c1[_0xeca4('0x14')][_0xeca4('0x12')]);}})['catch'](function(_0xe46842){logger[_0xeca4('0xf')](_0xeca4('0x11'),_0x2525ff,_0xe46842);_0x586475(_0xe46842);});});} \ No newline at end of file +var _0xc737=['Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','Condition,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xc737,0x196));var _0x7c73=function(_0x3a9887,_0x124705){_0x3a9887=_0x3a9887-0x0;var _0x31174d=_0xc737[_0x3a9887];return _0x31174d;};'use strict';var _=require(_0x7c73('0x0'));var util=require(_0x7c73('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7c73('0x2'));var db=require(_0x7c73('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7c73('0x4'))(_0x7c73('0x5'));var config=require(_0x7c73('0x6'));var jayson=require(_0x7c73('0x7'));var client=jayson[_0x7c73('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45a94d,_0x15ba3a,_0xca8752){return new BPromise(function(_0xf178e1,_0x3a9b53){return client['request'](_0x45a94d,_0xca8752)['then'](function(_0x2d2002){logger['info'](_0x7c73('0x9'),_0x15ba3a,_0x7c73('0xa'));logger[_0x7c73('0xb')](_0x7c73('0xc'),_0x15ba3a,_0x7c73('0xa'),JSON[_0x7c73('0xd')](_0x2d2002));if(_0x2d2002[_0x7c73('0xe')]){if(_0x2d2002['error'][_0x7c73('0xf')]===0x1f4){logger[_0x7c73('0xe')](_0x7c73('0x9'),_0x15ba3a,_0x2d2002[_0x7c73('0xe')]['message']);return _0x3a9b53(_0x2d2002[_0x7c73('0xe')][_0x7c73('0x10')]);}logger['error'](_0x7c73('0x9'),_0x15ba3a,_0x2d2002['error'][_0x7c73('0x10')]);return _0xf178e1(_0x2d2002['error'][_0x7c73('0x10')]);}else{logger['info']('Condition,\x20%s,\x20%s',_0x15ba3a,'request\x20sent');_0xf178e1(_0x2d2002[_0x7c73('0x11')]['message']);}})[_0x7c73('0x12')](function(_0x369297){logger[_0x7c73('0xe')]('Condition,\x20%s,\x20%s',_0x15ba3a,_0x369297);_0x3a9b53(_0x369297);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 7357826..e963cb4 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 _0xe3bf=['put','isAuthenticated','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller'];(function(_0x12d6c8,_0x5b82dd){var _0x5c7d04=function(_0x22a3e9){while(--_0x22a3e9){_0x12d6c8['push'](_0x12d6c8['shift']());}};_0x5c7d04(++_0x5b82dd);}(_0xe3bf,0xb9));var _0xfe3b=function(_0x1e3638,_0x29ae62){_0x1e3638=_0x1e3638-0x0;var _0x48430e=_0xe3bf[_0x1e3638];return _0x48430e;};'use strict';var multer=require(_0xfe3b('0x0'));var util=require(_0xfe3b('0x1'));var path=require('path');var timeout=require(_0xfe3b('0x2'));var express=require(_0xfe3b('0x3'));var router=express[_0xfe3b('0x4')]();var fs_extra=require(_0xfe3b('0x5'));var auth=require(_0xfe3b('0x6'));var interaction=require(_0xfe3b('0x7'));var config=require(_0xfe3b('0x8'));var controller=require(_0xfe3b('0x9'));router[_0xfe3b('0xa')]('/:id',auth[_0xfe3b('0xb')](),controller[_0xfe3b('0xc')]);router[_0xfe3b('0xd')]('/:id',auth[_0xfe3b('0xb')](),controller[_0xfe3b('0xe')]);module['exports']=router; \ No newline at end of file +var _0x4212=['../../components/interaction/service','./condition.controller','put','/:id','isAuthenticated','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x4212,0xdb));var _0x2421=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x4212[_0x56482c];return _0x5aae7a;};'use strict';var multer=require(_0x2421('0x0'));var util=require('util');var path=require(_0x2421('0x1'));var timeout=require(_0x2421('0x2'));var express=require('express');var router=express[_0x2421('0x3')]();var fs_extra=require(_0x2421('0x4'));var auth=require(_0x2421('0x5'));var interaction=require(_0x2421('0x6'));var config=require('../../config/environment');var controller=require(_0x2421('0x7'));router[_0x2421('0x8')](_0x2421('0x9'),auth[_0x2421('0xa')](),controller[_0x2421('0xb')]);router[_0x2421('0xc')](_0x2421('0x9'),auth[_0x2421('0xa')](),controller[_0x2421('0xd')]);module[_0x2421('0xe')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index e4dd852..1b17320 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 _0x3d76=['INTEGER','sequelize','exports','STRING','name'];(function(_0x384447,_0x41669a){var _0x3810db=function(_0x3f1288){while(--_0x3f1288){_0x384447['push'](_0x384447['shift']());}};_0x3810db(++_0x41669a);}(_0x3d76,0x13c));var _0x63d7=function(_0x3b8f2e,_0x5a99a8){_0x3b8f2e=_0x3b8f2e-0x0;var _0x1433d5=_0x3d76[_0x3b8f2e];return _0x1433d5;};'use strict';var Sequelize=require(_0x63d7('0x0'));module[_0x63d7('0x1')]={'name':{'type':Sequelize[_0x63d7('0x2')],'allowNull':![],'unique':_0x63d7('0x3')},'OrderBy':{'type':Sequelize[_0x63d7('0x4')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x63d7('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x7bc8=['name','exports','STRING'];(function(_0x2ed502,_0x3b7fab){var _0x191886=function(_0x446add){while(--_0x446add){_0x2ed502['push'](_0x2ed502['shift']());}};_0x191886(++_0x3b7fab);}(_0x7bc8,0x15a));var _0x87bc=function(_0xeb5ef8,_0x1963d8){_0xeb5ef8=_0xeb5ef8-0x0;var _0x2b186f=_0x7bc8[_0xeb5ef8];return _0x2b186f;};'use strict';var Sequelize=require('sequelize');module[_0x87bc('0x0')]={'name':{'type':Sequelize[_0x87bc('0x1')],'allowNull':![],'unique':_0x87bc('0x2')},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x87bc('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index bb585b5..4cc7960 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 _0x2032=['limit','count','set','Content-Range','apply','save','then','destroy','get','ContactItemTypes','sendStatus','error','stack','name','send','index','map','ContactItemType','fieldName','model','query','keys','filters','intersection','attributes','fields','nolimit','order','where','pick','merge','type','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined'];(function(_0x2810af,_0x336b0a){var _0x2be61b=function(_0x50c323){while(--_0x50c323){_0x2810af['push'](_0x2810af['shift']());}};_0x2be61b(++_0x336b0a);}(_0x2032,0xd9));var _0x2203=function(_0x114646,_0x2bdaaf){_0x114646=_0x114646-0x0;var _0x25e6e4=_0x2032[_0x114646];return _0x25e6e4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2203('0x0'));var zipdir=require(_0x2203('0x1'));var jsonpatch=require(_0x2203('0x2'));var rp=require('request-promise');var moment=require(_0x2203('0x3'));var BPromise=require(_0x2203('0x4'));var Mustache=require('mustache');var util=require(_0x2203('0x5'));var path=require(_0x2203('0x6'));var sox=require(_0x2203('0x7'));var csv=require(_0x2203('0x8'));var ejs=require(_0x2203('0x9'));var fs=require('fs');var fs_extra=require(_0x2203('0xa'));var _=require(_0x2203('0xb'));var squel=require(_0x2203('0xc'));var crypto=require(_0x2203('0xd'));var jsforce=require(_0x2203('0xe'));var deskjs=require(_0x2203('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2203('0x10'));var Redis=require('ioredis');var authService=require(_0x2203('0x11'));var qs=require(_0x2203('0x12'));var as=require(_0x2203('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2203('0x14'))('api');var utils=require(_0x2203('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2203('0x16'));var db=require(_0x2203('0x17'))['db'];function respondWithStatusCode(_0x4b9376,_0x583bc7){_0x583bc7=_0x583bc7||0xcc;return function(_0x585c76){if(_0x585c76){return _0x4b9376['sendStatus'](_0x583bc7);}return _0x4b9376['status'](_0x583bc7)[_0x2203('0x18')]();};}function respondWithResult(_0x538b30,_0x592e47){_0x592e47=_0x592e47||0xc8;return function(_0x21a3af){if(_0x21a3af){return _0x538b30[_0x2203('0x19')](_0x592e47)[_0x2203('0x1a')](_0x21a3af);}};}function respondWithFilteredResult(_0x41af85,_0x226209){return function(_0x3fe0a8){if(_0x3fe0a8){var _0x2c36e6=typeof _0x226209[_0x2203('0x1b')]===_0x2203('0x1c')&&typeof _0x226209[_0x2203('0x1d')]==='undefined';var _0x280eda=_0x3fe0a8[_0x2203('0x1e')];var _0x4893ff=_0x2c36e6?0x0:_0x226209[_0x2203('0x1b')];var _0x8906e1=_0x2c36e6?_0x3fe0a8['count']:_0x226209[_0x2203('0x1b')]+_0x226209['limit'];var _0x2904ba;if(_0x8906e1>=_0x280eda){_0x8906e1=_0x280eda;_0x2904ba=0xc8;}else{_0x2904ba=0xce;}_0x41af85[_0x2203('0x19')](_0x2904ba);return _0x41af85[_0x2203('0x1f')](_0x2203('0x20'),_0x4893ff+'-'+_0x8906e1+'/'+_0x280eda)[_0x2203('0x1a')](_0x3fe0a8);}return null;};}function patchUpdates(_0x449039){return function(_0x538c23){try{jsonpatch[_0x2203('0x21')](_0x538c23,_0x449039,!![]);}catch(_0x50822b){return BPromise['reject'](_0x50822b);}return _0x538c23[_0x2203('0x22')]();};}function saveUpdates(_0x496d82,_0x3b8ef9){return function(_0x5bfe61){if(_0x5bfe61){return _0x5bfe61['update'](_0x496d82)[_0x2203('0x23')](function(_0x5e29cd){return _0x5e29cd;});}return null;};}function removeEntity(_0x5c8da9,_0x226374){return function(_0x2718f5){if(_0x2718f5){return _0x2718f5[_0x2203('0x24')]()[_0x2203('0x23')](function(){var _0x1244f4=_0x2718f5[_0x2203('0x25')]({'plain':!![]});var _0x49c12=_0x2203('0x26');return db['UserProfileResource'][_0x2203('0x24')]({'where':{'type':_0x49c12,'resourceId':_0x1244f4['id']}})[_0x2203('0x23')](function(){return _0x2718f5;});})[_0x2203('0x23')](function(){_0x5c8da9['status'](0xcc)[_0x2203('0x18')]();});}};}function handleEntityNotFound(_0x1cec17,_0x5c5fd3){return function(_0xd6e109){if(!_0xd6e109){_0x1cec17[_0x2203('0x27')](0x194);}return _0xd6e109;};}function handleError(_0x1c6a77,_0x46b8b9){_0x46b8b9=_0x46b8b9||0x1f4;return function(_0x28ae02){logger[_0x2203('0x28')](_0x28ae02[_0x2203('0x29')]);if(_0x28ae02['name']){delete _0x28ae02[_0x2203('0x2a')];}_0x1c6a77[_0x2203('0x19')](_0x46b8b9)[_0x2203('0x2b')](_0x28ae02);};}exports[_0x2203('0x2c')]=function(_0x52a426,_0x3a8e23){var _0x21ff0d={},_0x287c95={},_0xf59954={'count':0x0,'rows':[]};var _0x520602=_[_0x2203('0x2d')](db[_0x2203('0x2e')]['rawAttributes'],function(_0x5c0157){return{'name':_0x5c0157[_0x2203('0x2f')],'type':_0x5c0157['type']['key']};});_0x287c95[_0x2203('0x30')]=_[_0x2203('0x2d')](_0x520602,_0x2203('0x2a'));_0x287c95[_0x2203('0x31')]=_[_0x2203('0x32')](_0x52a426['query']);_0x287c95[_0x2203('0x33')]=_[_0x2203('0x34')](_0x287c95['model'],_0x287c95[_0x2203('0x31')]);_0x21ff0d[_0x2203('0x35')]=_[_0x2203('0x34')](_0x287c95[_0x2203('0x30')],qs[_0x2203('0x36')](_0x52a426[_0x2203('0x31')][_0x2203('0x36')]));_0x21ff0d[_0x2203('0x35')]=_0x21ff0d[_0x2203('0x35')]['length']?_0x21ff0d[_0x2203('0x35')]:_0x287c95[_0x2203('0x30')];if(!_0x52a426['query']['hasOwnProperty'](_0x2203('0x37'))){_0x21ff0d['limit']=qs[_0x2203('0x1d')](_0x52a426[_0x2203('0x31')][_0x2203('0x1d')]);_0x21ff0d['offset']=qs['offset'](_0x52a426[_0x2203('0x31')]['offset']);}_0x21ff0d[_0x2203('0x38')]=qs['sort'](_0x52a426[_0x2203('0x31')]['sort']);_0x21ff0d[_0x2203('0x39')]=qs[_0x2203('0x33')](_[_0x2203('0x3a')](_0x52a426[_0x2203('0x31')],_0x287c95[_0x2203('0x33')]),_0x520602);if(_0x52a426['query']['filter']){_0x21ff0d['where']=_[_0x2203('0x3b')](_0x21ff0d[_0x2203('0x39')],{'$or':_[_0x2203('0x2d')](_0x520602,function(_0x3b0c7a){if(_0x3b0c7a[_0x2203('0x3c')]!==_0x2203('0x3d')){var _0x1c7e3d={};_0x1c7e3d[_0x3b0c7a['name']]={'$like':'%'+_0x52a426[_0x2203('0x31')][_0x2203('0x3e')]+'%'};return _0x1c7e3d;}})});}_0x21ff0d=_[_0x2203('0x3b')]({},_0x21ff0d,_0x52a426[_0x2203('0x3f')]);var _0x493d12={'where':_0x21ff0d['where']};return db[_0x2203('0x2e')]['count'](_0x493d12)[_0x2203('0x23')](function(_0x446209){_0xf59954[_0x2203('0x1e')]=_0x446209;if(_0x52a426['query']['includeAll']){_0x21ff0d[_0x2203('0x40')]=[{'all':!![]}];}return db[_0x2203('0x2e')][_0x2203('0x41')](_0x21ff0d);})[_0x2203('0x23')](function(_0x372709){_0xf59954[_0x2203('0x42')]=_0x372709;return _0xf59954;})['then'](respondWithFilteredResult(_0x3a8e23,_0x21ff0d))[_0x2203('0x43')](handleError(_0x3a8e23,null));};exports[_0x2203('0x44')]=function(_0x3a866c,_0x266076){var _0x16b452={'raw':!![],'where':{'id':_0x3a866c[_0x2203('0x45')]['id']}},_0x36b99f={};_0x36b99f[_0x2203('0x30')]=_[_0x2203('0x32')](db[_0x2203('0x2e')]['rawAttributes']);_0x36b99f[_0x2203('0x31')]=_[_0x2203('0x32')](_0x3a866c[_0x2203('0x31')]);_0x36b99f[_0x2203('0x33')]=_['intersection'](_0x36b99f['model'],_0x36b99f[_0x2203('0x31')]);_0x16b452['attributes']=_[_0x2203('0x34')](_0x36b99f[_0x2203('0x30')],qs[_0x2203('0x36')](_0x3a866c[_0x2203('0x31')]['fields']));_0x16b452[_0x2203('0x35')]=_0x16b452[_0x2203('0x35')]['length']?_0x16b452[_0x2203('0x35')]:_0x36b99f[_0x2203('0x30')];if(_0x3a866c[_0x2203('0x31')][_0x2203('0x46')]){_0x16b452['include']=[{'all':!![]}];}_0x16b452=_['merge']({},_0x16b452,_0x3a866c[_0x2203('0x3f')]);return db['ContactItemType']['find'](_0x16b452)[_0x2203('0x23')](handleEntityNotFound(_0x266076,null))[_0x2203('0x23')](respondWithResult(_0x266076,null))[_0x2203('0x43')](handleError(_0x266076,null));};exports['create']=function(_0x4c1496,_0x131aec){return db[_0x2203('0x2e')][_0x2203('0x47')](_0x4c1496[_0x2203('0x48')],{})[_0x2203('0x23')](function(_0x21fd78){var _0x4a7f4e=_0x4c1496[_0x2203('0x49')]['get']({'plain':!![]});if(!_0x4a7f4e)throw new Error(_0x2203('0x4a'));if(_0x4a7f4e[_0x2203('0x4b')]===_0x2203('0x49')){var _0x1e49dd=_0x21fd78['get']({'plain':!![]});var _0x506795=_0x2203('0x26');return db[_0x2203('0x4c')][_0x2203('0x4d')]({'where':{'name':_0x506795,'userProfileId':_0x4a7f4e[_0x2203('0x4e')]},'raw':!![]})['then'](function(_0x4de47a){if(_0x4de47a&&_0x4de47a['autoAssociation']===0x0){return db[_0x2203('0x4f')][_0x2203('0x47')]({'name':_0x1e49dd['name'],'resourceId':_0x1e49dd['id'],'type':_0x4de47a[_0x2203('0x2a')],'sectionId':_0x4de47a['id']},{})[_0x2203('0x23')](function(){return _0x21fd78;});}else{return _0x21fd78;}})['catch'](function(_0x32b1db){logger[_0x2203('0x28')](_0x2203('0x50'),_0x32b1db);throw _0x32b1db;});}return _0x21fd78;})[_0x2203('0x23')](respondWithResult(_0x131aec,0xc9))['catch'](handleError(_0x131aec,null));};exports[_0x2203('0x51')]=function(_0x5268d6,_0x3858f0){if(_0x5268d6[_0x2203('0x48')]['id']){delete _0x5268d6['body']['id'];}return db[_0x2203('0x2e')][_0x2203('0x4d')]({'where':{'id':_0x5268d6[_0x2203('0x45')]['id']}})[_0x2203('0x23')](handleEntityNotFound(_0x3858f0,null))[_0x2203('0x23')](saveUpdates(_0x5268d6[_0x2203('0x48')],null))['then'](respondWithResult(_0x3858f0,null))['catch'](handleError(_0x3858f0,null));};exports[_0x2203('0x24')]=function(_0x524356,_0x56e881){return db[_0x2203('0x2e')][_0x2203('0x4d')]({'where':{'id':_0x524356[_0x2203('0x45')]['id']}})['then'](handleEntityNotFound(_0x56e881,null))[_0x2203('0x23')](db['CmContactHasItem']['update']({'ItemTypeId':null},{'where':{'ItemTypeId':_0x524356[_0x2203('0x45')]['id']}}))['then'](removeEntity(_0x56e881,null))['catch'](handleError(_0x56e881,null));}; \ No newline at end of file +var _0x4137=['userProfileId','autoAssociation','find','params','CmContactHasItem','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','json','offset','limit','count','set','apply','reject','save','update','destroy','then','get','end','sendStatus','stack','name','send','index','map','ContactItemType','rawAttributes','type','key','model','keys','filters','intersection','attributes','fields','length','query','order','sort','where','pick','filter','merge','include','findAll','rows','catch','show','includeAll','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x25207d,_0x5cce53){var _0x547923=function(_0x12d6a4){while(--_0x12d6a4){_0x25207d['push'](_0x25207d['shift']());}};_0x547923(++_0x5cce53);}(_0x4137,0xf8));var _0x7413=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x4137[_0x413feb];return _0x40ee88;};'use strict';var emlformat=require(_0x7413('0x0'));var rimraf=require(_0x7413('0x1'));var zipdir=require(_0x7413('0x2'));var jsonpatch=require(_0x7413('0x3'));var rp=require(_0x7413('0x4'));var moment=require(_0x7413('0x5'));var BPromise=require(_0x7413('0x6'));var Mustache=require(_0x7413('0x7'));var util=require(_0x7413('0x8'));var path=require(_0x7413('0x9'));var sox=require(_0x7413('0xa'));var csv=require(_0x7413('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7413('0xc'));var _=require(_0x7413('0xd'));var squel=require(_0x7413('0xe'));var crypto=require(_0x7413('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x7413('0x10'));var toCsv=require(_0x7413('0xb'));var querystring=require('querystring');var Papa=require(_0x7413('0x11'));var Redis=require(_0x7413('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x7413('0x13'));var as=require(_0x7413('0x14'));var hardwareService=require(_0x7413('0x15'));var logger=require(_0x7413('0x16'))(_0x7413('0x17'));var utils=require('../../config/utils');var config=require(_0x7413('0x18'));var licenseUtil=require(_0x7413('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x18a874,_0xa26ca4){_0xa26ca4=_0xa26ca4||0xcc;return function(_0x13e6bd){if(_0x13e6bd){return _0x18a874['sendStatus'](_0xa26ca4);}return _0x18a874['status'](_0xa26ca4)['end']();};}function respondWithResult(_0x2267f6,_0x336c4c){_0x336c4c=_0x336c4c||0xc8;return function(_0x49f0f6){if(_0x49f0f6){return _0x2267f6[_0x7413('0x1a')](_0x336c4c)[_0x7413('0x1b')](_0x49f0f6);}};}function respondWithFilteredResult(_0x4955d3,_0x38b3d1){return function(_0x50f301){if(_0x50f301){var _0x4b9a5b=typeof _0x38b3d1[_0x7413('0x1c')]==='undefined'&&typeof _0x38b3d1[_0x7413('0x1d')]==='undefined';var _0x2036b6=_0x50f301[_0x7413('0x1e')];var _0x19157f=_0x4b9a5b?0x0:_0x38b3d1[_0x7413('0x1c')];var _0x2a3417=_0x4b9a5b?_0x50f301[_0x7413('0x1e')]:_0x38b3d1['offset']+_0x38b3d1[_0x7413('0x1d')];var _0x17c062;if(_0x2a3417>=_0x2036b6){_0x2a3417=_0x2036b6;_0x17c062=0xc8;}else{_0x17c062=0xce;}_0x4955d3[_0x7413('0x1a')](_0x17c062);return _0x4955d3[_0x7413('0x1f')]('Content-Range',_0x19157f+'-'+_0x2a3417+'/'+_0x2036b6)[_0x7413('0x1b')](_0x50f301);}return null;};}function patchUpdates(_0x12d94d){return function(_0x206afc){try{jsonpatch[_0x7413('0x20')](_0x206afc,_0x12d94d,!![]);}catch(_0x409392){return BPromise[_0x7413('0x21')](_0x409392);}return _0x206afc[_0x7413('0x22')]();};}function saveUpdates(_0x4e18cb,_0x56a06a){return function(_0x5f12a2){if(_0x5f12a2){return _0x5f12a2[_0x7413('0x23')](_0x4e18cb)['then'](function(_0x1585ba){return _0x1585ba;});}return null;};}function removeEntity(_0x372944,_0x3b0c81){return function(_0x2fc0f4){if(_0x2fc0f4){return _0x2fc0f4[_0x7413('0x24')]()[_0x7413('0x25')](function(){var _0x1d97fd=_0x2fc0f4[_0x7413('0x26')]({'plain':!![]});var _0x1d455b='ContactItemTypes';return db['UserProfileResource'][_0x7413('0x24')]({'where':{'type':_0x1d455b,'resourceId':_0x1d97fd['id']}})['then'](function(){return _0x2fc0f4;});})[_0x7413('0x25')](function(){_0x372944[_0x7413('0x1a')](0xcc)[_0x7413('0x27')]();});}};}function handleEntityNotFound(_0x4c2e90,_0x35e0fd){return function(_0x896552){if(!_0x896552){_0x4c2e90[_0x7413('0x28')](0x194);}return _0x896552;};}function handleError(_0x4843fd,_0x19970c){_0x19970c=_0x19970c||0x1f4;return function(_0x2e521f){logger['error'](_0x2e521f[_0x7413('0x29')]);if(_0x2e521f['name']){delete _0x2e521f[_0x7413('0x2a')];}_0x4843fd[_0x7413('0x1a')](_0x19970c)[_0x7413('0x2b')](_0x2e521f);};}exports[_0x7413('0x2c')]=function(_0x25fa52,_0x2004ea){var _0x5bb3ea={},_0x1ffb6f={},_0x17c342={'count':0x0,'rows':[]};var _0x39db32=_[_0x7413('0x2d')](db[_0x7413('0x2e')][_0x7413('0x2f')],function(_0x185cfe){return{'name':_0x185cfe['fieldName'],'type':_0x185cfe[_0x7413('0x30')][_0x7413('0x31')]};});_0x1ffb6f[_0x7413('0x32')]=_[_0x7413('0x2d')](_0x39db32,_0x7413('0x2a'));_0x1ffb6f['query']=_[_0x7413('0x33')](_0x25fa52['query']);_0x1ffb6f[_0x7413('0x34')]=_[_0x7413('0x35')](_0x1ffb6f[_0x7413('0x32')],_0x1ffb6f['query']);_0x5bb3ea[_0x7413('0x36')]=_['intersection'](_0x1ffb6f[_0x7413('0x32')],qs[_0x7413('0x37')](_0x25fa52['query']['fields']));_0x5bb3ea[_0x7413('0x36')]=_0x5bb3ea[_0x7413('0x36')][_0x7413('0x38')]?_0x5bb3ea['attributes']:_0x1ffb6f['model'];if(!_0x25fa52[_0x7413('0x39')]['hasOwnProperty']('nolimit')){_0x5bb3ea[_0x7413('0x1d')]=qs['limit'](_0x25fa52[_0x7413('0x39')][_0x7413('0x1d')]);_0x5bb3ea[_0x7413('0x1c')]=qs[_0x7413('0x1c')](_0x25fa52[_0x7413('0x39')]['offset']);}_0x5bb3ea[_0x7413('0x3a')]=qs[_0x7413('0x3b')](_0x25fa52[_0x7413('0x39')][_0x7413('0x3b')]);_0x5bb3ea[_0x7413('0x3c')]=qs[_0x7413('0x34')](_[_0x7413('0x3d')](_0x25fa52[_0x7413('0x39')],_0x1ffb6f[_0x7413('0x34')]),_0x39db32);if(_0x25fa52[_0x7413('0x39')][_0x7413('0x3e')]){_0x5bb3ea[_0x7413('0x3c')]=_['merge'](_0x5bb3ea[_0x7413('0x3c')],{'$or':_['map'](_0x39db32,function(_0x56cb6f){if(_0x56cb6f['type']!=='VIRTUAL'){var _0x5c86ad={};_0x5c86ad[_0x56cb6f[_0x7413('0x2a')]]={'$like':'%'+_0x25fa52['query']['filter']+'%'};return _0x5c86ad;}})});}_0x5bb3ea=_[_0x7413('0x3f')]({},_0x5bb3ea,_0x25fa52['options']);var _0x4c6746={'where':_0x5bb3ea[_0x7413('0x3c')]};return db[_0x7413('0x2e')][_0x7413('0x1e')](_0x4c6746)[_0x7413('0x25')](function(_0x8049c0){_0x17c342['count']=_0x8049c0;if(_0x25fa52[_0x7413('0x39')]['includeAll']){_0x5bb3ea[_0x7413('0x40')]=[{'all':!![]}];}return db[_0x7413('0x2e')][_0x7413('0x41')](_0x5bb3ea);})[_0x7413('0x25')](function(_0x3f7da2){_0x17c342[_0x7413('0x42')]=_0x3f7da2;return _0x17c342;})[_0x7413('0x25')](respondWithFilteredResult(_0x2004ea,_0x5bb3ea))[_0x7413('0x43')](handleError(_0x2004ea,null));};exports[_0x7413('0x44')]=function(_0x1dd908,_0x38cd61){var _0x1e8bbd={'raw':!![],'where':{'id':_0x1dd908['params']['id']}},_0x3fbec4={};_0x3fbec4[_0x7413('0x32')]=_[_0x7413('0x33')](db[_0x7413('0x2e')][_0x7413('0x2f')]);_0x3fbec4[_0x7413('0x39')]=_[_0x7413('0x33')](_0x1dd908[_0x7413('0x39')]);_0x3fbec4[_0x7413('0x34')]=_[_0x7413('0x35')](_0x3fbec4[_0x7413('0x32')],_0x3fbec4[_0x7413('0x39')]);_0x1e8bbd['attributes']=_[_0x7413('0x35')](_0x3fbec4['model'],qs[_0x7413('0x37')](_0x1dd908[_0x7413('0x39')][_0x7413('0x37')]));_0x1e8bbd[_0x7413('0x36')]=_0x1e8bbd[_0x7413('0x36')][_0x7413('0x38')]?_0x1e8bbd[_0x7413('0x36')]:_0x3fbec4[_0x7413('0x32')];if(_0x1dd908[_0x7413('0x39')][_0x7413('0x45')]){_0x1e8bbd['include']=[{'all':!![]}];}_0x1e8bbd=_['merge']({},_0x1e8bbd,_0x1dd908[_0x7413('0x46')]);return db['ContactItemType']['find'](_0x1e8bbd)[_0x7413('0x25')](handleEntityNotFound(_0x38cd61,null))[_0x7413('0x25')](respondWithResult(_0x38cd61,null))['catch'](handleError(_0x38cd61,null));};exports[_0x7413('0x47')]=function(_0x586d25,_0x562bae){return db[_0x7413('0x2e')]['create'](_0x586d25[_0x7413('0x48')],{})[_0x7413('0x25')](function(_0x1a7338){var _0x5fe361=_0x586d25[_0x7413('0x49')][_0x7413('0x26')]({'plain':!![]});if(!_0x5fe361)throw new Error(_0x7413('0x4a'));if(_0x5fe361[_0x7413('0x4b')]===_0x7413('0x49')){var _0x2031e3=_0x1a7338['get']({'plain':!![]});var _0x369891='ContactItemTypes';return db['UserProfileSection']['find']({'where':{'name':_0x369891,'userProfileId':_0x5fe361[_0x7413('0x4c')]},'raw':!![]})[_0x7413('0x25')](function(_0x453510){if(_0x453510&&_0x453510[_0x7413('0x4d')]===0x0){return db['UserProfileResource']['create']({'name':_0x2031e3[_0x7413('0x2a')],'resourceId':_0x2031e3['id'],'type':_0x453510['name'],'sectionId':_0x453510['id']},{})[_0x7413('0x25')](function(){return _0x1a7338;});}else{return _0x1a7338;}})['catch'](function(_0x4f8353){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4f8353);throw _0x4f8353;});}return _0x1a7338;})['then'](respondWithResult(_0x562bae,0xc9))[_0x7413('0x43')](handleError(_0x562bae,null));};exports[_0x7413('0x23')]=function(_0x229573,_0x2ffec6){if(_0x229573[_0x7413('0x48')]['id']){delete _0x229573['body']['id'];}return db[_0x7413('0x2e')][_0x7413('0x4e')]({'where':{'id':_0x229573[_0x7413('0x4f')]['id']}})['then'](handleEntityNotFound(_0x2ffec6,null))[_0x7413('0x25')](saveUpdates(_0x229573['body'],null))['then'](respondWithResult(_0x2ffec6,null))[_0x7413('0x43')](handleError(_0x2ffec6,null));};exports[_0x7413('0x24')]=function(_0x1939a8,_0x287365){return db[_0x7413('0x2e')][_0x7413('0x4e')]({'where':{'id':_0x1939a8['params']['id']}})[_0x7413('0x25')](handleEntityNotFound(_0x287365,null))['then'](db[_0x7413('0x50')]['update']({'ItemTypeId':null},{'where':{'ItemTypeId':_0x1939a8[_0x7413('0x4f')]['id']}}))['then'](removeEntity(_0x287365,null))[_0x7413('0x43')](handleError(_0x287365,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 5e54411..44a4f17 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 _0xe7ae=['util','../../config/logger','bluebird','path','rimraf','../../config/environment','./contactItemType.attributes','exports','define','ContactItemType','tools_contact_item_types','lodash'];(function(_0x4901a2,_0x5bc071){var _0x6aaa0e=function(_0x2c5328){while(--_0x2c5328){_0x4901a2['push'](_0x4901a2['shift']());}};_0x6aaa0e(++_0x5bc071);}(_0xe7ae,0xd7));var _0xee7a=function(_0x14fd8d,_0x2619a8){_0x14fd8d=_0x14fd8d-0x0;var _0x4b3548=_0xe7ae[_0x14fd8d];return _0x4b3548;};'use strict';var _=require(_0xee7a('0x0'));var util=require(_0xee7a('0x1'));var logger=require(_0xee7a('0x2'))('api');var moment=require('moment');var BPromise=require(_0xee7a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xee7a('0x4'));var rimraf=require(_0xee7a('0x5'));var config=require(_0xee7a('0x6'));var attributes=require(_0xee7a('0x7'));module[_0xee7a('0x8')]=function(_0x1d5e41,_0x31cb64){return _0x1d5e41[_0xee7a('0x9')](_0xee7a('0xa'),attributes,{'tableName':_0xee7a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8acf=['path','rimraf','../../config/environment','./contactItemType.attributes','exports','ContactItemType','tools_contact_item_types','lodash','../../config/logger','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8acf,0xe3));var _0xf8ac=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x8acf[_0x263a74];return _0x2aa86c;};'use strict';var _=require(_0xf8ac('0x0'));var util=require('util');var logger=require(_0xf8ac('0x1'))('api');var moment=require('moment');var BPromise=require(_0xf8ac('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf8ac('0x3'));var rimraf=require(_0xf8ac('0x4'));var config=require(_0xf8ac('0x5'));var attributes=require(_0xf8ac('0x6'));module[_0xf8ac('0x7')]=function(_0x492d44,_0x430ebd){return _0x492d44['define'](_0xf8ac('0x8'),attributes,{'tableName':_0xf8ac('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index 6553b24..e8438b8 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 _0xd0eb=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','error','code','message','info','catch'];(function(_0x26d96d,_0xf6ef52){var _0x457578=function(_0x4ca946){while(--_0x4ca946){_0x26d96d['push'](_0x26d96d['shift']());}};_0x457578(++_0xf6ef52);}(_0xd0eb,0x73));var _0xbd0e=function(_0x52666e,_0x5b3776){_0x52666e=_0x52666e-0x0;var _0x515330=_0xd0eb[_0x52666e];return _0x515330;};'use strict';var _=require('lodash');var util=require(_0xbd0e('0x0'));var moment=require(_0xbd0e('0x1'));var BPromise=require(_0xbd0e('0x2'));var rs=require(_0xbd0e('0x3'));var fs=require('fs');var Redis=require(_0xbd0e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbd0e('0x5'));var logger=require(_0xbd0e('0x6'))(_0xbd0e('0x7'));var config=require(_0xbd0e('0x8'));var jayson=require(_0xbd0e('0x9'));var client=jayson[_0xbd0e('0xa')][_0xbd0e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3c6455,_0x58934b,_0x41a663){return new BPromise(function(_0x4ff5b7,_0x143de5){return client[_0xbd0e('0xc')](_0x3c6455,_0x41a663)[_0xbd0e('0xd')](function(_0x59b5e8){logger['info'](_0xbd0e('0xe'),_0x58934b,_0xbd0e('0xf'));logger[_0xbd0e('0x10')](_0xbd0e('0x11'),_0x58934b,_0xbd0e('0xf'),JSON['stringify'](_0x59b5e8));if(_0x59b5e8[_0xbd0e('0x12')]){if(_0x59b5e8[_0xbd0e('0x12')][_0xbd0e('0x13')]===0x1f4){logger[_0xbd0e('0x12')](_0xbd0e('0xe'),_0x58934b,_0x59b5e8[_0xbd0e('0x12')]['message']);return _0x143de5(_0x59b5e8[_0xbd0e('0x12')][_0xbd0e('0x14')]);}logger[_0xbd0e('0x12')](_0xbd0e('0xe'),_0x58934b,_0x59b5e8[_0xbd0e('0x12')][_0xbd0e('0x14')]);return _0x4ff5b7(_0x59b5e8[_0xbd0e('0x12')][_0xbd0e('0x14')]);}else{logger[_0xbd0e('0x15')](_0xbd0e('0xe'),_0x58934b,'request\x20sent');_0x4ff5b7(_0x59b5e8['result']['message']);}})[_0xbd0e('0x16')](function(_0x1568d7){logger[_0xbd0e('0x12')]('ContactItemType,\x20%s,\x20%s',_0x58934b,_0x1568d7);_0x143de5(_0x1568d7);});});} \ No newline at end of file +var _0xfb4f=['jayson/promise','client','request','then','info','ContactItemType,\x20%s,\x20%s','debug','ContactItemType,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x115e0e,_0x1f8e56){var _0x2534c2=function(_0x2a2f06){while(--_0x2a2f06){_0x115e0e['push'](_0x115e0e['shift']());}};_0x2534c2(++_0x1f8e56);}(_0xfb4f,0x8c));var _0xffb4=function(_0x4d203f,_0x4b4464){_0x4d203f=_0x4d203f-0x0;var _0x44bce4=_0xfb4f[_0x4d203f];return _0x44bce4;};'use strict';var _=require(_0xffb4('0x0'));var util=require(_0xffb4('0x1'));var moment=require(_0xffb4('0x2'));var BPromise=require(_0xffb4('0x3'));var rs=require(_0xffb4('0x4'));var fs=require('fs');var Redis=require(_0xffb4('0x5'));var db=require(_0xffb4('0x6'))['db'];var utils=require(_0xffb4('0x7'));var logger=require('../../config/logger')(_0xffb4('0x8'));var config=require(_0xffb4('0x9'));var jayson=require(_0xffb4('0xa'));var client=jayson[_0xffb4('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a3204,_0x39d528,_0x49fb9a){return new BPromise(function(_0x36ac5d,_0x39ee6d){return client[_0xffb4('0xc')](_0x2a3204,_0x49fb9a)[_0xffb4('0xd')](function(_0xaee03d){logger[_0xffb4('0xe')](_0xffb4('0xf'),_0x39d528,'request\x20sent');logger[_0xffb4('0x10')](_0xffb4('0x11'),_0x39d528,_0xffb4('0x12'),JSON[_0xffb4('0x13')](_0xaee03d));if(_0xaee03d[_0xffb4('0x14')]){if(_0xaee03d[_0xffb4('0x14')][_0xffb4('0x15')]===0x1f4){logger['error']('ContactItemType,\x20%s,\x20%s',_0x39d528,_0xaee03d[_0xffb4('0x14')][_0xffb4('0x16')]);return _0x39ee6d(_0xaee03d[_0xffb4('0x14')][_0xffb4('0x16')]);}logger[_0xffb4('0x14')](_0xffb4('0xf'),_0x39d528,_0xaee03d[_0xffb4('0x14')]['message']);return _0x36ac5d(_0xaee03d[_0xffb4('0x14')][_0xffb4('0x16')]);}else{logger['info'](_0xffb4('0xf'),_0x39d528,_0xffb4('0x12'));_0x36ac5d(_0xaee03d[_0xffb4('0x17')][_0xffb4('0x16')]);}})[_0xffb4('0x18')](function(_0x862bd5){logger[_0xffb4('0x14')](_0xffb4('0xf'),_0x39d528,_0x862bd5);_0x39ee6d(_0x862bd5);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 1f642d3..1fb0c78 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 _0x2420=['destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','post','create','update'];(function(_0x58a049,_0x3782e3){var _0x5674cd=function(_0x1e4668){while(--_0x1e4668){_0x58a049['push'](_0x58a049['shift']());}};_0x5674cd(++_0x3782e3);}(_0x2420,0xd2));var _0x0242=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x2420[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require(_0x0242('0x0'));var util=require(_0x0242('0x1'));var path=require(_0x0242('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0242('0x3')]();var fs_extra=require(_0x0242('0x4'));var auth=require(_0x0242('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0242('0x6'));var controller=require('./contactItemType.controller');router[_0x0242('0x7')]('/',auth[_0x0242('0x8')](),controller[_0x0242('0x9')]);router[_0x0242('0x7')](_0x0242('0xa'),auth[_0x0242('0x8')](),controller['show']);router[_0x0242('0xb')]('/',auth[_0x0242('0x8')](),controller[_0x0242('0xc')]);router['put']('/:id',auth[_0x0242('0x8')](),controller[_0x0242('0xd')]);router['delete'](_0x0242('0xa'),auth[_0x0242('0x8')](),controller[_0x0242('0xe')]);module[_0x0242('0xf')]=router; \ No newline at end of file +var _0xf31b=['update','destroy','exports','util','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','/:id','show','post','create','put'];(function(_0x177a3e,_0xdf7e48){var _0x53dc44=function(_0x192252){while(--_0x192252){_0x177a3e['push'](_0x177a3e['shift']());}};_0x53dc44(++_0xdf7e48);}(_0xf31b,0x93));var _0xbf31=function(_0x429f49,_0x3d1a9f){_0x429f49=_0x429f49-0x0;var _0x31bc38=_0xf31b[_0x429f49];return _0x31bc38;};'use strict';var multer=require('multer');var util=require(_0xbf31('0x0'));var path=require('path');var timeout=require(_0xbf31('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xbf31('0x2'));var auth=require(_0xbf31('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xbf31('0x4'));var controller=require(_0xbf31('0x5'));router[_0xbf31('0x6')]('/',auth[_0xbf31('0x7')](),controller['index']);router[_0xbf31('0x6')](_0xbf31('0x8'),auth[_0xbf31('0x7')](),controller[_0xbf31('0x9')]);router[_0xbf31('0xa')]('/',auth[_0xbf31('0x7')](),controller[_0xbf31('0xb')]);router[_0xbf31('0xc')](_0xbf31('0x8'),auth['isAuthenticated'](),controller[_0xbf31('0xd')]);router['delete'](_0xbf31('0x8'),auth[_0xbf31('0x7')](),controller[_0xbf31('0xe')]);module[_0xbf31('0xf')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 5207bf2..bb6ee12 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(_0x58afd5,_0x534a48){var _0x3e503b=function(_0x27ba44){while(--_0x27ba44){_0x58afd5['push'](_0x58afd5['shift']());}};_0x3e503b(++_0x534a48);}(_0xb7e7,0x121));var _0x7b7e=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xb7e7[_0x502c7d];return _0x30b7ed;};'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 _0xb10b=['name','sequelize','STRING'];(function(_0x51d186,_0x1ad18a){var _0x46a739=function(_0x13bba7){while(--_0x13bba7){_0x51d186['push'](_0x51d186['shift']());}};_0x46a739(++_0x1ad18a);}(_0xb10b,0x12a));var _0xbb10=function(_0x25f39c,_0x4f231a){_0x25f39c=_0x25f39c-0x0;var _0x19bb4a=_0xb10b[_0x25f39c];return _0x19bb4a;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 593a24a..22c7eb0 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 _0xb382=['api','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./dashboard.socket','register','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','save','update','then','CustomDashboards','destroy','error','stack','name','send','index','map','Dashboard','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','iframe','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrSmsAccounts','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','zip-dir','fast-json-patch','moment','util','path','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb382,0x6c));var _0x2b38=function(_0x1e484a,_0x1bb40a){_0x1e484a=_0x1e484a-0x0;var _0x419b03=_0xb382[_0x1e484a];return _0x419b03;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2b38('0x0'));var jsonpatch=require(_0x2b38('0x1'));var rp=require('request-promise');var moment=require(_0x2b38('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2b38('0x3'));var path=require(_0x2b38('0x4'));var sox=require('sox');var csv=require(_0x2b38('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2b38('0x6'));var _=require(_0x2b38('0x7'));var squel=require(_0x2b38('0x8'));var crypto=require('crypto');var jsforce=require(_0x2b38('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x2b38('0x5'));var querystring=require(_0x2b38('0xa'));var Papa=require(_0x2b38('0xb'));var Redis=require(_0x2b38('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x2b38('0xd'));var as=require(_0x2b38('0xe'));var hardwareService=require(_0x2b38('0xf'));var logger=require(_0x2b38('0x10'))(_0x2b38('0x11'));var utils=require('../../config/utils');var config=require(_0x2b38('0x12'));var licenseUtil=require(_0x2b38('0x13'));var db=require('../../mysqldb')['db'];config[_0x2b38('0x14')]=_[_0x2b38('0x15')](config[_0x2b38('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0x2b38('0x16'))(new Redis(config[_0x2b38('0x14')]));require(_0x2b38('0x17'))[_0x2b38('0x18')](socket);function respondWithStatusCode(_0x5c7ebb,_0x48adb8){_0x48adb8=_0x48adb8||0xcc;return function(_0x4aa7fd){if(_0x4aa7fd){return _0x5c7ebb[_0x2b38('0x19')](_0x48adb8);}return _0x5c7ebb[_0x2b38('0x1a')](_0x48adb8)[_0x2b38('0x1b')]();};}function respondWithResult(_0x3a5080,_0x5782dd){_0x5782dd=_0x5782dd||0xc8;return function(_0x167f16){if(_0x167f16){return _0x3a5080['status'](_0x5782dd)['json'](_0x167f16);}};}function respondWithFilteredResult(_0x11f67c,_0x1286a2){return function(_0x57d14f){if(_0x57d14f){var _0xc88645=typeof _0x1286a2[_0x2b38('0x1c')]===_0x2b38('0x1d')&&typeof _0x1286a2['limit']==='undefined';var _0x457c24=_0x57d14f[_0x2b38('0x1e')];var _0x3e8bac=_0xc88645?0x0:_0x1286a2['offset'];var _0x378b28=_0xc88645?_0x57d14f[_0x2b38('0x1e')]:_0x1286a2['offset']+_0x1286a2[_0x2b38('0x1f')];var _0x32ddd9;if(_0x378b28>=_0x457c24){_0x378b28=_0x457c24;_0x32ddd9=0xc8;}else{_0x32ddd9=0xce;}_0x11f67c[_0x2b38('0x1a')](_0x32ddd9);return _0x11f67c[_0x2b38('0x20')](_0x2b38('0x21'),_0x3e8bac+'-'+_0x378b28+'/'+_0x457c24)[_0x2b38('0x22')](_0x57d14f);}return null;};}function patchUpdates(_0x5d475c){return function(_0xd0b7f1){try{jsonpatch['apply'](_0xd0b7f1,_0x5d475c,!![]);}catch(_0x46b25d){return BPromise['reject'](_0x46b25d);}return _0xd0b7f1[_0x2b38('0x23')]();};}function saveUpdates(_0x4e8f40,_0x209f97){return function(_0x27c257){if(_0x27c257){return _0x27c257[_0x2b38('0x24')](_0x4e8f40)['then'](function(_0x5124c3){return _0x5124c3;});}return null;};}function removeEntity(_0x265619,_0x86ed0e){return function(_0x5e4d70){if(_0x5e4d70){return _0x5e4d70['destroy']()[_0x2b38('0x25')](function(){var _0x48f413=_0x5e4d70['get']({'plain':!![]});var _0x1403a3=_0x2b38('0x26');return db['UserProfileResource'][_0x2b38('0x27')]({'where':{'type':_0x1403a3,'resourceId':_0x48f413['id']}})[_0x2b38('0x25')](function(){return _0x5e4d70;});})[_0x2b38('0x25')](function(){_0x265619['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xeefb6,_0x1ac187){return function(_0x1213e5){if(!_0x1213e5){_0xeefb6[_0x2b38('0x19')](0x194);}return _0x1213e5;};}function handleError(_0x37ff4f,_0x540dcd){_0x540dcd=_0x540dcd||0x1f4;return function(_0xac3a6e){logger[_0x2b38('0x28')](_0xac3a6e[_0x2b38('0x29')]);if(_0xac3a6e['name']){delete _0xac3a6e[_0x2b38('0x2a')];}_0x37ff4f['status'](_0x540dcd)[_0x2b38('0x2b')](_0xac3a6e);};}exports[_0x2b38('0x2c')]=function(_0x3cc033,_0xf66a36){var _0x31d34e={},_0x42ffa3={},_0x29427a={'count':0x0,'rows':[]};var _0x28b4cd=_[_0x2b38('0x2d')](db[_0x2b38('0x2e')][_0x2b38('0x2f')],function(_0x3e1257){return{'name':_0x3e1257[_0x2b38('0x30')],'type':_0x3e1257[_0x2b38('0x31')][_0x2b38('0x32')]};});_0x42ffa3[_0x2b38('0x33')]=_[_0x2b38('0x2d')](_0x28b4cd,'name');_0x42ffa3[_0x2b38('0x34')]=_[_0x2b38('0x35')](_0x3cc033['query']);_0x42ffa3[_0x2b38('0x36')]=_[_0x2b38('0x37')](_0x42ffa3[_0x2b38('0x33')],_0x42ffa3[_0x2b38('0x34')]);_0x31d34e[_0x2b38('0x38')]=_[_0x2b38('0x37')](_0x42ffa3[_0x2b38('0x33')],qs[_0x2b38('0x39')](_0x3cc033[_0x2b38('0x34')]['fields']));_0x31d34e['attributes']=_0x31d34e[_0x2b38('0x38')][_0x2b38('0x3a')]?_0x31d34e[_0x2b38('0x38')]:_0x42ffa3['model'];if(!_0x3cc033[_0x2b38('0x34')][_0x2b38('0x3b')](_0x2b38('0x3c'))){_0x31d34e['limit']=qs[_0x2b38('0x1f')](_0x3cc033[_0x2b38('0x34')][_0x2b38('0x1f')]);_0x31d34e[_0x2b38('0x1c')]=qs[_0x2b38('0x1c')](_0x3cc033['query'][_0x2b38('0x1c')]);}_0x31d34e['order']=qs[_0x2b38('0x3d')](_0x3cc033[_0x2b38('0x34')]['sort']);_0x31d34e[_0x2b38('0x3e')]=qs[_0x2b38('0x36')](_[_0x2b38('0x3f')](_0x3cc033[_0x2b38('0x34')],_0x42ffa3[_0x2b38('0x36')]),_0x28b4cd);if(_0x3cc033[_0x2b38('0x34')][_0x2b38('0x40')]){_0x31d34e['where']=_[_0x2b38('0x41')](_0x31d34e[_0x2b38('0x3e')],{'$or':_[_0x2b38('0x2d')](_0x28b4cd,function(_0x4f4a20){if(_0x4f4a20[_0x2b38('0x31')]!=='VIRTUAL'){var _0x316468={};_0x316468[_0x4f4a20[_0x2b38('0x2a')]]={'$like':'%'+_0x3cc033[_0x2b38('0x34')][_0x2b38('0x40')]+'%'};return _0x316468;}})});}_0x31d34e=_[_0x2b38('0x41')]({},_0x31d34e,_0x3cc033[_0x2b38('0x42')]);var _0x464270={'where':_0x31d34e[_0x2b38('0x3e')]};return db['Dashboard'][_0x2b38('0x1e')](_0x464270)[_0x2b38('0x25')](function(_0x5497b9){_0x29427a['count']=_0x5497b9;if(_0x3cc033[_0x2b38('0x34')][_0x2b38('0x43')]){_0x31d34e[_0x2b38('0x44')]=[{'all':!![]}];}return db[_0x2b38('0x2e')]['findAll'](_0x31d34e);})['then'](function(_0x148e1e){_0x29427a['rows']=_0x148e1e;return _0x29427a;})[_0x2b38('0x25')](respondWithFilteredResult(_0xf66a36,_0x31d34e))[_0x2b38('0x45')](handleError(_0xf66a36,null));};exports[_0x2b38('0x46')]=function(_0x38e3e6,_0x2bebeb){var _0x39dffb={'raw':![],'where':{'id':_0x38e3e6[_0x2b38('0x47')]['id']}},_0x5599e1={};_0x5599e1['model']=_['keys'](db[_0x2b38('0x2e')][_0x2b38('0x2f')]);_0x5599e1[_0x2b38('0x34')]=_[_0x2b38('0x35')](_0x38e3e6['query']);_0x5599e1[_0x2b38('0x36')]=_[_0x2b38('0x37')](_0x5599e1[_0x2b38('0x33')],_0x5599e1[_0x2b38('0x34')]);_0x39dffb[_0x2b38('0x38')]=_['intersection'](_0x5599e1[_0x2b38('0x33')],qs[_0x2b38('0x39')](_0x38e3e6[_0x2b38('0x34')][_0x2b38('0x39')]));_0x39dffb['attributes']=_0x39dffb[_0x2b38('0x38')]['length']?_0x39dffb[_0x2b38('0x38')]:_0x5599e1['model'];if(_0x38e3e6[_0x2b38('0x34')][_0x2b38('0x43')]){_0x39dffb[_0x2b38('0x44')]=[{'all':!![]}];}_0x39dffb=_[_0x2b38('0x41')]({},_0x39dffb,_0x38e3e6[_0x2b38('0x42')]);return db[_0x2b38('0x2e')][_0x2b38('0x48')](_0x39dffb)[_0x2b38('0x25')](handleEntityNotFound(_0x2bebeb,null))[_0x2b38('0x25')](respondWithResult(_0x2bebeb,null))[_0x2b38('0x45')](handleError(_0x2bebeb,null));};exports['create']=function(_0x10baa3,_0x5439fb){return db[_0x2b38('0x2e')][_0x2b38('0x49')](_0x10baa3[_0x2b38('0x4a')],{})[_0x2b38('0x25')](function(_0x123e11){var _0x14db77=_0x10baa3[_0x2b38('0x4b')][_0x2b38('0x4c')]({'plain':!![]});if(!_0x14db77)throw new Error(_0x2b38('0x4d'));if(_0x14db77[_0x2b38('0x4e')]==='user'){var _0x570989=_0x123e11[_0x2b38('0x4c')]({'plain':!![]});var _0x1ca592='CustomDashboards';return db[_0x2b38('0x4f')][_0x2b38('0x48')]({'where':{'name':_0x1ca592,'userProfileId':_0x14db77[_0x2b38('0x50')]},'raw':!![]})['then'](function(_0xa6b323){if(_0xa6b323&&_0xa6b323[_0x2b38('0x51')]===0x0){return db[_0x2b38('0x52')][_0x2b38('0x49')]({'name':_0x570989['name'],'resourceId':_0x570989['id'],'type':_0xa6b323[_0x2b38('0x2a')],'sectionId':_0xa6b323['id']},{})[_0x2b38('0x25')](function(){return _0x123e11;});}else{return _0x123e11;}})[_0x2b38('0x45')](function(_0x2ba978){logger[_0x2b38('0x28')](_0x2b38('0x53'),_0x2ba978);throw _0x2ba978;});}return _0x123e11;})[_0x2b38('0x25')](respondWithResult(_0x5439fb,0xc9))[_0x2b38('0x45')](handleError(_0x5439fb,null));};exports[_0x2b38('0x54')]=function(_0x4c86cd,_0x33af38){var _0x56a3f8={'where':{'id':_0x4c86cd[_0x2b38('0x47')]['id']}},_0x3988e2={};_0x3988e2[_0x2b38('0x33')]=_[_0x2b38('0x35')](db[_0x2b38('0x2e')][_0x2b38('0x2f')]);_0x56a3f8[_0x2b38('0x38')]=_[_0x2b38('0x37')](_0x3988e2[_0x2b38('0x33')],qs[_0x2b38('0x39')](_0x4c86cd[_0x2b38('0x34')][_0x2b38('0x39')]));_0x56a3f8['attributes']=_0x56a3f8['attributes'][_0x2b38('0x3a')]?_0x56a3f8[_0x2b38('0x38')]:_0x3988e2[_0x2b38('0x33')];if(_0x4c86cd[_0x2b38('0x34')]['includeAll']){_0x56a3f8[_0x2b38('0x44')]=[{'all':!![]}];}_0x56a3f8=_[_0x2b38('0x41')]({},_0x56a3f8,_0x4c86cd[_0x2b38('0x42')]);return db[_0x2b38('0x2e')][_0x2b38('0x48')](_0x56a3f8)[_0x2b38('0x25')](handleEntityNotFound(_0x33af38,null))['then'](function(_0x5b09d3){if(_0x5b09d3){var _0x1727a3=_0x5b09d3[_0x2b38('0x4c')]({'plain':!![]});_0x1727a3=qs[_0x2b38('0x55')](_0x1727a3,['id',_0x2b38('0x56'),_0x2b38('0x57')]);_0x4c86cd[_0x2b38('0x4a')]=_[_0x2b38('0x55')](_0x4c86cd[_0x2b38('0x4a')],['id','createdAt',_0x2b38('0x57')]);return db['Dashboard'][_0x2b38('0x49')](_['merge'](_0x1727a3,_0x4c86cd[_0x2b38('0x4a')]),{'include':_0x4c86cd['query'][_0x2b38('0x43')]?[{'all':!![]}]:undefined})[_0x2b38('0x25')](function(_0x13a235){var _0x233888=_0x4c86cd[_0x2b38('0x4b')][_0x2b38('0x4c')]({'plain':!![]});if(!_0x233888)throw new Error(_0x2b38('0x4d'));if(_0x233888[_0x2b38('0x4e')]==='user'){var _0x283abd=_0x13a235[_0x2b38('0x4c')]({'plain':!![]});var _0x403413=_0x2b38('0x26');return db[_0x2b38('0x4f')][_0x2b38('0x48')]({'where':{'name':_0x403413,'userProfileId':_0x233888[_0x2b38('0x50')]},'raw':!![]})[_0x2b38('0x25')](function(_0x12884e){if(_0x12884e&&_0x12884e['autoAssociation']===0x0){return db[_0x2b38('0x52')][_0x2b38('0x49')]({'name':_0x283abd[_0x2b38('0x2a')],'resourceId':_0x283abd['id'],'type':_0x12884e[_0x2b38('0x2a')],'sectionId':_0x12884e['id']},{})['then'](function(){return _0x13a235;});}else{return _0x13a235;}})[_0x2b38('0x45')](function(_0x27b31c){logger[_0x2b38('0x28')](_0x2b38('0x53'),_0x27b31c);throw _0x27b31c;});}return _0x13a235;});}})[_0x2b38('0x25')](respondWithResult(_0x33af38,0xc9))[_0x2b38('0x45')](handleError(_0x33af38,null));};exports[_0x2b38('0x24')]=function(_0x51917f,_0x51caa2){if(_0x51917f[_0x2b38('0x4a')]['id']){delete _0x51917f[_0x2b38('0x4a')]['id'];}return db[_0x2b38('0x2e')][_0x2b38('0x48')]({'where':{'id':_0x51917f['params']['id']}})[_0x2b38('0x25')](handleEntityNotFound(_0x51caa2,null))[_0x2b38('0x25')](saveUpdates(_0x51917f[_0x2b38('0x4a')],null))[_0x2b38('0x25')](respondWithResult(_0x51caa2,null))[_0x2b38('0x45')](handleError(_0x51caa2,null));};exports[_0x2b38('0x27')]=function(_0x19f783,_0x2dc934){return db[_0x2b38('0x2e')]['find']({'where':{'id':_0x19f783['params']['id']}})[_0x2b38('0x25')](handleEntityNotFound(_0x2dc934,null))[_0x2b38('0x25')](removeEntity(_0x2dc934,null))[_0x2b38('0x45')](handleError(_0x2dc934,null));};function widgetAttributes(_0x32b957){try{switch(_0x32b957[_0x2b38('0x31')]){case _0x2b38('0x58'):return[{'name':'attrUrl','value':_0x32b957[_0x2b38('0x59')]||(_0x32b957[_0x2b38('0x5a')]&&_0x32b957[_0x2b38('0x5a')][0x0]?_0x32b957[_0x2b38('0x5a')][0x0][_0x2b38('0x5b')]:undefined)||'https://'}];case _0x2b38('0x5c'):return[{'name':_0x2b38('0x5d'),'value':_0x32b957[_0x2b38('0x5d')]||(_0x32b957['attrs']&&_0x32b957[_0x2b38('0x5a')][0x0]?_0x32b957[_0x2b38('0x5a')][0x0][_0x2b38('0x5b')]:undefined)||''}];case _0x2b38('0x5e'):return[{'name':'attrHourFormat','value':_0x32b957[_0x2b38('0x5f')]||(_0x32b957[_0x2b38('0x5a')]&&_0x32b957[_0x2b38('0x5a')][0x0]?_0x32b957[_0x2b38('0x5a')][0x0][_0x2b38('0x5b')]:undefined)||_0x2b38('0x60')},{'name':'attrTimezone','value':_0x32b957[_0x2b38('0x61')]||(_0x32b957[_0x2b38('0x5a')]&&_0x32b957['attrs'][0x1]?_0x32b957[_0x2b38('0x5a')][0x1][_0x2b38('0x5b')]:undefined)||_0x2b38('0x62')},{'name':'attrFontSize','value':_0x32b957[_0x2b38('0x63')]||(_0x32b957[_0x2b38('0x5a')]&&_0x32b957[_0x2b38('0x5a')][0x2]?_0x32b957[_0x2b38('0x5a')][0x2][_0x2b38('0x5b')]:undefined)||0xc}];case _0x2b38('0x64'):return[{'name':_0x2b38('0x65'),'value':_0x32b957[_0x2b38('0x65')]||(_0x32b957[_0x2b38('0x5a')]&&_0x32b957[_0x2b38('0x5a')][0x0]?_0x32b957[_0x2b38('0x5a')][0x0]['value']:undefined)||_0x2b38('0x66')},{'name':_0x2b38('0x67'),'value':_0x32b957[_0x2b38('0x67')]||(_0x32b957[_0x2b38('0x5a')]&&_0x32b957['attrs'][0x1]?_0x32b957[_0x2b38('0x5a')][0x1][_0x2b38('0x5b')]:undefined)||[]},{'name':_0x2b38('0x63'),'value':_0x32b957['attrFontSize']||(_0x32b957[_0x2b38('0x5a')]&&_0x32b957[_0x2b38('0x5a')][0x2]?_0x32b957[_0x2b38('0x5a')][0x2][_0x2b38('0x5b')]:undefined)||0x14},{'name':_0x2b38('0x68'),'value':_0x32b957[_0x2b38('0x68')]||(_0x32b957['attrs']&&_0x32b957[_0x2b38('0x5a')][0x3]?_0x32b957[_0x2b38('0x5a')][0x3]['value']:undefined)||_0x2b38('0x69')},{'name':_0x2b38('0x6a'),'value':_0x32b957[_0x2b38('0x6a')]||(_0x32b957[_0x2b38('0x5a')]&&_0x32b957[_0x2b38('0x5a')][0x4]?_0x32b957[_0x2b38('0x5a')][0x4][_0x2b38('0x5b')]:undefined)||''},{'name':_0x2b38('0x6b'),'value':_0x32b957[_0x2b38('0x6b')]||(_0x32b957[_0x2b38('0x5a')]&&_0x32b957[_0x2b38('0x5a')][0x5]?_0x32b957['attrs'][0x5]['value']:undefined)||''},{'name':'attrSmsAccounts','value':_0x32b957['attrSmsAccounts']||(_0x32b957['attrs']&&_0x32b957['attrs'][0x6]?_0x32b957['attrs'][0x6][_0x2b38('0x5b')]:undefined)||''},{'name':_0x2b38('0x6c'),'value':_0x32b957['attrOpenchannelAccounts']||(_0x32b957[_0x2b38('0x5a')]&&_0x32b957[_0x2b38('0x5a')][0x7]?_0x32b957[_0x2b38('0x5a')][0x7]['value']:undefined)||''},{'name':_0x2b38('0x6d'),'value':_0x32b957[_0x2b38('0x6d')]||(_0x32b957[_0x2b38('0x5a')]&&_0x32b957['attrs'][0x8]?_0x32b957[_0x2b38('0x5a')][0x8][_0x2b38('0x5b')]:undefined)||''},{'name':_0x2b38('0x6e'),'value':_0x32b957[_0x2b38('0x6e')]||(_0x32b957[_0x2b38('0x5a')]&&_0x32b957['attrs'][0x9]?_0x32b957['attrs'][0x9][_0x2b38('0x5b')]:undefined)||''}];case'multibar-chart':case _0x2b38('0x6f'):return[{'name':_0x2b38('0x70'),'value':_0x32b957[_0x2b38('0x70')]||(_0x32b957['attrs']&&_0x32b957['attrs'][0x0]?_0x32b957[_0x2b38('0x5a')][0x0][_0x2b38('0x5b')]:undefined)||'total'},{'name':_0x2b38('0x71'),'value':_0x32b957[_0x2b38('0x71')]||(_0x32b957[_0x2b38('0x5a')]&&_0x32b957[_0x2b38('0x5a')][0x1]?_0x32b957[_0x2b38('0x5a')][0x1][_0x2b38('0x5b')]:undefined)||null},{'name':_0x2b38('0x72'),'value':_0x32b957[_0x2b38('0x72')]||(_0x32b957[_0x2b38('0x5a')]&&_0x32b957[_0x2b38('0x5a')][0x2]?_0x32b957[_0x2b38('0x5a')][0x2][_0x2b38('0x5b')]:undefined)||null},{'name':_0x2b38('0x67'),'value':_0x32b957[_0x2b38('0x67')]||(_0x32b957[_0x2b38('0x5a')]&&_0x32b957[_0x2b38('0x5a')][0x3]?_0x32b957['attrs'][0x3]['value']:undefined)||[]},{'name':_0x2b38('0x68'),'value':_0x32b957[_0x2b38('0x68')]||(_0x32b957[_0x2b38('0x5a')]&&_0x32b957[_0x2b38('0x5a')][0x4]?_0x32b957[_0x2b38('0x5a')][0x4][_0x2b38('0x5b')]:undefined)||_0x2b38('0x69')},{'name':_0x2b38('0x6a'),'value':_0x32b957[_0x2b38('0x6a')]||(_0x32b957[_0x2b38('0x5a')]&&_0x32b957[_0x2b38('0x5a')][0x5]?_0x32b957['attrs'][0x5]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0x32b957['attrFaxAccounts']||(_0x32b957[_0x2b38('0x5a')]&&_0x32b957[_0x2b38('0x5a')][0x6]?_0x32b957[_0x2b38('0x5a')][0x6][_0x2b38('0x5b')]:undefined)||''},{'name':_0x2b38('0x73'),'value':_0x32b957[_0x2b38('0x73')]||(_0x32b957[_0x2b38('0x5a')]&&_0x32b957[_0x2b38('0x5a')][0x7]?_0x32b957[_0x2b38('0x5a')][0x7][_0x2b38('0x5b')]:undefined)||''},{'name':_0x2b38('0x6c'),'value':_0x32b957['attrOpenchannelAccounts']||(_0x32b957[_0x2b38('0x5a')]&&_0x32b957[_0x2b38('0x5a')][0x8]?_0x32b957[_0x2b38('0x5a')][0x8][_0x2b38('0x5b')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x32b957[_0x2b38('0x6d')]||(_0x32b957['attrs']&&_0x32b957['attrs'][0x9]?_0x32b957[_0x2b38('0x5a')][0x9][_0x2b38('0x5b')]:undefined)||''},{'name':'attrChatWebsites','value':_0x32b957[_0x2b38('0x6e')]||(_0x32b957[_0x2b38('0x5a')]&&_0x32b957[_0x2b38('0x5a')][0xa]?_0x32b957[_0x2b38('0x5a')][0xa][_0x2b38('0x5b')]:undefined)||''}];case'web-report':return[{'name':'attrReport','type':_0x32b957[_0x2b38('0x74')]||(_0x32b957[_0x2b38('0x5a')]&&_0x32b957['attrs'][0x0]?_0x32b957['attrs'][0x0][_0x2b38('0x31')]:undefined)||null,'value':_0x32b957[_0x2b38('0x75')]||(_0x32b957['attrs']&&_0x32b957[_0x2b38('0x5a')][0x0]?_0x32b957[_0x2b38('0x5a')][0x0][_0x2b38('0x5b')]:undefined)||null},{'name':'attrRefresh','value':_0x32b957[_0x2b38('0x76')]||(_0x32b957[_0x2b38('0x5a')]&&_0x32b957[_0x2b38('0x5a')][0x1]?_0x32b957[_0x2b38('0x5a')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x48ddea){logger['error'](_0x2b38('0x77'),JSON[_0x2b38('0x78')](_0x48ddea));return[];}}exports[_0x2b38('0x79')]=function(_0x79267f,_0x25481a,_0x42a439){if(_0x79267f[_0x2b38('0x4a')]['id']){delete _0x79267f[_0x2b38('0x4a')]['id'];}return db[_0x2b38('0x2e')][_0x2b38('0x48')]({'where':{'id':_0x79267f[_0x2b38('0x47')]['id']}})[_0x2b38('0x25')](handleEntityNotFound(_0x25481a,null))[_0x2b38('0x25')](function(_0x12be6c){if(_0x12be6c){_0x79267f[_0x2b38('0x4a')][_0x2b38('0x7a')]=_0x12be6c['id'];_0x79267f[_0x2b38('0x4a')][_0x2b38('0x5a')]=widgetAttributes(_0x79267f[_0x2b38('0x4a')]);return db[_0x2b38('0x7b')][_0x2b38('0x49')](_0x79267f[_0x2b38('0x4a')]);}})[_0x2b38('0x25')](respondWithResult(_0x25481a,null))['catch'](handleError(_0x25481a,null));};exports['getItems']=function(_0x2d3111,_0x92790b,_0xb5bc04){var _0x2d34df={};var _0x2fe62e={};var _0x35edfc;var _0x5262d4;return db['Dashboard']['findOne']({'where':{'id':_0x2d3111[_0x2b38('0x47')]['id']}})[_0x2b38('0x25')](handleEntityNotFound(_0x92790b,null))[_0x2b38('0x25')](function(_0x2f63db){if(_0x2f63db){_0x35edfc=_0x2f63db;_0x2fe62e[_0x2b38('0x33')]=_['keys'](db[_0x2b38('0x7b')]['rawAttributes']);_0x2fe62e['query']=_['keys'](_0x2d3111[_0x2b38('0x34')]);_0x2fe62e['filters']=_[_0x2b38('0x37')](_0x2fe62e[_0x2b38('0x33')],_0x2fe62e[_0x2b38('0x34')]);_0x2d34df['attributes']=_[_0x2b38('0x37')](_0x2fe62e[_0x2b38('0x33')],qs[_0x2b38('0x39')](_0x2d3111['query']['fields']));_0x2d34df[_0x2b38('0x38')]=_0x2d34df[_0x2b38('0x38')][_0x2b38('0x3a')]?_0x2d34df[_0x2b38('0x38')]:_0x2fe62e['model'];_0x2d34df['order']=qs[_0x2b38('0x3d')](_0x2d3111['query'][_0x2b38('0x3d')]);_0x2d34df[_0x2b38('0x3e')]=qs['filters'](_['pick'](_0x2d3111['query'],_0x2fe62e[_0x2b38('0x36')]));if(_0x2d3111['query'][_0x2b38('0x40')]){_0x2d34df[_0x2b38('0x3e')]=_[_0x2b38('0x41')](_0x2d34df[_0x2b38('0x3e')],{'$or':_['map'](_0x2d34df['attributes'],function(_0x40a78a){var _0x55103e={};_0x55103e[_0x40a78a]={'$like':'%'+_0x2d3111[_0x2b38('0x34')]['filter']+'%'};return _0x55103e;})});}_0x2d34df=_[_0x2b38('0x41')]({},_0x2d34df,_0x2d3111[_0x2b38('0x42')]);return _0x35edfc[_0x2b38('0x7c')](_0x2d34df);}})['then'](function(_0x4d7d19){if(_0x4d7d19){_0x5262d4=_0x4d7d19[_0x2b38('0x3a')];if(!_0x2d3111[_0x2b38('0x34')][_0x2b38('0x3b')](_0x2b38('0x3c'))){_0x2d34df[_0x2b38('0x1f')]=qs[_0x2b38('0x1f')](_0x2d3111[_0x2b38('0x34')][_0x2b38('0x1f')]);_0x2d34df[_0x2b38('0x1c')]=qs['offset'](_0x2d3111[_0x2b38('0x34')]['offset']);}return _0x35edfc[_0x2b38('0x7c')](_0x2d34df);}})['then'](function(_0x38375b){if(_0x38375b){return _0x38375b?{'count':_0x5262d4,'rows':_0x38375b}:null;}})[_0x2b38('0x25')](respondWithResult(_0x92790b,null))[_0x2b38('0x45')](handleError(_0x92790b,null));}; \ No newline at end of file +var _0x2846=['stack','name','index','map','Dashboard','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','fields','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','CustomDashboards','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','updatedAt','body','update','iframe','attrUrl','attrs','https://','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','findOne','getItems','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','count','limit','apply','reject','save','then','get','UserProfileResource','destroy','error'];(function(_0x3a3c3d,_0x3b8542){var _0xf3142f=function(_0x479bb0){while(--_0x479bb0){_0x3a3c3d['push'](_0x3a3c3d['shift']());}};_0xf3142f(++_0x3b8542);}(_0x2846,0xd9));var _0x6284=function(_0x32819e,_0x1641bc){_0x32819e=_0x32819e-0x0;var _0x35bc86=_0x2846[_0x32819e];return _0x35bc86;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6284('0x0'));var zipdir=require(_0x6284('0x1'));var jsonpatch=require(_0x6284('0x2'));var rp=require(_0x6284('0x3'));var moment=require('moment');var BPromise=require(_0x6284('0x4'));var Mustache=require(_0x6284('0x5'));var util=require('util');var path=require(_0x6284('0x6'));var sox=require(_0x6284('0x7'));var csv=require(_0x6284('0x8'));var ejs=require(_0x6284('0x9'));var fs=require('fs');var fs_extra=require(_0x6284('0xa'));var _=require(_0x6284('0xb'));var squel=require(_0x6284('0xc'));var crypto=require('crypto');var jsforce=require(_0x6284('0xd'));var deskjs=require(_0x6284('0xe'));var toCsv=require(_0x6284('0x8'));var querystring=require(_0x6284('0xf'));var Papa=require(_0x6284('0x10'));var Redis=require(_0x6284('0x11'));var authService=require(_0x6284('0x12'));var qs=require(_0x6284('0x13'));var as=require(_0x6284('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6284('0x15'))(_0x6284('0x16'));var utils=require(_0x6284('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6284('0x18'))['db'];config[_0x6284('0x19')]=_[_0x6284('0x1a')](config['redis'],{'host':_0x6284('0x1b'),'port':0x18eb});var socket=require(_0x6284('0x1c'))(new Redis(config[_0x6284('0x19')]));require('./dashboard.socket')['register'](socket);function respondWithStatusCode(_0x3b9206,_0x1fb90b){_0x1fb90b=_0x1fb90b||0xcc;return function(_0x20d9e1){if(_0x20d9e1){return _0x3b9206[_0x6284('0x1d')](_0x1fb90b);}return _0x3b9206[_0x6284('0x1e')](_0x1fb90b)[_0x6284('0x1f')]();};}function respondWithResult(_0x503f13,_0x1f1b8a){_0x1f1b8a=_0x1f1b8a||0xc8;return function(_0x319824){if(_0x319824){return _0x503f13[_0x6284('0x1e')](_0x1f1b8a)[_0x6284('0x20')](_0x319824);}};}function respondWithFilteredResult(_0x5ec90e,_0x3c1ea5){return function(_0x35e3a5){if(_0x35e3a5){var _0x4fb823=typeof _0x3c1ea5[_0x6284('0x21')]===_0x6284('0x22')&&typeof _0x3c1ea5['limit']===_0x6284('0x22');var _0x4559a4=_0x35e3a5[_0x6284('0x23')];var _0x2e8718=_0x4fb823?0x0:_0x3c1ea5[_0x6284('0x21')];var _0x60b073=_0x4fb823?_0x35e3a5[_0x6284('0x23')]:_0x3c1ea5['offset']+_0x3c1ea5[_0x6284('0x24')];var _0x5a1dce;if(_0x60b073>=_0x4559a4){_0x60b073=_0x4559a4;_0x5a1dce=0xc8;}else{_0x5a1dce=0xce;}_0x5ec90e[_0x6284('0x1e')](_0x5a1dce);return _0x5ec90e['set']('Content-Range',_0x2e8718+'-'+_0x60b073+'/'+_0x4559a4)[_0x6284('0x20')](_0x35e3a5);}return null;};}function patchUpdates(_0x5414d2){return function(_0x15bbe5){try{jsonpatch[_0x6284('0x25')](_0x15bbe5,_0x5414d2,!![]);}catch(_0xa3cb59){return BPromise[_0x6284('0x26')](_0xa3cb59);}return _0x15bbe5[_0x6284('0x27')]();};}function saveUpdates(_0x23ddba,_0x22e1d8){return function(_0x476bd9){if(_0x476bd9){return _0x476bd9['update'](_0x23ddba)[_0x6284('0x28')](function(_0x423163){return _0x423163;});}return null;};}function removeEntity(_0x273508,_0x880b31){return function(_0x27cb3c){if(_0x27cb3c){return _0x27cb3c['destroy']()[_0x6284('0x28')](function(){var _0xa87b11=_0x27cb3c[_0x6284('0x29')]({'plain':!![]});var _0x520aff='CustomDashboards';return db[_0x6284('0x2a')][_0x6284('0x2b')]({'where':{'type':_0x520aff,'resourceId':_0xa87b11['id']}})[_0x6284('0x28')](function(){return _0x27cb3c;});})[_0x6284('0x28')](function(){_0x273508[_0x6284('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13ccb4,_0x1cf61b){return function(_0x576020){if(!_0x576020){_0x13ccb4[_0x6284('0x1d')](0x194);}return _0x576020;};}function handleError(_0x201bb3,_0x29b5d4){_0x29b5d4=_0x29b5d4||0x1f4;return function(_0x472fcd){logger[_0x6284('0x2c')](_0x472fcd[_0x6284('0x2d')]);if(_0x472fcd[_0x6284('0x2e')]){delete _0x472fcd['name'];}_0x201bb3[_0x6284('0x1e')](_0x29b5d4)['send'](_0x472fcd);};}exports[_0x6284('0x2f')]=function(_0x3b420d,_0x3fb7bf){var _0x27b01f={},_0x7e1fa0={},_0x42969d={'count':0x0,'rows':[]};var _0x39c359=_[_0x6284('0x30')](db[_0x6284('0x31')][_0x6284('0x32')],function(_0x3e75d4){return{'name':_0x3e75d4[_0x6284('0x33')],'type':_0x3e75d4['type'][_0x6284('0x34')]};});_0x7e1fa0[_0x6284('0x35')]=_['map'](_0x39c359,_0x6284('0x2e'));_0x7e1fa0[_0x6284('0x36')]=_[_0x6284('0x37')](_0x3b420d[_0x6284('0x36')]);_0x7e1fa0[_0x6284('0x38')]=_['intersection'](_0x7e1fa0[_0x6284('0x35')],_0x7e1fa0[_0x6284('0x36')]);_0x27b01f[_0x6284('0x39')]=_[_0x6284('0x3a')](_0x7e1fa0[_0x6284('0x35')],qs['fields'](_0x3b420d[_0x6284('0x36')]['fields']));_0x27b01f[_0x6284('0x39')]=_0x27b01f[_0x6284('0x39')]['length']?_0x27b01f[_0x6284('0x39')]:_0x7e1fa0[_0x6284('0x35')];if(!_0x3b420d[_0x6284('0x36')]['hasOwnProperty'](_0x6284('0x3b'))){_0x27b01f['limit']=qs['limit'](_0x3b420d[_0x6284('0x36')][_0x6284('0x24')]);_0x27b01f[_0x6284('0x21')]=qs[_0x6284('0x21')](_0x3b420d[_0x6284('0x36')][_0x6284('0x21')]);}_0x27b01f[_0x6284('0x3c')]=qs[_0x6284('0x3d')](_0x3b420d[_0x6284('0x36')][_0x6284('0x3d')]);_0x27b01f[_0x6284('0x3e')]=qs[_0x6284('0x38')](_[_0x6284('0x3f')](_0x3b420d[_0x6284('0x36')],_0x7e1fa0[_0x6284('0x38')]),_0x39c359);if(_0x3b420d['query'][_0x6284('0x40')]){_0x27b01f[_0x6284('0x3e')]=_[_0x6284('0x41')](_0x27b01f[_0x6284('0x3e')],{'$or':_[_0x6284('0x30')](_0x39c359,function(_0x51439d){if(_0x51439d[_0x6284('0x42')]!==_0x6284('0x43')){var _0x107bb1={};_0x107bb1[_0x51439d[_0x6284('0x2e')]]={'$like':'%'+_0x3b420d['query']['filter']+'%'};return _0x107bb1;}})});}_0x27b01f=_['merge']({},_0x27b01f,_0x3b420d[_0x6284('0x44')]);var _0x218065={'where':_0x27b01f[_0x6284('0x3e')]};return db[_0x6284('0x31')][_0x6284('0x23')](_0x218065)[_0x6284('0x28')](function(_0x37668d){_0x42969d[_0x6284('0x23')]=_0x37668d;if(_0x3b420d[_0x6284('0x36')][_0x6284('0x45')]){_0x27b01f[_0x6284('0x46')]=[{'all':!![]}];}return db[_0x6284('0x31')][_0x6284('0x47')](_0x27b01f);})[_0x6284('0x28')](function(_0x20b1ea){_0x42969d['rows']=_0x20b1ea;return _0x42969d;})[_0x6284('0x28')](respondWithFilteredResult(_0x3fb7bf,_0x27b01f))[_0x6284('0x48')](handleError(_0x3fb7bf,null));};exports[_0x6284('0x49')]=function(_0x3057fb,_0x55f1b9){var _0x2ba7b3={'raw':![],'where':{'id':_0x3057fb['params']['id']}},_0x3fa19b={};_0x3fa19b[_0x6284('0x35')]=_[_0x6284('0x37')](db[_0x6284('0x31')]['rawAttributes']);_0x3fa19b['query']=_[_0x6284('0x37')](_0x3057fb[_0x6284('0x36')]);_0x3fa19b[_0x6284('0x38')]=_[_0x6284('0x3a')](_0x3fa19b[_0x6284('0x35')],_0x3fa19b[_0x6284('0x36')]);_0x2ba7b3['attributes']=_[_0x6284('0x3a')](_0x3fa19b['model'],qs[_0x6284('0x4a')](_0x3057fb[_0x6284('0x36')][_0x6284('0x4a')]));_0x2ba7b3[_0x6284('0x39')]=_0x2ba7b3['attributes'][_0x6284('0x4b')]?_0x2ba7b3[_0x6284('0x39')]:_0x3fa19b['model'];if(_0x3057fb['query'][_0x6284('0x45')]){_0x2ba7b3['include']=[{'all':!![]}];}_0x2ba7b3=_[_0x6284('0x41')]({},_0x2ba7b3,_0x3057fb[_0x6284('0x44')]);return db[_0x6284('0x31')][_0x6284('0x4c')](_0x2ba7b3)[_0x6284('0x28')](handleEntityNotFound(_0x55f1b9,null))[_0x6284('0x28')](respondWithResult(_0x55f1b9,null))[_0x6284('0x48')](handleError(_0x55f1b9,null));};exports['create']=function(_0x2bc18a,_0x3c0d34){return db[_0x6284('0x31')][_0x6284('0x4d')](_0x2bc18a['body'],{})[_0x6284('0x28')](function(_0x154f6c){var _0x23e311=_0x2bc18a[_0x6284('0x4e')][_0x6284('0x29')]({'plain':!![]});if(!_0x23e311)throw new Error(_0x6284('0x4f'));if(_0x23e311['role']===_0x6284('0x4e')){var _0x35c267=_0x154f6c['get']({'plain':!![]});var _0x22f0d5=_0x6284('0x50');return db[_0x6284('0x51')][_0x6284('0x4c')]({'where':{'name':_0x22f0d5,'userProfileId':_0x23e311[_0x6284('0x52')]},'raw':!![]})[_0x6284('0x28')](function(_0x17aa90){if(_0x17aa90&&_0x17aa90[_0x6284('0x53')]===0x0){return db['UserProfileResource'][_0x6284('0x4d')]({'name':_0x35c267['name'],'resourceId':_0x35c267['id'],'type':_0x17aa90[_0x6284('0x2e')],'sectionId':_0x17aa90['id']},{})[_0x6284('0x28')](function(){return _0x154f6c;});}else{return _0x154f6c;}})[_0x6284('0x48')](function(_0x2ba392){logger[_0x6284('0x2c')](_0x6284('0x54'),_0x2ba392);throw _0x2ba392;});}return _0x154f6c;})['then'](respondWithResult(_0x3c0d34,0xc9))[_0x6284('0x48')](handleError(_0x3c0d34,null));};exports[_0x6284('0x55')]=function(_0x38b96c,_0x17ace8){var _0x4327bb={'where':{'id':_0x38b96c[_0x6284('0x56')]['id']}},_0x393215={};_0x393215[_0x6284('0x35')]=_[_0x6284('0x37')](db[_0x6284('0x31')][_0x6284('0x32')]);_0x4327bb[_0x6284('0x39')]=_[_0x6284('0x3a')](_0x393215[_0x6284('0x35')],qs[_0x6284('0x4a')](_0x38b96c['query'][_0x6284('0x4a')]));_0x4327bb['attributes']=_0x4327bb['attributes'][_0x6284('0x4b')]?_0x4327bb[_0x6284('0x39')]:_0x393215[_0x6284('0x35')];if(_0x38b96c[_0x6284('0x36')][_0x6284('0x45')]){_0x4327bb['include']=[{'all':!![]}];}_0x4327bb=_[_0x6284('0x41')]({},_0x4327bb,_0x38b96c[_0x6284('0x44')]);return db['Dashboard'][_0x6284('0x4c')](_0x4327bb)[_0x6284('0x28')](handleEntityNotFound(_0x17ace8,null))[_0x6284('0x28')](function(_0x39f566){if(_0x39f566){var _0x1b8c4d=_0x39f566[_0x6284('0x29')]({'plain':!![]});_0x1b8c4d=qs[_0x6284('0x57')](_0x1b8c4d,['id',_0x6284('0x58'),_0x6284('0x59')]);_0x38b96c[_0x6284('0x5a')]=_['omit'](_0x38b96c[_0x6284('0x5a')],['id',_0x6284('0x58'),'updatedAt']);return db[_0x6284('0x31')][_0x6284('0x4d')](_[_0x6284('0x41')](_0x1b8c4d,_0x38b96c[_0x6284('0x5a')]),{'include':_0x38b96c['query'][_0x6284('0x45')]?[{'all':!![]}]:undefined})['then'](function(_0x77f47b){var _0x262aef=_0x38b96c[_0x6284('0x4e')][_0x6284('0x29')]({'plain':!![]});if(!_0x262aef)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x262aef['role']===_0x6284('0x4e')){var _0x161daa=_0x77f47b[_0x6284('0x29')]({'plain':!![]});var _0x1ab4cc=_0x6284('0x50');return db[_0x6284('0x51')][_0x6284('0x4c')]({'where':{'name':_0x1ab4cc,'userProfileId':_0x262aef['userProfileId']},'raw':!![]})[_0x6284('0x28')](function(_0x28213c){if(_0x28213c&&_0x28213c[_0x6284('0x53')]===0x0){return db[_0x6284('0x2a')][_0x6284('0x4d')]({'name':_0x161daa[_0x6284('0x2e')],'resourceId':_0x161daa['id'],'type':_0x28213c[_0x6284('0x2e')],'sectionId':_0x28213c['id']},{})[_0x6284('0x28')](function(){return _0x77f47b;});}else{return _0x77f47b;}})['catch'](function(_0xc2b83c){logger['error'](_0x6284('0x54'),_0xc2b83c);throw _0xc2b83c;});}return _0x77f47b;});}})['then'](respondWithResult(_0x17ace8,0xc9))['catch'](handleError(_0x17ace8,null));};exports[_0x6284('0x5b')]=function(_0x2cda39,_0x4e62db){if(_0x2cda39[_0x6284('0x5a')]['id']){delete _0x2cda39[_0x6284('0x5a')]['id'];}return db[_0x6284('0x31')]['find']({'where':{'id':_0x2cda39[_0x6284('0x56')]['id']}})[_0x6284('0x28')](handleEntityNotFound(_0x4e62db,null))[_0x6284('0x28')](saveUpdates(_0x2cda39[_0x6284('0x5a')],null))[_0x6284('0x28')](respondWithResult(_0x4e62db,null))[_0x6284('0x48')](handleError(_0x4e62db,null));};exports[_0x6284('0x2b')]=function(_0x47efc7,_0x58c338){return db[_0x6284('0x31')][_0x6284('0x4c')]({'where':{'id':_0x47efc7[_0x6284('0x56')]['id']}})['then'](handleEntityNotFound(_0x58c338,null))[_0x6284('0x28')](removeEntity(_0x58c338,null))[_0x6284('0x48')](handleError(_0x58c338,null));};function widgetAttributes(_0xf32129){try{switch(_0xf32129['type']){case _0x6284('0x5c'):return[{'name':_0x6284('0x5d'),'value':_0xf32129[_0x6284('0x5d')]||(_0xf32129[_0x6284('0x5e')]&&_0xf32129['attrs'][0x0]?_0xf32129['attrs'][0x0]['value']:undefined)||_0x6284('0x5f')}];case _0x6284('0x60'):return[{'name':_0x6284('0x61'),'value':_0xf32129['attrPath']||(_0xf32129[_0x6284('0x5e')]&&_0xf32129[_0x6284('0x5e')][0x0]?_0xf32129['attrs'][0x0][_0x6284('0x62')]:undefined)||''}];case _0x6284('0x63'):return[{'name':_0x6284('0x64'),'value':_0xf32129['attrHourFormat']||(_0xf32129['attrs']&&_0xf32129['attrs'][0x0]?_0xf32129[_0x6284('0x5e')][0x0]['value']:undefined)||_0x6284('0x65')},{'name':'attrTimezone','value':_0xf32129[_0x6284('0x66')]||(_0xf32129[_0x6284('0x5e')]&&_0xf32129['attrs'][0x1]?_0xf32129[_0x6284('0x5e')][0x1][_0x6284('0x62')]:undefined)||_0x6284('0x67')},{'name':'attrFontSize','value':_0xf32129[_0x6284('0x68')]||(_0xf32129[_0x6284('0x5e')]&&_0xf32129['attrs'][0x2]?_0xf32129[_0x6284('0x5e')][0x2][_0x6284('0x62')]:undefined)||0xc}];case _0x6284('0x69'):return[{'name':_0x6284('0x6a'),'value':_0xf32129[_0x6284('0x6a')]||(_0xf32129[_0x6284('0x5e')]&&_0xf32129[_0x6284('0x5e')][0x0]?_0xf32129[_0x6284('0x5e')][0x0][_0x6284('0x62')]:undefined)||_0x6284('0x6b')},{'name':_0x6284('0x6c'),'value':_0xf32129[_0x6284('0x6c')]||(_0xf32129['attrs']&&_0xf32129['attrs'][0x1]?_0xf32129[_0x6284('0x5e')][0x1][_0x6284('0x62')]:undefined)||[]},{'name':'attrFontSize','value':_0xf32129[_0x6284('0x68')]||(_0xf32129[_0x6284('0x5e')]&&_0xf32129['attrs'][0x2]?_0xf32129[_0x6284('0x5e')][0x2][_0x6284('0x62')]:undefined)||0x14},{'name':_0x6284('0x6d'),'value':_0xf32129['attrChannel']||(_0xf32129[_0x6284('0x5e')]&&_0xf32129['attrs'][0x3]?_0xf32129[_0x6284('0x5e')][0x3]['value']:undefined)||_0x6284('0x6e')},{'name':_0x6284('0x6f'),'value':_0xf32129[_0x6284('0x6f')]||(_0xf32129[_0x6284('0x5e')]&&_0xf32129[_0x6284('0x5e')][0x4]?_0xf32129['attrs'][0x4][_0x6284('0x62')]:undefined)||''},{'name':_0x6284('0x70'),'value':_0xf32129[_0x6284('0x70')]||(_0xf32129['attrs']&&_0xf32129[_0x6284('0x5e')][0x5]?_0xf32129['attrs'][0x5][_0x6284('0x62')]:undefined)||''},{'name':_0x6284('0x71'),'value':_0xf32129[_0x6284('0x71')]||(_0xf32129[_0x6284('0x5e')]&&_0xf32129[_0x6284('0x5e')][0x6]?_0xf32129[_0x6284('0x5e')][0x6][_0x6284('0x62')]:undefined)||''},{'name':_0x6284('0x72'),'value':_0xf32129[_0x6284('0x72')]||(_0xf32129[_0x6284('0x5e')]&&_0xf32129[_0x6284('0x5e')][0x7]?_0xf32129['attrs'][0x7][_0x6284('0x62')]:undefined)||''},{'name':_0x6284('0x73'),'value':_0xf32129['attrWhatsappAccounts']||(_0xf32129[_0x6284('0x5e')]&&_0xf32129['attrs'][0x8]?_0xf32129[_0x6284('0x5e')][0x8][_0x6284('0x62')]:undefined)||''},{'name':'attrChatWebsites','value':_0xf32129[_0x6284('0x74')]||(_0xf32129[_0x6284('0x5e')]&&_0xf32129[_0x6284('0x5e')][0x9]?_0xf32129[_0x6284('0x5e')][0x9]['value']:undefined)||''}];case _0x6284('0x75'):case _0x6284('0x76'):return[{'name':_0x6284('0x77'),'value':_0xf32129[_0x6284('0x77')]||(_0xf32129[_0x6284('0x5e')]&&_0xf32129[_0x6284('0x5e')][0x0]?_0xf32129[_0x6284('0x5e')][0x0]['value']:undefined)||_0x6284('0x6b')},{'name':_0x6284('0x78'),'value':_0xf32129[_0x6284('0x78')]||(_0xf32129[_0x6284('0x5e')]&&_0xf32129[_0x6284('0x5e')][0x1]?_0xf32129[_0x6284('0x5e')][0x1][_0x6284('0x62')]:undefined)||null},{'name':_0x6284('0x79'),'value':_0xf32129[_0x6284('0x79')]||(_0xf32129[_0x6284('0x5e')]&&_0xf32129[_0x6284('0x5e')][0x2]?_0xf32129[_0x6284('0x5e')][0x2][_0x6284('0x62')]:undefined)||null},{'name':_0x6284('0x6c'),'value':_0xf32129[_0x6284('0x6c')]||(_0xf32129['attrs']&&_0xf32129[_0x6284('0x5e')][0x3]?_0xf32129[_0x6284('0x5e')][0x3]['value']:undefined)||[]},{'name':_0x6284('0x6d'),'value':_0xf32129['attrChannel']||(_0xf32129[_0x6284('0x5e')]&&_0xf32129['attrs'][0x4]?_0xf32129[_0x6284('0x5e')][0x4][_0x6284('0x62')]:undefined)||_0x6284('0x6e')},{'name':_0x6284('0x6f'),'value':_0xf32129['attrEmailAccounts']||(_0xf32129[_0x6284('0x5e')]&&_0xf32129[_0x6284('0x5e')][0x5]?_0xf32129[_0x6284('0x5e')][0x5][_0x6284('0x62')]:undefined)||''},{'name':_0x6284('0x70'),'value':_0xf32129[_0x6284('0x70')]||(_0xf32129[_0x6284('0x5e')]&&_0xf32129[_0x6284('0x5e')][0x6]?_0xf32129[_0x6284('0x5e')][0x6]['value']:undefined)||''},{'name':_0x6284('0x71'),'value':_0xf32129[_0x6284('0x71')]||(_0xf32129[_0x6284('0x5e')]&&_0xf32129[_0x6284('0x5e')][0x7]?_0xf32129['attrs'][0x7][_0x6284('0x62')]:undefined)||''},{'name':_0x6284('0x72'),'value':_0xf32129['attrOpenchannelAccounts']||(_0xf32129[_0x6284('0x5e')]&&_0xf32129[_0x6284('0x5e')][0x8]?_0xf32129['attrs'][0x8][_0x6284('0x62')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0xf32129['attrWhatsappAccounts']||(_0xf32129[_0x6284('0x5e')]&&_0xf32129[_0x6284('0x5e')][0x9]?_0xf32129['attrs'][0x9]['value']:undefined)||''},{'name':_0x6284('0x74'),'value':_0xf32129[_0x6284('0x74')]||(_0xf32129[_0x6284('0x5e')]&&_0xf32129[_0x6284('0x5e')][0xa]?_0xf32129['attrs'][0xa][_0x6284('0x62')]:undefined)||''}];case _0x6284('0x7a'):return[{'name':_0x6284('0x7b'),'type':_0xf32129['reportType']||(_0xf32129[_0x6284('0x5e')]&&_0xf32129[_0x6284('0x5e')][0x0]?_0xf32129[_0x6284('0x5e')][0x0]['type']:undefined)||null,'value':_0xf32129['attrReport']||(_0xf32129[_0x6284('0x5e')]&&_0xf32129['attrs'][0x0]?_0xf32129[_0x6284('0x5e')][0x0][_0x6284('0x62')]:undefined)||null},{'name':'attrRefresh','value':_0xf32129[_0x6284('0x7c')]||(_0xf32129['attrs']&&_0xf32129[_0x6284('0x5e')][0x1]?_0xf32129['attrs'][0x1][_0x6284('0x62')]:undefined)||0x0}];default:return[];}}catch(_0x39e186){logger['error'](_0x6284('0x7d'),JSON[_0x6284('0x7e')](_0x39e186));return[];}}exports[_0x6284('0x7f')]=function(_0x23caaa,_0x532799,_0x189ca8){if(_0x23caaa[_0x6284('0x5a')]['id']){delete _0x23caaa[_0x6284('0x5a')]['id'];}return db[_0x6284('0x31')][_0x6284('0x4c')]({'where':{'id':_0x23caaa[_0x6284('0x56')]['id']}})['then'](handleEntityNotFound(_0x532799,null))[_0x6284('0x28')](function(_0x236cf0){if(_0x236cf0){_0x23caaa['body'][_0x6284('0x80')]=_0x236cf0['id'];_0x23caaa['body']['attrs']=widgetAttributes(_0x23caaa[_0x6284('0x5a')]);return db['DashboardItem'][_0x6284('0x4d')](_0x23caaa[_0x6284('0x5a')]);}})[_0x6284('0x28')](respondWithResult(_0x532799,null))['catch'](handleError(_0x532799,null));};exports['getItems']=function(_0x2f79fd,_0x5ab088,_0xdf9b2c){var _0x5855f4={};var _0x328717={};var _0x5e1d7a;var _0x37e3bf;return db[_0x6284('0x31')][_0x6284('0x81')]({'where':{'id':_0x2f79fd[_0x6284('0x56')]['id']}})[_0x6284('0x28')](handleEntityNotFound(_0x5ab088,null))['then'](function(_0x5da259){if(_0x5da259){_0x5e1d7a=_0x5da259;_0x328717[_0x6284('0x35')]=_['keys'](db['DashboardItem']['rawAttributes']);_0x328717['query']=_[_0x6284('0x37')](_0x2f79fd['query']);_0x328717['filters']=_[_0x6284('0x3a')](_0x328717[_0x6284('0x35')],_0x328717[_0x6284('0x36')]);_0x5855f4['attributes']=_[_0x6284('0x3a')](_0x328717[_0x6284('0x35')],qs[_0x6284('0x4a')](_0x2f79fd[_0x6284('0x36')][_0x6284('0x4a')]));_0x5855f4[_0x6284('0x39')]=_0x5855f4[_0x6284('0x39')][_0x6284('0x4b')]?_0x5855f4[_0x6284('0x39')]:_0x328717[_0x6284('0x35')];_0x5855f4['order']=qs[_0x6284('0x3d')](_0x2f79fd[_0x6284('0x36')][_0x6284('0x3d')]);_0x5855f4['where']=qs['filters'](_[_0x6284('0x3f')](_0x2f79fd[_0x6284('0x36')],_0x328717[_0x6284('0x38')]));if(_0x2f79fd[_0x6284('0x36')][_0x6284('0x40')]){_0x5855f4[_0x6284('0x3e')]=_[_0x6284('0x41')](_0x5855f4[_0x6284('0x3e')],{'$or':_[_0x6284('0x30')](_0x5855f4[_0x6284('0x39')],function(_0x231c98){var _0x5102b0={};_0x5102b0[_0x231c98]={'$like':'%'+_0x2f79fd['query'][_0x6284('0x40')]+'%'};return _0x5102b0;})});}_0x5855f4=_[_0x6284('0x41')]({},_0x5855f4,_0x2f79fd[_0x6284('0x44')]);return _0x5e1d7a['getItems'](_0x5855f4);}})['then'](function(_0x4eca24){if(_0x4eca24){_0x37e3bf=_0x4eca24['length'];if(!_0x2f79fd['query']['hasOwnProperty'](_0x6284('0x3b'))){_0x5855f4[_0x6284('0x24')]=qs[_0x6284('0x24')](_0x2f79fd[_0x6284('0x36')][_0x6284('0x24')]);_0x5855f4['offset']=qs[_0x6284('0x21')](_0x2f79fd[_0x6284('0x36')][_0x6284('0x21')]);}return _0x5e1d7a[_0x6284('0x82')](_0x5855f4);}})[_0x6284('0x28')](function(_0x181639){if(_0x181639){return _0x181639?{'count':_0x37e3bf,'rows':_0x181639}:null;}})[_0x6284('0x28')](respondWithResult(_0x5ab088,null))[_0x6284('0x48')](handleError(_0x5ab088,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 59e7c1a..4452082 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 _0x394d=['update','emit','hook','events','save'];(function(_0x2aec43,_0x2d7071){var _0x426785=function(_0x4e5a0c){while(--_0x4e5a0c){_0x2aec43['push'](_0x2aec43['shift']());}};_0x426785(++_0x2d7071);}(_0x394d,0x12a));var _0xd394=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x394d[_0x1928c9];return _0x51b5fb;};'use strict';var EventEmitter=require(_0xd394('0x0'));var Dashboard=require('../../mysqldb')['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd394('0x1'),'afterUpdate':_0xd394('0x2'),'afterDestroy':'remove'};function emitEvent(_0x410368){return function(_0x499c7c,_0x278b36,_0x5c765b){DashboardEvents['emit'](_0x410368+':'+_0x499c7c['id'],_0x499c7c);DashboardEvents[_0xd394('0x3')](_0x410368,_0x499c7c);_0x5c765b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0xd394('0x4')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file +var _0x433f=['remove','emit','hasOwnProperty','hook','../../mysqldb','Dashboard','update'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0x433f,0x1b6));var _0xf433=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x433f[_0x167cc1];return _0x10bc4b;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0xf433('0x0'))['db'][_0xf433('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xf433('0x2'),'afterDestroy':_0xf433('0x3')};function emitEvent(_0x3ee98f){return function(_0x134ad6,_0x5a46a5,_0x76d90){DashboardEvents[_0xf433('0x4')](_0x3ee98f+':'+_0x134ad6['id'],_0x134ad6);DashboardEvents['emit'](_0x3ee98f,_0x134ad6);_0x76d90(null);};}for(var e in events){if(events[_0xf433('0x5')](e)){var event=events[e];Dashboard[_0xf433('0x6')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index a0de992..010a028 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 _0xdb59=['define','Dashboard','lodash','util','api','moment','bluebird','path','../../config/environment','./dashboard.attributes','exports'];(function(_0x576666,_0x4a1273){var _0x46ff5b=function(_0x55eb41){while(--_0x55eb41){_0x576666['push'](_0x576666['shift']());}};_0x46ff5b(++_0x4a1273);}(_0xdb59,0x9c));var _0x9db5=function(_0x412faa,_0x6d5ea8){_0x412faa=_0x412faa-0x0;var _0x204402=_0xdb59[_0x412faa];return _0x204402;};'use strict';var _=require(_0x9db5('0x0'));var util=require(_0x9db5('0x1'));var logger=require('../../config/logger')(_0x9db5('0x2'));var moment=require(_0x9db5('0x3'));var BPromise=require(_0x9db5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9db5('0x5'));var rimraf=require('rimraf');var config=require(_0x9db5('0x6'));var attributes=require(_0x9db5('0x7'));module[_0x9db5('0x8')]=function(_0xf2b5f2,_0x47f101){return _0xf2b5f2[_0x9db5('0x9')](_0x9db5('0xa'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6a92=['./dashboard.attributes','exports','dashboards','lodash','util','../../config/logger','api','moment'];(function(_0x3c1638,_0x4f26f1){var _0xd27ae2=function(_0x563394){while(--_0x563394){_0x3c1638['push'](_0x3c1638['shift']());}};_0xd27ae2(++_0x4f26f1);}(_0x6a92,0x14b));var _0x26a9=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0x6a92[_0x49b207];return _0x2dc8fa;};'use strict';var _=require(_0x26a9('0x0'));var util=require(_0x26a9('0x1'));var logger=require(_0x26a9('0x2'))(_0x26a9('0x3'));var moment=require(_0x26a9('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x26a9('0x5'));module[_0x26a9('0x6')]=function(_0x566daa,_0x4e4e3a){return _0x566daa['define']('Dashboard',attributes,{'tableName':_0x26a9('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index 9792367..ecbd863 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 _0x901a=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment'];(function(_0xb96f30,_0x1ec6a1){var _0xd8d174=function(_0x10bb33){while(--_0x10bb33){_0xb96f30['push'](_0xb96f30['shift']());}};_0xd8d174(++_0x1ec6a1);}(_0x901a,0x19d));var _0xa901=function(_0x4b039d,_0x55b356){_0x4b039d=_0x4b039d-0x0;var _0x4497ce=_0x901a[_0x4b039d];return _0x4497ce;};'use strict';var _=require(_0xa901('0x0'));var util=require(_0xa901('0x1'));var moment=require(_0xa901('0x2'));var BPromise=require(_0xa901('0x3'));var rs=require(_0xa901('0x4'));var fs=require('fs');var Redis=require(_0xa901('0x5'));var db=require(_0xa901('0x6'))['db'];var utils=require(_0xa901('0x7'));var logger=require(_0xa901('0x8'))(_0xa901('0x9'));var config=require(_0xa901('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xa901('0xb')][_0xa901('0xc')]({'port':0x232a});config[_0xa901('0xd')]=_[_0xa901('0xe')](config[_0xa901('0xd')],{'host':_0xa901('0xf'),'port':0x18eb});var socket=require(_0xa901('0x10'))(new Redis(config[_0xa901('0xd')]));require(_0xa901('0x11'))[_0xa901('0x12')](socket);function respondWithRpcPromise(_0x763676,_0x3fbc3e,_0x57cb04){return new BPromise(function(_0x505157,_0x40f21a){return client[_0xa901('0x13')](_0x763676,_0x57cb04)[_0xa901('0x14')](function(_0x5debf9){logger[_0xa901('0x15')](_0xa901('0x16'),_0x3fbc3e,'request\x20sent');logger[_0xa901('0x17')](_0xa901('0x18'),_0x3fbc3e,'request\x20sent',JSON[_0xa901('0x19')](_0x5debf9));if(_0x5debf9[_0xa901('0x1a')]){if(_0x5debf9['error'][_0xa901('0x1b')]===0x1f4){logger[_0xa901('0x1a')](_0xa901('0x16'),_0x3fbc3e,_0x5debf9[_0xa901('0x1a')][_0xa901('0x1c')]);return _0x40f21a(_0x5debf9['error'][_0xa901('0x1c')]);}logger[_0xa901('0x1a')]('Dashboard,\x20%s,\x20%s',_0x3fbc3e,_0x5debf9[_0xa901('0x1a')][_0xa901('0x1c')]);return _0x505157(_0x5debf9['error'][_0xa901('0x1c')]);}else{logger[_0xa901('0x15')](_0xa901('0x16'),_0x3fbc3e,_0xa901('0x1d'));_0x505157(_0x5debf9[_0xa901('0x1e')][_0xa901('0x1c')]);}})[_0xa901('0x1f')](function(_0xc34a0a){logger[_0xa901('0x1a')]('Dashboard,\x20%s,\x20%s',_0x3fbc3e,_0xc34a0a);_0x40f21a(_0xc34a0a);});});} \ No newline at end of file +var _0x8425=['info','result','catch','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./dashboard.socket','register','request','then','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x1ca40c,_0x582eaf){var _0x50b2a3=function(_0xb6eb65){while(--_0xb6eb65){_0x1ca40c['push'](_0x1ca40c['shift']());}};_0x50b2a3(++_0x582eaf);}(_0x8425,0x15f));var _0x5842=function(_0x2fb0cb,_0x82a283){_0x2fb0cb=_0x2fb0cb-0x0;var _0x493ba0=_0x8425[_0x2fb0cb];return _0x493ba0;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x5842('0x0'));var rs=require(_0x5842('0x1'));var fs=require('fs');var Redis=require(_0x5842('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x5842('0x3'));var logger=require(_0x5842('0x4'))(_0x5842('0x5'));var config=require(_0x5842('0x6'));var jayson=require(_0x5842('0x7'));var client=jayson[_0x5842('0x8')][_0x5842('0x9')]({'port':0x232a});config['redis']=_[_0x5842('0xa')](config[_0x5842('0xb')],{'host':_0x5842('0xc'),'port':0x18eb});var socket=require(_0x5842('0xd'))(new Redis(config[_0x5842('0xb')]));require(_0x5842('0xe'))[_0x5842('0xf')](socket);function respondWithRpcPromise(_0x40448f,_0x16cbf0,_0xc53592){return new BPromise(function(_0x552f9e,_0x31f0df){return client[_0x5842('0x10')](_0x40448f,_0xc53592)[_0x5842('0x11')](function(_0x2d7c32){logger['info'](_0x5842('0x12'),_0x16cbf0,_0x5842('0x13'));logger[_0x5842('0x14')](_0x5842('0x15'),_0x16cbf0,'request\x20sent',JSON[_0x5842('0x16')](_0x2d7c32));if(_0x2d7c32[_0x5842('0x17')]){if(_0x2d7c32[_0x5842('0x17')][_0x5842('0x18')]===0x1f4){logger['error'](_0x5842('0x12'),_0x16cbf0,_0x2d7c32['error'][_0x5842('0x19')]);return _0x31f0df(_0x2d7c32[_0x5842('0x17')][_0x5842('0x19')]);}logger['error'](_0x5842('0x12'),_0x16cbf0,_0x2d7c32['error'][_0x5842('0x19')]);return _0x552f9e(_0x2d7c32[_0x5842('0x17')][_0x5842('0x19')]);}else{logger[_0x5842('0x1a')](_0x5842('0x12'),_0x16cbf0,_0x5842('0x13'));_0x552f9e(_0x2d7c32[_0x5842('0x1b')][_0x5842('0x19')]);}})[_0x5842('0x1c')](function(_0x20d047){logger[_0x5842('0x17')](_0x5842('0x12'),_0x16cbf0,_0x20d047);_0x31f0df(_0x20d047);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 975808e..e81e404 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 _0x748f=['./dashboard.events','remove','update','emit','register'];(function(_0x38734b,_0x2edc9a){var _0xd62647=function(_0x5d4c37){while(--_0x5d4c37){_0x38734b['push'](_0x38734b['shift']());}};_0xd62647(++_0x2edc9a);}(_0x748f,0x1e5));var _0xf748=function(_0x5cc0e8,_0x5c68dd){_0x5cc0e8=_0x5cc0e8-0x0;var _0x5a81f8=_0x748f[_0x5cc0e8];return _0x5a81f8;};'use strict';var DashboardEvents=require(_0xf748('0x0'));var events=['save',_0xf748('0x1'),_0xf748('0x2')];function createListener(_0x590202,_0x1bdd26){return function(_0x141e81){_0x1bdd26[_0xf748('0x3')](_0x590202,_0x141e81);};}function removeListener(_0x59a838,_0x2b23a4){return function(){DashboardEvents['removeListener'](_0x59a838,_0x2b23a4);};}exports[_0xf748('0x4')]=function(_0x207911){for(var _0x311d19=0x0,_0x4534d4=events['length'];_0x311d19<_0x4534d4;_0x311d19++){var _0x426706=events[_0x311d19];var _0x45ca01=createListener('dashboard:'+_0x426706,_0x207911);DashboardEvents['on'](_0x426706,_0x45ca01);}}; \ No newline at end of file +var _0x5eb5=['update','emit','removeListener','register','length','dashboard:','./dashboard.events','save','remove'];(function(_0x7dd78a,_0x4f845f){var _0x5a4d3f=function(_0x48edea){while(--_0x48edea){_0x7dd78a['push'](_0x7dd78a['shift']());}};_0x5a4d3f(++_0x4f845f);}(_0x5eb5,0x16e));var _0x55eb=function(_0x2603da,_0x2ae113){_0x2603da=_0x2603da-0x0;var _0x3861a6=_0x5eb5[_0x2603da];return _0x3861a6;};'use strict';var DashboardEvents=require(_0x55eb('0x0'));var events=[_0x55eb('0x1'),_0x55eb('0x2'),_0x55eb('0x3')];function createListener(_0x218fa6,_0x5d85b2){return function(_0x18573d){_0x5d85b2[_0x55eb('0x4')](_0x218fa6,_0x18573d);};}function removeListener(_0x80dd0,_0x3c21a9){return function(){DashboardEvents[_0x55eb('0x5')](_0x80dd0,_0x3c21a9);};}exports[_0x55eb('0x6')]=function(_0x3e19c9){for(var _0x196d45=0x0,_0x49a121=events[_0x55eb('0x7')];_0x196d45<_0x49a121;_0x196d45++){var _0x68e95a=events[_0x196d45];var _0x3cfbc8=createListener(_0x55eb('0x8')+_0x68e95a,_0x3e19c9);DashboardEvents['on'](_0x68e95a,_0x3cfbc8);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index ad2d10e..b618b8a 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 _0x0b22=['isAuthenticated','index','show','/:id/items','post','create','/:id/clone','clone','addItem','put','/:id','delete','exports','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0x0b22,0x76));var _0x20b2=function(_0x4f52cd,_0x8f8a62){_0x4f52cd=_0x4f52cd-0x0;var _0x4d1c3f=_0x0b22[_0x4f52cd];return _0x4d1c3f;};'use strict';var multer=require('multer');var util=require(_0x20b2('0x0'));var path=require(_0x20b2('0x1'));var timeout=require('connect-timeout');var express=require(_0x20b2('0x2'));var router=express[_0x20b2('0x3')]();var fs_extra=require(_0x20b2('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x20b2('0x5'));var config=require(_0x20b2('0x6'));var controller=require('./dashboard.controller');router[_0x20b2('0x7')]('/',auth[_0x20b2('0x8')](),controller[_0x20b2('0x9')]);router[_0x20b2('0x7')]('/:id',auth[_0x20b2('0x8')](),controller[_0x20b2('0xa')]);router[_0x20b2('0x7')](_0x20b2('0xb'),auth[_0x20b2('0x8')](),controller['getItems']);router[_0x20b2('0xc')]('/',auth[_0x20b2('0x8')](),controller[_0x20b2('0xd')]);router[_0x20b2('0xc')](_0x20b2('0xe'),auth[_0x20b2('0x8')](),controller[_0x20b2('0xf')]);router[_0x20b2('0xc')](_0x20b2('0xb'),auth['isAuthenticated'](),controller[_0x20b2('0x10')]);router[_0x20b2('0x11')](_0x20b2('0x12'),auth[_0x20b2('0x8')](),controller['update']);router[_0x20b2('0x13')](_0x20b2('0x12'),auth[_0x20b2('0x8')](),controller['destroy']);module[_0x20b2('0x14')]=router; \ No newline at end of file +var _0xa8ba=['destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./dashboard.controller','get','isAuthenticated','index','/:id/items','getItems','post','create','clone','addItem','put','update','/:id'];(function(_0x105534,_0x117104){var _0x18a262=function(_0x443d54){while(--_0x443d54){_0x105534['push'](_0x105534['shift']());}};_0x18a262(++_0x117104);}(_0xa8ba,0x6b));var _0xaa8b=function(_0x46a711,_0x2bdf60){_0x46a711=_0x46a711-0x0;var _0xac6e72=_0xa8ba[_0x46a711];return _0xac6e72;};'use strict';var multer=require(_0xaa8b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xaa8b('0x1'));var express=require(_0xaa8b('0x2'));var router=express[_0xaa8b('0x3')]();var fs_extra=require(_0xaa8b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xaa8b('0x5'));var config=require('../../config/environment');var controller=require(_0xaa8b('0x6'));router[_0xaa8b('0x7')]('/',auth[_0xaa8b('0x8')](),controller[_0xaa8b('0x9')]);router[_0xaa8b('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xaa8b('0x7')](_0xaa8b('0xa'),auth[_0xaa8b('0x8')](),controller[_0xaa8b('0xb')]);router[_0xaa8b('0xc')]('/',auth[_0xaa8b('0x8')](),controller[_0xaa8b('0xd')]);router['post']('/:id/clone',auth['isAuthenticated'](),controller[_0xaa8b('0xe')]);router[_0xaa8b('0xc')](_0xaa8b('0xa'),auth[_0xaa8b('0x8')](),controller[_0xaa8b('0xf')]);router[_0xaa8b('0x10')]('/:id',auth[_0xaa8b('0x8')](),controller[_0xaa8b('0x11')]);router['delete'](_0xaa8b('0x12'),auth[_0xaa8b('0x8')](),controller[_0xaa8b('0x13')]);module[_0xaa8b('0x14')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 82fbc20..d602b69 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 _0x0295=['#ffffff','sequelize','exports','TEXT','long','parse','getDataValue','attrs','setDataValue','INTEGER','STRING'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x0295,0x1f0));var _0x5029=function(_0x161341,_0x1c054d){_0x161341=_0x161341-0x0;var _0x5e06c3=_0x0295[_0x161341];return _0x5e06c3;};'use strict';var Sequelize=require(_0x5029('0x0'));var squel=require('squel');var _=require('lodash');module[_0x5029('0x1')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x5029('0x2')](_0x5029('0x3')),'get':function(){try{return JSON[_0x5029('0x4')](this[_0x5029('0x5')](_0x5029('0x6')));}catch(_0x69a497){return[];}},'set':function(_0x200217){try{this[_0x5029('0x7')](_0x5029('0x6'),JSON['stringify'](_0x200217));}catch(_0x54978f){this['setDataValue'](_0x5029('0x6'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0x5029('0x8')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x5029('0x8')]},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0x5029('0x9')],'allowNull':![],'defaultValue':_0x5029('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x5029('0x9')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x5029('0x9')]},'titleFontSize':{'type':Sequelize[_0x5029('0x8')],'defaultValue':0xc}}; \ No newline at end of file +var _0x6f47=['#ffffff','squel','lodash','STRING','TEXT','parse','getDataValue','attrs','setDataValue','stringify','INTEGER'];(function(_0x2a8b1d,_0x1057e8){var _0x3d9ee9=function(_0x386cd2){while(--_0x386cd2){_0x2a8b1d['push'](_0x2a8b1d['shift']());}};_0x3d9ee9(++_0x1057e8);}(_0x6f47,0xc7));var _0x76f4=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0x6f47[_0xf71120];return _0xbe2fd3;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x76f4('0x0'));var _=require(_0x76f4('0x1'));module['exports']={'title':{'type':Sequelize[_0x76f4('0x2')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x76f4('0x3')]('long'),'get':function(){try{return JSON[_0x76f4('0x4')](this[_0x76f4('0x5')](_0x76f4('0x6')));}catch(_0x2523ba){return[];}},'set':function(_0x5754ca){try{this[_0x76f4('0x7')](_0x76f4('0x6'),JSON[_0x76f4('0x8')](_0x5754ca));}catch(_0x497f99){this[_0x76f4('0x7')](_0x76f4('0x6'),JSON[_0x76f4('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0x76f4('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x76f4('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0x76f4('0x2')],'allowNull':![],'defaultValue':_0x76f4('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x76f4('0x2')]},'titleFontSize':{'type':Sequelize[_0x76f4('0x9')],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 82df0af..e4c28e8 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 _0x176c=['request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','show','params','DashboardItem','rawAttributes','query','filters','intersection','model','attributes','fields','length','include','merge','options','find','catch','type','iframe','attrUrl','attrs','https://','custom','attrPath','value','clock','attrHourFormat','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','body','create','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x21dc33,_0x2472be){var _0x5c765e=function(_0x31ce51){while(--_0x31ce51){_0x21dc33['push'](_0x21dc33['shift']());}};_0x5c765e(++_0x2472be);}(_0x176c,0x134));var _0xc176=function(_0x5dce18,_0x51854c){_0x5dce18=_0x5dce18-0x0;var _0x5c2a22=_0x176c[_0x5dce18];return _0x5c2a22;};'use strict';var emlformat=require(_0xc176('0x0'));var rimraf=require(_0xc176('0x1'));var zipdir=require(_0xc176('0x2'));var jsonpatch=require(_0xc176('0x3'));var rp=require(_0xc176('0x4'));var moment=require(_0xc176('0x5'));var BPromise=require(_0xc176('0x6'));var Mustache=require('mustache');var util=require(_0xc176('0x7'));var path=require(_0xc176('0x8'));var sox=require('sox');var csv=require(_0xc176('0x9'));var ejs=require(_0xc176('0xa'));var fs=require('fs');var fs_extra=require(_0xc176('0xb'));var _=require('lodash');var squel=require(_0xc176('0xc'));var crypto=require(_0xc176('0xd'));var jsforce=require(_0xc176('0xe'));var deskjs=require(_0xc176('0xf'));var toCsv=require(_0xc176('0x9'));var querystring=require('querystring');var Papa=require(_0xc176('0x10'));var Redis=require(_0xc176('0x11'));var authService=require(_0xc176('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xc176('0x13'));var hardwareService=require(_0xc176('0x14'));var logger=require(_0xc176('0x15'))(_0xc176('0x16'));var utils=require(_0xc176('0x17'));var config=require(_0xc176('0x18'));var licenseUtil=require(_0xc176('0x19'));var db=require(_0xc176('0x1a'))['db'];config['redis']=_[_0xc176('0x1b')](config[_0xc176('0x1c')],{'host':_0xc176('0x1d'),'port':0x18eb});var socket=require(_0xc176('0x1e'))(new Redis(config[_0xc176('0x1c')]));require('./dashboardItem.socket')[_0xc176('0x1f')](socket);function respondWithStatusCode(_0x3ba62e,_0x27ded2){_0x27ded2=_0x27ded2||0xcc;return function(_0x4b8af0){if(_0x4b8af0){return _0x3ba62e[_0xc176('0x20')](_0x27ded2);}return _0x3ba62e['status'](_0x27ded2)[_0xc176('0x21')]();};}function respondWithResult(_0x246e9f,_0x4fdbd5){_0x4fdbd5=_0x4fdbd5||0xc8;return function(_0xfc47b4){if(_0xfc47b4){return _0x246e9f[_0xc176('0x22')](_0x4fdbd5)[_0xc176('0x23')](_0xfc47b4);}};}function respondWithFilteredResult(_0x1b9b5b,_0x33b528){return function(_0x284bb8){if(_0x284bb8){var _0x5e081a=typeof _0x33b528[_0xc176('0x24')]==='undefined'&&typeof _0x33b528[_0xc176('0x25')]===_0xc176('0x26');var _0x1c40bf=_0x284bb8[_0xc176('0x27')];var _0x261680=_0x5e081a?0x0:_0x33b528[_0xc176('0x24')];var _0x5526da=_0x5e081a?_0x284bb8['count']:_0x33b528[_0xc176('0x24')]+_0x33b528['limit'];var _0x179994;if(_0x5526da>=_0x1c40bf){_0x5526da=_0x1c40bf;_0x179994=0xc8;}else{_0x179994=0xce;}_0x1b9b5b['status'](_0x179994);return _0x1b9b5b[_0xc176('0x28')](_0xc176('0x29'),_0x261680+'-'+_0x5526da+'/'+_0x1c40bf)[_0xc176('0x23')](_0x284bb8);}return null;};}function patchUpdates(_0x580149){return function(_0x583c16){try{jsonpatch[_0xc176('0x2a')](_0x583c16,_0x580149,!![]);}catch(_0xdb4e6f){return BPromise[_0xc176('0x2b')](_0xdb4e6f);}return _0x583c16[_0xc176('0x2c')]();};}function saveUpdates(_0x5670da,_0x2e264d){return function(_0x5b71e6){if(_0x5b71e6){return _0x5b71e6[_0xc176('0x2d')](_0x5670da)['then'](function(_0x5049f8){return _0x5049f8;});}return null;};}function removeEntity(_0x39ee9b,_0x12ab18){return function(_0x3e4ecb){if(_0x3e4ecb){return _0x3e4ecb[_0xc176('0x2e')]()[_0xc176('0x2f')](function(){_0x39ee9b[_0xc176('0x22')](0xcc)[_0xc176('0x21')]();});}};}function handleEntityNotFound(_0x3d9fbf,_0x2cbdfa){return function(_0x3f5509){if(!_0x3f5509){_0x3d9fbf[_0xc176('0x20')](0x194);}return _0x3f5509;};}function handleError(_0x93f53c,_0x4628ad){_0x4628ad=_0x4628ad||0x1f4;return function(_0x449d76){logger[_0xc176('0x30')](_0x449d76[_0xc176('0x31')]);if(_0x449d76[_0xc176('0x32')]){delete _0x449d76['name'];}_0x93f53c['status'](_0x4628ad)[_0xc176('0x33')](_0x449d76);};}exports[_0xc176('0x34')]=function(_0x56a1bd,_0x17e111){var _0x3c7c1b={'raw':![],'where':{'id':_0x56a1bd[_0xc176('0x35')]['id']}},_0x2034fe={};_0x2034fe['model']=_['keys'](db[_0xc176('0x36')][_0xc176('0x37')]);_0x2034fe[_0xc176('0x38')]=_['keys'](_0x56a1bd[_0xc176('0x38')]);_0x2034fe[_0xc176('0x39')]=_[_0xc176('0x3a')](_0x2034fe[_0xc176('0x3b')],_0x2034fe[_0xc176('0x38')]);_0x3c7c1b[_0xc176('0x3c')]=_[_0xc176('0x3a')](_0x2034fe[_0xc176('0x3b')],qs['fields'](_0x56a1bd['query'][_0xc176('0x3d')]));_0x3c7c1b[_0xc176('0x3c')]=_0x3c7c1b[_0xc176('0x3c')][_0xc176('0x3e')]?_0x3c7c1b[_0xc176('0x3c')]:_0x2034fe[_0xc176('0x3b')];if(_0x56a1bd[_0xc176('0x38')]['includeAll']){_0x3c7c1b[_0xc176('0x3f')]=[{'all':!![]}];}_0x3c7c1b=_[_0xc176('0x40')]({},_0x3c7c1b,_0x56a1bd[_0xc176('0x41')]);return db['DashboardItem'][_0xc176('0x42')](_0x3c7c1b)[_0xc176('0x2f')](handleEntityNotFound(_0x17e111,null))[_0xc176('0x2f')](respondWithResult(_0x17e111,null))[_0xc176('0x43')](handleError(_0x17e111,null));};exports[_0xc176('0x2e')]=function(_0x38875c,_0xcaa2ad){return db[_0xc176('0x36')]['find']({'where':{'id':_0x38875c[_0xc176('0x35')]['id']}})[_0xc176('0x2f')](handleEntityNotFound(_0xcaa2ad,null))['then'](removeEntity(_0xcaa2ad,null))[_0xc176('0x43')](handleError(_0xcaa2ad,null));};function widgetAttributes(_0x196cb0){try{switch(_0x196cb0[_0xc176('0x44')]){case _0xc176('0x45'):return[{'name':_0xc176('0x46'),'value':_0x196cb0[_0xc176('0x46')]||(_0x196cb0['attrs']&&_0x196cb0['attrs'][0x0]?_0x196cb0[_0xc176('0x47')][0x0]['value']:undefined)||_0xc176('0x48')}];case _0xc176('0x49'):return[{'name':_0xc176('0x4a'),'value':_0x196cb0[_0xc176('0x4a')]||(_0x196cb0[_0xc176('0x47')]&&_0x196cb0[_0xc176('0x47')][0x0]?_0x196cb0[_0xc176('0x47')][0x0][_0xc176('0x4b')]:undefined)||''}];case _0xc176('0x4c'):return[{'name':_0xc176('0x4d'),'value':_0x196cb0['attrHourFormat']||(_0x196cb0['attrs']&&_0x196cb0[_0xc176('0x47')][0x0]?_0x196cb0[_0xc176('0x47')][0x0]['value']:undefined)||'HH:mm:ss'},{'name':_0xc176('0x4e'),'value':_0x196cb0[_0xc176('0x4e')]||(_0x196cb0[_0xc176('0x47')]&&_0x196cb0[_0xc176('0x47')][0x1]?_0x196cb0['attrs'][0x1]['value']:undefined)||'0.00'},{'name':_0xc176('0x4f'),'value':_0x196cb0[_0xc176('0x4f')]||(_0x196cb0[_0xc176('0x47')]&&_0x196cb0['attrs'][0x2]?_0x196cb0[_0xc176('0x47')][0x2][_0xc176('0x4b')]:undefined)||0xc}];case _0xc176('0x50'):return[{'name':_0xc176('0x51'),'value':_0x196cb0[_0xc176('0x51')]||(_0x196cb0[_0xc176('0x47')]&&_0x196cb0[_0xc176('0x47')][0x0]?_0x196cb0['attrs'][0x0][_0xc176('0x4b')]:undefined)||_0xc176('0x52')},{'name':_0xc176('0x53'),'value':_0x196cb0[_0xc176('0x53')]||(_0x196cb0[_0xc176('0x47')]&&_0x196cb0[_0xc176('0x47')][0x1]?_0x196cb0[_0xc176('0x47')][0x1]['value']:undefined)||[]},{'name':_0xc176('0x4f'),'value':_0x196cb0['attrFontSize']||(_0x196cb0[_0xc176('0x47')]&&_0x196cb0[_0xc176('0x47')][0x2]?_0x196cb0[_0xc176('0x47')][0x2][_0xc176('0x4b')]:undefined)||0x14},{'name':'attrChannel','value':_0x196cb0[_0xc176('0x54')]||(_0x196cb0[_0xc176('0x47')]&&_0x196cb0[_0xc176('0x47')][0x3]?_0x196cb0['attrs'][0x3][_0xc176('0x4b')]:undefined)||_0xc176('0x55')},{'name':_0xc176('0x56'),'value':_0x196cb0[_0xc176('0x56')]||(_0x196cb0[_0xc176('0x47')]&&_0x196cb0[_0xc176('0x47')][0x4]?_0x196cb0[_0xc176('0x47')][0x4][_0xc176('0x4b')]:undefined)||''},{'name':_0xc176('0x57'),'value':_0x196cb0[_0xc176('0x57')]||(_0x196cb0[_0xc176('0x47')]&&_0x196cb0[_0xc176('0x47')][0x5]?_0x196cb0[_0xc176('0x47')][0x5][_0xc176('0x4b')]:undefined)||''},{'name':_0xc176('0x58'),'value':_0x196cb0[_0xc176('0x58')]||(_0x196cb0['attrs']&&_0x196cb0['attrs'][0x6]?_0x196cb0['attrs'][0x6]['value']:undefined)||''},{'name':_0xc176('0x59'),'value':_0x196cb0[_0xc176('0x59')]||(_0x196cb0[_0xc176('0x47')]&&_0x196cb0[_0xc176('0x47')][0x7]?_0x196cb0['attrs'][0x7][_0xc176('0x4b')]:undefined)||''},{'name':_0xc176('0x5a'),'value':_0x196cb0[_0xc176('0x5a')]||(_0x196cb0[_0xc176('0x47')]&&_0x196cb0[_0xc176('0x47')][0x8]?_0x196cb0[_0xc176('0x47')][0x8][_0xc176('0x4b')]:undefined)||''},{'name':'attrChatWebsites','value':_0x196cb0[_0xc176('0x5b')]||(_0x196cb0['attrs']&&_0x196cb0[_0xc176('0x47')][0x9]?_0x196cb0[_0xc176('0x47')][0x9][_0xc176('0x4b')]:undefined)||''}];case _0xc176('0x5c'):case _0xc176('0x5d'):return[{'name':_0xc176('0x5e'),'value':_0x196cb0[_0xc176('0x5e')]||(_0x196cb0['attrs']&&_0x196cb0[_0xc176('0x47')][0x0]?_0x196cb0[_0xc176('0x47')][0x0]['value']:undefined)||_0xc176('0x52')},{'name':_0xc176('0x5f'),'value':_0x196cb0[_0xc176('0x5f')]||(_0x196cb0[_0xc176('0x47')]&&_0x196cb0[_0xc176('0x47')][0x1]?_0x196cb0[_0xc176('0x47')][0x1][_0xc176('0x4b')]:undefined)||null},{'name':'attrSerie3','value':_0x196cb0[_0xc176('0x60')]||(_0x196cb0[_0xc176('0x47')]&&_0x196cb0[_0xc176('0x47')][0x2]?_0x196cb0['attrs'][0x2]['value']:undefined)||null},{'name':_0xc176('0x53'),'value':_0x196cb0[_0xc176('0x53')]||(_0x196cb0[_0xc176('0x47')]&&_0x196cb0['attrs'][0x3]?_0x196cb0['attrs'][0x3][_0xc176('0x4b')]:undefined)||[]},{'name':_0xc176('0x54'),'value':_0x196cb0[_0xc176('0x54')]||(_0x196cb0[_0xc176('0x47')]&&_0x196cb0['attrs'][0x4]?_0x196cb0[_0xc176('0x47')][0x4]['value']:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x196cb0[_0xc176('0x56')]||(_0x196cb0[_0xc176('0x47')]&&_0x196cb0[_0xc176('0x47')][0x5]?_0x196cb0[_0xc176('0x47')][0x5][_0xc176('0x4b')]:undefined)||''},{'name':_0xc176('0x57'),'value':_0x196cb0[_0xc176('0x57')]||(_0x196cb0['attrs']&&_0x196cb0[_0xc176('0x47')][0x6]?_0x196cb0['attrs'][0x6][_0xc176('0x4b')]:undefined)||''},{'name':_0xc176('0x58'),'value':_0x196cb0[_0xc176('0x58')]||(_0x196cb0[_0xc176('0x47')]&&_0x196cb0['attrs'][0x7]?_0x196cb0[_0xc176('0x47')][0x7]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x196cb0[_0xc176('0x59')]||(_0x196cb0[_0xc176('0x47')]&&_0x196cb0[_0xc176('0x47')][0x8]?_0x196cb0[_0xc176('0x47')][0x8][_0xc176('0x4b')]:undefined)||''},{'name':_0xc176('0x5a'),'value':_0x196cb0[_0xc176('0x5a')]||(_0x196cb0['attrs']&&_0x196cb0[_0xc176('0x47')][0x9]?_0x196cb0[_0xc176('0x47')][0x9][_0xc176('0x4b')]:undefined)||''},{'name':'attrChatWebsites','value':_0x196cb0[_0xc176('0x5b')]||(_0x196cb0['attrs']&&_0x196cb0['attrs'][0xa]?_0x196cb0[_0xc176('0x47')][0xa]['value']:undefined)||''}];case'web-report':return[{'name':_0xc176('0x61'),'type':_0x196cb0[_0xc176('0x62')]||(_0x196cb0[_0xc176('0x47')]&&_0x196cb0[_0xc176('0x47')][0x0]?_0x196cb0[_0xc176('0x47')][0x0][_0xc176('0x44')]:undefined)||null,'value':_0x196cb0[_0xc176('0x61')]||(_0x196cb0[_0xc176('0x47')]&&_0x196cb0['attrs'][0x0]?_0x196cb0['attrs'][0x0][_0xc176('0x4b')]:undefined)||null},{'name':_0xc176('0x63'),'value':_0x196cb0[_0xc176('0x63')]||(_0x196cb0[_0xc176('0x47')]&&_0x196cb0['attrs'][0x1]?_0x196cb0[_0xc176('0x47')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x209ca6){logger[_0xc176('0x30')](_0xc176('0x64'),JSON[_0xc176('0x65')](_0x209ca6));return[];}}exports['create']=function(_0x1580fe,_0x1ce264){if(_0x1580fe[_0xc176('0x66')]){_0x1580fe[_0xc176('0x66')][_0xc176('0x47')]=widgetAttributes(_0x1580fe[_0xc176('0x66')]);}return db[_0xc176('0x36')][_0xc176('0x67')](_0x1580fe[_0xc176('0x66')],{})[_0xc176('0x2f')](respondWithResult(_0x1ce264,0xc9))[_0xc176('0x43')](handleError(_0x1ce264,null));};exports[_0xc176('0x2d')]=function(_0x55ccd7,_0x20ff1f){if(_0x55ccd7[_0xc176('0x66')]['id']){delete _0x55ccd7[_0xc176('0x66')]['id'];}_0x55ccd7['body'][_0xc176('0x47')]=widgetAttributes(_0x55ccd7[_0xc176('0x66')]);return db[_0xc176('0x36')][_0xc176('0x42')]({'where':{'id':_0x55ccd7[_0xc176('0x35')]['id']}})[_0xc176('0x2f')](handleEntityNotFound(_0x20ff1f,null))[_0xc176('0x2f')](saveUpdates(_0x55ccd7[_0xc176('0x66')],null))['then'](respondWithResult(_0x20ff1f,null))[_0xc176('0x43')](handleError(_0x20ff1f,null));}; \ No newline at end of file +var _0xf1c6=['send','params','model','DashboardItem','query','filters','intersection','attributes','fields','length','includeAll','include','merge','find','then','catch','type','iframe','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../mysqldb','redis','./dashboardItem.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','error','stack','name'];(function(_0x35b914,_0x42351e){var _0x1d8bfb=function(_0x3b36a5){while(--_0x3b36a5){_0x35b914['push'](_0x35b914['shift']());}};_0x1d8bfb(++_0x42351e);}(_0xf1c6,0x145));var _0x6f1c=function(_0x1f47b1,_0x97a4d2){_0x1f47b1=_0x1f47b1-0x0;var _0x69e436=_0xf1c6[_0x1f47b1];return _0x69e436;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6f1c('0x0'));var jsonpatch=require(_0x6f1c('0x1'));var rp=require(_0x6f1c('0x2'));var moment=require(_0x6f1c('0x3'));var BPromise=require(_0x6f1c('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6f1c('0x5'));var sox=require('sox');var csv=require(_0x6f1c('0x6'));var ejs=require(_0x6f1c('0x7'));var fs=require('fs');var fs_extra=require(_0x6f1c('0x8'));var _=require('lodash');var squel=require(_0x6f1c('0x9'));var crypto=require('crypto');var jsforce=require(_0x6f1c('0xa'));var deskjs=require(_0x6f1c('0xb'));var toCsv=require(_0x6f1c('0x6'));var querystring=require('querystring');var Papa=require(_0x6f1c('0xc'));var Redis=require('ioredis');var authService=require(_0x6f1c('0xd'));var qs=require(_0x6f1c('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6f1c('0xf'));var logger=require(_0x6f1c('0x10'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6f1c('0x11'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6f1c('0x12')]));require(_0x6f1c('0x13'))[_0x6f1c('0x14')](socket);function respondWithStatusCode(_0x5549d1,_0x82203a){_0x82203a=_0x82203a||0xcc;return function(_0x238c62){if(_0x238c62){return _0x5549d1[_0x6f1c('0x15')](_0x82203a);}return _0x5549d1['status'](_0x82203a)[_0x6f1c('0x16')]();};}function respondWithResult(_0x210abb,_0x5515fa){_0x5515fa=_0x5515fa||0xc8;return function(_0x28fc5f){if(_0x28fc5f){return _0x210abb[_0x6f1c('0x17')](_0x5515fa)[_0x6f1c('0x18')](_0x28fc5f);}};}function respondWithFilteredResult(_0x6e2d39,_0x3c3e21){return function(_0x16d2bb){if(_0x16d2bb){var _0x491151=typeof _0x3c3e21[_0x6f1c('0x19')]===_0x6f1c('0x1a')&&typeof _0x3c3e21[_0x6f1c('0x1b')]===_0x6f1c('0x1a');var _0x20c2bb=_0x16d2bb[_0x6f1c('0x1c')];var _0x4dbb3f=_0x491151?0x0:_0x3c3e21['offset'];var _0x58c2d8=_0x491151?_0x16d2bb[_0x6f1c('0x1c')]:_0x3c3e21['offset']+_0x3c3e21[_0x6f1c('0x1b')];var _0x4f6637;if(_0x58c2d8>=_0x20c2bb){_0x58c2d8=_0x20c2bb;_0x4f6637=0xc8;}else{_0x4f6637=0xce;}_0x6e2d39[_0x6f1c('0x17')](_0x4f6637);return _0x6e2d39[_0x6f1c('0x1d')](_0x6f1c('0x1e'),_0x4dbb3f+'-'+_0x58c2d8+'/'+_0x20c2bb)[_0x6f1c('0x18')](_0x16d2bb);}return null;};}function patchUpdates(_0x2ed8f1){return function(_0x3a082c){try{jsonpatch[_0x6f1c('0x1f')](_0x3a082c,_0x2ed8f1,!![]);}catch(_0x35934b){return BPromise[_0x6f1c('0x20')](_0x35934b);}return _0x3a082c[_0x6f1c('0x21')]();};}function saveUpdates(_0x130bae,_0x2da230){return function(_0x388416){if(_0x388416){return _0x388416[_0x6f1c('0x22')](_0x130bae)['then'](function(_0x2a3b6a){return _0x2a3b6a;});}return null;};}function removeEntity(_0x2b29af,_0x4a8fc1){return function(_0x3c0dd1){if(_0x3c0dd1){return _0x3c0dd1[_0x6f1c('0x23')]()['then'](function(){_0x2b29af['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x500e36,_0x16fe5a){return function(_0x1ac9f5){if(!_0x1ac9f5){_0x500e36[_0x6f1c('0x15')](0x194);}return _0x1ac9f5;};}function handleError(_0x30267d,_0x29b952){_0x29b952=_0x29b952||0x1f4;return function(_0x66cb25){logger[_0x6f1c('0x24')](_0x66cb25[_0x6f1c('0x25')]);if(_0x66cb25[_0x6f1c('0x26')]){delete _0x66cb25[_0x6f1c('0x26')];}_0x30267d[_0x6f1c('0x17')](_0x29b952)[_0x6f1c('0x27')](_0x66cb25);};}exports['show']=function(_0x528e40,_0x1f783a){var _0x4084af={'raw':![],'where':{'id':_0x528e40[_0x6f1c('0x28')]['id']}},_0x383802={};_0x383802[_0x6f1c('0x29')]=_['keys'](db[_0x6f1c('0x2a')]['rawAttributes']);_0x383802[_0x6f1c('0x2b')]=_['keys'](_0x528e40[_0x6f1c('0x2b')]);_0x383802[_0x6f1c('0x2c')]=_[_0x6f1c('0x2d')](_0x383802[_0x6f1c('0x29')],_0x383802[_0x6f1c('0x2b')]);_0x4084af[_0x6f1c('0x2e')]=_[_0x6f1c('0x2d')](_0x383802[_0x6f1c('0x29')],qs[_0x6f1c('0x2f')](_0x528e40[_0x6f1c('0x2b')]['fields']));_0x4084af[_0x6f1c('0x2e')]=_0x4084af[_0x6f1c('0x2e')][_0x6f1c('0x30')]?_0x4084af[_0x6f1c('0x2e')]:_0x383802[_0x6f1c('0x29')];if(_0x528e40[_0x6f1c('0x2b')][_0x6f1c('0x31')]){_0x4084af[_0x6f1c('0x32')]=[{'all':!![]}];}_0x4084af=_[_0x6f1c('0x33')]({},_0x4084af,_0x528e40['options']);return db['DashboardItem'][_0x6f1c('0x34')](_0x4084af)[_0x6f1c('0x35')](handleEntityNotFound(_0x1f783a,null))[_0x6f1c('0x35')](respondWithResult(_0x1f783a,null))[_0x6f1c('0x36')](handleError(_0x1f783a,null));};exports[_0x6f1c('0x23')]=function(_0x84fa1c,_0x19d62b){return db[_0x6f1c('0x2a')][_0x6f1c('0x34')]({'where':{'id':_0x84fa1c[_0x6f1c('0x28')]['id']}})[_0x6f1c('0x35')](handleEntityNotFound(_0x19d62b,null))[_0x6f1c('0x35')](removeEntity(_0x19d62b,null))[_0x6f1c('0x36')](handleError(_0x19d62b,null));};function widgetAttributes(_0x38d241){try{switch(_0x38d241[_0x6f1c('0x37')]){case _0x6f1c('0x38'):return[{'name':'attrUrl','value':_0x38d241['attrUrl']||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241[_0x6f1c('0x39')][0x0]?_0x38d241[_0x6f1c('0x39')][0x0][_0x6f1c('0x3a')]:undefined)||_0x6f1c('0x3b')}];case _0x6f1c('0x3c'):return[{'name':_0x6f1c('0x3d'),'value':_0x38d241[_0x6f1c('0x3d')]||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241['attrs'][0x0]?_0x38d241[_0x6f1c('0x39')][0x0][_0x6f1c('0x3a')]:undefined)||''}];case _0x6f1c('0x3e'):return[{'name':_0x6f1c('0x3f'),'value':_0x38d241['attrHourFormat']||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241['attrs'][0x0]?_0x38d241[_0x6f1c('0x39')][0x0][_0x6f1c('0x3a')]:undefined)||_0x6f1c('0x40')},{'name':_0x6f1c('0x41'),'value':_0x38d241[_0x6f1c('0x41')]||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241[_0x6f1c('0x39')][0x1]?_0x38d241[_0x6f1c('0x39')][0x1][_0x6f1c('0x3a')]:undefined)||_0x6f1c('0x42')},{'name':_0x6f1c('0x43'),'value':_0x38d241[_0x6f1c('0x43')]||(_0x38d241['attrs']&&_0x38d241[_0x6f1c('0x39')][0x2]?_0x38d241[_0x6f1c('0x39')][0x2]['value']:undefined)||0xc}];case _0x6f1c('0x44'):return[{'name':_0x6f1c('0x45'),'value':_0x38d241[_0x6f1c('0x45')]||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241[_0x6f1c('0x39')][0x0]?_0x38d241[_0x6f1c('0x39')][0x0][_0x6f1c('0x3a')]:undefined)||'total'},{'name':_0x6f1c('0x46'),'value':_0x38d241['attrVoiceQueues']||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241[_0x6f1c('0x39')][0x1]?_0x38d241[_0x6f1c('0x39')][0x1][_0x6f1c('0x3a')]:undefined)||[]},{'name':_0x6f1c('0x43'),'value':_0x38d241['attrFontSize']||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241[_0x6f1c('0x39')][0x2]?_0x38d241['attrs'][0x2][_0x6f1c('0x3a')]:undefined)||0x14},{'name':_0x6f1c('0x47'),'value':_0x38d241[_0x6f1c('0x47')]||(_0x38d241['attrs']&&_0x38d241[_0x6f1c('0x39')][0x3]?_0x38d241[_0x6f1c('0x39')][0x3][_0x6f1c('0x3a')]:undefined)||_0x6f1c('0x48')},{'name':_0x6f1c('0x49'),'value':_0x38d241[_0x6f1c('0x49')]||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241[_0x6f1c('0x39')][0x4]?_0x38d241['attrs'][0x4][_0x6f1c('0x3a')]:undefined)||''},{'name':_0x6f1c('0x4a'),'value':_0x38d241[_0x6f1c('0x4a')]||(_0x38d241['attrs']&&_0x38d241[_0x6f1c('0x39')][0x5]?_0x38d241[_0x6f1c('0x39')][0x5][_0x6f1c('0x3a')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x38d241[_0x6f1c('0x4b')]||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241[_0x6f1c('0x39')][0x6]?_0x38d241[_0x6f1c('0x39')][0x6][_0x6f1c('0x3a')]:undefined)||''},{'name':_0x6f1c('0x4c'),'value':_0x38d241[_0x6f1c('0x4c')]||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241['attrs'][0x7]?_0x38d241[_0x6f1c('0x39')][0x7][_0x6f1c('0x3a')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x38d241[_0x6f1c('0x4d')]||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241['attrs'][0x8]?_0x38d241['attrs'][0x8]['value']:undefined)||''},{'name':_0x6f1c('0x4e'),'value':_0x38d241['attrChatWebsites']||(_0x38d241['attrs']&&_0x38d241[_0x6f1c('0x39')][0x9]?_0x38d241[_0x6f1c('0x39')][0x9]['value']:undefined)||''}];case _0x6f1c('0x4f'):case _0x6f1c('0x50'):return[{'name':_0x6f1c('0x51'),'value':_0x38d241['attrSerie1']||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241[_0x6f1c('0x39')][0x0]?_0x38d241['attrs'][0x0][_0x6f1c('0x3a')]:undefined)||'total'},{'name':_0x6f1c('0x52'),'value':_0x38d241[_0x6f1c('0x52')]||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241[_0x6f1c('0x39')][0x1]?_0x38d241[_0x6f1c('0x39')][0x1][_0x6f1c('0x3a')]:undefined)||null},{'name':'attrSerie3','value':_0x38d241['attrSerie3']||(_0x38d241['attrs']&&_0x38d241[_0x6f1c('0x39')][0x2]?_0x38d241[_0x6f1c('0x39')][0x2]['value']:undefined)||null},{'name':_0x6f1c('0x46'),'value':_0x38d241['attrVoiceQueues']||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241['attrs'][0x3]?_0x38d241[_0x6f1c('0x39')][0x3][_0x6f1c('0x3a')]:undefined)||[]},{'name':_0x6f1c('0x47'),'value':_0x38d241[_0x6f1c('0x47')]||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241[_0x6f1c('0x39')][0x4]?_0x38d241[_0x6f1c('0x39')][0x4][_0x6f1c('0x3a')]:undefined)||_0x6f1c('0x48')},{'name':_0x6f1c('0x49'),'value':_0x38d241[_0x6f1c('0x49')]||(_0x38d241['attrs']&&_0x38d241[_0x6f1c('0x39')][0x5]?_0x38d241['attrs'][0x5][_0x6f1c('0x3a')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x38d241[_0x6f1c('0x4a')]||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241['attrs'][0x6]?_0x38d241[_0x6f1c('0x39')][0x6][_0x6f1c('0x3a')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x38d241['attrSmsAccounts']||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241[_0x6f1c('0x39')][0x7]?_0x38d241[_0x6f1c('0x39')][0x7][_0x6f1c('0x3a')]:undefined)||''},{'name':_0x6f1c('0x4c'),'value':_0x38d241[_0x6f1c('0x4c')]||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241[_0x6f1c('0x39')][0x8]?_0x38d241[_0x6f1c('0x39')][0x8][_0x6f1c('0x3a')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x38d241[_0x6f1c('0x4d')]||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241['attrs'][0x9]?_0x38d241['attrs'][0x9][_0x6f1c('0x3a')]:undefined)||''},{'name':_0x6f1c('0x4e'),'value':_0x38d241['attrChatWebsites']||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241[_0x6f1c('0x39')][0xa]?_0x38d241[_0x6f1c('0x39')][0xa][_0x6f1c('0x3a')]:undefined)||''}];case _0x6f1c('0x53'):return[{'name':_0x6f1c('0x54'),'type':_0x38d241[_0x6f1c('0x55')]||(_0x38d241['attrs']&&_0x38d241[_0x6f1c('0x39')][0x0]?_0x38d241[_0x6f1c('0x39')][0x0]['type']:undefined)||null,'value':_0x38d241[_0x6f1c('0x54')]||(_0x38d241['attrs']&&_0x38d241[_0x6f1c('0x39')][0x0]?_0x38d241[_0x6f1c('0x39')][0x0]['value']:undefined)||null},{'name':_0x6f1c('0x56'),'value':_0x38d241[_0x6f1c('0x56')]||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241['attrs'][0x1]?_0x38d241[_0x6f1c('0x39')][0x1][_0x6f1c('0x3a')]:undefined)||0x0}];default:return[];}}catch(_0x5a69ec){logger[_0x6f1c('0x24')](_0x6f1c('0x57'),JSON[_0x6f1c('0x58')](_0x5a69ec));return[];}}exports[_0x6f1c('0x59')]=function(_0x51ae01,_0xad0e0f){if(_0x51ae01[_0x6f1c('0x5a')]){_0x51ae01[_0x6f1c('0x5a')]['attrs']=widgetAttributes(_0x51ae01[_0x6f1c('0x5a')]);}return db[_0x6f1c('0x2a')]['create'](_0x51ae01[_0x6f1c('0x5a')],{})[_0x6f1c('0x35')](respondWithResult(_0xad0e0f,0xc9))[_0x6f1c('0x36')](handleError(_0xad0e0f,null));};exports[_0x6f1c('0x22')]=function(_0xc3e7c0,_0x4bd3e3){if(_0xc3e7c0['body']['id']){delete _0xc3e7c0[_0x6f1c('0x5a')]['id'];}_0xc3e7c0['body']['attrs']=widgetAttributes(_0xc3e7c0[_0x6f1c('0x5a')]);return db['DashboardItem'][_0x6f1c('0x34')]({'where':{'id':_0xc3e7c0[_0x6f1c('0x28')]['id']}})[_0x6f1c('0x35')](handleEntityNotFound(_0x4bd3e3,null))[_0x6f1c('0x35')](saveUpdates(_0xc3e7c0[_0x6f1c('0x5a')],null))[_0x6f1c('0x35')](respondWithResult(_0x4bd3e3,null))[_0x6f1c('0x36')](handleError(_0x4bd3e3,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 8a6e1ee..a224556 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 _0xcac5=['hasOwnProperty','hook','DashboardItem','setMaxListeners','save','update','remove'];(function(_0x129d36,_0x28147f){var _0xfd9793=function(_0x24bc91){while(--_0x24bc91){_0x129d36['push'](_0x129d36['shift']());}};_0xfd9793(++_0x28147f);}(_0xcac5,0xb8));var _0x5cac=function(_0x42f98b,_0x2ab798){_0x42f98b=_0x42f98b-0x0;var _0x9d4c8d=_0xcac5[_0x42f98b];return _0x9d4c8d;};'use strict';var EventEmitter=require('events');var DashboardItem=require('../../mysqldb')['db'][_0x5cac('0x0')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x5cac('0x1')](0x0);var events={'afterCreate':_0x5cac('0x2'),'afterUpdate':_0x5cac('0x3'),'afterDestroy':_0x5cac('0x4')};function emitEvent(_0x5722ed){return function(_0x1824ee,_0x20eeff,_0xcf5f0){DashboardItemEvents['emit'](_0x5722ed+':'+_0x1824ee['id'],_0x1824ee);DashboardItemEvents['emit'](_0x5722ed,_0x1824ee);_0xcf5f0(null);};}for(var e in events){if(events[_0x5cac('0x5')](e)){var event=events[e];DashboardItem[_0x5cac('0x6')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file +var _0xc767=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','remove','emit'];(function(_0x1bc38d,_0x41da7b){var _0x3acf8d=function(_0x5b65ad){while(--_0x5b65ad){_0x1bc38d['push'](_0x1bc38d['shift']());}};_0x3acf8d(++_0x41da7b);}(_0xc767,0x108));var _0x7c76=function(_0x319e2e,_0x2f727f){_0x319e2e=_0x319e2e-0x0;var _0x302524=_0xc767[_0x319e2e];return _0x302524;};'use strict';var EventEmitter=require(_0x7c76('0x0'));var DashboardItem=require(_0x7c76('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7c76('0x2'),'afterUpdate':_0x7c76('0x3'),'afterDestroy':_0x7c76('0x4')};function emitEvent(_0x32a03c){return function(_0x4d208b,_0x1f4472,_0x1207e3){DashboardItemEvents[_0x7c76('0x5')](_0x32a03c+':'+_0x4d208b['id'],_0x4d208b);DashboardItemEvents[_0x7c76('0x5')](_0x32a03c,_0x4d208b);_0x1207e3(null);};}for(var e in events){if(events[_0x7c76('0x6')](e)){var event=events[e];DashboardItem[_0x7c76('0x7')](e,emitEvent(event));}}module[_0x7c76('0x8')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index d847dc3..f3a6bb9 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 _0x081e=['exports','define','DashboardItem','dashboard_items','lodash','../../config/logger','api','moment','request-promise','path','../../config/environment','./dashboardItem.attributes'];(function(_0x167d8f,_0x1ef533){var _0x1d0fd3=function(_0x4854ec){while(--_0x4854ec){_0x167d8f['push'](_0x167d8f['shift']());}};_0x1d0fd3(++_0x1ef533);}(_0x081e,0x160));var _0xe081=function(_0x35eb94,_0x2e78a8){_0x35eb94=_0x35eb94-0x0;var _0x593add=_0x081e[_0x35eb94];return _0x593add;};'use strict';var _=require(_0xe081('0x0'));var util=require('util');var logger=require(_0xe081('0x1'))(_0xe081('0x2'));var moment=require(_0xe081('0x3'));var BPromise=require('bluebird');var rp=require(_0xe081('0x4'));var fs=require('fs');var path=require(_0xe081('0x5'));var rimraf=require('rimraf');var config=require(_0xe081('0x6'));var attributes=require(_0xe081('0x7'));module[_0xe081('0x8')]=function(_0x345108,_0x3c446c){return _0x345108[_0xe081('0x9')](_0xe081('0xa'),attributes,{'tableName':_0xe081('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1f93=['exports','define','DashboardItem','dashboard_items','util','../../config/logger','api','bluebird','request-promise','rimraf','./dashboardItem.attributes'];(function(_0x849663,_0x19ca3b){var _0x7e62ae=function(_0x85d121){while(--_0x85d121){_0x849663['push'](_0x849663['shift']());}};_0x7e62ae(++_0x19ca3b);}(_0x1f93,0x19b));var _0x31f9=function(_0x314239,_0x423341){_0x314239=_0x314239-0x0;var _0x2f77ca=_0x1f93[_0x314239];return _0x2f77ca;};'use strict';var _=require('lodash');var util=require(_0x31f9('0x0'));var logger=require(_0x31f9('0x1'))(_0x31f9('0x2'));var moment=require('moment');var BPromise=require(_0x31f9('0x3'));var rp=require(_0x31f9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x31f9('0x5'));var config=require('../../config/environment');var attributes=require(_0x31f9('0x6'));module[_0x31f9('0x7')]=function(_0x584af2,_0x5f309c){return _0x584af2[_0x31f9('0x8')](_0x31f9('0x9'),attributes,{'tableName':_0x31f9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index 2af9ecd..9b59ecf 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 _0xd6d2=['redis','localhost','socket.io-emitter','./dashboardItem.socket','register','request','DashboardItem,\x20%s,\x20%s','debug','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','defaults'];(function(_0x32e74,_0xe869ab){var _0x1d3dda=function(_0x2f81f3){while(--_0x2f81f3){_0x32e74['push'](_0x32e74['shift']());}};_0x1d3dda(++_0xe869ab);}(_0xd6d2,0x11e));var _0x2d6d=function(_0x114738,_0x2b1942){_0x114738=_0x114738-0x0;var _0x46cf7e=_0xd6d2[_0x114738];return _0x46cf7e;};'use strict';var _=require(_0x2d6d('0x0'));var util=require(_0x2d6d('0x1'));var moment=require('moment');var BPromise=require(_0x2d6d('0x2'));var rs=require(_0x2d6d('0x3'));var fs=require('fs');var Redis=require(_0x2d6d('0x4'));var db=require(_0x2d6d('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2d6d('0x6'));var config=require('../../config/environment');var jayson=require(_0x2d6d('0x7'));var client=jayson[_0x2d6d('0x8')][_0x2d6d('0x9')]({'port':0x232a});config['redis']=_[_0x2d6d('0xa')](config[_0x2d6d('0xb')],{'host':_0x2d6d('0xc'),'port':0x18eb});var socket=require(_0x2d6d('0xd'))(new Redis(config[_0x2d6d('0xb')]));require(_0x2d6d('0xe'))[_0x2d6d('0xf')](socket);function respondWithRpcPromise(_0xa79c86,_0x5d91cc,_0x229bab){return new BPromise(function(_0x2b592b,_0x287e9d){return client[_0x2d6d('0x10')](_0xa79c86,_0x229bab)['then'](function(_0x2f00fc){logger['info'](_0x2d6d('0x11'),_0x5d91cc,'request\x20sent');logger[_0x2d6d('0x12')](_0x2d6d('0x13'),_0x5d91cc,_0x2d6d('0x14'),JSON[_0x2d6d('0x15')](_0x2f00fc));if(_0x2f00fc[_0x2d6d('0x16')]){if(_0x2f00fc[_0x2d6d('0x16')][_0x2d6d('0x17')]===0x1f4){logger[_0x2d6d('0x16')](_0x2d6d('0x11'),_0x5d91cc,_0x2f00fc[_0x2d6d('0x16')][_0x2d6d('0x18')]);return _0x287e9d(_0x2f00fc['error']['message']);}logger[_0x2d6d('0x16')](_0x2d6d('0x11'),_0x5d91cc,_0x2f00fc[_0x2d6d('0x16')]['message']);return _0x2b592b(_0x2f00fc['error']['message']);}else{logger[_0x2d6d('0x19')]('DashboardItem,\x20%s,\x20%s',_0x5d91cc,_0x2d6d('0x14'));_0x2b592b(_0x2f00fc['result'][_0x2d6d('0x18')]);}})[_0x2d6d('0x1a')](function(_0x1c1daa){logger[_0x2d6d('0x16')](_0x2d6d('0x11'),_0x5d91cc,_0x1c1daa);_0x287e9d(_0x1c1daa);});});} \ No newline at end of file +var _0x5675=['defaults','socket.io-emitter','./dashboardItem.socket','register','request','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','redis'];(function(_0x24cd30,_0x13d408){var _0x357f1f=function(_0x5e9818){while(--_0x5e9818){_0x24cd30['push'](_0x24cd30['shift']());}};_0x357f1f(++_0x13d408);}(_0x5675,0xa4));var _0x5567=function(_0x266618,_0x18f637){_0x266618=_0x266618-0x0;var _0x54dbf5=_0x5675[_0x266618];return _0x54dbf5;};'use strict';var _=require(_0x5567('0x0'));var util=require(_0x5567('0x1'));var moment=require(_0x5567('0x2'));var BPromise=require(_0x5567('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5567('0x4'));var db=require(_0x5567('0x5'))['db'];var utils=require(_0x5567('0x6'));var logger=require(_0x5567('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5567('0x8'));var client=jayson['client'][_0x5567('0x9')]({'port':0x232a});config[_0x5567('0xa')]=_[_0x5567('0xb')](config[_0x5567('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x5567('0xc'))(new Redis(config[_0x5567('0xa')]));require(_0x5567('0xd'))[_0x5567('0xe')](socket);function respondWithRpcPromise(_0x61cd44,_0x31469b,_0x267a49){return new BPromise(function(_0x38c84f,_0x2164c5){return client[_0x5567('0xf')](_0x61cd44,_0x267a49)['then'](function(_0x29d92d){logger['info'](_0x5567('0x10'),_0x31469b,_0x5567('0x11'));logger[_0x5567('0x12')](_0x5567('0x13'),_0x31469b,'request\x20sent',JSON[_0x5567('0x14')](_0x29d92d));if(_0x29d92d[_0x5567('0x15')]){if(_0x29d92d[_0x5567('0x15')][_0x5567('0x16')]===0x1f4){logger[_0x5567('0x15')]('DashboardItem,\x20%s,\x20%s',_0x31469b,_0x29d92d[_0x5567('0x15')][_0x5567('0x17')]);return _0x2164c5(_0x29d92d[_0x5567('0x15')][_0x5567('0x17')]);}logger[_0x5567('0x15')]('DashboardItem,\x20%s,\x20%s',_0x31469b,_0x29d92d['error'][_0x5567('0x17')]);return _0x38c84f(_0x29d92d[_0x5567('0x15')][_0x5567('0x17')]);}else{logger['info']('DashboardItem,\x20%s,\x20%s',_0x31469b,_0x5567('0x11'));_0x38c84f(_0x29d92d[_0x5567('0x18')][_0x5567('0x17')]);}})['catch'](function(_0x152dd8){logger[_0x5567('0x15')](_0x5567('0x10'),_0x31469b,_0x152dd8);_0x2164c5(_0x152dd8);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 9b2087b..4f09039 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 _0x27a5=['./dashboardItem.events','remove','update','emit','removeListener','register','length','dashboardItem:'];(function(_0x4fb299,_0x29b701){var _0x351765=function(_0x4f126a){while(--_0x4f126a){_0x4fb299['push'](_0x4fb299['shift']());}};_0x351765(++_0x29b701);}(_0x27a5,0xa0));var _0x527a=function(_0x3cddcb,_0x5e0bbd){_0x3cddcb=_0x3cddcb-0x0;var _0x3878e8=_0x27a5[_0x3cddcb];return _0x3878e8;};'use strict';var DashboardItemEvents=require(_0x527a('0x0'));var events=['save',_0x527a('0x1'),_0x527a('0x2')];function createListener(_0x4c4340,_0x46dc62){return function(_0x249d76){_0x46dc62[_0x527a('0x3')](_0x4c4340,_0x249d76);};}function removeListener(_0xabcad0,_0x335a65){return function(){DashboardItemEvents[_0x527a('0x4')](_0xabcad0,_0x335a65);};}exports[_0x527a('0x5')]=function(_0x498804){for(var _0x5bc043=0x0,_0x41d7b3=events[_0x527a('0x6')];_0x5bc043<_0x41d7b3;_0x5bc043++){var _0x5aec2d=events[_0x5bc043];var _0x559c24=createListener(_0x527a('0x7')+_0x5aec2d,_0x498804);DashboardItemEvents['on'](_0x5aec2d,_0x559c24);}}; \ No newline at end of file +var _0x209a=['update','emit','removeListener','register','length','dashboardItem:','./dashboardItem.events','save','remove'];(function(_0x108deb,_0x141434){var _0x5826ab=function(_0x4a5dcd){while(--_0x4a5dcd){_0x108deb['push'](_0x108deb['shift']());}};_0x5826ab(++_0x141434);}(_0x209a,0xba));var _0xa209=function(_0x87a5a3,_0x43a3f5){_0x87a5a3=_0x87a5a3-0x0;var _0x498feb=_0x209a[_0x87a5a3];return _0x498feb;};'use strict';var DashboardItemEvents=require(_0xa209('0x0'));var events=[_0xa209('0x1'),_0xa209('0x2'),_0xa209('0x3')];function createListener(_0x1d26ba,_0x16d39b){return function(_0x5ab220){_0x16d39b[_0xa209('0x4')](_0x1d26ba,_0x5ab220);};}function removeListener(_0x3e28df,_0x4a9f5a){return function(){DashboardItemEvents[_0xa209('0x5')](_0x3e28df,_0x4a9f5a);};}exports[_0xa209('0x6')]=function(_0x5e9cab){for(var _0x147c51=0x0,_0x256f78=events[_0xa209('0x7')];_0x147c51<_0x256f78;_0x147c51++){var _0x439039=events[_0x147c51];var _0x4df966=createListener(_0xa209('0x8')+_0x439039,_0x5e9cab);DashboardItemEvents['on'](_0x439039,_0x4df966);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 216335f..40667ee 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 _0xcd0e=['post','isAuthenticated','create','put','update','delete','exports','multer','util','path','express','../../config/environment','./dashboardItem.controller','get','/:id','show'];(function(_0x3e16fa,_0x266062){var _0x5f3666=function(_0x19c2c7){while(--_0x19c2c7){_0x3e16fa['push'](_0x3e16fa['shift']());}};_0x5f3666(++_0x266062);}(_0xcd0e,0x77));var _0xecd0=function(_0x25248b,_0x3c8491){_0x25248b=_0x25248b-0x0;var _0x509939=_0xcd0e[_0x25248b];return _0x509939;};'use strict';var multer=require(_0xecd0('0x0'));var util=require(_0xecd0('0x1'));var path=require(_0xecd0('0x2'));var timeout=require('connect-timeout');var express=require(_0xecd0('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xecd0('0x4'));var controller=require(_0xecd0('0x5'));router[_0xecd0('0x6')](_0xecd0('0x7'),auth['isAuthenticated'](),controller[_0xecd0('0x8')]);router[_0xecd0('0x9')]('/',auth[_0xecd0('0xa')](),controller[_0xecd0('0xb')]);router[_0xecd0('0xc')](_0xecd0('0x7'),auth[_0xecd0('0xa')](),controller[_0xecd0('0xd')]);router[_0xecd0('0xe')](_0xecd0('0x7'),auth[_0xecd0('0xa')](),controller['destroy']);module[_0xecd0('0xf')]=router; \ No newline at end of file +var _0xcd7b=['get','/:id','isAuthenticated','show','put','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../config/environment','./dashboardItem.controller'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0xcd7b,0x116));var _0xbcd7=function(_0x57e869,_0x18a92d){_0x57e869=_0x57e869-0x0;var _0x4524db=_0xcd7b[_0x57e869];return _0x4524db;};'use strict';var multer=require(_0xbcd7('0x0'));var util=require('util');var path=require(_0xbcd7('0x1'));var timeout=require(_0xbcd7('0x2'));var express=require(_0xbcd7('0x3'));var router=express['Router']();var fs_extra=require(_0xbcd7('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xbcd7('0x5'));var controller=require(_0xbcd7('0x6'));router[_0xbcd7('0x7')](_0xbcd7('0x8'),auth[_0xbcd7('0x9')](),controller[_0xbcd7('0xa')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xbcd7('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xbcd7('0xc')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xbcd7('0xd')]);module[_0xbcd7('0xe')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index b57e982..04d8e4a 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 _0x6324=['STRING','sequelize','exports','ENUM','first','second','third'];(function(_0x337bee,_0x53cbca){var _0x24c37d=function(_0x535b06){while(--_0x535b06){_0x337bee['push'](_0x337bee['shift']());}};_0x24c37d(++_0x53cbca);}(_0x6324,0xe1));var _0x4632=function(_0x42653f,_0x531aed){_0x42653f=_0x42653f-0x0;var _0x55185f=_0x6324[_0x42653f];return _0x55185f;};'use strict';var Sequelize=require(_0x4632('0x0'));module[_0x4632('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize[_0x4632('0x2')](_0x4632('0x3'),_0x4632('0x4'),_0x4632('0x5')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0x4632('0x6')]}}; \ No newline at end of file +var _0x3418=['first','second','third','sequelize','STRING','ENUM'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x3418,0xbd));var _0x8341=function(_0xcc23d9,_0xdf1edb){_0xcc23d9=_0xcc23d9-0x0;var _0x54d3c3=_0x3418[_0xcc23d9];return _0x54d3c3;};'use strict';var Sequelize=require(_0x8341('0x0'));module['exports']={'name':{'type':Sequelize[_0x8341('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0x8341('0x2')](_0x8341('0x3'),_0x8341('0x4'),_0x8341('0x5')),'allowNull':![],'defaultValue':_0x8341('0x3')},'description':{'type':Sequelize[_0x8341('0x1')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index e04a6f7..023db19 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 _0xb957=['filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','rawAttributes','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','Dispositions','UserProfileResource','sendStatus','error','stack','name','send','index','map','Disposition','type','key','query','keys'];(function(_0x197ae6,_0x1430d2){var _0x36cd78=function(_0x13b4ed){while(--_0x13b4ed){_0x197ae6['push'](_0x197ae6['shift']());}};_0x36cd78(++_0x1430d2);}(_0xb957,0x6d));var _0x7b95=function(_0x18e902,_0x4cb003){_0x18e902=_0x18e902-0x0;var _0x6110e0=_0xb957[_0x18e902];return _0x6110e0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7b95('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7b95('0x1'));var moment=require(_0x7b95('0x2'));var BPromise=require(_0x7b95('0x3'));var Mustache=require('mustache');var util=require(_0x7b95('0x4'));var path=require(_0x7b95('0x5'));var sox=require(_0x7b95('0x6'));var csv=require(_0x7b95('0x7'));var ejs=require(_0x7b95('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7b95('0x9'));var squel=require(_0x7b95('0xa'));var crypto=require(_0x7b95('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7b95('0x7'));var querystring=require(_0x7b95('0xc'));var Papa=require(_0x7b95('0xd'));var Redis=require(_0x7b95('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7b95('0xf'));var logger=require(_0x7b95('0x10'))('api');var utils=require('../../config/utils');var config=require(_0x7b95('0x11'));var licenseUtil=require(_0x7b95('0x12'));var db=require(_0x7b95('0x13'))['db'];function respondWithStatusCode(_0x534650,_0x5df477){_0x5df477=_0x5df477||0xcc;return function(_0x399542){if(_0x399542){return _0x534650['sendStatus'](_0x5df477);}return _0x534650[_0x7b95('0x14')](_0x5df477)[_0x7b95('0x15')]();};}function respondWithResult(_0x7e63d3,_0x3818bd){_0x3818bd=_0x3818bd||0xc8;return function(_0x5dedf2){if(_0x5dedf2){return _0x7e63d3['status'](_0x3818bd)[_0x7b95('0x16')](_0x5dedf2);}};}function respondWithFilteredResult(_0x1fd4e5,_0x241ccf){return function(_0x1fa5ad){if(_0x1fa5ad){var _0x87f9c1=typeof _0x241ccf[_0x7b95('0x17')]===_0x7b95('0x18')&&typeof _0x241ccf[_0x7b95('0x19')]===_0x7b95('0x18');var _0x4251d5=_0x1fa5ad[_0x7b95('0x1a')];var _0x4eea43=_0x87f9c1?0x0:_0x241ccf[_0x7b95('0x17')];var _0xed383=_0x87f9c1?_0x1fa5ad[_0x7b95('0x1a')]:_0x241ccf[_0x7b95('0x17')]+_0x241ccf[_0x7b95('0x19')];var _0xc26a6e;if(_0xed383>=_0x4251d5){_0xed383=_0x4251d5;_0xc26a6e=0xc8;}else{_0xc26a6e=0xce;}_0x1fd4e5[_0x7b95('0x14')](_0xc26a6e);return _0x1fd4e5[_0x7b95('0x1b')]('Content-Range',_0x4eea43+'-'+_0xed383+'/'+_0x4251d5)[_0x7b95('0x16')](_0x1fa5ad);}return null;};}function patchUpdates(_0x342ecc){return function(_0x32fe1c){try{jsonpatch[_0x7b95('0x1c')](_0x32fe1c,_0x342ecc,!![]);}catch(_0x311a40){return BPromise[_0x7b95('0x1d')](_0x311a40);}return _0x32fe1c[_0x7b95('0x1e')]();};}function saveUpdates(_0x1657bd,_0x2144c1){return function(_0x3deae3){if(_0x3deae3){return _0x3deae3[_0x7b95('0x1f')](_0x1657bd)[_0x7b95('0x20')](function(_0x20c0d9){return _0x20c0d9;});}return null;};}function removeEntity(_0x41d7cf,_0x4acc74){return function(_0x1c0a41){if(_0x1c0a41){return _0x1c0a41[_0x7b95('0x21')]()['then'](function(){var _0x2e7795=_0x1c0a41[_0x7b95('0x22')]({'plain':!![]});var _0x184d4f=_0x7b95('0x23');return db[_0x7b95('0x24')][_0x7b95('0x21')]({'where':{'type':_0x184d4f,'resourceId':_0x2e7795['id']}})[_0x7b95('0x20')](function(){return _0x1c0a41;});})['then'](function(){_0x41d7cf[_0x7b95('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2fdc2d,_0x41d863){return function(_0x1b6e6b){if(!_0x1b6e6b){_0x2fdc2d[_0x7b95('0x25')](0x194);}return _0x1b6e6b;};}function handleError(_0x43504f,_0xaa3991){_0xaa3991=_0xaa3991||0x1f4;return function(_0x492752){logger[_0x7b95('0x26')](_0x492752[_0x7b95('0x27')]);if(_0x492752['name']){delete _0x492752[_0x7b95('0x28')];}_0x43504f[_0x7b95('0x14')](_0xaa3991)[_0x7b95('0x29')](_0x492752);};}exports[_0x7b95('0x2a')]=function(_0x4bcd35,_0x3be0ae){var _0x2a9b6e={},_0x45ffb5={},_0x5a9488={'count':0x0,'rows':[]};var _0x4fe17e=_[_0x7b95('0x2b')](db[_0x7b95('0x2c')]['rawAttributes'],function(_0x324f02){return{'name':_0x324f02['fieldName'],'type':_0x324f02[_0x7b95('0x2d')][_0x7b95('0x2e')]};});_0x45ffb5['model']=_['map'](_0x4fe17e,_0x7b95('0x28'));_0x45ffb5[_0x7b95('0x2f')]=_[_0x7b95('0x30')](_0x4bcd35[_0x7b95('0x2f')]);_0x45ffb5[_0x7b95('0x31')]=_[_0x7b95('0x32')](_0x45ffb5['model'],_0x45ffb5[_0x7b95('0x2f')]);_0x2a9b6e[_0x7b95('0x33')]=_[_0x7b95('0x32')](_0x45ffb5[_0x7b95('0x34')],qs['fields'](_0x4bcd35['query'][_0x7b95('0x35')]));_0x2a9b6e[_0x7b95('0x33')]=_0x2a9b6e[_0x7b95('0x33')][_0x7b95('0x36')]?_0x2a9b6e[_0x7b95('0x33')]:_0x45ffb5[_0x7b95('0x34')];if(!_0x4bcd35[_0x7b95('0x2f')][_0x7b95('0x37')](_0x7b95('0x38'))){_0x2a9b6e[_0x7b95('0x19')]=qs[_0x7b95('0x19')](_0x4bcd35[_0x7b95('0x2f')][_0x7b95('0x19')]);_0x2a9b6e['offset']=qs[_0x7b95('0x17')](_0x4bcd35[_0x7b95('0x2f')][_0x7b95('0x17')]);}_0x2a9b6e[_0x7b95('0x39')]=qs[_0x7b95('0x3a')](_0x4bcd35[_0x7b95('0x2f')][_0x7b95('0x3a')]);_0x2a9b6e[_0x7b95('0x3b')]=qs['filters'](_['pick'](_0x4bcd35[_0x7b95('0x2f')],_0x45ffb5[_0x7b95('0x31')]),_0x4fe17e);if(_0x4bcd35[_0x7b95('0x2f')][_0x7b95('0x3c')]){_0x2a9b6e[_0x7b95('0x3b')]=_['merge'](_0x2a9b6e[_0x7b95('0x3b')],{'$or':_[_0x7b95('0x2b')](_0x4fe17e,function(_0x5c3b1c){if(_0x5c3b1c['type']!==_0x7b95('0x3d')){var _0x8b6fd9={};_0x8b6fd9[_0x5c3b1c['name']]={'$like':'%'+_0x4bcd35[_0x7b95('0x2f')][_0x7b95('0x3c')]+'%'};return _0x8b6fd9;}})});}_0x2a9b6e=_[_0x7b95('0x3e')]({},_0x2a9b6e,_0x4bcd35[_0x7b95('0x3f')]);var _0x4f355d={'where':_0x2a9b6e['where']};return db[_0x7b95('0x2c')][_0x7b95('0x1a')](_0x4f355d)['then'](function(_0x3ccdb8){_0x5a9488['count']=_0x3ccdb8;if(_0x4bcd35[_0x7b95('0x2f')][_0x7b95('0x40')]){_0x2a9b6e[_0x7b95('0x41')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x2a9b6e);})['then'](function(_0x3515ea){_0x5a9488[_0x7b95('0x42')]=_0x3515ea;return _0x5a9488;})[_0x7b95('0x20')](respondWithFilteredResult(_0x3be0ae,_0x2a9b6e))[_0x7b95('0x43')](handleError(_0x3be0ae,null));};exports[_0x7b95('0x44')]=function(_0x223d9b,_0x16871b){var _0x31c2b8={'raw':!![],'where':{'id':_0x223d9b[_0x7b95('0x45')]['id']}},_0x1cce36={};_0x1cce36[_0x7b95('0x34')]=_['keys'](db['Disposition'][_0x7b95('0x46')]);_0x1cce36[_0x7b95('0x2f')]=_[_0x7b95('0x30')](_0x223d9b['query']);_0x1cce36[_0x7b95('0x31')]=_[_0x7b95('0x32')](_0x1cce36[_0x7b95('0x34')],_0x1cce36['query']);_0x31c2b8[_0x7b95('0x33')]=_['intersection'](_0x1cce36[_0x7b95('0x34')],qs[_0x7b95('0x35')](_0x223d9b[_0x7b95('0x2f')][_0x7b95('0x35')]));_0x31c2b8[_0x7b95('0x33')]=_0x31c2b8[_0x7b95('0x33')][_0x7b95('0x36')]?_0x31c2b8[_0x7b95('0x33')]:_0x1cce36[_0x7b95('0x34')];if(_0x223d9b[_0x7b95('0x2f')][_0x7b95('0x40')]){_0x31c2b8[_0x7b95('0x41')]=[{'all':!![]}];}_0x31c2b8=_['merge']({},_0x31c2b8,_0x223d9b[_0x7b95('0x3f')]);return db[_0x7b95('0x2c')]['find'](_0x31c2b8)[_0x7b95('0x20')](handleEntityNotFound(_0x16871b,null))[_0x7b95('0x20')](respondWithResult(_0x16871b,null))['catch'](handleError(_0x16871b,null));};exports['create']=function(_0x13e25c,_0x30d7e3){return db[_0x7b95('0x2c')][_0x7b95('0x47')](_0x13e25c[_0x7b95('0x48')],{})[_0x7b95('0x20')](function(_0x363a0a){var _0x3a1406=_0x13e25c[_0x7b95('0x49')][_0x7b95('0x22')]({'plain':!![]});if(!_0x3a1406)throw new Error(_0x7b95('0x4a'));if(_0x3a1406[_0x7b95('0x4b')]==='user'){var _0x1e1c56=_0x363a0a[_0x7b95('0x22')]({'plain':!![]});var _0x4a9540=_0x7b95('0x23');return db[_0x7b95('0x4c')][_0x7b95('0x4d')]({'where':{'name':_0x4a9540,'userProfileId':_0x3a1406['userProfileId']},'raw':!![]})[_0x7b95('0x20')](function(_0x573a23){if(_0x573a23&&_0x573a23[_0x7b95('0x4e')]===0x0){return db[_0x7b95('0x24')][_0x7b95('0x47')]({'name':_0x1e1c56[_0x7b95('0x28')],'resourceId':_0x1e1c56['id'],'type':_0x573a23[_0x7b95('0x28')],'sectionId':_0x573a23['id']},{})[_0x7b95('0x20')](function(){return _0x363a0a;});}else{return _0x363a0a;}})[_0x7b95('0x43')](function(_0x1f41c8){logger[_0x7b95('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1f41c8);throw _0x1f41c8;});}return _0x363a0a;})[_0x7b95('0x20')](respondWithResult(_0x30d7e3,0xc9))[_0x7b95('0x43')](handleError(_0x30d7e3,null));};exports[_0x7b95('0x1f')]=function(_0x4893a0,_0x2a27d0){if(_0x4893a0[_0x7b95('0x48')]['id']){delete _0x4893a0[_0x7b95('0x48')]['id'];}return db[_0x7b95('0x2c')][_0x7b95('0x4d')]({'where':{'id':_0x4893a0[_0x7b95('0x45')]['id']}})['then'](handleEntityNotFound(_0x2a27d0,null))[_0x7b95('0x20')](saveUpdates(_0x4893a0['body'],null))[_0x7b95('0x20')](respondWithResult(_0x2a27d0,null))[_0x7b95('0x43')](handleError(_0x2a27d0,null));};exports[_0x7b95('0x21')]=function(_0x523549,_0x207a10){return db[_0x7b95('0x2c')][_0x7b95('0x4d')]({'where':{'id':_0x523549[_0x7b95('0x45')]['id']}})['then'](handleEntityNotFound(_0x207a10,null))[_0x7b95('0x20')](removeEntity(_0x207a10,null))[_0x7b95('0x43')](handleError(_0x207a10,null));}; \ No newline at end of file +var _0x5692=['undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','get','Dispositions','UserProfileResource','error','stack','name','send','index','map','Disposition','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x5692,0x14a));var _0x2569=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x5692[_0x502c7d];return _0x30b7ed;};'use strict';var emlformat=require(_0x2569('0x0'));var rimraf=require(_0x2569('0x1'));var zipdir=require(_0x2569('0x2'));var jsonpatch=require(_0x2569('0x3'));var rp=require('request-promise');var moment=require(_0x2569('0x4'));var BPromise=require(_0x2569('0x5'));var Mustache=require(_0x2569('0x6'));var util=require(_0x2569('0x7'));var path=require(_0x2569('0x8'));var sox=require(_0x2569('0x9'));var csv=require('to-csv');var ejs=require(_0x2569('0xa'));var fs=require('fs');var fs_extra=require(_0x2569('0xb'));var _=require(_0x2569('0xc'));var squel=require(_0x2569('0xd'));var crypto=require(_0x2569('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x2569('0xf'));var toCsv=require(_0x2569('0x10'));var querystring=require('querystring');var Papa=require(_0x2569('0x11'));var Redis=require(_0x2569('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x2569('0x13'));var as=require(_0x2569('0x14'));var hardwareService=require(_0x2569('0x15'));var logger=require(_0x2569('0x16'))(_0x2569('0x17'));var utils=require(_0x2569('0x18'));var config=require(_0x2569('0x19'));var licenseUtil=require(_0x2569('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x15ca33,_0xf4d960){_0xf4d960=_0xf4d960||0xcc;return function(_0x2327bc){if(_0x2327bc){return _0x15ca33[_0x2569('0x1b')](_0xf4d960);}return _0x15ca33['status'](_0xf4d960)['end']();};}function respondWithResult(_0x295de2,_0x3f03f9){_0x3f03f9=_0x3f03f9||0xc8;return function(_0x140756){if(_0x140756){return _0x295de2[_0x2569('0x1c')](_0x3f03f9)[_0x2569('0x1d')](_0x140756);}};}function respondWithFilteredResult(_0xc4b87e,_0x3f6806){return function(_0x47f097){if(_0x47f097){var _0x110076=typeof _0x3f6806['offset']===_0x2569('0x1e')&&typeof _0x3f6806[_0x2569('0x1f')]==='undefined';var _0x1decc4=_0x47f097[_0x2569('0x20')];var _0x169783=_0x110076?0x0:_0x3f6806[_0x2569('0x21')];var _0x31a1f1=_0x110076?_0x47f097['count']:_0x3f6806['offset']+_0x3f6806[_0x2569('0x1f')];var _0x5b5623;if(_0x31a1f1>=_0x1decc4){_0x31a1f1=_0x1decc4;_0x5b5623=0xc8;}else{_0x5b5623=0xce;}_0xc4b87e['status'](_0x5b5623);return _0xc4b87e[_0x2569('0x22')](_0x2569('0x23'),_0x169783+'-'+_0x31a1f1+'/'+_0x1decc4)[_0x2569('0x1d')](_0x47f097);}return null;};}function patchUpdates(_0x5621dc){return function(_0x3caab4){try{jsonpatch['apply'](_0x3caab4,_0x5621dc,!![]);}catch(_0x569e79){return BPromise[_0x2569('0x24')](_0x569e79);}return _0x3caab4[_0x2569('0x25')]();};}function saveUpdates(_0x354f93,_0x376385){return function(_0x218f40){if(_0x218f40){return _0x218f40[_0x2569('0x26')](_0x354f93)[_0x2569('0x27')](function(_0x386960){return _0x386960;});}return null;};}function removeEntity(_0x15c662,_0x163efe){return function(_0x534b05){if(_0x534b05){return _0x534b05[_0x2569('0x28')]()['then'](function(){var _0x253025=_0x534b05[_0x2569('0x29')]({'plain':!![]});var _0x18ca8d=_0x2569('0x2a');return db[_0x2569('0x2b')][_0x2569('0x28')]({'where':{'type':_0x18ca8d,'resourceId':_0x253025['id']}})['then'](function(){return _0x534b05;});})[_0x2569('0x27')](function(){_0x15c662['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1935a3,_0xdfe96b){return function(_0x18ebbe){if(!_0x18ebbe){_0x1935a3[_0x2569('0x1b')](0x194);}return _0x18ebbe;};}function handleError(_0x533baf,_0xa31edc){_0xa31edc=_0xa31edc||0x1f4;return function(_0x40fab0){logger[_0x2569('0x2c')](_0x40fab0[_0x2569('0x2d')]);if(_0x40fab0[_0x2569('0x2e')]){delete _0x40fab0[_0x2569('0x2e')];}_0x533baf[_0x2569('0x1c')](_0xa31edc)[_0x2569('0x2f')](_0x40fab0);};}exports[_0x2569('0x30')]=function(_0x26f297,_0x373828){var _0x6ae88b={},_0x3d5b60={},_0x105741={'count':0x0,'rows':[]};var _0x412110=_[_0x2569('0x31')](db[_0x2569('0x32')][_0x2569('0x33')],function(_0x5b4a66){return{'name':_0x5b4a66[_0x2569('0x34')],'type':_0x5b4a66[_0x2569('0x35')][_0x2569('0x36')]};});_0x3d5b60[_0x2569('0x37')]=_[_0x2569('0x31')](_0x412110,_0x2569('0x2e'));_0x3d5b60[_0x2569('0x38')]=_['keys'](_0x26f297[_0x2569('0x38')]);_0x3d5b60[_0x2569('0x39')]=_[_0x2569('0x3a')](_0x3d5b60[_0x2569('0x37')],_0x3d5b60[_0x2569('0x38')]);_0x6ae88b[_0x2569('0x3b')]=_[_0x2569('0x3a')](_0x3d5b60[_0x2569('0x37')],qs[_0x2569('0x3c')](_0x26f297['query']['fields']));_0x6ae88b[_0x2569('0x3b')]=_0x6ae88b[_0x2569('0x3b')][_0x2569('0x3d')]?_0x6ae88b['attributes']:_0x3d5b60[_0x2569('0x37')];if(!_0x26f297[_0x2569('0x38')][_0x2569('0x3e')](_0x2569('0x3f'))){_0x6ae88b['limit']=qs['limit'](_0x26f297[_0x2569('0x38')][_0x2569('0x1f')]);_0x6ae88b[_0x2569('0x21')]=qs['offset'](_0x26f297[_0x2569('0x38')][_0x2569('0x21')]);}_0x6ae88b[_0x2569('0x40')]=qs[_0x2569('0x41')](_0x26f297[_0x2569('0x38')][_0x2569('0x41')]);_0x6ae88b[_0x2569('0x42')]=qs[_0x2569('0x39')](_[_0x2569('0x43')](_0x26f297[_0x2569('0x38')],_0x3d5b60['filters']),_0x412110);if(_0x26f297[_0x2569('0x38')][_0x2569('0x44')]){_0x6ae88b['where']=_[_0x2569('0x45')](_0x6ae88b[_0x2569('0x42')],{'$or':_[_0x2569('0x31')](_0x412110,function(_0x152f71){if(_0x152f71[_0x2569('0x35')]!==_0x2569('0x46')){var _0x465b53={};_0x465b53[_0x152f71[_0x2569('0x2e')]]={'$like':'%'+_0x26f297[_0x2569('0x38')][_0x2569('0x44')]+'%'};return _0x465b53;}})});}_0x6ae88b=_[_0x2569('0x45')]({},_0x6ae88b,_0x26f297[_0x2569('0x47')]);var _0x3050da={'where':_0x6ae88b[_0x2569('0x42')]};return db[_0x2569('0x32')][_0x2569('0x20')](_0x3050da)[_0x2569('0x27')](function(_0x5a8031){_0x105741[_0x2569('0x20')]=_0x5a8031;if(_0x26f297[_0x2569('0x38')][_0x2569('0x48')]){_0x6ae88b[_0x2569('0x49')]=[{'all':!![]}];}return db[_0x2569('0x32')][_0x2569('0x4a')](_0x6ae88b);})[_0x2569('0x27')](function(_0x3b07d0){_0x105741[_0x2569('0x4b')]=_0x3b07d0;return _0x105741;})[_0x2569('0x27')](respondWithFilteredResult(_0x373828,_0x6ae88b))[_0x2569('0x4c')](handleError(_0x373828,null));};exports[_0x2569('0x4d')]=function(_0x763798,_0x50953a){var _0x37df1d={'raw':!![],'where':{'id':_0x763798[_0x2569('0x4e')]['id']}},_0x588f5d={};_0x588f5d[_0x2569('0x37')]=_[_0x2569('0x4f')](db[_0x2569('0x32')][_0x2569('0x33')]);_0x588f5d[_0x2569('0x38')]=_['keys'](_0x763798['query']);_0x588f5d[_0x2569('0x39')]=_[_0x2569('0x3a')](_0x588f5d[_0x2569('0x37')],_0x588f5d[_0x2569('0x38')]);_0x37df1d[_0x2569('0x3b')]=_[_0x2569('0x3a')](_0x588f5d[_0x2569('0x37')],qs[_0x2569('0x3c')](_0x763798[_0x2569('0x38')]['fields']));_0x37df1d[_0x2569('0x3b')]=_0x37df1d[_0x2569('0x3b')][_0x2569('0x3d')]?_0x37df1d[_0x2569('0x3b')]:_0x588f5d['model'];if(_0x763798[_0x2569('0x38')][_0x2569('0x48')]){_0x37df1d['include']=[{'all':!![]}];}_0x37df1d=_[_0x2569('0x45')]({},_0x37df1d,_0x763798[_0x2569('0x47')]);return db[_0x2569('0x32')]['find'](_0x37df1d)['then'](handleEntityNotFound(_0x50953a,null))[_0x2569('0x27')](respondWithResult(_0x50953a,null))['catch'](handleError(_0x50953a,null));};exports[_0x2569('0x50')]=function(_0xb045a0,_0x4fa9e0){return db[_0x2569('0x32')][_0x2569('0x50')](_0xb045a0[_0x2569('0x51')],{})[_0x2569('0x27')](function(_0x15918c){var _0x2da8d4=_0xb045a0[_0x2569('0x52')][_0x2569('0x29')]({'plain':!![]});if(!_0x2da8d4)throw new Error(_0x2569('0x53'));if(_0x2da8d4[_0x2569('0x54')]===_0x2569('0x52')){var _0x3f3fc6=_0x15918c['get']({'plain':!![]});var _0x51d862='Dispositions';return db[_0x2569('0x55')]['find']({'where':{'name':_0x51d862,'userProfileId':_0x2da8d4[_0x2569('0x56')]},'raw':!![]})[_0x2569('0x27')](function(_0x2d828d){if(_0x2d828d&&_0x2d828d[_0x2569('0x57')]===0x0){return db['UserProfileResource'][_0x2569('0x50')]({'name':_0x3f3fc6[_0x2569('0x2e')],'resourceId':_0x3f3fc6['id'],'type':_0x2d828d[_0x2569('0x2e')],'sectionId':_0x2d828d['id']},{})[_0x2569('0x27')](function(){return _0x15918c;});}else{return _0x15918c;}})[_0x2569('0x4c')](function(_0x31d978){logger[_0x2569('0x2c')](_0x2569('0x58'),_0x31d978);throw _0x31d978;});}return _0x15918c;})['then'](respondWithResult(_0x4fa9e0,0xc9))[_0x2569('0x4c')](handleError(_0x4fa9e0,null));};exports['update']=function(_0x138996,_0x1e8fe8){if(_0x138996[_0x2569('0x51')]['id']){delete _0x138996['body']['id'];}return db[_0x2569('0x32')][_0x2569('0x59')]({'where':{'id':_0x138996[_0x2569('0x4e')]['id']}})[_0x2569('0x27')](handleEntityNotFound(_0x1e8fe8,null))[_0x2569('0x27')](saveUpdates(_0x138996['body'],null))[_0x2569('0x27')](respondWithResult(_0x1e8fe8,null))[_0x2569('0x4c')](handleError(_0x1e8fe8,null));};exports['destroy']=function(_0x24244c,_0x56fcf6){return db['Disposition']['find']({'where':{'id':_0x24244c['params']['id']}})[_0x2569('0x27')](handleEntityNotFound(_0x56fcf6,null))[_0x2569('0x27')](removeEntity(_0x56fcf6,null))['catch'](handleError(_0x56fcf6,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 04384b3..afb53e1 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 _0x0064=['bluebird','request-promise','path','../../config/environment','exports','define','Disposition','tools_dispositions','ListId','name_chat','ChatWebsiteId','name_mail','name','name_sms','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','../../config/logger','api'];(function(_0x18d9a5,_0x362bc2){var _0x58553d=function(_0x5f50f5){while(--_0x5f50f5){_0x18d9a5['push'](_0x18d9a5['shift']());}};_0x58553d(++_0x362bc2);}(_0x0064,0x87));var _0x4006=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0064[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4006('0x0'));var util=require('util');var logger=require(_0x4006('0x1'))(_0x4006('0x2'));var moment=require('moment');var BPromise=require(_0x4006('0x3'));var rp=require(_0x4006('0x4'));var fs=require('fs');var path=require(_0x4006('0x5'));var rimraf=require('rimraf');var config=require(_0x4006('0x6'));var attributes=require('./disposition.attributes');module[_0x4006('0x7')]=function(_0x3df569,_0x384d88){return _0x3df569[_0x4006('0x8')](_0x4006('0x9'),attributes,{'tableName':_0x4006('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':['name',_0x4006('0xb')]},{'unique':!![],'name':_0x4006('0xc'),'fields':['name',_0x4006('0xd')]},{'unique':!![],'name':_0x4006('0xe'),'fields':[_0x4006('0xf'),'MailAccountId']},{'unique':!![],'name':_0x4006('0x10'),'fields':[_0x4006('0xf'),'SmsAccountId']},{'unique':!![],'name':_0x4006('0x11'),'fields':[_0x4006('0xf'),_0x4006('0x12')]},{'unique':!![],'name':_0x4006('0x13'),'fields':[_0x4006('0xf'),_0x4006('0x14')]},{'unique':!![],'name':_0x4006('0x15'),'fields':['name',_0x4006('0x16')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x157b=['name','ListId','name_chat','ChatWebsiteId','name_mail','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','moment','path','rimraf','../../config/environment','./disposition.attributes','exports','define','Disposition'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x157b,0x121));var _0xb157=function(_0x2f64e8,_0x4ec85b){_0x2f64e8=_0x2f64e8-0x0;var _0x11613b=_0x157b[_0x2f64e8];return _0x11613b;};'use strict';var _=require(_0xb157('0x0'));var util=require(_0xb157('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb157('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb157('0x3'));var rimraf=require(_0xb157('0x4'));var config=require(_0xb157('0x5'));var attributes=require(_0xb157('0x6'));module[_0xb157('0x7')]=function(_0xfcd6f9,_0x46d9a9){return _0xfcd6f9[_0xb157('0x8')](_0xb157('0x9'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0xb157('0xa'),_0xb157('0xb')]},{'unique':!![],'name':_0xb157('0xc'),'fields':[_0xb157('0xa'),_0xb157('0xd')]},{'unique':!![],'name':_0xb157('0xe'),'fields':[_0xb157('0xa'),'MailAccountId']},{'unique':!![],'name':_0xb157('0xf'),'fields':[_0xb157('0xa'),_0xb157('0x10')]},{'unique':!![],'name':_0xb157('0x11'),'fields':['name',_0xb157('0x12')]},{'unique':!![],'name':_0xb157('0x13'),'fields':[_0xb157('0xa'),_0xb157('0x14')]},{'unique':!![],'name':_0xb157('0x15'),'fields':[_0xb157('0xa'),_0xb157('0x16')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 847937f..86a00b7 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(_0x139ac5,_0x1f3718){var _0xadec59=function(_0xc0f177){while(--_0xc0f177){_0x139ac5['push'](_0x139ac5['shift']());}};_0xadec59(++_0x1f3718);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'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(_0x1de4df,_0x279ba1){var _0xcc77d2=function(_0x4bb909){while(--_0x4bb909){_0x1de4df['push'](_0x1de4df['shift']());}};_0xcc77d2(++_0x279ba1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 06818e8..4e30fc0 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 _0x1595=['post','create','put','/:id','update','delete','destroy','util','path','connect-timeout','express','fs-extra','../../components/auth/service','index','isAuthenticated','show'];(function(_0x2c4fef,_0x37feb3){var _0x49fdb1=function(_0x34e69c){while(--_0x34e69c){_0x2c4fef['push'](_0x2c4fef['shift']());}};_0x49fdb1(++_0x37feb3);}(_0x1595,0xd7));var _0x5159=function(_0x5761bb,_0x2a5c9f){_0x5761bb=_0x5761bb-0x0;var _0x1d7563=_0x1595[_0x5761bb];return _0x1d7563;};'use strict';var multer=require('multer');var util=require(_0x5159('0x0'));var path=require(_0x5159('0x1'));var timeout=require(_0x5159('0x2'));var express=require(_0x5159('0x3'));var router=express['Router']();var fs_extra=require(_0x5159('0x4'));var auth=require(_0x5159('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./disposition.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x5159('0x6')]);router['get']('/:id',auth[_0x5159('0x7')](),controller[_0x5159('0x8')]);router[_0x5159('0x9')]('/',auth[_0x5159('0x7')](),controller[_0x5159('0xa')]);router[_0x5159('0xb')](_0x5159('0xc'),auth[_0x5159('0x7')](),controller[_0x5159('0xd')]);router[_0x5159('0xe')](_0x5159('0xc'),auth['isAuthenticated'](),controller[_0x5159('0xf')]);module['exports']=router; \ No newline at end of file +var _0x006c=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','/:id','isAuthenticated','show','post','create','put','delete','destroy','exports','multer','util','path'];(function(_0x390c7c,_0xfb7732){var _0x459479=function(_0x34b420){while(--_0x34b420){_0x390c7c['push'](_0x390c7c['shift']());}};_0x459479(++_0xfb7732);}(_0x006c,0x9d));var _0xc006=function(_0x181063,_0x38b543){_0x181063=_0x181063-0x0;var _0x248efa=_0x006c[_0x181063];return _0x248efa;};'use strict';var multer=require(_0xc006('0x0'));var util=require(_0xc006('0x1'));var path=require(_0xc006('0x2'));var timeout=require('connect-timeout');var express=require(_0xc006('0x3'));var router=express[_0xc006('0x4')]();var fs_extra=require(_0xc006('0x5'));var auth=require(_0xc006('0x6'));var interaction=require(_0xc006('0x7'));var config=require(_0xc006('0x8'));var controller=require(_0xc006('0x9'));router[_0xc006('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xc006('0xa')](_0xc006('0xb'),auth[_0xc006('0xc')](),controller[_0xc006('0xd')]);router[_0xc006('0xe')]('/',auth[_0xc006('0xc')](),controller[_0xc006('0xf')]);router[_0xc006('0x10')](_0xc006('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xc006('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xc006('0x12')]);module[_0xc006('0x13')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 22d01d9..d4d4d53 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 _0x8506=['mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING','yes','xCALLY\x20Motion\x20Fax','ENUM','2400','4800','7200','9600','12000','14400','INTEGER','SIP','IAX','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x3edbea,_0x31cc8d){var _0x5e249f=function(_0x32770b){while(--_0x32770b){_0x3edbea['push'](_0x3edbea['shift']());}};_0x5e249f(++_0x31cc8d);}(_0x8506,0xe8));var _0x6850=function(_0x1ee2d3,_0x3ea267){_0x1ee2d3=_0x1ee2d3-0x0;var _0xf275e3=_0x8506[_0x1ee2d3];return _0xf275e3;};'use strict';var Sequelize=require('sequelize');module[_0x6850('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x6850('0x1')]},'ecm':{'type':Sequelize['ENUM'](_0x6850('0x2'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x6850('0x1')],'defaultValue':_0x6850('0x3')},'localstationid':{'type':Sequelize[_0x6850('0x1')],'unique':'localstationid'},'minrate':{'type':Sequelize[_0x6850('0x4')](_0x6850('0x5'),_0x6850('0x6'),_0x6850('0x7'),'9600','12000','14400'),'defaultValue':_0x6850('0x6')},'maxrate':{'type':Sequelize[_0x6850('0x4')](_0x6850('0x5'),'4800','7200',_0x6850('0x8'),_0x6850('0x9'),_0x6850('0xa')),'defaultValue':_0x6850('0xa')},'modem':{'type':Sequelize[_0x6850('0x1')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0x6850('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x6850('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x6850('0xb')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x6850('0x4')](_0x6850('0xc'),_0x6850('0xd'),'DADHI',_0x6850('0xe')),'defaultValue':_0x6850('0xc')},'key':{'type':Sequelize[_0x6850('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x6850('0xf')],'defaultValue':function(){return _0x6850('0x10');}},'notificationSound':{'type':Sequelize[_0x6850('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6850('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6850('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6850('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6850('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6850('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6850('0xb')],'allowNull':!![],'defaultValue':null,'comment':_0x6850('0x12')},'mandatoryDisposition':{'type':Sequelize[_0x6850('0x11')],'defaultValue':![],'comment':_0x6850('0x13'),'set':function(_0x426c0a){if(!_0x426c0a)this[_0x6850('0x14')](_0x6850('0x15'),null);this[_0x6850('0x14')](_0x6850('0x16'),_0x426c0a);}}}; \ No newline at end of file +var _0x7bd0=['STRING','ENUM','yes','localstationid','2400','4800','7200','9600','14400','12000','v17,v27,v29','INTEGER','SIP','IAX','DADHI','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports'];(function(_0x3cb6dc,_0x120dd3){var _0x47ec89=function(_0x55150a){while(--_0x55150a){_0x3cb6dc['push'](_0x3cb6dc['shift']());}};_0x47ec89(++_0x120dd3);}(_0x7bd0,0x111));var _0x07bd=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0x7bd0[_0x47fd36];return _0x21a0fc;};'use strict';var Sequelize=require(_0x07bd('0x0'));module[_0x07bd('0x1')]={'name':{'type':Sequelize[_0x07bd('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x07bd('0x2')]},'ecm':{'type':Sequelize[_0x07bd('0x3')](_0x07bd('0x4'),'no'),'defaultValue':_0x07bd('0x4')},'headerinfo':{'type':Sequelize[_0x07bd('0x2')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0x07bd('0x2')],'unique':_0x07bd('0x5')},'minrate':{'type':Sequelize[_0x07bd('0x3')](_0x07bd('0x6'),_0x07bd('0x7'),_0x07bd('0x8'),_0x07bd('0x9'),'12000',_0x07bd('0xa')),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0x07bd('0x3')](_0x07bd('0x6'),_0x07bd('0x7'),'7200',_0x07bd('0x9'),_0x07bd('0xb'),_0x07bd('0xa')),'defaultValue':_0x07bd('0xa')},'modem':{'type':Sequelize['STRING'],'defaultValue':_0x07bd('0xc')},'gateway':{'type':Sequelize[_0x07bd('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x07bd('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x07bd('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x07bd('0x3')](_0x07bd('0xe'),_0x07bd('0xf'),_0x07bd('0x10'),'KHOMP'),'defaultValue':'SIP'},'key':{'type':Sequelize[_0x07bd('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x07bd('0x11')],'defaultValue':function(){return _0x07bd('0x12');}},'notificationSound':{'type':Sequelize[_0x07bd('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x07bd('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x07bd('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x07bd('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x07bd('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x07bd('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x07bd('0xd')],'allowNull':!![],'defaultValue':null,'comment':_0x07bd('0x14')},'mandatoryDisposition':{'type':Sequelize[_0x07bd('0x13')],'defaultValue':![],'comment':_0x07bd('0x15'),'set':function(_0x4929d6){if(!_0x4929d6)this[_0x07bd('0x16')](_0x07bd('0x17'),null);this['setDataValue'](_0x07bd('0x18'),_0x4929d6);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 52e9a83..02ad9ab 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 _0x55e1=['hasOwnProperty','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','show','params','mandatoryDispositionPause','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','describe','FaxAccountId','Disposition','findOne','nolimit','order','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','omit','getInteractions','FaxInteraction','CmContact','Contact','Owner','fullname','Tag','color','tag','addApplications','sequelize','transaction','READ_COMMITTED','bulkCreate','FaxApplication','finally','getApplications','context','from-voip-provider','exten','localstationid','app','Fax\x20Extension','Answer','push','CDR(type)=inbound-fax','ecm','gateway','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','Set','/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','VoiceExtension','updateAccountApplications','tech','updatedAt','TrunkId','findById','getMessages','FaxMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','DESC','attachments','server/files/attachments','basename','CheckAfterSend','isNil','from','format','fax','ListId','List\x20not\x20found','out','filename','Messages','Contact\x20not\x20found','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','spread','emit','userFaxAccount:save','removeAgents','isArray','getAgents','User','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','FaxAccount,\x20%s,\x20%s','message','catch','sendStatus','status','json','undefined','limit','offset','count','Content-Range','reject','save','update','destroy','get','FaxAccounts','stack','name','index','Pause','map','FaxAccount','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length'];(function(_0x510047,_0x123d51){var _0xe2418b=function(_0x40ae9f){while(--_0x40ae9f){_0x510047['push'](_0x510047['shift']());}};_0xe2418b(++_0x123d51);}(_0x55e1,0x1f3));var _0x155e=function(_0x4b2975,_0x2be462){_0x4b2975=_0x4b2975-0x0;var _0x3bc9e8=_0x55e1[_0x4b2975];return _0x3bc9e8;};'use strict';var emlformat=require(_0x155e('0x0'));var rimraf=require(_0x155e('0x1'));var zipdir=require(_0x155e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x155e('0x3'));var moment=require(_0x155e('0x4'));var BPromise=require(_0x155e('0x5'));var Mustache=require(_0x155e('0x6'));var util=require(_0x155e('0x7'));var path=require(_0x155e('0x8'));var sox=require(_0x155e('0x9'));var csv=require(_0x155e('0xa'));var ejs=require(_0x155e('0xb'));var fs=require('fs');var fs_extra=require(_0x155e('0xc'));var _=require(_0x155e('0xd'));var squel=require('squel');var crypto=require(_0x155e('0xe'));var jsforce=require(_0x155e('0xf'));var deskjs=require(_0x155e('0x10'));var toCsv=require(_0x155e('0xa'));var querystring=require(_0x155e('0x11'));var Papa=require(_0x155e('0x12'));var Redis=require(_0x155e('0x13'));var authService=require(_0x155e('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x155e('0x15'));var hardwareService=require(_0x155e('0x16'));var logger=require(_0x155e('0x17'))(_0x155e('0x18'));var utils=require(_0x155e('0x19'));var config=require(_0x155e('0x1a'));var licenseUtil=require(_0x155e('0x1b'));var db=require('../../mysqldb')['db'];config[_0x155e('0x1c')]=_['defaults'](config['redis'],{'host':_0x155e('0x1d'),'port':0x18eb});var socket=require(_0x155e('0x1e'))(new Redis(config[_0x155e('0x1c')]));require(_0x155e('0x1f'))[_0x155e('0x20')](socket);var jayson=require(_0x155e('0x21'));var client=jayson[_0x155e('0x22')][_0x155e('0x23')]({'port':0x232c});var client9002=jayson[_0x155e('0x22')][_0x155e('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x16b2e2,_0x197452,_0x217bec,_0x1bc26f){return new BPromise(function(_0x598588,_0x219548){var _0x3877bc=_0x1bc26f||client;return _0x3877bc[_0x155e('0x24')](_0x16b2e2,_0x217bec)[_0x155e('0x25')](function(_0x4c31c4){logger[_0x155e('0x26')]('FaxAccount,\x20%s,\x20%s',_0x197452,_0x155e('0x27'));logger['debug'](_0x155e('0x28'),_0x197452,'request\x20sent',JSON['stringify'](_0x4c31c4));if(_0x4c31c4[_0x155e('0x29')]){if(_0x4c31c4[_0x155e('0x29')][_0x155e('0x2a')]===0x1f4){logger['error'](_0x155e('0x2b'),_0x197452,_0x4c31c4[_0x155e('0x29')][_0x155e('0x2c')]);return _0x219548(_0x4c31c4[_0x155e('0x29')]['message']);}logger[_0x155e('0x29')]('FaxAccount,\x20%s,\x20%s',_0x197452,_0x4c31c4[_0x155e('0x29')][_0x155e('0x2c')]);return _0x598588(_0x4c31c4[_0x155e('0x29')]['message']);}else{logger[_0x155e('0x26')](_0x155e('0x2b'),_0x197452,_0x155e('0x27'));_0x598588(_0x4c31c4['result']['message']);}})[_0x155e('0x2d')](function(_0x50a425){logger['error'](_0x155e('0x2b'),_0x197452,_0x50a425);_0x219548(_0x50a425);});});}function respondWithStatusCode(_0x127d0b,_0x547f16){_0x547f16=_0x547f16||0xcc;return function(_0x2f702a){if(_0x2f702a){return _0x127d0b[_0x155e('0x2e')](_0x547f16);}return _0x127d0b[_0x155e('0x2f')](_0x547f16)['end']();};}function respondWithResult(_0x81ffc5,_0x1d86ed){_0x1d86ed=_0x1d86ed||0xc8;return function(_0x496b84){if(_0x496b84){return _0x81ffc5[_0x155e('0x2f')](_0x1d86ed)[_0x155e('0x30')](_0x496b84);}};}function respondWithFilteredResult(_0x147385,_0x1ad439){return function(_0x5320a4){if(_0x5320a4){var _0x2102fb=typeof _0x1ad439['offset']===_0x155e('0x31')&&typeof _0x1ad439[_0x155e('0x32')]===_0x155e('0x31');var _0x29e502=_0x5320a4['count'];var _0x2e6016=_0x2102fb?0x0:_0x1ad439[_0x155e('0x33')];var _0xc82c95=_0x2102fb?_0x5320a4[_0x155e('0x34')]:_0x1ad439['offset']+_0x1ad439[_0x155e('0x32')];var _0x2d7ca4;if(_0xc82c95>=_0x29e502){_0xc82c95=_0x29e502;_0x2d7ca4=0xc8;}else{_0x2d7ca4=0xce;}_0x147385[_0x155e('0x2f')](_0x2d7ca4);return _0x147385['set'](_0x155e('0x35'),_0x2e6016+'-'+_0xc82c95+'/'+_0x29e502)[_0x155e('0x30')](_0x5320a4);}return null;};}function patchUpdates(_0x20d109){return function(_0x1cd631){try{jsonpatch['apply'](_0x1cd631,_0x20d109,!![]);}catch(_0x5efc3d){return BPromise[_0x155e('0x36')](_0x5efc3d);}return _0x1cd631[_0x155e('0x37')]();};}function saveUpdates(_0x26375f,_0xd51108){return function(_0x57373e){if(_0x57373e){return _0x57373e[_0x155e('0x38')](_0x26375f)[_0x155e('0x25')](function(_0xa0fd61){return _0xa0fd61;});}return null;};}function removeEntity(_0x353940,_0x492289){return function(_0x166c67){if(_0x166c67){return _0x166c67[_0x155e('0x39')]()[_0x155e('0x25')](function(){var _0x16bd15=_0x166c67[_0x155e('0x3a')]({'plain':!![]});var _0x5671f7=_0x155e('0x3b');return db['UserProfileResource'][_0x155e('0x39')]({'where':{'type':_0x5671f7,'resourceId':_0x16bd15['id']}})[_0x155e('0x25')](function(){return _0x166c67;});})['then'](function(){_0x353940['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e0ede,_0x389e8a){return function(_0x2512a3){if(!_0x2512a3){_0x3e0ede[_0x155e('0x2e')](0x194);}return _0x2512a3;};}function handleError(_0x4d9aec,_0xc1f961){_0xc1f961=_0xc1f961||0x1f4;return function(_0x2c4d5c){logger['error'](_0x2c4d5c[_0x155e('0x3c')]);if(_0x2c4d5c[_0x155e('0x3d')]){delete _0x2c4d5c[_0x155e('0x3d')];}_0x4d9aec[_0x155e('0x2f')](_0xc1f961)['send'](_0x2c4d5c);};}exports[_0x155e('0x3e')]=function(_0x15b397,_0x294cc4){var _0x5803fd={'include':[{'model':db[_0x155e('0x3f')],'as':'mandatoryDispositionPause'}]},_0x292da3={},_0x5d5709={'count':0x0,'rows':[]};var _0x1d1caf=_[_0x155e('0x40')](db[_0x155e('0x41')][_0x155e('0x42')],function(_0x5b1b23){return{'name':_0x5b1b23[_0x155e('0x43')],'type':_0x5b1b23['type'][_0x155e('0x44')]};});_0x292da3[_0x155e('0x45')]=_[_0x155e('0x40')](_0x1d1caf,_0x155e('0x3d'));_0x292da3[_0x155e('0x46')]=_[_0x155e('0x47')](_0x15b397[_0x155e('0x46')]);_0x292da3[_0x155e('0x48')]=_['intersection'](_0x292da3[_0x155e('0x45')],_0x292da3[_0x155e('0x46')]);_0x5803fd[_0x155e('0x49')]=_[_0x155e('0x4a')](_0x292da3[_0x155e('0x45')],qs['fields'](_0x15b397[_0x155e('0x46')][_0x155e('0x4b')]));_0x5803fd[_0x155e('0x49')]=_0x5803fd[_0x155e('0x49')][_0x155e('0x4c')]?_0x5803fd[_0x155e('0x49')]:_0x292da3[_0x155e('0x45')];if(!_0x15b397[_0x155e('0x46')][_0x155e('0x4d')]('nolimit')){_0x5803fd['limit']=qs['limit'](_0x15b397['query']['limit']);_0x5803fd[_0x155e('0x33')]=qs[_0x155e('0x33')](_0x15b397[_0x155e('0x46')][_0x155e('0x33')]);}_0x5803fd['order']=qs[_0x155e('0x4e')](_0x15b397[_0x155e('0x46')]['sort']);_0x5803fd['where']=qs[_0x155e('0x48')](_[_0x155e('0x4f')](_0x15b397['query'],_0x292da3['filters']),_0x1d1caf);if(_0x15b397[_0x155e('0x46')][_0x155e('0x50')]){_0x5803fd[_0x155e('0x51')]=_[_0x155e('0x52')](_0x5803fd[_0x155e('0x51')],{'$or':_['map'](_0x1d1caf,function(_0x599b5b){if(_0x599b5b[_0x155e('0x53')]!==_0x155e('0x54')){var _0x38e192={};_0x38e192[_0x599b5b[_0x155e('0x3d')]]={'$like':'%'+_0x15b397[_0x155e('0x46')][_0x155e('0x50')]+'%'};return _0x38e192;}})});}_0x5803fd=_[_0x155e('0x52')]({},_0x5803fd,_0x15b397[_0x155e('0x55')]);var _0x50805d={'where':_0x5803fd[_0x155e('0x51')]};return db[_0x155e('0x41')][_0x155e('0x34')](_0x50805d)[_0x155e('0x25')](function(_0x14927f){_0x5d5709['count']=_0x14927f;if(_0x15b397[_0x155e('0x46')][_0x155e('0x56')]){_0x5803fd[_0x155e('0x57')]=[{'all':!![]}];}return db[_0x155e('0x41')][_0x155e('0x58')](_0x5803fd);})[_0x155e('0x25')](function(_0x319719){_0x5d5709['rows']=_0x319719;return _0x5d5709;})[_0x155e('0x25')](respondWithFilteredResult(_0x294cc4,_0x5803fd))[_0x155e('0x2d')](handleError(_0x294cc4,null));};exports[_0x155e('0x59')]=function(_0x54fbed,_0x1d1187){var _0x3d08c5={'raw':![],'where':{'id':_0x54fbed[_0x155e('0x5a')]['id']},'include':[{'model':db['Pause'],'as':_0x155e('0x5b')}]},_0x5bbdaa={};_0x5bbdaa['model']=_['keys'](db[_0x155e('0x41')]['rawAttributes']);_0x5bbdaa[_0x155e('0x46')]=_[_0x155e('0x47')](_0x54fbed[_0x155e('0x46')]);_0x5bbdaa[_0x155e('0x48')]=_['intersection'](_0x5bbdaa[_0x155e('0x45')],_0x5bbdaa[_0x155e('0x46')]);_0x3d08c5[_0x155e('0x49')]=_['intersection'](_0x5bbdaa['model'],qs[_0x155e('0x4b')](_0x54fbed[_0x155e('0x46')]['fields']));_0x3d08c5[_0x155e('0x49')]=_0x3d08c5['attributes'][_0x155e('0x4c')]?_0x3d08c5[_0x155e('0x49')]:_0x5bbdaa[_0x155e('0x45')];if(_0x54fbed['query'][_0x155e('0x56')]){_0x3d08c5[_0x155e('0x57')]=[{'all':!![]}];}_0x3d08c5=_[_0x155e('0x52')]({},_0x3d08c5,_0x54fbed[_0x155e('0x55')]);return db[_0x155e('0x41')][_0x155e('0x5c')](_0x3d08c5)[_0x155e('0x25')](handleEntityNotFound(_0x1d1187,null))['then'](respondWithResult(_0x1d1187,null))[_0x155e('0x2d')](handleError(_0x1d1187,null));};exports['create']=function(_0x1cb1e6,_0x95c160){return db[_0x155e('0x41')][_0x155e('0x5d')](_0x1cb1e6[_0x155e('0x5e')],{})['then'](function(_0x3b553b){var _0x383eea=_0x1cb1e6[_0x155e('0x5f')][_0x155e('0x3a')]({'plain':!![]});if(!_0x383eea)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x383eea['role']===_0x155e('0x5f')){var _0x5d15ca=_0x3b553b[_0x155e('0x3a')]({'plain':!![]});var _0x35a760=_0x155e('0x3b');return db[_0x155e('0x60')][_0x155e('0x5c')]({'where':{'name':_0x35a760,'userProfileId':_0x383eea[_0x155e('0x61')]},'raw':!![]})[_0x155e('0x25')](function(_0x557d4e){if(_0x557d4e&&_0x557d4e[_0x155e('0x62')]===0x0){return db[_0x155e('0x63')][_0x155e('0x5d')]({'name':_0x5d15ca[_0x155e('0x3d')],'resourceId':_0x5d15ca['id'],'type':_0x557d4e[_0x155e('0x3d')],'sectionId':_0x557d4e['id']},{})[_0x155e('0x25')](function(){return _0x3b553b;});}else{return _0x3b553b;}})[_0x155e('0x2d')](function(_0x64a996){logger[_0x155e('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x64a996);throw _0x64a996;});}return _0x3b553b;})['then'](respondWithResult(_0x95c160,0xc9))['catch'](handleError(_0x95c160,null));};exports[_0x155e('0x38')]=function(_0x4d7c13,_0x25a658){if(_0x4d7c13[_0x155e('0x5e')]['id']){delete _0x4d7c13[_0x155e('0x5e')]['id'];}return db[_0x155e('0x41')]['find']({'where':{'id':_0x4d7c13[_0x155e('0x5a')]['id']},'include':[{'model':db['Pause'],'as':_0x155e('0x5b')}]})['then'](handleEntityNotFound(_0x25a658,null))[_0x155e('0x25')](saveUpdates(_0x4d7c13['body'],null))['then'](respondWithResult(_0x25a658,null))[_0x155e('0x2d')](handleError(_0x25a658,null));};exports['destroy']=function(_0x5b250c,_0x143052){return db[_0x155e('0x41')]['find']({'where':{'id':_0x5b250c[_0x155e('0x5a')]['id']}})[_0x155e('0x25')](handleEntityNotFound(_0x143052,null))[_0x155e('0x25')](removeEntity(_0x143052,null))['catch'](handleError(_0x143052,null));};exports[_0x155e('0x64')]=function(_0x4bcb0b,_0x1b100d){return db[_0x155e('0x41')]['describe']()[_0x155e('0x25')](respondWithResult(_0x1b100d,null))[_0x155e('0x2d')](handleError(_0x1b100d,null));};exports['addDisposition']=function(_0x2f5cbe,_0xc5c6f7,_0x507a93){if(_0x2f5cbe['body']['id']){delete _0x2f5cbe[_0x155e('0x5e')]['id'];}return db[_0x155e('0x41')]['find']({'where':{'id':_0x2f5cbe[_0x155e('0x5a')]['id']}})[_0x155e('0x25')](handleEntityNotFound(_0xc5c6f7,null))[_0x155e('0x25')](function(_0x5c492b){if(_0x5c492b){_0x2f5cbe[_0x155e('0x5e')][_0x155e('0x65')]=_0x5c492b['id'];return db[_0x155e('0x66')][_0x155e('0x5d')](_0x2f5cbe[_0x155e('0x5e')]);}})[_0x155e('0x25')](respondWithResult(_0xc5c6f7,null))['catch'](handleError(_0xc5c6f7,null));};exports['getDispositions']=function(_0xca020b,_0x137f72,_0x5d1355){var _0x2efced={'raw':![],'where':{}};var _0x58924d={};var _0x59ad51={'count':0x0,'rows':[]};return db['FaxAccount'][_0x155e('0x67')]({'where':{'id':_0xca020b[_0x155e('0x5a')]['id']}})[_0x155e('0x25')](handleEntityNotFound(_0x137f72,null))['then'](function(_0x3d21f4){if(_0x3d21f4){_0x58924d[_0x155e('0x45')]=_[_0x155e('0x47')](db[_0x155e('0x66')][_0x155e('0x42')]);_0x58924d[_0x155e('0x46')]=_[_0x155e('0x47')](_0xca020b[_0x155e('0x46')]);_0x58924d[_0x155e('0x48')]=_[_0x155e('0x4a')](_0x58924d['model'],_0x58924d[_0x155e('0x46')]);_0x2efced['attributes']=_[_0x155e('0x4a')](_0x58924d[_0x155e('0x45')],qs[_0x155e('0x4b')](_0xca020b[_0x155e('0x46')][_0x155e('0x4b')]));_0x2efced[_0x155e('0x49')]=_0x2efced['attributes'][_0x155e('0x4c')]?_0x2efced[_0x155e('0x49')]:_0x58924d[_0x155e('0x45')];if(!_0xca020b[_0x155e('0x46')]['hasOwnProperty'](_0x155e('0x68'))){_0x2efced[_0x155e('0x32')]=qs[_0x155e('0x32')](_0xca020b[_0x155e('0x46')][_0x155e('0x32')]);_0x2efced[_0x155e('0x33')]=qs['offset'](_0xca020b[_0x155e('0x46')][_0x155e('0x33')]);}_0x2efced[_0x155e('0x69')]=qs[_0x155e('0x4e')](_0xca020b[_0x155e('0x46')][_0x155e('0x4e')]);_0x2efced[_0x155e('0x51')]=qs[_0x155e('0x48')](_['pick'](_0xca020b[_0x155e('0x46')],_0x58924d[_0x155e('0x48')]));_0x2efced[_0x155e('0x51')][_0x155e('0x65')]=_0x3d21f4['id'];if(_0xca020b['query']['filter']){_0x2efced[_0x155e('0x51')]=_['merge'](_0x2efced['where'],{'$or':_[_0x155e('0x40')](_0x2efced['attributes'],function(_0x6c3dbd){var _0x2a2ef1={};_0x2a2ef1[_0x6c3dbd]={'$like':'%'+_0xca020b[_0x155e('0x46')][_0x155e('0x50')]+'%'};return _0x2a2ef1;})});}_0x2efced=_[_0x155e('0x52')]({},_0x2efced,_0xca020b[_0x155e('0x55')]);return db[_0x155e('0x66')][_0x155e('0x34')]({'where':_0x2efced[_0x155e('0x51')]})[_0x155e('0x25')](function(_0x863842){_0x59ad51[_0x155e('0x34')]=_0x863842;if(_0xca020b[_0x155e('0x46')]['includeAll']){_0x2efced['include']=[{'all':!![]}];}return db[_0x155e('0x66')][_0x155e('0x58')](_0x2efced);})['then'](function(_0x2eca1a){_0x59ad51[_0x155e('0x6a')]=_0x2eca1a;return _0x59ad51;});}})[_0x155e('0x25')](respondWithFilteredResult(_0x137f72,_0x2efced))[_0x155e('0x2d')](handleError(_0x137f72,null));};exports['removeDispositions']=function(_0x19cc2c,_0xe0403e,_0x1bb7f9){return db[_0x155e('0x41')][_0x155e('0x5c')]({'where':{'id':_0x19cc2c['params']['id']}})[_0x155e('0x25')](handleEntityNotFound(_0xe0403e,null))[_0x155e('0x25')](function(_0x49cd60){if(_0x49cd60){return _0x49cd60[_0x155e('0x6b')](_0x19cc2c['query'][_0x155e('0x6c')]);}})['then'](respondWithStatusCode(_0xe0403e,null))[_0x155e('0x2d')](handleError(_0xe0403e,null));};exports[_0x155e('0x6d')]=function(_0x22ac76,_0x315396,_0x42bffa){if(_0x22ac76[_0x155e('0x5e')]['id']){delete _0x22ac76['body']['id'];}return db[_0x155e('0x41')][_0x155e('0x5c')]({'where':{'id':_0x22ac76[_0x155e('0x5a')]['id']}})['then'](handleEntityNotFound(_0x315396,null))['then'](function(_0x259486){if(_0x259486){_0x22ac76['body'][_0x155e('0x65')]=_0x259486['id'];return db[_0x155e('0x6e')][_0x155e('0x5d')](_0x22ac76[_0x155e('0x5e')]);}})[_0x155e('0x25')](respondWithResult(_0x315396,null))[_0x155e('0x2d')](handleError(_0x315396,null));};exports[_0x155e('0x6f')]=function(_0x1c287d,_0x254a4f,_0x5ced6a){var _0x4074ad={'raw':![],'where':{}};var _0x2115d1={};var _0x41cda4={'count':0x0,'rows':[]};return db[_0x155e('0x41')][_0x155e('0x67')]({'where':{'id':_0x1c287d['params']['id']}})['then'](handleEntityNotFound(_0x254a4f,null))['then'](function(_0x495185){if(_0x495185){_0x2115d1['model']=_[_0x155e('0x47')](db[_0x155e('0x6e')][_0x155e('0x42')]);_0x2115d1[_0x155e('0x46')]=_[_0x155e('0x47')](_0x1c287d['query']);_0x2115d1[_0x155e('0x48')]=_[_0x155e('0x4a')](_0x2115d1['model'],_0x2115d1[_0x155e('0x46')]);_0x4074ad[_0x155e('0x49')]=_[_0x155e('0x4a')](_0x2115d1[_0x155e('0x45')],qs[_0x155e('0x4b')](_0x1c287d[_0x155e('0x46')]['fields']));_0x4074ad[_0x155e('0x49')]=_0x4074ad[_0x155e('0x49')][_0x155e('0x4c')]?_0x4074ad[_0x155e('0x49')]:_0x2115d1[_0x155e('0x45')];if(!_0x1c287d[_0x155e('0x46')]['hasOwnProperty']('nolimit')){_0x4074ad[_0x155e('0x32')]=qs[_0x155e('0x32')](_0x1c287d[_0x155e('0x46')][_0x155e('0x32')]);_0x4074ad[_0x155e('0x33')]=qs['offset'](_0x1c287d['query'][_0x155e('0x33')]);}_0x4074ad['order']=qs['sort'](_0x1c287d[_0x155e('0x46')][_0x155e('0x4e')]);_0x4074ad['where']=qs['filters'](_['pick'](_0x1c287d['query'],_0x2115d1['filters']));_0x4074ad[_0x155e('0x51')][_0x155e('0x65')]=_0x495185['id'];if(_0x1c287d[_0x155e('0x46')][_0x155e('0x50')]){_0x4074ad['where']=_[_0x155e('0x52')](_0x4074ad[_0x155e('0x51')],{'$or':_['map'](_0x4074ad[_0x155e('0x49')],function(_0x55b448){var _0x263482={};_0x263482[_0x55b448]={'$like':'%'+_0x1c287d[_0x155e('0x46')][_0x155e('0x50')]+'%'};return _0x263482;})});}_0x4074ad=_[_0x155e('0x52')]({},_0x4074ad,_0x1c287d['options']);return db['CannedAnswer']['count']({'where':_0x4074ad[_0x155e('0x51')]})[_0x155e('0x25')](function(_0x5eb8c7){_0x41cda4[_0x155e('0x34')]=_0x5eb8c7;if(_0x1c287d['query'][_0x155e('0x56')]){_0x4074ad[_0x155e('0x57')]=[{'all':!![]}];}return db['CannedAnswer'][_0x155e('0x58')](_0x4074ad);})[_0x155e('0x25')](function(_0x32df4f){_0x41cda4[_0x155e('0x6a')]=_0x32df4f;return _0x41cda4;});}})[_0x155e('0x25')](respondWithFilteredResult(_0x254a4f,_0x4074ad))[_0x155e('0x2d')](handleError(_0x254a4f,null));};exports['removeAnswers']=function(_0x2502d8,_0x1f614a,_0x4c3128){return db[_0x155e('0x41')][_0x155e('0x5c')]({'where':{'id':_0x2502d8[_0x155e('0x5a')]['id']}})[_0x155e('0x25')](handleEntityNotFound(_0x1f614a,null))['then'](function(_0x9dda04){if(_0x9dda04){return _0x9dda04[_0x155e('0x70')](_0x2502d8[_0x155e('0x46')][_0x155e('0x6c')]);}})[_0x155e('0x25')](respondWithStatusCode(_0x1f614a,null))[_0x155e('0x2d')](handleError(_0x1f614a,null));};exports[_0x155e('0x71')]=function(_0xbe4513,_0xbbd143,_0x2063b2){return db['FaxInteraction']['find']({'where':{'id':_0xbe4513['params']['id']}})['then'](handleEntityNotFound(_0xbbd143,null))[_0x155e('0x25')](function(_0x3797f2){if(_0x3797f2){return _0x3797f2[_0x155e('0x71')](_0xbe4513[_0x155e('0x5e')][_0x155e('0x6c')],_[_0x155e('0x72')](_0xbe4513['body'],[_0x155e('0x6c'),'id'])||{});}})['then'](respondWithResult(_0xbbd143,null))[_0x155e('0x2d')](handleError(_0xbbd143,null));};exports[_0x155e('0x73')]=function(_0x50a91c,_0x454297,_0xa2c043){var _0xd1917b={'raw':![],'where':{}};var _0x2c8f27={};var _0x32012c={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x50a91c[_0x155e('0x5a')]['id']}})[_0x155e('0x25')](handleEntityNotFound(_0x454297,null))[_0x155e('0x25')](function(_0x1cbab0){if(_0x1cbab0){_0x2c8f27[_0x155e('0x45')]=_['keys'](db[_0x155e('0x74')][_0x155e('0x42')]);_0x2c8f27[_0x155e('0x46')]=_[_0x155e('0x47')](_0x50a91c[_0x155e('0x46')]);_0x2c8f27[_0x155e('0x48')]=_[_0x155e('0x4a')](_0x2c8f27[_0x155e('0x45')],_0x2c8f27[_0x155e('0x46')]);_0xd1917b[_0x155e('0x49')]=_[_0x155e('0x4a')](_0x2c8f27[_0x155e('0x45')],qs[_0x155e('0x4b')](_0x50a91c[_0x155e('0x46')][_0x155e('0x4b')]));_0xd1917b[_0x155e('0x49')]=_0xd1917b['attributes']['length']?_0xd1917b[_0x155e('0x49')]:_0x2c8f27['model'];if(!_0x50a91c[_0x155e('0x46')][_0x155e('0x4d')](_0x155e('0x68'))){_0xd1917b[_0x155e('0x32')]=qs[_0x155e('0x32')](_0x50a91c['query']['limit']);_0xd1917b['offset']=qs[_0x155e('0x33')](_0x50a91c[_0x155e('0x46')][_0x155e('0x33')]);}_0xd1917b[_0x155e('0x69')]=qs[_0x155e('0x4e')](_0x50a91c['query'][_0x155e('0x4e')]);_0xd1917b[_0x155e('0x51')]=qs[_0x155e('0x48')](_['pick'](_0x50a91c[_0x155e('0x46')],_0x2c8f27[_0x155e('0x48')]));_0xd1917b[_0x155e('0x51')][_0x155e('0x65')]=_0x1cbab0['id'];if(_0x50a91c[_0x155e('0x46')][_0x155e('0x50')]){_0xd1917b[_0x155e('0x51')]=_['merge'](_0xd1917b[_0x155e('0x51')],{'$or':_['map'](_0xd1917b[_0x155e('0x49')],function(_0x4f4662){var _0x2d790b={};_0x2d790b[_0x4f4662]={'$like':'%'+_0x50a91c[_0x155e('0x46')][_0x155e('0x50')]+'%'};return _0x2d790b;})});}_0xd1917b=_[_0x155e('0x52')]({},_0xd1917b,_0x50a91c[_0x155e('0x55')]);return db[_0x155e('0x74')]['count']({'where':_0xd1917b[_0x155e('0x51')]})[_0x155e('0x25')](function(_0x50ef0){_0x32012c[_0x155e('0x34')]=_0x50ef0;if(_0x50a91c['query'][_0x155e('0x56')]){_0xd1917b[_0x155e('0x57')]=[{'model':db[_0x155e('0x75')],'as':_0x155e('0x76'),'required':![]},{'model':db['User'],'as':_0x155e('0x77'),'attributes':[_0x155e('0x3d'),_0x155e('0x78'),'internal'],'required':![]},{'model':db[_0x155e('0x79')],'as':'Tags','attributes':['id',_0x155e('0x3d'),_0x155e('0x7a')],'where':_0x50a91c[_0x155e('0x46')][_0x155e('0x7b')]?{'id':_0x50a91c['query'][_0x155e('0x7b')]}:undefined,'required':_0x50a91c['query'][_0x155e('0x7b')]?!![]:![]}];}return db[_0x155e('0x74')][_0x155e('0x58')](_0xd1917b);})[_0x155e('0x25')](function(_0xa9293e){_0x32012c[_0x155e('0x6a')]=_0xa9293e;return _0x32012c;});}})[_0x155e('0x25')](respondWithFilteredResult(_0x454297,_0xd1917b))[_0x155e('0x2d')](handleError(_0x454297,null));};exports[_0x155e('0x7c')]=function(_0x1a868c,_0x50fe5f){var _0x45774d=_0x1a868c[_0x155e('0x5a')]['id'];var _0x22a704=_0x1a868c[_0x155e('0x5e')];var _0x15ac0b=0xc8;var _0x306c7e=null;return db[_0x155e('0x7d')][_0x155e('0x7e')]({'isolationLevel':db[_0x155e('0x7d')]['Transaction']['ISOLATION_LEVELS'][_0x155e('0x7f')]},function(_0x3fcc37){return db[_0x155e('0x41')][_0x155e('0x67')]({'where':{'id':_0x45774d},'transaction':_0x3fcc37})['then'](function(_0x5c23e2){if(_0x5c23e2){return db['FaxApplication']['destroy']({'where':{'FaxAccountId':_0x45774d},'transaction':_0x3fcc37})['then'](function(){var _0x4ac128=_['map'](_0x22a704,function(_0x352807){_0x352807[_0x155e('0x65')]=_0x45774d;return _0x352807;});return db['FaxApplication'][_0x155e('0x80')](_0x4ac128,{'transaction':_0x3fcc37});});}else{_0x15ac0b=0x194;_0x306c7e=[];}});})[_0x155e('0x25')](function(){if(_0x15ac0b!==0x194){return db[_0x155e('0x81')]['findAndCountAll']({'where':{'FaxAccountId':_0x45774d},'order':'priority'})[_0x155e('0x25')](function(_0xcaacf1){_0x306c7e=_0xcaacf1;});}})['catch'](function(_0x56e57b){_0x15ac0b=0x1f4;logger[_0x155e('0x29')](_0x56e57b[_0x155e('0x3c')]);if(_0x56e57b['name']){delete _0x56e57b[_0x155e('0x3d')];}_0x306c7e=_0x56e57b;})[_0x155e('0x82')](function(){if(_0x306c7e===null){_0x50fe5f[_0x155e('0x2e')](_0x15ac0b);}else{if(_0x15ac0b===0x1f4){_0x50fe5f[_0x155e('0x2f')](_0x15ac0b)['send'](_0x306c7e);}else{_0x50fe5f[_0x155e('0x2f')](_0x15ac0b)[_0x155e('0x30')](_0x306c7e);}}});};exports['getApplications']=function(_0x53a687,_0x203cf3,_0x599626){var _0x31059f={};var _0x3d75fb={};var _0x3001f3;var _0x1d02d7;return db[_0x155e('0x41')][_0x155e('0x67')]({'where':{'id':_0x53a687[_0x155e('0x5a')]['id']}})['then'](handleEntityNotFound(_0x203cf3,null))['then'](function(_0x3d11c5){if(_0x3d11c5){_0x3001f3=_0x3d11c5;_0x3d75fb[_0x155e('0x45')]=_['keys'](db['FaxApplication'][_0x155e('0x42')]);_0x3d75fb[_0x155e('0x46')]=_[_0x155e('0x47')](_0x53a687['query']);_0x3d75fb[_0x155e('0x48')]=_[_0x155e('0x4a')](_0x3d75fb['model'],_0x3d75fb['query']);_0x31059f[_0x155e('0x49')]=_['intersection'](_0x3d75fb[_0x155e('0x45')],qs['fields'](_0x53a687['query']['fields']));_0x31059f['attributes']=_0x31059f[_0x155e('0x49')]['length']?_0x31059f['attributes']:_0x3d75fb[_0x155e('0x45')];_0x31059f[_0x155e('0x69')]=qs[_0x155e('0x4e')](_0x53a687[_0x155e('0x46')]['sort']);_0x31059f[_0x155e('0x51')]=qs[_0x155e('0x48')](_[_0x155e('0x4f')](_0x53a687[_0x155e('0x46')],_0x3d75fb[_0x155e('0x48')]));if(_0x53a687[_0x155e('0x46')][_0x155e('0x50')]){_0x31059f[_0x155e('0x51')]=_[_0x155e('0x52')](_0x31059f[_0x155e('0x51')],{'$or':_[_0x155e('0x40')](_0x31059f['attributes'],function(_0x13bf6f){var _0x7c6a33={};_0x7c6a33[_0x13bf6f]={'$like':'%'+_0x53a687[_0x155e('0x46')][_0x155e('0x50')]+'%'};return _0x7c6a33;})});}_0x31059f=_['merge']({},_0x31059f,_0x53a687[_0x155e('0x55')]);return _0x3001f3['getApplications'](_0x31059f);}})[_0x155e('0x25')](function(_0x32d9ca){if(_0x32d9ca){_0x1d02d7=_0x32d9ca[_0x155e('0x4c')];if(!_0x53a687[_0x155e('0x46')][_0x155e('0x4d')](_0x155e('0x68'))){_0x31059f[_0x155e('0x32')]=qs[_0x155e('0x32')](_0x53a687['query'][_0x155e('0x32')]);_0x31059f[_0x155e('0x33')]=qs[_0x155e('0x33')](_0x53a687[_0x155e('0x46')][_0x155e('0x33')]);}return _0x3001f3[_0x155e('0x83')](_0x31059f);}})[_0x155e('0x25')](function(_0x24019d){if(_0x24019d){return _0x24019d?{'count':_0x1d02d7,'rows':_0x24019d}:null;}})[_0x155e('0x25')](respondWithResult(_0x203cf3,null))[_0x155e('0x2d')](handleError(_0x203cf3,null));};function Extension(_0x4efbb5,_0x1432db,_0x5d7576,_0x36558b){this[_0x155e('0x84')]=_0x155e('0x85');this[_0x155e('0x86')]=_0x4efbb5[_0x155e('0x87')];this[_0x155e('0x88')]=_0x36558b;this[_0x155e('0x53')]='system';this['description']=_0x155e('0x89');this['FaxAccountId']=_0x4efbb5['id'];this['priority']=_0x1432db;this['appdata']=_0x5d7576;}function createExtensionsReciveFax(_0x16fdbc){var _0x1bb46e=0x1;var _0xca9f97=[];_0xca9f97['push'](new Extension(_0x16fdbc,_0x1bb46e,'',_0x155e('0x8a')));_0x1bb46e+=0x1;_0xca9f97[_0x155e('0x8b')](new Extension(_0x16fdbc,_0x1bb46e,_0x155e('0x8c'),'Set'));_0x1bb46e+=0x1;for(var _0x1e1716 in _0x16fdbc){if(_0x16fdbc[_0x155e('0x4d')](_0x1e1716)&&(_0x1e1716===_0x155e('0x8d')||_0x1e1716==='localstationid'||_0x1e1716===_0x155e('0x8e')||_0x1e1716===_0x155e('0x8f')||_0x1e1716===_0x155e('0x90')||_0x1e1716===_0x155e('0x91')||_0x1e1716===_0x155e('0x92')||_0x1e1716===_0x155e('0x93')||_0x1e1716===_0x155e('0x94'))){_0xca9f97['push'](new Extension(_0x16fdbc,_0x1bb46e,'FAXOPT('+_0x1e1716+')='+_0x16fdbc[_0x1e1716],_0x155e('0x95')));_0x1bb46e+=0x1;}}_0xca9f97['push'](new Extension(_0x16fdbc,_0x1bb46e,'6','Wait'));_0x1bb46e+=0x1;_0xca9f97['push'](new Extension(_0x16fdbc,_0x1bb46e,_0x155e('0x96'),'ReceiveFax'));_0x1bb46e=0x0;return _0xca9f97;}exports['addAccountApplications']=function(_0x40da9f,_0x57b84d,_0x509335){var _0x44da48;return db[_0x155e('0x7d')][_0x155e('0x7e')](function(_0x18ead6){return db['FaxAccount'][_0x155e('0x5d')](_0x40da9f['body'],{'transaction':_0x18ead6})[_0x155e('0x25')](function(_0x2db097){_0x44da48=_0x2db097[_0x155e('0x3a')]({'plain':!![]});return db[_0x155e('0x97')]['bulkCreate'](createExtensionsReciveFax(_0x44da48),{'transaction':_0x18ead6});});})[_0x155e('0x25')](function(){return _0x44da48;})[_0x155e('0x25')](respondWithResult(_0x57b84d,null))[_0x155e('0x2d')](handleError(_0x57b84d,null));};exports[_0x155e('0x98')]=function(_0x50f159,_0x4e767a,_0xbe2972){var _0x3da4b2;return db[_0x155e('0x7d')][_0x155e('0x7e')](function(_0x5a59c5){return db[_0x155e('0x41')][_0x155e('0x38')](_0x50f159[_0x155e('0x5e')],{'where':{'id':_0x50f159[_0x155e('0x5e')]['id']},'transaction':_0x5a59c5})[_0x155e('0x25')](function(_0xc410d4){return db[_0x155e('0x97')]['destroy']({'where':{'FaxAccountId':_0x50f159['body']['id']},'transaction':_0x5a59c5})[_0x155e('0x25')](function(_0x59ade2){return db[_0x155e('0x97')][_0x155e('0x80')](createExtensionsReciveFax(_[_0x155e('0x72')](_0x50f159[_0x155e('0x5e')],[_0x155e('0x99'),_0x155e('0x44'),'createdAt',_0x155e('0x9a'),_0x155e('0x9b'),'ListId'])),{'transaction':_0x5a59c5});});});})[_0x155e('0x25')](function(){return db[_0x155e('0x41')][_0x155e('0x9c')](_0x50f159[_0x155e('0x5e')]['id']);})[_0x155e('0x25')](respondWithResult(_0x4e767a,null))[_0x155e('0x2d')](handleError(_0x4e767a,null));};exports[_0x155e('0x9d')]=function(_0x4aba0f,_0x17b04a,_0x4ac4f6){var _0x2d27f2={'raw':!![],'where':{}};var _0x3b6beb={};var _0x19ef0c={'count':0x0,'rows':[]};return db[_0x155e('0x41')][_0x155e('0x67')]({'where':{'id':_0x4aba0f[_0x155e('0x5a')]['id']}})[_0x155e('0x25')](handleEntityNotFound(_0x17b04a,null))[_0x155e('0x25')](function(_0x115542){if(_0x115542){_0x3b6beb[_0x155e('0x45')]=_[_0x155e('0x47')](db[_0x155e('0x9e')][_0x155e('0x42')]);_0x3b6beb[_0x155e('0x46')]=_['keys'](_0x4aba0f[_0x155e('0x46')]);_0x3b6beb[_0x155e('0x48')]=_[_0x155e('0x4a')](_0x3b6beb[_0x155e('0x45')],_0x3b6beb[_0x155e('0x46')]);_0x2d27f2[_0x155e('0x49')]=_[_0x155e('0x4a')](_0x3b6beb['model'],qs[_0x155e('0x4b')](_0x4aba0f[_0x155e('0x46')][_0x155e('0x4b')]));_0x2d27f2['attributes']=_0x2d27f2[_0x155e('0x49')][_0x155e('0x4c')]?_0x2d27f2[_0x155e('0x49')]:_0x3b6beb[_0x155e('0x45')];if(!_0x4aba0f[_0x155e('0x46')][_0x155e('0x4d')](_0x155e('0x68'))){_0x2d27f2[_0x155e('0x32')]=qs[_0x155e('0x32')](_0x4aba0f[_0x155e('0x46')][_0x155e('0x32')]);_0x2d27f2[_0x155e('0x33')]=qs[_0x155e('0x33')](_0x4aba0f[_0x155e('0x46')][_0x155e('0x33')]);}_0x2d27f2[_0x155e('0x69')]=qs[_0x155e('0x4e')](_0x4aba0f[_0x155e('0x46')][_0x155e('0x4e')]);_0x2d27f2[_0x155e('0x51')]=qs['filters'](_['pick'](_0x4aba0f[_0x155e('0x46')],_0x3b6beb[_0x155e('0x48')]));_0x2d27f2[_0x155e('0x51')][_0x155e('0x65')]=_0x115542['id'];if(_0x4aba0f[_0x155e('0x46')][_0x155e('0x50')]){_0x2d27f2[_0x155e('0x51')]=_['merge'](_0x2d27f2['where'],{'$or':_[_0x155e('0x40')](_0x2d27f2['attributes'],function(_0x1a66fa){var _0x3a16ac={};_0x3a16ac[_0x1a66fa]={'$like':'%'+_0x4aba0f['query'][_0x155e('0x50')]+'%'};return _0x3a16ac;})});}if(_0x4aba0f[_0x155e('0x46')][_0x155e('0x9f')]){var _0x4f29e8=_0x4aba0f[_0x155e('0x46')][_0x155e('0x9f')][_0x155e('0xa0')](',');var _0xc41d8a={};_0xc41d8a[_0x4f29e8[0x0]]={'$gte':moment(_0x4f29e8[0x1])['format'](_0x155e('0xa1'))};_0x2d27f2[_0x155e('0x51')]=_[_0x155e('0x52')](_0x2d27f2[_0x155e('0x51')],_0xc41d8a);}_0x2d27f2=_[_0x155e('0x52')]({},_0x2d27f2,_0x4aba0f[_0x155e('0x55')]);return db[_0x155e('0x9e')]['count']({'where':_0x2d27f2[_0x155e('0x51')]})['then'](function(_0x118f35){_0x19ef0c['count']=_0x118f35;if(_0x4aba0f[_0x155e('0x46')][_0x155e('0x56')]){_0x2d27f2[_0x155e('0x57')]=[{'all':!![]}];}return db[_0x155e('0x9e')][_0x155e('0x58')](_0x2d27f2);})[_0x155e('0x25')](function(_0x1e04a8){_0x19ef0c[_0x155e('0x6a')]=_0x1e04a8;return _0x19ef0c;});}})['then'](respondWithFilteredResult(_0x17b04a,_0x2d27f2))['catch'](handleError(_0x17b04a,null));};exports['send']=function(_0x5ffed9,_0x1504b0,_0x58ad4c){var _0xf157f1,_0x46f54c={},_0x119f77;if(_0x5ffed9['body']['to']){_0x119f77=_0x5ffed9[_0x155e('0x5e')]['to'][0x0];}return db['FaxAccount'][_0x155e('0x5c')]({'where':{'id':_0x5ffed9['params']['id']},'include':[{'model':db[_0x155e('0xa2')],'as':_0x155e('0xa3'),'include':[{'model':db[_0x155e('0x75')],'as':_0x155e('0xa4'),'where':{'fax':_0x119f77},'limit':0x1,'order':[['updatedAt',_0x155e('0xa5')]]}]}]})[_0x155e('0x25')](handleEntityNotFound(_0x1504b0,null))[_0x155e('0x25')](function(_0x17298a){_0xf157f1=_0x17298a;if(_0x5ffed9['body'][_0x155e('0xa6')]&&_0x5ffed9[_0x155e('0x5e')][_0x155e('0xa6')][_0x155e('0x4c')]){for(var _0x2d7d92=0x0;_0x2d7d92<_0x5ffed9[_0x155e('0x5e')][_0x155e('0xa6')][_0x155e('0x4c')];_0x2d7d92+=0x1){_0x5ffed9['body']['attachments'][_0x2d7d92]={'filename':_0x5ffed9[_0x155e('0x5e')][_0x155e('0xa6')][_0x2d7d92]['name'],'id':_0x5ffed9[_0x155e('0x5e')][_0x155e('0xa6')][_0x2d7d92]['id'],'path':path['join'](config['root'],_0x155e('0xa7'),_0x5ffed9['body'][_0x155e('0xa6')][_0x2d7d92][_0x155e('0xa8')])};}}return respondWithRpcPromise(_0x155e('0xa9'),_0x155e('0xa9'),{'FaxAccountId':_['isNil'](_0x5ffed9['params']['id'])?undefined:_0x5ffed9[_0x155e('0x5a')]['id'],'path':_['isNil'](_0x5ffed9[_0x155e('0x5e')][_0x155e('0xa6')][0x0]['path'])?undefined:_0x5ffed9[_0x155e('0x5e')]['attachments'][0x0][_0x155e('0x8')],'fax':_[_0x155e('0xaa')](_0x5ffed9[_0x155e('0x5e')]['to'][0x0])?undefined:_0x5ffed9[_0x155e('0x5e')]['to'][0x0]},client9002);})[_0x155e('0x25')](function(){if(_0xf157f1){if(_['isNil'](_0x5ffed9[_0x155e('0x5e')][_0x155e('0xab')])){_0x5ffed9[_0x155e('0x5e')]['from']=util[_0x155e('0xac')]('\x22%s\x22\x20<%s>',_0xf157f1[_0x155e('0x3d')],_0xf157f1[_0x155e('0xad')]);}if(_0xf157f1[_0x155e('0xa3')]){if(_0xf157f1[_0x155e('0xa3')][_0x155e('0xa4')][_0x155e('0x4c')]){return _0xf157f1['List'][_0x155e('0xa4')][0x0];}else{return db[_0x155e('0x75')]['create'](_['defaults'](_0x5ffed9[_0x155e('0x5e')],{'firstName':_0x5ffed9[_0x155e('0x5e')]['to'][0x0],'phone':_0x5ffed9[_0x155e('0x5e')]['to'][0x0],'fax':_0x5ffed9['body']['to'][0x0],'ListId':_0xf157f1[_0x155e('0xae')]}));}}else{throw new Error(_0x155e('0xaf'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0x155e('0x25')](function(_0x380398){if(_0x380398){return db[_0x155e('0x74')][_0x155e('0x5c')]({'where':{'ContactId':_0x380398['id'],'closed':![],'FaxAccountId':_0xf157f1['id']}})[_0x155e('0x25')](function(_0x354e1f){if(_0x354e1f){return[_0x354e1f,![]];}return db[_0x155e('0x74')][_0x155e('0x5d')]({'UserId':_0x5ffed9['user']['id'],'ContactId':_0x380398['id'],'FaxAccountId':_0xf157f1['id'],'fax':_0x5ffed9[_0x155e('0x5e')]['to'][0x0],'firstMsgDirection':_0x155e('0xb0'),'Messages':[_['merge'](_0x5ffed9[_0x155e('0x5e')],{'read':![],'body':_0x5ffed9[_0x155e('0x5e')][_0x155e('0xa6')][0x0][_0x155e('0xb1')],'FaxAccountId':_0xf157f1['id'],'UserId':_0x5ffed9[_0x155e('0x5f')]['id'],'ContactId':_0x380398['id'],'AttachmentId':_0x5ffed9[_0x155e('0x5e')][_0x155e('0xa6')][0x0]['id']})]},{'include':[{'model':db[_0x155e('0x9e')],'as':_0x155e('0xb2')}]})[_0x155e('0x25')](function(_0x14b14e){return[_0x14b14e,!![]];});});}else{throw new Error(_0x155e('0xb3'));}})['spread'](function(_0x1653ca,_0x4a5c2e){if(_0x4a5c2e){return _0x1653ca;}return db[_0x155e('0x9e')]['create']({'direction':_0x155e('0xb0'),'read':![],'body':_0x5ffed9[_0x155e('0x5e')][_0x155e('0xa6')][0x0][_0x155e('0xb1')],'FaxAccountId':_0xf157f1['id'],'FaxInteractionId':_0x1653ca['id'],'UserId':_0x5ffed9['user']['id'],'ContactId':_0x1653ca[_0x155e('0xb4')],'AttachmentId':_0x5ffed9[_0x155e('0x5e')][_0x155e('0xa6')][0x0]['id']})[_0x155e('0x25')](function(_0x1b105e){_0x1653ca[_0x155e('0xb5')][_0x155e('0xb2')]=[];_0x1653ca[_0x155e('0xb5')]['Messages'][_0x155e('0x8b')](_0x1b105e['dataValues']);return _0x1653ca;});})[_0x155e('0x25')](function(_0x4435f9){respondWithRpcPromise(_0x155e('0xb6'),_0x155e('0xb6'),{'FaxAccountId':_[_0x155e('0xaa')](_0x5ffed9[_0x155e('0x5a')]['id'])?undefined:_0x5ffed9[_0x155e('0x5a')]['id'],'path':_[_0x155e('0xaa')](_0x5ffed9[_0x155e('0x5e')][_0x155e('0xa6')][0x0][_0x155e('0x8')])?undefined:_0x5ffed9[_0x155e('0x5e')]['attachments'][0x0][_0x155e('0x8')],'fax':_[_0x155e('0xaa')](_0x5ffed9['body']['to'][0x0])?undefined:_0x5ffed9['body']['to'][0x0],'AttachmentId':_0x5ffed9[_0x155e('0x5e')]['attachments'][0x0]['id']},client9002)[_0x155e('0x25')](function(_0x159f0e){logger[_0x155e('0x26')](_0x155e('0xb7'),_0x159f0e);})[_0x155e('0x2d')](function(_0x1ad8a1){logger[_0x155e('0x26')](_0x155e('0xb7'),_0x1ad8a1);});return _0x4435f9;})[_0x155e('0x25')](respondWithResult(_0x1504b0,null))['catch'](handleError(_0x1504b0,null));};exports[_0x155e('0xb8')]=function(_0x40a7cb,_0x37e970,_0x546b55){return db[_0x155e('0x41')][_0x155e('0x5c')]({'where':{'id':_0x40a7cb['params']['id']}})[_0x155e('0x25')](handleEntityNotFound(_0x37e970,null))[_0x155e('0x25')](function(_0x2c416e){if(_0x2c416e){return _0x2c416e[_0x155e('0xb8')](_0x40a7cb[_0x155e('0x5e')][_0x155e('0x6c')],_[_0x155e('0x72')](_0x40a7cb[_0x155e('0x5e')],[_0x155e('0x6c'),'id'])||{})[_0x155e('0xb9')](function(_0x2f31c8){for(var _0xfbbcd6=0x0;_0xfbbcd6<_0x40a7cb[_0x155e('0x5e')][_0x155e('0x6c')][_0x155e('0x4c')];_0xfbbcd6+=0x1){socket[_0x155e('0xba')](_0x155e('0xbb'),{'UserId':Number(_0x40a7cb['body'][_0x155e('0x6c')][_0xfbbcd6]),'FaxAccountId':Number(_0x40a7cb[_0x155e('0x5a')]['id'])});}return _0x2f31c8;});}})[_0x155e('0x25')](respondWithResult(_0x37e970,null))['catch'](handleError(_0x37e970,null));};exports[_0x155e('0xbc')]=function(_0x399820,_0x682a10,_0x568b0a){return db['FaxAccount']['find']({'where':{'id':_0x399820[_0x155e('0x5a')]['id']}})[_0x155e('0x25')](handleEntityNotFound(_0x682a10,null))[_0x155e('0x25')](function(_0x4a5f9b){if(_0x4a5f9b){return _0x4a5f9b[_0x155e('0xbc')](_0x399820[_0x155e('0x46')]['ids'])[_0x155e('0x25')](function(){if(_[_0x155e('0xbd')](_0x399820[_0x155e('0x46')][_0x155e('0x6c')])){for(var _0x31eedc=0x0;_0x31eedc<_0x399820['query'][_0x155e('0x6c')][_0x155e('0x4c')];_0x31eedc+=0x1){socket[_0x155e('0xba')]('userFaxAccount:remove',{'UserId':Number(_0x399820[_0x155e('0x46')]['ids'][_0x31eedc]),'FaxAccountId':Number(_0x399820[_0x155e('0x5a')]['id'])});}}else{socket['emit']('userFaxAccount:remove',{'UserId':Number(_0x399820[_0x155e('0x46')][_0x155e('0x6c')]),'FaxAccountId':Number(_0x399820[_0x155e('0x5a')]['id'])});}});}})[_0x155e('0x25')](respondWithStatusCode(_0x682a10,null))['catch'](handleError(_0x682a10,null));};exports[_0x155e('0xbe')]=function(_0x1220ed,_0x166723,_0x3382c0){var _0x2c3d65={};var _0x3c1057={};var _0x36e3e4;var _0x21d2fa;return db[_0x155e('0x41')][_0x155e('0x67')]({'where':{'id':_0x1220ed[_0x155e('0x5a')]['id']}})[_0x155e('0x25')](handleEntityNotFound(_0x166723,null))[_0x155e('0x25')](function(_0x1ce4d5){if(_0x1ce4d5){_0x36e3e4=_0x1ce4d5;_0x3c1057['model']=_['keys'](db[_0x155e('0xbf')][_0x155e('0x42')]);_0x3c1057[_0x155e('0x46')]=_[_0x155e('0x47')](_0x1220ed[_0x155e('0x46')]);_0x3c1057[_0x155e('0x48')]=_['intersection'](_0x3c1057[_0x155e('0x45')],_0x3c1057[_0x155e('0x46')]);_0x2c3d65[_0x155e('0x49')]=_[_0x155e('0x4a')](_0x3c1057[_0x155e('0x45')],qs[_0x155e('0x4b')](_0x1220ed['query'][_0x155e('0x4b')]));_0x2c3d65[_0x155e('0x49')]=_0x2c3d65[_0x155e('0x49')][_0x155e('0x4c')]?_0x2c3d65[_0x155e('0x49')]:_0x3c1057[_0x155e('0x45')];_0x2c3d65[_0x155e('0x69')]=qs['sort'](_0x1220ed['query'][_0x155e('0x4e')]);_0x2c3d65['where']=qs[_0x155e('0x48')](_[_0x155e('0x4f')](_0x1220ed[_0x155e('0x46')],_0x3c1057[_0x155e('0x48')]));if(_0x1220ed[_0x155e('0x46')]['filter']){_0x2c3d65[_0x155e('0x51')]=_[_0x155e('0x52')](_0x2c3d65[_0x155e('0x51')],{'$or':_['map'](_0x2c3d65[_0x155e('0x49')],function(_0x5851c5){var _0xff9100={};_0xff9100[_0x5851c5]={'$like':'%'+_0x1220ed[_0x155e('0x46')][_0x155e('0x50')]+'%'};return _0xff9100;})});}_0x2c3d65=_[_0x155e('0x52')]({},_0x2c3d65,_0x1220ed[_0x155e('0x55')]);return _0x36e3e4[_0x155e('0xbe')](_0x2c3d65);}})[_0x155e('0x25')](function(_0x3df521){if(_0x3df521){_0x21d2fa=_0x3df521[_0x155e('0x4c')];if(!_0x1220ed[_0x155e('0x46')][_0x155e('0x4d')](_0x155e('0x68'))){_0x2c3d65[_0x155e('0x32')]=qs[_0x155e('0x32')](_0x1220ed['query'][_0x155e('0x32')]);_0x2c3d65[_0x155e('0x33')]=qs['offset'](_0x1220ed[_0x155e('0x46')][_0x155e('0x33')]);}return _0x36e3e4[_0x155e('0xbe')](_0x2c3d65);}})['then'](function(_0x3f139a){if(_0x3f139a){return _0x3f139a?{'count':_0x21d2fa,'rows':_0x3f139a}:null;}})[_0x155e('0x25')](respondWithResult(_0x166723,null))[_0x155e('0x2d')](handleError(_0x166723,null));}; \ No newline at end of file +var _0x0e1e=['desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','./faxAccount.socket','register','jayson/promise','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','save','destroy','get','FaxAccounts','UserProfileResource','end','name','send','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','includeAll','include','rows','catch','show','params','Pause','keys','merge','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','getDispositions','findOne','FaxAccountId','Disposition','findAll','ids','CannedAnswer','options','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tags','color','tag','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','FaxApplication','findAndCountAll','stack','finally','getApplications','context','from-voip-provider','exten','localstationid','app','description','Fax\x20Extension','priority','appdata','push','Answer','Set','ecm','faxdetect','maxrate','minrate','modem','t38timeout','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','bulkCreate','updateAccountApplications','update','tech','TrunkId','ListId','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','Contacts','updatedAt','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','path','from','\x22%s\x22\x20<%s>','fax','List','List\x20not\x20found','out','Messages','Contact\x20not\x20found','spread','filename','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x2c9fd2,_0x13c630){var _0xe7c289=function(_0x189f46){while(--_0x189f46){_0x2c9fd2['push'](_0x2c9fd2['shift']());}};_0xe7c289(++_0x13c630);}(_0x0e1e,0x188));var _0xe0e1=function(_0xde8ec8,_0x10f814){_0xde8ec8=_0xde8ec8-0x0;var _0x3dfb65=_0x0e1e[_0xde8ec8];return _0x3dfb65;};'use strict';var emlformat=require(_0xe0e1('0x0'));var rimraf=require(_0xe0e1('0x1'));var zipdir=require(_0xe0e1('0x2'));var jsonpatch=require(_0xe0e1('0x3'));var rp=require(_0xe0e1('0x4'));var moment=require('moment');var BPromise=require(_0xe0e1('0x5'));var Mustache=require(_0xe0e1('0x6'));var util=require(_0xe0e1('0x7'));var path=require('path');var sox=require(_0xe0e1('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe0e1('0x9'));var _=require(_0xe0e1('0xa'));var squel=require(_0xe0e1('0xb'));var crypto=require(_0xe0e1('0xc'));var jsforce=require(_0xe0e1('0xd'));var deskjs=require(_0xe0e1('0xe'));var toCsv=require(_0xe0e1('0xf'));var querystring=require(_0xe0e1('0x10'));var Papa=require(_0xe0e1('0x11'));var Redis=require(_0xe0e1('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xe0e1('0x13'));var as=require(_0xe0e1('0x14'));var hardwareService=require(_0xe0e1('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xe0e1('0x16'));var config=require(_0xe0e1('0x17'));var licenseUtil=require(_0xe0e1('0x18'));var db=require('../../mysqldb')['db'];config[_0xe0e1('0x19')]=_[_0xe0e1('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe0e1('0x19')]));require(_0xe0e1('0x1b'))[_0xe0e1('0x1c')](socket);var jayson=require(_0xe0e1('0x1d'));var client=jayson[_0xe0e1('0x1e')][_0xe0e1('0x1f')]({'port':0x232c});var client9002=jayson[_0xe0e1('0x1e')][_0xe0e1('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x664745,_0x206352,_0x4c5d59,_0x1b3875){return new BPromise(function(_0x105e7b,_0x1c08e1){var _0x4f6697=_0x1b3875||client;return _0x4f6697[_0xe0e1('0x20')](_0x664745,_0x4c5d59)[_0xe0e1('0x21')](function(_0x1e549b){logger[_0xe0e1('0x22')](_0xe0e1('0x23'),_0x206352,_0xe0e1('0x24'));logger[_0xe0e1('0x25')](_0xe0e1('0x26'),_0x206352,'request\x20sent',JSON[_0xe0e1('0x27')](_0x1e549b));if(_0x1e549b['error']){if(_0x1e549b[_0xe0e1('0x28')][_0xe0e1('0x29')]===0x1f4){logger[_0xe0e1('0x28')]('FaxAccount,\x20%s,\x20%s',_0x206352,_0x1e549b[_0xe0e1('0x28')][_0xe0e1('0x2a')]);return _0x1c08e1(_0x1e549b[_0xe0e1('0x28')]['message']);}logger['error'](_0xe0e1('0x23'),_0x206352,_0x1e549b[_0xe0e1('0x28')]['message']);return _0x105e7b(_0x1e549b[_0xe0e1('0x28')][_0xe0e1('0x2a')]);}else{logger[_0xe0e1('0x22')](_0xe0e1('0x23'),_0x206352,'request\x20sent');_0x105e7b(_0x1e549b[_0xe0e1('0x2b')][_0xe0e1('0x2a')]);}})['catch'](function(_0x5dd8e9){logger[_0xe0e1('0x28')](_0xe0e1('0x23'),_0x206352,_0x5dd8e9);_0x1c08e1(_0x5dd8e9);});});}function respondWithStatusCode(_0x100acf,_0x1a708a){_0x1a708a=_0x1a708a||0xcc;return function(_0x30674c){if(_0x30674c){return _0x100acf[_0xe0e1('0x2c')](_0x1a708a);}return _0x100acf['status'](_0x1a708a)['end']();};}function respondWithResult(_0x19a935,_0x3837ff){_0x3837ff=_0x3837ff||0xc8;return function(_0x3244f7){if(_0x3244f7){return _0x19a935[_0xe0e1('0x2d')](_0x3837ff)['json'](_0x3244f7);}};}function respondWithFilteredResult(_0x1a45b3,_0xbe275){return function(_0x4af028){if(_0x4af028){var _0x478b73=typeof _0xbe275[_0xe0e1('0x2e')]===_0xe0e1('0x2f')&&typeof _0xbe275[_0xe0e1('0x30')]===_0xe0e1('0x2f');var _0x1faa20=_0x4af028[_0xe0e1('0x31')];var _0x542cfa=_0x478b73?0x0:_0xbe275[_0xe0e1('0x2e')];var _0x2b31be=_0x478b73?_0x4af028['count']:_0xbe275[_0xe0e1('0x2e')]+_0xbe275[_0xe0e1('0x30')];var _0x317768;if(_0x2b31be>=_0x1faa20){_0x2b31be=_0x1faa20;_0x317768=0xc8;}else{_0x317768=0xce;}_0x1a45b3[_0xe0e1('0x2d')](_0x317768);return _0x1a45b3[_0xe0e1('0x32')]('Content-Range',_0x542cfa+'-'+_0x2b31be+'/'+_0x1faa20)[_0xe0e1('0x33')](_0x4af028);}return null;};}function patchUpdates(_0x3fca9f){return function(_0x123f31){try{jsonpatch[_0xe0e1('0x34')](_0x123f31,_0x3fca9f,!![]);}catch(_0x1dba6a){return BPromise[_0xe0e1('0x35')](_0x1dba6a);}return _0x123f31[_0xe0e1('0x36')]();};}function saveUpdates(_0x4c0efe,_0x3bf7e9){return function(_0x30fe4e){if(_0x30fe4e){return _0x30fe4e['update'](_0x4c0efe)['then'](function(_0x6559fa){return _0x6559fa;});}return null;};}function removeEntity(_0x423bed,_0x34b76e){return function(_0x2f35d7){if(_0x2f35d7){return _0x2f35d7[_0xe0e1('0x37')]()[_0xe0e1('0x21')](function(){var _0x55c238=_0x2f35d7[_0xe0e1('0x38')]({'plain':!![]});var _0x46602a=_0xe0e1('0x39');return db[_0xe0e1('0x3a')][_0xe0e1('0x37')]({'where':{'type':_0x46602a,'resourceId':_0x55c238['id']}})['then'](function(){return _0x2f35d7;});})['then'](function(){_0x423bed['status'](0xcc)[_0xe0e1('0x3b')]();});}};}function handleEntityNotFound(_0x1d6b40,_0x32ae9c){return function(_0x5d6444){if(!_0x5d6444){_0x1d6b40[_0xe0e1('0x2c')](0x194);}return _0x5d6444;};}function handleError(_0x5bd6fd,_0x40d5a7){_0x40d5a7=_0x40d5a7||0x1f4;return function(_0x45d333){logger[_0xe0e1('0x28')](_0x45d333['stack']);if(_0x45d333['name']){delete _0x45d333[_0xe0e1('0x3c')];}_0x5bd6fd['status'](_0x40d5a7)[_0xe0e1('0x3d')](_0x45d333);};}exports['index']=function(_0x11540f,_0x30462d){var _0x4369f6={'include':[{'model':db['Pause'],'as':_0xe0e1('0x3e')}]},_0x10c7b3={},_0x37fd28={'count':0x0,'rows':[]};var _0x38cb61=_[_0xe0e1('0x3f')](db[_0xe0e1('0x40')][_0xe0e1('0x41')],function(_0x35799f){return{'name':_0x35799f[_0xe0e1('0x42')],'type':_0x35799f[_0xe0e1('0x43')][_0xe0e1('0x44')]};});_0x10c7b3['model']=_[_0xe0e1('0x3f')](_0x38cb61,_0xe0e1('0x3c'));_0x10c7b3[_0xe0e1('0x45')]=_['keys'](_0x11540f['query']);_0x10c7b3['filters']=_[_0xe0e1('0x46')](_0x10c7b3[_0xe0e1('0x47')],_0x10c7b3[_0xe0e1('0x45')]);_0x4369f6[_0xe0e1('0x48')]=_[_0xe0e1('0x46')](_0x10c7b3[_0xe0e1('0x47')],qs[_0xe0e1('0x49')](_0x11540f[_0xe0e1('0x45')][_0xe0e1('0x49')]));_0x4369f6[_0xe0e1('0x48')]=_0x4369f6[_0xe0e1('0x48')][_0xe0e1('0x4a')]?_0x4369f6[_0xe0e1('0x48')]:_0x10c7b3[_0xe0e1('0x47')];if(!_0x11540f[_0xe0e1('0x45')][_0xe0e1('0x4b')](_0xe0e1('0x4c'))){_0x4369f6[_0xe0e1('0x30')]=qs[_0xe0e1('0x30')](_0x11540f[_0xe0e1('0x45')][_0xe0e1('0x30')]);_0x4369f6[_0xe0e1('0x2e')]=qs[_0xe0e1('0x2e')](_0x11540f['query'][_0xe0e1('0x2e')]);}_0x4369f6[_0xe0e1('0x4d')]=qs[_0xe0e1('0x4e')](_0x11540f[_0xe0e1('0x45')]['sort']);_0x4369f6[_0xe0e1('0x4f')]=qs[_0xe0e1('0x50')](_[_0xe0e1('0x51')](_0x11540f[_0xe0e1('0x45')],_0x10c7b3[_0xe0e1('0x50')]),_0x38cb61);if(_0x11540f[_0xe0e1('0x45')][_0xe0e1('0x52')]){_0x4369f6[_0xe0e1('0x4f')]=_['merge'](_0x4369f6[_0xe0e1('0x4f')],{'$or':_[_0xe0e1('0x3f')](_0x38cb61,function(_0x4b3eb5){if(_0x4b3eb5[_0xe0e1('0x43')]!==_0xe0e1('0x53')){var _0x51d369={};_0x51d369[_0x4b3eb5[_0xe0e1('0x3c')]]={'$like':'%'+_0x11540f[_0xe0e1('0x45')][_0xe0e1('0x52')]+'%'};return _0x51d369;}})});}_0x4369f6=_['merge']({},_0x4369f6,_0x11540f['options']);var _0x5505f9={'where':_0x4369f6[_0xe0e1('0x4f')]};return db[_0xe0e1('0x40')][_0xe0e1('0x31')](_0x5505f9)[_0xe0e1('0x21')](function(_0x56775f){_0x37fd28[_0xe0e1('0x31')]=_0x56775f;if(_0x11540f[_0xe0e1('0x45')][_0xe0e1('0x54')]){_0x4369f6[_0xe0e1('0x55')]=[{'all':!![]}];}return db['FaxAccount']['findAll'](_0x4369f6);})[_0xe0e1('0x21')](function(_0x31984e){_0x37fd28[_0xe0e1('0x56')]=_0x31984e;return _0x37fd28;})[_0xe0e1('0x21')](respondWithFilteredResult(_0x30462d,_0x4369f6))[_0xe0e1('0x57')](handleError(_0x30462d,null));};exports[_0xe0e1('0x58')]=function(_0x7c4662,_0x585a40){var _0xa74292={'raw':![],'where':{'id':_0x7c4662[_0xe0e1('0x59')]['id']},'include':[{'model':db[_0xe0e1('0x5a')],'as':_0xe0e1('0x3e')}]},_0x421953={};_0x421953[_0xe0e1('0x47')]=_[_0xe0e1('0x5b')](db[_0xe0e1('0x40')][_0xe0e1('0x41')]);_0x421953['query']=_[_0xe0e1('0x5b')](_0x7c4662[_0xe0e1('0x45')]);_0x421953[_0xe0e1('0x50')]=_['intersection'](_0x421953[_0xe0e1('0x47')],_0x421953[_0xe0e1('0x45')]);_0xa74292['attributes']=_[_0xe0e1('0x46')](_0x421953['model'],qs['fields'](_0x7c4662['query'][_0xe0e1('0x49')]));_0xa74292[_0xe0e1('0x48')]=_0xa74292[_0xe0e1('0x48')][_0xe0e1('0x4a')]?_0xa74292[_0xe0e1('0x48')]:_0x421953['model'];if(_0x7c4662[_0xe0e1('0x45')][_0xe0e1('0x54')]){_0xa74292[_0xe0e1('0x55')]=[{'all':!![]}];}_0xa74292=_[_0xe0e1('0x5c')]({},_0xa74292,_0x7c4662['options']);return db[_0xe0e1('0x40')][_0xe0e1('0x5d')](_0xa74292)[_0xe0e1('0x21')](handleEntityNotFound(_0x585a40,null))[_0xe0e1('0x21')](respondWithResult(_0x585a40,null))[_0xe0e1('0x57')](handleError(_0x585a40,null));};exports[_0xe0e1('0x5e')]=function(_0x20038d,_0x595aba){return db[_0xe0e1('0x40')][_0xe0e1('0x5e')](_0x20038d['body'],{})[_0xe0e1('0x21')](function(_0x5cff1a){var _0x244872=_0x20038d[_0xe0e1('0x5f')][_0xe0e1('0x38')]({'plain':!![]});if(!_0x244872)throw new Error(_0xe0e1('0x60'));if(_0x244872[_0xe0e1('0x61')]===_0xe0e1('0x5f')){var _0x17975e=_0x5cff1a[_0xe0e1('0x38')]({'plain':!![]});var _0x20415e=_0xe0e1('0x39');return db[_0xe0e1('0x62')][_0xe0e1('0x5d')]({'where':{'name':_0x20415e,'userProfileId':_0x244872[_0xe0e1('0x63')]},'raw':!![]})[_0xe0e1('0x21')](function(_0x17ce79){if(_0x17ce79&&_0x17ce79[_0xe0e1('0x64')]===0x0){return db[_0xe0e1('0x3a')]['create']({'name':_0x17975e[_0xe0e1('0x3c')],'resourceId':_0x17975e['id'],'type':_0x17ce79[_0xe0e1('0x3c')],'sectionId':_0x17ce79['id']},{})[_0xe0e1('0x21')](function(){return _0x5cff1a;});}else{return _0x5cff1a;}})[_0xe0e1('0x57')](function(_0x4244d9){logger[_0xe0e1('0x28')](_0xe0e1('0x65'),_0x4244d9);throw _0x4244d9;});}return _0x5cff1a;})[_0xe0e1('0x21')](respondWithResult(_0x595aba,0xc9))[_0xe0e1('0x57')](handleError(_0x595aba,null));};exports['update']=function(_0x38e884,_0x3cc773){if(_0x38e884['body']['id']){delete _0x38e884[_0xe0e1('0x66')]['id'];}return db[_0xe0e1('0x40')][_0xe0e1('0x5d')]({'where':{'id':_0x38e884['params']['id']},'include':[{'model':db[_0xe0e1('0x5a')],'as':'mandatoryDispositionPause'}]})[_0xe0e1('0x21')](handleEntityNotFound(_0x3cc773,null))['then'](saveUpdates(_0x38e884['body'],null))[_0xe0e1('0x21')](respondWithResult(_0x3cc773,null))[_0xe0e1('0x57')](handleError(_0x3cc773,null));};exports['destroy']=function(_0x4be2d6,_0x2c6770){return db['FaxAccount'][_0xe0e1('0x5d')]({'where':{'id':_0x4be2d6[_0xe0e1('0x59')]['id']}})[_0xe0e1('0x21')](handleEntityNotFound(_0x2c6770,null))[_0xe0e1('0x21')](removeEntity(_0x2c6770,null))[_0xe0e1('0x57')](handleError(_0x2c6770,null));};exports[_0xe0e1('0x67')]=function(_0x268353,_0x38db01){return db[_0xe0e1('0x40')][_0xe0e1('0x67')]()[_0xe0e1('0x21')](respondWithResult(_0x38db01,null))[_0xe0e1('0x57')](handleError(_0x38db01,null));};exports[_0xe0e1('0x68')]=function(_0x1a881e,_0x6d88a7,_0x583070){if(_0x1a881e[_0xe0e1('0x66')]['id']){delete _0x1a881e[_0xe0e1('0x66')]['id'];}return db[_0xe0e1('0x40')]['find']({'where':{'id':_0x1a881e[_0xe0e1('0x59')]['id']}})[_0xe0e1('0x21')](handleEntityNotFound(_0x6d88a7,null))[_0xe0e1('0x21')](function(_0x18fa67){if(_0x18fa67){_0x1a881e[_0xe0e1('0x66')]['FaxAccountId']=_0x18fa67['id'];return db['Disposition'][_0xe0e1('0x5e')](_0x1a881e[_0xe0e1('0x66')]);}})[_0xe0e1('0x21')](respondWithResult(_0x6d88a7,null))[_0xe0e1('0x57')](handleError(_0x6d88a7,null));};exports[_0xe0e1('0x69')]=function(_0x62454c,_0x338d81,_0x3f23a4){var _0x35bd87={'raw':![],'where':{}};var _0x55d45d={};var _0xb87fb2={'count':0x0,'rows':[]};return db[_0xe0e1('0x40')][_0xe0e1('0x6a')]({'where':{'id':_0x62454c[_0xe0e1('0x59')]['id']}})['then'](handleEntityNotFound(_0x338d81,null))[_0xe0e1('0x21')](function(_0x4033d5){if(_0x4033d5){_0x55d45d[_0xe0e1('0x47')]=_[_0xe0e1('0x5b')](db['Disposition'][_0xe0e1('0x41')]);_0x55d45d[_0xe0e1('0x45')]=_['keys'](_0x62454c['query']);_0x55d45d[_0xe0e1('0x50')]=_[_0xe0e1('0x46')](_0x55d45d[_0xe0e1('0x47')],_0x55d45d[_0xe0e1('0x45')]);_0x35bd87['attributes']=_[_0xe0e1('0x46')](_0x55d45d[_0xe0e1('0x47')],qs[_0xe0e1('0x49')](_0x62454c[_0xe0e1('0x45')][_0xe0e1('0x49')]));_0x35bd87['attributes']=_0x35bd87[_0xe0e1('0x48')][_0xe0e1('0x4a')]?_0x35bd87[_0xe0e1('0x48')]:_0x55d45d['model'];if(!_0x62454c['query'][_0xe0e1('0x4b')](_0xe0e1('0x4c'))){_0x35bd87[_0xe0e1('0x30')]=qs[_0xe0e1('0x30')](_0x62454c[_0xe0e1('0x45')][_0xe0e1('0x30')]);_0x35bd87[_0xe0e1('0x2e')]=qs[_0xe0e1('0x2e')](_0x62454c[_0xe0e1('0x45')][_0xe0e1('0x2e')]);}_0x35bd87[_0xe0e1('0x4d')]=qs[_0xe0e1('0x4e')](_0x62454c['query'][_0xe0e1('0x4e')]);_0x35bd87[_0xe0e1('0x4f')]=qs[_0xe0e1('0x50')](_[_0xe0e1('0x51')](_0x62454c['query'],_0x55d45d['filters']));_0x35bd87[_0xe0e1('0x4f')][_0xe0e1('0x6b')]=_0x4033d5['id'];if(_0x62454c[_0xe0e1('0x45')][_0xe0e1('0x52')]){_0x35bd87['where']=_[_0xe0e1('0x5c')](_0x35bd87[_0xe0e1('0x4f')],{'$or':_[_0xe0e1('0x3f')](_0x35bd87[_0xe0e1('0x48')],function(_0x431073){var _0x1ed547={};_0x1ed547[_0x431073]={'$like':'%'+_0x62454c[_0xe0e1('0x45')][_0xe0e1('0x52')]+'%'};return _0x1ed547;})});}_0x35bd87=_[_0xe0e1('0x5c')]({},_0x35bd87,_0x62454c['options']);return db[_0xe0e1('0x6c')][_0xe0e1('0x31')]({'where':_0x35bd87[_0xe0e1('0x4f')]})['then'](function(_0x4c54f7){_0xb87fb2['count']=_0x4c54f7;if(_0x62454c[_0xe0e1('0x45')][_0xe0e1('0x54')]){_0x35bd87['include']=[{'all':!![]}];}return db['Disposition'][_0xe0e1('0x6d')](_0x35bd87);})['then'](function(_0x2772a9){_0xb87fb2[_0xe0e1('0x56')]=_0x2772a9;return _0xb87fb2;});}})['then'](respondWithFilteredResult(_0x338d81,_0x35bd87))[_0xe0e1('0x57')](handleError(_0x338d81,null));};exports['removeDispositions']=function(_0x2098d3,_0x7c180d,_0x6f7773){return db[_0xe0e1('0x40')][_0xe0e1('0x5d')]({'where':{'id':_0x2098d3[_0xe0e1('0x59')]['id']}})[_0xe0e1('0x21')](handleEntityNotFound(_0x7c180d,null))[_0xe0e1('0x21')](function(_0x1b8faa){if(_0x1b8faa){return _0x1b8faa['removeDispositions'](_0x2098d3[_0xe0e1('0x45')][_0xe0e1('0x6e')]);}})[_0xe0e1('0x21')](respondWithStatusCode(_0x7c180d,null))[_0xe0e1('0x57')](handleError(_0x7c180d,null));};exports['addAnswer']=function(_0x47abda,_0x501abc,_0x508dab){if(_0x47abda[_0xe0e1('0x66')]['id']){delete _0x47abda['body']['id'];}return db[_0xe0e1('0x40')][_0xe0e1('0x5d')]({'where':{'id':_0x47abda[_0xe0e1('0x59')]['id']}})[_0xe0e1('0x21')](handleEntityNotFound(_0x501abc,null))[_0xe0e1('0x21')](function(_0x1efb8b){if(_0x1efb8b){_0x47abda[_0xe0e1('0x66')][_0xe0e1('0x6b')]=_0x1efb8b['id'];return db[_0xe0e1('0x6f')][_0xe0e1('0x5e')](_0x47abda[_0xe0e1('0x66')]);}})[_0xe0e1('0x21')](respondWithResult(_0x501abc,null))[_0xe0e1('0x57')](handleError(_0x501abc,null));};exports['getAnswers']=function(_0x30aa76,_0x4c0ac6,_0x8e4b05){var _0x15e3d0={'raw':![],'where':{}};var _0x2d6df4={};var _0x30ea77={'count':0x0,'rows':[]};return db[_0xe0e1('0x40')][_0xe0e1('0x6a')]({'where':{'id':_0x30aa76[_0xe0e1('0x59')]['id']}})[_0xe0e1('0x21')](handleEntityNotFound(_0x4c0ac6,null))[_0xe0e1('0x21')](function(_0x27a2a7){if(_0x27a2a7){_0x2d6df4[_0xe0e1('0x47')]=_['keys'](db[_0xe0e1('0x6f')]['rawAttributes']);_0x2d6df4[_0xe0e1('0x45')]=_[_0xe0e1('0x5b')](_0x30aa76[_0xe0e1('0x45')]);_0x2d6df4[_0xe0e1('0x50')]=_[_0xe0e1('0x46')](_0x2d6df4['model'],_0x2d6df4['query']);_0x15e3d0[_0xe0e1('0x48')]=_[_0xe0e1('0x46')](_0x2d6df4[_0xe0e1('0x47')],qs['fields'](_0x30aa76[_0xe0e1('0x45')][_0xe0e1('0x49')]));_0x15e3d0[_0xe0e1('0x48')]=_0x15e3d0[_0xe0e1('0x48')]['length']?_0x15e3d0[_0xe0e1('0x48')]:_0x2d6df4[_0xe0e1('0x47')];if(!_0x30aa76['query']['hasOwnProperty'](_0xe0e1('0x4c'))){_0x15e3d0[_0xe0e1('0x30')]=qs[_0xe0e1('0x30')](_0x30aa76[_0xe0e1('0x45')][_0xe0e1('0x30')]);_0x15e3d0[_0xe0e1('0x2e')]=qs['offset'](_0x30aa76['query'][_0xe0e1('0x2e')]);}_0x15e3d0[_0xe0e1('0x4d')]=qs[_0xe0e1('0x4e')](_0x30aa76[_0xe0e1('0x45')][_0xe0e1('0x4e')]);_0x15e3d0[_0xe0e1('0x4f')]=qs[_0xe0e1('0x50')](_[_0xe0e1('0x51')](_0x30aa76[_0xe0e1('0x45')],_0x2d6df4[_0xe0e1('0x50')]));_0x15e3d0[_0xe0e1('0x4f')]['FaxAccountId']=_0x27a2a7['id'];if(_0x30aa76['query']['filter']){_0x15e3d0[_0xe0e1('0x4f')]=_[_0xe0e1('0x5c')](_0x15e3d0[_0xe0e1('0x4f')],{'$or':_['map'](_0x15e3d0['attributes'],function(_0x2f77a8){var _0x3977e9={};_0x3977e9[_0x2f77a8]={'$like':'%'+_0x30aa76[_0xe0e1('0x45')][_0xe0e1('0x52')]+'%'};return _0x3977e9;})});}_0x15e3d0=_[_0xe0e1('0x5c')]({},_0x15e3d0,_0x30aa76[_0xe0e1('0x70')]);return db[_0xe0e1('0x6f')][_0xe0e1('0x31')]({'where':_0x15e3d0['where']})['then'](function(_0x294c57){_0x30ea77[_0xe0e1('0x31')]=_0x294c57;if(_0x30aa76['query'][_0xe0e1('0x54')]){_0x15e3d0['include']=[{'all':!![]}];}return db[_0xe0e1('0x6f')][_0xe0e1('0x6d')](_0x15e3d0);})[_0xe0e1('0x21')](function(_0x35d94f){_0x30ea77[_0xe0e1('0x56')]=_0x35d94f;return _0x30ea77;});}})[_0xe0e1('0x21')](respondWithFilteredResult(_0x4c0ac6,_0x15e3d0))[_0xe0e1('0x57')](handleError(_0x4c0ac6,null));};exports[_0xe0e1('0x71')]=function(_0xb901f,_0x43ac35,_0xce586f){return db[_0xe0e1('0x40')][_0xe0e1('0x5d')]({'where':{'id':_0xb901f[_0xe0e1('0x59')]['id']}})[_0xe0e1('0x21')](handleEntityNotFound(_0x43ac35,null))['then'](function(_0x11bc85){if(_0x11bc85){return _0x11bc85[_0xe0e1('0x71')](_0xb901f['query'][_0xe0e1('0x6e')]);}})[_0xe0e1('0x21')](respondWithStatusCode(_0x43ac35,null))[_0xe0e1('0x57')](handleError(_0x43ac35,null));};exports[_0xe0e1('0x72')]=function(_0x49d3e5,_0x428703,_0x26fec1){return db[_0xe0e1('0x73')]['find']({'where':{'id':_0x49d3e5[_0xe0e1('0x59')]['id']}})[_0xe0e1('0x21')](handleEntityNotFound(_0x428703,null))[_0xe0e1('0x21')](function(_0x30e5eb){if(_0x30e5eb){return _0x30e5eb[_0xe0e1('0x72')](_0x49d3e5[_0xe0e1('0x66')]['ids'],_[_0xe0e1('0x74')](_0x49d3e5[_0xe0e1('0x66')],[_0xe0e1('0x6e'),'id'])||{});}})[_0xe0e1('0x21')](respondWithResult(_0x428703,null))[_0xe0e1('0x57')](handleError(_0x428703,null));};exports[_0xe0e1('0x75')]=function(_0xde9bbe,_0x2390c2,_0x8dc15d){var _0x39b9c4={'raw':![],'where':{}};var _0x39ad34={};var _0x1dc139={'count':0x0,'rows':[]};return db[_0xe0e1('0x40')][_0xe0e1('0x6a')]({'where':{'id':_0xde9bbe[_0xe0e1('0x59')]['id']}})['then'](handleEntityNotFound(_0x2390c2,null))[_0xe0e1('0x21')](function(_0x977ca0){if(_0x977ca0){_0x39ad34['model']=_[_0xe0e1('0x5b')](db[_0xe0e1('0x73')][_0xe0e1('0x41')]);_0x39ad34[_0xe0e1('0x45')]=_[_0xe0e1('0x5b')](_0xde9bbe[_0xe0e1('0x45')]);_0x39ad34[_0xe0e1('0x50')]=_['intersection'](_0x39ad34['model'],_0x39ad34[_0xe0e1('0x45')]);_0x39b9c4['attributes']=_[_0xe0e1('0x46')](_0x39ad34['model'],qs[_0xe0e1('0x49')](_0xde9bbe[_0xe0e1('0x45')][_0xe0e1('0x49')]));_0x39b9c4[_0xe0e1('0x48')]=_0x39b9c4[_0xe0e1('0x48')]['length']?_0x39b9c4[_0xe0e1('0x48')]:_0x39ad34['model'];if(!_0xde9bbe['query']['hasOwnProperty'](_0xe0e1('0x4c'))){_0x39b9c4[_0xe0e1('0x30')]=qs[_0xe0e1('0x30')](_0xde9bbe['query']['limit']);_0x39b9c4[_0xe0e1('0x2e')]=qs[_0xe0e1('0x2e')](_0xde9bbe[_0xe0e1('0x45')][_0xe0e1('0x2e')]);}_0x39b9c4['order']=qs[_0xe0e1('0x4e')](_0xde9bbe[_0xe0e1('0x45')]['sort']);_0x39b9c4[_0xe0e1('0x4f')]=qs[_0xe0e1('0x50')](_[_0xe0e1('0x51')](_0xde9bbe[_0xe0e1('0x45')],_0x39ad34[_0xe0e1('0x50')]));_0x39b9c4[_0xe0e1('0x4f')][_0xe0e1('0x6b')]=_0x977ca0['id'];if(_0xde9bbe[_0xe0e1('0x45')][_0xe0e1('0x52')]){_0x39b9c4[_0xe0e1('0x4f')]=_[_0xe0e1('0x5c')](_0x39b9c4[_0xe0e1('0x4f')],{'$or':_['map'](_0x39b9c4[_0xe0e1('0x48')],function(_0x2f1435){var _0x9375ce={};_0x9375ce[_0x2f1435]={'$like':'%'+_0xde9bbe[_0xe0e1('0x45')][_0xe0e1('0x52')]+'%'};return _0x9375ce;})});}_0x39b9c4=_[_0xe0e1('0x5c')]({},_0x39b9c4,_0xde9bbe[_0xe0e1('0x70')]);return db[_0xe0e1('0x73')][_0xe0e1('0x31')]({'where':_0x39b9c4[_0xe0e1('0x4f')]})[_0xe0e1('0x21')](function(_0x5ac8c7){_0x1dc139[_0xe0e1('0x31')]=_0x5ac8c7;if(_0xde9bbe[_0xe0e1('0x45')]['includeAll']){_0x39b9c4[_0xe0e1('0x55')]=[{'model':db[_0xe0e1('0x76')],'as':_0xe0e1('0x77'),'required':![]},{'model':db[_0xe0e1('0x78')],'as':_0xe0e1('0x79'),'attributes':[_0xe0e1('0x3c'),_0xe0e1('0x7a'),_0xe0e1('0x7b')],'required':![]},{'model':db['Tag'],'as':_0xe0e1('0x7c'),'attributes':['id',_0xe0e1('0x3c'),_0xe0e1('0x7d')],'where':_0xde9bbe['query'][_0xe0e1('0x7e')]?{'id':_0xde9bbe['query']['tag']}:undefined,'required':_0xde9bbe[_0xe0e1('0x45')][_0xe0e1('0x7e')]?!![]:![]}];}return db['FaxInteraction'][_0xe0e1('0x6d')](_0x39b9c4);})['then'](function(_0x10da8e){_0x1dc139['rows']=_0x10da8e;return _0x1dc139;});}})[_0xe0e1('0x21')](respondWithFilteredResult(_0x2390c2,_0x39b9c4))['catch'](handleError(_0x2390c2,null));};exports[_0xe0e1('0x7f')]=function(_0x494ba0,_0x1c9338){var _0x50391a=_0x494ba0['params']['id'];var _0x4155f4=_0x494ba0[_0xe0e1('0x66')];var _0x358d1b=0xc8;var _0x2809c6=null;return db[_0xe0e1('0x80')][_0xe0e1('0x81')]({'isolationLevel':db[_0xe0e1('0x80')][_0xe0e1('0x82')]['ISOLATION_LEVELS'][_0xe0e1('0x83')]},function(_0x4ae8a8){return db[_0xe0e1('0x40')]['findOne']({'where':{'id':_0x50391a},'transaction':_0x4ae8a8})[_0xe0e1('0x21')](function(_0x8fb03){if(_0x8fb03){return db['FaxApplication'][_0xe0e1('0x37')]({'where':{'FaxAccountId':_0x50391a},'transaction':_0x4ae8a8})[_0xe0e1('0x21')](function(){var _0x4044fc=_[_0xe0e1('0x3f')](_0x4155f4,function(_0x1f6b32){_0x1f6b32[_0xe0e1('0x6b')]=_0x50391a;return _0x1f6b32;});return db['FaxApplication']['bulkCreate'](_0x4044fc,{'transaction':_0x4ae8a8});});}else{_0x358d1b=0x194;_0x2809c6=[];}});})[_0xe0e1('0x21')](function(){if(_0x358d1b!==0x194){return db[_0xe0e1('0x84')][_0xe0e1('0x85')]({'where':{'FaxAccountId':_0x50391a},'order':'priority'})[_0xe0e1('0x21')](function(_0x53a206){_0x2809c6=_0x53a206;});}})[_0xe0e1('0x57')](function(_0x53d9f7){_0x358d1b=0x1f4;logger[_0xe0e1('0x28')](_0x53d9f7[_0xe0e1('0x86')]);if(_0x53d9f7[_0xe0e1('0x3c')]){delete _0x53d9f7[_0xe0e1('0x3c')];}_0x2809c6=_0x53d9f7;})[_0xe0e1('0x87')](function(){if(_0x2809c6===null){_0x1c9338[_0xe0e1('0x2c')](_0x358d1b);}else{if(_0x358d1b===0x1f4){_0x1c9338[_0xe0e1('0x2d')](_0x358d1b)['send'](_0x2809c6);}else{_0x1c9338[_0xe0e1('0x2d')](_0x358d1b)[_0xe0e1('0x33')](_0x2809c6);}}});};exports[_0xe0e1('0x88')]=function(_0x4fa5ba,_0x3a510f,_0x47e56a){var _0x150b43={};var _0x51f7f0={};var _0x4ac1e8;var _0x3882f9;return db[_0xe0e1('0x40')]['findOne']({'where':{'id':_0x4fa5ba[_0xe0e1('0x59')]['id']}})[_0xe0e1('0x21')](handleEntityNotFound(_0x3a510f,null))[_0xe0e1('0x21')](function(_0x3008e5){if(_0x3008e5){_0x4ac1e8=_0x3008e5;_0x51f7f0[_0xe0e1('0x47')]=_[_0xe0e1('0x5b')](db['FaxApplication']['rawAttributes']);_0x51f7f0[_0xe0e1('0x45')]=_[_0xe0e1('0x5b')](_0x4fa5ba[_0xe0e1('0x45')]);_0x51f7f0[_0xe0e1('0x50')]=_[_0xe0e1('0x46')](_0x51f7f0[_0xe0e1('0x47')],_0x51f7f0['query']);_0x150b43[_0xe0e1('0x48')]=_[_0xe0e1('0x46')](_0x51f7f0[_0xe0e1('0x47')],qs['fields'](_0x4fa5ba[_0xe0e1('0x45')][_0xe0e1('0x49')]));_0x150b43['attributes']=_0x150b43[_0xe0e1('0x48')][_0xe0e1('0x4a')]?_0x150b43[_0xe0e1('0x48')]:_0x51f7f0['model'];_0x150b43['order']=qs['sort'](_0x4fa5ba[_0xe0e1('0x45')][_0xe0e1('0x4e')]);_0x150b43[_0xe0e1('0x4f')]=qs[_0xe0e1('0x50')](_[_0xe0e1('0x51')](_0x4fa5ba[_0xe0e1('0x45')],_0x51f7f0[_0xe0e1('0x50')]));if(_0x4fa5ba[_0xe0e1('0x45')][_0xe0e1('0x52')]){_0x150b43[_0xe0e1('0x4f')]=_[_0xe0e1('0x5c')](_0x150b43[_0xe0e1('0x4f')],{'$or':_['map'](_0x150b43[_0xe0e1('0x48')],function(_0x22db59){var _0x41e693={};_0x41e693[_0x22db59]={'$like':'%'+_0x4fa5ba[_0xe0e1('0x45')][_0xe0e1('0x52')]+'%'};return _0x41e693;})});}_0x150b43=_[_0xe0e1('0x5c')]({},_0x150b43,_0x4fa5ba[_0xe0e1('0x70')]);return _0x4ac1e8[_0xe0e1('0x88')](_0x150b43);}})[_0xe0e1('0x21')](function(_0x10ab5e){if(_0x10ab5e){_0x3882f9=_0x10ab5e[_0xe0e1('0x4a')];if(!_0x4fa5ba[_0xe0e1('0x45')][_0xe0e1('0x4b')](_0xe0e1('0x4c'))){_0x150b43[_0xe0e1('0x30')]=qs[_0xe0e1('0x30')](_0x4fa5ba[_0xe0e1('0x45')][_0xe0e1('0x30')]);_0x150b43[_0xe0e1('0x2e')]=qs[_0xe0e1('0x2e')](_0x4fa5ba[_0xe0e1('0x45')][_0xe0e1('0x2e')]);}return _0x4ac1e8[_0xe0e1('0x88')](_0x150b43);}})[_0xe0e1('0x21')](function(_0x58c709){if(_0x58c709){return _0x58c709?{'count':_0x3882f9,'rows':_0x58c709}:null;}})[_0xe0e1('0x21')](respondWithResult(_0x3a510f,null))[_0xe0e1('0x57')](handleError(_0x3a510f,null));};function Extension(_0x1d8667,_0x255878,_0x2a0099,_0x262934){this[_0xe0e1('0x89')]=_0xe0e1('0x8a');this[_0xe0e1('0x8b')]=_0x1d8667[_0xe0e1('0x8c')];this[_0xe0e1('0x8d')]=_0x262934;this[_0xe0e1('0x43')]='system';this[_0xe0e1('0x8e')]=_0xe0e1('0x8f');this[_0xe0e1('0x6b')]=_0x1d8667['id'];this[_0xe0e1('0x90')]=_0x255878;this[_0xe0e1('0x91')]=_0x2a0099;}function createExtensionsReciveFax(_0x42ceb8){var _0x5b0607=0x1;var _0x1113f6=[];_0x1113f6[_0xe0e1('0x92')](new Extension(_0x42ceb8,_0x5b0607,'',_0xe0e1('0x93')));_0x5b0607+=0x1;_0x1113f6[_0xe0e1('0x92')](new Extension(_0x42ceb8,_0x5b0607,'CDR(type)=inbound-fax',_0xe0e1('0x94')));_0x5b0607+=0x1;for(var _0x42b963 in _0x42ceb8){if(_0x42ceb8['hasOwnProperty'](_0x42b963)&&(_0x42b963===_0xe0e1('0x95')||_0x42b963===_0xe0e1('0x8c')||_0x42b963==='gateway'||_0x42b963===_0xe0e1('0x96')||_0x42b963==='headerinfo'||_0x42b963===_0xe0e1('0x97')||_0x42b963===_0xe0e1('0x98')||_0x42b963===_0xe0e1('0x99')||_0x42b963===_0xe0e1('0x9a'))){_0x1113f6[_0xe0e1('0x92')](new Extension(_0x42ceb8,_0x5b0607,'FAXOPT('+_0x42b963+')='+_0x42ceb8[_0x42b963],_0xe0e1('0x94')));_0x5b0607+=0x1;}}_0x1113f6['push'](new Extension(_0x42ceb8,_0x5b0607,'6',_0xe0e1('0x9b')));_0x5b0607+=0x1;_0x1113f6[_0xe0e1('0x92')](new Extension(_0x42ceb8,_0x5b0607,_0xe0e1('0x9c'),_0xe0e1('0x9d')));_0x5b0607=0x0;return _0x1113f6;}exports[_0xe0e1('0x9e')]=function(_0x4177e6,_0x1c6b40,_0x43db3e){var _0x5e4054;return db['sequelize'][_0xe0e1('0x81')](function(_0x1c13bc){return db[_0xe0e1('0x40')][_0xe0e1('0x5e')](_0x4177e6['body'],{'transaction':_0x1c13bc})[_0xe0e1('0x21')](function(_0x50de81){_0x5e4054=_0x50de81[_0xe0e1('0x38')]({'plain':!![]});return db[_0xe0e1('0x9f')][_0xe0e1('0xa0')](createExtensionsReciveFax(_0x5e4054),{'transaction':_0x1c13bc});});})['then'](function(){return _0x5e4054;})[_0xe0e1('0x21')](respondWithResult(_0x1c6b40,null))[_0xe0e1('0x57')](handleError(_0x1c6b40,null));};exports[_0xe0e1('0xa1')]=function(_0x2dc7df,_0x15acbf,_0x3968d7){var _0x1da08d;return db[_0xe0e1('0x80')]['transaction'](function(_0x17e5a2){return db[_0xe0e1('0x40')][_0xe0e1('0xa2')](_0x2dc7df[_0xe0e1('0x66')],{'where':{'id':_0x2dc7df[_0xe0e1('0x66')]['id']},'transaction':_0x17e5a2})[_0xe0e1('0x21')](function(_0xc90737){return db[_0xe0e1('0x9f')][_0xe0e1('0x37')]({'where':{'FaxAccountId':_0x2dc7df[_0xe0e1('0x66')]['id']},'transaction':_0x17e5a2})[_0xe0e1('0x21')](function(_0x522af0){return db['VoiceExtension']['bulkCreate'](createExtensionsReciveFax(_['omit'](_0x2dc7df['body'],[_0xe0e1('0xa3'),_0xe0e1('0x44'),'createdAt','updatedAt',_0xe0e1('0xa4'),_0xe0e1('0xa5')])),{'transaction':_0x17e5a2});});});})[_0xe0e1('0x21')](function(){return db[_0xe0e1('0x40')]['findById'](_0x2dc7df[_0xe0e1('0x66')]['id']);})['then'](respondWithResult(_0x15acbf,null))[_0xe0e1('0x57')](handleError(_0x15acbf,null));};exports['getMessages']=function(_0x23326d,_0x13ce31,_0x246ce6){var _0xcf890b={'raw':!![],'where':{}};var _0x3fb36b={};var _0x45cc06={'count':0x0,'rows':[]};return db[_0xe0e1('0x40')]['findOne']({'where':{'id':_0x23326d['params']['id']}})[_0xe0e1('0x21')](handleEntityNotFound(_0x13ce31,null))[_0xe0e1('0x21')](function(_0x204045){if(_0x204045){_0x3fb36b['model']=_['keys'](db[_0xe0e1('0xa6')]['rawAttributes']);_0x3fb36b['query']=_[_0xe0e1('0x5b')](_0x23326d['query']);_0x3fb36b[_0xe0e1('0x50')]=_[_0xe0e1('0x46')](_0x3fb36b[_0xe0e1('0x47')],_0x3fb36b[_0xe0e1('0x45')]);_0xcf890b['attributes']=_['intersection'](_0x3fb36b['model'],qs['fields'](_0x23326d[_0xe0e1('0x45')][_0xe0e1('0x49')]));_0xcf890b[_0xe0e1('0x48')]=_0xcf890b['attributes'][_0xe0e1('0x4a')]?_0xcf890b[_0xe0e1('0x48')]:_0x3fb36b[_0xe0e1('0x47')];if(!_0x23326d['query'][_0xe0e1('0x4b')]('nolimit')){_0xcf890b[_0xe0e1('0x30')]=qs['limit'](_0x23326d['query']['limit']);_0xcf890b['offset']=qs['offset'](_0x23326d[_0xe0e1('0x45')][_0xe0e1('0x2e')]);}_0xcf890b['order']=qs['sort'](_0x23326d['query'][_0xe0e1('0x4e')]);_0xcf890b[_0xe0e1('0x4f')]=qs[_0xe0e1('0x50')](_['pick'](_0x23326d[_0xe0e1('0x45')],_0x3fb36b[_0xe0e1('0x50')]));_0xcf890b[_0xe0e1('0x4f')]['FaxAccountId']=_0x204045['id'];if(_0x23326d[_0xe0e1('0x45')][_0xe0e1('0x52')]){_0xcf890b[_0xe0e1('0x4f')]=_[_0xe0e1('0x5c')](_0xcf890b['where'],{'$or':_[_0xe0e1('0x3f')](_0xcf890b['attributes'],function(_0x22c204){var _0x2045e0={};_0x2045e0[_0x22c204]={'$like':'%'+_0x23326d[_0xe0e1('0x45')][_0xe0e1('0x52')]+'%'};return _0x2045e0;})});}if(_0x23326d[_0xe0e1('0x45')][_0xe0e1('0xa7')]){var _0x3f8e96=_0x23326d[_0xe0e1('0x45')][_0xe0e1('0xa7')][_0xe0e1('0xa8')](',');var _0x4edde8={};_0x4edde8[_0x3f8e96[0x0]]={'$gte':moment(_0x3f8e96[0x1])[_0xe0e1('0xa9')](_0xe0e1('0xaa'))};_0xcf890b[_0xe0e1('0x4f')]=_[_0xe0e1('0x5c')](_0xcf890b[_0xe0e1('0x4f')],_0x4edde8);}_0xcf890b=_[_0xe0e1('0x5c')]({},_0xcf890b,_0x23326d['options']);return db[_0xe0e1('0xa6')][_0xe0e1('0x31')]({'where':_0xcf890b[_0xe0e1('0x4f')]})[_0xe0e1('0x21')](function(_0x307dcf){_0x45cc06[_0xe0e1('0x31')]=_0x307dcf;if(_0x23326d[_0xe0e1('0x45')][_0xe0e1('0x54')]){_0xcf890b[_0xe0e1('0x55')]=[{'all':!![]}];}return db['FaxMessage'][_0xe0e1('0x6d')](_0xcf890b);})[_0xe0e1('0x21')](function(_0xc6ea5d){_0x45cc06[_0xe0e1('0x56')]=_0xc6ea5d;return _0x45cc06;});}})[_0xe0e1('0x21')](respondWithFilteredResult(_0x13ce31,_0xcf890b))[_0xe0e1('0x57')](handleError(_0x13ce31,null));};exports[_0xe0e1('0x3d')]=function(_0x196034,_0x1875e6,_0x40e275){var _0x1bce9e,_0x2334cf={},_0x2a67f7;if(_0x196034['body']['to']){_0x2a67f7=_0x196034['body']['to'][0x0];}return db[_0xe0e1('0x40')][_0xe0e1('0x5d')]({'where':{'id':_0x196034['params']['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xe0e1('0x76')],'as':_0xe0e1('0xab'),'where':{'fax':_0x2a67f7},'limit':0x1,'order':[[_0xe0e1('0xac'),_0xe0e1('0xad')]]}]}]})[_0xe0e1('0x21')](handleEntityNotFound(_0x1875e6,null))['then'](function(_0x3371bb){_0x1bce9e=_0x3371bb;if(_0x196034['body'][_0xe0e1('0xae')]&&_0x196034[_0xe0e1('0x66')][_0xe0e1('0xae')][_0xe0e1('0x4a')]){for(var _0x2cbbd5=0x0;_0x2cbbd5<_0x196034[_0xe0e1('0x66')]['attachments'][_0xe0e1('0x4a')];_0x2cbbd5+=0x1){_0x196034[_0xe0e1('0x66')][_0xe0e1('0xae')][_0x2cbbd5]={'filename':_0x196034[_0xe0e1('0x66')][_0xe0e1('0xae')][_0x2cbbd5][_0xe0e1('0x3c')],'id':_0x196034[_0xe0e1('0x66')][_0xe0e1('0xae')][_0x2cbbd5]['id'],'path':path[_0xe0e1('0xaf')](config[_0xe0e1('0xb0')],_0xe0e1('0xb1'),_0x196034[_0xe0e1('0x66')]['attachments'][_0x2cbbd5][_0xe0e1('0xb2')])};}}return respondWithRpcPromise(_0xe0e1('0xb3'),'CheckAfterSend',{'FaxAccountId':_[_0xe0e1('0xb4')](_0x196034[_0xe0e1('0x59')]['id'])?undefined:_0x196034[_0xe0e1('0x59')]['id'],'path':_[_0xe0e1('0xb4')](_0x196034[_0xe0e1('0x66')][_0xe0e1('0xae')][0x0][_0xe0e1('0xb5')])?undefined:_0x196034['body']['attachments'][0x0][_0xe0e1('0xb5')],'fax':_[_0xe0e1('0xb4')](_0x196034[_0xe0e1('0x66')]['to'][0x0])?undefined:_0x196034[_0xe0e1('0x66')]['to'][0x0]},client9002);})[_0xe0e1('0x21')](function(){if(_0x1bce9e){if(_[_0xe0e1('0xb4')](_0x196034[_0xe0e1('0x66')][_0xe0e1('0xb6')])){_0x196034[_0xe0e1('0x66')][_0xe0e1('0xb6')]=util[_0xe0e1('0xa9')](_0xe0e1('0xb7'),_0x1bce9e['name'],_0x1bce9e[_0xe0e1('0xb8')]);}if(_0x1bce9e['List']){if(_0x1bce9e[_0xe0e1('0xb9')][_0xe0e1('0xab')][_0xe0e1('0x4a')]){return _0x1bce9e[_0xe0e1('0xb9')]['Contacts'][0x0];}else{return db['CmContact']['create'](_[_0xe0e1('0x1a')](_0x196034['body'],{'firstName':_0x196034[_0xe0e1('0x66')]['to'][0x0],'phone':_0x196034[_0xe0e1('0x66')]['to'][0x0],'fax':_0x196034[_0xe0e1('0x66')]['to'][0x0],'ListId':_0x1bce9e[_0xe0e1('0xa5')]}));}}else{throw new Error(_0xe0e1('0xba'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0xe0e1('0x21')](function(_0x41dd29){if(_0x41dd29){return db[_0xe0e1('0x73')][_0xe0e1('0x5d')]({'where':{'ContactId':_0x41dd29['id'],'closed':![],'FaxAccountId':_0x1bce9e['id']}})[_0xe0e1('0x21')](function(_0x54edb3){if(_0x54edb3){return[_0x54edb3,![]];}return db[_0xe0e1('0x73')][_0xe0e1('0x5e')]({'UserId':_0x196034['user']['id'],'ContactId':_0x41dd29['id'],'FaxAccountId':_0x1bce9e['id'],'fax':_0x196034[_0xe0e1('0x66')]['to'][0x0],'firstMsgDirection':_0xe0e1('0xbb'),'Messages':[_[_0xe0e1('0x5c')](_0x196034[_0xe0e1('0x66')],{'read':![],'body':_0x196034[_0xe0e1('0x66')]['attachments'][0x0]['filename'],'FaxAccountId':_0x1bce9e['id'],'UserId':_0x196034['user']['id'],'ContactId':_0x41dd29['id'],'AttachmentId':_0x196034[_0xe0e1('0x66')][_0xe0e1('0xae')][0x0]['id']})]},{'include':[{'model':db[_0xe0e1('0xa6')],'as':_0xe0e1('0xbc')}]})['then'](function(_0x22efab){return[_0x22efab,!![]];});});}else{throw new Error(_0xe0e1('0xbd'));}})[_0xe0e1('0xbe')](function(_0xf85ede,_0x49f01c){if(_0x49f01c){return _0xf85ede;}return db[_0xe0e1('0xa6')][_0xe0e1('0x5e')]({'direction':_0xe0e1('0xbb'),'read':![],'body':_0x196034[_0xe0e1('0x66')][_0xe0e1('0xae')][0x0][_0xe0e1('0xbf')],'FaxAccountId':_0x1bce9e['id'],'FaxInteractionId':_0xf85ede['id'],'UserId':_0x196034[_0xe0e1('0x5f')]['id'],'ContactId':_0xf85ede[_0xe0e1('0xc0')],'AttachmentId':_0x196034[_0xe0e1('0x66')]['attachments'][0x0]['id']})['then'](function(_0x27729f){_0xf85ede['dataValues'][_0xe0e1('0xbc')]=[];_0xf85ede['dataValues']['Messages']['push'](_0x27729f[_0xe0e1('0xc1')]);return _0xf85ede;});})[_0xe0e1('0x21')](function(_0xc1b43){respondWithRpcPromise(_0xe0e1('0xc2'),_0xe0e1('0xc2'),{'FaxAccountId':_[_0xe0e1('0xb4')](_0x196034[_0xe0e1('0x59')]['id'])?undefined:_0x196034[_0xe0e1('0x59')]['id'],'path':_[_0xe0e1('0xb4')](_0x196034[_0xe0e1('0x66')][_0xe0e1('0xae')][0x0][_0xe0e1('0xb5')])?undefined:_0x196034['body'][_0xe0e1('0xae')][0x0][_0xe0e1('0xb5')],'fax':_['isNil'](_0x196034['body']['to'][0x0])?undefined:_0x196034['body']['to'][0x0],'AttachmentId':_0x196034[_0xe0e1('0x66')]['attachments'][0x0]['id']},client9002)['then'](function(_0xb48ff0){logger[_0xe0e1('0x22')](_0xe0e1('0xc3'),_0xb48ff0);})[_0xe0e1('0x57')](function(_0x549be3){logger[_0xe0e1('0x22')](_0xe0e1('0xc3'),_0x549be3);});return _0xc1b43;})[_0xe0e1('0x21')](respondWithResult(_0x1875e6,null))['catch'](handleError(_0x1875e6,null));};exports['addAgents']=function(_0x3a65ca,_0x44025d,_0x559150){return db[_0xe0e1('0x40')][_0xe0e1('0x5d')]({'where':{'id':_0x3a65ca[_0xe0e1('0x59')]['id']}})[_0xe0e1('0x21')](handleEntityNotFound(_0x44025d,null))[_0xe0e1('0x21')](function(_0x5af875){if(_0x5af875){return _0x5af875[_0xe0e1('0xc4')](_0x3a65ca[_0xe0e1('0x66')][_0xe0e1('0x6e')],_[_0xe0e1('0x74')](_0x3a65ca[_0xe0e1('0x66')],[_0xe0e1('0x6e'),'id'])||{})['spread'](function(_0xd549d2){for(var _0x4e3514=0x0;_0x4e3514<_0x3a65ca[_0xe0e1('0x66')][_0xe0e1('0x6e')]['length'];_0x4e3514+=0x1){socket[_0xe0e1('0xc5')](_0xe0e1('0xc6'),{'UserId':Number(_0x3a65ca[_0xe0e1('0x66')][_0xe0e1('0x6e')][_0x4e3514]),'FaxAccountId':Number(_0x3a65ca['params']['id'])});}return _0xd549d2;});}})[_0xe0e1('0x21')](respondWithResult(_0x44025d,null))[_0xe0e1('0x57')](handleError(_0x44025d,null));};exports[_0xe0e1('0xc7')]=function(_0x584bb0,_0x5667b8,_0x16bdf7){return db[_0xe0e1('0x40')][_0xe0e1('0x5d')]({'where':{'id':_0x584bb0['params']['id']}})[_0xe0e1('0x21')](handleEntityNotFound(_0x5667b8,null))['then'](function(_0x561ea0){if(_0x561ea0){return _0x561ea0[_0xe0e1('0xc7')](_0x584bb0[_0xe0e1('0x45')]['ids'])['then'](function(){if(_[_0xe0e1('0xc8')](_0x584bb0[_0xe0e1('0x45')][_0xe0e1('0x6e')])){for(var _0x346751=0x0;_0x346751<_0x584bb0[_0xe0e1('0x45')][_0xe0e1('0x6e')][_0xe0e1('0x4a')];_0x346751+=0x1){socket[_0xe0e1('0xc5')]('userFaxAccount:remove',{'UserId':Number(_0x584bb0[_0xe0e1('0x45')][_0xe0e1('0x6e')][_0x346751]),'FaxAccountId':Number(_0x584bb0[_0xe0e1('0x59')]['id'])});}}else{socket[_0xe0e1('0xc5')](_0xe0e1('0xc9'),{'UserId':Number(_0x584bb0[_0xe0e1('0x45')]['ids']),'FaxAccountId':Number(_0x584bb0['params']['id'])});}});}})[_0xe0e1('0x21')](respondWithStatusCode(_0x5667b8,null))[_0xe0e1('0x57')](handleError(_0x5667b8,null));};exports[_0xe0e1('0xca')]=function(_0x1a1526,_0x160d8d,_0x180fe9){var _0x691a1f={};var _0x4cd28e={};var _0x48b864;var _0x29d553;return db[_0xe0e1('0x40')][_0xe0e1('0x6a')]({'where':{'id':_0x1a1526[_0xe0e1('0x59')]['id']}})[_0xe0e1('0x21')](handleEntityNotFound(_0x160d8d,null))['then'](function(_0x111554){if(_0x111554){_0x48b864=_0x111554;_0x4cd28e['model']=_[_0xe0e1('0x5b')](db['User']['rawAttributes']);_0x4cd28e[_0xe0e1('0x45')]=_['keys'](_0x1a1526['query']);_0x4cd28e['filters']=_[_0xe0e1('0x46')](_0x4cd28e[_0xe0e1('0x47')],_0x4cd28e['query']);_0x691a1f[_0xe0e1('0x48')]=_['intersection'](_0x4cd28e[_0xe0e1('0x47')],qs['fields'](_0x1a1526[_0xe0e1('0x45')][_0xe0e1('0x49')]));_0x691a1f[_0xe0e1('0x48')]=_0x691a1f[_0xe0e1('0x48')][_0xe0e1('0x4a')]?_0x691a1f[_0xe0e1('0x48')]:_0x4cd28e[_0xe0e1('0x47')];_0x691a1f['order']=qs[_0xe0e1('0x4e')](_0x1a1526[_0xe0e1('0x45')][_0xe0e1('0x4e')]);_0x691a1f[_0xe0e1('0x4f')]=qs[_0xe0e1('0x50')](_[_0xe0e1('0x51')](_0x1a1526[_0xe0e1('0x45')],_0x4cd28e['filters']));if(_0x1a1526[_0xe0e1('0x45')][_0xe0e1('0x52')]){_0x691a1f[_0xe0e1('0x4f')]=_[_0xe0e1('0x5c')](_0x691a1f[_0xe0e1('0x4f')],{'$or':_['map'](_0x691a1f[_0xe0e1('0x48')],function(_0x3542b1){var _0x441dc0={};_0x441dc0[_0x3542b1]={'$like':'%'+_0x1a1526[_0xe0e1('0x45')]['filter']+'%'};return _0x441dc0;})});}_0x691a1f=_[_0xe0e1('0x5c')]({},_0x691a1f,_0x1a1526[_0xe0e1('0x70')]);return _0x48b864[_0xe0e1('0xca')](_0x691a1f);}})[_0xe0e1('0x21')](function(_0x541bcf){if(_0x541bcf){_0x29d553=_0x541bcf['length'];if(!_0x1a1526[_0xe0e1('0x45')][_0xe0e1('0x4b')]('nolimit')){_0x691a1f[_0xe0e1('0x30')]=qs[_0xe0e1('0x30')](_0x1a1526[_0xe0e1('0x45')][_0xe0e1('0x30')]);_0x691a1f['offset']=qs[_0xe0e1('0x2e')](_0x1a1526['query']['offset']);}return _0x48b864['getAgents'](_0x691a1f);}})[_0xe0e1('0x21')](function(_0x2ff1f8){if(_0x2ff1f8){return _0x2ff1f8?{'count':_0x29d553,'rows':_0x2ff1f8}:null;}})['then'](respondWithResult(_0x160d8d,null))[_0xe0e1('0x57')](handleError(_0x160d8d,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 60e7884..67ba962 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 _0x57e4=['FaxAccount','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x10dfdf,_0x36b623){var _0x4d857d=function(_0x4683ee){while(--_0x4683ee){_0x10dfdf['push'](_0x10dfdf['shift']());}};_0x4d857d(++_0x36b623);}(_0x57e4,0x1e5));var _0x457e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x57e4[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0x457e('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0x457e('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x457e('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x457e('0x3'),'afterDestroy':_0x457e('0x4')};function emitEvent(_0xcc16f4){return function(_0x572329,_0x45173e,_0x46393f){FaxAccountEvents[_0x457e('0x5')](_0xcc16f4+':'+_0x572329['id'],_0x572329);FaxAccountEvents[_0x457e('0x5')](_0xcc16f4,_0x572329);_0x46393f(null);};}for(var e in events){if(events[_0x457e('0x6')](e)){var event=events[e];FaxAccount[_0x457e('0x7')](e,emitEvent(event));}}module[_0x457e('0x8')]=FaxAccountEvents; \ No newline at end of file +var _0x2bd1=['exports','events','../../mysqldb','setMaxListeners','save','emit','hook'];(function(_0x1635fe,_0x5f1d9f){var _0x3c512a=function(_0x26b53d){while(--_0x26b53d){_0x1635fe['push'](_0x1635fe['shift']());}};_0x3c512a(++_0x5f1d9f);}(_0x2bd1,0x143));var _0x12bd=function(_0x402df3,_0x204128){_0x402df3=_0x402df3-0x0;var _0x35edcc=_0x2bd1[_0x402df3];return _0x35edcc;};'use strict';var EventEmitter=require(_0x12bd('0x0'));var FaxAccount=require(_0x12bd('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x12bd('0x2')](0x0);var events={'afterCreate':_0x12bd('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4f7899){return function(_0x17d6b8,_0x35f648,_0x86091e){FaxAccountEvents[_0x12bd('0x4')](_0x4f7899+':'+_0x17d6b8['id'],_0x17d6b8);FaxAccountEvents[_0x12bd('0x4')](_0x4f7899,_0x17d6b8);_0x86091e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0x12bd('0x5')](e,emitEvent(event));}}module[_0x12bd('0x6')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index fa03cf7..22bad1e 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 _0x3b8e=['./faxAccount.attributes','define','FaxAccount','fax_accounts','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5ec626,_0x59d1dc){var _0x5b8e24=function(_0x548b55){while(--_0x548b55){_0x5ec626['push'](_0x5ec626['shift']());}};_0x5b8e24(++_0x59d1dc);}(_0x3b8e,0x1f0));var _0xe3b8=function(_0x1f994c,_0x10db25){_0x1f994c=_0x1f994c-0x0;var _0x307377=_0x3b8e[_0x1f994c];return _0x307377;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe3b8('0x0'))(_0xe3b8('0x1'));var moment=require(_0xe3b8('0x2'));var BPromise=require(_0xe3b8('0x3'));var rp=require(_0xe3b8('0x4'));var fs=require('fs');var path=require(_0xe3b8('0x5'));var rimraf=require(_0xe3b8('0x6'));var config=require(_0xe3b8('0x7'));var attributes=require(_0xe3b8('0x8'));module['exports']=function(_0x4bd4b1,_0x15e0a7){return _0x4bd4b1[_0xe3b8('0x9')](_0xe3b8('0xa'),attributes,{'tableName':_0xe3b8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe8f0=['bluebird','path','rimraf','../../config/environment','./faxAccount.attributes','define','fax_accounts','lodash','util','../../config/logger'];(function(_0x59f569,_0x2158dc){var _0x4f54db=function(_0x5879f0){while(--_0x5879f0){_0x59f569['push'](_0x59f569['shift']());}};_0x4f54db(++_0x2158dc);}(_0xe8f0,0x179));var _0x0e8f=function(_0x4c7736,_0x126d06){_0x4c7736=_0x4c7736-0x0;var _0x38cabe=_0xe8f0[_0x4c7736];return _0x38cabe;};'use strict';var _=require(_0x0e8f('0x0'));var util=require(_0x0e8f('0x1'));var logger=require(_0x0e8f('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0e8f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0e8f('0x4'));var rimraf=require(_0x0e8f('0x5'));var config=require(_0x0e8f('0x6'));var attributes=require(_0x0e8f('0x7'));module['exports']=function(_0x384af6,_0x39c590){return _0x384af6[_0x0e8f('0x8')]('FaxAccount',attributes,{'tableName':_0x0e8f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index 3474025..2564d35 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 _0x3bc4=['unmanaged','*,*,*,*','created','ContactId','AttachmentId','UserId','name','interaction','agent','waitForTheAssignedAgent','FaxQueue','queueId','unshift','queue','waitForTheAssignedQueue','Start','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./faxAccount.socket','register','request','info','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetFaxAccount','FaxAccount','options','raw','where','attributes','limit','include','map','model','body','fax','CmContact','then','Sequelize','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','isNil','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','Contacts','DESC','FaxApplication','Applications','List','account','applications','list','asc','create','contact','FaxInteraction','find','Contact\x20not\x20found','spread','get','autoclose','push'];(function(_0x48b784,_0x2999e9){var _0x17f563=function(_0x50c7d2){while(--_0x50c7d2){_0x48b784['push'](_0x48b784['shift']());}};_0x17f563(++_0x2999e9);}(_0x3bc4,0x12a));var _0x43bc=function(_0x154192,_0x2d360f){_0x154192=_0x154192-0x0;var _0x3c2792=_0x3bc4[_0x154192];return _0x3c2792;};'use strict';var _=require(_0x43bc('0x0'));var util=require(_0x43bc('0x1'));var moment=require(_0x43bc('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x43bc('0x3'));var db=require(_0x43bc('0x4'))['db'];var utils=require(_0x43bc('0x5'));var logger=require(_0x43bc('0x6'))(_0x43bc('0x7'));var config=require(_0x43bc('0x8'));var jayson=require(_0x43bc('0x9'));var client=jayson[_0x43bc('0xa')][_0x43bc('0xb')]({'port':0x232c});config[_0x43bc('0xc')]=_[_0x43bc('0xd')](config[_0x43bc('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x43bc('0xe'))(new Redis(config['redis']));require(_0x43bc('0xf'))[_0x43bc('0x10')](socket);function respondWithRpcPromise(_0x1492fa,_0x45a73e,_0x2c79e1){return new BPromise(function(_0x3aa1ed,_0x180458){return client[_0x43bc('0x11')](_0x1492fa,_0x2c79e1)['then'](function(_0x1990b0){logger[_0x43bc('0x12')](_0x43bc('0x13'),_0x45a73e,'request\x20sent');logger[_0x43bc('0x14')](_0x43bc('0x15'),_0x45a73e,_0x43bc('0x16'),JSON[_0x43bc('0x17')](_0x1990b0));if(_0x1990b0[_0x43bc('0x18')]){if(_0x1990b0[_0x43bc('0x18')][_0x43bc('0x19')]===0x1f4){logger[_0x43bc('0x18')](_0x43bc('0x13'),_0x45a73e,_0x1990b0['error']['message']);return _0x180458(_0x1990b0[_0x43bc('0x18')][_0x43bc('0x1a')]);}logger[_0x43bc('0x18')](_0x43bc('0x13'),_0x45a73e,_0x1990b0[_0x43bc('0x18')][_0x43bc('0x1a')]);return _0x3aa1ed(_0x1990b0[_0x43bc('0x18')][_0x43bc('0x1a')]);}else{logger[_0x43bc('0x12')](_0x43bc('0x13'),_0x45a73e,_0x43bc('0x16'));_0x3aa1ed(_0x1990b0['result']['message']);}})[_0x43bc('0x1b')](function(_0x957a47){logger[_0x43bc('0x18')](_0x43bc('0x13'),_0x45a73e,_0x957a47);_0x180458(_0x957a47);});});}exports[_0x43bc('0x1c')]=function(_0x3da597){var _0xc5c5ce=this;return new Promise(function(_0x501552,_0x27f7fd){return db[_0x43bc('0x1d')]['findAll']({'raw':_0x3da597[_0x43bc('0x1e')]?_0x3da597['options'][_0x43bc('0x1f')]===undefined?!![]:![]:!![],'where':_0x3da597['options']?_0x3da597[_0x43bc('0x1e')][_0x43bc('0x20')]||null:null,'attributes':_0x3da597[_0x43bc('0x1e')]?_0x3da597[_0x43bc('0x1e')][_0x43bc('0x21')]||null:null,'limit':_0x3da597[_0x43bc('0x1e')]?_0x3da597['options'][_0x43bc('0x22')]||null:null,'include':_0x3da597[_0x43bc('0x1e')]?_0x3da597[_0x43bc('0x1e')][_0x43bc('0x23')]?_[_0x43bc('0x24')](_0x3da597['options']['include'],function(_0x726dee){return{'model':db[_0x726dee[_0x43bc('0x25')]],'as':_0x726dee['as'],'attributes':_0x726dee['attributes'],'include':_0x726dee['include']?_[_0x43bc('0x24')](_0x726dee[_0x43bc('0x23')],function(_0x464f8e){return{'model':db[_0x464f8e[_0x43bc('0x25')]],'as':_0x464f8e['as'],'attributes':_0x464f8e[_0x43bc('0x21')],'include':_0x464f8e[_0x43bc('0x23')]?_['map'](_0x464f8e['include'],function(_0x3d31a6){return{'model':db[_0x3d31a6[_0x43bc('0x25')]],'as':_0x3d31a6['as'],'attributes':_0x3d31a6['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3a86e2){logger[_0x43bc('0x12')](_0x43bc('0x1c'),_0x3da597);logger['debug']('GetFaxAccount',_0x3da597,JSON[_0x43bc('0x17')](_0x3a86e2));_0x501552(_0x3a86e2);})[_0x43bc('0x1b')](function(_0xcfcca7){logger[_0x43bc('0x18')](_0x43bc('0x1c'),_0xcfcca7['message'],_0x3da597);_0x27f7fd(_0xc5c5ce[_0x43bc('0x18')](0x1f4,_0xcfcca7[_0x43bc('0x1a')]));});});};exports['NotifyFaxAccount']=function(_0x251d07,_0x5aa868,_0x3184b0){var _0x359ec1=this;return new Promise(function(_0x45b411,_0x2a0fdb){var _0x35cc5b={'body':_0x251d07[_0x43bc('0x26')],'channel':_0x43bc('0x27')};var _0x50233b=[];var _0x537189=[];var _0x5b79e6={};return db[_0x43bc('0x28')]['describe']()[_0x43bc('0x29')](function(_0x4d7587){if(!_0x4d7587){throw new db[(_0x43bc('0x2a'))]['ValidationError'](_0x43bc('0x2b'));}_0x50233b=_[_0x43bc('0x2c')](_[_0x43bc('0x2d')](_0x4d7587),[_0x43bc('0x2e'),_0x43bc('0x2f')]);_0x537189=_[_0x43bc('0x2c')](_['keys'](_0x4d7587),['createdAt',_0x43bc('0x2f'),_0x43bc('0x30'),_0x43bc('0x31')]);if(_0x251d07[_0x43bc('0x26')]['id']){delete _0x251d07[_0x43bc('0x26')]['id'];}if(_[_0x43bc('0x32')](_0x251d07['body']['from'])){throw new db[(_0x43bc('0x2a'))][(_0x43bc('0x33'))](_0x43bc('0x34'));}if(_['isNil'](_0x251d07[_0x43bc('0x26')]['body'])||_0x251d07['body']['body']===''){throw new db[(_0x43bc('0x2a'))][(_0x43bc('0x33'))](_0x43bc('0x35'));}if(_['isNil'](_0x251d07[_0x43bc('0x26')][_0x43bc('0x36')])){throw new db['Sequelize'][(_0x43bc('0x33'))](_0x43bc('0x37')+_0x537189);}if(!_[_0x43bc('0x38')](_0x537189,_0x251d07[_0x43bc('0x26')]['mapKey'])){throw new db[(_0x43bc('0x2a'))][(_0x43bc('0x33'))](_0x43bc('0x39')+_0x537189);}_0x5b79e6[_0x251d07[_0x43bc('0x26')]['mapKey']]=_0x251d07[_0x43bc('0x26')][_0x43bc('0x3a')];})[_0x43bc('0x29')](function(){return db[_0x43bc('0x1d')]['find']({'where':{'id':_0x251d07['account']['id']},'include':[{'model':db[_0x43bc('0x3b')],'as':'List','include':[{'model':db[_0x43bc('0x28')],'as':_0x43bc('0x3c'),'where':_0x5b79e6,'limit':0x1,'order':[['updatedAt',_0x43bc('0x3d')]]}]},{'model':db[_0x43bc('0x3e')],'as':_0x43bc('0x3f')}]});})[_0x43bc('0x29')](function(_0x57cb85){if(_0x57cb85&&_0x57cb85[_0x43bc('0x40')]){var _0x5ae83a=_0x57cb85['get']({'plain':!![]});_0x35cc5b[_0x43bc('0x41')]=_0x5ae83a;_0x35cc5b[_0x43bc('0x42')]=_0x5ae83a[_0x43bc('0x3f')];_0x35cc5b[_0x43bc('0x43')]=_0x5ae83a[_0x43bc('0x40')];_0x35cc5b[_0x43bc('0x42')]=_['orderBy'](_0x35cc5b[_0x43bc('0x42')],['priority'],[_0x43bc('0x44')]);if(_0x35cc5b[_0x43bc('0x41')][_0x43bc('0x3f')]){delete _0x35cc5b[_0x43bc('0x41')][_0x43bc('0x3f')];}if(_0x35cc5b['account']['List']&&_0x35cc5b['account'][_0x43bc('0x40')][_0x43bc('0x3c')]['length']){return _0x35cc5b[_0x43bc('0x41')][_0x43bc('0x40')][_0x43bc('0x3c')][0x0];}var _0x210b23=_[_0x43bc('0xd')](_0x251d07[_0x43bc('0x26')],{'firstName':_0x251d07[_0x43bc('0x26')][_0x43bc('0x3a')],'ListId':_0x5ae83a['ListId']});_0x210b23[_0x251d07[_0x43bc('0x26')][_0x43bc('0x36')]]=_0x251d07['body'][_0x43bc('0x3a')];return db[_0x43bc('0x28')][_0x43bc('0x45')](_0x210b23,{'fields':_0x50233b,'raw':!![]});}})[_0x43bc('0x29')](function(_0x15cc63){_0x35cc5b[_0x43bc('0x46')]=_0x15cc63;if(_0x15cc63){var _0x4708e1={'ContactId':_0x15cc63['id'],'FaxAccountId':_0x251d07['account']['id'],'fax':_0x15cc63[_0x43bc('0x27')]};return db[_0x43bc('0x47')][_0x43bc('0x48')]({'where':{'ContactId':_0x15cc63['id'],'closed':![],'FaxAccountId':_0x251d07[_0x43bc('0x41')]['id']}})[_0x43bc('0x29')](function(_0x3e1965){if(_0x3e1965){return[_0x3e1965,![]];}return db[_0x43bc('0x47')]['create'](_0x4708e1)[_0x43bc('0x29')](function(_0x382519){return[_0x382519,!![]];});});}else{throw new Error(_0x43bc('0x49'));}})[_0x43bc('0x4a')](function(_0x3b461f,_0x2e8c25){var _0x118fa7=_0x3b461f[_0x43bc('0x4b')]({'plain':!![]});if(_0x2e8c25){if(_0x35cc5b[_0x43bc('0x41')][_0x43bc('0x4c')]){_0x35cc5b['applications'][_0x43bc('0x4d')]({'id':0x0,'priority':_0x35cc5b[_0x43bc('0x42')]['length']+0x1,'app':'close','appdata':_0x43bc('0x4e'),'interval':_0x43bc('0x4f')});}_0x118fa7['created']=!![];}else{_0x118fa7[_0x43bc('0x50')]=![];}_0x35cc5b['interaction']=_0x118fa7;return db['FaxMessage'][_0x43bc('0x45')]({'body':_0x251d07[_0x43bc('0x26')][_0x43bc('0x26')],'FaxAccountId':_0x251d07['account']['id'],'FaxInteractionId':_0x3b461f['id'],'direction':'in','ContactId':_0x3b461f[_0x43bc('0x51')],'AttachmentId':_0x251d07[_0x43bc('0x26')][_0x43bc('0x52')]});})[_0x43bc('0x29')](function(_0x1b5595){_0x35cc5b['message']=_0x1b5595;if(!_0x35cc5b['interaction'][_0x43bc('0x53')])return;return db['User'][_0x43bc('0x48')]({'attributes':['id',_0x43bc('0x54')],'where':{'id':_0x35cc5b[_0x43bc('0x55')]['UserId']}});})[_0x43bc('0x29')](function(_0x58e355){if(_0x58e355){_0x35cc5b[_0x43bc('0x42')]['unshift']({'id':0x0,'priority':0x0,'app':_0x43bc('0x56'),'appdata':_0x58e355['name']+','+(_0x35cc5b[_0x43bc('0x41')][_0x43bc('0x57')]||0xa),'interval':_0x43bc('0x4f')});}if(!_0x35cc5b[_0x43bc('0x55')]['queueId'])return;return db[_0x43bc('0x58')][_0x43bc('0x48')]({'attributes':['id',_0x43bc('0x54')],'where':{'id':_0x35cc5b['interaction'][_0x43bc('0x59')]}});})['then'](function(_0x5afc1b){if(_0x5afc1b){_0x35cc5b[_0x43bc('0x42')][_0x43bc('0x5a')]({'id':0x0,'priority':0x1,'app':_0x43bc('0x5b'),'appdata':_0x5afc1b['name']+','+(_0x35cc5b[_0x43bc('0x41')][_0x43bc('0x5c')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x43bc('0x5d'),'startRouting',_0x35cc5b);})[_0x43bc('0x29')](function(_0x1d1bff){_0x45b411(_0x1d1bff);})['catch'](function(_0x27df9f){_0x2a0fdb(_0x359ec1[_0x43bc('0x18')](0x1f4,_0x27df9f[_0x43bc('0x1a')]));});});}; \ No newline at end of file +var _0xbcdc=['./faxAccount.socket','register','request','then','info','request\x20sent','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','result','catch','GetFaxAccount','FaxAccount','findAll','raw','options','where','attributes','limit','include','model','map','debug','NotifyFaxAccount','fax','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','body','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','isNil','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','List','Contacts','DESC','Applications','get','account','applications','list','orderBy','priority','asc','length','create','FaxInteraction','Contact\x20not\x20found','spread','autoclose','push','unmanaged','*,*,*,*','interaction','FaxMessage','ContactId','AttachmentId','UserId','User','name','unshift','agent','queueId','queue','waitForTheAssignedQueue','Start','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x2f5aca,_0x49c809){var _0xf7b3d7=function(_0x3ef5de){while(--_0x3ef5de){_0x2f5aca['push'](_0x2f5aca['shift']());}};_0xf7b3d7(++_0x49c809);}(_0xbcdc,0xaa));var _0xcbcd=function(_0x3f541a,_0x315b8c){_0x3f541a=_0x3f541a-0x0;var _0xefb673=_0xbcdc[_0x3f541a];return _0xefb673;};'use strict';var _=require('lodash');var util=require(_0xcbcd('0x0'));var moment=require(_0xcbcd('0x1'));var BPromise=require(_0xcbcd('0x2'));var rs=require(_0xcbcd('0x3'));var fs=require('fs');var Redis=require(_0xcbcd('0x4'));var db=require(_0xcbcd('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcbcd('0x6'))(_0xcbcd('0x7'));var config=require('../../config/environment');var jayson=require(_0xcbcd('0x8'));var client=jayson[_0xcbcd('0x9')][_0xcbcd('0xa')]({'port':0x232c});config[_0xcbcd('0xb')]=_[_0xcbcd('0xc')](config[_0xcbcd('0xb')],{'host':_0xcbcd('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xcbcd('0xe'))[_0xcbcd('0xf')](socket);function respondWithRpcPromise(_0x27abdc,_0xb17385,_0x22127d){return new BPromise(function(_0x546b80,_0x16e3ed){return client[_0xcbcd('0x10')](_0x27abdc,_0x22127d)[_0xcbcd('0x11')](function(_0x2d9b93){logger[_0xcbcd('0x12')]('FaxAccount,\x20%s,\x20%s',_0xb17385,_0xcbcd('0x13'));logger['debug']('FaxAccount,\x20%s,\x20%s,\x20%s',_0xb17385,_0xcbcd('0x13'),JSON[_0xcbcd('0x14')](_0x2d9b93));if(_0x2d9b93[_0xcbcd('0x15')]){if(_0x2d9b93['error'][_0xcbcd('0x16')]===0x1f4){logger[_0xcbcd('0x15')](_0xcbcd('0x17'),_0xb17385,_0x2d9b93[_0xcbcd('0x15')][_0xcbcd('0x18')]);return _0x16e3ed(_0x2d9b93['error']['message']);}logger[_0xcbcd('0x15')](_0xcbcd('0x17'),_0xb17385,_0x2d9b93[_0xcbcd('0x15')]['message']);return _0x546b80(_0x2d9b93['error'][_0xcbcd('0x18')]);}else{logger[_0xcbcd('0x12')]('FaxAccount,\x20%s,\x20%s',_0xb17385,_0xcbcd('0x13'));_0x546b80(_0x2d9b93[_0xcbcd('0x19')][_0xcbcd('0x18')]);}})[_0xcbcd('0x1a')](function(_0x280ed6){logger[_0xcbcd('0x15')]('FaxAccount,\x20%s,\x20%s',_0xb17385,_0x280ed6);_0x16e3ed(_0x280ed6);});});}exports[_0xcbcd('0x1b')]=function(_0x350e72){var _0x301271=this;return new Promise(function(_0x471f77,_0x37c52c){return db[_0xcbcd('0x1c')][_0xcbcd('0x1d')]({'raw':_0x350e72['options']?_0x350e72['options'][_0xcbcd('0x1e')]===undefined?!![]:![]:!![],'where':_0x350e72[_0xcbcd('0x1f')]?_0x350e72[_0xcbcd('0x1f')][_0xcbcd('0x20')]||null:null,'attributes':_0x350e72['options']?_0x350e72['options'][_0xcbcd('0x21')]||null:null,'limit':_0x350e72[_0xcbcd('0x1f')]?_0x350e72['options'][_0xcbcd('0x22')]||null:null,'include':_0x350e72['options']?_0x350e72['options'][_0xcbcd('0x23')]?_['map'](_0x350e72[_0xcbcd('0x1f')]['include'],function(_0x58e007){return{'model':db[_0x58e007[_0xcbcd('0x24')]],'as':_0x58e007['as'],'attributes':_0x58e007[_0xcbcd('0x21')],'include':_0x58e007[_0xcbcd('0x23')]?_[_0xcbcd('0x25')](_0x58e007['include'],function(_0x3f8a65){return{'model':db[_0x3f8a65[_0xcbcd('0x24')]],'as':_0x3f8a65['as'],'attributes':_0x3f8a65['attributes'],'include':_0x3f8a65[_0xcbcd('0x23')]?_['map'](_0x3f8a65['include'],function(_0x15188d){return{'model':db[_0x15188d[_0xcbcd('0x24')]],'as':_0x15188d['as'],'attributes':_0x15188d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5b9ac1){logger['info'](_0xcbcd('0x1b'),_0x350e72);logger[_0xcbcd('0x26')](_0xcbcd('0x1b'),_0x350e72,JSON['stringify'](_0x5b9ac1));_0x471f77(_0x5b9ac1);})[_0xcbcd('0x1a')](function(_0x17319a){logger[_0xcbcd('0x15')](_0xcbcd('0x1b'),_0x17319a[_0xcbcd('0x18')],_0x350e72);_0x37c52c(_0x301271[_0xcbcd('0x15')](0x1f4,_0x17319a['message']));});});};exports[_0xcbcd('0x27')]=function(_0x53c613,_0x27280a,_0x455ad3){var _0x347cb3=this;return new Promise(function(_0x1b8bd7,_0x9d1d55){var _0x3a191a={'body':_0x53c613['body'],'channel':_0xcbcd('0x28')};var _0x4077cc=[];var _0x3ae062=[];var _0x3e2b07={};return db[_0xcbcd('0x29')]['describe']()['then'](function(_0xfcc0d6){if(!_0xfcc0d6){throw new db[(_0xcbcd('0x2a'))][(_0xcbcd('0x2b'))](_0xcbcd('0x2c'));}_0x4077cc=_[_0xcbcd('0x2d')](_[_0xcbcd('0x2e')](_0xfcc0d6),[_0xcbcd('0x2f'),_0xcbcd('0x30')]);_0x3ae062=_[_0xcbcd('0x2d')](_[_0xcbcd('0x2e')](_0xfcc0d6),[_0xcbcd('0x2f'),_0xcbcd('0x30'),_0xcbcd('0x31'),'ListId']);if(_0x53c613[_0xcbcd('0x32')]['id']){delete _0x53c613['body']['id'];}if(_['isNil'](_0x53c613[_0xcbcd('0x32')][_0xcbcd('0x33')])){throw new db['Sequelize']['ValidationError'](_0xcbcd('0x34'));}if(_['isNil'](_0x53c613['body'][_0xcbcd('0x32')])||_0x53c613[_0xcbcd('0x32')][_0xcbcd('0x32')]===''){throw new db[(_0xcbcd('0x2a'))][(_0xcbcd('0x2b'))](_0xcbcd('0x35'));}if(_[_0xcbcd('0x36')](_0x53c613[_0xcbcd('0x32')][_0xcbcd('0x37')])){throw new db['Sequelize']['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3ae062);}if(!_[_0xcbcd('0x38')](_0x3ae062,_0x53c613[_0xcbcd('0x32')]['mapKey'])){throw new db[(_0xcbcd('0x2a'))][(_0xcbcd('0x2b'))](_0xcbcd('0x39')+_0x3ae062);}_0x3e2b07[_0x53c613[_0xcbcd('0x32')][_0xcbcd('0x37')]]=_0x53c613[_0xcbcd('0x32')][_0xcbcd('0x33')];})[_0xcbcd('0x11')](function(){return db[_0xcbcd('0x1c')][_0xcbcd('0x3a')]({'where':{'id':_0x53c613['account']['id']},'include':[{'model':db['CmList'],'as':_0xcbcd('0x3b'),'include':[{'model':db[_0xcbcd('0x29')],'as':_0xcbcd('0x3c'),'where':_0x3e2b07,'limit':0x1,'order':[[_0xcbcd('0x30'),_0xcbcd('0x3d')]]}]},{'model':db['FaxApplication'],'as':_0xcbcd('0x3e')}]});})[_0xcbcd('0x11')](function(_0x168a53){if(_0x168a53&&_0x168a53['List']){var _0x7da3f4=_0x168a53[_0xcbcd('0x3f')]({'plain':!![]});_0x3a191a[_0xcbcd('0x40')]=_0x7da3f4;_0x3a191a[_0xcbcd('0x41')]=_0x7da3f4[_0xcbcd('0x3e')];_0x3a191a[_0xcbcd('0x42')]=_0x7da3f4[_0xcbcd('0x3b')];_0x3a191a[_0xcbcd('0x41')]=_[_0xcbcd('0x43')](_0x3a191a[_0xcbcd('0x41')],[_0xcbcd('0x44')],[_0xcbcd('0x45')]);if(_0x3a191a[_0xcbcd('0x40')]['Applications']){delete _0x3a191a[_0xcbcd('0x40')][_0xcbcd('0x3e')];}if(_0x3a191a[_0xcbcd('0x40')]['List']&&_0x3a191a[_0xcbcd('0x40')][_0xcbcd('0x3b')]['Contacts'][_0xcbcd('0x46')]){return _0x3a191a[_0xcbcd('0x40')][_0xcbcd('0x3b')][_0xcbcd('0x3c')][0x0];}var _0x3f9a66=_[_0xcbcd('0xc')](_0x53c613[_0xcbcd('0x32')],{'firstName':_0x53c613[_0xcbcd('0x32')][_0xcbcd('0x33')],'ListId':_0x7da3f4['ListId']});_0x3f9a66[_0x53c613[_0xcbcd('0x32')]['mapKey']]=_0x53c613[_0xcbcd('0x32')][_0xcbcd('0x33')];return db[_0xcbcd('0x29')][_0xcbcd('0x47')](_0x3f9a66,{'fields':_0x4077cc,'raw':!![]});}})[_0xcbcd('0x11')](function(_0x200c92){_0x3a191a['contact']=_0x200c92;if(_0x200c92){var _0x360766={'ContactId':_0x200c92['id'],'FaxAccountId':_0x53c613[_0xcbcd('0x40')]['id'],'fax':_0x200c92[_0xcbcd('0x28')]};return db[_0xcbcd('0x48')][_0xcbcd('0x3a')]({'where':{'ContactId':_0x200c92['id'],'closed':![],'FaxAccountId':_0x53c613[_0xcbcd('0x40')]['id']}})['then'](function(_0x1c9876){if(_0x1c9876){return[_0x1c9876,![]];}return db[_0xcbcd('0x48')][_0xcbcd('0x47')](_0x360766)[_0xcbcd('0x11')](function(_0x5c361f){return[_0x5c361f,!![]];});});}else{throw new Error(_0xcbcd('0x49'));}})[_0xcbcd('0x4a')](function(_0x22ac16,_0x24833d){var _0x257470=_0x22ac16[_0xcbcd('0x3f')]({'plain':!![]});if(_0x24833d){if(_0x3a191a[_0xcbcd('0x40')][_0xcbcd('0x4b')]){_0x3a191a[_0xcbcd('0x41')][_0xcbcd('0x4c')]({'id':0x0,'priority':_0x3a191a[_0xcbcd('0x41')]['length']+0x1,'app':'close','appdata':_0xcbcd('0x4d'),'interval':_0xcbcd('0x4e')});}_0x257470['created']=!![];}else{_0x257470['created']=![];}_0x3a191a[_0xcbcd('0x4f')]=_0x257470;return db[_0xcbcd('0x50')]['create']({'body':_0x53c613[_0xcbcd('0x32')][_0xcbcd('0x32')],'FaxAccountId':_0x53c613['account']['id'],'FaxInteractionId':_0x22ac16['id'],'direction':'in','ContactId':_0x22ac16[_0xcbcd('0x51')],'AttachmentId':_0x53c613[_0xcbcd('0x32')][_0xcbcd('0x52')]});})[_0xcbcd('0x11')](function(_0x26b099){_0x3a191a['message']=_0x26b099;if(!_0x3a191a[_0xcbcd('0x4f')][_0xcbcd('0x53')])return;return db[_0xcbcd('0x54')][_0xcbcd('0x3a')]({'attributes':['id',_0xcbcd('0x55')],'where':{'id':_0x3a191a['interaction'][_0xcbcd('0x53')]}});})[_0xcbcd('0x11')](function(_0x3f43c6){if(_0x3f43c6){_0x3a191a['applications'][_0xcbcd('0x56')]({'id':0x0,'priority':0x0,'app':_0xcbcd('0x57'),'appdata':_0x3f43c6['name']+','+(_0x3a191a['account']['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}if(!_0x3a191a[_0xcbcd('0x4f')][_0xcbcd('0x58')])return;return db['FaxQueue'][_0xcbcd('0x3a')]({'attributes':['id',_0xcbcd('0x55')],'where':{'id':_0x3a191a[_0xcbcd('0x4f')][_0xcbcd('0x58')]}});})[_0xcbcd('0x11')](function(_0x465b33){if(_0x465b33){_0x3a191a[_0xcbcd('0x41')][_0xcbcd('0x56')]({'id':0x0,'priority':0x1,'app':_0xcbcd('0x59'),'appdata':_0x465b33[_0xcbcd('0x55')]+','+(_0x3a191a[_0xcbcd('0x40')][_0xcbcd('0x5a')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xcbcd('0x5b'),'startRouting',_0x3a191a);})[_0xcbcd('0x11')](function(_0xfcbb8d){_0x1b8bd7(_0xfcbb8d);})[_0xcbcd('0x1a')](function(_0x1b4494){_0x9d1d55(_0x347cb3['error'](0x1f4,_0x1b4494['message']));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 08c247b..b13954f 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 _0xe21f=['update','emit','length','save','remove'];(function(_0x4b281a,_0x1733de){var _0x3149a7=function(_0x3a6b40){while(--_0x3a6b40){_0x4b281a['push'](_0x4b281a['shift']());}};_0x3149a7(++_0x1733de);}(_0xe21f,0xe9));var _0xfe21=function(_0x3af04e,_0x32fe73){_0x3af04e=_0x3af04e-0x0;var _0x22c466=_0xe21f[_0x3af04e];return _0x22c466;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0xfe21('0x0'),_0xfe21('0x1'),_0xfe21('0x2')];function createListener(_0x2e1679,_0x58c568){return function(_0x512495){_0x58c568[_0xfe21('0x3')](_0x2e1679,_0x512495);};}function removeListener(_0x43b74b,_0x48a911){return function(){FaxAccountEvents['removeListener'](_0x43b74b,_0x48a911);};}exports['register']=function(_0x59c873){for(var _0x406166=0x0,_0x22fa0a=events[_0xfe21('0x4')];_0x406166<_0x22fa0a;_0x406166++){var _0x3566bb=events[_0x406166];var _0x103a14=createListener('faxAccount:'+_0x3566bb,_0x59c873);FaxAccountEvents['on'](_0x3566bb,_0x103a14);}}; \ No newline at end of file +var _0xee77=['faxAccount:','save','update','register'];(function(_0x2564ba,_0x493d30){var _0x138cd0=function(_0x167841){while(--_0x167841){_0x2564ba['push'](_0x2564ba['shift']());}};_0x138cd0(++_0x493d30);}(_0xee77,0xf5));var _0x7ee7=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xee77[_0x47e7cb];return _0x2a8874;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0x7ee7('0x0'),'remove',_0x7ee7('0x1')];function createListener(_0x196e6f,_0x4e3c6d){return function(_0x1c2941){_0x4e3c6d['emit'](_0x196e6f,_0x1c2941);};}function removeListener(_0x51f9d9,_0x141eb3){return function(){FaxAccountEvents['removeListener'](_0x51f9d9,_0x141eb3);};}exports[_0x7ee7('0x2')]=function(_0x36ec10){for(var _0xe80e8d=0x0,_0x4c08d1=events['length'];_0xe80e8d<_0x4c08d1;_0xe80e8d++){var _0x10b7d2=events[_0xe80e8d];var _0x258157=createListener(_0x7ee7('0x3')+_0x10b7d2,_0x36ec10);FaxAccountEvents['on'](_0x10b7d2,_0x258157);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 79e47bc..f514a4a 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 _0xf5ea=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getAgents','post','addDisposition','addAnswer','addInteraction','addApplications','/addaccountapplications','/:id/send','/:id/users','addAgents','put','update','delete','removeAnswers','removeAgents','exports','util','express','Router'];(function(_0x375768,_0x453064){var _0x4a49f5=function(_0x276b31){while(--_0x276b31){_0x375768['push'](_0x375768['shift']());}};_0x4a49f5(++_0x453064);}(_0xf5ea,0xc0));var _0xaf5e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xf5ea[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require('multer');var util=require(_0xaf5e('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xaf5e('0x1'));var router=express[_0xaf5e('0x2')]();var fs_extra=require(_0xaf5e('0x3'));var auth=require(_0xaf5e('0x4'));var interaction=require(_0xaf5e('0x5'));var config=require(_0xaf5e('0x6'));var controller=require(_0xaf5e('0x7'));router[_0xaf5e('0x8')]('/',auth[_0xaf5e('0x9')](),controller[_0xaf5e('0xa')]);router[_0xaf5e('0x8')](_0xaf5e('0xb'),auth[_0xaf5e('0x9')](),controller['describe']);router[_0xaf5e('0x8')](_0xaf5e('0xc'),auth[_0xaf5e('0x9')](),controller[_0xaf5e('0xd')]);router[_0xaf5e('0x8')](_0xaf5e('0xe'),auth['isAuthenticated'](),controller[_0xaf5e('0xf')]);router[_0xaf5e('0x8')](_0xaf5e('0x10'),auth['isAuthenticated'](),controller[_0xaf5e('0x11')]);router[_0xaf5e('0x8')](_0xaf5e('0x12'),auth[_0xaf5e('0x9')](),controller[_0xaf5e('0x13')]);router['get'](_0xaf5e('0x14'),auth[_0xaf5e('0x9')](),controller[_0xaf5e('0x15')]);router[_0xaf5e('0x8')](_0xaf5e('0x16'),auth[_0xaf5e('0x9')](),controller['getMessages']);router['get']('/:id/users',auth[_0xaf5e('0x9')](),controller[_0xaf5e('0x17')]);router[_0xaf5e('0x18')]('/',auth[_0xaf5e('0x9')](),controller['create']);router['post'](_0xaf5e('0xe'),auth[_0xaf5e('0x9')](),controller[_0xaf5e('0x19')]);router[_0xaf5e('0x18')](_0xaf5e('0x10'),auth[_0xaf5e('0x9')](),controller[_0xaf5e('0x1a')]);router['post']('/:id/interactions',auth[_0xaf5e('0x9')](),controller[_0xaf5e('0x1b')]);router['post'](_0xaf5e('0x14'),auth[_0xaf5e('0x9')](),controller[_0xaf5e('0x1c')]);router[_0xaf5e('0x18')](_0xaf5e('0x1d'),auth[_0xaf5e('0x9')](),controller['addAccountApplications']);router['post']('/updateaccountapplications',auth[_0xaf5e('0x9')](),controller['updateAccountApplications']);router[_0xaf5e('0x18')](_0xaf5e('0x1e'),auth[_0xaf5e('0x9')](),controller['send']);router[_0xaf5e('0x18')](_0xaf5e('0x1f'),auth[_0xaf5e('0x9')](),controller[_0xaf5e('0x20')]);router[_0xaf5e('0x21')](_0xaf5e('0xc'),auth[_0xaf5e('0x9')](),controller[_0xaf5e('0x22')]);router[_0xaf5e('0x23')](_0xaf5e('0xc'),auth[_0xaf5e('0x9')](),controller['destroy']);router['delete'](_0xaf5e('0xe'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0xaf5e('0x23')](_0xaf5e('0x10'),auth[_0xaf5e('0x9')](),controller[_0xaf5e('0x24')]);router['delete'](_0xaf5e('0x1f'),auth[_0xaf5e('0x9')](),controller[_0xaf5e('0x25')]);module[_0xaf5e('0x26')]=router; \ No newline at end of file +var _0xa0fc=['update','delete','destroy','removeAnswers','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','index','/describe','isAuthenticated','describe','get','/:id','show','/:id/dispositions','getDispositions','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put'];(function(_0x768eb6,_0x4b216a){var _0xb8f02=function(_0x438353){while(--_0x438353){_0x768eb6['push'](_0x768eb6['shift']());}};_0xb8f02(++_0x4b216a);}(_0xa0fc,0xb1));var _0xca0f=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa0fc[_0x2d8fc2];return _0x3a9e53;};'use strict';var multer=require(_0xca0f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xca0f('0x1'));var express=require(_0xca0f('0x2'));var router=express[_0xca0f('0x3')]();var fs_extra=require(_0xca0f('0x4'));var auth=require(_0xca0f('0x5'));var interaction=require(_0xca0f('0x6'));var config=require('../../config/environment');var controller=require('./faxAccount.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xca0f('0x7')]);router['get'](_0xca0f('0x8'),auth[_0xca0f('0x9')](),controller[_0xca0f('0xa')]);router[_0xca0f('0xb')](_0xca0f('0xc'),auth['isAuthenticated'](),controller[_0xca0f('0xd')]);router[_0xca0f('0xb')](_0xca0f('0xe'),auth[_0xca0f('0x9')](),controller[_0xca0f('0xf')]);router[_0xca0f('0xb')]('/:id/canned_answers',auth[_0xca0f('0x9')](),controller['getAnswers']);router[_0xca0f('0xb')](_0xca0f('0x10'),auth[_0xca0f('0x9')](),controller[_0xca0f('0x11')]);router[_0xca0f('0xb')](_0xca0f('0x12'),auth[_0xca0f('0x9')](),controller[_0xca0f('0x13')]);router[_0xca0f('0xb')](_0xca0f('0x14'),auth[_0xca0f('0x9')](),controller[_0xca0f('0x15')]);router['get'](_0xca0f('0x16'),auth[_0xca0f('0x9')](),controller[_0xca0f('0x17')]);router[_0xca0f('0x18')]('/',auth[_0xca0f('0x9')](),controller[_0xca0f('0x19')]);router[_0xca0f('0x18')](_0xca0f('0xe'),auth[_0xca0f('0x9')](),controller[_0xca0f('0x1a')]);router[_0xca0f('0x18')](_0xca0f('0x1b'),auth[_0xca0f('0x9')](),controller[_0xca0f('0x1c')]);router[_0xca0f('0x18')](_0xca0f('0x10'),auth[_0xca0f('0x9')](),controller[_0xca0f('0x1d')]);router[_0xca0f('0x18')](_0xca0f('0x12'),auth['isAuthenticated'](),controller[_0xca0f('0x1e')]);router['post'](_0xca0f('0x1f'),auth[_0xca0f('0x9')](),controller[_0xca0f('0x20')]);router[_0xca0f('0x18')](_0xca0f('0x21'),auth[_0xca0f('0x9')](),controller['updateAccountApplications']);router[_0xca0f('0x18')](_0xca0f('0x22'),auth[_0xca0f('0x9')](),controller[_0xca0f('0x23')]);router['post'](_0xca0f('0x16'),auth['isAuthenticated'](),controller[_0xca0f('0x24')]);router[_0xca0f('0x25')](_0xca0f('0xc'),auth[_0xca0f('0x9')](),controller[_0xca0f('0x26')]);router[_0xca0f('0x27')](_0xca0f('0xc'),auth[_0xca0f('0x9')](),controller[_0xca0f('0x28')]);router[_0xca0f('0x27')](_0xca0f('0xe'),auth[_0xca0f('0x9')](),controller['removeDispositions']);router[_0xca0f('0x27')](_0xca0f('0x1b'),auth[_0xca0f('0x9')](),controller[_0xca0f('0x29')]);router['delete'](_0xca0f('0x16'),auth[_0xca0f('0x9')](),controller['removeAgents']);module[_0xca0f('0x2a')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index e9023d9..b4e0491 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 _0xd224=['INTEGER','STRING','noop','TEXT','*,*,*,*','exports'];(function(_0x3cba93,_0x5c2fd8){var _0x4a2991=function(_0x3cf95b){while(--_0x3cf95b){_0x3cba93['push'](_0x3cba93['shift']());}};_0x4a2991(++_0x5c2fd8);}(_0xd224,0x1a9));var _0x4d22=function(_0x120b45,_0x3d5c8e){_0x120b45=_0x120b45-0x0;var _0x5162db=_0xd224[_0x120b45];return _0x5162db;};'use strict';var Sequelize=require('sequelize');module[_0x4d22('0x0')]={'priority':{'type':Sequelize[_0x4d22('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x4d22('0x2')],'allowNull':![],'defaultValue':_0x4d22('0x3')},'appdata':{'type':Sequelize[_0x4d22('0x4')]()},'description':{'type':Sequelize[_0x4d22('0x2')]},'interval':{'type':Sequelize[_0x4d22('0x2')],'defaultValue':_0x4d22('0x5')}}; \ No newline at end of file +var _0xa2f9=['STRING','noop','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x5d4d30,_0x1b0c09){var _0x2606c4=function(_0x97432d){while(--_0x97432d){_0x5d4d30['push'](_0x5d4d30['shift']());}};_0x2606c4(++_0x1b0c09);}(_0xa2f9,0x195));var _0x9a2f=function(_0x2304ce,_0x5e2bb0){_0x2304ce=_0x2304ce-0x0;var _0x503964=_0xa2f9[_0x2304ce];return _0x503964;};'use strict';var Sequelize=require(_0x9a2f('0x0'));module[_0x9a2f('0x1')]={'priority':{'type':Sequelize[_0x9a2f('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x9a2f('0x3')],'allowNull':![],'defaultValue':_0x9a2f('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x9a2f('0x3')]},'interval':{'type':Sequelize[_0x9a2f('0x3')],'defaultValue':_0x9a2f('0x5')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 6322beb..cb68180 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 _0x290d=['rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','reject','save','update','destroy','error','stack','name','send','FaxApplication','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','catch','find','create','body','params'];(function(_0x3bef36,_0x43009f){var _0x4838c9=function(_0x292b3a){while(--_0x292b3a){_0x3bef36['push'](_0x3bef36['shift']());}};_0x4838c9(++_0x43009f);}(_0x290d,0xdb));var _0xd290=function(_0x37f614,_0xc94b50){_0x37f614=_0x37f614-0x0;var _0x487bac=_0x290d[_0x37f614];return _0x487bac;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd290('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd290('0x1'));var rp=require(_0xd290('0x2'));var moment=require(_0xd290('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd290('0x4'));var path=require(_0xd290('0x5'));var sox=require(_0xd290('0x6'));var csv=require(_0xd290('0x7'));var ejs=require(_0xd290('0x8'));var fs=require('fs');var fs_extra=require(_0xd290('0x9'));var _=require(_0xd290('0xa'));var squel=require(_0xd290('0xb'));var crypto=require('crypto');var jsforce=require(_0xd290('0xc'));var deskjs=require(_0xd290('0xd'));var toCsv=require(_0xd290('0x7'));var querystring=require(_0xd290('0xe'));var Papa=require(_0xd290('0xf'));var Redis=require(_0xd290('0x10'));var authService=require(_0xd290('0x11'));var qs=require(_0xd290('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd290('0x13'));var logger=require(_0xd290('0x14'))('api');var utils=require(_0xd290('0x15'));var config=require(_0xd290('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xd290('0x17'))['db'];function respondWithStatusCode(_0x9a288c,_0x48dacd){_0x48dacd=_0x48dacd||0xcc;return function(_0x4fec1e){if(_0x4fec1e){return _0x9a288c[_0xd290('0x18')](_0x48dacd);}return _0x9a288c[_0xd290('0x19')](_0x48dacd)[_0xd290('0x1a')]();};}function respondWithResult(_0x3eb629,_0xfa2f1a){_0xfa2f1a=_0xfa2f1a||0xc8;return function(_0x290b2d){if(_0x290b2d){return _0x3eb629[_0xd290('0x19')](_0xfa2f1a)[_0xd290('0x1b')](_0x290b2d);}};}function respondWithFilteredResult(_0x572b45,_0x1072e3){return function(_0x178864){if(_0x178864){var _0x3d4490=typeof _0x1072e3[_0xd290('0x1c')]===_0xd290('0x1d')&&typeof _0x1072e3['limit']===_0xd290('0x1d');var _0x4807d6=_0x178864[_0xd290('0x1e')];var _0x158604=_0x3d4490?0x0:_0x1072e3[_0xd290('0x1c')];var _0x4e984c=_0x3d4490?_0x178864['count']:_0x1072e3[_0xd290('0x1c')]+_0x1072e3['limit'];var _0x1d20fb;if(_0x4e984c>=_0x4807d6){_0x4e984c=_0x4807d6;_0x1d20fb=0xc8;}else{_0x1d20fb=0xce;}_0x572b45['status'](_0x1d20fb);return _0x572b45['set']('Content-Range',_0x158604+'-'+_0x4e984c+'/'+_0x4807d6)[_0xd290('0x1b')](_0x178864);}return null;};}function patchUpdates(_0x48a67f){return function(_0x170601){try{jsonpatch['apply'](_0x170601,_0x48a67f,!![]);}catch(_0x12fe78){return BPromise[_0xd290('0x1f')](_0x12fe78);}return _0x170601[_0xd290('0x20')]();};}function saveUpdates(_0x9aa24e,_0x144837){return function(_0xd3149a){if(_0xd3149a){return _0xd3149a[_0xd290('0x21')](_0x9aa24e)['then'](function(_0x119c37){return _0x119c37;});}return null;};}function removeEntity(_0x383ec9,_0x2bca70){return function(_0x483a18){if(_0x483a18){return _0x483a18[_0xd290('0x22')]()['then'](function(){_0x383ec9[_0xd290('0x19')](0xcc)[_0xd290('0x1a')]();});}};}function handleEntityNotFound(_0x55c4b0,_0x24db07){return function(_0x4a5eb1){if(!_0x4a5eb1){_0x55c4b0[_0xd290('0x18')](0x194);}return _0x4a5eb1;};}function handleError(_0x55b7d8,_0x590b37){_0x590b37=_0x590b37||0x1f4;return function(_0x5b3344){logger[_0xd290('0x23')](_0x5b3344[_0xd290('0x24')]);if(_0x5b3344[_0xd290('0x25')]){delete _0x5b3344[_0xd290('0x25')];}_0x55b7d8['status'](_0x590b37)[_0xd290('0x26')](_0x5b3344);};}exports['index']=function(_0x1a8272,_0x26ce5f){var _0x5beefe={},_0x47ce85={},_0x38e6a7={'count':0x0,'rows':[]};var _0x5d53ff=_['map'](db[_0xd290('0x27')][_0xd290('0x28')],function(_0x49f3bd){return{'name':_0x49f3bd[_0xd290('0x29')],'type':_0x49f3bd[_0xd290('0x2a')][_0xd290('0x2b')]};});_0x47ce85[_0xd290('0x2c')]=_[_0xd290('0x2d')](_0x5d53ff,'name');_0x47ce85[_0xd290('0x2e')]=_[_0xd290('0x2f')](_0x1a8272[_0xd290('0x2e')]);_0x47ce85[_0xd290('0x30')]=_[_0xd290('0x31')](_0x47ce85[_0xd290('0x2c')],_0x47ce85[_0xd290('0x2e')]);_0x5beefe[_0xd290('0x32')]=_['intersection'](_0x47ce85[_0xd290('0x2c')],qs['fields'](_0x1a8272['query'][_0xd290('0x33')]));_0x5beefe[_0xd290('0x32')]=_0x5beefe[_0xd290('0x32')][_0xd290('0x34')]?_0x5beefe[_0xd290('0x32')]:_0x47ce85[_0xd290('0x2c')];if(!_0x1a8272[_0xd290('0x2e')][_0xd290('0x35')](_0xd290('0x36'))){_0x5beefe[_0xd290('0x37')]=qs['limit'](_0x1a8272[_0xd290('0x2e')][_0xd290('0x37')]);_0x5beefe[_0xd290('0x1c')]=qs[_0xd290('0x1c')](_0x1a8272[_0xd290('0x2e')][_0xd290('0x1c')]);}_0x5beefe[_0xd290('0x38')]=qs['sort'](_0x1a8272[_0xd290('0x2e')][_0xd290('0x39')]);_0x5beefe[_0xd290('0x3a')]=qs[_0xd290('0x30')](_[_0xd290('0x3b')](_0x1a8272[_0xd290('0x2e')],_0x47ce85[_0xd290('0x30')]),_0x5d53ff);if(_0x1a8272[_0xd290('0x2e')][_0xd290('0x3c')]){_0x5beefe['where']=_[_0xd290('0x3d')](_0x5beefe[_0xd290('0x3a')],{'$or':_[_0xd290('0x2d')](_0x5d53ff,function(_0x45c351){if(_0x45c351['type']!==_0xd290('0x3e')){var _0x452d8c={};_0x452d8c[_0x45c351['name']]={'$like':'%'+_0x1a8272['query'][_0xd290('0x3c')]+'%'};return _0x452d8c;}})});}_0x5beefe=_[_0xd290('0x3d')]({},_0x5beefe,_0x1a8272[_0xd290('0x3f')]);var _0x5515fd={'where':_0x5beefe[_0xd290('0x3a')]};return db['FaxApplication'][_0xd290('0x1e')](_0x5515fd)[_0xd290('0x40')](function(_0x2d9fc7){_0x38e6a7['count']=_0x2d9fc7;if(_0x1a8272['query'][_0xd290('0x41')]){_0x5beefe[_0xd290('0x42')]=[{'all':!![]}];}return db[_0xd290('0x27')][_0xd290('0x43')](_0x5beefe);})[_0xd290('0x40')](function(_0x320531){_0x38e6a7['rows']=_0x320531;return _0x38e6a7;})[_0xd290('0x40')](respondWithFilteredResult(_0x26ce5f,_0x5beefe))[_0xd290('0x44')](handleError(_0x26ce5f,null));};exports['show']=function(_0xc3aa29,_0x4f8ad4){var _0x2c7212={'raw':!![],'where':{'id':_0xc3aa29['params']['id']}},_0x13da59={};_0x13da59[_0xd290('0x2c')]=_[_0xd290('0x2f')](db[_0xd290('0x27')][_0xd290('0x28')]);_0x13da59[_0xd290('0x2e')]=_[_0xd290('0x2f')](_0xc3aa29[_0xd290('0x2e')]);_0x13da59[_0xd290('0x30')]=_['intersection'](_0x13da59[_0xd290('0x2c')],_0x13da59[_0xd290('0x2e')]);_0x2c7212[_0xd290('0x32')]=_['intersection'](_0x13da59[_0xd290('0x2c')],qs['fields'](_0xc3aa29['query'][_0xd290('0x33')]));_0x2c7212[_0xd290('0x32')]=_0x2c7212[_0xd290('0x32')]['length']?_0x2c7212[_0xd290('0x32')]:_0x13da59[_0xd290('0x2c')];if(_0xc3aa29[_0xd290('0x2e')][_0xd290('0x41')]){_0x2c7212[_0xd290('0x42')]=[{'all':!![]}];}_0x2c7212=_[_0xd290('0x3d')]({},_0x2c7212,_0xc3aa29[_0xd290('0x3f')]);return db[_0xd290('0x27')][_0xd290('0x45')](_0x2c7212)['then'](handleEntityNotFound(_0x4f8ad4,null))[_0xd290('0x40')](respondWithResult(_0x4f8ad4,null))['catch'](handleError(_0x4f8ad4,null));};exports[_0xd290('0x46')]=function(_0x277fb6,_0x4aaac4){return db[_0xd290('0x27')]['create'](_0x277fb6[_0xd290('0x47')],{})['then'](respondWithResult(_0x4aaac4,0xc9))[_0xd290('0x44')](handleError(_0x4aaac4,null));};exports[_0xd290('0x21')]=function(_0x28d434,_0x87a665){if(_0x28d434['body']['id']){delete _0x28d434['body']['id'];}return db['FaxApplication']['find']({'where':{'id':_0x28d434[_0xd290('0x48')]['id']}})[_0xd290('0x40')](handleEntityNotFound(_0x87a665,null))[_0xd290('0x40')](saveUpdates(_0x28d434[_0xd290('0x47')],null))['then'](respondWithResult(_0x87a665,null))[_0xd290('0x44')](handleError(_0x87a665,null));};exports[_0xd290('0x22')]=function(_0x20ad4b,_0x221ef5){return db['FaxApplication'][_0xd290('0x45')]({'where':{'id':_0x20ad4b[_0xd290('0x48')]['id']}})[_0xd290('0x40')](handleEntityNotFound(_0x221ef5,null))['then'](removeEntity(_0x221ef5,null))['catch'](handleError(_0x221ef5,null));}; \ No newline at end of file +var _0x98b8=['sox','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','FaxApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','zip-dir','moment','bluebird','mustache','util','path'];(function(_0x5a89ea,_0x436388){var _0x21193d=function(_0x1a9118){while(--_0x1a9118){_0x5a89ea['push'](_0x5a89ea['shift']());}};_0x21193d(++_0x436388);}(_0x98b8,0x11a));var _0x898b=function(_0x39ce7f,_0x449ab4){_0x39ce7f=_0x39ce7f-0x0;var _0x22a931=_0x98b8[_0x39ce7f];return _0x22a931;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x898b('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x898b('0x1'));var BPromise=require(_0x898b('0x2'));var Mustache=require(_0x898b('0x3'));var util=require(_0x898b('0x4'));var path=require(_0x898b('0x5'));var sox=require(_0x898b('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x898b('0x7'));var _=require('lodash');var squel=require(_0x898b('0x8'));var crypto=require('crypto');var jsforce=require(_0x898b('0x9'));var deskjs=require(_0x898b('0xa'));var toCsv=require(_0x898b('0xb'));var querystring=require(_0x898b('0xc'));var Papa=require(_0x898b('0xd'));var Redis=require('ioredis');var authService=require(_0x898b('0xe'));var qs=require(_0x898b('0xf'));var as=require(_0x898b('0x10'));var hardwareService=require(_0x898b('0x11'));var logger=require('../../config/logger')(_0x898b('0x12'));var utils=require(_0x898b('0x13'));var config=require(_0x898b('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a23ed,_0x5f6f49){_0x5f6f49=_0x5f6f49||0xcc;return function(_0x56265a){if(_0x56265a){return _0x1a23ed[_0x898b('0x15')](_0x5f6f49);}return _0x1a23ed[_0x898b('0x16')](_0x5f6f49)['end']();};}function respondWithResult(_0x2d3615,_0x1dea52){_0x1dea52=_0x1dea52||0xc8;return function(_0x1ef095){if(_0x1ef095){return _0x2d3615[_0x898b('0x16')](_0x1dea52)[_0x898b('0x17')](_0x1ef095);}};}function respondWithFilteredResult(_0x4e87f1,_0x10a548){return function(_0x15b749){if(_0x15b749){var _0x3642ae=typeof _0x10a548[_0x898b('0x18')]===_0x898b('0x19')&&typeof _0x10a548[_0x898b('0x1a')]===_0x898b('0x19');var _0x25c867=_0x15b749['count'];var _0x3a8245=_0x3642ae?0x0:_0x10a548[_0x898b('0x18')];var _0x4a50f6=_0x3642ae?_0x15b749[_0x898b('0x1b')]:_0x10a548[_0x898b('0x18')]+_0x10a548[_0x898b('0x1a')];var _0x5724e5;if(_0x4a50f6>=_0x25c867){_0x4a50f6=_0x25c867;_0x5724e5=0xc8;}else{_0x5724e5=0xce;}_0x4e87f1[_0x898b('0x16')](_0x5724e5);return _0x4e87f1['set'](_0x898b('0x1c'),_0x3a8245+'-'+_0x4a50f6+'/'+_0x25c867)[_0x898b('0x17')](_0x15b749);}return null;};}function patchUpdates(_0x1a4a18){return function(_0x51e387){try{jsonpatch[_0x898b('0x1d')](_0x51e387,_0x1a4a18,!![]);}catch(_0x9a13b4){return BPromise[_0x898b('0x1e')](_0x9a13b4);}return _0x51e387[_0x898b('0x1f')]();};}function saveUpdates(_0x52cc7e,_0x4a4569){return function(_0x1e79c6){if(_0x1e79c6){return _0x1e79c6[_0x898b('0x20')](_0x52cc7e)[_0x898b('0x21')](function(_0x24acfc){return _0x24acfc;});}return null;};}function removeEntity(_0x868b90,_0x531895){return function(_0x19541b){if(_0x19541b){return _0x19541b[_0x898b('0x22')]()[_0x898b('0x21')](function(){_0x868b90[_0x898b('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe50df0,_0x4e1fb2){return function(_0x32a0fe){if(!_0x32a0fe){_0xe50df0[_0x898b('0x15')](0x194);}return _0x32a0fe;};}function handleError(_0x14b81d,_0xc43509){_0xc43509=_0xc43509||0x1f4;return function(_0x910834){logger[_0x898b('0x23')](_0x910834[_0x898b('0x24')]);if(_0x910834[_0x898b('0x25')]){delete _0x910834[_0x898b('0x25')];}_0x14b81d[_0x898b('0x16')](_0xc43509)[_0x898b('0x26')](_0x910834);};}exports[_0x898b('0x27')]=function(_0x1cc9aa,_0x2ed054){var _0x3b4648={},_0x2a5178={},_0x7a2f6b={'count':0x0,'rows':[]};var _0x9c8aa7=_[_0x898b('0x28')](db[_0x898b('0x29')][_0x898b('0x2a')],function(_0x472374){return{'name':_0x472374[_0x898b('0x2b')],'type':_0x472374[_0x898b('0x2c')][_0x898b('0x2d')]};});_0x2a5178[_0x898b('0x2e')]=_[_0x898b('0x28')](_0x9c8aa7,'name');_0x2a5178[_0x898b('0x2f')]=_[_0x898b('0x30')](_0x1cc9aa[_0x898b('0x2f')]);_0x2a5178[_0x898b('0x31')]=_[_0x898b('0x32')](_0x2a5178[_0x898b('0x2e')],_0x2a5178[_0x898b('0x2f')]);_0x3b4648[_0x898b('0x33')]=_[_0x898b('0x32')](_0x2a5178['model'],qs[_0x898b('0x34')](_0x1cc9aa[_0x898b('0x2f')]['fields']));_0x3b4648['attributes']=_0x3b4648['attributes'][_0x898b('0x35')]?_0x3b4648[_0x898b('0x33')]:_0x2a5178[_0x898b('0x2e')];if(!_0x1cc9aa['query'][_0x898b('0x36')](_0x898b('0x37'))){_0x3b4648[_0x898b('0x1a')]=qs[_0x898b('0x1a')](_0x1cc9aa['query'][_0x898b('0x1a')]);_0x3b4648[_0x898b('0x18')]=qs['offset'](_0x1cc9aa[_0x898b('0x2f')][_0x898b('0x18')]);}_0x3b4648[_0x898b('0x38')]=qs[_0x898b('0x39')](_0x1cc9aa['query'][_0x898b('0x39')]);_0x3b4648['where']=qs[_0x898b('0x31')](_['pick'](_0x1cc9aa[_0x898b('0x2f')],_0x2a5178[_0x898b('0x31')]),_0x9c8aa7);if(_0x1cc9aa[_0x898b('0x2f')]['filter']){_0x3b4648[_0x898b('0x3a')]=_[_0x898b('0x3b')](_0x3b4648[_0x898b('0x3a')],{'$or':_[_0x898b('0x28')](_0x9c8aa7,function(_0x13a266){if(_0x13a266['type']!=='VIRTUAL'){var _0x517312={};_0x517312[_0x13a266[_0x898b('0x25')]]={'$like':'%'+_0x1cc9aa['query'][_0x898b('0x3c')]+'%'};return _0x517312;}})});}_0x3b4648=_[_0x898b('0x3b')]({},_0x3b4648,_0x1cc9aa[_0x898b('0x3d')]);var _0x4fa6ad={'where':_0x3b4648[_0x898b('0x3a')]};return db[_0x898b('0x29')]['count'](_0x4fa6ad)['then'](function(_0x125405){_0x7a2f6b[_0x898b('0x1b')]=_0x125405;if(_0x1cc9aa['query'][_0x898b('0x3e')]){_0x3b4648[_0x898b('0x3f')]=[{'all':!![]}];}return db['FaxApplication'][_0x898b('0x40')](_0x3b4648);})['then'](function(_0x19b26f){_0x7a2f6b[_0x898b('0x41')]=_0x19b26f;return _0x7a2f6b;})[_0x898b('0x21')](respondWithFilteredResult(_0x2ed054,_0x3b4648))[_0x898b('0x42')](handleError(_0x2ed054,null));};exports[_0x898b('0x43')]=function(_0x446feb,_0x114e74){var _0x49f62a={'raw':!![],'where':{'id':_0x446feb[_0x898b('0x44')]['id']}},_0x18e1d4={};_0x18e1d4[_0x898b('0x2e')]=_[_0x898b('0x30')](db[_0x898b('0x29')][_0x898b('0x2a')]);_0x18e1d4[_0x898b('0x2f')]=_[_0x898b('0x30')](_0x446feb[_0x898b('0x2f')]);_0x18e1d4[_0x898b('0x31')]=_[_0x898b('0x32')](_0x18e1d4['model'],_0x18e1d4[_0x898b('0x2f')]);_0x49f62a[_0x898b('0x33')]=_[_0x898b('0x32')](_0x18e1d4[_0x898b('0x2e')],qs[_0x898b('0x34')](_0x446feb['query'][_0x898b('0x34')]));_0x49f62a[_0x898b('0x33')]=_0x49f62a[_0x898b('0x33')][_0x898b('0x35')]?_0x49f62a[_0x898b('0x33')]:_0x18e1d4['model'];if(_0x446feb[_0x898b('0x2f')][_0x898b('0x3e')]){_0x49f62a[_0x898b('0x3f')]=[{'all':!![]}];}_0x49f62a=_[_0x898b('0x3b')]({},_0x49f62a,_0x446feb[_0x898b('0x3d')]);return db[_0x898b('0x29')][_0x898b('0x45')](_0x49f62a)[_0x898b('0x21')](handleEntityNotFound(_0x114e74,null))['then'](respondWithResult(_0x114e74,null))[_0x898b('0x42')](handleError(_0x114e74,null));};exports['create']=function(_0x280c88,_0x1f6dac){return db[_0x898b('0x29')][_0x898b('0x46')](_0x280c88[_0x898b('0x47')],{})[_0x898b('0x21')](respondWithResult(_0x1f6dac,0xc9))[_0x898b('0x42')](handleError(_0x1f6dac,null));};exports[_0x898b('0x20')]=function(_0x4bfa33,_0x115f7e){if(_0x4bfa33[_0x898b('0x47')]['id']){delete _0x4bfa33[_0x898b('0x47')]['id'];}return db[_0x898b('0x29')][_0x898b('0x45')]({'where':{'id':_0x4bfa33[_0x898b('0x44')]['id']}})[_0x898b('0x21')](handleEntityNotFound(_0x115f7e,null))[_0x898b('0x21')](saveUpdates(_0x4bfa33['body'],null))[_0x898b('0x21')](respondWithResult(_0x115f7e,null))[_0x898b('0x42')](handleError(_0x115f7e,null));};exports[_0x898b('0x22')]=function(_0x2b7a71,_0x1ed65e){return db[_0x898b('0x29')][_0x898b('0x45')]({'where':{'id':_0x2b7a71[_0x898b('0x44')]['id']}})['then'](handleEntityNotFound(_0x1ed65e,null))['then'](removeEntity(_0x1ed65e,null))[_0x898b('0x42')](handleError(_0x1ed65e,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 4b537b4..6f76a62 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 _0x9754=['request-promise','rimraf','../../config/environment','exports','define','FaxApplication','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird'];(function(_0x43576f,_0x1356ed){var _0x4d2466=function(_0x865deb){while(--_0x865deb){_0x43576f['push'](_0x43576f['shift']());}};_0x4d2466(++_0x1356ed);}(_0x9754,0x1d5));var _0x4975=function(_0x54a02c,_0x5944d1){_0x54a02c=_0x54a02c-0x0;var _0x5ca521=_0x9754[_0x54a02c];return _0x5ca521;};'use strict';var _=require('lodash');var util=require(_0x4975('0x0'));var logger=require(_0x4975('0x1'))('api');var moment=require(_0x4975('0x2'));var BPromise=require(_0x4975('0x3'));var rp=require(_0x4975('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4975('0x5'));var config=require(_0x4975('0x6'));var attributes=require('./faxApplication.attributes');module[_0x4975('0x7')]=function(_0x42fa0c,_0xd77bee){return _0x42fa0c[_0x4975('0x8')](_0x4975('0x9'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x4975('0xa')});}; \ No newline at end of file +var _0xf868=['rimraf','exports','define','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird'];(function(_0x30ac91,_0x166518){var _0x5a55f7=function(_0x2095a4){while(--_0x2095a4){_0x30ac91['push'](_0x30ac91['shift']());}};_0x5a55f7(++_0x166518);}(_0xf868,0x187));var _0x8f86=function(_0x421e20,_0x1f4579){_0x421e20=_0x421e20-0x0;var _0xfd5262=_0xf868[_0x421e20];return _0xfd5262;};'use strict';var _=require('lodash');var util=require(_0x8f86('0x0'));var logger=require(_0x8f86('0x1'))(_0x8f86('0x2'));var moment=require(_0x8f86('0x3'));var BPromise=require(_0x8f86('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8f86('0x5'));var config=require('../../config/environment');var attributes=require('./faxApplication.attributes');module[_0x8f86('0x6')]=function(_0x2c6314,_0x54d005){return _0x2c6314[_0x8f86('0x7')](_0x8f86('0x8'),attributes,{'tableName':_0x8f86('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8f86('0xa'),'collate':_0x8f86('0xb')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index adf97d1..d291be6 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 _0xe93b=['limit','stringify','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','error','code','FaxApplication,\x20%s,\x20%s','message','info','result','catch','UpdateFaxApplication','FaxApplication','update','body','options','where'];(function(_0x29a29f,_0x155ce7){var _0x443ea3=function(_0xe0dd24){while(--_0xe0dd24){_0x29a29f['push'](_0x29a29f['shift']());}};_0x443ea3(++_0x155ce7);}(_0xe93b,0x16a));var _0xbe93=function(_0x47dc5d,_0x1c1055){_0x47dc5d=_0x47dc5d-0x0;var _0x120c38=_0xe93b[_0x47dc5d];return _0x120c38;};'use strict';var _=require(_0xbe93('0x0'));var util=require(_0xbe93('0x1'));var moment=require(_0xbe93('0x2'));var BPromise=require(_0xbe93('0x3'));var rs=require(_0xbe93('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbe93('0x5'));var logger=require(_0xbe93('0x6'))(_0xbe93('0x7'));var config=require(_0xbe93('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbe93('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2dd8aa,_0x2d5f9a,_0x3ab63c){return new BPromise(function(_0x396b8c,_0x1edee5){return client[_0xbe93('0xa')](_0x2dd8aa,_0x3ab63c)[_0xbe93('0xb')](function(_0x35ac7f){logger['info']('FaxApplication,\x20%s,\x20%s',_0x2d5f9a,_0xbe93('0xc'));logger[_0xbe93('0xd')](_0xbe93('0xe'),_0x2d5f9a,_0xbe93('0xc'),JSON['stringify'](_0x35ac7f));if(_0x35ac7f[_0xbe93('0xf')]){if(_0x35ac7f[_0xbe93('0xf')][_0xbe93('0x10')]===0x1f4){logger[_0xbe93('0xf')](_0xbe93('0x11'),_0x2d5f9a,_0x35ac7f[_0xbe93('0xf')]['message']);return _0x1edee5(_0x35ac7f['error'][_0xbe93('0x12')]);}logger['error']('FaxApplication,\x20%s,\x20%s',_0x2d5f9a,_0x35ac7f[_0xbe93('0xf')]['message']);return _0x396b8c(_0x35ac7f['error'][_0xbe93('0x12')]);}else{logger[_0xbe93('0x13')](_0xbe93('0x11'),_0x2d5f9a,_0xbe93('0xc'));_0x396b8c(_0x35ac7f[_0xbe93('0x14')][_0xbe93('0x12')]);}})[_0xbe93('0x15')](function(_0x4c159d){logger[_0xbe93('0xf')](_0xbe93('0x11'),_0x2d5f9a,_0x4c159d);_0x1edee5(_0x4c159d);});});}exports[_0xbe93('0x16')]=function(_0x473c98){var _0x45ca1d=this;return new Promise(function(_0xd79b70,_0xcf665d){return db[_0xbe93('0x17')][_0xbe93('0x18')](_0x473c98[_0xbe93('0x19')],{'raw':_0x473c98[_0xbe93('0x1a')]?_0x473c98[_0xbe93('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x473c98[_0xbe93('0x1a')]?_0x473c98[_0xbe93('0x1a')][_0xbe93('0x1b')]||null:null,'attributes':_0x473c98[_0xbe93('0x1a')]?_0x473c98[_0xbe93('0x1a')]['attributes']||null:null,'limit':_0x473c98[_0xbe93('0x1a')]?_0x473c98['options'][_0xbe93('0x1c')]||null:null})[_0xbe93('0xb')](function(_0x5233c7){logger[_0xbe93('0x13')](_0xbe93('0x16'),_0x473c98);logger[_0xbe93('0xd')]('UpdateFaxApplication',_0x473c98,JSON[_0xbe93('0x1d')](_0x5233c7));_0xd79b70(_0x5233c7);})['catch'](function(_0x37178f){logger['error'](_0xbe93('0x16'),_0x37178f['message'],_0x473c98);_0xcf665d(_0x45ca1d[_0xbe93('0xf')](0x1f4,_0x37178f[_0xbe93('0x12')]));});});}; \ No newline at end of file +var _0x8342=['UpdateFaxApplication','FaxApplication','update','options','raw','where','attributes','limit','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','then','info','request\x20sent','stringify','code','error','FaxApplication,\x20%s,\x20%s','message','catch'];(function(_0x36376b,_0x4b81a8){var _0x307e43=function(_0x1d2918){while(--_0x1d2918){_0x36376b['push'](_0x36376b['shift']());}};_0x307e43(++_0x4b81a8);}(_0x8342,0x121));var _0x2834=function(_0x564d53,_0x31ac8a){_0x564d53=_0x564d53-0x0;var _0x1ba891=_0x8342[_0x564d53];return _0x1ba891;};'use strict';var _=require(_0x2834('0x0'));var util=require(_0x2834('0x1'));var moment=require(_0x2834('0x2'));var BPromise=require(_0x2834('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2834('0x4'));var db=require(_0x2834('0x5'))['db'];var utils=require(_0x2834('0x6'));var logger=require(_0x2834('0x7'))('rpc');var config=require(_0x2834('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2834('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x28901a,_0x2e2c39,_0x42824e){return new BPromise(function(_0x4e488a,_0x52d3a7){return client['request'](_0x28901a,_0x42824e)[_0x2834('0xa')](function(_0x383c0d){logger[_0x2834('0xb')]('FaxApplication,\x20%s,\x20%s',_0x2e2c39,_0x2834('0xc'));logger['debug']('FaxApplication,\x20%s,\x20%s,\x20%s',_0x2e2c39,'request\x20sent',JSON[_0x2834('0xd')](_0x383c0d));if(_0x383c0d['error']){if(_0x383c0d['error'][_0x2834('0xe')]===0x1f4){logger[_0x2834('0xf')](_0x2834('0x10'),_0x2e2c39,_0x383c0d[_0x2834('0xf')][_0x2834('0x11')]);return _0x52d3a7(_0x383c0d[_0x2834('0xf')][_0x2834('0x11')]);}logger[_0x2834('0xf')](_0x2834('0x10'),_0x2e2c39,_0x383c0d[_0x2834('0xf')][_0x2834('0x11')]);return _0x4e488a(_0x383c0d['error'][_0x2834('0x11')]);}else{logger[_0x2834('0xb')](_0x2834('0x10'),_0x2e2c39,_0x2834('0xc'));_0x4e488a(_0x383c0d['result'][_0x2834('0x11')]);}})[_0x2834('0x12')](function(_0x17dd52){logger[_0x2834('0xf')]('FaxApplication,\x20%s,\x20%s',_0x2e2c39,_0x17dd52);_0x52d3a7(_0x17dd52);});});}exports[_0x2834('0x13')]=function(_0x31f39c){var _0x5246b9=this;return new Promise(function(_0x9df21a,_0x236c4e){return db[_0x2834('0x14')][_0x2834('0x15')](_0x31f39c['body'],{'raw':_0x31f39c[_0x2834('0x16')]?_0x31f39c[_0x2834('0x16')][_0x2834('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x31f39c['options']?_0x31f39c['options'][_0x2834('0x18')]||null:null,'attributes':_0x31f39c[_0x2834('0x16')]?_0x31f39c['options'][_0x2834('0x19')]||null:null,'limit':_0x31f39c[_0x2834('0x16')]?_0x31f39c[_0x2834('0x16')][_0x2834('0x1a')]||null:null})[_0x2834('0xa')](function(_0x5e8bef){logger[_0x2834('0xb')](_0x2834('0x13'),_0x31f39c);logger[_0x2834('0x1b')](_0x2834('0x13'),_0x31f39c,JSON['stringify'](_0x5e8bef));_0x9df21a(_0x5e8bef);})[_0x2834('0x12')](function(_0x2dca11){logger[_0x2834('0xf')](_0x2834('0x13'),_0x2dca11['message'],_0x31f39c);_0x236c4e(_0x5246b9[_0x2834('0xf')](0x1f4,_0x2dca11['message']));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index c97bbd7..e496819 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 _0x955f=['path','connect-timeout','express','fs-extra','../../config/environment','get','isAuthenticated','index','/:id','post','create','put','update','destroy','exports','multer','util'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x955f,0x1eb));var _0xf955=function(_0x5f372b,_0x1819d9){_0x5f372b=_0x5f372b-0x0;var _0x3dbe9c=_0x955f[_0x5f372b];return _0x3dbe9c;};'use strict';var multer=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var path=require(_0xf955('0x2'));var timeout=require(_0xf955('0x3'));var express=require(_0xf955('0x4'));var router=express['Router']();var fs_extra=require(_0xf955('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf955('0x6'));var controller=require('./faxApplication.controller');router[_0xf955('0x7')]('/',auth[_0xf955('0x8')](),controller[_0xf955('0x9')]);router['get'](_0xf955('0xa'),auth[_0xf955('0x8')](),controller['show']);router[_0xf955('0xb')]('/',auth[_0xf955('0x8')](),controller[_0xf955('0xc')]);router[_0xf955('0xd')](_0xf955('0xa'),auth[_0xf955('0x8')](),controller[_0xf955('0xe')]);router['delete'](_0xf955('0xa'),auth['isAuthenticated'](),controller[_0xf955('0xf')]);module[_0xf955('0x10')]=router; \ No newline at end of file +var _0x13f6=['delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxApplication.controller','isAuthenticated','index','post','create','put','update'];(function(_0x5e7137,_0x11418a){var _0x4ba22c=function(_0xe68361){while(--_0xe68361){_0x5e7137['push'](_0x5e7137['shift']());}};_0x4ba22c(++_0x11418a);}(_0x13f6,0x124));var _0x613f=function(_0xaaab26,_0x462a42){_0xaaab26=_0xaaab26-0x0;var _0x4a4172=_0x13f6[_0xaaab26];return _0x4a4172;};'use strict';var multer=require(_0x613f('0x0'));var util=require(_0x613f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x613f('0x2'));var router=express[_0x613f('0x3')]();var fs_extra=require(_0x613f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x613f('0x5'));var config=require(_0x613f('0x6'));var controller=require(_0x613f('0x7'));router['get']('/',auth[_0x613f('0x8')](),controller[_0x613f('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x613f('0xa')]('/',auth[_0x613f('0x8')](),controller[_0x613f('0xb')]);router[_0x613f('0xc')]('/:id',auth[_0x613f('0x8')](),controller[_0x613f('0xd')]);router[_0x613f('0xe')]('/:id',auth[_0x613f('0x8')](),controller[_0x613f('0xf')]);module[_0x613f('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 33c7e23..06dc7b0 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 _0xe3da=['DATE','STRING','ENUM','out','INTEGER','sequelize','exports','BOOLEAN'];(function(_0x4bb2d6,_0x574fe3){var _0xfa04ff=function(_0x14d1a4){while(--_0x14d1a4){_0x4bb2d6['push'](_0x4bb2d6['shift']());}};_0xfa04ff(++_0x574fe3);}(_0xe3da,0x1cd));var _0xae3d=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xe3da[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0xae3d('0x0'));module[_0xae3d('0x1')]={'closed':{'type':Sequelize[_0xae3d('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xae3d('0x3')]},'disposition':{'type':Sequelize[_0xae3d('0x4')]},'secondDisposition':{'type':Sequelize[_0xae3d('0x4')]},'thirdDisposition':{'type':Sequelize[_0xae3d('0x4')]},'note':{'type':Sequelize[_0xae3d('0x4')]},'read1stAt':{'type':Sequelize[_0xae3d('0x3')]},'fax':{'type':Sequelize[_0xae3d('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xae3d('0x5')]('in',_0xae3d('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xae3d('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xae3d('0x5')]('in',_0xae3d('0x6')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0xae3d('0x7')]}}; \ No newline at end of file +var _0x5f66=['INTEGER','exports','DATE','STRING','out'];(function(_0xfdda64,_0xc80f3){var _0x1d9c30=function(_0xfd77fd){while(--_0xfd77fd){_0xfdda64['push'](_0xfdda64['shift']());}};_0x1d9c30(++_0xc80f3);}(_0x5f66,0x1a0));var _0x65f6=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x5f66[_0x122096];return _0x3d1966;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x65f6('0x1')]},'disposition':{'type':Sequelize[_0x65f6('0x2')]},'secondDisposition':{'type':Sequelize[_0x65f6('0x2')]},'thirdDisposition':{'type':Sequelize[_0x65f6('0x2')]},'note':{'type':Sequelize[_0x65f6('0x2')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0x65f6('0x2')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x65f6('0x3')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x65f6('0x1')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x65f6('0x4')]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index b949ad1..fc2c077 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 _0x7e2c=['index','map','FaxInteraction','rawAttributes','type','getOptions','findAll','query','user','catch','show','params','keys','filters','model','attributes','intersection','fields','length','includeAll','include','merge','options','find','create','body','describe','FaxMessage','addMessage','ids','omit','getMessages','findOne','hasOwnProperty','order','sort','pick','where','FaxInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','spread','faxInteractionTags:save','removeTags','download','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','Attachment','Messages','createdAt','get','mkdirSync','basename','existsSync','createReadStream','createWriteStream','resolve','err','unlinkSync','rimraf','zip-dir','moment','bluebird','util','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','update','then','error','stack','name','send'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x7e2c,0x171));var _0xc7e2=function(_0x46cd90,_0x25b41a){_0x46cd90=_0x46cd90-0x0;var _0x3320b8=_0x7e2c[_0x46cd90];return _0x3320b8;};'use strict';var rimraf=require(_0xc7e2('0x0'));var zipdir=require(_0xc7e2('0x1'));var moment=require(_0xc7e2('0x2'));var BPromise=require(_0xc7e2('0x3'));var util=require(_0xc7e2('0x4'));var path=require('path');var fs=require('fs');var _=require(_0xc7e2('0x5'));var Redis=require(_0xc7e2('0x6'));var interaction=require('../../components/interaction/service');var qs=require(_0xc7e2('0x7'));var logger=require(_0xc7e2('0x8'))(_0xc7e2('0x9'));var config=require('../../config/environment');var db=require(_0xc7e2('0xa'))['db'];config[_0xc7e2('0xb')]=_[_0xc7e2('0xc')](config[_0xc7e2('0xb')],{'host':_0xc7e2('0xd'),'port':0x18eb});var socket=require(_0xc7e2('0xe'))(new Redis(config['redis']));require(_0xc7e2('0xf'))[_0xc7e2('0x10')](socket);function respondWithStatusCode(_0x131e8e,_0x5ea74c){_0x5ea74c=_0x5ea74c||0xcc;return function(_0x43035c){if(_0x43035c){return _0x131e8e[_0xc7e2('0x11')](_0x5ea74c);}return _0x131e8e[_0xc7e2('0x12')](_0x5ea74c)[_0xc7e2('0x13')]();};}function respondWithResult(_0x2cdb4d,_0x4f961c){_0x4f961c=_0x4f961c||0xc8;return function(_0x4e50c0){if(_0x4e50c0){return _0x2cdb4d[_0xc7e2('0x12')](_0x4f961c)[_0xc7e2('0x14')](_0x4e50c0);}};}function respondWithFilteredResult(_0x3db445,_0x3b8895){return function(_0x4c64bc){if(_0x4c64bc){var _0x5733cf=typeof _0x3b8895[_0xc7e2('0x15')]===_0xc7e2('0x16')&&typeof _0x3b8895['limit']==='undefined';var _0x3cbbc8=_0x4c64bc['count'];var _0x7d5258=_0x5733cf?0x0:_0x3b8895[_0xc7e2('0x15')];var _0x29ecd8=_0x5733cf?_0x4c64bc[_0xc7e2('0x17')]:_0x3b8895[_0xc7e2('0x15')]+_0x3b8895[_0xc7e2('0x18')];var _0x3da516;if(_0x29ecd8>=_0x3cbbc8){_0x29ecd8=_0x3cbbc8;_0x3da516=0xc8;}else{_0x3da516=0xce;}_0x3db445[_0xc7e2('0x12')](_0x3da516);return _0x3db445['set']('Content-Range',_0x7d5258+'-'+_0x29ecd8+'/'+_0x3cbbc8)[_0xc7e2('0x14')](_0x4c64bc);}return null;};}function saveUpdates(_0x2c3fb9){return function(_0x20b217){if(_0x20b217){return _0x20b217[_0xc7e2('0x19')](_0x2c3fb9)[_0xc7e2('0x1a')](function(_0x3f70e3){return _0x3f70e3;});}return null;};}function removeEntity(_0x268285){return function(_0x32e815){if(_0x32e815){return _0x32e815['destroy']()[_0xc7e2('0x1a')](function(){_0x268285['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c23cf){return function(_0x278720){if(!_0x278720){_0x2c23cf[_0xc7e2('0x11')](0x194);}return _0x278720;};}function handleError(_0x2e8d06,_0x11e844){_0x11e844=_0x11e844||0x1f4;return function(_0x27f2de){logger[_0xc7e2('0x1b')](_0x27f2de[_0xc7e2('0x1c')]);if(_0x27f2de[_0xc7e2('0x1d')]){delete _0x27f2de[_0xc7e2('0x1d')];}_0x2e8d06[_0xc7e2('0x12')](_0x11e844)[_0xc7e2('0x1e')](_0x27f2de);};}exports[_0xc7e2('0x1f')]=function(_0xafe89f,_0x12b2a6){var _0x14fb7b={};var _0x207212=_[_0xc7e2('0x20')](db[_0xc7e2('0x21')][_0xc7e2('0x22')],function(_0x1b9d22){return{'name':_0x1b9d22['fieldName'],'type':_0x1b9d22[_0xc7e2('0x23')]['key']};});_0x14fb7b=qs[_0xc7e2('0x24')](_0x207212,_0xafe89f);return interaction[_0xc7e2('0x25')]('fax',_0xafe89f[_0xc7e2('0x26')],_0xafe89f[_0xc7e2('0x27')],_0x14fb7b,_0x207212)['then'](respondWithFilteredResult(_0x12b2a6,_0x14fb7b))[_0xc7e2('0x28')](handleError(_0x12b2a6,null));};exports[_0xc7e2('0x29')]=function(_0x4a6d1b,_0x2f8cb7){var _0x54ba9c={'raw':![],'where':{'id':_0x4a6d1b[_0xc7e2('0x2a')]['id']}},_0x290d9f={};_0x290d9f['model']=_[_0xc7e2('0x2b')](db[_0xc7e2('0x21')][_0xc7e2('0x22')]);_0x290d9f[_0xc7e2('0x26')]=_[_0xc7e2('0x2b')](_0x4a6d1b[_0xc7e2('0x26')]);_0x290d9f[_0xc7e2('0x2c')]=_['intersection'](_0x290d9f[_0xc7e2('0x2d')],_0x290d9f[_0xc7e2('0x26')]);_0x54ba9c[_0xc7e2('0x2e')]=_[_0xc7e2('0x2f')](_0x290d9f[_0xc7e2('0x2d')],qs['fields'](_0x4a6d1b[_0xc7e2('0x26')][_0xc7e2('0x30')]));_0x54ba9c[_0xc7e2('0x2e')]=_0x54ba9c[_0xc7e2('0x2e')][_0xc7e2('0x31')]?_0x54ba9c['attributes']:_0x290d9f[_0xc7e2('0x2d')];if(_0x4a6d1b[_0xc7e2('0x26')][_0xc7e2('0x32')]){_0x54ba9c[_0xc7e2('0x33')]=[{'all':!![]}];}_0x54ba9c=_[_0xc7e2('0x34')]({},_0x54ba9c,_0x4a6d1b[_0xc7e2('0x35')]);return db[_0xc7e2('0x21')][_0xc7e2('0x36')](_0x54ba9c)[_0xc7e2('0x1a')](handleEntityNotFound(_0x2f8cb7,null))[_0xc7e2('0x1a')](respondWithResult(_0x2f8cb7,null))[_0xc7e2('0x28')](handleError(_0x2f8cb7,null));};exports[_0xc7e2('0x37')]=function(_0x58f525,_0x40d7ae){return db['FaxInteraction'][_0xc7e2('0x37')](_0x58f525['body'],{})[_0xc7e2('0x1a')](respondWithResult(_0x40d7ae,0xc9))[_0xc7e2('0x28')](handleError(_0x40d7ae,null));};exports['update']=function(_0x54b1e0,_0x239c4d){if(_0x54b1e0[_0xc7e2('0x38')]['id']){delete _0x54b1e0['body']['id'];}return db['FaxInteraction'][_0xc7e2('0x36')]({'where':{'id':_0x54b1e0['params']['id']}})[_0xc7e2('0x1a')](handleEntityNotFound(_0x239c4d,null))[_0xc7e2('0x1a')](saveUpdates(_0x54b1e0[_0xc7e2('0x38')],null))[_0xc7e2('0x1a')](respondWithResult(_0x239c4d,null))[_0xc7e2('0x28')](handleError(_0x239c4d,null));};exports['destroy']=function(_0x434271,_0xe58ba){return db[_0xc7e2('0x21')]['find']({'where':{'id':_0x434271['params']['id']}})[_0xc7e2('0x1a')](handleEntityNotFound(_0xe58ba,null))[_0xc7e2('0x1a')](removeEntity(_0xe58ba,null))[_0xc7e2('0x28')](handleError(_0xe58ba,null));};exports[_0xc7e2('0x39')]=function(_0x1c5ed1,_0x286180){return db[_0xc7e2('0x21')]['describe']()['then'](respondWithResult(_0x286180,null))[_0xc7e2('0x28')](handleError(_0x286180,null));};exports['addMessage']=function(_0x336152,_0x423a1c){return db[_0xc7e2('0x3a')][_0xc7e2('0x36')]({'where':{'id':_0x336152[_0xc7e2('0x2a')]['id']}})[_0xc7e2('0x1a')](handleEntityNotFound(_0x423a1c,null))[_0xc7e2('0x1a')](function(_0x4d6db4){if(_0x4d6db4){return _0x4d6db4[_0xc7e2('0x3b')](_0x336152[_0xc7e2('0x38')][_0xc7e2('0x3c')],_[_0xc7e2('0x3d')](_0x336152['body'],[_0xc7e2('0x3c'),'id'])||{});}})[_0xc7e2('0x1a')](respondWithResult(_0x423a1c,null))[_0xc7e2('0x28')](handleError(_0x423a1c,null));};exports[_0xc7e2('0x3e')]=function(_0x1a42fd,_0x3a2fcd){var _0x1a193c={'raw':![],'where':{}};var _0x22139b={};var _0x997a={'count':0x0,'rows':[]};return db[_0xc7e2('0x21')][_0xc7e2('0x3f')]({'where':{'id':_0x1a42fd[_0xc7e2('0x2a')]['id']}})[_0xc7e2('0x1a')](handleEntityNotFound(_0x3a2fcd,null))['then'](function(_0x3058c2){if(_0x3058c2){_0x22139b[_0xc7e2('0x2d')]=_[_0xc7e2('0x2b')](db[_0xc7e2('0x3a')][_0xc7e2('0x22')]);_0x22139b[_0xc7e2('0x26')]=_[_0xc7e2('0x2b')](_0x1a42fd[_0xc7e2('0x26')]);_0x22139b[_0xc7e2('0x2c')]=_[_0xc7e2('0x2f')](_0x22139b[_0xc7e2('0x2d')],_0x22139b[_0xc7e2('0x26')]);_0x1a193c[_0xc7e2('0x2e')]=_[_0xc7e2('0x2f')](_0x22139b['model'],qs[_0xc7e2('0x30')](_0x1a42fd[_0xc7e2('0x26')]['fields']));_0x1a193c[_0xc7e2('0x2e')]=_0x1a193c[_0xc7e2('0x2e')][_0xc7e2('0x31')]?_0x1a193c[_0xc7e2('0x2e')]:_0x22139b['model'];if(!_0x1a42fd[_0xc7e2('0x26')][_0xc7e2('0x40')]('nolimit')){_0x1a193c[_0xc7e2('0x18')]=qs['limit'](_0x1a42fd[_0xc7e2('0x26')][_0xc7e2('0x18')]);_0x1a193c[_0xc7e2('0x15')]=qs['offset'](_0x1a42fd['query'][_0xc7e2('0x15')]);}_0x1a193c[_0xc7e2('0x41')]=qs[_0xc7e2('0x42')](_0x1a42fd[_0xc7e2('0x26')][_0xc7e2('0x42')]);_0x1a193c['where']=qs[_0xc7e2('0x2c')](_[_0xc7e2('0x43')](_0x1a42fd['query'],_0x22139b['filters']));_0x1a193c[_0xc7e2('0x44')][_0xc7e2('0x45')]=_0x3058c2['id'];if(_0x1a42fd[_0xc7e2('0x26')][_0xc7e2('0x46')]){_0x1a193c['where']=_[_0xc7e2('0x34')](_0x1a193c['where'],{'$or':_[_0xc7e2('0x20')](_0x1a193c[_0xc7e2('0x2e')],function(_0x5c2e74){var _0x239b82={};_0x239b82[_0x5c2e74]={'$like':'%'+_0x1a42fd[_0xc7e2('0x26')][_0xc7e2('0x46')]+'%'};return _0x239b82;})});}if(_0x1a42fd[_0xc7e2('0x26')][_0xc7e2('0x47')]){var _0x151b71=_0x1a42fd[_0xc7e2('0x26')][_0xc7e2('0x47')][_0xc7e2('0x48')](',');var _0x293fbc={};_0x293fbc[_0x151b71[0x0]]={'$gte':moment(_0x151b71[0x1])[_0xc7e2('0x49')](_0xc7e2('0x4a'))};_0x1a193c[_0xc7e2('0x44')]=_[_0xc7e2('0x34')](_0x1a193c[_0xc7e2('0x44')],_0x293fbc);}_0x1a193c=_[_0xc7e2('0x34')]({},_0x1a193c,_0x1a42fd[_0xc7e2('0x35')]);return db[_0xc7e2('0x3a')][_0xc7e2('0x17')]({'where':_0x1a193c[_0xc7e2('0x44')]})[_0xc7e2('0x1a')](function(_0x4c711e){_0x997a[_0xc7e2('0x17')]=_0x4c711e;if(_0x1a42fd['query']['includeAll']){_0x1a193c['include']=[{'all':!![]}];}return db[_0xc7e2('0x3a')][_0xc7e2('0x25')](_0x1a193c);})[_0xc7e2('0x1a')](function(_0x130f49){_0x997a[_0xc7e2('0x4b')]=_0x130f49;return _0x997a;});}})['then'](respondWithFilteredResult(_0x3a2fcd,_0x1a193c))[_0xc7e2('0x28')](handleError(_0x3a2fcd,null));};exports[_0xc7e2('0x4c')]=function(_0x2c9df6,_0x303a7a){return db['FaxInteraction'][_0xc7e2('0x36')]({'where':{'id':_0x2c9df6[_0xc7e2('0x2a')]['id']}})[_0xc7e2('0x1a')](handleEntityNotFound(_0x303a7a,null))[_0xc7e2('0x1a')](function(_0x1ff955){if(_0x1ff955){return _0x1ff955['setTags'](_0x2c9df6[_0xc7e2('0x38')][_0xc7e2('0x3c')],_[_0xc7e2('0x3d')](_0x2c9df6[_0xc7e2('0x38')],['ids','id'])||{})[_0xc7e2('0x4d')](function(){return db['Tag'][_0xc7e2('0x25')]({'attributes':['id',_0xc7e2('0x1d'),'color'],'where':{'id':_0x2c9df6[_0xc7e2('0x38')][_0xc7e2('0x3c')]}});})[_0xc7e2('0x1a')](function(_0x117f1e){socket['emit'](_0xc7e2('0x4e'),{'id':Number(_0x2c9df6['params']['id']),'tags':_0x117f1e||[]});return{'id':Number(_0x2c9df6[_0xc7e2('0x2a')]['id']),'tags':_0x117f1e||[]};});}})['then'](respondWithResult(_0x303a7a,null))[_0xc7e2('0x28')](handleError(_0x303a7a,null));};exports[_0xc7e2('0x4f')]=function(_0x516eff,_0xd312c5){return db[_0xc7e2('0x21')][_0xc7e2('0x36')]({'where':{'id':_0x516eff[_0xc7e2('0x2a')]['id']}})[_0xc7e2('0x1a')](handleEntityNotFound(_0xd312c5,null))[_0xc7e2('0x1a')](function(_0x3ae99d){if(_0x3ae99d){return _0x3ae99d[_0xc7e2('0x4f')](_0x516eff[_0xc7e2('0x26')][_0xc7e2('0x3c')]);}})[_0xc7e2('0x1a')](respondWithStatusCode(_0xd312c5,null))[_0xc7e2('0x28')](handleError(_0xd312c5,null));};exports[_0xc7e2('0x50')]=function(_0x476151,_0x59f5ea){var _0xa2daaf=moment()['unix']()['toString']();var _0x5a1946=path[_0xc7e2('0x51')](config[_0xc7e2('0x52')],_0xc7e2('0x53'),_0xc7e2('0x54'),_0xc7e2('0x55'));var _0x5a830c=path['join'](config[_0xc7e2('0x52')],_0xc7e2('0x53'),_0xc7e2('0x54'),_0xc7e2('0x56'));var _0x19e4ba=path[_0xc7e2('0x51')](_0x5a1946,_0xa2daaf);var _0x26461b=util[_0xc7e2('0x49')](_0xc7e2('0x57'),_0x476151[_0xc7e2('0x2a')]['id'],_0xa2daaf);var _0x55ebda=path[_0xc7e2('0x51')](_0x5a1946,_0x26461b);var _0x1da9c1=[];_0x1da9c1['push']({'model':db['Attachment'],'as':_0xc7e2('0x58'),'raw':!![]});var _0x5a56d8=[{'model':db['FaxMessage'],'as':_0xc7e2('0x59'),'attributes':['id',_0xc7e2('0x38'),_0xc7e2('0x5a')],'include':_0x1da9c1}];return db[_0xc7e2('0x21')][_0xc7e2('0x36')]({'where':{'id':_0x476151[_0xc7e2('0x2a')]['id']},'include':_0x5a56d8})['then'](handleEntityNotFound(_0x59f5ea,null))[_0xc7e2('0x1a')](function(_0x3f5a7b){if(_0x3f5a7b&&_0x3f5a7b[_0xc7e2('0x59')]){var _0x50e1ec=_0x3f5a7b[_0xc7e2('0x5b')]({'plain':!![]});fs[_0xc7e2('0x5c')](_0x19e4ba);for(var _0x5699b9=0x0;_0x5699b9<_0x50e1ec['Messages'][_0xc7e2('0x31')];_0x5699b9++){var _0x1d11c2=_0x50e1ec['Messages'][_0x5699b9][_0xc7e2('0x58')];if(_0x1d11c2){var _0x27fdc5=path['join'](_0x5a830c,_0x1d11c2[_0xc7e2('0x5d')]);if(fs[_0xc7e2('0x5e')](_0x27fdc5)){fs[_0xc7e2('0x5f')](_0x27fdc5)['pipe'](fs[_0xc7e2('0x60')](path[_0xc7e2('0x51')](_0x19e4ba,_0x1d11c2['basename'])));}}}return BPromise[_0xc7e2('0x61')]()[_0xc7e2('0x1a')](function(){return new BPromise(function(_0x368087,_0x2a420a){zipdir(_0x19e4ba,{'saveTo':_0x55ebda},function(_0x1c47e1,_0x2edbb1){if(_0x1c47e1)return _0x2a420a(_0x1c47e1);return _0x368087(_0x2edbb1);});})[_0xc7e2('0x1a')](function(){return new BPromise(function(_0x453403,_0x176563){rimraf(_0x19e4ba,function(_0x2c1f24){if(_0x2c1f24)_0x176563(_0x2c1f24);return _0x453403();});});})['then'](function(){return _0x59f5ea['download'](_0x55ebda,_0x26461b,function(_0x5e8679){if(_0x5e8679){console['log'](_0xc7e2('0x62'),_0x5e8679);}else{fs[_0xc7e2('0x63')](_0x55ebda);}});});});}else{return _0x59f5ea[_0xc7e2('0x11')](0xc8);}})[_0xc7e2('0x28')](handleError(_0x59f5ea,null));}; \ No newline at end of file +var _0x5932=['$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','rows','addTags','setTags','spread','Tag','color','emit','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','Attachment','createdAt','Messages','get','mkdirSync','basename','existsSync','pipe','createWriteStream','resolve','log','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','destroy','then','error','name','send','index','map','FaxInteraction','rawAttributes','fieldName','key','getOptions','findAll','query','params','model','keys','filters','intersection','attributes','fields','length','include','merge','options','find','catch','create','body','describe','addMessage','FaxMessage','omit','ids','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','FaxInteractionId','filter'];(function(_0x112e8c,_0x543f31){var _0x572aa3=function(_0x19b1f4){while(--_0x19b1f4){_0x112e8c['push'](_0x112e8c['shift']());}};_0x572aa3(++_0x543f31);}(_0x5932,0x8f));var _0x2593=function(_0x1c0d1d,_0x382783){_0x1c0d1d=_0x1c0d1d-0x0;var _0x44b6b8=_0x5932[_0x1c0d1d];return _0x44b6b8;};'use strict';var rimraf=require(_0x2593('0x0'));var zipdir=require(_0x2593('0x1'));var moment=require(_0x2593('0x2'));var BPromise=require(_0x2593('0x3'));var util=require(_0x2593('0x4'));var path=require(_0x2593('0x5'));var fs=require('fs');var _=require(_0x2593('0x6'));var Redis=require(_0x2593('0x7'));var interaction=require(_0x2593('0x8'));var qs=require(_0x2593('0x9'));var logger=require(_0x2593('0xa'))(_0x2593('0xb'));var config=require('../../config/environment');var db=require(_0x2593('0xc'))['db'];config[_0x2593('0xd')]=_[_0x2593('0xe')](config[_0x2593('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x2593('0xf'))(new Redis(config['redis']));require(_0x2593('0x10'))[_0x2593('0x11')](socket);function respondWithStatusCode(_0x83a36a,_0x1c8a09){_0x1c8a09=_0x1c8a09||0xcc;return function(_0x5252e9){if(_0x5252e9){return _0x83a36a[_0x2593('0x12')](_0x1c8a09);}return _0x83a36a[_0x2593('0x13')](_0x1c8a09)[_0x2593('0x14')]();};}function respondWithResult(_0x5c764d,_0x55e04a){_0x55e04a=_0x55e04a||0xc8;return function(_0xdcecb7){if(_0xdcecb7){return _0x5c764d['status'](_0x55e04a)[_0x2593('0x15')](_0xdcecb7);}};}function respondWithFilteredResult(_0x39c34a,_0x472082){return function(_0x1efaaf){if(_0x1efaaf){var _0x40fa95=typeof _0x472082[_0x2593('0x16')]===_0x2593('0x17')&&typeof _0x472082[_0x2593('0x18')]===_0x2593('0x17');var _0x4270f5=_0x1efaaf[_0x2593('0x19')];var _0x37b4f4=_0x40fa95?0x0:_0x472082[_0x2593('0x16')];var _0x2edc58=_0x40fa95?_0x1efaaf[_0x2593('0x19')]:_0x472082['offset']+_0x472082[_0x2593('0x18')];var _0x37fcaf;if(_0x2edc58>=_0x4270f5){_0x2edc58=_0x4270f5;_0x37fcaf=0xc8;}else{_0x37fcaf=0xce;}_0x39c34a['status'](_0x37fcaf);return _0x39c34a['set'](_0x2593('0x1a'),_0x37b4f4+'-'+_0x2edc58+'/'+_0x4270f5)[_0x2593('0x15')](_0x1efaaf);}return null;};}function saveUpdates(_0x350e63){return function(_0x4c9cc1){if(_0x4c9cc1){return _0x4c9cc1[_0x2593('0x1b')](_0x350e63)['then'](function(_0x3d293f){return _0x3d293f;});}return null;};}function removeEntity(_0xb15a3d){return function(_0x37011e){if(_0x37011e){return _0x37011e[_0x2593('0x1c')]()[_0x2593('0x1d')](function(){_0xb15a3d['status'](0xcc)[_0x2593('0x14')]();});}};}function handleEntityNotFound(_0xc6802f){return function(_0x53a6ae){if(!_0x53a6ae){_0xc6802f[_0x2593('0x12')](0x194);}return _0x53a6ae;};}function handleError(_0x43bbac,_0x56425e){_0x56425e=_0x56425e||0x1f4;return function(_0x3b0b7f){logger[_0x2593('0x1e')](_0x3b0b7f['stack']);if(_0x3b0b7f[_0x2593('0x1f')]){delete _0x3b0b7f[_0x2593('0x1f')];}_0x43bbac[_0x2593('0x13')](_0x56425e)[_0x2593('0x20')](_0x3b0b7f);};}exports[_0x2593('0x21')]=function(_0xf3931,_0x5bf05b){var _0x411415={};var _0x84d4f2=_[_0x2593('0x22')](db[_0x2593('0x23')][_0x2593('0x24')],function(_0x5150cc){return{'name':_0x5150cc[_0x2593('0x25')],'type':_0x5150cc['type'][_0x2593('0x26')]};});_0x411415=qs[_0x2593('0x27')](_0x84d4f2,_0xf3931);return interaction[_0x2593('0x28')]('fax',_0xf3931[_0x2593('0x29')],_0xf3931['user'],_0x411415,_0x84d4f2)[_0x2593('0x1d')](respondWithFilteredResult(_0x5bf05b,_0x411415))['catch'](handleError(_0x5bf05b,null));};exports['show']=function(_0x4df7c2,_0x293bc0){var _0xbc37dd={'raw':![],'where':{'id':_0x4df7c2[_0x2593('0x2a')]['id']}},_0x42a498={};_0x42a498[_0x2593('0x2b')]=_[_0x2593('0x2c')](db[_0x2593('0x23')][_0x2593('0x24')]);_0x42a498[_0x2593('0x29')]=_[_0x2593('0x2c')](_0x4df7c2['query']);_0x42a498[_0x2593('0x2d')]=_[_0x2593('0x2e')](_0x42a498[_0x2593('0x2b')],_0x42a498['query']);_0xbc37dd[_0x2593('0x2f')]=_[_0x2593('0x2e')](_0x42a498[_0x2593('0x2b')],qs[_0x2593('0x30')](_0x4df7c2[_0x2593('0x29')]['fields']));_0xbc37dd['attributes']=_0xbc37dd[_0x2593('0x2f')][_0x2593('0x31')]?_0xbc37dd[_0x2593('0x2f')]:_0x42a498[_0x2593('0x2b')];if(_0x4df7c2['query']['includeAll']){_0xbc37dd[_0x2593('0x32')]=[{'all':!![]}];}_0xbc37dd=_[_0x2593('0x33')]({},_0xbc37dd,_0x4df7c2[_0x2593('0x34')]);return db['FaxInteraction'][_0x2593('0x35')](_0xbc37dd)[_0x2593('0x1d')](handleEntityNotFound(_0x293bc0,null))['then'](respondWithResult(_0x293bc0,null))[_0x2593('0x36')](handleError(_0x293bc0,null));};exports[_0x2593('0x37')]=function(_0x99ce57,_0x490207){return db[_0x2593('0x23')][_0x2593('0x37')](_0x99ce57[_0x2593('0x38')],{})[_0x2593('0x1d')](respondWithResult(_0x490207,0xc9))[_0x2593('0x36')](handleError(_0x490207,null));};exports[_0x2593('0x1b')]=function(_0x1ab9b4,_0x206aed){if(_0x1ab9b4['body']['id']){delete _0x1ab9b4[_0x2593('0x38')]['id'];}return db[_0x2593('0x23')]['find']({'where':{'id':_0x1ab9b4['params']['id']}})[_0x2593('0x1d')](handleEntityNotFound(_0x206aed,null))['then'](saveUpdates(_0x1ab9b4[_0x2593('0x38')],null))[_0x2593('0x1d')](respondWithResult(_0x206aed,null))[_0x2593('0x36')](handleError(_0x206aed,null));};exports[_0x2593('0x1c')]=function(_0x48c564,_0x30ffea){return db[_0x2593('0x23')][_0x2593('0x35')]({'where':{'id':_0x48c564[_0x2593('0x2a')]['id']}})[_0x2593('0x1d')](handleEntityNotFound(_0x30ffea,null))[_0x2593('0x1d')](removeEntity(_0x30ffea,null))[_0x2593('0x36')](handleError(_0x30ffea,null));};exports[_0x2593('0x39')]=function(_0x15e46b,_0x1ea477){return db[_0x2593('0x23')][_0x2593('0x39')]()['then'](respondWithResult(_0x1ea477,null))[_0x2593('0x36')](handleError(_0x1ea477,null));};exports[_0x2593('0x3a')]=function(_0x335ddc,_0x276918){return db[_0x2593('0x3b')][_0x2593('0x35')]({'where':{'id':_0x335ddc[_0x2593('0x2a')]['id']}})['then'](handleEntityNotFound(_0x276918,null))[_0x2593('0x1d')](function(_0x44a506){if(_0x44a506){return _0x44a506[_0x2593('0x3a')](_0x335ddc[_0x2593('0x38')]['ids'],_[_0x2593('0x3c')](_0x335ddc[_0x2593('0x38')],[_0x2593('0x3d'),'id'])||{});}})[_0x2593('0x1d')](respondWithResult(_0x276918,null))[_0x2593('0x36')](handleError(_0x276918,null));};exports[_0x2593('0x3e')]=function(_0x48f1f2,_0x350794){var _0x2f6704={'raw':![],'where':{}};var _0x5e0914={};var _0x7cad26={'count':0x0,'rows':[]};return db[_0x2593('0x23')][_0x2593('0x3f')]({'where':{'id':_0x48f1f2[_0x2593('0x2a')]['id']}})['then'](handleEntityNotFound(_0x350794,null))[_0x2593('0x1d')](function(_0x12be0d){if(_0x12be0d){_0x5e0914[_0x2593('0x2b')]=_['keys'](db[_0x2593('0x3b')][_0x2593('0x24')]);_0x5e0914[_0x2593('0x29')]=_[_0x2593('0x2c')](_0x48f1f2[_0x2593('0x29')]);_0x5e0914[_0x2593('0x2d')]=_[_0x2593('0x2e')](_0x5e0914[_0x2593('0x2b')],_0x5e0914[_0x2593('0x29')]);_0x2f6704['attributes']=_[_0x2593('0x2e')](_0x5e0914[_0x2593('0x2b')],qs[_0x2593('0x30')](_0x48f1f2['query']['fields']));_0x2f6704[_0x2593('0x2f')]=_0x2f6704['attributes'][_0x2593('0x31')]?_0x2f6704['attributes']:_0x5e0914[_0x2593('0x2b')];if(!_0x48f1f2['query'][_0x2593('0x40')](_0x2593('0x41'))){_0x2f6704['limit']=qs[_0x2593('0x18')](_0x48f1f2[_0x2593('0x29')][_0x2593('0x18')]);_0x2f6704[_0x2593('0x16')]=qs[_0x2593('0x16')](_0x48f1f2[_0x2593('0x29')]['offset']);}_0x2f6704[_0x2593('0x42')]=qs[_0x2593('0x43')](_0x48f1f2[_0x2593('0x29')][_0x2593('0x43')]);_0x2f6704[_0x2593('0x44')]=qs[_0x2593('0x2d')](_['pick'](_0x48f1f2[_0x2593('0x29')],_0x5e0914[_0x2593('0x2d')]));_0x2f6704[_0x2593('0x44')][_0x2593('0x45')]=_0x12be0d['id'];if(_0x48f1f2['query'][_0x2593('0x46')]){_0x2f6704[_0x2593('0x44')]=_[_0x2593('0x33')](_0x2f6704['where'],{'$or':_[_0x2593('0x22')](_0x2f6704['attributes'],function(_0x266304){var _0x226014={};_0x226014[_0x266304]={'$like':'%'+_0x48f1f2['query'][_0x2593('0x46')]+'%'};return _0x226014;})});}if(_0x48f1f2[_0x2593('0x29')][_0x2593('0x47')]){var _0x1fe7f8=_0x48f1f2[_0x2593('0x29')][_0x2593('0x47')][_0x2593('0x48')](',');var _0x39267d={};_0x39267d[_0x1fe7f8[0x0]]={'$gte':moment(_0x1fe7f8[0x1])[_0x2593('0x49')](_0x2593('0x4a'))};_0x2f6704[_0x2593('0x44')]=_[_0x2593('0x33')](_0x2f6704[_0x2593('0x44')],_0x39267d);}_0x2f6704=_[_0x2593('0x33')]({},_0x2f6704,_0x48f1f2[_0x2593('0x34')]);return db[_0x2593('0x3b')][_0x2593('0x19')]({'where':_0x2f6704[_0x2593('0x44')]})[_0x2593('0x1d')](function(_0xd2f023){_0x7cad26[_0x2593('0x19')]=_0xd2f023;if(_0x48f1f2['query'][_0x2593('0x4b')]){_0x2f6704[_0x2593('0x32')]=[{'all':!![]}];}return db['FaxMessage'][_0x2593('0x28')](_0x2f6704);})[_0x2593('0x1d')](function(_0x3b536a){_0x7cad26[_0x2593('0x4c')]=_0x3b536a;return _0x7cad26;});}})[_0x2593('0x1d')](respondWithFilteredResult(_0x350794,_0x2f6704))[_0x2593('0x36')](handleError(_0x350794,null));};exports[_0x2593('0x4d')]=function(_0x4783bd,_0x1b1520){return db[_0x2593('0x23')][_0x2593('0x35')]({'where':{'id':_0x4783bd[_0x2593('0x2a')]['id']}})[_0x2593('0x1d')](handleEntityNotFound(_0x1b1520,null))[_0x2593('0x1d')](function(_0x22ae77){if(_0x22ae77){return _0x22ae77[_0x2593('0x4e')](_0x4783bd[_0x2593('0x38')][_0x2593('0x3d')],_['omit'](_0x4783bd[_0x2593('0x38')],[_0x2593('0x3d'),'id'])||{})[_0x2593('0x4f')](function(){return db[_0x2593('0x50')]['findAll']({'attributes':['id',_0x2593('0x1f'),_0x2593('0x51')],'where':{'id':_0x4783bd[_0x2593('0x38')]['ids']}});})[_0x2593('0x1d')](function(_0x31d0c6){socket[_0x2593('0x52')]('faxInteractionTags:save',{'id':Number(_0x4783bd[_0x2593('0x2a')]['id']),'tags':_0x31d0c6||[]});return{'id':Number(_0x4783bd[_0x2593('0x2a')]['id']),'tags':_0x31d0c6||[]};});}})['then'](respondWithResult(_0x1b1520,null))['catch'](handleError(_0x1b1520,null));};exports['removeTags']=function(_0x47975d,_0x38ba41){return db[_0x2593('0x23')][_0x2593('0x35')]({'where':{'id':_0x47975d[_0x2593('0x2a')]['id']}})[_0x2593('0x1d')](handleEntityNotFound(_0x38ba41,null))['then'](function(_0x429144){if(_0x429144){return _0x429144[_0x2593('0x53')](_0x47975d[_0x2593('0x29')]['ids']);}})[_0x2593('0x1d')](respondWithStatusCode(_0x38ba41,null))[_0x2593('0x36')](handleError(_0x38ba41,null));};exports[_0x2593('0x54')]=function(_0x169b3a,_0x2cd926){var _0x27b7db=moment()[_0x2593('0x55')]()[_0x2593('0x56')]();var _0x390857=path[_0x2593('0x57')](config[_0x2593('0x58')],_0x2593('0x59'),_0x2593('0x5a'),_0x2593('0x5b'));var _0x1d6003=path[_0x2593('0x57')](config[_0x2593('0x58')],_0x2593('0x59'),_0x2593('0x5a'),_0x2593('0x5c'));var _0x57a29a=path[_0x2593('0x57')](_0x390857,_0x27b7db);var _0x1d9685=util['format'](_0x2593('0x5d'),_0x169b3a['params']['id'],_0x27b7db);var _0x4c1f0a=path['join'](_0x390857,_0x1d9685);var _0x1a2d2a=[];_0x1a2d2a[_0x2593('0x5e')]({'model':db[_0x2593('0x5f')],'as':_0x2593('0x5f'),'raw':!![]});var _0x1f1549=[{'model':db[_0x2593('0x3b')],'as':'Messages','attributes':['id',_0x2593('0x38'),_0x2593('0x60')],'include':_0x1a2d2a}];return db[_0x2593('0x23')][_0x2593('0x35')]({'where':{'id':_0x169b3a[_0x2593('0x2a')]['id']},'include':_0x1f1549})[_0x2593('0x1d')](handleEntityNotFound(_0x2cd926,null))['then'](function(_0xc6913e){if(_0xc6913e&&_0xc6913e[_0x2593('0x61')]){var _0x39e620=_0xc6913e[_0x2593('0x62')]({'plain':!![]});fs[_0x2593('0x63')](_0x57a29a);for(var _0x213cce=0x0;_0x213cce<_0x39e620[_0x2593('0x61')]['length'];_0x213cce++){var _0x43e906=_0x39e620[_0x2593('0x61')][_0x213cce][_0x2593('0x5f')];if(_0x43e906){var _0x295d2b=path['join'](_0x1d6003,_0x43e906[_0x2593('0x64')]);if(fs[_0x2593('0x65')](_0x295d2b)){fs['createReadStream'](_0x295d2b)[_0x2593('0x66')](fs[_0x2593('0x67')](path['join'](_0x57a29a,_0x43e906['basename'])));}}}return BPromise[_0x2593('0x68')]()[_0x2593('0x1d')](function(){return new BPromise(function(_0x285374,_0x3fb341){zipdir(_0x57a29a,{'saveTo':_0x4c1f0a},function(_0x150038,_0x590f76){if(_0x150038)return _0x3fb341(_0x150038);return _0x285374(_0x590f76);});})[_0x2593('0x1d')](function(){return new BPromise(function(_0x1d0d58,_0x507984){rimraf(_0x57a29a,function(_0x1a6096){if(_0x1a6096)_0x507984(_0x1a6096);return _0x1d0d58();});});})[_0x2593('0x1d')](function(){return _0x2cd926['download'](_0x4c1f0a,_0x1d9685,function(_0x4aa612){if(_0x4aa612){console[_0x2593('0x69')]('err',_0x4aa612);}else{fs[_0x2593('0x6a')](_0x4c1f0a);}});});});}else{return _0x2cd926[_0x2593('0x12')](0xc8);}})[_0x2593('0x36')](handleError(_0x2cd926,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 10cc861..f4fd58b 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 _0x089f=['setDataValue','map','findAll','unreadMessages','emit','catch','hasOwnProperty','events','../../mysqldb','FaxInteraction','setMaxListeners','update','getUsers','then'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x089f,0x111));var _0xf089=function(_0x2852a6,_0x3c9a60){_0x2852a6=_0x2852a6-0x0;var _0x30239c=_0x089f[_0x2852a6];return _0x30239c;};'use strict';var EventEmitter=require(_0xf089('0x0'));var FaxInteraction=require(_0xf089('0x1'))['db'][_0xf089('0x2')];var FaxMessage=require(_0xf089('0x1'))['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xf089('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf089('0x4'),'afterDestroy':'remove'};function emitEvent(_0x48d09e){return function(_0x2bc713,_0x106bf2,_0x181ccd){_0x2bc713[_0xf089('0x5')]({'attributes':['id'],'raw':!![]})[_0xf089('0x6')](function(_0x28fd83){_0x2bc713[_0xf089('0x7')]('Users',_0x28fd83[_0xf089('0x8')](function(_0x44666c){return{'id':_0x44666c['id']};}));return FaxMessage[_0xf089('0x9')]({'where':{'FaxInteractionId':_0x2bc713['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf089('0x6')](function(_0x2acee8){_0x2bc713['setDataValue'](_0xf089('0xa'),_0x2acee8['length']);FaxInteractionEvents[_0xf089('0xb')](_0x48d09e+':'+_0x2bc713['id'],_0x2bc713);FaxInteractionEvents['emit'](_0x48d09e,_0x2bc713);_0x181ccd(null);})[_0xf089('0xc')](_0x181ccd(null));};}for(var e in events){if(events[_0xf089('0xd')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file +var _0x761a=['remove','getUsers','setDataValue','map','unreadMessages','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','FaxMessage','setMaxListeners','save','update'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x761a,0x1ca));var _0xa761=function(_0x9817e7,_0x1d8098){_0x9817e7=_0x9817e7-0x0;var _0x56eccb=_0x761a[_0x9817e7];return _0x56eccb;};'use strict';var EventEmitter=require(_0xa761('0x0'));var FaxInteraction=require(_0xa761('0x1'))['db']['FaxInteraction'];var FaxMessage=require(_0xa761('0x1'))['db'][_0xa761('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xa761('0x3')](0x0);var events={'afterCreate':_0xa761('0x4'),'afterUpdate':_0xa761('0x5'),'afterDestroy':_0xa761('0x6')};function emitEvent(_0x3ff756){return function(_0x1291e1,_0x2635e3,_0x4b7acc){_0x1291e1[_0xa761('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x56d33f){_0x1291e1[_0xa761('0x8')]('Users',_0x56d33f[_0xa761('0x9')](function(_0x241515){return{'id':_0x241515['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x1291e1['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x134dd0){_0x1291e1['setDataValue'](_0xa761('0xa'),_0x134dd0[_0xa761('0xb')]);FaxInteractionEvents[_0xa761('0xc')](_0x3ff756+':'+_0x1291e1['id'],_0x1291e1);FaxInteractionEvents[_0xa761('0xc')](_0x3ff756,_0x1291e1);_0x4b7acc(null);})[_0xa761('0xd')](_0x4b7acc(null));};}for(var e in events){if(events[_0xa761('0xe')](e)){var event=events[e];FaxInteraction[_0xa761('0xf')](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 88f8b32..366c1a9 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 _0xa8d5=['exports','define','FaxInteraction','changed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x4e2861,_0x199be0){var _0x2265e3=function(_0x469693){while(--_0x469693){_0x4e2861['push'](_0x4e2861['shift']());}};_0x2265e3(++_0x199be0);}(_0xa8d5,0x1b3));var _0x5a8d=function(_0x2ca2b6,_0x1d9b76){_0x2ca2b6=_0x2ca2b6-0x0;var _0x1ea293=_0xa8d5[_0x2ca2b6];return _0x1ea293;};'use strict';var _=require(_0x5a8d('0x0'));var util=require(_0x5a8d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x5a8d('0x2'));var BPromise=require(_0x5a8d('0x3'));var rp=require(_0x5a8d('0x4'));var fs=require('fs');var path=require(_0x5a8d('0x5'));var rimraf=require('rimraf');var config=require(_0x5a8d('0x6'));var attributes=require('./faxInteraction.attributes');module[_0x5a8d('0x7')]=function(_0x5ee8f0,_0x44e479){return _0x5ee8f0[_0x5a8d('0x8')](_0x5a8d('0x9'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x46c6dd,_0x30f53c,_0x4c5977){if(_0x46c6dd[_0x5a8d('0xa')]('closed')){_0x46c6dd[_0x5a8d('0xb')]=moment()['format'](_0x5a8d('0xc'));}_0x4c5977(null,_0x46c6dd);}}});}; \ No newline at end of file +var _0xd09b=['FaxInteraction','fax_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define'];(function(_0x59605e,_0xb51758){var _0x56807d=function(_0x5b6bcb){while(--_0x5b6bcb){_0x59605e['push'](_0x59605e['shift']());}};_0x56807d(++_0xb51758);}(_0xd09b,0x1da));var _0xbd09=function(_0x955d2e,_0x373a5b){_0x955d2e=_0x955d2e-0x0;var _0x3296bf=_0xd09b[_0x955d2e];return _0x3296bf;};'use strict';var _=require(_0xbd09('0x0'));var util=require(_0xbd09('0x1'));var logger=require(_0xbd09('0x2'))(_0xbd09('0x3'));var moment=require(_0xbd09('0x4'));var BPromise=require('bluebird');var rp=require(_0xbd09('0x5'));var fs=require('fs');var path=require(_0xbd09('0x6'));var rimraf=require(_0xbd09('0x7'));var config=require(_0xbd09('0x8'));var attributes=require(_0xbd09('0x9'));module[_0xbd09('0xa')]=function(_0x8c82ff,_0x180e27){return _0x8c82ff[_0xbd09('0xb')](_0xbd09('0xc'),attributes,{'tableName':_0xbd09('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1fe4d8,_0xe2400d,_0x2e9d78){if(_0x1fe4d8[_0xbd09('0xe')](_0xbd09('0xf'))){_0x1fe4d8[_0xbd09('0x10')]=moment()['format'](_0xbd09('0x11'));}_0x2e9d78(null,_0x1fe4d8);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 690c380..2f3cf41 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 _0x5a77=['then','addTags','body','ids','omit','AddTags','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','client','http','redis','defaults','localhost','./faxInteraction.socket','FaxInteraction,\x20%s,\x20%s','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','FaxInteraction','update','options','raw','where','UpdateFaxInteraction','AddTagsToFaxInteraction','find'];(function(_0x90ea50,_0x4f896e){var _0x305664=function(_0x1d15b9){while(--_0x1d15b9){_0x90ea50['push'](_0x90ea50['shift']());}};_0x305664(++_0x4f896e);}(_0x5a77,0x9a));var _0x75a7=function(_0xadbfe3,_0x1dc94e){_0xadbfe3=_0xadbfe3-0x0;var _0x569c26=_0x5a77[_0xadbfe3];return _0x569c26;};'use strict';var _=require(_0x75a7('0x0'));var util=require(_0x75a7('0x1'));var moment=require(_0x75a7('0x2'));var BPromise=require('bluebird');var rs=require(_0x75a7('0x3'));var fs=require('fs');var Redis=require(_0x75a7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x75a7('0x5'));var logger=require(_0x75a7('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x75a7('0x7')][_0x75a7('0x8')]({'port':0x232a});config[_0x75a7('0x9')]=_[_0x75a7('0xa')](config[_0x75a7('0x9')],{'host':_0x75a7('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x75a7('0x9')]));require(_0x75a7('0xc'))['register'](socket);function respondWithRpcPromise(_0xc0cf16,_0x4cbae1,_0x467653){return new BPromise(function(_0x8d7287,_0x4c7c6c){return client['request'](_0xc0cf16,_0x467653)['then'](function(_0x315a9d){logger['info'](_0x75a7('0xd'),_0x4cbae1,'request\x20sent');logger[_0x75a7('0xe')](_0x75a7('0xf'),_0x4cbae1,'request\x20sent',JSON[_0x75a7('0x10')](_0x315a9d));if(_0x315a9d[_0x75a7('0x11')]){if(_0x315a9d[_0x75a7('0x11')][_0x75a7('0x12')]===0x1f4){logger['error'](_0x75a7('0xd'),_0x4cbae1,_0x315a9d['error']['message']);return _0x4c7c6c(_0x315a9d['error'][_0x75a7('0x13')]);}logger['error'](_0x75a7('0xd'),_0x4cbae1,_0x315a9d[_0x75a7('0x11')][_0x75a7('0x13')]);return _0x8d7287(_0x315a9d[_0x75a7('0x11')][_0x75a7('0x13')]);}else{logger[_0x75a7('0x14')](_0x75a7('0xd'),_0x4cbae1,'request\x20sent');_0x8d7287(_0x315a9d[_0x75a7('0x15')][_0x75a7('0x13')]);}})[_0x75a7('0x16')](function(_0x3d0fdd){logger['error']('FaxInteraction,\x20%s,\x20%s',_0x4cbae1,_0x3d0fdd);_0x4c7c6c(_0x3d0fdd);});});}exports['UpdateFaxInteraction']=function(_0x672c4){var _0x279abd=this;return new Promise(function(_0x5e4545,_0x3f5380){return db[_0x75a7('0x17')][_0x75a7('0x18')](_0x672c4['body'],{'raw':_0x672c4[_0x75a7('0x19')]?_0x672c4[_0x75a7('0x19')][_0x75a7('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x672c4[_0x75a7('0x19')]?_0x672c4[_0x75a7('0x19')][_0x75a7('0x1b')]||null:null,'attributes':_0x672c4[_0x75a7('0x19')]?_0x672c4['options']['attributes']||null:null,'limit':_0x672c4[_0x75a7('0x19')]?_0x672c4[_0x75a7('0x19')]['limit']||null:null})['then'](function(_0x226460){logger[_0x75a7('0x14')]('UpdateFaxInteraction',_0x672c4);logger[_0x75a7('0xe')](_0x75a7('0x1c'),_0x672c4,JSON[_0x75a7('0x10')](_0x226460));_0x5e4545(_0x226460);})[_0x75a7('0x16')](function(_0x416e1a){logger['error'](_0x75a7('0x1c'),_0x416e1a[_0x75a7('0x13')],_0x672c4);_0x3f5380(_0x279abd['error'](0x1f4,_0x416e1a[_0x75a7('0x13')]));});});};exports[_0x75a7('0x1d')]=function(_0x466179){return new Promise(function(_0x40cd1d,_0x4fea43){return db['FaxInteraction'][_0x75a7('0x1e')]({'where':_0x466179[_0x75a7('0x19')]?_0x466179[_0x75a7('0x19')][_0x75a7('0x1b')]||null:null})[_0x75a7('0x1f')](function(_0x3b9804){if(_0x3b9804){return _0x3b9804[_0x75a7('0x20')](_0x466179[_0x75a7('0x21')][_0x75a7('0x22')],_[_0x75a7('0x23')](_0x466179[_0x75a7('0x21')],['ids','id'])||{});}})['spread'](function(_0x5b4eab){logger[_0x75a7('0x14')]('AddTags',_0x466179);logger[_0x75a7('0xe')](_0x75a7('0x24'),_0x466179,JSON[_0x75a7('0x10')](_0x5b4eab));_0x40cd1d(_0x5b4eab);})[_0x75a7('0x16')](function(_0x458c54){logger[_0x75a7('0x11')](_0x75a7('0x24'),_0x458c54[_0x75a7('0x13')],_0x466179);_0x4fea43(_this[_0x75a7('0x11')](0x1f4,_0x458c54['message']));});});}; \ No newline at end of file +var _0x8523=['info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','where','attributes','limit','then','AddTagsToFaxInteraction','find','addTags','ids','omit','spread','AddTags','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','request'];(function(_0x342696,_0x146f50){var _0x15b8e4=function(_0x591e2a){while(--_0x591e2a){_0x342696['push'](_0x342696['shift']());}};_0x15b8e4(++_0x146f50);}(_0x8523,0x139));var _0x3852=function(_0x453c9f,_0x563800){_0x453c9f=_0x453c9f-0x0;var _0x3b22d3=_0x8523[_0x453c9f];return _0x3b22d3;};'use strict';var _=require('lodash');var util=require(_0x3852('0x0'));var moment=require('moment');var BPromise=require(_0x3852('0x1'));var rs=require(_0x3852('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3852('0x3'))['db'];var utils=require(_0x3852('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x3852('0x5'));var jayson=require(_0x3852('0x6'));var client=jayson[_0x3852('0x7')]['http']({'port':0x232a});config[_0x3852('0x8')]=_[_0x3852('0x9')](config[_0x3852('0x8')],{'host':_0x3852('0xa'),'port':0x18eb});var socket=require(_0x3852('0xb'))(new Redis(config['redis']));require(_0x3852('0xc'))[_0x3852('0xd')](socket);function respondWithRpcPromise(_0xb7eb6f,_0x4f52d2,_0x37e641){return new BPromise(function(_0x5cd596,_0x4c8ace){return client[_0x3852('0xe')](_0xb7eb6f,_0x37e641)['then'](function(_0x49249c){logger[_0x3852('0xf')](_0x3852('0x10'),_0x4f52d2,_0x3852('0x11'));logger[_0x3852('0x12')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x4f52d2,_0x3852('0x11'),JSON[_0x3852('0x13')](_0x49249c));if(_0x49249c[_0x3852('0x14')]){if(_0x49249c['error'][_0x3852('0x15')]===0x1f4){logger[_0x3852('0x14')]('FaxInteraction,\x20%s,\x20%s',_0x4f52d2,_0x49249c[_0x3852('0x14')][_0x3852('0x16')]);return _0x4c8ace(_0x49249c['error'][_0x3852('0x16')]);}logger['error']('FaxInteraction,\x20%s,\x20%s',_0x4f52d2,_0x49249c['error'][_0x3852('0x16')]);return _0x5cd596(_0x49249c[_0x3852('0x14')]['message']);}else{logger[_0x3852('0xf')]('FaxInteraction,\x20%s,\x20%s',_0x4f52d2,'request\x20sent');_0x5cd596(_0x49249c['result']['message']);}})[_0x3852('0x17')](function(_0x8b5d91){logger[_0x3852('0x14')](_0x3852('0x10'),_0x4f52d2,_0x8b5d91);_0x4c8ace(_0x8b5d91);});});}exports[_0x3852('0x18')]=function(_0x5d6b37){var _0x2beca3=this;return new Promise(function(_0x4b7c35,_0x332d82){return db[_0x3852('0x19')][_0x3852('0x1a')](_0x5d6b37[_0x3852('0x1b')],{'raw':_0x5d6b37[_0x3852('0x1c')]?_0x5d6b37['options'][_0x3852('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d6b37[_0x3852('0x1c')]?_0x5d6b37['options'][_0x3852('0x1e')]||null:null,'attributes':_0x5d6b37[_0x3852('0x1c')]?_0x5d6b37[_0x3852('0x1c')][_0x3852('0x1f')]||null:null,'limit':_0x5d6b37[_0x3852('0x1c')]?_0x5d6b37[_0x3852('0x1c')][_0x3852('0x20')]||null:null})[_0x3852('0x21')](function(_0xd039e9){logger[_0x3852('0xf')]('UpdateFaxInteraction',_0x5d6b37);logger[_0x3852('0x12')](_0x3852('0x18'),_0x5d6b37,JSON[_0x3852('0x13')](_0xd039e9));_0x4b7c35(_0xd039e9);})[_0x3852('0x17')](function(_0x32b756){logger[_0x3852('0x14')](_0x3852('0x18'),_0x32b756[_0x3852('0x16')],_0x5d6b37);_0x332d82(_0x2beca3[_0x3852('0x14')](0x1f4,_0x32b756['message']));});});};exports[_0x3852('0x22')]=function(_0x24c3a1){return new Promise(function(_0x100e5b,_0x17149c){return db[_0x3852('0x19')][_0x3852('0x23')]({'where':_0x24c3a1[_0x3852('0x1c')]?_0x24c3a1[_0x3852('0x1c')][_0x3852('0x1e')]||null:null})[_0x3852('0x21')](function(_0x5f571c){if(_0x5f571c){return _0x5f571c[_0x3852('0x24')](_0x24c3a1[_0x3852('0x1b')][_0x3852('0x25')],_[_0x3852('0x26')](_0x24c3a1[_0x3852('0x1b')],[_0x3852('0x25'),'id'])||{});}})[_0x3852('0x27')](function(_0x1fdef0){logger[_0x3852('0xf')]('AddTags',_0x24c3a1);logger[_0x3852('0x12')](_0x3852('0x28'),_0x24c3a1,JSON[_0x3852('0x13')](_0x1fdef0));_0x100e5b(_0x1fdef0);})[_0x3852('0x17')](function(_0x334a39){logger[_0x3852('0x14')](_0x3852('0x28'),_0x334a39[_0x3852('0x16')],_0x24c3a1);_0x17149c(_this['error'](0x1f4,_0x334a39['message']));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 319f5bc..0af7ad6 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 _0x6a2b=['remove','update','emit','register','length','faxInteraction:','./faxInteraction.events','save'];(function(_0x3f5dce,_0x4ec6ca){var _0x110567=function(_0x2ff55c){while(--_0x2ff55c){_0x3f5dce['push'](_0x3f5dce['shift']());}};_0x110567(++_0x4ec6ca);}(_0x6a2b,0x1b6));var _0xb6a2=function(_0x2847d0,_0x10a787){_0x2847d0=_0x2847d0-0x0;var _0x1cc209=_0x6a2b[_0x2847d0];return _0x1cc209;};'use strict';var FaxInteractionEvents=require(_0xb6a2('0x0'));var events=[_0xb6a2('0x1'),_0xb6a2('0x2'),_0xb6a2('0x3')];function createListener(_0x2807f3,_0x43d786){return function(_0x1248ce){_0x43d786[_0xb6a2('0x4')](_0x2807f3,_0x1248ce);};}function removeListener(_0x187363,_0x260014){return function(){FaxInteractionEvents['removeListener'](_0x187363,_0x260014);};}exports[_0xb6a2('0x5')]=function(_0x3e2778){for(var _0x87f80c=0x0,_0x1df8b6=events[_0xb6a2('0x6')];_0x87f80c<_0x1df8b6;_0x87f80c++){var _0x4d31f5=events[_0x87f80c];var _0x5a01f2=createListener(_0xb6a2('0x7')+_0x4d31f5,_0x3e2778);FaxInteractionEvents['on'](_0x4d31f5,_0x5a01f2);}}; \ No newline at end of file +var _0xcfa7=['faxInteraction:','./faxInteraction.events','remove','emit','removeListener','register','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcfa7,0x1b3));var _0x7cfa=function(_0xf9f597,_0x980181){_0xf9f597=_0xf9f597-0x0;var _0x447f0a=_0xcfa7[_0xf9f597];return _0x447f0a;};'use strict';var FaxInteractionEvents=require(_0x7cfa('0x0'));var events=['save',_0x7cfa('0x1'),'update'];function createListener(_0x1d2e45,_0x12c7a2){return function(_0x1f4b90){_0x12c7a2[_0x7cfa('0x2')](_0x1d2e45,_0x1f4b90);};}function removeListener(_0x429006,_0x26cb4e){return function(){FaxInteractionEvents[_0x7cfa('0x3')](_0x429006,_0x26cb4e);};}exports[_0x7cfa('0x4')]=function(_0x347d1a){for(var _0x2d26b6=0x0,_0x54ba8c=events[_0x7cfa('0x5')];_0x2d26b6<_0x54ba8c;_0x2d26b6++){var _0x4ec15e=events[_0x2d26b6];var _0x3035b2=createListener(_0x7cfa('0x6')+_0x4ec15e,_0x347d1a);FaxInteractionEvents['on'](_0x4ec15e,_0x3035b2);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index ee64e9b..468eac3 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 _0xa61d=['/:id/tags','removeTags','exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/messages','getMessages','download','post','addMessage','fax','faxinteraction:addtags','addTags','put','tracked','faxinteraction:update','update','faxinteraction:destroy','destroy'];(function(_0x478bc3,_0x4864b7){var _0x216cd8=function(_0x17d0ef){while(--_0x17d0ef){_0x478bc3['push'](_0x478bc3['shift']());}};_0x216cd8(++_0x4864b7);}(_0xa61d,0x7f));var _0xda61=function(_0x5668db,_0x149b9a){_0x5668db=_0x5668db-0x0;var _0x9335dc=_0xa61d[_0x5668db];return _0x9335dc;};'use strict';var multer=require(_0xda61('0x0'));var util=require(_0xda61('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xda61('0x2'));var router=express['Router']();var fs_extra=require(_0xda61('0x3'));var auth=require(_0xda61('0x4'));var interaction=require(_0xda61('0x5'));var config=require(_0xda61('0x6'));var controller=require(_0xda61('0x7'));router[_0xda61('0x8')]('/',auth[_0xda61('0x9')](),controller[_0xda61('0xa')]);router[_0xda61('0x8')](_0xda61('0xb'),auth[_0xda61('0x9')](),controller['describe']);router[_0xda61('0x8')](_0xda61('0xc'),auth[_0xda61('0x9')](),controller[_0xda61('0xd')]);router[_0xda61('0x8')](_0xda61('0xe'),auth[_0xda61('0x9')](),controller[_0xda61('0xf')]);router[_0xda61('0x8')]('/:id/download',auth[_0xda61('0x9')](),controller[_0xda61('0x10')]);router[_0xda61('0x11')]('/',auth[_0xda61('0x9')](),controller['create']);router[_0xda61('0x11')](_0xda61('0xe'),auth['isAuthenticated'](),controller[_0xda61('0x12')]);router[_0xda61('0x11')]('/:id/tags',auth[_0xda61('0x9')](),interaction['tracked'](_0xda61('0x13'),_0xda61('0x14')),controller[_0xda61('0x15')]);router[_0xda61('0x16')]('/:id',auth[_0xda61('0x9')](),interaction[_0xda61('0x17')]('fax',_0xda61('0x18')),controller[_0xda61('0x19')]);router['delete'](_0xda61('0xc'),auth['isAuthenticated'](),interaction['tracked']('fax',_0xda61('0x1a')),controller[_0xda61('0x1b')]);router['delete'](_0xda61('0x1c'),auth[_0xda61('0x9')](),controller[_0xda61('0x1d')]);module[_0xda61('0x1e')]=router; \ No newline at end of file +var _0x3a4d=['post','create','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','put','/:id','faxinteraction:update','removeTags','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','index','/describe','describe','isAuthenticated','show','/:id/messages','getMessages'];(function(_0x53ddb3,_0x5ee378){var _0x8d40fb=function(_0xca3010){while(--_0xca3010){_0x53ddb3['push'](_0x53ddb3['shift']());}};_0x8d40fb(++_0x5ee378);}(_0x3a4d,0x1e8));var _0xd3a4=function(_0x59c765,_0x1b14cb){_0x59c765=_0x59c765-0x0;var _0x731b6d=_0x3a4d[_0x59c765];return _0x731b6d;};'use strict';var multer=require(_0xd3a4('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd3a4('0x1'));var express=require(_0xd3a4('0x2'));var router=express[_0xd3a4('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xd3a4('0x4'));var interaction=require(_0xd3a4('0x5'));var config=require(_0xd3a4('0x6'));var controller=require(_0xd3a4('0x7'));router[_0xd3a4('0x8')]('/',auth['isAuthenticated'](),controller[_0xd3a4('0x9')]);router['get'](_0xd3a4('0xa'),auth['isAuthenticated'](),controller[_0xd3a4('0xb')]);router[_0xd3a4('0x8')]('/:id',auth[_0xd3a4('0xc')](),controller[_0xd3a4('0xd')]);router[_0xd3a4('0x8')](_0xd3a4('0xe'),auth['isAuthenticated'](),controller[_0xd3a4('0xf')]);router['get']('/:id/download',auth[_0xd3a4('0xc')](),controller['download']);router[_0xd3a4('0x10')]('/',auth[_0xd3a4('0xc')](),controller[_0xd3a4('0x11')]);router['post'](_0xd3a4('0xe'),auth[_0xd3a4('0xc')](),controller[_0xd3a4('0x12')]);router['post'](_0xd3a4('0x13'),auth[_0xd3a4('0xc')](),interaction[_0xd3a4('0x14')](_0xd3a4('0x15'),_0xd3a4('0x16')),controller[_0xd3a4('0x17')]);router[_0xd3a4('0x18')](_0xd3a4('0x19'),auth[_0xd3a4('0xc')](),interaction[_0xd3a4('0x14')]('fax',_0xd3a4('0x1a')),controller['update']);router['delete'](_0xd3a4('0x19'),auth[_0xd3a4('0xc')](),interaction[_0xd3a4('0x14')](_0xd3a4('0x15'),'faxinteraction:destroy'),controller['destroy']);router['delete'](_0xd3a4('0x13'),auth[_0xd3a4('0xc')](),controller[_0xd3a4('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index b9e516b..b97dbed 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 _0xc831=['exports','TEXT','medium','BOOLEAN','ENUM','out','DATE'];(function(_0x1466ba,_0x4cd93e){var _0x56a71b=function(_0x1eb2d3){while(--_0x1eb2d3){_0x1466ba['push'](_0x1466ba['shift']());}};_0x56a71b(++_0x4cd93e);}(_0xc831,0x103));var _0x1c83=function(_0x383cfe,_0x4b8cdb){_0x383cfe=_0x383cfe-0x0;var _0x57925f=_0xc831[_0x383cfe];return _0x57925f;};'use strict';var Sequelize=require('sequelize');module[_0x1c83('0x0')]={'body':{'type':Sequelize[_0x1c83('0x1')](_0x1c83('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x1c83('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x1c83('0x4')]('in',_0x1c83('0x5')),'defaultValue':_0x1c83('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x1c83('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0x1c83('0x6')]}}; \ No newline at end of file +var _0x615a=['TEXT','BOOLEAN','ENUM','out','DATE','sequelize'];(function(_0x388bfa,_0x1f518c){var _0x11d6a6=function(_0x40b0b3){while(--_0x40b0b3){_0x388bfa['push'](_0x388bfa['shift']());}};_0x11d6a6(++_0x1f518c);}(_0x615a,0x119));var _0xa615=function(_0x3fd27c,_0x291768){_0x3fd27c=_0x3fd27c-0x0;var _0x35f210=_0x615a[_0x3fd27c];return _0x35f210;};'use strict';var Sequelize=require(_0xa615('0x0'));module['exports']={'body':{'type':Sequelize[_0xa615('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xa615('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xa615('0x3')]('in',_0xa615('0x4')),'defaultValue':_0xa615('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0xa615('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 6dc1d9d..1f46cda 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 _0x5ca3=['code','message','catch','status','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','sendStatus','stack','name','send','index','map','FaxMessage','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','options','includeAll','include','rows','show','find','body','params','describe','accept','sms','acceptMessage','fax','reject','UserId','FaxInteraction','FaxInteractionId','interaction','get','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','contact','User','agent','fullname','email','internal','format','SIP/%s','channel','motionChannel','event','EventManager','rejectmessage','create','CmContact','ContactId','Attachment','AttachmentId','SendFax','isNil','/var/opt/motion2/server/files/attachments/%s','join','root','files','attachments','basename','util','path','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','defaults','socket.io-emitter','redis','./faxMessage.socket','register','jayson/promise','client','request','info','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x5a0806,_0x5cb366){var _0x479b9c=function(_0x34920c){while(--_0x34920c){_0x5a0806['push'](_0x5a0806['shift']());}};_0x479b9c(++_0x5cb366);}(_0x5ca3,0xd1));var _0x35ca=function(_0x1855a8,_0x28aa7c){_0x1855a8=_0x1855a8-0x0;var _0x211756=_0x5ca3[_0x1855a8];return _0x211756;};'use strict';var util=require(_0x35ca('0x0'));var path=require(_0x35ca('0x1'));var _=require('lodash');var Redis=require(_0x35ca('0x2'));var interactionService=require(_0x35ca('0x3'));var qs=require(_0x35ca('0x4'));var logger=require(_0x35ca('0x5'))(_0x35ca('0x6'));var config=require(_0x35ca('0x7'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x35ca('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x35ca('0x9'))(new Redis(config[_0x35ca('0xa')]));require(_0x35ca('0xb'))[_0x35ca('0xc')](socket);var jayson=require(_0x35ca('0xd'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x35ca('0xe')]['http']({'port':0x232a});var interaction_log=require(_0x35ca('0x5'))('fax-interactions');function respondWithRpcPromise(_0x583830,_0x244496,_0x33b239,_0x360355){return new Promise(function(_0x434d50,_0xca5fe0){var _0x156e8a=_0x360355||client;return _0x156e8a[_0x35ca('0xf')](_0x583830,_0x33b239)['then'](function(_0x45e53f){logger[_0x35ca('0x10')](_0x35ca('0x11'),_0x244496,'request\x20sent');logger[_0x35ca('0x12')](_0x35ca('0x13'),_0x244496,_0x35ca('0x14'),JSON[_0x35ca('0x15')](_0x45e53f));if(_0x45e53f[_0x35ca('0x16')]){if(_0x45e53f[_0x35ca('0x16')][_0x35ca('0x17')]===0x1f4){logger[_0x35ca('0x16')](_0x35ca('0x11'),_0x244496,_0x45e53f[_0x35ca('0x16')]['message']);return _0xca5fe0(_0x45e53f[_0x35ca('0x16')][_0x35ca('0x18')]);}logger['error'](_0x35ca('0x11'),_0x244496,_0x45e53f[_0x35ca('0x16')][_0x35ca('0x18')]);return _0x434d50(_0x45e53f['error'][_0x35ca('0x18')]);}else{logger[_0x35ca('0x10')](_0x35ca('0x11'),_0x244496,'request\x20sent');_0x434d50(_0x45e53f['result'][_0x35ca('0x18')]);}})[_0x35ca('0x19')](function(_0x5204f5){logger[_0x35ca('0x16')]('FaxMessage,\x20%s,\x20%s',_0x244496,_0x5204f5);_0xca5fe0(_0x5204f5);});});}function respondWithResult(_0x206b69,_0x37dd38){_0x37dd38=_0x37dd38||0xc8;return function(_0x34b5af){if(_0x34b5af){return _0x206b69[_0x35ca('0x1a')](_0x37dd38)['json'](_0x34b5af);}};}function respondWithFilteredResult(_0x4e8915,_0x1baabb){return function(_0x25bb08){if(_0x25bb08){var _0x178fb1=typeof _0x1baabb[_0x35ca('0x1b')]===_0x35ca('0x1c')&&typeof _0x1baabb[_0x35ca('0x1d')]===_0x35ca('0x1c');var _0x2de060=_0x25bb08[_0x35ca('0x1e')];var _0x4b3a1a=_0x178fb1?0x0:_0x1baabb[_0x35ca('0x1b')];var _0x2800e2=_0x178fb1?_0x25bb08[_0x35ca('0x1e')]:_0x1baabb['offset']+_0x1baabb[_0x35ca('0x1d')];var _0x399acf;if(_0x2800e2>=_0x2de060){_0x2800e2=_0x2de060;_0x399acf=0xc8;}else{_0x399acf=0xce;}_0x4e8915[_0x35ca('0x1a')](_0x399acf);return _0x4e8915[_0x35ca('0x1f')](_0x35ca('0x20'),_0x4b3a1a+'-'+_0x2800e2+'/'+_0x2de060)['json'](_0x25bb08);}return null;};}function saveUpdates(_0xf68550){return function(_0xd0e2c1){if(_0xd0e2c1){return _0xd0e2c1[_0x35ca('0x21')](_0xf68550)[_0x35ca('0x22')](function(_0x1bc6ad){return _0x1bc6ad;});}return null;};}function removeEntity(_0x47bed7){return function(_0x487a0f){if(_0x487a0f){return _0x487a0f[_0x35ca('0x23')]()['then'](function(){_0x47bed7[_0x35ca('0x1a')](0xcc)[_0x35ca('0x24')]();});}};}function handleEntityNotFound(_0x4e12ed){return function(_0x377185){if(!_0x377185){_0x4e12ed[_0x35ca('0x25')](0x194);}return _0x377185;};}function handleError(_0x52d173,_0x57c42a){_0x57c42a=_0x57c42a||0x1f4;return function(_0x582d42){logger[_0x35ca('0x16')](_0x582d42[_0x35ca('0x26')]);if(_0x582d42[_0x35ca('0x27')]){delete _0x582d42['name'];}_0x52d173['status'](_0x57c42a)[_0x35ca('0x28')](_0x582d42);};}exports[_0x35ca('0x29')]=function(_0x30a629,_0x41c595){var _0x1f651f={},_0x41280e={},_0x430a09={'count':0x0,'rows':[]};var _0x5a4419=_[_0x35ca('0x2a')](db[_0x35ca('0x2b')]['rawAttributes'],function(_0x3d9a83){return{'name':_0x3d9a83[_0x35ca('0x2c')],'type':_0x3d9a83[_0x35ca('0x2d')][_0x35ca('0x2e')]};});_0x41280e[_0x35ca('0x2f')]=_[_0x35ca('0x2a')](_0x5a4419,_0x35ca('0x27'));_0x41280e[_0x35ca('0x30')]=_[_0x35ca('0x31')](_0x30a629[_0x35ca('0x30')]);_0x41280e[_0x35ca('0x32')]=_[_0x35ca('0x33')](_0x41280e['model'],_0x41280e['query']);_0x1f651f[_0x35ca('0x34')]=_[_0x35ca('0x33')](_0x41280e[_0x35ca('0x2f')],qs[_0x35ca('0x35')](_0x30a629[_0x35ca('0x30')][_0x35ca('0x35')]));_0x1f651f['attributes']=_0x1f651f[_0x35ca('0x34')][_0x35ca('0x36')]?_0x1f651f[_0x35ca('0x34')]:_0x41280e[_0x35ca('0x2f')];if(!_0x30a629[_0x35ca('0x30')][_0x35ca('0x37')](_0x35ca('0x38'))){_0x1f651f[_0x35ca('0x1d')]=qs[_0x35ca('0x1d')](_0x30a629[_0x35ca('0x30')]['limit']);_0x1f651f[_0x35ca('0x1b')]=qs[_0x35ca('0x1b')](_0x30a629['query']['offset']);}_0x1f651f[_0x35ca('0x39')]=qs[_0x35ca('0x3a')](_0x30a629[_0x35ca('0x30')][_0x35ca('0x3a')]);_0x1f651f['where']=qs[_0x35ca('0x32')](_[_0x35ca('0x3b')](_0x30a629[_0x35ca('0x30')],_0x41280e[_0x35ca('0x32')]),_0x5a4419);if(_0x30a629['query']['filter']){_0x1f651f[_0x35ca('0x3c')]=_['merge'](_0x1f651f[_0x35ca('0x3c')],{'$or':_['map'](_0x5a4419,function(_0x5e1702){if(_0x5e1702[_0x35ca('0x2d')]!==_0x35ca('0x3d')){var _0x120ffa={};_0x120ffa[_0x5e1702[_0x35ca('0x27')]]={'$like':'%'+_0x30a629[_0x35ca('0x30')][_0x35ca('0x3e')]+'%'};return _0x120ffa;}})});}_0x1f651f=_['merge']({},_0x1f651f,_0x30a629[_0x35ca('0x3f')]);var _0x51ebeb={'where':_0x1f651f['where']};return db[_0x35ca('0x2b')][_0x35ca('0x1e')](_0x51ebeb)[_0x35ca('0x22')](function(_0x5f0f3c){_0x430a09[_0x35ca('0x1e')]=_0x5f0f3c;if(_0x30a629[_0x35ca('0x30')][_0x35ca('0x40')]){_0x1f651f[_0x35ca('0x41')]=[{'all':!![]}];}return db[_0x35ca('0x2b')]['findAll'](_0x1f651f);})['then'](function(_0x467aa4){_0x430a09[_0x35ca('0x42')]=_0x467aa4;return _0x430a09;})[_0x35ca('0x22')](respondWithFilteredResult(_0x41c595,_0x1f651f))['catch'](handleError(_0x41c595,null));};exports[_0x35ca('0x43')]=function(_0x3a767c,_0x1097dd){var _0x2714ae={'raw':!![],'where':{'id':_0x3a767c['params']['id']}},_0x414de9={};_0x414de9[_0x35ca('0x2f')]=_[_0x35ca('0x31')](db['FaxMessage']['rawAttributes']);_0x414de9['query']=_[_0x35ca('0x31')](_0x3a767c['query']);_0x414de9[_0x35ca('0x32')]=_['intersection'](_0x414de9['model'],_0x414de9[_0x35ca('0x30')]);_0x2714ae[_0x35ca('0x34')]=_[_0x35ca('0x33')](_0x414de9[_0x35ca('0x2f')],qs[_0x35ca('0x35')](_0x3a767c[_0x35ca('0x30')][_0x35ca('0x35')]));_0x2714ae[_0x35ca('0x34')]=_0x2714ae[_0x35ca('0x34')][_0x35ca('0x36')]?_0x2714ae[_0x35ca('0x34')]:_0x414de9[_0x35ca('0x2f')];if(_0x3a767c[_0x35ca('0x30')][_0x35ca('0x40')]){_0x2714ae[_0x35ca('0x41')]=[{'all':!![]}];}_0x2714ae=_['merge']({},_0x2714ae,_0x3a767c['options']);return db[_0x35ca('0x2b')][_0x35ca('0x44')](_0x2714ae)[_0x35ca('0x22')](handleEntityNotFound(_0x1097dd,null))[_0x35ca('0x22')](respondWithResult(_0x1097dd,null))['catch'](handleError(_0x1097dd,null));};exports[_0x35ca('0x21')]=function(_0x5bbf59,_0x2247b0){if(_0x5bbf59[_0x35ca('0x45')]['id']){delete _0x5bbf59['body']['id'];}return db[_0x35ca('0x2b')]['find']({'where':{'id':_0x5bbf59[_0x35ca('0x46')]['id']}})[_0x35ca('0x22')](handleEntityNotFound(_0x2247b0,null))[_0x35ca('0x22')](saveUpdates(_0x5bbf59[_0x35ca('0x45')],null))[_0x35ca('0x22')](respondWithResult(_0x2247b0,null))[_0x35ca('0x19')](handleError(_0x2247b0,null));};exports['destroy']=function(_0x14e800,_0x4d390d){return db[_0x35ca('0x2b')][_0x35ca('0x44')]({'where':{'id':_0x14e800[_0x35ca('0x46')]['id']}})[_0x35ca('0x22')](handleEntityNotFound(_0x4d390d,null))[_0x35ca('0x22')](removeEntity(_0x4d390d,null))[_0x35ca('0x19')](handleError(_0x4d390d,null));};exports['describe']=function(_0x43eab1,_0x320c4e){return db['FaxMessage'][_0x35ca('0x47')]()[_0x35ca('0x22')](respondWithResult(_0x320c4e,null))[_0x35ca('0x19')](handleError(_0x320c4e,null));};exports[_0x35ca('0x48')]=function(_0x5086e0,_0x3be3fc){var _0x30b7ff=_0x35ca('0x49');return interactionService[_0x35ca('0x4a')](_0x5086e0,_0x30b7ff)[_0x35ca('0x22')](respondWithResult(_0x3be3fc,null))[_0x35ca('0x19')](handleError(_0x3be3fc,null));};exports[_0x35ca('0x48')]=function(_0x4d77a,_0x2a7df1){var _0x125863=_0x35ca('0x4b');return interactionService[_0x35ca('0x4a')](_0x4d77a,_0x125863)[_0x35ca('0x22')](respondWithResult(_0x2a7df1,null))[_0x35ca('0x19')](handleError(_0x2a7df1,null));};exports[_0x35ca('0x4c')]=function(_0x318f0b,_0x3dbde7){var _0x304a4f={'agent':{},'channel':'fax'};if(_0x318f0b[_0x35ca('0x45')]['id']){delete _0x318f0b['body']['id'];}_0x318f0b[_0x35ca('0x45')][_0x35ca('0x4d')]=_0x318f0b[_0x35ca('0x45')]['UserId']||_0x318f0b['user']['id'];_0x304a4f['agent']['id']=_0x318f0b[_0x35ca('0x45')][_0x35ca('0x4d')];return db['FaxMessage']['find']({'where':{'id':_0x318f0b[_0x35ca('0x46')]['id'],'UserId':null}})[_0x35ca('0x22')](handleEntityNotFound(_0x3dbde7,null))[_0x35ca('0x22')](function(_0xb0aac8){if(_0xb0aac8){_0x304a4f[_0x35ca('0x18')]=_0xb0aac8['get']({'plain':!![]});return db[_0x35ca('0x4e')]['find']({'where':{'id':_0xb0aac8[_0x35ca('0x4f')]}});}return null;})[_0x35ca('0x22')](handleEntityNotFound(_0x3dbde7,null))[_0x35ca('0x22')](function(_0x22fc3f){if(_0x22fc3f){_0x304a4f[_0x35ca('0x50')]=_0x22fc3f[_0x35ca('0x51')]({'plain':!![]});interaction_log[_0x35ca('0x10')](_0x35ca('0x52'),_0x318f0b[_0x35ca('0x53')]['id'],_0x318f0b[_0x35ca('0x53')][_0x35ca('0x27')],_0x318f0b[_0x35ca('0x53')][_0x35ca('0x54')],_0x304a4f[_0x35ca('0x50')]['id'],_0x318f0b['body']?JSON[_0x35ca('0x15')](_0x318f0b[_0x35ca('0x45')]):'null');return respondWithRpcPromise(_0x35ca('0x55'),_0x35ca('0x56'),_0x304a4f);}return null;})[_0x35ca('0x22')](function(_0x375a9e){var _0x1f2d7e=_0x35ca('0x57')+_0x375a9e[_0x35ca('0x18')]['ContactId'];return db[_0x35ca('0x58')][_0x35ca('0x30')](_0x1f2d7e,{'type':db[_0x35ca('0x59')]['QueryTypes']['SELECT'],'raw':!![]})[_0x35ca('0x22')](function(_0x1c1ea1){return _0x1c1ea1;});})[_0x35ca('0x22')](function(_0x5becf0){if(_0x5becf0){_0x304a4f[_0x35ca('0x18')][_0x35ca('0x5a')]=_0x5becf0[0x0];if(!_0x318f0b[_0x35ca('0x45')]['UserId'])return;return db[_0x35ca('0x5b')][_0x35ca('0x44')]({'where':{'id':_0x318f0b[_0x35ca('0x45')][_0x35ca('0x4d')],'role':_0x35ca('0x5c')},'attributes':['id',_0x35ca('0x27'),_0x35ca('0x5d'),_0x35ca('0x5e'),_0x35ca('0x5f')],'raw':!![]});}return null;})[_0x35ca('0x22')](function(_0x1ac2ea){if(!_0x1ac2ea)return null;_0x304a4f['message'][_0x35ca('0x5c')]=_0x1ac2ea;return _0x304a4f;})['then'](function(_0x1a7951){if(_0x1a7951){_0x1a7951[_0x35ca('0x18')]['interface']=util[_0x35ca('0x60')](_0x35ca('0x61'),_0x318f0b['user'][_0x35ca('0x27')]);_0x1a7951[_0x35ca('0x18')]['channel']=_0x304a4f[_0x35ca('0x62')];_0x1a7951['message'][_0x35ca('0x63')]=_0x304a4f[_0x35ca('0x62')];_0x1a7951[_0x35ca('0x18')][_0x35ca('0x64')]=_0x35ca('0x4c');respondWithRpcPromise('EventManager',_0x35ca('0x65'),{'event':_0x35ca('0x66'),'message':_0x1a7951[_0x35ca('0x18')]},client9002);return _0x304a4f;}return null;})['then'](respondWithResult(_0x3dbde7,null))['catch'](handleError(_0x3dbde7,null));};exports['create']=function(_0x37f757,_0x502778){var _0x36c3ad;return db[_0x35ca('0x2b')][_0x35ca('0x67')](_0x37f757['body'],{})[_0x35ca('0x22')](function(_0x7f04fe){_0x36c3ad=_0x7f04fe;return db[_0x35ca('0x68')]['findOne']({'where':{'id':_0x36c3ad[_0x35ca('0x69')]}});})[_0x35ca('0x22')](function(_0x40b605){if(_['isNil'](_0x40b605)){return;}else{_0x36c3ad[_0x35ca('0x4b')]=_0x40b605[_0x35ca('0x4b')];return db[_0x35ca('0x6a')]['findOne']({'where':{'id':_0x36c3ad[_0x35ca('0x6b')]}});}})['then'](function(_0x2daa30){return respondWithRpcPromise('SendFax',_0x35ca('0x6c'),{'FaxAccountId':_[_0x35ca('0x6d')](_0x37f757[_0x35ca('0x45')])?undefined:_0x37f757[_0x35ca('0x45')]['FaxAccountId'],'path':_['isNil'](_0x2daa30)?undefined:util[_0x35ca('0x60')](_0x35ca('0x6e'),_0x2daa30['basename']),'fax':_[_0x35ca('0x6d')](_0x36c3ad[_0x35ca('0x4b')])?undefined:_0x36c3ad[_0x35ca('0x4b')],'AttachmentId':_0x36c3ad[_0x35ca('0x6b')]},client9002);})[_0x35ca('0x22')](respondWithResult(_0x502778,0xc9))[_0x35ca('0x19')](handleError(_0x502778,null));};exports['download']=function(_0x4544a3,_0xb14b0){var _0x2ee8a7=path[_0x35ca('0x6f')](config[_0x35ca('0x70')],'server',_0x35ca('0x71'),_0x35ca('0x72'));return db[_0x35ca('0x2b')][_0x35ca('0x44')]({'where':{'id':_0x4544a3[_0x35ca('0x46')]['id']},'include':[{'model':db[_0x35ca('0x6a')],'as':_0x35ca('0x6a')}]})[_0x35ca('0x22')](handleEntityNotFound(_0xb14b0,null))['then'](function(_0x132212){if(_0x132212){return _0xb14b0['download'](path[_0x35ca('0x6f')](_0x2ee8a7,_0x132212[_0x35ca('0x6a')][_0x35ca('0x73')]));}})[_0x35ca('0x19')](handleError(_0xb14b0,null));}; \ No newline at end of file +var _0xbb2d=['message','result','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','sendStatus','stack','name','send','map','FaxMessage','rawAttributes','fieldName','type','key','model','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','keys','options','find','body','describe','accept','sms','fax','acceptMessage','reject','UserId','agent','get','FaxInteraction','FaxInteractionId','interaction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','fullname','internal','interface','SIP/%s','channel','EventManager','rejectmessage','create','CmContact','findOne','isNil','AttachmentId','SendFax','format','/var/opt/motion2/server/files/attachments/%s','download','join','root','server','files','attachments','Attachment','basename','util','path','lodash','../../components/interaction/service','../../config/logger','api','../../mysqldb','redis','./faxMessage.socket','register','jayson/promise','client','http','fax-interactions','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0xbb2d,0x14d));var _0xdbb2=function(_0x47a40b,_0x443ecf){_0x47a40b=_0x47a40b-0x0;var _0x19610c=_0xbb2d[_0x47a40b];return _0x19610c;};'use strict';var util=require(_0xdbb2('0x0'));var path=require(_0xdbb2('0x1'));var _=require(_0xdbb2('0x2'));var Redis=require('ioredis');var interactionService=require(_0xdbb2('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0xdbb2('0x4'))(_0xdbb2('0x5'));var config=require('../../config/environment');var db=require(_0xdbb2('0x6'))['db'];config['redis']=_['defaults'](config[_0xdbb2('0x7')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdbb2('0x7')]));require(_0xdbb2('0x8'))[_0xdbb2('0x9')](socket);var jayson=require(_0xdbb2('0xa'));var client=jayson[_0xdbb2('0xb')][_0xdbb2('0xc')]({'port':0x232c});var client9002=jayson['client'][_0xdbb2('0xc')]({'port':0x232a});var interaction_log=require(_0xdbb2('0x4'))(_0xdbb2('0xd'));function respondWithRpcPromise(_0x6efa8f,_0x24b7ed,_0x473f38,_0x364ad8){return new Promise(function(_0x1c0286,_0x340a14){var _0x5cbb18=_0x364ad8||client;return _0x5cbb18['request'](_0x6efa8f,_0x473f38)[_0xdbb2('0xe')](function(_0xb0e45f){logger[_0xdbb2('0xf')](_0xdbb2('0x10'),_0x24b7ed,_0xdbb2('0x11'));logger['debug']('FaxMessage,\x20%s,\x20%s,\x20%s',_0x24b7ed,_0xdbb2('0x11'),JSON[_0xdbb2('0x12')](_0xb0e45f));if(_0xb0e45f[_0xdbb2('0x13')]){if(_0xb0e45f[_0xdbb2('0x13')][_0xdbb2('0x14')]===0x1f4){logger[_0xdbb2('0x13')](_0xdbb2('0x10'),_0x24b7ed,_0xb0e45f[_0xdbb2('0x13')][_0xdbb2('0x15')]);return _0x340a14(_0xb0e45f[_0xdbb2('0x13')][_0xdbb2('0x15')]);}logger[_0xdbb2('0x13')](_0xdbb2('0x10'),_0x24b7ed,_0xb0e45f[_0xdbb2('0x13')]['message']);return _0x1c0286(_0xb0e45f[_0xdbb2('0x13')]['message']);}else{logger[_0xdbb2('0xf')](_0xdbb2('0x10'),_0x24b7ed,_0xdbb2('0x11'));_0x1c0286(_0xb0e45f[_0xdbb2('0x16')][_0xdbb2('0x15')]);}})['catch'](function(_0x51614d){logger[_0xdbb2('0x13')](_0xdbb2('0x10'),_0x24b7ed,_0x51614d);_0x340a14(_0x51614d);});});}function respondWithResult(_0xce76ff,_0x58c4ae){_0x58c4ae=_0x58c4ae||0xc8;return function(_0xcdac2d){if(_0xcdac2d){return _0xce76ff[_0xdbb2('0x17')](_0x58c4ae)[_0xdbb2('0x18')](_0xcdac2d);}};}function respondWithFilteredResult(_0x1bbf4a,_0x1bd048){return function(_0x43901b){if(_0x43901b){var _0xe39a20=typeof _0x1bd048[_0xdbb2('0x19')]===_0xdbb2('0x1a')&&typeof _0x1bd048[_0xdbb2('0x1b')]===_0xdbb2('0x1a');var _0x4d4585=_0x43901b[_0xdbb2('0x1c')];var _0x1080ce=_0xe39a20?0x0:_0x1bd048[_0xdbb2('0x19')];var _0xe49039=_0xe39a20?_0x43901b[_0xdbb2('0x1c')]:_0x1bd048[_0xdbb2('0x19')]+_0x1bd048['limit'];var _0x19030b;if(_0xe49039>=_0x4d4585){_0xe49039=_0x4d4585;_0x19030b=0xc8;}else{_0x19030b=0xce;}_0x1bbf4a[_0xdbb2('0x17')](_0x19030b);return _0x1bbf4a[_0xdbb2('0x1d')](_0xdbb2('0x1e'),_0x1080ce+'-'+_0xe49039+'/'+_0x4d4585)['json'](_0x43901b);}return null;};}function saveUpdates(_0x3f5871){return function(_0x34f0f7){if(_0x34f0f7){return _0x34f0f7[_0xdbb2('0x1f')](_0x3f5871)[_0xdbb2('0xe')](function(_0x1e5ee4){return _0x1e5ee4;});}return null;};}function removeEntity(_0x280a85){return function(_0x19beca){if(_0x19beca){return _0x19beca[_0xdbb2('0x20')]()['then'](function(){_0x280a85[_0xdbb2('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ed2b9){return function(_0x29d652){if(!_0x29d652){_0x3ed2b9[_0xdbb2('0x21')](0x194);}return _0x29d652;};}function handleError(_0xc561f4,_0x1f2e43){_0x1f2e43=_0x1f2e43||0x1f4;return function(_0x468605){logger[_0xdbb2('0x13')](_0x468605[_0xdbb2('0x22')]);if(_0x468605['name']){delete _0x468605[_0xdbb2('0x23')];}_0xc561f4['status'](_0x1f2e43)[_0xdbb2('0x24')](_0x468605);};}exports['index']=function(_0x59adc3,_0x1e1415){var _0x488a53={},_0x1f7fdc={},_0x3a3a82={'count':0x0,'rows':[]};var _0x329e0f=_[_0xdbb2('0x25')](db[_0xdbb2('0x26')][_0xdbb2('0x27')],function(_0x489b4e){return{'name':_0x489b4e[_0xdbb2('0x28')],'type':_0x489b4e[_0xdbb2('0x29')][_0xdbb2('0x2a')]};});_0x1f7fdc[_0xdbb2('0x2b')]=_[_0xdbb2('0x25')](_0x329e0f,_0xdbb2('0x23'));_0x1f7fdc['query']=_['keys'](_0x59adc3['query']);_0x1f7fdc[_0xdbb2('0x2c')]=_[_0xdbb2('0x2d')](_0x1f7fdc[_0xdbb2('0x2b')],_0x1f7fdc['query']);_0x488a53[_0xdbb2('0x2e')]=_[_0xdbb2('0x2d')](_0x1f7fdc[_0xdbb2('0x2b')],qs[_0xdbb2('0x2f')](_0x59adc3[_0xdbb2('0x30')][_0xdbb2('0x2f')]));_0x488a53[_0xdbb2('0x2e')]=_0x488a53[_0xdbb2('0x2e')][_0xdbb2('0x31')]?_0x488a53['attributes']:_0x1f7fdc['model'];if(!_0x59adc3['query'][_0xdbb2('0x32')](_0xdbb2('0x33'))){_0x488a53[_0xdbb2('0x1b')]=qs[_0xdbb2('0x1b')](_0x59adc3['query'][_0xdbb2('0x1b')]);_0x488a53[_0xdbb2('0x19')]=qs[_0xdbb2('0x19')](_0x59adc3[_0xdbb2('0x30')][_0xdbb2('0x19')]);}_0x488a53[_0xdbb2('0x34')]=qs[_0xdbb2('0x35')](_0x59adc3['query'][_0xdbb2('0x35')]);_0x488a53[_0xdbb2('0x36')]=qs[_0xdbb2('0x2c')](_[_0xdbb2('0x37')](_0x59adc3['query'],_0x1f7fdc[_0xdbb2('0x2c')]),_0x329e0f);if(_0x59adc3[_0xdbb2('0x30')][_0xdbb2('0x38')]){_0x488a53[_0xdbb2('0x36')]=_['merge'](_0x488a53['where'],{'$or':_[_0xdbb2('0x25')](_0x329e0f,function(_0x318678){if(_0x318678[_0xdbb2('0x29')]!==_0xdbb2('0x39')){var _0x183776={};_0x183776[_0x318678[_0xdbb2('0x23')]]={'$like':'%'+_0x59adc3[_0xdbb2('0x30')]['filter']+'%'};return _0x183776;}})});}_0x488a53=_[_0xdbb2('0x3a')]({},_0x488a53,_0x59adc3['options']);var _0x36801c={'where':_0x488a53[_0xdbb2('0x36')]};return db[_0xdbb2('0x26')]['count'](_0x36801c)[_0xdbb2('0xe')](function(_0x252d44){_0x3a3a82[_0xdbb2('0x1c')]=_0x252d44;if(_0x59adc3['query'][_0xdbb2('0x3b')]){_0x488a53[_0xdbb2('0x3c')]=[{'all':!![]}];}return db['FaxMessage'][_0xdbb2('0x3d')](_0x488a53);})[_0xdbb2('0xe')](function(_0x33d023){_0x3a3a82[_0xdbb2('0x3e')]=_0x33d023;return _0x3a3a82;})[_0xdbb2('0xe')](respondWithFilteredResult(_0x1e1415,_0x488a53))[_0xdbb2('0x3f')](handleError(_0x1e1415,null));};exports[_0xdbb2('0x40')]=function(_0x20b8fc,_0x22cb34){var _0x3224d6={'raw':!![],'where':{'id':_0x20b8fc[_0xdbb2('0x41')]['id']}},_0x44e344={};_0x44e344[_0xdbb2('0x2b')]=_[_0xdbb2('0x42')](db['FaxMessage']['rawAttributes']);_0x44e344[_0xdbb2('0x30')]=_[_0xdbb2('0x42')](_0x20b8fc[_0xdbb2('0x30')]);_0x44e344[_0xdbb2('0x2c')]=_[_0xdbb2('0x2d')](_0x44e344['model'],_0x44e344[_0xdbb2('0x30')]);_0x3224d6[_0xdbb2('0x2e')]=_['intersection'](_0x44e344['model'],qs[_0xdbb2('0x2f')](_0x20b8fc[_0xdbb2('0x30')]['fields']));_0x3224d6[_0xdbb2('0x2e')]=_0x3224d6[_0xdbb2('0x2e')]['length']?_0x3224d6[_0xdbb2('0x2e')]:_0x44e344[_0xdbb2('0x2b')];if(_0x20b8fc[_0xdbb2('0x30')]['includeAll']){_0x3224d6[_0xdbb2('0x3c')]=[{'all':!![]}];}_0x3224d6=_['merge']({},_0x3224d6,_0x20b8fc[_0xdbb2('0x43')]);return db[_0xdbb2('0x26')][_0xdbb2('0x44')](_0x3224d6)[_0xdbb2('0xe')](handleEntityNotFound(_0x22cb34,null))[_0xdbb2('0xe')](respondWithResult(_0x22cb34,null))['catch'](handleError(_0x22cb34,null));};exports[_0xdbb2('0x1f')]=function(_0x5f18d5,_0x90b89e){if(_0x5f18d5[_0xdbb2('0x45')]['id']){delete _0x5f18d5[_0xdbb2('0x45')]['id'];}return db[_0xdbb2('0x26')][_0xdbb2('0x44')]({'where':{'id':_0x5f18d5['params']['id']}})[_0xdbb2('0xe')](handleEntityNotFound(_0x90b89e,null))[_0xdbb2('0xe')](saveUpdates(_0x5f18d5['body'],null))[_0xdbb2('0xe')](respondWithResult(_0x90b89e,null))[_0xdbb2('0x3f')](handleError(_0x90b89e,null));};exports[_0xdbb2('0x20')]=function(_0x405b80,_0x330b66){return db['FaxMessage'][_0xdbb2('0x44')]({'where':{'id':_0x405b80[_0xdbb2('0x41')]['id']}})[_0xdbb2('0xe')](handleEntityNotFound(_0x330b66,null))[_0xdbb2('0xe')](removeEntity(_0x330b66,null))[_0xdbb2('0x3f')](handleError(_0x330b66,null));};exports['describe']=function(_0x4bac8e,_0x48b030){return db[_0xdbb2('0x26')][_0xdbb2('0x46')]()[_0xdbb2('0xe')](respondWithResult(_0x48b030,null))[_0xdbb2('0x3f')](handleError(_0x48b030,null));};exports[_0xdbb2('0x47')]=function(_0x10d1cf,_0x7001a9){var _0x53e710=_0xdbb2('0x48');return interactionService['acceptMessage'](_0x10d1cf,_0x53e710)['then'](respondWithResult(_0x7001a9,null))[_0xdbb2('0x3f')](handleError(_0x7001a9,null));};exports['accept']=function(_0x4669ff,_0x35a871){var _0xd7014=_0xdbb2('0x49');return interactionService[_0xdbb2('0x4a')](_0x4669ff,_0xd7014)[_0xdbb2('0xe')](respondWithResult(_0x35a871,null))[_0xdbb2('0x3f')](handleError(_0x35a871,null));};exports[_0xdbb2('0x4b')]=function(_0x2b0763,_0x2810a9){var _0x4b1936={'agent':{},'channel':'fax'};if(_0x2b0763[_0xdbb2('0x45')]['id']){delete _0x2b0763[_0xdbb2('0x45')]['id'];}_0x2b0763[_0xdbb2('0x45')][_0xdbb2('0x4c')]=_0x2b0763[_0xdbb2('0x45')][_0xdbb2('0x4c')]||_0x2b0763['user']['id'];_0x4b1936[_0xdbb2('0x4d')]['id']=_0x2b0763[_0xdbb2('0x45')][_0xdbb2('0x4c')];return db[_0xdbb2('0x26')][_0xdbb2('0x44')]({'where':{'id':_0x2b0763[_0xdbb2('0x41')]['id'],'UserId':null}})[_0xdbb2('0xe')](handleEntityNotFound(_0x2810a9,null))[_0xdbb2('0xe')](function(_0x20e8c8){if(_0x20e8c8){_0x4b1936['message']=_0x20e8c8[_0xdbb2('0x4e')]({'plain':!![]});return db[_0xdbb2('0x4f')][_0xdbb2('0x44')]({'where':{'id':_0x20e8c8[_0xdbb2('0x50')]}});}return null;})['then'](handleEntityNotFound(_0x2810a9,null))[_0xdbb2('0xe')](function(_0x4decc6){if(_0x4decc6){_0x4b1936[_0xdbb2('0x51')]=_0x4decc6['get']({'plain':!![]});interaction_log[_0xdbb2('0xf')](_0xdbb2('0x52'),_0x2b0763[_0xdbb2('0x53')]['id'],_0x2b0763[_0xdbb2('0x53')][_0xdbb2('0x23')],_0x2b0763[_0xdbb2('0x53')][_0xdbb2('0x54')],_0x4b1936[_0xdbb2('0x51')]['id'],_0x2b0763['body']?JSON['stringify'](_0x2b0763[_0xdbb2('0x45')]):_0xdbb2('0x55'));return respondWithRpcPromise(_0xdbb2('0x56'),_0xdbb2('0x57'),_0x4b1936);}return null;})[_0xdbb2('0xe')](function(_0x2771b1){var _0x192df8=_0xdbb2('0x58')+_0x2771b1[_0xdbb2('0x15')][_0xdbb2('0x59')];return db[_0xdbb2('0x5a')][_0xdbb2('0x30')](_0x192df8,{'type':db[_0xdbb2('0x5b')][_0xdbb2('0x5c')][_0xdbb2('0x5d')],'raw':!![]})['then'](function(_0x4f1e7c){return _0x4f1e7c;});})[_0xdbb2('0xe')](function(_0x4b758f){if(_0x4b758f){_0x4b1936['message']['contact']=_0x4b758f[0x0];if(!_0x2b0763['body'][_0xdbb2('0x4c')])return;return db[_0xdbb2('0x5e')][_0xdbb2('0x44')]({'where':{'id':_0x2b0763[_0xdbb2('0x45')]['UserId'],'role':'agent'},'attributes':['id',_0xdbb2('0x23'),_0xdbb2('0x5f'),'email',_0xdbb2('0x60')],'raw':!![]});}return null;})[_0xdbb2('0xe')](function(_0x210c6d){if(!_0x210c6d)return null;_0x4b1936['message'][_0xdbb2('0x4d')]=_0x210c6d;return _0x4b1936;})[_0xdbb2('0xe')](function(_0x34fb91){if(_0x34fb91){_0x34fb91[_0xdbb2('0x15')][_0xdbb2('0x61')]=util['format'](_0xdbb2('0x62'),_0x2b0763['user'][_0xdbb2('0x23')]);_0x34fb91[_0xdbb2('0x15')][_0xdbb2('0x63')]=_0x4b1936['channel'];_0x34fb91['message']['motionChannel']=_0x4b1936['channel'];_0x34fb91[_0xdbb2('0x15')]['event']='reject';respondWithRpcPromise(_0xdbb2('0x64'),_0xdbb2('0x64'),{'event':_0xdbb2('0x65'),'message':_0x34fb91['message']},client9002);return _0x4b1936;}return null;})[_0xdbb2('0xe')](respondWithResult(_0x2810a9,null))[_0xdbb2('0x3f')](handleError(_0x2810a9,null));};exports[_0xdbb2('0x66')]=function(_0x2e0fe7,_0x48d5af){var _0x3cbb08;return db[_0xdbb2('0x26')]['create'](_0x2e0fe7['body'],{})['then'](function(_0x15be68){_0x3cbb08=_0x15be68;return db[_0xdbb2('0x67')][_0xdbb2('0x68')]({'where':{'id':_0x3cbb08['ContactId']}});})[_0xdbb2('0xe')](function(_0x211e77){if(_[_0xdbb2('0x69')](_0x211e77)){return;}else{_0x3cbb08[_0xdbb2('0x49')]=_0x211e77[_0xdbb2('0x49')];return db['Attachment'][_0xdbb2('0x68')]({'where':{'id':_0x3cbb08[_0xdbb2('0x6a')]}});}})[_0xdbb2('0xe')](function(_0x14a028){return respondWithRpcPromise(_0xdbb2('0x6b'),_0xdbb2('0x6b'),{'FaxAccountId':_[_0xdbb2('0x69')](_0x2e0fe7['body'])?undefined:_0x2e0fe7[_0xdbb2('0x45')]['FaxAccountId'],'path':_[_0xdbb2('0x69')](_0x14a028)?undefined:util[_0xdbb2('0x6c')](_0xdbb2('0x6d'),_0x14a028['basename']),'fax':_[_0xdbb2('0x69')](_0x3cbb08[_0xdbb2('0x49')])?undefined:_0x3cbb08[_0xdbb2('0x49')],'AttachmentId':_0x3cbb08['AttachmentId']},client9002);})[_0xdbb2('0xe')](respondWithResult(_0x48d5af,0xc9))['catch'](handleError(_0x48d5af,null));};exports[_0xdbb2('0x6e')]=function(_0x1abcf2,_0x2a42d2){var _0x2cf3bc=path[_0xdbb2('0x6f')](config[_0xdbb2('0x70')],_0xdbb2('0x71'),_0xdbb2('0x72'),_0xdbb2('0x73'));return db[_0xdbb2('0x26')][_0xdbb2('0x44')]({'where':{'id':_0x1abcf2[_0xdbb2('0x41')]['id']},'include':[{'model':db['Attachment'],'as':_0xdbb2('0x74')}]})[_0xdbb2('0xe')](handleEntityNotFound(_0x2a42d2,null))[_0xdbb2('0xe')](function(_0x2e4e51){if(_0x2e4e51){return _0x2a42d2[_0xdbb2('0x6e')](path['join'](_0x2cf3bc,_0x2e4e51['Attachment'][_0xdbb2('0x75')]));}})['catch'](handleError(_0x2a42d2,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 9b5ad53..ef7a504 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 _0xf470=['hasOwnProperty','hook','exports','events','../../mysqldb','FaxMessage','setMaxListeners','save','update','emit'];(function(_0x21ebbc,_0x1ec54a){var _0xb25add=function(_0x437c38){while(--_0x437c38){_0x21ebbc['push'](_0x21ebbc['shift']());}};_0xb25add(++_0x1ec54a);}(_0xf470,0xfd));var _0x0f47=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0xf470[_0x209941];return _0x1e8729;};'use strict';var EventEmitter=require(_0x0f47('0x0'));var FaxMessage=require(_0x0f47('0x1'))['db'][_0x0f47('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x0f47('0x3')](0x0);var events={'afterCreate':_0x0f47('0x4'),'afterUpdate':_0x0f47('0x5'),'afterDestroy':'remove'};function emitEvent(_0x8fd765){return function(_0x3e20a3,_0x493828,_0x1b6cfc){FaxMessageEvents[_0x0f47('0x6')](_0x8fd765+':'+_0x3e20a3['id'],_0x3e20a3);FaxMessageEvents[_0x0f47('0x6')](_0x8fd765,_0x3e20a3);_0x1b6cfc(null);};}for(var e in events){if(events[_0x0f47('0x7')](e)){var event=events[e];FaxMessage[_0x0f47('0x8')](e,emitEvent(event));}}module[_0x0f47('0x9')]=FaxMessageEvents; \ No newline at end of file +var _0xc7bd=['hook','../../mysqldb','FaxMessage','save','remove','emit','hasOwnProperty'];(function(_0x364704,_0x314352){var _0x177693=function(_0x3fad61){while(--_0x3fad61){_0x364704['push'](_0x364704['shift']());}};_0x177693(++_0x314352);}(_0xc7bd,0x86));var _0xdc7b=function(_0x54d866,_0xf9a5a){_0x54d866=_0x54d866-0x0;var _0x337c33=_0xc7bd[_0x54d866];return _0x337c33;};'use strict';var EventEmitter=require('events');var FaxMessage=require(_0xdc7b('0x0'))['db'][_0xdc7b('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xdc7b('0x2'),'afterUpdate':'update','afterDestroy':_0xdc7b('0x3')};function emitEvent(_0x541301){return function(_0x5a8db9,_0x2d3095,_0x4050dc){FaxMessageEvents[_0xdc7b('0x4')](_0x541301+':'+_0x5a8db9['id'],_0x5a8db9);FaxMessageEvents[_0xdc7b('0x4')](_0x541301,_0x5a8db9);_0x4050dc(null);};}for(var e in events){if(events[_0xdc7b('0x5')](e)){var event=events[e];FaxMessage[_0xdc7b('0x6')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 309383e..c69c64a 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 _0xd8fb=['api','moment','bluebird','request-promise','path','rimraf','exports','define','FaxMessage','fax_messages','body','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0xecd4be,_0x37db25){var _0x4e4b4e=function(_0x12787c){while(--_0x12787c){_0xecd4be['push'](_0xecd4be['shift']());}};_0x4e4b4e(++_0x37db25);}(_0xd8fb,0x133));var _0xbd8f=function(_0x35b5b3,_0x5df9e8){_0x35b5b3=_0x35b5b3-0x0;var _0x45f35c=_0xd8fb[_0x35b5b3];return _0x45f35c;};'use strict';var _=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var logger=require(_0xbd8f('0x2'))(_0xbd8f('0x3'));var moment=require(_0xbd8f('0x4'));var BPromise=require(_0xbd8f('0x5'));var rp=require(_0xbd8f('0x6'));var fs=require('fs');var path=require(_0xbd8f('0x7'));var rimraf=require(_0xbd8f('0x8'));var config=require('../../config/environment');var attributes=require('./faxMessage.attributes');module[_0xbd8f('0x9')]=function(_0x186978,_0x3871f5){return _0x186978[_0xbd8f('0xa')](_0xbd8f('0xb'),attributes,{'tableName':_0xbd8f('0xc'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0xbd8f('0xd')],'type':_0xbd8f('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4c44fb,_0x9568b9,_0x13c875){var _0x4acba7=_0x186978['models'];var _0x317082=_0x4c44fb[_0xbd8f('0xf')]({'plain':!![]});if(_0x317082[_0xbd8f('0x10')][_0xbd8f('0x11')]()==='in'||_0x317082[_0xbd8f('0x10')][_0xbd8f('0x11')]()===_0xbd8f('0x12')&&!_0x317082[_0xbd8f('0x13')]&&!_[_0xbd8f('0x14')](_0x317082[_0xbd8f('0x15')])){_0x4acba7[_0xbd8f('0x16')][_0xbd8f('0x17')]({'where':{'id':_0x317082[_0xbd8f('0x18')]}})[_0xbd8f('0x19')](function(_0x1836a2){if(_0x1836a2){_0x1836a2['update']({'lastMsgAt':_0x317082[_0xbd8f('0x1a')],'lastMsgDirection':_0x317082[_0xbd8f('0x10')]['toLowerCase']()});}})[_0xbd8f('0x1b')](function(_0x5c7771){console[_0xbd8f('0x1c')](_0x5c7771);});}_0x13c875();}},'charset':_0xbd8f('0x1d'),'collate':_0xbd8f('0x1e')});}; \ No newline at end of file +var _0x9d1e=['./faxMessage.attributes','exports','define','FaxMessage','fax_messages','FULLTEXT','models','get','direction','toLowerCase','out','UserId','findOne','FaxInteractionId','then','update','createdAt','error','utf8mb4','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x1ffbd6,_0x45a3d6){var _0x2d0531=function(_0x542f48){while(--_0x542f48){_0x1ffbd6['push'](_0x1ffbd6['shift']());}};_0x2d0531(++_0x45a3d6);}(_0x9d1e,0x64));var _0xe9d1=function(_0x356bc8,_0x348c79){_0x356bc8=_0x356bc8-0x0;var _0x24722b=_0x9d1e[_0x356bc8];return _0x24722b;};'use strict';var _=require(_0xe9d1('0x0'));var util=require(_0xe9d1('0x1'));var logger=require(_0xe9d1('0x2'))(_0xe9d1('0x3'));var moment=require(_0xe9d1('0x4'));var BPromise=require('bluebird');var rp=require(_0xe9d1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe9d1('0x6'));var config=require(_0xe9d1('0x7'));var attributes=require(_0xe9d1('0x8'));module[_0xe9d1('0x9')]=function(_0x2fc532,_0x49c95f){return _0x2fc532[_0xe9d1('0xa')](_0xe9d1('0xb'),attributes,{'tableName':_0xe9d1('0xc'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':['body'],'type':_0xe9d1('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x39c316,_0x3c49a3,_0x32d76d){var _0x40dd85=_0x2fc532[_0xe9d1('0xe')];var _0x1d3356=_0x39c316[_0xe9d1('0xf')]({'plain':!![]});if(_0x1d3356[_0xe9d1('0x10')][_0xe9d1('0x11')]()==='in'||_0x1d3356[_0xe9d1('0x10')]['toLowerCase']()===_0xe9d1('0x12')&&!_0x1d3356['secret']&&!_['isNil'](_0x1d3356[_0xe9d1('0x13')])){_0x40dd85['FaxInteraction'][_0xe9d1('0x14')]({'where':{'id':_0x1d3356[_0xe9d1('0x15')]}})[_0xe9d1('0x16')](function(_0x3f8e34){if(_0x3f8e34){_0x3f8e34[_0xe9d1('0x17')]({'lastMsgAt':_0x1d3356[_0xe9d1('0x18')],'lastMsgDirection':_0x1d3356[_0xe9d1('0x10')][_0xe9d1('0x11')]()});}})['catch'](function(_0x4c670a){console[_0xe9d1('0x19')](_0x4c670a);});}_0x32d76d();}},'charset':_0xe9d1('0x1a'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index f97733d..3e79118 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 _0x9f62=['util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','request','info','request\x20sent','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','result','CreateFaxMessage','FaxMessage','body','raw','then','debug','catch','UpdateFaxMessage','update','options','where','attributes','limit'];(function(_0x422634,_0x1488a0){var _0x2dcf79=function(_0x180dfb){while(--_0x180dfb){_0x422634['push'](_0x422634['shift']());}};_0x2dcf79(++_0x1488a0);}(_0x9f62,0x154));var _0x29f6=function(_0x22bfb5,_0x51761d){_0x22bfb5=_0x22bfb5-0x0;var _0x12b87e=_0x9f62[_0x22bfb5];return _0x12b87e;};'use strict';var _=require('lodash');var util=require(_0x29f6('0x0'));var moment=require('moment');var BPromise=require(_0x29f6('0x1'));var rs=require(_0x29f6('0x2'));var fs=require('fs');var Redis=require(_0x29f6('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x29f6('0x4'))(_0x29f6('0x5'));var config=require(_0x29f6('0x6'));var jayson=require(_0x29f6('0x7'));var client=jayson['client'][_0x29f6('0x8')]({'port':0x232a});config[_0x29f6('0x9')]=_[_0x29f6('0xa')](config[_0x29f6('0x9')],{'host':_0x29f6('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./faxMessage.socket')['register'](socket);function respondWithRpcPromise(_0xe25841,_0x44db16,_0x4fb455){return new BPromise(function(_0x5a0724,_0x29b3f5){return client[_0x29f6('0xc')](_0xe25841,_0x4fb455)['then'](function(_0x17b69c){logger[_0x29f6('0xd')]('FaxMessage,\x20%s,\x20%s',_0x44db16,'request\x20sent');logger['debug']('FaxMessage,\x20%s,\x20%s,\x20%s',_0x44db16,_0x29f6('0xe'),JSON[_0x29f6('0xf')](_0x17b69c));if(_0x17b69c[_0x29f6('0x10')]){if(_0x17b69c[_0x29f6('0x10')][_0x29f6('0x11')]===0x1f4){logger[_0x29f6('0x10')](_0x29f6('0x12'),_0x44db16,_0x17b69c[_0x29f6('0x10')][_0x29f6('0x13')]);return _0x29b3f5(_0x17b69c[_0x29f6('0x10')][_0x29f6('0x13')]);}logger[_0x29f6('0x10')](_0x29f6('0x12'),_0x44db16,_0x17b69c[_0x29f6('0x10')][_0x29f6('0x13')]);return _0x5a0724(_0x17b69c[_0x29f6('0x10')][_0x29f6('0x13')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x44db16,_0x29f6('0xe'));_0x5a0724(_0x17b69c[_0x29f6('0x14')][_0x29f6('0x13')]);}})['catch'](function(_0xcb90){logger[_0x29f6('0x10')]('FaxMessage,\x20%s,\x20%s',_0x44db16,_0xcb90);_0x29b3f5(_0xcb90);});});}exports[_0x29f6('0x15')]=function(_0x3e81af){var _0x42a8fa=this;return new Promise(function(_0x41b9f0,_0xb6e7a9){return db[_0x29f6('0x16')]['create'](_0x3e81af[_0x29f6('0x17')],{'raw':_0x3e81af['options']?_0x3e81af['options'][_0x29f6('0x18')]===undefined?!![]:![]:!![]})[_0x29f6('0x19')](function(_0x39c6b3){logger[_0x29f6('0xd')]('CreateFaxMessage',_0x3e81af);logger[_0x29f6('0x1a')]('CreateFaxMessage',_0x3e81af,JSON[_0x29f6('0xf')](_0x39c6b3));_0x41b9f0(_0x39c6b3);})[_0x29f6('0x1b')](function(_0x4200cc){logger[_0x29f6('0x10')]('CreateFaxMessage',_0x4200cc[_0x29f6('0x13')],_0x3e81af);_0xb6e7a9(_0x42a8fa[_0x29f6('0x10')](0x1f4,_0x4200cc['message']));});});};exports[_0x29f6('0x1c')]=function(_0x45f792){var _0x2519ac=this;return new Promise(function(_0x342038,_0x84ccb7){return db[_0x29f6('0x16')][_0x29f6('0x1d')](_0x45f792['body'],{'raw':_0x45f792[_0x29f6('0x1e')]?_0x45f792[_0x29f6('0x1e')][_0x29f6('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45f792[_0x29f6('0x1e')]?_0x45f792[_0x29f6('0x1e')][_0x29f6('0x1f')]||null:null,'attributes':_0x45f792[_0x29f6('0x1e')]?_0x45f792[_0x29f6('0x1e')][_0x29f6('0x20')]||null:null,'limit':_0x45f792[_0x29f6('0x1e')]?_0x45f792[_0x29f6('0x1e')][_0x29f6('0x21')]||null:null})[_0x29f6('0x19')](function(_0x304c28){logger[_0x29f6('0xd')](_0x29f6('0x1c'),_0x45f792);logger[_0x29f6('0x1a')]('UpdateFaxMessage',_0x45f792,JSON['stringify'](_0x304c28));_0x342038(_0x304c28);})[_0x29f6('0x1b')](function(_0x489897){logger[_0x29f6('0x10')](_0x29f6('0x1c'),_0x489897[_0x29f6('0x13')],_0x45f792);_0x84ccb7(_0x2519ac[_0x29f6('0x10')](0x1f4,_0x489897['message']));});});}; \ No newline at end of file +var _0xf3cd=['redis','defaults','socket.io-emitter','register','request','then','info','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateFaxMessage','body','options','raw','UpdateFaxMessage','FaxMessage','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x216286,_0x527c9b){var _0x593472=function(_0x46b115){while(--_0x46b115){_0x216286['push'](_0x216286['shift']());}};_0x593472(++_0x527c9b);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x3cb530,_0x170e8c){_0x3cb530=_0x3cb530-0x0;var _0x4168ea=_0xf3cd[_0x3cb530];return _0x4168ea;};'use strict';var _=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var moment=require(_0xdf3c('0x2'));var BPromise=require(_0xdf3c('0x3'));var rs=require(_0xdf3c('0x4'));var fs=require('fs');var Redis=require(_0xdf3c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xdf3c('0x6'));var logger=require(_0xdf3c('0x7'))(_0xdf3c('0x8'));var config=require('../../config/environment');var jayson=require(_0xdf3c('0x9'));var client=jayson[_0xdf3c('0xa')][_0xdf3c('0xb')]({'port':0x232a});config[_0xdf3c('0xc')]=_[_0xdf3c('0xd')](config[_0xdf3c('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xdf3c('0xe'))(new Redis(config['redis']));require('./faxMessage.socket')[_0xdf3c('0xf')](socket);function respondWithRpcPromise(_0x981616,_0x5ef936,_0x1dba4c){return new BPromise(function(_0x205f33,_0x2d420c){return client[_0xdf3c('0x10')](_0x981616,_0x1dba4c)[_0xdf3c('0x11')](function(_0x1c456b){logger[_0xdf3c('0x12')](_0xdf3c('0x13'),_0x5ef936,'request\x20sent');logger[_0xdf3c('0x14')](_0xdf3c('0x15'),_0x5ef936,_0xdf3c('0x16'),JSON[_0xdf3c('0x17')](_0x1c456b));if(_0x1c456b['error']){if(_0x1c456b[_0xdf3c('0x18')][_0xdf3c('0x19')]===0x1f4){logger[_0xdf3c('0x18')]('FaxMessage,\x20%s,\x20%s',_0x5ef936,_0x1c456b[_0xdf3c('0x18')][_0xdf3c('0x1a')]);return _0x2d420c(_0x1c456b[_0xdf3c('0x18')][_0xdf3c('0x1a')]);}logger[_0xdf3c('0x18')](_0xdf3c('0x13'),_0x5ef936,_0x1c456b[_0xdf3c('0x18')][_0xdf3c('0x1a')]);return _0x205f33(_0x1c456b[_0xdf3c('0x18')][_0xdf3c('0x1a')]);}else{logger['info'](_0xdf3c('0x13'),_0x5ef936,_0xdf3c('0x16'));_0x205f33(_0x1c456b[_0xdf3c('0x1b')][_0xdf3c('0x1a')]);}})[_0xdf3c('0x1c')](function(_0x113b56){logger[_0xdf3c('0x18')](_0xdf3c('0x13'),_0x5ef936,_0x113b56);_0x2d420c(_0x113b56);});});}exports[_0xdf3c('0x1d')]=function(_0x18fb5f){var _0x267488=this;return new Promise(function(_0x3d14cc,_0x25487c){return db['FaxMessage']['create'](_0x18fb5f[_0xdf3c('0x1e')],{'raw':_0x18fb5f['options']?_0x18fb5f[_0xdf3c('0x1f')][_0xdf3c('0x20')]===undefined?!![]:![]:!![]})[_0xdf3c('0x11')](function(_0x38b319){logger[_0xdf3c('0x12')](_0xdf3c('0x1d'),_0x18fb5f);logger['debug'](_0xdf3c('0x1d'),_0x18fb5f,JSON[_0xdf3c('0x17')](_0x38b319));_0x3d14cc(_0x38b319);})[_0xdf3c('0x1c')](function(_0x24754a){logger[_0xdf3c('0x18')](_0xdf3c('0x1d'),_0x24754a[_0xdf3c('0x1a')],_0x18fb5f);_0x25487c(_0x267488[_0xdf3c('0x18')](0x1f4,_0x24754a[_0xdf3c('0x1a')]));});});};exports[_0xdf3c('0x21')]=function(_0x4c076c){var _0xd284d7=this;return new Promise(function(_0x153daa,_0x4b57a4){return db[_0xdf3c('0x22')]['update'](_0x4c076c['body'],{'raw':_0x4c076c['options']?_0x4c076c[_0xdf3c('0x1f')][_0xdf3c('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c076c['options']?_0x4c076c['options'][_0xdf3c('0x23')]||null:null,'attributes':_0x4c076c[_0xdf3c('0x1f')]?_0x4c076c[_0xdf3c('0x1f')][_0xdf3c('0x24')]||null:null,'limit':_0x4c076c['options']?_0x4c076c[_0xdf3c('0x1f')][_0xdf3c('0x25')]||null:null})['then'](function(_0x51e0a4){logger[_0xdf3c('0x12')](_0xdf3c('0x21'),_0x4c076c);logger[_0xdf3c('0x14')]('UpdateFaxMessage',_0x4c076c,JSON[_0xdf3c('0x17')](_0x51e0a4));_0x153daa(_0x51e0a4);})[_0xdf3c('0x1c')](function(_0x21e7b8){logger[_0xdf3c('0x18')]('UpdateFaxMessage',_0x21e7b8[_0xdf3c('0x1a')],_0x4c076c);_0x4b57a4(_0xd284d7[_0xdf3c('0x18')](0x1f4,_0x21e7b8['message']));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 094e373..a84a83d 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 _0x014b=['length','remove','update','emit','removeListener','register'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0x014b,0x109));var _0xb014=function(_0x3eb7c4,_0x33127c){_0x3eb7c4=_0x3eb7c4-0x0;var _0x4fd396=_0x014b[_0x3eb7c4];return _0x4fd396;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=['save',_0xb014('0x0'),_0xb014('0x1')];function createListener(_0xf9ce70,_0x2254f5){return function(_0x2682f6){_0x2254f5[_0xb014('0x2')](_0xf9ce70,_0x2682f6);};}function removeListener(_0x41c18e,_0x1c39d6){return function(){FaxMessageEvents[_0xb014('0x3')](_0x41c18e,_0x1c39d6);};}exports[_0xb014('0x4')]=function(_0x423594){for(var _0x1053c9=0x0,_0x2a2b7d=events[_0xb014('0x5')];_0x1053c9<_0x2a2b7d;_0x1053c9++){var _0x4f7c07=events[_0x1053c9];var _0x39e33f=createListener('faxMessage:'+_0x4f7c07,_0x423594);FaxMessageEvents['on'](_0x4f7c07,_0x39e33f);}}; \ No newline at end of file +var _0x862d=['emit','register','length','faxMessage:','./faxMessage.events','save','remove','update'];(function(_0x1a550a,_0x1c44fb){var _0x507d39=function(_0x16b65f){while(--_0x16b65f){_0x1a550a['push'](_0x1a550a['shift']());}};_0x507d39(++_0x1c44fb);}(_0x862d,0x18c));var _0xd862=function(_0x4530fc,_0x2fe936){_0x4530fc=_0x4530fc-0x0;var _0x35c896=_0x862d[_0x4530fc];return _0x35c896;};'use strict';var FaxMessageEvents=require(_0xd862('0x0'));var events=[_0xd862('0x1'),_0xd862('0x2'),_0xd862('0x3')];function createListener(_0x53a61a,_0xe562a0){return function(_0x15119e){_0xe562a0[_0xd862('0x4')](_0x53a61a,_0x15119e);};}function removeListener(_0x3b5cfe,_0x39446b){return function(){FaxMessageEvents['removeListener'](_0x3b5cfe,_0x39446b);};}exports[_0xd862('0x5')]=function(_0x3f6a29){for(var _0x1b613d=0x0,_0xa27839=events[_0xd862('0x6')];_0x1b613d<_0xa27839;_0x1b613d++){var _0x6b643b=events[_0x1b613d];var _0x28bf78=createListener(_0xd862('0x7')+_0x6b643b,_0x3f6a29);FaxMessageEvents['on'](_0x6b643b,_0x28bf78);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index fe5482c..dc4e6ff 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 _0xf72b=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/download','post','tracked','fax','faxmessage:create','create','put','update','/:id/accept','accept','reject','delete','destroy','exports','multer','path','express'];(function(_0x165270,_0x34b93e){var _0x56dc19=function(_0x4eba9f){while(--_0x4eba9f){_0x165270['push'](_0x165270['shift']());}};_0x56dc19(++_0x34b93e);}(_0xf72b,0x1d9));var _0xbf72=function(_0x3d1289,_0xb17e79){_0x3d1289=_0x3d1289-0x0;var _0x1b5f88=_0xf72b[_0x3d1289];return _0x1b5f88;};'use strict';var multer=require(_0xbf72('0x0'));var util=require('util');var path=require(_0xbf72('0x1'));var timeout=require('connect-timeout');var express=require(_0xbf72('0x2'));var router=express[_0xbf72('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbf72('0x4'));var interaction=require(_0xbf72('0x5'));var config=require(_0xbf72('0x6'));var controller=require(_0xbf72('0x7'));router[_0xbf72('0x8')]('/',auth[_0xbf72('0x9')](),controller['index']);router[_0xbf72('0x8')](_0xbf72('0xa'),auth[_0xbf72('0x9')](),controller[_0xbf72('0xb')]);router[_0xbf72('0x8')](_0xbf72('0xc'),auth['isAuthenticated'](),controller[_0xbf72('0xd')]);router['get'](_0xbf72('0xe'),auth[_0xbf72('0x9')](),controller['download']);router[_0xbf72('0xf')]('/',auth[_0xbf72('0x9')](),interaction[_0xbf72('0x10')](_0xbf72('0x11'),_0xbf72('0x12')),controller[_0xbf72('0x13')]);router[_0xbf72('0x14')](_0xbf72('0xc'),auth['isAuthenticated'](),controller[_0xbf72('0x15')]);router[_0xbf72('0x14')](_0xbf72('0x16'),auth['isAuthenticated'](),controller[_0xbf72('0x17')]);router['put']('/:id/reject',auth['isAuthenticated'](),controller[_0xbf72('0x18')]);router[_0xbf72('0x19')](_0xbf72('0xc'),auth[_0xbf72('0x9')](),controller[_0xbf72('0x1a')]);module[_0xbf72('0x1b')]=router; \ No newline at end of file +var _0xee5b=['update','/:id/accept','accept','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','/:id/download','download','post','tracked','fax','faxmessage:create','create','put','/:id'];(function(_0x452f6e,_0x9bb466){var _0x14154c=function(_0x520cf5){while(--_0x520cf5){_0x452f6e['push'](_0x452f6e['shift']());}};_0x14154c(++_0x9bb466);}(_0xee5b,0x1f4));var _0xbee5=function(_0xb58866,_0x97375c){_0xb58866=_0xb58866-0x0;var _0x746f5d=_0xee5b[_0xb58866];return _0x746f5d;};'use strict';var multer=require(_0xbee5('0x0'));var util=require('util');var path=require(_0xbee5('0x1'));var timeout=require(_0xbee5('0x2'));var express=require('express');var router=express[_0xbee5('0x3')]();var fs_extra=require(_0xbee5('0x4'));var auth=require(_0xbee5('0x5'));var interaction=require(_0xbee5('0x6'));var config=require('../../config/environment');var controller=require('./faxMessage.controller');router[_0xbee5('0x7')]('/',auth[_0xbee5('0x8')](),controller[_0xbee5('0x9')]);router[_0xbee5('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0xbee5('0x8')](),controller[_0xbee5('0xa')]);router[_0xbee5('0x7')](_0xbee5('0xb'),auth['isAuthenticated'](),controller[_0xbee5('0xc')]);router[_0xbee5('0xd')]('/',auth[_0xbee5('0x8')](),interaction[_0xbee5('0xe')](_0xbee5('0xf'),_0xbee5('0x10')),controller[_0xbee5('0x11')]);router[_0xbee5('0x12')](_0xbee5('0x13'),auth['isAuthenticated'](),controller[_0xbee5('0x14')]);router['put'](_0xbee5('0x15'),auth[_0xbee5('0x8')](),controller[_0xbee5('0x16')]);router['put']('/:id/reject',auth[_0xbee5('0x8')](),controller['reject']);router[_0xbee5('0x17')]('/:id',auth[_0xbee5('0x8')](),controller[_0xbee5('0x18')]);module[_0xbee5('0x19')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 201e436..d40aba2 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 _0x9f53=['exports','STRING','INTEGER','rrmemory','beepall','roundrobin','sequelize'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0x9f53,0xfb));var _0x39f5=function(_0x465daa,_0x558b2b){_0x465daa=_0x465daa-0x0;var _0xaa5a37=_0x9f53[_0x465daa];return _0xaa5a37;};'use strict';var Sequelize=require(_0x39f5('0x0'));module[_0x39f5('0x1')]={'name':{'type':Sequelize[_0x39f5('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x39f5('0x2')]},'timeout':{'type':Sequelize[_0x39f5('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x39f5('0x4'),_0x39f5('0x5'),_0x39f5('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x39f5('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8411=['sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin'];(function(_0x2767af,_0x57e921){var _0x1f7c84=function(_0x946955){while(--_0x946955){_0x2767af['push'](_0x2767af['shift']());}};_0x1f7c84(++_0x57e921);}(_0x8411,0x168));var _0x1841=function(_0x5132fa,_0x2893f4){_0x5132fa=_0x5132fa-0x0;var _0x5cf339=_0x8411[_0x5132fa];return _0x5cf339;};'use strict';var Sequelize=require(_0x1841('0x0'));module[_0x1841('0x1')]={'name':{'type':Sequelize[_0x1841('0x2')],'unique':_0x1841('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1841('0x2')]},'timeout':{'type':Sequelize[_0x1841('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1841('0x5')](_0x1841('0x6'),_0x1841('0x7'),_0x1841('0x8')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x1841('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index a8272ab..ff7ee22 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 _0xb4c7=['removeAgents','userFaxQueue:remove','addAgents','spread','isArray','getAgents','bluebird','util','lodash','squel','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','FaxQueues','UserProfileResource','error','name','send','index','map','FaxQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','findAll','rows','model','keys','filters','intersection','fields','attributes','length','merge','options','catch','create','user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','getMembers','findOne','hasOwnProperty','sort','filter','User','findAndCountAll','UserId','agent','faxPause','createdAt','SIP','updatedAt','getTeams','Team','order','pick','nolimit','addTeams','Agents','voicePause','interface','flatMap','sequelize','transaction','each','UserFaxQueue','forEach','emit','userFaxQueue:save','removeTeams','ids','select','tq.TeamId','from','team_has_fax_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','all','union','value','isEmpty'];(function(_0x1c6ef2,_0x8d926a){var _0x404b8c=function(_0x4fdf1e){while(--_0x4fdf1e){_0x1c6ef2['push'](_0x1c6ef2['shift']());}};_0x404b8c(++_0x8d926a);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x2bea98,_0x158b40){_0x2bea98=_0x2bea98-0x0;var _0x335552=_0xb4c7[_0x2bea98];return _0x335552;};'use strict';var BPromise=require(_0x7b4c('0x0'));var util=require(_0x7b4c('0x1'));var _=require(_0x7b4c('0x2'));var squel=require(_0x7b4c('0x3'));var Redis=require(_0x7b4c('0x4'));var qs=require('../../components/parsers/qs');var logger=require(_0x7b4c('0x5'))(_0x7b4c('0x6'));var config=require(_0x7b4c('0x7'));var db=require(_0x7b4c('0x8'))['db'];config[_0x7b4c('0x9')]=_['defaults'](config[_0x7b4c('0x9')],{'host':_0x7b4c('0xa'),'port':0x18eb});var socket=require(_0x7b4c('0xb'))(new Redis(config['redis']));require(_0x7b4c('0xc'))[_0x7b4c('0xd')](socket);function respondWithStatusCode(_0x570daa,_0x433aa2){_0x433aa2=_0x433aa2||0xcc;return function(_0x179b2d){if(_0x179b2d){return _0x570daa[_0x7b4c('0xe')](_0x433aa2);}return _0x570daa[_0x7b4c('0xf')](_0x433aa2)[_0x7b4c('0x10')]();};}function respondWithResult(_0x93d013,_0x1a996f){_0x1a996f=_0x1a996f||0xc8;return function(_0xc62104){if(_0xc62104){return _0x93d013[_0x7b4c('0xf')](_0x1a996f)[_0x7b4c('0x11')](_0xc62104);}};}function respondWithFilteredResult(_0x5d5bc3,_0x554d62){return function(_0x24dd7d){if(_0x24dd7d){var _0x18342b=typeof _0x554d62[_0x7b4c('0x12')]===_0x7b4c('0x13')&&typeof _0x554d62[_0x7b4c('0x14')]===_0x7b4c('0x13');var _0x3ea0da=_0x24dd7d[_0x7b4c('0x15')];var _0x25b90b=_0x18342b?0x0:_0x554d62[_0x7b4c('0x12')];var _0x593a19=_0x18342b?_0x24dd7d[_0x7b4c('0x15')]:_0x554d62[_0x7b4c('0x12')]+_0x554d62[_0x7b4c('0x14')];var _0x2a0e2f;if(_0x593a19>=_0x3ea0da){_0x593a19=_0x3ea0da;_0x2a0e2f=0xc8;}else{_0x2a0e2f=0xce;}_0x5d5bc3[_0x7b4c('0xf')](_0x2a0e2f);return _0x5d5bc3[_0x7b4c('0x16')](_0x7b4c('0x17'),_0x25b90b+'-'+_0x593a19+'/'+_0x3ea0da)[_0x7b4c('0x11')](_0x24dd7d);}return null;};}function saveUpdates(_0x4d3f5e){return function(_0x36e701){if(_0x36e701){return _0x36e701[_0x7b4c('0x18')](_0x4d3f5e)[_0x7b4c('0x19')](function(_0x36c02a){return _0x36c02a;});}return null;};}function removeEntity(_0x59ae96){return function(_0x3ce10c){if(_0x3ce10c){return _0x3ce10c[_0x7b4c('0x1a')]()[_0x7b4c('0x19')](function(){var _0x380b79=_0x3ce10c[_0x7b4c('0x1b')]({'plain':!![]});var _0x1363b4=_0x7b4c('0x1c');return db[_0x7b4c('0x1d')][_0x7b4c('0x1a')]({'where':{'type':_0x1363b4,'resourceId':_0x380b79['id']}})['then'](function(){return _0x3ce10c;});})[_0x7b4c('0x19')](function(){_0x59ae96[_0x7b4c('0xf')](0xcc)[_0x7b4c('0x10')]();});}};}function handleEntityNotFound(_0xabeffb){return function(_0x148a79){if(!_0x148a79){_0xabeffb[_0x7b4c('0xe')](0x194);}return _0x148a79;};}function handleError(_0x176704,_0x3d4826){_0x3d4826=_0x3d4826||0x1f4;return function(_0x2ab9e1){logger[_0x7b4c('0x1e')](_0x2ab9e1['stack']);if(_0x2ab9e1[_0x7b4c('0x1f')]){delete _0x2ab9e1[_0x7b4c('0x1f')];}_0x176704[_0x7b4c('0xf')](_0x3d4826)[_0x7b4c('0x20')](_0x2ab9e1);};}exports[_0x7b4c('0x21')]=function(_0x2bdc4d,_0x37c059){var _0x459eb4={};var _0x1f311e={'count':0x0,'rows':[]};var _0x1a69db=_[_0x7b4c('0x22')](db[_0x7b4c('0x23')][_0x7b4c('0x24')],function(_0x501f75){return{'name':_0x501f75[_0x7b4c('0x25')],'type':_0x501f75[_0x7b4c('0x26')][_0x7b4c('0x27')]};});_0x459eb4=qs[_0x7b4c('0x28')](_0x1a69db,_0x2bdc4d);var _0x207c2f={'where':_0x459eb4[_0x7b4c('0x29')]};return db[_0x7b4c('0x23')][_0x7b4c('0x15')](_0x207c2f)[_0x7b4c('0x19')](function(_0x9a799b){_0x1f311e[_0x7b4c('0x15')]=_0x9a799b;_0x459eb4[_0x7b4c('0x2a')]=qs[_0x7b4c('0x2a')](_0x2bdc4d[_0x7b4c('0x2b')]);return db[_0x7b4c('0x23')][_0x7b4c('0x2c')](_0x459eb4);})[_0x7b4c('0x19')](function(_0xce5781){_0x1f311e[_0x7b4c('0x2d')]=_0xce5781;return _0x1f311e;})['then'](respondWithFilteredResult(_0x37c059,_0x459eb4))['catch'](handleError(_0x37c059,null));};exports['show']=function(_0x2fe0f4,_0x2efff3){var _0x14fb7f={'raw':!![],'where':{'id':_0x2fe0f4['params']['id']}},_0x66e770={};_0x66e770[_0x7b4c('0x2e')]=_[_0x7b4c('0x2f')](db['FaxQueue'][_0x7b4c('0x24')]);_0x66e770['query']=_[_0x7b4c('0x2f')](_0x2fe0f4[_0x7b4c('0x2b')]);_0x66e770[_0x7b4c('0x30')]=_['intersection'](_0x66e770[_0x7b4c('0x2e')],_0x66e770[_0x7b4c('0x2b')]);_0x14fb7f['attributes']=_[_0x7b4c('0x31')](_0x66e770[_0x7b4c('0x2e')],qs[_0x7b4c('0x32')](_0x2fe0f4[_0x7b4c('0x2b')]['fields']));_0x14fb7f['attributes']=_0x14fb7f[_0x7b4c('0x33')][_0x7b4c('0x34')]?_0x14fb7f['attributes']:_0x66e770[_0x7b4c('0x2e')];if(_0x2fe0f4['query']['includeAll']){_0x14fb7f[_0x7b4c('0x2a')]=[{'all':!![]}];}_0x14fb7f=_[_0x7b4c('0x35')]({},_0x14fb7f,_0x2fe0f4[_0x7b4c('0x36')]);return db[_0x7b4c('0x23')]['find'](_0x14fb7f)[_0x7b4c('0x19')](handleEntityNotFound(_0x2efff3,null))[_0x7b4c('0x19')](respondWithResult(_0x2efff3,null))[_0x7b4c('0x37')](handleError(_0x2efff3,null));};exports[_0x7b4c('0x38')]=function(_0x346e0c,_0xddd16){return db[_0x7b4c('0x23')]['create'](_0x346e0c['body'],{})[_0x7b4c('0x19')](function(_0x37f136){var _0x31ef1e=_0x346e0c[_0x7b4c('0x39')][_0x7b4c('0x1b')]({'plain':!![]});if(!_0x31ef1e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x31ef1e[_0x7b4c('0x3a')]===_0x7b4c('0x39')){var _0x46b9ae=_0x37f136[_0x7b4c('0x1b')]({'plain':!![]});var _0x22f71b=_0x7b4c('0x1c');return db[_0x7b4c('0x3b')][_0x7b4c('0x3c')]({'where':{'name':_0x22f71b,'userProfileId':_0x31ef1e[_0x7b4c('0x3d')]},'raw':!![]})['then'](function(_0x2a4085){if(_0x2a4085&&_0x2a4085['autoAssociation']===0x0){return db[_0x7b4c('0x1d')]['create']({'name':_0x46b9ae[_0x7b4c('0x1f')],'resourceId':_0x46b9ae['id'],'type':_0x2a4085[_0x7b4c('0x1f')],'sectionId':_0x2a4085['id']},{})['then'](function(){return _0x37f136;});}else{return _0x37f136;}})['catch'](function(_0x354578){logger[_0x7b4c('0x1e')](_0x7b4c('0x3e'),_0x354578);throw _0x354578;});}return _0x37f136;})[_0x7b4c('0x19')](respondWithResult(_0xddd16,0xc9))['catch'](handleError(_0xddd16,null));};exports[_0x7b4c('0x18')]=function(_0x2ed731,_0x100774){if(_0x2ed731['body']['id']){delete _0x2ed731[_0x7b4c('0x3f')]['id'];}return db['FaxQueue']['find']({'where':{'id':_0x2ed731[_0x7b4c('0x40')]['id']}})['then'](handleEntityNotFound(_0x100774,null))[_0x7b4c('0x19')](saveUpdates(_0x2ed731[_0x7b4c('0x3f')],null))[_0x7b4c('0x19')](respondWithResult(_0x100774,null))[_0x7b4c('0x37')](handleError(_0x100774,null));};exports[_0x7b4c('0x1a')]=function(_0x42f386,_0x13de84){return db[_0x7b4c('0x23')][_0x7b4c('0x3c')]({'where':{'id':_0x42f386['params']['id']}})[_0x7b4c('0x19')](handleEntityNotFound(_0x13de84,null))['then'](removeEntity(_0x13de84,null))['catch'](handleError(_0x13de84,null));};exports[_0x7b4c('0x41')]=function(_0x1f1653,_0x54a887){return db['FaxQueue'][_0x7b4c('0x41')]()[_0x7b4c('0x19')](respondWithResult(_0x54a887,null))[_0x7b4c('0x37')](handleError(_0x54a887,null));};exports[_0x7b4c('0x42')]=function(_0x8ebf9b,_0x4759e9){var _0x336796={'raw':!![],'where':{}},_0x1cf7c7={},_0x57ad8c;return db[_0x7b4c('0x23')][_0x7b4c('0x43')]({'where':{'id':_0x8ebf9b[_0x7b4c('0x40')]['id']}})[_0x7b4c('0x19')](handleEntityNotFound(_0x4759e9,null))[_0x7b4c('0x19')](function(_0x379f15){if(_0x379f15){_0x57ad8c=_0x379f15[_0x7b4c('0x1b')]({'plain':!![]});_0x1cf7c7[_0x7b4c('0x2e')]=_[_0x7b4c('0x2f')](db['UserFaxQueue']['rawAttributes']);_0x1cf7c7[_0x7b4c('0x2b')]=_[_0x7b4c('0x2f')](_0x8ebf9b[_0x7b4c('0x2b')]);_0x1cf7c7['filters']=_[_0x7b4c('0x31')](_0x1cf7c7[_0x7b4c('0x2e')],_0x1cf7c7['query']);_0x336796[_0x7b4c('0x33')]=_['intersection'](_0x1cf7c7[_0x7b4c('0x2e')],qs['fields'](_0x8ebf9b[_0x7b4c('0x2b')]['fields']));_0x336796[_0x7b4c('0x33')]=_0x336796[_0x7b4c('0x33')]['length']?_0x336796['attributes']:_0x1cf7c7[_0x7b4c('0x2e')];if(!_0x8ebf9b[_0x7b4c('0x2b')][_0x7b4c('0x44')]('nolimit')){_0x336796['limit']=qs[_0x7b4c('0x14')](_0x8ebf9b[_0x7b4c('0x2b')]['limit']);_0x336796['offset']=qs[_0x7b4c('0x12')](_0x8ebf9b[_0x7b4c('0x2b')][_0x7b4c('0x12')]);}_0x336796['order']=qs[_0x7b4c('0x45')](_0x8ebf9b[_0x7b4c('0x2b')]['sort']);_0x336796['where']=qs[_0x7b4c('0x30')](_['pick'](_0x8ebf9b['query'],_0x1cf7c7[_0x7b4c('0x30')]));_0x336796['where']['FaxQueueId']=_0x379f15['id'];if(_0x8ebf9b[_0x7b4c('0x2b')][_0x7b4c('0x46')]){_0x336796[_0x7b4c('0x29')]=_[_0x7b4c('0x35')](_0x336796['where'],{'$or':_['map'](_0x336796[_0x7b4c('0x33')],function(_0x6c226d){var _0x30a7e3={};_0x30a7e3[_0x6c226d]={'$like':'%'+_0x8ebf9b['query'][_0x7b4c('0x46')]+'%'};return _0x30a7e3;})});}_0x336796=_[_0x7b4c('0x35')]({},_0x336796,_0x8ebf9b[_0x7b4c('0x36')]);return db['UserFaxQueue'][_0x7b4c('0x2c')](_0x336796);}})[_0x7b4c('0x19')](function(_0x529803){if(_0x529803){return db[_0x7b4c('0x47')][_0x7b4c('0x48')]({'where':{'id':_[_0x7b4c('0x22')](_0x529803,_0x7b4c('0x49')),'role':_0x7b4c('0x4a')},'attributes':['id',_0x7b4c('0x1f'),_0x7b4c('0x4b'),'updatedAt',_0x7b4c('0x4c')]});}})[_0x7b4c('0x19')](function(_0x4ab9dc){if(_0x4ab9dc){return{'count':_0x4ab9dc[_0x7b4c('0x15')],'rows':_[_0x7b4c('0x22')](_0x4ab9dc[_0x7b4c('0x2d')],function(_0x6b3d5e){return{'membername':_0x6b3d5e['name'],'UserId':_0x6b3d5e['id'],'queue_name':_0x57ad8c[_0x7b4c('0x1f')],'FaxQueueId':_0x57ad8c['id'],'interface':util['format']('%s/%s',_0x7b4c('0x4d'),_0x6b3d5e[_0x7b4c('0x1f')]),'penalty':0x0,'paused':_0x6b3d5e[_0x7b4c('0x4b')],'createdAt':_0x6b3d5e[_0x7b4c('0x4c')],'updatedAt':_0x6b3d5e[_0x7b4c('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4759e9,_0x336796))['catch'](handleError(_0x4759e9,null));};exports[_0x7b4c('0x4f')]=function(_0x3c84af,_0x2b77de){var _0x5e102d={};var _0xade53c={};var _0xc4dae0;var _0x36fc5d;return db['FaxQueue'][_0x7b4c('0x43')]({'where':{'id':_0x3c84af[_0x7b4c('0x40')]['id']}})[_0x7b4c('0x19')](handleEntityNotFound(_0x2b77de,null))['then'](function(_0x257e56){if(_0x257e56){_0xc4dae0=_0x257e56;_0xade53c[_0x7b4c('0x2e')]=_['keys'](db[_0x7b4c('0x50')]['rawAttributes']);_0xade53c[_0x7b4c('0x2b')]=_[_0x7b4c('0x2f')](_0x3c84af[_0x7b4c('0x2b')]);_0xade53c['filters']=_['intersection'](_0xade53c[_0x7b4c('0x2e')],_0xade53c[_0x7b4c('0x2b')]);_0x5e102d[_0x7b4c('0x33')]=_['intersection'](_0xade53c[_0x7b4c('0x2e')],qs['fields'](_0x3c84af[_0x7b4c('0x2b')][_0x7b4c('0x32')]));_0x5e102d[_0x7b4c('0x33')]=_0x5e102d[_0x7b4c('0x33')][_0x7b4c('0x34')]?_0x5e102d['attributes']:_0xade53c[_0x7b4c('0x2e')];_0x5e102d[_0x7b4c('0x51')]=qs['sort'](_0x3c84af[_0x7b4c('0x2b')][_0x7b4c('0x45')]);_0x5e102d[_0x7b4c('0x29')]=qs[_0x7b4c('0x30')](_[_0x7b4c('0x52')](_0x3c84af[_0x7b4c('0x2b')],_0xade53c[_0x7b4c('0x30')]));if(_0x3c84af[_0x7b4c('0x2b')]['filter']){_0x5e102d[_0x7b4c('0x29')]=_[_0x7b4c('0x35')](_0x5e102d[_0x7b4c('0x29')],{'$or':_[_0x7b4c('0x22')](_0x5e102d[_0x7b4c('0x33')],function(_0x3cbf32){var _0x2f3ba9={};_0x2f3ba9[_0x3cbf32]={'$like':'%'+_0x3c84af[_0x7b4c('0x2b')][_0x7b4c('0x46')]+'%'};return _0x2f3ba9;})});}_0x5e102d=_[_0x7b4c('0x35')]({},_0x5e102d,_0x3c84af[_0x7b4c('0x36')]);return _0xc4dae0[_0x7b4c('0x4f')](_0x5e102d);}})[_0x7b4c('0x19')](function(_0x225f38){if(_0x225f38){_0x36fc5d=_0x225f38[_0x7b4c('0x34')];if(!_0x3c84af[_0x7b4c('0x2b')][_0x7b4c('0x44')](_0x7b4c('0x53'))){_0x5e102d[_0x7b4c('0x14')]=qs[_0x7b4c('0x14')](_0x3c84af['query']['limit']);_0x5e102d[_0x7b4c('0x12')]=qs[_0x7b4c('0x12')](_0x3c84af['query'][_0x7b4c('0x12')]);}return _0xc4dae0[_0x7b4c('0x4f')](_0x5e102d);}})[_0x7b4c('0x19')](function(_0xc214ce){if(_0xc214ce){return _0xc214ce?{'count':_0x36fc5d,'rows':_0xc214ce}:null;}})[_0x7b4c('0x19')](respondWithResult(_0x2b77de,null))[_0x7b4c('0x37')](handleError(_0x2b77de,null));};exports[_0x7b4c('0x54')]=function(_0x456111,_0x40edf1){var _0x4ff33f=_0x456111[_0x7b4c('0x3f')]['ids'];return db[_0x7b4c('0x50')]['findAll']({'where':{'id':_0x4ff33f},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7b4c('0x55'),'attributes':['id','name','online',_0x7b4c('0x56'),_0x7b4c('0x57')],'raw':!![]}]})[_0x7b4c('0x19')](function(_0x530979){if(_0x530979){var _0x46fe2e=_[_0x7b4c('0x58')](_0x530979,function(_0x10e789){var _0x29987e=_0x10e789[_0x7b4c('0x1b')]({'plain':!![]});return _0x29987e[_0x7b4c('0x55')];});return db[_0x7b4c('0x23')][_0x7b4c('0x3c')]({'where':{'id':_0x456111[_0x7b4c('0x40')]['id']}})[_0x7b4c('0x19')](function(_0x294c8b){return db[_0x7b4c('0x59')][_0x7b4c('0x5a')](function(_0x1989e1){return _0x294c8b['addTeams'](_0x4ff33f,{'transaction':_0x1989e1})[_0x7b4c('0x19')](function(){return BPromise[_0x7b4c('0x5b')](_0x46fe2e,function(_0x35e94a){return db[_0x7b4c('0x5c')]['findOrCreate']({'where':{'UserId':_0x35e94a['id'],'FaxQueueId':_0x456111[_0x7b4c('0x40')]['id']},'transaction':_0x1989e1});});})[_0x7b4c('0x19')](function(){_0x46fe2e[_0x7b4c('0x5d')](function(_0x317cd4){socket[_0x7b4c('0x5e')](_0x7b4c('0x5f'),{'UserId':_0x317cd4['id'],'FaxQueueId':_0x294c8b['id']});});});});});}})[_0x7b4c('0x19')](respondWithStatusCode(_0x40edf1,null))['catch'](handleError(_0x40edf1,null));};exports[_0x7b4c('0x60')]=function(_0x108c99,_0x4d2c85){return db['Team']['findAll']({'where':{'id':_0x108c99[_0x7b4c('0x2b')][_0x7b4c('0x61')]},'attributes':['id'],'include':[{'model':db[_0x7b4c('0x47')],'as':_0x7b4c('0x55'),'attributes':['id'],'raw':!![]}]})[_0x7b4c('0x19')](handleEntityNotFound(_0x4d2c85,null))[_0x7b4c('0x19')](function(_0x2abb3e){var _0x200c98=_[_0x7b4c('0x22')](_0x2abb3e,'id');var _0x2bc889=[];var _0x83e8bb=[];var _0x257fae=squel[_0x7b4c('0x62')]();_0x257fae['field'](_0x7b4c('0x63'))[_0x7b4c('0x64')](_0x7b4c('0x65'),'tq')['join'](_0x7b4c('0x66'),'ut',_0x7b4c('0x67'))[_0x7b4c('0x29')](_0x7b4c('0x68'),_0x108c99[_0x7b4c('0x40')]['id']);for(var _0x57f1a0=0x0;_0x57f1a0<_0x2abb3e[_0x7b4c('0x34')];_0x57f1a0+=0x1){let _0x1cd19e=_0x2abb3e[_0x57f1a0];for(var _0x34abb1=0x0;_0x34abb1<_0x1cd19e[_0x7b4c('0x55')]['length'];_0x34abb1+=0x1){let _0x11842d=_0x1cd19e[_0x7b4c('0x55')][_0x34abb1];var _0xdfa0bc=_0x257fae['clone']();_0xdfa0bc[_0x7b4c('0x29')](_0x7b4c('0x69'),_0x11842d['id']);_0x83e8bb[_0x7b4c('0x6a')](db[_0x7b4c('0x59')]['query'](_0xdfa0bc[_0x7b4c('0x6b')](),{'type':db[_0x7b4c('0x59')][_0x7b4c('0x6c')][_0x7b4c('0x6d')]})['then'](function(_0x288a82){if(_0x288a82['length']===0x1){return _0x11842d['id'];}else{var _0x3b9d97=_['every'](_[_0x7b4c('0x22')](_0x288a82,_0x7b4c('0x6e')),function(_0xb442e3){return _['includes'](_0x200c98,_0xb442e3);});if(_0x3b9d97){return _0x11842d['id'];}}}));}}return BPromise[_0x7b4c('0x6f')](_0x83e8bb)['then'](function(_0xb2d616){_0x2bc889=_(_0x2bc889)[_0x7b4c('0x70')](_0xb2d616)['compact']()[_0x7b4c('0x71')]();return db[_0x7b4c('0x23')][_0x7b4c('0x3c')]({'where':{'id':_0x108c99[_0x7b4c('0x40')]['id']}})['then'](function(_0x3d1450){return db[_0x7b4c('0x59')]['transaction'](function(_0x17d1fc){return _0x3d1450[_0x7b4c('0x60')](_0x108c99[_0x7b4c('0x2b')][_0x7b4c('0x61')],{'transaction':_0x17d1fc})[_0x7b4c('0x19')](function(){if(!_[_0x7b4c('0x72')](_0x2bc889)){return _0x3d1450[_0x7b4c('0x73')](_0x2bc889,{'transaction':_0x17d1fc});}})['then'](function(){_0x2bc889['forEach'](function(_0xdb202){socket[_0x7b4c('0x5e')](_0x7b4c('0x74'),{'UserId':_0xdb202,'FaxQueueId':_0x3d1450['id']});});});});});});})[_0x7b4c('0x19')](respondWithStatusCode(_0x4d2c85,null))[_0x7b4c('0x37')](handleError(_0x4d2c85,null));};exports['addAgents']=function(_0x228b2b,_0x28cf40){return db[_0x7b4c('0x23')][_0x7b4c('0x3c')]({'where':{'id':_0x228b2b['params']['id']}})['then'](handleEntityNotFound(_0x28cf40,null))[_0x7b4c('0x19')](function(_0x2b1cbe){if(_0x2b1cbe){return _0x2b1cbe[_0x7b4c('0x75')](_0x228b2b[_0x7b4c('0x3f')][_0x7b4c('0x61')],_['omit'](_0x228b2b[_0x7b4c('0x3f')],[_0x7b4c('0x61'),'id'])||{})[_0x7b4c('0x76')](function(_0x20a26c){for(var _0x5c067a=0x0;_0x5c067a<_0x228b2b['body']['ids'][_0x7b4c('0x34')];_0x5c067a+=0x1){socket[_0x7b4c('0x5e')](_0x7b4c('0x5f'),{'UserId':Number(_0x228b2b['body'][_0x7b4c('0x61')][_0x5c067a]),'FaxQueueId':Number(_0x228b2b['params']['id'])});}return _0x20a26c;});}})['then'](respondWithResult(_0x28cf40,null))[_0x7b4c('0x37')](handleError(_0x28cf40,null));};exports['removeAgents']=function(_0x437ef7,_0x1a7b95){return db['FaxQueue']['find']({'where':{'id':_0x437ef7[_0x7b4c('0x40')]['id']}})[_0x7b4c('0x19')](handleEntityNotFound(_0x1a7b95,null))[_0x7b4c('0x19')](function(_0x119426){if(_0x119426){return _0x119426['removeAgents'](_0x437ef7['query'][_0x7b4c('0x61')])[_0x7b4c('0x19')](function(){if(_[_0x7b4c('0x77')](_0x437ef7[_0x7b4c('0x2b')][_0x7b4c('0x61')])){for(var _0x14fc2f=0x0;_0x14fc2f<_0x437ef7[_0x7b4c('0x2b')]['ids'][_0x7b4c('0x34')];_0x14fc2f+=0x1){socket[_0x7b4c('0x5e')](_0x7b4c('0x74'),{'UserId':Number(_0x437ef7[_0x7b4c('0x2b')][_0x7b4c('0x61')][_0x14fc2f]),'FaxQueueId':Number(_0x437ef7[_0x7b4c('0x40')]['id'])});}}else{socket[_0x7b4c('0x5e')](_0x7b4c('0x74'),{'UserId':Number(_0x437ef7[_0x7b4c('0x2b')]['ids']),'FaxQueueId':Number(_0x437ef7[_0x7b4c('0x40')]['id'])});}});}})[_0x7b4c('0x19')](respondWithStatusCode(_0x1a7b95,null))[_0x7b4c('0x37')](handleError(_0x1a7b95,null));};exports[_0x7b4c('0x78')]=function(_0x3a1150,_0x3c5e44){var _0x1aae06={};var _0x34a4cc={};var _0x3fd4ed;var _0x59e7b9;return db[_0x7b4c('0x23')][_0x7b4c('0x43')]({'where':{'id':_0x3a1150[_0x7b4c('0x40')]['id']}})[_0x7b4c('0x19')](handleEntityNotFound(_0x3c5e44,null))[_0x7b4c('0x19')](function(_0x1a4ac1){if(_0x1a4ac1){_0x3fd4ed=_0x1a4ac1;_0x34a4cc['model']=_[_0x7b4c('0x2f')](db[_0x7b4c('0x47')]['rawAttributes']);_0x34a4cc['query']=_[_0x7b4c('0x2f')](_0x3a1150['query']);_0x34a4cc[_0x7b4c('0x30')]=_[_0x7b4c('0x31')](_0x34a4cc[_0x7b4c('0x2e')],_0x34a4cc[_0x7b4c('0x2b')]);_0x1aae06['attributes']=_['intersection'](_0x34a4cc[_0x7b4c('0x2e')],qs[_0x7b4c('0x32')](_0x3a1150[_0x7b4c('0x2b')][_0x7b4c('0x32')]));_0x1aae06[_0x7b4c('0x33')]=_0x1aae06[_0x7b4c('0x33')][_0x7b4c('0x34')]?_0x1aae06[_0x7b4c('0x33')]:_0x34a4cc[_0x7b4c('0x2e')];_0x1aae06[_0x7b4c('0x51')]=qs[_0x7b4c('0x45')](_0x3a1150[_0x7b4c('0x2b')][_0x7b4c('0x45')]);_0x1aae06[_0x7b4c('0x29')]=qs[_0x7b4c('0x30')](_['pick'](_0x3a1150[_0x7b4c('0x2b')],_0x34a4cc[_0x7b4c('0x30')]));if(_0x3a1150[_0x7b4c('0x2b')][_0x7b4c('0x46')]){_0x1aae06['where']=_['merge'](_0x1aae06[_0x7b4c('0x29')],{'$or':_[_0x7b4c('0x22')](_0x1aae06[_0x7b4c('0x33')],function(_0x46be32){var _0x84555b={};_0x84555b[_0x46be32]={'$like':'%'+_0x3a1150[_0x7b4c('0x2b')][_0x7b4c('0x46')]+'%'};return _0x84555b;})});}_0x1aae06=_[_0x7b4c('0x35')]({},_0x1aae06,_0x3a1150[_0x7b4c('0x36')]);return _0x3fd4ed['getAgents'](_0x1aae06);}})[_0x7b4c('0x19')](function(_0x3f29fd){if(_0x3f29fd){_0x59e7b9=_0x3f29fd[_0x7b4c('0x34')];if(!_0x3a1150[_0x7b4c('0x2b')][_0x7b4c('0x44')](_0x7b4c('0x53'))){_0x1aae06[_0x7b4c('0x14')]=qs[_0x7b4c('0x14')](_0x3a1150[_0x7b4c('0x2b')][_0x7b4c('0x14')]);_0x1aae06[_0x7b4c('0x12')]=qs[_0x7b4c('0x12')](_0x3a1150['query']['offset']);}return _0x3fd4ed[_0x7b4c('0x78')](_0x1aae06);}})[_0x7b4c('0x19')](function(_0xf491ab){if(_0xf491ab){return _0xf491ab?{'count':_0x59e7b9,'rows':_0xf491ab}:null;}})[_0x7b4c('0x19')](respondWithResult(_0x3c5e44,null))[_0x7b4c('0x37')](handleError(_0x3c5e44,null));}; \ No newline at end of file +var _0xc359=['userFaxQueue:remove','addAgents','spread','isArray','getAgents','util','squel','ioredis','../../components/parsers/qs','api','../../mysqldb','defaults','./faxQueue.socket','register','sendStatus','end','json','undefined','limit','count','offset','status','set','Content-Range','update','then','destroy','FaxQueues','UserProfileResource','error','name','send','index','FaxQueue','rawAttributes','type','getOptions','where','include','query','findAll','rows','catch','show','model','keys','filters','fields','attributes','length','includeAll','options','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','body','params','describe','getMembers','findOne','UserFaxQueue','intersection','nolimit','order','sort','pick','filter','merge','map','User','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','hasOwnProperty','addTeams','ids','Agents','online','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','select','field','tq.TeamId','team_has_fax_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','isEmpty','removeAgents'];(function(_0x3ebc84,_0x28f3e1){var _0x2a16bd=function(_0x2d28eb){while(--_0x2d28eb){_0x3ebc84['push'](_0x3ebc84['shift']());}};_0x2a16bd(++_0x28f3e1);}(_0xc359,0x1d9));var _0x9c35=function(_0x30cd7e,_0x4db10a){_0x30cd7e=_0x30cd7e-0x0;var _0x462a02=_0xc359[_0x30cd7e];return _0x462a02;};'use strict';var BPromise=require('bluebird');var util=require(_0x9c35('0x0'));var _=require('lodash');var squel=require(_0x9c35('0x1'));var Redis=require(_0x9c35('0x2'));var qs=require(_0x9c35('0x3'));var logger=require('../../config/logger')(_0x9c35('0x4'));var config=require('../../config/environment');var db=require(_0x9c35('0x5'))['db'];config['redis']=_[_0x9c35('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9c35('0x7'))[_0x9c35('0x8')](socket);function respondWithStatusCode(_0x1ab745,_0x301e66){_0x301e66=_0x301e66||0xcc;return function(_0x2b2821){if(_0x2b2821){return _0x1ab745[_0x9c35('0x9')](_0x301e66);}return _0x1ab745['status'](_0x301e66)[_0x9c35('0xa')]();};}function respondWithResult(_0x467add,_0x500420){_0x500420=_0x500420||0xc8;return function(_0x4e3834){if(_0x4e3834){return _0x467add['status'](_0x500420)[_0x9c35('0xb')](_0x4e3834);}};}function respondWithFilteredResult(_0x4d012f,_0x179d10){return function(_0x20d3c7){if(_0x20d3c7){var _0x5883a8=typeof _0x179d10['offset']===_0x9c35('0xc')&&typeof _0x179d10[_0x9c35('0xd')]===_0x9c35('0xc');var _0x11c209=_0x20d3c7[_0x9c35('0xe')];var _0x4cc2ca=_0x5883a8?0x0:_0x179d10[_0x9c35('0xf')];var _0x4470df=_0x5883a8?_0x20d3c7[_0x9c35('0xe')]:_0x179d10[_0x9c35('0xf')]+_0x179d10[_0x9c35('0xd')];var _0x308392;if(_0x4470df>=_0x11c209){_0x4470df=_0x11c209;_0x308392=0xc8;}else{_0x308392=0xce;}_0x4d012f[_0x9c35('0x10')](_0x308392);return _0x4d012f[_0x9c35('0x11')](_0x9c35('0x12'),_0x4cc2ca+'-'+_0x4470df+'/'+_0x11c209)[_0x9c35('0xb')](_0x20d3c7);}return null;};}function saveUpdates(_0x387dd7){return function(_0x2e8ec1){if(_0x2e8ec1){return _0x2e8ec1[_0x9c35('0x13')](_0x387dd7)[_0x9c35('0x14')](function(_0x26db4b){return _0x26db4b;});}return null;};}function removeEntity(_0x4cbeb6){return function(_0x1d0227){if(_0x1d0227){return _0x1d0227[_0x9c35('0x15')]()[_0x9c35('0x14')](function(){var _0x24f1d9=_0x1d0227['get']({'plain':!![]});var _0x142091=_0x9c35('0x16');return db[_0x9c35('0x17')][_0x9c35('0x15')]({'where':{'type':_0x142091,'resourceId':_0x24f1d9['id']}})[_0x9c35('0x14')](function(){return _0x1d0227;});})['then'](function(){_0x4cbeb6[_0x9c35('0x10')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41aee8){return function(_0x421979){if(!_0x421979){_0x41aee8[_0x9c35('0x9')](0x194);}return _0x421979;};}function handleError(_0x8ffae5,_0x3d2193){_0x3d2193=_0x3d2193||0x1f4;return function(_0x8240f5){logger[_0x9c35('0x18')](_0x8240f5['stack']);if(_0x8240f5['name']){delete _0x8240f5[_0x9c35('0x19')];}_0x8ffae5[_0x9c35('0x10')](_0x3d2193)[_0x9c35('0x1a')](_0x8240f5);};}exports[_0x9c35('0x1b')]=function(_0x50a509,_0x233364){var _0x578e00={};var _0x223d9e={'count':0x0,'rows':[]};var _0x4bf0ea=_['map'](db[_0x9c35('0x1c')][_0x9c35('0x1d')],function(_0x2cba78){return{'name':_0x2cba78['fieldName'],'type':_0x2cba78[_0x9c35('0x1e')]['key']};});_0x578e00=qs[_0x9c35('0x1f')](_0x4bf0ea,_0x50a509);var _0x2a0954={'where':_0x578e00[_0x9c35('0x20')]};return db[_0x9c35('0x1c')][_0x9c35('0xe')](_0x2a0954)['then'](function(_0x4593e3){_0x223d9e[_0x9c35('0xe')]=_0x4593e3;_0x578e00['include']=qs[_0x9c35('0x21')](_0x50a509[_0x9c35('0x22')]);return db[_0x9c35('0x1c')][_0x9c35('0x23')](_0x578e00);})[_0x9c35('0x14')](function(_0x4cb625){_0x223d9e[_0x9c35('0x24')]=_0x4cb625;return _0x223d9e;})[_0x9c35('0x14')](respondWithFilteredResult(_0x233364,_0x578e00))[_0x9c35('0x25')](handleError(_0x233364,null));};exports[_0x9c35('0x26')]=function(_0x315981,_0x2b5341){var _0x5b28c5={'raw':!![],'where':{'id':_0x315981['params']['id']}},_0x40a3c3={};_0x40a3c3[_0x9c35('0x27')]=_[_0x9c35('0x28')](db[_0x9c35('0x1c')][_0x9c35('0x1d')]);_0x40a3c3[_0x9c35('0x22')]=_['keys'](_0x315981[_0x9c35('0x22')]);_0x40a3c3[_0x9c35('0x29')]=_['intersection'](_0x40a3c3['model'],_0x40a3c3[_0x9c35('0x22')]);_0x5b28c5['attributes']=_['intersection'](_0x40a3c3['model'],qs[_0x9c35('0x2a')](_0x315981[_0x9c35('0x22')][_0x9c35('0x2a')]));_0x5b28c5[_0x9c35('0x2b')]=_0x5b28c5[_0x9c35('0x2b')][_0x9c35('0x2c')]?_0x5b28c5['attributes']:_0x40a3c3[_0x9c35('0x27')];if(_0x315981[_0x9c35('0x22')][_0x9c35('0x2d')]){_0x5b28c5[_0x9c35('0x21')]=[{'all':!![]}];}_0x5b28c5=_['merge']({},_0x5b28c5,_0x315981[_0x9c35('0x2e')]);return db[_0x9c35('0x1c')][_0x9c35('0x2f')](_0x5b28c5)[_0x9c35('0x14')](handleEntityNotFound(_0x2b5341,null))[_0x9c35('0x14')](respondWithResult(_0x2b5341,null))[_0x9c35('0x25')](handleError(_0x2b5341,null));};exports[_0x9c35('0x30')]=function(_0x5628e7,_0x535edd){return db['FaxQueue'][_0x9c35('0x30')](_0x5628e7['body'],{})[_0x9c35('0x14')](function(_0x49a11c){var _0x49aadb=_0x5628e7[_0x9c35('0x31')][_0x9c35('0x32')]({'plain':!![]});if(!_0x49aadb)throw new Error(_0x9c35('0x33'));if(_0x49aadb[_0x9c35('0x34')]===_0x9c35('0x31')){var _0x17bace=_0x49a11c[_0x9c35('0x32')]({'plain':!![]});var _0x4a2002=_0x9c35('0x16');return db['UserProfileSection'][_0x9c35('0x2f')]({'where':{'name':_0x4a2002,'userProfileId':_0x49aadb['userProfileId']},'raw':!![]})['then'](function(_0x4fc454){if(_0x4fc454&&_0x4fc454['autoAssociation']===0x0){return db[_0x9c35('0x17')][_0x9c35('0x30')]({'name':_0x17bace[_0x9c35('0x19')],'resourceId':_0x17bace['id'],'type':_0x4fc454[_0x9c35('0x19')],'sectionId':_0x4fc454['id']},{})['then'](function(){return _0x49a11c;});}else{return _0x49a11c;}})[_0x9c35('0x25')](function(_0xff952f){logger[_0x9c35('0x18')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xff952f);throw _0xff952f;});}return _0x49a11c;})[_0x9c35('0x14')](respondWithResult(_0x535edd,0xc9))[_0x9c35('0x25')](handleError(_0x535edd,null));};exports[_0x9c35('0x13')]=function(_0x3ac8e9,_0x4269b0){if(_0x3ac8e9[_0x9c35('0x35')]['id']){delete _0x3ac8e9[_0x9c35('0x35')]['id'];}return db[_0x9c35('0x1c')][_0x9c35('0x2f')]({'where':{'id':_0x3ac8e9[_0x9c35('0x36')]['id']}})[_0x9c35('0x14')](handleEntityNotFound(_0x4269b0,null))['then'](saveUpdates(_0x3ac8e9[_0x9c35('0x35')],null))[_0x9c35('0x14')](respondWithResult(_0x4269b0,null))[_0x9c35('0x25')](handleError(_0x4269b0,null));};exports[_0x9c35('0x15')]=function(_0xffa2d9,_0xb7fa00){return db[_0x9c35('0x1c')][_0x9c35('0x2f')]({'where':{'id':_0xffa2d9[_0x9c35('0x36')]['id']}})[_0x9c35('0x14')](handleEntityNotFound(_0xb7fa00,null))[_0x9c35('0x14')](removeEntity(_0xb7fa00,null))[_0x9c35('0x25')](handleError(_0xb7fa00,null));};exports[_0x9c35('0x37')]=function(_0x1e7640,_0x2f2362){return db[_0x9c35('0x1c')][_0x9c35('0x37')]()[_0x9c35('0x14')](respondWithResult(_0x2f2362,null))[_0x9c35('0x25')](handleError(_0x2f2362,null));};exports[_0x9c35('0x38')]=function(_0x4571f9,_0x258d0a){var _0x5ca172={'raw':!![],'where':{}},_0x23afc2={},_0x58a2c2;return db[_0x9c35('0x1c')][_0x9c35('0x39')]({'where':{'id':_0x4571f9[_0x9c35('0x36')]['id']}})['then'](handleEntityNotFound(_0x258d0a,null))[_0x9c35('0x14')](function(_0x1d24ae){if(_0x1d24ae){_0x58a2c2=_0x1d24ae[_0x9c35('0x32')]({'plain':!![]});_0x23afc2['model']=_[_0x9c35('0x28')](db[_0x9c35('0x3a')]['rawAttributes']);_0x23afc2[_0x9c35('0x22')]=_['keys'](_0x4571f9[_0x9c35('0x22')]);_0x23afc2[_0x9c35('0x29')]=_[_0x9c35('0x3b')](_0x23afc2[_0x9c35('0x27')],_0x23afc2[_0x9c35('0x22')]);_0x5ca172[_0x9c35('0x2b')]=_[_0x9c35('0x3b')](_0x23afc2[_0x9c35('0x27')],qs[_0x9c35('0x2a')](_0x4571f9['query'][_0x9c35('0x2a')]));_0x5ca172[_0x9c35('0x2b')]=_0x5ca172[_0x9c35('0x2b')]['length']?_0x5ca172['attributes']:_0x23afc2[_0x9c35('0x27')];if(!_0x4571f9[_0x9c35('0x22')]['hasOwnProperty'](_0x9c35('0x3c'))){_0x5ca172[_0x9c35('0xd')]=qs[_0x9c35('0xd')](_0x4571f9[_0x9c35('0x22')][_0x9c35('0xd')]);_0x5ca172[_0x9c35('0xf')]=qs['offset'](_0x4571f9[_0x9c35('0x22')]['offset']);}_0x5ca172[_0x9c35('0x3d')]=qs[_0x9c35('0x3e')](_0x4571f9[_0x9c35('0x22')]['sort']);_0x5ca172[_0x9c35('0x20')]=qs[_0x9c35('0x29')](_[_0x9c35('0x3f')](_0x4571f9[_0x9c35('0x22')],_0x23afc2[_0x9c35('0x29')]));_0x5ca172[_0x9c35('0x20')]['FaxQueueId']=_0x1d24ae['id'];if(_0x4571f9['query'][_0x9c35('0x40')]){_0x5ca172[_0x9c35('0x20')]=_[_0x9c35('0x41')](_0x5ca172['where'],{'$or':_[_0x9c35('0x42')](_0x5ca172[_0x9c35('0x2b')],function(_0x433379){var _0x3f8768={};_0x3f8768[_0x433379]={'$like':'%'+_0x4571f9[_0x9c35('0x22')][_0x9c35('0x40')]+'%'};return _0x3f8768;})});}_0x5ca172=_[_0x9c35('0x41')]({},_0x5ca172,_0x4571f9['options']);return db['UserFaxQueue'][_0x9c35('0x23')](_0x5ca172);}})[_0x9c35('0x14')](function(_0x590844){if(_0x590844){return db[_0x9c35('0x43')][_0x9c35('0x44')]({'where':{'id':_[_0x9c35('0x42')](_0x590844,_0x9c35('0x45')),'role':_0x9c35('0x46')},'attributes':['id',_0x9c35('0x19'),_0x9c35('0x47'),_0x9c35('0x48'),_0x9c35('0x49')]});}})[_0x9c35('0x14')](function(_0x3a168c){if(_0x3a168c){return{'count':_0x3a168c[_0x9c35('0xe')],'rows':_[_0x9c35('0x42')](_0x3a168c[_0x9c35('0x24')],function(_0x1effb){return{'membername':_0x1effb[_0x9c35('0x19')],'UserId':_0x1effb['id'],'queue_name':_0x58a2c2[_0x9c35('0x19')],'FaxQueueId':_0x58a2c2['id'],'interface':util[_0x9c35('0x4a')](_0x9c35('0x4b'),_0x9c35('0x4c'),_0x1effb[_0x9c35('0x19')]),'penalty':0x0,'paused':_0x1effb[_0x9c35('0x47')],'createdAt':_0x1effb[_0x9c35('0x49')],'updatedAt':_0x1effb[_0x9c35('0x48')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x9c35('0x14')](respondWithFilteredResult(_0x258d0a,_0x5ca172))[_0x9c35('0x25')](handleError(_0x258d0a,null));};exports[_0x9c35('0x4d')]=function(_0x55804e,_0x2f3086){var _0x21d903={};var _0x1bf387={};var _0x59a221;var _0x3903bd;return db['FaxQueue'][_0x9c35('0x39')]({'where':{'id':_0x55804e[_0x9c35('0x36')]['id']}})[_0x9c35('0x14')](handleEntityNotFound(_0x2f3086,null))[_0x9c35('0x14')](function(_0x20f8c8){if(_0x20f8c8){_0x59a221=_0x20f8c8;_0x1bf387[_0x9c35('0x27')]=_['keys'](db[_0x9c35('0x4e')][_0x9c35('0x1d')]);_0x1bf387[_0x9c35('0x22')]=_[_0x9c35('0x28')](_0x55804e['query']);_0x1bf387[_0x9c35('0x29')]=_[_0x9c35('0x3b')](_0x1bf387['model'],_0x1bf387['query']);_0x21d903[_0x9c35('0x2b')]=_[_0x9c35('0x3b')](_0x1bf387[_0x9c35('0x27')],qs[_0x9c35('0x2a')](_0x55804e[_0x9c35('0x22')][_0x9c35('0x2a')]));_0x21d903[_0x9c35('0x2b')]=_0x21d903[_0x9c35('0x2b')]['length']?_0x21d903[_0x9c35('0x2b')]:_0x1bf387['model'];_0x21d903[_0x9c35('0x3d')]=qs[_0x9c35('0x3e')](_0x55804e[_0x9c35('0x22')]['sort']);_0x21d903[_0x9c35('0x20')]=qs[_0x9c35('0x29')](_['pick'](_0x55804e[_0x9c35('0x22')],_0x1bf387[_0x9c35('0x29')]));if(_0x55804e[_0x9c35('0x22')]['filter']){_0x21d903[_0x9c35('0x20')]=_[_0x9c35('0x41')](_0x21d903[_0x9c35('0x20')],{'$or':_['map'](_0x21d903[_0x9c35('0x2b')],function(_0x313fb6){var _0x370aef={};_0x370aef[_0x313fb6]={'$like':'%'+_0x55804e[_0x9c35('0x22')]['filter']+'%'};return _0x370aef;})});}_0x21d903=_[_0x9c35('0x41')]({},_0x21d903,_0x55804e[_0x9c35('0x2e')]);return _0x59a221[_0x9c35('0x4d')](_0x21d903);}})[_0x9c35('0x14')](function(_0x1ab635){if(_0x1ab635){_0x3903bd=_0x1ab635[_0x9c35('0x2c')];if(!_0x55804e[_0x9c35('0x22')][_0x9c35('0x4f')](_0x9c35('0x3c'))){_0x21d903['limit']=qs[_0x9c35('0xd')](_0x55804e[_0x9c35('0x22')][_0x9c35('0xd')]);_0x21d903[_0x9c35('0xf')]=qs['offset'](_0x55804e['query'][_0x9c35('0xf')]);}return _0x59a221[_0x9c35('0x4d')](_0x21d903);}})['then'](function(_0x46c171){if(_0x46c171){return _0x46c171?{'count':_0x3903bd,'rows':_0x46c171}:null;}})[_0x9c35('0x14')](respondWithResult(_0x2f3086,null))[_0x9c35('0x25')](handleError(_0x2f3086,null));};exports[_0x9c35('0x50')]=function(_0x392ace,_0x4e6395){var _0x103871=_0x392ace['body'][_0x9c35('0x51')];return db[_0x9c35('0x4e')][_0x9c35('0x23')]({'where':{'id':_0x103871},'attributes':['id'],'include':[{'model':db[_0x9c35('0x43')],'as':_0x9c35('0x52'),'attributes':['id',_0x9c35('0x19'),_0x9c35('0x53'),'voicePause',_0x9c35('0x54')],'raw':!![]}]})[_0x9c35('0x14')](function(_0x23ac9a){if(_0x23ac9a){var _0x3efc42=_[_0x9c35('0x55')](_0x23ac9a,function(_0x3be13f){var _0x550567=_0x3be13f['get']({'plain':!![]});return _0x550567['Agents'];});return db[_0x9c35('0x1c')][_0x9c35('0x2f')]({'where':{'id':_0x392ace[_0x9c35('0x36')]['id']}})[_0x9c35('0x14')](function(_0x3688f1){return db[_0x9c35('0x56')][_0x9c35('0x57')](function(_0x3df12c){return _0x3688f1['addTeams'](_0x103871,{'transaction':_0x3df12c})[_0x9c35('0x14')](function(){return BPromise[_0x9c35('0x58')](_0x3efc42,function(_0x92aa4c){return db[_0x9c35('0x3a')][_0x9c35('0x59')]({'where':{'UserId':_0x92aa4c['id'],'FaxQueueId':_0x392ace['params']['id']},'transaction':_0x3df12c});});})['then'](function(){_0x3efc42[_0x9c35('0x5a')](function(_0x23f44a){socket[_0x9c35('0x5b')](_0x9c35('0x5c'),{'UserId':_0x23f44a['id'],'FaxQueueId':_0x3688f1['id']});});});});});}})[_0x9c35('0x14')](respondWithStatusCode(_0x4e6395,null))[_0x9c35('0x25')](handleError(_0x4e6395,null));};exports[_0x9c35('0x5d')]=function(_0x538cf0,_0x1c5201){return db[_0x9c35('0x4e')][_0x9c35('0x23')]({'where':{'id':_0x538cf0[_0x9c35('0x22')][_0x9c35('0x51')]},'attributes':['id'],'include':[{'model':db[_0x9c35('0x43')],'as':_0x9c35('0x52'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1c5201,null))['then'](function(_0xa222ad){var _0x1499db=_[_0x9c35('0x42')](_0xa222ad,'id');var _0x4a9cb1=[];var _0x54c879=[];var _0x342436=squel[_0x9c35('0x5e')]();_0x342436[_0x9c35('0x5f')](_0x9c35('0x60'))['from'](_0x9c35('0x61'),'tq')['join'](_0x9c35('0x62'),'ut',_0x9c35('0x63'))['where'](_0x9c35('0x64'),_0x538cf0[_0x9c35('0x36')]['id']);for(var _0x4111d0=0x0;_0x4111d0<_0xa222ad[_0x9c35('0x2c')];_0x4111d0+=0x1){let _0x299a9e=_0xa222ad[_0x4111d0];for(var _0x57030f=0x0;_0x57030f<_0x299a9e[_0x9c35('0x52')][_0x9c35('0x2c')];_0x57030f+=0x1){let _0x23d80f=_0x299a9e[_0x9c35('0x52')][_0x57030f];var _0xf1dbb9=_0x342436[_0x9c35('0x65')]();_0xf1dbb9[_0x9c35('0x20')](_0x9c35('0x66'),_0x23d80f['id']);_0x54c879[_0x9c35('0x67')](db[_0x9c35('0x56')][_0x9c35('0x22')](_0xf1dbb9[_0x9c35('0x68')](),{'type':db[_0x9c35('0x56')][_0x9c35('0x69')][_0x9c35('0x6a')]})['then'](function(_0x439677){if(_0x439677[_0x9c35('0x2c')]===0x1){return _0x23d80f['id'];}else{var _0x4e86dd=_[_0x9c35('0x6b')](_[_0x9c35('0x42')](_0x439677,_0x9c35('0x6c')),function(_0x2f8a96){return _[_0x9c35('0x6d')](_0x1499db,_0x2f8a96);});if(_0x4e86dd){return _0x23d80f['id'];}}}));}}return BPromise['all'](_0x54c879)[_0x9c35('0x14')](function(_0x3c54e8){_0x4a9cb1=_(_0x4a9cb1)['union'](_0x3c54e8)['compact']()['value']();return db[_0x9c35('0x1c')][_0x9c35('0x2f')]({'where':{'id':_0x538cf0['params']['id']}})[_0x9c35('0x14')](function(_0x2a9449){return db[_0x9c35('0x56')]['transaction'](function(_0x32b861){return _0x2a9449[_0x9c35('0x5d')](_0x538cf0[_0x9c35('0x22')]['ids'],{'transaction':_0x32b861})[_0x9c35('0x14')](function(){if(!_[_0x9c35('0x6e')](_0x4a9cb1)){return _0x2a9449[_0x9c35('0x6f')](_0x4a9cb1,{'transaction':_0x32b861});}})['then'](function(){_0x4a9cb1[_0x9c35('0x5a')](function(_0x3a222d){socket[_0x9c35('0x5b')](_0x9c35('0x70'),{'UserId':_0x3a222d,'FaxQueueId':_0x2a9449['id']});});});});});});})[_0x9c35('0x14')](respondWithStatusCode(_0x1c5201,null))['catch'](handleError(_0x1c5201,null));};exports[_0x9c35('0x71')]=function(_0x48c11d,_0x31ad01){return db[_0x9c35('0x1c')][_0x9c35('0x2f')]({'where':{'id':_0x48c11d[_0x9c35('0x36')]['id']}})['then'](handleEntityNotFound(_0x31ad01,null))['then'](function(_0x191094){if(_0x191094){return _0x191094[_0x9c35('0x71')](_0x48c11d[_0x9c35('0x35')][_0x9c35('0x51')],_['omit'](_0x48c11d[_0x9c35('0x35')],[_0x9c35('0x51'),'id'])||{})[_0x9c35('0x72')](function(_0x5ae212){for(var _0x3fb812=0x0;_0x3fb812<_0x48c11d[_0x9c35('0x35')][_0x9c35('0x51')][_0x9c35('0x2c')];_0x3fb812+=0x1){socket[_0x9c35('0x5b')](_0x9c35('0x5c'),{'UserId':Number(_0x48c11d[_0x9c35('0x35')]['ids'][_0x3fb812]),'FaxQueueId':Number(_0x48c11d[_0x9c35('0x36')]['id'])});}return _0x5ae212;});}})[_0x9c35('0x14')](respondWithResult(_0x31ad01,null))[_0x9c35('0x25')](handleError(_0x31ad01,null));};exports[_0x9c35('0x6f')]=function(_0x31f0ad,_0x21b7ba){return db[_0x9c35('0x1c')][_0x9c35('0x2f')]({'where':{'id':_0x31f0ad[_0x9c35('0x36')]['id']}})['then'](handleEntityNotFound(_0x21b7ba,null))[_0x9c35('0x14')](function(_0x4631ea){if(_0x4631ea){return _0x4631ea[_0x9c35('0x6f')](_0x31f0ad[_0x9c35('0x22')][_0x9c35('0x51')])[_0x9c35('0x14')](function(){if(_[_0x9c35('0x73')](_0x31f0ad[_0x9c35('0x22')][_0x9c35('0x51')])){for(var _0x290fc1=0x0;_0x290fc1<_0x31f0ad[_0x9c35('0x22')][_0x9c35('0x51')][_0x9c35('0x2c')];_0x290fc1+=0x1){socket[_0x9c35('0x5b')](_0x9c35('0x70'),{'UserId':Number(_0x31f0ad[_0x9c35('0x22')][_0x9c35('0x51')][_0x290fc1]),'FaxQueueId':Number(_0x31f0ad[_0x9c35('0x36')]['id'])});}}else{socket[_0x9c35('0x5b')](_0x9c35('0x70'),{'UserId':Number(_0x31f0ad[_0x9c35('0x22')][_0x9c35('0x51')]),'FaxQueueId':Number(_0x31f0ad[_0x9c35('0x36')]['id'])});}});}})[_0x9c35('0x14')](respondWithStatusCode(_0x21b7ba,null))[_0x9c35('0x25')](handleError(_0x21b7ba,null));};exports[_0x9c35('0x74')]=function(_0x5775e0,_0x6e456a){var _0x3de11c={};var _0x39630e={};var _0x39847a;var _0x16c704;return db['FaxQueue'][_0x9c35('0x39')]({'where':{'id':_0x5775e0[_0x9c35('0x36')]['id']}})[_0x9c35('0x14')](handleEntityNotFound(_0x6e456a,null))['then'](function(_0x3fa2e3){if(_0x3fa2e3){_0x39847a=_0x3fa2e3;_0x39630e[_0x9c35('0x27')]=_['keys'](db[_0x9c35('0x43')][_0x9c35('0x1d')]);_0x39630e['query']=_[_0x9c35('0x28')](_0x5775e0[_0x9c35('0x22')]);_0x39630e['filters']=_[_0x9c35('0x3b')](_0x39630e[_0x9c35('0x27')],_0x39630e['query']);_0x3de11c[_0x9c35('0x2b')]=_[_0x9c35('0x3b')](_0x39630e[_0x9c35('0x27')],qs[_0x9c35('0x2a')](_0x5775e0[_0x9c35('0x22')]['fields']));_0x3de11c['attributes']=_0x3de11c[_0x9c35('0x2b')]['length']?_0x3de11c['attributes']:_0x39630e['model'];_0x3de11c['order']=qs['sort'](_0x5775e0[_0x9c35('0x22')][_0x9c35('0x3e')]);_0x3de11c[_0x9c35('0x20')]=qs[_0x9c35('0x29')](_[_0x9c35('0x3f')](_0x5775e0[_0x9c35('0x22')],_0x39630e['filters']));if(_0x5775e0[_0x9c35('0x22')][_0x9c35('0x40')]){_0x3de11c[_0x9c35('0x20')]=_[_0x9c35('0x41')](_0x3de11c[_0x9c35('0x20')],{'$or':_[_0x9c35('0x42')](_0x3de11c['attributes'],function(_0x2250f9){var _0x35bc1a={};_0x35bc1a[_0x2250f9]={'$like':'%'+_0x5775e0[_0x9c35('0x22')][_0x9c35('0x40')]+'%'};return _0x35bc1a;})});}_0x3de11c=_[_0x9c35('0x41')]({},_0x3de11c,_0x5775e0[_0x9c35('0x2e')]);return _0x39847a[_0x9c35('0x74')](_0x3de11c);}})[_0x9c35('0x14')](function(_0xa2e3b6){if(_0xa2e3b6){_0x16c704=_0xa2e3b6[_0x9c35('0x2c')];if(!_0x5775e0[_0x9c35('0x22')][_0x9c35('0x4f')]('nolimit')){_0x3de11c[_0x9c35('0xd')]=qs[_0x9c35('0xd')](_0x5775e0[_0x9c35('0x22')]['limit']);_0x3de11c[_0x9c35('0xf')]=qs[_0x9c35('0xf')](_0x5775e0['query']['offset']);}return _0x39847a[_0x9c35('0x74')](_0x3de11c);}})[_0x9c35('0x14')](function(_0x4a881b){if(_0x4a881b){return _0x4a881b?{'count':_0x16c704,'rows':_0x4a881b}:null;}})[_0x9c35('0x14')](respondWithResult(_0x6e456a,null))[_0x9c35('0x25')](handleError(_0x6e456a,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index e405ed5..d0081d1 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 _0xbe6f=['hasOwnProperty','hook','exports','events','../../mysqldb','FaxQueue','setMaxListeners','save','update','emit'];(function(_0x2f00e9,_0x1797bf){var _0x1c874c=function(_0x52208d){while(--_0x52208d){_0x2f00e9['push'](_0x2f00e9['shift']());}};_0x1c874c(++_0x1797bf);}(_0xbe6f,0x189));var _0xfbe6=function(_0x5f556e,_0xc918bb){_0x5f556e=_0x5f556e-0x0;var _0x2fab39=_0xbe6f[_0x5f556e];return _0x2fab39;};'use strict';var EventEmitter=require(_0xfbe6('0x0'));var FaxQueue=require(_0xfbe6('0x1'))['db'][_0xfbe6('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xfbe6('0x3')](0x0);var events={'afterCreate':_0xfbe6('0x4'),'afterUpdate':_0xfbe6('0x5'),'afterDestroy':'remove'};function emitEvent(_0x4eec14){return function(_0x2944d8,_0x2f2a49,_0x1f43ff){FaxQueueEvents[_0xfbe6('0x6')](_0x4eec14+':'+_0x2944d8['id'],_0x2944d8);FaxQueueEvents[_0xfbe6('0x6')](_0x4eec14,_0x2944d8);_0x1f43ff(null);};}for(var e in events){if(events[_0xfbe6('0x7')](e)){var event=events[e];FaxQueue[_0xfbe6('0x8')](e,emitEvent(event));}}module[_0xfbe6('0x9')]=FaxQueueEvents; \ No newline at end of file +var _0x504a=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxQueue','setMaxListeners','save','update'];(function(_0x11fcec,_0x2e9b56){var _0x29a9ee=function(_0x11a0c8){while(--_0x11a0c8){_0x11fcec['push'](_0x11fcec['shift']());}};_0x29a9ee(++_0x2e9b56);}(_0x504a,0x15a));var _0xa504=function(_0x470534,_0x8973a5){_0x470534=_0x470534-0x0;var _0x3e78c6=_0x504a[_0x470534];return _0x3e78c6;};'use strict';var EventEmitter=require(_0xa504('0x0'));var FaxQueue=require(_0xa504('0x1'))['db'][_0xa504('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xa504('0x3')](0x0);var events={'afterCreate':_0xa504('0x4'),'afterUpdate':_0xa504('0x5'),'afterDestroy':_0xa504('0x6')};function emitEvent(_0x4a126c){return function(_0x241e69,_0x21e48f,_0x41e6fe){FaxQueueEvents[_0xa504('0x7')](_0x4a126c+':'+_0x241e69['id'],_0x241e69);FaxQueueEvents[_0xa504('0x7')](_0x4a126c,_0x241e69);_0x41e6fe(null);};}for(var e in events){if(events[_0xa504('0x8')](e)){var event=events[e];FaxQueue[_0xa504('0x9')](e,emitEvent(event));}}module[_0xa504('0xa')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 2a6b132..1f93fbe 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 _0xecc4=['bluebird','path','rimraf','../../config/environment','exports','../../config/logger','api','moment'];(function(_0x370b20,_0xae065c){var _0x5bc5fb=function(_0x5b8e87){while(--_0x5b8e87){_0x370b20['push'](_0x370b20['shift']());}};_0x5bc5fb(++_0xae065c);}(_0xecc4,0x1ad));var _0x4ecc=function(_0x363240,_0x230d4e){_0x363240=_0x363240-0x0;var _0x937893=_0xecc4[_0x363240];return _0x937893;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4ecc('0x0'))(_0x4ecc('0x1'));var moment=require(_0x4ecc('0x2'));var BPromise=require(_0x4ecc('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4ecc('0x4'));var rimraf=require(_0x4ecc('0x5'));var config=require(_0x4ecc('0x6'));var attributes=require('./faxQueue.attributes');module[_0x4ecc('0x7')]=function(_0x307efb,_0x5aa5a6){return _0x307efb['define']('FaxQueue',attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc52f=['moment','bluebird','path','rimraf','../../config/environment','./faxQueue.attributes','define','FaxQueue','fax_queues','lodash','util','../../config/logger','api'];(function(_0x195961,_0x364284){var _0x5a2e12=function(_0x36ea9f){while(--_0x36ea9f){_0x195961['push'](_0x195961['shift']());}};_0x5a2e12(++_0x364284);}(_0xc52f,0x100));var _0xfc52=function(_0x263d83,_0x29e843){_0x263d83=_0x263d83-0x0;var _0x39bc83=_0xc52f[_0x263d83];return _0x39bc83;};'use strict';var _=require(_0xfc52('0x0'));var util=require(_0xfc52('0x1'));var logger=require(_0xfc52('0x2'))(_0xfc52('0x3'));var moment=require(_0xfc52('0x4'));var BPromise=require(_0xfc52('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfc52('0x6'));var rimraf=require(_0xfc52('0x7'));var config=require(_0xfc52('0x8'));var attributes=require(_0xfc52('0x9'));module['exports']=function(_0x31b08c,_0x330ed3){return _0x31b08c[_0xfc52('0xa')](_0xfc52('0xb'),attributes,{'tableName':_0xfc52('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index 96f1921..a58ac93 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 _0x3c5b=['attributes','stringify','ShowFaxQueue','then','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','request','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','limit','include','map','model'];(function(_0x7e7cb4,_0x18106e){var _0x3577aa=function(_0x52f92e){while(--_0x52f92e){_0x7e7cb4['push'](_0x7e7cb4['shift']());}};_0x3577aa(++_0x18106e);}(_0x3c5b,0xe8));var _0xb3c5=function(_0x16df72,_0x540c04){_0x16df72=_0x16df72-0x0;var _0x1480e9=_0x3c5b[_0x16df72];return _0x1480e9;};'use strict';var _=require(_0xb3c5('0x0'));var util=require(_0xb3c5('0x1'));var moment=require(_0xb3c5('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb3c5('0x3'));var db=require(_0xb3c5('0x4'))['db'];var utils=require(_0xb3c5('0x5'));var logger=require(_0xb3c5('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb3c5('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0xb3c5('0x8')]=_[_0xb3c5('0x9')](config[_0xb3c5('0x8')],{'host':_0xb3c5('0xa'),'port':0x18eb});var socket=require(_0xb3c5('0xb'))(new Redis(config['redis']));require(_0xb3c5('0xc'))[_0xb3c5('0xd')](socket);function respondWithRpcPromise(_0x77963d,_0x4d9fbe,_0xbf1319){return new BPromise(function(_0x32fc20,_0x19eff4){return client[_0xb3c5('0xe')](_0x77963d,_0xbf1319)['then'](function(_0x537675){logger['info'](_0xb3c5('0xf'),_0x4d9fbe,_0xb3c5('0x10'));logger[_0xb3c5('0x11')](_0xb3c5('0x12'),_0x4d9fbe,_0xb3c5('0x10'),JSON['stringify'](_0x537675));if(_0x537675[_0xb3c5('0x13')]){if(_0x537675[_0xb3c5('0x13')]['code']===0x1f4){logger[_0xb3c5('0x13')]('FaxQueue,\x20%s,\x20%s',_0x4d9fbe,_0x537675[_0xb3c5('0x13')][_0xb3c5('0x14')]);return _0x19eff4(_0x537675[_0xb3c5('0x13')]['message']);}logger[_0xb3c5('0x13')](_0xb3c5('0xf'),_0x4d9fbe,_0x537675[_0xb3c5('0x13')][_0xb3c5('0x14')]);return _0x32fc20(_0x537675[_0xb3c5('0x13')]['message']);}else{logger[_0xb3c5('0x15')](_0xb3c5('0xf'),_0x4d9fbe,'request\x20sent');_0x32fc20(_0x537675[_0xb3c5('0x16')][_0xb3c5('0x14')]);}})[_0xb3c5('0x17')](function(_0xa91d7e){logger[_0xb3c5('0x13')](_0xb3c5('0xf'),_0x4d9fbe,_0xa91d7e);_0x19eff4(_0xa91d7e);});});}exports[_0xb3c5('0x18')]=function(_0x938af5){var _0x3b92a9=this;return new Promise(function(_0x3aa22d,_0x251620){return db[_0xb3c5('0x19')][_0xb3c5('0x1a')]({'raw':_0x938af5[_0xb3c5('0x1b')]?_0x938af5[_0xb3c5('0x1b')][_0xb3c5('0x1c')]===undefined?!![]:![]:!![],'where':_0x938af5['options']?_0x938af5[_0xb3c5('0x1b')][_0xb3c5('0x1d')]||null:null,'attributes':_0x938af5[_0xb3c5('0x1b')]?_0x938af5[_0xb3c5('0x1b')]['attributes']||null:null,'limit':_0x938af5[_0xb3c5('0x1b')]?_0x938af5[_0xb3c5('0x1b')][_0xb3c5('0x1e')]||null:null,'include':_0x938af5[_0xb3c5('0x1b')]?_0x938af5[_0xb3c5('0x1b')][_0xb3c5('0x1f')]?_[_0xb3c5('0x20')](_0x938af5[_0xb3c5('0x1b')]['include'],function(_0x29062){return{'model':db[_0x29062[_0xb3c5('0x21')]],'as':_0x29062['as'],'attributes':_0x29062['attributes'],'include':_0x29062[_0xb3c5('0x1f')]?_[_0xb3c5('0x20')](_0x29062[_0xb3c5('0x1f')],function(_0x292c2d){return{'model':db[_0x292c2d[_0xb3c5('0x21')]],'as':_0x292c2d['as'],'attributes':_0x292c2d[_0xb3c5('0x22')],'include':_0x292c2d[_0xb3c5('0x1f')]?_[_0xb3c5('0x20')](_0x292c2d[_0xb3c5('0x1f')],function(_0x156dbb){return{'model':db[_0x156dbb[_0xb3c5('0x21')]],'as':_0x156dbb['as'],'attributes':_0x156dbb['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x108b7e){logger[_0xb3c5('0x15')](_0xb3c5('0x18'),_0x938af5);logger[_0xb3c5('0x11')](_0xb3c5('0x18'),_0x938af5,JSON[_0xb3c5('0x23')](_0x108b7e));_0x3aa22d(_0x108b7e);})[_0xb3c5('0x17')](function(_0xd198c2){logger[_0xb3c5('0x13')](_0xb3c5('0x18'),_0xd198c2[_0xb3c5('0x14')],_0x938af5);_0x251620(_0x3b92a9[_0xb3c5('0x13')](0x1f4,_0xd198c2[_0xb3c5('0x14')]));});});};exports[_0xb3c5('0x24')]=function(_0x5dba6e){var _0x1adfb6=this;return new Promise(function(_0x31a167,_0x5dd284){return db[_0xb3c5('0x19')]['find']({'raw':_0x5dba6e[_0xb3c5('0x1b')]?_0x5dba6e[_0xb3c5('0x1b')][_0xb3c5('0x1c')]===undefined?!![]:![]:!![],'where':_0x5dba6e[_0xb3c5('0x1b')]?_0x5dba6e['options']['where']||null:null,'attributes':_0x5dba6e[_0xb3c5('0x1b')]?_0x5dba6e['options'][_0xb3c5('0x22')]||null:null,'include':_0x5dba6e[_0xb3c5('0x1b')]?_0x5dba6e['options'][_0xb3c5('0x1f')]?_['map'](_0x5dba6e[_0xb3c5('0x1b')][_0xb3c5('0x1f')],function(_0x243f33){return{'model':db[_0x243f33['model']],'as':_0x243f33['as'],'attributes':_0x243f33[_0xb3c5('0x22')],'include':_0x243f33[_0xb3c5('0x1f')]?_[_0xb3c5('0x20')](_0x243f33['include'],function(_0x44eb18){return{'model':db[_0x44eb18['model']],'as':_0x44eb18['as'],'attributes':_0x44eb18['attributes'],'include':_0x44eb18[_0xb3c5('0x1f')]?_['map'](_0x44eb18['include'],function(_0x163fcb){return{'model':db[_0x163fcb[_0xb3c5('0x21')]],'as':_0x163fcb['as'],'attributes':_0x163fcb[_0xb3c5('0x22')]};}):[]};}):[]};}):[]:[]})[_0xb3c5('0x25')](function(_0x56eb79){logger['info'](_0xb3c5('0x24'),_0x5dba6e);logger['debug'](_0xb3c5('0x24'),_0x5dba6e,JSON[_0xb3c5('0x23')](_0x56eb79));_0x31a167(_0x56eb79);})[_0xb3c5('0x17')](function(_0x5dd122){logger['error'](_0xb3c5('0x24'),_0x5dd122[_0xb3c5('0x14')],_0x5dba6e);_0x5dd284(_0x1adfb6[_0xb3c5('0x13')](0x1f4,_0x5dd122[_0xb3c5('0x14')]));});});}; \ No newline at end of file +var _0x4279=['limit','include','model','attributes','map','debug','ShowFaxQueue','find','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','localhost','socket.io-emitter','./faxQueue.socket','request','then','FaxQueue,\x20%s,\x20%s','FaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where'];(function(_0x18d50f,_0x124aff){var _0x8ce385=function(_0x321962){while(--_0x321962){_0x18d50f['push'](_0x18d50f['shift']());}};_0x8ce385(++_0x124aff);}(_0x4279,0xf8));var _0x9427=function(_0xcef398,_0x250d15){_0xcef398=_0xcef398-0x0;var _0x49d661=_0x4279[_0xcef398];return _0x49d661;};'use strict';var _=require(_0x9427('0x0'));var util=require(_0x9427('0x1'));var moment=require('moment');var BPromise=require(_0x9427('0x2'));var rs=require(_0x9427('0x3'));var fs=require('fs');var Redis=require(_0x9427('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9427('0x5'));var logger=require(_0x9427('0x6'))(_0x9427('0x7'));var config=require('../../config/environment');var jayson=require(_0x9427('0x8'));var client=jayson[_0x9427('0x9')]['http']({'port':0x232a});config[_0x9427('0xa')]=_['defaults'](config['redis'],{'host':_0x9427('0xb'),'port':0x18eb});var socket=require(_0x9427('0xc'))(new Redis(config['redis']));require(_0x9427('0xd'))['register'](socket);function respondWithRpcPromise(_0x5f1d10,_0x8a75ca,_0x2e35d7){return new BPromise(function(_0x48f8a1,_0x1f32d1){return client[_0x9427('0xe')](_0x5f1d10,_0x2e35d7)[_0x9427('0xf')](function(_0x28124e){logger['info'](_0x9427('0x10'),_0x8a75ca,'request\x20sent');logger['debug'](_0x9427('0x11'),_0x8a75ca,_0x9427('0x12'),JSON[_0x9427('0x13')](_0x28124e));if(_0x28124e[_0x9427('0x14')]){if(_0x28124e[_0x9427('0x14')][_0x9427('0x15')]===0x1f4){logger[_0x9427('0x14')](_0x9427('0x10'),_0x8a75ca,_0x28124e[_0x9427('0x14')]['message']);return _0x1f32d1(_0x28124e[_0x9427('0x14')][_0x9427('0x16')]);}logger[_0x9427('0x14')](_0x9427('0x10'),_0x8a75ca,_0x28124e[_0x9427('0x14')][_0x9427('0x16')]);return _0x48f8a1(_0x28124e['error'][_0x9427('0x16')]);}else{logger[_0x9427('0x17')]('FaxQueue,\x20%s,\x20%s',_0x8a75ca,_0x9427('0x12'));_0x48f8a1(_0x28124e[_0x9427('0x18')][_0x9427('0x16')]);}})[_0x9427('0x19')](function(_0x5121b6){logger[_0x9427('0x14')](_0x9427('0x10'),_0x8a75ca,_0x5121b6);_0x1f32d1(_0x5121b6);});});}exports[_0x9427('0x1a')]=function(_0x357a46){var _0x584730=this;return new Promise(function(_0x3622e1,_0x4d4682){return db[_0x9427('0x1b')][_0x9427('0x1c')]({'raw':_0x357a46[_0x9427('0x1d')]?_0x357a46['options'][_0x9427('0x1e')]===undefined?!![]:![]:!![],'where':_0x357a46[_0x9427('0x1d')]?_0x357a46['options'][_0x9427('0x1f')]||null:null,'attributes':_0x357a46[_0x9427('0x1d')]?_0x357a46[_0x9427('0x1d')]['attributes']||null:null,'limit':_0x357a46['options']?_0x357a46[_0x9427('0x1d')][_0x9427('0x20')]||null:null,'include':_0x357a46['options']?_0x357a46[_0x9427('0x1d')][_0x9427('0x21')]?_['map'](_0x357a46[_0x9427('0x1d')][_0x9427('0x21')],function(_0xa0a71f){return{'model':db[_0xa0a71f[_0x9427('0x22')]],'as':_0xa0a71f['as'],'attributes':_0xa0a71f[_0x9427('0x23')],'include':_0xa0a71f[_0x9427('0x21')]?_['map'](_0xa0a71f[_0x9427('0x21')],function(_0x1505a5){return{'model':db[_0x1505a5[_0x9427('0x22')]],'as':_0x1505a5['as'],'attributes':_0x1505a5[_0x9427('0x23')],'include':_0x1505a5[_0x9427('0x21')]?_[_0x9427('0x24')](_0x1505a5[_0x9427('0x21')],function(_0x3bc1ff){return{'model':db[_0x3bc1ff['model']],'as':_0x3bc1ff['as'],'attributes':_0x3bc1ff[_0x9427('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xc63374){logger[_0x9427('0x17')]('GetFaxQueue',_0x357a46);logger[_0x9427('0x25')](_0x9427('0x1a'),_0x357a46,JSON[_0x9427('0x13')](_0xc63374));_0x3622e1(_0xc63374);})['catch'](function(_0x5e3db2){logger[_0x9427('0x14')]('GetFaxQueue',_0x5e3db2['message'],_0x357a46);_0x4d4682(_0x584730[_0x9427('0x14')](0x1f4,_0x5e3db2[_0x9427('0x16')]));});});};exports[_0x9427('0x26')]=function(_0x3d3239){var _0x419913=this;return new Promise(function(_0x27a912,_0x12ec62){return db[_0x9427('0x1b')][_0x9427('0x27')]({'raw':_0x3d3239[_0x9427('0x1d')]?_0x3d3239['options'][_0x9427('0x1e')]===undefined?!![]:![]:!![],'where':_0x3d3239[_0x9427('0x1d')]?_0x3d3239[_0x9427('0x1d')]['where']||null:null,'attributes':_0x3d3239['options']?_0x3d3239['options']['attributes']||null:null,'include':_0x3d3239[_0x9427('0x1d')]?_0x3d3239['options']['include']?_[_0x9427('0x24')](_0x3d3239['options'][_0x9427('0x21')],function(_0x1771cb){return{'model':db[_0x1771cb['model']],'as':_0x1771cb['as'],'attributes':_0x1771cb['attributes'],'include':_0x1771cb[_0x9427('0x21')]?_[_0x9427('0x24')](_0x1771cb[_0x9427('0x21')],function(_0x5dfd6e){return{'model':db[_0x5dfd6e[_0x9427('0x22')]],'as':_0x5dfd6e['as'],'attributes':_0x5dfd6e[_0x9427('0x23')],'include':_0x5dfd6e[_0x9427('0x21')]?_[_0x9427('0x24')](_0x5dfd6e[_0x9427('0x21')],function(_0x33a6a3){return{'model':db[_0x33a6a3[_0x9427('0x22')]],'as':_0x33a6a3['as'],'attributes':_0x33a6a3[_0x9427('0x23')]};}):[]};}):[]};}):[]:[]})[_0x9427('0xf')](function(_0x5d10dd){logger[_0x9427('0x17')]('ShowFaxQueue',_0x3d3239);logger[_0x9427('0x25')](_0x9427('0x26'),_0x3d3239,JSON[_0x9427('0x13')](_0x5d10dd));_0x27a912(_0x5d10dd);})[_0x9427('0x19')](function(_0x577673){logger[_0x9427('0x14')](_0x9427('0x26'),_0x577673[_0x9427('0x16')],_0x3d3239);_0x12ec62(_0x419913['error'](0x1f4,_0x577673[_0x9427('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index c3c85bf..a9e29bd 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 _0x038b=['removeListener','register','length','save','remove','update','emit'];(function(_0x434804,_0x415f68){var _0x573fc8=function(_0x3ce265){while(--_0x3ce265){_0x434804['push'](_0x434804['shift']());}};_0x573fc8(++_0x415f68);}(_0x038b,0x114));var _0xb038=function(_0x56970f,_0x504480){_0x56970f=_0x56970f-0x0;var _0x2a6951=_0x038b[_0x56970f];return _0x2a6951;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0xb038('0x0'),_0xb038('0x1'),_0xb038('0x2')];function createListener(_0x5623c3,_0x3d7dfe){return function(_0x5ed31a){_0x3d7dfe[_0xb038('0x3')](_0x5623c3,_0x5ed31a);};}function removeListener(_0x3d090b,_0x4a8a30){return function(){FaxQueueEvents[_0xb038('0x4')](_0x3d090b,_0x4a8a30);};}exports[_0xb038('0x5')]=function(_0x4fe092){for(var _0x54e1e7=0x0,_0x2e3e64=events[_0xb038('0x6')];_0x54e1e7<_0x2e3e64;_0x54e1e7++){var _0x1534a9=events[_0x54e1e7];var _0x4b4085=createListener('faxQueue:'+_0x1534a9,_0x4fe092);FaxQueueEvents['on'](_0x1534a9,_0x4b4085);}}; \ No newline at end of file +var _0xce39=['register','length','faxQueue:','./faxQueue.events','save','remove','update','emit','removeListener'];(function(_0x131a70,_0x5f53b2){var _0x212967=function(_0x2a43ac){while(--_0x2a43ac){_0x131a70['push'](_0x131a70['shift']());}};_0x212967(++_0x5f53b2);}(_0xce39,0x198));var _0x9ce3=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xce39[_0x2641f9];return _0x585741;};'use strict';var FaxQueueEvents=require(_0x9ce3('0x0'));var events=[_0x9ce3('0x1'),_0x9ce3('0x2'),_0x9ce3('0x3')];function createListener(_0x488007,_0x3ffa32){return function(_0x30bf80){_0x3ffa32[_0x9ce3('0x4')](_0x488007,_0x30bf80);};}function removeListener(_0x4e2ca9,_0x461957){return function(){FaxQueueEvents[_0x9ce3('0x5')](_0x4e2ca9,_0x461957);};}exports[_0x9ce3('0x6')]=function(_0x85b79a){for(var _0x14e1b1=0x0,_0x350ba2=events[_0x9ce3('0x7')];_0x14e1b1<_0x350ba2;_0x14e1b1++){var _0x4eb633=events[_0x14e1b1];var _0x1db553=createListener(_0x9ce3('0x8')+_0x4eb633,_0x85b79a);FaxQueueEvents['on'](_0x4eb633,_0x1db553);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 7133ffd..72a3dd4 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 _0xbd10=['path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','update','destroy','delete','removeTeams','multer','util'];(function(_0x49eaac,_0x429484){var _0x326559=function(_0x55340d){while(--_0x55340d){_0x49eaac['push'](_0x49eaac['shift']());}};_0x326559(++_0x429484);}(_0xbd10,0x85));var _0x0bd1=function(_0x3eb61f,_0x392042){_0x3eb61f=_0x3eb61f-0x0;var _0x5f1e4d=_0xbd10[_0x3eb61f];return _0x5f1e4d;};'use strict';var multer=require(_0x0bd1('0x0'));var util=require(_0x0bd1('0x1'));var path=require(_0x0bd1('0x2'));var timeout=require('connect-timeout');var express=require(_0x0bd1('0x3'));var router=express[_0x0bd1('0x4')]();var fs_extra=require(_0x0bd1('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0bd1('0x6'));var config=require(_0x0bd1('0x7'));var controller=require(_0x0bd1('0x8'));router[_0x0bd1('0x9')]('/',auth[_0x0bd1('0xa')](),controller[_0x0bd1('0xb')]);router['get'](_0x0bd1('0xc'),auth['isAuthenticated'](),controller[_0x0bd1('0xd')]);router[_0x0bd1('0x9')](_0x0bd1('0xe'),auth[_0x0bd1('0xa')](),controller['show']);router[_0x0bd1('0x9')](_0x0bd1('0xf'),auth[_0x0bd1('0xa')](),controller[_0x0bd1('0x10')]);router[_0x0bd1('0x9')](_0x0bd1('0x11'),auth['isAuthenticated'](),controller[_0x0bd1('0x12')]);router[_0x0bd1('0x9')](_0x0bd1('0x13'),auth[_0x0bd1('0xa')](),controller[_0x0bd1('0x14')]);router[_0x0bd1('0x15')]('/',auth['isAuthenticated'](),controller[_0x0bd1('0x16')]);router[_0x0bd1('0x15')](_0x0bd1('0x11'),auth['isAuthenticated'](),controller['addTeams']);router[_0x0bd1('0x15')](_0x0bd1('0x13'),auth[_0x0bd1('0xa')](),controller['addAgents']);router['put'](_0x0bd1('0xe'),auth[_0x0bd1('0xa')](),controller[_0x0bd1('0x17')]);router['delete'](_0x0bd1('0xe'),auth[_0x0bd1('0xa')](),controller[_0x0bd1('0x18')]);router[_0x0bd1('0x19')]('/:id/teams',auth[_0x0bd1('0xa')](),controller[_0x0bd1('0x1a')]);router['delete'](_0x0bd1('0x13'),auth[_0x0bd1('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x6455=['getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','update','destroy','removeTeams','delete','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/members','/:id/teams'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6455,0x97));var _0x5645=function(_0x31f4e2,_0x174cdb){_0x31f4e2=_0x31f4e2-0x0;var _0x1c96e6=_0x6455[_0x31f4e2];return _0x1c96e6;};'use strict';var multer=require(_0x5645('0x0'));var util=require('util');var path=require(_0x5645('0x1'));var timeout=require(_0x5645('0x2'));var express=require(_0x5645('0x3'));var router=express[_0x5645('0x4')]();var fs_extra=require(_0x5645('0x5'));var auth=require(_0x5645('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5645('0x7'));var controller=require(_0x5645('0x8'));router[_0x5645('0x9')]('/',auth[_0x5645('0xa')](),controller[_0x5645('0xb')]);router[_0x5645('0x9')](_0x5645('0xc'),auth[_0x5645('0xa')](),controller['describe']);router['get'](_0x5645('0xd'),auth[_0x5645('0xa')](),controller[_0x5645('0xe')]);router[_0x5645('0x9')](_0x5645('0xf'),auth[_0x5645('0xa')](),controller['getMembers']);router[_0x5645('0x9')](_0x5645('0x10'),auth[_0x5645('0xa')](),controller[_0x5645('0x11')]);router['get'](_0x5645('0x12'),auth['isAuthenticated'](),controller[_0x5645('0x13')]);router[_0x5645('0x14')]('/',auth[_0x5645('0xa')](),controller[_0x5645('0x15')]);router[_0x5645('0x14')](_0x5645('0x10'),auth[_0x5645('0xa')](),controller[_0x5645('0x16')]);router['post'](_0x5645('0x12'),auth[_0x5645('0xa')](),controller[_0x5645('0x17')]);router['put']('/:id',auth[_0x5645('0xa')](),controller[_0x5645('0x18')]);router['delete'](_0x5645('0xd'),auth[_0x5645('0xa')](),controller[_0x5645('0x19')]);router['delete'](_0x5645('0x10'),auth[_0x5645('0xa')](),controller[_0x5645('0x1a')]);router[_0x5645('0x1b')]('/:id/users',auth[_0x5645('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 83e7a0c..d88b5dd 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 _0x89bf=['DATE','moment','exports','STRING'];(function(_0x44295c,_0x41e434){var _0x342694=function(_0x1ea187){while(--_0x1ea187){_0x44295c['push'](_0x44295c['shift']());}};_0x342694(++_0x41e434);}(_0x89bf,0x11d));var _0xf89b=function(_0x394bf2,_0x331e93){_0x394bf2=_0x394bf2-0x0;var _0x562d39=_0x89bf[_0x394bf2];return _0x562d39;};'use strict';var moment=require(_0xf89b('0x0'));var Sequelize=require('sequelize');module[_0xf89b('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xf89b('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xf89b('0x3')]},'acceptAt':{'type':Sequelize[_0xf89b('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xf89b('0x2')]}}; \ No newline at end of file +var _0x6007=['exports','STRING','DATE','moment','sequelize'];(function(_0x1e5fc4,_0x36c444){var _0x48c8b9=function(_0x220223){while(--_0x220223){_0x1e5fc4['push'](_0x1e5fc4['shift']());}};_0x48c8b9(++_0x36c444);}(_0x6007,0x8f));var _0x7600=function(_0x4bb66f,_0x3cd682){_0x4bb66f=_0x4bb66f-0x0;var _0xf2772f=_0x6007[_0x4bb66f];return _0xf2772f;};'use strict';var moment=require(_0x7600('0x0'));var Sequelize=require(_0x7600('0x1'));module[_0x7600('0x2')]={'uniqueid':{'type':Sequelize[_0x7600('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x7600('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7600('0x4')]},'acceptAt':{'type':Sequelize[_0x7600('0x4')]},'exitAt':{'type':Sequelize[_0x7600('0x4')]},'reason':{'type':Sequelize[_0x7600('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index f113dc1..f1cfbf2 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 _0x96a2=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','count','limit','Content-Range','apply','update','then','destroy','error','stack','name','map','FaxQueueReport','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','keys','filters','find','catch','create','body','describe','eml-format','zip-dir'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x96a2,0x96));var _0x296a=function(_0x63d3c7,_0x4bae01){_0x63d3c7=_0x63d3c7-0x0;var _0x23a9f7=_0x96a2[_0x63d3c7];return _0x23a9f7;};'use strict';var emlformat=require(_0x296a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x296a('0x1'));var jsonpatch=require(_0x296a('0x2'));var rp=require(_0x296a('0x3'));var moment=require(_0x296a('0x4'));var BPromise=require(_0x296a('0x5'));var Mustache=require(_0x296a('0x6'));var util=require(_0x296a('0x7'));var path=require(_0x296a('0x8'));var sox=require(_0x296a('0x9'));var csv=require(_0x296a('0xa'));var ejs=require(_0x296a('0xb'));var fs=require('fs');var fs_extra=require(_0x296a('0xc'));var _=require(_0x296a('0xd'));var squel=require(_0x296a('0xe'));var crypto=require(_0x296a('0xf'));var jsforce=require(_0x296a('0x10'));var deskjs=require(_0x296a('0x11'));var toCsv=require(_0x296a('0xa'));var querystring=require('querystring');var Papa=require(_0x296a('0x12'));var Redis=require(_0x296a('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x296a('0x14'));var as=require(_0x296a('0x15'));var hardwareService=require(_0x296a('0x16'));var logger=require(_0x296a('0x17'))(_0x296a('0x18'));var utils=require(_0x296a('0x19'));var config=require(_0x296a('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x296a('0x1b'))['db'];function respondWithStatusCode(_0x9fd86a,_0x507a4c){_0x507a4c=_0x507a4c||0xcc;return function(_0x4574bd){if(_0x4574bd){return _0x9fd86a[_0x296a('0x1c')](_0x507a4c);}return _0x9fd86a['status'](_0x507a4c)[_0x296a('0x1d')]();};}function respondWithResult(_0xba0fe9,_0x495be8){_0x495be8=_0x495be8||0xc8;return function(_0xc1f766){if(_0xc1f766){return _0xba0fe9[_0x296a('0x1e')](_0x495be8)[_0x296a('0x1f')](_0xc1f766);}};}function respondWithFilteredResult(_0x1d7815,_0x99b163){return function(_0x164e80){if(_0x164e80){var _0x5c1f54=typeof _0x99b163[_0x296a('0x20')]==='undefined'&&typeof _0x99b163['limit']==='undefined';var _0x463b66=_0x164e80[_0x296a('0x21')];var _0x2b82d6=_0x5c1f54?0x0:_0x99b163['offset'];var _0x51ba98=_0x5c1f54?_0x164e80[_0x296a('0x21')]:_0x99b163['offset']+_0x99b163[_0x296a('0x22')];var _0x2c1ea4;if(_0x51ba98>=_0x463b66){_0x51ba98=_0x463b66;_0x2c1ea4=0xc8;}else{_0x2c1ea4=0xce;}_0x1d7815[_0x296a('0x1e')](_0x2c1ea4);return _0x1d7815['set'](_0x296a('0x23'),_0x2b82d6+'-'+_0x51ba98+'/'+_0x463b66)[_0x296a('0x1f')](_0x164e80);}return null;};}function patchUpdates(_0x334844){return function(_0x5aad3e){try{jsonpatch[_0x296a('0x24')](_0x5aad3e,_0x334844,!![]);}catch(_0x71fbc6){return BPromise['reject'](_0x71fbc6);}return _0x5aad3e['save']();};}function saveUpdates(_0x2a2971,_0x3750c7){return function(_0x3be956){if(_0x3be956){return _0x3be956[_0x296a('0x25')](_0x2a2971)[_0x296a('0x26')](function(_0x16f287){return _0x16f287;});}return null;};}function removeEntity(_0x2cff01,_0x2cf007){return function(_0x37f6d4){if(_0x37f6d4){return _0x37f6d4[_0x296a('0x27')]()[_0x296a('0x26')](function(){_0x2cff01[_0x296a('0x1e')](0xcc)[_0x296a('0x1d')]();});}};}function handleEntityNotFound(_0xf6b922,_0x2177df){return function(_0x529eb8){if(!_0x529eb8){_0xf6b922[_0x296a('0x1c')](0x194);}return _0x529eb8;};}function handleError(_0x43911b,_0x526ac5){_0x526ac5=_0x526ac5||0x1f4;return function(_0x2c4bed){logger[_0x296a('0x28')](_0x2c4bed[_0x296a('0x29')]);if(_0x2c4bed['name']){delete _0x2c4bed[_0x296a('0x2a')];}_0x43911b[_0x296a('0x1e')](_0x526ac5)['send'](_0x2c4bed);};}exports['index']=function(_0x15e9ac,_0x2c0644){var _0x2d7209={},_0x583548={},_0x571c26={'count':0x0,'rows':[]};var _0x18d372=_[_0x296a('0x2b')](db[_0x296a('0x2c')][_0x296a('0x2d')],function(_0x11278b){return{'name':_0x11278b[_0x296a('0x2e')],'type':_0x11278b[_0x296a('0x2f')][_0x296a('0x30')]};});_0x583548[_0x296a('0x31')]=_[_0x296a('0x2b')](_0x18d372,'name');_0x583548[_0x296a('0x32')]=_['keys'](_0x15e9ac[_0x296a('0x32')]);_0x583548['filters']=_[_0x296a('0x33')](_0x583548[_0x296a('0x31')],_0x583548[_0x296a('0x32')]);_0x2d7209[_0x296a('0x34')]=_[_0x296a('0x33')](_0x583548['model'],qs[_0x296a('0x35')](_0x15e9ac[_0x296a('0x32')][_0x296a('0x35')]));_0x2d7209[_0x296a('0x34')]=_0x2d7209['attributes'][_0x296a('0x36')]?_0x2d7209['attributes']:_0x583548['model'];if(!_0x15e9ac['query'][_0x296a('0x37')](_0x296a('0x38'))){_0x2d7209[_0x296a('0x22')]=qs[_0x296a('0x22')](_0x15e9ac['query'][_0x296a('0x22')]);_0x2d7209[_0x296a('0x20')]=qs[_0x296a('0x20')](_0x15e9ac[_0x296a('0x32')]['offset']);}_0x2d7209['order']=qs['sort'](_0x15e9ac[_0x296a('0x32')][_0x296a('0x39')]);_0x2d7209[_0x296a('0x3a')]=qs['filters'](_[_0x296a('0x3b')](_0x15e9ac['query'],_0x583548['filters']),_0x18d372);if(_0x15e9ac[_0x296a('0x32')][_0x296a('0x3c')]){_0x2d7209[_0x296a('0x3a')]=_[_0x296a('0x3d')](_0x2d7209['where'],{'$or':_[_0x296a('0x2b')](_0x18d372,function(_0x3641f7){if(_0x3641f7['type']!==_0x296a('0x3e')){var _0x4b296c={};_0x4b296c[_0x3641f7['name']]={'$like':'%'+_0x15e9ac['query'][_0x296a('0x3c')]+'%'};return _0x4b296c;}})});}_0x2d7209=_[_0x296a('0x3d')]({},_0x2d7209,_0x15e9ac['options']);var _0x1bfcf={'where':_0x2d7209[_0x296a('0x3a')]};return db[_0x296a('0x2c')][_0x296a('0x21')](_0x1bfcf)[_0x296a('0x26')](function(_0x7e7b0f){_0x571c26[_0x296a('0x21')]=_0x7e7b0f;if(_0x15e9ac[_0x296a('0x32')][_0x296a('0x3f')]){_0x2d7209[_0x296a('0x40')]=[{'all':!![]}];}return db['FaxQueueReport'][_0x296a('0x41')](_0x2d7209);})[_0x296a('0x26')](function(_0x547bda){_0x571c26[_0x296a('0x42')]=_0x547bda;return _0x571c26;})['then'](respondWithFilteredResult(_0x2c0644,_0x2d7209))['catch'](handleError(_0x2c0644,null));};exports[_0x296a('0x43')]=function(_0xb4d70b,_0x7e2f25){var _0x2255bc={'raw':!![],'where':{'id':_0xb4d70b[_0x296a('0x44')]['id']}},_0x1c58d3={};_0x1c58d3[_0x296a('0x31')]=_[_0x296a('0x45')](db[_0x296a('0x2c')][_0x296a('0x2d')]);_0x1c58d3[_0x296a('0x32')]=_[_0x296a('0x45')](_0xb4d70b[_0x296a('0x32')]);_0x1c58d3[_0x296a('0x46')]=_[_0x296a('0x33')](_0x1c58d3[_0x296a('0x31')],_0x1c58d3['query']);_0x2255bc['attributes']=_[_0x296a('0x33')](_0x1c58d3['model'],qs[_0x296a('0x35')](_0xb4d70b['query'][_0x296a('0x35')]));_0x2255bc[_0x296a('0x34')]=_0x2255bc['attributes'][_0x296a('0x36')]?_0x2255bc['attributes']:_0x1c58d3[_0x296a('0x31')];if(_0xb4d70b[_0x296a('0x32')]['includeAll']){_0x2255bc[_0x296a('0x40')]=[{'all':!![]}];}_0x2255bc=_[_0x296a('0x3d')]({},_0x2255bc,_0xb4d70b['options']);return db[_0x296a('0x2c')][_0x296a('0x47')](_0x2255bc)[_0x296a('0x26')](handleEntityNotFound(_0x7e2f25,null))[_0x296a('0x26')](respondWithResult(_0x7e2f25,null))[_0x296a('0x48')](handleError(_0x7e2f25,null));};exports[_0x296a('0x49')]=function(_0x22473f,_0x3fcb86){return db[_0x296a('0x2c')][_0x296a('0x49')](_0x22473f[_0x296a('0x4a')],{})[_0x296a('0x26')](respondWithResult(_0x3fcb86,0xc9))[_0x296a('0x48')](handleError(_0x3fcb86,null));};exports[_0x296a('0x25')]=function(_0x23aefa,_0x3d1115){if(_0x23aefa['body']['id']){delete _0x23aefa[_0x296a('0x4a')]['id'];}return db[_0x296a('0x2c')][_0x296a('0x47')]({'where':{'id':_0x23aefa[_0x296a('0x44')]['id']}})[_0x296a('0x26')](handleEntityNotFound(_0x3d1115,null))[_0x296a('0x26')](saveUpdates(_0x23aefa[_0x296a('0x4a')],null))[_0x296a('0x26')](respondWithResult(_0x3d1115,null))['catch'](handleError(_0x3d1115,null));};exports[_0x296a('0x27')]=function(_0xcb620a,_0x162b91){return db[_0x296a('0x2c')][_0x296a('0x47')]({'where':{'id':_0xcb620a['params']['id']}})['then'](handleEntityNotFound(_0x162b91,null))[_0x296a('0x26')](removeEntity(_0x162b91,null))[_0x296a('0x48')](handleError(_0x162b91,null));};exports[_0x296a('0x4b')]=function(_0xe19e05,_0x3a79ae){return db[_0x296a('0x2c')][_0x296a('0x4b')]()[_0x296a('0x26')](respondWithResult(_0x3a79ae,null))[_0x296a('0x48')](handleError(_0x3a79ae,null));}; \ No newline at end of file +var _0xfc03=['desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','FaxQueueReport','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','keys','rawAttributes','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto'];(function(_0x71223b,_0x4c186b){var _0x16279b=function(_0x120f94){while(--_0x120f94){_0x71223b['push'](_0x71223b['shift']());}};_0x16279b(++_0x4c186b);}(_0xfc03,0x16f));var _0x3fc0=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0xfc03[_0x47fd36];return _0x21a0fc;};'use strict';var emlformat=require(_0x3fc0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3fc0('0x1'));var jsonpatch=require(_0x3fc0('0x2'));var rp=require('request-promise');var moment=require(_0x3fc0('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3fc0('0x4'));var util=require(_0x3fc0('0x5'));var path=require(_0x3fc0('0x6'));var sox=require(_0x3fc0('0x7'));var csv=require(_0x3fc0('0x8'));var ejs=require(_0x3fc0('0x9'));var fs=require('fs');var fs_extra=require(_0x3fc0('0xa'));var _=require(_0x3fc0('0xb'));var squel=require('squel');var crypto=require(_0x3fc0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x3fc0('0xd'));var toCsv=require(_0x3fc0('0x8'));var querystring=require(_0x3fc0('0xe'));var Papa=require(_0x3fc0('0xf'));var Redis=require('ioredis');var authService=require(_0x3fc0('0x10'));var qs=require(_0x3fc0('0x11'));var as=require(_0x3fc0('0x12'));var hardwareService=require(_0x3fc0('0x13'));var logger=require(_0x3fc0('0x14'))('api');var utils=require(_0x3fc0('0x15'));var config=require(_0x3fc0('0x16'));var licenseUtil=require(_0x3fc0('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1011b7,_0x582e22){_0x582e22=_0x582e22||0xcc;return function(_0x3a4cc0){if(_0x3a4cc0){return _0x1011b7[_0x3fc0('0x18')](_0x582e22);}return _0x1011b7['status'](_0x582e22)[_0x3fc0('0x19')]();};}function respondWithResult(_0x422926,_0x392c46){_0x392c46=_0x392c46||0xc8;return function(_0x4eb69a){if(_0x4eb69a){return _0x422926[_0x3fc0('0x1a')](_0x392c46)[_0x3fc0('0x1b')](_0x4eb69a);}};}function respondWithFilteredResult(_0x367ce1,_0x27619a){return function(_0x562ecc){if(_0x562ecc){var _0x277dbf=typeof _0x27619a[_0x3fc0('0x1c')]===_0x3fc0('0x1d')&&typeof _0x27619a['limit']===_0x3fc0('0x1d');var _0x491446=_0x562ecc[_0x3fc0('0x1e')];var _0x3c5026=_0x277dbf?0x0:_0x27619a['offset'];var _0x3bb388=_0x277dbf?_0x562ecc[_0x3fc0('0x1e')]:_0x27619a[_0x3fc0('0x1c')]+_0x27619a[_0x3fc0('0x1f')];var _0x1bd575;if(_0x3bb388>=_0x491446){_0x3bb388=_0x491446;_0x1bd575=0xc8;}else{_0x1bd575=0xce;}_0x367ce1[_0x3fc0('0x1a')](_0x1bd575);return _0x367ce1[_0x3fc0('0x20')](_0x3fc0('0x21'),_0x3c5026+'-'+_0x3bb388+'/'+_0x491446)[_0x3fc0('0x1b')](_0x562ecc);}return null;};}function patchUpdates(_0x5c859e){return function(_0xf13744){try{jsonpatch[_0x3fc0('0x22')](_0xf13744,_0x5c859e,!![]);}catch(_0x34ffa7){return BPromise[_0x3fc0('0x23')](_0x34ffa7);}return _0xf13744[_0x3fc0('0x24')]();};}function saveUpdates(_0x448293,_0x47c770){return function(_0x477674){if(_0x477674){return _0x477674[_0x3fc0('0x25')](_0x448293)[_0x3fc0('0x26')](function(_0x28fc65){return _0x28fc65;});}return null;};}function removeEntity(_0x46c213,_0x303dd2){return function(_0x2f423e){if(_0x2f423e){return _0x2f423e[_0x3fc0('0x27')]()[_0x3fc0('0x26')](function(){_0x46c213[_0x3fc0('0x1a')](0xcc)[_0x3fc0('0x19')]();});}};}function handleEntityNotFound(_0x1abe10,_0x784765){return function(_0xba1a23){if(!_0xba1a23){_0x1abe10[_0x3fc0('0x18')](0x194);}return _0xba1a23;};}function handleError(_0xbec5b5,_0x4f5111){_0x4f5111=_0x4f5111||0x1f4;return function(_0x365c8e){logger[_0x3fc0('0x28')](_0x365c8e[_0x3fc0('0x29')]);if(_0x365c8e[_0x3fc0('0x2a')]){delete _0x365c8e['name'];}_0xbec5b5[_0x3fc0('0x1a')](_0x4f5111)[_0x3fc0('0x2b')](_0x365c8e);};}exports[_0x3fc0('0x2c')]=function(_0x2645b4,_0x559fcc){var _0x1e4d99={},_0x1a2261={},_0x1960a4={'count':0x0,'rows':[]};var _0xac736c=_[_0x3fc0('0x2d')](db[_0x3fc0('0x2e')]['rawAttributes'],function(_0xd9ecae){return{'name':_0xd9ecae[_0x3fc0('0x2f')],'type':_0xd9ecae[_0x3fc0('0x30')][_0x3fc0('0x31')]};});_0x1a2261[_0x3fc0('0x32')]=_[_0x3fc0('0x2d')](_0xac736c,_0x3fc0('0x2a'));_0x1a2261[_0x3fc0('0x33')]=_['keys'](_0x2645b4['query']);_0x1a2261[_0x3fc0('0x34')]=_['intersection'](_0x1a2261[_0x3fc0('0x32')],_0x1a2261[_0x3fc0('0x33')]);_0x1e4d99[_0x3fc0('0x35')]=_[_0x3fc0('0x36')](_0x1a2261[_0x3fc0('0x32')],qs['fields'](_0x2645b4['query'][_0x3fc0('0x37')]));_0x1e4d99[_0x3fc0('0x35')]=_0x1e4d99[_0x3fc0('0x35')][_0x3fc0('0x38')]?_0x1e4d99[_0x3fc0('0x35')]:_0x1a2261['model'];if(!_0x2645b4[_0x3fc0('0x33')][_0x3fc0('0x39')](_0x3fc0('0x3a'))){_0x1e4d99['limit']=qs[_0x3fc0('0x1f')](_0x2645b4[_0x3fc0('0x33')][_0x3fc0('0x1f')]);_0x1e4d99[_0x3fc0('0x1c')]=qs['offset'](_0x2645b4[_0x3fc0('0x33')][_0x3fc0('0x1c')]);}_0x1e4d99['order']=qs[_0x3fc0('0x3b')](_0x2645b4['query'][_0x3fc0('0x3b')]);_0x1e4d99[_0x3fc0('0x3c')]=qs[_0x3fc0('0x34')](_[_0x3fc0('0x3d')](_0x2645b4[_0x3fc0('0x33')],_0x1a2261[_0x3fc0('0x34')]),_0xac736c);if(_0x2645b4[_0x3fc0('0x33')][_0x3fc0('0x3e')]){_0x1e4d99[_0x3fc0('0x3c')]=_[_0x3fc0('0x3f')](_0x1e4d99[_0x3fc0('0x3c')],{'$or':_['map'](_0xac736c,function(_0x6bbe04){if(_0x6bbe04[_0x3fc0('0x30')]!==_0x3fc0('0x40')){var _0x28b4d5={};_0x28b4d5[_0x6bbe04[_0x3fc0('0x2a')]]={'$like':'%'+_0x2645b4[_0x3fc0('0x33')]['filter']+'%'};return _0x28b4d5;}})});}_0x1e4d99=_['merge']({},_0x1e4d99,_0x2645b4[_0x3fc0('0x41')]);var _0x3386d2={'where':_0x1e4d99[_0x3fc0('0x3c')]};return db[_0x3fc0('0x2e')][_0x3fc0('0x1e')](_0x3386d2)['then'](function(_0x53b45e){_0x1960a4['count']=_0x53b45e;if(_0x2645b4[_0x3fc0('0x33')][_0x3fc0('0x42')]){_0x1e4d99[_0x3fc0('0x43')]=[{'all':!![]}];}return db['FaxQueueReport']['findAll'](_0x1e4d99);})[_0x3fc0('0x26')](function(_0x239dc5){_0x1960a4[_0x3fc0('0x44')]=_0x239dc5;return _0x1960a4;})[_0x3fc0('0x26')](respondWithFilteredResult(_0x559fcc,_0x1e4d99))['catch'](handleError(_0x559fcc,null));};exports['show']=function(_0x17510a,_0x2a45dc){var _0x547670={'raw':!![],'where':{'id':_0x17510a['params']['id']}},_0x32768f={};_0x32768f[_0x3fc0('0x32')]=_[_0x3fc0('0x45')](db[_0x3fc0('0x2e')][_0x3fc0('0x46')]);_0x32768f[_0x3fc0('0x33')]=_[_0x3fc0('0x45')](_0x17510a[_0x3fc0('0x33')]);_0x32768f[_0x3fc0('0x34')]=_['intersection'](_0x32768f[_0x3fc0('0x32')],_0x32768f['query']);_0x547670[_0x3fc0('0x35')]=_[_0x3fc0('0x36')](_0x32768f[_0x3fc0('0x32')],qs[_0x3fc0('0x37')](_0x17510a[_0x3fc0('0x33')]['fields']));_0x547670[_0x3fc0('0x35')]=_0x547670[_0x3fc0('0x35')][_0x3fc0('0x38')]?_0x547670[_0x3fc0('0x35')]:_0x32768f['model'];if(_0x17510a[_0x3fc0('0x33')]['includeAll']){_0x547670[_0x3fc0('0x43')]=[{'all':!![]}];}_0x547670=_[_0x3fc0('0x3f')]({},_0x547670,_0x17510a[_0x3fc0('0x41')]);return db[_0x3fc0('0x2e')][_0x3fc0('0x47')](_0x547670)['then'](handleEntityNotFound(_0x2a45dc,null))[_0x3fc0('0x26')](respondWithResult(_0x2a45dc,null))[_0x3fc0('0x48')](handleError(_0x2a45dc,null));};exports[_0x3fc0('0x49')]=function(_0x4c4aed,_0x3df404){return db[_0x3fc0('0x2e')]['create'](_0x4c4aed[_0x3fc0('0x4a')],{})[_0x3fc0('0x26')](respondWithResult(_0x3df404,0xc9))[_0x3fc0('0x48')](handleError(_0x3df404,null));};exports['update']=function(_0x5e5c73,_0x3a35ac){if(_0x5e5c73[_0x3fc0('0x4a')]['id']){delete _0x5e5c73[_0x3fc0('0x4a')]['id'];}return db['FaxQueueReport'][_0x3fc0('0x47')]({'where':{'id':_0x5e5c73['params']['id']}})[_0x3fc0('0x26')](handleEntityNotFound(_0x3a35ac,null))['then'](saveUpdates(_0x5e5c73['body'],null))['then'](respondWithResult(_0x3a35ac,null))[_0x3fc0('0x48')](handleError(_0x3a35ac,null));};exports[_0x3fc0('0x27')]=function(_0x141b4c,_0x3730f5){return db[_0x3fc0('0x2e')][_0x3fc0('0x47')]({'where':{'id':_0x141b4c['params']['id']}})[_0x3fc0('0x26')](handleEntityNotFound(_0x3730f5,null))[_0x3fc0('0x26')](removeEntity(_0x3730f5,null))['catch'](handleError(_0x3730f5,null));};exports['describe']=function(_0x74ae6a,_0x12f93a){return db[_0x3fc0('0x2e')][_0x3fc0('0x4b')]()[_0x3fc0('0x26')](respondWithResult(_0x12f93a,null))[_0x3fc0('0x48')](handleError(_0x12f93a,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 350ff1a..9f19454 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 _0x5fab=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport','report_fax_queue','uniqueid','lodash','util','api'];(function(_0x11c72b,_0x4fe3af){var _0xad9ef=function(_0xb9579b){while(--_0xb9579b){_0x11c72b['push'](_0x11c72b['shift']());}};_0xad9ef(++_0x4fe3af);}(_0x5fab,0x177));var _0xb5fa=function(_0x4a1e96,_0x143e6b){_0x4a1e96=_0x4a1e96-0x0;var _0x5acea9=_0x5fab[_0x4a1e96];return _0x5acea9;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var logger=require('../../config/logger')(_0xb5fa('0x2'));var moment=require(_0xb5fa('0x3'));var BPromise=require(_0xb5fa('0x4'));var rp=require(_0xb5fa('0x5'));var fs=require('fs');var path=require(_0xb5fa('0x6'));var rimraf=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var attributes=require(_0xb5fa('0x9'));module[_0xb5fa('0xa')]=function(_0x44df89,_0x4a0249){return _0x44df89['define'](_0xb5fa('0xb'),attributes,{'tableName':_0xb5fa('0xc'),'paranoid':![],'indexes':[{'name':_0xb5fa('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x1cb9=['api','moment','bluebird','path','rimraf','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','lodash','../../config/logger'];(function(_0x22f8ab,_0x15d8ff){var _0x2a70e5=function(_0x5e6895){while(--_0x5e6895){_0x22f8ab['push'](_0x22f8ab['shift']());}};_0x2a70e5(++_0x15d8ff);}(_0x1cb9,0x14e));var _0x91cb=function(_0x2fbde9,_0x77f73b){_0x2fbde9=_0x2fbde9-0x0;var _0x25d7db=_0x1cb9[_0x2fbde9];return _0x25d7db;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var logger=require(_0x91cb('0x1'))(_0x91cb('0x2'));var moment=require(_0x91cb('0x3'));var BPromise=require(_0x91cb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91cb('0x5'));var rimraf=require(_0x91cb('0x6'));var config=require('../../config/environment');var attributes=require(_0x91cb('0x7'));module[_0x91cb('0x8')]=function(_0x186dc3,_0x28543e){return _0x186dc3[_0x91cb('0x9')](_0x91cb('0xa'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0x91cb('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 63c15b8..51c11a4 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 _0x27b0=['UpdateFaxQueueReport','update','body','where','attributes','limit','util','ioredis','rpc','../../config/environment','jayson/promise','client','http','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','FaxQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','options','raw','then'];(function(_0x52a6b8,_0x5f3978){var _0x5d4ac3=function(_0x5c2ce6){while(--_0x5c2ce6){_0x52a6b8['push'](_0x52a6b8['shift']());}};_0x5d4ac3(++_0x5f3978);}(_0x27b0,0x18e));var _0x027b=function(_0x2653ac,_0x338212){_0x2653ac=_0x2653ac-0x0;var _0x14a4ba=_0x27b0[_0x2653ac];return _0x14a4ba;};'use strict';var _=require('lodash');var util=require(_0x027b('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x027b('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x027b('0x2'));var config=require(_0x027b('0x3'));var jayson=require(_0x027b('0x4'));var client=jayson[_0x027b('0x5')][_0x027b('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x5c4337,_0x356fee,_0x4ed082){return new BPromise(function(_0x540eb5,_0x3cc47d){return client['request'](_0x5c4337,_0x4ed082)['then'](function(_0x441f97){logger[_0x027b('0x7')](_0x027b('0x8'),_0x356fee,_0x027b('0x9'));logger['debug'](_0x027b('0xa'),_0x356fee,_0x027b('0x9'),JSON['stringify'](_0x441f97));if(_0x441f97[_0x027b('0xb')]){if(_0x441f97[_0x027b('0xb')][_0x027b('0xc')]===0x1f4){logger['error'](_0x027b('0x8'),_0x356fee,_0x441f97['error'][_0x027b('0xd')]);return _0x3cc47d(_0x441f97['error'][_0x027b('0xd')]);}logger['error'](_0x027b('0x8'),_0x356fee,_0x441f97[_0x027b('0xb')][_0x027b('0xd')]);return _0x540eb5(_0x441f97[_0x027b('0xb')][_0x027b('0xd')]);}else{logger[_0x027b('0x7')](_0x027b('0x8'),_0x356fee,_0x027b('0x9'));_0x540eb5(_0x441f97[_0x027b('0xe')][_0x027b('0xd')]);}})[_0x027b('0xf')](function(_0x5a9210){logger['error'](_0x027b('0x8'),_0x356fee,_0x5a9210);_0x3cc47d(_0x5a9210);});});}exports[_0x027b('0x10')]=function(_0x4ff893){var _0x4f6926=this;return new Promise(function(_0xd7636a,_0xcd2c27){return db[_0x027b('0x11')][_0x027b('0x12')](_0x4ff893['body'],{'raw':_0x4ff893['options']?_0x4ff893[_0x027b('0x13')][_0x027b('0x14')]===undefined?!![]:![]:!![]})[_0x027b('0x15')](function(_0x593a50){logger[_0x027b('0x7')](_0x027b('0x10'),_0x4ff893);logger['debug'](_0x027b('0x10'),_0x4ff893,JSON['stringify'](_0x593a50));_0xd7636a(_0x593a50);})[_0x027b('0xf')](function(_0x743399){logger[_0x027b('0xb')](_0x027b('0x10'),_0x743399[_0x027b('0xd')],_0x4ff893);_0xcd2c27(_0x4f6926[_0x027b('0xb')](0x1f4,_0x743399[_0x027b('0xd')]));});});};exports[_0x027b('0x16')]=function(_0x238753){var _0x4d79d0=this;return new Promise(function(_0x59fbb8,_0x2ba608){return db[_0x027b('0x11')][_0x027b('0x17')](_0x238753[_0x027b('0x18')],{'raw':_0x238753['options']?_0x238753['options'][_0x027b('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x238753['options']?_0x238753[_0x027b('0x13')][_0x027b('0x19')]||null:null,'attributes':_0x238753['options']?_0x238753[_0x027b('0x13')][_0x027b('0x1a')]||null:null,'limit':_0x238753[_0x027b('0x13')]?_0x238753['options'][_0x027b('0x1b')]||null:null})[_0x027b('0x15')](function(_0x374d47){logger[_0x027b('0x7')](_0x027b('0x16'),_0x238753);logger['debug'](_0x027b('0x16'),_0x238753,JSON['stringify'](_0x374d47));_0x59fbb8(_0x374d47);})['catch'](function(_0x5814b1){logger['error']('UpdateFaxQueueReport',_0x5814b1[_0x027b('0xd')],_0x238753);_0x2ba608(_0x4d79d0[_0x027b('0xb')](0x1f4,_0x5814b1[_0x027b('0xd')]));});});}; \ No newline at end of file +var _0x3bb3=['update','where','attributes','limit','UpdateFaxQueueReport','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','request\x20sent','stringify','error','FaxQueueReport,\x20%s,\x20%s','message','result','CreateFaxQueueReport','FaxQueueReport','create','body','options','catch'];(function(_0x407238,_0x4074ce){var _0x10924a=function(_0x43d758){while(--_0x43d758){_0x407238['push'](_0x407238['shift']());}};_0x10924a(++_0x4074ce);}(_0x3bb3,0x1d3));var _0x33bb=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x3bb3[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x33bb('0x0'));var util=require(_0x33bb('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x33bb('0x2'));var fs=require('fs');var Redis=require(_0x33bb('0x3'));var db=require(_0x33bb('0x4'))['db'];var utils=require(_0x33bb('0x5'));var logger=require(_0x33bb('0x6'))(_0x33bb('0x7'));var config=require(_0x33bb('0x8'));var jayson=require(_0x33bb('0x9'));var client=jayson[_0x33bb('0xa')][_0x33bb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x694858,_0x9185b6,_0x1a2e68){return new BPromise(function(_0x579a0f,_0x43dcb9){return client[_0x33bb('0xc')](_0x694858,_0x1a2e68)[_0x33bb('0xd')](function(_0x1deb23){logger[_0x33bb('0xe')]('FaxQueueReport,\x20%s,\x20%s',_0x9185b6,'request\x20sent');logger[_0x33bb('0xf')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x9185b6,_0x33bb('0x10'),JSON[_0x33bb('0x11')](_0x1deb23));if(_0x1deb23[_0x33bb('0x12')]){if(_0x1deb23[_0x33bb('0x12')]['code']===0x1f4){logger[_0x33bb('0x12')](_0x33bb('0x13'),_0x9185b6,_0x1deb23['error'][_0x33bb('0x14')]);return _0x43dcb9(_0x1deb23['error'][_0x33bb('0x14')]);}logger['error'](_0x33bb('0x13'),_0x9185b6,_0x1deb23['error'][_0x33bb('0x14')]);return _0x579a0f(_0x1deb23[_0x33bb('0x12')][_0x33bb('0x14')]);}else{logger[_0x33bb('0xe')]('FaxQueueReport,\x20%s,\x20%s',_0x9185b6,_0x33bb('0x10'));_0x579a0f(_0x1deb23[_0x33bb('0x15')]['message']);}})['catch'](function(_0x58ae50){logger[_0x33bb('0x12')]('FaxQueueReport,\x20%s,\x20%s',_0x9185b6,_0x58ae50);_0x43dcb9(_0x58ae50);});});}exports[_0x33bb('0x16')]=function(_0x581afd){var _0x3ca289=this;return new Promise(function(_0x87002a,_0xc7e5f0){return db[_0x33bb('0x17')][_0x33bb('0x18')](_0x581afd[_0x33bb('0x19')],{'raw':_0x581afd[_0x33bb('0x1a')]?_0x581afd[_0x33bb('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x33bb('0xd')](function(_0x56fd52){logger[_0x33bb('0xe')](_0x33bb('0x16'),_0x581afd);logger[_0x33bb('0xf')](_0x33bb('0x16'),_0x581afd,JSON[_0x33bb('0x11')](_0x56fd52));_0x87002a(_0x56fd52);})[_0x33bb('0x1b')](function(_0x34473f){logger[_0x33bb('0x12')](_0x33bb('0x16'),_0x34473f[_0x33bb('0x14')],_0x581afd);_0xc7e5f0(_0x3ca289[_0x33bb('0x12')](0x1f4,_0x34473f[_0x33bb('0x14')]));});});};exports['UpdateFaxQueueReport']=function(_0x4daed5){var _0x39dcf9=this;return new Promise(function(_0x4e0d83,_0x2aa2eb){return db[_0x33bb('0x17')][_0x33bb('0x1c')](_0x4daed5['body'],{'raw':_0x4daed5[_0x33bb('0x1a')]?_0x4daed5['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4daed5[_0x33bb('0x1a')]?_0x4daed5['options'][_0x33bb('0x1d')]||null:null,'attributes':_0x4daed5[_0x33bb('0x1a')]?_0x4daed5[_0x33bb('0x1a')][_0x33bb('0x1e')]||null:null,'limit':_0x4daed5['options']?_0x4daed5[_0x33bb('0x1a')][_0x33bb('0x1f')]||null:null})[_0x33bb('0xd')](function(_0x24243f){logger['info'](_0x33bb('0x20'),_0x4daed5);logger[_0x33bb('0xf')](_0x33bb('0x20'),_0x4daed5,JSON[_0x33bb('0x11')](_0x24243f));_0x4e0d83(_0x24243f);})[_0x33bb('0x1b')](function(_0x32b982){logger[_0x33bb('0x12')](_0x33bb('0x20'),_0x32b982['message'],_0x4daed5);_0x2aa2eb(_0x39dcf9[_0x33bb('0x12')](0x1f4,_0x32b982[_0x33bb('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index a9ec2f3..4840747 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 _0x7fd1=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','index','/describe','isAuthenticated','/:id','show','post','put','delete','multer','util','path'];(function(_0x3fe393,_0x234a3a){var _0x534d14=function(_0x277fab){while(--_0x277fab){_0x3fe393['push'](_0x3fe393['shift']());}};_0x534d14(++_0x234a3a);}(_0x7fd1,0x18c));var _0x17fd=function(_0x425fda,_0x454d6d){_0x425fda=_0x425fda-0x0;var _0x4b50d4=_0x7fd1[_0x425fda];return _0x4b50d4;};'use strict';var multer=require(_0x17fd('0x0'));var util=require(_0x17fd('0x1'));var path=require(_0x17fd('0x2'));var timeout=require(_0x17fd('0x3'));var express=require(_0x17fd('0x4'));var router=express['Router']();var fs_extra=require(_0x17fd('0x5'));var auth=require(_0x17fd('0x6'));var interaction=require(_0x17fd('0x7'));var config=require(_0x17fd('0x8'));var controller=require(_0x17fd('0x9'));router[_0x17fd('0xa')]('/',auth['isAuthenticated'](),controller[_0x17fd('0xb')]);router['get'](_0x17fd('0xc'),auth[_0x17fd('0xd')](),controller['describe']);router[_0x17fd('0xa')](_0x17fd('0xe'),auth[_0x17fd('0xd')](),controller[_0x17fd('0xf')]);router[_0x17fd('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x17fd('0x11')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x17fd('0x12')](_0x17fd('0xe'),auth[_0x17fd('0xd')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x393c=['/:id','show','post','create','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe'];(function(_0xf858e,_0x51b0f1){var _0x5344d8=function(_0x5219d6){while(--_0x5219d6){_0xf858e['push'](_0xf858e['shift']());}};_0x5344d8(++_0x51b0f1);}(_0x393c,0x92));var _0xc393=function(_0x35ca61,_0x470a82){_0x35ca61=_0x35ca61-0x0;var _0x492487=_0x393c[_0x35ca61];return _0x492487;};'use strict';var multer=require(_0xc393('0x0'));var util=require(_0xc393('0x1'));var path=require(_0xc393('0x2'));var timeout=require(_0xc393('0x3'));var express=require(_0xc393('0x4'));var router=express['Router']();var fs_extra=require(_0xc393('0x5'));var auth=require(_0xc393('0x6'));var interaction=require(_0xc393('0x7'));var config=require(_0xc393('0x8'));var controller=require('./faxQueueReport.controller');router[_0xc393('0x9')]('/',auth[_0xc393('0xa')](),controller[_0xc393('0xb')]);router[_0xc393('0x9')](_0xc393('0xc'),auth[_0xc393('0xa')](),controller[_0xc393('0xd')]);router[_0xc393('0x9')](_0xc393('0xe'),auth['isAuthenticated'](),controller[_0xc393('0xf')]);router[_0xc393('0x10')]('/',auth[_0xc393('0xa')](),controller[_0xc393('0x11')]);router['put'](_0xc393('0xe'),auth['isAuthenticated'](),controller['update']);router[_0xc393('0x12')](_0xc393('0xe'),auth['isAuthenticated'](),controller[_0xc393('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 83c00b6..111b03f 100644 --- a/server/api/faxTransferReport/faxTransferReport.attributes.js +++ b/server/api/faxTransferReport/faxTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x5f3de3,_0x40f0f5){var _0x287e0d=function(_0x3189dc){while(--_0x3189dc){_0x5f3de3['push'](_0x5f3de3['shift']());}};_0x287e0d(++_0x40f0f5);}(_0xb43b,0x1b2));var _0xbb43=function(_0x5e499b,_0x587329){_0x5e499b=_0x5e499b-0x0;var _0x1b05bc=_0xb43b[_0x5e499b];return _0x1b05bc;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file +var _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x37e59e,_0x37573d){var _0x328ec4=function(_0x2fac83){while(--_0x2fac83){_0x37e59e['push'](_0x37e59e['shift']());}};_0x328ec4(++_0x37573d);}(_0x70e0,0x17b));var _0x070e=function(_0x58ebf2,_0x82034){_0x58ebf2=_0x58ebf2-0x0;var _0x3022e6=_0x70e0[_0x58ebf2];return _0x3022e6;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index a8d0008..ffd63cf 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 _0xd6f7=['params','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','apply','reject','save','then','destroy','end','error','name','index','map','FaxTransferReport','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','findAll','rows','catch','show','rawAttributes','includeAll','find','create','body'];(function(_0x16667f,_0x53d251){var _0x411a5c=function(_0x328d19){while(--_0x328d19){_0x16667f['push'](_0x16667f['shift']());}};_0x411a5c(++_0x53d251);}(_0xd6f7,0x174));var _0x7d6f=function(_0x272d90,_0x5e70ff){_0x272d90=_0x272d90-0x0;var _0x2bf4a2=_0xd6f7[_0x272d90];return _0x2bf4a2;};'use strict';var emlformat=require(_0x7d6f('0x0'));var rimraf=require(_0x7d6f('0x1'));var zipdir=require(_0x7d6f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7d6f('0x3'));var moment=require(_0x7d6f('0x4'));var BPromise=require(_0x7d6f('0x5'));var Mustache=require('mustache');var util=require(_0x7d6f('0x6'));var path=require(_0x7d6f('0x7'));var sox=require('sox');var csv=require(_0x7d6f('0x8'));var ejs=require(_0x7d6f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7d6f('0xa'));var squel=require(_0x7d6f('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7d6f('0xc'));var toCsv=require(_0x7d6f('0x8'));var querystring=require(_0x7d6f('0xd'));var Papa=require(_0x7d6f('0xe'));var Redis=require(_0x7d6f('0xf'));var authService=require(_0x7d6f('0x10'));var qs=require(_0x7d6f('0x11'));var as=require(_0x7d6f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7d6f('0x13'))(_0x7d6f('0x14'));var utils=require(_0x7d6f('0x15'));var config=require(_0x7d6f('0x16'));var licenseUtil=require(_0x7d6f('0x17'));var db=require(_0x7d6f('0x18'))['db'];function respondWithStatusCode(_0x5009ed,_0x2817c4){_0x2817c4=_0x2817c4||0xcc;return function(_0x1a839f){if(_0x1a839f){return _0x5009ed[_0x7d6f('0x19')](_0x2817c4);}return _0x5009ed[_0x7d6f('0x1a')](_0x2817c4)['end']();};}function respondWithResult(_0x50abb2,_0x20aed7){_0x20aed7=_0x20aed7||0xc8;return function(_0x559c59){if(_0x559c59){return _0x50abb2[_0x7d6f('0x1a')](_0x20aed7)[_0x7d6f('0x1b')](_0x559c59);}};}function respondWithFilteredResult(_0x11b6f7,_0x1305ef){return function(_0x30c600){if(_0x30c600){var _0x2b50b3=typeof _0x1305ef[_0x7d6f('0x1c')]===_0x7d6f('0x1d')&&typeof _0x1305ef[_0x7d6f('0x1e')]===_0x7d6f('0x1d');var _0x55334c=_0x30c600[_0x7d6f('0x1f')];var _0x193024=_0x2b50b3?0x0:_0x1305ef[_0x7d6f('0x1c')];var _0x68d98c=_0x2b50b3?_0x30c600[_0x7d6f('0x1f')]:_0x1305ef[_0x7d6f('0x1c')]+_0x1305ef[_0x7d6f('0x1e')];var _0x704d5e;if(_0x68d98c>=_0x55334c){_0x68d98c=_0x55334c;_0x704d5e=0xc8;}else{_0x704d5e=0xce;}_0x11b6f7[_0x7d6f('0x1a')](_0x704d5e);return _0x11b6f7['set']('Content-Range',_0x193024+'-'+_0x68d98c+'/'+_0x55334c)[_0x7d6f('0x1b')](_0x30c600);}return null;};}function patchUpdates(_0xf3f52a){return function(_0x26158b){try{jsonpatch[_0x7d6f('0x20')](_0x26158b,_0xf3f52a,!![]);}catch(_0x5a8462){return BPromise[_0x7d6f('0x21')](_0x5a8462);}return _0x26158b[_0x7d6f('0x22')]();};}function saveUpdates(_0x57d625,_0x227413){return function(_0xc12ee4){if(_0xc12ee4){return _0xc12ee4['update'](_0x57d625)[_0x7d6f('0x23')](function(_0x43553e){return _0x43553e;});}return null;};}function removeEntity(_0x56a1bc,_0xd59f7b){return function(_0x13be40){if(_0x13be40){return _0x13be40[_0x7d6f('0x24')]()[_0x7d6f('0x23')](function(){_0x56a1bc['status'](0xcc)[_0x7d6f('0x25')]();});}};}function handleEntityNotFound(_0x32e545,_0xac248c){return function(_0x49051c){if(!_0x49051c){_0x32e545[_0x7d6f('0x19')](0x194);}return _0x49051c;};}function handleError(_0x10743d,_0x5c83bd){_0x5c83bd=_0x5c83bd||0x1f4;return function(_0x2fb9cc){logger[_0x7d6f('0x26')](_0x2fb9cc['stack']);if(_0x2fb9cc[_0x7d6f('0x27')]){delete _0x2fb9cc[_0x7d6f('0x27')];}_0x10743d['status'](_0x5c83bd)['send'](_0x2fb9cc);};}exports[_0x7d6f('0x28')]=function(_0x1b6a63,_0x3ecd13){var _0x4859b8={},_0x4d0c99={},_0x114d86={'count':0x0,'rows':[]};var _0x55a6e5=_[_0x7d6f('0x29')](db[_0x7d6f('0x2a')]['rawAttributes'],function(_0xe21ec0){return{'name':_0xe21ec0['fieldName'],'type':_0xe21ec0[_0x7d6f('0x2b')][_0x7d6f('0x2c')]};});_0x4d0c99[_0x7d6f('0x2d')]=_['map'](_0x55a6e5,'name');_0x4d0c99[_0x7d6f('0x2e')]=_[_0x7d6f('0x2f')](_0x1b6a63['query']);_0x4d0c99[_0x7d6f('0x30')]=_['intersection'](_0x4d0c99[_0x7d6f('0x2d')],_0x4d0c99[_0x7d6f('0x2e')]);_0x4859b8[_0x7d6f('0x31')]=_[_0x7d6f('0x32')](_0x4d0c99[_0x7d6f('0x2d')],qs['fields'](_0x1b6a63[_0x7d6f('0x2e')][_0x7d6f('0x33')]));_0x4859b8[_0x7d6f('0x31')]=_0x4859b8[_0x7d6f('0x31')][_0x7d6f('0x34')]?_0x4859b8['attributes']:_0x4d0c99[_0x7d6f('0x2d')];if(!_0x1b6a63['query'][_0x7d6f('0x35')](_0x7d6f('0x36'))){_0x4859b8[_0x7d6f('0x1e')]=qs[_0x7d6f('0x1e')](_0x1b6a63[_0x7d6f('0x2e')][_0x7d6f('0x1e')]);_0x4859b8[_0x7d6f('0x1c')]=qs[_0x7d6f('0x1c')](_0x1b6a63[_0x7d6f('0x2e')][_0x7d6f('0x1c')]);}_0x4859b8[_0x7d6f('0x37')]=qs[_0x7d6f('0x38')](_0x1b6a63[_0x7d6f('0x2e')][_0x7d6f('0x38')]);_0x4859b8[_0x7d6f('0x39')]=qs[_0x7d6f('0x30')](_[_0x7d6f('0x3a')](_0x1b6a63['query'],_0x4d0c99[_0x7d6f('0x30')]),_0x55a6e5);if(_0x1b6a63[_0x7d6f('0x2e')][_0x7d6f('0x3b')]){_0x4859b8[_0x7d6f('0x39')]=_['merge'](_0x4859b8['where'],{'$or':_[_0x7d6f('0x29')](_0x55a6e5,function(_0x529cb3){if(_0x529cb3[_0x7d6f('0x2b')]!==_0x7d6f('0x3c')){var _0xd93b16={};_0xd93b16[_0x529cb3[_0x7d6f('0x27')]]={'$like':'%'+_0x1b6a63['query']['filter']+'%'};return _0xd93b16;}})});}_0x4859b8=_[_0x7d6f('0x3d')]({},_0x4859b8,_0x1b6a63[_0x7d6f('0x3e')]);var _0x1b0ebb={'where':_0x4859b8[_0x7d6f('0x39')]};return db['FaxTransferReport'][_0x7d6f('0x1f')](_0x1b0ebb)['then'](function(_0xfc73d6){_0x114d86[_0x7d6f('0x1f')]=_0xfc73d6;if(_0x1b6a63[_0x7d6f('0x2e')]['includeAll']){_0x4859b8['include']=[{'all':!![]}];}return db['FaxTransferReport'][_0x7d6f('0x3f')](_0x4859b8);})[_0x7d6f('0x23')](function(_0x5f5760){_0x114d86[_0x7d6f('0x40')]=_0x5f5760;return _0x114d86;})[_0x7d6f('0x23')](respondWithFilteredResult(_0x3ecd13,_0x4859b8))[_0x7d6f('0x41')](handleError(_0x3ecd13,null));};exports[_0x7d6f('0x42')]=function(_0x3a7184,_0x534dac){var _0x36f0d8={'raw':!![],'where':{'id':_0x3a7184['params']['id']}},_0x18914f={};_0x18914f[_0x7d6f('0x2d')]=_[_0x7d6f('0x2f')](db[_0x7d6f('0x2a')][_0x7d6f('0x43')]);_0x18914f[_0x7d6f('0x2e')]=_[_0x7d6f('0x2f')](_0x3a7184['query']);_0x18914f[_0x7d6f('0x30')]=_[_0x7d6f('0x32')](_0x18914f[_0x7d6f('0x2d')],_0x18914f[_0x7d6f('0x2e')]);_0x36f0d8[_0x7d6f('0x31')]=_[_0x7d6f('0x32')](_0x18914f[_0x7d6f('0x2d')],qs[_0x7d6f('0x33')](_0x3a7184[_0x7d6f('0x2e')][_0x7d6f('0x33')]));_0x36f0d8[_0x7d6f('0x31')]=_0x36f0d8['attributes'][_0x7d6f('0x34')]?_0x36f0d8[_0x7d6f('0x31')]:_0x18914f['model'];if(_0x3a7184['query'][_0x7d6f('0x44')]){_0x36f0d8['include']=[{'all':!![]}];}_0x36f0d8=_[_0x7d6f('0x3d')]({},_0x36f0d8,_0x3a7184[_0x7d6f('0x3e')]);return db[_0x7d6f('0x2a')][_0x7d6f('0x45')](_0x36f0d8)[_0x7d6f('0x23')](handleEntityNotFound(_0x534dac,null))[_0x7d6f('0x23')](respondWithResult(_0x534dac,null))[_0x7d6f('0x41')](handleError(_0x534dac,null));};exports[_0x7d6f('0x46')]=function(_0x1b5412,_0x32940f){return db[_0x7d6f('0x2a')]['create'](_0x1b5412[_0x7d6f('0x47')],{})[_0x7d6f('0x23')](respondWithResult(_0x32940f,0xc9))['catch'](handleError(_0x32940f,null));};exports['update']=function(_0x1d4dc3,_0x63ef44){if(_0x1d4dc3[_0x7d6f('0x47')]['id']){delete _0x1d4dc3['body']['id'];}return db[_0x7d6f('0x2a')]['find']({'where':{'id':_0x1d4dc3[_0x7d6f('0x48')]['id']}})[_0x7d6f('0x23')](handleEntityNotFound(_0x63ef44,null))[_0x7d6f('0x23')](saveUpdates(_0x1d4dc3[_0x7d6f('0x47')],null))[_0x7d6f('0x23')](respondWithResult(_0x63ef44,null))['catch'](handleError(_0x63ef44,null));};exports[_0x7d6f('0x24')]=function(_0x5b2741,_0x2773fd){return db[_0x7d6f('0x2a')][_0x7d6f('0x45')]({'where':{'id':_0x5b2741[_0x7d6f('0x48')]['id']}})[_0x7d6f('0x23')](handleEntityNotFound(_0x2773fd,null))[_0x7d6f('0x23')](removeEntity(_0x2773fd,null))['catch'](handleError(_0x2773fd,null));};exports[_0x7d6f('0x49')]=function(_0xd853d2,_0x126883){return db['FaxTransferReport']['describe']()[_0x7d6f('0x23')](respondWithResult(_0x126883,null))[_0x7d6f('0x41')](handleError(_0x126883,null));}; \ No newline at end of file +var _0x2e66=['api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','update','then','destroy','error','stack','name','send','index','map','FaxTransferReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','VIRTUAL','filter','merge','options','includeAll','findAll','catch','show','params','include','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x4be116,_0x44e2df){var _0x216c01=function(_0x428012){while(--_0x428012){_0x4be116['push'](_0x4be116['shift']());}};_0x216c01(++_0x44e2df);}(_0x2e66,0x1b3));var _0x62e6=function(_0x692a8f,_0x4938bc){_0x692a8f=_0x692a8f-0x0;var _0x1362c1=_0x2e66[_0x692a8f];return _0x1362c1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x62e6('0x0'));var zipdir=require(_0x62e6('0x1'));var jsonpatch=require(_0x62e6('0x2'));var rp=require(_0x62e6('0x3'));var moment=require(_0x62e6('0x4'));var BPromise=require(_0x62e6('0x5'));var Mustache=require('mustache');var util=require(_0x62e6('0x6'));var path=require(_0x62e6('0x7'));var sox=require(_0x62e6('0x8'));var csv=require('to-csv');var ejs=require(_0x62e6('0x9'));var fs=require('fs');var fs_extra=require(_0x62e6('0xa'));var _=require(_0x62e6('0xb'));var squel=require(_0x62e6('0xc'));var crypto=require(_0x62e6('0xd'));var jsforce=require(_0x62e6('0xe'));var deskjs=require(_0x62e6('0xf'));var toCsv=require(_0x62e6('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x62e6('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x62e6('0x12'));var as=require(_0x62e6('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x62e6('0x14'))(_0x62e6('0x15'));var utils=require(_0x62e6('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x62e6('0x17'));var db=require(_0x62e6('0x18'))['db'];function respondWithStatusCode(_0x40a815,_0x5a4e25){_0x5a4e25=_0x5a4e25||0xcc;return function(_0x1f76d9){if(_0x1f76d9){return _0x40a815[_0x62e6('0x19')](_0x5a4e25);}return _0x40a815[_0x62e6('0x1a')](_0x5a4e25)[_0x62e6('0x1b')]();};}function respondWithResult(_0x284c26,_0x26317e){_0x26317e=_0x26317e||0xc8;return function(_0x5250cd){if(_0x5250cd){return _0x284c26['status'](_0x26317e)[_0x62e6('0x1c')](_0x5250cd);}};}function respondWithFilteredResult(_0x4dd578,_0x39ec65){return function(_0x21fcd2){if(_0x21fcd2){var _0x1bebde=typeof _0x39ec65[_0x62e6('0x1d')]===_0x62e6('0x1e')&&typeof _0x39ec65[_0x62e6('0x1f')]===_0x62e6('0x1e');var _0x53c7ac=_0x21fcd2[_0x62e6('0x20')];var _0x10aa48=_0x1bebde?0x0:_0x39ec65['offset'];var _0x1e409e=_0x1bebde?_0x21fcd2['count']:_0x39ec65[_0x62e6('0x1d')]+_0x39ec65[_0x62e6('0x1f')];var _0x2eaec2;if(_0x1e409e>=_0x53c7ac){_0x1e409e=_0x53c7ac;_0x2eaec2=0xc8;}else{_0x2eaec2=0xce;}_0x4dd578[_0x62e6('0x1a')](_0x2eaec2);return _0x4dd578['set'](_0x62e6('0x21'),_0x10aa48+'-'+_0x1e409e+'/'+_0x53c7ac)['json'](_0x21fcd2);}return null;};}function patchUpdates(_0x10473e){return function(_0x1cd556){try{jsonpatch['apply'](_0x1cd556,_0x10473e,!![]);}catch(_0x286333){return BPromise[_0x62e6('0x22')](_0x286333);}return _0x1cd556['save']();};}function saveUpdates(_0x1011ba,_0x3c933b){return function(_0x5d0f9b){if(_0x5d0f9b){return _0x5d0f9b[_0x62e6('0x23')](_0x1011ba)[_0x62e6('0x24')](function(_0x5dfc1a){return _0x5dfc1a;});}return null;};}function removeEntity(_0x4cfdfb,_0x4c5541){return function(_0xd0ceb0){if(_0xd0ceb0){return _0xd0ceb0[_0x62e6('0x25')]()[_0x62e6('0x24')](function(){_0x4cfdfb[_0x62e6('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59c491,_0x1d5432){return function(_0x187335){if(!_0x187335){_0x59c491[_0x62e6('0x19')](0x194);}return _0x187335;};}function handleError(_0x53f948,_0x3a9759){_0x3a9759=_0x3a9759||0x1f4;return function(_0x411281){logger[_0x62e6('0x26')](_0x411281[_0x62e6('0x27')]);if(_0x411281[_0x62e6('0x28')]){delete _0x411281[_0x62e6('0x28')];}_0x53f948[_0x62e6('0x1a')](_0x3a9759)[_0x62e6('0x29')](_0x411281);};}exports[_0x62e6('0x2a')]=function(_0x3603dc,_0x1f6a6a){var _0x10320f={},_0x196da9={},_0x5ac996={'count':0x0,'rows':[]};var _0x371931=_[_0x62e6('0x2b')](db[_0x62e6('0x2c')][_0x62e6('0x2d')],function(_0x70d5a){return{'name':_0x70d5a[_0x62e6('0x2e')],'type':_0x70d5a[_0x62e6('0x2f')][_0x62e6('0x30')]};});_0x196da9[_0x62e6('0x31')]=_[_0x62e6('0x2b')](_0x371931,_0x62e6('0x28'));_0x196da9['query']=_[_0x62e6('0x32')](_0x3603dc[_0x62e6('0x33')]);_0x196da9[_0x62e6('0x34')]=_[_0x62e6('0x35')](_0x196da9[_0x62e6('0x31')],_0x196da9[_0x62e6('0x33')]);_0x10320f['attributes']=_[_0x62e6('0x35')](_0x196da9[_0x62e6('0x31')],qs[_0x62e6('0x36')](_0x3603dc[_0x62e6('0x33')][_0x62e6('0x36')]));_0x10320f['attributes']=_0x10320f[_0x62e6('0x37')][_0x62e6('0x38')]?_0x10320f[_0x62e6('0x37')]:_0x196da9[_0x62e6('0x31')];if(!_0x3603dc[_0x62e6('0x33')][_0x62e6('0x39')](_0x62e6('0x3a'))){_0x10320f['limit']=qs[_0x62e6('0x1f')](_0x3603dc[_0x62e6('0x33')][_0x62e6('0x1f')]);_0x10320f[_0x62e6('0x1d')]=qs[_0x62e6('0x1d')](_0x3603dc[_0x62e6('0x33')][_0x62e6('0x1d')]);}_0x10320f[_0x62e6('0x3b')]=qs['sort'](_0x3603dc[_0x62e6('0x33')]['sort']);_0x10320f[_0x62e6('0x3c')]=qs[_0x62e6('0x34')](_[_0x62e6('0x3d')](_0x3603dc[_0x62e6('0x33')],_0x196da9[_0x62e6('0x34')]),_0x371931);if(_0x3603dc['query']['filter']){_0x10320f[_0x62e6('0x3c')]=_['merge'](_0x10320f[_0x62e6('0x3c')],{'$or':_[_0x62e6('0x2b')](_0x371931,function(_0x57d97f){if(_0x57d97f[_0x62e6('0x2f')]!==_0x62e6('0x3e')){var _0x51f35f={};_0x51f35f[_0x57d97f[_0x62e6('0x28')]]={'$like':'%'+_0x3603dc['query'][_0x62e6('0x3f')]+'%'};return _0x51f35f;}})});}_0x10320f=_[_0x62e6('0x40')]({},_0x10320f,_0x3603dc[_0x62e6('0x41')]);var _0x11a515={'where':_0x10320f[_0x62e6('0x3c')]};return db[_0x62e6('0x2c')][_0x62e6('0x20')](_0x11a515)[_0x62e6('0x24')](function(_0x2f08ae){_0x5ac996[_0x62e6('0x20')]=_0x2f08ae;if(_0x3603dc[_0x62e6('0x33')][_0x62e6('0x42')]){_0x10320f['include']=[{'all':!![]}];}return db[_0x62e6('0x2c')][_0x62e6('0x43')](_0x10320f);})['then'](function(_0x67c012){_0x5ac996['rows']=_0x67c012;return _0x5ac996;})[_0x62e6('0x24')](respondWithFilteredResult(_0x1f6a6a,_0x10320f))[_0x62e6('0x44')](handleError(_0x1f6a6a,null));};exports[_0x62e6('0x45')]=function(_0x48eb55,_0x389787){var _0x28ab23={'raw':!![],'where':{'id':_0x48eb55[_0x62e6('0x46')]['id']}},_0x2d0a4c={};_0x2d0a4c[_0x62e6('0x31')]=_['keys'](db[_0x62e6('0x2c')][_0x62e6('0x2d')]);_0x2d0a4c[_0x62e6('0x33')]=_[_0x62e6('0x32')](_0x48eb55[_0x62e6('0x33')]);_0x2d0a4c[_0x62e6('0x34')]=_[_0x62e6('0x35')](_0x2d0a4c['model'],_0x2d0a4c[_0x62e6('0x33')]);_0x28ab23['attributes']=_['intersection'](_0x2d0a4c[_0x62e6('0x31')],qs['fields'](_0x48eb55[_0x62e6('0x33')][_0x62e6('0x36')]));_0x28ab23[_0x62e6('0x37')]=_0x28ab23[_0x62e6('0x37')][_0x62e6('0x38')]?_0x28ab23[_0x62e6('0x37')]:_0x2d0a4c[_0x62e6('0x31')];if(_0x48eb55[_0x62e6('0x33')]['includeAll']){_0x28ab23[_0x62e6('0x47')]=[{'all':!![]}];}_0x28ab23=_[_0x62e6('0x40')]({},_0x28ab23,_0x48eb55[_0x62e6('0x41')]);return db[_0x62e6('0x2c')][_0x62e6('0x48')](_0x28ab23)[_0x62e6('0x24')](handleEntityNotFound(_0x389787,null))[_0x62e6('0x24')](respondWithResult(_0x389787,null))[_0x62e6('0x44')](handleError(_0x389787,null));};exports[_0x62e6('0x49')]=function(_0x4d14bc,_0x4b216a){return db[_0x62e6('0x2c')][_0x62e6('0x49')](_0x4d14bc[_0x62e6('0x4a')],{})['then'](respondWithResult(_0x4b216a,0xc9))['catch'](handleError(_0x4b216a,null));};exports[_0x62e6('0x23')]=function(_0x141417,_0x290ca8){if(_0x141417[_0x62e6('0x4a')]['id']){delete _0x141417[_0x62e6('0x4a')]['id'];}return db[_0x62e6('0x2c')][_0x62e6('0x48')]({'where':{'id':_0x141417[_0x62e6('0x46')]['id']}})[_0x62e6('0x24')](handleEntityNotFound(_0x290ca8,null))[_0x62e6('0x24')](saveUpdates(_0x141417[_0x62e6('0x4a')],null))[_0x62e6('0x24')](respondWithResult(_0x290ca8,null))['catch'](handleError(_0x290ca8,null));};exports[_0x62e6('0x25')]=function(_0x344d8e,_0x45964c){return db[_0x62e6('0x2c')][_0x62e6('0x48')]({'where':{'id':_0x344d8e[_0x62e6('0x46')]['id']}})[_0x62e6('0x24')](handleEntityNotFound(_0x45964c,null))[_0x62e6('0x24')](removeEntity(_0x45964c,null))['catch'](handleError(_0x45964c,null));};exports[_0x62e6('0x4b')]=function(_0x5be15d,_0x5e07d1){return db[_0x62e6('0x2c')]['describe']()[_0x62e6('0x24')](respondWithResult(_0x5e07d1,null))[_0x62e6('0x44')](handleError(_0x5e07d1,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index d6a1903..601bb5c 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 _0x04e7=['rimraf','../../config/environment','exports','define','report_fax_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4e8b98,_0x13eda9){var _0x319712=function(_0x80da19){while(--_0x80da19){_0x4e8b98['push'](_0x4e8b98['shift']());}};_0x319712(++_0x13eda9);}(_0x04e7,0x6e));var _0x704e=function(_0x5af97c,_0x24a49f){_0x5af97c=_0x5af97c-0x0;var _0x3472ae=_0x04e7[_0x5af97c];return _0x3472ae;};'use strict';var _=require(_0x704e('0x0'));var util=require(_0x704e('0x1'));var logger=require(_0x704e('0x2'))(_0x704e('0x3'));var moment=require(_0x704e('0x4'));var BPromise=require(_0x704e('0x5'));var rp=require(_0x704e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x704e('0x7'));var config=require(_0x704e('0x8'));var attributes=require('./faxTransferReport.attributes');module[_0x704e('0x9')]=function(_0x471eff,_0x460b6e){return _0x471eff[_0x704e('0xa')]('FaxTransferReport',attributes,{'tableName':_0x704e('0xb'),'paranoid':![],'indexes':[{'name':_0x704e('0xc'),'fields':[_0x704e('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb515=['../../config/environment','exports','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x12fe32,_0x1d5358){var _0x1701f5=function(_0x236080){while(--_0x236080){_0x12fe32['push'](_0x12fe32['shift']());}};_0x1701f5(++_0x1d5358);}(_0xb515,0x1b8));var _0x5b51=function(_0x5471ec,_0x1ce81a){_0x5471ec=_0x5471ec-0x0;var _0x121d4c=_0xb515[_0x5471ec];return _0x121d4c;};'use strict';var _=require(_0x5b51('0x0'));var util=require('util');var logger=require(_0x5b51('0x1'))(_0x5b51('0x2'));var moment=require(_0x5b51('0x3'));var BPromise=require(_0x5b51('0x4'));var rp=require(_0x5b51('0x5'));var fs=require('fs');var path=require(_0x5b51('0x6'));var rimraf=require(_0x5b51('0x7'));var config=require(_0x5b51('0x8'));var attributes=require('./faxTransferReport.attributes');module[_0x5b51('0x9')]=function(_0xf9e3ac,_0x3ef482){return _0xf9e3ac[_0x5b51('0xa')](_0x5b51('0xb'),attributes,{'tableName':_0x5b51('0xc'),'paranoid':![],'indexes':[{'name':_0x5b51('0xd'),'fields':[_0x5b51('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index dc464e4..d37914d 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 _0xeb1d=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x174237,_0x34dec3){var _0x22cd8d=function(_0x472999){while(--_0x472999){_0x174237['push'](_0x174237['shift']());}};_0x22cd8d(++_0x34dec3);}(_0xeb1d,0x96));var _0xdeb1=function(_0x350681,_0x4f86f4){_0x350681=_0x350681-0x0;var _0x34ac0e=_0xeb1d[_0x350681];return _0x34ac0e;};'use strict';var _=require(_0xdeb1('0x0'));var util=require(_0xdeb1('0x1'));var moment=require(_0xdeb1('0x2'));var BPromise=require(_0xdeb1('0x3'));var rs=require(_0xdeb1('0x4'));var fs=require('fs');var Redis=require(_0xdeb1('0x5'));var db=require(_0xdeb1('0x6'))['db'];var utils=require(_0xdeb1('0x7'));var logger=require(_0xdeb1('0x8'))(_0xdeb1('0x9'));var config=require('../../config/environment');var jayson=require(_0xdeb1('0xa'));var client=jayson[_0xdeb1('0xb')][_0xdeb1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x418ff3,_0x209806,_0x53092d){return new BPromise(function(_0x5334a2,_0x410460){return client[_0xdeb1('0xd')](_0x418ff3,_0x53092d)[_0xdeb1('0xe')](function(_0x2cacb4){logger[_0xdeb1('0xf')](_0xdeb1('0x10'),_0x209806,'request\x20sent');logger[_0xdeb1('0x11')](_0xdeb1('0x12'),_0x209806,_0xdeb1('0x13'),JSON[_0xdeb1('0x14')](_0x2cacb4));if(_0x2cacb4[_0xdeb1('0x15')]){if(_0x2cacb4[_0xdeb1('0x15')][_0xdeb1('0x16')]===0x1f4){logger[_0xdeb1('0x15')](_0xdeb1('0x10'),_0x209806,_0x2cacb4[_0xdeb1('0x15')][_0xdeb1('0x17')]);return _0x410460(_0x2cacb4[_0xdeb1('0x15')][_0xdeb1('0x17')]);}logger[_0xdeb1('0x15')](_0xdeb1('0x10'),_0x209806,_0x2cacb4['error'][_0xdeb1('0x17')]);return _0x5334a2(_0x2cacb4[_0xdeb1('0x15')][_0xdeb1('0x17')]);}else{logger[_0xdeb1('0xf')](_0xdeb1('0x10'),_0x209806,_0xdeb1('0x13'));_0x5334a2(_0x2cacb4[_0xdeb1('0x18')][_0xdeb1('0x17')]);}})['catch'](function(_0xca047b){logger[_0xdeb1('0x15')](_0xdeb1('0x10'),_0x209806,_0xca047b);_0x410460(_0xca047b);});});} \ No newline at end of file +var _0x6b3a=['request','then','info','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','error','code','FaxTransferReport,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x38857f,_0x3f5184){var _0x5595e4=function(_0xc06dcd){while(--_0xc06dcd){_0x38857f['push'](_0x38857f['shift']());}};_0x5595e4(++_0x3f5184);}(_0x6b3a,0x11b));var _0xa6b3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6b3a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa6b3('0x0'));var util=require(_0xa6b3('0x1'));var moment=require(_0xa6b3('0x2'));var BPromise=require(_0xa6b3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa6b3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa6b3('0x5'));var logger=require('../../config/logger')(_0xa6b3('0x6'));var config=require(_0xa6b3('0x7'));var jayson=require(_0xa6b3('0x8'));var client=jayson[_0xa6b3('0x9')][_0xa6b3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4e1f70,_0x2ca6f2,_0x450b25){return new BPromise(function(_0x275425,_0x2b8718){return client[_0xa6b3('0xb')](_0x4e1f70,_0x450b25)[_0xa6b3('0xc')](function(_0x58a183){logger[_0xa6b3('0xd')]('FaxTransferReport,\x20%s,\x20%s',_0x2ca6f2,_0xa6b3('0xe'));logger['debug'](_0xa6b3('0xf'),_0x2ca6f2,_0xa6b3('0xe'),JSON['stringify'](_0x58a183));if(_0x58a183[_0xa6b3('0x10')]){if(_0x58a183[_0xa6b3('0x10')][_0xa6b3('0x11')]===0x1f4){logger[_0xa6b3('0x10')](_0xa6b3('0x12'),_0x2ca6f2,_0x58a183['error'][_0xa6b3('0x13')]);return _0x2b8718(_0x58a183[_0xa6b3('0x10')]['message']);}logger['error'](_0xa6b3('0x12'),_0x2ca6f2,_0x58a183['error'][_0xa6b3('0x13')]);return _0x275425(_0x58a183[_0xa6b3('0x10')][_0xa6b3('0x13')]);}else{logger[_0xa6b3('0xd')](_0xa6b3('0x12'),_0x2ca6f2,_0xa6b3('0xe'));_0x275425(_0x58a183[_0xa6b3('0x14')][_0xa6b3('0x13')]);}})['catch'](function(_0x496212){logger['error'](_0xa6b3('0x12'),_0x2ca6f2,_0x496212);_0x2b8718(_0x496212);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index f5b6772..d487fb4 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 _0x543c=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','/describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x86dee8,_0x11b14f){var _0x5cda1f=function(_0x16caaa){while(--_0x16caaa){_0x86dee8['push'](_0x86dee8['shift']());}};_0x5cda1f(++_0x11b14f);}(_0x543c,0xef));var _0xc543=function(_0x27604f,_0x5ae336){_0x27604f=_0x27604f-0x0;var _0x40d189=_0x543c[_0x27604f];return _0x40d189;};'use strict';var multer=require(_0xc543('0x0'));var util=require(_0xc543('0x1'));var path=require(_0xc543('0x2'));var timeout=require(_0xc543('0x3'));var express=require('express');var router=express[_0xc543('0x4')]();var fs_extra=require(_0xc543('0x5'));var auth=require(_0xc543('0x6'));var interaction=require(_0xc543('0x7'));var config=require(_0xc543('0x8'));var controller=require(_0xc543('0x9'));router[_0xc543('0xa')]('/',auth[_0xc543('0xb')](),controller['index']);router['get'](_0xc543('0xc'),auth[_0xc543('0xb')](),controller['describe']);router[_0xc543('0xa')](_0xc543('0xd'),auth[_0xc543('0xb')](),controller[_0xc543('0xe')]);router[_0xc543('0xf')]('/',auth[_0xc543('0xb')](),controller[_0xc543('0x10')]);router[_0xc543('0x11')]('/:id',auth[_0xc543('0xb')](),controller[_0xc543('0x12')]);router[_0xc543('0x13')]('/:id',auth[_0xc543('0xb')](),controller[_0xc543('0x14')]);module[_0xc543('0x15')]=router; \ No newline at end of file +var _0xb500=['express','fs-extra','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','connect-timeout'];(function(_0x4fdc46,_0x2a3759){var _0x2c178a=function(_0x59ead9){while(--_0x59ead9){_0x4fdc46['push'](_0x4fdc46['shift']());}};_0x2c178a(++_0x2a3759);}(_0xb500,0x76));var _0x0b50=function(_0x288b07,_0x2281a1){_0x288b07=_0x288b07-0x0;var _0x121f3a=_0xb500[_0x288b07];return _0x121f3a;};'use strict';var multer=require(_0x0b50('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0b50('0x1'));var express=require(_0x0b50('0x2'));var router=express['Router']();var fs_extra=require(_0x0b50('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x0b50('0x4'));var config=require(_0x0b50('0x5'));var controller=require('./faxTransferReport.controller');router[_0x0b50('0x6')]('/',auth['isAuthenticated'](),controller[_0x0b50('0x7')]);router[_0x0b50('0x6')](_0x0b50('0x8'),auth[_0x0b50('0x9')](),controller[_0x0b50('0xa')]);router[_0x0b50('0x6')](_0x0b50('0xb'),auth[_0x0b50('0x9')](),controller[_0x0b50('0xc')]);router[_0x0b50('0xd')]('/',auth[_0x0b50('0x9')](),controller[_0x0b50('0xe')]);router[_0x0b50('0xf')](_0x0b50('0xb'),auth['isAuthenticated'](),controller[_0x0b50('0x10')]);router[_0x0b50('0x11')](_0x0b50('0xb'),auth[_0x0b50('0x9')](),controller[_0x0b50('0x12')]);module[_0x0b50('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index ff0675b..e0a64ef 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 _0xf354=['put','update','delete','destroy','util','path','express','Router','../../components/auth/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration'];(function(_0x78db5e,_0x3b9804){var _0x250b88=function(_0x20a40f){while(--_0x20a40f){_0x78db5e['push'](_0x78db5e['shift']());}};_0x250b88(++_0x3b9804);}(_0xf354,0x9e));var _0x4f35=function(_0x518761,_0x35785e){_0x518761=_0x518761-0x0;var _0x1e5a23=_0xf354[_0x518761];return _0x1e5a23;};'use strict';var multer=require('multer');var util=require(_0x4f35('0x0'));var path=require(_0x4f35('0x1'));var timeout=require('connect-timeout');var express=require(_0x4f35('0x2'));var router=express[_0x4f35('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4f35('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4f35('0x5'));var controller=require(_0x4f35('0x6'));router[_0x4f35('0x7')]('/',auth[_0x4f35('0x8')](),controller[_0x4f35('0x9')]);router[_0x4f35('0x7')](_0x4f35('0xa'),auth[_0x4f35('0x8')](),controller[_0x4f35('0xb')]);router[_0x4f35('0x7')](_0x4f35('0xc'),auth[_0x4f35('0x8')](),controller['getConfigurations']);router['get'](_0x4f35('0xd'),auth[_0x4f35('0x8')](),controller[_0x4f35('0xe')]);router[_0x4f35('0xf')]('/',auth['isAuthenticated'](),controller[_0x4f35('0x10')]);router[_0x4f35('0xf')](_0x4f35('0xc'),auth[_0x4f35('0x8')](),controller[_0x4f35('0x11')]);router[_0x4f35('0x12')](_0x4f35('0xa'),auth['isAuthenticated'](),controller[_0x4f35('0x13')]);router[_0x4f35('0x14')](_0x4f35('0xa'),auth[_0x4f35('0x8')](),controller[_0x4f35('0x15')]);module['exports']=router; \ No newline at end of file +var _0x7a1f=['destroy','exports','multer','util','express','fs-extra','../../components/interaction/service','./intDeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create'];(function(_0x4afd9e,_0x3b532f){var _0x1cdcdd=function(_0x290589){while(--_0x290589){_0x4afd9e['push'](_0x4afd9e['shift']());}};_0x1cdcdd(++_0x3b532f);}(_0x7a1f,0x134));var _0xf7a1=function(_0x23ec06,_0x561142){_0x23ec06=_0x23ec06-0x0;var _0x2831d4=_0x7a1f[_0x23ec06];return _0x2831d4;};'use strict';var multer=require(_0xf7a1('0x0'));var util=require(_0xf7a1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf7a1('0x2'));var router=express['Router']();var fs_extra=require(_0xf7a1('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xf7a1('0x4'));var config=require('../../config/environment');var controller=require(_0xf7a1('0x5'));router[_0xf7a1('0x6')]('/',auth[_0xf7a1('0x7')](),controller[_0xf7a1('0x8')]);router[_0xf7a1('0x6')](_0xf7a1('0x9'),auth['isAuthenticated'](),controller[_0xf7a1('0xa')]);router[_0xf7a1('0x6')](_0xf7a1('0xb'),auth[_0xf7a1('0x7')](),controller[_0xf7a1('0xc')]);router[_0xf7a1('0x6')](_0xf7a1('0xd'),auth[_0xf7a1('0x7')](),controller['getFields']);router[_0xf7a1('0xe')]('/',auth['isAuthenticated'](),controller[_0xf7a1('0xf')]);router['post'](_0xf7a1('0xb'),auth[_0xf7a1('0x7')](),controller['addConfiguration']);router['put'](_0xf7a1('0x9'),auth[_0xf7a1('0x7')](),controller['update']);router['delete'](_0xf7a1('0x9'),auth['isAuthenticated'](),controller[_0xf7a1('0x10')]);module[_0xf7a1('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 0841372..2e04c0e 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 _0x53e9=['newTab','sequelize','STRING','ENUM','basic','integrationTab'];(function(_0x46a3ff,_0x470b9a){var _0x404bc2=function(_0x20f25f){while(--_0x20f25f){_0x46a3ff['push'](_0x46a3ff['shift']());}};_0x404bc2(++_0x470b9a);}(_0x53e9,0xb5));var _0x953e=function(_0x4def8b,_0x546bfe){_0x4def8b=_0x4def8b-0x0;var _0x4769fc=_0x53e9[_0x4def8b];return _0x4769fc;};'use strict';var Sequelize=require(_0x953e('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x953e('0x1')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x953e('0x1')]},'authType':{'type':Sequelize[_0x953e('0x2')]('basic'),'defaultValue':_0x953e('0x3')},'password':{'type':Sequelize[_0x953e('0x1')]},'consumerKey':{'type':Sequelize[_0x953e('0x1')]},'consumerSecret':{'type':Sequelize[_0x953e('0x1')]},'token':{'type':Sequelize[_0x953e('0x1')]},'tokenSecret':{'type':Sequelize[_0x953e('0x1')]},'serverUrl':{'type':Sequelize[_0x953e('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x953e('0x2')](_0x953e('0x4'),_0x953e('0x5')),'defaultValue':_0x953e('0x4')}}; \ No newline at end of file +var _0xc849=['STRING','ENUM','basic','integrationTab','newTab','exports'];(function(_0x3568c9,_0x543a4d){var _0x400db1=function(_0x3720a5){while(--_0x3720a5){_0x3568c9['push'](_0x3568c9['shift']());}};_0x400db1(++_0x543a4d);}(_0xc849,0x14f));var _0x9c84=function(_0x2a8854,_0x2f8e2a){_0x2a8854=_0x2a8854-0x0;var _0x594643=_0xc849[_0x2a8854];return _0x594643;};'use strict';var Sequelize=require('sequelize');module[_0x9c84('0x0')]={'name':{'type':Sequelize[_0x9c84('0x1')]},'description':{'type':Sequelize[_0x9c84('0x1')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x9c84('0x1')]},'authType':{'type':Sequelize[_0x9c84('0x2')](_0x9c84('0x3')),'defaultValue':_0x9c84('0x3')},'password':{'type':Sequelize[_0x9c84('0x1')]},'consumerKey':{'type':Sequelize[_0x9c84('0x1')]},'consumerSecret':{'type':Sequelize[_0x9c84('0x1')]},'token':{'type':Sequelize[_0x9c84('0x1')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x9c84('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x9c84('0x2')](_0x9c84('0x4'),_0x9c84('0x5')),'defaultValue':_0x9c84('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 53ad32b..c34af19 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 _0x0f6a=['slice','substring','lastIndexOf','format','%s/custom_fields','application/json','basic','Basic\x20%s','base64','concat','_embedded','entries','test','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','statusCode','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','end','error','stack','index','DeskAccount','rawAttributes','key','map','query','keys','filters','model','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','merge','type','name','options','includeAll','include','findAll','catch','show','params','create','body','findOne','DeskConfiguration','order','getConfigurations','hasOwnProperty','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','authType','username','password','consumerSecret','token','tokenSecret'];(function(_0x533050,_0xe05ec){var _0x25812f=function(_0x26dd52){while(--_0x26dd52){_0x533050['push'](_0x533050['shift']());}};_0x25812f(++_0xe05ec);}(_0x0f6a,0x1d6));var _0xa0f6=function(_0x4f2da9,_0x1ea50c){_0x4f2da9=_0x4f2da9-0x0;var _0x2dca8a=_0x0f6a[_0x4f2da9];return _0x2dca8a;};'use strict';var emlformat=require(_0xa0f6('0x0'));var rimraf=require(_0xa0f6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa0f6('0x2'));var rp=require(_0xa0f6('0x3'));var moment=require(_0xa0f6('0x4'));var BPromise=require(_0xa0f6('0x5'));var Mustache=require(_0xa0f6('0x6'));var util=require(_0xa0f6('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xa0f6('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa0f6('0x9'));var squel=require(_0xa0f6('0xa'));var crypto=require(_0xa0f6('0xb'));var jsforce=require(_0xa0f6('0xc'));var deskjs=require(_0xa0f6('0xd'));var toCsv=require(_0xa0f6('0x8'));var querystring=require(_0xa0f6('0xe'));var Papa=require(_0xa0f6('0xf'));var Redis=require(_0xa0f6('0x10'));var authService=require(_0xa0f6('0x11'));var qs=require(_0xa0f6('0x12'));var as=require(_0xa0f6('0x13'));var hardwareService=require(_0xa0f6('0x14'));var logger=require(_0xa0f6('0x15'))(_0xa0f6('0x16'));var utils=require(_0xa0f6('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xa0f6('0x18'));var db=require(_0xa0f6('0x19'))['db'];var integrations=require(_0xa0f6('0x1a'));function respondWithStatusCode(_0x1fa2db,_0x1bd716){_0x1bd716=_0x1bd716||0xcc;return function(_0x11e248){if(_0x11e248){return _0x1fa2db[_0xa0f6('0x1b')](_0x1bd716);}return _0x1fa2db[_0xa0f6('0x1c')](_0x1bd716)['end']();};}function respondWithResult(_0x2417ef,_0x44a160){_0x44a160=_0x44a160||0xc8;return function(_0x3eb04b){if(_0x3eb04b){return _0x2417ef['status'](_0x44a160)[_0xa0f6('0x1d')](_0x3eb04b);}};}function respondWithFilteredResult(_0x5040d0,_0x2a06e3){return function(_0x6d6350){if(_0x6d6350){var _0x2ba942=typeof _0x2a06e3[_0xa0f6('0x1e')]==='undefined'&&typeof _0x2a06e3[_0xa0f6('0x1f')]===_0xa0f6('0x20');var _0x812618=_0x6d6350[_0xa0f6('0x21')];var _0x58f548=_0x2ba942?0x0:_0x2a06e3[_0xa0f6('0x1e')];var _0x44e7ab=_0x2ba942?_0x6d6350[_0xa0f6('0x21')]:_0x2a06e3['offset']+_0x2a06e3['limit'];var _0xc0dbb1;if(_0x44e7ab>=_0x812618){_0x44e7ab=_0x812618;_0xc0dbb1=0xc8;}else{_0xc0dbb1=0xce;}_0x5040d0[_0xa0f6('0x1c')](_0xc0dbb1);return _0x5040d0[_0xa0f6('0x22')](_0xa0f6('0x23'),_0x58f548+'-'+_0x44e7ab+'/'+_0x812618)[_0xa0f6('0x1d')](_0x6d6350);}return null;};}function patchUpdates(_0x42cff9){return function(_0x2fc4c0){try{jsonpatch[_0xa0f6('0x24')](_0x2fc4c0,_0x42cff9,!![]);}catch(_0x1603b4){return BPromise['reject'](_0x1603b4);}return _0x2fc4c0[_0xa0f6('0x25')]();};}function saveUpdates(_0xeb6384,_0x47d4b4){return function(_0x30d34c){if(_0x30d34c){return _0x30d34c[_0xa0f6('0x26')](_0xeb6384)[_0xa0f6('0x27')](function(_0x252840){return _0x252840;});}return null;};}function removeEntity(_0x1fded6,_0x365b95){return function(_0x2604ec){if(_0x2604ec){return _0x2604ec[_0xa0f6('0x28')]()[_0xa0f6('0x27')](function(){_0x1fded6[_0xa0f6('0x1c')](0xcc)[_0xa0f6('0x29')]();});}};}function handleEntityNotFound(_0x1a413f,_0xdeb419){return function(_0x47d165){if(!_0x47d165){_0x1a413f[_0xa0f6('0x1b')](0x194);}return _0x47d165;};}function handleError(_0x48adde,_0xcd2c56){_0xcd2c56=_0xcd2c56||0x1f4;return function(_0x129b3e){logger[_0xa0f6('0x2a')](_0x129b3e[_0xa0f6('0x2b')]);if(_0x129b3e['name']){delete _0x129b3e['name'];}_0x48adde['status'](_0xcd2c56)['send'](_0x129b3e);};}exports[_0xa0f6('0x2c')]=function(_0x438905,_0xd13389){var _0x188639={},_0x5644ce={},_0x5715a1={'count':0x0,'rows':[]};var _0x2367cb=_['map'](db[_0xa0f6('0x2d')][_0xa0f6('0x2e')],function(_0x5006da){return{'name':_0x5006da['fieldName'],'type':_0x5006da['type'][_0xa0f6('0x2f')]};});_0x5644ce['model']=_[_0xa0f6('0x30')](_0x2367cb,'name');_0x5644ce[_0xa0f6('0x31')]=_[_0xa0f6('0x32')](_0x438905['query']);_0x5644ce[_0xa0f6('0x33')]=_['intersection'](_0x5644ce[_0xa0f6('0x34')],_0x5644ce['query']);_0x188639['attributes']=_[_0xa0f6('0x35')](_0x5644ce[_0xa0f6('0x34')],qs[_0xa0f6('0x36')](_0x438905[_0xa0f6('0x31')]['fields']));_0x188639[_0xa0f6('0x37')]=_0x188639[_0xa0f6('0x37')][_0xa0f6('0x38')]?_0x188639[_0xa0f6('0x37')]:_0x5644ce['model'];if(!_0x438905['query']['hasOwnProperty'](_0xa0f6('0x39'))){_0x188639[_0xa0f6('0x1f')]=qs[_0xa0f6('0x1f')](_0x438905[_0xa0f6('0x31')][_0xa0f6('0x1f')]);_0x188639[_0xa0f6('0x1e')]=qs[_0xa0f6('0x1e')](_0x438905[_0xa0f6('0x31')][_0xa0f6('0x1e')]);}_0x188639['order']=qs[_0xa0f6('0x3a')](_0x438905[_0xa0f6('0x31')][_0xa0f6('0x3a')]);_0x188639[_0xa0f6('0x3b')]=qs[_0xa0f6('0x33')](_[_0xa0f6('0x3c')](_0x438905[_0xa0f6('0x31')],_0x5644ce['filters']),_0x2367cb);if(_0x438905[_0xa0f6('0x31')][_0xa0f6('0x3d')]){_0x188639[_0xa0f6('0x3b')]=_[_0xa0f6('0x3e')](_0x188639[_0xa0f6('0x3b')],{'$or':_[_0xa0f6('0x30')](_0x2367cb,function(_0xbde94f){if(_0xbde94f[_0xa0f6('0x3f')]!=='VIRTUAL'){var _0x53a5af={};_0x53a5af[_0xbde94f[_0xa0f6('0x40')]]={'$like':'%'+_0x438905['query'][_0xa0f6('0x3d')]+'%'};return _0x53a5af;}})});}_0x188639=_[_0xa0f6('0x3e')]({},_0x188639,_0x438905[_0xa0f6('0x41')]);var _0x40b350={'where':_0x188639[_0xa0f6('0x3b')]};return db[_0xa0f6('0x2d')]['count'](_0x40b350)[_0xa0f6('0x27')](function(_0x1bb6ea){_0x5715a1[_0xa0f6('0x21')]=_0x1bb6ea;if(_0x438905[_0xa0f6('0x31')][_0xa0f6('0x42')]){_0x188639[_0xa0f6('0x43')]=[{'all':!![]}];}return db[_0xa0f6('0x2d')][_0xa0f6('0x44')](_0x188639);})[_0xa0f6('0x27')](function(_0xfdbf7a){_0x5715a1['rows']=_0xfdbf7a;return _0x5715a1;})[_0xa0f6('0x27')](respondWithFilteredResult(_0xd13389,_0x188639))[_0xa0f6('0x45')](handleError(_0xd13389,null));};exports[_0xa0f6('0x46')]=function(_0x4717f7,_0x113c9a){var _0xed6c71={'raw':![],'where':{'id':_0x4717f7[_0xa0f6('0x47')]['id']}},_0x4b7ae1={};_0x4b7ae1['model']=_[_0xa0f6('0x32')](db[_0xa0f6('0x2d')][_0xa0f6('0x2e')]);_0x4b7ae1[_0xa0f6('0x31')]=_[_0xa0f6('0x32')](_0x4717f7['query']);_0x4b7ae1[_0xa0f6('0x33')]=_['intersection'](_0x4b7ae1['model'],_0x4b7ae1[_0xa0f6('0x31')]);_0xed6c71[_0xa0f6('0x37')]=_[_0xa0f6('0x35')](_0x4b7ae1[_0xa0f6('0x34')],qs['fields'](_0x4717f7[_0xa0f6('0x31')][_0xa0f6('0x36')]));_0xed6c71['attributes']=_0xed6c71[_0xa0f6('0x37')]['length']?_0xed6c71[_0xa0f6('0x37')]:_0x4b7ae1[_0xa0f6('0x34')];if(_0x4717f7[_0xa0f6('0x31')][_0xa0f6('0x42')]){_0xed6c71['include']=[{'all':!![]}];}_0xed6c71=_[_0xa0f6('0x3e')]({},_0xed6c71,_0x4717f7[_0xa0f6('0x41')]);return db[_0xa0f6('0x2d')]['find'](_0xed6c71)[_0xa0f6('0x27')](handleEntityNotFound(_0x113c9a,null))[_0xa0f6('0x27')](respondWithResult(_0x113c9a,null))[_0xa0f6('0x45')](handleError(_0x113c9a,null));};exports[_0xa0f6('0x48')]=function(_0x268fb4,_0x1f5fc2){return db[_0xa0f6('0x2d')]['create'](_0x268fb4[_0xa0f6('0x49')],{})[_0xa0f6('0x27')](respondWithResult(_0x1f5fc2,0xc9))['catch'](handleError(_0x1f5fc2,null));};exports[_0xa0f6('0x26')]=function(_0x5eebf3,_0x2121fe){if(_0x5eebf3['body']['id']){delete _0x5eebf3[_0xa0f6('0x49')]['id'];}return db[_0xa0f6('0x2d')]['find']({'where':{'id':_0x5eebf3[_0xa0f6('0x47')]['id']}})['then'](handleEntityNotFound(_0x2121fe,null))[_0xa0f6('0x27')](saveUpdates(_0x5eebf3[_0xa0f6('0x49')],null))[_0xa0f6('0x27')](respondWithResult(_0x2121fe,null))['catch'](handleError(_0x2121fe,null));};exports['destroy']=function(_0x1e19bc,_0x228dad){return db[_0xa0f6('0x2d')]['find']({'where':{'id':_0x1e19bc[_0xa0f6('0x47')]['id']}})[_0xa0f6('0x27')](handleEntityNotFound(_0x228dad,null))[_0xa0f6('0x27')](removeEntity(_0x228dad,null))[_0xa0f6('0x45')](handleError(_0x228dad,null));};exports['getConfigurations']=function(_0x2ac783,_0x50cd0e,_0x5203b9){var _0x476dcf={};var _0x5d0480={};var _0xb1d56f;var _0xd4f99e;return db['DeskAccount'][_0xa0f6('0x4a')]({'where':{'id':_0x2ac783[_0xa0f6('0x47')]['id']}})[_0xa0f6('0x27')](handleEntityNotFound(_0x50cd0e,null))[_0xa0f6('0x27')](function(_0x517d68){if(_0x517d68){_0xb1d56f=_0x517d68;_0x5d0480[_0xa0f6('0x34')]=_['keys'](db[_0xa0f6('0x4b')][_0xa0f6('0x2e')]);_0x5d0480['query']=_['keys'](_0x2ac783[_0xa0f6('0x31')]);_0x5d0480[_0xa0f6('0x33')]=_[_0xa0f6('0x35')](_0x5d0480[_0xa0f6('0x34')],_0x5d0480[_0xa0f6('0x31')]);_0x476dcf[_0xa0f6('0x37')]=_[_0xa0f6('0x35')](_0x5d0480['model'],qs[_0xa0f6('0x36')](_0x2ac783[_0xa0f6('0x31')][_0xa0f6('0x36')]));_0x476dcf['attributes']=_0x476dcf['attributes']['length']?_0x476dcf[_0xa0f6('0x37')]:_0x5d0480['model'];_0x476dcf[_0xa0f6('0x4c')]=qs[_0xa0f6('0x3a')](_0x2ac783['query'][_0xa0f6('0x3a')]);_0x476dcf['where']=qs['filters'](_[_0xa0f6('0x3c')](_0x2ac783[_0xa0f6('0x31')],_0x5d0480[_0xa0f6('0x33')]));if(_0x2ac783['query'][_0xa0f6('0x3d')]){_0x476dcf['where']=_[_0xa0f6('0x3e')](_0x476dcf[_0xa0f6('0x3b')],{'$or':_[_0xa0f6('0x30')](_0x476dcf[_0xa0f6('0x37')],function(_0x487f00){var _0x1304c7={};_0x1304c7[_0x487f00]={'$like':'%'+_0x2ac783[_0xa0f6('0x31')]['filter']+'%'};return _0x1304c7;})});}_0x476dcf=_[_0xa0f6('0x3e')]({},_0x476dcf,_0x2ac783[_0xa0f6('0x41')]);return _0xb1d56f[_0xa0f6('0x4d')](_0x476dcf);}})[_0xa0f6('0x27')](function(_0x2792dd){if(_0x2792dd){_0xd4f99e=_0x2792dd[_0xa0f6('0x38')];if(!_0x2ac783[_0xa0f6('0x31')][_0xa0f6('0x4e')](_0xa0f6('0x39'))){_0x476dcf['limit']=qs[_0xa0f6('0x1f')](_0x2ac783[_0xa0f6('0x31')][_0xa0f6('0x1f')]);_0x476dcf[_0xa0f6('0x1e')]=qs[_0xa0f6('0x1e')](_0x2ac783['query']['offset']);}return _0xb1d56f['getConfigurations'](_0x476dcf);}})[_0xa0f6('0x27')](function(_0x51bb9f){if(_0x51bb9f){return _0x51bb9f?{'count':_0xd4f99e,'rows':_0x51bb9f}:null;}})[_0xa0f6('0x27')](respondWithResult(_0x50cd0e,null))[_0xa0f6('0x45')](handleError(_0x50cd0e,null));};exports['addConfiguration']=function(_0x1246c1,_0x3d98b9,_0x8cfe52){if(_0x1246c1[_0xa0f6('0x49')]['id']){delete _0x1246c1['body']['id'];}return db['DeskAccount']['findOne']({'where':{'id':_0x1246c1[_0xa0f6('0x47')]['id']}})[_0xa0f6('0x27')](handleEntityNotFound(_0x3d98b9,null))[_0xa0f6('0x27')](function(_0x460817){if(_0x460817){_0x1246c1[_0xa0f6('0x49')][_0xa0f6('0x4f')]=_0x460817['id'];_0x1246c1[_0xa0f6('0x49')][_0xa0f6('0x50')]=integrations[_0xa0f6('0x51')](_0x1246c1[_0xa0f6('0x49')][_0xa0f6('0x52')],_0x1246c1[_0xa0f6('0x49')]['type']);_0x1246c1['body'][_0xa0f6('0x53')]=integrations[_0xa0f6('0x54')](_0x1246c1['body'][_0xa0f6('0x52')],_0x1246c1[_0xa0f6('0x49')][_0xa0f6('0x3f')]);return db['DeskConfiguration'][_0xa0f6('0x48')](_0x1246c1[_0xa0f6('0x49')],{'include':[{'model':db[_0xa0f6('0x55')],'as':_0xa0f6('0x50')},{'model':db[_0xa0f6('0x55')],'as':_0xa0f6('0x53')}]});}return null;})[_0xa0f6('0x27')](respondWithResult(_0x3d98b9,null))[_0xa0f6('0x45')](handleError(_0x3d98b9,null));};exports[_0xa0f6('0x56')]=function(_0x382f77,_0x2df25b,_0x3bf7e0){var _0x47281d=[{'name':_0xa0f6('0x57'),'label':'priority','custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x4776af='';return db[_0xa0f6('0x2d')][_0xa0f6('0x4a')]({'where':{'id':_0x382f77[_0xa0f6('0x47')]['id']},'attributes':['id',_0xa0f6('0x58'),_0xa0f6('0x59'),_0xa0f6('0x5a'),_0xa0f6('0x5b'),'consumerKey',_0xa0f6('0x5c'),_0xa0f6('0x5d'),_0xa0f6('0x5e')]})[_0xa0f6('0x27')](handleEntityNotFound(_0x2df25b,null))[_0xa0f6('0x27')](function(_0x5d156b){if(_0x5d156b){_0x4776af=_0x5d156b['remoteUri'];var _0xf98070=_0x4776af[_0xa0f6('0x5f')](-0x1);if(_0xf98070==='/'){_0x4776af=_0x4776af[_0xa0f6('0x60')](0x0,_0x4776af[_0xa0f6('0x61')](_0xf98070));}var _0x2f020d={'method':'GET','uri':util[_0xa0f6('0x62')](_0xa0f6('0x63'),_0x4776af),'headers':{'Content-Type':_0xa0f6('0x64'),'Accept':_0xa0f6('0x64')},'json':!![]};if(_0x5d156b[_0xa0f6('0x59')]===_0xa0f6('0x65')){_0x2f020d['headers']['Authorization']=util[_0xa0f6('0x62')](_0xa0f6('0x66'),new Buffer(util['format']('%s:%s',_0x5d156b[_0xa0f6('0x5a')],_0x5d156b['password']))['toString'](_0xa0f6('0x67')));}return rp(_0x2f020d)[_0xa0f6('0x27')](function(_0xcf4d9c){return _0x47281d[_0xa0f6('0x68')](_[_0xa0f6('0x30')](_0xcf4d9c[_0xa0f6('0x69')][_0xa0f6('0x6a')],function(_0x62dac3){return{'id':_0x62dac3[_0xa0f6('0x40')],'name':_0x62dac3['name'],'type':_0x62dac3[_0xa0f6('0x3f')],'active':_0x62dac3['active'],'label':_0x62dac3['label'],'custom':!![]};}));});}})[_0xa0f6('0x27')](function(_0x465bf1){return{'count':_0x465bf1[_0xa0f6('0x38')],'rows':_0x465bf1};})[_0xa0f6('0x27')](respondWithResult(_0x2df25b,null))[_0xa0f6('0x45')](function(_0x26aa46){var _0x2ebe3d=_0x382f77[_0xa0f6('0x31')][_0xa0f6('0x6b')]?0x1f4:_0x26aa46['statusCode']||0x1f4;logger[_0xa0f6('0x2a')](_0xa0f6('0x6c'),_0xa0f6('0x56'),_0x2ebe3d,JSON[_0xa0f6('0x6d')](_0x26aa46));delete _0x26aa46[_0xa0f6('0x40')];if(_0x2ebe3d===0x191){_0x2ebe3d=0x190;}_0x2df25b[_0xa0f6('0x1c')](_0x2ebe3d)[_0xa0f6('0x6e')](_0x382f77['query']['test']?{'message':_0xa0f6('0x6f'),'statusCode':_0x26aa46[_0xa0f6('0x70')]}:_0x26aa46);});}; \ No newline at end of file +var _0xe31e=['count','Content-Range','apply','reject','save','then','destroy','sendStatus','stack','name','send','index','DeskAccount','rawAttributes','fieldName','type','model','map','query','keys','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','getConfigurations','findOne','DeskConfiguration','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','DeskField','priority','remoteUri','username','consumerKey','consumerSecret','tokenSecret','substring','lastIndexOf','GET','%s/custom_fields','application/json','basic','headers','Authorization','format','Basic\x20%s','password','toString','entries','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit'];(function(_0xf60f58,_0x15c66b){var _0x299698=function(_0x1497ce){while(--_0x1497ce){_0xf60f58['push'](_0xf60f58['shift']());}};_0x299698(++_0x15c66b);}(_0xe31e,0x12b));var _0xee31=function(_0x42e773,_0x561aa9){_0x42e773=_0x42e773-0x0;var _0x1e9496=_0xe31e[_0x42e773];return _0x1e9496;};'use strict';var emlformat=require(_0xee31('0x0'));var rimraf=require(_0xee31('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xee31('0x2'));var rp=require(_0xee31('0x3'));var moment=require('moment');var BPromise=require(_0xee31('0x4'));var Mustache=require(_0xee31('0x5'));var util=require(_0xee31('0x6'));var path=require(_0xee31('0x7'));var sox=require(_0xee31('0x8'));var csv=require(_0xee31('0x9'));var ejs=require(_0xee31('0xa'));var fs=require('fs');var fs_extra=require(_0xee31('0xb'));var _=require(_0xee31('0xc'));var squel=require(_0xee31('0xd'));var crypto=require(_0xee31('0xe'));var jsforce=require(_0xee31('0xf'));var deskjs=require(_0xee31('0x10'));var toCsv=require('to-csv');var querystring=require(_0xee31('0x11'));var Papa=require(_0xee31('0x12'));var Redis=require(_0xee31('0x13'));var authService=require(_0xee31('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xee31('0x15'));var logger=require(_0xee31('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xee31('0x17'));var db=require(_0xee31('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x20c37e,_0x5dc18c){_0x5dc18c=_0x5dc18c||0xcc;return function(_0x38228e){if(_0x38228e){return _0x20c37e['sendStatus'](_0x5dc18c);}return _0x20c37e['status'](_0x5dc18c)[_0xee31('0x19')]();};}function respondWithResult(_0x794029,_0xf07ab7){_0xf07ab7=_0xf07ab7||0xc8;return function(_0x8139b8){if(_0x8139b8){return _0x794029[_0xee31('0x1a')](_0xf07ab7)[_0xee31('0x1b')](_0x8139b8);}};}function respondWithFilteredResult(_0x5eec0b,_0x5f413b){return function(_0x2ad57e){if(_0x2ad57e){var _0x488fd3=typeof _0x5f413b[_0xee31('0x1c')]===_0xee31('0x1d')&&typeof _0x5f413b[_0xee31('0x1e')]===_0xee31('0x1d');var _0x177484=_0x2ad57e[_0xee31('0x1f')];var _0x51e25f=_0x488fd3?0x0:_0x5f413b[_0xee31('0x1c')];var _0x169089=_0x488fd3?_0x2ad57e[_0xee31('0x1f')]:_0x5f413b[_0xee31('0x1c')]+_0x5f413b[_0xee31('0x1e')];var _0xd21912;if(_0x169089>=_0x177484){_0x169089=_0x177484;_0xd21912=0xc8;}else{_0xd21912=0xce;}_0x5eec0b[_0xee31('0x1a')](_0xd21912);return _0x5eec0b['set'](_0xee31('0x20'),_0x51e25f+'-'+_0x169089+'/'+_0x177484)[_0xee31('0x1b')](_0x2ad57e);}return null;};}function patchUpdates(_0x803147){return function(_0x1f147f){try{jsonpatch[_0xee31('0x21')](_0x1f147f,_0x803147,!![]);}catch(_0x162c54){return BPromise[_0xee31('0x22')](_0x162c54);}return _0x1f147f[_0xee31('0x23')]();};}function saveUpdates(_0x41a699,_0x4306ac){return function(_0x18277b){if(_0x18277b){return _0x18277b['update'](_0x41a699)[_0xee31('0x24')](function(_0x1f9eba){return _0x1f9eba;});}return null;};}function removeEntity(_0x3c715b,_0x2925f6){return function(_0x334873){if(_0x334873){return _0x334873[_0xee31('0x25')]()[_0xee31('0x24')](function(){_0x3c715b['status'](0xcc)[_0xee31('0x19')]();});}};}function handleEntityNotFound(_0x28a7e0,_0x372efd){return function(_0x3ba9a2){if(!_0x3ba9a2){_0x28a7e0[_0xee31('0x26')](0x194);}return _0x3ba9a2;};}function handleError(_0x26fed2,_0xffffc4){_0xffffc4=_0xffffc4||0x1f4;return function(_0x11ec46){logger['error'](_0x11ec46[_0xee31('0x27')]);if(_0x11ec46[_0xee31('0x28')]){delete _0x11ec46[_0xee31('0x28')];}_0x26fed2[_0xee31('0x1a')](_0xffffc4)[_0xee31('0x29')](_0x11ec46);};}exports[_0xee31('0x2a')]=function(_0x248aff,_0x229642){var _0x300ad2={},_0x15b758={},_0x25902a={'count':0x0,'rows':[]};var _0x537bea=_['map'](db[_0xee31('0x2b')][_0xee31('0x2c')],function(_0x5251a2){return{'name':_0x5251a2[_0xee31('0x2d')],'type':_0x5251a2[_0xee31('0x2e')]['key']};});_0x15b758[_0xee31('0x2f')]=_[_0xee31('0x30')](_0x537bea,_0xee31('0x28'));_0x15b758[_0xee31('0x31')]=_[_0xee31('0x32')](_0x248aff['query']);_0x15b758['filters']=_[_0xee31('0x33')](_0x15b758[_0xee31('0x2f')],_0x15b758[_0xee31('0x31')]);_0x300ad2[_0xee31('0x34')]=_[_0xee31('0x33')](_0x15b758['model'],qs[_0xee31('0x35')](_0x248aff[_0xee31('0x31')][_0xee31('0x35')]));_0x300ad2[_0xee31('0x34')]=_0x300ad2[_0xee31('0x34')][_0xee31('0x36')]?_0x300ad2[_0xee31('0x34')]:_0x15b758[_0xee31('0x2f')];if(!_0x248aff[_0xee31('0x31')]['hasOwnProperty'](_0xee31('0x37'))){_0x300ad2[_0xee31('0x1e')]=qs[_0xee31('0x1e')](_0x248aff[_0xee31('0x31')][_0xee31('0x1e')]);_0x300ad2[_0xee31('0x1c')]=qs[_0xee31('0x1c')](_0x248aff['query'][_0xee31('0x1c')]);}_0x300ad2['order']=qs[_0xee31('0x38')](_0x248aff[_0xee31('0x31')][_0xee31('0x38')]);_0x300ad2[_0xee31('0x39')]=qs[_0xee31('0x3a')](_[_0xee31('0x3b')](_0x248aff[_0xee31('0x31')],_0x15b758['filters']),_0x537bea);if(_0x248aff[_0xee31('0x31')][_0xee31('0x3c')]){_0x300ad2['where']=_['merge'](_0x300ad2[_0xee31('0x39')],{'$or':_[_0xee31('0x30')](_0x537bea,function(_0x1a06fc){if(_0x1a06fc[_0xee31('0x2e')]!=='VIRTUAL'){var _0x8f96b7={};_0x8f96b7[_0x1a06fc[_0xee31('0x28')]]={'$like':'%'+_0x248aff[_0xee31('0x31')][_0xee31('0x3c')]+'%'};return _0x8f96b7;}})});}_0x300ad2=_[_0xee31('0x3d')]({},_0x300ad2,_0x248aff[_0xee31('0x3e')]);var _0x596db2={'where':_0x300ad2[_0xee31('0x39')]};return db[_0xee31('0x2b')][_0xee31('0x1f')](_0x596db2)[_0xee31('0x24')](function(_0x5613eb){_0x25902a[_0xee31('0x1f')]=_0x5613eb;if(_0x248aff[_0xee31('0x31')][_0xee31('0x3f')]){_0x300ad2[_0xee31('0x40')]=[{'all':!![]}];}return db[_0xee31('0x2b')][_0xee31('0x41')](_0x300ad2);})['then'](function(_0x533a22){_0x25902a[_0xee31('0x42')]=_0x533a22;return _0x25902a;})[_0xee31('0x24')](respondWithFilteredResult(_0x229642,_0x300ad2))[_0xee31('0x43')](handleError(_0x229642,null));};exports[_0xee31('0x44')]=function(_0x41811d,_0x8421d0){var _0x3bd118={'raw':![],'where':{'id':_0x41811d[_0xee31('0x45')]['id']}},_0x16d008={};_0x16d008[_0xee31('0x2f')]=_['keys'](db['DeskAccount'][_0xee31('0x2c')]);_0x16d008[_0xee31('0x31')]=_[_0xee31('0x32')](_0x41811d[_0xee31('0x31')]);_0x16d008[_0xee31('0x3a')]=_[_0xee31('0x33')](_0x16d008['model'],_0x16d008[_0xee31('0x31')]);_0x3bd118[_0xee31('0x34')]=_[_0xee31('0x33')](_0x16d008['model'],qs[_0xee31('0x35')](_0x41811d[_0xee31('0x31')][_0xee31('0x35')]));_0x3bd118[_0xee31('0x34')]=_0x3bd118[_0xee31('0x34')][_0xee31('0x36')]?_0x3bd118[_0xee31('0x34')]:_0x16d008[_0xee31('0x2f')];if(_0x41811d[_0xee31('0x31')][_0xee31('0x3f')]){_0x3bd118[_0xee31('0x40')]=[{'all':!![]}];}_0x3bd118=_[_0xee31('0x3d')]({},_0x3bd118,_0x41811d[_0xee31('0x3e')]);return db['DeskAccount'][_0xee31('0x46')](_0x3bd118)[_0xee31('0x24')](handleEntityNotFound(_0x8421d0,null))[_0xee31('0x24')](respondWithResult(_0x8421d0,null))[_0xee31('0x43')](handleError(_0x8421d0,null));};exports[_0xee31('0x47')]=function(_0x4bd44a,_0x3d3895){return db[_0xee31('0x2b')][_0xee31('0x47')](_0x4bd44a[_0xee31('0x48')],{})[_0xee31('0x24')](respondWithResult(_0x3d3895,0xc9))['catch'](handleError(_0x3d3895,null));};exports['update']=function(_0x23d958,_0x133077){if(_0x23d958[_0xee31('0x48')]['id']){delete _0x23d958[_0xee31('0x48')]['id'];}return db[_0xee31('0x2b')][_0xee31('0x46')]({'where':{'id':_0x23d958[_0xee31('0x45')]['id']}})[_0xee31('0x24')](handleEntityNotFound(_0x133077,null))[_0xee31('0x24')](saveUpdates(_0x23d958[_0xee31('0x48')],null))[_0xee31('0x24')](respondWithResult(_0x133077,null))['catch'](handleError(_0x133077,null));};exports[_0xee31('0x25')]=function(_0x43e05d,_0x16b54e){return db[_0xee31('0x2b')][_0xee31('0x46')]({'where':{'id':_0x43e05d[_0xee31('0x45')]['id']}})['then'](handleEntityNotFound(_0x16b54e,null))['then'](removeEntity(_0x16b54e,null))[_0xee31('0x43')](handleError(_0x16b54e,null));};exports[_0xee31('0x49')]=function(_0x19e1f2,_0xf5eb9d,_0x40c6ed){var _0x2a5fb5={};var _0x33246f={};var _0x2b0b7d;var _0x4bf4d6;return db[_0xee31('0x2b')][_0xee31('0x4a')]({'where':{'id':_0x19e1f2['params']['id']}})[_0xee31('0x24')](handleEntityNotFound(_0xf5eb9d,null))[_0xee31('0x24')](function(_0x20f44e){if(_0x20f44e){_0x2b0b7d=_0x20f44e;_0x33246f[_0xee31('0x2f')]=_[_0xee31('0x32')](db[_0xee31('0x4b')][_0xee31('0x2c')]);_0x33246f[_0xee31('0x31')]=_[_0xee31('0x32')](_0x19e1f2[_0xee31('0x31')]);_0x33246f[_0xee31('0x3a')]=_[_0xee31('0x33')](_0x33246f[_0xee31('0x2f')],_0x33246f[_0xee31('0x31')]);_0x2a5fb5['attributes']=_[_0xee31('0x33')](_0x33246f[_0xee31('0x2f')],qs[_0xee31('0x35')](_0x19e1f2['query']['fields']));_0x2a5fb5['attributes']=_0x2a5fb5[_0xee31('0x34')]['length']?_0x2a5fb5[_0xee31('0x34')]:_0x33246f['model'];_0x2a5fb5['order']=qs['sort'](_0x19e1f2[_0xee31('0x31')][_0xee31('0x38')]);_0x2a5fb5[_0xee31('0x39')]=qs[_0xee31('0x3a')](_['pick'](_0x19e1f2[_0xee31('0x31')],_0x33246f[_0xee31('0x3a')]));if(_0x19e1f2[_0xee31('0x31')][_0xee31('0x3c')]){_0x2a5fb5['where']=_[_0xee31('0x3d')](_0x2a5fb5[_0xee31('0x39')],{'$or':_[_0xee31('0x30')](_0x2a5fb5[_0xee31('0x34')],function(_0x5dc34b){var _0x115a51={};_0x115a51[_0x5dc34b]={'$like':'%'+_0x19e1f2[_0xee31('0x31')][_0xee31('0x3c')]+'%'};return _0x115a51;})});}_0x2a5fb5=_['merge']({},_0x2a5fb5,_0x19e1f2[_0xee31('0x3e')]);return _0x2b0b7d[_0xee31('0x49')](_0x2a5fb5);}})[_0xee31('0x24')](function(_0x4c4e4d){if(_0x4c4e4d){_0x4bf4d6=_0x4c4e4d[_0xee31('0x36')];if(!_0x19e1f2[_0xee31('0x31')]['hasOwnProperty'](_0xee31('0x37'))){_0x2a5fb5[_0xee31('0x1e')]=qs[_0xee31('0x1e')](_0x19e1f2[_0xee31('0x31')]['limit']);_0x2a5fb5['offset']=qs['offset'](_0x19e1f2[_0xee31('0x31')][_0xee31('0x1c')]);}return _0x2b0b7d[_0xee31('0x49')](_0x2a5fb5);}})[_0xee31('0x24')](function(_0x5a61a1){if(_0x5a61a1){return _0x5a61a1?{'count':_0x4bf4d6,'rows':_0x5a61a1}:null;}})[_0xee31('0x24')](respondWithResult(_0xf5eb9d,null))[_0xee31('0x43')](handleError(_0xf5eb9d,null));};exports[_0xee31('0x4c')]=function(_0x1fbaf9,_0x57307d,_0x3d5633){if(_0x1fbaf9[_0xee31('0x48')]['id']){delete _0x1fbaf9[_0xee31('0x48')]['id'];}return db['DeskAccount'][_0xee31('0x4a')]({'where':{'id':_0x1fbaf9[_0xee31('0x45')]['id']}})[_0xee31('0x24')](handleEntityNotFound(_0x57307d,null))[_0xee31('0x24')](function(_0x58c26f){if(_0x58c26f){_0x1fbaf9[_0xee31('0x48')][_0xee31('0x4d')]=_0x58c26f['id'];_0x1fbaf9[_0xee31('0x48')][_0xee31('0x4e')]=integrations[_0xee31('0x4f')](_0x1fbaf9['body']['channel'],_0x1fbaf9[_0xee31('0x48')][_0xee31('0x2e')]);_0x1fbaf9[_0xee31('0x48')][_0xee31('0x50')]=integrations[_0xee31('0x51')](_0x1fbaf9['body']['channel'],_0x1fbaf9[_0xee31('0x48')][_0xee31('0x2e')]);return db[_0xee31('0x4b')][_0xee31('0x47')](_0x1fbaf9[_0xee31('0x48')],{'include':[{'model':db[_0xee31('0x52')],'as':'Subjects'},{'model':db[_0xee31('0x52')],'as':_0xee31('0x50')}]});}return null;})[_0xee31('0x24')](respondWithResult(_0x57307d,null))['catch'](handleError(_0x57307d,null));};exports['getFields']=function(_0x3dced3,_0x24853b,_0x3a2d51){var _0x4e51d0=[{'name':_0xee31('0x53'),'label':_0xee31('0x53'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x326573='';return db['DeskAccount']['findOne']({'where':{'id':_0x3dced3['params']['id']},'attributes':['id',_0xee31('0x54'),'authType',_0xee31('0x55'),'password',_0xee31('0x56'),_0xee31('0x57'),'token',_0xee31('0x58')]})[_0xee31('0x24')](handleEntityNotFound(_0x24853b,null))[_0xee31('0x24')](function(_0x97da8f){if(_0x97da8f){_0x326573=_0x97da8f[_0xee31('0x54')];var _0x4b33f2=_0x326573['slice'](-0x1);if(_0x4b33f2==='/'){_0x326573=_0x326573[_0xee31('0x59')](0x0,_0x326573[_0xee31('0x5a')](_0x4b33f2));}var _0x32d563={'method':_0xee31('0x5b'),'uri':util['format'](_0xee31('0x5c'),_0x326573),'headers':{'Content-Type':_0xee31('0x5d'),'Accept':'application/json'},'json':!![]};if(_0x97da8f['authType']===_0xee31('0x5e')){_0x32d563[_0xee31('0x5f')][_0xee31('0x60')]=util[_0xee31('0x61')](_0xee31('0x62'),new Buffer(util[_0xee31('0x61')]('%s:%s',_0x97da8f[_0xee31('0x55')],_0x97da8f[_0xee31('0x63')]))[_0xee31('0x64')]('base64'));}return rp(_0x32d563)['then'](function(_0x5bc880){return _0x4e51d0['concat'](_[_0xee31('0x30')](_0x5bc880['_embedded'][_0xee31('0x65')],function(_0x54846d){return{'id':_0x54846d['name'],'name':_0x54846d[_0xee31('0x28')],'type':_0x54846d[_0xee31('0x2e')],'active':_0x54846d[_0xee31('0x66')],'label':_0x54846d[_0xee31('0x67')],'custom':!![]};}));});}})[_0xee31('0x24')](function(_0x2c3291){return{'count':_0x2c3291[_0xee31('0x36')],'rows':_0x2c3291};})[_0xee31('0x24')](respondWithResult(_0x24853b,null))[_0xee31('0x43')](function(_0x2bd014){var _0x102dcb=_0x3dced3[_0xee31('0x31')][_0xee31('0x68')]?0x1f4:_0x2bd014[_0xee31('0x69')]||0x1f4;logger['error'](_0xee31('0x6a'),_0xee31('0x6b'),_0x102dcb,JSON[_0xee31('0x6c')](_0x2bd014));delete _0x2bd014[_0xee31('0x28')];if(_0x102dcb===0x191){_0x102dcb=0x190;}_0x24853b[_0xee31('0x1a')](_0x102dcb)[_0xee31('0x29')](_0x3dced3[_0xee31('0x31')][_0xee31('0x68')]?{'message':_0xee31('0x6d'),'statusCode':_0x2bd014[_0xee31('0x69')]}:_0x2bd014);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 643812e..3b9e9a6 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 _0x3b64=['util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','DeskAccount','lodash'];(function(_0x4644c7,_0x3188a7){var _0x4bfd9e=function(_0x3d4b3a){while(--_0x3d4b3a){_0x4644c7['push'](_0x4644c7['shift']());}};_0x4bfd9e(++_0x3188a7);}(_0x3b64,0x1af));var _0x43b6=function(_0x1b47e4,_0x1666e4){_0x1b47e4=_0x1b47e4-0x0;var _0x217544=_0x3b64[_0x1b47e4];return _0x217544;};'use strict';var _=require(_0x43b6('0x0'));var util=require(_0x43b6('0x1'));var logger=require(_0x43b6('0x2'))('api');var moment=require(_0x43b6('0x3'));var BPromise=require(_0x43b6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x43b6('0x5'));var rimraf=require(_0x43b6('0x6'));var config=require(_0x43b6('0x7'));var attributes=require(_0x43b6('0x8'));var integrations=require(_0x43b6('0x9'));module[_0x43b6('0xa')]=function(_0x46061e,_0xc55a41){return _0x46061e['define'](_0x43b6('0xb'),attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaf84=['request-promise','path','rimraf','./intDeskAccount.attributes','../../components/integrations/configuration','util','../../config/logger','api','bluebird'];(function(_0xf25599,_0x4e23cf){var _0x3249ba=function(_0x398c16){while(--_0x398c16){_0xf25599['push'](_0xf25599['shift']());}};_0x3249ba(++_0x4e23cf);}(_0xaf84,0x68));var _0x4af8=function(_0x1c6551,_0x3fbc2e){_0x1c6551=_0x1c6551-0x0;var _0x3f7434=_0xaf84[_0x1c6551];return _0x3f7434;};'use strict';var _=require('lodash');var util=require(_0x4af8('0x0'));var logger=require(_0x4af8('0x1'))(_0x4af8('0x2'));var moment=require('moment');var BPromise=require(_0x4af8('0x3'));var rp=require(_0x4af8('0x4'));var fs=require('fs');var path=require(_0x4af8('0x5'));var rimraf=require(_0x4af8('0x6'));var config=require('../../config/environment');var attributes=require(_0x4af8('0x7'));var integrations=require(_0x4af8('0x8'));module['exports']=function(_0x5a96a1,_0xf39536){return _0x5a96a1['define']('DeskAccount',attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index 62dba84..dcee814 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 _0x6ded=['debug','DeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetDeskAccount','findAll','options','raw','where','attributes','limit','include','model','stringify','ShowDeskAccount','DeskAccount','find','map','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x28014d,_0x383e2f){var _0x2572cc=function(_0x17aabd){while(--_0x17aabd){_0x28014d['push'](_0x28014d['shift']());}};_0x2572cc(++_0x383e2f);}(_0x6ded,0xff));var _0xd6de=function(_0x506dd1,_0x4532a0){_0x506dd1=_0x506dd1-0x0;var _0x110493=_0x6ded[_0x506dd1];return _0x110493;};'use strict';var _=require(_0xd6de('0x0'));var util=require(_0xd6de('0x1'));var moment=require(_0xd6de('0x2'));var BPromise=require(_0xd6de('0x3'));var rs=require(_0xd6de('0x4'));var fs=require('fs');var Redis=require(_0xd6de('0x5'));var db=require(_0xd6de('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd6de('0x7'))(_0xd6de('0x8'));var config=require(_0xd6de('0x9'));var jayson=require(_0xd6de('0xa'));var client=jayson[_0xd6de('0xb')][_0xd6de('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xcb3770,_0x10894b,_0x23cb87){return new BPromise(function(_0x111f99,_0x26e6c7){return client[_0xd6de('0xd')](_0xcb3770,_0x23cb87)[_0xd6de('0xe')](function(_0x8378ac){logger[_0xd6de('0xf')](_0xd6de('0x10'),_0x10894b,_0xd6de('0x11'));logger[_0xd6de('0x12')](_0xd6de('0x13'),_0x10894b,_0xd6de('0x11'),JSON['stringify'](_0x8378ac));if(_0x8378ac[_0xd6de('0x14')]){if(_0x8378ac[_0xd6de('0x14')][_0xd6de('0x15')]===0x1f4){logger[_0xd6de('0x14')](_0xd6de('0x10'),_0x10894b,_0x8378ac[_0xd6de('0x14')][_0xd6de('0x16')]);return _0x26e6c7(_0x8378ac[_0xd6de('0x14')]['message']);}logger[_0xd6de('0x14')](_0xd6de('0x10'),_0x10894b,_0x8378ac[_0xd6de('0x14')][_0xd6de('0x16')]);return _0x111f99(_0x8378ac['error'][_0xd6de('0x16')]);}else{logger['info']('DeskAccount,\x20%s,\x20%s',_0x10894b,_0xd6de('0x11'));_0x111f99(_0x8378ac[_0xd6de('0x17')][_0xd6de('0x16')]);}})[_0xd6de('0x18')](function(_0x1ccd73){logger[_0xd6de('0x14')](_0xd6de('0x10'),_0x10894b,_0x1ccd73);_0x26e6c7(_0x1ccd73);});});}exports[_0xd6de('0x19')]=function(_0x5b45a4){var _0x403042=this;return new Promise(function(_0x333fe8,_0x3a0e21){return db['DeskAccount'][_0xd6de('0x1a')]({'raw':_0x5b45a4[_0xd6de('0x1b')]?_0x5b45a4[_0xd6de('0x1b')][_0xd6de('0x1c')]===undefined?!![]:![]:!![],'where':_0x5b45a4[_0xd6de('0x1b')]?_0x5b45a4[_0xd6de('0x1b')][_0xd6de('0x1d')]||null:null,'attributes':_0x5b45a4['options']?_0x5b45a4[_0xd6de('0x1b')][_0xd6de('0x1e')]||null:null,'limit':_0x5b45a4[_0xd6de('0x1b')]?_0x5b45a4[_0xd6de('0x1b')][_0xd6de('0x1f')]||null:null,'include':_0x5b45a4[_0xd6de('0x1b')]?_0x5b45a4[_0xd6de('0x1b')][_0xd6de('0x20')]?_['map'](_0x5b45a4[_0xd6de('0x1b')][_0xd6de('0x20')],function(_0x23b669){return{'model':db[_0x23b669[_0xd6de('0x21')]],'as':_0x23b669['as'],'attributes':_0x23b669[_0xd6de('0x1e')],'include':_0x23b669[_0xd6de('0x20')]?_['map'](_0x23b669[_0xd6de('0x20')],function(_0x23565b){return{'model':db[_0x23565b['model']],'as':_0x23565b['as'],'attributes':_0x23565b['attributes'],'include':_0x23565b[_0xd6de('0x20')]?_['map'](_0x23565b[_0xd6de('0x20')],function(_0xf5b0c5){return{'model':db[_0xf5b0c5[_0xd6de('0x21')]],'as':_0xf5b0c5['as'],'attributes':_0xf5b0c5[_0xd6de('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xd6de('0xe')](function(_0x3eabc7){logger[_0xd6de('0xf')](_0xd6de('0x19'),_0x5b45a4);logger[_0xd6de('0x12')](_0xd6de('0x19'),_0x5b45a4,JSON[_0xd6de('0x22')](_0x3eabc7));_0x333fe8(_0x3eabc7);})[_0xd6de('0x18')](function(_0x3b1a50){logger[_0xd6de('0x14')]('GetDeskAccount',_0x3b1a50[_0xd6de('0x16')],_0x5b45a4);_0x3a0e21(_0x403042[_0xd6de('0x14')](0x1f4,_0x3b1a50[_0xd6de('0x16')]));});});};exports[_0xd6de('0x23')]=function(_0x51a22a){var _0x357fdd=this;return new Promise(function(_0x289b7a,_0x3ee0e3){return db[_0xd6de('0x24')][_0xd6de('0x25')]({'raw':_0x51a22a[_0xd6de('0x1b')]?_0x51a22a[_0xd6de('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x51a22a[_0xd6de('0x1b')]?_0x51a22a[_0xd6de('0x1b')][_0xd6de('0x1d')]||null:null,'attributes':_0x51a22a[_0xd6de('0x1b')]?_0x51a22a[_0xd6de('0x1b')][_0xd6de('0x1e')]||null:null,'include':_0x51a22a[_0xd6de('0x1b')]?_0x51a22a[_0xd6de('0x1b')][_0xd6de('0x20')]?_[_0xd6de('0x26')](_0x51a22a['options'][_0xd6de('0x20')],function(_0x428d54){return{'model':db[_0x428d54[_0xd6de('0x21')]],'as':_0x428d54['as'],'attributes':_0x428d54['attributes'],'include':_0x428d54[_0xd6de('0x20')]?_[_0xd6de('0x26')](_0x428d54[_0xd6de('0x20')],function(_0x1b5579){return{'model':db[_0x1b5579[_0xd6de('0x21')]],'as':_0x1b5579['as'],'attributes':_0x1b5579[_0xd6de('0x1e')],'include':_0x1b5579[_0xd6de('0x20')]?_[_0xd6de('0x26')](_0x1b5579['include'],function(_0xce2f46){return{'model':db[_0xce2f46[_0xd6de('0x21')]],'as':_0xce2f46['as'],'attributes':_0xce2f46['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5d5af8){logger[_0xd6de('0xf')]('ShowDeskAccount',_0x51a22a);logger[_0xd6de('0x12')](_0xd6de('0x23'),_0x51a22a,JSON[_0xd6de('0x22')](_0x5d5af8));_0x289b7a(_0x5d5af8);})['catch'](function(_0x4be772){logger[_0xd6de('0x14')](_0xd6de('0x23'),_0x4be772[_0xd6de('0x16')],_0x51a22a);_0x3ee0e3(_0x357fdd[_0xd6de('0x14')](0x1f4,_0x4be772['message']));});});}; \ No newline at end of file +var _0xcde6=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','info','DeskAccount,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','DeskAccount','findAll','options','raw','where','attributes','include','map','model','GetDeskAccount','debug','find','then','ShowDeskAccount','lodash','util'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xcde6,0x1da));var _0x6cde=function(_0x35b1e5,_0x386163){_0x35b1e5=_0x35b1e5-0x0;var _0x1c5ce4=_0xcde6[_0x35b1e5];return _0x1c5ce4;};'use strict';var _=require(_0x6cde('0x0'));var util=require(_0x6cde('0x1'));var moment=require(_0x6cde('0x2'));var BPromise=require(_0x6cde('0x3'));var rs=require(_0x6cde('0x4'));var fs=require('fs');var Redis=require(_0x6cde('0x5'));var db=require(_0x6cde('0x6'))['db'];var utils=require(_0x6cde('0x7'));var logger=require(_0x6cde('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6cde('0x9'));var client=jayson[_0x6cde('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f0adf,_0x4cc5c2,_0x18260b){return new BPromise(function(_0x29771f,_0x1716f2){return client['request'](_0x4f0adf,_0x18260b)['then'](function(_0x809632){logger[_0x6cde('0xb')](_0x6cde('0xc'),_0x4cc5c2,_0x6cde('0xd'));logger['debug']('DeskAccount,\x20%s,\x20%s,\x20%s',_0x4cc5c2,_0x6cde('0xd'),JSON[_0x6cde('0xe')](_0x809632));if(_0x809632['error']){if(_0x809632['error'][_0x6cde('0xf')]===0x1f4){logger[_0x6cde('0x10')](_0x6cde('0xc'),_0x4cc5c2,_0x809632[_0x6cde('0x10')][_0x6cde('0x11')]);return _0x1716f2(_0x809632[_0x6cde('0x10')][_0x6cde('0x11')]);}logger[_0x6cde('0x10')](_0x6cde('0xc'),_0x4cc5c2,_0x809632[_0x6cde('0x10')][_0x6cde('0x11')]);return _0x29771f(_0x809632[_0x6cde('0x10')][_0x6cde('0x11')]);}else{logger['info']('DeskAccount,\x20%s,\x20%s',_0x4cc5c2,_0x6cde('0xd'));_0x29771f(_0x809632[_0x6cde('0x12')][_0x6cde('0x11')]);}})[_0x6cde('0x13')](function(_0x2fcda5){logger[_0x6cde('0x10')](_0x6cde('0xc'),_0x4cc5c2,_0x2fcda5);_0x1716f2(_0x2fcda5);});});}exports['GetDeskAccount']=function(_0x467e52){var _0xb6a88e=this;return new Promise(function(_0x28762f,_0x5a8b97){return db[_0x6cde('0x14')][_0x6cde('0x15')]({'raw':_0x467e52[_0x6cde('0x16')]?_0x467e52[_0x6cde('0x16')][_0x6cde('0x17')]===undefined?!![]:![]:!![],'where':_0x467e52['options']?_0x467e52['options'][_0x6cde('0x18')]||null:null,'attributes':_0x467e52[_0x6cde('0x16')]?_0x467e52[_0x6cde('0x16')][_0x6cde('0x19')]||null:null,'limit':_0x467e52[_0x6cde('0x16')]?_0x467e52[_0x6cde('0x16')]['limit']||null:null,'include':_0x467e52[_0x6cde('0x16')]?_0x467e52['options'][_0x6cde('0x1a')]?_[_0x6cde('0x1b')](_0x467e52['options']['include'],function(_0x534e6a){return{'model':db[_0x534e6a[_0x6cde('0x1c')]],'as':_0x534e6a['as'],'attributes':_0x534e6a[_0x6cde('0x19')],'include':_0x534e6a['include']?_['map'](_0x534e6a['include'],function(_0x581fed){return{'model':db[_0x581fed[_0x6cde('0x1c')]],'as':_0x581fed['as'],'attributes':_0x581fed[_0x6cde('0x19')],'include':_0x581fed['include']?_[_0x6cde('0x1b')](_0x581fed[_0x6cde('0x1a')],function(_0x419570){return{'model':db[_0x419570[_0x6cde('0x1c')]],'as':_0x419570['as'],'attributes':_0x419570[_0x6cde('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x18e71f){logger[_0x6cde('0xb')](_0x6cde('0x1d'),_0x467e52);logger[_0x6cde('0x1e')](_0x6cde('0x1d'),_0x467e52,JSON[_0x6cde('0xe')](_0x18e71f));_0x28762f(_0x18e71f);})[_0x6cde('0x13')](function(_0x84b923){logger[_0x6cde('0x10')](_0x6cde('0x1d'),_0x84b923[_0x6cde('0x11')],_0x467e52);_0x5a8b97(_0xb6a88e[_0x6cde('0x10')](0x1f4,_0x84b923[_0x6cde('0x11')]));});});};exports['ShowDeskAccount']=function(_0x44c539){var _0x12bad6=this;return new Promise(function(_0x2e1ae6,_0x4245fc){return db['DeskAccount'][_0x6cde('0x1f')]({'raw':_0x44c539[_0x6cde('0x16')]?_0x44c539[_0x6cde('0x16')][_0x6cde('0x17')]===undefined?!![]:![]:!![],'where':_0x44c539[_0x6cde('0x16')]?_0x44c539[_0x6cde('0x16')][_0x6cde('0x18')]||null:null,'attributes':_0x44c539['options']?_0x44c539[_0x6cde('0x16')][_0x6cde('0x19')]||null:null,'include':_0x44c539[_0x6cde('0x16')]?_0x44c539[_0x6cde('0x16')][_0x6cde('0x1a')]?_['map'](_0x44c539[_0x6cde('0x16')]['include'],function(_0x1a8226){return{'model':db[_0x1a8226[_0x6cde('0x1c')]],'as':_0x1a8226['as'],'attributes':_0x1a8226[_0x6cde('0x19')],'include':_0x1a8226[_0x6cde('0x1a')]?_['map'](_0x1a8226[_0x6cde('0x1a')],function(_0x3af6cb){return{'model':db[_0x3af6cb[_0x6cde('0x1c')]],'as':_0x3af6cb['as'],'attributes':_0x3af6cb[_0x6cde('0x19')],'include':_0x3af6cb[_0x6cde('0x1a')]?_[_0x6cde('0x1b')](_0x3af6cb[_0x6cde('0x1a')],function(_0xa847ef){return{'model':db[_0xa847ef['model']],'as':_0xa847ef['as'],'attributes':_0xa847ef[_0x6cde('0x19')]};}):[]};}):[]};}):[]:[]})[_0x6cde('0x20')](function(_0x1b588f){logger[_0x6cde('0xb')]('ShowDeskAccount',_0x44c539);logger[_0x6cde('0x1e')](_0x6cde('0x21'),_0x44c539,JSON[_0x6cde('0xe')](_0x1b588f));_0x2e1ae6(_0x1b588f);})[_0x6cde('0x13')](function(_0x4e08c9){logger[_0x6cde('0x10')](_0x6cde('0x21'),_0x4e08c9[_0x6cde('0x11')],_0x44c539);_0x4245fc(_0x12bad6[_0x6cde('0x10')](0x1f4,_0x4e08c9[_0x6cde('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index e63e626..12db915 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 _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(_0x5bb4cb,_0x4b9b79){var _0x1d7aee=function(_0x17ffaa){while(--_0x17ffaa){_0x5bb4cb['push'](_0x5bb4cb['shift']());}};_0x1d7aee(++_0x4b9b79);}(_0x008c,0x188));var _0xc008=function(_0x4b8212,_0x37d755){_0x4b8212=_0x4b8212-0x0;var _0x54de6e=_0x008c[_0x4b8212];return _0x54de6e;};'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 +var _0x9957=['/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields'];(function(_0x5ec849,_0x423036){var _0x54d580=function(_0x798c5a){while(--_0x798c5a){_0x5ec849['push'](_0x5ec849['shift']());}};_0x54d580(++_0x423036);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/fields',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/descriptions',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x14')]('/:id/tags',auth['isAuthenticated'](),controller[_0x7995('0x16')]);router[_0x7995('0x17')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller['destroy']);module[_0x7995('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index be3cd27..63afcff 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 _0x9ff1=['sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9ff1,0x180));var _0x19ff=function(_0x1f73e6,_0x3e8e99){_0x1f73e6=_0x1f73e6-0x0;var _0x33b417=_0x9ff1[_0x1f73e6];return _0x33b417;};'use strict';var Sequelize=require(_0x19ff('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xae4e=['STRING','exports'];(function(_0x415aba,_0x35def2){var _0x2ecf62=function(_0x3a43fe){while(--_0x3a43fe){_0x415aba['push'](_0x415aba['shift']());}};_0x2ecf62(++_0x35def2);}(_0xae4e,0x11d));var _0xeae4=function(_0x19ec23,_0x25e81b){_0x19ec23=_0x19ec23-0x0;var _0x2e8c05=_0xae4e[_0x19ec23];return _0x2e8c05;};'use strict';var Sequelize=require('sequelize');module[_0xeae4('0x0')]={'name':{'type':Sequelize[_0xeae4('0x1')]},'description':{'type':Sequelize[_0xeae4('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index b18c564..bff8bdd 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 _0x23b4=['getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','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/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','error','stack','name','send','map','DeskConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','find','create','update','body','DeskField','order','pick','getFields','getSubjects','findOne','getDescriptions'];(function(_0x23f877,_0x3494f3){var _0x39f573=function(_0x16b815){while(--_0x16b815){_0x23f877['push'](_0x23f877['shift']());}};_0x39f573(++_0x3494f3);}(_0x23b4,0x1ac));var _0x423b=function(_0xac151d,_0x4ea1d2){_0xac151d=_0xac151d-0x0;var _0x111dba=_0x23b4[_0xac151d];return _0x111dba;};'use strict';var emlformat=require(_0x423b('0x0'));var rimraf=require(_0x423b('0x1'));var zipdir=require(_0x423b('0x2'));var jsonpatch=require(_0x423b('0x3'));var rp=require(_0x423b('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x423b('0x5'));var util=require(_0x423b('0x6'));var path=require('path');var sox=require(_0x423b('0x7'));var csv=require(_0x423b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x423b('0x9'));var _=require('lodash');var squel=require(_0x423b('0xa'));var crypto=require(_0x423b('0xb'));var jsforce=require(_0x423b('0xc'));var deskjs=require(_0x423b('0xd'));var toCsv=require(_0x423b('0x8'));var querystring=require(_0x423b('0xe'));var Papa=require(_0x423b('0xf'));var Redis=require(_0x423b('0x10'));var authService=require(_0x423b('0x11'));var qs=require(_0x423b('0x12'));var as=require(_0x423b('0x13'));var hardwareService=require(_0x423b('0x14'));var logger=require(_0x423b('0x15'))(_0x423b('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x423b('0x17'));var db=require(_0x423b('0x18'))['db'];function respondWithStatusCode(_0x347429,_0x38e782){_0x38e782=_0x38e782||0xcc;return function(_0x6c392a){if(_0x6c392a){return _0x347429[_0x423b('0x19')](_0x38e782);}return _0x347429[_0x423b('0x1a')](_0x38e782)[_0x423b('0x1b')]();};}function respondWithResult(_0x1b059f,_0x1ced6d){_0x1ced6d=_0x1ced6d||0xc8;return function(_0x329a47){if(_0x329a47){return _0x1b059f['status'](_0x1ced6d)[_0x423b('0x1c')](_0x329a47);}};}function respondWithFilteredResult(_0x583945,_0x5cf3c5){return function(_0xea0e6b){if(_0xea0e6b){var _0x4980ea=typeof _0x5cf3c5[_0x423b('0x1d')]===_0x423b('0x1e')&&typeof _0x5cf3c5[_0x423b('0x1f')]===_0x423b('0x1e');var _0x35a8d0=_0xea0e6b[_0x423b('0x20')];var _0xc02890=_0x4980ea?0x0:_0x5cf3c5['offset'];var _0x5e76d2=_0x4980ea?_0xea0e6b[_0x423b('0x20')]:_0x5cf3c5[_0x423b('0x1d')]+_0x5cf3c5[_0x423b('0x1f')];var _0x44b2e0;if(_0x5e76d2>=_0x35a8d0){_0x5e76d2=_0x35a8d0;_0x44b2e0=0xc8;}else{_0x44b2e0=0xce;}_0x583945[_0x423b('0x1a')](_0x44b2e0);return _0x583945[_0x423b('0x21')](_0x423b('0x22'),_0xc02890+'-'+_0x5e76d2+'/'+_0x35a8d0)[_0x423b('0x1c')](_0xea0e6b);}return null;};}function patchUpdates(_0x1a1f53){return function(_0x2faa7f){try{jsonpatch['apply'](_0x2faa7f,_0x1a1f53,!![]);}catch(_0x257f43){return BPromise[_0x423b('0x23')](_0x257f43);}return _0x2faa7f[_0x423b('0x24')]();};}function saveUpdates(_0x31d790,_0xbac8c8){return function(_0x4757a1){if(_0x4757a1){return _0x4757a1['update'](_0x31d790)[_0x423b('0x25')](function(_0x22375f){return _0x22375f;});}return null;};}function removeEntity(_0xcd5897,_0x4bbfc0){return function(_0x184a9f){if(_0x184a9f){return _0x184a9f[_0x423b('0x26')]()[_0x423b('0x25')](function(){_0xcd5897[_0x423b('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b2fb8,_0x2dd57e){return function(_0x42962f){if(!_0x42962f){_0x3b2fb8[_0x423b('0x19')](0x194);}return _0x42962f;};}function handleError(_0x126c05,_0x4dc378){_0x4dc378=_0x4dc378||0x1f4;return function(_0x3605cd){logger[_0x423b('0x27')](_0x3605cd[_0x423b('0x28')]);if(_0x3605cd[_0x423b('0x29')]){delete _0x3605cd['name'];}_0x126c05[_0x423b('0x1a')](_0x4dc378)[_0x423b('0x2a')](_0x3605cd);};}exports['index']=function(_0x3a1c24,_0x4d7f8e){var _0x63d44c={},_0x1765d7={},_0x1a97ae={'count':0x0,'rows':[]};var _0x1dcf1c=_[_0x423b('0x2b')](db[_0x423b('0x2c')][_0x423b('0x2d')],function(_0x5835b7){return{'name':_0x5835b7[_0x423b('0x2e')],'type':_0x5835b7[_0x423b('0x2f')][_0x423b('0x30')]};});_0x1765d7['model']=_[_0x423b('0x2b')](_0x1dcf1c,_0x423b('0x29'));_0x1765d7[_0x423b('0x31')]=_[_0x423b('0x32')](_0x3a1c24['query']);_0x1765d7[_0x423b('0x33')]=_[_0x423b('0x34')](_0x1765d7[_0x423b('0x35')],_0x1765d7[_0x423b('0x31')]);_0x63d44c[_0x423b('0x36')]=_[_0x423b('0x34')](_0x1765d7[_0x423b('0x35')],qs['fields'](_0x3a1c24['query'][_0x423b('0x37')]));_0x63d44c['attributes']=_0x63d44c['attributes'][_0x423b('0x38')]?_0x63d44c[_0x423b('0x36')]:_0x1765d7[_0x423b('0x35')];if(!_0x3a1c24[_0x423b('0x31')][_0x423b('0x39')](_0x423b('0x3a'))){_0x63d44c[_0x423b('0x1f')]=qs['limit'](_0x3a1c24[_0x423b('0x31')][_0x423b('0x1f')]);_0x63d44c[_0x423b('0x1d')]=qs[_0x423b('0x1d')](_0x3a1c24[_0x423b('0x31')][_0x423b('0x1d')]);}_0x63d44c['order']=qs[_0x423b('0x3b')](_0x3a1c24[_0x423b('0x31')][_0x423b('0x3b')]);_0x63d44c['where']=qs[_0x423b('0x33')](_['pick'](_0x3a1c24[_0x423b('0x31')],_0x1765d7['filters']),_0x1dcf1c);if(_0x3a1c24[_0x423b('0x31')]['filter']){_0x63d44c[_0x423b('0x3c')]=_[_0x423b('0x3d')](_0x63d44c[_0x423b('0x3c')],{'$or':_['map'](_0x1dcf1c,function(_0x2efbf9){if(_0x2efbf9[_0x423b('0x2f')]!==_0x423b('0x3e')){var _0x477814={};_0x477814[_0x2efbf9[_0x423b('0x29')]]={'$like':'%'+_0x3a1c24[_0x423b('0x31')][_0x423b('0x3f')]+'%'};return _0x477814;}})});}_0x63d44c=_['merge']({},_0x63d44c,_0x3a1c24[_0x423b('0x40')]);var _0x2627ff={'where':_0x63d44c[_0x423b('0x3c')]};return db[_0x423b('0x2c')][_0x423b('0x20')](_0x2627ff)['then'](function(_0x4b52eb){_0x1a97ae[_0x423b('0x20')]=_0x4b52eb;if(_0x3a1c24[_0x423b('0x31')][_0x423b('0x41')]){_0x63d44c[_0x423b('0x42')]=[{'all':!![]}];}return db[_0x423b('0x2c')][_0x423b('0x43')](_0x63d44c);})[_0x423b('0x25')](function(_0x9249de){_0x1a97ae[_0x423b('0x44')]=_0x9249de;return _0x1a97ae;})[_0x423b('0x25')](respondWithFilteredResult(_0x4d7f8e,_0x63d44c))[_0x423b('0x45')](handleError(_0x4d7f8e,null));};exports['show']=function(_0x29cdc5,_0x2a28d7){var _0x3c40f5={'raw':![],'where':{'id':_0x29cdc5[_0x423b('0x46')]['id']}},_0x22460b={};_0x22460b[_0x423b('0x35')]=_[_0x423b('0x32')](db[_0x423b('0x2c')][_0x423b('0x2d')]);_0x22460b['query']=_[_0x423b('0x32')](_0x29cdc5[_0x423b('0x31')]);_0x22460b['filters']=_['intersection'](_0x22460b['model'],_0x22460b['query']);_0x3c40f5['attributes']=_[_0x423b('0x34')](_0x22460b[_0x423b('0x35')],qs[_0x423b('0x37')](_0x29cdc5['query']['fields']));_0x3c40f5[_0x423b('0x36')]=_0x3c40f5[_0x423b('0x36')]['length']?_0x3c40f5[_0x423b('0x36')]:_0x22460b[_0x423b('0x35')];if(_0x29cdc5[_0x423b('0x31')]['includeAll']){_0x3c40f5[_0x423b('0x42')]=[{'all':!![]}];}_0x3c40f5=_[_0x423b('0x3d')]({},_0x3c40f5,_0x29cdc5[_0x423b('0x40')]);return db['DeskConfiguration'][_0x423b('0x47')](_0x3c40f5)[_0x423b('0x25')](handleEntityNotFound(_0x2a28d7,null))['then'](respondWithResult(_0x2a28d7,null))[_0x423b('0x45')](handleError(_0x2a28d7,null));};exports['create']=function(_0x4e47ab,_0x3d66c7){return db[_0x423b('0x2c')][_0x423b('0x48')](_0x4e47ab['body'],{})[_0x423b('0x25')](respondWithResult(_0x3d66c7,0xc9))[_0x423b('0x45')](handleError(_0x3d66c7,null));};exports[_0x423b('0x49')]=function(_0x46af8f,_0x14f2af){if(_0x46af8f[_0x423b('0x4a')]['id']){delete _0x46af8f[_0x423b('0x4a')]['id'];}return db[_0x423b('0x2c')][_0x423b('0x47')]({'where':{'id':_0x46af8f[_0x423b('0x46')]['id']}})['then'](handleEntityNotFound(_0x14f2af,null))[_0x423b('0x25')](saveUpdates(_0x46af8f[_0x423b('0x4a')],null))[_0x423b('0x25')](respondWithResult(_0x14f2af,null))[_0x423b('0x45')](handleError(_0x14f2af,null));};exports[_0x423b('0x26')]=function(_0x191656,_0x2549c5){return db['DeskConfiguration'][_0x423b('0x47')]({'where':{'id':_0x191656[_0x423b('0x46')]['id']}})['then'](handleEntityNotFound(_0x2549c5,null))[_0x423b('0x25')](removeEntity(_0x2549c5,null))[_0x423b('0x45')](handleError(_0x2549c5,null));};exports['getFields']=function(_0x5325b4,_0x501e2c,_0x4e2bf9){var _0x25f44b={};var _0x2cac66={};var _0x39f88b;var _0x516771;return db['DeskConfiguration']['findOne']({'where':{'id':_0x5325b4['params']['id']}})['then'](handleEntityNotFound(_0x501e2c,null))[_0x423b('0x25')](function(_0x236347){if(_0x236347){_0x39f88b=_0x236347;_0x2cac66['model']=_[_0x423b('0x32')](db[_0x423b('0x4b')][_0x423b('0x2d')]);_0x2cac66['query']=_[_0x423b('0x32')](_0x5325b4[_0x423b('0x31')]);_0x2cac66[_0x423b('0x33')]=_['intersection'](_0x2cac66[_0x423b('0x35')],_0x2cac66[_0x423b('0x31')]);_0x25f44b[_0x423b('0x36')]=_['intersection'](_0x2cac66[_0x423b('0x35')],qs['fields'](_0x5325b4[_0x423b('0x31')][_0x423b('0x37')]));_0x25f44b['attributes']=_0x25f44b[_0x423b('0x36')]['length']?_0x25f44b[_0x423b('0x36')]:_0x2cac66[_0x423b('0x35')];_0x25f44b[_0x423b('0x4c')]=qs[_0x423b('0x3b')](_0x5325b4[_0x423b('0x31')][_0x423b('0x3b')]);_0x25f44b['where']=qs[_0x423b('0x33')](_[_0x423b('0x4d')](_0x5325b4[_0x423b('0x31')],_0x2cac66[_0x423b('0x33')]));if(_0x5325b4[_0x423b('0x31')][_0x423b('0x3f')]){_0x25f44b[_0x423b('0x3c')]=_[_0x423b('0x3d')](_0x25f44b[_0x423b('0x3c')],{'$or':_[_0x423b('0x2b')](_0x25f44b[_0x423b('0x36')],function(_0x1015b0){var _0xf9b285={};_0xf9b285[_0x1015b0]={'$like':'%'+_0x5325b4[_0x423b('0x31')][_0x423b('0x3f')]+'%'};return _0xf9b285;})});}_0x25f44b=_['merge']({},_0x25f44b,_0x5325b4[_0x423b('0x40')]);return _0x39f88b[_0x423b('0x4e')](_0x25f44b);}})[_0x423b('0x25')](function(_0x1e85ba){if(_0x1e85ba){_0x516771=_0x1e85ba[_0x423b('0x38')];if(!_0x5325b4[_0x423b('0x31')][_0x423b('0x39')](_0x423b('0x3a'))){_0x25f44b[_0x423b('0x1f')]=qs['limit'](_0x5325b4['query'][_0x423b('0x1f')]);_0x25f44b['offset']=qs['offset'](_0x5325b4['query'][_0x423b('0x1d')]);}return _0x39f88b[_0x423b('0x4e')](_0x25f44b);}})[_0x423b('0x25')](function(_0x2a794e){if(_0x2a794e){return _0x2a794e?{'count':_0x516771,'rows':_0x2a794e}:null;}})[_0x423b('0x25')](respondWithResult(_0x501e2c,null))[_0x423b('0x45')](handleError(_0x501e2c,null));};exports[_0x423b('0x4f')]=function(_0x16d289,_0x340ade,_0x2ffaf9){var _0x1a9ebf={};var _0x51a1ed={};var _0x581500;var _0x172ec9;return db[_0x423b('0x2c')][_0x423b('0x50')]({'where':{'id':_0x16d289[_0x423b('0x46')]['id']}})['then'](handleEntityNotFound(_0x340ade,null))[_0x423b('0x25')](function(_0x5f3f14){if(_0x5f3f14){_0x581500=_0x5f3f14;_0x51a1ed[_0x423b('0x35')]=_[_0x423b('0x32')](db[_0x423b('0x4b')]['rawAttributes']);_0x51a1ed[_0x423b('0x31')]=_[_0x423b('0x32')](_0x16d289[_0x423b('0x31')]);_0x51a1ed['filters']=_[_0x423b('0x34')](_0x51a1ed[_0x423b('0x35')],_0x51a1ed['query']);_0x1a9ebf['attributes']=_[_0x423b('0x34')](_0x51a1ed['model'],qs[_0x423b('0x37')](_0x16d289['query']['fields']));_0x1a9ebf[_0x423b('0x36')]=_0x1a9ebf[_0x423b('0x36')]['length']?_0x1a9ebf[_0x423b('0x36')]:_0x51a1ed[_0x423b('0x35')];_0x1a9ebf[_0x423b('0x4c')]=qs[_0x423b('0x3b')](_0x16d289[_0x423b('0x31')][_0x423b('0x3b')]);_0x1a9ebf[_0x423b('0x3c')]=qs[_0x423b('0x33')](_[_0x423b('0x4d')](_0x16d289[_0x423b('0x31')],_0x51a1ed[_0x423b('0x33')]));if(_0x16d289[_0x423b('0x31')][_0x423b('0x3f')]){_0x1a9ebf[_0x423b('0x3c')]=_[_0x423b('0x3d')](_0x1a9ebf[_0x423b('0x3c')],{'$or':_[_0x423b('0x2b')](_0x1a9ebf['attributes'],function(_0x54bc6e){var _0x3c8b21={};_0x3c8b21[_0x54bc6e]={'$like':'%'+_0x16d289[_0x423b('0x31')][_0x423b('0x3f')]+'%'};return _0x3c8b21;})});}_0x1a9ebf=_[_0x423b('0x3d')]({},_0x1a9ebf,_0x16d289['options']);return _0x581500['getSubjects'](_0x1a9ebf);}})['then'](function(_0x183c1d){if(_0x183c1d){_0x172ec9=_0x183c1d['length'];if(!_0x16d289['query'][_0x423b('0x39')](_0x423b('0x3a'))){_0x1a9ebf[_0x423b('0x1f')]=qs[_0x423b('0x1f')](_0x16d289[_0x423b('0x31')][_0x423b('0x1f')]);_0x1a9ebf[_0x423b('0x1d')]=qs[_0x423b('0x1d')](_0x16d289[_0x423b('0x31')][_0x423b('0x1d')]);}return _0x581500[_0x423b('0x4f')](_0x1a9ebf);}})[_0x423b('0x25')](function(_0x39adda){if(_0x39adda){return _0x39adda?{'count':_0x172ec9,'rows':_0x39adda}:null;}})[_0x423b('0x25')](respondWithResult(_0x340ade,null))[_0x423b('0x45')](handleError(_0x340ade,null));};exports[_0x423b('0x51')]=function(_0x578dde,_0x86f26a,_0x390869){var _0x5259f3={};var _0x38f92d={};var _0x533ef0;var _0x49e3ec;return db[_0x423b('0x2c')][_0x423b('0x50')]({'where':{'id':_0x578dde[_0x423b('0x46')]['id']}})[_0x423b('0x25')](handleEntityNotFound(_0x86f26a,null))[_0x423b('0x25')](function(_0x237cb2){if(_0x237cb2){_0x533ef0=_0x237cb2;_0x38f92d[_0x423b('0x35')]=_[_0x423b('0x32')](db[_0x423b('0x4b')][_0x423b('0x2d')]);_0x38f92d[_0x423b('0x31')]=_[_0x423b('0x32')](_0x578dde['query']);_0x38f92d[_0x423b('0x33')]=_['intersection'](_0x38f92d[_0x423b('0x35')],_0x38f92d[_0x423b('0x31')]);_0x5259f3[_0x423b('0x36')]=_[_0x423b('0x34')](_0x38f92d['model'],qs[_0x423b('0x37')](_0x578dde[_0x423b('0x31')][_0x423b('0x37')]));_0x5259f3['attributes']=_0x5259f3['attributes']['length']?_0x5259f3[_0x423b('0x36')]:_0x38f92d[_0x423b('0x35')];_0x5259f3[_0x423b('0x4c')]=qs['sort'](_0x578dde[_0x423b('0x31')][_0x423b('0x3b')]);_0x5259f3[_0x423b('0x3c')]=qs[_0x423b('0x33')](_['pick'](_0x578dde['query'],_0x38f92d[_0x423b('0x33')]));if(_0x578dde[_0x423b('0x31')][_0x423b('0x3f')]){_0x5259f3[_0x423b('0x3c')]=_[_0x423b('0x3d')](_0x5259f3[_0x423b('0x3c')],{'$or':_['map'](_0x5259f3['attributes'],function(_0x23508f){var _0x1156bc={};_0x1156bc[_0x23508f]={'$like':'%'+_0x578dde[_0x423b('0x31')]['filter']+'%'};return _0x1156bc;})});}_0x5259f3=_['merge']({},_0x5259f3,_0x578dde[_0x423b('0x40')]);return _0x533ef0['getDescriptions'](_0x5259f3);}})[_0x423b('0x25')](function(_0x5eb1d2){if(_0x5eb1d2){_0x49e3ec=_0x5eb1d2[_0x423b('0x38')];if(!_0x578dde[_0x423b('0x31')]['hasOwnProperty'](_0x423b('0x3a'))){_0x5259f3[_0x423b('0x1f')]=qs[_0x423b('0x1f')](_0x578dde['query']['limit']);_0x5259f3[_0x423b('0x1d')]=qs[_0x423b('0x1d')](_0x578dde[_0x423b('0x31')]['offset']);}return _0x533ef0['getDescriptions'](_0x5259f3);}})['then'](function(_0x4f37e1){if(_0x4f37e1){return _0x4f37e1?{'count':_0x49e3ec,'rows':_0x4f37e1}:null;}})[_0x423b('0x25')](respondWithResult(_0x86f26a,null))['catch'](handleError(_0x86f26a,null));};exports[_0x423b('0x52')]=function(_0x5777e5,_0x2af8b5,_0x5b31d1){var _0x1bfd84={};var _0x21db2b={};var _0x380c78;var _0x52fa08;return db[_0x423b('0x2c')][_0x423b('0x50')]({'where':{'id':_0x5777e5[_0x423b('0x46')]['id']}})[_0x423b('0x25')](handleEntityNotFound(_0x2af8b5,null))[_0x423b('0x25')](function(_0x111f21){if(_0x111f21){_0x380c78=_0x111f21;_0x21db2b[_0x423b('0x35')]=_[_0x423b('0x32')](db['Tag'][_0x423b('0x2d')]);_0x21db2b[_0x423b('0x31')]=_[_0x423b('0x32')](_0x5777e5['query']);_0x21db2b['filters']=_['intersection'](_0x21db2b['model'],_0x21db2b[_0x423b('0x31')]);_0x1bfd84[_0x423b('0x36')]=_[_0x423b('0x34')](_0x21db2b['model'],qs[_0x423b('0x37')](_0x5777e5[_0x423b('0x31')][_0x423b('0x37')]));_0x1bfd84[_0x423b('0x36')]=_0x1bfd84[_0x423b('0x36')]['length']?_0x1bfd84['attributes']:_0x21db2b['model'];_0x1bfd84[_0x423b('0x4c')]=qs['sort'](_0x5777e5['query'][_0x423b('0x3b')]);_0x1bfd84[_0x423b('0x3c')]=qs[_0x423b('0x33')](_[_0x423b('0x4d')](_0x5777e5['query'],_0x21db2b[_0x423b('0x33')]));if(_0x5777e5['query']['filter']){_0x1bfd84[_0x423b('0x3c')]=_['merge'](_0x1bfd84['where'],{'$or':_['map'](_0x1bfd84[_0x423b('0x36')],function(_0x1efb4c){var _0x377d34={};_0x377d34[_0x1efb4c]={'$like':'%'+_0x5777e5[_0x423b('0x31')][_0x423b('0x3f')]+'%'};return _0x377d34;})});}_0x1bfd84=_[_0x423b('0x3d')]({},_0x1bfd84,_0x5777e5[_0x423b('0x40')]);return _0x380c78['getTags'](_0x1bfd84);}})['then'](function(_0x5b227d){if(_0x5b227d){_0x52fa08=_0x5b227d[_0x423b('0x38')];if(!_0x5777e5[_0x423b('0x31')][_0x423b('0x39')](_0x423b('0x3a'))){_0x1bfd84[_0x423b('0x1f')]=qs['limit'](_0x5777e5[_0x423b('0x31')]['limit']);_0x1bfd84[_0x423b('0x1d')]=qs['offset'](_0x5777e5[_0x423b('0x31')][_0x423b('0x1d')]);}return _0x380c78[_0x423b('0x52')](_0x1bfd84);}})[_0x423b('0x25')](function(_0x374a64){if(_0x374a64){return _0x374a64?{'count':_0x52fa08,'rows':_0x374a64}:null;}})[_0x423b('0x25')](respondWithResult(_0x2af8b5,null))[_0x423b('0x45')](handleError(_0x2af8b5,null));};exports['setTags']=function(_0x46029d,_0x4900c8,_0x3f4633){if(_0x46029d[_0x423b('0x4a')]['id']){delete _0x46029d[_0x423b('0x4a')]['id'];}return db[_0x423b('0x2c')][_0x423b('0x50')]({'where':{'id':_0x46029d['params']['id']}})[_0x423b('0x25')](handleEntityNotFound(_0x4900c8,null))['then'](function(_0x31c861){if(_0x31c861){return _0x31c861[_0x423b('0x53')](_0x46029d['body'][_0x423b('0x54')]||[]);}return null;})[_0x423b('0x25')](respondWithResult(_0x4900c8,null))[_0x423b('0x45')](handleError(_0x4900c8,null));}; \ No newline at end of file +var _0x024b=['end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','map','DeskConfiguration','rawAttributes','type','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','getFields','DeskField','pick','hasOwnProperty','getSubjects','getDescriptions','findOne','Tag','getTags','setTags','ids','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x024b,0xe4));var _0xb024=function(_0x438e4d,_0x529810){_0x438e4d=_0x438e4d-0x0;var _0x4e6283=_0x024b[_0x438e4d];return _0x4e6283;};'use strict';var emlformat=require(_0xb024('0x0'));var rimraf=require(_0xb024('0x1'));var zipdir=require(_0xb024('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb024('0x3'));var moment=require(_0xb024('0x4'));var BPromise=require(_0xb024('0x5'));var Mustache=require(_0xb024('0x6'));var util=require('util');var path=require(_0xb024('0x7'));var sox=require(_0xb024('0x8'));var csv=require('to-csv');var ejs=require(_0xb024('0x9'));var fs=require('fs');var fs_extra=require(_0xb024('0xa'));var _=require('lodash');var squel=require(_0xb024('0xb'));var crypto=require(_0xb024('0xc'));var jsforce=require(_0xb024('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb024('0xe'));var querystring=require(_0xb024('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb024('0x10'));var qs=require(_0xb024('0x11'));var as=require(_0xb024('0x12'));var hardwareService=require(_0xb024('0x13'));var logger=require('../../config/logger')(_0xb024('0x14'));var utils=require(_0xb024('0x15'));var config=require(_0xb024('0x16'));var licenseUtil=require(_0xb024('0x17'));var db=require(_0xb024('0x18'))['db'];function respondWithStatusCode(_0x529041,_0x2b9ef4){_0x2b9ef4=_0x2b9ef4||0xcc;return function(_0x123070){if(_0x123070){return _0x529041[_0xb024('0x19')](_0x2b9ef4);}return _0x529041[_0xb024('0x1a')](_0x2b9ef4)[_0xb024('0x1b')]();};}function respondWithResult(_0x43bf77,_0x33070b){_0x33070b=_0x33070b||0xc8;return function(_0x110f66){if(_0x110f66){return _0x43bf77[_0xb024('0x1a')](_0x33070b)[_0xb024('0x1c')](_0x110f66);}};}function respondWithFilteredResult(_0x52db23,_0x3db89c){return function(_0x5daa42){if(_0x5daa42){var _0x30c351=typeof _0x3db89c[_0xb024('0x1d')]===_0xb024('0x1e')&&typeof _0x3db89c[_0xb024('0x1f')]===_0xb024('0x1e');var _0x409586=_0x5daa42[_0xb024('0x20')];var _0x4b0a97=_0x30c351?0x0:_0x3db89c['offset'];var _0x359b5b=_0x30c351?_0x5daa42[_0xb024('0x20')]:_0x3db89c[_0xb024('0x1d')]+_0x3db89c[_0xb024('0x1f')];var _0x135987;if(_0x359b5b>=_0x409586){_0x359b5b=_0x409586;_0x135987=0xc8;}else{_0x135987=0xce;}_0x52db23[_0xb024('0x1a')](_0x135987);return _0x52db23[_0xb024('0x21')](_0xb024('0x22'),_0x4b0a97+'-'+_0x359b5b+'/'+_0x409586)[_0xb024('0x1c')](_0x5daa42);}return null;};}function patchUpdates(_0x1f2848){return function(_0x5e4b74){try{jsonpatch[_0xb024('0x23')](_0x5e4b74,_0x1f2848,!![]);}catch(_0x24a737){return BPromise['reject'](_0x24a737);}return _0x5e4b74[_0xb024('0x24')]();};}function saveUpdates(_0x13718f,_0x5e3986){return function(_0x109171){if(_0x109171){return _0x109171[_0xb024('0x25')](_0x13718f)[_0xb024('0x26')](function(_0x53468a){return _0x53468a;});}return null;};}function removeEntity(_0x231bd5,_0x59772e){return function(_0x3258f1){if(_0x3258f1){return _0x3258f1[_0xb024('0x27')]()[_0xb024('0x26')](function(){_0x231bd5[_0xb024('0x1a')](0xcc)[_0xb024('0x1b')]();});}};}function handleEntityNotFound(_0x16a617,_0x3b3c52){return function(_0x43ecd5){if(!_0x43ecd5){_0x16a617[_0xb024('0x19')](0x194);}return _0x43ecd5;};}function handleError(_0x284e40,_0x70f44a){_0x70f44a=_0x70f44a||0x1f4;return function(_0x93a922){logger['error'](_0x93a922[_0xb024('0x28')]);if(_0x93a922[_0xb024('0x29')]){delete _0x93a922[_0xb024('0x29')];}_0x284e40[_0xb024('0x1a')](_0x70f44a)[_0xb024('0x2a')](_0x93a922);};}exports['index']=function(_0x1360b8,_0x20a85b){var _0x183057={},_0xae9625={},_0x560e71={'count':0x0,'rows':[]};var _0x554c5d=_[_0xb024('0x2b')](db[_0xb024('0x2c')][_0xb024('0x2d')],function(_0x2325cc){return{'name':_0x2325cc['fieldName'],'type':_0x2325cc[_0xb024('0x2e')][_0xb024('0x2f')]};});_0xae9625['model']=_['map'](_0x554c5d,_0xb024('0x29'));_0xae9625[_0xb024('0x30')]=_[_0xb024('0x31')](_0x1360b8[_0xb024('0x30')]);_0xae9625['filters']=_[_0xb024('0x32')](_0xae9625[_0xb024('0x33')],_0xae9625[_0xb024('0x30')]);_0x183057[_0xb024('0x34')]=_[_0xb024('0x32')](_0xae9625[_0xb024('0x33')],qs[_0xb024('0x35')](_0x1360b8[_0xb024('0x30')][_0xb024('0x35')]));_0x183057[_0xb024('0x34')]=_0x183057[_0xb024('0x34')][_0xb024('0x36')]?_0x183057['attributes']:_0xae9625['model'];if(!_0x1360b8[_0xb024('0x30')]['hasOwnProperty'](_0xb024('0x37'))){_0x183057['limit']=qs[_0xb024('0x1f')](_0x1360b8[_0xb024('0x30')][_0xb024('0x1f')]);_0x183057['offset']=qs[_0xb024('0x1d')](_0x1360b8['query'][_0xb024('0x1d')]);}_0x183057[_0xb024('0x38')]=qs[_0xb024('0x39')](_0x1360b8['query']['sort']);_0x183057[_0xb024('0x3a')]=qs[_0xb024('0x3b')](_['pick'](_0x1360b8[_0xb024('0x30')],_0xae9625['filters']),_0x554c5d);if(_0x1360b8[_0xb024('0x30')]['filter']){_0x183057['where']=_['merge'](_0x183057[_0xb024('0x3a')],{'$or':_[_0xb024('0x2b')](_0x554c5d,function(_0x556bd2){if(_0x556bd2[_0xb024('0x2e')]!==_0xb024('0x3c')){var _0x5e6b1a={};_0x5e6b1a[_0x556bd2[_0xb024('0x29')]]={'$like':'%'+_0x1360b8[_0xb024('0x30')][_0xb024('0x3d')]+'%'};return _0x5e6b1a;}})});}_0x183057=_[_0xb024('0x3e')]({},_0x183057,_0x1360b8[_0xb024('0x3f')]);var _0x3ba692={'where':_0x183057['where']};return db['DeskConfiguration'][_0xb024('0x20')](_0x3ba692)[_0xb024('0x26')](function(_0x2a3bbe){_0x560e71[_0xb024('0x20')]=_0x2a3bbe;if(_0x1360b8[_0xb024('0x30')][_0xb024('0x40')]){_0x183057[_0xb024('0x41')]=[{'all':!![]}];}return db[_0xb024('0x2c')][_0xb024('0x42')](_0x183057);})[_0xb024('0x26')](function(_0x473d8e){_0x560e71[_0xb024('0x43')]=_0x473d8e;return _0x560e71;})[_0xb024('0x26')](respondWithFilteredResult(_0x20a85b,_0x183057))[_0xb024('0x44')](handleError(_0x20a85b,null));};exports[_0xb024('0x45')]=function(_0x1128c3,_0x333b64){var _0x4ef52b={'raw':![],'where':{'id':_0x1128c3[_0xb024('0x46')]['id']}},_0x2899c0={};_0x2899c0[_0xb024('0x33')]=_[_0xb024('0x31')](db[_0xb024('0x2c')][_0xb024('0x2d')]);_0x2899c0[_0xb024('0x30')]=_['keys'](_0x1128c3[_0xb024('0x30')]);_0x2899c0['filters']=_[_0xb024('0x32')](_0x2899c0[_0xb024('0x33')],_0x2899c0[_0xb024('0x30')]);_0x4ef52b[_0xb024('0x34')]=_[_0xb024('0x32')](_0x2899c0['model'],qs[_0xb024('0x35')](_0x1128c3['query'][_0xb024('0x35')]));_0x4ef52b[_0xb024('0x34')]=_0x4ef52b[_0xb024('0x34')][_0xb024('0x36')]?_0x4ef52b[_0xb024('0x34')]:_0x2899c0[_0xb024('0x33')];if(_0x1128c3[_0xb024('0x30')][_0xb024('0x40')]){_0x4ef52b[_0xb024('0x41')]=[{'all':!![]}];}_0x4ef52b=_[_0xb024('0x3e')]({},_0x4ef52b,_0x1128c3['options']);return db['DeskConfiguration']['find'](_0x4ef52b)[_0xb024('0x26')](handleEntityNotFound(_0x333b64,null))[_0xb024('0x26')](respondWithResult(_0x333b64,null))[_0xb024('0x44')](handleError(_0x333b64,null));};exports[_0xb024('0x47')]=function(_0x3c00aa,_0x321a32){return db[_0xb024('0x2c')][_0xb024('0x47')](_0x3c00aa['body'],{})[_0xb024('0x26')](respondWithResult(_0x321a32,0xc9))[_0xb024('0x44')](handleError(_0x321a32,null));};exports['update']=function(_0x19e9d4,_0x1a0217){if(_0x19e9d4['body']['id']){delete _0x19e9d4[_0xb024('0x48')]['id'];}return db[_0xb024('0x2c')][_0xb024('0x49')]({'where':{'id':_0x19e9d4['params']['id']}})[_0xb024('0x26')](handleEntityNotFound(_0x1a0217,null))[_0xb024('0x26')](saveUpdates(_0x19e9d4[_0xb024('0x48')],null))[_0xb024('0x26')](respondWithResult(_0x1a0217,null))[_0xb024('0x44')](handleError(_0x1a0217,null));};exports[_0xb024('0x27')]=function(_0x260a32,_0x2c310e){return db[_0xb024('0x2c')][_0xb024('0x49')]({'where':{'id':_0x260a32[_0xb024('0x46')]['id']}})[_0xb024('0x26')](handleEntityNotFound(_0x2c310e,null))[_0xb024('0x26')](removeEntity(_0x2c310e,null))['catch'](handleError(_0x2c310e,null));};exports[_0xb024('0x4a')]=function(_0x5cf334,_0xa19c82,_0xcea318){var _0x596279={};var _0x2c18a5={};var _0x39c31b;var _0x8a4e98;return db[_0xb024('0x2c')]['findOne']({'where':{'id':_0x5cf334[_0xb024('0x46')]['id']}})[_0xb024('0x26')](handleEntityNotFound(_0xa19c82,null))[_0xb024('0x26')](function(_0x5dbaff){if(_0x5dbaff){_0x39c31b=_0x5dbaff;_0x2c18a5[_0xb024('0x33')]=_[_0xb024('0x31')](db[_0xb024('0x4b')][_0xb024('0x2d')]);_0x2c18a5[_0xb024('0x30')]=_[_0xb024('0x31')](_0x5cf334[_0xb024('0x30')]);_0x2c18a5[_0xb024('0x3b')]=_[_0xb024('0x32')](_0x2c18a5[_0xb024('0x33')],_0x2c18a5[_0xb024('0x30')]);_0x596279['attributes']=_['intersection'](_0x2c18a5[_0xb024('0x33')],qs['fields'](_0x5cf334[_0xb024('0x30')][_0xb024('0x35')]));_0x596279[_0xb024('0x34')]=_0x596279[_0xb024('0x34')][_0xb024('0x36')]?_0x596279[_0xb024('0x34')]:_0x2c18a5[_0xb024('0x33')];_0x596279[_0xb024('0x38')]=qs[_0xb024('0x39')](_0x5cf334[_0xb024('0x30')][_0xb024('0x39')]);_0x596279[_0xb024('0x3a')]=qs['filters'](_[_0xb024('0x4c')](_0x5cf334[_0xb024('0x30')],_0x2c18a5['filters']));if(_0x5cf334[_0xb024('0x30')][_0xb024('0x3d')]){_0x596279[_0xb024('0x3a')]=_[_0xb024('0x3e')](_0x596279[_0xb024('0x3a')],{'$or':_[_0xb024('0x2b')](_0x596279['attributes'],function(_0xa81692){var _0xa49511={};_0xa49511[_0xa81692]={'$like':'%'+_0x5cf334[_0xb024('0x30')]['filter']+'%'};return _0xa49511;})});}_0x596279=_[_0xb024('0x3e')]({},_0x596279,_0x5cf334[_0xb024('0x3f')]);return _0x39c31b[_0xb024('0x4a')](_0x596279);}})['then'](function(_0x598e3b){if(_0x598e3b){_0x8a4e98=_0x598e3b[_0xb024('0x36')];if(!_0x5cf334[_0xb024('0x30')][_0xb024('0x4d')](_0xb024('0x37'))){_0x596279[_0xb024('0x1f')]=qs[_0xb024('0x1f')](_0x5cf334[_0xb024('0x30')][_0xb024('0x1f')]);_0x596279[_0xb024('0x1d')]=qs['offset'](_0x5cf334['query'][_0xb024('0x1d')]);}return _0x39c31b[_0xb024('0x4a')](_0x596279);}})['then'](function(_0xdab7f5){if(_0xdab7f5){return _0xdab7f5?{'count':_0x8a4e98,'rows':_0xdab7f5}:null;}})['then'](respondWithResult(_0xa19c82,null))[_0xb024('0x44')](handleError(_0xa19c82,null));};exports['getSubjects']=function(_0x31a187,_0x13ea4c,_0x196a13){var _0x54bc1e={};var _0x1317d8={};var _0x8eb804;var _0x1dfb92;return db['DeskConfiguration']['findOne']({'where':{'id':_0x31a187['params']['id']}})[_0xb024('0x26')](handleEntityNotFound(_0x13ea4c,null))[_0xb024('0x26')](function(_0x19a6c8){if(_0x19a6c8){_0x8eb804=_0x19a6c8;_0x1317d8[_0xb024('0x33')]=_[_0xb024('0x31')](db[_0xb024('0x4b')][_0xb024('0x2d')]);_0x1317d8[_0xb024('0x30')]=_[_0xb024('0x31')](_0x31a187[_0xb024('0x30')]);_0x1317d8['filters']=_['intersection'](_0x1317d8[_0xb024('0x33')],_0x1317d8['query']);_0x54bc1e[_0xb024('0x34')]=_[_0xb024('0x32')](_0x1317d8[_0xb024('0x33')],qs[_0xb024('0x35')](_0x31a187[_0xb024('0x30')]['fields']));_0x54bc1e['attributes']=_0x54bc1e[_0xb024('0x34')][_0xb024('0x36')]?_0x54bc1e[_0xb024('0x34')]:_0x1317d8['model'];_0x54bc1e[_0xb024('0x38')]=qs[_0xb024('0x39')](_0x31a187[_0xb024('0x30')][_0xb024('0x39')]);_0x54bc1e['where']=qs[_0xb024('0x3b')](_[_0xb024('0x4c')](_0x31a187[_0xb024('0x30')],_0x1317d8[_0xb024('0x3b')]));if(_0x31a187['query']['filter']){_0x54bc1e[_0xb024('0x3a')]=_[_0xb024('0x3e')](_0x54bc1e['where'],{'$or':_['map'](_0x54bc1e[_0xb024('0x34')],function(_0x36384e){var _0x1ae130={};_0x1ae130[_0x36384e]={'$like':'%'+_0x31a187[_0xb024('0x30')][_0xb024('0x3d')]+'%'};return _0x1ae130;})});}_0x54bc1e=_['merge']({},_0x54bc1e,_0x31a187['options']);return _0x8eb804[_0xb024('0x4e')](_0x54bc1e);}})['then'](function(_0x431dc0){if(_0x431dc0){_0x1dfb92=_0x431dc0[_0xb024('0x36')];if(!_0x31a187['query'][_0xb024('0x4d')](_0xb024('0x37'))){_0x54bc1e[_0xb024('0x1f')]=qs[_0xb024('0x1f')](_0x31a187['query'][_0xb024('0x1f')]);_0x54bc1e[_0xb024('0x1d')]=qs['offset'](_0x31a187[_0xb024('0x30')][_0xb024('0x1d')]);}return _0x8eb804[_0xb024('0x4e')](_0x54bc1e);}})[_0xb024('0x26')](function(_0x8b305f){if(_0x8b305f){return _0x8b305f?{'count':_0x1dfb92,'rows':_0x8b305f}:null;}})[_0xb024('0x26')](respondWithResult(_0x13ea4c,null))[_0xb024('0x44')](handleError(_0x13ea4c,null));};exports[_0xb024('0x4f')]=function(_0x423b15,_0x266e6b,_0x1ec781){var _0x305fe6={};var _0x53d08e={};var _0x511726;var _0x53e1f4;return db[_0xb024('0x2c')][_0xb024('0x50')]({'where':{'id':_0x423b15['params']['id']}})[_0xb024('0x26')](handleEntityNotFound(_0x266e6b,null))['then'](function(_0xebe022){if(_0xebe022){_0x511726=_0xebe022;_0x53d08e[_0xb024('0x33')]=_['keys'](db['DeskField'][_0xb024('0x2d')]);_0x53d08e['query']=_[_0xb024('0x31')](_0x423b15[_0xb024('0x30')]);_0x53d08e['filters']=_[_0xb024('0x32')](_0x53d08e[_0xb024('0x33')],_0x53d08e[_0xb024('0x30')]);_0x305fe6[_0xb024('0x34')]=_[_0xb024('0x32')](_0x53d08e[_0xb024('0x33')],qs[_0xb024('0x35')](_0x423b15[_0xb024('0x30')]['fields']));_0x305fe6['attributes']=_0x305fe6[_0xb024('0x34')][_0xb024('0x36')]?_0x305fe6['attributes']:_0x53d08e[_0xb024('0x33')];_0x305fe6[_0xb024('0x38')]=qs[_0xb024('0x39')](_0x423b15[_0xb024('0x30')][_0xb024('0x39')]);_0x305fe6[_0xb024('0x3a')]=qs[_0xb024('0x3b')](_[_0xb024('0x4c')](_0x423b15[_0xb024('0x30')],_0x53d08e[_0xb024('0x3b')]));if(_0x423b15[_0xb024('0x30')]['filter']){_0x305fe6[_0xb024('0x3a')]=_[_0xb024('0x3e')](_0x305fe6[_0xb024('0x3a')],{'$or':_[_0xb024('0x2b')](_0x305fe6[_0xb024('0x34')],function(_0x2e2d7d){var _0x26a54c={};_0x26a54c[_0x2e2d7d]={'$like':'%'+_0x423b15['query'][_0xb024('0x3d')]+'%'};return _0x26a54c;})});}_0x305fe6=_[_0xb024('0x3e')]({},_0x305fe6,_0x423b15['options']);return _0x511726[_0xb024('0x4f')](_0x305fe6);}})['then'](function(_0x1dc53d){if(_0x1dc53d){_0x53e1f4=_0x1dc53d[_0xb024('0x36')];if(!_0x423b15[_0xb024('0x30')][_0xb024('0x4d')](_0xb024('0x37'))){_0x305fe6[_0xb024('0x1f')]=qs[_0xb024('0x1f')](_0x423b15[_0xb024('0x30')][_0xb024('0x1f')]);_0x305fe6[_0xb024('0x1d')]=qs[_0xb024('0x1d')](_0x423b15[_0xb024('0x30')][_0xb024('0x1d')]);}return _0x511726['getDescriptions'](_0x305fe6);}})[_0xb024('0x26')](function(_0x54df4e){if(_0x54df4e){return _0x54df4e?{'count':_0x53e1f4,'rows':_0x54df4e}:null;}})['then'](respondWithResult(_0x266e6b,null))['catch'](handleError(_0x266e6b,null));};exports['getTags']=function(_0xd5868a,_0x2202b8,_0x59ee8b){var _0x1947c6={};var _0x5de8f1={};var _0x2b82bf;var _0x384d60;return db[_0xb024('0x2c')]['findOne']({'where':{'id':_0xd5868a[_0xb024('0x46')]['id']}})['then'](handleEntityNotFound(_0x2202b8,null))[_0xb024('0x26')](function(_0x4e6608){if(_0x4e6608){_0x2b82bf=_0x4e6608;_0x5de8f1['model']=_[_0xb024('0x31')](db[_0xb024('0x51')][_0xb024('0x2d')]);_0x5de8f1[_0xb024('0x30')]=_['keys'](_0xd5868a[_0xb024('0x30')]);_0x5de8f1[_0xb024('0x3b')]=_[_0xb024('0x32')](_0x5de8f1[_0xb024('0x33')],_0x5de8f1[_0xb024('0x30')]);_0x1947c6['attributes']=_[_0xb024('0x32')](_0x5de8f1[_0xb024('0x33')],qs[_0xb024('0x35')](_0xd5868a[_0xb024('0x30')][_0xb024('0x35')]));_0x1947c6[_0xb024('0x34')]=_0x1947c6[_0xb024('0x34')][_0xb024('0x36')]?_0x1947c6[_0xb024('0x34')]:_0x5de8f1[_0xb024('0x33')];_0x1947c6['order']=qs[_0xb024('0x39')](_0xd5868a[_0xb024('0x30')]['sort']);_0x1947c6[_0xb024('0x3a')]=qs[_0xb024('0x3b')](_[_0xb024('0x4c')](_0xd5868a[_0xb024('0x30')],_0x5de8f1[_0xb024('0x3b')]));if(_0xd5868a['query'][_0xb024('0x3d')]){_0x1947c6[_0xb024('0x3a')]=_[_0xb024('0x3e')](_0x1947c6[_0xb024('0x3a')],{'$or':_['map'](_0x1947c6[_0xb024('0x34')],function(_0x5943bb){var _0x4cbc81={};_0x4cbc81[_0x5943bb]={'$like':'%'+_0xd5868a['query'][_0xb024('0x3d')]+'%'};return _0x4cbc81;})});}_0x1947c6=_[_0xb024('0x3e')]({},_0x1947c6,_0xd5868a[_0xb024('0x3f')]);return _0x2b82bf[_0xb024('0x52')](_0x1947c6);}})['then'](function(_0x1a4ce9){if(_0x1a4ce9){_0x384d60=_0x1a4ce9[_0xb024('0x36')];if(!_0xd5868a[_0xb024('0x30')][_0xb024('0x4d')](_0xb024('0x37'))){_0x1947c6[_0xb024('0x1f')]=qs[_0xb024('0x1f')](_0xd5868a['query'][_0xb024('0x1f')]);_0x1947c6[_0xb024('0x1d')]=qs['offset'](_0xd5868a[_0xb024('0x30')][_0xb024('0x1d')]);}return _0x2b82bf[_0xb024('0x52')](_0x1947c6);}})[_0xb024('0x26')](function(_0x16a03d){if(_0x16a03d){return _0x16a03d?{'count':_0x384d60,'rows':_0x16a03d}:null;}})['then'](respondWithResult(_0x2202b8,null))[_0xb024('0x44')](handleError(_0x2202b8,null));};exports[_0xb024('0x53')]=function(_0x31470b,_0x506464,_0x5ccce5){if(_0x31470b[_0xb024('0x48')]['id']){delete _0x31470b['body']['id'];}return db['DeskConfiguration'][_0xb024('0x50')]({'where':{'id':_0x31470b[_0xb024('0x46')]['id']}})[_0xb024('0x26')](handleEntityNotFound(_0x506464,null))[_0xb024('0x26')](function(_0xf6f9c3){if(_0xf6f9c3){return _0xf6f9c3['setTags'](_0x31470b[_0xb024('0x48')][_0xb024('0x54')]||[]);}return null;})['then'](respondWithResult(_0x506464,null))['catch'](handleError(_0x506464,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index b61cfd6..885c717 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 _0x2ba6=['api','moment','bluebird','request-promise','path','rimraf','./intDeskConfiguration.attributes','define','DeskConfiguration','lodash','util','../../config/logger'];(function(_0x53a301,_0x5343b7){var _0x3889ca=function(_0x1c73e0){while(--_0x1c73e0){_0x53a301['push'](_0x53a301['shift']());}};_0x3889ca(++_0x5343b7);}(_0x2ba6,0x135));var _0x62ba=function(_0x5f288f,_0x242129){_0x5f288f=_0x5f288f-0x0;var _0x29df11=_0x2ba6[_0x5f288f];return _0x29df11;};'use strict';var _=require(_0x62ba('0x0'));var util=require(_0x62ba('0x1'));var logger=require(_0x62ba('0x2'))(_0x62ba('0x3'));var moment=require(_0x62ba('0x4'));var BPromise=require(_0x62ba('0x5'));var rp=require(_0x62ba('0x6'));var fs=require('fs');var path=require(_0x62ba('0x7'));var rimraf=require(_0x62ba('0x8'));var config=require('../../config/environment');var attributes=require(_0x62ba('0x9'));module['exports']=function(_0x4ac882,_0x525da9){return _0x4ac882[_0x62ba('0xa')](_0x62ba('0xb'),attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5e24=['define','int_desk_configurations','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5e24,0xb2));var _0x45e2=function(_0x1906f4,_0x530f6a){_0x1906f4=_0x1906f4-0x0;var _0x58e1de=_0x5e24[_0x1906f4];return _0x58e1de;};'use strict';var _=require('lodash');var util=require(_0x45e2('0x0'));var logger=require('../../config/logger')(_0x45e2('0x1'));var moment=require('moment');var BPromise=require(_0x45e2('0x2'));var rp=require(_0x45e2('0x3'));var fs=require('fs');var path=require(_0x45e2('0x4'));var rimraf=require(_0x45e2('0x5'));var config=require(_0x45e2('0x6'));var attributes=require(_0x45e2('0x7'));module[_0x45e2('0x8')]=function(_0x2bb7a9,_0x422f9e){return _0x2bb7a9[_0x45e2('0x9')]('DeskConfiguration',attributes,{'tableName':_0x45e2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index db82549..b4be556 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 _0x6b06=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','catch'];(function(_0x5a95fa,_0x4a2fc9){var _0x1a61b8=function(_0x59f119){while(--_0x59f119){_0x5a95fa['push'](_0x5a95fa['shift']());}};_0x1a61b8(++_0x4a2fc9);}(_0x6b06,0x1e4));var _0x66b0=function(_0x311abc,_0x29e921){_0x311abc=_0x311abc-0x0;var _0x239aa5=_0x6b06[_0x311abc];return _0x239aa5;};'use strict';var _=require(_0x66b0('0x0'));var util=require(_0x66b0('0x1'));var moment=require(_0x66b0('0x2'));var BPromise=require('bluebird');var rs=require(_0x66b0('0x3'));var fs=require('fs');var Redis=require(_0x66b0('0x4'));var db=require(_0x66b0('0x5'))['db'];var utils=require(_0x66b0('0x6'));var logger=require(_0x66b0('0x7'))(_0x66b0('0x8'));var config=require(_0x66b0('0x9'));var jayson=require(_0x66b0('0xa'));var client=jayson['client'][_0x66b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2fafa4,_0x52036c,_0xaab24d){return new BPromise(function(_0x1a3440,_0x47f0c4){return client[_0x66b0('0xc')](_0x2fafa4,_0xaab24d)[_0x66b0('0xd')](function(_0x1cf27a){logger[_0x66b0('0xe')](_0x66b0('0xf'),_0x52036c,_0x66b0('0x10'));logger['debug']('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x52036c,_0x66b0('0x10'),JSON[_0x66b0('0x11')](_0x1cf27a));if(_0x1cf27a['error']){if(_0x1cf27a['error'][_0x66b0('0x12')]===0x1f4){logger[_0x66b0('0x13')](_0x66b0('0xf'),_0x52036c,_0x1cf27a['error'][_0x66b0('0x14')]);return _0x47f0c4(_0x1cf27a[_0x66b0('0x13')][_0x66b0('0x14')]);}logger['error'](_0x66b0('0xf'),_0x52036c,_0x1cf27a[_0x66b0('0x13')][_0x66b0('0x14')]);return _0x1a3440(_0x1cf27a['error']['message']);}else{logger[_0x66b0('0xe')](_0x66b0('0xf'),_0x52036c,_0x66b0('0x10'));_0x1a3440(_0x1cf27a['result'][_0x66b0('0x14')]);}})[_0x66b0('0x15')](function(_0x4f0d75){logger[_0x66b0('0x13')](_0x66b0('0xf'),_0x52036c,_0x4f0d75);_0x47f0c4(_0x4f0d75);});});} \ No newline at end of file +var _0xe1e8=['lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','info','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','DeskConfiguration,\x20%s,\x20%s','message','result'];(function(_0x368e09,_0x2c1517){var _0x14b7df=function(_0x5002af){while(--_0x5002af){_0x368e09['push'](_0x368e09['shift']());}};_0x14b7df(++_0x2c1517);}(_0xe1e8,0x1cb));var _0x8e1e=function(_0x265c85,_0x27d83d){_0x265c85=_0x265c85-0x0;var _0x445ac2=_0xe1e8[_0x265c85];return _0x445ac2;};'use strict';var _=require(_0x8e1e('0x0'));var util=require('util');var moment=require(_0x8e1e('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8e1e('0x2'));var db=require(_0x8e1e('0x3'))['db'];var utils=require(_0x8e1e('0x4'));var logger=require(_0x8e1e('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8e1e('0x6'));var client=jayson[_0x8e1e('0x7')][_0x8e1e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1861ce,_0x4eb2b7,_0x21ee75){return new BPromise(function(_0xe8a658,_0x3a1ead){return client['request'](_0x1861ce,_0x21ee75)['then'](function(_0x4007f3){logger[_0x8e1e('0x9')]('DeskConfiguration,\x20%s,\x20%s',_0x4eb2b7,_0x8e1e('0xa'));logger['debug'](_0x8e1e('0xb'),_0x4eb2b7,_0x8e1e('0xa'),JSON[_0x8e1e('0xc')](_0x4007f3));if(_0x4007f3[_0x8e1e('0xd')]){if(_0x4007f3[_0x8e1e('0xd')]['code']===0x1f4){logger[_0x8e1e('0xd')](_0x8e1e('0xe'),_0x4eb2b7,_0x4007f3[_0x8e1e('0xd')]['message']);return _0x3a1ead(_0x4007f3[_0x8e1e('0xd')][_0x8e1e('0xf')]);}logger[_0x8e1e('0xd')](_0x8e1e('0xe'),_0x4eb2b7,_0x4007f3['error']['message']);return _0xe8a658(_0x4007f3['error'][_0x8e1e('0xf')]);}else{logger[_0x8e1e('0x9')](_0x8e1e('0xe'),_0x4eb2b7,_0x8e1e('0xa'));_0xe8a658(_0x4007f3[_0x8e1e('0x10')]['message']);}})['catch'](function(_0x2d2dc2){logger[_0x8e1e('0xd')](_0x8e1e('0xe'),_0x4eb2b7,_0x2d2dc2);_0x3a1ead(_0x2d2dc2);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 3a08e3a..041aeea 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 _0x0e5a=['multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDeskField.controller','get','/:id','isAuthenticated','show','post','create','put','delete'];(function(_0x20beae,_0x5eac6d){var _0xf5725=function(_0x926a3b){while(--_0x926a3b){_0x20beae['push'](_0x20beae['shift']());}};_0xf5725(++_0x5eac6d);}(_0x0e5a,0x70));var _0xa0e5=function(_0x2c0626,_0x26fd30){_0x2c0626=_0x2c0626-0x0;var _0x1317ea=_0x0e5a[_0x2c0626];return _0x1317ea;};'use strict';var multer=require(_0xa0e5('0x0'));var util=require(_0xa0e5('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa0e5('0x2'));var router=express[_0xa0e5('0x3')]();var fs_extra=require(_0xa0e5('0x4'));var auth=require(_0xa0e5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa0e5('0x6'));var controller=require(_0xa0e5('0x7'));router[_0xa0e5('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa0e5('0x8')](_0xa0e5('0x9'),auth[_0xa0e5('0xa')](),controller[_0xa0e5('0xb')]);router[_0xa0e5('0xc')]('/',auth[_0xa0e5('0xa')](),controller[_0xa0e5('0xd')]);router[_0xa0e5('0xe')](_0xa0e5('0x9'),auth[_0xa0e5('0xa')](),controller['update']);router[_0xa0e5('0xf')](_0xa0e5('0x9'),auth[_0xa0e5('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xf524=['post','create','put','update','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','index','get','/:id','isAuthenticated'];(function(_0x304ae0,_0x4e6cbc){var _0x28a93c=function(_0x389350){while(--_0x389350){_0x304ae0['push'](_0x304ae0['shift']());}};_0x28a93c(++_0x4e6cbc);}(_0xf524,0x16b));var _0x4f52=function(_0x4b62db,_0x1b18d3){_0x4b62db=_0x4b62db-0x0;var _0x2935a0=_0xf524[_0x4b62db];return _0x2935a0;};'use strict';var multer=require('multer');var util=require(_0x4f52('0x0'));var path=require(_0x4f52('0x1'));var timeout=require(_0x4f52('0x2'));var express=require('express');var router=express[_0x4f52('0x3')]();var fs_extra=require(_0x4f52('0x4'));var auth=require(_0x4f52('0x5'));var interaction=require(_0x4f52('0x6'));var config=require('../../config/environment');var controller=require('./intDeskField.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x4f52('0x7')]);router[_0x4f52('0x8')](_0x4f52('0x9'),auth[_0x4f52('0xa')](),controller['show']);router[_0x4f52('0xb')]('/',auth[_0x4f52('0xa')](),controller[_0x4f52('0xc')]);router[_0x4f52('0xd')]('/:id',auth[_0x4f52('0xa')](),controller[_0x4f52('0xe')]);router['delete'](_0x4f52('0x9'),auth[_0x4f52('0xa')](),controller[_0x4f52('0xf')]);module[_0x4f52('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 7baf631..5fe2c9e 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 _0xa74a=['customVariable','keyValue','picklist','STRING','sequelize','exports','ENUM','string','variable'];(function(_0x55b885,_0x15f7f1){var _0x4cb16d=function(_0x3b4667){while(--_0x3b4667){_0x55b885['push'](_0x55b885['shift']());}};_0x4cb16d(++_0x15f7f1);}(_0xa74a,0x1c6));var _0xaa74=function(_0x57c746,_0x3c75dc){_0x57c746=_0x57c746-0x0;var _0x3a953c=_0xa74a[_0x57c746];return _0x3a953c;};'use strict';var Sequelize=require(_0xaa74('0x0'));module[_0xaa74('0x1')]={'type':{'type':Sequelize[_0xaa74('0x2')](_0xaa74('0x3'),_0xaa74('0x4'),_0xaa74('0x5'),_0xaa74('0x6'),_0xaa74('0x7')),'defaultValue':_0xaa74('0x3')},'content':{'type':Sequelize[_0xaa74('0x8')]},'key':{'type':Sequelize[_0xaa74('0x8')]},'keyType':{'type':Sequelize[_0xaa74('0x2')](_0xaa74('0x3'),'variable',_0xaa74('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xaa74('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd34b=['variable','BOOLEAN','sequelize','string','customVariable','picklist','STRING','ENUM'];(function(_0x3fc017,_0x288faf){var _0x542e8c=function(_0x42438c){while(--_0x42438c){_0x3fc017['push'](_0x3fc017['shift']());}};_0x542e8c(++_0x288faf);}(_0xd34b,0x142));var _0xbd34=function(_0x2993ee,_0x3d6444){_0x2993ee=_0x2993ee-0x0;var _0xcb14c1=_0xd34b[_0x2993ee];return _0xcb14c1;};'use strict';var Sequelize=require(_0xbd34('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xbd34('0x1'),'variable',_0xbd34('0x2'),'keyValue',_0xbd34('0x3')),'defaultValue':_0xbd34('0x1')},'content':{'type':Sequelize[_0xbd34('0x4')]},'key':{'type':Sequelize[_0xbd34('0x4')]},'keyType':{'type':Sequelize[_0xbd34('0x5')](_0xbd34('0x1'),_0xbd34('0x6'),_0xbd34('0x2'))},'keyContent':{'type':Sequelize[_0xbd34('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xbd34('0x4')]},'customField':{'type':Sequelize[_0xbd34('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xbd34('0x4')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index a76cf10..fb83ce3 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 _0x7b92=['update','then','destroy','sendStatus','stack','name','send','index','map','DeskField','fieldName','type','key','model','query','keys','filters','attributes','fields','nolimit','order','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','rawAttributes','intersection','length','find','catch','create','body','eml-format','zip-dir','fast-json-patch','bluebird','path','sox','ejs','fs-extra','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','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save'];(function(_0x231e16,_0x67347b){var _0x570a7c=function(_0x2c35b4){while(--_0x2c35b4){_0x231e16['push'](_0x231e16['shift']());}};_0x570a7c(++_0x67347b);}(_0x7b92,0x1e3));var _0x27b9=function(_0xe4d6c6,_0x3bdbf2){_0xe4d6c6=_0xe4d6c6-0x0;var _0x3a8935=_0x7b92[_0xe4d6c6];return _0x3a8935;};'use strict';var emlformat=require(_0x27b9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x27b9('0x1'));var jsonpatch=require(_0x27b9('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x27b9('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x27b9('0x4'));var sox=require(_0x27b9('0x5'));var csv=require('to-csv');var ejs=require(_0x27b9('0x6'));var fs=require('fs');var fs_extra=require(_0x27b9('0x7'));var _=require('lodash');var squel=require(_0x27b9('0x8'));var crypto=require(_0x27b9('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x27b9('0xa'));var toCsv=require(_0x27b9('0xb'));var querystring=require(_0x27b9('0xc'));var Papa=require(_0x27b9('0xd'));var Redis=require(_0x27b9('0xe'));var authService=require(_0x27b9('0xf'));var qs=require(_0x27b9('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x27b9('0x11'));var logger=require(_0x27b9('0x12'))(_0x27b9('0x13'));var utils=require(_0x27b9('0x14'));var config=require(_0x27b9('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x27b9('0x16'))['db'];function respondWithStatusCode(_0x2e469b,_0x540690){_0x540690=_0x540690||0xcc;return function(_0x25b7cd){if(_0x25b7cd){return _0x2e469b['sendStatus'](_0x540690);}return _0x2e469b['status'](_0x540690)[_0x27b9('0x17')]();};}function respondWithResult(_0x4f8c9e,_0x4b3270){_0x4b3270=_0x4b3270||0xc8;return function(_0x594b22){if(_0x594b22){return _0x4f8c9e[_0x27b9('0x18')](_0x4b3270)[_0x27b9('0x19')](_0x594b22);}};}function respondWithFilteredResult(_0x36036b,_0x4347e5){return function(_0x5c227c){if(_0x5c227c){var _0x76af1e=typeof _0x4347e5[_0x27b9('0x1a')]===_0x27b9('0x1b')&&typeof _0x4347e5[_0x27b9('0x1c')]==='undefined';var _0x570b41=_0x5c227c[_0x27b9('0x1d')];var _0x26bc0f=_0x76af1e?0x0:_0x4347e5[_0x27b9('0x1a')];var _0xa0a9f9=_0x76af1e?_0x5c227c[_0x27b9('0x1d')]:_0x4347e5[_0x27b9('0x1a')]+_0x4347e5['limit'];var _0x4c0842;if(_0xa0a9f9>=_0x570b41){_0xa0a9f9=_0x570b41;_0x4c0842=0xc8;}else{_0x4c0842=0xce;}_0x36036b['status'](_0x4c0842);return _0x36036b[_0x27b9('0x1e')](_0x27b9('0x1f'),_0x26bc0f+'-'+_0xa0a9f9+'/'+_0x570b41)[_0x27b9('0x19')](_0x5c227c);}return null;};}function patchUpdates(_0x443e4b){return function(_0x263369){try{jsonpatch[_0x27b9('0x20')](_0x263369,_0x443e4b,!![]);}catch(_0x3013a9){return BPromise[_0x27b9('0x21')](_0x3013a9);}return _0x263369[_0x27b9('0x22')]();};}function saveUpdates(_0x58ab54,_0x43b28a){return function(_0x3cfd93){if(_0x3cfd93){return _0x3cfd93[_0x27b9('0x23')](_0x58ab54)[_0x27b9('0x24')](function(_0xf69565){return _0xf69565;});}return null;};}function removeEntity(_0x2b27e9,_0x123be1){return function(_0x8803db){if(_0x8803db){return _0x8803db[_0x27b9('0x25')]()['then'](function(){_0x2b27e9['status'](0xcc)[_0x27b9('0x17')]();});}};}function handleEntityNotFound(_0x58a3ea,_0x2bbc42){return function(_0x4bdc08){if(!_0x4bdc08){_0x58a3ea[_0x27b9('0x26')](0x194);}return _0x4bdc08;};}function handleError(_0x3998a0,_0x4d09f0){_0x4d09f0=_0x4d09f0||0x1f4;return function(_0x5d32c9){logger['error'](_0x5d32c9[_0x27b9('0x27')]);if(_0x5d32c9[_0x27b9('0x28')]){delete _0x5d32c9[_0x27b9('0x28')];}_0x3998a0[_0x27b9('0x18')](_0x4d09f0)[_0x27b9('0x29')](_0x5d32c9);};}exports[_0x27b9('0x2a')]=function(_0x36ae8b,_0x7713c1){var _0x114b37={},_0x292833={},_0x12e7eb={'count':0x0,'rows':[]};var _0x311225=_[_0x27b9('0x2b')](db[_0x27b9('0x2c')]['rawAttributes'],function(_0x2b2744){return{'name':_0x2b2744[_0x27b9('0x2d')],'type':_0x2b2744[_0x27b9('0x2e')][_0x27b9('0x2f')]};});_0x292833[_0x27b9('0x30')]=_[_0x27b9('0x2b')](_0x311225,_0x27b9('0x28'));_0x292833[_0x27b9('0x31')]=_[_0x27b9('0x32')](_0x36ae8b[_0x27b9('0x31')]);_0x292833[_0x27b9('0x33')]=_['intersection'](_0x292833[_0x27b9('0x30')],_0x292833['query']);_0x114b37[_0x27b9('0x34')]=_['intersection'](_0x292833[_0x27b9('0x30')],qs[_0x27b9('0x35')](_0x36ae8b['query'][_0x27b9('0x35')]));_0x114b37[_0x27b9('0x34')]=_0x114b37[_0x27b9('0x34')]['length']?_0x114b37['attributes']:_0x292833[_0x27b9('0x30')];if(!_0x36ae8b[_0x27b9('0x31')]['hasOwnProperty'](_0x27b9('0x36'))){_0x114b37[_0x27b9('0x1c')]=qs[_0x27b9('0x1c')](_0x36ae8b[_0x27b9('0x31')][_0x27b9('0x1c')]);_0x114b37[_0x27b9('0x1a')]=qs[_0x27b9('0x1a')](_0x36ae8b[_0x27b9('0x31')][_0x27b9('0x1a')]);}_0x114b37[_0x27b9('0x37')]=qs['sort'](_0x36ae8b['query']['sort']);_0x114b37[_0x27b9('0x38')]=qs['filters'](_[_0x27b9('0x39')](_0x36ae8b[_0x27b9('0x31')],_0x292833[_0x27b9('0x33')]),_0x311225);if(_0x36ae8b[_0x27b9('0x31')][_0x27b9('0x3a')]){_0x114b37[_0x27b9('0x38')]=_[_0x27b9('0x3b')](_0x114b37[_0x27b9('0x38')],{'$or':_[_0x27b9('0x2b')](_0x311225,function(_0x388118){if(_0x388118['type']!==_0x27b9('0x3c')){var _0xa44f05={};_0xa44f05[_0x388118['name']]={'$like':'%'+_0x36ae8b[_0x27b9('0x31')]['filter']+'%'};return _0xa44f05;}})});}_0x114b37=_[_0x27b9('0x3b')]({},_0x114b37,_0x36ae8b['options']);var _0x4e2035={'where':_0x114b37[_0x27b9('0x38')]};return db[_0x27b9('0x2c')][_0x27b9('0x1d')](_0x4e2035)['then'](function(_0x4cfefa){_0x12e7eb['count']=_0x4cfefa;if(_0x36ae8b[_0x27b9('0x31')][_0x27b9('0x3d')]){_0x114b37[_0x27b9('0x3e')]=[{'all':!![]}];}return db[_0x27b9('0x2c')][_0x27b9('0x3f')](_0x114b37);})[_0x27b9('0x24')](function(_0x1e83bd){_0x12e7eb[_0x27b9('0x40')]=_0x1e83bd;return _0x12e7eb;})[_0x27b9('0x24')](respondWithFilteredResult(_0x7713c1,_0x114b37))['catch'](handleError(_0x7713c1,null));};exports[_0x27b9('0x41')]=function(_0x15ec21,_0x462729){var _0x456c48={'raw':!![],'where':{'id':_0x15ec21[_0x27b9('0x42')]['id']}},_0x1e2f9f={};_0x1e2f9f[_0x27b9('0x30')]=_[_0x27b9('0x32')](db['DeskField'][_0x27b9('0x43')]);_0x1e2f9f['query']=_['keys'](_0x15ec21['query']);_0x1e2f9f[_0x27b9('0x33')]=_[_0x27b9('0x44')](_0x1e2f9f[_0x27b9('0x30')],_0x1e2f9f[_0x27b9('0x31')]);_0x456c48[_0x27b9('0x34')]=_[_0x27b9('0x44')](_0x1e2f9f['model'],qs[_0x27b9('0x35')](_0x15ec21[_0x27b9('0x31')][_0x27b9('0x35')]));_0x456c48[_0x27b9('0x34')]=_0x456c48[_0x27b9('0x34')][_0x27b9('0x45')]?_0x456c48['attributes']:_0x1e2f9f[_0x27b9('0x30')];if(_0x15ec21[_0x27b9('0x31')][_0x27b9('0x3d')]){_0x456c48[_0x27b9('0x3e')]=[{'all':!![]}];}_0x456c48=_[_0x27b9('0x3b')]({},_0x456c48,_0x15ec21['options']);return db[_0x27b9('0x2c')][_0x27b9('0x46')](_0x456c48)[_0x27b9('0x24')](handleEntityNotFound(_0x462729,null))[_0x27b9('0x24')](respondWithResult(_0x462729,null))[_0x27b9('0x47')](handleError(_0x462729,null));};exports[_0x27b9('0x48')]=function(_0x8413b1,_0x3c2879){return db[_0x27b9('0x2c')][_0x27b9('0x48')](_0x8413b1[_0x27b9('0x49')],{})[_0x27b9('0x24')](respondWithResult(_0x3c2879,0xc9))[_0x27b9('0x47')](handleError(_0x3c2879,null));};exports[_0x27b9('0x23')]=function(_0x1e58b6,_0xad64d1){if(_0x1e58b6['body']['id']){delete _0x1e58b6[_0x27b9('0x49')]['id'];}return db[_0x27b9('0x2c')]['find']({'where':{'id':_0x1e58b6['params']['id']}})['then'](handleEntityNotFound(_0xad64d1,null))['then'](saveUpdates(_0x1e58b6[_0x27b9('0x49')],null))['then'](respondWithResult(_0xad64d1,null))['catch'](handleError(_0xad64d1,null));};exports[_0x27b9('0x25')]=function(_0x2e817a,_0x3d6fc8){return db[_0x27b9('0x2c')][_0x27b9('0x46')]({'where':{'id':_0x2e817a[_0x27b9('0x42')]['id']}})[_0x27b9('0x24')](handleEntityNotFound(_0x3d6fc8,null))[_0x27b9('0x24')](removeEntity(_0x3d6fc8,null))[_0x27b9('0x47')](handleError(_0x3d6fc8,null));}; \ No newline at end of file +var _0x1228=['end','json','undefined','count','limit','reject','save','update','then','destroy','error','stack','name','send','index','DeskField','rawAttributes','key','model','map','query','keys','filters','intersection','attributes','fields','nolimit','offset','sort','pick','filter','where','merge','type','options','includeAll','rows','catch','params','length','find','create','body','eml-format','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x1228,0x12f));var _0x8122=function(_0x62ae03,_0xe5a1d2){_0x62ae03=_0x62ae03-0x0;var _0x335278=_0x1228[_0x62ae03];return _0x335278;};'use strict';var emlformat=require(_0x8122('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8122('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8122('0x2'));var moment=require(_0x8122('0x3'));var BPromise=require(_0x8122('0x4'));var Mustache=require('mustache');var util=require(_0x8122('0x5'));var path=require(_0x8122('0x6'));var sox=require('sox');var csv=require(_0x8122('0x7'));var ejs=require(_0x8122('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8122('0x9'));var squel=require(_0x8122('0xa'));var crypto=require('crypto');var jsforce=require(_0x8122('0xb'));var deskjs=require(_0x8122('0xc'));var toCsv=require('to-csv');var querystring=require(_0x8122('0xd'));var Papa=require(_0x8122('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8122('0xf'));var logger=require('../../config/logger')(_0x8122('0x10'));var utils=require(_0x8122('0x11'));var config=require(_0x8122('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x8122('0x13'))['db'];function respondWithStatusCode(_0x565f6e,_0x162ed4){_0x162ed4=_0x162ed4||0xcc;return function(_0x1ca828){if(_0x1ca828){return _0x565f6e[_0x8122('0x14')](_0x162ed4);}return _0x565f6e[_0x8122('0x15')](_0x162ed4)[_0x8122('0x16')]();};}function respondWithResult(_0x266feb,_0x1fa431){_0x1fa431=_0x1fa431||0xc8;return function(_0x1be8e2){if(_0x1be8e2){return _0x266feb[_0x8122('0x15')](_0x1fa431)[_0x8122('0x17')](_0x1be8e2);}};}function respondWithFilteredResult(_0xfa15a2,_0x6baf37){return function(_0x559256){if(_0x559256){var _0x3ed5d1=typeof _0x6baf37['offset']===_0x8122('0x18')&&typeof _0x6baf37['limit']===_0x8122('0x18');var _0x2acf8f=_0x559256[_0x8122('0x19')];var _0x4bfb9e=_0x3ed5d1?0x0:_0x6baf37['offset'];var _0x4f7277=_0x3ed5d1?_0x559256['count']:_0x6baf37['offset']+_0x6baf37[_0x8122('0x1a')];var _0x2511e9;if(_0x4f7277>=_0x2acf8f){_0x4f7277=_0x2acf8f;_0x2511e9=0xc8;}else{_0x2511e9=0xce;}_0xfa15a2[_0x8122('0x15')](_0x2511e9);return _0xfa15a2['set']('Content-Range',_0x4bfb9e+'-'+_0x4f7277+'/'+_0x2acf8f)[_0x8122('0x17')](_0x559256);}return null;};}function patchUpdates(_0x174321){return function(_0x68761a){try{jsonpatch['apply'](_0x68761a,_0x174321,!![]);}catch(_0x15e635){return BPromise[_0x8122('0x1b')](_0x15e635);}return _0x68761a[_0x8122('0x1c')]();};}function saveUpdates(_0x988c0c,_0x3c6226){return function(_0x130e1b){if(_0x130e1b){return _0x130e1b[_0x8122('0x1d')](_0x988c0c)[_0x8122('0x1e')](function(_0x4fc6af){return _0x4fc6af;});}return null;};}function removeEntity(_0x34c185,_0x5cfa77){return function(_0x732946){if(_0x732946){return _0x732946[_0x8122('0x1f')]()[_0x8122('0x1e')](function(){_0x34c185[_0x8122('0x15')](0xcc)[_0x8122('0x16')]();});}};}function handleEntityNotFound(_0x240a6d,_0x40e945){return function(_0x2708a5){if(!_0x2708a5){_0x240a6d[_0x8122('0x14')](0x194);}return _0x2708a5;};}function handleError(_0x4e67ab,_0x1258d7){_0x1258d7=_0x1258d7||0x1f4;return function(_0xa79602){logger[_0x8122('0x20')](_0xa79602[_0x8122('0x21')]);if(_0xa79602[_0x8122('0x22')]){delete _0xa79602[_0x8122('0x22')];}_0x4e67ab[_0x8122('0x15')](_0x1258d7)[_0x8122('0x23')](_0xa79602);};}exports[_0x8122('0x24')]=function(_0x4610b1,_0x4c70f4){var _0x49531a={},_0x2a0b63={},_0x264ccf={'count':0x0,'rows':[]};var _0x5263ca=_['map'](db[_0x8122('0x25')][_0x8122('0x26')],function(_0x367ada){return{'name':_0x367ada['fieldName'],'type':_0x367ada['type'][_0x8122('0x27')]};});_0x2a0b63[_0x8122('0x28')]=_[_0x8122('0x29')](_0x5263ca,_0x8122('0x22'));_0x2a0b63[_0x8122('0x2a')]=_[_0x8122('0x2b')](_0x4610b1[_0x8122('0x2a')]);_0x2a0b63[_0x8122('0x2c')]=_[_0x8122('0x2d')](_0x2a0b63[_0x8122('0x28')],_0x2a0b63['query']);_0x49531a[_0x8122('0x2e')]=_[_0x8122('0x2d')](_0x2a0b63[_0x8122('0x28')],qs[_0x8122('0x2f')](_0x4610b1[_0x8122('0x2a')][_0x8122('0x2f')]));_0x49531a[_0x8122('0x2e')]=_0x49531a[_0x8122('0x2e')]['length']?_0x49531a['attributes']:_0x2a0b63[_0x8122('0x28')];if(!_0x4610b1['query']['hasOwnProperty'](_0x8122('0x30'))){_0x49531a['limit']=qs['limit'](_0x4610b1[_0x8122('0x2a')][_0x8122('0x1a')]);_0x49531a['offset']=qs[_0x8122('0x31')](_0x4610b1['query'][_0x8122('0x31')]);}_0x49531a['order']=qs[_0x8122('0x32')](_0x4610b1[_0x8122('0x2a')]['sort']);_0x49531a['where']=qs['filters'](_[_0x8122('0x33')](_0x4610b1[_0x8122('0x2a')],_0x2a0b63['filters']),_0x5263ca);if(_0x4610b1[_0x8122('0x2a')][_0x8122('0x34')]){_0x49531a[_0x8122('0x35')]=_[_0x8122('0x36')](_0x49531a['where'],{'$or':_[_0x8122('0x29')](_0x5263ca,function(_0x1a1510){if(_0x1a1510[_0x8122('0x37')]!=='VIRTUAL'){var _0x3805ec={};_0x3805ec[_0x1a1510['name']]={'$like':'%'+_0x4610b1[_0x8122('0x2a')]['filter']+'%'};return _0x3805ec;}})});}_0x49531a=_[_0x8122('0x36')]({},_0x49531a,_0x4610b1[_0x8122('0x38')]);var _0x1e6c01={'where':_0x49531a[_0x8122('0x35')]};return db['DeskField'][_0x8122('0x19')](_0x1e6c01)[_0x8122('0x1e')](function(_0x565829){_0x264ccf[_0x8122('0x19')]=_0x565829;if(_0x4610b1[_0x8122('0x2a')][_0x8122('0x39')]){_0x49531a['include']=[{'all':!![]}];}return db[_0x8122('0x25')]['findAll'](_0x49531a);})[_0x8122('0x1e')](function(_0x3258e8){_0x264ccf[_0x8122('0x3a')]=_0x3258e8;return _0x264ccf;})[_0x8122('0x1e')](respondWithFilteredResult(_0x4c70f4,_0x49531a))[_0x8122('0x3b')](handleError(_0x4c70f4,null));};exports['show']=function(_0xbad19,_0x16ab8c){var _0x5bceb1={'raw':!![],'where':{'id':_0xbad19[_0x8122('0x3c')]['id']}},_0x3dbd77={};_0x3dbd77[_0x8122('0x28')]=_[_0x8122('0x2b')](db[_0x8122('0x25')][_0x8122('0x26')]);_0x3dbd77[_0x8122('0x2a')]=_['keys'](_0xbad19[_0x8122('0x2a')]);_0x3dbd77[_0x8122('0x2c')]=_[_0x8122('0x2d')](_0x3dbd77['model'],_0x3dbd77[_0x8122('0x2a')]);_0x5bceb1[_0x8122('0x2e')]=_[_0x8122('0x2d')](_0x3dbd77['model'],qs['fields'](_0xbad19[_0x8122('0x2a')]['fields']));_0x5bceb1['attributes']=_0x5bceb1[_0x8122('0x2e')][_0x8122('0x3d')]?_0x5bceb1[_0x8122('0x2e')]:_0x3dbd77['model'];if(_0xbad19[_0x8122('0x2a')][_0x8122('0x39')]){_0x5bceb1['include']=[{'all':!![]}];}_0x5bceb1=_[_0x8122('0x36')]({},_0x5bceb1,_0xbad19[_0x8122('0x38')]);return db[_0x8122('0x25')][_0x8122('0x3e')](_0x5bceb1)['then'](handleEntityNotFound(_0x16ab8c,null))[_0x8122('0x1e')](respondWithResult(_0x16ab8c,null))['catch'](handleError(_0x16ab8c,null));};exports[_0x8122('0x3f')]=function(_0x21860f,_0x5e6093){return db[_0x8122('0x25')][_0x8122('0x3f')](_0x21860f['body'],{})[_0x8122('0x1e')](respondWithResult(_0x5e6093,0xc9))[_0x8122('0x3b')](handleError(_0x5e6093,null));};exports[_0x8122('0x1d')]=function(_0x8c7e4f,_0x1d9ccf){if(_0x8c7e4f[_0x8122('0x40')]['id']){delete _0x8c7e4f[_0x8122('0x40')]['id'];}return db['DeskField'][_0x8122('0x3e')]({'where':{'id':_0x8c7e4f[_0x8122('0x3c')]['id']}})[_0x8122('0x1e')](handleEntityNotFound(_0x1d9ccf,null))[_0x8122('0x1e')](saveUpdates(_0x8c7e4f['body'],null))[_0x8122('0x1e')](respondWithResult(_0x1d9ccf,null))[_0x8122('0x3b')](handleError(_0x1d9ccf,null));};exports[_0x8122('0x1f')]=function(_0x4bac94,_0x3618cb){return db[_0x8122('0x25')][_0x8122('0x3e')]({'where':{'id':_0x4bac94[_0x8122('0x3c')]['id']}})[_0x8122('0x1e')](handleEntityNotFound(_0x3618cb,null))['then'](removeEntity(_0x3618cb,null))[_0x8122('0x3b')](handleError(_0x3618cb,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 6ce86eb..e28cc75 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 _0x02a6=['define','DeskField','int_desk_fields','desk_unique_index','idField','FieldId','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','exports'];(function(_0x4d41a5,_0x1732a7){var _0x5852f3=function(_0x505e4d){while(--_0x505e4d){_0x4d41a5['push'](_0x4d41a5['shift']());}};_0x5852f3(++_0x1732a7);}(_0x02a6,0xb0));var _0x602a=function(_0x133014,_0x6bd8ac){_0x133014=_0x133014-0x0;var _0x444bad=_0x02a6[_0x133014];return _0x444bad;};'use strict';var _=require(_0x602a('0x0'));var util=require(_0x602a('0x1'));var logger=require('../../config/logger')(_0x602a('0x2'));var moment=require(_0x602a('0x3'));var BPromise=require(_0x602a('0x4'));var rp=require(_0x602a('0x5'));var fs=require('fs');var path=require(_0x602a('0x6'));var rimraf=require(_0x602a('0x7'));var config=require(_0x602a('0x8'));var attributes=require(_0x602a('0x9'));module[_0x602a('0xa')]=function(_0x412dfd,_0xf33b60){return _0x412dfd[_0x602a('0xb')](_0x602a('0xc'),attributes,{'tableName':_0x602a('0xd'),'paranoid':![],'indexes':[{'name':_0x602a('0xe'),'fields':[_0x602a('0xf'),_0x602a('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x99b3=['moment','bluebird','request-promise','rimraf','./intDeskField.attributes','exports','define','int_desk_fields','desk_unique_index','FieldId','util','api'];(function(_0x53c96,_0x1e1e11){var _0x3a22d2=function(_0x24613b){while(--_0x24613b){_0x53c96['push'](_0x53c96['shift']());}};_0x3a22d2(++_0x1e1e11);}(_0x99b3,0x6a));var _0x399b=function(_0x3acccc,_0x3a7a65){_0x3acccc=_0x3acccc-0x0;var _0x1649fe=_0x99b3[_0x3acccc];return _0x1649fe;};'use strict';var _=require('lodash');var util=require(_0x399b('0x0'));var logger=require('../../config/logger')(_0x399b('0x1'));var moment=require(_0x399b('0x2'));var BPromise=require(_0x399b('0x3'));var rp=require(_0x399b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x399b('0x5'));var config=require('../../config/environment');var attributes=require(_0x399b('0x6'));module[_0x399b('0x7')]=function(_0x41a199,_0x5384fc){return _0x41a199[_0x399b('0x8')]('DeskField',attributes,{'tableName':_0x399b('0x9'),'paranoid':![],'indexes':[{'name':_0x399b('0xa'),'fields':['idField',_0x399b('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index 4d6b5ec..fc3ee3f 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 _0x85af=['jayson/promise','client','http','info','request\x20sent','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','DeskField,\x20%s,\x20%s','message','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x333803,_0x5d16cc){var _0x2b04b4=function(_0xad9765){while(--_0xad9765){_0x333803['push'](_0x333803['shift']());}};_0x2b04b4(++_0x5d16cc);}(_0x85af,0xc0));var _0xf85a=function(_0x4b7a2e,_0xfec93b){_0x4b7a2e=_0x4b7a2e-0x0;var _0x48c612=_0x85af[_0x4b7a2e];return _0x48c612;};'use strict';var _=require('lodash');var util=require(_0xf85a('0x0'));var moment=require('moment');var BPromise=require(_0xf85a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf85a('0x2'));var db=require(_0xf85a('0x3'))['db'];var utils=require(_0xf85a('0x4'));var logger=require(_0xf85a('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf85a('0x6'));var client=jayson[_0xf85a('0x7')][_0xf85a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x386ee3,_0x4cd0a5,_0x19f917){return new BPromise(function(_0x4e85c3,_0xa3fe15){return client['request'](_0x386ee3,_0x19f917)['then'](function(_0x31045f){logger[_0xf85a('0x9')]('DeskField,\x20%s,\x20%s',_0x4cd0a5,_0xf85a('0xa'));logger['debug'](_0xf85a('0xb'),_0x4cd0a5,_0xf85a('0xa'),JSON[_0xf85a('0xc')](_0x31045f));if(_0x31045f[_0xf85a('0xd')]){if(_0x31045f[_0xf85a('0xd')]['code']===0x1f4){logger['error'](_0xf85a('0xe'),_0x4cd0a5,_0x31045f[_0xf85a('0xd')][_0xf85a('0xf')]);return _0xa3fe15(_0x31045f[_0xf85a('0xd')][_0xf85a('0xf')]);}logger[_0xf85a('0xd')](_0xf85a('0xe'),_0x4cd0a5,_0x31045f['error'][_0xf85a('0xf')]);return _0x4e85c3(_0x31045f['error'][_0xf85a('0xf')]);}else{logger[_0xf85a('0x9')](_0xf85a('0xe'),_0x4cd0a5,_0xf85a('0xa'));_0x4e85c3(_0x31045f[_0xf85a('0x10')][_0xf85a('0xf')]);}})[_0xf85a('0x11')](function(_0x33c115){logger[_0xf85a('0xd')](_0xf85a('0xe'),_0x4cd0a5,_0x33c115);_0xa3fe15(_0x33c115);});});} \ No newline at end of file +var _0xa18d=['then','DeskField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x409dfa,_0x3a16a5){var _0x36ec21=function(_0x4d00d4){while(--_0x4d00d4){_0x409dfa['push'](_0x409dfa['shift']());}};_0x36ec21(++_0x3a16a5);}(_0xa18d,0x13c));var _0xda18=function(_0x3f7b88,_0x3c3e4d){_0x3f7b88=_0x3f7b88-0x0;var _0x102008=_0xa18d[_0x3f7b88];return _0x102008;};'use strict';var _=require(_0xda18('0x0'));var util=require(_0xda18('0x1'));var moment=require(_0xda18('0x2'));var BPromise=require(_0xda18('0x3'));var rs=require(_0xda18('0x4'));var fs=require('fs');var Redis=require(_0xda18('0x5'));var db=require(_0xda18('0x6'))['db'];var utils=require(_0xda18('0x7'));var logger=require(_0xda18('0x8'))(_0xda18('0x9'));var config=require(_0xda18('0xa'));var jayson=require(_0xda18('0xb'));var client=jayson[_0xda18('0xc')][_0xda18('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4651c0,_0x8439e6,_0x43e445){return new BPromise(function(_0x4ec1b8,_0xb09885){return client['request'](_0x4651c0,_0x43e445)[_0xda18('0xe')](function(_0x227382){logger['info'](_0xda18('0xf'),_0x8439e6,'request\x20sent');logger['debug']('DeskField,\x20%s,\x20%s,\x20%s',_0x8439e6,_0xda18('0x10'),JSON[_0xda18('0x11')](_0x227382));if(_0x227382[_0xda18('0x12')]){if(_0x227382[_0xda18('0x12')][_0xda18('0x13')]===0x1f4){logger[_0xda18('0x12')](_0xda18('0xf'),_0x8439e6,_0x227382[_0xda18('0x12')][_0xda18('0x14')]);return _0xb09885(_0x227382['error'][_0xda18('0x14')]);}logger[_0xda18('0x12')](_0xda18('0xf'),_0x8439e6,_0x227382[_0xda18('0x12')][_0xda18('0x14')]);return _0x4ec1b8(_0x227382[_0xda18('0x12')]['message']);}else{logger['info'](_0xda18('0xf'),_0x8439e6,'request\x20sent');_0x4ec1b8(_0x227382[_0xda18('0x15')][_0xda18('0x14')]);}})['catch'](function(_0x25302d){logger['error'](_0xda18('0xf'),_0x8439e6,_0x25302d);_0xb09885(_0x25302d);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 0d6b6de..5192bb7 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 _0xa5c1=['./intDynamics365Account.controller','get','isAuthenticated','/:id','show','/:id/configurations','getFields','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x367aff,_0x3a83b3){var _0x50b3fa=function(_0x133c32){while(--_0x133c32){_0x367aff['push'](_0x367aff['shift']());}};_0x50b3fa(++_0x3a83b3);}(_0xa5c1,0xa5));var _0x1a5c=function(_0x12bd82,_0x2f89ca){_0x12bd82=_0x12bd82-0x0;var _0x1c8039=_0xa5c1[_0x12bd82];return _0x1c8039;};'use strict';var multer=require(_0x1a5c('0x0'));var util=require('util');var path=require(_0x1a5c('0x1'));var timeout=require(_0x1a5c('0x2'));var express=require(_0x1a5c('0x3'));var router=express[_0x1a5c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1a5c('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1a5c('0x6'));router[_0x1a5c('0x7')]('/',auth[_0x1a5c('0x8')](),controller['index']);router['get'](_0x1a5c('0x9'),auth['isAuthenticated'](),controller[_0x1a5c('0xa')]);router[_0x1a5c('0x7')](_0x1a5c('0xb'),auth[_0x1a5c('0x8')](),controller['getConfigurations']);router[_0x1a5c('0x7')]('/:id/fields',auth[_0x1a5c('0x8')](),controller[_0x1a5c('0xc')]);router[_0x1a5c('0xd')]('/',auth[_0x1a5c('0x8')](),controller[_0x1a5c('0xe')]);router[_0x1a5c('0xd')](_0x1a5c('0xb'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x1a5c('0xf')]('/:id',auth[_0x1a5c('0x8')](),controller['update']);router[_0x1a5c('0x10')](_0x1a5c('0x9'),auth['isAuthenticated'](),controller[_0x1a5c('0x11')]);module[_0x1a5c('0x12')]=router; \ No newline at end of file +var _0x34da=['/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDynamics365Account.controller','get','index'];(function(_0x10a212,_0x579d85){var _0x23c82b=function(_0x412ea9){while(--_0x412ea9){_0x10a212['push'](_0x10a212['shift']());}};_0x23c82b(++_0x579d85);}(_0x34da,0x113));var _0xa34d=function(_0x1cfa90,_0x59603a){_0x1cfa90=_0x1cfa90-0x0;var _0x12b21f=_0x34da[_0x1cfa90];return _0x12b21f;};'use strict';var multer=require(_0xa34d('0x0'));var util=require(_0xa34d('0x1'));var path=require(_0xa34d('0x2'));var timeout=require(_0xa34d('0x3'));var express=require('express');var router=express[_0xa34d('0x4')]();var fs_extra=require(_0xa34d('0x5'));var auth=require(_0xa34d('0x6'));var interaction=require(_0xa34d('0x7'));var config=require('../../config/environment');var controller=require(_0xa34d('0x8'));router[_0xa34d('0x9')]('/',auth['isAuthenticated'](),controller[_0xa34d('0xa')]);router[_0xa34d('0x9')](_0xa34d('0xb'),auth[_0xa34d('0xc')](),controller[_0xa34d('0xd')]);router['get'](_0xa34d('0xe'),auth[_0xa34d('0xc')](),controller[_0xa34d('0xf')]);router[_0xa34d('0x9')](_0xa34d('0x10'),auth['isAuthenticated'](),controller[_0xa34d('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa34d('0x12')]);router[_0xa34d('0x13')](_0xa34d('0xe'),auth[_0xa34d('0xc')](),controller[_0xa34d('0x14')]);router[_0xa34d('0x15')]('/:id',auth[_0xa34d('0xc')](),controller[_0xa34d('0x16')]);router[_0xa34d('0x17')]('/:id',auth[_0xa34d('0xc')](),controller[_0xa34d('0x18')]);module[_0xa34d('0x19')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 6f1c7e0..45134f5 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 _0xae24=['STRING','BOOLEAN','sequelize'];(function(_0x5a6bd3,_0x1b50f3){var _0x1c8b2a=function(_0x3ee7d2){while(--_0x3ee7d2){_0x5a6bd3['push'](_0x5a6bd3['shift']());}};_0x1c8b2a(++_0x1b50f3);}(_0xae24,0x182));var _0x4ae2=function(_0x3eda75,_0x3f9bad){_0x3eda75=_0x3eda75-0x0;var _0xf47dc3=_0xae24[_0x3eda75];return _0xf47dc3;};'use strict';var Sequelize=require(_0x4ae2('0x0'));module['exports']={'name':{'type':Sequelize[_0x4ae2('0x1')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x4ae2('0x1')]},'remoteUri':{'type':Sequelize[_0x4ae2('0x1')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x4ae2('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x4ae2('0x1')]},'modernAuthentication':{'type':Sequelize[_0x4ae2('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x0c23=['STRING','BOOLEAN','sequelize','exports'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x0c23,0x13e));var _0x30c2=function(_0x40a2b1,_0x36a0a0){_0x40a2b1=_0x40a2b1-0x0;var _0x5f520c=_0x0c23[_0x40a2b1];return _0x5f520c;};'use strict';var Sequelize=require(_0x30c2('0x0'));module[_0x30c2('0x1')]={'name':{'type':Sequelize[_0x30c2('0x2')]},'username':{'type':Sequelize[_0x30c2('0x2')]},'password':{'type':Sequelize[_0x30c2('0x2')]},'remoteUri':{'type':Sequelize[_0x30c2('0x2')]},'tenantId':{'type':Sequelize[_0x30c2('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x30c2('0x2')]},'serverUrl':{'type':Sequelize[_0x30c2('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x30c2('0x2')]},'modernAuthentication':{'type':Sequelize[_0x30c2('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 2ddcdff..bf773dc 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 _0xbee7=['exchangerate','firstresponsebykpiidname','followupby','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyname','modifiedbyyominame','modifiedonbehalfbyname','msdyn_iotalertname','numberofchildincidents','onholdtime','owneridname','owneridtype','parentcaseidname','primarycontactidname','primarycontactidyominame','productidname','productserialnumber','resolveby','resolvebykpiidname','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','data7','access_token','data5','POST','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','value',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','4.0','Attributes','includes','LogicalName','@odata.type','PicklistAttributeMetadata','push','MetadataId','all','forEach','isNil','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','test','statusCode','Wrong\x20credentials','GET','EntityDefinitions(',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','FalseOption','DisplayName','?$select=DisplayName,LogicalName','request-promise','util','lodash','../../components/parsers/qs','../../config/logger','api','status','offset','undefined','limit','count','set','Content-Range','destroy','then','sendStatus','error','stack','name','send','index','Dynamics365Account','rawAttributes','key','query','keys','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','filters','length','find','create','body','getConfigurations','Dynamics365Configuration','findOne','AccountId','Subjects','channel','Descriptions','getDescriptions','Dynamics365Field','substring','lastIndexOf','format','%s/api/data/v9.0/','getFields','ticketType','incident','title','customerid','ownerid','caseorigincode','subject','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon'];(function(_0x461a54,_0x4fcd3d){var _0x234455=function(_0x229330){while(--_0x229330){_0x461a54['push'](_0x461a54['shift']());}};_0x234455(++_0x4fcd3d);}(_0xbee7,0x1c6));var _0x7bee=function(_0x195601,_0xdae54f){_0x195601=_0x195601-0x0;var _0x5263d6=_0xbee7[_0x195601];return _0x5263d6;};'use strict';var rp=require(_0x7bee('0x0'));var util=require(_0x7bee('0x1'));var _=require(_0x7bee('0x2'));var qs=require(_0x7bee('0x3'));var logger=require(_0x7bee('0x4'))(_0x7bee('0x5'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithResult(_0x46c318,_0x40605b){_0x40605b=_0x40605b||0xc8;return function(_0x376a66){if(_0x376a66){return _0x46c318[_0x7bee('0x6')](_0x40605b)['json'](_0x376a66);}};}function respondWithFilteredResult(_0x379003,_0x432253){return function(_0x14c133){if(_0x14c133){var _0x11d084=typeof _0x432253[_0x7bee('0x7')]===_0x7bee('0x8')&&typeof _0x432253[_0x7bee('0x9')]===_0x7bee('0x8');var _0x3f3a7b=_0x14c133[_0x7bee('0xa')];var _0x5b04c5=_0x11d084?0x0:_0x432253[_0x7bee('0x7')];var _0x7d7b25=_0x11d084?_0x14c133[_0x7bee('0xa')]:_0x432253[_0x7bee('0x7')]+_0x432253[_0x7bee('0x9')];var _0x3dc251;if(_0x7d7b25>=_0x3f3a7b){_0x7d7b25=_0x3f3a7b;_0x3dc251=0xc8;}else{_0x3dc251=0xce;}_0x379003[_0x7bee('0x6')](_0x3dc251);return _0x379003[_0x7bee('0xb')](_0x7bee('0xc'),_0x5b04c5+'-'+_0x7d7b25+'/'+_0x3f3a7b)['json'](_0x14c133);}return null;};}function saveUpdates(_0x4fd947){return function(_0x100ac9){if(_0x100ac9){return _0x100ac9['update'](_0x4fd947)['then'](function(_0x50159a){return _0x50159a;});}return null;};}function removeEntity(_0x2c0db4){return function(_0x47a8c1){if(_0x47a8c1){return _0x47a8c1[_0x7bee('0xd')]()[_0x7bee('0xe')](function(){_0x2c0db4[_0x7bee('0x6')](0xcc)['end']();});}};}function handleEntityNotFound(_0x342178){return function(_0x33a0e4){if(!_0x33a0e4){_0x342178[_0x7bee('0xf')](0x194);}return _0x33a0e4;};}function handleError(_0x6088b8,_0x46016c){_0x46016c=_0x46016c||0x1f4;return function(_0x36cb0e){logger[_0x7bee('0x10')](_0x36cb0e[_0x7bee('0x11')]);if(_0x36cb0e['name']){delete _0x36cb0e[_0x7bee('0x12')];}_0x6088b8[_0x7bee('0x6')](_0x46016c)[_0x7bee('0x13')](_0x36cb0e);};}exports[_0x7bee('0x14')]=function(_0x375944,_0x7a577){var _0x583d5b={},_0x49d74b={},_0x9bb08d={'count':0x0,'rows':[]};var _0x69c44d=_['map'](db[_0x7bee('0x15')][_0x7bee('0x16')],function(_0x443a0a){return{'name':_0x443a0a['fieldName'],'type':_0x443a0a['type'][_0x7bee('0x17')]};});_0x49d74b['model']=_['map'](_0x69c44d,_0x7bee('0x12'));_0x49d74b[_0x7bee('0x18')]=_[_0x7bee('0x19')](_0x375944[_0x7bee('0x18')]);_0x49d74b['filters']=_['intersection'](_0x49d74b[_0x7bee('0x1a')],_0x49d74b[_0x7bee('0x18')]);_0x583d5b[_0x7bee('0x1b')]=_[_0x7bee('0x1c')](_0x49d74b[_0x7bee('0x1a')],qs[_0x7bee('0x1d')](_0x375944[_0x7bee('0x18')][_0x7bee('0x1d')]));_0x583d5b[_0x7bee('0x1b')]=_0x583d5b[_0x7bee('0x1b')]['length']?_0x583d5b['attributes']:_0x49d74b[_0x7bee('0x1a')];if(!_0x375944[_0x7bee('0x18')][_0x7bee('0x1e')](_0x7bee('0x1f'))){_0x583d5b[_0x7bee('0x9')]=qs[_0x7bee('0x9')](_0x375944[_0x7bee('0x18')]['limit']);_0x583d5b[_0x7bee('0x7')]=qs[_0x7bee('0x7')](_0x375944[_0x7bee('0x18')]['offset']);}_0x583d5b[_0x7bee('0x20')]=qs['sort'](_0x375944[_0x7bee('0x18')][_0x7bee('0x21')]);_0x583d5b['where']=qs['filters'](_[_0x7bee('0x22')](_0x375944[_0x7bee('0x18')],_0x49d74b['filters']),_0x69c44d);if(_0x375944[_0x7bee('0x18')][_0x7bee('0x23')]){_0x583d5b[_0x7bee('0x24')]=_[_0x7bee('0x25')](_0x583d5b[_0x7bee('0x24')],{'$or':_[_0x7bee('0x26')](_0x69c44d,function(_0x4fb5ab){if(_0x4fb5ab[_0x7bee('0x27')]!==_0x7bee('0x28')){var _0x55373c={};_0x55373c[_0x4fb5ab[_0x7bee('0x12')]]={'$like':'%'+_0x375944[_0x7bee('0x18')][_0x7bee('0x23')]+'%'};return _0x55373c;}})});}_0x583d5b=_[_0x7bee('0x25')]({},_0x583d5b,_0x375944[_0x7bee('0x29')]);var _0x300f13={'where':_0x583d5b[_0x7bee('0x24')]};return db[_0x7bee('0x15')]['count'](_0x300f13)[_0x7bee('0xe')](function(_0x4d5211){_0x9bb08d[_0x7bee('0xa')]=_0x4d5211;if(_0x375944['query'][_0x7bee('0x2a')]){_0x583d5b[_0x7bee('0x2b')]=[{'all':!![]}];}return db[_0x7bee('0x15')][_0x7bee('0x2c')](_0x583d5b);})['then'](function(_0x22bf0a){_0x9bb08d[_0x7bee('0x2d')]=_0x22bf0a;return _0x9bb08d;})['then'](respondWithFilteredResult(_0x7a577,_0x583d5b))[_0x7bee('0x2e')](handleError(_0x7a577,null));};exports[_0x7bee('0x2f')]=function(_0x1f2753,_0x41ec85){var _0x109f50={'raw':![],'where':{'id':_0x1f2753[_0x7bee('0x30')]['id']}},_0x191400={};_0x191400['model']=_[_0x7bee('0x19')](db[_0x7bee('0x15')]['rawAttributes']);_0x191400[_0x7bee('0x18')]=_[_0x7bee('0x19')](_0x1f2753[_0x7bee('0x18')]);_0x191400[_0x7bee('0x31')]=_[_0x7bee('0x1c')](_0x191400[_0x7bee('0x1a')],_0x191400[_0x7bee('0x18')]);_0x109f50[_0x7bee('0x1b')]=_[_0x7bee('0x1c')](_0x191400[_0x7bee('0x1a')],qs[_0x7bee('0x1d')](_0x1f2753[_0x7bee('0x18')]['fields']));_0x109f50[_0x7bee('0x1b')]=_0x109f50[_0x7bee('0x1b')][_0x7bee('0x32')]?_0x109f50[_0x7bee('0x1b')]:_0x191400[_0x7bee('0x1a')];if(_0x1f2753['query'][_0x7bee('0x2a')]){_0x109f50[_0x7bee('0x2b')]=[{'all':!![]}];}_0x109f50=_['merge']({},_0x109f50,_0x1f2753[_0x7bee('0x29')]);return db[_0x7bee('0x15')][_0x7bee('0x33')](_0x109f50)[_0x7bee('0xe')](handleEntityNotFound(_0x41ec85,null))[_0x7bee('0xe')](respondWithResult(_0x41ec85,null))['catch'](handleError(_0x41ec85,null));};exports[_0x7bee('0x34')]=function(_0x36d06d,_0x418d5f){return db[_0x7bee('0x15')]['create'](_0x36d06d['body'],{})[_0x7bee('0xe')](respondWithResult(_0x418d5f,0xc9))[_0x7bee('0x2e')](handleError(_0x418d5f,null));};exports['update']=function(_0x53c3d4,_0x20b976){if(_0x53c3d4[_0x7bee('0x35')]['id']){delete _0x53c3d4[_0x7bee('0x35')]['id'];}return db[_0x7bee('0x15')][_0x7bee('0x33')]({'where':{'id':_0x53c3d4[_0x7bee('0x30')]['id']}})[_0x7bee('0xe')](handleEntityNotFound(_0x20b976,null))[_0x7bee('0xe')](saveUpdates(_0x53c3d4[_0x7bee('0x35')],null))[_0x7bee('0xe')](respondWithResult(_0x20b976,null))[_0x7bee('0x2e')](handleError(_0x20b976,null));};exports[_0x7bee('0xd')]=function(_0x3a25be,_0x4005b8){return db['Dynamics365Account'][_0x7bee('0x33')]({'where':{'id':_0x3a25be[_0x7bee('0x30')]['id']}})['then'](handleEntityNotFound(_0x4005b8,null))['then'](removeEntity(_0x4005b8,null))[_0x7bee('0x2e')](handleError(_0x4005b8,null));};exports[_0x7bee('0x36')]=function(_0x4fa567,_0x5b74dc){var _0x593078={};var _0x2ef84b={};var _0x18e723;var _0xedca5b;return db[_0x7bee('0x15')]['findOne']({'where':{'id':_0x4fa567[_0x7bee('0x30')]['id']}})[_0x7bee('0xe')](handleEntityNotFound(_0x5b74dc,null))[_0x7bee('0xe')](function(_0x51fede){if(_0x51fede){_0x18e723=_0x51fede;_0x2ef84b['model']=_[_0x7bee('0x19')](db[_0x7bee('0x37')][_0x7bee('0x16')]);_0x2ef84b[_0x7bee('0x18')]=_[_0x7bee('0x19')](_0x4fa567[_0x7bee('0x18')]);_0x2ef84b['filters']=_[_0x7bee('0x1c')](_0x2ef84b[_0x7bee('0x1a')],_0x2ef84b['query']);_0x593078[_0x7bee('0x1b')]=_[_0x7bee('0x1c')](_0x2ef84b[_0x7bee('0x1a')],qs[_0x7bee('0x1d')](_0x4fa567['query']['fields']));_0x593078[_0x7bee('0x1b')]=_0x593078[_0x7bee('0x1b')]['length']?_0x593078[_0x7bee('0x1b')]:_0x2ef84b[_0x7bee('0x1a')];_0x593078['order']=qs[_0x7bee('0x21')](_0x4fa567[_0x7bee('0x18')][_0x7bee('0x21')]);_0x593078[_0x7bee('0x24')]=qs['filters'](_[_0x7bee('0x22')](_0x4fa567['query'],_0x2ef84b[_0x7bee('0x31')]));if(_0x4fa567[_0x7bee('0x18')][_0x7bee('0x23')]){_0x593078[_0x7bee('0x24')]=_[_0x7bee('0x25')](_0x593078['where'],{'$or':_[_0x7bee('0x26')](_0x593078[_0x7bee('0x1b')],function(_0x595f25){var _0x51177c={};_0x51177c[_0x595f25]={'$like':'%'+_0x4fa567['query']['filter']+'%'};return _0x51177c;})});}_0x593078=_[_0x7bee('0x25')]({},_0x593078,_0x4fa567[_0x7bee('0x29')]);return _0x18e723[_0x7bee('0x36')](_0x593078);}})[_0x7bee('0xe')](function(_0x2e0509){if(_0x2e0509){_0xedca5b=_0x2e0509[_0x7bee('0x32')];if(!_0x4fa567['query']['hasOwnProperty'](_0x7bee('0x1f'))){_0x593078[_0x7bee('0x9')]=qs[_0x7bee('0x9')](_0x4fa567[_0x7bee('0x18')][_0x7bee('0x9')]);_0x593078['offset']=qs[_0x7bee('0x7')](_0x4fa567[_0x7bee('0x18')][_0x7bee('0x7')]);}return _0x18e723[_0x7bee('0x36')](_0x593078);}})['then'](function(_0x56b8d4){if(_0x56b8d4){return _0x56b8d4?{'count':_0xedca5b,'rows':_0x56b8d4}:null;}})[_0x7bee('0xe')](respondWithResult(_0x5b74dc,null))[_0x7bee('0x2e')](handleError(_0x5b74dc,null));};exports['addConfiguration']=function(_0x165743,_0x2e72f1){if(_0x165743[_0x7bee('0x35')]['id']){delete _0x165743[_0x7bee('0x35')]['id'];}return db[_0x7bee('0x15')][_0x7bee('0x38')]({'where':{'id':_0x165743[_0x7bee('0x30')]['id']}})[_0x7bee('0xe')](handleEntityNotFound(_0x2e72f1,null))[_0x7bee('0xe')](function(_0x2ac1c9){if(_0x2ac1c9){_0x165743[_0x7bee('0x35')][_0x7bee('0x39')]=_0x2ac1c9['id'];_0x165743[_0x7bee('0x35')][_0x7bee('0x3a')]=integrations['getSubjects'](_0x165743[_0x7bee('0x35')][_0x7bee('0x3b')],_0x165743['body'][_0x7bee('0x27')]);_0x165743[_0x7bee('0x35')][_0x7bee('0x3c')]=integrations[_0x7bee('0x3d')](_0x165743[_0x7bee('0x35')]['channel'],_0x165743['body'][_0x7bee('0x27')]);return db[_0x7bee('0x37')][_0x7bee('0x34')](_0x165743[_0x7bee('0x35')],{'include':[{'model':db[_0x7bee('0x3e')],'as':_0x7bee('0x3a')},{'model':db[_0x7bee('0x3e')],'as':_0x7bee('0x3c')}]});}return null;})['then'](respondWithResult(_0x2e72f1,null))[_0x7bee('0x2e')](handleError(_0x2e72f1,null));};function sanitizeRemoteUri(_0x2a5c46){var _0xd70cd8=_0x2a5c46['slice'](-0x1);if(_0xd70cd8==='/')return _0x2a5c46[_0x7bee('0x3f')](0x0,_0x2a5c46[_0x7bee('0x40')](_0xd70cd8));return _0x2a5c46;}function getWebApiUrl(_0x58b78d){return util[_0x7bee('0x41')](_0x7bee('0x42'),_0x58b78d);}exports[_0x7bee('0x43')]=function(_0x460ea6,_0x3a9910){var _0x18c521=_0x460ea6[_0x7bee('0x18')][_0x7bee('0x44')];var _0x1f7b31=_0x18c521===_0x7bee('0x45')?'Incident':'PhoneCall';var _0x30a0a9='';var _0x4cabd8='';var _0x505ded='';var _0x10fecc='';var _0x87729b='';var _0x5c9020='';var _0x550cdd='';var _0x1334b0='';var _0xe3ba7=[_0x7bee('0x46'),'description',_0x7bee('0x47'),_0x7bee('0x48'),_0x7bee('0x49'),_0x7bee('0x4a'),'phonenumber',_0x7bee('0x4b'),_0x7bee('0x4c'),_0x7bee('0x4d')];var _0x401dbc=[_0x7bee('0x4e'),_0x7bee('0x4f'),_0x7bee('0x50'),_0x7bee('0x51'),'contactidname','contactidyominame','contractdetailidname','contractidname',_0x7bee('0x52'),_0x7bee('0x53'),_0x7bee('0x54'),_0x7bee('0x55'),_0x7bee('0x56'),_0x7bee('0x57'),'createdonbehalfbyyominame','customeridname',_0x7bee('0x58'),_0x7bee('0x59'),_0x7bee('0x5a'),_0x7bee('0x5b'),_0x7bee('0x5c'),_0x7bee('0x5d'),_0x7bee('0x5e'),_0x7bee('0x5f'),_0x7bee('0x60'),_0x7bee('0x61'),'importsequencenumber','influencescore',_0x7bee('0x62'),_0x7bee('0x63'),_0x7bee('0x64'),_0x7bee('0x65'),'modifiedbyexternalpartyyominame',_0x7bee('0x66'),_0x7bee('0x67'),'modifiedon',_0x7bee('0x68'),'modifiedonbehalfbyyominame','msdyn_incidenttypename',_0x7bee('0x69'),_0x7bee('0x6a'),_0x7bee('0x6b'),'overriddencreatedon',_0x7bee('0x6c'),_0x7bee('0x6d'),'owneridyominame',_0x7bee('0x6e'),_0x7bee('0x6f'),_0x7bee('0x70'),'prioritycodename',_0x7bee('0x71'),_0x7bee('0x72'),_0x7bee('0x73'),_0x7bee('0x74'),'responseby',_0x7bee('0x75'),_0x7bee('0x76'),_0x7bee('0x77'),_0x7bee('0x78'),'slaname','socialprofileidname',_0x7bee('0x79'),_0x7bee('0x7a'),_0x7bee('0x7b'),_0x7bee('0x7c'),_0x7bee('0x7d'),_0x7bee('0x7e'),'traversedpath',_0x7bee('0x7f'),_0x7bee('0x80')];var _0x47ce5d=_0xe3ba7[_0x7bee('0x81')](_0x401dbc);return db[_0x7bee('0x15')]['findOne']({'where':{'id':_0x460ea6['params']['id']},'attributes':['id',_0x7bee('0x82'),_0x7bee('0x83'),_0x7bee('0x84'),_0x7bee('0x85'),_0x7bee('0x86'),_0x7bee('0x87'),_0x7bee('0x88')],'include':[{'model':db[_0x7bee('0x89')],'as':_0x7bee('0x89'),'attributes':['id','data5',_0x7bee('0x8a')]}]})[_0x7bee('0xe')](handleEntityNotFound(_0x3a9910,null))[_0x7bee('0xe')](function(_0x471310){if(_0x471310){if(_0x471310['modernAuthentication']){_0x471310[_0x7bee('0x8b')]=_0x471310[_0x7bee('0x89')][_0x7bee('0x8c')];_0x1334b0=sanitizeRemoteUri(_0x471310[_0x7bee('0x89')]['data7']);_0x550cdd=getWebApiUrl(_0x1334b0);return _0x471310;}_0x1334b0=sanitizeRemoteUri(_0x471310['remoteUri']);_0x550cdd=getWebApiUrl(_0x1334b0);var _0xe8bc82={'method':_0x7bee('0x8d'),'uri':'https://login.microsoftonline.com/'+_0x471310[_0x7bee('0x85')]+'/oauth2/token','form':{'client_id':_0x471310[_0x7bee('0x86')],'resource':_0x1334b0,'username':_0x471310[_0x7bee('0x82')],'password':_0x471310[_0x7bee('0x83')],'grant_type':_0x7bee('0x83'),'client_secret':_0x471310['clientSecret']},'json':!![]};return rp(_0xe8bc82);}})[_0x7bee('0xe')](function(_0x59eeff){_0x5c9020=_0x59eeff[_0x7bee('0x8b')];var _0x49a28b={'method':'GET','uri':encodeURI(_0x550cdd+_0x7bee('0x8e')+_0x1f7b31+'\x27'),'headers':{'Authorization':_0x7bee('0x8f')+_0x5c9020,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x49a28b);})[_0x7bee('0xe')](function(_0x5c770e){var _0x3b7094=_0x5c770e[_0x7bee('0x90')][0x0];var _0x431abe=_0x3b7094['MetadataId'];var _0x2289e2={'method':'GET','uri':_0x550cdd+'EntityDefinitions('+_0x431abe+_0x7bee('0x91'),'headers':{'Authorization':_0x7bee('0x8f')+_0x5c9020,'If-None-Match':null,'OData-Version':_0x7bee('0x92')},'json':!![]};return rp(_0x2289e2);})[_0x7bee('0xe')](function(_0x2eab87){_0x30a0a9=_0x2eab87;_0x4cabd8=_0x30a0a9[_0x7bee('0x93')];_0x4cabd8=_['remove'](_0x4cabd8,function(_0x39b6fc){return!_0x47ce5d[_0x7bee('0x94')](_0x39b6fc[_0x7bee('0x95')]);});var _0x29aa5=[];var _0x55c5f9=[];_0x4cabd8['forEach'](function(_0x3212f9){if(_0x3212f9[_0x7bee('0x96')]){var _0x1339ea=_0x3212f9[_0x7bee('0x96')][_0x7bee('0x3f')](_0x3212f9[_0x7bee('0x96')][_0x7bee('0x40')]('.')+0x1);if(_0x1339ea===_0x7bee('0x97')){_0x29aa5[_0x7bee('0x98')](getSelectList(_0x550cdd,_0x18c521,_0x55c5f9,_0x30a0a9[_0x7bee('0x99')],_0x3212f9[_0x7bee('0x99')],_0x5c9020));}}});return Promise[_0x7bee('0x9a')](_0x29aa5);})['then'](function(_0x580b47){_0x505ded=_0x580b47[0x0];var _0x47d4d9=[];var _0x518b65=[];_0x4cabd8[_0x7bee('0x9b')](function(_0x250881){if(!_[_0x7bee('0x9c')](_0x250881[_0x7bee('0x96')])){var _0x2acc22=_0x250881[_0x7bee('0x96')][_0x7bee('0x3f')](_0x250881[_0x7bee('0x96')][_0x7bee('0x40')]('.')+0x1);if(_0x2acc22==='BooleanAttributeMetadata'){_0x47d4d9[_0x7bee('0x98')](getBooleanList(_0x550cdd,_0x18c521,_0x518b65,_0x30a0a9[_0x7bee('0x99')],_0x250881[_0x7bee('0x99')],_0x5c9020));}}});return Promise['all'](_0x47d4d9);})['then'](function(_0x1e205c){_0x10fecc=_0x1e205c[0x0];var _0x21f6af=[];var _0x157aec=[];_0x4cabd8['forEach'](function(_0x5deaa3){if(_0x5deaa3['@odata.type']){var _0x457c16=_0x5deaa3[_0x7bee('0x96')][_0x7bee('0x3f')](_0x5deaa3[_0x7bee('0x96')][_0x7bee('0x40')]('.')+0x1);if(_0x457c16==='StringAttributeMetadata'||_0x457c16===_0x7bee('0x9d')||_0x457c16===_0x7bee('0x9e')||_0x457c16===_0x7bee('0x9f')||_0x457c16===_0x7bee('0xa0')||_0x457c16===_0x7bee('0xa1')||_0x457c16===_0x7bee('0xa2')||_0x457c16===_0x7bee('0xa3')||_0x457c16==='StateAttributeMetadata'||_0x457c16===_0x7bee('0xa4')){_0x21f6af[_0x7bee('0x98')](getInputList(_0x550cdd,_0x18c521,_0x457c16,_0x157aec,_0x30a0a9[_0x7bee('0x99')],_0x5deaa3[_0x7bee('0x99')],_0x5c9020));}}});return Promise[_0x7bee('0x9a')](_0x21f6af);})['then'](function(_0x21a7a9){_0x87729b=_0x21a7a9[0x0];var _0x3a62b6=_0x505ded[_0x7bee('0x81')](_0x10fecc)[_0x7bee('0x81')](_0x87729b);var _0x263331={'count':_0x3a62b6[_0x7bee('0x32')],'rows':_0x3a62b6};return _0x263331;})['then'](respondWithResult(_0x3a9910,null))[_0x7bee('0x2e')](function(_0x26d1e3){var _0x5bdf88=_0x460ea6['query'][_0x7bee('0xa5')]?0x1f4:_0x26d1e3[_0x7bee('0xa6')]||0x1f4;logger[_0x7bee('0x10')](_0x26d1e3[_0x7bee('0x11')]);delete _0x26d1e3[_0x7bee('0x12')];if(_0x5bdf88===0x191){_0x5bdf88=0x190;}_0x3a9910['status'](_0x5bdf88)['send'](_0x460ea6['query'][_0x7bee('0xa5')]?{'message':_0x7bee('0xa7'),'statusCode':_0x26d1e3[_0x7bee('0xa6')]}:_0x26d1e3);});};function getSelectList(_0x2edd0f,_0x26b846,_0x2da50f,_0x289e77,_0x4a4a8e,_0x512bd1){var _0x21b1d2={'method':_0x7bee('0xa8'),'uri':_0x2edd0f+_0x7bee('0xa9')+_0x289e77+_0x7bee('0xaa')+_0x4a4a8e+_0x7bee('0xab')+_0x7bee('0xac'),'headers':{'Authorization':'Bearer\x20'+_0x512bd1,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x21b1d2)[_0x7bee('0xe')](function(_0x277a9e){var _0x7cbb8b=[];var _0x3f91bd=_0x277a9e[_0x7bee('0xad')][_0x7bee('0xae')];_0x3f91bd[_0x7bee('0x9b')](function(_0x2f75a){_0x7cbb8b[_0x7bee('0x98')]({'name':_0x2f75a[_0x7bee('0xaf')][_0x7bee('0xb0')][_0x7bee('0xaf')],'value':String(_0x2f75a[_0x7bee('0xb1')])});});var _0x1f2e41={'id':_0x26b846+'_'+_0x277a9e[_0x7bee('0x95')],'name':_0x277a9e['DisplayName'][_0x7bee('0xb0')][_0x7bee('0xaf')],'custom':![],'options':_0x7cbb8b};_0x2da50f[_0x7bee('0x98')](_0x1f2e41);return _0x2da50f;});}function getBooleanList(_0x54115,_0x192b3e,_0x4af7b3,_0x27c824,_0xc440b6,_0x4cd56f){var _0x453be9={'method':_0x7bee('0xa8'),'uri':_0x54115+'EntityDefinitions('+_0x27c824+')/Attributes('+_0xc440b6+_0x7bee('0xb2'),'headers':{'Authorization':_0x7bee('0x8f')+_0x4cd56f,'If-None-Match':null,'OData-Version':_0x7bee('0x92')},'json':!![]};return rp(_0x453be9)[_0x7bee('0xe')](function(_0x216cc5){var _0x40a68a=[];_0x40a68a[_0x7bee('0x98')]({'name':_0x216cc5['OptionSet'][_0x7bee('0xb3')][_0x7bee('0xaf')]['UserLocalizedLabel'][_0x7bee('0xaf')],'value':'true'},{'name':_0x216cc5[_0x7bee('0xad')][_0x7bee('0xb4')][_0x7bee('0xaf')][_0x7bee('0xb0')][_0x7bee('0xaf')],'value':'false'});var _0x3b3e1d={'id':_0x192b3e+'_'+_0x216cc5['LogicalName'],'name':_0x216cc5[_0x7bee('0xb5')][_0x7bee('0xb0')][_0x7bee('0xaf')],'custom':![],'options':_0x40a68a};_0x4af7b3[_0x7bee('0x98')](_0x3b3e1d);return _0x4af7b3;});}function getInputList(_0xddd628,_0xd9fb33,_0x589507,_0x414a8b,_0x4627cd,_0x3988d9,_0x47f0c6){var _0x37863a={'method':_0x7bee('0xa8'),'uri':_0xddd628+_0x7bee('0xa9')+_0x4627cd+_0x7bee('0xaa')+_0x3988d9+')/Microsoft.Dynamics.CRM.'+_0x589507+_0x7bee('0xb6'),'headers':{'Authorization':_0x7bee('0x8f')+_0x47f0c6,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x37863a)[_0x7bee('0xe')](function(_0x1f3309){var _0x459606={'id':_0xd9fb33+'_'+_0x1f3309[_0x7bee('0x95')],'name':_0x1f3309['DisplayName'][_0x7bee('0xb0')]?_0x1f3309[_0x7bee('0xb5')][_0x7bee('0xb0')][_0x7bee('0xaf')]:_0x1f3309['LogicalName'],'custom':![],'options':[]};_0x414a8b[_0x7bee('0x98')](_0x459606);return _0x414a8b;});} \ No newline at end of file +var _0x1605=['modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','overriddencreatedon','owneridname','owneridyominame','primarycontactidyominame','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','remoteUri','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','data5','data7','access_token','POST','https://login.microsoftonline.com/','/oauth2/token','password','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','all','isNil','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','statusCode','Wrong\x20credentials',')/Attributes(','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','push','Label','UserLocalizedLabel','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','util','lodash','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','status','offset','undefined','count','limit','set','json','update','then','destroy','sendStatus','error','stack','name','send','index','map','Dynamics365Account','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','filters','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','getConfigurations','findOne','Dynamics365Configuration','order','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','Dynamics365Field','Descriptions','slice','substring','lastIndexOf','getFields','incident','Incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','accountidname','actualserviceunits','billedserviceunits','contactidname','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyyominame','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname'];(function(_0x89ad43,_0xd4b71d){var _0x5bcacc=function(_0x365613){while(--_0x365613){_0x89ad43['push'](_0x89ad43['shift']());}};_0x5bcacc(++_0xd4b71d);}(_0x1605,0x1d4));var _0x5160=function(_0x590688,_0x3652cd){_0x590688=_0x590688-0x0;var _0x1680ec=_0x1605[_0x590688];return _0x1680ec;};'use strict';var rp=require('request-promise');var util=require(_0x5160('0x0'));var _=require(_0x5160('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x5160('0x2'))(_0x5160('0x3'));var db=require(_0x5160('0x4'))['db'];var integrations=require(_0x5160('0x5'));function respondWithResult(_0x3bbba1,_0x379d87){_0x379d87=_0x379d87||0xc8;return function(_0xd2e91b){if(_0xd2e91b){return _0x3bbba1[_0x5160('0x6')](_0x379d87)['json'](_0xd2e91b);}};}function respondWithFilteredResult(_0x5d4441,_0x515b23){return function(_0x231992){if(_0x231992){var _0x2df04a=typeof _0x515b23[_0x5160('0x7')]===_0x5160('0x8')&&typeof _0x515b23['limit']==='undefined';var _0xd720b=_0x231992[_0x5160('0x9')];var _0x49b48c=_0x2df04a?0x0:_0x515b23[_0x5160('0x7')];var _0xe449=_0x2df04a?_0x231992[_0x5160('0x9')]:_0x515b23['offset']+_0x515b23[_0x5160('0xa')];var _0x1bc655;if(_0xe449>=_0xd720b){_0xe449=_0xd720b;_0x1bc655=0xc8;}else{_0x1bc655=0xce;}_0x5d4441[_0x5160('0x6')](_0x1bc655);return _0x5d4441[_0x5160('0xb')]('Content-Range',_0x49b48c+'-'+_0xe449+'/'+_0xd720b)[_0x5160('0xc')](_0x231992);}return null;};}function saveUpdates(_0x2374d5){return function(_0x5c3b01){if(_0x5c3b01){return _0x5c3b01[_0x5160('0xd')](_0x2374d5)[_0x5160('0xe')](function(_0x38e932){return _0x38e932;});}return null;};}function removeEntity(_0x321fb4){return function(_0x6f7cb8){if(_0x6f7cb8){return _0x6f7cb8[_0x5160('0xf')]()[_0x5160('0xe')](function(){_0x321fb4[_0x5160('0x6')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe0717a){return function(_0x30680e){if(!_0x30680e){_0xe0717a[_0x5160('0x10')](0x194);}return _0x30680e;};}function handleError(_0x54d973,_0xd66d0c){_0xd66d0c=_0xd66d0c||0x1f4;return function(_0x477458){logger[_0x5160('0x11')](_0x477458[_0x5160('0x12')]);if(_0x477458['name']){delete _0x477458[_0x5160('0x13')];}_0x54d973[_0x5160('0x6')](_0xd66d0c)[_0x5160('0x14')](_0x477458);};}exports[_0x5160('0x15')]=function(_0x483bef,_0x4307d9){var _0x2e3314={},_0x1fe1f={},_0x5003a3={'count':0x0,'rows':[]};var _0x541195=_[_0x5160('0x16')](db[_0x5160('0x17')][_0x5160('0x18')],function(_0x4f5ee3){return{'name':_0x4f5ee3[_0x5160('0x19')],'type':_0x4f5ee3[_0x5160('0x1a')][_0x5160('0x1b')]};});_0x1fe1f[_0x5160('0x1c')]=_[_0x5160('0x16')](_0x541195,_0x5160('0x13'));_0x1fe1f[_0x5160('0x1d')]=_['keys'](_0x483bef[_0x5160('0x1d')]);_0x1fe1f['filters']=_['intersection'](_0x1fe1f['model'],_0x1fe1f[_0x5160('0x1d')]);_0x2e3314[_0x5160('0x1e')]=_[_0x5160('0x1f')](_0x1fe1f['model'],qs[_0x5160('0x20')](_0x483bef[_0x5160('0x1d')][_0x5160('0x20')]));_0x2e3314[_0x5160('0x1e')]=_0x2e3314['attributes'][_0x5160('0x21')]?_0x2e3314[_0x5160('0x1e')]:_0x1fe1f[_0x5160('0x1c')];if(!_0x483bef['query'][_0x5160('0x22')](_0x5160('0x23'))){_0x2e3314['limit']=qs[_0x5160('0xa')](_0x483bef[_0x5160('0x1d')][_0x5160('0xa')]);_0x2e3314[_0x5160('0x7')]=qs[_0x5160('0x7')](_0x483bef['query']['offset']);}_0x2e3314['order']=qs['sort'](_0x483bef[_0x5160('0x1d')][_0x5160('0x24')]);_0x2e3314['where']=qs[_0x5160('0x25')](_[_0x5160('0x26')](_0x483bef[_0x5160('0x1d')],_0x1fe1f[_0x5160('0x25')]),_0x541195);if(_0x483bef['query']['filter']){_0x2e3314[_0x5160('0x27')]=_[_0x5160('0x28')](_0x2e3314[_0x5160('0x27')],{'$or':_[_0x5160('0x16')](_0x541195,function(_0x2a7382){if(_0x2a7382[_0x5160('0x1a')]!==_0x5160('0x29')){var _0x11142d={};_0x11142d[_0x2a7382['name']]={'$like':'%'+_0x483bef[_0x5160('0x1d')][_0x5160('0x2a')]+'%'};return _0x11142d;}})});}_0x2e3314=_[_0x5160('0x28')]({},_0x2e3314,_0x483bef[_0x5160('0x2b')]);var _0x2a7498={'where':_0x2e3314[_0x5160('0x27')]};return db['Dynamics365Account'][_0x5160('0x9')](_0x2a7498)[_0x5160('0xe')](function(_0x58a4ef){_0x5003a3[_0x5160('0x9')]=_0x58a4ef;if(_0x483bef[_0x5160('0x1d')][_0x5160('0x2c')]){_0x2e3314[_0x5160('0x2d')]=[{'all':!![]}];}return db[_0x5160('0x17')][_0x5160('0x2e')](_0x2e3314);})[_0x5160('0xe')](function(_0x4e95f6){_0x5003a3[_0x5160('0x2f')]=_0x4e95f6;return _0x5003a3;})[_0x5160('0xe')](respondWithFilteredResult(_0x4307d9,_0x2e3314))[_0x5160('0x30')](handleError(_0x4307d9,null));};exports[_0x5160('0x31')]=function(_0x5a26f9,_0x55cad5){var _0x494bb3={'raw':![],'where':{'id':_0x5a26f9[_0x5160('0x32')]['id']}},_0x2376e4={};_0x2376e4['model']=_[_0x5160('0x33')](db[_0x5160('0x17')][_0x5160('0x18')]);_0x2376e4[_0x5160('0x1d')]=_[_0x5160('0x33')](_0x5a26f9[_0x5160('0x1d')]);_0x2376e4[_0x5160('0x25')]=_[_0x5160('0x1f')](_0x2376e4[_0x5160('0x1c')],_0x2376e4['query']);_0x494bb3['attributes']=_[_0x5160('0x1f')](_0x2376e4[_0x5160('0x1c')],qs[_0x5160('0x20')](_0x5a26f9[_0x5160('0x1d')][_0x5160('0x20')]));_0x494bb3['attributes']=_0x494bb3[_0x5160('0x1e')]['length']?_0x494bb3[_0x5160('0x1e')]:_0x2376e4[_0x5160('0x1c')];if(_0x5a26f9[_0x5160('0x1d')][_0x5160('0x2c')]){_0x494bb3['include']=[{'all':!![]}];}_0x494bb3=_[_0x5160('0x28')]({},_0x494bb3,_0x5a26f9[_0x5160('0x2b')]);return db[_0x5160('0x17')][_0x5160('0x34')](_0x494bb3)[_0x5160('0xe')](handleEntityNotFound(_0x55cad5,null))[_0x5160('0xe')](respondWithResult(_0x55cad5,null))['catch'](handleError(_0x55cad5,null));};exports[_0x5160('0x35')]=function(_0x134760,_0x392b71){return db[_0x5160('0x17')]['create'](_0x134760['body'],{})[_0x5160('0xe')](respondWithResult(_0x392b71,0xc9))[_0x5160('0x30')](handleError(_0x392b71,null));};exports[_0x5160('0xd')]=function(_0x1b179a,_0x412406){if(_0x1b179a[_0x5160('0x36')]['id']){delete _0x1b179a[_0x5160('0x36')]['id'];}return db[_0x5160('0x17')][_0x5160('0x34')]({'where':{'id':_0x1b179a[_0x5160('0x32')]['id']}})[_0x5160('0xe')](handleEntityNotFound(_0x412406,null))[_0x5160('0xe')](saveUpdates(_0x1b179a[_0x5160('0x36')],null))['then'](respondWithResult(_0x412406,null))['catch'](handleError(_0x412406,null));};exports['destroy']=function(_0x33094e,_0x273535){return db[_0x5160('0x17')][_0x5160('0x34')]({'where':{'id':_0x33094e[_0x5160('0x32')]['id']}})[_0x5160('0xe')](handleEntityNotFound(_0x273535,null))[_0x5160('0xe')](removeEntity(_0x273535,null))['catch'](handleError(_0x273535,null));};exports[_0x5160('0x37')]=function(_0x2fe533,_0x53e312){var _0x28cf9f={};var _0x2aa39a={};var _0x376bba;var _0x236e23;return db['Dynamics365Account'][_0x5160('0x38')]({'where':{'id':_0x2fe533['params']['id']}})[_0x5160('0xe')](handleEntityNotFound(_0x53e312,null))[_0x5160('0xe')](function(_0x50e5dd){if(_0x50e5dd){_0x376bba=_0x50e5dd;_0x2aa39a['model']=_[_0x5160('0x33')](db[_0x5160('0x39')]['rawAttributes']);_0x2aa39a['query']=_[_0x5160('0x33')](_0x2fe533[_0x5160('0x1d')]);_0x2aa39a[_0x5160('0x25')]=_['intersection'](_0x2aa39a[_0x5160('0x1c')],_0x2aa39a['query']);_0x28cf9f[_0x5160('0x1e')]=_[_0x5160('0x1f')](_0x2aa39a[_0x5160('0x1c')],qs['fields'](_0x2fe533[_0x5160('0x1d')][_0x5160('0x20')]));_0x28cf9f[_0x5160('0x1e')]=_0x28cf9f['attributes']['length']?_0x28cf9f[_0x5160('0x1e')]:_0x2aa39a[_0x5160('0x1c')];_0x28cf9f[_0x5160('0x3a')]=qs[_0x5160('0x24')](_0x2fe533['query'][_0x5160('0x24')]);_0x28cf9f[_0x5160('0x27')]=qs[_0x5160('0x25')](_[_0x5160('0x26')](_0x2fe533[_0x5160('0x1d')],_0x2aa39a[_0x5160('0x25')]));if(_0x2fe533[_0x5160('0x1d')]['filter']){_0x28cf9f[_0x5160('0x27')]=_[_0x5160('0x28')](_0x28cf9f[_0x5160('0x27')],{'$or':_[_0x5160('0x16')](_0x28cf9f['attributes'],function(_0x3330d4){var _0x49d68e={};_0x49d68e[_0x3330d4]={'$like':'%'+_0x2fe533[_0x5160('0x1d')][_0x5160('0x2a')]+'%'};return _0x49d68e;})});}_0x28cf9f=_[_0x5160('0x28')]({},_0x28cf9f,_0x2fe533[_0x5160('0x2b')]);return _0x376bba['getConfigurations'](_0x28cf9f);}})[_0x5160('0xe')](function(_0x6f9a9c){if(_0x6f9a9c){_0x236e23=_0x6f9a9c[_0x5160('0x21')];if(!_0x2fe533[_0x5160('0x1d')][_0x5160('0x22')]('nolimit')){_0x28cf9f['limit']=qs['limit'](_0x2fe533[_0x5160('0x1d')]['limit']);_0x28cf9f[_0x5160('0x7')]=qs['offset'](_0x2fe533[_0x5160('0x1d')][_0x5160('0x7')]);}return _0x376bba[_0x5160('0x37')](_0x28cf9f);}})[_0x5160('0xe')](function(_0x1a06d2){if(_0x1a06d2){return _0x1a06d2?{'count':_0x236e23,'rows':_0x1a06d2}:null;}})['then'](respondWithResult(_0x53e312,null))['catch'](handleError(_0x53e312,null));};exports[_0x5160('0x3b')]=function(_0x518b80,_0x5f548e){if(_0x518b80[_0x5160('0x36')]['id']){delete _0x518b80['body']['id'];}return db[_0x5160('0x17')][_0x5160('0x38')]({'where':{'id':_0x518b80[_0x5160('0x32')]['id']}})[_0x5160('0xe')](handleEntityNotFound(_0x5f548e,null))['then'](function(_0x2a369d){if(_0x2a369d){_0x518b80[_0x5160('0x36')][_0x5160('0x3c')]=_0x2a369d['id'];_0x518b80[_0x5160('0x36')][_0x5160('0x3d')]=integrations[_0x5160('0x3e')](_0x518b80['body'][_0x5160('0x3f')],_0x518b80['body'][_0x5160('0x1a')]);_0x518b80[_0x5160('0x36')]['Descriptions']=integrations[_0x5160('0x40')](_0x518b80[_0x5160('0x36')][_0x5160('0x3f')],_0x518b80[_0x5160('0x36')][_0x5160('0x1a')]);return db['Dynamics365Configuration'][_0x5160('0x35')](_0x518b80[_0x5160('0x36')],{'include':[{'model':db[_0x5160('0x41')],'as':_0x5160('0x3d')},{'model':db['Dynamics365Field'],'as':_0x5160('0x42')}]});}return null;})[_0x5160('0xe')](respondWithResult(_0x5f548e,null))[_0x5160('0x30')](handleError(_0x5f548e,null));};function sanitizeRemoteUri(_0xe3338){var _0x184bfb=_0xe3338[_0x5160('0x43')](-0x1);if(_0x184bfb==='/')return _0xe3338[_0x5160('0x44')](0x0,_0xe3338[_0x5160('0x45')](_0x184bfb));return _0xe3338;}function getWebApiUrl(_0x2d6547){return util['format']('%s/api/data/v9.0/',_0x2d6547);}exports[_0x5160('0x46')]=function(_0x147dfb,_0x470893){var _0x495245=_0x147dfb[_0x5160('0x1d')]['ticketType'];var _0x211d5a=_0x495245===_0x5160('0x47')?_0x5160('0x48'):_0x5160('0x49');var _0x4acbe0='';var _0xbb55c7='';var _0xa9bff6='';var _0x397e3d='';var _0x361c06='';var _0x288b09='';var _0x4463eb='';var _0x59b88f='';var _0x23c2a3=[_0x5160('0x4a'),_0x5160('0x4b'),_0x5160('0x4c'),_0x5160('0x4d'),_0x5160('0x4e'),_0x5160('0x4f'),_0x5160('0x50'),_0x5160('0x51'),_0x5160('0x52'),'phonecall_activity_parties'];var _0xeb18c4=[_0x5160('0x53'),'accountidyominame',_0x5160('0x54'),_0x5160('0x55'),_0x5160('0x56'),'contactidyominame',_0x5160('0x57'),_0x5160('0x58'),_0x5160('0x59'),_0x5160('0x5a'),'createdbyname',_0x5160('0x5b'),'createdon',_0x5160('0x5c'),_0x5160('0x5d'),_0x5160('0x5e'),_0x5160('0x5f'),'customeridyominame','emailaddress',_0x5160('0x60'),_0x5160('0x61'),_0x5160('0x62'),_0x5160('0x63'),_0x5160('0x64'),_0x5160('0x65'),_0x5160('0x66'),_0x5160('0x67'),_0x5160('0x68'),_0x5160('0x69'),_0x5160('0x6a'),_0x5160('0x6b'),_0x5160('0x6c'),_0x5160('0x6d'),_0x5160('0x6e'),_0x5160('0x6f'),'modifiedon',_0x5160('0x70'),_0x5160('0x71'),_0x5160('0x72'),_0x5160('0x73'),'numberofchildincidents','onholdtime',_0x5160('0x74'),_0x5160('0x75'),'owneridtype',_0x5160('0x76'),'parentcaseidname','primarycontactidname',_0x5160('0x77'),'prioritycodename',_0x5160('0x78'),_0x5160('0x79'),_0x5160('0x7a'),_0x5160('0x7b'),_0x5160('0x7c'),'responsiblecontactidname','responsiblecontactidyominame',_0x5160('0x7d'),_0x5160('0x7e'),_0x5160('0x7f'),_0x5160('0x80'),_0x5160('0x81'),_0x5160('0x82'),_0x5160('0x83'),'ticketnumber','timezoneruleversionnumber','transactioncurrencyidname',_0x5160('0x84'),_0x5160('0x85'),_0x5160('0x86')];var _0x7d7974=_0x23c2a3[_0x5160('0x87')](_0xeb18c4);return db[_0x5160('0x17')][_0x5160('0x38')]({'where':{'id':_0x147dfb[_0x5160('0x32')]['id']},'attributes':['id',_0x5160('0x88'),'password',_0x5160('0x89'),_0x5160('0x8a'),_0x5160('0x8b'),_0x5160('0x8c'),_0x5160('0x8d')],'include':[{'model':db[_0x5160('0x8e')],'as':_0x5160('0x8e'),'attributes':['id',_0x5160('0x8f'),_0x5160('0x90')]}]})[_0x5160('0xe')](handleEntityNotFound(_0x470893,null))[_0x5160('0xe')](function(_0x5b5896){if(_0x5b5896){if(_0x5b5896[_0x5160('0x8d')]){_0x5b5896[_0x5160('0x91')]=_0x5b5896[_0x5160('0x8e')][_0x5160('0x8f')];_0x59b88f=sanitizeRemoteUri(_0x5b5896['CloudProvider']['data7']);_0x4463eb=getWebApiUrl(_0x59b88f);return _0x5b5896;}_0x59b88f=sanitizeRemoteUri(_0x5b5896[_0x5160('0x89')]);_0x4463eb=getWebApiUrl(_0x59b88f);var _0x247fdf={'method':_0x5160('0x92'),'uri':_0x5160('0x93')+_0x5b5896[_0x5160('0x8a')]+_0x5160('0x94'),'form':{'client_id':_0x5b5896[_0x5160('0x8b')],'resource':_0x59b88f,'username':_0x5b5896[_0x5160('0x88')],'password':_0x5b5896[_0x5160('0x95')],'grant_type':_0x5160('0x95'),'client_secret':_0x5b5896[_0x5160('0x8c')]},'json':!![]};return rp(_0x247fdf);}})['then'](function(_0x5d60df){_0x288b09=_0x5d60df[_0x5160('0x91')];var _0x3dd41c={'method':_0x5160('0x96'),'uri':encodeURI(_0x4463eb+_0x5160('0x97')+_0x211d5a+'\x27'),'headers':{'Authorization':_0x5160('0x98')+_0x288b09,'If-None-Match':null,'OData-Version':_0x5160('0x99')},'json':!![]};return rp(_0x3dd41c);})[_0x5160('0xe')](function(_0x412a76){var _0x35f5dd=_0x412a76[_0x5160('0x9a')][0x0];var _0x23bd7e=_0x35f5dd[_0x5160('0x9b')];var _0x398506={'method':'GET','uri':_0x4463eb+_0x5160('0x9c')+_0x23bd7e+_0x5160('0x9d'),'headers':{'Authorization':_0x5160('0x98')+_0x288b09,'If-None-Match':null,'OData-Version':_0x5160('0x99')},'json':!![]};return rp(_0x398506);})['then'](function(_0x1c5bce){_0x4acbe0=_0x1c5bce;_0xbb55c7=_0x4acbe0[_0x5160('0x9e')];_0xbb55c7=_['remove'](_0xbb55c7,function(_0x4aee52){return!_0x7d7974['includes'](_0x4aee52[_0x5160('0x9f')]);});var _0x3b64ca=[];var _0x4576b7=[];_0xbb55c7[_0x5160('0xa0')](function(_0x359386){if(_0x359386[_0x5160('0xa1')]){var _0x7d4dfa=_0x359386[_0x5160('0xa1')]['substring'](_0x359386[_0x5160('0xa1')][_0x5160('0x45')]('.')+0x1);if(_0x7d4dfa===_0x5160('0xa2')){_0x3b64ca['push'](getSelectList(_0x4463eb,_0x495245,_0x4576b7,_0x4acbe0[_0x5160('0x9b')],_0x359386[_0x5160('0x9b')],_0x288b09));}}});return Promise[_0x5160('0xa3')](_0x3b64ca);})[_0x5160('0xe')](function(_0x168b18){_0xa9bff6=_0x168b18[0x0];var _0x4e715d=[];var _0x112221=[];_0xbb55c7[_0x5160('0xa0')](function(_0xe729c5){if(!_[_0x5160('0xa4')](_0xe729c5[_0x5160('0xa1')])){var _0x398fe9=_0xe729c5[_0x5160('0xa1')]['substring'](_0xe729c5['@odata.type'][_0x5160('0x45')]('.')+0x1);if(_0x398fe9===_0x5160('0xa5')){_0x4e715d['push'](getBooleanList(_0x4463eb,_0x495245,_0x112221,_0x4acbe0['MetadataId'],_0xe729c5['MetadataId'],_0x288b09));}}});return Promise[_0x5160('0xa3')](_0x4e715d);})[_0x5160('0xe')](function(_0x5f28f5){_0x397e3d=_0x5f28f5[0x0];var _0x410c91=[];var _0x159c8e=[];_0xbb55c7[_0x5160('0xa0')](function(_0x5ee5e3){if(_0x5ee5e3[_0x5160('0xa1')]){var _0x58995d=_0x5ee5e3[_0x5160('0xa1')]['substring'](_0x5ee5e3[_0x5160('0xa1')][_0x5160('0x45')]('.')+0x1);if(_0x58995d===_0x5160('0xa6')||_0x58995d===_0x5160('0xa7')||_0x58995d===_0x5160('0xa8')||_0x58995d===_0x5160('0xa9')||_0x58995d===_0x5160('0xaa')||_0x58995d===_0x5160('0xab')||_0x58995d===_0x5160('0xac')||_0x58995d==='EntityNameAttributeMetadata'||_0x58995d===_0x5160('0xad')||_0x58995d===_0x5160('0xae')){_0x410c91['push'](getInputList(_0x4463eb,_0x495245,_0x58995d,_0x159c8e,_0x4acbe0['MetadataId'],_0x5ee5e3['MetadataId'],_0x288b09));}}});return Promise[_0x5160('0xa3')](_0x410c91);})['then'](function(_0x2f0ad8){_0x361c06=_0x2f0ad8[0x0];var _0x20c033=_0xa9bff6[_0x5160('0x87')](_0x397e3d)[_0x5160('0x87')](_0x361c06);var _0x3eeff8={'count':_0x20c033[_0x5160('0x21')],'rows':_0x20c033};return _0x3eeff8;})[_0x5160('0xe')](respondWithResult(_0x470893,null))[_0x5160('0x30')](function(_0x279792){var _0x5c23e6=_0x147dfb[_0x5160('0x1d')]['test']?0x1f4:_0x279792[_0x5160('0xaf')]||0x1f4;logger[_0x5160('0x11')](_0x279792[_0x5160('0x12')]);delete _0x279792[_0x5160('0x13')];if(_0x5c23e6===0x191){_0x5c23e6=0x190;}_0x470893[_0x5160('0x6')](_0x5c23e6)[_0x5160('0x14')](_0x147dfb[_0x5160('0x1d')]['test']?{'message':_0x5160('0xb0'),'statusCode':_0x279792[_0x5160('0xaf')]}:_0x279792);});};function getSelectList(_0x55ffc9,_0x3aacf7,_0x2e87ba,_0x2bfa2d,_0x283baa,_0x2b7da3){var _0x3287e9={'method':'GET','uri':_0x55ffc9+_0x5160('0x9c')+_0x2bfa2d+_0x5160('0xb1')+_0x283baa+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0x5160('0xb2'),'headers':{'Authorization':_0x5160('0x98')+_0x2b7da3,'If-None-Match':null,'OData-Version':_0x5160('0x99')},'json':!![]};return rp(_0x3287e9)[_0x5160('0xe')](function(_0xe887e7){var _0x5bc0af=[];var _0x3202ed=_0xe887e7[_0x5160('0xb3')][_0x5160('0xb4')];_0x3202ed[_0x5160('0xa0')](function(_0x549f8b){_0x5bc0af[_0x5160('0xb5')]({'name':_0x549f8b[_0x5160('0xb6')][_0x5160('0xb7')][_0x5160('0xb6')],'value':String(_0x549f8b[_0x5160('0xb8')])});});var _0x4b44e8={'id':_0x3aacf7+'_'+_0xe887e7[_0x5160('0x9f')],'name':_0xe887e7[_0x5160('0xb9')][_0x5160('0xb7')]['Label'],'custom':![],'options':_0x5bc0af};_0x2e87ba[_0x5160('0xb5')](_0x4b44e8);return _0x2e87ba;});}function getBooleanList(_0x20c698,_0x567061,_0x57e536,_0x4def9f,_0x5d3b1b,_0x476b03){var _0x3ce03d={'method':'GET','uri':_0x20c698+_0x5160('0x9c')+_0x4def9f+_0x5160('0xb1')+_0x5d3b1b+_0x5160('0xba'),'headers':{'Authorization':'Bearer\x20'+_0x476b03,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3ce03d)['then'](function(_0x55d607){var _0x3030e7=[];_0x3030e7['push']({'name':_0x55d607['OptionSet'][_0x5160('0xbb')]['Label'][_0x5160('0xb7')][_0x5160('0xb6')],'value':_0x5160('0xbc')},{'name':_0x55d607['OptionSet']['FalseOption'][_0x5160('0xb6')][_0x5160('0xb7')][_0x5160('0xb6')],'value':_0x5160('0xbd')});var _0xcce8f7={'id':_0x567061+'_'+_0x55d607['LogicalName'],'name':_0x55d607[_0x5160('0xb9')][_0x5160('0xb7')][_0x5160('0xb6')],'custom':![],'options':_0x3030e7};_0x57e536[_0x5160('0xb5')](_0xcce8f7);return _0x57e536;});}function getInputList(_0x232896,_0x2a710d,_0x109a15,_0x18bcc9,_0x31fdd1,_0x4dc81e,_0x5d8be8){var _0x3f7c8c={'method':_0x5160('0x96'),'uri':_0x232896+_0x5160('0x9c')+_0x31fdd1+_0x5160('0xb1')+_0x4dc81e+_0x5160('0xbe')+_0x109a15+_0x5160('0xbf'),'headers':{'Authorization':_0x5160('0x98')+_0x5d8be8,'If-None-Match':null,'OData-Version':_0x5160('0x99')},'json':!![]};return rp(_0x3f7c8c)['then'](function(_0x3f4fea){var _0x281a8b={'id':_0x2a710d+'_'+_0x3f4fea[_0x5160('0x9f')],'name':_0x3f4fea['DisplayName'][_0x5160('0xb7')]?_0x3f4fea['DisplayName'][_0x5160('0xb7')][_0x5160('0xb6')]:_0x3f4fea[_0x5160('0x9f')],'custom':![],'options':[]};_0x18bcc9[_0x5160('0xb5')](_0x281a8b);return _0x18bcc9;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index a838889..6002165 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['int_dynamics365_accounts','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','define'];(function(_0x50a790,_0xcf6f3d){var _0x23c34a=function(_0x200e68){while(--_0x200e68){_0x50a790['push'](_0x50a790['shift']());}};_0x23c34a(++_0xcf6f3d);}(_0xb7e7,0x121));var _0x7b7e=function(_0x55abd9,_0x1148af){_0x55abd9=_0x55abd9-0x0;var _0x3e5669=_0xb7e7[_0x55abd9];return _0x3e5669;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x333fa4,_0x372bde){return _0x333fa4[_0x7b7e('0x7')]('Dynamics365Account',attributes,{'tableName':_0x7b7e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb7e7=['int_dynamics365_accounts','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','define'];(function(_0x81c30d,_0x59e7f6){var _0x5428da=function(_0x422d09){while(--_0x422d09){_0x81c30d['push'](_0x81c30d['shift']());}};_0x5428da(++_0x59e7f6);}(_0xb7e7,0x121));var _0x7b7e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xb7e7[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x333fa4,_0x372bde){return _0x333fa4[_0x7b7e('0x7')]('Dynamics365Account',attributes,{'tableName':_0x7b7e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 4a669c5..5fae763 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 _0xd295=['model','catch','ShowDynamics365Account','find','raw','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','Dynamics365Account,\x20%s,\x20%s','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetDynamics365Account','Dynamics365Account','findAll','options','where','attributes','include','map'];(function(_0x442c2e,_0x5681ab){var _0x1c8ef3=function(_0x445faa){while(--_0x445faa){_0x442c2e['push'](_0x442c2e['shift']());}};_0x1c8ef3(++_0x5681ab);}(_0xd295,0x68));var _0x5d29=function(_0x2d7e84,_0x5c9dd6){_0x2d7e84=_0x2d7e84-0x0;var _0x3a8729=_0xd295[_0x2d7e84];return _0x3a8729;};'use strict';var _=require(_0x5d29('0x0'));var util=require(_0x5d29('0x1'));var moment=require(_0x5d29('0x2'));var BPromise=require(_0x5d29('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5d29('0x4'))['db'];var utils=require(_0x5d29('0x5'));var logger=require('../../config/logger')(_0x5d29('0x6'));var config=require(_0x5d29('0x7'));var jayson=require(_0x5d29('0x8'));var client=jayson['client'][_0x5d29('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x12d775,_0x7eabca,_0x35f431){return new BPromise(function(_0x29f10c,_0x451ade){return client['request'](_0x12d775,_0x35f431)[_0x5d29('0xa')](function(_0x3afe3f){logger[_0x5d29('0xb')](_0x5d29('0xc'),_0x7eabca,'request\x20sent');logger[_0x5d29('0xd')](_0x5d29('0xe'),_0x7eabca,'request\x20sent',JSON[_0x5d29('0xf')](_0x3afe3f));if(_0x3afe3f[_0x5d29('0x10')]){if(_0x3afe3f[_0x5d29('0x10')][_0x5d29('0x11')]===0x1f4){logger[_0x5d29('0x10')](_0x5d29('0xc'),_0x7eabca,_0x3afe3f[_0x5d29('0x10')][_0x5d29('0x12')]);return _0x451ade(_0x3afe3f[_0x5d29('0x10')][_0x5d29('0x12')]);}logger[_0x5d29('0x10')](_0x5d29('0xc'),_0x7eabca,_0x3afe3f['error'][_0x5d29('0x12')]);return _0x29f10c(_0x3afe3f[_0x5d29('0x10')]['message']);}else{logger[_0x5d29('0xb')]('Dynamics365Account,\x20%s,\x20%s',_0x7eabca,'request\x20sent');_0x29f10c(_0x3afe3f[_0x5d29('0x13')]['message']);}})['catch'](function(_0x5f5c3f){logger[_0x5d29('0x10')](_0x5d29('0xc'),_0x7eabca,_0x5f5c3f);_0x451ade(_0x5f5c3f);});});}exports[_0x5d29('0x14')]=function(_0x2aaed0){var _0x4d8400=this;return new Promise(function(_0x41ec88,_0x3b8552){return db[_0x5d29('0x15')][_0x5d29('0x16')]({'raw':_0x2aaed0[_0x5d29('0x17')]?_0x2aaed0[_0x5d29('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x2aaed0['options']?_0x2aaed0[_0x5d29('0x17')][_0x5d29('0x18')]||null:null,'attributes':_0x2aaed0[_0x5d29('0x17')]?_0x2aaed0[_0x5d29('0x17')][_0x5d29('0x19')]||null:null,'limit':_0x2aaed0[_0x5d29('0x17')]?_0x2aaed0[_0x5d29('0x17')]['limit']||null:null,'include':_0x2aaed0[_0x5d29('0x17')]?_0x2aaed0[_0x5d29('0x17')][_0x5d29('0x1a')]?_[_0x5d29('0x1b')](_0x2aaed0[_0x5d29('0x17')][_0x5d29('0x1a')],function(_0x507b16){return{'model':db[_0x507b16['model']],'as':_0x507b16['as'],'attributes':_0x507b16[_0x5d29('0x19')],'include':_0x507b16[_0x5d29('0x1a')]?_[_0x5d29('0x1b')](_0x507b16[_0x5d29('0x1a')],function(_0x33aa16){return{'model':db[_0x33aa16['model']],'as':_0x33aa16['as'],'attributes':_0x33aa16[_0x5d29('0x19')],'include':_0x33aa16[_0x5d29('0x1a')]?_['map'](_0x33aa16[_0x5d29('0x1a')],function(_0x38c417){return{'model':db[_0x38c417[_0x5d29('0x1c')]],'as':_0x38c417['as'],'attributes':_0x38c417[_0x5d29('0x19')]};}):[]};}):[]};}):[]:[]})[_0x5d29('0xa')](function(_0x106d3e){logger[_0x5d29('0xb')](_0x5d29('0x14'),_0x2aaed0);logger[_0x5d29('0xd')]('GetDynamics365Account',_0x2aaed0,JSON[_0x5d29('0xf')](_0x106d3e));_0x41ec88(_0x106d3e);})[_0x5d29('0x1d')](function(_0x16710a){logger[_0x5d29('0x10')]('GetDynamics365Account',_0x16710a['message'],_0x2aaed0);_0x3b8552(_0x4d8400[_0x5d29('0x10')](0x1f4,_0x16710a[_0x5d29('0x12')]));});});};exports[_0x5d29('0x1e')]=function(_0x545412){var _0x3c203d=this;return new Promise(function(_0x3b76f6,_0xd0381e){return db['Dynamics365Account'][_0x5d29('0x1f')]({'raw':_0x545412['options']?_0x545412[_0x5d29('0x17')][_0x5d29('0x20')]===undefined?!![]:![]:!![],'where':_0x545412[_0x5d29('0x17')]?_0x545412[_0x5d29('0x17')][_0x5d29('0x18')]||null:null,'attributes':_0x545412[_0x5d29('0x17')]?_0x545412[_0x5d29('0x17')][_0x5d29('0x19')]||null:null,'include':_0x545412[_0x5d29('0x17')]?_0x545412[_0x5d29('0x17')][_0x5d29('0x1a')]?_['map'](_0x545412[_0x5d29('0x17')][_0x5d29('0x1a')],function(_0x5c713f){return{'model':db[_0x5c713f[_0x5d29('0x1c')]],'as':_0x5c713f['as'],'attributes':_0x5c713f[_0x5d29('0x19')],'include':_0x5c713f[_0x5d29('0x1a')]?_[_0x5d29('0x1b')](_0x5c713f[_0x5d29('0x1a')],function(_0x5ba120){return{'model':db[_0x5ba120[_0x5d29('0x1c')]],'as':_0x5ba120['as'],'attributes':_0x5ba120[_0x5d29('0x19')],'include':_0x5ba120[_0x5d29('0x1a')]?_['map'](_0x5ba120[_0x5d29('0x1a')],function(_0x111640){return{'model':db[_0x111640[_0x5d29('0x1c')]],'as':_0x111640['as'],'attributes':_0x111640[_0x5d29('0x19')]};}):[]};}):[]};}):[]:[]})[_0x5d29('0xa')](function(_0x2687b0){logger[_0x5d29('0xb')](_0x5d29('0x1e'),_0x545412);logger[_0x5d29('0xd')]('ShowDynamics365Account',_0x545412,JSON[_0x5d29('0xf')](_0x2687b0));_0x3b76f6(_0x2687b0);})['catch'](function(_0x3c3c46){logger[_0x5d29('0x10')](_0x5d29('0x1e'),_0x3c3c46[_0x5d29('0x12')],_0x545412);_0xd0381e(_0x3c203d[_0x5d29('0x10')](0x1f4,_0x3c3c46['message']));});});}; \ No newline at end of file +var _0x95fe=['request','then','info','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','Dynamics365Account,\x20%s,\x20%s','message','result','catch','Dynamics365Account','findAll','options','include','map','model','attributes','GetDynamics365Account','stringify','ShowDynamics365Account','find','raw','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x11ca63,_0xea9f9c){var _0x41f1f6=function(_0xb80b69){while(--_0xb80b69){_0x11ca63['push'](_0x11ca63['shift']());}};_0x41f1f6(++_0xea9f9c);}(_0x95fe,0x149));var _0xe95f=function(_0x6ca7f4,_0x51a5df){_0x6ca7f4=_0x6ca7f4-0x0;var _0x494fa6=_0x95fe[_0x6ca7f4];return _0x494fa6;};'use strict';var _=require(_0xe95f('0x0'));var util=require(_0xe95f('0x1'));var moment=require('moment');var BPromise=require(_0xe95f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe95f('0x3'));var db=require(_0xe95f('0x4'))['db'];var utils=require(_0xe95f('0x5'));var logger=require(_0xe95f('0x6'))('rpc');var config=require(_0xe95f('0x7'));var jayson=require(_0xe95f('0x8'));var client=jayson[_0xe95f('0x9')][_0xe95f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x29b7f9,_0x2a5008,_0x3ba616){return new BPromise(function(_0x365e24,_0x3fda14){return client[_0xe95f('0xb')](_0x29b7f9,_0x3ba616)[_0xe95f('0xc')](function(_0x4a7083){logger[_0xe95f('0xd')]('Dynamics365Account,\x20%s,\x20%s',_0x2a5008,_0xe95f('0xe'));logger[_0xe95f('0xf')](_0xe95f('0x10'),_0x2a5008,_0xe95f('0xe'),JSON['stringify'](_0x4a7083));if(_0x4a7083[_0xe95f('0x11')]){if(_0x4a7083[_0xe95f('0x11')]['code']===0x1f4){logger[_0xe95f('0x11')](_0xe95f('0x12'),_0x2a5008,_0x4a7083[_0xe95f('0x11')][_0xe95f('0x13')]);return _0x3fda14(_0x4a7083['error'][_0xe95f('0x13')]);}logger[_0xe95f('0x11')]('Dynamics365Account,\x20%s,\x20%s',_0x2a5008,_0x4a7083['error'][_0xe95f('0x13')]);return _0x365e24(_0x4a7083[_0xe95f('0x11')][_0xe95f('0x13')]);}else{logger[_0xe95f('0xd')](_0xe95f('0x12'),_0x2a5008,'request\x20sent');_0x365e24(_0x4a7083[_0xe95f('0x14')][_0xe95f('0x13')]);}})[_0xe95f('0x15')](function(_0x401983){logger['error'](_0xe95f('0x12'),_0x2a5008,_0x401983);_0x3fda14(_0x401983);});});}exports['GetDynamics365Account']=function(_0x37babe){var _0xccc09b=this;return new Promise(function(_0x36d72c,_0x5237fe){return db[_0xe95f('0x16')][_0xe95f('0x17')]({'raw':_0x37babe['options']?_0x37babe[_0xe95f('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x37babe[_0xe95f('0x18')]?_0x37babe[_0xe95f('0x18')]['where']||null:null,'attributes':_0x37babe[_0xe95f('0x18')]?_0x37babe[_0xe95f('0x18')]['attributes']||null:null,'limit':_0x37babe[_0xe95f('0x18')]?_0x37babe['options']['limit']||null:null,'include':_0x37babe[_0xe95f('0x18')]?_0x37babe['options'][_0xe95f('0x19')]?_[_0xe95f('0x1a')](_0x37babe['options'][_0xe95f('0x19')],function(_0x5f3876){return{'model':db[_0x5f3876[_0xe95f('0x1b')]],'as':_0x5f3876['as'],'attributes':_0x5f3876['attributes'],'include':_0x5f3876['include']?_[_0xe95f('0x1a')](_0x5f3876[_0xe95f('0x19')],function(_0x17de3d){return{'model':db[_0x17de3d[_0xe95f('0x1b')]],'as':_0x17de3d['as'],'attributes':_0x17de3d['attributes'],'include':_0x17de3d['include']?_[_0xe95f('0x1a')](_0x17de3d['include'],function(_0x320eb5){return{'model':db[_0x320eb5[_0xe95f('0x1b')]],'as':_0x320eb5['as'],'attributes':_0x320eb5[_0xe95f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe95f('0xc')](function(_0x5909b0){logger[_0xe95f('0xd')]('GetDynamics365Account',_0x37babe);logger[_0xe95f('0xf')](_0xe95f('0x1d'),_0x37babe,JSON[_0xe95f('0x1e')](_0x5909b0));_0x36d72c(_0x5909b0);})['catch'](function(_0x51974f){logger[_0xe95f('0x11')]('GetDynamics365Account',_0x51974f[_0xe95f('0x13')],_0x37babe);_0x5237fe(_0xccc09b[_0xe95f('0x11')](0x1f4,_0x51974f[_0xe95f('0x13')]));});});};exports[_0xe95f('0x1f')]=function(_0x36f7eb){var _0x3d7f0a=this;return new Promise(function(_0x15ef33,_0x58ea72){return db[_0xe95f('0x16')][_0xe95f('0x20')]({'raw':_0x36f7eb[_0xe95f('0x18')]?_0x36f7eb[_0xe95f('0x18')][_0xe95f('0x21')]===undefined?!![]:![]:!![],'where':_0x36f7eb[_0xe95f('0x18')]?_0x36f7eb[_0xe95f('0x18')]['where']||null:null,'attributes':_0x36f7eb[_0xe95f('0x18')]?_0x36f7eb['options']['attributes']||null:null,'include':_0x36f7eb[_0xe95f('0x18')]?_0x36f7eb[_0xe95f('0x18')][_0xe95f('0x19')]?_[_0xe95f('0x1a')](_0x36f7eb[_0xe95f('0x18')][_0xe95f('0x19')],function(_0xd05224){return{'model':db[_0xd05224[_0xe95f('0x1b')]],'as':_0xd05224['as'],'attributes':_0xd05224[_0xe95f('0x1c')],'include':_0xd05224[_0xe95f('0x19')]?_['map'](_0xd05224[_0xe95f('0x19')],function(_0x4a9c49){return{'model':db[_0x4a9c49[_0xe95f('0x1b')]],'as':_0x4a9c49['as'],'attributes':_0x4a9c49['attributes'],'include':_0x4a9c49[_0xe95f('0x19')]?_['map'](_0x4a9c49['include'],function(_0x5d3b20){return{'model':db[_0x5d3b20[_0xe95f('0x1b')]],'as':_0x5d3b20['as'],'attributes':_0x5d3b20[_0xe95f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe95f('0xc')](function(_0x46c624){logger[_0xe95f('0xd')]('ShowDynamics365Account',_0x36f7eb);logger[_0xe95f('0xf')]('ShowDynamics365Account',_0x36f7eb,JSON['stringify'](_0x46c624));_0x15ef33(_0x46c624);})[_0xe95f('0x15')](function(_0x4e352a){logger['error']('ShowDynamics365Account',_0x4e352a[_0xe95f('0x13')],_0x36f7eb);_0x58ea72(_0x3d7f0a[_0xe95f('0x11')](0x1f4,_0x4e352a[_0xe95f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 5c471d2..885ece9 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 _0x97c1=['./intDynamics365Configuration.controller','index','get','/:id','isAuthenticated','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','delete','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x97c1,0xdf));var _0x197c=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x97c1[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require(_0x197c('0x0'));var util=require(_0x197c('0x1'));var path=require('path');var timeout=require(_0x197c('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x197c('0x3'));var auth=require(_0x197c('0x4'));var interaction=require(_0x197c('0x5'));var config=require(_0x197c('0x6'));var controller=require(_0x197c('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x197c('0x8')]);router[_0x197c('0x9')](_0x197c('0xa'),auth[_0x197c('0xb')](),controller['show']);router['get'](_0x197c('0xc'),auth['isAuthenticated'](),controller[_0x197c('0xd')]);router[_0x197c('0x9')](_0x197c('0xe'),auth[_0x197c('0xb')](),controller['getSubjects']);router[_0x197c('0x9')](_0x197c('0xf'),auth[_0x197c('0xb')](),controller[_0x197c('0x10')]);router[_0x197c('0x11')]('/',auth['isAuthenticated'](),controller[_0x197c('0x12')]);router[_0x197c('0x13')](_0x197c('0xa'),auth[_0x197c('0xb')](),controller['update']);router[_0x197c('0x14')](_0x197c('0xa'),auth[_0x197c('0xb')](),controller[_0x197c('0x15')]);module[_0x197c('0x16')]=router; \ No newline at end of file +var _0x0c8d=['destroy','exports','util','path','connect-timeout','express','Router','./intDynamics365Configuration.controller','get','isAuthenticated','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions','update','/:id'];(function(_0x545ddc,_0x2a253a){var _0x20661a=function(_0x3f1704){while(--_0x3f1704){_0x545ddc['push'](_0x545ddc['shift']());}};_0x20661a(++_0x2a253a);}(_0x0c8d,0x79));var _0xd0c8=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x0c8d[_0x2070da];return _0x4f9fe1;};'use strict';var multer=require('multer');var util=require(_0xd0c8('0x0'));var path=require(_0xd0c8('0x1'));var timeout=require(_0xd0c8('0x2'));var express=require(_0xd0c8('0x3'));var router=express[_0xd0c8('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd0c8('0x5'));router[_0xd0c8('0x6')]('/',auth[_0xd0c8('0x7')](),controller['index']);router[_0xd0c8('0x6')]('/:id',auth[_0xd0c8('0x7')](),controller[_0xd0c8('0x8')]);router[_0xd0c8('0x6')](_0xd0c8('0x9'),auth[_0xd0c8('0x7')](),controller['getFields']);router[_0xd0c8('0x6')](_0xd0c8('0xa'),auth[_0xd0c8('0x7')](),controller[_0xd0c8('0xb')]);router['get']('/:id/descriptions',auth[_0xd0c8('0x7')](),controller[_0xd0c8('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0xd0c8('0x7')](),controller[_0xd0c8('0xd')]);router['delete'](_0xd0c8('0xe'),auth[_0xd0c8('0x7')](),controller[_0xd0c8('0xf')]);module[_0xd0c8('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 7883641..eb70110 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 _0xb3a0=['contact','nothing','BOOLEAN','exports','STRING','ENUM','incident','phonecall'];(function(_0x30864c,_0x49789b){var _0x5569cf=function(_0x1ccfa7){while(--_0x1ccfa7){_0x30864c['push'](_0x30864c['shift']());}};_0x5569cf(++_0x49789b);}(_0xb3a0,0x1cb));var _0x0b3a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb3a0[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0x0b3a('0x0')]={'name':{'type':Sequelize[_0x0b3a('0x1')]},'description':{'type':Sequelize[_0x0b3a('0x1')]},'ticketType':{'type':Sequelize[_0x0b3a('0x2')](_0x0b3a('0x3'),_0x0b3a('0x4')),'defaultValue':'incident'},'moduleCreate':{'type':Sequelize[_0x0b3a('0x2')](_0x0b3a('0x5'),_0x0b3a('0x6')),'defaultValue':_0x0b3a('0x5'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize['STRING'],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x0b3a('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0x7fae=['incident','phonecall','nothing','contact','sequelize','exports','STRING','ENUM'];(function(_0x294aa8,_0x438870){var _0x2f014c=function(_0x476584){while(--_0x476584){_0x294aa8['push'](_0x294aa8['shift']());}};_0x2f014c(++_0x438870);}(_0x7fae,0x8c));var _0xe7fa=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x7fae[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require(_0xe7fa('0x0'));module[_0xe7fa('0x1')]={'name':{'type':Sequelize[_0xe7fa('0x2')]},'description':{'type':Sequelize[_0xe7fa('0x2')]},'ticketType':{'type':Sequelize[_0xe7fa('0x3')](_0xe7fa('0x4'),_0xe7fa('0x5')),'defaultValue':_0xe7fa('0x4')},'moduleCreate':{'type':Sequelize[_0xe7fa('0x3')]('contact',_0xe7fa('0x6')),'defaultValue':_0xe7fa('0x7'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0xe7fa('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 5e36280..108effc 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 _0x2fd5=['include','findAll','rows','catch','params','keys','rawAttributes','find','create','body','getFields','findOne','getSubjects','getDescriptions','Dynamics365Field','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','Dynamics365Configuration','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll'];(function(_0x18f294,_0x4726d9){var _0x2841a6=function(_0xb07309){while(--_0xb07309){_0x18f294['push'](_0x18f294['shift']());}};_0x2841a6(++_0x4726d9);}(_0x2fd5,0x147));var _0x52fd=function(_0x21dbf9,_0x293351){_0x21dbf9=_0x21dbf9-0x0;var _0xb5cfd4=_0x2fd5[_0x21dbf9];return _0xb5cfd4;};'use strict';var emlformat=require(_0x52fd('0x0'));var rimraf=require(_0x52fd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x52fd('0x2'));var moment=require(_0x52fd('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x52fd('0x4'));var util=require(_0x52fd('0x5'));var path=require(_0x52fd('0x6'));var sox=require(_0x52fd('0x7'));var csv=require(_0x52fd('0x8'));var ejs=require(_0x52fd('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x52fd('0xa'));var squel=require(_0x52fd('0xb'));var crypto=require(_0x52fd('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x52fd('0xd'));var toCsv=require(_0x52fd('0x8'));var querystring=require('querystring');var Papa=require(_0x52fd('0xe'));var Redis=require(_0x52fd('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x52fd('0x10'));var hardwareService=require(_0x52fd('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x52fd('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x52fd('0x13'));var db=require(_0x52fd('0x14'))['db'];function respondWithStatusCode(_0x3ba6e5,_0x19dd8a){_0x19dd8a=_0x19dd8a||0xcc;return function(_0x43ef9c){if(_0x43ef9c){return _0x3ba6e5['sendStatus'](_0x19dd8a);}return _0x3ba6e5[_0x52fd('0x15')](_0x19dd8a)[_0x52fd('0x16')]();};}function respondWithResult(_0x206485,_0xd4f314){_0xd4f314=_0xd4f314||0xc8;return function(_0x30ddee){if(_0x30ddee){return _0x206485[_0x52fd('0x15')](_0xd4f314)[_0x52fd('0x17')](_0x30ddee);}};}function respondWithFilteredResult(_0x4325c7,_0x1a4442){return function(_0x5b480c){if(_0x5b480c){var _0x59e413=typeof _0x1a4442[_0x52fd('0x18')]===_0x52fd('0x19')&&typeof _0x1a4442[_0x52fd('0x1a')]===_0x52fd('0x19');var _0x5b05fb=_0x5b480c['count'];var _0x1364c6=_0x59e413?0x0:_0x1a4442[_0x52fd('0x18')];var _0x4ccdcc=_0x59e413?_0x5b480c[_0x52fd('0x1b')]:_0x1a4442[_0x52fd('0x18')]+_0x1a4442['limit'];var _0x3ee35e;if(_0x4ccdcc>=_0x5b05fb){_0x4ccdcc=_0x5b05fb;_0x3ee35e=0xc8;}else{_0x3ee35e=0xce;}_0x4325c7[_0x52fd('0x15')](_0x3ee35e);return _0x4325c7['set'](_0x52fd('0x1c'),_0x1364c6+'-'+_0x4ccdcc+'/'+_0x5b05fb)[_0x52fd('0x17')](_0x5b480c);}return null;};}function patchUpdates(_0x22e0cb){return function(_0x43d49f){try{jsonpatch[_0x52fd('0x1d')](_0x43d49f,_0x22e0cb,!![]);}catch(_0x3ba6bb){return BPromise[_0x52fd('0x1e')](_0x3ba6bb);}return _0x43d49f[_0x52fd('0x1f')]();};}function saveUpdates(_0x121799,_0x141233){return function(_0x5ab5f6){if(_0x5ab5f6){return _0x5ab5f6[_0x52fd('0x20')](_0x121799)[_0x52fd('0x21')](function(_0x594265){return _0x594265;});}return null;};}function removeEntity(_0xd98f3a,_0x4e8ea5){return function(_0x538877){if(_0x538877){return _0x538877[_0x52fd('0x22')]()[_0x52fd('0x21')](function(){_0xd98f3a[_0x52fd('0x15')](0xcc)[_0x52fd('0x16')]();});}};}function handleEntityNotFound(_0x13fd5e,_0x187502){return function(_0x2bb89e){if(!_0x2bb89e){_0x13fd5e[_0x52fd('0x23')](0x194);}return _0x2bb89e;};}function handleError(_0x5654ad,_0x556991){_0x556991=_0x556991||0x1f4;return function(_0x11b994){logger[_0x52fd('0x24')](_0x11b994[_0x52fd('0x25')]);if(_0x11b994[_0x52fd('0x26')]){delete _0x11b994[_0x52fd('0x26')];}_0x5654ad[_0x52fd('0x15')](_0x556991)[_0x52fd('0x27')](_0x11b994);};}exports[_0x52fd('0x28')]=function(_0x637be7,_0x3c3d9e){var _0x3ef505={},_0x3c9a82={},_0x199aa9={'count':0x0,'rows':[]};var _0x4bad91=_[_0x52fd('0x29')](db[_0x52fd('0x2a')]['rawAttributes'],function(_0x50302b){return{'name':_0x50302b[_0x52fd('0x2b')],'type':_0x50302b[_0x52fd('0x2c')][_0x52fd('0x2d')]};});_0x3c9a82[_0x52fd('0x2e')]=_['map'](_0x4bad91,_0x52fd('0x26'));_0x3c9a82[_0x52fd('0x2f')]=_['keys'](_0x637be7[_0x52fd('0x2f')]);_0x3c9a82[_0x52fd('0x30')]=_[_0x52fd('0x31')](_0x3c9a82[_0x52fd('0x2e')],_0x3c9a82[_0x52fd('0x2f')]);_0x3ef505[_0x52fd('0x32')]=_[_0x52fd('0x31')](_0x3c9a82[_0x52fd('0x2e')],qs[_0x52fd('0x33')](_0x637be7[_0x52fd('0x2f')][_0x52fd('0x33')]));_0x3ef505[_0x52fd('0x32')]=_0x3ef505[_0x52fd('0x32')][_0x52fd('0x34')]?_0x3ef505[_0x52fd('0x32')]:_0x3c9a82[_0x52fd('0x2e')];if(!_0x637be7[_0x52fd('0x2f')][_0x52fd('0x35')](_0x52fd('0x36'))){_0x3ef505['limit']=qs['limit'](_0x637be7[_0x52fd('0x2f')][_0x52fd('0x1a')]);_0x3ef505[_0x52fd('0x18')]=qs['offset'](_0x637be7[_0x52fd('0x2f')][_0x52fd('0x18')]);}_0x3ef505[_0x52fd('0x37')]=qs[_0x52fd('0x38')](_0x637be7[_0x52fd('0x2f')][_0x52fd('0x38')]);_0x3ef505[_0x52fd('0x39')]=qs[_0x52fd('0x30')](_[_0x52fd('0x3a')](_0x637be7[_0x52fd('0x2f')],_0x3c9a82[_0x52fd('0x30')]),_0x4bad91);if(_0x637be7[_0x52fd('0x2f')][_0x52fd('0x3b')]){_0x3ef505[_0x52fd('0x39')]=_[_0x52fd('0x3c')](_0x3ef505[_0x52fd('0x39')],{'$or':_[_0x52fd('0x29')](_0x4bad91,function(_0x58ee5f){if(_0x58ee5f[_0x52fd('0x2c')]!=='VIRTUAL'){var _0x20058a={};_0x20058a[_0x58ee5f[_0x52fd('0x26')]]={'$like':'%'+_0x637be7[_0x52fd('0x2f')][_0x52fd('0x3b')]+'%'};return _0x20058a;}})});}_0x3ef505=_['merge']({},_0x3ef505,_0x637be7[_0x52fd('0x3d')]);var _0x55e72f={'where':_0x3ef505['where']};return db['Dynamics365Configuration'][_0x52fd('0x1b')](_0x55e72f)[_0x52fd('0x21')](function(_0x5e72c9){_0x199aa9[_0x52fd('0x1b')]=_0x5e72c9;if(_0x637be7['query'][_0x52fd('0x3e')]){_0x3ef505[_0x52fd('0x3f')]=[{'all':!![]}];}return db[_0x52fd('0x2a')][_0x52fd('0x40')](_0x3ef505);})[_0x52fd('0x21')](function(_0x958e3){_0x199aa9[_0x52fd('0x41')]=_0x958e3;return _0x199aa9;})[_0x52fd('0x21')](respondWithFilteredResult(_0x3c3d9e,_0x3ef505))[_0x52fd('0x42')](handleError(_0x3c3d9e,null));};exports['show']=function(_0x570490,_0x6d37d5){var _0x57ac1d={'raw':![],'where':{'id':_0x570490[_0x52fd('0x43')]['id']}},_0x3df30f={};_0x3df30f[_0x52fd('0x2e')]=_[_0x52fd('0x44')](db[_0x52fd('0x2a')][_0x52fd('0x45')]);_0x3df30f[_0x52fd('0x2f')]=_[_0x52fd('0x44')](_0x570490[_0x52fd('0x2f')]);_0x3df30f[_0x52fd('0x30')]=_[_0x52fd('0x31')](_0x3df30f[_0x52fd('0x2e')],_0x3df30f[_0x52fd('0x2f')]);_0x57ac1d[_0x52fd('0x32')]=_[_0x52fd('0x31')](_0x3df30f['model'],qs[_0x52fd('0x33')](_0x570490['query'][_0x52fd('0x33')]));_0x57ac1d[_0x52fd('0x32')]=_0x57ac1d[_0x52fd('0x32')][_0x52fd('0x34')]?_0x57ac1d[_0x52fd('0x32')]:_0x3df30f['model'];if(_0x570490[_0x52fd('0x2f')]['includeAll']){_0x57ac1d[_0x52fd('0x3f')]=[{'all':!![]}];}_0x57ac1d=_[_0x52fd('0x3c')]({},_0x57ac1d,_0x570490[_0x52fd('0x3d')]);return db[_0x52fd('0x2a')][_0x52fd('0x46')](_0x57ac1d)[_0x52fd('0x21')](handleEntityNotFound(_0x6d37d5,null))[_0x52fd('0x21')](respondWithResult(_0x6d37d5,null))['catch'](handleError(_0x6d37d5,null));};exports[_0x52fd('0x47')]=function(_0x345ae9,_0x569733){return db['Dynamics365Configuration']['create'](_0x345ae9[_0x52fd('0x48')],{})[_0x52fd('0x21')](respondWithResult(_0x569733,0xc9))[_0x52fd('0x42')](handleError(_0x569733,null));};exports['update']=function(_0x13e47d,_0x39133c){if(_0x13e47d[_0x52fd('0x48')]['id']){delete _0x13e47d[_0x52fd('0x48')]['id'];}return db[_0x52fd('0x2a')]['find']({'where':{'id':_0x13e47d[_0x52fd('0x43')]['id']}})[_0x52fd('0x21')](handleEntityNotFound(_0x39133c,null))[_0x52fd('0x21')](saveUpdates(_0x13e47d[_0x52fd('0x48')],null))[_0x52fd('0x21')](respondWithResult(_0x39133c,null))[_0x52fd('0x42')](handleError(_0x39133c,null));};exports[_0x52fd('0x22')]=function(_0x3f7ff1,_0x5c051e){return db[_0x52fd('0x2a')][_0x52fd('0x46')]({'where':{'id':_0x3f7ff1['params']['id']}})[_0x52fd('0x21')](handleEntityNotFound(_0x5c051e,null))[_0x52fd('0x21')](removeEntity(_0x5c051e,null))[_0x52fd('0x42')](handleError(_0x5c051e,null));};exports[_0x52fd('0x49')]=function(_0x24213f,_0x44f682,_0x209a4b){var _0x348844={};var _0x4a9b43={};var _0xb737ef;var _0x16d047;return db[_0x52fd('0x2a')][_0x52fd('0x4a')]({'where':{'id':_0x24213f['params']['id']}})[_0x52fd('0x21')](handleEntityNotFound(_0x44f682,null))[_0x52fd('0x21')](function(_0x580264){if(_0x580264){_0xb737ef=_0x580264;_0x4a9b43[_0x52fd('0x2e')]=_[_0x52fd('0x44')](db['Dynamics365Field']['rawAttributes']);_0x4a9b43[_0x52fd('0x2f')]=_[_0x52fd('0x44')](_0x24213f['query']);_0x4a9b43[_0x52fd('0x30')]=_[_0x52fd('0x31')](_0x4a9b43[_0x52fd('0x2e')],_0x4a9b43[_0x52fd('0x2f')]);_0x348844[_0x52fd('0x32')]=_['intersection'](_0x4a9b43[_0x52fd('0x2e')],qs[_0x52fd('0x33')](_0x24213f[_0x52fd('0x2f')][_0x52fd('0x33')]));_0x348844[_0x52fd('0x32')]=_0x348844[_0x52fd('0x32')][_0x52fd('0x34')]?_0x348844['attributes']:_0x4a9b43[_0x52fd('0x2e')];_0x348844[_0x52fd('0x37')]=qs[_0x52fd('0x38')](_0x24213f[_0x52fd('0x2f')][_0x52fd('0x38')]);_0x348844[_0x52fd('0x39')]=qs[_0x52fd('0x30')](_[_0x52fd('0x3a')](_0x24213f[_0x52fd('0x2f')],_0x4a9b43[_0x52fd('0x30')]));if(_0x24213f['query']['filter']){_0x348844[_0x52fd('0x39')]=_[_0x52fd('0x3c')](_0x348844[_0x52fd('0x39')],{'$or':_[_0x52fd('0x29')](_0x348844[_0x52fd('0x32')],function(_0x3a66b8){var _0xa15ca={};_0xa15ca[_0x3a66b8]={'$like':'%'+_0x24213f[_0x52fd('0x2f')][_0x52fd('0x3b')]+'%'};return _0xa15ca;})});}_0x348844=_[_0x52fd('0x3c')]({},_0x348844,_0x24213f[_0x52fd('0x3d')]);return _0xb737ef['getFields'](_0x348844);}})[_0x52fd('0x21')](function(_0x4002c5){if(_0x4002c5){_0x16d047=_0x4002c5[_0x52fd('0x34')];if(!_0x24213f['query'][_0x52fd('0x35')](_0x52fd('0x36'))){_0x348844[_0x52fd('0x1a')]=qs[_0x52fd('0x1a')](_0x24213f[_0x52fd('0x2f')][_0x52fd('0x1a')]);_0x348844['offset']=qs[_0x52fd('0x18')](_0x24213f[_0x52fd('0x2f')]['offset']);}return _0xb737ef['getFields'](_0x348844);}})[_0x52fd('0x21')](function(_0x3c5966){if(_0x3c5966){return _0x3c5966?{'count':_0x16d047,'rows':_0x3c5966}:null;}})[_0x52fd('0x21')](respondWithResult(_0x44f682,null))[_0x52fd('0x42')](handleError(_0x44f682,null));};exports['getSubjects']=function(_0x47ffbb,_0x4f309e,_0x25e4ee){var _0x2c5eda={};var _0x148a8a={};var _0x5da5d2;var _0x52d94d;return db[_0x52fd('0x2a')]['findOne']({'where':{'id':_0x47ffbb['params']['id']}})['then'](handleEntityNotFound(_0x4f309e,null))[_0x52fd('0x21')](function(_0x24a3d8){if(_0x24a3d8){_0x5da5d2=_0x24a3d8;_0x148a8a[_0x52fd('0x2e')]=_['keys'](db['Dynamics365Field']['rawAttributes']);_0x148a8a['query']=_['keys'](_0x47ffbb[_0x52fd('0x2f')]);_0x148a8a[_0x52fd('0x30')]=_['intersection'](_0x148a8a[_0x52fd('0x2e')],_0x148a8a['query']);_0x2c5eda['attributes']=_[_0x52fd('0x31')](_0x148a8a[_0x52fd('0x2e')],qs[_0x52fd('0x33')](_0x47ffbb[_0x52fd('0x2f')][_0x52fd('0x33')]));_0x2c5eda[_0x52fd('0x32')]=_0x2c5eda[_0x52fd('0x32')][_0x52fd('0x34')]?_0x2c5eda[_0x52fd('0x32')]:_0x148a8a['model'];_0x2c5eda[_0x52fd('0x37')]=qs[_0x52fd('0x38')](_0x47ffbb[_0x52fd('0x2f')]['sort']);_0x2c5eda[_0x52fd('0x39')]=qs[_0x52fd('0x30')](_[_0x52fd('0x3a')](_0x47ffbb[_0x52fd('0x2f')],_0x148a8a[_0x52fd('0x30')]));if(_0x47ffbb[_0x52fd('0x2f')][_0x52fd('0x3b')]){_0x2c5eda[_0x52fd('0x39')]=_[_0x52fd('0x3c')](_0x2c5eda[_0x52fd('0x39')],{'$or':_['map'](_0x2c5eda[_0x52fd('0x32')],function(_0x83edb6){var _0x3540e1={};_0x3540e1[_0x83edb6]={'$like':'%'+_0x47ffbb[_0x52fd('0x2f')][_0x52fd('0x3b')]+'%'};return _0x3540e1;})});}_0x2c5eda=_[_0x52fd('0x3c')]({},_0x2c5eda,_0x47ffbb['options']);return _0x5da5d2[_0x52fd('0x4b')](_0x2c5eda);}})[_0x52fd('0x21')](function(_0x4b83a2){if(_0x4b83a2){_0x52d94d=_0x4b83a2[_0x52fd('0x34')];if(!_0x47ffbb['query'][_0x52fd('0x35')](_0x52fd('0x36'))){_0x2c5eda[_0x52fd('0x1a')]=qs[_0x52fd('0x1a')](_0x47ffbb[_0x52fd('0x2f')]['limit']);_0x2c5eda[_0x52fd('0x18')]=qs[_0x52fd('0x18')](_0x47ffbb['query'][_0x52fd('0x18')]);}return _0x5da5d2['getSubjects'](_0x2c5eda);}})[_0x52fd('0x21')](function(_0x15021b){if(_0x15021b){return _0x15021b?{'count':_0x52d94d,'rows':_0x15021b}:null;}})[_0x52fd('0x21')](respondWithResult(_0x4f309e,null))['catch'](handleError(_0x4f309e,null));};exports[_0x52fd('0x4c')]=function(_0x99628,_0x5a9bca,_0x29ff4e){var _0x13b040={};var _0x5ae645={};var _0x567556;var _0x4e44c5;return db[_0x52fd('0x2a')][_0x52fd('0x4a')]({'where':{'id':_0x99628['params']['id']}})[_0x52fd('0x21')](handleEntityNotFound(_0x5a9bca,null))[_0x52fd('0x21')](function(_0x5569fc){if(_0x5569fc){_0x567556=_0x5569fc;_0x5ae645[_0x52fd('0x2e')]=_[_0x52fd('0x44')](db[_0x52fd('0x4d')][_0x52fd('0x45')]);_0x5ae645['query']=_[_0x52fd('0x44')](_0x99628[_0x52fd('0x2f')]);_0x5ae645[_0x52fd('0x30')]=_['intersection'](_0x5ae645[_0x52fd('0x2e')],_0x5ae645[_0x52fd('0x2f')]);_0x13b040[_0x52fd('0x32')]=_[_0x52fd('0x31')](_0x5ae645[_0x52fd('0x2e')],qs[_0x52fd('0x33')](_0x99628['query'][_0x52fd('0x33')]));_0x13b040[_0x52fd('0x32')]=_0x13b040[_0x52fd('0x32')][_0x52fd('0x34')]?_0x13b040[_0x52fd('0x32')]:_0x5ae645[_0x52fd('0x2e')];_0x13b040[_0x52fd('0x37')]=qs[_0x52fd('0x38')](_0x99628[_0x52fd('0x2f')][_0x52fd('0x38')]);_0x13b040[_0x52fd('0x39')]=qs[_0x52fd('0x30')](_[_0x52fd('0x3a')](_0x99628[_0x52fd('0x2f')],_0x5ae645[_0x52fd('0x30')]));if(_0x99628[_0x52fd('0x2f')][_0x52fd('0x3b')]){_0x13b040[_0x52fd('0x39')]=_[_0x52fd('0x3c')](_0x13b040[_0x52fd('0x39')],{'$or':_[_0x52fd('0x29')](_0x13b040[_0x52fd('0x32')],function(_0x5567dd){var _0x598135={};_0x598135[_0x5567dd]={'$like':'%'+_0x99628['query'][_0x52fd('0x3b')]+'%'};return _0x598135;})});}_0x13b040=_[_0x52fd('0x3c')]({},_0x13b040,_0x99628[_0x52fd('0x3d')]);return _0x567556[_0x52fd('0x4c')](_0x13b040);}})[_0x52fd('0x21')](function(_0x59e51f){if(_0x59e51f){_0x4e44c5=_0x59e51f[_0x52fd('0x34')];if(!_0x99628[_0x52fd('0x2f')][_0x52fd('0x35')](_0x52fd('0x36'))){_0x13b040[_0x52fd('0x1a')]=qs['limit'](_0x99628['query']['limit']);_0x13b040[_0x52fd('0x18')]=qs[_0x52fd('0x18')](_0x99628[_0x52fd('0x2f')][_0x52fd('0x18')]);}return _0x567556[_0x52fd('0x4c')](_0x13b040);}})['then'](function(_0x1d4b93){if(_0x1d4b93){return _0x1d4b93?{'count':_0x4e44c5,'rows':_0x1d4b93}:null;}})[_0x52fd('0x21')](respondWithResult(_0x5a9bca,null))[_0x52fd('0x42')](handleError(_0x5a9bca,null));}; \ No newline at end of file +var _0x4e83=['../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','count','status','set','Content-Range','reject','update','then','destroy','end','error','stack','name','send','map','Dynamics365Configuration','type','key','model','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','includeAll','findAll','rows','catch','rawAttributes','intersection','length','include','options','create','body','params','find','getFields','findOne','Dynamics365Field','pick','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware'];(function(_0xa18b1b,_0x58b8df){var _0x4ba39c=function(_0x1df47c){while(--_0x1df47c){_0xa18b1b['push'](_0xa18b1b['shift']());}};_0x4ba39c(++_0x58b8df);}(_0x4e83,0x1d5));var _0x34e8=function(_0x241207,_0x39a50c){_0x241207=_0x241207-0x0;var _0x26f4ce=_0x4e83[_0x241207];return _0x26f4ce;};'use strict';var emlformat=require(_0x34e8('0x0'));var rimraf=require(_0x34e8('0x1'));var zipdir=require(_0x34e8('0x2'));var jsonpatch=require(_0x34e8('0x3'));var rp=require(_0x34e8('0x4'));var moment=require(_0x34e8('0x5'));var BPromise=require(_0x34e8('0x6'));var Mustache=require(_0x34e8('0x7'));var util=require(_0x34e8('0x8'));var path=require(_0x34e8('0x9'));var sox=require(_0x34e8('0xa'));var csv=require(_0x34e8('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x34e8('0xc'));var _=require(_0x34e8('0xd'));var squel=require(_0x34e8('0xe'));var crypto=require(_0x34e8('0xf'));var jsforce=require(_0x34e8('0x10'));var deskjs=require(_0x34e8('0x11'));var toCsv=require(_0x34e8('0xb'));var querystring=require('querystring');var Papa=require(_0x34e8('0x12'));var Redis=require(_0x34e8('0x13'));var authService=require(_0x34e8('0x14'));var qs=require(_0x34e8('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x34e8('0x16'));var logger=require(_0x34e8('0x17'))(_0x34e8('0x18'));var utils=require(_0x34e8('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x34e8('0x1a'));var db=require(_0x34e8('0x1b'))['db'];function respondWithStatusCode(_0x5edc61,_0x15d1a2){_0x15d1a2=_0x15d1a2||0xcc;return function(_0x3c73ee){if(_0x3c73ee){return _0x5edc61[_0x34e8('0x1c')](_0x15d1a2);}return _0x5edc61['status'](_0x15d1a2)['end']();};}function respondWithResult(_0x821c02,_0xa3ced9){_0xa3ced9=_0xa3ced9||0xc8;return function(_0x512d92){if(_0x512d92){return _0x821c02['status'](_0xa3ced9)[_0x34e8('0x1d')](_0x512d92);}};}function respondWithFilteredResult(_0x55bea4,_0x114b0f){return function(_0x573862){if(_0x573862){var _0xa824bf=typeof _0x114b0f[_0x34e8('0x1e')]===_0x34e8('0x1f')&&typeof _0x114b0f['limit']===_0x34e8('0x1f');var _0x4669fc=_0x573862[_0x34e8('0x20')];var _0x4924c1=_0xa824bf?0x0:_0x114b0f[_0x34e8('0x1e')];var _0x384f24=_0xa824bf?_0x573862[_0x34e8('0x20')]:_0x114b0f[_0x34e8('0x1e')]+_0x114b0f['limit'];var _0x5f0196;if(_0x384f24>=_0x4669fc){_0x384f24=_0x4669fc;_0x5f0196=0xc8;}else{_0x5f0196=0xce;}_0x55bea4[_0x34e8('0x21')](_0x5f0196);return _0x55bea4[_0x34e8('0x22')](_0x34e8('0x23'),_0x4924c1+'-'+_0x384f24+'/'+_0x4669fc)[_0x34e8('0x1d')](_0x573862);}return null;};}function patchUpdates(_0x1bca23){return function(_0x43f7b0){try{jsonpatch['apply'](_0x43f7b0,_0x1bca23,!![]);}catch(_0x608618){return BPromise[_0x34e8('0x24')](_0x608618);}return _0x43f7b0['save']();};}function saveUpdates(_0x760c90,_0x347987){return function(_0x3c2a25){if(_0x3c2a25){return _0x3c2a25[_0x34e8('0x25')](_0x760c90)[_0x34e8('0x26')](function(_0x2c29c1){return _0x2c29c1;});}return null;};}function removeEntity(_0x5e8b79,_0x2cfe57){return function(_0x3ae923){if(_0x3ae923){return _0x3ae923[_0x34e8('0x27')]()['then'](function(){_0x5e8b79[_0x34e8('0x21')](0xcc)[_0x34e8('0x28')]();});}};}function handleEntityNotFound(_0x2f05ea,_0x502133){return function(_0x11e687){if(!_0x11e687){_0x2f05ea[_0x34e8('0x1c')](0x194);}return _0x11e687;};}function handleError(_0x148767,_0x3c4eb6){_0x3c4eb6=_0x3c4eb6||0x1f4;return function(_0x4c78d1){logger[_0x34e8('0x29')](_0x4c78d1[_0x34e8('0x2a')]);if(_0x4c78d1['name']){delete _0x4c78d1[_0x34e8('0x2b')];}_0x148767[_0x34e8('0x21')](_0x3c4eb6)[_0x34e8('0x2c')](_0x4c78d1);};}exports['index']=function(_0x267a15,_0x120ed0){var _0x57fdc3={},_0x536b07={},_0x52f44f={'count':0x0,'rows':[]};var _0x16938c=_[_0x34e8('0x2d')](db[_0x34e8('0x2e')]['rawAttributes'],function(_0xa3e0b8){return{'name':_0xa3e0b8['fieldName'],'type':_0xa3e0b8[_0x34e8('0x2f')][_0x34e8('0x30')]};});_0x536b07[_0x34e8('0x31')]=_[_0x34e8('0x2d')](_0x16938c,_0x34e8('0x2b'));_0x536b07[_0x34e8('0x32')]=_[_0x34e8('0x33')](_0x267a15['query']);_0x536b07[_0x34e8('0x34')]=_['intersection'](_0x536b07[_0x34e8('0x31')],_0x536b07[_0x34e8('0x32')]);_0x57fdc3[_0x34e8('0x35')]=_['intersection'](_0x536b07[_0x34e8('0x31')],qs['fields'](_0x267a15[_0x34e8('0x32')][_0x34e8('0x36')]));_0x57fdc3['attributes']=_0x57fdc3['attributes']['length']?_0x57fdc3[_0x34e8('0x35')]:_0x536b07[_0x34e8('0x31')];if(!_0x267a15[_0x34e8('0x32')][_0x34e8('0x37')](_0x34e8('0x38'))){_0x57fdc3[_0x34e8('0x39')]=qs[_0x34e8('0x39')](_0x267a15[_0x34e8('0x32')][_0x34e8('0x39')]);_0x57fdc3['offset']=qs[_0x34e8('0x1e')](_0x267a15[_0x34e8('0x32')][_0x34e8('0x1e')]);}_0x57fdc3[_0x34e8('0x3a')]=qs['sort'](_0x267a15[_0x34e8('0x32')][_0x34e8('0x3b')]);_0x57fdc3[_0x34e8('0x3c')]=qs['filters'](_['pick'](_0x267a15[_0x34e8('0x32')],_0x536b07['filters']),_0x16938c);if(_0x267a15[_0x34e8('0x32')][_0x34e8('0x3d')]){_0x57fdc3[_0x34e8('0x3c')]=_[_0x34e8('0x3e')](_0x57fdc3['where'],{'$or':_['map'](_0x16938c,function(_0xbf3ea0){if(_0xbf3ea0[_0x34e8('0x2f')]!=='VIRTUAL'){var _0x54900d={};_0x54900d[_0xbf3ea0[_0x34e8('0x2b')]]={'$like':'%'+_0x267a15['query'][_0x34e8('0x3d')]+'%'};return _0x54900d;}})});}_0x57fdc3=_[_0x34e8('0x3e')]({},_0x57fdc3,_0x267a15['options']);var _0x4af663={'where':_0x57fdc3[_0x34e8('0x3c')]};return db[_0x34e8('0x2e')][_0x34e8('0x20')](_0x4af663)['then'](function(_0x3ebbb0){_0x52f44f[_0x34e8('0x20')]=_0x3ebbb0;if(_0x267a15[_0x34e8('0x32')][_0x34e8('0x3f')]){_0x57fdc3['include']=[{'all':!![]}];}return db[_0x34e8('0x2e')][_0x34e8('0x40')](_0x57fdc3);})['then'](function(_0x52df94){_0x52f44f[_0x34e8('0x41')]=_0x52df94;return _0x52f44f;})[_0x34e8('0x26')](respondWithFilteredResult(_0x120ed0,_0x57fdc3))[_0x34e8('0x42')](handleError(_0x120ed0,null));};exports['show']=function(_0xca091c,_0x56c373){var _0x323794={'raw':![],'where':{'id':_0xca091c['params']['id']}},_0x4f5b16={};_0x4f5b16[_0x34e8('0x31')]=_[_0x34e8('0x33')](db[_0x34e8('0x2e')][_0x34e8('0x43')]);_0x4f5b16[_0x34e8('0x32')]=_[_0x34e8('0x33')](_0xca091c[_0x34e8('0x32')]);_0x4f5b16[_0x34e8('0x34')]=_[_0x34e8('0x44')](_0x4f5b16[_0x34e8('0x31')],_0x4f5b16[_0x34e8('0x32')]);_0x323794[_0x34e8('0x35')]=_[_0x34e8('0x44')](_0x4f5b16['model'],qs[_0x34e8('0x36')](_0xca091c[_0x34e8('0x32')]['fields']));_0x323794[_0x34e8('0x35')]=_0x323794['attributes'][_0x34e8('0x45')]?_0x323794[_0x34e8('0x35')]:_0x4f5b16[_0x34e8('0x31')];if(_0xca091c[_0x34e8('0x32')][_0x34e8('0x3f')]){_0x323794[_0x34e8('0x46')]=[{'all':!![]}];}_0x323794=_[_0x34e8('0x3e')]({},_0x323794,_0xca091c[_0x34e8('0x47')]);return db[_0x34e8('0x2e')]['find'](_0x323794)[_0x34e8('0x26')](handleEntityNotFound(_0x56c373,null))['then'](respondWithResult(_0x56c373,null))[_0x34e8('0x42')](handleError(_0x56c373,null));};exports[_0x34e8('0x48')]=function(_0x205097,_0x1a703e){return db[_0x34e8('0x2e')][_0x34e8('0x48')](_0x205097[_0x34e8('0x49')],{})[_0x34e8('0x26')](respondWithResult(_0x1a703e,0xc9))[_0x34e8('0x42')](handleError(_0x1a703e,null));};exports[_0x34e8('0x25')]=function(_0x53ad7e,_0x503ec8){if(_0x53ad7e[_0x34e8('0x49')]['id']){delete _0x53ad7e['body']['id'];}return db[_0x34e8('0x2e')]['find']({'where':{'id':_0x53ad7e[_0x34e8('0x4a')]['id']}})[_0x34e8('0x26')](handleEntityNotFound(_0x503ec8,null))[_0x34e8('0x26')](saveUpdates(_0x53ad7e[_0x34e8('0x49')],null))[_0x34e8('0x26')](respondWithResult(_0x503ec8,null))[_0x34e8('0x42')](handleError(_0x503ec8,null));};exports[_0x34e8('0x27')]=function(_0x36b035,_0x2f7174){return db[_0x34e8('0x2e')][_0x34e8('0x4b')]({'where':{'id':_0x36b035[_0x34e8('0x4a')]['id']}})[_0x34e8('0x26')](handleEntityNotFound(_0x2f7174,null))[_0x34e8('0x26')](removeEntity(_0x2f7174,null))['catch'](handleError(_0x2f7174,null));};exports[_0x34e8('0x4c')]=function(_0xe8ff86,_0x43850a,_0x5d9b57){var _0x46f95b={};var _0x963669={};var _0x596d16;var _0x26360d;return db[_0x34e8('0x2e')][_0x34e8('0x4d')]({'where':{'id':_0xe8ff86['params']['id']}})[_0x34e8('0x26')](handleEntityNotFound(_0x43850a,null))['then'](function(_0x4799db){if(_0x4799db){_0x596d16=_0x4799db;_0x963669[_0x34e8('0x31')]=_[_0x34e8('0x33')](db[_0x34e8('0x4e')][_0x34e8('0x43')]);_0x963669[_0x34e8('0x32')]=_[_0x34e8('0x33')](_0xe8ff86[_0x34e8('0x32')]);_0x963669[_0x34e8('0x34')]=_[_0x34e8('0x44')](_0x963669[_0x34e8('0x31')],_0x963669[_0x34e8('0x32')]);_0x46f95b[_0x34e8('0x35')]=_[_0x34e8('0x44')](_0x963669[_0x34e8('0x31')],qs[_0x34e8('0x36')](_0xe8ff86['query'][_0x34e8('0x36')]));_0x46f95b[_0x34e8('0x35')]=_0x46f95b['attributes'][_0x34e8('0x45')]?_0x46f95b[_0x34e8('0x35')]:_0x963669[_0x34e8('0x31')];_0x46f95b['order']=qs['sort'](_0xe8ff86[_0x34e8('0x32')]['sort']);_0x46f95b['where']=qs[_0x34e8('0x34')](_[_0x34e8('0x4f')](_0xe8ff86[_0x34e8('0x32')],_0x963669[_0x34e8('0x34')]));if(_0xe8ff86[_0x34e8('0x32')][_0x34e8('0x3d')]){_0x46f95b['where']=_[_0x34e8('0x3e')](_0x46f95b[_0x34e8('0x3c')],{'$or':_['map'](_0x46f95b[_0x34e8('0x35')],function(_0x2ebcca){var _0x18f0e3={};_0x18f0e3[_0x2ebcca]={'$like':'%'+_0xe8ff86[_0x34e8('0x32')]['filter']+'%'};return _0x18f0e3;})});}_0x46f95b=_[_0x34e8('0x3e')]({},_0x46f95b,_0xe8ff86[_0x34e8('0x47')]);return _0x596d16[_0x34e8('0x4c')](_0x46f95b);}})[_0x34e8('0x26')](function(_0x226445){if(_0x226445){_0x26360d=_0x226445[_0x34e8('0x45')];if(!_0xe8ff86[_0x34e8('0x32')][_0x34e8('0x37')](_0x34e8('0x38'))){_0x46f95b['limit']=qs['limit'](_0xe8ff86[_0x34e8('0x32')][_0x34e8('0x39')]);_0x46f95b['offset']=qs[_0x34e8('0x1e')](_0xe8ff86[_0x34e8('0x32')][_0x34e8('0x1e')]);}return _0x596d16['getFields'](_0x46f95b);}})[_0x34e8('0x26')](function(_0x5a604c){if(_0x5a604c){return _0x5a604c?{'count':_0x26360d,'rows':_0x5a604c}:null;}})[_0x34e8('0x26')](respondWithResult(_0x43850a,null))[_0x34e8('0x42')](handleError(_0x43850a,null));};exports[_0x34e8('0x50')]=function(_0x3da198,_0x50f61b,_0x47cde7){var _0xd5460={};var _0x40bbe2={};var _0x5242ec;var _0x1f1ab6;return db[_0x34e8('0x2e')][_0x34e8('0x4d')]({'where':{'id':_0x3da198['params']['id']}})['then'](handleEntityNotFound(_0x50f61b,null))['then'](function(_0x5a6e9c){if(_0x5a6e9c){_0x5242ec=_0x5a6e9c;_0x40bbe2[_0x34e8('0x31')]=_[_0x34e8('0x33')](db['Dynamics365Field'][_0x34e8('0x43')]);_0x40bbe2['query']=_['keys'](_0x3da198[_0x34e8('0x32')]);_0x40bbe2[_0x34e8('0x34')]=_[_0x34e8('0x44')](_0x40bbe2[_0x34e8('0x31')],_0x40bbe2[_0x34e8('0x32')]);_0xd5460[_0x34e8('0x35')]=_[_0x34e8('0x44')](_0x40bbe2[_0x34e8('0x31')],qs[_0x34e8('0x36')](_0x3da198['query'][_0x34e8('0x36')]));_0xd5460[_0x34e8('0x35')]=_0xd5460[_0x34e8('0x35')]['length']?_0xd5460[_0x34e8('0x35')]:_0x40bbe2['model'];_0xd5460[_0x34e8('0x3a')]=qs[_0x34e8('0x3b')](_0x3da198['query'][_0x34e8('0x3b')]);_0xd5460[_0x34e8('0x3c')]=qs[_0x34e8('0x34')](_[_0x34e8('0x4f')](_0x3da198[_0x34e8('0x32')],_0x40bbe2[_0x34e8('0x34')]));if(_0x3da198[_0x34e8('0x32')][_0x34e8('0x3d')]){_0xd5460[_0x34e8('0x3c')]=_[_0x34e8('0x3e')](_0xd5460[_0x34e8('0x3c')],{'$or':_[_0x34e8('0x2d')](_0xd5460[_0x34e8('0x35')],function(_0x20390a){var _0x33e8e3={};_0x33e8e3[_0x20390a]={'$like':'%'+_0x3da198['query'][_0x34e8('0x3d')]+'%'};return _0x33e8e3;})});}_0xd5460=_[_0x34e8('0x3e')]({},_0xd5460,_0x3da198[_0x34e8('0x47')]);return _0x5242ec[_0x34e8('0x50')](_0xd5460);}})['then'](function(_0x2e18f1){if(_0x2e18f1){_0x1f1ab6=_0x2e18f1[_0x34e8('0x45')];if(!_0x3da198[_0x34e8('0x32')][_0x34e8('0x37')](_0x34e8('0x38'))){_0xd5460[_0x34e8('0x39')]=qs['limit'](_0x3da198[_0x34e8('0x32')]['limit']);_0xd5460[_0x34e8('0x1e')]=qs[_0x34e8('0x1e')](_0x3da198[_0x34e8('0x32')]['offset']);}return _0x5242ec[_0x34e8('0x50')](_0xd5460);}})[_0x34e8('0x26')](function(_0x4a549d){if(_0x4a549d){return _0x4a549d?{'count':_0x1f1ab6,'rows':_0x4a549d}:null;}})[_0x34e8('0x26')](respondWithResult(_0x50f61b,null))[_0x34e8('0x42')](handleError(_0x50f61b,null));};exports[_0x34e8('0x51')]=function(_0x27d3fd,_0x64177f,_0x27c1d6){var _0x5bfe82={};var _0xcdbeeb={};var _0x195506;var _0x451647;return db[_0x34e8('0x2e')][_0x34e8('0x4d')]({'where':{'id':_0x27d3fd[_0x34e8('0x4a')]['id']}})[_0x34e8('0x26')](handleEntityNotFound(_0x64177f,null))[_0x34e8('0x26')](function(_0xbaf3e3){if(_0xbaf3e3){_0x195506=_0xbaf3e3;_0xcdbeeb['model']=_[_0x34e8('0x33')](db[_0x34e8('0x4e')][_0x34e8('0x43')]);_0xcdbeeb[_0x34e8('0x32')]=_[_0x34e8('0x33')](_0x27d3fd['query']);_0xcdbeeb[_0x34e8('0x34')]=_[_0x34e8('0x44')](_0xcdbeeb[_0x34e8('0x31')],_0xcdbeeb[_0x34e8('0x32')]);_0x5bfe82[_0x34e8('0x35')]=_[_0x34e8('0x44')](_0xcdbeeb[_0x34e8('0x31')],qs['fields'](_0x27d3fd[_0x34e8('0x32')]['fields']));_0x5bfe82['attributes']=_0x5bfe82['attributes']['length']?_0x5bfe82[_0x34e8('0x35')]:_0xcdbeeb['model'];_0x5bfe82[_0x34e8('0x3a')]=qs[_0x34e8('0x3b')](_0x27d3fd[_0x34e8('0x32')]['sort']);_0x5bfe82[_0x34e8('0x3c')]=qs[_0x34e8('0x34')](_[_0x34e8('0x4f')](_0x27d3fd[_0x34e8('0x32')],_0xcdbeeb[_0x34e8('0x34')]));if(_0x27d3fd['query']['filter']){_0x5bfe82[_0x34e8('0x3c')]=_['merge'](_0x5bfe82[_0x34e8('0x3c')],{'$or':_['map'](_0x5bfe82[_0x34e8('0x35')],function(_0x251579){var _0x1306f2={};_0x1306f2[_0x251579]={'$like':'%'+_0x27d3fd[_0x34e8('0x32')][_0x34e8('0x3d')]+'%'};return _0x1306f2;})});}_0x5bfe82=_[_0x34e8('0x3e')]({},_0x5bfe82,_0x27d3fd['options']);return _0x195506[_0x34e8('0x51')](_0x5bfe82);}})[_0x34e8('0x26')](function(_0x2264d1){if(_0x2264d1){_0x451647=_0x2264d1[_0x34e8('0x45')];if(!_0x27d3fd[_0x34e8('0x32')]['hasOwnProperty'](_0x34e8('0x38'))){_0x5bfe82['limit']=qs[_0x34e8('0x39')](_0x27d3fd[_0x34e8('0x32')][_0x34e8('0x39')]);_0x5bfe82[_0x34e8('0x1e')]=qs[_0x34e8('0x1e')](_0x27d3fd[_0x34e8('0x32')][_0x34e8('0x1e')]);}return _0x195506[_0x34e8('0x51')](_0x5bfe82);}})[_0x34e8('0x26')](function(_0x2b466d){if(_0x2b466d){return _0x2b466d?{'count':_0x451647,'rows':_0x2b466d}:null;}})[_0x34e8('0x26')](respondWithResult(_0x64177f,null))['catch'](handleError(_0x64177f,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 13b43ab..acce6bf 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 _0x8d0e=['define','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intDynamics365Configuration.attributes'];(function(_0x469f93,_0x2a2c71){var _0x465f36=function(_0x49e22a){while(--_0x49e22a){_0x469f93['push'](_0x469f93['shift']());}};_0x465f36(++_0x2a2c71);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x59ef40,_0x5eaa46){_0x59ef40=_0x59ef40-0x0;var _0x282ed7=_0x8d0e[_0x59ef40];return _0x282ed7;};'use strict';var _=require(_0xe8d0('0x0'));var util=require(_0xe8d0('0x1'));var logger=require(_0xe8d0('0x2'))(_0xe8d0('0x3'));var moment=require(_0xe8d0('0x4'));var BPromise=require(_0xe8d0('0x5'));var rp=require(_0xe8d0('0x6'));var fs=require('fs');var path=require(_0xe8d0('0x7'));var rimraf=require(_0xe8d0('0x8'));var config=require('../../config/environment');var attributes=require(_0xe8d0('0x9'));module['exports']=function(_0x560dab,_0x2e2985){return _0x560dab[_0xe8d0('0xa')](_0xe8d0('0xb'),attributes,{'tableName':_0xe8d0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaa88=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','Dynamics365Configuration','int_dynamics365_configurations','lodash'];(function(_0x1ed464,_0x47ef91){var _0x37875e=function(_0x1e399a){while(--_0x1e399a){_0x1ed464['push'](_0x1ed464['shift']());}};_0x37875e(++_0x47ef91);}(_0xaa88,0x137));var _0x8aa8=function(_0x3f465d,_0xbd2037){_0x3f465d=_0x3f465d-0x0;var _0x121ad1=_0xaa88[_0x3f465d];return _0x121ad1;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var logger=require(_0x8aa8('0x2'))(_0x8aa8('0x3'));var moment=require('moment');var BPromise=require(_0x8aa8('0x4'));var rp=require(_0x8aa8('0x5'));var fs=require('fs');var path=require(_0x8aa8('0x6'));var rimraf=require(_0x8aa8('0x7'));var config=require(_0x8aa8('0x8'));var attributes=require(_0x8aa8('0x9'));module['exports']=function(_0x5bda0d,_0x460042){return _0x5bda0d['define'](_0x8aa8('0xa'),attributes,{'tableName':_0x8aa8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index faa5485..2110ecf 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 _0xfdf9=['jayson/promise','client','http','request','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0xfdf9,0x1c6));var _0x9fdf=function(_0x501ba3,_0x23b3e3){_0x501ba3=_0x501ba3-0x0;var _0x2ed213=_0xfdf9[_0x501ba3];return _0x2ed213;};'use strict';var _=require(_0x9fdf('0x0'));var util=require(_0x9fdf('0x1'));var moment=require('moment');var BPromise=require(_0x9fdf('0x2'));var rs=require(_0x9fdf('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9fdf('0x4'))['db'];var utils=require(_0x9fdf('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x9fdf('0x6'));var client=jayson[_0x9fdf('0x7')][_0x9fdf('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x174dfb,_0x196f1d,_0x146e44){return new BPromise(function(_0x5a2e0b,_0x367dfb){return client[_0x9fdf('0x9')](_0x174dfb,_0x146e44)['then'](function(_0x5d0997){logger['info'](_0x9fdf('0xa'),_0x196f1d,_0x9fdf('0xb'));logger[_0x9fdf('0xc')](_0x9fdf('0xd'),_0x196f1d,_0x9fdf('0xb'),JSON[_0x9fdf('0xe')](_0x5d0997));if(_0x5d0997['error']){if(_0x5d0997['error'][_0x9fdf('0xf')]===0x1f4){logger['error'](_0x9fdf('0xa'),_0x196f1d,_0x5d0997[_0x9fdf('0x10')][_0x9fdf('0x11')]);return _0x367dfb(_0x5d0997[_0x9fdf('0x10')]['message']);}logger['error'](_0x9fdf('0xa'),_0x196f1d,_0x5d0997[_0x9fdf('0x10')][_0x9fdf('0x11')]);return _0x5a2e0b(_0x5d0997['error'][_0x9fdf('0x11')]);}else{logger[_0x9fdf('0x12')]('Dynamics365Configuration,\x20%s,\x20%s',_0x196f1d,_0x9fdf('0xb'));_0x5a2e0b(_0x5d0997['result']['message']);}})[_0x9fdf('0x13')](function(_0x53c484){logger[_0x9fdf('0x10')](_0x9fdf('0xa'),_0x196f1d,_0x53c484);_0x367dfb(_0x53c484);});});} \ No newline at end of file +var _0x6da2=['rpc','jayson/promise','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x6da2,0x187));var _0x26da=function(_0x411b75,_0x4de4ca){_0x411b75=_0x411b75-0x0;var _0x5a9239=_0x6da2[_0x411b75];return _0x5a9239;};'use strict';var _=require(_0x26da('0x0'));var util=require(_0x26da('0x1'));var moment=require(_0x26da('0x2'));var BPromise=require(_0x26da('0x3'));var rs=require(_0x26da('0x4'));var fs=require('fs');var Redis=require(_0x26da('0x5'));var db=require(_0x26da('0x6'))['db'];var utils=require(_0x26da('0x7'));var logger=require(_0x26da('0x8'))(_0x26da('0x9'));var config=require('../../config/environment');var jayson=require(_0x26da('0xa'));var client=jayson[_0x26da('0xb')][_0x26da('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x251c25,_0x1305c5,_0x1e92a8){return new BPromise(function(_0x3496c3,_0x33eb3b){return client[_0x26da('0xd')](_0x251c25,_0x1e92a8)[_0x26da('0xe')](function(_0x7ee538){logger[_0x26da('0xf')](_0x26da('0x10'),_0x1305c5,'request\x20sent');logger[_0x26da('0x11')](_0x26da('0x12'),_0x1305c5,_0x26da('0x13'),JSON[_0x26da('0x14')](_0x7ee538));if(_0x7ee538[_0x26da('0x15')]){if(_0x7ee538[_0x26da('0x15')][_0x26da('0x16')]===0x1f4){logger[_0x26da('0x15')]('Dynamics365Configuration,\x20%s,\x20%s',_0x1305c5,_0x7ee538[_0x26da('0x15')]['message']);return _0x33eb3b(_0x7ee538[_0x26da('0x15')]['message']);}logger[_0x26da('0x15')](_0x26da('0x10'),_0x1305c5,_0x7ee538[_0x26da('0x15')][_0x26da('0x17')]);return _0x3496c3(_0x7ee538[_0x26da('0x15')][_0x26da('0x17')]);}else{logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x1305c5,_0x26da('0x13'));_0x3496c3(_0x7ee538['result'][_0x26da('0x17')]);}})[_0x26da('0x18')](function(_0x5b9cf1){logger[_0x26da('0x15')](_0x26da('0x10'),_0x1305c5,_0x5b9cf1);_0x33eb3b(_0x5b9cf1);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 327586f..8e35904 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 _0xe20c=['../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','/:id','show','create','put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x27c1fb,_0x5a124d){var _0x159eb0=function(_0x4b6877){while(--_0x4b6877){_0x27c1fb['push'](_0x27c1fb['shift']());}};_0x159eb0(++_0x5a124d);}(_0xe20c,0x91));var _0xce20=function(_0x4c764c,_0x4b456c){_0x4c764c=_0x4c764c-0x0;var _0x563316=_0xe20c[_0x4c764c];return _0x563316;};'use strict';var multer=require(_0xce20('0x0'));var util=require(_0xce20('0x1'));var path=require('path');var timeout=require(_0xce20('0x2'));var express=require(_0xce20('0x3'));var router=express[_0xce20('0x4')]();var fs_extra=require(_0xce20('0x5'));var auth=require(_0xce20('0x6'));var interaction=require(_0xce20('0x7'));var config=require(_0xce20('0x8'));var controller=require(_0xce20('0x9'));router[_0xce20('0xa')]('/',auth[_0xce20('0xb')](),controller['index']);router[_0xce20('0xa')](_0xce20('0xc'),auth['isAuthenticated'](),controller[_0xce20('0xd')]);router['post']('/',auth[_0xce20('0xb')](),controller[_0xce20('0xe')]);router[_0xce20('0xf')](_0xce20('0xc'),auth[_0xce20('0xb')](),controller[_0xce20('0x10')]);router[_0xce20('0x11')](_0xce20('0xc'),auth[_0xce20('0xb')](),controller['destroy']);module[_0xce20('0x12')]=router; \ No newline at end of file +var _0xf236=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','multer','path','connect-timeout'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0xf236,0x1dd));var _0x6f23=function(_0x2abaae,_0x29fd8b){_0x2abaae=_0x2abaae-0x0;var _0x5b5745=_0xf236[_0x2abaae];return _0x5b5745;};'use strict';var multer=require(_0x6f23('0x0'));var util=require('util');var path=require(_0x6f23('0x1'));var timeout=require(_0x6f23('0x2'));var express=require(_0x6f23('0x3'));var router=express[_0x6f23('0x4')]();var fs_extra=require(_0x6f23('0x5'));var auth=require(_0x6f23('0x6'));var interaction=require(_0x6f23('0x7'));var config=require(_0x6f23('0x8'));var controller=require(_0x6f23('0x9'));router[_0x6f23('0xa')]('/',auth[_0x6f23('0xb')](),controller[_0x6f23('0xc')]);router[_0x6f23('0xa')](_0x6f23('0xd'),auth[_0x6f23('0xb')](),controller['show']);router[_0x6f23('0xe')]('/',auth[_0x6f23('0xb')](),controller[_0x6f23('0xf')]);router[_0x6f23('0x10')]('/:id',auth[_0x6f23('0xb')](),controller[_0x6f23('0x11')]);router[_0x6f23('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x6f23('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 3371ac8..92a2339 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 _0x6390=['customVariable','BOOLEAN','sequelize','exports','ENUM','string','variable','keyValue','STRING'];(function(_0xd12c51,_0x5107de){var _0x29177d=function(_0x52876c){while(--_0x52876c){_0xd12c51['push'](_0xd12c51['shift']());}};_0x29177d(++_0x5107de);}(_0x6390,0x119));var _0x0639=function(_0x1ac971,_0x21f635){_0x1ac971=_0x1ac971-0x0;var _0x3509e9=_0x6390[_0x1ac971];return _0x3509e9;};'use strict';var Sequelize=require(_0x0639('0x0'));module[_0x0639('0x1')]={'type':{'type':Sequelize[_0x0639('0x2')](_0x0639('0x3'),_0x0639('0x4'),'customVariable',_0x0639('0x5'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x0639('0x6')]},'key':{'type':Sequelize[_0x0639('0x6')]},'keyType':{'type':Sequelize[_0x0639('0x2')](_0x0639('0x3'),_0x0639('0x4'),_0x0639('0x7'))},'keyContent':{'type':Sequelize[_0x0639('0x6')]},'idField':{'type':Sequelize[_0x0639('0x6')]},'nameField':{'type':Sequelize[_0x0639('0x6')]},'customField':{'type':Sequelize[_0x0639('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0639('0x6')]}}; \ No newline at end of file +var _0x6356=['customVariable','keyValue','picklist','string','STRING','ENUM','variable','BOOLEAN','sequelize'];(function(_0x27638d,_0x4094db){var _0x35da35=function(_0x538095){while(--_0x538095){_0x27638d['push'](_0x27638d['shift']());}};_0x35da35(++_0x4094db);}(_0x6356,0x131));var _0x6635=function(_0x30e8a1,_0x55fa82){_0x30e8a1=_0x30e8a1-0x0;var _0x37c6f1=_0x6356[_0x30e8a1];return _0x37c6f1;};'use strict';var Sequelize=require(_0x6635('0x0'));module['exports']={'type':{'type':Sequelize['ENUM']('string','variable',_0x6635('0x1'),_0x6635('0x2'),_0x6635('0x3')),'defaultValue':_0x6635('0x4')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x6635('0x5')]},'keyType':{'type':Sequelize[_0x6635('0x6')](_0x6635('0x4'),_0x6635('0x7'),_0x6635('0x1'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x6635('0x5')]},'nameField':{'type':Sequelize[_0x6635('0x5')]},'customField':{'type':Sequelize[_0x6635('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index ddf1a1c..1b6627c 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 _0x45b7=['end','status','limit','undefined','count','offset','set','json','apply','reject','save','update','then','stack','name','send','index','map','Dynamics365Field','fieldName','type','key','model','query','intersection','attributes','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','keys','rawAttributes','fields','length','find','create','body','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x45b7,0x1a2));var _0x745b=function(_0x2c48eb,_0x123733){_0x2c48eb=_0x2c48eb-0x0;var _0x32ce87=_0x45b7[_0x2c48eb];return _0x32ce87;};'use strict';var emlformat=require(_0x745b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x745b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x745b('0x2'));var moment=require(_0x745b('0x3'));var BPromise=require(_0x745b('0x4'));var Mustache=require(_0x745b('0x5'));var util=require(_0x745b('0x6'));var path=require(_0x745b('0x7'));var sox=require(_0x745b('0x8'));var csv=require('to-csv');var ejs=require(_0x745b('0x9'));var fs=require('fs');var fs_extra=require(_0x745b('0xa'));var _=require(_0x745b('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x745b('0xc'));var deskjs=require(_0x745b('0xd'));var toCsv=require(_0x745b('0xe'));var querystring=require(_0x745b('0xf'));var Papa=require(_0x745b('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x745b('0x11'));var hardwareService=require(_0x745b('0x12'));var logger=require(_0x745b('0x13'))(_0x745b('0x14'));var utils=require(_0x745b('0x15'));var config=require(_0x745b('0x16'));var licenseUtil=require(_0x745b('0x17'));var db=require(_0x745b('0x18'))['db'];function respondWithStatusCode(_0x1303b4,_0x5c5d1c){_0x5c5d1c=_0x5c5d1c||0xcc;return function(_0x3a0915){if(_0x3a0915){return _0x1303b4[_0x745b('0x19')](_0x5c5d1c);}return _0x1303b4['status'](_0x5c5d1c)[_0x745b('0x1a')]();};}function respondWithResult(_0x2a150b,_0x45fccb){_0x45fccb=_0x45fccb||0xc8;return function(_0xa3c984){if(_0xa3c984){return _0x2a150b[_0x745b('0x1b')](_0x45fccb)['json'](_0xa3c984);}};}function respondWithFilteredResult(_0x19f29c,_0x3b36d9){return function(_0x594244){if(_0x594244){var _0x1ea65e=typeof _0x3b36d9['offset']==='undefined'&&typeof _0x3b36d9[_0x745b('0x1c')]===_0x745b('0x1d');var _0x59c729=_0x594244[_0x745b('0x1e')];var _0xa1c298=_0x1ea65e?0x0:_0x3b36d9[_0x745b('0x1f')];var _0x289ccb=_0x1ea65e?_0x594244[_0x745b('0x1e')]:_0x3b36d9[_0x745b('0x1f')]+_0x3b36d9['limit'];var _0x545983;if(_0x289ccb>=_0x59c729){_0x289ccb=_0x59c729;_0x545983=0xc8;}else{_0x545983=0xce;}_0x19f29c[_0x745b('0x1b')](_0x545983);return _0x19f29c[_0x745b('0x20')]('Content-Range',_0xa1c298+'-'+_0x289ccb+'/'+_0x59c729)[_0x745b('0x21')](_0x594244);}return null;};}function patchUpdates(_0x1053dc){return function(_0x2b7200){try{jsonpatch[_0x745b('0x22')](_0x2b7200,_0x1053dc,!![]);}catch(_0x477232){return BPromise[_0x745b('0x23')](_0x477232);}return _0x2b7200[_0x745b('0x24')]();};}function saveUpdates(_0x45bb3f,_0x4b1be5){return function(_0x143a03){if(_0x143a03){return _0x143a03[_0x745b('0x25')](_0x45bb3f)[_0x745b('0x26')](function(_0xd58212){return _0xd58212;});}return null;};}function removeEntity(_0xaee61f,_0x2131cf){return function(_0x3d8cb7){if(_0x3d8cb7){return _0x3d8cb7['destroy']()[_0x745b('0x26')](function(){_0xaee61f[_0x745b('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x70fdce,_0x1b6d8c){return function(_0x216517){if(!_0x216517){_0x70fdce[_0x745b('0x19')](0x194);}return _0x216517;};}function handleError(_0x109139,_0x51ab26){_0x51ab26=_0x51ab26||0x1f4;return function(_0x5c807a){logger['error'](_0x5c807a[_0x745b('0x27')]);if(_0x5c807a[_0x745b('0x28')]){delete _0x5c807a[_0x745b('0x28')];}_0x109139[_0x745b('0x1b')](_0x51ab26)[_0x745b('0x29')](_0x5c807a);};}exports[_0x745b('0x2a')]=function(_0x4c93e4,_0x24461c){var _0x5b6bdd={},_0x32f345={},_0x4af296={'count':0x0,'rows':[]};var _0x24fe4a=_[_0x745b('0x2b')](db[_0x745b('0x2c')]['rawAttributes'],function(_0x25e323){return{'name':_0x25e323[_0x745b('0x2d')],'type':_0x25e323[_0x745b('0x2e')][_0x745b('0x2f')]};});_0x32f345[_0x745b('0x30')]=_[_0x745b('0x2b')](_0x24fe4a,_0x745b('0x28'));_0x32f345[_0x745b('0x31')]=_['keys'](_0x4c93e4['query']);_0x32f345['filters']=_[_0x745b('0x32')](_0x32f345[_0x745b('0x30')],_0x32f345[_0x745b('0x31')]);_0x5b6bdd['attributes']=_[_0x745b('0x32')](_0x32f345[_0x745b('0x30')],qs['fields'](_0x4c93e4[_0x745b('0x31')]['fields']));_0x5b6bdd[_0x745b('0x33')]=_0x5b6bdd[_0x745b('0x33')]['length']?_0x5b6bdd[_0x745b('0x33')]:_0x32f345[_0x745b('0x30')];if(!_0x4c93e4[_0x745b('0x31')][_0x745b('0x34')](_0x745b('0x35'))){_0x5b6bdd[_0x745b('0x1c')]=qs[_0x745b('0x1c')](_0x4c93e4[_0x745b('0x31')][_0x745b('0x1c')]);_0x5b6bdd['offset']=qs[_0x745b('0x1f')](_0x4c93e4[_0x745b('0x31')][_0x745b('0x1f')]);}_0x5b6bdd['order']=qs[_0x745b('0x36')](_0x4c93e4['query'][_0x745b('0x36')]);_0x5b6bdd[_0x745b('0x37')]=qs[_0x745b('0x38')](_[_0x745b('0x39')](_0x4c93e4[_0x745b('0x31')],_0x32f345['filters']),_0x24fe4a);if(_0x4c93e4[_0x745b('0x31')][_0x745b('0x3a')]){_0x5b6bdd[_0x745b('0x37')]=_[_0x745b('0x3b')](_0x5b6bdd[_0x745b('0x37')],{'$or':_[_0x745b('0x2b')](_0x24fe4a,function(_0x293578){if(_0x293578[_0x745b('0x2e')]!==_0x745b('0x3c')){var _0x2342ef={};_0x2342ef[_0x293578[_0x745b('0x28')]]={'$like':'%'+_0x4c93e4['query'][_0x745b('0x3a')]+'%'};return _0x2342ef;}})});}_0x5b6bdd=_['merge']({},_0x5b6bdd,_0x4c93e4[_0x745b('0x3d')]);var _0x3b4f6e={'where':_0x5b6bdd[_0x745b('0x37')]};return db['Dynamics365Field'][_0x745b('0x1e')](_0x3b4f6e)['then'](function(_0x2e5420){_0x4af296[_0x745b('0x1e')]=_0x2e5420;if(_0x4c93e4[_0x745b('0x31')][_0x745b('0x3e')]){_0x5b6bdd[_0x745b('0x3f')]=[{'all':!![]}];}return db[_0x745b('0x2c')]['findAll'](_0x5b6bdd);})[_0x745b('0x26')](function(_0x47655b){_0x4af296[_0x745b('0x40')]=_0x47655b;return _0x4af296;})[_0x745b('0x26')](respondWithFilteredResult(_0x24461c,_0x5b6bdd))[_0x745b('0x41')](handleError(_0x24461c,null));};exports['show']=function(_0x1609f4,_0x117d10){var _0x2544fc={'raw':!![],'where':{'id':_0x1609f4[_0x745b('0x42')]['id']}},_0x4ca5d9={};_0x4ca5d9[_0x745b('0x30')]=_[_0x745b('0x43')](db[_0x745b('0x2c')][_0x745b('0x44')]);_0x4ca5d9[_0x745b('0x31')]=_[_0x745b('0x43')](_0x1609f4[_0x745b('0x31')]);_0x4ca5d9[_0x745b('0x38')]=_[_0x745b('0x32')](_0x4ca5d9[_0x745b('0x30')],_0x4ca5d9[_0x745b('0x31')]);_0x2544fc['attributes']=_['intersection'](_0x4ca5d9[_0x745b('0x30')],qs[_0x745b('0x45')](_0x1609f4['query'][_0x745b('0x45')]));_0x2544fc[_0x745b('0x33')]=_0x2544fc[_0x745b('0x33')][_0x745b('0x46')]?_0x2544fc[_0x745b('0x33')]:_0x4ca5d9[_0x745b('0x30')];if(_0x1609f4['query'][_0x745b('0x3e')]){_0x2544fc['include']=[{'all':!![]}];}_0x2544fc=_[_0x745b('0x3b')]({},_0x2544fc,_0x1609f4[_0x745b('0x3d')]);return db[_0x745b('0x2c')][_0x745b('0x47')](_0x2544fc)[_0x745b('0x26')](handleEntityNotFound(_0x117d10,null))['then'](respondWithResult(_0x117d10,null))['catch'](handleError(_0x117d10,null));};exports['create']=function(_0xe70101,_0xf44bd3){return db['Dynamics365Field'][_0x745b('0x48')](_0xe70101[_0x745b('0x49')],{})[_0x745b('0x26')](respondWithResult(_0xf44bd3,0xc9))[_0x745b('0x41')](handleError(_0xf44bd3,null));};exports[_0x745b('0x25')]=function(_0x44d935,_0x57431e){if(_0x44d935['body']['id']){delete _0x44d935[_0x745b('0x49')]['id'];}return db[_0x745b('0x2c')]['find']({'where':{'id':_0x44d935[_0x745b('0x42')]['id']}})[_0x745b('0x26')](handleEntityNotFound(_0x57431e,null))['then'](saveUpdates(_0x44d935[_0x745b('0x49')],null))['then'](respondWithResult(_0x57431e,null))['catch'](handleError(_0x57431e,null));};exports['destroy']=function(_0x19da62,_0x2b05f7){return db[_0x745b('0x2c')][_0x745b('0x47')]({'where':{'id':_0x19da62[_0x745b('0x42')]['id']}})['then'](handleEntityNotFound(_0x2b05f7,null))['then'](removeEntity(_0x2b05f7,null))[_0x745b('0x41')](handleError(_0x2b05f7,null));}; \ No newline at end of file +var _0x0479=['error','name','send','index','map','Dynamics365Field','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','where','filter','merge','options','includeAll','rows','catch','params','rawAttributes','keys','include','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','then','destroy'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x0479,0x10d));var _0x9047=function(_0x45cfb5,_0x3b6fb6){_0x45cfb5=_0x45cfb5-0x0;var _0x20cff1=_0x0479[_0x45cfb5];return _0x20cff1;};'use strict';var emlformat=require(_0x9047('0x0'));var rimraf=require(_0x9047('0x1'));var zipdir=require(_0x9047('0x2'));var jsonpatch=require(_0x9047('0x3'));var rp=require(_0x9047('0x4'));var moment=require(_0x9047('0x5'));var BPromise=require(_0x9047('0x6'));var Mustache=require(_0x9047('0x7'));var util=require(_0x9047('0x8'));var path=require(_0x9047('0x9'));var sox=require(_0x9047('0xa'));var csv=require(_0x9047('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9047('0xc'));var _=require(_0x9047('0xd'));var squel=require(_0x9047('0xe'));var crypto=require(_0x9047('0xf'));var jsforce=require(_0x9047('0x10'));var deskjs=require(_0x9047('0x11'));var toCsv=require('to-csv');var querystring=require(_0x9047('0x12'));var Papa=require(_0x9047('0x13'));var Redis=require(_0x9047('0x14'));var authService=require(_0x9047('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x9047('0x16'));var hardwareService=require(_0x9047('0x17'));var logger=require(_0x9047('0x18'))('api');var utils=require(_0x9047('0x19'));var config=require(_0x9047('0x1a'));var licenseUtil=require(_0x9047('0x1b'));var db=require(_0x9047('0x1c'))['db'];function respondWithStatusCode(_0x3e54bc,_0x1fb488){_0x1fb488=_0x1fb488||0xcc;return function(_0x3caee2){if(_0x3caee2){return _0x3e54bc[_0x9047('0x1d')](_0x1fb488);}return _0x3e54bc[_0x9047('0x1e')](_0x1fb488)[_0x9047('0x1f')]();};}function respondWithResult(_0x2635e4,_0x18c5d8){_0x18c5d8=_0x18c5d8||0xc8;return function(_0x56d9cb){if(_0x56d9cb){return _0x2635e4[_0x9047('0x1e')](_0x18c5d8)[_0x9047('0x20')](_0x56d9cb);}};}function respondWithFilteredResult(_0x92f935,_0x1be8c3){return function(_0x48b2d2){if(_0x48b2d2){var _0x3452ba=typeof _0x1be8c3[_0x9047('0x21')]===_0x9047('0x22')&&typeof _0x1be8c3['limit']===_0x9047('0x22');var _0x590b86=_0x48b2d2['count'];var _0x6df18b=_0x3452ba?0x0:_0x1be8c3[_0x9047('0x21')];var _0x377b61=_0x3452ba?_0x48b2d2[_0x9047('0x23')]:_0x1be8c3[_0x9047('0x21')]+_0x1be8c3[_0x9047('0x24')];var _0x263cf2;if(_0x377b61>=_0x590b86){_0x377b61=_0x590b86;_0x263cf2=0xc8;}else{_0x263cf2=0xce;}_0x92f935[_0x9047('0x1e')](_0x263cf2);return _0x92f935[_0x9047('0x25')]('Content-Range',_0x6df18b+'-'+_0x377b61+'/'+_0x590b86)[_0x9047('0x20')](_0x48b2d2);}return null;};}function patchUpdates(_0x2e4de9){return function(_0x3f3a2a){try{jsonpatch[_0x9047('0x26')](_0x3f3a2a,_0x2e4de9,!![]);}catch(_0x37cac5){return BPromise[_0x9047('0x27')](_0x37cac5);}return _0x3f3a2a[_0x9047('0x28')]();};}function saveUpdates(_0x598899,_0x15d3f3){return function(_0x300cf1){if(_0x300cf1){return _0x300cf1['update'](_0x598899)[_0x9047('0x29')](function(_0x567146){return _0x567146;});}return null;};}function removeEntity(_0x54d330,_0x555373){return function(_0x1930aa){if(_0x1930aa){return _0x1930aa[_0x9047('0x2a')]()['then'](function(){_0x54d330[_0x9047('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x31abfb,_0x201cbf){return function(_0x4120c9){if(!_0x4120c9){_0x31abfb['sendStatus'](0x194);}return _0x4120c9;};}function handleError(_0x418d0a,_0x2852b5){_0x2852b5=_0x2852b5||0x1f4;return function(_0x122e12){logger[_0x9047('0x2b')](_0x122e12['stack']);if(_0x122e12[_0x9047('0x2c')]){delete _0x122e12['name'];}_0x418d0a[_0x9047('0x1e')](_0x2852b5)[_0x9047('0x2d')](_0x122e12);};}exports[_0x9047('0x2e')]=function(_0x1cb1d3,_0x568c94){var _0x126df8={},_0x348098={},_0x1cd99a={'count':0x0,'rows':[]};var _0x11e72f=_[_0x9047('0x2f')](db[_0x9047('0x30')]['rawAttributes'],function(_0x477a90){return{'name':_0x477a90[_0x9047('0x31')],'type':_0x477a90[_0x9047('0x32')][_0x9047('0x33')]};});_0x348098[_0x9047('0x34')]=_[_0x9047('0x2f')](_0x11e72f,_0x9047('0x2c'));_0x348098['query']=_['keys'](_0x1cb1d3[_0x9047('0x35')]);_0x348098['filters']=_[_0x9047('0x36')](_0x348098[_0x9047('0x34')],_0x348098[_0x9047('0x35')]);_0x126df8[_0x9047('0x37')]=_[_0x9047('0x36')](_0x348098['model'],qs['fields'](_0x1cb1d3[_0x9047('0x35')][_0x9047('0x38')]));_0x126df8[_0x9047('0x37')]=_0x126df8['attributes'][_0x9047('0x39')]?_0x126df8[_0x9047('0x37')]:_0x348098[_0x9047('0x34')];if(!_0x1cb1d3[_0x9047('0x35')][_0x9047('0x3a')](_0x9047('0x3b'))){_0x126df8[_0x9047('0x24')]=qs[_0x9047('0x24')](_0x1cb1d3[_0x9047('0x35')][_0x9047('0x24')]);_0x126df8[_0x9047('0x21')]=qs[_0x9047('0x21')](_0x1cb1d3[_0x9047('0x35')]['offset']);}_0x126df8['order']=qs[_0x9047('0x3c')](_0x1cb1d3[_0x9047('0x35')][_0x9047('0x3c')]);_0x126df8['where']=qs[_0x9047('0x3d')](_[_0x9047('0x3e')](_0x1cb1d3[_0x9047('0x35')],_0x348098[_0x9047('0x3d')]),_0x11e72f);if(_0x1cb1d3[_0x9047('0x35')]['filter']){_0x126df8[_0x9047('0x3f')]=_['merge'](_0x126df8[_0x9047('0x3f')],{'$or':_[_0x9047('0x2f')](_0x11e72f,function(_0x137ffa){if(_0x137ffa[_0x9047('0x32')]!=='VIRTUAL'){var _0x49ba37={};_0x49ba37[_0x137ffa[_0x9047('0x2c')]]={'$like':'%'+_0x1cb1d3[_0x9047('0x35')][_0x9047('0x40')]+'%'};return _0x49ba37;}})});}_0x126df8=_[_0x9047('0x41')]({},_0x126df8,_0x1cb1d3[_0x9047('0x42')]);var _0x34a1c4={'where':_0x126df8[_0x9047('0x3f')]};return db['Dynamics365Field']['count'](_0x34a1c4)[_0x9047('0x29')](function(_0x2fc864){_0x1cd99a[_0x9047('0x23')]=_0x2fc864;if(_0x1cb1d3[_0x9047('0x35')][_0x9047('0x43')]){_0x126df8['include']=[{'all':!![]}];}return db[_0x9047('0x30')]['findAll'](_0x126df8);})['then'](function(_0x3912bd){_0x1cd99a[_0x9047('0x44')]=_0x3912bd;return _0x1cd99a;})[_0x9047('0x29')](respondWithFilteredResult(_0x568c94,_0x126df8))[_0x9047('0x45')](handleError(_0x568c94,null));};exports['show']=function(_0x5839f0,_0x1b75c5){var _0x30cc11={'raw':!![],'where':{'id':_0x5839f0[_0x9047('0x46')]['id']}},_0x59a121={};_0x59a121[_0x9047('0x34')]=_['keys'](db[_0x9047('0x30')][_0x9047('0x47')]);_0x59a121[_0x9047('0x35')]=_[_0x9047('0x48')](_0x5839f0[_0x9047('0x35')]);_0x59a121[_0x9047('0x3d')]=_['intersection'](_0x59a121['model'],_0x59a121['query']);_0x30cc11[_0x9047('0x37')]=_[_0x9047('0x36')](_0x59a121[_0x9047('0x34')],qs['fields'](_0x5839f0[_0x9047('0x35')][_0x9047('0x38')]));_0x30cc11['attributes']=_0x30cc11[_0x9047('0x37')]['length']?_0x30cc11['attributes']:_0x59a121['model'];if(_0x5839f0[_0x9047('0x35')]['includeAll']){_0x30cc11[_0x9047('0x49')]=[{'all':!![]}];}_0x30cc11=_[_0x9047('0x41')]({},_0x30cc11,_0x5839f0['options']);return db[_0x9047('0x30')][_0x9047('0x4a')](_0x30cc11)[_0x9047('0x29')](handleEntityNotFound(_0x1b75c5,null))['then'](respondWithResult(_0x1b75c5,null))[_0x9047('0x45')](handleError(_0x1b75c5,null));};exports[_0x9047('0x4b')]=function(_0x19c522,_0x49bcca){return db[_0x9047('0x30')][_0x9047('0x4b')](_0x19c522[_0x9047('0x4c')],{})['then'](respondWithResult(_0x49bcca,0xc9))['catch'](handleError(_0x49bcca,null));};exports[_0x9047('0x4d')]=function(_0x3b9cce,_0x380444){if(_0x3b9cce[_0x9047('0x4c')]['id']){delete _0x3b9cce[_0x9047('0x4c')]['id'];}return db['Dynamics365Field'][_0x9047('0x4a')]({'where':{'id':_0x3b9cce[_0x9047('0x46')]['id']}})['then'](handleEntityNotFound(_0x380444,null))[_0x9047('0x29')](saveUpdates(_0x3b9cce['body'],null))[_0x9047('0x29')](respondWithResult(_0x380444,null))[_0x9047('0x45')](handleError(_0x380444,null));};exports[_0x9047('0x2a')]=function(_0x3e5ff0,_0x1e5547){return db['Dynamics365Field']['find']({'where':{'id':_0x3e5ff0[_0x9047('0x46')]['id']}})[_0x9047('0x29')](handleEntityNotFound(_0x1e5547,null))[_0x9047('0x29')](removeEntity(_0x1e5547,null))['catch'](handleError(_0x1e5547,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 2e432fd..f88e59b 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 _0x0430=['path','rimraf','./intDynamics365Field.attributes','exports','define','Dynamics365Field','int_dynamics365_fields','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x290f21,_0x5dbf3d){var _0x24614b=function(_0x5bfbac){while(--_0x5bfbac){_0x290f21['push'](_0x290f21['shift']());}};_0x24614b(++_0x5dbf3d);}(_0x0430,0x1d9));var _0x0043=function(_0x4318ce,_0x5af3d6){_0x4318ce=_0x4318ce-0x0;var _0x267b3c=_0x0430[_0x4318ce];return _0x267b3c;};'use strict';var _=require(_0x0043('0x0'));var util=require(_0x0043('0x1'));var logger=require(_0x0043('0x2'))(_0x0043('0x3'));var moment=require(_0x0043('0x4'));var BPromise=require(_0x0043('0x5'));var rp=require(_0x0043('0x6'));var fs=require('fs');var path=require(_0x0043('0x7'));var rimraf=require(_0x0043('0x8'));var config=require('../../config/environment');var attributes=require(_0x0043('0x9'));module[_0x0043('0xa')]=function(_0x2b3ecf,_0x4dfaed){return _0x2b3ecf[_0x0043('0xb')](_0x0043('0xc'),attributes,{'tableName':_0x0043('0xd'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':['idField',_0x0043('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4f88=['path','rimraf','exports','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','util','../../config/logger','bluebird','request-promise'];(function(_0x356bb1,_0x5060b8){var _0x2b6de8=function(_0x4e51d8){while(--_0x4e51d8){_0x356bb1['push'](_0x356bb1['shift']());}};_0x2b6de8(++_0x5060b8);}(_0x4f88,0x17d));var _0x84f8=function(_0x43b487,_0x21893a){_0x43b487=_0x43b487-0x0;var _0x2f707a=_0x4f88[_0x43b487];return _0x2f707a;};'use strict';var _=require('lodash');var util=require(_0x84f8('0x0'));var logger=require(_0x84f8('0x1'))('api');var moment=require('moment');var BPromise=require(_0x84f8('0x2'));var rp=require(_0x84f8('0x3'));var fs=require('fs');var path=require(_0x84f8('0x4'));var rimraf=require(_0x84f8('0x5'));var config=require('../../config/environment');var attributes=require('./intDynamics365Field.attributes');module[_0x84f8('0x6')]=function(_0x4f9413,_0x108b5a){return _0x4f9413['define']('Dynamics365Field',attributes,{'tableName':_0x84f8('0x7'),'paranoid':![],'indexes':[{'name':_0x84f8('0x8'),'fields':[_0x84f8('0x9'),_0x84f8('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index 0634c5a..29f3dd2 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 _0x3050=['jayson/promise','client','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4e2ac6,_0x5770c5){var _0x26886f=function(_0x8184ba){while(--_0x8184ba){_0x4e2ac6['push'](_0x4e2ac6['shift']());}};_0x26886f(++_0x5770c5);}(_0x3050,0x149));var _0x0305=function(_0x2d8545,_0x4f542f){_0x2d8545=_0x2d8545-0x0;var _0x5f3cf4=_0x3050[_0x2d8545];return _0x5f3cf4;};'use strict';var _=require(_0x0305('0x0'));var util=require(_0x0305('0x1'));var moment=require('moment');var BPromise=require(_0x0305('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0305('0x3'));var db=require(_0x0305('0x4'))['db'];var utils=require(_0x0305('0x5'));var logger=require(_0x0305('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0305('0x7'));var client=jayson[_0x0305('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5431f5,_0x3bb425,_0xb9d2da){return new BPromise(function(_0x514de2,_0x2ff29d){return client[_0x0305('0x9')](_0x5431f5,_0xb9d2da)[_0x0305('0xa')](function(_0x149034){logger[_0x0305('0xb')](_0x0305('0xc'),_0x3bb425,_0x0305('0xd'));logger[_0x0305('0xe')](_0x0305('0xf'),_0x3bb425,_0x0305('0xd'),JSON[_0x0305('0x10')](_0x149034));if(_0x149034[_0x0305('0x11')]){if(_0x149034[_0x0305('0x11')][_0x0305('0x12')]===0x1f4){logger[_0x0305('0x11')](_0x0305('0xc'),_0x3bb425,_0x149034['error'][_0x0305('0x13')]);return _0x2ff29d(_0x149034['error']['message']);}logger['error'](_0x0305('0xc'),_0x3bb425,_0x149034[_0x0305('0x11')][_0x0305('0x13')]);return _0x514de2(_0x149034['error'][_0x0305('0x13')]);}else{logger[_0x0305('0xb')](_0x0305('0xc'),_0x3bb425,'request\x20sent');_0x514de2(_0x149034['result'][_0x0305('0x13')]);}})[_0x0305('0x14')](function(_0x4eef29){logger[_0x0305('0x11')](_0x0305('0xc'),_0x3bb425,_0x4eef29);_0x2ff29d(_0x4eef29);});});} \ No newline at end of file +var _0x0f15=['Dynamics365Field,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','client','http','then','info','Dynamics365Field,\x20%s,\x20%s','debug'];(function(_0x3e7a28,_0x4d8f04){var _0x281a03=function(_0x3b70c2){while(--_0x3b70c2){_0x3e7a28['push'](_0x3e7a28['shift']());}};_0x281a03(++_0x4d8f04);}(_0x0f15,0xde));var _0x50f1=function(_0x436b6e,_0x30ccab){_0x436b6e=_0x436b6e-0x0;var _0x3fe68d=_0x0f15[_0x436b6e];return _0x3fe68d;};'use strict';var _=require(_0x50f1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x50f1('0x1'));var rs=require(_0x50f1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x50f1('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x50f1('0x4'));var config=require(_0x50f1('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x50f1('0x6')][_0x50f1('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x124fd5,_0x8aa72a,_0x3bae91){return new BPromise(function(_0x3d97e2,_0x2604f3){return client['request'](_0x124fd5,_0x3bae91)[_0x50f1('0x8')](function(_0x3771c6){logger[_0x50f1('0x9')](_0x50f1('0xa'),_0x8aa72a,'request\x20sent');logger[_0x50f1('0xb')](_0x50f1('0xc'),_0x8aa72a,_0x50f1('0xd'),JSON['stringify'](_0x3771c6));if(_0x3771c6['error']){if(_0x3771c6[_0x50f1('0xe')][_0x50f1('0xf')]===0x1f4){logger[_0x50f1('0xe')](_0x50f1('0xa'),_0x8aa72a,_0x3771c6[_0x50f1('0xe')]['message']);return _0x2604f3(_0x3771c6['error'][_0x50f1('0x10')]);}logger[_0x50f1('0xe')]('Dynamics365Field,\x20%s,\x20%s',_0x8aa72a,_0x3771c6[_0x50f1('0xe')][_0x50f1('0x10')]);return _0x3d97e2(_0x3771c6[_0x50f1('0xe')][_0x50f1('0x10')]);}else{logger[_0x50f1('0x9')]('Dynamics365Field,\x20%s,\x20%s',_0x8aa72a,_0x50f1('0xd'));_0x3d97e2(_0x3771c6['result'][_0x50f1('0x10')]);}})[_0x50f1('0x11')](function(_0x2e5c66){logger[_0x50f1('0xe')]('Dynamics365Field,\x20%s,\x20%s',_0x8aa72a,_0x2e5c66);_0x2604f3(_0x2e5c66);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 7331ea2..be60645 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 _0xc2d9=['./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','post','create','addConfiguration','put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc2d9,0x1dd));var _0x9c2d=function(_0xc066e3,_0xdbc21c){_0xc066e3=_0xc066e3-0x0;var _0x364318=_0xc2d9[_0xc066e3];return _0x364318;};'use strict';var multer=require(_0x9c2d('0x0'));var util=require(_0x9c2d('0x1'));var path=require('path');var timeout=require(_0x9c2d('0x2'));var express=require(_0x9c2d('0x3'));var router=express[_0x9c2d('0x4')]();var fs_extra=require(_0x9c2d('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9c2d('0x6'));var controller=require(_0x9c2d('0x7'));router[_0x9c2d('0x8')]('/',auth[_0x9c2d('0x9')](),controller[_0x9c2d('0xa')]);router[_0x9c2d('0x8')](_0x9c2d('0xb'),auth['isAuthenticated'](),controller[_0x9c2d('0xc')]);router[_0x9c2d('0x8')](_0x9c2d('0xd'),auth['isAuthenticated'](),controller[_0x9c2d('0xe')]);router['get']('/:id/fields',auth[_0x9c2d('0x9')](),controller['getFields']);router[_0x9c2d('0xf')]('/',auth['isAuthenticated'](),controller[_0x9c2d('0x10')]);router[_0x9c2d('0xf')](_0x9c2d('0xd'),auth['isAuthenticated'](),controller[_0x9c2d('0x11')]);router[_0x9c2d('0x12')](_0x9c2d('0xb'),auth['isAuthenticated'](),controller[_0x9c2d('0x13')]);router[_0x9c2d('0x14')](_0x9c2d('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x9c2d('0x15')]=router; \ No newline at end of file +var _0x1a75=['../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','/:id/configurations','getConfigurations','post','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x2f71a0,_0x29f6b4){var _0x25a4cd=function(_0x10abe6){while(--_0x10abe6){_0x2f71a0['push'](_0x2f71a0['shift']());}};_0x25a4cd(++_0x29f6b4);}(_0x1a75,0x86));var _0x51a7=function(_0x380f5d,_0x334b34){_0x380f5d=_0x380f5d-0x0;var _0x217df1=_0x1a75[_0x380f5d];return _0x217df1;};'use strict';var multer=require(_0x51a7('0x0'));var util=require(_0x51a7('0x1'));var path=require(_0x51a7('0x2'));var timeout=require(_0x51a7('0x3'));var express=require(_0x51a7('0x4'));var router=express[_0x51a7('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x51a7('0x6'));var config=require(_0x51a7('0x7'));var controller=require(_0x51a7('0x8'));router[_0x51a7('0x9')]('/',auth[_0x51a7('0xa')](),controller['index']);router[_0x51a7('0x9')]('/:id',auth[_0x51a7('0xa')](),controller['show']);router['get'](_0x51a7('0xb'),auth[_0x51a7('0xa')](),controller[_0x51a7('0xc')]);router[_0x51a7('0x9')]('/:id/fields',auth[_0x51a7('0xa')](),controller['getFields']);router[_0x51a7('0xd')]('/',auth['isAuthenticated'](),controller[_0x51a7('0xe')]);router[_0x51a7('0xd')](_0x51a7('0xb'),auth[_0x51a7('0xa')](),controller['addConfiguration']);router[_0x51a7('0xf')](_0x51a7('0x10'),auth[_0x51a7('0xa')](),controller[_0x51a7('0x11')]);router['delete'](_0x51a7('0x10'),auth[_0x51a7('0xa')](),controller[_0x51a7('0x12')]);module[_0x51a7('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 09a2942..6638acc 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 _0x4888=['exports','STRING','username'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x4888,0x198));var _0x8488=function(_0x16da8f,_0x4ddb80){_0x16da8f=_0x16da8f-0x0;var _0xd5dca8=_0x4888[_0x16da8f];return _0xd5dca8;};'use strict';var Sequelize=require('sequelize');module[_0x8488('0x0')]={'name':{'type':Sequelize[_0x8488('0x1')]},'description':{'type':Sequelize[_0x8488('0x1')]},'username':{'type':Sequelize[_0x8488('0x1')],'unique':_0x8488('0x2')},'apiKey':{'type':Sequelize[_0x8488('0x1')]},'remoteUri':{'type':Sequelize[_0x8488('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x8488('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x6a95=['exports','STRING','username','sequelize'];(function(_0x1f6e71,_0x19360b){var _0x2271aa=function(_0x2f0431){while(--_0x2f0431){_0x1f6e71['push'](_0x1f6e71['shift']());}};_0x2271aa(++_0x19360b);}(_0x6a95,0x1db));var _0x56a9=function(_0x40bffc,_0x3a45d7){_0x40bffc=_0x40bffc-0x0;var _0x3007e9=_0x6a95[_0x40bffc];return _0x3007e9;};'use strict';var Sequelize=require(_0x56a9('0x0'));module[_0x56a9('0x1')]={'name':{'type':Sequelize[_0x56a9('0x2')]},'description':{'type':Sequelize[_0x56a9('0x2')]},'username':{'type':Sequelize[_0x56a9('0x2')],'unique':_0x56a9('0x3')},'apiKey':{'type':Sequelize[_0x56a9('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x56a9('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 1d7f743..fb858cc 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 _0x1c8a=['rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','offset','limit','count','set','json','apply','reject','save','update','then','destroy','stack','name','index','FreshdeskAccount','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','catch','show','find','create','body','params','getConfigurations','findOne','FreshdeskConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','getFields','apiKey','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','base64','requester','subject','agent','description','group','source','default','custom_dropdown','label','choices','map','capitalize','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','send','eml-format'];(function(_0x393d69,_0x3a8c83){var _0x3cee37=function(_0x462682){while(--_0x462682){_0x393d69['push'](_0x393d69['shift']());}};_0x3cee37(++_0x3a8c83);}(_0x1c8a,0x140));var _0xa1c8=function(_0x3874b0,_0xca85bb){_0x3874b0=_0x3874b0-0x0;var _0x2f567e=_0x1c8a[_0x3874b0];return _0x2f567e;};'use strict';var emlformat=require(_0xa1c8('0x0'));var rimraf=require(_0xa1c8('0x1'));var zipdir=require(_0xa1c8('0x2'));var jsonpatch=require(_0xa1c8('0x3'));var rp=require(_0xa1c8('0x4'));var moment=require('moment');var BPromise=require(_0xa1c8('0x5'));var Mustache=require('mustache');var util=require(_0xa1c8('0x6'));var path=require(_0xa1c8('0x7'));var sox=require(_0xa1c8('0x8'));var csv=require('to-csv');var ejs=require(_0xa1c8('0x9'));var fs=require('fs');var fs_extra=require(_0xa1c8('0xa'));var _=require(_0xa1c8('0xb'));var squel=require('squel');var crypto=require(_0xa1c8('0xc'));var jsforce=require(_0xa1c8('0xd'));var deskjs=require(_0xa1c8('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa1c8('0xf'));var Papa=require(_0xa1c8('0x10'));var Redis=require(_0xa1c8('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa1c8('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa1c8('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa1c8('0x14'));var db=require(_0xa1c8('0x15'))['db'];var integrations=require(_0xa1c8('0x16'));function respondWithStatusCode(_0x707249,_0x644e9c){_0x644e9c=_0x644e9c||0xcc;return function(_0x4097bf){if(_0x4097bf){return _0x707249['sendStatus'](_0x644e9c);}return _0x707249[_0xa1c8('0x17')](_0x644e9c)[_0xa1c8('0x18')]();};}function respondWithResult(_0xcccc7b,_0x3797fe){_0x3797fe=_0x3797fe||0xc8;return function(_0xcb9223){if(_0xcb9223){return _0xcccc7b[_0xa1c8('0x17')](_0x3797fe)['json'](_0xcb9223);}};}function respondWithFilteredResult(_0x7f1128,_0x51b1c3){return function(_0x17d4d2){if(_0x17d4d2){var _0x2ef438=typeof _0x51b1c3[_0xa1c8('0x19')]==='undefined'&&typeof _0x51b1c3[_0xa1c8('0x1a')]==='undefined';var _0x55caa7=_0x17d4d2[_0xa1c8('0x1b')];var _0x112ab0=_0x2ef438?0x0:_0x51b1c3['offset'];var _0x3c66c3=_0x2ef438?_0x17d4d2[_0xa1c8('0x1b')]:_0x51b1c3[_0xa1c8('0x19')]+_0x51b1c3['limit'];var _0x35cd08;if(_0x3c66c3>=_0x55caa7){_0x3c66c3=_0x55caa7;_0x35cd08=0xc8;}else{_0x35cd08=0xce;}_0x7f1128[_0xa1c8('0x17')](_0x35cd08);return _0x7f1128[_0xa1c8('0x1c')]('Content-Range',_0x112ab0+'-'+_0x3c66c3+'/'+_0x55caa7)[_0xa1c8('0x1d')](_0x17d4d2);}return null;};}function patchUpdates(_0x874b1f){return function(_0x520ec1){try{jsonpatch[_0xa1c8('0x1e')](_0x520ec1,_0x874b1f,!![]);}catch(_0x34d526){return BPromise[_0xa1c8('0x1f')](_0x34d526);}return _0x520ec1[_0xa1c8('0x20')]();};}function saveUpdates(_0x19fe5a,_0x23ff11){return function(_0x198400){if(_0x198400){return _0x198400[_0xa1c8('0x21')](_0x19fe5a)[_0xa1c8('0x22')](function(_0x193077){return _0x193077;});}return null;};}function removeEntity(_0x28473c,_0x125047){return function(_0x2827ed){if(_0x2827ed){return _0x2827ed[_0xa1c8('0x23')]()[_0xa1c8('0x22')](function(){_0x28473c[_0xa1c8('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e9a50,_0x550b68){return function(_0x63eb4c){if(!_0x63eb4c){_0x1e9a50['sendStatus'](0x194);}return _0x63eb4c;};}function handleError(_0x404cb8,_0x508742){_0x508742=_0x508742||0x1f4;return function(_0x22eec1){logger['error'](_0x22eec1[_0xa1c8('0x24')]);if(_0x22eec1[_0xa1c8('0x25')]){delete _0x22eec1[_0xa1c8('0x25')];}_0x404cb8[_0xa1c8('0x17')](_0x508742)['send'](_0x22eec1);};}exports[_0xa1c8('0x26')]=function(_0x404fa1,_0x28b9e5){var _0x4d0a4f={},_0x5f43bc={},_0x1a44de={'count':0x0,'rows':[]};var _0x473a62=_['map'](db[_0xa1c8('0x27')][_0xa1c8('0x28')],function(_0xeadfdd){return{'name':_0xeadfdd['fieldName'],'type':_0xeadfdd['type']['key']};});_0x5f43bc[_0xa1c8('0x29')]=_['map'](_0x473a62,_0xa1c8('0x25'));_0x5f43bc[_0xa1c8('0x2a')]=_[_0xa1c8('0x2b')](_0x404fa1[_0xa1c8('0x2a')]);_0x5f43bc[_0xa1c8('0x2c')]=_[_0xa1c8('0x2d')](_0x5f43bc['model'],_0x5f43bc[_0xa1c8('0x2a')]);_0x4d0a4f[_0xa1c8('0x2e')]=_[_0xa1c8('0x2d')](_0x5f43bc[_0xa1c8('0x29')],qs['fields'](_0x404fa1['query'][_0xa1c8('0x2f')]));_0x4d0a4f['attributes']=_0x4d0a4f[_0xa1c8('0x2e')][_0xa1c8('0x30')]?_0x4d0a4f[_0xa1c8('0x2e')]:_0x5f43bc[_0xa1c8('0x29')];if(!_0x404fa1[_0xa1c8('0x2a')][_0xa1c8('0x31')](_0xa1c8('0x32'))){_0x4d0a4f[_0xa1c8('0x1a')]=qs['limit'](_0x404fa1[_0xa1c8('0x2a')][_0xa1c8('0x1a')]);_0x4d0a4f[_0xa1c8('0x19')]=qs[_0xa1c8('0x19')](_0x404fa1[_0xa1c8('0x2a')][_0xa1c8('0x19')]);}_0x4d0a4f[_0xa1c8('0x33')]=qs[_0xa1c8('0x34')](_0x404fa1[_0xa1c8('0x2a')][_0xa1c8('0x34')]);_0x4d0a4f[_0xa1c8('0x35')]=qs[_0xa1c8('0x2c')](_[_0xa1c8('0x36')](_0x404fa1[_0xa1c8('0x2a')],_0x5f43bc['filters']),_0x473a62);if(_0x404fa1['query'][_0xa1c8('0x37')]){_0x4d0a4f[_0xa1c8('0x35')]=_[_0xa1c8('0x38')](_0x4d0a4f['where'],{'$or':_['map'](_0x473a62,function(_0x4c0b92){if(_0x4c0b92[_0xa1c8('0x39')]!=='VIRTUAL'){var _0x580963={};_0x580963[_0x4c0b92[_0xa1c8('0x25')]]={'$like':'%'+_0x404fa1[_0xa1c8('0x2a')][_0xa1c8('0x37')]+'%'};return _0x580963;}})});}_0x4d0a4f=_['merge']({},_0x4d0a4f,_0x404fa1[_0xa1c8('0x3a')]);var _0x3fe148={'where':_0x4d0a4f['where']};return db[_0xa1c8('0x27')][_0xa1c8('0x1b')](_0x3fe148)[_0xa1c8('0x22')](function(_0x4bad1e){_0x1a44de[_0xa1c8('0x1b')]=_0x4bad1e;if(_0x404fa1[_0xa1c8('0x2a')][_0xa1c8('0x3b')]){_0x4d0a4f[_0xa1c8('0x3c')]=[{'all':!![]}];}return db[_0xa1c8('0x27')]['findAll'](_0x4d0a4f);})[_0xa1c8('0x22')](function(_0x57c24c){_0x1a44de['rows']=_0x57c24c;return _0x1a44de;})['then'](respondWithFilteredResult(_0x28b9e5,_0x4d0a4f))[_0xa1c8('0x3d')](handleError(_0x28b9e5,null));};exports[_0xa1c8('0x3e')]=function(_0x15e9fe,_0x26289d){var _0x3a5cd4={'raw':![],'where':{'id':_0x15e9fe['params']['id']}},_0x5a82ca={};_0x5a82ca[_0xa1c8('0x29')]=_[_0xa1c8('0x2b')](db[_0xa1c8('0x27')]['rawAttributes']);_0x5a82ca['query']=_[_0xa1c8('0x2b')](_0x15e9fe[_0xa1c8('0x2a')]);_0x5a82ca[_0xa1c8('0x2c')]=_[_0xa1c8('0x2d')](_0x5a82ca[_0xa1c8('0x29')],_0x5a82ca[_0xa1c8('0x2a')]);_0x3a5cd4[_0xa1c8('0x2e')]=_['intersection'](_0x5a82ca[_0xa1c8('0x29')],qs['fields'](_0x15e9fe[_0xa1c8('0x2a')][_0xa1c8('0x2f')]));_0x3a5cd4[_0xa1c8('0x2e')]=_0x3a5cd4['attributes'][_0xa1c8('0x30')]?_0x3a5cd4['attributes']:_0x5a82ca[_0xa1c8('0x29')];if(_0x15e9fe[_0xa1c8('0x2a')][_0xa1c8('0x3b')]){_0x3a5cd4['include']=[{'all':!![]}];}_0x3a5cd4=_[_0xa1c8('0x38')]({},_0x3a5cd4,_0x15e9fe[_0xa1c8('0x3a')]);return db['FreshdeskAccount'][_0xa1c8('0x3f')](_0x3a5cd4)[_0xa1c8('0x22')](handleEntityNotFound(_0x26289d,null))[_0xa1c8('0x22')](respondWithResult(_0x26289d,null))[_0xa1c8('0x3d')](handleError(_0x26289d,null));};exports[_0xa1c8('0x40')]=function(_0x43616f,_0x258d46){return db[_0xa1c8('0x27')][_0xa1c8('0x40')](_0x43616f['body'],{})[_0xa1c8('0x22')](respondWithResult(_0x258d46,0xc9))[_0xa1c8('0x3d')](handleError(_0x258d46,null));};exports[_0xa1c8('0x21')]=function(_0xf29fc,_0x4f0909){if(_0xf29fc[_0xa1c8('0x41')]['id']){delete _0xf29fc[_0xa1c8('0x41')]['id'];}return db[_0xa1c8('0x27')][_0xa1c8('0x3f')]({'where':{'id':_0xf29fc[_0xa1c8('0x42')]['id']}})['then'](handleEntityNotFound(_0x4f0909,null))[_0xa1c8('0x22')](saveUpdates(_0xf29fc[_0xa1c8('0x41')],null))[_0xa1c8('0x22')](respondWithResult(_0x4f0909,null))[_0xa1c8('0x3d')](handleError(_0x4f0909,null));};exports[_0xa1c8('0x23')]=function(_0x50a90f,_0x5bbef3){return db[_0xa1c8('0x27')][_0xa1c8('0x3f')]({'where':{'id':_0x50a90f[_0xa1c8('0x42')]['id']}})['then'](handleEntityNotFound(_0x5bbef3,null))[_0xa1c8('0x22')](removeEntity(_0x5bbef3,null))[_0xa1c8('0x3d')](handleError(_0x5bbef3,null));};exports[_0xa1c8('0x43')]=function(_0xda6bd9,_0x443b94,_0x2e083e){var _0x3fd9b7={};var _0x423429={};var _0x18dac8;var _0xf13fa3;return db[_0xa1c8('0x27')][_0xa1c8('0x44')]({'where':{'id':_0xda6bd9[_0xa1c8('0x42')]['id']}})['then'](handleEntityNotFound(_0x443b94,null))[_0xa1c8('0x22')](function(_0x1a117a){if(_0x1a117a){_0x18dac8=_0x1a117a;_0x423429[_0xa1c8('0x29')]=_[_0xa1c8('0x2b')](db[_0xa1c8('0x45')][_0xa1c8('0x28')]);_0x423429[_0xa1c8('0x2a')]=_[_0xa1c8('0x2b')](_0xda6bd9['query']);_0x423429[_0xa1c8('0x2c')]=_[_0xa1c8('0x2d')](_0x423429[_0xa1c8('0x29')],_0x423429[_0xa1c8('0x2a')]);_0x3fd9b7['attributes']=_['intersection'](_0x423429[_0xa1c8('0x29')],qs['fields'](_0xda6bd9[_0xa1c8('0x2a')][_0xa1c8('0x2f')]));_0x3fd9b7[_0xa1c8('0x2e')]=_0x3fd9b7[_0xa1c8('0x2e')][_0xa1c8('0x30')]?_0x3fd9b7[_0xa1c8('0x2e')]:_0x423429['model'];_0x3fd9b7[_0xa1c8('0x33')]=qs['sort'](_0xda6bd9[_0xa1c8('0x2a')]['sort']);_0x3fd9b7[_0xa1c8('0x35')]=qs[_0xa1c8('0x2c')](_[_0xa1c8('0x36')](_0xda6bd9[_0xa1c8('0x2a')],_0x423429['filters']));if(_0xda6bd9[_0xa1c8('0x2a')][_0xa1c8('0x37')]){_0x3fd9b7[_0xa1c8('0x35')]=_[_0xa1c8('0x38')](_0x3fd9b7[_0xa1c8('0x35')],{'$or':_['map'](_0x3fd9b7['attributes'],function(_0x30ed79){var _0x3d4873={};_0x3d4873[_0x30ed79]={'$like':'%'+_0xda6bd9['query'][_0xa1c8('0x37')]+'%'};return _0x3d4873;})});}_0x3fd9b7=_['merge']({},_0x3fd9b7,_0xda6bd9['options']);return _0x18dac8['getConfigurations'](_0x3fd9b7);}})[_0xa1c8('0x22')](function(_0x4df225){if(_0x4df225){_0xf13fa3=_0x4df225['length'];if(!_0xda6bd9[_0xa1c8('0x2a')]['hasOwnProperty'](_0xa1c8('0x32'))){_0x3fd9b7['limit']=qs['limit'](_0xda6bd9[_0xa1c8('0x2a')][_0xa1c8('0x1a')]);_0x3fd9b7[_0xa1c8('0x19')]=qs['offset'](_0xda6bd9[_0xa1c8('0x2a')][_0xa1c8('0x19')]);}return _0x18dac8[_0xa1c8('0x43')](_0x3fd9b7);}})['then'](function(_0x458579){if(_0x458579){return _0x458579?{'count':_0xf13fa3,'rows':_0x458579}:null;}})[_0xa1c8('0x22')](respondWithResult(_0x443b94,null))['catch'](handleError(_0x443b94,null));};exports[_0xa1c8('0x46')]=function(_0x380926,_0x670db6,_0x511b19){if(_0x380926[_0xa1c8('0x41')]['id']){delete _0x380926[_0xa1c8('0x41')]['id'];}return db['FreshdeskAccount'][_0xa1c8('0x44')]({'where':{'id':_0x380926['params']['id']}})[_0xa1c8('0x22')](handleEntityNotFound(_0x670db6,null))['then'](function(_0x125cfb){if(_0x125cfb){_0x380926[_0xa1c8('0x41')][_0xa1c8('0x47')]=_0x125cfb['id'];_0x380926[_0xa1c8('0x41')][_0xa1c8('0x48')]=integrations[_0xa1c8('0x49')](_0x380926[_0xa1c8('0x41')][_0xa1c8('0x4a')],_0x380926['body'][_0xa1c8('0x39')]);_0x380926[_0xa1c8('0x41')][_0xa1c8('0x4b')]=integrations[_0xa1c8('0x4c')](_0x380926[_0xa1c8('0x41')][_0xa1c8('0x4a')],_0x380926[_0xa1c8('0x41')][_0xa1c8('0x39')]);return db[_0xa1c8('0x45')][_0xa1c8('0x40')](_0x380926[_0xa1c8('0x41')],{'include':[{'model':db[_0xa1c8('0x4d')],'as':_0xa1c8('0x48')},{'model':db[_0xa1c8('0x4d')],'as':_0xa1c8('0x4b')}]});}return null;})[_0xa1c8('0x22')](respondWithResult(_0x670db6,null))[_0xa1c8('0x3d')](handleError(_0x670db6,null));};exports[_0xa1c8('0x4e')]=function(_0x376f19,_0x3eda58,_0x71af88){var _0xc75ecd='';return db[_0xa1c8('0x27')][_0xa1c8('0x44')]({'where':{'id':_0x376f19[_0xa1c8('0x42')]['id']},'attributes':['id','remoteUri',_0xa1c8('0x4f')]})[_0xa1c8('0x22')](handleEntityNotFound(_0x3eda58,null))[_0xa1c8('0x22')](function(_0x42feab){if(_0x42feab){_0xc75ecd=_0x42feab['remoteUri'];var _0x3d3e13=_0xc75ecd['slice'](-0x1);if(_0x3d3e13==='/'){_0xc75ecd=_0xc75ecd[_0xa1c8('0x50')](0x0,_0xc75ecd[_0xa1c8('0x51')](_0x3d3e13));}return rp({'method':_0xa1c8('0x52'),'uri':util[_0xa1c8('0x53')](_0xa1c8('0x54'),_0xc75ecd,_0xa1c8('0x55')),'headers':{'Authorization':util[_0xa1c8('0x53')](_0xa1c8('0x56'),new Buffer(util[_0xa1c8('0x53')](_0xa1c8('0x57'),_0x42feab['apiKey']))[_0xa1c8('0x58')](_0xa1c8('0x59')))},'json':!![]});}})[_0xa1c8('0x22')](function(_0x12ef5c){if(_0x12ef5c){var _0x142a14=[_0xa1c8('0x5a'),_0xa1c8('0x5b'),_0xa1c8('0x5c'),_0xa1c8('0x5d'),'status','priority',_0xa1c8('0x5e'),_0xa1c8('0x5f'),'ticket_type',_0xa1c8('0x5e'),'company'];_['remove'](_0x12ef5c,function(_0x25afae){return _0x142a14['includes'](_0x25afae[_0xa1c8('0x25')])||!_0x25afae[_0xa1c8('0x60')]&&_0x25afae['type']!=='custom_text'&&_0x25afae[_0xa1c8('0x39')]!==_0xa1c8('0x61');});return{'count':_0x12ef5c['length'],'rows':_['map'](_0x12ef5c,function(_0xeb16fc){return{'id':_0xeb16fc[_0xa1c8('0x25')],'name':_0xeb16fc[_0xa1c8('0x62')],'custom':!_0xeb16fc[_0xa1c8('0x60')],'options':_0xeb16fc[_0xa1c8('0x63')]?_[_0xa1c8('0x64')](_0xeb16fc[_0xa1c8('0x63')],function(_0x513962){return{'name':_[_0xa1c8('0x65')](_0x513962),'value':_0x513962};}):[]};})};}})[_0xa1c8('0x22')](respondWithResult(_0x3eda58,null))[_0xa1c8('0x3d')](function(_0x154d17){var _0x471f8e=_0x376f19[_0xa1c8('0x2a')][_0xa1c8('0x66')]?0x1f4:_0x154d17[_0xa1c8('0x67')]||0x1f4;logger[_0xa1c8('0x68')](_0xa1c8('0x69'),_0xa1c8('0x4e'),_0x471f8e,JSON['stringify'](_0x154d17));delete _0x154d17['name'];if(_0x471f8e===0x191){_0x471f8e=0x190;}_0x3eda58[_0xa1c8('0x17')](_0x471f8e)[_0xa1c8('0x6a')](_0x376f19[_0xa1c8('0x2a')][_0xa1c8('0x66')]?{'message':'Wrong\x20credentials','statusCode':_0x154d17[_0xa1c8('0x67')]}:_0x154d17);});}; \ No newline at end of file +var _0x292b=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','sendStatus','stack','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','include','findAll','rows','catch','show','params','includeAll','options','create','body','update','find','getConfigurations','FreshdeskConfiguration','addConfiguration','findOne','AccountId','getSubjects','Descriptions','getDescriptions','FreshdeskField','remoteUri','apiKey','lastIndexOf','GET','%s/%s','api/v2/ticket_fields','format','Basic\x20%s','%s:X','toString','requester','subject','description','priority','group','source','ticket_type','remove','includes','default','custom_text','custom_dropdown','choices','capitalize','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis'];(function(_0x5d7293,_0x695842){var _0x2f0755=function(_0x5b1a69){while(--_0x5b1a69){_0x5d7293['push'](_0x5d7293['shift']());}};_0x2f0755(++_0x695842);}(_0x292b,0x64));var _0xb292=function(_0x49bfb8,_0x5b6e2b){_0x49bfb8=_0x49bfb8-0x0;var _0x1be0b7=_0x292b[_0x49bfb8];return _0x1be0b7;};'use strict';var emlformat=require(_0xb292('0x0'));var rimraf=require(_0xb292('0x1'));var zipdir=require(_0xb292('0x2'));var jsonpatch=require(_0xb292('0x3'));var rp=require(_0xb292('0x4'));var moment=require(_0xb292('0x5'));var BPromise=require(_0xb292('0x6'));var Mustache=require(_0xb292('0x7'));var util=require(_0xb292('0x8'));var path=require(_0xb292('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb292('0xa'));var _=require(_0xb292('0xb'));var squel=require(_0xb292('0xc'));var crypto=require('crypto');var jsforce=require(_0xb292('0xd'));var deskjs=require(_0xb292('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb292('0xf'));var Redis=require(_0xb292('0x10'));var authService=require(_0xb292('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xb292('0x12'));var hardwareService=require(_0xb292('0x13'));var logger=require(_0xb292('0x14'))(_0xb292('0x15'));var utils=require('../../config/utils');var config=require(_0xb292('0x16'));var licenseUtil=require(_0xb292('0x17'));var db=require(_0xb292('0x18'))['db'];var integrations=require(_0xb292('0x19'));function respondWithStatusCode(_0x5dbdf4,_0x22bdce){_0x22bdce=_0x22bdce||0xcc;return function(_0x2dae35){if(_0x2dae35){return _0x5dbdf4['sendStatus'](_0x22bdce);}return _0x5dbdf4['status'](_0x22bdce)['end']();};}function respondWithResult(_0x104e5f,_0x223a1d){_0x223a1d=_0x223a1d||0xc8;return function(_0x417aad){if(_0x417aad){return _0x104e5f[_0xb292('0x1a')](_0x223a1d)[_0xb292('0x1b')](_0x417aad);}};}function respondWithFilteredResult(_0x1677bf,_0x18b43c){return function(_0x5c1c01){if(_0x5c1c01){var _0x439891=typeof _0x18b43c[_0xb292('0x1c')]===_0xb292('0x1d')&&typeof _0x18b43c[_0xb292('0x1e')]===_0xb292('0x1d');var _0xf32a5c=_0x5c1c01['count'];var _0x2fa2e4=_0x439891?0x0:_0x18b43c[_0xb292('0x1c')];var _0x2fc03d=_0x439891?_0x5c1c01[_0xb292('0x1f')]:_0x18b43c[_0xb292('0x1c')]+_0x18b43c[_0xb292('0x1e')];var _0x19e1a0;if(_0x2fc03d>=_0xf32a5c){_0x2fc03d=_0xf32a5c;_0x19e1a0=0xc8;}else{_0x19e1a0=0xce;}_0x1677bf['status'](_0x19e1a0);return _0x1677bf[_0xb292('0x20')](_0xb292('0x21'),_0x2fa2e4+'-'+_0x2fc03d+'/'+_0xf32a5c)[_0xb292('0x1b')](_0x5c1c01);}return null;};}function patchUpdates(_0x5ee1b8){return function(_0xd1fa7a){try{jsonpatch[_0xb292('0x22')](_0xd1fa7a,_0x5ee1b8,!![]);}catch(_0x51a216){return BPromise[_0xb292('0x23')](_0x51a216);}return _0xd1fa7a['save']();};}function saveUpdates(_0x41c21c,_0x55b728){return function(_0x1e1f10){if(_0x1e1f10){return _0x1e1f10['update'](_0x41c21c)[_0xb292('0x24')](function(_0x5e9ccf){return _0x5e9ccf;});}return null;};}function removeEntity(_0x44735d,_0x1de6e5){return function(_0x3b9e90){if(_0x3b9e90){return _0x3b9e90[_0xb292('0x25')]()[_0xb292('0x24')](function(){_0x44735d[_0xb292('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x53d64e,_0x5537ee){return function(_0x5cbda6){if(!_0x5cbda6){_0x53d64e[_0xb292('0x26')](0x194);}return _0x5cbda6;};}function handleError(_0x1d1f4c,_0x1ecd86){_0x1ecd86=_0x1ecd86||0x1f4;return function(_0x52ecd4){logger['error'](_0x52ecd4[_0xb292('0x27')]);if(_0x52ecd4[_0xb292('0x28')]){delete _0x52ecd4['name'];}_0x1d1f4c['status'](_0x1ecd86)[_0xb292('0x29')](_0x52ecd4);};}exports[_0xb292('0x2a')]=function(_0x3c8005,_0x5bd3af){var _0x2fc66d={},_0x5e5a29={},_0x2c231e={'count':0x0,'rows':[]};var _0x186532=_[_0xb292('0x2b')](db[_0xb292('0x2c')][_0xb292('0x2d')],function(_0xb7ab72){return{'name':_0xb7ab72[_0xb292('0x2e')],'type':_0xb7ab72['type'][_0xb292('0x2f')]};});_0x5e5a29[_0xb292('0x30')]=_[_0xb292('0x2b')](_0x186532,_0xb292('0x28'));_0x5e5a29['query']=_[_0xb292('0x31')](_0x3c8005[_0xb292('0x32')]);_0x5e5a29[_0xb292('0x33')]=_[_0xb292('0x34')](_0x5e5a29[_0xb292('0x30')],_0x5e5a29[_0xb292('0x32')]);_0x2fc66d[_0xb292('0x35')]=_[_0xb292('0x34')](_0x5e5a29[_0xb292('0x30')],qs[_0xb292('0x36')](_0x3c8005[_0xb292('0x32')]['fields']));_0x2fc66d[_0xb292('0x35')]=_0x2fc66d[_0xb292('0x35')][_0xb292('0x37')]?_0x2fc66d[_0xb292('0x35')]:_0x5e5a29['model'];if(!_0x3c8005['query'][_0xb292('0x38')](_0xb292('0x39'))){_0x2fc66d[_0xb292('0x1e')]=qs[_0xb292('0x1e')](_0x3c8005['query']['limit']);_0x2fc66d[_0xb292('0x1c')]=qs[_0xb292('0x1c')](_0x3c8005[_0xb292('0x32')][_0xb292('0x1c')]);}_0x2fc66d[_0xb292('0x3a')]=qs['sort'](_0x3c8005[_0xb292('0x32')][_0xb292('0x3b')]);_0x2fc66d[_0xb292('0x3c')]=qs[_0xb292('0x33')](_[_0xb292('0x3d')](_0x3c8005[_0xb292('0x32')],_0x5e5a29[_0xb292('0x33')]),_0x186532);if(_0x3c8005[_0xb292('0x32')][_0xb292('0x3e')]){_0x2fc66d[_0xb292('0x3c')]=_[_0xb292('0x3f')](_0x2fc66d[_0xb292('0x3c')],{'$or':_[_0xb292('0x2b')](_0x186532,function(_0x500e16){if(_0x500e16[_0xb292('0x40')]!==_0xb292('0x41')){var _0x3e231b={};_0x3e231b[_0x500e16[_0xb292('0x28')]]={'$like':'%'+_0x3c8005[_0xb292('0x32')]['filter']+'%'};return _0x3e231b;}})});}_0x2fc66d=_[_0xb292('0x3f')]({},_0x2fc66d,_0x3c8005['options']);var _0x248bfb={'where':_0x2fc66d[_0xb292('0x3c')]};return db['FreshdeskAccount'][_0xb292('0x1f')](_0x248bfb)[_0xb292('0x24')](function(_0x5b1f98){_0x2c231e[_0xb292('0x1f')]=_0x5b1f98;if(_0x3c8005[_0xb292('0x32')]['includeAll']){_0x2fc66d[_0xb292('0x42')]=[{'all':!![]}];}return db[_0xb292('0x2c')][_0xb292('0x43')](_0x2fc66d);})[_0xb292('0x24')](function(_0x27a455){_0x2c231e[_0xb292('0x44')]=_0x27a455;return _0x2c231e;})['then'](respondWithFilteredResult(_0x5bd3af,_0x2fc66d))[_0xb292('0x45')](handleError(_0x5bd3af,null));};exports[_0xb292('0x46')]=function(_0x4d9ccd,_0x2534f1){var _0x3308e0={'raw':![],'where':{'id':_0x4d9ccd[_0xb292('0x47')]['id']}},_0x5cbed4={};_0x5cbed4[_0xb292('0x30')]=_[_0xb292('0x31')](db[_0xb292('0x2c')][_0xb292('0x2d')]);_0x5cbed4[_0xb292('0x32')]=_['keys'](_0x4d9ccd[_0xb292('0x32')]);_0x5cbed4[_0xb292('0x33')]=_[_0xb292('0x34')](_0x5cbed4[_0xb292('0x30')],_0x5cbed4[_0xb292('0x32')]);_0x3308e0['attributes']=_[_0xb292('0x34')](_0x5cbed4[_0xb292('0x30')],qs[_0xb292('0x36')](_0x4d9ccd['query'][_0xb292('0x36')]));_0x3308e0[_0xb292('0x35')]=_0x3308e0[_0xb292('0x35')][_0xb292('0x37')]?_0x3308e0[_0xb292('0x35')]:_0x5cbed4[_0xb292('0x30')];if(_0x4d9ccd[_0xb292('0x32')][_0xb292('0x48')]){_0x3308e0[_0xb292('0x42')]=[{'all':!![]}];}_0x3308e0=_[_0xb292('0x3f')]({},_0x3308e0,_0x4d9ccd[_0xb292('0x49')]);return db[_0xb292('0x2c')]['find'](_0x3308e0)['then'](handleEntityNotFound(_0x2534f1,null))[_0xb292('0x24')](respondWithResult(_0x2534f1,null))[_0xb292('0x45')](handleError(_0x2534f1,null));};exports['create']=function(_0x12c1cf,_0x13da99){return db[_0xb292('0x2c')][_0xb292('0x4a')](_0x12c1cf[_0xb292('0x4b')],{})[_0xb292('0x24')](respondWithResult(_0x13da99,0xc9))[_0xb292('0x45')](handleError(_0x13da99,null));};exports[_0xb292('0x4c')]=function(_0x2e92f6,_0x35aaae){if(_0x2e92f6[_0xb292('0x4b')]['id']){delete _0x2e92f6['body']['id'];}return db[_0xb292('0x2c')]['find']({'where':{'id':_0x2e92f6['params']['id']}})[_0xb292('0x24')](handleEntityNotFound(_0x35aaae,null))[_0xb292('0x24')](saveUpdates(_0x2e92f6['body'],null))['then'](respondWithResult(_0x35aaae,null))[_0xb292('0x45')](handleError(_0x35aaae,null));};exports['destroy']=function(_0x2d494c,_0x351cd8){return db['FreshdeskAccount'][_0xb292('0x4d')]({'where':{'id':_0x2d494c[_0xb292('0x47')]['id']}})[_0xb292('0x24')](handleEntityNotFound(_0x351cd8,null))['then'](removeEntity(_0x351cd8,null))[_0xb292('0x45')](handleError(_0x351cd8,null));};exports[_0xb292('0x4e')]=function(_0xb5c34,_0x3ed8f1,_0x2da3fc){var _0x37c820={};var _0x2ce5a1={};var _0x16613b;var _0x39b4a4;return db[_0xb292('0x2c')]['findOne']({'where':{'id':_0xb5c34[_0xb292('0x47')]['id']}})['then'](handleEntityNotFound(_0x3ed8f1,null))[_0xb292('0x24')](function(_0x36fd26){if(_0x36fd26){_0x16613b=_0x36fd26;_0x2ce5a1['model']=_[_0xb292('0x31')](db[_0xb292('0x4f')][_0xb292('0x2d')]);_0x2ce5a1[_0xb292('0x32')]=_[_0xb292('0x31')](_0xb5c34[_0xb292('0x32')]);_0x2ce5a1[_0xb292('0x33')]=_[_0xb292('0x34')](_0x2ce5a1[_0xb292('0x30')],_0x2ce5a1[_0xb292('0x32')]);_0x37c820[_0xb292('0x35')]=_['intersection'](_0x2ce5a1[_0xb292('0x30')],qs[_0xb292('0x36')](_0xb5c34[_0xb292('0x32')][_0xb292('0x36')]));_0x37c820[_0xb292('0x35')]=_0x37c820[_0xb292('0x35')][_0xb292('0x37')]?_0x37c820[_0xb292('0x35')]:_0x2ce5a1[_0xb292('0x30')];_0x37c820[_0xb292('0x3a')]=qs[_0xb292('0x3b')](_0xb5c34[_0xb292('0x32')][_0xb292('0x3b')]);_0x37c820[_0xb292('0x3c')]=qs['filters'](_[_0xb292('0x3d')](_0xb5c34[_0xb292('0x32')],_0x2ce5a1[_0xb292('0x33')]));if(_0xb5c34[_0xb292('0x32')][_0xb292('0x3e')]){_0x37c820[_0xb292('0x3c')]=_[_0xb292('0x3f')](_0x37c820['where'],{'$or':_[_0xb292('0x2b')](_0x37c820[_0xb292('0x35')],function(_0x53940c){var _0x2a0e41={};_0x2a0e41[_0x53940c]={'$like':'%'+_0xb5c34[_0xb292('0x32')]['filter']+'%'};return _0x2a0e41;})});}_0x37c820=_[_0xb292('0x3f')]({},_0x37c820,_0xb5c34['options']);return _0x16613b[_0xb292('0x4e')](_0x37c820);}})['then'](function(_0x1ad750){if(_0x1ad750){_0x39b4a4=_0x1ad750[_0xb292('0x37')];if(!_0xb5c34[_0xb292('0x32')][_0xb292('0x38')](_0xb292('0x39'))){_0x37c820['limit']=qs[_0xb292('0x1e')](_0xb5c34[_0xb292('0x32')][_0xb292('0x1e')]);_0x37c820['offset']=qs[_0xb292('0x1c')](_0xb5c34['query']['offset']);}return _0x16613b['getConfigurations'](_0x37c820);}})['then'](function(_0x553e36){if(_0x553e36){return _0x553e36?{'count':_0x39b4a4,'rows':_0x553e36}:null;}})[_0xb292('0x24')](respondWithResult(_0x3ed8f1,null))[_0xb292('0x45')](handleError(_0x3ed8f1,null));};exports[_0xb292('0x50')]=function(_0x1a53c5,_0x557f93,_0x50b44c){if(_0x1a53c5[_0xb292('0x4b')]['id']){delete _0x1a53c5[_0xb292('0x4b')]['id'];}return db[_0xb292('0x2c')][_0xb292('0x51')]({'where':{'id':_0x1a53c5[_0xb292('0x47')]['id']}})[_0xb292('0x24')](handleEntityNotFound(_0x557f93,null))[_0xb292('0x24')](function(_0x345b88){if(_0x345b88){_0x1a53c5[_0xb292('0x4b')][_0xb292('0x52')]=_0x345b88['id'];_0x1a53c5['body']['Subjects']=integrations[_0xb292('0x53')](_0x1a53c5[_0xb292('0x4b')]['channel'],_0x1a53c5[_0xb292('0x4b')][_0xb292('0x40')]);_0x1a53c5['body'][_0xb292('0x54')]=integrations[_0xb292('0x55')](_0x1a53c5[_0xb292('0x4b')]['channel'],_0x1a53c5[_0xb292('0x4b')][_0xb292('0x40')]);return db[_0xb292('0x4f')][_0xb292('0x4a')](_0x1a53c5['body'],{'include':[{'model':db[_0xb292('0x56')],'as':'Subjects'},{'model':db[_0xb292('0x56')],'as':'Descriptions'}]});}return null;})[_0xb292('0x24')](respondWithResult(_0x557f93,null))[_0xb292('0x45')](handleError(_0x557f93,null));};exports['getFields']=function(_0x435f57,_0x5c15d0,_0x3804e0){var _0x261d49='';return db[_0xb292('0x2c')][_0xb292('0x51')]({'where':{'id':_0x435f57[_0xb292('0x47')]['id']},'attributes':['id',_0xb292('0x57'),_0xb292('0x58')]})[_0xb292('0x24')](handleEntityNotFound(_0x5c15d0,null))[_0xb292('0x24')](function(_0x216a2c){if(_0x216a2c){_0x261d49=_0x216a2c[_0xb292('0x57')];var _0x5b48f3=_0x261d49['slice'](-0x1);if(_0x5b48f3==='/'){_0x261d49=_0x261d49['substring'](0x0,_0x261d49[_0xb292('0x59')](_0x5b48f3));}return rp({'method':_0xb292('0x5a'),'uri':util['format'](_0xb292('0x5b'),_0x261d49,_0xb292('0x5c')),'headers':{'Authorization':util[_0xb292('0x5d')](_0xb292('0x5e'),new Buffer(util[_0xb292('0x5d')](_0xb292('0x5f'),_0x216a2c[_0xb292('0x58')]))[_0xb292('0x60')]('base64'))},'json':!![]});}})['then'](function(_0x3e5e8f){if(_0x3e5e8f){var _0x339c04=[_0xb292('0x61'),_0xb292('0x62'),'agent',_0xb292('0x63'),_0xb292('0x1a'),_0xb292('0x64'),_0xb292('0x65'),_0xb292('0x66'),_0xb292('0x67'),_0xb292('0x65'),'company'];_[_0xb292('0x68')](_0x3e5e8f,function(_0x8e341){return _0x339c04[_0xb292('0x69')](_0x8e341['name'])||!_0x8e341[_0xb292('0x6a')]&&_0x8e341[_0xb292('0x40')]!==_0xb292('0x6b')&&_0x8e341[_0xb292('0x40')]!==_0xb292('0x6c');});return{'count':_0x3e5e8f[_0xb292('0x37')],'rows':_[_0xb292('0x2b')](_0x3e5e8f,function(_0x284a00){return{'id':_0x284a00[_0xb292('0x28')],'name':_0x284a00['label'],'custom':!_0x284a00[_0xb292('0x6a')],'options':_0x284a00[_0xb292('0x6d')]?_[_0xb292('0x2b')](_0x284a00[_0xb292('0x6d')],function(_0x56553b){return{'name':_[_0xb292('0x6e')](_0x56553b),'value':_0x56553b};}):[]};})};}})[_0xb292('0x24')](respondWithResult(_0x5c15d0,null))['catch'](function(_0x29b930){var _0x532f8d=_0x435f57[_0xb292('0x32')][_0xb292('0x6f')]?0x1f4:_0x29b930[_0xb292('0x70')]||0x1f4;logger[_0xb292('0x71')](_0xb292('0x72'),'getFields',_0x532f8d,JSON[_0xb292('0x73')](_0x29b930));delete _0x29b930[_0xb292('0x28')];if(_0x532f8d===0x191){_0x532f8d=0x190;}_0x5c15d0[_0xb292('0x1a')](_0x532f8d)['send'](_0x435f57[_0xb292('0x32')][_0xb292('0x6f')]?{'message':_0xb292('0x74'),'statusCode':_0x29b930[_0xb292('0x70')]}:_0x29b930);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 041af6e..efe87be 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 _0xf3a5=['exports','FreshdeskAccount','int_freshdesk_accounts','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskAccount.attributes'];(function(_0x4ec524,_0x15b5c0){var _0x3f72a0=function(_0x1e5410){while(--_0x1e5410){_0x4ec524['push'](_0x4ec524['shift']());}};_0x3f72a0(++_0x15b5c0);}(_0xf3a5,0xea));var _0x5f3a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf3a5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x5f3a('0x0'));var logger=require(_0x5f3a('0x1'))(_0x5f3a('0x2'));var moment=require('moment');var BPromise=require(_0x5f3a('0x3'));var rp=require(_0x5f3a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5f3a('0x5'));var config=require(_0x5f3a('0x6'));var attributes=require(_0x5f3a('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x5f3a('0x8')]=function(_0x2430f5,_0x12bc57){return _0x2430f5['define'](_0x5f3a('0x9'),attributes,{'tableName':_0x5f3a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4a81=['../../config/environment','./intFreshdeskAccount.attributes','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','api','moment','path','rimraf'];(function(_0x3b0265,_0x54c4b6){var _0x4d6215=function(_0x431a45){while(--_0x431a45){_0x3b0265['push'](_0x3b0265['shift']());}};_0x4d6215(++_0x54c4b6);}(_0x4a81,0x1c0));var _0x14a8=function(_0x571827,_0x3ee620){_0x571827=_0x571827-0x0;var _0x5d56ed=_0x4a81[_0x571827];return _0x5d56ed;};'use strict';var _=require(_0x14a8('0x0'));var util=require(_0x14a8('0x1'));var logger=require(_0x14a8('0x2'))(_0x14a8('0x3'));var moment=require(_0x14a8('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x14a8('0x5'));var rimraf=require(_0x14a8('0x6'));var config=require(_0x14a8('0x7'));var attributes=require(_0x14a8('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x14a8('0x9')]=function(_0x1e4fde,_0x3c5a2e){return _0x1e4fde[_0x14a8('0xa')](_0x14a8('0xb'),attributes,{'tableName':_0x14a8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index dc393b8..d4a6616 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 _0xa7eb=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','attributes','limit','include','map','model','debug','ShowFreshdeskAccount','where','lodash','util','moment','randomstring'];(function(_0xbfcb9a,_0x4f1bcc){var _0xc0697b=function(_0x16ea99){while(--_0x16ea99){_0xbfcb9a['push'](_0xbfcb9a['shift']());}};_0xc0697b(++_0x4f1bcc);}(_0xa7eb,0x1b6));var _0xba7e=function(_0x451078,_0xc12bf){_0x451078=_0x451078-0x0;var _0x5336e2=_0xa7eb[_0x451078];return _0x5336e2;};'use strict';var _=require(_0xba7e('0x0'));var util=require(_0xba7e('0x1'));var moment=require(_0xba7e('0x2'));var BPromise=require('bluebird');var rs=require(_0xba7e('0x3'));var fs=require('fs');var Redis=require(_0xba7e('0x4'));var db=require(_0xba7e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xba7e('0x6'))(_0xba7e('0x7'));var config=require(_0xba7e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xba7e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x244db9,_0x234bbe,_0x1072fa){return new BPromise(function(_0x4d9ce3,_0x36edf9){return client[_0xba7e('0xa')](_0x244db9,_0x1072fa)[_0xba7e('0xb')](function(_0x5c9fc0){logger[_0xba7e('0xc')](_0xba7e('0xd'),_0x234bbe,_0xba7e('0xe'));logger['debug'](_0xba7e('0xf'),_0x234bbe,_0xba7e('0xe'),JSON[_0xba7e('0x10')](_0x5c9fc0));if(_0x5c9fc0['error']){if(_0x5c9fc0[_0xba7e('0x11')]['code']===0x1f4){logger['error'](_0xba7e('0xd'),_0x234bbe,_0x5c9fc0[_0xba7e('0x11')][_0xba7e('0x12')]);return _0x36edf9(_0x5c9fc0[_0xba7e('0x11')][_0xba7e('0x12')]);}logger[_0xba7e('0x11')]('FreshdeskAccount,\x20%s,\x20%s',_0x234bbe,_0x5c9fc0[_0xba7e('0x11')][_0xba7e('0x12')]);return _0x4d9ce3(_0x5c9fc0[_0xba7e('0x11')][_0xba7e('0x12')]);}else{logger['info'](_0xba7e('0xd'),_0x234bbe,'request\x20sent');_0x4d9ce3(_0x5c9fc0[_0xba7e('0x13')][_0xba7e('0x12')]);}})[_0xba7e('0x14')](function(_0x28e298){logger[_0xba7e('0x11')]('FreshdeskAccount,\x20%s,\x20%s',_0x234bbe,_0x28e298);_0x36edf9(_0x28e298);});});}exports[_0xba7e('0x15')]=function(_0x142b2a){var _0x58a511=this;return new Promise(function(_0x2525bb,_0xf42a40){return db[_0xba7e('0x16')][_0xba7e('0x17')]({'raw':_0x142b2a[_0xba7e('0x18')]?_0x142b2a[_0xba7e('0x18')][_0xba7e('0x19')]===undefined?!![]:![]:!![],'where':_0x142b2a[_0xba7e('0x18')]?_0x142b2a['options']['where']||null:null,'attributes':_0x142b2a[_0xba7e('0x18')]?_0x142b2a[_0xba7e('0x18')][_0xba7e('0x1a')]||null:null,'limit':_0x142b2a[_0xba7e('0x18')]?_0x142b2a[_0xba7e('0x18')][_0xba7e('0x1b')]||null:null,'include':_0x142b2a['options']?_0x142b2a[_0xba7e('0x18')][_0xba7e('0x1c')]?_[_0xba7e('0x1d')](_0x142b2a[_0xba7e('0x18')][_0xba7e('0x1c')],function(_0x3c1682){return{'model':db[_0x3c1682[_0xba7e('0x1e')]],'as':_0x3c1682['as'],'attributes':_0x3c1682['attributes'],'include':_0x3c1682[_0xba7e('0x1c')]?_['map'](_0x3c1682[_0xba7e('0x1c')],function(_0x5156d7){return{'model':db[_0x5156d7['model']],'as':_0x5156d7['as'],'attributes':_0x5156d7[_0xba7e('0x1a')],'include':_0x5156d7[_0xba7e('0x1c')]?_[_0xba7e('0x1d')](_0x5156d7[_0xba7e('0x1c')],function(_0x3dee82){return{'model':db[_0x3dee82[_0xba7e('0x1e')]],'as':_0x3dee82['as'],'attributes':_0x3dee82[_0xba7e('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xba7e('0xb')](function(_0xbb691a){logger[_0xba7e('0xc')]('GetFreshdeskAccount',_0x142b2a);logger[_0xba7e('0x1f')](_0xba7e('0x15'),_0x142b2a,JSON['stringify'](_0xbb691a));_0x2525bb(_0xbb691a);})[_0xba7e('0x14')](function(_0xe1f4ff){logger[_0xba7e('0x11')]('GetFreshdeskAccount',_0xe1f4ff[_0xba7e('0x12')],_0x142b2a);_0xf42a40(_0x58a511['error'](0x1f4,_0xe1f4ff[_0xba7e('0x12')]));});});};exports[_0xba7e('0x20')]=function(_0x439881){var _0x9ecc34=this;return new Promise(function(_0x53bf78,_0x408a13){return db[_0xba7e('0x16')]['find']({'raw':_0x439881['options']?_0x439881[_0xba7e('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x439881[_0xba7e('0x18')]?_0x439881['options'][_0xba7e('0x21')]||null:null,'attributes':_0x439881[_0xba7e('0x18')]?_0x439881['options'][_0xba7e('0x1a')]||null:null,'include':_0x439881[_0xba7e('0x18')]?_0x439881[_0xba7e('0x18')][_0xba7e('0x1c')]?_[_0xba7e('0x1d')](_0x439881[_0xba7e('0x18')]['include'],function(_0x2a7585){return{'model':db[_0x2a7585[_0xba7e('0x1e')]],'as':_0x2a7585['as'],'attributes':_0x2a7585[_0xba7e('0x1a')],'include':_0x2a7585['include']?_[_0xba7e('0x1d')](_0x2a7585[_0xba7e('0x1c')],function(_0x2d321c){return{'model':db[_0x2d321c['model']],'as':_0x2d321c['as'],'attributes':_0x2d321c['attributes'],'include':_0x2d321c[_0xba7e('0x1c')]?_[_0xba7e('0x1d')](_0x2d321c[_0xba7e('0x1c')],function(_0x14efe3){return{'model':db[_0x14efe3[_0xba7e('0x1e')]],'as':_0x14efe3['as'],'attributes':_0x14efe3[_0xba7e('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xba7e('0xb')](function(_0x49e815){logger[_0xba7e('0xc')]('ShowFreshdeskAccount',_0x439881);logger[_0xba7e('0x1f')](_0xba7e('0x20'),_0x439881,JSON['stringify'](_0x49e815));_0x53bf78(_0x49e815);})[_0xba7e('0x14')](function(_0x508975){logger[_0xba7e('0x11')](_0xba7e('0x20'),_0x508975['message'],_0x439881);_0x408a13(_0x9ecc34['error'](0x1f4,_0x508975[_0xba7e('0x12')]));});});}; \ No newline at end of file +var _0xb2a7=['raw','include','map','model','attributes','ShowFreshdeskAccount','FreshdeskAccount','where','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetFreshdeskAccount','findAll','options'];(function(_0x51c52b,_0x147712){var _0x581ce3=function(_0x2e61a0){while(--_0x2e61a0){_0x51c52b['push'](_0x51c52b['shift']());}};_0x581ce3(++_0x147712);}(_0xb2a7,0xe8));var _0x7b2a=function(_0xdca351,_0x367d1a){_0xdca351=_0xdca351-0x0;var _0x20da96=_0xb2a7[_0xdca351];return _0x20da96;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7b2a('0x0'));var BPromise=require(_0x7b2a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7b2a('0x2'));var db=require(_0x7b2a('0x3'))['db'];var utils=require(_0x7b2a('0x4'));var logger=require(_0x7b2a('0x5'))('rpc');var config=require(_0x7b2a('0x6'));var jayson=require(_0x7b2a('0x7'));var client=jayson[_0x7b2a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2de1ad,_0x4490e2,_0x458f3a){return new BPromise(function(_0x4be2b9,_0x2e3fa8){return client[_0x7b2a('0x9')](_0x2de1ad,_0x458f3a)[_0x7b2a('0xa')](function(_0x164d01){logger[_0x7b2a('0xb')](_0x7b2a('0xc'),_0x4490e2,_0x7b2a('0xd'));logger[_0x7b2a('0xe')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x4490e2,_0x7b2a('0xd'),JSON[_0x7b2a('0xf')](_0x164d01));if(_0x164d01[_0x7b2a('0x10')]){if(_0x164d01[_0x7b2a('0x10')][_0x7b2a('0x11')]===0x1f4){logger[_0x7b2a('0x10')](_0x7b2a('0xc'),_0x4490e2,_0x164d01[_0x7b2a('0x10')]['message']);return _0x2e3fa8(_0x164d01[_0x7b2a('0x10')]['message']);}logger[_0x7b2a('0x10')](_0x7b2a('0xc'),_0x4490e2,_0x164d01[_0x7b2a('0x10')]['message']);return _0x4be2b9(_0x164d01[_0x7b2a('0x10')][_0x7b2a('0x12')]);}else{logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x4490e2,_0x7b2a('0xd'));_0x4be2b9(_0x164d01[_0x7b2a('0x13')]['message']);}})[_0x7b2a('0x14')](function(_0x50604e){logger[_0x7b2a('0x10')]('FreshdeskAccount,\x20%s,\x20%s',_0x4490e2,_0x50604e);_0x2e3fa8(_0x50604e);});});}exports[_0x7b2a('0x15')]=function(_0x5b30ae){var _0xb83a6a=this;return new Promise(function(_0xf697f8,_0x2575b2){return db['FreshdeskAccount'][_0x7b2a('0x16')]({'raw':_0x5b30ae['options']?_0x5b30ae[_0x7b2a('0x17')][_0x7b2a('0x18')]===undefined?!![]:![]:!![],'where':_0x5b30ae[_0x7b2a('0x17')]?_0x5b30ae[_0x7b2a('0x17')]['where']||null:null,'attributes':_0x5b30ae[_0x7b2a('0x17')]?_0x5b30ae['options']['attributes']||null:null,'limit':_0x5b30ae['options']?_0x5b30ae['options']['limit']||null:null,'include':_0x5b30ae[_0x7b2a('0x17')]?_0x5b30ae[_0x7b2a('0x17')][_0x7b2a('0x19')]?_[_0x7b2a('0x1a')](_0x5b30ae[_0x7b2a('0x17')][_0x7b2a('0x19')],function(_0x3e1d6f){return{'model':db[_0x3e1d6f[_0x7b2a('0x1b')]],'as':_0x3e1d6f['as'],'attributes':_0x3e1d6f[_0x7b2a('0x1c')],'include':_0x3e1d6f[_0x7b2a('0x19')]?_['map'](_0x3e1d6f[_0x7b2a('0x19')],function(_0x33a091){return{'model':db[_0x33a091[_0x7b2a('0x1b')]],'as':_0x33a091['as'],'attributes':_0x33a091['attributes'],'include':_0x33a091[_0x7b2a('0x19')]?_[_0x7b2a('0x1a')](_0x33a091[_0x7b2a('0x19')],function(_0xb956c){return{'model':db[_0xb956c[_0x7b2a('0x1b')]],'as':_0xb956c['as'],'attributes':_0xb956c['attributes']};}):[]};}):[]};}):[]:[]})[_0x7b2a('0xa')](function(_0x49cbf8){logger['info'](_0x7b2a('0x15'),_0x5b30ae);logger[_0x7b2a('0xe')]('GetFreshdeskAccount',_0x5b30ae,JSON[_0x7b2a('0xf')](_0x49cbf8));_0xf697f8(_0x49cbf8);})['catch'](function(_0x2e47ce){logger[_0x7b2a('0x10')](_0x7b2a('0x15'),_0x2e47ce['message'],_0x5b30ae);_0x2575b2(_0xb83a6a[_0x7b2a('0x10')](0x1f4,_0x2e47ce['message']));});});};exports[_0x7b2a('0x1d')]=function(_0x422aab){var _0x262a22=this;return new Promise(function(_0x28d22a,_0x58c652){return db[_0x7b2a('0x1e')]['find']({'raw':_0x422aab[_0x7b2a('0x17')]?_0x422aab[_0x7b2a('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x422aab[_0x7b2a('0x17')]?_0x422aab[_0x7b2a('0x17')][_0x7b2a('0x1f')]||null:null,'attributes':_0x422aab[_0x7b2a('0x17')]?_0x422aab[_0x7b2a('0x17')]['attributes']||null:null,'include':_0x422aab['options']?_0x422aab['options'][_0x7b2a('0x19')]?_[_0x7b2a('0x1a')](_0x422aab[_0x7b2a('0x17')]['include'],function(_0x37f860){return{'model':db[_0x37f860[_0x7b2a('0x1b')]],'as':_0x37f860['as'],'attributes':_0x37f860['attributes'],'include':_0x37f860['include']?_['map'](_0x37f860[_0x7b2a('0x19')],function(_0x3b023e){return{'model':db[_0x3b023e[_0x7b2a('0x1b')]],'as':_0x3b023e['as'],'attributes':_0x3b023e[_0x7b2a('0x1c')],'include':_0x3b023e[_0x7b2a('0x19')]?_['map'](_0x3b023e[_0x7b2a('0x19')],function(_0x5b1f72){return{'model':db[_0x5b1f72[_0x7b2a('0x1b')]],'as':_0x5b1f72['as'],'attributes':_0x5b1f72['attributes']};}):[]};}):[]};}):[]:[]})[_0x7b2a('0xa')](function(_0x1d9de9){logger[_0x7b2a('0xb')]('ShowFreshdeskAccount',_0x422aab);logger['debug'](_0x7b2a('0x1d'),_0x422aab,JSON['stringify'](_0x1d9de9));_0x28d22a(_0x1d9de9);})[_0x7b2a('0x14')](function(_0x1b274d){logger[_0x7b2a('0x10')]('ShowFreshdeskAccount',_0x1b274d[_0x7b2a('0x12')],_0x422aab);_0x58c652(_0x262a22[_0x7b2a('0x10')](0x1f4,_0x1b274d[_0x7b2a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index cba62bd..381f4d3 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 _0x2143=['setTags','update','delete','destroy','exports','util','path','express','Router','fs-extra','isAuthenticated','index','get','/:id','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags'];(function(_0x3c6ee1,_0x2795c2){var _0x1ac4ec=function(_0x3e8eab){while(--_0x3e8eab){_0x3c6ee1['push'](_0x3c6ee1['shift']());}};_0x1ac4ec(++_0x2795c2);}(_0x2143,0x1e8));var _0x3214=function(_0x56d1f3,_0x530a88){_0x56d1f3=_0x56d1f3-0x0;var _0x5b4e4f=_0x2143[_0x56d1f3];return _0x5b4e4f;};'use strict';var multer=require('multer');var util=require(_0x3214('0x0'));var path=require(_0x3214('0x1'));var timeout=require('connect-timeout');var express=require(_0x3214('0x2'));var router=express[_0x3214('0x3')]();var fs_extra=require(_0x3214('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intFreshdeskConfiguration.controller');router['get']('/',auth[_0x3214('0x5')](),controller[_0x3214('0x6')]);router[_0x3214('0x7')](_0x3214('0x8'),auth[_0x3214('0x5')](),controller['show']);router[_0x3214('0x7')](_0x3214('0x9'),auth[_0x3214('0x5')](),controller[_0x3214('0xa')]);router[_0x3214('0x7')]('/:id/subjects',auth[_0x3214('0x5')](),controller[_0x3214('0xb')]);router[_0x3214('0x7')](_0x3214('0xc'),auth[_0x3214('0x5')](),controller[_0x3214('0xd')]);router['get']('/:id/tags',auth['isAuthenticated'](),controller[_0x3214('0xe')]);router[_0x3214('0xf')]('/',auth[_0x3214('0x5')](),controller[_0x3214('0x10')]);router[_0x3214('0xf')](_0x3214('0x11'),auth[_0x3214('0x5')](),controller[_0x3214('0x12')]);router['put'](_0x3214('0x8'),auth[_0x3214('0x5')](),controller[_0x3214('0x13')]);router[_0x3214('0x14')](_0x3214('0x8'),auth[_0x3214('0x5')](),controller[_0x3214('0x15')]);module[_0x3214('0x16')]=router; \ No newline at end of file +var _0xcaa8=['getFields','getDescriptions','/:id/tags','getTags','post','create','setTags','/:id','update','delete','destroy','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields'];(function(_0x5b8a3b,_0x5f1e06){var _0x586e61=function(_0x2da91f){while(--_0x2da91f){_0x5b8a3b['push'](_0x5b8a3b['shift']());}};_0x586e61(++_0x5f1e06);}(_0xcaa8,0x1d3));var _0x8caa=function(_0x31ca46,_0x1aaabd){_0x31ca46=_0x31ca46-0x0;var _0x46d55d=_0xcaa8[_0x31ca46];return _0x46d55d;};'use strict';var multer=require('multer');var util=require(_0x8caa('0x0'));var path=require(_0x8caa('0x1'));var timeout=require('connect-timeout');var express=require(_0x8caa('0x2'));var router=express[_0x8caa('0x3')]();var fs_extra=require(_0x8caa('0x4'));var auth=require(_0x8caa('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8caa('0x6'));var controller=require(_0x8caa('0x7'));router[_0x8caa('0x8')]('/',auth[_0x8caa('0x9')](),controller[_0x8caa('0xa')]);router[_0x8caa('0x8')]('/:id',auth[_0x8caa('0x9')](),controller[_0x8caa('0xb')]);router['get'](_0x8caa('0xc'),auth[_0x8caa('0x9')](),controller[_0x8caa('0xd')]);router['get']('/:id/subjects',auth[_0x8caa('0x9')](),controller['getSubjects']);router[_0x8caa('0x8')]('/:id/descriptions',auth[_0x8caa('0x9')](),controller[_0x8caa('0xe')]);router[_0x8caa('0x8')](_0x8caa('0xf'),auth[_0x8caa('0x9')](),controller[_0x8caa('0x10')]);router[_0x8caa('0x11')]('/',auth['isAuthenticated'](),controller[_0x8caa('0x12')]);router[_0x8caa('0x11')](_0x8caa('0xf'),auth[_0x8caa('0x9')](),controller[_0x8caa('0x13')]);router['put'](_0x8caa('0x14'),auth['isAuthenticated'](),controller[_0x8caa('0x15')]);router[_0x8caa('0x16')](_0x8caa('0x14'),auth[_0x8caa('0x9')](),controller[_0x8caa('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 1990048..a7e1434 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 _0xa143=['exports','STRING','sequelize'];(function(_0x56cf62,_0x1d69a3){var _0x523526=function(_0x527edc){while(--_0x527edc){_0x56cf62['push'](_0x56cf62['shift']());}};_0x523526(++_0x1d69a3);}(_0xa143,0x143));var _0x3a14=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa143[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x3a14('0x0'));module[_0x3a14('0x1')]={'name':{'type':Sequelize[_0x3a14('0x2')]},'description':{'type':Sequelize[_0x3a14('0x2')]}}; \ No newline at end of file +var _0x8559=['sequelize','exports','STRING'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0x8559,0x1b6));var _0x9855=function(_0x44c477,_0x3a0a07){_0x44c477=_0x44c477-0x0;var _0x5dba37=_0x8559[_0x44c477];return _0x5dba37;};'use strict';var Sequelize=require(_0x9855('0x0'));module[_0x9855('0x1')]={'name':{'type':Sequelize[_0x9855('0x2')]},'description':{'type':Sequelize[_0x9855('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index eb4fa11..abc68b6 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 _0x9077=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','end','error','stack','send','index','FreshdeskConfiguration','rawAttributes','type','key','model','map','name','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','merge','options','includeAll','findAll','rows','catch','params','include','find','create','body','destroy','getFields','FreshdeskField','order','pick','hasOwnProperty','getSubjects','findOne','getDescriptions','getTags','setTags','ids','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','squel','crypto','querystring','papaparse','ioredis'];(function(_0x4fc1e3,_0x52f995){var _0x1ce4e4=function(_0x27e2b0){while(--_0x27e2b0){_0x4fc1e3['push'](_0x4fc1e3['shift']());}};_0x1ce4e4(++_0x52f995);}(_0x9077,0x94));var _0x7907=function(_0x73a84b,_0x23d3bb){_0x73a84b=_0x73a84b-0x0;var _0x9e2a66=_0x9077[_0x73a84b];return _0x9e2a66;};'use strict';var emlformat=require(_0x7907('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7907('0x1'));var jsonpatch=require(_0x7907('0x2'));var rp=require(_0x7907('0x3'));var moment=require(_0x7907('0x4'));var BPromise=require(_0x7907('0x5'));var Mustache=require(_0x7907('0x6'));var util=require('util');var path=require(_0x7907('0x7'));var sox=require(_0x7907('0x8'));var csv=require(_0x7907('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7907('0xa'));var _=require('lodash');var squel=require(_0x7907('0xb'));var crypto=require(_0x7907('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7907('0x9'));var querystring=require(_0x7907('0xd'));var Papa=require(_0x7907('0xe'));var Redis=require(_0x7907('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x7907('0x10'));var as=require(_0x7907('0x11'));var hardwareService=require(_0x7907('0x12'));var logger=require('../../config/logger')(_0x7907('0x13'));var utils=require('../../config/utils');var config=require(_0x7907('0x14'));var licenseUtil=require(_0x7907('0x15'));var db=require(_0x7907('0x16'))['db'];function respondWithStatusCode(_0x130d84,_0x41dd4b){_0x41dd4b=_0x41dd4b||0xcc;return function(_0x972448){if(_0x972448){return _0x130d84[_0x7907('0x17')](_0x41dd4b);}return _0x130d84['status'](_0x41dd4b)['end']();};}function respondWithResult(_0x573c8f,_0x3e4187){_0x3e4187=_0x3e4187||0xc8;return function(_0x4adcf3){if(_0x4adcf3){return _0x573c8f[_0x7907('0x18')](_0x3e4187)[_0x7907('0x19')](_0x4adcf3);}};}function respondWithFilteredResult(_0x3f12f8,_0x26629f){return function(_0x486176){if(_0x486176){var _0x2bac10=typeof _0x26629f[_0x7907('0x1a')]===_0x7907('0x1b')&&typeof _0x26629f[_0x7907('0x1c')]===_0x7907('0x1b');var _0x28f0aa=_0x486176[_0x7907('0x1d')];var _0x50f5b0=_0x2bac10?0x0:_0x26629f[_0x7907('0x1a')];var _0x783df2=_0x2bac10?_0x486176['count']:_0x26629f['offset']+_0x26629f[_0x7907('0x1c')];var _0x6dd372;if(_0x783df2>=_0x28f0aa){_0x783df2=_0x28f0aa;_0x6dd372=0xc8;}else{_0x6dd372=0xce;}_0x3f12f8[_0x7907('0x18')](_0x6dd372);return _0x3f12f8[_0x7907('0x1e')](_0x7907('0x1f'),_0x50f5b0+'-'+_0x783df2+'/'+_0x28f0aa)[_0x7907('0x19')](_0x486176);}return null;};}function patchUpdates(_0xb00ce9){return function(_0xf28914){try{jsonpatch[_0x7907('0x20')](_0xf28914,_0xb00ce9,!![]);}catch(_0x5dca7e){return BPromise[_0x7907('0x21')](_0x5dca7e);}return _0xf28914['save']();};}function saveUpdates(_0x2c7b1a,_0x2ce9fb){return function(_0x536746){if(_0x536746){return _0x536746[_0x7907('0x22')](_0x2c7b1a)[_0x7907('0x23')](function(_0x4c325c){return _0x4c325c;});}return null;};}function removeEntity(_0x307cc0,_0x3b0273){return function(_0x5e27f8){if(_0x5e27f8){return _0x5e27f8['destroy']()[_0x7907('0x23')](function(){_0x307cc0[_0x7907('0x18')](0xcc)[_0x7907('0x24')]();});}};}function handleEntityNotFound(_0x48ba17,_0x18bf3a){return function(_0x1f764c){if(!_0x1f764c){_0x48ba17[_0x7907('0x17')](0x194);}return _0x1f764c;};}function handleError(_0x546513,_0x4c9094){_0x4c9094=_0x4c9094||0x1f4;return function(_0x4aa328){logger[_0x7907('0x25')](_0x4aa328[_0x7907('0x26')]);if(_0x4aa328['name']){delete _0x4aa328['name'];}_0x546513[_0x7907('0x18')](_0x4c9094)[_0x7907('0x27')](_0x4aa328);};}exports[_0x7907('0x28')]=function(_0x406739,_0x5a5ffa){var _0x233057={},_0x1305f0={},_0x579c1a={'count':0x0,'rows':[]};var _0xf0e4dd=_['map'](db[_0x7907('0x29')][_0x7907('0x2a')],function(_0x4cee71){return{'name':_0x4cee71['fieldName'],'type':_0x4cee71[_0x7907('0x2b')][_0x7907('0x2c')]};});_0x1305f0[_0x7907('0x2d')]=_[_0x7907('0x2e')](_0xf0e4dd,_0x7907('0x2f'));_0x1305f0[_0x7907('0x30')]=_[_0x7907('0x31')](_0x406739['query']);_0x1305f0[_0x7907('0x32')]=_[_0x7907('0x33')](_0x1305f0['model'],_0x1305f0[_0x7907('0x30')]);_0x233057[_0x7907('0x34')]=_[_0x7907('0x33')](_0x1305f0[_0x7907('0x2d')],qs[_0x7907('0x35')](_0x406739[_0x7907('0x30')]['fields']));_0x233057[_0x7907('0x34')]=_0x233057[_0x7907('0x34')][_0x7907('0x36')]?_0x233057[_0x7907('0x34')]:_0x1305f0['model'];if(!_0x406739[_0x7907('0x30')]['hasOwnProperty'](_0x7907('0x37'))){_0x233057['limit']=qs['limit'](_0x406739[_0x7907('0x30')]['limit']);_0x233057[_0x7907('0x1a')]=qs[_0x7907('0x1a')](_0x406739[_0x7907('0x30')][_0x7907('0x1a')]);}_0x233057['order']=qs[_0x7907('0x38')](_0x406739[_0x7907('0x30')][_0x7907('0x38')]);_0x233057[_0x7907('0x39')]=qs[_0x7907('0x32')](_['pick'](_0x406739['query'],_0x1305f0[_0x7907('0x32')]),_0xf0e4dd);if(_0x406739[_0x7907('0x30')][_0x7907('0x3a')]){_0x233057['where']=_[_0x7907('0x3b')](_0x233057[_0x7907('0x39')],{'$or':_['map'](_0xf0e4dd,function(_0x3b44fc){if(_0x3b44fc[_0x7907('0x2b')]!=='VIRTUAL'){var _0x5098b5={};_0x5098b5[_0x3b44fc[_0x7907('0x2f')]]={'$like':'%'+_0x406739[_0x7907('0x30')]['filter']+'%'};return _0x5098b5;}})});}_0x233057=_['merge']({},_0x233057,_0x406739[_0x7907('0x3c')]);var _0x58291f={'where':_0x233057[_0x7907('0x39')]};return db['FreshdeskConfiguration'][_0x7907('0x1d')](_0x58291f)['then'](function(_0x52e5fd){_0x579c1a[_0x7907('0x1d')]=_0x52e5fd;if(_0x406739[_0x7907('0x30')][_0x7907('0x3d')]){_0x233057['include']=[{'all':!![]}];}return db[_0x7907('0x29')][_0x7907('0x3e')](_0x233057);})[_0x7907('0x23')](function(_0x5f5533){_0x579c1a[_0x7907('0x3f')]=_0x5f5533;return _0x579c1a;})[_0x7907('0x23')](respondWithFilteredResult(_0x5a5ffa,_0x233057))[_0x7907('0x40')](handleError(_0x5a5ffa,null));};exports['show']=function(_0x36b457,_0x15ce31){var _0x22dfe6={'raw':![],'where':{'id':_0x36b457[_0x7907('0x41')]['id']}},_0x3c71b3={};_0x3c71b3['model']=_[_0x7907('0x31')](db[_0x7907('0x29')][_0x7907('0x2a')]);_0x3c71b3[_0x7907('0x30')]=_[_0x7907('0x31')](_0x36b457['query']);_0x3c71b3[_0x7907('0x32')]=_['intersection'](_0x3c71b3['model'],_0x3c71b3[_0x7907('0x30')]);_0x22dfe6[_0x7907('0x34')]=_[_0x7907('0x33')](_0x3c71b3[_0x7907('0x2d')],qs[_0x7907('0x35')](_0x36b457[_0x7907('0x30')][_0x7907('0x35')]));_0x22dfe6[_0x7907('0x34')]=_0x22dfe6[_0x7907('0x34')][_0x7907('0x36')]?_0x22dfe6[_0x7907('0x34')]:_0x3c71b3[_0x7907('0x2d')];if(_0x36b457[_0x7907('0x30')][_0x7907('0x3d')]){_0x22dfe6[_0x7907('0x42')]=[{'all':!![]}];}_0x22dfe6=_[_0x7907('0x3b')]({},_0x22dfe6,_0x36b457[_0x7907('0x3c')]);return db[_0x7907('0x29')][_0x7907('0x43')](_0x22dfe6)[_0x7907('0x23')](handleEntityNotFound(_0x15ce31,null))[_0x7907('0x23')](respondWithResult(_0x15ce31,null))[_0x7907('0x40')](handleError(_0x15ce31,null));};exports[_0x7907('0x44')]=function(_0x1b44c5,_0x4b7130){return db['FreshdeskConfiguration']['create'](_0x1b44c5[_0x7907('0x45')],{})[_0x7907('0x23')](respondWithResult(_0x4b7130,0xc9))[_0x7907('0x40')](handleError(_0x4b7130,null));};exports[_0x7907('0x22')]=function(_0x4ca53a,_0x30c34a){if(_0x4ca53a[_0x7907('0x45')]['id']){delete _0x4ca53a[_0x7907('0x45')]['id'];}return db[_0x7907('0x29')][_0x7907('0x43')]({'where':{'id':_0x4ca53a[_0x7907('0x41')]['id']}})['then'](handleEntityNotFound(_0x30c34a,null))[_0x7907('0x23')](saveUpdates(_0x4ca53a[_0x7907('0x45')],null))[_0x7907('0x23')](respondWithResult(_0x30c34a,null))[_0x7907('0x40')](handleError(_0x30c34a,null));};exports[_0x7907('0x46')]=function(_0x370a87,_0x48ab6a){return db[_0x7907('0x29')][_0x7907('0x43')]({'where':{'id':_0x370a87['params']['id']}})[_0x7907('0x23')](handleEntityNotFound(_0x48ab6a,null))[_0x7907('0x23')](removeEntity(_0x48ab6a,null))[_0x7907('0x40')](handleError(_0x48ab6a,null));};exports[_0x7907('0x47')]=function(_0x23fd61,_0x407ec1,_0x19165b){var _0x4ed3c8={};var _0x9380f3={};var _0x51bbec;var _0x24908d;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x23fd61[_0x7907('0x41')]['id']}})[_0x7907('0x23')](handleEntityNotFound(_0x407ec1,null))['then'](function(_0x54ef3a){if(_0x54ef3a){_0x51bbec=_0x54ef3a;_0x9380f3[_0x7907('0x2d')]=_[_0x7907('0x31')](db[_0x7907('0x48')]['rawAttributes']);_0x9380f3[_0x7907('0x30')]=_['keys'](_0x23fd61['query']);_0x9380f3['filters']=_['intersection'](_0x9380f3['model'],_0x9380f3[_0x7907('0x30')]);_0x4ed3c8[_0x7907('0x34')]=_['intersection'](_0x9380f3[_0x7907('0x2d')],qs['fields'](_0x23fd61['query'][_0x7907('0x35')]));_0x4ed3c8['attributes']=_0x4ed3c8['attributes'][_0x7907('0x36')]?_0x4ed3c8[_0x7907('0x34')]:_0x9380f3['model'];_0x4ed3c8[_0x7907('0x49')]=qs[_0x7907('0x38')](_0x23fd61['query'][_0x7907('0x38')]);_0x4ed3c8[_0x7907('0x39')]=qs[_0x7907('0x32')](_[_0x7907('0x4a')](_0x23fd61[_0x7907('0x30')],_0x9380f3[_0x7907('0x32')]));if(_0x23fd61[_0x7907('0x30')][_0x7907('0x3a')]){_0x4ed3c8[_0x7907('0x39')]=_[_0x7907('0x3b')](_0x4ed3c8[_0x7907('0x39')],{'$or':_[_0x7907('0x2e')](_0x4ed3c8[_0x7907('0x34')],function(_0x5730f0){var _0x11fb9a={};_0x11fb9a[_0x5730f0]={'$like':'%'+_0x23fd61['query'][_0x7907('0x3a')]+'%'};return _0x11fb9a;})});}_0x4ed3c8=_['merge']({},_0x4ed3c8,_0x23fd61[_0x7907('0x3c')]);return _0x51bbec[_0x7907('0x47')](_0x4ed3c8);}})[_0x7907('0x23')](function(_0x41ffff){if(_0x41ffff){_0x24908d=_0x41ffff[_0x7907('0x36')];if(!_0x23fd61[_0x7907('0x30')][_0x7907('0x4b')](_0x7907('0x37'))){_0x4ed3c8['limit']=qs[_0x7907('0x1c')](_0x23fd61['query'][_0x7907('0x1c')]);_0x4ed3c8[_0x7907('0x1a')]=qs[_0x7907('0x1a')](_0x23fd61['query']['offset']);}return _0x51bbec[_0x7907('0x47')](_0x4ed3c8);}})['then'](function(_0x111cfa){if(_0x111cfa){return _0x111cfa?{'count':_0x24908d,'rows':_0x111cfa}:null;}})[_0x7907('0x23')](respondWithResult(_0x407ec1,null))[_0x7907('0x40')](handleError(_0x407ec1,null));};exports[_0x7907('0x4c')]=function(_0x1b6756,_0x277cf9,_0x6d5929){var _0x40bfeb={};var _0xb2cb26={};var _0x3a5fcb;var _0x278f0c;return db[_0x7907('0x29')][_0x7907('0x4d')]({'where':{'id':_0x1b6756['params']['id']}})[_0x7907('0x23')](handleEntityNotFound(_0x277cf9,null))[_0x7907('0x23')](function(_0x22813a){if(_0x22813a){_0x3a5fcb=_0x22813a;_0xb2cb26[_0x7907('0x2d')]=_[_0x7907('0x31')](db[_0x7907('0x48')][_0x7907('0x2a')]);_0xb2cb26['query']=_[_0x7907('0x31')](_0x1b6756[_0x7907('0x30')]);_0xb2cb26[_0x7907('0x32')]=_[_0x7907('0x33')](_0xb2cb26[_0x7907('0x2d')],_0xb2cb26[_0x7907('0x30')]);_0x40bfeb['attributes']=_['intersection'](_0xb2cb26['model'],qs[_0x7907('0x35')](_0x1b6756[_0x7907('0x30')][_0x7907('0x35')]));_0x40bfeb['attributes']=_0x40bfeb[_0x7907('0x34')]['length']?_0x40bfeb[_0x7907('0x34')]:_0xb2cb26[_0x7907('0x2d')];_0x40bfeb['order']=qs['sort'](_0x1b6756[_0x7907('0x30')][_0x7907('0x38')]);_0x40bfeb[_0x7907('0x39')]=qs[_0x7907('0x32')](_[_0x7907('0x4a')](_0x1b6756[_0x7907('0x30')],_0xb2cb26[_0x7907('0x32')]));if(_0x1b6756[_0x7907('0x30')]['filter']){_0x40bfeb['where']=_['merge'](_0x40bfeb[_0x7907('0x39')],{'$or':_[_0x7907('0x2e')](_0x40bfeb['attributes'],function(_0x3caee8){var _0x3336a3={};_0x3336a3[_0x3caee8]={'$like':'%'+_0x1b6756[_0x7907('0x30')]['filter']+'%'};return _0x3336a3;})});}_0x40bfeb=_['merge']({},_0x40bfeb,_0x1b6756[_0x7907('0x3c')]);return _0x3a5fcb[_0x7907('0x4c')](_0x40bfeb);}})['then'](function(_0x5903d9){if(_0x5903d9){_0x278f0c=_0x5903d9['length'];if(!_0x1b6756[_0x7907('0x30')]['hasOwnProperty'](_0x7907('0x37'))){_0x40bfeb['limit']=qs['limit'](_0x1b6756[_0x7907('0x30')][_0x7907('0x1c')]);_0x40bfeb[_0x7907('0x1a')]=qs[_0x7907('0x1a')](_0x1b6756[_0x7907('0x30')][_0x7907('0x1a')]);}return _0x3a5fcb[_0x7907('0x4c')](_0x40bfeb);}})[_0x7907('0x23')](function(_0x8d417e){if(_0x8d417e){return _0x8d417e?{'count':_0x278f0c,'rows':_0x8d417e}:null;}})['then'](respondWithResult(_0x277cf9,null))[_0x7907('0x40')](handleError(_0x277cf9,null));};exports[_0x7907('0x4e')]=function(_0x17f32d,_0x44ba94,_0x288455){var _0x1ae1ec={};var _0x7e54b6={};var _0x2c0a89;var _0x2e6f83;return db['FreshdeskConfiguration'][_0x7907('0x4d')]({'where':{'id':_0x17f32d[_0x7907('0x41')]['id']}})[_0x7907('0x23')](handleEntityNotFound(_0x44ba94,null))[_0x7907('0x23')](function(_0x4a9c99){if(_0x4a9c99){_0x2c0a89=_0x4a9c99;_0x7e54b6[_0x7907('0x2d')]=_[_0x7907('0x31')](db[_0x7907('0x48')][_0x7907('0x2a')]);_0x7e54b6['query']=_[_0x7907('0x31')](_0x17f32d['query']);_0x7e54b6[_0x7907('0x32')]=_[_0x7907('0x33')](_0x7e54b6[_0x7907('0x2d')],_0x7e54b6['query']);_0x1ae1ec[_0x7907('0x34')]=_['intersection'](_0x7e54b6[_0x7907('0x2d')],qs[_0x7907('0x35')](_0x17f32d[_0x7907('0x30')][_0x7907('0x35')]));_0x1ae1ec[_0x7907('0x34')]=_0x1ae1ec['attributes'][_0x7907('0x36')]?_0x1ae1ec['attributes']:_0x7e54b6['model'];_0x1ae1ec['order']=qs['sort'](_0x17f32d[_0x7907('0x30')][_0x7907('0x38')]);_0x1ae1ec[_0x7907('0x39')]=qs[_0x7907('0x32')](_[_0x7907('0x4a')](_0x17f32d['query'],_0x7e54b6[_0x7907('0x32')]));if(_0x17f32d[_0x7907('0x30')][_0x7907('0x3a')]){_0x1ae1ec[_0x7907('0x39')]=_['merge'](_0x1ae1ec[_0x7907('0x39')],{'$or':_[_0x7907('0x2e')](_0x1ae1ec[_0x7907('0x34')],function(_0x2d87b9){var _0x1973b9={};_0x1973b9[_0x2d87b9]={'$like':'%'+_0x17f32d['query']['filter']+'%'};return _0x1973b9;})});}_0x1ae1ec=_[_0x7907('0x3b')]({},_0x1ae1ec,_0x17f32d[_0x7907('0x3c')]);return _0x2c0a89[_0x7907('0x4e')](_0x1ae1ec);}})['then'](function(_0x2da2f9){if(_0x2da2f9){_0x2e6f83=_0x2da2f9[_0x7907('0x36')];if(!_0x17f32d[_0x7907('0x30')][_0x7907('0x4b')]('nolimit')){_0x1ae1ec['limit']=qs[_0x7907('0x1c')](_0x17f32d['query']['limit']);_0x1ae1ec[_0x7907('0x1a')]=qs[_0x7907('0x1a')](_0x17f32d[_0x7907('0x30')][_0x7907('0x1a')]);}return _0x2c0a89[_0x7907('0x4e')](_0x1ae1ec);}})[_0x7907('0x23')](function(_0x124de4){if(_0x124de4){return _0x124de4?{'count':_0x2e6f83,'rows':_0x124de4}:null;}})[_0x7907('0x23')](respondWithResult(_0x44ba94,null))[_0x7907('0x40')](handleError(_0x44ba94,null));};exports[_0x7907('0x4f')]=function(_0x4d2567,_0x2349a6,_0x4a70d0){var _0x835b35={};var _0x579db9={};var _0x26b511;var _0xeb7e76;return db[_0x7907('0x29')][_0x7907('0x4d')]({'where':{'id':_0x4d2567[_0x7907('0x41')]['id']}})[_0x7907('0x23')](handleEntityNotFound(_0x2349a6,null))[_0x7907('0x23')](function(_0x5351eb){if(_0x5351eb){_0x26b511=_0x5351eb;_0x579db9[_0x7907('0x2d')]=_[_0x7907('0x31')](db['Tag'][_0x7907('0x2a')]);_0x579db9[_0x7907('0x30')]=_[_0x7907('0x31')](_0x4d2567[_0x7907('0x30')]);_0x579db9[_0x7907('0x32')]=_[_0x7907('0x33')](_0x579db9[_0x7907('0x2d')],_0x579db9[_0x7907('0x30')]);_0x835b35[_0x7907('0x34')]=_[_0x7907('0x33')](_0x579db9[_0x7907('0x2d')],qs[_0x7907('0x35')](_0x4d2567[_0x7907('0x30')][_0x7907('0x35')]));_0x835b35[_0x7907('0x34')]=_0x835b35[_0x7907('0x34')][_0x7907('0x36')]?_0x835b35['attributes']:_0x579db9[_0x7907('0x2d')];_0x835b35[_0x7907('0x49')]=qs[_0x7907('0x38')](_0x4d2567[_0x7907('0x30')][_0x7907('0x38')]);_0x835b35[_0x7907('0x39')]=qs[_0x7907('0x32')](_[_0x7907('0x4a')](_0x4d2567[_0x7907('0x30')],_0x579db9[_0x7907('0x32')]));if(_0x4d2567['query'][_0x7907('0x3a')]){_0x835b35[_0x7907('0x39')]=_[_0x7907('0x3b')](_0x835b35[_0x7907('0x39')],{'$or':_['map'](_0x835b35[_0x7907('0x34')],function(_0x4ba2f5){var _0x2275ca={};_0x2275ca[_0x4ba2f5]={'$like':'%'+_0x4d2567[_0x7907('0x30')]['filter']+'%'};return _0x2275ca;})});}_0x835b35=_[_0x7907('0x3b')]({},_0x835b35,_0x4d2567[_0x7907('0x3c')]);return _0x26b511[_0x7907('0x4f')](_0x835b35);}})['then'](function(_0x46a136){if(_0x46a136){_0xeb7e76=_0x46a136[_0x7907('0x36')];if(!_0x4d2567[_0x7907('0x30')][_0x7907('0x4b')](_0x7907('0x37'))){_0x835b35[_0x7907('0x1c')]=qs[_0x7907('0x1c')](_0x4d2567[_0x7907('0x30')][_0x7907('0x1c')]);_0x835b35[_0x7907('0x1a')]=qs[_0x7907('0x1a')](_0x4d2567[_0x7907('0x30')]['offset']);}return _0x26b511[_0x7907('0x4f')](_0x835b35);}})[_0x7907('0x23')](function(_0x2a67e9){if(_0x2a67e9){return _0x2a67e9?{'count':_0xeb7e76,'rows':_0x2a67e9}:null;}})[_0x7907('0x23')](respondWithResult(_0x2349a6,null))[_0x7907('0x40')](handleError(_0x2349a6,null));};exports[_0x7907('0x50')]=function(_0x39d1f1,_0x4edd13,_0x158255){if(_0x39d1f1[_0x7907('0x45')]['id']){delete _0x39d1f1[_0x7907('0x45')]['id'];}return db[_0x7907('0x29')][_0x7907('0x4d')]({'where':{'id':_0x39d1f1['params']['id']}})[_0x7907('0x23')](handleEntityNotFound(_0x4edd13,null))['then'](function(_0x12ef8a){if(_0x12ef8a){return _0x12ef8a[_0x7907('0x50')](_0x39d1f1[_0x7907('0x45')][_0x7907('0x51')]||[]);}return null;})['then'](respondWithResult(_0x4edd13,null))[_0x7907('0x40')](handleError(_0x4edd13,null));}; \ No newline at end of file +var _0x8324=['create','catch','body','params','destroy','getFields','findOne','FreshdeskField','rawAttributes','getSubjects','getDescriptions','getTags','setTags','ids','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','then','stack','name','send','index','map','FreshdeskConfiguration','fieldName','key','keys','query','fields','length','attributes','model','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','intersection','find'];(function(_0xcb9f7,_0x5efe92){var _0x558f76=function(_0x1fba04){while(--_0x1fba04){_0xcb9f7['push'](_0xcb9f7['shift']());}};_0x558f76(++_0x5efe92);}(_0x8324,0x14a));var _0x4832=function(_0x4bcf38,_0x3c12be){_0x4bcf38=_0x4bcf38-0x0;var _0x4a89be=_0x8324[_0x4bcf38];return _0x4a89be;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4832('0x0'));var jsonpatch=require(_0x4832('0x1'));var rp=require(_0x4832('0x2'));var moment=require(_0x4832('0x3'));var BPromise=require(_0x4832('0x4'));var Mustache=require('mustache');var util=require(_0x4832('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4832('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4832('0x7'));var squel=require(_0x4832('0x8'));var crypto=require(_0x4832('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x4832('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4832('0xb'));var Redis=require(_0x4832('0xc'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4832('0xd'));var hardwareService=require(_0x4832('0xe'));var logger=require(_0x4832('0xf'))(_0x4832('0x10'));var utils=require(_0x4832('0x11'));var config=require(_0x4832('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x4832('0x13'))['db'];function respondWithStatusCode(_0x1e544b,_0x2b3e7d){_0x2b3e7d=_0x2b3e7d||0xcc;return function(_0x34aa5a){if(_0x34aa5a){return _0x1e544b[_0x4832('0x14')](_0x2b3e7d);}return _0x1e544b[_0x4832('0x15')](_0x2b3e7d)[_0x4832('0x16')]();};}function respondWithResult(_0x58386b,_0x59bd03){_0x59bd03=_0x59bd03||0xc8;return function(_0xe7ef1e){if(_0xe7ef1e){return _0x58386b[_0x4832('0x15')](_0x59bd03)[_0x4832('0x17')](_0xe7ef1e);}};}function respondWithFilteredResult(_0x4f1a92,_0x4e8add){return function(_0x311a69){if(_0x311a69){var _0x3c08d2=typeof _0x4e8add[_0x4832('0x18')]===_0x4832('0x19')&&typeof _0x4e8add[_0x4832('0x1a')]===_0x4832('0x19');var _0x580ed7=_0x311a69[_0x4832('0x1b')];var _0x10bc16=_0x3c08d2?0x0:_0x4e8add[_0x4832('0x18')];var _0x18f060=_0x3c08d2?_0x311a69[_0x4832('0x1b')]:_0x4e8add[_0x4832('0x18')]+_0x4e8add[_0x4832('0x1a')];var _0x9f7c38;if(_0x18f060>=_0x580ed7){_0x18f060=_0x580ed7;_0x9f7c38=0xc8;}else{_0x9f7c38=0xce;}_0x4f1a92['status'](_0x9f7c38);return _0x4f1a92[_0x4832('0x1c')](_0x4832('0x1d'),_0x10bc16+'-'+_0x18f060+'/'+_0x580ed7)[_0x4832('0x17')](_0x311a69);}return null;};}function patchUpdates(_0x15cf94){return function(_0x2f3fee){try{jsonpatch[_0x4832('0x1e')](_0x2f3fee,_0x15cf94,!![]);}catch(_0xb7a933){return BPromise['reject'](_0xb7a933);}return _0x2f3fee['save']();};}function saveUpdates(_0x38ae7b,_0x556109){return function(_0x142b1c){if(_0x142b1c){return _0x142b1c['update'](_0x38ae7b)[_0x4832('0x1f')](function(_0x3f3e7a){return _0x3f3e7a;});}return null;};}function removeEntity(_0x4992fc,_0x807485){return function(_0x1d416b){if(_0x1d416b){return _0x1d416b['destroy']()['then'](function(){_0x4992fc[_0x4832('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf8b838,_0x5dfafe){return function(_0xd9fb85){if(!_0xd9fb85){_0xf8b838['sendStatus'](0x194);}return _0xd9fb85;};}function handleError(_0x491950,_0x3d10d9){_0x3d10d9=_0x3d10d9||0x1f4;return function(_0x442047){logger['error'](_0x442047[_0x4832('0x20')]);if(_0x442047['name']){delete _0x442047[_0x4832('0x21')];}_0x491950[_0x4832('0x15')](_0x3d10d9)[_0x4832('0x22')](_0x442047);};}exports[_0x4832('0x23')]=function(_0x57917b,_0x35e157){var _0x64a6b4={},_0x2fc9bb={},_0x2ace7d={'count':0x0,'rows':[]};var _0x5a428e=_[_0x4832('0x24')](db[_0x4832('0x25')]['rawAttributes'],function(_0x5265f6){return{'name':_0x5265f6[_0x4832('0x26')],'type':_0x5265f6['type'][_0x4832('0x27')]};});_0x2fc9bb['model']=_[_0x4832('0x24')](_0x5a428e,_0x4832('0x21'));_0x2fc9bb['query']=_[_0x4832('0x28')](_0x57917b[_0x4832('0x29')]);_0x2fc9bb['filters']=_['intersection'](_0x2fc9bb['model'],_0x2fc9bb[_0x4832('0x29')]);_0x64a6b4['attributes']=_['intersection'](_0x2fc9bb['model'],qs['fields'](_0x57917b[_0x4832('0x29')][_0x4832('0x2a')]));_0x64a6b4['attributes']=_0x64a6b4['attributes'][_0x4832('0x2b')]?_0x64a6b4[_0x4832('0x2c')]:_0x2fc9bb[_0x4832('0x2d')];if(!_0x57917b[_0x4832('0x29')][_0x4832('0x2e')](_0x4832('0x2f'))){_0x64a6b4[_0x4832('0x1a')]=qs[_0x4832('0x1a')](_0x57917b[_0x4832('0x29')][_0x4832('0x1a')]);_0x64a6b4['offset']=qs['offset'](_0x57917b['query']['offset']);}_0x64a6b4[_0x4832('0x30')]=qs[_0x4832('0x31')](_0x57917b[_0x4832('0x29')]['sort']);_0x64a6b4[_0x4832('0x32')]=qs[_0x4832('0x33')](_[_0x4832('0x34')](_0x57917b['query'],_0x2fc9bb['filters']),_0x5a428e);if(_0x57917b[_0x4832('0x29')][_0x4832('0x35')]){_0x64a6b4[_0x4832('0x32')]=_[_0x4832('0x36')](_0x64a6b4['where'],{'$or':_[_0x4832('0x24')](_0x5a428e,function(_0x5be9d2){if(_0x5be9d2[_0x4832('0x37')]!==_0x4832('0x38')){var _0x52e23e={};_0x52e23e[_0x5be9d2[_0x4832('0x21')]]={'$like':'%'+_0x57917b[_0x4832('0x29')]['filter']+'%'};return _0x52e23e;}})});}_0x64a6b4=_[_0x4832('0x36')]({},_0x64a6b4,_0x57917b[_0x4832('0x39')]);var _0x2deda3={'where':_0x64a6b4[_0x4832('0x32')]};return db['FreshdeskConfiguration'][_0x4832('0x1b')](_0x2deda3)[_0x4832('0x1f')](function(_0x48f088){_0x2ace7d['count']=_0x48f088;if(_0x57917b[_0x4832('0x29')][_0x4832('0x3a')]){_0x64a6b4[_0x4832('0x3b')]=[{'all':!![]}];}return db[_0x4832('0x25')][_0x4832('0x3c')](_0x64a6b4);})[_0x4832('0x1f')](function(_0x347d3a){_0x2ace7d[_0x4832('0x3d')]=_0x347d3a;return _0x2ace7d;})[_0x4832('0x1f')](respondWithFilteredResult(_0x35e157,_0x64a6b4))['catch'](handleError(_0x35e157,null));};exports[_0x4832('0x3e')]=function(_0x24b82b,_0x5b9097){var _0x14bef4={'raw':![],'where':{'id':_0x24b82b['params']['id']}},_0x39f0d4={};_0x39f0d4['model']=_['keys'](db[_0x4832('0x25')]['rawAttributes']);_0x39f0d4[_0x4832('0x29')]=_[_0x4832('0x28')](_0x24b82b[_0x4832('0x29')]);_0x39f0d4[_0x4832('0x33')]=_[_0x4832('0x3f')](_0x39f0d4['model'],_0x39f0d4['query']);_0x14bef4[_0x4832('0x2c')]=_[_0x4832('0x3f')](_0x39f0d4[_0x4832('0x2d')],qs[_0x4832('0x2a')](_0x24b82b[_0x4832('0x29')][_0x4832('0x2a')]));_0x14bef4[_0x4832('0x2c')]=_0x14bef4[_0x4832('0x2c')][_0x4832('0x2b')]?_0x14bef4[_0x4832('0x2c')]:_0x39f0d4[_0x4832('0x2d')];if(_0x24b82b['query'][_0x4832('0x3a')]){_0x14bef4[_0x4832('0x3b')]=[{'all':!![]}];}_0x14bef4=_[_0x4832('0x36')]({},_0x14bef4,_0x24b82b['options']);return db['FreshdeskConfiguration'][_0x4832('0x40')](_0x14bef4)[_0x4832('0x1f')](handleEntityNotFound(_0x5b9097,null))[_0x4832('0x1f')](respondWithResult(_0x5b9097,null))['catch'](handleError(_0x5b9097,null));};exports[_0x4832('0x41')]=function(_0x35cb32,_0xdc055e){return db['FreshdeskConfiguration'][_0x4832('0x41')](_0x35cb32['body'],{})[_0x4832('0x1f')](respondWithResult(_0xdc055e,0xc9))[_0x4832('0x42')](handleError(_0xdc055e,null));};exports['update']=function(_0xba3151,_0x5201df){if(_0xba3151[_0x4832('0x43')]['id']){delete _0xba3151[_0x4832('0x43')]['id'];}return db['FreshdeskConfiguration']['find']({'where':{'id':_0xba3151[_0x4832('0x44')]['id']}})[_0x4832('0x1f')](handleEntityNotFound(_0x5201df,null))[_0x4832('0x1f')](saveUpdates(_0xba3151[_0x4832('0x43')],null))[_0x4832('0x1f')](respondWithResult(_0x5201df,null))[_0x4832('0x42')](handleError(_0x5201df,null));};exports[_0x4832('0x45')]=function(_0x30775a,_0x4fdba1){return db[_0x4832('0x25')][_0x4832('0x40')]({'where':{'id':_0x30775a['params']['id']}})[_0x4832('0x1f')](handleEntityNotFound(_0x4fdba1,null))[_0x4832('0x1f')](removeEntity(_0x4fdba1,null))['catch'](handleError(_0x4fdba1,null));};exports[_0x4832('0x46')]=function(_0x537640,_0x4ac477,_0x32b337){var _0x270456={};var _0x459777={};var _0x3dc28d;var _0x145e56;return db[_0x4832('0x25')][_0x4832('0x47')]({'where':{'id':_0x537640[_0x4832('0x44')]['id']}})[_0x4832('0x1f')](handleEntityNotFound(_0x4ac477,null))[_0x4832('0x1f')](function(_0x3dcbaf){if(_0x3dcbaf){_0x3dc28d=_0x3dcbaf;_0x459777[_0x4832('0x2d')]=_['keys'](db[_0x4832('0x48')][_0x4832('0x49')]);_0x459777[_0x4832('0x29')]=_[_0x4832('0x28')](_0x537640[_0x4832('0x29')]);_0x459777[_0x4832('0x33')]=_[_0x4832('0x3f')](_0x459777['model'],_0x459777[_0x4832('0x29')]);_0x270456[_0x4832('0x2c')]=_[_0x4832('0x3f')](_0x459777[_0x4832('0x2d')],qs[_0x4832('0x2a')](_0x537640['query'][_0x4832('0x2a')]));_0x270456[_0x4832('0x2c')]=_0x270456['attributes'][_0x4832('0x2b')]?_0x270456[_0x4832('0x2c')]:_0x459777[_0x4832('0x2d')];_0x270456['order']=qs[_0x4832('0x31')](_0x537640[_0x4832('0x29')][_0x4832('0x31')]);_0x270456[_0x4832('0x32')]=qs[_0x4832('0x33')](_[_0x4832('0x34')](_0x537640['query'],_0x459777['filters']));if(_0x537640[_0x4832('0x29')][_0x4832('0x35')]){_0x270456['where']=_[_0x4832('0x36')](_0x270456[_0x4832('0x32')],{'$or':_[_0x4832('0x24')](_0x270456[_0x4832('0x2c')],function(_0x766a00){var _0x49c7a5={};_0x49c7a5[_0x766a00]={'$like':'%'+_0x537640['query']['filter']+'%'};return _0x49c7a5;})});}_0x270456=_[_0x4832('0x36')]({},_0x270456,_0x537640[_0x4832('0x39')]);return _0x3dc28d['getFields'](_0x270456);}})[_0x4832('0x1f')](function(_0x582272){if(_0x582272){_0x145e56=_0x582272[_0x4832('0x2b')];if(!_0x537640[_0x4832('0x29')][_0x4832('0x2e')]('nolimit')){_0x270456['limit']=qs[_0x4832('0x1a')](_0x537640['query'][_0x4832('0x1a')]);_0x270456[_0x4832('0x18')]=qs['offset'](_0x537640[_0x4832('0x29')][_0x4832('0x18')]);}return _0x3dc28d[_0x4832('0x46')](_0x270456);}})[_0x4832('0x1f')](function(_0x2a0772){if(_0x2a0772){return _0x2a0772?{'count':_0x145e56,'rows':_0x2a0772}:null;}})['then'](respondWithResult(_0x4ac477,null))[_0x4832('0x42')](handleError(_0x4ac477,null));};exports['getSubjects']=function(_0x3790bf,_0x4d7752,_0x5654c3){var _0x5cc28e={};var _0x1f7a9f={};var _0x445141;var _0x439d89;return db[_0x4832('0x25')][_0x4832('0x47')]({'where':{'id':_0x3790bf[_0x4832('0x44')]['id']}})[_0x4832('0x1f')](handleEntityNotFound(_0x4d7752,null))[_0x4832('0x1f')](function(_0x322ea4){if(_0x322ea4){_0x445141=_0x322ea4;_0x1f7a9f[_0x4832('0x2d')]=_[_0x4832('0x28')](db[_0x4832('0x48')][_0x4832('0x49')]);_0x1f7a9f[_0x4832('0x29')]=_[_0x4832('0x28')](_0x3790bf[_0x4832('0x29')]);_0x1f7a9f['filters']=_[_0x4832('0x3f')](_0x1f7a9f['model'],_0x1f7a9f['query']);_0x5cc28e[_0x4832('0x2c')]=_[_0x4832('0x3f')](_0x1f7a9f[_0x4832('0x2d')],qs['fields'](_0x3790bf['query'][_0x4832('0x2a')]));_0x5cc28e['attributes']=_0x5cc28e[_0x4832('0x2c')][_0x4832('0x2b')]?_0x5cc28e['attributes']:_0x1f7a9f[_0x4832('0x2d')];_0x5cc28e['order']=qs[_0x4832('0x31')](_0x3790bf[_0x4832('0x29')]['sort']);_0x5cc28e[_0x4832('0x32')]=qs[_0x4832('0x33')](_['pick'](_0x3790bf[_0x4832('0x29')],_0x1f7a9f[_0x4832('0x33')]));if(_0x3790bf['query'][_0x4832('0x35')]){_0x5cc28e['where']=_[_0x4832('0x36')](_0x5cc28e['where'],{'$or':_[_0x4832('0x24')](_0x5cc28e[_0x4832('0x2c')],function(_0x1bccb3){var _0x56b7d8={};_0x56b7d8[_0x1bccb3]={'$like':'%'+_0x3790bf[_0x4832('0x29')][_0x4832('0x35')]+'%'};return _0x56b7d8;})});}_0x5cc28e=_[_0x4832('0x36')]({},_0x5cc28e,_0x3790bf[_0x4832('0x39')]);return _0x445141[_0x4832('0x4a')](_0x5cc28e);}})[_0x4832('0x1f')](function(_0x3868e2){if(_0x3868e2){_0x439d89=_0x3868e2[_0x4832('0x2b')];if(!_0x3790bf[_0x4832('0x29')][_0x4832('0x2e')](_0x4832('0x2f'))){_0x5cc28e['limit']=qs[_0x4832('0x1a')](_0x3790bf[_0x4832('0x29')]['limit']);_0x5cc28e['offset']=qs[_0x4832('0x18')](_0x3790bf[_0x4832('0x29')][_0x4832('0x18')]);}return _0x445141[_0x4832('0x4a')](_0x5cc28e);}})[_0x4832('0x1f')](function(_0x59797a){if(_0x59797a){return _0x59797a?{'count':_0x439d89,'rows':_0x59797a}:null;}})[_0x4832('0x1f')](respondWithResult(_0x4d7752,null))[_0x4832('0x42')](handleError(_0x4d7752,null));};exports['getDescriptions']=function(_0x5c6a0f,_0x40b7f4,_0x1c6e36){var _0x3b925f={};var _0xbc9e30={};var _0x5b48cd;var _0x1f6c63;return db['FreshdeskConfiguration'][_0x4832('0x47')]({'where':{'id':_0x5c6a0f[_0x4832('0x44')]['id']}})[_0x4832('0x1f')](handleEntityNotFound(_0x40b7f4,null))[_0x4832('0x1f')](function(_0x544c77){if(_0x544c77){_0x5b48cd=_0x544c77;_0xbc9e30[_0x4832('0x2d')]=_[_0x4832('0x28')](db[_0x4832('0x48')][_0x4832('0x49')]);_0xbc9e30[_0x4832('0x29')]=_[_0x4832('0x28')](_0x5c6a0f[_0x4832('0x29')]);_0xbc9e30['filters']=_[_0x4832('0x3f')](_0xbc9e30['model'],_0xbc9e30['query']);_0x3b925f['attributes']=_[_0x4832('0x3f')](_0xbc9e30[_0x4832('0x2d')],qs[_0x4832('0x2a')](_0x5c6a0f[_0x4832('0x29')]['fields']));_0x3b925f[_0x4832('0x2c')]=_0x3b925f[_0x4832('0x2c')][_0x4832('0x2b')]?_0x3b925f[_0x4832('0x2c')]:_0xbc9e30[_0x4832('0x2d')];_0x3b925f[_0x4832('0x30')]=qs[_0x4832('0x31')](_0x5c6a0f[_0x4832('0x29')][_0x4832('0x31')]);_0x3b925f[_0x4832('0x32')]=qs[_0x4832('0x33')](_[_0x4832('0x34')](_0x5c6a0f[_0x4832('0x29')],_0xbc9e30[_0x4832('0x33')]));if(_0x5c6a0f['query'][_0x4832('0x35')]){_0x3b925f[_0x4832('0x32')]=_['merge'](_0x3b925f['where'],{'$or':_[_0x4832('0x24')](_0x3b925f[_0x4832('0x2c')],function(_0x2a1b3b){var _0x20b443={};_0x20b443[_0x2a1b3b]={'$like':'%'+_0x5c6a0f[_0x4832('0x29')][_0x4832('0x35')]+'%'};return _0x20b443;})});}_0x3b925f=_[_0x4832('0x36')]({},_0x3b925f,_0x5c6a0f[_0x4832('0x39')]);return _0x5b48cd[_0x4832('0x4b')](_0x3b925f);}})[_0x4832('0x1f')](function(_0x22ec63){if(_0x22ec63){_0x1f6c63=_0x22ec63[_0x4832('0x2b')];if(!_0x5c6a0f[_0x4832('0x29')]['hasOwnProperty'](_0x4832('0x2f'))){_0x3b925f[_0x4832('0x1a')]=qs[_0x4832('0x1a')](_0x5c6a0f[_0x4832('0x29')][_0x4832('0x1a')]);_0x3b925f[_0x4832('0x18')]=qs[_0x4832('0x18')](_0x5c6a0f['query'][_0x4832('0x18')]);}return _0x5b48cd[_0x4832('0x4b')](_0x3b925f);}})[_0x4832('0x1f')](function(_0x4f2384){if(_0x4f2384){return _0x4f2384?{'count':_0x1f6c63,'rows':_0x4f2384}:null;}})[_0x4832('0x1f')](respondWithResult(_0x40b7f4,null))[_0x4832('0x42')](handleError(_0x40b7f4,null));};exports[_0x4832('0x4c')]=function(_0x28c7b0,_0x361583,_0x3a78a8){var _0x17d6b1={};var _0x63cf54={};var _0x3c8f15;var _0x2b277c;return db[_0x4832('0x25')]['findOne']({'where':{'id':_0x28c7b0['params']['id']}})[_0x4832('0x1f')](handleEntityNotFound(_0x361583,null))['then'](function(_0x62926a){if(_0x62926a){_0x3c8f15=_0x62926a;_0x63cf54[_0x4832('0x2d')]=_['keys'](db['Tag'][_0x4832('0x49')]);_0x63cf54[_0x4832('0x29')]=_[_0x4832('0x28')](_0x28c7b0[_0x4832('0x29')]);_0x63cf54['filters']=_['intersection'](_0x63cf54['model'],_0x63cf54[_0x4832('0x29')]);_0x17d6b1[_0x4832('0x2c')]=_[_0x4832('0x3f')](_0x63cf54['model'],qs['fields'](_0x28c7b0['query']['fields']));_0x17d6b1['attributes']=_0x17d6b1['attributes'][_0x4832('0x2b')]?_0x17d6b1[_0x4832('0x2c')]:_0x63cf54['model'];_0x17d6b1[_0x4832('0x30')]=qs[_0x4832('0x31')](_0x28c7b0[_0x4832('0x29')]['sort']);_0x17d6b1[_0x4832('0x32')]=qs[_0x4832('0x33')](_['pick'](_0x28c7b0[_0x4832('0x29')],_0x63cf54[_0x4832('0x33')]));if(_0x28c7b0[_0x4832('0x29')][_0x4832('0x35')]){_0x17d6b1[_0x4832('0x32')]=_[_0x4832('0x36')](_0x17d6b1['where'],{'$or':_[_0x4832('0x24')](_0x17d6b1[_0x4832('0x2c')],function(_0x399ab8){var _0x74b543={};_0x74b543[_0x399ab8]={'$like':'%'+_0x28c7b0[_0x4832('0x29')][_0x4832('0x35')]+'%'};return _0x74b543;})});}_0x17d6b1=_[_0x4832('0x36')]({},_0x17d6b1,_0x28c7b0[_0x4832('0x39')]);return _0x3c8f15[_0x4832('0x4c')](_0x17d6b1);}})[_0x4832('0x1f')](function(_0x658cb8){if(_0x658cb8){_0x2b277c=_0x658cb8['length'];if(!_0x28c7b0['query']['hasOwnProperty'](_0x4832('0x2f'))){_0x17d6b1[_0x4832('0x1a')]=qs['limit'](_0x28c7b0[_0x4832('0x29')][_0x4832('0x1a')]);_0x17d6b1[_0x4832('0x18')]=qs['offset'](_0x28c7b0['query']['offset']);}return _0x3c8f15[_0x4832('0x4c')](_0x17d6b1);}})[_0x4832('0x1f')](function(_0x2e5c1f){if(_0x2e5c1f){return _0x2e5c1f?{'count':_0x2b277c,'rows':_0x2e5c1f}:null;}})[_0x4832('0x1f')](respondWithResult(_0x361583,null))[_0x4832('0x42')](handleError(_0x361583,null));};exports[_0x4832('0x4d')]=function(_0x157efe,_0x2e36c0,_0xf1f29a){if(_0x157efe['body']['id']){delete _0x157efe['body']['id'];}return db[_0x4832('0x25')][_0x4832('0x47')]({'where':{'id':_0x157efe['params']['id']}})[_0x4832('0x1f')](handleEntityNotFound(_0x2e36c0,null))[_0x4832('0x1f')](function(_0x68f55b){if(_0x68f55b){return _0x68f55b[_0x4832('0x4d')](_0x157efe[_0x4832('0x43')][_0x4832('0x4e')]||[]);}return null;})[_0x4832('0x1f')](respondWithResult(_0x2e36c0,null))[_0x4832('0x42')](handleError(_0x2e36c0,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index ccfedab..0e0601e 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 _0xc862=['exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes'];(function(_0x3f8aa6,_0x5ab4d6){var _0x25da45=function(_0x4bc4d6){while(--_0x4bc4d6){_0x3f8aa6['push'](_0x3f8aa6['shift']());}};_0x25da45(++_0x5ab4d6);}(_0xc862,0xd0));var _0x2c86=function(_0x405a4a,_0x36acf4){_0x405a4a=_0x405a4a-0x0;var _0x58b0de=_0xc862[_0x405a4a];return _0x58b0de;};'use strict';var _=require(_0x2c86('0x0'));var util=require(_0x2c86('0x1'));var logger=require(_0x2c86('0x2'))('api');var moment=require(_0x2c86('0x3'));var BPromise=require('bluebird');var rp=require(_0x2c86('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2c86('0x5'));var config=require(_0x2c86('0x6'));var attributes=require(_0x2c86('0x7'));module[_0x2c86('0x8')]=function(_0x59f1f2,_0x173530){return _0x59f1f2[_0x2c86('0x9')](_0x2c86('0xa'),attributes,{'tableName':_0x2c86('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2321=['int_freshdesk_configurations','lodash','../../config/logger','api','moment','bluebird','path','../../config/environment','./intFreshdeskConfiguration.attributes','define','FreshdeskConfiguration'];(function(_0x306583,_0x26b8ee){var _0x7edb07=function(_0x3afa9e){while(--_0x3afa9e){_0x306583['push'](_0x306583['shift']());}};_0x7edb07(++_0x26b8ee);}(_0x2321,0xe8));var _0x1232=function(_0x3dee92,_0x55e1eb){_0x3dee92=_0x3dee92-0x0;var _0x44d36e=_0x2321[_0x3dee92];return _0x44d36e;};'use strict';var _=require(_0x1232('0x0'));var util=require('util');var logger=require(_0x1232('0x1'))(_0x1232('0x2'));var moment=require(_0x1232('0x3'));var BPromise=require(_0x1232('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1232('0x5'));var rimraf=require('rimraf');var config=require(_0x1232('0x6'));var attributes=require(_0x1232('0x7'));module['exports']=function(_0x318332,_0x32d7af){return _0x318332[_0x1232('0x8')](_0x1232('0x9'),attributes,{'tableName':_0x1232('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index 65903db..980a602 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 _0x9ef4=['http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2ab977,_0x5cc91e){var _0x12de0=function(_0x554636){while(--_0x554636){_0x2ab977['push'](_0x2ab977['shift']());}};_0x12de0(++_0x5cc91e);}(_0x9ef4,0xc4));var _0x49ef=function(_0x447f5a,_0x122b09){_0x447f5a=_0x447f5a-0x0;var _0x571867=_0x9ef4[_0x447f5a];return _0x571867;};'use strict';var _=require(_0x49ef('0x0'));var util=require(_0x49ef('0x1'));var moment=require(_0x49ef('0x2'));var BPromise=require(_0x49ef('0x3'));var rs=require(_0x49ef('0x4'));var fs=require('fs');var Redis=require(_0x49ef('0x5'));var db=require(_0x49ef('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x49ef('0x7'))(_0x49ef('0x8'));var config=require(_0x49ef('0x9'));var jayson=require(_0x49ef('0xa'));var client=jayson[_0x49ef('0xb')][_0x49ef('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5a0feb,_0x49822d,_0xb26c82){return new BPromise(function(_0x5b854c,_0x5aecf0){return client[_0x49ef('0xd')](_0x5a0feb,_0xb26c82)[_0x49ef('0xe')](function(_0x17f8d6){logger[_0x49ef('0xf')](_0x49ef('0x10'),_0x49822d,_0x49ef('0x11'));logger[_0x49ef('0x12')](_0x49ef('0x13'),_0x49822d,_0x49ef('0x11'),JSON[_0x49ef('0x14')](_0x17f8d6));if(_0x17f8d6[_0x49ef('0x15')]){if(_0x17f8d6['error'][_0x49ef('0x16')]===0x1f4){logger[_0x49ef('0x15')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x49822d,_0x17f8d6['error'][_0x49ef('0x17')]);return _0x5aecf0(_0x17f8d6[_0x49ef('0x15')][_0x49ef('0x17')]);}logger[_0x49ef('0x15')](_0x49ef('0x10'),_0x49822d,_0x17f8d6['error']['message']);return _0x5b854c(_0x17f8d6['error'][_0x49ef('0x17')]);}else{logger['info'](_0x49ef('0x10'),_0x49822d,_0x49ef('0x11'));_0x5b854c(_0x17f8d6[_0x49ef('0x18')][_0x49ef('0x17')]);}})[_0x49ef('0x19')](function(_0x4894da){logger[_0x49ef('0x15')](_0x49ef('0x10'),_0x49822d,_0x4894da);_0x5aecf0(_0x4894da);});});} \ No newline at end of file +var _0xb135=['info','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','jayson/promise','client','request'];(function(_0x35c8fe,_0x20b291){var _0x131090=function(_0x292cff){while(--_0x292cff){_0x35c8fe['push'](_0x35c8fe['shift']());}};_0x131090(++_0x20b291);}(_0xb135,0xd2));var _0x5b13=function(_0x346781,_0x478d47){_0x346781=_0x346781-0x0;var _0x3b40d0=_0xb135[_0x346781];return _0x3b40d0;};'use strict';var _=require(_0x5b13('0x0'));var util=require(_0x5b13('0x1'));var moment=require(_0x5b13('0x2'));var BPromise=require(_0x5b13('0x3'));var rs=require(_0x5b13('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5b13('0x5'));var logger=require('../../config/logger')(_0x5b13('0x6'));var config=require('../../config/environment');var jayson=require(_0x5b13('0x7'));var client=jayson[_0x5b13('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x174b17,_0x4bbdf3,_0x5e6410){return new BPromise(function(_0x243a74,_0x1b1338){return client[_0x5b13('0x9')](_0x174b17,_0x5e6410)['then'](function(_0x61e65e){logger[_0x5b13('0xa')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x4bbdf3,_0x5b13('0xb'));logger[_0x5b13('0xc')](_0x5b13('0xd'),_0x4bbdf3,_0x5b13('0xb'),JSON[_0x5b13('0xe')](_0x61e65e));if(_0x61e65e['error']){if(_0x61e65e[_0x5b13('0xf')][_0x5b13('0x10')]===0x1f4){logger['error'](_0x5b13('0x11'),_0x4bbdf3,_0x61e65e[_0x5b13('0xf')]['message']);return _0x1b1338(_0x61e65e[_0x5b13('0xf')]['message']);}logger[_0x5b13('0xf')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x4bbdf3,_0x61e65e[_0x5b13('0xf')][_0x5b13('0x12')]);return _0x243a74(_0x61e65e[_0x5b13('0xf')][_0x5b13('0x12')]);}else{logger['info'](_0x5b13('0x11'),_0x4bbdf3,_0x5b13('0xb'));_0x243a74(_0x61e65e['result'][_0x5b13('0x12')]);}})[_0x5b13('0x13')](function(_0x4f53fc){logger[_0x5b13('0xf')](_0x5b13('0x11'),_0x4bbdf3,_0x4f53fc);_0x1b1338(_0x4f53fc);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 6c7e604..595fc1e 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 _0x55fa=['delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','put'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0x55fa,0xff));var _0xa55f=function(_0x46de85,_0x24f65c){_0x46de85=_0x46de85-0x0;var _0x4055c9=_0x55fa[_0x46de85];return _0x4055c9;};'use strict';var multer=require(_0xa55f('0x0'));var util=require('util');var path=require(_0xa55f('0x1'));var timeout=require(_0xa55f('0x2'));var express=require(_0xa55f('0x3'));var router=express['Router']();var fs_extra=require(_0xa55f('0x4'));var auth=require(_0xa55f('0x5'));var interaction=require(_0xa55f('0x6'));var config=require(_0xa55f('0x7'));var controller=require('./intFreshdeskField.controller');router[_0xa55f('0x8')]('/',auth[_0xa55f('0x9')](),controller[_0xa55f('0xa')]);router[_0xa55f('0x8')](_0xa55f('0xb'),auth[_0xa55f('0x9')](),controller[_0xa55f('0xc')]);router[_0xa55f('0xd')]('/',auth[_0xa55f('0x9')](),controller['create']);router[_0xa55f('0xe')]('/:id',auth[_0xa55f('0x9')](),controller['update']);router[_0xa55f('0xf')](_0xa55f('0xb'),auth[_0xa55f('0x9')](),controller[_0xa55f('0x10')]);module[_0xa55f('0x11')]=router; \ No newline at end of file +var _0x4a8f=['update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','show','post','create','put','/:id'];(function(_0xd5f5f,_0x4e33b5){var _0x1aad2a=function(_0x69c53a){while(--_0x69c53a){_0xd5f5f['push'](_0xd5f5f['shift']());}};_0x1aad2a(++_0x4e33b5);}(_0x4a8f,0x158));var _0xf4a8=function(_0x3fe393,_0x234a3a){_0x3fe393=_0x3fe393-0x0;var _0x534d14=_0x4a8f[_0x3fe393];return _0x534d14;};'use strict';var multer=require('multer');var util=require(_0xf4a8('0x0'));var path=require(_0xf4a8('0x1'));var timeout=require(_0xf4a8('0x2'));var express=require(_0xf4a8('0x3'));var router=express['Router']();var fs_extra=require(_0xf4a8('0x4'));var auth=require(_0xf4a8('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf4a8('0x6'));var controller=require(_0xf4a8('0x7'));router[_0xf4a8('0x8')]('/',auth[_0xf4a8('0x9')](),controller[_0xf4a8('0xa')]);router[_0xf4a8('0x8')]('/:id',auth[_0xf4a8('0x9')](),controller[_0xf4a8('0xb')]);router[_0xf4a8('0xc')]('/',auth[_0xf4a8('0x9')](),controller[_0xf4a8('0xd')]);router[_0xf4a8('0xe')](_0xf4a8('0xf'),auth['isAuthenticated'](),controller[_0xf4a8('0x10')]);router[_0xf4a8('0x11')]('/:id',auth[_0xf4a8('0x9')](),controller[_0xf4a8('0x12')]);module[_0xf4a8('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index bdd0567..c1c8f79 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 _0x1d5e=['string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','exports','ENUM'];(function(_0x3e0b47,_0x34334f){var _0x2683f0=function(_0x31fe38){while(--_0x31fe38){_0x3e0b47['push'](_0x3e0b47['shift']());}};_0x2683f0(++_0x34334f);}(_0x1d5e,0xc4));var _0xe1d5=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1d5e[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0xe1d5('0x0')]={'type':{'type':Sequelize[_0xe1d5('0x1')](_0xe1d5('0x2'),_0xe1d5('0x3'),_0xe1d5('0x4'),_0xe1d5('0x5'),_0xe1d5('0x6')),'defaultValue':_0xe1d5('0x2')},'content':{'type':Sequelize[_0xe1d5('0x7')]},'key':{'type':Sequelize[_0xe1d5('0x7')]},'keyType':{'type':Sequelize[_0xe1d5('0x1')](_0xe1d5('0x2'),_0xe1d5('0x3'),_0xe1d5('0x4'))},'keyContent':{'type':Sequelize[_0xe1d5('0x7')]},'idField':{'type':Sequelize[_0xe1d5('0x7')]},'nameField':{'type':Sequelize[_0xe1d5('0x7')]},'customField':{'type':Sequelize[_0xe1d5('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe1d5('0x7')]}}; \ No newline at end of file +var _0x0d8a=['string','STRING','BOOLEAN','sequelize','exports','ENUM','variable','customVariable','keyValue','picklist'];(function(_0x3b9583,_0x148150){var _0x35c329=function(_0x43121e){while(--_0x43121e){_0x3b9583['push'](_0x3b9583['shift']());}};_0x35c329(++_0x148150);}(_0x0d8a,0x17f));var _0xa0d8=function(_0x17088c,_0x653302){_0x17088c=_0x17088c-0x0;var _0x5b36ee=_0x0d8a[_0x17088c];return _0x5b36ee;};'use strict';var Sequelize=require(_0xa0d8('0x0'));module[_0xa0d8('0x1')]={'type':{'type':Sequelize[_0xa0d8('0x2')]('string',_0xa0d8('0x3'),_0xa0d8('0x4'),_0xa0d8('0x5'),_0xa0d8('0x6')),'defaultValue':_0xa0d8('0x7')},'content':{'type':Sequelize[_0xa0d8('0x8')]},'key':{'type':Sequelize[_0xa0d8('0x8')]},'keyType':{'type':Sequelize[_0xa0d8('0x2')](_0xa0d8('0x7'),_0xa0d8('0x3'),_0xa0d8('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xa0d8('0x8')]},'nameField':{'type':Sequelize[_0xa0d8('0x8')]},'customField':{'type':Sequelize[_0xa0d8('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 88d0d9a..53b2d29 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 _0xc36d=['desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','status','end','json','limit','undefined','count','offset','Content-Range','apply','save','update','then','destroy','stack','name','send','index','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','options','includeAll','include','rows','catch','show','params','FreshdeskField','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce'];(function(_0x284b43,_0x5212d6){var _0x1550cd=function(_0x11620a){while(--_0x11620a){_0x284b43['push'](_0x284b43['shift']());}};_0x1550cd(++_0x5212d6);}(_0xc36d,0x7d));var _0xdc36=function(_0x53b199,_0x38ff21){_0x53b199=_0x53b199-0x0;var _0x1ba42d=_0xc36d[_0x53b199];return _0x1ba42d;};'use strict';var emlformat=require(_0xdc36('0x0'));var rimraf=require(_0xdc36('0x1'));var zipdir=require(_0xdc36('0x2'));var jsonpatch=require(_0xdc36('0x3'));var rp=require(_0xdc36('0x4'));var moment=require(_0xdc36('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xdc36('0x6'));var util=require(_0xdc36('0x7'));var path=require('path');var sox=require(_0xdc36('0x8'));var csv=require(_0xdc36('0x9'));var ejs=require(_0xdc36('0xa'));var fs=require('fs');var fs_extra=require(_0xdc36('0xb'));var _=require(_0xdc36('0xc'));var squel=require('squel');var crypto=require(_0xdc36('0xd'));var jsforce=require(_0xdc36('0xe'));var deskjs=require(_0xdc36('0xf'));var toCsv=require(_0xdc36('0x9'));var querystring=require('querystring');var Papa=require(_0xdc36('0x10'));var Redis=require(_0xdc36('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xdc36('0x12'));var as=require(_0xdc36('0x13'));var hardwareService=require(_0xdc36('0x14'));var logger=require('../../config/logger')(_0xdc36('0x15'));var utils=require(_0xdc36('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xdc36('0x17'))['db'];function respondWithStatusCode(_0x276692,_0x519fa5){_0x519fa5=_0x519fa5||0xcc;return function(_0x5d62ee){if(_0x5d62ee){return _0x276692['sendStatus'](_0x519fa5);}return _0x276692[_0xdc36('0x18')](_0x519fa5)[_0xdc36('0x19')]();};}function respondWithResult(_0x243d54,_0xae6ad3){_0xae6ad3=_0xae6ad3||0xc8;return function(_0x30803d){if(_0x30803d){return _0x243d54[_0xdc36('0x18')](_0xae6ad3)[_0xdc36('0x1a')](_0x30803d);}};}function respondWithFilteredResult(_0x809cf0,_0x57ebde){return function(_0x155cce){if(_0x155cce){var _0x526ac8=typeof _0x57ebde['offset']==='undefined'&&typeof _0x57ebde[_0xdc36('0x1b')]===_0xdc36('0x1c');var _0x5a498f=_0x155cce[_0xdc36('0x1d')];var _0x219a73=_0x526ac8?0x0:_0x57ebde[_0xdc36('0x1e')];var _0x225878=_0x526ac8?_0x155cce[_0xdc36('0x1d')]:_0x57ebde[_0xdc36('0x1e')]+_0x57ebde['limit'];var _0x3d4c4c;if(_0x225878>=_0x5a498f){_0x225878=_0x5a498f;_0x3d4c4c=0xc8;}else{_0x3d4c4c=0xce;}_0x809cf0[_0xdc36('0x18')](_0x3d4c4c);return _0x809cf0['set'](_0xdc36('0x1f'),_0x219a73+'-'+_0x225878+'/'+_0x5a498f)[_0xdc36('0x1a')](_0x155cce);}return null;};}function patchUpdates(_0x3f25f0){return function(_0x5f15ef){try{jsonpatch[_0xdc36('0x20')](_0x5f15ef,_0x3f25f0,!![]);}catch(_0x235a39){return BPromise['reject'](_0x235a39);}return _0x5f15ef[_0xdc36('0x21')]();};}function saveUpdates(_0x480277,_0x5a6e35){return function(_0x12f9d8){if(_0x12f9d8){return _0x12f9d8[_0xdc36('0x22')](_0x480277)[_0xdc36('0x23')](function(_0xda916b){return _0xda916b;});}return null;};}function removeEntity(_0x2d83c0,_0x34d261){return function(_0x14b595){if(_0x14b595){return _0x14b595[_0xdc36('0x24')]()['then'](function(){_0x2d83c0[_0xdc36('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2338d7,_0x38bd73){return function(_0x15e686){if(!_0x15e686){_0x2338d7['sendStatus'](0x194);}return _0x15e686;};}function handleError(_0xbc4322,_0x6e3906){_0x6e3906=_0x6e3906||0x1f4;return function(_0x337091){logger['error'](_0x337091[_0xdc36('0x25')]);if(_0x337091[_0xdc36('0x26')]){delete _0x337091[_0xdc36('0x26')];}_0xbc4322['status'](_0x6e3906)[_0xdc36('0x27')](_0x337091);};}exports[_0xdc36('0x28')]=function(_0x4b15b4,_0x3fe57f){var _0x12fed2={},_0x4ea2ad={},_0x21151b={'count':0x0,'rows':[]};var _0x5bba0b=_['map'](db['FreshdeskField'][_0xdc36('0x29')],function(_0x2f2bb4){return{'name':_0x2f2bb4['fieldName'],'type':_0x2f2bb4[_0xdc36('0x2a')][_0xdc36('0x2b')]};});_0x4ea2ad[_0xdc36('0x2c')]=_['map'](_0x5bba0b,_0xdc36('0x26'));_0x4ea2ad[_0xdc36('0x2d')]=_[_0xdc36('0x2e')](_0x4b15b4[_0xdc36('0x2d')]);_0x4ea2ad[_0xdc36('0x2f')]=_[_0xdc36('0x30')](_0x4ea2ad[_0xdc36('0x2c')],_0x4ea2ad['query']);_0x12fed2[_0xdc36('0x31')]=_[_0xdc36('0x30')](_0x4ea2ad['model'],qs['fields'](_0x4b15b4[_0xdc36('0x2d')][_0xdc36('0x32')]));_0x12fed2[_0xdc36('0x31')]=_0x12fed2['attributes']['length']?_0x12fed2[_0xdc36('0x31')]:_0x4ea2ad[_0xdc36('0x2c')];if(!_0x4b15b4[_0xdc36('0x2d')][_0xdc36('0x33')](_0xdc36('0x34'))){_0x12fed2[_0xdc36('0x1b')]=qs[_0xdc36('0x1b')](_0x4b15b4[_0xdc36('0x2d')][_0xdc36('0x1b')]);_0x12fed2[_0xdc36('0x1e')]=qs[_0xdc36('0x1e')](_0x4b15b4['query'][_0xdc36('0x1e')]);}_0x12fed2[_0xdc36('0x35')]=qs[_0xdc36('0x36')](_0x4b15b4[_0xdc36('0x2d')]['sort']);_0x12fed2[_0xdc36('0x37')]=qs[_0xdc36('0x2f')](_[_0xdc36('0x38')](_0x4b15b4[_0xdc36('0x2d')],_0x4ea2ad['filters']),_0x5bba0b);if(_0x4b15b4[_0xdc36('0x2d')]['filter']){_0x12fed2['where']=_[_0xdc36('0x39')](_0x12fed2[_0xdc36('0x37')],{'$or':_[_0xdc36('0x3a')](_0x5bba0b,function(_0x54c45d){if(_0x54c45d[_0xdc36('0x2a')]!=='VIRTUAL'){var _0x45760b={};_0x45760b[_0x54c45d[_0xdc36('0x26')]]={'$like':'%'+_0x4b15b4[_0xdc36('0x2d')]['filter']+'%'};return _0x45760b;}})});}_0x12fed2=_[_0xdc36('0x39')]({},_0x12fed2,_0x4b15b4[_0xdc36('0x3b')]);var _0xd98d42={'where':_0x12fed2[_0xdc36('0x37')]};return db['FreshdeskField'][_0xdc36('0x1d')](_0xd98d42)[_0xdc36('0x23')](function(_0x68816d){_0x21151b['count']=_0x68816d;if(_0x4b15b4['query'][_0xdc36('0x3c')]){_0x12fed2[_0xdc36('0x3d')]=[{'all':!![]}];}return db['FreshdeskField']['findAll'](_0x12fed2);})[_0xdc36('0x23')](function(_0x8f4c80){_0x21151b[_0xdc36('0x3e')]=_0x8f4c80;return _0x21151b;})[_0xdc36('0x23')](respondWithFilteredResult(_0x3fe57f,_0x12fed2))[_0xdc36('0x3f')](handleError(_0x3fe57f,null));};exports[_0xdc36('0x40')]=function(_0x932213,_0x2a83ee){var _0x2f4c89={'raw':!![],'where':{'id':_0x932213[_0xdc36('0x41')]['id']}},_0x125f0e={};_0x125f0e[_0xdc36('0x2c')]=_[_0xdc36('0x2e')](db[_0xdc36('0x42')][_0xdc36('0x29')]);_0x125f0e[_0xdc36('0x2d')]=_[_0xdc36('0x2e')](_0x932213[_0xdc36('0x2d')]);_0x125f0e[_0xdc36('0x2f')]=_[_0xdc36('0x30')](_0x125f0e[_0xdc36('0x2c')],_0x125f0e[_0xdc36('0x2d')]);_0x2f4c89[_0xdc36('0x31')]=_[_0xdc36('0x30')](_0x125f0e[_0xdc36('0x2c')],qs[_0xdc36('0x32')](_0x932213['query'][_0xdc36('0x32')]));_0x2f4c89[_0xdc36('0x31')]=_0x2f4c89['attributes']['length']?_0x2f4c89[_0xdc36('0x31')]:_0x125f0e['model'];if(_0x932213[_0xdc36('0x2d')]['includeAll']){_0x2f4c89[_0xdc36('0x3d')]=[{'all':!![]}];}_0x2f4c89=_[_0xdc36('0x39')]({},_0x2f4c89,_0x932213[_0xdc36('0x3b')]);return db[_0xdc36('0x42')][_0xdc36('0x43')](_0x2f4c89)[_0xdc36('0x23')](handleEntityNotFound(_0x2a83ee,null))[_0xdc36('0x23')](respondWithResult(_0x2a83ee,null))[_0xdc36('0x3f')](handleError(_0x2a83ee,null));};exports[_0xdc36('0x44')]=function(_0x38c24b,_0x3c27c7){return db[_0xdc36('0x42')][_0xdc36('0x44')](_0x38c24b[_0xdc36('0x45')],{})[_0xdc36('0x23')](respondWithResult(_0x3c27c7,0xc9))[_0xdc36('0x3f')](handleError(_0x3c27c7,null));};exports[_0xdc36('0x22')]=function(_0x3399cc,_0x562c86){if(_0x3399cc['body']['id']){delete _0x3399cc[_0xdc36('0x45')]['id'];}return db[_0xdc36('0x42')][_0xdc36('0x43')]({'where':{'id':_0x3399cc[_0xdc36('0x41')]['id']}})[_0xdc36('0x23')](handleEntityNotFound(_0x562c86,null))[_0xdc36('0x23')](saveUpdates(_0x3399cc['body'],null))[_0xdc36('0x23')](respondWithResult(_0x562c86,null))[_0xdc36('0x3f')](handleError(_0x562c86,null));};exports[_0xdc36('0x24')]=function(_0x49f456,_0x2c6856){return db[_0xdc36('0x42')][_0xdc36('0x43')]({'where':{'id':_0x49f456[_0xdc36('0x41')]['id']}})[_0xdc36('0x23')](handleEntityNotFound(_0x2c6856,null))[_0xdc36('0x23')](removeEntity(_0x2c6856,null))['catch'](handleError(_0x2c6856,null));}; \ No newline at end of file +var _0x422f=['update','destroy','then','error','stack','name','map','FreshdeskField','fieldName','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','type','VIRTUAL','findAll','rows','show','params','rawAttributes','length','includeAll','include','merge','options','find','body','catch','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','Content-Range','apply','reject','save'];(function(_0x5eb22e,_0x27cbac){var _0x27fed5=function(_0x565467){while(--_0x565467){_0x5eb22e['push'](_0x5eb22e['shift']());}};_0x27fed5(++_0x27cbac);}(_0x422f,0x1c7));var _0xf422=function(_0x4ade92,_0x4d333f){_0x4ade92=_0x4ade92-0x0;var _0x58eff3=_0x422f[_0x4ade92];return _0x58eff3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf422('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf422('0x1'));var rp=require(_0xf422('0x2'));var moment=require('moment');var BPromise=require(_0xf422('0x3'));var Mustache=require(_0xf422('0x4'));var util=require(_0xf422('0x5'));var path=require(_0xf422('0x6'));var sox=require(_0xf422('0x7'));var csv=require(_0xf422('0x8'));var ejs=require(_0xf422('0x9'));var fs=require('fs');var fs_extra=require(_0xf422('0xa'));var _=require(_0xf422('0xb'));var squel=require('squel');var crypto=require(_0xf422('0xc'));var jsforce=require(_0xf422('0xd'));var deskjs=require(_0xf422('0xe'));var toCsv=require(_0xf422('0x8'));var querystring=require(_0xf422('0xf'));var Papa=require('papaparse');var Redis=require(_0xf422('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf422('0x11'));var hardwareService=require(_0xf422('0x12'));var logger=require(_0xf422('0x13'))(_0xf422('0x14'));var utils=require(_0xf422('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf422('0x16'));var db=require(_0xf422('0x17'))['db'];function respondWithStatusCode(_0x4d56d1,_0x133a6a){_0x133a6a=_0x133a6a||0xcc;return function(_0x8aa9cc){if(_0x8aa9cc){return _0x4d56d1[_0xf422('0x18')](_0x133a6a);}return _0x4d56d1[_0xf422('0x19')](_0x133a6a)[_0xf422('0x1a')]();};}function respondWithResult(_0x28a6a8,_0x223b21){_0x223b21=_0x223b21||0xc8;return function(_0x272430){if(_0x272430){return _0x28a6a8[_0xf422('0x19')](_0x223b21)['json'](_0x272430);}};}function respondWithFilteredResult(_0x54bb9c,_0x52f96b){return function(_0x1c81e1){if(_0x1c81e1){var _0x30b70a=typeof _0x52f96b[_0xf422('0x1b')]===_0xf422('0x1c')&&typeof _0x52f96b['limit']===_0xf422('0x1c');var _0x264964=_0x1c81e1[_0xf422('0x1d')];var _0x2ae133=_0x30b70a?0x0:_0x52f96b[_0xf422('0x1b')];var _0x29b0b1=_0x30b70a?_0x1c81e1['count']:_0x52f96b['offset']+_0x52f96b[_0xf422('0x1e')];var _0x4b657;if(_0x29b0b1>=_0x264964){_0x29b0b1=_0x264964;_0x4b657=0xc8;}else{_0x4b657=0xce;}_0x54bb9c[_0xf422('0x19')](_0x4b657);return _0x54bb9c['set'](_0xf422('0x1f'),_0x2ae133+'-'+_0x29b0b1+'/'+_0x264964)['json'](_0x1c81e1);}return null;};}function patchUpdates(_0x22afe7){return function(_0x15833b){try{jsonpatch[_0xf422('0x20')](_0x15833b,_0x22afe7,!![]);}catch(_0x4d6717){return BPromise[_0xf422('0x21')](_0x4d6717);}return _0x15833b[_0xf422('0x22')]();};}function saveUpdates(_0x511529,_0x4b80a0){return function(_0x268575){if(_0x268575){return _0x268575[_0xf422('0x23')](_0x511529)['then'](function(_0x25b6a5){return _0x25b6a5;});}return null;};}function removeEntity(_0x570ea2,_0x3b21a5){return function(_0x32ceee){if(_0x32ceee){return _0x32ceee[_0xf422('0x24')]()[_0xf422('0x25')](function(){_0x570ea2[_0xf422('0x19')](0xcc)[_0xf422('0x1a')]();});}};}function handleEntityNotFound(_0xd8d70f,_0x11d10b){return function(_0x5dcab4){if(!_0x5dcab4){_0xd8d70f[_0xf422('0x18')](0x194);}return _0x5dcab4;};}function handleError(_0x59d03d,_0x2f0f9f){_0x2f0f9f=_0x2f0f9f||0x1f4;return function(_0x7d36e7){logger[_0xf422('0x26')](_0x7d36e7[_0xf422('0x27')]);if(_0x7d36e7[_0xf422('0x28')]){delete _0x7d36e7[_0xf422('0x28')];}_0x59d03d[_0xf422('0x19')](_0x2f0f9f)['send'](_0x7d36e7);};}exports['index']=function(_0x35d1fa,_0x10d51b){var _0x266fb8={},_0x33ef63={},_0xefb99e={'count':0x0,'rows':[]};var _0x48e0c7=_[_0xf422('0x29')](db[_0xf422('0x2a')]['rawAttributes'],function(_0x5f0186){return{'name':_0x5f0186[_0xf422('0x2b')],'type':_0x5f0186['type']['key']};});_0x33ef63[_0xf422('0x2c')]=_[_0xf422('0x29')](_0x48e0c7,'name');_0x33ef63[_0xf422('0x2d')]=_[_0xf422('0x2e')](_0x35d1fa[_0xf422('0x2d')]);_0x33ef63[_0xf422('0x2f')]=_[_0xf422('0x30')](_0x33ef63['model'],_0x33ef63[_0xf422('0x2d')]);_0x266fb8['attributes']=_[_0xf422('0x30')](_0x33ef63[_0xf422('0x2c')],qs[_0xf422('0x31')](_0x35d1fa[_0xf422('0x2d')][_0xf422('0x31')]));_0x266fb8[_0xf422('0x32')]=_0x266fb8[_0xf422('0x32')]['length']?_0x266fb8['attributes']:_0x33ef63[_0xf422('0x2c')];if(!_0x35d1fa[_0xf422('0x2d')]['hasOwnProperty'](_0xf422('0x33'))){_0x266fb8[_0xf422('0x1e')]=qs[_0xf422('0x1e')](_0x35d1fa[_0xf422('0x2d')][_0xf422('0x1e')]);_0x266fb8[_0xf422('0x1b')]=qs[_0xf422('0x1b')](_0x35d1fa[_0xf422('0x2d')][_0xf422('0x1b')]);}_0x266fb8[_0xf422('0x34')]=qs[_0xf422('0x35')](_0x35d1fa[_0xf422('0x2d')][_0xf422('0x35')]);_0x266fb8[_0xf422('0x36')]=qs['filters'](_['pick'](_0x35d1fa['query'],_0x33ef63[_0xf422('0x2f')]),_0x48e0c7);if(_0x35d1fa[_0xf422('0x2d')]['filter']){_0x266fb8[_0xf422('0x36')]=_['merge'](_0x266fb8[_0xf422('0x36')],{'$or':_[_0xf422('0x29')](_0x48e0c7,function(_0x55ac68){if(_0x55ac68[_0xf422('0x37')]!==_0xf422('0x38')){var _0x174f6f={};_0x174f6f[_0x55ac68['name']]={'$like':'%'+_0x35d1fa[_0xf422('0x2d')]['filter']+'%'};return _0x174f6f;}})});}_0x266fb8=_['merge']({},_0x266fb8,_0x35d1fa['options']);var _0x112bce={'where':_0x266fb8[_0xf422('0x36')]};return db[_0xf422('0x2a')][_0xf422('0x1d')](_0x112bce)[_0xf422('0x25')](function(_0x2f82a0){_0xefb99e[_0xf422('0x1d')]=_0x2f82a0;if(_0x35d1fa[_0xf422('0x2d')]['includeAll']){_0x266fb8['include']=[{'all':!![]}];}return db[_0xf422('0x2a')][_0xf422('0x39')](_0x266fb8);})[_0xf422('0x25')](function(_0xb3955){_0xefb99e[_0xf422('0x3a')]=_0xb3955;return _0xefb99e;})[_0xf422('0x25')](respondWithFilteredResult(_0x10d51b,_0x266fb8))['catch'](handleError(_0x10d51b,null));};exports[_0xf422('0x3b')]=function(_0x4f453a,_0x17c1f2){var _0x391e3c={'raw':!![],'where':{'id':_0x4f453a[_0xf422('0x3c')]['id']}},_0x564041={};_0x564041[_0xf422('0x2c')]=_[_0xf422('0x2e')](db[_0xf422('0x2a')][_0xf422('0x3d')]);_0x564041['query']=_[_0xf422('0x2e')](_0x4f453a[_0xf422('0x2d')]);_0x564041[_0xf422('0x2f')]=_[_0xf422('0x30')](_0x564041[_0xf422('0x2c')],_0x564041['query']);_0x391e3c[_0xf422('0x32')]=_[_0xf422('0x30')](_0x564041['model'],qs[_0xf422('0x31')](_0x4f453a['query'][_0xf422('0x31')]));_0x391e3c[_0xf422('0x32')]=_0x391e3c[_0xf422('0x32')][_0xf422('0x3e')]?_0x391e3c[_0xf422('0x32')]:_0x564041[_0xf422('0x2c')];if(_0x4f453a[_0xf422('0x2d')][_0xf422('0x3f')]){_0x391e3c[_0xf422('0x40')]=[{'all':!![]}];}_0x391e3c=_[_0xf422('0x41')]({},_0x391e3c,_0x4f453a[_0xf422('0x42')]);return db[_0xf422('0x2a')][_0xf422('0x43')](_0x391e3c)[_0xf422('0x25')](handleEntityNotFound(_0x17c1f2,null))[_0xf422('0x25')](respondWithResult(_0x17c1f2,null))['catch'](handleError(_0x17c1f2,null));};exports['create']=function(_0x3c59dd,_0x2c2ce9){return db[_0xf422('0x2a')]['create'](_0x3c59dd[_0xf422('0x44')],{})[_0xf422('0x25')](respondWithResult(_0x2c2ce9,0xc9))[_0xf422('0x45')](handleError(_0x2c2ce9,null));};exports[_0xf422('0x23')]=function(_0x1f3a30,_0x259e24){if(_0x1f3a30[_0xf422('0x44')]['id']){delete _0x1f3a30['body']['id'];}return db[_0xf422('0x2a')]['find']({'where':{'id':_0x1f3a30[_0xf422('0x3c')]['id']}})[_0xf422('0x25')](handleEntityNotFound(_0x259e24,null))['then'](saveUpdates(_0x1f3a30[_0xf422('0x44')],null))[_0xf422('0x25')](respondWithResult(_0x259e24,null))[_0xf422('0x45')](handleError(_0x259e24,null));};exports[_0xf422('0x24')]=function(_0x2df71a,_0x5c3cb8){return db['FreshdeskField'][_0xf422('0x43')]({'where':{'id':_0x2df71a['params']['id']}})[_0xf422('0x25')](handleEntityNotFound(_0x5c3cb8,null))[_0xf422('0x25')](removeEntity(_0x5c3cb8,null))[_0xf422('0x45')](handleError(_0x5c3cb8,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 961909a..a8e5928 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 _0x1f71=['exports','define','FreshdeskField','freshdesk_unique_index','FieldId','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes'];(function(_0x7b173,_0x539d7f){var _0x1c598c=function(_0xe1e1e0){while(--_0xe1e1e0){_0x7b173['push'](_0x7b173['shift']());}};_0x1c598c(++_0x539d7f);}(_0x1f71,0xaa));var _0x11f7=function(_0x19857f,_0x48afa0){_0x19857f=_0x19857f-0x0;var _0x500131=_0x1f71[_0x19857f];return _0x500131;};'use strict';var _=require('lodash');var util=require(_0x11f7('0x0'));var logger=require(_0x11f7('0x1'))(_0x11f7('0x2'));var moment=require(_0x11f7('0x3'));var BPromise=require(_0x11f7('0x4'));var rp=require(_0x11f7('0x5'));var fs=require('fs');var path=require(_0x11f7('0x6'));var rimraf=require(_0x11f7('0x7'));var config=require(_0x11f7('0x8'));var attributes=require(_0x11f7('0x9'));module[_0x11f7('0xa')]=function(_0x5110aa,_0x48f717){return _0x5110aa[_0x11f7('0xb')](_0x11f7('0xc'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0x11f7('0xd'),'fields':['idField',_0x11f7('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf25a=['moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskField.attributes','int_freshdesk_fields','freshdesk_unique_index','idField','lodash','util','../../config/logger'];(function(_0x12cb7c,_0x4ce42b){var _0x325f77=function(_0x111e12){while(--_0x111e12){_0x12cb7c['push'](_0x12cb7c['shift']());}};_0x325f77(++_0x4ce42b);}(_0xf25a,0x195));var _0xaf25=function(_0x5ef955,_0x194047){_0x5ef955=_0x5ef955-0x0;var _0x5f2be1=_0xf25a[_0x5ef955];return _0x5f2be1;};'use strict';var _=require(_0xaf25('0x0'));var util=require(_0xaf25('0x1'));var logger=require(_0xaf25('0x2'))('api');var moment=require(_0xaf25('0x3'));var BPromise=require(_0xaf25('0x4'));var rp=require(_0xaf25('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaf25('0x6'));var config=require(_0xaf25('0x7'));var attributes=require(_0xaf25('0x8'));module['exports']=function(_0x49281b,_0x30eaae){return _0x49281b['define']('FreshdeskField',attributes,{'tableName':_0xaf25('0x9'),'paranoid':![],'indexes':[{'name':_0xaf25('0xa'),'fields':[_0xaf25('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index 4006a6d..452ebb7 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 _0x6bcb=['result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','FreshdeskField,\x20%s,\x20%s','debug','request\x20sent','error','message','info'];(function(_0x34cb00,_0x51c716){var _0x26d606=function(_0x467f35){while(--_0x467f35){_0x34cb00['push'](_0x34cb00['shift']());}};_0x26d606(++_0x51c716);}(_0x6bcb,0x132));var _0xb6bc=function(_0x47242d,_0x13f993){_0x47242d=_0x47242d-0x0;var _0x30273a=_0x6bcb[_0x47242d];return _0x30273a;};'use strict';var _=require('lodash');var util=require(_0xb6bc('0x0'));var moment=require(_0xb6bc('0x1'));var BPromise=require(_0xb6bc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb6bc('0x3'));var db=require(_0xb6bc('0x4'))['db'];var utils=require(_0xb6bc('0x5'));var logger=require('../../config/logger')(_0xb6bc('0x6'));var config=require('../../config/environment');var jayson=require(_0xb6bc('0x7'));var client=jayson[_0xb6bc('0x8')][_0xb6bc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x510ed6,_0x34f55b,_0x367b35){return new BPromise(function(_0x29b51e,_0x2c375f){return client[_0xb6bc('0xa')](_0x510ed6,_0x367b35)['then'](function(_0xb68571){logger['info'](_0xb6bc('0xb'),_0x34f55b,'request\x20sent');logger[_0xb6bc('0xc')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x34f55b,_0xb6bc('0xd'),JSON['stringify'](_0xb68571));if(_0xb68571['error']){if(_0xb68571[_0xb6bc('0xe')]['code']===0x1f4){logger[_0xb6bc('0xe')](_0xb6bc('0xb'),_0x34f55b,_0xb68571[_0xb6bc('0xe')]['message']);return _0x2c375f(_0xb68571[_0xb6bc('0xe')]['message']);}logger[_0xb6bc('0xe')](_0xb6bc('0xb'),_0x34f55b,_0xb68571[_0xb6bc('0xe')][_0xb6bc('0xf')]);return _0x29b51e(_0xb68571[_0xb6bc('0xe')]['message']);}else{logger[_0xb6bc('0x10')](_0xb6bc('0xb'),_0x34f55b,_0xb6bc('0xd'));_0x29b51e(_0xb68571[_0xb6bc('0x11')][_0xb6bc('0xf')]);}})[_0xb6bc('0x12')](function(_0x50b897){logger[_0xb6bc('0xe')](_0xb6bc('0xb'),_0x34f55b,_0x50b897);_0x2c375f(_0x50b897);});});} \ No newline at end of file +var _0xdc3e=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xdc3e,0xf2));var _0xedc3=function(_0x21d4aa,_0x4e0dd5){_0x21d4aa=_0x21d4aa-0x0;var _0x4d1b8e=_0xdc3e[_0x21d4aa];return _0x4d1b8e;};'use strict';var _=require('lodash');var util=require(_0xedc3('0x0'));var moment=require(_0xedc3('0x1'));var BPromise=require(_0xedc3('0x2'));var rs=require(_0xedc3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xedc3('0x4'))['db'];var utils=require(_0xedc3('0x5'));var logger=require('../../config/logger')(_0xedc3('0x6'));var config=require(_0xedc3('0x7'));var jayson=require(_0xedc3('0x8'));var client=jayson[_0xedc3('0x9')][_0xedc3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x43fc5d,_0x5a7e7f,_0x1968b2){return new BPromise(function(_0x217604,_0x35406d){return client[_0xedc3('0xb')](_0x43fc5d,_0x1968b2)[_0xedc3('0xc')](function(_0x203312){logger['info'](_0xedc3('0xd'),_0x5a7e7f,_0xedc3('0xe'));logger[_0xedc3('0xf')](_0xedc3('0x10'),_0x5a7e7f,'request\x20sent',JSON[_0xedc3('0x11')](_0x203312));if(_0x203312[_0xedc3('0x12')]){if(_0x203312[_0xedc3('0x12')][_0xedc3('0x13')]===0x1f4){logger[_0xedc3('0x12')](_0xedc3('0xd'),_0x5a7e7f,_0x203312[_0xedc3('0x12')]['message']);return _0x35406d(_0x203312[_0xedc3('0x12')][_0xedc3('0x14')]);}logger['error'](_0xedc3('0xd'),_0x5a7e7f,_0x203312[_0xedc3('0x12')][_0xedc3('0x14')]);return _0x217604(_0x203312['error'][_0xedc3('0x14')]);}else{logger['info'](_0xedc3('0xd'),_0x5a7e7f,_0xedc3('0xe'));_0x217604(_0x203312['result'][_0xedc3('0x14')]);}})[_0xedc3('0x15')](function(_0xd8d545){logger[_0xedc3('0x12')]('FreshdeskField,\x20%s,\x20%s',_0x5a7e7f,_0xd8d545);_0x35406d(_0xd8d545);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 31be1ee..c6878f0 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 _0x2e54=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy','exports','multer','connect-timeout','express'];(function(_0x421f66,_0x2c65c4){var _0x229969=function(_0x3a89b2){while(--_0x3a89b2){_0x421f66['push'](_0x421f66['shift']());}};_0x229969(++_0x2c65c4);}(_0x2e54,0x1dd));var _0x42e5=function(_0x572133,_0x755f22){_0x572133=_0x572133-0x0;var _0x29ebdf=_0x2e54[_0x572133];return _0x29ebdf;};'use strict';var multer=require(_0x42e5('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x42e5('0x1'));var express=require(_0x42e5('0x2'));var router=express[_0x42e5('0x3')]();var fs_extra=require(_0x42e5('0x4'));var auth=require(_0x42e5('0x5'));var interaction=require(_0x42e5('0x6'));var config=require(_0x42e5('0x7'));var controller=require('./intFreshsalesAccount.controller');router[_0x42e5('0x8')]('/',auth[_0x42e5('0x9')](),controller[_0x42e5('0xa')]);router['get'](_0x42e5('0xb'),auth['isAuthenticated'](),controller[_0x42e5('0xc')]);router['get'](_0x42e5('0xd'),auth[_0x42e5('0x9')](),controller[_0x42e5('0xe')]);router[_0x42e5('0x8')](_0x42e5('0xf'),auth[_0x42e5('0x9')](),controller[_0x42e5('0x10')]);router[_0x42e5('0x11')]('/',auth[_0x42e5('0x9')](),controller['create']);router[_0x42e5('0x11')](_0x42e5('0xd'),auth['isAuthenticated'](),controller[_0x42e5('0x12')]);router[_0x42e5('0x13')](_0x42e5('0xb'),auth[_0x42e5('0x9')](),controller[_0x42e5('0x14')]);router[_0x42e5('0x15')](_0x42e5('0xb'),auth[_0x42e5('0x9')](),controller[_0x42e5('0x16')]);module[_0x42e5('0x17')]=router; \ No newline at end of file +var _0x4ded=['./intFreshsalesAccount.controller','get','index','/:id','isAuthenticated','show','getFields','post','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xc3071f,_0x566221){var _0xbc8f61=function(_0x13cd10){while(--_0x13cd10){_0xc3071f['push'](_0xc3071f['shift']());}};_0xbc8f61(++_0x566221);}(_0x4ded,0x116));var _0xd4de=function(_0x3bbff0,_0x253a66){_0x3bbff0=_0x3bbff0-0x0;var _0x101ab5=_0x4ded[_0x3bbff0];return _0x101ab5;};'use strict';var multer=require(_0xd4de('0x0'));var util=require(_0xd4de('0x1'));var path=require(_0xd4de('0x2'));var timeout=require(_0xd4de('0x3'));var express=require(_0xd4de('0x4'));var router=express[_0xd4de('0x5')]();var fs_extra=require(_0xd4de('0x6'));var auth=require(_0xd4de('0x7'));var interaction=require(_0xd4de('0x8'));var config=require(_0xd4de('0x9'));var controller=require(_0xd4de('0xa'));router[_0xd4de('0xb')]('/',auth['isAuthenticated'](),controller[_0xd4de('0xc')]);router[_0xd4de('0xb')](_0xd4de('0xd'),auth[_0xd4de('0xe')](),controller[_0xd4de('0xf')]);router[_0xd4de('0xb')]('/:id/configurations',auth[_0xd4de('0xe')](),controller['getConfigurations']);router['get']('/:id/fields',auth[_0xd4de('0xe')](),controller[_0xd4de('0x10')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xd4de('0x11')]('/:id/configurations',auth[_0xd4de('0xe')](),controller[_0xd4de('0x12')]);router[_0xd4de('0x13')](_0xd4de('0xd'),auth[_0xd4de('0xe')](),controller[_0xd4de('0x14')]);router[_0xd4de('0x15')](_0xd4de('0xd'),auth[_0xd4de('0xe')](),controller[_0xd4de('0x16')]);module[_0xd4de('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index aa6d3f4..68ed697 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 _0x583c=['exports','STRING','username','sequelize'];(function(_0xa186c,_0x5e2ea6){var _0x333dd2=function(_0x2b80c0){while(--_0x2b80c0){_0xa186c['push'](_0xa186c['shift']());}};_0x333dd2(++_0x5e2ea6);}(_0x583c,0x12b));var _0xc583=function(_0x57fa33,_0x2b8222){_0x57fa33=_0x57fa33-0x0;var _0x12e724=_0x583c[_0x57fa33];return _0x12e724;};'use strict';var Sequelize=require(_0xc583('0x0'));module[_0xc583('0x1')]={'name':{'type':Sequelize[_0xc583('0x2')]},'description':{'type':Sequelize[_0xc583('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xc583('0x3')},'apiKey':{'type':Sequelize[_0xc583('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xc583('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x1893=['STRING','username','remoteUri'];(function(_0x3fc97b,_0x20ca29){var _0x3a0c82=function(_0x1c15ec){while(--_0x1c15ec){_0x3fc97b['push'](_0x3fc97b['shift']());}};_0x3a0c82(++_0x20ca29);}(_0x1893,0xa2));var _0x3189=function(_0x293e7a,_0x1792a2){_0x293e7a=_0x293e7a-0x0;var _0xb78342=_0x1893[_0x293e7a];return _0xb78342;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3189('0x0')]},'description':{'type':Sequelize[_0x3189('0x0')]},'username':{'type':Sequelize[_0x3189('0x0')],'unique':_0x3189('0x1')},'apiKey':{'type':Sequelize[_0x3189('0x0')]},'remoteUri':{'type':Sequelize[_0x3189('0x0')],'unique':_0x3189('0x2')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index bb740b6..561cd12 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 _0xa674=['end','status','json','offset','undefined','count','set','apply','save','update','destroy','then','error','stack','name','send','index','map','FreshsalesAccount','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','merge','includeAll','include','findAll','show','rawAttributes','options','find','create','body','params','getConfigurations','findOne','FreshsalesConfiguration','pick','hasOwnProperty','limit','addConfiguration','Subjects','getSubjects','channel','type','Descriptions','getDescriptions','FreshsalesField','getFields','username','remoteUri','apiKey','slice','substring','GET','format','users','email','Requested\x20Resource\x20not\x20Found','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','sox','to-csv','fs-extra','lodash','crypto','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','sendStatus'];(function(_0x4898e1,_0x208a2b){var _0x1c9424=function(_0x2564d3){while(--_0x2564d3){_0x4898e1['push'](_0x4898e1['shift']());}};_0x1c9424(++_0x208a2b);}(_0xa674,0xa9));var _0x4a67=function(_0x1f29e8,_0x320b53){_0x1f29e8=_0x1f29e8-0x0;var _0x5b4338=_0xa674[_0x1f29e8];return _0x5b4338;};'use strict';var emlformat=require(_0x4a67('0x0'));var rimraf=require(_0x4a67('0x1'));var zipdir=require(_0x4a67('0x2'));var jsonpatch=require(_0x4a67('0x3'));var rp=require(_0x4a67('0x4'));var moment=require(_0x4a67('0x5'));var BPromise=require(_0x4a67('0x6'));var Mustache=require(_0x4a67('0x7'));var util=require(_0x4a67('0x8'));var path=require(_0x4a67('0x9'));var sox=require(_0x4a67('0xa'));var csv=require(_0x4a67('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4a67('0xc'));var _=require(_0x4a67('0xd'));var squel=require('squel');var crypto=require(_0x4a67('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4a67('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4a67('0xf'));var qs=require(_0x4a67('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4a67('0x11'));var logger=require(_0x4a67('0x12'))(_0x4a67('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x3bf36b,_0x9c0db7){_0x9c0db7=_0x9c0db7||0xcc;return function(_0x3b9867){if(_0x3b9867){return _0x3bf36b[_0x4a67('0x14')](_0x9c0db7);}return _0x3bf36b['status'](_0x9c0db7)[_0x4a67('0x15')]();};}function respondWithResult(_0x2e12d3,_0xfb7466){_0xfb7466=_0xfb7466||0xc8;return function(_0x54b556){if(_0x54b556){return _0x2e12d3[_0x4a67('0x16')](_0xfb7466)[_0x4a67('0x17')](_0x54b556);}};}function respondWithFilteredResult(_0x50b7e6,_0xdcaa25){return function(_0x43b5f2){if(_0x43b5f2){var _0x162339=typeof _0xdcaa25[_0x4a67('0x18')]===_0x4a67('0x19')&&typeof _0xdcaa25['limit']==='undefined';var _0x2e545e=_0x43b5f2['count'];var _0xca3e26=_0x162339?0x0:_0xdcaa25[_0x4a67('0x18')];var _0x393599=_0x162339?_0x43b5f2[_0x4a67('0x1a')]:_0xdcaa25[_0x4a67('0x18')]+_0xdcaa25['limit'];var _0x33bc9f;if(_0x393599>=_0x2e545e){_0x393599=_0x2e545e;_0x33bc9f=0xc8;}else{_0x33bc9f=0xce;}_0x50b7e6['status'](_0x33bc9f);return _0x50b7e6[_0x4a67('0x1b')]('Content-Range',_0xca3e26+'-'+_0x393599+'/'+_0x2e545e)[_0x4a67('0x17')](_0x43b5f2);}return null;};}function patchUpdates(_0x4a6f65){return function(_0x394542){try{jsonpatch[_0x4a67('0x1c')](_0x394542,_0x4a6f65,!![]);}catch(_0x3aa39d){return BPromise['reject'](_0x3aa39d);}return _0x394542[_0x4a67('0x1d')]();};}function saveUpdates(_0x1b9e24,_0x8c6c00){return function(_0x425df5){if(_0x425df5){return _0x425df5[_0x4a67('0x1e')](_0x1b9e24)['then'](function(_0x16a05e){return _0x16a05e;});}return null;};}function removeEntity(_0x20640e,_0x50c488){return function(_0xa4166){if(_0xa4166){return _0xa4166[_0x4a67('0x1f')]()[_0x4a67('0x20')](function(){_0x20640e[_0x4a67('0x16')](0xcc)[_0x4a67('0x15')]();});}};}function handleEntityNotFound(_0x3006b7,_0x2f27b2){return function(_0x86d08d){if(!_0x86d08d){_0x3006b7[_0x4a67('0x14')](0x194);}return _0x86d08d;};}function handleError(_0x60402,_0x2d80f3){_0x2d80f3=_0x2d80f3||0x1f4;return function(_0x26e239){logger[_0x4a67('0x21')](_0x26e239[_0x4a67('0x22')]);if(_0x26e239[_0x4a67('0x23')]){delete _0x26e239[_0x4a67('0x23')];}_0x60402[_0x4a67('0x16')](_0x2d80f3)[_0x4a67('0x24')](_0x26e239);};}exports[_0x4a67('0x25')]=function(_0x3f4516,_0x125773){var _0x348201={},_0x85da30={},_0x5c9782={'count':0x0,'rows':[]};var _0x4d33b6=_[_0x4a67('0x26')](db[_0x4a67('0x27')]['rawAttributes'],function(_0x3a5e8f){return{'name':_0x3a5e8f[_0x4a67('0x28')],'type':_0x3a5e8f['type'][_0x4a67('0x29')]};});_0x85da30[_0x4a67('0x2a')]=_['map'](_0x4d33b6,_0x4a67('0x23'));_0x85da30[_0x4a67('0x2b')]=_[_0x4a67('0x2c')](_0x3f4516['query']);_0x85da30[_0x4a67('0x2d')]=_[_0x4a67('0x2e')](_0x85da30[_0x4a67('0x2a')],_0x85da30[_0x4a67('0x2b')]);_0x348201[_0x4a67('0x2f')]=_[_0x4a67('0x2e')](_0x85da30[_0x4a67('0x2a')],qs[_0x4a67('0x30')](_0x3f4516[_0x4a67('0x2b')][_0x4a67('0x30')]));_0x348201['attributes']=_0x348201[_0x4a67('0x2f')][_0x4a67('0x31')]?_0x348201[_0x4a67('0x2f')]:_0x85da30['model'];if(!_0x3f4516[_0x4a67('0x2b')]['hasOwnProperty'](_0x4a67('0x32'))){_0x348201['limit']=qs['limit'](_0x3f4516[_0x4a67('0x2b')]['limit']);_0x348201[_0x4a67('0x18')]=qs[_0x4a67('0x18')](_0x3f4516[_0x4a67('0x2b')]['offset']);}_0x348201['order']=qs[_0x4a67('0x33')](_0x3f4516[_0x4a67('0x2b')]['sort']);_0x348201[_0x4a67('0x34')]=qs[_0x4a67('0x2d')](_['pick'](_0x3f4516[_0x4a67('0x2b')],_0x85da30[_0x4a67('0x2d')]),_0x4d33b6);if(_0x3f4516[_0x4a67('0x2b')][_0x4a67('0x35')]){_0x348201[_0x4a67('0x34')]=_[_0x4a67('0x36')](_0x348201['where'],{'$or':_['map'](_0x4d33b6,function(_0x259069){if(_0x259069['type']!=='VIRTUAL'){var _0x5bea02={};_0x5bea02[_0x259069[_0x4a67('0x23')]]={'$like':'%'+_0x3f4516['query']['filter']+'%'};return _0x5bea02;}})});}_0x348201=_[_0x4a67('0x36')]({},_0x348201,_0x3f4516['options']);var _0x3937f6={'where':_0x348201[_0x4a67('0x34')]};return db[_0x4a67('0x27')]['count'](_0x3937f6)['then'](function(_0x2417fb){_0x5c9782['count']=_0x2417fb;if(_0x3f4516['query'][_0x4a67('0x37')]){_0x348201[_0x4a67('0x38')]=[{'all':!![]}];}return db['FreshsalesAccount'][_0x4a67('0x39')](_0x348201);})['then'](function(_0x710233){_0x5c9782['rows']=_0x710233;return _0x5c9782;})[_0x4a67('0x20')](respondWithFilteredResult(_0x125773,_0x348201))['catch'](handleError(_0x125773,null));};exports[_0x4a67('0x3a')]=function(_0x135780,_0x318800){var _0x3a3a52={'raw':![],'where':{'id':_0x135780['params']['id']}},_0x496772={};_0x496772[_0x4a67('0x2a')]=_[_0x4a67('0x2c')](db[_0x4a67('0x27')][_0x4a67('0x3b')]);_0x496772[_0x4a67('0x2b')]=_[_0x4a67('0x2c')](_0x135780[_0x4a67('0x2b')]);_0x496772[_0x4a67('0x2d')]=_[_0x4a67('0x2e')](_0x496772['model'],_0x496772[_0x4a67('0x2b')]);_0x3a3a52[_0x4a67('0x2f')]=_[_0x4a67('0x2e')](_0x496772[_0x4a67('0x2a')],qs[_0x4a67('0x30')](_0x135780[_0x4a67('0x2b')]['fields']));_0x3a3a52[_0x4a67('0x2f')]=_0x3a3a52['attributes'][_0x4a67('0x31')]?_0x3a3a52[_0x4a67('0x2f')]:_0x496772[_0x4a67('0x2a')];if(_0x135780[_0x4a67('0x2b')]['includeAll']){_0x3a3a52['include']=[{'all':!![]}];}_0x3a3a52=_[_0x4a67('0x36')]({},_0x3a3a52,_0x135780[_0x4a67('0x3c')]);return db['FreshsalesAccount'][_0x4a67('0x3d')](_0x3a3a52)[_0x4a67('0x20')](handleEntityNotFound(_0x318800,null))[_0x4a67('0x20')](respondWithResult(_0x318800,null))['catch'](handleError(_0x318800,null));};exports[_0x4a67('0x3e')]=function(_0x173428,_0x118e75){return db[_0x4a67('0x27')][_0x4a67('0x3e')](_0x173428[_0x4a67('0x3f')],{})[_0x4a67('0x20')](respondWithResult(_0x118e75,0xc9))['catch'](handleError(_0x118e75,null));};exports[_0x4a67('0x1e')]=function(_0x5910d8,_0xc27d82){if(_0x5910d8[_0x4a67('0x3f')]['id']){delete _0x5910d8[_0x4a67('0x3f')]['id'];}return db[_0x4a67('0x27')][_0x4a67('0x3d')]({'where':{'id':_0x5910d8[_0x4a67('0x40')]['id']}})['then'](handleEntityNotFound(_0xc27d82,null))[_0x4a67('0x20')](saveUpdates(_0x5910d8[_0x4a67('0x3f')],null))[_0x4a67('0x20')](respondWithResult(_0xc27d82,null))['catch'](handleError(_0xc27d82,null));};exports[_0x4a67('0x1f')]=function(_0x23d5f7,_0x11b655){return db['FreshsalesAccount'][_0x4a67('0x3d')]({'where':{'id':_0x23d5f7[_0x4a67('0x40')]['id']}})[_0x4a67('0x20')](handleEntityNotFound(_0x11b655,null))[_0x4a67('0x20')](removeEntity(_0x11b655,null))['catch'](handleError(_0x11b655,null));};exports[_0x4a67('0x41')]=function(_0x254778,_0x1701ce,_0x3cbf07){var _0x4497de={};var _0x2aafc={};var _0x1783fa;var _0x4e453a;return db[_0x4a67('0x27')][_0x4a67('0x42')]({'where':{'id':_0x254778[_0x4a67('0x40')]['id']}})[_0x4a67('0x20')](handleEntityNotFound(_0x1701ce,null))['then'](function(_0x3f5ddd){if(_0x3f5ddd){_0x1783fa=_0x3f5ddd;_0x2aafc[_0x4a67('0x2a')]=_[_0x4a67('0x2c')](db[_0x4a67('0x43')][_0x4a67('0x3b')]);_0x2aafc[_0x4a67('0x2b')]=_[_0x4a67('0x2c')](_0x254778[_0x4a67('0x2b')]);_0x2aafc['filters']=_[_0x4a67('0x2e')](_0x2aafc['model'],_0x2aafc[_0x4a67('0x2b')]);_0x4497de[_0x4a67('0x2f')]=_[_0x4a67('0x2e')](_0x2aafc[_0x4a67('0x2a')],qs['fields'](_0x254778[_0x4a67('0x2b')][_0x4a67('0x30')]));_0x4497de['attributes']=_0x4497de[_0x4a67('0x2f')][_0x4a67('0x31')]?_0x4497de[_0x4a67('0x2f')]:_0x2aafc[_0x4a67('0x2a')];_0x4497de['order']=qs[_0x4a67('0x33')](_0x254778['query'][_0x4a67('0x33')]);_0x4497de[_0x4a67('0x34')]=qs[_0x4a67('0x2d')](_[_0x4a67('0x44')](_0x254778[_0x4a67('0x2b')],_0x2aafc[_0x4a67('0x2d')]));if(_0x254778['query'][_0x4a67('0x35')]){_0x4497de['where']=_['merge'](_0x4497de[_0x4a67('0x34')],{'$or':_[_0x4a67('0x26')](_0x4497de[_0x4a67('0x2f')],function(_0x1937f6){var _0x591999={};_0x591999[_0x1937f6]={'$like':'%'+_0x254778[_0x4a67('0x2b')][_0x4a67('0x35')]+'%'};return _0x591999;})});}_0x4497de=_['merge']({},_0x4497de,_0x254778[_0x4a67('0x3c')]);return _0x1783fa[_0x4a67('0x41')](_0x4497de);}})[_0x4a67('0x20')](function(_0x35a109){if(_0x35a109){_0x4e453a=_0x35a109[_0x4a67('0x31')];if(!_0x254778[_0x4a67('0x2b')][_0x4a67('0x45')](_0x4a67('0x32'))){_0x4497de['limit']=qs[_0x4a67('0x46')](_0x254778['query'][_0x4a67('0x46')]);_0x4497de[_0x4a67('0x18')]=qs[_0x4a67('0x18')](_0x254778[_0x4a67('0x2b')]['offset']);}return _0x1783fa['getConfigurations'](_0x4497de);}})['then'](function(_0x1920a6){if(_0x1920a6){return _0x1920a6?{'count':_0x4e453a,'rows':_0x1920a6}:null;}})[_0x4a67('0x20')](respondWithResult(_0x1701ce,null))['catch'](handleError(_0x1701ce,null));};exports[_0x4a67('0x47')]=function(_0x26f3b3,_0x4dedf7,_0x5f5713){if(_0x26f3b3[_0x4a67('0x3f')]['id']){delete _0x26f3b3['body']['id'];}return db[_0x4a67('0x27')][_0x4a67('0x42')]({'where':{'id':_0x26f3b3[_0x4a67('0x40')]['id']}})['then'](handleEntityNotFound(_0x4dedf7,null))[_0x4a67('0x20')](function(_0x536943){if(_0x536943){_0x26f3b3[_0x4a67('0x3f')]['AccountId']=_0x536943['id'];_0x26f3b3[_0x4a67('0x3f')][_0x4a67('0x48')]=integrations[_0x4a67('0x49')](_0x26f3b3[_0x4a67('0x3f')][_0x4a67('0x4a')],_0x26f3b3['body'][_0x4a67('0x4b')]);_0x26f3b3[_0x4a67('0x3f')][_0x4a67('0x4c')]=integrations[_0x4a67('0x4d')](_0x26f3b3['body'][_0x4a67('0x4a')],_0x26f3b3['body']['type']);return db['FreshsalesConfiguration'][_0x4a67('0x3e')](_0x26f3b3['body'],{'include':[{'model':db[_0x4a67('0x4e')],'as':'Subjects'},{'model':db[_0x4a67('0x4e')],'as':_0x4a67('0x4c')}]});}return null;})['then'](respondWithResult(_0x4dedf7,null))['catch'](handleError(_0x4dedf7,null));};exports[_0x4a67('0x4f')]=function(_0x3fe54e,_0x15a58e,_0x29cff2){var _0x3935c0='';var _0x5a66b7='';return db['FreshsalesAccount'][_0x4a67('0x42')]({'where':{'id':_0x3fe54e[_0x4a67('0x40')]['id']},'attributes':['id',_0x4a67('0x50'),_0x4a67('0x51'),_0x4a67('0x52')]})[_0x4a67('0x20')](handleEntityNotFound(_0x15a58e,null))[_0x4a67('0x20')](function(_0x428a53){if(_0x428a53){_0x5a66b7=_0x428a53[_0x4a67('0x50')];_0x3935c0=_0x428a53['remoteUri'];var _0x1ba00c=_0x428a53[_0x4a67('0x51')][_0x4a67('0x53')](-0x1);if(_0x1ba00c==='/'){_0x3935c0=_0x3935c0[_0x4a67('0x54')](0x0,_0x3935c0['lastIndexOf'](_0x1ba00c));}return rp({'method':_0x4a67('0x55'),'uri':util[_0x4a67('0x56')]('%s%s',_0x3935c0,'/api/selector/owners'),'headers':{'Authorization':'Token\x20token='+_0x428a53[_0x4a67('0x52')]},'json':!![]});}})[_0x4a67('0x20')](function(_0x273ad2){if(_0x273ad2){var _0x40b28a=_0x273ad2[_0x4a67('0x57')];var _0xe86034=![];var _0x4d1905=null;for(_0x4d1905=0x0;_0x4d1905<_0x40b28a[_0x4a67('0x31')];_0x4d1905++){if(_0x40b28a[_0x4d1905][_0x4a67('0x58')]===_0x5a66b7){_0xe86034=!![];}}if(_0xe86034){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x4a67('0x59')});}}})['then'](respondWithResult(_0x15a58e,null))['catch'](function(_0x339ae5){var _0x218f4d=_0x3fe54e[_0x4a67('0x2b')][_0x4a67('0x5a')]?0x1f4:_0x339ae5[_0x4a67('0x5b')]||0x1f4;logger['error'](_0x4a67('0x5c'),_0x4a67('0x4f'),_0x218f4d,JSON[_0x4a67('0x5d')](_0x339ae5));delete _0x339ae5['name'];if(_0x218f4d===0x191){_0x218f4d=0x190;}_0x15a58e['status'](_0x218f4d)[_0x4a67('0x24')](_0x3fe54e[_0x4a67('0x2b')][_0x4a67('0x5a')]?{'message':_0x4a67('0x5e'),'statusCode':_0x339ae5['statusCode']}:_0x339ae5);});}; \ No newline at end of file +var _0x24d6=['VIRTUAL','includeAll','include','findAll','rows','params','rawAttributes','keys','length','options','find','create','update','body','destroy','getConfigurations','findOne','nolimit','catch','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesConfiguration','FreshsalesField','getFields','username','apiKey','remoteUri','slice','substring','GET','%s%s','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','stringify','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','error','name','send','map','FreshsalesAccount','fieldName','key','model','query','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','filter','merge','type'];(function(_0x48f3f5,_0x2a82f1){var _0x2b4746=function(_0x3f7067){while(--_0x3f7067){_0x48f3f5['push'](_0x48f3f5['shift']());}};_0x2b4746(++_0x2a82f1);}(_0x24d6,0x8c));var _0x624d=function(_0x1ca4c3,_0x554126){_0x1ca4c3=_0x1ca4c3-0x0;var _0x4426a6=_0x24d6[_0x1ca4c3];return _0x4426a6;};'use strict';var emlformat=require(_0x624d('0x0'));var rimraf=require(_0x624d('0x1'));var zipdir=require(_0x624d('0x2'));var jsonpatch=require(_0x624d('0x3'));var rp=require(_0x624d('0x4'));var moment=require(_0x624d('0x5'));var BPromise=require(_0x624d('0x6'));var Mustache=require('mustache');var util=require(_0x624d('0x7'));var path=require(_0x624d('0x8'));var sox=require(_0x624d('0x9'));var csv=require(_0x624d('0xa'));var ejs=require(_0x624d('0xb'));var fs=require('fs');var fs_extra=require(_0x624d('0xc'));var _=require('lodash');var squel=require(_0x624d('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x624d('0xe'));var Papa=require(_0x624d('0xf'));var Redis=require(_0x624d('0x10'));var authService=require(_0x624d('0x11'));var qs=require(_0x624d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x624d('0x13'));var logger=require(_0x624d('0x14'))(_0x624d('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x57bbac,_0x217946){_0x217946=_0x217946||0xcc;return function(_0x25b5c7){if(_0x25b5c7){return _0x57bbac[_0x624d('0x16')](_0x217946);}return _0x57bbac[_0x624d('0x17')](_0x217946)[_0x624d('0x18')]();};}function respondWithResult(_0x3a2bab,_0x1321db){_0x1321db=_0x1321db||0xc8;return function(_0x5c7e3b){if(_0x5c7e3b){return _0x3a2bab[_0x624d('0x17')](_0x1321db)[_0x624d('0x19')](_0x5c7e3b);}};}function respondWithFilteredResult(_0x5f5038,_0xd6f58e){return function(_0x2b6f88){if(_0x2b6f88){var _0x2af958=typeof _0xd6f58e[_0x624d('0x1a')]===_0x624d('0x1b')&&typeof _0xd6f58e[_0x624d('0x1c')]==='undefined';var _0x15b455=_0x2b6f88['count'];var _0x5845e1=_0x2af958?0x0:_0xd6f58e[_0x624d('0x1a')];var _0x8cff49=_0x2af958?_0x2b6f88[_0x624d('0x1d')]:_0xd6f58e[_0x624d('0x1a')]+_0xd6f58e[_0x624d('0x1c')];var _0x51aeb9;if(_0x8cff49>=_0x15b455){_0x8cff49=_0x15b455;_0x51aeb9=0xc8;}else{_0x51aeb9=0xce;}_0x5f5038[_0x624d('0x17')](_0x51aeb9);return _0x5f5038['set'](_0x624d('0x1e'),_0x5845e1+'-'+_0x8cff49+'/'+_0x15b455)[_0x624d('0x19')](_0x2b6f88);}return null;};}function patchUpdates(_0x2e006a){return function(_0x5b5ffe){try{jsonpatch[_0x624d('0x1f')](_0x5b5ffe,_0x2e006a,!![]);}catch(_0x2ce59d){return BPromise[_0x624d('0x20')](_0x2ce59d);}return _0x5b5ffe[_0x624d('0x21')]();};}function saveUpdates(_0x43a4bc,_0x16cc70){return function(_0x16af7a){if(_0x16af7a){return _0x16af7a['update'](_0x43a4bc)[_0x624d('0x22')](function(_0x4f4358){return _0x4f4358;});}return null;};}function removeEntity(_0xad8110,_0x3a6130){return function(_0x53deed){if(_0x53deed){return _0x53deed['destroy']()[_0x624d('0x22')](function(){_0xad8110[_0x624d('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x86d992,_0x527461){return function(_0x5f5b21){if(!_0x5f5b21){_0x86d992['sendStatus'](0x194);}return _0x5f5b21;};}function handleError(_0x181c04,_0x7d4268){_0x7d4268=_0x7d4268||0x1f4;return function(_0x4ae956){logger[_0x624d('0x23')](_0x4ae956['stack']);if(_0x4ae956[_0x624d('0x24')]){delete _0x4ae956['name'];}_0x181c04[_0x624d('0x17')](_0x7d4268)[_0x624d('0x25')](_0x4ae956);};}exports['index']=function(_0x23daaf,_0x1fe2a1){var _0x106577={},_0x3982d4={},_0x2232ea={'count':0x0,'rows':[]};var _0x43f6ba=_[_0x624d('0x26')](db[_0x624d('0x27')]['rawAttributes'],function(_0xc32876){return{'name':_0xc32876[_0x624d('0x28')],'type':_0xc32876['type'][_0x624d('0x29')]};});_0x3982d4[_0x624d('0x2a')]=_[_0x624d('0x26')](_0x43f6ba,_0x624d('0x24'));_0x3982d4[_0x624d('0x2b')]=_['keys'](_0x23daaf['query']);_0x3982d4['filters']=_[_0x624d('0x2c')](_0x3982d4[_0x624d('0x2a')],_0x3982d4['query']);_0x106577[_0x624d('0x2d')]=_[_0x624d('0x2c')](_0x3982d4[_0x624d('0x2a')],qs[_0x624d('0x2e')](_0x23daaf[_0x624d('0x2b')][_0x624d('0x2e')]));_0x106577['attributes']=_0x106577[_0x624d('0x2d')]['length']?_0x106577['attributes']:_0x3982d4[_0x624d('0x2a')];if(!_0x23daaf[_0x624d('0x2b')][_0x624d('0x2f')]('nolimit')){_0x106577[_0x624d('0x1c')]=qs[_0x624d('0x1c')](_0x23daaf[_0x624d('0x2b')][_0x624d('0x1c')]);_0x106577[_0x624d('0x1a')]=qs[_0x624d('0x1a')](_0x23daaf[_0x624d('0x2b')][_0x624d('0x1a')]);}_0x106577[_0x624d('0x30')]=qs[_0x624d('0x31')](_0x23daaf[_0x624d('0x2b')][_0x624d('0x31')]);_0x106577[_0x624d('0x32')]=qs[_0x624d('0x33')](_[_0x624d('0x34')](_0x23daaf['query'],_0x3982d4[_0x624d('0x33')]),_0x43f6ba);if(_0x23daaf[_0x624d('0x2b')][_0x624d('0x35')]){_0x106577[_0x624d('0x32')]=_[_0x624d('0x36')](_0x106577['where'],{'$or':_[_0x624d('0x26')](_0x43f6ba,function(_0x54d44d){if(_0x54d44d[_0x624d('0x37')]!==_0x624d('0x38')){var _0x563308={};_0x563308[_0x54d44d[_0x624d('0x24')]]={'$like':'%'+_0x23daaf[_0x624d('0x2b')]['filter']+'%'};return _0x563308;}})});}_0x106577=_[_0x624d('0x36')]({},_0x106577,_0x23daaf['options']);var _0x5c9019={'where':_0x106577[_0x624d('0x32')]};return db[_0x624d('0x27')][_0x624d('0x1d')](_0x5c9019)[_0x624d('0x22')](function(_0x5bb24c){_0x2232ea[_0x624d('0x1d')]=_0x5bb24c;if(_0x23daaf[_0x624d('0x2b')][_0x624d('0x39')]){_0x106577[_0x624d('0x3a')]=[{'all':!![]}];}return db[_0x624d('0x27')][_0x624d('0x3b')](_0x106577);})[_0x624d('0x22')](function(_0x2e1bff){_0x2232ea[_0x624d('0x3c')]=_0x2e1bff;return _0x2232ea;})[_0x624d('0x22')](respondWithFilteredResult(_0x1fe2a1,_0x106577))['catch'](handleError(_0x1fe2a1,null));};exports['show']=function(_0xea6f2c,_0x4dc638){var _0x4c23df={'raw':![],'where':{'id':_0xea6f2c[_0x624d('0x3d')]['id']}},_0x4891c9={};_0x4891c9[_0x624d('0x2a')]=_['keys'](db['FreshsalesAccount'][_0x624d('0x3e')]);_0x4891c9[_0x624d('0x2b')]=_[_0x624d('0x3f')](_0xea6f2c[_0x624d('0x2b')]);_0x4891c9['filters']=_[_0x624d('0x2c')](_0x4891c9[_0x624d('0x2a')],_0x4891c9['query']);_0x4c23df[_0x624d('0x2d')]=_[_0x624d('0x2c')](_0x4891c9[_0x624d('0x2a')],qs[_0x624d('0x2e')](_0xea6f2c['query'][_0x624d('0x2e')]));_0x4c23df[_0x624d('0x2d')]=_0x4c23df['attributes'][_0x624d('0x40')]?_0x4c23df[_0x624d('0x2d')]:_0x4891c9[_0x624d('0x2a')];if(_0xea6f2c['query'][_0x624d('0x39')]){_0x4c23df[_0x624d('0x3a')]=[{'all':!![]}];}_0x4c23df=_[_0x624d('0x36')]({},_0x4c23df,_0xea6f2c[_0x624d('0x41')]);return db['FreshsalesAccount'][_0x624d('0x42')](_0x4c23df)['then'](handleEntityNotFound(_0x4dc638,null))[_0x624d('0x22')](respondWithResult(_0x4dc638,null))['catch'](handleError(_0x4dc638,null));};exports[_0x624d('0x43')]=function(_0x4501ca,_0x2f153e){return db[_0x624d('0x27')][_0x624d('0x43')](_0x4501ca['body'],{})[_0x624d('0x22')](respondWithResult(_0x2f153e,0xc9))['catch'](handleError(_0x2f153e,null));};exports[_0x624d('0x44')]=function(_0x1e97f4,_0x3fc8b1){if(_0x1e97f4[_0x624d('0x45')]['id']){delete _0x1e97f4[_0x624d('0x45')]['id'];}return db[_0x624d('0x27')][_0x624d('0x42')]({'where':{'id':_0x1e97f4[_0x624d('0x3d')]['id']}})['then'](handleEntityNotFound(_0x3fc8b1,null))['then'](saveUpdates(_0x1e97f4[_0x624d('0x45')],null))[_0x624d('0x22')](respondWithResult(_0x3fc8b1,null))['catch'](handleError(_0x3fc8b1,null));};exports[_0x624d('0x46')]=function(_0x5459d5,_0x1099df){return db[_0x624d('0x27')][_0x624d('0x42')]({'where':{'id':_0x5459d5[_0x624d('0x3d')]['id']}})[_0x624d('0x22')](handleEntityNotFound(_0x1099df,null))[_0x624d('0x22')](removeEntity(_0x1099df,null))['catch'](handleError(_0x1099df,null));};exports[_0x624d('0x47')]=function(_0x53dee5,_0x283462,_0xd0e712){var _0x3e00f8={};var _0x56fbf5={};var _0x4b4c3a;var _0x36f47a;return db['FreshsalesAccount'][_0x624d('0x48')]({'where':{'id':_0x53dee5[_0x624d('0x3d')]['id']}})['then'](handleEntityNotFound(_0x283462,null))['then'](function(_0x5a6df8){if(_0x5a6df8){_0x4b4c3a=_0x5a6df8;_0x56fbf5[_0x624d('0x2a')]=_[_0x624d('0x3f')](db['FreshsalesConfiguration'][_0x624d('0x3e')]);_0x56fbf5[_0x624d('0x2b')]=_[_0x624d('0x3f')](_0x53dee5[_0x624d('0x2b')]);_0x56fbf5[_0x624d('0x33')]=_['intersection'](_0x56fbf5[_0x624d('0x2a')],_0x56fbf5['query']);_0x3e00f8[_0x624d('0x2d')]=_[_0x624d('0x2c')](_0x56fbf5[_0x624d('0x2a')],qs[_0x624d('0x2e')](_0x53dee5['query']['fields']));_0x3e00f8[_0x624d('0x2d')]=_0x3e00f8[_0x624d('0x2d')][_0x624d('0x40')]?_0x3e00f8['attributes']:_0x56fbf5['model'];_0x3e00f8[_0x624d('0x30')]=qs[_0x624d('0x31')](_0x53dee5['query'][_0x624d('0x31')]);_0x3e00f8['where']=qs[_0x624d('0x33')](_[_0x624d('0x34')](_0x53dee5['query'],_0x56fbf5['filters']));if(_0x53dee5[_0x624d('0x2b')][_0x624d('0x35')]){_0x3e00f8[_0x624d('0x32')]=_['merge'](_0x3e00f8[_0x624d('0x32')],{'$or':_[_0x624d('0x26')](_0x3e00f8[_0x624d('0x2d')],function(_0x53d102){var _0x32a996={};_0x32a996[_0x53d102]={'$like':'%'+_0x53dee5[_0x624d('0x2b')]['filter']+'%'};return _0x32a996;})});}_0x3e00f8=_['merge']({},_0x3e00f8,_0x53dee5[_0x624d('0x41')]);return _0x4b4c3a[_0x624d('0x47')](_0x3e00f8);}})[_0x624d('0x22')](function(_0x16da3e){if(_0x16da3e){_0x36f47a=_0x16da3e[_0x624d('0x40')];if(!_0x53dee5[_0x624d('0x2b')]['hasOwnProperty'](_0x624d('0x49'))){_0x3e00f8['limit']=qs[_0x624d('0x1c')](_0x53dee5[_0x624d('0x2b')][_0x624d('0x1c')]);_0x3e00f8[_0x624d('0x1a')]=qs['offset'](_0x53dee5[_0x624d('0x2b')][_0x624d('0x1a')]);}return _0x4b4c3a[_0x624d('0x47')](_0x3e00f8);}})['then'](function(_0x128c3b){if(_0x128c3b){return _0x128c3b?{'count':_0x36f47a,'rows':_0x128c3b}:null;}})[_0x624d('0x22')](respondWithResult(_0x283462,null))[_0x624d('0x4a')](handleError(_0x283462,null));};exports['addConfiguration']=function(_0x31885e,_0x426e95,_0x50f5d8){if(_0x31885e[_0x624d('0x45')]['id']){delete _0x31885e[_0x624d('0x45')]['id'];}return db[_0x624d('0x27')][_0x624d('0x48')]({'where':{'id':_0x31885e[_0x624d('0x3d')]['id']}})[_0x624d('0x22')](handleEntityNotFound(_0x426e95,null))[_0x624d('0x22')](function(_0x4dcad3){if(_0x4dcad3){_0x31885e[_0x624d('0x45')][_0x624d('0x4b')]=_0x4dcad3['id'];_0x31885e[_0x624d('0x45')][_0x624d('0x4c')]=integrations[_0x624d('0x4d')](_0x31885e[_0x624d('0x45')][_0x624d('0x4e')],_0x31885e[_0x624d('0x45')][_0x624d('0x37')]);_0x31885e['body'][_0x624d('0x4f')]=integrations[_0x624d('0x50')](_0x31885e[_0x624d('0x45')][_0x624d('0x4e')],_0x31885e[_0x624d('0x45')][_0x624d('0x37')]);return db[_0x624d('0x51')][_0x624d('0x43')](_0x31885e['body'],{'include':[{'model':db[_0x624d('0x52')],'as':_0x624d('0x4c')},{'model':db[_0x624d('0x52')],'as':_0x624d('0x4f')}]});}return null;})['then'](respondWithResult(_0x426e95,null))[_0x624d('0x4a')](handleError(_0x426e95,null));};exports[_0x624d('0x53')]=function(_0x275cbf,_0x2c51cc,_0x5eb2de){var _0x538bf6='';var _0x12333b='';return db[_0x624d('0x27')]['findOne']({'where':{'id':_0x275cbf[_0x624d('0x3d')]['id']},'attributes':['id',_0x624d('0x54'),'remoteUri',_0x624d('0x55')]})['then'](handleEntityNotFound(_0x2c51cc,null))['then'](function(_0x54b9bb){if(_0x54b9bb){_0x12333b=_0x54b9bb[_0x624d('0x54')];_0x538bf6=_0x54b9bb[_0x624d('0x56')];var _0x5e6acc=_0x54b9bb['remoteUri'][_0x624d('0x57')](-0x1);if(_0x5e6acc==='/'){_0x538bf6=_0x538bf6[_0x624d('0x58')](0x0,_0x538bf6['lastIndexOf'](_0x5e6acc));}return rp({'method':_0x624d('0x59'),'uri':util['format'](_0x624d('0x5a'),_0x538bf6,'/api/selector/owners'),'headers':{'Authorization':_0x624d('0x5b')+_0x54b9bb['apiKey']},'json':!![]});}})[_0x624d('0x22')](function(_0x422ce4){if(_0x422ce4){var _0x4c3d12=_0x422ce4[_0x624d('0x5c')];var _0x14d145=![];var _0x4345a9=null;for(_0x4345a9=0x0;_0x4345a9<_0x4c3d12[_0x624d('0x40')];_0x4345a9++){if(_0x4c3d12[_0x4345a9][_0x624d('0x5d')]===_0x12333b){_0x14d145=!![];}}if(_0x14d145){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x624d('0x5e')});}}})[_0x624d('0x22')](respondWithResult(_0x2c51cc,null))[_0x624d('0x4a')](function(_0x3c7c3a){var _0x3a440c=_0x275cbf[_0x624d('0x2b')][_0x624d('0x5f')]?0x1f4:_0x3c7c3a[_0x624d('0x60')]||0x1f4;logger[_0x624d('0x23')]('getFields,\x20%s,\x20%s,\x20%s',_0x624d('0x53'),_0x3a440c,JSON[_0x624d('0x61')](_0x3c7c3a));delete _0x3c7c3a[_0x624d('0x24')];if(_0x3a440c===0x191){_0x3a440c=0x190;}_0x2c51cc[_0x624d('0x17')](_0x3a440c)[_0x624d('0x25')](_0x275cbf[_0x624d('0x2b')][_0x624d('0x5f')]?{'message':'Wrong\x20credentials','statusCode':_0x3c7c3a[_0x624d('0x60')]}:_0x3c7c3a);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 8fb3ae5..4d7f3e4 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 _0xe5af=['FreshsalesAccount','int_freshsales_accounts','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../components/integrations/configuration','exports','define'];(function(_0x12de61,_0x4b56a4){var _0xb3684f=function(_0x27fa50){while(--_0x27fa50){_0x12de61['push'](_0x12de61['shift']());}};_0xb3684f(++_0x4b56a4);}(_0xe5af,0x9c));var _0xfe5a=function(_0x588945,_0x4af238){_0x588945=_0x588945-0x0;var _0x509466=_0xe5af[_0x588945];return _0x509466;};'use strict';var _=require('lodash');var util=require(_0xfe5a('0x0'));var logger=require(_0xfe5a('0x1'))('api');var moment=require(_0xfe5a('0x2'));var BPromise=require(_0xfe5a('0x3'));var rp=require(_0xfe5a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfe5a('0x5'));var config=require('../../config/environment');var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0xfe5a('0x6'));module[_0xfe5a('0x7')]=function(_0x4e418f,_0x5eea2e){return _0x4e418f[_0xfe5a('0x8')](_0xfe5a('0x9'),attributes,{'tableName':_0xfe5a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x01d9=['bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','define','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api'];(function(_0x50caca,_0x212602){var _0x1abd60=function(_0x1d71aa){while(--_0x1d71aa){_0x50caca['push'](_0x50caca['shift']());}};_0x1abd60(++_0x212602);}(_0x01d9,0x6c));var _0x901d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x01d9[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x901d('0x0'));var util=require(_0x901d('0x1'));var logger=require(_0x901d('0x2'))(_0x901d('0x3'));var moment=require('moment');var BPromise=require(_0x901d('0x4'));var rp=require(_0x901d('0x5'));var fs=require('fs');var path=require(_0x901d('0x6'));var rimraf=require(_0x901d('0x7'));var config=require(_0x901d('0x8'));var attributes=require(_0x901d('0x9'));var integrations=require(_0x901d('0xa'));module['exports']=function(_0x1e5d7d,_0x6c9ac8){return _0x1e5d7d[_0x901d('0xb')](_0x901d('0xc'),attributes,{'tableName':_0x901d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index cd5c1bf..1acf9e1 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 _0x32b6=['raw','where','attributes','limit','include','map','model','catch','ShowFreshsalesAccount','find','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','request\x20sent','stringify','error','code','FreshsalesAccount,\x20%s,\x20%s','message','info','GetFreshsalesAccount','FreshsalesAccount','findAll','options'];(function(_0x1aef6b,_0x5b8c20){var _0x4302e2=function(_0x2a4f4b){while(--_0x2a4f4b){_0x1aef6b['push'](_0x1aef6b['shift']());}};_0x4302e2(++_0x5b8c20);}(_0x32b6,0x1d1));var _0x632b=function(_0x231057,_0x253d43){_0x231057=_0x231057-0x0;var _0x1222cc=_0x32b6[_0x231057];return _0x1222cc;};'use strict';var _=require(_0x632b('0x0'));var util=require(_0x632b('0x1'));var moment=require('moment');var BPromise=require(_0x632b('0x2'));var rs=require(_0x632b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x632b('0x4'));var logger=require(_0x632b('0x5'))(_0x632b('0x6'));var config=require(_0x632b('0x7'));var jayson=require(_0x632b('0x8'));var client=jayson[_0x632b('0x9')][_0x632b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x10458a,_0x3bbf43,_0x43d6c7){return new BPromise(function(_0x5128f5,_0x33d711){return client[_0x632b('0xb')](_0x10458a,_0x43d6c7)[_0x632b('0xc')](function(_0x174201){logger['info']('FreshsalesAccount,\x20%s,\x20%s',_0x3bbf43,'request\x20sent');logger[_0x632b('0xd')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x3bbf43,_0x632b('0xe'),JSON[_0x632b('0xf')](_0x174201));if(_0x174201[_0x632b('0x10')]){if(_0x174201[_0x632b('0x10')][_0x632b('0x11')]===0x1f4){logger[_0x632b('0x10')](_0x632b('0x12'),_0x3bbf43,_0x174201[_0x632b('0x10')][_0x632b('0x13')]);return _0x33d711(_0x174201['error'][_0x632b('0x13')]);}logger[_0x632b('0x10')](_0x632b('0x12'),_0x3bbf43,_0x174201['error'][_0x632b('0x13')]);return _0x5128f5(_0x174201[_0x632b('0x10')][_0x632b('0x13')]);}else{logger[_0x632b('0x14')](_0x632b('0x12'),_0x3bbf43,_0x632b('0xe'));_0x5128f5(_0x174201['result'][_0x632b('0x13')]);}})['catch'](function(_0x4fdef2){logger[_0x632b('0x10')]('FreshsalesAccount,\x20%s,\x20%s',_0x3bbf43,_0x4fdef2);_0x33d711(_0x4fdef2);});});}exports[_0x632b('0x15')]=function(_0x3bb27f){var _0x28c472=this;return new Promise(function(_0x51c894,_0x2f3e88){return db[_0x632b('0x16')][_0x632b('0x17')]({'raw':_0x3bb27f[_0x632b('0x18')]?_0x3bb27f['options'][_0x632b('0x19')]===undefined?!![]:![]:!![],'where':_0x3bb27f[_0x632b('0x18')]?_0x3bb27f['options'][_0x632b('0x1a')]||null:null,'attributes':_0x3bb27f['options']?_0x3bb27f['options'][_0x632b('0x1b')]||null:null,'limit':_0x3bb27f['options']?_0x3bb27f[_0x632b('0x18')][_0x632b('0x1c')]||null:null,'include':_0x3bb27f[_0x632b('0x18')]?_0x3bb27f['options'][_0x632b('0x1d')]?_[_0x632b('0x1e')](_0x3bb27f['options'][_0x632b('0x1d')],function(_0x379dc2){return{'model':db[_0x379dc2[_0x632b('0x1f')]],'as':_0x379dc2['as'],'attributes':_0x379dc2[_0x632b('0x1b')],'include':_0x379dc2[_0x632b('0x1d')]?_[_0x632b('0x1e')](_0x379dc2['include'],function(_0x5e7b20){return{'model':db[_0x5e7b20[_0x632b('0x1f')]],'as':_0x5e7b20['as'],'attributes':_0x5e7b20['attributes'],'include':_0x5e7b20[_0x632b('0x1d')]?_[_0x632b('0x1e')](_0x5e7b20['include'],function(_0x273e89){return{'model':db[_0x273e89[_0x632b('0x1f')]],'as':_0x273e89['as'],'attributes':_0x273e89[_0x632b('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x632b('0xc')](function(_0x4728a8){logger[_0x632b('0x14')](_0x632b('0x15'),_0x3bb27f);logger[_0x632b('0xd')](_0x632b('0x15'),_0x3bb27f,JSON['stringify'](_0x4728a8));_0x51c894(_0x4728a8);})[_0x632b('0x20')](function(_0x35348e){logger[_0x632b('0x10')](_0x632b('0x15'),_0x35348e[_0x632b('0x13')],_0x3bb27f);_0x2f3e88(_0x28c472[_0x632b('0x10')](0x1f4,_0x35348e[_0x632b('0x13')]));});});};exports[_0x632b('0x21')]=function(_0x1ace1b){var _0x319df3=this;return new Promise(function(_0x417793,_0x35584f){return db[_0x632b('0x16')][_0x632b('0x22')]({'raw':_0x1ace1b[_0x632b('0x18')]?_0x1ace1b[_0x632b('0x18')][_0x632b('0x19')]===undefined?!![]:![]:!![],'where':_0x1ace1b[_0x632b('0x18')]?_0x1ace1b[_0x632b('0x18')][_0x632b('0x1a')]||null:null,'attributes':_0x1ace1b['options']?_0x1ace1b[_0x632b('0x18')][_0x632b('0x1b')]||null:null,'include':_0x1ace1b[_0x632b('0x18')]?_0x1ace1b[_0x632b('0x18')]['include']?_[_0x632b('0x1e')](_0x1ace1b['options'][_0x632b('0x1d')],function(_0x15b22d){return{'model':db[_0x15b22d['model']],'as':_0x15b22d['as'],'attributes':_0x15b22d[_0x632b('0x1b')],'include':_0x15b22d[_0x632b('0x1d')]?_[_0x632b('0x1e')](_0x15b22d[_0x632b('0x1d')],function(_0x27bbf5){return{'model':db[_0x27bbf5[_0x632b('0x1f')]],'as':_0x27bbf5['as'],'attributes':_0x27bbf5[_0x632b('0x1b')],'include':_0x27bbf5[_0x632b('0x1d')]?_['map'](_0x27bbf5['include'],function(_0x22ae6a){return{'model':db[_0x22ae6a[_0x632b('0x1f')]],'as':_0x22ae6a['as'],'attributes':_0x22ae6a[_0x632b('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x632b('0xc')](function(_0x384420){logger[_0x632b('0x14')](_0x632b('0x21'),_0x1ace1b);logger[_0x632b('0xd')]('ShowFreshsalesAccount',_0x1ace1b,JSON['stringify'](_0x384420));_0x417793(_0x384420);})[_0x632b('0x20')](function(_0x581b92){logger[_0x632b('0x10')](_0x632b('0x21'),_0x581b92[_0x632b('0x13')],_0x1ace1b);_0x35584f(_0x319df3[_0x632b('0x10')](0x1f4,_0x581b92[_0x632b('0x13')]));});});}; \ No newline at end of file +var _0xc4aa=['bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','limit','include','map','model','stringify','ShowFreshsalesAccount','lodash','util','moment'];(function(_0x161020,_0x467abe){var _0x360356=function(_0x56a2ec){while(--_0x56a2ec){_0x161020['push'](_0x161020['shift']());}};_0x360356(++_0x467abe);}(_0xc4aa,0x1b7));var _0xac4a=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xc4aa[_0xa148b7];return _0x51efd3;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});}exports[_0xac4a('0x15')]=function(_0x28e304){var _0x44ec59=this;return new Promise(function(_0x546c5d,_0x5ac21e){return db[_0xac4a('0x16')][_0xac4a('0x17')]({'raw':_0x28e304[_0xac4a('0x18')]?_0x28e304['options'][_0xac4a('0x19')]===undefined?!![]:![]:!![],'where':_0x28e304[_0xac4a('0x18')]?_0x28e304[_0xac4a('0x18')][_0xac4a('0x1a')]||null:null,'attributes':_0x28e304[_0xac4a('0x18')]?_0x28e304[_0xac4a('0x18')][_0xac4a('0x1b')]||null:null,'limit':_0x28e304[_0xac4a('0x18')]?_0x28e304['options'][_0xac4a('0x1c')]||null:null,'include':_0x28e304[_0xac4a('0x18')]?_0x28e304['options'][_0xac4a('0x1d')]?_[_0xac4a('0x1e')](_0x28e304[_0xac4a('0x18')][_0xac4a('0x1d')],function(_0x4d2d6c){return{'model':db[_0x4d2d6c[_0xac4a('0x1f')]],'as':_0x4d2d6c['as'],'attributes':_0x4d2d6c[_0xac4a('0x1b')],'include':_0x4d2d6c[_0xac4a('0x1d')]?_[_0xac4a('0x1e')](_0x4d2d6c[_0xac4a('0x1d')],function(_0x2b0dc2){return{'model':db[_0x2b0dc2[_0xac4a('0x1f')]],'as':_0x2b0dc2['as'],'attributes':_0x2b0dc2[_0xac4a('0x1b')],'include':_0x2b0dc2[_0xac4a('0x1d')]?_[_0xac4a('0x1e')](_0x2b0dc2[_0xac4a('0x1d')],function(_0x215a31){return{'model':db[_0x215a31[_0xac4a('0x1f')]],'as':_0x215a31['as'],'attributes':_0x215a31[_0xac4a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xac4a('0xc')](function(_0x20202c){logger['info'](_0xac4a('0x15'),_0x28e304);logger[_0xac4a('0xf')](_0xac4a('0x15'),_0x28e304,JSON[_0xac4a('0x20')](_0x20202c));_0x546c5d(_0x20202c);})[_0xac4a('0x14')](function(_0x4a5a9e){logger['error'](_0xac4a('0x15'),_0x4a5a9e[_0xac4a('0x12')],_0x28e304);_0x5ac21e(_0x44ec59[_0xac4a('0x10')](0x1f4,_0x4a5a9e['message']));});});};exports['ShowFreshsalesAccount']=function(_0x355755){var _0x2896bc=this;return new Promise(function(_0x228629,_0x432066){return db[_0xac4a('0x16')]['find']({'raw':_0x355755[_0xac4a('0x18')]?_0x355755['options'][_0xac4a('0x19')]===undefined?!![]:![]:!![],'where':_0x355755['options']?_0x355755[_0xac4a('0x18')][_0xac4a('0x1a')]||null:null,'attributes':_0x355755[_0xac4a('0x18')]?_0x355755[_0xac4a('0x18')][_0xac4a('0x1b')]||null:null,'include':_0x355755[_0xac4a('0x18')]?_0x355755[_0xac4a('0x18')][_0xac4a('0x1d')]?_[_0xac4a('0x1e')](_0x355755[_0xac4a('0x18')][_0xac4a('0x1d')],function(_0x1634df){return{'model':db[_0x1634df[_0xac4a('0x1f')]],'as':_0x1634df['as'],'attributes':_0x1634df[_0xac4a('0x1b')],'include':_0x1634df['include']?_[_0xac4a('0x1e')](_0x1634df[_0xac4a('0x1d')],function(_0x5a4e2b){return{'model':db[_0x5a4e2b[_0xac4a('0x1f')]],'as':_0x5a4e2b['as'],'attributes':_0x5a4e2b[_0xac4a('0x1b')],'include':_0x5a4e2b['include']?_['map'](_0x5a4e2b[_0xac4a('0x1d')],function(_0x1ba096){return{'model':db[_0x1ba096[_0xac4a('0x1f')]],'as':_0x1ba096['as'],'attributes':_0x1ba096[_0xac4a('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x453d02){logger[_0xac4a('0x13')]('ShowFreshsalesAccount',_0x355755);logger[_0xac4a('0xf')](_0xac4a('0x21'),_0x355755,JSON[_0xac4a('0x20')](_0x453d02));_0x228629(_0x453d02);})['catch'](function(_0x121328){logger[_0xac4a('0x10')](_0xac4a('0x21'),_0x121328['message'],_0x355755);_0x432066(_0x2896bc[_0xac4a('0x10')](0x1f4,_0x121328[_0xac4a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index d36a9c9..0e1f353 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 _0xcbe8=['getFields','post','create','put','delete','destroy','exports','multer','express','../../config/environment','./intFreshsalesConfiguration.controller','isAuthenticated','/:id','show','get','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields'];(function(_0x1fc080,_0xadb20d){var _0x15f3e6=function(_0x3d3eb8){while(--_0x3d3eb8){_0x1fc080['push'](_0x1fc080['shift']());}};_0x15f3e6(++_0xadb20d);}(_0xcbe8,0xf7));var _0x8cbe=function(_0x1c6865,_0x51bfbd){_0x1c6865=_0x1c6865-0x0;var _0x48bf38=_0xcbe8[_0x1c6865];return _0x48bf38;};'use strict';var multer=require(_0x8cbe('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8cbe('0x1'));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(_0x8cbe('0x2'));var controller=require(_0x8cbe('0x3'));router['get']('/',auth[_0x8cbe('0x4')](),controller['index']);router['get'](_0x8cbe('0x5'),auth[_0x8cbe('0x4')](),controller[_0x8cbe('0x6')]);router[_0x8cbe('0x7')](_0x8cbe('0x8'),auth[_0x8cbe('0x4')](),controller[_0x8cbe('0x9')]);router['get'](_0x8cbe('0xa'),auth[_0x8cbe('0x4')](),controller[_0x8cbe('0xb')]);router['get'](_0x8cbe('0xc'),auth['isAuthenticated'](),controller[_0x8cbe('0xd')]);router[_0x8cbe('0xe')]('/',auth['isAuthenticated'](),controller[_0x8cbe('0xf')]);router[_0x8cbe('0x10')](_0x8cbe('0x5'),auth[_0x8cbe('0x4')](),controller['update']);router[_0x8cbe('0x11')](_0x8cbe('0x5'),auth[_0x8cbe('0x4')](),controller[_0x8cbe('0x12')]);module[_0x8cbe('0x13')]=router; \ No newline at end of file +var _0xa704=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','getSubjects','getDescriptions','/:id/fields','getFields','post','create','put','destroy','exports'];(function(_0x50fdc5,_0x1797f0){var _0x4b0c78=function(_0xedf9f6){while(--_0xedf9f6){_0x50fdc5['push'](_0x50fdc5['shift']());}};_0x4b0c78(++_0x1797f0);}(_0xa704,0x177));var _0x4a70=function(_0x51356c,_0x501f0c){_0x51356c=_0x51356c-0x0;var _0x2ebe29=_0xa704[_0x51356c];return _0x2ebe29;};'use strict';var multer=require(_0x4a70('0x0'));var util=require(_0x4a70('0x1'));var path=require(_0x4a70('0x2'));var timeout=require(_0x4a70('0x3'));var express=require(_0x4a70('0x4'));var router=express[_0x4a70('0x5')]();var fs_extra=require(_0x4a70('0x6'));var auth=require(_0x4a70('0x7'));var interaction=require(_0x4a70('0x8'));var config=require(_0x4a70('0x9'));var controller=require(_0x4a70('0xa'));router[_0x4a70('0xb')]('/',auth[_0x4a70('0xc')](),controller[_0x4a70('0xd')]);router[_0x4a70('0xb')](_0x4a70('0xe'),auth['isAuthenticated'](),controller[_0x4a70('0xf')]);router[_0x4a70('0xb')]('/:id/subjects',auth[_0x4a70('0xc')](),controller[_0x4a70('0x10')]);router['get']('/:id/descriptions',auth[_0x4a70('0xc')](),controller[_0x4a70('0x11')]);router[_0x4a70('0xb')](_0x4a70('0x12'),auth[_0x4a70('0xc')](),controller[_0x4a70('0x13')]);router[_0x4a70('0x14')]('/',auth['isAuthenticated'](),controller[_0x4a70('0x15')]);router[_0x4a70('0x16')](_0x4a70('0xe'),auth[_0x4a70('0xc')](),controller['update']);router['delete'](_0x4a70('0xe'),auth['isAuthenticated'](),controller[_0x4a70('0x17')]);module[_0x4a70('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 96b0068..a2b6c8e 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 _0x2a9e=['exports','STRING'];(function(_0x795091,_0x4c5bc0){var _0x689e6=function(_0x5060ee){while(--_0x5060ee){_0x795091['push'](_0x795091['shift']());}};_0x689e6(++_0x4c5bc0);}(_0x2a9e,0x14c));var _0xe2a9=function(_0x5e0894,_0x9d17b2){_0x5e0894=_0x5e0894-0x0;var _0xaa7229=_0x2a9e[_0x5e0894];return _0xaa7229;};'use strict';var Sequelize=require('sequelize');module[_0xe2a9('0x0')]={'name':{'type':Sequelize[_0xe2a9('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x41bb=['STRING','exports'];(function(_0x2291cb,_0x3d2b79){var _0x53b5d2=function(_0x300c99){while(--_0x300c99){_0x2291cb['push'](_0x2291cb['shift']());}};_0x53b5d2(++_0x3d2b79);}(_0x41bb,0x1bd));var _0xb41b=function(_0x385b10,_0x4fcb6e){_0x385b10=_0x385b10-0x0;var _0x7164dd=_0x41bb[_0x385b10];return _0x7164dd;};'use strict';var Sequelize=require('sequelize');module[_0xb41b('0x0')]={'name':{'type':Sequelize[_0xb41b('0x1')]},'description':{'type':Sequelize[_0xb41b('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 7eb4c5b..ce6a465 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 _0x882c=['options','includeAll','include','rows','catch','show','rawAttributes','find','create','body','update','getSubjects','findOne','params','FreshsalesField','pick','nolimit','getDescriptions','getFields','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','send','index','map','FreshsalesConfiguration','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge'];(function(_0xf79774,_0x2d4d4e){var _0x3bd76d=function(_0x390ad1){while(--_0x390ad1){_0xf79774['push'](_0xf79774['shift']());}};_0x3bd76d(++_0x2d4d4e);}(_0x882c,0xfd));var _0xc882=function(_0x37f212,_0x9bf1b2){_0x37f212=_0x37f212-0x0;var _0x57ba32=_0x882c[_0x37f212];return _0x57ba32;};'use strict';var emlformat=require(_0xc882('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc882('0x1'));var rp=require(_0xc882('0x2'));var moment=require('moment');var BPromise=require(_0xc882('0x3'));var Mustache=require(_0xc882('0x4'));var util=require(_0xc882('0x5'));var path=require(_0xc882('0x6'));var sox=require(_0xc882('0x7'));var csv=require(_0xc882('0x8'));var ejs=require(_0xc882('0x9'));var fs=require('fs');var fs_extra=require(_0xc882('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc882('0x8'));var querystring=require(_0xc882('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc882('0xc'));var qs=require(_0xc882('0xd'));var as=require(_0xc882('0xe'));var hardwareService=require(_0xc882('0xf'));var logger=require(_0xc882('0x10'))('api');var utils=require(_0xc882('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xc882('0x12'));var db=require(_0xc882('0x13'))['db'];function respondWithStatusCode(_0x333cdb,_0x10d0ad){_0x10d0ad=_0x10d0ad||0xcc;return function(_0x12ebc4){if(_0x12ebc4){return _0x333cdb[_0xc882('0x14')](_0x10d0ad);}return _0x333cdb[_0xc882('0x15')](_0x10d0ad)[_0xc882('0x16')]();};}function respondWithResult(_0x5d1370,_0x19541f){_0x19541f=_0x19541f||0xc8;return function(_0x48ddb2){if(_0x48ddb2){return _0x5d1370[_0xc882('0x15')](_0x19541f)['json'](_0x48ddb2);}};}function respondWithFilteredResult(_0x2bcaeb,_0x4e41d0){return function(_0x6a3def){if(_0x6a3def){var _0x1046ed=typeof _0x4e41d0[_0xc882('0x17')]==='undefined'&&typeof _0x4e41d0[_0xc882('0x18')]===_0xc882('0x19');var _0x252e94=_0x6a3def['count'];var _0x1449f6=_0x1046ed?0x0:_0x4e41d0['offset'];var _0x3b499e=_0x1046ed?_0x6a3def[_0xc882('0x1a')]:_0x4e41d0[_0xc882('0x17')]+_0x4e41d0[_0xc882('0x18')];var _0x38389d;if(_0x3b499e>=_0x252e94){_0x3b499e=_0x252e94;_0x38389d=0xc8;}else{_0x38389d=0xce;}_0x2bcaeb['status'](_0x38389d);return _0x2bcaeb['set'](_0xc882('0x1b'),_0x1449f6+'-'+_0x3b499e+'/'+_0x252e94)[_0xc882('0x1c')](_0x6a3def);}return null;};}function patchUpdates(_0x11ba3f){return function(_0x5524b8){try{jsonpatch[_0xc882('0x1d')](_0x5524b8,_0x11ba3f,!![]);}catch(_0x46fbcd){return BPromise[_0xc882('0x1e')](_0x46fbcd);}return _0x5524b8[_0xc882('0x1f')]();};}function saveUpdates(_0x3873f5,_0xe572a9){return function(_0x278952){if(_0x278952){return _0x278952['update'](_0x3873f5)[_0xc882('0x20')](function(_0x52b144){return _0x52b144;});}return null;};}function removeEntity(_0x65fd38,_0x4373dc){return function(_0x4bb2fa){if(_0x4bb2fa){return _0x4bb2fa[_0xc882('0x21')]()['then'](function(){_0x65fd38[_0xc882('0x15')](0xcc)[_0xc882('0x16')]();});}};}function handleEntityNotFound(_0x5ca8d6,_0x4278d2){return function(_0x2b0059){if(!_0x2b0059){_0x5ca8d6[_0xc882('0x14')](0x194);}return _0x2b0059;};}function handleError(_0x5c01ed,_0x5e5ab5){_0x5e5ab5=_0x5e5ab5||0x1f4;return function(_0x2d3359){logger[_0xc882('0x22')](_0x2d3359[_0xc882('0x23')]);if(_0x2d3359[_0xc882('0x24')]){delete _0x2d3359[_0xc882('0x24')];}_0x5c01ed[_0xc882('0x15')](_0x5e5ab5)[_0xc882('0x25')](_0x2d3359);};}exports[_0xc882('0x26')]=function(_0x1cc62c,_0x3d9828){var _0x30f86a={},_0x3642ba={},_0x25eb21={'count':0x0,'rows':[]};var _0x572faf=_[_0xc882('0x27')](db[_0xc882('0x28')]['rawAttributes'],function(_0x33f25b){return{'name':_0x33f25b[_0xc882('0x29')],'type':_0x33f25b[_0xc882('0x2a')][_0xc882('0x2b')]};});_0x3642ba[_0xc882('0x2c')]=_[_0xc882('0x27')](_0x572faf,_0xc882('0x24'));_0x3642ba['query']=_[_0xc882('0x2d')](_0x1cc62c[_0xc882('0x2e')]);_0x3642ba[_0xc882('0x2f')]=_[_0xc882('0x30')](_0x3642ba['model'],_0x3642ba['query']);_0x30f86a[_0xc882('0x31')]=_['intersection'](_0x3642ba[_0xc882('0x2c')],qs[_0xc882('0x32')](_0x1cc62c[_0xc882('0x2e')][_0xc882('0x32')]));_0x30f86a[_0xc882('0x31')]=_0x30f86a['attributes'][_0xc882('0x33')]?_0x30f86a[_0xc882('0x31')]:_0x3642ba[_0xc882('0x2c')];if(!_0x1cc62c['query'][_0xc882('0x34')]('nolimit')){_0x30f86a[_0xc882('0x18')]=qs[_0xc882('0x18')](_0x1cc62c[_0xc882('0x2e')]['limit']);_0x30f86a[_0xc882('0x17')]=qs[_0xc882('0x17')](_0x1cc62c[_0xc882('0x2e')]['offset']);}_0x30f86a[_0xc882('0x35')]=qs[_0xc882('0x36')](_0x1cc62c['query'][_0xc882('0x36')]);_0x30f86a[_0xc882('0x37')]=qs[_0xc882('0x2f')](_['pick'](_0x1cc62c['query'],_0x3642ba[_0xc882('0x2f')]),_0x572faf);if(_0x1cc62c[_0xc882('0x2e')][_0xc882('0x38')]){_0x30f86a[_0xc882('0x37')]=_['merge'](_0x30f86a[_0xc882('0x37')],{'$or':_[_0xc882('0x27')](_0x572faf,function(_0x4f0cb0){if(_0x4f0cb0['type']!==_0xc882('0x39')){var _0x511dfd={};_0x511dfd[_0x4f0cb0[_0xc882('0x24')]]={'$like':'%'+_0x1cc62c['query'][_0xc882('0x38')]+'%'};return _0x511dfd;}})});}_0x30f86a=_[_0xc882('0x3a')]({},_0x30f86a,_0x1cc62c[_0xc882('0x3b')]);var _0x54c6cf={'where':_0x30f86a[_0xc882('0x37')]};return db[_0xc882('0x28')][_0xc882('0x1a')](_0x54c6cf)[_0xc882('0x20')](function(_0x130f20){_0x25eb21[_0xc882('0x1a')]=_0x130f20;if(_0x1cc62c[_0xc882('0x2e')][_0xc882('0x3c')]){_0x30f86a[_0xc882('0x3d')]=[{'all':!![]}];}return db[_0xc882('0x28')]['findAll'](_0x30f86a);})[_0xc882('0x20')](function(_0x1ee1c8){_0x25eb21[_0xc882('0x3e')]=_0x1ee1c8;return _0x25eb21;})[_0xc882('0x20')](respondWithFilteredResult(_0x3d9828,_0x30f86a))[_0xc882('0x3f')](handleError(_0x3d9828,null));};exports[_0xc882('0x40')]=function(_0x1aaa04,_0x73868e){var _0x3934f7={'raw':![],'where':{'id':_0x1aaa04['params']['id']}},_0x1b0239={};_0x1b0239[_0xc882('0x2c')]=_[_0xc882('0x2d')](db['FreshsalesConfiguration'][_0xc882('0x41')]);_0x1b0239[_0xc882('0x2e')]=_[_0xc882('0x2d')](_0x1aaa04[_0xc882('0x2e')]);_0x1b0239[_0xc882('0x2f')]=_[_0xc882('0x30')](_0x1b0239['model'],_0x1b0239['query']);_0x3934f7[_0xc882('0x31')]=_[_0xc882('0x30')](_0x1b0239[_0xc882('0x2c')],qs[_0xc882('0x32')](_0x1aaa04[_0xc882('0x2e')]['fields']));_0x3934f7['attributes']=_0x3934f7[_0xc882('0x31')]['length']?_0x3934f7['attributes']:_0x1b0239['model'];if(_0x1aaa04[_0xc882('0x2e')][_0xc882('0x3c')]){_0x3934f7[_0xc882('0x3d')]=[{'all':!![]}];}_0x3934f7=_[_0xc882('0x3a')]({},_0x3934f7,_0x1aaa04[_0xc882('0x3b')]);return db[_0xc882('0x28')][_0xc882('0x42')](_0x3934f7)[_0xc882('0x20')](handleEntityNotFound(_0x73868e,null))[_0xc882('0x20')](respondWithResult(_0x73868e,null))[_0xc882('0x3f')](handleError(_0x73868e,null));};exports[_0xc882('0x43')]=function(_0x2c722e,_0x3fc7a6){return db[_0xc882('0x28')][_0xc882('0x43')](_0x2c722e[_0xc882('0x44')],{})[_0xc882('0x20')](respondWithResult(_0x3fc7a6,0xc9))[_0xc882('0x3f')](handleError(_0x3fc7a6,null));};exports[_0xc882('0x45')]=function(_0x346d15,_0x1adc7c){if(_0x346d15[_0xc882('0x44')]['id']){delete _0x346d15[_0xc882('0x44')]['id'];}return db[_0xc882('0x28')][_0xc882('0x42')]({'where':{'id':_0x346d15['params']['id']}})['then'](handleEntityNotFound(_0x1adc7c,null))[_0xc882('0x20')](saveUpdates(_0x346d15[_0xc882('0x44')],null))[_0xc882('0x20')](respondWithResult(_0x1adc7c,null))[_0xc882('0x3f')](handleError(_0x1adc7c,null));};exports[_0xc882('0x21')]=function(_0x437302,_0x51cf8d){return db[_0xc882('0x28')]['find']({'where':{'id':_0x437302['params']['id']}})['then'](handleEntityNotFound(_0x51cf8d,null))[_0xc882('0x20')](removeEntity(_0x51cf8d,null))[_0xc882('0x3f')](handleError(_0x51cf8d,null));};exports[_0xc882('0x46')]=function(_0xdeab83,_0x445103,_0x2b7801){var _0x522111={};var _0x5c9b32={};var _0x46253e;var _0x215523;return db[_0xc882('0x28')][_0xc882('0x47')]({'where':{'id':_0xdeab83[_0xc882('0x48')]['id']}})[_0xc882('0x20')](handleEntityNotFound(_0x445103,null))['then'](function(_0x4468d3){if(_0x4468d3){_0x46253e=_0x4468d3;_0x5c9b32[_0xc882('0x2c')]=_[_0xc882('0x2d')](db[_0xc882('0x49')][_0xc882('0x41')]);_0x5c9b32['query']=_['keys'](_0xdeab83['query']);_0x5c9b32[_0xc882('0x2f')]=_[_0xc882('0x30')](_0x5c9b32[_0xc882('0x2c')],_0x5c9b32[_0xc882('0x2e')]);_0x522111[_0xc882('0x31')]=_['intersection'](_0x5c9b32[_0xc882('0x2c')],qs[_0xc882('0x32')](_0xdeab83[_0xc882('0x2e')]['fields']));_0x522111[_0xc882('0x31')]=_0x522111[_0xc882('0x31')][_0xc882('0x33')]?_0x522111['attributes']:_0x5c9b32['model'];_0x522111[_0xc882('0x35')]=qs[_0xc882('0x36')](_0xdeab83[_0xc882('0x2e')][_0xc882('0x36')]);_0x522111[_0xc882('0x37')]=qs['filters'](_[_0xc882('0x4a')](_0xdeab83[_0xc882('0x2e')],_0x5c9b32[_0xc882('0x2f')]));if(_0xdeab83[_0xc882('0x2e')][_0xc882('0x38')]){_0x522111['where']=_[_0xc882('0x3a')](_0x522111[_0xc882('0x37')],{'$or':_['map'](_0x522111[_0xc882('0x31')],function(_0x3baa51){var _0x41bf67={};_0x41bf67[_0x3baa51]={'$like':'%'+_0xdeab83[_0xc882('0x2e')][_0xc882('0x38')]+'%'};return _0x41bf67;})});}_0x522111=_[_0xc882('0x3a')]({},_0x522111,_0xdeab83['options']);return _0x46253e[_0xc882('0x46')](_0x522111);}})[_0xc882('0x20')](function(_0x37732a){if(_0x37732a){_0x215523=_0x37732a[_0xc882('0x33')];if(!_0xdeab83[_0xc882('0x2e')][_0xc882('0x34')](_0xc882('0x4b'))){_0x522111['limit']=qs['limit'](_0xdeab83[_0xc882('0x2e')][_0xc882('0x18')]);_0x522111['offset']=qs['offset'](_0xdeab83[_0xc882('0x2e')][_0xc882('0x17')]);}return _0x46253e['getSubjects'](_0x522111);}})[_0xc882('0x20')](function(_0x5ea4f5){if(_0x5ea4f5){return _0x5ea4f5?{'count':_0x215523,'rows':_0x5ea4f5}:null;}})[_0xc882('0x20')](respondWithResult(_0x445103,null))[_0xc882('0x3f')](handleError(_0x445103,null));};exports[_0xc882('0x4c')]=function(_0x5e080f,_0x1b634e,_0x35d6b5){var _0x202c1d={};var _0x49a2f8={};var _0x59b78b;var _0x182947;return db[_0xc882('0x28')]['findOne']({'where':{'id':_0x5e080f[_0xc882('0x48')]['id']}})[_0xc882('0x20')](handleEntityNotFound(_0x1b634e,null))[_0xc882('0x20')](function(_0xd30623){if(_0xd30623){_0x59b78b=_0xd30623;_0x49a2f8[_0xc882('0x2c')]=_[_0xc882('0x2d')](db[_0xc882('0x49')][_0xc882('0x41')]);_0x49a2f8[_0xc882('0x2e')]=_[_0xc882('0x2d')](_0x5e080f[_0xc882('0x2e')]);_0x49a2f8[_0xc882('0x2f')]=_[_0xc882('0x30')](_0x49a2f8['model'],_0x49a2f8[_0xc882('0x2e')]);_0x202c1d[_0xc882('0x31')]=_[_0xc882('0x30')](_0x49a2f8[_0xc882('0x2c')],qs[_0xc882('0x32')](_0x5e080f['query'][_0xc882('0x32')]));_0x202c1d[_0xc882('0x31')]=_0x202c1d[_0xc882('0x31')]['length']?_0x202c1d[_0xc882('0x31')]:_0x49a2f8[_0xc882('0x2c')];_0x202c1d[_0xc882('0x35')]=qs[_0xc882('0x36')](_0x5e080f[_0xc882('0x2e')][_0xc882('0x36')]);_0x202c1d['where']=qs[_0xc882('0x2f')](_[_0xc882('0x4a')](_0x5e080f[_0xc882('0x2e')],_0x49a2f8[_0xc882('0x2f')]));if(_0x5e080f[_0xc882('0x2e')][_0xc882('0x38')]){_0x202c1d[_0xc882('0x37')]=_[_0xc882('0x3a')](_0x202c1d[_0xc882('0x37')],{'$or':_[_0xc882('0x27')](_0x202c1d['attributes'],function(_0x135092){var _0x1a18b9={};_0x1a18b9[_0x135092]={'$like':'%'+_0x5e080f[_0xc882('0x2e')][_0xc882('0x38')]+'%'};return _0x1a18b9;})});}_0x202c1d=_[_0xc882('0x3a')]({},_0x202c1d,_0x5e080f['options']);return _0x59b78b[_0xc882('0x4c')](_0x202c1d);}})[_0xc882('0x20')](function(_0x711dce){if(_0x711dce){_0x182947=_0x711dce[_0xc882('0x33')];if(!_0x5e080f[_0xc882('0x2e')][_0xc882('0x34')](_0xc882('0x4b'))){_0x202c1d[_0xc882('0x18')]=qs[_0xc882('0x18')](_0x5e080f[_0xc882('0x2e')][_0xc882('0x18')]);_0x202c1d[_0xc882('0x17')]=qs[_0xc882('0x17')](_0x5e080f['query']['offset']);}return _0x59b78b[_0xc882('0x4c')](_0x202c1d);}})[_0xc882('0x20')](function(_0x226fd7){if(_0x226fd7){return _0x226fd7?{'count':_0x182947,'rows':_0x226fd7}:null;}})['then'](respondWithResult(_0x1b634e,null))[_0xc882('0x3f')](handleError(_0x1b634e,null));};exports['getFields']=function(_0x52288d,_0x42478f,_0x1ddada){var _0x56f21c={};var _0x531f31={};var _0x5cecba;var _0x5303e0;return db[_0xc882('0x28')][_0xc882('0x47')]({'where':{'id':_0x52288d[_0xc882('0x48')]['id']}})[_0xc882('0x20')](handleEntityNotFound(_0x42478f,null))[_0xc882('0x20')](function(_0x2f26d8){if(_0x2f26d8){_0x5cecba=_0x2f26d8;_0x531f31[_0xc882('0x2c')]=_['keys'](db[_0xc882('0x49')][_0xc882('0x41')]);_0x531f31[_0xc882('0x2e')]=_[_0xc882('0x2d')](_0x52288d[_0xc882('0x2e')]);_0x531f31[_0xc882('0x2f')]=_[_0xc882('0x30')](_0x531f31[_0xc882('0x2c')],_0x531f31['query']);_0x56f21c[_0xc882('0x31')]=_[_0xc882('0x30')](_0x531f31['model'],qs[_0xc882('0x32')](_0x52288d['query'][_0xc882('0x32')]));_0x56f21c[_0xc882('0x31')]=_0x56f21c[_0xc882('0x31')]['length']?_0x56f21c['attributes']:_0x531f31['model'];_0x56f21c[_0xc882('0x35')]=qs[_0xc882('0x36')](_0x52288d[_0xc882('0x2e')][_0xc882('0x36')]);_0x56f21c[_0xc882('0x37')]=qs['filters'](_[_0xc882('0x4a')](_0x52288d[_0xc882('0x2e')],_0x531f31[_0xc882('0x2f')]));if(_0x52288d[_0xc882('0x2e')][_0xc882('0x38')]){_0x56f21c[_0xc882('0x37')]=_[_0xc882('0x3a')](_0x56f21c['where'],{'$or':_[_0xc882('0x27')](_0x56f21c['attributes'],function(_0x1cea29){var _0x398d4f={};_0x398d4f[_0x1cea29]={'$like':'%'+_0x52288d[_0xc882('0x2e')][_0xc882('0x38')]+'%'};return _0x398d4f;})});}_0x56f21c=_[_0xc882('0x3a')]({},_0x56f21c,_0x52288d['options']);return _0x5cecba['getFields'](_0x56f21c);}})[_0xc882('0x20')](function(_0x44114c){if(_0x44114c){_0x5303e0=_0x44114c['length'];if(!_0x52288d[_0xc882('0x2e')][_0xc882('0x34')]('nolimit')){_0x56f21c[_0xc882('0x18')]=qs[_0xc882('0x18')](_0x52288d[_0xc882('0x2e')][_0xc882('0x18')]);_0x56f21c[_0xc882('0x17')]=qs[_0xc882('0x17')](_0x52288d[_0xc882('0x2e')][_0xc882('0x17')]);}return _0x5cecba[_0xc882('0x4d')](_0x56f21c);}})[_0xc882('0x20')](function(_0x27b975){if(_0x27b975){return _0x27b975?{'count':_0x5303e0,'rows':_0x27b975}:null;}})[_0xc882('0x20')](respondWithResult(_0x42478f,null))['catch'](handleError(_0x42478f,null));}; \ No newline at end of file +var _0xbbb1=['then','end','error','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','fieldName','type','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','keys','include','create','body','find','destroy','getSubjects','findOne','FreshsalesField','getDescriptions','getFields','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update'];(function(_0x33c797,_0x430c30){var _0x514ff7=function(_0x17920c){while(--_0x17920c){_0x33c797['push'](_0x33c797['shift']());}};_0x514ff7(++_0x430c30);}(_0xbbb1,0x11e));var _0x1bbb=function(_0x5210ac,_0xcb3f25){_0x5210ac=_0x5210ac-0x0;var _0x499f03=_0xbbb1[_0x5210ac];return _0x499f03;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1bbb('0x0'));var zipdir=require(_0x1bbb('0x1'));var jsonpatch=require(_0x1bbb('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1bbb('0x3'));var Mustache=require(_0x1bbb('0x4'));var util=require(_0x1bbb('0x5'));var path=require(_0x1bbb('0x6'));var sox=require(_0x1bbb('0x7'));var csv=require(_0x1bbb('0x8'));var ejs=require(_0x1bbb('0x9'));var fs=require('fs');var fs_extra=require(_0x1bbb('0xa'));var _=require(_0x1bbb('0xb'));var squel=require('squel');var crypto=require(_0x1bbb('0xc'));var jsforce=require(_0x1bbb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x1bbb('0x8'));var querystring=require(_0x1bbb('0xe'));var Papa=require(_0x1bbb('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1bbb('0x10'));var logger=require('../../config/logger')(_0x1bbb('0x11'));var utils=require('../../config/utils');var config=require(_0x1bbb('0x12'));var licenseUtil=require(_0x1bbb('0x13'));var db=require(_0x1bbb('0x14'))['db'];function respondWithStatusCode(_0x2681e0,_0xa43249){_0xa43249=_0xa43249||0xcc;return function(_0x30d8dc){if(_0x30d8dc){return _0x2681e0[_0x1bbb('0x15')](_0xa43249);}return _0x2681e0[_0x1bbb('0x16')](_0xa43249)['end']();};}function respondWithResult(_0x528523,_0x40abc0){_0x40abc0=_0x40abc0||0xc8;return function(_0x4c63af){if(_0x4c63af){return _0x528523[_0x1bbb('0x16')](_0x40abc0)[_0x1bbb('0x17')](_0x4c63af);}};}function respondWithFilteredResult(_0x4d5d41,_0x394ae0){return function(_0x1ba155){if(_0x1ba155){var _0x5887df=typeof _0x394ae0[_0x1bbb('0x18')]==='undefined'&&typeof _0x394ae0['limit']===_0x1bbb('0x19');var _0x2555c1=_0x1ba155[_0x1bbb('0x1a')];var _0x49bff6=_0x5887df?0x0:_0x394ae0[_0x1bbb('0x18')];var _0x34be1c=_0x5887df?_0x1ba155[_0x1bbb('0x1a')]:_0x394ae0[_0x1bbb('0x18')]+_0x394ae0[_0x1bbb('0x1b')];var _0x43f1c8;if(_0x34be1c>=_0x2555c1){_0x34be1c=_0x2555c1;_0x43f1c8=0xc8;}else{_0x43f1c8=0xce;}_0x4d5d41[_0x1bbb('0x16')](_0x43f1c8);return _0x4d5d41[_0x1bbb('0x1c')](_0x1bbb('0x1d'),_0x49bff6+'-'+_0x34be1c+'/'+_0x2555c1)[_0x1bbb('0x17')](_0x1ba155);}return null;};}function patchUpdates(_0xa59533){return function(_0x40273b){try{jsonpatch[_0x1bbb('0x1e')](_0x40273b,_0xa59533,!![]);}catch(_0x124f06){return BPromise[_0x1bbb('0x1f')](_0x124f06);}return _0x40273b[_0x1bbb('0x20')]();};}function saveUpdates(_0x2b2b35,_0x29a905){return function(_0x2edbda){if(_0x2edbda){return _0x2edbda[_0x1bbb('0x21')](_0x2b2b35)[_0x1bbb('0x22')](function(_0x3a6a93){return _0x3a6a93;});}return null;};}function removeEntity(_0xdd3570,_0x513bd3){return function(_0x1c34e0){if(_0x1c34e0){return _0x1c34e0['destroy']()['then'](function(){_0xdd3570[_0x1bbb('0x16')](0xcc)[_0x1bbb('0x23')]();});}};}function handleEntityNotFound(_0x30e2b9,_0x3887e2){return function(_0xae56b2){if(!_0xae56b2){_0x30e2b9[_0x1bbb('0x15')](0x194);}return _0xae56b2;};}function handleError(_0x41eded,_0x45daaa){_0x45daaa=_0x45daaa||0x1f4;return function(_0x112907){logger[_0x1bbb('0x24')](_0x112907[_0x1bbb('0x25')]);if(_0x112907[_0x1bbb('0x26')]){delete _0x112907[_0x1bbb('0x26')];}_0x41eded[_0x1bbb('0x16')](_0x45daaa)[_0x1bbb('0x27')](_0x112907);};}exports[_0x1bbb('0x28')]=function(_0x34ca73,_0x467c7a){var _0x134245={},_0x596677={},_0x564180={'count':0x0,'rows':[]};var _0x524fba=_[_0x1bbb('0x29')](db[_0x1bbb('0x2a')][_0x1bbb('0x2b')],function(_0x3911fc){return{'name':_0x3911fc[_0x1bbb('0x2c')],'type':_0x3911fc[_0x1bbb('0x2d')][_0x1bbb('0x2e')]};});_0x596677['model']=_['map'](_0x524fba,'name');_0x596677[_0x1bbb('0x2f')]=_['keys'](_0x34ca73[_0x1bbb('0x2f')]);_0x596677[_0x1bbb('0x30')]=_['intersection'](_0x596677[_0x1bbb('0x31')],_0x596677[_0x1bbb('0x2f')]);_0x134245[_0x1bbb('0x32')]=_[_0x1bbb('0x33')](_0x596677['model'],qs['fields'](_0x34ca73[_0x1bbb('0x2f')][_0x1bbb('0x34')]));_0x134245[_0x1bbb('0x32')]=_0x134245['attributes'][_0x1bbb('0x35')]?_0x134245[_0x1bbb('0x32')]:_0x596677[_0x1bbb('0x31')];if(!_0x34ca73['query'][_0x1bbb('0x36')](_0x1bbb('0x37'))){_0x134245[_0x1bbb('0x1b')]=qs[_0x1bbb('0x1b')](_0x34ca73[_0x1bbb('0x2f')][_0x1bbb('0x1b')]);_0x134245[_0x1bbb('0x18')]=qs['offset'](_0x34ca73['query'][_0x1bbb('0x18')]);}_0x134245[_0x1bbb('0x38')]=qs['sort'](_0x34ca73[_0x1bbb('0x2f')][_0x1bbb('0x39')]);_0x134245[_0x1bbb('0x3a')]=qs[_0x1bbb('0x30')](_[_0x1bbb('0x3b')](_0x34ca73[_0x1bbb('0x2f')],_0x596677[_0x1bbb('0x30')]),_0x524fba);if(_0x34ca73['query'][_0x1bbb('0x3c')]){_0x134245[_0x1bbb('0x3a')]=_[_0x1bbb('0x3d')](_0x134245[_0x1bbb('0x3a')],{'$or':_[_0x1bbb('0x29')](_0x524fba,function(_0x469b0f){if(_0x469b0f['type']!==_0x1bbb('0x3e')){var _0x86fd18={};_0x86fd18[_0x469b0f['name']]={'$like':'%'+_0x34ca73[_0x1bbb('0x2f')][_0x1bbb('0x3c')]+'%'};return _0x86fd18;}})});}_0x134245=_[_0x1bbb('0x3d')]({},_0x134245,_0x34ca73[_0x1bbb('0x3f')]);var _0x1d42e4={'where':_0x134245['where']};return db[_0x1bbb('0x2a')]['count'](_0x1d42e4)[_0x1bbb('0x22')](function(_0x110722){_0x564180[_0x1bbb('0x1a')]=_0x110722;if(_0x34ca73[_0x1bbb('0x2f')][_0x1bbb('0x40')]){_0x134245['include']=[{'all':!![]}];}return db[_0x1bbb('0x2a')][_0x1bbb('0x41')](_0x134245);})[_0x1bbb('0x22')](function(_0x5e7869){_0x564180['rows']=_0x5e7869;return _0x564180;})[_0x1bbb('0x22')](respondWithFilteredResult(_0x467c7a,_0x134245))[_0x1bbb('0x42')](handleError(_0x467c7a,null));};exports[_0x1bbb('0x43')]=function(_0x4252d0,_0x345cef){var _0x29b1d8={'raw':![],'where':{'id':_0x4252d0[_0x1bbb('0x44')]['id']}},_0xa6f49d={};_0xa6f49d[_0x1bbb('0x31')]=_[_0x1bbb('0x45')](db[_0x1bbb('0x2a')][_0x1bbb('0x2b')]);_0xa6f49d[_0x1bbb('0x2f')]=_[_0x1bbb('0x45')](_0x4252d0[_0x1bbb('0x2f')]);_0xa6f49d['filters']=_[_0x1bbb('0x33')](_0xa6f49d[_0x1bbb('0x31')],_0xa6f49d['query']);_0x29b1d8['attributes']=_[_0x1bbb('0x33')](_0xa6f49d[_0x1bbb('0x31')],qs[_0x1bbb('0x34')](_0x4252d0[_0x1bbb('0x2f')][_0x1bbb('0x34')]));_0x29b1d8[_0x1bbb('0x32')]=_0x29b1d8[_0x1bbb('0x32')]['length']?_0x29b1d8['attributes']:_0xa6f49d['model'];if(_0x4252d0[_0x1bbb('0x2f')]['includeAll']){_0x29b1d8[_0x1bbb('0x46')]=[{'all':!![]}];}_0x29b1d8=_[_0x1bbb('0x3d')]({},_0x29b1d8,_0x4252d0['options']);return db['FreshsalesConfiguration']['find'](_0x29b1d8)[_0x1bbb('0x22')](handleEntityNotFound(_0x345cef,null))[_0x1bbb('0x22')](respondWithResult(_0x345cef,null))[_0x1bbb('0x42')](handleError(_0x345cef,null));};exports[_0x1bbb('0x47')]=function(_0x59dbae,_0x2b7613){return db[_0x1bbb('0x2a')]['create'](_0x59dbae['body'],{})[_0x1bbb('0x22')](respondWithResult(_0x2b7613,0xc9))[_0x1bbb('0x42')](handleError(_0x2b7613,null));};exports[_0x1bbb('0x21')]=function(_0x413df6,_0x51195c){if(_0x413df6[_0x1bbb('0x48')]['id']){delete _0x413df6[_0x1bbb('0x48')]['id'];}return db[_0x1bbb('0x2a')][_0x1bbb('0x49')]({'where':{'id':_0x413df6[_0x1bbb('0x44')]['id']}})[_0x1bbb('0x22')](handleEntityNotFound(_0x51195c,null))[_0x1bbb('0x22')](saveUpdates(_0x413df6[_0x1bbb('0x48')],null))[_0x1bbb('0x22')](respondWithResult(_0x51195c,null))['catch'](handleError(_0x51195c,null));};exports[_0x1bbb('0x4a')]=function(_0x259883,_0xf927ab){return db[_0x1bbb('0x2a')][_0x1bbb('0x49')]({'where':{'id':_0x259883['params']['id']}})[_0x1bbb('0x22')](handleEntityNotFound(_0xf927ab,null))[_0x1bbb('0x22')](removeEntity(_0xf927ab,null))[_0x1bbb('0x42')](handleError(_0xf927ab,null));};exports[_0x1bbb('0x4b')]=function(_0x4ccd31,_0x1748f0,_0x8e65e7){var _0x18680d={};var _0x25eefa={};var _0x5f2ddd;var _0x379f8a;return db[_0x1bbb('0x2a')][_0x1bbb('0x4c')]({'where':{'id':_0x4ccd31[_0x1bbb('0x44')]['id']}})[_0x1bbb('0x22')](handleEntityNotFound(_0x1748f0,null))[_0x1bbb('0x22')](function(_0x505e20){if(_0x505e20){_0x5f2ddd=_0x505e20;_0x25eefa[_0x1bbb('0x31')]=_[_0x1bbb('0x45')](db[_0x1bbb('0x4d')][_0x1bbb('0x2b')]);_0x25eefa[_0x1bbb('0x2f')]=_[_0x1bbb('0x45')](_0x4ccd31[_0x1bbb('0x2f')]);_0x25eefa[_0x1bbb('0x30')]=_[_0x1bbb('0x33')](_0x25eefa[_0x1bbb('0x31')],_0x25eefa[_0x1bbb('0x2f')]);_0x18680d[_0x1bbb('0x32')]=_[_0x1bbb('0x33')](_0x25eefa[_0x1bbb('0x31')],qs[_0x1bbb('0x34')](_0x4ccd31['query']['fields']));_0x18680d[_0x1bbb('0x32')]=_0x18680d[_0x1bbb('0x32')][_0x1bbb('0x35')]?_0x18680d[_0x1bbb('0x32')]:_0x25eefa[_0x1bbb('0x31')];_0x18680d[_0x1bbb('0x38')]=qs[_0x1bbb('0x39')](_0x4ccd31[_0x1bbb('0x2f')][_0x1bbb('0x39')]);_0x18680d[_0x1bbb('0x3a')]=qs[_0x1bbb('0x30')](_[_0x1bbb('0x3b')](_0x4ccd31[_0x1bbb('0x2f')],_0x25eefa[_0x1bbb('0x30')]));if(_0x4ccd31[_0x1bbb('0x2f')][_0x1bbb('0x3c')]){_0x18680d['where']=_[_0x1bbb('0x3d')](_0x18680d['where'],{'$or':_[_0x1bbb('0x29')](_0x18680d['attributes'],function(_0x1ef2b6){var _0x4f2078={};_0x4f2078[_0x1ef2b6]={'$like':'%'+_0x4ccd31[_0x1bbb('0x2f')][_0x1bbb('0x3c')]+'%'};return _0x4f2078;})});}_0x18680d=_[_0x1bbb('0x3d')]({},_0x18680d,_0x4ccd31[_0x1bbb('0x3f')]);return _0x5f2ddd[_0x1bbb('0x4b')](_0x18680d);}})['then'](function(_0x5e8598){if(_0x5e8598){_0x379f8a=_0x5e8598['length'];if(!_0x4ccd31['query'][_0x1bbb('0x36')](_0x1bbb('0x37'))){_0x18680d['limit']=qs[_0x1bbb('0x1b')](_0x4ccd31[_0x1bbb('0x2f')]['limit']);_0x18680d[_0x1bbb('0x18')]=qs[_0x1bbb('0x18')](_0x4ccd31['query'][_0x1bbb('0x18')]);}return _0x5f2ddd['getSubjects'](_0x18680d);}})[_0x1bbb('0x22')](function(_0x5bb058){if(_0x5bb058){return _0x5bb058?{'count':_0x379f8a,'rows':_0x5bb058}:null;}})['then'](respondWithResult(_0x1748f0,null))[_0x1bbb('0x42')](handleError(_0x1748f0,null));};exports['getDescriptions']=function(_0x5a3e73,_0x11b2cb,_0x345068){var _0x42139c={};var _0xdc7a10={};var _0x48b72c;var _0x4680d3;return db[_0x1bbb('0x2a')][_0x1bbb('0x4c')]({'where':{'id':_0x5a3e73['params']['id']}})[_0x1bbb('0x22')](handleEntityNotFound(_0x11b2cb,null))[_0x1bbb('0x22')](function(_0x4393d8){if(_0x4393d8){_0x48b72c=_0x4393d8;_0xdc7a10[_0x1bbb('0x31')]=_['keys'](db[_0x1bbb('0x4d')][_0x1bbb('0x2b')]);_0xdc7a10[_0x1bbb('0x2f')]=_['keys'](_0x5a3e73[_0x1bbb('0x2f')]);_0xdc7a10[_0x1bbb('0x30')]=_['intersection'](_0xdc7a10[_0x1bbb('0x31')],_0xdc7a10[_0x1bbb('0x2f')]);_0x42139c[_0x1bbb('0x32')]=_['intersection'](_0xdc7a10[_0x1bbb('0x31')],qs[_0x1bbb('0x34')](_0x5a3e73['query'][_0x1bbb('0x34')]));_0x42139c[_0x1bbb('0x32')]=_0x42139c[_0x1bbb('0x32')]['length']?_0x42139c[_0x1bbb('0x32')]:_0xdc7a10[_0x1bbb('0x31')];_0x42139c[_0x1bbb('0x38')]=qs[_0x1bbb('0x39')](_0x5a3e73[_0x1bbb('0x2f')][_0x1bbb('0x39')]);_0x42139c[_0x1bbb('0x3a')]=qs[_0x1bbb('0x30')](_[_0x1bbb('0x3b')](_0x5a3e73[_0x1bbb('0x2f')],_0xdc7a10[_0x1bbb('0x30')]));if(_0x5a3e73[_0x1bbb('0x2f')][_0x1bbb('0x3c')]){_0x42139c[_0x1bbb('0x3a')]=_['merge'](_0x42139c[_0x1bbb('0x3a')],{'$or':_[_0x1bbb('0x29')](_0x42139c[_0x1bbb('0x32')],function(_0x40540c){var _0x2f096c={};_0x2f096c[_0x40540c]={'$like':'%'+_0x5a3e73['query']['filter']+'%'};return _0x2f096c;})});}_0x42139c=_[_0x1bbb('0x3d')]({},_0x42139c,_0x5a3e73[_0x1bbb('0x3f')]);return _0x48b72c[_0x1bbb('0x4e')](_0x42139c);}})[_0x1bbb('0x22')](function(_0x17f745){if(_0x17f745){_0x4680d3=_0x17f745[_0x1bbb('0x35')];if(!_0x5a3e73['query'][_0x1bbb('0x36')](_0x1bbb('0x37'))){_0x42139c['limit']=qs[_0x1bbb('0x1b')](_0x5a3e73[_0x1bbb('0x2f')]['limit']);_0x42139c['offset']=qs['offset'](_0x5a3e73[_0x1bbb('0x2f')][_0x1bbb('0x18')]);}return _0x48b72c['getDescriptions'](_0x42139c);}})[_0x1bbb('0x22')](function(_0x2d9dba){if(_0x2d9dba){return _0x2d9dba?{'count':_0x4680d3,'rows':_0x2d9dba}:null;}})['then'](respondWithResult(_0x11b2cb,null))[_0x1bbb('0x42')](handleError(_0x11b2cb,null));};exports[_0x1bbb('0x4f')]=function(_0x2dc97e,_0x5461f5,_0x3a025e){var _0xf4e656={};var _0x34413b={};var _0x108911;var _0x57f69e;return db[_0x1bbb('0x2a')][_0x1bbb('0x4c')]({'where':{'id':_0x2dc97e[_0x1bbb('0x44')]['id']}})[_0x1bbb('0x22')](handleEntityNotFound(_0x5461f5,null))[_0x1bbb('0x22')](function(_0x25c9b4){if(_0x25c9b4){_0x108911=_0x25c9b4;_0x34413b[_0x1bbb('0x31')]=_[_0x1bbb('0x45')](db['FreshsalesField'][_0x1bbb('0x2b')]);_0x34413b[_0x1bbb('0x2f')]=_[_0x1bbb('0x45')](_0x2dc97e[_0x1bbb('0x2f')]);_0x34413b['filters']=_[_0x1bbb('0x33')](_0x34413b[_0x1bbb('0x31')],_0x34413b[_0x1bbb('0x2f')]);_0xf4e656[_0x1bbb('0x32')]=_['intersection'](_0x34413b['model'],qs['fields'](_0x2dc97e[_0x1bbb('0x2f')]['fields']));_0xf4e656[_0x1bbb('0x32')]=_0xf4e656[_0x1bbb('0x32')][_0x1bbb('0x35')]?_0xf4e656[_0x1bbb('0x32')]:_0x34413b['model'];_0xf4e656[_0x1bbb('0x38')]=qs[_0x1bbb('0x39')](_0x2dc97e['query'][_0x1bbb('0x39')]);_0xf4e656['where']=qs[_0x1bbb('0x30')](_[_0x1bbb('0x3b')](_0x2dc97e[_0x1bbb('0x2f')],_0x34413b['filters']));if(_0x2dc97e[_0x1bbb('0x2f')][_0x1bbb('0x3c')]){_0xf4e656[_0x1bbb('0x3a')]=_[_0x1bbb('0x3d')](_0xf4e656[_0x1bbb('0x3a')],{'$or':_[_0x1bbb('0x29')](_0xf4e656[_0x1bbb('0x32')],function(_0x1b46f7){var _0x345015={};_0x345015[_0x1b46f7]={'$like':'%'+_0x2dc97e[_0x1bbb('0x2f')][_0x1bbb('0x3c')]+'%'};return _0x345015;})});}_0xf4e656=_[_0x1bbb('0x3d')]({},_0xf4e656,_0x2dc97e['options']);return _0x108911[_0x1bbb('0x4f')](_0xf4e656);}})[_0x1bbb('0x22')](function(_0x3c6380){if(_0x3c6380){_0x57f69e=_0x3c6380[_0x1bbb('0x35')];if(!_0x2dc97e[_0x1bbb('0x2f')][_0x1bbb('0x36')](_0x1bbb('0x37'))){_0xf4e656[_0x1bbb('0x1b')]=qs[_0x1bbb('0x1b')](_0x2dc97e['query'][_0x1bbb('0x1b')]);_0xf4e656['offset']=qs[_0x1bbb('0x18')](_0x2dc97e[_0x1bbb('0x2f')][_0x1bbb('0x18')]);}return _0x108911[_0x1bbb('0x4f')](_0xf4e656);}})[_0x1bbb('0x22')](function(_0x33b5e5){if(_0x33b5e5){return _0x33b5e5?{'count':_0x57f69e,'rows':_0x33b5e5}:null;}})[_0x1bbb('0x22')](respondWithResult(_0x5461f5,null))[_0x1bbb('0x42')](handleError(_0x5461f5,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index f922916..81b3ffb 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 _0xfccf=['int_freshsales_configurations','lodash','util','api','bluebird','request-promise','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration'];(function(_0x4f34d8,_0x40f022){var _0xc97536=function(_0xef9dfc){while(--_0xef9dfc){_0x4f34d8['push'](_0x4f34d8['shift']());}};_0xc97536(++_0x40f022);}(_0xfccf,0x115));var _0xffcc=function(_0x5ad51e,_0x3aec2f){_0x5ad51e=_0x5ad51e-0x0;var _0xbbec83=_0xfccf[_0x5ad51e];return _0xbbec83;};'use strict';var _=require(_0xffcc('0x0'));var util=require(_0xffcc('0x1'));var logger=require('../../config/logger')(_0xffcc('0x2'));var moment=require('moment');var BPromise=require(_0xffcc('0x3'));var rp=require(_0xffcc('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xffcc('0x5'));var config=require(_0xffcc('0x6'));var attributes=require(_0xffcc('0x7'));module[_0xffcc('0x8')]=function(_0x2b8d2d,_0x5ee326){return _0x2b8d2d[_0xffcc('0x9')](_0xffcc('0xa'),attributes,{'tableName':_0xffcc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfb3c=['../../config/logger','bluebird','request-promise','path','rimraf','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations'];(function(_0x5b3ec1,_0x4986d4){var _0x195e76=function(_0x23980a){while(--_0x23980a){_0x5b3ec1['push'](_0x5b3ec1['shift']());}};_0x195e76(++_0x4986d4);}(_0xfb3c,0x14a));var _0xcfb3=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xfb3c[_0x413feb];return _0x40ee88;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xcfb3('0x0'))('api');var moment=require('moment');var BPromise=require(_0xcfb3('0x1'));var rp=require(_0xcfb3('0x2'));var fs=require('fs');var path=require(_0xcfb3('0x3'));var rimraf=require(_0xcfb3('0x4'));var config=require('../../config/environment');var attributes=require(_0xcfb3('0x5'));module[_0xcfb3('0x6')]=function(_0x4f1e1f,_0x4760a2){return _0x4f1e1f[_0xcfb3('0x7')](_0xcfb3('0x8'),attributes,{'tableName':_0xcfb3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index 075c737..f724f73 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 _0x0ad1=['debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x1133c0,_0x3483a9){var _0x514993=function(_0x390762){while(--_0x390762){_0x1133c0['push'](_0x1133c0['shift']());}};_0x514993(++_0x3483a9);}(_0x0ad1,0x1bd));var _0x10ad=function(_0x17bfd6,_0xfb2a1e){_0x17bfd6=_0x17bfd6-0x0;var _0x25cabf=_0x0ad1[_0x17bfd6];return _0x25cabf;};'use strict';var _=require(_0x10ad('0x0'));var util=require('util');var moment=require(_0x10ad('0x1'));var BPromise=require(_0x10ad('0x2'));var rs=require(_0x10ad('0x3'));var fs=require('fs');var Redis=require(_0x10ad('0x4'));var db=require(_0x10ad('0x5'))['db'];var utils=require(_0x10ad('0x6'));var logger=require(_0x10ad('0x7'))('rpc');var config=require(_0x10ad('0x8'));var jayson=require(_0x10ad('0x9'));var client=jayson[_0x10ad('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5f47c7,_0x23d136,_0x333e06){return new BPromise(function(_0x189670,_0x9082e8){return client[_0x10ad('0xb')](_0x5f47c7,_0x333e06)[_0x10ad('0xc')](function(_0x5b59d8){logger['info'](_0x10ad('0xd'),_0x23d136,_0x10ad('0xe'));logger[_0x10ad('0xf')](_0x10ad('0x10'),_0x23d136,_0x10ad('0xe'),JSON['stringify'](_0x5b59d8));if(_0x5b59d8[_0x10ad('0x11')]){if(_0x5b59d8[_0x10ad('0x11')][_0x10ad('0x12')]===0x1f4){logger[_0x10ad('0x11')](_0x10ad('0xd'),_0x23d136,_0x5b59d8[_0x10ad('0x11')]['message']);return _0x9082e8(_0x5b59d8['error']['message']);}logger[_0x10ad('0x11')](_0x10ad('0xd'),_0x23d136,_0x5b59d8[_0x10ad('0x11')][_0x10ad('0x13')]);return _0x189670(_0x5b59d8[_0x10ad('0x11')][_0x10ad('0x13')]);}else{logger[_0x10ad('0x14')](_0x10ad('0xd'),_0x23d136,'request\x20sent');_0x189670(_0x5b59d8[_0x10ad('0x15')][_0x10ad('0x13')]);}})[_0x10ad('0x16')](function(_0xfe12d9){logger[_0x10ad('0x11')](_0x10ad('0xd'),_0x23d136,_0xfe12d9);_0x9082e8(_0xfe12d9);});});} \ No newline at end of file +var _0x2184=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x57a2a6,_0x3d21b2){var _0x74724a=function(_0x5918cc){while(--_0x5918cc){_0x57a2a6['push'](_0x57a2a6['shift']());}};_0x74724a(++_0x3d21b2);}(_0x2184,0x17e));var _0x4218=function(_0x223ef6,_0x2a1939){_0x223ef6=_0x223ef6-0x0;var _0x3ef20d=_0x2184[_0x223ef6];return _0x3ef20d;};'use strict';var _=require(_0x4218('0x0'));var util=require(_0x4218('0x1'));var moment=require(_0x4218('0x2'));var BPromise=require('bluebird');var rs=require(_0x4218('0x3'));var fs=require('fs');var Redis=require(_0x4218('0x4'));var db=require(_0x4218('0x5'))['db'];var utils=require(_0x4218('0x6'));var logger=require(_0x4218('0x7'))(_0x4218('0x8'));var config=require(_0x4218('0x9'));var jayson=require(_0x4218('0xa'));var client=jayson[_0x4218('0xb')][_0x4218('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x893dff,_0x5c9482,_0x114ff7){return new BPromise(function(_0x47b222,_0x422016){return client['request'](_0x893dff,_0x114ff7)[_0x4218('0xd')](function(_0x3f6b31){logger[_0x4218('0xe')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x5c9482,_0x4218('0xf'));logger['debug'](_0x4218('0x10'),_0x5c9482,_0x4218('0xf'),JSON[_0x4218('0x11')](_0x3f6b31));if(_0x3f6b31[_0x4218('0x12')]){if(_0x3f6b31[_0x4218('0x12')][_0x4218('0x13')]===0x1f4){logger['error'](_0x4218('0x14'),_0x5c9482,_0x3f6b31[_0x4218('0x12')]['message']);return _0x422016(_0x3f6b31['error'][_0x4218('0x15')]);}logger[_0x4218('0x12')](_0x4218('0x14'),_0x5c9482,_0x3f6b31[_0x4218('0x12')][_0x4218('0x15')]);return _0x47b222(_0x3f6b31[_0x4218('0x12')][_0x4218('0x15')]);}else{logger[_0x4218('0xe')](_0x4218('0x14'),_0x5c9482,'request\x20sent');_0x47b222(_0x3f6b31[_0x4218('0x16')]['message']);}})[_0x4218('0x17')](function(_0x264c07){logger[_0x4218('0x12')](_0x4218('0x14'),_0x5c9482,_0x264c07);_0x422016(_0x264c07);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index ca2d889..82acb17 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 _0x4ea3=['multer','util','path','connect-timeout','Router','../../components/auth/service','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','post','create','destroy'];(function(_0x562362,_0x5d54f4){var _0x3a18ce=function(_0x4b96ed){while(--_0x4b96ed){_0x562362['push'](_0x562362['shift']());}};_0x3a18ce(++_0x5d54f4);}(_0x4ea3,0x70));var _0x34ea=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x4ea3[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x34ea('0x0'));var util=require(_0x34ea('0x1'));var path=require(_0x34ea('0x2'));var timeout=require(_0x34ea('0x3'));var express=require('express');var router=express[_0x34ea('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x34ea('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x34ea('0x6'));router[_0x34ea('0x7')]('/',auth[_0x34ea('0x8')](),controller[_0x34ea('0x9')]);router[_0x34ea('0x7')](_0x34ea('0xa'),auth[_0x34ea('0x8')](),controller['show']);router[_0x34ea('0xb')]('/',auth[_0x34ea('0x8')](),controller[_0x34ea('0xc')]);router['put'](_0x34ea('0xa'),auth[_0x34ea('0x8')](),controller['update']);router['delete'](_0x34ea('0xa'),auth[_0x34ea('0x8')](),controller[_0x34ea('0xd')]);module['exports']=router; \ No newline at end of file +var _0x6364=['isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6364,0x8f));var _0x4636=function(_0x263ec6,_0x4033cb){_0x263ec6=_0x263ec6-0x0;var _0x4a4461=_0x6364[_0x263ec6];return _0x4a4461;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4636('0x0'));var timeout=require(_0x4636('0x1'));var express=require(_0x4636('0x2'));var router=express[_0x4636('0x3')]();var fs_extra=require(_0x4636('0x4'));var auth=require(_0x4636('0x5'));var interaction=require(_0x4636('0x6'));var config=require(_0x4636('0x7'));var controller=require('./intFreshsalesField.controller');router[_0x4636('0x8')]('/',auth[_0x4636('0x9')](),controller[_0x4636('0xa')]);router[_0x4636('0x8')](_0x4636('0xb'),auth['isAuthenticated'](),controller[_0x4636('0xc')]);router[_0x4636('0xd')]('/',auth[_0x4636('0x9')](),controller[_0x4636('0xe')]);router['put'](_0x4636('0xb'),auth[_0x4636('0x9')](),controller[_0x4636('0xf')]);router[_0x4636('0x10')](_0x4636('0xb'),auth['isAuthenticated'](),controller[_0x4636('0x11')]);module[_0x4636('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 18ad0f0..65124c2 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 _0x0d1a=['variable','sequelize','customVariable','keyValue','STRING','ENUM'];(function(_0x7e2c6,_0x3e72e3){var _0x22a736=function(_0x159fd5){while(--_0x159fd5){_0x7e2c6['push'](_0x7e2c6['shift']());}};_0x22a736(++_0x3e72e3);}(_0x0d1a,0x7f));var _0xa0d1=function(_0x588a8d,_0x25e69c){_0x588a8d=_0x588a8d-0x0;var _0x19e67e=_0x0d1a[_0x588a8d];return _0x19e67e;};'use strict';var Sequelize=require(_0xa0d1('0x0'));module['exports']={'type':{'type':Sequelize['ENUM']('string','variable',_0xa0d1('0x1'),_0xa0d1('0x2'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xa0d1('0x3')]},'keyType':{'type':Sequelize[_0xa0d1('0x4')]('string',_0xa0d1('0x5'),_0xa0d1('0x1'))},'keyContent':{'type':Sequelize[_0xa0d1('0x3')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xa0d1('0x3')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb6dc=['sequelize','exports','ENUM','string','customVariable','keyValue','picklist','STRING','BOOLEAN'];(function(_0x7303c,_0x2d7803){var _0x367cc7=function(_0x333990){while(--_0x333990){_0x7303c['push'](_0x7303c['shift']());}};_0x367cc7(++_0x2d7803);}(_0xb6dc,0xd8));var _0xcb6d=function(_0x2664c0,_0xe32904){_0x2664c0=_0x2664c0-0x0;var _0x37814f=_0xb6dc[_0x2664c0];return _0x37814f;};'use strict';var Sequelize=require(_0xcb6d('0x0'));module[_0xcb6d('0x1')]={'type':{'type':Sequelize[_0xcb6d('0x2')](_0xcb6d('0x3'),'variable',_0xcb6d('0x4'),_0xcb6d('0x5'),_0xcb6d('0x6')),'defaultValue':_0xcb6d('0x3')},'content':{'type':Sequelize[_0xcb6d('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xcb6d('0x3'),'variable',_0xcb6d('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xcb6d('0x7')]},'customField':{'type':Sequelize[_0xcb6d('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xcb6d('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 6edce5b..e9a9f7e 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 _0x1b2e=['include','findAll','rows','catch','show','params','length','find','body','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','send','map','FreshsalesField','rawAttributes','fieldName','key','model','name','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filters','filter','where','merge','type','count','includeAll'];(function(_0x293274,_0x1f9041){var _0x21730e=function(_0x56fc27){while(--_0x56fc27){_0x293274['push'](_0x293274['shift']());}};_0x21730e(++_0x1f9041);}(_0x1b2e,0x131));var _0xe1b2=function(_0x42c8d6,_0x4513e7){_0x42c8d6=_0x42c8d6-0x0;var _0x4a0319=_0x1b2e[_0x42c8d6];return _0x4a0319;};'use strict';var emlformat=require(_0xe1b2('0x0'));var rimraf=require(_0xe1b2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe1b2('0x2'));var rp=require(_0xe1b2('0x3'));var moment=require(_0xe1b2('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe1b2('0x5'));var util=require(_0xe1b2('0x6'));var path=require(_0xe1b2('0x7'));var sox=require('sox');var csv=require(_0xe1b2('0x8'));var ejs=require(_0xe1b2('0x9'));var fs=require('fs');var fs_extra=require(_0xe1b2('0xa'));var _=require(_0xe1b2('0xb'));var squel=require(_0xe1b2('0xc'));var crypto=require(_0xe1b2('0xd'));var jsforce=require(_0xe1b2('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe1b2('0x8'));var querystring=require('querystring');var Papa=require(_0xe1b2('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe1b2('0x10'));var hardwareService=require(_0xe1b2('0x11'));var logger=require(_0xe1b2('0x12'))(_0xe1b2('0x13'));var utils=require(_0xe1b2('0x14'));var config=require(_0xe1b2('0x15'));var licenseUtil=require(_0xe1b2('0x16'));var db=require(_0xe1b2('0x17'))['db'];function respondWithStatusCode(_0x3df8b4,_0xc22b32){_0xc22b32=_0xc22b32||0xcc;return function(_0x5bbfd4){if(_0x5bbfd4){return _0x3df8b4['sendStatus'](_0xc22b32);}return _0x3df8b4[_0xe1b2('0x18')](_0xc22b32)[_0xe1b2('0x19')]();};}function respondWithResult(_0x3f527d,_0x275401){_0x275401=_0x275401||0xc8;return function(_0x3a9940){if(_0x3a9940){return _0x3f527d['status'](_0x275401)[_0xe1b2('0x1a')](_0x3a9940);}};}function respondWithFilteredResult(_0x5c2c11,_0x1bf311){return function(_0x2ba6dd){if(_0x2ba6dd){var _0x3dcc0c=typeof _0x1bf311['offset']===_0xe1b2('0x1b')&&typeof _0x1bf311[_0xe1b2('0x1c')]==='undefined';var _0x316b9f=_0x2ba6dd['count'];var _0x4d3e91=_0x3dcc0c?0x0:_0x1bf311[_0xe1b2('0x1d')];var _0x182b6b=_0x3dcc0c?_0x2ba6dd['count']:_0x1bf311[_0xe1b2('0x1d')]+_0x1bf311[_0xe1b2('0x1c')];var _0x28197f;if(_0x182b6b>=_0x316b9f){_0x182b6b=_0x316b9f;_0x28197f=0xc8;}else{_0x28197f=0xce;}_0x5c2c11[_0xe1b2('0x18')](_0x28197f);return _0x5c2c11[_0xe1b2('0x1e')](_0xe1b2('0x1f'),_0x4d3e91+'-'+_0x182b6b+'/'+_0x316b9f)['json'](_0x2ba6dd);}return null;};}function patchUpdates(_0x47c693){return function(_0x176078){try{jsonpatch[_0xe1b2('0x20')](_0x176078,_0x47c693,!![]);}catch(_0x305116){return BPromise[_0xe1b2('0x21')](_0x305116);}return _0x176078[_0xe1b2('0x22')]();};}function saveUpdates(_0xeab6d2,_0x17c27b){return function(_0x1e31e8){if(_0x1e31e8){return _0x1e31e8[_0xe1b2('0x23')](_0xeab6d2)[_0xe1b2('0x24')](function(_0x3fdce0){return _0x3fdce0;});}return null;};}function removeEntity(_0x49e459,_0x9bc965){return function(_0x5b2e9d){if(_0x5b2e9d){return _0x5b2e9d[_0xe1b2('0x25')]()['then'](function(){_0x49e459[_0xe1b2('0x18')](0xcc)[_0xe1b2('0x19')]();});}};}function handleEntityNotFound(_0x42ca90,_0x2fefb3){return function(_0x275dfb){if(!_0x275dfb){_0x42ca90[_0xe1b2('0x26')](0x194);}return _0x275dfb;};}function handleError(_0x34c2b2,_0x372384){_0x372384=_0x372384||0x1f4;return function(_0x12207e){logger[_0xe1b2('0x27')](_0x12207e[_0xe1b2('0x28')]);if(_0x12207e['name']){delete _0x12207e['name'];}_0x34c2b2[_0xe1b2('0x18')](_0x372384)[_0xe1b2('0x29')](_0x12207e);};}exports['index']=function(_0x25499a,_0x20e015){var _0xf0e2c2={},_0x122c6b={},_0x167ddf={'count':0x0,'rows':[]};var _0x59306e=_[_0xe1b2('0x2a')](db[_0xe1b2('0x2b')][_0xe1b2('0x2c')],function(_0x320f87){return{'name':_0x320f87[_0xe1b2('0x2d')],'type':_0x320f87['type'][_0xe1b2('0x2e')]};});_0x122c6b[_0xe1b2('0x2f')]=_[_0xe1b2('0x2a')](_0x59306e,_0xe1b2('0x30'));_0x122c6b[_0xe1b2('0x31')]=_[_0xe1b2('0x32')](_0x25499a[_0xe1b2('0x31')]);_0x122c6b['filters']=_[_0xe1b2('0x33')](_0x122c6b['model'],_0x122c6b['query']);_0xf0e2c2[_0xe1b2('0x34')]=_['intersection'](_0x122c6b[_0xe1b2('0x2f')],qs[_0xe1b2('0x35')](_0x25499a[_0xe1b2('0x31')]['fields']));_0xf0e2c2[_0xe1b2('0x34')]=_0xf0e2c2[_0xe1b2('0x34')]['length']?_0xf0e2c2[_0xe1b2('0x34')]:_0x122c6b[_0xe1b2('0x2f')];if(!_0x25499a[_0xe1b2('0x31')][_0xe1b2('0x36')]('nolimit')){_0xf0e2c2['limit']=qs[_0xe1b2('0x1c')](_0x25499a['query'][_0xe1b2('0x1c')]);_0xf0e2c2['offset']=qs['offset'](_0x25499a[_0xe1b2('0x31')]['offset']);}_0xf0e2c2[_0xe1b2('0x37')]=qs[_0xe1b2('0x38')](_0x25499a[_0xe1b2('0x31')][_0xe1b2('0x38')]);_0xf0e2c2['where']=qs['filters'](_[_0xe1b2('0x39')](_0x25499a[_0xe1b2('0x31')],_0x122c6b[_0xe1b2('0x3a')]),_0x59306e);if(_0x25499a[_0xe1b2('0x31')][_0xe1b2('0x3b')]){_0xf0e2c2[_0xe1b2('0x3c')]=_[_0xe1b2('0x3d')](_0xf0e2c2[_0xe1b2('0x3c')],{'$or':_['map'](_0x59306e,function(_0x5cd2f9){if(_0x5cd2f9[_0xe1b2('0x3e')]!=='VIRTUAL'){var _0x46abc6={};_0x46abc6[_0x5cd2f9[_0xe1b2('0x30')]]={'$like':'%'+_0x25499a['query']['filter']+'%'};return _0x46abc6;}})});}_0xf0e2c2=_['merge']({},_0xf0e2c2,_0x25499a['options']);var _0x23c4ae={'where':_0xf0e2c2['where']};return db[_0xe1b2('0x2b')][_0xe1b2('0x3f')](_0x23c4ae)['then'](function(_0x44e3d){_0x167ddf['count']=_0x44e3d;if(_0x25499a[_0xe1b2('0x31')][_0xe1b2('0x40')]){_0xf0e2c2[_0xe1b2('0x41')]=[{'all':!![]}];}return db[_0xe1b2('0x2b')][_0xe1b2('0x42')](_0xf0e2c2);})['then'](function(_0x2f7352){_0x167ddf[_0xe1b2('0x43')]=_0x2f7352;return _0x167ddf;})['then'](respondWithFilteredResult(_0x20e015,_0xf0e2c2))[_0xe1b2('0x44')](handleError(_0x20e015,null));};exports[_0xe1b2('0x45')]=function(_0x4a9017,_0x5542e4){var _0x4bf49b={'raw':!![],'where':{'id':_0x4a9017[_0xe1b2('0x46')]['id']}},_0x5cdfb6={};_0x5cdfb6[_0xe1b2('0x2f')]=_['keys'](db[_0xe1b2('0x2b')]['rawAttributes']);_0x5cdfb6[_0xe1b2('0x31')]=_[_0xe1b2('0x32')](_0x4a9017[_0xe1b2('0x31')]);_0x5cdfb6[_0xe1b2('0x3a')]=_[_0xe1b2('0x33')](_0x5cdfb6['model'],_0x5cdfb6[_0xe1b2('0x31')]);_0x4bf49b[_0xe1b2('0x34')]=_[_0xe1b2('0x33')](_0x5cdfb6['model'],qs['fields'](_0x4a9017[_0xe1b2('0x31')]['fields']));_0x4bf49b[_0xe1b2('0x34')]=_0x4bf49b[_0xe1b2('0x34')][_0xe1b2('0x47')]?_0x4bf49b['attributes']:_0x5cdfb6[_0xe1b2('0x2f')];if(_0x4a9017[_0xe1b2('0x31')][_0xe1b2('0x40')]){_0x4bf49b[_0xe1b2('0x41')]=[{'all':!![]}];}_0x4bf49b=_[_0xe1b2('0x3d')]({},_0x4bf49b,_0x4a9017['options']);return db[_0xe1b2('0x2b')][_0xe1b2('0x48')](_0x4bf49b)[_0xe1b2('0x24')](handleEntityNotFound(_0x5542e4,null))[_0xe1b2('0x24')](respondWithResult(_0x5542e4,null))[_0xe1b2('0x44')](handleError(_0x5542e4,null));};exports['create']=function(_0x485690,_0x562642){return db[_0xe1b2('0x2b')]['create'](_0x485690[_0xe1b2('0x49')],{})[_0xe1b2('0x24')](respondWithResult(_0x562642,0xc9))['catch'](handleError(_0x562642,null));};exports[_0xe1b2('0x23')]=function(_0x47fe11,_0x516400){if(_0x47fe11['body']['id']){delete _0x47fe11['body']['id'];}return db[_0xe1b2('0x2b')]['find']({'where':{'id':_0x47fe11[_0xe1b2('0x46')]['id']}})[_0xe1b2('0x24')](handleEntityNotFound(_0x516400,null))[_0xe1b2('0x24')](saveUpdates(_0x47fe11['body'],null))[_0xe1b2('0x24')](respondWithResult(_0x516400,null))['catch'](handleError(_0x516400,null));};exports[_0xe1b2('0x25')]=function(_0xa25ac2,_0xf97653){return db[_0xe1b2('0x2b')][_0xe1b2('0x48')]({'where':{'id':_0xa25ac2[_0xe1b2('0x46')]['id']}})['then'](handleEntityNotFound(_0xf97653,null))[_0xe1b2('0x24')](removeEntity(_0xf97653,null))[_0xe1b2('0x44')](handleError(_0xf97653,null));}; \ No newline at end of file +var _0xe579=['../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','offset','limit','set','Content-Range','reject','save','update','then','error','stack','send','index','map','rawAttributes','type','name','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','count','includeAll','FreshsalesField','rows','catch','show','params','include','find','create','body','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0xec1289,_0x4fa82b){var _0x3e223c=function(_0x9752ec){while(--_0x9752ec){_0xec1289['push'](_0xec1289['shift']());}};_0x3e223c(++_0x4fa82b);}(_0xe579,0x87));var _0x9e57=function(_0x12c420,_0xb66261){_0x12c420=_0x12c420-0x0;var _0x179acc=_0xe579[_0x12c420];return _0x179acc;};'use strict';var emlformat=require(_0x9e57('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9e57('0x1'));var jsonpatch=require(_0x9e57('0x2'));var rp=require(_0x9e57('0x3'));var moment=require(_0x9e57('0x4'));var BPromise=require(_0x9e57('0x5'));var Mustache=require(_0x9e57('0x6'));var util=require(_0x9e57('0x7'));var path=require('path');var sox=require(_0x9e57('0x8'));var csv=require(_0x9e57('0x9'));var ejs=require(_0x9e57('0xa'));var fs=require('fs');var fs_extra=require(_0x9e57('0xb'));var _=require(_0x9e57('0xc'));var squel=require('squel');var crypto=require(_0x9e57('0xd'));var jsforce=require(_0x9e57('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x9e57('0x9'));var querystring=require(_0x9e57('0xf'));var Papa=require(_0x9e57('0x10'));var Redis=require(_0x9e57('0x11'));var authService=require(_0x9e57('0x12'));var qs=require(_0x9e57('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9e57('0x14'));var logger=require(_0x9e57('0x15'))('api');var utils=require(_0x9e57('0x16'));var config=require(_0x9e57('0x17'));var licenseUtil=require(_0x9e57('0x18'));var db=require(_0x9e57('0x19'))['db'];function respondWithStatusCode(_0x566e60,_0x32a3c5){_0x32a3c5=_0x32a3c5||0xcc;return function(_0x29437f){if(_0x29437f){return _0x566e60[_0x9e57('0x1a')](_0x32a3c5);}return _0x566e60[_0x9e57('0x1b')](_0x32a3c5)[_0x9e57('0x1c')]();};}function respondWithResult(_0x187dbd,_0x22377a){_0x22377a=_0x22377a||0xc8;return function(_0x1154fa){if(_0x1154fa){return _0x187dbd[_0x9e57('0x1b')](_0x22377a)[_0x9e57('0x1d')](_0x1154fa);}};}function respondWithFilteredResult(_0x5cc35b,_0x57a9b7){return function(_0x3aa399){if(_0x3aa399){var _0x400fe8=typeof _0x57a9b7['offset']==='undefined'&&typeof _0x57a9b7['limit']===_0x9e57('0x1e');var _0x3602bc=_0x3aa399['count'];var _0x1a3dbf=_0x400fe8?0x0:_0x57a9b7[_0x9e57('0x1f')];var _0x11fd22=_0x400fe8?_0x3aa399['count']:_0x57a9b7[_0x9e57('0x1f')]+_0x57a9b7[_0x9e57('0x20')];var _0x272803;if(_0x11fd22>=_0x3602bc){_0x11fd22=_0x3602bc;_0x272803=0xc8;}else{_0x272803=0xce;}_0x5cc35b['status'](_0x272803);return _0x5cc35b[_0x9e57('0x21')](_0x9e57('0x22'),_0x1a3dbf+'-'+_0x11fd22+'/'+_0x3602bc)[_0x9e57('0x1d')](_0x3aa399);}return null;};}function patchUpdates(_0x17785d){return function(_0x47ba32){try{jsonpatch['apply'](_0x47ba32,_0x17785d,!![]);}catch(_0x51c5c3){return BPromise[_0x9e57('0x23')](_0x51c5c3);}return _0x47ba32[_0x9e57('0x24')]();};}function saveUpdates(_0x40262e,_0x1f01e4){return function(_0x31ef76){if(_0x31ef76){return _0x31ef76[_0x9e57('0x25')](_0x40262e)[_0x9e57('0x26')](function(_0x20911b){return _0x20911b;});}return null;};}function removeEntity(_0x22c08c,_0x13904a){return function(_0x3ad165){if(_0x3ad165){return _0x3ad165['destroy']()[_0x9e57('0x26')](function(){_0x22c08c[_0x9e57('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28cf4a,_0x1d1491){return function(_0x5943ad){if(!_0x5943ad){_0x28cf4a['sendStatus'](0x194);}return _0x5943ad;};}function handleError(_0x3c3757,_0x409b9a){_0x409b9a=_0x409b9a||0x1f4;return function(_0x2ac99d){logger[_0x9e57('0x27')](_0x2ac99d[_0x9e57('0x28')]);if(_0x2ac99d['name']){delete _0x2ac99d['name'];}_0x3c3757[_0x9e57('0x1b')](_0x409b9a)[_0x9e57('0x29')](_0x2ac99d);};}exports[_0x9e57('0x2a')]=function(_0x1c493e,_0x229cb5){var _0x19ec35={},_0x1f280a={},_0x509c01={'count':0x0,'rows':[]};var _0x57fa4d=_[_0x9e57('0x2b')](db['FreshsalesField'][_0x9e57('0x2c')],function(_0x526699){return{'name':_0x526699['fieldName'],'type':_0x526699[_0x9e57('0x2d')]['key']};});_0x1f280a['model']=_[_0x9e57('0x2b')](_0x57fa4d,_0x9e57('0x2e'));_0x1f280a[_0x9e57('0x2f')]=_[_0x9e57('0x30')](_0x1c493e[_0x9e57('0x2f')]);_0x1f280a[_0x9e57('0x31')]=_[_0x9e57('0x32')](_0x1f280a[_0x9e57('0x33')],_0x1f280a[_0x9e57('0x2f')]);_0x19ec35[_0x9e57('0x34')]=_[_0x9e57('0x32')](_0x1f280a['model'],qs[_0x9e57('0x35')](_0x1c493e['query'][_0x9e57('0x35')]));_0x19ec35['attributes']=_0x19ec35[_0x9e57('0x34')][_0x9e57('0x36')]?_0x19ec35['attributes']:_0x1f280a['model'];if(!_0x1c493e[_0x9e57('0x2f')][_0x9e57('0x37')](_0x9e57('0x38'))){_0x19ec35[_0x9e57('0x20')]=qs[_0x9e57('0x20')](_0x1c493e[_0x9e57('0x2f')][_0x9e57('0x20')]);_0x19ec35[_0x9e57('0x1f')]=qs[_0x9e57('0x1f')](_0x1c493e[_0x9e57('0x2f')][_0x9e57('0x1f')]);}_0x19ec35[_0x9e57('0x39')]=qs[_0x9e57('0x3a')](_0x1c493e[_0x9e57('0x2f')]['sort']);_0x19ec35['where']=qs[_0x9e57('0x31')](_[_0x9e57('0x3b')](_0x1c493e[_0x9e57('0x2f')],_0x1f280a['filters']),_0x57fa4d);if(_0x1c493e[_0x9e57('0x2f')]['filter']){_0x19ec35[_0x9e57('0x3c')]=_[_0x9e57('0x3d')](_0x19ec35['where'],{'$or':_[_0x9e57('0x2b')](_0x57fa4d,function(_0x519b6e){if(_0x519b6e[_0x9e57('0x2d')]!==_0x9e57('0x3e')){var _0x2f4cd6={};_0x2f4cd6[_0x519b6e[_0x9e57('0x2e')]]={'$like':'%'+_0x1c493e['query'][_0x9e57('0x3f')]+'%'};return _0x2f4cd6;}})});}_0x19ec35=_[_0x9e57('0x3d')]({},_0x19ec35,_0x1c493e[_0x9e57('0x40')]);var _0x5bf799={'where':_0x19ec35[_0x9e57('0x3c')]};return db['FreshsalesField'][_0x9e57('0x41')](_0x5bf799)[_0x9e57('0x26')](function(_0x5305ec){_0x509c01[_0x9e57('0x41')]=_0x5305ec;if(_0x1c493e[_0x9e57('0x2f')][_0x9e57('0x42')]){_0x19ec35['include']=[{'all':!![]}];}return db[_0x9e57('0x43')]['findAll'](_0x19ec35);})[_0x9e57('0x26')](function(_0x246482){_0x509c01[_0x9e57('0x44')]=_0x246482;return _0x509c01;})[_0x9e57('0x26')](respondWithFilteredResult(_0x229cb5,_0x19ec35))[_0x9e57('0x45')](handleError(_0x229cb5,null));};exports[_0x9e57('0x46')]=function(_0xa85d6d,_0x21da42){var _0x14279e={'raw':!![],'where':{'id':_0xa85d6d[_0x9e57('0x47')]['id']}},_0x36e808={};_0x36e808[_0x9e57('0x33')]=_[_0x9e57('0x30')](db[_0x9e57('0x43')][_0x9e57('0x2c')]);_0x36e808[_0x9e57('0x2f')]=_[_0x9e57('0x30')](_0xa85d6d['query']);_0x36e808['filters']=_['intersection'](_0x36e808[_0x9e57('0x33')],_0x36e808['query']);_0x14279e[_0x9e57('0x34')]=_['intersection'](_0x36e808['model'],qs['fields'](_0xa85d6d['query']['fields']));_0x14279e['attributes']=_0x14279e[_0x9e57('0x34')][_0x9e57('0x36')]?_0x14279e[_0x9e57('0x34')]:_0x36e808[_0x9e57('0x33')];if(_0xa85d6d[_0x9e57('0x2f')]['includeAll']){_0x14279e[_0x9e57('0x48')]=[{'all':!![]}];}_0x14279e=_[_0x9e57('0x3d')]({},_0x14279e,_0xa85d6d[_0x9e57('0x40')]);return db[_0x9e57('0x43')][_0x9e57('0x49')](_0x14279e)['then'](handleEntityNotFound(_0x21da42,null))[_0x9e57('0x26')](respondWithResult(_0x21da42,null))[_0x9e57('0x45')](handleError(_0x21da42,null));};exports[_0x9e57('0x4a')]=function(_0x104960,_0x55d127){return db[_0x9e57('0x43')][_0x9e57('0x4a')](_0x104960['body'],{})[_0x9e57('0x26')](respondWithResult(_0x55d127,0xc9))[_0x9e57('0x45')](handleError(_0x55d127,null));};exports[_0x9e57('0x25')]=function(_0x543a95,_0x5ecdce){if(_0x543a95[_0x9e57('0x4b')]['id']){delete _0x543a95[_0x9e57('0x4b')]['id'];}return db['FreshsalesField']['find']({'where':{'id':_0x543a95[_0x9e57('0x47')]['id']}})[_0x9e57('0x26')](handleEntityNotFound(_0x5ecdce,null))[_0x9e57('0x26')](saveUpdates(_0x543a95[_0x9e57('0x4b')],null))[_0x9e57('0x26')](respondWithResult(_0x5ecdce,null))['catch'](handleError(_0x5ecdce,null));};exports[_0x9e57('0x4c')]=function(_0x85d3b7,_0x1f8450){return db[_0x9e57('0x43')][_0x9e57('0x49')]({'where':{'id':_0x85d3b7[_0x9e57('0x47')]['id']}})[_0x9e57('0x26')](handleEntityNotFound(_0x1f8450,null))[_0x9e57('0x26')](removeEntity(_0x1f8450,null))['catch'](handleError(_0x1f8450,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 7952752..4de21c9 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 _0x9e6b=['../../config/environment','exports','FreshsalesField','FieldId','lodash','util','api','request-promise','path','rimraf'];(function(_0x18edd7,_0x21192e){var _0x51d8be=function(_0x1bbd37){while(--_0x1bbd37){_0x18edd7['push'](_0x18edd7['shift']());}};_0x51d8be(++_0x21192e);}(_0x9e6b,0x11c));var _0xb9e6=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x9e6b[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0xb9e6('0x0'));var util=require(_0xb9e6('0x1'));var logger=require('../../config/logger')(_0xb9e6('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb9e6('0x3'));var fs=require('fs');var path=require(_0xb9e6('0x4'));var rimraf=require(_0xb9e6('0x5'));var config=require(_0xb9e6('0x6'));var attributes=require('./intFreshsalesField.attributes');module[_0xb9e6('0x7')]=function(_0x1a6a4f,_0x1b9eed){return _0x1a6a4f['define'](_0xb9e6('0x8'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':['idField',_0xb9e6('0x9')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdfb1=['api','bluebird','request-promise','path','rimraf','define','int_freshsales_fields','freshsales_unique_index','idField','FieldId','lodash','util','../../config/logger'];(function(_0x568496,_0x565afd){var _0x26c5c1=function(_0x4d251e){while(--_0x4d251e){_0x568496['push'](_0x568496['shift']());}};_0x26c5c1(++_0x565afd);}(_0xdfb1,0x8c));var _0x1dfb=function(_0x27d589,_0x41dd04){_0x27d589=_0x27d589-0x0;var _0x38cc29=_0xdfb1[_0x27d589];return _0x38cc29;};'use strict';var _=require(_0x1dfb('0x0'));var util=require(_0x1dfb('0x1'));var logger=require(_0x1dfb('0x2'))(_0x1dfb('0x3'));var moment=require('moment');var BPromise=require(_0x1dfb('0x4'));var rp=require(_0x1dfb('0x5'));var fs=require('fs');var path=require(_0x1dfb('0x6'));var rimraf=require(_0x1dfb('0x7'));var config=require('../../config/environment');var attributes=require('./intFreshsalesField.attributes');module['exports']=function(_0x31f0ff,_0x36bf77){return _0x31f0ff[_0x1dfb('0x8')]('FreshsalesField',attributes,{'tableName':_0x1dfb('0x9'),'paranoid':![],'indexes':[{'name':_0x1dfb('0xa'),'fields':[_0x1dfb('0xb'),_0x1dfb('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index c30ad03..f8d781e 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 _0x6d38=['request','then','FreshsalesField,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x3969e9,_0x2f9378){var _0x42818e=function(_0x229b0d){while(--_0x229b0d){_0x3969e9['push'](_0x3969e9['shift']());}};_0x42818e(++_0x2f9378);}(_0x6d38,0x1ef));var _0x86d3=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x6d38[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require(_0x86d3('0x0'));var moment=require(_0x86d3('0x1'));var BPromise=require(_0x86d3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x86d3('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x86d3('0x4'))(_0x86d3('0x5'));var config=require(_0x86d3('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x86d3('0x7')][_0x86d3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x33d4aa,_0x2eaa15,_0x47e654){return new BPromise(function(_0x552b07,_0x2aea31){return client[_0x86d3('0x9')](_0x33d4aa,_0x47e654)[_0x86d3('0xa')](function(_0x499640){logger['info'](_0x86d3('0xb'),_0x2eaa15,_0x86d3('0xc'));logger['debug']('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x2eaa15,_0x86d3('0xc'),JSON[_0x86d3('0xd')](_0x499640));if(_0x499640['error']){if(_0x499640[_0x86d3('0xe')]['code']===0x1f4){logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);return _0x2aea31(_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);}logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x499640['error'][_0x86d3('0xf')]);return _0x552b07(_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);}else{logger[_0x86d3('0x10')](_0x86d3('0xb'),_0x2eaa15,_0x86d3('0xc'));_0x552b07(_0x499640[_0x86d3('0x11')][_0x86d3('0xf')]);}})['catch'](function(_0x2d5ba9){logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x2d5ba9);_0x2aea31(_0x2d5ba9);});});} \ No newline at end of file +var _0xeda8=['debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesField,\x20%s,\x20%s','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent'];(function(_0x3a1ff0,_0x778ffd){var _0x3f7f9e=function(_0x47715c){while(--_0x47715c){_0x3a1ff0['push'](_0x3a1ff0['shift']());}};_0x3f7f9e(++_0x778ffd);}(_0xeda8,0x104));var _0x8eda=function(_0x5696f3,_0x4a9618){_0x5696f3=_0x5696f3-0x0;var _0x5774e8=_0xeda8[_0x5696f3];return _0x5774e8;};'use strict';var _=require(_0x8eda('0x0'));var util=require(_0x8eda('0x1'));var moment=require('moment');var BPromise=require(_0x8eda('0x2'));var rs=require(_0x8eda('0x3'));var fs=require('fs');var Redis=require(_0x8eda('0x4'));var db=require(_0x8eda('0x5'))['db'];var utils=require(_0x8eda('0x6'));var logger=require(_0x8eda('0x7'))(_0x8eda('0x8'));var config=require(_0x8eda('0x9'));var jayson=require(_0x8eda('0xa'));var client=jayson[_0x8eda('0xb')][_0x8eda('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x32abe8,_0x4e2ebb,_0x28b721){return new BPromise(function(_0x1b6a1d,_0x5aa93d){return client[_0x8eda('0xd')](_0x32abe8,_0x28b721)['then'](function(_0x4f7893){logger['info']('FreshsalesField,\x20%s,\x20%s',_0x4e2ebb,_0x8eda('0xe'));logger[_0x8eda('0xf')](_0x8eda('0x10'),_0x4e2ebb,'request\x20sent',JSON[_0x8eda('0x11')](_0x4f7893));if(_0x4f7893['error']){if(_0x4f7893[_0x8eda('0x12')][_0x8eda('0x13')]===0x1f4){logger[_0x8eda('0x12')](_0x8eda('0x14'),_0x4e2ebb,_0x4f7893[_0x8eda('0x12')][_0x8eda('0x15')]);return _0x5aa93d(_0x4f7893[_0x8eda('0x12')][_0x8eda('0x15')]);}logger['error']('FreshsalesField,\x20%s,\x20%s',_0x4e2ebb,_0x4f7893[_0x8eda('0x12')][_0x8eda('0x15')]);return _0x1b6a1d(_0x4f7893['error'][_0x8eda('0x15')]);}else{logger[_0x8eda('0x16')](_0x8eda('0x14'),_0x4e2ebb,'request\x20sent');_0x1b6a1d(_0x4f7893[_0x8eda('0x17')]['message']);}})[_0x8eda('0x18')](function(_0x553382){logger[_0x8eda('0x12')]('FreshsalesField,\x20%s,\x20%s',_0x4e2ebb,_0x553382);_0x5aa93d(_0x553382);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index e0d398c..fda3f03 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(_0x52c284,_0x274830){var _0xf0d742=function(_0x2a8593){while(--_0x2a8593){_0x52c284['push'](_0x52c284['shift']());}};_0xf0d742(++_0x274830);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'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(_0x58e06d,_0x4a141e){var _0x3b475b=function(_0x515c77){while(--_0x515c77){_0x58e06d['push'](_0x58e06d['shift']());}};_0x3b475b(++_0x4a141e);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index cb803d9..8d7aabf 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 _0xb4b6=['newTab','exports','STRING','username','integrationTab'];(function(_0x5c6994,_0x19ad9a){var _0x1d5c84=function(_0x4a385a){while(--_0x4a385a){_0x5c6994['push'](_0x5c6994['shift']());}};_0x1d5c84(++_0x19ad9a);}(_0xb4b6,0x7e));var _0x6b4b=function(_0x2f5024,_0xe5994e){_0x2f5024=_0x2f5024-0x0;var _0x372a6e=_0xb4b6[_0x2f5024];return _0x372a6e;};'use strict';var Sequelize=require('sequelize');module[_0x6b4b('0x0')]={'name':{'type':Sequelize[_0x6b4b('0x1')]},'description':{'type':Sequelize[_0x6b4b('0x1')]},'username':{'type':Sequelize[_0x6b4b('0x1')],'unique':_0x6b4b('0x2')},'remoteUri':{'type':Sequelize[_0x6b4b('0x1')]},'password':{'type':Sequelize[_0x6b4b('0x1')]},'clientId':{'type':Sequelize[_0x6b4b('0x1')]},'clientSecret':{'type':Sequelize[_0x6b4b('0x1')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x6b4b('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x6b4b('0x3'),_0x6b4b('0x4')),'defaultValue':_0x6b4b('0x3')}}; \ No newline at end of file +var _0x80e6=['newTab','exports','STRING','username','ENUM','integrationTab'];(function(_0x16d8db,_0x6a1999){var _0x51ca48=function(_0x412e25){while(--_0x412e25){_0x16d8db['push'](_0x16d8db['shift']());}};_0x51ca48(++_0x6a1999);}(_0x80e6,0x1e7));var _0x680e=function(_0x20dd99,_0x5516d3){_0x20dd99=_0x20dd99-0x0;var _0x41548d=_0x80e6[_0x20dd99];return _0x41548d;};'use strict';var Sequelize=require('sequelize');module[_0x680e('0x0')]={'name':{'type':Sequelize[_0x680e('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x680e('0x1')],'unique':_0x680e('0x2')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x680e('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x680e('0x1')]},'securityToken':{'type':Sequelize[_0x680e('0x1')]},'serverUrl':{'type':Sequelize[_0x680e('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x680e('0x3')](_0x680e('0x4'),_0x680e('0x5')),'defaultValue':_0x680e('0x4')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 4c17382..174fded 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 _0xff8a=['email','phone','remove','includes','label','custom','picklistValues','value','true','False','false','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','test','eml-format','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','error','name','send','index','SalesforceAccount','fieldName','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','map','VIRTUAL','include','findAll','rows','catch','params','keys','rawAttributes','length','includeAll','find','create','body','destroy','getConfigurations','SalesforceConfiguration','options','nolimit','addConfiguration','findOne','AccountId','Subjects','channel','Descriptions','getDescriptions','SalesforceField','Task','remoteUri','clientId','clientSecret','username','password','securityToken','slice','login','concat','isNil','ticketType','sobject','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','picklist','boolean'];(function(_0x44bcb6,_0x16e9a3){var _0x49ac0f=function(_0x418622){while(--_0x418622){_0x44bcb6['push'](_0x44bcb6['shift']());}};_0x49ac0f(++_0x16e9a3);}(_0xff8a,0x86));var _0xaff8=function(_0xc8f794,_0x1c8170){_0xc8f794=_0xc8f794-0x0;var _0xb2b464=_0xff8a[_0xc8f794];return _0xb2b464;};'use strict';var emlformat=require(_0xaff8('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xaff8('0x1'));var rp=require(_0xaff8('0x2'));var moment=require(_0xaff8('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xaff8('0x4'));var util=require('util');var path=require('path');var sox=require(_0xaff8('0x5'));var csv=require(_0xaff8('0x6'));var ejs=require(_0xaff8('0x7'));var fs=require('fs');var fs_extra=require(_0xaff8('0x8'));var _=require('lodash');var squel=require(_0xaff8('0x9'));var crypto=require(_0xaff8('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xaff8('0x6'));var querystring=require(_0xaff8('0xb'));var Papa=require('papaparse');var Redis=require(_0xaff8('0xc'));var authService=require(_0xaff8('0xd'));var qs=require(_0xaff8('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaff8('0xf'));var logger=require('../../config/logger')(_0xaff8('0x10'));var utils=require(_0xaff8('0x11'));var config=require(_0xaff8('0x12'));var licenseUtil=require(_0xaff8('0x13'));var db=require('../../mysqldb')['db'];var integrations=require(_0xaff8('0x14'));function respondWithStatusCode(_0x4f930d,_0xc1afc6){_0xc1afc6=_0xc1afc6||0xcc;return function(_0x421038){if(_0x421038){return _0x4f930d[_0xaff8('0x15')](_0xc1afc6);}return _0x4f930d[_0xaff8('0x16')](_0xc1afc6)['end']();};}function respondWithResult(_0x1457e2,_0x53c17b){_0x53c17b=_0x53c17b||0xc8;return function(_0x2707d8){if(_0x2707d8){return _0x1457e2['status'](_0x53c17b)[_0xaff8('0x17')](_0x2707d8);}};}function respondWithFilteredResult(_0x6f9553,_0x237429){return function(_0x33ee08){if(_0x33ee08){var _0x3825af=typeof _0x237429['offset']==='undefined'&&typeof _0x237429['limit']==='undefined';var _0x85112a=_0x33ee08[_0xaff8('0x18')];var _0x18be85=_0x3825af?0x0:_0x237429[_0xaff8('0x19')];var _0x78a715=_0x3825af?_0x33ee08[_0xaff8('0x18')]:_0x237429[_0xaff8('0x19')]+_0x237429[_0xaff8('0x1a')];var _0x4d5e53;if(_0x78a715>=_0x85112a){_0x78a715=_0x85112a;_0x4d5e53=0xc8;}else{_0x4d5e53=0xce;}_0x6f9553['status'](_0x4d5e53);return _0x6f9553[_0xaff8('0x1b')](_0xaff8('0x1c'),_0x18be85+'-'+_0x78a715+'/'+_0x85112a)[_0xaff8('0x17')](_0x33ee08);}return null;};}function patchUpdates(_0x16be00){return function(_0x8fd55c){try{jsonpatch['apply'](_0x8fd55c,_0x16be00,!![]);}catch(_0x5c52e8){return BPromise[_0xaff8('0x1d')](_0x5c52e8);}return _0x8fd55c[_0xaff8('0x1e')]();};}function saveUpdates(_0xa9ca05,_0xbd79b9){return function(_0x553b7d){if(_0x553b7d){return _0x553b7d[_0xaff8('0x1f')](_0xa9ca05)[_0xaff8('0x20')](function(_0x650e1e){return _0x650e1e;});}return null;};}function removeEntity(_0x25dda3,_0x1eb6f3){return function(_0x12b6a8){if(_0x12b6a8){return _0x12b6a8['destroy']()[_0xaff8('0x20')](function(){_0x25dda3[_0xaff8('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x339f3f,_0x11a722){return function(_0x300af7){if(!_0x300af7){_0x339f3f[_0xaff8('0x15')](0x194);}return _0x300af7;};}function handleError(_0x4f7a79,_0x3aa140){_0x3aa140=_0x3aa140||0x1f4;return function(_0x5241cb){logger[_0xaff8('0x21')](_0x5241cb['stack']);if(_0x5241cb[_0xaff8('0x22')]){delete _0x5241cb[_0xaff8('0x22')];}_0x4f7a79[_0xaff8('0x16')](_0x3aa140)[_0xaff8('0x23')](_0x5241cb);};}exports[_0xaff8('0x24')]=function(_0x5dec6c,_0x4fce88){var _0x4fcdaa={},_0x47cf27={},_0x191fb8={'count':0x0,'rows':[]};var _0x5bd63f=_['map'](db[_0xaff8('0x25')]['rawAttributes'],function(_0x3b155d){return{'name':_0x3b155d[_0xaff8('0x26')],'type':_0x3b155d[_0xaff8('0x27')][_0xaff8('0x28')]};});_0x47cf27['model']=_['map'](_0x5bd63f,_0xaff8('0x22'));_0x47cf27[_0xaff8('0x29')]=_['keys'](_0x5dec6c['query']);_0x47cf27[_0xaff8('0x2a')]=_[_0xaff8('0x2b')](_0x47cf27[_0xaff8('0x2c')],_0x47cf27['query']);_0x4fcdaa[_0xaff8('0x2d')]=_[_0xaff8('0x2b')](_0x47cf27[_0xaff8('0x2c')],qs[_0xaff8('0x2e')](_0x5dec6c[_0xaff8('0x29')][_0xaff8('0x2e')]));_0x4fcdaa[_0xaff8('0x2d')]=_0x4fcdaa[_0xaff8('0x2d')]['length']?_0x4fcdaa[_0xaff8('0x2d')]:_0x47cf27[_0xaff8('0x2c')];if(!_0x5dec6c[_0xaff8('0x29')][_0xaff8('0x2f')]('nolimit')){_0x4fcdaa[_0xaff8('0x1a')]=qs[_0xaff8('0x1a')](_0x5dec6c[_0xaff8('0x29')][_0xaff8('0x1a')]);_0x4fcdaa[_0xaff8('0x19')]=qs[_0xaff8('0x19')](_0x5dec6c['query'][_0xaff8('0x19')]);}_0x4fcdaa[_0xaff8('0x30')]=qs['sort'](_0x5dec6c[_0xaff8('0x29')][_0xaff8('0x31')]);_0x4fcdaa[_0xaff8('0x32')]=qs[_0xaff8('0x2a')](_[_0xaff8('0x33')](_0x5dec6c[_0xaff8('0x29')],_0x47cf27[_0xaff8('0x2a')]),_0x5bd63f);if(_0x5dec6c['query'][_0xaff8('0x34')]){_0x4fcdaa[_0xaff8('0x32')]=_[_0xaff8('0x35')](_0x4fcdaa[_0xaff8('0x32')],{'$or':_[_0xaff8('0x36')](_0x5bd63f,function(_0x5da5d9){if(_0x5da5d9[_0xaff8('0x27')]!==_0xaff8('0x37')){var _0x258f4c={};_0x258f4c[_0x5da5d9[_0xaff8('0x22')]]={'$like':'%'+_0x5dec6c[_0xaff8('0x29')][_0xaff8('0x34')]+'%'};return _0x258f4c;}})});}_0x4fcdaa=_[_0xaff8('0x35')]({},_0x4fcdaa,_0x5dec6c['options']);var _0x51cdbc={'where':_0x4fcdaa[_0xaff8('0x32')]};return db[_0xaff8('0x25')]['count'](_0x51cdbc)[_0xaff8('0x20')](function(_0x1dd934){_0x191fb8[_0xaff8('0x18')]=_0x1dd934;if(_0x5dec6c[_0xaff8('0x29')]['includeAll']){_0x4fcdaa[_0xaff8('0x38')]=[{'all':!![]}];}return db[_0xaff8('0x25')][_0xaff8('0x39')](_0x4fcdaa);})[_0xaff8('0x20')](function(_0x48cfd2){_0x191fb8[_0xaff8('0x3a')]=_0x48cfd2;return _0x191fb8;})[_0xaff8('0x20')](respondWithFilteredResult(_0x4fce88,_0x4fcdaa))[_0xaff8('0x3b')](handleError(_0x4fce88,null));};exports['show']=function(_0x1f41ba,_0x3e7347){var _0x579c0d={'raw':![],'where':{'id':_0x1f41ba[_0xaff8('0x3c')]['id']}},_0x5e4265={};_0x5e4265['model']=_[_0xaff8('0x3d')](db['SalesforceAccount'][_0xaff8('0x3e')]);_0x5e4265[_0xaff8('0x29')]=_['keys'](_0x1f41ba[_0xaff8('0x29')]);_0x5e4265[_0xaff8('0x2a')]=_['intersection'](_0x5e4265[_0xaff8('0x2c')],_0x5e4265['query']);_0x579c0d['attributes']=_['intersection'](_0x5e4265[_0xaff8('0x2c')],qs[_0xaff8('0x2e')](_0x1f41ba['query'][_0xaff8('0x2e')]));_0x579c0d[_0xaff8('0x2d')]=_0x579c0d[_0xaff8('0x2d')][_0xaff8('0x3f')]?_0x579c0d[_0xaff8('0x2d')]:_0x5e4265[_0xaff8('0x2c')];if(_0x1f41ba[_0xaff8('0x29')][_0xaff8('0x40')]){_0x579c0d[_0xaff8('0x38')]=[{'all':!![]}];}_0x579c0d=_[_0xaff8('0x35')]({},_0x579c0d,_0x1f41ba['options']);return db[_0xaff8('0x25')][_0xaff8('0x41')](_0x579c0d)[_0xaff8('0x20')](handleEntityNotFound(_0x3e7347,null))[_0xaff8('0x20')](respondWithResult(_0x3e7347,null))[_0xaff8('0x3b')](handleError(_0x3e7347,null));};exports[_0xaff8('0x42')]=function(_0x2786c0,_0x2e1e52){return db[_0xaff8('0x25')]['create'](_0x2786c0[_0xaff8('0x43')],{})[_0xaff8('0x20')](respondWithResult(_0x2e1e52,0xc9))['catch'](handleError(_0x2e1e52,null));};exports[_0xaff8('0x1f')]=function(_0x3bb5ab,_0x38a337){if(_0x3bb5ab[_0xaff8('0x43')]['id']){delete _0x3bb5ab[_0xaff8('0x43')]['id'];}return db[_0xaff8('0x25')][_0xaff8('0x41')]({'where':{'id':_0x3bb5ab[_0xaff8('0x3c')]['id']}})[_0xaff8('0x20')](handleEntityNotFound(_0x38a337,null))['then'](saveUpdates(_0x3bb5ab[_0xaff8('0x43')],null))[_0xaff8('0x20')](respondWithResult(_0x38a337,null))[_0xaff8('0x3b')](handleError(_0x38a337,null));};exports[_0xaff8('0x44')]=function(_0x48fc15,_0x39ee48){return db['SalesforceAccount'][_0xaff8('0x41')]({'where':{'id':_0x48fc15['params']['id']}})['then'](handleEntityNotFound(_0x39ee48,null))[_0xaff8('0x20')](removeEntity(_0x39ee48,null))[_0xaff8('0x3b')](handleError(_0x39ee48,null));};exports[_0xaff8('0x45')]=function(_0xbe0880,_0x6789c9,_0xe8c6da){var _0x2d4983={};var _0x3ca901={};var _0x18a0b4;var _0x5aa79e;return db[_0xaff8('0x25')]['findOne']({'where':{'id':_0xbe0880[_0xaff8('0x3c')]['id']}})[_0xaff8('0x20')](handleEntityNotFound(_0x6789c9,null))['then'](function(_0x3e2074){if(_0x3e2074){_0x18a0b4=_0x3e2074;_0x3ca901[_0xaff8('0x2c')]=_['keys'](db[_0xaff8('0x46')][_0xaff8('0x3e')]);_0x3ca901[_0xaff8('0x29')]=_['keys'](_0xbe0880[_0xaff8('0x29')]);_0x3ca901[_0xaff8('0x2a')]=_['intersection'](_0x3ca901[_0xaff8('0x2c')],_0x3ca901[_0xaff8('0x29')]);_0x2d4983[_0xaff8('0x2d')]=_[_0xaff8('0x2b')](_0x3ca901[_0xaff8('0x2c')],qs[_0xaff8('0x2e')](_0xbe0880[_0xaff8('0x29')][_0xaff8('0x2e')]));_0x2d4983[_0xaff8('0x2d')]=_0x2d4983[_0xaff8('0x2d')][_0xaff8('0x3f')]?_0x2d4983['attributes']:_0x3ca901['model'];_0x2d4983[_0xaff8('0x30')]=qs[_0xaff8('0x31')](_0xbe0880['query'][_0xaff8('0x31')]);_0x2d4983[_0xaff8('0x32')]=qs[_0xaff8('0x2a')](_[_0xaff8('0x33')](_0xbe0880['query'],_0x3ca901[_0xaff8('0x2a')]));if(_0xbe0880['query'][_0xaff8('0x34')]){_0x2d4983[_0xaff8('0x32')]=_[_0xaff8('0x35')](_0x2d4983[_0xaff8('0x32')],{'$or':_[_0xaff8('0x36')](_0x2d4983[_0xaff8('0x2d')],function(_0xc360f8){var _0x2a6516={};_0x2a6516[_0xc360f8]={'$like':'%'+_0xbe0880[_0xaff8('0x29')][_0xaff8('0x34')]+'%'};return _0x2a6516;})});}_0x2d4983=_[_0xaff8('0x35')]({},_0x2d4983,_0xbe0880[_0xaff8('0x47')]);return _0x18a0b4[_0xaff8('0x45')](_0x2d4983);}})[_0xaff8('0x20')](function(_0x315031){if(_0x315031){_0x5aa79e=_0x315031[_0xaff8('0x3f')];if(!_0xbe0880[_0xaff8('0x29')][_0xaff8('0x2f')](_0xaff8('0x48'))){_0x2d4983[_0xaff8('0x1a')]=qs[_0xaff8('0x1a')](_0xbe0880['query'][_0xaff8('0x1a')]);_0x2d4983[_0xaff8('0x19')]=qs[_0xaff8('0x19')](_0xbe0880[_0xaff8('0x29')][_0xaff8('0x19')]);}return _0x18a0b4[_0xaff8('0x45')](_0x2d4983);}})[_0xaff8('0x20')](function(_0x288813){if(_0x288813){return _0x288813?{'count':_0x5aa79e,'rows':_0x288813}:null;}})['then'](respondWithResult(_0x6789c9,null))['catch'](handleError(_0x6789c9,null));};exports[_0xaff8('0x49')]=function(_0x4d748a,_0x75d316,_0x53784a){if(_0x4d748a[_0xaff8('0x43')]['id']){delete _0x4d748a['body']['id'];}return db[_0xaff8('0x25')][_0xaff8('0x4a')]({'where':{'id':_0x4d748a[_0xaff8('0x3c')]['id']}})['then'](handleEntityNotFound(_0x75d316,null))['then'](function(_0x2a03da){if(_0x2a03da){_0x4d748a['body'][_0xaff8('0x4b')]=_0x2a03da['id'];_0x4d748a[_0xaff8('0x43')][_0xaff8('0x4c')]=integrations['getSubjects'](_0x4d748a['body'][_0xaff8('0x4d')],_0x4d748a['body'][_0xaff8('0x27')]);_0x4d748a['body'][_0xaff8('0x4e')]=integrations[_0xaff8('0x4f')](_0x4d748a['body'][_0xaff8('0x4d')],_0x4d748a[_0xaff8('0x43')]['type']);return db[_0xaff8('0x46')][_0xaff8('0x42')](_0x4d748a['body'],{'include':[{'model':db[_0xaff8('0x50')],'as':'Subjects'},{'model':db[_0xaff8('0x50')],'as':'Descriptions'}]});}return null;})[_0xaff8('0x20')](respondWithResult(_0x75d316,null))['catch'](handleError(_0x75d316,null));};exports['getFields']=function(_0x244c95,_0x34d7ac,_0x4d525b){var _0x4bedc2;var _0x145ebf='';var _0x30af7a=_0xaff8('0x51');return db[_0xaff8('0x25')][_0xaff8('0x4a')]({'where':{'id':_0x244c95[_0xaff8('0x3c')]['id']},'attributes':['id',_0xaff8('0x52'),_0xaff8('0x53'),_0xaff8('0x54'),_0xaff8('0x55'),_0xaff8('0x56'),_0xaff8('0x57')]})[_0xaff8('0x20')](handleEntityNotFound(_0x34d7ac,null))['then'](function(_0x29886c){if(_0x29886c){_0x145ebf=_0x29886c['remoteUri'];var _0x36d582=_0x145ebf[_0xaff8('0x58')](-0x1);if(_0x36d582==='/'){_0x145ebf=_0x145ebf['substring'](0x0,_0x145ebf['lastIndexOf'](_0x36d582));}_0x4bedc2=new jsforce['Connection']({'oauth2':{'loginUrl':_0x145ebf,'clientId':_0x29886c[_0xaff8('0x53')],'clientSecret':_0x29886c[_0xaff8('0x54')]}});return _0x4bedc2[_0xaff8('0x59')](_0x29886c[_0xaff8('0x55')],_0x29886c['password'][_0xaff8('0x5a')](_0x29886c[_0xaff8('0x57')]));}})['then'](function(_0x26a3ef){if(_0x26a3ef){if(!_[_0xaff8('0x5b')](_0x244c95[_0xaff8('0x29')][_0xaff8('0x5c')])){_0x30af7a=_0x244c95[_0xaff8('0x29')][_0xaff8('0x5c')];}return _0x4bedc2[_0xaff8('0x5d')](_0x30af7a)['describe']();}})[_0xaff8('0x20')](function(_0x35bf36){var _0x1d92ae=[_0xaff8('0x5e'),_0xaff8('0x5f'),_0xaff8('0x60'),_0xaff8('0x61'),_0xaff8('0x62'),_0xaff8('0x63')];var _0x7670e6=['string','int',_0xaff8('0x64'),_0xaff8('0x65'),_0xaff8('0x66'),'textarea',_0xaff8('0x67')];if(_0x35bf36){_[_0xaff8('0x68')](_0x35bf36[_0xaff8('0x2e')],function(_0x155651){return _0x1d92ae[_0xaff8('0x69')](_0x155651[_0xaff8('0x22')])||!_0x7670e6['includes'](_0x155651[_0xaff8('0x27')]);});return{'count':_0x35bf36[_0xaff8('0x2e')][_0xaff8('0x3f')],'rows':_[_0xaff8('0x36')](_0x35bf36[_0xaff8('0x2e')],function(_0x3f87fb){return{'id':_0x3f87fb[_0xaff8('0x22')],'name':_0x3f87fb[_0xaff8('0x6a')],'custom':_0x3f87fb[_0xaff8('0x6b')],'options':_0x3f87fb[_0xaff8('0x6c')]['length']>0x0?_['map'](_0x3f87fb[_0xaff8('0x6c')],function(_0x15fff8){return{'name':_0x15fff8[_0xaff8('0x6a')],'value':_0x15fff8[_0xaff8('0x6d')]};}):_0x3f87fb[_0xaff8('0x27')]==_0xaff8('0x65')?[{'name':'True','value':_0xaff8('0x6e')},{'name':_0xaff8('0x6f'),'value':_0xaff8('0x70')}]:[]};})};}})[_0xaff8('0x20')](respondWithResult(_0x34d7ac,null))[_0xaff8('0x3b')](function(_0x1720a7){var _0xfbb7b5=_0x244c95[_0xaff8('0x29')]['test']?0x1f4:_0x1720a7[_0xaff8('0x71')]||0x1f4;logger['error'](_0xaff8('0x72'),_0xaff8('0x73'),_0xfbb7b5,JSON[_0xaff8('0x74')](_0x1720a7));delete _0x1720a7[_0xaff8('0x22')];if(_0xfbb7b5===0x191){_0xfbb7b5=0x190;}_0x34d7ac['status'](_0xfbb7b5)['send'](_0x244c95[_0xaff8('0x29')][_0xaff8('0x75')]?{'message':'Wrong\x20credentials','statusCode':_0x1720a7[_0xaff8('0x71')]}:_0x1720a7);});}; \ No newline at end of file +var _0xe3c7=['intersection','attributes','fields','length','hasOwnProperty','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','create','body','find','SalesforceConfiguration','sort','nolimit','getConfigurations','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','Task','remoteUri','clientId','securityToken','lastIndexOf','Connection','clientSecret','login','username','password','concat','isNil','ticketType','sobject','describe','OwnerId','IsReminderSet','IsRecurrence','Subject','Description','picklist','boolean','email','textarea','includes','label','picklistValues','value','true','False','false','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','count','Content-Range','save','update','then','destroy','sendStatus','error','stack','name','map','SalesforceAccount','rawAttributes','fieldName','type','model','query','keys','filters'];(function(_0x22f164,_0xaa4f80){var _0x51ab95=function(_0x190b68){while(--_0x190b68){_0x22f164['push'](_0x22f164['shift']());}};_0x51ab95(++_0xaa4f80);}(_0xe3c7,0xc0));var _0x7e3c=function(_0x434467,_0x2c6a75){_0x434467=_0x434467-0x0;var _0x5248ba=_0xe3c7[_0x434467];return _0x5248ba;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7e3c('0x0'));var zipdir=require(_0x7e3c('0x1'));var jsonpatch=require(_0x7e3c('0x2'));var rp=require(_0x7e3c('0x3'));var moment=require(_0x7e3c('0x4'));var BPromise=require(_0x7e3c('0x5'));var Mustache=require('mustache');var util=require(_0x7e3c('0x6'));var path=require(_0x7e3c('0x7'));var sox=require(_0x7e3c('0x8'));var csv=require(_0x7e3c('0x9'));var ejs=require(_0x7e3c('0xa'));var fs=require('fs');var fs_extra=require(_0x7e3c('0xb'));var _=require(_0x7e3c('0xc'));var squel=require(_0x7e3c('0xd'));var crypto=require(_0x7e3c('0xe'));var jsforce=require(_0x7e3c('0xf'));var deskjs=require(_0x7e3c('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7e3c('0x11'));var authService=require(_0x7e3c('0x12'));var qs=require(_0x7e3c('0x13'));var as=require(_0x7e3c('0x14'));var hardwareService=require(_0x7e3c('0x15'));var logger=require(_0x7e3c('0x16'))(_0x7e3c('0x17'));var utils=require('../../config/utils');var config=require(_0x7e3c('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x7e3c('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x18738f,_0x515656){_0x515656=_0x515656||0xcc;return function(_0x1026bc){if(_0x1026bc){return _0x18738f['sendStatus'](_0x515656);}return _0x18738f[_0x7e3c('0x1a')](_0x515656)[_0x7e3c('0x1b')]();};}function respondWithResult(_0x31fa1f,_0x3e5e18){_0x3e5e18=_0x3e5e18||0xc8;return function(_0x5e9a46){if(_0x5e9a46){return _0x31fa1f[_0x7e3c('0x1a')](_0x3e5e18)['json'](_0x5e9a46);}};}function respondWithFilteredResult(_0x50ff16,_0x2972fe){return function(_0x456c1b){if(_0x456c1b){var _0x45c4c1=typeof _0x2972fe[_0x7e3c('0x1c')]===_0x7e3c('0x1d')&&typeof _0x2972fe[_0x7e3c('0x1e')]===_0x7e3c('0x1d');var _0x2ccfc2=_0x456c1b[_0x7e3c('0x1f')];var _0x38f198=_0x45c4c1?0x0:_0x2972fe[_0x7e3c('0x1c')];var _0x2cdb2b=_0x45c4c1?_0x456c1b[_0x7e3c('0x1f')]:_0x2972fe[_0x7e3c('0x1c')]+_0x2972fe[_0x7e3c('0x1e')];var _0x35cc83;if(_0x2cdb2b>=_0x2ccfc2){_0x2cdb2b=_0x2ccfc2;_0x35cc83=0xc8;}else{_0x35cc83=0xce;}_0x50ff16[_0x7e3c('0x1a')](_0x35cc83);return _0x50ff16['set'](_0x7e3c('0x20'),_0x38f198+'-'+_0x2cdb2b+'/'+_0x2ccfc2)['json'](_0x456c1b);}return null;};}function patchUpdates(_0x3d473b){return function(_0x499e0f){try{jsonpatch['apply'](_0x499e0f,_0x3d473b,!![]);}catch(_0x4874d2){return BPromise['reject'](_0x4874d2);}return _0x499e0f[_0x7e3c('0x21')]();};}function saveUpdates(_0x30f5d3,_0x50f82d){return function(_0x3bc37b){if(_0x3bc37b){return _0x3bc37b[_0x7e3c('0x22')](_0x30f5d3)[_0x7e3c('0x23')](function(_0x2c1dc2){return _0x2c1dc2;});}return null;};}function removeEntity(_0x1d062f,_0x44b00c){return function(_0x5dd714){if(_0x5dd714){return _0x5dd714[_0x7e3c('0x24')]()[_0x7e3c('0x23')](function(){_0x1d062f[_0x7e3c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x12222f,_0x5e616b){return function(_0xce6de7){if(!_0xce6de7){_0x12222f[_0x7e3c('0x25')](0x194);}return _0xce6de7;};}function handleError(_0x1e918a,_0x21ea0c){_0x21ea0c=_0x21ea0c||0x1f4;return function(_0x14ac37){logger[_0x7e3c('0x26')](_0x14ac37[_0x7e3c('0x27')]);if(_0x14ac37[_0x7e3c('0x28')]){delete _0x14ac37['name'];}_0x1e918a[_0x7e3c('0x1a')](_0x21ea0c)['send'](_0x14ac37);};}exports['index']=function(_0x2e69fc,_0x4877e0){var _0x5dd691={},_0x33926f={},_0x51adac={'count':0x0,'rows':[]};var _0x43e05c=_[_0x7e3c('0x29')](db[_0x7e3c('0x2a')][_0x7e3c('0x2b')],function(_0x378f9f){return{'name':_0x378f9f[_0x7e3c('0x2c')],'type':_0x378f9f[_0x7e3c('0x2d')]['key']};});_0x33926f[_0x7e3c('0x2e')]=_[_0x7e3c('0x29')](_0x43e05c,'name');_0x33926f[_0x7e3c('0x2f')]=_[_0x7e3c('0x30')](_0x2e69fc['query']);_0x33926f[_0x7e3c('0x31')]=_[_0x7e3c('0x32')](_0x33926f[_0x7e3c('0x2e')],_0x33926f['query']);_0x5dd691[_0x7e3c('0x33')]=_['intersection'](_0x33926f[_0x7e3c('0x2e')],qs[_0x7e3c('0x34')](_0x2e69fc[_0x7e3c('0x2f')][_0x7e3c('0x34')]));_0x5dd691['attributes']=_0x5dd691['attributes'][_0x7e3c('0x35')]?_0x5dd691[_0x7e3c('0x33')]:_0x33926f[_0x7e3c('0x2e')];if(!_0x2e69fc[_0x7e3c('0x2f')][_0x7e3c('0x36')]('nolimit')){_0x5dd691[_0x7e3c('0x1e')]=qs[_0x7e3c('0x1e')](_0x2e69fc['query']['limit']);_0x5dd691[_0x7e3c('0x1c')]=qs[_0x7e3c('0x1c')](_0x2e69fc[_0x7e3c('0x2f')][_0x7e3c('0x1c')]);}_0x5dd691[_0x7e3c('0x37')]=qs['sort'](_0x2e69fc[_0x7e3c('0x2f')]['sort']);_0x5dd691[_0x7e3c('0x38')]=qs[_0x7e3c('0x31')](_[_0x7e3c('0x39')](_0x2e69fc[_0x7e3c('0x2f')],_0x33926f[_0x7e3c('0x31')]),_0x43e05c);if(_0x2e69fc[_0x7e3c('0x2f')][_0x7e3c('0x3a')]){_0x5dd691[_0x7e3c('0x38')]=_[_0x7e3c('0x3b')](_0x5dd691[_0x7e3c('0x38')],{'$or':_[_0x7e3c('0x29')](_0x43e05c,function(_0x1c3f34){if(_0x1c3f34['type']!==_0x7e3c('0x3c')){var _0xf039a={};_0xf039a[_0x1c3f34[_0x7e3c('0x28')]]={'$like':'%'+_0x2e69fc[_0x7e3c('0x2f')][_0x7e3c('0x3a')]+'%'};return _0xf039a;}})});}_0x5dd691=_[_0x7e3c('0x3b')]({},_0x5dd691,_0x2e69fc[_0x7e3c('0x3d')]);var _0x15ec95={'where':_0x5dd691['where']};return db[_0x7e3c('0x2a')][_0x7e3c('0x1f')](_0x15ec95)[_0x7e3c('0x23')](function(_0x11a131){_0x51adac['count']=_0x11a131;if(_0x2e69fc[_0x7e3c('0x2f')][_0x7e3c('0x3e')]){_0x5dd691[_0x7e3c('0x3f')]=[{'all':!![]}];}return db[_0x7e3c('0x2a')]['findAll'](_0x5dd691);})[_0x7e3c('0x23')](function(_0x4e4cb5){_0x51adac[_0x7e3c('0x40')]=_0x4e4cb5;return _0x51adac;})['then'](respondWithFilteredResult(_0x4877e0,_0x5dd691))[_0x7e3c('0x41')](handleError(_0x4877e0,null));};exports[_0x7e3c('0x42')]=function(_0x15777d,_0x57a843){var _0x2bf405={'raw':![],'where':{'id':_0x15777d[_0x7e3c('0x43')]['id']}},_0x1b09ed={};_0x1b09ed['model']=_[_0x7e3c('0x30')](db['SalesforceAccount'][_0x7e3c('0x2b')]);_0x1b09ed['query']=_[_0x7e3c('0x30')](_0x15777d['query']);_0x1b09ed[_0x7e3c('0x31')]=_['intersection'](_0x1b09ed[_0x7e3c('0x2e')],_0x1b09ed[_0x7e3c('0x2f')]);_0x2bf405[_0x7e3c('0x33')]=_[_0x7e3c('0x32')](_0x1b09ed[_0x7e3c('0x2e')],qs[_0x7e3c('0x34')](_0x15777d[_0x7e3c('0x2f')][_0x7e3c('0x34')]));_0x2bf405[_0x7e3c('0x33')]=_0x2bf405[_0x7e3c('0x33')][_0x7e3c('0x35')]?_0x2bf405[_0x7e3c('0x33')]:_0x1b09ed['model'];if(_0x15777d[_0x7e3c('0x2f')][_0x7e3c('0x3e')]){_0x2bf405[_0x7e3c('0x3f')]=[{'all':!![]}];}_0x2bf405=_[_0x7e3c('0x3b')]({},_0x2bf405,_0x15777d[_0x7e3c('0x3d')]);return db[_0x7e3c('0x2a')]['find'](_0x2bf405)[_0x7e3c('0x23')](handleEntityNotFound(_0x57a843,null))[_0x7e3c('0x23')](respondWithResult(_0x57a843,null))[_0x7e3c('0x41')](handleError(_0x57a843,null));};exports[_0x7e3c('0x44')]=function(_0x5801d2,_0x1bea6a){return db[_0x7e3c('0x2a')]['create'](_0x5801d2['body'],{})['then'](respondWithResult(_0x1bea6a,0xc9))[_0x7e3c('0x41')](handleError(_0x1bea6a,null));};exports['update']=function(_0xc428ea,_0x10a978){if(_0xc428ea[_0x7e3c('0x45')]['id']){delete _0xc428ea[_0x7e3c('0x45')]['id'];}return db[_0x7e3c('0x2a')]['find']({'where':{'id':_0xc428ea['params']['id']}})['then'](handleEntityNotFound(_0x10a978,null))[_0x7e3c('0x23')](saveUpdates(_0xc428ea['body'],null))[_0x7e3c('0x23')](respondWithResult(_0x10a978,null))[_0x7e3c('0x41')](handleError(_0x10a978,null));};exports['destroy']=function(_0x3216bb,_0x24d5f9){return db[_0x7e3c('0x2a')][_0x7e3c('0x46')]({'where':{'id':_0x3216bb[_0x7e3c('0x43')]['id']}})[_0x7e3c('0x23')](handleEntityNotFound(_0x24d5f9,null))['then'](removeEntity(_0x24d5f9,null))[_0x7e3c('0x41')](handleError(_0x24d5f9,null));};exports['getConfigurations']=function(_0x39c67f,_0x2b6114,_0xc461ad){var _0x59fb98={};var _0x35da5c={};var _0x2d5b47;var _0x58fc06;return db[_0x7e3c('0x2a')]['findOne']({'where':{'id':_0x39c67f[_0x7e3c('0x43')]['id']}})['then'](handleEntityNotFound(_0x2b6114,null))['then'](function(_0x3dbfe3){if(_0x3dbfe3){_0x2d5b47=_0x3dbfe3;_0x35da5c[_0x7e3c('0x2e')]=_[_0x7e3c('0x30')](db[_0x7e3c('0x47')][_0x7e3c('0x2b')]);_0x35da5c['query']=_[_0x7e3c('0x30')](_0x39c67f['query']);_0x35da5c[_0x7e3c('0x31')]=_[_0x7e3c('0x32')](_0x35da5c[_0x7e3c('0x2e')],_0x35da5c[_0x7e3c('0x2f')]);_0x59fb98[_0x7e3c('0x33')]=_[_0x7e3c('0x32')](_0x35da5c[_0x7e3c('0x2e')],qs['fields'](_0x39c67f[_0x7e3c('0x2f')]['fields']));_0x59fb98['attributes']=_0x59fb98[_0x7e3c('0x33')][_0x7e3c('0x35')]?_0x59fb98[_0x7e3c('0x33')]:_0x35da5c['model'];_0x59fb98[_0x7e3c('0x37')]=qs[_0x7e3c('0x48')](_0x39c67f[_0x7e3c('0x2f')][_0x7e3c('0x48')]);_0x59fb98['where']=qs[_0x7e3c('0x31')](_[_0x7e3c('0x39')](_0x39c67f[_0x7e3c('0x2f')],_0x35da5c[_0x7e3c('0x31')]));if(_0x39c67f[_0x7e3c('0x2f')][_0x7e3c('0x3a')]){_0x59fb98[_0x7e3c('0x38')]=_[_0x7e3c('0x3b')](_0x59fb98['where'],{'$or':_[_0x7e3c('0x29')](_0x59fb98[_0x7e3c('0x33')],function(_0x1b71c6){var _0x223dde={};_0x223dde[_0x1b71c6]={'$like':'%'+_0x39c67f[_0x7e3c('0x2f')]['filter']+'%'};return _0x223dde;})});}_0x59fb98=_[_0x7e3c('0x3b')]({},_0x59fb98,_0x39c67f[_0x7e3c('0x3d')]);return _0x2d5b47['getConfigurations'](_0x59fb98);}})[_0x7e3c('0x23')](function(_0x2f9892){if(_0x2f9892){_0x58fc06=_0x2f9892['length'];if(!_0x39c67f[_0x7e3c('0x2f')]['hasOwnProperty'](_0x7e3c('0x49'))){_0x59fb98['limit']=qs[_0x7e3c('0x1e')](_0x39c67f[_0x7e3c('0x2f')][_0x7e3c('0x1e')]);_0x59fb98[_0x7e3c('0x1c')]=qs[_0x7e3c('0x1c')](_0x39c67f['query'][_0x7e3c('0x1c')]);}return _0x2d5b47[_0x7e3c('0x4a')](_0x59fb98);}})[_0x7e3c('0x23')](function(_0xcaded5){if(_0xcaded5){return _0xcaded5?{'count':_0x58fc06,'rows':_0xcaded5}:null;}})[_0x7e3c('0x23')](respondWithResult(_0x2b6114,null))[_0x7e3c('0x41')](handleError(_0x2b6114,null));};exports[_0x7e3c('0x4b')]=function(_0x4370ee,_0x2c5a83,_0x4042c8){if(_0x4370ee[_0x7e3c('0x45')]['id']){delete _0x4370ee[_0x7e3c('0x45')]['id'];}return db['SalesforceAccount'][_0x7e3c('0x4c')]({'where':{'id':_0x4370ee[_0x7e3c('0x43')]['id']}})[_0x7e3c('0x23')](handleEntityNotFound(_0x2c5a83,null))[_0x7e3c('0x23')](function(_0x537d48){if(_0x537d48){_0x4370ee['body'][_0x7e3c('0x4d')]=_0x537d48['id'];_0x4370ee[_0x7e3c('0x45')][_0x7e3c('0x4e')]=integrations[_0x7e3c('0x4f')](_0x4370ee[_0x7e3c('0x45')][_0x7e3c('0x50')],_0x4370ee[_0x7e3c('0x45')][_0x7e3c('0x2d')]);_0x4370ee['body'][_0x7e3c('0x51')]=integrations[_0x7e3c('0x52')](_0x4370ee[_0x7e3c('0x45')][_0x7e3c('0x50')],_0x4370ee['body'][_0x7e3c('0x2d')]);return db[_0x7e3c('0x47')][_0x7e3c('0x44')](_0x4370ee[_0x7e3c('0x45')],{'include':[{'model':db['SalesforceField'],'as':'Subjects'},{'model':db[_0x7e3c('0x53')],'as':_0x7e3c('0x51')}]});}return null;})[_0x7e3c('0x23')](respondWithResult(_0x2c5a83,null))[_0x7e3c('0x41')](handleError(_0x2c5a83,null));};exports[_0x7e3c('0x54')]=function(_0x4afc99,_0x392ea1,_0x1046ae){var _0x7ead4e;var _0x14a780='';var _0x110675=_0x7e3c('0x55');return db[_0x7e3c('0x2a')][_0x7e3c('0x4c')]({'where':{'id':_0x4afc99[_0x7e3c('0x43')]['id']},'attributes':['id',_0x7e3c('0x56'),_0x7e3c('0x57'),'clientSecret','username','password',_0x7e3c('0x58')]})[_0x7e3c('0x23')](handleEntityNotFound(_0x392ea1,null))[_0x7e3c('0x23')](function(_0x1a4714){if(_0x1a4714){_0x14a780=_0x1a4714['remoteUri'];var _0x4c2dd2=_0x14a780['slice'](-0x1);if(_0x4c2dd2==='/'){_0x14a780=_0x14a780['substring'](0x0,_0x14a780[_0x7e3c('0x59')](_0x4c2dd2));}_0x7ead4e=new jsforce[(_0x7e3c('0x5a'))]({'oauth2':{'loginUrl':_0x14a780,'clientId':_0x1a4714[_0x7e3c('0x57')],'clientSecret':_0x1a4714[_0x7e3c('0x5b')]}});return _0x7ead4e[_0x7e3c('0x5c')](_0x1a4714[_0x7e3c('0x5d')],_0x1a4714[_0x7e3c('0x5e')][_0x7e3c('0x5f')](_0x1a4714[_0x7e3c('0x58')]));}})['then'](function(_0x386b64){if(_0x386b64){if(!_[_0x7e3c('0x60')](_0x4afc99[_0x7e3c('0x2f')][_0x7e3c('0x61')])){_0x110675=_0x4afc99[_0x7e3c('0x2f')]['ticketType'];}return _0x7ead4e[_0x7e3c('0x62')](_0x110675)[_0x7e3c('0x63')]();}})[_0x7e3c('0x23')](function(_0x330339){var _0x1f0a74=[_0x7e3c('0x64'),'ActivityDate',_0x7e3c('0x65'),_0x7e3c('0x66'),_0x7e3c('0x67'),_0x7e3c('0x68')];var _0x46e6b5=['string','int',_0x7e3c('0x69'),_0x7e3c('0x6a'),_0x7e3c('0x6b'),_0x7e3c('0x6c'),'phone'];if(_0x330339){_['remove'](_0x330339['fields'],function(_0x117468){return _0x1f0a74[_0x7e3c('0x6d')](_0x117468['name'])||!_0x46e6b5[_0x7e3c('0x6d')](_0x117468[_0x7e3c('0x2d')]);});return{'count':_0x330339[_0x7e3c('0x34')][_0x7e3c('0x35')],'rows':_[_0x7e3c('0x29')](_0x330339[_0x7e3c('0x34')],function(_0x48025c){return{'id':_0x48025c['name'],'name':_0x48025c[_0x7e3c('0x6e')],'custom':_0x48025c['custom'],'options':_0x48025c['picklistValues']['length']>0x0?_[_0x7e3c('0x29')](_0x48025c[_0x7e3c('0x6f')],function(_0x35c02a){return{'name':_0x35c02a[_0x7e3c('0x6e')],'value':_0x35c02a[_0x7e3c('0x70')]};}):_0x48025c[_0x7e3c('0x2d')]==_0x7e3c('0x6a')?[{'name':'True','value':_0x7e3c('0x71')},{'name':_0x7e3c('0x72'),'value':_0x7e3c('0x73')}]:[]};})};}})[_0x7e3c('0x23')](respondWithResult(_0x392ea1,null))[_0x7e3c('0x41')](function(_0x17d9ee){var _0x116fa4=_0x4afc99[_0x7e3c('0x2f')]['test']?0x1f4:_0x17d9ee[_0x7e3c('0x74')]||0x1f4;logger[_0x7e3c('0x26')](_0x7e3c('0x75'),_0x7e3c('0x54'),_0x116fa4,JSON[_0x7e3c('0x76')](_0x17d9ee));delete _0x17d9ee['name'];if(_0x116fa4===0x191){_0x116fa4=0x190;}_0x392ea1[_0x7e3c('0x1a')](_0x116fa4)['send'](_0x4afc99[_0x7e3c('0x2f')][_0x7e3c('0x77')]?{'message':_0x7e3c('0x78'),'statusCode':_0x17d9ee[_0x7e3c('0x74')]}:_0x17d9ee);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index ac5ad4a..8cadb44 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 _0x0a70=['request-promise','path','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts','lodash','util','api','moment','bluebird'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x0a70,0x1c2));var _0x00a7=function(_0x589056,_0x102f9f){_0x589056=_0x589056-0x0;var _0x805f55=_0x0a70[_0x589056];return _0x805f55;};'use strict';var _=require(_0x00a7('0x0'));var util=require(_0x00a7('0x1'));var logger=require('../../config/logger')(_0x00a7('0x2'));var moment=require(_0x00a7('0x3'));var BPromise=require(_0x00a7('0x4'));var rp=require(_0x00a7('0x5'));var fs=require('fs');var path=require(_0x00a7('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x00a7('0x7'));var integrations=require(_0x00a7('0x8'));module[_0x00a7('0x9')]=function(_0xe868e4,_0x213741){return _0xe868e4[_0x00a7('0xa')](_0x00a7('0xb'),attributes,{'tableName':_0x00a7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1166=['request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','define','lodash','../../config/logger','api','moment','bluebird'];(function(_0x9abce9,_0x5203e1){var _0x4ae261=function(_0x4b079b){while(--_0x4b079b){_0x9abce9['push'](_0x9abce9['shift']());}};_0x4ae261(++_0x5203e1);}(_0x1166,0x1a8));var _0x6116=function(_0x4726bf,_0x5ceade){_0x4726bf=_0x4726bf-0x0;var _0x2bc946=_0x1166[_0x4726bf];return _0x2bc946;};'use strict';var _=require(_0x6116('0x0'));var util=require('util');var logger=require(_0x6116('0x1'))(_0x6116('0x2'));var moment=require(_0x6116('0x3'));var BPromise=require(_0x6116('0x4'));var rp=require(_0x6116('0x5'));var fs=require('fs');var path=require(_0x6116('0x6'));var rimraf=require(_0x6116('0x7'));var config=require(_0x6116('0x8'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0x6116('0x9'));module['exports']=function(_0x215549,_0x4aa737){return _0x215549[_0x6116('0xa')]('SalesforceAccount',attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index d7af914..dc0122b 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 _0x07e8=['util','moment','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowSalesforceAccount','find','lodash'];(function(_0x590b61,_0x4c4335){var _0x1a14dc=function(_0x2ff4f6){while(--_0x2ff4f6){_0x590b61['push'](_0x590b61['shift']());}};_0x1a14dc(++_0x4c4335);}(_0x07e8,0x10f));var _0x807e=function(_0x2149e0,_0xc80990){_0x2149e0=_0x2149e0-0x0;var _0x2a0d7a=_0x07e8[_0x2149e0];return _0x2a0d7a;};'use strict';var _=require(_0x807e('0x0'));var util=require(_0x807e('0x1'));var moment=require(_0x807e('0x2'));var BPromise=require('bluebird');var rs=require(_0x807e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x807e('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x807e('0x5'));var config=require(_0x807e('0x6'));var jayson=require(_0x807e('0x7'));var client=jayson['client'][_0x807e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xa12efd,_0x30766c,_0x178efb){return new BPromise(function(_0x1845b3,_0x54e3cb){return client[_0x807e('0x9')](_0xa12efd,_0x178efb)[_0x807e('0xa')](function(_0x400374){logger[_0x807e('0xb')](_0x807e('0xc'),_0x30766c,_0x807e('0xd'));logger[_0x807e('0xe')](_0x807e('0xf'),_0x30766c,_0x807e('0xd'),JSON[_0x807e('0x10')](_0x400374));if(_0x400374[_0x807e('0x11')]){if(_0x400374[_0x807e('0x11')][_0x807e('0x12')]===0x1f4){logger[_0x807e('0x11')]('SalesforceAccount,\x20%s,\x20%s',_0x30766c,_0x400374[_0x807e('0x11')][_0x807e('0x13')]);return _0x54e3cb(_0x400374[_0x807e('0x11')][_0x807e('0x13')]);}logger[_0x807e('0x11')](_0x807e('0xc'),_0x30766c,_0x400374[_0x807e('0x11')]['message']);return _0x1845b3(_0x400374['error'][_0x807e('0x13')]);}else{logger[_0x807e('0xb')](_0x807e('0xc'),_0x30766c,_0x807e('0xd'));_0x1845b3(_0x400374['result'][_0x807e('0x13')]);}})[_0x807e('0x14')](function(_0x1ffc81){logger[_0x807e('0x11')](_0x807e('0xc'),_0x30766c,_0x1ffc81);_0x54e3cb(_0x1ffc81);});});}exports[_0x807e('0x15')]=function(_0x535987){var _0x81676e=this;return new Promise(function(_0x57af7a,_0x3ce49b){return db[_0x807e('0x16')][_0x807e('0x17')]({'raw':_0x535987[_0x807e('0x18')]?_0x535987[_0x807e('0x18')][_0x807e('0x19')]===undefined?!![]:![]:!![],'where':_0x535987[_0x807e('0x18')]?_0x535987[_0x807e('0x18')][_0x807e('0x1a')]||null:null,'attributes':_0x535987['options']?_0x535987['options'][_0x807e('0x1b')]||null:null,'limit':_0x535987[_0x807e('0x18')]?_0x535987[_0x807e('0x18')][_0x807e('0x1c')]||null:null,'include':_0x535987[_0x807e('0x18')]?_0x535987[_0x807e('0x18')][_0x807e('0x1d')]?_[_0x807e('0x1e')](_0x535987['options'][_0x807e('0x1d')],function(_0x2a0a70){return{'model':db[_0x2a0a70[_0x807e('0x1f')]],'as':_0x2a0a70['as'],'attributes':_0x2a0a70[_0x807e('0x1b')],'include':_0x2a0a70[_0x807e('0x1d')]?_[_0x807e('0x1e')](_0x2a0a70['include'],function(_0x277560){return{'model':db[_0x277560['model']],'as':_0x277560['as'],'attributes':_0x277560[_0x807e('0x1b')],'include':_0x277560[_0x807e('0x1d')]?_[_0x807e('0x1e')](_0x277560['include'],function(_0x36bb30){return{'model':db[_0x36bb30[_0x807e('0x1f')]],'as':_0x36bb30['as'],'attributes':_0x36bb30[_0x807e('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x807e('0xa')](function(_0x395754){logger[_0x807e('0xb')]('GetSalesforceAccount',_0x535987);logger[_0x807e('0xe')]('GetSalesforceAccount',_0x535987,JSON[_0x807e('0x10')](_0x395754));_0x57af7a(_0x395754);})[_0x807e('0x14')](function(_0x146112){logger['error'](_0x807e('0x15'),_0x146112[_0x807e('0x13')],_0x535987);_0x3ce49b(_0x81676e['error'](0x1f4,_0x146112[_0x807e('0x13')]));});});};exports[_0x807e('0x20')]=function(_0x57af90){var _0x344eec=this;return new Promise(function(_0x525061,_0x3b9249){return db[_0x807e('0x16')][_0x807e('0x21')]({'raw':_0x57af90[_0x807e('0x18')]?_0x57af90['options']['raw']===undefined?!![]:![]:!![],'where':_0x57af90[_0x807e('0x18')]?_0x57af90[_0x807e('0x18')][_0x807e('0x1a')]||null:null,'attributes':_0x57af90[_0x807e('0x18')]?_0x57af90[_0x807e('0x18')]['attributes']||null:null,'include':_0x57af90['options']?_0x57af90[_0x807e('0x18')][_0x807e('0x1d')]?_['map'](_0x57af90[_0x807e('0x18')][_0x807e('0x1d')],function(_0x3bb392){return{'model':db[_0x3bb392[_0x807e('0x1f')]],'as':_0x3bb392['as'],'attributes':_0x3bb392[_0x807e('0x1b')],'include':_0x3bb392[_0x807e('0x1d')]?_[_0x807e('0x1e')](_0x3bb392[_0x807e('0x1d')],function(_0x1632a7){return{'model':db[_0x1632a7[_0x807e('0x1f')]],'as':_0x1632a7['as'],'attributes':_0x1632a7['attributes'],'include':_0x1632a7[_0x807e('0x1d')]?_[_0x807e('0x1e')](_0x1632a7[_0x807e('0x1d')],function(_0x498301){return{'model':db[_0x498301[_0x807e('0x1f')]],'as':_0x498301['as'],'attributes':_0x498301[_0x807e('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x807e('0xa')](function(_0x546370){logger['info'](_0x807e('0x20'),_0x57af90);logger['debug']('ShowSalesforceAccount',_0x57af90,JSON[_0x807e('0x10')](_0x546370));_0x525061(_0x546370);})[_0x807e('0x14')](function(_0x33c75f){logger[_0x807e('0x11')](_0x807e('0x20'),_0x33c75f[_0x807e('0x13')],_0x57af90);_0x3b9249(_0x344eec[_0x807e('0x11')](0x1f4,_0x33c75f[_0x807e('0x13')]));});});}; \ No newline at end of file +var _0x4efd=['where','attributes','limit','include','map','model','then','info','ShowSalesforceAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','http','request','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x4efd,0x14e));var _0xd4ef=function(_0x3902c1,_0x1c9eb2){_0x3902c1=_0x3902c1-0x0;var _0x1266cc=_0x4efd[_0x3902c1];return _0x1266cc;};'use strict';var _=require(_0xd4ef('0x0'));var util=require(_0xd4ef('0x1'));var moment=require(_0xd4ef('0x2'));var BPromise=require(_0xd4ef('0x3'));var rs=require(_0xd4ef('0x4'));var fs=require('fs');var Redis=require(_0xd4ef('0x5'));var db=require(_0xd4ef('0x6'))['db'];var utils=require(_0xd4ef('0x7'));var logger=require(_0xd4ef('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xd4ef('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a21e7,_0x3cf1a6,_0x18f8bf){return new BPromise(function(_0x5a7b42,_0x10d0f3){return client[_0xd4ef('0xa')](_0x2a21e7,_0x18f8bf)['then'](function(_0x2aa103){logger['info'](_0xd4ef('0xb'),_0x3cf1a6,_0xd4ef('0xc'));logger[_0xd4ef('0xd')](_0xd4ef('0xe'),_0x3cf1a6,_0xd4ef('0xc'),JSON[_0xd4ef('0xf')](_0x2aa103));if(_0x2aa103[_0xd4ef('0x10')]){if(_0x2aa103[_0xd4ef('0x10')][_0xd4ef('0x11')]===0x1f4){logger[_0xd4ef('0x10')](_0xd4ef('0xb'),_0x3cf1a6,_0x2aa103[_0xd4ef('0x10')]['message']);return _0x10d0f3(_0x2aa103[_0xd4ef('0x10')][_0xd4ef('0x12')]);}logger['error'](_0xd4ef('0xb'),_0x3cf1a6,_0x2aa103[_0xd4ef('0x10')][_0xd4ef('0x12')]);return _0x5a7b42(_0x2aa103[_0xd4ef('0x10')]['message']);}else{logger['info'](_0xd4ef('0xb'),_0x3cf1a6,_0xd4ef('0xc'));_0x5a7b42(_0x2aa103[_0xd4ef('0x13')][_0xd4ef('0x12')]);}})[_0xd4ef('0x14')](function(_0x84d51f){logger[_0xd4ef('0x10')](_0xd4ef('0xb'),_0x3cf1a6,_0x84d51f);_0x10d0f3(_0x84d51f);});});}exports[_0xd4ef('0x15')]=function(_0x2de671){var _0x14b0c7=this;return new Promise(function(_0x300535,_0x414e2b){return db[_0xd4ef('0x16')][_0xd4ef('0x17')]({'raw':_0x2de671['options']?_0x2de671[_0xd4ef('0x18')][_0xd4ef('0x19')]===undefined?!![]:![]:!![],'where':_0x2de671[_0xd4ef('0x18')]?_0x2de671['options'][_0xd4ef('0x1a')]||null:null,'attributes':_0x2de671[_0xd4ef('0x18')]?_0x2de671['options'][_0xd4ef('0x1b')]||null:null,'limit':_0x2de671[_0xd4ef('0x18')]?_0x2de671[_0xd4ef('0x18')][_0xd4ef('0x1c')]||null:null,'include':_0x2de671[_0xd4ef('0x18')]?_0x2de671[_0xd4ef('0x18')][_0xd4ef('0x1d')]?_[_0xd4ef('0x1e')](_0x2de671[_0xd4ef('0x18')]['include'],function(_0x1d8354){return{'model':db[_0x1d8354[_0xd4ef('0x1f')]],'as':_0x1d8354['as'],'attributes':_0x1d8354[_0xd4ef('0x1b')],'include':_0x1d8354[_0xd4ef('0x1d')]?_[_0xd4ef('0x1e')](_0x1d8354['include'],function(_0x513e11){return{'model':db[_0x513e11[_0xd4ef('0x1f')]],'as':_0x513e11['as'],'attributes':_0x513e11[_0xd4ef('0x1b')],'include':_0x513e11[_0xd4ef('0x1d')]?_[_0xd4ef('0x1e')](_0x513e11[_0xd4ef('0x1d')],function(_0x29734f){return{'model':db[_0x29734f[_0xd4ef('0x1f')]],'as':_0x29734f['as'],'attributes':_0x29734f[_0xd4ef('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xd4ef('0x20')](function(_0x5aa5e8){logger[_0xd4ef('0x21')](_0xd4ef('0x15'),_0x2de671);logger[_0xd4ef('0xd')]('GetSalesforceAccount',_0x2de671,JSON[_0xd4ef('0xf')](_0x5aa5e8));_0x300535(_0x5aa5e8);})[_0xd4ef('0x14')](function(_0x2f01df){logger[_0xd4ef('0x10')](_0xd4ef('0x15'),_0x2f01df['message'],_0x2de671);_0x414e2b(_0x14b0c7[_0xd4ef('0x10')](0x1f4,_0x2f01df[_0xd4ef('0x12')]));});});};exports[_0xd4ef('0x22')]=function(_0x153bfc){var _0x95ba64=this;return new Promise(function(_0x330e1e,_0x47e144){return db[_0xd4ef('0x16')][_0xd4ef('0x23')]({'raw':_0x153bfc[_0xd4ef('0x18')]?_0x153bfc[_0xd4ef('0x18')][_0xd4ef('0x19')]===undefined?!![]:![]:!![],'where':_0x153bfc['options']?_0x153bfc[_0xd4ef('0x18')][_0xd4ef('0x1a')]||null:null,'attributes':_0x153bfc[_0xd4ef('0x18')]?_0x153bfc[_0xd4ef('0x18')][_0xd4ef('0x1b')]||null:null,'include':_0x153bfc['options']?_0x153bfc[_0xd4ef('0x18')][_0xd4ef('0x1d')]?_['map'](_0x153bfc[_0xd4ef('0x18')][_0xd4ef('0x1d')],function(_0x209d6f){return{'model':db[_0x209d6f[_0xd4ef('0x1f')]],'as':_0x209d6f['as'],'attributes':_0x209d6f[_0xd4ef('0x1b')],'include':_0x209d6f['include']?_[_0xd4ef('0x1e')](_0x209d6f[_0xd4ef('0x1d')],function(_0x200f99){return{'model':db[_0x200f99[_0xd4ef('0x1f')]],'as':_0x200f99['as'],'attributes':_0x200f99[_0xd4ef('0x1b')],'include':_0x200f99[_0xd4ef('0x1d')]?_[_0xd4ef('0x1e')](_0x200f99[_0xd4ef('0x1d')],function(_0x4b7b1d){return{'model':db[_0x4b7b1d[_0xd4ef('0x1f')]],'as':_0x4b7b1d['as'],'attributes':_0x4b7b1d[_0xd4ef('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xd4ef('0x20')](function(_0x1db79d){logger[_0xd4ef('0x21')](_0xd4ef('0x22'),_0x153bfc);logger[_0xd4ef('0xd')](_0xd4ef('0x22'),_0x153bfc,JSON[_0xd4ef('0xf')](_0x1db79d));_0x330e1e(_0x1db79d);})[_0xd4ef('0x14')](function(_0x3eb393){logger['error'](_0xd4ef('0x22'),_0x3eb393['message'],_0x153bfc);_0x47e144(_0x95ba64[_0xd4ef('0x10')](0x1f4,_0x3eb393[_0xd4ef('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 2e55408..710b229 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(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0xdb28,0x106));var _0x8db2=function(_0x406957,_0x5b33d3){_0x406957=_0x406957-0x0;var _0x144be8=_0xdb28[_0x406957];return _0x144be8;};'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 _0x5f2f=['Router','fs-extra','../../components/auth/service','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','create','put','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x1808f9,_0x322e07){var _0x2ffc89=function(_0x2f44f8){while(--_0x2f44f8){_0x1808f9['push'](_0x1808f9['shift']());}};_0x2ffc89(++_0x322e07);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5d5661,_0x2e0f25){_0x5d5661=_0x5d5661-0x0;var _0x1efa1e=_0x5f2f[_0x5d5661];return _0x1efa1e;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x9')](_0xf5f2('0x10'),auth['isAuthenticated'](),controller[_0xf5f2('0x11')]);router['get']('/:id/descriptions',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x12')]);router['post']('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x13')]);router[_0xf5f2('0x14')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x15')]);router['delete'](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x16')]);module[_0xf5f2('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index c7386f0..bdd000c 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 _0x6f62=['account','contact_lead','contact','sequelize','exports','STRING','ENUM','Task','Case','lead','account_contact_lead'];(function(_0x5205f9,_0x5c3a15){var _0x1e3361=function(_0x18895a){while(--_0x18895a){_0x5205f9['push'](_0x5205f9['shift']());}};_0x1e3361(++_0x5c3a15);}(_0x6f62,0x12c));var _0x26f6=function(_0x8a969d,_0x339d9f){_0x8a969d=_0x8a969d-0x0;var _0x1d8dc7=_0x6f62[_0x8a969d];return _0x1d8dc7;};'use strict';var Sequelize=require(_0x26f6('0x0'));module[_0x26f6('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x26f6('0x2')]},'ticketType':{'type':Sequelize[_0x26f6('0x3')](_0x26f6('0x4'),_0x26f6('0x5')),'defaultValue':_0x26f6('0x4')},'moduleSearch':{'type':Sequelize[_0x26f6('0x3')]('contact_lead','contact',_0x26f6('0x6'),_0x26f6('0x7'),_0x26f6('0x8')),'defaultValue':_0x26f6('0x9')},'moduleCreate':{'type':Sequelize[_0x26f6('0x3')]('nothing',_0x26f6('0xa'),_0x26f6('0x6'),_0x26f6('0x8')),'defaultValue':_0x26f6('0x6')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0x26f6('0x2')]},'additionalSearchContact':{'type':Sequelize[_0x26f6('0x2')]},'additionalSearchLead':{'type':Sequelize[_0x26f6('0x2')]}}; \ No newline at end of file +var _0x3ccb=['account','contact_lead','nothing','lead','sequelize','exports','STRING','ENUM','Task','contact','account_contact_lead'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x3ccb,0x190));var _0xb3cc=function(_0x28d225,_0x43be18){_0x28d225=_0x28d225-0x0;var _0x1f79e1=_0x3ccb[_0x28d225];return _0x1f79e1;};'use strict';var Sequelize=require(_0xb3cc('0x0'));module[_0xb3cc('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb3cc('0x2')]},'ticketType':{'type':Sequelize[_0xb3cc('0x3')](_0xb3cc('0x4'),'Case'),'defaultValue':_0xb3cc('0x4')},'moduleSearch':{'type':Sequelize['ENUM']('contact_lead',_0xb3cc('0x5'),'lead',_0xb3cc('0x6'),_0xb3cc('0x7')),'defaultValue':_0xb3cc('0x8')},'moduleCreate':{'type':Sequelize[_0xb3cc('0x3')](_0xb3cc('0x9'),_0xb3cc('0x5'),_0xb3cc('0xa'),_0xb3cc('0x7')),'defaultValue':_0xb3cc('0xa')},'leadId':{'type':Sequelize[_0xb3cc('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0xb3cc('0x2')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0xb3cc('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index a2d21d3..8768068 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 _0x1daf=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','SalesforceConfiguration','rawAttributes','fieldName','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','body','findOne','SalesforceField','getFields','nolimit','getSubjects','getDescriptions','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x5a87fb,_0x2c2d6d){var _0x5c1ac5=function(_0x23183c){while(--_0x23183c){_0x5a87fb['push'](_0x5a87fb['shift']());}};_0x5c1ac5(++_0x2c2d6d);}(_0x1daf,0x17c));var _0xf1da=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x1daf[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0xf1da('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf1da('0x1'));var rp=require(_0xf1da('0x2'));var moment=require(_0xf1da('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf1da('0x4'));var util=require(_0xf1da('0x5'));var path=require(_0xf1da('0x6'));var sox=require(_0xf1da('0x7'));var csv=require('to-csv');var ejs=require(_0xf1da('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xf1da('0x9'));var crypto=require(_0xf1da('0xa'));var jsforce=require(_0xf1da('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf1da('0xc'));var Papa=require(_0xf1da('0xd'));var Redis=require(_0xf1da('0xe'));var authService=require(_0xf1da('0xf'));var qs=require(_0xf1da('0x10'));var as=require(_0xf1da('0x11'));var hardwareService=require(_0xf1da('0x12'));var logger=require(_0xf1da('0x13'))(_0xf1da('0x14'));var utils=require(_0xf1da('0x15'));var config=require(_0xf1da('0x16'));var licenseUtil=require(_0xf1da('0x17'));var db=require(_0xf1da('0x18'))['db'];function respondWithStatusCode(_0x315c67,_0x4de893){_0x4de893=_0x4de893||0xcc;return function(_0x5cdc90){if(_0x5cdc90){return _0x315c67['sendStatus'](_0x4de893);}return _0x315c67[_0xf1da('0x19')](_0x4de893)[_0xf1da('0x1a')]();};}function respondWithResult(_0xe6d535,_0x1a9740){_0x1a9740=_0x1a9740||0xc8;return function(_0x191b05){if(_0x191b05){return _0xe6d535[_0xf1da('0x19')](_0x1a9740)[_0xf1da('0x1b')](_0x191b05);}};}function respondWithFilteredResult(_0x183a1e,_0x84e1cd){return function(_0x4dbb89){if(_0x4dbb89){var _0x159618=typeof _0x84e1cd[_0xf1da('0x1c')]===_0xf1da('0x1d')&&typeof _0x84e1cd[_0xf1da('0x1e')]==='undefined';var _0xa1e805=_0x4dbb89[_0xf1da('0x1f')];var _0xc20ec0=_0x159618?0x0:_0x84e1cd[_0xf1da('0x1c')];var _0x7f11ac=_0x159618?_0x4dbb89[_0xf1da('0x1f')]:_0x84e1cd[_0xf1da('0x1c')]+_0x84e1cd[_0xf1da('0x1e')];var _0x2b2f38;if(_0x7f11ac>=_0xa1e805){_0x7f11ac=_0xa1e805;_0x2b2f38=0xc8;}else{_0x2b2f38=0xce;}_0x183a1e[_0xf1da('0x19')](_0x2b2f38);return _0x183a1e[_0xf1da('0x20')](_0xf1da('0x21'),_0xc20ec0+'-'+_0x7f11ac+'/'+_0xa1e805)[_0xf1da('0x1b')](_0x4dbb89);}return null;};}function patchUpdates(_0x484a39){return function(_0x15c82){try{jsonpatch[_0xf1da('0x22')](_0x15c82,_0x484a39,!![]);}catch(_0x4f560e){return BPromise['reject'](_0x4f560e);}return _0x15c82[_0xf1da('0x23')]();};}function saveUpdates(_0x26d83c,_0x580721){return function(_0x25c928){if(_0x25c928){return _0x25c928[_0xf1da('0x24')](_0x26d83c)[_0xf1da('0x25')](function(_0x14c03e){return _0x14c03e;});}return null;};}function removeEntity(_0x499acc,_0x388541){return function(_0x4cc73b){if(_0x4cc73b){return _0x4cc73b[_0xf1da('0x26')]()['then'](function(){_0x499acc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x54f6c2,_0x39cb39){return function(_0x444882){if(!_0x444882){_0x54f6c2[_0xf1da('0x27')](0x194);}return _0x444882;};}function handleError(_0x383e38,_0x1649c3){_0x1649c3=_0x1649c3||0x1f4;return function(_0x6bc464){logger[_0xf1da('0x28')](_0x6bc464[_0xf1da('0x29')]);if(_0x6bc464[_0xf1da('0x2a')]){delete _0x6bc464[_0xf1da('0x2a')];}_0x383e38['status'](_0x1649c3)['send'](_0x6bc464);};}exports['index']=function(_0xd9522f,_0x13dc66){var _0x5c71de={},_0x97cd6d={},_0x236df4={'count':0x0,'rows':[]};var _0x24158c=_['map'](db[_0xf1da('0x2b')][_0xf1da('0x2c')],function(_0x2c34e8){return{'name':_0x2c34e8[_0xf1da('0x2d')],'type':_0x2c34e8['type'][_0xf1da('0x2e')]};});_0x97cd6d[_0xf1da('0x2f')]=_[_0xf1da('0x30')](_0x24158c,_0xf1da('0x2a'));_0x97cd6d['query']=_[_0xf1da('0x31')](_0xd9522f[_0xf1da('0x32')]);_0x97cd6d[_0xf1da('0x33')]=_[_0xf1da('0x34')](_0x97cd6d[_0xf1da('0x2f')],_0x97cd6d[_0xf1da('0x32')]);_0x5c71de[_0xf1da('0x35')]=_[_0xf1da('0x34')](_0x97cd6d['model'],qs['fields'](_0xd9522f[_0xf1da('0x32')][_0xf1da('0x36')]));_0x5c71de[_0xf1da('0x35')]=_0x5c71de[_0xf1da('0x35')][_0xf1da('0x37')]?_0x5c71de[_0xf1da('0x35')]:_0x97cd6d[_0xf1da('0x2f')];if(!_0xd9522f['query'][_0xf1da('0x38')]('nolimit')){_0x5c71de[_0xf1da('0x1e')]=qs[_0xf1da('0x1e')](_0xd9522f['query']['limit']);_0x5c71de['offset']=qs[_0xf1da('0x1c')](_0xd9522f[_0xf1da('0x32')][_0xf1da('0x1c')]);}_0x5c71de[_0xf1da('0x39')]=qs[_0xf1da('0x3a')](_0xd9522f[_0xf1da('0x32')]['sort']);_0x5c71de['where']=qs[_0xf1da('0x33')](_[_0xf1da('0x3b')](_0xd9522f[_0xf1da('0x32')],_0x97cd6d[_0xf1da('0x33')]),_0x24158c);if(_0xd9522f[_0xf1da('0x32')][_0xf1da('0x3c')]){_0x5c71de[_0xf1da('0x3d')]=_[_0xf1da('0x3e')](_0x5c71de[_0xf1da('0x3d')],{'$or':_[_0xf1da('0x30')](_0x24158c,function(_0x57c17b){if(_0x57c17b[_0xf1da('0x3f')]!==_0xf1da('0x40')){var _0x342f0f={};_0x342f0f[_0x57c17b[_0xf1da('0x2a')]]={'$like':'%'+_0xd9522f[_0xf1da('0x32')][_0xf1da('0x3c')]+'%'};return _0x342f0f;}})});}_0x5c71de=_['merge']({},_0x5c71de,_0xd9522f[_0xf1da('0x41')]);var _0x4633a9={'where':_0x5c71de['where']};return db[_0xf1da('0x2b')]['count'](_0x4633a9)[_0xf1da('0x25')](function(_0x2b6684){_0x236df4[_0xf1da('0x1f')]=_0x2b6684;if(_0xd9522f['query'][_0xf1da('0x42')]){_0x5c71de[_0xf1da('0x43')]=[{'all':!![]}];}return db[_0xf1da('0x2b')][_0xf1da('0x44')](_0x5c71de);})[_0xf1da('0x25')](function(_0x350ef2){_0x236df4[_0xf1da('0x45')]=_0x350ef2;return _0x236df4;})[_0xf1da('0x25')](respondWithFilteredResult(_0x13dc66,_0x5c71de))[_0xf1da('0x46')](handleError(_0x13dc66,null));};exports['show']=function(_0x45ca81,_0x478892){var _0x2a2dba={'raw':![],'where':{'id':_0x45ca81[_0xf1da('0x47')]['id']}},_0x285c1f={};_0x285c1f[_0xf1da('0x2f')]=_[_0xf1da('0x31')](db['SalesforceConfiguration']['rawAttributes']);_0x285c1f['query']=_[_0xf1da('0x31')](_0x45ca81[_0xf1da('0x32')]);_0x285c1f[_0xf1da('0x33')]=_['intersection'](_0x285c1f[_0xf1da('0x2f')],_0x285c1f[_0xf1da('0x32')]);_0x2a2dba[_0xf1da('0x35')]=_[_0xf1da('0x34')](_0x285c1f[_0xf1da('0x2f')],qs[_0xf1da('0x36')](_0x45ca81[_0xf1da('0x32')][_0xf1da('0x36')]));_0x2a2dba[_0xf1da('0x35')]=_0x2a2dba[_0xf1da('0x35')][_0xf1da('0x37')]?_0x2a2dba[_0xf1da('0x35')]:_0x285c1f['model'];if(_0x45ca81[_0xf1da('0x32')][_0xf1da('0x42')]){_0x2a2dba[_0xf1da('0x43')]=[{'all':!![]}];}_0x2a2dba=_[_0xf1da('0x3e')]({},_0x2a2dba,_0x45ca81['options']);return db['SalesforceConfiguration'][_0xf1da('0x48')](_0x2a2dba)['then'](handleEntityNotFound(_0x478892,null))['then'](respondWithResult(_0x478892,null))[_0xf1da('0x46')](handleError(_0x478892,null));};exports['create']=function(_0x54448c,_0x5ad769){return db[_0xf1da('0x2b')]['create'](_0x54448c[_0xf1da('0x49')],{})['then'](respondWithResult(_0x5ad769,0xc9))['catch'](handleError(_0x5ad769,null));};exports[_0xf1da('0x24')]=function(_0xf69f79,_0x4baa08){if(_0xf69f79['body']['id']){delete _0xf69f79['body']['id'];}return db[_0xf1da('0x2b')][_0xf1da('0x48')]({'where':{'id':_0xf69f79['params']['id']}})[_0xf1da('0x25')](handleEntityNotFound(_0x4baa08,null))[_0xf1da('0x25')](saveUpdates(_0xf69f79[_0xf1da('0x49')],null))[_0xf1da('0x25')](respondWithResult(_0x4baa08,null))[_0xf1da('0x46')](handleError(_0x4baa08,null));};exports[_0xf1da('0x26')]=function(_0x13e8ff,_0x57eb14){return db[_0xf1da('0x2b')][_0xf1da('0x48')]({'where':{'id':_0x13e8ff['params']['id']}})[_0xf1da('0x25')](handleEntityNotFound(_0x57eb14,null))[_0xf1da('0x25')](removeEntity(_0x57eb14,null))[_0xf1da('0x46')](handleError(_0x57eb14,null));};exports['getFields']=function(_0x3f4f83,_0x130096,_0x32bd30){var _0x5b89e8={};var _0x39ff53={};var _0x380a84;var _0x5ee05b;return db[_0xf1da('0x2b')][_0xf1da('0x4a')]({'where':{'id':_0x3f4f83[_0xf1da('0x47')]['id']}})['then'](handleEntityNotFound(_0x130096,null))['then'](function(_0x5e2fa3){if(_0x5e2fa3){_0x380a84=_0x5e2fa3;_0x39ff53[_0xf1da('0x2f')]=_[_0xf1da('0x31')](db[_0xf1da('0x4b')][_0xf1da('0x2c')]);_0x39ff53[_0xf1da('0x32')]=_[_0xf1da('0x31')](_0x3f4f83[_0xf1da('0x32')]);_0x39ff53[_0xf1da('0x33')]=_[_0xf1da('0x34')](_0x39ff53[_0xf1da('0x2f')],_0x39ff53[_0xf1da('0x32')]);_0x5b89e8[_0xf1da('0x35')]=_[_0xf1da('0x34')](_0x39ff53[_0xf1da('0x2f')],qs[_0xf1da('0x36')](_0x3f4f83[_0xf1da('0x32')][_0xf1da('0x36')]));_0x5b89e8[_0xf1da('0x35')]=_0x5b89e8[_0xf1da('0x35')]['length']?_0x5b89e8['attributes']:_0x39ff53[_0xf1da('0x2f')];_0x5b89e8[_0xf1da('0x39')]=qs['sort'](_0x3f4f83[_0xf1da('0x32')][_0xf1da('0x3a')]);_0x5b89e8['where']=qs[_0xf1da('0x33')](_['pick'](_0x3f4f83['query'],_0x39ff53[_0xf1da('0x33')]));if(_0x3f4f83[_0xf1da('0x32')][_0xf1da('0x3c')]){_0x5b89e8[_0xf1da('0x3d')]=_[_0xf1da('0x3e')](_0x5b89e8['where'],{'$or':_[_0xf1da('0x30')](_0x5b89e8[_0xf1da('0x35')],function(_0x1dbcb5){var _0x21e04e={};_0x21e04e[_0x1dbcb5]={'$like':'%'+_0x3f4f83[_0xf1da('0x32')][_0xf1da('0x3c')]+'%'};return _0x21e04e;})});}_0x5b89e8=_['merge']({},_0x5b89e8,_0x3f4f83[_0xf1da('0x41')]);return _0x380a84[_0xf1da('0x4c')](_0x5b89e8);}})['then'](function(_0x19bd79){if(_0x19bd79){_0x5ee05b=_0x19bd79[_0xf1da('0x37')];if(!_0x3f4f83['query'][_0xf1da('0x38')](_0xf1da('0x4d'))){_0x5b89e8[_0xf1da('0x1e')]=qs['limit'](_0x3f4f83[_0xf1da('0x32')]['limit']);_0x5b89e8[_0xf1da('0x1c')]=qs[_0xf1da('0x1c')](_0x3f4f83[_0xf1da('0x32')][_0xf1da('0x1c')]);}return _0x380a84['getFields'](_0x5b89e8);}})[_0xf1da('0x25')](function(_0x181619){if(_0x181619){return _0x181619?{'count':_0x5ee05b,'rows':_0x181619}:null;}})[_0xf1da('0x25')](respondWithResult(_0x130096,null))['catch'](handleError(_0x130096,null));};exports[_0xf1da('0x4e')]=function(_0x18100c,_0x43fe59,_0x1f192f){var _0x2d98bd={};var _0x435517={};var _0x4a37e1;var _0xdaa8e8;return db[_0xf1da('0x2b')]['findOne']({'where':{'id':_0x18100c['params']['id']}})[_0xf1da('0x25')](handleEntityNotFound(_0x43fe59,null))['then'](function(_0x2388ed){if(_0x2388ed){_0x4a37e1=_0x2388ed;_0x435517['model']=_[_0xf1da('0x31')](db['SalesforceField'][_0xf1da('0x2c')]);_0x435517[_0xf1da('0x32')]=_['keys'](_0x18100c[_0xf1da('0x32')]);_0x435517['filters']=_['intersection'](_0x435517[_0xf1da('0x2f')],_0x435517[_0xf1da('0x32')]);_0x2d98bd[_0xf1da('0x35')]=_[_0xf1da('0x34')](_0x435517[_0xf1da('0x2f')],qs[_0xf1da('0x36')](_0x18100c[_0xf1da('0x32')][_0xf1da('0x36')]));_0x2d98bd[_0xf1da('0x35')]=_0x2d98bd['attributes'][_0xf1da('0x37')]?_0x2d98bd[_0xf1da('0x35')]:_0x435517['model'];_0x2d98bd['order']=qs['sort'](_0x18100c[_0xf1da('0x32')]['sort']);_0x2d98bd[_0xf1da('0x3d')]=qs['filters'](_[_0xf1da('0x3b')](_0x18100c[_0xf1da('0x32')],_0x435517[_0xf1da('0x33')]));if(_0x18100c[_0xf1da('0x32')][_0xf1da('0x3c')]){_0x2d98bd['where']=_[_0xf1da('0x3e')](_0x2d98bd['where'],{'$or':_['map'](_0x2d98bd['attributes'],function(_0x5c1dfc){var _0x3acca7={};_0x3acca7[_0x5c1dfc]={'$like':'%'+_0x18100c['query'][_0xf1da('0x3c')]+'%'};return _0x3acca7;})});}_0x2d98bd=_[_0xf1da('0x3e')]({},_0x2d98bd,_0x18100c[_0xf1da('0x41')]);return _0x4a37e1[_0xf1da('0x4e')](_0x2d98bd);}})[_0xf1da('0x25')](function(_0x1020c0){if(_0x1020c0){_0xdaa8e8=_0x1020c0[_0xf1da('0x37')];if(!_0x18100c['query'][_0xf1da('0x38')](_0xf1da('0x4d'))){_0x2d98bd['limit']=qs[_0xf1da('0x1e')](_0x18100c[_0xf1da('0x32')][_0xf1da('0x1e')]);_0x2d98bd['offset']=qs[_0xf1da('0x1c')](_0x18100c[_0xf1da('0x32')][_0xf1da('0x1c')]);}return _0x4a37e1['getSubjects'](_0x2d98bd);}})[_0xf1da('0x25')](function(_0xa642d9){if(_0xa642d9){return _0xa642d9?{'count':_0xdaa8e8,'rows':_0xa642d9}:null;}})[_0xf1da('0x25')](respondWithResult(_0x43fe59,null))['catch'](handleError(_0x43fe59,null));};exports['getDescriptions']=function(_0x2ce4ec,_0x681618,_0x492cec){var _0x49c3c0={};var _0x4ad78a={};var _0x47a5db;var _0x29befd;return db[_0xf1da('0x2b')]['findOne']({'where':{'id':_0x2ce4ec[_0xf1da('0x47')]['id']}})[_0xf1da('0x25')](handleEntityNotFound(_0x681618,null))['then'](function(_0x38bf6a){if(_0x38bf6a){_0x47a5db=_0x38bf6a;_0x4ad78a[_0xf1da('0x2f')]=_[_0xf1da('0x31')](db['SalesforceField'][_0xf1da('0x2c')]);_0x4ad78a[_0xf1da('0x32')]=_[_0xf1da('0x31')](_0x2ce4ec[_0xf1da('0x32')]);_0x4ad78a['filters']=_[_0xf1da('0x34')](_0x4ad78a[_0xf1da('0x2f')],_0x4ad78a['query']);_0x49c3c0['attributes']=_[_0xf1da('0x34')](_0x4ad78a['model'],qs[_0xf1da('0x36')](_0x2ce4ec[_0xf1da('0x32')][_0xf1da('0x36')]));_0x49c3c0[_0xf1da('0x35')]=_0x49c3c0['attributes'][_0xf1da('0x37')]?_0x49c3c0[_0xf1da('0x35')]:_0x4ad78a[_0xf1da('0x2f')];_0x49c3c0[_0xf1da('0x39')]=qs[_0xf1da('0x3a')](_0x2ce4ec[_0xf1da('0x32')][_0xf1da('0x3a')]);_0x49c3c0[_0xf1da('0x3d')]=qs[_0xf1da('0x33')](_[_0xf1da('0x3b')](_0x2ce4ec['query'],_0x4ad78a[_0xf1da('0x33')]));if(_0x2ce4ec[_0xf1da('0x32')][_0xf1da('0x3c')]){_0x49c3c0[_0xf1da('0x3d')]=_[_0xf1da('0x3e')](_0x49c3c0[_0xf1da('0x3d')],{'$or':_[_0xf1da('0x30')](_0x49c3c0['attributes'],function(_0x2f45a2){var _0x53c0d8={};_0x53c0d8[_0x2f45a2]={'$like':'%'+_0x2ce4ec[_0xf1da('0x32')][_0xf1da('0x3c')]+'%'};return _0x53c0d8;})});}_0x49c3c0=_['merge']({},_0x49c3c0,_0x2ce4ec[_0xf1da('0x41')]);return _0x47a5db['getDescriptions'](_0x49c3c0);}})[_0xf1da('0x25')](function(_0x5f3585){if(_0x5f3585){_0x29befd=_0x5f3585[_0xf1da('0x37')];if(!_0x2ce4ec[_0xf1da('0x32')][_0xf1da('0x38')](_0xf1da('0x4d'))){_0x49c3c0['limit']=qs[_0xf1da('0x1e')](_0x2ce4ec['query'][_0xf1da('0x1e')]);_0x49c3c0[_0xf1da('0x1c')]=qs[_0xf1da('0x1c')](_0x2ce4ec[_0xf1da('0x32')][_0xf1da('0x1c')]);}return _0x47a5db[_0xf1da('0x4f')](_0x49c3c0);}})['then'](function(_0x17e558){if(_0x17e558){return _0x17e558?{'count':_0x29befd,'rows':_0x17e558}:null;}})['then'](respondWithResult(_0x681618,null))['catch'](handleError(_0x681618,null));}; \ No newline at end of file +var _0xae6b=['nolimit','sort','where','pick','merge','filter','options','includeAll','include','SalesforceConfiguration','rows','catch','show','create','body','find','params','getFields','findOne','length','order','getSubjects','getDescriptions','SalesforceField','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','update','then','destroy','error','name','send','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty'];(function(_0x172c4b,_0x526e08){var _0x4aca79=function(_0x42210c){while(--_0x42210c){_0x172c4b['push'](_0x172c4b['shift']());}};_0x4aca79(++_0x526e08);}(_0xae6b,0x158));var _0xbae6=function(_0x4a3570,_0x169197){_0x4a3570=_0x4a3570-0x0;var _0x235ca8=_0xae6b[_0x4a3570];return _0x235ca8;};'use strict';var emlformat=require(_0xbae6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbae6('0x1'));var jsonpatch=require(_0xbae6('0x2'));var rp=require(_0xbae6('0x3'));var moment=require(_0xbae6('0x4'));var BPromise=require(_0xbae6('0x5'));var Mustache=require(_0xbae6('0x6'));var util=require(_0xbae6('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xbae6('0x8'));var ejs=require(_0xbae6('0x9'));var fs=require('fs');var fs_extra=require(_0xbae6('0xa'));var _=require(_0xbae6('0xb'));var squel=require(_0xbae6('0xc'));var crypto=require('crypto');var jsforce=require(_0xbae6('0xd'));var deskjs=require(_0xbae6('0xe'));var toCsv=require('to-csv');var querystring=require(_0xbae6('0xf'));var Papa=require(_0xbae6('0x10'));var Redis=require(_0xbae6('0x11'));var authService=require(_0xbae6('0x12'));var qs=require(_0xbae6('0x13'));var as=require(_0xbae6('0x14'));var hardwareService=require(_0xbae6('0x15'));var logger=require(_0xbae6('0x16'))(_0xbae6('0x17'));var utils=require('../../config/utils');var config=require(_0xbae6('0x18'));var licenseUtil=require(_0xbae6('0x19'));var db=require(_0xbae6('0x1a'))['db'];function respondWithStatusCode(_0x3a871d,_0x56a8a0){_0x56a8a0=_0x56a8a0||0xcc;return function(_0x3d97e8){if(_0x3d97e8){return _0x3a871d[_0xbae6('0x1b')](_0x56a8a0);}return _0x3a871d[_0xbae6('0x1c')](_0x56a8a0)[_0xbae6('0x1d')]();};}function respondWithResult(_0x37c472,_0x3d22d3){_0x3d22d3=_0x3d22d3||0xc8;return function(_0xc44bc1){if(_0xc44bc1){return _0x37c472[_0xbae6('0x1c')](_0x3d22d3)['json'](_0xc44bc1);}};}function respondWithFilteredResult(_0x11fa5e,_0x469e0b){return function(_0x45774b){if(_0x45774b){var _0x702e1a=typeof _0x469e0b[_0xbae6('0x1e')]===_0xbae6('0x1f')&&typeof _0x469e0b[_0xbae6('0x20')]===_0xbae6('0x1f');var _0x1b6898=_0x45774b[_0xbae6('0x21')];var _0x3cfcee=_0x702e1a?0x0:_0x469e0b['offset'];var _0x4f3270=_0x702e1a?_0x45774b[_0xbae6('0x21')]:_0x469e0b[_0xbae6('0x1e')]+_0x469e0b[_0xbae6('0x20')];var _0x57b4bd;if(_0x4f3270>=_0x1b6898){_0x4f3270=_0x1b6898;_0x57b4bd=0xc8;}else{_0x57b4bd=0xce;}_0x11fa5e[_0xbae6('0x1c')](_0x57b4bd);return _0x11fa5e[_0xbae6('0x22')](_0xbae6('0x23'),_0x3cfcee+'-'+_0x4f3270+'/'+_0x1b6898)[_0xbae6('0x24')](_0x45774b);}return null;};}function patchUpdates(_0x4bdf9e){return function(_0x5263af){try{jsonpatch['apply'](_0x5263af,_0x4bdf9e,!![]);}catch(_0x237858){return BPromise[_0xbae6('0x25')](_0x237858);}return _0x5263af['save']();};}function saveUpdates(_0xeb81be,_0x1375f1){return function(_0x38942b){if(_0x38942b){return _0x38942b[_0xbae6('0x26')](_0xeb81be)[_0xbae6('0x27')](function(_0x48be3f){return _0x48be3f;});}return null;};}function removeEntity(_0xdf2757,_0x4b4040){return function(_0x3617ca){if(_0x3617ca){return _0x3617ca[_0xbae6('0x28')]()[_0xbae6('0x27')](function(){_0xdf2757[_0xbae6('0x1c')](0xcc)[_0xbae6('0x1d')]();});}};}function handleEntityNotFound(_0x2437f7,_0x4fcabc){return function(_0x464980){if(!_0x464980){_0x2437f7[_0xbae6('0x1b')](0x194);}return _0x464980;};}function handleError(_0xd17d2b,_0x72fde2){_0x72fde2=_0x72fde2||0x1f4;return function(_0x5a5258){logger[_0xbae6('0x29')](_0x5a5258['stack']);if(_0x5a5258[_0xbae6('0x2a')]){delete _0x5a5258['name'];}_0xd17d2b['status'](_0x72fde2)[_0xbae6('0x2b')](_0x5a5258);};}exports['index']=function(_0x51cace,_0xb023c4){var _0x15929d={},_0x549417={},_0x587a93={'count':0x0,'rows':[]};var _0x4fa2d3=_[_0xbae6('0x2c')](db['SalesforceConfiguration'][_0xbae6('0x2d')],function(_0xfa7ace){return{'name':_0xfa7ace[_0xbae6('0x2e')],'type':_0xfa7ace[_0xbae6('0x2f')]['key']};});_0x549417['model']=_['map'](_0x4fa2d3,_0xbae6('0x2a'));_0x549417[_0xbae6('0x30')]=_[_0xbae6('0x31')](_0x51cace[_0xbae6('0x30')]);_0x549417[_0xbae6('0x32')]=_[_0xbae6('0x33')](_0x549417[_0xbae6('0x34')],_0x549417['query']);_0x15929d[_0xbae6('0x35')]=_[_0xbae6('0x33')](_0x549417[_0xbae6('0x34')],qs['fields'](_0x51cace[_0xbae6('0x30')][_0xbae6('0x36')]));_0x15929d[_0xbae6('0x35')]=_0x15929d['attributes']['length']?_0x15929d['attributes']:_0x549417[_0xbae6('0x34')];if(!_0x51cace['query'][_0xbae6('0x37')](_0xbae6('0x38'))){_0x15929d['limit']=qs['limit'](_0x51cace[_0xbae6('0x30')]['limit']);_0x15929d['offset']=qs[_0xbae6('0x1e')](_0x51cace[_0xbae6('0x30')][_0xbae6('0x1e')]);}_0x15929d['order']=qs['sort'](_0x51cace[_0xbae6('0x30')][_0xbae6('0x39')]);_0x15929d[_0xbae6('0x3a')]=qs['filters'](_[_0xbae6('0x3b')](_0x51cace['query'],_0x549417[_0xbae6('0x32')]),_0x4fa2d3);if(_0x51cace['query']['filter']){_0x15929d['where']=_[_0xbae6('0x3c')](_0x15929d[_0xbae6('0x3a')],{'$or':_[_0xbae6('0x2c')](_0x4fa2d3,function(_0x40d2f7){if(_0x40d2f7[_0xbae6('0x2f')]!=='VIRTUAL'){var _0x5244c4={};_0x5244c4[_0x40d2f7['name']]={'$like':'%'+_0x51cace['query'][_0xbae6('0x3d')]+'%'};return _0x5244c4;}})});}_0x15929d=_[_0xbae6('0x3c')]({},_0x15929d,_0x51cace[_0xbae6('0x3e')]);var _0x3fdca9={'where':_0x15929d[_0xbae6('0x3a')]};return db['SalesforceConfiguration'][_0xbae6('0x21')](_0x3fdca9)[_0xbae6('0x27')](function(_0x5dccad){_0x587a93[_0xbae6('0x21')]=_0x5dccad;if(_0x51cace[_0xbae6('0x30')][_0xbae6('0x3f')]){_0x15929d[_0xbae6('0x40')]=[{'all':!![]}];}return db[_0xbae6('0x41')]['findAll'](_0x15929d);})[_0xbae6('0x27')](function(_0x1c2569){_0x587a93[_0xbae6('0x42')]=_0x1c2569;return _0x587a93;})[_0xbae6('0x27')](respondWithFilteredResult(_0xb023c4,_0x15929d))[_0xbae6('0x43')](handleError(_0xb023c4,null));};exports[_0xbae6('0x44')]=function(_0x5b88b6,_0x59b560){var _0x36f0f8={'raw':![],'where':{'id':_0x5b88b6['params']['id']}},_0xdc08b={};_0xdc08b[_0xbae6('0x34')]=_['keys'](db[_0xbae6('0x41')][_0xbae6('0x2d')]);_0xdc08b[_0xbae6('0x30')]=_['keys'](_0x5b88b6['query']);_0xdc08b[_0xbae6('0x32')]=_[_0xbae6('0x33')](_0xdc08b[_0xbae6('0x34')],_0xdc08b[_0xbae6('0x30')]);_0x36f0f8['attributes']=_['intersection'](_0xdc08b[_0xbae6('0x34')],qs['fields'](_0x5b88b6['query'][_0xbae6('0x36')]));_0x36f0f8['attributes']=_0x36f0f8[_0xbae6('0x35')]['length']?_0x36f0f8['attributes']:_0xdc08b[_0xbae6('0x34')];if(_0x5b88b6['query'][_0xbae6('0x3f')]){_0x36f0f8[_0xbae6('0x40')]=[{'all':!![]}];}_0x36f0f8=_[_0xbae6('0x3c')]({},_0x36f0f8,_0x5b88b6[_0xbae6('0x3e')]);return db[_0xbae6('0x41')]['find'](_0x36f0f8)[_0xbae6('0x27')](handleEntityNotFound(_0x59b560,null))[_0xbae6('0x27')](respondWithResult(_0x59b560,null))[_0xbae6('0x43')](handleError(_0x59b560,null));};exports[_0xbae6('0x45')]=function(_0x639a3f,_0x5c31d8){return db[_0xbae6('0x41')][_0xbae6('0x45')](_0x639a3f[_0xbae6('0x46')],{})[_0xbae6('0x27')](respondWithResult(_0x5c31d8,0xc9))['catch'](handleError(_0x5c31d8,null));};exports[_0xbae6('0x26')]=function(_0x4b857b,_0x192339){if(_0x4b857b[_0xbae6('0x46')]['id']){delete _0x4b857b[_0xbae6('0x46')]['id'];}return db['SalesforceConfiguration'][_0xbae6('0x47')]({'where':{'id':_0x4b857b[_0xbae6('0x48')]['id']}})[_0xbae6('0x27')](handleEntityNotFound(_0x192339,null))[_0xbae6('0x27')](saveUpdates(_0x4b857b[_0xbae6('0x46')],null))[_0xbae6('0x27')](respondWithResult(_0x192339,null))[_0xbae6('0x43')](handleError(_0x192339,null));};exports[_0xbae6('0x28')]=function(_0x48c548,_0xddecce){return db[_0xbae6('0x41')][_0xbae6('0x47')]({'where':{'id':_0x48c548[_0xbae6('0x48')]['id']}})['then'](handleEntityNotFound(_0xddecce,null))[_0xbae6('0x27')](removeEntity(_0xddecce,null))[_0xbae6('0x43')](handleError(_0xddecce,null));};exports[_0xbae6('0x49')]=function(_0x1adaf9,_0x4d86ab,_0x3fb2dc){var _0x25e64d={};var _0xdd58c6={};var _0x19b0b0;var _0x266d36;return db[_0xbae6('0x41')][_0xbae6('0x4a')]({'where':{'id':_0x1adaf9[_0xbae6('0x48')]['id']}})[_0xbae6('0x27')](handleEntityNotFound(_0x4d86ab,null))[_0xbae6('0x27')](function(_0x3ff742){if(_0x3ff742){_0x19b0b0=_0x3ff742;_0xdd58c6[_0xbae6('0x34')]=_[_0xbae6('0x31')](db['SalesforceField']['rawAttributes']);_0xdd58c6['query']=_[_0xbae6('0x31')](_0x1adaf9['query']);_0xdd58c6[_0xbae6('0x32')]=_[_0xbae6('0x33')](_0xdd58c6[_0xbae6('0x34')],_0xdd58c6[_0xbae6('0x30')]);_0x25e64d[_0xbae6('0x35')]=_[_0xbae6('0x33')](_0xdd58c6[_0xbae6('0x34')],qs[_0xbae6('0x36')](_0x1adaf9['query'][_0xbae6('0x36')]));_0x25e64d[_0xbae6('0x35')]=_0x25e64d[_0xbae6('0x35')][_0xbae6('0x4b')]?_0x25e64d[_0xbae6('0x35')]:_0xdd58c6['model'];_0x25e64d[_0xbae6('0x4c')]=qs[_0xbae6('0x39')](_0x1adaf9[_0xbae6('0x30')][_0xbae6('0x39')]);_0x25e64d['where']=qs['filters'](_[_0xbae6('0x3b')](_0x1adaf9[_0xbae6('0x30')],_0xdd58c6[_0xbae6('0x32')]));if(_0x1adaf9[_0xbae6('0x30')][_0xbae6('0x3d')]){_0x25e64d[_0xbae6('0x3a')]=_[_0xbae6('0x3c')](_0x25e64d[_0xbae6('0x3a')],{'$or':_[_0xbae6('0x2c')](_0x25e64d['attributes'],function(_0x260f66){var _0x21be2e={};_0x21be2e[_0x260f66]={'$like':'%'+_0x1adaf9['query']['filter']+'%'};return _0x21be2e;})});}_0x25e64d=_['merge']({},_0x25e64d,_0x1adaf9[_0xbae6('0x3e')]);return _0x19b0b0[_0xbae6('0x49')](_0x25e64d);}})['then'](function(_0x2c4fc6){if(_0x2c4fc6){_0x266d36=_0x2c4fc6[_0xbae6('0x4b')];if(!_0x1adaf9[_0xbae6('0x30')][_0xbae6('0x37')](_0xbae6('0x38'))){_0x25e64d[_0xbae6('0x20')]=qs[_0xbae6('0x20')](_0x1adaf9[_0xbae6('0x30')]['limit']);_0x25e64d[_0xbae6('0x1e')]=qs[_0xbae6('0x1e')](_0x1adaf9['query'][_0xbae6('0x1e')]);}return _0x19b0b0[_0xbae6('0x49')](_0x25e64d);}})[_0xbae6('0x27')](function(_0x9e42d9){if(_0x9e42d9){return _0x9e42d9?{'count':_0x266d36,'rows':_0x9e42d9}:null;}})['then'](respondWithResult(_0x4d86ab,null))['catch'](handleError(_0x4d86ab,null));};exports['getSubjects']=function(_0x2c720b,_0x10188e,_0x5c9f0a){var _0x22d2de={};var _0x1c3fe7={};var _0x253294;var _0x1e77ae;return db[_0xbae6('0x41')][_0xbae6('0x4a')]({'where':{'id':_0x2c720b[_0xbae6('0x48')]['id']}})[_0xbae6('0x27')](handleEntityNotFound(_0x10188e,null))[_0xbae6('0x27')](function(_0x3867ce){if(_0x3867ce){_0x253294=_0x3867ce;_0x1c3fe7[_0xbae6('0x34')]=_[_0xbae6('0x31')](db['SalesforceField'][_0xbae6('0x2d')]);_0x1c3fe7[_0xbae6('0x30')]=_[_0xbae6('0x31')](_0x2c720b[_0xbae6('0x30')]);_0x1c3fe7['filters']=_[_0xbae6('0x33')](_0x1c3fe7[_0xbae6('0x34')],_0x1c3fe7[_0xbae6('0x30')]);_0x22d2de[_0xbae6('0x35')]=_[_0xbae6('0x33')](_0x1c3fe7[_0xbae6('0x34')],qs['fields'](_0x2c720b['query'][_0xbae6('0x36')]));_0x22d2de[_0xbae6('0x35')]=_0x22d2de[_0xbae6('0x35')][_0xbae6('0x4b')]?_0x22d2de[_0xbae6('0x35')]:_0x1c3fe7[_0xbae6('0x34')];_0x22d2de[_0xbae6('0x4c')]=qs[_0xbae6('0x39')](_0x2c720b['query']['sort']);_0x22d2de['where']=qs[_0xbae6('0x32')](_[_0xbae6('0x3b')](_0x2c720b[_0xbae6('0x30')],_0x1c3fe7[_0xbae6('0x32')]));if(_0x2c720b[_0xbae6('0x30')][_0xbae6('0x3d')]){_0x22d2de[_0xbae6('0x3a')]=_['merge'](_0x22d2de[_0xbae6('0x3a')],{'$or':_['map'](_0x22d2de[_0xbae6('0x35')],function(_0xd25350){var _0x96bc0={};_0x96bc0[_0xd25350]={'$like':'%'+_0x2c720b[_0xbae6('0x30')]['filter']+'%'};return _0x96bc0;})});}_0x22d2de=_[_0xbae6('0x3c')]({},_0x22d2de,_0x2c720b[_0xbae6('0x3e')]);return _0x253294[_0xbae6('0x4d')](_0x22d2de);}})[_0xbae6('0x27')](function(_0x57d1ba){if(_0x57d1ba){_0x1e77ae=_0x57d1ba[_0xbae6('0x4b')];if(!_0x2c720b[_0xbae6('0x30')][_0xbae6('0x37')]('nolimit')){_0x22d2de[_0xbae6('0x20')]=qs[_0xbae6('0x20')](_0x2c720b['query'][_0xbae6('0x20')]);_0x22d2de[_0xbae6('0x1e')]=qs[_0xbae6('0x1e')](_0x2c720b['query'][_0xbae6('0x1e')]);}return _0x253294[_0xbae6('0x4d')](_0x22d2de);}})[_0xbae6('0x27')](function(_0x2dfc9a){if(_0x2dfc9a){return _0x2dfc9a?{'count':_0x1e77ae,'rows':_0x2dfc9a}:null;}})[_0xbae6('0x27')](respondWithResult(_0x10188e,null))[_0xbae6('0x43')](handleError(_0x10188e,null));};exports[_0xbae6('0x4e')]=function(_0x5cbfb9,_0x2c4add,_0x4a90ac){var _0x8e8a81={};var _0x140ae0={};var _0x3060b2;var _0x2934b7;return db[_0xbae6('0x41')][_0xbae6('0x4a')]({'where':{'id':_0x5cbfb9[_0xbae6('0x48')]['id']}})['then'](handleEntityNotFound(_0x2c4add,null))[_0xbae6('0x27')](function(_0x3d43ca){if(_0x3d43ca){_0x3060b2=_0x3d43ca;_0x140ae0[_0xbae6('0x34')]=_[_0xbae6('0x31')](db[_0xbae6('0x4f')]['rawAttributes']);_0x140ae0[_0xbae6('0x30')]=_[_0xbae6('0x31')](_0x5cbfb9[_0xbae6('0x30')]);_0x140ae0[_0xbae6('0x32')]=_['intersection'](_0x140ae0[_0xbae6('0x34')],_0x140ae0[_0xbae6('0x30')]);_0x8e8a81[_0xbae6('0x35')]=_[_0xbae6('0x33')](_0x140ae0[_0xbae6('0x34')],qs[_0xbae6('0x36')](_0x5cbfb9[_0xbae6('0x30')][_0xbae6('0x36')]));_0x8e8a81[_0xbae6('0x35')]=_0x8e8a81[_0xbae6('0x35')][_0xbae6('0x4b')]?_0x8e8a81['attributes']:_0x140ae0['model'];_0x8e8a81[_0xbae6('0x4c')]=qs[_0xbae6('0x39')](_0x5cbfb9[_0xbae6('0x30')][_0xbae6('0x39')]);_0x8e8a81[_0xbae6('0x3a')]=qs[_0xbae6('0x32')](_[_0xbae6('0x3b')](_0x5cbfb9[_0xbae6('0x30')],_0x140ae0['filters']));if(_0x5cbfb9['query'][_0xbae6('0x3d')]){_0x8e8a81['where']=_['merge'](_0x8e8a81['where'],{'$or':_['map'](_0x8e8a81['attributes'],function(_0x410b90){var _0x5c4dbf={};_0x5c4dbf[_0x410b90]={'$like':'%'+_0x5cbfb9[_0xbae6('0x30')][_0xbae6('0x3d')]+'%'};return _0x5c4dbf;})});}_0x8e8a81=_[_0xbae6('0x3c')]({},_0x8e8a81,_0x5cbfb9[_0xbae6('0x3e')]);return _0x3060b2[_0xbae6('0x4e')](_0x8e8a81);}})[_0xbae6('0x27')](function(_0x332642){if(_0x332642){_0x2934b7=_0x332642[_0xbae6('0x4b')];if(!_0x5cbfb9[_0xbae6('0x30')]['hasOwnProperty'](_0xbae6('0x38'))){_0x8e8a81[_0xbae6('0x20')]=qs['limit'](_0x5cbfb9[_0xbae6('0x30')][_0xbae6('0x20')]);_0x8e8a81[_0xbae6('0x1e')]=qs[_0xbae6('0x1e')](_0x5cbfb9['query'][_0xbae6('0x1e')]);}return _0x3060b2[_0xbae6('0x4e')](_0x8e8a81);}})[_0xbae6('0x27')](function(_0x1fb10a){if(_0x1fb10a){return _0x1fb10a?{'count':_0x2934b7,'rows':_0x1fb10a}:null;}})[_0xbae6('0x27')](respondWithResult(_0x2c4add,null))[_0xbae6('0x43')](handleError(_0x2c4add,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 0325fc9..11f8771 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 _0xe9ef=['request-promise','path','rimraf','../../config/environment','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x18959a,_0x39f48d){var _0x3a4a2f=function(_0x364a9b){while(--_0x364a9b){_0x18959a['push'](_0x18959a['shift']());}};_0x3a4a2f(++_0x39f48d);}(_0xe9ef,0x166));var _0xfe9e=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xe9ef[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0xfe9e('0x0'));var util=require(_0xfe9e('0x1'));var logger=require(_0xfe9e('0x2'))(_0xfe9e('0x3'));var moment=require(_0xfe9e('0x4'));var BPromise=require(_0xfe9e('0x5'));var rp=require(_0xfe9e('0x6'));var fs=require('fs');var path=require(_0xfe9e('0x7'));var rimraf=require(_0xfe9e('0x8'));var config=require(_0xfe9e('0x9'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0xfe9e('0xa')]=function(_0x545d06,_0x298bee){return _0x545d06[_0xfe9e('0xb')](_0xfe9e('0xc'),attributes,{'tableName':_0xfe9e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb410=['./intSalesforceConfiguration.attributes','exports','SalesforceConfiguration','int_salesforce_configurations','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x33007f,_0x4b38d2){var _0x10d38c=function(_0x497992){while(--_0x497992){_0x33007f['push'](_0x33007f['shift']());}};_0x10d38c(++_0x4b38d2);}(_0xb410,0x148));var _0x0b41=function(_0x44268d,_0xad8443){_0x44268d=_0x44268d-0x0;var _0x4be92d=_0xb410[_0x44268d];return _0x4be92d;};'use strict';var _=require('lodash');var util=require(_0x0b41('0x0'));var logger=require(_0x0b41('0x1'))(_0x0b41('0x2'));var moment=require(_0x0b41('0x3'));var BPromise=require(_0x0b41('0x4'));var rp=require(_0x0b41('0x5'));var fs=require('fs');var path=require(_0x0b41('0x6'));var rimraf=require(_0x0b41('0x7'));var config=require('../../config/environment');var attributes=require(_0x0b41('0x8'));module[_0x0b41('0x9')]=function(_0x5b2d01,_0x30157f){return _0x5b2d01['define'](_0x0b41('0xa'),attributes,{'tableName':_0x0b41('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index abdd296..a755654 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 _0xd595=['rpc','../../config/environment','jayson/promise','client','http','request','then','SalesforceConfiguration,\x20%s,\x20%s','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x401314,_0x25ba22){var _0x2ae4b7=function(_0x329538){while(--_0x329538){_0x401314['push'](_0x401314['shift']());}};_0x2ae4b7(++_0x25ba22);}(_0xd595,0xc8));var _0x5d59=function(_0xf6a160,_0xcb53d2){_0xf6a160=_0xf6a160-0x0;var _0x5ab234=_0xd595[_0xf6a160];return _0x5ab234;};'use strict';var _=require(_0x5d59('0x0'));var util=require('util');var moment=require(_0x5d59('0x1'));var BPromise=require(_0x5d59('0x2'));var rs=require(_0x5d59('0x3'));var fs=require('fs');var Redis=require(_0x5d59('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5d59('0x5'));var logger=require(_0x5d59('0x6'))(_0x5d59('0x7'));var config=require(_0x5d59('0x8'));var jayson=require(_0x5d59('0x9'));var client=jayson[_0x5d59('0xa')][_0x5d59('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x7f8ae2,_0x1883b4,_0x18d25b){return new BPromise(function(_0x19fa14,_0x4bedbf){return client[_0x5d59('0xc')](_0x7f8ae2,_0x18d25b)[_0x5d59('0xd')](function(_0x5d75b8){logger['info'](_0x5d59('0xe'),_0x1883b4,'request\x20sent');logger[_0x5d59('0xf')](_0x5d59('0x10'),_0x1883b4,_0x5d59('0x11'),JSON['stringify'](_0x5d75b8));if(_0x5d75b8[_0x5d59('0x12')]){if(_0x5d75b8[_0x5d59('0x12')]['code']===0x1f4){logger[_0x5d59('0x12')]('SalesforceConfiguration,\x20%s,\x20%s',_0x1883b4,_0x5d75b8['error'][_0x5d59('0x13')]);return _0x4bedbf(_0x5d75b8[_0x5d59('0x12')][_0x5d59('0x13')]);}logger[_0x5d59('0x12')]('SalesforceConfiguration,\x20%s,\x20%s',_0x1883b4,_0x5d75b8[_0x5d59('0x12')][_0x5d59('0x13')]);return _0x19fa14(_0x5d75b8[_0x5d59('0x12')][_0x5d59('0x13')]);}else{logger[_0x5d59('0x14')]('SalesforceConfiguration,\x20%s,\x20%s',_0x1883b4,'request\x20sent');_0x19fa14(_0x5d75b8[_0x5d59('0x15')][_0x5d59('0x13')]);}})[_0x5d59('0x16')](function(_0x40928c){logger[_0x5d59('0x12')](_0x5d59('0xe'),_0x1883b4,_0x40928c);_0x4bedbf(_0x40928c);});});} \ No newline at end of file +var _0x3abf=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird'];(function(_0x179c7e,_0x3c62ed){var _0xb2dcbb=function(_0x3829ff){while(--_0x3829ff){_0x179c7e['push'](_0x179c7e['shift']());}};_0xb2dcbb(++_0x3c62ed);}(_0x3abf,0x80));var _0xf3ab=function(_0x5d4a85,_0x1089f1){_0x5d4a85=_0x5d4a85-0x0;var _0x46544d=_0x3abf[_0x5d4a85];return _0x46544d;};'use strict';var _=require(_0xf3ab('0x0'));var util=require(_0xf3ab('0x1'));var moment=require(_0xf3ab('0x2'));var BPromise=require(_0xf3ab('0x3'));var rs=require(_0xf3ab('0x4'));var fs=require('fs');var Redis=require(_0xf3ab('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf3ab('0x6'));var logger=require(_0xf3ab('0x7'))(_0xf3ab('0x8'));var config=require('../../config/environment');var jayson=require(_0xf3ab('0x9'));var client=jayson[_0xf3ab('0xa')][_0xf3ab('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2fd736,_0x40d6e4,_0x479d74){return new BPromise(function(_0x2b51d9,_0x5c1c6d){return client[_0xf3ab('0xc')](_0x2fd736,_0x479d74)[_0xf3ab('0xd')](function(_0x5f2e65){logger[_0xf3ab('0xe')]('SalesforceConfiguration,\x20%s,\x20%s',_0x40d6e4,_0xf3ab('0xf'));logger['debug'](_0xf3ab('0x10'),_0x40d6e4,'request\x20sent',JSON['stringify'](_0x5f2e65));if(_0x5f2e65[_0xf3ab('0x11')]){if(_0x5f2e65[_0xf3ab('0x11')][_0xf3ab('0x12')]===0x1f4){logger[_0xf3ab('0x11')](_0xf3ab('0x13'),_0x40d6e4,_0x5f2e65['error']['message']);return _0x5c1c6d(_0x5f2e65['error'][_0xf3ab('0x14')]);}logger['error'](_0xf3ab('0x13'),_0x40d6e4,_0x5f2e65[_0xf3ab('0x11')][_0xf3ab('0x14')]);return _0x2b51d9(_0x5f2e65[_0xf3ab('0x11')]['message']);}else{logger['info'](_0xf3ab('0x13'),_0x40d6e4,_0xf3ab('0xf'));_0x2b51d9(_0x5f2e65[_0xf3ab('0x15')][_0xf3ab('0x14')]);}})['catch'](function(_0x526f3e){logger[_0xf3ab('0x11')]('SalesforceConfiguration,\x20%s,\x20%s',_0x40d6e4,_0x526f3e);_0x5c1c6d(_0x526f3e);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 68d675d..c799cf0 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 _0x4165=['put','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intSalesforceField.controller','get','isAuthenticated','/:id','show','post','create'];(function(_0x3379e1,_0x257870){var _0x48116a=function(_0xfb88ce){while(--_0xfb88ce){_0x3379e1['push'](_0x3379e1['shift']());}};_0x48116a(++_0x257870);}(_0x4165,0xcf));var _0x5416=function(_0x215580,_0x73e9cb){_0x215580=_0x215580-0x0;var _0x5829f9=_0x4165[_0x215580];return _0x5829f9;};'use strict';var multer=require(_0x5416('0x0'));var util=require('util');var path=require(_0x5416('0x1'));var timeout=require(_0x5416('0x2'));var express=require(_0x5416('0x3'));var router=express[_0x5416('0x4')]();var fs_extra=require(_0x5416('0x5'));var auth=require(_0x5416('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5416('0x7'));router[_0x5416('0x8')]('/',auth[_0x5416('0x9')](),controller['index']);router[_0x5416('0x8')](_0x5416('0xa'),auth[_0x5416('0x9')](),controller[_0x5416('0xb')]);router[_0x5416('0xc')]('/',auth[_0x5416('0x9')](),controller[_0x5416('0xd')]);router[_0x5416('0xe')](_0x5416('0xa'),auth[_0x5416('0x9')](),controller['update']);router[_0x5416('0xf')](_0x5416('0xa'),auth[_0x5416('0x9')](),controller['destroy']);module[_0x5416('0x10')]=router; \ No newline at end of file +var _0x723b=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','/:id','show','post','isAuthenticated','create','put','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x47bf5d,_0x3abfaa){var _0x2a0c52=function(_0x4af8d1){while(--_0x4af8d1){_0x47bf5d['push'](_0x47bf5d['shift']());}};_0x2a0c52(++_0x3abfaa);}(_0x723b,0x1c9));var _0xb723=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x723b[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xb723('0x0'));var util=require('util');var path=require(_0xb723('0x1'));var timeout=require(_0xb723('0x2'));var express=require(_0xb723('0x3'));var router=express[_0xb723('0x4')]();var fs_extra=require(_0xb723('0x5'));var auth=require(_0xb723('0x6'));var interaction=require(_0xb723('0x7'));var config=require(_0xb723('0x8'));var controller=require(_0xb723('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xb723('0xa')](_0xb723('0xb'),auth['isAuthenticated'](),controller[_0xb723('0xc')]);router[_0xb723('0xd')]('/',auth[_0xb723('0xe')](),controller[_0xb723('0xf')]);router[_0xb723('0x10')](_0xb723('0xb'),auth[_0xb723('0xe')](),controller['update']);router[_0xb723('0x11')](_0xb723('0xb'),auth['isAuthenticated'](),controller[_0xb723('0x12')]);module[_0xb723('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index eff4dc6..7cbc6fd 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 _0xf339=['exports','ENUM','variable','customVariable','keyValue','string','STRING','sequelize'];(function(_0x3875b1,_0x47cf1a){var _0x1e9c55=function(_0xc8e89b){while(--_0xc8e89b){_0x3875b1['push'](_0x3875b1['shift']());}};_0x1e9c55(++_0x47cf1a);}(_0xf339,0x87));var _0x9f33=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xf339[_0x2be8c2];return _0x97f531;};'use strict';var Sequelize=require(_0x9f33('0x0'));module[_0x9f33('0x1')]={'type':{'type':Sequelize[_0x9f33('0x2')]('string',_0x9f33('0x3'),_0x9f33('0x4'),_0x9f33('0x5'),'picklist'),'defaultValue':_0x9f33('0x6')},'content':{'type':Sequelize[_0x9f33('0x7')]},'key':{'type':Sequelize[_0x9f33('0x7')]},'keyType':{'type':Sequelize[_0x9f33('0x2')](_0x9f33('0x6'),_0x9f33('0x3'),_0x9f33('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x9f33('0x7')]},'variableName':{'type':Sequelize[_0x9f33('0x7')]}}; \ No newline at end of file +var _0xc373=['exports','ENUM','variable','customVariable','picklist','STRING','string'];(function(_0x344bad,_0x70be29){var _0x13be12=function(_0x21ad26){while(--_0x21ad26){_0x344bad['push'](_0x344bad['shift']());}};_0x13be12(++_0x70be29);}(_0xc373,0x70));var _0x3c37=function(_0x26b5ff,_0x92009a){_0x26b5ff=_0x26b5ff-0x0;var _0x58603e=_0xc373[_0x26b5ff];return _0x58603e;};'use strict';var Sequelize=require('sequelize');module[_0x3c37('0x0')]={'type':{'type':Sequelize[_0x3c37('0x1')]('string',_0x3c37('0x2'),_0x3c37('0x3'),'keyValue',_0x3c37('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x3c37('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x3c37('0x1')](_0x3c37('0x6'),_0x3c37('0x2'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x3c37('0x5')]},'variableName':{'type':Sequelize[_0x3c37('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 63422e5..72f9ab3 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 _0xa846=['intersection','model','attributes','fields','length','order','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','eml-format','rimraf','fast-json-patch','bluebird','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','../../config/utils','../../mysqldb','sendStatus','json','undefined','count','offset','limit','status','Content-Range','reject','save','update','destroy','then','error','stack','name','send','index','map','SalesforceField','rawAttributes','type','query','filters'];(function(_0x50aa2e,_0xfbd6f0){var _0x5e07f0=function(_0x3ed540){while(--_0x3ed540){_0x50aa2e['push'](_0x50aa2e['shift']());}};_0x5e07f0(++_0xfbd6f0);}(_0xa846,0x16f));var _0x6a84=function(_0x4c9f6a,_0xcb2cb2){_0x4c9f6a=_0x4c9f6a-0x0;var _0x5df5b9=_0xa846[_0x4c9f6a];return _0x5df5b9;};'use strict';var emlformat=require(_0x6a84('0x0'));var rimraf=require(_0x6a84('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6a84('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6a84('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6a84('0x4'));var sox=require(_0x6a84('0x5'));var csv=require(_0x6a84('0x6'));var ejs=require(_0x6a84('0x7'));var fs=require('fs');var fs_extra=require(_0x6a84('0x8'));var _=require('lodash');var squel=require(_0x6a84('0x9'));var crypto=require(_0x6a84('0xa'));var jsforce=require(_0x6a84('0xb'));var deskjs=require(_0x6a84('0xc'));var toCsv=require(_0x6a84('0x6'));var querystring=require(_0x6a84('0xd'));var Papa=require(_0x6a84('0xe'));var Redis=require(_0x6a84('0xf'));var authService=require(_0x6a84('0x10'));var qs=require(_0x6a84('0x11'));var as=require(_0x6a84('0x12'));var hardwareService=require(_0x6a84('0x13'));var logger=require(_0x6a84('0x14'))('api');var utils=require(_0x6a84('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6a84('0x16'))['db'];function respondWithStatusCode(_0x21791b,_0x528446){_0x528446=_0x528446||0xcc;return function(_0x59778d){if(_0x59778d){return _0x21791b[_0x6a84('0x17')](_0x528446);}return _0x21791b['status'](_0x528446)['end']();};}function respondWithResult(_0x4e876d,_0x861058){_0x861058=_0x861058||0xc8;return function(_0x403d2c){if(_0x403d2c){return _0x4e876d['status'](_0x861058)[_0x6a84('0x18')](_0x403d2c);}};}function respondWithFilteredResult(_0x55d7c1,_0x2cafea){return function(_0x205506){if(_0x205506){var _0x228f30=typeof _0x2cafea['offset']===_0x6a84('0x19')&&typeof _0x2cafea['limit']===_0x6a84('0x19');var _0x13f0e0=_0x205506['count'];var _0x2432eb=_0x228f30?0x0:_0x2cafea['offset'];var _0x259d87=_0x228f30?_0x205506[_0x6a84('0x1a')]:_0x2cafea[_0x6a84('0x1b')]+_0x2cafea[_0x6a84('0x1c')];var _0xd7211b;if(_0x259d87>=_0x13f0e0){_0x259d87=_0x13f0e0;_0xd7211b=0xc8;}else{_0xd7211b=0xce;}_0x55d7c1[_0x6a84('0x1d')](_0xd7211b);return _0x55d7c1['set'](_0x6a84('0x1e'),_0x2432eb+'-'+_0x259d87+'/'+_0x13f0e0)[_0x6a84('0x18')](_0x205506);}return null;};}function patchUpdates(_0x35259f){return function(_0x580b8a){try{jsonpatch['apply'](_0x580b8a,_0x35259f,!![]);}catch(_0x2ec4f7){return BPromise[_0x6a84('0x1f')](_0x2ec4f7);}return _0x580b8a[_0x6a84('0x20')]();};}function saveUpdates(_0x2efffa,_0x462ff1){return function(_0x18b558){if(_0x18b558){return _0x18b558[_0x6a84('0x21')](_0x2efffa)['then'](function(_0x328d59){return _0x328d59;});}return null;};}function removeEntity(_0x5056e1,_0x29e700){return function(_0x1c21b8){if(_0x1c21b8){return _0x1c21b8[_0x6a84('0x22')]()[_0x6a84('0x23')](function(){_0x5056e1[_0x6a84('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a3db4,_0x2029fe){return function(_0x36b74b){if(!_0x36b74b){_0x4a3db4['sendStatus'](0x194);}return _0x36b74b;};}function handleError(_0x1abd89,_0x425e76){_0x425e76=_0x425e76||0x1f4;return function(_0x11f978){logger[_0x6a84('0x24')](_0x11f978[_0x6a84('0x25')]);if(_0x11f978[_0x6a84('0x26')]){delete _0x11f978[_0x6a84('0x26')];}_0x1abd89[_0x6a84('0x1d')](_0x425e76)[_0x6a84('0x27')](_0x11f978);};}exports[_0x6a84('0x28')]=function(_0x5313dd,_0x4b5151){var _0x433cb6={},_0xb3c2ea={},_0x16e0d8={'count':0x0,'rows':[]};var _0x36471c=_[_0x6a84('0x29')](db[_0x6a84('0x2a')][_0x6a84('0x2b')],function(_0x5a76c7){return{'name':_0x5a76c7['fieldName'],'type':_0x5a76c7[_0x6a84('0x2c')]['key']};});_0xb3c2ea['model']=_[_0x6a84('0x29')](_0x36471c,_0x6a84('0x26'));_0xb3c2ea[_0x6a84('0x2d')]=_['keys'](_0x5313dd['query']);_0xb3c2ea[_0x6a84('0x2e')]=_[_0x6a84('0x2f')](_0xb3c2ea[_0x6a84('0x30')],_0xb3c2ea[_0x6a84('0x2d')]);_0x433cb6[_0x6a84('0x31')]=_[_0x6a84('0x2f')](_0xb3c2ea[_0x6a84('0x30')],qs[_0x6a84('0x32')](_0x5313dd['query'][_0x6a84('0x32')]));_0x433cb6[_0x6a84('0x31')]=_0x433cb6['attributes'][_0x6a84('0x33')]?_0x433cb6[_0x6a84('0x31')]:_0xb3c2ea['model'];if(!_0x5313dd[_0x6a84('0x2d')]['hasOwnProperty']('nolimit')){_0x433cb6[_0x6a84('0x1c')]=qs[_0x6a84('0x1c')](_0x5313dd[_0x6a84('0x2d')][_0x6a84('0x1c')]);_0x433cb6['offset']=qs['offset'](_0x5313dd[_0x6a84('0x2d')][_0x6a84('0x1b')]);}_0x433cb6[_0x6a84('0x34')]=qs['sort'](_0x5313dd[_0x6a84('0x2d')]['sort']);_0x433cb6[_0x6a84('0x35')]=qs[_0x6a84('0x2e')](_[_0x6a84('0x36')](_0x5313dd[_0x6a84('0x2d')],_0xb3c2ea[_0x6a84('0x2e')]),_0x36471c);if(_0x5313dd[_0x6a84('0x2d')][_0x6a84('0x37')]){_0x433cb6[_0x6a84('0x35')]=_['merge'](_0x433cb6[_0x6a84('0x35')],{'$or':_['map'](_0x36471c,function(_0x59841b){if(_0x59841b[_0x6a84('0x2c')]!==_0x6a84('0x38')){var _0x3ee79a={};_0x3ee79a[_0x59841b[_0x6a84('0x26')]]={'$like':'%'+_0x5313dd[_0x6a84('0x2d')][_0x6a84('0x37')]+'%'};return _0x3ee79a;}})});}_0x433cb6=_[_0x6a84('0x39')]({},_0x433cb6,_0x5313dd[_0x6a84('0x3a')]);var _0x494e0b={'where':_0x433cb6['where']};return db[_0x6a84('0x2a')]['count'](_0x494e0b)[_0x6a84('0x23')](function(_0xda7dcb){_0x16e0d8[_0x6a84('0x1a')]=_0xda7dcb;if(_0x5313dd[_0x6a84('0x2d')][_0x6a84('0x3b')]){_0x433cb6[_0x6a84('0x3c')]=[{'all':!![]}];}return db[_0x6a84('0x2a')][_0x6a84('0x3d')](_0x433cb6);})[_0x6a84('0x23')](function(_0x1843d6){_0x16e0d8[_0x6a84('0x3e')]=_0x1843d6;return _0x16e0d8;})['then'](respondWithFilteredResult(_0x4b5151,_0x433cb6))[_0x6a84('0x3f')](handleError(_0x4b5151,null));};exports['show']=function(_0x1ec247,_0x36e33a){var _0x185ccd={'raw':!![],'where':{'id':_0x1ec247[_0x6a84('0x40')]['id']}},_0x3d3797={};_0x3d3797[_0x6a84('0x30')]=_['keys'](db[_0x6a84('0x2a')][_0x6a84('0x2b')]);_0x3d3797[_0x6a84('0x2d')]=_[_0x6a84('0x41')](_0x1ec247['query']);_0x3d3797[_0x6a84('0x2e')]=_[_0x6a84('0x2f')](_0x3d3797['model'],_0x3d3797[_0x6a84('0x2d')]);_0x185ccd[_0x6a84('0x31')]=_[_0x6a84('0x2f')](_0x3d3797[_0x6a84('0x30')],qs[_0x6a84('0x32')](_0x1ec247['query']['fields']));_0x185ccd[_0x6a84('0x31')]=_0x185ccd['attributes'][_0x6a84('0x33')]?_0x185ccd[_0x6a84('0x31')]:_0x3d3797['model'];if(_0x1ec247['query'][_0x6a84('0x3b')]){_0x185ccd[_0x6a84('0x3c')]=[{'all':!![]}];}_0x185ccd=_['merge']({},_0x185ccd,_0x1ec247['options']);return db[_0x6a84('0x2a')][_0x6a84('0x42')](_0x185ccd)[_0x6a84('0x23')](handleEntityNotFound(_0x36e33a,null))[_0x6a84('0x23')](respondWithResult(_0x36e33a,null))[_0x6a84('0x3f')](handleError(_0x36e33a,null));};exports[_0x6a84('0x43')]=function(_0x483ef2,_0x5dad29){return db[_0x6a84('0x2a')]['create'](_0x483ef2[_0x6a84('0x44')],{})[_0x6a84('0x23')](respondWithResult(_0x5dad29,0xc9))[_0x6a84('0x3f')](handleError(_0x5dad29,null));};exports[_0x6a84('0x21')]=function(_0x3cacbf,_0x5b9b9c){if(_0x3cacbf[_0x6a84('0x44')]['id']){delete _0x3cacbf['body']['id'];}return db[_0x6a84('0x2a')][_0x6a84('0x42')]({'where':{'id':_0x3cacbf[_0x6a84('0x40')]['id']}})['then'](handleEntityNotFound(_0x5b9b9c,null))[_0x6a84('0x23')](saveUpdates(_0x3cacbf['body'],null))[_0x6a84('0x23')](respondWithResult(_0x5b9b9c,null))[_0x6a84('0x3f')](handleError(_0x5b9b9c,null));};exports['destroy']=function(_0x2a9309,_0x3d797a){return db[_0x6a84('0x2a')][_0x6a84('0x42')]({'where':{'id':_0x2a9309['params']['id']}})[_0x6a84('0x23')](handleEntityNotFound(_0x3d797a,null))[_0x6a84('0x23')](removeEntity(_0x3d797a,null))[_0x6a84('0x3f')](handleError(_0x3d797a,null));}; \ No newline at end of file +var _0xf207=['attributes','intersection','fields','hasOwnProperty','nolimit','limit','sort','where','filters','pick','filter','merge','options','SalesforceField','includeAll','include','findAll','rows','show','length','find','catch','create','body','params','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','Content-Range','apply','reject','save','update','destroy','then','end','error','stack','index','map','rawAttributes','fieldName','type','model','keys','query'];(function(_0x2a0fc6,_0xf8faa9){var _0x533956=function(_0x857ce4){while(--_0x857ce4){_0x2a0fc6['push'](_0x2a0fc6['shift']());}};_0x533956(++_0xf8faa9);}(_0xf207,0x18b));var _0x7f20=function(_0x1f3c56,_0x598757){_0x1f3c56=_0x1f3c56-0x0;var _0x569524=_0xf207[_0x1f3c56];return _0x569524;};'use strict';var emlformat=require(_0x7f20('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7f20('0x1'));var jsonpatch=require(_0x7f20('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7f20('0x3'));var Mustache=require(_0x7f20('0x4'));var util=require(_0x7f20('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7f20('0x6'));var _=require(_0x7f20('0x7'));var squel=require(_0x7f20('0x8'));var crypto=require(_0x7f20('0x9'));var jsforce=require(_0x7f20('0xa'));var deskjs=require(_0x7f20('0xb'));var toCsv=require(_0x7f20('0xc'));var querystring=require(_0x7f20('0xd'));var Papa=require(_0x7f20('0xe'));var Redis=require(_0x7f20('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x7f20('0x10'));var as=require(_0x7f20('0x11'));var hardwareService=require(_0x7f20('0x12'));var logger=require(_0x7f20('0x13'))(_0x7f20('0x14'));var utils=require(_0x7f20('0x15'));var config=require(_0x7f20('0x16'));var licenseUtil=require(_0x7f20('0x17'));var db=require(_0x7f20('0x18'))['db'];function respondWithStatusCode(_0x20df4b,_0x4f42ca){_0x4f42ca=_0x4f42ca||0xcc;return function(_0x2ceeb1){if(_0x2ceeb1){return _0x20df4b[_0x7f20('0x19')](_0x4f42ca);}return _0x20df4b[_0x7f20('0x1a')](_0x4f42ca)['end']();};}function respondWithResult(_0x22c93b,_0x202ffe){_0x202ffe=_0x202ffe||0xc8;return function(_0x3c5746){if(_0x3c5746){return _0x22c93b['status'](_0x202ffe)[_0x7f20('0x1b')](_0x3c5746);}};}function respondWithFilteredResult(_0x168cd4,_0x238d6a){return function(_0x312bec){if(_0x312bec){var _0x366b68=typeof _0x238d6a[_0x7f20('0x1c')]===_0x7f20('0x1d')&&typeof _0x238d6a['limit']===_0x7f20('0x1d');var _0x47ef1d=_0x312bec[_0x7f20('0x1e')];var _0x57b1f7=_0x366b68?0x0:_0x238d6a[_0x7f20('0x1c')];var _0x47fa31=_0x366b68?_0x312bec[_0x7f20('0x1e')]:_0x238d6a[_0x7f20('0x1c')]+_0x238d6a['limit'];var _0x1bfc84;if(_0x47fa31>=_0x47ef1d){_0x47fa31=_0x47ef1d;_0x1bfc84=0xc8;}else{_0x1bfc84=0xce;}_0x168cd4[_0x7f20('0x1a')](_0x1bfc84);return _0x168cd4['set'](_0x7f20('0x1f'),_0x57b1f7+'-'+_0x47fa31+'/'+_0x47ef1d)[_0x7f20('0x1b')](_0x312bec);}return null;};}function patchUpdates(_0x9534d){return function(_0x222330){try{jsonpatch[_0x7f20('0x20')](_0x222330,_0x9534d,!![]);}catch(_0x57bc69){return BPromise[_0x7f20('0x21')](_0x57bc69);}return _0x222330[_0x7f20('0x22')]();};}function saveUpdates(_0x51c038,_0x4c5bb5){return function(_0x55cbfa){if(_0x55cbfa){return _0x55cbfa[_0x7f20('0x23')](_0x51c038)['then'](function(_0x105794){return _0x105794;});}return null;};}function removeEntity(_0x1e7a0b,_0x4ca665){return function(_0x5266b8){if(_0x5266b8){return _0x5266b8[_0x7f20('0x24')]()[_0x7f20('0x25')](function(){_0x1e7a0b[_0x7f20('0x1a')](0xcc)[_0x7f20('0x26')]();});}};}function handleEntityNotFound(_0x3d3fbf,_0x32c2fa){return function(_0x172bc9){if(!_0x172bc9){_0x3d3fbf['sendStatus'](0x194);}return _0x172bc9;};}function handleError(_0x52980d,_0x4755b9){_0x4755b9=_0x4755b9||0x1f4;return function(_0x30f33b){logger[_0x7f20('0x27')](_0x30f33b[_0x7f20('0x28')]);if(_0x30f33b['name']){delete _0x30f33b['name'];}_0x52980d['status'](_0x4755b9)['send'](_0x30f33b);};}exports[_0x7f20('0x29')]=function(_0x36b764,_0x7e2a6d){var _0x3c10b4={},_0x5911f9={},_0x175eff={'count':0x0,'rows':[]};var _0x178629=_[_0x7f20('0x2a')](db['SalesforceField'][_0x7f20('0x2b')],function(_0x56b460){return{'name':_0x56b460[_0x7f20('0x2c')],'type':_0x56b460[_0x7f20('0x2d')]['key']};});_0x5911f9[_0x7f20('0x2e')]=_[_0x7f20('0x2a')](_0x178629,'name');_0x5911f9['query']=_[_0x7f20('0x2f')](_0x36b764[_0x7f20('0x30')]);_0x5911f9['filters']=_['intersection'](_0x5911f9[_0x7f20('0x2e')],_0x5911f9['query']);_0x3c10b4[_0x7f20('0x31')]=_[_0x7f20('0x32')](_0x5911f9[_0x7f20('0x2e')],qs[_0x7f20('0x33')](_0x36b764[_0x7f20('0x30')]['fields']));_0x3c10b4[_0x7f20('0x31')]=_0x3c10b4['attributes']['length']?_0x3c10b4[_0x7f20('0x31')]:_0x5911f9['model'];if(!_0x36b764[_0x7f20('0x30')][_0x7f20('0x34')](_0x7f20('0x35'))){_0x3c10b4['limit']=qs['limit'](_0x36b764[_0x7f20('0x30')][_0x7f20('0x36')]);_0x3c10b4[_0x7f20('0x1c')]=qs[_0x7f20('0x1c')](_0x36b764[_0x7f20('0x30')][_0x7f20('0x1c')]);}_0x3c10b4['order']=qs[_0x7f20('0x37')](_0x36b764['query'][_0x7f20('0x37')]);_0x3c10b4[_0x7f20('0x38')]=qs[_0x7f20('0x39')](_[_0x7f20('0x3a')](_0x36b764['query'],_0x5911f9['filters']),_0x178629);if(_0x36b764[_0x7f20('0x30')][_0x7f20('0x3b')]){_0x3c10b4['where']=_[_0x7f20('0x3c')](_0x3c10b4[_0x7f20('0x38')],{'$or':_[_0x7f20('0x2a')](_0x178629,function(_0x303e4b){if(_0x303e4b['type']!=='VIRTUAL'){var _0x2217da={};_0x2217da[_0x303e4b['name']]={'$like':'%'+_0x36b764[_0x7f20('0x30')]['filter']+'%'};return _0x2217da;}})});}_0x3c10b4=_[_0x7f20('0x3c')]({},_0x3c10b4,_0x36b764[_0x7f20('0x3d')]);var _0x597099={'where':_0x3c10b4['where']};return db[_0x7f20('0x3e')][_0x7f20('0x1e')](_0x597099)[_0x7f20('0x25')](function(_0x4d9bbd){_0x175eff['count']=_0x4d9bbd;if(_0x36b764[_0x7f20('0x30')][_0x7f20('0x3f')]){_0x3c10b4[_0x7f20('0x40')]=[{'all':!![]}];}return db[_0x7f20('0x3e')][_0x7f20('0x41')](_0x3c10b4);})[_0x7f20('0x25')](function(_0x14e218){_0x175eff[_0x7f20('0x42')]=_0x14e218;return _0x175eff;})['then'](respondWithFilteredResult(_0x7e2a6d,_0x3c10b4))['catch'](handleError(_0x7e2a6d,null));};exports[_0x7f20('0x43')]=function(_0x1e0934,_0x3e3b7e){var _0x274985={'raw':!![],'where':{'id':_0x1e0934['params']['id']}},_0x47f379={};_0x47f379[_0x7f20('0x2e')]=_[_0x7f20('0x2f')](db[_0x7f20('0x3e')]['rawAttributes']);_0x47f379[_0x7f20('0x30')]=_[_0x7f20('0x2f')](_0x1e0934[_0x7f20('0x30')]);_0x47f379[_0x7f20('0x39')]=_[_0x7f20('0x32')](_0x47f379[_0x7f20('0x2e')],_0x47f379[_0x7f20('0x30')]);_0x274985[_0x7f20('0x31')]=_['intersection'](_0x47f379[_0x7f20('0x2e')],qs[_0x7f20('0x33')](_0x1e0934[_0x7f20('0x30')][_0x7f20('0x33')]));_0x274985['attributes']=_0x274985[_0x7f20('0x31')][_0x7f20('0x44')]?_0x274985[_0x7f20('0x31')]:_0x47f379['model'];if(_0x1e0934[_0x7f20('0x30')][_0x7f20('0x3f')]){_0x274985[_0x7f20('0x40')]=[{'all':!![]}];}_0x274985=_[_0x7f20('0x3c')]({},_0x274985,_0x1e0934[_0x7f20('0x3d')]);return db[_0x7f20('0x3e')][_0x7f20('0x45')](_0x274985)[_0x7f20('0x25')](handleEntityNotFound(_0x3e3b7e,null))[_0x7f20('0x25')](respondWithResult(_0x3e3b7e,null))[_0x7f20('0x46')](handleError(_0x3e3b7e,null));};exports[_0x7f20('0x47')]=function(_0x543e4f,_0x28a037){return db[_0x7f20('0x3e')]['create'](_0x543e4f[_0x7f20('0x48')],{})[_0x7f20('0x25')](respondWithResult(_0x28a037,0xc9))[_0x7f20('0x46')](handleError(_0x28a037,null));};exports[_0x7f20('0x23')]=function(_0x145e4a,_0x433a8f){if(_0x145e4a[_0x7f20('0x48')]['id']){delete _0x145e4a[_0x7f20('0x48')]['id'];}return db[_0x7f20('0x3e')][_0x7f20('0x45')]({'where':{'id':_0x145e4a[_0x7f20('0x49')]['id']}})['then'](handleEntityNotFound(_0x433a8f,null))[_0x7f20('0x25')](saveUpdates(_0x145e4a[_0x7f20('0x48')],null))[_0x7f20('0x25')](respondWithResult(_0x433a8f,null))[_0x7f20('0x46')](handleError(_0x433a8f,null));};exports[_0x7f20('0x24')]=function(_0x5a1dba,_0x4ffeac){return db['SalesforceField'][_0x7f20('0x45')]({'where':{'id':_0x5a1dba[_0x7f20('0x49')]['id']}})[_0x7f20('0x25')](handleEntityNotFound(_0x4ffeac,null))['then'](removeEntity(_0x4ffeac,null))[_0x7f20('0x46')](handleError(_0x4ffeac,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 7eb6f69..e2bdeb4 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 _0xd4e8=['./intSalesforceField.attributes','exports','define','int_salesforce_fields','salesforce_unique_index','idField','lodash','util','api','bluebird','request-promise','rimraf'];(function(_0x3b1cf8,_0x5b79f9){var _0x5d0434=function(_0x1b6559){while(--_0x1b6559){_0x3b1cf8['push'](_0x3b1cf8['shift']());}};_0x5d0434(++_0x5b79f9);}(_0xd4e8,0x1f2));var _0x8d4e=function(_0x26742c,_0xe241ee){_0x26742c=_0x26742c-0x0;var _0x4d9df4=_0xd4e8[_0x26742c];return _0x4d9df4;};'use strict';var _=require(_0x8d4e('0x0'));var util=require(_0x8d4e('0x1'));var logger=require('../../config/logger')(_0x8d4e('0x2'));var moment=require('moment');var BPromise=require(_0x8d4e('0x3'));var rp=require(_0x8d4e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8d4e('0x5'));var config=require('../../config/environment');var attributes=require(_0x8d4e('0x6'));module[_0x8d4e('0x7')]=function(_0x44d4f1,_0x2aa286){return _0x44d4f1[_0x8d4e('0x8')]('SalesforceField',attributes,{'tableName':_0x8d4e('0x9'),'paranoid':![],'indexes':[{'name':_0x8d4e('0xa'),'fields':[_0x8d4e('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5b9f=['exports','define','SalesforceField','int_salesforce_fields','lodash','util','api','bluebird','request-promise','rimraf','./intSalesforceField.attributes'];(function(_0x4d886a,_0x1980d3){var _0x3fa895=function(_0x3731f8){while(--_0x3731f8){_0x4d886a['push'](_0x4d886a['shift']());}};_0x3fa895(++_0x1980d3);}(_0x5b9f,0x138));var _0xf5b9=function(_0x403905,_0x10afdd){_0x403905=_0x403905-0x0;var _0x31f3c3=_0x5b9f[_0x403905];return _0x31f3c3;};'use strict';var _=require(_0xf5b9('0x0'));var util=require(_0xf5b9('0x1'));var logger=require('../../config/logger')(_0xf5b9('0x2'));var moment=require('moment');var BPromise=require(_0xf5b9('0x3'));var rp=require(_0xf5b9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf5b9('0x5'));var config=require('../../config/environment');var attributes=require(_0xf5b9('0x6'));module[_0xf5b9('0x7')]=function(_0x452b9f,_0x5eeae3){return _0x452b9f[_0xf5b9('0x8')](_0xf5b9('0x9'),attributes,{'tableName':_0xf5b9('0xa'),'paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index 219190c..2c2baad 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 _0x856c=['info','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x17f11e,_0xb43c71){var _0x1f7315=function(_0xb0cccf){while(--_0xb0cccf){_0x17f11e['push'](_0x17f11e['shift']());}};_0x1f7315(++_0xb43c71);}(_0x856c,0x1d1));var _0xc856=function(_0x208616,_0x15dd90){_0x208616=_0x208616-0x0;var _0x224886=_0x856c[_0x208616];return _0x224886;};'use strict';var _=require(_0xc856('0x0'));var util=require(_0xc856('0x1'));var moment=require(_0xc856('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc856('0x3'));var db=require(_0xc856('0x4'))['db'];var utils=require(_0xc856('0x5'));var logger=require(_0xc856('0x6'))('rpc');var config=require(_0xc856('0x7'));var jayson=require(_0xc856('0x8'));var client=jayson['client'][_0xc856('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x223e4c,_0x361ef6,_0x5489a1){return new BPromise(function(_0x1e5228,_0x4d8295){return client['request'](_0x223e4c,_0x5489a1)[_0xc856('0xa')](function(_0x4db27a){logger['info'](_0xc856('0xb'),_0x361ef6,_0xc856('0xc'));logger[_0xc856('0xd')](_0xc856('0xe'),_0x361ef6,_0xc856('0xc'),JSON[_0xc856('0xf')](_0x4db27a));if(_0x4db27a[_0xc856('0x10')]){if(_0x4db27a[_0xc856('0x10')]['code']===0x1f4){logger[_0xc856('0x10')](_0xc856('0xb'),_0x361ef6,_0x4db27a[_0xc856('0x10')][_0xc856('0x11')]);return _0x4d8295(_0x4db27a[_0xc856('0x10')][_0xc856('0x11')]);}logger[_0xc856('0x10')]('SalesforceField,\x20%s,\x20%s',_0x361ef6,_0x4db27a[_0xc856('0x10')][_0xc856('0x11')]);return _0x1e5228(_0x4db27a[_0xc856('0x10')][_0xc856('0x11')]);}else{logger[_0xc856('0x12')](_0xc856('0xb'),_0x361ef6,_0xc856('0xc'));_0x1e5228(_0x4db27a[_0xc856('0x13')]['message']);}})[_0xc856('0x14')](function(_0x124c0b){logger[_0xc856('0x10')](_0xc856('0xb'),_0x361ef6,_0x124c0b);_0x4d8295(_0x124c0b);});});} \ No newline at end of file +var _0x3c59=['SalesforceField,\x20%s,\x20%s','SalesforceField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x1e09d3,_0x36247c){var _0x11efb9=function(_0x53e456){while(--_0x53e456){_0x1e09d3['push'](_0x1e09d3['shift']());}};_0x11efb9(++_0x36247c);}(_0x3c59,0xb1));var _0x93c5=function(_0x383493,_0x173752){_0x383493=_0x383493-0x0;var _0x38aebc=_0x3c59[_0x383493];return _0x38aebc;};'use strict';var _=require(_0x93c5('0x0'));var util=require(_0x93c5('0x1'));var moment=require(_0x93c5('0x2'));var BPromise=require(_0x93c5('0x3'));var rs=require(_0x93c5('0x4'));var fs=require('fs');var Redis=require(_0x93c5('0x5'));var db=require(_0x93c5('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x93c5('0x7'))(_0x93c5('0x8'));var config=require('../../config/environment');var jayson=require(_0x93c5('0x9'));var client=jayson[_0x93c5('0xa')][_0x93c5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x29c8cf,_0x5ba630,_0x2e8029){return new BPromise(function(_0x3a0ffc,_0x520808){return client[_0x93c5('0xc')](_0x29c8cf,_0x2e8029)[_0x93c5('0xd')](function(_0x44f7ad){logger[_0x93c5('0xe')](_0x93c5('0xf'),_0x5ba630,'request\x20sent');logger['debug'](_0x93c5('0x10'),_0x5ba630,_0x93c5('0x11'),JSON[_0x93c5('0x12')](_0x44f7ad));if(_0x44f7ad[_0x93c5('0x13')]){if(_0x44f7ad['error'][_0x93c5('0x14')]===0x1f4){logger['error'](_0x93c5('0xf'),_0x5ba630,_0x44f7ad[_0x93c5('0x13')]['message']);return _0x520808(_0x44f7ad[_0x93c5('0x13')][_0x93c5('0x15')]);}logger[_0x93c5('0x13')]('SalesforceField,\x20%s,\x20%s',_0x5ba630,_0x44f7ad[_0x93c5('0x13')][_0x93c5('0x15')]);return _0x3a0ffc(_0x44f7ad[_0x93c5('0x13')][_0x93c5('0x15')]);}else{logger[_0x93c5('0xe')](_0x93c5('0xf'),_0x5ba630,'request\x20sent');_0x3a0ffc(_0x44f7ad[_0x93c5('0x16')][_0x93c5('0x15')]);}})[_0x93c5('0x17')](function(_0x3aea33){logger[_0x93c5('0x13')]('SalesforceField,\x20%s,\x20%s',_0x5ba630,_0x3aea33);_0x520808(_0x3aea33);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index a54af0b..421d94d 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 _0xc35a=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','create','addConfiguration','put','update','delete','destroy','multer','util'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xc35a,0x1c6));var _0xac35=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xc35a[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require(_0xac35('0x0'));var util=require(_0xac35('0x1'));var path=require('path');var timeout=require(_0xac35('0x2'));var express=require(_0xac35('0x3'));var router=express[_0xac35('0x4')]();var fs_extra=require(_0xac35('0x5'));var auth=require(_0xac35('0x6'));var interaction=require(_0xac35('0x7'));var config=require(_0xac35('0x8'));var controller=require(_0xac35('0x9'));router[_0xac35('0xa')]('/',auth[_0xac35('0xb')](),controller[_0xac35('0xc')]);router[_0xac35('0xa')](_0xac35('0xd'),auth[_0xac35('0xb')](),controller['show']);router[_0xac35('0xa')](_0xac35('0xe'),auth[_0xac35('0xb')](),controller[_0xac35('0xf')]);router[_0xac35('0xa')](_0xac35('0x10'),auth['isAuthenticated'](),controller[_0xac35('0x11')]);router['post']('/',auth[_0xac35('0xb')](),controller[_0xac35('0x12')]);router['post']('/:id/configurations',auth[_0xac35('0xb')](),controller[_0xac35('0x13')]);router[_0xac35('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xac35('0x15')]);router[_0xac35('0x16')]('/:id',auth[_0xac35('0xb')](),controller[_0xac35('0x17')]);module['exports']=router; \ No newline at end of file +var _0xf296=['exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./intServicenowAccount.controller','get','index','isAuthenticated','show','/:id/configurations','getConfigurations','getFields','create','addConfiguration','/:id','update','delete','destroy'];(function(_0x35ae6c,_0x4183e9){var _0x49fffb=function(_0x5ecfa2){while(--_0x5ecfa2){_0x35ae6c['push'](_0x35ae6c['shift']());}};_0x49fffb(++_0x4183e9);}(_0xf296,0x94));var _0x6f29=function(_0x476bcd,_0x2f6582){_0x476bcd=_0x476bcd-0x0;var _0x47b60f=_0xf296[_0x476bcd];return _0x47b60f;};'use strict';var multer=require(_0x6f29('0x0'));var util=require(_0x6f29('0x1'));var path=require('path');var timeout=require(_0x6f29('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x6f29('0x3'));var auth=require(_0x6f29('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6f29('0x5'));var controller=require(_0x6f29('0x6'));router[_0x6f29('0x7')]('/',auth['isAuthenticated'](),controller[_0x6f29('0x8')]);router[_0x6f29('0x7')]('/:id',auth[_0x6f29('0x9')](),controller[_0x6f29('0xa')]);router[_0x6f29('0x7')](_0x6f29('0xb'),auth[_0x6f29('0x9')](),controller[_0x6f29('0xc')]);router[_0x6f29('0x7')]('/:id/fields',auth['isAuthenticated'](),controller[_0x6f29('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6f29('0xe')]);router['post'](_0x6f29('0xb'),auth[_0x6f29('0x9')](),controller[_0x6f29('0xf')]);router['put'](_0x6f29('0x10'),auth[_0x6f29('0x9')](),controller[_0x6f29('0x11')]);router[_0x6f29('0x12')](_0x6f29('0x10'),auth['isAuthenticated'](),controller[_0x6f29('0x13')]);module[_0x6f29('0x14')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index ae04408..52e5fd2 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 _0xb571=['sequelize','exports','STRING','username'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0xb571,0xfc));var _0x1b57=function(_0x1d5fc8,_0x10a107){_0x1d5fc8=_0x1d5fc8-0x0;var _0x3ca8b2=_0xb571[_0x1d5fc8];return _0x3ca8b2;};'use strict';var Sequelize=require(_0x1b57('0x0'));module[_0x1b57('0x1')]={'name':{'type':Sequelize[_0x1b57('0x2')]},'description':{'type':Sequelize[_0x1b57('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x1b57('0x3')},'password':{'type':Sequelize[_0x1b57('0x2')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x1d7d=['sequelize','exports','STRING'];(function(_0x57b44b,_0xb7dfc8){var _0x1736c1=function(_0x43b8b3){while(--_0x43b8b3){_0x57b44b['push'](_0x57b44b['shift']());}};_0x1736c1(++_0xb7dfc8);}(_0x1d7d,0x105));var _0xd1d7=function(_0x32c102,_0x2f33b7){_0x32c102=_0x32c102-0x0;var _0x5943c0=_0x1d7d[_0x32c102];return _0x5943c0;};'use strict';var Sequelize=require(_0xd1d7('0x0'));module[_0xd1d7('0x1')]={'name':{'type':Sequelize[_0xd1d7('0x2')]},'description':{'type':Sequelize[_0xd1d7('0x2')]},'username':{'type':Sequelize[_0xd1d7('0x2')],'unique':'username'},'password':{'type':Sequelize[_0xd1d7('0x2')]},'email':{'type':Sequelize[_0xd1d7('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xd1d7('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index bcb3df7..d51af45 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 _0xffd8=['incident?sysparm_display_value=all','result','log','assign','includes','forEach','internalType','label','push','all','TCL:\x20_object','remove','ServiceNow\x20error:\x20','test','statusCode','Wrong\x20credentials','true','False','false','inactive','value','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','include','ServicenowAccount','findAll','catch','params','includeAll','options','create','body','find','getConfigurations','findOne','ServicenowConfiguration','order','Subjects','getSubjects','Descriptions','ServicenowField','getFields','hold_reason','notify','incident_state','severity','category','parent','made_sla','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','number','resolved_by','sys_updated_by','user_input','sys_created_on','sys_domain','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','active','work_notes_list','priority','rfc','time_worked','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','caller_id','approval_set','subcategory','work_notes','close_code','correlation_display','delivery_task','work_start','assignment_group','business_stc','calendar_duration','sys_class_name','close_notes','follow_up','parent_incident','contact_type','reopened_by','company','reassignment_count','activity_due','assigned_to','comments','sla_due','approval','sys_mod_count','reopen_count','sys_tags','upon_approval','correlation_id','location','email','remoteUri','slice','substring','lastIndexOf','%s/api/now/doc/table/schema/','format','%s/api/now/table/','username','password','GET'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xffd8,0xc8));var _0x8ffd=function(_0x4a372d,_0x3bd91f){_0x4a372d=_0x4a372d-0x0;var _0x546ac0=_0xffd8[_0x4a372d];return _0x546ac0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8ffd('0x0'));var zipdir=require(_0x8ffd('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8ffd('0x2'));var moment=require(_0x8ffd('0x3'));var BPromise=require(_0x8ffd('0x4'));var Mustache=require('mustache');var util=require(_0x8ffd('0x5'));var path=require('path');var sox=require(_0x8ffd('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8ffd('0x7'));var _=require('lodash');var squel=require(_0x8ffd('0x8'));var crypto=require(_0x8ffd('0x9'));var jsforce=require(_0x8ffd('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8ffd('0xb'));var Papa=require(_0x8ffd('0xc'));var Redis=require(_0x8ffd('0xd'));var authService=require(_0x8ffd('0xe'));var qs=require(_0x8ffd('0xf'));var as=require(_0x8ffd('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8ffd('0x11'))('api');var utils=require(_0x8ffd('0x12'));var config=require(_0x8ffd('0x13'));var licenseUtil=require(_0x8ffd('0x14'));var db=require(_0x8ffd('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x19c264,_0x3cf6d2){_0x3cf6d2=_0x3cf6d2||0xcc;return function(_0xed49ac){if(_0xed49ac){return _0x19c264[_0x8ffd('0x16')](_0x3cf6d2);}return _0x19c264[_0x8ffd('0x17')](_0x3cf6d2)[_0x8ffd('0x18')]();};}function respondWithResult(_0x455053,_0x236570){_0x236570=_0x236570||0xc8;return function(_0xd68a78){if(_0xd68a78){return _0x455053[_0x8ffd('0x17')](_0x236570)[_0x8ffd('0x19')](_0xd68a78);}};}function respondWithFilteredResult(_0x37064f,_0x171aa4){return function(_0xca915f){if(_0xca915f){var _0x325341=typeof _0x171aa4[_0x8ffd('0x1a')]==='undefined'&&typeof _0x171aa4[_0x8ffd('0x1b')]===_0x8ffd('0x1c');var _0x5b5bb7=_0xca915f['count'];var _0x189816=_0x325341?0x0:_0x171aa4[_0x8ffd('0x1a')];var _0x4dd07e=_0x325341?_0xca915f[_0x8ffd('0x1d')]:_0x171aa4[_0x8ffd('0x1a')]+_0x171aa4[_0x8ffd('0x1b')];var _0xd39da;if(_0x4dd07e>=_0x5b5bb7){_0x4dd07e=_0x5b5bb7;_0xd39da=0xc8;}else{_0xd39da=0xce;}_0x37064f[_0x8ffd('0x17')](_0xd39da);return _0x37064f[_0x8ffd('0x1e')]('Content-Range',_0x189816+'-'+_0x4dd07e+'/'+_0x5b5bb7)[_0x8ffd('0x19')](_0xca915f);}return null;};}function patchUpdates(_0x30d247){return function(_0xfe2783){try{jsonpatch[_0x8ffd('0x1f')](_0xfe2783,_0x30d247,!![]);}catch(_0x53ca43){return BPromise[_0x8ffd('0x20')](_0x53ca43);}return _0xfe2783[_0x8ffd('0x21')]();};}function saveUpdates(_0x38559c,_0x5289d9){return function(_0x48788a){if(_0x48788a){return _0x48788a[_0x8ffd('0x22')](_0x38559c)[_0x8ffd('0x23')](function(_0x11e317){return _0x11e317;});}return null;};}function removeEntity(_0x23d50c,_0x25c1d4){return function(_0x55a283){if(_0x55a283){return _0x55a283[_0x8ffd('0x24')]()[_0x8ffd('0x23')](function(){_0x23d50c[_0x8ffd('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x175f7f,_0xfbee79){return function(_0xeefb17){if(!_0xeefb17){_0x175f7f[_0x8ffd('0x16')](0x194);}return _0xeefb17;};}function handleError(_0x170675,_0x3d17d9){_0x3d17d9=_0x3d17d9||0x1f4;return function(_0x37a25f){logger[_0x8ffd('0x25')](_0x37a25f[_0x8ffd('0x26')]);if(_0x37a25f[_0x8ffd('0x27')]){delete _0x37a25f[_0x8ffd('0x27')];}_0x170675[_0x8ffd('0x17')](_0x3d17d9)[_0x8ffd('0x28')](_0x37a25f);};}exports[_0x8ffd('0x29')]=function(_0x22a4e4,_0x3741d6){var _0x48d0ee={},_0x12bf03={},_0x5315ad={'count':0x0,'rows':[]};var _0x1276a7=_[_0x8ffd('0x2a')](db['ServicenowAccount'][_0x8ffd('0x2b')],function(_0x5c8a65){return{'name':_0x5c8a65[_0x8ffd('0x2c')],'type':_0x5c8a65[_0x8ffd('0x2d')][_0x8ffd('0x2e')]};});_0x12bf03['model']=_[_0x8ffd('0x2a')](_0x1276a7,_0x8ffd('0x27'));_0x12bf03[_0x8ffd('0x2f')]=_[_0x8ffd('0x30')](_0x22a4e4[_0x8ffd('0x2f')]);_0x12bf03[_0x8ffd('0x31')]=_[_0x8ffd('0x32')](_0x12bf03['model'],_0x12bf03[_0x8ffd('0x2f')]);_0x48d0ee[_0x8ffd('0x33')]=_[_0x8ffd('0x32')](_0x12bf03[_0x8ffd('0x34')],qs[_0x8ffd('0x35')](_0x22a4e4['query'][_0x8ffd('0x35')]));_0x48d0ee['attributes']=_0x48d0ee[_0x8ffd('0x33')][_0x8ffd('0x36')]?_0x48d0ee['attributes']:_0x12bf03[_0x8ffd('0x34')];if(!_0x22a4e4[_0x8ffd('0x2f')][_0x8ffd('0x37')](_0x8ffd('0x38'))){_0x48d0ee[_0x8ffd('0x1b')]=qs[_0x8ffd('0x1b')](_0x22a4e4['query'][_0x8ffd('0x1b')]);_0x48d0ee[_0x8ffd('0x1a')]=qs[_0x8ffd('0x1a')](_0x22a4e4[_0x8ffd('0x2f')]['offset']);}_0x48d0ee['order']=qs['sort'](_0x22a4e4[_0x8ffd('0x2f')][_0x8ffd('0x39')]);_0x48d0ee[_0x8ffd('0x3a')]=qs[_0x8ffd('0x31')](_[_0x8ffd('0x3b')](_0x22a4e4[_0x8ffd('0x2f')],_0x12bf03[_0x8ffd('0x31')]),_0x1276a7);if(_0x22a4e4[_0x8ffd('0x2f')][_0x8ffd('0x3c')]){_0x48d0ee['where']=_[_0x8ffd('0x3d')](_0x48d0ee['where'],{'$or':_[_0x8ffd('0x2a')](_0x1276a7,function(_0x3aa527){if(_0x3aa527[_0x8ffd('0x2d')]!==_0x8ffd('0x3e')){var _0x2405e1={};_0x2405e1[_0x3aa527[_0x8ffd('0x27')]]={'$like':'%'+_0x22a4e4[_0x8ffd('0x2f')][_0x8ffd('0x3c')]+'%'};return _0x2405e1;}})});}_0x48d0ee=_[_0x8ffd('0x3d')]({},_0x48d0ee,_0x22a4e4['options']);var _0x20d10c={'where':_0x48d0ee[_0x8ffd('0x3a')]};return db['ServicenowAccount'][_0x8ffd('0x1d')](_0x20d10c)[_0x8ffd('0x23')](function(_0x15b211){_0x5315ad[_0x8ffd('0x1d')]=_0x15b211;if(_0x22a4e4['query']['includeAll']){_0x48d0ee[_0x8ffd('0x3f')]=[{'all':!![]}];}return db[_0x8ffd('0x40')][_0x8ffd('0x41')](_0x48d0ee);})[_0x8ffd('0x23')](function(_0x2444fb){_0x5315ad['rows']=_0x2444fb;return _0x5315ad;})[_0x8ffd('0x23')](respondWithFilteredResult(_0x3741d6,_0x48d0ee))[_0x8ffd('0x42')](handleError(_0x3741d6,null));};exports['show']=function(_0x40b3d9,_0x15c7b4){var _0x1224ab={'raw':![],'where':{'id':_0x40b3d9[_0x8ffd('0x43')]['id']}},_0x1db29e={};_0x1db29e[_0x8ffd('0x34')]=_[_0x8ffd('0x30')](db[_0x8ffd('0x40')]['rawAttributes']);_0x1db29e[_0x8ffd('0x2f')]=_[_0x8ffd('0x30')](_0x40b3d9[_0x8ffd('0x2f')]);_0x1db29e[_0x8ffd('0x31')]=_[_0x8ffd('0x32')](_0x1db29e[_0x8ffd('0x34')],_0x1db29e[_0x8ffd('0x2f')]);_0x1224ab[_0x8ffd('0x33')]=_[_0x8ffd('0x32')](_0x1db29e[_0x8ffd('0x34')],qs[_0x8ffd('0x35')](_0x40b3d9[_0x8ffd('0x2f')][_0x8ffd('0x35')]));_0x1224ab[_0x8ffd('0x33')]=_0x1224ab[_0x8ffd('0x33')]['length']?_0x1224ab[_0x8ffd('0x33')]:_0x1db29e[_0x8ffd('0x34')];if(_0x40b3d9['query'][_0x8ffd('0x44')]){_0x1224ab['include']=[{'all':!![]}];}_0x1224ab=_[_0x8ffd('0x3d')]({},_0x1224ab,_0x40b3d9[_0x8ffd('0x45')]);return db[_0x8ffd('0x40')]['find'](_0x1224ab)[_0x8ffd('0x23')](handleEntityNotFound(_0x15c7b4,null))[_0x8ffd('0x23')](respondWithResult(_0x15c7b4,null))[_0x8ffd('0x42')](handleError(_0x15c7b4,null));};exports[_0x8ffd('0x46')]=function(_0xa7dd0,_0x204e52){return db[_0x8ffd('0x40')][_0x8ffd('0x46')](_0xa7dd0[_0x8ffd('0x47')],{})[_0x8ffd('0x23')](respondWithResult(_0x204e52,0xc9))[_0x8ffd('0x42')](handleError(_0x204e52,null));};exports[_0x8ffd('0x22')]=function(_0x4c818e,_0x56507){if(_0x4c818e['body']['id']){delete _0x4c818e[_0x8ffd('0x47')]['id'];}return db[_0x8ffd('0x40')]['find']({'where':{'id':_0x4c818e[_0x8ffd('0x43')]['id']}})['then'](handleEntityNotFound(_0x56507,null))['then'](saveUpdates(_0x4c818e[_0x8ffd('0x47')],null))[_0x8ffd('0x23')](respondWithResult(_0x56507,null))[_0x8ffd('0x42')](handleError(_0x56507,null));};exports['destroy']=function(_0x2e4ffe,_0x2038bc){return db[_0x8ffd('0x40')][_0x8ffd('0x48')]({'where':{'id':_0x2e4ffe[_0x8ffd('0x43')]['id']}})[_0x8ffd('0x23')](handleEntityNotFound(_0x2038bc,null))['then'](removeEntity(_0x2038bc,null))['catch'](handleError(_0x2038bc,null));};exports[_0x8ffd('0x49')]=function(_0x179ed0,_0x2f3f67,_0x33c3bd){var _0x448bce={};var _0xef08e8={};var _0x7c6eee;var _0x458a46;return db[_0x8ffd('0x40')][_0x8ffd('0x4a')]({'where':{'id':_0x179ed0['params']['id']}})['then'](handleEntityNotFound(_0x2f3f67,null))[_0x8ffd('0x23')](function(_0x24a875){if(_0x24a875){_0x7c6eee=_0x24a875;_0xef08e8[_0x8ffd('0x34')]=_[_0x8ffd('0x30')](db[_0x8ffd('0x4b')][_0x8ffd('0x2b')]);_0xef08e8[_0x8ffd('0x2f')]=_[_0x8ffd('0x30')](_0x179ed0[_0x8ffd('0x2f')]);_0xef08e8[_0x8ffd('0x31')]=_[_0x8ffd('0x32')](_0xef08e8[_0x8ffd('0x34')],_0xef08e8[_0x8ffd('0x2f')]);_0x448bce['attributes']=_['intersection'](_0xef08e8['model'],qs[_0x8ffd('0x35')](_0x179ed0[_0x8ffd('0x2f')][_0x8ffd('0x35')]));_0x448bce[_0x8ffd('0x33')]=_0x448bce[_0x8ffd('0x33')][_0x8ffd('0x36')]?_0x448bce['attributes']:_0xef08e8[_0x8ffd('0x34')];_0x448bce[_0x8ffd('0x4c')]=qs['sort'](_0x179ed0['query'][_0x8ffd('0x39')]);_0x448bce[_0x8ffd('0x3a')]=qs[_0x8ffd('0x31')](_['pick'](_0x179ed0[_0x8ffd('0x2f')],_0xef08e8['filters']));if(_0x179ed0[_0x8ffd('0x2f')][_0x8ffd('0x3c')]){_0x448bce[_0x8ffd('0x3a')]=_[_0x8ffd('0x3d')](_0x448bce[_0x8ffd('0x3a')],{'$or':_[_0x8ffd('0x2a')](_0x448bce[_0x8ffd('0x33')],function(_0x52fa5b){var _0x2275bf={};_0x2275bf[_0x52fa5b]={'$like':'%'+_0x179ed0[_0x8ffd('0x2f')]['filter']+'%'};return _0x2275bf;})});}_0x448bce=_[_0x8ffd('0x3d')]({},_0x448bce,_0x179ed0['options']);return _0x7c6eee[_0x8ffd('0x49')](_0x448bce);}})['then'](function(_0x400719){if(_0x400719){_0x458a46=_0x400719['length'];if(!_0x179ed0[_0x8ffd('0x2f')][_0x8ffd('0x37')](_0x8ffd('0x38'))){_0x448bce['limit']=qs[_0x8ffd('0x1b')](_0x179ed0['query'][_0x8ffd('0x1b')]);_0x448bce['offset']=qs[_0x8ffd('0x1a')](_0x179ed0[_0x8ffd('0x2f')][_0x8ffd('0x1a')]);}return _0x7c6eee[_0x8ffd('0x49')](_0x448bce);}})['then'](function(_0x4f965a){if(_0x4f965a){return _0x4f965a?{'count':_0x458a46,'rows':_0x4f965a}:null;}})[_0x8ffd('0x23')](respondWithResult(_0x2f3f67,null))[_0x8ffd('0x42')](handleError(_0x2f3f67,null));};exports['addConfiguration']=function(_0x3a4dba,_0x18a23d,_0x22edf5){if(_0x3a4dba[_0x8ffd('0x47')]['id']){delete _0x3a4dba[_0x8ffd('0x47')]['id'];}return db[_0x8ffd('0x40')][_0x8ffd('0x4a')]({'where':{'id':_0x3a4dba[_0x8ffd('0x43')]['id']}})[_0x8ffd('0x23')](handleEntityNotFound(_0x18a23d,null))[_0x8ffd('0x23')](function(_0x249630){if(_0x249630){_0x3a4dba[_0x8ffd('0x47')]['AccountId']=_0x249630['id'];_0x3a4dba[_0x8ffd('0x47')][_0x8ffd('0x4d')]=integrations[_0x8ffd('0x4e')](_0x3a4dba[_0x8ffd('0x47')]['channel'],_0x3a4dba[_0x8ffd('0x47')][_0x8ffd('0x2d')]);_0x3a4dba['body'][_0x8ffd('0x4f')]=integrations['getDescriptions'](_0x3a4dba[_0x8ffd('0x47')]['channel'],_0x3a4dba[_0x8ffd('0x47')]['type']);return db[_0x8ffd('0x4b')][_0x8ffd('0x46')](_0x3a4dba['body'],{'include':[{'model':db[_0x8ffd('0x50')],'as':_0x8ffd('0x4d')},{'model':db[_0x8ffd('0x50')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x18a23d,null))['catch'](handleError(_0x18a23d,null));};exports[_0x8ffd('0x51')]=function(_0xdd66a6,_0x21119e,_0x49bb3f){var _0x34c84b=['made_sla',_0x8ffd('0x52'),'knowledge','subcategory','close_code',_0x8ffd('0x53'),_0x8ffd('0x54'),_0x8ffd('0x55'),_0x8ffd('0x56')];var _0x46d220=[_0x8ffd('0x57'),_0x8ffd('0x58'),_0x8ffd('0x59'),_0x8ffd('0x5a'),_0x8ffd('0x5b'),_0x8ffd('0x5c'),_0x8ffd('0x5d'),_0x8ffd('0x52'),_0x8ffd('0x5e'),_0x8ffd('0x5f'),_0x8ffd('0x60'),_0x8ffd('0x61'),'opened_by',_0x8ffd('0x62'),_0x8ffd('0x63'),_0x8ffd('0x64'),'state',_0x8ffd('0x65'),'knowledge',_0x8ffd('0x4c'),_0x8ffd('0x66'),_0x8ffd('0x67'),_0x8ffd('0x68'),_0x8ffd('0x69'),'impact',_0x8ffd('0x6a'),_0x8ffd('0x6b'),'business_service',_0x8ffd('0x6c'),'sys_domain_path',_0x8ffd('0x6d'),_0x8ffd('0x6e'),_0x8ffd('0x6f'),_0x8ffd('0x70'),_0x8ffd('0x71'),_0x8ffd('0x72'),_0x8ffd('0x73'),_0x8ffd('0x74'),'resolved_at',_0x8ffd('0x75'),_0x8ffd('0x76'),_0x8ffd('0x77'),_0x8ffd('0x78'),'short_description',_0x8ffd('0x79'),_0x8ffd('0x7a'),_0x8ffd('0x7b'),_0x8ffd('0x7c'),_0x8ffd('0x7d'),_0x8ffd('0x7e'),'additional_assignee_list','description',_0x8ffd('0x7f'),'notify',_0x8ffd('0x80'),_0x8ffd('0x81'),'closed_by',_0x8ffd('0x82'),_0x8ffd('0x83'),'sys_id',_0x8ffd('0x84'),_0x8ffd('0x85'),'incident_state','urgency','problem_id',_0x8ffd('0x86'),_0x8ffd('0x87'),_0x8ffd('0x88'),_0x8ffd('0x89'),_0x8ffd('0x55'),_0x8ffd('0x8a'),_0x8ffd('0x8b'),_0x8ffd('0x8c'),'comments_and_work_notes','due_date',_0x8ffd('0x8d'),_0x8ffd('0x8e'),_0x8ffd('0x8f'),'escalation',_0x8ffd('0x90'),_0x8ffd('0x91'),_0x8ffd('0x92'),_0x8ffd('0x56')];var _0xc17a5a='';var _0x3ee14d='';var _0x373075=[];var _0x438007='';var _0x52baea='';var _0x213662=[];var _0x4b7e44='';var _0xfb7cc7='';var _0x264981={};var _0x1a06be='';return db['ServicenowAccount'][_0x8ffd('0x4a')]({'where':{'id':_0xdd66a6[_0x8ffd('0x43')]['id']},'attributes':['id','username','password',_0x8ffd('0x93'),_0x8ffd('0x94'),'serverUrl']})['then'](handleEntityNotFound(_0x21119e,null))[_0x8ffd('0x23')](function(_0x25b603){if(_0x25b603){_0x1a06be=_0x25b603[_0x8ffd('0x94')];var _0x1c4870=_0x1a06be[_0x8ffd('0x95')](-0x1);if(_0x1c4870==='/'){_0x1a06be=_0x1a06be[_0x8ffd('0x96')](0x0,_0x1a06be[_0x8ffd('0x97')](_0x1c4870));}_0xfb7cc7=util['format'](_0x8ffd('0x98'),_0x1a06be);_0x4b7e44=util[_0x8ffd('0x99')](_0x8ffd('0x9a'),_0x1a06be);_0x264981={'user':_0x25b603[_0x8ffd('0x9b')],'pass':_0x25b603[_0x8ffd('0x9c')]};var _0x5c1d55={'method':_0x8ffd('0x9d'),'uri':_0xfb7cc7+_0x8ffd('0x9e'),'auth':_0x264981,'json':!![]};return rp(_0x5c1d55);}})[_0x8ffd('0x23')](function(_0xba8add){if(_0xba8add[_0x8ffd('0x9f')][_0x8ffd('0x36')]>0x0){_0xc17a5a=_0xba8add[_0x8ffd('0x9f')];}console[_0x8ffd('0xa0')]('incident\x20table\x20objects',_0xc17a5a);_0x213662=[];_0x3ee14d=Object[_0x8ffd('0xa1')]([],_0xc17a5a);_['remove'](_0x3ee14d,function(_0xc929a3){return!_0x34c84b[_0x8ffd('0xa2')](_0xc929a3[_0x8ffd('0x27')]);});_0x3ee14d[_0x8ffd('0xa3')](function(_0x45ee33){var _0x16ff55=createFieldObject(_0x4b7e44,_0x264981,_0x45ee33[_0x8ffd('0xa4')],_0x45ee33['name'],_0x45ee33[_0x8ffd('0xa5')],![]);_0x213662[_0x8ffd('0xa6')](_0x16ff55);});return Promise[_0x8ffd('0xa7')](_0x213662);})[_0x8ffd('0x23')](function(_0x159b06){_0x373075=_0x159b06;_0x438007=Object[_0x8ffd('0xa1')]([],_0xc17a5a);console[_0x8ffd('0xa0')](_0x8ffd('0xa8'),_0xc17a5a);_[_0x8ffd('0xa9')](_0x438007,function(_0x305784){return _0x46d220[_0x8ffd('0xa2')](_0x305784[_0x8ffd('0x27')]);});console[_0x8ffd('0xa0')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x438007);_0x213662=[];_0x438007['forEach'](function(_0x332cb1){var _0x5504db=createFieldObject(_0x4b7e44,_0x264981,_0x332cb1['internalType'],_0x332cb1['name'],_0x332cb1[_0x8ffd('0xa5')],!![]);_0x213662[_0x8ffd('0xa6')](_0x5504db);});return Promise[_0x8ffd('0xa7')](_0x213662);})[_0x8ffd('0x23')](function(_0x51f9b6){_0x52baea=_0x51f9b6;var _0x41be8f=_0x373075['concat'](_0x52baea);return{'count':_0x41be8f[_0x8ffd('0x36')],'rows':_0x41be8f};})[_0x8ffd('0x23')](respondWithResult(_0x21119e,null))[_0x8ffd('0x42')](function(_0x40d183){console[_0x8ffd('0xa0')](_0x8ffd('0xaa')+_0x40d183);var _0x3aa1a6=_0xdd66a6[_0x8ffd('0x2f')][_0x8ffd('0xab')]?0x1f4:_0x40d183[_0x8ffd('0xac')]||0x1f4;logger[_0x8ffd('0x25')](_0x40d183[_0x8ffd('0x26')]);delete _0x40d183[_0x8ffd('0x27')];if(_0x3aa1a6===0x191){_0x3aa1a6=0x190;}_0x21119e[_0x8ffd('0x17')](_0x3aa1a6)[_0x8ffd('0x28')](_0xdd66a6[_0x8ffd('0x2f')][_0x8ffd('0xab')]?{'message':_0x8ffd('0xad'),'statusCode':_0x40d183['statusCode']}:_0x40d183);});};function createFieldObject(_0xb66230,_0x4dda2e,_0x53d35c,_0x345c5e,_0x1a12f2,_0x2e7f63){return new Promise(function(_0x48ee3e,_0x2cb1b3){var _0x4da23b={'id':_0x345c5e,'name':_0x1a12f2,'custom':_0x2e7f63};if(_0x53d35c==='boolean'){_0x4da23b[_0x8ffd('0x45')]=[{'name':'True','value':_0x8ffd('0xae')},{'name':_0x8ffd('0xaf'),'value':_0x8ffd('0xb0')}];_0x48ee3e(_0x4da23b);}else{var _0x251798={'method':'GET','uri':_0xb66230+'sys_choice?sysparm_query=name=incident^element='+_0x345c5e,'auth':_0x4dda2e,'json':!![]};return rp(_0x251798)[_0x8ffd('0x23')](function(_0x555a2a){var _0x862c6d=[];if(_0x555a2a[_0x8ffd('0x9f')][_0x8ffd('0x36')]>0x0){_0x555a2a[_0x8ffd('0x9f')]['forEach'](function(_0x284da9){if(_0x284da9[_0x8ffd('0xb1')]===_0x8ffd('0xb0')){var _0xaa6094={'name':_0x284da9[_0x8ffd('0xa5')],'value':_0x284da9[_0x8ffd('0xb2')]};_0x862c6d['push'](_0xaa6094);}});}_0x4da23b['options']=_0x862c6d;if(_0x4da23b[_0x8ffd('0x45')][_0x8ffd('0x36')]>0x0){_0x48ee3e(_0x4da23b);}else{if(_0x2e7f63==![]){_0x48ee3e();}else{_0x48ee3e(_0x4da23b);}}});}});} \ No newline at end of file +var _0xb2d2=['additional_assignee_list','description','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','reopened_by','urgency','problem_id','company','activity_due','assigned_to','comments','sla_due','approval','comments_and_work_notes','sys_tags','escalation','upon_approval','correlation_id','location','username','password','email','remoteUri','serverUrl','slice','substring','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','remove','includes','forEach','internalType','label','push','all','assign','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','ServiceNow\x20error:\x20','test','statusCode','error','True','true','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','apply','reject','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','filter','where','merge','type','VIRTUAL','options','ServicenowAccount','includeAll','include','findAll','catch','params','find','create','body','update','getConfigurations','findOne','ServicenowConfiguration','addConfiguration','Subjects','getSubjects','Descriptions','channel','ServicenowField','hold_reason','knowledge','close_code','notify','incident_state','category','made_sla','watch_list','sys_updated_on','child_incidents','approval_history','number','sys_updated_by','user_input','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','impact','active','business_service','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','work_end','reopened_time','approval_set','subcategory','work_notes','short_description','correlation_display','assignment_group','business_stc'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xb2d2,0x1a8));var _0x2b2d=function(_0x3127f3,_0xb0df5c){_0x3127f3=_0x3127f3-0x0;var _0x1b846d=_0xb2d2[_0x3127f3];return _0x1b846d;};'use strict';var emlformat=require(_0x2b2d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2b2d('0x1'));var rp=require(_0x2b2d('0x2'));var moment=require(_0x2b2d('0x3'));var BPromise=require(_0x2b2d('0x4'));var Mustache=require(_0x2b2d('0x5'));var util=require('util');var path=require(_0x2b2d('0x6'));var sox=require(_0x2b2d('0x7'));var csv=require('to-csv');var ejs=require(_0x2b2d('0x8'));var fs=require('fs');var fs_extra=require(_0x2b2d('0x9'));var _=require(_0x2b2d('0xa'));var squel=require(_0x2b2d('0xb'));var crypto=require(_0x2b2d('0xc'));var jsforce=require(_0x2b2d('0xd'));var deskjs=require(_0x2b2d('0xe'));var toCsv=require('to-csv');var querystring=require(_0x2b2d('0xf'));var Papa=require(_0x2b2d('0x10'));var Redis=require(_0x2b2d('0x11'));var authService=require(_0x2b2d('0x12'));var qs=require(_0x2b2d('0x13'));var as=require(_0x2b2d('0x14'));var hardwareService=require(_0x2b2d('0x15'));var logger=require('../../config/logger')(_0x2b2d('0x16'));var utils=require(_0x2b2d('0x17'));var config=require(_0x2b2d('0x18'));var licenseUtil=require(_0x2b2d('0x19'));var db=require('../../mysqldb')['db'];var integrations=require(_0x2b2d('0x1a'));function respondWithStatusCode(_0x1e3344,_0x1e3f2c){_0x1e3f2c=_0x1e3f2c||0xcc;return function(_0x5312b5){if(_0x5312b5){return _0x1e3344[_0x2b2d('0x1b')](_0x1e3f2c);}return _0x1e3344['status'](_0x1e3f2c)[_0x2b2d('0x1c')]();};}function respondWithResult(_0x2577e6,_0x16f430){_0x16f430=_0x16f430||0xc8;return function(_0x536c97){if(_0x536c97){return _0x2577e6[_0x2b2d('0x1d')](_0x16f430)[_0x2b2d('0x1e')](_0x536c97);}};}function respondWithFilteredResult(_0x3d0fd9,_0x1faea8){return function(_0x4599af){if(_0x4599af){var _0x3cf7ce=typeof _0x1faea8[_0x2b2d('0x1f')]===_0x2b2d('0x20')&&typeof _0x1faea8['limit']==='undefined';var _0xa30ce3=_0x4599af[_0x2b2d('0x21')];var _0x502096=_0x3cf7ce?0x0:_0x1faea8[_0x2b2d('0x1f')];var _0x5c6068=_0x3cf7ce?_0x4599af['count']:_0x1faea8['offset']+_0x1faea8['limit'];var _0x1310d8;if(_0x5c6068>=_0xa30ce3){_0x5c6068=_0xa30ce3;_0x1310d8=0xc8;}else{_0x1310d8=0xce;}_0x3d0fd9['status'](_0x1310d8);return _0x3d0fd9[_0x2b2d('0x22')](_0x2b2d('0x23'),_0x502096+'-'+_0x5c6068+'/'+_0xa30ce3)[_0x2b2d('0x1e')](_0x4599af);}return null;};}function patchUpdates(_0x427667){return function(_0x40962b){try{jsonpatch[_0x2b2d('0x24')](_0x40962b,_0x427667,!![]);}catch(_0x3e0b96){return BPromise[_0x2b2d('0x25')](_0x3e0b96);}return _0x40962b['save']();};}function saveUpdates(_0x2dd39d,_0x2574fe){return function(_0x34b06f){if(_0x34b06f){return _0x34b06f['update'](_0x2dd39d)[_0x2b2d('0x26')](function(_0xe12845){return _0xe12845;});}return null;};}function removeEntity(_0x38bbe2,_0x5ca57d){return function(_0x5992fb){if(_0x5992fb){return _0x5992fb[_0x2b2d('0x27')]()['then'](function(){_0x38bbe2[_0x2b2d('0x1d')](0xcc)[_0x2b2d('0x1c')]();});}};}function handleEntityNotFound(_0x54823b,_0xf9eb6d){return function(_0x8b63ce){if(!_0x8b63ce){_0x54823b['sendStatus'](0x194);}return _0x8b63ce;};}function handleError(_0x1b2103,_0x318e4c){_0x318e4c=_0x318e4c||0x1f4;return function(_0x2b76b2){logger['error'](_0x2b76b2[_0x2b2d('0x28')]);if(_0x2b76b2['name']){delete _0x2b76b2[_0x2b2d('0x29')];}_0x1b2103[_0x2b2d('0x1d')](_0x318e4c)[_0x2b2d('0x2a')](_0x2b76b2);};}exports[_0x2b2d('0x2b')]=function(_0x39ebb3,_0x203cbc){var _0x2d282e={},_0x55ffbe={},_0x300c5b={'count':0x0,'rows':[]};var _0x24b303=_[_0x2b2d('0x2c')](db['ServicenowAccount'][_0x2b2d('0x2d')],function(_0x5107c1){return{'name':_0x5107c1[_0x2b2d('0x2e')],'type':_0x5107c1['type'][_0x2b2d('0x2f')]};});_0x55ffbe[_0x2b2d('0x30')]=_['map'](_0x24b303,_0x2b2d('0x29'));_0x55ffbe[_0x2b2d('0x31')]=_[_0x2b2d('0x32')](_0x39ebb3[_0x2b2d('0x31')]);_0x55ffbe[_0x2b2d('0x33')]=_['intersection'](_0x55ffbe['model'],_0x55ffbe[_0x2b2d('0x31')]);_0x2d282e[_0x2b2d('0x34')]=_[_0x2b2d('0x35')](_0x55ffbe[_0x2b2d('0x30')],qs['fields'](_0x39ebb3[_0x2b2d('0x31')][_0x2b2d('0x36')]));_0x2d282e[_0x2b2d('0x34')]=_0x2d282e[_0x2b2d('0x34')][_0x2b2d('0x37')]?_0x2d282e[_0x2b2d('0x34')]:_0x55ffbe[_0x2b2d('0x30')];if(!_0x39ebb3[_0x2b2d('0x31')][_0x2b2d('0x38')](_0x2b2d('0x39'))){_0x2d282e['limit']=qs[_0x2b2d('0x3a')](_0x39ebb3[_0x2b2d('0x31')][_0x2b2d('0x3a')]);_0x2d282e[_0x2b2d('0x1f')]=qs[_0x2b2d('0x1f')](_0x39ebb3[_0x2b2d('0x31')][_0x2b2d('0x1f')]);}_0x2d282e[_0x2b2d('0x3b')]=qs[_0x2b2d('0x3c')](_0x39ebb3[_0x2b2d('0x31')]['sort']);_0x2d282e['where']=qs['filters'](_['pick'](_0x39ebb3[_0x2b2d('0x31')],_0x55ffbe[_0x2b2d('0x33')]),_0x24b303);if(_0x39ebb3['query'][_0x2b2d('0x3d')]){_0x2d282e[_0x2b2d('0x3e')]=_[_0x2b2d('0x3f')](_0x2d282e[_0x2b2d('0x3e')],{'$or':_[_0x2b2d('0x2c')](_0x24b303,function(_0xab9581){if(_0xab9581[_0x2b2d('0x40')]!==_0x2b2d('0x41')){var _0x33f077={};_0x33f077[_0xab9581[_0x2b2d('0x29')]]={'$like':'%'+_0x39ebb3[_0x2b2d('0x31')]['filter']+'%'};return _0x33f077;}})});}_0x2d282e=_[_0x2b2d('0x3f')]({},_0x2d282e,_0x39ebb3[_0x2b2d('0x42')]);var _0xcdde59={'where':_0x2d282e[_0x2b2d('0x3e')]};return db[_0x2b2d('0x43')][_0x2b2d('0x21')](_0xcdde59)[_0x2b2d('0x26')](function(_0x250105){_0x300c5b[_0x2b2d('0x21')]=_0x250105;if(_0x39ebb3['query'][_0x2b2d('0x44')]){_0x2d282e[_0x2b2d('0x45')]=[{'all':!![]}];}return db[_0x2b2d('0x43')][_0x2b2d('0x46')](_0x2d282e);})[_0x2b2d('0x26')](function(_0xf7c5ab){_0x300c5b['rows']=_0xf7c5ab;return _0x300c5b;})['then'](respondWithFilteredResult(_0x203cbc,_0x2d282e))[_0x2b2d('0x47')](handleError(_0x203cbc,null));};exports['show']=function(_0x3a89ac,_0x4f9cd5){var _0x504b1a={'raw':![],'where':{'id':_0x3a89ac[_0x2b2d('0x48')]['id']}},_0x5de36a={};_0x5de36a['model']=_[_0x2b2d('0x32')](db[_0x2b2d('0x43')][_0x2b2d('0x2d')]);_0x5de36a[_0x2b2d('0x31')]=_['keys'](_0x3a89ac[_0x2b2d('0x31')]);_0x5de36a[_0x2b2d('0x33')]=_[_0x2b2d('0x35')](_0x5de36a[_0x2b2d('0x30')],_0x5de36a[_0x2b2d('0x31')]);_0x504b1a[_0x2b2d('0x34')]=_[_0x2b2d('0x35')](_0x5de36a[_0x2b2d('0x30')],qs[_0x2b2d('0x36')](_0x3a89ac[_0x2b2d('0x31')][_0x2b2d('0x36')]));_0x504b1a['attributes']=_0x504b1a[_0x2b2d('0x34')]['length']?_0x504b1a[_0x2b2d('0x34')]:_0x5de36a[_0x2b2d('0x30')];if(_0x3a89ac[_0x2b2d('0x31')]['includeAll']){_0x504b1a[_0x2b2d('0x45')]=[{'all':!![]}];}_0x504b1a=_[_0x2b2d('0x3f')]({},_0x504b1a,_0x3a89ac[_0x2b2d('0x42')]);return db[_0x2b2d('0x43')][_0x2b2d('0x49')](_0x504b1a)[_0x2b2d('0x26')](handleEntityNotFound(_0x4f9cd5,null))[_0x2b2d('0x26')](respondWithResult(_0x4f9cd5,null))['catch'](handleError(_0x4f9cd5,null));};exports['create']=function(_0x490f0e,_0x214329){return db['ServicenowAccount'][_0x2b2d('0x4a')](_0x490f0e[_0x2b2d('0x4b')],{})[_0x2b2d('0x26')](respondWithResult(_0x214329,0xc9))[_0x2b2d('0x47')](handleError(_0x214329,null));};exports[_0x2b2d('0x4c')]=function(_0x6e37d7,_0x5fd23){if(_0x6e37d7['body']['id']){delete _0x6e37d7[_0x2b2d('0x4b')]['id'];}return db[_0x2b2d('0x43')][_0x2b2d('0x49')]({'where':{'id':_0x6e37d7[_0x2b2d('0x48')]['id']}})['then'](handleEntityNotFound(_0x5fd23,null))[_0x2b2d('0x26')](saveUpdates(_0x6e37d7[_0x2b2d('0x4b')],null))[_0x2b2d('0x26')](respondWithResult(_0x5fd23,null))['catch'](handleError(_0x5fd23,null));};exports[_0x2b2d('0x27')]=function(_0x3f8fb7,_0xe27ae0){return db[_0x2b2d('0x43')][_0x2b2d('0x49')]({'where':{'id':_0x3f8fb7[_0x2b2d('0x48')]['id']}})[_0x2b2d('0x26')](handleEntityNotFound(_0xe27ae0,null))[_0x2b2d('0x26')](removeEntity(_0xe27ae0,null))[_0x2b2d('0x47')](handleError(_0xe27ae0,null));};exports[_0x2b2d('0x4d')]=function(_0x55ef58,_0x249b09,_0x2f53df){var _0x433c6d={};var _0x5d43f7={};var _0x8abc8a;var _0x2b17a2;return db[_0x2b2d('0x43')][_0x2b2d('0x4e')]({'where':{'id':_0x55ef58[_0x2b2d('0x48')]['id']}})[_0x2b2d('0x26')](handleEntityNotFound(_0x249b09,null))[_0x2b2d('0x26')](function(_0x337496){if(_0x337496){_0x8abc8a=_0x337496;_0x5d43f7[_0x2b2d('0x30')]=_[_0x2b2d('0x32')](db[_0x2b2d('0x4f')][_0x2b2d('0x2d')]);_0x5d43f7[_0x2b2d('0x31')]=_[_0x2b2d('0x32')](_0x55ef58[_0x2b2d('0x31')]);_0x5d43f7['filters']=_[_0x2b2d('0x35')](_0x5d43f7['model'],_0x5d43f7['query']);_0x433c6d['attributes']=_[_0x2b2d('0x35')](_0x5d43f7[_0x2b2d('0x30')],qs[_0x2b2d('0x36')](_0x55ef58[_0x2b2d('0x31')][_0x2b2d('0x36')]));_0x433c6d[_0x2b2d('0x34')]=_0x433c6d[_0x2b2d('0x34')]['length']?_0x433c6d['attributes']:_0x5d43f7[_0x2b2d('0x30')];_0x433c6d['order']=qs[_0x2b2d('0x3c')](_0x55ef58[_0x2b2d('0x31')][_0x2b2d('0x3c')]);_0x433c6d[_0x2b2d('0x3e')]=qs[_0x2b2d('0x33')](_['pick'](_0x55ef58[_0x2b2d('0x31')],_0x5d43f7[_0x2b2d('0x33')]));if(_0x55ef58[_0x2b2d('0x31')][_0x2b2d('0x3d')]){_0x433c6d[_0x2b2d('0x3e')]=_[_0x2b2d('0x3f')](_0x433c6d[_0x2b2d('0x3e')],{'$or':_[_0x2b2d('0x2c')](_0x433c6d[_0x2b2d('0x34')],function(_0x5d8dc7){var _0x44170c={};_0x44170c[_0x5d8dc7]={'$like':'%'+_0x55ef58[_0x2b2d('0x31')][_0x2b2d('0x3d')]+'%'};return _0x44170c;})});}_0x433c6d=_[_0x2b2d('0x3f')]({},_0x433c6d,_0x55ef58[_0x2b2d('0x42')]);return _0x8abc8a[_0x2b2d('0x4d')](_0x433c6d);}})[_0x2b2d('0x26')](function(_0x1827b2){if(_0x1827b2){_0x2b17a2=_0x1827b2[_0x2b2d('0x37')];if(!_0x55ef58[_0x2b2d('0x31')]['hasOwnProperty'](_0x2b2d('0x39'))){_0x433c6d[_0x2b2d('0x3a')]=qs[_0x2b2d('0x3a')](_0x55ef58[_0x2b2d('0x31')][_0x2b2d('0x3a')]);_0x433c6d[_0x2b2d('0x1f')]=qs[_0x2b2d('0x1f')](_0x55ef58[_0x2b2d('0x31')][_0x2b2d('0x1f')]);}return _0x8abc8a[_0x2b2d('0x4d')](_0x433c6d);}})[_0x2b2d('0x26')](function(_0x50e4c){if(_0x50e4c){return _0x50e4c?{'count':_0x2b17a2,'rows':_0x50e4c}:null;}})[_0x2b2d('0x26')](respondWithResult(_0x249b09,null))[_0x2b2d('0x47')](handleError(_0x249b09,null));};exports[_0x2b2d('0x50')]=function(_0xe3e64f,_0x2e28c4,_0x1f10ac){if(_0xe3e64f['body']['id']){delete _0xe3e64f[_0x2b2d('0x4b')]['id'];}return db[_0x2b2d('0x43')][_0x2b2d('0x4e')]({'where':{'id':_0xe3e64f[_0x2b2d('0x48')]['id']}})[_0x2b2d('0x26')](handleEntityNotFound(_0x2e28c4,null))[_0x2b2d('0x26')](function(_0x235fb6){if(_0x235fb6){_0xe3e64f[_0x2b2d('0x4b')]['AccountId']=_0x235fb6['id'];_0xe3e64f[_0x2b2d('0x4b')][_0x2b2d('0x51')]=integrations[_0x2b2d('0x52')](_0xe3e64f[_0x2b2d('0x4b')]['channel'],_0xe3e64f['body'][_0x2b2d('0x40')]);_0xe3e64f['body'][_0x2b2d('0x53')]=integrations['getDescriptions'](_0xe3e64f[_0x2b2d('0x4b')][_0x2b2d('0x54')],_0xe3e64f[_0x2b2d('0x4b')][_0x2b2d('0x40')]);return db['ServicenowConfiguration'][_0x2b2d('0x4a')](_0xe3e64f[_0x2b2d('0x4b')],{'include':[{'model':db[_0x2b2d('0x55')],'as':_0x2b2d('0x51')},{'model':db[_0x2b2d('0x55')],'as':'Descriptions'}]});}return null;})[_0x2b2d('0x26')](respondWithResult(_0x2e28c4,null))[_0x2b2d('0x47')](handleError(_0x2e28c4,null));};exports['getFields']=function(_0x268846,_0xfa6836,_0x210b6b){var _0x1dc887=['made_sla',_0x2b2d('0x56'),_0x2b2d('0x57'),'subcategory',_0x2b2d('0x58'),_0x2b2d('0x59'),_0x2b2d('0x5a'),'severity',_0x2b2d('0x5b')];var _0x24c5dc=['parent',_0x2b2d('0x5c'),'caused_by',_0x2b2d('0x5d'),'upon_reject',_0x2b2d('0x5e'),_0x2b2d('0x5f'),'hold_reason',_0x2b2d('0x60'),_0x2b2d('0x61'),'resolved_by',_0x2b2d('0x62'),'opened_by',_0x2b2d('0x63'),_0x2b2d('0x64'),_0x2b2d('0x65'),_0x2b2d('0x66'),_0x2b2d('0x67'),_0x2b2d('0x57'),_0x2b2d('0x3b'),_0x2b2d('0x68'),_0x2b2d('0x69'),_0x2b2d('0x6a'),'delivery_plan',_0x2b2d('0x6b'),_0x2b2d('0x6c'),'work_notes_list',_0x2b2d('0x6d'),'priority',_0x2b2d('0x6e'),_0x2b2d('0x6f'),_0x2b2d('0x70'),_0x2b2d('0x71'),_0x2b2d('0x72'),_0x2b2d('0x73'),'group_list',_0x2b2d('0x74'),_0x2b2d('0x75'),'resolved_at','caller_id',_0x2b2d('0x76'),_0x2b2d('0x77'),_0x2b2d('0x78'),_0x2b2d('0x79'),_0x2b2d('0x58'),_0x2b2d('0x7a'),'delivery_task','work_start',_0x2b2d('0x7b'),_0x2b2d('0x7c'),_0x2b2d('0x7d'),_0x2b2d('0x7e'),'calendar_duration','notify',_0x2b2d('0x7f'),_0x2b2d('0x80'),_0x2b2d('0x81'),_0x2b2d('0x82'),_0x2b2d('0x83'),_0x2b2d('0x84'),'contact_type',_0x2b2d('0x85'),_0x2b2d('0x5a'),_0x2b2d('0x86'),_0x2b2d('0x87'),_0x2b2d('0x88'),'reassignment_count',_0x2b2d('0x89'),_0x2b2d('0x8a'),'severity',_0x2b2d('0x8b'),_0x2b2d('0x8c'),_0x2b2d('0x8d'),_0x2b2d('0x8e'),'due_date','sys_mod_count','reopen_count',_0x2b2d('0x8f'),_0x2b2d('0x90'),_0x2b2d('0x91'),_0x2b2d('0x92'),_0x2b2d('0x93'),'category'];var _0x4015af='';var _0x27c1b5='';var _0x34e2e7=[];var _0x21ef2a='';var _0x1fcefe='';var _0x1a567b=[];var _0x2b358d='';var _0x57c6d7='';var _0x20a140={};var _0x50475e='';return db[_0x2b2d('0x43')]['findOne']({'where':{'id':_0x268846[_0x2b2d('0x48')]['id']},'attributes':['id',_0x2b2d('0x94'),_0x2b2d('0x95'),_0x2b2d('0x96'),_0x2b2d('0x97'),_0x2b2d('0x98')]})[_0x2b2d('0x26')](handleEntityNotFound(_0xfa6836,null))[_0x2b2d('0x26')](function(_0x926da5){if(_0x926da5){_0x50475e=_0x926da5[_0x2b2d('0x97')];var _0x5de318=_0x50475e[_0x2b2d('0x99')](-0x1);if(_0x5de318==='/'){_0x50475e=_0x50475e[_0x2b2d('0x9a')](0x0,_0x50475e['lastIndexOf'](_0x5de318));}_0x57c6d7=util[_0x2b2d('0x9b')](_0x2b2d('0x9c'),_0x50475e);_0x2b358d=util[_0x2b2d('0x9b')](_0x2b2d('0x9d'),_0x50475e);_0x20a140={'user':_0x926da5[_0x2b2d('0x94')],'pass':_0x926da5[_0x2b2d('0x95')]};var _0x4ae0b2={'method':_0x2b2d('0x9e'),'uri':_0x57c6d7+_0x2b2d('0x9f'),'auth':_0x20a140,'json':!![]};return rp(_0x4ae0b2);}})['then'](function(_0x42efef){if(_0x42efef[_0x2b2d('0xa0')][_0x2b2d('0x37')]>0x0){_0x4015af=_0x42efef[_0x2b2d('0xa0')];}console[_0x2b2d('0xa1')](_0x2b2d('0xa2'),_0x4015af);_0x1a567b=[];_0x27c1b5=Object['assign']([],_0x4015af);_[_0x2b2d('0xa3')](_0x27c1b5,function(_0x3a1e28){return!_0x1dc887[_0x2b2d('0xa4')](_0x3a1e28[_0x2b2d('0x29')]);});_0x27c1b5[_0x2b2d('0xa5')](function(_0x31ca4f){var _0x1722f5=createFieldObject(_0x2b358d,_0x20a140,_0x31ca4f[_0x2b2d('0xa6')],_0x31ca4f[_0x2b2d('0x29')],_0x31ca4f[_0x2b2d('0xa7')],![]);_0x1a567b[_0x2b2d('0xa8')](_0x1722f5);});return Promise[_0x2b2d('0xa9')](_0x1a567b);})[_0x2b2d('0x26')](function(_0x10045d){_0x34e2e7=_0x10045d;_0x21ef2a=Object[_0x2b2d('0xaa')]([],_0x4015af);console[_0x2b2d('0xa1')](_0x2b2d('0xab'),_0x4015af);_[_0x2b2d('0xa3')](_0x21ef2a,function(_0x173354){return _0x24c5dc[_0x2b2d('0xa4')](_0x173354[_0x2b2d('0x29')]);});console[_0x2b2d('0xa1')](_0x2b2d('0xac'),_0x21ef2a);_0x1a567b=[];_0x21ef2a[_0x2b2d('0xa5')](function(_0x581881){var _0x4ea70e=createFieldObject(_0x2b358d,_0x20a140,_0x581881['internalType'],_0x581881[_0x2b2d('0x29')],_0x581881[_0x2b2d('0xa7')],!![]);_0x1a567b[_0x2b2d('0xa8')](_0x4ea70e);});return Promise[_0x2b2d('0xa9')](_0x1a567b);})[_0x2b2d('0x26')](function(_0xfbd5a1){_0x1fcefe=_0xfbd5a1;var _0x4eb486=_0x34e2e7['concat'](_0x1fcefe);return{'count':_0x4eb486[_0x2b2d('0x37')],'rows':_0x4eb486};})['then'](respondWithResult(_0xfa6836,null))['catch'](function(_0xca4c15){console[_0x2b2d('0xa1')](_0x2b2d('0xad')+_0xca4c15);var _0x4da266=_0x268846[_0x2b2d('0x31')][_0x2b2d('0xae')]?0x1f4:_0xca4c15[_0x2b2d('0xaf')]||0x1f4;logger[_0x2b2d('0xb0')](_0xca4c15[_0x2b2d('0x28')]);delete _0xca4c15['name'];if(_0x4da266===0x191){_0x4da266=0x190;}_0xfa6836['status'](_0x4da266)[_0x2b2d('0x2a')](_0x268846['query'][_0x2b2d('0xae')]?{'message':'Wrong\x20credentials','statusCode':_0xca4c15[_0x2b2d('0xaf')]}:_0xca4c15);});};function createFieldObject(_0x3388a2,_0x5686df,_0x1b5a56,_0x542bfe,_0x348f6f,_0x54c365){return new Promise(function(_0x1e669a,_0x25ee7d){var _0x2e30f5={'id':_0x542bfe,'name':_0x348f6f,'custom':_0x54c365};if(_0x1b5a56==='boolean'){_0x2e30f5[_0x2b2d('0x42')]=[{'name':_0x2b2d('0xb1'),'value':_0x2b2d('0xb2')},{'name':'False','value':_0x2b2d('0xb3')}];_0x1e669a(_0x2e30f5);}else{var _0x4ffdd0={'method':'GET','uri':_0x3388a2+_0x2b2d('0xb4')+_0x542bfe,'auth':_0x5686df,'json':!![]};return rp(_0x4ffdd0)[_0x2b2d('0x26')](function(_0x39d1cf){var _0x132e99=[];if(_0x39d1cf[_0x2b2d('0xa0')]['length']>0x0){_0x39d1cf[_0x2b2d('0xa0')][_0x2b2d('0xa5')](function(_0x5be85b){if(_0x5be85b[_0x2b2d('0xb5')]==='false'){var _0x337df1={'name':_0x5be85b['label'],'value':_0x5be85b[_0x2b2d('0xb6')]};_0x132e99['push'](_0x337df1);}});}_0x2e30f5[_0x2b2d('0x42')]=_0x132e99;if(_0x2e30f5[_0x2b2d('0x42')][_0x2b2d('0x37')]>0x0){_0x1e669a(_0x2e30f5);}else{if(_0x54c365==![]){_0x1e669a();}else{_0x1e669a(_0x2e30f5);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index a80ecb4..66d70da 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 _0x5fab=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','int_servicenow_accounts'];(function(_0x33f750,_0x3a0638){var _0xd2186a=function(_0x20b011){while(--_0x20b011){_0x33f750['push'](_0x33f750['shift']());}};_0xd2186a(++_0x3a0638);}(_0x5fab,0x177));var _0xb5fa=function(_0x2c7516,_0x2ca7f1){_0x2c7516=_0x2c7516-0x0;var _0x1d76a2=_0x5fab[_0x2c7516];return _0x1d76a2;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var logger=require('../../config/logger')(_0xb5fa('0x2'));var moment=require(_0xb5fa('0x3'));var BPromise=require(_0xb5fa('0x4'));var rp=require(_0xb5fa('0x5'));var fs=require('fs');var path=require(_0xb5fa('0x6'));var rimraf=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var attributes=require(_0xb5fa('0x9'));var integrations=require(_0xb5fa('0xa'));module[_0xb5fa('0xb')]=function(_0x4a0249,_0x5d70f6){return _0x4a0249[_0xb5fa('0xc')](_0xb5fa('0xd'),attributes,{'tableName':_0xb5fa('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x31f0=['./intServicenowAccount.attributes','ServicenowAccount','int_servicenow_accounts','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x20c2af,_0x3ff4dc){var _0x389a53=function(_0x344cb2){while(--_0x344cb2){_0x20c2af['push'](_0x20c2af['shift']());}};_0x389a53(++_0x3ff4dc);}(_0x31f0,0xb7));var _0x031f=function(_0x50d06f,_0x12e149){_0x50d06f=_0x50d06f-0x0;var _0x35e119=_0x31f0[_0x50d06f];return _0x35e119;};'use strict';var _=require(_0x031f('0x0'));var util=require('util');var logger=require(_0x031f('0x1'))('api');var moment=require(_0x031f('0x2'));var BPromise=require(_0x031f('0x3'));var rp=require(_0x031f('0x4'));var fs=require('fs');var path=require(_0x031f('0x5'));var rimraf=require('rimraf');var config=require(_0x031f('0x6'));var attributes=require(_0x031f('0x7'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x56328c,_0x3dc98e){return _0x56328c['define'](_0x031f('0x8'),attributes,{'tableName':_0x031f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index ed3a62e..686201e 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 _0xed33=['moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowServicenowAccount','find','debug','catch','lodash','util'];(function(_0x222a1b,_0x393ca1){var _0x392a7b=function(_0x3e0583){while(--_0x3e0583){_0x222a1b['push'](_0x222a1b['shift']());}};_0x392a7b(++_0x393ca1);}(_0xed33,0xfa));var _0x3ed3=function(_0x5af361,_0x416f6a){_0x5af361=_0x5af361-0x0;var _0x32dc35=_0xed33[_0x5af361];return _0x32dc35;};'use strict';var _=require(_0x3ed3('0x0'));var util=require(_0x3ed3('0x1'));var moment=require(_0x3ed3('0x2'));var BPromise=require(_0x3ed3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3ed3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3ed3('0x5'));var logger=require(_0x3ed3('0x6'))(_0x3ed3('0x7'));var config=require(_0x3ed3('0x8'));var jayson=require(_0x3ed3('0x9'));var client=jayson[_0x3ed3('0xa')][_0x3ed3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3811d2,_0x365656,_0x1a39c4){return new BPromise(function(_0x203f24,_0x1ed99e){return client[_0x3ed3('0xc')](_0x3811d2,_0x1a39c4)[_0x3ed3('0xd')](function(_0x3b67c6){logger[_0x3ed3('0xe')](_0x3ed3('0xf'),_0x365656,_0x3ed3('0x10'));logger['debug'](_0x3ed3('0x11'),_0x365656,_0x3ed3('0x10'),JSON[_0x3ed3('0x12')](_0x3b67c6));if(_0x3b67c6['error']){if(_0x3b67c6[_0x3ed3('0x13')]['code']===0x1f4){logger[_0x3ed3('0x13')](_0x3ed3('0xf'),_0x365656,_0x3b67c6[_0x3ed3('0x13')]['message']);return _0x1ed99e(_0x3b67c6[_0x3ed3('0x13')][_0x3ed3('0x14')]);}logger[_0x3ed3('0x13')]('ServicenowAccount,\x20%s,\x20%s',_0x365656,_0x3b67c6[_0x3ed3('0x13')][_0x3ed3('0x14')]);return _0x203f24(_0x3b67c6[_0x3ed3('0x13')][_0x3ed3('0x14')]);}else{logger[_0x3ed3('0xe')](_0x3ed3('0xf'),_0x365656,_0x3ed3('0x10'));_0x203f24(_0x3b67c6['result'][_0x3ed3('0x14')]);}})['catch'](function(_0x250d8f){logger[_0x3ed3('0x13')](_0x3ed3('0xf'),_0x365656,_0x250d8f);_0x1ed99e(_0x250d8f);});});}exports[_0x3ed3('0x15')]=function(_0x1b121d){var _0x7647ca=this;return new Promise(function(_0x2149e4,_0x22cfbd){return db[_0x3ed3('0x16')][_0x3ed3('0x17')]({'raw':_0x1b121d[_0x3ed3('0x18')]?_0x1b121d[_0x3ed3('0x18')][_0x3ed3('0x19')]===undefined?!![]:![]:!![],'where':_0x1b121d['options']?_0x1b121d[_0x3ed3('0x18')][_0x3ed3('0x1a')]||null:null,'attributes':_0x1b121d[_0x3ed3('0x18')]?_0x1b121d[_0x3ed3('0x18')][_0x3ed3('0x1b')]||null:null,'limit':_0x1b121d['options']?_0x1b121d[_0x3ed3('0x18')][_0x3ed3('0x1c')]||null:null,'include':_0x1b121d[_0x3ed3('0x18')]?_0x1b121d[_0x3ed3('0x18')][_0x3ed3('0x1d')]?_[_0x3ed3('0x1e')](_0x1b121d['options'][_0x3ed3('0x1d')],function(_0x5c9475){return{'model':db[_0x5c9475[_0x3ed3('0x1f')]],'as':_0x5c9475['as'],'attributes':_0x5c9475[_0x3ed3('0x1b')],'include':_0x5c9475[_0x3ed3('0x1d')]?_[_0x3ed3('0x1e')](_0x5c9475[_0x3ed3('0x1d')],function(_0x1d40a1){return{'model':db[_0x1d40a1['model']],'as':_0x1d40a1['as'],'attributes':_0x1d40a1[_0x3ed3('0x1b')],'include':_0x1d40a1[_0x3ed3('0x1d')]?_[_0x3ed3('0x1e')](_0x1d40a1[_0x3ed3('0x1d')],function(_0x357ae7){return{'model':db[_0x357ae7['model']],'as':_0x357ae7['as'],'attributes':_0x357ae7['attributes']};}):[]};}):[]};}):[]:[]})[_0x3ed3('0xd')](function(_0x555c05){logger[_0x3ed3('0xe')](_0x3ed3('0x15'),_0x1b121d);logger['debug'](_0x3ed3('0x15'),_0x1b121d,JSON[_0x3ed3('0x12')](_0x555c05));_0x2149e4(_0x555c05);})['catch'](function(_0x2f3645){logger[_0x3ed3('0x13')]('GetServicenowAccount',_0x2f3645['message'],_0x1b121d);_0x22cfbd(_0x7647ca[_0x3ed3('0x13')](0x1f4,_0x2f3645['message']));});});};exports[_0x3ed3('0x20')]=function(_0x1d3970){var _0x398dec=this;return new Promise(function(_0x5add93,_0x11e56d){return db[_0x3ed3('0x16')][_0x3ed3('0x21')]({'raw':_0x1d3970['options']?_0x1d3970[_0x3ed3('0x18')][_0x3ed3('0x19')]===undefined?!![]:![]:!![],'where':_0x1d3970[_0x3ed3('0x18')]?_0x1d3970[_0x3ed3('0x18')][_0x3ed3('0x1a')]||null:null,'attributes':_0x1d3970[_0x3ed3('0x18')]?_0x1d3970['options']['attributes']||null:null,'include':_0x1d3970[_0x3ed3('0x18')]?_0x1d3970[_0x3ed3('0x18')][_0x3ed3('0x1d')]?_[_0x3ed3('0x1e')](_0x1d3970[_0x3ed3('0x18')]['include'],function(_0x1be3cf){return{'model':db[_0x1be3cf[_0x3ed3('0x1f')]],'as':_0x1be3cf['as'],'attributes':_0x1be3cf[_0x3ed3('0x1b')],'include':_0x1be3cf['include']?_[_0x3ed3('0x1e')](_0x1be3cf['include'],function(_0x3c7b8d){return{'model':db[_0x3c7b8d[_0x3ed3('0x1f')]],'as':_0x3c7b8d['as'],'attributes':_0x3c7b8d['attributes'],'include':_0x3c7b8d['include']?_[_0x3ed3('0x1e')](_0x3c7b8d[_0x3ed3('0x1d')],function(_0x4cb713){return{'model':db[_0x4cb713[_0x3ed3('0x1f')]],'as':_0x4cb713['as'],'attributes':_0x4cb713[_0x3ed3('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x3ed3('0xd')](function(_0x3f9858){logger['info'](_0x3ed3('0x20'),_0x1d3970);logger[_0x3ed3('0x22')](_0x3ed3('0x20'),_0x1d3970,JSON[_0x3ed3('0x12')](_0x3f9858));_0x5add93(_0x3f9858);})[_0x3ed3('0x23')](function(_0x5c8b0c){logger[_0x3ed3('0x13')]('ShowServicenowAccount',_0x5c8b0c[_0x3ed3('0x14')],_0x1d3970);_0x11e56d(_0x398dec[_0x3ed3('0x13')](0x1f4,_0x5c8b0c[_0x3ed3('0x14')]));});});}; \ No newline at end of file +var _0xc965=['attributes','GetServicenowAccount','debug','find','ShowServicenowAccount','lodash','util','moment','bluebird','ioredis','../../mysqldb','jayson/promise','client','http','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','ServicenowAccount','findAll','options','raw','where','limit','map','include','model'];(function(_0x43dc66,_0x1fe159){var _0x30807f=function(_0x249bb1){while(--_0x249bb1){_0x43dc66['push'](_0x43dc66['shift']());}};_0x30807f(++_0x1fe159);}(_0xc965,0x68));var _0x5c96=function(_0x5e2b34,_0x58385c){_0x5e2b34=_0x5e2b34-0x0;var _0x4859f9=_0xc965[_0x5e2b34];return _0x4859f9;};'use strict';var _=require(_0x5c96('0x0'));var util=require(_0x5c96('0x1'));var moment=require(_0x5c96('0x2'));var BPromise=require(_0x5c96('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5c96('0x4'));var db=require(_0x5c96('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x5c96('0x6'));var client=jayson[_0x5c96('0x7')][_0x5c96('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2fa554,_0x5f3c63,_0x2c5f08){return new BPromise(function(_0x144d26,_0x489a25){return client['request'](_0x2fa554,_0x2c5f08)[_0x5c96('0x9')](function(_0x15b93c){logger[_0x5c96('0xa')](_0x5c96('0xb'),_0x5f3c63,_0x5c96('0xc'));logger['debug']('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x5f3c63,'request\x20sent',JSON[_0x5c96('0xd')](_0x15b93c));if(_0x15b93c[_0x5c96('0xe')]){if(_0x15b93c[_0x5c96('0xe')][_0x5c96('0xf')]===0x1f4){logger[_0x5c96('0xe')](_0x5c96('0xb'),_0x5f3c63,_0x15b93c[_0x5c96('0xe')][_0x5c96('0x10')]);return _0x489a25(_0x15b93c[_0x5c96('0xe')]['message']);}logger['error'](_0x5c96('0xb'),_0x5f3c63,_0x15b93c[_0x5c96('0xe')][_0x5c96('0x10')]);return _0x144d26(_0x15b93c[_0x5c96('0xe')]['message']);}else{logger[_0x5c96('0xa')](_0x5c96('0xb'),_0x5f3c63,_0x5c96('0xc'));_0x144d26(_0x15b93c[_0x5c96('0x11')]['message']);}})[_0x5c96('0x12')](function(_0x34e2df){logger[_0x5c96('0xe')]('ServicenowAccount,\x20%s,\x20%s',_0x5f3c63,_0x34e2df);_0x489a25(_0x34e2df);});});}exports['GetServicenowAccount']=function(_0x3672db){var _0x9206d8=this;return new Promise(function(_0x5d991a,_0x569baa){return db[_0x5c96('0x13')][_0x5c96('0x14')]({'raw':_0x3672db[_0x5c96('0x15')]?_0x3672db['options'][_0x5c96('0x16')]===undefined?!![]:![]:!![],'where':_0x3672db[_0x5c96('0x15')]?_0x3672db['options'][_0x5c96('0x17')]||null:null,'attributes':_0x3672db['options']?_0x3672db[_0x5c96('0x15')]['attributes']||null:null,'limit':_0x3672db[_0x5c96('0x15')]?_0x3672db[_0x5c96('0x15')][_0x5c96('0x18')]||null:null,'include':_0x3672db[_0x5c96('0x15')]?_0x3672db[_0x5c96('0x15')]['include']?_[_0x5c96('0x19')](_0x3672db[_0x5c96('0x15')][_0x5c96('0x1a')],function(_0x1c7f92){return{'model':db[_0x1c7f92[_0x5c96('0x1b')]],'as':_0x1c7f92['as'],'attributes':_0x1c7f92[_0x5c96('0x1c')],'include':_0x1c7f92[_0x5c96('0x1a')]?_[_0x5c96('0x19')](_0x1c7f92[_0x5c96('0x1a')],function(_0x1ab0eb){return{'model':db[_0x1ab0eb[_0x5c96('0x1b')]],'as':_0x1ab0eb['as'],'attributes':_0x1ab0eb[_0x5c96('0x1c')],'include':_0x1ab0eb[_0x5c96('0x1a')]?_['map'](_0x1ab0eb[_0x5c96('0x1a')],function(_0x3091c7){return{'model':db[_0x3091c7[_0x5c96('0x1b')]],'as':_0x3091c7['as'],'attributes':_0x3091c7[_0x5c96('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x5c96('0x9')](function(_0x1aebed){logger[_0x5c96('0xa')](_0x5c96('0x1d'),_0x3672db);logger[_0x5c96('0x1e')](_0x5c96('0x1d'),_0x3672db,JSON['stringify'](_0x1aebed));_0x5d991a(_0x1aebed);})[_0x5c96('0x12')](function(_0x18f68e){logger[_0x5c96('0xe')](_0x5c96('0x1d'),_0x18f68e['message'],_0x3672db);_0x569baa(_0x9206d8[_0x5c96('0xe')](0x1f4,_0x18f68e[_0x5c96('0x10')]));});});};exports['ShowServicenowAccount']=function(_0x5e678f){var _0x5b12b7=this;return new Promise(function(_0x428eac,_0x4a7c50){return db[_0x5c96('0x13')][_0x5c96('0x1f')]({'raw':_0x5e678f[_0x5c96('0x15')]?_0x5e678f[_0x5c96('0x15')][_0x5c96('0x16')]===undefined?!![]:![]:!![],'where':_0x5e678f[_0x5c96('0x15')]?_0x5e678f['options'][_0x5c96('0x17')]||null:null,'attributes':_0x5e678f[_0x5c96('0x15')]?_0x5e678f[_0x5c96('0x15')]['attributes']||null:null,'include':_0x5e678f['options']?_0x5e678f['options'][_0x5c96('0x1a')]?_['map'](_0x5e678f[_0x5c96('0x15')][_0x5c96('0x1a')],function(_0x3b8017){return{'model':db[_0x3b8017[_0x5c96('0x1b')]],'as':_0x3b8017['as'],'attributes':_0x3b8017['attributes'],'include':_0x3b8017[_0x5c96('0x1a')]?_[_0x5c96('0x19')](_0x3b8017[_0x5c96('0x1a')],function(_0x36b889){return{'model':db[_0x36b889[_0x5c96('0x1b')]],'as':_0x36b889['as'],'attributes':_0x36b889[_0x5c96('0x1c')],'include':_0x36b889[_0x5c96('0x1a')]?_[_0x5c96('0x19')](_0x36b889[_0x5c96('0x1a')],function(_0x475d1c){return{'model':db[_0x475d1c[_0x5c96('0x1b')]],'as':_0x475d1c['as'],'attributes':_0x475d1c[_0x5c96('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x5c96('0x9')](function(_0x537abb){logger['info'](_0x5c96('0x20'),_0x5e678f);logger[_0x5c96('0x1e')](_0x5c96('0x20'),_0x5e678f,JSON['stringify'](_0x537abb));_0x428eac(_0x537abb);})[_0x5c96('0x12')](function(_0x144b94){logger[_0x5c96('0xe')](_0x5c96('0x20'),_0x144b94['message'],_0x5e678f);_0x4a7c50(_0x5b12b7[_0x5c96('0xe')](0x1f4,_0x144b94[_0x5c96('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 35d75ba..20c965a 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 _0xd0a7=['Router','fs-extra','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','index','/:id','isAuthenticated','get','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x2bf678,_0x2670f0){var _0x4d98a9=function(_0x505a13){while(--_0x505a13){_0x2bf678['push'](_0x2bf678['shift']());}};_0x4d98a9(++_0x2670f0);}(_0xd0a7,0xc5));var _0x7d0a=function(_0x55ba55,_0x958914){_0x55ba55=_0x55ba55-0x0;var _0x40e853=_0xd0a7[_0x55ba55];return _0x40e853;};'use strict';var multer=require('multer');var util=require(_0x7d0a('0x0'));var path=require(_0x7d0a('0x1'));var timeout=require(_0x7d0a('0x2'));var express=require('express');var router=express[_0x7d0a('0x3')]();var fs_extra=require(_0x7d0a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7d0a('0x5'));var config=require(_0x7d0a('0x6'));var controller=require(_0x7d0a('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x7d0a('0x8')]);router['get'](_0x7d0a('0x9'),auth[_0x7d0a('0xa')](),controller['show']);router[_0x7d0a('0xb')](_0x7d0a('0xc'),auth[_0x7d0a('0xa')](),controller[_0x7d0a('0xd')]);router[_0x7d0a('0xb')](_0x7d0a('0xe'),auth[_0x7d0a('0xa')](),controller[_0x7d0a('0xf')]);router[_0x7d0a('0xb')](_0x7d0a('0x10'),auth[_0x7d0a('0xa')](),controller[_0x7d0a('0x11')]);router[_0x7d0a('0x12')]('/',auth[_0x7d0a('0xa')](),controller[_0x7d0a('0x13')]);router[_0x7d0a('0x14')](_0x7d0a('0x9'),auth['isAuthenticated'](),controller[_0x7d0a('0x15')]);router[_0x7d0a('0x16')](_0x7d0a('0x9'),auth[_0x7d0a('0xa')](),controller[_0x7d0a('0x17')]);module[_0x7d0a('0x18')]=router; \ No newline at end of file +var _0xc813=['multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','update','delete','destroy','exports'];(function(_0x17045c,_0x470ebe){var _0x844ac5=function(_0x1ce250){while(--_0x1ce250){_0x17045c['push'](_0x17045c['shift']());}};_0x844ac5(++_0x470ebe);}(_0xc813,0x8a));var _0x3c81=function(_0x5bb710,_0x2f29f4){_0x5bb710=_0x5bb710-0x0;var _0x40ed91=_0xc813[_0x5bb710];return _0x40ed91;};'use strict';var multer=require(_0x3c81('0x0'));var util=require('util');var path=require(_0x3c81('0x1'));var timeout=require(_0x3c81('0x2'));var express=require(_0x3c81('0x3'));var router=express['Router']();var fs_extra=require(_0x3c81('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3c81('0x5'));var config=require(_0x3c81('0x6'));var controller=require(_0x3c81('0x7'));router[_0x3c81('0x8')]('/',auth['isAuthenticated'](),controller[_0x3c81('0x9')]);router[_0x3c81('0x8')](_0x3c81('0xa'),auth[_0x3c81('0xb')](),controller[_0x3c81('0xc')]);router['get'](_0x3c81('0xd'),auth['isAuthenticated'](),controller[_0x3c81('0xe')]);router[_0x3c81('0x8')](_0x3c81('0xf'),auth['isAuthenticated'](),controller[_0x3c81('0x10')]);router[_0x3c81('0x8')](_0x3c81('0x11'),auth[_0x3c81('0xb')](),controller[_0x3c81('0x12')]);router['post']('/',auth[_0x3c81('0xb')](),controller['create']);router['put']('/:id',auth[_0x3c81('0xb')](),controller[_0x3c81('0x13')]);router[_0x3c81('0x14')]('/:id',auth[_0x3c81('0xb')](),controller[_0x3c81('0x15')]);module[_0x3c81('0x16')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 45badea..9d8bc04 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 _0xe3ec=['exports','STRING','sequelize'];(function(_0x53139c,_0x2d8206){var _0x433c84=function(_0x17bcc0){while(--_0x17bcc0){_0x53139c['push'](_0x53139c['shift']());}};_0x433c84(++_0x2d8206);}(_0xe3ec,0x149));var _0xce3e=function(_0x543fa7,_0x466240){_0x543fa7=_0x543fa7-0x0;var _0x50bb05=_0xe3ec[_0x543fa7];return _0x50bb05;};'use strict';var Sequelize=require(_0xce3e('0x0'));module[_0xce3e('0x1')]={'name':{'type':Sequelize[_0xce3e('0x2')]},'description':{'type':Sequelize[_0xce3e('0x2')]}}; \ No newline at end of file +var _0xbf2a=['exports','STRING','sequelize'];(function(_0x48dbcd,_0x536c97){var _0x3ec7f3=function(_0x15b94a){while(--_0x15b94a){_0x48dbcd['push'](_0x48dbcd['shift']());}};_0x3ec7f3(++_0x536c97);}(_0xbf2a,0x134));var _0xabf2=function(_0x9ace37,_0x4d1159){_0x9ace37=_0x9ace37-0x0;var _0x23ecc0=_0xbf2a[_0x9ace37];return _0x23ecc0;};'use strict';var Sequelize=require(_0xabf2('0x0'));module[_0xabf2('0x1')]={'name':{'type':Sequelize[_0xabf2('0x2')]},'description':{'type':Sequelize[_0xabf2('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 952df71..9ca128a 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 _0xb368=['hasOwnProperty','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','find','catch','create','body','params','getFields','findOne','nolimit','getSubjects','ServicenowField','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length'];(function(_0x44cf9c,_0x393610){var _0x2997ae=function(_0x1e826f){while(--_0x1e826f){_0x44cf9c['push'](_0x44cf9c['shift']());}};_0x2997ae(++_0x393610);}(_0xb368,0x68));var _0x8b36=function(_0x59a6e6,_0x32addd){_0x59a6e6=_0x59a6e6-0x0;var _0x8b5310=_0xb368[_0x59a6e6];return _0x8b5310;};'use strict';var emlformat=require(_0x8b36('0x0'));var rimraf=require(_0x8b36('0x1'));var zipdir=require(_0x8b36('0x2'));var jsonpatch=require(_0x8b36('0x3'));var rp=require(_0x8b36('0x4'));var moment=require(_0x8b36('0x5'));var BPromise=require(_0x8b36('0x6'));var Mustache=require(_0x8b36('0x7'));var util=require(_0x8b36('0x8'));var path=require(_0x8b36('0x9'));var sox=require('sox');var csv=require(_0x8b36('0xa'));var ejs=require(_0x8b36('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8b36('0xc'));var crypto=require('crypto');var jsforce=require(_0x8b36('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x8b36('0xa'));var querystring=require(_0x8b36('0xe'));var Papa=require(_0x8b36('0xf'));var Redis=require('ioredis');var authService=require(_0x8b36('0x10'));var qs=require(_0x8b36('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8b36('0x12'))(_0x8b36('0x13'));var utils=require(_0x8b36('0x14'));var config=require(_0x8b36('0x15'));var licenseUtil=require(_0x8b36('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5ef596,_0x583785){_0x583785=_0x583785||0xcc;return function(_0xb1b00c){if(_0xb1b00c){return _0x5ef596[_0x8b36('0x17')](_0x583785);}return _0x5ef596[_0x8b36('0x18')](_0x583785)[_0x8b36('0x19')]();};}function respondWithResult(_0x11e0d7,_0x39f4be){_0x39f4be=_0x39f4be||0xc8;return function(_0x8c9ce0){if(_0x8c9ce0){return _0x11e0d7[_0x8b36('0x18')](_0x39f4be)[_0x8b36('0x1a')](_0x8c9ce0);}};}function respondWithFilteredResult(_0x36e515,_0xf2bd38){return function(_0x470cbb){if(_0x470cbb){var _0x46f5d2=typeof _0xf2bd38['offset']===_0x8b36('0x1b')&&typeof _0xf2bd38[_0x8b36('0x1c')]===_0x8b36('0x1b');var _0x4d7154=_0x470cbb[_0x8b36('0x1d')];var _0x37805f=_0x46f5d2?0x0:_0xf2bd38[_0x8b36('0x1e')];var _0x2759c3=_0x46f5d2?_0x470cbb[_0x8b36('0x1d')]:_0xf2bd38[_0x8b36('0x1e')]+_0xf2bd38[_0x8b36('0x1c')];var _0x547260;if(_0x2759c3>=_0x4d7154){_0x2759c3=_0x4d7154;_0x547260=0xc8;}else{_0x547260=0xce;}_0x36e515[_0x8b36('0x18')](_0x547260);return _0x36e515[_0x8b36('0x1f')](_0x8b36('0x20'),_0x37805f+'-'+_0x2759c3+'/'+_0x4d7154)[_0x8b36('0x1a')](_0x470cbb);}return null;};}function patchUpdates(_0xf8b2fe){return function(_0xf8b906){try{jsonpatch[_0x8b36('0x21')](_0xf8b906,_0xf8b2fe,!![]);}catch(_0x3e3852){return BPromise[_0x8b36('0x22')](_0x3e3852);}return _0xf8b906['save']();};}function saveUpdates(_0x302271,_0x46d39a){return function(_0x59a543){if(_0x59a543){return _0x59a543[_0x8b36('0x23')](_0x302271)[_0x8b36('0x24')](function(_0x28b111){return _0x28b111;});}return null;};}function removeEntity(_0x159e18,_0x2c1a96){return function(_0x2d3ab5){if(_0x2d3ab5){return _0x2d3ab5[_0x8b36('0x25')]()[_0x8b36('0x24')](function(){_0x159e18['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x26926d,_0x2c9cf4){return function(_0x17be9d){if(!_0x17be9d){_0x26926d['sendStatus'](0x194);}return _0x17be9d;};}function handleError(_0x500682,_0x16ad4c){_0x16ad4c=_0x16ad4c||0x1f4;return function(_0x3952ad){logger[_0x8b36('0x26')](_0x3952ad[_0x8b36('0x27')]);if(_0x3952ad[_0x8b36('0x28')]){delete _0x3952ad[_0x8b36('0x28')];}_0x500682[_0x8b36('0x18')](_0x16ad4c)[_0x8b36('0x29')](_0x3952ad);};}exports[_0x8b36('0x2a')]=function(_0xdebb78,_0x5920b0){var _0x1bca58={},_0x4c6f70={},_0x3426cc={'count':0x0,'rows':[]};var _0x30f388=_['map'](db[_0x8b36('0x2b')][_0x8b36('0x2c')],function(_0x4b403c){return{'name':_0x4b403c[_0x8b36('0x2d')],'type':_0x4b403c[_0x8b36('0x2e')][_0x8b36('0x2f')]};});_0x4c6f70[_0x8b36('0x30')]=_['map'](_0x30f388,_0x8b36('0x28'));_0x4c6f70['query']=_[_0x8b36('0x31')](_0xdebb78[_0x8b36('0x32')]);_0x4c6f70[_0x8b36('0x33')]=_[_0x8b36('0x34')](_0x4c6f70['model'],_0x4c6f70[_0x8b36('0x32')]);_0x1bca58[_0x8b36('0x35')]=_[_0x8b36('0x34')](_0x4c6f70['model'],qs['fields'](_0xdebb78[_0x8b36('0x32')][_0x8b36('0x36')]));_0x1bca58[_0x8b36('0x35')]=_0x1bca58[_0x8b36('0x35')][_0x8b36('0x37')]?_0x1bca58[_0x8b36('0x35')]:_0x4c6f70[_0x8b36('0x30')];if(!_0xdebb78[_0x8b36('0x32')][_0x8b36('0x38')]('nolimit')){_0x1bca58[_0x8b36('0x1c')]=qs[_0x8b36('0x1c')](_0xdebb78[_0x8b36('0x32')][_0x8b36('0x1c')]);_0x1bca58[_0x8b36('0x1e')]=qs[_0x8b36('0x1e')](_0xdebb78[_0x8b36('0x32')]['offset']);}_0x1bca58[_0x8b36('0x39')]=qs[_0x8b36('0x3a')](_0xdebb78[_0x8b36('0x32')]['sort']);_0x1bca58[_0x8b36('0x3b')]=qs[_0x8b36('0x33')](_[_0x8b36('0x3c')](_0xdebb78[_0x8b36('0x32')],_0x4c6f70[_0x8b36('0x33')]),_0x30f388);if(_0xdebb78['query'][_0x8b36('0x3d')]){_0x1bca58['where']=_[_0x8b36('0x3e')](_0x1bca58[_0x8b36('0x3b')],{'$or':_[_0x8b36('0x3f')](_0x30f388,function(_0x5953bc){if(_0x5953bc['type']!==_0x8b36('0x40')){var _0x5dd1e0={};_0x5dd1e0[_0x5953bc[_0x8b36('0x28')]]={'$like':'%'+_0xdebb78['query']['filter']+'%'};return _0x5dd1e0;}})});}_0x1bca58=_['merge']({},_0x1bca58,_0xdebb78[_0x8b36('0x41')]);var _0x5b3eab={'where':_0x1bca58[_0x8b36('0x3b')]};return db[_0x8b36('0x2b')]['count'](_0x5b3eab)[_0x8b36('0x24')](function(_0x34e9a7){_0x3426cc[_0x8b36('0x1d')]=_0x34e9a7;if(_0xdebb78[_0x8b36('0x32')][_0x8b36('0x42')]){_0x1bca58[_0x8b36('0x43')]=[{'all':!![]}];}return db['ServicenowConfiguration'][_0x8b36('0x44')](_0x1bca58);})[_0x8b36('0x24')](function(_0x45c23d){_0x3426cc['rows']=_0x45c23d;return _0x3426cc;})[_0x8b36('0x24')](respondWithFilteredResult(_0x5920b0,_0x1bca58))['catch'](handleError(_0x5920b0,null));};exports['show']=function(_0x499cd5,_0x5f5638){var _0x5039f0={'raw':![],'where':{'id':_0x499cd5['params']['id']}},_0x550d61={};_0x550d61[_0x8b36('0x30')]=_[_0x8b36('0x31')](db[_0x8b36('0x2b')][_0x8b36('0x2c')]);_0x550d61[_0x8b36('0x32')]=_[_0x8b36('0x31')](_0x499cd5['query']);_0x550d61[_0x8b36('0x33')]=_[_0x8b36('0x34')](_0x550d61[_0x8b36('0x30')],_0x550d61[_0x8b36('0x32')]);_0x5039f0[_0x8b36('0x35')]=_[_0x8b36('0x34')](_0x550d61[_0x8b36('0x30')],qs[_0x8b36('0x36')](_0x499cd5[_0x8b36('0x32')]['fields']));_0x5039f0[_0x8b36('0x35')]=_0x5039f0[_0x8b36('0x35')][_0x8b36('0x37')]?_0x5039f0[_0x8b36('0x35')]:_0x550d61[_0x8b36('0x30')];if(_0x499cd5[_0x8b36('0x32')]['includeAll']){_0x5039f0[_0x8b36('0x43')]=[{'all':!![]}];}_0x5039f0=_[_0x8b36('0x3e')]({},_0x5039f0,_0x499cd5[_0x8b36('0x41')]);return db[_0x8b36('0x2b')][_0x8b36('0x45')](_0x5039f0)[_0x8b36('0x24')](handleEntityNotFound(_0x5f5638,null))['then'](respondWithResult(_0x5f5638,null))[_0x8b36('0x46')](handleError(_0x5f5638,null));};exports[_0x8b36('0x47')]=function(_0x44af3e,_0x7d0380){return db[_0x8b36('0x2b')][_0x8b36('0x47')](_0x44af3e['body'],{})[_0x8b36('0x24')](respondWithResult(_0x7d0380,0xc9))[_0x8b36('0x46')](handleError(_0x7d0380,null));};exports['update']=function(_0x3859eb,_0x5ba2e8){if(_0x3859eb['body']['id']){delete _0x3859eb[_0x8b36('0x48')]['id'];}return db['ServicenowConfiguration'][_0x8b36('0x45')]({'where':{'id':_0x3859eb[_0x8b36('0x49')]['id']}})[_0x8b36('0x24')](handleEntityNotFound(_0x5ba2e8,null))[_0x8b36('0x24')](saveUpdates(_0x3859eb[_0x8b36('0x48')],null))[_0x8b36('0x24')](respondWithResult(_0x5ba2e8,null))[_0x8b36('0x46')](handleError(_0x5ba2e8,null));};exports[_0x8b36('0x25')]=function(_0x5b2c0f,_0x14b04c){return db[_0x8b36('0x2b')][_0x8b36('0x45')]({'where':{'id':_0x5b2c0f[_0x8b36('0x49')]['id']}})[_0x8b36('0x24')](handleEntityNotFound(_0x14b04c,null))[_0x8b36('0x24')](removeEntity(_0x14b04c,null))[_0x8b36('0x46')](handleError(_0x14b04c,null));};exports[_0x8b36('0x4a')]=function(_0x322ea1,_0x219a5d,_0x1ee30f){var _0x4cd7ba={};var _0x301097={};var _0x478c74;var _0x547e4a;return db['ServicenowConfiguration'][_0x8b36('0x4b')]({'where':{'id':_0x322ea1[_0x8b36('0x49')]['id']}})[_0x8b36('0x24')](handleEntityNotFound(_0x219a5d,null))[_0x8b36('0x24')](function(_0x2e327b){if(_0x2e327b){_0x478c74=_0x2e327b;_0x301097[_0x8b36('0x30')]=_['keys'](db['ServicenowField'][_0x8b36('0x2c')]);_0x301097[_0x8b36('0x32')]=_[_0x8b36('0x31')](_0x322ea1['query']);_0x301097[_0x8b36('0x33')]=_['intersection'](_0x301097[_0x8b36('0x30')],_0x301097['query']);_0x4cd7ba[_0x8b36('0x35')]=_[_0x8b36('0x34')](_0x301097['model'],qs['fields'](_0x322ea1[_0x8b36('0x32')][_0x8b36('0x36')]));_0x4cd7ba[_0x8b36('0x35')]=_0x4cd7ba['attributes'][_0x8b36('0x37')]?_0x4cd7ba[_0x8b36('0x35')]:_0x301097[_0x8b36('0x30')];_0x4cd7ba['order']=qs[_0x8b36('0x3a')](_0x322ea1[_0x8b36('0x32')]['sort']);_0x4cd7ba[_0x8b36('0x3b')]=qs[_0x8b36('0x33')](_[_0x8b36('0x3c')](_0x322ea1[_0x8b36('0x32')],_0x301097[_0x8b36('0x33')]));if(_0x322ea1[_0x8b36('0x32')][_0x8b36('0x3d')]){_0x4cd7ba['where']=_['merge'](_0x4cd7ba['where'],{'$or':_[_0x8b36('0x3f')](_0x4cd7ba[_0x8b36('0x35')],function(_0x15cffb){var _0x10ec33={};_0x10ec33[_0x15cffb]={'$like':'%'+_0x322ea1[_0x8b36('0x32')][_0x8b36('0x3d')]+'%'};return _0x10ec33;})});}_0x4cd7ba=_[_0x8b36('0x3e')]({},_0x4cd7ba,_0x322ea1[_0x8b36('0x41')]);return _0x478c74['getFields'](_0x4cd7ba);}})[_0x8b36('0x24')](function(_0x2193c2){if(_0x2193c2){_0x547e4a=_0x2193c2['length'];if(!_0x322ea1[_0x8b36('0x32')]['hasOwnProperty'](_0x8b36('0x4c'))){_0x4cd7ba[_0x8b36('0x1c')]=qs[_0x8b36('0x1c')](_0x322ea1[_0x8b36('0x32')][_0x8b36('0x1c')]);_0x4cd7ba[_0x8b36('0x1e')]=qs[_0x8b36('0x1e')](_0x322ea1['query']['offset']);}return _0x478c74['getFields'](_0x4cd7ba);}})[_0x8b36('0x24')](function(_0x4c2843){if(_0x4c2843){return _0x4c2843?{'count':_0x547e4a,'rows':_0x4c2843}:null;}})[_0x8b36('0x24')](respondWithResult(_0x219a5d,null))[_0x8b36('0x46')](handleError(_0x219a5d,null));};exports[_0x8b36('0x4d')]=function(_0x509e14,_0x22ded3,_0x24cb2d){var _0x4498de={};var _0x3e05f7={};var _0x2f1812;var _0xd589b4;return db[_0x8b36('0x2b')][_0x8b36('0x4b')]({'where':{'id':_0x509e14[_0x8b36('0x49')]['id']}})[_0x8b36('0x24')](handleEntityNotFound(_0x22ded3,null))['then'](function(_0x565d0e){if(_0x565d0e){_0x2f1812=_0x565d0e;_0x3e05f7[_0x8b36('0x30')]=_['keys'](db[_0x8b36('0x4e')][_0x8b36('0x2c')]);_0x3e05f7[_0x8b36('0x32')]=_[_0x8b36('0x31')](_0x509e14[_0x8b36('0x32')]);_0x3e05f7['filters']=_[_0x8b36('0x34')](_0x3e05f7[_0x8b36('0x30')],_0x3e05f7[_0x8b36('0x32')]);_0x4498de[_0x8b36('0x35')]=_[_0x8b36('0x34')](_0x3e05f7[_0x8b36('0x30')],qs['fields'](_0x509e14[_0x8b36('0x32')][_0x8b36('0x36')]));_0x4498de[_0x8b36('0x35')]=_0x4498de['attributes'][_0x8b36('0x37')]?_0x4498de[_0x8b36('0x35')]:_0x3e05f7[_0x8b36('0x30')];_0x4498de[_0x8b36('0x39')]=qs[_0x8b36('0x3a')](_0x509e14[_0x8b36('0x32')]['sort']);_0x4498de[_0x8b36('0x3b')]=qs[_0x8b36('0x33')](_[_0x8b36('0x3c')](_0x509e14[_0x8b36('0x32')],_0x3e05f7[_0x8b36('0x33')]));if(_0x509e14[_0x8b36('0x32')]['filter']){_0x4498de[_0x8b36('0x3b')]=_[_0x8b36('0x3e')](_0x4498de[_0x8b36('0x3b')],{'$or':_['map'](_0x4498de['attributes'],function(_0x173436){var _0x2bb62c={};_0x2bb62c[_0x173436]={'$like':'%'+_0x509e14['query'][_0x8b36('0x3d')]+'%'};return _0x2bb62c;})});}_0x4498de=_[_0x8b36('0x3e')]({},_0x4498de,_0x509e14['options']);return _0x2f1812[_0x8b36('0x4d')](_0x4498de);}})[_0x8b36('0x24')](function(_0x6c575c){if(_0x6c575c){_0xd589b4=_0x6c575c['length'];if(!_0x509e14[_0x8b36('0x32')][_0x8b36('0x38')]('nolimit')){_0x4498de['limit']=qs[_0x8b36('0x1c')](_0x509e14[_0x8b36('0x32')][_0x8b36('0x1c')]);_0x4498de[_0x8b36('0x1e')]=qs['offset'](_0x509e14['query']['offset']);}return _0x2f1812[_0x8b36('0x4d')](_0x4498de);}})['then'](function(_0x4231d5){if(_0x4231d5){return _0x4231d5?{'count':_0xd589b4,'rows':_0x4231d5}:null;}})[_0x8b36('0x24')](respondWithResult(_0x22ded3,null))['catch'](handleError(_0x22ded3,null));};exports[_0x8b36('0x4f')]=function(_0xbce155,_0x1807e3,_0x5f51a2){var _0xb872e={};var _0x42dc97={};var _0x15522e;var _0x185848;return db[_0x8b36('0x2b')][_0x8b36('0x4b')]({'where':{'id':_0xbce155[_0x8b36('0x49')]['id']}})[_0x8b36('0x24')](handleEntityNotFound(_0x1807e3,null))[_0x8b36('0x24')](function(_0xb22d42){if(_0xb22d42){_0x15522e=_0xb22d42;_0x42dc97[_0x8b36('0x30')]=_['keys'](db[_0x8b36('0x4e')][_0x8b36('0x2c')]);_0x42dc97[_0x8b36('0x32')]=_[_0x8b36('0x31')](_0xbce155[_0x8b36('0x32')]);_0x42dc97[_0x8b36('0x33')]=_[_0x8b36('0x34')](_0x42dc97[_0x8b36('0x30')],_0x42dc97[_0x8b36('0x32')]);_0xb872e[_0x8b36('0x35')]=_[_0x8b36('0x34')](_0x42dc97[_0x8b36('0x30')],qs[_0x8b36('0x36')](_0xbce155[_0x8b36('0x32')][_0x8b36('0x36')]));_0xb872e[_0x8b36('0x35')]=_0xb872e[_0x8b36('0x35')]['length']?_0xb872e[_0x8b36('0x35')]:_0x42dc97['model'];_0xb872e[_0x8b36('0x39')]=qs[_0x8b36('0x3a')](_0xbce155[_0x8b36('0x32')]['sort']);_0xb872e[_0x8b36('0x3b')]=qs['filters'](_[_0x8b36('0x3c')](_0xbce155[_0x8b36('0x32')],_0x42dc97[_0x8b36('0x33')]));if(_0xbce155[_0x8b36('0x32')][_0x8b36('0x3d')]){_0xb872e['where']=_[_0x8b36('0x3e')](_0xb872e[_0x8b36('0x3b')],{'$or':_['map'](_0xb872e[_0x8b36('0x35')],function(_0x569849){var _0x283908={};_0x283908[_0x569849]={'$like':'%'+_0xbce155[_0x8b36('0x32')][_0x8b36('0x3d')]+'%'};return _0x283908;})});}_0xb872e=_['merge']({},_0xb872e,_0xbce155[_0x8b36('0x41')]);return _0x15522e[_0x8b36('0x4f')](_0xb872e);}})[_0x8b36('0x24')](function(_0xc8f06e){if(_0xc8f06e){_0x185848=_0xc8f06e[_0x8b36('0x37')];if(!_0xbce155[_0x8b36('0x32')][_0x8b36('0x38')](_0x8b36('0x4c'))){_0xb872e[_0x8b36('0x1c')]=qs[_0x8b36('0x1c')](_0xbce155['query']['limit']);_0xb872e['offset']=qs['offset'](_0xbce155[_0x8b36('0x32')][_0x8b36('0x1e')]);}return _0x15522e[_0x8b36('0x4f')](_0xb872e);}})[_0x8b36('0x24')](function(_0x25754e){if(_0x25754e){return _0x25754e?{'count':_0x185848,'rows':_0x25754e}:null;}})['then'](respondWithResult(_0x1807e3,null))[_0x8b36('0x46')](handleError(_0x1807e3,null));}; \ No newline at end of file +var _0xc70f=['stack','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','name','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','limit','pick','merge','where','VIRTUAL','filter','includeAll','include','rows','catch','show','params','options','body','find','destroy','getFields','findOne','ServicenowField','order','sort','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','lodash','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','reject','then','error'];(function(_0x4bf96c,_0x4d24fd){var _0x281d09=function(_0x56538e){while(--_0x56538e){_0x4bf96c['push'](_0x4bf96c['shift']());}};_0x281d09(++_0x4d24fd);}(_0xc70f,0x112));var _0xfc70=function(_0x51d30a,_0x157328){_0x51d30a=_0x51d30a-0x0;var _0x43b92f=_0xc70f[_0x51d30a];return _0x43b92f;};'use strict';var emlformat=require(_0xfc70('0x0'));var rimraf=require(_0xfc70('0x1'));var zipdir=require(_0xfc70('0x2'));var jsonpatch=require(_0xfc70('0x3'));var rp=require('request-promise');var moment=require(_0xfc70('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xfc70('0x5'));var util=require(_0xfc70('0x6'));var path=require(_0xfc70('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfc70('0x8'));var squel=require('squel');var crypto=require(_0xfc70('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xfc70('0xa'));var toCsv=require(_0xfc70('0xb'));var querystring=require('querystring');var Papa=require(_0xfc70('0xc'));var Redis=require(_0xfc70('0xd'));var authService=require(_0xfc70('0xe'));var qs=require(_0xfc70('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfc70('0x10'));var logger=require(_0xfc70('0x11'))(_0xfc70('0x12'));var utils=require(_0xfc70('0x13'));var config=require(_0xfc70('0x14'));var licenseUtil=require(_0xfc70('0x15'));var db=require(_0xfc70('0x16'))['db'];function respondWithStatusCode(_0x51cc27,_0x3cb11c){_0x3cb11c=_0x3cb11c||0xcc;return function(_0x5bac34){if(_0x5bac34){return _0x51cc27[_0xfc70('0x17')](_0x3cb11c);}return _0x51cc27[_0xfc70('0x18')](_0x3cb11c)[_0xfc70('0x19')]();};}function respondWithResult(_0x246766,_0x81149b){_0x81149b=_0x81149b||0xc8;return function(_0x501be5){if(_0x501be5){return _0x246766[_0xfc70('0x18')](_0x81149b)[_0xfc70('0x1a')](_0x501be5);}};}function respondWithFilteredResult(_0x19a79e,_0x12c646){return function(_0x409868){if(_0x409868){var _0x120be0=typeof _0x12c646[_0xfc70('0x1b')]===_0xfc70('0x1c')&&typeof _0x12c646['limit']===_0xfc70('0x1c');var _0x375ef4=_0x409868[_0xfc70('0x1d')];var _0x1a191f=_0x120be0?0x0:_0x12c646['offset'];var _0x5259f0=_0x120be0?_0x409868[_0xfc70('0x1d')]:_0x12c646['offset']+_0x12c646['limit'];var _0x58d108;if(_0x5259f0>=_0x375ef4){_0x5259f0=_0x375ef4;_0x58d108=0xc8;}else{_0x58d108=0xce;}_0x19a79e[_0xfc70('0x18')](_0x58d108);return _0x19a79e[_0xfc70('0x1e')]('Content-Range',_0x1a191f+'-'+_0x5259f0+'/'+_0x375ef4)[_0xfc70('0x1a')](_0x409868);}return null;};}function patchUpdates(_0x3e04ba){return function(_0x5037d3){try{jsonpatch['apply'](_0x5037d3,_0x3e04ba,!![]);}catch(_0x527588){return BPromise[_0xfc70('0x1f')](_0x527588);}return _0x5037d3['save']();};}function saveUpdates(_0x348f0b,_0x3ff0ef){return function(_0x5aa4a9){if(_0x5aa4a9){return _0x5aa4a9['update'](_0x348f0b)[_0xfc70('0x20')](function(_0x40ef26){return _0x40ef26;});}return null;};}function removeEntity(_0x394f4b,_0x19acfd){return function(_0x301abd){if(_0x301abd){return _0x301abd['destroy']()[_0xfc70('0x20')](function(){_0x394f4b[_0xfc70('0x18')](0xcc)[_0xfc70('0x19')]();});}};}function handleEntityNotFound(_0x3895ac,_0x856b5b){return function(_0x4dbfa9){if(!_0x4dbfa9){_0x3895ac['sendStatus'](0x194);}return _0x4dbfa9;};}function handleError(_0x10d13e,_0xff9665){_0xff9665=_0xff9665||0x1f4;return function(_0x9e7199){logger[_0xfc70('0x21')](_0x9e7199[_0xfc70('0x22')]);if(_0x9e7199['name']){delete _0x9e7199['name'];}_0x10d13e['status'](_0xff9665)[_0xfc70('0x23')](_0x9e7199);};}exports[_0xfc70('0x24')]=function(_0x59b651,_0x8036ad){var _0x15e13c={},_0x3ffe50={},_0x9eb82c={'count':0x0,'rows':[]};var _0xe48afc=_[_0xfc70('0x25')](db[_0xfc70('0x26')][_0xfc70('0x27')],function(_0x34627b){return{'name':_0x34627b[_0xfc70('0x28')],'type':_0x34627b[_0xfc70('0x29')][_0xfc70('0x2a')]};});_0x3ffe50[_0xfc70('0x2b')]=_[_0xfc70('0x25')](_0xe48afc,_0xfc70('0x2c'));_0x3ffe50['query']=_[_0xfc70('0x2d')](_0x59b651['query']);_0x3ffe50[_0xfc70('0x2e')]=_[_0xfc70('0x2f')](_0x3ffe50[_0xfc70('0x2b')],_0x3ffe50[_0xfc70('0x30')]);_0x15e13c[_0xfc70('0x31')]=_[_0xfc70('0x2f')](_0x3ffe50[_0xfc70('0x2b')],qs[_0xfc70('0x32')](_0x59b651[_0xfc70('0x30')][_0xfc70('0x32')]));_0x15e13c[_0xfc70('0x31')]=_0x15e13c[_0xfc70('0x31')][_0xfc70('0x33')]?_0x15e13c[_0xfc70('0x31')]:_0x3ffe50[_0xfc70('0x2b')];if(!_0x59b651[_0xfc70('0x30')][_0xfc70('0x34')](_0xfc70('0x35'))){_0x15e13c[_0xfc70('0x36')]=qs['limit'](_0x59b651[_0xfc70('0x30')][_0xfc70('0x36')]);_0x15e13c[_0xfc70('0x1b')]=qs[_0xfc70('0x1b')](_0x59b651['query'][_0xfc70('0x1b')]);}_0x15e13c['order']=qs['sort'](_0x59b651[_0xfc70('0x30')]['sort']);_0x15e13c['where']=qs[_0xfc70('0x2e')](_[_0xfc70('0x37')](_0x59b651[_0xfc70('0x30')],_0x3ffe50[_0xfc70('0x2e')]),_0xe48afc);if(_0x59b651[_0xfc70('0x30')]['filter']){_0x15e13c['where']=_[_0xfc70('0x38')](_0x15e13c[_0xfc70('0x39')],{'$or':_[_0xfc70('0x25')](_0xe48afc,function(_0x388544){if(_0x388544[_0xfc70('0x29')]!==_0xfc70('0x3a')){var _0xbfa17e={};_0xbfa17e[_0x388544[_0xfc70('0x2c')]]={'$like':'%'+_0x59b651['query'][_0xfc70('0x3b')]+'%'};return _0xbfa17e;}})});}_0x15e13c=_[_0xfc70('0x38')]({},_0x15e13c,_0x59b651['options']);var _0x50c9d2={'where':_0x15e13c[_0xfc70('0x39')]};return db[_0xfc70('0x26')][_0xfc70('0x1d')](_0x50c9d2)[_0xfc70('0x20')](function(_0x4101c3){_0x9eb82c['count']=_0x4101c3;if(_0x59b651[_0xfc70('0x30')][_0xfc70('0x3c')]){_0x15e13c[_0xfc70('0x3d')]=[{'all':!![]}];}return db[_0xfc70('0x26')]['findAll'](_0x15e13c);})[_0xfc70('0x20')](function(_0x42a4d5){_0x9eb82c[_0xfc70('0x3e')]=_0x42a4d5;return _0x9eb82c;})['then'](respondWithFilteredResult(_0x8036ad,_0x15e13c))[_0xfc70('0x3f')](handleError(_0x8036ad,null));};exports[_0xfc70('0x40')]=function(_0x3089cc,_0x419439){var _0x4505df={'raw':![],'where':{'id':_0x3089cc[_0xfc70('0x41')]['id']}},_0x5e84fd={};_0x5e84fd[_0xfc70('0x2b')]=_['keys'](db[_0xfc70('0x26')][_0xfc70('0x27')]);_0x5e84fd[_0xfc70('0x30')]=_[_0xfc70('0x2d')](_0x3089cc['query']);_0x5e84fd[_0xfc70('0x2e')]=_[_0xfc70('0x2f')](_0x5e84fd['model'],_0x5e84fd[_0xfc70('0x30')]);_0x4505df[_0xfc70('0x31')]=_['intersection'](_0x5e84fd[_0xfc70('0x2b')],qs['fields'](_0x3089cc['query']['fields']));_0x4505df[_0xfc70('0x31')]=_0x4505df[_0xfc70('0x31')][_0xfc70('0x33')]?_0x4505df[_0xfc70('0x31')]:_0x5e84fd['model'];if(_0x3089cc[_0xfc70('0x30')][_0xfc70('0x3c')]){_0x4505df[_0xfc70('0x3d')]=[{'all':!![]}];}_0x4505df=_['merge']({},_0x4505df,_0x3089cc[_0xfc70('0x42')]);return db[_0xfc70('0x26')]['find'](_0x4505df)[_0xfc70('0x20')](handleEntityNotFound(_0x419439,null))[_0xfc70('0x20')](respondWithResult(_0x419439,null))[_0xfc70('0x3f')](handleError(_0x419439,null));};exports['create']=function(_0x1e0688,_0x4318b9){return db[_0xfc70('0x26')]['create'](_0x1e0688[_0xfc70('0x43')],{})['then'](respondWithResult(_0x4318b9,0xc9))['catch'](handleError(_0x4318b9,null));};exports['update']=function(_0x47c8ba,_0x42d78c){if(_0x47c8ba[_0xfc70('0x43')]['id']){delete _0x47c8ba[_0xfc70('0x43')]['id'];}return db[_0xfc70('0x26')][_0xfc70('0x44')]({'where':{'id':_0x47c8ba[_0xfc70('0x41')]['id']}})[_0xfc70('0x20')](handleEntityNotFound(_0x42d78c,null))['then'](saveUpdates(_0x47c8ba['body'],null))[_0xfc70('0x20')](respondWithResult(_0x42d78c,null))[_0xfc70('0x3f')](handleError(_0x42d78c,null));};exports[_0xfc70('0x45')]=function(_0x376cae,_0x3fd682){return db['ServicenowConfiguration']['find']({'where':{'id':_0x376cae['params']['id']}})[_0xfc70('0x20')](handleEntityNotFound(_0x3fd682,null))[_0xfc70('0x20')](removeEntity(_0x3fd682,null))[_0xfc70('0x3f')](handleError(_0x3fd682,null));};exports[_0xfc70('0x46')]=function(_0xda6b,_0x455da0,_0xca2ef){var _0x1e9ec7={};var _0x244734={};var _0x8c517a;var _0x2a018f;return db[_0xfc70('0x26')][_0xfc70('0x47')]({'where':{'id':_0xda6b[_0xfc70('0x41')]['id']}})[_0xfc70('0x20')](handleEntityNotFound(_0x455da0,null))[_0xfc70('0x20')](function(_0x4c5eea){if(_0x4c5eea){_0x8c517a=_0x4c5eea;_0x244734['model']=_[_0xfc70('0x2d')](db[_0xfc70('0x48')][_0xfc70('0x27')]);_0x244734[_0xfc70('0x30')]=_[_0xfc70('0x2d')](_0xda6b['query']);_0x244734['filters']=_[_0xfc70('0x2f')](_0x244734[_0xfc70('0x2b')],_0x244734[_0xfc70('0x30')]);_0x1e9ec7['attributes']=_[_0xfc70('0x2f')](_0x244734[_0xfc70('0x2b')],qs[_0xfc70('0x32')](_0xda6b[_0xfc70('0x30')][_0xfc70('0x32')]));_0x1e9ec7[_0xfc70('0x31')]=_0x1e9ec7[_0xfc70('0x31')][_0xfc70('0x33')]?_0x1e9ec7[_0xfc70('0x31')]:_0x244734['model'];_0x1e9ec7[_0xfc70('0x49')]=qs['sort'](_0xda6b[_0xfc70('0x30')][_0xfc70('0x4a')]);_0x1e9ec7['where']=qs[_0xfc70('0x2e')](_[_0xfc70('0x37')](_0xda6b[_0xfc70('0x30')],_0x244734[_0xfc70('0x2e')]));if(_0xda6b[_0xfc70('0x30')][_0xfc70('0x3b')]){_0x1e9ec7[_0xfc70('0x39')]=_[_0xfc70('0x38')](_0x1e9ec7[_0xfc70('0x39')],{'$or':_[_0xfc70('0x25')](_0x1e9ec7[_0xfc70('0x31')],function(_0x598cec){var _0xafcee8={};_0xafcee8[_0x598cec]={'$like':'%'+_0xda6b['query'][_0xfc70('0x3b')]+'%'};return _0xafcee8;})});}_0x1e9ec7=_[_0xfc70('0x38')]({},_0x1e9ec7,_0xda6b['options']);return _0x8c517a[_0xfc70('0x46')](_0x1e9ec7);}})[_0xfc70('0x20')](function(_0x639bdd){if(_0x639bdd){_0x2a018f=_0x639bdd[_0xfc70('0x33')];if(!_0xda6b[_0xfc70('0x30')][_0xfc70('0x34')](_0xfc70('0x35'))){_0x1e9ec7[_0xfc70('0x36')]=qs[_0xfc70('0x36')](_0xda6b[_0xfc70('0x30')][_0xfc70('0x36')]);_0x1e9ec7['offset']=qs[_0xfc70('0x1b')](_0xda6b[_0xfc70('0x30')][_0xfc70('0x1b')]);}return _0x8c517a['getFields'](_0x1e9ec7);}})['then'](function(_0x3bd9de){if(_0x3bd9de){return _0x3bd9de?{'count':_0x2a018f,'rows':_0x3bd9de}:null;}})[_0xfc70('0x20')](respondWithResult(_0x455da0,null))[_0xfc70('0x3f')](handleError(_0x455da0,null));};exports['getSubjects']=function(_0x787af9,_0xd78160,_0x337ede){var _0x131ee3={};var _0x367d53={};var _0x468a45;var _0x3649f2;return db[_0xfc70('0x26')][_0xfc70('0x47')]({'where':{'id':_0x787af9[_0xfc70('0x41')]['id']}})[_0xfc70('0x20')](handleEntityNotFound(_0xd78160,null))[_0xfc70('0x20')](function(_0x511e79){if(_0x511e79){_0x468a45=_0x511e79;_0x367d53['model']=_[_0xfc70('0x2d')](db[_0xfc70('0x48')][_0xfc70('0x27')]);_0x367d53[_0xfc70('0x30')]=_[_0xfc70('0x2d')](_0x787af9[_0xfc70('0x30')]);_0x367d53['filters']=_[_0xfc70('0x2f')](_0x367d53['model'],_0x367d53[_0xfc70('0x30')]);_0x131ee3[_0xfc70('0x31')]=_['intersection'](_0x367d53[_0xfc70('0x2b')],qs['fields'](_0x787af9[_0xfc70('0x30')][_0xfc70('0x32')]));_0x131ee3[_0xfc70('0x31')]=_0x131ee3[_0xfc70('0x31')][_0xfc70('0x33')]?_0x131ee3[_0xfc70('0x31')]:_0x367d53[_0xfc70('0x2b')];_0x131ee3['order']=qs[_0xfc70('0x4a')](_0x787af9[_0xfc70('0x30')][_0xfc70('0x4a')]);_0x131ee3[_0xfc70('0x39')]=qs['filters'](_[_0xfc70('0x37')](_0x787af9[_0xfc70('0x30')],_0x367d53['filters']));if(_0x787af9[_0xfc70('0x30')][_0xfc70('0x3b')]){_0x131ee3[_0xfc70('0x39')]=_[_0xfc70('0x38')](_0x131ee3[_0xfc70('0x39')],{'$or':_[_0xfc70('0x25')](_0x131ee3[_0xfc70('0x31')],function(_0x4ce6c0){var _0x87f3a5={};_0x87f3a5[_0x4ce6c0]={'$like':'%'+_0x787af9[_0xfc70('0x30')][_0xfc70('0x3b')]+'%'};return _0x87f3a5;})});}_0x131ee3=_['merge']({},_0x131ee3,_0x787af9[_0xfc70('0x42')]);return _0x468a45[_0xfc70('0x4b')](_0x131ee3);}})[_0xfc70('0x20')](function(_0x4054b3){if(_0x4054b3){_0x3649f2=_0x4054b3[_0xfc70('0x33')];if(!_0x787af9[_0xfc70('0x30')][_0xfc70('0x34')](_0xfc70('0x35'))){_0x131ee3[_0xfc70('0x36')]=qs[_0xfc70('0x36')](_0x787af9[_0xfc70('0x30')]['limit']);_0x131ee3[_0xfc70('0x1b')]=qs['offset'](_0x787af9[_0xfc70('0x30')][_0xfc70('0x1b')]);}return _0x468a45[_0xfc70('0x4b')](_0x131ee3);}})[_0xfc70('0x20')](function(_0x6a9f36){if(_0x6a9f36){return _0x6a9f36?{'count':_0x3649f2,'rows':_0x6a9f36}:null;}})[_0xfc70('0x20')](respondWithResult(_0xd78160,null))[_0xfc70('0x3f')](handleError(_0xd78160,null));};exports['getDescriptions']=function(_0x5938db,_0x1d5515,_0x2592fb){var _0x26251e={};var _0x461b37={};var _0x14326f;var _0x5ba4d;return db[_0xfc70('0x26')][_0xfc70('0x47')]({'where':{'id':_0x5938db[_0xfc70('0x41')]['id']}})[_0xfc70('0x20')](handleEntityNotFound(_0x1d5515,null))[_0xfc70('0x20')](function(_0x186bac){if(_0x186bac){_0x14326f=_0x186bac;_0x461b37[_0xfc70('0x2b')]=_[_0xfc70('0x2d')](db['ServicenowField'][_0xfc70('0x27')]);_0x461b37['query']=_[_0xfc70('0x2d')](_0x5938db['query']);_0x461b37[_0xfc70('0x2e')]=_['intersection'](_0x461b37[_0xfc70('0x2b')],_0x461b37[_0xfc70('0x30')]);_0x26251e[_0xfc70('0x31')]=_[_0xfc70('0x2f')](_0x461b37['model'],qs[_0xfc70('0x32')](_0x5938db[_0xfc70('0x30')][_0xfc70('0x32')]));_0x26251e[_0xfc70('0x31')]=_0x26251e[_0xfc70('0x31')]['length']?_0x26251e[_0xfc70('0x31')]:_0x461b37['model'];_0x26251e[_0xfc70('0x49')]=qs[_0xfc70('0x4a')](_0x5938db[_0xfc70('0x30')][_0xfc70('0x4a')]);_0x26251e[_0xfc70('0x39')]=qs[_0xfc70('0x2e')](_[_0xfc70('0x37')](_0x5938db[_0xfc70('0x30')],_0x461b37['filters']));if(_0x5938db[_0xfc70('0x30')][_0xfc70('0x3b')]){_0x26251e[_0xfc70('0x39')]=_[_0xfc70('0x38')](_0x26251e[_0xfc70('0x39')],{'$or':_[_0xfc70('0x25')](_0x26251e[_0xfc70('0x31')],function(_0x195dc5){var _0x3307be={};_0x3307be[_0x195dc5]={'$like':'%'+_0x5938db[_0xfc70('0x30')][_0xfc70('0x3b')]+'%'};return _0x3307be;})});}_0x26251e=_[_0xfc70('0x38')]({},_0x26251e,_0x5938db[_0xfc70('0x42')]);return _0x14326f['getDescriptions'](_0x26251e);}})[_0xfc70('0x20')](function(_0x300e3b){if(_0x300e3b){_0x5ba4d=_0x300e3b[_0xfc70('0x33')];if(!_0x5938db[_0xfc70('0x30')][_0xfc70('0x34')](_0xfc70('0x35'))){_0x26251e['limit']=qs[_0xfc70('0x36')](_0x5938db[_0xfc70('0x30')]['limit']);_0x26251e['offset']=qs[_0xfc70('0x1b')](_0x5938db['query'][_0xfc70('0x1b')]);}return _0x14326f[_0xfc70('0x4c')](_0x26251e);}})['then'](function(_0x154202){if(_0x154202){return _0x154202?{'count':_0x5ba4d,'rows':_0x154202}:null;}})[_0xfc70('0x20')](respondWithResult(_0x1d5515,null))[_0xfc70('0x3f')](handleError(_0x1d5515,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index c4be045..4ce64ef 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 _0xd5fc=['../../config/environment','exports','define','lodash','moment','bluebird','request-promise','path','rimraf'];(function(_0x7f4dbc,_0x344984){var _0x3229c9=function(_0x4589c6){while(--_0x4589c6){_0x7f4dbc['push'](_0x7f4dbc['shift']());}};_0x3229c9(++_0x344984);}(_0xd5fc,0xae));var _0xcd5f=function(_0x495172,_0x38a35f){_0x495172=_0x495172-0x0;var _0x3051cc=_0xd5fc[_0x495172];return _0x3051cc;};'use strict';var _=require(_0xcd5f('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xcd5f('0x1'));var BPromise=require(_0xcd5f('0x2'));var rp=require(_0xcd5f('0x3'));var fs=require('fs');var path=require(_0xcd5f('0x4'));var rimraf=require(_0xcd5f('0x5'));var config=require(_0xcd5f('0x6'));var attributes=require('./intServicenowConfiguration.attributes');module[_0xcd5f('0x7')]=function(_0x4b4ca8,_0x95b8bb){return _0x4b4ca8[_0xcd5f('0x8')]('ServicenowConfiguration',attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9147=['./intServicenowConfiguration.attributes','define','int_servicenow_configurations','lodash','util','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x510132,_0x19645a){var _0x27edf7=function(_0x3a4ce8){while(--_0x3a4ce8){_0x510132['push'](_0x510132['shift']());}};_0x27edf7(++_0x19645a);}(_0x9147,0x7b));var _0x7914=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x9147[_0x376b45];return _0x2341b3;};'use strict';var _=require(_0x7914('0x0'));var util=require(_0x7914('0x1'));var logger=require('../../config/logger')(_0x7914('0x2'));var moment=require('moment');var BPromise=require(_0x7914('0x3'));var rp=require(_0x7914('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7914('0x5'));var config=require(_0x7914('0x6'));var attributes=require(_0x7914('0x7'));module['exports']=function(_0x34c372,_0x4dd321){return _0x34c372[_0x7914('0x8')]('ServicenowConfiguration',attributes,{'tableName':_0x7914('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index c50eef4..ac8e9d7 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 _0xfd4c=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','ServicenowConfiguration,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x5e6838,_0x39ea15){var _0x11700d=function(_0x435c83){while(--_0x435c83){_0x5e6838['push'](_0x5e6838['shift']());}};_0x11700d(++_0x39ea15);}(_0xfd4c,0x17b));var _0xcfd4=function(_0x238bf6,_0x2c2f11){_0x238bf6=_0x238bf6-0x0;var _0xb3e16d=_0xfd4c[_0x238bf6];return _0xb3e16d;};'use strict';var _=require(_0xcfd4('0x0'));var util=require(_0xcfd4('0x1'));var moment=require('moment');var BPromise=require(_0xcfd4('0x2'));var rs=require(_0xcfd4('0x3'));var fs=require('fs');var Redis=require(_0xcfd4('0x4'));var db=require(_0xcfd4('0x5'))['db'];var utils=require(_0xcfd4('0x6'));var logger=require('../../config/logger')(_0xcfd4('0x7'));var config=require(_0xcfd4('0x8'));var jayson=require(_0xcfd4('0x9'));var client=jayson[_0xcfd4('0xa')][_0xcfd4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xc70bf4,_0xfd0644,_0x28fc02){return new BPromise(function(_0x8ff051,_0x575808){return client[_0xcfd4('0xc')](_0xc70bf4,_0x28fc02)[_0xcfd4('0xd')](function(_0x39d7a0){logger[_0xcfd4('0xe')]('ServicenowConfiguration,\x20%s,\x20%s',_0xfd0644,'request\x20sent');logger[_0xcfd4('0xf')](_0xcfd4('0x10'),_0xfd0644,_0xcfd4('0x11'),JSON[_0xcfd4('0x12')](_0x39d7a0));if(_0x39d7a0[_0xcfd4('0x13')]){if(_0x39d7a0['error']['code']===0x1f4){logger[_0xcfd4('0x13')]('ServicenowConfiguration,\x20%s,\x20%s',_0xfd0644,_0x39d7a0['error']['message']);return _0x575808(_0x39d7a0[_0xcfd4('0x13')][_0xcfd4('0x14')]);}logger['error'](_0xcfd4('0x15'),_0xfd0644,_0x39d7a0[_0xcfd4('0x13')][_0xcfd4('0x14')]);return _0x8ff051(_0x39d7a0[_0xcfd4('0x13')][_0xcfd4('0x14')]);}else{logger[_0xcfd4('0xe')](_0xcfd4('0x15'),_0xfd0644,_0xcfd4('0x11'));_0x8ff051(_0x39d7a0[_0xcfd4('0x16')]['message']);}})[_0xcfd4('0x17')](function(_0x4508b9){logger['error'](_0xcfd4('0x15'),_0xfd0644,_0x4508b9);_0x575808(_0x4508b9);});});} \ No newline at end of file +var _0x99d6=['ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','ServicenowConfiguration,\x20%s,\x20%s','message','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug'];(function(_0x284807,_0x4be925){var _0x50c774=function(_0xf56cf7){while(--_0xf56cf7){_0x284807['push'](_0x284807['shift']());}};_0x50c774(++_0x4be925);}(_0x99d6,0x193));var _0x699d=function(_0x2de020,_0x252df0){_0x2de020=_0x2de020-0x0;var _0x182b7c=_0x99d6[_0x2de020];return _0x182b7c;};'use strict';var _=require(_0x699d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x699d('0x1'));var fs=require('fs');var Redis=require(_0x699d('0x2'));var db=require(_0x699d('0x3'))['db'];var utils=require(_0x699d('0x4'));var logger=require(_0x699d('0x5'))(_0x699d('0x6'));var config=require(_0x699d('0x7'));var jayson=require(_0x699d('0x8'));var client=jayson[_0x699d('0x9')][_0x699d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xee5e8,_0x2a0387,_0x4f6d7f){return new BPromise(function(_0x5765b7,_0x17751e){return client[_0x699d('0xb')](_0xee5e8,_0x4f6d7f)['then'](function(_0x100389){logger[_0x699d('0xc')]('ServicenowConfiguration,\x20%s,\x20%s',_0x2a0387,_0x699d('0xd'));logger[_0x699d('0xe')](_0x699d('0xf'),_0x2a0387,_0x699d('0xd'),JSON[_0x699d('0x10')](_0x100389));if(_0x100389[_0x699d('0x11')]){if(_0x100389[_0x699d('0x11')]['code']===0x1f4){logger[_0x699d('0x11')](_0x699d('0x12'),_0x2a0387,_0x100389[_0x699d('0x11')][_0x699d('0x13')]);return _0x17751e(_0x100389['error'][_0x699d('0x13')]);}logger['error'](_0x699d('0x12'),_0x2a0387,_0x100389[_0x699d('0x11')]['message']);return _0x5765b7(_0x100389[_0x699d('0x11')][_0x699d('0x13')]);}else{logger[_0x699d('0xc')](_0x699d('0x12'),_0x2a0387,_0x699d('0xd'));_0x5765b7(_0x100389[_0x699d('0x14')][_0x699d('0x13')]);}})[_0x699d('0x15')](function(_0x560e02){logger[_0x699d('0x11')](_0x699d('0x12'),_0x2a0387,_0x560e02);_0x17751e(_0x560e02);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 801d73b..1d251e2 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 _0x583b=['put','/:id','update','delete','destroy','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','show','post','create'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x583b,0x113));var _0xb583=function(_0x30e634,_0x3493d4){_0x30e634=_0x30e634-0x0;var _0x43ccaf=_0x583b[_0x30e634];return _0x43ccaf;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb583('0x0'));var timeout=require('connect-timeout');var express=require(_0xb583('0x1'));var router=express[_0xb583('0x2')]();var fs_extra=require(_0xb583('0x3'));var auth=require(_0xb583('0x4'));var interaction=require(_0xb583('0x5'));var config=require(_0xb583('0x6'));var controller=require(_0xb583('0x7'));router[_0xb583('0x8')]('/',auth[_0xb583('0x9')](),controller['index']);router[_0xb583('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xb583('0xa')]);router[_0xb583('0xb')]('/',auth['isAuthenticated'](),controller[_0xb583('0xc')]);router[_0xb583('0xd')](_0xb583('0xe'),auth[_0xb583('0x9')](),controller[_0xb583('0xf')]);router[_0xb583('0x10')](_0xb583('0xe'),auth[_0xb583('0x9')](),controller[_0xb583('0x11')]);module['exports']=router; \ No newline at end of file +var _0x342c=['exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','/:id','show','create','put','delete','destroy'];(function(_0x5d07cb,_0x2b313d){var _0x3d5b7d=function(_0x51a961){while(--_0x51a961){_0x5d07cb['push'](_0x5d07cb['shift']());}};_0x3d5b7d(++_0x2b313d);}(_0x342c,0xac));var _0xc342=function(_0x223452,_0x49e85f){_0x223452=_0x223452-0x0;var _0x786481=_0x342c[_0x223452];return _0x786481;};'use strict';var multer=require(_0xc342('0x0'));var util=require(_0xc342('0x1'));var path=require(_0xc342('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc342('0x3')]();var fs_extra=require(_0xc342('0x4'));var auth=require(_0xc342('0x5'));var interaction=require(_0xc342('0x6'));var config=require(_0xc342('0x7'));var controller=require(_0xc342('0x8'));router[_0xc342('0x9')]('/',auth[_0xc342('0xa')](),controller[_0xc342('0xb')]);router[_0xc342('0x9')](_0xc342('0xc'),auth[_0xc342('0xa')](),controller[_0xc342('0xd')]);router['post']('/',auth[_0xc342('0xa')](),controller[_0xc342('0xe')]);router[_0xc342('0xf')](_0xc342('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xc342('0x10')](_0xc342('0xc'),auth[_0xc342('0xa')](),controller[_0xc342('0x11')]);module[_0xc342('0x12')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index a48a268..d2dc527 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 _0x3189=['sequelize','exports','string','customVariable','picklist','STRING','variable','BOOLEAN'];(function(_0x480f68,_0x266efa){var _0x671946=function(_0x301e89){while(--_0x301e89){_0x480f68['push'](_0x480f68['shift']());}};_0x671946(++_0x266efa);}(_0x3189,0x188));var _0x9318=function(_0xe2253b,_0x2dbcb6){_0xe2253b=_0xe2253b-0x0;var _0x338115=_0x3189[_0xe2253b];return _0x338115;};'use strict';var Sequelize=require(_0x9318('0x0'));module[_0x9318('0x1')]={'type':{'type':Sequelize['ENUM'](_0x9318('0x2'),'variable',_0x9318('0x3'),'keyValue',_0x9318('0x4')),'defaultValue':_0x9318('0x2')},'content':{'type':Sequelize[_0x9318('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x9318('0x2'),_0x9318('0x6'),_0x9318('0x3'))},'keyContent':{'type':Sequelize[_0x9318('0x5')]},'idField':{'type':Sequelize[_0x9318('0x5')]},'nameField':{'type':Sequelize[_0x9318('0x5')]},'customField':{'type':Sequelize[_0x9318('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9318('0x5')]}}; \ No newline at end of file +var _0x309e=['customVariable','keyValue','picklist','STRING','variable','BOOLEAN','sequelize','ENUM','string'];(function(_0x580ed4,_0x2d979c){var _0x12a1ef=function(_0x5c210d){while(--_0x5c210d){_0x580ed4['push'](_0x580ed4['shift']());}};_0x12a1ef(++_0x2d979c);}(_0x309e,0x9f));var _0xe309=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x309e[_0x543084];return _0x306a57;};'use strict';var Sequelize=require(_0xe309('0x0'));module['exports']={'type':{'type':Sequelize[_0xe309('0x1')](_0xe309('0x2'),'variable',_0xe309('0x3'),_0xe309('0x4'),_0xe309('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xe309('0x6')]},'key':{'type':Sequelize[_0xe309('0x6')]},'keyType':{'type':Sequelize[_0xe309('0x1')]('string',_0xe309('0x7'),_0xe309('0x3'))},'keyContent':{'type':Sequelize[_0xe309('0x6')]},'idField':{'type':Sequelize[_0xe309('0x6')]},'nameField':{'type':Sequelize[_0xe309('0x6')]},'customField':{'type':Sequelize[_0xe309('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe309('0x6')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index e6d1c27..510cfd6 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 _0xb4f7=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','destroy','stack','name','send','index','map','ServicenowField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','nolimit','sort','where','pick','VIRTUAL','filter','merge','options','include','findAll','catch','show','includeAll','find','create','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x210727,_0x220396){var _0x1f40ef=function(_0x4a6780){while(--_0x4a6780){_0x210727['push'](_0x210727['shift']());}};_0x1f40ef(++_0x220396);}(_0xb4f7,0x7e));var _0x7b4f=function(_0xcaaec0,_0x253fb3){_0xcaaec0=_0xcaaec0-0x0;var _0x1e6ae4=_0xb4f7[_0xcaaec0];return _0x1e6ae4;};'use strict';var emlformat=require(_0x7b4f('0x0'));var rimraf=require(_0x7b4f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7b4f('0x2'));var rp=require(_0x7b4f('0x3'));var moment=require(_0x7b4f('0x4'));var BPromise=require(_0x7b4f('0x5'));var Mustache=require(_0x7b4f('0x6'));var util=require('util');var path=require(_0x7b4f('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7b4f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x7b4f('0x9'));var crypto=require(_0x7b4f('0xa'));var jsforce=require(_0x7b4f('0xb'));var deskjs=require(_0x7b4f('0xc'));var toCsv=require('to-csv');var querystring=require(_0x7b4f('0xd'));var Papa=require(_0x7b4f('0xe'));var Redis=require(_0x7b4f('0xf'));var authService=require(_0x7b4f('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7b4f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7b4f('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x7b4f('0x13'));var licenseUtil=require(_0x7b4f('0x14'));var db=require(_0x7b4f('0x15'))['db'];function respondWithStatusCode(_0x1668ec,_0x388559){_0x388559=_0x388559||0xcc;return function(_0x568d40){if(_0x568d40){return _0x1668ec[_0x7b4f('0x16')](_0x388559);}return _0x1668ec[_0x7b4f('0x17')](_0x388559)[_0x7b4f('0x18')]();};}function respondWithResult(_0x146d31,_0x1715eb){_0x1715eb=_0x1715eb||0xc8;return function(_0x4e80d5){if(_0x4e80d5){return _0x146d31[_0x7b4f('0x17')](_0x1715eb)[_0x7b4f('0x19')](_0x4e80d5);}};}function respondWithFilteredResult(_0x48ffdf,_0x4536e3){return function(_0x7a8bc3){if(_0x7a8bc3){var _0x3c6f9a=typeof _0x4536e3[_0x7b4f('0x1a')]===_0x7b4f('0x1b')&&typeof _0x4536e3['limit']===_0x7b4f('0x1b');var _0x509520=_0x7a8bc3[_0x7b4f('0x1c')];var _0x31c13f=_0x3c6f9a?0x0:_0x4536e3[_0x7b4f('0x1a')];var _0x329e99=_0x3c6f9a?_0x7a8bc3[_0x7b4f('0x1c')]:_0x4536e3[_0x7b4f('0x1a')]+_0x4536e3[_0x7b4f('0x1d')];var _0x53cf9c;if(_0x329e99>=_0x509520){_0x329e99=_0x509520;_0x53cf9c=0xc8;}else{_0x53cf9c=0xce;}_0x48ffdf['status'](_0x53cf9c);return _0x48ffdf[_0x7b4f('0x1e')]('Content-Range',_0x31c13f+'-'+_0x329e99+'/'+_0x509520)['json'](_0x7a8bc3);}return null;};}function patchUpdates(_0x320dbe){return function(_0xae0bd1){try{jsonpatch[_0x7b4f('0x1f')](_0xae0bd1,_0x320dbe,!![]);}catch(_0x3b5e8a){return BPromise['reject'](_0x3b5e8a);}return _0xae0bd1[_0x7b4f('0x20')]();};}function saveUpdates(_0x1de13a,_0x1e821f){return function(_0x2e2d0d){if(_0x2e2d0d){return _0x2e2d0d[_0x7b4f('0x21')](_0x1de13a)[_0x7b4f('0x22')](function(_0x1cd4fa){return _0x1cd4fa;});}return null;};}function removeEntity(_0x3a351c,_0xc7bdab){return function(_0x5e0e9b){if(_0x5e0e9b){return _0x5e0e9b[_0x7b4f('0x23')]()[_0x7b4f('0x22')](function(){_0x3a351c['status'](0xcc)[_0x7b4f('0x18')]();});}};}function handleEntityNotFound(_0x18cd2c,_0x1cdb52){return function(_0x1be8a1){if(!_0x1be8a1){_0x18cd2c[_0x7b4f('0x16')](0x194);}return _0x1be8a1;};}function handleError(_0x662126,_0xedd051){_0xedd051=_0xedd051||0x1f4;return function(_0x33f0b1){logger['error'](_0x33f0b1[_0x7b4f('0x24')]);if(_0x33f0b1[_0x7b4f('0x25')]){delete _0x33f0b1['name'];}_0x662126['status'](_0xedd051)[_0x7b4f('0x26')](_0x33f0b1);};}exports[_0x7b4f('0x27')]=function(_0x136f9f,_0x132bc){var _0x3ce2d7={},_0x45ab10={},_0x3eb260={'count':0x0,'rows':[]};var _0x221357=_[_0x7b4f('0x28')](db[_0x7b4f('0x29')][_0x7b4f('0x2a')],function(_0x527a0a){return{'name':_0x527a0a[_0x7b4f('0x2b')],'type':_0x527a0a[_0x7b4f('0x2c')][_0x7b4f('0x2d')]};});_0x45ab10['model']=_[_0x7b4f('0x28')](_0x221357,_0x7b4f('0x25'));_0x45ab10[_0x7b4f('0x2e')]=_[_0x7b4f('0x2f')](_0x136f9f[_0x7b4f('0x2e')]);_0x45ab10[_0x7b4f('0x30')]=_[_0x7b4f('0x31')](_0x45ab10['model'],_0x45ab10[_0x7b4f('0x2e')]);_0x3ce2d7[_0x7b4f('0x32')]=_[_0x7b4f('0x31')](_0x45ab10[_0x7b4f('0x33')],qs[_0x7b4f('0x34')](_0x136f9f[_0x7b4f('0x2e')][_0x7b4f('0x34')]));_0x3ce2d7[_0x7b4f('0x32')]=_0x3ce2d7[_0x7b4f('0x32')][_0x7b4f('0x35')]?_0x3ce2d7['attributes']:_0x45ab10[_0x7b4f('0x33')];if(!_0x136f9f[_0x7b4f('0x2e')]['hasOwnProperty'](_0x7b4f('0x36'))){_0x3ce2d7['limit']=qs[_0x7b4f('0x1d')](_0x136f9f[_0x7b4f('0x2e')][_0x7b4f('0x1d')]);_0x3ce2d7[_0x7b4f('0x1a')]=qs['offset'](_0x136f9f[_0x7b4f('0x2e')][_0x7b4f('0x1a')]);}_0x3ce2d7['order']=qs['sort'](_0x136f9f[_0x7b4f('0x2e')][_0x7b4f('0x37')]);_0x3ce2d7[_0x7b4f('0x38')]=qs[_0x7b4f('0x30')](_[_0x7b4f('0x39')](_0x136f9f[_0x7b4f('0x2e')],_0x45ab10[_0x7b4f('0x30')]),_0x221357);if(_0x136f9f[_0x7b4f('0x2e')]['filter']){_0x3ce2d7[_0x7b4f('0x38')]=_['merge'](_0x3ce2d7['where'],{'$or':_['map'](_0x221357,function(_0x202c97){if(_0x202c97[_0x7b4f('0x2c')]!==_0x7b4f('0x3a')){var _0xbc7364={};_0xbc7364[_0x202c97[_0x7b4f('0x25')]]={'$like':'%'+_0x136f9f['query'][_0x7b4f('0x3b')]+'%'};return _0xbc7364;}})});}_0x3ce2d7=_[_0x7b4f('0x3c')]({},_0x3ce2d7,_0x136f9f[_0x7b4f('0x3d')]);var _0x3aedcb={'where':_0x3ce2d7[_0x7b4f('0x38')]};return db[_0x7b4f('0x29')]['count'](_0x3aedcb)[_0x7b4f('0x22')](function(_0x1e7dbc){_0x3eb260[_0x7b4f('0x1c')]=_0x1e7dbc;if(_0x136f9f['query']['includeAll']){_0x3ce2d7[_0x7b4f('0x3e')]=[{'all':!![]}];}return db[_0x7b4f('0x29')][_0x7b4f('0x3f')](_0x3ce2d7);})[_0x7b4f('0x22')](function(_0x44a024){_0x3eb260['rows']=_0x44a024;return _0x3eb260;})['then'](respondWithFilteredResult(_0x132bc,_0x3ce2d7))[_0x7b4f('0x40')](handleError(_0x132bc,null));};exports[_0x7b4f('0x41')]=function(_0x48ff73,_0x413f61){var _0x271814={'raw':!![],'where':{'id':_0x48ff73['params']['id']}},_0x4ad0ee={};_0x4ad0ee[_0x7b4f('0x33')]=_[_0x7b4f('0x2f')](db[_0x7b4f('0x29')]['rawAttributes']);_0x4ad0ee[_0x7b4f('0x2e')]=_['keys'](_0x48ff73['query']);_0x4ad0ee[_0x7b4f('0x30')]=_['intersection'](_0x4ad0ee[_0x7b4f('0x33')],_0x4ad0ee[_0x7b4f('0x2e')]);_0x271814[_0x7b4f('0x32')]=_[_0x7b4f('0x31')](_0x4ad0ee[_0x7b4f('0x33')],qs['fields'](_0x48ff73['query'][_0x7b4f('0x34')]));_0x271814['attributes']=_0x271814[_0x7b4f('0x32')][_0x7b4f('0x35')]?_0x271814[_0x7b4f('0x32')]:_0x4ad0ee[_0x7b4f('0x33')];if(_0x48ff73[_0x7b4f('0x2e')][_0x7b4f('0x42')]){_0x271814[_0x7b4f('0x3e')]=[{'all':!![]}];}_0x271814=_[_0x7b4f('0x3c')]({},_0x271814,_0x48ff73[_0x7b4f('0x3d')]);return db[_0x7b4f('0x29')][_0x7b4f('0x43')](_0x271814)[_0x7b4f('0x22')](handleEntityNotFound(_0x413f61,null))[_0x7b4f('0x22')](respondWithResult(_0x413f61,null))[_0x7b4f('0x40')](handleError(_0x413f61,null));};exports['create']=function(_0x25bc2c,_0x527ced){return db['ServicenowField'][_0x7b4f('0x44')](_0x25bc2c['body'],{})[_0x7b4f('0x22')](respondWithResult(_0x527ced,0xc9))[_0x7b4f('0x40')](handleError(_0x527ced,null));};exports[_0x7b4f('0x21')]=function(_0x52a188,_0x2f4794){if(_0x52a188[_0x7b4f('0x45')]['id']){delete _0x52a188[_0x7b4f('0x45')]['id'];}return db[_0x7b4f('0x29')][_0x7b4f('0x43')]({'where':{'id':_0x52a188[_0x7b4f('0x46')]['id']}})['then'](handleEntityNotFound(_0x2f4794,null))[_0x7b4f('0x22')](saveUpdates(_0x52a188[_0x7b4f('0x45')],null))[_0x7b4f('0x22')](respondWithResult(_0x2f4794,null))[_0x7b4f('0x40')](handleError(_0x2f4794,null));};exports['destroy']=function(_0x3ba768,_0x3906ec){return db[_0x7b4f('0x29')][_0x7b4f('0x43')]({'where':{'id':_0x3ba768[_0x7b4f('0x46')]['id']}})['then'](handleEntityNotFound(_0x3906ec,null))[_0x7b4f('0x22')](removeEntity(_0x3906ec,null))[_0x7b4f('0x40')](handleError(_0x3906ec,null));}; \ No newline at end of file +var _0xaa30=['index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','where','pick','VIRTUAL','filter','merge','options','includeAll','include','ServicenowField','rows','create','body','find','params','catch','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','name','send'];(function(_0x33699c,_0x222459){var _0x228c15=function(_0x4664d8){while(--_0x4664d8){_0x33699c['push'](_0x33699c['shift']());}};_0x228c15(++_0x222459);}(_0xaa30,0x1c1));var _0x0aa3=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xaa30[_0x5b561d];return _0x431060;};'use strict';var emlformat=require(_0x0aa3('0x0'));var rimraf=require(_0x0aa3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0aa3('0x2'));var moment=require(_0x0aa3('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0aa3('0x4'));var util=require(_0x0aa3('0x5'));var path=require(_0x0aa3('0x6'));var sox=require(_0x0aa3('0x7'));var csv=require(_0x0aa3('0x8'));var ejs=require(_0x0aa3('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0aa3('0xa'));var squel=require(_0x0aa3('0xb'));var crypto=require(_0x0aa3('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0aa3('0xd'));var toCsv=require(_0x0aa3('0x8'));var querystring=require(_0x0aa3('0xe'));var Papa=require(_0x0aa3('0xf'));var Redis=require(_0x0aa3('0x10'));var authService=require(_0x0aa3('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0aa3('0x12'));var logger=require(_0x0aa3('0x13'))(_0x0aa3('0x14'));var utils=require(_0x0aa3('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x0aa3('0x16'));var db=require(_0x0aa3('0x17'))['db'];function respondWithStatusCode(_0xcfc941,_0x18d7ec){_0x18d7ec=_0x18d7ec||0xcc;return function(_0x249792){if(_0x249792){return _0xcfc941[_0x0aa3('0x18')](_0x18d7ec);}return _0xcfc941[_0x0aa3('0x19')](_0x18d7ec)[_0x0aa3('0x1a')]();};}function respondWithResult(_0x52f307,_0x56b005){_0x56b005=_0x56b005||0xc8;return function(_0x5425c6){if(_0x5425c6){return _0x52f307['status'](_0x56b005)[_0x0aa3('0x1b')](_0x5425c6);}};}function respondWithFilteredResult(_0x51e45b,_0x59a901){return function(_0x39b673){if(_0x39b673){var _0x307513=typeof _0x59a901[_0x0aa3('0x1c')]===_0x0aa3('0x1d')&&typeof _0x59a901[_0x0aa3('0x1e')]===_0x0aa3('0x1d');var _0x8beeff=_0x39b673[_0x0aa3('0x1f')];var _0x3f6efd=_0x307513?0x0:_0x59a901[_0x0aa3('0x1c')];var _0x16c7e2=_0x307513?_0x39b673['count']:_0x59a901[_0x0aa3('0x1c')]+_0x59a901[_0x0aa3('0x1e')];var _0x1c20ab;if(_0x16c7e2>=_0x8beeff){_0x16c7e2=_0x8beeff;_0x1c20ab=0xc8;}else{_0x1c20ab=0xce;}_0x51e45b['status'](_0x1c20ab);return _0x51e45b['set'](_0x0aa3('0x20'),_0x3f6efd+'-'+_0x16c7e2+'/'+_0x8beeff)[_0x0aa3('0x1b')](_0x39b673);}return null;};}function patchUpdates(_0x3d0bec){return function(_0x5d36b5){try{jsonpatch[_0x0aa3('0x21')](_0x5d36b5,_0x3d0bec,!![]);}catch(_0x293e7b){return BPromise[_0x0aa3('0x22')](_0x293e7b);}return _0x5d36b5[_0x0aa3('0x23')]();};}function saveUpdates(_0x21124e,_0x26d7c4){return function(_0x11786b){if(_0x11786b){return _0x11786b[_0x0aa3('0x24')](_0x21124e)[_0x0aa3('0x25')](function(_0x3b0af7){return _0x3b0af7;});}return null;};}function removeEntity(_0x41f804,_0x43c427){return function(_0x216624){if(_0x216624){return _0x216624[_0x0aa3('0x26')]()[_0x0aa3('0x25')](function(){_0x41f804[_0x0aa3('0x19')](0xcc)[_0x0aa3('0x1a')]();});}};}function handleEntityNotFound(_0x3e525e,_0x4eef3a){return function(_0x20cea9){if(!_0x20cea9){_0x3e525e[_0x0aa3('0x18')](0x194);}return _0x20cea9;};}function handleError(_0x32df39,_0x4e1ece){_0x4e1ece=_0x4e1ece||0x1f4;return function(_0xdb92b2){logger['error'](_0xdb92b2['stack']);if(_0xdb92b2['name']){delete _0xdb92b2[_0x0aa3('0x27')];}_0x32df39[_0x0aa3('0x19')](_0x4e1ece)[_0x0aa3('0x28')](_0xdb92b2);};}exports[_0x0aa3('0x29')]=function(_0x251e31,_0x4b2589){var _0x5bf5b6={},_0xb4b24f={},_0x519d1b={'count':0x0,'rows':[]};var _0x188e0b=_[_0x0aa3('0x2a')](db['ServicenowField'][_0x0aa3('0x2b')],function(_0x3a073e){return{'name':_0x3a073e[_0x0aa3('0x2c')],'type':_0x3a073e['type'][_0x0aa3('0x2d')]};});_0xb4b24f[_0x0aa3('0x2e')]=_[_0x0aa3('0x2a')](_0x188e0b,_0x0aa3('0x27'));_0xb4b24f[_0x0aa3('0x2f')]=_[_0x0aa3('0x30')](_0x251e31[_0x0aa3('0x2f')]);_0xb4b24f[_0x0aa3('0x31')]=_[_0x0aa3('0x32')](_0xb4b24f['model'],_0xb4b24f[_0x0aa3('0x2f')]);_0x5bf5b6['attributes']=_[_0x0aa3('0x32')](_0xb4b24f[_0x0aa3('0x2e')],qs[_0x0aa3('0x33')](_0x251e31[_0x0aa3('0x2f')][_0x0aa3('0x33')]));_0x5bf5b6['attributes']=_0x5bf5b6[_0x0aa3('0x34')][_0x0aa3('0x35')]?_0x5bf5b6[_0x0aa3('0x34')]:_0xb4b24f[_0x0aa3('0x2e')];if(!_0x251e31['query']['hasOwnProperty'](_0x0aa3('0x36'))){_0x5bf5b6[_0x0aa3('0x1e')]=qs[_0x0aa3('0x1e')](_0x251e31[_0x0aa3('0x2f')][_0x0aa3('0x1e')]);_0x5bf5b6[_0x0aa3('0x1c')]=qs[_0x0aa3('0x1c')](_0x251e31[_0x0aa3('0x2f')]['offset']);}_0x5bf5b6['order']=qs['sort'](_0x251e31[_0x0aa3('0x2f')]['sort']);_0x5bf5b6[_0x0aa3('0x37')]=qs[_0x0aa3('0x31')](_[_0x0aa3('0x38')](_0x251e31[_0x0aa3('0x2f')],_0xb4b24f['filters']),_0x188e0b);if(_0x251e31['query']['filter']){_0x5bf5b6[_0x0aa3('0x37')]=_['merge'](_0x5bf5b6[_0x0aa3('0x37')],{'$or':_[_0x0aa3('0x2a')](_0x188e0b,function(_0xdde9a1){if(_0xdde9a1['type']!==_0x0aa3('0x39')){var _0x3d59c3={};_0x3d59c3[_0xdde9a1[_0x0aa3('0x27')]]={'$like':'%'+_0x251e31['query'][_0x0aa3('0x3a')]+'%'};return _0x3d59c3;}})});}_0x5bf5b6=_[_0x0aa3('0x3b')]({},_0x5bf5b6,_0x251e31[_0x0aa3('0x3c')]);var _0x49ab7b={'where':_0x5bf5b6[_0x0aa3('0x37')]};return db['ServicenowField'][_0x0aa3('0x1f')](_0x49ab7b)['then'](function(_0x2255a5){_0x519d1b[_0x0aa3('0x1f')]=_0x2255a5;if(_0x251e31[_0x0aa3('0x2f')][_0x0aa3('0x3d')]){_0x5bf5b6[_0x0aa3('0x3e')]=[{'all':!![]}];}return db[_0x0aa3('0x3f')]['findAll'](_0x5bf5b6);})['then'](function(_0x366c70){_0x519d1b[_0x0aa3('0x40')]=_0x366c70;return _0x519d1b;})[_0x0aa3('0x25')](respondWithFilteredResult(_0x4b2589,_0x5bf5b6))['catch'](handleError(_0x4b2589,null));};exports['show']=function(_0x2859b9,_0x3a675e){var _0x22d323={'raw':!![],'where':{'id':_0x2859b9['params']['id']}},_0x2313af={};_0x2313af[_0x0aa3('0x2e')]=_[_0x0aa3('0x30')](db[_0x0aa3('0x3f')]['rawAttributes']);_0x2313af['query']=_[_0x0aa3('0x30')](_0x2859b9[_0x0aa3('0x2f')]);_0x2313af[_0x0aa3('0x31')]=_[_0x0aa3('0x32')](_0x2313af[_0x0aa3('0x2e')],_0x2313af[_0x0aa3('0x2f')]);_0x22d323[_0x0aa3('0x34')]=_[_0x0aa3('0x32')](_0x2313af[_0x0aa3('0x2e')],qs[_0x0aa3('0x33')](_0x2859b9[_0x0aa3('0x2f')][_0x0aa3('0x33')]));_0x22d323[_0x0aa3('0x34')]=_0x22d323[_0x0aa3('0x34')][_0x0aa3('0x35')]?_0x22d323[_0x0aa3('0x34')]:_0x2313af[_0x0aa3('0x2e')];if(_0x2859b9[_0x0aa3('0x2f')]['includeAll']){_0x22d323[_0x0aa3('0x3e')]=[{'all':!![]}];}_0x22d323=_[_0x0aa3('0x3b')]({},_0x22d323,_0x2859b9[_0x0aa3('0x3c')]);return db[_0x0aa3('0x3f')]['find'](_0x22d323)[_0x0aa3('0x25')](handleEntityNotFound(_0x3a675e,null))[_0x0aa3('0x25')](respondWithResult(_0x3a675e,null))['catch'](handleError(_0x3a675e,null));};exports[_0x0aa3('0x41')]=function(_0x5a15ac,_0xb7b0e8){return db[_0x0aa3('0x3f')]['create'](_0x5a15ac[_0x0aa3('0x42')],{})['then'](respondWithResult(_0xb7b0e8,0xc9))['catch'](handleError(_0xb7b0e8,null));};exports[_0x0aa3('0x24')]=function(_0x27c3a0,_0xa45d51){if(_0x27c3a0[_0x0aa3('0x42')]['id']){delete _0x27c3a0[_0x0aa3('0x42')]['id'];}return db[_0x0aa3('0x3f')][_0x0aa3('0x43')]({'where':{'id':_0x27c3a0[_0x0aa3('0x44')]['id']}})['then'](handleEntityNotFound(_0xa45d51,null))[_0x0aa3('0x25')](saveUpdates(_0x27c3a0[_0x0aa3('0x42')],null))[_0x0aa3('0x25')](respondWithResult(_0xa45d51,null))[_0x0aa3('0x45')](handleError(_0xa45d51,null));};exports[_0x0aa3('0x26')]=function(_0x11e89e,_0x290d7f){return db[_0x0aa3('0x3f')][_0x0aa3('0x43')]({'where':{'id':_0x11e89e[_0x0aa3('0x44')]['id']}})['then'](handleEntityNotFound(_0x290d7f,null))[_0x0aa3('0x25')](removeEntity(_0x290d7f,null))[_0x0aa3('0x45')](handleError(_0x290d7f,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index f460035..690f296 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 _0x4160=['ServicenowField','servicenow_unique_index','idField','FieldId','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define'];(function(_0x557214,_0x346207){var _0x502630=function(_0x24800f){while(--_0x24800f){_0x557214['push'](_0x557214['shift']());}};_0x502630(++_0x346207);}(_0x4160,0xa9));var _0x0416=function(_0x4e04c0,_0x2b7048){_0x4e04c0=_0x4e04c0-0x0;var _0x1c0230=_0x4160[_0x4e04c0];return _0x1c0230;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x0416('0x0'));var BPromise=require(_0x0416('0x1'));var rp=require(_0x0416('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0416('0x3'));var config=require(_0x0416('0x4'));var attributes=require('./intServicenowField.attributes');module[_0x0416('0x5')]=function(_0x211e08,_0x4c9024){return _0x211e08[_0x0416('0x6')](_0x0416('0x7'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0x0416('0x8'),'fields':[_0x0416('0x9'),_0x0416('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x38cd=['servicenow_unique_index','idField','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields'];(function(_0x334927,_0x5da3fa){var _0x251a9b=function(_0x54bf00){while(--_0x54bf00){_0x334927['push'](_0x334927['shift']());}};_0x251a9b(++_0x5da3fa);}(_0x38cd,0xc2));var _0xd38c=function(_0x4bb581,_0x6f7037){_0x4bb581=_0x4bb581-0x0;var _0x316bf5=_0x38cd[_0x4bb581];return _0x316bf5;};'use strict';var _=require(_0xd38c('0x0'));var util=require(_0xd38c('0x1'));var logger=require(_0xd38c('0x2'))(_0xd38c('0x3'));var moment=require(_0xd38c('0x4'));var BPromise=require(_0xd38c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd38c('0x6'));var rimraf=require(_0xd38c('0x7'));var config=require(_0xd38c('0x8'));var attributes=require(_0xd38c('0x9'));module[_0xd38c('0xa')]=function(_0x42a045,_0x26ee69){return _0x42a045[_0xd38c('0xb')](_0xd38c('0xc'),attributes,{'tableName':_0xd38c('0xd'),'paranoid':![],'indexes':[{'name':_0xd38c('0xe'),'fields':[_0xd38c('0xf'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index 9cae9f1..02fbd06 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 _0xda3f=['rpc','jayson/promise','client','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/logger'];(function(_0xf4666e,_0x571140){var _0x1853f1=function(_0x5160a5){while(--_0x5160a5){_0xf4666e['push'](_0xf4666e['shift']());}};_0x1853f1(++_0x571140);}(_0xda3f,0xec));var _0xfda3=function(_0x5e657e,_0x3d7d2c){_0x5e657e=_0x5e657e-0x0;var _0x28230c=_0xda3f[_0x5e657e];return _0x28230c;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var moment=require(_0xfda3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfda3('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xfda3('0x3'))(_0xfda3('0x4'));var config=require('../../config/environment');var jayson=require(_0xfda3('0x5'));var client=jayson[_0xfda3('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e72d1,_0x316792,_0x42476a){return new BPromise(function(_0x125e2a,_0x4018c0){return client[_0xfda3('0x7')](_0x4e72d1,_0x42476a)[_0xfda3('0x8')](function(_0x46655c){logger[_0xfda3('0x9')](_0xfda3('0xa'),_0x316792,_0xfda3('0xb'));logger[_0xfda3('0xc')](_0xfda3('0xd'),_0x316792,'request\x20sent',JSON[_0xfda3('0xe')](_0x46655c));if(_0x46655c[_0xfda3('0xf')]){if(_0x46655c[_0xfda3('0xf')][_0xfda3('0x10')]===0x1f4){logger[_0xfda3('0xf')]('ServicenowField,\x20%s,\x20%s',_0x316792,_0x46655c[_0xfda3('0xf')]['message']);return _0x4018c0(_0x46655c[_0xfda3('0xf')][_0xfda3('0x11')]);}logger['error']('ServicenowField,\x20%s,\x20%s',_0x316792,_0x46655c['error'][_0xfda3('0x11')]);return _0x125e2a(_0x46655c[_0xfda3('0xf')]['message']);}else{logger['info']('ServicenowField,\x20%s,\x20%s',_0x316792,_0xfda3('0xb'));_0x125e2a(_0x46655c[_0xfda3('0x12')][_0xfda3('0x11')]);}})[_0xfda3('0x13')](function(_0x34900d){logger[_0xfda3('0xf')](_0xfda3('0xa'),_0x316792,_0x34900d);_0x4018c0(_0x34900d);});});} \ No newline at end of file +var _0xa9e0=['http','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3f56c5,_0x28e46d){var _0x1a0590=function(_0x166e2e){while(--_0x166e2e){_0x3f56c5['push'](_0x3f56c5['shift']());}};_0x1a0590(++_0x28e46d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 680862a..6a63c52 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(_0x786af0,_0x22b795){var _0x3f9b63=function(_0xd21f73){while(--_0xd21f73){_0x786af0['push'](_0x786af0['shift']());}};_0x3f9b63(++_0x22b795);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'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(_0x4c3932,_0xbd80e5){var _0x226628=function(_0x3ada7e){while(--_0x3ada7e){_0x4c3932['push'](_0x4c3932['shift']());}};_0x226628(++_0xbd80e5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index f7ad335..8e0a068 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(_0x5e276d,_0x2c8885){var _0x2a677b=function(_0x4dccd8){while(--_0x4dccd8){_0x5e276d['push'](_0x5e276d['shift']());}};_0x2a677b(++_0x2c8885);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'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(_0x9a6460,_0x5a3da6){var _0x4df3ee=function(_0x381759){while(--_0x381759){_0x9a6460['push'](_0x9a6460['shift']());}};_0x4df3ee(++_0x5a3da6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x0a9e('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0a9e('0x2')],'unique':_0x0a9e('0x4')},'serverUrl':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index b305b6d..7ef192f 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 _0xbe4e=['request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','then','destroy','error','stack','name','send','map','SugarcrmAccount','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','include','findAll','catch','show','params','create','body','update','find','getConfigurations','findOne','SugarcrmConfiguration','order','options','AccountId','Subjects','channel','Descriptions','getDescriptions','SugarcrmField','getFields','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','username','remoteUri','slice','substring','lastIndexOf','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','POST','Calls','values','module_fields','remove','includes','label','endsWith','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','fast-json-patch'];(function(_0x5df66e,_0x4ec5bb){var _0x8c0a8f=function(_0x1c8062){while(--_0x1c8062){_0x5df66e['push'](_0x5df66e['shift']());}};_0x8c0a8f(++_0x4ec5bb);}(_0xbe4e,0xf1));var _0xebe4=function(_0x11b24f,_0x39a7e3){_0x11b24f=_0x11b24f-0x0;var _0x1b4798=_0xbe4e[_0x11b24f];return _0x1b4798;};'use strict';var emlformat=require(_0xebe4('0x0'));var rimraf=require(_0xebe4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xebe4('0x2'));var rp=require(_0xebe4('0x3'));var moment=require(_0xebe4('0x4'));var BPromise=require(_0xebe4('0x5'));var Mustache=require(_0xebe4('0x6'));var util=require(_0xebe4('0x7'));var path=require(_0xebe4('0x8'));var sox=require(_0xebe4('0x9'));var csv=require('to-csv');var ejs=require(_0xebe4('0xa'));var fs=require('fs');var fs_extra=require(_0xebe4('0xb'));var _=require(_0xebe4('0xc'));var squel=require(_0xebe4('0xd'));var crypto=require(_0xebe4('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xebe4('0xf'));var toCsv=require('to-csv');var querystring=require(_0xebe4('0x10'));var Papa=require('papaparse');var Redis=require(_0xebe4('0x11'));var authService=require(_0xebe4('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xebe4('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xebe4('0x14'))(_0xebe4('0x15'));var utils=require(_0xebe4('0x16'));var config=require(_0xebe4('0x17'));var licenseUtil=require(_0xebe4('0x18'));var db=require(_0xebe4('0x19'))['db'];var integrations=require(_0xebe4('0x1a'));function respondWithStatusCode(_0x552450,_0x1141d0){_0x1141d0=_0x1141d0||0xcc;return function(_0x40ae58){if(_0x40ae58){return _0x552450[_0xebe4('0x1b')](_0x1141d0);}return _0x552450[_0xebe4('0x1c')](_0x1141d0)[_0xebe4('0x1d')]();};}function respondWithResult(_0x506a51,_0x4b3d3a){_0x4b3d3a=_0x4b3d3a||0xc8;return function(_0x44a54a){if(_0x44a54a){return _0x506a51[_0xebe4('0x1c')](_0x4b3d3a)[_0xebe4('0x1e')](_0x44a54a);}};}function respondWithFilteredResult(_0x5a4ea1,_0x5433ed){return function(_0x49a73c){if(_0x49a73c){var _0x767706=typeof _0x5433ed['offset']===_0xebe4('0x1f')&&typeof _0x5433ed[_0xebe4('0x20')]===_0xebe4('0x1f');var _0x42144c=_0x49a73c[_0xebe4('0x21')];var _0xac291a=_0x767706?0x0:_0x5433ed[_0xebe4('0x22')];var _0xd3390c=_0x767706?_0x49a73c['count']:_0x5433ed['offset']+_0x5433ed[_0xebe4('0x20')];var _0x5498e6;if(_0xd3390c>=_0x42144c){_0xd3390c=_0x42144c;_0x5498e6=0xc8;}else{_0x5498e6=0xce;}_0x5a4ea1['status'](_0x5498e6);return _0x5a4ea1[_0xebe4('0x23')]('Content-Range',_0xac291a+'-'+_0xd3390c+'/'+_0x42144c)[_0xebe4('0x1e')](_0x49a73c);}return null;};}function patchUpdates(_0x2b4f35){return function(_0x31ec4e){try{jsonpatch[_0xebe4('0x24')](_0x31ec4e,_0x2b4f35,!![]);}catch(_0x129649){return BPromise[_0xebe4('0x25')](_0x129649);}return _0x31ec4e[_0xebe4('0x26')]();};}function saveUpdates(_0x4771ef,_0x5421c3){return function(_0x88e081){if(_0x88e081){return _0x88e081['update'](_0x4771ef)[_0xebe4('0x27')](function(_0x21300a){return _0x21300a;});}return null;};}function removeEntity(_0x3f4be4,_0x5eebb8){return function(_0x57ced6){if(_0x57ced6){return _0x57ced6[_0xebe4('0x28')]()['then'](function(){_0x3f4be4['status'](0xcc)[_0xebe4('0x1d')]();});}};}function handleEntityNotFound(_0x5bb877,_0x932a94){return function(_0x4504e9){if(!_0x4504e9){_0x5bb877[_0xebe4('0x1b')](0x194);}return _0x4504e9;};}function handleError(_0x427465,_0x4300e2){_0x4300e2=_0x4300e2||0x1f4;return function(_0x2a275d){logger[_0xebe4('0x29')](_0x2a275d[_0xebe4('0x2a')]);if(_0x2a275d[_0xebe4('0x2b')]){delete _0x2a275d[_0xebe4('0x2b')];}_0x427465[_0xebe4('0x1c')](_0x4300e2)[_0xebe4('0x2c')](_0x2a275d);};}exports['index']=function(_0x2e6c05,_0x5b0c10){var _0x11cf5a={},_0x4b6aad={},_0x5d1f39={'count':0x0,'rows':[]};var _0x5902f5=_[_0xebe4('0x2d')](db[_0xebe4('0x2e')]['rawAttributes'],function(_0x242813){return{'name':_0x242813[_0xebe4('0x2f')],'type':_0x242813[_0xebe4('0x30')][_0xebe4('0x31')]};});_0x4b6aad['model']=_[_0xebe4('0x2d')](_0x5902f5,_0xebe4('0x2b'));_0x4b6aad[_0xebe4('0x32')]=_[_0xebe4('0x33')](_0x2e6c05['query']);_0x4b6aad[_0xebe4('0x34')]=_[_0xebe4('0x35')](_0x4b6aad[_0xebe4('0x36')],_0x4b6aad[_0xebe4('0x32')]);_0x11cf5a['attributes']=_[_0xebe4('0x35')](_0x4b6aad[_0xebe4('0x36')],qs[_0xebe4('0x37')](_0x2e6c05['query']['fields']));_0x11cf5a[_0xebe4('0x38')]=_0x11cf5a[_0xebe4('0x38')][_0xebe4('0x39')]?_0x11cf5a[_0xebe4('0x38')]:_0x4b6aad[_0xebe4('0x36')];if(!_0x2e6c05[_0xebe4('0x32')][_0xebe4('0x3a')](_0xebe4('0x3b'))){_0x11cf5a[_0xebe4('0x20')]=qs[_0xebe4('0x20')](_0x2e6c05[_0xebe4('0x32')][_0xebe4('0x20')]);_0x11cf5a['offset']=qs[_0xebe4('0x22')](_0x2e6c05['query'][_0xebe4('0x22')]);}_0x11cf5a['order']=qs['sort'](_0x2e6c05[_0xebe4('0x32')][_0xebe4('0x3c')]);_0x11cf5a[_0xebe4('0x3d')]=qs[_0xebe4('0x34')](_[_0xebe4('0x3e')](_0x2e6c05[_0xebe4('0x32')],_0x4b6aad['filters']),_0x5902f5);if(_0x2e6c05[_0xebe4('0x32')][_0xebe4('0x3f')]){_0x11cf5a['where']=_[_0xebe4('0x40')](_0x11cf5a[_0xebe4('0x3d')],{'$or':_[_0xebe4('0x2d')](_0x5902f5,function(_0x3e272f){if(_0x3e272f[_0xebe4('0x30')]!==_0xebe4('0x41')){var _0xb43bbe={};_0xb43bbe[_0x3e272f[_0xebe4('0x2b')]]={'$like':'%'+_0x2e6c05[_0xebe4('0x32')][_0xebe4('0x3f')]+'%'};return _0xb43bbe;}})});}_0x11cf5a=_[_0xebe4('0x40')]({},_0x11cf5a,_0x2e6c05['options']);var _0x5c1904={'where':_0x11cf5a[_0xebe4('0x3d')]};return db['SugarcrmAccount'][_0xebe4('0x21')](_0x5c1904)[_0xebe4('0x27')](function(_0x2c65d8){_0x5d1f39[_0xebe4('0x21')]=_0x2c65d8;if(_0x2e6c05[_0xebe4('0x32')]['includeAll']){_0x11cf5a[_0xebe4('0x42')]=[{'all':!![]}];}return db[_0xebe4('0x2e')][_0xebe4('0x43')](_0x11cf5a);})['then'](function(_0x5bb589){_0x5d1f39['rows']=_0x5bb589;return _0x5d1f39;})[_0xebe4('0x27')](respondWithFilteredResult(_0x5b0c10,_0x11cf5a))[_0xebe4('0x44')](handleError(_0x5b0c10,null));};exports[_0xebe4('0x45')]=function(_0x1711bf,_0xdbcc23){var _0xb604f3={'raw':![],'where':{'id':_0x1711bf[_0xebe4('0x46')]['id']}},_0x5a81be={};_0x5a81be['model']=_[_0xebe4('0x33')](db[_0xebe4('0x2e')]['rawAttributes']);_0x5a81be['query']=_[_0xebe4('0x33')](_0x1711bf['query']);_0x5a81be[_0xebe4('0x34')]=_['intersection'](_0x5a81be['model'],_0x5a81be[_0xebe4('0x32')]);_0xb604f3['attributes']=_[_0xebe4('0x35')](_0x5a81be['model'],qs[_0xebe4('0x37')](_0x1711bf['query'][_0xebe4('0x37')]));_0xb604f3[_0xebe4('0x38')]=_0xb604f3[_0xebe4('0x38')][_0xebe4('0x39')]?_0xb604f3[_0xebe4('0x38')]:_0x5a81be[_0xebe4('0x36')];if(_0x1711bf[_0xebe4('0x32')]['includeAll']){_0xb604f3[_0xebe4('0x42')]=[{'all':!![]}];}_0xb604f3=_['merge']({},_0xb604f3,_0x1711bf['options']);return db['SugarcrmAccount']['find'](_0xb604f3)[_0xebe4('0x27')](handleEntityNotFound(_0xdbcc23,null))[_0xebe4('0x27')](respondWithResult(_0xdbcc23,null))[_0xebe4('0x44')](handleError(_0xdbcc23,null));};exports[_0xebe4('0x47')]=function(_0xb0525a,_0x4366cf){return db[_0xebe4('0x2e')][_0xebe4('0x47')](_0xb0525a[_0xebe4('0x48')],{})['then'](respondWithResult(_0x4366cf,0xc9))[_0xebe4('0x44')](handleError(_0x4366cf,null));};exports[_0xebe4('0x49')]=function(_0x307505,_0x46bba6){if(_0x307505[_0xebe4('0x48')]['id']){delete _0x307505[_0xebe4('0x48')]['id'];}return db[_0xebe4('0x2e')]['find']({'where':{'id':_0x307505['params']['id']}})[_0xebe4('0x27')](handleEntityNotFound(_0x46bba6,null))['then'](saveUpdates(_0x307505['body'],null))[_0xebe4('0x27')](respondWithResult(_0x46bba6,null))[_0xebe4('0x44')](handleError(_0x46bba6,null));};exports[_0xebe4('0x28')]=function(_0x2f4e58,_0x37fc5d){return db['SugarcrmAccount'][_0xebe4('0x4a')]({'where':{'id':_0x2f4e58['params']['id']}})[_0xebe4('0x27')](handleEntityNotFound(_0x37fc5d,null))[_0xebe4('0x27')](removeEntity(_0x37fc5d,null))['catch'](handleError(_0x37fc5d,null));};exports[_0xebe4('0x4b')]=function(_0xd92e64,_0x12eca1,_0x1bcfb0){var _0x1a6142={};var _0x581ab0={};var _0x108a4d;var _0x4a194c;return db[_0xebe4('0x2e')][_0xebe4('0x4c')]({'where':{'id':_0xd92e64['params']['id']}})['then'](handleEntityNotFound(_0x12eca1,null))[_0xebe4('0x27')](function(_0x2f0410){if(_0x2f0410){_0x108a4d=_0x2f0410;_0x581ab0['model']=_[_0xebe4('0x33')](db[_0xebe4('0x4d')]['rawAttributes']);_0x581ab0['query']=_[_0xebe4('0x33')](_0xd92e64['query']);_0x581ab0[_0xebe4('0x34')]=_[_0xebe4('0x35')](_0x581ab0[_0xebe4('0x36')],_0x581ab0['query']);_0x1a6142['attributes']=_[_0xebe4('0x35')](_0x581ab0[_0xebe4('0x36')],qs[_0xebe4('0x37')](_0xd92e64[_0xebe4('0x32')][_0xebe4('0x37')]));_0x1a6142[_0xebe4('0x38')]=_0x1a6142[_0xebe4('0x38')][_0xebe4('0x39')]?_0x1a6142[_0xebe4('0x38')]:_0x581ab0[_0xebe4('0x36')];_0x1a6142[_0xebe4('0x4e')]=qs[_0xebe4('0x3c')](_0xd92e64[_0xebe4('0x32')][_0xebe4('0x3c')]);_0x1a6142[_0xebe4('0x3d')]=qs[_0xebe4('0x34')](_[_0xebe4('0x3e')](_0xd92e64[_0xebe4('0x32')],_0x581ab0[_0xebe4('0x34')]));if(_0xd92e64['query'][_0xebe4('0x3f')]){_0x1a6142['where']=_[_0xebe4('0x40')](_0x1a6142[_0xebe4('0x3d')],{'$or':_[_0xebe4('0x2d')](_0x1a6142['attributes'],function(_0x22fdbd){var _0x23cb6a={};_0x23cb6a[_0x22fdbd]={'$like':'%'+_0xd92e64[_0xebe4('0x32')][_0xebe4('0x3f')]+'%'};return _0x23cb6a;})});}_0x1a6142=_[_0xebe4('0x40')]({},_0x1a6142,_0xd92e64[_0xebe4('0x4f')]);return _0x108a4d['getConfigurations'](_0x1a6142);}})['then'](function(_0x30bfcc){if(_0x30bfcc){_0x4a194c=_0x30bfcc[_0xebe4('0x39')];if(!_0xd92e64[_0xebe4('0x32')]['hasOwnProperty'](_0xebe4('0x3b'))){_0x1a6142['limit']=qs['limit'](_0xd92e64[_0xebe4('0x32')][_0xebe4('0x20')]);_0x1a6142[_0xebe4('0x22')]=qs[_0xebe4('0x22')](_0xd92e64['query']['offset']);}return _0x108a4d[_0xebe4('0x4b')](_0x1a6142);}})[_0xebe4('0x27')](function(_0x3bb966){if(_0x3bb966){return _0x3bb966?{'count':_0x4a194c,'rows':_0x3bb966}:null;}})[_0xebe4('0x27')](respondWithResult(_0x12eca1,null))[_0xebe4('0x44')](handleError(_0x12eca1,null));};exports['addConfiguration']=function(_0x24e0d1,_0x378a1d,_0x47eb77){if(_0x24e0d1[_0xebe4('0x48')]['id']){delete _0x24e0d1['body']['id'];}return db[_0xebe4('0x2e')][_0xebe4('0x4c')]({'where':{'id':_0x24e0d1[_0xebe4('0x46')]['id']}})[_0xebe4('0x27')](handleEntityNotFound(_0x378a1d,null))[_0xebe4('0x27')](function(_0x9075f){if(_0x9075f){_0x24e0d1[_0xebe4('0x48')][_0xebe4('0x50')]=_0x9075f['id'];_0x24e0d1[_0xebe4('0x48')][_0xebe4('0x51')]=integrations['getSubjects'](_0x24e0d1['body'][_0xebe4('0x52')],_0x24e0d1[_0xebe4('0x48')][_0xebe4('0x30')]);_0x24e0d1[_0xebe4('0x48')][_0xebe4('0x53')]=integrations[_0xebe4('0x54')](_0x24e0d1[_0xebe4('0x48')][_0xebe4('0x52')],_0x24e0d1[_0xebe4('0x48')][_0xebe4('0x30')]);return db['SugarcrmConfiguration'][_0xebe4('0x47')](_0x24e0d1['body'],{'include':[{'model':db[_0xebe4('0x55')],'as':_0xebe4('0x51')},{'model':db['SugarcrmField'],'as':_0xebe4('0x53')}]});}return null;})['then'](respondWithResult(_0x378a1d,null))[_0xebe4('0x44')](handleError(_0x378a1d,null));};exports[_0xebe4('0x56')]=function(_0x19a6fc,_0x5ec055,_0x48ae81){var _0x3eeb3d='';var _0x3f33a3=['id',_0xebe4('0x2b'),_0xebe4('0x57'),_0xebe4('0x58'),_0xebe4('0x59'),_0xebe4('0x5a'),_0xebe4('0x5b'),_0xebe4('0x5c'),_0xebe4('0x5d'),_0xebe4('0x5e'),_0xebe4('0x5f'),_0xebe4('0x60')];return db[_0xebe4('0x2e')]['findOne']({'where':{'id':_0x19a6fc['params']['id']},'attributes':['id',_0xebe4('0x61'),'password',_0xebe4('0x62')]})['then'](handleEntityNotFound(_0x5ec055,null))[_0xebe4('0x27')](function(_0xe1ad29){if(_0xe1ad29){_0x3eeb3d=_0xe1ad29[_0xebe4('0x62')];var _0x4b05a1=_0x3eeb3d[_0xebe4('0x63')](-0x1);if(_0x4b05a1==='/'){_0x3eeb3d=_0x3eeb3d[_0xebe4('0x64')](0x0,_0x3eeb3d[_0xebe4('0x65')](_0x4b05a1));}return rp({'method':'POST','uri':util[_0xebe4('0x66')](_0xebe4('0x67'),_0x3eeb3d,_0xebe4('0x68')),'json':!![],'form':{'method':_0xebe4('0x69'),'input_type':_0xebe4('0x6a'),'response_type':_0xebe4('0x6a'),'rest_data':JSON[_0xebe4('0x6b')]({'user_auth':{'user_name':_0xe1ad29['username'],'password':_0xe1ad29['password'],'encryption':_0xebe4('0x6c')},'application':_0xebe4('0x6d')})}});}})[_0xebe4('0x27')](function(_0x2723d2){if(_0x2723d2&&_0x2723d2[_0xebe4('0x2b')]!==_0xebe4('0x6e')&&_0x2723d2[_0xebe4('0x2b')]!=='Password\x20Expired'){return rp({'method':_0xebe4('0x6f'),'uri':util[_0xebe4('0x66')](_0xebe4('0x67'),_0x3eeb3d,_0xebe4('0x68')),'json':!![],'form':{'method':'get_module_fields','input_type':_0xebe4('0x6a'),'response_type':_0xebe4('0x6a'),'rest_data':JSON[_0xebe4('0x6b')]({'session':_0x2723d2['id'],'module_name':_0xebe4('0x70')})}})[_0xebe4('0x27')](function(_0x277584){if(_0x277584){var _0x5975fa=_[_0xebe4('0x71')](_0x277584[_0xebe4('0x72')]);_[_0xebe4('0x73')](_0x5975fa,function(_0x333fe1){return _0x3f33a3[_0xebe4('0x74')](_0x333fe1['name']);});return{'count':_0x5975fa['length'],'rows':_[_0xebe4('0x2d')](_0x5975fa,function(_0x3edd03){return{'id':_0x3edd03['name'],'name':_0x3edd03[_0xebe4('0x75')],'custom':_[_0xebe4('0x76')](_0x3edd03['name'],'_c')?!![]:![],'options':_0x3edd03[_0xebe4('0x4f')]?_['map'](_[_0xebe4('0x71')](_0x3edd03[_0xebe4('0x4f')]),function(_0x17ec1b){return{'name':_0x17ec1b['value'],'value':_0x17ec1b['name']};}):[]};})};}})[_0xebe4('0x27')](respondWithResult(_0x5ec055,null))[_0xebe4('0x44')](function(_0x495270){var _0x3f64f7=_0x19a6fc[_0xebe4('0x32')][_0xebe4('0x77')]?0x1f4:_0x495270['statusCode']||0x1f4;logger[_0xebe4('0x29')](_0xebe4('0x78'),'getFields',_0x3f64f7,JSON[_0xebe4('0x6b')](_0x495270));delete _0x495270[_0xebe4('0x2b')];if(_0x3f64f7===0x191){_0x3f64f7=0x190;}_0x5ec055[_0xebe4('0x1c')](_0x3f64f7)[_0xebe4('0x2c')](_0x19a6fc[_0xebe4('0x32')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x495270['statusCode']}:_0x495270);});}else{var _0x2fe2d5=0x1f4;_0x5ec055[_0xebe4('0x1c')](_0x2fe2d5)['send']({'message':_0xebe4('0x79'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x8eea=['get_module_fields','Calls','values','label','endsWith','value','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','eml-format','rimraf','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','json','save','update','then','destroy','error','name','send','index','map','SugarcrmAccount','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','getConfigurations','SugarcrmConfiguration','length','pick','addConfiguration','AccountId','Subjects','getDescriptions','SugarcrmField','Descriptions','getFields','assigned_user_id','created_by','description','duration_minutes','parent_id','parent_type','direction','findOne','password','remoteUri','slice','substring','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','username','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','POST'];(function(_0xeee152,_0xb9532){var _0x4e7d73=function(_0x28664a){while(--_0x28664a){_0xeee152['push'](_0xeee152['shift']());}};_0x4e7d73(++_0xb9532);}(_0x8eea,0x7e));var _0xa8ee=function(_0x1ebeea,_0x2f54f4){_0x1ebeea=_0x1ebeea-0x0;var _0x576465=_0x8eea[_0x1ebeea];return _0x576465;};'use strict';var emlformat=require(_0xa8ee('0x0'));var rimraf=require(_0xa8ee('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa8ee('0x2'));var moment=require('moment');var BPromise=require(_0xa8ee('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa8ee('0x4'));var sox=require(_0xa8ee('0x5'));var csv=require(_0xa8ee('0x6'));var ejs=require(_0xa8ee('0x7'));var fs=require('fs');var fs_extra=require(_0xa8ee('0x8'));var _=require(_0xa8ee('0x9'));var squel=require(_0xa8ee('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa8ee('0xb'));var toCsv=require(_0xa8ee('0x6'));var querystring=require('querystring');var Papa=require(_0xa8ee('0xc'));var Redis=require(_0xa8ee('0xd'));var authService=require(_0xa8ee('0xe'));var qs=require(_0xa8ee('0xf'));var as=require(_0xa8ee('0x10'));var hardwareService=require(_0xa8ee('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xa8ee('0x12'));var config=require(_0xa8ee('0x13'));var licenseUtil=require(_0xa8ee('0x14'));var db=require(_0xa8ee('0x15'))['db'];var integrations=require(_0xa8ee('0x16'));function respondWithStatusCode(_0x162031,_0xf918c){_0xf918c=_0xf918c||0xcc;return function(_0x33dc5d){if(_0x33dc5d){return _0x162031[_0xa8ee('0x17')](_0xf918c);}return _0x162031[_0xa8ee('0x18')](_0xf918c)[_0xa8ee('0x19')]();};}function respondWithResult(_0x1d65a8,_0xb6be63){_0xb6be63=_0xb6be63||0xc8;return function(_0x331967){if(_0x331967){return _0x1d65a8['status'](_0xb6be63)['json'](_0x331967);}};}function respondWithFilteredResult(_0x319ad8,_0x1666d3){return function(_0x2b4299){if(_0x2b4299){var _0x417125=typeof _0x1666d3[_0xa8ee('0x1a')]===_0xa8ee('0x1b')&&typeof _0x1666d3[_0xa8ee('0x1c')]==='undefined';var _0x4a456e=_0x2b4299[_0xa8ee('0x1d')];var _0x1e8641=_0x417125?0x0:_0x1666d3[_0xa8ee('0x1a')];var _0x396ca4=_0x417125?_0x2b4299[_0xa8ee('0x1d')]:_0x1666d3['offset']+_0x1666d3[_0xa8ee('0x1c')];var _0xba214a;if(_0x396ca4>=_0x4a456e){_0x396ca4=_0x4a456e;_0xba214a=0xc8;}else{_0xba214a=0xce;}_0x319ad8[_0xa8ee('0x18')](_0xba214a);return _0x319ad8[_0xa8ee('0x1e')]('Content-Range',_0x1e8641+'-'+_0x396ca4+'/'+_0x4a456e)[_0xa8ee('0x1f')](_0x2b4299);}return null;};}function patchUpdates(_0x2322e9){return function(_0x1e7133){try{jsonpatch['apply'](_0x1e7133,_0x2322e9,!![]);}catch(_0x30d08a){return BPromise['reject'](_0x30d08a);}return _0x1e7133[_0xa8ee('0x20')]();};}function saveUpdates(_0x58b5a0,_0x5169ce){return function(_0x49e26a){if(_0x49e26a){return _0x49e26a[_0xa8ee('0x21')](_0x58b5a0)[_0xa8ee('0x22')](function(_0x2a9912){return _0x2a9912;});}return null;};}function removeEntity(_0x22b6f7,_0x16e065){return function(_0x5d4882){if(_0x5d4882){return _0x5d4882[_0xa8ee('0x23')]()['then'](function(){_0x22b6f7[_0xa8ee('0x18')](0xcc)[_0xa8ee('0x19')]();});}};}function handleEntityNotFound(_0x7038fc,_0xcbd89b){return function(_0x5e275d){if(!_0x5e275d){_0x7038fc[_0xa8ee('0x17')](0x194);}return _0x5e275d;};}function handleError(_0x103fc6,_0x2e3a44){_0x2e3a44=_0x2e3a44||0x1f4;return function(_0x1d10bd){logger[_0xa8ee('0x24')](_0x1d10bd['stack']);if(_0x1d10bd[_0xa8ee('0x25')]){delete _0x1d10bd[_0xa8ee('0x25')];}_0x103fc6[_0xa8ee('0x18')](_0x2e3a44)[_0xa8ee('0x26')](_0x1d10bd);};}exports[_0xa8ee('0x27')]=function(_0x558b4a,_0x2d4570){var _0x4e3ace={},_0x91d49a={},_0x11a52f={'count':0x0,'rows':[]};var _0x572c76=_[_0xa8ee('0x28')](db[_0xa8ee('0x29')][_0xa8ee('0x2a')],function(_0x409195){return{'name':_0x409195[_0xa8ee('0x2b')],'type':_0x409195[_0xa8ee('0x2c')]['key']};});_0x91d49a[_0xa8ee('0x2d')]=_[_0xa8ee('0x28')](_0x572c76,_0xa8ee('0x25'));_0x91d49a['query']=_[_0xa8ee('0x2e')](_0x558b4a[_0xa8ee('0x2f')]);_0x91d49a[_0xa8ee('0x30')]=_[_0xa8ee('0x31')](_0x91d49a[_0xa8ee('0x2d')],_0x91d49a[_0xa8ee('0x2f')]);_0x4e3ace[_0xa8ee('0x32')]=_['intersection'](_0x91d49a[_0xa8ee('0x2d')],qs['fields'](_0x558b4a['query'][_0xa8ee('0x33')]));_0x4e3ace[_0xa8ee('0x32')]=_0x4e3ace[_0xa8ee('0x32')]['length']?_0x4e3ace['attributes']:_0x91d49a['model'];if(!_0x558b4a[_0xa8ee('0x2f')][_0xa8ee('0x34')](_0xa8ee('0x35'))){_0x4e3ace[_0xa8ee('0x1c')]=qs[_0xa8ee('0x1c')](_0x558b4a[_0xa8ee('0x2f')][_0xa8ee('0x1c')]);_0x4e3ace[_0xa8ee('0x1a')]=qs[_0xa8ee('0x1a')](_0x558b4a[_0xa8ee('0x2f')]['offset']);}_0x4e3ace[_0xa8ee('0x36')]=qs[_0xa8ee('0x37')](_0x558b4a[_0xa8ee('0x2f')]['sort']);_0x4e3ace[_0xa8ee('0x38')]=qs[_0xa8ee('0x30')](_['pick'](_0x558b4a['query'],_0x91d49a[_0xa8ee('0x30')]),_0x572c76);if(_0x558b4a[_0xa8ee('0x2f')]['filter']){_0x4e3ace[_0xa8ee('0x38')]=_['merge'](_0x4e3ace['where'],{'$or':_['map'](_0x572c76,function(_0x4b7cd7){if(_0x4b7cd7[_0xa8ee('0x2c')]!==_0xa8ee('0x39')){var _0xa279d1={};_0xa279d1[_0x4b7cd7[_0xa8ee('0x25')]]={'$like':'%'+_0x558b4a[_0xa8ee('0x2f')][_0xa8ee('0x3a')]+'%'};return _0xa279d1;}})});}_0x4e3ace=_[_0xa8ee('0x3b')]({},_0x4e3ace,_0x558b4a[_0xa8ee('0x3c')]);var _0x27c139={'where':_0x4e3ace[_0xa8ee('0x38')]};return db[_0xa8ee('0x29')][_0xa8ee('0x1d')](_0x27c139)[_0xa8ee('0x22')](function(_0x147bbc){_0x11a52f[_0xa8ee('0x1d')]=_0x147bbc;if(_0x558b4a['query'][_0xa8ee('0x3d')]){_0x4e3ace[_0xa8ee('0x3e')]=[{'all':!![]}];}return db[_0xa8ee('0x29')][_0xa8ee('0x3f')](_0x4e3ace);})[_0xa8ee('0x22')](function(_0x558ffe){_0x11a52f[_0xa8ee('0x40')]=_0x558ffe;return _0x11a52f;})['then'](respondWithFilteredResult(_0x2d4570,_0x4e3ace))[_0xa8ee('0x41')](handleError(_0x2d4570,null));};exports[_0xa8ee('0x42')]=function(_0x4f34ec,_0x1160ee){var _0x10c011={'raw':![],'where':{'id':_0x4f34ec['params']['id']}},_0x2dcc4b={};_0x2dcc4b['model']=_['keys'](db['SugarcrmAccount'][_0xa8ee('0x2a')]);_0x2dcc4b[_0xa8ee('0x2f')]=_[_0xa8ee('0x2e')](_0x4f34ec[_0xa8ee('0x2f')]);_0x2dcc4b[_0xa8ee('0x30')]=_[_0xa8ee('0x31')](_0x2dcc4b[_0xa8ee('0x2d')],_0x2dcc4b[_0xa8ee('0x2f')]);_0x10c011[_0xa8ee('0x32')]=_['intersection'](_0x2dcc4b[_0xa8ee('0x2d')],qs[_0xa8ee('0x33')](_0x4f34ec[_0xa8ee('0x2f')][_0xa8ee('0x33')]));_0x10c011[_0xa8ee('0x32')]=_0x10c011[_0xa8ee('0x32')]['length']?_0x10c011['attributes']:_0x2dcc4b['model'];if(_0x4f34ec['query'][_0xa8ee('0x3d')]){_0x10c011[_0xa8ee('0x3e')]=[{'all':!![]}];}_0x10c011=_['merge']({},_0x10c011,_0x4f34ec[_0xa8ee('0x3c')]);return db[_0xa8ee('0x29')][_0xa8ee('0x43')](_0x10c011)[_0xa8ee('0x22')](handleEntityNotFound(_0x1160ee,null))[_0xa8ee('0x22')](respondWithResult(_0x1160ee,null))[_0xa8ee('0x41')](handleError(_0x1160ee,null));};exports['create']=function(_0x2d753c,_0xf03ff8){return db[_0xa8ee('0x29')][_0xa8ee('0x44')](_0x2d753c[_0xa8ee('0x45')],{})[_0xa8ee('0x22')](respondWithResult(_0xf03ff8,0xc9))[_0xa8ee('0x41')](handleError(_0xf03ff8,null));};exports[_0xa8ee('0x21')]=function(_0xcb019c,_0x16d76c){if(_0xcb019c[_0xa8ee('0x45')]['id']){delete _0xcb019c['body']['id'];}return db[_0xa8ee('0x29')]['find']({'where':{'id':_0xcb019c['params']['id']}})[_0xa8ee('0x22')](handleEntityNotFound(_0x16d76c,null))[_0xa8ee('0x22')](saveUpdates(_0xcb019c[_0xa8ee('0x45')],null))['then'](respondWithResult(_0x16d76c,null))[_0xa8ee('0x41')](handleError(_0x16d76c,null));};exports[_0xa8ee('0x23')]=function(_0x1a73de,_0x560d35){return db[_0xa8ee('0x29')]['find']({'where':{'id':_0x1a73de[_0xa8ee('0x46')]['id']}})[_0xa8ee('0x22')](handleEntityNotFound(_0x560d35,null))[_0xa8ee('0x22')](removeEntity(_0x560d35,null))['catch'](handleError(_0x560d35,null));};exports[_0xa8ee('0x47')]=function(_0xee6f1,_0x95af68,_0x478b41){var _0x468ab3={};var _0x2d1d18={};var _0x53db07;var _0xb70776;return db[_0xa8ee('0x29')]['findOne']({'where':{'id':_0xee6f1[_0xa8ee('0x46')]['id']}})[_0xa8ee('0x22')](handleEntityNotFound(_0x95af68,null))['then'](function(_0x2294de){if(_0x2294de){_0x53db07=_0x2294de;_0x2d1d18[_0xa8ee('0x2d')]=_[_0xa8ee('0x2e')](db[_0xa8ee('0x48')][_0xa8ee('0x2a')]);_0x2d1d18[_0xa8ee('0x2f')]=_[_0xa8ee('0x2e')](_0xee6f1[_0xa8ee('0x2f')]);_0x2d1d18[_0xa8ee('0x30')]=_[_0xa8ee('0x31')](_0x2d1d18[_0xa8ee('0x2d')],_0x2d1d18[_0xa8ee('0x2f')]);_0x468ab3[_0xa8ee('0x32')]=_[_0xa8ee('0x31')](_0x2d1d18[_0xa8ee('0x2d')],qs[_0xa8ee('0x33')](_0xee6f1[_0xa8ee('0x2f')][_0xa8ee('0x33')]));_0x468ab3[_0xa8ee('0x32')]=_0x468ab3['attributes'][_0xa8ee('0x49')]?_0x468ab3[_0xa8ee('0x32')]:_0x2d1d18[_0xa8ee('0x2d')];_0x468ab3[_0xa8ee('0x36')]=qs['sort'](_0xee6f1[_0xa8ee('0x2f')]['sort']);_0x468ab3[_0xa8ee('0x38')]=qs[_0xa8ee('0x30')](_[_0xa8ee('0x4a')](_0xee6f1[_0xa8ee('0x2f')],_0x2d1d18[_0xa8ee('0x30')]));if(_0xee6f1[_0xa8ee('0x2f')][_0xa8ee('0x3a')]){_0x468ab3[_0xa8ee('0x38')]=_[_0xa8ee('0x3b')](_0x468ab3[_0xa8ee('0x38')],{'$or':_[_0xa8ee('0x28')](_0x468ab3['attributes'],function(_0x4df11c){var _0x4835ae={};_0x4835ae[_0x4df11c]={'$like':'%'+_0xee6f1[_0xa8ee('0x2f')][_0xa8ee('0x3a')]+'%'};return _0x4835ae;})});}_0x468ab3=_['merge']({},_0x468ab3,_0xee6f1[_0xa8ee('0x3c')]);return _0x53db07['getConfigurations'](_0x468ab3);}})[_0xa8ee('0x22')](function(_0x67156a){if(_0x67156a){_0xb70776=_0x67156a['length'];if(!_0xee6f1['query'][_0xa8ee('0x34')](_0xa8ee('0x35'))){_0x468ab3['limit']=qs[_0xa8ee('0x1c')](_0xee6f1['query']['limit']);_0x468ab3[_0xa8ee('0x1a')]=qs[_0xa8ee('0x1a')](_0xee6f1[_0xa8ee('0x2f')][_0xa8ee('0x1a')]);}return _0x53db07[_0xa8ee('0x47')](_0x468ab3);}})[_0xa8ee('0x22')](function(_0x33008b){if(_0x33008b){return _0x33008b?{'count':_0xb70776,'rows':_0x33008b}:null;}})[_0xa8ee('0x22')](respondWithResult(_0x95af68,null))['catch'](handleError(_0x95af68,null));};exports[_0xa8ee('0x4b')]=function(_0x18272c,_0x37cf78,_0x49468c){if(_0x18272c[_0xa8ee('0x45')]['id']){delete _0x18272c[_0xa8ee('0x45')]['id'];}return db['SugarcrmAccount']['findOne']({'where':{'id':_0x18272c[_0xa8ee('0x46')]['id']}})[_0xa8ee('0x22')](handleEntityNotFound(_0x37cf78,null))[_0xa8ee('0x22')](function(_0x2686e4){if(_0x2686e4){_0x18272c[_0xa8ee('0x45')][_0xa8ee('0x4c')]=_0x2686e4['id'];_0x18272c[_0xa8ee('0x45')][_0xa8ee('0x4d')]=integrations['getSubjects'](_0x18272c['body']['channel'],_0x18272c['body'][_0xa8ee('0x2c')]);_0x18272c[_0xa8ee('0x45')]['Descriptions']=integrations[_0xa8ee('0x4e')](_0x18272c['body']['channel'],_0x18272c[_0xa8ee('0x45')][_0xa8ee('0x2c')]);return db[_0xa8ee('0x48')][_0xa8ee('0x44')](_0x18272c[_0xa8ee('0x45')],{'include':[{'model':db[_0xa8ee('0x4f')],'as':'Subjects'},{'model':db['SugarcrmField'],'as':_0xa8ee('0x50')}]});}return null;})[_0xa8ee('0x22')](respondWithResult(_0x37cf78,null))[_0xa8ee('0x41')](handleError(_0x37cf78,null));};exports[_0xa8ee('0x51')]=function(_0x1c230e,_0x5bf63d,_0x1bd1ea){var _0x57df6a='';var _0x2a131a=['id',_0xa8ee('0x25'),_0xa8ee('0x52'),_0xa8ee('0x53'),_0xa8ee('0x54'),'date_start','duration_hours',_0xa8ee('0x55'),_0xa8ee('0x56'),_0xa8ee('0x57'),'parent_name',_0xa8ee('0x58')];return db['SugarcrmAccount'][_0xa8ee('0x59')]({'where':{'id':_0x1c230e[_0xa8ee('0x46')]['id']},'attributes':['id','username',_0xa8ee('0x5a'),_0xa8ee('0x5b')]})['then'](handleEntityNotFound(_0x5bf63d,null))[_0xa8ee('0x22')](function(_0x385cd1){if(_0x385cd1){_0x57df6a=_0x385cd1['remoteUri'];var _0xbbc638=_0x57df6a[_0xa8ee('0x5c')](-0x1);if(_0xbbc638==='/'){_0x57df6a=_0x57df6a[_0xa8ee('0x5d')](0x0,_0x57df6a['lastIndexOf'](_0xbbc638));}return rp({'method':'POST','uri':util[_0xa8ee('0x5e')](_0xa8ee('0x5f'),_0x57df6a,_0xa8ee('0x60')),'json':!![],'form':{'method':_0xa8ee('0x61'),'input_type':_0xa8ee('0x62'),'response_type':_0xa8ee('0x62'),'rest_data':JSON[_0xa8ee('0x63')]({'user_auth':{'user_name':_0x385cd1[_0xa8ee('0x64')],'password':_0x385cd1['password'],'encryption':_0xa8ee('0x65')},'application':_0xa8ee('0x66')})}});}})[_0xa8ee('0x22')](function(_0x4009ef){if(_0x4009ef&&_0x4009ef[_0xa8ee('0x25')]!==_0xa8ee('0x67')&&_0x4009ef[_0xa8ee('0x25')]!==_0xa8ee('0x68')){return rp({'method':_0xa8ee('0x69'),'uri':util['format']('%s%s',_0x57df6a,_0xa8ee('0x60')),'json':!![],'form':{'method':_0xa8ee('0x6a'),'input_type':_0xa8ee('0x62'),'response_type':_0xa8ee('0x62'),'rest_data':JSON['stringify']({'session':_0x4009ef['id'],'module_name':_0xa8ee('0x6b')})}})[_0xa8ee('0x22')](function(_0x277299){if(_0x277299){var _0x405d1a=_[_0xa8ee('0x6c')](_0x277299['module_fields']);_['remove'](_0x405d1a,function(_0x42d765){return _0x2a131a['includes'](_0x42d765[_0xa8ee('0x25')]);});return{'count':_0x405d1a['length'],'rows':_[_0xa8ee('0x28')](_0x405d1a,function(_0x1cb1c8){return{'id':_0x1cb1c8[_0xa8ee('0x25')],'name':_0x1cb1c8[_0xa8ee('0x6d')],'custom':_[_0xa8ee('0x6e')](_0x1cb1c8['name'],'_c')?!![]:![],'options':_0x1cb1c8['options']?_[_0xa8ee('0x28')](_[_0xa8ee('0x6c')](_0x1cb1c8[_0xa8ee('0x3c')]),function(_0x3ff0e4){return{'name':_0x3ff0e4[_0xa8ee('0x6f')],'value':_0x3ff0e4[_0xa8ee('0x25')]};}):[]};})};}})[_0xa8ee('0x22')](respondWithResult(_0x5bf63d,null))[_0xa8ee('0x41')](function(_0x289304){var _0x37e18b=_0x1c230e[_0xa8ee('0x2f')][_0xa8ee('0x70')]?0x1f4:_0x289304['statusCode']||0x1f4;logger['error'](_0xa8ee('0x71'),_0xa8ee('0x51'),_0x37e18b,JSON[_0xa8ee('0x63')](_0x289304));delete _0x289304[_0xa8ee('0x25')];if(_0x37e18b===0x191){_0x37e18b=0x190;}_0x5bf63d[_0xa8ee('0x18')](_0x37e18b)[_0xa8ee('0x26')](_0x1c230e[_0xa8ee('0x2f')][_0xa8ee('0x70')]?{'message':_0xa8ee('0x72'),'statusCode':_0x289304[_0xa8ee('0x73')]}:_0x289304);});}else{var _0xfce930=0x1f4;_0x5bf63d[_0xa8ee('0x18')](_0xfce930)[_0xa8ee('0x26')]({'message':_0xa8ee('0x72'),'statusCode':0x190});}});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js index 0aa4b6e..cfa0a0d 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 _0x758a=['exports','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','api','moment','bluebird','../../config/environment','../../components/integrations/configuration'];(function(_0x15ebd0,_0x5354df){var _0x239bf3=function(_0x250ac9){while(--_0x250ac9){_0x15ebd0['push'](_0x15ebd0['shift']());}};_0x239bf3(++_0x5354df);}(_0x758a,0x1d1));var _0xa758=function(_0x383461,_0x21eadc){_0x383461=_0x383461-0x0;var _0x298be9=_0x758a[_0x383461];return _0x298be9;};'use strict';var _=require(_0xa758('0x0'));var util=require(_0xa758('0x1'));var logger=require(_0xa758('0x2'))(_0xa758('0x3'));var moment=require(_0xa758('0x4'));var BPromise=require(_0xa758('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa758('0x6'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0xa758('0x7'));module[_0xa758('0x8')]=function(_0x1c13d4,_0x57bdd1){return _0x1c13d4['define'](_0xa758('0x9'),attributes,{'tableName':_0xa758('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbfeb=['define','SugarcrmAccount','int_sugarcrm_accounts','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x35a62d,_0x2fc11c){var _0x37b401=function(_0x195195){while(--_0x195195){_0x35a62d['push'](_0x35a62d['shift']());}};_0x37b401(++_0x2fc11c);}(_0xbfeb,0x1c3));var _0xbbfe=function(_0x55ded6,_0xb21985){_0x55ded6=_0x55ded6-0x0;var _0x357f3d=_0xbfeb[_0x55ded6];return _0x357f3d;};'use strict';var _=require('lodash');var util=require(_0xbbfe('0x0'));var logger=require(_0xbbfe('0x1'))(_0xbbfe('0x2'));var moment=require(_0xbbfe('0x3'));var BPromise=require('bluebird');var rp=require(_0xbbfe('0x4'));var fs=require('fs');var path=require(_0xbbfe('0x5'));var rimraf=require(_0xbbfe('0x6'));var config=require(_0xbbfe('0x7'));var attributes=require(_0xbbfe('0x8'));var integrations=require(_0xbbfe('0x9'));module[_0xbbfe('0xa')]=function(_0x18db08,_0x32600e){return _0x18db08[_0xbbfe('0xb')](_0xbbfe('0xc'),attributes,{'tableName':_0xbbfe('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index 432e2ee..1a28658 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 _0x437a=['limit','include','attributes','model','map','ShowSugarcrmAccount','find','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmAccount,\x20%s,\x20%s','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','where'];(function(_0x24cdba,_0x6725ba){var _0x21c413=function(_0x46051a){while(--_0x46051a){_0x24cdba['push'](_0x24cdba['shift']());}};_0x21c413(++_0x6725ba);}(_0x437a,0x1f2));var _0xa437=function(_0x229f8d,_0x48402c){_0x229f8d=_0x229f8d-0x0;var _0x3e193c=_0x437a[_0x229f8d];return _0x3e193c;};'use strict';var _=require(_0xa437('0x0'));var util=require('util');var moment=require(_0xa437('0x1'));var BPromise=require(_0xa437('0x2'));var rs=require(_0xa437('0x3'));var fs=require('fs');var Redis=require(_0xa437('0x4'));var db=require(_0xa437('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xa437('0x6'));var jayson=require(_0xa437('0x7'));var client=jayson[_0xa437('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a5801,_0x48aeb1,_0x2af7dd){return new BPromise(function(_0x116145,_0x536aa3){return client[_0xa437('0x9')](_0x1a5801,_0x2af7dd)[_0xa437('0xa')](function(_0x5b7793){logger[_0xa437('0xb')]('SugarcrmAccount,\x20%s,\x20%s',_0x48aeb1,_0xa437('0xc'));logger[_0xa437('0xd')](_0xa437('0xe'),_0x48aeb1,_0xa437('0xc'),JSON[_0xa437('0xf')](_0x5b7793));if(_0x5b7793[_0xa437('0x10')]){if(_0x5b7793['error'][_0xa437('0x11')]===0x1f4){logger[_0xa437('0x10')](_0xa437('0x12'),_0x48aeb1,_0x5b7793[_0xa437('0x10')][_0xa437('0x13')]);return _0x536aa3(_0x5b7793[_0xa437('0x10')][_0xa437('0x13')]);}logger[_0xa437('0x10')](_0xa437('0x12'),_0x48aeb1,_0x5b7793[_0xa437('0x10')]['message']);return _0x116145(_0x5b7793[_0xa437('0x10')]['message']);}else{logger[_0xa437('0xb')](_0xa437('0x12'),_0x48aeb1,_0xa437('0xc'));_0x116145(_0x5b7793[_0xa437('0x14')][_0xa437('0x13')]);}})[_0xa437('0x15')](function(_0x3d9839){logger[_0xa437('0x10')](_0xa437('0x12'),_0x48aeb1,_0x3d9839);_0x536aa3(_0x3d9839);});});}exports[_0xa437('0x16')]=function(_0x4d82a8){var _0x4756ca=this;return new Promise(function(_0x2efd5a,_0x5c5648){return db[_0xa437('0x17')][_0xa437('0x18')]({'raw':_0x4d82a8[_0xa437('0x19')]?_0x4d82a8['options']['raw']===undefined?!![]:![]:!![],'where':_0x4d82a8[_0xa437('0x19')]?_0x4d82a8[_0xa437('0x19')][_0xa437('0x1a')]||null:null,'attributes':_0x4d82a8['options']?_0x4d82a8[_0xa437('0x19')]['attributes']||null:null,'limit':_0x4d82a8[_0xa437('0x19')]?_0x4d82a8[_0xa437('0x19')][_0xa437('0x1b')]||null:null,'include':_0x4d82a8['options']?_0x4d82a8[_0xa437('0x19')][_0xa437('0x1c')]?_['map'](_0x4d82a8[_0xa437('0x19')][_0xa437('0x1c')],function(_0x58aa00){return{'model':db[_0x58aa00['model']],'as':_0x58aa00['as'],'attributes':_0x58aa00[_0xa437('0x1d')],'include':_0x58aa00[_0xa437('0x1c')]?_['map'](_0x58aa00[_0xa437('0x1c')],function(_0x94aaba){return{'model':db[_0x94aaba[_0xa437('0x1e')]],'as':_0x94aaba['as'],'attributes':_0x94aaba[_0xa437('0x1d')],'include':_0x94aaba['include']?_[_0xa437('0x1f')](_0x94aaba[_0xa437('0x1c')],function(_0x3da1e0){return{'model':db[_0x3da1e0[_0xa437('0x1e')]],'as':_0x3da1e0['as'],'attributes':_0x3da1e0[_0xa437('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xa437('0xa')](function(_0x1ddee8){logger[_0xa437('0xb')](_0xa437('0x16'),_0x4d82a8);logger['debug'](_0xa437('0x16'),_0x4d82a8,JSON[_0xa437('0xf')](_0x1ddee8));_0x2efd5a(_0x1ddee8);})[_0xa437('0x15')](function(_0x3c0417){logger[_0xa437('0x10')](_0xa437('0x16'),_0x3c0417['message'],_0x4d82a8);_0x5c5648(_0x4756ca[_0xa437('0x10')](0x1f4,_0x3c0417[_0xa437('0x13')]));});});};exports[_0xa437('0x20')]=function(_0x28182b){var _0x299f4f=this;return new Promise(function(_0x17e385,_0x48fa05){return db[_0xa437('0x17')][_0xa437('0x21')]({'raw':_0x28182b['options']?_0x28182b[_0xa437('0x19')][_0xa437('0x22')]===undefined?!![]:![]:!![],'where':_0x28182b['options']?_0x28182b[_0xa437('0x19')]['where']||null:null,'attributes':_0x28182b['options']?_0x28182b[_0xa437('0x19')]['attributes']||null:null,'include':_0x28182b[_0xa437('0x19')]?_0x28182b['options'][_0xa437('0x1c')]?_[_0xa437('0x1f')](_0x28182b[_0xa437('0x19')]['include'],function(_0x5daf9c){return{'model':db[_0x5daf9c[_0xa437('0x1e')]],'as':_0x5daf9c['as'],'attributes':_0x5daf9c[_0xa437('0x1d')],'include':_0x5daf9c[_0xa437('0x1c')]?_[_0xa437('0x1f')](_0x5daf9c[_0xa437('0x1c')],function(_0x29a8c1){return{'model':db[_0x29a8c1[_0xa437('0x1e')]],'as':_0x29a8c1['as'],'attributes':_0x29a8c1[_0xa437('0x1d')],'include':_0x29a8c1[_0xa437('0x1c')]?_[_0xa437('0x1f')](_0x29a8c1[_0xa437('0x1c')],function(_0x38f1ea){return{'model':db[_0x38f1ea[_0xa437('0x1e')]],'as':_0x38f1ea['as'],'attributes':_0x38f1ea['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x47109f){logger['info'](_0xa437('0x20'),_0x28182b);logger['debug'](_0xa437('0x20'),_0x28182b,JSON[_0xa437('0xf')](_0x47109f));_0x17e385(_0x47109f);})[_0xa437('0x15')](function(_0x5013cd){logger[_0xa437('0x10')](_0xa437('0x20'),_0x5013cd['message'],_0x28182b);_0x48fa05(_0x299f4f[_0xa437('0x10')](0x1f4,_0x5013cd[_0xa437('0x13')]));});});}; \ No newline at end of file +var _0xf912=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetSugarcrmAccount','findAll','options','raw','attributes','map','include','model','ShowSugarcrmAccount','SugarcrmAccount','find','where','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x3ba603,_0x58cb58){var _0x1afc1a=function(_0x2b6b9a){while(--_0x2b6b9a){_0x3ba603['push'](_0x3ba603['shift']());}};_0x1afc1a(++_0x58cb58);}(_0xf912,0x112));var _0x2f91=function(_0x4f7449,_0x407356){_0x4f7449=_0x4f7449-0x0;var _0x21e3cb=_0xf912[_0x4f7449];return _0x21e3cb;};'use strict';var _=require(_0x2f91('0x0'));var util=require(_0x2f91('0x1'));var moment=require(_0x2f91('0x2'));var BPromise=require('bluebird');var rs=require(_0x2f91('0x3'));var fs=require('fs');var Redis=require(_0x2f91('0x4'));var db=require(_0x2f91('0x5'))['db'];var utils=require(_0x2f91('0x6'));var logger=require(_0x2f91('0x7'))(_0x2f91('0x8'));var config=require(_0x2f91('0x9'));var jayson=require(_0x2f91('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x11795d,_0x3bb3e4,_0x17257d){return new BPromise(function(_0x1d9a90,_0x552466){return client[_0x2f91('0xb')](_0x11795d,_0x17257d)[_0x2f91('0xc')](function(_0x780aaa){logger[_0x2f91('0xd')](_0x2f91('0xe'),_0x3bb3e4,_0x2f91('0xf'));logger[_0x2f91('0x10')](_0x2f91('0x11'),_0x3bb3e4,_0x2f91('0xf'),JSON[_0x2f91('0x12')](_0x780aaa));if(_0x780aaa[_0x2f91('0x13')]){if(_0x780aaa[_0x2f91('0x13')][_0x2f91('0x14')]===0x1f4){logger[_0x2f91('0x13')](_0x2f91('0xe'),_0x3bb3e4,_0x780aaa[_0x2f91('0x13')][_0x2f91('0x15')]);return _0x552466(_0x780aaa['error'][_0x2f91('0x15')]);}logger[_0x2f91('0x13')](_0x2f91('0xe'),_0x3bb3e4,_0x780aaa['error']['message']);return _0x1d9a90(_0x780aaa[_0x2f91('0x13')][_0x2f91('0x15')]);}else{logger['info'](_0x2f91('0xe'),_0x3bb3e4,_0x2f91('0xf'));_0x1d9a90(_0x780aaa['result'][_0x2f91('0x15')]);}})[_0x2f91('0x16')](function(_0x1633a3){logger[_0x2f91('0x13')](_0x2f91('0xe'),_0x3bb3e4,_0x1633a3);_0x552466(_0x1633a3);});});}exports[_0x2f91('0x17')]=function(_0x3a2b7c){var _0x2cdfd3=this;return new Promise(function(_0x465cc0,_0x579511){return db['SugarcrmAccount'][_0x2f91('0x18')]({'raw':_0x3a2b7c[_0x2f91('0x19')]?_0x3a2b7c[_0x2f91('0x19')][_0x2f91('0x1a')]===undefined?!![]:![]:!![],'where':_0x3a2b7c['options']?_0x3a2b7c['options']['where']||null:null,'attributes':_0x3a2b7c[_0x2f91('0x19')]?_0x3a2b7c[_0x2f91('0x19')][_0x2f91('0x1b')]||null:null,'limit':_0x3a2b7c[_0x2f91('0x19')]?_0x3a2b7c['options']['limit']||null:null,'include':_0x3a2b7c[_0x2f91('0x19')]?_0x3a2b7c['options']['include']?_[_0x2f91('0x1c')](_0x3a2b7c['options'][_0x2f91('0x1d')],function(_0x3b9bf1){return{'model':db[_0x3b9bf1['model']],'as':_0x3b9bf1['as'],'attributes':_0x3b9bf1[_0x2f91('0x1b')],'include':_0x3b9bf1[_0x2f91('0x1d')]?_[_0x2f91('0x1c')](_0x3b9bf1['include'],function(_0x1f48c3){return{'model':db[_0x1f48c3['model']],'as':_0x1f48c3['as'],'attributes':_0x1f48c3['attributes'],'include':_0x1f48c3[_0x2f91('0x1d')]?_['map'](_0x1f48c3['include'],function(_0x511412){return{'model':db[_0x511412[_0x2f91('0x1e')]],'as':_0x511412['as'],'attributes':_0x511412[_0x2f91('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x2f91('0xc')](function(_0x5ac1e7){logger[_0x2f91('0xd')](_0x2f91('0x17'),_0x3a2b7c);logger['debug'](_0x2f91('0x17'),_0x3a2b7c,JSON[_0x2f91('0x12')](_0x5ac1e7));_0x465cc0(_0x5ac1e7);})[_0x2f91('0x16')](function(_0x15fce7){logger[_0x2f91('0x13')]('GetSugarcrmAccount',_0x15fce7[_0x2f91('0x15')],_0x3a2b7c);_0x579511(_0x2cdfd3[_0x2f91('0x13')](0x1f4,_0x15fce7[_0x2f91('0x15')]));});});};exports[_0x2f91('0x1f')]=function(_0x15859d){var _0x51e2b4=this;return new Promise(function(_0x3b837b,_0x1bc6da){return db[_0x2f91('0x20')][_0x2f91('0x21')]({'raw':_0x15859d['options']?_0x15859d['options']['raw']===undefined?!![]:![]:!![],'where':_0x15859d['options']?_0x15859d['options'][_0x2f91('0x22')]||null:null,'attributes':_0x15859d[_0x2f91('0x19')]?_0x15859d[_0x2f91('0x19')][_0x2f91('0x1b')]||null:null,'include':_0x15859d[_0x2f91('0x19')]?_0x15859d[_0x2f91('0x19')]['include']?_[_0x2f91('0x1c')](_0x15859d[_0x2f91('0x19')][_0x2f91('0x1d')],function(_0x3735f7){return{'model':db[_0x3735f7[_0x2f91('0x1e')]],'as':_0x3735f7['as'],'attributes':_0x3735f7['attributes'],'include':_0x3735f7[_0x2f91('0x1d')]?_[_0x2f91('0x1c')](_0x3735f7[_0x2f91('0x1d')],function(_0x1e4c91){return{'model':db[_0x1e4c91[_0x2f91('0x1e')]],'as':_0x1e4c91['as'],'attributes':_0x1e4c91[_0x2f91('0x1b')],'include':_0x1e4c91[_0x2f91('0x1d')]?_[_0x2f91('0x1c')](_0x1e4c91[_0x2f91('0x1d')],function(_0x500722){return{'model':db[_0x500722[_0x2f91('0x1e')]],'as':_0x500722['as'],'attributes':_0x500722[_0x2f91('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x2f91('0xc')](function(_0x5cc2e6){logger[_0x2f91('0xd')](_0x2f91('0x1f'),_0x15859d);logger['debug'](_0x2f91('0x1f'),_0x15859d,JSON[_0x2f91('0x12')](_0x5cc2e6));_0x3b837b(_0x5cc2e6);})[_0x2f91('0x16')](function(_0x23eb30){logger[_0x2f91('0x13')](_0x2f91('0x1f'),_0x23eb30['message'],_0x15859d);_0x1bc6da(_0x51e2b4[_0x2f91('0x13')](0x1f4,_0x23eb30[_0x2f91('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 3807993..d4a9580 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 _0x047f=['isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','create','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id'];(function(_0x32d124,_0x4d7a1d){var _0x613e0b=function(_0x5998ec){while(--_0x5998ec){_0x32d124['push'](_0x32d124['shift']());}};_0x613e0b(++_0x4d7a1d);}(_0x047f,0xfc));var _0xf047=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x047f[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xf047('0x0'));var util=require(_0xf047('0x1'));var path=require(_0xf047('0x2'));var timeout=require(_0xf047('0x3'));var express=require('express');var router=express[_0xf047('0x4')]();var fs_extra=require(_0xf047('0x5'));var auth=require(_0xf047('0x6'));var interaction=require(_0xf047('0x7'));var config=require(_0xf047('0x8'));var controller=require('./intSugarcrmConfiguration.controller');router[_0xf047('0x9')]('/',auth['isAuthenticated'](),controller[_0xf047('0xa')]);router[_0xf047('0x9')](_0xf047('0xb'),auth[_0xf047('0xc')](),controller[_0xf047('0xd')]);router[_0xf047('0x9')](_0xf047('0xe'),auth['isAuthenticated'](),controller[_0xf047('0xf')]);router['get'](_0xf047('0x10'),auth[_0xf047('0xc')](),controller[_0xf047('0x11')]);router[_0xf047('0x9')]('/:id/descriptions',auth[_0xf047('0xc')](),controller[_0xf047('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0xf047('0x13')]);router[_0xf047('0x14')]('/:id',auth[_0xf047('0xc')](),controller[_0xf047('0x15')]);router['delete'](_0xf047('0xb'),auth[_0xf047('0xc')](),controller[_0xf047('0x16')]);module[_0xf047('0x17')]=router; \ No newline at end of file +var _0x8b26=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','update','delete','destroy','multer','util','path','express','Router'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8b26,0x1f3));var _0x68b2=function(_0x355c42,_0x9e37fb){_0x355c42=_0x355c42-0x0;var _0x5795f6=_0x8b26[_0x355c42];return _0x5795f6;};'use strict';var multer=require(_0x68b2('0x0'));var util=require(_0x68b2('0x1'));var path=require(_0x68b2('0x2'));var timeout=require('connect-timeout');var express=require(_0x68b2('0x3'));var router=express[_0x68b2('0x4')]();var fs_extra=require(_0x68b2('0x5'));var auth=require(_0x68b2('0x6'));var interaction=require(_0x68b2('0x7'));var config=require(_0x68b2('0x8'));var controller=require(_0x68b2('0x9'));router[_0x68b2('0xa')]('/',auth[_0x68b2('0xb')](),controller[_0x68b2('0xc')]);router['get'](_0x68b2('0xd'),auth[_0x68b2('0xb')](),controller[_0x68b2('0xe')]);router[_0x68b2('0xa')]('/:id/fields',auth[_0x68b2('0xb')](),controller['getFields']);router['get'](_0x68b2('0xf'),auth[_0x68b2('0xb')](),controller[_0x68b2('0x10')]);router['get'](_0x68b2('0x11'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x68b2('0x12')]('/',auth[_0x68b2('0xb')](),controller[_0x68b2('0x13')]);router[_0x68b2('0x14')](_0x68b2('0xd'),auth[_0x68b2('0xb')](),controller[_0x68b2('0x15')]);router[_0x68b2('0x16')](_0x68b2('0xd'),auth[_0x68b2('0xb')](),controller[_0x68b2('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index b9f076e..c2a5334 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 _0x3e26=['exports','STRING','sequelize'];(function(_0x20b504,_0x329d95){var _0x2cf438=function(_0x122f75){while(--_0x122f75){_0x20b504['push'](_0x20b504['shift']());}};_0x2cf438(++_0x329d95);}(_0x3e26,0xd4));var _0x63e2=function(_0x570729,_0x16789c){_0x570729=_0x570729-0x0;var _0x1da797=_0x3e26[_0x570729];return _0x1da797;};'use strict';var Sequelize=require(_0x63e2('0x0'));module[_0x63e2('0x1')]={'name':{'type':Sequelize[_0x63e2('0x2')]},'description':{'type':Sequelize[_0x63e2('0x2')]}}; \ No newline at end of file +var _0x4014=['exports','STRING','sequelize'];(function(_0x9c3c56,_0x169b56){var _0x2dd782=function(_0x386962){while(--_0x386962){_0x9c3c56['push'](_0x9c3c56['shift']());}};_0x2dd782(++_0x169b56);}(_0x4014,0x9e));var _0x4401=function(_0x9dfc10,_0x19c2d5){_0x9dfc10=_0x9dfc10-0x0;var _0x4f938a=_0x4014[_0x9dfc10];return _0x4f938a;};'use strict';var Sequelize=require(_0x4401('0x0'));module[_0x4401('0x1')]={'name':{'type':Sequelize[_0x4401('0x2')]},'description':{'type':Sequelize[_0x4401('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 6a41443..95399cd 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 _0xe48b=['name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','SugarcrmConfiguration','includeAll','include','findAll','rows','catch','show','params','keys','create','body','find','getFields','findOne','SugarcrmField','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error'];(function(_0xd2b873,_0xc29a0b){var _0x588ff5=function(_0x56331f){while(--_0x56331f){_0xd2b873['push'](_0xd2b873['shift']());}};_0x588ff5(++_0xc29a0b);}(_0xe48b,0xcd));var _0xbe48=function(_0x44e208,_0x1d9689){_0x44e208=_0x44e208-0x0;var _0x43ca9a=_0xe48b[_0x44e208];return _0x43ca9a;};'use strict';var emlformat=require(_0xbe48('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbe48('0x1'));var jsonpatch=require(_0xbe48('0x2'));var rp=require('request-promise');var moment=require(_0xbe48('0x3'));var BPromise=require(_0xbe48('0x4'));var Mustache=require('mustache');var util=require(_0xbe48('0x5'));var path=require(_0xbe48('0x6'));var sox=require('sox');var csv=require(_0xbe48('0x7'));var ejs=require(_0xbe48('0x8'));var fs=require('fs');var fs_extra=require(_0xbe48('0x9'));var _=require(_0xbe48('0xa'));var squel=require(_0xbe48('0xb'));var crypto=require(_0xbe48('0xc'));var jsforce=require(_0xbe48('0xd'));var deskjs=require(_0xbe48('0xe'));var toCsv=require(_0xbe48('0x7'));var querystring=require(_0xbe48('0xf'));var Papa=require(_0xbe48('0x10'));var Redis=require(_0xbe48('0x11'));var authService=require(_0xbe48('0x12'));var qs=require(_0xbe48('0x13'));var as=require(_0xbe48('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbe48('0x15'));var utils=require(_0xbe48('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xbe48('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ef12c,_0x226416){_0x226416=_0x226416||0xcc;return function(_0x50c5f3){if(_0x50c5f3){return _0x3ef12c[_0xbe48('0x18')](_0x226416);}return _0x3ef12c[_0xbe48('0x19')](_0x226416)['end']();};}function respondWithResult(_0x139630,_0x16ffe3){_0x16ffe3=_0x16ffe3||0xc8;return function(_0x129801){if(_0x129801){return _0x139630[_0xbe48('0x19')](_0x16ffe3)[_0xbe48('0x1a')](_0x129801);}};}function respondWithFilteredResult(_0x1c23f0,_0x166758){return function(_0x763848){if(_0x763848){var _0x314f66=typeof _0x166758[_0xbe48('0x1b')]===_0xbe48('0x1c')&&typeof _0x166758[_0xbe48('0x1d')]===_0xbe48('0x1c');var _0x384c89=_0x763848['count'];var _0x5b2909=_0x314f66?0x0:_0x166758[_0xbe48('0x1b')];var _0x9a01e1=_0x314f66?_0x763848[_0xbe48('0x1e')]:_0x166758[_0xbe48('0x1b')]+_0x166758['limit'];var _0x33143e;if(_0x9a01e1>=_0x384c89){_0x9a01e1=_0x384c89;_0x33143e=0xc8;}else{_0x33143e=0xce;}_0x1c23f0[_0xbe48('0x19')](_0x33143e);return _0x1c23f0[_0xbe48('0x1f')](_0xbe48('0x20'),_0x5b2909+'-'+_0x9a01e1+'/'+_0x384c89)[_0xbe48('0x1a')](_0x763848);}return null;};}function patchUpdates(_0x1b99d5){return function(_0x3b3882){try{jsonpatch[_0xbe48('0x21')](_0x3b3882,_0x1b99d5,!![]);}catch(_0x5687c1){return BPromise[_0xbe48('0x22')](_0x5687c1);}return _0x3b3882[_0xbe48('0x23')]();};}function saveUpdates(_0x2af666,_0x147895){return function(_0xd400f8){if(_0xd400f8){return _0xd400f8[_0xbe48('0x24')](_0x2af666)[_0xbe48('0x25')](function(_0x8c44be){return _0x8c44be;});}return null;};}function removeEntity(_0x4d4673,_0x2bb627){return function(_0x4bffe5){if(_0x4bffe5){return _0x4bffe5[_0xbe48('0x26')]()[_0xbe48('0x25')](function(){_0x4d4673[_0xbe48('0x19')](0xcc)[_0xbe48('0x27')]();});}};}function handleEntityNotFound(_0x4f851b,_0x282734){return function(_0x35d031){if(!_0x35d031){_0x4f851b[_0xbe48('0x18')](0x194);}return _0x35d031;};}function handleError(_0x8e6c74,_0x404520){_0x404520=_0x404520||0x1f4;return function(_0x295801){logger[_0xbe48('0x28')](_0x295801['stack']);if(_0x295801[_0xbe48('0x29')]){delete _0x295801[_0xbe48('0x29')];}_0x8e6c74[_0xbe48('0x19')](_0x404520)[_0xbe48('0x2a')](_0x295801);};}exports[_0xbe48('0x2b')]=function(_0x121c9e,_0x29ab96){var _0x5cb864={},_0x6d2006={},_0x34d468={'count':0x0,'rows':[]};var _0x3023cd=_[_0xbe48('0x2c')](db['SugarcrmConfiguration'][_0xbe48('0x2d')],function(_0x3d3da1){return{'name':_0x3d3da1[_0xbe48('0x2e')],'type':_0x3d3da1[_0xbe48('0x2f')][_0xbe48('0x30')]};});_0x6d2006[_0xbe48('0x31')]=_[_0xbe48('0x2c')](_0x3023cd,_0xbe48('0x29'));_0x6d2006[_0xbe48('0x32')]=_['keys'](_0x121c9e['query']);_0x6d2006[_0xbe48('0x33')]=_[_0xbe48('0x34')](_0x6d2006[_0xbe48('0x31')],_0x6d2006['query']);_0x5cb864[_0xbe48('0x35')]=_[_0xbe48('0x34')](_0x6d2006['model'],qs[_0xbe48('0x36')](_0x121c9e[_0xbe48('0x32')][_0xbe48('0x36')]));_0x5cb864[_0xbe48('0x35')]=_0x5cb864[_0xbe48('0x35')][_0xbe48('0x37')]?_0x5cb864[_0xbe48('0x35')]:_0x6d2006['model'];if(!_0x121c9e[_0xbe48('0x32')][_0xbe48('0x38')](_0xbe48('0x39'))){_0x5cb864[_0xbe48('0x1d')]=qs[_0xbe48('0x1d')](_0x121c9e[_0xbe48('0x32')]['limit']);_0x5cb864[_0xbe48('0x1b')]=qs[_0xbe48('0x1b')](_0x121c9e[_0xbe48('0x32')][_0xbe48('0x1b')]);}_0x5cb864[_0xbe48('0x3a')]=qs[_0xbe48('0x3b')](_0x121c9e['query'][_0xbe48('0x3b')]);_0x5cb864[_0xbe48('0x3c')]=qs[_0xbe48('0x33')](_[_0xbe48('0x3d')](_0x121c9e[_0xbe48('0x32')],_0x6d2006[_0xbe48('0x33')]),_0x3023cd);if(_0x121c9e[_0xbe48('0x32')]['filter']){_0x5cb864[_0xbe48('0x3c')]=_[_0xbe48('0x3e')](_0x5cb864[_0xbe48('0x3c')],{'$or':_[_0xbe48('0x2c')](_0x3023cd,function(_0x39f909){if(_0x39f909['type']!=='VIRTUAL'){var _0x394ab2={};_0x394ab2[_0x39f909[_0xbe48('0x29')]]={'$like':'%'+_0x121c9e[_0xbe48('0x32')][_0xbe48('0x3f')]+'%'};return _0x394ab2;}})});}_0x5cb864=_[_0xbe48('0x3e')]({},_0x5cb864,_0x121c9e[_0xbe48('0x40')]);var _0x12ad24={'where':_0x5cb864['where']};return db[_0xbe48('0x41')][_0xbe48('0x1e')](_0x12ad24)[_0xbe48('0x25')](function(_0x29e183){_0x34d468[_0xbe48('0x1e')]=_0x29e183;if(_0x121c9e[_0xbe48('0x32')][_0xbe48('0x42')]){_0x5cb864[_0xbe48('0x43')]=[{'all':!![]}];}return db[_0xbe48('0x41')][_0xbe48('0x44')](_0x5cb864);})[_0xbe48('0x25')](function(_0x11edfa){_0x34d468[_0xbe48('0x45')]=_0x11edfa;return _0x34d468;})[_0xbe48('0x25')](respondWithFilteredResult(_0x29ab96,_0x5cb864))[_0xbe48('0x46')](handleError(_0x29ab96,null));};exports[_0xbe48('0x47')]=function(_0x5400c7,_0x1b01f9){var _0xe52f34={'raw':![],'where':{'id':_0x5400c7[_0xbe48('0x48')]['id']}},_0x2a983d={};_0x2a983d['model']=_[_0xbe48('0x49')](db[_0xbe48('0x41')][_0xbe48('0x2d')]);_0x2a983d[_0xbe48('0x32')]=_[_0xbe48('0x49')](_0x5400c7[_0xbe48('0x32')]);_0x2a983d[_0xbe48('0x33')]=_[_0xbe48('0x34')](_0x2a983d[_0xbe48('0x31')],_0x2a983d[_0xbe48('0x32')]);_0xe52f34['attributes']=_['intersection'](_0x2a983d['model'],qs[_0xbe48('0x36')](_0x5400c7[_0xbe48('0x32')][_0xbe48('0x36')]));_0xe52f34[_0xbe48('0x35')]=_0xe52f34[_0xbe48('0x35')][_0xbe48('0x37')]?_0xe52f34[_0xbe48('0x35')]:_0x2a983d['model'];if(_0x5400c7['query']['includeAll']){_0xe52f34[_0xbe48('0x43')]=[{'all':!![]}];}_0xe52f34=_['merge']({},_0xe52f34,_0x5400c7[_0xbe48('0x40')]);return db[_0xbe48('0x41')]['find'](_0xe52f34)[_0xbe48('0x25')](handleEntityNotFound(_0x1b01f9,null))[_0xbe48('0x25')](respondWithResult(_0x1b01f9,null))[_0xbe48('0x46')](handleError(_0x1b01f9,null));};exports[_0xbe48('0x4a')]=function(_0x3fdc5a,_0x4ebb5c){return db['SugarcrmConfiguration'][_0xbe48('0x4a')](_0x3fdc5a[_0xbe48('0x4b')],{})['then'](respondWithResult(_0x4ebb5c,0xc9))[_0xbe48('0x46')](handleError(_0x4ebb5c,null));};exports[_0xbe48('0x24')]=function(_0x49f817,_0x2313a6){if(_0x49f817[_0xbe48('0x4b')]['id']){delete _0x49f817[_0xbe48('0x4b')]['id'];}return db['SugarcrmConfiguration']['find']({'where':{'id':_0x49f817['params']['id']}})[_0xbe48('0x25')](handleEntityNotFound(_0x2313a6,null))[_0xbe48('0x25')](saveUpdates(_0x49f817['body'],null))[_0xbe48('0x25')](respondWithResult(_0x2313a6,null))['catch'](handleError(_0x2313a6,null));};exports[_0xbe48('0x26')]=function(_0x42c53c,_0x22abe9){return db[_0xbe48('0x41')][_0xbe48('0x4c')]({'where':{'id':_0x42c53c[_0xbe48('0x48')]['id']}})[_0xbe48('0x25')](handleEntityNotFound(_0x22abe9,null))['then'](removeEntity(_0x22abe9,null))[_0xbe48('0x46')](handleError(_0x22abe9,null));};exports[_0xbe48('0x4d')]=function(_0x38d369,_0x511778,_0x3d7894){var _0x2d9a5f={};var _0x545e5b={};var _0x2718a6;var _0x7152b0;return db[_0xbe48('0x41')][_0xbe48('0x4e')]({'where':{'id':_0x38d369[_0xbe48('0x48')]['id']}})[_0xbe48('0x25')](handleEntityNotFound(_0x511778,null))[_0xbe48('0x25')](function(_0xcc3a85){if(_0xcc3a85){_0x2718a6=_0xcc3a85;_0x545e5b[_0xbe48('0x31')]=_[_0xbe48('0x49')](db[_0xbe48('0x4f')][_0xbe48('0x2d')]);_0x545e5b[_0xbe48('0x32')]=_['keys'](_0x38d369[_0xbe48('0x32')]);_0x545e5b['filters']=_[_0xbe48('0x34')](_0x545e5b['model'],_0x545e5b[_0xbe48('0x32')]);_0x2d9a5f[_0xbe48('0x35')]=_[_0xbe48('0x34')](_0x545e5b[_0xbe48('0x31')],qs[_0xbe48('0x36')](_0x38d369[_0xbe48('0x32')][_0xbe48('0x36')]));_0x2d9a5f['attributes']=_0x2d9a5f[_0xbe48('0x35')][_0xbe48('0x37')]?_0x2d9a5f[_0xbe48('0x35')]:_0x545e5b[_0xbe48('0x31')];_0x2d9a5f[_0xbe48('0x3a')]=qs['sort'](_0x38d369['query'][_0xbe48('0x3b')]);_0x2d9a5f[_0xbe48('0x3c')]=qs['filters'](_[_0xbe48('0x3d')](_0x38d369[_0xbe48('0x32')],_0x545e5b['filters']));if(_0x38d369[_0xbe48('0x32')][_0xbe48('0x3f')]){_0x2d9a5f[_0xbe48('0x3c')]=_[_0xbe48('0x3e')](_0x2d9a5f['where'],{'$or':_[_0xbe48('0x2c')](_0x2d9a5f[_0xbe48('0x35')],function(_0x2d9875){var _0x23c356={};_0x23c356[_0x2d9875]={'$like':'%'+_0x38d369[_0xbe48('0x32')][_0xbe48('0x3f')]+'%'};return _0x23c356;})});}_0x2d9a5f=_[_0xbe48('0x3e')]({},_0x2d9a5f,_0x38d369[_0xbe48('0x40')]);return _0x2718a6['getFields'](_0x2d9a5f);}})[_0xbe48('0x25')](function(_0x53cb87){if(_0x53cb87){_0x7152b0=_0x53cb87[_0xbe48('0x37')];if(!_0x38d369[_0xbe48('0x32')][_0xbe48('0x38')](_0xbe48('0x39'))){_0x2d9a5f['limit']=qs[_0xbe48('0x1d')](_0x38d369['query'][_0xbe48('0x1d')]);_0x2d9a5f[_0xbe48('0x1b')]=qs['offset'](_0x38d369['query'][_0xbe48('0x1b')]);}return _0x2718a6[_0xbe48('0x4d')](_0x2d9a5f);}})[_0xbe48('0x25')](function(_0x5751bd){if(_0x5751bd){return _0x5751bd?{'count':_0x7152b0,'rows':_0x5751bd}:null;}})[_0xbe48('0x25')](respondWithResult(_0x511778,null))[_0xbe48('0x46')](handleError(_0x511778,null));};exports[_0xbe48('0x50')]=function(_0x2151c9,_0x4d74cb,_0x161452){var _0x371626={};var _0x269b6d={};var _0x944eb6;var _0x2b0aeb;return db[_0xbe48('0x41')]['findOne']({'where':{'id':_0x2151c9[_0xbe48('0x48')]['id']}})['then'](handleEntityNotFound(_0x4d74cb,null))[_0xbe48('0x25')](function(_0x17e655){if(_0x17e655){_0x944eb6=_0x17e655;_0x269b6d['model']=_[_0xbe48('0x49')](db[_0xbe48('0x4f')]['rawAttributes']);_0x269b6d[_0xbe48('0x32')]=_['keys'](_0x2151c9['query']);_0x269b6d[_0xbe48('0x33')]=_[_0xbe48('0x34')](_0x269b6d[_0xbe48('0x31')],_0x269b6d[_0xbe48('0x32')]);_0x371626[_0xbe48('0x35')]=_[_0xbe48('0x34')](_0x269b6d[_0xbe48('0x31')],qs[_0xbe48('0x36')](_0x2151c9[_0xbe48('0x32')][_0xbe48('0x36')]));_0x371626['attributes']=_0x371626[_0xbe48('0x35')][_0xbe48('0x37')]?_0x371626[_0xbe48('0x35')]:_0x269b6d[_0xbe48('0x31')];_0x371626[_0xbe48('0x3a')]=qs['sort'](_0x2151c9['query'][_0xbe48('0x3b')]);_0x371626['where']=qs[_0xbe48('0x33')](_['pick'](_0x2151c9['query'],_0x269b6d[_0xbe48('0x33')]));if(_0x2151c9['query']['filter']){_0x371626[_0xbe48('0x3c')]=_[_0xbe48('0x3e')](_0x371626[_0xbe48('0x3c')],{'$or':_[_0xbe48('0x2c')](_0x371626[_0xbe48('0x35')],function(_0x57f3b8){var _0x18a818={};_0x18a818[_0x57f3b8]={'$like':'%'+_0x2151c9[_0xbe48('0x32')][_0xbe48('0x3f')]+'%'};return _0x18a818;})});}_0x371626=_[_0xbe48('0x3e')]({},_0x371626,_0x2151c9[_0xbe48('0x40')]);return _0x944eb6[_0xbe48('0x50')](_0x371626);}})[_0xbe48('0x25')](function(_0x11fbf6){if(_0x11fbf6){_0x2b0aeb=_0x11fbf6['length'];if(!_0x2151c9[_0xbe48('0x32')][_0xbe48('0x38')]('nolimit')){_0x371626['limit']=qs[_0xbe48('0x1d')](_0x2151c9[_0xbe48('0x32')][_0xbe48('0x1d')]);_0x371626[_0xbe48('0x1b')]=qs[_0xbe48('0x1b')](_0x2151c9[_0xbe48('0x32')]['offset']);}return _0x944eb6[_0xbe48('0x50')](_0x371626);}})[_0xbe48('0x25')](function(_0x48ecf8){if(_0x48ecf8){return _0x48ecf8?{'count':_0x2b0aeb,'rows':_0x48ecf8}:null;}})[_0xbe48('0x25')](respondWithResult(_0x4d74cb,null))['catch'](handleError(_0x4d74cb,null));};exports[_0xbe48('0x51')]=function(_0x2589d5,_0x4bf72e,_0x27bedd){var _0x4011f1={};var _0x329065={};var _0x31259e;var _0x38d05d;return db[_0xbe48('0x41')][_0xbe48('0x4e')]({'where':{'id':_0x2589d5[_0xbe48('0x48')]['id']}})[_0xbe48('0x25')](handleEntityNotFound(_0x4bf72e,null))['then'](function(_0x19ad88){if(_0x19ad88){_0x31259e=_0x19ad88;_0x329065['model']=_[_0xbe48('0x49')](db[_0xbe48('0x4f')][_0xbe48('0x2d')]);_0x329065[_0xbe48('0x32')]=_[_0xbe48('0x49')](_0x2589d5[_0xbe48('0x32')]);_0x329065[_0xbe48('0x33')]=_[_0xbe48('0x34')](_0x329065[_0xbe48('0x31')],_0x329065[_0xbe48('0x32')]);_0x4011f1[_0xbe48('0x35')]=_[_0xbe48('0x34')](_0x329065[_0xbe48('0x31')],qs[_0xbe48('0x36')](_0x2589d5['query'][_0xbe48('0x36')]));_0x4011f1['attributes']=_0x4011f1[_0xbe48('0x35')][_0xbe48('0x37')]?_0x4011f1[_0xbe48('0x35')]:_0x329065['model'];_0x4011f1['order']=qs['sort'](_0x2589d5[_0xbe48('0x32')][_0xbe48('0x3b')]);_0x4011f1[_0xbe48('0x3c')]=qs['filters'](_[_0xbe48('0x3d')](_0x2589d5['query'],_0x329065[_0xbe48('0x33')]));if(_0x2589d5[_0xbe48('0x32')][_0xbe48('0x3f')]){_0x4011f1[_0xbe48('0x3c')]=_[_0xbe48('0x3e')](_0x4011f1[_0xbe48('0x3c')],{'$or':_[_0xbe48('0x2c')](_0x4011f1['attributes'],function(_0x39b190){var _0x19a5c8={};_0x19a5c8[_0x39b190]={'$like':'%'+_0x2589d5[_0xbe48('0x32')][_0xbe48('0x3f')]+'%'};return _0x19a5c8;})});}_0x4011f1=_['merge']({},_0x4011f1,_0x2589d5['options']);return _0x31259e['getDescriptions'](_0x4011f1);}})[_0xbe48('0x25')](function(_0x6d766a){if(_0x6d766a){_0x38d05d=_0x6d766a[_0xbe48('0x37')];if(!_0x2589d5[_0xbe48('0x32')][_0xbe48('0x38')](_0xbe48('0x39'))){_0x4011f1[_0xbe48('0x1d')]=qs['limit'](_0x2589d5[_0xbe48('0x32')][_0xbe48('0x1d')]);_0x4011f1[_0xbe48('0x1b')]=qs[_0xbe48('0x1b')](_0x2589d5[_0xbe48('0x32')][_0xbe48('0x1b')]);}return _0x31259e[_0xbe48('0x51')](_0x4011f1);}})[_0xbe48('0x25')](function(_0x574263){if(_0x574263){return _0x574263?{'count':_0x38d05d,'rows':_0x574263}:null;}})['then'](respondWithResult(_0x4bf72e,null))[_0xbe48('0x46')](handleError(_0x4bf72e,null));}; \ No newline at end of file +var _0x039f=['../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','then','destroy','end','error','stack','name','send','index','map','SugarcrmConfiguration','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','where','filters','filter','merge','VIRTUAL','options','include','rows','catch','show','params','keys','find','body','update','getFields','findOne','SugarcrmField','sort','pick','nolimit','getSubjects','rawAttributes','getDescriptions','rimraf','fast-json-patch','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware'];(function(_0x4fa4b1,_0x5849b8){var _0x3dfede=function(_0x377cf6){while(--_0x377cf6){_0x4fa4b1['push'](_0x4fa4b1['shift']());}};_0x3dfede(++_0x5849b8);}(_0x039f,0xd3));var _0xf039=function(_0x2c7b86,_0x59ef3c){_0x2c7b86=_0x2c7b86-0x0;var _0x256735=_0x039f[_0x2c7b86];return _0x256735;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf039('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf039('0x1'));var rp=require('request-promise');var moment=require(_0xf039('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf039('0x3'));var path=require(_0xf039('0x4'));var sox=require(_0xf039('0x5'));var csv=require(_0xf039('0x6'));var ejs=require(_0xf039('0x7'));var fs=require('fs');var fs_extra=require(_0xf039('0x8'));var _=require(_0xf039('0x9'));var squel=require(_0xf039('0xa'));var crypto=require(_0xf039('0xb'));var jsforce=require(_0xf039('0xc'));var deskjs=require(_0xf039('0xd'));var toCsv=require(_0xf039('0x6'));var querystring=require(_0xf039('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf039('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf039('0x10'));var logger=require(_0xf039('0x11'))('api');var utils=require(_0xf039('0x12'));var config=require(_0xf039('0x13'));var licenseUtil=require(_0xf039('0x14'));var db=require(_0xf039('0x15'))['db'];function respondWithStatusCode(_0x4f7bb7,_0x5596d0){_0x5596d0=_0x5596d0||0xcc;return function(_0x42bf75){if(_0x42bf75){return _0x4f7bb7[_0xf039('0x16')](_0x5596d0);}return _0x4f7bb7[_0xf039('0x17')](_0x5596d0)['end']();};}function respondWithResult(_0x2d8822,_0x59eba5){_0x59eba5=_0x59eba5||0xc8;return function(_0x4e82c8){if(_0x4e82c8){return _0x2d8822[_0xf039('0x17')](_0x59eba5)[_0xf039('0x18')](_0x4e82c8);}};}function respondWithFilteredResult(_0x173773,_0x145a5b){return function(_0x58dcc1){if(_0x58dcc1){var _0x1c61fb=typeof _0x145a5b[_0xf039('0x19')]==='undefined'&&typeof _0x145a5b[_0xf039('0x1a')]===_0xf039('0x1b');var _0x22b397=_0x58dcc1[_0xf039('0x1c')];var _0x26e270=_0x1c61fb?0x0:_0x145a5b['offset'];var _0x238241=_0x1c61fb?_0x58dcc1['count']:_0x145a5b[_0xf039('0x19')]+_0x145a5b[_0xf039('0x1a')];var _0x103f26;if(_0x238241>=_0x22b397){_0x238241=_0x22b397;_0x103f26=0xc8;}else{_0x103f26=0xce;}_0x173773['status'](_0x103f26);return _0x173773[_0xf039('0x1d')](_0xf039('0x1e'),_0x26e270+'-'+_0x238241+'/'+_0x22b397)[_0xf039('0x18')](_0x58dcc1);}return null;};}function patchUpdates(_0x1cee06){return function(_0x35876c){try{jsonpatch['apply'](_0x35876c,_0x1cee06,!![]);}catch(_0x1ee65e){return BPromise['reject'](_0x1ee65e);}return _0x35876c['save']();};}function saveUpdates(_0x1ca994,_0x2e8594){return function(_0x5c1993){if(_0x5c1993){return _0x5c1993['update'](_0x1ca994)[_0xf039('0x1f')](function(_0x4b3b65){return _0x4b3b65;});}return null;};}function removeEntity(_0x5b6b68,_0x143de4){return function(_0x141f9f){if(_0x141f9f){return _0x141f9f[_0xf039('0x20')]()[_0xf039('0x1f')](function(){_0x5b6b68[_0xf039('0x17')](0xcc)[_0xf039('0x21')]();});}};}function handleEntityNotFound(_0x459c3d,_0x1aacd9){return function(_0x1b1546){if(!_0x1b1546){_0x459c3d[_0xf039('0x16')](0x194);}return _0x1b1546;};}function handleError(_0x4813e2,_0x1e3581){_0x1e3581=_0x1e3581||0x1f4;return function(_0x50354b){logger[_0xf039('0x22')](_0x50354b[_0xf039('0x23')]);if(_0x50354b['name']){delete _0x50354b[_0xf039('0x24')];}_0x4813e2[_0xf039('0x17')](_0x1e3581)[_0xf039('0x25')](_0x50354b);};}exports[_0xf039('0x26')]=function(_0x20daf7,_0x4e78b9){var _0xf55c33={},_0x226a07={},_0x563b0f={'count':0x0,'rows':[]};var _0x34993d=_[_0xf039('0x27')](db[_0xf039('0x28')]['rawAttributes'],function(_0x4872c5){return{'name':_0x4872c5[_0xf039('0x29')],'type':_0x4872c5[_0xf039('0x2a')][_0xf039('0x2b')]};});_0x226a07[_0xf039('0x2c')]=_[_0xf039('0x27')](_0x34993d,'name');_0x226a07[_0xf039('0x2d')]=_['keys'](_0x20daf7[_0xf039('0x2d')]);_0x226a07['filters']=_[_0xf039('0x2e')](_0x226a07[_0xf039('0x2c')],_0x226a07[_0xf039('0x2d')]);_0xf55c33[_0xf039('0x2f')]=_[_0xf039('0x2e')](_0x226a07[_0xf039('0x2c')],qs['fields'](_0x20daf7[_0xf039('0x2d')][_0xf039('0x30')]));_0xf55c33[_0xf039('0x2f')]=_0xf55c33[_0xf039('0x2f')][_0xf039('0x31')]?_0xf55c33[_0xf039('0x2f')]:_0x226a07[_0xf039('0x2c')];if(!_0x20daf7[_0xf039('0x2d')][_0xf039('0x32')]('nolimit')){_0xf55c33['limit']=qs[_0xf039('0x1a')](_0x20daf7[_0xf039('0x2d')][_0xf039('0x1a')]);_0xf55c33[_0xf039('0x19')]=qs['offset'](_0x20daf7[_0xf039('0x2d')][_0xf039('0x19')]);}_0xf55c33[_0xf039('0x33')]=qs['sort'](_0x20daf7['query']['sort']);_0xf55c33[_0xf039('0x34')]=qs['filters'](_['pick'](_0x20daf7['query'],_0x226a07[_0xf039('0x35')]),_0x34993d);if(_0x20daf7[_0xf039('0x2d')][_0xf039('0x36')]){_0xf55c33[_0xf039('0x34')]=_[_0xf039('0x37')](_0xf55c33['where'],{'$or':_[_0xf039('0x27')](_0x34993d,function(_0x496bf1){if(_0x496bf1[_0xf039('0x2a')]!==_0xf039('0x38')){var _0x1b6fb5={};_0x1b6fb5[_0x496bf1[_0xf039('0x24')]]={'$like':'%'+_0x20daf7[_0xf039('0x2d')][_0xf039('0x36')]+'%'};return _0x1b6fb5;}})});}_0xf55c33=_[_0xf039('0x37')]({},_0xf55c33,_0x20daf7[_0xf039('0x39')]);var _0x35ccbd={'where':_0xf55c33[_0xf039('0x34')]};return db['SugarcrmConfiguration'][_0xf039('0x1c')](_0x35ccbd)['then'](function(_0x27bda1){_0x563b0f[_0xf039('0x1c')]=_0x27bda1;if(_0x20daf7[_0xf039('0x2d')]['includeAll']){_0xf55c33[_0xf039('0x3a')]=[{'all':!![]}];}return db[_0xf039('0x28')]['findAll'](_0xf55c33);})[_0xf039('0x1f')](function(_0x3fd6e4){_0x563b0f[_0xf039('0x3b')]=_0x3fd6e4;return _0x563b0f;})[_0xf039('0x1f')](respondWithFilteredResult(_0x4e78b9,_0xf55c33))[_0xf039('0x3c')](handleError(_0x4e78b9,null));};exports[_0xf039('0x3d')]=function(_0x159dd0,_0x4d73ff){var _0x4f627c={'raw':![],'where':{'id':_0x159dd0[_0xf039('0x3e')]['id']}},_0x6fb23b={};_0x6fb23b['model']=_[_0xf039('0x3f')](db[_0xf039('0x28')]['rawAttributes']);_0x6fb23b['query']=_[_0xf039('0x3f')](_0x159dd0['query']);_0x6fb23b[_0xf039('0x35')]=_[_0xf039('0x2e')](_0x6fb23b[_0xf039('0x2c')],_0x6fb23b[_0xf039('0x2d')]);_0x4f627c[_0xf039('0x2f')]=_[_0xf039('0x2e')](_0x6fb23b['model'],qs['fields'](_0x159dd0[_0xf039('0x2d')][_0xf039('0x30')]));_0x4f627c[_0xf039('0x2f')]=_0x4f627c[_0xf039('0x2f')][_0xf039('0x31')]?_0x4f627c[_0xf039('0x2f')]:_0x6fb23b[_0xf039('0x2c')];if(_0x159dd0[_0xf039('0x2d')]['includeAll']){_0x4f627c[_0xf039('0x3a')]=[{'all':!![]}];}_0x4f627c=_[_0xf039('0x37')]({},_0x4f627c,_0x159dd0[_0xf039('0x39')]);return db[_0xf039('0x28')][_0xf039('0x40')](_0x4f627c)['then'](handleEntityNotFound(_0x4d73ff,null))['then'](respondWithResult(_0x4d73ff,null))['catch'](handleError(_0x4d73ff,null));};exports['create']=function(_0x296550,_0x9260d7){return db[_0xf039('0x28')]['create'](_0x296550[_0xf039('0x41')],{})[_0xf039('0x1f')](respondWithResult(_0x9260d7,0xc9))[_0xf039('0x3c')](handleError(_0x9260d7,null));};exports[_0xf039('0x42')]=function(_0x23dc4f,_0x2a2268){if(_0x23dc4f['body']['id']){delete _0x23dc4f[_0xf039('0x41')]['id'];}return db[_0xf039('0x28')][_0xf039('0x40')]({'where':{'id':_0x23dc4f['params']['id']}})[_0xf039('0x1f')](handleEntityNotFound(_0x2a2268,null))[_0xf039('0x1f')](saveUpdates(_0x23dc4f[_0xf039('0x41')],null))['then'](respondWithResult(_0x2a2268,null))[_0xf039('0x3c')](handleError(_0x2a2268,null));};exports['destroy']=function(_0x2dfb31,_0x327fce){return db[_0xf039('0x28')]['find']({'where':{'id':_0x2dfb31[_0xf039('0x3e')]['id']}})['then'](handleEntityNotFound(_0x327fce,null))['then'](removeEntity(_0x327fce,null))[_0xf039('0x3c')](handleError(_0x327fce,null));};exports[_0xf039('0x43')]=function(_0x40170a,_0x993003,_0x5a4179){var _0x44d546={};var _0x5a62fd={};var _0x508262;var _0x294f8f;return db['SugarcrmConfiguration'][_0xf039('0x44')]({'where':{'id':_0x40170a[_0xf039('0x3e')]['id']}})['then'](handleEntityNotFound(_0x993003,null))[_0xf039('0x1f')](function(_0x4ff823){if(_0x4ff823){_0x508262=_0x4ff823;_0x5a62fd['model']=_[_0xf039('0x3f')](db[_0xf039('0x45')]['rawAttributes']);_0x5a62fd[_0xf039('0x2d')]=_[_0xf039('0x3f')](_0x40170a[_0xf039('0x2d')]);_0x5a62fd['filters']=_[_0xf039('0x2e')](_0x5a62fd[_0xf039('0x2c')],_0x5a62fd['query']);_0x44d546[_0xf039('0x2f')]=_[_0xf039('0x2e')](_0x5a62fd[_0xf039('0x2c')],qs[_0xf039('0x30')](_0x40170a[_0xf039('0x2d')][_0xf039('0x30')]));_0x44d546[_0xf039('0x2f')]=_0x44d546[_0xf039('0x2f')][_0xf039('0x31')]?_0x44d546[_0xf039('0x2f')]:_0x5a62fd['model'];_0x44d546[_0xf039('0x33')]=qs[_0xf039('0x46')](_0x40170a[_0xf039('0x2d')][_0xf039('0x46')]);_0x44d546['where']=qs['filters'](_[_0xf039('0x47')](_0x40170a[_0xf039('0x2d')],_0x5a62fd[_0xf039('0x35')]));if(_0x40170a[_0xf039('0x2d')][_0xf039('0x36')]){_0x44d546[_0xf039('0x34')]=_['merge'](_0x44d546['where'],{'$or':_[_0xf039('0x27')](_0x44d546[_0xf039('0x2f')],function(_0x2bf03a){var _0x1640c8={};_0x1640c8[_0x2bf03a]={'$like':'%'+_0x40170a['query'][_0xf039('0x36')]+'%'};return _0x1640c8;})});}_0x44d546=_[_0xf039('0x37')]({},_0x44d546,_0x40170a[_0xf039('0x39')]);return _0x508262[_0xf039('0x43')](_0x44d546);}})[_0xf039('0x1f')](function(_0xdc5599){if(_0xdc5599){_0x294f8f=_0xdc5599[_0xf039('0x31')];if(!_0x40170a[_0xf039('0x2d')]['hasOwnProperty'](_0xf039('0x48'))){_0x44d546[_0xf039('0x1a')]=qs[_0xf039('0x1a')](_0x40170a[_0xf039('0x2d')][_0xf039('0x1a')]);_0x44d546[_0xf039('0x19')]=qs[_0xf039('0x19')](_0x40170a[_0xf039('0x2d')]['offset']);}return _0x508262[_0xf039('0x43')](_0x44d546);}})[_0xf039('0x1f')](function(_0x2ffce3){if(_0x2ffce3){return _0x2ffce3?{'count':_0x294f8f,'rows':_0x2ffce3}:null;}})[_0xf039('0x1f')](respondWithResult(_0x993003,null))['catch'](handleError(_0x993003,null));};exports[_0xf039('0x49')]=function(_0xdf0a38,_0x51e513,_0x490feb){var _0x2db9ec={};var _0x1633df={};var _0x37c265;var _0x55e525;return db['SugarcrmConfiguration'][_0xf039('0x44')]({'where':{'id':_0xdf0a38[_0xf039('0x3e')]['id']}})[_0xf039('0x1f')](handleEntityNotFound(_0x51e513,null))[_0xf039('0x1f')](function(_0x48eb75){if(_0x48eb75){_0x37c265=_0x48eb75;_0x1633df[_0xf039('0x2c')]=_['keys'](db[_0xf039('0x45')][_0xf039('0x4a')]);_0x1633df[_0xf039('0x2d')]=_[_0xf039('0x3f')](_0xdf0a38['query']);_0x1633df[_0xf039('0x35')]=_[_0xf039('0x2e')](_0x1633df[_0xf039('0x2c')],_0x1633df[_0xf039('0x2d')]);_0x2db9ec['attributes']=_[_0xf039('0x2e')](_0x1633df['model'],qs[_0xf039('0x30')](_0xdf0a38[_0xf039('0x2d')]['fields']));_0x2db9ec['attributes']=_0x2db9ec['attributes'][_0xf039('0x31')]?_0x2db9ec[_0xf039('0x2f')]:_0x1633df[_0xf039('0x2c')];_0x2db9ec[_0xf039('0x33')]=qs['sort'](_0xdf0a38[_0xf039('0x2d')][_0xf039('0x46')]);_0x2db9ec[_0xf039('0x34')]=qs['filters'](_[_0xf039('0x47')](_0xdf0a38[_0xf039('0x2d')],_0x1633df[_0xf039('0x35')]));if(_0xdf0a38[_0xf039('0x2d')]['filter']){_0x2db9ec[_0xf039('0x34')]=_[_0xf039('0x37')](_0x2db9ec[_0xf039('0x34')],{'$or':_[_0xf039('0x27')](_0x2db9ec['attributes'],function(_0x4d98d4){var _0x542401={};_0x542401[_0x4d98d4]={'$like':'%'+_0xdf0a38[_0xf039('0x2d')][_0xf039('0x36')]+'%'};return _0x542401;})});}_0x2db9ec=_['merge']({},_0x2db9ec,_0xdf0a38['options']);return _0x37c265[_0xf039('0x49')](_0x2db9ec);}})[_0xf039('0x1f')](function(_0xe879d4){if(_0xe879d4){_0x55e525=_0xe879d4['length'];if(!_0xdf0a38[_0xf039('0x2d')][_0xf039('0x32')]('nolimit')){_0x2db9ec[_0xf039('0x1a')]=qs[_0xf039('0x1a')](_0xdf0a38[_0xf039('0x2d')][_0xf039('0x1a')]);_0x2db9ec['offset']=qs[_0xf039('0x19')](_0xdf0a38[_0xf039('0x2d')][_0xf039('0x19')]);}return _0x37c265[_0xf039('0x49')](_0x2db9ec);}})[_0xf039('0x1f')](function(_0x2f1555){if(_0x2f1555){return _0x2f1555?{'count':_0x55e525,'rows':_0x2f1555}:null;}})[_0xf039('0x1f')](respondWithResult(_0x51e513,null))[_0xf039('0x3c')](handleError(_0x51e513,null));};exports[_0xf039('0x4b')]=function(_0x2cc60b,_0x2def9a,_0x37076f){var _0x236fc0={};var _0x20bd01={};var _0x5e5349;var _0x586895;return db[_0xf039('0x28')][_0xf039('0x44')]({'where':{'id':_0x2cc60b[_0xf039('0x3e')]['id']}})['then'](handleEntityNotFound(_0x2def9a,null))['then'](function(_0x13b985){if(_0x13b985){_0x5e5349=_0x13b985;_0x20bd01[_0xf039('0x2c')]=_['keys'](db[_0xf039('0x45')][_0xf039('0x4a')]);_0x20bd01[_0xf039('0x2d')]=_[_0xf039('0x3f')](_0x2cc60b[_0xf039('0x2d')]);_0x20bd01[_0xf039('0x35')]=_[_0xf039('0x2e')](_0x20bd01[_0xf039('0x2c')],_0x20bd01[_0xf039('0x2d')]);_0x236fc0[_0xf039('0x2f')]=_[_0xf039('0x2e')](_0x20bd01['model'],qs[_0xf039('0x30')](_0x2cc60b[_0xf039('0x2d')][_0xf039('0x30')]));_0x236fc0['attributes']=_0x236fc0[_0xf039('0x2f')][_0xf039('0x31')]?_0x236fc0[_0xf039('0x2f')]:_0x20bd01['model'];_0x236fc0[_0xf039('0x33')]=qs[_0xf039('0x46')](_0x2cc60b[_0xf039('0x2d')][_0xf039('0x46')]);_0x236fc0[_0xf039('0x34')]=qs[_0xf039('0x35')](_[_0xf039('0x47')](_0x2cc60b[_0xf039('0x2d')],_0x20bd01['filters']));if(_0x2cc60b[_0xf039('0x2d')][_0xf039('0x36')]){_0x236fc0['where']=_[_0xf039('0x37')](_0x236fc0['where'],{'$or':_[_0xf039('0x27')](_0x236fc0[_0xf039('0x2f')],function(_0x2b6b7a){var _0x1a2790={};_0x1a2790[_0x2b6b7a]={'$like':'%'+_0x2cc60b[_0xf039('0x2d')][_0xf039('0x36')]+'%'};return _0x1a2790;})});}_0x236fc0=_['merge']({},_0x236fc0,_0x2cc60b[_0xf039('0x39')]);return _0x5e5349[_0xf039('0x4b')](_0x236fc0);}})['then'](function(_0x43dde8){if(_0x43dde8){_0x586895=_0x43dde8[_0xf039('0x31')];if(!_0x2cc60b[_0xf039('0x2d')][_0xf039('0x32')]('nolimit')){_0x236fc0[_0xf039('0x1a')]=qs['limit'](_0x2cc60b[_0xf039('0x2d')][_0xf039('0x1a')]);_0x236fc0[_0xf039('0x19')]=qs[_0xf039('0x19')](_0x2cc60b['query'][_0xf039('0x19')]);}return _0x5e5349['getDescriptions'](_0x236fc0);}})['then'](function(_0x1a0c1e){if(_0x1a0c1e){return _0x1a0c1e?{'count':_0x586895,'rows':_0x1a0c1e}:null;}})[_0xf039('0x1f')](respondWithResult(_0x2def9a,null))['catch'](handleError(_0x2def9a,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 7906da1..405c38b 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 _0x0523=['path','rimraf','./intSugarcrmConfiguration.attributes','exports','define','util','api','bluebird'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x0523,0xa5));var _0x3052=function(_0x3d8bbd,_0x3f8c34){_0x3d8bbd=_0x3d8bbd-0x0;var _0xf17a80=_0x0523[_0x3d8bbd];return _0xf17a80;};'use strict';var _=require('lodash');var util=require(_0x3052('0x0'));var logger=require('../../config/logger')(_0x3052('0x1'));var moment=require('moment');var BPromise=require(_0x3052('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3052('0x3'));var rimraf=require(_0x3052('0x4'));var config=require('../../config/environment');var attributes=require(_0x3052('0x5'));module[_0x3052('0x6')]=function(_0x175feb,_0x480927){return _0x175feb[_0x3052('0x7')]('SugarcrmConfiguration',attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9ab5=['bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','lodash','../../config/logger','api','moment'];(function(_0x25521b,_0xa0697b){var _0x1f7487=function(_0x5c1b5c){while(--_0x5c1b5c){_0x25521b['push'](_0x25521b['shift']());}};_0x1f7487(++_0xa0697b);}(_0x9ab5,0x11a));var _0x59ab=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x9ab5[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x59ab('0x0'));var util=require('util');var logger=require(_0x59ab('0x1'))(_0x59ab('0x2'));var moment=require(_0x59ab('0x3'));var BPromise=require(_0x59ab('0x4'));var rp=require(_0x59ab('0x5'));var fs=require('fs');var path=require(_0x59ab('0x6'));var rimraf=require(_0x59ab('0x7'));var config=require(_0x59ab('0x8'));var attributes=require(_0x59ab('0x9'));module[_0x59ab('0xa')]=function(_0x5c059c,_0x325678){return _0x5c059c[_0x59ab('0xb')](_0x59ab('0xc'),attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index 731e50a..c037b5d 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 _0xccfb=['request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s'];(function(_0x1d4981,_0xb68096){var _0x30c0bb=function(_0x29af50){while(--_0x29af50){_0x1d4981['push'](_0x1d4981['shift']());}};_0x30c0bb(++_0xb68096);}(_0xccfb,0x118));var _0xbccf=function(_0x56b50d,_0x2f4d83){_0x56b50d=_0x56b50d-0x0;var _0x1a732d=_0xccfb[_0x56b50d];return _0x1a732d;};'use strict';var _=require(_0xbccf('0x0'));var util=require(_0xbccf('0x1'));var moment=require(_0xbccf('0x2'));var BPromise=require(_0xbccf('0x3'));var rs=require(_0xbccf('0x4'));var fs=require('fs');var Redis=require(_0xbccf('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbccf('0x6'))(_0xbccf('0x7'));var config=require(_0xbccf('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xbccf('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd6b58d,_0x5d9a69,_0x3c35ea){return new BPromise(function(_0x7fa5a8,_0x50d028){return client[_0xbccf('0xa')](_0xd6b58d,_0x3c35ea)[_0xbccf('0xb')](function(_0x16a572){logger[_0xbccf('0xc')](_0xbccf('0xd'),_0x5d9a69,_0xbccf('0xe'));logger[_0xbccf('0xf')](_0xbccf('0x10'),_0x5d9a69,_0xbccf('0xe'),JSON[_0xbccf('0x11')](_0x16a572));if(_0x16a572[_0xbccf('0x12')]){if(_0x16a572[_0xbccf('0x12')]['code']===0x1f4){logger[_0xbccf('0x12')](_0xbccf('0xd'),_0x5d9a69,_0x16a572['error'][_0xbccf('0x13')]);return _0x50d028(_0x16a572['error'][_0xbccf('0x13')]);}logger[_0xbccf('0x12')](_0xbccf('0xd'),_0x5d9a69,_0x16a572[_0xbccf('0x12')][_0xbccf('0x13')]);return _0x7fa5a8(_0x16a572[_0xbccf('0x12')][_0xbccf('0x13')]);}else{logger[_0xbccf('0xc')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x5d9a69,_0xbccf('0xe'));_0x7fa5a8(_0x16a572['result'][_0xbccf('0x13')]);}})[_0xbccf('0x14')](function(_0x34dfa1){logger[_0xbccf('0x12')](_0xbccf('0xd'),_0x5d9a69,_0x34dfa1);_0x50d028(_0x34dfa1);});});} \ No newline at end of file +var _0xa71e=['util','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','info','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','SugarcrmConfiguration,\x20%s,\x20%s','message','result','lodash'];(function(_0x1964e4,_0x2c3506){var _0x344590=function(_0x2a8133){while(--_0x2a8133){_0x1964e4['push'](_0x1964e4['shift']());}};_0x344590(++_0x2c3506);}(_0xa71e,0x14f));var _0xea71=function(_0x3ec333,_0x26bcbe){_0x3ec333=_0x3ec333-0x0;var _0x15ccb8=_0xa71e[_0x3ec333];return _0x15ccb8;};'use strict';var _=require(_0xea71('0x0'));var util=require(_0xea71('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xea71('0x2'))['db'];var utils=require(_0xea71('0x3'));var logger=require(_0xea71('0x4'))(_0xea71('0x5'));var config=require('../../config/environment');var jayson=require(_0xea71('0x6'));var client=jayson[_0xea71('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32384c,_0x39e8fb,_0x3e50f1){return new BPromise(function(_0x2820a4,_0x13f1e0){return client['request'](_0x32384c,_0x3e50f1)['then'](function(_0xf8223e){logger[_0xea71('0x8')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x39e8fb,_0xea71('0x9'));logger['debug'](_0xea71('0xa'),_0x39e8fb,_0xea71('0x9'),JSON[_0xea71('0xb')](_0xf8223e));if(_0xf8223e[_0xea71('0xc')]){if(_0xf8223e[_0xea71('0xc')]['code']===0x1f4){logger['error'](_0xea71('0xd'),_0x39e8fb,_0xf8223e[_0xea71('0xc')][_0xea71('0xe')]);return _0x13f1e0(_0xf8223e[_0xea71('0xc')]['message']);}logger['error'](_0xea71('0xd'),_0x39e8fb,_0xf8223e[_0xea71('0xc')][_0xea71('0xe')]);return _0x2820a4(_0xf8223e[_0xea71('0xc')][_0xea71('0xe')]);}else{logger['info'](_0xea71('0xd'),_0x39e8fb,_0xea71('0x9'));_0x2820a4(_0xf8223e[_0xea71('0xf')][_0xea71('0xe')]);}})['catch'](function(_0x41e491){logger['error'](_0xea71('0xd'),_0x39e8fb,_0x41e491);_0x13f1e0(_0x41e491);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index cc4e3d4..08ec960 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 _0x2888=['post','create','put','update','destroy','exports','multer','path','express','Router','fs-extra','../../config/environment','./intSugarcrmField.controller','get','index','/:id','isAuthenticated'];(function(_0x456a72,_0x38875f){var _0x1ea548=function(_0x42aed1){while(--_0x42aed1){_0x456a72['push'](_0x456a72['shift']());}};_0x1ea548(++_0x38875f);}(_0x2888,0x116));var _0x8288=function(_0x367acc,_0x49b154){_0x367acc=_0x367acc-0x0;var _0x51d0a9=_0x2888[_0x367acc];return _0x51d0a9;};'use strict';var multer=require(_0x8288('0x0'));var util=require('util');var path=require(_0x8288('0x1'));var timeout=require('connect-timeout');var express=require(_0x8288('0x2'));var router=express[_0x8288('0x3')]();var fs_extra=require(_0x8288('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8288('0x5'));var controller=require(_0x8288('0x6'));router[_0x8288('0x7')]('/',auth['isAuthenticated'](),controller[_0x8288('0x8')]);router['get'](_0x8288('0x9'),auth[_0x8288('0xa')](),controller['show']);router[_0x8288('0xb')]('/',auth['isAuthenticated'](),controller[_0x8288('0xc')]);router[_0x8288('0xd')](_0x8288('0x9'),auth[_0x8288('0xa')](),controller[_0x8288('0xe')]);router['delete'](_0x8288('0x9'),auth[_0x8288('0xa')](),controller[_0x8288('0xf')]);module[_0x8288('0x10')]=router; \ No newline at end of file +var _0x0a3d=['get','/:id','isAuthenticated','show','post','create','put','update','path','express','Router','../../config/environment'];(function(_0x1d137c,_0x3ecbf0){var _0x4a8a6d=function(_0x53004f){while(--_0x53004f){_0x1d137c['push'](_0x1d137c['shift']());}};_0x4a8a6d(++_0x3ecbf0);}(_0x0a3d,0xd4));var _0xd0a3=function(_0x33c464,_0x231797){_0x33c464=_0x33c464-0x0;var _0x261e16=_0x0a3d[_0x33c464];return _0x261e16;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd0a3('0x0'));var timeout=require('connect-timeout');var express=require(_0xd0a3('0x1'));var router=express[_0xd0a3('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd0a3('0x3'));var controller=require('./intSugarcrmField.controller');router[_0xd0a3('0x4')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd0a3('0x4')](_0xd0a3('0x5'),auth[_0xd0a3('0x6')](),controller[_0xd0a3('0x7')]);router[_0xd0a3('0x8')]('/',auth[_0xd0a3('0x6')](),controller[_0xd0a3('0x9')]);router[_0xd0a3('0xa')](_0xd0a3('0x5'),auth[_0xd0a3('0x6')](),controller[_0xd0a3('0xb')]);router['delete'](_0xd0a3('0x5'),auth[_0xd0a3('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 0c76452..fa95a2b 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 _0xd455=['string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','exports','ENUM'];(function(_0x18506f,_0x5957b1){var _0x589670=function(_0x225f82){while(--_0x225f82){_0x18506f['push'](_0x18506f['shift']());}};_0x589670(++_0x5957b1);}(_0xd455,0x11e));var _0x5d45=function(_0x34f235,_0x4cb723){_0x34f235=_0x34f235-0x0;var _0xe2ef1=_0xd455[_0x34f235];return _0xe2ef1;};'use strict';var Sequelize=require('sequelize');module[_0x5d45('0x0')]={'type':{'type':Sequelize[_0x5d45('0x1')](_0x5d45('0x2'),_0x5d45('0x3'),_0x5d45('0x4'),_0x5d45('0x5'),_0x5d45('0x6')),'defaultValue':_0x5d45('0x2')},'content':{'type':Sequelize[_0x5d45('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x5d45('0x1')]('string','variable','customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x5d45('0x7')]},'customField':{'type':Sequelize[_0x5d45('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5d45('0x7')]}}; \ No newline at end of file +var _0x502b=['customVariable','STRING','exports','ENUM','string','variable','picklist'];(function(_0x21090b,_0x39dd3b){var _0x3c68d7=function(_0x28ecd4){while(--_0x28ecd4){_0x21090b['push'](_0x21090b['shift']());}};_0x3c68d7(++_0x39dd3b);}(_0x502b,0xbf));var _0xb502=function(_0xbaeba7,_0x578dfa){_0xbaeba7=_0xbaeba7-0x0;var _0x4b42e7=_0x502b[_0xbaeba7];return _0x4b42e7;};'use strict';var Sequelize=require('sequelize');module[_0xb502('0x0')]={'type':{'type':Sequelize[_0xb502('0x1')](_0xb502('0x2'),_0xb502('0x3'),'customVariable','keyValue',_0xb502('0x4')),'defaultValue':_0xb502('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xb502('0x1')](_0xb502('0x2'),_0xb502('0x3'),_0xb502('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xb502('0x6')]},'nameField':{'type':Sequelize[_0xb502('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb502('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 5a4cb5c..0c8e1ce 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 _0x2248=['filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','find','catch','create','body','params','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','end','error','stack','name','index','SugarcrmField','rawAttributes','fieldName','type','key','model','map','keys','intersection','query','fields','attributes','length','nolimit','order','sort','where','pick','filters'];(function(_0x12889e,_0x696fbe){var _0x21d316=function(_0x4a0d65){while(--_0x4a0d65){_0x12889e['push'](_0x12889e['shift']());}};_0x21d316(++_0x696fbe);}(_0x2248,0xfb));var _0x8224=function(_0x3381ba,_0x4ccb5a){_0x3381ba=_0x3381ba-0x0;var _0x2827ee=_0x2248[_0x3381ba];return _0x2827ee;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8224('0x0'));var jsonpatch=require(_0x8224('0x1'));var rp=require(_0x8224('0x2'));var moment=require(_0x8224('0x3'));var BPromise=require(_0x8224('0x4'));var Mustache=require(_0x8224('0x5'));var util=require(_0x8224('0x6'));var path=require(_0x8224('0x7'));var sox=require(_0x8224('0x8'));var csv=require(_0x8224('0x9'));var ejs=require(_0x8224('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8224('0xb'));var squel=require(_0x8224('0xc'));var crypto=require(_0x8224('0xd'));var jsforce=require(_0x8224('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x8224('0x9'));var querystring=require('querystring');var Papa=require(_0x8224('0xf'));var Redis=require(_0x8224('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x8224('0x11'));var as=require(_0x8224('0x12'));var hardwareService=require(_0x8224('0x13'));var logger=require(_0x8224('0x14'))(_0x8224('0x15'));var utils=require(_0x8224('0x16'));var config=require(_0x8224('0x17'));var licenseUtil=require(_0x8224('0x18'));var db=require(_0x8224('0x19'))['db'];function respondWithStatusCode(_0x3bad56,_0xf98e97){_0xf98e97=_0xf98e97||0xcc;return function(_0x11bf09){if(_0x11bf09){return _0x3bad56[_0x8224('0x1a')](_0xf98e97);}return _0x3bad56[_0x8224('0x1b')](_0xf98e97)['end']();};}function respondWithResult(_0x423c1b,_0x1431c7){_0x1431c7=_0x1431c7||0xc8;return function(_0x4c8147){if(_0x4c8147){return _0x423c1b[_0x8224('0x1b')](_0x1431c7)['json'](_0x4c8147);}};}function respondWithFilteredResult(_0x3c4049,_0x4b8453){return function(_0x59e32c){if(_0x59e32c){var _0x261632=typeof _0x4b8453[_0x8224('0x1c')]===_0x8224('0x1d')&&typeof _0x4b8453[_0x8224('0x1e')]==='undefined';var _0x4409b5=_0x59e32c[_0x8224('0x1f')];var _0x554dd6=_0x261632?0x0:_0x4b8453[_0x8224('0x1c')];var _0x25b0c1=_0x261632?_0x59e32c[_0x8224('0x1f')]:_0x4b8453['offset']+_0x4b8453[_0x8224('0x1e')];var _0x384ddb;if(_0x25b0c1>=_0x4409b5){_0x25b0c1=_0x4409b5;_0x384ddb=0xc8;}else{_0x384ddb=0xce;}_0x3c4049['status'](_0x384ddb);return _0x3c4049[_0x8224('0x20')](_0x8224('0x21'),_0x554dd6+'-'+_0x25b0c1+'/'+_0x4409b5)[_0x8224('0x22')](_0x59e32c);}return null;};}function patchUpdates(_0x54b232){return function(_0x8d90d8){try{jsonpatch[_0x8224('0x23')](_0x8d90d8,_0x54b232,!![]);}catch(_0x39b094){return BPromise[_0x8224('0x24')](_0x39b094);}return _0x8d90d8[_0x8224('0x25')]();};}function saveUpdates(_0x982fb7,_0x564a8f){return function(_0x39805c){if(_0x39805c){return _0x39805c[_0x8224('0x26')](_0x982fb7)['then'](function(_0x1394b6){return _0x1394b6;});}return null;};}function removeEntity(_0x9c7aa7,_0x3e3803){return function(_0xfdf918){if(_0xfdf918){return _0xfdf918[_0x8224('0x27')]()[_0x8224('0x28')](function(){_0x9c7aa7[_0x8224('0x1b')](0xcc)[_0x8224('0x29')]();});}};}function handleEntityNotFound(_0x40e410,_0x2cfa54){return function(_0x34c5ff){if(!_0x34c5ff){_0x40e410[_0x8224('0x1a')](0x194);}return _0x34c5ff;};}function handleError(_0x4eefe9,_0x5f3ea5){_0x5f3ea5=_0x5f3ea5||0x1f4;return function(_0x1a55b0){logger[_0x8224('0x2a')](_0x1a55b0[_0x8224('0x2b')]);if(_0x1a55b0[_0x8224('0x2c')]){delete _0x1a55b0[_0x8224('0x2c')];}_0x4eefe9['status'](_0x5f3ea5)['send'](_0x1a55b0);};}exports[_0x8224('0x2d')]=function(_0x6de39d,_0x380ef1){var _0x20fe4d={},_0x4dd90b={},_0x303b99={'count':0x0,'rows':[]};var _0xeb59dc=_['map'](db[_0x8224('0x2e')][_0x8224('0x2f')],function(_0x566c62){return{'name':_0x566c62[_0x8224('0x30')],'type':_0x566c62[_0x8224('0x31')][_0x8224('0x32')]};});_0x4dd90b[_0x8224('0x33')]=_[_0x8224('0x34')](_0xeb59dc,'name');_0x4dd90b['query']=_[_0x8224('0x35')](_0x6de39d['query']);_0x4dd90b['filters']=_[_0x8224('0x36')](_0x4dd90b[_0x8224('0x33')],_0x4dd90b[_0x8224('0x37')]);_0x20fe4d['attributes']=_['intersection'](_0x4dd90b[_0x8224('0x33')],qs[_0x8224('0x38')](_0x6de39d['query'][_0x8224('0x38')]));_0x20fe4d[_0x8224('0x39')]=_0x20fe4d[_0x8224('0x39')][_0x8224('0x3a')]?_0x20fe4d[_0x8224('0x39')]:_0x4dd90b[_0x8224('0x33')];if(!_0x6de39d['query']['hasOwnProperty'](_0x8224('0x3b'))){_0x20fe4d[_0x8224('0x1e')]=qs[_0x8224('0x1e')](_0x6de39d[_0x8224('0x37')][_0x8224('0x1e')]);_0x20fe4d['offset']=qs[_0x8224('0x1c')](_0x6de39d[_0x8224('0x37')][_0x8224('0x1c')]);}_0x20fe4d[_0x8224('0x3c')]=qs[_0x8224('0x3d')](_0x6de39d[_0x8224('0x37')]['sort']);_0x20fe4d[_0x8224('0x3e')]=qs['filters'](_[_0x8224('0x3f')](_0x6de39d['query'],_0x4dd90b[_0x8224('0x40')]),_0xeb59dc);if(_0x6de39d[_0x8224('0x37')][_0x8224('0x41')]){_0x20fe4d['where']=_[_0x8224('0x42')](_0x20fe4d['where'],{'$or':_['map'](_0xeb59dc,function(_0x4652e9){if(_0x4652e9[_0x8224('0x31')]!==_0x8224('0x43')){var _0x39ad7f={};_0x39ad7f[_0x4652e9[_0x8224('0x2c')]]={'$like':'%'+_0x6de39d[_0x8224('0x37')][_0x8224('0x41')]+'%'};return _0x39ad7f;}})});}_0x20fe4d=_[_0x8224('0x42')]({},_0x20fe4d,_0x6de39d[_0x8224('0x44')]);var _0x2d9132={'where':_0x20fe4d[_0x8224('0x3e')]};return db[_0x8224('0x2e')]['count'](_0x2d9132)[_0x8224('0x28')](function(_0x2b1c09){_0x303b99['count']=_0x2b1c09;if(_0x6de39d[_0x8224('0x37')][_0x8224('0x45')]){_0x20fe4d[_0x8224('0x46')]=[{'all':!![]}];}return db['SugarcrmField'][_0x8224('0x47')](_0x20fe4d);})['then'](function(_0x4185e2){_0x303b99[_0x8224('0x48')]=_0x4185e2;return _0x303b99;})[_0x8224('0x28')](respondWithFilteredResult(_0x380ef1,_0x20fe4d))['catch'](handleError(_0x380ef1,null));};exports[_0x8224('0x49')]=function(_0x43000f,_0x3cbfee){var _0x2f940e={'raw':!![],'where':{'id':_0x43000f['params']['id']}},_0x1bd935={};_0x1bd935[_0x8224('0x33')]=_[_0x8224('0x35')](db[_0x8224('0x2e')]['rawAttributes']);_0x1bd935[_0x8224('0x37')]=_['keys'](_0x43000f[_0x8224('0x37')]);_0x1bd935[_0x8224('0x40')]=_['intersection'](_0x1bd935[_0x8224('0x33')],_0x1bd935['query']);_0x2f940e[_0x8224('0x39')]=_[_0x8224('0x36')](_0x1bd935[_0x8224('0x33')],qs[_0x8224('0x38')](_0x43000f[_0x8224('0x37')][_0x8224('0x38')]));_0x2f940e[_0x8224('0x39')]=_0x2f940e['attributes'][_0x8224('0x3a')]?_0x2f940e['attributes']:_0x1bd935[_0x8224('0x33')];if(_0x43000f['query'][_0x8224('0x45')]){_0x2f940e[_0x8224('0x46')]=[{'all':!![]}];}_0x2f940e=_[_0x8224('0x42')]({},_0x2f940e,_0x43000f[_0x8224('0x44')]);return db[_0x8224('0x2e')][_0x8224('0x4a')](_0x2f940e)['then'](handleEntityNotFound(_0x3cbfee,null))[_0x8224('0x28')](respondWithResult(_0x3cbfee,null))[_0x8224('0x4b')](handleError(_0x3cbfee,null));};exports[_0x8224('0x4c')]=function(_0x43cfdb,_0x5ae887){return db[_0x8224('0x2e')][_0x8224('0x4c')](_0x43cfdb[_0x8224('0x4d')],{})[_0x8224('0x28')](respondWithResult(_0x5ae887,0xc9))[_0x8224('0x4b')](handleError(_0x5ae887,null));};exports[_0x8224('0x26')]=function(_0x38da5e,_0x4de607){if(_0x38da5e[_0x8224('0x4d')]['id']){delete _0x38da5e[_0x8224('0x4d')]['id'];}return db['SugarcrmField']['find']({'where':{'id':_0x38da5e[_0x8224('0x4e')]['id']}})[_0x8224('0x28')](handleEntityNotFound(_0x4de607,null))[_0x8224('0x28')](saveUpdates(_0x38da5e[_0x8224('0x4d')],null))[_0x8224('0x28')](respondWithResult(_0x4de607,null))[_0x8224('0x4b')](handleError(_0x4de607,null));};exports['destroy']=function(_0xa7df93,_0x2156ac){return db[_0x8224('0x2e')]['find']({'where':{'id':_0xa7df93[_0x8224('0x4e')]['id']}})[_0x8224('0x28')](handleEntityNotFound(_0x2156ac,null))[_0x8224('0x28')](removeEntity(_0x2156ac,null))[_0x8224('0x4b')](handleError(_0x2156ac,null));}; \ No newline at end of file +var _0xb03e=['findAll','rows','catch','show','params','find','create','body','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','name','send','map','SugarcrmField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','sort','where','pick','VIRTUAL','merge','options','includeAll','include'];(function(_0x1bd9f0,_0x2f618d){var _0x24d691=function(_0x559e9b){while(--_0x559e9b){_0x1bd9f0['push'](_0x1bd9f0['shift']());}};_0x24d691(++_0x2f618d);}(_0xb03e,0x19a));var _0xeb03=function(_0x209dac,_0x5b323c){_0x209dac=_0x209dac-0x0;var _0x4a86df=_0xb03e[_0x209dac];return _0x4a86df;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xeb03('0x0'));var rp=require('request-promise');var moment=require(_0xeb03('0x1'));var BPromise=require(_0xeb03('0x2'));var Mustache=require('mustache');var util=require('util');var path=require(_0xeb03('0x3'));var sox=require(_0xeb03('0x4'));var csv=require(_0xeb03('0x5'));var ejs=require(_0xeb03('0x6'));var fs=require('fs');var fs_extra=require(_0xeb03('0x7'));var _=require(_0xeb03('0x8'));var squel=require('squel');var crypto=require(_0xeb03('0x9'));var jsforce=require(_0xeb03('0xa'));var deskjs=require(_0xeb03('0xb'));var toCsv=require(_0xeb03('0x5'));var querystring=require(_0xeb03('0xc'));var Papa=require('papaparse');var Redis=require(_0xeb03('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xeb03('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xeb03('0xf'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xeb03('0x10'));var db=require(_0xeb03('0x11'))['db'];function respondWithStatusCode(_0x568a80,_0x4a44c3){_0x4a44c3=_0x4a44c3||0xcc;return function(_0x2ad0bd){if(_0x2ad0bd){return _0x568a80[_0xeb03('0x12')](_0x4a44c3);}return _0x568a80[_0xeb03('0x13')](_0x4a44c3)[_0xeb03('0x14')]();};}function respondWithResult(_0x2b805f,_0x5e57aa){_0x5e57aa=_0x5e57aa||0xc8;return function(_0x26a5aa){if(_0x26a5aa){return _0x2b805f[_0xeb03('0x13')](_0x5e57aa)[_0xeb03('0x15')](_0x26a5aa);}};}function respondWithFilteredResult(_0x2f77d1,_0x382404){return function(_0x5b62ba){if(_0x5b62ba){var _0x36014a=typeof _0x382404[_0xeb03('0x16')]===_0xeb03('0x17')&&typeof _0x382404[_0xeb03('0x18')]===_0xeb03('0x17');var _0x594065=_0x5b62ba[_0xeb03('0x19')];var _0x32a48b=_0x36014a?0x0:_0x382404[_0xeb03('0x16')];var _0x4d8b82=_0x36014a?_0x5b62ba[_0xeb03('0x19')]:_0x382404['offset']+_0x382404[_0xeb03('0x18')];var _0x347074;if(_0x4d8b82>=_0x594065){_0x4d8b82=_0x594065;_0x347074=0xc8;}else{_0x347074=0xce;}_0x2f77d1[_0xeb03('0x13')](_0x347074);return _0x2f77d1[_0xeb03('0x1a')](_0xeb03('0x1b'),_0x32a48b+'-'+_0x4d8b82+'/'+_0x594065)[_0xeb03('0x15')](_0x5b62ba);}return null;};}function patchUpdates(_0xb70aaa){return function(_0x46b05e){try{jsonpatch[_0xeb03('0x1c')](_0x46b05e,_0xb70aaa,!![]);}catch(_0x310ad1){return BPromise[_0xeb03('0x1d')](_0x310ad1);}return _0x46b05e[_0xeb03('0x1e')]();};}function saveUpdates(_0xa7ccd1,_0x73d586){return function(_0x55c7b7){if(_0x55c7b7){return _0x55c7b7[_0xeb03('0x1f')](_0xa7ccd1)['then'](function(_0x501df3){return _0x501df3;});}return null;};}function removeEntity(_0x31ae5a,_0x380adf){return function(_0x10323e){if(_0x10323e){return _0x10323e[_0xeb03('0x20')]()[_0xeb03('0x21')](function(){_0x31ae5a[_0xeb03('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32cdb5,_0x33f1b9){return function(_0x296952){if(!_0x296952){_0x32cdb5[_0xeb03('0x12')](0x194);}return _0x296952;};}function handleError(_0x5d2ae7,_0xbecb71){_0xbecb71=_0xbecb71||0x1f4;return function(_0x204d7b){logger[_0xeb03('0x22')](_0x204d7b['stack']);if(_0x204d7b[_0xeb03('0x23')]){delete _0x204d7b['name'];}_0x5d2ae7[_0xeb03('0x13')](_0xbecb71)[_0xeb03('0x24')](_0x204d7b);};}exports['index']=function(_0x5ee4af,_0x285541){var _0x12789d={},_0x468210={},_0xf89e0c={'count':0x0,'rows':[]};var _0x59a8cc=_[_0xeb03('0x25')](db[_0xeb03('0x26')][_0xeb03('0x27')],function(_0x443e1c){return{'name':_0x443e1c[_0xeb03('0x28')],'type':_0x443e1c[_0xeb03('0x29')][_0xeb03('0x2a')]};});_0x468210[_0xeb03('0x2b')]=_[_0xeb03('0x25')](_0x59a8cc,'name');_0x468210[_0xeb03('0x2c')]=_[_0xeb03('0x2d')](_0x5ee4af[_0xeb03('0x2c')]);_0x468210[_0xeb03('0x2e')]=_[_0xeb03('0x2f')](_0x468210[_0xeb03('0x2b')],_0x468210[_0xeb03('0x2c')]);_0x12789d[_0xeb03('0x30')]=_[_0xeb03('0x2f')](_0x468210[_0xeb03('0x2b')],qs[_0xeb03('0x31')](_0x5ee4af[_0xeb03('0x2c')][_0xeb03('0x31')]));_0x12789d[_0xeb03('0x30')]=_0x12789d['attributes'][_0xeb03('0x32')]?_0x12789d['attributes']:_0x468210[_0xeb03('0x2b')];if(!_0x5ee4af[_0xeb03('0x2c')]['hasOwnProperty']('nolimit')){_0x12789d[_0xeb03('0x18')]=qs[_0xeb03('0x18')](_0x5ee4af['query'][_0xeb03('0x18')]);_0x12789d[_0xeb03('0x16')]=qs[_0xeb03('0x16')](_0x5ee4af[_0xeb03('0x2c')]['offset']);}_0x12789d['order']=qs[_0xeb03('0x33')](_0x5ee4af['query'][_0xeb03('0x33')]);_0x12789d[_0xeb03('0x34')]=qs[_0xeb03('0x2e')](_[_0xeb03('0x35')](_0x5ee4af['query'],_0x468210['filters']),_0x59a8cc);if(_0x5ee4af[_0xeb03('0x2c')]['filter']){_0x12789d['where']=_['merge'](_0x12789d[_0xeb03('0x34')],{'$or':_[_0xeb03('0x25')](_0x59a8cc,function(_0x4e134a){if(_0x4e134a['type']!==_0xeb03('0x36')){var _0x415e55={};_0x415e55[_0x4e134a[_0xeb03('0x23')]]={'$like':'%'+_0x5ee4af['query']['filter']+'%'};return _0x415e55;}})});}_0x12789d=_[_0xeb03('0x37')]({},_0x12789d,_0x5ee4af[_0xeb03('0x38')]);var _0x1a38c4={'where':_0x12789d[_0xeb03('0x34')]};return db[_0xeb03('0x26')][_0xeb03('0x19')](_0x1a38c4)[_0xeb03('0x21')](function(_0x7071c3){_0xf89e0c[_0xeb03('0x19')]=_0x7071c3;if(_0x5ee4af[_0xeb03('0x2c')][_0xeb03('0x39')]){_0x12789d[_0xeb03('0x3a')]=[{'all':!![]}];}return db['SugarcrmField'][_0xeb03('0x3b')](_0x12789d);})[_0xeb03('0x21')](function(_0x2670ef){_0xf89e0c[_0xeb03('0x3c')]=_0x2670ef;return _0xf89e0c;})[_0xeb03('0x21')](respondWithFilteredResult(_0x285541,_0x12789d))[_0xeb03('0x3d')](handleError(_0x285541,null));};exports[_0xeb03('0x3e')]=function(_0x2aa0dd,_0x847009){var _0x4e0c9e={'raw':!![],'where':{'id':_0x2aa0dd[_0xeb03('0x3f')]['id']}},_0x34d8b2={};_0x34d8b2[_0xeb03('0x2b')]=_[_0xeb03('0x2d')](db['SugarcrmField']['rawAttributes']);_0x34d8b2['query']=_[_0xeb03('0x2d')](_0x2aa0dd[_0xeb03('0x2c')]);_0x34d8b2[_0xeb03('0x2e')]=_[_0xeb03('0x2f')](_0x34d8b2[_0xeb03('0x2b')],_0x34d8b2[_0xeb03('0x2c')]);_0x4e0c9e[_0xeb03('0x30')]=_[_0xeb03('0x2f')](_0x34d8b2['model'],qs[_0xeb03('0x31')](_0x2aa0dd[_0xeb03('0x2c')][_0xeb03('0x31')]));_0x4e0c9e[_0xeb03('0x30')]=_0x4e0c9e[_0xeb03('0x30')][_0xeb03('0x32')]?_0x4e0c9e[_0xeb03('0x30')]:_0x34d8b2[_0xeb03('0x2b')];if(_0x2aa0dd[_0xeb03('0x2c')][_0xeb03('0x39')]){_0x4e0c9e[_0xeb03('0x3a')]=[{'all':!![]}];}_0x4e0c9e=_['merge']({},_0x4e0c9e,_0x2aa0dd['options']);return db[_0xeb03('0x26')][_0xeb03('0x40')](_0x4e0c9e)[_0xeb03('0x21')](handleEntityNotFound(_0x847009,null))[_0xeb03('0x21')](respondWithResult(_0x847009,null))[_0xeb03('0x3d')](handleError(_0x847009,null));};exports[_0xeb03('0x41')]=function(_0x5b2d76,_0x5dec6a){return db['SugarcrmField'][_0xeb03('0x41')](_0x5b2d76['body'],{})[_0xeb03('0x21')](respondWithResult(_0x5dec6a,0xc9))[_0xeb03('0x3d')](handleError(_0x5dec6a,null));};exports['update']=function(_0x218e4c,_0x105363){if(_0x218e4c[_0xeb03('0x42')]['id']){delete _0x218e4c[_0xeb03('0x42')]['id'];}return db['SugarcrmField']['find']({'where':{'id':_0x218e4c[_0xeb03('0x3f')]['id']}})[_0xeb03('0x21')](handleEntityNotFound(_0x105363,null))[_0xeb03('0x21')](saveUpdates(_0x218e4c[_0xeb03('0x42')],null))['then'](respondWithResult(_0x105363,null))[_0xeb03('0x3d')](handleError(_0x105363,null));};exports[_0xeb03('0x20')]=function(_0x53883e,_0x3b1ee5){return db[_0xeb03('0x26')][_0xeb03('0x40')]({'where':{'id':_0x53883e[_0xeb03('0x3f')]['id']}})['then'](handleEntityNotFound(_0x3b1ee5,null))[_0xeb03('0x21')](removeEntity(_0x3b1ee5,null))['catch'](handleError(_0x3b1ee5,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index eab940e..7393071 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 _0x5554=['exports','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','util','api','moment','bluebird','request-promise','rimraf','./intSugarcrmField.attributes'];(function(_0x3970cf,_0x36f9a0){var _0x4ac432=function(_0x58cf15){while(--_0x58cf15){_0x3970cf['push'](_0x3970cf['shift']());}};_0x4ac432(++_0x36f9a0);}(_0x5554,0x19d));var _0x4555=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x5554[_0x110c3d];return _0x226d67;};'use strict';var _=require('lodash');var util=require(_0x4555('0x0'));var logger=require('../../config/logger')(_0x4555('0x1'));var moment=require(_0x4555('0x2'));var BPromise=require(_0x4555('0x3'));var rp=require(_0x4555('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4555('0x5'));var config=require('../../config/environment');var attributes=require(_0x4555('0x6'));module[_0x4555('0x7')]=function(_0x1b468d,_0x4d6059){return _0x1b468d['define'](_0x4555('0x8'),attributes,{'tableName':_0x4555('0x9'),'paranoid':![],'indexes':[{'name':_0x4555('0xa'),'fields':[_0x4555('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa941=['int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','util','../../config/logger','api','bluebird','request-promise','rimraf','./intSugarcrmField.attributes','exports','define','SugarcrmField'];(function(_0x1a0011,_0x32b202){var _0x49bfb2=function(_0x2ecc23){while(--_0x2ecc23){_0x1a0011['push'](_0x1a0011['shift']());}};_0x49bfb2(++_0x32b202);}(_0xa941,0x1e0));var _0x1a94=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xa941[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require('lodash');var util=require(_0x1a94('0x0'));var logger=require(_0x1a94('0x1'))(_0x1a94('0x2'));var moment=require('moment');var BPromise=require(_0x1a94('0x3'));var rp=require(_0x1a94('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1a94('0x5'));var config=require('../../config/environment');var attributes=require(_0x1a94('0x6'));module[_0x1a94('0x7')]=function(_0x1e1da9,_0x3dec76){return _0x1e1da9[_0x1a94('0x8')](_0x1a94('0x9'),attributes,{'tableName':_0x1a94('0xa'),'paranoid':![],'indexes':[{'name':_0x1a94('0xb'),'fields':[_0x1a94('0xc'),_0x1a94('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index a95acc0..074baf3 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 _0x392a=['stringify','error','code','message','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','SugarcrmField,\x20%s,\x20%s,\x20%s'];(function(_0x4051be,_0x4e30dc){var _0x10d8e5=function(_0x1ae1c2){while(--_0x1ae1c2){_0x4051be['push'](_0x4051be['shift']());}};_0x10d8e5(++_0x4e30dc);}(_0x392a,0x83));var _0xa392=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x392a[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0xa392('0x0'));var util=require(_0xa392('0x1'));var moment=require('moment');var BPromise=require(_0xa392('0x2'));var rs=require(_0xa392('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa392('0x4'))['db'];var utils=require(_0xa392('0x5'));var logger=require(_0xa392('0x6'))(_0xa392('0x7'));var config=require('../../config/environment');var jayson=require(_0xa392('0x8'));var client=jayson[_0xa392('0x9')][_0xa392('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b50cf,_0x44ccaf,_0x267fa6){return new BPromise(function(_0x28864b,_0x25b908){return client[_0xa392('0xb')](_0x2b50cf,_0x267fa6)['then'](function(_0x570339){logger[_0xa392('0xc')](_0xa392('0xd'),_0x44ccaf,_0xa392('0xe'));logger['debug'](_0xa392('0xf'),_0x44ccaf,_0xa392('0xe'),JSON[_0xa392('0x10')](_0x570339));if(_0x570339[_0xa392('0x11')]){if(_0x570339['error'][_0xa392('0x12')]===0x1f4){logger['error'](_0xa392('0xd'),_0x44ccaf,_0x570339[_0xa392('0x11')][_0xa392('0x13')]);return _0x25b908(_0x570339[_0xa392('0x11')][_0xa392('0x13')]);}logger['error'](_0xa392('0xd'),_0x44ccaf,_0x570339[_0xa392('0x11')]['message']);return _0x28864b(_0x570339['error']['message']);}else{logger['info'](_0xa392('0xd'),_0x44ccaf,_0xa392('0xe'));_0x28864b(_0x570339[_0xa392('0x14')][_0xa392('0x13')]);}})['catch'](function(_0x1dcee2){logger[_0xa392('0x11')]('SugarcrmField,\x20%s,\x20%s',_0x44ccaf,_0x1dcee2);_0x25b908(_0x1dcee2);});});} \ No newline at end of file +var _0x975b=['../../config/environment','jayson/promise','http','request','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x239d8f,_0x59d10e){var _0x1597d6=function(_0x68afba){while(--_0x68afba){_0x239d8f['push'](_0x239d8f['shift']());}};_0x1597d6(++_0x59d10e);}(_0x975b,0x66));var _0xb975=function(_0xba92a7,_0x32cf31){_0xba92a7=_0xba92a7-0x0;var _0x2b7eda=_0x975b[_0xba92a7];return _0x2b7eda;};'use strict';var _=require('lodash');var util=require(_0xb975('0x0'));var moment=require(_0xb975('0x1'));var BPromise=require(_0xb975('0x2'));var rs=require(_0xb975('0x3'));var fs=require('fs');var Redis=require(_0xb975('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb975('0x5'));var logger=require(_0xb975('0x6'))(_0xb975('0x7'));var config=require(_0xb975('0x8'));var jayson=require(_0xb975('0x9'));var client=jayson['client'][_0xb975('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x513305,_0x592b12,_0x11b80b){return new BPromise(function(_0x327823,_0x57f1f3){return client[_0xb975('0xb')](_0x513305,_0x11b80b)['then'](function(_0x277340){logger[_0xb975('0xc')](_0xb975('0xd'),_0x592b12,_0xb975('0xe'));logger['debug'](_0xb975('0xf'),_0x592b12,'request\x20sent',JSON[_0xb975('0x10')](_0x277340));if(_0x277340['error']){if(_0x277340[_0xb975('0x11')][_0xb975('0x12')]===0x1f4){logger[_0xb975('0x11')]('SugarcrmField,\x20%s,\x20%s',_0x592b12,_0x277340[_0xb975('0x11')][_0xb975('0x13')]);return _0x57f1f3(_0x277340['error']['message']);}logger[_0xb975('0x11')](_0xb975('0xd'),_0x592b12,_0x277340['error'][_0xb975('0x13')]);return _0x327823(_0x277340[_0xb975('0x11')]['message']);}else{logger['info']('SugarcrmField,\x20%s,\x20%s',_0x592b12,_0xb975('0xe'));_0x327823(_0x277340[_0xb975('0x14')][_0xb975('0x13')]);}})[_0xb975('0x15')](function(_0x4843c0){logger[_0xb975('0x11')](_0xb975('0xd'),_0x592b12,_0x4843c0);_0x57f1f3(_0x4843c0);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 2d39bcb..6ad474f 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 _0xbbcb=['create','addConfiguration','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','getConfigurations','/:id/fields','getFields','post'];(function(_0x1633a0,_0x3cdfc1){var _0x523846=function(_0x564b28){while(--_0x564b28){_0x1633a0['push'](_0x1633a0['shift']());}};_0x523846(++_0x3cdfc1);}(_0xbbcb,0x16e));var _0xbbbc=function(_0x155843,_0x43404e){_0x155843=_0x155843-0x0;var _0x2dd29f=_0xbbcb[_0x155843];return _0x2dd29f;};'use strict';var multer=require(_0xbbbc('0x0'));var util=require(_0xbbbc('0x1'));var path=require(_0xbbbc('0x2'));var timeout=require(_0xbbbc('0x3'));var express=require(_0xbbbc('0x4'));var router=express[_0xbbbc('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xbbbc('0x6'));var interaction=require(_0xbbbc('0x7'));var config=require(_0xbbbc('0x8'));var controller=require(_0xbbbc('0x9'));router[_0xbbbc('0xa')]('/',auth[_0xbbbc('0xb')](),controller[_0xbbbc('0xc')]);router[_0xbbbc('0xa')](_0xbbbc('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xbbbc('0xa')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xbbbc('0xe')]);router[_0xbbbc('0xa')](_0xbbbc('0xf'),auth[_0xbbbc('0xb')](),controller[_0xbbbc('0x10')]);router[_0xbbbc('0x11')]('/',auth['isAuthenticated'](),controller[_0xbbbc('0x12')]);router[_0xbbbc('0x11')]('/:id/configurations',auth[_0xbbbc('0xb')](),controller[_0xbbbc('0x13')]);router[_0xbbbc('0x14')]('/:id',auth[_0xbbbc('0xb')](),controller[_0xbbbc('0x15')]);router['delete'](_0xbbbc('0xd'),auth[_0xbbbc('0xb')](),controller[_0xbbbc('0x16')]);module[_0xbbbc('0x17')]=router; \ No newline at end of file +var _0x6fb8=['getFields','post','create','addConfiguration','put','update','delete','exports','multer','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations'];(function(_0x503102,_0x79b68c){var _0x5e0089=function(_0x4ee065){while(--_0x4ee065){_0x503102['push'](_0x503102['shift']());}};_0x5e0089(++_0x79b68c);}(_0x6fb8,0x104));var _0x86fb=function(_0x12c280,_0x51dd07){_0x12c280=_0x12c280-0x0;var _0x3638d3=_0x6fb8[_0x12c280];return _0x3638d3;};'use strict';var multer=require(_0x86fb('0x0'));var util=require('util');var path=require(_0x86fb('0x1'));var timeout=require(_0x86fb('0x2'));var express=require('express');var router=express[_0x86fb('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x86fb('0x4'));var config=require(_0x86fb('0x5'));var controller=require(_0x86fb('0x6'));router[_0x86fb('0x7')]('/',auth[_0x86fb('0x8')](),controller[_0x86fb('0x9')]);router[_0x86fb('0x7')](_0x86fb('0xa'),auth[_0x86fb('0x8')](),controller[_0x86fb('0xb')]);router[_0x86fb('0x7')](_0x86fb('0xc'),auth[_0x86fb('0x8')](),controller['getConfigurations']);router[_0x86fb('0x7')]('/:id/fields',auth[_0x86fb('0x8')](),controller[_0x86fb('0xd')]);router[_0x86fb('0xe')]('/',auth['isAuthenticated'](),controller[_0x86fb('0xf')]);router['post'](_0x86fb('0xc'),auth[_0x86fb('0x8')](),controller[_0x86fb('0x10')]);router[_0x86fb('0x11')](_0x86fb('0xa'),auth[_0x86fb('0x8')](),controller[_0x86fb('0x12')]);router[_0x86fb('0x13')](_0x86fb('0xa'),auth[_0x86fb('0x8')](),controller['destroy']);module[_0x86fb('0x14')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index a5bc7e9..9db6265 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 _0xc7b3=['exports','STRING','sequelize'];(function(_0xf6be2d,_0x30101e){var _0x58e4fa=function(_0x2f444b){while(--_0x2f444b){_0xf6be2d['push'](_0xf6be2d['shift']());}};_0x58e4fa(++_0x30101e);}(_0xc7b3,0xc8));var _0x3c7b=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xc7b3[_0x1694f5];return _0x5b4321;};'use strict';var Sequelize=require(_0x3c7b('0x0'));module[_0x3c7b('0x1')]={'name':{'type':Sequelize[_0x3c7b('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x3c7b('0x2')]},'username':{'type':Sequelize[_0x3c7b('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x3c7b('0x2')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0x3c7b('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0x3c7b('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xbd62=['exports','STRING','HelpDesk'];(function(_0x5d7c45,_0x7f1fe0){var _0x196a18=function(_0x3aecc7){while(--_0x3aecc7){_0x5d7c45['push'](_0x5d7c45['shift']());}};_0x196a18(++_0x7f1fe0);}(_0xbd62,0x99));var _0x2bd6=function(_0x16ce40,_0xbc8451){_0x16ce40=_0x16ce40-0x0;var _0x227e2b=_0xbd62[_0x16ce40];return _0x227e2b;};'use strict';var Sequelize=require('sequelize');module[_0x2bd6('0x0')]={'name':{'type':Sequelize[_0x2bd6('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x2bd6('0x1')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x2bd6('0x1')],'allowNull':![],'defaultValue':_0x2bd6('0x2')},'remoteUri':{'type':Sequelize[_0x2bd6('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x2bd6('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x2bd6('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 70673c9..2ac8f97 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 _0x2072=['then','destroy','error','stack','name','index','map','VtigerAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','merge','where','VIRTUAL','includeAll','include','findAll','rows','show','params','options','find','catch','create','body','update','getConfigurations','VtigerConfiguration','nolimit','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','VtigerField','getFields','username','moduleName','remoteUri','serverUrl','accessKey','slice','substring','lastIndexOf','format','getchallenge','success','login','result','token','GET','describe','sessionName','autogenerated','reference','remove','includes','editable','false','label','startsWith','picklist','picklistValues','value','log','vTiger\x20error:\x20','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','test','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save'];(function(_0x1adb96,_0x5c8a81){var _0x13ab64=function(_0x4d031a){while(--_0x4d031a){_0x1adb96['push'](_0x1adb96['shift']());}};_0x13ab64(++_0x5c8a81);}(_0x2072,0xd0));var _0x2207=function(_0x3d57f5,_0x58043f){_0x3d57f5=_0x3d57f5-0x0;var _0x1b6ef3=_0x2072[_0x3d57f5];return _0x1b6ef3;};'use strict';var emlformat=require(_0x2207('0x0'));var rimraf=require(_0x2207('0x1'));var zipdir=require(_0x2207('0x2'));var jsonpatch=require(_0x2207('0x3'));var rp=require(_0x2207('0x4'));var moment=require(_0x2207('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2207('0x6'));var util=require('util');var path=require('path');var sox=require(_0x2207('0x7'));var csv=require(_0x2207('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2207('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2207('0xa'));var jsforce=require(_0x2207('0xb'));var deskjs=require(_0x2207('0xc'));var toCsv=require(_0x2207('0x8'));var querystring=require(_0x2207('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2207('0xe'));var qs=require(_0x2207('0xf'));var as=require(_0x2207('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2207('0x11'))(_0x2207('0x12'));var utils=require(_0x2207('0x13'));var config=require(_0x2207('0x14'));var licenseUtil=require(_0x2207('0x15'));var db=require(_0x2207('0x16'))['db'];var integrations=require(_0x2207('0x17'));function respondWithStatusCode(_0x279f7e,_0xceeb8d){_0xceeb8d=_0xceeb8d||0xcc;return function(_0x3cd2b1){if(_0x3cd2b1){return _0x279f7e[_0x2207('0x18')](_0xceeb8d);}return _0x279f7e[_0x2207('0x19')](_0xceeb8d)[_0x2207('0x1a')]();};}function respondWithResult(_0x256a02,_0x2bfea2){_0x2bfea2=_0x2bfea2||0xc8;return function(_0x239a21){if(_0x239a21){return _0x256a02['status'](_0x2bfea2)['json'](_0x239a21);}};}function respondWithFilteredResult(_0xf39205,_0x19a826){return function(_0x3e769f){if(_0x3e769f){var _0x155c8b=typeof _0x19a826[_0x2207('0x1b')]===_0x2207('0x1c')&&typeof _0x19a826[_0x2207('0x1d')]==='undefined';var _0x490843=_0x3e769f[_0x2207('0x1e')];var _0x16d671=_0x155c8b?0x0:_0x19a826['offset'];var _0x5558ec=_0x155c8b?_0x3e769f[_0x2207('0x1e')]:_0x19a826[_0x2207('0x1b')]+_0x19a826['limit'];var _0x4a7cdb;if(_0x5558ec>=_0x490843){_0x5558ec=_0x490843;_0x4a7cdb=0xc8;}else{_0x4a7cdb=0xce;}_0xf39205[_0x2207('0x19')](_0x4a7cdb);return _0xf39205[_0x2207('0x1f')](_0x2207('0x20'),_0x16d671+'-'+_0x5558ec+'/'+_0x490843)[_0x2207('0x21')](_0x3e769f);}return null;};}function patchUpdates(_0x530bd7){return function(_0x2033d3){try{jsonpatch[_0x2207('0x22')](_0x2033d3,_0x530bd7,!![]);}catch(_0x3a7523){return BPromise['reject'](_0x3a7523);}return _0x2033d3[_0x2207('0x23')]();};}function saveUpdates(_0x4a0c40,_0x5111a6){return function(_0x21b7f1){if(_0x21b7f1){return _0x21b7f1['update'](_0x4a0c40)[_0x2207('0x24')](function(_0x143717){return _0x143717;});}return null;};}function removeEntity(_0xe6410c,_0x2e5866){return function(_0x53c8bc){if(_0x53c8bc){return _0x53c8bc[_0x2207('0x25')]()[_0x2207('0x24')](function(){_0xe6410c[_0x2207('0x19')](0xcc)[_0x2207('0x1a')]();});}};}function handleEntityNotFound(_0x2efca6,_0x4c1658){return function(_0x3f6118){if(!_0x3f6118){_0x2efca6[_0x2207('0x18')](0x194);}return _0x3f6118;};}function handleError(_0x1f0525,_0x411442){_0x411442=_0x411442||0x1f4;return function(_0x51c102){logger[_0x2207('0x26')](_0x51c102[_0x2207('0x27')]);if(_0x51c102[_0x2207('0x28')]){delete _0x51c102[_0x2207('0x28')];}_0x1f0525[_0x2207('0x19')](_0x411442)['send'](_0x51c102);};}exports[_0x2207('0x29')]=function(_0x28c12d,_0x31233c){var _0x396def={},_0x48d8ba={},_0x586468={'count':0x0,'rows':[]};var _0x1e100f=_[_0x2207('0x2a')](db[_0x2207('0x2b')][_0x2207('0x2c')],function(_0xf022e7){return{'name':_0xf022e7[_0x2207('0x2d')],'type':_0xf022e7[_0x2207('0x2e')][_0x2207('0x2f')]};});_0x48d8ba[_0x2207('0x30')]=_[_0x2207('0x2a')](_0x1e100f,_0x2207('0x28'));_0x48d8ba[_0x2207('0x31')]=_[_0x2207('0x32')](_0x28c12d[_0x2207('0x31')]);_0x48d8ba[_0x2207('0x33')]=_[_0x2207('0x34')](_0x48d8ba['model'],_0x48d8ba[_0x2207('0x31')]);_0x396def[_0x2207('0x35')]=_[_0x2207('0x34')](_0x48d8ba[_0x2207('0x30')],qs['fields'](_0x28c12d[_0x2207('0x31')][_0x2207('0x36')]));_0x396def['attributes']=_0x396def['attributes'][_0x2207('0x37')]?_0x396def[_0x2207('0x35')]:_0x48d8ba[_0x2207('0x30')];if(!_0x28c12d['query'][_0x2207('0x38')]('nolimit')){_0x396def[_0x2207('0x1d')]=qs[_0x2207('0x1d')](_0x28c12d[_0x2207('0x31')]['limit']);_0x396def['offset']=qs['offset'](_0x28c12d[_0x2207('0x31')]['offset']);}_0x396def[_0x2207('0x39')]=qs['sort'](_0x28c12d[_0x2207('0x31')][_0x2207('0x3a')]);_0x396def['where']=qs[_0x2207('0x33')](_[_0x2207('0x3b')](_0x28c12d['query'],_0x48d8ba[_0x2207('0x33')]),_0x1e100f);if(_0x28c12d[_0x2207('0x31')][_0x2207('0x3c')]){_0x396def['where']=_[_0x2207('0x3d')](_0x396def[_0x2207('0x3e')],{'$or':_[_0x2207('0x2a')](_0x1e100f,function(_0x5e3446){if(_0x5e3446[_0x2207('0x2e')]!==_0x2207('0x3f')){var _0x4e6d6f={};_0x4e6d6f[_0x5e3446['name']]={'$like':'%'+_0x28c12d[_0x2207('0x31')][_0x2207('0x3c')]+'%'};return _0x4e6d6f;}})});}_0x396def=_[_0x2207('0x3d')]({},_0x396def,_0x28c12d['options']);var _0x707e5c={'where':_0x396def[_0x2207('0x3e')]};return db['VtigerAccount'][_0x2207('0x1e')](_0x707e5c)['then'](function(_0x5d86bf){_0x586468[_0x2207('0x1e')]=_0x5d86bf;if(_0x28c12d[_0x2207('0x31')][_0x2207('0x40')]){_0x396def[_0x2207('0x41')]=[{'all':!![]}];}return db[_0x2207('0x2b')][_0x2207('0x42')](_0x396def);})['then'](function(_0x4b09fe){_0x586468[_0x2207('0x43')]=_0x4b09fe;return _0x586468;})[_0x2207('0x24')](respondWithFilteredResult(_0x31233c,_0x396def))['catch'](handleError(_0x31233c,null));};exports[_0x2207('0x44')]=function(_0x146b53,_0x25d424){var _0x1e31b7={'raw':![],'where':{'id':_0x146b53[_0x2207('0x45')]['id']}},_0x36a76f={};_0x36a76f[_0x2207('0x30')]=_['keys'](db[_0x2207('0x2b')]['rawAttributes']);_0x36a76f[_0x2207('0x31')]=_[_0x2207('0x32')](_0x146b53[_0x2207('0x31')]);_0x36a76f[_0x2207('0x33')]=_[_0x2207('0x34')](_0x36a76f['model'],_0x36a76f['query']);_0x1e31b7[_0x2207('0x35')]=_[_0x2207('0x34')](_0x36a76f['model'],qs[_0x2207('0x36')](_0x146b53[_0x2207('0x31')][_0x2207('0x36')]));_0x1e31b7[_0x2207('0x35')]=_0x1e31b7[_0x2207('0x35')]['length']?_0x1e31b7['attributes']:_0x36a76f[_0x2207('0x30')];if(_0x146b53[_0x2207('0x31')]['includeAll']){_0x1e31b7[_0x2207('0x41')]=[{'all':!![]}];}_0x1e31b7=_[_0x2207('0x3d')]({},_0x1e31b7,_0x146b53[_0x2207('0x46')]);return db[_0x2207('0x2b')][_0x2207('0x47')](_0x1e31b7)[_0x2207('0x24')](handleEntityNotFound(_0x25d424,null))[_0x2207('0x24')](respondWithResult(_0x25d424,null))[_0x2207('0x48')](handleError(_0x25d424,null));};exports['create']=function(_0xe71fbb,_0x1c9e5c){return db[_0x2207('0x2b')][_0x2207('0x49')](_0xe71fbb[_0x2207('0x4a')],{})[_0x2207('0x24')](respondWithResult(_0x1c9e5c,0xc9))[_0x2207('0x48')](handleError(_0x1c9e5c,null));};exports[_0x2207('0x4b')]=function(_0x43672c,_0x131e18){if(_0x43672c['body']['id']){delete _0x43672c['body']['id'];}return db['VtigerAccount'][_0x2207('0x47')]({'where':{'id':_0x43672c[_0x2207('0x45')]['id']}})['then'](handleEntityNotFound(_0x131e18,null))[_0x2207('0x24')](saveUpdates(_0x43672c[_0x2207('0x4a')],null))[_0x2207('0x24')](respondWithResult(_0x131e18,null))['catch'](handleError(_0x131e18,null));};exports[_0x2207('0x25')]=function(_0x1d5ef3,_0x2e301d){return db[_0x2207('0x2b')][_0x2207('0x47')]({'where':{'id':_0x1d5ef3[_0x2207('0x45')]['id']}})[_0x2207('0x24')](handleEntityNotFound(_0x2e301d,null))[_0x2207('0x24')](removeEntity(_0x2e301d,null))['catch'](handleError(_0x2e301d,null));};exports[_0x2207('0x4c')]=function(_0x2f68c0,_0x985687,_0x5af613){var _0x1cacbe={};var _0x3094af={};var _0x84baf6;var _0xe21003;return db[_0x2207('0x2b')]['findOne']({'where':{'id':_0x2f68c0[_0x2207('0x45')]['id']}})[_0x2207('0x24')](handleEntityNotFound(_0x985687,null))[_0x2207('0x24')](function(_0x340a6c){if(_0x340a6c){_0x84baf6=_0x340a6c;_0x3094af[_0x2207('0x30')]=_['keys'](db[_0x2207('0x4d')][_0x2207('0x2c')]);_0x3094af[_0x2207('0x31')]=_[_0x2207('0x32')](_0x2f68c0['query']);_0x3094af[_0x2207('0x33')]=_[_0x2207('0x34')](_0x3094af['model'],_0x3094af[_0x2207('0x31')]);_0x1cacbe[_0x2207('0x35')]=_[_0x2207('0x34')](_0x3094af[_0x2207('0x30')],qs[_0x2207('0x36')](_0x2f68c0[_0x2207('0x31')][_0x2207('0x36')]));_0x1cacbe[_0x2207('0x35')]=_0x1cacbe[_0x2207('0x35')][_0x2207('0x37')]?_0x1cacbe['attributes']:_0x3094af[_0x2207('0x30')];_0x1cacbe[_0x2207('0x39')]=qs[_0x2207('0x3a')](_0x2f68c0[_0x2207('0x31')][_0x2207('0x3a')]);_0x1cacbe['where']=qs[_0x2207('0x33')](_['pick'](_0x2f68c0[_0x2207('0x31')],_0x3094af[_0x2207('0x33')]));if(_0x2f68c0['query'][_0x2207('0x3c')]){_0x1cacbe[_0x2207('0x3e')]=_['merge'](_0x1cacbe[_0x2207('0x3e')],{'$or':_[_0x2207('0x2a')](_0x1cacbe[_0x2207('0x35')],function(_0x398972){var _0x83bec5={};_0x83bec5[_0x398972]={'$like':'%'+_0x2f68c0[_0x2207('0x31')][_0x2207('0x3c')]+'%'};return _0x83bec5;})});}_0x1cacbe=_[_0x2207('0x3d')]({},_0x1cacbe,_0x2f68c0[_0x2207('0x46')]);return _0x84baf6[_0x2207('0x4c')](_0x1cacbe);}})[_0x2207('0x24')](function(_0x2a63f9){if(_0x2a63f9){_0xe21003=_0x2a63f9['length'];if(!_0x2f68c0[_0x2207('0x31')][_0x2207('0x38')](_0x2207('0x4e'))){_0x1cacbe[_0x2207('0x1d')]=qs[_0x2207('0x1d')](_0x2f68c0[_0x2207('0x31')][_0x2207('0x1d')]);_0x1cacbe[_0x2207('0x1b')]=qs['offset'](_0x2f68c0[_0x2207('0x31')]['offset']);}return _0x84baf6[_0x2207('0x4c')](_0x1cacbe);}})['then'](function(_0x1c80f0){if(_0x1c80f0){return _0x1c80f0?{'count':_0xe21003,'rows':_0x1c80f0}:null;}})['then'](respondWithResult(_0x985687,null))['catch'](handleError(_0x985687,null));};exports[_0x2207('0x4f')]=function(_0x1cd67c,_0x1aeb27,_0x794603){if(_0x1cd67c[_0x2207('0x4a')]['id']){delete _0x1cd67c[_0x2207('0x4a')]['id'];}return db[_0x2207('0x2b')][_0x2207('0x50')]({'where':{'id':_0x1cd67c['params']['id']}})['then'](handleEntityNotFound(_0x1aeb27,null))['then'](function(_0x232aab){if(_0x232aab){_0x1cd67c['body'][_0x2207('0x51')]=_0x232aab['id'];_0x1cd67c[_0x2207('0x4a')][_0x2207('0x52')]=integrations[_0x2207('0x53')](_0x1cd67c[_0x2207('0x4a')][_0x2207('0x54')],_0x1cd67c[_0x2207('0x4a')][_0x2207('0x2e')]);_0x1cd67c['body'][_0x2207('0x55')]=integrations['getDescriptions'](_0x1cd67c[_0x2207('0x4a')][_0x2207('0x54')],_0x1cd67c['body']['type']);return db[_0x2207('0x4d')]['create'](_0x1cd67c[_0x2207('0x4a')],{'include':[{'model':db['VtigerField'],'as':_0x2207('0x52')},{'model':db[_0x2207('0x56')],'as':_0x2207('0x55')}]});}return null;})['then'](respondWithResult(_0x1aeb27,null))[_0x2207('0x48')](handleError(_0x1aeb27,null));};var md5=require('md5');exports[_0x2207('0x57')]=function(_0x2f5c7d,_0x1dfa3f,_0x1dfe6e){var _0x58190d=null;var _0x7ea826=null;var _0x353859=null;var _0x276d95=null;var _0x320489='';return db[_0x2207('0x2b')][_0x2207('0x50')]({'where':{'id':_0x2f5c7d[_0x2207('0x45')]['id']},'attributes':['id',_0x2207('0x28'),_0x2207('0x58'),'description',_0x2207('0x59'),_0x2207('0x5a'),_0x2207('0x5b'),_0x2207('0x5c')]})[_0x2207('0x24')](handleEntityNotFound(_0x1dfa3f,null))[_0x2207('0x24')](function(_0x1c6e09){if(_0x1c6e09){_0x58190d=_0x1c6e09['username'];_0x7ea826=_0x1c6e09['accessKey'];_0x353859=_0x1c6e09[_0x2207('0x59')];_0x320489=_0x1c6e09[_0x2207('0x5a')];var _0x4f1a24=_0x320489[_0x2207('0x5d')](-0x1);if(_0x4f1a24==='/'){_0x320489=_0x320489[_0x2207('0x5e')](0x0,_0x320489[_0x2207('0x5f')](_0x4f1a24));}_0x276d95=util[_0x2207('0x60')]('%s/webservice.php',_0x320489);var _0x15dc7d={'method':'GET','uri':_0x276d95,'qs':{'operation':_0x2207('0x61'),'username':_0x1c6e09[_0x2207('0x58')]},'json':!![]};return rp(_0x15dc7d);}})[_0x2207('0x24')](function(_0x137ee8){if(_0x137ee8[_0x2207('0x62')]){var _0x26d34e={'method':'POST','uri':_0x276d95,'form':{'operation':_0x2207('0x63'),'username':_0x58190d,'accessKey':md5(_0x137ee8[_0x2207('0x64')][_0x2207('0x65')]+_0x7ea826)},'json':!![]};return rp(_0x26d34e);}})[_0x2207('0x24')](function(_0x38767a){if(_0x38767a[_0x2207('0x62')]){var _0x31bba0={'method':_0x2207('0x66'),'uri':_0x276d95,'qs':{'operation':_0x2207('0x67'),'username':_0x58190d,'sessionName':_0x38767a[_0x2207('0x64')][_0x2207('0x68')],'elementType':_0x353859},'json':!![]};return rp(_0x31bba0);}})['then'](function(_0x58a615){if(_0x58a615[_0x2207('0x62')]){var _0x2559e5=[_0x2207('0x69'),_0x2207('0x6a'),'owner'];_[_0x2207('0x6b')](_0x58a615[_0x2207('0x64')][_0x2207('0x36')],function(_0x2e2186){return _0x2559e5[_0x2207('0x6c')](_0x2e2186[_0x2207('0x2e')][_0x2207('0x28')]);});_[_0x2207('0x6b')](_0x58a615[_0x2207('0x64')][_0x2207('0x36')],function(_0x1a1c71){return _0x1a1c71[_0x2207('0x6d')]===_0x2207('0x6e');});return{'count':_0x58a615[_0x2207('0x64')]['fields'][_0x2207('0x37')],'rows':_[_0x2207('0x2a')](_0x58a615['result'][_0x2207('0x36')],function(_0xbcc0e9){return{'id':_0xbcc0e9[_0x2207('0x28')],'name':_0xbcc0e9[_0x2207('0x6f')],'custom':_[_0x2207('0x70')](_0xbcc0e9[_0x2207('0x28')],'cf_')?!![]:![],'options':_0xbcc0e9[_0x2207('0x2e')][_0x2207('0x28')]===_0x2207('0x71')&&_0xbcc0e9['type'][_0x2207('0x72')][_0x2207('0x37')]>0x0?_[_0x2207('0x2a')](_0xbcc0e9[_0x2207('0x2e')][_0x2207('0x72')],function(_0x1adad8){return{'name':_0x1adad8['label'],'value':_0x1adad8[_0x2207('0x73')]};}):[]};})};}})[_0x2207('0x24')](respondWithResult(_0x1dfa3f,null))[_0x2207('0x48')](function(_0x46afe6){console[_0x2207('0x74')](_0x2207('0x75')+_0x46afe6);var _0x167b00=_0x2f5c7d['query']['test']?0x1f4:_0x46afe6[_0x2207('0x76')]||0x1f4;logger[_0x2207('0x26')](_0x2207('0x77'),_0x2207('0x57'),_0x167b00,JSON['stringify'](_0x46afe6));delete _0x46afe6[_0x2207('0x28')];if(_0x167b00===0x191){_0x167b00=0x190;}_0x1dfa3f['status'](_0x167b00)[_0x2207('0x78')](_0x2f5c7d['query'][_0x2207('0x79')]?{'message':'Wrong\x20credentials','statusCode':_0x46afe6[_0x2207('0x76')]}:_0x46afe6);});}; \ No newline at end of file +var _0xf2c8=['hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','then','includeAll','findAll','rows','catch','show','length','include','find','create','body','params','getConfigurations','VtigerConfiguration','rawAttributes','merge','options','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','VtigerField','getFields','username','remoteUri','accessKey','moduleName','lastIndexOf','format','%s/webservice.php','getchallenge','success','POST','login','token','describe','result','sessionName','reference','remove','includes','false','startsWith','cf_','picklist','label','value','log','test','statusCode','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','count','set','apply','reject','save','destroy','error','stack','name','send','VtigerAccount','fieldName','type','key','model','map','query','keys','attributes','intersection','fields'];(function(_0xfbaa0,_0x15dc0d){var _0xda5936=function(_0x291658){while(--_0x291658){_0xfbaa0['push'](_0xfbaa0['shift']());}};_0xda5936(++_0x15dc0d);}(_0xf2c8,0xb3));var _0x8f2c=function(_0x5cc91a,_0x27a981){_0x5cc91a=_0x5cc91a-0x0;var _0x282cd6=_0xf2c8[_0x5cc91a];return _0x282cd6;};'use strict';var emlformat=require(_0x8f2c('0x0'));var rimraf=require(_0x8f2c('0x1'));var zipdir=require(_0x8f2c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8f2c('0x3'));var moment=require(_0x8f2c('0x4'));var BPromise=require(_0x8f2c('0x5'));var Mustache=require(_0x8f2c('0x6'));var util=require(_0x8f2c('0x7'));var path=require(_0x8f2c('0x8'));var sox=require(_0x8f2c('0x9'));var csv=require('to-csv');var ejs=require(_0x8f2c('0xa'));var fs=require('fs');var fs_extra=require(_0x8f2c('0xb'));var _=require('lodash');var squel=require(_0x8f2c('0xc'));var crypto=require(_0x8f2c('0xd'));var jsforce=require(_0x8f2c('0xe'));var deskjs=require(_0x8f2c('0xf'));var toCsv=require(_0x8f2c('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8f2c('0x11'));var qs=require(_0x8f2c('0x12'));var as=require(_0x8f2c('0x13'));var hardwareService=require(_0x8f2c('0x14'));var logger=require('../../config/logger')(_0x8f2c('0x15'));var utils=require(_0x8f2c('0x16'));var config=require(_0x8f2c('0x17'));var licenseUtil=require(_0x8f2c('0x18'));var db=require(_0x8f2c('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x2bbb2c,_0xf5177e){_0xf5177e=_0xf5177e||0xcc;return function(_0x3a114a){if(_0x3a114a){return _0x2bbb2c[_0x8f2c('0x1a')](_0xf5177e);}return _0x2bbb2c['status'](_0xf5177e)[_0x8f2c('0x1b')]();};}function respondWithResult(_0x6c2b59,_0x17177b){_0x17177b=_0x17177b||0xc8;return function(_0xabe9c7){if(_0xabe9c7){return _0x6c2b59[_0x8f2c('0x1c')](_0x17177b)[_0x8f2c('0x1d')](_0xabe9c7);}};}function respondWithFilteredResult(_0x8d3838,_0x4618a7){return function(_0x35c6fe){if(_0x35c6fe){var _0x417850=typeof _0x4618a7[_0x8f2c('0x1e')]==='undefined'&&typeof _0x4618a7[_0x8f2c('0x1f')]==='undefined';var _0x217c91=_0x35c6fe['count'];var _0x1cc220=_0x417850?0x0:_0x4618a7[_0x8f2c('0x1e')];var _0x4cde74=_0x417850?_0x35c6fe[_0x8f2c('0x20')]:_0x4618a7[_0x8f2c('0x1e')]+_0x4618a7['limit'];var _0x173e96;if(_0x4cde74>=_0x217c91){_0x4cde74=_0x217c91;_0x173e96=0xc8;}else{_0x173e96=0xce;}_0x8d3838[_0x8f2c('0x1c')](_0x173e96);return _0x8d3838[_0x8f2c('0x21')]('Content-Range',_0x1cc220+'-'+_0x4cde74+'/'+_0x217c91)[_0x8f2c('0x1d')](_0x35c6fe);}return null;};}function patchUpdates(_0x2f3511){return function(_0x599b36){try{jsonpatch[_0x8f2c('0x22')](_0x599b36,_0x2f3511,!![]);}catch(_0x13e5cf){return BPromise[_0x8f2c('0x23')](_0x13e5cf);}return _0x599b36[_0x8f2c('0x24')]();};}function saveUpdates(_0x2a025d,_0x296e23){return function(_0x484f8f){if(_0x484f8f){return _0x484f8f['update'](_0x2a025d)['then'](function(_0x2a7111){return _0x2a7111;});}return null;};}function removeEntity(_0x139ddc,_0xfbe8c8){return function(_0x201964){if(_0x201964){return _0x201964[_0x8f2c('0x25')]()['then'](function(){_0x139ddc[_0x8f2c('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c966a,_0x17638d){return function(_0x1388e9){if(!_0x1388e9){_0x5c966a[_0x8f2c('0x1a')](0x194);}return _0x1388e9;};}function handleError(_0x47ec5e,_0x1f98b9){_0x1f98b9=_0x1f98b9||0x1f4;return function(_0x4d7ce3){logger[_0x8f2c('0x26')](_0x4d7ce3[_0x8f2c('0x27')]);if(_0x4d7ce3[_0x8f2c('0x28')]){delete _0x4d7ce3[_0x8f2c('0x28')];}_0x47ec5e[_0x8f2c('0x1c')](_0x1f98b9)[_0x8f2c('0x29')](_0x4d7ce3);};}exports['index']=function(_0x572f5e,_0x16401f){var _0x880d5d={},_0x570778={},_0x1c1acc={'count':0x0,'rows':[]};var _0x56c686=_['map'](db[_0x8f2c('0x2a')]['rawAttributes'],function(_0xb7361e){return{'name':_0xb7361e[_0x8f2c('0x2b')],'type':_0xb7361e[_0x8f2c('0x2c')][_0x8f2c('0x2d')]};});_0x570778[_0x8f2c('0x2e')]=_[_0x8f2c('0x2f')](_0x56c686,_0x8f2c('0x28'));_0x570778[_0x8f2c('0x30')]=_[_0x8f2c('0x31')](_0x572f5e[_0x8f2c('0x30')]);_0x570778['filters']=_['intersection'](_0x570778[_0x8f2c('0x2e')],_0x570778[_0x8f2c('0x30')]);_0x880d5d[_0x8f2c('0x32')]=_[_0x8f2c('0x33')](_0x570778[_0x8f2c('0x2e')],qs['fields'](_0x572f5e['query'][_0x8f2c('0x34')]));_0x880d5d[_0x8f2c('0x32')]=_0x880d5d['attributes']['length']?_0x880d5d[_0x8f2c('0x32')]:_0x570778['model'];if(!_0x572f5e[_0x8f2c('0x30')][_0x8f2c('0x35')](_0x8f2c('0x36'))){_0x880d5d[_0x8f2c('0x1f')]=qs[_0x8f2c('0x1f')](_0x572f5e[_0x8f2c('0x30')]['limit']);_0x880d5d[_0x8f2c('0x1e')]=qs['offset'](_0x572f5e[_0x8f2c('0x30')][_0x8f2c('0x1e')]);}_0x880d5d[_0x8f2c('0x37')]=qs[_0x8f2c('0x38')](_0x572f5e[_0x8f2c('0x30')][_0x8f2c('0x38')]);_0x880d5d[_0x8f2c('0x39')]=qs[_0x8f2c('0x3a')](_[_0x8f2c('0x3b')](_0x572f5e['query'],_0x570778[_0x8f2c('0x3a')]),_0x56c686);if(_0x572f5e['query'][_0x8f2c('0x3c')]){_0x880d5d[_0x8f2c('0x39')]=_['merge'](_0x880d5d[_0x8f2c('0x39')],{'$or':_['map'](_0x56c686,function(_0x16bdf5){if(_0x16bdf5[_0x8f2c('0x2c')]!==_0x8f2c('0x3d')){var _0x9d8ba7={};_0x9d8ba7[_0x16bdf5['name']]={'$like':'%'+_0x572f5e[_0x8f2c('0x30')][_0x8f2c('0x3c')]+'%'};return _0x9d8ba7;}})});}_0x880d5d=_['merge']({},_0x880d5d,_0x572f5e['options']);var _0x31d18e={'where':_0x880d5d['where']};return db[_0x8f2c('0x2a')][_0x8f2c('0x20')](_0x31d18e)[_0x8f2c('0x3e')](function(_0x4c8ce3){_0x1c1acc[_0x8f2c('0x20')]=_0x4c8ce3;if(_0x572f5e[_0x8f2c('0x30')][_0x8f2c('0x3f')]){_0x880d5d['include']=[{'all':!![]}];}return db[_0x8f2c('0x2a')][_0x8f2c('0x40')](_0x880d5d);})[_0x8f2c('0x3e')](function(_0x1ba749){_0x1c1acc[_0x8f2c('0x41')]=_0x1ba749;return _0x1c1acc;})['then'](respondWithFilteredResult(_0x16401f,_0x880d5d))[_0x8f2c('0x42')](handleError(_0x16401f,null));};exports[_0x8f2c('0x43')]=function(_0x291687,_0x15b232){var _0x168373={'raw':![],'where':{'id':_0x291687['params']['id']}},_0x4bc560={};_0x4bc560['model']=_[_0x8f2c('0x31')](db[_0x8f2c('0x2a')]['rawAttributes']);_0x4bc560['query']=_[_0x8f2c('0x31')](_0x291687[_0x8f2c('0x30')]);_0x4bc560[_0x8f2c('0x3a')]=_[_0x8f2c('0x33')](_0x4bc560[_0x8f2c('0x2e')],_0x4bc560[_0x8f2c('0x30')]);_0x168373[_0x8f2c('0x32')]=_[_0x8f2c('0x33')](_0x4bc560[_0x8f2c('0x2e')],qs['fields'](_0x291687[_0x8f2c('0x30')][_0x8f2c('0x34')]));_0x168373['attributes']=_0x168373[_0x8f2c('0x32')][_0x8f2c('0x44')]?_0x168373[_0x8f2c('0x32')]:_0x4bc560[_0x8f2c('0x2e')];if(_0x291687[_0x8f2c('0x30')][_0x8f2c('0x3f')]){_0x168373[_0x8f2c('0x45')]=[{'all':!![]}];}_0x168373=_['merge']({},_0x168373,_0x291687['options']);return db[_0x8f2c('0x2a')][_0x8f2c('0x46')](_0x168373)[_0x8f2c('0x3e')](handleEntityNotFound(_0x15b232,null))['then'](respondWithResult(_0x15b232,null))[_0x8f2c('0x42')](handleError(_0x15b232,null));};exports[_0x8f2c('0x47')]=function(_0x1c37eb,_0x25d8f0){return db['VtigerAccount'][_0x8f2c('0x47')](_0x1c37eb[_0x8f2c('0x48')],{})['then'](respondWithResult(_0x25d8f0,0xc9))[_0x8f2c('0x42')](handleError(_0x25d8f0,null));};exports['update']=function(_0x194b36,_0xf7d0d2){if(_0x194b36[_0x8f2c('0x48')]['id']){delete _0x194b36['body']['id'];}return db['VtigerAccount'][_0x8f2c('0x46')]({'where':{'id':_0x194b36[_0x8f2c('0x49')]['id']}})[_0x8f2c('0x3e')](handleEntityNotFound(_0xf7d0d2,null))[_0x8f2c('0x3e')](saveUpdates(_0x194b36[_0x8f2c('0x48')],null))[_0x8f2c('0x3e')](respondWithResult(_0xf7d0d2,null))['catch'](handleError(_0xf7d0d2,null));};exports[_0x8f2c('0x25')]=function(_0x1d5bc9,_0x54a2e2){return db[_0x8f2c('0x2a')]['find']({'where':{'id':_0x1d5bc9[_0x8f2c('0x49')]['id']}})[_0x8f2c('0x3e')](handleEntityNotFound(_0x54a2e2,null))[_0x8f2c('0x3e')](removeEntity(_0x54a2e2,null))[_0x8f2c('0x42')](handleError(_0x54a2e2,null));};exports[_0x8f2c('0x4a')]=function(_0x11914b,_0x38d4c7,_0x30363a){var _0x442479={};var _0x47de79={};var _0x488471;var _0x2e7001;return db[_0x8f2c('0x2a')]['findOne']({'where':{'id':_0x11914b[_0x8f2c('0x49')]['id']}})['then'](handleEntityNotFound(_0x38d4c7,null))[_0x8f2c('0x3e')](function(_0x2b89f1){if(_0x2b89f1){_0x488471=_0x2b89f1;_0x47de79[_0x8f2c('0x2e')]=_['keys'](db[_0x8f2c('0x4b')][_0x8f2c('0x4c')]);_0x47de79['query']=_[_0x8f2c('0x31')](_0x11914b[_0x8f2c('0x30')]);_0x47de79['filters']=_[_0x8f2c('0x33')](_0x47de79[_0x8f2c('0x2e')],_0x47de79[_0x8f2c('0x30')]);_0x442479['attributes']=_[_0x8f2c('0x33')](_0x47de79[_0x8f2c('0x2e')],qs['fields'](_0x11914b[_0x8f2c('0x30')][_0x8f2c('0x34')]));_0x442479['attributes']=_0x442479[_0x8f2c('0x32')][_0x8f2c('0x44')]?_0x442479[_0x8f2c('0x32')]:_0x47de79[_0x8f2c('0x2e')];_0x442479[_0x8f2c('0x37')]=qs[_0x8f2c('0x38')](_0x11914b['query'][_0x8f2c('0x38')]);_0x442479[_0x8f2c('0x39')]=qs[_0x8f2c('0x3a')](_['pick'](_0x11914b['query'],_0x47de79[_0x8f2c('0x3a')]));if(_0x11914b[_0x8f2c('0x30')]['filter']){_0x442479[_0x8f2c('0x39')]=_[_0x8f2c('0x4d')](_0x442479[_0x8f2c('0x39')],{'$or':_[_0x8f2c('0x2f')](_0x442479['attributes'],function(_0x1fc91a){var _0x13115f={};_0x13115f[_0x1fc91a]={'$like':'%'+_0x11914b[_0x8f2c('0x30')][_0x8f2c('0x3c')]+'%'};return _0x13115f;})});}_0x442479=_[_0x8f2c('0x4d')]({},_0x442479,_0x11914b[_0x8f2c('0x4e')]);return _0x488471['getConfigurations'](_0x442479);}})[_0x8f2c('0x3e')](function(_0x5d345d){if(_0x5d345d){_0x2e7001=_0x5d345d['length'];if(!_0x11914b['query'][_0x8f2c('0x35')]('nolimit')){_0x442479['limit']=qs[_0x8f2c('0x1f')](_0x11914b[_0x8f2c('0x30')][_0x8f2c('0x1f')]);_0x442479['offset']=qs['offset'](_0x11914b[_0x8f2c('0x30')][_0x8f2c('0x1e')]);}return _0x488471[_0x8f2c('0x4a')](_0x442479);}})[_0x8f2c('0x3e')](function(_0x2584e3){if(_0x2584e3){return _0x2584e3?{'count':_0x2e7001,'rows':_0x2584e3}:null;}})['then'](respondWithResult(_0x38d4c7,null))[_0x8f2c('0x42')](handleError(_0x38d4c7,null));};exports[_0x8f2c('0x4f')]=function(_0x325f7d,_0x4de63d,_0x1ecc98){if(_0x325f7d[_0x8f2c('0x48')]['id']){delete _0x325f7d['body']['id'];}return db[_0x8f2c('0x2a')]['findOne']({'where':{'id':_0x325f7d[_0x8f2c('0x49')]['id']}})[_0x8f2c('0x3e')](handleEntityNotFound(_0x4de63d,null))[_0x8f2c('0x3e')](function(_0x4765ec){if(_0x4765ec){_0x325f7d[_0x8f2c('0x48')][_0x8f2c('0x50')]=_0x4765ec['id'];_0x325f7d[_0x8f2c('0x48')][_0x8f2c('0x51')]=integrations[_0x8f2c('0x52')](_0x325f7d['body']['channel'],_0x325f7d[_0x8f2c('0x48')]['type']);_0x325f7d['body'][_0x8f2c('0x53')]=integrations[_0x8f2c('0x54')](_0x325f7d[_0x8f2c('0x48')]['channel'],_0x325f7d[_0x8f2c('0x48')][_0x8f2c('0x2c')]);return db[_0x8f2c('0x4b')][_0x8f2c('0x47')](_0x325f7d[_0x8f2c('0x48')],{'include':[{'model':db[_0x8f2c('0x55')],'as':'Subjects'},{'model':db[_0x8f2c('0x55')],'as':_0x8f2c('0x53')}]});}return null;})['then'](respondWithResult(_0x4de63d,null))['catch'](handleError(_0x4de63d,null));};var md5=require('md5');exports[_0x8f2c('0x56')]=function(_0x572e55,_0xfa345b,_0x3dafc4){var _0x1bd0b9=null;var _0xb0f388=null;var _0x3366ff=null;var _0x4819c3=null;var _0x2c0d6d='';return db[_0x8f2c('0x2a')]['findOne']({'where':{'id':_0x572e55[_0x8f2c('0x49')]['id']},'attributes':['id',_0x8f2c('0x28'),_0x8f2c('0x57'),'description','moduleName',_0x8f2c('0x58'),'serverUrl',_0x8f2c('0x59')]})['then'](handleEntityNotFound(_0xfa345b,null))['then'](function(_0x46b779){if(_0x46b779){_0x1bd0b9=_0x46b779[_0x8f2c('0x57')];_0xb0f388=_0x46b779[_0x8f2c('0x59')];_0x3366ff=_0x46b779[_0x8f2c('0x5a')];_0x2c0d6d=_0x46b779[_0x8f2c('0x58')];var _0x591438=_0x2c0d6d['slice'](-0x1);if(_0x591438==='/'){_0x2c0d6d=_0x2c0d6d['substring'](0x0,_0x2c0d6d[_0x8f2c('0x5b')](_0x591438));}_0x4819c3=util[_0x8f2c('0x5c')](_0x8f2c('0x5d'),_0x2c0d6d);var _0x5635e3={'method':'GET','uri':_0x4819c3,'qs':{'operation':_0x8f2c('0x5e'),'username':_0x46b779[_0x8f2c('0x57')]},'json':!![]};return rp(_0x5635e3);}})[_0x8f2c('0x3e')](function(_0x430418){if(_0x430418[_0x8f2c('0x5f')]){var _0x295ddc={'method':_0x8f2c('0x60'),'uri':_0x4819c3,'form':{'operation':_0x8f2c('0x61'),'username':_0x1bd0b9,'accessKey':md5(_0x430418['result'][_0x8f2c('0x62')]+_0xb0f388)},'json':!![]};return rp(_0x295ddc);}})[_0x8f2c('0x3e')](function(_0xba11f1){if(_0xba11f1[_0x8f2c('0x5f')]){var _0x51a63c={'method':'GET','uri':_0x4819c3,'qs':{'operation':_0x8f2c('0x63'),'username':_0x1bd0b9,'sessionName':_0xba11f1[_0x8f2c('0x64')][_0x8f2c('0x65')],'elementType':_0x3366ff},'json':!![]};return rp(_0x51a63c);}})[_0x8f2c('0x3e')](function(_0x3463c0){if(_0x3463c0['success']){var _0x2c027d=['autogenerated',_0x8f2c('0x66'),'owner'];_[_0x8f2c('0x67')](_0x3463c0[_0x8f2c('0x64')][_0x8f2c('0x34')],function(_0x58c0ad){return _0x2c027d[_0x8f2c('0x68')](_0x58c0ad['type'][_0x8f2c('0x28')]);});_['remove'](_0x3463c0['result'][_0x8f2c('0x34')],function(_0x51ab3c){return _0x51ab3c['editable']===_0x8f2c('0x69');});return{'count':_0x3463c0[_0x8f2c('0x64')]['fields']['length'],'rows':_[_0x8f2c('0x2f')](_0x3463c0[_0x8f2c('0x64')]['fields'],function(_0x231056){return{'id':_0x231056[_0x8f2c('0x28')],'name':_0x231056['label'],'custom':_[_0x8f2c('0x6a')](_0x231056[_0x8f2c('0x28')],_0x8f2c('0x6b'))?!![]:![],'options':_0x231056[_0x8f2c('0x2c')]['name']===_0x8f2c('0x6c')&&_0x231056[_0x8f2c('0x2c')]['picklistValues']['length']>0x0?_['map'](_0x231056[_0x8f2c('0x2c')]['picklistValues'],function(_0x5d5ba7){return{'name':_0x5d5ba7[_0x8f2c('0x6d')],'value':_0x5d5ba7[_0x8f2c('0x6e')]};}):[]};})};}})[_0x8f2c('0x3e')](respondWithResult(_0xfa345b,null))[_0x8f2c('0x42')](function(_0x4b38dc){console[_0x8f2c('0x6f')]('vTiger\x20error:\x20'+_0x4b38dc);var _0x4da1e0=_0x572e55[_0x8f2c('0x30')][_0x8f2c('0x70')]?0x1f4:_0x4b38dc[_0x8f2c('0x71')]||0x1f4;logger[_0x8f2c('0x26')]('getFields,\x20%s,\x20%s,\x20%s',_0x8f2c('0x56'),_0x4da1e0,JSON[_0x8f2c('0x72')](_0x4b38dc));delete _0x4b38dc['name'];if(_0x4da1e0===0x191){_0x4da1e0=0x190;}_0xfa345b[_0x8f2c('0x1c')](_0x4da1e0)[_0x8f2c('0x29')](_0x572e55['query'][_0x8f2c('0x70')]?{'message':_0x8f2c('0x73'),'statusCode':_0x4b38dc[_0x8f2c('0x71')]}:_0x4b38dc);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 600449e..5329352 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 _0xc0fb=['define','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','api','moment','bluebird','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x279a4c,_0x46c4a5){var _0x460ea7=function(_0x238956){while(--_0x238956){_0x279a4c['push'](_0x279a4c['shift']());}};_0x460ea7(++_0x46c4a5);}(_0xc0fb,0xe0));var _0xbc0f=function(_0x288ed3,_0x42b1d2){_0x288ed3=_0x288ed3-0x0;var _0x80475=_0xc0fb[_0x288ed3];return _0x80475;};'use strict';var _=require(_0xbc0f('0x0'));var util=require(_0xbc0f('0x1'));var logger=require(_0xbc0f('0x2'))(_0xbc0f('0x3'));var moment=require(_0xbc0f('0x4'));var BPromise=require(_0xbc0f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xbc0f('0x6'));var attributes=require(_0xbc0f('0x7'));var integrations=require(_0xbc0f('0x8'));module[_0xbc0f('0x9')]=function(_0x53fa1e,_0x5a3800){return _0x53fa1e[_0xbc0f('0xa')](_0xbc0f('0xb'),attributes,{'tableName':_0xbc0f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf85c=['lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','define'];(function(_0x29e3b6,_0x40b0b4){var _0x55d4b0=function(_0x55c58e){while(--_0x55c58e){_0x29e3b6['push'](_0x29e3b6['shift']());}};_0x55d4b0(++_0x40b0b4);}(_0xf85c,0x11e));var _0xcf85=function(_0x474bc0,_0x26989c){_0x474bc0=_0x474bc0-0x0;var _0x4b24cf=_0xf85c[_0x474bc0];return _0x4b24cf;};'use strict';var _=require(_0xcf85('0x0'));var util=require(_0xcf85('0x1'));var logger=require(_0xcf85('0x2'))(_0xcf85('0x3'));var moment=require(_0xcf85('0x4'));var BPromise=require(_0xcf85('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcf85('0x6'));var rimraf=require('rimraf');var config=require(_0xcf85('0x7'));var attributes=require(_0xcf85('0x8'));var integrations=require(_0xcf85('0x9'));module['exports']=function(_0x33024e,_0x326a9b){return _0x33024e[_0xcf85('0xa')]('VtigerAccount',attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index 053cc3e..0f1aa44 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 _0x593e=['findAll','options','raw','where','attributes','limit','include','model','map','stringify','ShowVtigerAccount','VtigerAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','VtigerAccount,\x20%s,\x20%s','message','result','catch','GetVtigerAccount'];(function(_0x408fa7,_0x303486){var _0x1bceea=function(_0x4641ca){while(--_0x4641ca){_0x408fa7['push'](_0x408fa7['shift']());}};_0x1bceea(++_0x303486);}(_0x593e,0xcb));var _0xe593=function(_0x328198,_0x3da0aa){_0x328198=_0x328198-0x0;var _0x59ab32=_0x593e[_0x328198];return _0x59ab32;};'use strict';var _=require(_0xe593('0x0'));var util=require(_0xe593('0x1'));var moment=require(_0xe593('0x2'));var BPromise=require(_0xe593('0x3'));var rs=require(_0xe593('0x4'));var fs=require('fs');var Redis=require(_0xe593('0x5'));var db=require(_0xe593('0x6'))['db'];var utils=require(_0xe593('0x7'));var logger=require('../../config/logger')(_0xe593('0x8'));var config=require(_0xe593('0x9'));var jayson=require(_0xe593('0xa'));var client=jayson[_0xe593('0xb')][_0xe593('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x14cff3,_0x1cda29,_0x307dad){return new BPromise(function(_0x169c08,_0x265099){return client['request'](_0x14cff3,_0x307dad)[_0xe593('0xd')](function(_0x4091db){logger[_0xe593('0xe')]('VtigerAccount,\x20%s,\x20%s',_0x1cda29,'request\x20sent');logger[_0xe593('0xf')](_0xe593('0x10'),_0x1cda29,_0xe593('0x11'),JSON['stringify'](_0x4091db));if(_0x4091db[_0xe593('0x12')]){if(_0x4091db[_0xe593('0x12')][_0xe593('0x13')]===0x1f4){logger[_0xe593('0x12')](_0xe593('0x14'),_0x1cda29,_0x4091db[_0xe593('0x12')][_0xe593('0x15')]);return _0x265099(_0x4091db[_0xe593('0x12')][_0xe593('0x15')]);}logger[_0xe593('0x12')]('VtigerAccount,\x20%s,\x20%s',_0x1cda29,_0x4091db[_0xe593('0x12')][_0xe593('0x15')]);return _0x169c08(_0x4091db['error'][_0xe593('0x15')]);}else{logger[_0xe593('0xe')]('VtigerAccount,\x20%s,\x20%s',_0x1cda29,_0xe593('0x11'));_0x169c08(_0x4091db[_0xe593('0x16')][_0xe593('0x15')]);}})[_0xe593('0x17')](function(_0x3408ec){logger[_0xe593('0x12')]('VtigerAccount,\x20%s,\x20%s',_0x1cda29,_0x3408ec);_0x265099(_0x3408ec);});});}exports[_0xe593('0x18')]=function(_0x470d07){var _0x5f57ce=this;return new Promise(function(_0xd1020e,_0x28b5ed){return db['VtigerAccount'][_0xe593('0x19')]({'raw':_0x470d07[_0xe593('0x1a')]?_0x470d07[_0xe593('0x1a')][_0xe593('0x1b')]===undefined?!![]:![]:!![],'where':_0x470d07[_0xe593('0x1a')]?_0x470d07[_0xe593('0x1a')][_0xe593('0x1c')]||null:null,'attributes':_0x470d07['options']?_0x470d07['options'][_0xe593('0x1d')]||null:null,'limit':_0x470d07['options']?_0x470d07['options'][_0xe593('0x1e')]||null:null,'include':_0x470d07[_0xe593('0x1a')]?_0x470d07['options'][_0xe593('0x1f')]?_['map'](_0x470d07[_0xe593('0x1a')][_0xe593('0x1f')],function(_0x185cea){return{'model':db[_0x185cea[_0xe593('0x20')]],'as':_0x185cea['as'],'attributes':_0x185cea[_0xe593('0x1d')],'include':_0x185cea[_0xe593('0x1f')]?_[_0xe593('0x21')](_0x185cea[_0xe593('0x1f')],function(_0x4fc483){return{'model':db[_0x4fc483[_0xe593('0x20')]],'as':_0x4fc483['as'],'attributes':_0x4fc483[_0xe593('0x1d')],'include':_0x4fc483['include']?_['map'](_0x4fc483[_0xe593('0x1f')],function(_0x25238f){return{'model':db[_0x25238f[_0xe593('0x20')]],'as':_0x25238f['as'],'attributes':_0x25238f[_0xe593('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xe593('0xd')](function(_0x27a3d2){logger['info'](_0xe593('0x18'),_0x470d07);logger['debug'](_0xe593('0x18'),_0x470d07,JSON[_0xe593('0x22')](_0x27a3d2));_0xd1020e(_0x27a3d2);})['catch'](function(_0x337ee0){logger['error'](_0xe593('0x18'),_0x337ee0[_0xe593('0x15')],_0x470d07);_0x28b5ed(_0x5f57ce[_0xe593('0x12')](0x1f4,_0x337ee0['message']));});});};exports[_0xe593('0x23')]=function(_0x13f44){var _0x3066ed=this;return new Promise(function(_0x338222,_0x2588be){return db[_0xe593('0x24')][_0xe593('0x25')]({'raw':_0x13f44['options']?_0x13f44[_0xe593('0x1a')][_0xe593('0x1b')]===undefined?!![]:![]:!![],'where':_0x13f44['options']?_0x13f44[_0xe593('0x1a')]['where']||null:null,'attributes':_0x13f44[_0xe593('0x1a')]?_0x13f44[_0xe593('0x1a')][_0xe593('0x1d')]||null:null,'include':_0x13f44[_0xe593('0x1a')]?_0x13f44[_0xe593('0x1a')][_0xe593('0x1f')]?_[_0xe593('0x21')](_0x13f44[_0xe593('0x1a')][_0xe593('0x1f')],function(_0x4305de){return{'model':db[_0x4305de['model']],'as':_0x4305de['as'],'attributes':_0x4305de[_0xe593('0x1d')],'include':_0x4305de[_0xe593('0x1f')]?_[_0xe593('0x21')](_0x4305de['include'],function(_0x4fefb3){return{'model':db[_0x4fefb3[_0xe593('0x20')]],'as':_0x4fefb3['as'],'attributes':_0x4fefb3['attributes'],'include':_0x4fefb3[_0xe593('0x1f')]?_[_0xe593('0x21')](_0x4fefb3[_0xe593('0x1f')],function(_0x30511c){return{'model':db[_0x30511c[_0xe593('0x20')]],'as':_0x30511c['as'],'attributes':_0x30511c[_0xe593('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xe593('0xd')](function(_0x4889cc){logger['info'](_0xe593('0x23'),_0x13f44);logger['debug'](_0xe593('0x23'),_0x13f44,JSON['stringify'](_0x4889cc));_0x338222(_0x4889cc);})[_0xe593('0x17')](function(_0x5b9589){logger['error'](_0xe593('0x23'),_0x5b9589[_0xe593('0x15')],_0x13f44);_0x2588be(_0x3066ed[_0xe593('0x12')](0x1f4,_0x5b9589['message']));});});}; \ No newline at end of file +var _0x4ded=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','request\x20sent','debug','error','code','VtigerAccount,\x20%s,\x20%s','message','info','result','GetVtigerAccount','VtigerAccount','findAll','options','where','attributes','limit','include','map','model','stringify','find','ShowVtigerAccount','lodash','util'];(function(_0x16df0d,_0x2f9985){var _0x4b061e=function(_0x56d13d){while(--_0x56d13d){_0x16df0d['push'](_0x16df0d['shift']());}};_0x4b061e(++_0x2f9985);}(_0x4ded,0x116));var _0xd4de=function(_0x489a47,_0x4ecb00){_0x489a47=_0x489a47-0x0;var _0x190ca6=_0x4ded[_0x489a47];return _0x190ca6;};'use strict';var _=require(_0xd4de('0x0'));var util=require(_0xd4de('0x1'));var moment=require(_0xd4de('0x2'));var BPromise=require(_0xd4de('0x3'));var rs=require(_0xd4de('0x4'));var fs=require('fs');var Redis=require(_0xd4de('0x5'));var db=require(_0xd4de('0x6'))['db'];var utils=require(_0xd4de('0x7'));var logger=require(_0xd4de('0x8'))(_0xd4de('0x9'));var config=require(_0xd4de('0xa'));var jayson=require(_0xd4de('0xb'));var client=jayson['client'][_0xd4de('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2433b8,_0x15eb91,_0x2c56d5){return new BPromise(function(_0x4453c2,_0x1e8c35){return client['request'](_0x2433b8,_0x2c56d5)[_0xd4de('0xd')](function(_0x5ebcf3){logger['info']('VtigerAccount,\x20%s,\x20%s',_0x15eb91,_0xd4de('0xe'));logger[_0xd4de('0xf')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x15eb91,'request\x20sent',JSON['stringify'](_0x5ebcf3));if(_0x5ebcf3[_0xd4de('0x10')]){if(_0x5ebcf3['error'][_0xd4de('0x11')]===0x1f4){logger[_0xd4de('0x10')](_0xd4de('0x12'),_0x15eb91,_0x5ebcf3[_0xd4de('0x10')][_0xd4de('0x13')]);return _0x1e8c35(_0x5ebcf3[_0xd4de('0x10')][_0xd4de('0x13')]);}logger[_0xd4de('0x10')](_0xd4de('0x12'),_0x15eb91,_0x5ebcf3[_0xd4de('0x10')][_0xd4de('0x13')]);return _0x4453c2(_0x5ebcf3[_0xd4de('0x10')][_0xd4de('0x13')]);}else{logger[_0xd4de('0x14')](_0xd4de('0x12'),_0x15eb91,_0xd4de('0xe'));_0x4453c2(_0x5ebcf3[_0xd4de('0x15')]['message']);}})['catch'](function(_0x3df820){logger[_0xd4de('0x10')](_0xd4de('0x12'),_0x15eb91,_0x3df820);_0x1e8c35(_0x3df820);});});}exports[_0xd4de('0x16')]=function(_0x5b1d1c){var _0x4d0df6=this;return new Promise(function(_0x1e91d5,_0x54b757){return db[_0xd4de('0x17')][_0xd4de('0x18')]({'raw':_0x5b1d1c['options']?_0x5b1d1c[_0xd4de('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x5b1d1c[_0xd4de('0x19')]?_0x5b1d1c[_0xd4de('0x19')][_0xd4de('0x1a')]||null:null,'attributes':_0x5b1d1c[_0xd4de('0x19')]?_0x5b1d1c['options'][_0xd4de('0x1b')]||null:null,'limit':_0x5b1d1c[_0xd4de('0x19')]?_0x5b1d1c[_0xd4de('0x19')][_0xd4de('0x1c')]||null:null,'include':_0x5b1d1c[_0xd4de('0x19')]?_0x5b1d1c[_0xd4de('0x19')][_0xd4de('0x1d')]?_[_0xd4de('0x1e')](_0x5b1d1c[_0xd4de('0x19')][_0xd4de('0x1d')],function(_0x534b37){return{'model':db[_0x534b37[_0xd4de('0x1f')]],'as':_0x534b37['as'],'attributes':_0x534b37[_0xd4de('0x1b')],'include':_0x534b37[_0xd4de('0x1d')]?_[_0xd4de('0x1e')](_0x534b37[_0xd4de('0x1d')],function(_0x984904){return{'model':db[_0x984904[_0xd4de('0x1f')]],'as':_0x984904['as'],'attributes':_0x984904[_0xd4de('0x1b')],'include':_0x984904[_0xd4de('0x1d')]?_[_0xd4de('0x1e')](_0x984904[_0xd4de('0x1d')],function(_0xb2d8a1){return{'model':db[_0xb2d8a1['model']],'as':_0xb2d8a1['as'],'attributes':_0xb2d8a1[_0xd4de('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xd4de('0xd')](function(_0x5005b0){logger[_0xd4de('0x14')]('GetVtigerAccount',_0x5b1d1c);logger[_0xd4de('0xf')](_0xd4de('0x16'),_0x5b1d1c,JSON[_0xd4de('0x20')](_0x5005b0));_0x1e91d5(_0x5005b0);})['catch'](function(_0xd4de93){logger[_0xd4de('0x10')](_0xd4de('0x16'),_0xd4de93['message'],_0x5b1d1c);_0x54b757(_0x4d0df6[_0xd4de('0x10')](0x1f4,_0xd4de93[_0xd4de('0x13')]));});});};exports['ShowVtigerAccount']=function(_0x5103b5){var _0x5706fe=this;return new Promise(function(_0x3f6491,_0x496795){return db[_0xd4de('0x17')][_0xd4de('0x21')]({'raw':_0x5103b5[_0xd4de('0x19')]?_0x5103b5[_0xd4de('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x5103b5[_0xd4de('0x19')]?_0x5103b5[_0xd4de('0x19')]['where']||null:null,'attributes':_0x5103b5[_0xd4de('0x19')]?_0x5103b5[_0xd4de('0x19')]['attributes']||null:null,'include':_0x5103b5['options']?_0x5103b5[_0xd4de('0x19')][_0xd4de('0x1d')]?_[_0xd4de('0x1e')](_0x5103b5[_0xd4de('0x19')]['include'],function(_0x2bdc98){return{'model':db[_0x2bdc98[_0xd4de('0x1f')]],'as':_0x2bdc98['as'],'attributes':_0x2bdc98['attributes'],'include':_0x2bdc98[_0xd4de('0x1d')]?_[_0xd4de('0x1e')](_0x2bdc98[_0xd4de('0x1d')],function(_0x34528a){return{'model':db[_0x34528a[_0xd4de('0x1f')]],'as':_0x34528a['as'],'attributes':_0x34528a[_0xd4de('0x1b')],'include':_0x34528a['include']?_['map'](_0x34528a[_0xd4de('0x1d')],function(_0x2d2fda){return{'model':db[_0x2d2fda[_0xd4de('0x1f')]],'as':_0x2d2fda['as'],'attributes':_0x2d2fda['attributes']};}):[]};}):[]};}):[]:[]})[_0xd4de('0xd')](function(_0x44b96c){logger['info'](_0xd4de('0x22'),_0x5103b5);logger[_0xd4de('0xf')](_0xd4de('0x22'),_0x5103b5,JSON[_0xd4de('0x20')](_0x44b96c));_0x3f6491(_0x44b96c);})['catch'](function(_0x53d7dc){logger[_0xd4de('0x10')]('ShowVtigerAccount',_0x53d7dc[_0xd4de('0x13')],_0x5103b5);_0x496795(_0x5706fe['error'](0x1f4,_0x53d7dc[_0xd4de('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index ecc44d9..38097f4 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 _0x01c9=['get','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','/:id','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','isAuthenticated','index','show'];(function(_0xb9622e,_0x91225d){var _0x12969e=function(_0x5e8b52){while(--_0x5e8b52){_0xb9622e['push'](_0xb9622e['shift']());}};_0x12969e(++_0x91225d);}(_0x01c9,0xb3));var _0x901c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x01c9[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x901c('0x0'));var util=require(_0x901c('0x1'));var path=require(_0x901c('0x2'));var timeout=require(_0x901c('0x3'));var express=require(_0x901c('0x4'));var router=express[_0x901c('0x5')]();var fs_extra=require(_0x901c('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x901c('0x7'));var config=require(_0x901c('0x8'));var controller=require(_0x901c('0x9'));router['get']('/',auth[_0x901c('0xa')](),controller[_0x901c('0xb')]);router['get']('/:id',auth[_0x901c('0xa')](),controller[_0x901c('0xc')]);router[_0x901c('0xd')](_0x901c('0xe'),auth[_0x901c('0xa')](),controller['getFields']);router[_0x901c('0xd')](_0x901c('0xf'),auth[_0x901c('0xa')](),controller[_0x901c('0x10')]);router[_0x901c('0xd')](_0x901c('0x11'),auth[_0x901c('0xa')](),controller['getDescriptions']);router[_0x901c('0x12')]('/',auth[_0x901c('0xa')](),controller[_0x901c('0x13')]);router[_0x901c('0x14')](_0x901c('0x15'),auth[_0x901c('0xa')](),controller[_0x901c('0x16')]);router['delete']('/:id',auth[_0x901c('0xa')](),controller[_0x901c('0x17')]);module['exports']=router; \ No newline at end of file +var _0x888d=['isAuthenticated','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','update','/:id','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','index','get'];(function(_0x22de93,_0x175f6e){var _0xcd801=function(_0x23ea7e){while(--_0x23ea7e){_0x22de93['push'](_0x22de93['shift']());}};_0xcd801(++_0x175f6e);}(_0x888d,0x199));var _0xd888=function(_0x19bce8,_0x188b99){_0x19bce8=_0x19bce8-0x0;var _0x36b3c3=_0x888d[_0x19bce8];return _0x36b3c3;};'use strict';var multer=require('multer');var util=require(_0xd888('0x0'));var path=require(_0xd888('0x1'));var timeout=require('connect-timeout');var express=require(_0xd888('0x2'));var router=express[_0xd888('0x3')]();var fs_extra=require(_0xd888('0x4'));var auth=require(_0xd888('0x5'));var interaction=require(_0xd888('0x6'));var config=require(_0xd888('0x7'));var controller=require(_0xd888('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xd888('0x9')]);router[_0xd888('0xa')]('/:id',auth[_0xd888('0xb')](),controller[_0xd888('0xc')]);router['get'](_0xd888('0xd'),auth[_0xd888('0xb')](),controller['getFields']);router[_0xd888('0xa')](_0xd888('0xe'),auth[_0xd888('0xb')](),controller[_0xd888('0xf')]);router[_0xd888('0xa')](_0xd888('0x10'),auth[_0xd888('0xb')](),controller[_0xd888('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd888('0x12')]);router['put']('/:id',auth[_0xd888('0xb')](),controller[_0xd888('0x13')]);router['delete'](_0xd888('0x14'),auth[_0xd888('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 9cbfe9b..f758e13 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 _0x7215=['STRING','sequelize'];(function(_0x2a1296,_0x4e325a){var _0x1caeb9=function(_0xc12d0f){while(--_0xc12d0f){_0x2a1296['push'](_0x2a1296['shift']());}};_0x1caeb9(++_0x4e325a);}(_0x7215,0x161));var _0x5721=function(_0x31e26c,_0x2afe26){_0x31e26c=_0x31e26c-0x0;var _0xec208f=_0x7215[_0x31e26c];return _0xec208f;};'use strict';var Sequelize=require(_0x5721('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5721('0x1')]}}; \ No newline at end of file +var _0x5a51=['STRING','sequelize','exports'];(function(_0x18bd81,_0x567c25){var _0x298435=function(_0x5461ac){while(--_0x5461ac){_0x18bd81['push'](_0x18bd81['shift']());}};_0x298435(++_0x567c25);}(_0x5a51,0x127));var _0x15a5=function(_0x401724,_0xff576){_0x401724=_0x401724-0x0;var _0x586460=_0x5a51[_0x401724];return _0x586460;};'use strict';var Sequelize=require(_0x15a5('0x0'));module[_0x15a5('0x1')]={'name':{'type':Sequelize[_0x15a5('0x2')]},'description':{'type':Sequelize[_0x15a5('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index f20e766..e6ee577 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 _0x0ea9=['end','json','offset','undefined','limit','count','status','set','apply','reject','save','update','then','destroy','stack','name','send','VtigerConfiguration','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','sort','where','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','find','getFields','findOne','VtigerField','order','pick','hasOwnProperty','nolimit','getSubjects','filter','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','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/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x15703e,_0x5d9908){var _0x30b197=function(_0x3082ac){while(--_0x3082ac){_0x15703e['push'](_0x15703e['shift']());}};_0x30b197(++_0x5d9908);}(_0x0ea9,0xd6));var _0x90ea=function(_0x4c47c0,_0x2e6258){_0x4c47c0=_0x4c47c0-0x0;var _0x461a22=_0x0ea9[_0x4c47c0];return _0x461a22;};'use strict';var emlformat=require(_0x90ea('0x0'));var rimraf=require(_0x90ea('0x1'));var zipdir=require(_0x90ea('0x2'));var jsonpatch=require(_0x90ea('0x3'));var rp=require(_0x90ea('0x4'));var moment=require(_0x90ea('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x90ea('0x6'));var csv=require(_0x90ea('0x7'));var ejs=require(_0x90ea('0x8'));var fs=require('fs');var fs_extra=require(_0x90ea('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x90ea('0xa'));var jsforce=require(_0x90ea('0xb'));var deskjs=require(_0x90ea('0xc'));var toCsv=require('to-csv');var querystring=require(_0x90ea('0xd'));var Papa=require(_0x90ea('0xe'));var Redis=require(_0x90ea('0xf'));var authService=require(_0x90ea('0x10'));var qs=require(_0x90ea('0x11'));var as=require(_0x90ea('0x12'));var hardwareService=require(_0x90ea('0x13'));var logger=require(_0x90ea('0x14'))(_0x90ea('0x15'));var utils=require('../../config/utils');var config=require(_0x90ea('0x16'));var licenseUtil=require(_0x90ea('0x17'));var db=require(_0x90ea('0x18'))['db'];function respondWithStatusCode(_0x5bc7a0,_0xc9d91e){_0xc9d91e=_0xc9d91e||0xcc;return function(_0x461370){if(_0x461370){return _0x5bc7a0[_0x90ea('0x19')](_0xc9d91e);}return _0x5bc7a0['status'](_0xc9d91e)[_0x90ea('0x1a')]();};}function respondWithResult(_0x421021,_0x5143cf){_0x5143cf=_0x5143cf||0xc8;return function(_0x337cf5){if(_0x337cf5){return _0x421021['status'](_0x5143cf)[_0x90ea('0x1b')](_0x337cf5);}};}function respondWithFilteredResult(_0x184a57,_0x3c1f6f){return function(_0x243096){if(_0x243096){var _0x5763a2=typeof _0x3c1f6f[_0x90ea('0x1c')]===_0x90ea('0x1d')&&typeof _0x3c1f6f[_0x90ea('0x1e')]===_0x90ea('0x1d');var _0x3a96e2=_0x243096['count'];var _0x58ad51=_0x5763a2?0x0:_0x3c1f6f['offset'];var _0x3d5d69=_0x5763a2?_0x243096[_0x90ea('0x1f')]:_0x3c1f6f['offset']+_0x3c1f6f[_0x90ea('0x1e')];var _0x2a8470;if(_0x3d5d69>=_0x3a96e2){_0x3d5d69=_0x3a96e2;_0x2a8470=0xc8;}else{_0x2a8470=0xce;}_0x184a57[_0x90ea('0x20')](_0x2a8470);return _0x184a57[_0x90ea('0x21')]('Content-Range',_0x58ad51+'-'+_0x3d5d69+'/'+_0x3a96e2)['json'](_0x243096);}return null;};}function patchUpdates(_0x520a35){return function(_0x26518b){try{jsonpatch[_0x90ea('0x22')](_0x26518b,_0x520a35,!![]);}catch(_0x23d1d4){return BPromise[_0x90ea('0x23')](_0x23d1d4);}return _0x26518b[_0x90ea('0x24')]();};}function saveUpdates(_0xf944f1,_0x26f029){return function(_0x2d8aca){if(_0x2d8aca){return _0x2d8aca[_0x90ea('0x25')](_0xf944f1)[_0x90ea('0x26')](function(_0x4e1dad){return _0x4e1dad;});}return null;};}function removeEntity(_0x27f78f,_0x41cef4){return function(_0x27635c){if(_0x27635c){return _0x27635c[_0x90ea('0x27')]()['then'](function(){_0x27f78f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5dca63,_0x132236){return function(_0x3e9de2){if(!_0x3e9de2){_0x5dca63[_0x90ea('0x19')](0x194);}return _0x3e9de2;};}function handleError(_0x58e1ec,_0x5adff0){_0x5adff0=_0x5adff0||0x1f4;return function(_0x46350a){logger['error'](_0x46350a[_0x90ea('0x28')]);if(_0x46350a[_0x90ea('0x29')]){delete _0x46350a[_0x90ea('0x29')];}_0x58e1ec[_0x90ea('0x20')](_0x5adff0)[_0x90ea('0x2a')](_0x46350a);};}exports['index']=function(_0x41b07b,_0xa26b4b){var _0x348a62={},_0x4f7683={},_0x3ae07d={'count':0x0,'rows':[]};var _0x881e9=_['map'](db[_0x90ea('0x2b')]['rawAttributes'],function(_0x257a50){return{'name':_0x257a50['fieldName'],'type':_0x257a50[_0x90ea('0x2c')][_0x90ea('0x2d')]};});_0x4f7683[_0x90ea('0x2e')]=_[_0x90ea('0x2f')](_0x881e9,_0x90ea('0x29'));_0x4f7683[_0x90ea('0x30')]=_[_0x90ea('0x31')](_0x41b07b[_0x90ea('0x30')]);_0x4f7683[_0x90ea('0x32')]=_[_0x90ea('0x33')](_0x4f7683[_0x90ea('0x2e')],_0x4f7683['query']);_0x348a62['attributes']=_[_0x90ea('0x33')](_0x4f7683['model'],qs['fields'](_0x41b07b[_0x90ea('0x30')][_0x90ea('0x34')]));_0x348a62[_0x90ea('0x35')]=_0x348a62[_0x90ea('0x35')][_0x90ea('0x36')]?_0x348a62[_0x90ea('0x35')]:_0x4f7683[_0x90ea('0x2e')];if(!_0x41b07b[_0x90ea('0x30')]['hasOwnProperty']('nolimit')){_0x348a62[_0x90ea('0x1e')]=qs[_0x90ea('0x1e')](_0x41b07b[_0x90ea('0x30')]['limit']);_0x348a62[_0x90ea('0x1c')]=qs[_0x90ea('0x1c')](_0x41b07b[_0x90ea('0x30')][_0x90ea('0x1c')]);}_0x348a62['order']=qs[_0x90ea('0x37')](_0x41b07b[_0x90ea('0x30')][_0x90ea('0x37')]);_0x348a62[_0x90ea('0x38')]=qs['filters'](_['pick'](_0x41b07b[_0x90ea('0x30')],_0x4f7683['filters']),_0x881e9);if(_0x41b07b['query']['filter']){_0x348a62['where']=_[_0x90ea('0x39')](_0x348a62[_0x90ea('0x38')],{'$or':_[_0x90ea('0x2f')](_0x881e9,function(_0x3d1624){if(_0x3d1624['type']!=='VIRTUAL'){var _0x48f53c={};_0x48f53c[_0x3d1624['name']]={'$like':'%'+_0x41b07b[_0x90ea('0x30')]['filter']+'%'};return _0x48f53c;}})});}_0x348a62=_[_0x90ea('0x39')]({},_0x348a62,_0x41b07b[_0x90ea('0x3a')]);var _0x2161a2={'where':_0x348a62[_0x90ea('0x38')]};return db[_0x90ea('0x2b')]['count'](_0x2161a2)[_0x90ea('0x26')](function(_0x44bffb){_0x3ae07d[_0x90ea('0x1f')]=_0x44bffb;if(_0x41b07b['query'][_0x90ea('0x3b')]){_0x348a62[_0x90ea('0x3c')]=[{'all':!![]}];}return db[_0x90ea('0x2b')][_0x90ea('0x3d')](_0x348a62);})[_0x90ea('0x26')](function(_0x54af4d){_0x3ae07d[_0x90ea('0x3e')]=_0x54af4d;return _0x3ae07d;})[_0x90ea('0x26')](respondWithFilteredResult(_0xa26b4b,_0x348a62))[_0x90ea('0x3f')](handleError(_0xa26b4b,null));};exports[_0x90ea('0x40')]=function(_0x44789f,_0x24b45d){var _0x4ce43f={'raw':![],'where':{'id':_0x44789f[_0x90ea('0x41')]['id']}},_0xeb6f03={};_0xeb6f03[_0x90ea('0x2e')]=_[_0x90ea('0x31')](db['VtigerConfiguration'][_0x90ea('0x42')]);_0xeb6f03['query']=_[_0x90ea('0x31')](_0x44789f[_0x90ea('0x30')]);_0xeb6f03['filters']=_[_0x90ea('0x33')](_0xeb6f03[_0x90ea('0x2e')],_0xeb6f03['query']);_0x4ce43f['attributes']=_[_0x90ea('0x33')](_0xeb6f03[_0x90ea('0x2e')],qs[_0x90ea('0x34')](_0x44789f[_0x90ea('0x30')][_0x90ea('0x34')]));_0x4ce43f['attributes']=_0x4ce43f[_0x90ea('0x35')][_0x90ea('0x36')]?_0x4ce43f[_0x90ea('0x35')]:_0xeb6f03[_0x90ea('0x2e')];if(_0x44789f[_0x90ea('0x30')][_0x90ea('0x3b')]){_0x4ce43f[_0x90ea('0x3c')]=[{'all':!![]}];}_0x4ce43f=_['merge']({},_0x4ce43f,_0x44789f[_0x90ea('0x3a')]);return db[_0x90ea('0x2b')]['find'](_0x4ce43f)[_0x90ea('0x26')](handleEntityNotFound(_0x24b45d,null))[_0x90ea('0x26')](respondWithResult(_0x24b45d,null))['catch'](handleError(_0x24b45d,null));};exports[_0x90ea('0x43')]=function(_0x4a6c57,_0xc60751){return db[_0x90ea('0x2b')][_0x90ea('0x43')](_0x4a6c57[_0x90ea('0x44')],{})['then'](respondWithResult(_0xc60751,0xc9))['catch'](handleError(_0xc60751,null));};exports[_0x90ea('0x25')]=function(_0x270e0a,_0x840602){if(_0x270e0a[_0x90ea('0x44')]['id']){delete _0x270e0a[_0x90ea('0x44')]['id'];}return db[_0x90ea('0x2b')][_0x90ea('0x45')]({'where':{'id':_0x270e0a['params']['id']}})[_0x90ea('0x26')](handleEntityNotFound(_0x840602,null))[_0x90ea('0x26')](saveUpdates(_0x270e0a[_0x90ea('0x44')],null))['then'](respondWithResult(_0x840602,null))['catch'](handleError(_0x840602,null));};exports[_0x90ea('0x27')]=function(_0x3e01d3,_0x22b97b){return db[_0x90ea('0x2b')]['find']({'where':{'id':_0x3e01d3[_0x90ea('0x41')]['id']}})[_0x90ea('0x26')](handleEntityNotFound(_0x22b97b,null))[_0x90ea('0x26')](removeEntity(_0x22b97b,null))[_0x90ea('0x3f')](handleError(_0x22b97b,null));};exports[_0x90ea('0x46')]=function(_0x3fa26e,_0x1a13b2,_0xc28330){var _0x48eb39={};var _0x5915b2={};var _0x5335c0;var _0x1a5193;return db[_0x90ea('0x2b')][_0x90ea('0x47')]({'where':{'id':_0x3fa26e['params']['id']}})[_0x90ea('0x26')](handleEntityNotFound(_0x1a13b2,null))['then'](function(_0x15f79d){if(_0x15f79d){_0x5335c0=_0x15f79d;_0x5915b2['model']=_[_0x90ea('0x31')](db[_0x90ea('0x48')][_0x90ea('0x42')]);_0x5915b2[_0x90ea('0x30')]=_[_0x90ea('0x31')](_0x3fa26e['query']);_0x5915b2[_0x90ea('0x32')]=_['intersection'](_0x5915b2[_0x90ea('0x2e')],_0x5915b2[_0x90ea('0x30')]);_0x48eb39[_0x90ea('0x35')]=_[_0x90ea('0x33')](_0x5915b2['model'],qs[_0x90ea('0x34')](_0x3fa26e['query'][_0x90ea('0x34')]));_0x48eb39[_0x90ea('0x35')]=_0x48eb39['attributes']['length']?_0x48eb39[_0x90ea('0x35')]:_0x5915b2[_0x90ea('0x2e')];_0x48eb39[_0x90ea('0x49')]=qs[_0x90ea('0x37')](_0x3fa26e['query'][_0x90ea('0x37')]);_0x48eb39[_0x90ea('0x38')]=qs['filters'](_[_0x90ea('0x4a')](_0x3fa26e[_0x90ea('0x30')],_0x5915b2[_0x90ea('0x32')]));if(_0x3fa26e[_0x90ea('0x30')]['filter']){_0x48eb39[_0x90ea('0x38')]=_[_0x90ea('0x39')](_0x48eb39[_0x90ea('0x38')],{'$or':_[_0x90ea('0x2f')](_0x48eb39[_0x90ea('0x35')],function(_0xda69ba){var _0x5d5a7a={};_0x5d5a7a[_0xda69ba]={'$like':'%'+_0x3fa26e[_0x90ea('0x30')]['filter']+'%'};return _0x5d5a7a;})});}_0x48eb39=_[_0x90ea('0x39')]({},_0x48eb39,_0x3fa26e['options']);return _0x5335c0[_0x90ea('0x46')](_0x48eb39);}})['then'](function(_0x3d2350){if(_0x3d2350){_0x1a5193=_0x3d2350['length'];if(!_0x3fa26e[_0x90ea('0x30')][_0x90ea('0x4b')](_0x90ea('0x4c'))){_0x48eb39[_0x90ea('0x1e')]=qs[_0x90ea('0x1e')](_0x3fa26e[_0x90ea('0x30')]['limit']);_0x48eb39[_0x90ea('0x1c')]=qs['offset'](_0x3fa26e[_0x90ea('0x30')][_0x90ea('0x1c')]);}return _0x5335c0[_0x90ea('0x46')](_0x48eb39);}})[_0x90ea('0x26')](function(_0x2deb6e){if(_0x2deb6e){return _0x2deb6e?{'count':_0x1a5193,'rows':_0x2deb6e}:null;}})[_0x90ea('0x26')](respondWithResult(_0x1a13b2,null))[_0x90ea('0x3f')](handleError(_0x1a13b2,null));};exports[_0x90ea('0x4d')]=function(_0x3461f4,_0x56f9dd,_0x1ca4f5){var _0x550f88={};var _0x4865f4={};var _0x516ecb;var _0x26b91e;return db[_0x90ea('0x2b')]['findOne']({'where':{'id':_0x3461f4[_0x90ea('0x41')]['id']}})[_0x90ea('0x26')](handleEntityNotFound(_0x56f9dd,null))[_0x90ea('0x26')](function(_0x40ba7f){if(_0x40ba7f){_0x516ecb=_0x40ba7f;_0x4865f4[_0x90ea('0x2e')]=_['keys'](db[_0x90ea('0x48')]['rawAttributes']);_0x4865f4[_0x90ea('0x30')]=_[_0x90ea('0x31')](_0x3461f4[_0x90ea('0x30')]);_0x4865f4['filters']=_['intersection'](_0x4865f4[_0x90ea('0x2e')],_0x4865f4[_0x90ea('0x30')]);_0x550f88[_0x90ea('0x35')]=_['intersection'](_0x4865f4[_0x90ea('0x2e')],qs[_0x90ea('0x34')](_0x3461f4[_0x90ea('0x30')]['fields']));_0x550f88[_0x90ea('0x35')]=_0x550f88[_0x90ea('0x35')][_0x90ea('0x36')]?_0x550f88[_0x90ea('0x35')]:_0x4865f4[_0x90ea('0x2e')];_0x550f88['order']=qs['sort'](_0x3461f4[_0x90ea('0x30')][_0x90ea('0x37')]);_0x550f88[_0x90ea('0x38')]=qs[_0x90ea('0x32')](_[_0x90ea('0x4a')](_0x3461f4['query'],_0x4865f4[_0x90ea('0x32')]));if(_0x3461f4[_0x90ea('0x30')][_0x90ea('0x4e')]){_0x550f88[_0x90ea('0x38')]=_['merge'](_0x550f88[_0x90ea('0x38')],{'$or':_[_0x90ea('0x2f')](_0x550f88[_0x90ea('0x35')],function(_0x309f9e){var _0x1a291a={};_0x1a291a[_0x309f9e]={'$like':'%'+_0x3461f4[_0x90ea('0x30')][_0x90ea('0x4e')]+'%'};return _0x1a291a;})});}_0x550f88=_[_0x90ea('0x39')]({},_0x550f88,_0x3461f4[_0x90ea('0x3a')]);return _0x516ecb[_0x90ea('0x4d')](_0x550f88);}})[_0x90ea('0x26')](function(_0x1e45ec){if(_0x1e45ec){_0x26b91e=_0x1e45ec['length'];if(!_0x3461f4[_0x90ea('0x30')][_0x90ea('0x4b')](_0x90ea('0x4c'))){_0x550f88['limit']=qs[_0x90ea('0x1e')](_0x3461f4[_0x90ea('0x30')][_0x90ea('0x1e')]);_0x550f88[_0x90ea('0x1c')]=qs[_0x90ea('0x1c')](_0x3461f4[_0x90ea('0x30')][_0x90ea('0x1c')]);}return _0x516ecb[_0x90ea('0x4d')](_0x550f88);}})[_0x90ea('0x26')](function(_0x5e04bc){if(_0x5e04bc){return _0x5e04bc?{'count':_0x26b91e,'rows':_0x5e04bc}:null;}})[_0x90ea('0x26')](respondWithResult(_0x56f9dd,null))[_0x90ea('0x3f')](handleError(_0x56f9dd,null));};exports['getDescriptions']=function(_0x3dac22,_0xcd20db,_0x1244a7){var _0x57b4d0={};var _0x3eacbe={};var _0x37a9d6;var _0x512faf;return db[_0x90ea('0x2b')][_0x90ea('0x47')]({'where':{'id':_0x3dac22['params']['id']}})['then'](handleEntityNotFound(_0xcd20db,null))['then'](function(_0x1da19d){if(_0x1da19d){_0x37a9d6=_0x1da19d;_0x3eacbe[_0x90ea('0x2e')]=_['keys'](db[_0x90ea('0x48')][_0x90ea('0x42')]);_0x3eacbe[_0x90ea('0x30')]=_[_0x90ea('0x31')](_0x3dac22[_0x90ea('0x30')]);_0x3eacbe[_0x90ea('0x32')]=_[_0x90ea('0x33')](_0x3eacbe[_0x90ea('0x2e')],_0x3eacbe['query']);_0x57b4d0[_0x90ea('0x35')]=_[_0x90ea('0x33')](_0x3eacbe[_0x90ea('0x2e')],qs[_0x90ea('0x34')](_0x3dac22[_0x90ea('0x30')][_0x90ea('0x34')]));_0x57b4d0[_0x90ea('0x35')]=_0x57b4d0[_0x90ea('0x35')][_0x90ea('0x36')]?_0x57b4d0[_0x90ea('0x35')]:_0x3eacbe[_0x90ea('0x2e')];_0x57b4d0[_0x90ea('0x49')]=qs[_0x90ea('0x37')](_0x3dac22[_0x90ea('0x30')][_0x90ea('0x37')]);_0x57b4d0[_0x90ea('0x38')]=qs[_0x90ea('0x32')](_[_0x90ea('0x4a')](_0x3dac22[_0x90ea('0x30')],_0x3eacbe[_0x90ea('0x32')]));if(_0x3dac22[_0x90ea('0x30')][_0x90ea('0x4e')]){_0x57b4d0[_0x90ea('0x38')]=_['merge'](_0x57b4d0[_0x90ea('0x38')],{'$or':_[_0x90ea('0x2f')](_0x57b4d0[_0x90ea('0x35')],function(_0x5f0de1){var _0x231fb1={};_0x231fb1[_0x5f0de1]={'$like':'%'+_0x3dac22['query']['filter']+'%'};return _0x231fb1;})});}_0x57b4d0=_[_0x90ea('0x39')]({},_0x57b4d0,_0x3dac22[_0x90ea('0x3a')]);return _0x37a9d6[_0x90ea('0x4f')](_0x57b4d0);}})[_0x90ea('0x26')](function(_0x2f6718){if(_0x2f6718){_0x512faf=_0x2f6718['length'];if(!_0x3dac22['query'][_0x90ea('0x4b')](_0x90ea('0x4c'))){_0x57b4d0[_0x90ea('0x1e')]=qs['limit'](_0x3dac22[_0x90ea('0x30')][_0x90ea('0x1e')]);_0x57b4d0[_0x90ea('0x1c')]=qs['offset'](_0x3dac22[_0x90ea('0x30')]['offset']);}return _0x37a9d6[_0x90ea('0x4f')](_0x57b4d0);}})[_0x90ea('0x26')](function(_0x5f5c10){if(_0x5f5c10){return _0x5f5c10?{'count':_0x512faf,'rows':_0x5f5c10}:null;}})[_0x90ea('0x26')](respondWithResult(_0xcd20db,null))[_0x90ea('0x3f')](handleError(_0xcd20db,null));}; \ No newline at end of file +var _0x595c=['api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','VtigerConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','length','include','find','catch','create','body','getFields','findOne','pick','VtigerField','getSubjects','getDescriptions','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x2b152a,_0x3dd988){var _0x2ad4c7=function(_0x2fa97c){while(--_0x2fa97c){_0x2b152a['push'](_0x2b152a['shift']());}};_0x2ad4c7(++_0x3dd988);}(_0x595c,0x1e3));var _0xc595=function(_0x25d513,_0x5417fc){_0x25d513=_0x25d513-0x0;var _0x11cea4=_0x595c[_0x25d513];return _0x11cea4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc595('0x0'));var rp=require(_0xc595('0x1'));var moment=require(_0xc595('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xc595('0x3'));var util=require('util');var path=require(_0xc595('0x4'));var sox=require(_0xc595('0x5'));var csv=require(_0xc595('0x6'));var ejs=require(_0xc595('0x7'));var fs=require('fs');var fs_extra=require(_0xc595('0x8'));var _=require(_0xc595('0x9'));var squel=require(_0xc595('0xa'));var crypto=require(_0xc595('0xb'));var jsforce=require(_0xc595('0xc'));var deskjs=require(_0xc595('0xd'));var toCsv=require(_0xc595('0x6'));var querystring=require(_0xc595('0xe'));var Papa=require(_0xc595('0xf'));var Redis=require(_0xc595('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xc595('0x11'));var as=require(_0xc595('0x12'));var hardwareService=require(_0xc595('0x13'));var logger=require(_0xc595('0x14'))(_0xc595('0x15'));var utils=require(_0xc595('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xc595('0x17'));var db=require(_0xc595('0x18'))['db'];function respondWithStatusCode(_0x21c005,_0x35ed6a){_0x35ed6a=_0x35ed6a||0xcc;return function(_0x558c54){if(_0x558c54){return _0x21c005['sendStatus'](_0x35ed6a);}return _0x21c005['status'](_0x35ed6a)[_0xc595('0x19')]();};}function respondWithResult(_0x8a0fc5,_0x418127){_0x418127=_0x418127||0xc8;return function(_0x120c95){if(_0x120c95){return _0x8a0fc5[_0xc595('0x1a')](_0x418127)[_0xc595('0x1b')](_0x120c95);}};}function respondWithFilteredResult(_0x58fd7c,_0x450fb2){return function(_0x21eac5){if(_0x21eac5){var _0x5dab59=typeof _0x450fb2[_0xc595('0x1c')]===_0xc595('0x1d')&&typeof _0x450fb2[_0xc595('0x1e')]===_0xc595('0x1d');var _0x51755f=_0x21eac5[_0xc595('0x1f')];var _0x3182cd=_0x5dab59?0x0:_0x450fb2[_0xc595('0x1c')];var _0x461593=_0x5dab59?_0x21eac5[_0xc595('0x1f')]:_0x450fb2['offset']+_0x450fb2[_0xc595('0x1e')];var _0x573deb;if(_0x461593>=_0x51755f){_0x461593=_0x51755f;_0x573deb=0xc8;}else{_0x573deb=0xce;}_0x58fd7c[_0xc595('0x1a')](_0x573deb);return _0x58fd7c[_0xc595('0x20')](_0xc595('0x21'),_0x3182cd+'-'+_0x461593+'/'+_0x51755f)[_0xc595('0x1b')](_0x21eac5);}return null;};}function patchUpdates(_0x56f85b){return function(_0x216699){try{jsonpatch['apply'](_0x216699,_0x56f85b,!![]);}catch(_0xc1c4f9){return BPromise[_0xc595('0x22')](_0xc1c4f9);}return _0x216699[_0xc595('0x23')]();};}function saveUpdates(_0x432fbc,_0x590dd2){return function(_0x179a3f){if(_0x179a3f){return _0x179a3f[_0xc595('0x24')](_0x432fbc)['then'](function(_0x2eed87){return _0x2eed87;});}return null;};}function removeEntity(_0x10aa39,_0x22caed){return function(_0x4565b2){if(_0x4565b2){return _0x4565b2[_0xc595('0x25')]()[_0xc595('0x26')](function(){_0x10aa39[_0xc595('0x1a')](0xcc)[_0xc595('0x19')]();});}};}function handleEntityNotFound(_0x447f62,_0x1e1908){return function(_0x431ca4){if(!_0x431ca4){_0x447f62[_0xc595('0x27')](0x194);}return _0x431ca4;};}function handleError(_0x3871b9,_0x47b11a){_0x47b11a=_0x47b11a||0x1f4;return function(_0xeaa8cc){logger[_0xc595('0x28')](_0xeaa8cc[_0xc595('0x29')]);if(_0xeaa8cc[_0xc595('0x2a')]){delete _0xeaa8cc[_0xc595('0x2a')];}_0x3871b9[_0xc595('0x1a')](_0x47b11a)[_0xc595('0x2b')](_0xeaa8cc);};}exports[_0xc595('0x2c')]=function(_0x540f99,_0x32c682){var _0x562a74={},_0x16607c={},_0x2aa126={'count':0x0,'rows':[]};var _0x27d381=_[_0xc595('0x2d')](db[_0xc595('0x2e')][_0xc595('0x2f')],function(_0xb7d1c){return{'name':_0xb7d1c[_0xc595('0x30')],'type':_0xb7d1c[_0xc595('0x31')][_0xc595('0x32')]};});_0x16607c[_0xc595('0x33')]=_[_0xc595('0x2d')](_0x27d381,'name');_0x16607c[_0xc595('0x34')]=_[_0xc595('0x35')](_0x540f99[_0xc595('0x34')]);_0x16607c[_0xc595('0x36')]=_[_0xc595('0x37')](_0x16607c[_0xc595('0x33')],_0x16607c[_0xc595('0x34')]);_0x562a74[_0xc595('0x38')]=_[_0xc595('0x37')](_0x16607c[_0xc595('0x33')],qs[_0xc595('0x39')](_0x540f99['query']['fields']));_0x562a74[_0xc595('0x38')]=_0x562a74['attributes']['length']?_0x562a74[_0xc595('0x38')]:_0x16607c[_0xc595('0x33')];if(!_0x540f99[_0xc595('0x34')][_0xc595('0x3a')](_0xc595('0x3b'))){_0x562a74[_0xc595('0x1e')]=qs[_0xc595('0x1e')](_0x540f99['query'][_0xc595('0x1e')]);_0x562a74[_0xc595('0x1c')]=qs[_0xc595('0x1c')](_0x540f99[_0xc595('0x34')][_0xc595('0x1c')]);}_0x562a74[_0xc595('0x3c')]=qs['sort'](_0x540f99['query'][_0xc595('0x3d')]);_0x562a74[_0xc595('0x3e')]=qs['filters'](_['pick'](_0x540f99[_0xc595('0x34')],_0x16607c['filters']),_0x27d381);if(_0x540f99[_0xc595('0x34')][_0xc595('0x3f')]){_0x562a74[_0xc595('0x3e')]=_[_0xc595('0x40')](_0x562a74[_0xc595('0x3e')],{'$or':_[_0xc595('0x2d')](_0x27d381,function(_0x3ff244){if(_0x3ff244[_0xc595('0x31')]!==_0xc595('0x41')){var _0x340f1c={};_0x340f1c[_0x3ff244[_0xc595('0x2a')]]={'$like':'%'+_0x540f99[_0xc595('0x34')]['filter']+'%'};return _0x340f1c;}})});}_0x562a74=_['merge']({},_0x562a74,_0x540f99[_0xc595('0x42')]);var _0x5d64bd={'where':_0x562a74[_0xc595('0x3e')]};return db['VtigerConfiguration']['count'](_0x5d64bd)[_0xc595('0x26')](function(_0x3db10f){_0x2aa126[_0xc595('0x1f')]=_0x3db10f;if(_0x540f99[_0xc595('0x34')][_0xc595('0x43')]){_0x562a74['include']=[{'all':!![]}];}return db[_0xc595('0x2e')][_0xc595('0x44')](_0x562a74);})['then'](function(_0x2b5c23){_0x2aa126[_0xc595('0x45')]=_0x2b5c23;return _0x2aa126;})[_0xc595('0x26')](respondWithFilteredResult(_0x32c682,_0x562a74))['catch'](handleError(_0x32c682,null));};exports[_0xc595('0x46')]=function(_0x2f26e4,_0xcff817){var _0x3e1b99={'raw':![],'where':{'id':_0x2f26e4[_0xc595('0x47')]['id']}},_0x5e2a62={};_0x5e2a62['model']=_[_0xc595('0x35')](db['VtigerConfiguration']['rawAttributes']);_0x5e2a62[_0xc595('0x34')]=_[_0xc595('0x35')](_0x2f26e4[_0xc595('0x34')]);_0x5e2a62[_0xc595('0x36')]=_['intersection'](_0x5e2a62[_0xc595('0x33')],_0x5e2a62['query']);_0x3e1b99[_0xc595('0x38')]=_[_0xc595('0x37')](_0x5e2a62[_0xc595('0x33')],qs[_0xc595('0x39')](_0x2f26e4[_0xc595('0x34')][_0xc595('0x39')]));_0x3e1b99[_0xc595('0x38')]=_0x3e1b99[_0xc595('0x38')][_0xc595('0x48')]?_0x3e1b99[_0xc595('0x38')]:_0x5e2a62['model'];if(_0x2f26e4['query'][_0xc595('0x43')]){_0x3e1b99[_0xc595('0x49')]=[{'all':!![]}];}_0x3e1b99=_['merge']({},_0x3e1b99,_0x2f26e4['options']);return db[_0xc595('0x2e')][_0xc595('0x4a')](_0x3e1b99)[_0xc595('0x26')](handleEntityNotFound(_0xcff817,null))[_0xc595('0x26')](respondWithResult(_0xcff817,null))[_0xc595('0x4b')](handleError(_0xcff817,null));};exports[_0xc595('0x4c')]=function(_0x48191f,_0x49ba19){return db[_0xc595('0x2e')][_0xc595('0x4c')](_0x48191f[_0xc595('0x4d')],{})[_0xc595('0x26')](respondWithResult(_0x49ba19,0xc9))[_0xc595('0x4b')](handleError(_0x49ba19,null));};exports[_0xc595('0x24')]=function(_0x4f7fae,_0xb092c9){if(_0x4f7fae[_0xc595('0x4d')]['id']){delete _0x4f7fae[_0xc595('0x4d')]['id'];}return db[_0xc595('0x2e')][_0xc595('0x4a')]({'where':{'id':_0x4f7fae[_0xc595('0x47')]['id']}})[_0xc595('0x26')](handleEntityNotFound(_0xb092c9,null))[_0xc595('0x26')](saveUpdates(_0x4f7fae[_0xc595('0x4d')],null))[_0xc595('0x26')](respondWithResult(_0xb092c9,null))[_0xc595('0x4b')](handleError(_0xb092c9,null));};exports[_0xc595('0x25')]=function(_0x32e548,_0x3940c1){return db[_0xc595('0x2e')][_0xc595('0x4a')]({'where':{'id':_0x32e548[_0xc595('0x47')]['id']}})[_0xc595('0x26')](handleEntityNotFound(_0x3940c1,null))['then'](removeEntity(_0x3940c1,null))[_0xc595('0x4b')](handleError(_0x3940c1,null));};exports[_0xc595('0x4e')]=function(_0x1ef3eb,_0x40770d,_0x111dd9){var _0x16ecf9={};var _0x407cad={};var _0x1f9761;var _0x20033f;return db['VtigerConfiguration'][_0xc595('0x4f')]({'where':{'id':_0x1ef3eb['params']['id']}})[_0xc595('0x26')](handleEntityNotFound(_0x40770d,null))[_0xc595('0x26')](function(_0x42a450){if(_0x42a450){_0x1f9761=_0x42a450;_0x407cad['model']=_[_0xc595('0x35')](db['VtigerField'][_0xc595('0x2f')]);_0x407cad['query']=_['keys'](_0x1ef3eb[_0xc595('0x34')]);_0x407cad[_0xc595('0x36')]=_[_0xc595('0x37')](_0x407cad[_0xc595('0x33')],_0x407cad[_0xc595('0x34')]);_0x16ecf9[_0xc595('0x38')]=_[_0xc595('0x37')](_0x407cad['model'],qs[_0xc595('0x39')](_0x1ef3eb[_0xc595('0x34')][_0xc595('0x39')]));_0x16ecf9[_0xc595('0x38')]=_0x16ecf9['attributes']['length']?_0x16ecf9[_0xc595('0x38')]:_0x407cad[_0xc595('0x33')];_0x16ecf9[_0xc595('0x3c')]=qs[_0xc595('0x3d')](_0x1ef3eb[_0xc595('0x34')][_0xc595('0x3d')]);_0x16ecf9[_0xc595('0x3e')]=qs['filters'](_[_0xc595('0x50')](_0x1ef3eb['query'],_0x407cad[_0xc595('0x36')]));if(_0x1ef3eb['query'][_0xc595('0x3f')]){_0x16ecf9[_0xc595('0x3e')]=_[_0xc595('0x40')](_0x16ecf9[_0xc595('0x3e')],{'$or':_[_0xc595('0x2d')](_0x16ecf9['attributes'],function(_0x53f201){var _0x58ee2c={};_0x58ee2c[_0x53f201]={'$like':'%'+_0x1ef3eb[_0xc595('0x34')]['filter']+'%'};return _0x58ee2c;})});}_0x16ecf9=_[_0xc595('0x40')]({},_0x16ecf9,_0x1ef3eb['options']);return _0x1f9761[_0xc595('0x4e')](_0x16ecf9);}})[_0xc595('0x26')](function(_0x349c86){if(_0x349c86){_0x20033f=_0x349c86[_0xc595('0x48')];if(!_0x1ef3eb['query'][_0xc595('0x3a')](_0xc595('0x3b'))){_0x16ecf9[_0xc595('0x1e')]=qs[_0xc595('0x1e')](_0x1ef3eb['query']['limit']);_0x16ecf9[_0xc595('0x1c')]=qs[_0xc595('0x1c')](_0x1ef3eb[_0xc595('0x34')][_0xc595('0x1c')]);}return _0x1f9761[_0xc595('0x4e')](_0x16ecf9);}})['then'](function(_0x49d755){if(_0x49d755){return _0x49d755?{'count':_0x20033f,'rows':_0x49d755}:null;}})[_0xc595('0x26')](respondWithResult(_0x40770d,null))['catch'](handleError(_0x40770d,null));};exports['getSubjects']=function(_0x47b517,_0x2e818e,_0x430463){var _0x3cb779={};var _0xe0e0ff={};var _0xd2d402;var _0x5e1cf5;return db[_0xc595('0x2e')][_0xc595('0x4f')]({'where':{'id':_0x47b517[_0xc595('0x47')]['id']}})['then'](handleEntityNotFound(_0x2e818e,null))['then'](function(_0x2001ae){if(_0x2001ae){_0xd2d402=_0x2001ae;_0xe0e0ff[_0xc595('0x33')]=_['keys'](db[_0xc595('0x51')][_0xc595('0x2f')]);_0xe0e0ff[_0xc595('0x34')]=_[_0xc595('0x35')](_0x47b517[_0xc595('0x34')]);_0xe0e0ff[_0xc595('0x36')]=_[_0xc595('0x37')](_0xe0e0ff[_0xc595('0x33')],_0xe0e0ff[_0xc595('0x34')]);_0x3cb779['attributes']=_[_0xc595('0x37')](_0xe0e0ff[_0xc595('0x33')],qs['fields'](_0x47b517[_0xc595('0x34')][_0xc595('0x39')]));_0x3cb779[_0xc595('0x38')]=_0x3cb779[_0xc595('0x38')][_0xc595('0x48')]?_0x3cb779[_0xc595('0x38')]:_0xe0e0ff['model'];_0x3cb779[_0xc595('0x3c')]=qs[_0xc595('0x3d')](_0x47b517[_0xc595('0x34')]['sort']);_0x3cb779['where']=qs[_0xc595('0x36')](_[_0xc595('0x50')](_0x47b517[_0xc595('0x34')],_0xe0e0ff[_0xc595('0x36')]));if(_0x47b517[_0xc595('0x34')]['filter']){_0x3cb779[_0xc595('0x3e')]=_[_0xc595('0x40')](_0x3cb779['where'],{'$or':_[_0xc595('0x2d')](_0x3cb779[_0xc595('0x38')],function(_0x176ccf){var _0x11c48d={};_0x11c48d[_0x176ccf]={'$like':'%'+_0x47b517[_0xc595('0x34')][_0xc595('0x3f')]+'%'};return _0x11c48d;})});}_0x3cb779=_['merge']({},_0x3cb779,_0x47b517[_0xc595('0x42')]);return _0xd2d402[_0xc595('0x52')](_0x3cb779);}})[_0xc595('0x26')](function(_0x51b9fb){if(_0x51b9fb){_0x5e1cf5=_0x51b9fb[_0xc595('0x48')];if(!_0x47b517['query'][_0xc595('0x3a')](_0xc595('0x3b'))){_0x3cb779['limit']=qs[_0xc595('0x1e')](_0x47b517[_0xc595('0x34')][_0xc595('0x1e')]);_0x3cb779['offset']=qs[_0xc595('0x1c')](_0x47b517[_0xc595('0x34')][_0xc595('0x1c')]);}return _0xd2d402[_0xc595('0x52')](_0x3cb779);}})[_0xc595('0x26')](function(_0x481b9e){if(_0x481b9e){return _0x481b9e?{'count':_0x5e1cf5,'rows':_0x481b9e}:null;}})[_0xc595('0x26')](respondWithResult(_0x2e818e,null))[_0xc595('0x4b')](handleError(_0x2e818e,null));};exports['getDescriptions']=function(_0x42239b,_0x5d926b,_0x48dec9){var _0x1e84f7={};var _0x1653e0={};var _0x3e997c;var _0x163bb4;return db[_0xc595('0x2e')]['findOne']({'where':{'id':_0x42239b[_0xc595('0x47')]['id']}})[_0xc595('0x26')](handleEntityNotFound(_0x5d926b,null))[_0xc595('0x26')](function(_0x549969){if(_0x549969){_0x3e997c=_0x549969;_0x1653e0[_0xc595('0x33')]=_[_0xc595('0x35')](db['VtigerField'][_0xc595('0x2f')]);_0x1653e0[_0xc595('0x34')]=_[_0xc595('0x35')](_0x42239b[_0xc595('0x34')]);_0x1653e0[_0xc595('0x36')]=_['intersection'](_0x1653e0['model'],_0x1653e0[_0xc595('0x34')]);_0x1e84f7[_0xc595('0x38')]=_['intersection'](_0x1653e0[_0xc595('0x33')],qs[_0xc595('0x39')](_0x42239b[_0xc595('0x34')][_0xc595('0x39')]));_0x1e84f7[_0xc595('0x38')]=_0x1e84f7[_0xc595('0x38')][_0xc595('0x48')]?_0x1e84f7['attributes']:_0x1653e0['model'];_0x1e84f7[_0xc595('0x3c')]=qs[_0xc595('0x3d')](_0x42239b[_0xc595('0x34')][_0xc595('0x3d')]);_0x1e84f7[_0xc595('0x3e')]=qs[_0xc595('0x36')](_[_0xc595('0x50')](_0x42239b[_0xc595('0x34')],_0x1653e0[_0xc595('0x36')]));if(_0x42239b[_0xc595('0x34')]['filter']){_0x1e84f7[_0xc595('0x3e')]=_[_0xc595('0x40')](_0x1e84f7[_0xc595('0x3e')],{'$or':_[_0xc595('0x2d')](_0x1e84f7[_0xc595('0x38')],function(_0x356669){var _0x13d51c={};_0x13d51c[_0x356669]={'$like':'%'+_0x42239b[_0xc595('0x34')][_0xc595('0x3f')]+'%'};return _0x13d51c;})});}_0x1e84f7=_[_0xc595('0x40')]({},_0x1e84f7,_0x42239b[_0xc595('0x42')]);return _0x3e997c[_0xc595('0x53')](_0x1e84f7);}})[_0xc595('0x26')](function(_0x3f028b){if(_0x3f028b){_0x163bb4=_0x3f028b['length'];if(!_0x42239b[_0xc595('0x34')][_0xc595('0x3a')]('nolimit')){_0x1e84f7[_0xc595('0x1e')]=qs['limit'](_0x42239b[_0xc595('0x34')][_0xc595('0x1e')]);_0x1e84f7['offset']=qs[_0xc595('0x1c')](_0x42239b['query'][_0xc595('0x1c')]);}return _0x3e997c['getDescriptions'](_0x1e84f7);}})[_0xc595('0x26')](function(_0x125b71){if(_0x125b71){return _0x125b71?{'count':_0x163bb4,'rows':_0x125b71}:null;}})[_0xc595('0x26')](respondWithResult(_0x5d926b,null))[_0xc595('0x4b')](handleError(_0x5d926b,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 89a84d9..ae02bb4 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 _0x73c0=['request-promise','path','rimraf','./intVtigerConfiguration.attributes','define','VtigerConfiguration','int_vtiger_configurations','api','moment'];(function(_0x4a6cf8,_0x5534ef){var _0x22205e=function(_0x3f4d0d){while(--_0x3f4d0d){_0x4a6cf8['push'](_0x4a6cf8['shift']());}};_0x22205e(++_0x5534ef);}(_0x73c0,0xd6));var _0x073c=function(_0x3d258e,_0x32cc99){_0x3d258e=_0x3d258e-0x0;var _0x14b982=_0x73c0[_0x3d258e];return _0x14b982;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x073c('0x0'));var moment=require(_0x073c('0x1'));var BPromise=require('bluebird');var rp=require(_0x073c('0x2'));var fs=require('fs');var path=require(_0x073c('0x3'));var rimraf=require(_0x073c('0x4'));var config=require('../../config/environment');var attributes=require(_0x073c('0x5'));module['exports']=function(_0x48bf5e,_0x220695){return _0x48bf5e[_0x073c('0x6')](_0x073c('0x7'),attributes,{'tableName':_0x073c('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x26ec=['define','VtigerConfiguration','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','exports'];(function(_0x40287b,_0xc33817){var _0x6ae1b3=function(_0x1c563c){while(--_0x1c563c){_0x40287b['push'](_0x40287b['shift']());}};_0x6ae1b3(++_0xc33817);}(_0x26ec,0xe9));var _0xc26e=function(_0x38b0f1,_0xa1d93d){_0x38b0f1=_0x38b0f1-0x0;var _0x327bbc=_0x26ec[_0x38b0f1];return _0x327bbc;};'use strict';var _=require(_0xc26e('0x0'));var util=require(_0xc26e('0x1'));var logger=require(_0xc26e('0x2'))('api');var moment=require(_0xc26e('0x3'));var BPromise=require(_0xc26e('0x4'));var rp=require(_0xc26e('0x5'));var fs=require('fs');var path=require(_0xc26e('0x6'));var rimraf=require('rimraf');var config=require(_0xc26e('0x7'));var attributes=require('./intVtigerConfiguration.attributes');module[_0xc26e('0x8')]=function(_0x1de060,_0x2bb7c5){return _0x1de060[_0xc26e('0x9')](_0xc26e('0xa'),attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index 20e7d6b..81994a6 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 _0x625c=['request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s'];(function(_0x1ab180,_0x382b2c){var _0xfb2c2d=function(_0x1c5fd3){while(--_0x1c5fd3){_0x1ab180['push'](_0x1ab180['shift']());}};_0xfb2c2d(++_0x382b2c);}(_0x625c,0x1a9));var _0xc625=function(_0x13d8d1,_0x50ed8a){_0x13d8d1=_0x13d8d1-0x0;var _0x234e6a=_0x625c[_0x13d8d1];return _0x234e6a;};'use strict';var _=require('lodash');var util=require(_0xc625('0x0'));var moment=require(_0xc625('0x1'));var BPromise=require(_0xc625('0x2'));var rs=require(_0xc625('0x3'));var fs=require('fs');var Redis=require(_0xc625('0x4'));var db=require(_0xc625('0x5'))['db'];var utils=require(_0xc625('0x6'));var logger=require(_0xc625('0x7'))(_0xc625('0x8'));var config=require(_0xc625('0x9'));var jayson=require(_0xc625('0xa'));var client=jayson[_0xc625('0xb')][_0xc625('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2e9725,_0x20e7c5,_0x3e6ad6){return new BPromise(function(_0x4a7a14,_0x57fa1d){return client[_0xc625('0xd')](_0x2e9725,_0x3e6ad6)[_0xc625('0xe')](function(_0x52c4f2){logger[_0xc625('0xf')](_0xc625('0x10'),_0x20e7c5,_0xc625('0x11'));logger[_0xc625('0x12')](_0xc625('0x13'),_0x20e7c5,_0xc625('0x11'),JSON[_0xc625('0x14')](_0x52c4f2));if(_0x52c4f2[_0xc625('0x15')]){if(_0x52c4f2[_0xc625('0x15')][_0xc625('0x16')]===0x1f4){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x20e7c5,_0x52c4f2[_0xc625('0x15')][_0xc625('0x17')]);return _0x57fa1d(_0x52c4f2[_0xc625('0x15')][_0xc625('0x17')]);}logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x20e7c5,_0x52c4f2[_0xc625('0x15')]['message']);return _0x4a7a14(_0x52c4f2['error']['message']);}else{logger[_0xc625('0xf')]('VtigerConfiguration,\x20%s,\x20%s',_0x20e7c5,_0xc625('0x11'));_0x4a7a14(_0x52c4f2[_0xc625('0x18')][_0xc625('0x17')]);}})[_0xc625('0x19')](function(_0x4e5219){logger[_0xc625('0x15')]('VtigerConfiguration,\x20%s,\x20%s',_0x20e7c5,_0x4e5219);_0x57fa1d(_0x4e5219);});});} \ No newline at end of file +var _0xd954=['VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x9f9380,_0x313674){var _0x45290e=function(_0x50ab18){while(--_0x50ab18){_0x9f9380['push'](_0x9f9380['shift']());}};_0x45290e(++_0x313674);}(_0xd954,0x1d5));var _0x4d95=function(_0x2f7270,_0x307af1){_0x2f7270=_0x2f7270-0x0;var _0xe1d89a=_0xd954[_0x2f7270];return _0xe1d89a;};'use strict';var _=require(_0x4d95('0x0'));var util=require(_0x4d95('0x1'));var moment=require(_0x4d95('0x2'));var BPromise=require(_0x4d95('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4d95('0x4'))['db'];var utils=require(_0x4d95('0x5'));var logger=require(_0x4d95('0x6'))(_0x4d95('0x7'));var config=require(_0x4d95('0x8'));var jayson=require(_0x4d95('0x9'));var client=jayson[_0x4d95('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3f489a,_0x2c5c02,_0x39f164){return new BPromise(function(_0x5bd93a,_0x15a354){return client[_0x4d95('0xb')](_0x3f489a,_0x39f164)[_0x4d95('0xc')](function(_0x28d0fe){logger[_0x4d95('0xd')](_0x4d95('0xe'),_0x2c5c02,_0x4d95('0xf'));logger[_0x4d95('0x10')](_0x4d95('0x11'),_0x2c5c02,_0x4d95('0xf'),JSON['stringify'](_0x28d0fe));if(_0x28d0fe[_0x4d95('0x12')]){if(_0x28d0fe[_0x4d95('0x12')][_0x4d95('0x13')]===0x1f4){logger[_0x4d95('0x12')]('VtigerConfiguration,\x20%s,\x20%s',_0x2c5c02,_0x28d0fe[_0x4d95('0x12')]['message']);return _0x15a354(_0x28d0fe[_0x4d95('0x12')][_0x4d95('0x14')]);}logger[_0x4d95('0x12')](_0x4d95('0xe'),_0x2c5c02,_0x28d0fe[_0x4d95('0x12')][_0x4d95('0x14')]);return _0x5bd93a(_0x28d0fe[_0x4d95('0x12')][_0x4d95('0x14')]);}else{logger[_0x4d95('0xd')](_0x4d95('0xe'),_0x2c5c02,'request\x20sent');_0x5bd93a(_0x28d0fe[_0x4d95('0x15')][_0x4d95('0x14')]);}})[_0x4d95('0x16')](function(_0x3348c3){logger[_0x4d95('0x12')](_0x4d95('0xe'),_0x2c5c02,_0x3348c3);_0x15a354(_0x3348c3);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index fc24039..e5b671c 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 _0xa33d=['fs-extra','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','util','path','express','Router'];(function(_0x47041d,_0x42153f){var _0x5022bd=function(_0x1dbb9a){while(--_0x1dbb9a){_0x47041d['push'](_0x47041d['shift']());}};_0x5022bd(++_0x42153f);}(_0xa33d,0x164));var _0xda33=function(_0x133d35,_0x235924){_0x133d35=_0x133d35-0x0;var _0x42386e=_0xa33d[_0x133d35];return _0x42386e;};'use strict';var multer=require('multer');var util=require(_0xda33('0x0'));var path=require(_0xda33('0x1'));var timeout=require('connect-timeout');var express=require(_0xda33('0x2'));var router=express[_0xda33('0x3')]();var fs_extra=require(_0xda33('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xda33('0x5'));var config=require(_0xda33('0x6'));var controller=require(_0xda33('0x7'));router[_0xda33('0x8')]('/',auth[_0xda33('0x9')](),controller[_0xda33('0xa')]);router[_0xda33('0x8')](_0xda33('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xda33('0xc')]('/',auth[_0xda33('0x9')](),controller[_0xda33('0xd')]);router[_0xda33('0xe')](_0xda33('0xb'),auth[_0xda33('0x9')](),controller[_0xda33('0xf')]);router[_0xda33('0x10')]('/:id',auth[_0xda33('0x9')](),controller[_0xda33('0x11')]);module['exports']=router; \ No newline at end of file +var _0x9d54=['isAuthenticated','show','post','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id'];(function(_0x4ca7c3,_0x20a99e){var _0x454288=function(_0x4032dd){while(--_0x4032dd){_0x4ca7c3['push'](_0x4ca7c3['shift']());}};_0x454288(++_0x20a99e);}(_0x9d54,0x15b));var _0x49d5=function(_0x400f64,_0x5bc51e){_0x400f64=_0x400f64-0x0;var _0x41c060=_0x9d54[_0x400f64];return _0x41c060;};'use strict';var multer=require(_0x49d5('0x0'));var util=require(_0x49d5('0x1'));var path=require(_0x49d5('0x2'));var timeout=require(_0x49d5('0x3'));var express=require(_0x49d5('0x4'));var router=express[_0x49d5('0x5')]();var fs_extra=require(_0x49d5('0x6'));var auth=require(_0x49d5('0x7'));var interaction=require(_0x49d5('0x8'));var config=require(_0x49d5('0x9'));var controller=require('./intVtigerField.controller');router[_0x49d5('0xa')]('/',auth['isAuthenticated'](),controller[_0x49d5('0xb')]);router[_0x49d5('0xa')](_0x49d5('0xc'),auth[_0x49d5('0xd')](),controller[_0x49d5('0xe')]);router[_0x49d5('0xf')]('/',auth[_0x49d5('0xd')](),controller['create']);router[_0x49d5('0x10')](_0x49d5('0xc'),auth[_0x49d5('0xd')](),controller[_0x49d5('0x11')]);router[_0x49d5('0x12')](_0x49d5('0xc'),auth[_0x49d5('0xd')](),controller['destroy']);module[_0x49d5('0x13')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 24f4ae5..c69ee21 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 _0x8ecc=['keyValue','STRING','BOOLEAN','sequelize','ENUM','string','variable','customVariable'];(function(_0x57126a,_0x156aab){var _0x4c8aa8=function(_0x757f90){while(--_0x757f90){_0x57126a['push'](_0x57126a['shift']());}};_0x4c8aa8(++_0x156aab);}(_0x8ecc,0x10b));var _0xc8ec=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8ecc[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xc8ec('0x0'));module['exports']={'type':{'type':Sequelize[_0xc8ec('0x1')](_0xc8ec('0x2'),_0xc8ec('0x3'),_0xc8ec('0x4'),_0xc8ec('0x5'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0xc8ec('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xc8ec('0x1')](_0xc8ec('0x2'),_0xc8ec('0x3'),_0xc8ec('0x4'))},'keyContent':{'type':Sequelize[_0xc8ec('0x6')]},'idField':{'type':Sequelize[_0xc8ec('0x6')]},'nameField':{'type':Sequelize[_0xc8ec('0x6')]},'customField':{'type':Sequelize[_0xc8ec('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc8ec('0x6')]}}; \ No newline at end of file +var _0x2339=['sequelize','exports','ENUM','string','customVariable','keyValue','STRING','BOOLEAN'];(function(_0xf15857,_0x2cf860){var _0x2f4e5c=function(_0x3c01aa){while(--_0x3c01aa){_0xf15857['push'](_0xf15857['shift']());}};_0x2f4e5c(++_0x2cf860);}(_0x2339,0xf8));var _0x9233=function(_0x18a033,_0x3c5fae){_0x18a033=_0x18a033-0x0;var _0xfd0041=_0x2339[_0x18a033];return _0xfd0041;};'use strict';var Sequelize=require(_0x9233('0x0'));module[_0x9233('0x1')]={'type':{'type':Sequelize[_0x9233('0x2')](_0x9233('0x3'),'variable',_0x9233('0x4'),_0x9233('0x5'),'picklist'),'defaultValue':_0x9233('0x3')},'content':{'type':Sequelize[_0x9233('0x6')]},'key':{'type':Sequelize[_0x9233('0x6')]},'keyType':{'type':Sequelize[_0x9233('0x2')]('string','variable',_0x9233('0x4'))},'keyContent':{'type':Sequelize[_0x9233('0x6')]},'idField':{'type':Sequelize[_0x9233('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x9233('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9233('0x6')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index bf99665..f5a51ad 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 _0xadf9=['where','merge','options','VtigerField','includeAll','include','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter'];(function(_0x331940,_0x23be3b){var _0x53edf7=function(_0x14742d){while(--_0x14742d){_0x331940['push'](_0x331940['shift']());}};_0x53edf7(++_0x23be3b);}(_0xadf9,0xe8));var _0x9adf=function(_0x23b87c,_0x3132ac){_0x23b87c=_0x23b87c-0x0;var _0x3d15d6=_0xadf9[_0x23b87c];return _0x3d15d6;};'use strict';var emlformat=require(_0x9adf('0x0'));var rimraf=require(_0x9adf('0x1'));var zipdir=require(_0x9adf('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9adf('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9adf('0x4'));var util=require(_0x9adf('0x5'));var path=require(_0x9adf('0x6'));var sox=require(_0x9adf('0x7'));var csv=require(_0x9adf('0x8'));var ejs=require(_0x9adf('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9adf('0xa'));var squel=require(_0x9adf('0xb'));var crypto=require(_0x9adf('0xc'));var jsforce=require(_0x9adf('0xd'));var deskjs=require(_0x9adf('0xe'));var toCsv=require(_0x9adf('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9adf('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x9adf('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9adf('0x11'));var logger=require(_0x9adf('0x12'))(_0x9adf('0x13'));var utils=require(_0x9adf('0x14'));var config=require(_0x9adf('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x9adf('0x16'))['db'];function respondWithStatusCode(_0x1d377a,_0x2477f4){_0x2477f4=_0x2477f4||0xcc;return function(_0x35010f){if(_0x35010f){return _0x1d377a[_0x9adf('0x17')](_0x2477f4);}return _0x1d377a[_0x9adf('0x18')](_0x2477f4)[_0x9adf('0x19')]();};}function respondWithResult(_0x4e3e50,_0x2833a5){_0x2833a5=_0x2833a5||0xc8;return function(_0x6d384c){if(_0x6d384c){return _0x4e3e50[_0x9adf('0x18')](_0x2833a5)[_0x9adf('0x1a')](_0x6d384c);}};}function respondWithFilteredResult(_0x5c633e,_0x2e60f3){return function(_0x4b85a2){if(_0x4b85a2){var _0x4aee77=typeof _0x2e60f3[_0x9adf('0x1b')]==='undefined'&&typeof _0x2e60f3[_0x9adf('0x1c')]===_0x9adf('0x1d');var _0x230951=_0x4b85a2[_0x9adf('0x1e')];var _0x5889e1=_0x4aee77?0x0:_0x2e60f3[_0x9adf('0x1b')];var _0x58818d=_0x4aee77?_0x4b85a2[_0x9adf('0x1e')]:_0x2e60f3['offset']+_0x2e60f3[_0x9adf('0x1c')];var _0x500e81;if(_0x58818d>=_0x230951){_0x58818d=_0x230951;_0x500e81=0xc8;}else{_0x500e81=0xce;}_0x5c633e[_0x9adf('0x18')](_0x500e81);return _0x5c633e[_0x9adf('0x1f')](_0x9adf('0x20'),_0x5889e1+'-'+_0x58818d+'/'+_0x230951)[_0x9adf('0x1a')](_0x4b85a2);}return null;};}function patchUpdates(_0x20aa2f){return function(_0xdbbebc){try{jsonpatch[_0x9adf('0x21')](_0xdbbebc,_0x20aa2f,!![]);}catch(_0x145f13){return BPromise['reject'](_0x145f13);}return _0xdbbebc[_0x9adf('0x22')]();};}function saveUpdates(_0x2b4240,_0x2ffc51){return function(_0x40282e){if(_0x40282e){return _0x40282e[_0x9adf('0x23')](_0x2b4240)[_0x9adf('0x24')](function(_0x11b162){return _0x11b162;});}return null;};}function removeEntity(_0x26bbc2,_0x181770){return function(_0x4a7e5f){if(_0x4a7e5f){return _0x4a7e5f[_0x9adf('0x25')]()[_0x9adf('0x24')](function(){_0x26bbc2[_0x9adf('0x18')](0xcc)[_0x9adf('0x19')]();});}};}function handleEntityNotFound(_0x545aeb,_0x423aa9){return function(_0x23f299){if(!_0x23f299){_0x545aeb[_0x9adf('0x17')](0x194);}return _0x23f299;};}function handleError(_0x1a9cb0,_0x57459e){_0x57459e=_0x57459e||0x1f4;return function(_0x488680){logger[_0x9adf('0x26')](_0x488680[_0x9adf('0x27')]);if(_0x488680[_0x9adf('0x28')]){delete _0x488680['name'];}_0x1a9cb0[_0x9adf('0x18')](_0x57459e)[_0x9adf('0x29')](_0x488680);};}exports[_0x9adf('0x2a')]=function(_0x280404,_0x4b8ea6){var _0x451675={},_0x1bcc8f={},_0xfb3a2f={'count':0x0,'rows':[]};var _0x40a26b=_['map'](db['VtigerField'][_0x9adf('0x2b')],function(_0x1ae744){return{'name':_0x1ae744[_0x9adf('0x2c')],'type':_0x1ae744[_0x9adf('0x2d')]['key']};});_0x1bcc8f[_0x9adf('0x2e')]=_[_0x9adf('0x2f')](_0x40a26b,_0x9adf('0x28'));_0x1bcc8f['query']=_[_0x9adf('0x30')](_0x280404['query']);_0x1bcc8f[_0x9adf('0x31')]=_[_0x9adf('0x32')](_0x1bcc8f[_0x9adf('0x2e')],_0x1bcc8f[_0x9adf('0x33')]);_0x451675[_0x9adf('0x34')]=_[_0x9adf('0x32')](_0x1bcc8f[_0x9adf('0x2e')],qs[_0x9adf('0x35')](_0x280404[_0x9adf('0x33')][_0x9adf('0x35')]));_0x451675[_0x9adf('0x34')]=_0x451675[_0x9adf('0x34')][_0x9adf('0x36')]?_0x451675['attributes']:_0x1bcc8f[_0x9adf('0x2e')];if(!_0x280404[_0x9adf('0x33')][_0x9adf('0x37')](_0x9adf('0x38'))){_0x451675[_0x9adf('0x1c')]=qs[_0x9adf('0x1c')](_0x280404[_0x9adf('0x33')][_0x9adf('0x1c')]);_0x451675['offset']=qs['offset'](_0x280404[_0x9adf('0x33')][_0x9adf('0x1b')]);}_0x451675['order']=qs['sort'](_0x280404[_0x9adf('0x33')][_0x9adf('0x39')]);_0x451675['where']=qs[_0x9adf('0x31')](_[_0x9adf('0x3a')](_0x280404['query'],_0x1bcc8f[_0x9adf('0x31')]),_0x40a26b);if(_0x280404[_0x9adf('0x33')][_0x9adf('0x3b')]){_0x451675[_0x9adf('0x3c')]=_[_0x9adf('0x3d')](_0x451675[_0x9adf('0x3c')],{'$or':_[_0x9adf('0x2f')](_0x40a26b,function(_0x5c6c65){if(_0x5c6c65['type']!=='VIRTUAL'){var _0x82b6e0={};_0x82b6e0[_0x5c6c65[_0x9adf('0x28')]]={'$like':'%'+_0x280404['query'][_0x9adf('0x3b')]+'%'};return _0x82b6e0;}})});}_0x451675=_[_0x9adf('0x3d')]({},_0x451675,_0x280404[_0x9adf('0x3e')]);var _0xfd30d9={'where':_0x451675[_0x9adf('0x3c')]};return db[_0x9adf('0x3f')][_0x9adf('0x1e')](_0xfd30d9)[_0x9adf('0x24')](function(_0xd323d0){_0xfb3a2f['count']=_0xd323d0;if(_0x280404['query'][_0x9adf('0x40')]){_0x451675[_0x9adf('0x41')]=[{'all':!![]}];}return db['VtigerField']['findAll'](_0x451675);})[_0x9adf('0x24')](function(_0x1155e9){_0xfb3a2f[_0x9adf('0x42')]=_0x1155e9;return _0xfb3a2f;})[_0x9adf('0x24')](respondWithFilteredResult(_0x4b8ea6,_0x451675))[_0x9adf('0x43')](handleError(_0x4b8ea6,null));};exports[_0x9adf('0x44')]=function(_0x2e0ab0,_0x12efd7){var _0x41d8cd={'raw':!![],'where':{'id':_0x2e0ab0[_0x9adf('0x45')]['id']}},_0x13788e={};_0x13788e[_0x9adf('0x2e')]=_[_0x9adf('0x30')](db[_0x9adf('0x3f')][_0x9adf('0x2b')]);_0x13788e['query']=_['keys'](_0x2e0ab0[_0x9adf('0x33')]);_0x13788e[_0x9adf('0x31')]=_['intersection'](_0x13788e[_0x9adf('0x2e')],_0x13788e[_0x9adf('0x33')]);_0x41d8cd[_0x9adf('0x34')]=_['intersection'](_0x13788e[_0x9adf('0x2e')],qs[_0x9adf('0x35')](_0x2e0ab0['query']['fields']));_0x41d8cd['attributes']=_0x41d8cd[_0x9adf('0x34')][_0x9adf('0x36')]?_0x41d8cd['attributes']:_0x13788e['model'];if(_0x2e0ab0[_0x9adf('0x33')][_0x9adf('0x40')]){_0x41d8cd[_0x9adf('0x41')]=[{'all':!![]}];}_0x41d8cd=_[_0x9adf('0x3d')]({},_0x41d8cd,_0x2e0ab0[_0x9adf('0x3e')]);return db[_0x9adf('0x3f')][_0x9adf('0x46')](_0x41d8cd)['then'](handleEntityNotFound(_0x12efd7,null))[_0x9adf('0x24')](respondWithResult(_0x12efd7,null))['catch'](handleError(_0x12efd7,null));};exports[_0x9adf('0x47')]=function(_0x13e08d,_0xac99c6){return db[_0x9adf('0x3f')][_0x9adf('0x47')](_0x13e08d[_0x9adf('0x48')],{})[_0x9adf('0x24')](respondWithResult(_0xac99c6,0xc9))[_0x9adf('0x43')](handleError(_0xac99c6,null));};exports[_0x9adf('0x23')]=function(_0x2804c4,_0x3194c8){if(_0x2804c4['body']['id']){delete _0x2804c4[_0x9adf('0x48')]['id'];}return db['VtigerField'][_0x9adf('0x46')]({'where':{'id':_0x2804c4[_0x9adf('0x45')]['id']}})['then'](handleEntityNotFound(_0x3194c8,null))['then'](saveUpdates(_0x2804c4['body'],null))[_0x9adf('0x24')](respondWithResult(_0x3194c8,null))[_0x9adf('0x43')](handleError(_0x3194c8,null));};exports[_0x9adf('0x25')]=function(_0xe297f7,_0x4de327){return db['VtigerField'][_0x9adf('0x46')]({'where':{'id':_0xe297f7[_0x9adf('0x45')]['id']}})[_0x9adf('0x24')](handleEntityNotFound(_0x4de327,null))[_0x9adf('0x24')](removeEntity(_0x4de327,null))[_0x9adf('0x43')](handleError(_0x4de327,null));}; \ No newline at end of file +var _0x996d=['order','sort','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','params','rawAttributes','intersection','fields','find','catch','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','VtigerField','type','key','map','query','keys','filters','model','attributes','length','hasOwnProperty','nolimit','limit'];(function(_0x52f25d,_0x3fabcc){var _0x443f30=function(_0x3a8a99){while(--_0x3a8a99){_0x52f25d['push'](_0x52f25d['shift']());}};_0x443f30(++_0x3fabcc);}(_0x996d,0xed));var _0xd996=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x996d[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xd996('0x0'));var rimraf=require(_0xd996('0x1'));var zipdir=require(_0xd996('0x2'));var jsonpatch=require(_0xd996('0x3'));var rp=require('request-promise');var moment=require(_0xd996('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xd996('0x5'));var sox=require(_0xd996('0x6'));var csv=require(_0xd996('0x7'));var ejs=require(_0xd996('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd996('0x9'));var squel=require('squel');var crypto=require(_0xd996('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xd996('0xb'));var toCsv=require(_0xd996('0x7'));var querystring=require(_0xd996('0xc'));var Papa=require(_0xd996('0xd'));var Redis=require(_0xd996('0xe'));var authService=require(_0xd996('0xf'));var qs=require(_0xd996('0x10'));var as=require(_0xd996('0x11'));var hardwareService=require(_0xd996('0x12'));var logger=require(_0xd996('0x13'))(_0xd996('0x14'));var utils=require('../../config/utils');var config=require(_0xd996('0x15'));var licenseUtil=require(_0xd996('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2da206,_0x179165){_0x179165=_0x179165||0xcc;return function(_0x377d5d){if(_0x377d5d){return _0x2da206[_0xd996('0x17')](_0x179165);}return _0x2da206[_0xd996('0x18')](_0x179165)[_0xd996('0x19')]();};}function respondWithResult(_0x1d07b0,_0x5ce52f){_0x5ce52f=_0x5ce52f||0xc8;return function(_0x11444a){if(_0x11444a){return _0x1d07b0[_0xd996('0x18')](_0x5ce52f)[_0xd996('0x1a')](_0x11444a);}};}function respondWithFilteredResult(_0x5ea70a,_0x55ba3e){return function(_0x29e536){if(_0x29e536){var _0x4f869a=typeof _0x55ba3e[_0xd996('0x1b')]==='undefined'&&typeof _0x55ba3e['limit']===_0xd996('0x1c');var _0x172902=_0x29e536['count'];var _0x3e632c=_0x4f869a?0x0:_0x55ba3e[_0xd996('0x1b')];var _0x121bc8=_0x4f869a?_0x29e536['count']:_0x55ba3e[_0xd996('0x1b')]+_0x55ba3e['limit'];var _0x114ba8;if(_0x121bc8>=_0x172902){_0x121bc8=_0x172902;_0x114ba8=0xc8;}else{_0x114ba8=0xce;}_0x5ea70a[_0xd996('0x18')](_0x114ba8);return _0x5ea70a[_0xd996('0x1d')](_0xd996('0x1e'),_0x3e632c+'-'+_0x121bc8+'/'+_0x172902)['json'](_0x29e536);}return null;};}function patchUpdates(_0x2168a9){return function(_0x44e94f){try{jsonpatch[_0xd996('0x1f')](_0x44e94f,_0x2168a9,!![]);}catch(_0x2be12c){return BPromise[_0xd996('0x20')](_0x2be12c);}return _0x44e94f[_0xd996('0x21')]();};}function saveUpdates(_0x2b22a4,_0x1731b4){return function(_0xc1e718){if(_0xc1e718){return _0xc1e718[_0xd996('0x22')](_0x2b22a4)[_0xd996('0x23')](function(_0x1ed7df){return _0x1ed7df;});}return null;};}function removeEntity(_0x2eb6fe,_0x58ddad){return function(_0x5844b5){if(_0x5844b5){return _0x5844b5[_0xd996('0x24')]()[_0xd996('0x23')](function(){_0x2eb6fe['status'](0xcc)[_0xd996('0x19')]();});}};}function handleEntityNotFound(_0x52e7ca,_0x596098){return function(_0x578359){if(!_0x578359){_0x52e7ca[_0xd996('0x17')](0x194);}return _0x578359;};}function handleError(_0x1ae949,_0x136606){_0x136606=_0x136606||0x1f4;return function(_0x273b93){logger[_0xd996('0x25')](_0x273b93[_0xd996('0x26')]);if(_0x273b93[_0xd996('0x27')]){delete _0x273b93[_0xd996('0x27')];}_0x1ae949['status'](_0x136606)[_0xd996('0x28')](_0x273b93);};}exports[_0xd996('0x29')]=function(_0x4d268e,_0x4d1fe1){var _0x19511f={},_0xc013b7={},_0x2d49d7={'count':0x0,'rows':[]};var _0x5a791c=_['map'](db[_0xd996('0x2a')]['rawAttributes'],function(_0x397966){return{'name':_0x397966['fieldName'],'type':_0x397966[_0xd996('0x2b')][_0xd996('0x2c')]};});_0xc013b7['model']=_[_0xd996('0x2d')](_0x5a791c,_0xd996('0x27'));_0xc013b7[_0xd996('0x2e')]=_[_0xd996('0x2f')](_0x4d268e[_0xd996('0x2e')]);_0xc013b7[_0xd996('0x30')]=_['intersection'](_0xc013b7[_0xd996('0x31')],_0xc013b7[_0xd996('0x2e')]);_0x19511f[_0xd996('0x32')]=_['intersection'](_0xc013b7[_0xd996('0x31')],qs['fields'](_0x4d268e[_0xd996('0x2e')]['fields']));_0x19511f[_0xd996('0x32')]=_0x19511f[_0xd996('0x32')][_0xd996('0x33')]?_0x19511f[_0xd996('0x32')]:_0xc013b7[_0xd996('0x31')];if(!_0x4d268e[_0xd996('0x2e')][_0xd996('0x34')](_0xd996('0x35'))){_0x19511f[_0xd996('0x36')]=qs['limit'](_0x4d268e[_0xd996('0x2e')][_0xd996('0x36')]);_0x19511f[_0xd996('0x1b')]=qs[_0xd996('0x1b')](_0x4d268e['query'][_0xd996('0x1b')]);}_0x19511f[_0xd996('0x37')]=qs[_0xd996('0x38')](_0x4d268e[_0xd996('0x2e')]['sort']);_0x19511f['where']=qs[_0xd996('0x30')](_['pick'](_0x4d268e['query'],_0xc013b7[_0xd996('0x30')]),_0x5a791c);if(_0x4d268e[_0xd996('0x2e')][_0xd996('0x39')]){_0x19511f[_0xd996('0x3a')]=_[_0xd996('0x3b')](_0x19511f[_0xd996('0x3a')],{'$or':_['map'](_0x5a791c,function(_0x500896){if(_0x500896[_0xd996('0x2b')]!==_0xd996('0x3c')){var _0xb1d669={};_0xb1d669[_0x500896[_0xd996('0x27')]]={'$like':'%'+_0x4d268e['query'][_0xd996('0x39')]+'%'};return _0xb1d669;}})});}_0x19511f=_[_0xd996('0x3b')]({},_0x19511f,_0x4d268e[_0xd996('0x3d')]);var _0x286d1f={'where':_0x19511f[_0xd996('0x3a')]};return db['VtigerField'][_0xd996('0x3e')](_0x286d1f)[_0xd996('0x23')](function(_0xdcbcca){_0x2d49d7[_0xd996('0x3e')]=_0xdcbcca;if(_0x4d268e[_0xd996('0x2e')][_0xd996('0x3f')]){_0x19511f[_0xd996('0x40')]=[{'all':!![]}];}return db[_0xd996('0x2a')][_0xd996('0x41')](_0x19511f);})['then'](function(_0x3db06b){_0x2d49d7['rows']=_0x3db06b;return _0x2d49d7;})[_0xd996('0x23')](respondWithFilteredResult(_0x4d1fe1,_0x19511f))['catch'](handleError(_0x4d1fe1,null));};exports['show']=function(_0x1e5574,_0x27c44c){var _0x44e20b={'raw':!![],'where':{'id':_0x1e5574[_0xd996('0x42')]['id']}},_0x7fb912={};_0x7fb912['model']=_[_0xd996('0x2f')](db['VtigerField'][_0xd996('0x43')]);_0x7fb912[_0xd996('0x2e')]=_[_0xd996('0x2f')](_0x1e5574['query']);_0x7fb912[_0xd996('0x30')]=_[_0xd996('0x44')](_0x7fb912[_0xd996('0x31')],_0x7fb912[_0xd996('0x2e')]);_0x44e20b[_0xd996('0x32')]=_['intersection'](_0x7fb912[_0xd996('0x31')],qs['fields'](_0x1e5574[_0xd996('0x2e')][_0xd996('0x45')]));_0x44e20b[_0xd996('0x32')]=_0x44e20b[_0xd996('0x32')][_0xd996('0x33')]?_0x44e20b[_0xd996('0x32')]:_0x7fb912[_0xd996('0x31')];if(_0x1e5574['query']['includeAll']){_0x44e20b[_0xd996('0x40')]=[{'all':!![]}];}_0x44e20b=_[_0xd996('0x3b')]({},_0x44e20b,_0x1e5574[_0xd996('0x3d')]);return db[_0xd996('0x2a')][_0xd996('0x46')](_0x44e20b)[_0xd996('0x23')](handleEntityNotFound(_0x27c44c,null))[_0xd996('0x23')](respondWithResult(_0x27c44c,null))[_0xd996('0x47')](handleError(_0x27c44c,null));};exports['create']=function(_0x5a1ce6,_0x56096e){return db[_0xd996('0x2a')]['create'](_0x5a1ce6[_0xd996('0x48')],{})['then'](respondWithResult(_0x56096e,0xc9))[_0xd996('0x47')](handleError(_0x56096e,null));};exports[_0xd996('0x22')]=function(_0x2cd730,_0x36ecf){if(_0x2cd730[_0xd996('0x48')]['id']){delete _0x2cd730[_0xd996('0x48')]['id'];}return db['VtigerField']['find']({'where':{'id':_0x2cd730[_0xd996('0x42')]['id']}})['then'](handleEntityNotFound(_0x36ecf,null))[_0xd996('0x23')](saveUpdates(_0x2cd730[_0xd996('0x48')],null))[_0xd996('0x23')](respondWithResult(_0x36ecf,null))[_0xd996('0x47')](handleError(_0x36ecf,null));};exports[_0xd996('0x24')]=function(_0x1a65d1,_0xd5f11){return db['VtigerField'][_0xd996('0x46')]({'where':{'id':_0x1a65d1[_0xd996('0x42')]['id']}})[_0xd996('0x23')](handleEntityNotFound(_0xd5f11,null))[_0xd996('0x23')](removeEntity(_0xd5f11,null))[_0xd996('0x47')](handleError(_0xd5f11,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index a47be49..3682edb 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 _0x682b=['./intVtigerField.attributes','exports','VtigerField','int_vtiger_fields','FieldId','lodash','util','api','bluebird','path','rimraf'];(function(_0x567926,_0x132177){var _0x55c6ec=function(_0x7f2903){while(--_0x7f2903){_0x567926['push'](_0x567926['shift']());}};_0x55c6ec(++_0x132177);}(_0x682b,0x10d));var _0xb682=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x682b[_0x263a74];return _0x2aa86c;};'use strict';var _=require(_0xb682('0x0'));var util=require(_0xb682('0x1'));var logger=require('../../config/logger')(_0xb682('0x2'));var moment=require('moment');var BPromise=require(_0xb682('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb682('0x4'));var rimraf=require(_0xb682('0x5'));var config=require('../../config/environment');var attributes=require(_0xb682('0x6'));module[_0xb682('0x7')]=function(_0x1c3b6e,_0x214cc5){return _0x1c3b6e['define'](_0xb682('0x8'),attributes,{'tableName':_0xb682('0x9'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':['idField',_0xb682('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa21a=['../../config/environment','./intVtigerField.attributes','define','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x2be006,_0x240ed5){var _0x8cf714=function(_0x5d81be){while(--_0x5d81be){_0x2be006['push'](_0x2be006['shift']());}};_0x8cf714(++_0x240ed5);}(_0xa21a,0x149));var _0xaa21=function(_0x284461,_0x459cf9){_0x284461=_0x284461-0x0;var _0x288d7f=_0xa21a[_0x284461];return _0x288d7f;};'use strict';var _=require(_0xaa21('0x0'));var util=require(_0xaa21('0x1'));var logger=require(_0xaa21('0x2'))('api');var moment=require(_0xaa21('0x3'));var BPromise=require(_0xaa21('0x4'));var rp=require(_0xaa21('0x5'));var fs=require('fs');var path=require(_0xaa21('0x6'));var rimraf=require('rimraf');var config=require(_0xaa21('0x7'));var attributes=require(_0xaa21('0x8'));module['exports']=function(_0x2d03ff,_0x49ffab){return _0x2d03ff[_0xaa21('0x9')](_0xaa21('0xa'),attributes,{'tableName':_0xaa21('0xb'),'paranoid':![],'indexes':[{'name':_0xaa21('0xc'),'fields':[_0xaa21('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index 8ae7097..4efd4f1 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 _0x659b=['http','then','VtigerField,\x20%s,\x20%s','request\x20sent','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x5edfb4,_0x2c938c){var _0x3daf93=function(_0x119da8){while(--_0x119da8){_0x5edfb4['push'](_0x5edfb4['shift']());}};_0x3daf93(++_0x2c938c);}(_0x659b,0x100));var _0xb659=function(_0xa84f90,_0x325b39){_0xa84f90=_0xa84f90-0x0;var _0x3d5ec3=_0x659b[_0xa84f90];return _0x3d5ec3;};'use strict';var _=require('lodash');var util=require(_0xb659('0x0'));var moment=require(_0xb659('0x1'));var BPromise=require(_0xb659('0x2'));var rs=require(_0xb659('0x3'));var fs=require('fs');var Redis=require(_0xb659('0x4'));var db=require(_0xb659('0x5'))['db'];var utils=require(_0xb659('0x6'));var logger=require(_0xb659('0x7'))('rpc');var config=require(_0xb659('0x8'));var jayson=require(_0xb659('0x9'));var client=jayson['client'][_0xb659('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5de4ed,_0xf30b0,_0x17dedb){return new BPromise(function(_0xb48bdd,_0x52640d){return client['request'](_0x5de4ed,_0x17dedb)[_0xb659('0xb')](function(_0x3daf1b){logger['info'](_0xb659('0xc'),_0xf30b0,_0xb659('0xd'));logger['debug'](_0xb659('0xe'),_0xf30b0,_0xb659('0xd'),JSON[_0xb659('0xf')](_0x3daf1b));if(_0x3daf1b[_0xb659('0x10')]){if(_0x3daf1b['error'][_0xb659('0x11')]===0x1f4){logger[_0xb659('0x10')]('VtigerField,\x20%s,\x20%s',_0xf30b0,_0x3daf1b[_0xb659('0x10')][_0xb659('0x12')]);return _0x52640d(_0x3daf1b[_0xb659('0x10')][_0xb659('0x12')]);}logger[_0xb659('0x10')]('VtigerField,\x20%s,\x20%s',_0xf30b0,_0x3daf1b['error'][_0xb659('0x12')]);return _0xb48bdd(_0x3daf1b[_0xb659('0x10')]['message']);}else{logger['info'](_0xb659('0xc'),_0xf30b0,_0xb659('0xd'));_0xb48bdd(_0x3daf1b['result']['message']);}})['catch'](function(_0x51c065){logger[_0xb659('0x10')](_0xb659('0xc'),_0xf30b0,_0x51c065);_0x52640d(_0x51c065);});});} \ No newline at end of file +var _0x3fcc=['lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','VtigerField,\x20%s,\x20%s','request\x20sent','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x3c3698,_0xa0bf08){var _0x4e6637=function(_0x1fc9a4){while(--_0x1fc9a4){_0x3c3698['push'](_0x3c3698['shift']());}};_0x4e6637(++_0xa0bf08);}(_0x3fcc,0x104));var _0xc3fc=function(_0x24eea8,_0x5b0e6c){_0x24eea8=_0x24eea8-0x0;var _0xa45f11=_0x3fcc[_0x24eea8];return _0xa45f11;};'use strict';var _=require(_0xc3fc('0x0'));var util=require(_0xc3fc('0x1'));var moment=require(_0xc3fc('0x2'));var BPromise=require(_0xc3fc('0x3'));var rs=require(_0xc3fc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc3fc('0x5'));var logger=require(_0xc3fc('0x6'))(_0xc3fc('0x7'));var config=require(_0xc3fc('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc3fc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x26ca92,_0x57b904,_0x5187cf){return new BPromise(function(_0x422824,_0x2b61ea){return client[_0xc3fc('0xa')](_0x26ca92,_0x5187cf)[_0xc3fc('0xb')](function(_0x4742c3){logger['info'](_0xc3fc('0xc'),_0x57b904,_0xc3fc('0xd'));logger['debug'](_0xc3fc('0xe'),_0x57b904,_0xc3fc('0xd'),JSON[_0xc3fc('0xf')](_0x4742c3));if(_0x4742c3[_0xc3fc('0x10')]){if(_0x4742c3[_0xc3fc('0x10')][_0xc3fc('0x11')]===0x1f4){logger['error'](_0xc3fc('0xc'),_0x57b904,_0x4742c3[_0xc3fc('0x10')]['message']);return _0x2b61ea(_0x4742c3['error'][_0xc3fc('0x12')]);}logger[_0xc3fc('0x10')]('VtigerField,\x20%s,\x20%s',_0x57b904,_0x4742c3[_0xc3fc('0x10')][_0xc3fc('0x12')]);return _0x422824(_0x4742c3[_0xc3fc('0x10')][_0xc3fc('0x12')]);}else{logger[_0xc3fc('0x13')](_0xc3fc('0xc'),_0x57b904,_0xc3fc('0xd'));_0x422824(_0x4742c3['result'][_0xc3fc('0x12')]);}})['catch'](function(_0x221434){logger[_0xc3fc('0x10')](_0xc3fc('0xc'),_0x57b904,_0x221434);_0x2b61ea(_0x221434);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index e8a55f6..5fb56b1 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 _0x0271=['util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','/:id','getConfigurations','getFields','create','/:id/configurations','addConfiguration','put','update','delete','destroy','exports','multer'];(function(_0xfabd7c,_0x153e5d){var _0x40ae44=function(_0x4c58ee){while(--_0x4c58ee){_0xfabd7c['push'](_0xfabd7c['shift']());}};_0x40ae44(++_0x153e5d);}(_0x0271,0xdb));var _0x1027=function(_0x11c5c2,_0x263405){_0x11c5c2=_0x11c5c2-0x0;var _0x59cc34=_0x0271[_0x11c5c2];return _0x59cc34;};'use strict';var multer=require(_0x1027('0x0'));var util=require(_0x1027('0x1'));var path=require(_0x1027('0x2'));var timeout=require(_0x1027('0x3'));var express=require(_0x1027('0x4'));var router=express[_0x1027('0x5')]();var fs_extra=require(_0x1027('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1027('0x7'));var controller=require(_0x1027('0x8'));router[_0x1027('0x9')]('/',auth[_0x1027('0xa')](),controller['index']);router[_0x1027('0x9')](_0x1027('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1027('0x9')]('/:id/configurations',auth[_0x1027('0xa')](),controller[_0x1027('0xc')]);router[_0x1027('0x9')]('/:id/fields',auth[_0x1027('0xa')](),controller[_0x1027('0xd')]);router['post']('/',auth[_0x1027('0xa')](),controller[_0x1027('0xe')]);router['post'](_0x1027('0xf'),auth['isAuthenticated'](),controller[_0x1027('0x10')]);router[_0x1027('0x11')](_0x1027('0xb'),auth[_0x1027('0xa')](),controller[_0x1027('0x12')]);router[_0x1027('0x13')](_0x1027('0xb'),auth[_0x1027('0xa')](),controller[_0x1027('0x14')]);module[_0x1027('0x15')]=router; \ No newline at end of file +var _0x2b7e=['/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZendeskAccount.controller','get','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put'];(function(_0x41c1dd,_0x3ad5d0){var _0x3337a6=function(_0x18a3b7){while(--_0x18a3b7){_0x41c1dd['push'](_0x41c1dd['shift']());}};_0x3337a6(++_0x3ad5d0);}(_0x2b7e,0x1b4));var _0xe2b7=function(_0x48ccf2,_0x381185){_0x48ccf2=_0x48ccf2-0x0;var _0x207d58=_0x2b7e[_0x48ccf2];return _0x207d58;};'use strict';var multer=require(_0xe2b7('0x0'));var util=require(_0xe2b7('0x1'));var path=require(_0xe2b7('0x2'));var timeout=require(_0xe2b7('0x3'));var express=require(_0xe2b7('0x4'));var router=express[_0xe2b7('0x5')]();var fs_extra=require(_0xe2b7('0x6'));var auth=require(_0xe2b7('0x7'));var interaction=require(_0xe2b7('0x8'));var config=require('../../config/environment');var controller=require(_0xe2b7('0x9'));router[_0xe2b7('0xa')]('/',auth[_0xe2b7('0xb')](),controller['index']);router[_0xe2b7('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xe2b7('0xc')]);router['get'](_0xe2b7('0xd'),auth['isAuthenticated'](),controller[_0xe2b7('0xe')]);router[_0xe2b7('0xa')](_0xe2b7('0xf'),auth[_0xe2b7('0xb')](),controller[_0xe2b7('0x10')]);router['post']('/',auth[_0xe2b7('0xb')](),controller['create']);router[_0xe2b7('0x11')](_0xe2b7('0xd'),auth[_0xe2b7('0xb')](),controller[_0xe2b7('0x12')]);router[_0xe2b7('0x13')](_0xe2b7('0x14'),auth[_0xe2b7('0xb')](),controller[_0xe2b7('0x15')]);router[_0xe2b7('0x16')](_0xe2b7('0x14'),auth[_0xe2b7('0xb')](),controller[_0xe2b7('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 32d29bd..7d24ffb 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 _0x553a=['exports','STRING','username','password','ENUM','integrationTab'];(function(_0x4f2488,_0x37f267){var _0x5b6ebe=function(_0x22b12c){while(--_0x22b12c){_0x4f2488['push'](_0x4f2488['shift']());}};_0x5b6ebe(++_0x37f267);}(_0x553a,0x192));var _0xa553=function(_0x232e7a,_0x19997){_0x232e7a=_0x232e7a-0x0;var _0x445ddd=_0x553a[_0x232e7a];return _0x445ddd;};'use strict';var Sequelize=require('sequelize');module[_0xa553('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa553('0x1')]},'username':{'type':Sequelize[_0xa553('0x1')],'unique':_0xa553('0x2')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xa553('0x1')],'unique':'remoteUri'},'authType':{'type':Sequelize['ENUM'](_0xa553('0x3'),'token'),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0xa553('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xa553('0x4')](_0xa553('0x5'),'newTab'),'defaultValue':_0xa553('0x5')}}; \ No newline at end of file +var _0x71ab=['newTab','exports','STRING','username','remoteUri','ENUM','password','token','integrationTab'];(function(_0x2728b4,_0x2cf984){var _0x47c6b1=function(_0x135a92){while(--_0x135a92){_0x2728b4['push'](_0x2728b4['shift']());}};_0x47c6b1(++_0x2cf984);}(_0x71ab,0x64));var _0xb71a=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x71ab[_0x465028];return _0xb783d4;};'use strict';var Sequelize=require('sequelize');module[_0xb71a('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb71a('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0xb71a('0x2')},'password':{'type':Sequelize[_0xb71a('0x1')]},'token':{'type':Sequelize[_0xb71a('0x1')]},'remoteUri':{'type':Sequelize[_0xb71a('0x1')],'unique':_0xb71a('0x3')},'authType':{'type':Sequelize[_0xb71a('0x4')](_0xb71a('0x5'),_0xb71a('0x6')),'defaultValue':_0xb71a('0x5')},'serverUrl':{'type':Sequelize[_0xb71a('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xb71a('0x4')](_0xb71a('0x7'),_0xb71a('0x8')),'defaultValue':_0xb71a('0x7')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index a5fca5e..074badd 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 _0xf4eb=['includes','position','title','system_field_options','custom_field_options','test','statusCode','error','getFields','stringify','send','Wrong\x20credentials','eml-format','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','map','ZendeskAccount','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','merge','filter','options','includeAll','include','catch','show','params','find','create','body','getConfigurations','order','nolimit','addConfiguration','Subjects','getSubjects','channel','getDescriptions','ZendeskConfiguration','ZendeskField','findOne','username','password','authType','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','headers','Basic\x20%s','%s:%s','toString','base64','%s/token:%s','token','ValidationError','description','assignee','remove','ticket_fields'];(function(_0x42f370,_0xaa01c7){var _0x2fee7d=function(_0x56a08a){while(--_0x56a08a){_0x42f370['push'](_0x42f370['shift']());}};_0x2fee7d(++_0xaa01c7);}(_0xf4eb,0xec));var _0xbf4e=function(_0x148dc4,_0x764f75){_0x148dc4=_0x148dc4-0x0;var _0x2c9aa5=_0xf4eb[_0x148dc4];return _0x2c9aa5;};'use strict';var emlformat=require(_0xbf4e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbf4e('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbf4e('0x2'));var path=require(_0xbf4e('0x3'));var sox=require(_0xbf4e('0x4'));var csv=require(_0xbf4e('0x5'));var ejs=require(_0xbf4e('0x6'));var fs=require('fs');var fs_extra=require(_0xbf4e('0x7'));var _=require(_0xbf4e('0x8'));var squel=require('squel');var crypto=require(_0xbf4e('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbf4e('0x5'));var querystring=require(_0xbf4e('0xa'));var Papa=require(_0xbf4e('0xb'));var Redis=require(_0xbf4e('0xc'));var authService=require(_0xbf4e('0xd'));var qs=require(_0xbf4e('0xe'));var as=require(_0xbf4e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbf4e('0x10'));var utils=require('../../config/utils');var config=require(_0xbf4e('0x11'));var licenseUtil=require(_0xbf4e('0x12'));var db=require('../../mysqldb')['db'];var integrations=require(_0xbf4e('0x13'));function respondWithStatusCode(_0x5a3035,_0x56d185){_0x56d185=_0x56d185||0xcc;return function(_0x209b25){if(_0x209b25){return _0x5a3035[_0xbf4e('0x14')](_0x56d185);}return _0x5a3035[_0xbf4e('0x15')](_0x56d185)[_0xbf4e('0x16')]();};}function respondWithResult(_0x3b74bd,_0x61bd54){_0x61bd54=_0x61bd54||0xc8;return function(_0x4984b4){if(_0x4984b4){return _0x3b74bd['status'](_0x61bd54)[_0xbf4e('0x17')](_0x4984b4);}};}function respondWithFilteredResult(_0x1735ae,_0x28fc6b){return function(_0x542909){if(_0x542909){var _0x14110b=typeof _0x28fc6b[_0xbf4e('0x18')]===_0xbf4e('0x19')&&typeof _0x28fc6b[_0xbf4e('0x1a')]==='undefined';var _0x247322=_0x542909['count'];var _0x5db03f=_0x14110b?0x0:_0x28fc6b['offset'];var _0x4f8762=_0x14110b?_0x542909[_0xbf4e('0x1b')]:_0x28fc6b[_0xbf4e('0x18')]+_0x28fc6b[_0xbf4e('0x1a')];var _0x4d9c2a;if(_0x4f8762>=_0x247322){_0x4f8762=_0x247322;_0x4d9c2a=0xc8;}else{_0x4d9c2a=0xce;}_0x1735ae['status'](_0x4d9c2a);return _0x1735ae[_0xbf4e('0x1c')](_0xbf4e('0x1d'),_0x5db03f+'-'+_0x4f8762+'/'+_0x247322)[_0xbf4e('0x17')](_0x542909);}return null;};}function patchUpdates(_0x3a875b){return function(_0x344727){try{jsonpatch[_0xbf4e('0x1e')](_0x344727,_0x3a875b,!![]);}catch(_0x415963){return BPromise[_0xbf4e('0x1f')](_0x415963);}return _0x344727[_0xbf4e('0x20')]();};}function saveUpdates(_0x376832,_0x30539b){return function(_0x59bd84){if(_0x59bd84){return _0x59bd84[_0xbf4e('0x21')](_0x376832)[_0xbf4e('0x22')](function(_0x51648c){return _0x51648c;});}return null;};}function removeEntity(_0x31e3f5,_0x30994d){return function(_0x114412){if(_0x114412){return _0x114412[_0xbf4e('0x23')]()[_0xbf4e('0x22')](function(){_0x31e3f5['status'](0xcc)[_0xbf4e('0x16')]();});}};}function handleEntityNotFound(_0x36688a,_0x3d6863){return function(_0x5766d4){if(!_0x5766d4){_0x36688a[_0xbf4e('0x14')](0x194);}return _0x5766d4;};}function handleError(_0x5e08b1,_0x5bcf71){_0x5bcf71=_0x5bcf71||0x1f4;return function(_0x2bfccf){logger['error'](_0x2bfccf[_0xbf4e('0x24')]);if(_0x2bfccf[_0xbf4e('0x25')]){delete _0x2bfccf[_0xbf4e('0x25')];}_0x5e08b1[_0xbf4e('0x15')](_0x5bcf71)['send'](_0x2bfccf);};}exports[_0xbf4e('0x26')]=function(_0x8e0ab5,_0x43879d){var _0x4cd4a1={},_0x681c3b={},_0x590c85={'count':0x0,'rows':[]};var _0x1dfa81=_[_0xbf4e('0x27')](db[_0xbf4e('0x28')]['rawAttributes'],function(_0x1d12e2){return{'name':_0x1d12e2[_0xbf4e('0x29')],'type':_0x1d12e2[_0xbf4e('0x2a')][_0xbf4e('0x2b')]};});_0x681c3b[_0xbf4e('0x2c')]=_[_0xbf4e('0x27')](_0x1dfa81,'name');_0x681c3b[_0xbf4e('0x2d')]=_[_0xbf4e('0x2e')](_0x8e0ab5['query']);_0x681c3b[_0xbf4e('0x2f')]=_[_0xbf4e('0x30')](_0x681c3b['model'],_0x681c3b[_0xbf4e('0x2d')]);_0x4cd4a1['attributes']=_[_0xbf4e('0x30')](_0x681c3b['model'],qs[_0xbf4e('0x31')](_0x8e0ab5[_0xbf4e('0x2d')][_0xbf4e('0x31')]));_0x4cd4a1['attributes']=_0x4cd4a1[_0xbf4e('0x32')][_0xbf4e('0x33')]?_0x4cd4a1[_0xbf4e('0x32')]:_0x681c3b[_0xbf4e('0x2c')];if(!_0x8e0ab5[_0xbf4e('0x2d')][_0xbf4e('0x34')]('nolimit')){_0x4cd4a1[_0xbf4e('0x1a')]=qs[_0xbf4e('0x1a')](_0x8e0ab5[_0xbf4e('0x2d')][_0xbf4e('0x1a')]);_0x4cd4a1[_0xbf4e('0x18')]=qs['offset'](_0x8e0ab5['query']['offset']);}_0x4cd4a1['order']=qs[_0xbf4e('0x35')](_0x8e0ab5[_0xbf4e('0x2d')][_0xbf4e('0x35')]);_0x4cd4a1[_0xbf4e('0x36')]=qs[_0xbf4e('0x2f')](_[_0xbf4e('0x37')](_0x8e0ab5[_0xbf4e('0x2d')],_0x681c3b[_0xbf4e('0x2f')]),_0x1dfa81);if(_0x8e0ab5[_0xbf4e('0x2d')]['filter']){_0x4cd4a1['where']=_[_0xbf4e('0x38')](_0x4cd4a1[_0xbf4e('0x36')],{'$or':_[_0xbf4e('0x27')](_0x1dfa81,function(_0x4ae676){if(_0x4ae676[_0xbf4e('0x2a')]!=='VIRTUAL'){var _0x370d90={};_0x370d90[_0x4ae676[_0xbf4e('0x25')]]={'$like':'%'+_0x8e0ab5[_0xbf4e('0x2d')][_0xbf4e('0x39')]+'%'};return _0x370d90;}})});}_0x4cd4a1=_['merge']({},_0x4cd4a1,_0x8e0ab5[_0xbf4e('0x3a')]);var _0x78ab2d={'where':_0x4cd4a1[_0xbf4e('0x36')]};return db[_0xbf4e('0x28')]['count'](_0x78ab2d)[_0xbf4e('0x22')](function(_0x44e96b){_0x590c85[_0xbf4e('0x1b')]=_0x44e96b;if(_0x8e0ab5[_0xbf4e('0x2d')][_0xbf4e('0x3b')]){_0x4cd4a1[_0xbf4e('0x3c')]=[{'all':!![]}];}return db[_0xbf4e('0x28')]['findAll'](_0x4cd4a1);})[_0xbf4e('0x22')](function(_0x7b3a94){_0x590c85['rows']=_0x7b3a94;return _0x590c85;})['then'](respondWithFilteredResult(_0x43879d,_0x4cd4a1))[_0xbf4e('0x3d')](handleError(_0x43879d,null));};exports[_0xbf4e('0x3e')]=function(_0x495e53,_0x5bfc4d){var _0x2b1bf4={'raw':![],'where':{'id':_0x495e53[_0xbf4e('0x3f')]['id']}},_0x150224={};_0x150224[_0xbf4e('0x2c')]=_[_0xbf4e('0x2e')](db[_0xbf4e('0x28')]['rawAttributes']);_0x150224[_0xbf4e('0x2d')]=_[_0xbf4e('0x2e')](_0x495e53['query']);_0x150224['filters']=_['intersection'](_0x150224['model'],_0x150224[_0xbf4e('0x2d')]);_0x2b1bf4['attributes']=_[_0xbf4e('0x30')](_0x150224[_0xbf4e('0x2c')],qs['fields'](_0x495e53['query'][_0xbf4e('0x31')]));_0x2b1bf4[_0xbf4e('0x32')]=_0x2b1bf4[_0xbf4e('0x32')][_0xbf4e('0x33')]?_0x2b1bf4[_0xbf4e('0x32')]:_0x150224['model'];if(_0x495e53[_0xbf4e('0x2d')][_0xbf4e('0x3b')]){_0x2b1bf4[_0xbf4e('0x3c')]=[{'all':!![]}];}_0x2b1bf4=_[_0xbf4e('0x38')]({},_0x2b1bf4,_0x495e53[_0xbf4e('0x3a')]);return db[_0xbf4e('0x28')][_0xbf4e('0x40')](_0x2b1bf4)[_0xbf4e('0x22')](handleEntityNotFound(_0x5bfc4d,null))['then'](respondWithResult(_0x5bfc4d,null))[_0xbf4e('0x3d')](handleError(_0x5bfc4d,null));};exports[_0xbf4e('0x41')]=function(_0x1833c1,_0x32bed6){return db[_0xbf4e('0x28')][_0xbf4e('0x41')](_0x1833c1[_0xbf4e('0x42')],{})[_0xbf4e('0x22')](respondWithResult(_0x32bed6,0xc9))[_0xbf4e('0x3d')](handleError(_0x32bed6,null));};exports[_0xbf4e('0x21')]=function(_0x2fdba9,_0x6fd78d){if(_0x2fdba9[_0xbf4e('0x42')]['id']){delete _0x2fdba9[_0xbf4e('0x42')]['id'];}return db[_0xbf4e('0x28')][_0xbf4e('0x40')]({'where':{'id':_0x2fdba9[_0xbf4e('0x3f')]['id']}})['then'](handleEntityNotFound(_0x6fd78d,null))[_0xbf4e('0x22')](saveUpdates(_0x2fdba9[_0xbf4e('0x42')],null))[_0xbf4e('0x22')](respondWithResult(_0x6fd78d,null))['catch'](handleError(_0x6fd78d,null));};exports[_0xbf4e('0x23')]=function(_0x5ed838,_0x4a050e){return db[_0xbf4e('0x28')][_0xbf4e('0x40')]({'where':{'id':_0x5ed838['params']['id']}})[_0xbf4e('0x22')](handleEntityNotFound(_0x4a050e,null))[_0xbf4e('0x22')](removeEntity(_0x4a050e,null))[_0xbf4e('0x3d')](handleError(_0x4a050e,null));};exports[_0xbf4e('0x43')]=function(_0x42eef6,_0x2ac2c8,_0x419969){var _0x1cdd8c={};var _0x3cd61b={};var _0xc058e1;var _0x271ad2;return db['ZendeskAccount']['findOne']({'where':{'id':_0x42eef6[_0xbf4e('0x3f')]['id']}})[_0xbf4e('0x22')](handleEntityNotFound(_0x2ac2c8,null))[_0xbf4e('0x22')](function(_0x586f5d){if(_0x586f5d){_0xc058e1=_0x586f5d;_0x3cd61b[_0xbf4e('0x2c')]=_[_0xbf4e('0x2e')](db['ZendeskConfiguration']['rawAttributes']);_0x3cd61b[_0xbf4e('0x2d')]=_['keys'](_0x42eef6['query']);_0x3cd61b[_0xbf4e('0x2f')]=_[_0xbf4e('0x30')](_0x3cd61b[_0xbf4e('0x2c')],_0x3cd61b[_0xbf4e('0x2d')]);_0x1cdd8c[_0xbf4e('0x32')]=_['intersection'](_0x3cd61b[_0xbf4e('0x2c')],qs['fields'](_0x42eef6[_0xbf4e('0x2d')]['fields']));_0x1cdd8c[_0xbf4e('0x32')]=_0x1cdd8c['attributes'][_0xbf4e('0x33')]?_0x1cdd8c[_0xbf4e('0x32')]:_0x3cd61b[_0xbf4e('0x2c')];_0x1cdd8c[_0xbf4e('0x44')]=qs[_0xbf4e('0x35')](_0x42eef6['query']['sort']);_0x1cdd8c['where']=qs['filters'](_[_0xbf4e('0x37')](_0x42eef6[_0xbf4e('0x2d')],_0x3cd61b['filters']));if(_0x42eef6[_0xbf4e('0x2d')][_0xbf4e('0x39')]){_0x1cdd8c[_0xbf4e('0x36')]=_[_0xbf4e('0x38')](_0x1cdd8c[_0xbf4e('0x36')],{'$or':_[_0xbf4e('0x27')](_0x1cdd8c[_0xbf4e('0x32')],function(_0x48682c){var _0x25c254={};_0x25c254[_0x48682c]={'$like':'%'+_0x42eef6[_0xbf4e('0x2d')][_0xbf4e('0x39')]+'%'};return _0x25c254;})});}_0x1cdd8c=_['merge']({},_0x1cdd8c,_0x42eef6['options']);return _0xc058e1[_0xbf4e('0x43')](_0x1cdd8c);}})[_0xbf4e('0x22')](function(_0x2e8a62){if(_0x2e8a62){_0x271ad2=_0x2e8a62['length'];if(!_0x42eef6[_0xbf4e('0x2d')][_0xbf4e('0x34')](_0xbf4e('0x45'))){_0x1cdd8c[_0xbf4e('0x1a')]=qs[_0xbf4e('0x1a')](_0x42eef6[_0xbf4e('0x2d')][_0xbf4e('0x1a')]);_0x1cdd8c[_0xbf4e('0x18')]=qs[_0xbf4e('0x18')](_0x42eef6[_0xbf4e('0x2d')][_0xbf4e('0x18')]);}return _0xc058e1[_0xbf4e('0x43')](_0x1cdd8c);}})['then'](function(_0x21cbd2){if(_0x21cbd2){return _0x21cbd2?{'count':_0x271ad2,'rows':_0x21cbd2}:null;}})['then'](respondWithResult(_0x2ac2c8,null))[_0xbf4e('0x3d')](handleError(_0x2ac2c8,null));};exports[_0xbf4e('0x46')]=function(_0x400fa5,_0x180b13,_0x2080ec){if(_0x400fa5[_0xbf4e('0x42')]['id']){delete _0x400fa5[_0xbf4e('0x42')]['id'];}return db[_0xbf4e('0x28')]['findOne']({'where':{'id':_0x400fa5[_0xbf4e('0x3f')]['id']}})[_0xbf4e('0x22')](handleEntityNotFound(_0x180b13,null))[_0xbf4e('0x22')](function(_0x33f9c4){if(_0x33f9c4){_0x400fa5[_0xbf4e('0x42')]['AccountId']=_0x33f9c4['id'];_0x400fa5[_0xbf4e('0x42')][_0xbf4e('0x47')]=integrations[_0xbf4e('0x48')](_0x400fa5[_0xbf4e('0x42')][_0xbf4e('0x49')],_0x400fa5[_0xbf4e('0x42')]['type']);_0x400fa5[_0xbf4e('0x42')]['Descriptions']=integrations[_0xbf4e('0x4a')](_0x400fa5[_0xbf4e('0x42')][_0xbf4e('0x49')],_0x400fa5[_0xbf4e('0x42')]['type']);return db[_0xbf4e('0x4b')]['create'](_0x400fa5['body'],{'include':[{'model':db[_0xbf4e('0x4c')],'as':_0xbf4e('0x47')},{'model':db[_0xbf4e('0x4c')],'as':'Descriptions'}]});}return null;})[_0xbf4e('0x22')](respondWithResult(_0x180b13,null))[_0xbf4e('0x3d')](handleError(_0x180b13,null));};exports['getFields']=function(_0x19c5b4,_0x42df5f,_0x4405b9){var _0x137224='';return db[_0xbf4e('0x28')][_0xbf4e('0x4d')]({'where':{'id':_0x19c5b4[_0xbf4e('0x3f')]['id']},'attributes':['id',_0xbf4e('0x4e'),_0xbf4e('0x4f'),'token',_0xbf4e('0x50'),_0xbf4e('0x51')]})[_0xbf4e('0x22')](handleEntityNotFound(_0x42df5f,null))[_0xbf4e('0x22')](function(_0x54f450){if(_0x54f450){_0x137224=_0x54f450[_0xbf4e('0x51')];var _0x667836=_0x137224[_0xbf4e('0x52')](-0x1);if(_0x667836==='/'){_0x137224=_0x137224[_0xbf4e('0x53')](0x0,_0x137224[_0xbf4e('0x54')](_0x667836));}var _0x3448f5={'method':_0xbf4e('0x55'),'uri':util[_0xbf4e('0x56')](_0xbf4e('0x57'),_0x137224,'ticket_fields'),'json':!![]};switch(_0x54f450[_0xbf4e('0x50')]){case'password':_0x3448f5[_0xbf4e('0x58')]={'Authorization':util[_0xbf4e('0x56')](_0xbf4e('0x59'),new Buffer(util[_0xbf4e('0x56')](_0xbf4e('0x5a'),_0x54f450['username'],_0x54f450[_0xbf4e('0x4f')]))[_0xbf4e('0x5b')](_0xbf4e('0x5c')))};break;case'token':_0x3448f5[_0xbf4e('0x58')]={'Authorization':util[_0xbf4e('0x56')](_0xbf4e('0x59'),new Buffer(util['format'](_0xbf4e('0x5d'),_0x54f450[_0xbf4e('0x4e')],_0x54f450[_0xbf4e('0x5e')]))[_0xbf4e('0x5b')](_0xbf4e('0x5c')))};break;default:throw new db['Sequelize'][(_0xbf4e('0x5f'))]('Unknown\x20authentication\x20type');}return rp(_0x3448f5);}})[_0xbf4e('0x22')](function(_0x504723){if(_0x504723){var _0x19a7e9=['subject',_0xbf4e('0x60'),'group',_0xbf4e('0x61')];_[_0xbf4e('0x62')](_0x504723[_0xbf4e('0x63')],function(_0x23de82){return _0x19a7e9[_0xbf4e('0x64')](_0x23de82[_0xbf4e('0x2a')]);});return{'count':_0x504723[_0xbf4e('0x63')]['length'],'rows':_[_0xbf4e('0x27')](_0x504723[_0xbf4e('0x63')],function(_0x2a242b){return{'id':_0x2a242b['id'],'name':_0x2a242b[_0xbf4e('0x65')]>0x7?_0x2a242b[_0xbf4e('0x66')]:_0x2a242b[_0xbf4e('0x2a')],'custom':_0x2a242b['position']>0x7?!![]:![],'options':_0x2a242b[_0xbf4e('0x67')]?_0x2a242b[_0xbf4e('0x67')]:_0x2a242b['custom_field_options']?_0x2a242b[_0xbf4e('0x68')]:[]};})};}})[_0xbf4e('0x22')](respondWithResult(_0x42df5f,null))[_0xbf4e('0x3d')](function(_0xb6d122){var _0x19ec7e=_0x19c5b4[_0xbf4e('0x2d')][_0xbf4e('0x69')]?0x1f4:_0xb6d122[_0xbf4e('0x6a')]||0x1f4;logger[_0xbf4e('0x6b')]('getFields,\x20%s,\x20%s,\x20%s',_0xbf4e('0x6c'),_0x19ec7e,JSON[_0xbf4e('0x6d')](_0xb6d122));delete _0xb6d122[_0xbf4e('0x25')];if(_0x19ec7e===0x191){_0x19ec7e=0x190;}_0x42df5f['status'](_0x19ec7e)[_0xbf4e('0x6e')](_0x19c5b4[_0xbf4e('0x2d')]['test']?{'message':_0xbf4e('0x6f'),'statusCode':_0xb6d122[_0xbf4e('0x6a')]}:_0xb6d122);});}; \ No newline at end of file +var _0xd4f4=['base64','%s/token:%s','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','group','remove','includes','position','title','system_field_options','custom_field_options','test','send','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','apply','reject','save','then','sendStatus','stack','name','index','map','ZendeskAccount','rawAttributes','type','key','model','keys','filters','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','rows','catch','intersection','includeAll','find','create','update','body','params','destroy','findOne','ZendeskConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','getFields','password','token','authType','remoteUri','slice','GET','%s/%s','ticket_fields','headers','format','Basic\x20%s','%s:%s','username','toString'];(function(_0x2f1525,_0x53c73b){var _0x31390b=function(_0x294f85){while(--_0x294f85){_0x2f1525['push'](_0x2f1525['shift']());}};_0x31390b(++_0x53c73b);}(_0xd4f4,0x8b));var _0x4d4f=function(_0x3c4e47,_0x47ee91){_0x3c4e47=_0x3c4e47-0x0;var _0x274fb6=_0xd4f4[_0x3c4e47];return _0x274fb6;};'use strict';var emlformat=require(_0x4d4f('0x0'));var rimraf=require(_0x4d4f('0x1'));var zipdir=require(_0x4d4f('0x2'));var jsonpatch=require(_0x4d4f('0x3'));var rp=require(_0x4d4f('0x4'));var moment=require(_0x4d4f('0x5'));var BPromise=require(_0x4d4f('0x6'));var Mustache=require(_0x4d4f('0x7'));var util=require(_0x4d4f('0x8'));var path=require(_0x4d4f('0x9'));var sox=require(_0x4d4f('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4d4f('0xb'));var squel=require(_0x4d4f('0xc'));var crypto=require(_0x4d4f('0xd'));var jsforce=require(_0x4d4f('0xe'));var deskjs=require(_0x4d4f('0xf'));var toCsv=require(_0x4d4f('0x10'));var querystring=require(_0x4d4f('0x11'));var Papa=require(_0x4d4f('0x12'));var Redis=require(_0x4d4f('0x13'));var authService=require(_0x4d4f('0x14'));var qs=require(_0x4d4f('0x15'));var as=require(_0x4d4f('0x16'));var hardwareService=require(_0x4d4f('0x17'));var logger=require(_0x4d4f('0x18'))(_0x4d4f('0x19'));var utils=require(_0x4d4f('0x1a'));var config=require(_0x4d4f('0x1b'));var licenseUtil=require(_0x4d4f('0x1c'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5b4f4e,_0x15fe6a){_0x15fe6a=_0x15fe6a||0xcc;return function(_0xe9b7a6){if(_0xe9b7a6){return _0x5b4f4e['sendStatus'](_0x15fe6a);}return _0x5b4f4e[_0x4d4f('0x1d')](_0x15fe6a)[_0x4d4f('0x1e')]();};}function respondWithResult(_0x1878b6,_0x59252c){_0x59252c=_0x59252c||0xc8;return function(_0x145804){if(_0x145804){return _0x1878b6[_0x4d4f('0x1d')](_0x59252c)[_0x4d4f('0x1f')](_0x145804);}};}function respondWithFilteredResult(_0x4a3364,_0x59bfb5){return function(_0x5e4ff5){if(_0x5e4ff5){var _0x18a528=typeof _0x59bfb5[_0x4d4f('0x20')]===_0x4d4f('0x21')&&typeof _0x59bfb5['limit']===_0x4d4f('0x21');var _0x17a437=_0x5e4ff5['count'];var _0x5dbbeb=_0x18a528?0x0:_0x59bfb5['offset'];var _0x5a58af=_0x18a528?_0x5e4ff5['count']:_0x59bfb5[_0x4d4f('0x20')]+_0x59bfb5[_0x4d4f('0x22')];var _0x433222;if(_0x5a58af>=_0x17a437){_0x5a58af=_0x17a437;_0x433222=0xc8;}else{_0x433222=0xce;}_0x4a3364[_0x4d4f('0x1d')](_0x433222);return _0x4a3364['set']('Content-Range',_0x5dbbeb+'-'+_0x5a58af+'/'+_0x17a437)[_0x4d4f('0x1f')](_0x5e4ff5);}return null;};}function patchUpdates(_0x4dd360){return function(_0x34a232){try{jsonpatch[_0x4d4f('0x23')](_0x34a232,_0x4dd360,!![]);}catch(_0x3d1e38){return BPromise[_0x4d4f('0x24')](_0x3d1e38);}return _0x34a232[_0x4d4f('0x25')]();};}function saveUpdates(_0x5beab4,_0x570520){return function(_0x4043f2){if(_0x4043f2){return _0x4043f2['update'](_0x5beab4)[_0x4d4f('0x26')](function(_0x3d5d93){return _0x3d5d93;});}return null;};}function removeEntity(_0x2d2fb3,_0x3f4a55){return function(_0xf3f7a4){if(_0xf3f7a4){return _0xf3f7a4['destroy']()[_0x4d4f('0x26')](function(){_0x2d2fb3[_0x4d4f('0x1d')](0xcc)[_0x4d4f('0x1e')]();});}};}function handleEntityNotFound(_0x28443b,_0x5cf9e7){return function(_0x51a7c5){if(!_0x51a7c5){_0x28443b[_0x4d4f('0x27')](0x194);}return _0x51a7c5;};}function handleError(_0xd51604,_0xa2492c){_0xa2492c=_0xa2492c||0x1f4;return function(_0x1f79f9){logger['error'](_0x1f79f9[_0x4d4f('0x28')]);if(_0x1f79f9[_0x4d4f('0x29')]){delete _0x1f79f9[_0x4d4f('0x29')];}_0xd51604[_0x4d4f('0x1d')](_0xa2492c)['send'](_0x1f79f9);};}exports[_0x4d4f('0x2a')]=function(_0x51cb3d,_0x1688bb){var _0x333a40={},_0x550040={},_0x2768f1={'count':0x0,'rows':[]};var _0x123383=_[_0x4d4f('0x2b')](db[_0x4d4f('0x2c')][_0x4d4f('0x2d')],function(_0x43a704){return{'name':_0x43a704['fieldName'],'type':_0x43a704[_0x4d4f('0x2e')][_0x4d4f('0x2f')]};});_0x550040[_0x4d4f('0x30')]=_[_0x4d4f('0x2b')](_0x123383,_0x4d4f('0x29'));_0x550040['query']=_[_0x4d4f('0x31')](_0x51cb3d['query']);_0x550040[_0x4d4f('0x32')]=_['intersection'](_0x550040['model'],_0x550040['query']);_0x333a40[_0x4d4f('0x33')]=_['intersection'](_0x550040[_0x4d4f('0x30')],qs[_0x4d4f('0x34')](_0x51cb3d[_0x4d4f('0x35')]['fields']));_0x333a40[_0x4d4f('0x33')]=_0x333a40[_0x4d4f('0x33')][_0x4d4f('0x36')]?_0x333a40['attributes']:_0x550040[_0x4d4f('0x30')];if(!_0x51cb3d['query'][_0x4d4f('0x37')](_0x4d4f('0x38'))){_0x333a40[_0x4d4f('0x22')]=qs[_0x4d4f('0x22')](_0x51cb3d[_0x4d4f('0x35')][_0x4d4f('0x22')]);_0x333a40[_0x4d4f('0x20')]=qs[_0x4d4f('0x20')](_0x51cb3d['query']['offset']);}_0x333a40[_0x4d4f('0x39')]=qs['sort'](_0x51cb3d['query'][_0x4d4f('0x3a')]);_0x333a40[_0x4d4f('0x3b')]=qs[_0x4d4f('0x32')](_[_0x4d4f('0x3c')](_0x51cb3d[_0x4d4f('0x35')],_0x550040['filters']),_0x123383);if(_0x51cb3d[_0x4d4f('0x35')][_0x4d4f('0x3d')]){_0x333a40['where']=_[_0x4d4f('0x3e')](_0x333a40[_0x4d4f('0x3b')],{'$or':_[_0x4d4f('0x2b')](_0x123383,function(_0x42f9ed){if(_0x42f9ed[_0x4d4f('0x2e')]!==_0x4d4f('0x3f')){var _0x20290e={};_0x20290e[_0x42f9ed[_0x4d4f('0x29')]]={'$like':'%'+_0x51cb3d[_0x4d4f('0x35')]['filter']+'%'};return _0x20290e;}})});}_0x333a40=_['merge']({},_0x333a40,_0x51cb3d[_0x4d4f('0x40')]);var _0x324a3c={'where':_0x333a40[_0x4d4f('0x3b')]};return db[_0x4d4f('0x2c')]['count'](_0x324a3c)['then'](function(_0x3afb4c){_0x2768f1[_0x4d4f('0x41')]=_0x3afb4c;if(_0x51cb3d['query']['includeAll']){_0x333a40[_0x4d4f('0x42')]=[{'all':!![]}];}return db[_0x4d4f('0x2c')]['findAll'](_0x333a40);})[_0x4d4f('0x26')](function(_0x330bca){_0x2768f1[_0x4d4f('0x43')]=_0x330bca;return _0x2768f1;})[_0x4d4f('0x26')](respondWithFilteredResult(_0x1688bb,_0x333a40))[_0x4d4f('0x44')](handleError(_0x1688bb,null));};exports['show']=function(_0x2b274e,_0x4c7c24){var _0x45a0c1={'raw':![],'where':{'id':_0x2b274e['params']['id']}},_0x5e4839={};_0x5e4839[_0x4d4f('0x30')]=_[_0x4d4f('0x31')](db[_0x4d4f('0x2c')]['rawAttributes']);_0x5e4839[_0x4d4f('0x35')]=_['keys'](_0x2b274e[_0x4d4f('0x35')]);_0x5e4839['filters']=_[_0x4d4f('0x45')](_0x5e4839[_0x4d4f('0x30')],_0x5e4839[_0x4d4f('0x35')]);_0x45a0c1[_0x4d4f('0x33')]=_[_0x4d4f('0x45')](_0x5e4839['model'],qs['fields'](_0x2b274e[_0x4d4f('0x35')][_0x4d4f('0x34')]));_0x45a0c1[_0x4d4f('0x33')]=_0x45a0c1[_0x4d4f('0x33')]['length']?_0x45a0c1['attributes']:_0x5e4839['model'];if(_0x2b274e[_0x4d4f('0x35')][_0x4d4f('0x46')]){_0x45a0c1[_0x4d4f('0x42')]=[{'all':!![]}];}_0x45a0c1=_[_0x4d4f('0x3e')]({},_0x45a0c1,_0x2b274e[_0x4d4f('0x40')]);return db[_0x4d4f('0x2c')][_0x4d4f('0x47')](_0x45a0c1)[_0x4d4f('0x26')](handleEntityNotFound(_0x4c7c24,null))[_0x4d4f('0x26')](respondWithResult(_0x4c7c24,null))[_0x4d4f('0x44')](handleError(_0x4c7c24,null));};exports[_0x4d4f('0x48')]=function(_0x1c290b,_0x5c7a41){return db[_0x4d4f('0x2c')][_0x4d4f('0x48')](_0x1c290b['body'],{})[_0x4d4f('0x26')](respondWithResult(_0x5c7a41,0xc9))['catch'](handleError(_0x5c7a41,null));};exports[_0x4d4f('0x49')]=function(_0x401466,_0x50a3b3){if(_0x401466[_0x4d4f('0x4a')]['id']){delete _0x401466[_0x4d4f('0x4a')]['id'];}return db[_0x4d4f('0x2c')][_0x4d4f('0x47')]({'where':{'id':_0x401466[_0x4d4f('0x4b')]['id']}})[_0x4d4f('0x26')](handleEntityNotFound(_0x50a3b3,null))[_0x4d4f('0x26')](saveUpdates(_0x401466[_0x4d4f('0x4a')],null))[_0x4d4f('0x26')](respondWithResult(_0x50a3b3,null))[_0x4d4f('0x44')](handleError(_0x50a3b3,null));};exports[_0x4d4f('0x4c')]=function(_0x3a21a6,_0x504d85){return db[_0x4d4f('0x2c')]['find']({'where':{'id':_0x3a21a6['params']['id']}})['then'](handleEntityNotFound(_0x504d85,null))[_0x4d4f('0x26')](removeEntity(_0x504d85,null))[_0x4d4f('0x44')](handleError(_0x504d85,null));};exports['getConfigurations']=function(_0x5f3252,_0x2a3bc4,_0x4c80c4){var _0x5adc7b={};var _0x3191b1={};var _0x528573;var _0x17b59e;return db[_0x4d4f('0x2c')][_0x4d4f('0x4d')]({'where':{'id':_0x5f3252[_0x4d4f('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2a3bc4,null))[_0x4d4f('0x26')](function(_0x2008c3){if(_0x2008c3){_0x528573=_0x2008c3;_0x3191b1[_0x4d4f('0x30')]=_[_0x4d4f('0x31')](db[_0x4d4f('0x4e')]['rawAttributes']);_0x3191b1[_0x4d4f('0x35')]=_['keys'](_0x5f3252[_0x4d4f('0x35')]);_0x3191b1['filters']=_[_0x4d4f('0x45')](_0x3191b1[_0x4d4f('0x30')],_0x3191b1['query']);_0x5adc7b[_0x4d4f('0x33')]=_[_0x4d4f('0x45')](_0x3191b1['model'],qs[_0x4d4f('0x34')](_0x5f3252['query'][_0x4d4f('0x34')]));_0x5adc7b['attributes']=_0x5adc7b['attributes'][_0x4d4f('0x36')]?_0x5adc7b[_0x4d4f('0x33')]:_0x3191b1[_0x4d4f('0x30')];_0x5adc7b[_0x4d4f('0x39')]=qs[_0x4d4f('0x3a')](_0x5f3252['query']['sort']);_0x5adc7b[_0x4d4f('0x3b')]=qs['filters'](_[_0x4d4f('0x3c')](_0x5f3252[_0x4d4f('0x35')],_0x3191b1[_0x4d4f('0x32')]));if(_0x5f3252[_0x4d4f('0x35')][_0x4d4f('0x3d')]){_0x5adc7b[_0x4d4f('0x3b')]=_['merge'](_0x5adc7b[_0x4d4f('0x3b')],{'$or':_[_0x4d4f('0x2b')](_0x5adc7b[_0x4d4f('0x33')],function(_0x4bb7ac){var _0x2011aa={};_0x2011aa[_0x4bb7ac]={'$like':'%'+_0x5f3252[_0x4d4f('0x35')][_0x4d4f('0x3d')]+'%'};return _0x2011aa;})});}_0x5adc7b=_['merge']({},_0x5adc7b,_0x5f3252[_0x4d4f('0x40')]);return _0x528573['getConfigurations'](_0x5adc7b);}})[_0x4d4f('0x26')](function(_0x2145ca){if(_0x2145ca){_0x17b59e=_0x2145ca[_0x4d4f('0x36')];if(!_0x5f3252[_0x4d4f('0x35')][_0x4d4f('0x37')](_0x4d4f('0x38'))){_0x5adc7b[_0x4d4f('0x22')]=qs[_0x4d4f('0x22')](_0x5f3252[_0x4d4f('0x35')]['limit']);_0x5adc7b[_0x4d4f('0x20')]=qs[_0x4d4f('0x20')](_0x5f3252['query'][_0x4d4f('0x20')]);}return _0x528573[_0x4d4f('0x4f')](_0x5adc7b);}})[_0x4d4f('0x26')](function(_0xae8fe){if(_0xae8fe){return _0xae8fe?{'count':_0x17b59e,'rows':_0xae8fe}:null;}})['then'](respondWithResult(_0x2a3bc4,null))[_0x4d4f('0x44')](handleError(_0x2a3bc4,null));};exports[_0x4d4f('0x50')]=function(_0x5995f2,_0x4d979a,_0x55552d){if(_0x5995f2[_0x4d4f('0x4a')]['id']){delete _0x5995f2['body']['id'];}return db['ZendeskAccount']['findOne']({'where':{'id':_0x5995f2[_0x4d4f('0x4b')]['id']}})[_0x4d4f('0x26')](handleEntityNotFound(_0x4d979a,null))['then'](function(_0x347bb1){if(_0x347bb1){_0x5995f2[_0x4d4f('0x4a')][_0x4d4f('0x51')]=_0x347bb1['id'];_0x5995f2[_0x4d4f('0x4a')][_0x4d4f('0x52')]=integrations[_0x4d4f('0x53')](_0x5995f2[_0x4d4f('0x4a')][_0x4d4f('0x54')],_0x5995f2['body'][_0x4d4f('0x2e')]);_0x5995f2['body'][_0x4d4f('0x55')]=integrations[_0x4d4f('0x56')](_0x5995f2[_0x4d4f('0x4a')]['channel'],_0x5995f2[_0x4d4f('0x4a')][_0x4d4f('0x2e')]);return db[_0x4d4f('0x4e')][_0x4d4f('0x48')](_0x5995f2['body'],{'include':[{'model':db[_0x4d4f('0x57')],'as':'Subjects'},{'model':db[_0x4d4f('0x57')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x4d979a,null))[_0x4d4f('0x44')](handleError(_0x4d979a,null));};exports[_0x4d4f('0x58')]=function(_0x5dd9ff,_0x3ade3d,_0x53a18b){var _0x41ffe7='';return db[_0x4d4f('0x2c')][_0x4d4f('0x4d')]({'where':{'id':_0x5dd9ff[_0x4d4f('0x4b')]['id']},'attributes':['id','username',_0x4d4f('0x59'),_0x4d4f('0x5a'),_0x4d4f('0x5b'),'remoteUri']})[_0x4d4f('0x26')](handleEntityNotFound(_0x3ade3d,null))[_0x4d4f('0x26')](function(_0x21046c){if(_0x21046c){_0x41ffe7=_0x21046c[_0x4d4f('0x5c')];var _0x3c5aee=_0x41ffe7[_0x4d4f('0x5d')](-0x1);if(_0x3c5aee==='/'){_0x41ffe7=_0x41ffe7['substring'](0x0,_0x41ffe7['lastIndexOf'](_0x3c5aee));}var _0x2ce3ce={'method':_0x4d4f('0x5e'),'uri':util['format'](_0x4d4f('0x5f'),_0x41ffe7,_0x4d4f('0x60')),'json':!![]};switch(_0x21046c[_0x4d4f('0x5b')]){case _0x4d4f('0x59'):_0x2ce3ce[_0x4d4f('0x61')]={'Authorization':util[_0x4d4f('0x62')](_0x4d4f('0x63'),new Buffer(util[_0x4d4f('0x62')](_0x4d4f('0x64'),_0x21046c[_0x4d4f('0x65')],_0x21046c[_0x4d4f('0x59')]))[_0x4d4f('0x66')](_0x4d4f('0x67')))};break;case _0x4d4f('0x5a'):_0x2ce3ce[_0x4d4f('0x61')]={'Authorization':util['format'](_0x4d4f('0x63'),new Buffer(util[_0x4d4f('0x62')](_0x4d4f('0x68'),_0x21046c[_0x4d4f('0x65')],_0x21046c['token']))['toString'](_0x4d4f('0x67')))};break;default:throw new db[(_0x4d4f('0x69'))][(_0x4d4f('0x6a'))](_0x4d4f('0x6b'));}return rp(_0x2ce3ce);}})[_0x4d4f('0x26')](function(_0x2876b5){if(_0x2876b5){var _0x19a8fb=[_0x4d4f('0x6c'),_0x4d4f('0x6d'),_0x4d4f('0x6e'),'assignee'];_[_0x4d4f('0x6f')](_0x2876b5[_0x4d4f('0x60')],function(_0x101a0a){return _0x19a8fb[_0x4d4f('0x70')](_0x101a0a['type']);});return{'count':_0x2876b5['ticket_fields']['length'],'rows':_[_0x4d4f('0x2b')](_0x2876b5['ticket_fields'],function(_0x3e592b){return{'id':_0x3e592b['id'],'name':_0x3e592b[_0x4d4f('0x71')]>0x7?_0x3e592b[_0x4d4f('0x72')]:_0x3e592b[_0x4d4f('0x2e')],'custom':_0x3e592b[_0x4d4f('0x71')]>0x7?!![]:![],'options':_0x3e592b[_0x4d4f('0x73')]?_0x3e592b[_0x4d4f('0x73')]:_0x3e592b[_0x4d4f('0x74')]?_0x3e592b['custom_field_options']:[]};})};}})['then'](respondWithResult(_0x3ade3d,null))[_0x4d4f('0x44')](function(_0x59a813){var _0x3a81b7=_0x5dd9ff[_0x4d4f('0x35')][_0x4d4f('0x75')]?0x1f4:_0x59a813['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x4d4f('0x58'),_0x3a81b7,JSON['stringify'](_0x59a813));delete _0x59a813[_0x4d4f('0x29')];if(_0x3a81b7===0x191){_0x3a81b7=0x190;}_0x3ade3d['status'](_0x3a81b7)[_0x4d4f('0x76')](_0x5dd9ff[_0x4d4f('0x35')][_0x4d4f('0x75')]?{'message':_0x4d4f('0x77'),'statusCode':_0x59a813[_0x4d4f('0x78')]}:_0x59a813);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 2df7f78..3b44a93 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 _0xe98b=['bluebird','request-promise','path','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','ZendeskAccount','lodash','util','api','moment'];(function(_0x308213,_0x224541){var _0x2e1619=function(_0x972b51){while(--_0x972b51){_0x308213['push'](_0x308213['shift']());}};_0x2e1619(++_0x224541);}(_0xe98b,0x140));var _0xbe98=function(_0x4ea1f1,_0x4700d9){_0x4ea1f1=_0x4ea1f1-0x0;var _0x42367c=_0xe98b[_0x4ea1f1];return _0x42367c;};'use strict';var _=require(_0xbe98('0x0'));var util=require(_0xbe98('0x1'));var logger=require('../../config/logger')(_0xbe98('0x2'));var moment=require(_0xbe98('0x3'));var BPromise=require(_0xbe98('0x4'));var rp=require(_0xbe98('0x5'));var fs=require('fs');var path=require(_0xbe98('0x6'));var rimraf=require('rimraf');var config=require(_0xbe98('0x7'));var attributes=require(_0xbe98('0x8'));var integrations=require(_0xbe98('0x9'));module[_0xbe98('0xa')]=function(_0x131934,_0x5f0d58){return _0x131934['define'](_0xbe98('0xb'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2ac0=['lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','../../components/integrations/configuration','exports','define','ZendeskAccount'];(function(_0x94030f,_0x476ed2){var _0x9f7747=function(_0x2b977a){while(--_0x2b977a){_0x94030f['push'](_0x94030f['shift']());}};_0x9f7747(++_0x476ed2);}(_0x2ac0,0xcc));var _0x02ac=function(_0x578d64,_0x15da79){_0x578d64=_0x578d64-0x0;var _0x8b4e42=_0x2ac0[_0x578d64];return _0x8b4e42;};'use strict';var _=require(_0x02ac('0x0'));var util=require(_0x02ac('0x1'));var logger=require(_0x02ac('0x2'))(_0x02ac('0x3'));var moment=require(_0x02ac('0x4'));var BPromise=require(_0x02ac('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x02ac('0x6'));var rimraf=require('rimraf');var config=require(_0x02ac('0x7'));var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0x02ac('0x8'));module[_0x02ac('0x9')]=function(_0x1ffdd4,_0x4d3d24){return _0x1ffdd4[_0x02ac('0xa')](_0x02ac('0xb'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index 3c32c7b..00d0f3a 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 _0x76cc=['ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetZendeskAccount','ZendeskAccount','options','raw','attributes','include','map','model','catch','ShowZendeskAccount','find','where','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x482b83,_0x270c4e){var _0x2f51ab=function(_0x16e756){while(--_0x16e756){_0x482b83['push'](_0x482b83['shift']());}};_0x2f51ab(++_0x270c4e);}(_0x76cc,0x7e));var _0xc76c=function(_0x1576a6,_0x32e5e0){_0x1576a6=_0x1576a6-0x0;var _0x43d079=_0x76cc[_0x1576a6];return _0x43d079;};'use strict';var _=require(_0xc76c('0x0'));var util=require(_0xc76c('0x1'));var moment=require('moment');var BPromise=require(_0xc76c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc76c('0x3'));var db=require(_0xc76c('0x4'))['db'];var utils=require(_0xc76c('0x5'));var logger=require(_0xc76c('0x6'))(_0xc76c('0x7'));var config=require(_0xc76c('0x8'));var jayson=require(_0xc76c('0x9'));var client=jayson[_0xc76c('0xa')][_0xc76c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1e7674,_0x583e5c,_0x237a46){return new BPromise(function(_0x43cc4e,_0xbc9cde){return client[_0xc76c('0xc')](_0x1e7674,_0x237a46)[_0xc76c('0xd')](function(_0x48c706){logger[_0xc76c('0xe')](_0xc76c('0xf'),_0x583e5c,_0xc76c('0x10'));logger[_0xc76c('0x11')](_0xc76c('0x12'),_0x583e5c,_0xc76c('0x10'),JSON[_0xc76c('0x13')](_0x48c706));if(_0x48c706[_0xc76c('0x14')]){if(_0x48c706['error'][_0xc76c('0x15')]===0x1f4){logger[_0xc76c('0x14')](_0xc76c('0xf'),_0x583e5c,_0x48c706['error'][_0xc76c('0x16')]);return _0xbc9cde(_0x48c706[_0xc76c('0x14')][_0xc76c('0x16')]);}logger[_0xc76c('0x14')](_0xc76c('0xf'),_0x583e5c,_0x48c706[_0xc76c('0x14')][_0xc76c('0x16')]);return _0x43cc4e(_0x48c706[_0xc76c('0x14')][_0xc76c('0x16')]);}else{logger[_0xc76c('0xe')]('ZendeskAccount,\x20%s,\x20%s',_0x583e5c,_0xc76c('0x10'));_0x43cc4e(_0x48c706[_0xc76c('0x17')][_0xc76c('0x16')]);}})['catch'](function(_0x5e7c2e){logger[_0xc76c('0x14')]('ZendeskAccount,\x20%s,\x20%s',_0x583e5c,_0x5e7c2e);_0xbc9cde(_0x5e7c2e);});});}exports[_0xc76c('0x18')]=function(_0x535c0f){var _0x5e7473=this;return new Promise(function(_0x18f159,_0xf851ac){return db[_0xc76c('0x19')]['findAll']({'raw':_0x535c0f[_0xc76c('0x1a')]?_0x535c0f['options'][_0xc76c('0x1b')]===undefined?!![]:![]:!![],'where':_0x535c0f[_0xc76c('0x1a')]?_0x535c0f[_0xc76c('0x1a')]['where']||null:null,'attributes':_0x535c0f[_0xc76c('0x1a')]?_0x535c0f['options'][_0xc76c('0x1c')]||null:null,'limit':_0x535c0f[_0xc76c('0x1a')]?_0x535c0f[_0xc76c('0x1a')]['limit']||null:null,'include':_0x535c0f['options']?_0x535c0f[_0xc76c('0x1a')][_0xc76c('0x1d')]?_[_0xc76c('0x1e')](_0x535c0f[_0xc76c('0x1a')][_0xc76c('0x1d')],function(_0x52cd9b){return{'model':db[_0x52cd9b[_0xc76c('0x1f')]],'as':_0x52cd9b['as'],'attributes':_0x52cd9b['attributes'],'include':_0x52cd9b[_0xc76c('0x1d')]?_[_0xc76c('0x1e')](_0x52cd9b['include'],function(_0x3772d4){return{'model':db[_0x3772d4['model']],'as':_0x3772d4['as'],'attributes':_0x3772d4[_0xc76c('0x1c')],'include':_0x3772d4[_0xc76c('0x1d')]?_['map'](_0x3772d4[_0xc76c('0x1d')],function(_0x5bf463){return{'model':db[_0x5bf463[_0xc76c('0x1f')]],'as':_0x5bf463['as'],'attributes':_0x5bf463['attributes']};}):[]};}):[]};}):[]:[]})[_0xc76c('0xd')](function(_0x407d8a){logger[_0xc76c('0xe')](_0xc76c('0x18'),_0x535c0f);logger[_0xc76c('0x11')](_0xc76c('0x18'),_0x535c0f,JSON['stringify'](_0x407d8a));_0x18f159(_0x407d8a);})[_0xc76c('0x20')](function(_0x36bbe3){logger[_0xc76c('0x14')]('GetZendeskAccount',_0x36bbe3[_0xc76c('0x16')],_0x535c0f);_0xf851ac(_0x5e7473[_0xc76c('0x14')](0x1f4,_0x36bbe3[_0xc76c('0x16')]));});});};exports[_0xc76c('0x21')]=function(_0x1a9672){var _0x1a74cf=this;return new Promise(function(_0x499627,_0x1716af){return db['ZendeskAccount'][_0xc76c('0x22')]({'raw':_0x1a9672[_0xc76c('0x1a')]?_0x1a9672[_0xc76c('0x1a')][_0xc76c('0x1b')]===undefined?!![]:![]:!![],'where':_0x1a9672[_0xc76c('0x1a')]?_0x1a9672[_0xc76c('0x1a')][_0xc76c('0x23')]||null:null,'attributes':_0x1a9672[_0xc76c('0x1a')]?_0x1a9672['options'][_0xc76c('0x1c')]||null:null,'include':_0x1a9672['options']?_0x1a9672['options'][_0xc76c('0x1d')]?_[_0xc76c('0x1e')](_0x1a9672[_0xc76c('0x1a')][_0xc76c('0x1d')],function(_0x4aa0ca){return{'model':db[_0x4aa0ca[_0xc76c('0x1f')]],'as':_0x4aa0ca['as'],'attributes':_0x4aa0ca[_0xc76c('0x1c')],'include':_0x4aa0ca[_0xc76c('0x1d')]?_[_0xc76c('0x1e')](_0x4aa0ca['include'],function(_0x2ba595){return{'model':db[_0x2ba595['model']],'as':_0x2ba595['as'],'attributes':_0x2ba595[_0xc76c('0x1c')],'include':_0x2ba595[_0xc76c('0x1d')]?_['map'](_0x2ba595['include'],function(_0x45203e){return{'model':db[_0x45203e[_0xc76c('0x1f')]],'as':_0x45203e['as'],'attributes':_0x45203e[_0xc76c('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x7b6842){logger[_0xc76c('0xe')](_0xc76c('0x21'),_0x1a9672);logger[_0xc76c('0x11')](_0xc76c('0x21'),_0x1a9672,JSON[_0xc76c('0x13')](_0x7b6842));_0x499627(_0x7b6842);})[_0xc76c('0x20')](function(_0x46f8fe){logger[_0xc76c('0x14')]('ShowZendeskAccount',_0x46f8fe[_0xc76c('0x16')],_0x1a9672);_0x1716af(_0x1a74cf[_0xc76c('0x14')](0x1f4,_0x46f8fe[_0xc76c('0x16')]));});});}; \ No newline at end of file +var _0x741a=['debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','GetZendeskAccount','ZendeskAccount','options','raw','attributes','limit','include','map','model','ShowZendeskAccount','find','where','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','request','then','ZendeskAccount,\x20%s,\x20%s'];(function(_0x3b7698,_0x4b0c43){var _0xf3169e=function(_0x17576e){while(--_0x17576e){_0x3b7698['push'](_0x3b7698['shift']());}};_0xf3169e(++_0x4b0c43);}(_0x741a,0x7b));var _0xa741=function(_0x11f249,_0x4ca4a8){_0x11f249=_0x11f249-0x0;var _0x5c3656=_0x741a[_0x11f249];return _0x5c3656;};'use strict';var _=require(_0xa741('0x0'));var util=require(_0xa741('0x1'));var moment=require(_0xa741('0x2'));var BPromise=require(_0xa741('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa741('0x4'));var db=require(_0xa741('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xa741('0x6'));var jayson=require(_0xa741('0x7'));var client=jayson[_0xa741('0x8')][_0xa741('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x37182c,_0x9b6033,_0x33be28){return new BPromise(function(_0x1e9c51,_0x183e10){return client[_0xa741('0xa')](_0x37182c,_0x33be28)[_0xa741('0xb')](function(_0x5b9529){logger['info'](_0xa741('0xc'),_0x9b6033,'request\x20sent');logger[_0xa741('0xd')](_0xa741('0xe'),_0x9b6033,_0xa741('0xf'),JSON[_0xa741('0x10')](_0x5b9529));if(_0x5b9529[_0xa741('0x11')]){if(_0x5b9529['error'][_0xa741('0x12')]===0x1f4){logger[_0xa741('0x11')]('ZendeskAccount,\x20%s,\x20%s',_0x9b6033,_0x5b9529['error'][_0xa741('0x13')]);return _0x183e10(_0x5b9529[_0xa741('0x11')]['message']);}logger[_0xa741('0x11')]('ZendeskAccount,\x20%s,\x20%s',_0x9b6033,_0x5b9529[_0xa741('0x11')][_0xa741('0x13')]);return _0x1e9c51(_0x5b9529[_0xa741('0x11')][_0xa741('0x13')]);}else{logger[_0xa741('0x14')]('ZendeskAccount,\x20%s,\x20%s',_0x9b6033,_0xa741('0xf'));_0x1e9c51(_0x5b9529['result'][_0xa741('0x13')]);}})[_0xa741('0x15')](function(_0xae3701){logger[_0xa741('0x11')]('ZendeskAccount,\x20%s,\x20%s',_0x9b6033,_0xae3701);_0x183e10(_0xae3701);});});}exports[_0xa741('0x16')]=function(_0x53e035){var _0x547879=this;return new Promise(function(_0x46ae68,_0x13ebfe){return db[_0xa741('0x17')]['findAll']({'raw':_0x53e035[_0xa741('0x18')]?_0x53e035[_0xa741('0x18')][_0xa741('0x19')]===undefined?!![]:![]:!![],'where':_0x53e035[_0xa741('0x18')]?_0x53e035[_0xa741('0x18')]['where']||null:null,'attributes':_0x53e035[_0xa741('0x18')]?_0x53e035['options'][_0xa741('0x1a')]||null:null,'limit':_0x53e035[_0xa741('0x18')]?_0x53e035['options'][_0xa741('0x1b')]||null:null,'include':_0x53e035[_0xa741('0x18')]?_0x53e035[_0xa741('0x18')][_0xa741('0x1c')]?_[_0xa741('0x1d')](_0x53e035[_0xa741('0x18')][_0xa741('0x1c')],function(_0x1b7b55){return{'model':db[_0x1b7b55[_0xa741('0x1e')]],'as':_0x1b7b55['as'],'attributes':_0x1b7b55['attributes'],'include':_0x1b7b55[_0xa741('0x1c')]?_[_0xa741('0x1d')](_0x1b7b55[_0xa741('0x1c')],function(_0x123ef0){return{'model':db[_0x123ef0[_0xa741('0x1e')]],'as':_0x123ef0['as'],'attributes':_0x123ef0[_0xa741('0x1a')],'include':_0x123ef0[_0xa741('0x1c')]?_[_0xa741('0x1d')](_0x123ef0[_0xa741('0x1c')],function(_0x2a75bc){return{'model':db[_0x2a75bc[_0xa741('0x1e')]],'as':_0x2a75bc['as'],'attributes':_0x2a75bc[_0xa741('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa741('0xb')](function(_0x15829b){logger[_0xa741('0x14')](_0xa741('0x16'),_0x53e035);logger[_0xa741('0xd')]('GetZendeskAccount',_0x53e035,JSON['stringify'](_0x15829b));_0x46ae68(_0x15829b);})[_0xa741('0x15')](function(_0x5489c6){logger[_0xa741('0x11')](_0xa741('0x16'),_0x5489c6[_0xa741('0x13')],_0x53e035);_0x13ebfe(_0x547879[_0xa741('0x11')](0x1f4,_0x5489c6[_0xa741('0x13')]));});});};exports[_0xa741('0x1f')]=function(_0x3cb3d7){var _0x139460=this;return new Promise(function(_0x421d35,_0x27721e){return db[_0xa741('0x17')][_0xa741('0x20')]({'raw':_0x3cb3d7['options']?_0x3cb3d7[_0xa741('0x18')][_0xa741('0x19')]===undefined?!![]:![]:!![],'where':_0x3cb3d7[_0xa741('0x18')]?_0x3cb3d7[_0xa741('0x18')][_0xa741('0x21')]||null:null,'attributes':_0x3cb3d7[_0xa741('0x18')]?_0x3cb3d7[_0xa741('0x18')]['attributes']||null:null,'include':_0x3cb3d7[_0xa741('0x18')]?_0x3cb3d7[_0xa741('0x18')][_0xa741('0x1c')]?_[_0xa741('0x1d')](_0x3cb3d7[_0xa741('0x18')][_0xa741('0x1c')],function(_0x1db9e1){return{'model':db[_0x1db9e1['model']],'as':_0x1db9e1['as'],'attributes':_0x1db9e1[_0xa741('0x1a')],'include':_0x1db9e1[_0xa741('0x1c')]?_['map'](_0x1db9e1[_0xa741('0x1c')],function(_0x2bf6b2){return{'model':db[_0x2bf6b2[_0xa741('0x1e')]],'as':_0x2bf6b2['as'],'attributes':_0x2bf6b2['attributes'],'include':_0x2bf6b2[_0xa741('0x1c')]?_['map'](_0x2bf6b2[_0xa741('0x1c')],function(_0x1eb581){return{'model':db[_0x1eb581[_0xa741('0x1e')]],'as':_0x1eb581['as'],'attributes':_0x1eb581[_0xa741('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa741('0xb')](function(_0x489178){logger['info']('ShowZendeskAccount',_0x3cb3d7);logger[_0xa741('0xd')](_0xa741('0x1f'),_0x3cb3d7,JSON[_0xa741('0x10')](_0x489178));_0x421d35(_0x489178);})[_0xa741('0x15')](function(_0x4dcd00){logger[_0xa741('0x11')](_0xa741('0x1f'),_0x4dcd00[_0xa741('0x13')],_0x3cb3d7);_0x27721e(_0x139460[_0xa741('0x11')](0x1f4,_0x4dcd00[_0xa741('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 19b3d3f..b487a17 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 _0xbaf0=['isAuthenticated','index','/:id','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get'];(function(_0x399934,_0x21f972){var _0x4bb027=function(_0x2f5cff){while(--_0x2f5cff){_0x399934['push'](_0x399934['shift']());}};_0x4bb027(++_0x21f972);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'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('0x9')]('/:id/fields',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0x9')](_0x0baf('0xe'),auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x9')](_0x0baf('0x10'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x11')]);router[_0x0baf('0x9')]('/:id/tags',auth['isAuthenticated'](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0x14')]);router['post'](_0x0baf('0x15'),auth['isAuthenticated'](),controller[_0x0baf('0x16')]);router[_0x0baf('0x17')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x18')]);router[_0x0baf('0x19')]('/:id',auth['isAuthenticated'](),controller[_0x0baf('0x1a')]);module[_0x0baf('0x1b')]=router; \ No newline at end of file +var _0x5c00=['path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','getFields','/:id/subjects','getSubjects','/:id/tags','post','create','setTags','put','/:id','delete','destroy','exports','multer','util'];(function(_0xaf8a88,_0x14d4a3){var _0x2c7b28=function(_0x460030){while(--_0x460030){_0xaf8a88['push'](_0xaf8a88['shift']());}};_0x2c7b28(++_0x14d4a3);}(_0x5c00,0x17e));var _0x05c0=function(_0x35b7ba,_0x155c7f){_0x35b7ba=_0x35b7ba-0x0;var _0x25ea5e=_0x5c00[_0x35b7ba];return _0x25ea5e;};'use strict';var multer=require(_0x05c0('0x0'));var util=require(_0x05c0('0x1'));var path=require(_0x05c0('0x2'));var timeout=require('connect-timeout');var express=require(_0x05c0('0x3'));var router=express['Router']();var fs_extra=require(_0x05c0('0x4'));var auth=require(_0x05c0('0x5'));var interaction=require(_0x05c0('0x6'));var config=require(_0x05c0('0x7'));var controller=require('./intZendeskConfiguration.controller');router[_0x05c0('0x8')]('/',auth[_0x05c0('0x9')](),controller[_0x05c0('0xa')]);router[_0x05c0('0x8')]('/:id',auth[_0x05c0('0x9')](),controller[_0x05c0('0xb')]);router[_0x05c0('0x8')]('/:id/fields',auth[_0x05c0('0x9')](),controller[_0x05c0('0xc')]);router[_0x05c0('0x8')](_0x05c0('0xd'),auth[_0x05c0('0x9')](),controller[_0x05c0('0xe')]);router['get']('/:id/descriptions',auth[_0x05c0('0x9')](),controller['getDescriptions']);router[_0x05c0('0x8')](_0x05c0('0xf'),auth[_0x05c0('0x9')](),controller['getTags']);router[_0x05c0('0x10')]('/',auth['isAuthenticated'](),controller[_0x05c0('0x11')]);router[_0x05c0('0x10')](_0x05c0('0xf'),auth[_0x05c0('0x9')](),controller[_0x05c0('0x12')]);router[_0x05c0('0x13')](_0x05c0('0x14'),auth[_0x05c0('0x9')](),controller['update']);router[_0x05c0('0x15')](_0x05c0('0x14'),auth[_0x05c0('0x9')](),controller[_0x05c0('0x16')]);module[_0x05c0('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 2789f54..14323c0 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 _0x68d2=['sequelize','exports','STRING'];(function(_0x3a6523,_0x520593){var _0x2614bb=function(_0x50e583){while(--_0x50e583){_0x3a6523['push'](_0x3a6523['shift']());}};_0x2614bb(++_0x520593);}(_0x68d2,0xab));var _0x268d=function(_0x1aa402,_0x5761f5){_0x1aa402=_0x1aa402-0x0;var _0xd31b9e=_0x68d2[_0x1aa402];return _0xd31b9e;};'use strict';var Sequelize=require(_0x268d('0x0'));module[_0x268d('0x1')]={'name':{'type':Sequelize[_0x268d('0x2')]},'description':{'type':Sequelize[_0x268d('0x2')]}}; \ No newline at end of file +var _0x1aab=['sequelize','exports','STRING'];(function(_0x1aabbd,_0x4a6869){var _0x513dcd=function(_0x70d75a){while(--_0x70d75a){_0x1aabbd['push'](_0x1aabbd['shift']());}};_0x513dcd(++_0x4a6869);}(_0x1aab,0xb1));var _0xb1aa=function(_0x447d2b,_0x1f79c0){_0x447d2b=_0x447d2b-0x0;var _0x48a1f0=_0x1aab[_0x447d2b];return _0x48a1f0;};'use strict';var Sequelize=require(_0xb1aa('0x0'));module[_0xb1aa('0x1')]={'name':{'type':Sequelize[_0xb1aa('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index be84eb2..09af914 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 _0xe904=['where','pick','filter','merge','VIRTUAL','options','ZendeskConfiguration','includeAll','findAll','rows','catch','show','rawAttributes','include','find','create','body','params','findOne','ZendeskField','getFields','getSubjects','hasOwnProperty','getDescriptions','getTags','setTags','ids','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort'];(function(_0x5a95fa,_0x4a2fc9){var _0x1a61b8=function(_0x59f119){while(--_0x59f119){_0x5a95fa['push'](_0x5a95fa['shift']());}};_0x1a61b8(++_0x4a2fc9);}(_0xe904,0x16f));var _0x4e90=function(_0x3a45b3,_0x300baf){_0x3a45b3=_0x3a45b3-0x0;var _0x4aba5b=_0xe904[_0x3a45b3];return _0x4aba5b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4e90('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4e90('0x1'));var rp=require(_0x4e90('0x2'));var moment=require(_0x4e90('0x3'));var BPromise=require(_0x4e90('0x4'));var Mustache=require(_0x4e90('0x5'));var util=require(_0x4e90('0x6'));var path=require(_0x4e90('0x7'));var sox=require('sox');var csv=require(_0x4e90('0x8'));var ejs=require(_0x4e90('0x9'));var fs=require('fs');var fs_extra=require(_0x4e90('0xa'));var _=require(_0x4e90('0xb'));var squel=require(_0x4e90('0xc'));var crypto=require('crypto');var jsforce=require(_0x4e90('0xd'));var deskjs=require(_0x4e90('0xe'));var toCsv=require(_0x4e90('0x8'));var querystring=require(_0x4e90('0xf'));var Papa=require(_0x4e90('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4e90('0x11'));var as=require(_0x4e90('0x12'));var hardwareService=require(_0x4e90('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x4e90('0x14'));var config=require(_0x4e90('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x4e90('0x16'))['db'];function respondWithStatusCode(_0x207c56,_0x3512dc){_0x3512dc=_0x3512dc||0xcc;return function(_0x4ede23){if(_0x4ede23){return _0x207c56[_0x4e90('0x17')](_0x3512dc);}return _0x207c56['status'](_0x3512dc)[_0x4e90('0x18')]();};}function respondWithResult(_0x4dea69,_0x302b9f){_0x302b9f=_0x302b9f||0xc8;return function(_0x3d0ebf){if(_0x3d0ebf){return _0x4dea69[_0x4e90('0x19')](_0x302b9f)[_0x4e90('0x1a')](_0x3d0ebf);}};}function respondWithFilteredResult(_0x156147,_0x118211){return function(_0x4e95b6){if(_0x4e95b6){var _0x249c09=typeof _0x118211[_0x4e90('0x1b')]===_0x4e90('0x1c')&&typeof _0x118211[_0x4e90('0x1d')]===_0x4e90('0x1c');var _0x47e498=_0x4e95b6[_0x4e90('0x1e')];var _0x264199=_0x249c09?0x0:_0x118211['offset'];var _0x1b2ab5=_0x249c09?_0x4e95b6['count']:_0x118211[_0x4e90('0x1b')]+_0x118211[_0x4e90('0x1d')];var _0x25ff6b;if(_0x1b2ab5>=_0x47e498){_0x1b2ab5=_0x47e498;_0x25ff6b=0xc8;}else{_0x25ff6b=0xce;}_0x156147['status'](_0x25ff6b);return _0x156147[_0x4e90('0x1f')](_0x4e90('0x20'),_0x264199+'-'+_0x1b2ab5+'/'+_0x47e498)[_0x4e90('0x1a')](_0x4e95b6);}return null;};}function patchUpdates(_0x4f2a6c){return function(_0x412124){try{jsonpatch[_0x4e90('0x21')](_0x412124,_0x4f2a6c,!![]);}catch(_0x3608c1){return BPromise[_0x4e90('0x22')](_0x3608c1);}return _0x412124['save']();};}function saveUpdates(_0x4d8931,_0x5f2578){return function(_0x4f2b70){if(_0x4f2b70){return _0x4f2b70[_0x4e90('0x23')](_0x4d8931)[_0x4e90('0x24')](function(_0x2a72d4){return _0x2a72d4;});}return null;};}function removeEntity(_0x5f3d16,_0x20ed9a){return function(_0x46f2c2){if(_0x46f2c2){return _0x46f2c2[_0x4e90('0x25')]()['then'](function(){_0x5f3d16[_0x4e90('0x19')](0xcc)[_0x4e90('0x18')]();});}};}function handleEntityNotFound(_0x1b9c30,_0x266671){return function(_0x3e5f7f){if(!_0x3e5f7f){_0x1b9c30[_0x4e90('0x17')](0x194);}return _0x3e5f7f;};}function handleError(_0x5c0c8a,_0x96562a){_0x96562a=_0x96562a||0x1f4;return function(_0x419cd8){logger[_0x4e90('0x26')](_0x419cd8[_0x4e90('0x27')]);if(_0x419cd8[_0x4e90('0x28')]){delete _0x419cd8[_0x4e90('0x28')];}_0x5c0c8a[_0x4e90('0x19')](_0x96562a)[_0x4e90('0x29')](_0x419cd8);};}exports[_0x4e90('0x2a')]=function(_0x57f657,_0x2ece94){var _0x3e94e2={},_0x1f4da4={},_0x3ad3d4={'count':0x0,'rows':[]};var _0x5d02b3=_[_0x4e90('0x2b')](db['ZendeskConfiguration']['rawAttributes'],function(_0x4f1da5){return{'name':_0x4f1da5[_0x4e90('0x2c')],'type':_0x4f1da5[_0x4e90('0x2d')][_0x4e90('0x2e')]};});_0x1f4da4['model']=_[_0x4e90('0x2b')](_0x5d02b3,_0x4e90('0x28'));_0x1f4da4[_0x4e90('0x2f')]=_[_0x4e90('0x30')](_0x57f657[_0x4e90('0x2f')]);_0x1f4da4[_0x4e90('0x31')]=_[_0x4e90('0x32')](_0x1f4da4[_0x4e90('0x33')],_0x1f4da4[_0x4e90('0x2f')]);_0x3e94e2[_0x4e90('0x34')]=_[_0x4e90('0x32')](_0x1f4da4[_0x4e90('0x33')],qs[_0x4e90('0x35')](_0x57f657[_0x4e90('0x2f')]['fields']));_0x3e94e2[_0x4e90('0x34')]=_0x3e94e2[_0x4e90('0x34')][_0x4e90('0x36')]?_0x3e94e2['attributes']:_0x1f4da4[_0x4e90('0x33')];if(!_0x57f657[_0x4e90('0x2f')]['hasOwnProperty'](_0x4e90('0x37'))){_0x3e94e2[_0x4e90('0x1d')]=qs['limit'](_0x57f657[_0x4e90('0x2f')][_0x4e90('0x1d')]);_0x3e94e2[_0x4e90('0x1b')]=qs[_0x4e90('0x1b')](_0x57f657[_0x4e90('0x2f')][_0x4e90('0x1b')]);}_0x3e94e2[_0x4e90('0x38')]=qs[_0x4e90('0x39')](_0x57f657[_0x4e90('0x2f')][_0x4e90('0x39')]);_0x3e94e2[_0x4e90('0x3a')]=qs[_0x4e90('0x31')](_[_0x4e90('0x3b')](_0x57f657[_0x4e90('0x2f')],_0x1f4da4['filters']),_0x5d02b3);if(_0x57f657[_0x4e90('0x2f')][_0x4e90('0x3c')]){_0x3e94e2['where']=_[_0x4e90('0x3d')](_0x3e94e2[_0x4e90('0x3a')],{'$or':_['map'](_0x5d02b3,function(_0x24cf42){if(_0x24cf42[_0x4e90('0x2d')]!==_0x4e90('0x3e')){var _0x2b0123={};_0x2b0123[_0x24cf42[_0x4e90('0x28')]]={'$like':'%'+_0x57f657[_0x4e90('0x2f')][_0x4e90('0x3c')]+'%'};return _0x2b0123;}})});}_0x3e94e2=_[_0x4e90('0x3d')]({},_0x3e94e2,_0x57f657[_0x4e90('0x3f')]);var _0x4058e3={'where':_0x3e94e2[_0x4e90('0x3a')]};return db[_0x4e90('0x40')][_0x4e90('0x1e')](_0x4058e3)[_0x4e90('0x24')](function(_0x10459e){_0x3ad3d4[_0x4e90('0x1e')]=_0x10459e;if(_0x57f657['query'][_0x4e90('0x41')]){_0x3e94e2['include']=[{'all':!![]}];}return db[_0x4e90('0x40')][_0x4e90('0x42')](_0x3e94e2);})[_0x4e90('0x24')](function(_0x42d99a){_0x3ad3d4[_0x4e90('0x43')]=_0x42d99a;return _0x3ad3d4;})[_0x4e90('0x24')](respondWithFilteredResult(_0x2ece94,_0x3e94e2))[_0x4e90('0x44')](handleError(_0x2ece94,null));};exports[_0x4e90('0x45')]=function(_0x3e563b,_0x1033d2){var _0xb6d567={'raw':![],'where':{'id':_0x3e563b['params']['id']}},_0x1a92ca={};_0x1a92ca[_0x4e90('0x33')]=_[_0x4e90('0x30')](db[_0x4e90('0x40')][_0x4e90('0x46')]);_0x1a92ca[_0x4e90('0x2f')]=_['keys'](_0x3e563b[_0x4e90('0x2f')]);_0x1a92ca[_0x4e90('0x31')]=_[_0x4e90('0x32')](_0x1a92ca[_0x4e90('0x33')],_0x1a92ca[_0x4e90('0x2f')]);_0xb6d567[_0x4e90('0x34')]=_[_0x4e90('0x32')](_0x1a92ca[_0x4e90('0x33')],qs[_0x4e90('0x35')](_0x3e563b['query']['fields']));_0xb6d567['attributes']=_0xb6d567[_0x4e90('0x34')][_0x4e90('0x36')]?_0xb6d567['attributes']:_0x1a92ca[_0x4e90('0x33')];if(_0x3e563b[_0x4e90('0x2f')][_0x4e90('0x41')]){_0xb6d567[_0x4e90('0x47')]=[{'all':!![]}];}_0xb6d567=_[_0x4e90('0x3d')]({},_0xb6d567,_0x3e563b[_0x4e90('0x3f')]);return db[_0x4e90('0x40')][_0x4e90('0x48')](_0xb6d567)[_0x4e90('0x24')](handleEntityNotFound(_0x1033d2,null))[_0x4e90('0x24')](respondWithResult(_0x1033d2,null))[_0x4e90('0x44')](handleError(_0x1033d2,null));};exports[_0x4e90('0x49')]=function(_0x299b2a,_0x4db6a0){return db[_0x4e90('0x40')][_0x4e90('0x49')](_0x299b2a[_0x4e90('0x4a')],{})['then'](respondWithResult(_0x4db6a0,0xc9))[_0x4e90('0x44')](handleError(_0x4db6a0,null));};exports['update']=function(_0x6bb1ea,_0x18b44b){if(_0x6bb1ea[_0x4e90('0x4a')]['id']){delete _0x6bb1ea['body']['id'];}return db[_0x4e90('0x40')]['find']({'where':{'id':_0x6bb1ea['params']['id']}})[_0x4e90('0x24')](handleEntityNotFound(_0x18b44b,null))[_0x4e90('0x24')](saveUpdates(_0x6bb1ea[_0x4e90('0x4a')],null))[_0x4e90('0x24')](respondWithResult(_0x18b44b,null))['catch'](handleError(_0x18b44b,null));};exports[_0x4e90('0x25')]=function(_0xb02a8,_0x1527bf){return db[_0x4e90('0x40')][_0x4e90('0x48')]({'where':{'id':_0xb02a8[_0x4e90('0x4b')]['id']}})[_0x4e90('0x24')](handleEntityNotFound(_0x1527bf,null))['then'](removeEntity(_0x1527bf,null))[_0x4e90('0x44')](handleError(_0x1527bf,null));};exports['getFields']=function(_0xaf189,_0x19980d,_0x263a54){var _0x36d1d6={};var _0x2176bf={};var _0x34a4f5;var _0x1c4ae5;return db['ZendeskConfiguration'][_0x4e90('0x4c')]({'where':{'id':_0xaf189[_0x4e90('0x4b')]['id']}})[_0x4e90('0x24')](handleEntityNotFound(_0x19980d,null))[_0x4e90('0x24')](function(_0x110211){if(_0x110211){_0x34a4f5=_0x110211;_0x2176bf[_0x4e90('0x33')]=_[_0x4e90('0x30')](db[_0x4e90('0x4d')][_0x4e90('0x46')]);_0x2176bf['query']=_['keys'](_0xaf189[_0x4e90('0x2f')]);_0x2176bf[_0x4e90('0x31')]=_[_0x4e90('0x32')](_0x2176bf[_0x4e90('0x33')],_0x2176bf['query']);_0x36d1d6[_0x4e90('0x34')]=_[_0x4e90('0x32')](_0x2176bf[_0x4e90('0x33')],qs[_0x4e90('0x35')](_0xaf189[_0x4e90('0x2f')]['fields']));_0x36d1d6[_0x4e90('0x34')]=_0x36d1d6['attributes'][_0x4e90('0x36')]?_0x36d1d6[_0x4e90('0x34')]:_0x2176bf['model'];_0x36d1d6[_0x4e90('0x38')]=qs[_0x4e90('0x39')](_0xaf189[_0x4e90('0x2f')]['sort']);_0x36d1d6[_0x4e90('0x3a')]=qs[_0x4e90('0x31')](_[_0x4e90('0x3b')](_0xaf189['query'],_0x2176bf[_0x4e90('0x31')]));if(_0xaf189[_0x4e90('0x2f')]['filter']){_0x36d1d6['where']=_[_0x4e90('0x3d')](_0x36d1d6[_0x4e90('0x3a')],{'$or':_[_0x4e90('0x2b')](_0x36d1d6[_0x4e90('0x34')],function(_0x235f0e){var _0x46f23a={};_0x46f23a[_0x235f0e]={'$like':'%'+_0xaf189[_0x4e90('0x2f')][_0x4e90('0x3c')]+'%'};return _0x46f23a;})});}_0x36d1d6=_['merge']({},_0x36d1d6,_0xaf189['options']);return _0x34a4f5[_0x4e90('0x4e')](_0x36d1d6);}})[_0x4e90('0x24')](function(_0x1a23ae){if(_0x1a23ae){_0x1c4ae5=_0x1a23ae[_0x4e90('0x36')];if(!_0xaf189[_0x4e90('0x2f')]['hasOwnProperty'](_0x4e90('0x37'))){_0x36d1d6[_0x4e90('0x1d')]=qs['limit'](_0xaf189[_0x4e90('0x2f')][_0x4e90('0x1d')]);_0x36d1d6['offset']=qs['offset'](_0xaf189['query'][_0x4e90('0x1b')]);}return _0x34a4f5[_0x4e90('0x4e')](_0x36d1d6);}})[_0x4e90('0x24')](function(_0x23f14e){if(_0x23f14e){return _0x23f14e?{'count':_0x1c4ae5,'rows':_0x23f14e}:null;}})[_0x4e90('0x24')](respondWithResult(_0x19980d,null))[_0x4e90('0x44')](handleError(_0x19980d,null));};exports['getSubjects']=function(_0x1f715b,_0x58b2a7,_0x265308){var _0x105230={};var _0x2b53f7={};var _0x15feb1;var _0x295f79;return db[_0x4e90('0x40')][_0x4e90('0x4c')]({'where':{'id':_0x1f715b[_0x4e90('0x4b')]['id']}})[_0x4e90('0x24')](handleEntityNotFound(_0x58b2a7,null))['then'](function(_0x4c3b6e){if(_0x4c3b6e){_0x15feb1=_0x4c3b6e;_0x2b53f7[_0x4e90('0x33')]=_[_0x4e90('0x30')](db[_0x4e90('0x4d')]['rawAttributes']);_0x2b53f7[_0x4e90('0x2f')]=_[_0x4e90('0x30')](_0x1f715b[_0x4e90('0x2f')]);_0x2b53f7[_0x4e90('0x31')]=_['intersection'](_0x2b53f7['model'],_0x2b53f7[_0x4e90('0x2f')]);_0x105230[_0x4e90('0x34')]=_['intersection'](_0x2b53f7[_0x4e90('0x33')],qs[_0x4e90('0x35')](_0x1f715b[_0x4e90('0x2f')][_0x4e90('0x35')]));_0x105230[_0x4e90('0x34')]=_0x105230[_0x4e90('0x34')][_0x4e90('0x36')]?_0x105230['attributes']:_0x2b53f7[_0x4e90('0x33')];_0x105230[_0x4e90('0x38')]=qs[_0x4e90('0x39')](_0x1f715b[_0x4e90('0x2f')][_0x4e90('0x39')]);_0x105230[_0x4e90('0x3a')]=qs[_0x4e90('0x31')](_[_0x4e90('0x3b')](_0x1f715b[_0x4e90('0x2f')],_0x2b53f7[_0x4e90('0x31')]));if(_0x1f715b['query'][_0x4e90('0x3c')]){_0x105230['where']=_['merge'](_0x105230[_0x4e90('0x3a')],{'$or':_['map'](_0x105230[_0x4e90('0x34')],function(_0x4c973f){var _0xd2f4f={};_0xd2f4f[_0x4c973f]={'$like':'%'+_0x1f715b['query'][_0x4e90('0x3c')]+'%'};return _0xd2f4f;})});}_0x105230=_[_0x4e90('0x3d')]({},_0x105230,_0x1f715b['options']);return _0x15feb1[_0x4e90('0x4f')](_0x105230);}})[_0x4e90('0x24')](function(_0x299e7e){if(_0x299e7e){_0x295f79=_0x299e7e[_0x4e90('0x36')];if(!_0x1f715b[_0x4e90('0x2f')][_0x4e90('0x50')](_0x4e90('0x37'))){_0x105230['limit']=qs['limit'](_0x1f715b[_0x4e90('0x2f')]['limit']);_0x105230[_0x4e90('0x1b')]=qs[_0x4e90('0x1b')](_0x1f715b[_0x4e90('0x2f')][_0x4e90('0x1b')]);}return _0x15feb1[_0x4e90('0x4f')](_0x105230);}})[_0x4e90('0x24')](function(_0x20d8b){if(_0x20d8b){return _0x20d8b?{'count':_0x295f79,'rows':_0x20d8b}:null;}})[_0x4e90('0x24')](respondWithResult(_0x58b2a7,null))['catch'](handleError(_0x58b2a7,null));};exports[_0x4e90('0x51')]=function(_0x2db62c,_0x146188,_0x1689a7){var _0x5d631f={};var _0x2141be={};var _0x2cc8c1;var _0x2e7aed;return db['ZendeskConfiguration'][_0x4e90('0x4c')]({'where':{'id':_0x2db62c[_0x4e90('0x4b')]['id']}})[_0x4e90('0x24')](handleEntityNotFound(_0x146188,null))[_0x4e90('0x24')](function(_0x4c72af){if(_0x4c72af){_0x2cc8c1=_0x4c72af;_0x2141be[_0x4e90('0x33')]=_['keys'](db[_0x4e90('0x4d')][_0x4e90('0x46')]);_0x2141be[_0x4e90('0x2f')]=_[_0x4e90('0x30')](_0x2db62c[_0x4e90('0x2f')]);_0x2141be[_0x4e90('0x31')]=_[_0x4e90('0x32')](_0x2141be[_0x4e90('0x33')],_0x2141be[_0x4e90('0x2f')]);_0x5d631f[_0x4e90('0x34')]=_[_0x4e90('0x32')](_0x2141be[_0x4e90('0x33')],qs['fields'](_0x2db62c[_0x4e90('0x2f')][_0x4e90('0x35')]));_0x5d631f[_0x4e90('0x34')]=_0x5d631f[_0x4e90('0x34')][_0x4e90('0x36')]?_0x5d631f['attributes']:_0x2141be[_0x4e90('0x33')];_0x5d631f[_0x4e90('0x38')]=qs[_0x4e90('0x39')](_0x2db62c[_0x4e90('0x2f')][_0x4e90('0x39')]);_0x5d631f[_0x4e90('0x3a')]=qs['filters'](_[_0x4e90('0x3b')](_0x2db62c[_0x4e90('0x2f')],_0x2141be[_0x4e90('0x31')]));if(_0x2db62c['query'][_0x4e90('0x3c')]){_0x5d631f['where']=_[_0x4e90('0x3d')](_0x5d631f[_0x4e90('0x3a')],{'$or':_[_0x4e90('0x2b')](_0x5d631f['attributes'],function(_0xd09e02){var _0x4aba32={};_0x4aba32[_0xd09e02]={'$like':'%'+_0x2db62c[_0x4e90('0x2f')]['filter']+'%'};return _0x4aba32;})});}_0x5d631f=_[_0x4e90('0x3d')]({},_0x5d631f,_0x2db62c['options']);return _0x2cc8c1[_0x4e90('0x51')](_0x5d631f);}})[_0x4e90('0x24')](function(_0x4ee0eb){if(_0x4ee0eb){_0x2e7aed=_0x4ee0eb[_0x4e90('0x36')];if(!_0x2db62c[_0x4e90('0x2f')][_0x4e90('0x50')](_0x4e90('0x37'))){_0x5d631f[_0x4e90('0x1d')]=qs[_0x4e90('0x1d')](_0x2db62c[_0x4e90('0x2f')][_0x4e90('0x1d')]);_0x5d631f[_0x4e90('0x1b')]=qs[_0x4e90('0x1b')](_0x2db62c[_0x4e90('0x2f')]['offset']);}return _0x2cc8c1[_0x4e90('0x51')](_0x5d631f);}})[_0x4e90('0x24')](function(_0x19ed19){if(_0x19ed19){return _0x19ed19?{'count':_0x2e7aed,'rows':_0x19ed19}:null;}})[_0x4e90('0x24')](respondWithResult(_0x146188,null))['catch'](handleError(_0x146188,null));};exports[_0x4e90('0x52')]=function(_0x4b2710,_0x3e4d7e,_0x26ad80){var _0x481016={};var _0x50cbe9={};var _0x111f01;var _0x4d4ea2;return db['ZendeskConfiguration'][_0x4e90('0x4c')]({'where':{'id':_0x4b2710[_0x4e90('0x4b')]['id']}})[_0x4e90('0x24')](handleEntityNotFound(_0x3e4d7e,null))[_0x4e90('0x24')](function(_0x1d7a01){if(_0x1d7a01){_0x111f01=_0x1d7a01;_0x50cbe9[_0x4e90('0x33')]=_[_0x4e90('0x30')](db['Tag'][_0x4e90('0x46')]);_0x50cbe9[_0x4e90('0x2f')]=_['keys'](_0x4b2710[_0x4e90('0x2f')]);_0x50cbe9[_0x4e90('0x31')]=_[_0x4e90('0x32')](_0x50cbe9[_0x4e90('0x33')],_0x50cbe9['query']);_0x481016['attributes']=_[_0x4e90('0x32')](_0x50cbe9[_0x4e90('0x33')],qs[_0x4e90('0x35')](_0x4b2710[_0x4e90('0x2f')][_0x4e90('0x35')]));_0x481016[_0x4e90('0x34')]=_0x481016[_0x4e90('0x34')][_0x4e90('0x36')]?_0x481016[_0x4e90('0x34')]:_0x50cbe9[_0x4e90('0x33')];_0x481016[_0x4e90('0x38')]=qs[_0x4e90('0x39')](_0x4b2710[_0x4e90('0x2f')][_0x4e90('0x39')]);_0x481016[_0x4e90('0x3a')]=qs['filters'](_[_0x4e90('0x3b')](_0x4b2710['query'],_0x50cbe9[_0x4e90('0x31')]));if(_0x4b2710[_0x4e90('0x2f')][_0x4e90('0x3c')]){_0x481016[_0x4e90('0x3a')]=_['merge'](_0x481016[_0x4e90('0x3a')],{'$or':_[_0x4e90('0x2b')](_0x481016[_0x4e90('0x34')],function(_0x175014){var _0xce12ca={};_0xce12ca[_0x175014]={'$like':'%'+_0x4b2710['query']['filter']+'%'};return _0xce12ca;})});}_0x481016=_[_0x4e90('0x3d')]({},_0x481016,_0x4b2710[_0x4e90('0x3f')]);return _0x111f01['getTags'](_0x481016);}})[_0x4e90('0x24')](function(_0x2049a4){if(_0x2049a4){_0x4d4ea2=_0x2049a4[_0x4e90('0x36')];if(!_0x4b2710[_0x4e90('0x2f')][_0x4e90('0x50')](_0x4e90('0x37'))){_0x481016[_0x4e90('0x1d')]=qs[_0x4e90('0x1d')](_0x4b2710[_0x4e90('0x2f')][_0x4e90('0x1d')]);_0x481016[_0x4e90('0x1b')]=qs['offset'](_0x4b2710[_0x4e90('0x2f')]['offset']);}return _0x111f01['getTags'](_0x481016);}})['then'](function(_0x2f354b){if(_0x2f354b){return _0x2f354b?{'count':_0x4d4ea2,'rows':_0x2f354b}:null;}})['then'](respondWithResult(_0x3e4d7e,null))[_0x4e90('0x44')](handleError(_0x3e4d7e,null));};exports['setTags']=function(_0x3920ce,_0x458270,_0x1b3f4a){if(_0x3920ce['body']['id']){delete _0x3920ce['body']['id'];}return db[_0x4e90('0x40')]['findOne']({'where':{'id':_0x3920ce[_0x4e90('0x4b')]['id']}})[_0x4e90('0x24')](handleEntityNotFound(_0x458270,null))[_0x4e90('0x24')](function(_0x34d353){if(_0x34d353){return _0x34d353[_0x4e90('0x53')](_0x3920ce[_0x4e90('0x4a')][_0x4e90('0x54')]||[]);}return null;})[_0x4e90('0x24')](respondWithResult(_0x458270,null))[_0x4e90('0x44')](handleError(_0x458270,null));}; \ No newline at end of file +var _0x190a=['api','../../config/utils','../../config/license/util','../../mysqldb','end','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','then','stack','name','send','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','create','body','update','destroy','getFields','ZendeskField','getSubjects','findOne','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0x190a,0x94));var _0xa190=function(_0x5ea778,_0x711f5f){_0x5ea778=_0x5ea778-0x0;var _0x4168f5=_0x190a[_0x5ea778];return _0x4168f5;};'use strict';var emlformat=require(_0xa190('0x0'));var rimraf=require(_0xa190('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa190('0x2'));var rp=require(_0xa190('0x3'));var moment=require(_0xa190('0x4'));var BPromise=require(_0xa190('0x5'));var Mustache=require(_0xa190('0x6'));var util=require(_0xa190('0x7'));var path=require(_0xa190('0x8'));var sox=require(_0xa190('0x9'));var csv=require('to-csv');var ejs=require(_0xa190('0xa'));var fs=require('fs');var fs_extra=require(_0xa190('0xb'));var _=require(_0xa190('0xc'));var squel=require(_0xa190('0xd'));var crypto=require(_0xa190('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xa190('0xf'));var toCsv=require(_0xa190('0x10'));var querystring=require(_0xa190('0x11'));var Papa=require(_0xa190('0x12'));var Redis=require(_0xa190('0x13'));var authService=require(_0xa190('0x14'));var qs=require(_0xa190('0x15'));var as=require(_0xa190('0x16'));var hardwareService=require(_0xa190('0x17'));var logger=require('../../config/logger')(_0xa190('0x18'));var utils=require(_0xa190('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xa190('0x1a'));var db=require(_0xa190('0x1b'))['db'];function respondWithStatusCode(_0x532e75,_0x3882c8){_0x3882c8=_0x3882c8||0xcc;return function(_0x26932e){if(_0x26932e){return _0x532e75['sendStatus'](_0x3882c8);}return _0x532e75['status'](_0x3882c8)[_0xa190('0x1c')]();};}function respondWithResult(_0x32e3a4,_0x121ad0){_0x121ad0=_0x121ad0||0xc8;return function(_0x25da8b){if(_0x25da8b){return _0x32e3a4[_0xa190('0x1d')](_0x121ad0)['json'](_0x25da8b);}};}function respondWithFilteredResult(_0x3dc692,_0x2e69cc){return function(_0x1b0f33){if(_0x1b0f33){var _0x4c7636=typeof _0x2e69cc[_0xa190('0x1e')]===_0xa190('0x1f')&&typeof _0x2e69cc[_0xa190('0x20')]===_0xa190('0x1f');var _0x3dff55=_0x1b0f33['count'];var _0x16e462=_0x4c7636?0x0:_0x2e69cc[_0xa190('0x1e')];var _0x4b3768=_0x4c7636?_0x1b0f33[_0xa190('0x21')]:_0x2e69cc['offset']+_0x2e69cc['limit'];var _0x469977;if(_0x4b3768>=_0x3dff55){_0x4b3768=_0x3dff55;_0x469977=0xc8;}else{_0x469977=0xce;}_0x3dc692[_0xa190('0x1d')](_0x469977);return _0x3dc692[_0xa190('0x22')](_0xa190('0x23'),_0x16e462+'-'+_0x4b3768+'/'+_0x3dff55)[_0xa190('0x24')](_0x1b0f33);}return null;};}function patchUpdates(_0x304c27){return function(_0x108498){try{jsonpatch['apply'](_0x108498,_0x304c27,!![]);}catch(_0x2ad19e){return BPromise[_0xa190('0x25')](_0x2ad19e);}return _0x108498[_0xa190('0x26')]();};}function saveUpdates(_0x2e0e32,_0x3344c3){return function(_0x223c1c){if(_0x223c1c){return _0x223c1c['update'](_0x2e0e32)[_0xa190('0x27')](function(_0x136c91){return _0x136c91;});}return null;};}function removeEntity(_0x1444b9,_0x501596){return function(_0x1f0c40){if(_0x1f0c40){return _0x1f0c40['destroy']()[_0xa190('0x27')](function(){_0x1444b9[_0xa190('0x1d')](0xcc)[_0xa190('0x1c')]();});}};}function handleEntityNotFound(_0x3cbc67,_0x2a9f62){return function(_0x596d58){if(!_0x596d58){_0x3cbc67['sendStatus'](0x194);}return _0x596d58;};}function handleError(_0x5319e1,_0x33dbcb){_0x33dbcb=_0x33dbcb||0x1f4;return function(_0x3c11c1){logger['error'](_0x3c11c1[_0xa190('0x28')]);if(_0x3c11c1[_0xa190('0x29')]){delete _0x3c11c1['name'];}_0x5319e1['status'](_0x33dbcb)[_0xa190('0x2a')](_0x3c11c1);};}exports[_0xa190('0x2b')]=function(_0x4feac8,_0x2a5b24){var _0x49a6a5={},_0x2f8651={},_0x25f1e3={'count':0x0,'rows':[]};var _0x459a9f=_[_0xa190('0x2c')](db[_0xa190('0x2d')][_0xa190('0x2e')],function(_0x482a7f){return{'name':_0x482a7f[_0xa190('0x2f')],'type':_0x482a7f[_0xa190('0x30')][_0xa190('0x31')]};});_0x2f8651[_0xa190('0x32')]=_[_0xa190('0x2c')](_0x459a9f,'name');_0x2f8651[_0xa190('0x33')]=_[_0xa190('0x34')](_0x4feac8[_0xa190('0x33')]);_0x2f8651[_0xa190('0x35')]=_[_0xa190('0x36')](_0x2f8651[_0xa190('0x32')],_0x2f8651['query']);_0x49a6a5['attributes']=_[_0xa190('0x36')](_0x2f8651[_0xa190('0x32')],qs['fields'](_0x4feac8[_0xa190('0x33')][_0xa190('0x37')]));_0x49a6a5[_0xa190('0x38')]=_0x49a6a5[_0xa190('0x38')][_0xa190('0x39')]?_0x49a6a5[_0xa190('0x38')]:_0x2f8651[_0xa190('0x32')];if(!_0x4feac8[_0xa190('0x33')][_0xa190('0x3a')](_0xa190('0x3b'))){_0x49a6a5['limit']=qs[_0xa190('0x20')](_0x4feac8[_0xa190('0x33')][_0xa190('0x20')]);_0x49a6a5[_0xa190('0x1e')]=qs[_0xa190('0x1e')](_0x4feac8['query']['offset']);}_0x49a6a5[_0xa190('0x3c')]=qs[_0xa190('0x3d')](_0x4feac8['query'][_0xa190('0x3d')]);_0x49a6a5[_0xa190('0x3e')]=qs[_0xa190('0x35')](_[_0xa190('0x3f')](_0x4feac8[_0xa190('0x33')],_0x2f8651[_0xa190('0x35')]),_0x459a9f);if(_0x4feac8[_0xa190('0x33')][_0xa190('0x40')]){_0x49a6a5[_0xa190('0x3e')]=_[_0xa190('0x41')](_0x49a6a5[_0xa190('0x3e')],{'$or':_[_0xa190('0x2c')](_0x459a9f,function(_0x598008){if(_0x598008['type']!==_0xa190('0x42')){var _0x4691bf={};_0x4691bf[_0x598008[_0xa190('0x29')]]={'$like':'%'+_0x4feac8[_0xa190('0x33')]['filter']+'%'};return _0x4691bf;}})});}_0x49a6a5=_['merge']({},_0x49a6a5,_0x4feac8[_0xa190('0x43')]);var _0x5c665a={'where':_0x49a6a5[_0xa190('0x3e')]};return db[_0xa190('0x2d')][_0xa190('0x21')](_0x5c665a)[_0xa190('0x27')](function(_0x39f855){_0x25f1e3['count']=_0x39f855;if(_0x4feac8['query'][_0xa190('0x44')]){_0x49a6a5[_0xa190('0x45')]=[{'all':!![]}];}return db['ZendeskConfiguration']['findAll'](_0x49a6a5);})['then'](function(_0x271912){_0x25f1e3[_0xa190('0x46')]=_0x271912;return _0x25f1e3;})[_0xa190('0x27')](respondWithFilteredResult(_0x2a5b24,_0x49a6a5))[_0xa190('0x47')](handleError(_0x2a5b24,null));};exports[_0xa190('0x48')]=function(_0x1dea69,_0x27281a){var _0x189600={'raw':![],'where':{'id':_0x1dea69[_0xa190('0x49')]['id']}},_0x50dfb8={};_0x50dfb8['model']=_[_0xa190('0x34')](db[_0xa190('0x2d')][_0xa190('0x2e')]);_0x50dfb8['query']=_[_0xa190('0x34')](_0x1dea69[_0xa190('0x33')]);_0x50dfb8[_0xa190('0x35')]=_[_0xa190('0x36')](_0x50dfb8[_0xa190('0x32')],_0x50dfb8['query']);_0x189600[_0xa190('0x38')]=_[_0xa190('0x36')](_0x50dfb8[_0xa190('0x32')],qs[_0xa190('0x37')](_0x1dea69[_0xa190('0x33')][_0xa190('0x37')]));_0x189600[_0xa190('0x38')]=_0x189600[_0xa190('0x38')][_0xa190('0x39')]?_0x189600[_0xa190('0x38')]:_0x50dfb8[_0xa190('0x32')];if(_0x1dea69[_0xa190('0x33')][_0xa190('0x44')]){_0x189600[_0xa190('0x45')]=[{'all':!![]}];}_0x189600=_['merge']({},_0x189600,_0x1dea69['options']);return db[_0xa190('0x2d')]['find'](_0x189600)[_0xa190('0x27')](handleEntityNotFound(_0x27281a,null))['then'](respondWithResult(_0x27281a,null))[_0xa190('0x47')](handleError(_0x27281a,null));};exports[_0xa190('0x4a')]=function(_0x370718,_0x3980b4){return db[_0xa190('0x2d')][_0xa190('0x4a')](_0x370718[_0xa190('0x4b')],{})['then'](respondWithResult(_0x3980b4,0xc9))[_0xa190('0x47')](handleError(_0x3980b4,null));};exports[_0xa190('0x4c')]=function(_0x2b1a90,_0x5d0cf9){if(_0x2b1a90['body']['id']){delete _0x2b1a90['body']['id'];}return db['ZendeskConfiguration']['find']({'where':{'id':_0x2b1a90['params']['id']}})[_0xa190('0x27')](handleEntityNotFound(_0x5d0cf9,null))[_0xa190('0x27')](saveUpdates(_0x2b1a90['body'],null))[_0xa190('0x27')](respondWithResult(_0x5d0cf9,null))[_0xa190('0x47')](handleError(_0x5d0cf9,null));};exports[_0xa190('0x4d')]=function(_0x6ae632,_0x562e23){return db['ZendeskConfiguration']['find']({'where':{'id':_0x6ae632[_0xa190('0x49')]['id']}})[_0xa190('0x27')](handleEntityNotFound(_0x562e23,null))[_0xa190('0x27')](removeEntity(_0x562e23,null))['catch'](handleError(_0x562e23,null));};exports[_0xa190('0x4e')]=function(_0x18680d,_0x2f6a91,_0x3cdbf2){var _0x267c8e={};var _0x489198={};var _0x10d500;var _0x2e37fb;return db[_0xa190('0x2d')]['findOne']({'where':{'id':_0x18680d[_0xa190('0x49')]['id']}})[_0xa190('0x27')](handleEntityNotFound(_0x2f6a91,null))[_0xa190('0x27')](function(_0x42745c){if(_0x42745c){_0x10d500=_0x42745c;_0x489198['model']=_[_0xa190('0x34')](db[_0xa190('0x4f')]['rawAttributes']);_0x489198['query']=_[_0xa190('0x34')](_0x18680d['query']);_0x489198[_0xa190('0x35')]=_[_0xa190('0x36')](_0x489198[_0xa190('0x32')],_0x489198[_0xa190('0x33')]);_0x267c8e[_0xa190('0x38')]=_[_0xa190('0x36')](_0x489198['model'],qs[_0xa190('0x37')](_0x18680d[_0xa190('0x33')][_0xa190('0x37')]));_0x267c8e[_0xa190('0x38')]=_0x267c8e['attributes'][_0xa190('0x39')]?_0x267c8e[_0xa190('0x38')]:_0x489198[_0xa190('0x32')];_0x267c8e[_0xa190('0x3c')]=qs[_0xa190('0x3d')](_0x18680d['query']['sort']);_0x267c8e[_0xa190('0x3e')]=qs[_0xa190('0x35')](_[_0xa190('0x3f')](_0x18680d[_0xa190('0x33')],_0x489198[_0xa190('0x35')]));if(_0x18680d['query'][_0xa190('0x40')]){_0x267c8e[_0xa190('0x3e')]=_[_0xa190('0x41')](_0x267c8e[_0xa190('0x3e')],{'$or':_[_0xa190('0x2c')](_0x267c8e[_0xa190('0x38')],function(_0x3ac245){var _0x31675a={};_0x31675a[_0x3ac245]={'$like':'%'+_0x18680d[_0xa190('0x33')][_0xa190('0x40')]+'%'};return _0x31675a;})});}_0x267c8e=_['merge']({},_0x267c8e,_0x18680d['options']);return _0x10d500[_0xa190('0x4e')](_0x267c8e);}})[_0xa190('0x27')](function(_0x53fea5){if(_0x53fea5){_0x2e37fb=_0x53fea5[_0xa190('0x39')];if(!_0x18680d[_0xa190('0x33')][_0xa190('0x3a')]('nolimit')){_0x267c8e[_0xa190('0x20')]=qs['limit'](_0x18680d[_0xa190('0x33')][_0xa190('0x20')]);_0x267c8e['offset']=qs[_0xa190('0x1e')](_0x18680d[_0xa190('0x33')][_0xa190('0x1e')]);}return _0x10d500[_0xa190('0x4e')](_0x267c8e);}})[_0xa190('0x27')](function(_0x1571e7){if(_0x1571e7){return _0x1571e7?{'count':_0x2e37fb,'rows':_0x1571e7}:null;}})[_0xa190('0x27')](respondWithResult(_0x2f6a91,null))[_0xa190('0x47')](handleError(_0x2f6a91,null));};exports[_0xa190('0x50')]=function(_0xced136,_0x490d9,_0x807432){var _0x4b9cec={};var _0x4524dd={};var _0x847da;var _0x33abe7;return db['ZendeskConfiguration'][_0xa190('0x51')]({'where':{'id':_0xced136[_0xa190('0x49')]['id']}})[_0xa190('0x27')](handleEntityNotFound(_0x490d9,null))['then'](function(_0x398745){if(_0x398745){_0x847da=_0x398745;_0x4524dd[_0xa190('0x32')]=_[_0xa190('0x34')](db[_0xa190('0x4f')]['rawAttributes']);_0x4524dd[_0xa190('0x33')]=_[_0xa190('0x34')](_0xced136[_0xa190('0x33')]);_0x4524dd[_0xa190('0x35')]=_[_0xa190('0x36')](_0x4524dd['model'],_0x4524dd['query']);_0x4b9cec[_0xa190('0x38')]=_['intersection'](_0x4524dd[_0xa190('0x32')],qs[_0xa190('0x37')](_0xced136[_0xa190('0x33')][_0xa190('0x37')]));_0x4b9cec[_0xa190('0x38')]=_0x4b9cec[_0xa190('0x38')]['length']?_0x4b9cec[_0xa190('0x38')]:_0x4524dd[_0xa190('0x32')];_0x4b9cec[_0xa190('0x3c')]=qs[_0xa190('0x3d')](_0xced136[_0xa190('0x33')][_0xa190('0x3d')]);_0x4b9cec['where']=qs[_0xa190('0x35')](_[_0xa190('0x3f')](_0xced136[_0xa190('0x33')],_0x4524dd[_0xa190('0x35')]));if(_0xced136[_0xa190('0x33')]['filter']){_0x4b9cec[_0xa190('0x3e')]=_[_0xa190('0x41')](_0x4b9cec['where'],{'$or':_[_0xa190('0x2c')](_0x4b9cec[_0xa190('0x38')],function(_0x127f5c){var _0x87a5c2={};_0x87a5c2[_0x127f5c]={'$like':'%'+_0xced136['query'][_0xa190('0x40')]+'%'};return _0x87a5c2;})});}_0x4b9cec=_[_0xa190('0x41')]({},_0x4b9cec,_0xced136[_0xa190('0x43')]);return _0x847da[_0xa190('0x50')](_0x4b9cec);}})['then'](function(_0x202e80){if(_0x202e80){_0x33abe7=_0x202e80[_0xa190('0x39')];if(!_0xced136[_0xa190('0x33')][_0xa190('0x3a')](_0xa190('0x3b'))){_0x4b9cec[_0xa190('0x20')]=qs[_0xa190('0x20')](_0xced136['query']['limit']);_0x4b9cec['offset']=qs[_0xa190('0x1e')](_0xced136[_0xa190('0x33')][_0xa190('0x1e')]);}return _0x847da[_0xa190('0x50')](_0x4b9cec);}})[_0xa190('0x27')](function(_0x4979e0){if(_0x4979e0){return _0x4979e0?{'count':_0x33abe7,'rows':_0x4979e0}:null;}})[_0xa190('0x27')](respondWithResult(_0x490d9,null))['catch'](handleError(_0x490d9,null));};exports[_0xa190('0x52')]=function(_0x4b78fd,_0xa35471,_0x15718b){var _0x9ad7c1={};var _0x50a2ee={};var _0x3525cf;var _0x1be0a5;return db[_0xa190('0x2d')][_0xa190('0x51')]({'where':{'id':_0x4b78fd[_0xa190('0x49')]['id']}})[_0xa190('0x27')](handleEntityNotFound(_0xa35471,null))[_0xa190('0x27')](function(_0x180575){if(_0x180575){_0x3525cf=_0x180575;_0x50a2ee[_0xa190('0x32')]=_['keys'](db['ZendeskField']['rawAttributes']);_0x50a2ee[_0xa190('0x33')]=_[_0xa190('0x34')](_0x4b78fd[_0xa190('0x33')]);_0x50a2ee[_0xa190('0x35')]=_[_0xa190('0x36')](_0x50a2ee[_0xa190('0x32')],_0x50a2ee[_0xa190('0x33')]);_0x9ad7c1['attributes']=_[_0xa190('0x36')](_0x50a2ee['model'],qs[_0xa190('0x37')](_0x4b78fd[_0xa190('0x33')][_0xa190('0x37')]));_0x9ad7c1[_0xa190('0x38')]=_0x9ad7c1[_0xa190('0x38')][_0xa190('0x39')]?_0x9ad7c1[_0xa190('0x38')]:_0x50a2ee[_0xa190('0x32')];_0x9ad7c1[_0xa190('0x3c')]=qs[_0xa190('0x3d')](_0x4b78fd[_0xa190('0x33')][_0xa190('0x3d')]);_0x9ad7c1['where']=qs['filters'](_[_0xa190('0x3f')](_0x4b78fd[_0xa190('0x33')],_0x50a2ee['filters']));if(_0x4b78fd[_0xa190('0x33')][_0xa190('0x40')]){_0x9ad7c1[_0xa190('0x3e')]=_[_0xa190('0x41')](_0x9ad7c1['where'],{'$or':_['map'](_0x9ad7c1['attributes'],function(_0x2ac06e){var _0x22b99f={};_0x22b99f[_0x2ac06e]={'$like':'%'+_0x4b78fd[_0xa190('0x33')]['filter']+'%'};return _0x22b99f;})});}_0x9ad7c1=_[_0xa190('0x41')]({},_0x9ad7c1,_0x4b78fd[_0xa190('0x43')]);return _0x3525cf['getDescriptions'](_0x9ad7c1);}})['then'](function(_0x3a4668){if(_0x3a4668){_0x1be0a5=_0x3a4668[_0xa190('0x39')];if(!_0x4b78fd[_0xa190('0x33')][_0xa190('0x3a')](_0xa190('0x3b'))){_0x9ad7c1[_0xa190('0x20')]=qs[_0xa190('0x20')](_0x4b78fd[_0xa190('0x33')]['limit']);_0x9ad7c1[_0xa190('0x1e')]=qs[_0xa190('0x1e')](_0x4b78fd[_0xa190('0x33')][_0xa190('0x1e')]);}return _0x3525cf[_0xa190('0x52')](_0x9ad7c1);}})[_0xa190('0x27')](function(_0x1aeb29){if(_0x1aeb29){return _0x1aeb29?{'count':_0x1be0a5,'rows':_0x1aeb29}:null;}})[_0xa190('0x27')](respondWithResult(_0xa35471,null))['catch'](handleError(_0xa35471,null));};exports[_0xa190('0x53')]=function(_0x337266,_0x4f4cae,_0x4d23f7){var _0x2c9928={};var _0x32a8fe={};var _0x5aa8f3;var _0x49aa58;return db['ZendeskConfiguration'][_0xa190('0x51')]({'where':{'id':_0x337266[_0xa190('0x49')]['id']}})[_0xa190('0x27')](handleEntityNotFound(_0x4f4cae,null))[_0xa190('0x27')](function(_0x567a4b){if(_0x567a4b){_0x5aa8f3=_0x567a4b;_0x32a8fe[_0xa190('0x32')]=_['keys'](db[_0xa190('0x54')][_0xa190('0x2e')]);_0x32a8fe[_0xa190('0x33')]=_[_0xa190('0x34')](_0x337266['query']);_0x32a8fe[_0xa190('0x35')]=_['intersection'](_0x32a8fe[_0xa190('0x32')],_0x32a8fe[_0xa190('0x33')]);_0x2c9928[_0xa190('0x38')]=_[_0xa190('0x36')](_0x32a8fe['model'],qs[_0xa190('0x37')](_0x337266[_0xa190('0x33')][_0xa190('0x37')]));_0x2c9928['attributes']=_0x2c9928[_0xa190('0x38')][_0xa190('0x39')]?_0x2c9928[_0xa190('0x38')]:_0x32a8fe[_0xa190('0x32')];_0x2c9928[_0xa190('0x3c')]=qs[_0xa190('0x3d')](_0x337266[_0xa190('0x33')][_0xa190('0x3d')]);_0x2c9928[_0xa190('0x3e')]=qs[_0xa190('0x35')](_[_0xa190('0x3f')](_0x337266[_0xa190('0x33')],_0x32a8fe[_0xa190('0x35')]));if(_0x337266[_0xa190('0x33')][_0xa190('0x40')]){_0x2c9928[_0xa190('0x3e')]=_[_0xa190('0x41')](_0x2c9928['where'],{'$or':_['map'](_0x2c9928[_0xa190('0x38')],function(_0x27e5ee){var _0x3053ee={};_0x3053ee[_0x27e5ee]={'$like':'%'+_0x337266[_0xa190('0x33')][_0xa190('0x40')]+'%'};return _0x3053ee;})});}_0x2c9928=_[_0xa190('0x41')]({},_0x2c9928,_0x337266['options']);return _0x5aa8f3[_0xa190('0x53')](_0x2c9928);}})['then'](function(_0x10dd80){if(_0x10dd80){_0x49aa58=_0x10dd80[_0xa190('0x39')];if(!_0x337266[_0xa190('0x33')][_0xa190('0x3a')](_0xa190('0x3b'))){_0x2c9928['limit']=qs[_0xa190('0x20')](_0x337266[_0xa190('0x33')]['limit']);_0x2c9928[_0xa190('0x1e')]=qs[_0xa190('0x1e')](_0x337266[_0xa190('0x33')][_0xa190('0x1e')]);}return _0x5aa8f3[_0xa190('0x53')](_0x2c9928);}})[_0xa190('0x27')](function(_0x51f1e1){if(_0x51f1e1){return _0x51f1e1?{'count':_0x49aa58,'rows':_0x51f1e1}:null;}})[_0xa190('0x27')](respondWithResult(_0x4f4cae,null))['catch'](handleError(_0x4f4cae,null));};exports[_0xa190('0x55')]=function(_0x188dfa,_0x50be4f,_0x5a0ca8){if(_0x188dfa[_0xa190('0x4b')]['id']){delete _0x188dfa[_0xa190('0x4b')]['id'];}return db[_0xa190('0x2d')][_0xa190('0x51')]({'where':{'id':_0x188dfa[_0xa190('0x49')]['id']}})['then'](handleEntityNotFound(_0x50be4f,null))['then'](function(_0x300b8c){if(_0x300b8c){return _0x300b8c[_0xa190('0x55')](_0x188dfa[_0xa190('0x4b')]['ids']||[]);}return null;})[_0xa190('0x27')](respondWithResult(_0x50be4f,null))['catch'](handleError(_0x50be4f,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 079ee30..2d81b26 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 _0x8f4c=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','ZendeskConfiguration'];(function(_0x12a5b8,_0x3ba542){var _0x24542c=function(_0x222ff2){while(--_0x222ff2){_0x12a5b8['push'](_0x12a5b8['shift']());}};_0x24542c(++_0x3ba542);}(_0x8f4c,0x113));var _0xc8f4=function(_0x32113d,_0x185cc4){_0x32113d=_0x32113d-0x0;var _0x270024=_0x8f4c[_0x32113d];return _0x270024;};'use strict';var _=require(_0xc8f4('0x0'));var util=require(_0xc8f4('0x1'));var logger=require(_0xc8f4('0x2'))(_0xc8f4('0x3'));var moment=require(_0xc8f4('0x4'));var BPromise=require(_0xc8f4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc8f4('0x6'));var rimraf=require(_0xc8f4('0x7'));var config=require(_0xc8f4('0x8'));var attributes=require('./intZendeskConfiguration.attributes');module[_0xc8f4('0x9')]=function(_0x5208da,_0x4c86f8){return _0x5208da['define'](_0xc8f4('0xa'),attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfff0=['./intZendeskConfiguration.attributes','define','int_zendesk_configurations','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0xfff0,0x139));var _0x0fff=function(_0x22b4fe,_0x28201c){_0x22b4fe=_0x22b4fe-0x0;var _0x1141af=_0xfff0[_0x22b4fe];return _0x1141af;};'use strict';var _=require('lodash');var util=require(_0x0fff('0x0'));var logger=require(_0x0fff('0x1'))(_0x0fff('0x2'));var moment=require('moment');var BPromise=require(_0x0fff('0x3'));var rp=require(_0x0fff('0x4'));var fs=require('fs');var path=require(_0x0fff('0x5'));var rimraf=require('rimraf');var config=require(_0x0fff('0x6'));var attributes=require(_0x0fff('0x7'));module['exports']=function(_0x33c813,_0x4c2221){return _0x33c813[_0x0fff('0x8')]('ZendeskConfiguration',attributes,{'tableName':_0x0fff('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index 0bb1373..bb70de5 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 _0x699f=['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','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','http','request'];(function(_0x43dcb6,_0x24cf04){var _0x58385a=function(_0x33f079){while(--_0x33f079){_0x43dcb6['push'](_0x43dcb6['shift']());}};_0x58385a(++_0x24cf04);}(_0x699f,0xbc));var _0xf699=function(_0x3a2a3c,_0x37bd31){_0x3a2a3c=_0x3a2a3c-0x0;var _0x50ac9a=_0x699f[_0x3a2a3c];return _0x50ac9a;};'use strict';var _=require(_0xf699('0x0'));var util=require(_0xf699('0x1'));var moment=require(_0xf699('0x2'));var BPromise=require('bluebird');var rs=require(_0xf699('0x3'));var fs=require('fs');var Redis=require(_0xf699('0x4'));var db=require(_0xf699('0x5'))['db'];var utils=require(_0xf699('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xf699('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf699('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x52e097,_0x1d8bae,_0x5bdaae){return new BPromise(function(_0x59eea4,_0x1fdd00){return client[_0xf699('0x9')](_0x52e097,_0x5bdaae)[_0xf699('0xa')](function(_0x2edb55){logger[_0xf699('0xb')](_0xf699('0xc'),_0x1d8bae,_0xf699('0xd'));logger[_0xf699('0xe')](_0xf699('0xf'),_0x1d8bae,_0xf699('0xd'),JSON[_0xf699('0x10')](_0x2edb55));if(_0x2edb55['error']){if(_0x2edb55[_0xf699('0x11')][_0xf699('0x12')]===0x1f4){logger[_0xf699('0x11')](_0xf699('0xc'),_0x1d8bae,_0x2edb55[_0xf699('0x11')][_0xf699('0x13')]);return _0x1fdd00(_0x2edb55[_0xf699('0x11')][_0xf699('0x13')]);}logger[_0xf699('0x11')](_0xf699('0xc'),_0x1d8bae,_0x2edb55['error'][_0xf699('0x13')]);return _0x59eea4(_0x2edb55['error']['message']);}else{logger['info'](_0xf699('0xc'),_0x1d8bae,_0xf699('0xd'));_0x59eea4(_0x2edb55[_0xf699('0x14')][_0xf699('0x13')]);}})[_0xf699('0x15')](function(_0x37ee84){logger[_0xf699('0x11')]('ZendeskConfiguration,\x20%s,\x20%s',_0x1d8bae,_0x37ee84);_0x1fdd00(_0x37ee84);});});} \ No newline at end of file +var _0xe5e1=['debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','ZendeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','info','request\x20sent'];(function(_0x74fd69,_0x12027d){var _0x14cca1=function(_0x270f2f){while(--_0x270f2f){_0x74fd69['push'](_0x74fd69['shift']());}};_0x14cca1(++_0x12027d);}(_0xe5e1,0x158));var _0x1e5e=function(_0x487849,_0x55d05e){_0x487849=_0x487849-0x0;var _0xd3a665=_0xe5e1[_0x487849];return _0xd3a665;};'use strict';var _=require(_0x1e5e('0x0'));var util=require(_0x1e5e('0x1'));var moment=require(_0x1e5e('0x2'));var BPromise=require(_0x1e5e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1e5e('0x4'));var db=require(_0x1e5e('0x5'))['db'];var utils=require(_0x1e5e('0x6'));var logger=require(_0x1e5e('0x7'))(_0x1e5e('0x8'));var config=require(_0x1e5e('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1e5e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x14b94e,_0x499855,_0x55c971){return new BPromise(function(_0x5bcd0e,_0x46846f){return client['request'](_0x14b94e,_0x55c971)['then'](function(_0x4be2f8){logger[_0x1e5e('0xb')]('ZendeskConfiguration,\x20%s,\x20%s',_0x499855,_0x1e5e('0xc'));logger[_0x1e5e('0xd')](_0x1e5e('0xe'),_0x499855,'request\x20sent',JSON['stringify'](_0x4be2f8));if(_0x4be2f8[_0x1e5e('0xf')]){if(_0x4be2f8[_0x1e5e('0xf')][_0x1e5e('0x10')]===0x1f4){logger[_0x1e5e('0xf')](_0x1e5e('0x11'),_0x499855,_0x4be2f8[_0x1e5e('0xf')][_0x1e5e('0x12')]);return _0x46846f(_0x4be2f8[_0x1e5e('0xf')][_0x1e5e('0x12')]);}logger[_0x1e5e('0xf')]('ZendeskConfiguration,\x20%s,\x20%s',_0x499855,_0x4be2f8[_0x1e5e('0xf')]['message']);return _0x5bcd0e(_0x4be2f8[_0x1e5e('0xf')]['message']);}else{logger[_0x1e5e('0xb')](_0x1e5e('0x11'),_0x499855,_0x1e5e('0xc'));_0x5bcd0e(_0x4be2f8[_0x1e5e('0x13')]['message']);}})[_0x1e5e('0x14')](function(_0x193f89){logger[_0x1e5e('0xf')](_0x1e5e('0x11'),_0x499855,_0x193f89);_0x46846f(_0x193f89);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 8e960bc..cae1e82 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 _0x2c00=['show','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','/:id'];(function(_0x1f582e,_0xf71df4){var _0x3f1462=function(_0x23ccdf){while(--_0x23ccdf){_0x1f582e['push'](_0x1f582e['shift']());}};_0x3f1462(++_0xf71df4);}(_0x2c00,0x12e));var _0x02c0=function(_0x582274,_0x2cbd9c){_0x582274=_0x582274-0x0;var _0x8f14d3=_0x2c00[_0x582274];return _0x8f14d3;};'use strict';var multer=require(_0x02c0('0x0'));var util=require(_0x02c0('0x1'));var path=require(_0x02c0('0x2'));var timeout=require('connect-timeout');var express=require(_0x02c0('0x3'));var router=express[_0x02c0('0x4')]();var fs_extra=require(_0x02c0('0x5'));var auth=require(_0x02c0('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x02c0('0x7'));var controller=require(_0x02c0('0x8'));router[_0x02c0('0x9')]('/',auth[_0x02c0('0xa')](),controller[_0x02c0('0xb')]);router[_0x02c0('0x9')](_0x02c0('0xc'),auth[_0x02c0('0xa')](),controller[_0x02c0('0xd')]);router[_0x02c0('0xe')]('/',auth[_0x02c0('0xa')](),controller[_0x02c0('0xf')]);router[_0x02c0('0x10')](_0x02c0('0xc'),auth[_0x02c0('0xa')](),controller[_0x02c0('0x11')]);router[_0x02c0('0x12')]('/:id',auth[_0x02c0('0xa')](),controller[_0x02c0('0x13')]);module[_0x02c0('0x14')]=router; \ No newline at end of file +var _0x2251=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','put','update','/:id'];(function(_0x3b4b6a,_0x2070fe){var _0x595086=function(_0x196c7a){while(--_0x196c7a){_0x3b4b6a['push'](_0x3b4b6a['shift']());}};_0x595086(++_0x2070fe);}(_0x2251,0x66));var _0x1225=function(_0x37b646,_0x4f34e9){_0x37b646=_0x37b646-0x0;var _0x6deef3=_0x2251[_0x37b646];return _0x6deef3;};'use strict';var multer=require(_0x1225('0x0'));var util=require(_0x1225('0x1'));var path=require(_0x1225('0x2'));var timeout=require(_0x1225('0x3'));var express=require(_0x1225('0x4'));var router=express[_0x1225('0x5')]();var fs_extra=require(_0x1225('0x6'));var auth=require(_0x1225('0x7'));var interaction=require(_0x1225('0x8'));var config=require(_0x1225('0x9'));var controller=require('./intZendeskField.controller');router[_0x1225('0xa')]('/',auth[_0x1225('0xb')](),controller[_0x1225('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x1225('0xd')]);router[_0x1225('0xe')]('/',auth[_0x1225('0xb')](),controller['create']);router[_0x1225('0xf')]('/:id',auth[_0x1225('0xb')](),controller[_0x1225('0x10')]);router['delete'](_0x1225('0x11'),auth[_0x1225('0xb')](),controller[_0x1225('0x12')]);module[_0x1225('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index fc014d7..d5c6ceb 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 _0xcecd=['keyValue','picklist','string','STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','variable'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xcecd,0x1e6));var _0xdcec=function(_0x197b63,_0x4ffdfb){_0x197b63=_0x197b63-0x0;var _0x476965=_0xcecd[_0x197b63];return _0x476965;};'use strict';var Sequelize=require(_0xdcec('0x0'));module[_0xdcec('0x1')]={'type':{'type':Sequelize[_0xdcec('0x2')]('string',_0xdcec('0x3'),'customVariable',_0xdcec('0x4'),_0xdcec('0x5')),'defaultValue':_0xdcec('0x6')},'content':{'type':Sequelize[_0xdcec('0x7')]},'key':{'type':Sequelize[_0xdcec('0x7')]},'keyType':{'type':Sequelize[_0xdcec('0x2')]('string',_0xdcec('0x3'),_0xdcec('0x8'))},'keyContent':{'type':Sequelize[_0xdcec('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xdcec('0x7')]},'customField':{'type':Sequelize[_0xdcec('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdcec('0x7')]}}; \ No newline at end of file +var _0xdbce=['BOOLEAN','sequelize','exports','string','variable','customVariable','picklist','STRING'];(function(_0x520a3f,_0x57eba7){var _0x189b9e=function(_0x43c8c2){while(--_0x43c8c2){_0x520a3f['push'](_0x520a3f['shift']());}};_0x189b9e(++_0x57eba7);}(_0xdbce,0xa1));var _0xedbc=function(_0x34fd5e,_0x5e35b2){_0x34fd5e=_0x34fd5e-0x0;var _0x3877b9=_0xdbce[_0x34fd5e];return _0x3877b9;};'use strict';var Sequelize=require(_0xedbc('0x0'));module[_0xedbc('0x1')]={'type':{'type':Sequelize['ENUM'](_0xedbc('0x2'),_0xedbc('0x3'),_0xedbc('0x4'),'keyValue',_0xedbc('0x5')),'defaultValue':_0xedbc('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xedbc('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xedbc('0x2'),'variable',_0xedbc('0x4'))},'keyContent':{'type':Sequelize[_0xedbc('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xedbc('0x6')]},'customField':{'type':Sequelize[_0xedbc('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xedbc('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 59da5c7..65719ea 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 _0xf01b=['reject','save','update','then','destroy','error','stack','send','map','rawAttributes','fieldName','type','key','name','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','ZendeskField','includeAll','include','findAll','rows','show','params','model','options','find','create','body','catch','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply'];(function(_0x485f35,_0x45a0fc){var _0x2ad118=function(_0x296650){while(--_0x296650){_0x485f35['push'](_0x485f35['shift']());}};_0x2ad118(++_0x45a0fc);}(_0xf01b,0x167));var _0xbf01=function(_0x1842bc,_0x1aa1db){_0x1842bc=_0x1842bc-0x0;var _0x4020f4=_0xf01b[_0x1842bc];return _0x4020f4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbf01('0x0'));var zipdir=require(_0xbf01('0x1'));var jsonpatch=require(_0xbf01('0x2'));var rp=require(_0xbf01('0x3'));var moment=require(_0xbf01('0x4'));var BPromise=require(_0xbf01('0x5'));var Mustache=require(_0xbf01('0x6'));var util=require(_0xbf01('0x7'));var path=require('path');var sox=require(_0xbf01('0x8'));var csv=require(_0xbf01('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbf01('0xa'));var _=require('lodash');var squel=require(_0xbf01('0xb'));var crypto=require(_0xbf01('0xc'));var jsforce=require(_0xbf01('0xd'));var deskjs=require(_0xbf01('0xe'));var toCsv=require(_0xbf01('0x9'));var querystring=require(_0xbf01('0xf'));var Papa=require('papaparse');var Redis=require(_0xbf01('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xbf01('0x11'));var as=require(_0xbf01('0x12'));var hardwareService=require(_0xbf01('0x13'));var logger=require(_0xbf01('0x14'))('api');var utils=require(_0xbf01('0x15'));var config=require(_0xbf01('0x16'));var licenseUtil=require(_0xbf01('0x17'));var db=require(_0xbf01('0x18'))['db'];function respondWithStatusCode(_0x53274b,_0x40ca5d){_0x40ca5d=_0x40ca5d||0xcc;return function(_0x1b5561){if(_0x1b5561){return _0x53274b[_0xbf01('0x19')](_0x40ca5d);}return _0x53274b[_0xbf01('0x1a')](_0x40ca5d)[_0xbf01('0x1b')]();};}function respondWithResult(_0x539f29,_0x637368){_0x637368=_0x637368||0xc8;return function(_0x27a191){if(_0x27a191){return _0x539f29[_0xbf01('0x1a')](_0x637368)[_0xbf01('0x1c')](_0x27a191);}};}function respondWithFilteredResult(_0x5bd59c,_0x4e86a3){return function(_0x7081ef){if(_0x7081ef){var _0x130d38=typeof _0x4e86a3[_0xbf01('0x1d')]===_0xbf01('0x1e')&&typeof _0x4e86a3[_0xbf01('0x1f')]==='undefined';var _0x56c7cf=_0x7081ef[_0xbf01('0x20')];var _0x2a08ce=_0x130d38?0x0:_0x4e86a3[_0xbf01('0x1d')];var _0x2f8717=_0x130d38?_0x7081ef[_0xbf01('0x20')]:_0x4e86a3['offset']+_0x4e86a3[_0xbf01('0x1f')];var _0x177a60;if(_0x2f8717>=_0x56c7cf){_0x2f8717=_0x56c7cf;_0x177a60=0xc8;}else{_0x177a60=0xce;}_0x5bd59c[_0xbf01('0x1a')](_0x177a60);return _0x5bd59c[_0xbf01('0x21')](_0xbf01('0x22'),_0x2a08ce+'-'+_0x2f8717+'/'+_0x56c7cf)[_0xbf01('0x1c')](_0x7081ef);}return null;};}function patchUpdates(_0x4ef93d){return function(_0x1bd803){try{jsonpatch[_0xbf01('0x23')](_0x1bd803,_0x4ef93d,!![]);}catch(_0x3c1d53){return BPromise[_0xbf01('0x24')](_0x3c1d53);}return _0x1bd803[_0xbf01('0x25')]();};}function saveUpdates(_0x195f17,_0x5c50a5){return function(_0x9aa599){if(_0x9aa599){return _0x9aa599[_0xbf01('0x26')](_0x195f17)[_0xbf01('0x27')](function(_0x37dfee){return _0x37dfee;});}return null;};}function removeEntity(_0x22b6b8,_0x4614a5){return function(_0x158c7d){if(_0x158c7d){return _0x158c7d[_0xbf01('0x28')]()[_0xbf01('0x27')](function(){_0x22b6b8[_0xbf01('0x1a')](0xcc)[_0xbf01('0x1b')]();});}};}function handleEntityNotFound(_0x580d90,_0x15bf92){return function(_0x488c17){if(!_0x488c17){_0x580d90[_0xbf01('0x19')](0x194);}return _0x488c17;};}function handleError(_0x41d174,_0x446b8b){_0x446b8b=_0x446b8b||0x1f4;return function(_0xcb7d74){logger[_0xbf01('0x29')](_0xcb7d74[_0xbf01('0x2a')]);if(_0xcb7d74['name']){delete _0xcb7d74['name'];}_0x41d174[_0xbf01('0x1a')](_0x446b8b)[_0xbf01('0x2b')](_0xcb7d74);};}exports['index']=function(_0x78f103,_0x279932){var _0x3ef668={},_0x396a8f={},_0xd42467={'count':0x0,'rows':[]};var _0x3a5f15=_[_0xbf01('0x2c')](db['ZendeskField'][_0xbf01('0x2d')],function(_0x427672){return{'name':_0x427672[_0xbf01('0x2e')],'type':_0x427672[_0xbf01('0x2f')][_0xbf01('0x30')]};});_0x396a8f['model']=_[_0xbf01('0x2c')](_0x3a5f15,_0xbf01('0x31'));_0x396a8f['query']=_[_0xbf01('0x32')](_0x78f103[_0xbf01('0x33')]);_0x396a8f['filters']=_[_0xbf01('0x34')](_0x396a8f['model'],_0x396a8f[_0xbf01('0x33')]);_0x3ef668[_0xbf01('0x35')]=_[_0xbf01('0x34')](_0x396a8f['model'],qs['fields'](_0x78f103[_0xbf01('0x33')][_0xbf01('0x36')]));_0x3ef668[_0xbf01('0x35')]=_0x3ef668[_0xbf01('0x35')][_0xbf01('0x37')]?_0x3ef668['attributes']:_0x396a8f['model'];if(!_0x78f103[_0xbf01('0x33')][_0xbf01('0x38')](_0xbf01('0x39'))){_0x3ef668['limit']=qs['limit'](_0x78f103[_0xbf01('0x33')]['limit']);_0x3ef668['offset']=qs[_0xbf01('0x1d')](_0x78f103[_0xbf01('0x33')]['offset']);}_0x3ef668[_0xbf01('0x3a')]=qs[_0xbf01('0x3b')](_0x78f103[_0xbf01('0x33')]['sort']);_0x3ef668[_0xbf01('0x3c')]=qs[_0xbf01('0x3d')](_[_0xbf01('0x3e')](_0x78f103['query'],_0x396a8f[_0xbf01('0x3d')]),_0x3a5f15);if(_0x78f103[_0xbf01('0x33')][_0xbf01('0x3f')]){_0x3ef668[_0xbf01('0x3c')]=_[_0xbf01('0x40')](_0x3ef668[_0xbf01('0x3c')],{'$or':_[_0xbf01('0x2c')](_0x3a5f15,function(_0x2ce190){if(_0x2ce190[_0xbf01('0x2f')]!==_0xbf01('0x41')){var _0x21be82={};_0x21be82[_0x2ce190[_0xbf01('0x31')]]={'$like':'%'+_0x78f103['query'][_0xbf01('0x3f')]+'%'};return _0x21be82;}})});}_0x3ef668=_[_0xbf01('0x40')]({},_0x3ef668,_0x78f103['options']);var _0x5296d0={'where':_0x3ef668[_0xbf01('0x3c')]};return db[_0xbf01('0x42')][_0xbf01('0x20')](_0x5296d0)[_0xbf01('0x27')](function(_0x3c9608){_0xd42467['count']=_0x3c9608;if(_0x78f103[_0xbf01('0x33')][_0xbf01('0x43')]){_0x3ef668[_0xbf01('0x44')]=[{'all':!![]}];}return db[_0xbf01('0x42')][_0xbf01('0x45')](_0x3ef668);})['then'](function(_0x3c8f51){_0xd42467[_0xbf01('0x46')]=_0x3c8f51;return _0xd42467;})[_0xbf01('0x27')](respondWithFilteredResult(_0x279932,_0x3ef668))['catch'](handleError(_0x279932,null));};exports[_0xbf01('0x47')]=function(_0x5a9a65,_0x39242a){var _0x1134e7={'raw':!![],'where':{'id':_0x5a9a65[_0xbf01('0x48')]['id']}},_0x4089c4={};_0x4089c4[_0xbf01('0x49')]=_[_0xbf01('0x32')](db[_0xbf01('0x42')][_0xbf01('0x2d')]);_0x4089c4[_0xbf01('0x33')]=_[_0xbf01('0x32')](_0x5a9a65[_0xbf01('0x33')]);_0x4089c4[_0xbf01('0x3d')]=_[_0xbf01('0x34')](_0x4089c4[_0xbf01('0x49')],_0x4089c4[_0xbf01('0x33')]);_0x1134e7[_0xbf01('0x35')]=_[_0xbf01('0x34')](_0x4089c4[_0xbf01('0x49')],qs['fields'](_0x5a9a65[_0xbf01('0x33')][_0xbf01('0x36')]));_0x1134e7[_0xbf01('0x35')]=_0x1134e7['attributes'][_0xbf01('0x37')]?_0x1134e7['attributes']:_0x4089c4['model'];if(_0x5a9a65[_0xbf01('0x33')][_0xbf01('0x43')]){_0x1134e7[_0xbf01('0x44')]=[{'all':!![]}];}_0x1134e7=_['merge']({},_0x1134e7,_0x5a9a65[_0xbf01('0x4a')]);return db[_0xbf01('0x42')][_0xbf01('0x4b')](_0x1134e7)[_0xbf01('0x27')](handleEntityNotFound(_0x39242a,null))[_0xbf01('0x27')](respondWithResult(_0x39242a,null))['catch'](handleError(_0x39242a,null));};exports[_0xbf01('0x4c')]=function(_0x29c3d0,_0x123f3a){return db['ZendeskField'][_0xbf01('0x4c')](_0x29c3d0[_0xbf01('0x4d')],{})[_0xbf01('0x27')](respondWithResult(_0x123f3a,0xc9))[_0xbf01('0x4e')](handleError(_0x123f3a,null));};exports[_0xbf01('0x26')]=function(_0x480819,_0x43b7c1){if(_0x480819['body']['id']){delete _0x480819['body']['id'];}return db[_0xbf01('0x42')][_0xbf01('0x4b')]({'where':{'id':_0x480819[_0xbf01('0x48')]['id']}})[_0xbf01('0x27')](handleEntityNotFound(_0x43b7c1,null))[_0xbf01('0x27')](saveUpdates(_0x480819[_0xbf01('0x4d')],null))[_0xbf01('0x27')](respondWithResult(_0x43b7c1,null))['catch'](handleError(_0x43b7c1,null));};exports['destroy']=function(_0x2b9bfd,_0x1cd506){return db['ZendeskField'][_0xbf01('0x4b')]({'where':{'id':_0x2b9bfd[_0xbf01('0x48')]['id']}})[_0xbf01('0x27')](handleEntityNotFound(_0x1cd506,null))[_0xbf01('0x27')](removeEntity(_0x1cd506,null))[_0xbf01('0x4e')](handleError(_0x1cd506,null));}; \ No newline at end of file +var _0x43f5=['includeAll','include','findAll','show','params','rawAttributes','intersection','find','create','body','catch','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','api','../../config/utils','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','destroy','then','sendStatus','error','stack','name','send','index','ZendeskField','fieldName','type','key','map','query','keys','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','where','merge','VIRTUAL','options'];(function(_0x201211,_0x2e2788){var _0x3641da=function(_0xfb58b4){while(--_0xfb58b4){_0x201211['push'](_0x201211['shift']());}};_0x3641da(++_0x2e2788);}(_0x43f5,0x9d));var _0x543f=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x43f5[_0x59ee6f];return _0x4c0979;};'use strict';var emlformat=require(_0x543f('0x0'));var rimraf=require(_0x543f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x543f('0x2'));var rp=require(_0x543f('0x3'));var moment=require(_0x543f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x543f('0x5'));var util=require(_0x543f('0x6'));var path=require(_0x543f('0x7'));var sox=require(_0x543f('0x8'));var csv=require(_0x543f('0x9'));var ejs=require(_0x543f('0xa'));var fs=require('fs');var fs_extra=require(_0x543f('0xb'));var _=require(_0x543f('0xc'));var squel=require('squel');var crypto=require(_0x543f('0xd'));var jsforce=require(_0x543f('0xe'));var deskjs=require(_0x543f('0xf'));var toCsv=require(_0x543f('0x9'));var querystring=require(_0x543f('0x10'));var Papa=require('papaparse');var Redis=require(_0x543f('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x543f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x543f('0x13'));var utils=require(_0x543f('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2df78b,_0x7cd9de){_0x7cd9de=_0x7cd9de||0xcc;return function(_0x3e9d1b){if(_0x3e9d1b){return _0x2df78b['sendStatus'](_0x7cd9de);}return _0x2df78b[_0x543f('0x15')](_0x7cd9de)[_0x543f('0x16')]();};}function respondWithResult(_0x1eb1c,_0x4b7ffb){_0x4b7ffb=_0x4b7ffb||0xc8;return function(_0x2fadd7){if(_0x2fadd7){return _0x1eb1c[_0x543f('0x15')](_0x4b7ffb)['json'](_0x2fadd7);}};}function respondWithFilteredResult(_0x59cf7e,_0xe6c6d1){return function(_0x5e879d){if(_0x5e879d){var _0x17b54c=typeof _0xe6c6d1[_0x543f('0x17')]===_0x543f('0x18')&&typeof _0xe6c6d1[_0x543f('0x19')]==='undefined';var _0x7a522d=_0x5e879d[_0x543f('0x1a')];var _0x212219=_0x17b54c?0x0:_0xe6c6d1[_0x543f('0x17')];var _0x3264bd=_0x17b54c?_0x5e879d[_0x543f('0x1a')]:_0xe6c6d1['offset']+_0xe6c6d1['limit'];var _0xbe5034;if(_0x3264bd>=_0x7a522d){_0x3264bd=_0x7a522d;_0xbe5034=0xc8;}else{_0xbe5034=0xce;}_0x59cf7e[_0x543f('0x15')](_0xbe5034);return _0x59cf7e[_0x543f('0x1b')](_0x543f('0x1c'),_0x212219+'-'+_0x3264bd+'/'+_0x7a522d)[_0x543f('0x1d')](_0x5e879d);}return null;};}function patchUpdates(_0x5ae65b){return function(_0xc39bce){try{jsonpatch[_0x543f('0x1e')](_0xc39bce,_0x5ae65b,!![]);}catch(_0xab996e){return BPromise['reject'](_0xab996e);}return _0xc39bce[_0x543f('0x1f')]();};}function saveUpdates(_0x18fbaf,_0xd3a0a1){return function(_0x4fa1cc){if(_0x4fa1cc){return _0x4fa1cc[_0x543f('0x20')](_0x18fbaf)['then'](function(_0x3961f8){return _0x3961f8;});}return null;};}function removeEntity(_0x49701c,_0x3914d3){return function(_0x5a9bc1){if(_0x5a9bc1){return _0x5a9bc1[_0x543f('0x21')]()[_0x543f('0x22')](function(){_0x49701c[_0x543f('0x15')](0xcc)[_0x543f('0x16')]();});}};}function handleEntityNotFound(_0x2827a3,_0x1a1b51){return function(_0x3c2108){if(!_0x3c2108){_0x2827a3[_0x543f('0x23')](0x194);}return _0x3c2108;};}function handleError(_0x1de959,_0x17b22b){_0x17b22b=_0x17b22b||0x1f4;return function(_0x2c22c8){logger[_0x543f('0x24')](_0x2c22c8[_0x543f('0x25')]);if(_0x2c22c8['name']){delete _0x2c22c8[_0x543f('0x26')];}_0x1de959[_0x543f('0x15')](_0x17b22b)[_0x543f('0x27')](_0x2c22c8);};}exports[_0x543f('0x28')]=function(_0x1c0495,_0x7f9c7b){var _0x1b31e6={},_0x5773cc={},_0x82694d={'count':0x0,'rows':[]};var _0x40412f=_['map'](db[_0x543f('0x29')]['rawAttributes'],function(_0x5ede7b){return{'name':_0x5ede7b[_0x543f('0x2a')],'type':_0x5ede7b[_0x543f('0x2b')][_0x543f('0x2c')]};});_0x5773cc['model']=_[_0x543f('0x2d')](_0x40412f,_0x543f('0x26'));_0x5773cc[_0x543f('0x2e')]=_[_0x543f('0x2f')](_0x1c0495[_0x543f('0x2e')]);_0x5773cc['filters']=_['intersection'](_0x5773cc[_0x543f('0x30')],_0x5773cc['query']);_0x1b31e6[_0x543f('0x31')]=_['intersection'](_0x5773cc[_0x543f('0x30')],qs['fields'](_0x1c0495[_0x543f('0x2e')][_0x543f('0x32')]));_0x1b31e6[_0x543f('0x31')]=_0x1b31e6['attributes'][_0x543f('0x33')]?_0x1b31e6['attributes']:_0x5773cc[_0x543f('0x30')];if(!_0x1c0495[_0x543f('0x2e')][_0x543f('0x34')](_0x543f('0x35'))){_0x1b31e6[_0x543f('0x19')]=qs[_0x543f('0x19')](_0x1c0495[_0x543f('0x2e')][_0x543f('0x19')]);_0x1b31e6[_0x543f('0x17')]=qs['offset'](_0x1c0495[_0x543f('0x2e')]['offset']);}_0x1b31e6[_0x543f('0x36')]=qs[_0x543f('0x37')](_0x1c0495[_0x543f('0x2e')]['sort']);_0x1b31e6['where']=qs['filters'](_[_0x543f('0x38')](_0x1c0495[_0x543f('0x2e')],_0x5773cc[_0x543f('0x39')]),_0x40412f);if(_0x1c0495[_0x543f('0x2e')]['filter']){_0x1b31e6[_0x543f('0x3a')]=_[_0x543f('0x3b')](_0x1b31e6[_0x543f('0x3a')],{'$or':_[_0x543f('0x2d')](_0x40412f,function(_0x458609){if(_0x458609['type']!==_0x543f('0x3c')){var _0x3891cd={};_0x3891cd[_0x458609[_0x543f('0x26')]]={'$like':'%'+_0x1c0495[_0x543f('0x2e')]['filter']+'%'};return _0x3891cd;}})});}_0x1b31e6=_[_0x543f('0x3b')]({},_0x1b31e6,_0x1c0495[_0x543f('0x3d')]);var _0x327957={'where':_0x1b31e6['where']};return db[_0x543f('0x29')][_0x543f('0x1a')](_0x327957)[_0x543f('0x22')](function(_0x5da661){_0x82694d[_0x543f('0x1a')]=_0x5da661;if(_0x1c0495[_0x543f('0x2e')][_0x543f('0x3e')]){_0x1b31e6[_0x543f('0x3f')]=[{'all':!![]}];}return db[_0x543f('0x29')][_0x543f('0x40')](_0x1b31e6);})[_0x543f('0x22')](function(_0x635cbf){_0x82694d['rows']=_0x635cbf;return _0x82694d;})[_0x543f('0x22')](respondWithFilteredResult(_0x7f9c7b,_0x1b31e6))['catch'](handleError(_0x7f9c7b,null));};exports[_0x543f('0x41')]=function(_0x1c1c00,_0x31bf58){var _0x2c4afd={'raw':!![],'where':{'id':_0x1c1c00[_0x543f('0x42')]['id']}},_0x1e52cb={};_0x1e52cb['model']=_[_0x543f('0x2f')](db[_0x543f('0x29')][_0x543f('0x43')]);_0x1e52cb[_0x543f('0x2e')]=_[_0x543f('0x2f')](_0x1c1c00[_0x543f('0x2e')]);_0x1e52cb[_0x543f('0x39')]=_[_0x543f('0x44')](_0x1e52cb[_0x543f('0x30')],_0x1e52cb[_0x543f('0x2e')]);_0x2c4afd[_0x543f('0x31')]=_[_0x543f('0x44')](_0x1e52cb[_0x543f('0x30')],qs[_0x543f('0x32')](_0x1c1c00[_0x543f('0x2e')]['fields']));_0x2c4afd[_0x543f('0x31')]=_0x2c4afd[_0x543f('0x31')][_0x543f('0x33')]?_0x2c4afd[_0x543f('0x31')]:_0x1e52cb['model'];if(_0x1c1c00[_0x543f('0x2e')][_0x543f('0x3e')]){_0x2c4afd['include']=[{'all':!![]}];}_0x2c4afd=_[_0x543f('0x3b')]({},_0x2c4afd,_0x1c1c00[_0x543f('0x3d')]);return db['ZendeskField'][_0x543f('0x45')](_0x2c4afd)[_0x543f('0x22')](handleEntityNotFound(_0x31bf58,null))[_0x543f('0x22')](respondWithResult(_0x31bf58,null))['catch'](handleError(_0x31bf58,null));};exports['create']=function(_0x45eddb,_0x1af1e5){return db[_0x543f('0x29')][_0x543f('0x46')](_0x45eddb[_0x543f('0x47')],{})[_0x543f('0x22')](respondWithResult(_0x1af1e5,0xc9))[_0x543f('0x48')](handleError(_0x1af1e5,null));};exports[_0x543f('0x20')]=function(_0x38d4cc,_0xb7146e){if(_0x38d4cc[_0x543f('0x47')]['id']){delete _0x38d4cc[_0x543f('0x47')]['id'];}return db[_0x543f('0x29')]['find']({'where':{'id':_0x38d4cc[_0x543f('0x42')]['id']}})[_0x543f('0x22')](handleEntityNotFound(_0xb7146e,null))[_0x543f('0x22')](saveUpdates(_0x38d4cc[_0x543f('0x47')],null))[_0x543f('0x22')](respondWithResult(_0xb7146e,null))[_0x543f('0x48')](handleError(_0xb7146e,null));};exports['destroy']=function(_0x57b39a,_0x5601cc){return db[_0x543f('0x29')][_0x543f('0x45')]({'where':{'id':_0x57b39a[_0x543f('0x42')]['id']}})['then'](handleEntityNotFound(_0x5601cc,null))[_0x543f('0x22')](removeEntity(_0x5601cc,null))[_0x543f('0x48')](handleError(_0x5601cc,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 7687ab5..21936b0 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 _0x5aa7=['../../config/logger','api','bluebird','request-promise','path','../../config/environment','./intZendeskField.attributes','exports','define','ZendeskField','zendesk_unique_index','idField','FieldId','lodash','util'];(function(_0x551630,_0x571bb9){var _0x5312fa=function(_0x1e0a22){while(--_0x1e0a22){_0x551630['push'](_0x551630['shift']());}};_0x5312fa(++_0x571bb9);}(_0x5aa7,0x94));var _0x75aa=function(_0x477361,_0x450ebc){_0x477361=_0x477361-0x0;var _0x2bd912=_0x5aa7[_0x477361];return _0x2bd912;};'use strict';var _=require(_0x75aa('0x0'));var util=require(_0x75aa('0x1'));var logger=require(_0x75aa('0x2'))(_0x75aa('0x3'));var moment=require('moment');var BPromise=require(_0x75aa('0x4'));var rp=require(_0x75aa('0x5'));var fs=require('fs');var path=require(_0x75aa('0x6'));var rimraf=require('rimraf');var config=require(_0x75aa('0x7'));var attributes=require(_0x75aa('0x8'));module[_0x75aa('0x9')]=function(_0x40f898,_0x186428){return _0x40f898[_0x75aa('0xa')](_0x75aa('0xb'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0x75aa('0xc'),'fields':[_0x75aa('0xd'),_0x75aa('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8b36=['./intZendeskField.attributes','exports','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','path','rimraf'];(function(_0x553e41,_0x33cd36){var _0x7ec113=function(_0x425300){while(--_0x425300){_0x553e41['push'](_0x553e41['shift']());}};_0x7ec113(++_0x33cd36);}(_0x8b36,0x1cd));var _0x68b3=function(_0x5cbf66,_0x2f127f){_0x5cbf66=_0x5cbf66-0x0;var _0x47927e=_0x8b36[_0x5cbf66];return _0x47927e;};'use strict';var _=require(_0x68b3('0x0'));var util=require(_0x68b3('0x1'));var logger=require(_0x68b3('0x2'))(_0x68b3('0x3'));var moment=require(_0x68b3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x68b3('0x5'));var rimraf=require(_0x68b3('0x6'));var config=require('../../config/environment');var attributes=require(_0x68b3('0x7'));module[_0x68b3('0x8')]=function(_0x57b53a,_0x1e09e7){return _0x57b53a['define']('ZendeskField',attributes,{'tableName':_0x68b3('0x9'),'paranoid':![],'indexes':[{'name':_0x68b3('0xa'),'fields':[_0x68b3('0xb'),_0x68b3('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index a3badbf..3c650e7 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 _0x3745=['request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http'];(function(_0x47df54,_0x1aeb61){var _0x261b87=function(_0x54bc77){while(--_0x54bc77){_0x47df54['push'](_0x47df54['shift']());}};_0x261b87(++_0x1aeb61);}(_0x3745,0x1e6));var _0x5374=function(_0x34725a,_0x443114){_0x34725a=_0x34725a-0x0;var _0x1739ef=_0x3745[_0x34725a];return _0x1739ef;};'use strict';var _=require('lodash');var util=require(_0x5374('0x0'));var moment=require(_0x5374('0x1'));var BPromise=require(_0x5374('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5374('0x3'))['db'];var utils=require(_0x5374('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x5374('0x5'));var jayson=require(_0x5374('0x6'));var client=jayson['client'][_0x5374('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x21ad86,_0x565a0b,_0x11bfb8){return new BPromise(function(_0xae743,_0x5717b){return client[_0x5374('0x8')](_0x21ad86,_0x11bfb8)[_0x5374('0x9')](function(_0x175448){logger[_0x5374('0xa')](_0x5374('0xb'),_0x565a0b,_0x5374('0xc'));logger[_0x5374('0xd')](_0x5374('0xe'),_0x565a0b,_0x5374('0xc'),JSON['stringify'](_0x175448));if(_0x175448['error']){if(_0x175448[_0x5374('0xf')][_0x5374('0x10')]===0x1f4){logger['error'](_0x5374('0xb'),_0x565a0b,_0x175448[_0x5374('0xf')][_0x5374('0x11')]);return _0x5717b(_0x175448['error'][_0x5374('0x11')]);}logger[_0x5374('0xf')](_0x5374('0xb'),_0x565a0b,_0x175448[_0x5374('0xf')][_0x5374('0x11')]);return _0xae743(_0x175448['error']['message']);}else{logger[_0x5374('0xa')](_0x5374('0xb'),_0x565a0b,_0x5374('0xc'));_0xae743(_0x175448['result']['message']);}})[_0x5374('0x12')](function(_0x28a4d8){logger[_0x5374('0xf')](_0x5374('0xb'),_0x565a0b,_0x28a4d8);_0x5717b(_0x28a4d8);});});} \ No newline at end of file +var _0xf8c9=['../../config/environment','client','http','request','then','info','ZendeskField,\x20%s,\x20%s','debug','ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc'];(function(_0x17d76b,_0x54345b){var _0x16f3ac=function(_0x315442){while(--_0x315442){_0x17d76b['push'](_0x17d76b['shift']());}};_0x16f3ac(++_0x54345b);}(_0xf8c9,0xb1));var _0x9f8c=function(_0x31972b,_0x4e6f14){_0x31972b=_0x31972b-0x0;var _0x3451c1=_0xf8c9[_0x31972b];return _0x3451c1;};'use strict';var _=require(_0x9f8c('0x0'));var util=require(_0x9f8c('0x1'));var moment=require(_0x9f8c('0x2'));var BPromise=require('bluebird');var rs=require(_0x9f8c('0x3'));var fs=require('fs');var Redis=require(_0x9f8c('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9f8c('0x5'))(_0x9f8c('0x6'));var config=require(_0x9f8c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9f8c('0x8')][_0x9f8c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xfc8085,_0x2fdead,_0x451737){return new BPromise(function(_0x7b432a,_0x30b5aa){return client[_0x9f8c('0xa')](_0xfc8085,_0x451737)[_0x9f8c('0xb')](function(_0x4e78a8){logger[_0x9f8c('0xc')](_0x9f8c('0xd'),_0x2fdead,'request\x20sent');logger[_0x9f8c('0xe')](_0x9f8c('0xf'),_0x2fdead,_0x9f8c('0x10'),JSON[_0x9f8c('0x11')](_0x4e78a8));if(_0x4e78a8[_0x9f8c('0x12')]){if(_0x4e78a8['error'][_0x9f8c('0x13')]===0x1f4){logger[_0x9f8c('0x12')](_0x9f8c('0xd'),_0x2fdead,_0x4e78a8[_0x9f8c('0x12')][_0x9f8c('0x14')]);return _0x30b5aa(_0x4e78a8[_0x9f8c('0x12')][_0x9f8c('0x14')]);}logger['error']('ZendeskField,\x20%s,\x20%s',_0x2fdead,_0x4e78a8[_0x9f8c('0x12')]['message']);return _0x7b432a(_0x4e78a8[_0x9f8c('0x12')][_0x9f8c('0x14')]);}else{logger['info'](_0x9f8c('0xd'),_0x2fdead,'request\x20sent');_0x7b432a(_0x4e78a8[_0x9f8c('0x15')][_0x9f8c('0x14')]);}})[_0x9f8c('0x16')](function(_0x4b90d8){logger[_0x9f8c('0x12')](_0x9f8c('0xd'),_0x2fdead,_0x4b90d8);_0x30b5aa(_0x4b90d8);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index dc8f538..ad418ef 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 _0x80e5=['multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','create','post','addConfiguration','delete','destroy','exports'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x80e5,0x7e));var _0x580e=function(_0x5ff517,_0x3e4ee0){_0x5ff517=_0x5ff517-0x0;var _0x19a245=_0x80e5[_0x5ff517];return _0x19a245;};'use strict';var multer=require(_0x580e('0x0'));var util=require('util');var path=require(_0x580e('0x1'));var timeout=require(_0x580e('0x2'));var express=require('express');var router=express[_0x580e('0x3')]();var fs_extra=require(_0x580e('0x4'));var auth=require(_0x580e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x580e('0x6'));var controller=require('./intZohoAccount.controller');router[_0x580e('0x7')]('/',auth[_0x580e('0x8')](),controller[_0x580e('0x9')]);router[_0x580e('0x7')](_0x580e('0xa'),auth['isAuthenticated'](),controller[_0x580e('0xb')]);router['get'](_0x580e('0xc'),auth[_0x580e('0x8')](),controller[_0x580e('0xd')]);router[_0x580e('0x7')]('/:id/fields',auth[_0x580e('0x8')](),controller[_0x580e('0xe')]);router['post']('/',auth[_0x580e('0x8')](),controller[_0x580e('0xf')]);router[_0x580e('0x10')](_0x580e('0xc'),auth[_0x580e('0x8')](),controller[_0x580e('0x11')]);router['put'](_0x580e('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x580e('0x12')](_0x580e('0xa'),auth['isAuthenticated'](),controller[_0x580e('0x13')]);module[_0x580e('0x14')]=router; \ No newline at end of file +var _0x17ae=['index','/:id','/:id/fields','post','/:id/configurations','addConfiguration','put','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZohoAccount.controller','get','isAuthenticated'];(function(_0x10ca3c,_0x57dd68){var _0x30f446=function(_0x50f18f){while(--_0x50f18f){_0x10ca3c['push'](_0x10ca3c['shift']());}};_0x30f446(++_0x57dd68);}(_0x17ae,0x198));var _0xe17a=function(_0x3e6398,_0x5e8559){_0x3e6398=_0x3e6398-0x0;var _0x5b943b=_0x17ae[_0x3e6398];return _0x5b943b;};'use strict';var multer=require('multer');var util=require(_0xe17a('0x0'));var path=require(_0xe17a('0x1'));var timeout=require('connect-timeout');var express=require(_0xe17a('0x2'));var router=express[_0xe17a('0x3')]();var fs_extra=require(_0xe17a('0x4'));var auth=require(_0xe17a('0x5'));var interaction=require(_0xe17a('0x6'));var config=require('../../config/environment');var controller=require(_0xe17a('0x7'));router[_0xe17a('0x8')]('/',auth[_0xe17a('0x9')](),controller[_0xe17a('0xa')]);router[_0xe17a('0x8')](_0xe17a('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xe17a('0x8')]('/:id/configurations',auth[_0xe17a('0x9')](),controller['getConfigurations']);router[_0xe17a('0x8')](_0xe17a('0xc'),auth[_0xe17a('0x9')](),controller['getFields']);router[_0xe17a('0xd')]('/',auth[_0xe17a('0x9')](),controller['create']);router[_0xe17a('0xd')](_0xe17a('0xe'),auth[_0xe17a('0x9')](),controller[_0xe17a('0xf')]);router[_0xe17a('0x10')](_0xe17a('0xb'),auth[_0xe17a('0x9')](),controller['update']);router['delete'](_0xe17a('0xb'),auth['isAuthenticated'](),controller[_0xe17a('0x11')]);module[_0xe17a('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index ae86f6d..d7e0335 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 _0xdace=['STRING','sequelize'];(function(_0x255917,_0x1e17be){var _0x21b02f=function(_0x38e019){while(--_0x38e019){_0x255917['push'](_0x255917['shift']());}};_0x21b02f(++_0x1e17be);}(_0xdace,0xc5));var _0xedac=function(_0x571a17,_0x63fb3d){_0x571a17=_0x571a17-0x0;var _0x3ef337=_0xdace[_0x571a17];return _0x3ef337;};'use strict';var Sequelize=require(_0xedac('0x0'));module['exports']={'name':{'type':Sequelize[_0xedac('0x1')]},'description':{'type':Sequelize[_0xedac('0x1')]},'host':{'type':Sequelize[_0xedac('0x1')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xedac('0x1')]},'clientSecret':{'type':Sequelize[_0xedac('0x1')]},'serverUrl':{'type':Sequelize[_0xedac('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0xedac('0x1')]},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb821=['STRING','exports'];(function(_0x34bf97,_0xc60f9d){var _0x292719=function(_0x31354e){while(--_0x31354e){_0x34bf97['push'](_0x34bf97['shift']());}};_0x292719(++_0xc60f9d);}(_0xb821,0xa7));var _0x1b82=function(_0x20aab1,_0xc6d854){_0x20aab1=_0x20aab1-0x0;var _0x277dff=_0xb821[_0x20aab1];return _0x277dff;};'use strict';var Sequelize=require('sequelize');module[_0x1b82('0x0')]={'name':{'type':Sequelize[_0x1b82('0x1')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x1b82('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x1b82('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0x1b82('0x1')]},'refreshToken':{'type':Sequelize[_0x1b82('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 5cbbfdb..5a47f7e 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 _0xd5dc=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ZohoAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','sort','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','find','create','body','getConfigurations','findOne','ZohoConfiguration','pick','options','hasOwnProperty','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','refreshToken','clientSecret','refresh_token','access_token','getFields','host','clientId','code','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','Zoho-oauthtoken\x20','response','message','Description','WhoId','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','system_mandatory','push','display_label','custom_field','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse'];(function(_0x1c8c28,_0x3ee093){var _0x1f59b4=function(_0x29bcc0){while(--_0x29bcc0){_0x1c8c28['push'](_0x1c8c28['shift']());}};_0x1f59b4(++_0x3ee093);}(_0xd5dc,0x178));var _0xcd5d=function(_0x441070,_0x56479d){_0x441070=_0x441070-0x0;var _0x162254=_0xd5dc[_0x441070];return _0x162254;};'use strict';var emlformat=require(_0xcd5d('0x0'));var rimraf=require(_0xcd5d('0x1'));var zipdir=require(_0xcd5d('0x2'));var jsonpatch=require(_0xcd5d('0x3'));var rp=require(_0xcd5d('0x4'));var moment=require(_0xcd5d('0x5'));var BPromise=require(_0xcd5d('0x6'));var Mustache=require(_0xcd5d('0x7'));var util=require(_0xcd5d('0x8'));var path=require('path');var sox=require(_0xcd5d('0x9'));var csv=require(_0xcd5d('0xa'));var ejs=require(_0xcd5d('0xb'));var fs=require('fs');var fs_extra=require(_0xcd5d('0xc'));var _=require('lodash');var squel=require(_0xcd5d('0xd'));var crypto=require('crypto');var jsforce=require(_0xcd5d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xcd5d('0xa'));var querystring=require(_0xcd5d('0xf'));var Papa=require(_0xcd5d('0x10'));var Redis=require(_0xcd5d('0x11'));var authService=require(_0xcd5d('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xcd5d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcd5d('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xcd5d('0x15'));var licenseUtil=require(_0xcd5d('0x16'));var db=require(_0xcd5d('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5f0c4d,_0x4b9c53){_0x4b9c53=_0x4b9c53||0xcc;return function(_0x3bafe5){if(_0x3bafe5){return _0x5f0c4d[_0xcd5d('0x18')](_0x4b9c53);}return _0x5f0c4d[_0xcd5d('0x19')](_0x4b9c53)[_0xcd5d('0x1a')]();};}function respondWithResult(_0x4f1dcb,_0x2b6e5f){_0x2b6e5f=_0x2b6e5f||0xc8;return function(_0x47de85){if(_0x47de85){return _0x4f1dcb[_0xcd5d('0x19')](_0x2b6e5f)['json'](_0x47de85);}};}function respondWithFilteredResult(_0x5dcb53,_0x4ba369){return function(_0x56861a){if(_0x56861a){var _0x2cfc7c=typeof _0x4ba369['offset']===_0xcd5d('0x1b')&&typeof _0x4ba369[_0xcd5d('0x1c')]==='undefined';var _0x471920=_0x56861a[_0xcd5d('0x1d')];var _0x4c5800=_0x2cfc7c?0x0:_0x4ba369[_0xcd5d('0x1e')];var _0x35c064=_0x2cfc7c?_0x56861a['count']:_0x4ba369[_0xcd5d('0x1e')]+_0x4ba369[_0xcd5d('0x1c')];var _0x486f1a;if(_0x35c064>=_0x471920){_0x35c064=_0x471920;_0x486f1a=0xc8;}else{_0x486f1a=0xce;}_0x5dcb53[_0xcd5d('0x19')](_0x486f1a);return _0x5dcb53[_0xcd5d('0x1f')](_0xcd5d('0x20'),_0x4c5800+'-'+_0x35c064+'/'+_0x471920)[_0xcd5d('0x21')](_0x56861a);}return null;};}function patchUpdates(_0x2b3fec){return function(_0x3b8717){try{jsonpatch[_0xcd5d('0x22')](_0x3b8717,_0x2b3fec,!![]);}catch(_0x2c6228){return BPromise[_0xcd5d('0x23')](_0x2c6228);}return _0x3b8717[_0xcd5d('0x24')]();};}function saveUpdates(_0x10d830,_0x299346){return function(_0x4cb5ed){if(_0x4cb5ed){return _0x4cb5ed[_0xcd5d('0x25')](_0x10d830)[_0xcd5d('0x26')](function(_0x433139){return _0x433139;});}return null;};}function removeEntity(_0x2dfa75,_0x91a191){return function(_0x1034a3){if(_0x1034a3){return _0x1034a3[_0xcd5d('0x27')]()['then'](function(){_0x2dfa75['status'](0xcc)[_0xcd5d('0x1a')]();});}};}function handleEntityNotFound(_0x27e9dc,_0x13fdd4){return function(_0x2a9f72){if(!_0x2a9f72){_0x27e9dc[_0xcd5d('0x18')](0x194);}return _0x2a9f72;};}function handleError(_0x425020,_0x39a4ec){_0x39a4ec=_0x39a4ec||0x1f4;return function(_0x29b991){logger[_0xcd5d('0x28')](_0x29b991[_0xcd5d('0x29')]);if(_0x29b991[_0xcd5d('0x2a')]){delete _0x29b991[_0xcd5d('0x2a')];}_0x425020['status'](_0x39a4ec)[_0xcd5d('0x2b')](_0x29b991);};}exports[_0xcd5d('0x2c')]=function(_0x107279,_0x2c7c63){var _0x349138={},_0x5bf55b={},_0x4fb75b={'count':0x0,'rows':[]};var _0x26920a=_[_0xcd5d('0x2d')](db[_0xcd5d('0x2e')][_0xcd5d('0x2f')],function(_0x7f02f9){return{'name':_0x7f02f9[_0xcd5d('0x30')],'type':_0x7f02f9[_0xcd5d('0x31')][_0xcd5d('0x32')]};});_0x5bf55b[_0xcd5d('0x33')]=_[_0xcd5d('0x2d')](_0x26920a,_0xcd5d('0x2a'));_0x5bf55b['query']=_[_0xcd5d('0x34')](_0x107279[_0xcd5d('0x35')]);_0x5bf55b[_0xcd5d('0x36')]=_[_0xcd5d('0x37')](_0x5bf55b[_0xcd5d('0x33')],_0x5bf55b[_0xcd5d('0x35')]);_0x349138[_0xcd5d('0x38')]=_[_0xcd5d('0x37')](_0x5bf55b[_0xcd5d('0x33')],qs[_0xcd5d('0x39')](_0x107279[_0xcd5d('0x35')][_0xcd5d('0x39')]));_0x349138['attributes']=_0x349138[_0xcd5d('0x38')][_0xcd5d('0x3a')]?_0x349138['attributes']:_0x5bf55b['model'];if(!_0x107279['query']['hasOwnProperty'](_0xcd5d('0x3b'))){_0x349138['limit']=qs[_0xcd5d('0x1c')](_0x107279[_0xcd5d('0x35')]['limit']);_0x349138[_0xcd5d('0x1e')]=qs[_0xcd5d('0x1e')](_0x107279[_0xcd5d('0x35')]['offset']);}_0x349138['order']=qs[_0xcd5d('0x3c')](_0x107279[_0xcd5d('0x35')][_0xcd5d('0x3c')]);_0x349138['where']=qs[_0xcd5d('0x36')](_['pick'](_0x107279[_0xcd5d('0x35')],_0x5bf55b[_0xcd5d('0x36')]),_0x26920a);if(_0x107279[_0xcd5d('0x35')][_0xcd5d('0x3d')]){_0x349138[_0xcd5d('0x3e')]=_[_0xcd5d('0x3f')](_0x349138[_0xcd5d('0x3e')],{'$or':_[_0xcd5d('0x2d')](_0x26920a,function(_0x4efb87){if(_0x4efb87['type']!==_0xcd5d('0x40')){var _0x189ee3={};_0x189ee3[_0x4efb87[_0xcd5d('0x2a')]]={'$like':'%'+_0x107279[_0xcd5d('0x35')][_0xcd5d('0x3d')]+'%'};return _0x189ee3;}})});}_0x349138=_[_0xcd5d('0x3f')]({},_0x349138,_0x107279['options']);var _0x146b63={'where':_0x349138[_0xcd5d('0x3e')]};return db[_0xcd5d('0x2e')][_0xcd5d('0x1d')](_0x146b63)['then'](function(_0x1b8b5b){_0x4fb75b[_0xcd5d('0x1d')]=_0x1b8b5b;if(_0x107279[_0xcd5d('0x35')][_0xcd5d('0x41')]){_0x349138[_0xcd5d('0x42')]=[{'all':!![]}];}return db[_0xcd5d('0x2e')][_0xcd5d('0x43')](_0x349138);})[_0xcd5d('0x26')](function(_0x29fad1){_0x4fb75b[_0xcd5d('0x44')]=_0x29fad1;return _0x4fb75b;})[_0xcd5d('0x26')](respondWithFilteredResult(_0x2c7c63,_0x349138))[_0xcd5d('0x45')](handleError(_0x2c7c63,null));};exports['show']=function(_0x51bf0b,_0x59b01c){var _0x467d1f={'raw':![],'where':{'id':_0x51bf0b[_0xcd5d('0x46')]['id']}},_0x89e592={};_0x89e592[_0xcd5d('0x33')]=_[_0xcd5d('0x34')](db[_0xcd5d('0x2e')]['rawAttributes']);_0x89e592[_0xcd5d('0x35')]=_[_0xcd5d('0x34')](_0x51bf0b[_0xcd5d('0x35')]);_0x89e592[_0xcd5d('0x36')]=_[_0xcd5d('0x37')](_0x89e592['model'],_0x89e592['query']);_0x467d1f['attributes']=_['intersection'](_0x89e592[_0xcd5d('0x33')],qs[_0xcd5d('0x39')](_0x51bf0b[_0xcd5d('0x35')][_0xcd5d('0x39')]));_0x467d1f[_0xcd5d('0x38')]=_0x467d1f[_0xcd5d('0x38')][_0xcd5d('0x3a')]?_0x467d1f[_0xcd5d('0x38')]:_0x89e592[_0xcd5d('0x33')];if(_0x51bf0b[_0xcd5d('0x35')][_0xcd5d('0x41')]){_0x467d1f['include']=[{'all':!![]}];}_0x467d1f=_[_0xcd5d('0x3f')]({},_0x467d1f,_0x51bf0b['options']);return db[_0xcd5d('0x2e')][_0xcd5d('0x47')](_0x467d1f)[_0xcd5d('0x26')](handleEntityNotFound(_0x59b01c,null))[_0xcd5d('0x26')](respondWithResult(_0x59b01c,null))[_0xcd5d('0x45')](handleError(_0x59b01c,null));};exports[_0xcd5d('0x48')]=function(_0x4c169f,_0x57d7be){return db[_0xcd5d('0x2e')][_0xcd5d('0x48')](_0x4c169f[_0xcd5d('0x49')],{})[_0xcd5d('0x26')](respondWithResult(_0x57d7be,0xc9))['catch'](handleError(_0x57d7be,null));};exports['update']=function(_0x8dcde7,_0x478425){if(_0x8dcde7[_0xcd5d('0x49')]['id']){delete _0x8dcde7['body']['id'];}return db['ZohoAccount'][_0xcd5d('0x47')]({'where':{'id':_0x8dcde7['params']['id']}})['then'](handleEntityNotFound(_0x478425,null))[_0xcd5d('0x26')](saveUpdates(_0x8dcde7[_0xcd5d('0x49')],null))[_0xcd5d('0x26')](respondWithResult(_0x478425,null))[_0xcd5d('0x45')](handleError(_0x478425,null));};exports[_0xcd5d('0x27')]=function(_0x1605e8,_0x39e446){return db['ZohoAccount']['find']({'where':{'id':_0x1605e8[_0xcd5d('0x46')]['id']}})[_0xcd5d('0x26')](handleEntityNotFound(_0x39e446,null))[_0xcd5d('0x26')](removeEntity(_0x39e446,null))[_0xcd5d('0x45')](handleError(_0x39e446,null));};exports[_0xcd5d('0x4a')]=function(_0x101dc3,_0x42989d,_0x3bb6b2){var _0x3336e7={};var _0x3b37da={};var _0x524452;var _0x445b1c;return db[_0xcd5d('0x2e')][_0xcd5d('0x4b')]({'where':{'id':_0x101dc3['params']['id']}})[_0xcd5d('0x26')](handleEntityNotFound(_0x42989d,null))[_0xcd5d('0x26')](function(_0x1efe7c){if(_0x1efe7c){_0x524452=_0x1efe7c;_0x3b37da[_0xcd5d('0x33')]=_['keys'](db[_0xcd5d('0x4c')][_0xcd5d('0x2f')]);_0x3b37da['query']=_['keys'](_0x101dc3['query']);_0x3b37da[_0xcd5d('0x36')]=_['intersection'](_0x3b37da[_0xcd5d('0x33')],_0x3b37da[_0xcd5d('0x35')]);_0x3336e7[_0xcd5d('0x38')]=_['intersection'](_0x3b37da[_0xcd5d('0x33')],qs[_0xcd5d('0x39')](_0x101dc3[_0xcd5d('0x35')][_0xcd5d('0x39')]));_0x3336e7[_0xcd5d('0x38')]=_0x3336e7['attributes'][_0xcd5d('0x3a')]?_0x3336e7[_0xcd5d('0x38')]:_0x3b37da[_0xcd5d('0x33')];_0x3336e7['order']=qs['sort'](_0x101dc3[_0xcd5d('0x35')]['sort']);_0x3336e7[_0xcd5d('0x3e')]=qs['filters'](_[_0xcd5d('0x4d')](_0x101dc3[_0xcd5d('0x35')],_0x3b37da['filters']));if(_0x101dc3['query'][_0xcd5d('0x3d')]){_0x3336e7[_0xcd5d('0x3e')]=_['merge'](_0x3336e7['where'],{'$or':_[_0xcd5d('0x2d')](_0x3336e7['attributes'],function(_0x1e392b){var _0x1a55ad={};_0x1a55ad[_0x1e392b]={'$like':'%'+_0x101dc3['query'][_0xcd5d('0x3d')]+'%'};return _0x1a55ad;})});}_0x3336e7=_['merge']({},_0x3336e7,_0x101dc3[_0xcd5d('0x4e')]);return _0x524452[_0xcd5d('0x4a')](_0x3336e7);}})[_0xcd5d('0x26')](function(_0x22372e){if(_0x22372e){_0x445b1c=_0x22372e[_0xcd5d('0x3a')];if(!_0x101dc3[_0xcd5d('0x35')][_0xcd5d('0x4f')]('nolimit')){_0x3336e7[_0xcd5d('0x1c')]=qs[_0xcd5d('0x1c')](_0x101dc3['query'][_0xcd5d('0x1c')]);_0x3336e7[_0xcd5d('0x1e')]=qs[_0xcd5d('0x1e')](_0x101dc3[_0xcd5d('0x35')][_0xcd5d('0x1e')]);}return _0x524452[_0xcd5d('0x4a')](_0x3336e7);}})['then'](function(_0x25e369){if(_0x25e369){return _0x25e369?{'count':_0x445b1c,'rows':_0x25e369}:null;}})[_0xcd5d('0x26')](respondWithResult(_0x42989d,null))[_0xcd5d('0x45')](handleError(_0x42989d,null));};exports[_0xcd5d('0x50')]=function(_0x1e393c,_0x11bd42,_0x418987){if(_0x1e393c['body']['id']){delete _0x1e393c[_0xcd5d('0x49')]['id'];}return db[_0xcd5d('0x2e')][_0xcd5d('0x4b')]({'where':{'id':_0x1e393c[_0xcd5d('0x46')]['id']}})[_0xcd5d('0x26')](handleEntityNotFound(_0x11bd42,null))[_0xcd5d('0x26')](function(_0x233089){if(_0x233089){_0x1e393c['body'][_0xcd5d('0x51')]=_0x233089['id'];_0x1e393c[_0xcd5d('0x49')][_0xcd5d('0x52')]=integrations['getSubjects'](_0x1e393c[_0xcd5d('0x49')][_0xcd5d('0x53')],_0x1e393c[_0xcd5d('0x49')][_0xcd5d('0x31')]);_0x1e393c[_0xcd5d('0x49')][_0xcd5d('0x54')]=integrations[_0xcd5d('0x55')](_0x1e393c[_0xcd5d('0x49')]['channel'],_0x1e393c[_0xcd5d('0x49')][_0xcd5d('0x31')]);return db[_0xcd5d('0x4c')][_0xcd5d('0x48')](_0x1e393c['body'],{'include':[{'model':db['ZohoField'],'as':_0xcd5d('0x52')},{'model':db[_0xcd5d('0x56')],'as':'Descriptions'}]});}return null;})[_0xcd5d('0x26')](respondWithResult(_0x11bd42,null))[_0xcd5d('0x45')](handleError(_0x11bd42,null));};function getAccessToken(_0x4c7276){return new Promise(function(_0x76eb87,_0x531722){var _0x16ac63;switch(_0x4c7276[_0xcd5d('0x57')]){case'US':_0x16ac63=_0xcd5d('0x58');break;case'AU':_0x16ac63=_0xcd5d('0x59');break;case'EU':_0x16ac63='https://accounts.zoho.eu';break;case'IN':_0x16ac63=_0xcd5d('0x5a');break;case'CN':_0x16ac63=_0xcd5d('0x5b');break;default:_0x16ac63=_0xcd5d('0x5c');break;}var _0x4c27e7={'method':'POST','uri':_0x16ac63+_0xcd5d('0x5d'),'qs':{'refresh_token':_0x4c7276[_0xcd5d('0x5e')],'client_id':_0x4c7276['clientId'],'client_secret':_0x4c7276[_0xcd5d('0x5f')],'grant_type':_0xcd5d('0x60')},'json':!![]};return rp(_0x4c27e7)[_0xcd5d('0x26')](function(_0x4223d2){if(_0x4223d2[_0xcd5d('0x61')]){_0x76eb87(_0x4223d2[_0xcd5d('0x61')]);}else{_0x531722('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0xcd5d('0x45')](function(_0x3233cb){_0x531722(_0x3233cb);});});}exports[_0xcd5d('0x62')]=function(_0x32e55a,_0x2d1c0f,_0x5997ab){var _0x280ce7,_0x85373,_0x1c9631,_0x289a66,_0x342af9;return db[_0xcd5d('0x2e')][_0xcd5d('0x4b')]({'where':{'id':_0x32e55a[_0xcd5d('0x46')]['id']},'attributes':['id',_0xcd5d('0x63'),_0xcd5d('0x57'),_0xcd5d('0x64'),_0xcd5d('0x5f'),'serverUrl',_0xcd5d('0x65'),_0xcd5d('0x5e')]})[_0xcd5d('0x26')](handleEntityNotFound(_0x2d1c0f,null))['then'](function(_0x53409f){_0x342af9=_0x53409f;_0x280ce7=_0x342af9[_0xcd5d('0x63')];_0x85373=_0x280ce7==='zoho.eu'?'eu':_0xcd5d('0x66');_0x1c9631=_0x342af9['serverUrl'];var _0x19b956=_0x1c9631[_0xcd5d('0x67')](-0x1);if(_0x19b956==='/'||_0x19b956==='\x5c'||_0x19b956===':'){_0x1c9631=_0x1c9631[_0xcd5d('0x68')](0x0,_0x1c9631[_0xcd5d('0x69')](_0x19b956));}if(!_0x342af9[_0xcd5d('0x5e')]){throw new Error(_0xcd5d('0x6a'));}return getAccessToken(_0x342af9);})['then'](function(_0x34901b){if(_0x34901b){return rp({'method':_0xcd5d('0x6b'),'uri':util[_0xcd5d('0x6c')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x85373),'qs':{'module':'Calls'},'headers':{'Authorization':_0xcd5d('0x6d')+_0x34901b},'json':!![]});}})[_0xcd5d('0x26')](function(_0x5da291){if(_0x5da291){if(_0x5da291[_0xcd5d('0x6e')]&&_0x5da291[_0xcd5d('0x6e')][_0xcd5d('0x28')]){throw new Error(_0x5da291[_0xcd5d('0x6e')]['error'][_0xcd5d('0x6f')]);}var _0x2c24ac=[];var _0x3ee02d=[];var _0x1fc50d=['Owner','Subject',_0xcd5d('0x70'),_0xcd5d('0x71'),'Call_Duration',_0xcd5d('0x72'),_0xcd5d('0x73'),_0xcd5d('0x74')];_0x3ee02d=_[_0xcd5d('0x75')](_0x5da291[_0xcd5d('0x39')],function(_0x346a23){return _0x1fc50d[_0xcd5d('0x76')](_0x346a23[_0xcd5d('0x77')]);});for(var _0x4bb048=0x0;_0x4bb048<_0x3ee02d[_0xcd5d('0x3a')];_0x4bb048++){if(_0x3ee02d[_0x4bb048][_0xcd5d('0x78')]===![]){_0x2c24ac[_0xcd5d('0x79')]({'id':_0x3ee02d[_0x4bb048]['id'],'name':_0x3ee02d[_0x4bb048][_0xcd5d('0x7a')],'custom':_0x3ee02d[_0x4bb048][_0xcd5d('0x7b')],'options':_0x3ee02d[_0x4bb048][_0xcd5d('0x7c')]===_0xcd5d('0x7d')&&_0x3ee02d[_0x4bb048][_0xcd5d('0x7e')][_0xcd5d('0x3a')]>-0x1?_[_0xcd5d('0x2d')](_0x3ee02d[_0x4bb048][_0xcd5d('0x7e')],function(_0x7e562d){return{'name':_0x7e562d,'value':_0x7e562d};}):[]});}}return{'count':_0x2c24ac['length'],'rows':_0x2c24ac};}else{return{'count':0x0,'rows':[]};}})[_0xcd5d('0x26')](respondWithResult(_0x2d1c0f,null))[_0xcd5d('0x45')](function(_0x24c2a5){var _0x225db8=_0x32e55a[_0xcd5d('0x35')][_0xcd5d('0x7f')]?0x1f4:_0x24c2a5[_0xcd5d('0x80')]||0x1f4;logger['error'](_0xcd5d('0x81'),_0xcd5d('0x62'),_0x225db8,JSON['stringify'](_0x24c2a5));delete _0x24c2a5[_0xcd5d('0x2a')];if(_0x225db8===0x191){_0x225db8=0x190;}_0x2d1c0f[_0xcd5d('0x19')](_0x225db8)[_0xcd5d('0x2b')](_0x32e55a['query'][_0xcd5d('0x7f')]?{'message':_0xcd5d('0x82'),'statusCode':_0x24c2a5[_0xcd5d('0x80')]}:_0x24c2a5);});}; \ No newline at end of file +var _0x8ab4=['addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','ZohoField','zone','https://accounts.zoho.in','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','getFields','host','serverUrl','zoho.eu','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','response','Owner','Subject','WhoId','Call_Duration','Call_Result','Call_Type','remove','system_mandatory','push','display_label','custom_field','picklist','pick_list_values','test','statusCode','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','ZohoAccount','includeAll','findAll','rows','show','include','find','catch','create','body','params','getConfigurations','findOne','ZohoConfiguration','rawAttributes'];(function(_0x31081f,_0x24916a){var _0x4cdd11=function(_0x38e782){while(--_0x38e782){_0x31081f['push'](_0x31081f['shift']());}};_0x4cdd11(++_0x24916a);}(_0x8ab4,0x137));var _0x48ab=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x8ab4[_0x465028];return _0xb783d4;};'use strict';var emlformat=require(_0x48ab('0x0'));var rimraf=require(_0x48ab('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x48ab('0x2'));var rp=require('request-promise');var moment=require(_0x48ab('0x3'));var BPromise=require(_0x48ab('0x4'));var Mustache=require(_0x48ab('0x5'));var util=require(_0x48ab('0x6'));var path=require(_0x48ab('0x7'));var sox=require(_0x48ab('0x8'));var csv=require(_0x48ab('0x9'));var ejs=require(_0x48ab('0xa'));var fs=require('fs');var fs_extra=require(_0x48ab('0xb'));var _=require(_0x48ab('0xc'));var squel=require(_0x48ab('0xd'));var crypto=require(_0x48ab('0xe'));var jsforce=require(_0x48ab('0xf'));var deskjs=require(_0x48ab('0x10'));var toCsv=require('to-csv');var querystring=require(_0x48ab('0x11'));var Papa=require(_0x48ab('0x12'));var Redis=require(_0x48ab('0x13'));var authService=require(_0x48ab('0x14'));var qs=require(_0x48ab('0x15'));var as=require(_0x48ab('0x16'));var hardwareService=require(_0x48ab('0x17'));var logger=require(_0x48ab('0x18'))(_0x48ab('0x19'));var utils=require('../../config/utils');var config=require(_0x48ab('0x1a'));var licenseUtil=require(_0x48ab('0x1b'));var db=require(_0x48ab('0x1c'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x56ffb6,_0x499a70){_0x499a70=_0x499a70||0xcc;return function(_0x5950ce){if(_0x5950ce){return _0x56ffb6[_0x48ab('0x1d')](_0x499a70);}return _0x56ffb6[_0x48ab('0x1e')](_0x499a70)[_0x48ab('0x1f')]();};}function respondWithResult(_0x5a62f0,_0x5c4204){_0x5c4204=_0x5c4204||0xc8;return function(_0x2b050e){if(_0x2b050e){return _0x5a62f0[_0x48ab('0x1e')](_0x5c4204)[_0x48ab('0x20')](_0x2b050e);}};}function respondWithFilteredResult(_0x5e8fcc,_0x31eece){return function(_0x240503){if(_0x240503){var _0x125724=typeof _0x31eece[_0x48ab('0x21')]==='undefined'&&typeof _0x31eece[_0x48ab('0x22')]==='undefined';var _0x23345b=_0x240503[_0x48ab('0x23')];var _0x14fd09=_0x125724?0x0:_0x31eece[_0x48ab('0x21')];var _0x4d1bb8=_0x125724?_0x240503['count']:_0x31eece[_0x48ab('0x21')]+_0x31eece['limit'];var _0x40f284;if(_0x4d1bb8>=_0x23345b){_0x4d1bb8=_0x23345b;_0x40f284=0xc8;}else{_0x40f284=0xce;}_0x5e8fcc[_0x48ab('0x1e')](_0x40f284);return _0x5e8fcc[_0x48ab('0x24')](_0x48ab('0x25'),_0x14fd09+'-'+_0x4d1bb8+'/'+_0x23345b)[_0x48ab('0x20')](_0x240503);}return null;};}function patchUpdates(_0x276b4f){return function(_0x19d871){try{jsonpatch[_0x48ab('0x26')](_0x19d871,_0x276b4f,!![]);}catch(_0x1419c5){return BPromise['reject'](_0x1419c5);}return _0x19d871[_0x48ab('0x27')]();};}function saveUpdates(_0x2ef919,_0x498c0b){return function(_0x2e99f5){if(_0x2e99f5){return _0x2e99f5[_0x48ab('0x28')](_0x2ef919)[_0x48ab('0x29')](function(_0x1acfff){return _0x1acfff;});}return null;};}function removeEntity(_0x4ff9e3,_0x559cba){return function(_0x42e1c7){if(_0x42e1c7){return _0x42e1c7[_0x48ab('0x2a')]()['then'](function(){_0x4ff9e3[_0x48ab('0x1e')](0xcc)[_0x48ab('0x1f')]();});}};}function handleEntityNotFound(_0x2c42ae,_0x5a9c5f){return function(_0xeb1ef8){if(!_0xeb1ef8){_0x2c42ae[_0x48ab('0x1d')](0x194);}return _0xeb1ef8;};}function handleError(_0x18c1bb,_0xa50e43){_0xa50e43=_0xa50e43||0x1f4;return function(_0x14b1b6){logger[_0x48ab('0x2b')](_0x14b1b6[_0x48ab('0x2c')]);if(_0x14b1b6[_0x48ab('0x2d')]){delete _0x14b1b6[_0x48ab('0x2d')];}_0x18c1bb[_0x48ab('0x1e')](_0xa50e43)[_0x48ab('0x2e')](_0x14b1b6);};}exports[_0x48ab('0x2f')]=function(_0x1cc4c5,_0x58859){var _0x57da19={},_0x5efc13={},_0x5946ff={'count':0x0,'rows':[]};var _0xc973d5=_[_0x48ab('0x30')](db['ZohoAccount']['rawAttributes'],function(_0x122e97){return{'name':_0x122e97['fieldName'],'type':_0x122e97[_0x48ab('0x31')][_0x48ab('0x32')]};});_0x5efc13[_0x48ab('0x33')]=_[_0x48ab('0x30')](_0xc973d5,_0x48ab('0x2d'));_0x5efc13[_0x48ab('0x34')]=_[_0x48ab('0x35')](_0x1cc4c5['query']);_0x5efc13[_0x48ab('0x36')]=_[_0x48ab('0x37')](_0x5efc13[_0x48ab('0x33')],_0x5efc13[_0x48ab('0x34')]);_0x57da19[_0x48ab('0x38')]=_[_0x48ab('0x37')](_0x5efc13[_0x48ab('0x33')],qs[_0x48ab('0x39')](_0x1cc4c5['query'][_0x48ab('0x39')]));_0x57da19[_0x48ab('0x38')]=_0x57da19[_0x48ab('0x38')][_0x48ab('0x3a')]?_0x57da19['attributes']:_0x5efc13[_0x48ab('0x33')];if(!_0x1cc4c5[_0x48ab('0x34')][_0x48ab('0x3b')](_0x48ab('0x3c'))){_0x57da19[_0x48ab('0x22')]=qs['limit'](_0x1cc4c5[_0x48ab('0x34')][_0x48ab('0x22')]);_0x57da19[_0x48ab('0x21')]=qs['offset'](_0x1cc4c5[_0x48ab('0x34')][_0x48ab('0x21')]);}_0x57da19['order']=qs[_0x48ab('0x3d')](_0x1cc4c5['query']['sort']);_0x57da19['where']=qs[_0x48ab('0x36')](_[_0x48ab('0x3e')](_0x1cc4c5[_0x48ab('0x34')],_0x5efc13[_0x48ab('0x36')]),_0xc973d5);if(_0x1cc4c5[_0x48ab('0x34')][_0x48ab('0x3f')]){_0x57da19[_0x48ab('0x40')]=_[_0x48ab('0x41')](_0x57da19[_0x48ab('0x40')],{'$or':_[_0x48ab('0x30')](_0xc973d5,function(_0xbfb401){if(_0xbfb401[_0x48ab('0x31')]!=='VIRTUAL'){var _0x329f74={};_0x329f74[_0xbfb401['name']]={'$like':'%'+_0x1cc4c5[_0x48ab('0x34')][_0x48ab('0x3f')]+'%'};return _0x329f74;}})});}_0x57da19=_['merge']({},_0x57da19,_0x1cc4c5[_0x48ab('0x42')]);var _0x4f1700={'where':_0x57da19[_0x48ab('0x40')]};return db[_0x48ab('0x43')]['count'](_0x4f1700)[_0x48ab('0x29')](function(_0x398ee7){_0x5946ff['count']=_0x398ee7;if(_0x1cc4c5[_0x48ab('0x34')][_0x48ab('0x44')]){_0x57da19['include']=[{'all':!![]}];}return db[_0x48ab('0x43')][_0x48ab('0x45')](_0x57da19);})[_0x48ab('0x29')](function(_0x2beb79){_0x5946ff[_0x48ab('0x46')]=_0x2beb79;return _0x5946ff;})['then'](respondWithFilteredResult(_0x58859,_0x57da19))['catch'](handleError(_0x58859,null));};exports[_0x48ab('0x47')]=function(_0x29c08d,_0xff10cd){var _0x344186={'raw':![],'where':{'id':_0x29c08d['params']['id']}},_0x19df73={};_0x19df73[_0x48ab('0x33')]=_[_0x48ab('0x35')](db[_0x48ab('0x43')]['rawAttributes']);_0x19df73[_0x48ab('0x34')]=_['keys'](_0x29c08d[_0x48ab('0x34')]);_0x19df73[_0x48ab('0x36')]=_[_0x48ab('0x37')](_0x19df73['model'],_0x19df73[_0x48ab('0x34')]);_0x344186[_0x48ab('0x38')]=_[_0x48ab('0x37')](_0x19df73[_0x48ab('0x33')],qs[_0x48ab('0x39')](_0x29c08d['query'][_0x48ab('0x39')]));_0x344186[_0x48ab('0x38')]=_0x344186['attributes'][_0x48ab('0x3a')]?_0x344186['attributes']:_0x19df73['model'];if(_0x29c08d[_0x48ab('0x34')][_0x48ab('0x44')]){_0x344186[_0x48ab('0x48')]=[{'all':!![]}];}_0x344186=_[_0x48ab('0x41')]({},_0x344186,_0x29c08d[_0x48ab('0x42')]);return db['ZohoAccount'][_0x48ab('0x49')](_0x344186)[_0x48ab('0x29')](handleEntityNotFound(_0xff10cd,null))['then'](respondWithResult(_0xff10cd,null))[_0x48ab('0x4a')](handleError(_0xff10cd,null));};exports[_0x48ab('0x4b')]=function(_0x2f445f,_0x6578bd){return db['ZohoAccount']['create'](_0x2f445f[_0x48ab('0x4c')],{})[_0x48ab('0x29')](respondWithResult(_0x6578bd,0xc9))['catch'](handleError(_0x6578bd,null));};exports[_0x48ab('0x28')]=function(_0x2d2f92,_0x249a93){if(_0x2d2f92['body']['id']){delete _0x2d2f92['body']['id'];}return db[_0x48ab('0x43')]['find']({'where':{'id':_0x2d2f92[_0x48ab('0x4d')]['id']}})[_0x48ab('0x29')](handleEntityNotFound(_0x249a93,null))[_0x48ab('0x29')](saveUpdates(_0x2d2f92[_0x48ab('0x4c')],null))['then'](respondWithResult(_0x249a93,null))['catch'](handleError(_0x249a93,null));};exports['destroy']=function(_0x22ae5d,_0x56ee87){return db[_0x48ab('0x43')]['find']({'where':{'id':_0x22ae5d[_0x48ab('0x4d')]['id']}})[_0x48ab('0x29')](handleEntityNotFound(_0x56ee87,null))[_0x48ab('0x29')](removeEntity(_0x56ee87,null))[_0x48ab('0x4a')](handleError(_0x56ee87,null));};exports[_0x48ab('0x4e')]=function(_0x2cf03c,_0x475354,_0x3cf4c9){var _0x1266e6={};var _0x5d7d40={};var _0x462b2e;var _0x1284d5;return db[_0x48ab('0x43')][_0x48ab('0x4f')]({'where':{'id':_0x2cf03c[_0x48ab('0x4d')]['id']}})[_0x48ab('0x29')](handleEntityNotFound(_0x475354,null))[_0x48ab('0x29')](function(_0x51076b){if(_0x51076b){_0x462b2e=_0x51076b;_0x5d7d40[_0x48ab('0x33')]=_[_0x48ab('0x35')](db[_0x48ab('0x50')][_0x48ab('0x51')]);_0x5d7d40[_0x48ab('0x34')]=_[_0x48ab('0x35')](_0x2cf03c[_0x48ab('0x34')]);_0x5d7d40[_0x48ab('0x36')]=_['intersection'](_0x5d7d40[_0x48ab('0x33')],_0x5d7d40[_0x48ab('0x34')]);_0x1266e6[_0x48ab('0x38')]=_[_0x48ab('0x37')](_0x5d7d40[_0x48ab('0x33')],qs[_0x48ab('0x39')](_0x2cf03c['query'][_0x48ab('0x39')]));_0x1266e6[_0x48ab('0x38')]=_0x1266e6['attributes'][_0x48ab('0x3a')]?_0x1266e6[_0x48ab('0x38')]:_0x5d7d40[_0x48ab('0x33')];_0x1266e6['order']=qs[_0x48ab('0x3d')](_0x2cf03c['query'][_0x48ab('0x3d')]);_0x1266e6[_0x48ab('0x40')]=qs[_0x48ab('0x36')](_['pick'](_0x2cf03c[_0x48ab('0x34')],_0x5d7d40[_0x48ab('0x36')]));if(_0x2cf03c[_0x48ab('0x34')][_0x48ab('0x3f')]){_0x1266e6[_0x48ab('0x40')]=_[_0x48ab('0x41')](_0x1266e6['where'],{'$or':_[_0x48ab('0x30')](_0x1266e6[_0x48ab('0x38')],function(_0x12c42c){var _0xaccaa0={};_0xaccaa0[_0x12c42c]={'$like':'%'+_0x2cf03c[_0x48ab('0x34')][_0x48ab('0x3f')]+'%'};return _0xaccaa0;})});}_0x1266e6=_[_0x48ab('0x41')]({},_0x1266e6,_0x2cf03c['options']);return _0x462b2e[_0x48ab('0x4e')](_0x1266e6);}})[_0x48ab('0x29')](function(_0x39f28f){if(_0x39f28f){_0x1284d5=_0x39f28f[_0x48ab('0x3a')];if(!_0x2cf03c[_0x48ab('0x34')][_0x48ab('0x3b')](_0x48ab('0x3c'))){_0x1266e6[_0x48ab('0x22')]=qs[_0x48ab('0x22')](_0x2cf03c[_0x48ab('0x34')][_0x48ab('0x22')]);_0x1266e6[_0x48ab('0x21')]=qs['offset'](_0x2cf03c[_0x48ab('0x34')][_0x48ab('0x21')]);}return _0x462b2e['getConfigurations'](_0x1266e6);}})[_0x48ab('0x29')](function(_0x4cfa1d){if(_0x4cfa1d){return _0x4cfa1d?{'count':_0x1284d5,'rows':_0x4cfa1d}:null;}})[_0x48ab('0x29')](respondWithResult(_0x475354,null))['catch'](handleError(_0x475354,null));};exports[_0x48ab('0x52')]=function(_0x1b5ea9,_0x727503,_0x552006){if(_0x1b5ea9[_0x48ab('0x4c')]['id']){delete _0x1b5ea9['body']['id'];}return db[_0x48ab('0x43')][_0x48ab('0x4f')]({'where':{'id':_0x1b5ea9[_0x48ab('0x4d')]['id']}})[_0x48ab('0x29')](handleEntityNotFound(_0x727503,null))[_0x48ab('0x29')](function(_0x5a575a){if(_0x5a575a){_0x1b5ea9[_0x48ab('0x4c')][_0x48ab('0x53')]=_0x5a575a['id'];_0x1b5ea9[_0x48ab('0x4c')][_0x48ab('0x54')]=integrations[_0x48ab('0x55')](_0x1b5ea9[_0x48ab('0x4c')]['channel'],_0x1b5ea9['body'][_0x48ab('0x31')]);_0x1b5ea9[_0x48ab('0x4c')][_0x48ab('0x56')]=integrations[_0x48ab('0x57')](_0x1b5ea9[_0x48ab('0x4c')][_0x48ab('0x58')],_0x1b5ea9[_0x48ab('0x4c')][_0x48ab('0x31')]);return db[_0x48ab('0x50')][_0x48ab('0x4b')](_0x1b5ea9['body'],{'include':[{'model':db[_0x48ab('0x59')],'as':_0x48ab('0x54')},{'model':db['ZohoField'],'as':_0x48ab('0x56')}]});}return null;})['then'](respondWithResult(_0x727503,null))[_0x48ab('0x4a')](handleError(_0x727503,null));};function getAccessToken(_0x1aeeba){return new Promise(function(_0xe53718,_0x3008fe){var _0x2a3c82;switch(_0x1aeeba[_0x48ab('0x5a')]){case'US':_0x2a3c82='https://accounts.zoho.com';break;case'AU':_0x2a3c82='https://accounts.zoho.com.au';break;case'EU':_0x2a3c82='https://accounts.zoho.eu';break;case'IN':_0x2a3c82=_0x48ab('0x5b');break;case'CN':_0x2a3c82='https://accounts.zoho.com.cn';break;default:_0x2a3c82=_0x48ab('0x5c');break;}var _0x52f000={'method':_0x48ab('0x5d'),'uri':_0x2a3c82+_0x48ab('0x5e'),'qs':{'refresh_token':_0x1aeeba[_0x48ab('0x5f')],'client_id':_0x1aeeba[_0x48ab('0x60')],'client_secret':_0x1aeeba[_0x48ab('0x61')],'grant_type':_0x48ab('0x62')},'json':!![]};return rp(_0x52f000)[_0x48ab('0x29')](function(_0x3f26b2){if(_0x3f26b2[_0x48ab('0x63')]){_0xe53718(_0x3f26b2['access_token']);}else{_0x3008fe('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0x48ab('0x4a')](function(_0x505148){_0x3008fe(_0x505148);});});}exports[_0x48ab('0x64')]=function(_0x968ecf,_0xee3324,_0x5333f1){var _0x3a0af1,_0x127de8,_0x1a4ce8,_0x8f09fd,_0x14b964;return db[_0x48ab('0x43')][_0x48ab('0x4f')]({'where':{'id':_0x968ecf['params']['id']},'attributes':['id',_0x48ab('0x65'),_0x48ab('0x5a'),_0x48ab('0x60'),_0x48ab('0x61'),_0x48ab('0x66'),'code',_0x48ab('0x5f')]})['then'](handleEntityNotFound(_0xee3324,null))[_0x48ab('0x29')](function(_0x503821){_0x14b964=_0x503821;_0x3a0af1=_0x14b964[_0x48ab('0x65')];_0x127de8=_0x3a0af1===_0x48ab('0x67')?'eu':_0x48ab('0x68');_0x1a4ce8=_0x14b964[_0x48ab('0x66')];var _0x1072e5=_0x1a4ce8[_0x48ab('0x69')](-0x1);if(_0x1072e5==='/'||_0x1072e5==='\x5c'||_0x1072e5===':'){_0x1a4ce8=_0x1a4ce8[_0x48ab('0x6a')](0x0,_0x1a4ce8[_0x48ab('0x6b')](_0x1072e5));}if(!_0x14b964[_0x48ab('0x5f')]){throw new Error(_0x48ab('0x6c'));}return getAccessToken(_0x14b964);})['then'](function(_0x9c0363){if(_0x9c0363){return rp({'method':_0x48ab('0x6d'),'uri':util[_0x48ab('0x6e')](_0x48ab('0x6f'),_0x127de8),'qs':{'module':_0x48ab('0x70')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x9c0363},'json':!![]});}})[_0x48ab('0x29')](function(_0x5247ca){if(_0x5247ca){if(_0x5247ca[_0x48ab('0x71')]&&_0x5247ca[_0x48ab('0x71')][_0x48ab('0x2b')]){throw new Error(_0x5247ca[_0x48ab('0x71')][_0x48ab('0x2b')]['message']);}var _0x2710fa=[];var _0x342187=[];var _0x467441=[_0x48ab('0x72'),_0x48ab('0x73'),'Description',_0x48ab('0x74'),_0x48ab('0x75'),_0x48ab('0x76'),'Call_Start_Time',_0x48ab('0x77')];_0x342187=_[_0x48ab('0x78')](_0x5247ca[_0x48ab('0x39')],function(_0x4824eb){return _0x467441['includes'](_0x4824eb['api_name']);});for(var _0x543d0a=0x0;_0x543d0a<_0x342187['length'];_0x543d0a++){if(_0x342187[_0x543d0a][_0x48ab('0x79')]===![]){_0x2710fa[_0x48ab('0x7a')]({'id':_0x342187[_0x543d0a]['id'],'name':_0x342187[_0x543d0a][_0x48ab('0x7b')],'custom':_0x342187[_0x543d0a][_0x48ab('0x7c')],'options':_0x342187[_0x543d0a]['data_type']===_0x48ab('0x7d')&&_0x342187[_0x543d0a][_0x48ab('0x7e')][_0x48ab('0x3a')]>-0x1?_['map'](_0x342187[_0x543d0a][_0x48ab('0x7e')],function(_0x443c21){return{'name':_0x443c21,'value':_0x443c21};}):[]});}}return{'count':_0x2710fa[_0x48ab('0x3a')],'rows':_0x2710fa};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0xee3324,null))['catch'](function(_0x424a23){var _0x57efa6=_0x968ecf['query'][_0x48ab('0x7f')]?0x1f4:_0x424a23[_0x48ab('0x80')]||0x1f4;logger[_0x48ab('0x2b')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x57efa6,JSON[_0x48ab('0x81')](_0x424a23));delete _0x424a23['name'];if(_0x57efa6===0x191){_0x57efa6=0x190;}_0xee3324['status'](_0x57efa6)['send'](_0x968ecf[_0x48ab('0x34')][_0x48ab('0x7f')]?{'message':_0x48ab('0x82'),'statusCode':_0x424a23[_0x48ab('0x80')]}:_0x424a23);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 7438eb8..1e751ac 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 _0x47a9=['bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','zone','serverUrl','clientId','changed','clientSecret','code','host','substring','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','then','parse','refreshToken','refresh_token','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','lastIndexOf','application/x-www-form-urlencoded','info','lodash','util','../../config/logger','api','moment'];(function(_0x425f04,_0x277745){var _0x42fb05=function(_0x43f35a){while(--_0x43f35a){_0x425f04['push'](_0x425f04['shift']());}};_0x42fb05(++_0x277745);}(_0x47a9,0x190));var _0x947a=function(_0x1084f6,_0x4bd28c){_0x1084f6=_0x1084f6-0x0;var _0x14ffba=_0x47a9[_0x1084f6];return _0x14ffba;};'use strict';var _=require(_0x947a('0x0'));var util=require(_0x947a('0x1'));var logger=require(_0x947a('0x2'))(_0x947a('0x3'));var moment=require(_0x947a('0x4'));var BPromise=require(_0x947a('0x5'));var rp=require(_0x947a('0x6'));var fs=require('fs');var path=require(_0x947a('0x7'));var rimraf=require(_0x947a('0x8'));var config=require(_0x947a('0x9'));var attributes=require('./intZohoAccount.attributes');var integrations=require(_0x947a('0xa'));module[_0x947a('0xb')]=function(_0x4c88ac,_0x1df909){return _0x4c88ac[_0x947a('0xc')](_0x947a('0xd'),attributes,{'tableName':_0x947a('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0xeb0308,_0x286b73,_0x42d6ff){if(_0xeb0308['changed'](_0x947a('0xf'))||_0xeb0308['changed'](_0x947a('0x10'))||_0xeb0308['changed'](_0x947a('0x11'))||_0xeb0308[_0x947a('0x12')](_0x947a('0x13'))||_0xeb0308['changed'](_0x947a('0x14'))||_0xeb0308[_0x947a('0x12')](_0x947a('0x15'))){var _0x3ffc2a,_0x2a5040;_0x3ffc2a=_0xeb0308[_0x947a('0x10')];var _0x790af8=_0x3ffc2a['slice'](-0x1);if(_0x790af8==='/'||_0x790af8==='\x5c'||_0x790af8===':'){_0x3ffc2a=_0x3ffc2a[_0x947a('0x16')](0x0,_0x3ffc2a['lastIndexOf'](_0x790af8));}switch(_0xeb0308[_0x947a('0xf')]){case'US':_0x2a5040=_0x947a('0x17');break;case'AU':_0x2a5040=_0x947a('0x18');break;case'IN':_0x2a5040=_0x947a('0x19');break;case'CN':_0x2a5040=_0x947a('0x1a');break;default:_0x2a5040=_0x947a('0x1b');break;}var _0x2c7f0a={'method':_0x947a('0x1c'),'uri':_0x2a5040+_0x947a('0x1d'),'form':{'grant_type':_0x947a('0x1e'),'client_id':_0xeb0308['clientId'],'client_secret':_0xeb0308['clientSecret'],'redirect_uri':_0xeb0308[_0x947a('0x10')],'code':_0xeb0308['code']},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x2c7f0a)[_0x947a('0x1f')](function(_0x349859){var _0x25c3e6=JSON[_0x947a('0x20')](_0x349859);if(_0x25c3e6['refresh_token']){_0xeb0308[_0x947a('0x21')]=_0x25c3e6[_0x947a('0x22')];logger['info'](util[_0x947a('0x23')](_0x947a('0x24'),_0xeb0308[_0x947a('0x25')],_0xeb0308['id']));}else{logger[_0x947a('0x26')](util[_0x947a('0x23')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0xeb0308[_0x947a('0x25')],_0xeb0308['id']),util[_0x947a('0x27')](_0x25c3e6,{'showHidden':![],'depth':null}));}return _0x42d6ff(null,_0x286b73);})[_0x947a('0x28')](function(_0x18cb00){logger[_0x947a('0x26')](util[_0x947a('0x23')](_0x947a('0x29'),_0xeb0308[_0x947a('0x25')],_0xeb0308['id']),util[_0x947a('0x27')](parsedResult,{'showHidden':![],'depth':null}));return _0x42d6ff(_0x18cb00);});}else{return _0x42d6ff(null,_0x286b73);}},'beforeUpdate':function(_0x30bdce,_0x3612cb,_0x1591a2){if(_0x30bdce[_0x947a('0x12')](_0x947a('0xf'))||_0x30bdce['changed']('serverUrl')||_0x30bdce[_0x947a('0x12')]('clientId')||_0x30bdce[_0x947a('0x12')](_0x947a('0x13'))||_0x30bdce[_0x947a('0x12')](_0x947a('0x14'))||_0x30bdce[_0x947a('0x12')](_0x947a('0x15'))){var _0x3dfc5d,_0x528e12;_0x3dfc5d=_0x30bdce[_0x947a('0x10')];var _0x1f3d99=_0x3dfc5d['slice'](-0x1);if(_0x1f3d99==='/'||_0x1f3d99==='\x5c'||_0x1f3d99===':'){_0x3dfc5d=_0x3dfc5d['substring'](0x0,_0x3dfc5d[_0x947a('0x2a')](_0x1f3d99));}switch(_0x30bdce[_0x947a('0xf')]){case'US':_0x528e12=_0x947a('0x17');break;case'AU':_0x528e12=_0x947a('0x18');break;case'IN':_0x528e12=_0x947a('0x19');break;case'CN':_0x528e12=_0x947a('0x1a');break;default:_0x528e12=_0x947a('0x1b');break;}var _0x2ca6e6={'method':_0x947a('0x1c'),'uri':_0x528e12+_0x947a('0x1d'),'form':{'grant_type':'authorization_code','client_id':_0x30bdce[_0x947a('0x11')],'client_secret':_0x30bdce['clientSecret'],'redirect_uri':_0x30bdce[_0x947a('0x10')],'code':_0x30bdce[_0x947a('0x14')]},'headers':{'Content-Type':_0x947a('0x2b')}};return rp(_0x2ca6e6)[_0x947a('0x1f')](function(_0x28d7ab){var _0x41902f=JSON['parse'](_0x28d7ab);if(_0x41902f[_0x947a('0x22')]){_0x30bdce['refreshToken']=_0x41902f[_0x947a('0x22')];logger[_0x947a('0x2c')](util[_0x947a('0x23')](_0x947a('0x24'),_0x30bdce[_0x947a('0x25')],_0x30bdce['id']));}else{logger['error'](util[_0x947a('0x23')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x30bdce['name'],_0x30bdce['id']),util[_0x947a('0x27')](_0x41902f,{'showHidden':![],'depth':null}));}return _0x1591a2(null,_0x3612cb);})['catch'](function(_0x5bf967){logger['error'](util[_0x947a('0x23')](_0x947a('0x29'),_0x30bdce[_0x947a('0x25')],_0x30bdce['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x1591a2(_0x5bf967);});}else{return _0x1591a2(null,_0x3612cb);}}}});}; \ No newline at end of file +var _0xf1d2=['serverUrl','clientId','clientSecret','code','host','slice','substring','https://accounts.zoho.com','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','application/x-www-form-urlencoded','then','refreshToken','refresh_token','info','format','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','lastIndexOf','https://accounts.zoho.com.au','https://accounts.zoho.in','/oauth/v2/token','authorization_code','parse','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','changed','zone'];(function(_0x727d78,_0x2f7912){var _0x104ce8=function(_0x4c1347){while(--_0x4c1347){_0x727d78['push'](_0x727d78['shift']());}};_0x104ce8(++_0x2f7912);}(_0xf1d2,0x11f));var _0x2f1d=function(_0x1709e7,_0x2ced21){_0x1709e7=_0x1709e7-0x0;var _0x402819=_0xf1d2[_0x1709e7];return _0x402819;};'use strict';var _=require('lodash');var util=require(_0x2f1d('0x0'));var logger=require('../../config/logger')(_0x2f1d('0x1'));var moment=require(_0x2f1d('0x2'));var BPromise=require(_0x2f1d('0x3'));var rp=require(_0x2f1d('0x4'));var fs=require('fs');var path=require(_0x2f1d('0x5'));var rimraf=require(_0x2f1d('0x6'));var config=require(_0x2f1d('0x7'));var attributes=require(_0x2f1d('0x8'));var integrations=require(_0x2f1d('0x9'));module[_0x2f1d('0xa')]=function(_0x3195d5,_0x343c83){return _0x3195d5[_0x2f1d('0xb')]('ZohoAccount',attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x45b10f,_0x5971e0,_0x475a5f){if(_0x45b10f[_0x2f1d('0xc')](_0x2f1d('0xd'))||_0x45b10f[_0x2f1d('0xc')](_0x2f1d('0xe'))||_0x45b10f[_0x2f1d('0xc')](_0x2f1d('0xf'))||_0x45b10f['changed'](_0x2f1d('0x10'))||_0x45b10f[_0x2f1d('0xc')](_0x2f1d('0x11'))||_0x45b10f[_0x2f1d('0xc')](_0x2f1d('0x12'))){var _0x1f3659,_0x374fb2;_0x1f3659=_0x45b10f[_0x2f1d('0xe')];var _0xd5d5bd=_0x1f3659[_0x2f1d('0x13')](-0x1);if(_0xd5d5bd==='/'||_0xd5d5bd==='\x5c'||_0xd5d5bd===':'){_0x1f3659=_0x1f3659[_0x2f1d('0x14')](0x0,_0x1f3659['lastIndexOf'](_0xd5d5bd));}switch(_0x45b10f[_0x2f1d('0xd')]){case'US':_0x374fb2=_0x2f1d('0x15');break;case'AU':_0x374fb2='https://accounts.zoho.com.au';break;case'IN':_0x374fb2='https://accounts.zoho.in';break;case'CN':_0x374fb2=_0x2f1d('0x16');break;default:_0x374fb2=_0x2f1d('0x17');break;}var _0x44a932={'method':_0x2f1d('0x18'),'uri':_0x374fb2+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x45b10f[_0x2f1d('0xf')],'client_secret':_0x45b10f[_0x2f1d('0x10')],'redirect_uri':_0x45b10f['serverUrl'],'code':_0x45b10f[_0x2f1d('0x11')]},'headers':{'Content-Type':_0x2f1d('0x19')}};return rp(_0x44a932)[_0x2f1d('0x1a')](function(_0x444890){var _0x3a068e=JSON['parse'](_0x444890);if(_0x3a068e['refresh_token']){_0x45b10f[_0x2f1d('0x1b')]=_0x3a068e[_0x2f1d('0x1c')];logger[_0x2f1d('0x1d')](util[_0x2f1d('0x1e')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x45b10f[_0x2f1d('0x1f')],_0x45b10f['id']));}else{logger[_0x2f1d('0x20')](util[_0x2f1d('0x1e')](_0x2f1d('0x21'),_0x45b10f[_0x2f1d('0x1f')],_0x45b10f['id']),util[_0x2f1d('0x22')](_0x3a068e,{'showHidden':![],'depth':null}));}return _0x475a5f(null,_0x5971e0);})[_0x2f1d('0x23')](function(_0x247aec){logger[_0x2f1d('0x20')](util['format'](_0x2f1d('0x21'),_0x45b10f['name'],_0x45b10f['id']),util[_0x2f1d('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x475a5f(_0x247aec);});}else{return _0x475a5f(null,_0x5971e0);}},'beforeUpdate':function(_0x826d23,_0x15120f,_0x661e25){if(_0x826d23[_0x2f1d('0xc')](_0x2f1d('0xd'))||_0x826d23[_0x2f1d('0xc')](_0x2f1d('0xe'))||_0x826d23['changed'](_0x2f1d('0xf'))||_0x826d23['changed'](_0x2f1d('0x10'))||_0x826d23['changed'](_0x2f1d('0x11'))||_0x826d23['changed'](_0x2f1d('0x12'))){var _0x8600fb,_0x18917f;_0x8600fb=_0x826d23[_0x2f1d('0xe')];var _0x353861=_0x8600fb[_0x2f1d('0x13')](-0x1);if(_0x353861==='/'||_0x353861==='\x5c'||_0x353861===':'){_0x8600fb=_0x8600fb['substring'](0x0,_0x8600fb[_0x2f1d('0x24')](_0x353861));}switch(_0x826d23['zone']){case'US':_0x18917f=_0x2f1d('0x15');break;case'AU':_0x18917f=_0x2f1d('0x25');break;case'IN':_0x18917f=_0x2f1d('0x26');break;case'CN':_0x18917f=_0x2f1d('0x16');break;default:_0x18917f=_0x2f1d('0x17');break;}var _0x3fbc8c={'method':'POST','uri':_0x18917f+_0x2f1d('0x27'),'form':{'grant_type':_0x2f1d('0x28'),'client_id':_0x826d23[_0x2f1d('0xf')],'client_secret':_0x826d23[_0x2f1d('0x10')],'redirect_uri':_0x826d23[_0x2f1d('0xe')],'code':_0x826d23[_0x2f1d('0x11')]},'headers':{'Content-Type':_0x2f1d('0x19')}};return rp(_0x3fbc8c)[_0x2f1d('0x1a')](function(_0x2bc634){var _0x1ec52d=JSON[_0x2f1d('0x29')](_0x2bc634);if(_0x1ec52d['refresh_token']){_0x826d23['refreshToken']=_0x1ec52d[_0x2f1d('0x1c')];logger[_0x2f1d('0x1d')](util[_0x2f1d('0x1e')](_0x2f1d('0x2a'),_0x826d23[_0x2f1d('0x1f')],_0x826d23['id']));}else{logger[_0x2f1d('0x20')](util['format'](_0x2f1d('0x21'),_0x826d23[_0x2f1d('0x1f')],_0x826d23['id']),util[_0x2f1d('0x22')](_0x1ec52d,{'showHidden':![],'depth':null}));}return _0x661e25(null,_0x15120f);})[_0x2f1d('0x23')](function(_0x344659){logger[_0x2f1d('0x20')](util[_0x2f1d('0x1e')](_0x2f1d('0x21'),_0x826d23[_0x2f1d('0x1f')],_0x826d23['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x661e25(_0x344659);});}else{return _0x661e25(null,_0x15120f);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 791a216..bf95045 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 _0x8cda=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','ZohoAccount,\x20%s,\x20%s','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','request\x20sent','catch','findAll','options','raw','where','attributes','limit','include','model','map','GetZohoAccount','ShowZohoAccount','find','then','util'];(function(_0xa1e3ca,_0x559022){var _0x5005ab=function(_0x12f90e){while(--_0x12f90e){_0xa1e3ca['push'](_0xa1e3ca['shift']());}};_0x5005ab(++_0x559022);}(_0x8cda,0x1db));var _0xa8cd=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8cda[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0xa8cd('0x0'));var moment=require(_0xa8cd('0x1'));var BPromise=require(_0xa8cd('0x2'));var rs=require(_0xa8cd('0x3'));var fs=require('fs');var Redis=require(_0xa8cd('0x4'));var db=require(_0xa8cd('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa8cd('0x6'))(_0xa8cd('0x7'));var config=require(_0xa8cd('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa8cd('0x9')][_0xa8cd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1362c3,_0x273d2f,_0x2b9b51){return new BPromise(function(_0x2481ba,_0x13f394){return client[_0xa8cd('0xb')](_0x1362c3,_0x2b9b51)['then'](function(_0x50b8ee){logger['info'](_0xa8cd('0xc'),_0x273d2f,'request\x20sent');logger[_0xa8cd('0xd')](_0xa8cd('0xe'),_0x273d2f,'request\x20sent',JSON[_0xa8cd('0xf')](_0x50b8ee));if(_0x50b8ee[_0xa8cd('0x10')]){if(_0x50b8ee['error']['code']===0x1f4){logger[_0xa8cd('0x10')](_0xa8cd('0xc'),_0x273d2f,_0x50b8ee[_0xa8cd('0x10')][_0xa8cd('0x11')]);return _0x13f394(_0x50b8ee[_0xa8cd('0x10')]['message']);}logger[_0xa8cd('0x10')]('ZohoAccount,\x20%s,\x20%s',_0x273d2f,_0x50b8ee[_0xa8cd('0x10')]['message']);return _0x2481ba(_0x50b8ee[_0xa8cd('0x10')]['message']);}else{logger[_0xa8cd('0x12')](_0xa8cd('0xc'),_0x273d2f,_0xa8cd('0x13'));_0x2481ba(_0x50b8ee['result']['message']);}})[_0xa8cd('0x14')](function(_0x6d5f40){logger[_0xa8cd('0x10')](_0xa8cd('0xc'),_0x273d2f,_0x6d5f40);_0x13f394(_0x6d5f40);});});}exports['GetZohoAccount']=function(_0x128a90){var _0x52252b=this;return new Promise(function(_0x1cacd5,_0x2ef224){return db['ZohoAccount'][_0xa8cd('0x15')]({'raw':_0x128a90[_0xa8cd('0x16')]?_0x128a90['options'][_0xa8cd('0x17')]===undefined?!![]:![]:!![],'where':_0x128a90[_0xa8cd('0x16')]?_0x128a90[_0xa8cd('0x16')][_0xa8cd('0x18')]||null:null,'attributes':_0x128a90[_0xa8cd('0x16')]?_0x128a90['options'][_0xa8cd('0x19')]||null:null,'limit':_0x128a90[_0xa8cd('0x16')]?_0x128a90[_0xa8cd('0x16')][_0xa8cd('0x1a')]||null:null,'include':_0x128a90['options']?_0x128a90[_0xa8cd('0x16')]['include']?_['map'](_0x128a90[_0xa8cd('0x16')][_0xa8cd('0x1b')],function(_0x4ec3cc){return{'model':db[_0x4ec3cc[_0xa8cd('0x1c')]],'as':_0x4ec3cc['as'],'attributes':_0x4ec3cc[_0xa8cd('0x19')],'include':_0x4ec3cc[_0xa8cd('0x1b')]?_[_0xa8cd('0x1d')](_0x4ec3cc[_0xa8cd('0x1b')],function(_0x2d1ef5){return{'model':db[_0x2d1ef5[_0xa8cd('0x1c')]],'as':_0x2d1ef5['as'],'attributes':_0x2d1ef5['attributes'],'include':_0x2d1ef5[_0xa8cd('0x1b')]?_[_0xa8cd('0x1d')](_0x2d1ef5[_0xa8cd('0x1b')],function(_0x393e5a){return{'model':db[_0x393e5a[_0xa8cd('0x1c')]],'as':_0x393e5a['as'],'attributes':_0x393e5a[_0xa8cd('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x38946b){logger[_0xa8cd('0x12')](_0xa8cd('0x1e'),_0x128a90);logger[_0xa8cd('0xd')](_0xa8cd('0x1e'),_0x128a90,JSON[_0xa8cd('0xf')](_0x38946b));_0x1cacd5(_0x38946b);})[_0xa8cd('0x14')](function(_0x3e1770){logger[_0xa8cd('0x10')](_0xa8cd('0x1e'),_0x3e1770[_0xa8cd('0x11')],_0x128a90);_0x2ef224(_0x52252b[_0xa8cd('0x10')](0x1f4,_0x3e1770[_0xa8cd('0x11')]));});});};exports[_0xa8cd('0x1f')]=function(_0x2b4c53){var _0x3c188f=this;return new Promise(function(_0x4b7671,_0x4cca4b){return db['ZohoAccount'][_0xa8cd('0x20')]({'raw':_0x2b4c53[_0xa8cd('0x16')]?_0x2b4c53[_0xa8cd('0x16')][_0xa8cd('0x17')]===undefined?!![]:![]:!![],'where':_0x2b4c53[_0xa8cd('0x16')]?_0x2b4c53[_0xa8cd('0x16')]['where']||null:null,'attributes':_0x2b4c53['options']?_0x2b4c53['options'][_0xa8cd('0x19')]||null:null,'include':_0x2b4c53[_0xa8cd('0x16')]?_0x2b4c53[_0xa8cd('0x16')][_0xa8cd('0x1b')]?_[_0xa8cd('0x1d')](_0x2b4c53[_0xa8cd('0x16')][_0xa8cd('0x1b')],function(_0x572862){return{'model':db[_0x572862[_0xa8cd('0x1c')]],'as':_0x572862['as'],'attributes':_0x572862[_0xa8cd('0x19')],'include':_0x572862['include']?_[_0xa8cd('0x1d')](_0x572862[_0xa8cd('0x1b')],function(_0x2ae8ed){return{'model':db[_0x2ae8ed[_0xa8cd('0x1c')]],'as':_0x2ae8ed['as'],'attributes':_0x2ae8ed['attributes'],'include':_0x2ae8ed[_0xa8cd('0x1b')]?_[_0xa8cd('0x1d')](_0x2ae8ed['include'],function(_0x3dc528){return{'model':db[_0x3dc528[_0xa8cd('0x1c')]],'as':_0x3dc528['as'],'attributes':_0x3dc528[_0xa8cd('0x19')]};}):[]};}):[]};}):[]:[]})[_0xa8cd('0x21')](function(_0x5b1245){logger['info'](_0xa8cd('0x1f'),_0x2b4c53);logger['debug'](_0xa8cd('0x1f'),_0x2b4c53,JSON['stringify'](_0x5b1245));_0x4b7671(_0x5b1245);})[_0xa8cd('0x14')](function(_0x32bad6){logger['error'](_0xa8cd('0x1f'),_0x32bad6[_0xa8cd('0x11')],_0x2b4c53);_0x4cca4b(_0x3c188f[_0xa8cd('0x10')](0x1f4,_0x32bad6[_0xa8cd('0x11')]));});});}; \ No newline at end of file +var _0x8f4c=['ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','attributes','limit','map','include','model','ShowZohoAccount','find','lodash','util','moment','bluebird','randomstring'];(function(_0x5494ab,_0x35bb9d){var _0x363a38=function(_0x2e6662){while(--_0x2e6662){_0x5494ab['push'](_0x5494ab['shift']());}};_0x363a38(++_0x35bb9d);}(_0x8f4c,0x113));var _0xc8f4=function(_0x44671c,_0x2a7436){_0x44671c=_0x44671c-0x0;var _0x5a61bc=_0x8f4c[_0x44671c];return _0x5a61bc;};'use strict';var _=require(_0xc8f4('0x0'));var util=require(_0xc8f4('0x1'));var moment=require(_0xc8f4('0x2'));var BPromise=require(_0xc8f4('0x3'));var rs=require(_0xc8f4('0x4'));var fs=require('fs');var Redis=require(_0xc8f4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc8f4('0x6'));var logger=require(_0xc8f4('0x7'))(_0xc8f4('0x8'));var config=require('../../config/environment');var jayson=require(_0xc8f4('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x520063,_0x373506,_0x48c39d){return new BPromise(function(_0x3ea9a2,_0x3a9ab1){return client[_0xc8f4('0xa')](_0x520063,_0x48c39d)[_0xc8f4('0xb')](function(_0x34f05f){logger['info'](_0xc8f4('0xc'),_0x373506,_0xc8f4('0xd'));logger[_0xc8f4('0xe')](_0xc8f4('0xf'),_0x373506,'request\x20sent',JSON[_0xc8f4('0x10')](_0x34f05f));if(_0x34f05f['error']){if(_0x34f05f[_0xc8f4('0x11')][_0xc8f4('0x12')]===0x1f4){logger[_0xc8f4('0x11')](_0xc8f4('0xc'),_0x373506,_0x34f05f[_0xc8f4('0x11')]['message']);return _0x3a9ab1(_0x34f05f[_0xc8f4('0x11')][_0xc8f4('0x13')]);}logger[_0xc8f4('0x11')](_0xc8f4('0xc'),_0x373506,_0x34f05f[_0xc8f4('0x11')][_0xc8f4('0x13')]);return _0x3ea9a2(_0x34f05f['error'][_0xc8f4('0x13')]);}else{logger[_0xc8f4('0x14')](_0xc8f4('0xc'),_0x373506,_0xc8f4('0xd'));_0x3ea9a2(_0x34f05f[_0xc8f4('0x15')]['message']);}})[_0xc8f4('0x16')](function(_0x4d2b77){logger['error'](_0xc8f4('0xc'),_0x373506,_0x4d2b77);_0x3a9ab1(_0x4d2b77);});});}exports[_0xc8f4('0x17')]=function(_0x108076){var _0x7bb973=this;return new Promise(function(_0x4763c1,_0x374761){return db[_0xc8f4('0x18')][_0xc8f4('0x19')]({'raw':_0x108076[_0xc8f4('0x1a')]?_0x108076[_0xc8f4('0x1a')][_0xc8f4('0x1b')]===undefined?!![]:![]:!![],'where':_0x108076[_0xc8f4('0x1a')]?_0x108076[_0xc8f4('0x1a')]['where']||null:null,'attributes':_0x108076[_0xc8f4('0x1a')]?_0x108076[_0xc8f4('0x1a')][_0xc8f4('0x1c')]||null:null,'limit':_0x108076[_0xc8f4('0x1a')]?_0x108076[_0xc8f4('0x1a')][_0xc8f4('0x1d')]||null:null,'include':_0x108076[_0xc8f4('0x1a')]?_0x108076[_0xc8f4('0x1a')]['include']?_[_0xc8f4('0x1e')](_0x108076[_0xc8f4('0x1a')][_0xc8f4('0x1f')],function(_0x1d159e){return{'model':db[_0x1d159e['model']],'as':_0x1d159e['as'],'attributes':_0x1d159e[_0xc8f4('0x1c')],'include':_0x1d159e['include']?_[_0xc8f4('0x1e')](_0x1d159e['include'],function(_0x177a44){return{'model':db[_0x177a44[_0xc8f4('0x20')]],'as':_0x177a44['as'],'attributes':_0x177a44['attributes'],'include':_0x177a44[_0xc8f4('0x1f')]?_[_0xc8f4('0x1e')](_0x177a44[_0xc8f4('0x1f')],function(_0x2fa052){return{'model':db[_0x2fa052['model']],'as':_0x2fa052['as'],'attributes':_0x2fa052[_0xc8f4('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc8f4('0xb')](function(_0x5db666){logger[_0xc8f4('0x14')](_0xc8f4('0x17'),_0x108076);logger[_0xc8f4('0xe')](_0xc8f4('0x17'),_0x108076,JSON[_0xc8f4('0x10')](_0x5db666));_0x4763c1(_0x5db666);})[_0xc8f4('0x16')](function(_0x4a25da){logger[_0xc8f4('0x11')](_0xc8f4('0x17'),_0x4a25da[_0xc8f4('0x13')],_0x108076);_0x374761(_0x7bb973['error'](0x1f4,_0x4a25da[_0xc8f4('0x13')]));});});};exports[_0xc8f4('0x21')]=function(_0x5ab6cb){var _0x56ec4b=this;return new Promise(function(_0x4d6c43,_0x2717ff){return db[_0xc8f4('0x18')][_0xc8f4('0x22')]({'raw':_0x5ab6cb[_0xc8f4('0x1a')]?_0x5ab6cb[_0xc8f4('0x1a')][_0xc8f4('0x1b')]===undefined?!![]:![]:!![],'where':_0x5ab6cb[_0xc8f4('0x1a')]?_0x5ab6cb[_0xc8f4('0x1a')]['where']||null:null,'attributes':_0x5ab6cb[_0xc8f4('0x1a')]?_0x5ab6cb[_0xc8f4('0x1a')][_0xc8f4('0x1c')]||null:null,'include':_0x5ab6cb['options']?_0x5ab6cb[_0xc8f4('0x1a')][_0xc8f4('0x1f')]?_['map'](_0x5ab6cb[_0xc8f4('0x1a')][_0xc8f4('0x1f')],function(_0x36f24f){return{'model':db[_0x36f24f['model']],'as':_0x36f24f['as'],'attributes':_0x36f24f[_0xc8f4('0x1c')],'include':_0x36f24f[_0xc8f4('0x1f')]?_[_0xc8f4('0x1e')](_0x36f24f['include'],function(_0x1c9d57){return{'model':db[_0x1c9d57[_0xc8f4('0x20')]],'as':_0x1c9d57['as'],'attributes':_0x1c9d57[_0xc8f4('0x1c')],'include':_0x1c9d57[_0xc8f4('0x1f')]?_[_0xc8f4('0x1e')](_0x1c9d57[_0xc8f4('0x1f')],function(_0xeacb80){return{'model':db[_0xeacb80[_0xc8f4('0x20')]],'as':_0xeacb80['as'],'attributes':_0xeacb80[_0xc8f4('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc8f4('0xb')](function(_0x35b516){logger[_0xc8f4('0x14')](_0xc8f4('0x21'),_0x5ab6cb);logger[_0xc8f4('0xe')](_0xc8f4('0x21'),_0x5ab6cb,JSON[_0xc8f4('0x10')](_0x35b516));_0x4d6c43(_0x35b516);})['catch'](function(_0x3a8cac){logger['error'](_0xc8f4('0x21'),_0x3a8cac['message'],_0x5ab6cb);_0x2717ff(_0x56ec4b[_0xc8f4('0x11')](0x1f4,_0x3a8cac[_0xc8f4('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 82d467b..61f8320 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 _0x422c=['/:id','/:id/subjects','getSubjects','/:id/descriptions','post','put','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x1f13ee,_0x59217b){var _0x16b0ce=function(_0x4c8fac){while(--_0x4c8fac){_0x1f13ee['push'](_0x1f13ee['shift']());}};_0x16b0ce(++_0x59217b);}(_0x422c,0x14a));var _0xc422=function(_0x39e147,_0x2e86d6){_0x39e147=_0x39e147-0x0;var _0x52250d=_0x422c[_0x39e147];return _0x52250d;};'use strict';var multer=require(_0xc422('0x0'));var util=require('util');var path=require(_0xc422('0x1'));var timeout=require('connect-timeout');var express=require(_0xc422('0x2'));var router=express[_0xc422('0x3')]();var fs_extra=require(_0xc422('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xc422('0x5'));var config=require(_0xc422('0x6'));var controller=require('./intZohoConfiguration.controller');router[_0xc422('0x7')]('/',auth[_0xc422('0x8')](),controller[_0xc422('0x9')]);router[_0xc422('0x7')](_0xc422('0xa'),auth[_0xc422('0x8')](),controller['show']);router[_0xc422('0x7')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0xc422('0x7')](_0xc422('0xb'),auth[_0xc422('0x8')](),controller[_0xc422('0xc')]);router[_0xc422('0x7')](_0xc422('0xd'),auth[_0xc422('0x8')](),controller['getDescriptions']);router[_0xc422('0xe')]('/',auth[_0xc422('0x8')](),controller['create']);router[_0xc422('0xf')](_0xc422('0xa'),auth['isAuthenticated'](),controller[_0xc422('0x10')]);router[_0xc422('0x11')]('/:id',auth[_0xc422('0x8')](),controller[_0xc422('0x12')]);module[_0xc422('0x13')]=router; \ No newline at end of file +var _0x5007=['fs-extra','../../components/auth/service','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/descriptions','post','put','update','exports','multer','util','path','connect-timeout','express'];(function(_0x1346e9,_0x46dd15){var _0x3b4cba=function(_0x5bf3f9){while(--_0x5bf3f9){_0x1346e9['push'](_0x1346e9['shift']());}};_0x3b4cba(++_0x46dd15);}(_0x5007,0xf2));var _0x7500=function(_0x3a73a1,_0x3cc202){_0x3a73a1=_0x3a73a1-0x0;var _0x39ab34=_0x5007[_0x3a73a1];return _0x39ab34;};'use strict';var multer=require(_0x7500('0x0'));var util=require(_0x7500('0x1'));var path=require(_0x7500('0x2'));var timeout=require(_0x7500('0x3'));var express=require(_0x7500('0x4'));var router=express['Router']();var fs_extra=require(_0x7500('0x5'));var auth=require(_0x7500('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intZohoConfiguration.controller');router[_0x7500('0x7')]('/',auth[_0x7500('0x8')](),controller[_0x7500('0x9')]);router[_0x7500('0x7')](_0x7500('0xa'),auth['isAuthenticated'](),controller[_0x7500('0xb')]);router[_0x7500('0x7')](_0x7500('0xc'),auth[_0x7500('0x8')](),controller[_0x7500('0xd')]);router[_0x7500('0x7')]('/:id/subjects',auth[_0x7500('0x8')](),controller['getSubjects']);router[_0x7500('0x7')](_0x7500('0xe'),auth[_0x7500('0x8')](),controller['getDescriptions']);router[_0x7500('0xf')]('/',auth[_0x7500('0x8')](),controller['create']);router[_0x7500('0x10')](_0x7500('0xa'),auth[_0x7500('0x8')](),controller[_0x7500('0x11')]);router['delete'](_0x7500('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x7500('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 852745a..b723a8e 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 _0x20c4=['sequelize','exports','lead','contact','nothing','ENUM','contact_lead','STRING'];(function(_0x1f2f7d,_0x379c04){var _0x45841c=function(_0x31814b){while(--_0x31814b){_0x1f2f7d['push'](_0x1f2f7d['shift']());}};_0x45841c(++_0x379c04);}(_0x20c4,0x88));var _0x420c=function(_0x2645bf,_0xed791d){_0x2645bf=_0x2645bf-0x0;var _0x414fcb=_0x20c4[_0x2645bf];return _0x414fcb;};'use strict';var Sequelize=require(_0x420c('0x0'));module[_0x420c('0x1')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize['ENUM'](_0x420c('0x2'),_0x420c('0x3'),_0x420c('0x4')),'defaultValue':_0x420c('0x2')},'moduleSearch':{'type':Sequelize[_0x420c('0x5')]('contact_lead',_0x420c('0x3'),_0x420c('0x2')),'defaultValue':_0x420c('0x6')},'description':{'type':Sequelize[_0x420c('0x7')]}}; \ No newline at end of file +var _0xa9be=['nothing','contact_lead','STRING','ENUM','lead','contact'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0xa9be,0x1b2));var _0xea9b=function(_0x5f2266,_0x2f9272){_0x5f2266=_0x5f2266-0x0;var _0x3d1fe5=_0xa9be[_0x5f2266];return _0x3d1fe5;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xea9b('0x0')]},'moduleCreate':{'type':Sequelize[_0xea9b('0x1')](_0xea9b('0x2'),_0xea9b('0x3'),_0xea9b('0x4')),'defaultValue':_0xea9b('0x2')},'moduleSearch':{'type':Sequelize[_0xea9b('0x1')]('contact_lead',_0xea9b('0x3'),_0xea9b('0x2')),'defaultValue':_0xea9b('0x5')},'description':{'type':Sequelize[_0xea9b('0x0')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 3bd19ac..1bbd4c2 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 _0xce69=['apply','reject','save','update','then','sendStatus','error','stack','name','send','index','map','ZohoConfiguration','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','findOne','ZohoField','pick','getFields','getSubjects','options','getDescriptions','eml-format','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','end','offset','undefined','limit','count','status','set','json'];(function(_0x829616,_0x5d9318){var _0x35857a=function(_0x502cb9){while(--_0x502cb9){_0x829616['push'](_0x829616['shift']());}};_0x35857a(++_0x5d9318);}(_0xce69,0x158));var _0x9ce6=function(_0x3c8e9a,_0x384306){_0x3c8e9a=_0x3c8e9a-0x0;var _0x2d4c57=_0xce69[_0x3c8e9a];return _0x2d4c57;};'use strict';var emlformat=require(_0x9ce6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9ce6('0x1'));var rp=require(_0x9ce6('0x2'));var moment=require(_0x9ce6('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x9ce6('0x4'));var sox=require(_0x9ce6('0x5'));var csv=require(_0x9ce6('0x6'));var ejs=require(_0x9ce6('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9ce6('0x8'));var squel=require('squel');var crypto=require(_0x9ce6('0x9'));var jsforce=require(_0x9ce6('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9ce6('0xb'));var Papa=require(_0x9ce6('0xc'));var Redis=require(_0x9ce6('0xd'));var authService=require(_0x9ce6('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x9ce6('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9ce6('0x10'))(_0x9ce6('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5870ee,_0x5f0436){_0x5f0436=_0x5f0436||0xcc;return function(_0x9eb9a7){if(_0x9eb9a7){return _0x5870ee['sendStatus'](_0x5f0436);}return _0x5870ee['status'](_0x5f0436)[_0x9ce6('0x12')]();};}function respondWithResult(_0x4d0be4,_0x1f7c45){_0x1f7c45=_0x1f7c45||0xc8;return function(_0x32aed2){if(_0x32aed2){return _0x4d0be4['status'](_0x1f7c45)['json'](_0x32aed2);}};}function respondWithFilteredResult(_0x34eadd,_0x4059cc){return function(_0xac3335){if(_0xac3335){var _0x478f80=typeof _0x4059cc[_0x9ce6('0x13')]===_0x9ce6('0x14')&&typeof _0x4059cc[_0x9ce6('0x15')]===_0x9ce6('0x14');var _0x224b35=_0xac3335['count'];var _0x1ca4a5=_0x478f80?0x0:_0x4059cc['offset'];var _0x425208=_0x478f80?_0xac3335[_0x9ce6('0x16')]:_0x4059cc[_0x9ce6('0x13')]+_0x4059cc[_0x9ce6('0x15')];var _0x1b7439;if(_0x425208>=_0x224b35){_0x425208=_0x224b35;_0x1b7439=0xc8;}else{_0x1b7439=0xce;}_0x34eadd[_0x9ce6('0x17')](_0x1b7439);return _0x34eadd[_0x9ce6('0x18')]('Content-Range',_0x1ca4a5+'-'+_0x425208+'/'+_0x224b35)[_0x9ce6('0x19')](_0xac3335);}return null;};}function patchUpdates(_0xa3796f){return function(_0x4c89a1){try{jsonpatch[_0x9ce6('0x1a')](_0x4c89a1,_0xa3796f,!![]);}catch(_0x460ea9){return BPromise[_0x9ce6('0x1b')](_0x460ea9);}return _0x4c89a1[_0x9ce6('0x1c')]();};}function saveUpdates(_0x1706d6,_0x3c68f4){return function(_0x57b24a){if(_0x57b24a){return _0x57b24a[_0x9ce6('0x1d')](_0x1706d6)[_0x9ce6('0x1e')](function(_0x469d02){return _0x469d02;});}return null;};}function removeEntity(_0x5ac39e,_0xa4765d){return function(_0x136b79){if(_0x136b79){return _0x136b79['destroy']()[_0x9ce6('0x1e')](function(){_0x5ac39e['status'](0xcc)[_0x9ce6('0x12')]();});}};}function handleEntityNotFound(_0x1efa03,_0x4c60e5){return function(_0x2df510){if(!_0x2df510){_0x1efa03[_0x9ce6('0x1f')](0x194);}return _0x2df510;};}function handleError(_0x3ae91e,_0x1faac7){_0x1faac7=_0x1faac7||0x1f4;return function(_0x35c486){logger[_0x9ce6('0x20')](_0x35c486[_0x9ce6('0x21')]);if(_0x35c486['name']){delete _0x35c486[_0x9ce6('0x22')];}_0x3ae91e[_0x9ce6('0x17')](_0x1faac7)[_0x9ce6('0x23')](_0x35c486);};}exports[_0x9ce6('0x24')]=function(_0x58c552,_0x34d3bc){var _0x25f2a1={},_0x32e99f={},_0x16032a={'count':0x0,'rows':[]};var _0x556b6f=_[_0x9ce6('0x25')](db[_0x9ce6('0x26')]['rawAttributes'],function(_0x598863){return{'name':_0x598863['fieldName'],'type':_0x598863[_0x9ce6('0x27')][_0x9ce6('0x28')]};});_0x32e99f[_0x9ce6('0x29')]=_[_0x9ce6('0x25')](_0x556b6f,_0x9ce6('0x22'));_0x32e99f[_0x9ce6('0x2a')]=_[_0x9ce6('0x2b')](_0x58c552[_0x9ce6('0x2a')]);_0x32e99f['filters']=_['intersection'](_0x32e99f[_0x9ce6('0x29')],_0x32e99f[_0x9ce6('0x2a')]);_0x25f2a1['attributes']=_[_0x9ce6('0x2c')](_0x32e99f[_0x9ce6('0x29')],qs[_0x9ce6('0x2d')](_0x58c552[_0x9ce6('0x2a')]['fields']));_0x25f2a1[_0x9ce6('0x2e')]=_0x25f2a1[_0x9ce6('0x2e')][_0x9ce6('0x2f')]?_0x25f2a1[_0x9ce6('0x2e')]:_0x32e99f['model'];if(!_0x58c552['query'][_0x9ce6('0x30')](_0x9ce6('0x31'))){_0x25f2a1[_0x9ce6('0x15')]=qs[_0x9ce6('0x15')](_0x58c552[_0x9ce6('0x2a')]['limit']);_0x25f2a1[_0x9ce6('0x13')]=qs[_0x9ce6('0x13')](_0x58c552[_0x9ce6('0x2a')][_0x9ce6('0x13')]);}_0x25f2a1[_0x9ce6('0x32')]=qs['sort'](_0x58c552[_0x9ce6('0x2a')][_0x9ce6('0x33')]);_0x25f2a1[_0x9ce6('0x34')]=qs[_0x9ce6('0x35')](_['pick'](_0x58c552[_0x9ce6('0x2a')],_0x32e99f[_0x9ce6('0x35')]),_0x556b6f);if(_0x58c552['query'][_0x9ce6('0x36')]){_0x25f2a1[_0x9ce6('0x34')]=_[_0x9ce6('0x37')](_0x25f2a1['where'],{'$or':_['map'](_0x556b6f,function(_0xb55333){if(_0xb55333[_0x9ce6('0x27')]!==_0x9ce6('0x38')){var _0x9c3f32={};_0x9c3f32[_0xb55333[_0x9ce6('0x22')]]={'$like':'%'+_0x58c552[_0x9ce6('0x2a')]['filter']+'%'};return _0x9c3f32;}})});}_0x25f2a1=_[_0x9ce6('0x37')]({},_0x25f2a1,_0x58c552['options']);var _0x4b5e17={'where':_0x25f2a1[_0x9ce6('0x34')]};return db['ZohoConfiguration'][_0x9ce6('0x16')](_0x4b5e17)['then'](function(_0x4a0f8f){_0x16032a[_0x9ce6('0x16')]=_0x4a0f8f;if(_0x58c552[_0x9ce6('0x2a')][_0x9ce6('0x39')]){_0x25f2a1[_0x9ce6('0x3a')]=[{'all':!![]}];}return db[_0x9ce6('0x26')]['findAll'](_0x25f2a1);})[_0x9ce6('0x1e')](function(_0x2046dd){_0x16032a[_0x9ce6('0x3b')]=_0x2046dd;return _0x16032a;})[_0x9ce6('0x1e')](respondWithFilteredResult(_0x34d3bc,_0x25f2a1))[_0x9ce6('0x3c')](handleError(_0x34d3bc,null));};exports[_0x9ce6('0x3d')]=function(_0x91d72f,_0xf2982a){var _0x2a7069={'raw':![],'where':{'id':_0x91d72f[_0x9ce6('0x3e')]['id']}},_0x11ec12={};_0x11ec12[_0x9ce6('0x29')]=_[_0x9ce6('0x2b')](db[_0x9ce6('0x26')][_0x9ce6('0x3f')]);_0x11ec12[_0x9ce6('0x2a')]=_[_0x9ce6('0x2b')](_0x91d72f[_0x9ce6('0x2a')]);_0x11ec12[_0x9ce6('0x35')]=_['intersection'](_0x11ec12[_0x9ce6('0x29')],_0x11ec12[_0x9ce6('0x2a')]);_0x2a7069[_0x9ce6('0x2e')]=_[_0x9ce6('0x2c')](_0x11ec12[_0x9ce6('0x29')],qs[_0x9ce6('0x2d')](_0x91d72f[_0x9ce6('0x2a')][_0x9ce6('0x2d')]));_0x2a7069[_0x9ce6('0x2e')]=_0x2a7069[_0x9ce6('0x2e')][_0x9ce6('0x2f')]?_0x2a7069[_0x9ce6('0x2e')]:_0x11ec12[_0x9ce6('0x29')];if(_0x91d72f[_0x9ce6('0x2a')][_0x9ce6('0x39')]){_0x2a7069[_0x9ce6('0x3a')]=[{'all':!![]}];}_0x2a7069=_[_0x9ce6('0x37')]({},_0x2a7069,_0x91d72f['options']);return db[_0x9ce6('0x26')][_0x9ce6('0x40')](_0x2a7069)['then'](handleEntityNotFound(_0xf2982a,null))[_0x9ce6('0x1e')](respondWithResult(_0xf2982a,null))[_0x9ce6('0x3c')](handleError(_0xf2982a,null));};exports[_0x9ce6('0x41')]=function(_0x5bcc4d,_0x5877e1){return db['ZohoConfiguration'][_0x9ce6('0x41')](_0x5bcc4d[_0x9ce6('0x42')],{})[_0x9ce6('0x1e')](respondWithResult(_0x5877e1,0xc9))[_0x9ce6('0x3c')](handleError(_0x5877e1,null));};exports['update']=function(_0x31441a,_0xc527b6){if(_0x31441a[_0x9ce6('0x42')]['id']){delete _0x31441a['body']['id'];}return db[_0x9ce6('0x26')][_0x9ce6('0x40')]({'where':{'id':_0x31441a[_0x9ce6('0x3e')]['id']}})[_0x9ce6('0x1e')](handleEntityNotFound(_0xc527b6,null))[_0x9ce6('0x1e')](saveUpdates(_0x31441a['body'],null))[_0x9ce6('0x1e')](respondWithResult(_0xc527b6,null))[_0x9ce6('0x3c')](handleError(_0xc527b6,null));};exports['destroy']=function(_0x264584,_0x538371){return db[_0x9ce6('0x26')][_0x9ce6('0x40')]({'where':{'id':_0x264584[_0x9ce6('0x3e')]['id']}})[_0x9ce6('0x1e')](handleEntityNotFound(_0x538371,null))[_0x9ce6('0x1e')](removeEntity(_0x538371,null))[_0x9ce6('0x3c')](handleError(_0x538371,null));};exports['getFields']=function(_0x3d62c3,_0x39f573,_0x227080){var _0xc3e0fb={};var _0x5ccafc={};var _0x62c1a7;var _0xa9b9bf;return db['ZohoConfiguration'][_0x9ce6('0x43')]({'where':{'id':_0x3d62c3[_0x9ce6('0x3e')]['id']}})[_0x9ce6('0x1e')](handleEntityNotFound(_0x39f573,null))['then'](function(_0x4aa68e){if(_0x4aa68e){_0x62c1a7=_0x4aa68e;_0x5ccafc[_0x9ce6('0x29')]=_[_0x9ce6('0x2b')](db[_0x9ce6('0x44')][_0x9ce6('0x3f')]);_0x5ccafc[_0x9ce6('0x2a')]=_['keys'](_0x3d62c3['query']);_0x5ccafc[_0x9ce6('0x35')]=_[_0x9ce6('0x2c')](_0x5ccafc[_0x9ce6('0x29')],_0x5ccafc[_0x9ce6('0x2a')]);_0xc3e0fb[_0x9ce6('0x2e')]=_[_0x9ce6('0x2c')](_0x5ccafc[_0x9ce6('0x29')],qs[_0x9ce6('0x2d')](_0x3d62c3[_0x9ce6('0x2a')]['fields']));_0xc3e0fb[_0x9ce6('0x2e')]=_0xc3e0fb['attributes'][_0x9ce6('0x2f')]?_0xc3e0fb[_0x9ce6('0x2e')]:_0x5ccafc[_0x9ce6('0x29')];_0xc3e0fb['order']=qs['sort'](_0x3d62c3[_0x9ce6('0x2a')]['sort']);_0xc3e0fb[_0x9ce6('0x34')]=qs[_0x9ce6('0x35')](_[_0x9ce6('0x45')](_0x3d62c3[_0x9ce6('0x2a')],_0x5ccafc[_0x9ce6('0x35')]));if(_0x3d62c3[_0x9ce6('0x2a')][_0x9ce6('0x36')]){_0xc3e0fb[_0x9ce6('0x34')]=_['merge'](_0xc3e0fb['where'],{'$or':_[_0x9ce6('0x25')](_0xc3e0fb[_0x9ce6('0x2e')],function(_0x5ede5f){var _0x54bfff={};_0x54bfff[_0x5ede5f]={'$like':'%'+_0x3d62c3[_0x9ce6('0x2a')][_0x9ce6('0x36')]+'%'};return _0x54bfff;})});}_0xc3e0fb=_['merge']({},_0xc3e0fb,_0x3d62c3['options']);return _0x62c1a7['getFields'](_0xc3e0fb);}})['then'](function(_0x5993c2){if(_0x5993c2){_0xa9b9bf=_0x5993c2['length'];if(!_0x3d62c3[_0x9ce6('0x2a')][_0x9ce6('0x30')](_0x9ce6('0x31'))){_0xc3e0fb[_0x9ce6('0x15')]=qs['limit'](_0x3d62c3[_0x9ce6('0x2a')][_0x9ce6('0x15')]);_0xc3e0fb[_0x9ce6('0x13')]=qs[_0x9ce6('0x13')](_0x3d62c3[_0x9ce6('0x2a')][_0x9ce6('0x13')]);}return _0x62c1a7[_0x9ce6('0x46')](_0xc3e0fb);}})[_0x9ce6('0x1e')](function(_0x4a8493){if(_0x4a8493){return _0x4a8493?{'count':_0xa9b9bf,'rows':_0x4a8493}:null;}})['then'](respondWithResult(_0x39f573,null))[_0x9ce6('0x3c')](handleError(_0x39f573,null));};exports[_0x9ce6('0x47')]=function(_0x38ff5a,_0x1ed362,_0x4d60e9){var _0x37090a={};var _0x2dc200={};var _0x2febf3;var _0xa329ee;return db[_0x9ce6('0x26')][_0x9ce6('0x43')]({'where':{'id':_0x38ff5a[_0x9ce6('0x3e')]['id']}})[_0x9ce6('0x1e')](handleEntityNotFound(_0x1ed362,null))['then'](function(_0x285135){if(_0x285135){_0x2febf3=_0x285135;_0x2dc200[_0x9ce6('0x29')]=_['keys'](db['ZohoField'][_0x9ce6('0x3f')]);_0x2dc200[_0x9ce6('0x2a')]=_[_0x9ce6('0x2b')](_0x38ff5a[_0x9ce6('0x2a')]);_0x2dc200['filters']=_[_0x9ce6('0x2c')](_0x2dc200[_0x9ce6('0x29')],_0x2dc200[_0x9ce6('0x2a')]);_0x37090a[_0x9ce6('0x2e')]=_[_0x9ce6('0x2c')](_0x2dc200['model'],qs[_0x9ce6('0x2d')](_0x38ff5a[_0x9ce6('0x2a')]['fields']));_0x37090a[_0x9ce6('0x2e')]=_0x37090a[_0x9ce6('0x2e')]['length']?_0x37090a[_0x9ce6('0x2e')]:_0x2dc200[_0x9ce6('0x29')];_0x37090a['order']=qs[_0x9ce6('0x33')](_0x38ff5a[_0x9ce6('0x2a')]['sort']);_0x37090a[_0x9ce6('0x34')]=qs[_0x9ce6('0x35')](_[_0x9ce6('0x45')](_0x38ff5a[_0x9ce6('0x2a')],_0x2dc200[_0x9ce6('0x35')]));if(_0x38ff5a['query'][_0x9ce6('0x36')]){_0x37090a['where']=_['merge'](_0x37090a[_0x9ce6('0x34')],{'$or':_['map'](_0x37090a[_0x9ce6('0x2e')],function(_0x315748){var _0x53c9d2={};_0x53c9d2[_0x315748]={'$like':'%'+_0x38ff5a[_0x9ce6('0x2a')][_0x9ce6('0x36')]+'%'};return _0x53c9d2;})});}_0x37090a=_[_0x9ce6('0x37')]({},_0x37090a,_0x38ff5a[_0x9ce6('0x48')]);return _0x2febf3[_0x9ce6('0x47')](_0x37090a);}})[_0x9ce6('0x1e')](function(_0x80bcec){if(_0x80bcec){_0xa329ee=_0x80bcec[_0x9ce6('0x2f')];if(!_0x38ff5a['query'][_0x9ce6('0x30')]('nolimit')){_0x37090a[_0x9ce6('0x15')]=qs[_0x9ce6('0x15')](_0x38ff5a[_0x9ce6('0x2a')][_0x9ce6('0x15')]);_0x37090a[_0x9ce6('0x13')]=qs[_0x9ce6('0x13')](_0x38ff5a[_0x9ce6('0x2a')]['offset']);}return _0x2febf3[_0x9ce6('0x47')](_0x37090a);}})[_0x9ce6('0x1e')](function(_0x1e50ef){if(_0x1e50ef){return _0x1e50ef?{'count':_0xa329ee,'rows':_0x1e50ef}:null;}})['then'](respondWithResult(_0x1ed362,null))[_0x9ce6('0x3c')](handleError(_0x1ed362,null));};exports['getDescriptions']=function(_0x24297a,_0x3eaeed,_0x4a0c9f){var _0x10e43c={};var _0x775034={};var _0x1d35c4;var _0x182e98;return db[_0x9ce6('0x26')]['findOne']({'where':{'id':_0x24297a[_0x9ce6('0x3e')]['id']}})[_0x9ce6('0x1e')](handleEntityNotFound(_0x3eaeed,null))[_0x9ce6('0x1e')](function(_0x56224d){if(_0x56224d){_0x1d35c4=_0x56224d;_0x775034['model']=_[_0x9ce6('0x2b')](db[_0x9ce6('0x44')][_0x9ce6('0x3f')]);_0x775034['query']=_[_0x9ce6('0x2b')](_0x24297a[_0x9ce6('0x2a')]);_0x775034[_0x9ce6('0x35')]=_[_0x9ce6('0x2c')](_0x775034[_0x9ce6('0x29')],_0x775034[_0x9ce6('0x2a')]);_0x10e43c[_0x9ce6('0x2e')]=_[_0x9ce6('0x2c')](_0x775034[_0x9ce6('0x29')],qs[_0x9ce6('0x2d')](_0x24297a[_0x9ce6('0x2a')]['fields']));_0x10e43c[_0x9ce6('0x2e')]=_0x10e43c[_0x9ce6('0x2e')][_0x9ce6('0x2f')]?_0x10e43c['attributes']:_0x775034[_0x9ce6('0x29')];_0x10e43c[_0x9ce6('0x32')]=qs[_0x9ce6('0x33')](_0x24297a[_0x9ce6('0x2a')][_0x9ce6('0x33')]);_0x10e43c['where']=qs[_0x9ce6('0x35')](_['pick'](_0x24297a['query'],_0x775034[_0x9ce6('0x35')]));if(_0x24297a[_0x9ce6('0x2a')][_0x9ce6('0x36')]){_0x10e43c[_0x9ce6('0x34')]=_[_0x9ce6('0x37')](_0x10e43c[_0x9ce6('0x34')],{'$or':_[_0x9ce6('0x25')](_0x10e43c[_0x9ce6('0x2e')],function(_0x399c6d){var _0x47029c={};_0x47029c[_0x399c6d]={'$like':'%'+_0x24297a[_0x9ce6('0x2a')][_0x9ce6('0x36')]+'%'};return _0x47029c;})});}_0x10e43c=_['merge']({},_0x10e43c,_0x24297a[_0x9ce6('0x48')]);return _0x1d35c4['getDescriptions'](_0x10e43c);}})[_0x9ce6('0x1e')](function(_0x62a4f1){if(_0x62a4f1){_0x182e98=_0x62a4f1[_0x9ce6('0x2f')];if(!_0x24297a['query'][_0x9ce6('0x30')]('nolimit')){_0x10e43c[_0x9ce6('0x15')]=qs['limit'](_0x24297a[_0x9ce6('0x2a')][_0x9ce6('0x15')]);_0x10e43c[_0x9ce6('0x13')]=qs[_0x9ce6('0x13')](_0x24297a['query'][_0x9ce6('0x13')]);}return _0x1d35c4[_0x9ce6('0x49')](_0x10e43c);}})['then'](function(_0x245b80){if(_0x245b80){return _0x245b80?{'count':_0x182e98,'rows':_0x245b80}:null;}})['then'](respondWithResult(_0x3eaeed,null))[_0x9ce6('0x3c')](handleError(_0x3eaeed,null));}; \ No newline at end of file +var _0x5078=['offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','error','stack','name','send','map','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','merge','options','ZohoConfiguration','includeAll','findAll','show','params','keys','include','find','catch','create','body','update','destroy','getFields','ZohoField','length','hasOwnProperty','getSubjects','findOne','getDescriptions','eml-format','zip-dir','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','sendStatus','end','status','json'];(function(_0x243984,_0x5dfe29){var _0x475e3e=function(_0x53a0ba){while(--_0x53a0ba){_0x243984['push'](_0x243984['shift']());}};_0x475e3e(++_0x5dfe29);}(_0x5078,0x124));var _0x8507=function(_0x3e1ccd,_0x3d3880){_0x3e1ccd=_0x3e1ccd-0x0;var _0x3e02ed=_0x5078[_0x3e1ccd];return _0x3e02ed;};'use strict';var emlformat=require(_0x8507('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8507('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8507('0x2'));var Mustache=require(_0x8507('0x3'));var util=require(_0x8507('0x4'));var path=require(_0x8507('0x5'));var sox=require(_0x8507('0x6'));var csv=require(_0x8507('0x7'));var ejs=require(_0x8507('0x8'));var fs=require('fs');var fs_extra=require(_0x8507('0x9'));var _=require(_0x8507('0xa'));var squel=require(_0x8507('0xb'));var crypto=require(_0x8507('0xc'));var jsforce=require(_0x8507('0xd'));var deskjs=require(_0x8507('0xe'));var toCsv=require(_0x8507('0x7'));var querystring=require(_0x8507('0xf'));var Papa=require(_0x8507('0x10'));var Redis=require(_0x8507('0x11'));var authService=require(_0x8507('0x12'));var qs=require(_0x8507('0x13'));var as=require(_0x8507('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8507('0x15'))(_0x8507('0x16'));var utils=require(_0x8507('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x31b554,_0x1bd614){_0x1bd614=_0x1bd614||0xcc;return function(_0x523832){if(_0x523832){return _0x31b554[_0x8507('0x18')](_0x1bd614);}return _0x31b554['status'](_0x1bd614)[_0x8507('0x19')]();};}function respondWithResult(_0x137b26,_0x3a18ee){_0x3a18ee=_0x3a18ee||0xc8;return function(_0x40add8){if(_0x40add8){return _0x137b26[_0x8507('0x1a')](_0x3a18ee)[_0x8507('0x1b')](_0x40add8);}};}function respondWithFilteredResult(_0x2195d5,_0x50bef1){return function(_0xa244f2){if(_0xa244f2){var _0x4fd627=typeof _0x50bef1[_0x8507('0x1c')]===_0x8507('0x1d')&&typeof _0x50bef1[_0x8507('0x1e')]===_0x8507('0x1d');var _0x206e65=_0xa244f2[_0x8507('0x1f')];var _0x24a6c2=_0x4fd627?0x0:_0x50bef1[_0x8507('0x1c')];var _0x5aaf66=_0x4fd627?_0xa244f2[_0x8507('0x1f')]:_0x50bef1[_0x8507('0x1c')]+_0x50bef1[_0x8507('0x1e')];var _0x6baa44;if(_0x5aaf66>=_0x206e65){_0x5aaf66=_0x206e65;_0x6baa44=0xc8;}else{_0x6baa44=0xce;}_0x2195d5['status'](_0x6baa44);return _0x2195d5[_0x8507('0x20')](_0x8507('0x21'),_0x24a6c2+'-'+_0x5aaf66+'/'+_0x206e65)[_0x8507('0x1b')](_0xa244f2);}return null;};}function patchUpdates(_0x2aea34){return function(_0x3444a7){try{jsonpatch[_0x8507('0x22')](_0x3444a7,_0x2aea34,!![]);}catch(_0x360b4a){return BPromise[_0x8507('0x23')](_0x360b4a);}return _0x3444a7[_0x8507('0x24')]();};}function saveUpdates(_0x261754,_0x3b72c1){return function(_0x3b5a50){if(_0x3b5a50){return _0x3b5a50['update'](_0x261754)[_0x8507('0x25')](function(_0x415bdb){return _0x415bdb;});}return null;};}function removeEntity(_0xeb232d,_0xeafeab){return function(_0x47f029){if(_0x47f029){return _0x47f029['destroy']()['then'](function(){_0xeb232d[_0x8507('0x1a')](0xcc)[_0x8507('0x19')]();});}};}function handleEntityNotFound(_0x56c253,_0x491ffd){return function(_0x3f455d){if(!_0x3f455d){_0x56c253[_0x8507('0x18')](0x194);}return _0x3f455d;};}function handleError(_0x34b899,_0x320104){_0x320104=_0x320104||0x1f4;return function(_0x25ebc0){logger[_0x8507('0x26')](_0x25ebc0[_0x8507('0x27')]);if(_0x25ebc0[_0x8507('0x28')]){delete _0x25ebc0[_0x8507('0x28')];}_0x34b899[_0x8507('0x1a')](_0x320104)[_0x8507('0x29')](_0x25ebc0);};}exports['index']=function(_0x3e3d7d,_0x23967f){var _0x538e30={},_0x53096a={},_0x1ffd92={'count':0x0,'rows':[]};var _0x3df8fe=_[_0x8507('0x2a')](db['ZohoConfiguration'][_0x8507('0x2b')],function(_0xe69858){return{'name':_0xe69858['fieldName'],'type':_0xe69858[_0x8507('0x2c')][_0x8507('0x2d')]};});_0x53096a[_0x8507('0x2e')]=_[_0x8507('0x2a')](_0x3df8fe,_0x8507('0x28'));_0x53096a[_0x8507('0x2f')]=_['keys'](_0x3e3d7d[_0x8507('0x2f')]);_0x53096a[_0x8507('0x30')]=_[_0x8507('0x31')](_0x53096a[_0x8507('0x2e')],_0x53096a[_0x8507('0x2f')]);_0x538e30['attributes']=_[_0x8507('0x31')](_0x53096a['model'],qs[_0x8507('0x32')](_0x3e3d7d['query'][_0x8507('0x32')]));_0x538e30[_0x8507('0x33')]=_0x538e30[_0x8507('0x33')]['length']?_0x538e30[_0x8507('0x33')]:_0x53096a[_0x8507('0x2e')];if(!_0x3e3d7d['query']['hasOwnProperty'](_0x8507('0x34'))){_0x538e30[_0x8507('0x1e')]=qs[_0x8507('0x1e')](_0x3e3d7d[_0x8507('0x2f')]['limit']);_0x538e30['offset']=qs[_0x8507('0x1c')](_0x3e3d7d[_0x8507('0x2f')]['offset']);}_0x538e30[_0x8507('0x35')]=qs[_0x8507('0x36')](_0x3e3d7d[_0x8507('0x2f')]['sort']);_0x538e30[_0x8507('0x37')]=qs[_0x8507('0x30')](_[_0x8507('0x38')](_0x3e3d7d['query'],_0x53096a[_0x8507('0x30')]),_0x3df8fe);if(_0x3e3d7d[_0x8507('0x2f')][_0x8507('0x39')]){_0x538e30[_0x8507('0x37')]=_['merge'](_0x538e30['where'],{'$or':_[_0x8507('0x2a')](_0x3df8fe,function(_0x38ddd9){if(_0x38ddd9[_0x8507('0x2c')]!=='VIRTUAL'){var _0x4294a0={};_0x4294a0[_0x38ddd9['name']]={'$like':'%'+_0x3e3d7d[_0x8507('0x2f')][_0x8507('0x39')]+'%'};return _0x4294a0;}})});}_0x538e30=_[_0x8507('0x3a')]({},_0x538e30,_0x3e3d7d[_0x8507('0x3b')]);var _0x2bddde={'where':_0x538e30[_0x8507('0x37')]};return db[_0x8507('0x3c')][_0x8507('0x1f')](_0x2bddde)[_0x8507('0x25')](function(_0x230bc8){_0x1ffd92[_0x8507('0x1f')]=_0x230bc8;if(_0x3e3d7d[_0x8507('0x2f')][_0x8507('0x3d')]){_0x538e30['include']=[{'all':!![]}];}return db[_0x8507('0x3c')][_0x8507('0x3e')](_0x538e30);})[_0x8507('0x25')](function(_0xeb7358){_0x1ffd92['rows']=_0xeb7358;return _0x1ffd92;})[_0x8507('0x25')](respondWithFilteredResult(_0x23967f,_0x538e30))['catch'](handleError(_0x23967f,null));};exports[_0x8507('0x3f')]=function(_0x5ab1d0,_0x4dab02){var _0x1df6cd={'raw':![],'where':{'id':_0x5ab1d0[_0x8507('0x40')]['id']}},_0x4cbab7={};_0x4cbab7[_0x8507('0x2e')]=_[_0x8507('0x41')](db[_0x8507('0x3c')][_0x8507('0x2b')]);_0x4cbab7['query']=_[_0x8507('0x41')](_0x5ab1d0[_0x8507('0x2f')]);_0x4cbab7[_0x8507('0x30')]=_[_0x8507('0x31')](_0x4cbab7['model'],_0x4cbab7[_0x8507('0x2f')]);_0x1df6cd[_0x8507('0x33')]=_['intersection'](_0x4cbab7[_0x8507('0x2e')],qs[_0x8507('0x32')](_0x5ab1d0['query'][_0x8507('0x32')]));_0x1df6cd['attributes']=_0x1df6cd[_0x8507('0x33')]['length']?_0x1df6cd[_0x8507('0x33')]:_0x4cbab7[_0x8507('0x2e')];if(_0x5ab1d0[_0x8507('0x2f')][_0x8507('0x3d')]){_0x1df6cd[_0x8507('0x42')]=[{'all':!![]}];}_0x1df6cd=_[_0x8507('0x3a')]({},_0x1df6cd,_0x5ab1d0[_0x8507('0x3b')]);return db['ZohoConfiguration'][_0x8507('0x43')](_0x1df6cd)[_0x8507('0x25')](handleEntityNotFound(_0x4dab02,null))[_0x8507('0x25')](respondWithResult(_0x4dab02,null))[_0x8507('0x44')](handleError(_0x4dab02,null));};exports[_0x8507('0x45')]=function(_0x365cc7,_0x2224b6){return db[_0x8507('0x3c')][_0x8507('0x45')](_0x365cc7[_0x8507('0x46')],{})[_0x8507('0x25')](respondWithResult(_0x2224b6,0xc9))['catch'](handleError(_0x2224b6,null));};exports[_0x8507('0x47')]=function(_0x3c9b8a,_0x57b325){if(_0x3c9b8a['body']['id']){delete _0x3c9b8a[_0x8507('0x46')]['id'];}return db['ZohoConfiguration'][_0x8507('0x43')]({'where':{'id':_0x3c9b8a[_0x8507('0x40')]['id']}})[_0x8507('0x25')](handleEntityNotFound(_0x57b325,null))[_0x8507('0x25')](saveUpdates(_0x3c9b8a[_0x8507('0x46')],null))[_0x8507('0x25')](respondWithResult(_0x57b325,null))[_0x8507('0x44')](handleError(_0x57b325,null));};exports[_0x8507('0x48')]=function(_0x37db86,_0x26a290){return db['ZohoConfiguration'][_0x8507('0x43')]({'where':{'id':_0x37db86['params']['id']}})['then'](handleEntityNotFound(_0x26a290,null))[_0x8507('0x25')](removeEntity(_0x26a290,null))[_0x8507('0x44')](handleError(_0x26a290,null));};exports[_0x8507('0x49')]=function(_0x2a4363,_0x168489,_0x2cd502){var _0x1e749b={};var _0x3b1b65={};var _0x3fdf0b;var _0x37357d;return db[_0x8507('0x3c')]['findOne']({'where':{'id':_0x2a4363[_0x8507('0x40')]['id']}})[_0x8507('0x25')](handleEntityNotFound(_0x168489,null))[_0x8507('0x25')](function(_0x5bc4a5){if(_0x5bc4a5){_0x3fdf0b=_0x5bc4a5;_0x3b1b65['model']=_[_0x8507('0x41')](db[_0x8507('0x4a')][_0x8507('0x2b')]);_0x3b1b65['query']=_[_0x8507('0x41')](_0x2a4363[_0x8507('0x2f')]);_0x3b1b65[_0x8507('0x30')]=_['intersection'](_0x3b1b65[_0x8507('0x2e')],_0x3b1b65[_0x8507('0x2f')]);_0x1e749b[_0x8507('0x33')]=_['intersection'](_0x3b1b65[_0x8507('0x2e')],qs[_0x8507('0x32')](_0x2a4363[_0x8507('0x2f')]['fields']));_0x1e749b[_0x8507('0x33')]=_0x1e749b[_0x8507('0x33')][_0x8507('0x4b')]?_0x1e749b[_0x8507('0x33')]:_0x3b1b65[_0x8507('0x2e')];_0x1e749b[_0x8507('0x35')]=qs[_0x8507('0x36')](_0x2a4363[_0x8507('0x2f')]['sort']);_0x1e749b[_0x8507('0x37')]=qs[_0x8507('0x30')](_[_0x8507('0x38')](_0x2a4363['query'],_0x3b1b65['filters']));if(_0x2a4363[_0x8507('0x2f')][_0x8507('0x39')]){_0x1e749b[_0x8507('0x37')]=_['merge'](_0x1e749b[_0x8507('0x37')],{'$or':_[_0x8507('0x2a')](_0x1e749b[_0x8507('0x33')],function(_0x1a49fc){var _0x109544={};_0x109544[_0x1a49fc]={'$like':'%'+_0x2a4363['query'][_0x8507('0x39')]+'%'};return _0x109544;})});}_0x1e749b=_[_0x8507('0x3a')]({},_0x1e749b,_0x2a4363[_0x8507('0x3b')]);return _0x3fdf0b['getFields'](_0x1e749b);}})[_0x8507('0x25')](function(_0x206228){if(_0x206228){_0x37357d=_0x206228['length'];if(!_0x2a4363[_0x8507('0x2f')][_0x8507('0x4c')](_0x8507('0x34'))){_0x1e749b[_0x8507('0x1e')]=qs[_0x8507('0x1e')](_0x2a4363['query'][_0x8507('0x1e')]);_0x1e749b['offset']=qs[_0x8507('0x1c')](_0x2a4363['query'][_0x8507('0x1c')]);}return _0x3fdf0b[_0x8507('0x49')](_0x1e749b);}})[_0x8507('0x25')](function(_0x10a5b9){if(_0x10a5b9){return _0x10a5b9?{'count':_0x37357d,'rows':_0x10a5b9}:null;}})[_0x8507('0x25')](respondWithResult(_0x168489,null))['catch'](handleError(_0x168489,null));};exports[_0x8507('0x4d')]=function(_0x3a091d,_0x175084,_0x42a1bb){var _0x329701={};var _0x2a041b={};var _0xc17ee2;var _0x1a5aac;return db[_0x8507('0x3c')][_0x8507('0x4e')]({'where':{'id':_0x3a091d[_0x8507('0x40')]['id']}})[_0x8507('0x25')](handleEntityNotFound(_0x175084,null))[_0x8507('0x25')](function(_0x2671e3){if(_0x2671e3){_0xc17ee2=_0x2671e3;_0x2a041b[_0x8507('0x2e')]=_[_0x8507('0x41')](db[_0x8507('0x4a')][_0x8507('0x2b')]);_0x2a041b[_0x8507('0x2f')]=_[_0x8507('0x41')](_0x3a091d[_0x8507('0x2f')]);_0x2a041b['filters']=_[_0x8507('0x31')](_0x2a041b[_0x8507('0x2e')],_0x2a041b['query']);_0x329701[_0x8507('0x33')]=_[_0x8507('0x31')](_0x2a041b[_0x8507('0x2e')],qs[_0x8507('0x32')](_0x3a091d['query'][_0x8507('0x32')]));_0x329701['attributes']=_0x329701[_0x8507('0x33')][_0x8507('0x4b')]?_0x329701['attributes']:_0x2a041b[_0x8507('0x2e')];_0x329701[_0x8507('0x35')]=qs['sort'](_0x3a091d[_0x8507('0x2f')][_0x8507('0x36')]);_0x329701[_0x8507('0x37')]=qs[_0x8507('0x30')](_[_0x8507('0x38')](_0x3a091d[_0x8507('0x2f')],_0x2a041b['filters']));if(_0x3a091d['query'][_0x8507('0x39')]){_0x329701[_0x8507('0x37')]=_[_0x8507('0x3a')](_0x329701['where'],{'$or':_['map'](_0x329701['attributes'],function(_0x58f1ae){var _0x1b9458={};_0x1b9458[_0x58f1ae]={'$like':'%'+_0x3a091d['query'][_0x8507('0x39')]+'%'};return _0x1b9458;})});}_0x329701=_[_0x8507('0x3a')]({},_0x329701,_0x3a091d[_0x8507('0x3b')]);return _0xc17ee2['getSubjects'](_0x329701);}})[_0x8507('0x25')](function(_0x698096){if(_0x698096){_0x1a5aac=_0x698096[_0x8507('0x4b')];if(!_0x3a091d[_0x8507('0x2f')][_0x8507('0x4c')]('nolimit')){_0x329701[_0x8507('0x1e')]=qs[_0x8507('0x1e')](_0x3a091d[_0x8507('0x2f')]['limit']);_0x329701[_0x8507('0x1c')]=qs['offset'](_0x3a091d[_0x8507('0x2f')]['offset']);}return _0xc17ee2['getSubjects'](_0x329701);}})[_0x8507('0x25')](function(_0x36c788){if(_0x36c788){return _0x36c788?{'count':_0x1a5aac,'rows':_0x36c788}:null;}})['then'](respondWithResult(_0x175084,null))['catch'](handleError(_0x175084,null));};exports[_0x8507('0x4f')]=function(_0x20111a,_0x4ebe8f,_0x54dd7a){var _0x526da0={};var _0x33843c={};var _0x491df4;var _0x3d92b4;return db[_0x8507('0x3c')][_0x8507('0x4e')]({'where':{'id':_0x20111a[_0x8507('0x40')]['id']}})[_0x8507('0x25')](handleEntityNotFound(_0x4ebe8f,null))[_0x8507('0x25')](function(_0x13421f){if(_0x13421f){_0x491df4=_0x13421f;_0x33843c['model']=_[_0x8507('0x41')](db[_0x8507('0x4a')][_0x8507('0x2b')]);_0x33843c[_0x8507('0x2f')]=_[_0x8507('0x41')](_0x20111a[_0x8507('0x2f')]);_0x33843c['filters']=_[_0x8507('0x31')](_0x33843c[_0x8507('0x2e')],_0x33843c[_0x8507('0x2f')]);_0x526da0[_0x8507('0x33')]=_[_0x8507('0x31')](_0x33843c[_0x8507('0x2e')],qs['fields'](_0x20111a[_0x8507('0x2f')][_0x8507('0x32')]));_0x526da0[_0x8507('0x33')]=_0x526da0[_0x8507('0x33')][_0x8507('0x4b')]?_0x526da0[_0x8507('0x33')]:_0x33843c['model'];_0x526da0['order']=qs[_0x8507('0x36')](_0x20111a[_0x8507('0x2f')][_0x8507('0x36')]);_0x526da0[_0x8507('0x37')]=qs[_0x8507('0x30')](_[_0x8507('0x38')](_0x20111a[_0x8507('0x2f')],_0x33843c['filters']));if(_0x20111a[_0x8507('0x2f')][_0x8507('0x39')]){_0x526da0[_0x8507('0x37')]=_[_0x8507('0x3a')](_0x526da0[_0x8507('0x37')],{'$or':_['map'](_0x526da0[_0x8507('0x33')],function(_0x25aa29){var _0x3f1e84={};_0x3f1e84[_0x25aa29]={'$like':'%'+_0x20111a[_0x8507('0x2f')][_0x8507('0x39')]+'%'};return _0x3f1e84;})});}_0x526da0=_[_0x8507('0x3a')]({},_0x526da0,_0x20111a['options']);return _0x491df4['getDescriptions'](_0x526da0);}})['then'](function(_0x387fcb){if(_0x387fcb){_0x3d92b4=_0x387fcb[_0x8507('0x4b')];if(!_0x20111a['query'][_0x8507('0x4c')]('nolimit')){_0x526da0['limit']=qs[_0x8507('0x1e')](_0x20111a[_0x8507('0x2f')][_0x8507('0x1e')]);_0x526da0['offset']=qs[_0x8507('0x1c')](_0x20111a['query'][_0x8507('0x1c')]);}return _0x491df4[_0x8507('0x4f')](_0x526da0);}})['then'](function(_0x462cbf){if(_0x462cbf){return _0x462cbf?{'count':_0x3d92b4,'rows':_0x462cbf}:null;}})[_0x8507('0x25')](respondWithResult(_0x4ebe8f,null))[_0x8507('0x44')](handleError(_0x4ebe8f,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index d95a699..399632a 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 _0x537c=['bluebird','request-promise','rimraf','../../config/environment','exports','define','ZohoConfiguration','lodash','../../config/logger','api','moment'];(function(_0x5ccf67,_0x303ec8){var _0x350dd4=function(_0x195946){while(--_0x195946){_0x5ccf67['push'](_0x5ccf67['shift']());}};_0x350dd4(++_0x303ec8);}(_0x537c,0x1bf));var _0xc537=function(_0xc95abe,_0x4d51fd){_0xc95abe=_0xc95abe-0x0;var _0xe7edc7=_0x537c[_0xc95abe];return _0xe7edc7;};'use strict';var _=require(_0xc537('0x0'));var util=require('util');var logger=require(_0xc537('0x1'))(_0xc537('0x2'));var moment=require(_0xc537('0x3'));var BPromise=require(_0xc537('0x4'));var rp=require(_0xc537('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc537('0x6'));var config=require(_0xc537('0x7'));var attributes=require('./intZohoConfiguration.attributes');module[_0xc537('0x8')]=function(_0x300462,_0x2f496a){return _0x300462[_0xc537('0x9')](_0xc537('0xa'),attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0e57=['moment','request-promise','../../config/environment','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','api'];(function(_0x124041,_0x4d585a){var _0x153145=function(_0x505cb4){while(--_0x505cb4){_0x124041['push'](_0x124041['shift']());}};_0x153145(++_0x4d585a);}(_0x0e57,0x98));var _0x70e5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0e57[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x70e5('0x0'));var util=require(_0x70e5('0x1'));var logger=require(_0x70e5('0x2'))(_0x70e5('0x3'));var moment=require(_0x70e5('0x4'));var BPromise=require('bluebird');var rp=require(_0x70e5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x70e5('0x6'));var attributes=require(_0x70e5('0x7'));module[_0x70e5('0x8')]=function(_0x567d8c,_0x44bcab){return _0x567d8c[_0x70e5('0x9')](_0x70e5('0xa'),attributes,{'tableName':_0x70e5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index 0c30b29..123e1ef 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 _0xea19=['http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client'];(function(_0x25945a,_0x24e1bc){var _0x14d9f1=function(_0x445ff3){while(--_0x445ff3){_0x25945a['push'](_0x25945a['shift']());}};_0x14d9f1(++_0x24e1bc);}(_0xea19,0x1dc));var _0x9ea1=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0xea19[_0x1abb09];return _0xea1c07;};'use strict';var _=require(_0x9ea1('0x0'));var util=require('util');var moment=require(_0x9ea1('0x1'));var BPromise=require(_0x9ea1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9ea1('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x9ea1('0x4'))(_0x9ea1('0x5'));var config=require(_0x9ea1('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x9ea1('0x7')][_0x9ea1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3c60bc,_0x5dedec,_0x357dbe){return new BPromise(function(_0x53f835,_0x5f2121){return client[_0x9ea1('0x9')](_0x3c60bc,_0x357dbe)[_0x9ea1('0xa')](function(_0xe1c932){logger[_0x9ea1('0xb')](_0x9ea1('0xc'),_0x5dedec,_0x9ea1('0xd'));logger[_0x9ea1('0xe')](_0x9ea1('0xf'),_0x5dedec,_0x9ea1('0xd'),JSON[_0x9ea1('0x10')](_0xe1c932));if(_0xe1c932['error']){if(_0xe1c932['error'][_0x9ea1('0x11')]===0x1f4){logger['error'](_0x9ea1('0xc'),_0x5dedec,_0xe1c932[_0x9ea1('0x12')][_0x9ea1('0x13')]);return _0x5f2121(_0xe1c932[_0x9ea1('0x12')][_0x9ea1('0x13')]);}logger[_0x9ea1('0x12')]('ZohoConfiguration,\x20%s,\x20%s',_0x5dedec,_0xe1c932[_0x9ea1('0x12')][_0x9ea1('0x13')]);return _0x53f835(_0xe1c932['error']['message']);}else{logger[_0x9ea1('0xb')]('ZohoConfiguration,\x20%s,\x20%s',_0x5dedec,_0x9ea1('0xd'));_0x53f835(_0xe1c932[_0x9ea1('0x14')][_0x9ea1('0x13')]);}})[_0x9ea1('0x15')](function(_0x5d8aaa){logger[_0x9ea1('0x12')](_0x9ea1('0xc'),_0x5dedec,_0x5d8aaa);_0x5f2121(_0x5d8aaa);});});} \ No newline at end of file +var _0x3524=['message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error'];(function(_0x39399f,_0x286482){var _0xde5cc6=function(_0x3880ac){while(--_0x3880ac){_0x39399f['push'](_0x39399f['shift']());}};_0xde5cc6(++_0x286482);}(_0x3524,0x1b8));var _0x4352=function(_0x10cdf6,_0x4b8187){_0x10cdf6=_0x10cdf6-0x0;var _0x13bd25=_0x3524[_0x10cdf6];return _0x13bd25;};'use strict';var _=require('lodash');var util=require(_0x4352('0x0'));var moment=require('moment');var BPromise=require(_0x4352('0x1'));var rs=require(_0x4352('0x2'));var fs=require('fs');var Redis=require(_0x4352('0x3'));var db=require(_0x4352('0x4'))['db'];var utils=require(_0x4352('0x5'));var logger=require('../../config/logger')(_0x4352('0x6'));var config=require(_0x4352('0x7'));var jayson=require(_0x4352('0x8'));var client=jayson[_0x4352('0x9')][_0x4352('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x33ff3c,_0xefec66,_0x1769e9){return new BPromise(function(_0xb813e2,_0xeae20b){return client[_0x4352('0xb')](_0x33ff3c,_0x1769e9)[_0x4352('0xc')](function(_0x4629c7){logger[_0x4352('0xd')](_0x4352('0xe'),_0xefec66,'request\x20sent');logger['debug'](_0x4352('0xf'),_0xefec66,_0x4352('0x10'),JSON[_0x4352('0x11')](_0x4629c7));if(_0x4629c7['error']){if(_0x4629c7['error'][_0x4352('0x12')]===0x1f4){logger[_0x4352('0x13')](_0x4352('0xe'),_0xefec66,_0x4629c7[_0x4352('0x13')][_0x4352('0x14')]);return _0xeae20b(_0x4629c7[_0x4352('0x13')][_0x4352('0x14')]);}logger[_0x4352('0x13')](_0x4352('0xe'),_0xefec66,_0x4629c7[_0x4352('0x13')]['message']);return _0xb813e2(_0x4629c7[_0x4352('0x13')][_0x4352('0x14')]);}else{logger['info']('ZohoConfiguration,\x20%s,\x20%s',_0xefec66,_0x4352('0x10'));_0xb813e2(_0x4629c7[_0x4352('0x15')]['message']);}})[_0x4352('0x16')](function(_0x504965){logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0xefec66,_0x504965);_0xeae20b(_0x504965);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 1886a59..03b60ca 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 _0xd646=['../../components/auth/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','show','post','create','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xd646,0x1dc));var _0x6d64=function(_0x41dcdb,_0x4e1a2f){_0x41dcdb=_0x41dcdb-0x0;var _0xce4042=_0xd646[_0x41dcdb];return _0xce4042;};'use strict';var multer=require(_0x6d64('0x0'));var util=require(_0x6d64('0x1'));var path=require(_0x6d64('0x2'));var timeout=require(_0x6d64('0x3'));var express=require(_0x6d64('0x4'));var router=express[_0x6d64('0x5')]();var fs_extra=require(_0x6d64('0x6'));var auth=require(_0x6d64('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x6d64('0x8'));var controller=require(_0x6d64('0x9'));router[_0x6d64('0xa')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0x6d64('0xb')](),controller[_0x6d64('0xc')]);router[_0x6d64('0xd')]('/',auth[_0x6d64('0xb')](),controller[_0x6d64('0xe')]);router[_0x6d64('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x6d64('0x10')]);router[_0x6d64('0x11')](_0x6d64('0x12'),auth['isAuthenticated'](),controller[_0x6d64('0x13')]);module[_0x6d64('0x14')]=router; \ No newline at end of file +var _0xacf3=['show','create','put','/:id','update','destroy','exports','path','connect-timeout','express','../../components/auth/service','../../config/environment','get','index','isAuthenticated'];(function(_0x2c525d,_0x456533){var _0xacedfc=function(_0x20807e){while(--_0x20807e){_0x2c525d['push'](_0x2c525d['shift']());}};_0xacedfc(++_0x456533);}(_0xacf3,0x115));var _0x3acf=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xacf3[_0x122ef9];return _0x42fba0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3acf('0x0'));var timeout=require(_0x3acf('0x1'));var express=require(_0x3acf('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3acf('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x3acf('0x4'));var controller=require('./intZohoField.controller');router[_0x3acf('0x5')]('/',auth['isAuthenticated'](),controller[_0x3acf('0x6')]);router['get']('/:id',auth[_0x3acf('0x7')](),controller[_0x3acf('0x8')]);router['post']('/',auth[_0x3acf('0x7')](),controller[_0x3acf('0x9')]);router[_0x3acf('0xa')](_0x3acf('0xb'),auth[_0x3acf('0x7')](),controller[_0x3acf('0xc')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x3acf('0xd')]);module[_0x3acf('0xe')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 96b33fd..42726b5 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 _0xbb32=['keyValue','picklist','STRING','ENUM','variable','sequelize','exports','string','customVariable'];(function(_0x42f6b1,_0x560c04){var _0x39b69f=function(_0x38df3c){while(--_0x38df3c){_0x42f6b1['push'](_0x42f6b1['shift']());}};_0x39b69f(++_0x560c04);}(_0xbb32,0x1e2));var _0x2bb3=function(_0x56c313,_0x4acb15){_0x56c313=_0x56c313-0x0;var _0x12987d=_0xbb32[_0x56c313];return _0x12987d;};'use strict';var Sequelize=require(_0x2bb3('0x0'));module[_0x2bb3('0x1')]={'type':{'type':Sequelize['ENUM'](_0x2bb3('0x2'),'variable',_0x2bb3('0x3'),_0x2bb3('0x4'),_0x2bb3('0x5')),'defaultValue':_0x2bb3('0x2')},'content':{'type':Sequelize[_0x2bb3('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x2bb3('0x7')](_0x2bb3('0x2'),_0x2bb3('0x8'),'customVariable')},'keyContent':{'type':Sequelize[_0x2bb3('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x2bb3('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2bb3('0x6')]}}; \ No newline at end of file +var _0x4c0a=['exports','ENUM','string','variable','keyValue','picklist','STRING','customVariable','BOOLEAN'];(function(_0x1541c6,_0x170408){var _0x41901b=function(_0x517db0){while(--_0x517db0){_0x1541c6['push'](_0x1541c6['shift']());}};_0x41901b(++_0x170408);}(_0x4c0a,0xd8));var _0xa4c0=function(_0x2e3207,_0x45ffe2){_0x2e3207=_0x2e3207-0x0;var _0x50a529=_0x4c0a[_0x2e3207];return _0x50a529;};'use strict';var Sequelize=require('sequelize');module[_0xa4c0('0x0')]={'type':{'type':Sequelize[_0xa4c0('0x1')](_0xa4c0('0x2'),_0xa4c0('0x3'),'customVariable',_0xa4c0('0x4'),_0xa4c0('0x5')),'defaultValue':_0xa4c0('0x2')},'content':{'type':Sequelize[_0xa4c0('0x6')]},'key':{'type':Sequelize[_0xa4c0('0x6')]},'keyType':{'type':Sequelize[_0xa4c0('0x1')](_0xa4c0('0x2'),_0xa4c0('0x3'),_0xa4c0('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xa4c0('0x6')]},'nameField':{'type':Sequelize[_0xa4c0('0x6')]},'customField':{'type':Sequelize[_0xa4c0('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa4c0('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 813e43e..f70599f 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 _0x5ac8=['ZohoField','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','includeAll','include','findAll','catch','show','find','create','body','params','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','end','sendStatus','error','stack','name','index'];(function(_0x339eaa,_0xbc2f72){var _0x4985b6=function(_0x10e65b){while(--_0x10e65b){_0x339eaa['push'](_0x339eaa['shift']());}};_0x4985b6(++_0xbc2f72);}(_0x5ac8,0x18b));var _0x85ac=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5ac8[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x85ac('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x85ac('0x1'));var moment=require(_0x85ac('0x2'));var BPromise=require(_0x85ac('0x3'));var Mustache=require('mustache');var util=require(_0x85ac('0x4'));var path=require(_0x85ac('0x5'));var sox=require(_0x85ac('0x6'));var csv=require(_0x85ac('0x7'));var ejs=require(_0x85ac('0x8'));var fs=require('fs');var fs_extra=require(_0x85ac('0x9'));var _=require(_0x85ac('0xa'));var squel=require('squel');var crypto=require(_0x85ac('0xb'));var jsforce=require(_0x85ac('0xc'));var deskjs=require(_0x85ac('0xd'));var toCsv=require(_0x85ac('0x7'));var querystring=require(_0x85ac('0xe'));var Papa=require('papaparse');var Redis=require(_0x85ac('0xf'));var authService=require(_0x85ac('0x10'));var qs=require(_0x85ac('0x11'));var as=require(_0x85ac('0x12'));var hardwareService=require(_0x85ac('0x13'));var logger=require(_0x85ac('0x14'))(_0x85ac('0x15'));var utils=require(_0x85ac('0x16'));var config=require(_0x85ac('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xff7df3,_0x6e435d){_0x6e435d=_0x6e435d||0xcc;return function(_0x367a24){if(_0x367a24){return _0xff7df3['sendStatus'](_0x6e435d);}return _0xff7df3[_0x85ac('0x18')](_0x6e435d)['end']();};}function respondWithResult(_0x489e4c,_0x492150){_0x492150=_0x492150||0xc8;return function(_0x26da6b){if(_0x26da6b){return _0x489e4c[_0x85ac('0x18')](_0x492150)[_0x85ac('0x19')](_0x26da6b);}};}function respondWithFilteredResult(_0x4187e0,_0x33fb45){return function(_0x44f427){if(_0x44f427){var _0x1e6898=typeof _0x33fb45[_0x85ac('0x1a')]==='undefined'&&typeof _0x33fb45[_0x85ac('0x1b')]===_0x85ac('0x1c');var _0x27acc0=_0x44f427[_0x85ac('0x1d')];var _0x1b0db0=_0x1e6898?0x0:_0x33fb45[_0x85ac('0x1a')];var _0x3c76e5=_0x1e6898?_0x44f427[_0x85ac('0x1d')]:_0x33fb45[_0x85ac('0x1a')]+_0x33fb45[_0x85ac('0x1b')];var _0x1dc778;if(_0x3c76e5>=_0x27acc0){_0x3c76e5=_0x27acc0;_0x1dc778=0xc8;}else{_0x1dc778=0xce;}_0x4187e0[_0x85ac('0x18')](_0x1dc778);return _0x4187e0[_0x85ac('0x1e')](_0x85ac('0x1f'),_0x1b0db0+'-'+_0x3c76e5+'/'+_0x27acc0)[_0x85ac('0x19')](_0x44f427);}return null;};}function patchUpdates(_0x56927b){return function(_0x7fdb13){try{jsonpatch[_0x85ac('0x20')](_0x7fdb13,_0x56927b,!![]);}catch(_0x6f3bfb){return BPromise[_0x85ac('0x21')](_0x6f3bfb);}return _0x7fdb13[_0x85ac('0x22')]();};}function saveUpdates(_0x4afa5e,_0x5ef210){return function(_0x1f7485){if(_0x1f7485){return _0x1f7485[_0x85ac('0x23')](_0x4afa5e)[_0x85ac('0x24')](function(_0xce600b){return _0xce600b;});}return null;};}function removeEntity(_0x3aa850,_0x7a2b19){return function(_0x1351cb){if(_0x1351cb){return _0x1351cb['destroy']()[_0x85ac('0x24')](function(){_0x3aa850[_0x85ac('0x18')](0xcc)[_0x85ac('0x25')]();});}};}function handleEntityNotFound(_0x563215,_0x525715){return function(_0x31b6cb){if(!_0x31b6cb){_0x563215[_0x85ac('0x26')](0x194);}return _0x31b6cb;};}function handleError(_0x48ab6e,_0x8fe66e){_0x8fe66e=_0x8fe66e||0x1f4;return function(_0xaf17f8){logger[_0x85ac('0x27')](_0xaf17f8[_0x85ac('0x28')]);if(_0xaf17f8[_0x85ac('0x29')]){delete _0xaf17f8['name'];}_0x48ab6e[_0x85ac('0x18')](_0x8fe66e)['send'](_0xaf17f8);};}exports[_0x85ac('0x2a')]=function(_0x16b569,_0xfa6129){var _0x31760a={},_0x1208fc={},_0x240070={'count':0x0,'rows':[]};var _0x42767b=_['map'](db[_0x85ac('0x2b')][_0x85ac('0x2c')],function(_0x1e2d9c){return{'name':_0x1e2d9c[_0x85ac('0x2d')],'type':_0x1e2d9c[_0x85ac('0x2e')][_0x85ac('0x2f')]};});_0x1208fc[_0x85ac('0x30')]=_[_0x85ac('0x31')](_0x42767b,_0x85ac('0x29'));_0x1208fc[_0x85ac('0x32')]=_[_0x85ac('0x33')](_0x16b569['query']);_0x1208fc[_0x85ac('0x34')]=_['intersection'](_0x1208fc[_0x85ac('0x30')],_0x1208fc[_0x85ac('0x32')]);_0x31760a[_0x85ac('0x35')]=_[_0x85ac('0x36')](_0x1208fc['model'],qs[_0x85ac('0x37')](_0x16b569[_0x85ac('0x32')][_0x85ac('0x37')]));_0x31760a[_0x85ac('0x35')]=_0x31760a[_0x85ac('0x35')][_0x85ac('0x38')]?_0x31760a[_0x85ac('0x35')]:_0x1208fc[_0x85ac('0x30')];if(!_0x16b569[_0x85ac('0x32')][_0x85ac('0x39')]('nolimit')){_0x31760a[_0x85ac('0x1b')]=qs[_0x85ac('0x1b')](_0x16b569[_0x85ac('0x32')]['limit']);_0x31760a[_0x85ac('0x1a')]=qs[_0x85ac('0x1a')](_0x16b569[_0x85ac('0x32')][_0x85ac('0x1a')]);}_0x31760a[_0x85ac('0x3a')]=qs['sort'](_0x16b569[_0x85ac('0x32')][_0x85ac('0x3b')]);_0x31760a[_0x85ac('0x3c')]=qs['filters'](_[_0x85ac('0x3d')](_0x16b569[_0x85ac('0x32')],_0x1208fc[_0x85ac('0x34')]),_0x42767b);if(_0x16b569[_0x85ac('0x32')]['filter']){_0x31760a[_0x85ac('0x3c')]=_['merge'](_0x31760a[_0x85ac('0x3c')],{'$or':_[_0x85ac('0x31')](_0x42767b,function(_0x4cd657){if(_0x4cd657['type']!=='VIRTUAL'){var _0x2bebea={};_0x2bebea[_0x4cd657['name']]={'$like':'%'+_0x16b569[_0x85ac('0x32')][_0x85ac('0x3e')]+'%'};return _0x2bebea;}})});}_0x31760a=_[_0x85ac('0x3f')]({},_0x31760a,_0x16b569['options']);var _0x3e7b18={'where':_0x31760a['where']};return db[_0x85ac('0x2b')]['count'](_0x3e7b18)[_0x85ac('0x24')](function(_0x53021d){_0x240070[_0x85ac('0x1d')]=_0x53021d;if(_0x16b569['query'][_0x85ac('0x40')]){_0x31760a[_0x85ac('0x41')]=[{'all':!![]}];}return db[_0x85ac('0x2b')][_0x85ac('0x42')](_0x31760a);})[_0x85ac('0x24')](function(_0x19243c){_0x240070['rows']=_0x19243c;return _0x240070;})[_0x85ac('0x24')](respondWithFilteredResult(_0xfa6129,_0x31760a))[_0x85ac('0x43')](handleError(_0xfa6129,null));};exports[_0x85ac('0x44')]=function(_0x4c517b,_0x4600a8){var _0x32e6c0={'raw':!![],'where':{'id':_0x4c517b['params']['id']}},_0x3753fb={};_0x3753fb['model']=_[_0x85ac('0x33')](db[_0x85ac('0x2b')][_0x85ac('0x2c')]);_0x3753fb[_0x85ac('0x32')]=_[_0x85ac('0x33')](_0x4c517b[_0x85ac('0x32')]);_0x3753fb[_0x85ac('0x34')]=_[_0x85ac('0x36')](_0x3753fb[_0x85ac('0x30')],_0x3753fb['query']);_0x32e6c0['attributes']=_[_0x85ac('0x36')](_0x3753fb['model'],qs[_0x85ac('0x37')](_0x4c517b[_0x85ac('0x32')][_0x85ac('0x37')]));_0x32e6c0[_0x85ac('0x35')]=_0x32e6c0[_0x85ac('0x35')][_0x85ac('0x38')]?_0x32e6c0[_0x85ac('0x35')]:_0x3753fb['model'];if(_0x4c517b[_0x85ac('0x32')][_0x85ac('0x40')]){_0x32e6c0[_0x85ac('0x41')]=[{'all':!![]}];}_0x32e6c0=_[_0x85ac('0x3f')]({},_0x32e6c0,_0x4c517b['options']);return db['ZohoField'][_0x85ac('0x45')](_0x32e6c0)['then'](handleEntityNotFound(_0x4600a8,null))[_0x85ac('0x24')](respondWithResult(_0x4600a8,null))[_0x85ac('0x43')](handleError(_0x4600a8,null));};exports[_0x85ac('0x46')]=function(_0x4c2b1f,_0x3de1e9){return db['ZohoField']['create'](_0x4c2b1f[_0x85ac('0x47')],{})[_0x85ac('0x24')](respondWithResult(_0x3de1e9,0xc9))['catch'](handleError(_0x3de1e9,null));};exports[_0x85ac('0x23')]=function(_0x4bd67c,_0x1fbd85){if(_0x4bd67c[_0x85ac('0x47')]['id']){delete _0x4bd67c[_0x85ac('0x47')]['id'];}return db['ZohoField'][_0x85ac('0x45')]({'where':{'id':_0x4bd67c[_0x85ac('0x48')]['id']}})[_0x85ac('0x24')](handleEntityNotFound(_0x1fbd85,null))[_0x85ac('0x24')](saveUpdates(_0x4bd67c[_0x85ac('0x47')],null))['then'](respondWithResult(_0x1fbd85,null))[_0x85ac('0x43')](handleError(_0x1fbd85,null));};exports['destroy']=function(_0x185a97,_0x877da6){return db['ZohoField'][_0x85ac('0x45')]({'where':{'id':_0x185a97[_0x85ac('0x48')]['id']}})[_0x85ac('0x24')](handleEntityNotFound(_0x877da6,null))['then'](removeEntity(_0x877da6,null))[_0x85ac('0x43')](handleError(_0x877da6,null));}; \ No newline at end of file +var _0x2716=['moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','name','index','map','ZohoField','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','include','catch','show','includeAll','find','create','body','params','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x21a11d,_0x18d8ec){var _0x474e50=function(_0x45d33b){while(--_0x45d33b){_0x21a11d['push'](_0x21a11d['shift']());}};_0x474e50(++_0x18d8ec);}(_0x2716,0xd4));var _0x6271=function(_0x2573f7,_0x1200bc){_0x2573f7=_0x2573f7-0x0;var _0x57740d=_0x2716[_0x2573f7];return _0x57740d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6271('0x0'));var zipdir=require(_0x6271('0x1'));var jsonpatch=require(_0x6271('0x2'));var rp=require(_0x6271('0x3'));var moment=require(_0x6271('0x4'));var BPromise=require(_0x6271('0x5'));var Mustache=require(_0x6271('0x6'));var util=require(_0x6271('0x7'));var path=require('path');var sox=require(_0x6271('0x8'));var csv=require(_0x6271('0x9'));var ejs=require(_0x6271('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6271('0xb'));var squel=require(_0x6271('0xc'));var crypto=require(_0x6271('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6271('0xe'));var toCsv=require(_0x6271('0x9'));var querystring=require(_0x6271('0xf'));var Papa=require(_0x6271('0x10'));var Redis=require(_0x6271('0x11'));var authService=require(_0x6271('0x12'));var qs=require(_0x6271('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6271('0x14'));var logger=require(_0x6271('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x6271('0x16'));var licenseUtil=require(_0x6271('0x17'));var db=require(_0x6271('0x18'))['db'];function respondWithStatusCode(_0x5e62a8,_0x229b96){_0x229b96=_0x229b96||0xcc;return function(_0x20139b){if(_0x20139b){return _0x5e62a8[_0x6271('0x19')](_0x229b96);}return _0x5e62a8['status'](_0x229b96)[_0x6271('0x1a')]();};}function respondWithResult(_0x3fc7fa,_0x3ba2b7){_0x3ba2b7=_0x3ba2b7||0xc8;return function(_0x22ec6b){if(_0x22ec6b){return _0x3fc7fa[_0x6271('0x1b')](_0x3ba2b7)['json'](_0x22ec6b);}};}function respondWithFilteredResult(_0x445219,_0x13cc1f){return function(_0x42c771){if(_0x42c771){var _0x34366e=typeof _0x13cc1f['offset']===_0x6271('0x1c')&&typeof _0x13cc1f[_0x6271('0x1d')]===_0x6271('0x1c');var _0xca1470=_0x42c771[_0x6271('0x1e')];var _0xdf5031=_0x34366e?0x0:_0x13cc1f['offset'];var _0x3a1da5=_0x34366e?_0x42c771[_0x6271('0x1e')]:_0x13cc1f['offset']+_0x13cc1f[_0x6271('0x1d')];var _0x16836c;if(_0x3a1da5>=_0xca1470){_0x3a1da5=_0xca1470;_0x16836c=0xc8;}else{_0x16836c=0xce;}_0x445219[_0x6271('0x1b')](_0x16836c);return _0x445219[_0x6271('0x1f')](_0x6271('0x20'),_0xdf5031+'-'+_0x3a1da5+'/'+_0xca1470)[_0x6271('0x21')](_0x42c771);}return null;};}function patchUpdates(_0x2f4c5e){return function(_0x33d976){try{jsonpatch[_0x6271('0x22')](_0x33d976,_0x2f4c5e,!![]);}catch(_0x187b5c){return BPromise['reject'](_0x187b5c);}return _0x33d976[_0x6271('0x23')]();};}function saveUpdates(_0xb81ec9,_0x5cf34d){return function(_0x4ffd3f){if(_0x4ffd3f){return _0x4ffd3f[_0x6271('0x24')](_0xb81ec9)[_0x6271('0x25')](function(_0x35294d){return _0x35294d;});}return null;};}function removeEntity(_0x1cea6c,_0x386dc7){return function(_0x43b93a){if(_0x43b93a){return _0x43b93a[_0x6271('0x26')]()['then'](function(){_0x1cea6c[_0x6271('0x1b')](0xcc)[_0x6271('0x1a')]();});}};}function handleEntityNotFound(_0x359221,_0x329a34){return function(_0x22a76b){if(!_0x22a76b){_0x359221[_0x6271('0x19')](0x194);}return _0x22a76b;};}function handleError(_0x4105a4,_0x42f10f){_0x42f10f=_0x42f10f||0x1f4;return function(_0x3b4e6c){logger['error'](_0x3b4e6c['stack']);if(_0x3b4e6c[_0x6271('0x27')]){delete _0x3b4e6c[_0x6271('0x27')];}_0x4105a4['status'](_0x42f10f)['send'](_0x3b4e6c);};}exports[_0x6271('0x28')]=function(_0x260b4e,_0x6b7489){var _0x4b3385={},_0x1b828a={},_0x3ba0d0={'count':0x0,'rows':[]};var _0x45e54a=_[_0x6271('0x29')](db[_0x6271('0x2a')][_0x6271('0x2b')],function(_0x45c166){return{'name':_0x45c166[_0x6271('0x2c')],'type':_0x45c166[_0x6271('0x2d')][_0x6271('0x2e')]};});_0x1b828a[_0x6271('0x2f')]=_[_0x6271('0x29')](_0x45e54a,_0x6271('0x27'));_0x1b828a['query']=_[_0x6271('0x30')](_0x260b4e[_0x6271('0x31')]);_0x1b828a[_0x6271('0x32')]=_['intersection'](_0x1b828a['model'],_0x1b828a['query']);_0x4b3385[_0x6271('0x33')]=_[_0x6271('0x34')](_0x1b828a[_0x6271('0x2f')],qs[_0x6271('0x35')](_0x260b4e[_0x6271('0x31')][_0x6271('0x35')]));_0x4b3385[_0x6271('0x33')]=_0x4b3385[_0x6271('0x33')][_0x6271('0x36')]?_0x4b3385[_0x6271('0x33')]:_0x1b828a[_0x6271('0x2f')];if(!_0x260b4e[_0x6271('0x31')][_0x6271('0x37')](_0x6271('0x38'))){_0x4b3385[_0x6271('0x1d')]=qs['limit'](_0x260b4e['query'][_0x6271('0x1d')]);_0x4b3385['offset']=qs[_0x6271('0x39')](_0x260b4e[_0x6271('0x31')][_0x6271('0x39')]);}_0x4b3385[_0x6271('0x3a')]=qs[_0x6271('0x3b')](_0x260b4e[_0x6271('0x31')]['sort']);_0x4b3385[_0x6271('0x3c')]=qs['filters'](_[_0x6271('0x3d')](_0x260b4e['query'],_0x1b828a[_0x6271('0x32')]),_0x45e54a);if(_0x260b4e[_0x6271('0x31')][_0x6271('0x3e')]){_0x4b3385[_0x6271('0x3c')]=_[_0x6271('0x3f')](_0x4b3385[_0x6271('0x3c')],{'$or':_[_0x6271('0x29')](_0x45e54a,function(_0x4197d6){if(_0x4197d6['type']!=='VIRTUAL'){var _0x3fb69c={};_0x3fb69c[_0x4197d6[_0x6271('0x27')]]={'$like':'%'+_0x260b4e['query'][_0x6271('0x3e')]+'%'};return _0x3fb69c;}})});}_0x4b3385=_[_0x6271('0x3f')]({},_0x4b3385,_0x260b4e['options']);var _0x539e0e={'where':_0x4b3385[_0x6271('0x3c')]};return db['ZohoField'][_0x6271('0x1e')](_0x539e0e)[_0x6271('0x25')](function(_0xc95c42){_0x3ba0d0[_0x6271('0x1e')]=_0xc95c42;if(_0x260b4e[_0x6271('0x31')]['includeAll']){_0x4b3385[_0x6271('0x40')]=[{'all':!![]}];}return db['ZohoField']['findAll'](_0x4b3385);})['then'](function(_0x31571d){_0x3ba0d0['rows']=_0x31571d;return _0x3ba0d0;})[_0x6271('0x25')](respondWithFilteredResult(_0x6b7489,_0x4b3385))[_0x6271('0x41')](handleError(_0x6b7489,null));};exports[_0x6271('0x42')]=function(_0x207d19,_0x243ae4){var _0x2e7dc8={'raw':!![],'where':{'id':_0x207d19['params']['id']}},_0xc6c1a1={};_0xc6c1a1['model']=_['keys'](db[_0x6271('0x2a')][_0x6271('0x2b')]);_0xc6c1a1[_0x6271('0x31')]=_[_0x6271('0x30')](_0x207d19[_0x6271('0x31')]);_0xc6c1a1[_0x6271('0x32')]=_[_0x6271('0x34')](_0xc6c1a1[_0x6271('0x2f')],_0xc6c1a1[_0x6271('0x31')]);_0x2e7dc8[_0x6271('0x33')]=_[_0x6271('0x34')](_0xc6c1a1[_0x6271('0x2f')],qs[_0x6271('0x35')](_0x207d19['query']['fields']));_0x2e7dc8[_0x6271('0x33')]=_0x2e7dc8[_0x6271('0x33')][_0x6271('0x36')]?_0x2e7dc8['attributes']:_0xc6c1a1[_0x6271('0x2f')];if(_0x207d19[_0x6271('0x31')][_0x6271('0x43')]){_0x2e7dc8['include']=[{'all':!![]}];}_0x2e7dc8=_[_0x6271('0x3f')]({},_0x2e7dc8,_0x207d19['options']);return db[_0x6271('0x2a')][_0x6271('0x44')](_0x2e7dc8)[_0x6271('0x25')](handleEntityNotFound(_0x243ae4,null))[_0x6271('0x25')](respondWithResult(_0x243ae4,null))[_0x6271('0x41')](handleError(_0x243ae4,null));};exports[_0x6271('0x45')]=function(_0x213098,_0x3b7bec){return db[_0x6271('0x2a')][_0x6271('0x45')](_0x213098[_0x6271('0x46')],{})[_0x6271('0x25')](respondWithResult(_0x3b7bec,0xc9))['catch'](handleError(_0x3b7bec,null));};exports[_0x6271('0x24')]=function(_0x473928,_0x21956f){if(_0x473928['body']['id']){delete _0x473928[_0x6271('0x46')]['id'];}return db['ZohoField']['find']({'where':{'id':_0x473928['params']['id']}})[_0x6271('0x25')](handleEntityNotFound(_0x21956f,null))[_0x6271('0x25')](saveUpdates(_0x473928[_0x6271('0x46')],null))[_0x6271('0x25')](respondWithResult(_0x21956f,null))[_0x6271('0x41')](handleError(_0x21956f,null));};exports['destroy']=function(_0x3e8705,_0x356af9){return db['ZohoField'][_0x6271('0x44')]({'where':{'id':_0x3e8705[_0x6271('0x47')]['id']}})[_0x6271('0x25')](handleEntityNotFound(_0x356af9,null))[_0x6271('0x25')](removeEntity(_0x356af9,null))[_0x6271('0x41')](handleError(_0x356af9,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 1ec8698..491e664 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 _0x1a37=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ZohoField','int_zoho_fields','lodash','util'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x1a37,0xb4));var _0x71a3=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x1a37[_0x4f9b18];return _0x29f20c;};'use strict';var _=require(_0x71a3('0x0'));var util=require(_0x71a3('0x1'));var logger=require(_0x71a3('0x2'))(_0x71a3('0x3'));var moment=require(_0x71a3('0x4'));var BPromise=require(_0x71a3('0x5'));var rp=require(_0x71a3('0x6'));var fs=require('fs');var path=require(_0x71a3('0x7'));var rimraf=require(_0x71a3('0x8'));var config=require(_0x71a3('0x9'));var attributes=require('./intZohoField.attributes');module[_0x71a3('0xa')]=function(_0x4f6b7a,_0xd09f7){return _0x4f6b7a[_0x71a3('0xb')](_0x71a3('0xc'),attributes,{'tableName':_0x71a3('0xd'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':['idField','FieldId'],'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(_0x1ab13e,_0x44507a){var _0xa28f8=function(_0x231213){while(--_0x231213){_0x1ab13e['push'](_0x1ab13e['shift']());}};_0xa28f8(++_0x44507a);}(_0xf61e,0x191));var _0xef61=function(_0x594030,_0x219e30){_0x594030=_0x594030-0x0;var _0x231a29=_0xf61e[_0x594030];return _0x231a29;};'use strict';var _=require(_0xef61('0x0'));var util=require(_0xef61('0x1'));var logger=require(_0xef61('0x2'))(_0xef61('0x3'));var moment=require(_0xef61('0x4'));var BPromise=require(_0xef61('0x5'));var rp=require(_0xef61('0x6'));var fs=require('fs');var path=require(_0xef61('0x7'));var rimraf=require(_0xef61('0x8'));var config=require(_0xef61('0x9'));var attributes=require(_0xef61('0xa'));module[_0xef61('0xb')]=function(_0x5b00b2,_0x9e17f4){return _0x5b00b2[_0xef61('0xc')]('ZohoField',attributes,{'tableName':_0xef61('0xd'),'paranoid':![],'indexes':[{'name':_0xef61('0xe'),'fields':[_0xef61('0xf'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 8239ff3..633ba61 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 _0xee96=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util'];(function(_0x508338,_0xcf1f4d){var _0x1ccd1b=function(_0x3b4525){while(--_0x3b4525){_0x508338['push'](_0x508338['shift']());}};_0x1ccd1b(++_0xcf1f4d);}(_0xee96,0x17e));var _0x6ee9=function(_0x5167e9,_0x59c597){_0x5167e9=_0x5167e9-0x0;var _0x5e599e=_0xee96[_0x5167e9];return _0x5e599e;};'use strict';var _=require(_0x6ee9('0x0'));var util=require(_0x6ee9('0x1'));var moment=require('moment');var BPromise=require(_0x6ee9('0x2'));var rs=require(_0x6ee9('0x3'));var fs=require('fs');var Redis=require(_0x6ee9('0x4'));var db=require(_0x6ee9('0x5'))['db'];var utils=require(_0x6ee9('0x6'));var logger=require(_0x6ee9('0x7'))('rpc');var config=require(_0x6ee9('0x8'));var jayson=require(_0x6ee9('0x9'));var client=jayson[_0x6ee9('0xa')][_0x6ee9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4468fd,_0xddf5f4,_0xe00fd3){return new BPromise(function(_0x38afbc,_0x4ffc7c){return client[_0x6ee9('0xc')](_0x4468fd,_0xe00fd3)[_0x6ee9('0xd')](function(_0x4c5098){logger[_0x6ee9('0xe')](_0x6ee9('0xf'),_0xddf5f4,_0x6ee9('0x10'));logger[_0x6ee9('0x11')](_0x6ee9('0x12'),_0xddf5f4,'request\x20sent',JSON[_0x6ee9('0x13')](_0x4c5098));if(_0x4c5098[_0x6ee9('0x14')]){if(_0x4c5098['error']['code']===0x1f4){logger[_0x6ee9('0x14')](_0x6ee9('0xf'),_0xddf5f4,_0x4c5098['error'][_0x6ee9('0x15')]);return _0x4ffc7c(_0x4c5098['error'][_0x6ee9('0x15')]);}logger[_0x6ee9('0x14')]('ZohoField,\x20%s,\x20%s',_0xddf5f4,_0x4c5098[_0x6ee9('0x14')][_0x6ee9('0x15')]);return _0x38afbc(_0x4c5098['error'][_0x6ee9('0x15')]);}else{logger[_0x6ee9('0xe')](_0x6ee9('0xf'),_0xddf5f4,_0x6ee9('0x10'));_0x38afbc(_0x4c5098[_0x6ee9('0x16')][_0x6ee9('0x15')]);}})[_0x6ee9('0x17')](function(_0xfca4d9){logger['error']('ZohoField,\x20%s,\x20%s',_0xddf5f4,_0xfca4d9);_0x4ffc7c(_0xfca4d9);});});} \ No newline at end of file +var _0x9eb5=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','util','moment','bluebird','randomstring','ioredis'];(function(_0x18ef0d,_0x5378f0){var _0x1cb21a=function(_0x19c455){while(--_0x19c455){_0x18ef0d['push'](_0x18ef0d['shift']());}};_0x1cb21a(++_0x5378f0);}(_0x9eb5,0x160));var _0x59eb=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9eb5[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x59eb('0x0'));var moment=require(_0x59eb('0x1'));var BPromise=require(_0x59eb('0x2'));var rs=require(_0x59eb('0x3'));var fs=require('fs');var Redis=require(_0x59eb('0x4'));var db=require(_0x59eb('0x5'))['db'];var utils=require(_0x59eb('0x6'));var logger=require('../../config/logger')(_0x59eb('0x7'));var config=require(_0x59eb('0x8'));var jayson=require(_0x59eb('0x9'));var client=jayson[_0x59eb('0xa')][_0x59eb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4fb2a5,_0x296027,_0x3c0bc5){return new BPromise(function(_0x130f03,_0xb4e141){return client['request'](_0x4fb2a5,_0x3c0bc5)[_0x59eb('0xc')](function(_0xcc6ad7){logger[_0x59eb('0xd')](_0x59eb('0xe'),_0x296027,_0x59eb('0xf'));logger[_0x59eb('0x10')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x296027,_0x59eb('0xf'),JSON[_0x59eb('0x11')](_0xcc6ad7));if(_0xcc6ad7[_0x59eb('0x12')]){if(_0xcc6ad7[_0x59eb('0x12')]['code']===0x1f4){logger['error'](_0x59eb('0xe'),_0x296027,_0xcc6ad7[_0x59eb('0x12')][_0x59eb('0x13')]);return _0xb4e141(_0xcc6ad7[_0x59eb('0x12')]['message']);}logger[_0x59eb('0x12')](_0x59eb('0xe'),_0x296027,_0xcc6ad7['error'][_0x59eb('0x13')]);return _0x130f03(_0xcc6ad7['error'][_0x59eb('0x13')]);}else{logger[_0x59eb('0xd')](_0x59eb('0xe'),_0x296027,_0x59eb('0xf'));_0x130f03(_0xcc6ad7[_0x59eb('0x14')][_0x59eb('0x13')]);}})['catch'](function(_0x270256){logger[_0x59eb('0x12')](_0x59eb('0xe'),_0x296027,_0x270256);_0xb4e141(_0x270256);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 69eb739..0353dd3 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0xeffcc,_0xbe4475){var _0x3c0822=function(_0x3a80c9){while(--_0x3a80c9){_0xeffcc['push'](_0xeffcc['shift']());}};_0x3c0822(++_0xbe4475);}(_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 +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x392781,_0x44c019){var _0x26420c=function(_0x2298be){while(--_0x2298be){_0x392781['push'](_0x392781['shift']());}};_0x26420c(++_0x44c019);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index f8c3fe3..da8ebdc 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 _0x8ae1=['state','sequelize','exports','STRING','unique_name_and_version','app.js','INTEGER'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x8ae1,0x1c8));var _0x18ae=function(_0x14d2a2,_0x478f51){_0x14d2a2=_0x14d2a2-0x0;var _0x2b4f8f=_0x8ae1[_0x14d2a2];return _0x2b4f8f;};'use strict';var Sequelize=require(_0x18ae('0x0'));module[_0x18ae('0x1')]={'name':{'type':Sequelize[_0x18ae('0x2')],'allowNull':![],'unique':_0x18ae('0x3')},'version':{'type':Sequelize[_0x18ae('0x2')],'allowNull':![],'unique':_0x18ae('0x3')},'main':{'type':Sequelize[_0x18ae('0x2')],'defaultValue':_0x18ae('0x4')},'filename':{'type':Sequelize[_0x18ae('0x2')]},'path':{'type':Sequelize[_0x18ae('0x2')]},'type':{'type':Sequelize[_0x18ae('0x2')]},'size':{'type':Sequelize[_0x18ae('0x5')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0x18ae('0x2')]},'state':{'type':Sequelize[_0x18ae('0x2')],'unique':_0x18ae('0x6')},'description':{'type':Sequelize[_0x18ae('0x2')]},'title':{'type':Sequelize[_0x18ae('0x2')]},'remoteUri':{'type':Sequelize[_0x18ae('0x2')]},'link':{'type':Sequelize[_0x18ae('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0x8493=['BOOLEAN','state','sequelize','STRING','app.js'];(function(_0x31e26d,_0x109038){var _0x3f78bc=function(_0xfe923d){while(--_0xfe923d){_0x31e26d['push'](_0x31e26d['shift']());}};_0x3f78bc(++_0x109038);}(_0x8493,0x151));var _0x3849=function(_0x71cd05,_0x36ac11){_0x71cd05=_0x71cd05-0x0;var _0x59c9e7=_0x8493[_0x71cd05];return _0x59c9e7;};'use strict';var Sequelize=require(_0x3849('0x0'));module['exports']={'name':{'type':Sequelize[_0x3849('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0x3849('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0x3849('0x1')],'defaultValue':_0x3849('0x2')},'filename':{'type':Sequelize[_0x3849('0x1')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x3849('0x1')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0x3849('0x3')],'defaultValue':![]},'author':{'type':Sequelize[_0x3849('0x1')]},'logo':{'type':Sequelize[_0x3849('0x1')]},'state':{'type':Sequelize['STRING'],'unique':_0x3849('0x4')},'description':{'type':Sequelize[_0x3849('0x1')]},'title':{'type':Sequelize[_0x3849('0x1')]},'remoteUri':{'type':Sequelize[_0x3849('0x1')]},'link':{'type':Sequelize[_0x3849('0x1')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index ee74980..7df4012 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 _0x1623=['model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','where','merge','options','Integration','findAll','rows','catch','show','params','length','find','create','body','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','apply','save','update','then','destroy','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','key'];(function(_0xdc37a1,_0x53ebb9){var _0x99b4fe=function(_0x2811e3){while(--_0x2811e3){_0xdc37a1['push'](_0xdc37a1['shift']());}};_0x99b4fe(++_0x53ebb9);}(_0x1623,0xab));var _0x3162=function(_0x1f4a27,_0x736224){_0x1f4a27=_0x1f4a27-0x0;var _0x54f7f7=_0x1623[_0x1f4a27];return _0x54f7f7;};'use strict';var emlformat=require(_0x3162('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3162('0x1'));var rp=require(_0x3162('0x2'));var moment=require(_0x3162('0x3'));var BPromise=require(_0x3162('0x4'));var Mustache=require(_0x3162('0x5'));var util=require('util');var path=require('path');var sox=require(_0x3162('0x6'));var csv=require('to-csv');var ejs=require(_0x3162('0x7'));var fs=require('fs');var fs_extra=require(_0x3162('0x8'));var _=require('lodash');var squel=require(_0x3162('0x9'));var crypto=require(_0x3162('0xa'));var jsforce=require(_0x3162('0xb'));var deskjs=require(_0x3162('0xc'));var toCsv=require(_0x3162('0xd'));var querystring=require(_0x3162('0xe'));var Papa=require(_0x3162('0xf'));var Redis=require(_0x3162('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3162('0x11'));var hardwareService=require(_0x3162('0x12'));var logger=require(_0x3162('0x13'))(_0x3162('0x14'));var utils=require(_0x3162('0x15'));var config=require(_0x3162('0x16'));var licenseUtil=require(_0x3162('0x17'));var db=require(_0x3162('0x18'))['db'];function respondWithStatusCode(_0x157ab8,_0x4c3625){_0x4c3625=_0x4c3625||0xcc;return function(_0x2d11c5){if(_0x2d11c5){return _0x157ab8['sendStatus'](_0x4c3625);}return _0x157ab8[_0x3162('0x19')](_0x4c3625)[_0x3162('0x1a')]();};}function respondWithResult(_0x49d1ad,_0x4a393a){_0x4a393a=_0x4a393a||0xc8;return function(_0x198764){if(_0x198764){return _0x49d1ad[_0x3162('0x19')](_0x4a393a)[_0x3162('0x1b')](_0x198764);}};}function respondWithFilteredResult(_0x4b8a3b,_0x15e348){return function(_0x3d0bea){if(_0x3d0bea){var _0x2705d1=typeof _0x15e348['offset']===_0x3162('0x1c')&&typeof _0x15e348[_0x3162('0x1d')]===_0x3162('0x1c');var _0xc3ee06=_0x3d0bea[_0x3162('0x1e')];var _0x1eed46=_0x2705d1?0x0:_0x15e348[_0x3162('0x1f')];var _0x4b2bf3=_0x2705d1?_0x3d0bea[_0x3162('0x1e')]:_0x15e348[_0x3162('0x1f')]+_0x15e348[_0x3162('0x1d')];var _0x36ca97;if(_0x4b2bf3>=_0xc3ee06){_0x4b2bf3=_0xc3ee06;_0x36ca97=0xc8;}else{_0x36ca97=0xce;}_0x4b8a3b['status'](_0x36ca97);return _0x4b8a3b[_0x3162('0x20')]('Content-Range',_0x1eed46+'-'+_0x4b2bf3+'/'+_0xc3ee06)['json'](_0x3d0bea);}return null;};}function patchUpdates(_0xa5c62b){return function(_0x3e4d23){try{jsonpatch[_0x3162('0x21')](_0x3e4d23,_0xa5c62b,!![]);}catch(_0x523fab){return BPromise['reject'](_0x523fab);}return _0x3e4d23[_0x3162('0x22')]();};}function saveUpdates(_0x396372,_0x32c051){return function(_0x26c90d){if(_0x26c90d){return _0x26c90d[_0x3162('0x23')](_0x396372)[_0x3162('0x24')](function(_0x52ae25){return _0x52ae25;});}return null;};}function removeEntity(_0x1b2713,_0x5a4994){return function(_0xd283d6){if(_0xd283d6){return _0xd283d6[_0x3162('0x25')]()[_0x3162('0x24')](function(){_0x1b2713[_0x3162('0x19')](0xcc)[_0x3162('0x1a')]();});}};}function handleEntityNotFound(_0x3c543e,_0x30552f){return function(_0x5f8f7){if(!_0x5f8f7){_0x3c543e[_0x3162('0x26')](0x194);}return _0x5f8f7;};}function handleError(_0x356c5d,_0x8fa09f){_0x8fa09f=_0x8fa09f||0x1f4;return function(_0x2f62d7){logger[_0x3162('0x27')](_0x2f62d7['stack']);if(_0x2f62d7[_0x3162('0x28')]){delete _0x2f62d7['name'];}_0x356c5d[_0x3162('0x19')](_0x8fa09f)[_0x3162('0x29')](_0x2f62d7);};}exports[_0x3162('0x2a')]=function(_0x57f567,_0x4903e7){var _0xda0389={},_0xaa1f35={},_0x14df16={'count':0x0,'rows':[]};var _0x399148=_[_0x3162('0x2b')](db['Integration'][_0x3162('0x2c')],function(_0x4e3cc2){return{'name':_0x4e3cc2[_0x3162('0x2d')],'type':_0x4e3cc2[_0x3162('0x2e')][_0x3162('0x2f')]};});_0xaa1f35[_0x3162('0x30')]=_[_0x3162('0x2b')](_0x399148,_0x3162('0x28'));_0xaa1f35[_0x3162('0x31')]=_[_0x3162('0x32')](_0x57f567['query']);_0xaa1f35[_0x3162('0x33')]=_[_0x3162('0x34')](_0xaa1f35['model'],_0xaa1f35[_0x3162('0x31')]);_0xda0389[_0x3162('0x35')]=_['intersection'](_0xaa1f35['model'],qs[_0x3162('0x36')](_0x57f567['query'][_0x3162('0x36')]));_0xda0389[_0x3162('0x35')]=_0xda0389[_0x3162('0x35')]['length']?_0xda0389['attributes']:_0xaa1f35[_0x3162('0x30')];if(!_0x57f567[_0x3162('0x31')]['hasOwnProperty'](_0x3162('0x37'))){_0xda0389['limit']=qs[_0x3162('0x1d')](_0x57f567[_0x3162('0x31')][_0x3162('0x1d')]);_0xda0389[_0x3162('0x1f')]=qs[_0x3162('0x1f')](_0x57f567[_0x3162('0x31')][_0x3162('0x1f')]);}_0xda0389[_0x3162('0x38')]=qs[_0x3162('0x39')](_0x57f567[_0x3162('0x31')][_0x3162('0x39')]);_0xda0389['where']=qs[_0x3162('0x33')](_[_0x3162('0x3a')](_0x57f567[_0x3162('0x31')],_0xaa1f35['filters']),_0x399148);if(_0x57f567['query'][_0x3162('0x3b')]){_0xda0389[_0x3162('0x3c')]=_[_0x3162('0x3d')](_0xda0389[_0x3162('0x3c')],{'$or':_['map'](_0x399148,function(_0x4186b6){if(_0x4186b6['type']!=='VIRTUAL'){var _0x5dee49={};_0x5dee49[_0x4186b6[_0x3162('0x28')]]={'$like':'%'+_0x57f567[_0x3162('0x31')][_0x3162('0x3b')]+'%'};return _0x5dee49;}})});}_0xda0389=_['merge']({},_0xda0389,_0x57f567[_0x3162('0x3e')]);var _0x2ce9c6={'where':_0xda0389[_0x3162('0x3c')]};return db[_0x3162('0x3f')][_0x3162('0x1e')](_0x2ce9c6)['then'](function(_0x5447d6){_0x14df16[_0x3162('0x1e')]=_0x5447d6;if(_0x57f567[_0x3162('0x31')]['includeAll']){_0xda0389['include']=[{'all':!![]}];}return db[_0x3162('0x3f')][_0x3162('0x40')](_0xda0389);})[_0x3162('0x24')](function(_0x4883ac){_0x14df16[_0x3162('0x41')]=_0x4883ac;return _0x14df16;})[_0x3162('0x24')](respondWithFilteredResult(_0x4903e7,_0xda0389))[_0x3162('0x42')](handleError(_0x4903e7,null));};exports[_0x3162('0x43')]=function(_0x534708,_0x2617d3){var _0x282e3e={'raw':![],'where':{'id':_0x534708[_0x3162('0x44')]['id']}},_0x522cce={};_0x522cce[_0x3162('0x30')]=_['keys'](db[_0x3162('0x3f')][_0x3162('0x2c')]);_0x522cce['query']=_[_0x3162('0x32')](_0x534708['query']);_0x522cce[_0x3162('0x33')]=_[_0x3162('0x34')](_0x522cce[_0x3162('0x30')],_0x522cce[_0x3162('0x31')]);_0x282e3e[_0x3162('0x35')]=_[_0x3162('0x34')](_0x522cce['model'],qs[_0x3162('0x36')](_0x534708[_0x3162('0x31')][_0x3162('0x36')]));_0x282e3e['attributes']=_0x282e3e[_0x3162('0x35')][_0x3162('0x45')]?_0x282e3e['attributes']:_0x522cce[_0x3162('0x30')];if(_0x534708['query']['includeAll']){_0x282e3e['include']=[{'all':!![]}];}_0x282e3e=_[_0x3162('0x3d')]({},_0x282e3e,_0x534708[_0x3162('0x3e')]);return db[_0x3162('0x3f')][_0x3162('0x46')](_0x282e3e)[_0x3162('0x24')](handleEntityNotFound(_0x2617d3,null))[_0x3162('0x24')](respondWithResult(_0x2617d3,null))[_0x3162('0x42')](handleError(_0x2617d3,null));};exports[_0x3162('0x47')]=function(_0x3d2958,_0x28865c){return db[_0x3162('0x3f')][_0x3162('0x47')](_0x3d2958[_0x3162('0x48')],{})['then'](respondWithResult(_0x28865c,0xc9))[_0x3162('0x42')](handleError(_0x28865c,null));};exports['update']=function(_0x4f1dde,_0x12d791){if(_0x4f1dde[_0x3162('0x48')]['id']){delete _0x4f1dde[_0x3162('0x48')]['id'];}return db[_0x3162('0x3f')]['find']({'where':{'id':_0x4f1dde[_0x3162('0x44')]['id']}})['then'](handleEntityNotFound(_0x12d791,null))[_0x3162('0x24')](saveUpdates(_0x4f1dde[_0x3162('0x48')],null))['then'](respondWithResult(_0x12d791,null))[_0x3162('0x42')](handleError(_0x12d791,null));};exports['destroy']=function(_0x516599,_0x13e7c4){return db[_0x3162('0x3f')][_0x3162('0x46')]({'where':{'id':_0x516599[_0x3162('0x44')]['id']}})[_0x3162('0x24')](handleEntityNotFound(_0x13e7c4,null))[_0x3162('0x24')](removeEntity(_0x13e7c4,null))[_0x3162('0x42')](handleError(_0x13e7c4,null));}; \ No newline at end of file +var _0xadb5=['model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','find','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','stack','name','send','index','map','Integration','fieldName','type','key'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xadb5,0xad));var _0x5adb=function(_0x1369e1,_0x108cbd){_0x1369e1=_0x1369e1-0x0;var _0x4331fa=_0xadb5[_0x1369e1];return _0x4331fa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5adb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5adb('0x1'));var rp=require(_0x5adb('0x2'));var moment=require(_0x5adb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5adb('0x4'));var util=require(_0x5adb('0x5'));var path=require(_0x5adb('0x6'));var sox=require('sox');var csv=require(_0x5adb('0x7'));var ejs=require(_0x5adb('0x8'));var fs=require('fs');var fs_extra=require(_0x5adb('0x9'));var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x7'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5adb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a0b70,_0x5433bf){_0x5433bf=_0x5433bf||0xcc;return function(_0x8cfcc6){if(_0x8cfcc6){return _0x2a0b70[_0x5adb('0x18')](_0x5433bf);}return _0x2a0b70[_0x5adb('0x19')](_0x5433bf)['end']();};}function respondWithResult(_0x2a545b,_0x34af2c){_0x34af2c=_0x34af2c||0xc8;return function(_0xf82f72){if(_0xf82f72){return _0x2a545b['status'](_0x34af2c)[_0x5adb('0x1a')](_0xf82f72);}};}function respondWithFilteredResult(_0x518823,_0x367d82){return function(_0x42a482){if(_0x42a482){var _0x30614e=typeof _0x367d82[_0x5adb('0x1b')]===_0x5adb('0x1c')&&typeof _0x367d82[_0x5adb('0x1d')]===_0x5adb('0x1c');var _0x42f4c6=_0x42a482[_0x5adb('0x1e')];var _0x529b65=_0x30614e?0x0:_0x367d82[_0x5adb('0x1b')];var _0x5de028=_0x30614e?_0x42a482[_0x5adb('0x1e')]:_0x367d82['offset']+_0x367d82[_0x5adb('0x1d')];var _0x50e84f;if(_0x5de028>=_0x42f4c6){_0x5de028=_0x42f4c6;_0x50e84f=0xc8;}else{_0x50e84f=0xce;}_0x518823['status'](_0x50e84f);return _0x518823[_0x5adb('0x1f')](_0x5adb('0x20'),_0x529b65+'-'+_0x5de028+'/'+_0x42f4c6)[_0x5adb('0x1a')](_0x42a482);}return null;};}function patchUpdates(_0x1fd4a7){return function(_0x99bc6c){try{jsonpatch['apply'](_0x99bc6c,_0x1fd4a7,!![]);}catch(_0x3255b3){return BPromise['reject'](_0x3255b3);}return _0x99bc6c['save']();};}function saveUpdates(_0x3754cc,_0x379b33){return function(_0x1a38d3){if(_0x1a38d3){return _0x1a38d3[_0x5adb('0x21')](_0x3754cc)[_0x5adb('0x22')](function(_0x413911){return _0x413911;});}return null;};}function removeEntity(_0xfd9bb9,_0x4ca150){return function(_0x4b1957){if(_0x4b1957){return _0x4b1957[_0x5adb('0x23')]()[_0x5adb('0x22')](function(){_0xfd9bb9[_0x5adb('0x19')](0xcc)[_0x5adb('0x24')]();});}};}function handleEntityNotFound(_0x49f203,_0x2fee18){return function(_0x2e1e63){if(!_0x2e1e63){_0x49f203['sendStatus'](0x194);}return _0x2e1e63;};}function handleError(_0x1feecf,_0x1ded9f){_0x1ded9f=_0x1ded9f||0x1f4;return function(_0x1a0acd){logger['error'](_0x1a0acd[_0x5adb('0x25')]);if(_0x1a0acd[_0x5adb('0x26')]){delete _0x1a0acd[_0x5adb('0x26')];}_0x1feecf[_0x5adb('0x19')](_0x1ded9f)[_0x5adb('0x27')](_0x1a0acd);};}exports[_0x5adb('0x28')]=function(_0x4a5d46,_0x49992e){var _0x5d457e={},_0x39bddd={},_0x1eac55={'count':0x0,'rows':[]};var _0x60a672=_[_0x5adb('0x29')](db[_0x5adb('0x2a')]['rawAttributes'],function(_0x11ec2a){return{'name':_0x11ec2a[_0x5adb('0x2b')],'type':_0x11ec2a[_0x5adb('0x2c')][_0x5adb('0x2d')]};});_0x39bddd[_0x5adb('0x2e')]=_[_0x5adb('0x29')](_0x60a672,_0x5adb('0x26'));_0x39bddd[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x4a5d46[_0x5adb('0x2f')]);_0x39bddd['filters']=_[_0x5adb('0x31')](_0x39bddd['model'],_0x39bddd[_0x5adb('0x2f')]);_0x5d457e[_0x5adb('0x32')]=_['intersection'](_0x39bddd[_0x5adb('0x2e')],qs[_0x5adb('0x33')](_0x4a5d46[_0x5adb('0x2f')]['fields']));_0x5d457e[_0x5adb('0x32')]=_0x5d457e[_0x5adb('0x32')]['length']?_0x5d457e['attributes']:_0x39bddd[_0x5adb('0x2e')];if(!_0x4a5d46['query'][_0x5adb('0x34')](_0x5adb('0x35'))){_0x5d457e[_0x5adb('0x1d')]=qs[_0x5adb('0x1d')](_0x4a5d46[_0x5adb('0x2f')]['limit']);_0x5d457e[_0x5adb('0x1b')]=qs[_0x5adb('0x1b')](_0x4a5d46[_0x5adb('0x2f')]['offset']);}_0x5d457e['order']=qs[_0x5adb('0x36')](_0x4a5d46[_0x5adb('0x2f')]['sort']);_0x5d457e[_0x5adb('0x37')]=qs['filters'](_[_0x5adb('0x38')](_0x4a5d46['query'],_0x39bddd[_0x5adb('0x39')]),_0x60a672);if(_0x4a5d46['query'][_0x5adb('0x3a')]){_0x5d457e[_0x5adb('0x37')]=_['merge'](_0x5d457e[_0x5adb('0x37')],{'$or':_['map'](_0x60a672,function(_0xadbe37){if(_0xadbe37[_0x5adb('0x2c')]!==_0x5adb('0x3b')){var _0x50edd1={};_0x50edd1[_0xadbe37[_0x5adb('0x26')]]={'$like':'%'+_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3a')]+'%'};return _0x50edd1;}})});}_0x5d457e=_[_0x5adb('0x3c')]({},_0x5d457e,_0x4a5d46[_0x5adb('0x3d')]);var _0x52d74f={'where':_0x5d457e['where']};return db['Integration']['count'](_0x52d74f)[_0x5adb('0x22')](function(_0x2fbe14){_0x1eac55[_0x5adb('0x1e')]=_0x2fbe14;if(_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0x5d457e[_0x5adb('0x3f')]=[{'all':!![]}];}return db[_0x5adb('0x2a')][_0x5adb('0x40')](_0x5d457e);})['then'](function(_0x53f2c6){_0x1eac55[_0x5adb('0x41')]=_0x53f2c6;return _0x1eac55;})['then'](respondWithFilteredResult(_0x49992e,_0x5d457e))[_0x5adb('0x42')](handleError(_0x49992e,null));};exports[_0x5adb('0x43')]=function(_0x299746,_0x121714){var _0xdfecfd={'raw':![],'where':{'id':_0x299746[_0x5adb('0x44')]['id']}},_0x522ee5={};_0x522ee5[_0x5adb('0x2e')]=_['keys'](db[_0x5adb('0x2a')][_0x5adb('0x45')]);_0x522ee5['query']=_[_0x5adb('0x30')](_0x299746[_0x5adb('0x2f')]);_0x522ee5[_0x5adb('0x39')]=_[_0x5adb('0x31')](_0x522ee5[_0x5adb('0x2e')],_0x522ee5[_0x5adb('0x2f')]);_0xdfecfd[_0x5adb('0x32')]=_['intersection'](_0x522ee5['model'],qs[_0x5adb('0x33')](_0x299746[_0x5adb('0x2f')][_0x5adb('0x33')]));_0xdfecfd[_0x5adb('0x32')]=_0xdfecfd['attributes']['length']?_0xdfecfd[_0x5adb('0x32')]:_0x522ee5[_0x5adb('0x2e')];if(_0x299746[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0xdfecfd[_0x5adb('0x3f')]=[{'all':!![]}];}_0xdfecfd=_['merge']({},_0xdfecfd,_0x299746[_0x5adb('0x3d')]);return db[_0x5adb('0x2a')]['find'](_0xdfecfd)[_0x5adb('0x22')](handleEntityNotFound(_0x121714,null))[_0x5adb('0x22')](respondWithResult(_0x121714,null))[_0x5adb('0x42')](handleError(_0x121714,null));};exports[_0x5adb('0x46')]=function(_0x186bd2,_0x3a5409){return db[_0x5adb('0x2a')][_0x5adb('0x46')](_0x186bd2['body'],{})[_0x5adb('0x22')](respondWithResult(_0x3a5409,0xc9))['catch'](handleError(_0x3a5409,null));};exports['update']=function(_0x5015ee,_0x3cd211){if(_0x5015ee[_0x5adb('0x47')]['id']){delete _0x5015ee[_0x5adb('0x47')]['id'];}return db['Integration'][_0x5adb('0x48')]({'where':{'id':_0x5015ee['params']['id']}})[_0x5adb('0x22')](handleEntityNotFound(_0x3cd211,null))[_0x5adb('0x22')](saveUpdates(_0x5015ee[_0x5adb('0x47')],null))['then'](respondWithResult(_0x3cd211,null))[_0x5adb('0x42')](handleError(_0x3cd211,null));};exports['destroy']=function(_0x22fa54,_0x6dc067){return db['Integration'][_0x5adb('0x48')]({'where':{'id':_0x22fa54[_0x5adb('0x44')]['id']}})[_0x5adb('0x22')](handleEntityNotFound(_0x6dc067,null))[_0x5adb('0x22')](removeEntity(_0x6dc067,null))[_0x5adb('0x42')](handleError(_0x6dc067,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 0293dd0..373fc8f 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 _0x8ed5=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integration.attributes','exports','integrations','lodash','util'];(function(_0x2c34ff,_0x1e8bee){var _0x476508=function(_0x3e50db){while(--_0x3e50db){_0x2c34ff['push'](_0x2c34ff['shift']());}};_0x476508(++_0x1e8bee);}(_0x8ed5,0x136));var _0x58ed=function(_0x478b0d,_0x228579){_0x478b0d=_0x478b0d-0x0;var _0x1d10f5=_0x8ed5[_0x478b0d];return _0x1d10f5;};'use strict';var _=require(_0x58ed('0x0'));var util=require(_0x58ed('0x1'));var logger=require(_0x58ed('0x2'))(_0x58ed('0x3'));var moment=require(_0x58ed('0x4'));var BPromise=require(_0x58ed('0x5'));var rp=require(_0x58ed('0x6'));var fs=require('fs');var path=require(_0x58ed('0x7'));var rimraf=require(_0x58ed('0x8'));var config=require(_0x58ed('0x9'));var attributes=require(_0x58ed('0xa'));module[_0x58ed('0xb')]=function(_0x5e60e5,_0x4e966d){return _0x5e60e5['define']('Integration',attributes,{'tableName':_0x58ed('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbc64=['util','../../config/logger','api','path','../../config/environment','exports','define','Integration','integrations'];(function(_0x4a3fdb,_0x136fcc){var _0x5566a0=function(_0x35faf6){while(--_0x35faf6){_0x4a3fdb['push'](_0x4a3fdb['shift']());}};_0x5566a0(++_0x136fcc);}(_0xbc64,0x14d));var _0x4bc6=function(_0xe45b6d,_0x443cac){_0xe45b6d=_0xe45b6d-0x0;var _0x4d6f47=_0xbc64[_0xe45b6d];return _0x4d6f47;};'use strict';var _=require('lodash');var util=require(_0x4bc6('0x0'));var logger=require(_0x4bc6('0x1'))(_0x4bc6('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4bc6('0x3'));var rimraf=require('rimraf');var config=require(_0x4bc6('0x4'));var attributes=require('./integration.attributes');module[_0x4bc6('0x5')]=function(_0x749b17,_0x532da7){return _0x749b17[_0x4bc6('0x6')](_0x4bc6('0x7'),attributes,{'tableName':_0x4bc6('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index 2241207..3a0fa00 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 _0xc6ac=['http','request','then','info','Integration,\x20%s,\x20%s','debug','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x272b62,_0x5a0a97){var _0x22e753=function(_0x267f04){while(--_0x267f04){_0x272b62['push'](_0x272b62['shift']());}};_0x22e753(++_0x5a0a97);}(_0xc6ac,0x15b));var _0xcc6a=function(_0xb7bd2d,_0x236857){_0xb7bd2d=_0xb7bd2d-0x0;var _0x3dda07=_0xc6ac[_0xb7bd2d];return _0x3dda07;};'use strict';var _=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var moment=require(_0xcc6a('0x2'));var BPromise=require(_0xcc6a('0x3'));var rs=require(_0xcc6a('0x4'));var fs=require('fs');var Redis=require(_0xcc6a('0x5'));var db=require(_0xcc6a('0x6'))['db'];var utils=require(_0xcc6a('0x7'));var logger=require(_0xcc6a('0x8'))(_0xcc6a('0x9'));var config=require(_0xcc6a('0xa'));var jayson=require(_0xcc6a('0xb'));var client=jayson[_0xcc6a('0xc')][_0xcc6a('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5f3887,_0x3dd497,_0x11b919){return new BPromise(function(_0xf02261,_0x560cc4){return client[_0xcc6a('0xe')](_0x5f3887,_0x11b919)[_0xcc6a('0xf')](function(_0x7806a0){logger[_0xcc6a('0x10')](_0xcc6a('0x11'),_0x3dd497,'request\x20sent');logger[_0xcc6a('0x12')](_0xcc6a('0x13'),_0x3dd497,_0xcc6a('0x14'),JSON['stringify'](_0x7806a0));if(_0x7806a0[_0xcc6a('0x15')]){if(_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x16')]===0x1f4){logger['error']('Integration,\x20%s,\x20%s',_0x3dd497,_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);return _0x560cc4(_0x7806a0[_0xcc6a('0x15')]['message']);}logger['error'](_0xcc6a('0x11'),_0x3dd497,_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);return _0xf02261(_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);}else{logger[_0xcc6a('0x10')](_0xcc6a('0x11'),_0x3dd497,_0xcc6a('0x14'));_0xf02261(_0x7806a0['result']['message']);}})['catch'](function(_0x395a55){logger[_0xcc6a('0x15')](_0xcc6a('0x11'),_0x3dd497,_0x395a55);_0x560cc4(_0x395a55);});});} \ No newline at end of file +var _0xc2c7=['../../config/logger','jayson/promise','client','http','request','then','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0xc2c7,0x134));var _0x7c2c=function(_0x54b25e,_0x5c13c7){_0x54b25e=_0x54b25e-0x0;var _0x5b80e7=_0xc2c7[_0x54b25e];return _0x5b80e7;};'use strict';var _=require('lodash');var util=require(_0x7c2c('0x0'));var moment=require(_0x7c2c('0x1'));var BPromise=require(_0x7c2c('0x2'));var rs=require(_0x7c2c('0x3'));var fs=require('fs');var Redis=require(_0x7c2c('0x4'));var db=require(_0x7c2c('0x5'))['db'];var utils=require(_0x7c2c('0x6'));var logger=require(_0x7c2c('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7c2c('0x8'));var client=jayson[_0x7c2c('0x9')][_0x7c2c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54f027,_0x4abe93,_0x5a1027){return new BPromise(function(_0x2274cd,_0x29638d){return client[_0x7c2c('0xb')](_0x54f027,_0x5a1027)[_0x7c2c('0xc')](function(_0x279cff){logger['info'](_0x7c2c('0xd'),_0x4abe93,_0x7c2c('0xe'));logger[_0x7c2c('0xf')](_0x7c2c('0x10'),_0x4abe93,_0x7c2c('0xe'),JSON[_0x7c2c('0x11')](_0x279cff));if(_0x279cff[_0x7c2c('0x12')]){if(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x13')]===0x1f4){logger[_0x7c2c('0x12')](_0x7c2c('0xd'),_0x4abe93,_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);return _0x29638d(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);}logger[_0x7c2c('0x12')]('Integration,\x20%s,\x20%s',_0x4abe93,_0x279cff['error'][_0x7c2c('0x14')]);return _0x2274cd(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);}else{logger['info'](_0x7c2c('0xd'),_0x4abe93,_0x7c2c('0xe'));_0x2274cd(_0x279cff['result'][_0x7c2c('0x14')]);}})['catch'](function(_0x1aa355){logger['error'](_0x7c2c('0xd'),_0x4abe93,_0x1aa355);_0x29638d(_0x1aa355);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index ba01b5b..a2216f5 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 _0x1a85=['../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports','path','connect-timeout','express','../../components/auth/service'];(function(_0x37dbbb,_0x1909de){var _0x10068f=function(_0x2464b0){while(--_0x2464b0){_0x37dbbb['push'](_0x37dbbb['shift']());}};_0x10068f(++_0x1909de);}(_0x1a85,0x178));var _0x51a8=function(_0x2d67b4,_0x4ca8fe){_0x2d67b4=_0x2d67b4-0x0;var _0x4cd582=_0x1a85[_0x2d67b4];return _0x4cd582;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x51a8('0x0'));var timeout=require(_0x51a8('0x1'));var express=require(_0x51a8('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x51a8('0x3'));var interaction=require(_0x51a8('0x4'));var config=require(_0x51a8('0x5'));var controller=require('./integrationReport.controller');router[_0x51a8('0x6')]('/',auth['isAuthenticated'](),controller[_0x51a8('0x7')]);router['get'](_0x51a8('0x8'),auth[_0x51a8('0x9')](),controller['describe']);router[_0x51a8('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x51a8('0xa')]);router[_0x51a8('0xb')]('/',auth[_0x51a8('0x9')](),controller[_0x51a8('0xc')]);router[_0x51a8('0xd')](_0x51a8('0xe'),auth[_0x51a8('0x9')](),controller[_0x51a8('0xf')]);router[_0x51a8('0x10')](_0x51a8('0xe'),auth[_0x51a8('0x9')](),controller[_0x51a8('0x11')]);module[_0x51a8('0x12')]=router; \ No newline at end of file +var _0xe2fe=['describe','/:id','post','update','destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe'];(function(_0x48cb1f,_0x5ca68d){var _0x172c4d=function(_0x85040){while(--_0x85040){_0x48cb1f['push'](_0x48cb1f['shift']());}};_0x172c4d(++_0x5ca68d);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xee2f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xee2f('0x1'));var express=require('express');var router=express[_0xee2f('0x2')]();var fs_extra=require(_0xee2f('0x3'));var auth=require(_0xee2f('0x4'));var interaction=require(_0xee2f('0x5'));var config=require(_0xee2f('0x6'));var controller=require('./integrationReport.controller');router[_0xee2f('0x7')]('/',auth[_0xee2f('0x8')](),controller['index']);router[_0xee2f('0x7')](_0xee2f('0x9'),auth['isAuthenticated'](),controller[_0xee2f('0xa')]);router['get'](_0xee2f('0xb'),auth[_0xee2f('0x8')](),controller['show']);router[_0xee2f('0xc')]('/',auth[_0xee2f('0x8')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xee2f('0xd')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xee2f('0xe')]);module[_0xee2f('0xf')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index bee3742..b4b4b0c 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 _0xe446=['STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENDING','RECEIVED','FAILED','exports'];(function(_0x1d7037,_0x57dd95){var _0x4d6568=function(_0x5c64c5){while(--_0x5c64c5){_0x1d7037['push'](_0x1d7037['shift']());}};_0x4d6568(++_0x57dd95);}(_0xe446,0x1df));var _0x6e44=function(_0x3655e5,_0x469eae){_0x3655e5=_0x3655e5-0x0;var _0x37dfac=_0xe446[_0x3655e5];return _0x37dfac;};'use strict';var Sequelize=require('sequelize');module[_0x6e44('0x0')]={'integration':{'type':Sequelize[_0x6e44('0x1')]},'eventChannel':{'type':Sequelize[_0x6e44('0x1')]},'exitStatus':{'type':Sequelize[_0x6e44('0x1')]},'ticketId':{'type':Sequelize[_0x6e44('0x1')]},'integrationId':{'type':Sequelize[_0x6e44('0x2')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x6e44('0x1')]},'calleridnum':{'type':Sequelize[_0x6e44('0x1')]},'calleridname':{'type':Sequelize[_0x6e44('0x1')]},'queue':{'type':Sequelize[_0x6e44('0x1')]},'interface':{'type':Sequelize[_0x6e44('0x1')]},'membername':{'type':Sequelize[_0x6e44('0x1')]},'agentcalledAt':{'type':Sequelize[_0x6e44('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x6e44('0x2')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x6e44('0x3')]},'talktime':{'type':Sequelize[_0x6e44('0x2')]},'agentacw':{'type':Sequelize[_0x6e44('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x6e44('0x2')]},'reason':{'type':Sequelize[_0x6e44('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x6e44('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0x6e44('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x6e44('0x3')]},'lastevent':{'type':Sequelize[_0x6e44('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x6e44('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x6e44('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x6e44('0x1')]},'exten':{'type':Sequelize[_0x6e44('0x1')]},'priority':{'type':Sequelize[_0x6e44('0x1')]},'destchannel':{'type':Sequelize[_0x6e44('0x1')]},'destchannelstate':{'type':Sequelize[_0x6e44('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x6e44('0x1')]},'destcalleridnum':{'type':Sequelize[_0x6e44('0x1')]},'destcalleridname':{'type':Sequelize[_0x6e44('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x6e44('0x1')]},'destlanguage':{'type':Sequelize[_0x6e44('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x6e44('0x1')]},'destexten':{'type':Sequelize[_0x6e44('0x1')]},'destpriority':{'type':Sequelize[_0x6e44('0x1')]},'destuniqueid':{'type':Sequelize[_0x6e44('0x1')]},'messageId':{'type':Sequelize[_0x6e44('0x1')]},'inReplyTo':{'type':Sequelize[_0x6e44('0x1')]},'subject':{'type':Sequelize[_0x6e44('0x1')]},'from':{'type':Sequelize[_0x6e44('0x1')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0x6e44('0x5')]},'html':{'type':Sequelize[_0x6e44('0x5')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0x6e44('0x6')]('SENT',_0x6e44('0x7'),_0x6e44('0x8'),_0x6e44('0x9'))},'url':{'type':Sequelize[_0x6e44('0x1')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0x6e44('0x1')]},'projectId':{'type':Sequelize[_0x6e44('0x2')]}}; \ No newline at end of file +var _0x90db=['SENT','SENDING','RECEIVED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM'];(function(_0x424414,_0x3f16a5){var _0x3fb38f=function(_0x18d5be){while(--_0x18d5be){_0x424414['push'](_0x424414['shift']());}};_0x3fb38f(++_0x3f16a5);}(_0x90db,0x179));var _0xb90d=function(_0x42f009,_0x5e27b1){_0x42f009=_0x42f009-0x0;var _0x22a1e0=_0x90db[_0x42f009];return _0x22a1e0;};'use strict';var Sequelize=require(_0xb90d('0x0'));module[_0xb90d('0x1')]={'integration':{'type':Sequelize[_0xb90d('0x2')]},'eventChannel':{'type':Sequelize[_0xb90d('0x2')]},'exitStatus':{'type':Sequelize[_0xb90d('0x2')]},'ticketId':{'type':Sequelize[_0xb90d('0x2')]},'integrationId':{'type':Sequelize[_0xb90d('0x3')]},'contacts':{'type':Sequelize[_0xb90d('0x2')]},'uniqueid':{'type':Sequelize[_0xb90d('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xb90d('0x2')]},'queue':{'type':Sequelize[_0xb90d('0x2')]},'interface':{'type':Sequelize[_0xb90d('0x2')]},'membername':{'type':Sequelize[_0xb90d('0x2')]},'agentcalledAt':{'type':Sequelize[_0xb90d('0x4')]},'agentconnectAt':{'type':Sequelize[_0xb90d('0x4')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xb90d('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xb90d('0x4')]},'talktime':{'type':Sequelize[_0xb90d('0x3')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xb90d('0x3')]},'reason':{'type':Sequelize[_0xb90d('0x2')]},'agentringnoanswer':{'type':Sequelize[_0xb90d('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xb90d('0x4')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xb90d('0x4')]},'lastevent':{'type':Sequelize[_0xb90d('0x2')]},'channel':{'type':Sequelize[_0xb90d('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xb90d('0x2')]},'connectedlinenum':{'type':Sequelize[_0xb90d('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xb90d('0x2')]},'context':{'type':Sequelize[_0xb90d('0x2')]},'exten':{'type':Sequelize[_0xb90d('0x2')]},'priority':{'type':Sequelize[_0xb90d('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xb90d('0x2')]},'destcalleridnum':{'type':Sequelize[_0xb90d('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xb90d('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xb90d('0x2')]},'destlanguage':{'type':Sequelize[_0xb90d('0x2')]},'destaccountcode':{'type':Sequelize[_0xb90d('0x2')]},'destcontext':{'type':Sequelize[_0xb90d('0x2')]},'destexten':{'type':Sequelize[_0xb90d('0x2')]},'destpriority':{'type':Sequelize[_0xb90d('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0xb90d('0x2')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0xb90d('0x2')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xb90d('0x2')]},'attachment':{'type':Sequelize[_0xb90d('0x6')]},'html':{'type':Sequelize[_0xb90d('0x6')]},'text':{'type':Sequelize[_0xb90d('0x6')]},'status':{'type':Sequelize[_0xb90d('0x7')](_0xb90d('0x8'),_0xb90d('0x9'),_0xb90d('0xa'),'FAILED')},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0xb90d('0x2')]},'appdata':{'type':Sequelize[_0xb90d('0x2')]},'projectId':{'type':Sequelize[_0xb90d('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index ffee873..6a342da 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 _0x6df3=['undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','error','name','send','type','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','IntegrationReport','include','findAll','catch','params','rawAttributes','find','create','body','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x6df3,0xbe));var _0x36df=function(_0x5c8f7c,_0x2c8676){_0x5c8f7c=_0x5c8f7c-0x0;var _0x5be745=_0x6df3[_0x5c8f7c];return _0x5be745;};'use strict';var emlformat=require(_0x36df('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x36df('0x1'));var rp=require(_0x36df('0x2'));var moment=require(_0x36df('0x3'));var BPromise=require(_0x36df('0x4'));var Mustache=require('mustache');var util=require(_0x36df('0x5'));var path=require(_0x36df('0x6'));var sox=require(_0x36df('0x7'));var csv=require(_0x36df('0x8'));var ejs=require(_0x36df('0x9'));var fs=require('fs');var fs_extra=require(_0x36df('0xa'));var _=require(_0x36df('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x36df('0xc'));var deskjs=require(_0x36df('0xd'));var toCsv=require('to-csv');var querystring=require(_0x36df('0xe'));var Papa=require('papaparse');var Redis=require(_0x36df('0xf'));var authService=require(_0x36df('0x10'));var qs=require(_0x36df('0x11'));var as=require(_0x36df('0x12'));var hardwareService=require(_0x36df('0x13'));var logger=require(_0x36df('0x14'))(_0x36df('0x15'));var utils=require(_0x36df('0x16'));var config=require(_0x36df('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x36df('0x18'))['db'];function respondWithStatusCode(_0x565c69,_0x5a1325){_0x5a1325=_0x5a1325||0xcc;return function(_0x14f1e0){if(_0x14f1e0){return _0x565c69[_0x36df('0x19')](_0x5a1325);}return _0x565c69['status'](_0x5a1325)[_0x36df('0x1a')]();};}function respondWithResult(_0x24504e,_0x542c58){_0x542c58=_0x542c58||0xc8;return function(_0x3ee445){if(_0x3ee445){return _0x24504e[_0x36df('0x1b')](_0x542c58)['json'](_0x3ee445);}};}function respondWithFilteredResult(_0x3620a8,_0x145794){return function(_0x56e9c7){if(_0x56e9c7){var _0xe4efd4=typeof _0x145794[_0x36df('0x1c')]===_0x36df('0x1d')&&typeof _0x145794[_0x36df('0x1e')]===_0x36df('0x1d');var _0x56e1b7=_0x56e9c7[_0x36df('0x1f')];var _0x2fa8a5=_0xe4efd4?0x0:_0x145794[_0x36df('0x1c')];var _0x3d7aa4=_0xe4efd4?_0x56e9c7[_0x36df('0x1f')]:_0x145794['offset']+_0x145794[_0x36df('0x1e')];var _0x4eda0f;if(_0x3d7aa4>=_0x56e1b7){_0x3d7aa4=_0x56e1b7;_0x4eda0f=0xc8;}else{_0x4eda0f=0xce;}_0x3620a8[_0x36df('0x1b')](_0x4eda0f);return _0x3620a8[_0x36df('0x20')](_0x36df('0x21'),_0x2fa8a5+'-'+_0x3d7aa4+'/'+_0x56e1b7)[_0x36df('0x22')](_0x56e9c7);}return null;};}function patchUpdates(_0x44905d){return function(_0x55d82d){try{jsonpatch[_0x36df('0x23')](_0x55d82d,_0x44905d,!![]);}catch(_0x5ed6b7){return BPromise[_0x36df('0x24')](_0x5ed6b7);}return _0x55d82d[_0x36df('0x25')]();};}function saveUpdates(_0x254289,_0x27d564){return function(_0x5a9a03){if(_0x5a9a03){return _0x5a9a03[_0x36df('0x26')](_0x254289)['then'](function(_0x8fff56){return _0x8fff56;});}return null;};}function removeEntity(_0x3b3650,_0x103404){return function(_0x1ff446){if(_0x1ff446){return _0x1ff446[_0x36df('0x27')]()[_0x36df('0x28')](function(){_0x3b3650[_0x36df('0x1b')](0xcc)[_0x36df('0x1a')]();});}};}function handleEntityNotFound(_0x4d997a,_0x48ab53){return function(_0x4e958c){if(!_0x4e958c){_0x4d997a['sendStatus'](0x194);}return _0x4e958c;};}function handleError(_0x33e20f,_0x3fb10b){_0x3fb10b=_0x3fb10b||0x1f4;return function(_0x5180a5){logger[_0x36df('0x29')](_0x5180a5['stack']);if(_0x5180a5[_0x36df('0x2a')]){delete _0x5180a5[_0x36df('0x2a')];}_0x33e20f[_0x36df('0x1b')](_0x3fb10b)[_0x36df('0x2b')](_0x5180a5);};}exports['index']=function(_0x21a93a,_0x4d3b57){var _0x3c641d={},_0x5c5c6e={},_0x21e6c2={'count':0x0,'rows':[]};var _0x25047b=_['map'](db['IntegrationReport']['rawAttributes'],function(_0x2a4e86){return{'name':_0x2a4e86['fieldName'],'type':_0x2a4e86[_0x36df('0x2c')]['key']};});_0x5c5c6e[_0x36df('0x2d')]=_[_0x36df('0x2e')](_0x25047b,'name');_0x5c5c6e[_0x36df('0x2f')]=_[_0x36df('0x30')](_0x21a93a[_0x36df('0x2f')]);_0x5c5c6e['filters']=_[_0x36df('0x31')](_0x5c5c6e[_0x36df('0x2d')],_0x5c5c6e[_0x36df('0x2f')]);_0x3c641d['attributes']=_[_0x36df('0x31')](_0x5c5c6e[_0x36df('0x2d')],qs[_0x36df('0x32')](_0x21a93a[_0x36df('0x2f')][_0x36df('0x32')]));_0x3c641d['attributes']=_0x3c641d[_0x36df('0x33')][_0x36df('0x34')]?_0x3c641d[_0x36df('0x33')]:_0x5c5c6e[_0x36df('0x2d')];if(!_0x21a93a['query'][_0x36df('0x35')](_0x36df('0x36'))){_0x3c641d[_0x36df('0x1e')]=qs[_0x36df('0x1e')](_0x21a93a['query']['limit']);_0x3c641d[_0x36df('0x1c')]=qs[_0x36df('0x1c')](_0x21a93a[_0x36df('0x2f')][_0x36df('0x1c')]);}_0x3c641d[_0x36df('0x37')]=qs[_0x36df('0x38')](_0x21a93a[_0x36df('0x2f')][_0x36df('0x38')]);_0x3c641d[_0x36df('0x39')]=qs[_0x36df('0x3a')](_[_0x36df('0x3b')](_0x21a93a['query'],_0x5c5c6e[_0x36df('0x3a')]),_0x25047b);if(_0x21a93a[_0x36df('0x2f')][_0x36df('0x3c')]){_0x3c641d[_0x36df('0x39')]=_[_0x36df('0x3d')](_0x3c641d[_0x36df('0x39')],{'$or':_[_0x36df('0x2e')](_0x25047b,function(_0x29e19b){if(_0x29e19b['type']!=='VIRTUAL'){var _0x51baa5={};_0x51baa5[_0x29e19b['name']]={'$like':'%'+_0x21a93a[_0x36df('0x2f')][_0x36df('0x3c')]+'%'};return _0x51baa5;}})});}_0x3c641d=_['merge']({},_0x3c641d,_0x21a93a[_0x36df('0x3e')]);var _0x3a4ea1={'where':_0x3c641d[_0x36df('0x39')]};return db[_0x36df('0x3f')][_0x36df('0x1f')](_0x3a4ea1)[_0x36df('0x28')](function(_0xd7f7ef){_0x21e6c2[_0x36df('0x1f')]=_0xd7f7ef;if(_0x21a93a[_0x36df('0x2f')]['includeAll']){_0x3c641d[_0x36df('0x40')]=[{'all':!![]}];}return db['IntegrationReport'][_0x36df('0x41')](_0x3c641d);})[_0x36df('0x28')](function(_0x4af6a5){_0x21e6c2['rows']=_0x4af6a5;return _0x21e6c2;})[_0x36df('0x28')](respondWithFilteredResult(_0x4d3b57,_0x3c641d))[_0x36df('0x42')](handleError(_0x4d3b57,null));};exports['show']=function(_0x1447e5,_0x3055da){var _0x224a12={'raw':![],'where':{'id':_0x1447e5[_0x36df('0x43')]['id']}},_0x4295f9={};_0x4295f9[_0x36df('0x2d')]=_[_0x36df('0x30')](db[_0x36df('0x3f')][_0x36df('0x44')]);_0x4295f9[_0x36df('0x2f')]=_[_0x36df('0x30')](_0x1447e5[_0x36df('0x2f')]);_0x4295f9[_0x36df('0x3a')]=_[_0x36df('0x31')](_0x4295f9[_0x36df('0x2d')],_0x4295f9[_0x36df('0x2f')]);_0x224a12[_0x36df('0x33')]=_[_0x36df('0x31')](_0x4295f9[_0x36df('0x2d')],qs[_0x36df('0x32')](_0x1447e5[_0x36df('0x2f')][_0x36df('0x32')]));_0x224a12[_0x36df('0x33')]=_0x224a12[_0x36df('0x33')][_0x36df('0x34')]?_0x224a12['attributes']:_0x4295f9[_0x36df('0x2d')];if(_0x1447e5[_0x36df('0x2f')]['includeAll']){_0x224a12['include']=[{'all':!![]}];}_0x224a12=_['merge']({},_0x224a12,_0x1447e5[_0x36df('0x3e')]);return db[_0x36df('0x3f')][_0x36df('0x45')](_0x224a12)[_0x36df('0x28')](handleEntityNotFound(_0x3055da,null))[_0x36df('0x28')](respondWithResult(_0x3055da,null))[_0x36df('0x42')](handleError(_0x3055da,null));};exports[_0x36df('0x46')]=function(_0x18d00a,_0x25eb46){return db['IntegrationReport'][_0x36df('0x46')](_0x18d00a[_0x36df('0x47')],{})[_0x36df('0x28')](respondWithResult(_0x25eb46,0xc9))['catch'](handleError(_0x25eb46,null));};exports[_0x36df('0x26')]=function(_0x355a0c,_0x40a3f6){if(_0x355a0c[_0x36df('0x47')]['id']){delete _0x355a0c[_0x36df('0x47')]['id'];}return db[_0x36df('0x3f')][_0x36df('0x45')]({'where':{'id':_0x355a0c[_0x36df('0x43')]['id']}})[_0x36df('0x28')](handleEntityNotFound(_0x40a3f6,null))['then'](saveUpdates(_0x355a0c[_0x36df('0x47')],null))['then'](respondWithResult(_0x40a3f6,null))['catch'](handleError(_0x40a3f6,null));};exports[_0x36df('0x27')]=function(_0x42cf49,_0x49a17b){return db['IntegrationReport'][_0x36df('0x45')]({'where':{'id':_0x42cf49['params']['id']}})['then'](handleEntityNotFound(_0x49a17b,null))[_0x36df('0x28')](removeEntity(_0x49a17b,null))['catch'](handleError(_0x49a17b,null));};exports['describe']=function(_0x31fba0,_0xa5679b){return db[_0x36df('0x3f')][_0x36df('0x48')]()[_0x36df('0x28')](respondWithResult(_0xa5679b,null))[_0x36df('0x42')](handleError(_0xa5679b,null));}; \ No newline at end of file +var _0x3b5c=['rawAttributes','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','map','IntegrationReport','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params'];(function(_0x4bf35e,_0xda90df){var _0x24c842=function(_0x360a7f){while(--_0x360a7f){_0x4bf35e['push'](_0x4bf35e['shift']());}};_0x24c842(++_0xda90df);}(_0x3b5c,0x9d));var _0xc3b5=function(_0x5d9f40,_0x35eed1){_0x5d9f40=_0x5d9f40-0x0;var _0x523a3c=_0x3b5c[_0x5d9f40];return _0x523a3c;};'use strict';var emlformat=require(_0xc3b5('0x0'));var rimraf=require(_0xc3b5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc3b5('0x2'));var rp=require(_0xc3b5('0x3'));var moment=require(_0xc3b5('0x4'));var BPromise=require(_0xc3b5('0x5'));var Mustache=require(_0xc3b5('0x6'));var util=require(_0xc3b5('0x7'));var path=require(_0xc3b5('0x8'));var sox=require(_0xc3b5('0x9'));var csv=require(_0xc3b5('0xa'));var ejs=require(_0xc3b5('0xb'));var fs=require('fs');var fs_extra=require(_0xc3b5('0xc'));var _=require(_0xc3b5('0xd'));var squel=require('squel');var crypto=require(_0xc3b5('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc3b5('0xf'));var toCsv=require('to-csv');var querystring=require(_0xc3b5('0x10'));var Papa=require(_0xc3b5('0x11'));var Redis=require('ioredis');var authService=require(_0xc3b5('0x12'));var qs=require(_0xc3b5('0x13'));var as=require(_0xc3b5('0x14'));var hardwareService=require(_0xc3b5('0x15'));var logger=require(_0xc3b5('0x16'))('api');var utils=require(_0xc3b5('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc3b5('0x18'))['db'];function respondWithStatusCode(_0x295ba7,_0x1c4d3e){_0x1c4d3e=_0x1c4d3e||0xcc;return function(_0x4bfcbe){if(_0x4bfcbe){return _0x295ba7['sendStatus'](_0x1c4d3e);}return _0x295ba7[_0xc3b5('0x19')](_0x1c4d3e)[_0xc3b5('0x1a')]();};}function respondWithResult(_0x1a9a75,_0xfc5fd3){_0xfc5fd3=_0xfc5fd3||0xc8;return function(_0x5119ef){if(_0x5119ef){return _0x1a9a75[_0xc3b5('0x19')](_0xfc5fd3)[_0xc3b5('0x1b')](_0x5119ef);}};}function respondWithFilteredResult(_0x117da4,_0x5b7c96){return function(_0x1a22ed){if(_0x1a22ed){var _0x697cb9=typeof _0x5b7c96['offset']===_0xc3b5('0x1c')&&typeof _0x5b7c96['limit']===_0xc3b5('0x1c');var _0x73770c=_0x1a22ed[_0xc3b5('0x1d')];var _0x111636=_0x697cb9?0x0:_0x5b7c96['offset'];var _0x116c06=_0x697cb9?_0x1a22ed[_0xc3b5('0x1d')]:_0x5b7c96[_0xc3b5('0x1e')]+_0x5b7c96[_0xc3b5('0x1f')];var _0x179b5e;if(_0x116c06>=_0x73770c){_0x116c06=_0x73770c;_0x179b5e=0xc8;}else{_0x179b5e=0xce;}_0x117da4[_0xc3b5('0x19')](_0x179b5e);return _0x117da4[_0xc3b5('0x20')](_0xc3b5('0x21'),_0x111636+'-'+_0x116c06+'/'+_0x73770c)['json'](_0x1a22ed);}return null;};}function patchUpdates(_0xf63840){return function(_0x5a175e){try{jsonpatch[_0xc3b5('0x22')](_0x5a175e,_0xf63840,!![]);}catch(_0x5f016c){return BPromise[_0xc3b5('0x23')](_0x5f016c);}return _0x5a175e[_0xc3b5('0x24')]();};}function saveUpdates(_0x35ec77,_0x4be594){return function(_0x5caf43){if(_0x5caf43){return _0x5caf43[_0xc3b5('0x25')](_0x35ec77)[_0xc3b5('0x26')](function(_0x359289){return _0x359289;});}return null;};}function removeEntity(_0x49dfb8,_0x35484c){return function(_0x175f77){if(_0x175f77){return _0x175f77[_0xc3b5('0x27')]()[_0xc3b5('0x26')](function(){_0x49dfb8[_0xc3b5('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b1dae,_0x4e209b){return function(_0x23439d){if(!_0x23439d){_0x5b1dae['sendStatus'](0x194);}return _0x23439d;};}function handleError(_0x42bd2d,_0x49ee69){_0x49ee69=_0x49ee69||0x1f4;return function(_0x2a1e45){logger['error'](_0x2a1e45[_0xc3b5('0x28')]);if(_0x2a1e45[_0xc3b5('0x29')]){delete _0x2a1e45[_0xc3b5('0x29')];}_0x42bd2d[_0xc3b5('0x19')](_0x49ee69)['send'](_0x2a1e45);};}exports[_0xc3b5('0x2a')]=function(_0x4b5e8e,_0x50c955){var _0x585237={},_0x378ca5={},_0x5b9493={'count':0x0,'rows':[]};var _0x229d71=_[_0xc3b5('0x2b')](db[_0xc3b5('0x2c')]['rawAttributes'],function(_0x2cca69){return{'name':_0x2cca69['fieldName'],'type':_0x2cca69[_0xc3b5('0x2d')][_0xc3b5('0x2e')]};});_0x378ca5[_0xc3b5('0x2f')]=_[_0xc3b5('0x2b')](_0x229d71,_0xc3b5('0x29'));_0x378ca5[_0xc3b5('0x30')]=_[_0xc3b5('0x31')](_0x4b5e8e[_0xc3b5('0x30')]);_0x378ca5[_0xc3b5('0x32')]=_[_0xc3b5('0x33')](_0x378ca5[_0xc3b5('0x2f')],_0x378ca5[_0xc3b5('0x30')]);_0x585237['attributes']=_[_0xc3b5('0x33')](_0x378ca5[_0xc3b5('0x2f')],qs[_0xc3b5('0x34')](_0x4b5e8e[_0xc3b5('0x30')][_0xc3b5('0x34')]));_0x585237[_0xc3b5('0x35')]=_0x585237[_0xc3b5('0x35')][_0xc3b5('0x36')]?_0x585237['attributes']:_0x378ca5[_0xc3b5('0x2f')];if(!_0x4b5e8e[_0xc3b5('0x30')][_0xc3b5('0x37')](_0xc3b5('0x38'))){_0x585237['limit']=qs['limit'](_0x4b5e8e[_0xc3b5('0x30')][_0xc3b5('0x1f')]);_0x585237[_0xc3b5('0x1e')]=qs[_0xc3b5('0x1e')](_0x4b5e8e[_0xc3b5('0x30')][_0xc3b5('0x1e')]);}_0x585237[_0xc3b5('0x39')]=qs[_0xc3b5('0x3a')](_0x4b5e8e['query'][_0xc3b5('0x3a')]);_0x585237[_0xc3b5('0x3b')]=qs[_0xc3b5('0x32')](_[_0xc3b5('0x3c')](_0x4b5e8e[_0xc3b5('0x30')],_0x378ca5[_0xc3b5('0x32')]),_0x229d71);if(_0x4b5e8e[_0xc3b5('0x30')][_0xc3b5('0x3d')]){_0x585237[_0xc3b5('0x3b')]=_[_0xc3b5('0x3e')](_0x585237[_0xc3b5('0x3b')],{'$or':_[_0xc3b5('0x2b')](_0x229d71,function(_0x47256e){if(_0x47256e[_0xc3b5('0x2d')]!==_0xc3b5('0x3f')){var _0x26207d={};_0x26207d[_0x47256e[_0xc3b5('0x29')]]={'$like':'%'+_0x4b5e8e[_0xc3b5('0x30')][_0xc3b5('0x3d')]+'%'};return _0x26207d;}})});}_0x585237=_[_0xc3b5('0x3e')]({},_0x585237,_0x4b5e8e[_0xc3b5('0x40')]);var _0x4fd1eb={'where':_0x585237['where']};return db[_0xc3b5('0x2c')][_0xc3b5('0x1d')](_0x4fd1eb)[_0xc3b5('0x26')](function(_0x52600b){_0x5b9493['count']=_0x52600b;if(_0x4b5e8e['query'][_0xc3b5('0x41')]){_0x585237[_0xc3b5('0x42')]=[{'all':!![]}];}return db[_0xc3b5('0x2c')][_0xc3b5('0x43')](_0x585237);})['then'](function(_0x4eb1e3){_0x5b9493[_0xc3b5('0x44')]=_0x4eb1e3;return _0x5b9493;})['then'](respondWithFilteredResult(_0x50c955,_0x585237))[_0xc3b5('0x45')](handleError(_0x50c955,null));};exports['show']=function(_0x4c17f0,_0x4f3b8d){var _0x17d5ed={'raw':![],'where':{'id':_0x4c17f0[_0xc3b5('0x46')]['id']}},_0x1f7767={};_0x1f7767[_0xc3b5('0x2f')]=_[_0xc3b5('0x31')](db['IntegrationReport'][_0xc3b5('0x47')]);_0x1f7767[_0xc3b5('0x30')]=_[_0xc3b5('0x31')](_0x4c17f0[_0xc3b5('0x30')]);_0x1f7767[_0xc3b5('0x32')]=_[_0xc3b5('0x33')](_0x1f7767[_0xc3b5('0x2f')],_0x1f7767['query']);_0x17d5ed[_0xc3b5('0x35')]=_[_0xc3b5('0x33')](_0x1f7767[_0xc3b5('0x2f')],qs[_0xc3b5('0x34')](_0x4c17f0['query']['fields']));_0x17d5ed[_0xc3b5('0x35')]=_0x17d5ed['attributes']['length']?_0x17d5ed['attributes']:_0x1f7767[_0xc3b5('0x2f')];if(_0x4c17f0[_0xc3b5('0x30')]['includeAll']){_0x17d5ed[_0xc3b5('0x42')]=[{'all':!![]}];}_0x17d5ed=_['merge']({},_0x17d5ed,_0x4c17f0[_0xc3b5('0x40')]);return db['IntegrationReport'][_0xc3b5('0x48')](_0x17d5ed)[_0xc3b5('0x26')](handleEntityNotFound(_0x4f3b8d,null))['then'](respondWithResult(_0x4f3b8d,null))['catch'](handleError(_0x4f3b8d,null));};exports[_0xc3b5('0x49')]=function(_0x5970c6,_0x44934c){return db[_0xc3b5('0x2c')][_0xc3b5('0x49')](_0x5970c6['body'],{})[_0xc3b5('0x26')](respondWithResult(_0x44934c,0xc9))[_0xc3b5('0x45')](handleError(_0x44934c,null));};exports['update']=function(_0x14563c,_0x3a4b43){if(_0x14563c[_0xc3b5('0x4a')]['id']){delete _0x14563c[_0xc3b5('0x4a')]['id'];}return db[_0xc3b5('0x2c')][_0xc3b5('0x48')]({'where':{'id':_0x14563c[_0xc3b5('0x46')]['id']}})[_0xc3b5('0x26')](handleEntityNotFound(_0x3a4b43,null))[_0xc3b5('0x26')](saveUpdates(_0x14563c['body'],null))['then'](respondWithResult(_0x3a4b43,null))['catch'](handleError(_0x3a4b43,null));};exports[_0xc3b5('0x27')]=function(_0x3ec5b0,_0x3bfa53){return db[_0xc3b5('0x2c')][_0xc3b5('0x48')]({'where':{'id':_0x3ec5b0['params']['id']}})[_0xc3b5('0x26')](handleEntityNotFound(_0x3bfa53,null))[_0xc3b5('0x26')](removeEntity(_0x3bfa53,null))[_0xc3b5('0x45')](handleError(_0x3bfa53,null));};exports[_0xc3b5('0x4b')]=function(_0x4eef5e,_0x19dcf3){return db[_0xc3b5('0x2c')]['describe']()[_0xc3b5('0x26')](respondWithResult(_0x19dcf3,null))[_0xc3b5('0x45')](handleError(_0x19dcf3,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 9b58c4b..ebf2636 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 _0x6e9f=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport','report_integration','lodash','util','../../config/logger'];(function(_0x369f62,_0x17a354){var _0x323a6d=function(_0x4fc5cf){while(--_0x4fc5cf){_0x369f62['push'](_0x369f62['shift']());}};_0x323a6d(++_0x17a354);}(_0x6e9f,0xa5));var _0xf6e9=function(_0x3e8b83,_0x5a3809){_0x3e8b83=_0x3e8b83-0x0;var _0x4ae7d7=_0x6e9f[_0x3e8b83];return _0x4ae7d7;};'use strict';var _=require(_0xf6e9('0x0'));var util=require(_0xf6e9('0x1'));var logger=require(_0xf6e9('0x2'))(_0xf6e9('0x3'));var moment=require(_0xf6e9('0x4'));var BPromise=require(_0xf6e9('0x5'));var rp=require(_0xf6e9('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf6e9('0x7'));var config=require(_0xf6e9('0x8'));var attributes=require(_0xf6e9('0x9'));module[_0xf6e9('0xa')]=function(_0xe200cc,_0x6b248f){return _0xe200cc[_0xf6e9('0xb')](_0xf6e9('0xc'),attributes,{'tableName':_0xf6e9('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xab0f=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','report_integration'];(function(_0x82cff,_0x1de062){var _0x3a243a=function(_0x37dc16){while(--_0x37dc16){_0x82cff['push'](_0x82cff['shift']());}};_0x3a243a(++_0x1de062);}(_0xab0f,0x174));var _0xfab0=function(_0x47a7fc,_0x3fe0c8){_0x47a7fc=_0x47a7fc-0x0;var _0x5364ac=_0xab0f[_0x47a7fc];return _0x5364ac;};'use strict';var _=require(_0xfab0('0x0'));var util=require(_0xfab0('0x1'));var logger=require(_0xfab0('0x2'))(_0xfab0('0x3'));var moment=require(_0xfab0('0x4'));var BPromise=require(_0xfab0('0x5'));var rp=require(_0xfab0('0x6'));var fs=require('fs');var path=require(_0xfab0('0x7'));var rimraf=require(_0xfab0('0x8'));var config=require(_0xfab0('0x9'));var attributes=require('./integrationReport.attributes');module[_0xfab0('0xa')]=function(_0x3ddee5,_0x4ba27c){return _0x3ddee5['define']('IntegrationReport',attributes,{'tableName':_0xfab0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index 0b19bcc..ec9446e 100644 --- a/server/api/integrationReport/integrationReport.rpc.js +++ b/server/api/integrationReport/integrationReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3f8a=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x2bfa86,_0x34bb3c){_0x2bfa86=_0x2bfa86-0x0;var _0xf15627=_0x3f8a[_0x2bfa86];return _0xf15627;};'use strict';var _=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var moment=require(_0xa3f8('0x2'));var BPromise=require(_0xa3f8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa3f8('0x4'));var db=require(_0xa3f8('0x5'))['db'];var utils=require(_0xa3f8('0x6'));var logger=require(_0xa3f8('0x7'))(_0xa3f8('0x8'));var config=require(_0xa3f8('0x9'));var jayson=require(_0xa3f8('0xa'));var client=jayson[_0xa3f8('0xb')][_0xa3f8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xf895d9,_0xcfea5,_0x268332){return new BPromise(function(_0x2faf2e,_0x2448de){return client[_0xa3f8('0xd')](_0xf895d9,_0x268332)[_0xa3f8('0xe')](function(_0xcdb0d4){logger['info'](_0xa3f8('0xf'),_0xcfea5,_0xa3f8('0x10'));logger[_0xa3f8('0x11')](_0xa3f8('0x12'),_0xcfea5,'request\x20sent',JSON[_0xa3f8('0x13')](_0xcdb0d4));if(_0xcdb0d4[_0xa3f8('0x14')]){if(_0xcdb0d4[_0xa3f8('0x14')][_0xa3f8('0x15')]===0x1f4){logger[_0xa3f8('0x14')](_0xa3f8('0xf'),_0xcfea5,_0xcdb0d4[_0xa3f8('0x14')][_0xa3f8('0x16')]);return _0x2448de(_0xcdb0d4[_0xa3f8('0x14')][_0xa3f8('0x16')]);}logger[_0xa3f8('0x14')](_0xa3f8('0xf'),_0xcfea5,_0xcdb0d4['error'][_0xa3f8('0x16')]);return _0x2faf2e(_0xcdb0d4[_0xa3f8('0x14')][_0xa3f8('0x16')]);}else{logger[_0xa3f8('0x17')]('IntegrationReport,\x20%s,\x20%s',_0xcfea5,_0xa3f8('0x10'));_0x2faf2e(_0xcdb0d4[_0xa3f8('0x18')][_0xa3f8('0x16')]);}})[_0xa3f8('0x19')](function(_0x45ef64){logger[_0xa3f8('0x14')](_0xa3f8('0xf'),_0xcfea5,_0x45ef64);_0x2448de(_0x45ef64);});});} \ No newline at end of file +var _0x2675=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','randomstring','ioredis'];(function(_0x33800d,_0x195a91){var _0x491b1f=function(_0x4e3513){while(--_0x4e3513){_0x33800d['push'](_0x33800d['shift']());}};_0x491b1f(++_0x195a91);}(_0x2675,0x75));var _0x5267=function(_0x517560,_0x54e985){_0x517560=_0x517560-0x0;var _0x4d0ed6=_0x2675[_0x517560];return _0x4d0ed6;};'use strict';var _=require(_0x5267('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5267('0x1'));var fs=require('fs');var Redis=require(_0x5267('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x5267('0x3'));var logger=require(_0x5267('0x4'))('rpc');var config=require(_0x5267('0x5'));var jayson=require(_0x5267('0x6'));var client=jayson[_0x5267('0x7')][_0x5267('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x20f065,_0xc56cd5,_0x527c16){return new BPromise(function(_0x9e0a27,_0x46bfdf){return client['request'](_0x20f065,_0x527c16)[_0x5267('0x9')](function(_0x5d6645){logger[_0x5267('0xa')](_0x5267('0xb'),_0xc56cd5,_0x5267('0xc'));logger['debug'](_0x5267('0xd'),_0xc56cd5,'request\x20sent',JSON[_0x5267('0xe')](_0x5d6645));if(_0x5d6645['error']){if(_0x5d6645[_0x5267('0xf')][_0x5267('0x10')]===0x1f4){logger[_0x5267('0xf')](_0x5267('0xb'),_0xc56cd5,_0x5d6645[_0x5267('0xf')][_0x5267('0x11')]);return _0x46bfdf(_0x5d6645[_0x5267('0xf')][_0x5267('0x11')]);}logger[_0x5267('0xf')](_0x5267('0xb'),_0xc56cd5,_0x5d6645[_0x5267('0xf')][_0x5267('0x11')]);return _0x9e0a27(_0x5d6645[_0x5267('0xf')]['message']);}else{logger['info'](_0x5267('0xb'),_0xc56cd5,_0x5267('0xc'));_0x9e0a27(_0x5d6645[_0x5267('0x12')][_0x5267('0x11')]);}})[_0x5267('0x13')](function(_0x27e5c6){logger[_0x5267('0xf')](_0x5267('0xb'),_0xc56cd5,_0x27e5c6);_0x46bfdf(_0x27e5c6);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index a23dbb9..cee6da3 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 _0x1883=['put','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','/:id/sub_intervals','getIntervals','create','post','addInterval','addIntervals'];(function(_0x1bb992,_0x2e645e){var _0x2f7a0b=function(_0x1e491){while(--_0x1e491){_0x1bb992['push'](_0x1bb992['shift']());}};_0x2f7a0b(++_0x2e645e);}(_0x1883,0xab));var _0x3188=function(_0x412d2e,_0x5db21f){_0x412d2e=_0x412d2e-0x0;var _0x33321e=_0x1883[_0x412d2e];return _0x33321e;};'use strict';var multer=require(_0x3188('0x0'));var util=require(_0x3188('0x1'));var path=require(_0x3188('0x2'));var timeout=require(_0x3188('0x3'));var express=require(_0x3188('0x4'));var router=express[_0x3188('0x5')]();var fs_extra=require(_0x3188('0x6'));var auth=require(_0x3188('0x7'));var interaction=require(_0x3188('0x8'));var config=require(_0x3188('0x9'));var controller=require(_0x3188('0xa'));router[_0x3188('0xb')]('/',auth[_0x3188('0xc')](),controller[_0x3188('0xd')]);router[_0x3188('0xb')](_0x3188('0xe'),auth[_0x3188('0xc')](),controller['show']);router[_0x3188('0xb')](_0x3188('0xf'),auth['isAuthenticated'](),controller[_0x3188('0x10')]);router['post']('/',auth[_0x3188('0xc')](),controller[_0x3188('0x11')]);router[_0x3188('0x12')](_0x3188('0xf'),auth['isAuthenticated'](),controller[_0x3188('0x13')]);router[_0x3188('0x12')]('/:id/sub_intervals/create_many',auth['isAuthenticated'](),controller[_0x3188('0x14')]);router[_0x3188('0x15')](_0x3188('0xe'),auth[_0x3188('0xc')](),controller[_0x3188('0x16')]);router[_0x3188('0x17')]('/:id',auth[_0x3188('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x90b1=['/:id/sub_intervals/create_many','put','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','index','get','/:id','isAuthenticated','show','/:id/sub_intervals','getIntervals','post','create','addInterval'];(function(_0x2acd0f,_0x3ac736){var _0x434b3e=function(_0x2fdca0){while(--_0x2fdca0){_0x2acd0f['push'](_0x2acd0f['shift']());}};_0x434b3e(++_0x3ac736);}(_0x90b1,0x1bb));var _0x190b=function(_0x57d740,_0x50be99){_0x57d740=_0x57d740-0x0;var _0x6607ef=_0x90b1[_0x57d740];return _0x6607ef;};'use strict';var multer=require(_0x190b('0x0'));var util=require(_0x190b('0x1'));var path=require(_0x190b('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x190b('0x3')]();var fs_extra=require(_0x190b('0x4'));var auth=require(_0x190b('0x5'));var interaction=require(_0x190b('0x6'));var config=require('../../config/environment');var controller=require('./interval.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x190b('0x7')]);router[_0x190b('0x8')](_0x190b('0x9'),auth[_0x190b('0xa')](),controller[_0x190b('0xb')]);router[_0x190b('0x8')](_0x190b('0xc'),auth['isAuthenticated'](),controller[_0x190b('0xd')]);router[_0x190b('0xe')]('/',auth[_0x190b('0xa')](),controller[_0x190b('0xf')]);router[_0x190b('0xe')](_0x190b('0xc'),auth[_0x190b('0xa')](),controller[_0x190b('0x10')]);router['post'](_0x190b('0x11'),auth[_0x190b('0xa')](),controller['addIntervals']);router[_0x190b('0x12')](_0x190b('0x9'),auth[_0x190b('0xa')](),controller[_0x190b('0x13')]);router[_0x190b('0x14')](_0x190b('0x9'),auth[_0x190b('0xa')](),controller[_0x190b('0x15')]);module[_0x190b('0x16')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 7b79a9b..48ea741 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 _0x054e=['sequelize','exports','STRING'];(function(_0x31f7c5,_0x3bf428){var _0x19fabc=function(_0x268080){while(--_0x268080){_0x31f7c5['push'](_0x31f7c5['shift']());}};_0x19fabc(++_0x3bf428);}(_0x054e,0x135));var _0xe054=function(_0x4ec7f2,_0x3d92d2){_0x4ec7f2=_0x4ec7f2-0x0;var _0x118004=_0x054e[_0x4ec7f2];return _0x118004;};'use strict';var Sequelize=require(_0xe054('0x0'));module[_0xe054('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xe054('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xd033=['STRING','exports'];(function(_0xa0d6e8,_0x41e320){var _0x4ba300=function(_0x5ad796){while(--_0x5ad796){_0xa0d6e8['push'](_0xa0d6e8['shift']());}};_0x4ba300(++_0x41e320);}(_0xd033,0x117));var _0x3d03=function(_0x45c981,_0x2ad2d4){_0x45c981=_0x45c981-0x0;var _0x4f62c8=_0xd033[_0x45c981];return _0x4f62c8;};'use strict';var Sequelize=require('sequelize');module[_0x3d03('0x0')]={'name':{'type':Sequelize[_0x3d03('0x1')]},'description':{'type':Sequelize[_0x3d03('0x1')]},'interval':{'type':Sequelize[_0x3d03('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 7f130a6..f9a8c40 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 _0x9e39=['rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../components/extensions/rewrite','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','update','then','get','Intervals','destroy','error','stack','name','send','index','map','Interval','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','getIntervals','findOne','hasOwnProperty','addIntervals','sequelize','bulkCreate'];(function(_0x5646c5,_0x58e7ab){var _0x21f5ef=function(_0x5b49bb){while(--_0x5b49bb){_0x5646c5['push'](_0x5646c5['shift']());}};_0x21f5ef(++_0x58e7ab);}(_0x9e39,0x114));var _0x99e3=function(_0x4c0bc7,_0x58f0e1){_0x4c0bc7=_0x4c0bc7-0x0;var _0x451e8a=_0x9e39[_0x4c0bc7];return _0x451e8a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x99e3('0x0'));var zipdir=require(_0x99e3('0x1'));var jsonpatch=require(_0x99e3('0x2'));var rp=require(_0x99e3('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x99e3('0x4'));var util=require(_0x99e3('0x5'));var path=require(_0x99e3('0x6'));var sox=require(_0x99e3('0x7'));var csv=require(_0x99e3('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x99e3('0x9'));var squel=require(_0x99e3('0xa'));var crypto=require(_0x99e3('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x99e3('0xc'));var toCsv=require(_0x99e3('0x8'));var querystring=require(_0x99e3('0xd'));var Papa=require(_0x99e3('0xe'));var Redis=require(_0x99e3('0xf'));var authService=require(_0x99e3('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x99e3('0x11'));var hardwareService=require(_0x99e3('0x12'));var logger=require(_0x99e3('0x13'))(_0x99e3('0x14'));var utils=require(_0x99e3('0x15'));var config=require(_0x99e3('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var extensions=require(_0x99e3('0x17'));function respondWithStatusCode(_0x5912d6,_0x55fd55){_0x55fd55=_0x55fd55||0xcc;return function(_0x16c469){if(_0x16c469){return _0x5912d6[_0x99e3('0x18')](_0x55fd55);}return _0x5912d6[_0x99e3('0x19')](_0x55fd55)[_0x99e3('0x1a')]();};}function respondWithResult(_0x21e842,_0x53a25e){_0x53a25e=_0x53a25e||0xc8;return function(_0xb84fc7){if(_0xb84fc7){return _0x21e842['status'](_0x53a25e)[_0x99e3('0x1b')](_0xb84fc7);}};}function respondWithFilteredResult(_0x208fd5,_0x52864b){return function(_0x579679){if(_0x579679){var _0xd0d531=typeof _0x52864b[_0x99e3('0x1c')]===_0x99e3('0x1d')&&typeof _0x52864b['limit']===_0x99e3('0x1d');var _0x57191e=_0x579679[_0x99e3('0x1e')];var _0x131614=_0xd0d531?0x0:_0x52864b[_0x99e3('0x1c')];var _0x497628=_0xd0d531?_0x579679[_0x99e3('0x1e')]:_0x52864b[_0x99e3('0x1c')]+_0x52864b[_0x99e3('0x1f')];var _0x2dc3a2;if(_0x497628>=_0x57191e){_0x497628=_0x57191e;_0x2dc3a2=0xc8;}else{_0x2dc3a2=0xce;}_0x208fd5[_0x99e3('0x19')](_0x2dc3a2);return _0x208fd5[_0x99e3('0x20')]('Content-Range',_0x131614+'-'+_0x497628+'/'+_0x57191e)['json'](_0x579679);}return null;};}function patchUpdates(_0x1945e0){return function(_0x2a492c){try{jsonpatch[_0x99e3('0x21')](_0x2a492c,_0x1945e0,!![]);}catch(_0x90eaa0){return BPromise[_0x99e3('0x22')](_0x90eaa0);}return _0x2a492c['save']();};}function saveUpdates(_0x146fce,_0x9efc30){return function(_0x12508a){if(_0x12508a){return _0x12508a[_0x99e3('0x23')](_0x146fce)[_0x99e3('0x24')](function(_0x55b4f0){return _0x55b4f0;});}return null;};}function removeEntity(_0x3aaeb9,_0x1dcbb2){return function(_0x2ed0db){if(_0x2ed0db){return _0x2ed0db['destroy']()[_0x99e3('0x24')](function(){var _0x118941=_0x2ed0db[_0x99e3('0x25')]({'plain':!![]});var _0x4535eb=_0x99e3('0x26');return db['UserProfileResource'][_0x99e3('0x27')]({'where':{'type':_0x4535eb,'resourceId':_0x118941['id']}})[_0x99e3('0x24')](function(){return _0x2ed0db;});})[_0x99e3('0x24')](function(){_0x3aaeb9[_0x99e3('0x19')](0xcc)[_0x99e3('0x1a')]();});}};}function handleEntityNotFound(_0x243fd4,_0x5378d6){return function(_0x1a37cd){if(!_0x1a37cd){_0x243fd4[_0x99e3('0x18')](0x194);}return _0x1a37cd;};}function handleError(_0x48753,_0x1adcf8){_0x1adcf8=_0x1adcf8||0x1f4;return function(_0x24b799){logger[_0x99e3('0x28')](_0x24b799[_0x99e3('0x29')]);if(_0x24b799[_0x99e3('0x2a')]){delete _0x24b799['name'];}_0x48753[_0x99e3('0x19')](_0x1adcf8)[_0x99e3('0x2b')](_0x24b799);};}exports[_0x99e3('0x2c')]=function(_0x366913,_0x1dc051){var _0x3c58dd={},_0x1677d2={},_0x2c1e92={'count':0x0,'rows':[]};var _0x3733d2=_[_0x99e3('0x2d')](db[_0x99e3('0x2e')][_0x99e3('0x2f')],function(_0x48da4a){return{'name':_0x48da4a[_0x99e3('0x30')],'type':_0x48da4a[_0x99e3('0x31')][_0x99e3('0x32')]};});_0x1677d2['model']=_['map'](_0x3733d2,'name');_0x1677d2[_0x99e3('0x33')]=_[_0x99e3('0x34')](_0x366913[_0x99e3('0x33')]);_0x1677d2[_0x99e3('0x35')]=_['intersection'](_0x1677d2[_0x99e3('0x36')],_0x1677d2[_0x99e3('0x33')]);_0x3c58dd[_0x99e3('0x37')]=_[_0x99e3('0x38')](_0x1677d2[_0x99e3('0x36')],qs[_0x99e3('0x39')](_0x366913['query'][_0x99e3('0x39')]));_0x3c58dd[_0x99e3('0x37')]=_0x3c58dd[_0x99e3('0x37')][_0x99e3('0x3a')]?_0x3c58dd[_0x99e3('0x37')]:_0x1677d2[_0x99e3('0x36')];if(!_0x366913[_0x99e3('0x33')]['hasOwnProperty'](_0x99e3('0x3b'))){_0x3c58dd[_0x99e3('0x1f')]=qs[_0x99e3('0x1f')](_0x366913[_0x99e3('0x33')]['limit']);_0x3c58dd[_0x99e3('0x1c')]=qs[_0x99e3('0x1c')](_0x366913[_0x99e3('0x33')][_0x99e3('0x1c')]);}_0x3c58dd[_0x99e3('0x3c')]=qs['sort'](_0x366913[_0x99e3('0x33')][_0x99e3('0x3d')]);_0x3c58dd[_0x99e3('0x3e')]=qs[_0x99e3('0x35')](_[_0x99e3('0x3f')](_0x366913[_0x99e3('0x33')],_0x1677d2[_0x99e3('0x35')]),_0x3733d2);if(_0x366913[_0x99e3('0x33')][_0x99e3('0x40')]){_0x3c58dd['where']=_[_0x99e3('0x41')](_0x3c58dd['where'],{'$or':_['map'](_0x3733d2,function(_0x3832c1){if(_0x3832c1[_0x99e3('0x31')]!==_0x99e3('0x42')){var _0x5be46a={};_0x5be46a[_0x3832c1['name']]={'$like':'%'+_0x366913['query'][_0x99e3('0x40')]+'%'};return _0x5be46a;}})});}_0x3c58dd=_[_0x99e3('0x41')]({},_0x3c58dd,_0x366913[_0x99e3('0x43')]);var _0x22b849={'where':_0x3c58dd[_0x99e3('0x3e')]};return db[_0x99e3('0x2e')][_0x99e3('0x1e')](_0x22b849)[_0x99e3('0x24')](function(_0x241906){_0x2c1e92[_0x99e3('0x1e')]=_0x241906;if(_0x366913['query']['includeAll']){_0x3c58dd[_0x99e3('0x44')]=[{'all':!![]}];}return db[_0x99e3('0x2e')][_0x99e3('0x45')](_0x3c58dd);})['then'](function(_0x344133){_0x2c1e92[_0x99e3('0x46')]=_0x344133;return _0x2c1e92;})['then'](respondWithFilteredResult(_0x1dc051,_0x3c58dd))[_0x99e3('0x47')](handleError(_0x1dc051,null));};exports['show']=function(_0x42f30a,_0x15bb19){var _0x365514={'raw':!![],'where':{'id':_0x42f30a[_0x99e3('0x48')]['id']}},_0x232a88={};_0x232a88[_0x99e3('0x36')]=_[_0x99e3('0x34')](db['Interval'][_0x99e3('0x2f')]);_0x232a88[_0x99e3('0x33')]=_[_0x99e3('0x34')](_0x42f30a[_0x99e3('0x33')]);_0x232a88[_0x99e3('0x35')]=_[_0x99e3('0x38')](_0x232a88['model'],_0x232a88[_0x99e3('0x33')]);_0x365514[_0x99e3('0x37')]=_[_0x99e3('0x38')](_0x232a88[_0x99e3('0x36')],qs[_0x99e3('0x39')](_0x42f30a[_0x99e3('0x33')]['fields']));_0x365514[_0x99e3('0x37')]=_0x365514[_0x99e3('0x37')]['length']?_0x365514[_0x99e3('0x37')]:_0x232a88['model'];if(_0x42f30a[_0x99e3('0x33')]['includeAll']){_0x365514['include']=[{'all':!![]}];}_0x365514=_[_0x99e3('0x41')]({},_0x365514,_0x42f30a[_0x99e3('0x43')]);return db[_0x99e3('0x2e')][_0x99e3('0x49')](_0x365514)[_0x99e3('0x24')](handleEntityNotFound(_0x15bb19,null))['then'](respondWithResult(_0x15bb19,null))[_0x99e3('0x47')](handleError(_0x15bb19,null));};exports[_0x99e3('0x4a')]=function(_0x30867e,_0x5287ad){return db[_0x99e3('0x2e')][_0x99e3('0x4a')](_0x30867e[_0x99e3('0x4b')],{})[_0x99e3('0x24')](function(_0xfb0d78){var _0x47e106=_0x30867e[_0x99e3('0x4c')][_0x99e3('0x25')]({'plain':!![]});if(!_0x47e106)throw new Error(_0x99e3('0x4d'));if(_0x47e106[_0x99e3('0x4e')]===_0x99e3('0x4c')){var _0x440294=_0xfb0d78[_0x99e3('0x25')]({'plain':!![]});var _0x5949e2=_0x99e3('0x26');return db[_0x99e3('0x4f')][_0x99e3('0x49')]({'where':{'name':_0x5949e2,'userProfileId':_0x47e106[_0x99e3('0x50')]},'raw':!![]})['then'](function(_0x39fcc6){if(_0x39fcc6&&_0x39fcc6[_0x99e3('0x51')]===0x0){return db[_0x99e3('0x52')][_0x99e3('0x4a')]({'name':_0x440294[_0x99e3('0x2a')],'resourceId':_0x440294['id'],'type':_0x39fcc6[_0x99e3('0x2a')],'sectionId':_0x39fcc6['id']},{})['then'](function(){return _0xfb0d78;});}else{return _0xfb0d78;}})[_0x99e3('0x47')](function(_0xd97d13){logger['error'](_0x99e3('0x53'),_0xd97d13);throw _0xd97d13;});}return _0xfb0d78;})[_0x99e3('0x24')](respondWithResult(_0x5287ad,0xc9))[_0x99e3('0x47')](handleError(_0x5287ad,null));};exports[_0x99e3('0x23')]=function(_0x558a2d,_0x423aab){if(_0x558a2d[_0x99e3('0x4b')]['id']){delete _0x558a2d[_0x99e3('0x4b')]['id'];}return db[_0x99e3('0x2e')][_0x99e3('0x49')]({'where':{'id':_0x558a2d[_0x99e3('0x48')]['id']}})[_0x99e3('0x24')](handleEntityNotFound(_0x423aab,null))[_0x99e3('0x24')](saveUpdates(_0x558a2d[_0x99e3('0x4b')],null))[_0x99e3('0x24')](respondWithResult(_0x423aab,null))[_0x99e3('0x47')](handleError(_0x423aab,null));};exports['destroy']=function(_0x5d835f,_0x3a2dcc){return db[_0x99e3('0x2e')]['find']({'where':{'id':_0x5d835f[_0x99e3('0x48')]['id']}})[_0x99e3('0x24')](handleEntityNotFound(_0x3a2dcc,null))[_0x99e3('0x24')](removeEntity(_0x3a2dcc,null))['catch'](handleError(_0x3a2dcc,null));};exports[_0x99e3('0x54')]=function(_0x5c453a,_0x25c6a4,_0x42dddd){if(_0x5c453a[_0x99e3('0x4b')]['id']){delete _0x5c453a[_0x99e3('0x4b')]['id'];}return db[_0x99e3('0x2e')][_0x99e3('0x49')]({'where':{'id':_0x5c453a[_0x99e3('0x48')]['id']}})[_0x99e3('0x24')](handleEntityNotFound(_0x25c6a4,null))[_0x99e3('0x24')](function(_0x22c7e5){if(_0x22c7e5){_0x5c453a['body'][_0x99e3('0x55')]=_0x22c7e5['id'];return db['Interval']['create'](_0x5c453a[_0x99e3('0x4b')]);}})[_0x99e3('0x24')](respondWithResult(_0x25c6a4,null))[_0x99e3('0x47')](handleError(_0x25c6a4,null));};exports[_0x99e3('0x56')]=function(_0x1ccb7a,_0x51b9e5,_0x48de8a){var _0x4fca99={};var _0x475b0b={};var _0x52715a;var _0x1f8d7d;return db[_0x99e3('0x2e')][_0x99e3('0x57')]({'where':{'id':_0x1ccb7a[_0x99e3('0x48')]['id']}})['then'](handleEntityNotFound(_0x51b9e5,null))[_0x99e3('0x24')](function(_0x25d070){if(_0x25d070){_0x52715a=_0x25d070;_0x475b0b[_0x99e3('0x36')]=_[_0x99e3('0x34')](db[_0x99e3('0x2e')][_0x99e3('0x2f')]);_0x475b0b[_0x99e3('0x33')]=_['keys'](_0x1ccb7a[_0x99e3('0x33')]);_0x475b0b[_0x99e3('0x35')]=_[_0x99e3('0x38')](_0x475b0b[_0x99e3('0x36')],_0x475b0b['query']);_0x4fca99[_0x99e3('0x37')]=_[_0x99e3('0x38')](_0x475b0b['model'],qs[_0x99e3('0x39')](_0x1ccb7a[_0x99e3('0x33')][_0x99e3('0x39')]));_0x4fca99[_0x99e3('0x37')]=_0x4fca99[_0x99e3('0x37')][_0x99e3('0x3a')]?_0x4fca99[_0x99e3('0x37')]:_0x475b0b[_0x99e3('0x36')];_0x4fca99[_0x99e3('0x3c')]=qs[_0x99e3('0x3d')](_0x1ccb7a['query']['sort']);_0x4fca99[_0x99e3('0x3e')]=qs['filters'](_[_0x99e3('0x3f')](_0x1ccb7a['query'],_0x475b0b[_0x99e3('0x35')]));if(_0x1ccb7a[_0x99e3('0x33')][_0x99e3('0x40')]){_0x4fca99[_0x99e3('0x3e')]=_['merge'](_0x4fca99[_0x99e3('0x3e')],{'$or':_[_0x99e3('0x2d')](_0x4fca99[_0x99e3('0x37')],function(_0x3d9f55){var _0x4e6910={};_0x4e6910[_0x3d9f55]={'$like':'%'+_0x1ccb7a['query'][_0x99e3('0x40')]+'%'};return _0x4e6910;})});}_0x4fca99=_[_0x99e3('0x41')]({},_0x4fca99,_0x1ccb7a[_0x99e3('0x43')]);return _0x52715a[_0x99e3('0x56')](_0x4fca99);}})[_0x99e3('0x24')](function(_0x4ffcfc){if(_0x4ffcfc){_0x1f8d7d=_0x4ffcfc[_0x99e3('0x3a')];if(!_0x1ccb7a[_0x99e3('0x33')][_0x99e3('0x58')]('nolimit')){_0x4fca99[_0x99e3('0x1f')]=qs[_0x99e3('0x1f')](_0x1ccb7a['query'][_0x99e3('0x1f')]);_0x4fca99['offset']=qs[_0x99e3('0x1c')](_0x1ccb7a[_0x99e3('0x33')]['offset']);}return _0x52715a[_0x99e3('0x56')](_0x4fca99);}})[_0x99e3('0x24')](function(_0xf94e1a){if(_0xf94e1a){return _0xf94e1a?{'count':_0x1f8d7d,'rows':_0xf94e1a}:null;}})[_0x99e3('0x24')](respondWithResult(_0x51b9e5,null))['catch'](handleError(_0x51b9e5,null));};exports[_0x99e3('0x59')]=function(_0x1968bf,_0x414a15,_0x11a9e2){return db['Interval'][_0x99e3('0x57')]({'where':{'id':_0x1968bf['params']['id']}})[_0x99e3('0x24')](handleEntityNotFound(_0x414a15,null))[_0x99e3('0x24')](function(_0x56fffc){if(_0x56fffc){return db[_0x99e3('0x5a')]['transaction'](function(_0x17b585){return db[_0x99e3('0x2e')][_0x99e3('0x27')]({'where':{'IntervalId':_0x1968bf[_0x99e3('0x48')]['id']},'transaction':_0x17b585})[_0x99e3('0x24')](function(_0x581c77){var _0x134c73=_[_0x99e3('0x2d')](_0x1968bf[_0x99e3('0x4b')],function(_0x726ad5){delete _0x726ad5['id'];_0x726ad5['IntervalId']=_0x1968bf[_0x99e3('0x48')]['id'];return _0x726ad5;});return db['Interval'][_0x99e3('0x5b')](_0x134c73,{'transaction':_0x17b585});});})['then'](function(){return db[_0x99e3('0x2e')][_0x99e3('0x45')]({'where':{'IntervalId':_0x1968bf['params']['id']}});});}})[_0x99e3('0x24')](respondWithResult(_0x414a15,null))[_0x99e3('0x47')](handleError(_0x414a15,null));}; \ No newline at end of file +var _0x3959=['undefined','limit','count','set','json','apply','reject','save','then','destroy','get','Intervals','UserProfileResource','stack','name','send','map','Interval','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','type','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','update','IntervalId','getIntervals','findOne','pick','addIntervals','sequelize','transaction','bulkCreate','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/extensions/rewrite','status','end','offset'];(function(_0x1e56e3,_0x289169){var _0x31eccd=function(_0x5eb492){while(--_0x5eb492){_0x1e56e3['push'](_0x1e56e3['shift']());}};_0x31eccd(++_0x289169);}(_0x3959,0x99));var _0x9395=function(_0x6d2976,_0x2e27b5){_0x6d2976=_0x6d2976-0x0;var _0x50031f=_0x3959[_0x6d2976];return _0x50031f;};'use strict';var emlformat=require(_0x9395('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9395('0x1'));var jsonpatch=require(_0x9395('0x2'));var rp=require(_0x9395('0x3'));var moment=require(_0x9395('0x4'));var BPromise=require(_0x9395('0x5'));var Mustache=require('mustache');var util=require(_0x9395('0x6'));var path=require(_0x9395('0x7'));var sox=require(_0x9395('0x8'));var csv=require(_0x9395('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x9395('0xa'));var jsforce=require(_0x9395('0xb'));var deskjs=require(_0x9395('0xc'));var toCsv=require(_0x9395('0x9'));var querystring=require(_0x9395('0xd'));var Papa=require(_0x9395('0xe'));var Redis=require(_0x9395('0xf'));var authService=require(_0x9395('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x9395('0x11'));var hardwareService=require(_0x9395('0x12'));var logger=require(_0x9395('0x13'))('api');var utils=require(_0x9395('0x14'));var config=require(_0x9395('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x9395('0x16'))['db'];var extensions=require(_0x9395('0x17'));function respondWithStatusCode(_0x35a489,_0x147a52){_0x147a52=_0x147a52||0xcc;return function(_0x6be7ed){if(_0x6be7ed){return _0x35a489['sendStatus'](_0x147a52);}return _0x35a489[_0x9395('0x18')](_0x147a52)[_0x9395('0x19')]();};}function respondWithResult(_0x131b51,_0x138ac5){_0x138ac5=_0x138ac5||0xc8;return function(_0x127bf6){if(_0x127bf6){return _0x131b51['status'](_0x138ac5)['json'](_0x127bf6);}};}function respondWithFilteredResult(_0x573c89,_0x273c45){return function(_0xc05927){if(_0xc05927){var _0x4e9df2=typeof _0x273c45[_0x9395('0x1a')]===_0x9395('0x1b')&&typeof _0x273c45[_0x9395('0x1c')]==='undefined';var _0x31dbeb=_0xc05927[_0x9395('0x1d')];var _0x36d794=_0x4e9df2?0x0:_0x273c45[_0x9395('0x1a')];var _0x146e20=_0x4e9df2?_0xc05927[_0x9395('0x1d')]:_0x273c45['offset']+_0x273c45[_0x9395('0x1c')];var _0x23df6b;if(_0x146e20>=_0x31dbeb){_0x146e20=_0x31dbeb;_0x23df6b=0xc8;}else{_0x23df6b=0xce;}_0x573c89['status'](_0x23df6b);return _0x573c89[_0x9395('0x1e')]('Content-Range',_0x36d794+'-'+_0x146e20+'/'+_0x31dbeb)[_0x9395('0x1f')](_0xc05927);}return null;};}function patchUpdates(_0x280fb5){return function(_0x5b10d4){try{jsonpatch[_0x9395('0x20')](_0x5b10d4,_0x280fb5,!![]);}catch(_0x32fdf5){return BPromise[_0x9395('0x21')](_0x32fdf5);}return _0x5b10d4[_0x9395('0x22')]();};}function saveUpdates(_0x4ae3cb,_0x3dee53){return function(_0xa7d9d){if(_0xa7d9d){return _0xa7d9d['update'](_0x4ae3cb)[_0x9395('0x23')](function(_0xbe06c7){return _0xbe06c7;});}return null;};}function removeEntity(_0xc09514,_0x43eae8){return function(_0x18b95d){if(_0x18b95d){return _0x18b95d[_0x9395('0x24')]()[_0x9395('0x23')](function(){var _0x1447c0=_0x18b95d[_0x9395('0x25')]({'plain':!![]});var _0x53ba2d=_0x9395('0x26');return db[_0x9395('0x27')][_0x9395('0x24')]({'where':{'type':_0x53ba2d,'resourceId':_0x1447c0['id']}})[_0x9395('0x23')](function(){return _0x18b95d;});})[_0x9395('0x23')](function(){_0xc09514[_0x9395('0x18')](0xcc)[_0x9395('0x19')]();});}};}function handleEntityNotFound(_0x197c89,_0x5cfe58){return function(_0x252ecc){if(!_0x252ecc){_0x197c89['sendStatus'](0x194);}return _0x252ecc;};}function handleError(_0x3b7465,_0x5485f4){_0x5485f4=_0x5485f4||0x1f4;return function(_0x35e736){logger['error'](_0x35e736[_0x9395('0x28')]);if(_0x35e736[_0x9395('0x29')]){delete _0x35e736[_0x9395('0x29')];}_0x3b7465['status'](_0x5485f4)[_0x9395('0x2a')](_0x35e736);};}exports['index']=function(_0x15684a,_0x5a5dca){var _0x23326c={},_0x5ddd1b={},_0x86ec0={'count':0x0,'rows':[]};var _0x3e844b=_[_0x9395('0x2b')](db[_0x9395('0x2c')][_0x9395('0x2d')],function(_0x4ccc46){return{'name':_0x4ccc46['fieldName'],'type':_0x4ccc46['type'][_0x9395('0x2e')]};});_0x5ddd1b[_0x9395('0x2f')]=_['map'](_0x3e844b,'name');_0x5ddd1b['query']=_[_0x9395('0x30')](_0x15684a[_0x9395('0x31')]);_0x5ddd1b[_0x9395('0x32')]=_[_0x9395('0x33')](_0x5ddd1b[_0x9395('0x2f')],_0x5ddd1b['query']);_0x23326c[_0x9395('0x34')]=_[_0x9395('0x33')](_0x5ddd1b[_0x9395('0x2f')],qs['fields'](_0x15684a[_0x9395('0x31')][_0x9395('0x35')]));_0x23326c[_0x9395('0x34')]=_0x23326c[_0x9395('0x34')][_0x9395('0x36')]?_0x23326c[_0x9395('0x34')]:_0x5ddd1b[_0x9395('0x2f')];if(!_0x15684a[_0x9395('0x31')][_0x9395('0x37')](_0x9395('0x38'))){_0x23326c[_0x9395('0x1c')]=qs['limit'](_0x15684a[_0x9395('0x31')][_0x9395('0x1c')]);_0x23326c[_0x9395('0x1a')]=qs[_0x9395('0x1a')](_0x15684a['query'][_0x9395('0x1a')]);}_0x23326c[_0x9395('0x39')]=qs[_0x9395('0x3a')](_0x15684a[_0x9395('0x31')][_0x9395('0x3a')]);_0x23326c['where']=qs[_0x9395('0x32')](_['pick'](_0x15684a[_0x9395('0x31')],_0x5ddd1b[_0x9395('0x32')]),_0x3e844b);if(_0x15684a[_0x9395('0x31')][_0x9395('0x3b')]){_0x23326c[_0x9395('0x3c')]=_['merge'](_0x23326c['where'],{'$or':_[_0x9395('0x2b')](_0x3e844b,function(_0x4b3af7){if(_0x4b3af7[_0x9395('0x3d')]!==_0x9395('0x3e')){var _0x2ed93a={};_0x2ed93a[_0x4b3af7[_0x9395('0x29')]]={'$like':'%'+_0x15684a[_0x9395('0x31')][_0x9395('0x3b')]+'%'};return _0x2ed93a;}})});}_0x23326c=_[_0x9395('0x3f')]({},_0x23326c,_0x15684a[_0x9395('0x40')]);var _0x2cae56={'where':_0x23326c[_0x9395('0x3c')]};return db[_0x9395('0x2c')][_0x9395('0x1d')](_0x2cae56)[_0x9395('0x23')](function(_0x433d35){_0x86ec0['count']=_0x433d35;if(_0x15684a[_0x9395('0x31')][_0x9395('0x41')]){_0x23326c['include']=[{'all':!![]}];}return db[_0x9395('0x2c')][_0x9395('0x42')](_0x23326c);})[_0x9395('0x23')](function(_0x161348){_0x86ec0[_0x9395('0x43')]=_0x161348;return _0x86ec0;})[_0x9395('0x23')](respondWithFilteredResult(_0x5a5dca,_0x23326c))[_0x9395('0x44')](handleError(_0x5a5dca,null));};exports[_0x9395('0x45')]=function(_0x1fc07d,_0x5e5d83){var _0x4e426d={'raw':!![],'where':{'id':_0x1fc07d[_0x9395('0x46')]['id']}},_0x4da5bc={};_0x4da5bc[_0x9395('0x2f')]=_[_0x9395('0x30')](db[_0x9395('0x2c')][_0x9395('0x2d')]);_0x4da5bc['query']=_[_0x9395('0x30')](_0x1fc07d['query']);_0x4da5bc[_0x9395('0x32')]=_[_0x9395('0x33')](_0x4da5bc[_0x9395('0x2f')],_0x4da5bc[_0x9395('0x31')]);_0x4e426d[_0x9395('0x34')]=_[_0x9395('0x33')](_0x4da5bc[_0x9395('0x2f')],qs['fields'](_0x1fc07d['query'][_0x9395('0x35')]));_0x4e426d[_0x9395('0x34')]=_0x4e426d[_0x9395('0x34')]['length']?_0x4e426d[_0x9395('0x34')]:_0x4da5bc['model'];if(_0x1fc07d['query'][_0x9395('0x41')]){_0x4e426d[_0x9395('0x47')]=[{'all':!![]}];}_0x4e426d=_['merge']({},_0x4e426d,_0x1fc07d['options']);return db['Interval'][_0x9395('0x48')](_0x4e426d)[_0x9395('0x23')](handleEntityNotFound(_0x5e5d83,null))[_0x9395('0x23')](respondWithResult(_0x5e5d83,null))[_0x9395('0x44')](handleError(_0x5e5d83,null));};exports[_0x9395('0x49')]=function(_0x57307f,_0x3bd31a){return db['Interval'][_0x9395('0x49')](_0x57307f[_0x9395('0x4a')],{})[_0x9395('0x23')](function(_0x4ff856){var _0x5699f3=_0x57307f[_0x9395('0x4b')][_0x9395('0x25')]({'plain':!![]});if(!_0x5699f3)throw new Error(_0x9395('0x4c'));if(_0x5699f3[_0x9395('0x4d')]===_0x9395('0x4b')){var _0x17623e=_0x4ff856[_0x9395('0x25')]({'plain':!![]});var _0x426e15=_0x9395('0x26');return db[_0x9395('0x4e')][_0x9395('0x48')]({'where':{'name':_0x426e15,'userProfileId':_0x5699f3[_0x9395('0x4f')]},'raw':!![]})[_0x9395('0x23')](function(_0x114deb){if(_0x114deb&&_0x114deb[_0x9395('0x50')]===0x0){return db[_0x9395('0x27')][_0x9395('0x49')]({'name':_0x17623e[_0x9395('0x29')],'resourceId':_0x17623e['id'],'type':_0x114deb[_0x9395('0x29')],'sectionId':_0x114deb['id']},{})[_0x9395('0x23')](function(){return _0x4ff856;});}else{return _0x4ff856;}})['catch'](function(_0x1b49a6){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1b49a6);throw _0x1b49a6;});}return _0x4ff856;})['then'](respondWithResult(_0x3bd31a,0xc9))[_0x9395('0x44')](handleError(_0x3bd31a,null));};exports[_0x9395('0x51')]=function(_0x1644e6,_0x5b63dd){if(_0x1644e6[_0x9395('0x4a')]['id']){delete _0x1644e6[_0x9395('0x4a')]['id'];}return db[_0x9395('0x2c')][_0x9395('0x48')]({'where':{'id':_0x1644e6[_0x9395('0x46')]['id']}})['then'](handleEntityNotFound(_0x5b63dd,null))[_0x9395('0x23')](saveUpdates(_0x1644e6['body'],null))[_0x9395('0x23')](respondWithResult(_0x5b63dd,null))[_0x9395('0x44')](handleError(_0x5b63dd,null));};exports[_0x9395('0x24')]=function(_0x47604e,_0x704cce){return db[_0x9395('0x2c')][_0x9395('0x48')]({'where':{'id':_0x47604e[_0x9395('0x46')]['id']}})[_0x9395('0x23')](handleEntityNotFound(_0x704cce,null))[_0x9395('0x23')](removeEntity(_0x704cce,null))[_0x9395('0x44')](handleError(_0x704cce,null));};exports['addInterval']=function(_0x42885e,_0x4e7a79,_0x3aa815){if(_0x42885e[_0x9395('0x4a')]['id']){delete _0x42885e['body']['id'];}return db['Interval']['find']({'where':{'id':_0x42885e[_0x9395('0x46')]['id']}})[_0x9395('0x23')](handleEntityNotFound(_0x4e7a79,null))[_0x9395('0x23')](function(_0x5d8a2c){if(_0x5d8a2c){_0x42885e[_0x9395('0x4a')][_0x9395('0x52')]=_0x5d8a2c['id'];return db[_0x9395('0x2c')]['create'](_0x42885e[_0x9395('0x4a')]);}})[_0x9395('0x23')](respondWithResult(_0x4e7a79,null))[_0x9395('0x44')](handleError(_0x4e7a79,null));};exports[_0x9395('0x53')]=function(_0x1be2d4,_0x31a8d5,_0x105411){var _0x5516fe={};var _0x779071={};var _0x334999;var _0xecd5f1;return db[_0x9395('0x2c')][_0x9395('0x54')]({'where':{'id':_0x1be2d4[_0x9395('0x46')]['id']}})[_0x9395('0x23')](handleEntityNotFound(_0x31a8d5,null))[_0x9395('0x23')](function(_0x4b6d71){if(_0x4b6d71){_0x334999=_0x4b6d71;_0x779071[_0x9395('0x2f')]=_[_0x9395('0x30')](db[_0x9395('0x2c')][_0x9395('0x2d')]);_0x779071[_0x9395('0x31')]=_[_0x9395('0x30')](_0x1be2d4[_0x9395('0x31')]);_0x779071[_0x9395('0x32')]=_['intersection'](_0x779071[_0x9395('0x2f')],_0x779071['query']);_0x5516fe[_0x9395('0x34')]=_[_0x9395('0x33')](_0x779071['model'],qs[_0x9395('0x35')](_0x1be2d4[_0x9395('0x31')]['fields']));_0x5516fe[_0x9395('0x34')]=_0x5516fe[_0x9395('0x34')][_0x9395('0x36')]?_0x5516fe[_0x9395('0x34')]:_0x779071[_0x9395('0x2f')];_0x5516fe[_0x9395('0x39')]=qs[_0x9395('0x3a')](_0x1be2d4[_0x9395('0x31')]['sort']);_0x5516fe[_0x9395('0x3c')]=qs['filters'](_[_0x9395('0x55')](_0x1be2d4[_0x9395('0x31')],_0x779071[_0x9395('0x32')]));if(_0x1be2d4[_0x9395('0x31')][_0x9395('0x3b')]){_0x5516fe[_0x9395('0x3c')]=_[_0x9395('0x3f')](_0x5516fe[_0x9395('0x3c')],{'$or':_[_0x9395('0x2b')](_0x5516fe[_0x9395('0x34')],function(_0x37f501){var _0x36dac8={};_0x36dac8[_0x37f501]={'$like':'%'+_0x1be2d4[_0x9395('0x31')]['filter']+'%'};return _0x36dac8;})});}_0x5516fe=_['merge']({},_0x5516fe,_0x1be2d4[_0x9395('0x40')]);return _0x334999[_0x9395('0x53')](_0x5516fe);}})['then'](function(_0x426841){if(_0x426841){_0xecd5f1=_0x426841['length'];if(!_0x1be2d4[_0x9395('0x31')][_0x9395('0x37')](_0x9395('0x38'))){_0x5516fe[_0x9395('0x1c')]=qs[_0x9395('0x1c')](_0x1be2d4[_0x9395('0x31')][_0x9395('0x1c')]);_0x5516fe[_0x9395('0x1a')]=qs[_0x9395('0x1a')](_0x1be2d4[_0x9395('0x31')][_0x9395('0x1a')]);}return _0x334999[_0x9395('0x53')](_0x5516fe);}})[_0x9395('0x23')](function(_0x12de8a){if(_0x12de8a){return _0x12de8a?{'count':_0xecd5f1,'rows':_0x12de8a}:null;}})['then'](respondWithResult(_0x31a8d5,null))['catch'](handleError(_0x31a8d5,null));};exports[_0x9395('0x56')]=function(_0x5243a3,_0x22ab7e,_0x2e9fb9){return db[_0x9395('0x2c')][_0x9395('0x54')]({'where':{'id':_0x5243a3['params']['id']}})[_0x9395('0x23')](handleEntityNotFound(_0x22ab7e,null))[_0x9395('0x23')](function(_0x14c5b3){if(_0x14c5b3){return db[_0x9395('0x57')][_0x9395('0x58')](function(_0x5cd23c){return db['Interval'][_0x9395('0x24')]({'where':{'IntervalId':_0x5243a3['params']['id']},'transaction':_0x5cd23c})[_0x9395('0x23')](function(_0x1b3560){var _0x5b329d=_[_0x9395('0x2b')](_0x5243a3[_0x9395('0x4a')],function(_0x482c7f){delete _0x482c7f['id'];_0x482c7f[_0x9395('0x52')]=_0x5243a3['params']['id'];return _0x482c7f;});return db['Interval'][_0x9395('0x59')](_0x5b329d,{'transaction':_0x5cd23c});});})[_0x9395('0x23')](function(){return db[_0x9395('0x2c')]['findAll']({'where':{'IntervalId':_0x5243a3['params']['id']}});});}})[_0x9395('0x23')](respondWithResult(_0x22ab7e,null))[_0x9395('0x44')](handleError(_0x22ab7e,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index cd9d5d7..0d99396 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 _0xb088=['../../components/extensions/rewrite','../../utils/iftime','iftime','Interval','tools_intervals','rewrite','string','interval','getIntervals','then','all','ifTime','reduce','./interval.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb088,0x99));var _0x8b08=function(_0x24fa3b,_0x4e5434){_0x24fa3b=_0x24fa3b-0x0;var _0x34b400=_0xb088[_0x24fa3b];return _0x34b400;};'use strict';var attributes=require(_0x8b08('0x0'));var extensions=require(_0x8b08('0x1'));var iftime=require(_0x8b08('0x2'))[_0x8b08('0x3')];module['exports']=function(_0xddd82b){return _0xddd82b['define'](_0x8b08('0x4'),attributes,{'tableName':_0x8b08('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x229988){extensions[_0x8b08('0x6')](_0xddd82b,_0x229988);},'afterBulkCreate':function(_0xf4719d,_0x25297d,_0x9c0291){_0x9c0291();extensions[_0x8b08('0x6')](_0xddd82b,_0xf4719d[0x0]);},'afterUpdate':function(_0x56b9f3){extensions['rewrite'](_0xddd82b,_0x56b9f3);},'afterDestroy':function(_0x137f50){extensions[_0x8b08('0x6')](_0xddd82b,_0x137f50);}},'instanceMethods':{'ifTime':function(_0x1fdb9e=undefined,_0x21a404=new Date()){if(typeof this['interval']===_0x8b08('0x7')){return iftime(this[_0x8b08('0x8')],_0x1fdb9e,_0x21a404);}else{return this[_0x8b08('0x9')]()[_0x8b08('0xa')](function(_0xb18d6a){return Promise[_0x8b08('0xb')](_0xb18d6a['map'](function(_0x49aa83){return _0x49aa83[_0x8b08('0xc')](_0x1fdb9e,_0x21a404);}));})[_0x8b08('0xa')](function(_0x44505c){return _0x44505c[_0x8b08('0xd')](function(_0x3e4ba0,_0x3387e6){return _0x3e4ba0||_0x3387e6;},![]);});}}}});}; \ No newline at end of file +var _0xda06=['exports','Interval','tools_intervals','rewrite','interval','string','getIntervals','then','all','map','ifTime','./interval.attributes','../../components/extensions/rewrite','../../utils/iftime'];(function(_0x4b4c3b,_0x121398){var _0x125d77=function(_0x3cdff5){while(--_0x3cdff5){_0x4b4c3b['push'](_0x4b4c3b['shift']());}};_0x125d77(++_0x121398);}(_0xda06,0x1e7));var _0x6da0=function(_0x17e600,_0x1fdf60){_0x17e600=_0x17e600-0x0;var _0x317515=_0xda06[_0x17e600];return _0x317515;};'use strict';var attributes=require(_0x6da0('0x0'));var extensions=require(_0x6da0('0x1'));var iftime=require(_0x6da0('0x2'))['iftime'];module[_0x6da0('0x3')]=function(_0x195f6c){return _0x195f6c['define'](_0x6da0('0x4'),attributes,{'tableName':_0x6da0('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x26f1c4){extensions['rewrite'](_0x195f6c,_0x26f1c4);},'afterBulkCreate':function(_0x444be8,_0x50558e,_0x1ad3e9){_0x1ad3e9();extensions[_0x6da0('0x6')](_0x195f6c,_0x444be8[0x0]);},'afterUpdate':function(_0xb5b97f){extensions[_0x6da0('0x6')](_0x195f6c,_0xb5b97f);},'afterDestroy':function(_0x4a58f3){extensions[_0x6da0('0x6')](_0x195f6c,_0x4a58f3);}},'instanceMethods':{'ifTime':function(_0x4e8d68=undefined,_0x3ae354=new Date()){if(typeof this[_0x6da0('0x7')]===_0x6da0('0x8')){return iftime(this['interval'],_0x4e8d68,_0x3ae354);}else{return this[_0x6da0('0x9')]()[_0x6da0('0xa')](function(_0x242086){return Promise[_0x6da0('0xb')](_0x242086[_0x6da0('0xc')](function(_0x324dc6){return _0x324dc6[_0x6da0('0xd')](_0x4e8d68,_0x3ae354);}));})[_0x6da0('0xa')](function(_0x23e0af){return _0x23e0af['reduce'](function(_0x523da5,_0x1c8b1d){return _0x523da5||_0x1c8b1d;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index a4b3d1f..a5c51be 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 _0x73ba=['format','name','join','IntervalIftime','intervalIds','isArray','intervals','string','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','silly','resolve','util','../../mysqldb','../../utils/iftime','iftime','../../config/logger','rpc','GetInterval','Interval','options','raw','limit','include','model','map','attributes','then','debug','stringify','error','message','find','where','info','ShowInterval','catch','all','ifTime','reduce'];(function(_0x2f7e20,_0x274e29){var _0x5619a3=function(_0x36db3a){while(--_0x36db3a){_0x2f7e20['push'](_0x2f7e20['shift']());}};_0x5619a3(++_0x274e29);}(_0x73ba,0x103));var _0xa73b=function(_0x5eb9b3,_0x46fda2){_0x5eb9b3=_0x5eb9b3-0x0;var _0xcb3dcb=_0x73ba[_0x5eb9b3];return _0xcb3dcb;};'use strict';var _=require('lodash');var util=require(_0xa73b('0x0'));var db=require(_0xa73b('0x1'))['db'];var iftime=require(_0xa73b('0x2'))[_0xa73b('0x3')];var logger=require(_0xa73b('0x4'))(_0xa73b('0x5'));exports[_0xa73b('0x6')]=function(_0x57c72c){var _0x3780df=this;return new Promise(function(_0x4f84d6,_0x24bf0c){return db[_0xa73b('0x7')]['findAll']({'raw':_0x57c72c[_0xa73b('0x8')]?_0x57c72c[_0xa73b('0x8')][_0xa73b('0x9')]===undefined?!![]:![]:!![],'where':_0x57c72c[_0xa73b('0x8')]?_0x57c72c[_0xa73b('0x8')]['where']||null:null,'attributes':_0x57c72c[_0xa73b('0x8')]?_0x57c72c[_0xa73b('0x8')]['attributes']||null:null,'limit':_0x57c72c[_0xa73b('0x8')]?_0x57c72c[_0xa73b('0x8')][_0xa73b('0xa')]||null:null,'include':_0x57c72c[_0xa73b('0x8')]?_0x57c72c[_0xa73b('0x8')][_0xa73b('0xb')]?_['map'](_0x57c72c[_0xa73b('0x8')][_0xa73b('0xb')],function(_0x2274f9){return{'model':db[_0x2274f9[_0xa73b('0xc')]],'as':_0x2274f9['as'],'attributes':_0x2274f9['attributes'],'include':_0x2274f9[_0xa73b('0xb')]?_[_0xa73b('0xd')](_0x2274f9['include'],function(_0x477f93){return{'model':db[_0x477f93[_0xa73b('0xc')]],'as':_0x477f93['as'],'attributes':_0x477f93[_0xa73b('0xe')],'include':_0x477f93['include']?_[_0xa73b('0xd')](_0x477f93[_0xa73b('0xb')],function(_0x5cfacc){return{'model':db[_0x5cfacc[_0xa73b('0xc')]],'as':_0x5cfacc['as'],'attributes':_0x5cfacc['attributes']};}):[]};}):[]};}):[]:[]})[_0xa73b('0xf')](function(_0xbed040){logger['info'](_0xa73b('0x6'),_0x57c72c);logger[_0xa73b('0x10')](_0xa73b('0x6'),_0x57c72c,JSON[_0xa73b('0x11')](_0xbed040));_0x4f84d6(_0xbed040);})['catch'](function(_0x1b2c26){logger[_0xa73b('0x12')](_0xa73b('0x6'),_0x1b2c26[_0xa73b('0x13')],_0x57c72c);_0x24bf0c(_0x3780df[_0xa73b('0x12')](0x1f4,_0x1b2c26[_0xa73b('0x13')]));});});};exports['ShowInterval']=function(_0x1fc4db){var _0x33f1e9=this;return new Promise(function(_0x3a2565,_0x1702fa){return db[_0xa73b('0x7')][_0xa73b('0x14')]({'raw':_0x1fc4db[_0xa73b('0x8')]?_0x1fc4db['options']['raw']===undefined?!![]:![]:!![],'where':_0x1fc4db['options']?_0x1fc4db[_0xa73b('0x8')][_0xa73b('0x15')]||null:null,'attributes':_0x1fc4db['options']?_0x1fc4db[_0xa73b('0x8')][_0xa73b('0xe')]||null:null,'include':_0x1fc4db[_0xa73b('0x8')]?_0x1fc4db[_0xa73b('0x8')][_0xa73b('0xb')]?_['map'](_0x1fc4db[_0xa73b('0x8')]['include'],function(_0x390051){return{'model':db[_0x390051[_0xa73b('0xc')]],'as':_0x390051['as'],'attributes':_0x390051[_0xa73b('0xe')],'include':_0x390051[_0xa73b('0xb')]?_[_0xa73b('0xd')](_0x390051[_0xa73b('0xb')],function(_0x3d6bb9){return{'model':db[_0x3d6bb9[_0xa73b('0xc')]],'as':_0x3d6bb9['as'],'attributes':_0x3d6bb9[_0xa73b('0xe')],'include':_0x3d6bb9[_0xa73b('0xb')]?_[_0xa73b('0xd')](_0x3d6bb9[_0xa73b('0xb')],function(_0x131f28){return{'model':db[_0x131f28[_0xa73b('0xc')]],'as':_0x131f28['as'],'attributes':_0x131f28[_0xa73b('0xe')]};}):[]};}):[]};}):[]:[]})[_0xa73b('0xf')](function(_0x169e27){logger[_0xa73b('0x16')](_0xa73b('0x17'),_0x1fc4db);logger[_0xa73b('0x10')]('ShowInterval',_0x1fc4db,JSON[_0xa73b('0x11')](_0x169e27));_0x3a2565(_0x169e27);})[_0xa73b('0x18')](function(_0x514057){logger[_0xa73b('0x12')](_0xa73b('0x17'),_0x514057[_0xa73b('0x13')],_0x1fc4db);_0x1702fa(_0x33f1e9['error'](0x1f4,_0x514057[_0xa73b('0x13')]));});});};function checkArrayOfIntervals(_0xd9ca6c,_0x79fe74){var _0x125d91=[];return db['Interval']['findAll']({'where':{'id':_0xd9ca6c}})[_0xa73b('0xf')](function(_0x2cd486){_0x125d91=_0x2cd486;return Promise[_0xa73b('0x19')](_0x125d91[_0xa73b('0xd')](function(_0x4b1660){return _0x4b1660[_0xa73b('0x1a')](_0x79fe74);}));})[_0xa73b('0xf')](function(_0x4a6d29){var _0x42ba60=_0x4a6d29[_0xa73b('0x1b')](function(_0x28e34c,_0x3cfca9){return _0x28e34c||_0x3cfca9;},![]);logger['info'](util[_0xa73b('0x1c')]('IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)',_0x125d91[_0xa73b('0xd')](function(_0x16a87f){return _0x16a87f[_0xa73b('0x1d')];})[_0xa73b('0x1e')](',\x20'),_0x125d91[_0xa73b('0xd')](function(_0x5b450b){return _0x5b450b['id'];})[_0xa73b('0x1e')](',\x20')));return _0x42ba60;});}function checkSingleInterval(_0x1b48a2,_0x11cc6b){return db[_0xa73b('0x7')]['findById'](_0x1b48a2)[_0xa73b('0xf')](function(_0x4bbbdf){if(_0x4bbbdf){logger[_0xa73b('0x16')](util[_0xa73b('0x1c')]('IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)',_0x4bbbdf[_0xa73b('0x1d')],_0x4bbbdf['id']));return _0x4bbbdf[_0xa73b('0x1a')](_0x11cc6b);}});}exports[_0xa73b('0x1f')]=function(_0x3c09ec){var _0x9a3068=_0x3c09ec[_0xa73b('0x20')];var _0x243091=Array[_0xa73b('0x21')](_0x3c09ec[_0xa73b('0x22')])?_0x3c09ec[_0xa73b('0x22')]:typeof _0x3c09ec[_0xa73b('0x22')]===_0xa73b('0x23')?[_0x3c09ec[_0xa73b('0x22')]]:[];var _0x1f344f=_0x3c09ec[_0xa73b('0x24')]||undefined;var _0x315c06=![];if(_0x243091[_0xa73b('0x25')]){logger['info'](util[_0xa73b('0x1c')](_0xa73b('0x26'),_0x243091[_0xa73b('0x1e')](';\x20')));}if(_0x1f344f){logger[_0xa73b('0x16')](util[_0xa73b('0x1c')]('IntervalIftime:\x20timezone\x20=\x20%s',_0x1f344f));}logger['debug']('Iftime',_0x315c06);logger[_0xa73b('0x27')](_0xa73b('0x1f'),_0x3c09ec);return Promise[_0xa73b('0x28')]()[_0xa73b('0xf')](function(){if(Array[_0xa73b('0x21')](_0x9a3068)){return checkArrayOfIntervals(_0x9a3068,_0x1f344f);}else if(_0x9a3068){return checkSingleInterval(_0x9a3068,_0x1f344f);}})[_0xa73b('0xf')](function(_0x12c3d3){var _0x4ace87=_0x243091[_0xa73b('0x1b')](function(_0x350281,_0x26785e){return _0x350281||iftime(_0x26785e,_0x1f344f);},![]);_0x315c06=_0x12c3d3||_0x4ace87;return _0x315c06;})[_0xa73b('0x18')](function(_0x400bcf){logger[_0xa73b('0x12')]('IntervalIftime',_0x3c09ec,_0x400bcf);throw this[_0xa73b('0x12')](0x1f4,_0x400bcf[_0xa73b('0x13')]);});}; \ No newline at end of file +var _0xdd65=['model','then','debug','catch','error','message','ShowInterval','Interval','find','where','info','stringify','findAll','ifTime','format','name','join','IntervalIftime','intervalIds','intervals','string','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','silly','resolve','isArray','reduce','lodash','../../mysqldb','../../utils/iftime','iftime','../../config/logger','rpc','GetInterval','options','raw','attributes','include','map'];(function(_0x3dacf9,_0x20e855){var _0x1a00b4=function(_0x501744){while(--_0x501744){_0x3dacf9['push'](_0x3dacf9['shift']());}};_0x1a00b4(++_0x20e855);}(_0xdd65,0xe4));var _0x5dd6=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xdd65[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x5dd6('0x0'));var util=require('util');var db=require(_0x5dd6('0x1'))['db'];var iftime=require(_0x5dd6('0x2'))[_0x5dd6('0x3')];var logger=require(_0x5dd6('0x4'))(_0x5dd6('0x5'));exports[_0x5dd6('0x6')]=function(_0x2c91db){var _0x489cc8=this;return new Promise(function(_0x164cc7,_0x24ee1c){return db['Interval']['findAll']({'raw':_0x2c91db[_0x5dd6('0x7')]?_0x2c91db[_0x5dd6('0x7')][_0x5dd6('0x8')]===undefined?!![]:![]:!![],'where':_0x2c91db['options']?_0x2c91db[_0x5dd6('0x7')]['where']||null:null,'attributes':_0x2c91db[_0x5dd6('0x7')]?_0x2c91db['options'][_0x5dd6('0x9')]||null:null,'limit':_0x2c91db[_0x5dd6('0x7')]?_0x2c91db[_0x5dd6('0x7')]['limit']||null:null,'include':_0x2c91db[_0x5dd6('0x7')]?_0x2c91db[_0x5dd6('0x7')][_0x5dd6('0xa')]?_[_0x5dd6('0xb')](_0x2c91db['options'][_0x5dd6('0xa')],function(_0x1fe1a3){return{'model':db[_0x1fe1a3['model']],'as':_0x1fe1a3['as'],'attributes':_0x1fe1a3[_0x5dd6('0x9')],'include':_0x1fe1a3[_0x5dd6('0xa')]?_[_0x5dd6('0xb')](_0x1fe1a3[_0x5dd6('0xa')],function(_0x362f20){return{'model':db[_0x362f20[_0x5dd6('0xc')]],'as':_0x362f20['as'],'attributes':_0x362f20[_0x5dd6('0x9')],'include':_0x362f20[_0x5dd6('0xa')]?_['map'](_0x362f20[_0x5dd6('0xa')],function(_0xaecf25){return{'model':db[_0xaecf25['model']],'as':_0xaecf25['as'],'attributes':_0xaecf25[_0x5dd6('0x9')]};}):[]};}):[]};}):[]:[]})[_0x5dd6('0xd')](function(_0x4cb60f){logger['info'](_0x5dd6('0x6'),_0x2c91db);logger[_0x5dd6('0xe')](_0x5dd6('0x6'),_0x2c91db,JSON['stringify'](_0x4cb60f));_0x164cc7(_0x4cb60f);})[_0x5dd6('0xf')](function(_0x469d0f){logger[_0x5dd6('0x10')]('GetInterval',_0x469d0f[_0x5dd6('0x11')],_0x2c91db);_0x24ee1c(_0x489cc8[_0x5dd6('0x10')](0x1f4,_0x469d0f[_0x5dd6('0x11')]));});});};exports[_0x5dd6('0x12')]=function(_0x1e4bcb){var _0x3ce448=this;return new Promise(function(_0x55962b,_0x526534){return db[_0x5dd6('0x13')][_0x5dd6('0x14')]({'raw':_0x1e4bcb[_0x5dd6('0x7')]?_0x1e4bcb['options'][_0x5dd6('0x8')]===undefined?!![]:![]:!![],'where':_0x1e4bcb[_0x5dd6('0x7')]?_0x1e4bcb[_0x5dd6('0x7')][_0x5dd6('0x15')]||null:null,'attributes':_0x1e4bcb[_0x5dd6('0x7')]?_0x1e4bcb[_0x5dd6('0x7')][_0x5dd6('0x9')]||null:null,'include':_0x1e4bcb[_0x5dd6('0x7')]?_0x1e4bcb[_0x5dd6('0x7')][_0x5dd6('0xa')]?_[_0x5dd6('0xb')](_0x1e4bcb[_0x5dd6('0x7')][_0x5dd6('0xa')],function(_0x3f1410){return{'model':db[_0x3f1410['model']],'as':_0x3f1410['as'],'attributes':_0x3f1410[_0x5dd6('0x9')],'include':_0x3f1410[_0x5dd6('0xa')]?_['map'](_0x3f1410[_0x5dd6('0xa')],function(_0x4f7390){return{'model':db[_0x4f7390['model']],'as':_0x4f7390['as'],'attributes':_0x4f7390[_0x5dd6('0x9')],'include':_0x4f7390[_0x5dd6('0xa')]?_['map'](_0x4f7390['include'],function(_0x792244){return{'model':db[_0x792244[_0x5dd6('0xc')]],'as':_0x792244['as'],'attributes':_0x792244[_0x5dd6('0x9')]};}):[]};}):[]};}):[]:[]})[_0x5dd6('0xd')](function(_0x11edcc){logger[_0x5dd6('0x16')](_0x5dd6('0x12'),_0x1e4bcb);logger['debug'](_0x5dd6('0x12'),_0x1e4bcb,JSON[_0x5dd6('0x17')](_0x11edcc));_0x55962b(_0x11edcc);})[_0x5dd6('0xf')](function(_0x3bb729){logger[_0x5dd6('0x10')](_0x5dd6('0x12'),_0x3bb729[_0x5dd6('0x11')],_0x1e4bcb);_0x526534(_0x3ce448[_0x5dd6('0x10')](0x1f4,_0x3bb729['message']));});});};function checkArrayOfIntervals(_0x128fa2,_0x30a44d){var _0x40aac5=[];return db['Interval'][_0x5dd6('0x18')]({'where':{'id':_0x128fa2}})[_0x5dd6('0xd')](function(_0x429bf7){_0x40aac5=_0x429bf7;return Promise['all'](_0x40aac5[_0x5dd6('0xb')](function(_0x58c31d){return _0x58c31d[_0x5dd6('0x19')](_0x30a44d);}));})[_0x5dd6('0xd')](function(_0xc70e5d){var _0x2d5684=_0xc70e5d['reduce'](function(_0x351032,_0x1f18ae){return _0x351032||_0x1f18ae;},![]);logger[_0x5dd6('0x16')](util[_0x5dd6('0x1a')]('IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)',_0x40aac5[_0x5dd6('0xb')](function(_0x174446){return _0x174446[_0x5dd6('0x1b')];})[_0x5dd6('0x1c')](',\x20'),_0x40aac5[_0x5dd6('0xb')](function(_0x32ab70){return _0x32ab70['id'];})[_0x5dd6('0x1c')](',\x20')));return _0x2d5684;});}function checkSingleInterval(_0x5b8c8d,_0x5f06ff){return db['Interval']['findById'](_0x5b8c8d)[_0x5dd6('0xd')](function(_0x214221){if(_0x214221){logger[_0x5dd6('0x16')](util[_0x5dd6('0x1a')]('IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)',_0x214221[_0x5dd6('0x1b')],_0x214221['id']));return _0x214221['ifTime'](_0x5f06ff);}});}exports[_0x5dd6('0x1d')]=function(_0x3dae23){var _0x463998=_0x3dae23[_0x5dd6('0x1e')];var _0x166b0e=Array['isArray'](_0x3dae23[_0x5dd6('0x1f')])?_0x3dae23[_0x5dd6('0x1f')]:typeof _0x3dae23[_0x5dd6('0x1f')]===_0x5dd6('0x20')?[_0x3dae23[_0x5dd6('0x1f')]]:[];var _0x527ccb=_0x3dae23['timezone']||undefined;var _0x17d912=![];if(_0x166b0e[_0x5dd6('0x21')]){logger['info'](util[_0x5dd6('0x1a')](_0x5dd6('0x22'),_0x166b0e[_0x5dd6('0x1c')](';\x20')));}if(_0x527ccb){logger[_0x5dd6('0x16')](util[_0x5dd6('0x1a')](_0x5dd6('0x23'),_0x527ccb));}logger[_0x5dd6('0xe')]('Iftime',_0x17d912);logger[_0x5dd6('0x24')](_0x5dd6('0x1d'),_0x3dae23);return Promise[_0x5dd6('0x25')]()['then'](function(){if(Array[_0x5dd6('0x26')](_0x463998)){return checkArrayOfIntervals(_0x463998,_0x527ccb);}else if(_0x463998){return checkSingleInterval(_0x463998,_0x527ccb);}})['then'](function(_0x3d2c01){var _0x323488=_0x166b0e[_0x5dd6('0x27')](function(_0x16341c,_0x5887f6){return _0x16341c||iftime(_0x5887f6,_0x527ccb);},![]);_0x17d912=_0x3d2c01||_0x323488;return _0x17d912;})[_0x5dd6('0xf')](function(_0x1aa149){logger[_0x5dd6('0x10')](_0x5dd6('0x1d'),_0x3dae23,_0x1aa149);throw this[_0x5dd6('0x10')](0x1f4,_0x1aa149[_0x5dd6('0x11')]);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 6e04826..a454004 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(_0x3217d3,_0xf66fcf){var _0x260f43=function(_0x2b4a34){while(--_0x2b4a34){_0x3217d3['push'](_0x3217d3['shift']());}};_0x260f43(++_0xf66fcf);}(_0x5f2f,0x73));var _0xf5f2=function(_0x205e67,_0x37bd87){_0x205e67=_0x205e67-0x0;var _0x2ffa15=_0x5f2f[_0x205e67];return _0x2ffa15;};'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 _0x5f2f=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller','post'];(function(_0x311b0c,_0x526166){var _0x4af3af=function(_0x30dbd3){while(--_0x30dbd3){_0x311b0c['push'](_0x311b0c['shift']());}};_0x4af3af(++_0x526166);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5b8816,_0x25e1cb){_0x5b8816=_0x5b8816-0x0;var _0x71d26e=_0x5f2f[_0x5b8816];return _0x71d26e;};'use strict';var express=require(_0xf5f2('0x0'));var router=express[_0xf5f2('0x1')]();var auth=require(_0xf5f2('0x2'));var controller=require(_0xf5f2('0x3'));router[_0xf5f2('0x4')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x6')]);module[_0xf5f2('0x7')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index a14a01e..a964b24 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 _0x24e8=['stringify','issuetype','Bug','fields','customfield_11500','email','customfield_11501','customfield_11502','customfield_11503','name','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','request','data','end','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','openIssue','send','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','summary','\x20from\x20'];(function(_0x216140,_0x216b43){var _0x4f8215=function(_0xd241bf){while(--_0xd241bf){_0x216140['push'](_0x216140['shift']());}};_0x4f8215(++_0x216b43);}(_0x24e8,0xa0));var _0x824e=function(_0x3a7e01,_0x51204c){_0x3a7e01=_0x3a7e01-0x0;var _0x5b8398=_0x24e8[_0x3a7e01];return _0x5b8398;};'use strict';var BPromise=require(_0x824e('0x0'));var https=require(_0x824e('0x1'));var logger=require(_0x824e('0x2'))(_0x824e('0x3'));var USERNAME=_0x824e('0x4');var PASSWORD=_0x824e('0x5');function openIssue(_0x55e9f3,_0x3056cd){var _0x2c7384={'fields':{'project':{'key':_0x55e9f3['key']||'MOTGUI'},'summary':(_0x55e9f3[_0x824e('0x6')]||'Report')+_0x824e('0x7')+_0x55e9f3['ip'],'description':_0x55e9f3['description']||JSON[_0x824e('0x8')](_0x55e9f3),'issuetype':{'name':_0x55e9f3[_0x824e('0x9')]||_0x824e('0xa')}}};_0x2c7384[_0x824e('0xb')][_0x824e('0xc')]=_0x55e9f3[_0x824e('0xd')];_0x2c7384['fields'][_0x824e('0xe')]=_0x55e9f3['oldToken'];_0x2c7384['fields'][_0x824e('0xf')]=_0x55e9f3['newToken'];_0x2c7384[_0x824e('0xb')][_0x824e('0x10')]=_0x55e9f3[_0x824e('0x11')];_0x2c7384[_0x824e('0xb')]['customfield_11504']=_0x55e9f3[_0x824e('0x12')];_0x2c7384[_0x824e('0xb')][_0x824e('0x13')]=_0x55e9f3['ip'];var _0x53533b={'host':_0x824e('0x14'),'port':0x1bb,'path':_0x824e('0x15'),'method':_0x824e('0x16'),'timeout':0x4e20,'headers':{'Content-Type':_0x824e('0x17'),'Authorization':_0x824e('0x18')+new Buffer(USERNAME+':'+PASSWORD)['toString']('base64')}};var _0x1c0420=JSON[_0x824e('0x8')](_0x2c7384);var _0x277d05=https[_0x824e('0x19')](_0x53533b,function(_0x159312){_0x159312['setEncoding']('utf8');var _0x144329='';_0x159312['on'](_0x824e('0x1a'),function(_0x2d6373){_0x144329+=_0x2d6373;});_0x159312['on'](_0x824e('0x1b'),function(){if(_0x3056cd){return _0x3056cd[_0x824e('0x1c')](_0x159312[_0x824e('0x1d')])[_0x824e('0x1e')](JSON[_0x824e('0x1f')](_0x144329));}});});_0x277d05['on'](_0x824e('0x20'),function(_0x32825d){if(_0x3056cd){return _0x3056cd['status'](0x1f4)[_0x824e('0x1e')]({'errors':[{'message':_0x824e('0x21'),'type':'api.jira'}]});}});_0x277d05['write'](_0x1c0420);_0x277d05['end']();}exports[_0x824e('0x22')]=openIssue;exports[_0x824e('0x23')]=function(_0x1d27ba,_0x2e7d9f){_0x1d27ba[_0x824e('0x24')]['ip']=_0x1d27ba[_0x824e('0x25')][_0x824e('0x26')]||_0x1d27ba[_0x824e('0x27')][_0x824e('0x28')]||_0x1d27ba['socket'][_0x824e('0x28')]||_0x1d27ba[_0x824e('0x27')][_0x824e('0x29')]['remoteAddress'];return openIssue(_0x1d27ba[_0x824e('0x24')],_0x2e7d9f);}; \ No newline at end of file +var _0xdac1=['json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','body','headers','connection','remoteAddress','socket','bluebird','https','api','support','3eAmWpBVP0','key','summary','Report','\x20from\x20','description','stringify','issuetype','Bug','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11502','customfield_11503','name','customfield_11504','reason','customfield_10102','application/json','Basic\x20','toString','request','setEncoding','data','end','status','statusCode','parse','error'];(function(_0x698e19,_0x37fd58){var _0x3db5bf=function(_0x73b6b0){while(--_0x73b6b0){_0x698e19['push'](_0x698e19['shift']());}};_0x3db5bf(++_0x37fd58);}(_0xdac1,0x67));var _0x1dac=function(_0x32c0ac,_0x1d8160){_0x32c0ac=_0x32c0ac-0x0;var _0x871cc1=_0xdac1[_0x32c0ac];return _0x871cc1;};'use strict';var BPromise=require(_0x1dac('0x0'));var https=require(_0x1dac('0x1'));var logger=require('../../config/logger')(_0x1dac('0x2'));var USERNAME=_0x1dac('0x3');var PASSWORD=_0x1dac('0x4');function openIssue(_0x22f2b0,_0x12083e){var _0x1b4850={'fields':{'project':{'key':_0x22f2b0[_0x1dac('0x5')]||'MOTGUI'},'summary':(_0x22f2b0[_0x1dac('0x6')]||_0x1dac('0x7'))+_0x1dac('0x8')+_0x22f2b0['ip'],'description':_0x22f2b0[_0x1dac('0x9')]||JSON[_0x1dac('0xa')](_0x22f2b0),'issuetype':{'name':_0x22f2b0[_0x1dac('0xb')]||_0x1dac('0xc')}}};_0x1b4850[_0x1dac('0xd')][_0x1dac('0xe')]=_0x22f2b0[_0x1dac('0xf')];_0x1b4850['fields'][_0x1dac('0x10')]=_0x22f2b0[_0x1dac('0x11')];_0x1b4850['fields'][_0x1dac('0x12')]=_0x22f2b0['newToken'];_0x1b4850[_0x1dac('0xd')][_0x1dac('0x13')]=_0x22f2b0[_0x1dac('0x14')];_0x1b4850[_0x1dac('0xd')][_0x1dac('0x15')]=_0x22f2b0[_0x1dac('0x16')];_0x1b4850[_0x1dac('0xd')][_0x1dac('0x17')]=_0x22f2b0['ip'];var _0x8509d9={'host':'track.xcallymotion.com','port':0x1bb,'path':'/rest/api/2/issue','method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0x1dac('0x18'),'Authorization':_0x1dac('0x19')+new Buffer(USERNAME+':'+PASSWORD)[_0x1dac('0x1a')]('base64')}};var _0x3cb453=JSON[_0x1dac('0xa')](_0x1b4850);var _0x5b8836=https[_0x1dac('0x1b')](_0x8509d9,function(_0x1e21d0){_0x1e21d0[_0x1dac('0x1c')]('utf8');var _0x5cdb21='';_0x1e21d0['on'](_0x1dac('0x1d'),function(_0x5acc38){_0x5cdb21+=_0x5acc38;});_0x1e21d0['on'](_0x1dac('0x1e'),function(){if(_0x12083e){return _0x12083e[_0x1dac('0x1f')](_0x1e21d0[_0x1dac('0x20')])['json'](JSON[_0x1dac('0x21')](_0x5cdb21));}});});_0x5b8836['on'](_0x1dac('0x22'),function(_0x2bd525){if(_0x12083e){return _0x12083e[_0x1dac('0x1f')](0x1f4)[_0x1dac('0x23')]({'errors':[{'message':_0x1dac('0x24'),'type':_0x1dac('0x25')}]});}});_0x5b8836[_0x1dac('0x26')](_0x3cb453);_0x5b8836[_0x1dac('0x1e')]();}exports[_0x1dac('0x27')]=openIssue;exports[_0x1dac('0x28')]=function(_0x1aa3b1,_0x3e1a87){_0x1aa3b1[_0x1dac('0x29')]['ip']=_0x1aa3b1[_0x1dac('0x2a')]['x-forwarded-for']||_0x1aa3b1[_0x1dac('0x2b')][_0x1dac('0x2c')]||_0x1aa3b1[_0x1dac('0x2d')]['remoteAddress']||_0x1aa3b1[_0x1dac('0x2b')][_0x1dac('0x2d')][_0x1dac('0x2c')];return openIssue(_0x1aa3b1['body'],_0x3e1a87);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 3bd7584..f72e06b 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 _0xcb91=['get','index','isAuthenticated','describe','/:id','post','create','put','update','delete','destroy','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller'];(function(_0xcd9444,_0x411ed8){var _0x55105e=function(_0x1632eb){while(--_0x1632eb){_0xcd9444['push'](_0xcd9444['shift']());}};_0x55105e(++_0x411ed8);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x15797a,_0x16274f){_0x15797a=_0x15797a-0x0;var _0x3e2618=_0xcb91[_0x15797a];return _0x3e2618;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');var controller=require(_0x1cb9('0x6'));router[_0x1cb9('0x7')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x7')]('/describe',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xa')]);router['get'](_0x1cb9('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1cb9('0xc')]('/',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xd')]);router[_0x1cb9('0xe')](_0x1cb9('0xb'),auth['isAuthenticated'](),controller[_0x1cb9('0xf')]);router[_0x1cb9('0x10')](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x11')]);module['exports']=router; \ No newline at end of file +var _0x4ea3=['multer','util','path','connect-timeout','Router','../../components/auth/service','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','/:id','post','update','destroy','exports'];(function(_0x4971ca,_0x2ae39a){var _0x10c18e=function(_0x469242){while(--_0x469242){_0x4971ca['push'](_0x4971ca['shift']());}};_0x10c18e(++_0x2ae39a);}(_0x4ea3,0x70));var _0x34ea=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x4ea3[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x34ea('0x0'));var util=require(_0x34ea('0x1'));var path=require(_0x34ea('0x2'));var timeout=require(_0x34ea('0x3'));var express=require('express');var router=express[_0x34ea('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x34ea('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x34ea('0x6'));router[_0x34ea('0x7')]('/',auth[_0x34ea('0x8')](),controller[_0x34ea('0x9')]);router[_0x34ea('0x7')](_0x34ea('0xa'),auth[_0x34ea('0x8')](),controller['describe']);router[_0x34ea('0x7')](_0x34ea('0xb'),auth[_0x34ea('0x8')](),controller['show']);router[_0x34ea('0xc')]('/',auth[_0x34ea('0x8')](),controller['create']);router['put'](_0x34ea('0xb'),auth[_0x34ea('0x8')](),controller[_0x34ea('0xd')]);router['delete'](_0x34ea('0xb'),auth[_0x34ea('0x8')](),controller[_0x34ea('0xe')]);module[_0x34ea('0xf')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 2203b68..560a618 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(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x7a54,0x106));var _0x47a5=function(_0x528ddb,_0xe4892f){_0x528ddb=_0x528ddb-0x0;var _0x22e4f9=_0x7a54[_0x528ddb];return _0x22e4f9;};'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(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x7a54,0x106));var _0x47a5=function(_0x30622e,_0x20ebcb){_0x30622e=_0x30622e-0x0;var _0x1d1079=_0x7a54[_0x30622e];return _0x1d1079;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index d2bbea7..6fd2342 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 _0xe14b=['rimraf','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','json','apply','save','update','then','error','stack','name','send','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','destroy','describe','eml-format'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xe14b,0x93));var _0xbe14=function(_0x513642,_0x909c7b){_0x513642=_0x513642-0x0;var _0x2b12aa=_0xe14b[_0x513642];return _0x2b12aa;};'use strict';var emlformat=require(_0xbe14('0x0'));var rimraf=require(_0xbe14('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbe14('0x2'));var moment=require(_0xbe14('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xbe14('0x4'));var util=require('util');var path=require('path');var sox=require(_0xbe14('0x5'));var csv=require(_0xbe14('0x6'));var ejs=require(_0xbe14('0x7'));var fs=require('fs');var fs_extra=require(_0xbe14('0x8'));var _=require(_0xbe14('0x9'));var squel=require(_0xbe14('0xa'));var crypto=require(_0xbe14('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbe14('0xc'));var Papa=require(_0xbe14('0xd'));var Redis=require(_0xbe14('0xe'));var authService=require(_0xbe14('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe14('0x10'));var logger=require(_0xbe14('0x11'))('api');var utils=require(_0xbe14('0x12'));var config=require(_0xbe14('0x13'));var licenseUtil=require(_0xbe14('0x14'));var db=require(_0xbe14('0x15'))['db'];function respondWithStatusCode(_0x27792f,_0x3b898d){_0x3b898d=_0x3b898d||0xcc;return function(_0x23a730){if(_0x23a730){return _0x27792f[_0xbe14('0x16')](_0x3b898d);}return _0x27792f[_0xbe14('0x17')](_0x3b898d)[_0xbe14('0x18')]();};}function respondWithResult(_0x1e4826,_0x33fd54){_0x33fd54=_0x33fd54||0xc8;return function(_0x813399){if(_0x813399){return _0x1e4826['status'](_0x33fd54)['json'](_0x813399);}};}function respondWithFilteredResult(_0x3f58f5,_0x3dc4a9){return function(_0xf4ac9){if(_0xf4ac9){var _0x37ce4e=typeof _0x3dc4a9['offset']===_0xbe14('0x19')&&typeof _0x3dc4a9[_0xbe14('0x1a')]===_0xbe14('0x19');var _0x123ede=_0xf4ac9[_0xbe14('0x1b')];var _0x29ab73=_0x37ce4e?0x0:_0x3dc4a9[_0xbe14('0x1c')];var _0x5ea1f8=_0x37ce4e?_0xf4ac9[_0xbe14('0x1b')]:_0x3dc4a9[_0xbe14('0x1c')]+_0x3dc4a9[_0xbe14('0x1a')];var _0x433459;if(_0x5ea1f8>=_0x123ede){_0x5ea1f8=_0x123ede;_0x433459=0xc8;}else{_0x433459=0xce;}_0x3f58f5[_0xbe14('0x17')](_0x433459);return _0x3f58f5[_0xbe14('0x1d')]('Content-Range',_0x29ab73+'-'+_0x5ea1f8+'/'+_0x123ede)[_0xbe14('0x1e')](_0xf4ac9);}return null;};}function patchUpdates(_0x4a1bbd){return function(_0x417c8d){try{jsonpatch[_0xbe14('0x1f')](_0x417c8d,_0x4a1bbd,!![]);}catch(_0x188ec4){return BPromise['reject'](_0x188ec4);}return _0x417c8d[_0xbe14('0x20')]();};}function saveUpdates(_0x56d845,_0x3c1c85){return function(_0x56e80c){if(_0x56e80c){return _0x56e80c[_0xbe14('0x21')](_0x56d845)['then'](function(_0x274018){return _0x274018;});}return null;};}function removeEntity(_0x3d3608,_0x505dbd){return function(_0x2da350){if(_0x2da350){return _0x2da350['destroy']()[_0xbe14('0x22')](function(){_0x3d3608['status'](0xcc)[_0xbe14('0x18')]();});}};}function handleEntityNotFound(_0x5fa043,_0x1ee9c1){return function(_0x39cc81){if(!_0x39cc81){_0x5fa043[_0xbe14('0x16')](0x194);}return _0x39cc81;};}function handleError(_0x2703f5,_0x55d001){_0x55d001=_0x55d001||0x1f4;return function(_0x1822e0){logger[_0xbe14('0x23')](_0x1822e0[_0xbe14('0x24')]);if(_0x1822e0[_0xbe14('0x25')]){delete _0x1822e0['name'];}_0x2703f5[_0xbe14('0x17')](_0x55d001)[_0xbe14('0x26')](_0x1822e0);};}exports['index']=function(_0x3c3613,_0x3b3e84){var _0x1c7cc7={},_0x19252f={},_0x34d648={'count':0x0,'rows':[]};var _0x36d4b2=_[_0xbe14('0x27')](db[_0xbe14('0x28')][_0xbe14('0x29')],function(_0x16a159){return{'name':_0x16a159[_0xbe14('0x2a')],'type':_0x16a159[_0xbe14('0x2b')][_0xbe14('0x2c')]};});_0x19252f[_0xbe14('0x2d')]=_[_0xbe14('0x27')](_0x36d4b2,_0xbe14('0x25'));_0x19252f[_0xbe14('0x2e')]=_[_0xbe14('0x2f')](_0x3c3613[_0xbe14('0x2e')]);_0x19252f[_0xbe14('0x30')]=_['intersection'](_0x19252f[_0xbe14('0x2d')],_0x19252f['query']);_0x1c7cc7['attributes']=_[_0xbe14('0x31')](_0x19252f['model'],qs[_0xbe14('0x32')](_0x3c3613[_0xbe14('0x2e')]['fields']));_0x1c7cc7['attributes']=_0x1c7cc7['attributes'][_0xbe14('0x33')]?_0x1c7cc7[_0xbe14('0x34')]:_0x19252f['model'];if(!_0x3c3613[_0xbe14('0x2e')][_0xbe14('0x35')](_0xbe14('0x36'))){_0x1c7cc7[_0xbe14('0x1a')]=qs[_0xbe14('0x1a')](_0x3c3613['query']['limit']);_0x1c7cc7[_0xbe14('0x1c')]=qs['offset'](_0x3c3613['query']['offset']);}_0x1c7cc7[_0xbe14('0x37')]=qs[_0xbe14('0x38')](_0x3c3613[_0xbe14('0x2e')][_0xbe14('0x38')]);_0x1c7cc7[_0xbe14('0x39')]=qs[_0xbe14('0x30')](_[_0xbe14('0x3a')](_0x3c3613[_0xbe14('0x2e')],_0x19252f[_0xbe14('0x30')]),_0x36d4b2);if(_0x3c3613[_0xbe14('0x2e')][_0xbe14('0x3b')]){_0x1c7cc7[_0xbe14('0x39')]=_['merge'](_0x1c7cc7['where'],{'$or':_[_0xbe14('0x27')](_0x36d4b2,function(_0x2951e1){if(_0x2951e1[_0xbe14('0x2b')]!=='VIRTUAL'){var _0x326329={};_0x326329[_0x2951e1[_0xbe14('0x25')]]={'$like':'%'+_0x3c3613[_0xbe14('0x2e')][_0xbe14('0x3b')]+'%'};return _0x326329;}})});}_0x1c7cc7=_[_0xbe14('0x3c')]({},_0x1c7cc7,_0x3c3613[_0xbe14('0x3d')]);var _0x19fa30={'where':_0x1c7cc7[_0xbe14('0x39')]};return db[_0xbe14('0x28')]['count'](_0x19fa30)[_0xbe14('0x22')](function(_0x841b71){_0x34d648[_0xbe14('0x1b')]=_0x841b71;if(_0x3c3613[_0xbe14('0x2e')][_0xbe14('0x3e')]){_0x1c7cc7[_0xbe14('0x3f')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xbe14('0x40')](_0x1c7cc7);})[_0xbe14('0x22')](function(_0x1220c9){_0x34d648[_0xbe14('0x41')]=_0x1220c9;return _0x34d648;})['then'](respondWithFilteredResult(_0x3b3e84,_0x1c7cc7))['catch'](handleError(_0x3b3e84,null));};exports[_0xbe14('0x42')]=function(_0xe417b,_0x3272ae){var _0x51c859={'raw':!![],'where':{'id':_0xe417b[_0xbe14('0x43')]['id']}},_0x5d5318={};_0x5d5318['model']=_['keys'](db[_0xbe14('0x28')][_0xbe14('0x29')]);_0x5d5318[_0xbe14('0x2e')]=_['keys'](_0xe417b['query']);_0x5d5318['filters']=_[_0xbe14('0x31')](_0x5d5318[_0xbe14('0x2d')],_0x5d5318[_0xbe14('0x2e')]);_0x51c859['attributes']=_[_0xbe14('0x31')](_0x5d5318[_0xbe14('0x2d')],qs[_0xbe14('0x32')](_0xe417b[_0xbe14('0x2e')]['fields']));_0x51c859['attributes']=_0x51c859[_0xbe14('0x34')][_0xbe14('0x33')]?_0x51c859[_0xbe14('0x34')]:_0x5d5318[_0xbe14('0x2d')];if(_0xe417b[_0xbe14('0x2e')]['includeAll']){_0x51c859['include']=[{'all':!![]}];}_0x51c859=_[_0xbe14('0x3c')]({},_0x51c859,_0xe417b[_0xbe14('0x3d')]);return db[_0xbe14('0x28')][_0xbe14('0x44')](_0x51c859)['then'](handleEntityNotFound(_0x3272ae,null))[_0xbe14('0x22')](respondWithResult(_0x3272ae,null))[_0xbe14('0x45')](handleError(_0x3272ae,null));};exports['create']=function(_0x396e40,_0x2a35e5){return db[_0xbe14('0x28')][_0xbe14('0x46')](_0x396e40['body'],{})['then'](respondWithResult(_0x2a35e5,0xc9))[_0xbe14('0x45')](handleError(_0x2a35e5,null));};exports[_0xbe14('0x21')]=function(_0x4a1a37,_0x5acf90){if(_0x4a1a37[_0xbe14('0x47')]['id']){delete _0x4a1a37[_0xbe14('0x47')]['id'];}return db[_0xbe14('0x28')][_0xbe14('0x44')]({'where':{'id':_0x4a1a37[_0xbe14('0x43')]['id']}})[_0xbe14('0x22')](handleEntityNotFound(_0x5acf90,null))[_0xbe14('0x22')](saveUpdates(_0x4a1a37['body'],null))[_0xbe14('0x22')](respondWithResult(_0x5acf90,null))[_0xbe14('0x45')](handleError(_0x5acf90,null));};exports[_0xbe14('0x48')]=function(_0x22b1f8,_0x2fc073){return db['JscriptyAnswerReport'][_0xbe14('0x44')]({'where':{'id':_0x22b1f8[_0xbe14('0x43')]['id']}})[_0xbe14('0x22')](handleEntityNotFound(_0x2fc073,null))[_0xbe14('0x22')](removeEntity(_0x2fc073,null))[_0xbe14('0x45')](handleError(_0x2fc073,null));};exports[_0xbe14('0x49')]=function(_0x505829,_0x5aeea9){return db[_0xbe14('0x28')][_0xbe14('0x49')]()[_0xbe14('0x22')](respondWithResult(_0x5aeea9,null))['catch'](handleError(_0x5aeea9,null));}; \ No newline at end of file +var _0xaa5c=['ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','apply','reject','save','update','destroy','then','error','stack','name','send','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','include','options','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','util','to-csv'];(function(_0x322522,_0x4db288){var _0x293bcf=function(_0xf108b8){while(--_0xf108b8){_0x322522['push'](_0x322522['shift']());}};_0x293bcf(++_0x4db288);}(_0xaa5c,0x1f2));var _0xcaa5=function(_0x2e0a78,_0x413dd2){_0x2e0a78=_0x2e0a78-0x0;var _0x93e65c=_0xaa5c[_0x2e0a78];return _0x93e65c;};'use strict';var emlformat=require(_0xcaa5('0x0'));var rimraf=require(_0xcaa5('0x1'));var zipdir=require(_0xcaa5('0x2'));var jsonpatch=require(_0xcaa5('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xcaa5('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xcaa5('0x5'));var ejs=require(_0xcaa5('0x6'));var fs=require('fs');var fs_extra=require(_0xcaa5('0x7'));var _=require('lodash');var squel=require(_0xcaa5('0x8'));var crypto=require(_0xcaa5('0x9'));var jsforce=require(_0xcaa5('0xa'));var deskjs=require(_0xcaa5('0xb'));var toCsv=require('to-csv');var querystring=require(_0xcaa5('0xc'));var Papa=require(_0xcaa5('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xcaa5('0xe'));var as=require(_0xcaa5('0xf'));var hardwareService=require(_0xcaa5('0x10'));var logger=require('../../config/logger')(_0xcaa5('0x11'));var utils=require('../../config/utils');var config=require(_0xcaa5('0x12'));var licenseUtil=require(_0xcaa5('0x13'));var db=require(_0xcaa5('0x14'))['db'];function respondWithStatusCode(_0x3b8783,_0x16bb6d){_0x16bb6d=_0x16bb6d||0xcc;return function(_0xbf4c57){if(_0xbf4c57){return _0x3b8783[_0xcaa5('0x15')](_0x16bb6d);}return _0x3b8783['status'](_0x16bb6d)[_0xcaa5('0x16')]();};}function respondWithResult(_0x240651,_0x474770){_0x474770=_0x474770||0xc8;return function(_0x295c9f){if(_0x295c9f){return _0x240651[_0xcaa5('0x17')](_0x474770)[_0xcaa5('0x18')](_0x295c9f);}};}function respondWithFilteredResult(_0x3e1c8e,_0xa2c6b6){return function(_0x8b7ad5){if(_0x8b7ad5){var _0x53e67f=typeof _0xa2c6b6[_0xcaa5('0x19')]==='undefined'&&typeof _0xa2c6b6[_0xcaa5('0x1a')]===_0xcaa5('0x1b');var _0x5ac8e5=_0x8b7ad5[_0xcaa5('0x1c')];var _0x2dae23=_0x53e67f?0x0:_0xa2c6b6[_0xcaa5('0x19')];var _0x7dad0b=_0x53e67f?_0x8b7ad5[_0xcaa5('0x1c')]:_0xa2c6b6['offset']+_0xa2c6b6[_0xcaa5('0x1a')];var _0x4470c1;if(_0x7dad0b>=_0x5ac8e5){_0x7dad0b=_0x5ac8e5;_0x4470c1=0xc8;}else{_0x4470c1=0xce;}_0x3e1c8e[_0xcaa5('0x17')](_0x4470c1);return _0x3e1c8e[_0xcaa5('0x1d')]('Content-Range',_0x2dae23+'-'+_0x7dad0b+'/'+_0x5ac8e5)[_0xcaa5('0x18')](_0x8b7ad5);}return null;};}function patchUpdates(_0x581ff8){return function(_0x93f6d4){try{jsonpatch[_0xcaa5('0x1e')](_0x93f6d4,_0x581ff8,!![]);}catch(_0xeca790){return BPromise[_0xcaa5('0x1f')](_0xeca790);}return _0x93f6d4[_0xcaa5('0x20')]();};}function saveUpdates(_0x52ca18,_0x48b8ee){return function(_0x51be62){if(_0x51be62){return _0x51be62[_0xcaa5('0x21')](_0x52ca18)['then'](function(_0x1ba266){return _0x1ba266;});}return null;};}function removeEntity(_0x5075ac,_0x39fb88){return function(_0x554027){if(_0x554027){return _0x554027[_0xcaa5('0x22')]()[_0xcaa5('0x23')](function(){_0x5075ac[_0xcaa5('0x17')](0xcc)[_0xcaa5('0x16')]();});}};}function handleEntityNotFound(_0x5c7693,_0xe4ae3b){return function(_0x51f0f0){if(!_0x51f0f0){_0x5c7693[_0xcaa5('0x15')](0x194);}return _0x51f0f0;};}function handleError(_0x57e076,_0x3b3c71){_0x3b3c71=_0x3b3c71||0x1f4;return function(_0x37d922){logger[_0xcaa5('0x24')](_0x37d922[_0xcaa5('0x25')]);if(_0x37d922[_0xcaa5('0x26')]){delete _0x37d922[_0xcaa5('0x26')];}_0x57e076[_0xcaa5('0x17')](_0x3b3c71)[_0xcaa5('0x27')](_0x37d922);};}exports['index']=function(_0x4c356d,_0x2f1420){var _0x3edb25={},_0x2d58f9={},_0x5c49fd={'count':0x0,'rows':[]};var _0x56db73=_[_0xcaa5('0x28')](db[_0xcaa5('0x29')][_0xcaa5('0x2a')],function(_0xe549d7){return{'name':_0xe549d7[_0xcaa5('0x2b')],'type':_0xe549d7[_0xcaa5('0x2c')][_0xcaa5('0x2d')]};});_0x2d58f9[_0xcaa5('0x2e')]=_[_0xcaa5('0x28')](_0x56db73,'name');_0x2d58f9[_0xcaa5('0x2f')]=_[_0xcaa5('0x30')](_0x4c356d[_0xcaa5('0x2f')]);_0x2d58f9[_0xcaa5('0x31')]=_['intersection'](_0x2d58f9[_0xcaa5('0x2e')],_0x2d58f9['query']);_0x3edb25[_0xcaa5('0x32')]=_[_0xcaa5('0x33')](_0x2d58f9[_0xcaa5('0x2e')],qs['fields'](_0x4c356d[_0xcaa5('0x2f')][_0xcaa5('0x34')]));_0x3edb25[_0xcaa5('0x32')]=_0x3edb25[_0xcaa5('0x32')]['length']?_0x3edb25[_0xcaa5('0x32')]:_0x2d58f9[_0xcaa5('0x2e')];if(!_0x4c356d[_0xcaa5('0x2f')][_0xcaa5('0x35')](_0xcaa5('0x36'))){_0x3edb25['limit']=qs['limit'](_0x4c356d[_0xcaa5('0x2f')][_0xcaa5('0x1a')]);_0x3edb25[_0xcaa5('0x19')]=qs['offset'](_0x4c356d[_0xcaa5('0x2f')]['offset']);}_0x3edb25[_0xcaa5('0x37')]=qs[_0xcaa5('0x38')](_0x4c356d['query'][_0xcaa5('0x38')]);_0x3edb25[_0xcaa5('0x39')]=qs[_0xcaa5('0x31')](_[_0xcaa5('0x3a')](_0x4c356d['query'],_0x2d58f9[_0xcaa5('0x31')]),_0x56db73);if(_0x4c356d[_0xcaa5('0x2f')][_0xcaa5('0x3b')]){_0x3edb25[_0xcaa5('0x39')]=_[_0xcaa5('0x3c')](_0x3edb25[_0xcaa5('0x39')],{'$or':_[_0xcaa5('0x28')](_0x56db73,function(_0x32b556){if(_0x32b556['type']!==_0xcaa5('0x3d')){var _0x3c024b={};_0x3c024b[_0x32b556[_0xcaa5('0x26')]]={'$like':'%'+_0x4c356d[_0xcaa5('0x2f')]['filter']+'%'};return _0x3c024b;}})});}_0x3edb25=_[_0xcaa5('0x3c')]({},_0x3edb25,_0x4c356d['options']);var _0x1fd607={'where':_0x3edb25[_0xcaa5('0x39')]};return db['JscriptyAnswerReport'][_0xcaa5('0x1c')](_0x1fd607)[_0xcaa5('0x23')](function(_0x130c90){_0x5c49fd[_0xcaa5('0x1c')]=_0x130c90;if(_0x4c356d[_0xcaa5('0x2f')][_0xcaa5('0x3e')]){_0x3edb25['include']=[{'all':!![]}];}return db[_0xcaa5('0x29')][_0xcaa5('0x3f')](_0x3edb25);})[_0xcaa5('0x23')](function(_0x3e9b40){_0x5c49fd[_0xcaa5('0x40')]=_0x3e9b40;return _0x5c49fd;})[_0xcaa5('0x23')](respondWithFilteredResult(_0x2f1420,_0x3edb25))[_0xcaa5('0x41')](handleError(_0x2f1420,null));};exports[_0xcaa5('0x42')]=function(_0x12ea07,_0x22313c){var _0x29f93a={'raw':!![],'where':{'id':_0x12ea07[_0xcaa5('0x43')]['id']}},_0x81887c={};_0x81887c[_0xcaa5('0x2e')]=_['keys'](db[_0xcaa5('0x29')]['rawAttributes']);_0x81887c[_0xcaa5('0x2f')]=_[_0xcaa5('0x30')](_0x12ea07[_0xcaa5('0x2f')]);_0x81887c[_0xcaa5('0x31')]=_['intersection'](_0x81887c[_0xcaa5('0x2e')],_0x81887c[_0xcaa5('0x2f')]);_0x29f93a[_0xcaa5('0x32')]=_[_0xcaa5('0x33')](_0x81887c[_0xcaa5('0x2e')],qs[_0xcaa5('0x34')](_0x12ea07[_0xcaa5('0x2f')][_0xcaa5('0x34')]));_0x29f93a['attributes']=_0x29f93a[_0xcaa5('0x32')]['length']?_0x29f93a[_0xcaa5('0x32')]:_0x81887c[_0xcaa5('0x2e')];if(_0x12ea07[_0xcaa5('0x2f')][_0xcaa5('0x3e')]){_0x29f93a[_0xcaa5('0x44')]=[{'all':!![]}];}_0x29f93a=_[_0xcaa5('0x3c')]({},_0x29f93a,_0x12ea07[_0xcaa5('0x45')]);return db[_0xcaa5('0x29')]['find'](_0x29f93a)[_0xcaa5('0x23')](handleEntityNotFound(_0x22313c,null))[_0xcaa5('0x23')](respondWithResult(_0x22313c,null))[_0xcaa5('0x41')](handleError(_0x22313c,null));};exports['create']=function(_0x2ab2a1,_0x2424f6){return db[_0xcaa5('0x29')]['create'](_0x2ab2a1[_0xcaa5('0x46')],{})[_0xcaa5('0x23')](respondWithResult(_0x2424f6,0xc9))[_0xcaa5('0x41')](handleError(_0x2424f6,null));};exports[_0xcaa5('0x21')]=function(_0x2fcb89,_0x9ccb2f){if(_0x2fcb89[_0xcaa5('0x46')]['id']){delete _0x2fcb89['body']['id'];}return db[_0xcaa5('0x29')]['find']({'where':{'id':_0x2fcb89[_0xcaa5('0x43')]['id']}})['then'](handleEntityNotFound(_0x9ccb2f,null))[_0xcaa5('0x23')](saveUpdates(_0x2fcb89[_0xcaa5('0x46')],null))[_0xcaa5('0x23')](respondWithResult(_0x9ccb2f,null))[_0xcaa5('0x41')](handleError(_0x9ccb2f,null));};exports[_0xcaa5('0x22')]=function(_0x42263b,_0x1ddd15){return db[_0xcaa5('0x29')]['find']({'where':{'id':_0x42263b[_0xcaa5('0x43')]['id']}})[_0xcaa5('0x23')](handleEntityNotFound(_0x1ddd15,null))[_0xcaa5('0x23')](removeEntity(_0x1ddd15,null))[_0xcaa5('0x41')](handleError(_0x1ddd15,null));};exports[_0xcaa5('0x47')]=function(_0x44f35e,_0x2c6aae){return db[_0xcaa5('0x29')]['describe']()[_0xcaa5('0x23')](respondWithResult(_0x2c6aae,null))[_0xcaa5('0x41')](handleError(_0x2c6aae,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 7568a1d..be222f3 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 _0x29fe=['../../config/environment','./jscriptyAnswerReport.attributes','define','JscriptyAnswerReport','report_jscripty_answers','util','moment','rimraf'];(function(_0x49f8c2,_0x5166b7){var _0x3e63ec=function(_0x575c26){while(--_0x575c26){_0x49f8c2['push'](_0x49f8c2['shift']());}};_0x3e63ec(++_0x5166b7);}(_0x29fe,0x1bd));var _0xe29f=function(_0x57cf62,_0x3dbbef){_0x57cf62=_0x57cf62-0x0;var _0x1b8f4e=_0x29fe[_0x57cf62];return _0x1b8f4e;};'use strict';var _=require('lodash');var util=require(_0xe29f('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xe29f('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe29f('0x2'));var config=require(_0xe29f('0x3'));var attributes=require(_0xe29f('0x4'));module['exports']=function(_0x2b8b82,_0x591655){return _0x2b8b82[_0xe29f('0x5')](_0xe29f('0x6'),attributes,{'tableName':_0xe29f('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xec22=['api','moment','bluebird','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','util','../../config/logger'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0xec22,0x1de));var _0x2ec2=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xec22[_0x46e363];return _0x3fb059;};'use strict';var _=require('lodash');var util=require(_0x2ec2('0x0'));var logger=require(_0x2ec2('0x1'))(_0x2ec2('0x2'));var moment=require(_0x2ec2('0x3'));var BPromise=require(_0x2ec2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2ec2('0x5'));var rimraf=require(_0x2ec2('0x6'));var config=require(_0x2ec2('0x7'));var attributes=require(_0x2ec2('0x8'));module[_0x2ec2('0x9')]=function(_0x54737b,_0xf3e138){return _0x54737b[_0x2ec2('0xa')](_0x2ec2('0xb'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index 8c54114..2ba7458 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 _0x6fe2=['result','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x35e124,_0x1d85e2){var _0x53c482=function(_0x5afd39){while(--_0x5afd39){_0x35e124['push'](_0x35e124['shift']());}};_0x53c482(++_0x1d85e2);}(_0x6fe2,0x1cf));var _0x26fe=function(_0x15c0ea,_0x4acfaa){_0x15c0ea=_0x15c0ea-0x0;var _0x306627=_0x6fe2[_0x15c0ea];return _0x306627;};'use strict';var _=require(_0x26fe('0x0'));var util=require(_0x26fe('0x1'));var moment=require(_0x26fe('0x2'));var BPromise=require('bluebird');var rs=require(_0x26fe('0x3'));var fs=require('fs');var Redis=require(_0x26fe('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x26fe('0x5'));var logger=require(_0x26fe('0x6'))(_0x26fe('0x7'));var config=require(_0x26fe('0x8'));var jayson=require(_0x26fe('0x9'));var client=jayson['client'][_0x26fe('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x422423,_0x56f7e9,_0xdd4420){return new BPromise(function(_0x4b07f,_0x2a914b){return client['request'](_0x422423,_0xdd4420)[_0x26fe('0xb')](function(_0x2dc781){logger[_0x26fe('0xc')](_0x26fe('0xd'),_0x56f7e9,_0x26fe('0xe'));logger[_0x26fe('0xf')](_0x26fe('0x10'),_0x56f7e9,_0x26fe('0xe'),JSON[_0x26fe('0x11')](_0x2dc781));if(_0x2dc781[_0x26fe('0x12')]){if(_0x2dc781[_0x26fe('0x12')][_0x26fe('0x13')]===0x1f4){logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x56f7e9,_0x2dc781[_0x26fe('0x12')][_0x26fe('0x14')]);return _0x2a914b(_0x2dc781[_0x26fe('0x12')][_0x26fe('0x14')]);}logger[_0x26fe('0x12')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x56f7e9,_0x2dc781['error'][_0x26fe('0x14')]);return _0x4b07f(_0x2dc781['error']['message']);}else{logger[_0x26fe('0xc')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x56f7e9,_0x26fe('0xe'));_0x4b07f(_0x2dc781[_0x26fe('0x15')][_0x26fe('0x14')]);}})['catch'](function(_0x9f7038){logger[_0x26fe('0x12')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x56f7e9,_0x9f7038);_0x2a914b(_0x9f7038);});});} \ No newline at end of file +var _0x7013=['code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','info','JscriptyAnswerReport,\x20%s,\x20%s','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x3d7925,_0x320817){var _0x22faa1=function(_0xd524dc){while(--_0xd524dc){_0x3d7925['push'](_0x3d7925['shift']());}};_0x22faa1(++_0x320817);}(_0x7013,0xbb));var _0x3701=function(_0x1afe27,_0x460e8b){_0x1afe27=_0x1afe27-0x0;var _0x1dbe0b=_0x7013[_0x1afe27];return _0x1dbe0b;};'use strict';var _=require(_0x3701('0x0'));var util=require(_0x3701('0x1'));var moment=require(_0x3701('0x2'));var BPromise=require(_0x3701('0x3'));var rs=require(_0x3701('0x4'));var fs=require('fs');var Redis=require(_0x3701('0x5'));var db=require(_0x3701('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3701('0x7'))(_0x3701('0x8'));var config=require(_0x3701('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3701('0xa')][_0x3701('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4ba18e,_0x4cd173,_0x409294){return new BPromise(function(_0xaad1ec,_0x461790){return client['request'](_0x4ba18e,_0x409294)[_0x3701('0xc')](function(_0x2c1197){logger[_0x3701('0xd')](_0x3701('0xe'),_0x4cd173,'request\x20sent');logger[_0x3701('0xf')](_0x3701('0x10'),_0x4cd173,_0x3701('0x11'),JSON[_0x3701('0x12')](_0x2c1197));if(_0x2c1197[_0x3701('0x13')]){if(_0x2c1197[_0x3701('0x13')][_0x3701('0x14')]===0x1f4){logger[_0x3701('0x13')](_0x3701('0xe'),_0x4cd173,_0x2c1197[_0x3701('0x13')]['message']);return _0x461790(_0x2c1197[_0x3701('0x13')][_0x3701('0x15')]);}logger[_0x3701('0x13')](_0x3701('0xe'),_0x4cd173,_0x2c1197['error'][_0x3701('0x15')]);return _0xaad1ec(_0x2c1197['error'][_0x3701('0x15')]);}else{logger[_0x3701('0xd')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x4cd173,_0x3701('0x11'));_0xaad1ec(_0x2c1197['result'][_0x3701('0x15')]);}})[_0x3701('0x16')](function(_0x1fd018){logger[_0x3701('0x13')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x4cd173,_0x1fd018);_0x461790(_0x1fd018);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 153a004..0848123 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 _0x3f66=['isAuthenticated','/:id','show','/:id/sessions','/:id/answers','/:id/summary','getSummary','post','/:id/clone','clone','put','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../config/environment','./jscriptyProject.controller','get'];(function(_0x41fb20,_0x489030){var _0x5bd281=function(_0x34b068){while(--_0x34b068){_0x41fb20['push'](_0x41fb20['shift']());}};_0x5bd281(++_0x489030);}(_0x3f66,0xb0));var _0x63f6=function(_0x57855a,_0x147826){_0x57855a=_0x57855a-0x0;var _0x32dca3=_0x3f66[_0x57855a];return _0x32dca3;};'use strict';var multer=require(_0x63f6('0x0'));var util=require(_0x63f6('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x63f6('0x2'));var router=express[_0x63f6('0x3')]();var fs_extra=require(_0x63f6('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x63f6('0x5'));var controller=require(_0x63f6('0x6'));router[_0x63f6('0x7')]('/',auth[_0x63f6('0x8')](),controller['index']);router[_0x63f6('0x7')](_0x63f6('0x9'),auth[_0x63f6('0x8')](),controller[_0x63f6('0xa')]);router[_0x63f6('0x7')](_0x63f6('0xb'),auth[_0x63f6('0x8')](),controller['getSessions']);router[_0x63f6('0x7')](_0x63f6('0xc'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x63f6('0x7')](_0x63f6('0xd'),auth[_0x63f6('0x8')](),timeout('30s'),controller[_0x63f6('0xe')]);router[_0x63f6('0xf')]('/',auth[_0x63f6('0x8')](),controller['create']);router[_0x63f6('0xf')](_0x63f6('0x10'),auth['isAuthenticated'](),controller[_0x63f6('0x11')]);router[_0x63f6('0x12')](_0x63f6('0x9'),auth[_0x63f6('0x8')](),controller[_0x63f6('0x13')]);router[_0x63f6('0x14')](_0x63f6('0x9'),auth[_0x63f6('0x8')](),controller[_0x63f6('0x15')]);module[_0x63f6('0x16')]=router; \ No newline at end of file +var _0x1cfa=['exports','multer','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','isAuthenticated','get','/:id','show','getSessions','/:id/answers','/:id/summary','post','/:id/clone','clone','put','update','delete'];(function(_0x5931a9,_0x5aaf34){var _0x104a93=function(_0x24bfa8){while(--_0x24bfa8){_0x5931a9['push'](_0x5931a9['shift']());}};_0x104a93(++_0x5aaf34);}(_0x1cfa,0x94));var _0xa1cf=function(_0x5dc6a4,_0x37e256){_0x5dc6a4=_0x5dc6a4-0x0;var _0x134f70=_0x1cfa[_0x5dc6a4];return _0x134f70;};'use strict';var multer=require(_0xa1cf('0x0'));var util=require('util');var path=require(_0xa1cf('0x1'));var timeout=require(_0xa1cf('0x2'));var express=require('express');var router=express[_0xa1cf('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa1cf('0x4'));var config=require(_0xa1cf('0x5'));var controller=require(_0xa1cf('0x6'));router['get']('/',auth[_0xa1cf('0x7')](),controller['index']);router[_0xa1cf('0x8')](_0xa1cf('0x9'),auth[_0xa1cf('0x7')](),controller[_0xa1cf('0xa')]);router['get']('/:id/sessions',auth['isAuthenticated'](),controller[_0xa1cf('0xb')]);router['get'](_0xa1cf('0xc'),auth[_0xa1cf('0x7')](),controller['getAnswers']);router[_0xa1cf('0x8')](_0xa1cf('0xd'),auth[_0xa1cf('0x7')](),timeout('30s'),controller['getSummary']);router[_0xa1cf('0xe')]('/',auth[_0xa1cf('0x7')](),controller['create']);router[_0xa1cf('0xe')](_0xa1cf('0xf'),auth['isAuthenticated'](),controller[_0xa1cf('0x10')]);router[_0xa1cf('0x11')](_0xa1cf('0x9'),auth[_0xa1cf('0x7')](),controller[_0xa1cf('0x12')]);router[_0xa1cf('0x13')](_0xa1cf('0x9'),auth[_0xa1cf('0x7')](),controller['destroy']);module[_0xa1cf('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index a0257d2..3849ea1 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 _0x1d4b=['STRING','name','TEXT','isObjectLike','setDataValue','formData','stringify','format','getDataValue','description','BOOLEAN','sequelize','util','exports'];(function(_0xb646a0,_0x229a9b){var _0x41bf90=function(_0xbb61a4){while(--_0xbb61a4){_0xb646a0['push'](_0xb646a0['shift']());}};_0x41bf90(++_0x229a9b);}(_0x1d4b,0x13f));var _0xb1d4=function(_0x2cd8a4,_0x51fb40){_0x2cd8a4=_0x2cd8a4-0x0;var _0x375630=_0x1d4b[_0x2cd8a4];return _0x375630;};'use strict';var Sequelize=require(_0xb1d4('0x0'));var _=require('lodash');var util=require(_0xb1d4('0x1'));module[_0xb1d4('0x2')]={'name':{'type':Sequelize[_0xb1d4('0x3')],'unique':_0xb1d4('0x4')},'description':{'type':Sequelize[_0xb1d4('0x3')]},'formData':{'type':Sequelize[_0xb1d4('0x5')]('long'),'set':function(_0x5b37c9){if(_[_0xb1d4('0x6')](_0x5b37c9)){this[_0xb1d4('0x7')](_0xb1d4('0x8'),JSON[_0xb1d4('0x9')](_0x5b37c9));}else if(_['isString'](_0x5b37c9)){this['setDataValue'](_0xb1d4('0x8'),_0x5b37c9);}else{this[_0xb1d4('0x7')](_0xb1d4('0x8'),util[_0xb1d4('0xa')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0xb1d4('0xb')](_0xb1d4('0x4'))||'',this[_0xb1d4('0xb')](_0xb1d4('0xc'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xb1d4('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xb1d4('0xd')],'defaultValue':![]}}; \ No newline at end of file +var _0xafe9=['isObjectLike','setDataValue','stringify','formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','lodash','exports','STRING','name','TEXT'];(function(_0x302ce3,_0x1a3cfb){var _0x10bdbc=function(_0x5598a8){while(--_0x5598a8){_0x302ce3['push'](_0x302ce3['shift']());}};_0x10bdbc(++_0x1a3cfb);}(_0xafe9,0xaf));var _0x9afe=function(_0x5f125e,_0x28bb1f){_0x5f125e=_0x5f125e-0x0;var _0x2681ce=_0xafe9[_0x5f125e];return _0x2681ce;};'use strict';var Sequelize=require('sequelize');var _=require(_0x9afe('0x0'));var util=require('util');module[_0x9afe('0x1')]={'name':{'type':Sequelize[_0x9afe('0x2')],'unique':_0x9afe('0x3')},'description':{'type':Sequelize[_0x9afe('0x2')]},'formData':{'type':Sequelize[_0x9afe('0x4')]('long'),'set':function(_0x232a5c){if(_[_0x9afe('0x5')](_0x232a5c)){this[_0x9afe('0x6')]('formData',JSON[_0x9afe('0x7')](_0x232a5c));}else if(_['isString'](_0x232a5c)){this['setDataValue'](_0x9afe('0x8'),_0x232a5c);}else{this[_0x9afe('0x6')]('formData',util[_0x9afe('0x9')](_0x9afe('0xa'),this['getDataValue'](_0x9afe('0x3'))||'',this[_0x9afe('0xb')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index da880b1..7b0f6e8 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 _0x91c5=['intersection','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','JscriptyProject','includeAll','findAll','rows','show','params','rawAttributes','include','options','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','createdAt','updatedAt','omit','getSessions','JscriptySessionReport','pick','ProjectId','findOne','JscriptyAnswerReport','hasOwnProperty','fromCharCode','toString','indexOf','replace','getSummary','starttime','parse','startTime','JscriptyQuestionReport','questionId','question','format','SessionId','push','now','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','text/csv','download','rimraf','request-promise','path','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','then','destroy','get','Projects','sendStatus','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','attributes'];(function(_0x9a7e5c,_0x57549f){var _0x4bb7fc=function(_0x2ae32b){while(--_0x2ae32b){_0x9a7e5c['push'](_0x9a7e5c['shift']());}};_0x4bb7fc(++_0x57549f);}(_0x91c5,0x124));var _0x591c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x91c5[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x591c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x591c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x591c('0x2'));var sox=require(_0x591c('0x3'));var csv=require('to-csv');var ejs=require(_0x591c('0x4'));var fs=require('fs');var fs_extra=require(_0x591c('0x5'));var _=require('lodash');var squel=require(_0x591c('0x6'));var crypto=require('crypto');var jsforce=require(_0x591c('0x7'));var deskjs=require(_0x591c('0x8'));var toCsv=require(_0x591c('0x9'));var querystring=require(_0x591c('0xa'));var Papa=require(_0x591c('0xb'));var Redis=require(_0x591c('0xc'));var authService=require(_0x591c('0xd'));var qs=require(_0x591c('0xe'));var as=require(_0x591c('0xf'));var hardwareService=require(_0x591c('0x10'));var logger=require(_0x591c('0x11'))(_0x591c('0x12'));var utils=require(_0x591c('0x13'));var config=require(_0x591c('0x14'));var licenseUtil=require(_0x591c('0x15'));var db=require(_0x591c('0x16'))['db'];function respondWithStatusCode(_0x548f0e,_0x1e8e1b){_0x1e8e1b=_0x1e8e1b||0xcc;return function(_0x32446f){if(_0x32446f){return _0x548f0e['sendStatus'](_0x1e8e1b);}return _0x548f0e[_0x591c('0x17')](_0x1e8e1b)[_0x591c('0x18')]();};}function respondWithResult(_0x39d254,_0x3284a2){_0x3284a2=_0x3284a2||0xc8;return function(_0x455ade){if(_0x455ade){return _0x39d254[_0x591c('0x17')](_0x3284a2)[_0x591c('0x19')](_0x455ade);}};}function respondWithFilteredResult(_0x221093,_0x41c4df){return function(_0x4f029c){if(_0x4f029c){var _0x27588d=typeof _0x41c4df['offset']===_0x591c('0x1a')&&typeof _0x41c4df[_0x591c('0x1b')]===_0x591c('0x1a');var _0x3c77bf=_0x4f029c['count'];var _0x2fbb24=_0x27588d?0x0:_0x41c4df[_0x591c('0x1c')];var _0x1bbca5=_0x27588d?_0x4f029c[_0x591c('0x1d')]:_0x41c4df[_0x591c('0x1c')]+_0x41c4df['limit'];var _0x380154;if(_0x1bbca5>=_0x3c77bf){_0x1bbca5=_0x3c77bf;_0x380154=0xc8;}else{_0x380154=0xce;}_0x221093[_0x591c('0x17')](_0x380154);return _0x221093[_0x591c('0x1e')](_0x591c('0x1f'),_0x2fbb24+'-'+_0x1bbca5+'/'+_0x3c77bf)[_0x591c('0x19')](_0x4f029c);}return null;};}function patchUpdates(_0x15d9dd){return function(_0x67508d){try{jsonpatch[_0x591c('0x20')](_0x67508d,_0x15d9dd,!![]);}catch(_0x357718){return BPromise[_0x591c('0x21')](_0x357718);}return _0x67508d['save']();};}function saveUpdates(_0x5e7f53,_0xb80c23){return function(_0x455072){if(_0x455072){return _0x455072['update'](_0x5e7f53)[_0x591c('0x22')](function(_0x5bacdd){return _0x5bacdd;});}return null;};}function removeEntity(_0x4de74f,_0x10ce81){return function(_0x598803){if(_0x598803){return _0x598803[_0x591c('0x23')]()[_0x591c('0x22')](function(){var _0x2086d4=_0x598803[_0x591c('0x24')]({'plain':!![]});var _0x41c99e=_0x591c('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x41c99e,'resourceId':_0x2086d4['id']}})['then'](function(){return _0x598803;});})['then'](function(){_0x4de74f[_0x591c('0x17')](0xcc)[_0x591c('0x18')]();});}};}function handleEntityNotFound(_0x4dc802,_0x50e603){return function(_0x6e974f){if(!_0x6e974f){_0x4dc802[_0x591c('0x26')](0x194);}return _0x6e974f;};}function handleError(_0x4ba8c7,_0x2243a4){_0x2243a4=_0x2243a4||0x1f4;return function(_0x5eae09){logger[_0x591c('0x27')](_0x5eae09[_0x591c('0x28')]);if(_0x5eae09[_0x591c('0x29')]){delete _0x5eae09[_0x591c('0x29')];}_0x4ba8c7[_0x591c('0x17')](_0x2243a4)[_0x591c('0x2a')](_0x5eae09);};}exports[_0x591c('0x2b')]=function(_0x3ab816,_0x44536e){var _0x3f01bf={},_0x47e48f={},_0x4fe132={'count':0x0,'rows':[]};var _0x250adf=_[_0x591c('0x2c')](db['JscriptyProject']['rawAttributes'],function(_0x22e7a9){return{'name':_0x22e7a9[_0x591c('0x2d')],'type':_0x22e7a9[_0x591c('0x2e')][_0x591c('0x2f')]};});_0x47e48f[_0x591c('0x30')]=_[_0x591c('0x2c')](_0x250adf,'name');_0x47e48f[_0x591c('0x31')]=_[_0x591c('0x32')](_0x3ab816[_0x591c('0x31')]);_0x47e48f[_0x591c('0x33')]=_['intersection'](_0x47e48f[_0x591c('0x30')],_0x47e48f['query']);_0x3f01bf[_0x591c('0x34')]=_[_0x591c('0x35')](_0x47e48f[_0x591c('0x30')],qs[_0x591c('0x36')](_0x3ab816['query']['fields']));_0x3f01bf[_0x591c('0x34')]=_0x3f01bf[_0x591c('0x34')][_0x591c('0x37')]?_0x3f01bf['attributes']:_0x47e48f[_0x591c('0x30')];if(!_0x3ab816[_0x591c('0x31')]['hasOwnProperty'](_0x591c('0x38'))){_0x3f01bf[_0x591c('0x1b')]=qs['limit'](_0x3ab816['query'][_0x591c('0x1b')]);_0x3f01bf[_0x591c('0x1c')]=qs['offset'](_0x3ab816[_0x591c('0x31')][_0x591c('0x1c')]);}_0x3f01bf[_0x591c('0x39')]=qs[_0x591c('0x3a')](_0x3ab816[_0x591c('0x31')]['sort']);_0x3f01bf[_0x591c('0x3b')]=qs[_0x591c('0x33')](_['pick'](_0x3ab816[_0x591c('0x31')],_0x47e48f['filters']),_0x250adf);if(_0x3ab816[_0x591c('0x31')][_0x591c('0x3c')]){_0x3f01bf['where']=_[_0x591c('0x3d')](_0x3f01bf['where'],{'$or':_[_0x591c('0x2c')](_0x250adf,function(_0x2c7051){if(_0x2c7051[_0x591c('0x2e')]!==_0x591c('0x3e')){var _0x2aa87e={};_0x2aa87e[_0x2c7051[_0x591c('0x29')]]={'$like':'%'+_0x3ab816['query']['filter']+'%'};return _0x2aa87e;}})});}_0x3f01bf=_[_0x591c('0x3d')]({},_0x3f01bf,_0x3ab816['options']);var _0x2ddf7d={'where':_0x3f01bf[_0x591c('0x3b')]};return db[_0x591c('0x3f')][_0x591c('0x1d')](_0x2ddf7d)[_0x591c('0x22')](function(_0x15e257){_0x4fe132[_0x591c('0x1d')]=_0x15e257;if(_0x3ab816['query'][_0x591c('0x40')]){_0x3f01bf['include']=[{'all':!![]}];}return db[_0x591c('0x3f')][_0x591c('0x41')](_0x3f01bf);})[_0x591c('0x22')](function(_0x4f8440){_0x4fe132[_0x591c('0x42')]=_0x4f8440;return _0x4fe132;})[_0x591c('0x22')](respondWithFilteredResult(_0x44536e,_0x3f01bf))['catch'](handleError(_0x44536e,null));};exports[_0x591c('0x43')]=function(_0x401a80,_0x44fd62){var _0x55f350={'raw':![],'where':{'id':_0x401a80[_0x591c('0x44')]['id']}},_0xdf02f1={};_0xdf02f1['model']=_['keys'](db['JscriptyProject'][_0x591c('0x45')]);_0xdf02f1[_0x591c('0x31')]=_[_0x591c('0x32')](_0x401a80['query']);_0xdf02f1[_0x591c('0x33')]=_['intersection'](_0xdf02f1[_0x591c('0x30')],_0xdf02f1[_0x591c('0x31')]);_0x55f350[_0x591c('0x34')]=_[_0x591c('0x35')](_0xdf02f1[_0x591c('0x30')],qs['fields'](_0x401a80['query']['fields']));_0x55f350[_0x591c('0x34')]=_0x55f350[_0x591c('0x34')][_0x591c('0x37')]?_0x55f350['attributes']:_0xdf02f1[_0x591c('0x30')];if(_0x401a80[_0x591c('0x31')]['includeAll']){_0x55f350[_0x591c('0x46')]=[{'all':!![]}];}_0x55f350=_[_0x591c('0x3d')]({},_0x55f350,_0x401a80[_0x591c('0x47')]);return db[_0x591c('0x3f')][_0x591c('0x48')](_0x55f350)[_0x591c('0x22')](handleEntityNotFound(_0x44fd62,null))[_0x591c('0x22')](respondWithResult(_0x44fd62,null))[_0x591c('0x49')](handleError(_0x44fd62,null));};exports[_0x591c('0x4a')]=function(_0x57d644,_0x28afee){return db['JscriptyProject']['create'](_0x57d644[_0x591c('0x4b')],{})['then'](function(_0x4d984b){var _0x188633=_0x57d644['user'][_0x591c('0x24')]({'plain':!![]});if(!_0x188633)throw new Error(_0x591c('0x4c'));if(_0x188633[_0x591c('0x4d')]===_0x591c('0x4e')){var _0x31e50b=_0x4d984b['get']({'plain':!![]});var _0xa4031e=_0x591c('0x25');return db[_0x591c('0x4f')][_0x591c('0x48')]({'where':{'name':_0xa4031e,'userProfileId':_0x188633[_0x591c('0x50')]},'raw':!![]})[_0x591c('0x22')](function(_0x25b8b6){if(_0x25b8b6&&_0x25b8b6[_0x591c('0x51')]===0x0){return db[_0x591c('0x52')][_0x591c('0x4a')]({'name':_0x31e50b[_0x591c('0x29')],'resourceId':_0x31e50b['id'],'type':_0x25b8b6[_0x591c('0x29')],'sectionId':_0x25b8b6['id']},{})[_0x591c('0x22')](function(){return _0x4d984b;});}else{return _0x4d984b;}})[_0x591c('0x49')](function(_0x165fcc){logger[_0x591c('0x27')](_0x591c('0x53'),_0x165fcc);throw _0x165fcc;});}return _0x4d984b;})[_0x591c('0x22')](respondWithResult(_0x28afee,0xc9))[_0x591c('0x49')](handleError(_0x28afee,null));};exports['clone']=function(_0x520385,_0x42f7db){var _0x3ae9c7={'where':{'id':_0x520385['params']['id']}},_0x302855={};_0x302855[_0x591c('0x30')]=_[_0x591c('0x32')](db[_0x591c('0x3f')]['rawAttributes']);_0x3ae9c7[_0x591c('0x34')]=_['intersection'](_0x302855[_0x591c('0x30')],qs[_0x591c('0x36')](_0x520385[_0x591c('0x31')][_0x591c('0x36')]));_0x3ae9c7[_0x591c('0x34')]=_0x3ae9c7[_0x591c('0x34')]['length']?_0x3ae9c7['attributes']:_0x302855[_0x591c('0x30')];if(_0x520385[_0x591c('0x31')][_0x591c('0x40')]){_0x3ae9c7[_0x591c('0x46')]=[{'all':!![]}];}_0x3ae9c7=_[_0x591c('0x3d')]({},_0x3ae9c7,_0x520385[_0x591c('0x47')]);return db['JscriptyProject'][_0x591c('0x48')](_0x3ae9c7)[_0x591c('0x22')](handleEntityNotFound(_0x42f7db,null))['then'](function(_0x26b1cb){if(_0x26b1cb){var _0x33fd4b=_0x26b1cb['get']({'plain':!![]});_0x33fd4b=qs['omit'](_0x33fd4b,['id',_0x591c('0x54'),_0x591c('0x55')]);_0x520385[_0x591c('0x4b')]=_[_0x591c('0x56')](_0x520385[_0x591c('0x4b')],['id','createdAt',_0x591c('0x55')]);return db[_0x591c('0x3f')]['create'](_[_0x591c('0x3d')](_0x33fd4b,_0x520385[_0x591c('0x4b')]),{'include':_0x520385[_0x591c('0x31')][_0x591c('0x40')]?[{'all':!![]}]:undefined})[_0x591c('0x22')](function(_0x32023d){var _0xa02087=_0x520385[_0x591c('0x4e')]['get']({'plain':!![]});if(!_0xa02087)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xa02087[_0x591c('0x4d')]==='user'){var _0x25c0c6=_0x32023d[_0x591c('0x24')]({'plain':!![]});var _0x3693ed='Projects';return db[_0x591c('0x4f')]['find']({'where':{'name':_0x3693ed,'userProfileId':_0xa02087[_0x591c('0x50')]},'raw':!![]})[_0x591c('0x22')](function(_0x301a73){if(_0x301a73&&_0x301a73['autoAssociation']===0x0){return db[_0x591c('0x52')][_0x591c('0x4a')]({'name':_0x25c0c6[_0x591c('0x29')],'resourceId':_0x25c0c6['id'],'type':_0x301a73[_0x591c('0x29')],'sectionId':_0x301a73['id']},{})['then'](function(){return _0x32023d;});}else{return _0x32023d;}})[_0x591c('0x49')](function(_0x288ac1){logger[_0x591c('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x288ac1);throw _0x288ac1;});}return _0x32023d;});}})['then'](respondWithResult(_0x42f7db,0xc9))['catch'](handleError(_0x42f7db,null));};exports['update']=function(_0x2169de,_0x4ac643){if(_0x2169de['body']['id']){delete _0x2169de[_0x591c('0x4b')]['id'];}return db[_0x591c('0x3f')][_0x591c('0x48')]({'where':{'id':_0x2169de[_0x591c('0x44')]['id']}})[_0x591c('0x22')](handleEntityNotFound(_0x4ac643,null))[_0x591c('0x22')](saveUpdates(_0x2169de[_0x591c('0x4b')],null))[_0x591c('0x22')](respondWithResult(_0x4ac643,null))[_0x591c('0x49')](handleError(_0x4ac643,null));};exports[_0x591c('0x23')]=function(_0x581027,_0xffdbf5){return db[_0x591c('0x3f')]['find']({'where':{'id':_0x581027[_0x591c('0x44')]['id']}})[_0x591c('0x22')](handleEntityNotFound(_0xffdbf5,null))[_0x591c('0x22')](removeEntity(_0xffdbf5,null))['catch'](handleError(_0xffdbf5,null));};exports[_0x591c('0x57')]=function(_0x44d917,_0x463de6,_0x2da6ab){var _0xe9b0ad={'raw':!![],'where':{}};var _0x1a04bd={};var _0x59afdf={'count':0x0,'rows':[]};return db[_0x591c('0x3f')]['findOne']({'where':{'id':_0x44d917[_0x591c('0x44')]['id']}})['then'](handleEntityNotFound(_0x463de6,null))[_0x591c('0x22')](function(_0x11e192){if(_0x11e192){_0x1a04bd[_0x591c('0x30')]=_[_0x591c('0x32')](db[_0x591c('0x58')][_0x591c('0x45')]);_0x1a04bd[_0x591c('0x31')]=_['keys'](_0x44d917[_0x591c('0x31')]);_0x1a04bd[_0x591c('0x33')]=_[_0x591c('0x35')](_0x1a04bd['model'],_0x1a04bd[_0x591c('0x31')]);_0xe9b0ad[_0x591c('0x34')]=_[_0x591c('0x35')](_0x1a04bd[_0x591c('0x30')],qs[_0x591c('0x36')](_0x44d917['query'][_0x591c('0x36')]));_0xe9b0ad['attributes']=_0xe9b0ad[_0x591c('0x34')][_0x591c('0x37')]?_0xe9b0ad[_0x591c('0x34')]:_0x1a04bd['model'];if(!_0x44d917[_0x591c('0x31')]['hasOwnProperty'](_0x591c('0x38'))){_0xe9b0ad['limit']=qs[_0x591c('0x1b')](_0x44d917[_0x591c('0x31')][_0x591c('0x1b')]);_0xe9b0ad[_0x591c('0x1c')]=qs['offset'](_0x44d917[_0x591c('0x31')][_0x591c('0x1c')]);}_0xe9b0ad[_0x591c('0x39')]=qs[_0x591c('0x3a')](_0x44d917['query'][_0x591c('0x3a')]);_0xe9b0ad[_0x591c('0x3b')]=qs[_0x591c('0x33')](_[_0x591c('0x59')](_0x44d917[_0x591c('0x31')],_0x1a04bd[_0x591c('0x33')]));_0xe9b0ad[_0x591c('0x3b')][_0x591c('0x5a')]=_0x11e192['id'];if(_0x44d917[_0x591c('0x31')][_0x591c('0x3c')]){_0xe9b0ad[_0x591c('0x3b')]=_[_0x591c('0x3d')](_0xe9b0ad[_0x591c('0x3b')],{'$or':_['map'](_0xe9b0ad[_0x591c('0x34')],function(_0x23a12){var _0x2205d9={};_0x2205d9[_0x23a12]={'$like':'%'+_0x44d917['query'][_0x591c('0x3c')]+'%'};return _0x2205d9;})});}_0xe9b0ad=_[_0x591c('0x3d')]({},_0xe9b0ad,_0x44d917[_0x591c('0x47')]);return db[_0x591c('0x58')][_0x591c('0x1d')]({'where':_0xe9b0ad['where']})['then'](function(_0x466035){_0x59afdf[_0x591c('0x1d')]=_0x466035;if(_0x44d917[_0x591c('0x31')][_0x591c('0x40')]){_0xe9b0ad[_0x591c('0x46')]=[{'all':!![]}];}return db[_0x591c('0x58')]['findAll'](_0xe9b0ad);})[_0x591c('0x22')](function(_0x456078){_0x59afdf[_0x591c('0x42')]=_0x456078;return _0x59afdf;});}})['then'](respondWithFilteredResult(_0x463de6,_0xe9b0ad))['catch'](handleError(_0x463de6,null));};exports['getAnswers']=function(_0x3b7022,_0x3bf730,_0x4e839e){var _0x345c8d={'raw':!![],'where':{}};var _0x512ab5={};var _0x1eb3b3={'count':0x0,'rows':[]};return db[_0x591c('0x3f')][_0x591c('0x5b')]({'where':{'id':_0x3b7022[_0x591c('0x44')]['id']}})[_0x591c('0x22')](handleEntityNotFound(_0x3bf730,null))[_0x591c('0x22')](function(_0x589cda){if(_0x589cda){_0x512ab5[_0x591c('0x30')]=_['keys'](db[_0x591c('0x5c')][_0x591c('0x45')]);_0x512ab5[_0x591c('0x31')]=_[_0x591c('0x32')](_0x3b7022[_0x591c('0x31')]);_0x512ab5[_0x591c('0x33')]=_[_0x591c('0x35')](_0x512ab5[_0x591c('0x30')],_0x512ab5['query']);_0x345c8d['attributes']=_[_0x591c('0x35')](_0x512ab5[_0x591c('0x30')],qs[_0x591c('0x36')](_0x3b7022['query']['fields']));_0x345c8d['attributes']=_0x345c8d['attributes'][_0x591c('0x37')]?_0x345c8d[_0x591c('0x34')]:_0x512ab5[_0x591c('0x30')];if(!_0x3b7022[_0x591c('0x31')][_0x591c('0x5d')](_0x591c('0x38'))){_0x345c8d[_0x591c('0x1b')]=qs[_0x591c('0x1b')](_0x3b7022[_0x591c('0x31')]['limit']);_0x345c8d[_0x591c('0x1c')]=qs['offset'](_0x3b7022[_0x591c('0x31')]['offset']);}_0x345c8d[_0x591c('0x39')]=qs['sort'](_0x3b7022[_0x591c('0x31')][_0x591c('0x3a')]);_0x345c8d[_0x591c('0x3b')]=qs[_0x591c('0x33')](_['pick'](_0x3b7022['query'],_0x512ab5[_0x591c('0x33')]));_0x345c8d[_0x591c('0x3b')][_0x591c('0x5a')]=_0x589cda['id'];if(_0x3b7022[_0x591c('0x31')][_0x591c('0x3c')]){_0x345c8d['where']=_['merge'](_0x345c8d[_0x591c('0x3b')],{'$or':_['map'](_0x345c8d[_0x591c('0x34')],function(_0x1d8f43){var _0x2b880a={};_0x2b880a[_0x1d8f43]={'$like':'%'+_0x3b7022['query'][_0x591c('0x3c')]+'%'};return _0x2b880a;})});}_0x345c8d=_[_0x591c('0x3d')]({},_0x345c8d,_0x3b7022[_0x591c('0x47')]);return db[_0x591c('0x5c')][_0x591c('0x1d')]({'where':_0x345c8d[_0x591c('0x3b')]})[_0x591c('0x22')](function(_0x194460){_0x1eb3b3[_0x591c('0x1d')]=_0x194460;if(_0x3b7022[_0x591c('0x31')][_0x591c('0x40')]){_0x345c8d['include']=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x591c('0x41')](_0x345c8d);})[_0x591c('0x22')](function(_0x37f6f1){_0x1eb3b3[_0x591c('0x42')]=_0x37f6f1;return _0x1eb3b3;});}})[_0x591c('0x22')](respondWithFilteredResult(_0x3bf730,_0x345c8d))[_0x591c('0x49')](handleError(_0x3bf730,null));};function char(_0x2d1ffa){return'number'===typeof _0x2d1ffa?String[_0x591c('0x5e')][_0x591c('0x20')](null,arguments):_0x2d1ffa;}function needsEncapsulation(_0x44359c){return!!_0x44359c&&(_0x44359c[_0x591c('0x5f')]()[_0x591c('0x60')](char(0xd))>=0x0||_0x44359c['toString']()['indexOf'](char(0xa))>=0x0||_0x44359c['toString']()[_0x591c('0x60')](char(0x2c))>=0x0||_0x44359c[_0x591c('0x5f')]()[_0x591c('0x60')](char(0x22))>=0x0);}function encapsulate(_0x1798c8){var _0x3afc5d=char(0x22),_0x6a73bb='\x5c'+char(0x22),_0x44929c=_0x1798c8[_0x591c('0x5f')]()[_0x591c('0x61')](new RegExp(_0x3afc5d,'g'),_0x6a73bb);return _0x3afc5d+_0x44929c+_0x3afc5d;}exports[_0x591c('0x62')]=function(_0x6473f9,_0x10efba,_0x1784ad){var _0x545905,_0x32f16a;var _0x5b5edb={'where':{'ProjectId':_0x6473f9[_0x591c('0x44')]['id']}};if(_0x6473f9[_0x591c('0x31')]['startTime']){_0x5b5edb[_0x591c('0x3b')][_0x591c('0x63')]=JSON[_0x591c('0x64')](_0x6473f9[_0x591c('0x31')][_0x591c('0x65')]);}return db[_0x591c('0x58')][_0x591c('0x41')](_0x5b5edb)['then'](handleEntityNotFound(_0x10efba,null))[_0x591c('0x22')](function(_0x885157){if(_0x885157){_0x545905=_0x885157;return db[_0x591c('0x66')][_0x591c('0x41')]({'where':{'SessionId':{'$in':_['map'](_0x545905,'id')},'ProjectId':_0x6473f9[_0x591c('0x44')]['id']},'order':'-createdAt'});}})[_0x591c('0x22')](handleEntityNotFound(_0x10efba,null))[_0x591c('0x22')](function(_0x25ce60){if(_0x25ce60){_0x32f16a=_0x25ce60;var _0x36cb10={};for(var _0x5bbe69=0x0,_0x197bee=_0x32f16a[_0x591c('0x37')];_0x5bbe69<_0x197bee;_0x5bbe69++){if(!_0x36cb10['hasOwnProperty'](_0x32f16a[_0x5bbe69][_0x591c('0x67')])){_0x36cb10[_0x32f16a[_0x5bbe69][_0x591c('0x67')]]=needsEncapsulation(_0x32f16a[_0x5bbe69]['question'])?encapsulate(_0x32f16a[_0x5bbe69]['question']):_0x32f16a[_0x5bbe69][_0x591c('0x68')];}}var _0xf26690=[],_0x7eaaee={};for(var _0x48931c=0x0,_0x59d91a=_0x545905['length'];_0x48931c<_0x59d91a;_0x48931c++){_0x7eaaee={'ProjectId':_0x6473f9[_0x591c('0x44')]['id'],'SessionId':_0x545905[_0x48931c]['id'],'StartTime':moment(_0x545905[_0x48931c]['starttime'])[_0x591c('0x69')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x54f7d5=0x0,_0x4768b4=_0x32f16a[_0x591c('0x37')];_0x54f7d5<_0x4768b4;_0x54f7d5++){if(_0x32f16a[_0x54f7d5][_0x591c('0x6a')]==_0x545905[_0x48931c]['id']&&_0x36cb10[_0x591c('0x5d')](_0x32f16a[_0x54f7d5][_0x591c('0x67')])){_0x7eaaee[_0x36cb10[_0x32f16a[_0x54f7d5]['questionId']]]=_0x32f16a[_0x54f7d5]['answer'];}}for(var _0xbcd6a5 in _0x36cb10){if(!_0x7eaaee[_0x591c('0x5d')](_0x36cb10[_0xbcd6a5])){_0x7eaaee[_0x36cb10[_0xbcd6a5]]=null;}}_0xf26690[_0x591c('0x6b')](_0x7eaaee);}return _0xf26690;}})[_0x591c('0x22')](function(_0x333ca5){if(!_['isEmpty'](_0x333ca5)){var _0x72fdf3=toCsv(_0x333ca5);var _0xc8b12a=Date[_0x591c('0x6c')]();fs['writeFileSync'](util[_0x591c('0x69')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x6473f9['params']['id'],_0xc8b12a),_0x72fdf3);_0x10efba[_0x591c('0x6d')](_0x591c('0x6e'),_0x591c('0x6f')+util[_0x591c('0x69')](_0x591c('0x70'),_0x6473f9[_0x591c('0x44')]['id'],_0xc8b12a));_0x10efba[_0x591c('0x6d')]('Content-type',_0x591c('0x71'));return _0x10efba[_0x591c('0x72')](util[_0x591c('0x69')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x6473f9['params']['id'],_0xc8b12a));}else{return _0x10efba['sendStatus'](0xcc);}})[_0x591c('0x49')](handleError(_0x10efba,null));}; \ No newline at end of file +var _0xda2d=['answer','push','isEmpty','now','writeFileSync','format','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','reject','save','update','then','destroy','get','Projects','UserProfileResource','stack','name','send','index','JscriptyProject','type','model','keys','query','filters','intersection','attributes','fields','length','order','sort','where','filter','map','options','includeAll','rows','catch','rawAttributes','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','merge','omit','createdAt','updatedAt','autoAssociation','getSessions','JscriptySessionReport','hasOwnProperty','nolimit','pick','ProjectId','findAll','getAnswers','findOne','JscriptyAnswerReport','apply','toString','indexOf','getSummary','startTime','parse','JscriptyQuestionReport','-createdAt','questionId','question','starttime','YYYY-MM-DD\x20HH:mm:ss','SessionId'];(function(_0x15e6c8,_0x16fe76){var _0x3440e8=function(_0x2fb057){while(--_0x2fb057){_0x15e6c8['push'](_0x15e6c8['shift']());}};_0x3440e8(++_0x16fe76);}(_0xda2d,0x102));var _0xdda2=function(_0x3456d3,_0x4349ea){_0x3456d3=_0x3456d3-0x0;var _0x25829f=_0xda2d[_0x3456d3];return _0x25829f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdda2('0x0'));var zipdir=require(_0xdda2('0x1'));var jsonpatch=require(_0xdda2('0x2'));var rp=require(_0xdda2('0x3'));var moment=require(_0xdda2('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xdda2('0x5'));var sox=require(_0xdda2('0x6'));var csv=require(_0xdda2('0x7'));var ejs=require(_0xdda2('0x8'));var fs=require('fs');var fs_extra=require(_0xdda2('0x9'));var _=require(_0xdda2('0xa'));var squel=require(_0xdda2('0xb'));var crypto=require(_0xdda2('0xc'));var jsforce=require(_0xdda2('0xd'));var deskjs=require(_0xdda2('0xe'));var toCsv=require('to-csv');var querystring=require(_0xdda2('0xf'));var Papa=require(_0xdda2('0x10'));var Redis=require('ioredis');var authService=require(_0xdda2('0x11'));var qs=require(_0xdda2('0x12'));var as=require(_0xdda2('0x13'));var hardwareService=require(_0xdda2('0x14'));var logger=require(_0xdda2('0x15'))(_0xdda2('0x16'));var utils=require(_0xdda2('0x17'));var config=require(_0xdda2('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x56d25d,_0xa6446b){_0xa6446b=_0xa6446b||0xcc;return function(_0x320f73){if(_0x320f73){return _0x56d25d[_0xdda2('0x19')](_0xa6446b);}return _0x56d25d[_0xdda2('0x1a')](_0xa6446b)[_0xdda2('0x1b')]();};}function respondWithResult(_0x475222,_0x3490f1){_0x3490f1=_0x3490f1||0xc8;return function(_0x4df902){if(_0x4df902){return _0x475222[_0xdda2('0x1a')](_0x3490f1)['json'](_0x4df902);}};}function respondWithFilteredResult(_0xbef148,_0xb6b01e){return function(_0x3553d5){if(_0x3553d5){var _0x457764=typeof _0xb6b01e[_0xdda2('0x1c')]==='undefined'&&typeof _0xb6b01e['limit']===_0xdda2('0x1d');var _0x518c6d=_0x3553d5[_0xdda2('0x1e')];var _0x1a3b35=_0x457764?0x0:_0xb6b01e[_0xdda2('0x1c')];var _0x2b6ee8=_0x457764?_0x3553d5[_0xdda2('0x1e')]:_0xb6b01e[_0xdda2('0x1c')]+_0xb6b01e[_0xdda2('0x1f')];var _0x351151;if(_0x2b6ee8>=_0x518c6d){_0x2b6ee8=_0x518c6d;_0x351151=0xc8;}else{_0x351151=0xce;}_0xbef148[_0xdda2('0x1a')](_0x351151);return _0xbef148[_0xdda2('0x20')](_0xdda2('0x21'),_0x1a3b35+'-'+_0x2b6ee8+'/'+_0x518c6d)[_0xdda2('0x22')](_0x3553d5);}return null;};}function patchUpdates(_0x4eed30){return function(_0x41fe7d){try{jsonpatch['apply'](_0x41fe7d,_0x4eed30,!![]);}catch(_0xc4567c){return BPromise[_0xdda2('0x23')](_0xc4567c);}return _0x41fe7d[_0xdda2('0x24')]();};}function saveUpdates(_0x4c5226,_0x347ee6){return function(_0x5a9bb8){if(_0x5a9bb8){return _0x5a9bb8[_0xdda2('0x25')](_0x4c5226)[_0xdda2('0x26')](function(_0x4ac3eb){return _0x4ac3eb;});}return null;};}function removeEntity(_0x144f1e,_0xfda248){return function(_0x2528d7){if(_0x2528d7){return _0x2528d7[_0xdda2('0x27')]()[_0xdda2('0x26')](function(){var _0x5739ad=_0x2528d7[_0xdda2('0x28')]({'plain':!![]});var _0x4be5ea=_0xdda2('0x29');return db[_0xdda2('0x2a')]['destroy']({'where':{'type':_0x4be5ea,'resourceId':_0x5739ad['id']}})['then'](function(){return _0x2528d7;});})[_0xdda2('0x26')](function(){_0x144f1e[_0xdda2('0x1a')](0xcc)[_0xdda2('0x1b')]();});}};}function handleEntityNotFound(_0x5e9e74,_0x90d919){return function(_0x5d26ae){if(!_0x5d26ae){_0x5e9e74[_0xdda2('0x19')](0x194);}return _0x5d26ae;};}function handleError(_0xe53dee,_0xe16ec7){_0xe16ec7=_0xe16ec7||0x1f4;return function(_0x91b41a){logger['error'](_0x91b41a[_0xdda2('0x2b')]);if(_0x91b41a[_0xdda2('0x2c')]){delete _0x91b41a['name'];}_0xe53dee[_0xdda2('0x1a')](_0xe16ec7)[_0xdda2('0x2d')](_0x91b41a);};}exports[_0xdda2('0x2e')]=function(_0x15e511,_0x5540e5){var _0x129eba={},_0x5e107f={},_0x4b19b7={'count':0x0,'rows':[]};var _0x1ca9f3=_['map'](db[_0xdda2('0x2f')]['rawAttributes'],function(_0x53ff76){return{'name':_0x53ff76['fieldName'],'type':_0x53ff76[_0xdda2('0x30')]['key']};});_0x5e107f[_0xdda2('0x31')]=_['map'](_0x1ca9f3,'name');_0x5e107f['query']=_[_0xdda2('0x32')](_0x15e511[_0xdda2('0x33')]);_0x5e107f[_0xdda2('0x34')]=_[_0xdda2('0x35')](_0x5e107f[_0xdda2('0x31')],_0x5e107f[_0xdda2('0x33')]);_0x129eba[_0xdda2('0x36')]=_[_0xdda2('0x35')](_0x5e107f[_0xdda2('0x31')],qs[_0xdda2('0x37')](_0x15e511['query'][_0xdda2('0x37')]));_0x129eba[_0xdda2('0x36')]=_0x129eba[_0xdda2('0x36')][_0xdda2('0x38')]?_0x129eba[_0xdda2('0x36')]:_0x5e107f[_0xdda2('0x31')];if(!_0x15e511[_0xdda2('0x33')]['hasOwnProperty']('nolimit')){_0x129eba[_0xdda2('0x1f')]=qs[_0xdda2('0x1f')](_0x15e511[_0xdda2('0x33')]['limit']);_0x129eba['offset']=qs[_0xdda2('0x1c')](_0x15e511[_0xdda2('0x33')][_0xdda2('0x1c')]);}_0x129eba[_0xdda2('0x39')]=qs[_0xdda2('0x3a')](_0x15e511['query'][_0xdda2('0x3a')]);_0x129eba[_0xdda2('0x3b')]=qs['filters'](_['pick'](_0x15e511[_0xdda2('0x33')],_0x5e107f[_0xdda2('0x34')]),_0x1ca9f3);if(_0x15e511[_0xdda2('0x33')][_0xdda2('0x3c')]){_0x129eba[_0xdda2('0x3b')]=_['merge'](_0x129eba[_0xdda2('0x3b')],{'$or':_[_0xdda2('0x3d')](_0x1ca9f3,function(_0x7dac2c){if(_0x7dac2c[_0xdda2('0x30')]!=='VIRTUAL'){var _0x4dc38f={};_0x4dc38f[_0x7dac2c[_0xdda2('0x2c')]]={'$like':'%'+_0x15e511[_0xdda2('0x33')][_0xdda2('0x3c')]+'%'};return _0x4dc38f;}})});}_0x129eba=_['merge']({},_0x129eba,_0x15e511[_0xdda2('0x3e')]);var _0x542ceb={'where':_0x129eba[_0xdda2('0x3b')]};return db['JscriptyProject'][_0xdda2('0x1e')](_0x542ceb)[_0xdda2('0x26')](function(_0x1db762){_0x4b19b7[_0xdda2('0x1e')]=_0x1db762;if(_0x15e511['query'][_0xdda2('0x3f')]){_0x129eba['include']=[{'all':!![]}];}return db[_0xdda2('0x2f')]['findAll'](_0x129eba);})[_0xdda2('0x26')](function(_0x12589b){_0x4b19b7[_0xdda2('0x40')]=_0x12589b;return _0x4b19b7;})[_0xdda2('0x26')](respondWithFilteredResult(_0x5540e5,_0x129eba))[_0xdda2('0x41')](handleError(_0x5540e5,null));};exports['show']=function(_0x1e29dc,_0x15a616){var _0x54735b={'raw':![],'where':{'id':_0x1e29dc['params']['id']}},_0x2caced={};_0x2caced[_0xdda2('0x31')]=_[_0xdda2('0x32')](db[_0xdda2('0x2f')][_0xdda2('0x42')]);_0x2caced[_0xdda2('0x33')]=_[_0xdda2('0x32')](_0x1e29dc[_0xdda2('0x33')]);_0x2caced[_0xdda2('0x34')]=_[_0xdda2('0x35')](_0x2caced[_0xdda2('0x31')],_0x2caced[_0xdda2('0x33')]);_0x54735b[_0xdda2('0x36')]=_[_0xdda2('0x35')](_0x2caced['model'],qs['fields'](_0x1e29dc['query'][_0xdda2('0x37')]));_0x54735b[_0xdda2('0x36')]=_0x54735b['attributes'][_0xdda2('0x38')]?_0x54735b[_0xdda2('0x36')]:_0x2caced[_0xdda2('0x31')];if(_0x1e29dc['query'][_0xdda2('0x3f')]){_0x54735b[_0xdda2('0x43')]=[{'all':!![]}];}_0x54735b=_['merge']({},_0x54735b,_0x1e29dc['options']);return db[_0xdda2('0x2f')]['find'](_0x54735b)[_0xdda2('0x26')](handleEntityNotFound(_0x15a616,null))['then'](respondWithResult(_0x15a616,null))[_0xdda2('0x41')](handleError(_0x15a616,null));};exports[_0xdda2('0x44')]=function(_0x50bd88,_0x585665){return db[_0xdda2('0x2f')][_0xdda2('0x44')](_0x50bd88[_0xdda2('0x45')],{})[_0xdda2('0x26')](function(_0x578a6c){var _0x1edbc6=_0x50bd88[_0xdda2('0x46')][_0xdda2('0x28')]({'plain':!![]});if(!_0x1edbc6)throw new Error(_0xdda2('0x47'));if(_0x1edbc6[_0xdda2('0x48')]==='user'){var _0x1a56cc=_0x578a6c[_0xdda2('0x28')]({'plain':!![]});var _0x51f2b6=_0xdda2('0x29');return db[_0xdda2('0x49')][_0xdda2('0x4a')]({'where':{'name':_0x51f2b6,'userProfileId':_0x1edbc6[_0xdda2('0x4b')]},'raw':!![]})[_0xdda2('0x26')](function(_0x265169){if(_0x265169&&_0x265169['autoAssociation']===0x0){return db[_0xdda2('0x2a')]['create']({'name':_0x1a56cc[_0xdda2('0x2c')],'resourceId':_0x1a56cc['id'],'type':_0x265169['name'],'sectionId':_0x265169['id']},{})[_0xdda2('0x26')](function(){return _0x578a6c;});}else{return _0x578a6c;}})['catch'](function(_0x3b5bbf){logger[_0xdda2('0x4c')](_0xdda2('0x4d'),_0x3b5bbf);throw _0x3b5bbf;});}return _0x578a6c;})[_0xdda2('0x26')](respondWithResult(_0x585665,0xc9))[_0xdda2('0x41')](handleError(_0x585665,null));};exports[_0xdda2('0x4e')]=function(_0x471b86,_0x40655d){var _0x538ebb={'where':{'id':_0x471b86[_0xdda2('0x4f')]['id']}},_0x477982={};_0x477982[_0xdda2('0x31')]=_['keys'](db[_0xdda2('0x2f')][_0xdda2('0x42')]);_0x538ebb['attributes']=_[_0xdda2('0x35')](_0x477982['model'],qs[_0xdda2('0x37')](_0x471b86[_0xdda2('0x33')][_0xdda2('0x37')]));_0x538ebb[_0xdda2('0x36')]=_0x538ebb[_0xdda2('0x36')]['length']?_0x538ebb['attributes']:_0x477982['model'];if(_0x471b86[_0xdda2('0x33')][_0xdda2('0x3f')]){_0x538ebb['include']=[{'all':!![]}];}_0x538ebb=_[_0xdda2('0x50')]({},_0x538ebb,_0x471b86[_0xdda2('0x3e')]);return db[_0xdda2('0x2f')]['find'](_0x538ebb)[_0xdda2('0x26')](handleEntityNotFound(_0x40655d,null))[_0xdda2('0x26')](function(_0x113266){if(_0x113266){var _0x58ae15=_0x113266[_0xdda2('0x28')]({'plain':!![]});_0x58ae15=qs[_0xdda2('0x51')](_0x58ae15,['id',_0xdda2('0x52'),_0xdda2('0x53')]);_0x471b86['body']=_[_0xdda2('0x51')](_0x471b86['body'],['id','createdAt','updatedAt']);return db[_0xdda2('0x2f')][_0xdda2('0x44')](_[_0xdda2('0x50')](_0x58ae15,_0x471b86[_0xdda2('0x45')]),{'include':_0x471b86[_0xdda2('0x33')][_0xdda2('0x3f')]?[{'all':!![]}]:undefined})[_0xdda2('0x26')](function(_0x3ac33a){var _0x269ad1=_0x471b86[_0xdda2('0x46')][_0xdda2('0x28')]({'plain':!![]});if(!_0x269ad1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x269ad1[_0xdda2('0x48')]===_0xdda2('0x46')){var _0x266ec0=_0x3ac33a[_0xdda2('0x28')]({'plain':!![]});var _0x90bb5c=_0xdda2('0x29');return db[_0xdda2('0x49')]['find']({'where':{'name':_0x90bb5c,'userProfileId':_0x269ad1[_0xdda2('0x4b')]},'raw':!![]})[_0xdda2('0x26')](function(_0x19e650){if(_0x19e650&&_0x19e650[_0xdda2('0x54')]===0x0){return db[_0xdda2('0x2a')]['create']({'name':_0x266ec0[_0xdda2('0x2c')],'resourceId':_0x266ec0['id'],'type':_0x19e650[_0xdda2('0x2c')],'sectionId':_0x19e650['id']},{})[_0xdda2('0x26')](function(){return _0x3ac33a;});}else{return _0x3ac33a;}})[_0xdda2('0x41')](function(_0x21d0e4){logger['error'](_0xdda2('0x4d'),_0x21d0e4);throw _0x21d0e4;});}return _0x3ac33a;});}})[_0xdda2('0x26')](respondWithResult(_0x40655d,0xc9))[_0xdda2('0x41')](handleError(_0x40655d,null));};exports[_0xdda2('0x25')]=function(_0x1ac15a,_0x5d34d7){if(_0x1ac15a[_0xdda2('0x45')]['id']){delete _0x1ac15a[_0xdda2('0x45')]['id'];}return db[_0xdda2('0x2f')]['find']({'where':{'id':_0x1ac15a[_0xdda2('0x4f')]['id']}})['then'](handleEntityNotFound(_0x5d34d7,null))[_0xdda2('0x26')](saveUpdates(_0x1ac15a[_0xdda2('0x45')],null))[_0xdda2('0x26')](respondWithResult(_0x5d34d7,null))['catch'](handleError(_0x5d34d7,null));};exports[_0xdda2('0x27')]=function(_0xc60963,_0x511fb9){return db[_0xdda2('0x2f')]['find']({'where':{'id':_0xc60963[_0xdda2('0x4f')]['id']}})[_0xdda2('0x26')](handleEntityNotFound(_0x511fb9,null))[_0xdda2('0x26')](removeEntity(_0x511fb9,null))[_0xdda2('0x41')](handleError(_0x511fb9,null));};exports[_0xdda2('0x55')]=function(_0x4a061a,_0x586ca1,_0x42fe90){var _0x25cf60={'raw':!![],'where':{}};var _0x547fbd={};var _0x53e9e0={'count':0x0,'rows':[]};return db[_0xdda2('0x2f')]['findOne']({'where':{'id':_0x4a061a[_0xdda2('0x4f')]['id']}})[_0xdda2('0x26')](handleEntityNotFound(_0x586ca1,null))['then'](function(_0x263f6d){if(_0x263f6d){_0x547fbd[_0xdda2('0x31')]=_[_0xdda2('0x32')](db[_0xdda2('0x56')][_0xdda2('0x42')]);_0x547fbd[_0xdda2('0x33')]=_['keys'](_0x4a061a[_0xdda2('0x33')]);_0x547fbd[_0xdda2('0x34')]=_[_0xdda2('0x35')](_0x547fbd['model'],_0x547fbd[_0xdda2('0x33')]);_0x25cf60[_0xdda2('0x36')]=_['intersection'](_0x547fbd['model'],qs[_0xdda2('0x37')](_0x4a061a[_0xdda2('0x33')][_0xdda2('0x37')]));_0x25cf60['attributes']=_0x25cf60['attributes'][_0xdda2('0x38')]?_0x25cf60['attributes']:_0x547fbd[_0xdda2('0x31')];if(!_0x4a061a[_0xdda2('0x33')][_0xdda2('0x57')](_0xdda2('0x58'))){_0x25cf60[_0xdda2('0x1f')]=qs[_0xdda2('0x1f')](_0x4a061a['query']['limit']);_0x25cf60[_0xdda2('0x1c')]=qs['offset'](_0x4a061a[_0xdda2('0x33')][_0xdda2('0x1c')]);}_0x25cf60[_0xdda2('0x39')]=qs[_0xdda2('0x3a')](_0x4a061a[_0xdda2('0x33')][_0xdda2('0x3a')]);_0x25cf60[_0xdda2('0x3b')]=qs[_0xdda2('0x34')](_[_0xdda2('0x59')](_0x4a061a['query'],_0x547fbd[_0xdda2('0x34')]));_0x25cf60[_0xdda2('0x3b')][_0xdda2('0x5a')]=_0x263f6d['id'];if(_0x4a061a[_0xdda2('0x33')]['filter']){_0x25cf60[_0xdda2('0x3b')]=_[_0xdda2('0x50')](_0x25cf60[_0xdda2('0x3b')],{'$or':_[_0xdda2('0x3d')](_0x25cf60['attributes'],function(_0x51766f){var _0xe4110b={};_0xe4110b[_0x51766f]={'$like':'%'+_0x4a061a[_0xdda2('0x33')][_0xdda2('0x3c')]+'%'};return _0xe4110b;})});}_0x25cf60=_[_0xdda2('0x50')]({},_0x25cf60,_0x4a061a['options']);return db[_0xdda2('0x56')][_0xdda2('0x1e')]({'where':_0x25cf60[_0xdda2('0x3b')]})[_0xdda2('0x26')](function(_0x2dda16){_0x53e9e0[_0xdda2('0x1e')]=_0x2dda16;if(_0x4a061a[_0xdda2('0x33')][_0xdda2('0x3f')]){_0x25cf60[_0xdda2('0x43')]=[{'all':!![]}];}return db[_0xdda2('0x56')][_0xdda2('0x5b')](_0x25cf60);})[_0xdda2('0x26')](function(_0x285cb2){_0x53e9e0[_0xdda2('0x40')]=_0x285cb2;return _0x53e9e0;});}})[_0xdda2('0x26')](respondWithFilteredResult(_0x586ca1,_0x25cf60))['catch'](handleError(_0x586ca1,null));};exports[_0xdda2('0x5c')]=function(_0x20969b,_0x58fcea,_0x50f7f6){var _0x3cb641={'raw':!![],'where':{}};var _0x40fd4c={};var _0x1ba7dd={'count':0x0,'rows':[]};return db[_0xdda2('0x2f')][_0xdda2('0x5d')]({'where':{'id':_0x20969b[_0xdda2('0x4f')]['id']}})['then'](handleEntityNotFound(_0x58fcea,null))[_0xdda2('0x26')](function(_0x1f3abe){if(_0x1f3abe){_0x40fd4c[_0xdda2('0x31')]=_[_0xdda2('0x32')](db['JscriptyAnswerReport'][_0xdda2('0x42')]);_0x40fd4c['query']=_[_0xdda2('0x32')](_0x20969b[_0xdda2('0x33')]);_0x40fd4c['filters']=_[_0xdda2('0x35')](_0x40fd4c[_0xdda2('0x31')],_0x40fd4c[_0xdda2('0x33')]);_0x3cb641[_0xdda2('0x36')]=_[_0xdda2('0x35')](_0x40fd4c[_0xdda2('0x31')],qs[_0xdda2('0x37')](_0x20969b[_0xdda2('0x33')][_0xdda2('0x37')]));_0x3cb641[_0xdda2('0x36')]=_0x3cb641[_0xdda2('0x36')]['length']?_0x3cb641[_0xdda2('0x36')]:_0x40fd4c[_0xdda2('0x31')];if(!_0x20969b[_0xdda2('0x33')][_0xdda2('0x57')](_0xdda2('0x58'))){_0x3cb641['limit']=qs[_0xdda2('0x1f')](_0x20969b[_0xdda2('0x33')]['limit']);_0x3cb641[_0xdda2('0x1c')]=qs[_0xdda2('0x1c')](_0x20969b['query']['offset']);}_0x3cb641[_0xdda2('0x39')]=qs[_0xdda2('0x3a')](_0x20969b[_0xdda2('0x33')][_0xdda2('0x3a')]);_0x3cb641[_0xdda2('0x3b')]=qs[_0xdda2('0x34')](_['pick'](_0x20969b[_0xdda2('0x33')],_0x40fd4c[_0xdda2('0x34')]));_0x3cb641['where'][_0xdda2('0x5a')]=_0x1f3abe['id'];if(_0x20969b[_0xdda2('0x33')]['filter']){_0x3cb641[_0xdda2('0x3b')]=_[_0xdda2('0x50')](_0x3cb641[_0xdda2('0x3b')],{'$or':_['map'](_0x3cb641[_0xdda2('0x36')],function(_0x4a34ee){var _0x45e549={};_0x45e549[_0x4a34ee]={'$like':'%'+_0x20969b[_0xdda2('0x33')][_0xdda2('0x3c')]+'%'};return _0x45e549;})});}_0x3cb641=_[_0xdda2('0x50')]({},_0x3cb641,_0x20969b['options']);return db['JscriptyAnswerReport'][_0xdda2('0x1e')]({'where':_0x3cb641[_0xdda2('0x3b')]})['then'](function(_0x468e32){_0x1ba7dd[_0xdda2('0x1e')]=_0x468e32;if(_0x20969b[_0xdda2('0x33')][_0xdda2('0x3f')]){_0x3cb641[_0xdda2('0x43')]=[{'all':!![]}];}return db[_0xdda2('0x5e')][_0xdda2('0x5b')](_0x3cb641);})[_0xdda2('0x26')](function(_0x3046c1){_0x1ba7dd[_0xdda2('0x40')]=_0x3046c1;return _0x1ba7dd;});}})[_0xdda2('0x26')](respondWithFilteredResult(_0x58fcea,_0x3cb641))[_0xdda2('0x41')](handleError(_0x58fcea,null));};function char(_0x528185){return'number'===typeof _0x528185?String['fromCharCode'][_0xdda2('0x5f')](null,arguments):_0x528185;}function needsEncapsulation(_0x4edf20){return!!_0x4edf20&&(_0x4edf20[_0xdda2('0x60')]()[_0xdda2('0x61')](char(0xd))>=0x0||_0x4edf20[_0xdda2('0x60')]()[_0xdda2('0x61')](char(0xa))>=0x0||_0x4edf20['toString']()[_0xdda2('0x61')](char(0x2c))>=0x0||_0x4edf20[_0xdda2('0x60')]()[_0xdda2('0x61')](char(0x22))>=0x0);}function encapsulate(_0x49d5a6){var _0x1d80c0=char(0x22),_0x86235b='\x5c'+char(0x22),_0x2588f5=_0x49d5a6['toString']()['replace'](new RegExp(_0x1d80c0,'g'),_0x86235b);return _0x1d80c0+_0x2588f5+_0x1d80c0;}exports[_0xdda2('0x62')]=function(_0x46e3e4,_0x42df5b,_0x5e3718){var _0x29a037,_0x32a2e9;var _0xdb1841={'where':{'ProjectId':_0x46e3e4[_0xdda2('0x4f')]['id']}};if(_0x46e3e4[_0xdda2('0x33')][_0xdda2('0x63')]){_0xdb1841[_0xdda2('0x3b')]['starttime']=JSON[_0xdda2('0x64')](_0x46e3e4[_0xdda2('0x33')][_0xdda2('0x63')]);}return db[_0xdda2('0x56')]['findAll'](_0xdb1841)[_0xdda2('0x26')](handleEntityNotFound(_0x42df5b,null))[_0xdda2('0x26')](function(_0x36de73){if(_0x36de73){_0x29a037=_0x36de73;return db[_0xdda2('0x65')]['findAll']({'where':{'SessionId':{'$in':_['map'](_0x29a037,'id')},'ProjectId':_0x46e3e4['params']['id']},'order':_0xdda2('0x66')});}})[_0xdda2('0x26')](handleEntityNotFound(_0x42df5b,null))[_0xdda2('0x26')](function(_0x429f24){if(_0x429f24){_0x32a2e9=_0x429f24;var _0x1cc1f4={};for(var _0x3cdef1=0x0,_0x5880b8=_0x32a2e9[_0xdda2('0x38')];_0x3cdef1<_0x5880b8;_0x3cdef1++){if(!_0x1cc1f4[_0xdda2('0x57')](_0x32a2e9[_0x3cdef1][_0xdda2('0x67')])){_0x1cc1f4[_0x32a2e9[_0x3cdef1][_0xdda2('0x67')]]=needsEncapsulation(_0x32a2e9[_0x3cdef1][_0xdda2('0x68')])?encapsulate(_0x32a2e9[_0x3cdef1][_0xdda2('0x68')]):_0x32a2e9[_0x3cdef1][_0xdda2('0x68')];}}var _0xbfd011=[],_0x4cdca6={};for(var _0x1aa741=0x0,_0x517b60=_0x29a037[_0xdda2('0x38')];_0x1aa741<_0x517b60;_0x1aa741++){_0x4cdca6={'ProjectId':_0x46e3e4['params']['id'],'SessionId':_0x29a037[_0x1aa741]['id'],'StartTime':moment(_0x29a037[_0x1aa741][_0xdda2('0x69')])['format'](_0xdda2('0x6a'))};for(var _0x31e555=0x0,_0x329d18=_0x32a2e9[_0xdda2('0x38')];_0x31e555<_0x329d18;_0x31e555++){if(_0x32a2e9[_0x31e555][_0xdda2('0x6b')]==_0x29a037[_0x1aa741]['id']&&_0x1cc1f4[_0xdda2('0x57')](_0x32a2e9[_0x31e555][_0xdda2('0x67')])){_0x4cdca6[_0x1cc1f4[_0x32a2e9[_0x31e555][_0xdda2('0x67')]]]=_0x32a2e9[_0x31e555][_0xdda2('0x6c')];}}for(var _0x49db3b in _0x1cc1f4){if(!_0x4cdca6[_0xdda2('0x57')](_0x1cc1f4[_0x49db3b])){_0x4cdca6[_0x1cc1f4[_0x49db3b]]=null;}}_0xbfd011[_0xdda2('0x6d')](_0x4cdca6);}return _0xbfd011;}})['then'](function(_0x42db44){if(!_[_0xdda2('0x6e')](_0x42db44)){var _0x2f3807=toCsv(_0x42db44);var _0x5600da=Date[_0xdda2('0x6f')]();fs[_0xdda2('0x70')](util[_0xdda2('0x71')](_0xdda2('0x72'),_0x46e3e4[_0xdda2('0x4f')]['id'],_0x5600da),_0x2f3807);_0x42df5b[_0xdda2('0x73')](_0xdda2('0x74'),_0xdda2('0x75')+util[_0xdda2('0x71')](_0xdda2('0x76'),_0x46e3e4['params']['id'],_0x5600da));_0x42df5b[_0xdda2('0x73')](_0xdda2('0x77'),_0xdda2('0x78'));return _0x42df5b[_0xdda2('0x79')](util[_0xdda2('0x71')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x46e3e4[_0xdda2('0x4f')]['id'],_0x5600da));}else{return _0x42df5b[_0xdda2('0x19')](0xcc);}})[_0xdda2('0x41')](handleError(_0x42df5b,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index ca26fd9..7dc9a3e 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 _0x9879=['request-promise','path','rimraf','../../config/environment','./jscriptyProject.attributes','exports','define','jscripty_projects','lodash','util','../../config/logger','moment'];(function(_0x77d76e,_0x106ed2){var _0x5620c8=function(_0x481b37){while(--_0x481b37){_0x77d76e['push'](_0x77d76e['shift']());}};_0x5620c8(++_0x106ed2);}(_0x9879,0x98));var _0x9987=function(_0x308279,_0x515b74){_0x308279=_0x308279-0x0;var _0xf33ea7=_0x9879[_0x308279];return _0xf33ea7;};'use strict';var _=require(_0x9987('0x0'));var util=require(_0x9987('0x1'));var logger=require(_0x9987('0x2'))('api');var moment=require(_0x9987('0x3'));var BPromise=require('bluebird');var rp=require(_0x9987('0x4'));var fs=require('fs');var path=require(_0x9987('0x5'));var rimraf=require(_0x9987('0x6'));var config=require(_0x9987('0x7'));var attributes=require(_0x9987('0x8'));module[_0x9987('0x9')]=function(_0x4258df,_0x4d479d){return _0x4258df[_0x9987('0xa')]('JscriptyProject',attributes,{'tableName':_0x9987('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x165d=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','define'];(function(_0x5acaa4,_0x549f5b){var _0x4b9175=function(_0x1ca9e4){while(--_0x1ca9e4){_0x5acaa4['push'](_0x5acaa4['shift']());}};_0x4b9175(++_0x549f5b);}(_0x165d,0x14a));var _0xd165=function(_0x10e27d,_0xb43940){_0x10e27d=_0x10e27d-0x0;var _0x2ec520=_0x165d[_0x10e27d];return _0x2ec520;};'use strict';var _=require(_0xd165('0x0'));var util=require(_0xd165('0x1'));var logger=require(_0xd165('0x2'))(_0xd165('0x3'));var moment=require(_0xd165('0x4'));var BPromise=require(_0xd165('0x5'));var rp=require(_0xd165('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd165('0x7'));var config=require(_0xd165('0x8'));var attributes=require('./jscriptyProject.attributes');module['exports']=function(_0x5435f9,_0x42d256){return _0x5435f9[_0xd165('0x9')]('JscriptyProject',attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index e89d9be..48eaee5 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 _0x70e0=['code','JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x36355f,_0xb1be37){var _0x239d9=function(_0x1eb5b4){while(--_0x1eb5b4){_0x36355f['push'](_0x36355f['shift']());}};_0x239d9(++_0xb1be37);}(_0x70e0,0x17b));var _0x070e=function(_0xdc3296,_0x481586){_0xdc3296=_0xdc3296-0x0;var _0x56abea=_0x70e0[_0xdc3296];return _0x56abea;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('JscriptyProject,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file +var _0xda3f=['rpc','jayson/promise','client','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/logger'];(function(_0x596f6e,_0x3f8857){var _0x1e0803=function(_0x31f91f){while(--_0x31f91f){_0x596f6e['push'](_0x596f6e['shift']());}};_0x1e0803(++_0x3f8857);}(_0xda3f,0xec));var _0xfda3=function(_0x336a72,_0xbb7b6a){_0x336a72=_0x336a72-0x0;var _0x37d0e7=_0xda3f[_0x336a72];return _0x37d0e7;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var moment=require(_0xfda3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfda3('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xfda3('0x3'))(_0xfda3('0x4'));var config=require('../../config/environment');var jayson=require(_0xfda3('0x5'));var client=jayson[_0xfda3('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e72d1,_0x316792,_0x42476a){return new BPromise(function(_0x125e2a,_0x4018c0){return client[_0xfda3('0x7')](_0x4e72d1,_0x42476a)[_0xfda3('0x8')](function(_0x46655c){logger[_0xfda3('0x9')](_0xfda3('0xa'),_0x316792,_0xfda3('0xb'));logger[_0xfda3('0xc')](_0xfda3('0xd'),_0x316792,'request\x20sent',JSON[_0xfda3('0xe')](_0x46655c));if(_0x46655c[_0xfda3('0xf')]){if(_0x46655c[_0xfda3('0xf')][_0xfda3('0x10')]===0x1f4){logger[_0xfda3('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x316792,_0x46655c[_0xfda3('0xf')]['message']);return _0x4018c0(_0x46655c[_0xfda3('0xf')][_0xfda3('0x11')]);}logger['error']('JscriptyProject,\x20%s,\x20%s',_0x316792,_0x46655c['error'][_0xfda3('0x11')]);return _0x125e2a(_0x46655c[_0xfda3('0xf')]['message']);}else{logger['info']('JscriptyProject,\x20%s,\x20%s',_0x316792,_0xfda3('0xb'));_0x125e2a(_0x46655c[_0xfda3('0x12')][_0xfda3('0x11')]);}})[_0xfda3('0x13')](function(_0x34900d){logger[_0xfda3('0xf')](_0xfda3('0xa'),_0x316792,_0x34900d);_0x4018c0(_0x34900d);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 6ff5530..4b9cab3 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 _0x2352=['show','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id'];(function(_0x547b60,_0x45eb3f){var _0x5a5440=function(_0x1b0895){while(--_0x1b0895){_0x547b60['push'](_0x547b60['shift']());}};_0x5a5440(++_0x45eb3f);}(_0x2352,0x1aa));var _0x2235=function(_0x3c8453,_0x4f09ee){_0x3c8453=_0x3c8453-0x0;var _0x4a6f8e=_0x2352[_0x3c8453];return _0x4a6f8e;};'use strict';var multer=require(_0x2235('0x0'));var util=require(_0x2235('0x1'));var path=require(_0x2235('0x2'));var timeout=require(_0x2235('0x3'));var express=require(_0x2235('0x4'));var router=express['Router']();var fs_extra=require(_0x2235('0x5'));var auth=require(_0x2235('0x6'));var interaction=require(_0x2235('0x7'));var config=require(_0x2235('0x8'));var controller=require('./jscriptyQuestionReport.controller');router[_0x2235('0x9')]('/',auth[_0x2235('0xa')](),controller['index']);router[_0x2235('0x9')](_0x2235('0xb'),auth[_0x2235('0xa')](),controller[_0x2235('0xc')]);router[_0x2235('0x9')](_0x2235('0xd'),auth['isAuthenticated'](),controller[_0x2235('0xe')]);router['post']('/',auth[_0x2235('0xa')](),controller[_0x2235('0xf')]);router[_0x2235('0x10')]('/:id',auth[_0x2235('0xa')](),controller[_0x2235('0x11')]);router[_0x2235('0x12')]('/:id',auth[_0x2235('0xa')](),controller[_0x2235('0x13')]);module['exports']=router; \ No newline at end of file +var _0x143c=['isAuthenticated','index','get','/describe','describe','/:id','show','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller'];(function(_0x5adc0a,_0x73fac5){var _0x23f5f8=function(_0xf1abbf){while(--_0xf1abbf){_0x5adc0a['push'](_0x5adc0a['shift']());}};_0x23f5f8(++_0x73fac5);}(_0x143c,0x16c));var _0xc143=function(_0x43f47b,_0x311636){_0x43f47b=_0x43f47b-0x0;var _0x4af9a6=_0x143c[_0x43f47b];return _0x4af9a6;};'use strict';var multer=require(_0xc143('0x0'));var util=require(_0xc143('0x1'));var path=require(_0xc143('0x2'));var timeout=require(_0xc143('0x3'));var express=require(_0xc143('0x4'));var router=express[_0xc143('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc143('0x6'));var interaction=require(_0xc143('0x7'));var config=require(_0xc143('0x8'));var controller=require(_0xc143('0x9'));router['get']('/',auth[_0xc143('0xa')](),controller[_0xc143('0xb')]);router[_0xc143('0xc')](_0xc143('0xd'),auth[_0xc143('0xa')](),controller[_0xc143('0xe')]);router[_0xc143('0xc')](_0xc143('0xf'),auth[_0xc143('0xa')](),controller[_0xc143('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc143('0x11')]);router[_0xc143('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xc143('0x13')]);router[_0xc143('0x14')]('/:id',auth[_0xc143('0xa')](),controller['destroy']);module[_0xc143('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 6b7d68d..ac3f79c 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(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x7a54,0x106));var _0x47a5=function(_0x1bcd34,_0x2597ec){_0x1bcd34=_0x1bcd34-0x0;var _0x403d57=_0x7a54[_0x1bcd34];return _0x403d57;};'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(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x7a54,0x106));var _0x47a5=function(_0x104fd1,_0x5878a2){_0x104fd1=_0x104fd1-0x0;var _0x3e8f11=_0x7a54[_0x104fd1];return _0x3e8f11;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index 718db98..1858b19 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 _0xfaba=['limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','type','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','find','create','body','params','destroy','describe','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined'];(function(_0x5d2507,_0x556fac){var _0x198c07=function(_0x2e2b6b){while(--_0x2e2b6b){_0x5d2507['push'](_0x5d2507['shift']());}};_0x198c07(++_0x556fac);}(_0xfaba,0x81));var _0xafab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfaba[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xafab('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xafab('0x1'));var rp=require(_0xafab('0x2'));var moment=require('moment');var BPromise=require(_0xafab('0x3'));var Mustache=require(_0xafab('0x4'));var util=require(_0xafab('0x5'));var path=require(_0xafab('0x6'));var sox=require(_0xafab('0x7'));var csv=require(_0xafab('0x8'));var ejs=require(_0xafab('0x9'));var fs=require('fs');var fs_extra=require(_0xafab('0xa'));var _=require(_0xafab('0xb'));var squel=require(_0xafab('0xc'));var crypto=require(_0xafab('0xd'));var jsforce=require(_0xafab('0xe'));var deskjs=require(_0xafab('0xf'));var toCsv=require(_0xafab('0x8'));var querystring=require(_0xafab('0x10'));var Papa=require(_0xafab('0x11'));var Redis=require(_0xafab('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xafab('0x13'));var logger=require('../../config/logger')(_0xafab('0x14'));var utils=require('../../config/utils');var config=require(_0xafab('0x15'));var licenseUtil=require(_0xafab('0x16'));var db=require(_0xafab('0x17'))['db'];function respondWithStatusCode(_0x28036,_0x5f447e){_0x5f447e=_0x5f447e||0xcc;return function(_0x5565b1){if(_0x5565b1){return _0x28036['sendStatus'](_0x5f447e);}return _0x28036[_0xafab('0x18')](_0x5f447e)[_0xafab('0x19')]();};}function respondWithResult(_0x163a78,_0x1eb991){_0x1eb991=_0x1eb991||0xc8;return function(_0x44c0c1){if(_0x44c0c1){return _0x163a78[_0xafab('0x18')](_0x1eb991)['json'](_0x44c0c1);}};}function respondWithFilteredResult(_0x8ac783,_0x258587){return function(_0x36e72c){if(_0x36e72c){var _0x4248dc=typeof _0x258587['offset']===_0xafab('0x1a')&&typeof _0x258587[_0xafab('0x1b')]===_0xafab('0x1a');var _0x5347a1=_0x36e72c[_0xafab('0x1c')];var _0x216ffc=_0x4248dc?0x0:_0x258587[_0xafab('0x1d')];var _0x560f38=_0x4248dc?_0x36e72c[_0xafab('0x1c')]:_0x258587[_0xafab('0x1d')]+_0x258587[_0xafab('0x1b')];var _0x1ac5cb;if(_0x560f38>=_0x5347a1){_0x560f38=_0x5347a1;_0x1ac5cb=0xc8;}else{_0x1ac5cb=0xce;}_0x8ac783['status'](_0x1ac5cb);return _0x8ac783[_0xafab('0x1e')](_0xafab('0x1f'),_0x216ffc+'-'+_0x560f38+'/'+_0x5347a1)[_0xafab('0x20')](_0x36e72c);}return null;};}function patchUpdates(_0x1c369a){return function(_0x345ccb){try{jsonpatch[_0xafab('0x21')](_0x345ccb,_0x1c369a,!![]);}catch(_0x5618e3){return BPromise[_0xafab('0x22')](_0x5618e3);}return _0x345ccb[_0xafab('0x23')]();};}function saveUpdates(_0x2c4803,_0x1bb060){return function(_0x26a3fa){if(_0x26a3fa){return _0x26a3fa[_0xafab('0x24')](_0x2c4803)[_0xafab('0x25')](function(_0x2a3754){return _0x2a3754;});}return null;};}function removeEntity(_0x4ec548,_0x3eab7a){return function(_0x473276){if(_0x473276){return _0x473276['destroy']()[_0xafab('0x25')](function(){_0x4ec548['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x32130b,_0x48640e){return function(_0x35cc00){if(!_0x35cc00){_0x32130b[_0xafab('0x26')](0x194);}return _0x35cc00;};}function handleError(_0x460d9e,_0x1a57f1){_0x1a57f1=_0x1a57f1||0x1f4;return function(_0x2d897a){logger[_0xafab('0x27')](_0x2d897a[_0xafab('0x28')]);if(_0x2d897a['name']){delete _0x2d897a[_0xafab('0x29')];}_0x460d9e['status'](_0x1a57f1)[_0xafab('0x2a')](_0x2d897a);};}exports[_0xafab('0x2b')]=function(_0x30ef52,_0x4f0e77){var _0x4c0f47={},_0x2b9d76={},_0x526a38={'count':0x0,'rows':[]};var _0x3c12cb=_[_0xafab('0x2c')](db[_0xafab('0x2d')][_0xafab('0x2e')],function(_0x82c010){return{'name':_0x82c010['fieldName'],'type':_0x82c010[_0xafab('0x2f')][_0xafab('0x30')]};});_0x2b9d76[_0xafab('0x31')]=_[_0xafab('0x2c')](_0x3c12cb,_0xafab('0x29'));_0x2b9d76['query']=_[_0xafab('0x32')](_0x30ef52['query']);_0x2b9d76[_0xafab('0x33')]=_['intersection'](_0x2b9d76[_0xafab('0x31')],_0x2b9d76['query']);_0x4c0f47['attributes']=_[_0xafab('0x34')](_0x2b9d76[_0xafab('0x31')],qs['fields'](_0x30ef52[_0xafab('0x35')][_0xafab('0x36')]));_0x4c0f47[_0xafab('0x37')]=_0x4c0f47[_0xafab('0x37')][_0xafab('0x38')]?_0x4c0f47[_0xafab('0x37')]:_0x2b9d76['model'];if(!_0x30ef52[_0xafab('0x35')][_0xafab('0x39')](_0xafab('0x3a'))){_0x4c0f47['limit']=qs[_0xafab('0x1b')](_0x30ef52[_0xafab('0x35')]['limit']);_0x4c0f47[_0xafab('0x1d')]=qs[_0xafab('0x1d')](_0x30ef52['query']['offset']);}_0x4c0f47[_0xafab('0x3b')]=qs[_0xafab('0x3c')](_0x30ef52[_0xafab('0x35')][_0xafab('0x3c')]);_0x4c0f47['where']=qs[_0xafab('0x33')](_[_0xafab('0x3d')](_0x30ef52[_0xafab('0x35')],_0x2b9d76[_0xafab('0x33')]),_0x3c12cb);if(_0x30ef52[_0xafab('0x35')][_0xafab('0x3e')]){_0x4c0f47[_0xafab('0x3f')]=_[_0xafab('0x40')](_0x4c0f47[_0xafab('0x3f')],{'$or':_[_0xafab('0x2c')](_0x3c12cb,function(_0x27635d){if(_0x27635d[_0xafab('0x2f')]!==_0xafab('0x41')){var _0x2dc837={};_0x2dc837[_0x27635d[_0xafab('0x29')]]={'$like':'%'+_0x30ef52[_0xafab('0x35')][_0xafab('0x3e')]+'%'};return _0x2dc837;}})});}_0x4c0f47=_[_0xafab('0x40')]({},_0x4c0f47,_0x30ef52['options']);var _0x49db92={'where':_0x4c0f47[_0xafab('0x3f')]};return db[_0xafab('0x2d')][_0xafab('0x1c')](_0x49db92)[_0xafab('0x25')](function(_0x5b17f1){_0x526a38[_0xafab('0x1c')]=_0x5b17f1;if(_0x30ef52['query'][_0xafab('0x42')]){_0x4c0f47[_0xafab('0x43')]=[{'all':!![]}];}return db[_0xafab('0x2d')][_0xafab('0x44')](_0x4c0f47);})[_0xafab('0x25')](function(_0x4d1cb1){_0x526a38[_0xafab('0x45')]=_0x4d1cb1;return _0x526a38;})[_0xafab('0x25')](respondWithFilteredResult(_0x4f0e77,_0x4c0f47))[_0xafab('0x46')](handleError(_0x4f0e77,null));};exports[_0xafab('0x47')]=function(_0x539704,_0x19d5b7){var _0x246c1d={'raw':!![],'where':{'id':_0x539704['params']['id']}},_0xfdb150={};_0xfdb150[_0xafab('0x31')]=_[_0xafab('0x32')](db['JscriptyQuestionReport'][_0xafab('0x2e')]);_0xfdb150[_0xafab('0x35')]=_['keys'](_0x539704[_0xafab('0x35')]);_0xfdb150[_0xafab('0x33')]=_['intersection'](_0xfdb150[_0xafab('0x31')],_0xfdb150[_0xafab('0x35')]);_0x246c1d[_0xafab('0x37')]=_[_0xafab('0x34')](_0xfdb150[_0xafab('0x31')],qs['fields'](_0x539704[_0xafab('0x35')][_0xafab('0x36')]));_0x246c1d[_0xafab('0x37')]=_0x246c1d['attributes'][_0xafab('0x38')]?_0x246c1d[_0xafab('0x37')]:_0xfdb150[_0xafab('0x31')];if(_0x539704['query'][_0xafab('0x42')]){_0x246c1d[_0xafab('0x43')]=[{'all':!![]}];}_0x246c1d=_['merge']({},_0x246c1d,_0x539704['options']);return db['JscriptyQuestionReport'][_0xafab('0x48')](_0x246c1d)[_0xafab('0x25')](handleEntityNotFound(_0x19d5b7,null))['then'](respondWithResult(_0x19d5b7,null))[_0xafab('0x46')](handleError(_0x19d5b7,null));};exports[_0xafab('0x49')]=function(_0x150f55,_0x2daa0e){return db['JscriptyQuestionReport']['create'](_0x150f55[_0xafab('0x4a')],{})[_0xafab('0x25')](respondWithResult(_0x2daa0e,0xc9))[_0xafab('0x46')](handleError(_0x2daa0e,null));};exports[_0xafab('0x24')]=function(_0x120c4e,_0x885de2){if(_0x120c4e[_0xafab('0x4a')]['id']){delete _0x120c4e['body']['id'];}return db[_0xafab('0x2d')][_0xafab('0x48')]({'where':{'id':_0x120c4e[_0xafab('0x4b')]['id']}})['then'](handleEntityNotFound(_0x885de2,null))[_0xafab('0x25')](saveUpdates(_0x120c4e[_0xafab('0x4a')],null))[_0xafab('0x25')](respondWithResult(_0x885de2,null))['catch'](handleError(_0x885de2,null));};exports[_0xafab('0x4c')]=function(_0x1a3e6a,_0x1a085b){return db[_0xafab('0x2d')][_0xafab('0x48')]({'where':{'id':_0x1a3e6a['params']['id']}})['then'](handleEntityNotFound(_0x1a085b,null))['then'](removeEntity(_0x1a085b,null))[_0xafab('0x46')](handleError(_0x1a085b,null));};exports[_0xafab('0x4d')]=function(_0x23f094,_0x1cab3a){return db[_0xafab('0x2d')][_0xafab('0x4d')]()[_0xafab('0x25')](respondWithResult(_0x1cab3a,null))['catch'](handleError(_0x1cab3a,null));}; \ No newline at end of file +var _0x42cb=['type','key','query','keys','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','options','count','findAll','show','params','fields','include','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','Content-Range','save','update','then','destroy','error','stack','name','send','map','JscriptyQuestionReport','rawAttributes','fieldName'];(function(_0x99e298,_0x4c95ad){var _0x32d7f1=function(_0x450c21){while(--_0x450c21){_0x99e298['push'](_0x99e298['shift']());}};_0x32d7f1(++_0x4c95ad);}(_0x42cb,0xae));var _0xb42c=function(_0x474dcb,_0x41aee4){_0x474dcb=_0x474dcb-0x0;var _0x1dd371=_0x42cb[_0x474dcb];return _0x1dd371;};'use strict';var emlformat=require(_0xb42c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb42c('0x1'));var jsonpatch=require(_0xb42c('0x2'));var rp=require(_0xb42c('0x3'));var moment=require('moment');var BPromise=require(_0xb42c('0x4'));var Mustache=require(_0xb42c('0x5'));var util=require(_0xb42c('0x6'));var path=require(_0xb42c('0x7'));var sox=require('sox');var csv=require(_0xb42c('0x8'));var ejs=require(_0xb42c('0x9'));var fs=require('fs');var fs_extra=require(_0xb42c('0xa'));var _=require('lodash');var squel=require(_0xb42c('0xb'));var crypto=require(_0xb42c('0xc'));var jsforce=require(_0xb42c('0xd'));var deskjs=require(_0xb42c('0xe'));var toCsv=require(_0xb42c('0x8'));var querystring=require(_0xb42c('0xf'));var Papa=require(_0xb42c('0x10'));var Redis=require(_0xb42c('0x11'));var authService=require(_0xb42c('0x12'));var qs=require(_0xb42c('0x13'));var as=require(_0xb42c('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb42c('0x15'))(_0xb42c('0x16'));var utils=require(_0xb42c('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb42c('0x18'))['db'];function respondWithStatusCode(_0xbe8d90,_0x5e3056){_0x5e3056=_0x5e3056||0xcc;return function(_0x3be93d){if(_0x3be93d){return _0xbe8d90[_0xb42c('0x19')](_0x5e3056);}return _0xbe8d90[_0xb42c('0x1a')](_0x5e3056)[_0xb42c('0x1b')]();};}function respondWithResult(_0x271f99,_0x406b58){_0x406b58=_0x406b58||0xc8;return function(_0x19f8c3){if(_0x19f8c3){return _0x271f99['status'](_0x406b58)[_0xb42c('0x1c')](_0x19f8c3);}};}function respondWithFilteredResult(_0x4b6192,_0x1163bc){return function(_0xd48821){if(_0xd48821){var _0x348577=typeof _0x1163bc[_0xb42c('0x1d')]===_0xb42c('0x1e')&&typeof _0x1163bc[_0xb42c('0x1f')]===_0xb42c('0x1e');var _0x4b6f0f=_0xd48821['count'];var _0x5803fd=_0x348577?0x0:_0x1163bc['offset'];var _0x3e7d76=_0x348577?_0xd48821['count']:_0x1163bc['offset']+_0x1163bc['limit'];var _0x9eea65;if(_0x3e7d76>=_0x4b6f0f){_0x3e7d76=_0x4b6f0f;_0x9eea65=0xc8;}else{_0x9eea65=0xce;}_0x4b6192[_0xb42c('0x1a')](_0x9eea65);return _0x4b6192['set'](_0xb42c('0x20'),_0x5803fd+'-'+_0x3e7d76+'/'+_0x4b6f0f)[_0xb42c('0x1c')](_0xd48821);}return null;};}function patchUpdates(_0x4ce78b){return function(_0x3f868e){try{jsonpatch['apply'](_0x3f868e,_0x4ce78b,!![]);}catch(_0x11a98a){return BPromise['reject'](_0x11a98a);}return _0x3f868e[_0xb42c('0x21')]();};}function saveUpdates(_0xebdc9,_0x2f82d2){return function(_0x58baa0){if(_0x58baa0){return _0x58baa0[_0xb42c('0x22')](_0xebdc9)[_0xb42c('0x23')](function(_0x3c650e){return _0x3c650e;});}return null;};}function removeEntity(_0x5cb8c8,_0x4f2001){return function(_0x4995c3){if(_0x4995c3){return _0x4995c3[_0xb42c('0x24')]()['then'](function(){_0x5cb8c8[_0xb42c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe189dc,_0x25fff1){return function(_0x4ee333){if(!_0x4ee333){_0xe189dc[_0xb42c('0x19')](0x194);}return _0x4ee333;};}function handleError(_0x7be80d,_0x3c5f4d){_0x3c5f4d=_0x3c5f4d||0x1f4;return function(_0x463ca3){logger[_0xb42c('0x25')](_0x463ca3[_0xb42c('0x26')]);if(_0x463ca3[_0xb42c('0x27')]){delete _0x463ca3['name'];}_0x7be80d[_0xb42c('0x1a')](_0x3c5f4d)[_0xb42c('0x28')](_0x463ca3);};}exports['index']=function(_0x36895e,_0x58977c){var _0xb72394={},_0xfa4d={},_0x34b037={'count':0x0,'rows':[]};var _0x39e3c4=_[_0xb42c('0x29')](db[_0xb42c('0x2a')][_0xb42c('0x2b')],function(_0xb5556b){return{'name':_0xb5556b[_0xb42c('0x2c')],'type':_0xb5556b[_0xb42c('0x2d')][_0xb42c('0x2e')]};});_0xfa4d['model']=_[_0xb42c('0x29')](_0x39e3c4,_0xb42c('0x27'));_0xfa4d[_0xb42c('0x2f')]=_[_0xb42c('0x30')](_0x36895e[_0xb42c('0x2f')]);_0xfa4d['filters']=_[_0xb42c('0x31')](_0xfa4d[_0xb42c('0x32')],_0xfa4d['query']);_0xb72394[_0xb42c('0x33')]=_[_0xb42c('0x31')](_0xfa4d[_0xb42c('0x32')],qs['fields'](_0x36895e[_0xb42c('0x2f')]['fields']));_0xb72394[_0xb42c('0x33')]=_0xb72394[_0xb42c('0x33')][_0xb42c('0x34')]?_0xb72394[_0xb42c('0x33')]:_0xfa4d[_0xb42c('0x32')];if(!_0x36895e[_0xb42c('0x2f')][_0xb42c('0x35')](_0xb42c('0x36'))){_0xb72394['limit']=qs[_0xb42c('0x1f')](_0x36895e[_0xb42c('0x2f')][_0xb42c('0x1f')]);_0xb72394[_0xb42c('0x1d')]=qs[_0xb42c('0x1d')](_0x36895e[_0xb42c('0x2f')][_0xb42c('0x1d')]);}_0xb72394[_0xb42c('0x37')]=qs[_0xb42c('0x38')](_0x36895e['query'][_0xb42c('0x38')]);_0xb72394[_0xb42c('0x39')]=qs[_0xb42c('0x3a')](_['pick'](_0x36895e[_0xb42c('0x2f')],_0xfa4d[_0xb42c('0x3a')]),_0x39e3c4);if(_0x36895e[_0xb42c('0x2f')]['filter']){_0xb72394['where']=_[_0xb42c('0x3b')](_0xb72394[_0xb42c('0x39')],{'$or':_[_0xb42c('0x29')](_0x39e3c4,function(_0x5131d1){if(_0x5131d1['type']!==_0xb42c('0x3c')){var _0x639508={};_0x639508[_0x5131d1['name']]={'$like':'%'+_0x36895e[_0xb42c('0x2f')]['filter']+'%'};return _0x639508;}})});}_0xb72394=_[_0xb42c('0x3b')]({},_0xb72394,_0x36895e[_0xb42c('0x3d')]);var _0xb2daac={'where':_0xb72394[_0xb42c('0x39')]};return db['JscriptyQuestionReport'][_0xb42c('0x3e')](_0xb2daac)[_0xb42c('0x23')](function(_0x3ff8a6){_0x34b037[_0xb42c('0x3e')]=_0x3ff8a6;if(_0x36895e[_0xb42c('0x2f')]['includeAll']){_0xb72394['include']=[{'all':!![]}];}return db[_0xb42c('0x2a')][_0xb42c('0x3f')](_0xb72394);})[_0xb42c('0x23')](function(_0x258b7c){_0x34b037['rows']=_0x258b7c;return _0x34b037;})[_0xb42c('0x23')](respondWithFilteredResult(_0x58977c,_0xb72394))['catch'](handleError(_0x58977c,null));};exports[_0xb42c('0x40')]=function(_0x260eb9,_0x2cfdf1){var _0x91c3b2={'raw':!![],'where':{'id':_0x260eb9[_0xb42c('0x41')]['id']}},_0xe64209={};_0xe64209['model']=_[_0xb42c('0x30')](db['JscriptyQuestionReport'][_0xb42c('0x2b')]);_0xe64209[_0xb42c('0x2f')]=_[_0xb42c('0x30')](_0x260eb9[_0xb42c('0x2f')]);_0xe64209[_0xb42c('0x3a')]=_['intersection'](_0xe64209[_0xb42c('0x32')],_0xe64209['query']);_0x91c3b2[_0xb42c('0x33')]=_['intersection'](_0xe64209[_0xb42c('0x32')],qs[_0xb42c('0x42')](_0x260eb9[_0xb42c('0x2f')][_0xb42c('0x42')]));_0x91c3b2[_0xb42c('0x33')]=_0x91c3b2[_0xb42c('0x33')][_0xb42c('0x34')]?_0x91c3b2[_0xb42c('0x33')]:_0xe64209['model'];if(_0x260eb9[_0xb42c('0x2f')]['includeAll']){_0x91c3b2[_0xb42c('0x43')]=[{'all':!![]}];}_0x91c3b2=_['merge']({},_0x91c3b2,_0x260eb9['options']);return db[_0xb42c('0x2a')][_0xb42c('0x44')](_0x91c3b2)[_0xb42c('0x23')](handleEntityNotFound(_0x2cfdf1,null))[_0xb42c('0x23')](respondWithResult(_0x2cfdf1,null))[_0xb42c('0x45')](handleError(_0x2cfdf1,null));};exports['create']=function(_0x4a1651,_0x31acef){return db[_0xb42c('0x2a')][_0xb42c('0x46')](_0x4a1651[_0xb42c('0x47')],{})[_0xb42c('0x23')](respondWithResult(_0x31acef,0xc9))[_0xb42c('0x45')](handleError(_0x31acef,null));};exports[_0xb42c('0x22')]=function(_0x3926a5,_0x2ca89d){if(_0x3926a5['body']['id']){delete _0x3926a5[_0xb42c('0x47')]['id'];}return db[_0xb42c('0x2a')][_0xb42c('0x44')]({'where':{'id':_0x3926a5[_0xb42c('0x41')]['id']}})['then'](handleEntityNotFound(_0x2ca89d,null))[_0xb42c('0x23')](saveUpdates(_0x3926a5['body'],null))[_0xb42c('0x23')](respondWithResult(_0x2ca89d,null))[_0xb42c('0x45')](handleError(_0x2ca89d,null));};exports[_0xb42c('0x24')]=function(_0x40f160,_0x583ba2){return db[_0xb42c('0x2a')][_0xb42c('0x44')]({'where':{'id':_0x40f160[_0xb42c('0x41')]['id']}})[_0xb42c('0x23')](handleEntityNotFound(_0x583ba2,null))[_0xb42c('0x23')](removeEntity(_0x583ba2,null))[_0xb42c('0x45')](handleError(_0x583ba2,null));};exports[_0xb42c('0x48')]=function(_0x4f76a7,_0x28bf6c){return db[_0xb42c('0x2a')]['describe']()['then'](respondWithResult(_0x28bf6c,null))[_0xb42c('0x45')](handleError(_0x28bf6c,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 2b7e933..8b3f9cb 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 _0xbe29=['exports','define','report_jscripty_questions','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./jscriptyQuestionReport.attributes'];(function(_0xef5464,_0xdcfb9){var _0x13336d=function(_0x5e2624){while(--_0x5e2624){_0xef5464['push'](_0xef5464['shift']());}};_0x13336d(++_0xdcfb9);}(_0xbe29,0x9d));var _0x9be2=function(_0x4e5552,_0x19ec4e){_0x4e5552=_0x4e5552-0x0;var _0x60a338=_0xbe29[_0x4e5552];return _0x60a338;};'use strict';var _=require('lodash');var util=require(_0x9be2('0x0'));var logger=require(_0x9be2('0x1'))(_0x9be2('0x2'));var moment=require(_0x9be2('0x3'));var BPromise=require(_0x9be2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9be2('0x5'));var rimraf=require('rimraf');var config=require(_0x9be2('0x6'));var attributes=require(_0x9be2('0x7'));module[_0x9be2('0x8')]=function(_0x5bbe6d,_0x309544){return _0x5bbe6d[_0x9be2('0x9')]('JscriptyQuestionReport',attributes,{'tableName':_0x9be2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x808b=['moment','bluebird','request-promise','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','define','JscriptyQuestionReport','report_jscripty_questions','util','../../config/logger','api'];(function(_0x20c9b2,_0x55d7b1){var _0x2c6030=function(_0x10845f){while(--_0x10845f){_0x20c9b2['push'](_0x20c9b2['shift']());}};_0x2c6030(++_0x55d7b1);}(_0x808b,0x135));var _0xb808=function(_0x130149,_0x535e7e){_0x130149=_0x130149-0x0;var _0x2afdb3=_0x808b[_0x130149];return _0x2afdb3;};'use strict';var _=require('lodash');var util=require(_0xb808('0x0'));var logger=require(_0xb808('0x1'))(_0xb808('0x2'));var moment=require(_0xb808('0x3'));var BPromise=require(_0xb808('0x4'));var rp=require(_0xb808('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb808('0x6'));var config=require(_0xb808('0x7'));var attributes=require(_0xb808('0x8'));module['exports']=function(_0x2e3f45,_0x2f84a4){return _0x2e3f45[_0xb808('0x9')](_0xb808('0xa'),attributes,{'tableName':_0xb808('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index 41a5af3..2dcbc55 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 _0x146d=['http','request','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x41f15f,_0x1a39ef){var _0x269a71=function(_0x52c50e){while(--_0x52c50e){_0x41f15f['push'](_0x41f15f['shift']());}};_0x269a71(++_0x1a39ef);}(_0x146d,0x13c));var _0xd146=function(_0x4ffbb0,_0x5b28ea){_0x4ffbb0=_0x4ffbb0-0x0;var _0xd29dd8=_0x146d[_0x4ffbb0];return _0xd29dd8;};'use strict';var _=require(_0xd146('0x0'));var util=require(_0xd146('0x1'));var moment=require(_0xd146('0x2'));var BPromise=require(_0xd146('0x3'));var rs=require(_0xd146('0x4'));var fs=require('fs');var Redis=require(_0xd146('0x5'));var db=require(_0xd146('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd146('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xd146('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x16c1bb,_0x46420c,_0x148b5b){return new BPromise(function(_0x513459,_0x3da450){return client[_0xd146('0x9')](_0x16c1bb,_0x148b5b)['then'](function(_0x4921b1){logger[_0xd146('0xa')](_0xd146('0xb'),_0x46420c,_0xd146('0xc'));logger['debug'](_0xd146('0xd'),_0x46420c,'request\x20sent',JSON[_0xd146('0xe')](_0x4921b1));if(_0x4921b1[_0xd146('0xf')]){if(_0x4921b1['error']['code']===0x1f4){logger[_0xd146('0xf')](_0xd146('0xb'),_0x46420c,_0x4921b1[_0xd146('0xf')]['message']);return _0x3da450(_0x4921b1['error']['message']);}logger['error'](_0xd146('0xb'),_0x46420c,_0x4921b1['error']['message']);return _0x513459(_0x4921b1[_0xd146('0xf')][_0xd146('0x10')]);}else{logger[_0xd146('0xa')](_0xd146('0xb'),_0x46420c,_0xd146('0xc'));_0x513459(_0x4921b1['result']['message']);}})[_0xd146('0x11')](function(_0xa5ce96){logger[_0xd146('0xf')](_0xd146('0xb'),_0x46420c,_0xa5ce96);_0x3da450(_0xa5ce96);});});} \ No newline at end of file +var _0x5df2=['http','request','then','info','request\x20sent','debug','stringify','error','code','message','JscriptyQuestionReport,\x20%s,\x20%s','result','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x13ce0c,_0x3f2a0d){var _0x4388fb=function(_0x27db4b){while(--_0x27db4b){_0x13ce0c['push'](_0x13ce0c['shift']());}};_0x4388fb(++_0x3f2a0d);}(_0x5df2,0x19b));var _0x25df=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0x5df2[_0x1deb03];return _0x189fe7;};'use strict';var _=require('lodash');var util=require(_0x25df('0x0'));var moment=require(_0x25df('0x1'));var BPromise=require('bluebird');var rs=require(_0x25df('0x2'));var fs=require('fs');var Redis=require(_0x25df('0x3'));var db=require(_0x25df('0x4'))['db'];var utils=require(_0x25df('0x5'));var logger=require(_0x25df('0x6'))(_0x25df('0x7'));var config=require(_0x25df('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x25df('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1b5453,_0x217511,_0x7edfc4){return new BPromise(function(_0x42384a,_0x363027){return client[_0x25df('0xa')](_0x1b5453,_0x7edfc4)[_0x25df('0xb')](function(_0x4aee4f){logger[_0x25df('0xc')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x217511,_0x25df('0xd'));logger[_0x25df('0xe')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x217511,_0x25df('0xd'),JSON[_0x25df('0xf')](_0x4aee4f));if(_0x4aee4f[_0x25df('0x10')]){if(_0x4aee4f[_0x25df('0x10')][_0x25df('0x11')]===0x1f4){logger[_0x25df('0x10')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x217511,_0x4aee4f[_0x25df('0x10')][_0x25df('0x12')]);return _0x363027(_0x4aee4f['error']['message']);}logger[_0x25df('0x10')](_0x25df('0x13'),_0x217511,_0x4aee4f[_0x25df('0x10')][_0x25df('0x12')]);return _0x42384a(_0x4aee4f[_0x25df('0x10')][_0x25df('0x12')]);}else{logger['info'](_0x25df('0x13'),_0x217511,_0x25df('0xd'));_0x42384a(_0x4aee4f[_0x25df('0x14')][_0x25df('0x12')]);}})['catch'](function(_0x56f3cc){logger[_0x25df('0x10')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x217511,_0x56f3cc);_0x363027(_0x56f3cc);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 610c467..f356433 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 _0xaad7=['get','isAuthenticated','index','/describe','describe','/:id','show','/:id/questions','post','create','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x44f974,_0x4db616){var _0x805dbd=function(_0x1a56b7){while(--_0x1a56b7){_0x44f974['push'](_0x44f974['shift']());}};_0x805dbd(++_0x4db616);}(_0xaad7,0x1b0));var _0x7aad=function(_0x4853be,_0x53f681){_0x4853be=_0x4853be-0x0;var _0xd5315e=_0xaad7[_0x4853be];return _0xd5315e;};'use strict';var multer=require(_0x7aad('0x0'));var util=require(_0x7aad('0x1'));var path=require('path');var timeout=require(_0x7aad('0x2'));var express=require(_0x7aad('0x3'));var router=express['Router']();var fs_extra=require(_0x7aad('0x4'));var auth=require(_0x7aad('0x5'));var interaction=require(_0x7aad('0x6'));var config=require(_0x7aad('0x7'));var controller=require('./jscriptySessionReport.controller');router[_0x7aad('0x8')]('/',auth[_0x7aad('0x9')](),controller[_0x7aad('0xa')]);router[_0x7aad('0x8')](_0x7aad('0xb'),auth[_0x7aad('0x9')](),controller[_0x7aad('0xc')]);router['get'](_0x7aad('0xd'),auth[_0x7aad('0x9')](),controller[_0x7aad('0xe')]);router[_0x7aad('0x8')](_0x7aad('0xf'),auth[_0x7aad('0x9')](),controller['getQuestions']);router[_0x7aad('0x10')]('/',auth[_0x7aad('0x9')](),controller[_0x7aad('0x11')]);router['put'](_0x7aad('0xd'),auth['isAuthenticated'](),controller[_0x7aad('0x12')]);router[_0x7aad('0x13')]('/:id',auth[_0x7aad('0x9')](),controller[_0x7aad('0x14')]);module[_0x7aad('0x15')]=router; \ No newline at end of file +var _0x3552=['../../components/interaction/service','isAuthenticated','index','get','/describe','/:id','/:id/questions','getQuestions','post','create','put','destroy','multer','path','connect-timeout','express','Router'];(function(_0x494d7a,_0xbda44a){var _0x51fca3=function(_0x117ed8){while(--_0x117ed8){_0x494d7a['push'](_0x494d7a['shift']());}};_0x51fca3(++_0xbda44a);}(_0x3552,0x171));var _0x2355=function(_0x2b6be9,_0x5cc118){_0x2b6be9=_0x2b6be9-0x0;var _0x3a847a=_0x3552[_0x2b6be9];return _0x3a847a;};'use strict';var multer=require(_0x2355('0x0'));var util=require('util');var path=require(_0x2355('0x1'));var timeout=require(_0x2355('0x2'));var express=require(_0x2355('0x3'));var router=express[_0x2355('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2355('0x5'));var config=require('../../config/environment');var controller=require('./jscriptySessionReport.controller');router['get']('/',auth[_0x2355('0x6')](),controller[_0x2355('0x7')]);router[_0x2355('0x8')](_0x2355('0x9'),auth[_0x2355('0x6')](),controller['describe']);router['get'](_0x2355('0xa'),auth[_0x2355('0x6')](),controller['show']);router[_0x2355('0x8')](_0x2355('0xb'),auth[_0x2355('0x6')](),controller[_0x2355('0xc')]);router[_0x2355('0xd')]('/',auth[_0x2355('0x6')](),controller[_0x2355('0xe')]);router[_0x2355('0xf')](_0x2355('0xa'),auth[_0x2355('0x6')](),controller['update']);router['delete']('/:id',auth[_0x2355('0x6')](),controller[_0x2355('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 83d3f14..31eddf5 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 _0xaf97=['starttime','setDataValue','endtime','format','STRING','BOOLEAN','moment','sequelize','exports','DATE'];(function(_0x5bdf64,_0x4e5c71){var _0x323a2c=function(_0x1e3f51){while(--_0x1e3f51){_0x5bdf64['push'](_0x5bdf64['shift']());}};_0x323a2c(++_0x4e5c71);}(_0xaf97,0x15a));var _0x7af9=function(_0x5ba9d1,_0x4ef651){_0x5ba9d1=_0x5ba9d1-0x0;var _0x1bb891=_0xaf97[_0x5ba9d1];return _0x1bb891;};'use strict';var moment=require(_0x7af9('0x0'));var Sequelize=require(_0x7af9('0x1'));module[_0x7af9('0x2')]={'starttime':{'type':Sequelize[_0x7af9('0x3')],'set':function(_0x14c3e0){this['setDataValue'](_0x7af9('0x4'),_0x14c3e0);this[_0x7af9('0x5')](_0x7af9('0x6'),moment()[_0x7af9('0x7')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0x7af9('0x3')]},'membername':{'type':Sequelize[_0x7af9('0x8')]},'projectname':{'type':Sequelize[_0x7af9('0x8')]},'queue':{'type':Sequelize[_0x7af9('0x8')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x7af9('0x8')]},'calleridnum':{'type':Sequelize[_0x7af9('0x8')]},'completed':{'type':Sequelize[_0x7af9('0x9')],'defaultValue':![]}}; \ No newline at end of file +var _0x6aa4=['setDataValue','endtime','format','STRING','BOOLEAN','sequelize','DATE','starttime'];(function(_0x55255e,_0x490aad){var _0x1a1622=function(_0x5cbf77){while(--_0x5cbf77){_0x55255e['push'](_0x55255e['shift']());}};_0x1a1622(++_0x490aad);}(_0x6aa4,0x15d));var _0x46aa=function(_0x1050e3,_0x39b6c0){_0x1050e3=_0x1050e3-0x0;var _0x2064d7=_0x6aa4[_0x1050e3];return _0x2064d7;};'use strict';var moment=require('moment');var Sequelize=require(_0x46aa('0x0'));module['exports']={'starttime':{'type':Sequelize[_0x46aa('0x1')],'set':function(_0x591fec){this['setDataValue'](_0x46aa('0x2'),_0x591fec);this[_0x46aa('0x3')](_0x46aa('0x4'),moment()[_0x46aa('0x5')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0x46aa('0x1')]},'membername':{'type':Sequelize[_0x46aa('0x6')]},'projectname':{'type':Sequelize[_0x46aa('0x6')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x46aa('0x6')]},'calleridname':{'type':Sequelize[_0x46aa('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0x46aa('0x7')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 996ac36..2ee0f3e 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 _0xf0a8=['merge','options','includeAll','findAll','rows','params','include','find','create','body','catch','describe','findOne','JscriptyQuestionReport','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','end','sendStatus','error','name','send','index','JscriptySessionReport','rawAttributes','fieldName','type','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','map','VIRTUAL','filter'];(function(_0x4b671e,_0x266951){var _0x1c65ee=function(_0x2e983a){while(--_0x2e983a){_0x4b671e['push'](_0x4b671e['shift']());}};_0x1c65ee(++_0x266951);}(_0xf0a8,0x104));var _0x8f0a=function(_0x46ee42,_0x41ac62){_0x46ee42=_0x46ee42-0x0;var _0x2c2f75=_0xf0a8[_0x46ee42];return _0x2c2f75;};'use strict';var emlformat=require(_0x8f0a('0x0'));var rimraf=require(_0x8f0a('0x1'));var zipdir=require(_0x8f0a('0x2'));var jsonpatch=require(_0x8f0a('0x3'));var rp=require(_0x8f0a('0x4'));var moment=require(_0x8f0a('0x5'));var BPromise=require(_0x8f0a('0x6'));var Mustache=require(_0x8f0a('0x7'));var util=require('util');var path=require(_0x8f0a('0x8'));var sox=require(_0x8f0a('0x9'));var csv=require(_0x8f0a('0xa'));var ejs=require(_0x8f0a('0xb'));var fs=require('fs');var fs_extra=require(_0x8f0a('0xc'));var _=require(_0x8f0a('0xd'));var squel=require(_0x8f0a('0xe'));var crypto=require(_0x8f0a('0xf'));var jsforce=require(_0x8f0a('0x10'));var deskjs=require(_0x8f0a('0x11'));var toCsv=require(_0x8f0a('0xa'));var querystring=require(_0x8f0a('0x12'));var Papa=require('papaparse');var Redis=require(_0x8f0a('0x13'));var authService=require(_0x8f0a('0x14'));var qs=require(_0x8f0a('0x15'));var as=require(_0x8f0a('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8f0a('0x17'))('api');var utils=require(_0x8f0a('0x18'));var config=require(_0x8f0a('0x19'));var licenseUtil=require(_0x8f0a('0x1a'));var db=require(_0x8f0a('0x1b'))['db'];function respondWithStatusCode(_0x10dae0,_0xa3c301){_0xa3c301=_0xa3c301||0xcc;return function(_0x450a55){if(_0x450a55){return _0x10dae0['sendStatus'](_0xa3c301);}return _0x10dae0['status'](_0xa3c301)['end']();};}function respondWithResult(_0x38be19,_0x5399b3){_0x5399b3=_0x5399b3||0xc8;return function(_0x2822b4){if(_0x2822b4){return _0x38be19[_0x8f0a('0x1c')](_0x5399b3)[_0x8f0a('0x1d')](_0x2822b4);}};}function respondWithFilteredResult(_0x138731,_0x3b864b){return function(_0x27943f){if(_0x27943f){var _0x2e607a=typeof _0x3b864b[_0x8f0a('0x1e')]===_0x8f0a('0x1f')&&typeof _0x3b864b[_0x8f0a('0x20')]===_0x8f0a('0x1f');var _0x25dcd1=_0x27943f[_0x8f0a('0x21')];var _0x1cd663=_0x2e607a?0x0:_0x3b864b['offset'];var _0x35f455=_0x2e607a?_0x27943f[_0x8f0a('0x21')]:_0x3b864b[_0x8f0a('0x1e')]+_0x3b864b[_0x8f0a('0x20')];var _0x48523a;if(_0x35f455>=_0x25dcd1){_0x35f455=_0x25dcd1;_0x48523a=0xc8;}else{_0x48523a=0xce;}_0x138731[_0x8f0a('0x1c')](_0x48523a);return _0x138731[_0x8f0a('0x22')](_0x8f0a('0x23'),_0x1cd663+'-'+_0x35f455+'/'+_0x25dcd1)[_0x8f0a('0x1d')](_0x27943f);}return null;};}function patchUpdates(_0x596f87){return function(_0x444ece){try{jsonpatch[_0x8f0a('0x24')](_0x444ece,_0x596f87,!![]);}catch(_0x607371){return BPromise[_0x8f0a('0x25')](_0x607371);}return _0x444ece[_0x8f0a('0x26')]();};}function saveUpdates(_0x46124a,_0x3321d9){return function(_0xeaf28f){if(_0xeaf28f){return _0xeaf28f['update'](_0x46124a)[_0x8f0a('0x27')](function(_0x18c8f3){return _0x18c8f3;});}return null;};}function removeEntity(_0x1d1302,_0x281ae3){return function(_0x58f110){if(_0x58f110){return _0x58f110[_0x8f0a('0x28')]()[_0x8f0a('0x27')](function(){_0x1d1302[_0x8f0a('0x1c')](0xcc)[_0x8f0a('0x29')]();});}};}function handleEntityNotFound(_0xda2569,_0x1ec857){return function(_0x351878){if(!_0x351878){_0xda2569[_0x8f0a('0x2a')](0x194);}return _0x351878;};}function handleError(_0x59e96f,_0x2205e0){_0x2205e0=_0x2205e0||0x1f4;return function(_0xe7bde1){logger[_0x8f0a('0x2b')](_0xe7bde1['stack']);if(_0xe7bde1['name']){delete _0xe7bde1[_0x8f0a('0x2c')];}_0x59e96f[_0x8f0a('0x1c')](_0x2205e0)[_0x8f0a('0x2d')](_0xe7bde1);};}exports[_0x8f0a('0x2e')]=function(_0x5ead0d,_0x406d59){var _0x531e5d={},_0x408b8b={},_0x3aac59={'count':0x0,'rows':[]};var _0x4dbc50=_['map'](db[_0x8f0a('0x2f')][_0x8f0a('0x30')],function(_0x208e11){return{'name':_0x208e11[_0x8f0a('0x31')],'type':_0x208e11[_0x8f0a('0x32')]['key']};});_0x408b8b['model']=_['map'](_0x4dbc50,'name');_0x408b8b[_0x8f0a('0x33')]=_[_0x8f0a('0x34')](_0x5ead0d[_0x8f0a('0x33')]);_0x408b8b['filters']=_[_0x8f0a('0x35')](_0x408b8b[_0x8f0a('0x36')],_0x408b8b['query']);_0x531e5d['attributes']=_[_0x8f0a('0x35')](_0x408b8b[_0x8f0a('0x36')],qs['fields'](_0x5ead0d[_0x8f0a('0x33')][_0x8f0a('0x37')]));_0x531e5d['attributes']=_0x531e5d[_0x8f0a('0x38')][_0x8f0a('0x39')]?_0x531e5d['attributes']:_0x408b8b[_0x8f0a('0x36')];if(!_0x5ead0d[_0x8f0a('0x33')][_0x8f0a('0x3a')](_0x8f0a('0x3b'))){_0x531e5d[_0x8f0a('0x20')]=qs[_0x8f0a('0x20')](_0x5ead0d[_0x8f0a('0x33')][_0x8f0a('0x20')]);_0x531e5d[_0x8f0a('0x1e')]=qs['offset'](_0x5ead0d[_0x8f0a('0x33')][_0x8f0a('0x1e')]);}_0x531e5d[_0x8f0a('0x3c')]=qs[_0x8f0a('0x3d')](_0x5ead0d['query'][_0x8f0a('0x3d')]);_0x531e5d[_0x8f0a('0x3e')]=qs[_0x8f0a('0x3f')](_[_0x8f0a('0x40')](_0x5ead0d[_0x8f0a('0x33')],_0x408b8b[_0x8f0a('0x3f')]),_0x4dbc50);if(_0x5ead0d[_0x8f0a('0x33')]['filter']){_0x531e5d[_0x8f0a('0x3e')]=_['merge'](_0x531e5d[_0x8f0a('0x3e')],{'$or':_[_0x8f0a('0x41')](_0x4dbc50,function(_0x51d617){if(_0x51d617[_0x8f0a('0x32')]!==_0x8f0a('0x42')){var _0x1e2627={};_0x1e2627[_0x51d617[_0x8f0a('0x2c')]]={'$like':'%'+_0x5ead0d[_0x8f0a('0x33')][_0x8f0a('0x43')]+'%'};return _0x1e2627;}})});}_0x531e5d=_[_0x8f0a('0x44')]({},_0x531e5d,_0x5ead0d[_0x8f0a('0x45')]);var _0x2b47b6={'where':_0x531e5d[_0x8f0a('0x3e')]};return db[_0x8f0a('0x2f')][_0x8f0a('0x21')](_0x2b47b6)['then'](function(_0x32d62e){_0x3aac59['count']=_0x32d62e;if(_0x5ead0d['query'][_0x8f0a('0x46')]){_0x531e5d['include']=[{'all':!![]}];}return db[_0x8f0a('0x2f')][_0x8f0a('0x47')](_0x531e5d);})[_0x8f0a('0x27')](function(_0xcbbb3){_0x3aac59[_0x8f0a('0x48')]=_0xcbbb3;return _0x3aac59;})[_0x8f0a('0x27')](respondWithFilteredResult(_0x406d59,_0x531e5d))['catch'](handleError(_0x406d59,null));};exports['show']=function(_0x313e3e,_0x5bc28e){var _0x220c59={'raw':!![],'where':{'id':_0x313e3e[_0x8f0a('0x49')]['id']}},_0x2e7340={};_0x2e7340[_0x8f0a('0x36')]=_[_0x8f0a('0x34')](db[_0x8f0a('0x2f')]['rawAttributes']);_0x2e7340['query']=_['keys'](_0x313e3e['query']);_0x2e7340[_0x8f0a('0x3f')]=_[_0x8f0a('0x35')](_0x2e7340[_0x8f0a('0x36')],_0x2e7340[_0x8f0a('0x33')]);_0x220c59['attributes']=_[_0x8f0a('0x35')](_0x2e7340[_0x8f0a('0x36')],qs['fields'](_0x313e3e['query'][_0x8f0a('0x37')]));_0x220c59[_0x8f0a('0x38')]=_0x220c59[_0x8f0a('0x38')][_0x8f0a('0x39')]?_0x220c59[_0x8f0a('0x38')]:_0x2e7340[_0x8f0a('0x36')];if(_0x313e3e[_0x8f0a('0x33')]['includeAll']){_0x220c59[_0x8f0a('0x4a')]=[{'all':!![]}];}_0x220c59=_['merge']({},_0x220c59,_0x313e3e[_0x8f0a('0x45')]);return db['JscriptySessionReport'][_0x8f0a('0x4b')](_0x220c59)[_0x8f0a('0x27')](handleEntityNotFound(_0x5bc28e,null))[_0x8f0a('0x27')](respondWithResult(_0x5bc28e,null))['catch'](handleError(_0x5bc28e,null));};exports[_0x8f0a('0x4c')]=function(_0x20a3e8,_0x2323a8){return db[_0x8f0a('0x2f')]['create'](_0x20a3e8[_0x8f0a('0x4d')],{})['then'](respondWithResult(_0x2323a8,0xc9))[_0x8f0a('0x4e')](handleError(_0x2323a8,null));};exports['update']=function(_0x3fb75f,_0x50bf7){if(_0x3fb75f[_0x8f0a('0x4d')]['id']){delete _0x3fb75f['body']['id'];}return db['JscriptySessionReport'][_0x8f0a('0x4b')]({'where':{'id':_0x3fb75f['params']['id']}})[_0x8f0a('0x27')](handleEntityNotFound(_0x50bf7,null))[_0x8f0a('0x27')](saveUpdates(_0x3fb75f['body'],null))[_0x8f0a('0x27')](respondWithResult(_0x50bf7,null))[_0x8f0a('0x4e')](handleError(_0x50bf7,null));};exports[_0x8f0a('0x28')]=function(_0x22c54e,_0x426f92){return db[_0x8f0a('0x2f')][_0x8f0a('0x4b')]({'where':{'id':_0x22c54e[_0x8f0a('0x49')]['id']}})[_0x8f0a('0x27')](handleEntityNotFound(_0x426f92,null))[_0x8f0a('0x27')](removeEntity(_0x426f92,null))[_0x8f0a('0x4e')](handleError(_0x426f92,null));};exports['describe']=function(_0x18ad91,_0x5c803d){return db[_0x8f0a('0x2f')][_0x8f0a('0x4f')]()['then'](respondWithResult(_0x5c803d,null))[_0x8f0a('0x4e')](handleError(_0x5c803d,null));};exports['getQuestions']=function(_0x56332c,_0x491832,_0x1040d7){var _0x4fe0b5={'raw':!![],'where':{}};var _0x40fbe2={};var _0xef335e={'count':0x0,'rows':[]};return db[_0x8f0a('0x2f')][_0x8f0a('0x50')]({'where':{'id':_0x56332c[_0x8f0a('0x49')]['id']}})['then'](handleEntityNotFound(_0x491832,null))[_0x8f0a('0x27')](function(_0x362472){if(_0x362472){_0x40fbe2[_0x8f0a('0x36')]=_[_0x8f0a('0x34')](db[_0x8f0a('0x51')][_0x8f0a('0x30')]);_0x40fbe2['query']=_[_0x8f0a('0x34')](_0x56332c[_0x8f0a('0x33')]);_0x40fbe2[_0x8f0a('0x3f')]=_[_0x8f0a('0x35')](_0x40fbe2[_0x8f0a('0x36')],_0x40fbe2[_0x8f0a('0x33')]);_0x4fe0b5['attributes']=_['intersection'](_0x40fbe2[_0x8f0a('0x36')],qs[_0x8f0a('0x37')](_0x56332c[_0x8f0a('0x33')][_0x8f0a('0x37')]));_0x4fe0b5[_0x8f0a('0x38')]=_0x4fe0b5['attributes'][_0x8f0a('0x39')]?_0x4fe0b5[_0x8f0a('0x38')]:_0x40fbe2[_0x8f0a('0x36')];if(!_0x56332c[_0x8f0a('0x33')][_0x8f0a('0x3a')]('nolimit')){_0x4fe0b5[_0x8f0a('0x20')]=qs[_0x8f0a('0x20')](_0x56332c[_0x8f0a('0x33')][_0x8f0a('0x20')]);_0x4fe0b5[_0x8f0a('0x1e')]=qs['offset'](_0x56332c[_0x8f0a('0x33')][_0x8f0a('0x1e')]);}_0x4fe0b5['order']=qs[_0x8f0a('0x3d')](_0x56332c[_0x8f0a('0x33')][_0x8f0a('0x3d')]);_0x4fe0b5['where']=qs['filters'](_['pick'](_0x56332c[_0x8f0a('0x33')],_0x40fbe2[_0x8f0a('0x3f')]));_0x4fe0b5[_0x8f0a('0x3e')]['SessionId']=_0x362472['id'];if(_0x56332c[_0x8f0a('0x33')][_0x8f0a('0x43')]){_0x4fe0b5[_0x8f0a('0x3e')]=_[_0x8f0a('0x44')](_0x4fe0b5[_0x8f0a('0x3e')],{'$or':_[_0x8f0a('0x41')](_0x4fe0b5[_0x8f0a('0x38')],function(_0x1c7f8e){var _0x54c624={};_0x54c624[_0x1c7f8e]={'$like':'%'+_0x56332c[_0x8f0a('0x33')][_0x8f0a('0x43')]+'%'};return _0x54c624;})});}_0x4fe0b5=_['merge']({},_0x4fe0b5,_0x56332c[_0x8f0a('0x45')]);return db[_0x8f0a('0x51')][_0x8f0a('0x21')]({'where':_0x4fe0b5[_0x8f0a('0x3e')]})[_0x8f0a('0x27')](function(_0x179df1){_0xef335e[_0x8f0a('0x21')]=_0x179df1;if(_0x56332c['query'][_0x8f0a('0x46')]){_0x4fe0b5[_0x8f0a('0x4a')]=[{'all':!![]}];}return db[_0x8f0a('0x51')][_0x8f0a('0x47')](_0x4fe0b5);})[_0x8f0a('0x27')](function(_0x5920d3){_0xef335e[_0x8f0a('0x48')]=_0x5920d3;return _0xef335e;});}})[_0x8f0a('0x27')](respondWithFilteredResult(_0x491832,_0x4fe0b5))['catch'](handleError(_0x491832,null));}; \ No newline at end of file +var _0xb19f=['params','create','body','find','describe','getQuestions','findOne','JscriptyQuestionReport','SessionId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show'];(function(_0x5c06c2,_0x488c06){var _0x3ff502=function(_0x230697){while(--_0x230697){_0x5c06c2['push'](_0x5c06c2['shift']());}};_0x3ff502(++_0x488c06);}(_0xb19f,0xa9));var _0xfb19=function(_0x34bb68,_0x5b0079){_0x34bb68=_0x34bb68-0x0;var _0x3db9fb=_0xb19f[_0x34bb68];return _0x3db9fb;};'use strict';var emlformat=require(_0xfb19('0x0'));var rimraf=require(_0xfb19('0x1'));var zipdir=require(_0xfb19('0x2'));var jsonpatch=require(_0xfb19('0x3'));var rp=require(_0xfb19('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xfb19('0x5'));var util=require(_0xfb19('0x6'));var path=require(_0xfb19('0x7'));var sox=require('sox');var csv=require(_0xfb19('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfb19('0x9'));var squel=require(_0xfb19('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xfb19('0xb'));var toCsv=require(_0xfb19('0x8'));var querystring=require(_0xfb19('0xc'));var Papa=require('papaparse');var Redis=require(_0xfb19('0xd'));var authService=require(_0xfb19('0xe'));var qs=require(_0xfb19('0xf'));var as=require(_0xfb19('0x10'));var hardwareService=require(_0xfb19('0x11'));var logger=require(_0xfb19('0x12'))(_0xfb19('0x13'));var utils=require(_0xfb19('0x14'));var config=require(_0xfb19('0x15'));var licenseUtil=require(_0xfb19('0x16'));var db=require(_0xfb19('0x17'))['db'];function respondWithStatusCode(_0x225132,_0x1ebd53){_0x1ebd53=_0x1ebd53||0xcc;return function(_0x36ceb8){if(_0x36ceb8){return _0x225132['sendStatus'](_0x1ebd53);}return _0x225132[_0xfb19('0x18')](_0x1ebd53)[_0xfb19('0x19')]();};}function respondWithResult(_0x410c3e,_0x2bcde6){_0x2bcde6=_0x2bcde6||0xc8;return function(_0x50901d){if(_0x50901d){return _0x410c3e['status'](_0x2bcde6)[_0xfb19('0x1a')](_0x50901d);}};}function respondWithFilteredResult(_0x861e17,_0x1e45ea){return function(_0x58402c){if(_0x58402c){var _0x26112f=typeof _0x1e45ea[_0xfb19('0x1b')]==='undefined'&&typeof _0x1e45ea[_0xfb19('0x1c')]===_0xfb19('0x1d');var _0x11c0c8=_0x58402c['count'];var _0x4cecc8=_0x26112f?0x0:_0x1e45ea[_0xfb19('0x1b')];var _0x37da12=_0x26112f?_0x58402c[_0xfb19('0x1e')]:_0x1e45ea[_0xfb19('0x1b')]+_0x1e45ea[_0xfb19('0x1c')];var _0x2e16fb;if(_0x37da12>=_0x11c0c8){_0x37da12=_0x11c0c8;_0x2e16fb=0xc8;}else{_0x2e16fb=0xce;}_0x861e17[_0xfb19('0x18')](_0x2e16fb);return _0x861e17[_0xfb19('0x1f')](_0xfb19('0x20'),_0x4cecc8+'-'+_0x37da12+'/'+_0x11c0c8)[_0xfb19('0x1a')](_0x58402c);}return null;};}function patchUpdates(_0x5d078e){return function(_0x5a2634){try{jsonpatch['apply'](_0x5a2634,_0x5d078e,!![]);}catch(_0x25b66c){return BPromise[_0xfb19('0x21')](_0x25b66c);}return _0x5a2634[_0xfb19('0x22')]();};}function saveUpdates(_0x2e8165,_0x4d866e){return function(_0x42387b){if(_0x42387b){return _0x42387b[_0xfb19('0x23')](_0x2e8165)[_0xfb19('0x24')](function(_0x2fdf17){return _0x2fdf17;});}return null;};}function removeEntity(_0x1f2f64,_0x16e9d4){return function(_0x5eabfb){if(_0x5eabfb){return _0x5eabfb[_0xfb19('0x25')]()[_0xfb19('0x24')](function(){_0x1f2f64['status'](0xcc)[_0xfb19('0x19')]();});}};}function handleEntityNotFound(_0xe93278,_0x5bb3e4){return function(_0x184047){if(!_0x184047){_0xe93278[_0xfb19('0x26')](0x194);}return _0x184047;};}function handleError(_0x47061d,_0x5ba4dc){_0x5ba4dc=_0x5ba4dc||0x1f4;return function(_0x44b92d){logger['error'](_0x44b92d[_0xfb19('0x27')]);if(_0x44b92d['name']){delete _0x44b92d[_0xfb19('0x28')];}_0x47061d[_0xfb19('0x18')](_0x5ba4dc)[_0xfb19('0x29')](_0x44b92d);};}exports[_0xfb19('0x2a')]=function(_0x3f3e6d,_0x4f9dad){var _0x38c92c={},_0x2d0edb={},_0x48b206={'count':0x0,'rows':[]};var _0x2dd7c7=_[_0xfb19('0x2b')](db[_0xfb19('0x2c')][_0xfb19('0x2d')],function(_0x209ef3){return{'name':_0x209ef3[_0xfb19('0x2e')],'type':_0x209ef3[_0xfb19('0x2f')]['key']};});_0x2d0edb[_0xfb19('0x30')]=_[_0xfb19('0x2b')](_0x2dd7c7,_0xfb19('0x28'));_0x2d0edb[_0xfb19('0x31')]=_[_0xfb19('0x32')](_0x3f3e6d[_0xfb19('0x31')]);_0x2d0edb[_0xfb19('0x33')]=_[_0xfb19('0x34')](_0x2d0edb[_0xfb19('0x30')],_0x2d0edb[_0xfb19('0x31')]);_0x38c92c[_0xfb19('0x35')]=_[_0xfb19('0x34')](_0x2d0edb['model'],qs['fields'](_0x3f3e6d[_0xfb19('0x31')][_0xfb19('0x36')]));_0x38c92c['attributes']=_0x38c92c[_0xfb19('0x35')][_0xfb19('0x37')]?_0x38c92c[_0xfb19('0x35')]:_0x2d0edb[_0xfb19('0x30')];if(!_0x3f3e6d[_0xfb19('0x31')]['hasOwnProperty'](_0xfb19('0x38'))){_0x38c92c[_0xfb19('0x1c')]=qs[_0xfb19('0x1c')](_0x3f3e6d[_0xfb19('0x31')][_0xfb19('0x1c')]);_0x38c92c[_0xfb19('0x1b')]=qs[_0xfb19('0x1b')](_0x3f3e6d[_0xfb19('0x31')][_0xfb19('0x1b')]);}_0x38c92c[_0xfb19('0x39')]=qs[_0xfb19('0x3a')](_0x3f3e6d['query'][_0xfb19('0x3a')]);_0x38c92c[_0xfb19('0x3b')]=qs[_0xfb19('0x33')](_[_0xfb19('0x3c')](_0x3f3e6d['query'],_0x2d0edb[_0xfb19('0x33')]),_0x2dd7c7);if(_0x3f3e6d[_0xfb19('0x31')]['filter']){_0x38c92c[_0xfb19('0x3b')]=_[_0xfb19('0x3d')](_0x38c92c['where'],{'$or':_['map'](_0x2dd7c7,function(_0x3e4957){if(_0x3e4957[_0xfb19('0x2f')]!==_0xfb19('0x3e')){var _0x7c5e81={};_0x7c5e81[_0x3e4957[_0xfb19('0x28')]]={'$like':'%'+_0x3f3e6d[_0xfb19('0x31')][_0xfb19('0x3f')]+'%'};return _0x7c5e81;}})});}_0x38c92c=_['merge']({},_0x38c92c,_0x3f3e6d[_0xfb19('0x40')]);var _0x2f8158={'where':_0x38c92c[_0xfb19('0x3b')]};return db[_0xfb19('0x2c')]['count'](_0x2f8158)['then'](function(_0x3d44a0){_0x48b206[_0xfb19('0x1e')]=_0x3d44a0;if(_0x3f3e6d[_0xfb19('0x31')][_0xfb19('0x41')]){_0x38c92c[_0xfb19('0x42')]=[{'all':!![]}];}return db[_0xfb19('0x2c')][_0xfb19('0x43')](_0x38c92c);})[_0xfb19('0x24')](function(_0x25e4b1){_0x48b206[_0xfb19('0x44')]=_0x25e4b1;return _0x48b206;})['then'](respondWithFilteredResult(_0x4f9dad,_0x38c92c))[_0xfb19('0x45')](handleError(_0x4f9dad,null));};exports[_0xfb19('0x46')]=function(_0x1e19b1,_0x5aa6a2){var _0x1d1ab5={'raw':!![],'where':{'id':_0x1e19b1[_0xfb19('0x47')]['id']}},_0xc583c2={};_0xc583c2[_0xfb19('0x30')]=_[_0xfb19('0x32')](db[_0xfb19('0x2c')][_0xfb19('0x2d')]);_0xc583c2['query']=_[_0xfb19('0x32')](_0x1e19b1[_0xfb19('0x31')]);_0xc583c2[_0xfb19('0x33')]=_[_0xfb19('0x34')](_0xc583c2['model'],_0xc583c2['query']);_0x1d1ab5['attributes']=_['intersection'](_0xc583c2[_0xfb19('0x30')],qs[_0xfb19('0x36')](_0x1e19b1[_0xfb19('0x31')][_0xfb19('0x36')]));_0x1d1ab5[_0xfb19('0x35')]=_0x1d1ab5[_0xfb19('0x35')][_0xfb19('0x37')]?_0x1d1ab5[_0xfb19('0x35')]:_0xc583c2[_0xfb19('0x30')];if(_0x1e19b1[_0xfb19('0x31')][_0xfb19('0x41')]){_0x1d1ab5['include']=[{'all':!![]}];}_0x1d1ab5=_[_0xfb19('0x3d')]({},_0x1d1ab5,_0x1e19b1['options']);return db[_0xfb19('0x2c')]['find'](_0x1d1ab5)[_0xfb19('0x24')](handleEntityNotFound(_0x5aa6a2,null))[_0xfb19('0x24')](respondWithResult(_0x5aa6a2,null))['catch'](handleError(_0x5aa6a2,null));};exports[_0xfb19('0x48')]=function(_0x5872cd,_0x14eade){return db[_0xfb19('0x2c')]['create'](_0x5872cd[_0xfb19('0x49')],{})[_0xfb19('0x24')](respondWithResult(_0x14eade,0xc9))['catch'](handleError(_0x14eade,null));};exports[_0xfb19('0x23')]=function(_0x5a6e56,_0x35927f){if(_0x5a6e56[_0xfb19('0x49')]['id']){delete _0x5a6e56[_0xfb19('0x49')]['id'];}return db[_0xfb19('0x2c')][_0xfb19('0x4a')]({'where':{'id':_0x5a6e56['params']['id']}})[_0xfb19('0x24')](handleEntityNotFound(_0x35927f,null))[_0xfb19('0x24')](saveUpdates(_0x5a6e56['body'],null))[_0xfb19('0x24')](respondWithResult(_0x35927f,null))[_0xfb19('0x45')](handleError(_0x35927f,null));};exports[_0xfb19('0x25')]=function(_0x3ff601,_0xfd60a7){return db[_0xfb19('0x2c')][_0xfb19('0x4a')]({'where':{'id':_0x3ff601[_0xfb19('0x47')]['id']}})['then'](handleEntityNotFound(_0xfd60a7,null))[_0xfb19('0x24')](removeEntity(_0xfd60a7,null))[_0xfb19('0x45')](handleError(_0xfd60a7,null));};exports[_0xfb19('0x4b')]=function(_0x546e6b,_0x4b42c6){return db[_0xfb19('0x2c')][_0xfb19('0x4b')]()[_0xfb19('0x24')](respondWithResult(_0x4b42c6,null))[_0xfb19('0x45')](handleError(_0x4b42c6,null));};exports[_0xfb19('0x4c')]=function(_0x406c74,_0x830f7d,_0x291eac){var _0x13093={'raw':!![],'where':{}};var _0x1be8ac={};var _0x427708={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0xfb19('0x4d')]({'where':{'id':_0x406c74['params']['id']}})[_0xfb19('0x24')](handleEntityNotFound(_0x830f7d,null))[_0xfb19('0x24')](function(_0x2a61cc){if(_0x2a61cc){_0x1be8ac[_0xfb19('0x30')]=_[_0xfb19('0x32')](db[_0xfb19('0x4e')]['rawAttributes']);_0x1be8ac[_0xfb19('0x31')]=_[_0xfb19('0x32')](_0x406c74[_0xfb19('0x31')]);_0x1be8ac[_0xfb19('0x33')]=_[_0xfb19('0x34')](_0x1be8ac[_0xfb19('0x30')],_0x1be8ac[_0xfb19('0x31')]);_0x13093[_0xfb19('0x35')]=_['intersection'](_0x1be8ac['model'],qs['fields'](_0x406c74[_0xfb19('0x31')][_0xfb19('0x36')]));_0x13093[_0xfb19('0x35')]=_0x13093[_0xfb19('0x35')][_0xfb19('0x37')]?_0x13093[_0xfb19('0x35')]:_0x1be8ac[_0xfb19('0x30')];if(!_0x406c74[_0xfb19('0x31')]['hasOwnProperty']('nolimit')){_0x13093[_0xfb19('0x1c')]=qs[_0xfb19('0x1c')](_0x406c74[_0xfb19('0x31')][_0xfb19('0x1c')]);_0x13093[_0xfb19('0x1b')]=qs[_0xfb19('0x1b')](_0x406c74[_0xfb19('0x31')][_0xfb19('0x1b')]);}_0x13093[_0xfb19('0x39')]=qs['sort'](_0x406c74[_0xfb19('0x31')][_0xfb19('0x3a')]);_0x13093[_0xfb19('0x3b')]=qs[_0xfb19('0x33')](_[_0xfb19('0x3c')](_0x406c74[_0xfb19('0x31')],_0x1be8ac[_0xfb19('0x33')]));_0x13093['where'][_0xfb19('0x4f')]=_0x2a61cc['id'];if(_0x406c74[_0xfb19('0x31')][_0xfb19('0x3f')]){_0x13093[_0xfb19('0x3b')]=_['merge'](_0x13093['where'],{'$or':_[_0xfb19('0x2b')](_0x13093[_0xfb19('0x35')],function(_0x12d412){var _0x1a795f={};_0x1a795f[_0x12d412]={'$like':'%'+_0x406c74['query'][_0xfb19('0x3f')]+'%'};return _0x1a795f;})});}_0x13093=_[_0xfb19('0x3d')]({},_0x13093,_0x406c74['options']);return db[_0xfb19('0x4e')]['count']({'where':_0x13093['where']})[_0xfb19('0x24')](function(_0xe2cec3){_0x427708[_0xfb19('0x1e')]=_0xe2cec3;if(_0x406c74[_0xfb19('0x31')][_0xfb19('0x41')]){_0x13093['include']=[{'all':!![]}];}return db[_0xfb19('0x4e')][_0xfb19('0x43')](_0x13093);})[_0xfb19('0x24')](function(_0x17d5af){_0x427708['rows']=_0x17d5af;return _0x427708;});}})[_0xfb19('0x24')](respondWithFilteredResult(_0x830f7d,_0x13093))[_0xfb19('0x45')](handleError(_0x830f7d,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 7747460..b59dd13 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 _0x4975=['./jscriptySessionReport.attributes','exports','JscriptySessionReport','report_jscripty_sessions','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4c6d11,_0x26dd29){var _0x38fe80=function(_0x17b732){while(--_0x17b732){_0x4c6d11['push'](_0x4c6d11['shift']());}};_0x38fe80(++_0x26dd29);}(_0x4975,0x86));var _0x5497=function(_0x59b695,_0x482e28){_0x59b695=_0x59b695-0x0;var _0x35ce76=_0x4975[_0x59b695];return _0x35ce76;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var logger=require(_0x5497('0x1'))(_0x5497('0x2'));var moment=require(_0x5497('0x3'));var BPromise=require(_0x5497('0x4'));var rp=require(_0x5497('0x5'));var fs=require('fs');var path=require(_0x5497('0x6'));var rimraf=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var attributes=require(_0x5497('0x9'));module[_0x5497('0xa')]=function(_0x539a27,_0x37e48d){return _0x539a27['define'](_0x5497('0xb'),attributes,{'tableName':_0x5497('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x90b1=['define','JscriptySessionReport','report_jscripty_sessions','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x17fa35,_0x2384da){var _0x573b02=function(_0x2ff8d9){while(--_0x2ff8d9){_0x17fa35['push'](_0x17fa35['shift']());}};_0x573b02(++_0x2384da);}(_0x90b1,0x1bb));var _0x190b=function(_0x2b6b92,_0x57303d){_0x2b6b92=_0x2b6b92-0x0;var _0x2233dc=_0x90b1[_0x2b6b92];return _0x2233dc;};'use strict';var _=require(_0x190b('0x0'));var util=require(_0x190b('0x1'));var logger=require(_0x190b('0x2'))('api');var moment=require('moment');var BPromise=require(_0x190b('0x3'));var rp=require(_0x190b('0x4'));var fs=require('fs');var path=require(_0x190b('0x5'));var rimraf=require(_0x190b('0x6'));var config=require('../../config/environment');var attributes=require('./jscriptySessionReport.attributes');module['exports']=function(_0x5da9c1,_0x27ff8c){return _0x5da9c1[_0x190b('0x7')](_0x190b('0x8'),attributes,{'tableName':_0x190b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index 1913f15..1e7864e 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 _0x47c5=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x483102,_0x54e93d){var _0x5cc885=function(_0x54931c){while(--_0x54931c){_0x483102['push'](_0x483102['shift']());}};_0x5cc885(++_0x54e93d);}(_0x47c5,0x165));var _0x547c=function(_0x2a5e67,_0x148cca){_0x2a5e67=_0x2a5e67-0x0;var _0xffe10=_0x47c5[_0x2a5e67];return _0xffe10;};'use strict';var _=require(_0x547c('0x0'));var util=require(_0x547c('0x1'));var moment=require(_0x547c('0x2'));var BPromise=require(_0x547c('0x3'));var rs=require(_0x547c('0x4'));var fs=require('fs');var Redis=require(_0x547c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x547c('0x6'));var logger=require(_0x547c('0x7'))('rpc');var config=require(_0x547c('0x8'));var jayson=require(_0x547c('0x9'));var client=jayson['client'][_0x547c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x439f25,_0x381f2e,_0x10a334){return new BPromise(function(_0x12fb7d,_0x4ef079){return client[_0x547c('0xb')](_0x439f25,_0x10a334)[_0x547c('0xc')](function(_0x10dec9){logger[_0x547c('0xd')](_0x547c('0xe'),_0x381f2e,_0x547c('0xf'));logger[_0x547c('0x10')](_0x547c('0x11'),_0x381f2e,_0x547c('0xf'),JSON[_0x547c('0x12')](_0x10dec9));if(_0x10dec9[_0x547c('0x13')]){if(_0x10dec9['error'][_0x547c('0x14')]===0x1f4){logger[_0x547c('0x13')]('JscriptySessionReport,\x20%s,\x20%s',_0x381f2e,_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);return _0x4ef079(_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);}logger[_0x547c('0x13')](_0x547c('0xe'),_0x381f2e,_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);return _0x12fb7d(_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);}else{logger[_0x547c('0xd')](_0x547c('0xe'),_0x381f2e,_0x547c('0xf'));_0x12fb7d(_0x10dec9[_0x547c('0x16')][_0x547c('0x15')]);}})[_0x547c('0x17')](function(_0x39498d){logger[_0x547c('0x13')]('JscriptySessionReport,\x20%s,\x20%s',_0x381f2e,_0x39498d);_0x4ef079(_0x39498d);});});} \ No newline at end of file +var _0x5fab=['../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','JscriptySessionReport,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x36dee4,_0x3d3cfe){var _0x13872f=function(_0x146a35){while(--_0x146a35){_0x36dee4['push'](_0x36dee4['shift']());}};_0x13872f(++_0x3d3cfe);}(_0x5fab,0x177));var _0xb5fa=function(_0x4fe93e,_0x44f9e2){_0x4fe93e=_0x4fe93e-0x0;var _0x5f1d5a=_0x5fab[_0x4fe93e];return _0x5f1d5a;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var moment=require('moment');var BPromise=require(_0xb5fa('0x2'));var rs=require(_0xb5fa('0x3'));var fs=require('fs');var Redis=require(_0xb5fa('0x4'));var db=require(_0xb5fa('0x5'))['db'];var utils=require(_0xb5fa('0x6'));var logger=require(_0xb5fa('0x7'))(_0xb5fa('0x8'));var config=require(_0xb5fa('0x9'));var jayson=require(_0xb5fa('0xa'));var client=jayson[_0xb5fa('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d70f6,_0x2e3804,_0x1aec3e){return new BPromise(function(_0x9c7bce,_0x56d018){return client[_0xb5fa('0xc')](_0x5d70f6,_0x1aec3e)[_0xb5fa('0xd')](function(_0x2cf4a5){logger['info']('JscriptySessionReport,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));logger[_0xb5fa('0xf')](_0xb5fa('0x10'),_0x2e3804,_0xb5fa('0xe'),JSON[_0xb5fa('0x11')](_0x2cf4a5));if(_0x2cf4a5[_0xb5fa('0x12')]){if(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x13')]===0x1f4){logger[_0xb5fa('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x56d018(_0x2cf4a5['error'][_0xb5fa('0x14')]);}logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x9c7bce(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);}else{logger['info']('JscriptySessionReport,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));_0x9c7bce(_0x2cf4a5[_0xb5fa('0x16')][_0xb5fa('0x14')]);}})[_0xb5fa('0x17')](function(_0x56fe10){logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x56fe10);_0x56d018(_0x56fe10);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 39625cc..a63944b 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 _0x14d8=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','get','index','put','/:id','isAuthenticated','/download_log_file','downloadLogFile','multer','util','path'];(function(_0x256b72,_0x340985){var _0x2183e3=function(_0xf7fd37){while(--_0xf7fd37){_0x256b72['push'](_0x256b72['shift']());}};_0x2183e3(++_0x340985);}(_0x14d8,0x9f));var _0x814d=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x14d8[_0x126558];return _0x1f6d14;};'use strict';var multer=require(_0x814d('0x0'));var util=require(_0x814d('0x1'));var path=require(_0x814d('0x2'));var timeout=require(_0x814d('0x3'));var express=require(_0x814d('0x4'));var router=express[_0x814d('0x5')]();var fs_extra=require(_0x814d('0x6'));var auth=require(_0x814d('0x7'));var interaction=require(_0x814d('0x8'));var config=require(_0x814d('0x9'));var controller=require(_0x814d('0xa'));router[_0x814d('0xb')]('/',controller[_0x814d('0xc')]);router[_0x814d('0xd')](_0x814d('0xe'),auth[_0x814d('0xf')](),controller['update']);router['get'](_0x814d('0x10'),auth[_0x814d('0xf')](),controller[_0x814d('0x11')]);module['exports']=router; \ No newline at end of file +var _0xbc69=['exports','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/:id','/download_log_file','isAuthenticated'];(function(_0x4f3949,_0x1b28b5){var _0x2bbb60=function(_0x137b51){while(--_0x137b51){_0x4f3949['push'](_0x4f3949['shift']());}};_0x2bbb60(++_0x1b28b5);}(_0xbc69,0xe5));var _0x9bc6=function(_0x3826ad,_0x49a30d){_0x3826ad=_0x3826ad-0x0;var _0x17b900=_0xbc69[_0x3826ad];return _0x17b900;};'use strict';var multer=require(_0x9bc6('0x0'));var util=require('util');var path=require(_0x9bc6('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9bc6('0x2')]();var fs_extra=require(_0x9bc6('0x3'));var auth=require(_0x9bc6('0x4'));var interaction=require(_0x9bc6('0x5'));var config=require('../../config/environment');var controller=require('./license.controller');router[_0x9bc6('0x6')]('/',controller[_0x9bc6('0x7')]);router['put'](_0x9bc6('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x9bc6('0x6')](_0x9bc6('0x9'),auth[_0x9bc6('0xa')](),controller['downloadLogFile']);module[_0x9bc6('0xb')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 0b7d4c3..7e056a8 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 _0x059a=['exports','TEXT','STRING','INTEGER','sequelize'];(function(_0x2fef3a,_0x1f10e4){var _0x342de2=function(_0x2cb802){while(--_0x2cb802){_0x2fef3a['push'](_0x2fef3a['shift']());}};_0x342de2(++_0x1f10e4);}(_0x059a,0x1ee));var _0xa059=function(_0x2f8d56,_0x376c64){_0x2f8d56=_0x2f8d56-0x0;var _0x36081d=_0x059a[_0x2f8d56];return _0x36081d;};'use strict';var Sequelize=require(_0xa059('0x0'));module[_0xa059('0x1')]={'license':{'type':Sequelize[_0xa059('0x2')]},'data1':{'type':Sequelize[_0xa059('0x3')]},'data2':{'type':Sequelize[_0xa059('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0xa059('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb5a9=['INTEGER','exports','TEXT','STRING'];(function(_0x2ceba7,_0x451ce4){var _0x5348eb=function(_0x3596fc){while(--_0x3596fc){_0x2ceba7['push'](_0x2ceba7['shift']());}};_0x5348eb(++_0x451ce4);}(_0xb5a9,0x111));var _0x9b5a=function(_0x397124,_0x59821a){_0x397124=_0x397124-0x0;var _0x34f423=_0xb5a9[_0x397124];return _0x34f423;};'use strict';var Sequelize=require('sequelize');module[_0x9b5a('0x0')]={'license':{'type':Sequelize[_0x9b5a('0x1')]},'data1':{'type':Sequelize[_0x9b5a('0x2')]},'data2':{'type':Sequelize[_0x9b5a('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x9b5a('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 6273080..9066726 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 _0x82d4=['jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','model','keys','License','rawAttributes','query','filters','intersection','attributes','fields','merge','options','catch','body','find','params','get','demo','downloadLogFile','join','/var','log','setHeader','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto'];(function(_0xbfcd7e,_0x4566d6){var _0x1c8cb4=function(_0x11132c){while(--_0x11132c){_0xbfcd7e['push'](_0xbfcd7e['shift']());}};_0x1c8cb4(++_0x4566d6);}(_0x82d4,0x141));var _0x482d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x82d4[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x482d('0x0'));var rimraf=require(_0x482d('0x1'));var zipdir=require(_0x482d('0x2'));var jsonpatch=require(_0x482d('0x3'));var rp=require(_0x482d('0x4'));var moment=require(_0x482d('0x5'));var BPromise=require(_0x482d('0x6'));var Mustache=require('mustache');var util=require(_0x482d('0x7'));var path=require(_0x482d('0x8'));var sox=require('sox');var csv=require(_0x482d('0x9'));var ejs=require(_0x482d('0xa'));var fs=require('fs');var fs_extra=require(_0x482d('0xb'));var _=require('lodash');var squel=require(_0x482d('0xc'));var crypto=require(_0x482d('0xd'));var jsforce=require(_0x482d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x482d('0x9'));var querystring=require(_0x482d('0xf'));var Papa=require('papaparse');var Redis=require(_0x482d('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x482d('0x11'));var as=require(_0x482d('0x12'));var hardwareService=require(_0x482d('0x13'));var logger=require(_0x482d('0x14'))(_0x482d('0x15'));var utils=require(_0x482d('0x16'));var config=require(_0x482d('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5abb97,_0x483efb){_0x483efb=_0x483efb||0xcc;return function(_0x2f5b1b){if(_0x2f5b1b){return _0x5abb97[_0x482d('0x18')](_0x483efb);}return _0x5abb97[_0x482d('0x19')](_0x483efb)[_0x482d('0x1a')]();};}function respondWithResult(_0x32b800,_0x54bd20){_0x54bd20=_0x54bd20||0xc8;return function(_0x5023c3){if(_0x5023c3){return _0x32b800[_0x482d('0x19')](_0x54bd20)['json'](_0x5023c3);}};}function respondWithFilteredResult(_0x305676,_0x3b5eb4){return function(_0x37738f){if(_0x37738f){var _0xf9c619=typeof _0x3b5eb4[_0x482d('0x1b')]===_0x482d('0x1c')&&typeof _0x3b5eb4['limit']===_0x482d('0x1c');var _0x2cb754=_0x37738f[_0x482d('0x1d')];var _0x43666c=_0xf9c619?0x0:_0x3b5eb4[_0x482d('0x1b')];var _0x378702=_0xf9c619?_0x37738f[_0x482d('0x1d')]:_0x3b5eb4[_0x482d('0x1b')]+_0x3b5eb4['limit'];var _0x26b759;if(_0x378702>=_0x2cb754){_0x378702=_0x2cb754;_0x26b759=0xc8;}else{_0x26b759=0xce;}_0x305676['status'](_0x26b759);return _0x305676[_0x482d('0x1e')](_0x482d('0x1f'),_0x43666c+'-'+_0x378702+'/'+_0x2cb754)['json'](_0x37738f);}return null;};}function patchUpdates(_0x5c10b3){return function(_0x5d8b1e){try{jsonpatch[_0x482d('0x20')](_0x5d8b1e,_0x5c10b3,!![]);}catch(_0x2a19ca){return BPromise[_0x482d('0x21')](_0x2a19ca);}return _0x5d8b1e[_0x482d('0x22')]();};}function saveUpdates(_0x518fdd,_0x2a8994){return function(_0x2b12c3){if(_0x2b12c3){return _0x2b12c3[_0x482d('0x23')](_0x518fdd)[_0x482d('0x24')](function(_0x105b93){return _0x105b93;});}return null;};}function removeEntity(_0x4360b3,_0x231fa5){return function(_0x470eb8){if(_0x470eb8){return _0x470eb8['destroy']()[_0x482d('0x24')](function(){_0x4360b3['status'](0xcc)[_0x482d('0x1a')]();});}};}function handleEntityNotFound(_0x3617e5,_0x312ec3){return function(_0x3a0b3e){if(!_0x3a0b3e){_0x3617e5[_0x482d('0x18')](0x194);}return _0x3a0b3e;};}function handleError(_0x1b19a2,_0x2308a0){_0x2308a0=_0x2308a0||0x1f4;return function(_0x11b067){logger[_0x482d('0x25')](_0x11b067[_0x482d('0x26')]);if(_0x11b067['name']){delete _0x11b067[_0x482d('0x27')];}_0x1b19a2[_0x482d('0x19')](_0x2308a0)[_0x482d('0x28')](_0x11b067);};}var utilLicense=require('../../config/license/util');exports['index']=function(_0x4036d7,_0xdf849f){var _0x7264e0={'raw':!![],'where':{'id':0x1}},_0x6db9c8={};_0x6db9c8[_0x482d('0x29')]=_[_0x482d('0x2a')](db[_0x482d('0x2b')][_0x482d('0x2c')]);_0x6db9c8[_0x482d('0x2d')]=_[_0x482d('0x2a')](_0x4036d7[_0x482d('0x2d')]);_0x6db9c8[_0x482d('0x2e')]=_[_0x482d('0x2f')](_0x6db9c8[_0x482d('0x29')],_0x6db9c8[_0x482d('0x2d')]);_0x7264e0[_0x482d('0x30')]=_[_0x482d('0x2f')](_0x6db9c8[_0x482d('0x29')],qs[_0x482d('0x31')](_0x4036d7[_0x482d('0x2d')][_0x482d('0x31')]));_0x7264e0[_0x482d('0x30')]=_0x7264e0[_0x482d('0x30')]['length']?_0x7264e0['attributes']:_0x6db9c8[_0x482d('0x29')];_0x7264e0=_[_0x482d('0x32')]({},_0x7264e0,_0x4036d7[_0x482d('0x33')]);return utilLicense['getLicense'](_0x7264e0)[_0x482d('0x24')](respondWithResult(_0xdf849f,null))[_0x482d('0x34')](handleError(_0xdf849f,null));};exports[_0x482d('0x23')]=function(_0x7a89d3,_0x551c83){if(_0x7a89d3[_0x482d('0x35')]['id']){delete _0x7a89d3[_0x482d('0x35')]['id'];}return db[_0x482d('0x2b')][_0x482d('0x36')]({'where':{'id':_0x7a89d3[_0x482d('0x37')]['id']}})[_0x482d('0x24')](handleEntityNotFound(_0x551c83,null))[_0x482d('0x24')](function(_0x5584ba){var _0x1d0054=_0x5584ba[_0x482d('0x38')]({'plain':!![]});return utilLicense['checkLicense'](_0x1d0054,_0x7a89d3[_0x482d('0x35')]['key']);})[_0x482d('0x24')](function(_0x2052ed){if(!_0x2052ed[_0x482d('0x39')]){return saveUpdates(_0x7a89d3['body'],null);}return _0x2052ed;})[_0x482d('0x24')](respondWithResult(_0x551c83,null))[_0x482d('0x34')](handleError(_0x551c83,null));};exports[_0x482d('0x3a')]=function(_0x4c5799,_0x176df2){var _0x2c43a3='license-info.log';var _0x314f6d=path[_0x482d('0x3b')](_0x482d('0x3c'),_0x482d('0x3d'),'xcally',_0x2c43a3);_0x176df2[_0x482d('0x3e')](_0x482d('0x3f'),_0x482d('0x40')+_0x2c43a3);_0x176df2[_0x482d('0x1e')](_0x482d('0x41'),_0x482d('0x42'));_0x176df2['download'](_0x314f6d);}; \ No newline at end of file +var _0xca99=['end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','stack','name','index','model','keys','License','rawAttributes','query','filters','intersection','fields','attributes','length','merge','catch','body','checkLicense','key','downloadLogFile','license-info.log','join','xcally','setHeader','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status'];(function(_0x21f8a8,_0x1d7071){var _0x21d3d5=function(_0x4ee4b4){while(--_0x4ee4b4){_0x21f8a8['push'](_0x21f8a8['shift']());}};_0x21d3d5(++_0x1d7071);}(_0xca99,0x138));var _0x9ca9=function(_0xbd9588,_0x22e90f){_0xbd9588=_0xbd9588-0x0;var _0x35a8d7=_0xca99[_0xbd9588];return _0x35a8d7;};'use strict';var emlformat=require(_0x9ca9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9ca9('0x1'));var jsonpatch=require(_0x9ca9('0x2'));var rp=require(_0x9ca9('0x3'));var moment=require(_0x9ca9('0x4'));var BPromise=require(_0x9ca9('0x5'));var Mustache=require(_0x9ca9('0x6'));var util=require(_0x9ca9('0x7'));var path=require(_0x9ca9('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9ca9('0x9'));var fs=require('fs');var fs_extra=require(_0x9ca9('0xa'));var _=require(_0x9ca9('0xb'));var squel=require(_0x9ca9('0xc'));var crypto=require(_0x9ca9('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9ca9('0xe'));var toCsv=require(_0x9ca9('0xf'));var querystring=require(_0x9ca9('0x10'));var Papa=require('papaparse');var Redis=require(_0x9ca9('0x11'));var authService=require(_0x9ca9('0x12'));var qs=require(_0x9ca9('0x13'));var as=require(_0x9ca9('0x14'));var hardwareService=require(_0x9ca9('0x15'));var logger=require(_0x9ca9('0x16'))(_0x9ca9('0x17'));var utils=require(_0x9ca9('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x9ca9('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x302fe3,_0x3bdfb8){_0x3bdfb8=_0x3bdfb8||0xcc;return function(_0x39718e){if(_0x39718e){return _0x302fe3[_0x9ca9('0x1a')](_0x3bdfb8);}return _0x302fe3[_0x9ca9('0x1b')](_0x3bdfb8)[_0x9ca9('0x1c')]();};}function respondWithResult(_0x574018,_0x337e9c){_0x337e9c=_0x337e9c||0xc8;return function(_0x8b5f14){if(_0x8b5f14){return _0x574018[_0x9ca9('0x1b')](_0x337e9c)[_0x9ca9('0x1d')](_0x8b5f14);}};}function respondWithFilteredResult(_0x115bc9,_0x39305e){return function(_0xc60dc5){if(_0xc60dc5){var _0xb3643b=typeof _0x39305e[_0x9ca9('0x1e')]===_0x9ca9('0x1f')&&typeof _0x39305e[_0x9ca9('0x20')]===_0x9ca9('0x1f');var _0x2a55e7=_0xc60dc5[_0x9ca9('0x21')];var _0x400a9a=_0xb3643b?0x0:_0x39305e[_0x9ca9('0x1e')];var _0x2e8583=_0xb3643b?_0xc60dc5[_0x9ca9('0x21')]:_0x39305e[_0x9ca9('0x1e')]+_0x39305e['limit'];var _0x53f6c4;if(_0x2e8583>=_0x2a55e7){_0x2e8583=_0x2a55e7;_0x53f6c4=0xc8;}else{_0x53f6c4=0xce;}_0x115bc9[_0x9ca9('0x1b')](_0x53f6c4);return _0x115bc9[_0x9ca9('0x22')](_0x9ca9('0x23'),_0x400a9a+'-'+_0x2e8583+'/'+_0x2a55e7)[_0x9ca9('0x1d')](_0xc60dc5);}return null;};}function patchUpdates(_0x4e7932){return function(_0x121f84){try{jsonpatch[_0x9ca9('0x24')](_0x121f84,_0x4e7932,!![]);}catch(_0x5131a1){return BPromise[_0x9ca9('0x25')](_0x5131a1);}return _0x121f84['save']();};}function saveUpdates(_0x22f589,_0x1c5745){return function(_0x3671bf){if(_0x3671bf){return _0x3671bf[_0x9ca9('0x26')](_0x22f589)[_0x9ca9('0x27')](function(_0x44ab75){return _0x44ab75;});}return null;};}function removeEntity(_0x18b08d,_0x49824b){return function(_0x23c475){if(_0x23c475){return _0x23c475[_0x9ca9('0x28')]()[_0x9ca9('0x27')](function(){_0x18b08d[_0x9ca9('0x1b')](0xcc)[_0x9ca9('0x1c')]();});}};}function handleEntityNotFound(_0x5b130f,_0xfd6a61){return function(_0x180cb7){if(!_0x180cb7){_0x5b130f[_0x9ca9('0x1a')](0x194);}return _0x180cb7;};}function handleError(_0x4b1e9f,_0x34bf3b){_0x34bf3b=_0x34bf3b||0x1f4;return function(_0x27585e){logger['error'](_0x27585e[_0x9ca9('0x29')]);if(_0x27585e[_0x9ca9('0x2a')]){delete _0x27585e[_0x9ca9('0x2a')];}_0x4b1e9f[_0x9ca9('0x1b')](_0x34bf3b)['send'](_0x27585e);};}var utilLicense=require(_0x9ca9('0x19'));exports[_0x9ca9('0x2b')]=function(_0x4482d2,_0x14a2d5){var _0x215607={'raw':!![],'where':{'id':0x1}},_0x4b95c6={};_0x4b95c6[_0x9ca9('0x2c')]=_[_0x9ca9('0x2d')](db[_0x9ca9('0x2e')][_0x9ca9('0x2f')]);_0x4b95c6[_0x9ca9('0x30')]=_[_0x9ca9('0x2d')](_0x4482d2['query']);_0x4b95c6[_0x9ca9('0x31')]=_[_0x9ca9('0x32')](_0x4b95c6['model'],_0x4b95c6[_0x9ca9('0x30')]);_0x215607['attributes']=_[_0x9ca9('0x32')](_0x4b95c6[_0x9ca9('0x2c')],qs[_0x9ca9('0x33')](_0x4482d2[_0x9ca9('0x30')][_0x9ca9('0x33')]));_0x215607[_0x9ca9('0x34')]=_0x215607[_0x9ca9('0x34')][_0x9ca9('0x35')]?_0x215607[_0x9ca9('0x34')]:_0x4b95c6[_0x9ca9('0x2c')];_0x215607=_[_0x9ca9('0x36')]({},_0x215607,_0x4482d2['options']);return utilLicense['getLicense'](_0x215607)[_0x9ca9('0x27')](respondWithResult(_0x14a2d5,null))[_0x9ca9('0x37')](handleError(_0x14a2d5,null));};exports[_0x9ca9('0x26')]=function(_0x1d9958,_0x5500cb){if(_0x1d9958[_0x9ca9('0x38')]['id']){delete _0x1d9958[_0x9ca9('0x38')]['id'];}return db[_0x9ca9('0x2e')]['find']({'where':{'id':_0x1d9958['params']['id']}})[_0x9ca9('0x27')](handleEntityNotFound(_0x5500cb,null))['then'](function(_0x589d76){var _0x450aff=_0x589d76['get']({'plain':!![]});return utilLicense[_0x9ca9('0x39')](_0x450aff,_0x1d9958['body'][_0x9ca9('0x3a')]);})[_0x9ca9('0x27')](function(_0x5a24f8){if(!_0x5a24f8['demo']){return saveUpdates(_0x1d9958['body'],null);}return _0x5a24f8;})[_0x9ca9('0x27')](respondWithResult(_0x5500cb,null))[_0x9ca9('0x37')](handleError(_0x5500cb,null));};exports[_0x9ca9('0x3b')]=function(_0x28429c,_0x2449a5){var _0x3f4671=_0x9ca9('0x3c');var _0x67e185=path[_0x9ca9('0x3d')]('/var','log',_0x9ca9('0x3e'),_0x3f4671);_0x2449a5[_0x9ca9('0x3f')](_0x9ca9('0x40'),_0x9ca9('0x41')+_0x3f4671);_0x2449a5[_0x9ca9('0x22')](_0x9ca9('0x42'),_0x9ca9('0x43'));_0x2449a5['download'](_0x67e185);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index ad6760f..26c7f93 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 _0x79c7=['rimraf','./license.attributes','exports','define','License','license','lodash','util','api','bluebird','path'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x79c7,0x13a));var _0x779c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x79c7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x779c('0x0'));var util=require(_0x779c('0x1'));var logger=require('../../config/logger')(_0x779c('0x2'));var moment=require('moment');var BPromise=require(_0x779c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x779c('0x4'));var rimraf=require(_0x779c('0x5'));var config=require('../../config/environment');var attributes=require(_0x779c('0x6'));module[_0x779c('0x7')]=function(_0x2bd6c3,_0x1a4ebc){return _0x2bd6c3[_0x779c('0x8')](_0x779c('0x9'),attributes,{'tableName':_0x779c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x71e6=['rimraf','../../config/environment','exports','License','lodash','util','../../config/logger','api','bluebird','path'];(function(_0x9cc155,_0x328c0c){var _0x45ab2f=function(_0x229d82){while(--_0x229d82){_0x9cc155['push'](_0x9cc155['shift']());}};_0x45ab2f(++_0x328c0c);}(_0x71e6,0x7c));var _0x671e=function(_0x2c9cce,_0x21e21c){_0x2c9cce=_0x2c9cce-0x0;var _0x4bc082=_0x71e6[_0x2c9cce];return _0x4bc082;};'use strict';var _=require(_0x671e('0x0'));var util=require(_0x671e('0x1'));var logger=require(_0x671e('0x2'))(_0x671e('0x3'));var moment=require('moment');var BPromise=require(_0x671e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x671e('0x5'));var rimraf=require(_0x671e('0x6'));var config=require(_0x671e('0x7'));var attributes=require('./license.attributes');module[_0x671e('0x8')]=function(_0x173f20,_0x2d457e){return _0x173f20['define'](_0x671e('0x9'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index c78f3d0..0a387a5 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 _0x9d68=['http','then','License,\x20%s,\x20%s','License,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x3b22f0,_0x3463fd){var _0x55bf4d=function(_0x18d03b){while(--_0x18d03b){_0x3b22f0['push'](_0x3b22f0['shift']());}};_0x55bf4d(++_0x3463fd);}(_0x9d68,0x1f0));var _0x89d6=function(_0x22a91c,_0x5ce13f){_0x22a91c=_0x22a91c-0x0;var _0x733c2f=_0x9d68[_0x22a91c];return _0x733c2f;};'use strict';var _=require(_0x89d6('0x0'));var util=require(_0x89d6('0x1'));var moment=require('moment');var BPromise=require(_0x89d6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x89d6('0x3'));var db=require(_0x89d6('0x4'))['db'];var utils=require(_0x89d6('0x5'));var logger=require(_0x89d6('0x6'))('rpc');var config=require(_0x89d6('0x7'));var jayson=require(_0x89d6('0x8'));var client=jayson[_0x89d6('0x9')][_0x89d6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f59af,_0x2b06f9,_0x4f130f){return new BPromise(function(_0x4620b6,_0x142f07){return client['request'](_0x2f59af,_0x4f130f)[_0x89d6('0xb')](function(_0x1bc1f0){logger['info'](_0x89d6('0xc'),_0x2b06f9,'request\x20sent');logger['debug'](_0x89d6('0xd'),_0x2b06f9,_0x89d6('0xe'),JSON[_0x89d6('0xf')](_0x1bc1f0));if(_0x1bc1f0[_0x89d6('0x10')]){if(_0x1bc1f0['error'][_0x89d6('0x11')]===0x1f4){logger[_0x89d6('0x10')]('License,\x20%s,\x20%s',_0x2b06f9,_0x1bc1f0['error'][_0x89d6('0x12')]);return _0x142f07(_0x1bc1f0['error'][_0x89d6('0x12')]);}logger[_0x89d6('0x10')](_0x89d6('0xc'),_0x2b06f9,_0x1bc1f0[_0x89d6('0x10')][_0x89d6('0x12')]);return _0x4620b6(_0x1bc1f0[_0x89d6('0x10')][_0x89d6('0x12')]);}else{logger[_0x89d6('0x13')](_0x89d6('0xc'),_0x2b06f9,'request\x20sent');_0x4620b6(_0x1bc1f0[_0x89d6('0x14')][_0x89d6('0x12')]);}})[_0x89d6('0x15')](function(_0x1d6655){logger['error'](_0x89d6('0xc'),_0x2b06f9,_0x1d6655);_0x142f07(_0x1d6655);});});} \ No newline at end of file +var _0x688e=['request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','License,\x20%s,\x20%s'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x688e,0x105));var _0xe688=function(_0x3950ce,_0xd6024b){_0x3950ce=_0x3950ce-0x0;var _0x14eb08=_0x688e[_0x3950ce];return _0x14eb08;};'use strict';var _=require(_0xe688('0x0'));var util=require(_0xe688('0x1'));var moment=require('moment');var BPromise=require(_0xe688('0x2'));var rs=require(_0xe688('0x3'));var fs=require('fs');var Redis=require(_0xe688('0x4'));var db=require(_0xe688('0x5'))['db'];var utils=require(_0xe688('0x6'));var logger=require(_0xe688('0x7'))('rpc');var config=require(_0xe688('0x8'));var jayson=require(_0xe688('0x9'));var client=jayson[_0xe688('0xa')][_0xe688('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2b826c,_0x474be8,_0x5a41f9){return new BPromise(function(_0x2f4f63,_0x66c1d0){return client[_0xe688('0xc')](_0x2b826c,_0x5a41f9)[_0xe688('0xd')](function(_0x28351d){logger['info'](_0xe688('0xe'),_0x474be8,_0xe688('0xf'));logger[_0xe688('0x10')](_0xe688('0x11'),_0x474be8,'request\x20sent',JSON[_0xe688('0x12')](_0x28351d));if(_0x28351d[_0xe688('0x13')]){if(_0x28351d[_0xe688('0x13')]['code']===0x1f4){logger[_0xe688('0x13')](_0xe688('0xe'),_0x474be8,_0x28351d[_0xe688('0x13')]['message']);return _0x66c1d0(_0x28351d[_0xe688('0x13')][_0xe688('0x14')]);}logger['error'](_0xe688('0xe'),_0x474be8,_0x28351d[_0xe688('0x13')][_0xe688('0x14')]);return _0x2f4f63(_0x28351d[_0xe688('0x13')][_0xe688('0x14')]);}else{logger[_0xe688('0x15')]('License,\x20%s,\x20%s',_0x474be8,_0xe688('0xf'));_0x2f4f63(_0x28351d[_0xe688('0x16')][_0xe688('0x14')]);}})['catch'](function(_0x111851){logger[_0xe688('0x13')](_0xe688('0xe'),_0x474be8,_0x111851);_0x66c1d0(_0x111851);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 1203cc4..80707a3 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 _0x61fd=['addAnswer','create','addImap','addSmtp','/:id/interactions','addInteraction','addApplications','/:id/send','send','/:id/users','addAgents','update','delete','removeSmtp','removeAgents','exports','multer','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getAnswers','/:id/in_servers','/:id/out_servers','getSmtp','/:id/applications','/:id/messages','getMessages','/:id/verify','verifySmtp','getAgents','post','addDisposition','/:id/canned_answers'];(function(_0x57b6f4,_0x18a077){var _0x24bda6=function(_0x17b171){while(--_0x17b171){_0x57b6f4['push'](_0x57b6f4['shift']());}};_0x24bda6(++_0x18a077);}(_0x61fd,0x13d));var _0xd61f=function(_0x59f5a4,_0x465acb){_0x59f5a4=_0x59f5a4-0x0;var _0x4824aa=_0x61fd[_0x59f5a4];return _0x4824aa;};'use strict';var multer=require(_0xd61f('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd61f('0x1')]();var fs_extra=require(_0xd61f('0x2'));var auth=require(_0xd61f('0x3'));var interaction=require(_0xd61f('0x4'));var config=require(_0xd61f('0x5'));var controller=require('./mailAccount.controller');router[_0xd61f('0x6')]('/',auth[_0xd61f('0x7')](),controller[_0xd61f('0x8')]);router[_0xd61f('0x6')](_0xd61f('0x9'),auth[_0xd61f('0x7')](),controller[_0xd61f('0xa')]);router[_0xd61f('0x6')](_0xd61f('0xb'),auth[_0xd61f('0x7')](),controller[_0xd61f('0xc')]);router[_0xd61f('0x6')](_0xd61f('0xd'),auth[_0xd61f('0x7')](),controller['getDispositions']);router[_0xd61f('0x6')]('/:id/canned_answers',auth[_0xd61f('0x7')](),controller[_0xd61f('0xe')]);router[_0xd61f('0x6')](_0xd61f('0xf'),auth[_0xd61f('0x7')](),controller['getImap']);router['get'](_0xd61f('0x10'),auth['isAuthenticated'](),controller[_0xd61f('0x11')]);router['get']('/:id/interactions',auth[_0xd61f('0x7')](),controller['getInteractions']);router[_0xd61f('0x6')](_0xd61f('0x12'),auth['isAuthenticated'](),controller['getApplications']);router[_0xd61f('0x6')](_0xd61f('0x13'),auth[_0xd61f('0x7')](),controller[_0xd61f('0x14')]);router[_0xd61f('0x6')](_0xd61f('0x15'),auth[_0xd61f('0x7')](),controller[_0xd61f('0x16')]);router[_0xd61f('0x6')]('/:id/users',auth[_0xd61f('0x7')](),controller[_0xd61f('0x17')]);router[_0xd61f('0x18')](_0xd61f('0xd'),auth[_0xd61f('0x7')](),controller[_0xd61f('0x19')]);router[_0xd61f('0x18')](_0xd61f('0x1a'),auth[_0xd61f('0x7')](),controller[_0xd61f('0x1b')]);router[_0xd61f('0x18')]('/',auth[_0xd61f('0x7')](),controller[_0xd61f('0x1c')]);router['post'](_0xd61f('0xf'),auth[_0xd61f('0x7')](),controller[_0xd61f('0x1d')]);router[_0xd61f('0x18')](_0xd61f('0x10'),auth[_0xd61f('0x7')](),controller[_0xd61f('0x1e')]);router[_0xd61f('0x18')](_0xd61f('0x1f'),auth[_0xd61f('0x7')](),controller[_0xd61f('0x20')]);router[_0xd61f('0x18')](_0xd61f('0x12'),auth[_0xd61f('0x7')](),controller[_0xd61f('0x21')]);router['post'](_0xd61f('0x22'),auth[_0xd61f('0x7')](),controller[_0xd61f('0x23')]);router[_0xd61f('0x18')](_0xd61f('0x24'),auth[_0xd61f('0x7')](),controller[_0xd61f('0x25')]);router['put'](_0xd61f('0xb'),auth['isAuthenticated'](),controller[_0xd61f('0x26')]);router[_0xd61f('0x27')]('/:id/dispositions',auth['isAuthenticated'](),controller['removeDispositions']);router[_0xd61f('0x27')]('/:id/canned_answers',auth[_0xd61f('0x7')](),controller['removeAnswers']);router[_0xd61f('0x27')](_0xd61f('0xf'),auth[_0xd61f('0x7')](),controller['removeImap']);router[_0xd61f('0x27')]('/:id/out_servers',auth[_0xd61f('0x7')](),controller[_0xd61f('0x28')]);router['delete'](_0xd61f('0xb'),auth[_0xd61f('0x7')](),controller['destroy']);router[_0xd61f('0x27')](_0xd61f('0x24'),auth['isAuthenticated'](),controller[_0xd61f('0x29')]);module[_0xd61f('0x2a')]=router; \ No newline at end of file +var _0x4bd9=['/:id/verify','verifySmtp','/:id/users','getAgents','post','addDisposition','addAnswer','create','/:id/in_servers','addImap','/:id/out_servers','addInteraction','/:id/send','send','delete','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailAccount.controller','index','get','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getImap','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages'];(function(_0x424895,_0x14c6f8){var _0xbf70ff=function(_0x2aacf5){while(--_0x2aacf5){_0x424895['push'](_0x424895['shift']());}};_0xbf70ff(++_0x14c6f8);}(_0x4bd9,0xd9));var _0x94bd=function(_0x40a11c,_0x1c7a1d){_0x40a11c=_0x40a11c-0x0;var _0xdb0aec=_0x4bd9[_0x40a11c];return _0xdb0aec;};'use strict';var multer=require(_0x94bd('0x0'));var util=require(_0x94bd('0x1'));var path=require(_0x94bd('0x2'));var timeout=require(_0x94bd('0x3'));var express=require(_0x94bd('0x4'));var router=express[_0x94bd('0x5')]();var fs_extra=require(_0x94bd('0x6'));var auth=require(_0x94bd('0x7'));var interaction=require(_0x94bd('0x8'));var config=require('../../config/environment');var controller=require(_0x94bd('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x94bd('0xa')]);router[_0x94bd('0xb')](_0x94bd('0xc'),auth[_0x94bd('0xd')](),controller[_0x94bd('0xe')]);router[_0x94bd('0xb')](_0x94bd('0xf'),auth[_0x94bd('0xd')](),controller[_0x94bd('0x10')]);router[_0x94bd('0xb')](_0x94bd('0x11'),auth[_0x94bd('0xd')](),controller[_0x94bd('0x12')]);router[_0x94bd('0xb')](_0x94bd('0x13'),auth[_0x94bd('0xd')](),controller['getAnswers']);router[_0x94bd('0xb')]('/:id/in_servers',auth[_0x94bd('0xd')](),controller[_0x94bd('0x14')]);router[_0x94bd('0xb')]('/:id/out_servers',auth[_0x94bd('0xd')](),controller[_0x94bd('0x15')]);router[_0x94bd('0xb')](_0x94bd('0x16'),auth[_0x94bd('0xd')](),controller[_0x94bd('0x17')]);router['get'](_0x94bd('0x18'),auth[_0x94bd('0xd')](),controller[_0x94bd('0x19')]);router[_0x94bd('0xb')](_0x94bd('0x1a'),auth[_0x94bd('0xd')](),controller[_0x94bd('0x1b')]);router[_0x94bd('0xb')](_0x94bd('0x1c'),auth[_0x94bd('0xd')](),controller[_0x94bd('0x1d')]);router['get'](_0x94bd('0x1e'),auth['isAuthenticated'](),controller[_0x94bd('0x1f')]);router[_0x94bd('0x20')](_0x94bd('0x11'),auth[_0x94bd('0xd')](),controller[_0x94bd('0x21')]);router[_0x94bd('0x20')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x94bd('0x22')]);router[_0x94bd('0x20')]('/',auth[_0x94bd('0xd')](),controller[_0x94bd('0x23')]);router[_0x94bd('0x20')](_0x94bd('0x24'),auth[_0x94bd('0xd')](),controller[_0x94bd('0x25')]);router[_0x94bd('0x20')](_0x94bd('0x26'),auth['isAuthenticated'](),controller['addSmtp']);router[_0x94bd('0x20')](_0x94bd('0x16'),auth[_0x94bd('0xd')](),controller[_0x94bd('0x27')]);router[_0x94bd('0x20')](_0x94bd('0x18'),auth['isAuthenticated'](),controller['addApplications']);router[_0x94bd('0x20')](_0x94bd('0x28'),auth[_0x94bd('0xd')](),controller[_0x94bd('0x29')]);router[_0x94bd('0x20')](_0x94bd('0x1e'),auth[_0x94bd('0xd')](),controller['addAgents']);router['put']('/:id',auth[_0x94bd('0xd')](),controller['update']);router[_0x94bd('0x2a')]('/:id/dispositions',auth[_0x94bd('0xd')](),controller['removeDispositions']);router[_0x94bd('0x2a')](_0x94bd('0x13'),auth[_0x94bd('0xd')](),controller[_0x94bd('0x2b')]);router[_0x94bd('0x2a')](_0x94bd('0x24'),auth['isAuthenticated'](),controller[_0x94bd('0x2c')]);router[_0x94bd('0x2a')](_0x94bd('0x26'),auth['isAuthenticated'](),controller[_0x94bd('0x2d')]);router[_0x94bd('0x2a')]('/:id',auth['isAuthenticated'](),controller[_0x94bd('0x2e')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0x94bd('0x2f')]);module[_0x94bd('0x30')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index fac9d13..bb5f104 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 _0xcbae=['outlook365','getDataValue','provider','custom','setDataValue','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','ENUM','gmail','hotmail'];(function(_0x5789c6,_0x55f3a0){var _0xad47f1=function(_0x49a37d){while(--_0x49a37d){_0x5789c6['push'](_0x5789c6['shift']());}};_0xad47f1(++_0x55f3a0);}(_0xcbae,0x8a));var _0xecba=function(_0x54ef6b,_0x37c730){_0x54ef6b=_0x54ef6b-0x0;var _0x1fdce3=_0xcbae[_0x54ef6b];return _0x1fdce3;};'use strict';var Sequelize=require(_0xecba('0x0'));module[_0xecba('0x1')]={'description':{'type':Sequelize[_0xecba('0x2')]},'name':{'type':Sequelize[_0xecba('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0xecba('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xecba('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xecba('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0xecba('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0xecba('0x4')]},'markAsUnread':{'type':Sequelize[_0xecba('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xecba('0x2')],'allowNull':![],'defaultValue':_0xecba('0x5')},'fontSize':{'type':Sequelize[_0xecba('0x6')](0x2)[_0xecba('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xecba('0x4')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xecba('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xecba('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xecba('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xecba('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xecba('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xecba('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xecba('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0xecba('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x5a3590){if(!_0x5a3590)this['setDataValue'](_0xecba('0x9'),null);this['setDataValue'](_0xecba('0xa'),_0x5a3590);}},'provider':{'type':Sequelize[_0xecba('0xb')](_0xecba('0xc'),_0xecba('0xd'),'yahoo',_0xecba('0xe')),'defaultValue':null,'get':function(){var _0x4159f4=this[_0xecba('0xf')](_0xecba('0x10'));return _0x4159f4||_0xecba('0x11');},'set':function(_0x43263e){if(_0x43263e===_0xecba('0x11')){_0x43263e=null;}return this[_0xecba('0x12')](_0xecba('0x10'),_0x43263e);}}}; \ No newline at end of file +var _0xe471=['mandatoryDispositionPauseId','ENUM','gmail','hotmail','yahoo','getDataValue','provider','custom','sequelize','exports','BOOLEAN','STRING','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x283e0e,_0x3f29df){var _0x37f29a=function(_0x57235f){while(--_0x57235f){_0x283e0e['push'](_0x283e0e['shift']());}};_0x37f29a(++_0x3f29df);}(_0xe471,0x148));var _0x1e47=function(_0x13dd75,_0x3ce801){_0x13dd75=_0x13dd75-0x0;var _0x162745=_0xe471[_0x13dd75];return _0x162745;};'use strict';var Sequelize=require(_0x1e47('0x0'));module[_0x1e47('0x1')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0x1e47('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x1e47('0x3')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x1e47('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0x1e47('0x3')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0x1e47('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x1e47('0x3')],'allowNull':![],'defaultValue':_0x1e47('0x4')},'fontSize':{'type':Sequelize[_0x1e47('0x5')](0x2)[_0x1e47('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x1e47('0x7')],'defaultValue':function(){return _0x1e47('0x8');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x1e47('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1e47('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x1e47('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x1e47('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1e47('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1e47('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1e47('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x1e47('0x9')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x1e47('0xa'),'set':function(_0x32d5a5){if(!_0x32d5a5)this[_0x1e47('0xb')](_0x1e47('0xc'),null);this[_0x1e47('0xb')]('mandatoryDisposition',_0x32d5a5);}},'provider':{'type':Sequelize[_0x1e47('0xd')](_0x1e47('0xe'),_0x1e47('0xf'),_0x1e47('0x10'),'outlook365'),'defaultValue':null,'get':function(){var _0x5d2289=this[_0x1e47('0x11')](_0x1e47('0x12'));return _0x5d2289||_0x1e47('0x13');},'set':function(_0x11c5e4){if(_0x11c5e4==='custom'){_0x11c5e4=null;}return this[_0x1e47('0xb')](_0x1e47('0x12'),_0x11c5e4);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 8e2ecd4..bb3b937 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 _0xf852=['from','email','attachments','join','root','basename','SendMail','sendMail','List','List\x20not\x20found','Contacts','subject','attach','out','messageId','Interaction','Messages','verifySmtp','getSmtpOptions','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','User','util','path','lodash','juice','ioredis','../../config/logger','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','destroy','get','MailAccounts','UserProfileResource','sendStatus','stack','name','send','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','Unknown\x20email\x20service\x20provider','user','password','pass','modernAuthentication','CloudProviderId','host','secure','service','authentication','username','Imap','port','Smtp','MailServerOut','mandatoryDispositionPause','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','merge','type','VIRTUAL','filter','options','MailAccount','includeAll','include','rows','show','params','MailServerIn','Pause','rawAttributes','update','body','custom','provider','find','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','Disposition','create','findOne','nolimit','order','pick','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findAll','removeAnswers','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','MailInteraction','omit','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','getMessages','MailMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','split','CmContact','updatedAt','DESC','CloudProvider'];(function(_0x38ced4,_0x24263f){var _0x547c07=function(_0x279fc4){while(--_0x279fc4){_0x38ced4['push'](_0x38ced4['shift']());}};_0x547c07(++_0x24263f);}(_0xf852,0x1b2));var _0x2f85=function(_0xa8dc5f,_0x14e053){_0xa8dc5f=_0xa8dc5f-0x0;var _0x5d0ac3=_0xf852[_0xa8dc5f];return _0x5d0ac3;};'use strict';var moment=require('moment');var BPromise=require('bluebird');var util=require(_0x2f85('0x0'));var path=require(_0x2f85('0x1'));var _=require(_0x2f85('0x2'));var juice=require(_0x2f85('0x3'));var Redis=require(_0x2f85('0x4'));var qs=require('../../components/parsers/qs');var logger=require(_0x2f85('0x5'))('api');var config=require('../../config/environment');var db=require(_0x2f85('0x6'))['db'];config[_0x2f85('0x7')]=_[_0x2f85('0x8')](config[_0x2f85('0x7')],{'host':_0x2f85('0x9'),'port':0x18eb});var socket=require(_0x2f85('0xa'))(new Redis(config[_0x2f85('0x7')]));require(_0x2f85('0xb'))[_0x2f85('0xc')](socket);var jayson=require(_0x2f85('0xd'));var client=jayson[_0x2f85('0xe')][_0x2f85('0xf')]({'port':0x232b});function respondWithRpcPromise(_0x404e82,_0x1c6125,_0xb812b5,_0xefe293){return new BPromise(function(_0x53baa7,_0x38b1a3){var _0x553cef=_0xefe293||client;return _0x553cef[_0x2f85('0x10')](_0x404e82,_0xb812b5)[_0x2f85('0x11')](function(_0x20e8a5){logger[_0x2f85('0x12')](_0x2f85('0x13'),_0x1c6125,_0x2f85('0x14'));logger[_0x2f85('0x15')](_0x2f85('0x16'),_0x1c6125,_0x2f85('0x14'),JSON['stringify'](_0x20e8a5));if(_0x20e8a5[_0x2f85('0x17')]){if(_0x20e8a5[_0x2f85('0x17')][_0x2f85('0x18')]===0x1f4){logger[_0x2f85('0x17')](_0x2f85('0x13'),_0x1c6125,_0x20e8a5[_0x2f85('0x17')]['message']);return _0x38b1a3(_0x20e8a5[_0x2f85('0x17')][_0x2f85('0x19')]);}logger[_0x2f85('0x17')]('MailAccount,\x20%s,\x20%s',_0x1c6125,_0x20e8a5[_0x2f85('0x17')][_0x2f85('0x19')]);return _0x53baa7(_0x20e8a5[_0x2f85('0x17')][_0x2f85('0x19')]);}else{logger[_0x2f85('0x12')]('MailAccount,\x20%s,\x20%s',_0x1c6125,_0x2f85('0x14'));_0x53baa7(_0x20e8a5['result'][_0x2f85('0x19')]);}})[_0x2f85('0x1a')](function(_0x5abd6c){logger['error']('MailAccount,\x20%s,\x20%s',_0x1c6125,_0x5abd6c);_0x38b1a3(_0x5abd6c);});});}function respondWithStatusCode(_0x1d1e89,_0x579667){_0x579667=_0x579667||0xcc;return function(_0x515e2c){if(_0x515e2c){return _0x1d1e89['sendStatus'](_0x579667);}return _0x1d1e89[_0x2f85('0x1b')](_0x579667)[_0x2f85('0x1c')]();};}function respondWithResult(_0x1a89b7,_0x5b71c8){_0x5b71c8=_0x5b71c8||0xc8;return function(_0x3da77a){if(_0x3da77a){return _0x1a89b7[_0x2f85('0x1b')](_0x5b71c8)[_0x2f85('0x1d')](_0x3da77a);}};}function respondWithFilteredResult(_0x917c13,_0x5b445b){return function(_0x2bd1c0){if(_0x2bd1c0){var _0x1deeb0=typeof _0x5b445b[_0x2f85('0x1e')]===_0x2f85('0x1f')&&typeof _0x5b445b[_0x2f85('0x20')]===_0x2f85('0x1f');var _0x3a4fb1=_0x2bd1c0[_0x2f85('0x21')];var _0x130851=_0x1deeb0?0x0:_0x5b445b['offset'];var _0x3f500d=_0x1deeb0?_0x2bd1c0[_0x2f85('0x21')]:_0x5b445b[_0x2f85('0x1e')]+_0x5b445b[_0x2f85('0x20')];var _0x435327;if(_0x3f500d>=_0x3a4fb1){_0x3f500d=_0x3a4fb1;_0x435327=0xc8;}else{_0x435327=0xce;}_0x917c13[_0x2f85('0x1b')](_0x435327);return _0x917c13[_0x2f85('0x22')](_0x2f85('0x23'),_0x130851+'-'+_0x3f500d+'/'+_0x3a4fb1)[_0x2f85('0x1d')](_0x2bd1c0);}return null;};}function saveUpdates(_0x49323f){return function(_0x154603){if(_0x154603){return _0x154603['update'](_0x49323f)[_0x2f85('0x11')](function(_0x13124a){return _0x13124a;});}return null;};}function removeEntity(_0x5f105f){return function(_0x57e674){if(_0x57e674){return _0x57e674[_0x2f85('0x24')]()[_0x2f85('0x11')](function(){var _0x313df4=_0x57e674[_0x2f85('0x25')]({'plain':!![]});var _0x29071b=_0x2f85('0x26');return db[_0x2f85('0x27')][_0x2f85('0x24')]({'where':{'type':_0x29071b,'resourceId':_0x313df4['id']}})[_0x2f85('0x11')](function(){return _0x57e674;});})[_0x2f85('0x11')](function(){_0x5f105f[_0x2f85('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16ad40){return function(_0x119177){if(!_0x119177){_0x16ad40[_0x2f85('0x28')](0x194);}return _0x119177;};}function handleError(_0xd30485,_0xbd555f){_0xbd555f=_0xbd555f||0x1f4;return function(_0x2ec68d){logger['error'](_0x2ec68d[_0x2f85('0x29')]);if(_0x2ec68d[_0x2f85('0x2a')]){delete _0x2ec68d['name'];}_0xd30485[_0x2f85('0x1b')](_0xbd555f)[_0x2f85('0x2b')](_0x2ec68d);};}function getImapHost(_0x131e3d){switch(_0x131e3d){case _0x2f85('0x2c'):return _0x2f85('0x2d');case _0x2f85('0x2e'):return _0x2f85('0x2f');case _0x2f85('0x30'):return _0x2f85('0x31');case _0x2f85('0x32'):return _0x2f85('0x33');}throw new Error('Unknown\x20email\x20service\x20provider',_0x131e3d);}function getSmtpHost(_0x4271d4){switch(_0x4271d4){case _0x2f85('0x2c'):return _0x2f85('0x34');case _0x2f85('0x2e'):return _0x2f85('0x35');case'hotmail':return _0x2f85('0x36');case'outlook365':return _0x2f85('0x37');}throw new Error(_0x2f85('0x38'),_0x4271d4);}function getAuthenticationOptions(_0x5ae159,_0x12150e){var _0x319a6b={};var _0x4ebe63={};if(_0x5ae159){_0x319a6b['user']=_0x4ebe63[_0x2f85('0x39')]=_0x12150e['username'];_0x319a6b[_0x2f85('0x3a')]=_0x4ebe63[_0x2f85('0x3b')]=_0x12150e[_0x2f85('0x3a')];if(_0x12150e[_0x2f85('0x3c')]){_0x319a6b[_0x2f85('0x3c')]=_0x4ebe63[_0x2f85('0x3c')]=!![];_0x319a6b['CloudProviderId']=_0x4ebe63[_0x2f85('0x3d')]=_0x12150e[_0x2f85('0x3d')];_0x319a6b['password']=_0x4ebe63[_0x2f85('0x3b')]=null;}else{_0x319a6b['CloudProviderId']=_0x4ebe63[_0x2f85('0x3d')]=null;}_0x319a6b['host']=getImapHost(_0x5ae159);_0x319a6b['port']=0x3e1;_0x4ebe63[_0x2f85('0x3e')]=getSmtpHost(_0x5ae159);_0x4ebe63['port']=0x24b;_0x4ebe63[_0x2f85('0x3f')]=![];_0x319a6b[_0x2f85('0x40')]=_0x4ebe63[_0x2f85('0x40')]=null;}else{if(_0x12150e[_0x2f85('0x41')]){_0x319a6b[_0x2f85('0x39')]=_0x4ebe63[_0x2f85('0x39')]=_0x12150e[_0x2f85('0x42')];_0x319a6b[_0x2f85('0x3a')]=_0x4ebe63['pass']=_0x12150e[_0x2f85('0x3a')];}else{_0x319a6b[_0x2f85('0x41')]=_0x4ebe63[_0x2f85('0x41')]=![];_0x319a6b[_0x2f85('0x39')]=_0x4ebe63['user']=null;_0x319a6b[_0x2f85('0x3a')]=_0x4ebe63[_0x2f85('0x3b')]=null;}_0x319a6b['host']=_0x12150e[_0x2f85('0x43')]['host'];_0x319a6b[_0x2f85('0x44')]=_0x12150e['Imap'][_0x2f85('0x44')];_0x4ebe63[_0x2f85('0x3e')]=_0x12150e[_0x2f85('0x45')]['host'];_0x4ebe63[_0x2f85('0x44')]=_0x12150e[_0x2f85('0x45')]['port'];}return{'Imap':_0x319a6b,'Smtp':_0x4ebe63};}exports['index']=function(_0x1281ed,_0x4dbcae){var _0x105918={'include':[{'model':db['MailServerIn'],'as':_0x2f85('0x43')},{'model':db[_0x2f85('0x46')],'as':_0x2f85('0x45')},{'model':db['Pause'],'as':_0x2f85('0x47')}]},_0x3ebd2b={},_0x2f12c4={'count':0x0,'rows':[]};var _0xf86578=_['map'](db['MailAccount']['rawAttributes'],function(_0x33a612){return{'name':_0x33a612[_0x2f85('0x48')],'type':_0x33a612['type'][_0x2f85('0x49')]};});_0x3ebd2b[_0x2f85('0x4a')]=_[_0x2f85('0x4b')](_0xf86578,_0x2f85('0x2a'));_0x3ebd2b[_0x2f85('0x4c')]=_[_0x2f85('0x4d')](_0x1281ed[_0x2f85('0x4c')]);_0x3ebd2b[_0x2f85('0x4e')]=_[_0x2f85('0x4f')](_0x3ebd2b['model'],_0x3ebd2b['query']);_0x105918[_0x2f85('0x50')]=_[_0x2f85('0x4f')](_0x3ebd2b[_0x2f85('0x4a')],qs[_0x2f85('0x51')](_0x1281ed[_0x2f85('0x4c')][_0x2f85('0x51')]));_0x105918[_0x2f85('0x50')]=_0x105918[_0x2f85('0x50')][_0x2f85('0x52')]?_0x105918[_0x2f85('0x50')]:_0x3ebd2b['model'];if(!_0x1281ed[_0x2f85('0x4c')][_0x2f85('0x53')]('nolimit')){_0x105918[_0x2f85('0x20')]=qs[_0x2f85('0x20')](_0x1281ed[_0x2f85('0x4c')][_0x2f85('0x20')]);_0x105918['offset']=qs['offset'](_0x1281ed[_0x2f85('0x4c')][_0x2f85('0x1e')]);}_0x105918['order']=qs['sort'](_0x1281ed[_0x2f85('0x4c')][_0x2f85('0x54')]);_0x105918['where']=qs['filters'](_['pick'](_0x1281ed[_0x2f85('0x4c')],_0x3ebd2b['filters']),_0xf86578);if(_0x1281ed[_0x2f85('0x4c')]['filter']){_0x105918[_0x2f85('0x55')]=_[_0x2f85('0x56')](_0x105918[_0x2f85('0x55')],{'$or':_[_0x2f85('0x4b')](_0xf86578,function(_0x1a571f){if(_0x1a571f[_0x2f85('0x57')]!==_0x2f85('0x58')){var _0x1bd8fa={};_0x1bd8fa[_0x1a571f['name']]={'$like':'%'+_0x1281ed[_0x2f85('0x4c')][_0x2f85('0x59')]+'%'};return _0x1bd8fa;}})});}_0x105918=_['merge']({},_0x105918,_0x1281ed[_0x2f85('0x5a')]);var _0x17d5c7={'where':_0x105918[_0x2f85('0x55')]};return db[_0x2f85('0x5b')][_0x2f85('0x21')](_0x17d5c7)[_0x2f85('0x11')](function(_0x43bf6a){_0x2f12c4[_0x2f85('0x21')]=_0x43bf6a;if(_0x1281ed['query'][_0x2f85('0x5c')]){_0x105918[_0x2f85('0x5d')]=[{'all':!![]}];}return db['MailAccount']['findAll'](_0x105918);})['then'](function(_0x441524){_0x2f12c4[_0x2f85('0x5e')]=_0x441524;return _0x2f12c4;})['then'](respondWithFilteredResult(_0x4dbcae,_0x105918))[_0x2f85('0x1a')](handleError(_0x4dbcae,null));};exports[_0x2f85('0x5f')]=function(_0x236c50,_0x201b18){var _0x205ff7={'raw':![],'where':{'id':_0x236c50[_0x2f85('0x60')]['id']},'include':[{'model':db[_0x2f85('0x61')],'as':_0x2f85('0x43')},{'model':db[_0x2f85('0x46')],'as':_0x2f85('0x45')},{'model':db[_0x2f85('0x62')],'as':'mandatoryDispositionPause'}]},_0x3f4056={};_0x3f4056['model']=_[_0x2f85('0x4d')](db[_0x2f85('0x5b')][_0x2f85('0x63')]);_0x3f4056[_0x2f85('0x4c')]=_[_0x2f85('0x4d')](_0x236c50[_0x2f85('0x4c')]);_0x3f4056['filters']=_[_0x2f85('0x4f')](_0x3f4056[_0x2f85('0x4a')],_0x3f4056[_0x2f85('0x4c')]);_0x205ff7['attributes']=_[_0x2f85('0x4f')](_0x3f4056[_0x2f85('0x4a')],qs[_0x2f85('0x51')](_0x236c50['query'][_0x2f85('0x51')]));_0x205ff7[_0x2f85('0x50')]=_0x205ff7[_0x2f85('0x50')][_0x2f85('0x52')]?_0x205ff7[_0x2f85('0x50')]:_0x3f4056[_0x2f85('0x4a')];if(_0x236c50[_0x2f85('0x4c')][_0x2f85('0x5c')]){_0x205ff7['include']=[{'all':!![]}];}_0x205ff7=_[_0x2f85('0x56')]({},_0x205ff7,_0x236c50[_0x2f85('0x5a')]);return db[_0x2f85('0x5b')]['find'](_0x205ff7)[_0x2f85('0x11')](handleEntityNotFound(_0x201b18,null))['then'](respondWithResult(_0x201b18,null))['catch'](handleError(_0x201b18,null));};exports[_0x2f85('0x64')]=function(_0xc4c08,_0x44dfd5){if(_0xc4c08[_0x2f85('0x65')]['id']){delete _0xc4c08[_0x2f85('0x65')]['id'];}var _0x2f9e05=_0xc4c08['body']['provider']===_0x2f85('0x66')?null:_0xc4c08[_0x2f85('0x65')][_0x2f85('0x67')];var _0x1ff5f6=_0xc4c08[_0x2f85('0x65')][_0x2f85('0x43')]||{};var _0x416f2c=_0xc4c08[_0x2f85('0x65')]['Smtp']||{};if(_0x2f9e05){_0x1ff5f6[_0x2f85('0x3e')]=getImapHost(_0x2f9e05);_0x1ff5f6[_0x2f85('0x44')]=0x3e1;_0x416f2c[_0x2f85('0x3e')]=getSmtpHost(_0x2f9e05);_0x416f2c[_0x2f85('0x44')]=0x24b;_0x416f2c[_0x2f85('0x3f')]=![];}if(_0x416f2c[_0x2f85('0x3c')]){_0x416f2c['secure']=![];}else{_0x416f2c[_0x2f85('0x3d')]=null;}if(!_0x1ff5f6[_0x2f85('0x3c')])_0x1ff5f6[_0x2f85('0x3d')]=null;_0xc4c08[_0x2f85('0x65')][_0x2f85('0x43')]=_0x1ff5f6;_0xc4c08[_0x2f85('0x65')]['Smtp']=_0x416f2c;return db[_0x2f85('0x5b')][_0x2f85('0x68')]({'where':{'id':_0xc4c08[_0x2f85('0x60')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x2f85('0x43')},{'model':db[_0x2f85('0x46')],'as':_0x2f85('0x45')},{'model':db[_0x2f85('0x62')],'as':'mandatoryDispositionPause'}]})[_0x2f85('0x11')](handleEntityNotFound(_0x44dfd5,null))[_0x2f85('0x11')](function(_0x51d4d9){if(!_0x51d4d9)throw new Error(_0x2f85('0x69'));if(_0x51d4d9[_0x2f85('0x40')])delete _0xc4c08['body'][_0x2f85('0x43')];return _0x51d4d9;})['then'](saveUpdates(_0xc4c08[_0x2f85('0x65')],null))[_0x2f85('0x11')](function(_0x225293){if(!_0xc4c08[_0x2f85('0x65')][_0x2f85('0x43')])return _0x225293;return db[_0x2f85('0x61')][_0x2f85('0x64')](_0xc4c08[_0x2f85('0x65')][_0x2f85('0x43')],{'where':{'MailAccountId':_0x225293['id']}})[_0x2f85('0x11')](function(){return _0x225293;});})[_0x2f85('0x11')](function(_0x2a58ed){if(!_0xc4c08['body'][_0x2f85('0x45')])return _0x2a58ed;return db[_0x2f85('0x46')]['update'](_0xc4c08[_0x2f85('0x65')]['Smtp'],{'where':{'MailAccountId':_0x2a58ed['id']}})['then'](function(){return _0x2a58ed;});})[_0x2f85('0x11')](respondWithResult(_0x44dfd5,null))[_0x2f85('0x1a')](handleError(_0x44dfd5,null));};exports[_0x2f85('0x6a')]=function(_0xcaac97,_0x3d661b){return db[_0x2f85('0x5b')]['describe']()['then'](respondWithResult(_0x3d661b,null))[_0x2f85('0x1a')](handleError(_0x3d661b,null));};exports[_0x2f85('0x6b')]=function(_0x351f36,_0x9f3112){if(_0x351f36['body']['id']){delete _0x351f36['body']['id'];}return db['MailAccount'][_0x2f85('0x68')]({'where':{'id':_0x351f36['params']['id']}})[_0x2f85('0x11')](handleEntityNotFound(_0x9f3112,null))[_0x2f85('0x11')](function(_0x4c0103){if(_0x4c0103){_0x351f36['body'][_0x2f85('0x6c')]=_0x4c0103['id'];return db[_0x2f85('0x6d')][_0x2f85('0x6e')](_0x351f36[_0x2f85('0x65')]);}})[_0x2f85('0x11')](respondWithResult(_0x9f3112,null))[_0x2f85('0x1a')](handleError(_0x9f3112,null));};exports['getDispositions']=function(_0x3719b0,_0x449df9){var _0x5b1d8a={'raw':![],'where':{}};var _0x2de18f={};var _0x33e470={'count':0x0,'rows':[]};return db['MailAccount'][_0x2f85('0x6f')]({'where':{'id':_0x3719b0[_0x2f85('0x60')]['id']}})[_0x2f85('0x11')](handleEntityNotFound(_0x449df9,null))['then'](function(_0x2f4aec){if(_0x2f4aec){_0x2de18f['model']=_[_0x2f85('0x4d')](db[_0x2f85('0x6d')][_0x2f85('0x63')]);_0x2de18f[_0x2f85('0x4c')]=_[_0x2f85('0x4d')](_0x3719b0[_0x2f85('0x4c')]);_0x2de18f[_0x2f85('0x4e')]=_[_0x2f85('0x4f')](_0x2de18f[_0x2f85('0x4a')],_0x2de18f[_0x2f85('0x4c')]);_0x5b1d8a[_0x2f85('0x50')]=_['intersection'](_0x2de18f[_0x2f85('0x4a')],qs[_0x2f85('0x51')](_0x3719b0['query'][_0x2f85('0x51')]));_0x5b1d8a[_0x2f85('0x50')]=_0x5b1d8a[_0x2f85('0x50')]['length']?_0x5b1d8a[_0x2f85('0x50')]:_0x2de18f[_0x2f85('0x4a')];if(!_0x3719b0[_0x2f85('0x4c')][_0x2f85('0x53')](_0x2f85('0x70'))){_0x5b1d8a[_0x2f85('0x20')]=qs[_0x2f85('0x20')](_0x3719b0[_0x2f85('0x4c')][_0x2f85('0x20')]);_0x5b1d8a[_0x2f85('0x1e')]=qs[_0x2f85('0x1e')](_0x3719b0['query'][_0x2f85('0x1e')]);}_0x5b1d8a[_0x2f85('0x71')]=qs['sort'](_0x3719b0[_0x2f85('0x4c')][_0x2f85('0x54')]);_0x5b1d8a[_0x2f85('0x55')]=qs[_0x2f85('0x4e')](_[_0x2f85('0x72')](_0x3719b0[_0x2f85('0x4c')],_0x2de18f[_0x2f85('0x4e')]));_0x5b1d8a['where'][_0x2f85('0x6c')]=_0x2f4aec['id'];if(_0x3719b0[_0x2f85('0x4c')]['filter']){_0x5b1d8a[_0x2f85('0x55')]=_[_0x2f85('0x56')](_0x5b1d8a['where'],{'$or':_[_0x2f85('0x4b')](_0x5b1d8a['attributes'],function(_0x1d8de1){var _0x54fe08={};_0x54fe08[_0x1d8de1]={'$like':'%'+_0x3719b0[_0x2f85('0x4c')][_0x2f85('0x59')]+'%'};return _0x54fe08;})});}_0x5b1d8a=_[_0x2f85('0x56')]({},_0x5b1d8a,_0x3719b0[_0x2f85('0x5a')]);return db['Disposition'][_0x2f85('0x21')]({'where':_0x5b1d8a['where']})[_0x2f85('0x11')](function(_0x392a4b){_0x33e470['count']=_0x392a4b;if(_0x3719b0[_0x2f85('0x4c')]['includeAll']){_0x5b1d8a[_0x2f85('0x5d')]=[{'all':!![]}];}return db[_0x2f85('0x6d')]['findAll'](_0x5b1d8a);})[_0x2f85('0x11')](function(_0x1fa978){_0x33e470[_0x2f85('0x5e')]=_0x1fa978;return _0x33e470;});}})['then'](respondWithFilteredResult(_0x449df9,_0x5b1d8a))[_0x2f85('0x1a')](handleError(_0x449df9,null));};exports[_0x2f85('0x73')]=function(_0x1160b6,_0x23a6a8){return db['MailAccount'][_0x2f85('0x68')]({'where':{'id':_0x1160b6[_0x2f85('0x60')]['id']}})[_0x2f85('0x11')](handleEntityNotFound(_0x23a6a8,null))[_0x2f85('0x11')](function(_0x1f1289){if(_0x1f1289){return _0x1f1289[_0x2f85('0x73')](_0x1160b6[_0x2f85('0x4c')][_0x2f85('0x74')]);}})['then'](respondWithStatusCode(_0x23a6a8,null))['catch'](handleError(_0x23a6a8,null));};exports[_0x2f85('0x75')]=function(_0x4a256b,_0x366f25){if(_0x4a256b[_0x2f85('0x65')]['id']){delete _0x4a256b[_0x2f85('0x65')]['id'];}return db[_0x2f85('0x5b')][_0x2f85('0x68')]({'where':{'id':_0x4a256b['params']['id']}})[_0x2f85('0x11')](handleEntityNotFound(_0x366f25,null))['then'](function(_0x30c825){if(_0x30c825){_0x4a256b[_0x2f85('0x65')][_0x2f85('0x6c')]=_0x30c825['id'];return db[_0x2f85('0x76')][_0x2f85('0x6e')](_0x4a256b['body']);}})[_0x2f85('0x11')](respondWithResult(_0x366f25,null))[_0x2f85('0x1a')](handleError(_0x366f25,null));};exports[_0x2f85('0x77')]=function(_0x3ab5ab,_0x215bc6){var _0x212586={'raw':![],'where':{}};var _0x563897={};var _0x5c8159={'count':0x0,'rows':[]};return db[_0x2f85('0x5b')][_0x2f85('0x6f')]({'where':{'id':_0x3ab5ab[_0x2f85('0x60')]['id']}})[_0x2f85('0x11')](handleEntityNotFound(_0x215bc6,null))['then'](function(_0x1dcdf4){if(_0x1dcdf4){_0x563897[_0x2f85('0x4a')]=_[_0x2f85('0x4d')](db[_0x2f85('0x76')][_0x2f85('0x63')]);_0x563897[_0x2f85('0x4c')]=_[_0x2f85('0x4d')](_0x3ab5ab['query']);_0x563897['filters']=_[_0x2f85('0x4f')](_0x563897[_0x2f85('0x4a')],_0x563897[_0x2f85('0x4c')]);_0x212586[_0x2f85('0x50')]=_[_0x2f85('0x4f')](_0x563897[_0x2f85('0x4a')],qs['fields'](_0x3ab5ab[_0x2f85('0x4c')][_0x2f85('0x51')]));_0x212586[_0x2f85('0x50')]=_0x212586[_0x2f85('0x50')][_0x2f85('0x52')]?_0x212586['attributes']:_0x563897[_0x2f85('0x4a')];if(!_0x3ab5ab['query']['hasOwnProperty'](_0x2f85('0x70'))){_0x212586[_0x2f85('0x20')]=qs[_0x2f85('0x20')](_0x3ab5ab['query'][_0x2f85('0x20')]);_0x212586[_0x2f85('0x1e')]=qs[_0x2f85('0x1e')](_0x3ab5ab[_0x2f85('0x4c')][_0x2f85('0x1e')]);}_0x212586[_0x2f85('0x71')]=qs[_0x2f85('0x54')](_0x3ab5ab[_0x2f85('0x4c')]['sort']);_0x212586[_0x2f85('0x55')]=qs[_0x2f85('0x4e')](_[_0x2f85('0x72')](_0x3ab5ab[_0x2f85('0x4c')],_0x563897[_0x2f85('0x4e')]));_0x212586[_0x2f85('0x55')][_0x2f85('0x6c')]=_0x1dcdf4['id'];if(_0x3ab5ab[_0x2f85('0x4c')]['filter']){_0x212586[_0x2f85('0x55')]=_[_0x2f85('0x56')](_0x212586['where'],{'$or':_[_0x2f85('0x4b')](_0x212586['attributes'],function(_0x128a0c){var _0x33e5d5={};_0x33e5d5[_0x128a0c]={'$like':'%'+_0x3ab5ab[_0x2f85('0x4c')][_0x2f85('0x59')]+'%'};return _0x33e5d5;})});}_0x212586=_[_0x2f85('0x56')]({},_0x212586,_0x3ab5ab[_0x2f85('0x5a')]);return db[_0x2f85('0x76')][_0x2f85('0x21')]({'where':_0x212586[_0x2f85('0x55')]})[_0x2f85('0x11')](function(_0x3917d7){_0x5c8159[_0x2f85('0x21')]=_0x3917d7;if(_0x3ab5ab[_0x2f85('0x4c')][_0x2f85('0x5c')]){_0x212586[_0x2f85('0x5d')]=[{'all':!![]}];}return db['CannedAnswer'][_0x2f85('0x78')](_0x212586);})[_0x2f85('0x11')](function(_0x2acfee){_0x5c8159['rows']=_0x2acfee;return _0x5c8159;});}})['then'](respondWithFilteredResult(_0x215bc6,_0x212586))['catch'](handleError(_0x215bc6,null));};exports[_0x2f85('0x79')]=function(_0x39a731,_0x30faee){return db[_0x2f85('0x5b')][_0x2f85('0x68')]({'where':{'id':_0x39a731[_0x2f85('0x60')]['id']}})[_0x2f85('0x11')](handleEntityNotFound(_0x30faee,null))['then'](function(_0x46ead0){if(_0x46ead0){return _0x46ead0[_0x2f85('0x79')](_0x39a731[_0x2f85('0x4c')][_0x2f85('0x74')]);}})[_0x2f85('0x11')](respondWithStatusCode(_0x30faee,null))[_0x2f85('0x1a')](handleError(_0x30faee,null));};exports['create']=function(_0x124621,_0x481402){var _0x1a8f62={'name':_0x124621[_0x2f85('0x65')][_0x2f85('0x2a')],'key':_0x124621['body']['key'],'provider':_0x124621[_0x2f85('0x65')][_0x2f85('0x67')]==='custom'?null:_0x124621[_0x2f85('0x65')][_0x2f85('0x67')],'email':_0x124621[_0x2f85('0x65')]['email'],'ListId':_0x124621[_0x2f85('0x65')][_0x2f85('0x7a')],'active':!_[_0x2f85('0x7b')](_0x124621[_0x2f85('0x65')][_0x2f85('0x7c')])?_0x124621[_0x2f85('0x65')]['active']:!![],'description':_0x124621[_0x2f85('0x65')][_0x2f85('0x7d')]||null};var _0x3c1c9c=getAuthenticationOptions(_0x1a8f62[_0x2f85('0x67')],_0x124621[_0x2f85('0x65')]);_0x1a8f62[_0x2f85('0x43')]=_0x3c1c9c[_0x2f85('0x43')];_0x1a8f62[_0x2f85('0x45')]=_0x3c1c9c[_0x2f85('0x45')];return db[_0x2f85('0x5b')][_0x2f85('0x6e')](_0x1a8f62,{'include':[{'model':db[_0x2f85('0x46')],'as':_0x2f85('0x45')},{'model':db[_0x2f85('0x61')],'as':_0x2f85('0x43')}]})[_0x2f85('0x11')](function(_0x33c1b8){var _0x2144af=_0x124621['user'][_0x2f85('0x25')]({'plain':!![]});if(!_0x2144af)throw new Error(_0x2f85('0x7e'));if(_0x2144af[_0x2f85('0x7f')]===_0x2f85('0x39')){var _0x4fbfae=_0x33c1b8[_0x2f85('0x25')]({'plain':!![]});return db[_0x2f85('0x80')][_0x2f85('0x68')]({'where':{'name':'MailAccounts','userProfileId':_0x2144af['userProfileId']},'raw':!![]})[_0x2f85('0x11')](function(_0xdb0a34){if(_0xdb0a34&&_0xdb0a34[_0x2f85('0x81')]===0x0){return db['UserProfileResource'][_0x2f85('0x6e')]({'name':_0x4fbfae[_0x2f85('0x2a')],'resourceId':_0x4fbfae['id'],'type':_0xdb0a34[_0x2f85('0x2a')],'sectionId':_0xdb0a34['id']},{})['then'](function(){return _0x33c1b8;});}else{return _0x33c1b8;}})[_0x2f85('0x1a')](function(_0x4ab714){logger['error'](_0x2f85('0x82'),_0x4ab714);throw _0x4ab714;});}return _0x33c1b8;})[_0x2f85('0x11')](respondWithResult(_0x481402,0xc9))[_0x2f85('0x1a')](handleError(_0x481402,null));};exports[_0x2f85('0x83')]=function(_0xc6c4a3,_0x3453ed){return db['MailAccount']['findOne']({'where':{'id':_0xc6c4a3[_0x2f85('0x60')]['id']}})['then'](handleEntityNotFound(_0x3453ed,null))[_0x2f85('0x11')](function(_0xbec8){if(_0xbec8){return _0xbec8[_0x2f85('0x83')]();}return null;})['then'](respondWithResult(_0x3453ed,null))[_0x2f85('0x1a')](handleError(_0x3453ed,null));};exports['addImap']=function(_0x5a5fec,_0x396035){if(_0x5a5fec['body']['id']){delete _0x5a5fec[_0x2f85('0x65')]['id'];}return db['MailAccount']['find']({'where':{'id':_0x5a5fec[_0x2f85('0x60')]['id']}})['then'](handleEntityNotFound(_0x396035,null))[_0x2f85('0x11')](function(_0x2a6dc2){if(_0x2a6dc2){_0x5a5fec['body'][_0x2f85('0x6c')]=_0x2a6dc2['id'];return db[_0x2f85('0x61')][_0x2f85('0x6e')](_0x5a5fec['body']);}})[_0x2f85('0x11')](respondWithResult(_0x396035,null))[_0x2f85('0x1a')](handleError(_0x396035,null));};exports['removeImap']=function(_0x1c3227,_0x48b0ec){return db[_0x2f85('0x5b')][_0x2f85('0x6f')]({'where':{'id':_0x1c3227[_0x2f85('0x60')]['id']}})[_0x2f85('0x11')](handleEntityNotFound(_0x48b0ec,null))[_0x2f85('0x11')](function(_0x38735c){if(_0x38735c){return _0x38735c[_0x2f85('0x84')](null);}return null;})[_0x2f85('0x11')](respondWithStatusCode(_0x48b0ec,null))['catch'](handleError(_0x48b0ec,null));};exports[_0x2f85('0x85')]=function(_0x3da7bc,_0x312201){return db['MailAccount'][_0x2f85('0x6f')]({'where':{'id':_0x3da7bc[_0x2f85('0x60')]['id']}})[_0x2f85('0x11')](handleEntityNotFound(_0x312201,null))[_0x2f85('0x11')](function(_0x1d2c14){if(_0x1d2c14){return _0x1d2c14['getSmtp']();}return null;})['then'](respondWithResult(_0x312201,null))[_0x2f85('0x1a')](handleError(_0x312201,null));};exports[_0x2f85('0x86')]=function(_0x55a260,_0x2c56bb){if(_0x55a260[_0x2f85('0x65')]['id']){delete _0x55a260[_0x2f85('0x65')]['id'];}return db[_0x2f85('0x5b')][_0x2f85('0x68')]({'where':{'id':_0x55a260[_0x2f85('0x60')]['id']}})[_0x2f85('0x11')](handleEntityNotFound(_0x2c56bb,null))['then'](function(_0x30e72d){if(_0x30e72d){_0x55a260['body'][_0x2f85('0x6c')]=_0x30e72d['id'];return db['MailServerOut'][_0x2f85('0x6e')](_0x55a260[_0x2f85('0x65')]);}})[_0x2f85('0x11')](respondWithResult(_0x2c56bb,null))[_0x2f85('0x1a')](handleError(_0x2c56bb,null));};exports[_0x2f85('0x87')]=function(_0x3afee5,_0x1336b7){return db['MailAccount']['findOne']({'where':{'id':_0x3afee5[_0x2f85('0x60')]['id']}})[_0x2f85('0x11')](handleEntityNotFound(_0x1336b7,null))['then'](function(_0x3a9187){if(_0x3a9187){return _0x3a9187[_0x2f85('0x88')](null);}return null;})[_0x2f85('0x11')](respondWithStatusCode(_0x1336b7,null))[_0x2f85('0x1a')](handleError(_0x1336b7,null));};exports['addInteraction']=function(_0x282fbe,_0x5b8482){return db[_0x2f85('0x89')][_0x2f85('0x68')]({'where':{'id':_0x282fbe[_0x2f85('0x60')]['id']}})['then'](handleEntityNotFound(_0x5b8482,null))[_0x2f85('0x11')](function(_0x510816){if(_0x510816){return _0x510816['addInteraction'](_0x282fbe['body'][_0x2f85('0x74')],_[_0x2f85('0x8a')](_0x282fbe[_0x2f85('0x65')],['ids','id'])||{});}})[_0x2f85('0x11')](respondWithResult(_0x5b8482,null))['catch'](handleError(_0x5b8482,null));};exports[_0x2f85('0x8b')]=function(_0x1888c0,_0x3f6b7d){var _0x2956e3={'raw':![],'where':{}};var _0x34cd16={};var _0x51f051={'count':0x0,'rows':[]};return db[_0x2f85('0x5b')][_0x2f85('0x6f')]({'where':{'id':_0x1888c0[_0x2f85('0x60')]['id']}})[_0x2f85('0x11')](handleEntityNotFound(_0x3f6b7d,null))[_0x2f85('0x11')](function(_0x1bde74){if(_0x1bde74){_0x34cd16[_0x2f85('0x4a')]=_[_0x2f85('0x4d')](db[_0x2f85('0x89')][_0x2f85('0x63')]);_0x34cd16['query']=_['keys'](_0x1888c0[_0x2f85('0x4c')]);_0x34cd16[_0x2f85('0x4e')]=_[_0x2f85('0x4f')](_0x34cd16[_0x2f85('0x4a')],_0x34cd16[_0x2f85('0x4c')]);_0x2956e3[_0x2f85('0x50')]=_[_0x2f85('0x4f')](_0x34cd16['model'],qs[_0x2f85('0x51')](_0x1888c0[_0x2f85('0x4c')][_0x2f85('0x51')]));_0x2956e3[_0x2f85('0x50')]=_0x2956e3['attributes'][_0x2f85('0x52')]?_0x2956e3[_0x2f85('0x50')]:_0x34cd16['model'];if(!_0x1888c0[_0x2f85('0x4c')][_0x2f85('0x53')](_0x2f85('0x70'))){_0x2956e3['limit']=qs[_0x2f85('0x20')](_0x1888c0[_0x2f85('0x4c')][_0x2f85('0x20')]);_0x2956e3['offset']=qs[_0x2f85('0x1e')](_0x1888c0['query'][_0x2f85('0x1e')]);}_0x2956e3[_0x2f85('0x71')]=qs['sort'](_0x1888c0['query'][_0x2f85('0x54')]);_0x2956e3[_0x2f85('0x55')]=qs['filters'](_[_0x2f85('0x72')](_0x1888c0[_0x2f85('0x4c')],_0x34cd16['filters']));_0x2956e3[_0x2f85('0x55')][_0x2f85('0x6c')]=_0x1bde74['id'];if(_0x1888c0[_0x2f85('0x4c')][_0x2f85('0x59')]){_0x2956e3[_0x2f85('0x55')]=_[_0x2f85('0x56')](_0x2956e3[_0x2f85('0x55')],{'$or':_[_0x2f85('0x4b')](_0x2956e3[_0x2f85('0x50')],function(_0x312d88){var _0x59d839={};_0x59d839[_0x312d88]={'$like':'%'+_0x1888c0[_0x2f85('0x4c')][_0x2f85('0x59')]+'%'};return _0x59d839;})});}_0x2956e3=_[_0x2f85('0x56')]({},_0x2956e3,_0x1888c0[_0x2f85('0x5a')]);return db[_0x2f85('0x89')][_0x2f85('0x21')]({'where':_0x2956e3[_0x2f85('0x55')]})[_0x2f85('0x11')](function(_0x29a6bf){_0x51f051[_0x2f85('0x21')]=_0x29a6bf;if(_0x1888c0[_0x2f85('0x4c')]['includeAll']){_0x2956e3[_0x2f85('0x5d')]=[{'model':db['CmContact'],'as':_0x2f85('0x8c'),'required':![]},{'model':db['User'],'as':_0x2f85('0x8d'),'attributes':[_0x2f85('0x2a'),_0x2f85('0x8e'),_0x2f85('0x8f')],'required':![]},{'model':db[_0x2f85('0x90')],'as':_0x2f85('0x91'),'attributes':['id',_0x2f85('0x2a'),_0x2f85('0x92')],'where':_0x1888c0[_0x2f85('0x4c')]['tag']?{'id':_0x1888c0['query'][_0x2f85('0x93')]}:undefined,'required':_0x1888c0[_0x2f85('0x4c')][_0x2f85('0x93')]?!![]:![]}];}return db['MailInteraction'][_0x2f85('0x78')](_0x2956e3);})[_0x2f85('0x11')](function(_0x41b54a){_0x51f051[_0x2f85('0x5e')]=_0x41b54a;return _0x51f051;});}})[_0x2f85('0x11')](respondWithFilteredResult(_0x3f6b7d,_0x2956e3))[_0x2f85('0x1a')](handleError(_0x3f6b7d,null));};exports[_0x2f85('0x94')]=function addApplications(_0x41e8fa,_0x42b05b){var _0x306b82=_0x41e8fa[_0x2f85('0x60')]['id'];var _0x4098f8=_0x41e8fa['body'];var _0x16b69c=0xc8;var _0x2c7045=null;return db['sequelize']['transaction']({'isolationLevel':db[_0x2f85('0x95')][_0x2f85('0x96')][_0x2f85('0x97')][_0x2f85('0x98')]},function(_0x284fc1){return db[_0x2f85('0x5b')]['findOne']({'where':{'id':_0x306b82},'transaction':_0x284fc1})['then'](function(_0x1f39eb){if(_0x1f39eb){return db[_0x2f85('0x99')][_0x2f85('0x24')]({'where':{'MailAccountId':_0x306b82},'transaction':_0x284fc1})[_0x2f85('0x11')](function(){var _0x176425=_[_0x2f85('0x4b')](_0x4098f8,function(_0x5478f8){_0x5478f8[_0x2f85('0x6c')]=_0x306b82;return _0x5478f8;});return db[_0x2f85('0x99')][_0x2f85('0x9a')](_0x176425,{'transaction':_0x284fc1});});}else{_0x16b69c=0x194;_0x2c7045=[];}});})['then'](function(){if(_0x16b69c!==0x194){return db[_0x2f85('0x99')][_0x2f85('0x9b')]({'where':{'MailAccountId':_0x306b82},'order':_0x2f85('0x9c')})[_0x2f85('0x11')](function(_0x1cccd6){_0x2c7045=_0x1cccd6;});}})[_0x2f85('0x1a')](function(_0x5ec293){_0x16b69c=0x1f4;logger[_0x2f85('0x17')](_0x5ec293['stack']);if(_0x5ec293[_0x2f85('0x2a')]){delete _0x5ec293[_0x2f85('0x2a')];}_0x2c7045=_0x5ec293;})['finally'](function(){if(_0x2c7045===null){_0x42b05b[_0x2f85('0x28')](_0x16b69c);}else{if(_0x16b69c===0x1f4){_0x42b05b[_0x2f85('0x1b')](_0x16b69c)[_0x2f85('0x2b')](_0x2c7045);}else{_0x42b05b[_0x2f85('0x1b')](_0x16b69c)[_0x2f85('0x1d')](_0x2c7045);}}});};exports[_0x2f85('0x9d')]=function(_0x11fa07,_0x5d87f6){var _0x14c558={};var _0x1d8e72={};var _0x6aea8b;var _0x1c5d0f;return db['MailAccount'][_0x2f85('0x6f')]({'where':{'id':_0x11fa07[_0x2f85('0x60')]['id']}})[_0x2f85('0x11')](handleEntityNotFound(_0x5d87f6,null))[_0x2f85('0x11')](function(_0x48388b){if(_0x48388b){_0x6aea8b=_0x48388b;_0x1d8e72[_0x2f85('0x4a')]=_[_0x2f85('0x4d')](db[_0x2f85('0x99')]['rawAttributes']);_0x1d8e72[_0x2f85('0x4c')]=_[_0x2f85('0x4d')](_0x11fa07[_0x2f85('0x4c')]);_0x1d8e72[_0x2f85('0x4e')]=_[_0x2f85('0x4f')](_0x1d8e72[_0x2f85('0x4a')],_0x1d8e72[_0x2f85('0x4c')]);_0x14c558[_0x2f85('0x50')]=_['intersection'](_0x1d8e72[_0x2f85('0x4a')],qs[_0x2f85('0x51')](_0x11fa07[_0x2f85('0x4c')]['fields']));_0x14c558[_0x2f85('0x50')]=_0x14c558['attributes'][_0x2f85('0x52')]?_0x14c558[_0x2f85('0x50')]:_0x1d8e72[_0x2f85('0x4a')];_0x14c558[_0x2f85('0x71')]=qs[_0x2f85('0x54')](_0x11fa07[_0x2f85('0x4c')]['sort']);_0x14c558[_0x2f85('0x55')]=qs['filters'](_['pick'](_0x11fa07[_0x2f85('0x4c')],_0x1d8e72[_0x2f85('0x4e')]));if(_0x11fa07[_0x2f85('0x4c')][_0x2f85('0x59')]){_0x14c558[_0x2f85('0x55')]=_[_0x2f85('0x56')](_0x14c558[_0x2f85('0x55')],{'$or':_['map'](_0x14c558[_0x2f85('0x50')],function(_0x29c8e6){var _0x492556={};_0x492556[_0x29c8e6]={'$like':'%'+_0x11fa07[_0x2f85('0x4c')]['filter']+'%'};return _0x492556;})});}_0x14c558=_[_0x2f85('0x56')]({},_0x14c558,_0x11fa07[_0x2f85('0x5a')]);return _0x6aea8b[_0x2f85('0x9d')](_0x14c558);}})[_0x2f85('0x11')](function(_0x5c255e){if(_0x5c255e){_0x1c5d0f=_0x5c255e[_0x2f85('0x52')];if(!_0x11fa07[_0x2f85('0x4c')]['hasOwnProperty'](_0x2f85('0x70'))){_0x14c558[_0x2f85('0x20')]=qs[_0x2f85('0x20')](_0x11fa07[_0x2f85('0x4c')][_0x2f85('0x20')]);_0x14c558[_0x2f85('0x1e')]=qs['offset'](_0x11fa07['query'][_0x2f85('0x1e')]);}return _0x6aea8b[_0x2f85('0x9d')](_0x14c558);}})[_0x2f85('0x11')](function(_0x56b3be){if(_0x56b3be){return _0x56b3be?{'count':_0x1c5d0f,'rows':_0x56b3be}:null;}})[_0x2f85('0x11')](respondWithResult(_0x5d87f6,null))[_0x2f85('0x1a')](handleError(_0x5d87f6,null));};exports[_0x2f85('0x9e')]=function(_0x27a2c9,_0x2a6bf2){var _0x1e41df={'raw':!![],'where':{}};var _0x469bf6={};var _0x2dc960={'count':0x0,'rows':[]};return db['MailAccount'][_0x2f85('0x6f')]({'where':{'id':_0x27a2c9[_0x2f85('0x60')]['id']}})[_0x2f85('0x11')](handleEntityNotFound(_0x2a6bf2,null))[_0x2f85('0x11')](function(_0x36ae16){if(_0x36ae16){_0x469bf6[_0x2f85('0x4a')]=_[_0x2f85('0x4d')](db[_0x2f85('0x9f')][_0x2f85('0x63')]);_0x469bf6[_0x2f85('0x4c')]=_['keys'](_0x27a2c9[_0x2f85('0x4c')]);_0x469bf6['filters']=_[_0x2f85('0x4f')](_0x469bf6[_0x2f85('0x4a')],_0x469bf6['query']);_0x1e41df[_0x2f85('0x50')]=_[_0x2f85('0x4f')](_0x469bf6[_0x2f85('0x4a')],qs[_0x2f85('0x51')](_0x27a2c9[_0x2f85('0x4c')]['fields']));_0x1e41df[_0x2f85('0x50')]=_0x1e41df[_0x2f85('0x50')][_0x2f85('0x52')]?_0x1e41df[_0x2f85('0x50')]:_0x469bf6[_0x2f85('0x4a')];if(!_0x27a2c9[_0x2f85('0x4c')][_0x2f85('0x53')](_0x2f85('0x70'))){_0x1e41df[_0x2f85('0x20')]=qs[_0x2f85('0x20')](_0x27a2c9[_0x2f85('0x4c')][_0x2f85('0x20')]);_0x1e41df['offset']=qs[_0x2f85('0x1e')](_0x27a2c9[_0x2f85('0x4c')]['offset']);}_0x1e41df['order']=qs['sort'](_0x27a2c9[_0x2f85('0x4c')]['sort']);_0x1e41df[_0x2f85('0x55')]=qs['filters'](_[_0x2f85('0x72')](_0x27a2c9[_0x2f85('0x4c')],_0x469bf6['filters']));_0x1e41df[_0x2f85('0x55')][_0x2f85('0x6c')]=_0x36ae16['id'];if(_0x27a2c9[_0x2f85('0x4c')][_0x2f85('0x59')]){_0x1e41df[_0x2f85('0x55')]=_['merge'](_0x1e41df[_0x2f85('0x55')],{'$or':_['map'](_0x1e41df[_0x2f85('0x50')],function(_0x471f00){var _0x4fe409={};_0x4fe409[_0x471f00]={'$like':'%'+_0x27a2c9['query'][_0x2f85('0x59')]+'%'};return _0x4fe409;})});}if(_0x27a2c9[_0x2f85('0x4c')][_0x2f85('0xa0')]){var _0x5d101b=_0x27a2c9[_0x2f85('0x4c')][_0x2f85('0xa0')]['split'](',');var _0x696112={};_0x696112[_0x5d101b[0x0]]={'$gte':moment(_0x5d101b[0x1])[_0x2f85('0xa1')](_0x2f85('0xa2'))};_0x1e41df[_0x2f85('0x55')]=_[_0x2f85('0x56')](_0x1e41df[_0x2f85('0x55')],_0x696112);}_0x1e41df=_[_0x2f85('0x56')]({},_0x1e41df,_0x27a2c9[_0x2f85('0x5a')]);return db[_0x2f85('0x9f')][_0x2f85('0x21')]({'where':_0x1e41df[_0x2f85('0x55')]})['then'](function(_0x384915){_0x2dc960['count']=_0x384915;if(_0x27a2c9[_0x2f85('0x4c')][_0x2f85('0x5c')]){_0x1e41df['include']=[{'all':!![]}];}return db[_0x2f85('0x9f')]['findAll'](_0x1e41df);})[_0x2f85('0x11')](function(_0x2e1d26){if(_0x27a2c9[_0x2f85('0x4c')][_0x2f85('0xa3')]==='true'){for(var _0x311bb8=0x0;_0x311bb8<_0x2e1d26[_0x2f85('0x52')];_0x311bb8++){_0x2e1d26[_0x311bb8][_0x2f85('0x65')]=juice(_0x2e1d26[_0x311bb8]['body']);}}_0x2dc960[_0x2f85('0x5e')]=_0x2e1d26;return _0x2dc960;});}})['then'](respondWithFilteredResult(_0x2a6bf2,_0x1e41df))['catch'](handleError(_0x2a6bf2,null));};exports[_0x2f85('0x2b')]=function(_0x401aef,_0x1708ae){var _0x22fa3b,_0x65776a={},_0x12d611;if(_0x401aef[_0x2f85('0x65')]['to']){_0x12d611=_0x401aef[_0x2f85('0x65')]['to'][_0x2f85('0xa4')](',')[0x0];}return db['MailAccount'][_0x2f85('0x68')]({'where':{'id':_0x401aef[_0x2f85('0x60')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x2f85('0xa5')],'as':'Contacts','where':{'email':_0x12d611},'limit':0x1,'order':[[_0x2f85('0xa6'),_0x2f85('0xa7')]]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0x2f85('0xa8')],'as':_0x2f85('0xa8'),'raw':!![]}]}]})[_0x2f85('0x11')](handleEntityNotFound(_0x1708ae,null))['then'](function(_0x21a2fc){if(!_0x21a2fc)return;_0x22fa3b=_0x21a2fc;if(!_0x21a2fc[_0x2f85('0x45')])throw new Error('Smtp\x20configuration\x20not\x20found');if(_[_0x2f85('0x7b')](_0x401aef['body'][_0x2f85('0xa9')])){_0x401aef[_0x2f85('0x65')]['from']=util[_0x2f85('0xa1')]('%s\x20<%s>',_0x21a2fc[_0x2f85('0x2a')],_0x21a2fc[_0x2f85('0xaa')]||_0x21a2fc[_0x2f85('0x45')][_0x2f85('0x39')]);}if(_0x401aef[_0x2f85('0x65')][_0x2f85('0xab')]&&_0x401aef[_0x2f85('0x65')][_0x2f85('0xab')][_0x2f85('0x52')]){for(var _0x285d45=0x0;_0x285d45<_0x401aef[_0x2f85('0x65')][_0x2f85('0xab')][_0x2f85('0x52')];_0x285d45+=0x1){_0x401aef[_0x2f85('0x65')]['attachments'][_0x285d45]={'filename':_0x401aef[_0x2f85('0x65')][_0x2f85('0xab')][_0x285d45]['name'],'path':path[_0x2f85('0xac')](config[_0x2f85('0xad')],'server/files/attachments',_0x401aef[_0x2f85('0x65')][_0x2f85('0xab')][_0x285d45][_0x2f85('0xae')])};}}var _0x17dfda=_0x21a2fc['getSmtpOptions']();return respondWithRpcPromise(_0x2f85('0xaf'),_0x2f85('0xb0'),{'account':_0x17dfda,'message':_0x401aef[_0x2f85('0x65')]});})[_0x2f85('0x11')](function(_0x175642){if(!_0x175642)return;_0x65776a=_0x175642;if(!_0x22fa3b[_0x2f85('0xb1')])throw new Error(_0x2f85('0xb2'));if(_0x22fa3b[_0x2f85('0xb1')][_0x2f85('0xb3')][_0x2f85('0x52')])return _0x22fa3b[_0x2f85('0xb1')][_0x2f85('0xb3')][0x0];return db['CmContact'][_0x2f85('0x6e')](_[_0x2f85('0x8')](_0x401aef[_0x2f85('0x65')],{'firstName':_0x401aef[_0x2f85('0x65')]['to'],'email':_0x401aef['body']['to'],'phone':_0x401aef['body']['to'],'ListId':_0x22fa3b[_0x2f85('0x7a')]}));})[_0x2f85('0x11')](function(_0x5c93b7){if(!_0x5c93b7)return;var _0x4a2b21={'UserId':_0x401aef[_0x2f85('0x39')]['id'],'ContactId':_0x5c93b7['id'],'MailAccountId':_0x22fa3b['id'],'inReplyTo':_0x65776a['messageId'],'to':_0x401aef['body'][_0x2f85('0xa9')],'cc':_0x401aef[_0x2f85('0x65')]['cc'],'subject':_0x401aef[_0x2f85('0x65')][_0x2f85('0xb4')],'attach':_0x401aef[_0x2f85('0x65')][_0x2f85('0xb5')],'firstMsgDirection':_0x2f85('0xb6'),'lastMsgAt':moment()[_0x2f85('0xa1')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0x2f85('0xb6'),'Messages':[_[_0x2f85('0x56')](_0x401aef[_0x2f85('0x65')],{'messageId':_0x65776a[_0x2f85('0xb7')],'sentAt':moment()['format'](_0x2f85('0xa2')),'read':!![],'MailAccountId':_0x22fa3b['id'],'UserId':_0x401aef[_0x2f85('0x39')]['id'],'ContactId':_0x5c93b7['id']})]};if(_0x401aef[_0x2f85('0x65')]['Interaction']){_0x4a2b21=_[_0x2f85('0x56')](_0x4a2b21,_0x401aef[_0x2f85('0x65')][_0x2f85('0xb8')]);}return db[_0x2f85('0x89')][_0x2f85('0x6e')](_0x4a2b21,{'include':[{'model':db[_0x2f85('0x9f')],'as':_0x2f85('0xb9')}]});})[_0x2f85('0x11')](respondWithResult(_0x1708ae,null))[_0x2f85('0x1a')](handleError(_0x1708ae,null));};exports[_0x2f85('0xba')]=function(_0x3c2eb5,_0x3535bf){return db[_0x2f85('0x5b')]['find']({'where':{'id':_0x3c2eb5[_0x2f85('0x60')]['id']},'include':[{'model':db[_0x2f85('0x46')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x2f85('0xa8')],'as':_0x2f85('0xa8'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x3535bf,null))[_0x2f85('0x11')](function(_0x89e967){if(!_0x89e967[_0x2f85('0x45')])return;var _0x5c193a=_0x89e967[_0x2f85('0xbb')]();return respondWithRpcPromise(_0x2f85('0xbc'),_0x2f85('0xba'),{'account':_0x5c193a});})['then'](respondWithResult(_0x3535bf,null))['catch'](handleError(_0x3535bf,null));};exports[_0x2f85('0x24')]=function(_0x5623e7,_0x2eedf2){return db[_0x2f85('0x5b')][_0x2f85('0x68')]({'where':{'id':_0x5623e7[_0x2f85('0x60')]['id']}})['then'](handleEntityNotFound(_0x2eedf2,null))[_0x2f85('0x11')](function(_0x1d366d){if(_0x1d366d&&_0x1d366d[_0x2f85('0x40')]){throw new db[(_0x2f85('0xbd'))][(_0x2f85('0xbe'))](_0x2f85('0xbf'));}return _0x1d366d;})[_0x2f85('0x11')](removeEntity(_0x2eedf2,null))[_0x2f85('0x1a')](handleError(_0x2eedf2,null));};exports['addAgents']=function(_0x4aaff1,_0x96ffcf){return db[_0x2f85('0x5b')][_0x2f85('0x68')]({'where':{'id':_0x4aaff1[_0x2f85('0x60')]['id']}})[_0x2f85('0x11')](handleEntityNotFound(_0x96ffcf,null))[_0x2f85('0x11')](function(_0xb7fbab){if(_0xb7fbab){return _0xb7fbab[_0x2f85('0xc0')](_0x4aaff1[_0x2f85('0x65')][_0x2f85('0x74')],_['omit'](_0x4aaff1[_0x2f85('0x65')],['ids','id'])||{})[_0x2f85('0xc1')](function(_0x3cfbdd){for(var _0x1ba4c0=0x0;_0x1ba4c0<_0x4aaff1[_0x2f85('0x65')][_0x2f85('0x74')][_0x2f85('0x52')];_0x1ba4c0+=0x1){socket[_0x2f85('0xc2')](_0x2f85('0xc3'),{'UserId':Number(_0x4aaff1[_0x2f85('0x65')][_0x2f85('0x74')][_0x1ba4c0]),'MailAccountId':Number(_0x4aaff1['params']['id'])});}return _0x3cfbdd;});}})[_0x2f85('0x11')](respondWithResult(_0x96ffcf,null))[_0x2f85('0x1a')](handleError(_0x96ffcf,null));};exports[_0x2f85('0xc4')]=function(_0x44b8e9,_0x1baf1a){return db[_0x2f85('0x5b')][_0x2f85('0x68')]({'where':{'id':_0x44b8e9['params']['id']}})[_0x2f85('0x11')](handleEntityNotFound(_0x1baf1a,null))['then'](function(_0x33ee8e){if(_0x33ee8e){return _0x33ee8e['removeAgents'](_0x44b8e9['query'][_0x2f85('0x74')])[_0x2f85('0x11')](function(){if(_[_0x2f85('0xc5')](_0x44b8e9[_0x2f85('0x4c')][_0x2f85('0x74')])){for(var _0x16d279=0x0;_0x16d279<_0x44b8e9['query'][_0x2f85('0x74')][_0x2f85('0x52')];_0x16d279+=0x1){socket[_0x2f85('0xc2')](_0x2f85('0xc6'),{'UserId':Number(_0x44b8e9[_0x2f85('0x4c')][_0x2f85('0x74')][_0x16d279]),'MailAccountId':Number(_0x44b8e9[_0x2f85('0x60')]['id'])});}}else{socket['emit']('userMailAccount:remove',{'UserId':Number(_0x44b8e9[_0x2f85('0x4c')][_0x2f85('0x74')]),'MailAccountId':Number(_0x44b8e9[_0x2f85('0x60')]['id'])});}});}})[_0x2f85('0x11')](respondWithStatusCode(_0x1baf1a,null))[_0x2f85('0x1a')](handleError(_0x1baf1a,null));};exports[_0x2f85('0xc7')]=function(_0x2ebc01,_0x5de30c){var _0x5cb8ea={};var _0x469b36={};var _0x11e8c0;var _0x3d8a40;return db[_0x2f85('0x5b')][_0x2f85('0x6f')]({'where':{'id':_0x2ebc01[_0x2f85('0x60')]['id']}})[_0x2f85('0x11')](handleEntityNotFound(_0x5de30c,null))[_0x2f85('0x11')](function(_0x38d5c6){if(_0x38d5c6){_0x11e8c0=_0x38d5c6;_0x469b36[_0x2f85('0x4a')]=_[_0x2f85('0x4d')](db[_0x2f85('0xc8')][_0x2f85('0x63')]);_0x469b36['query']=_['keys'](_0x2ebc01['query']);_0x469b36[_0x2f85('0x4e')]=_[_0x2f85('0x4f')](_0x469b36['model'],_0x469b36[_0x2f85('0x4c')]);_0x5cb8ea[_0x2f85('0x50')]=_['intersection'](_0x469b36[_0x2f85('0x4a')],qs['fields'](_0x2ebc01[_0x2f85('0x4c')][_0x2f85('0x51')]));_0x5cb8ea['attributes']=_0x5cb8ea[_0x2f85('0x50')][_0x2f85('0x52')]?_0x5cb8ea[_0x2f85('0x50')]:_0x469b36[_0x2f85('0x4a')];_0x5cb8ea['order']=qs[_0x2f85('0x54')](_0x2ebc01[_0x2f85('0x4c')]['sort']);_0x5cb8ea['where']=qs[_0x2f85('0x4e')](_['pick'](_0x2ebc01['query'],_0x469b36[_0x2f85('0x4e')]));if(_0x2ebc01[_0x2f85('0x4c')]['filter']){_0x5cb8ea[_0x2f85('0x55')]=_[_0x2f85('0x56')](_0x5cb8ea[_0x2f85('0x55')],{'$or':_['map'](_0x5cb8ea[_0x2f85('0x50')],function(_0x1dc59b){var _0x87fe55={};_0x87fe55[_0x1dc59b]={'$like':'%'+_0x2ebc01[_0x2f85('0x4c')][_0x2f85('0x59')]+'%'};return _0x87fe55;})});}_0x5cb8ea=_[_0x2f85('0x56')]({},_0x5cb8ea,_0x2ebc01[_0x2f85('0x5a')]);return _0x11e8c0[_0x2f85('0xc7')](_0x5cb8ea);}})[_0x2f85('0x11')](function(_0x5c3bac){if(_0x5c3bac){_0x3d8a40=_0x5c3bac['length'];if(!_0x2ebc01[_0x2f85('0x4c')][_0x2f85('0x53')](_0x2f85('0x70'))){_0x5cb8ea[_0x2f85('0x20')]=qs['limit'](_0x2ebc01[_0x2f85('0x4c')][_0x2f85('0x20')]);_0x5cb8ea[_0x2f85('0x1e')]=qs[_0x2f85('0x1e')](_0x2ebc01['query'][_0x2f85('0x1e')]);}return _0x11e8c0[_0x2f85('0xc7')](_0x5cb8ea);}})[_0x2f85('0x11')](function(_0x51afef){if(_0x51afef){return _0x51afef?{'count':_0x3d8a40,'rows':_0x51afef}:null;}})[_0x2f85('0x11')](respondWithResult(_0x5de30c,null))[_0x2f85('0x1a')](handleError(_0x5de30c,null));}; \ No newline at end of file +var _0x0e82=['getDispositions','findOne','Disposition','removeDispositions','ids','addAnswer','create','getAnswers','CannedAnswer','removeAnswers','custom','email','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','setSmtp','addInteraction','MailInteraction','getInteractions','Owner','fullname','internal','Tag','color','tag','addApplications','transaction','sequelize','READ_COMMITTED','MailApplication','findAndCountAll','priority','stack','finally','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','true','CmList','List','CmContact','Contacts','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','join','server/files/attachments','basename','getSmtpOptions','SendMail','List\x20not\x20found','defaults','messageId','attach','out','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','userMailAccount:save','removeAgents','isArray','emit','userMailAccount:remove','getAgents','User','moment','bluebird','util','path','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','redis','localhost','socket.io-emitter','register','jayson/promise','http','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','status','end','json','offset','undefined','limit','set','Content-Range','update','destroy','MailAccounts','UserProfileResource','sendStatus','name','send','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook.office365.com','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','outlook365','smtp.office365.com','user','username','pass','password','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','Imap','Smtp','index','MailServerIn','mandatoryDispositionPause','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','count','includeAll','include','findAll','rows','catch','show','params','MailServerOut','keys','MailAccount','fields','options','find','body','provider','Pause','Mail\x20Account\x20not\x20found','describe','MailAccountId'];(function(_0x30e84c,_0x4937fc){var _0x3aea2b=function(_0x306f46){while(--_0x306f46){_0x30e84c['push'](_0x30e84c['shift']());}};_0x3aea2b(++_0x4937fc);}(_0x0e82,0x1e7));var _0x20e8=function(_0xb50a43,_0x4bfdbd){_0xb50a43=_0xb50a43-0x0;var _0x2986de=_0x0e82[_0xb50a43];return _0x2986de;};'use strict';var moment=require(_0x20e8('0x0'));var BPromise=require(_0x20e8('0x1'));var util=require(_0x20e8('0x2'));var path=require(_0x20e8('0x3'));var _=require(_0x20e8('0x4'));var juice=require('juice');var Redis=require(_0x20e8('0x5'));var qs=require(_0x20e8('0x6'));var logger=require(_0x20e8('0x7'))('api');var config=require(_0x20e8('0x8'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x20e8('0x9')],{'host':_0x20e8('0xa'),'port':0x18eb});var socket=require(_0x20e8('0xb'))(new Redis(config['redis']));require('./mailAccount.socket')[_0x20e8('0xc')](socket);var jayson=require(_0x20e8('0xd'));var client=jayson['client'][_0x20e8('0xe')]({'port':0x232b});function respondWithRpcPromise(_0x2d54a0,_0x41e330,_0x16faf8,_0xf6cb6){return new BPromise(function(_0x14efef,_0xcb15ce){var _0x8dd944=_0xf6cb6||client;return _0x8dd944['request'](_0x2d54a0,_0x16faf8)[_0x20e8('0xf')](function(_0xd8a565){logger[_0x20e8('0x10')](_0x20e8('0x11'),_0x41e330,_0x20e8('0x12'));logger[_0x20e8('0x13')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x41e330,_0x20e8('0x12'),JSON[_0x20e8('0x14')](_0xd8a565));if(_0xd8a565[_0x20e8('0x15')]){if(_0xd8a565[_0x20e8('0x15')]['code']===0x1f4){logger[_0x20e8('0x15')](_0x20e8('0x11'),_0x41e330,_0xd8a565[_0x20e8('0x15')][_0x20e8('0x16')]);return _0xcb15ce(_0xd8a565[_0x20e8('0x15')][_0x20e8('0x16')]);}logger[_0x20e8('0x15')](_0x20e8('0x11'),_0x41e330,_0xd8a565[_0x20e8('0x15')]['message']);return _0x14efef(_0xd8a565['error']['message']);}else{logger[_0x20e8('0x10')]('MailAccount,\x20%s,\x20%s',_0x41e330,_0x20e8('0x12'));_0x14efef(_0xd8a565[_0x20e8('0x17')]['message']);}})['catch'](function(_0x1de456){logger[_0x20e8('0x15')](_0x20e8('0x11'),_0x41e330,_0x1de456);_0xcb15ce(_0x1de456);});});}function respondWithStatusCode(_0x38552e,_0x475ac0){_0x475ac0=_0x475ac0||0xcc;return function(_0x2e14be){if(_0x2e14be){return _0x38552e['sendStatus'](_0x475ac0);}return _0x38552e[_0x20e8('0x18')](_0x475ac0)[_0x20e8('0x19')]();};}function respondWithResult(_0x2b1b1d,_0x443145){_0x443145=_0x443145||0xc8;return function(_0x4f0f59){if(_0x4f0f59){return _0x2b1b1d[_0x20e8('0x18')](_0x443145)[_0x20e8('0x1a')](_0x4f0f59);}};}function respondWithFilteredResult(_0x2a5d2b,_0x213cb6){return function(_0x2153c1){if(_0x2153c1){var _0xc7c266=typeof _0x213cb6[_0x20e8('0x1b')]===_0x20e8('0x1c')&&typeof _0x213cb6[_0x20e8('0x1d')]==='undefined';var _0x2bb4f9=_0x2153c1['count'];var _0x81452a=_0xc7c266?0x0:_0x213cb6[_0x20e8('0x1b')];var _0x54a3ff=_0xc7c266?_0x2153c1['count']:_0x213cb6[_0x20e8('0x1b')]+_0x213cb6[_0x20e8('0x1d')];var _0x363971;if(_0x54a3ff>=_0x2bb4f9){_0x54a3ff=_0x2bb4f9;_0x363971=0xc8;}else{_0x363971=0xce;}_0x2a5d2b['status'](_0x363971);return _0x2a5d2b[_0x20e8('0x1e')](_0x20e8('0x1f'),_0x81452a+'-'+_0x54a3ff+'/'+_0x2bb4f9)[_0x20e8('0x1a')](_0x2153c1);}return null;};}function saveUpdates(_0x3cb3b6){return function(_0x32caaa){if(_0x32caaa){return _0x32caaa[_0x20e8('0x20')](_0x3cb3b6)[_0x20e8('0xf')](function(_0x36d40a){return _0x36d40a;});}return null;};}function removeEntity(_0x40fa94){return function(_0xa5b895){if(_0xa5b895){return _0xa5b895[_0x20e8('0x21')]()[_0x20e8('0xf')](function(){var _0x3df2b4=_0xa5b895['get']({'plain':!![]});var _0x244a73=_0x20e8('0x22');return db[_0x20e8('0x23')][_0x20e8('0x21')]({'where':{'type':_0x244a73,'resourceId':_0x3df2b4['id']}})[_0x20e8('0xf')](function(){return _0xa5b895;});})[_0x20e8('0xf')](function(){_0x40fa94[_0x20e8('0x18')](0xcc)[_0x20e8('0x19')]();});}};}function handleEntityNotFound(_0x14eb7a){return function(_0x24c0bf){if(!_0x24c0bf){_0x14eb7a[_0x20e8('0x24')](0x194);}return _0x24c0bf;};}function handleError(_0x46de9c,_0x581d9e){_0x581d9e=_0x581d9e||0x1f4;return function(_0x179144){logger[_0x20e8('0x15')](_0x179144['stack']);if(_0x179144['name']){delete _0x179144[_0x20e8('0x25')];}_0x46de9c[_0x20e8('0x18')](_0x581d9e)[_0x20e8('0x26')](_0x179144);};}function getImapHost(_0xc87b36){switch(_0xc87b36){case _0x20e8('0x27'):return _0x20e8('0x28');case _0x20e8('0x29'):return _0x20e8('0x2a');case _0x20e8('0x2b'):return _0x20e8('0x2c');case'outlook365':return _0x20e8('0x2d');}throw new Error('Unknown\x20email\x20service\x20provider',_0xc87b36);}function getSmtpHost(_0x37ac7d){switch(_0x37ac7d){case'gmail':return _0x20e8('0x2e');case _0x20e8('0x29'):return _0x20e8('0x2f');case _0x20e8('0x2b'):return _0x20e8('0x30');case _0x20e8('0x31'):return _0x20e8('0x32');}throw new Error('Unknown\x20email\x20service\x20provider',_0x37ac7d);}function getAuthenticationOptions(_0xae2361,_0x2b7bb7){var _0x1147de={};var _0x26e5b2={};if(_0xae2361){_0x1147de[_0x20e8('0x33')]=_0x26e5b2[_0x20e8('0x33')]=_0x2b7bb7[_0x20e8('0x34')];_0x1147de['password']=_0x26e5b2[_0x20e8('0x35')]=_0x2b7bb7[_0x20e8('0x36')];if(_0x2b7bb7['modernAuthentication']){_0x1147de[_0x20e8('0x37')]=_0x26e5b2[_0x20e8('0x37')]=!![];_0x1147de[_0x20e8('0x38')]=_0x26e5b2[_0x20e8('0x38')]=_0x2b7bb7[_0x20e8('0x38')];_0x1147de['password']=_0x26e5b2['pass']=null;}else{_0x1147de[_0x20e8('0x38')]=_0x26e5b2[_0x20e8('0x38')]=null;}_0x1147de[_0x20e8('0x39')]=getImapHost(_0xae2361);_0x1147de[_0x20e8('0x3a')]=0x3e1;_0x26e5b2[_0x20e8('0x39')]=getSmtpHost(_0xae2361);_0x26e5b2[_0x20e8('0x3a')]=0x24b;_0x26e5b2[_0x20e8('0x3b')]=![];_0x1147de['service']=_0x26e5b2[_0x20e8('0x3c')]=null;}else{if(_0x2b7bb7[_0x20e8('0x3d')]){_0x1147de['user']=_0x26e5b2[_0x20e8('0x33')]=_0x2b7bb7[_0x20e8('0x34')];_0x1147de[_0x20e8('0x36')]=_0x26e5b2[_0x20e8('0x35')]=_0x2b7bb7[_0x20e8('0x36')];}else{_0x1147de[_0x20e8('0x3d')]=_0x26e5b2['authentication']=![];_0x1147de[_0x20e8('0x33')]=_0x26e5b2[_0x20e8('0x33')]=null;_0x1147de[_0x20e8('0x36')]=_0x26e5b2[_0x20e8('0x35')]=null;}_0x1147de[_0x20e8('0x39')]=_0x2b7bb7[_0x20e8('0x3e')][_0x20e8('0x39')];_0x1147de[_0x20e8('0x3a')]=_0x2b7bb7[_0x20e8('0x3e')][_0x20e8('0x3a')];_0x26e5b2['host']=_0x2b7bb7['Smtp'][_0x20e8('0x39')];_0x26e5b2[_0x20e8('0x3a')]=_0x2b7bb7[_0x20e8('0x3f')][_0x20e8('0x3a')];}return{'Imap':_0x1147de,'Smtp':_0x26e5b2};}exports[_0x20e8('0x40')]=function(_0x4a20bb,_0x804319){var _0x1e95ac={'include':[{'model':db[_0x20e8('0x41')],'as':_0x20e8('0x3e')},{'model':db['MailServerOut'],'as':_0x20e8('0x3f')},{'model':db['Pause'],'as':_0x20e8('0x42')}]},_0x109da3={},_0x4944f6={'count':0x0,'rows':[]};var _0x7f1214=_[_0x20e8('0x43')](db['MailAccount'][_0x20e8('0x44')],function(_0xbec705){return{'name':_0xbec705[_0x20e8('0x45')],'type':_0xbec705['type'][_0x20e8('0x46')]};});_0x109da3[_0x20e8('0x47')]=_[_0x20e8('0x43')](_0x7f1214,'name');_0x109da3[_0x20e8('0x48')]=_['keys'](_0x4a20bb[_0x20e8('0x48')]);_0x109da3[_0x20e8('0x49')]=_[_0x20e8('0x4a')](_0x109da3[_0x20e8('0x47')],_0x109da3[_0x20e8('0x48')]);_0x1e95ac[_0x20e8('0x4b')]=_[_0x20e8('0x4a')](_0x109da3[_0x20e8('0x47')],qs['fields'](_0x4a20bb[_0x20e8('0x48')]['fields']));_0x1e95ac['attributes']=_0x1e95ac['attributes'][_0x20e8('0x4c')]?_0x1e95ac['attributes']:_0x109da3[_0x20e8('0x47')];if(!_0x4a20bb[_0x20e8('0x48')][_0x20e8('0x4d')](_0x20e8('0x4e'))){_0x1e95ac[_0x20e8('0x1d')]=qs[_0x20e8('0x1d')](_0x4a20bb[_0x20e8('0x48')][_0x20e8('0x1d')]);_0x1e95ac['offset']=qs['offset'](_0x4a20bb[_0x20e8('0x48')][_0x20e8('0x1b')]);}_0x1e95ac[_0x20e8('0x4f')]=qs[_0x20e8('0x50')](_0x4a20bb[_0x20e8('0x48')][_0x20e8('0x50')]);_0x1e95ac[_0x20e8('0x51')]=qs[_0x20e8('0x49')](_[_0x20e8('0x52')](_0x4a20bb[_0x20e8('0x48')],_0x109da3[_0x20e8('0x49')]),_0x7f1214);if(_0x4a20bb[_0x20e8('0x48')]['filter']){_0x1e95ac[_0x20e8('0x51')]=_[_0x20e8('0x53')](_0x1e95ac['where'],{'$or':_['map'](_0x7f1214,function(_0x27c953){if(_0x27c953[_0x20e8('0x54')]!==_0x20e8('0x55')){var _0x4f9d8f={};_0x4f9d8f[_0x27c953[_0x20e8('0x25')]]={'$like':'%'+_0x4a20bb[_0x20e8('0x48')][_0x20e8('0x56')]+'%'};return _0x4f9d8f;}})});}_0x1e95ac=_[_0x20e8('0x53')]({},_0x1e95ac,_0x4a20bb['options']);var _0x22e23e={'where':_0x1e95ac[_0x20e8('0x51')]};return db['MailAccount'][_0x20e8('0x57')](_0x22e23e)[_0x20e8('0xf')](function(_0x5618c5){_0x4944f6[_0x20e8('0x57')]=_0x5618c5;if(_0x4a20bb[_0x20e8('0x48')][_0x20e8('0x58')]){_0x1e95ac[_0x20e8('0x59')]=[{'all':!![]}];}return db['MailAccount'][_0x20e8('0x5a')](_0x1e95ac);})[_0x20e8('0xf')](function(_0x3e9a9d){_0x4944f6[_0x20e8('0x5b')]=_0x3e9a9d;return _0x4944f6;})[_0x20e8('0xf')](respondWithFilteredResult(_0x804319,_0x1e95ac))[_0x20e8('0x5c')](handleError(_0x804319,null));};exports[_0x20e8('0x5d')]=function(_0x434c09,_0x3a8381){var _0x406e80={'raw':![],'where':{'id':_0x434c09[_0x20e8('0x5e')]['id']},'include':[{'model':db[_0x20e8('0x41')],'as':'Imap'},{'model':db[_0x20e8('0x5f')],'as':_0x20e8('0x3f')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x2d918a={};_0x2d918a['model']=_[_0x20e8('0x60')](db[_0x20e8('0x61')][_0x20e8('0x44')]);_0x2d918a[_0x20e8('0x48')]=_[_0x20e8('0x60')](_0x434c09[_0x20e8('0x48')]);_0x2d918a[_0x20e8('0x49')]=_[_0x20e8('0x4a')](_0x2d918a['model'],_0x2d918a[_0x20e8('0x48')]);_0x406e80[_0x20e8('0x4b')]=_[_0x20e8('0x4a')](_0x2d918a['model'],qs[_0x20e8('0x62')](_0x434c09['query']['fields']));_0x406e80[_0x20e8('0x4b')]=_0x406e80[_0x20e8('0x4b')][_0x20e8('0x4c')]?_0x406e80[_0x20e8('0x4b')]:_0x2d918a[_0x20e8('0x47')];if(_0x434c09[_0x20e8('0x48')][_0x20e8('0x58')]){_0x406e80['include']=[{'all':!![]}];}_0x406e80=_[_0x20e8('0x53')]({},_0x406e80,_0x434c09[_0x20e8('0x63')]);return db[_0x20e8('0x61')][_0x20e8('0x64')](_0x406e80)[_0x20e8('0xf')](handleEntityNotFound(_0x3a8381,null))[_0x20e8('0xf')](respondWithResult(_0x3a8381,null))[_0x20e8('0x5c')](handleError(_0x3a8381,null));};exports[_0x20e8('0x20')]=function(_0x544fab,_0xd8ff9b){if(_0x544fab[_0x20e8('0x65')]['id']){delete _0x544fab[_0x20e8('0x65')]['id'];}var _0x52a42a=_0x544fab[_0x20e8('0x65')][_0x20e8('0x66')]==='custom'?null:_0x544fab['body'][_0x20e8('0x66')];var _0x16868f=_0x544fab[_0x20e8('0x65')][_0x20e8('0x3e')]||{};var _0x7c47a8=_0x544fab[_0x20e8('0x65')][_0x20e8('0x3f')]||{};if(_0x52a42a){_0x16868f['host']=getImapHost(_0x52a42a);_0x16868f[_0x20e8('0x3a')]=0x3e1;_0x7c47a8[_0x20e8('0x39')]=getSmtpHost(_0x52a42a);_0x7c47a8[_0x20e8('0x3a')]=0x24b;_0x7c47a8[_0x20e8('0x3b')]=![];}if(_0x7c47a8['modernAuthentication']){_0x7c47a8[_0x20e8('0x3b')]=![];}else{_0x7c47a8[_0x20e8('0x38')]=null;}if(!_0x16868f[_0x20e8('0x37')])_0x16868f[_0x20e8('0x38')]=null;_0x544fab[_0x20e8('0x65')][_0x20e8('0x3e')]=_0x16868f;_0x544fab[_0x20e8('0x65')][_0x20e8('0x3f')]=_0x7c47a8;return db[_0x20e8('0x61')]['find']({'where':{'id':_0x544fab[_0x20e8('0x5e')]['id']},'include':[{'model':db[_0x20e8('0x41')],'as':_0x20e8('0x3e')},{'model':db[_0x20e8('0x5f')],'as':_0x20e8('0x3f')},{'model':db[_0x20e8('0x67')],'as':'mandatoryDispositionPause'}]})[_0x20e8('0xf')](handleEntityNotFound(_0xd8ff9b,null))[_0x20e8('0xf')](function(_0x4a07fd){if(!_0x4a07fd)throw new Error(_0x20e8('0x68'));if(_0x4a07fd[_0x20e8('0x3c')])delete _0x544fab[_0x20e8('0x65')][_0x20e8('0x3e')];return _0x4a07fd;})[_0x20e8('0xf')](saveUpdates(_0x544fab[_0x20e8('0x65')],null))[_0x20e8('0xf')](function(_0x76452b){if(!_0x544fab[_0x20e8('0x65')][_0x20e8('0x3e')])return _0x76452b;return db['MailServerIn'][_0x20e8('0x20')](_0x544fab[_0x20e8('0x65')][_0x20e8('0x3e')],{'where':{'MailAccountId':_0x76452b['id']}})[_0x20e8('0xf')](function(){return _0x76452b;});})[_0x20e8('0xf')](function(_0x3bba85){if(!_0x544fab['body']['Smtp'])return _0x3bba85;return db['MailServerOut']['update'](_0x544fab['body'][_0x20e8('0x3f')],{'where':{'MailAccountId':_0x3bba85['id']}})['then'](function(){return _0x3bba85;});})[_0x20e8('0xf')](respondWithResult(_0xd8ff9b,null))[_0x20e8('0x5c')](handleError(_0xd8ff9b,null));};exports[_0x20e8('0x69')]=function(_0x2d7a8e,_0x230c58){return db[_0x20e8('0x61')][_0x20e8('0x69')]()[_0x20e8('0xf')](respondWithResult(_0x230c58,null))[_0x20e8('0x5c')](handleError(_0x230c58,null));};exports['addDisposition']=function(_0x419568,_0x2c58db){if(_0x419568[_0x20e8('0x65')]['id']){delete _0x419568[_0x20e8('0x65')]['id'];}return db['MailAccount'][_0x20e8('0x64')]({'where':{'id':_0x419568[_0x20e8('0x5e')]['id']}})[_0x20e8('0xf')](handleEntityNotFound(_0x2c58db,null))[_0x20e8('0xf')](function(_0x3312c3){if(_0x3312c3){_0x419568[_0x20e8('0x65')][_0x20e8('0x6a')]=_0x3312c3['id'];return db['Disposition']['create'](_0x419568[_0x20e8('0x65')]);}})[_0x20e8('0xf')](respondWithResult(_0x2c58db,null))[_0x20e8('0x5c')](handleError(_0x2c58db,null));};exports[_0x20e8('0x6b')]=function(_0x3c782d,_0x33df8d){var _0x59b353={'raw':![],'where':{}};var _0x4b2bcd={};var _0x5f0b66={'count':0x0,'rows':[]};return db[_0x20e8('0x61')][_0x20e8('0x6c')]({'where':{'id':_0x3c782d[_0x20e8('0x5e')]['id']}})[_0x20e8('0xf')](handleEntityNotFound(_0x33df8d,null))[_0x20e8('0xf')](function(_0x6cbaf0){if(_0x6cbaf0){_0x4b2bcd[_0x20e8('0x47')]=_[_0x20e8('0x60')](db[_0x20e8('0x6d')][_0x20e8('0x44')]);_0x4b2bcd[_0x20e8('0x48')]=_[_0x20e8('0x60')](_0x3c782d[_0x20e8('0x48')]);_0x4b2bcd[_0x20e8('0x49')]=_[_0x20e8('0x4a')](_0x4b2bcd[_0x20e8('0x47')],_0x4b2bcd[_0x20e8('0x48')]);_0x59b353[_0x20e8('0x4b')]=_['intersection'](_0x4b2bcd['model'],qs[_0x20e8('0x62')](_0x3c782d[_0x20e8('0x48')]['fields']));_0x59b353[_0x20e8('0x4b')]=_0x59b353[_0x20e8('0x4b')][_0x20e8('0x4c')]?_0x59b353[_0x20e8('0x4b')]:_0x4b2bcd['model'];if(!_0x3c782d[_0x20e8('0x48')][_0x20e8('0x4d')](_0x20e8('0x4e'))){_0x59b353['limit']=qs[_0x20e8('0x1d')](_0x3c782d[_0x20e8('0x48')]['limit']);_0x59b353[_0x20e8('0x1b')]=qs[_0x20e8('0x1b')](_0x3c782d[_0x20e8('0x48')][_0x20e8('0x1b')]);}_0x59b353[_0x20e8('0x4f')]=qs[_0x20e8('0x50')](_0x3c782d[_0x20e8('0x48')][_0x20e8('0x50')]);_0x59b353[_0x20e8('0x51')]=qs[_0x20e8('0x49')](_[_0x20e8('0x52')](_0x3c782d[_0x20e8('0x48')],_0x4b2bcd[_0x20e8('0x49')]));_0x59b353[_0x20e8('0x51')]['MailAccountId']=_0x6cbaf0['id'];if(_0x3c782d['query'][_0x20e8('0x56')]){_0x59b353[_0x20e8('0x51')]=_[_0x20e8('0x53')](_0x59b353['where'],{'$or':_['map'](_0x59b353[_0x20e8('0x4b')],function(_0x53d05d){var _0x549bc7={};_0x549bc7[_0x53d05d]={'$like':'%'+_0x3c782d[_0x20e8('0x48')][_0x20e8('0x56')]+'%'};return _0x549bc7;})});}_0x59b353=_[_0x20e8('0x53')]({},_0x59b353,_0x3c782d[_0x20e8('0x63')]);return db['Disposition'][_0x20e8('0x57')]({'where':_0x59b353[_0x20e8('0x51')]})[_0x20e8('0xf')](function(_0x133c6a){_0x5f0b66['count']=_0x133c6a;if(_0x3c782d[_0x20e8('0x48')][_0x20e8('0x58')]){_0x59b353[_0x20e8('0x59')]=[{'all':!![]}];}return db[_0x20e8('0x6d')]['findAll'](_0x59b353);})[_0x20e8('0xf')](function(_0x29b670){_0x5f0b66['rows']=_0x29b670;return _0x5f0b66;});}})[_0x20e8('0xf')](respondWithFilteredResult(_0x33df8d,_0x59b353))[_0x20e8('0x5c')](handleError(_0x33df8d,null));};exports[_0x20e8('0x6e')]=function(_0x32e890,_0x9ccb84){return db['MailAccount'][_0x20e8('0x64')]({'where':{'id':_0x32e890['params']['id']}})[_0x20e8('0xf')](handleEntityNotFound(_0x9ccb84,null))[_0x20e8('0xf')](function(_0x353d57){if(_0x353d57){return _0x353d57[_0x20e8('0x6e')](_0x32e890[_0x20e8('0x48')][_0x20e8('0x6f')]);}})[_0x20e8('0xf')](respondWithStatusCode(_0x9ccb84,null))[_0x20e8('0x5c')](handleError(_0x9ccb84,null));};exports[_0x20e8('0x70')]=function(_0x48cba8,_0x12af04){if(_0x48cba8['body']['id']){delete _0x48cba8[_0x20e8('0x65')]['id'];}return db['MailAccount'][_0x20e8('0x64')]({'where':{'id':_0x48cba8[_0x20e8('0x5e')]['id']}})[_0x20e8('0xf')](handleEntityNotFound(_0x12af04,null))['then'](function(_0x3e94e7){if(_0x3e94e7){_0x48cba8[_0x20e8('0x65')]['MailAccountId']=_0x3e94e7['id'];return db['CannedAnswer'][_0x20e8('0x71')](_0x48cba8['body']);}})[_0x20e8('0xf')](respondWithResult(_0x12af04,null))[_0x20e8('0x5c')](handleError(_0x12af04,null));};exports[_0x20e8('0x72')]=function(_0x12e606,_0x292468){var _0x499e22={'raw':![],'where':{}};var _0x16567f={};var _0x5c691a={'count':0x0,'rows':[]};return db[_0x20e8('0x61')][_0x20e8('0x6c')]({'where':{'id':_0x12e606[_0x20e8('0x5e')]['id']}})[_0x20e8('0xf')](handleEntityNotFound(_0x292468,null))[_0x20e8('0xf')](function(_0x2855a9){if(_0x2855a9){_0x16567f['model']=_[_0x20e8('0x60')](db[_0x20e8('0x73')]['rawAttributes']);_0x16567f['query']=_[_0x20e8('0x60')](_0x12e606[_0x20e8('0x48')]);_0x16567f[_0x20e8('0x49')]=_[_0x20e8('0x4a')](_0x16567f[_0x20e8('0x47')],_0x16567f['query']);_0x499e22['attributes']=_[_0x20e8('0x4a')](_0x16567f['model'],qs['fields'](_0x12e606[_0x20e8('0x48')]['fields']));_0x499e22[_0x20e8('0x4b')]=_0x499e22['attributes'][_0x20e8('0x4c')]?_0x499e22[_0x20e8('0x4b')]:_0x16567f[_0x20e8('0x47')];if(!_0x12e606[_0x20e8('0x48')]['hasOwnProperty']('nolimit')){_0x499e22[_0x20e8('0x1d')]=qs[_0x20e8('0x1d')](_0x12e606[_0x20e8('0x48')]['limit']);_0x499e22[_0x20e8('0x1b')]=qs[_0x20e8('0x1b')](_0x12e606['query'][_0x20e8('0x1b')]);}_0x499e22[_0x20e8('0x4f')]=qs['sort'](_0x12e606['query'][_0x20e8('0x50')]);_0x499e22['where']=qs['filters'](_[_0x20e8('0x52')](_0x12e606['query'],_0x16567f['filters']));_0x499e22[_0x20e8('0x51')][_0x20e8('0x6a')]=_0x2855a9['id'];if(_0x12e606[_0x20e8('0x48')]['filter']){_0x499e22[_0x20e8('0x51')]=_[_0x20e8('0x53')](_0x499e22[_0x20e8('0x51')],{'$or':_[_0x20e8('0x43')](_0x499e22[_0x20e8('0x4b')],function(_0x13331e){var _0x1600eb={};_0x1600eb[_0x13331e]={'$like':'%'+_0x12e606['query']['filter']+'%'};return _0x1600eb;})});}_0x499e22=_[_0x20e8('0x53')]({},_0x499e22,_0x12e606[_0x20e8('0x63')]);return db['CannedAnswer'][_0x20e8('0x57')]({'where':_0x499e22[_0x20e8('0x51')]})[_0x20e8('0xf')](function(_0x12d89a){_0x5c691a[_0x20e8('0x57')]=_0x12d89a;if(_0x12e606[_0x20e8('0x48')][_0x20e8('0x58')]){_0x499e22['include']=[{'all':!![]}];}return db[_0x20e8('0x73')][_0x20e8('0x5a')](_0x499e22);})[_0x20e8('0xf')](function(_0xa99dc3){_0x5c691a[_0x20e8('0x5b')]=_0xa99dc3;return _0x5c691a;});}})[_0x20e8('0xf')](respondWithFilteredResult(_0x292468,_0x499e22))['catch'](handleError(_0x292468,null));};exports[_0x20e8('0x74')]=function(_0x44188c,_0x448ec4){return db['MailAccount'][_0x20e8('0x64')]({'where':{'id':_0x44188c[_0x20e8('0x5e')]['id']}})['then'](handleEntityNotFound(_0x448ec4,null))[_0x20e8('0xf')](function(_0x107fa5){if(_0x107fa5){return _0x107fa5[_0x20e8('0x74')](_0x44188c[_0x20e8('0x48')][_0x20e8('0x6f')]);}})[_0x20e8('0xf')](respondWithStatusCode(_0x448ec4,null))[_0x20e8('0x5c')](handleError(_0x448ec4,null));};exports[_0x20e8('0x71')]=function(_0x50ec79,_0x295cc2){var _0x3b8058={'name':_0x50ec79[_0x20e8('0x65')][_0x20e8('0x25')],'key':_0x50ec79['body']['key'],'provider':_0x50ec79['body'][_0x20e8('0x66')]===_0x20e8('0x75')?null:_0x50ec79['body']['provider'],'email':_0x50ec79[_0x20e8('0x65')][_0x20e8('0x76')],'ListId':_0x50ec79['body'][_0x20e8('0x77')],'active':!_[_0x20e8('0x78')](_0x50ec79[_0x20e8('0x65')][_0x20e8('0x79')])?_0x50ec79[_0x20e8('0x65')][_0x20e8('0x79')]:!![],'description':_0x50ec79[_0x20e8('0x65')][_0x20e8('0x7a')]||null};var _0x1a91da=getAuthenticationOptions(_0x3b8058[_0x20e8('0x66')],_0x50ec79['body']);_0x3b8058[_0x20e8('0x3e')]=_0x1a91da[_0x20e8('0x3e')];_0x3b8058['Smtp']=_0x1a91da[_0x20e8('0x3f')];return db[_0x20e8('0x61')]['create'](_0x3b8058,{'include':[{'model':db['MailServerOut'],'as':_0x20e8('0x3f')},{'model':db[_0x20e8('0x41')],'as':_0x20e8('0x3e')}]})[_0x20e8('0xf')](function(_0x5abd40){var _0x1fc297=_0x50ec79[_0x20e8('0x33')]['get']({'plain':!![]});if(!_0x1fc297)throw new Error(_0x20e8('0x7b'));if(_0x1fc297[_0x20e8('0x7c')]===_0x20e8('0x33')){var _0x160201=_0x5abd40[_0x20e8('0x7d')]({'plain':!![]});return db['UserProfileSection'][_0x20e8('0x64')]({'where':{'name':_0x20e8('0x22'),'userProfileId':_0x1fc297[_0x20e8('0x7e')]},'raw':!![]})[_0x20e8('0xf')](function(_0x3da467){if(_0x3da467&&_0x3da467[_0x20e8('0x7f')]===0x0){return db[_0x20e8('0x23')][_0x20e8('0x71')]({'name':_0x160201[_0x20e8('0x25')],'resourceId':_0x160201['id'],'type':_0x3da467[_0x20e8('0x25')],'sectionId':_0x3da467['id']},{})[_0x20e8('0xf')](function(){return _0x5abd40;});}else{return _0x5abd40;}})[_0x20e8('0x5c')](function(_0x25f911){logger[_0x20e8('0x15')](_0x20e8('0x80'),_0x25f911);throw _0x25f911;});}return _0x5abd40;})[_0x20e8('0xf')](respondWithResult(_0x295cc2,0xc9))[_0x20e8('0x5c')](handleError(_0x295cc2,null));};exports['getImap']=function(_0x5b98db,_0x25e1a5){return db[_0x20e8('0x61')][_0x20e8('0x6c')]({'where':{'id':_0x5b98db[_0x20e8('0x5e')]['id']}})[_0x20e8('0xf')](handleEntityNotFound(_0x25e1a5,null))[_0x20e8('0xf')](function(_0x4f9f16){if(_0x4f9f16){return _0x4f9f16[_0x20e8('0x81')]();}return null;})[_0x20e8('0xf')](respondWithResult(_0x25e1a5,null))[_0x20e8('0x5c')](handleError(_0x25e1a5,null));};exports[_0x20e8('0x82')]=function(_0x4bf706,_0x1072a2){if(_0x4bf706[_0x20e8('0x65')]['id']){delete _0x4bf706[_0x20e8('0x65')]['id'];}return db[_0x20e8('0x61')][_0x20e8('0x64')]({'where':{'id':_0x4bf706[_0x20e8('0x5e')]['id']}})['then'](handleEntityNotFound(_0x1072a2,null))['then'](function(_0x24cac2){if(_0x24cac2){_0x4bf706['body']['MailAccountId']=_0x24cac2['id'];return db[_0x20e8('0x41')][_0x20e8('0x71')](_0x4bf706[_0x20e8('0x65')]);}})[_0x20e8('0xf')](respondWithResult(_0x1072a2,null))[_0x20e8('0x5c')](handleError(_0x1072a2,null));};exports[_0x20e8('0x83')]=function(_0x1eec74,_0x400ae3){return db[_0x20e8('0x61')][_0x20e8('0x6c')]({'where':{'id':_0x1eec74[_0x20e8('0x5e')]['id']}})[_0x20e8('0xf')](handleEntityNotFound(_0x400ae3,null))['then'](function(_0x57ec0d){if(_0x57ec0d){return _0x57ec0d[_0x20e8('0x84')](null);}return null;})['then'](respondWithStatusCode(_0x400ae3,null))['catch'](handleError(_0x400ae3,null));};exports[_0x20e8('0x85')]=function(_0x2608dd,_0x523959){return db['MailAccount'][_0x20e8('0x6c')]({'where':{'id':_0x2608dd['params']['id']}})[_0x20e8('0xf')](handleEntityNotFound(_0x523959,null))[_0x20e8('0xf')](function(_0x123813){if(_0x123813){return _0x123813[_0x20e8('0x85')]();}return null;})[_0x20e8('0xf')](respondWithResult(_0x523959,null))[_0x20e8('0x5c')](handleError(_0x523959,null));};exports[_0x20e8('0x86')]=function(_0x638245,_0x344ea9){if(_0x638245[_0x20e8('0x65')]['id']){delete _0x638245[_0x20e8('0x65')]['id'];}return db[_0x20e8('0x61')][_0x20e8('0x64')]({'where':{'id':_0x638245[_0x20e8('0x5e')]['id']}})['then'](handleEntityNotFound(_0x344ea9,null))['then'](function(_0x2007f2){if(_0x2007f2){_0x638245[_0x20e8('0x65')]['MailAccountId']=_0x2007f2['id'];return db[_0x20e8('0x5f')]['create'](_0x638245[_0x20e8('0x65')]);}})[_0x20e8('0xf')](respondWithResult(_0x344ea9,null))['catch'](handleError(_0x344ea9,null));};exports['removeSmtp']=function(_0x1e2829,_0x36dde0){return db['MailAccount'][_0x20e8('0x6c')]({'where':{'id':_0x1e2829[_0x20e8('0x5e')]['id']}})[_0x20e8('0xf')](handleEntityNotFound(_0x36dde0,null))['then'](function(_0x25c1d9){if(_0x25c1d9){return _0x25c1d9[_0x20e8('0x87')](null);}return null;})['then'](respondWithStatusCode(_0x36dde0,null))[_0x20e8('0x5c')](handleError(_0x36dde0,null));};exports[_0x20e8('0x88')]=function(_0x5a5ee0,_0x1ce59a){return db[_0x20e8('0x89')][_0x20e8('0x64')]({'where':{'id':_0x5a5ee0[_0x20e8('0x5e')]['id']}})[_0x20e8('0xf')](handleEntityNotFound(_0x1ce59a,null))[_0x20e8('0xf')](function(_0x3a7650){if(_0x3a7650){return _0x3a7650[_0x20e8('0x88')](_0x5a5ee0[_0x20e8('0x65')]['ids'],_['omit'](_0x5a5ee0[_0x20e8('0x65')],[_0x20e8('0x6f'),'id'])||{});}})[_0x20e8('0xf')](respondWithResult(_0x1ce59a,null))['catch'](handleError(_0x1ce59a,null));};exports[_0x20e8('0x8a')]=function(_0x1214ef,_0x4744db){var _0x5c3712={'raw':![],'where':{}};var _0x406764={};var _0x52fe15={'count':0x0,'rows':[]};return db[_0x20e8('0x61')][_0x20e8('0x6c')]({'where':{'id':_0x1214ef[_0x20e8('0x5e')]['id']}})[_0x20e8('0xf')](handleEntityNotFound(_0x4744db,null))[_0x20e8('0xf')](function(_0x320e89){if(_0x320e89){_0x406764['model']=_[_0x20e8('0x60')](db[_0x20e8('0x89')]['rawAttributes']);_0x406764['query']=_[_0x20e8('0x60')](_0x1214ef[_0x20e8('0x48')]);_0x406764[_0x20e8('0x49')]=_['intersection'](_0x406764[_0x20e8('0x47')],_0x406764['query']);_0x5c3712[_0x20e8('0x4b')]=_[_0x20e8('0x4a')](_0x406764[_0x20e8('0x47')],qs['fields'](_0x1214ef[_0x20e8('0x48')][_0x20e8('0x62')]));_0x5c3712[_0x20e8('0x4b')]=_0x5c3712[_0x20e8('0x4b')]['length']?_0x5c3712['attributes']:_0x406764[_0x20e8('0x47')];if(!_0x1214ef[_0x20e8('0x48')]['hasOwnProperty'](_0x20e8('0x4e'))){_0x5c3712[_0x20e8('0x1d')]=qs[_0x20e8('0x1d')](_0x1214ef[_0x20e8('0x48')][_0x20e8('0x1d')]);_0x5c3712[_0x20e8('0x1b')]=qs[_0x20e8('0x1b')](_0x1214ef[_0x20e8('0x48')][_0x20e8('0x1b')]);}_0x5c3712['order']=qs['sort'](_0x1214ef[_0x20e8('0x48')][_0x20e8('0x50')]);_0x5c3712[_0x20e8('0x51')]=qs[_0x20e8('0x49')](_['pick'](_0x1214ef[_0x20e8('0x48')],_0x406764['filters']));_0x5c3712[_0x20e8('0x51')]['MailAccountId']=_0x320e89['id'];if(_0x1214ef[_0x20e8('0x48')][_0x20e8('0x56')]){_0x5c3712['where']=_[_0x20e8('0x53')](_0x5c3712[_0x20e8('0x51')],{'$or':_[_0x20e8('0x43')](_0x5c3712['attributes'],function(_0x366552){var _0x149303={};_0x149303[_0x366552]={'$like':'%'+_0x1214ef[_0x20e8('0x48')][_0x20e8('0x56')]+'%'};return _0x149303;})});}_0x5c3712=_[_0x20e8('0x53')]({},_0x5c3712,_0x1214ef[_0x20e8('0x63')]);return db['MailInteraction'][_0x20e8('0x57')]({'where':_0x5c3712[_0x20e8('0x51')]})[_0x20e8('0xf')](function(_0x5227bc){_0x52fe15[_0x20e8('0x57')]=_0x5227bc;if(_0x1214ef['query']['includeAll']){_0x5c3712[_0x20e8('0x59')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db['User'],'as':_0x20e8('0x8b'),'attributes':['name',_0x20e8('0x8c'),_0x20e8('0x8d')],'required':![]},{'model':db[_0x20e8('0x8e')],'as':'Tags','attributes':['id',_0x20e8('0x25'),_0x20e8('0x8f')],'where':_0x1214ef[_0x20e8('0x48')][_0x20e8('0x90')]?{'id':_0x1214ef[_0x20e8('0x48')][_0x20e8('0x90')]}:undefined,'required':_0x1214ef[_0x20e8('0x48')][_0x20e8('0x90')]?!![]:![]}];}return db[_0x20e8('0x89')][_0x20e8('0x5a')](_0x5c3712);})[_0x20e8('0xf')](function(_0x8d7a33){_0x52fe15[_0x20e8('0x5b')]=_0x8d7a33;return _0x52fe15;});}})[_0x20e8('0xf')](respondWithFilteredResult(_0x4744db,_0x5c3712))[_0x20e8('0x5c')](handleError(_0x4744db,null));};exports[_0x20e8('0x91')]=function addApplications(_0x189087,_0x40a0bd){var _0x5e7fe5=_0x189087[_0x20e8('0x5e')]['id'];var _0x10c67f=_0x189087[_0x20e8('0x65')];var _0x3f7a11=0xc8;var _0x2b5f08=null;return db['sequelize'][_0x20e8('0x92')]({'isolationLevel':db[_0x20e8('0x93')]['Transaction']['ISOLATION_LEVELS'][_0x20e8('0x94')]},function(_0x2c5d53){return db[_0x20e8('0x61')][_0x20e8('0x6c')]({'where':{'id':_0x5e7fe5},'transaction':_0x2c5d53})[_0x20e8('0xf')](function(_0x72ba9){if(_0x72ba9){return db[_0x20e8('0x95')][_0x20e8('0x21')]({'where':{'MailAccountId':_0x5e7fe5},'transaction':_0x2c5d53})[_0x20e8('0xf')](function(){var _0x48f976=_[_0x20e8('0x43')](_0x10c67f,function(_0x2408b5){_0x2408b5[_0x20e8('0x6a')]=_0x5e7fe5;return _0x2408b5;});return db[_0x20e8('0x95')]['bulkCreate'](_0x48f976,{'transaction':_0x2c5d53});});}else{_0x3f7a11=0x194;_0x2b5f08=[];}});})[_0x20e8('0xf')](function(){if(_0x3f7a11!==0x194){return db['MailApplication'][_0x20e8('0x96')]({'where':{'MailAccountId':_0x5e7fe5},'order':_0x20e8('0x97')})[_0x20e8('0xf')](function(_0x1b8902){_0x2b5f08=_0x1b8902;});}})[_0x20e8('0x5c')](function(_0x1dc60e){_0x3f7a11=0x1f4;logger['error'](_0x1dc60e[_0x20e8('0x98')]);if(_0x1dc60e[_0x20e8('0x25')]){delete _0x1dc60e['name'];}_0x2b5f08=_0x1dc60e;})[_0x20e8('0x99')](function(){if(_0x2b5f08===null){_0x40a0bd[_0x20e8('0x24')](_0x3f7a11);}else{if(_0x3f7a11===0x1f4){_0x40a0bd[_0x20e8('0x18')](_0x3f7a11)['send'](_0x2b5f08);}else{_0x40a0bd['status'](_0x3f7a11)[_0x20e8('0x1a')](_0x2b5f08);}}});};exports[_0x20e8('0x9a')]=function(_0x39f818,_0x46bcde){var _0x310cde={};var _0x3f2b6e={};var _0x4bf14e;var _0x30ccff;return db[_0x20e8('0x61')][_0x20e8('0x6c')]({'where':{'id':_0x39f818[_0x20e8('0x5e')]['id']}})[_0x20e8('0xf')](handleEntityNotFound(_0x46bcde,null))[_0x20e8('0xf')](function(_0x505aa4){if(_0x505aa4){_0x4bf14e=_0x505aa4;_0x3f2b6e[_0x20e8('0x47')]=_[_0x20e8('0x60')](db[_0x20e8('0x95')][_0x20e8('0x44')]);_0x3f2b6e[_0x20e8('0x48')]=_[_0x20e8('0x60')](_0x39f818[_0x20e8('0x48')]);_0x3f2b6e['filters']=_['intersection'](_0x3f2b6e['model'],_0x3f2b6e[_0x20e8('0x48')]);_0x310cde['attributes']=_['intersection'](_0x3f2b6e[_0x20e8('0x47')],qs[_0x20e8('0x62')](_0x39f818[_0x20e8('0x48')]['fields']));_0x310cde[_0x20e8('0x4b')]=_0x310cde['attributes'][_0x20e8('0x4c')]?_0x310cde[_0x20e8('0x4b')]:_0x3f2b6e[_0x20e8('0x47')];_0x310cde['order']=qs[_0x20e8('0x50')](_0x39f818[_0x20e8('0x48')][_0x20e8('0x50')]);_0x310cde[_0x20e8('0x51')]=qs[_0x20e8('0x49')](_[_0x20e8('0x52')](_0x39f818[_0x20e8('0x48')],_0x3f2b6e['filters']));if(_0x39f818['query'][_0x20e8('0x56')]){_0x310cde[_0x20e8('0x51')]=_[_0x20e8('0x53')](_0x310cde['where'],{'$or':_[_0x20e8('0x43')](_0x310cde[_0x20e8('0x4b')],function(_0x2efc13){var _0x441f86={};_0x441f86[_0x2efc13]={'$like':'%'+_0x39f818[_0x20e8('0x48')][_0x20e8('0x56')]+'%'};return _0x441f86;})});}_0x310cde=_[_0x20e8('0x53')]({},_0x310cde,_0x39f818[_0x20e8('0x63')]);return _0x4bf14e['getApplications'](_0x310cde);}})['then'](function(_0x57a3fa){if(_0x57a3fa){_0x30ccff=_0x57a3fa[_0x20e8('0x4c')];if(!_0x39f818[_0x20e8('0x48')][_0x20e8('0x4d')](_0x20e8('0x4e'))){_0x310cde[_0x20e8('0x1d')]=qs[_0x20e8('0x1d')](_0x39f818[_0x20e8('0x48')][_0x20e8('0x1d')]);_0x310cde['offset']=qs[_0x20e8('0x1b')](_0x39f818[_0x20e8('0x48')]['offset']);}return _0x4bf14e['getApplications'](_0x310cde);}})[_0x20e8('0xf')](function(_0x51d7db){if(_0x51d7db){return _0x51d7db?{'count':_0x30ccff,'rows':_0x51d7db}:null;}})['then'](respondWithResult(_0x46bcde,null))[_0x20e8('0x5c')](handleError(_0x46bcde,null));};exports[_0x20e8('0x9b')]=function(_0x469d3d,_0x2e8690){var _0x4ffc79={'raw':!![],'where':{}};var _0x4b1e35={};var _0x2db439={'count':0x0,'rows':[]};return db[_0x20e8('0x61')][_0x20e8('0x6c')]({'where':{'id':_0x469d3d[_0x20e8('0x5e')]['id']}})['then'](handleEntityNotFound(_0x2e8690,null))['then'](function(_0x260db8){if(_0x260db8){_0x4b1e35[_0x20e8('0x47')]=_[_0x20e8('0x60')](db[_0x20e8('0x9c')][_0x20e8('0x44')]);_0x4b1e35[_0x20e8('0x48')]=_[_0x20e8('0x60')](_0x469d3d[_0x20e8('0x48')]);_0x4b1e35[_0x20e8('0x49')]=_[_0x20e8('0x4a')](_0x4b1e35[_0x20e8('0x47')],_0x4b1e35[_0x20e8('0x48')]);_0x4ffc79['attributes']=_[_0x20e8('0x4a')](_0x4b1e35[_0x20e8('0x47')],qs[_0x20e8('0x62')](_0x469d3d[_0x20e8('0x48')][_0x20e8('0x62')]));_0x4ffc79['attributes']=_0x4ffc79['attributes'][_0x20e8('0x4c')]?_0x4ffc79['attributes']:_0x4b1e35[_0x20e8('0x47')];if(!_0x469d3d[_0x20e8('0x48')][_0x20e8('0x4d')](_0x20e8('0x4e'))){_0x4ffc79['limit']=qs['limit'](_0x469d3d[_0x20e8('0x48')]['limit']);_0x4ffc79['offset']=qs[_0x20e8('0x1b')](_0x469d3d[_0x20e8('0x48')]['offset']);}_0x4ffc79[_0x20e8('0x4f')]=qs[_0x20e8('0x50')](_0x469d3d[_0x20e8('0x48')][_0x20e8('0x50')]);_0x4ffc79[_0x20e8('0x51')]=qs['filters'](_[_0x20e8('0x52')](_0x469d3d[_0x20e8('0x48')],_0x4b1e35[_0x20e8('0x49')]));_0x4ffc79[_0x20e8('0x51')]['MailAccountId']=_0x260db8['id'];if(_0x469d3d[_0x20e8('0x48')]['filter']){_0x4ffc79['where']=_[_0x20e8('0x53')](_0x4ffc79[_0x20e8('0x51')],{'$or':_[_0x20e8('0x43')](_0x4ffc79['attributes'],function(_0x3a4ff4){var _0x5c5fb3={};_0x5c5fb3[_0x3a4ff4]={'$like':'%'+_0x469d3d[_0x20e8('0x48')][_0x20e8('0x56')]+'%'};return _0x5c5fb3;})});}if(_0x469d3d[_0x20e8('0x48')][_0x20e8('0x9d')]){var _0x45c11f=_0x469d3d[_0x20e8('0x48')][_0x20e8('0x9d')][_0x20e8('0x9e')](',');var _0x58aa69={};_0x58aa69[_0x45c11f[0x0]]={'$gte':moment(_0x45c11f[0x1])[_0x20e8('0x9f')](_0x20e8('0xa0'))};_0x4ffc79[_0x20e8('0x51')]=_[_0x20e8('0x53')](_0x4ffc79[_0x20e8('0x51')],_0x58aa69);}_0x4ffc79=_[_0x20e8('0x53')]({},_0x4ffc79,_0x469d3d['options']);return db[_0x20e8('0x9c')][_0x20e8('0x57')]({'where':_0x4ffc79['where']})[_0x20e8('0xf')](function(_0x308a50){_0x2db439[_0x20e8('0x57')]=_0x308a50;if(_0x469d3d[_0x20e8('0x48')]['includeAll']){_0x4ffc79['include']=[{'all':!![]}];}return db['MailMessage'][_0x20e8('0x5a')](_0x4ffc79);})[_0x20e8('0xf')](function(_0x46e883){if(_0x469d3d[_0x20e8('0x48')]['inlineCss']===_0x20e8('0xa1')){for(var _0x5f417d=0x0;_0x5f417d<_0x46e883[_0x20e8('0x4c')];_0x5f417d++){_0x46e883[_0x5f417d]['body']=juice(_0x46e883[_0x5f417d][_0x20e8('0x65')]);}}_0x2db439[_0x20e8('0x5b')]=_0x46e883;return _0x2db439;});}})[_0x20e8('0xf')](respondWithFilteredResult(_0x2e8690,_0x4ffc79))[_0x20e8('0x5c')](handleError(_0x2e8690,null));};exports['send']=function(_0x17457c,_0xa260df){var _0x2c8bb7,_0x5d195f={},_0x71c4a6;if(_0x17457c[_0x20e8('0x65')]['to']){_0x71c4a6=_0x17457c['body']['to'][_0x20e8('0x9e')](',')[0x0];}return db[_0x20e8('0x61')]['find']({'where':{'id':_0x17457c[_0x20e8('0x5e')]['id']},'include':[{'model':db[_0x20e8('0xa2')],'as':_0x20e8('0xa3'),'include':[{'model':db[_0x20e8('0xa4')],'as':_0x20e8('0xa5'),'where':{'email':_0x71c4a6},'limit':0x1,'order':[[_0x20e8('0xa6'),_0x20e8('0xa7')]]}]},{'model':db['MailServerOut'],'as':_0x20e8('0x3f'),'raw':!![],'include':[{'model':db[_0x20e8('0xa8')],'as':'CloudProvider','raw':!![]}]}]})[_0x20e8('0xf')](handleEntityNotFound(_0xa260df,null))[_0x20e8('0xf')](function(_0x1ac166){if(!_0x1ac166)return;_0x2c8bb7=_0x1ac166;if(!_0x1ac166['Smtp'])throw new Error(_0x20e8('0xa9'));if(_[_0x20e8('0x78')](_0x17457c['body'][_0x20e8('0xaa')])){_0x17457c[_0x20e8('0x65')][_0x20e8('0xaa')]=util[_0x20e8('0x9f')](_0x20e8('0xab'),_0x1ac166[_0x20e8('0x25')],_0x1ac166['email']||_0x1ac166[_0x20e8('0x3f')][_0x20e8('0x33')]);}if(_0x17457c[_0x20e8('0x65')]['attachments']&&_0x17457c[_0x20e8('0x65')][_0x20e8('0xac')][_0x20e8('0x4c')]){for(var _0x1cac7f=0x0;_0x1cac7f<_0x17457c['body'][_0x20e8('0xac')][_0x20e8('0x4c')];_0x1cac7f+=0x1){_0x17457c[_0x20e8('0x65')][_0x20e8('0xac')][_0x1cac7f]={'filename':_0x17457c[_0x20e8('0x65')][_0x20e8('0xac')][_0x1cac7f][_0x20e8('0x25')],'path':path[_0x20e8('0xad')](config['root'],_0x20e8('0xae'),_0x17457c[_0x20e8('0x65')][_0x20e8('0xac')][_0x1cac7f][_0x20e8('0xaf')])};}}var _0x4b4919=_0x1ac166[_0x20e8('0xb0')]();return respondWithRpcPromise(_0x20e8('0xb1'),'sendMail',{'account':_0x4b4919,'message':_0x17457c[_0x20e8('0x65')]});})['then'](function(_0x5f0564){if(!_0x5f0564)return;_0x5d195f=_0x5f0564;if(!_0x2c8bb7[_0x20e8('0xa3')])throw new Error(_0x20e8('0xb2'));if(_0x2c8bb7['List'][_0x20e8('0xa5')]['length'])return _0x2c8bb7[_0x20e8('0xa3')][_0x20e8('0xa5')][0x0];return db['CmContact']['create'](_[_0x20e8('0xb3')](_0x17457c[_0x20e8('0x65')],{'firstName':_0x17457c[_0x20e8('0x65')]['to'],'email':_0x17457c[_0x20e8('0x65')]['to'],'phone':_0x17457c[_0x20e8('0x65')]['to'],'ListId':_0x2c8bb7[_0x20e8('0x77')]}));})[_0x20e8('0xf')](function(_0x36c9be){if(!_0x36c9be)return;var _0x1f6ea9={'UserId':_0x17457c[_0x20e8('0x33')]['id'],'ContactId':_0x36c9be['id'],'MailAccountId':_0x2c8bb7['id'],'inReplyTo':_0x5d195f[_0x20e8('0xb4')],'to':_0x17457c[_0x20e8('0x65')][_0x20e8('0xaa')],'cc':_0x17457c[_0x20e8('0x65')]['cc'],'subject':_0x17457c[_0x20e8('0x65')]['subject'],'attach':_0x17457c[_0x20e8('0x65')][_0x20e8('0xb5')],'firstMsgDirection':_0x20e8('0xb6'),'lastMsgAt':moment()[_0x20e8('0x9f')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'out','Messages':[_[_0x20e8('0x53')](_0x17457c['body'],{'messageId':_0x5d195f[_0x20e8('0xb4')],'sentAt':moment()[_0x20e8('0x9f')](_0x20e8('0xa0')),'read':!![],'MailAccountId':_0x2c8bb7['id'],'UserId':_0x17457c['user']['id'],'ContactId':_0x36c9be['id']})]};if(_0x17457c[_0x20e8('0x65')]['Interaction']){_0x1f6ea9=_[_0x20e8('0x53')](_0x1f6ea9,_0x17457c[_0x20e8('0x65')][_0x20e8('0xb7')]);}return db[_0x20e8('0x89')][_0x20e8('0x71')](_0x1f6ea9,{'include':[{'model':db['MailMessage'],'as':_0x20e8('0xb8')}]});})[_0x20e8('0xf')](respondWithResult(_0xa260df,null))[_0x20e8('0x5c')](handleError(_0xa260df,null));};exports[_0x20e8('0xb9')]=function(_0x216d27,_0x91de90){return db[_0x20e8('0x61')][_0x20e8('0x64')]({'where':{'id':_0x216d27['params']['id']},'include':[{'model':db[_0x20e8('0x5f')],'as':_0x20e8('0x3f'),'raw':!![],'include':[{'model':db[_0x20e8('0xa8')],'as':_0x20e8('0xa8'),'raw':!![]}]}]})[_0x20e8('0xf')](handleEntityNotFound(_0x91de90,null))[_0x20e8('0xf')](function(_0x163654){if(!_0x163654[_0x20e8('0x3f')])return;var _0x50b8ef=_0x163654[_0x20e8('0xb0')]();return respondWithRpcPromise(_0x20e8('0xba'),_0x20e8('0xb9'),{'account':_0x50b8ef});})[_0x20e8('0xf')](respondWithResult(_0x91de90,null))[_0x20e8('0x5c')](handleError(_0x91de90,null));};exports[_0x20e8('0x21')]=function(_0x3e83cd,_0x5f440a){return db[_0x20e8('0x61')]['find']({'where':{'id':_0x3e83cd[_0x20e8('0x5e')]['id']}})[_0x20e8('0xf')](handleEntityNotFound(_0x5f440a,null))[_0x20e8('0xf')](function(_0x1dd345){if(_0x1dd345&&_0x1dd345[_0x20e8('0x3c')]){throw new db[(_0x20e8('0xbb'))][(_0x20e8('0xbc'))](_0x20e8('0xbd'));}return _0x1dd345;})[_0x20e8('0xf')](removeEntity(_0x5f440a,null))['catch'](handleError(_0x5f440a,null));};exports['addAgents']=function(_0x3bf6b3,_0x1cb226){return db[_0x20e8('0x61')][_0x20e8('0x64')]({'where':{'id':_0x3bf6b3[_0x20e8('0x5e')]['id']}})[_0x20e8('0xf')](handleEntityNotFound(_0x1cb226,null))[_0x20e8('0xf')](function(_0x41545a){if(_0x41545a){return _0x41545a[_0x20e8('0xbe')](_0x3bf6b3[_0x20e8('0x65')]['ids'],_['omit'](_0x3bf6b3[_0x20e8('0x65')],[_0x20e8('0x6f'),'id'])||{})['spread'](function(_0x2a4e0e){for(var _0x21b0dc=0x0;_0x21b0dc<_0x3bf6b3[_0x20e8('0x65')]['ids'][_0x20e8('0x4c')];_0x21b0dc+=0x1){socket['emit'](_0x20e8('0xbf'),{'UserId':Number(_0x3bf6b3['body']['ids'][_0x21b0dc]),'MailAccountId':Number(_0x3bf6b3[_0x20e8('0x5e')]['id'])});}return _0x2a4e0e;});}})[_0x20e8('0xf')](respondWithResult(_0x1cb226,null))['catch'](handleError(_0x1cb226,null));};exports['removeAgents']=function(_0x4f9f3d,_0x464b11){return db['MailAccount'][_0x20e8('0x64')]({'where':{'id':_0x4f9f3d[_0x20e8('0x5e')]['id']}})[_0x20e8('0xf')](handleEntityNotFound(_0x464b11,null))[_0x20e8('0xf')](function(_0x3b9903){if(_0x3b9903){return _0x3b9903[_0x20e8('0xc0')](_0x4f9f3d[_0x20e8('0x48')][_0x20e8('0x6f')])[_0x20e8('0xf')](function(){if(_[_0x20e8('0xc1')](_0x4f9f3d[_0x20e8('0x48')][_0x20e8('0x6f')])){for(var _0x4796be=0x0;_0x4796be<_0x4f9f3d[_0x20e8('0x48')][_0x20e8('0x6f')]['length'];_0x4796be+=0x1){socket[_0x20e8('0xc2')](_0x20e8('0xc3'),{'UserId':Number(_0x4f9f3d[_0x20e8('0x48')][_0x20e8('0x6f')][_0x4796be]),'MailAccountId':Number(_0x4f9f3d['params']['id'])});}}else{socket[_0x20e8('0xc2')]('userMailAccount:remove',{'UserId':Number(_0x4f9f3d[_0x20e8('0x48')][_0x20e8('0x6f')]),'MailAccountId':Number(_0x4f9f3d['params']['id'])});}});}})[_0x20e8('0xf')](respondWithStatusCode(_0x464b11,null))[_0x20e8('0x5c')](handleError(_0x464b11,null));};exports[_0x20e8('0xc4')]=function(_0x257d66,_0x46d86a){var _0x294e33={};var _0x3d0fe6={};var _0x382ae1;var _0x80611;return db[_0x20e8('0x61')][_0x20e8('0x6c')]({'where':{'id':_0x257d66[_0x20e8('0x5e')]['id']}})[_0x20e8('0xf')](handleEntityNotFound(_0x46d86a,null))[_0x20e8('0xf')](function(_0x1a10b8){if(_0x1a10b8){_0x382ae1=_0x1a10b8;_0x3d0fe6[_0x20e8('0x47')]=_[_0x20e8('0x60')](db[_0x20e8('0xc5')][_0x20e8('0x44')]);_0x3d0fe6[_0x20e8('0x48')]=_[_0x20e8('0x60')](_0x257d66[_0x20e8('0x48')]);_0x3d0fe6[_0x20e8('0x49')]=_[_0x20e8('0x4a')](_0x3d0fe6['model'],_0x3d0fe6[_0x20e8('0x48')]);_0x294e33[_0x20e8('0x4b')]=_['intersection'](_0x3d0fe6[_0x20e8('0x47')],qs[_0x20e8('0x62')](_0x257d66[_0x20e8('0x48')]['fields']));_0x294e33[_0x20e8('0x4b')]=_0x294e33['attributes'][_0x20e8('0x4c')]?_0x294e33[_0x20e8('0x4b')]:_0x3d0fe6[_0x20e8('0x47')];_0x294e33[_0x20e8('0x4f')]=qs[_0x20e8('0x50')](_0x257d66[_0x20e8('0x48')][_0x20e8('0x50')]);_0x294e33['where']=qs[_0x20e8('0x49')](_['pick'](_0x257d66[_0x20e8('0x48')],_0x3d0fe6[_0x20e8('0x49')]));if(_0x257d66['query'][_0x20e8('0x56')]){_0x294e33['where']=_[_0x20e8('0x53')](_0x294e33[_0x20e8('0x51')],{'$or':_['map'](_0x294e33[_0x20e8('0x4b')],function(_0x2c5e87){var _0x560644={};_0x560644[_0x2c5e87]={'$like':'%'+_0x257d66[_0x20e8('0x48')][_0x20e8('0x56')]+'%'};return _0x560644;})});}_0x294e33=_[_0x20e8('0x53')]({},_0x294e33,_0x257d66[_0x20e8('0x63')]);return _0x382ae1[_0x20e8('0xc4')](_0x294e33);}})[_0x20e8('0xf')](function(_0x1d796c){if(_0x1d796c){_0x80611=_0x1d796c[_0x20e8('0x4c')];if(!_0x257d66[_0x20e8('0x48')]['hasOwnProperty'](_0x20e8('0x4e'))){_0x294e33[_0x20e8('0x1d')]=qs[_0x20e8('0x1d')](_0x257d66[_0x20e8('0x48')][_0x20e8('0x1d')]);_0x294e33[_0x20e8('0x1b')]=qs['offset'](_0x257d66[_0x20e8('0x48')][_0x20e8('0x1b')]);}return _0x382ae1[_0x20e8('0xc4')](_0x294e33);}})[_0x20e8('0xf')](function(_0x4824e9){if(_0x4824e9){return _0x4824e9?{'count':_0x80611,'rows':_0x4824e9}:null;}})['then'](respondWithResult(_0x46d86a,null))[_0x20e8('0x5c')](handleError(_0x46d86a,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 2487cc9..be83a3e 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 _0x1b9b=['exports','events','MailAccount','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x1846e2,_0xe66a3a){var _0x626282=function(_0x3c3e01){while(--_0x3c3e01){_0x1846e2['push'](_0x1846e2['shift']());}};_0x626282(++_0xe66a3a);}(_0x1b9b,0x89));var _0xb1b9=function(_0x42034f,_0x6b7fb6){_0x42034f=_0x42034f-0x0;var _0x1ba47d=_0x1b9b[_0x42034f];return _0x1ba47d;};'use strict';var EventEmitter=require(_0xb1b9('0x0'));var MailAccount=require('../../mysqldb')['db'][_0xb1b9('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xb1b9('0x2')](0x0);var events={'afterCreate':_0xb1b9('0x3'),'afterUpdate':_0xb1b9('0x4'),'afterDestroy':'remove'};function emitEvent(_0x38f77a){return function(_0x411464,_0x597f8f,_0x5c24be){MailAccountEvents['emit'](_0x38f77a+':'+_0x411464['id'],_0x411464);MailAccountEvents[_0xb1b9('0x5')](_0x38f77a,_0x411464);_0x5c24be(null);};}for(var e in events){if(events[_0xb1b9('0x6')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0xb1b9('0x7')]=MailAccountEvents; \ No newline at end of file +var _0x8f6b=['save','update','emit','hook','events','../../mysqldb','MailAccount'];(function(_0x3763f4,_0x3e96f4){var _0x2e8dab=function(_0x3fd5c7){while(--_0x3fd5c7){_0x3763f4['push'](_0x3763f4['shift']());}};_0x2e8dab(++_0x3e96f4);}(_0x8f6b,0x146));var _0xb8f6=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0x8f6b[_0x25bea7];return _0x175952;};'use strict';var EventEmitter=require(_0xb8f6('0x0'));var MailAccount=require(_0xb8f6('0x1'))['db'][_0xb8f6('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb8f6('0x3'),'afterUpdate':_0xb8f6('0x4'),'afterDestroy':'remove'};function emitEvent(_0x36b78d){return function(_0x456df3,_0x49693f,_0x333054){MailAccountEvents['emit'](_0x36b78d+':'+_0x456df3['id'],_0x456df3);MailAccountEvents[_0xb8f6('0x5')](_0x36b78d,_0x456df3);_0x333054(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount[_0xb8f6('0x6')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index b3e1520..dceeeb8 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 _0xbeb2=['MailAccount','mail_accounts','custom','service','provider','Smtp','host','port','secure','authentication','modernAuthentication','CloudProvider','OAuth2','user','auth','exports','define'];(function(_0x5b684,_0x22db3c){var _0x1fa9b7=function(_0x2e76f4){while(--_0x2e76f4){_0x5b684['push'](_0x5b684['shift']());}};_0x1fa9b7(++_0x22db3c);}(_0xbeb2,0x75));var _0x2beb=function(_0x1aacb2,_0x4dba34){_0x1aacb2=_0x1aacb2-0x0;var _0x3a6459=_0xbeb2[_0x1aacb2];return _0x3a6459;};'use strict';var attributes=require('./mailAccount.attributes');module[_0x2beb('0x0')]=function(_0xcc612d){return _0xcc612d[_0x2beb('0x1')](_0x2beb('0x2'),attributes,{'tableName':_0x2beb('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x25292d=this;var _0x2e5b9c={'id':_0x25292d['id'],'tls':{'rejectUnauthorized':![]}};if(_0x25292d['provider']!==_0x2beb('0x4')){_0x2e5b9c[_0x2beb('0x5')]=_0x25292d[_0x2beb('0x6')];}else{_0x2e5b9c['host']=_0x25292d[_0x2beb('0x7')][_0x2beb('0x8')];_0x2e5b9c[_0x2beb('0x9')]=_0x25292d['Smtp'][_0x2beb('0x9')];_0x2e5b9c[_0x2beb('0xa')]=_0x25292d['Smtp'][_0x2beb('0xa')];}if(_0x25292d[_0x2beb('0x7')][_0x2beb('0xb')]){if(_0x25292d[_0x2beb('0x7')][_0x2beb('0xc')]){if(!_0x25292d[_0x2beb('0x7')][_0x2beb('0xd')])throw new Error('Cloud\x20Provider\x20configuration\x20not\x20found');_0x2e5b9c['auth']={'type':_0x2beb('0xe'),'user':_0x25292d['Smtp'][_0x2beb('0xf')],'accessToken':_0x25292d['Smtp']['CloudProvider']['data5']};}else{_0x2e5b9c[_0x2beb('0x10')]={'user':_0x25292d[_0x2beb('0x7')][_0x2beb('0xf')],'pass':_0x25292d[_0x2beb('0x7')]['pass']};}}return _0x2e5b9c;}}});}; \ No newline at end of file +var _0xb09d=['OAuth2','user','data5','pass','./mailAccount.attributes','exports','define','MailAccount','mail_accounts','provider','custom','service','host','Smtp','port','secure','modernAuthentication','Cloud\x20Provider\x20configuration\x20not\x20found','auth'];(function(_0x2fc51d,_0x5bd035){var _0x3f3366=function(_0x1025cc){while(--_0x1025cc){_0x2fc51d['push'](_0x2fc51d['shift']());}};_0x3f3366(++_0x5bd035);}(_0xb09d,0x76));var _0xdb09=function(_0x476a6c,_0x1015c7){_0x476a6c=_0x476a6c-0x0;var _0x2c58dc=_0xb09d[_0x476a6c];return _0x2c58dc;};'use strict';var attributes=require(_0xdb09('0x0'));module[_0xdb09('0x1')]=function(_0x153e23){return _0x153e23[_0xdb09('0x2')](_0xdb09('0x3'),attributes,{'tableName':_0xdb09('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x15b1fc=this;var _0x251a83={'id':_0x15b1fc['id'],'tls':{'rejectUnauthorized':![]}};if(_0x15b1fc[_0xdb09('0x5')]!==_0xdb09('0x6')){_0x251a83[_0xdb09('0x7')]=_0x15b1fc[_0xdb09('0x5')];}else{_0x251a83[_0xdb09('0x8')]=_0x15b1fc[_0xdb09('0x9')][_0xdb09('0x8')];_0x251a83[_0xdb09('0xa')]=_0x15b1fc[_0xdb09('0x9')]['port'];_0x251a83['secure']=_0x15b1fc['Smtp'][_0xdb09('0xb')];}if(_0x15b1fc[_0xdb09('0x9')]['authentication']){if(_0x15b1fc[_0xdb09('0x9')][_0xdb09('0xc')]){if(!_0x15b1fc[_0xdb09('0x9')]['CloudProvider'])throw new Error(_0xdb09('0xd'));_0x251a83[_0xdb09('0xe')]={'type':_0xdb09('0xf'),'user':_0x15b1fc[_0xdb09('0x9')][_0xdb09('0x10')],'accessToken':_0x15b1fc[_0xdb09('0x9')]['CloudProvider'][_0xdb09('0x11')]};}else{_0x251a83[_0xdb09('0xe')]={'user':_0x15b1fc[_0xdb09('0x9')][_0xdb09('0x10')],'pass':_0x15b1fc[_0xdb09('0x9')][_0xdb09('0x12')]};}}return _0x251a83;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 0c1e7b3..3709989 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 _0x8ca9=['autoclose','push','length','close','*,*,*,*','create','List\x20not\x20found','contact','messageId','generate','attach','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','spread','update','subject','format','YYYY-MM-DD\x20HH:mm:ss','interaction','created','attachments','originTo','bcc','Email','ChatOfflineMessageId','Attachments','UserId','User','name','unshift','agent','waitForTheAssignedAgent','queueId','MailQueue','queue','waitForTheAssignedQueue','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailAccount','MailAccount','findAll','raw','options','limit','include','map','model','attributes','debug','ShowMailAccount','find','where','setDataValue','smtpOptions','getSmtpOptions','NotifyMailAccount','body','mail','difference','keys','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','account','CmList','List','CmContact','Contacts','DESC','MailApplication','Applications','MailServerOut','CloudProvider','get','omit','list','applications','priority','asc'];(function(_0x2b2e8c,_0x54f172){var _0x4e8fac=function(_0x31dfce){while(--_0x31dfce){_0x2b2e8c['push'](_0x2b2e8c['shift']());}};_0x4e8fac(++_0x54f172);}(_0x8ca9,0x9c));var _0x98ca=function(_0x206206,_0x2048ef){_0x206206=_0x206206-0x0;var _0x4c5d93=_0x8ca9[_0x206206];return _0x4c5d93;};'use strict';var _=require(_0x98ca('0x0'));var moment=require(_0x98ca('0x1'));var BPromise=require(_0x98ca('0x2'));var rs=require(_0x98ca('0x3'));var Redis=require(_0x98ca('0x4'));var db=require(_0x98ca('0x5'))['db'];var logger=require(_0x98ca('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x98ca('0x7'));var client=jayson['client'][_0x98ca('0x8')]({'port':0x232c});config['redis']=_[_0x98ca('0x9')](config[_0x98ca('0xa')],{'host':_0x98ca('0xb'),'port':0x18eb});var socket=require(_0x98ca('0xc'))(new Redis(config[_0x98ca('0xa')]));require(_0x98ca('0xd'))[_0x98ca('0xe')](socket);function respondWithRpcPromise(_0x210234,_0x277c29,_0x404cc1){return new BPromise(function(_0x572858,_0x2074fb){return client[_0x98ca('0xf')](_0x210234,_0x404cc1)[_0x98ca('0x10')](function(_0x220a97){logger[_0x98ca('0x11')](_0x98ca('0x12'),_0x277c29,_0x98ca('0x13'));logger['debug'](_0x98ca('0x14'),_0x277c29,_0x98ca('0x13'),JSON[_0x98ca('0x15')](_0x220a97));if(_0x220a97[_0x98ca('0x16')]){if(_0x220a97['error'][_0x98ca('0x17')]===0x1f4){logger[_0x98ca('0x16')](_0x98ca('0x12'),_0x277c29,_0x220a97[_0x98ca('0x16')][_0x98ca('0x18')]);return _0x2074fb(_0x220a97[_0x98ca('0x16')][_0x98ca('0x18')]);}logger['error'](_0x98ca('0x12'),_0x277c29,_0x220a97[_0x98ca('0x16')][_0x98ca('0x18')]);return _0x572858(_0x220a97[_0x98ca('0x16')]['message']);}else{logger[_0x98ca('0x11')](_0x98ca('0x12'),_0x277c29,_0x98ca('0x13'));_0x572858(_0x220a97[_0x98ca('0x19')][_0x98ca('0x18')]);}})[_0x98ca('0x1a')](function(_0x28c8a6){logger[_0x98ca('0x16')](_0x98ca('0x12'),_0x277c29,_0x28c8a6);_0x2074fb(_0x28c8a6);});});}exports[_0x98ca('0x1b')]=function(_0x1b2c69){var _0x4806a3=this;return new Promise(function(_0x626b37,_0x49298d){return db[_0x98ca('0x1c')][_0x98ca('0x1d')]({'raw':_0x1b2c69['options']?_0x1b2c69['options'][_0x98ca('0x1e')]===undefined?!![]:![]:!![],'where':_0x1b2c69[_0x98ca('0x1f')]?_0x1b2c69[_0x98ca('0x1f')]['where']||null:null,'attributes':_0x1b2c69[_0x98ca('0x1f')]?_0x1b2c69[_0x98ca('0x1f')]['attributes']||null:null,'limit':_0x1b2c69[_0x98ca('0x1f')]?_0x1b2c69['options'][_0x98ca('0x20')]||null:null,'include':_0x1b2c69[_0x98ca('0x1f')]?_0x1b2c69[_0x98ca('0x1f')][_0x98ca('0x21')]?_[_0x98ca('0x22')](_0x1b2c69[_0x98ca('0x1f')][_0x98ca('0x21')],function(_0x50b1a2){return{'model':db[_0x50b1a2[_0x98ca('0x23')]],'as':_0x50b1a2['as'],'attributes':_0x50b1a2['attributes'],'include':_0x50b1a2[_0x98ca('0x21')]?_[_0x98ca('0x22')](_0x50b1a2['include'],function(_0x1f569b){return{'model':db[_0x1f569b['model']],'as':_0x1f569b['as'],'attributes':_0x1f569b[_0x98ca('0x24')],'include':_0x1f569b['include']?_['map'](_0x1f569b[_0x98ca('0x21')],function(_0x540f45){return{'model':db[_0x540f45[_0x98ca('0x23')]],'as':_0x540f45['as'],'attributes':_0x540f45[_0x98ca('0x24')]};}):[]};}):[]};}):[]:[]})[_0x98ca('0x10')](function(_0x21a12a){logger[_0x98ca('0x11')](_0x98ca('0x1b'),_0x1b2c69);logger[_0x98ca('0x25')](_0x98ca('0x1b'),_0x1b2c69,JSON[_0x98ca('0x15')](_0x21a12a));_0x626b37(_0x21a12a);})['catch'](function(_0x2ebf28){logger['error'](_0x98ca('0x1b'),_0x2ebf28[_0x98ca('0x18')],_0x1b2c69);_0x49298d(_0x4806a3['error'](0x1f4,_0x2ebf28['message']));});});};exports[_0x98ca('0x26')]=function(_0x4b37b4){var _0x3990d7=this;return new Promise(function(_0x4f1622,_0x2aaf39){return db['MailAccount'][_0x98ca('0x27')]({'raw':_0x4b37b4[_0x98ca('0x1f')]?_0x4b37b4['options'][_0x98ca('0x1e')]===undefined?!![]:![]:!![],'where':_0x4b37b4[_0x98ca('0x1f')]?_0x4b37b4['options'][_0x98ca('0x28')]||null:null,'attributes':_0x4b37b4[_0x98ca('0x1f')]?_0x4b37b4['options'][_0x98ca('0x24')]||null:null,'include':_0x4b37b4[_0x98ca('0x1f')]?_0x4b37b4[_0x98ca('0x1f')][_0x98ca('0x21')]?_[_0x98ca('0x22')](_0x4b37b4['options'][_0x98ca('0x21')],function(_0x430a37){return{'model':db[_0x430a37['model']],'as':_0x430a37['as'],'attributes':_0x430a37[_0x98ca('0x24')],'include':_0x430a37[_0x98ca('0x21')]?_[_0x98ca('0x22')](_0x430a37['include'],function(_0x1ef3ff){return{'model':db[_0x1ef3ff[_0x98ca('0x23')]],'as':_0x1ef3ff['as'],'attributes':_0x1ef3ff[_0x98ca('0x24')],'include':_0x1ef3ff['include']?_[_0x98ca('0x22')](_0x1ef3ff[_0x98ca('0x21')],function(_0x10cbe0){return{'model':db[_0x10cbe0['model']],'as':_0x10cbe0['as'],'attributes':_0x10cbe0['attributes']};}):[]};}):[]};}):[]:[]})[_0x98ca('0x10')](function(_0xe77d02){if(_0x4b37b4[_0x98ca('0x1f')]['smtp']===!![])_0xe77d02[_0x98ca('0x29')](_0x98ca('0x2a'),_0xe77d02[_0x98ca('0x2b')]());logger['info'](_0x98ca('0x26'),_0x4b37b4);logger[_0x98ca('0x25')](_0x98ca('0x26'),_0x4b37b4,JSON[_0x98ca('0x15')](_0xe77d02));_0x4f1622(_0xe77d02);})[_0x98ca('0x1a')](function(_0x5d924c){logger['error']('ShowMailAccount',_0x5d924c[_0x98ca('0x18')],_0x4b37b4);_0x2aaf39(_0x3990d7[_0x98ca('0x16')](0x1f4,_0x5d924c[_0x98ca('0x18')]));});});};exports[_0x98ca('0x2c')]=function(_0x43ba26){var _0xda0db1=this;return new Promise(function(_0x29801f,_0x570afe){var _0x4900ed={'body':_0x43ba26[_0x98ca('0x2d')],'channel':_0x98ca('0x2e')};var _0x31424f=_[_0x98ca('0x2f')](_[_0x98ca('0x30')](db['CmContact']['rawAttributes']),['createdAt',_0x98ca('0x31'),_0x98ca('0x32'),_0x98ca('0x33')]);var _0x3f260b=![];if(_0x43ba26['body']['id']){delete _0x43ba26['body']['id'];}if(_[_0x98ca('0x34')](_0x43ba26[_0x98ca('0x2d')][_0x98ca('0x35')])){return _0x570afe(_0xda0db1[_0x98ca('0x16')](0x1f4,_0x98ca('0x36')));}if(_[_0x98ca('0x34')](_0x43ba26[_0x98ca('0x2d')][_0x98ca('0x2d')])||_0x43ba26[_0x98ca('0x2d')][_0x98ca('0x2d')]===''){return _0x570afe(_0xda0db1[_0x98ca('0x16')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x98ca('0x34')](_0x43ba26[_0x98ca('0x2d')][_0x98ca('0x37')])){return _0x570afe(_0xda0db1[_0x98ca('0x16')](0x1f4,_0x98ca('0x38')+_0x31424f));}if(!_[_0x98ca('0x39')](_0x31424f,_0x43ba26[_0x98ca('0x2d')][_0x98ca('0x37')])){return _0x570afe(_0xda0db1[_0x98ca('0x16')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x31424f));}var _0x2a4d0a={};_0x2a4d0a[_0x43ba26[_0x98ca('0x2d')]['mapKey']]=_0x43ba26[_0x98ca('0x2d')]['from'];return db[_0x98ca('0x1c')][_0x98ca('0x27')]({'where':{'id':_0x43ba26[_0x98ca('0x3a')]['id']},'include':[{'model':db[_0x98ca('0x3b')],'as':_0x98ca('0x3c'),'include':[{'model':db[_0x98ca('0x3d')],'as':_0x98ca('0x3e'),'where':_0x2a4d0a,'limit':0x1,'order':[[_0x98ca('0x31'),_0x98ca('0x3f')]]}]},{'model':db[_0x98ca('0x40')],'as':_0x98ca('0x41')},{'model':db[_0x98ca('0x42')],'as':'Smtp','include':[{'model':db[_0x98ca('0x43')],'as':_0x98ca('0x43')}]}]})[_0x98ca('0x10')](function(_0x19dc39){if(_0x19dc39&&_0x19dc39['List']){var _0xec9f92=_0x19dc39[_0x98ca('0x44')]({'plain':!![]});_0x4900ed[_0x98ca('0x3a')]=_[_0x98ca('0x45')](_0xec9f92,[_0x98ca('0x41'),_0x98ca('0x3c')]);_0x4900ed[_0x98ca('0x3a')]['smtpOptions']=_0x19dc39['getSmtpOptions']();_0x4900ed['applications']=_0xec9f92[_0x98ca('0x41')];_0x4900ed[_0x98ca('0x46')]=_0xec9f92[_0x98ca('0x3c')];_0x4900ed[_0x98ca('0x47')]=_['orderBy'](_0x4900ed['applications'],[_0x98ca('0x48')],[_0x98ca('0x49')]);if(_0x4900ed[_0x98ca('0x3a')]&&_0x4900ed[_0x98ca('0x3a')][_0x98ca('0x4a')]){_0x4900ed[_0x98ca('0x47')][_0x98ca('0x4b')]({'id':0x0,'priority':_0x4900ed[_0x98ca('0x47')][_0x98ca('0x4c')]+0x1,'app':_0x98ca('0x4d'),'appdata':_0x98ca('0x4a'),'interval':_0x98ca('0x4e')});}if(_0x4900ed[_0x98ca('0x3a')]['Applications']){delete _0x4900ed[_0x98ca('0x3a')]['Applications'];}if(_0x4900ed[_0x98ca('0x3a')][_0x98ca('0x3c')]){delete _0x4900ed[_0x98ca('0x3a')][_0x98ca('0x3c')];}if(_0xec9f92[_0x98ca('0x3c')]['Contacts'][_0x98ca('0x4c')]){return _0xec9f92[_0x98ca('0x3c')]['Contacts'][0x0];}var _0x19473e=_[_0x98ca('0x9')](_0x43ba26[_0x98ca('0x2d')],{'firstName':_0x43ba26['body'][_0x98ca('0x35')],'ListId':_0xec9f92[_0x98ca('0x33')]});_0x19473e[_0x43ba26['body'][_0x98ca('0x37')]]=_0x43ba26[_0x98ca('0x2d')][_0x98ca('0x35')];return db[_0x98ca('0x3d')][_0x98ca('0x4f')](_0x19473e);}else{throw new Error(_0x98ca('0x50'));}})[_0x98ca('0x10')](function(_0x594d82){_0x4900ed[_0x98ca('0x51')]=_0x594d82;if(_0x594d82){if(!_0x43ba26[_0x98ca('0x2d')][_0x98ca('0x18')]['messageId']){_0x43ba26['body'][_0x98ca('0x18')][_0x98ca('0x52')]=rs[_0x98ca('0x53')]()+'\x20'+_0x43ba26[_0x98ca('0x2d')][_0x98ca('0x18')][_0x98ca('0x35')];}var _0x3dc32e={'ContactId':_0x594d82['id'],'MailAccountId':_0x43ba26[_0x98ca('0x3a')]['id'],'inReplyTo':_0x43ba26['body'][_0x98ca('0x18')]['messageId'],'to':_0x43ba26['body'][_0x98ca('0x18')][_0x98ca('0x35')],'cc':_0x43ba26[_0x98ca('0x2d')][_0x98ca('0x18')]['cc'],'subject':_0x43ba26[_0x98ca('0x2d')][_0x98ca('0x18')]['subject'],'attach':_0x43ba26[_0x98ca('0x2d')][_0x98ca('0x18')][_0x98ca('0x54')],'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0x98ca('0x55')][_0x98ca('0x27')]({'where':{'closed':![],'MailAccountId':_0x43ba26[_0x98ca('0x3a')]['id']},'include':[{'model':db[_0x98ca('0x56')],'as':_0x98ca('0x57'),'attributes':[_0x98ca('0x52')],'where':{'messageId':_0x43ba26[_0x98ca('0x2d')][_0x98ca('0x18')][_0x98ca('0x58')]}}]})[_0x98ca('0x10')](function(_0x40c799){if(_0x40c799){return[_0x40c799,![]];}return db[_0x98ca('0x55')]['create'](_0x3dc32e)[_0x98ca('0x10')](function(_0xb7b30e){return[_0xb7b30e,!![]];});});}else{throw new Error(_0x98ca('0x59'));}})[_0x98ca('0x5a')](function(_0x1082f4,_0x23344b){if(_0x1082f4){_0x3f260b=_0x23344b;if(!_0x23344b){return _0x1082f4[_0x98ca('0x5b')]({'inReplyTo':_0x43ba26[_0x98ca('0x2d')][_0x98ca('0x18')]['messageId'],'to':_0x43ba26[_0x98ca('0x2d')][_0x98ca('0x18')][_0x98ca('0x35')],'cc':_0x43ba26['body'][_0x98ca('0x18')]['cc'],'subject':_0x43ba26[_0x98ca('0x2d')][_0x98ca('0x18')][_0x98ca('0x5c')],'attach':_0x1082f4[_0x98ca('0x54')]?_0x1082f4['attach']:_0x43ba26[_0x98ca('0x2d')][_0x98ca('0x18')]['attach'],'substatus':null,'substatusAt':moment()[_0x98ca('0x5d')](_0x98ca('0x5e')),'lastMsgAt':moment()[_0x98ca('0x5d')](_0x98ca('0x5e')),'lastMsgDirection':'in'});}else{return _0x1082f4;}}})[_0x98ca('0x10')](function(_0x20fcc9){_0x4900ed['interaction']=_0x20fcc9[_0x98ca('0x44')]({'plain':!![]});_0x4900ed[_0x98ca('0x5f')][_0x98ca('0x60')]=_0x3f260b;return db[_0x98ca('0x56')]['create']({'body':_0x43ba26[_0x98ca('0x2d')][_0x98ca('0x2d')],'MailAccountId':_0x43ba26['account']['id'],'MailInteractionId':_0x20fcc9['id'],'direction':'in','ContactId':_0x4900ed[_0x98ca('0x51')]['id'],'messageId':_0x43ba26[_0x98ca('0x2d')]['message'][_0x98ca('0x52')],'from':_0x43ba26[_0x98ca('0x2d')][_0x98ca('0x18')][_0x98ca('0x35')],'to':_0x43ba26[_0x98ca('0x2d')][_0x98ca('0x18')]['to'],'cc':_0x43ba26['body'][_0x98ca('0x18')]['cc'],'subject':_0x43ba26[_0x98ca('0x2d')][_0x98ca('0x18')][_0x98ca('0x5c')],'attach':_0x43ba26[_0x98ca('0x2d')][_0x98ca('0x18')][_0x98ca('0x54')],'Attachments':_0x43ba26['body'][_0x98ca('0x18')][_0x98ca('0x61')],'originTo':_0x43ba26[_0x98ca('0x2d')]['message'][_0x98ca('0x62')],'originCc':_0x43ba26[_0x98ca('0x2d')][_0x98ca('0x18')]['originCc'],'bcc':_0x43ba26[_0x98ca('0x2d')][_0x98ca('0x18')][_0x98ca('0x63')],'ChatWebsiteId':_0x43ba26[_0x98ca('0x2d')][_0x98ca('0x18')]['ChatWebsiteId']||null,'originChannel':_0x43ba26['body'][_0x98ca('0x18')]['originChannel']||_0x98ca('0x64'),'ChatOfflineMessageId':_0x43ba26[_0x98ca('0x2d')][_0x98ca('0x18')][_0x98ca('0x65')]||null},{'include':[{'model':db['Attachment'],'as':_0x98ca('0x66')}]});})[_0x98ca('0x10')](function(_0x55c8c3){_0x4900ed[_0x98ca('0x18')]=_0x55c8c3;if(!_0x4900ed[_0x98ca('0x5f')][_0x98ca('0x67')]){return;}return db[_0x98ca('0x68')][_0x98ca('0x27')]({'attributes':['id',_0x98ca('0x69')],'where':{'id':_0x4900ed[_0x98ca('0x5f')][_0x98ca('0x67')]}});})[_0x98ca('0x10')](function(_0x13114b){if(_0x13114b){_0x4900ed[_0x98ca('0x47')][_0x98ca('0x6a')]({'id':0x0,'priority':0x0,'app':_0x98ca('0x6b'),'appdata':_0x13114b[_0x98ca('0x69')]+','+(_0x4900ed[_0x98ca('0x3a')][_0x98ca('0x6c')]||0xa),'interval':_0x98ca('0x4e')});}if(!_0x4900ed[_0x98ca('0x5f')][_0x98ca('0x6d')]){return;}return db[_0x98ca('0x6e')][_0x98ca('0x27')]({'attributes':['id','name'],'where':{'id':_0x4900ed[_0x98ca('0x5f')][_0x98ca('0x6d')]}});})['then'](function(_0x34c7b7){if(_0x34c7b7){_0x4900ed[_0x98ca('0x47')]['unshift']({'id':0x0,'priority':0x1,'app':_0x98ca('0x6f'),'appdata':_0x34c7b7['name']+','+(_0x4900ed[_0x98ca('0x3a')][_0x98ca('0x70')]||0x12c),'interval':_0x98ca('0x4e')});}return respondWithRpcPromise(_0x98ca('0x71'),_0x98ca('0x72'),_0x4900ed);})['then'](function(_0x54975d){_0x29801f(_0x54975d);})[_0x98ca('0x1a')](function(_0x3f1057){_0x570afe(_0xda0db1[_0x98ca('0x16')](0x1f4,_0x3f1057[_0x98ca('0x18')]));});});}; \ No newline at end of file +var _0xe0ae=['DESC','MailApplication','Applications','MailServerOut','Smtp','CloudProvider','get','account','omit','getSmtpOptions','applications','orderBy','priority','autoclose','push','length','close','*,*,*,*','messageId','generate','subject','attach','YYYY-MM-DD\x20HH:mm:ss','MailMessage','Messages','inReplyTo','create','Contact\x20not\x20found','spread','update','format','created','contact','attachments','originTo','originCc','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','UserId','User','interaction','unshift','agent','name','waitForTheAssignedAgent','queueId','MailQueue','Start','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','client','defaults','redis','localhost','socket.io-emitter','./mailAccount.socket','request','then','info','request\x20sent','debug','error','MailAccount,\x20%s,\x20%s','message','result','catch','GetMailAccount','MailAccount','findAll','options','raw','where','limit','include','map','model','attributes','stringify','ShowMailAccount','find','setDataValue','smtpOptions','mail','difference','keys','CmContact','rawAttributes','createdAt','ListId','body','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','CmList','List','Contacts'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe0ae,0xa1));var _0xee0a=function(_0x1f1e31,_0x27b5c3){_0x1f1e31=_0x1f1e31-0x0;var _0x229b56=_0xe0ae[_0x1f1e31];return _0x229b56;};'use strict';var _=require('lodash');var moment=require('moment');var BPromise=require(_0xee0a('0x0'));var rs=require(_0xee0a('0x1'));var Redis=require('ioredis');var db=require(_0xee0a('0x2'))['db'];var logger=require('../../config/logger')(_0xee0a('0x3'));var config=require(_0xee0a('0x4'));var jayson=require('jayson/promise');var client=jayson[_0xee0a('0x5')]['http']({'port':0x232c});config['redis']=_[_0xee0a('0x6')](config[_0xee0a('0x7')],{'host':_0xee0a('0x8'),'port':0x18eb});var socket=require(_0xee0a('0x9'))(new Redis(config['redis']));require(_0xee0a('0xa'))['register'](socket);function respondWithRpcPromise(_0x4e2c89,_0x1f9d42,_0x3d0b3f){return new BPromise(function(_0xbd4483,_0x57d190){return client[_0xee0a('0xb')](_0x4e2c89,_0x3d0b3f)[_0xee0a('0xc')](function(_0x548eb7){logger[_0xee0a('0xd')]('MailAccount,\x20%s,\x20%s',_0x1f9d42,_0xee0a('0xe'));logger[_0xee0a('0xf')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x1f9d42,_0xee0a('0xe'),JSON['stringify'](_0x548eb7));if(_0x548eb7[_0xee0a('0x10')]){if(_0x548eb7[_0xee0a('0x10')]['code']===0x1f4){logger['error'](_0xee0a('0x11'),_0x1f9d42,_0x548eb7[_0xee0a('0x10')][_0xee0a('0x12')]);return _0x57d190(_0x548eb7[_0xee0a('0x10')][_0xee0a('0x12')]);}logger['error'](_0xee0a('0x11'),_0x1f9d42,_0x548eb7[_0xee0a('0x10')]['message']);return _0xbd4483(_0x548eb7[_0xee0a('0x10')][_0xee0a('0x12')]);}else{logger[_0xee0a('0xd')](_0xee0a('0x11'),_0x1f9d42,'request\x20sent');_0xbd4483(_0x548eb7[_0xee0a('0x13')][_0xee0a('0x12')]);}})[_0xee0a('0x14')](function(_0x55c474){logger[_0xee0a('0x10')](_0xee0a('0x11'),_0x1f9d42,_0x55c474);_0x57d190(_0x55c474);});});}exports[_0xee0a('0x15')]=function(_0x24f8f1){var _0x5d29e0=this;return new Promise(function(_0xe9d5d4,_0x10c224){return db[_0xee0a('0x16')][_0xee0a('0x17')]({'raw':_0x24f8f1['options']?_0x24f8f1[_0xee0a('0x18')][_0xee0a('0x19')]===undefined?!![]:![]:!![],'where':_0x24f8f1[_0xee0a('0x18')]?_0x24f8f1[_0xee0a('0x18')][_0xee0a('0x1a')]||null:null,'attributes':_0x24f8f1[_0xee0a('0x18')]?_0x24f8f1[_0xee0a('0x18')]['attributes']||null:null,'limit':_0x24f8f1[_0xee0a('0x18')]?_0x24f8f1[_0xee0a('0x18')][_0xee0a('0x1b')]||null:null,'include':_0x24f8f1[_0xee0a('0x18')]?_0x24f8f1['options'][_0xee0a('0x1c')]?_[_0xee0a('0x1d')](_0x24f8f1[_0xee0a('0x18')][_0xee0a('0x1c')],function(_0x4c61e2){return{'model':db[_0x4c61e2['model']],'as':_0x4c61e2['as'],'attributes':_0x4c61e2['attributes'],'include':_0x4c61e2[_0xee0a('0x1c')]?_['map'](_0x4c61e2['include'],function(_0x1c9ad8){return{'model':db[_0x1c9ad8[_0xee0a('0x1e')]],'as':_0x1c9ad8['as'],'attributes':_0x1c9ad8[_0xee0a('0x1f')],'include':_0x1c9ad8['include']?_[_0xee0a('0x1d')](_0x1c9ad8[_0xee0a('0x1c')],function(_0x15b1c0){return{'model':db[_0x15b1c0[_0xee0a('0x1e')]],'as':_0x15b1c0['as'],'attributes':_0x15b1c0[_0xee0a('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xee0a('0xc')](function(_0x145332){logger[_0xee0a('0xd')](_0xee0a('0x15'),_0x24f8f1);logger[_0xee0a('0xf')]('GetMailAccount',_0x24f8f1,JSON[_0xee0a('0x20')](_0x145332));_0xe9d5d4(_0x145332);})[_0xee0a('0x14')](function(_0x284be5){logger[_0xee0a('0x10')](_0xee0a('0x15'),_0x284be5[_0xee0a('0x12')],_0x24f8f1);_0x10c224(_0x5d29e0['error'](0x1f4,_0x284be5[_0xee0a('0x12')]));});});};exports[_0xee0a('0x21')]=function(_0x86cef4){var _0x114042=this;return new Promise(function(_0x4b9cd7,_0x354dff){return db['MailAccount'][_0xee0a('0x22')]({'raw':_0x86cef4[_0xee0a('0x18')]?_0x86cef4[_0xee0a('0x18')][_0xee0a('0x19')]===undefined?!![]:![]:!![],'where':_0x86cef4[_0xee0a('0x18')]?_0x86cef4[_0xee0a('0x18')][_0xee0a('0x1a')]||null:null,'attributes':_0x86cef4[_0xee0a('0x18')]?_0x86cef4['options'][_0xee0a('0x1f')]||null:null,'include':_0x86cef4[_0xee0a('0x18')]?_0x86cef4['options'][_0xee0a('0x1c')]?_[_0xee0a('0x1d')](_0x86cef4[_0xee0a('0x18')]['include'],function(_0x131b60){return{'model':db[_0x131b60[_0xee0a('0x1e')]],'as':_0x131b60['as'],'attributes':_0x131b60[_0xee0a('0x1f')],'include':_0x131b60['include']?_[_0xee0a('0x1d')](_0x131b60[_0xee0a('0x1c')],function(_0x340dc8){return{'model':db[_0x340dc8['model']],'as':_0x340dc8['as'],'attributes':_0x340dc8['attributes'],'include':_0x340dc8[_0xee0a('0x1c')]?_[_0xee0a('0x1d')](_0x340dc8[_0xee0a('0x1c')],function(_0x25041c){return{'model':db[_0x25041c[_0xee0a('0x1e')]],'as':_0x25041c['as'],'attributes':_0x25041c[_0xee0a('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xee0a('0xc')](function(_0x616351){if(_0x86cef4[_0xee0a('0x18')]['smtp']===!![])_0x616351[_0xee0a('0x23')](_0xee0a('0x24'),_0x616351['getSmtpOptions']());logger[_0xee0a('0xd')](_0xee0a('0x21'),_0x86cef4);logger['debug'](_0xee0a('0x21'),_0x86cef4,JSON[_0xee0a('0x20')](_0x616351));_0x4b9cd7(_0x616351);})[_0xee0a('0x14')](function(_0x4393d9){logger[_0xee0a('0x10')](_0xee0a('0x21'),_0x4393d9[_0xee0a('0x12')],_0x86cef4);_0x354dff(_0x114042[_0xee0a('0x10')](0x1f4,_0x4393d9[_0xee0a('0x12')]));});});};exports['NotifyMailAccount']=function(_0x429eca){var _0x263878=this;return new Promise(function(_0x41eba8,_0xf3efee){var _0x4c87e8={'body':_0x429eca['body'],'channel':_0xee0a('0x25')};var _0x2715f7=_[_0xee0a('0x26')](_[_0xee0a('0x27')](db[_0xee0a('0x28')][_0xee0a('0x29')]),[_0xee0a('0x2a'),'updatedAt','CompanyId',_0xee0a('0x2b')]);var _0x283062=![];if(_0x429eca['body']['id']){delete _0x429eca[_0xee0a('0x2c')]['id'];}if(_[_0xee0a('0x2d')](_0x429eca['body'][_0xee0a('0x2e')])){return _0xf3efee(_0x263878[_0xee0a('0x10')](0x1f4,_0xee0a('0x2f')));}if(_[_0xee0a('0x2d')](_0x429eca[_0xee0a('0x2c')][_0xee0a('0x2c')])||_0x429eca[_0xee0a('0x2c')]['body']===''){return _0xf3efee(_0x263878['error'](0x1f4,_0xee0a('0x30')));}if(_['isNil'](_0x429eca['body']['mapKey'])){return _0xf3efee(_0x263878[_0xee0a('0x10')](0x1f4,_0xee0a('0x31')+_0x2715f7));}if(!_['includes'](_0x2715f7,_0x429eca['body']['mapKey'])){return _0xf3efee(_0x263878['error'](0x1f4,_0xee0a('0x32')+_0x2715f7));}var _0x2e687f={};_0x2e687f[_0x429eca[_0xee0a('0x2c')][_0xee0a('0x33')]]=_0x429eca[_0xee0a('0x2c')][_0xee0a('0x2e')];return db['MailAccount'][_0xee0a('0x22')]({'where':{'id':_0x429eca['account']['id']},'include':[{'model':db[_0xee0a('0x34')],'as':_0xee0a('0x35'),'include':[{'model':db[_0xee0a('0x28')],'as':_0xee0a('0x36'),'where':_0x2e687f,'limit':0x1,'order':[['updatedAt',_0xee0a('0x37')]]}]},{'model':db[_0xee0a('0x38')],'as':_0xee0a('0x39')},{'model':db[_0xee0a('0x3a')],'as':_0xee0a('0x3b'),'include':[{'model':db[_0xee0a('0x3c')],'as':_0xee0a('0x3c')}]}]})['then'](function(_0x51300e){if(_0x51300e&&_0x51300e[_0xee0a('0x35')]){var _0x2162b8=_0x51300e[_0xee0a('0x3d')]({'plain':!![]});_0x4c87e8[_0xee0a('0x3e')]=_[_0xee0a('0x3f')](_0x2162b8,[_0xee0a('0x39'),_0xee0a('0x35')]);_0x4c87e8[_0xee0a('0x3e')][_0xee0a('0x24')]=_0x51300e[_0xee0a('0x40')]();_0x4c87e8[_0xee0a('0x41')]=_0x2162b8[_0xee0a('0x39')];_0x4c87e8['list']=_0x2162b8[_0xee0a('0x35')];_0x4c87e8[_0xee0a('0x41')]=_[_0xee0a('0x42')](_0x4c87e8[_0xee0a('0x41')],[_0xee0a('0x43')],['asc']);if(_0x4c87e8[_0xee0a('0x3e')]&&_0x4c87e8[_0xee0a('0x3e')][_0xee0a('0x44')]){_0x4c87e8[_0xee0a('0x41')][_0xee0a('0x45')]({'id':0x0,'priority':_0x4c87e8['applications'][_0xee0a('0x46')]+0x1,'app':_0xee0a('0x47'),'appdata':_0xee0a('0x44'),'interval':_0xee0a('0x48')});}if(_0x4c87e8[_0xee0a('0x3e')]['Applications']){delete _0x4c87e8[_0xee0a('0x3e')][_0xee0a('0x39')];}if(_0x4c87e8[_0xee0a('0x3e')][_0xee0a('0x35')]){delete _0x4c87e8[_0xee0a('0x3e')][_0xee0a('0x35')];}if(_0x2162b8[_0xee0a('0x35')][_0xee0a('0x36')][_0xee0a('0x46')]){return _0x2162b8[_0xee0a('0x35')][_0xee0a('0x36')][0x0];}var _0x24b147=_[_0xee0a('0x6')](_0x429eca[_0xee0a('0x2c')],{'firstName':_0x429eca[_0xee0a('0x2c')][_0xee0a('0x2e')],'ListId':_0x2162b8[_0xee0a('0x2b')]});_0x24b147[_0x429eca[_0xee0a('0x2c')][_0xee0a('0x33')]]=_0x429eca[_0xee0a('0x2c')][_0xee0a('0x2e')];return db[_0xee0a('0x28')]['create'](_0x24b147);}else{throw new Error('List\x20not\x20found');}})['then'](function(_0x35eb93){_0x4c87e8['contact']=_0x35eb93;if(_0x35eb93){if(!_0x429eca[_0xee0a('0x2c')][_0xee0a('0x12')][_0xee0a('0x49')]){_0x429eca[_0xee0a('0x2c')]['message'][_0xee0a('0x49')]=rs[_0xee0a('0x4a')]()+'\x20'+_0x429eca[_0xee0a('0x2c')][_0xee0a('0x12')][_0xee0a('0x2e')];}var _0x99e2b0={'ContactId':_0x35eb93['id'],'MailAccountId':_0x429eca[_0xee0a('0x3e')]['id'],'inReplyTo':_0x429eca[_0xee0a('0x2c')][_0xee0a('0x12')][_0xee0a('0x49')],'to':_0x429eca[_0xee0a('0x2c')][_0xee0a('0x12')][_0xee0a('0x2e')],'cc':_0x429eca[_0xee0a('0x2c')]['message']['cc'],'subject':_0x429eca[_0xee0a('0x2c')]['message'][_0xee0a('0x4b')],'attach':_0x429eca[_0xee0a('0x2c')]['message'][_0xee0a('0x4c')],'lastMsgAt':moment()['format'](_0xee0a('0x4d')),'lastMsgDirection':'in'};return db['MailInteraction']['find']({'where':{'closed':![],'MailAccountId':_0x429eca['account']['id']},'include':[{'model':db[_0xee0a('0x4e')],'as':_0xee0a('0x4f'),'attributes':[_0xee0a('0x49')],'where':{'messageId':_0x429eca[_0xee0a('0x2c')][_0xee0a('0x12')][_0xee0a('0x50')]}}]})[_0xee0a('0xc')](function(_0xe583e5){if(_0xe583e5){return[_0xe583e5,![]];}return db['MailInteraction'][_0xee0a('0x51')](_0x99e2b0)['then'](function(_0x593c77){return[_0x593c77,!![]];});});}else{throw new Error(_0xee0a('0x52'));}})[_0xee0a('0x53')](function(_0x2aa5d3,_0x20f149){if(_0x2aa5d3){_0x283062=_0x20f149;if(!_0x20f149){return _0x2aa5d3[_0xee0a('0x54')]({'inReplyTo':_0x429eca[_0xee0a('0x2c')][_0xee0a('0x12')][_0xee0a('0x49')],'to':_0x429eca['body'][_0xee0a('0x12')]['from'],'cc':_0x429eca[_0xee0a('0x2c')][_0xee0a('0x12')]['cc'],'subject':_0x429eca[_0xee0a('0x2c')][_0xee0a('0x12')][_0xee0a('0x4b')],'attach':_0x2aa5d3[_0xee0a('0x4c')]?_0x2aa5d3['attach']:_0x429eca[_0xee0a('0x2c')][_0xee0a('0x12')][_0xee0a('0x4c')],'substatus':null,'substatusAt':moment()['format'](_0xee0a('0x4d')),'lastMsgAt':moment()[_0xee0a('0x55')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0x2aa5d3;}}})[_0xee0a('0xc')](function(_0x4b76b9){_0x4c87e8['interaction']=_0x4b76b9['get']({'plain':!![]});_0x4c87e8['interaction'][_0xee0a('0x56')]=_0x283062;return db['MailMessage'][_0xee0a('0x51')]({'body':_0x429eca['body'][_0xee0a('0x2c')],'MailAccountId':_0x429eca[_0xee0a('0x3e')]['id'],'MailInteractionId':_0x4b76b9['id'],'direction':'in','ContactId':_0x4c87e8[_0xee0a('0x57')]['id'],'messageId':_0x429eca[_0xee0a('0x2c')]['message'][_0xee0a('0x49')],'from':_0x429eca[_0xee0a('0x2c')][_0xee0a('0x12')][_0xee0a('0x2e')],'to':_0x429eca[_0xee0a('0x2c')]['message']['to'],'cc':_0x429eca[_0xee0a('0x2c')][_0xee0a('0x12')]['cc'],'subject':_0x429eca[_0xee0a('0x2c')]['message'][_0xee0a('0x4b')],'attach':_0x429eca[_0xee0a('0x2c')]['message'][_0xee0a('0x4c')],'Attachments':_0x429eca[_0xee0a('0x2c')][_0xee0a('0x12')][_0xee0a('0x58')],'originTo':_0x429eca[_0xee0a('0x2c')][_0xee0a('0x12')][_0xee0a('0x59')],'originCc':_0x429eca[_0xee0a('0x2c')]['message'][_0xee0a('0x5a')],'bcc':_0x429eca[_0xee0a('0x2c')][_0xee0a('0x12')][_0xee0a('0x5b')],'ChatWebsiteId':_0x429eca[_0xee0a('0x2c')][_0xee0a('0x12')][_0xee0a('0x5c')]||null,'originChannel':_0x429eca['body'][_0xee0a('0x12')][_0xee0a('0x5d')]||_0xee0a('0x5e'),'ChatOfflineMessageId':_0x429eca[_0xee0a('0x2c')]['message'][_0xee0a('0x5f')]||null},{'include':[{'model':db[_0xee0a('0x60')],'as':_0xee0a('0x61')}]});})[_0xee0a('0xc')](function(_0x23373d){_0x4c87e8['message']=_0x23373d;if(!_0x4c87e8['interaction'][_0xee0a('0x62')]){return;}return db[_0xee0a('0x63')][_0xee0a('0x22')]({'attributes':['id','name'],'where':{'id':_0x4c87e8[_0xee0a('0x64')][_0xee0a('0x62')]}});})[_0xee0a('0xc')](function(_0x319487){if(_0x319487){_0x4c87e8[_0xee0a('0x41')][_0xee0a('0x65')]({'id':0x0,'priority':0x0,'app':_0xee0a('0x66'),'appdata':_0x319487[_0xee0a('0x67')]+','+(_0x4c87e8['account'][_0xee0a('0x68')]||0xa),'interval':_0xee0a('0x48')});}if(!_0x4c87e8[_0xee0a('0x64')][_0xee0a('0x69')]){return;}return db[_0xee0a('0x6a')]['find']({'attributes':['id',_0xee0a('0x67')],'where':{'id':_0x4c87e8[_0xee0a('0x64')][_0xee0a('0x69')]}});})[_0xee0a('0xc')](function(_0x12b9db){if(_0x12b9db){_0x4c87e8['applications']['unshift']({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x12b9db['name']+','+(_0x4c87e8[_0xee0a('0x3e')]['waitForTheAssignedQueue']||0x12c),'interval':_0xee0a('0x48')});}return respondWithRpcPromise(_0xee0a('0x6b'),'startRouting',_0x4c87e8);})[_0xee0a('0xc')](function(_0x59dd8b){_0x41eba8(_0x59dd8b);})[_0xee0a('0x14')](function(_0x5750bb){_0xf3efee(_0x263878[_0xee0a('0x10')](0x1f4,_0x5750bb[_0xee0a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 2c28277..05d0fb5 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 _0x3441=['mailAccount:','./mailAccount.events','update','emit','removeListener','length'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x3441,0x14b));var _0x1344=function(_0x304320,_0x232a69){_0x304320=_0x304320-0x0;var _0xe607da=_0x3441[_0x304320];return _0xe607da;};'use strict';var MailAccountEvents=require(_0x1344('0x0'));var events=['save','remove',_0x1344('0x1')];function createListener(_0x41959b,_0x484761){return function(_0x129aad){_0x484761[_0x1344('0x2')](_0x41959b,_0x129aad);};}function removeListener(_0x582e4e,_0x4df2ef){return function(){MailAccountEvents[_0x1344('0x3')](_0x582e4e,_0x4df2ef);};}exports['register']=function(_0x2b6f30){for(var _0x452819=0x0,_0x258e25=events[_0x1344('0x4')];_0x452819<_0x258e25;_0x452819++){var _0x5a127c=events[_0x452819];var _0x4c19b7=createListener(_0x1344('0x5')+_0x5a127c,_0x2b6f30);MailAccountEvents['on'](_0x5a127c,_0x4c19b7);}}; \ No newline at end of file +var _0x7d87=['update','emit','removeListener','register','mailAccount:','./mailAccount.events','remove'];(function(_0x2b6ec7,_0x514fd5){var _0x41063d=function(_0x4ddff1){while(--_0x4ddff1){_0x2b6ec7['push'](_0x2b6ec7['shift']());}};_0x41063d(++_0x514fd5);}(_0x7d87,0x178));var _0x77d8=function(_0x2a1866,_0x3f8038){_0x2a1866=_0x2a1866-0x0;var _0x604541=_0x7d87[_0x2a1866];return _0x604541;};'use strict';var MailAccountEvents=require(_0x77d8('0x0'));var events=['save',_0x77d8('0x1'),_0x77d8('0x2')];function createListener(_0x30ed08,_0x2b28e6){return function(_0x3dd798){_0x2b28e6[_0x77d8('0x3')](_0x30ed08,_0x3dd798);};}function removeListener(_0x539778,_0x3da7cd){return function(){MailAccountEvents[_0x77d8('0x4')](_0x539778,_0x3da7cd);};}exports[_0x77d8('0x5')]=function(_0x3a15cf){for(var _0x3e4849=0x0,_0x4b9c8a=events['length'];_0x3e4849<_0x4b9c8a;_0x3e4849++){var _0x160d5c=events[_0x3e4849];var _0x3d0135=createListener(_0x77d8('0x6')+_0x160d5c,_0x3a15cf);MailAccountEvents['on'](_0x160d5c,_0x3d0135);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 7f86766..7e01c2d 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 _0x9f7a=['./mailApplication.controller','/:id','show','put','update','isAuthenticated','exports','multer','util','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x934754,_0x15bd40){var _0x5cf1fc=function(_0x2c1de6){while(--_0x2c1de6){_0x934754['push'](_0x934754['shift']());}};_0x5cf1fc(++_0x15bd40);}(_0x9f7a,0x10b));var _0xa9f7=function(_0x42bc91,_0x41f40a){_0x42bc91=_0x42bc91-0x0;var _0x3f5507=_0x9f7a[_0x42bc91];return _0x3f5507;};'use strict';var multer=require(_0xa9f7('0x0'));var util=require(_0xa9f7('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa9f7('0x2')]();var fs_extra=require(_0xa9f7('0x3'));var auth=require(_0xa9f7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa9f7('0x5'));var controller=require(_0xa9f7('0x6'));router['get'](_0xa9f7('0x7'),auth['isAuthenticated'](),controller[_0xa9f7('0x8')]);router[_0xa9f7('0x9')](_0xa9f7('0x7'),auth['isAuthenticated'](),controller[_0xa9f7('0xa')]);router['delete'](_0xa9f7('0x7'),auth[_0xa9f7('0xb')](),controller['destroy']);module[_0xa9f7('0xc')]=router; \ No newline at end of file +var _0x7b02=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','put','update','destroy','exports','multer','util'];(function(_0x2610a8,_0x471458){var _0x2430ee=function(_0x486f93){while(--_0x486f93){_0x2610a8['push'](_0x2610a8['shift']());}};_0x2430ee(++_0x471458);}(_0x7b02,0xde));var _0x27b0=function(_0x37b167,_0xd28313){_0x37b167=_0x37b167-0x0;var _0x11b32c=_0x7b02[_0x37b167];return _0x11b32c;};'use strict';var multer=require(_0x27b0('0x0'));var util=require(_0x27b0('0x1'));var path=require(_0x27b0('0x2'));var timeout=require(_0x27b0('0x3'));var express=require(_0x27b0('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x27b0('0x5'));var interaction=require(_0x27b0('0x6'));var config=require(_0x27b0('0x7'));var controller=require('./mailApplication.controller');router[_0x27b0('0x8')](_0x27b0('0x9'),auth[_0x27b0('0xa')](),controller[_0x27b0('0xb')]);router[_0x27b0('0xc')](_0x27b0('0x9'),auth[_0x27b0('0xa')](),controller[_0x27b0('0xd')]);router['delete'](_0x27b0('0x9'),auth[_0x27b0('0xa')](),controller[_0x27b0('0xe')]);module[_0x27b0('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 61d556c..2af7d0f 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 _0x0bb2=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x555848,_0x2e1da5){var _0x1f607b=function(_0x4277de){while(--_0x4277de){_0x555848['push'](_0x555848['shift']());}};_0x1f607b(++_0x2e1da5);}(_0x0bb2,0x108));var _0x20bb=function(_0x3d29dd,_0x3aa4d4){_0x3d29dd=_0x3d29dd-0x0;var _0x4d38d9=_0x0bb2[_0x3d29dd];return _0x4d38d9;};'use strict';var Sequelize=require(_0x20bb('0x0'));module[_0x20bb('0x1')]={'priority':{'type':Sequelize[_0x20bb('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x20bb('0x3')],'allowNull':![],'defaultValue':_0x20bb('0x4')},'appdata':{'type':Sequelize[_0x20bb('0x5')]()},'description':{'type':Sequelize[_0x20bb('0x3')]},'interval':{'type':Sequelize[_0x20bb('0x3')],'defaultValue':_0x20bb('0x6')}}; \ No newline at end of file +var _0x43c5=['sequelize','exports','INTEGER','STRING','noop','*,*,*,*'];(function(_0x1f9c54,_0x4710f1){var _0x3eaa0c=function(_0x12d446){while(--_0x12d446){_0x1f9c54['push'](_0x1f9c54['shift']());}};_0x3eaa0c(++_0x4710f1);}(_0x43c5,0x13e));var _0x543c=function(_0x2bde6f,_0x144341){_0x2bde6f=_0x2bde6f-0x0;var _0x50ea15=_0x43c5[_0x2bde6f];return _0x50ea15;};'use strict';var Sequelize=require(_0x543c('0x0'));module[_0x543c('0x1')]={'priority':{'type':Sequelize[_0x543c('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x543c('0x3')],'allowNull':![],'defaultValue':_0x543c('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x543c('0x3')]},'interval':{'type':Sequelize[_0x543c('0x3')],'defaultValue':_0x543c('0x5')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 0254861..5a9a04e 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 _0x0713=['catch','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','stack','name','send','show','params','MailApplication','rawAttributes','query','keys','filters','intersection','model','fields','attributes','length','includeAll','include','merge','options','find','body'];(function(_0xfdd9e6,_0x1c1368){var _0x53d41d=function(_0xf23b02){while(--_0xf23b02){_0xfdd9e6['push'](_0xfdd9e6['shift']());}};_0x53d41d(++_0x1c1368);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3071('0x0'));var jsonpatch=require(_0x3071('0x1'));var rp=require(_0x3071('0x2'));var moment=require(_0x3071('0x3'));var BPromise=require(_0x3071('0x4'));var Mustache=require('mustache');var util=require(_0x3071('0x5'));var path=require(_0x3071('0x6'));var sox=require(_0x3071('0x7'));var csv=require(_0x3071('0x8'));var ejs=require(_0x3071('0x9'));var fs=require('fs');var fs_extra=require(_0x3071('0xa'));var _=require(_0x3071('0xb'));var squel=require(_0x3071('0xc'));var crypto=require(_0x3071('0xd'));var jsforce=require(_0x3071('0xe'));var deskjs=require(_0x3071('0xf'));var toCsv=require(_0x3071('0x8'));var querystring=require(_0x3071('0x10'));var Papa=require('papaparse');var Redis=require(_0x3071('0x11'));var authService=require(_0x3071('0x12'));var qs=require(_0x3071('0x13'));var as=require(_0x3071('0x14'));var hardwareService=require(_0x3071('0x15'));var logger=require('../../config/logger')(_0x3071('0x16'));var utils=require(_0x3071('0x17'));var config=require(_0x3071('0x18'));var licenseUtil=require(_0x3071('0x19'));var db=require(_0x3071('0x1a'))['db'];function respondWithStatusCode(_0x4a8cc7,_0x5330a8){_0x5330a8=_0x5330a8||0xcc;return function(_0x1826ca){if(_0x1826ca){return _0x4a8cc7['sendStatus'](_0x5330a8);}return _0x4a8cc7[_0x3071('0x1b')](_0x5330a8)[_0x3071('0x1c')]();};}function respondWithResult(_0x5d4883,_0x104e73){_0x104e73=_0x104e73||0xc8;return function(_0x4e1219){if(_0x4e1219){return _0x5d4883[_0x3071('0x1b')](_0x104e73)[_0x3071('0x1d')](_0x4e1219);}};}function respondWithFilteredResult(_0x1271d0,_0x1f14e1){return function(_0x1caa5d){if(_0x1caa5d){var _0x2a6a4b=typeof _0x1f14e1[_0x3071('0x1e')]===_0x3071('0x1f')&&typeof _0x1f14e1[_0x3071('0x20')]===_0x3071('0x1f');var _0x5f3c22=_0x1caa5d[_0x3071('0x21')];var _0x17dbda=_0x2a6a4b?0x0:_0x1f14e1[_0x3071('0x1e')];var _0x108a83=_0x2a6a4b?_0x1caa5d[_0x3071('0x21')]:_0x1f14e1[_0x3071('0x1e')]+_0x1f14e1[_0x3071('0x20')];var _0x26f113;if(_0x108a83>=_0x5f3c22){_0x108a83=_0x5f3c22;_0x26f113=0xc8;}else{_0x26f113=0xce;}_0x1271d0['status'](_0x26f113);return _0x1271d0[_0x3071('0x22')](_0x3071('0x23'),_0x17dbda+'-'+_0x108a83+'/'+_0x5f3c22)[_0x3071('0x1d')](_0x1caa5d);}return null;};}function patchUpdates(_0x56c267){return function(_0xb8f4e3){try{jsonpatch['apply'](_0xb8f4e3,_0x56c267,!![]);}catch(_0x833074){return BPromise[_0x3071('0x24')](_0x833074);}return _0xb8f4e3[_0x3071('0x25')]();};}function saveUpdates(_0x457b57,_0x33090c){return function(_0x34c50e){if(_0x34c50e){return _0x34c50e[_0x3071('0x26')](_0x457b57)[_0x3071('0x27')](function(_0x542646){return _0x542646;});}return null;};}function removeEntity(_0x481a51,_0x2ce48a){return function(_0xb05b1d){if(_0xb05b1d){return _0xb05b1d[_0x3071('0x28')]()[_0x3071('0x27')](function(){_0x481a51[_0x3071('0x1b')](0xcc)[_0x3071('0x1c')]();});}};}function handleEntityNotFound(_0x7a4cb4,_0x1fe727){return function(_0x1de5fb){if(!_0x1de5fb){_0x7a4cb4['sendStatus'](0x194);}return _0x1de5fb;};}function handleError(_0x2e5f93,_0x3f1e6e){_0x3f1e6e=_0x3f1e6e||0x1f4;return function(_0x177138){logger['error'](_0x177138[_0x3071('0x29')]);if(_0x177138[_0x3071('0x2a')]){delete _0x177138[_0x3071('0x2a')];}_0x2e5f93[_0x3071('0x1b')](_0x3f1e6e)[_0x3071('0x2b')](_0x177138);};}exports[_0x3071('0x2c')]=function(_0x177b5f,_0x3921a1){var _0x32f1b4={'raw':!![],'where':{'id':_0x177b5f[_0x3071('0x2d')]['id']}},_0x292205={};_0x292205['model']=_['keys'](db[_0x3071('0x2e')][_0x3071('0x2f')]);_0x292205[_0x3071('0x30')]=_[_0x3071('0x31')](_0x177b5f[_0x3071('0x30')]);_0x292205[_0x3071('0x32')]=_[_0x3071('0x33')](_0x292205[_0x3071('0x34')],_0x292205['query']);_0x32f1b4['attributes']=_['intersection'](_0x292205[_0x3071('0x34')],qs[_0x3071('0x35')](_0x177b5f['query'][_0x3071('0x35')]));_0x32f1b4[_0x3071('0x36')]=_0x32f1b4[_0x3071('0x36')][_0x3071('0x37')]?_0x32f1b4['attributes']:_0x292205[_0x3071('0x34')];if(_0x177b5f[_0x3071('0x30')][_0x3071('0x38')]){_0x32f1b4[_0x3071('0x39')]=[{'all':!![]}];}_0x32f1b4=_[_0x3071('0x3a')]({},_0x32f1b4,_0x177b5f[_0x3071('0x3b')]);return db[_0x3071('0x2e')][_0x3071('0x3c')](_0x32f1b4)['then'](handleEntityNotFound(_0x3921a1,null))[_0x3071('0x27')](respondWithResult(_0x3921a1,null))['catch'](handleError(_0x3921a1,null));};exports['update']=function(_0x1a1a64,_0xa3a7ae){if(_0x1a1a64['body']['id']){delete _0x1a1a64[_0x3071('0x3d')]['id'];}return db[_0x3071('0x2e')][_0x3071('0x3c')]({'where':{'id':_0x1a1a64[_0x3071('0x2d')]['id']}})[_0x3071('0x27')](handleEntityNotFound(_0xa3a7ae,null))[_0x3071('0x27')](saveUpdates(_0x1a1a64['body'],null))[_0x3071('0x27')](respondWithResult(_0xa3a7ae,null))[_0x3071('0x3e')](handleError(_0xa3a7ae,null));};exports['destroy']=function(_0x44ad05,_0x5b1392){return db[_0x3071('0x2e')][_0x3071('0x3c')]({'where':{'id':_0x44ad05['params']['id']}})['then'](handleEntityNotFound(_0x5b1392,null))[_0x3071('0x27')](removeEntity(_0x5b1392,null))[_0x3071('0x3e')](handleError(_0x5b1392,null));}; \ No newline at end of file +var _0xac4a=['Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','show','params','model','keys','MailApplication','query','filters','intersection','fields','attributes','length','includeAll','include','merge','options','catch','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set'];(function(_0x851192,_0x3ee14c){var _0x544ca6=function(_0x56ed7d){while(--_0x56ed7d){_0x851192['push'](_0x851192['shift']());}};_0x544ca6(++_0x3ee14c);}(_0xac4a,0x13f));var _0xaac4=function(_0x3dd0a0,_0x248b43){_0x3dd0a0=_0x3dd0a0-0x0;var _0x1a358d=_0xac4a[_0x3dd0a0];return _0x1a358d;};'use strict';var emlformat=require(_0xaac4('0x0'));var rimraf=require(_0xaac4('0x1'));var zipdir=require(_0xaac4('0x2'));var jsonpatch=require(_0xaac4('0x3'));var rp=require(_0xaac4('0x4'));var moment=require(_0xaac4('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xaac4('0x6'));var path=require(_0xaac4('0x7'));var sox=require(_0xaac4('0x8'));var csv=require('to-csv');var ejs=require(_0xaac4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaac4('0xa'));var squel=require('squel');var crypto=require(_0xaac4('0xb'));var jsforce=require(_0xaac4('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xaac4('0xd'));var Papa=require('papaparse');var Redis=require(_0xaac4('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xaac4('0xf'));var hardwareService=require(_0xaac4('0x10'));var logger=require(_0xaac4('0x11'))(_0xaac4('0x12'));var utils=require(_0xaac4('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xaac4('0x14'))['db'];function respondWithStatusCode(_0x2e2d02,_0x45e512){_0x45e512=_0x45e512||0xcc;return function(_0x5a4801){if(_0x5a4801){return _0x2e2d02[_0xaac4('0x15')](_0x45e512);}return _0x2e2d02[_0xaac4('0x16')](_0x45e512)['end']();};}function respondWithResult(_0xf06b1d,_0x2b20d0){_0x2b20d0=_0x2b20d0||0xc8;return function(_0x46698d){if(_0x46698d){return _0xf06b1d[_0xaac4('0x16')](_0x2b20d0)[_0xaac4('0x17')](_0x46698d);}};}function respondWithFilteredResult(_0x2fbeb7,_0x31b7e5){return function(_0x1df9ae){if(_0x1df9ae){var _0x233278=typeof _0x31b7e5[_0xaac4('0x18')]===_0xaac4('0x19')&&typeof _0x31b7e5[_0xaac4('0x1a')]===_0xaac4('0x19');var _0x52686a=_0x1df9ae[_0xaac4('0x1b')];var _0x52085a=_0x233278?0x0:_0x31b7e5[_0xaac4('0x18')];var _0x5b6fd6=_0x233278?_0x1df9ae[_0xaac4('0x1b')]:_0x31b7e5[_0xaac4('0x18')]+_0x31b7e5[_0xaac4('0x1a')];var _0x271bcb;if(_0x5b6fd6>=_0x52686a){_0x5b6fd6=_0x52686a;_0x271bcb=0xc8;}else{_0x271bcb=0xce;}_0x2fbeb7[_0xaac4('0x16')](_0x271bcb);return _0x2fbeb7[_0xaac4('0x1c')](_0xaac4('0x1d'),_0x52085a+'-'+_0x5b6fd6+'/'+_0x52686a)[_0xaac4('0x17')](_0x1df9ae);}return null;};}function patchUpdates(_0x4166ee){return function(_0x480fb0){try{jsonpatch[_0xaac4('0x1e')](_0x480fb0,_0x4166ee,!![]);}catch(_0x4e1e89){return BPromise[_0xaac4('0x1f')](_0x4e1e89);}return _0x480fb0[_0xaac4('0x20')]();};}function saveUpdates(_0x43625c,_0x477b77){return function(_0x17140f){if(_0x17140f){return _0x17140f[_0xaac4('0x21')](_0x43625c)['then'](function(_0x43ccdc){return _0x43ccdc;});}return null;};}function removeEntity(_0x27a84d,_0x174860){return function(_0x4f10ec){if(_0x4f10ec){return _0x4f10ec[_0xaac4('0x22')]()[_0xaac4('0x23')](function(){_0x27a84d[_0xaac4('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24186b,_0x4f1b65){return function(_0x54203b){if(!_0x54203b){_0x24186b['sendStatus'](0x194);}return _0x54203b;};}function handleError(_0x5a0bb3,_0x22d5a6){_0x22d5a6=_0x22d5a6||0x1f4;return function(_0x17d25f){logger[_0xaac4('0x24')](_0x17d25f[_0xaac4('0x25')]);if(_0x17d25f[_0xaac4('0x26')]){delete _0x17d25f[_0xaac4('0x26')];}_0x5a0bb3[_0xaac4('0x16')](_0x22d5a6)[_0xaac4('0x27')](_0x17d25f);};}exports[_0xaac4('0x28')]=function(_0x386c9b,_0x4d0f5f){var _0x316445={'raw':!![],'where':{'id':_0x386c9b[_0xaac4('0x29')]['id']}},_0x16b33c={};_0x16b33c[_0xaac4('0x2a')]=_[_0xaac4('0x2b')](db[_0xaac4('0x2c')]['rawAttributes']);_0x16b33c[_0xaac4('0x2d')]=_['keys'](_0x386c9b[_0xaac4('0x2d')]);_0x16b33c[_0xaac4('0x2e')]=_[_0xaac4('0x2f')](_0x16b33c[_0xaac4('0x2a')],_0x16b33c['query']);_0x316445['attributes']=_['intersection'](_0x16b33c[_0xaac4('0x2a')],qs[_0xaac4('0x30')](_0x386c9b[_0xaac4('0x2d')][_0xaac4('0x30')]));_0x316445[_0xaac4('0x31')]=_0x316445[_0xaac4('0x31')][_0xaac4('0x32')]?_0x316445[_0xaac4('0x31')]:_0x16b33c[_0xaac4('0x2a')];if(_0x386c9b[_0xaac4('0x2d')][_0xaac4('0x33')]){_0x316445[_0xaac4('0x34')]=[{'all':!![]}];}_0x316445=_[_0xaac4('0x35')]({},_0x316445,_0x386c9b[_0xaac4('0x36')]);return db[_0xaac4('0x2c')]['find'](_0x316445)['then'](handleEntityNotFound(_0x4d0f5f,null))[_0xaac4('0x23')](respondWithResult(_0x4d0f5f,null))[_0xaac4('0x37')](handleError(_0x4d0f5f,null));};exports[_0xaac4('0x21')]=function(_0x5e6080,_0x191d0f){if(_0x5e6080[_0xaac4('0x38')]['id']){delete _0x5e6080[_0xaac4('0x38')]['id'];}return db[_0xaac4('0x2c')][_0xaac4('0x39')]({'where':{'id':_0x5e6080[_0xaac4('0x29')]['id']}})[_0xaac4('0x23')](handleEntityNotFound(_0x191d0f,null))['then'](saveUpdates(_0x5e6080[_0xaac4('0x38')],null))[_0xaac4('0x23')](respondWithResult(_0x191d0f,null))[_0xaac4('0x37')](handleError(_0x191d0f,null));};exports['destroy']=function(_0x36d84a,_0x497e7b){return db['MailApplication'][_0xaac4('0x39')]({'where':{'id':_0x36d84a[_0xaac4('0x29')]['id']}})[_0xaac4('0x23')](handleEntityNotFound(_0x497e7b,null))['then'](removeEntity(_0x497e7b,null))['catch'](handleError(_0x497e7b,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 430b61d..1e4a6e7 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 _0x6ced=['../../config/logger','api','moment','bluebird','request-promise','path','./mailApplication.attributes','exports','define','MailApplication','mail_applications','utf8mb4','lodash','util'];(function(_0x1e9b27,_0x389fc8){var _0x1b50c9=function(_0x5d1a26){while(--_0x5d1a26){_0x1e9b27['push'](_0x1e9b27['shift']());}};_0x1b50c9(++_0x389fc8);}(_0x6ced,0x14e));var _0xd6ce=function(_0x4f19d1,_0x16e1a6){_0x4f19d1=_0x4f19d1-0x0;var _0x1fe82e=_0x6ced[_0x4f19d1];return _0x1fe82e;};'use strict';var _=require(_0xd6ce('0x0'));var util=require(_0xd6ce('0x1'));var logger=require(_0xd6ce('0x2'))(_0xd6ce('0x3'));var moment=require(_0xd6ce('0x4'));var BPromise=require(_0xd6ce('0x5'));var rp=require(_0xd6ce('0x6'));var fs=require('fs');var path=require(_0xd6ce('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd6ce('0x8'));module[_0xd6ce('0x9')]=function(_0x40ef57,_0x2df92d){return _0x40ef57[_0xd6ce('0xa')](_0xd6ce('0xb'),attributes,{'tableName':_0xd6ce('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd6ce('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x6830=['exports','define','MailApplication','mail_applications','utf8mb4_unicode_ci','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x6830,0x1a9));var _0x0683=function(_0xb9d223,_0x21b9e5){_0xb9d223=_0xb9d223-0x0;var _0x340b55=_0x6830[_0xb9d223];return _0x340b55;};'use strict';var _=require('lodash');var util=require(_0x0683('0x0'));var logger=require(_0x0683('0x1'))('api');var moment=require(_0x0683('0x2'));var BPromise=require('bluebird');var rp=require(_0x0683('0x3'));var fs=require('fs');var path=require(_0x0683('0x4'));var rimraf=require(_0x0683('0x5'));var config=require(_0x0683('0x6'));var attributes=require('./mailApplication.attributes');module[_0x0683('0x7')]=function(_0x1aea6c,_0x5ec2c7){return _0x1aea6c[_0x0683('0x8')](_0x0683('0x9'),attributes,{'tableName':_0x0683('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0683('0xb')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index a6924eb..97d32ad 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 _0xcf71=['where','limit','UpdateMailApplication','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','request\x20sent','debug','stringify','error','code','MailApplication,\x20%s,\x20%s','message','info','MailApplication','update','body','options'];(function(_0xbf5e16,_0x146ce3){var _0x5975a5=function(_0x2387a7){while(--_0x2387a7){_0xbf5e16['push'](_0xbf5e16['shift']());}};_0x5975a5(++_0x146ce3);}(_0xcf71,0xc8));var _0x1cf7=function(_0x9a7d08,_0xe9048){_0x9a7d08=_0x9a7d08-0x0;var _0x58e6e8=_0xcf71[_0x9a7d08];return _0x58e6e8;};'use strict';var _=require('lodash');var util=require(_0x1cf7('0x0'));var moment=require(_0x1cf7('0x1'));var BPromise=require(_0x1cf7('0x2'));var rs=require(_0x1cf7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1cf7('0x4'))['db'];var utils=require(_0x1cf7('0x5'));var logger=require(_0x1cf7('0x6'))(_0x1cf7('0x7'));var config=require(_0x1cf7('0x8'));var jayson=require(_0x1cf7('0x9'));var client=jayson[_0x1cf7('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e9fa3,_0x58eb80,_0x3705c8){return new BPromise(function(_0x58960f,_0x47b523){return client['request'](_0x5e9fa3,_0x3705c8)[_0x1cf7('0xb')](function(_0x3da83e){logger['info']('MailApplication,\x20%s,\x20%s',_0x58eb80,_0x1cf7('0xc'));logger[_0x1cf7('0xd')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x58eb80,_0x1cf7('0xc'),JSON[_0x1cf7('0xe')](_0x3da83e));if(_0x3da83e[_0x1cf7('0xf')]){if(_0x3da83e['error'][_0x1cf7('0x10')]===0x1f4){logger['error'](_0x1cf7('0x11'),_0x58eb80,_0x3da83e[_0x1cf7('0xf')][_0x1cf7('0x12')]);return _0x47b523(_0x3da83e[_0x1cf7('0xf')]['message']);}logger['error'](_0x1cf7('0x11'),_0x58eb80,_0x3da83e[_0x1cf7('0xf')][_0x1cf7('0x12')]);return _0x58960f(_0x3da83e['error'][_0x1cf7('0x12')]);}else{logger[_0x1cf7('0x13')](_0x1cf7('0x11'),_0x58eb80,'request\x20sent');_0x58960f(_0x3da83e['result'][_0x1cf7('0x12')]);}})['catch'](function(_0x5e7803){logger[_0x1cf7('0xf')](_0x1cf7('0x11'),_0x58eb80,_0x5e7803);_0x47b523(_0x5e7803);});});}exports['UpdateMailApplication']=function(_0x58c494){var _0x304ac8=this;return new Promise(function(_0x16c1be,_0x28b00a){return db[_0x1cf7('0x14')][_0x1cf7('0x15')](_0x58c494[_0x1cf7('0x16')],{'raw':_0x58c494['options']?_0x58c494[_0x1cf7('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58c494['options']?_0x58c494[_0x1cf7('0x17')][_0x1cf7('0x18')]||null:null,'attributes':_0x58c494[_0x1cf7('0x17')]?_0x58c494['options']['attributes']||null:null,'limit':_0x58c494[_0x1cf7('0x17')]?_0x58c494['options'][_0x1cf7('0x19')]||null:null})[_0x1cf7('0xb')](function(_0x572769){logger[_0x1cf7('0x13')](_0x1cf7('0x1a'),_0x58c494);logger['debug']('UpdateMailApplication',_0x58c494,JSON[_0x1cf7('0xe')](_0x572769));_0x16c1be(_0x572769);})[_0x1cf7('0x1b')](function(_0x435ad7){logger['error'](_0x1cf7('0x1a'),_0x435ad7['message'],_0x58c494);_0x28b00a(_0x304ac8[_0x1cf7('0xf')](0x1f4,_0x435ad7[_0x1cf7('0x12')]));});});}; \ No newline at end of file +var _0x32e3=['MailApplication','update','options','raw','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','MailApplication,\x20%s,\x20%s','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','UpdateMailApplication'];(function(_0x34a124,_0x3d3894){var _0x3388f1=function(_0x2142b7){while(--_0x2142b7){_0x34a124['push'](_0x34a124['shift']());}};_0x3388f1(++_0x3d3894);}(_0x32e3,0x1d8));var _0x332e=function(_0x43a129,_0x10b57c){_0x43a129=_0x43a129-0x0;var _0x1f8193=_0x32e3[_0x43a129];return _0x1f8193;};'use strict';var _=require(_0x332e('0x0'));var util=require(_0x332e('0x1'));var moment=require(_0x332e('0x2'));var BPromise=require(_0x332e('0x3'));var rs=require(_0x332e('0x4'));var fs=require('fs');var Redis=require(_0x332e('0x5'));var db=require(_0x332e('0x6'))['db'];var utils=require(_0x332e('0x7'));var logger=require('../../config/logger')(_0x332e('0x8'));var config=require(_0x332e('0x9'));var jayson=require(_0x332e('0xa'));var client=jayson[_0x332e('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x213a15,_0x4dfba7,_0x59126b){return new BPromise(function(_0x239b9c,_0x1205c2){return client['request'](_0x213a15,_0x59126b)[_0x332e('0xc')](function(_0x4566d2){logger['info'](_0x332e('0xd'),_0x4dfba7,'request\x20sent');logger[_0x332e('0xe')](_0x332e('0xf'),_0x4dfba7,'request\x20sent',JSON[_0x332e('0x10')](_0x4566d2));if(_0x4566d2['error']){if(_0x4566d2[_0x332e('0x11')][_0x332e('0x12')]===0x1f4){logger['error']('MailApplication,\x20%s,\x20%s',_0x4dfba7,_0x4566d2['error']['message']);return _0x1205c2(_0x4566d2[_0x332e('0x11')]['message']);}logger[_0x332e('0x11')]('MailApplication,\x20%s,\x20%s',_0x4dfba7,_0x4566d2[_0x332e('0x11')][_0x332e('0x13')]);return _0x239b9c(_0x4566d2['error'][_0x332e('0x13')]);}else{logger[_0x332e('0x14')](_0x332e('0xd'),_0x4dfba7,'request\x20sent');_0x239b9c(_0x4566d2[_0x332e('0x15')][_0x332e('0x13')]);}})[_0x332e('0x16')](function(_0x2c4c5e){logger[_0x332e('0x11')](_0x332e('0xd'),_0x4dfba7,_0x2c4c5e);_0x1205c2(_0x2c4c5e);});});}exports[_0x332e('0x17')]=function(_0x9f7981){var _0x171a11=this;return new Promise(function(_0x53b3f8,_0x44859a){return db[_0x332e('0x18')][_0x332e('0x19')](_0x9f7981['body'],{'raw':_0x9f7981[_0x332e('0x1a')]?_0x9f7981[_0x332e('0x1a')][_0x332e('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x9f7981['options']?_0x9f7981[_0x332e('0x1a')][_0x332e('0x1c')]||null:null,'attributes':_0x9f7981[_0x332e('0x1a')]?_0x9f7981[_0x332e('0x1a')][_0x332e('0x1d')]||null:null,'limit':_0x9f7981[_0x332e('0x1a')]?_0x9f7981['options'][_0x332e('0x1e')]||null:null})['then'](function(_0x411848){logger['info'](_0x332e('0x17'),_0x9f7981);logger[_0x332e('0xe')](_0x332e('0x17'),_0x9f7981,JSON['stringify'](_0x411848));_0x53b3f8(_0x411848);})['catch'](function(_0xc1bca0){logger[_0x332e('0x11')]('UpdateMailApplication',_0xc1bca0['message'],_0x9f7981);_0x44859a(_0x171a11[_0x332e('0x11')](0x1f4,_0xc1bca0['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 770287d..b2f0d19 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 _0x7c0b=['describe','/:id','show','/:id/messages','getMessages','post','create','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','mailinteraction:update','mailinteraction:destroy','delete','removeTags','exports','express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index'];(function(_0x170647,_0x4d4c36){var _0x349e0e=function(_0x9463fa){while(--_0x9463fa){_0x170647['push'](_0x170647['shift']());}};_0x349e0e(++_0x4d4c36);}(_0x7c0b,0x130));var _0xb7c0=function(_0x39d227,_0x283f4e){_0x39d227=_0x39d227-0x0;var _0x1db84f=_0x7c0b[_0x39d227];return _0x1db84f;};'use strict';var express=require(_0xb7c0('0x0'));var router=express[_0xb7c0('0x1')]();var auth=require(_0xb7c0('0x2'));var interaction=require(_0xb7c0('0x3'));var controller=require(_0xb7c0('0x4'));router[_0xb7c0('0x5')]('/',auth[_0xb7c0('0x6')](),controller[_0xb7c0('0x7')]);router[_0xb7c0('0x5')]('/describe',auth[_0xb7c0('0x6')](),controller[_0xb7c0('0x8')]);router['get'](_0xb7c0('0x9'),auth[_0xb7c0('0x6')](),controller[_0xb7c0('0xa')]);router[_0xb7c0('0x5')](_0xb7c0('0xb'),auth['isAuthenticated'](),controller[_0xb7c0('0xc')]);router['get']('/:id/download',auth[_0xb7c0('0x6')](),controller['download']);router[_0xb7c0('0xd')]('/',auth[_0xb7c0('0x6')](),controller[_0xb7c0('0xe')]);router['post']('/:id/messages',auth[_0xb7c0('0x6')](),controller[_0xb7c0('0xf')]);router[_0xb7c0('0xd')](_0xb7c0('0x10'),auth['isAuthenticated'](),interaction[_0xb7c0('0x11')](_0xb7c0('0x12'),_0xb7c0('0x13')),controller[_0xb7c0('0x14')]);router['put'](_0xb7c0('0x9'),auth[_0xb7c0('0x6')](),interaction['tracked']('mail',_0xb7c0('0x15')),controller['update']);router['delete'](_0xb7c0('0x9'),auth['isAuthenticated'](),interaction[_0xb7c0('0x11')](_0xb7c0('0x12'),_0xb7c0('0x16')),controller['destroy']);router[_0xb7c0('0x17')](_0xb7c0('0x10'),auth['isAuthenticated'](),controller[_0xb7c0('0x18')]);module[_0xb7c0('0x19')]=router; \ No newline at end of file +var _0xe9fb=['/:id/download','download','create','post','addMessage','/:id/tags','tracked','mail','addTags','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','removeTags','exports','express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','/describe','/:id','/:id/messages'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0xe9fb,0xe0));var _0xbe9f=function(_0x2af38a,_0x27524b){_0x2af38a=_0x2af38a-0x0;var _0x54ff30=_0xe9fb[_0x2af38a];return _0x54ff30;};'use strict';var express=require(_0xbe9f('0x0'));var router=express[_0xbe9f('0x1')]();var auth=require(_0xbe9f('0x2'));var interaction=require(_0xbe9f('0x3'));var controller=require(_0xbe9f('0x4'));router[_0xbe9f('0x5')]('/',auth[_0xbe9f('0x6')](),controller['index']);router[_0xbe9f('0x5')](_0xbe9f('0x7'),auth[_0xbe9f('0x6')](),controller['describe']);router[_0xbe9f('0x5')](_0xbe9f('0x8'),auth[_0xbe9f('0x6')](),controller['show']);router[_0xbe9f('0x5')](_0xbe9f('0x9'),auth[_0xbe9f('0x6')](),controller['getMessages']);router[_0xbe9f('0x5')](_0xbe9f('0xa'),auth[_0xbe9f('0x6')](),controller[_0xbe9f('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xbe9f('0xc')]);router[_0xbe9f('0xd')](_0xbe9f('0x9'),auth[_0xbe9f('0x6')](),controller[_0xbe9f('0xe')]);router[_0xbe9f('0xd')](_0xbe9f('0xf'),auth[_0xbe9f('0x6')](),interaction[_0xbe9f('0x10')](_0xbe9f('0x11'),'mailinteraction:addtags'),controller[_0xbe9f('0x12')]);router['put'](_0xbe9f('0x8'),auth[_0xbe9f('0x6')](),interaction[_0xbe9f('0x10')](_0xbe9f('0x11'),_0xbe9f('0x13')),controller[_0xbe9f('0x14')]);router[_0xbe9f('0x15')](_0xbe9f('0x8'),auth['isAuthenticated'](),interaction[_0xbe9f('0x10')](_0xbe9f('0x11'),_0xbe9f('0x16')),controller[_0xbe9f('0x17')]);router[_0xbe9f('0x15')]('/:id/tags',auth[_0xbe9f('0x6')](),controller[_0xbe9f('0x18')]);module[_0xbe9f('0x19')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 4932614..1bb9a10 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 _0x581f=['sequelize','iconv','exports','BOOLEAN','DATE','STRING','TEXT','ENUM','out','INTEGER'];(function(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0x581f,0x1e0));var _0xf581=function(_0x1b092a,_0xa0a68d){_0x1b092a=_0x1b092a-0x0;var _0x3e5a3d=_0x581f[_0x1b092a];return _0x3e5a3d;};'use strict';var Sequelize=require(_0xf581('0x0'));var iconv=require(_0xf581('0x1'));module[_0xf581('0x2')]={'closed':{'type':Sequelize[_0xf581('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xf581('0x4')]},'disposition':{'type':Sequelize[_0xf581('0x5')]},'secondDisposition':{'type':Sequelize[_0xf581('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xf581('0x5')]},'inReplyTo':{'type':Sequelize[_0xf581('0x5')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xf581('0x6')]('long')},'subject':{'type':Sequelize[_0xf581('0x6')]()},'attach':{'type':Sequelize[_0xf581('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xf581('0x4')]},'substatus':{'type':Sequelize[_0xf581('0x5')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xf581('0x7')]('in',_0xf581('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xf581('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xf581('0x7')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xf581('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xf581('0x9')]}}; \ No newline at end of file +var _0x4817=['long','TEXT','BOOLEAN','ENUM','INTEGER','DATE','STRING'];(function(_0x412e27,_0x20a978){var _0x53da42=function(_0x43cae5){while(--_0x43cae5){_0x412e27['push'](_0x412e27['shift']());}};_0x53da42(++_0x20a978);}(_0x4817,0x11d));var _0x7481=function(_0x2100e5,_0x3dda09){_0x2100e5=_0x2100e5-0x0;var _0x55afb9=_0x4817[_0x2100e5];return _0x55afb9;};'use strict';var Sequelize=require('sequelize');var iconv=require('iconv');module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x7481('0x0')]},'disposition':{'type':Sequelize[_0x7481('0x1')]},'secondDisposition':{'type':Sequelize[_0x7481('0x1')]},'thirdDisposition':{'type':Sequelize[_0x7481('0x1')]},'note':{'type':Sequelize[_0x7481('0x1')]},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['TEXT'](_0x7481('0x2'))},'subject':{'type':Sequelize[_0x7481('0x3')]()},'attach':{'type':Sequelize[_0x7481('0x4')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0x7481('0x1')](0x3c)},'substatusAt':{'type':Sequelize[_0x7481('0x0')]},'firstMsgDirection':{'type':Sequelize[_0x7481('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x7481('0x0')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x7481('0x4')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x7481('0x6')]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index c55f0af..1e6b15a 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 _0xc377=['intersection','fields','attributes','length','includeAll','include','merge','options','find','create','body','params','addMessage','MailMessage','omit','ids','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','pick','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','count','inlineCss','rows','addTags','setTags','spread','Tag','color','emit','mailInteractionTags:save','removeTags','download','unix','toString','join','root','files','tmp','format','transcript-%d-%s.zip','attachments','push','Attachment','Attachments','Messages','from','subject','createdAt','get','mkdirSync','each','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','basename','build','writeFileSync','message%d.eml','eml-format','rimraf','zip-dir','bluebird','path','lodash','juice','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../mysqldb','html-entities','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','update','then','destroy','error','stack','name','send','map','MailInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','mail','catch','model','keys','query','filters'];(function(_0x752ec7,_0x41675b){var _0x30e825=function(_0x2db4a9){while(--_0x2db4a9){_0x752ec7['push'](_0x752ec7['shift']());}};_0x30e825(++_0x41675b);}(_0xc377,0x1a6));var _0x7c37=function(_0x35ff01,_0x36699a){_0x35ff01=_0x35ff01-0x0;var _0x105c89=_0xc377[_0x35ff01];return _0x105c89;};'use strict';var emlformat=require(_0x7c37('0x0'));var rimraf=require(_0x7c37('0x1'));var zipdir=require(_0x7c37('0x2'));var moment=require('moment');var BPromise=require(_0x7c37('0x3'));var util=require('util');var path=require(_0x7c37('0x4'));var fs=require('fs');var _=require(_0x7c37('0x5'));var juice=require(_0x7c37('0x6'));var Redis=require(_0x7c37('0x7'));var interaction=require(_0x7c37('0x8'));var qs=require(_0x7c37('0x9'));var logger=require(_0x7c37('0xa'))(_0x7c37('0xb'));var config=require('../../config/environment');var db=require(_0x7c37('0xc'))['db'];var htmlEntities=require(_0x7c37('0xd'));config[_0x7c37('0xe')]=_[_0x7c37('0xf')](config[_0x7c37('0xe')],{'host':_0x7c37('0x10'),'port':0x18eb});var socket=require(_0x7c37('0x11'))(new Redis(config[_0x7c37('0xe')]));require(_0x7c37('0x12'))[_0x7c37('0x13')](socket);function respondWithStatusCode(_0x552126,_0x107a2c){_0x107a2c=_0x107a2c||0xcc;return function(_0x58acae){if(_0x58acae){return _0x552126[_0x7c37('0x14')](_0x107a2c);}return _0x552126[_0x7c37('0x15')](_0x107a2c)[_0x7c37('0x16')]();};}function respondWithResult(_0x4c79a7,_0x183534){_0x183534=_0x183534||0xc8;return function(_0x57cb92){if(_0x57cb92){return _0x4c79a7[_0x7c37('0x15')](_0x183534)[_0x7c37('0x17')](_0x57cb92);}};}function respondWithFilteredResult(_0x1c61c5,_0x4f5140){return function(_0x12bc78){if(_0x12bc78){var _0xb5e77b=typeof _0x4f5140[_0x7c37('0x18')]===_0x7c37('0x19')&&typeof _0x4f5140[_0x7c37('0x1a')]===_0x7c37('0x19');var _0x495c87=_0x12bc78['count'];var _0x16d1db=_0xb5e77b?0x0:_0x4f5140[_0x7c37('0x18')];var _0x112dcd=_0xb5e77b?_0x12bc78['count']:_0x4f5140[_0x7c37('0x18')]+_0x4f5140[_0x7c37('0x1a')];var _0x489b8;if(_0x112dcd>=_0x495c87){_0x112dcd=_0x495c87;_0x489b8=0xc8;}else{_0x489b8=0xce;}_0x1c61c5[_0x7c37('0x15')](_0x489b8);return _0x1c61c5[_0x7c37('0x1b')](_0x7c37('0x1c'),_0x16d1db+'-'+_0x112dcd+'/'+_0x495c87)[_0x7c37('0x17')](_0x12bc78);}return null;};}function saveUpdates(_0x36e5d0){return function(_0x13bac1){if(_0x13bac1){return _0x13bac1[_0x7c37('0x1d')](_0x36e5d0)[_0x7c37('0x1e')](function(_0xfd8cf0){return _0xfd8cf0;});}return null;};}function removeEntity(_0x1328fc){return function(_0x3e7223){if(_0x3e7223){return _0x3e7223[_0x7c37('0x1f')]()[_0x7c37('0x1e')](function(){_0x1328fc[_0x7c37('0x15')](0xcc)[_0x7c37('0x16')]();});}};}function handleEntityNotFound(_0x4e89e8){return function(_0x214715){if(!_0x214715){_0x4e89e8[_0x7c37('0x14')](0x194);}return _0x214715;};}function handleError(_0x586073,_0x338189){_0x338189=_0x338189||0x1f4;return function(_0x16a4b5){logger[_0x7c37('0x20')](_0x16a4b5[_0x7c37('0x21')]);if(_0x16a4b5['name']){delete _0x16a4b5[_0x7c37('0x22')];}_0x586073[_0x7c37('0x15')](_0x338189)[_0x7c37('0x23')](_0x16a4b5);};}exports['index']=function(_0x1ac3b8,_0x41fcfe){var _0x1ccf06={};var _0xf8ca21=_[_0x7c37('0x24')](db[_0x7c37('0x25')][_0x7c37('0x26')],function(_0x1639ec){return{'name':_0x1639ec[_0x7c37('0x27')],'type':_0x1639ec[_0x7c37('0x28')][_0x7c37('0x29')]};});_0x1ccf06=qs[_0x7c37('0x2a')](_0xf8ca21,_0x1ac3b8);return interaction[_0x7c37('0x2b')](_0x7c37('0x2c'),_0x1ac3b8['query'],_0x1ac3b8['user'],_0x1ccf06,_0xf8ca21)[_0x7c37('0x1e')](respondWithFilteredResult(_0x41fcfe,_0x1ccf06))[_0x7c37('0x2d')](handleError(_0x41fcfe,null));};exports['show']=function(_0x4985c2,_0x36521e){var _0x18a2fa={'raw':![],'where':{'id':_0x4985c2['params']['id']}},_0xdb31b3={};_0xdb31b3[_0x7c37('0x2e')]=_[_0x7c37('0x2f')](db[_0x7c37('0x25')][_0x7c37('0x26')]);_0xdb31b3[_0x7c37('0x30')]=_[_0x7c37('0x2f')](_0x4985c2[_0x7c37('0x30')]);_0xdb31b3[_0x7c37('0x31')]=_[_0x7c37('0x32')](_0xdb31b3['model'],_0xdb31b3[_0x7c37('0x30')]);_0x18a2fa['attributes']=_[_0x7c37('0x32')](_0xdb31b3['model'],qs['fields'](_0x4985c2[_0x7c37('0x30')][_0x7c37('0x33')]));_0x18a2fa[_0x7c37('0x34')]=_0x18a2fa[_0x7c37('0x34')][_0x7c37('0x35')]?_0x18a2fa['attributes']:_0xdb31b3[_0x7c37('0x2e')];if(_0x4985c2['query'][_0x7c37('0x36')]){_0x18a2fa[_0x7c37('0x37')]=[{'all':!![]}];}_0x18a2fa=_[_0x7c37('0x38')]({},_0x18a2fa,_0x4985c2[_0x7c37('0x39')]);return db['MailInteraction'][_0x7c37('0x3a')](_0x18a2fa)['then'](handleEntityNotFound(_0x36521e,null))['then'](respondWithResult(_0x36521e,null))[_0x7c37('0x2d')](handleError(_0x36521e,null));};exports['create']=function(_0x249c0b,_0x536f1d){return db['MailInteraction'][_0x7c37('0x3b')](_0x249c0b[_0x7c37('0x3c')],{})['then'](respondWithResult(_0x536f1d,0xc9))[_0x7c37('0x2d')](handleError(_0x536f1d,null));};exports[_0x7c37('0x1d')]=function(_0xd67e7d,_0x297c7e){if(_0xd67e7d[_0x7c37('0x3c')]['id']){delete _0xd67e7d[_0x7c37('0x3c')]['id'];}return db[_0x7c37('0x25')][_0x7c37('0x3a')]({'where':{'id':_0xd67e7d[_0x7c37('0x3d')]['id']}})[_0x7c37('0x1e')](handleEntityNotFound(_0x297c7e,null))[_0x7c37('0x1e')](saveUpdates(_0xd67e7d[_0x7c37('0x3c')],null))[_0x7c37('0x1e')](respondWithResult(_0x297c7e,null))[_0x7c37('0x2d')](handleError(_0x297c7e,null));};exports['destroy']=function(_0x30ea2b,_0x58ad88){return db['MailInteraction'][_0x7c37('0x3a')]({'where':{'id':_0x30ea2b['params']['id']}})['then'](handleEntityNotFound(_0x58ad88,null))[_0x7c37('0x1e')](removeEntity(_0x58ad88,null))[_0x7c37('0x2d')](handleError(_0x58ad88,null));};exports['describe']=function(_0x3baaa2,_0xcfa30e){return db[_0x7c37('0x25')]['describe']()[_0x7c37('0x1e')](respondWithResult(_0xcfa30e,null))[_0x7c37('0x2d')](handleError(_0xcfa30e,null));};exports[_0x7c37('0x3e')]=function(_0x356b72,_0x23e26b){return db[_0x7c37('0x3f')][_0x7c37('0x3a')]({'where':{'id':_0x356b72[_0x7c37('0x3d')]['id']}})['then'](handleEntityNotFound(_0x23e26b,null))[_0x7c37('0x1e')](function(_0xbc5902){if(_0xbc5902){return _0xbc5902[_0x7c37('0x3e')](_0x356b72[_0x7c37('0x3c')]['ids'],_[_0x7c37('0x40')](_0x356b72[_0x7c37('0x3c')],[_0x7c37('0x41'),'id'])||{});}})[_0x7c37('0x1e')](respondWithResult(_0x23e26b,null))['catch'](handleError(_0x23e26b,null));};exports[_0x7c37('0x42')]=function(_0x12407e,_0x15f9e3){var _0x355984={'raw':![],'where':{}};var _0x3254cd={};var _0x52c919={'count':0x0,'rows':[]};return db[_0x7c37('0x25')][_0x7c37('0x43')]({'where':{'id':_0x12407e[_0x7c37('0x3d')]['id']}})['then'](handleEntityNotFound(_0x15f9e3,null))[_0x7c37('0x1e')](function(_0x1f8666){if(_0x1f8666){_0x3254cd['model']=_['keys'](db[_0x7c37('0x3f')]['rawAttributes']);_0x3254cd[_0x7c37('0x30')]=_[_0x7c37('0x2f')](_0x12407e[_0x7c37('0x30')]);_0x3254cd['filters']=_['intersection'](_0x3254cd['model'],_0x3254cd['query']);_0x355984['attributes']=_[_0x7c37('0x32')](_0x3254cd[_0x7c37('0x2e')],qs[_0x7c37('0x33')](_0x12407e[_0x7c37('0x30')][_0x7c37('0x33')]));_0x355984[_0x7c37('0x34')]=_0x355984[_0x7c37('0x34')][_0x7c37('0x35')]?_0x355984['attributes']:_0x3254cd[_0x7c37('0x2e')];if(!_0x12407e[_0x7c37('0x30')][_0x7c37('0x44')](_0x7c37('0x45'))){_0x355984[_0x7c37('0x1a')]=qs[_0x7c37('0x1a')](_0x12407e[_0x7c37('0x30')]['limit']);_0x355984['offset']=qs['offset'](_0x12407e[_0x7c37('0x30')][_0x7c37('0x18')]);}_0x355984[_0x7c37('0x46')]=qs[_0x7c37('0x47')](_0x12407e[_0x7c37('0x30')][_0x7c37('0x47')]);_0x355984[_0x7c37('0x48')]=qs[_0x7c37('0x31')](_[_0x7c37('0x49')](_0x12407e[_0x7c37('0x30')],_0x3254cd[_0x7c37('0x31')]));_0x355984[_0x7c37('0x48')]['MailInteractionId']=_0x1f8666['id'];if(_0x12407e[_0x7c37('0x30')][_0x7c37('0x4a')]){_0x355984[_0x7c37('0x48')]=_[_0x7c37('0x38')](_0x355984[_0x7c37('0x48')],{'$or':_[_0x7c37('0x24')](_0x355984['attributes'],function(_0x4ec866){var _0x4639ea={};_0x4639ea[_0x4ec866]={'$like':'%'+_0x12407e[_0x7c37('0x30')]['filter']+'%'};return _0x4639ea;})});}if(_0x12407e[_0x7c37('0x30')]['$gte']){var _0x473d45=_0x12407e[_0x7c37('0x30')][_0x7c37('0x4b')][_0x7c37('0x4c')](',');var _0x18ce8e={};_0x18ce8e[_0x473d45[0x0]]={'$gte':moment(_0x473d45[0x1])['format'](_0x7c37('0x4d'))};_0x355984[_0x7c37('0x48')]=_['merge'](_0x355984[_0x7c37('0x48')],_0x18ce8e);}_0x355984=_[_0x7c37('0x38')]({},_0x355984,_0x12407e['options']);return db[_0x7c37('0x3f')][_0x7c37('0x4e')]({'where':_0x355984[_0x7c37('0x48')]})[_0x7c37('0x1e')](function(_0x595249){_0x52c919[_0x7c37('0x4e')]=_0x595249;if(_0x12407e['query']['includeAll']){_0x355984[_0x7c37('0x37')]=[{'all':!![]}];}return db['MailMessage'][_0x7c37('0x2b')](_0x355984);})[_0x7c37('0x1e')](function(_0x5e5ab2){if(_0x12407e[_0x7c37('0x30')][_0x7c37('0x4f')]==='true'){for(var _0x376fc7=0x0;_0x376fc7<_0x5e5ab2[_0x7c37('0x35')];_0x376fc7++){_0x5e5ab2[_0x376fc7][_0x7c37('0x3c')]=juice(_0x5e5ab2[_0x376fc7][_0x7c37('0x3c')]);}}_0x52c919[_0x7c37('0x50')]=_0x5e5ab2;return _0x52c919;});}})[_0x7c37('0x1e')](respondWithFilteredResult(_0x15f9e3,_0x355984))[_0x7c37('0x2d')](handleError(_0x15f9e3,null));};exports[_0x7c37('0x51')]=function(_0x11e974,_0x309891){return db[_0x7c37('0x25')][_0x7c37('0x3a')]({'where':{'id':_0x11e974[_0x7c37('0x3d')]['id']}})[_0x7c37('0x1e')](handleEntityNotFound(_0x309891,null))[_0x7c37('0x1e')](function(_0x15ab56){if(_0x15ab56){return _0x15ab56[_0x7c37('0x52')](_0x11e974[_0x7c37('0x3c')][_0x7c37('0x41')],_[_0x7c37('0x40')](_0x11e974[_0x7c37('0x3c')],['ids','id'])||{})[_0x7c37('0x53')](function(){return db[_0x7c37('0x54')][_0x7c37('0x2b')]({'attributes':['id',_0x7c37('0x22'),_0x7c37('0x55')],'where':{'id':_0x11e974[_0x7c37('0x3c')]['ids']}});})['then'](function(_0x4855e){socket[_0x7c37('0x56')](_0x7c37('0x57'),{'id':Number(_0x11e974[_0x7c37('0x3d')]['id']),'tags':_0x4855e||[]});return{'id':Number(_0x11e974[_0x7c37('0x3d')]['id']),'tags':_0x4855e||[]};});}})[_0x7c37('0x1e')](respondWithResult(_0x309891,null))[_0x7c37('0x2d')](handleError(_0x309891,null));};exports[_0x7c37('0x58')]=function(_0xf5bd6f,_0x3338cf){return db[_0x7c37('0x25')]['find']({'where':{'id':_0xf5bd6f[_0x7c37('0x3d')]['id']}})['then'](handleEntityNotFound(_0x3338cf,null))[_0x7c37('0x1e')](function(_0x4ca1f8){if(_0x4ca1f8){return _0x4ca1f8[_0x7c37('0x58')](_0xf5bd6f[_0x7c37('0x30')][_0x7c37('0x41')]);}})['then'](respondWithStatusCode(_0x3338cf,null))[_0x7c37('0x2d')](handleError(_0x3338cf,null));};exports[_0x7c37('0x59')]=function(_0x10fb7e,_0x1c0d66){var _0x3b593c=moment()[_0x7c37('0x5a')]()[_0x7c37('0x5b')]();var _0x8b80b9=path[_0x7c37('0x5c')](config[_0x7c37('0x5d')],'server',_0x7c37('0x5e'),_0x7c37('0x5f'));var _0x8ec1d4=path[_0x7c37('0x5c')](config[_0x7c37('0x5d')],'server','files','attachments');var _0x4a0706=path[_0x7c37('0x5c')](_0x8b80b9,_0x3b593c);var _0x468dab=util[_0x7c37('0x60')](_0x7c37('0x61'),_0x10fb7e['params']['id'],_0x3b593c);var _0x584b0b=path[_0x7c37('0x5c')](_0x8b80b9,_0x468dab);var _0x3d727f=[];if(_0x10fb7e['query'][_0x7c37('0x62')]){_0x3d727f[_0x7c37('0x63')]({'model':db[_0x7c37('0x64')],'as':_0x7c37('0x65'),'raw':!![]});}var _0x1dd7d8=[{'model':db['MailMessage'],'as':_0x7c37('0x66'),'attributes':['id','body',_0x7c37('0x67'),'to','cc','bcc',_0x7c37('0x68'),_0x7c37('0x69')],'where':{'secret':![]},'order':qs[_0x7c37('0x47')]('id'),'include':_0x3d727f}];return db['MailInteraction'][_0x7c37('0x3a')]({'where':{'id':_0x10fb7e[_0x7c37('0x3d')]['id']},'include':_0x1dd7d8})['then'](handleEntityNotFound(_0x1c0d66,null))['then'](function(_0x46e0a1){if(_0x46e0a1&&_0x46e0a1[_0x7c37('0x66')]){var _0x1c9bcb=_0x46e0a1[_0x7c37('0x6a')]({'plain':!![]});fs[_0x7c37('0x6b')](_0x4a0706);return BPromise[_0x7c37('0x6c')](_0x1c9bcb[_0x7c37('0x66')],function(_0x137d4d,_0x369688){var _0x43ca7a={'from':_0x137d4d[_0x7c37('0x67')],'to':_0x137d4d['to']||'missing.recipient@your.company.com','subject':_0x137d4d[_0x7c37('0x68')],'html':htmlEntities[_0x7c37('0x6d')](_0x137d4d[_0x7c37('0x3c')]),'headers':{'Date':moment(_0x137d4d[_0x7c37('0x69')])['format'](_0x7c37('0x6e'))},'attachments':[]};if(_0x137d4d['cc']){_0x43ca7a[_0x7c37('0x6f')]['Cc']=_0x137d4d['cc'];}if(_0x137d4d[_0x7c37('0x70')]){_0x43ca7a[_0x7c37('0x6f')][_0x7c37('0x71')]=_0x137d4d[_0x7c37('0x70')];}return new BPromise(function(_0x91717c,_0xe0f1ed){if(_0x137d4d[_0x7c37('0x65')]){for(var _0x2fc30b=0x0;_0x2fc30b<_0x137d4d['Attachments']['length'];_0x2fc30b++){var _0x82eab0=_0x137d4d[_0x7c37('0x65')][_0x2fc30b];var _0x2e3178=path[_0x7c37('0x5c')](_0x8ec1d4,_0x82eab0[_0x7c37('0x72')]);if(fs['existsSync'](_0x2e3178)){_0x43ca7a[_0x7c37('0x62')][_0x7c37('0x63')]({'name':_0x82eab0[_0x7c37('0x22')],'contentType':_0x82eab0[_0x7c37('0x28')],'data':fs['readFileSync'](_0x2e3178)});}}}emlformat[_0x7c37('0x73')](_0x43ca7a,function(_0x3584c0,_0x1bcf03){if(_0x3584c0)return _0xe0f1ed(_0x3584c0);fs[_0x7c37('0x74')](path[_0x7c37('0x5c')](_0x4a0706,util[_0x7c37('0x60')](_0x7c37('0x75'),_0x369688)),_0x1bcf03);return _0x91717c(_0x1bcf03);});});})[_0x7c37('0x1e')](function(){return new BPromise(function(_0x207410,_0x1908d8){zipdir(_0x4a0706,{'saveTo':_0x584b0b},function(_0xdf8bdc,_0x52f4ce){if(_0xdf8bdc)return _0x1908d8(_0xdf8bdc);return _0x207410(_0x52f4ce);});})['then'](function(){return new BPromise(function(_0x1ece52,_0x2d071f){rimraf(_0x4a0706,function(_0x5608d9){if(_0x5608d9)_0x2d071f(_0x5608d9);return _0x1ece52();});});})[_0x7c37('0x1e')](function(){return _0x1c0d66[_0x7c37('0x59')](_0x584b0b,_0x468dab,function(_0x2ac239){if(!_0x2ac239)fs['unlinkSync'](_0x584b0b);});});});}else{return _0x1c0d66[_0x7c37('0x14')](0xc8);}})[_0x7c37('0x2d')](handleError(_0x1c0d66,null));}; \ No newline at end of file +var _0xa9c1=['pick','where','MailInteractionId','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','merge','findAll','inlineCss','true','rows','addTags','setTags','spread','emit','mailInteractionTags:save','removeTags','download','unix','toString','join','root','files','tmp','server','attachments','transcript-%d-%s.zip','push','Attachment','Messages','bcc','subject','get','mkdirSync','from','decode','headers','Bcc','Attachments','basename','existsSync','readFileSync','build','writeFileSync','message%d.eml','unlinkSync','eml-format','zip-dir','moment','util','path','lodash','juice','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','html-entities','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','status','end','offset','limit','undefined','count','set','Content-Range','update','then','destroy','sendStatus','error','stack','name','send','index','map','MailInteraction','rawAttributes','fieldName','type','key','mail','query','user','catch','show','params','model','keys','attributes','intersection','fields','includeAll','include','options','find','create','body','describe','addMessage','MailMessage','ids','omit','getMessages','findOne','filters','length','hasOwnProperty','nolimit','sort'];(function(_0x383126,_0x2c3d21){var _0x36d006=function(_0x389931){while(--_0x389931){_0x383126['push'](_0x383126['shift']());}};_0x36d006(++_0x2c3d21);}(_0xa9c1,0x11d));var _0x1a9c=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9c1[_0x32d457];return _0x338386;};'use strict';var emlformat=require(_0x1a9c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1a9c('0x1'));var moment=require(_0x1a9c('0x2'));var BPromise=require('bluebird');var util=require(_0x1a9c('0x3'));var path=require(_0x1a9c('0x4'));var fs=require('fs');var _=require(_0x1a9c('0x5'));var juice=require(_0x1a9c('0x6'));var Redis=require(_0x1a9c('0x7'));var interaction=require(_0x1a9c('0x8'));var qs=require(_0x1a9c('0x9'));var logger=require('../../config/logger')(_0x1a9c('0xa'));var config=require(_0x1a9c('0xb'));var db=require(_0x1a9c('0xc'))['db'];var htmlEntities=require(_0x1a9c('0xd'));config[_0x1a9c('0xe')]=_[_0x1a9c('0xf')](config['redis'],{'host':_0x1a9c('0x10'),'port':0x18eb});var socket=require(_0x1a9c('0x11'))(new Redis(config[_0x1a9c('0xe')]));require(_0x1a9c('0x12'))[_0x1a9c('0x13')](socket);function respondWithStatusCode(_0x38bb40,_0x41dab7){_0x41dab7=_0x41dab7||0xcc;return function(_0x492e13){if(_0x492e13){return _0x38bb40['sendStatus'](_0x41dab7);}return _0x38bb40[_0x1a9c('0x14')](_0x41dab7)[_0x1a9c('0x15')]();};}function respondWithResult(_0x682255,_0x59f2af){_0x59f2af=_0x59f2af||0xc8;return function(_0x47bf47){if(_0x47bf47){return _0x682255[_0x1a9c('0x14')](_0x59f2af)['json'](_0x47bf47);}};}function respondWithFilteredResult(_0x44b3e5,_0x61ef4a){return function(_0x43d880){if(_0x43d880){var _0x37905a=typeof _0x61ef4a[_0x1a9c('0x16')]==='undefined'&&typeof _0x61ef4a[_0x1a9c('0x17')]===_0x1a9c('0x18');var _0x19f884=_0x43d880[_0x1a9c('0x19')];var _0x688636=_0x37905a?0x0:_0x61ef4a[_0x1a9c('0x16')];var _0x193752=_0x37905a?_0x43d880[_0x1a9c('0x19')]:_0x61ef4a[_0x1a9c('0x16')]+_0x61ef4a['limit'];var _0xc92c2;if(_0x193752>=_0x19f884){_0x193752=_0x19f884;_0xc92c2=0xc8;}else{_0xc92c2=0xce;}_0x44b3e5['status'](_0xc92c2);return _0x44b3e5[_0x1a9c('0x1a')](_0x1a9c('0x1b'),_0x688636+'-'+_0x193752+'/'+_0x19f884)['json'](_0x43d880);}return null;};}function saveUpdates(_0x56c11f){return function(_0xe6f615){if(_0xe6f615){return _0xe6f615[_0x1a9c('0x1c')](_0x56c11f)[_0x1a9c('0x1d')](function(_0x7c4f94){return _0x7c4f94;});}return null;};}function removeEntity(_0x39a497){return function(_0x38f117){if(_0x38f117){return _0x38f117[_0x1a9c('0x1e')]()[_0x1a9c('0x1d')](function(){_0x39a497['status'](0xcc)[_0x1a9c('0x15')]();});}};}function handleEntityNotFound(_0x10055c){return function(_0x204720){if(!_0x204720){_0x10055c[_0x1a9c('0x1f')](0x194);}return _0x204720;};}function handleError(_0x168031,_0x44284c){_0x44284c=_0x44284c||0x1f4;return function(_0x247286){logger[_0x1a9c('0x20')](_0x247286[_0x1a9c('0x21')]);if(_0x247286[_0x1a9c('0x22')]){delete _0x247286[_0x1a9c('0x22')];}_0x168031[_0x1a9c('0x14')](_0x44284c)[_0x1a9c('0x23')](_0x247286);};}exports[_0x1a9c('0x24')]=function(_0x12c1d7,_0x220d5a){var _0x248236={};var _0x56dc65=_[_0x1a9c('0x25')](db[_0x1a9c('0x26')][_0x1a9c('0x27')],function(_0x541487){return{'name':_0x541487[_0x1a9c('0x28')],'type':_0x541487[_0x1a9c('0x29')][_0x1a9c('0x2a')]};});_0x248236=qs['getOptions'](_0x56dc65,_0x12c1d7);return interaction['findAll'](_0x1a9c('0x2b'),_0x12c1d7[_0x1a9c('0x2c')],_0x12c1d7[_0x1a9c('0x2d')],_0x248236,_0x56dc65)[_0x1a9c('0x1d')](respondWithFilteredResult(_0x220d5a,_0x248236))[_0x1a9c('0x2e')](handleError(_0x220d5a,null));};exports[_0x1a9c('0x2f')]=function(_0x989bad,_0x29807b){var _0x556b93={'raw':![],'where':{'id':_0x989bad[_0x1a9c('0x30')]['id']}},_0x162cde={};_0x162cde[_0x1a9c('0x31')]=_[_0x1a9c('0x32')](db[_0x1a9c('0x26')][_0x1a9c('0x27')]);_0x162cde[_0x1a9c('0x2c')]=_[_0x1a9c('0x32')](_0x989bad[_0x1a9c('0x2c')]);_0x162cde['filters']=_['intersection'](_0x162cde[_0x1a9c('0x31')],_0x162cde['query']);_0x556b93[_0x1a9c('0x33')]=_[_0x1a9c('0x34')](_0x162cde[_0x1a9c('0x31')],qs['fields'](_0x989bad[_0x1a9c('0x2c')][_0x1a9c('0x35')]));_0x556b93['attributes']=_0x556b93[_0x1a9c('0x33')]['length']?_0x556b93[_0x1a9c('0x33')]:_0x162cde[_0x1a9c('0x31')];if(_0x989bad['query'][_0x1a9c('0x36')]){_0x556b93[_0x1a9c('0x37')]=[{'all':!![]}];}_0x556b93=_['merge']({},_0x556b93,_0x989bad[_0x1a9c('0x38')]);return db[_0x1a9c('0x26')][_0x1a9c('0x39')](_0x556b93)[_0x1a9c('0x1d')](handleEntityNotFound(_0x29807b,null))[_0x1a9c('0x1d')](respondWithResult(_0x29807b,null))[_0x1a9c('0x2e')](handleError(_0x29807b,null));};exports[_0x1a9c('0x3a')]=function(_0x404041,_0x529633){return db[_0x1a9c('0x26')]['create'](_0x404041['body'],{})['then'](respondWithResult(_0x529633,0xc9))[_0x1a9c('0x2e')](handleError(_0x529633,null));};exports[_0x1a9c('0x1c')]=function(_0x46cbc8,_0x4bdf52){if(_0x46cbc8[_0x1a9c('0x3b')]['id']){delete _0x46cbc8[_0x1a9c('0x3b')]['id'];}return db['MailInteraction'][_0x1a9c('0x39')]({'where':{'id':_0x46cbc8['params']['id']}})['then'](handleEntityNotFound(_0x4bdf52,null))[_0x1a9c('0x1d')](saveUpdates(_0x46cbc8['body'],null))[_0x1a9c('0x1d')](respondWithResult(_0x4bdf52,null))['catch'](handleError(_0x4bdf52,null));};exports[_0x1a9c('0x1e')]=function(_0x2da011,_0x2af781){return db[_0x1a9c('0x26')]['find']({'where':{'id':_0x2da011[_0x1a9c('0x30')]['id']}})[_0x1a9c('0x1d')](handleEntityNotFound(_0x2af781,null))[_0x1a9c('0x1d')](removeEntity(_0x2af781,null))[_0x1a9c('0x2e')](handleError(_0x2af781,null));};exports[_0x1a9c('0x3c')]=function(_0x14712e,_0x4cdf56){return db['MailInteraction']['describe']()[_0x1a9c('0x1d')](respondWithResult(_0x4cdf56,null))[_0x1a9c('0x2e')](handleError(_0x4cdf56,null));};exports[_0x1a9c('0x3d')]=function(_0x292dda,_0x3078d5){return db[_0x1a9c('0x3e')][_0x1a9c('0x39')]({'where':{'id':_0x292dda[_0x1a9c('0x30')]['id']}})['then'](handleEntityNotFound(_0x3078d5,null))[_0x1a9c('0x1d')](function(_0x1e9d0d){if(_0x1e9d0d){return _0x1e9d0d[_0x1a9c('0x3d')](_0x292dda[_0x1a9c('0x3b')][_0x1a9c('0x3f')],_[_0x1a9c('0x40')](_0x292dda[_0x1a9c('0x3b')],[_0x1a9c('0x3f'),'id'])||{});}})['then'](respondWithResult(_0x3078d5,null))['catch'](handleError(_0x3078d5,null));};exports[_0x1a9c('0x41')]=function(_0x44d740,_0x2e71a2){var _0x1cc6eb={'raw':![],'where':{}};var _0x39fba5={};var _0x35d6fc={'count':0x0,'rows':[]};return db[_0x1a9c('0x26')][_0x1a9c('0x42')]({'where':{'id':_0x44d740[_0x1a9c('0x30')]['id']}})['then'](handleEntityNotFound(_0x2e71a2,null))['then'](function(_0x2d3c5c){if(_0x2d3c5c){_0x39fba5[_0x1a9c('0x31')]=_['keys'](db[_0x1a9c('0x3e')][_0x1a9c('0x27')]);_0x39fba5[_0x1a9c('0x2c')]=_[_0x1a9c('0x32')](_0x44d740[_0x1a9c('0x2c')]);_0x39fba5[_0x1a9c('0x43')]=_[_0x1a9c('0x34')](_0x39fba5['model'],_0x39fba5[_0x1a9c('0x2c')]);_0x1cc6eb[_0x1a9c('0x33')]=_[_0x1a9c('0x34')](_0x39fba5[_0x1a9c('0x31')],qs[_0x1a9c('0x35')](_0x44d740['query'][_0x1a9c('0x35')]));_0x1cc6eb['attributes']=_0x1cc6eb[_0x1a9c('0x33')][_0x1a9c('0x44')]?_0x1cc6eb['attributes']:_0x39fba5[_0x1a9c('0x31')];if(!_0x44d740[_0x1a9c('0x2c')][_0x1a9c('0x45')](_0x1a9c('0x46'))){_0x1cc6eb['limit']=qs['limit'](_0x44d740[_0x1a9c('0x2c')][_0x1a9c('0x17')]);_0x1cc6eb[_0x1a9c('0x16')]=qs[_0x1a9c('0x16')](_0x44d740[_0x1a9c('0x2c')][_0x1a9c('0x16')]);}_0x1cc6eb['order']=qs[_0x1a9c('0x47')](_0x44d740[_0x1a9c('0x2c')][_0x1a9c('0x47')]);_0x1cc6eb['where']=qs[_0x1a9c('0x43')](_[_0x1a9c('0x48')](_0x44d740[_0x1a9c('0x2c')],_0x39fba5[_0x1a9c('0x43')]));_0x1cc6eb[_0x1a9c('0x49')][_0x1a9c('0x4a')]=_0x2d3c5c['id'];if(_0x44d740[_0x1a9c('0x2c')][_0x1a9c('0x4b')]){_0x1cc6eb[_0x1a9c('0x49')]=_['merge'](_0x1cc6eb[_0x1a9c('0x49')],{'$or':_[_0x1a9c('0x25')](_0x1cc6eb[_0x1a9c('0x33')],function(_0x7264b0){var _0x32e4af={};_0x32e4af[_0x7264b0]={'$like':'%'+_0x44d740[_0x1a9c('0x2c')][_0x1a9c('0x4b')]+'%'};return _0x32e4af;})});}if(_0x44d740['query'][_0x1a9c('0x4c')]){var _0x3ac375=_0x44d740[_0x1a9c('0x2c')][_0x1a9c('0x4c')]['split'](',');var _0x391fd3={};_0x391fd3[_0x3ac375[0x0]]={'$gte':moment(_0x3ac375[0x1])[_0x1a9c('0x4d')](_0x1a9c('0x4e'))};_0x1cc6eb[_0x1a9c('0x49')]=_[_0x1a9c('0x4f')](_0x1cc6eb[_0x1a9c('0x49')],_0x391fd3);}_0x1cc6eb=_[_0x1a9c('0x4f')]({},_0x1cc6eb,_0x44d740[_0x1a9c('0x38')]);return db['MailMessage'][_0x1a9c('0x19')]({'where':_0x1cc6eb['where']})[_0x1a9c('0x1d')](function(_0x4441ae){_0x35d6fc[_0x1a9c('0x19')]=_0x4441ae;if(_0x44d740['query'][_0x1a9c('0x36')]){_0x1cc6eb[_0x1a9c('0x37')]=[{'all':!![]}];}return db['MailMessage'][_0x1a9c('0x50')](_0x1cc6eb);})['then'](function(_0x305e2e){if(_0x44d740[_0x1a9c('0x2c')][_0x1a9c('0x51')]===_0x1a9c('0x52')){for(var _0x4620b2=0x0;_0x4620b2<_0x305e2e[_0x1a9c('0x44')];_0x4620b2++){_0x305e2e[_0x4620b2][_0x1a9c('0x3b')]=juice(_0x305e2e[_0x4620b2][_0x1a9c('0x3b')]);}}_0x35d6fc[_0x1a9c('0x53')]=_0x305e2e;return _0x35d6fc;});}})[_0x1a9c('0x1d')](respondWithFilteredResult(_0x2e71a2,_0x1cc6eb))[_0x1a9c('0x2e')](handleError(_0x2e71a2,null));};exports[_0x1a9c('0x54')]=function(_0x4626eb,_0x49656d){return db[_0x1a9c('0x26')][_0x1a9c('0x39')]({'where':{'id':_0x4626eb['params']['id']}})[_0x1a9c('0x1d')](handleEntityNotFound(_0x49656d,null))[_0x1a9c('0x1d')](function(_0x5c9e04){if(_0x5c9e04){return _0x5c9e04[_0x1a9c('0x55')](_0x4626eb[_0x1a9c('0x3b')][_0x1a9c('0x3f')],_[_0x1a9c('0x40')](_0x4626eb['body'],['ids','id'])||{})[_0x1a9c('0x56')](function(){return db['Tag']['findAll']({'attributes':['id','name','color'],'where':{'id':_0x4626eb[_0x1a9c('0x3b')][_0x1a9c('0x3f')]}});})[_0x1a9c('0x1d')](function(_0x318476){socket[_0x1a9c('0x57')](_0x1a9c('0x58'),{'id':Number(_0x4626eb['params']['id']),'tags':_0x318476||[]});return{'id':Number(_0x4626eb['params']['id']),'tags':_0x318476||[]};});}})[_0x1a9c('0x1d')](respondWithResult(_0x49656d,null))[_0x1a9c('0x2e')](handleError(_0x49656d,null));};exports[_0x1a9c('0x59')]=function(_0x52f2c5,_0x575e55){return db['MailInteraction']['find']({'where':{'id':_0x52f2c5[_0x1a9c('0x30')]['id']}})[_0x1a9c('0x1d')](handleEntityNotFound(_0x575e55,null))['then'](function(_0x2ecf6d){if(_0x2ecf6d){return _0x2ecf6d[_0x1a9c('0x59')](_0x52f2c5[_0x1a9c('0x2c')][_0x1a9c('0x3f')]);}})[_0x1a9c('0x1d')](respondWithStatusCode(_0x575e55,null))[_0x1a9c('0x2e')](handleError(_0x575e55,null));};exports[_0x1a9c('0x5a')]=function(_0x734329,_0x4c4128){var _0x3498f4=moment()[_0x1a9c('0x5b')]()[_0x1a9c('0x5c')]();var _0x459590=path[_0x1a9c('0x5d')](config[_0x1a9c('0x5e')],'server',_0x1a9c('0x5f'),_0x1a9c('0x60'));var _0x2f9dfe=path[_0x1a9c('0x5d')](config[_0x1a9c('0x5e')],_0x1a9c('0x61'),_0x1a9c('0x5f'),_0x1a9c('0x62'));var _0x30f846=path[_0x1a9c('0x5d')](_0x459590,_0x3498f4);var _0x1c15c5=util[_0x1a9c('0x4d')](_0x1a9c('0x63'),_0x734329[_0x1a9c('0x30')]['id'],_0x3498f4);var _0x5c01a5=path[_0x1a9c('0x5d')](_0x459590,_0x1c15c5);var _0x464aac=[];if(_0x734329['query'][_0x1a9c('0x62')]){_0x464aac[_0x1a9c('0x64')]({'model':db[_0x1a9c('0x65')],'as':'Attachments','raw':!![]});}var _0x1a3006=[{'model':db[_0x1a9c('0x3e')],'as':_0x1a9c('0x66'),'attributes':['id',_0x1a9c('0x3b'),'from','to','cc',_0x1a9c('0x67'),_0x1a9c('0x68'),'createdAt'],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x464aac}];return db[_0x1a9c('0x26')][_0x1a9c('0x39')]({'where':{'id':_0x734329[_0x1a9c('0x30')]['id']},'include':_0x1a3006})[_0x1a9c('0x1d')](handleEntityNotFound(_0x4c4128,null))[_0x1a9c('0x1d')](function(_0x2d3cb0){if(_0x2d3cb0&&_0x2d3cb0['Messages']){var _0x6edc91=_0x2d3cb0[_0x1a9c('0x69')]({'plain':!![]});fs[_0x1a9c('0x6a')](_0x30f846);return BPromise['each'](_0x6edc91[_0x1a9c('0x66')],function(_0xa16d5c,_0x479437){var _0x16337f={'from':_0xa16d5c[_0x1a9c('0x6b')],'to':_0xa16d5c['to']||'missing.recipient@your.company.com','subject':_0xa16d5c[_0x1a9c('0x68')],'html':htmlEntities[_0x1a9c('0x6c')](_0xa16d5c[_0x1a9c('0x3b')]),'headers':{'Date':moment(_0xa16d5c['createdAt'])[_0x1a9c('0x4d')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0xa16d5c['cc']){_0x16337f[_0x1a9c('0x6d')]['Cc']=_0xa16d5c['cc'];}if(_0xa16d5c[_0x1a9c('0x67')]){_0x16337f['headers'][_0x1a9c('0x6e')]=_0xa16d5c[_0x1a9c('0x67')];}return new BPromise(function(_0x53bb0e,_0xdc28e5){if(_0xa16d5c['Attachments']){for(var _0x3f276e=0x0;_0x3f276e<_0xa16d5c[_0x1a9c('0x6f')][_0x1a9c('0x44')];_0x3f276e++){var _0x5ab1e6=_0xa16d5c[_0x1a9c('0x6f')][_0x3f276e];var _0x2da1a4=path[_0x1a9c('0x5d')](_0x2f9dfe,_0x5ab1e6[_0x1a9c('0x70')]);if(fs[_0x1a9c('0x71')](_0x2da1a4)){_0x16337f[_0x1a9c('0x62')][_0x1a9c('0x64')]({'name':_0x5ab1e6[_0x1a9c('0x22')],'contentType':_0x5ab1e6[_0x1a9c('0x29')],'data':fs[_0x1a9c('0x72')](_0x2da1a4)});}}}emlformat[_0x1a9c('0x73')](_0x16337f,function(_0x105fe9,_0x56aba2){if(_0x105fe9)return _0xdc28e5(_0x105fe9);fs[_0x1a9c('0x74')](path['join'](_0x30f846,util[_0x1a9c('0x4d')](_0x1a9c('0x75'),_0x479437)),_0x56aba2);return _0x53bb0e(_0x56aba2);});});})['then'](function(){return new BPromise(function(_0x5bb6e5,_0x48bad5){zipdir(_0x30f846,{'saveTo':_0x5c01a5},function(_0x2462d2,_0x1b17cf){if(_0x2462d2)return _0x48bad5(_0x2462d2);return _0x5bb6e5(_0x1b17cf);});})[_0x1a9c('0x1d')](function(){return new BPromise(function(_0x5da3c0,_0x378db6){rimraf(_0x30f846,function(_0x1215ca){if(_0x1215ca)_0x378db6(_0x1215ca);return _0x5da3c0();});});})[_0x1a9c('0x1d')](function(){return _0x4c4128['download'](_0x5c01a5,_0x1c15c5,function(_0x1040c4){if(!_0x1040c4)fs[_0x1a9c('0x76')](_0x5c01a5);});});});}else{return _0x4c4128[_0x1a9c('0x1f')](0xc8);}})[_0x1a9c('0x2e')](handleError(_0x4c4128,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 3263336..870d63f 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 _0x13f2=['findAll','length','catch','hasOwnProperty','hook','exports','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','save','update','getUsers','setDataValue','Users','map'];(function(_0x20a0fc,_0x517aa3){var _0x551f1d=function(_0x53112a){while(--_0x53112a){_0x20a0fc['push'](_0x20a0fc['shift']());}};_0x551f1d(++_0x517aa3);}(_0x13f2,0x146));var _0x213f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x13f2[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0x213f('0x0'))['db'][_0x213f('0x1')];var MailMessage=require(_0x213f('0x0'))['db'][_0x213f('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x213f('0x3')](0x0);var events={'afterCreate':_0x213f('0x4'),'afterUpdate':_0x213f('0x5'),'afterDestroy':'remove'};function emitEvent(_0x47c7d7){return function(_0x243c58,_0x1f1044,_0x3b5e82){_0x243c58[_0x213f('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x37b5b0){_0x243c58[_0x213f('0x7')](_0x213f('0x8'),_0x37b5b0[_0x213f('0x9')](function(_0x5e17ea){return{'id':_0x5e17ea['id']};}));return MailMessage[_0x213f('0xa')]({'where':{'MailInteractionId':_0x243c58['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x29b155){_0x243c58['setDataValue']('unreadMessages',_0x29b155[_0x213f('0xb')]);MailInteractionEvents['emit'](_0x47c7d7+':'+_0x243c58['id'],_0x243c58);MailInteractionEvents['emit'](_0x47c7d7,_0x243c58);_0x3b5e82(null);})[_0x213f('0xc')](_0x3b5e82(null));};}for(var e in events){if(events[_0x213f('0xd')](e)){var event=events[e];MailInteraction[_0x213f('0xe')](e,emitEvent(event));}}module[_0x213f('0xf')]=MailInteractionEvents; \ No newline at end of file +var _0x9116=['exports','events','MailInteraction','../../mysqldb','MailMessage','setMaxListeners','save','update','getUsers','setDataValue','Users','map','then','unreadMessages','length','emit','catch','hook'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x9116,0x10f));var _0x6911=function(_0xb95e68,_0x46fea5){_0xb95e68=_0xb95e68-0x0;var _0x274df0=_0x9116[_0xb95e68];return _0x274df0;};'use strict';var EventEmitter=require(_0x6911('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0x6911('0x1')];var MailMessage=require(_0x6911('0x2'))['db'][_0x6911('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x6911('0x4')](0x0);var events={'afterCreate':_0x6911('0x5'),'afterUpdate':_0x6911('0x6'),'afterDestroy':'remove'};function emitEvent(_0x573957){return function(_0x91ecba,_0x58fd4e,_0xb79588){_0x91ecba[_0x6911('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x30c27c){_0x91ecba[_0x6911('0x8')](_0x6911('0x9'),_0x30c27c[_0x6911('0xa')](function(_0x261813){return{'id':_0x261813['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x91ecba['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6911('0xb')](function(_0x25b678){_0x91ecba[_0x6911('0x8')](_0x6911('0xc'),_0x25b678[_0x6911('0xd')]);MailInteractionEvents[_0x6911('0xe')](_0x573957+':'+_0x91ecba['id'],_0x91ecba);MailInteractionEvents[_0x6911('0xe')](_0x573957,_0x91ecba);_0xb79588(null);})[_0x6911('0xf')](_0xb79588(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0x6911('0x10')](e,emitEvent(event));}}module[_0x6911('0x11')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index bcd79c9..2e8ff71 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 _0xf58d=['substatus','format','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','changed','substatusAt','models','get','MailMessage','then','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./mailInteraction.attributes','exports','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT'];(function(_0x1dc747,_0x141403){var _0x241ae6=function(_0x382569){while(--_0x382569){_0x1dc747['push'](_0x1dc747['shift']());}};_0x241ae6(++_0x141403);}(_0xf58d,0x15d));var _0xdf58=function(_0x11d5e2,_0x35997c){_0x11d5e2=_0x11d5e2-0x0;var _0x2823c7=_0xf58d[_0x11d5e2];return _0x2823c7;};'use strict';var _=require(_0xdf58('0x0'));var util=require(_0xdf58('0x1'));var logger=require(_0xdf58('0x2'))(_0xdf58('0x3'));var moment=require(_0xdf58('0x4'));var BPromise=require('bluebird');var rp=require(_0xdf58('0x5'));var fs=require('fs');var path=require(_0xdf58('0x6'));var rimraf=require(_0xdf58('0x7'));var config=require('../../config/environment');var attributes=require(_0xdf58('0x8'));module[_0xdf58('0x9')]=function(_0x283c4c,_0x190d98){return _0x283c4c['define'](_0xdf58('0xa'),attributes,{'tableName':_0xdf58('0xb'),'paranoid':![],'indexes':[{'name':_0xdf58('0xc'),'fields':[_0xdf58('0xd'),'to'],'type':_0xdf58('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x340c1a,_0x4d056e,_0x3e2ede){if(_0x340c1a[_0xdf58('0xf')]){_0x340c1a['substatusAt']=moment()[_0xdf58('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x340c1a[_0xdf58('0x11')]){_0x340c1a[_0xdf58('0x12')]=moment()[_0xdf58('0x10')](_0xdf58('0x13'));}_0x3e2ede(null,_0x4d056e);},'beforeUpdate':function(_0x5aebb5,_0x372fe8,_0x39b99f){if(_0x5aebb5[_0xdf58('0x14')]('substatus')){_0x5aebb5[_0xdf58('0x15')]=_0x5aebb5[_0xdf58('0xf')]?moment()['format'](_0xdf58('0x13')):null;}if(_0x5aebb5['changed'](_0xdf58('0x11'))){_0x5aebb5['closedAt']=moment()[_0xdf58('0x10')](_0xdf58('0x13'));_0x5aebb5[_0xdf58('0xf')]=null;_0x5aebb5['substatusAt']=null;}_0x39b99f(null,_0x5aebb5);},'afterUpdate':function(_0x323ae2,_0x1be9fd,_0x541ccd){var _0x51c161=_0x283c4c[_0xdf58('0x16')];var _0x433810=_0x323ae2[_0xdf58('0x17')]({'plain':!![]});if(_0x433810[_0xdf58('0x11')]){return _0x51c161[_0xdf58('0x18')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x433810['id']}})[_0xdf58('0x19')](function(){_0x541ccd();})['catch'](function(_0x15e4ce){_0x541ccd(_0x15e4ce);});}else{_0x541ccd();}}},'charset':_0xdf58('0x1a'),'collate':_0xdf58('0x1b')});}; \ No newline at end of file +var _0x6b2d=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','mail_interactions','fti_mail_interactions','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','changed','closedAt','models','update','then','catch','utf8mb4_unicode_ci','util'];(function(_0x18363c,_0x40e913){var _0x3c1f7f=function(_0x11c01d){while(--_0x11c01d){_0x18363c['push'](_0x18363c['shift']());}};_0x3c1f7f(++_0x40e913);}(_0x6b2d,0x143));var _0xd6b2=function(_0x1a1ebd,_0x4f8bfe){_0x1a1ebd=_0x1a1ebd-0x0;var _0x3a8a13=_0x6b2d[_0x1a1ebd];return _0x3a8a13;};'use strict';var _=require('lodash');var util=require(_0xd6b2('0x0'));var logger=require(_0xd6b2('0x1'))(_0xd6b2('0x2'));var moment=require(_0xd6b2('0x3'));var BPromise=require(_0xd6b2('0x4'));var rp=require(_0xd6b2('0x5'));var fs=require('fs');var path=require(_0xd6b2('0x6'));var rimraf=require(_0xd6b2('0x7'));var config=require(_0xd6b2('0x8'));var attributes=require(_0xd6b2('0x9'));module[_0xd6b2('0xa')]=function(_0x2b7bf8,_0x1bf25e){return _0x2b7bf8[_0xd6b2('0xb')]('MailInteraction',attributes,{'tableName':_0xd6b2('0xc'),'paranoid':![],'indexes':[{'name':_0xd6b2('0xd'),'fields':['subject','to'],'type':_0xd6b2('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1a618a,_0x1f24c2,_0x2ef9c9){if(_0x1a618a[_0xd6b2('0xf')]){_0x1a618a[_0xd6b2('0x10')]=moment()[_0xd6b2('0x11')](_0xd6b2('0x12'));}if(_0x1a618a[_0xd6b2('0x13')]){_0x1a618a['closedAt']=moment()[_0xd6b2('0x11')](_0xd6b2('0x12'));}_0x2ef9c9(null,_0x1f24c2);},'beforeUpdate':function(_0x570b44,_0x4832c9,_0x5aa7e3){if(_0x570b44[_0xd6b2('0x14')](_0xd6b2('0xf'))){_0x570b44[_0xd6b2('0x10')]=_0x570b44[_0xd6b2('0xf')]?moment()[_0xd6b2('0x11')](_0xd6b2('0x12')):null;}if(_0x570b44[_0xd6b2('0x14')]('closed')){_0x570b44[_0xd6b2('0x15')]=moment()[_0xd6b2('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x570b44['substatus']=null;_0x570b44[_0xd6b2('0x10')]=null;}_0x5aa7e3(null,_0x570b44);},'afterUpdate':function(_0x1c5fda,_0xdababf,_0x982eb9){var _0x3f4d55=_0x2b7bf8[_0xd6b2('0x16')];var _0x2d6102=_0x1c5fda['get']({'plain':!![]});if(_0x2d6102[_0xd6b2('0x13')]){return _0x3f4d55['MailMessage'][_0xd6b2('0x17')]({'read':!![]},{'where':{'MailInteractionId':_0x2d6102['id']}})[_0xd6b2('0x18')](function(){_0x982eb9();})[_0xd6b2('0x19')](function(_0x2aa58b){_0x982eb9(_0x2aa58b);});}else{_0x982eb9();}}},'charset':'utf8mb4','collate':_0xd6b2('0x1a')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 847a116..91253d7 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 _0xf69d=['../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','request','then','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MailInteraction,\x20%s,\x20%s','message','info','catch','UpdateMailInteraction','body','options','where','attributes','AddTagsToMailInteraction','MailInteraction','find','addTags','ids','omit','spread','debug','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x554247,_0x367fda){var _0x469992=function(_0x5d643f){while(--_0x5d643f){_0x554247['push'](_0x554247['shift']());}};_0x469992(++_0x367fda);}(_0xf69d,0xd3));var _0xdf69=function(_0x226536,_0x37a2f8){_0x226536=_0x226536-0x0;var _0x2c8fe9=_0xf69d[_0x226536];return _0x2c8fe9;};'use strict';var _=require(_0xdf69('0x0'));var util=require(_0xdf69('0x1'));var moment=require(_0xdf69('0x2'));var BPromise=require(_0xdf69('0x3'));var rs=require(_0xdf69('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdf69('0x5'))['db'];var utils=require(_0xdf69('0x6'));var logger=require(_0xdf69('0x7'))(_0xdf69('0x8'));var config=require(_0xdf69('0x9'));var jayson=require(_0xdf69('0xa'));var client=jayson[_0xdf69('0xb')][_0xdf69('0xc')]({'port':0x232a});config[_0xdf69('0xd')]=_[_0xdf69('0xe')](config[_0xdf69('0xd')],{'host':_0xdf69('0xf'),'port':0x18eb});var socket=require(_0xdf69('0x10'))(new Redis(config[_0xdf69('0xd')]));require(_0xdf69('0x11'))[_0xdf69('0x12')](socket);function respondWithRpcPromise(_0x1e0e8d,_0x4fcc93,_0x305726){return new BPromise(function(_0x420011,_0x20cc6c){return client[_0xdf69('0x13')](_0x1e0e8d,_0x305726)[_0xdf69('0x14')](function(_0x1b86d4){logger['info']('MailInteraction,\x20%s,\x20%s',_0x4fcc93,'request\x20sent');logger['debug'](_0xdf69('0x15'),_0x4fcc93,_0xdf69('0x16'),JSON[_0xdf69('0x17')](_0x1b86d4));if(_0x1b86d4[_0xdf69('0x18')]){if(_0x1b86d4[_0xdf69('0x18')][_0xdf69('0x19')]===0x1f4){logger['error'](_0xdf69('0x1a'),_0x4fcc93,_0x1b86d4[_0xdf69('0x18')][_0xdf69('0x1b')]);return _0x20cc6c(_0x1b86d4[_0xdf69('0x18')]['message']);}logger[_0xdf69('0x18')]('MailInteraction,\x20%s,\x20%s',_0x4fcc93,_0x1b86d4[_0xdf69('0x18')][_0xdf69('0x1b')]);return _0x420011(_0x1b86d4['error'][_0xdf69('0x1b')]);}else{logger[_0xdf69('0x1c')](_0xdf69('0x1a'),_0x4fcc93,_0xdf69('0x16'));_0x420011(_0x1b86d4['result']['message']);}})[_0xdf69('0x1d')](function(_0x15e73a){logger['error'](_0xdf69('0x1a'),_0x4fcc93,_0x15e73a);_0x20cc6c(_0x15e73a);});});}exports[_0xdf69('0x1e')]=function(_0x68fa80){var _0x526cbc=this;return new Promise(function(_0x4776df,_0x452cfa){return db['MailInteraction']['update'](_0x68fa80[_0xdf69('0x1f')],{'raw':_0x68fa80[_0xdf69('0x20')]?_0x68fa80[_0xdf69('0x20')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x68fa80['options']?_0x68fa80['options'][_0xdf69('0x21')]||null:null,'attributes':_0x68fa80['options']?_0x68fa80[_0xdf69('0x20')][_0xdf69('0x22')]||null:null,'limit':_0x68fa80[_0xdf69('0x20')]?_0x68fa80['options']['limit']||null:null})[_0xdf69('0x14')](function(_0x1437f6){logger[_0xdf69('0x1c')](_0xdf69('0x1e'),_0x68fa80);logger['debug'](_0xdf69('0x1e'),_0x68fa80,JSON[_0xdf69('0x17')](_0x1437f6));_0x4776df(_0x1437f6);})[_0xdf69('0x1d')](function(_0x5969cb){logger[_0xdf69('0x18')]('UpdateMailInteraction',_0x5969cb['message'],_0x68fa80);_0x452cfa(_0x526cbc['error'](0x1f4,_0x5969cb['message']));});});};exports[_0xdf69('0x23')]=function(_0xe339ac){return new Promise(function(_0x4fc007,_0x301bd2){return db[_0xdf69('0x24')][_0xdf69('0x25')]({'where':_0xe339ac[_0xdf69('0x20')]?_0xe339ac[_0xdf69('0x20')][_0xdf69('0x21')]||null:null})[_0xdf69('0x14')](function(_0x16b3ee){if(_0x16b3ee){return _0x16b3ee[_0xdf69('0x26')](_0xe339ac[_0xdf69('0x1f')][_0xdf69('0x27')],_[_0xdf69('0x28')](_0xe339ac[_0xdf69('0x1f')],[_0xdf69('0x27'),'id'])||{});}})[_0xdf69('0x29')](function(_0x31cee5){logger[_0xdf69('0x1c')]('AddTags',_0xe339ac);logger[_0xdf69('0x2a')](_0xdf69('0x2b'),_0xe339ac,JSON[_0xdf69('0x17')](_0x31cee5));_0x4fc007(_0x31cee5);})[_0xdf69('0x1d')](function(_0x1a23d1){logger['error'](_0xdf69('0x2b'),_0x1a23d1['message'],_0xe339ac);_0x301bd2(_this[_0xdf69('0x18')](0x1f4,_0x1a23d1[_0xdf69('0x1b')]));});});}; \ No newline at end of file +var _0x8b17=['result','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','limit','then','AddTagsToMailInteraction','find','where','addTags','ids','omit','spread','AddTags','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','register','request','info','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','MailInteraction,\x20%s,\x20%s','message'];(function(_0x460268,_0x1446a3){var _0x6e3d8f=function(_0x44f1b8){while(--_0x44f1b8){_0x460268['push'](_0x460268['shift']());}};_0x6e3d8f(++_0x1446a3);}(_0x8b17,0xbe));var _0x78b1=function(_0x43e41f,_0x14f856){_0x43e41f=_0x43e41f-0x0;var _0xc885a5=_0x8b17[_0x43e41f];return _0xc885a5;};'use strict';var _=require('lodash');var util=require(_0x78b1('0x0'));var moment=require(_0x78b1('0x1'));var BPromise=require(_0x78b1('0x2'));var rs=require(_0x78b1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x78b1('0x4'))['db'];var utils=require(_0x78b1('0x5'));var logger=require(_0x78b1('0x6'))(_0x78b1('0x7'));var config=require(_0x78b1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x78b1('0x9')][_0x78b1('0xa')]({'port':0x232a});config[_0x78b1('0xb')]=_['defaults'](config[_0x78b1('0xb')],{'host':_0x78b1('0xc'),'port':0x18eb});var socket=require(_0x78b1('0xd'))(new Redis(config['redis']));require('./mailInteraction.socket')[_0x78b1('0xe')](socket);function respondWithRpcPromise(_0x559c32,_0x18bd50,_0x2fc62c){return new BPromise(function(_0xa16b94,_0x38281f){return client[_0x78b1('0xf')](_0x559c32,_0x2fc62c)['then'](function(_0x27f945){logger[_0x78b1('0x10')]('MailInteraction,\x20%s,\x20%s',_0x18bd50,_0x78b1('0x11'));logger[_0x78b1('0x12')](_0x78b1('0x13'),_0x18bd50,_0x78b1('0x11'),JSON[_0x78b1('0x14')](_0x27f945));if(_0x27f945[_0x78b1('0x15')]){if(_0x27f945[_0x78b1('0x15')][_0x78b1('0x16')]===0x1f4){logger['error'](_0x78b1('0x17'),_0x18bd50,_0x27f945[_0x78b1('0x15')][_0x78b1('0x18')]);return _0x38281f(_0x27f945[_0x78b1('0x15')][_0x78b1('0x18')]);}logger[_0x78b1('0x15')](_0x78b1('0x17'),_0x18bd50,_0x27f945['error'][_0x78b1('0x18')]);return _0xa16b94(_0x27f945[_0x78b1('0x15')][_0x78b1('0x18')]);}else{logger[_0x78b1('0x10')]('MailInteraction,\x20%s,\x20%s',_0x18bd50,_0x78b1('0x11'));_0xa16b94(_0x27f945[_0x78b1('0x19')][_0x78b1('0x18')]);}})[_0x78b1('0x1a')](function(_0x5571bb){logger[_0x78b1('0x15')](_0x78b1('0x17'),_0x18bd50,_0x5571bb);_0x38281f(_0x5571bb);});});}exports[_0x78b1('0x1b')]=function(_0x4af0a9){var _0x16e9cb=this;return new Promise(function(_0x3d5b4c,_0x1dd290){return db[_0x78b1('0x1c')][_0x78b1('0x1d')](_0x4af0a9[_0x78b1('0x1e')],{'raw':_0x4af0a9['options']?_0x4af0a9[_0x78b1('0x1f')][_0x78b1('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4af0a9[_0x78b1('0x1f')]?_0x4af0a9[_0x78b1('0x1f')]['where']||null:null,'attributes':_0x4af0a9[_0x78b1('0x1f')]?_0x4af0a9[_0x78b1('0x1f')]['attributes']||null:null,'limit':_0x4af0a9[_0x78b1('0x1f')]?_0x4af0a9[_0x78b1('0x1f')][_0x78b1('0x21')]||null:null})[_0x78b1('0x22')](function(_0x25e3bc){logger['info']('UpdateMailInteraction',_0x4af0a9);logger[_0x78b1('0x12')](_0x78b1('0x1b'),_0x4af0a9,JSON['stringify'](_0x25e3bc));_0x3d5b4c(_0x25e3bc);})[_0x78b1('0x1a')](function(_0xfd551f){logger[_0x78b1('0x15')](_0x78b1('0x1b'),_0xfd551f[_0x78b1('0x18')],_0x4af0a9);_0x1dd290(_0x16e9cb['error'](0x1f4,_0xfd551f[_0x78b1('0x18')]));});});};exports[_0x78b1('0x23')]=function(_0x4f2069){return new Promise(function(_0x56719f,_0x324953){return db[_0x78b1('0x1c')][_0x78b1('0x24')]({'where':_0x4f2069[_0x78b1('0x1f')]?_0x4f2069[_0x78b1('0x1f')][_0x78b1('0x25')]||null:null})[_0x78b1('0x22')](function(_0x4a6a9e){if(_0x4a6a9e){return _0x4a6a9e[_0x78b1('0x26')](_0x4f2069[_0x78b1('0x1e')][_0x78b1('0x27')],_[_0x78b1('0x28')](_0x4f2069[_0x78b1('0x1e')],['ids','id'])||{});}})[_0x78b1('0x29')](function(_0x4d05f5){logger[_0x78b1('0x10')]('AddTags',_0x4f2069);logger[_0x78b1('0x12')](_0x78b1('0x2a'),_0x4f2069,JSON['stringify'](_0x4d05f5));_0x56719f(_0x4d05f5);})[_0x78b1('0x1a')](function(_0x1a4faa){logger[_0x78b1('0x15')](_0x78b1('0x2a'),_0x1a4faa[_0x78b1('0x18')],_0x4f2069);_0x324953(_this[_0x78b1('0x15')](0x1f4,_0x1a4faa['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 9cd45ad..d44ac35 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 _0x1ed8=['mailInteraction:','save','update','emit','register','length'];(function(_0x4a245a,_0x118e63){var _0x26286e=function(_0x595812){while(--_0x595812){_0x4a245a['push'](_0x4a245a['shift']());}};_0x26286e(++_0x118e63);}(_0x1ed8,0x157));var _0x81ed=function(_0x3524b4,_0x144e7b){_0x3524b4=_0x3524b4-0x0;var _0x15c122=_0x1ed8[_0x3524b4];return _0x15c122;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0x81ed('0x0'),'remove',_0x81ed('0x1')];function createListener(_0x2cf5ab,_0x11292e){return function(_0x439214){_0x11292e[_0x81ed('0x2')](_0x2cf5ab,_0x439214);};}function removeListener(_0xbea08d,_0x5f0eca){return function(){MailInteractionEvents['removeListener'](_0xbea08d,_0x5f0eca);};}exports[_0x81ed('0x3')]=function(_0xe524d3){for(var _0x47b7d1=0x0,_0x5bf77b=events[_0x81ed('0x4')];_0x47b7d1<_0x5bf77b;_0x47b7d1++){var _0x15f560=events[_0x47b7d1];var _0x427b33=createListener(_0x81ed('0x5')+_0x15f560,_0xe524d3);MailInteractionEvents['on'](_0x15f560,_0x427b33);}}; \ No newline at end of file +var _0x9631=['update','emit','register','mailInteraction:','./mailInteraction.events','save'];(function(_0x167696,_0x48e4e4){var _0x4168c3=function(_0x46b5dd){while(--_0x46b5dd){_0x167696['push'](_0x167696['shift']());}};_0x4168c3(++_0x48e4e4);}(_0x9631,0x148));var _0x1963=function(_0x5b05de,_0x441400){_0x5b05de=_0x5b05de-0x0;var _0x1dbd07=_0x9631[_0x5b05de];return _0x1dbd07;};'use strict';var MailInteractionEvents=require(_0x1963('0x0'));var events=[_0x1963('0x1'),'remove',_0x1963('0x2')];function createListener(_0x173d6d,_0x253eff){return function(_0x284924){_0x253eff[_0x1963('0x3')](_0x173d6d,_0x284924);};}function removeListener(_0x5c2682,_0x4bac73){return function(){MailInteractionEvents['removeListener'](_0x5c2682,_0x4bac73);};}exports[_0x1963('0x4')]=function(_0x4efbf6){for(var _0x4f39de=0x0,_0xe4309a=events['length'];_0x4f39de<_0xe4309a;_0x4f39de++){var _0x6be5ab=events[_0x4f39de];var _0x3bee84=createListener(_0x1963('0x5')+_0x6be5ab,_0x4efbf6);MailInteractionEvents['on'](_0x6be5ab,_0x3bee84);}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/index.js b/server/api/mailInteractionHasTag/index.js index c87e76b..ed303fe 100644 --- a/server/api/mailInteractionHasTag/index.js +++ b/server/api/mailInteractionHasTag/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa0a1=['../../components/auth/service','./mailInteractionHasTag.controller','get','describe','exports','express'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0xa0a1,0x15b));var _0x1a0a=function(_0xd8b0c5,_0x4784e5){_0xd8b0c5=_0xd8b0c5-0x0;var _0x5e769f=_0xa0a1[_0xd8b0c5];return _0x5e769f;};'use strict';var express=require(_0x1a0a('0x0'));var router=express['Router']();var auth=require(_0x1a0a('0x1'));var controller=require(_0x1a0a('0x2'));router[_0x1a0a('0x3')]('/describe',auth['isAuthenticated'](),controller[_0x1a0a('0x4')]);module[_0x1a0a('0x5')]=router; \ No newline at end of file +var _0xa23f=['get','/describe','isAuthenticated','describe','express','Router'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xa23f,0x7c));var _0xfa23=function(_0x23e1d7,_0x422032){_0x23e1d7=_0x23e1d7-0x0;var _0x113fee=_0xa23f[_0x23e1d7];return _0x113fee;};'use strict';var express=require(_0xfa23('0x0'));var router=express[_0xfa23('0x1')]();var auth=require('../../components/auth/service');var controller=require('./mailInteractionHasTag.controller');router[_0xfa23('0x2')](_0xfa23('0x3'),auth[_0xfa23('0x4')](),controller[_0xfa23('0x5')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js index 1b10bbb..3993008 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','../../config/logger','api','../../mysqldb','json','error','name','status','describe','then'];(function(_0x3df1bc,_0x4c2da5){var _0x58f0d9=function(_0x224e89){while(--_0x224e89){_0x3df1bc['push'](_0x3df1bc['shift']());}};_0x58f0d9(++_0x4c2da5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'use strict';var logger=require(_0x0a9e('0x0'))(_0x0a9e('0x1'));var db=require(_0x0a9e('0x2'))['db'];function respondWithResult(_0x5dd881,_0x550fbc){_0x550fbc=_0x550fbc||0xc8;return function(_0x18d5c9){if(_0x18d5c9){return _0x5dd881['status'](_0x550fbc)[_0x0a9e('0x3')](_0x18d5c9);}};}function handleError(_0x432180,_0x2ab90b){_0x2ab90b=_0x2ab90b||0x1f4;return function(_0x991246){logger[_0x0a9e('0x4')](_0x991246['stack']);if(_0x991246[_0x0a9e('0x5')]){delete _0x991246[_0x0a9e('0x5')];}_0x432180[_0x0a9e('0x6')](_0x2ab90b)['send'](_0x991246);};}exports['describe']=function(_0xe42b77,_0x56465b){return db['MailInteractionHasTag'][_0x0a9e('0x7')]()[_0x0a9e('0x8')](respondWithResult(_0x56465b,null))[_0x0a9e('0x9')](handleError(_0x56465b,null));}; \ No newline at end of file +var _0xa9e0=['catch','../../config/logger','api','../../mysqldb','json','error','name','status','describe','then'];(function(_0x44afe1,_0x314593){var _0x5ef2c4=function(_0x45f898){while(--_0x45f898){_0x44afe1['push'](_0x44afe1['shift']());}};_0x5ef2c4(++_0x314593);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'use strict';var logger=require(_0x0a9e('0x0'))(_0x0a9e('0x1'));var db=require(_0x0a9e('0x2'))['db'];function respondWithResult(_0x5dd881,_0x550fbc){_0x550fbc=_0x550fbc||0xc8;return function(_0x18d5c9){if(_0x18d5c9){return _0x5dd881['status'](_0x550fbc)[_0x0a9e('0x3')](_0x18d5c9);}};}function handleError(_0x432180,_0x2ab90b){_0x2ab90b=_0x2ab90b||0x1f4;return function(_0x991246){logger[_0x0a9e('0x4')](_0x991246['stack']);if(_0x991246[_0x0a9e('0x5')]){delete _0x991246[_0x0a9e('0x5')];}_0x432180[_0x0a9e('0x6')](_0x2ab90b)['send'](_0x991246);};}exports['describe']=function(_0xe42b77,_0x56465b){return db['MailInteractionHasTag'][_0x0a9e('0x7')]()[_0x0a9e('0x8')](respondWithResult(_0x56465b,null))[_0x0a9e('0x9')](handleError(_0x56465b,null));}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.js index 0f77788..2607c97 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x526d=['sequelize','exports','INTEGER'];(function(_0x390a19,_0x5dd137){var _0x5d8230=function(_0x2e6234){while(--_0x2e6234){_0x390a19['push'](_0x390a19['shift']());}};_0x5d8230(++_0x5dd137);}(_0x526d,0x1b3));var _0xd526=function(_0x22bdec,_0x184bc2){_0x22bdec=_0x22bdec-0x0;var _0x23b2a5=_0x526d[_0x22bdec];return _0x23b2a5;};'use strict';var Sequelize=require(_0xd526('0x0'));module[_0xd526('0x1')]={'MailInteractionId':{'type':Sequelize[_0xd526('0x2')],'primaryKey':!![]},'TagId':{'type':Sequelize[_0xd526('0x2')],'defaultValue':null}}; \ No newline at end of file +var _0x4f9d=['INTEGER','sequelize','exports'];(function(_0x21f17f,_0x49d662){var _0x21d30e=function(_0x315c66){while(--_0x315c66){_0x21f17f['push'](_0x21f17f['shift']());}};_0x21d30e(++_0x49d662);}(_0x4f9d,0x127));var _0xd4f9=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4f9d[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xd4f9('0x0'));module[_0xd4f9('0x1')]={'MailInteractionId':{'type':Sequelize[_0xd4f9('0x2')],'primaryKey':!![]},'TagId':{'type':Sequelize[_0xd4f9('0x2')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js index 2368205..9c5bdbe 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6e3f=['./mailInteractionHasTag','define'];(function(_0xc241ac,_0x1da4c6){var _0x246556=function(_0x5c0a51){while(--_0x5c0a51){_0xc241ac['push'](_0xc241ac['shift']());}};_0x246556(++_0x1da4c6);}(_0x6e3f,0x1a6));var _0xf6e3=function(_0x459965,_0x13b387){_0x459965=_0x459965-0x0;var _0x1dde7f=_0x6e3f[_0x459965];return _0x1dde7f;};'use strict';var attributes=require(_0xf6e3('0x0'));module['exports']=function(_0x104a38){return _0x104a38[_0xf6e3('0x1')]('MailInteractionHasTag',attributes,{'tableName':'mail_interaction_has_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe13a=['mail_interaction_has_tags','./mailInteractionHasTag','exports','define'];(function(_0x40a166,_0x4f526a){var _0x725abe=function(_0x3f42c5){while(--_0x3f42c5){_0x40a166['push'](_0x40a166['shift']());}};_0x725abe(++_0x4f526a);}(_0xe13a,0x125));var _0xae13=function(_0x585758,_0x5747b8){_0x585758=_0x585758-0x0;var _0x4e4806=_0xe13a[_0x585758];return _0x4e4806;};'use strict';var attributes=require(_0xae13('0x0'));module[_0xae13('0x1')]=function(_0x51c6cf){return _0x51c6cf[_0xae13('0x2')]('MailInteractionHasTag',attributes,{'tableName':_0xae13('0x3'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 1943d60..a42cfb5 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 _0x5a68=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','isAuthenticated','index','get','describe','/:id','show','/:id/download','post','mailmessage:create','update','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','path','connect-timeout'];(function(_0xf34109,_0x380779){var _0x570bfc=function(_0x1ad086){while(--_0x1ad086){_0xf34109['push'](_0xf34109['shift']());}};_0x570bfc(++_0x380779);}(_0x5a68,0x1ae));var _0x85a6=function(_0x59d74c,_0x311f12){_0x59d74c=_0x59d74c-0x0;var _0x2402cd=_0x5a68[_0x59d74c];return _0x2402cd;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x85a6('0x0'));var timeout=require(_0x85a6('0x1'));var express=require(_0x85a6('0x2'));var router=express[_0x85a6('0x3')]();var fs_extra=require(_0x85a6('0x4'));var auth=require(_0x85a6('0x5'));var interaction=require(_0x85a6('0x6'));var config=require(_0x85a6('0x7'));var controller=require(_0x85a6('0x8'));router['get']('/',auth[_0x85a6('0x9')](),controller[_0x85a6('0xa')]);router[_0x85a6('0xb')]('/describe',auth[_0x85a6('0x9')](),controller[_0x85a6('0xc')]);router[_0x85a6('0xb')](_0x85a6('0xd'),auth[_0x85a6('0x9')](),controller[_0x85a6('0xe')]);router[_0x85a6('0xb')](_0x85a6('0xf'),auth[_0x85a6('0x9')](),controller['download']);router[_0x85a6('0x10')]('/',auth['isAuthenticated'](),interaction['tracked']('mail',_0x85a6('0x11')),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x85a6('0x12')]);router[_0x85a6('0x13')](_0x85a6('0x14'),auth['isAuthenticated'](),controller[_0x85a6('0x15')]);router[_0x85a6('0x13')](_0x85a6('0x16'),auth[_0x85a6('0x9')](),controller[_0x85a6('0x17')]);router[_0x85a6('0x18')](_0x85a6('0xd'),auth[_0x85a6('0x9')](),controller[_0x85a6('0x19')]);module[_0x85a6('0x1a')]=router; \ No newline at end of file +var _0xc1aa=['mail','mailmessage:create','put','/:id','accept','/:id/reject','reject','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','index','get','/describe','isAuthenticated','describe','/:id/download','download','post'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0xc1aa,0xa9));var _0xac1a=function(_0x28bc41,_0x1eca28){_0x28bc41=_0x28bc41-0x0;var _0x31821b=_0xc1aa[_0x28bc41];return _0x31821b;};'use strict';var multer=require(_0xac1a('0x0'));var util=require('util');var path=require(_0xac1a('0x1'));var timeout=require(_0xac1a('0x2'));var express=require(_0xac1a('0x3'));var router=express['Router']();var fs_extra=require(_0xac1a('0x4'));var auth=require(_0xac1a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xac1a('0x6'));var controller=require('./mailMessage.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xac1a('0x7')]);router[_0xac1a('0x8')](_0xac1a('0x9'),auth[_0xac1a('0xa')](),controller[_0xac1a('0xb')]);router['get']('/:id',auth[_0xac1a('0xa')](),controller['show']);router[_0xac1a('0x8')](_0xac1a('0xc'),auth[_0xac1a('0xa')](),controller[_0xac1a('0xd')]);router[_0xac1a('0xe')]('/',auth[_0xac1a('0xa')](),interaction['tracked'](_0xac1a('0xf'),_0xac1a('0x10')),controller['create']);router[_0xac1a('0x11')](_0xac1a('0x12'),auth[_0xac1a('0xa')](),controller['update']);router[_0xac1a('0x11')]('/:id/accept',auth[_0xac1a('0xa')](),controller[_0xac1a('0x13')]);router[_0xac1a('0x11')](_0xac1a('0x14'),auth[_0xac1a('0xa')](),controller[_0xac1a('0x15')]);router['delete'](_0xac1a('0x12'),auth[_0xac1a('0xa')](),controller['destroy']);module[_0xac1a('0x16')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index eebf242..d17ffed 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 _0x61fa=['medium','BOOLEAN','ENUM','out','STRING','long','DATE','INTEGER','Email','Chat','lodash','TEXT'];(function(_0x3b3cbb,_0x13a449){var _0x365fe9=function(_0x4b59f0){while(--_0x4b59f0){_0x3b3cbb['push'](_0x3b3cbb['shift']());}};_0x365fe9(++_0x13a449);}(_0x61fa,0x1ba));var _0xa61f=function(_0x4bc7a8,_0x501829){_0x4bc7a8=_0x4bc7a8-0x0;var _0x2bb25c=_0x61fa[_0x4bc7a8];return _0x2bb25c;};'use strict';var Sequelize=require('sequelize');var _=require(_0xa61f('0x0'));module['exports']={'body':{'type':Sequelize[_0xa61f('0x1')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0xa61f('0x2'))},'read':{'type':Sequelize[_0xa61f('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xa61f('0x4')]('in',_0xa61f('0x5')),'defaultValue':_0xa61f('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xa61f('0x6')](0x1fe)},'from':{'type':Sequelize[_0xa61f('0x6')]},'to':{'type':Sequelize[_0xa61f('0x1')](_0xa61f('0x7'))},'cc':{'type':Sequelize['TEXT']('long')},'bcc':{'type':Sequelize[_0xa61f('0x1')](_0xa61f('0x7'))},'subject':{'type':Sequelize[_0xa61f('0x1')]},'sentAt':{'type':Sequelize[_0xa61f('0x8')]},'attach':{'type':Sequelize[_0xa61f('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xa61f('0x3')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xa61f('0x8')]},'originTo':{'type':Sequelize['TEXT'](_0xa61f('0x7'))},'originCc':{'type':Sequelize['TEXT'](_0xa61f('0x7'))},'originChannel':{'type':Sequelize['ENUM'](_0xa61f('0xa'),_0xa61f('0xb')),'defaultValue':_0xa61f('0xa'),'allowNull':![]}}; \ No newline at end of file +var _0x9db1=['STRING','BOOLEAN','DATE','ENUM','Chat','Email','sequelize','lodash','exports','TEXT','long','medium','out'];(function(_0x2d1c0c,_0x1b0440){var _0x3343de=function(_0x508544){while(--_0x508544){_0x2d1c0c['push'](_0x2d1c0c['shift']());}};_0x3343de(++_0x1b0440);}(_0x9db1,0xf0));var _0x19db=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9db1[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x19db('0x0'));var _=require(_0x19db('0x1'));module[_0x19db('0x2')]={'body':{'type':Sequelize[_0x19db('0x3')](_0x19db('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x19db('0x3')](_0x19db('0x5'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x19db('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x19db('0x7')](0x1fe)},'from':{'type':Sequelize[_0x19db('0x7')]},'to':{'type':Sequelize[_0x19db('0x3')]('long')},'cc':{'type':Sequelize[_0x19db('0x3')](_0x19db('0x4'))},'bcc':{'type':Sequelize[_0x19db('0x3')](_0x19db('0x4'))},'subject':{'type':Sequelize[_0x19db('0x3')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0x19db('0x8')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x19db('0x9')]},'originTo':{'type':Sequelize['TEXT'](_0x19db('0x4'))},'originCc':{'type':Sequelize[_0x19db('0x3')](_0x19db('0x4'))},'originChannel':{'type':Sequelize[_0x19db('0xa')]('Email',_0x19db('0xb')),'defaultValue':_0x19db('0xc'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 54e139e..4324c25 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 _0xa07a=['writeFileSync','unlinkSync','eml-format','moment','util','path','lodash','ioredis','html-to-text','../../components/interaction/service','../../config/logger','api','mail-interactions','../../mysqldb','redis','localhost','html-entities','./mailMessage.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','MailMessage,\x20%s,\x20%s','message','catch','status','json','offset','undefined','limit','count','set','update','destroy','end','sendStatus','name','send','index','MailMessage','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','include','findAll','rows','show','params','includeAll','options','find','body','create','direction','out','secret','split','MailAccount','MailAccountId','CmList','List','Contacts','updatedAt','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','root','server/files/attachments','basename','CmContact','defaults','ListId','List\x20not\x20found','sendMail','YYYY-MM-DD\x20HH:mm:ss','stringify','accept','mail','acceptMessage','UserId','get','MailInteractionId','interaction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','agent','interface','SIP/%s','channel','motionChannel','event','reject','EventManager','download','unix','files','tmp','server','message-%s.eml','from','bcc','subject','Attachment','decode','createdAt','format','headers','Bcc','Attachments','existsSync','push','readFileSync','build'];(function(_0x523f68,_0x13aac8){var _0x50b982=function(_0xc12b51){while(--_0xc12b51){_0x523f68['push'](_0x523f68['shift']());}};_0x50b982(++_0x13aac8);}(_0xa07a,0x9c));var _0xaa07=function(_0x46b389,_0x1eeb39){_0x46b389=_0x46b389-0x0;var _0x180f3e=_0xa07a[_0x46b389];return _0x180f3e;};'use strict';var emlformat=require(_0xaa07('0x0'));var moment=require(_0xaa07('0x1'));var util=require(_0xaa07('0x2'));var path=require(_0xaa07('0x3'));var fs=require('fs');var _=require(_0xaa07('0x4'));var Redis=require(_0xaa07('0x5'));var htmlToText=require(_0xaa07('0x6'));var interactionService=require(_0xaa07('0x7'));var qs=require('../../components/parsers/qs');var logger=require(_0xaa07('0x8'))(_0xaa07('0x9'));var interaction_log=require('../../config/logger')(_0xaa07('0xa'));var config=require('../../config/environment');var db=require(_0xaa07('0xb'))['db'];config[_0xaa07('0xc')]=_['defaults'](config['redis'],{'host':_0xaa07('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xaa07('0xc')]));var htmlEntities=require(_0xaa07('0xe'));require(_0xaa07('0xf'))[_0xaa07('0x10')](socket);var jayson=require(_0xaa07('0x11'));var client=jayson['client']['http']({'port':0x232c});var client9003=jayson[_0xaa07('0x12')][_0xaa07('0x13')]({'port':0x232b});var client9002=jayson['client'][_0xaa07('0x13')]({'port':0x232a});function respondWithRpcPromise(_0xbf9fde,_0x25fe8e,_0x2ff470,_0x5f1925){return new Promise(function(_0x2307e6,_0x31d908){var _0x232577=_0x5f1925||client;return _0x232577[_0xaa07('0x14')](_0xbf9fde,_0x2ff470)[_0xaa07('0x15')](function(_0x4573ae){logger[_0xaa07('0x16')]('MailMessage,\x20%s,\x20%s',_0x25fe8e,_0xaa07('0x17'));logger[_0xaa07('0x18')](_0xaa07('0x19'),_0x25fe8e,'request\x20sent',JSON['stringify'](_0x4573ae));if(_0x4573ae[_0xaa07('0x1a')]){if(_0x4573ae['error'][_0xaa07('0x1b')]===0x1f4){logger[_0xaa07('0x1a')](_0xaa07('0x1c'),_0x25fe8e,_0x4573ae[_0xaa07('0x1a')][_0xaa07('0x1d')]);return _0x31d908(_0x4573ae[_0xaa07('0x1a')][_0xaa07('0x1d')]);}logger[_0xaa07('0x1a')](_0xaa07('0x1c'),_0x25fe8e,_0x4573ae['error'][_0xaa07('0x1d')]);return _0x2307e6(_0x4573ae[_0xaa07('0x1a')][_0xaa07('0x1d')]);}else{logger['info'](_0xaa07('0x1c'),_0x25fe8e,_0xaa07('0x17'));_0x2307e6(_0x4573ae['result'][_0xaa07('0x1d')]);}})[_0xaa07('0x1e')](function(_0x361111){logger['error']('MailMessage,\x20%s,\x20%s',_0x25fe8e,_0x361111);_0x31d908(_0x361111);});});}function respondWithResult(_0x3f8114,_0xf65b11){_0xf65b11=_0xf65b11||0xc8;return function(_0x5c266f){if(_0x5c266f){return _0x3f8114[_0xaa07('0x1f')](_0xf65b11)[_0xaa07('0x20')](_0x5c266f);}};}function respondWithFilteredResult(_0x4c3f3e,_0x1a7200){return function(_0xfd0275){if(_0xfd0275){var _0x23c555=typeof _0x1a7200[_0xaa07('0x21')]===_0xaa07('0x22')&&typeof _0x1a7200[_0xaa07('0x23')]===_0xaa07('0x22');var _0x2a0f7c=_0xfd0275[_0xaa07('0x24')];var _0x2f3af7=_0x23c555?0x0:_0x1a7200[_0xaa07('0x21')];var _0x1b9d08=_0x23c555?_0xfd0275[_0xaa07('0x24')]:_0x1a7200[_0xaa07('0x21')]+_0x1a7200['limit'];var _0x207e48;if(_0x1b9d08>=_0x2a0f7c){_0x1b9d08=_0x2a0f7c;_0x207e48=0xc8;}else{_0x207e48=0xce;}_0x4c3f3e[_0xaa07('0x1f')](_0x207e48);return _0x4c3f3e[_0xaa07('0x25')]('Content-Range',_0x2f3af7+'-'+_0x1b9d08+'/'+_0x2a0f7c)[_0xaa07('0x20')](_0xfd0275);}return null;};}function saveUpdates(_0x46c2cf){return function(_0x4d54dd){if(_0x4d54dd){return _0x4d54dd[_0xaa07('0x26')](_0x46c2cf)[_0xaa07('0x15')](function(_0x623e1b){return _0x623e1b;});}return null;};}function removeEntity(_0x5cc068){return function(_0x31f41a){if(_0x31f41a){return _0x31f41a[_0xaa07('0x27')]()[_0xaa07('0x15')](function(){_0x5cc068['status'](0xcc)[_0xaa07('0x28')]();});}};}function handleEntityNotFound(_0x25b2a2){return function(_0x422fb9){if(!_0x422fb9){_0x25b2a2[_0xaa07('0x29')](0x194);}return _0x422fb9;};}function handleError(_0x32180d,_0x39feaf){_0x39feaf=_0x39feaf||0x1f4;return function(_0x283d65){logger[_0xaa07('0x1a')](_0x283d65['stack']);if(_0x283d65[_0xaa07('0x2a')]){delete _0x283d65[_0xaa07('0x2a')];}_0x32180d[_0xaa07('0x1f')](_0x39feaf)[_0xaa07('0x2b')](_0x283d65);};}exports[_0xaa07('0x2c')]=function(_0x39f6a3,_0x4b92a1){var _0x52812f={},_0x22075d={},_0x2befcc={'count':0x0,'rows':[]};var _0x3745e6=_['map'](db[_0xaa07('0x2d')][_0xaa07('0x2e')],function(_0x238199){return{'name':_0x238199[_0xaa07('0x2f')],'type':_0x238199[_0xaa07('0x30')][_0xaa07('0x31')]};});_0x22075d[_0xaa07('0x32')]=_[_0xaa07('0x33')](_0x3745e6,_0xaa07('0x2a'));_0x22075d[_0xaa07('0x34')]=_[_0xaa07('0x35')](_0x39f6a3[_0xaa07('0x34')]);_0x22075d[_0xaa07('0x36')]=_[_0xaa07('0x37')](_0x22075d[_0xaa07('0x32')],_0x22075d[_0xaa07('0x34')]);_0x52812f[_0xaa07('0x38')]=_[_0xaa07('0x37')](_0x22075d[_0xaa07('0x32')],qs['fields'](_0x39f6a3[_0xaa07('0x34')][_0xaa07('0x39')]));_0x52812f[_0xaa07('0x38')]=_0x52812f[_0xaa07('0x38')][_0xaa07('0x3a')]?_0x52812f['attributes']:_0x22075d[_0xaa07('0x32')];if(!_0x39f6a3['query'][_0xaa07('0x3b')](_0xaa07('0x3c'))){_0x52812f[_0xaa07('0x23')]=qs[_0xaa07('0x23')](_0x39f6a3[_0xaa07('0x34')][_0xaa07('0x23')]);_0x52812f[_0xaa07('0x21')]=qs['offset'](_0x39f6a3[_0xaa07('0x34')]['offset']);}_0x52812f[_0xaa07('0x3d')]=qs[_0xaa07('0x3e')](_0x39f6a3[_0xaa07('0x34')][_0xaa07('0x3e')]);_0x52812f[_0xaa07('0x3f')]=qs[_0xaa07('0x36')](_[_0xaa07('0x40')](_0x39f6a3['query'],_0x22075d[_0xaa07('0x36')]),_0x3745e6);if(_0x39f6a3['query'][_0xaa07('0x41')]){_0x52812f['where']=_[_0xaa07('0x42')](_0x52812f['where'],{'$or':_[_0xaa07('0x33')](_0x3745e6,function(_0x92cde6){if(_0x92cde6[_0xaa07('0x30')]!=='VIRTUAL'){var _0x2f0e91={};_0x2f0e91[_0x92cde6[_0xaa07('0x2a')]]={'$like':'%'+_0x39f6a3['query'][_0xaa07('0x41')]+'%'};return _0x2f0e91;}})});}_0x52812f=_[_0xaa07('0x42')]({},_0x52812f,_0x39f6a3['options']);var _0x3d7f80={'where':_0x52812f[_0xaa07('0x3f')]};return db[_0xaa07('0x2d')][_0xaa07('0x24')](_0x3d7f80)['then'](function(_0x1307d3){_0x2befcc[_0xaa07('0x24')]=_0x1307d3;if(_0x39f6a3['query']['includeAll']){_0x52812f[_0xaa07('0x43')]=[{'all':!![]}];}return db[_0xaa07('0x2d')][_0xaa07('0x44')](_0x52812f);})[_0xaa07('0x15')](function(_0x44e8b1){_0x2befcc[_0xaa07('0x45')]=_0x44e8b1;return _0x2befcc;})[_0xaa07('0x15')](respondWithFilteredResult(_0x4b92a1,_0x52812f))[_0xaa07('0x1e')](handleError(_0x4b92a1,null));};exports[_0xaa07('0x46')]=function(_0xc52208,_0xd56fdb){var _0x134da7={'raw':!![],'where':{'id':_0xc52208[_0xaa07('0x47')]['id']}},_0x3aded5={};_0x3aded5[_0xaa07('0x32')]=_[_0xaa07('0x35')](db['MailMessage'][_0xaa07('0x2e')]);_0x3aded5[_0xaa07('0x34')]=_['keys'](_0xc52208[_0xaa07('0x34')]);_0x3aded5[_0xaa07('0x36')]=_['intersection'](_0x3aded5[_0xaa07('0x32')],_0x3aded5[_0xaa07('0x34')]);_0x134da7[_0xaa07('0x38')]=_[_0xaa07('0x37')](_0x3aded5[_0xaa07('0x32')],qs[_0xaa07('0x39')](_0xc52208[_0xaa07('0x34')][_0xaa07('0x39')]));_0x134da7[_0xaa07('0x38')]=_0x134da7[_0xaa07('0x38')][_0xaa07('0x3a')]?_0x134da7['attributes']:_0x3aded5[_0xaa07('0x32')];if(_0xc52208[_0xaa07('0x34')][_0xaa07('0x48')]){_0x134da7[_0xaa07('0x43')]=[{'all':!![]}];}_0x134da7=_[_0xaa07('0x42')]({},_0x134da7,_0xc52208[_0xaa07('0x49')]);return db['MailMessage'][_0xaa07('0x4a')](_0x134da7)[_0xaa07('0x15')](handleEntityNotFound(_0xd56fdb,null))[_0xaa07('0x15')](respondWithResult(_0xd56fdb,null))[_0xaa07('0x1e')](handleError(_0xd56fdb,null));};exports[_0xaa07('0x26')]=function(_0x10ba04,_0x4375d1){if(_0x10ba04[_0xaa07('0x4b')]['id']){delete _0x10ba04['body']['id'];}return db['MailMessage']['find']({'where':{'id':_0x10ba04[_0xaa07('0x47')]['id']}})[_0xaa07('0x15')](handleEntityNotFound(_0x4375d1,null))[_0xaa07('0x15')](saveUpdates(_0x10ba04['body'],null))['then'](respondWithResult(_0x4375d1,null))['catch'](handleError(_0x4375d1,null));};exports['destroy']=function(_0x587955,_0x533897){return db[_0xaa07('0x2d')][_0xaa07('0x4a')]({'where':{'id':_0x587955['params']['id']}})[_0xaa07('0x15')](handleEntityNotFound(_0x533897,null))[_0xaa07('0x15')](removeEntity(_0x533897,null))[_0xaa07('0x1e')](handleError(_0x533897,null));};exports['describe']=function(_0x106e62,_0x53caa6){return db[_0xaa07('0x2d')]['describe']()[_0xaa07('0x15')](respondWithResult(_0x53caa6,null))[_0xaa07('0x1e')](handleError(_0x53caa6,null));};exports[_0xaa07('0x4c')]=function(_0x46f3f7,_0x4f7a9d){return db[_0xaa07('0x2d')][_0xaa07('0x4c')](_0x46f3f7[_0xaa07('0x4b')])['then'](function(_0x2eedd8){if(_0x2eedd8){if(_0x2eedd8[_0xaa07('0x4d')]===_0xaa07('0x4e')&&!_0x2eedd8[_0xaa07('0x4f')]){var _0xf736d4,_0x583c33,_0x17f6ef;if(_0x46f3f7['body']['to']){_0x583c33=_0x46f3f7['body']['to'][_0xaa07('0x50')](',')[0x0];}return db[_0xaa07('0x51')]['findOne']({'where':{'id':_0x2eedd8[_0xaa07('0x52')]},'include':[{'model':db[_0xaa07('0x53')],'as':_0xaa07('0x54'),'include':[{'model':db['CmContact'],'as':_0xaa07('0x55'),'where':{'email':_0x583c33},'limit':0x1,'order':[[_0xaa07('0x56'),'DESC']]}]},{'model':db[_0xaa07('0x57')],'as':_0xaa07('0x58'),'raw':!![],'include':[{'model':db[_0xaa07('0x59')],'as':'CloudProvider','raw':!![]}]}]})[_0xaa07('0x15')](function(_0x1dc13c){_0xf736d4=_0x1dc13c;if(!_0xf736d4||!_0xf736d4[_0xaa07('0x58')])return;var _0x36af97=_0xf736d4[_0xaa07('0x5a')]();if(_0x46f3f7['body'][_0xaa07('0x5b')]&&_0x46f3f7[_0xaa07('0x4b')][_0xaa07('0x5b')][_0xaa07('0x3a')]){for(var _0x464bf0=0x0;_0x464bf0<_0x46f3f7[_0xaa07('0x4b')][_0xaa07('0x5b')][_0xaa07('0x3a')];_0x464bf0+=0x1){_0x46f3f7[_0xaa07('0x4b')][_0xaa07('0x5b')][_0x464bf0]={'filename':_0x46f3f7['body'][_0xaa07('0x5b')][_0x464bf0][_0xaa07('0x2a')],'path':path[_0xaa07('0x5c')](config[_0xaa07('0x5d')],_0xaa07('0x5e'),_0x46f3f7[_0xaa07('0x4b')][_0xaa07('0x5b')][_0x464bf0][_0xaa07('0x5f')])};}}_0x17f6ef={'account':_0x36af97,'message':_0x46f3f7['body']};return;})['then'](function(){if(_0xf736d4['List']){if(_0xf736d4['List']['Contacts'][_0xaa07('0x3a')]){return _0xf736d4[_0xaa07('0x54')]['Contacts'][0x0];}else{return db[_0xaa07('0x60')][_0xaa07('0x4c')](_[_0xaa07('0x61')](_0x46f3f7[_0xaa07('0x4b')],{'firstName':_0x46f3f7[_0xaa07('0x4b')]['to'],'email':_0x46f3f7['body']['to'],'phone':_0x46f3f7[_0xaa07('0x4b')]['to'],'ListId':_0xf736d4[_0xaa07('0x62')]}));}}else{throw new Error(_0xaa07('0x63'));}})['then'](function(){if(_0x17f6ef){return respondWithRpcPromise('SendMail',_0xaa07('0x64'),_0x17f6ef,client9003)[_0xaa07('0x15')](function(_0x271d93){return _0x2eedd8[_0xaa07('0x26')]({'read':!![],'messageId':_0x271d93['messageId'],'sentAt':moment()['format'](_0xaa07('0x65'))});})[_0xaa07('0x1e')](function(_0x51138c){logger[_0xaa07('0x1a')]('%s',JSON[_0xaa07('0x66')](_0x51138c));return _0x2eedd8;});}return _0x2eedd8;});}return _0x2eedd8;}})[_0xaa07('0x15')](respondWithResult(_0x4f7a9d,0xc9))[_0xaa07('0x1e')](handleError(_0x4f7a9d,null));};exports[_0xaa07('0x67')]=function(_0x1d2c03,_0x2d8fe1){var _0x32996d=_0xaa07('0x68');return interactionService[_0xaa07('0x69')](_0x1d2c03,_0x32996d)[_0xaa07('0x15')](respondWithResult(_0x2d8fe1,null))[_0xaa07('0x1e')](handleError(_0x2d8fe1,null));};exports['reject']=function(_0x2de654,_0x1f49a1){var _0xb65dfe={'agent':{},'channel':_0xaa07('0x68')};if(_0x2de654[_0xaa07('0x4b')]['id']){delete _0x2de654[_0xaa07('0x4b')]['id'];}_0x2de654[_0xaa07('0x4b')][_0xaa07('0x6a')]=_0x2de654[_0xaa07('0x4b')][_0xaa07('0x6a')]||_0x2de654['user']['id'];_0xb65dfe['agent']['id']=_0x2de654[_0xaa07('0x4b')][_0xaa07('0x6a')];return db[_0xaa07('0x2d')][_0xaa07('0x4a')]({'where':{'id':_0x2de654['params']['id'],'UserId':null}})[_0xaa07('0x15')](handleEntityNotFound(_0x1f49a1,null))[_0xaa07('0x15')](function(_0x332754){if(_0x332754){_0xb65dfe['message']=_0x332754[_0xaa07('0x6b')]({'plain':!![]});return db['MailInteraction']['find']({'where':{'id':_0x332754[_0xaa07('0x6c')]}});}return null;})[_0xaa07('0x15')](handleEntityNotFound(_0x1f49a1,null))[_0xaa07('0x15')](function(_0x469e74){if(_0x469e74){_0xb65dfe[_0xaa07('0x6d')]=_0x469e74[_0xaa07('0x6b')]({'plain':!![]});interaction_log[_0xaa07('0x16')](_0xaa07('0x6e'),_0x2de654[_0xaa07('0x6f')]['id'],_0x2de654['user'][_0xaa07('0x2a')],_0x2de654[_0xaa07('0x6f')]['role'],_0xb65dfe['interaction']['id'],_0x2de654['body']?JSON['stringify'](_0x2de654[_0xaa07('0x4b')]):_0xaa07('0x70'));return respondWithRpcPromise(_0xaa07('0x71'),_0xaa07('0x72'),_0xb65dfe);}return null;})['then'](function(_0x309147){var _0x584311=_0xaa07('0x73')+_0x309147[_0xaa07('0x1d')][_0xaa07('0x74')];return db[_0xaa07('0x75')][_0xaa07('0x34')](_0x584311,{'type':db[_0xaa07('0x76')][_0xaa07('0x77')][_0xaa07('0x78')],'raw':!![]})[_0xaa07('0x15')](function(_0x381d5a){return _0x381d5a;});})[_0xaa07('0x15')](function(_0xca4090){if(_0xca4090){_0xb65dfe['message'][_0xaa07('0x79')]=_0xca4090[0x0];if(!_0x2de654[_0xaa07('0x4b')]['UserId'])return;return db[_0xaa07('0x7a')][_0xaa07('0x4a')]({'where':{'id':_0x2de654[_0xaa07('0x4b')][_0xaa07('0x6a')],'role':'agent'},'attributes':['id',_0xaa07('0x2a'),_0xaa07('0x7b'),'email','internal'],'raw':!![]});}return null;})[_0xaa07('0x15')](function(_0x4d2ee6){if(!_0x4d2ee6)return null;_0xb65dfe[_0xaa07('0x1d')][_0xaa07('0x7c')]=_0x4d2ee6;return _0xb65dfe;})[_0xaa07('0x15')](function(_0x4382af){if(_0x4382af){_0x4382af[_0xaa07('0x1d')][_0xaa07('0x7d')]=util['format'](_0xaa07('0x7e'),_0x2de654[_0xaa07('0x6f')][_0xaa07('0x2a')]);_0x4382af[_0xaa07('0x1d')][_0xaa07('0x7f')]=_0xb65dfe[_0xaa07('0x7f')];_0x4382af[_0xaa07('0x1d')][_0xaa07('0x80')]=_0xb65dfe['channel'];_0x4382af[_0xaa07('0x1d')][_0xaa07('0x81')]=_0xaa07('0x82');_0x4382af[_0xaa07('0x1d')]['body']=htmlToText['fromString'](_0xb65dfe['message'][_0xaa07('0x4b')]);respondWithRpcPromise(_0xaa07('0x83'),_0xaa07('0x83'),{'event':'rejectmessage','message':_0x4382af[_0xaa07('0x1d')]},client9002);return _0xb65dfe;}return null;})[_0xaa07('0x15')](respondWithResult(_0x1f49a1,null))[_0xaa07('0x1e')](handleError(_0x1f49a1,null));};exports[_0xaa07('0x84')]=function(_0x59d937,_0x5445c4){var _0x203a31=moment()[_0xaa07('0x85')]()['toString']();var _0x21098f=path[_0xaa07('0x5c')](config['root'],'server',_0xaa07('0x86'),_0xaa07('0x87'));var _0x5efb4d=path[_0xaa07('0x5c')](config[_0xaa07('0x5d')],_0xaa07('0x88'),'files',_0xaa07('0x5b'));var _0x4ed940=util['format'](_0xaa07('0x89'),_0x203a31);return db[_0xaa07('0x2d')][_0xaa07('0x4a')]({'where':{'id':_0x59d937['params']['id']},'attributes':['id','body',_0xaa07('0x8a'),'to','cc',_0xaa07('0x8b'),_0xaa07('0x8c'),'createdAt'],'include':_0x59d937[_0xaa07('0x34')][_0xaa07('0x5b')]?[{'model':db[_0xaa07('0x8d')],'as':'Attachments'}]:undefined})['then'](handleEntityNotFound(_0x5445c4,null))[_0xaa07('0x15')](function(_0x23740){if(_0x23740){var _0x3d5842=_0x23740;var _0x37fe9b={'from':_0x3d5842[_0xaa07('0x8a')],'to':_0x3d5842['to'],'subject':_0x3d5842[_0xaa07('0x8c')],'html':htmlEntities[_0xaa07('0x8e')](_0x3d5842['body']),'headers':{'Date':moment(_0x3d5842[_0xaa07('0x8f')])[_0xaa07('0x90')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x23740['cc']){_0x37fe9b[_0xaa07('0x91')]['Cc']=_0x23740['cc'];}if(_0x23740[_0xaa07('0x8b')]){_0x37fe9b[_0xaa07('0x91')][_0xaa07('0x92')]=_0x23740[_0xaa07('0x8b')];}return new Promise(function(_0x5cc815,_0x496504){if(_0x23740[_0xaa07('0x93')]){for(var _0x37fcbf=0x0;_0x37fcbf<_0x23740[_0xaa07('0x93')][_0xaa07('0x3a')];_0x37fcbf++){var _0x4469eb=_0x23740[_0xaa07('0x93')][_0x37fcbf];var _0x3ab04e=path['join'](_0x5efb4d,_0x4469eb[_0xaa07('0x5f')]);if(fs[_0xaa07('0x94')](_0x3ab04e)){_0x37fe9b[_0xaa07('0x5b')][_0xaa07('0x95')]({'name':_0x4469eb[_0xaa07('0x2a')],'contentType':_0x4469eb[_0xaa07('0x30')],'data':fs[_0xaa07('0x96')](_0x3ab04e)});}}}emlformat[_0xaa07('0x97')](_0x37fe9b,function(_0xc44435,_0x1236e4){if(_0xc44435)return _0x496504(_0xc44435);fs[_0xaa07('0x98')](path[_0xaa07('0x5c')](_0x21098f,_0x4ed940),_0x1236e4);return _0x5cc815(_0x1236e4);});});}})[_0xaa07('0x15')](function(_0x1e6ccf){if(_0x1e6ccf){return _0x5445c4['download'](path[_0xaa07('0x5c')](_0x21098f,_0x4ed940),_0x4ed940,function(_0x133c67){if(!_0x133c67)fs[_0xaa07('0x99')](path[_0xaa07('0x5c')](_0x21098f,_0x4ed940));});}})['catch'](handleError(_0x5445c4,null));}; \ No newline at end of file +var _0x68da=['mail','acceptMessage','reject','UserId','user','agent','MailInteraction','MailInteractionId','interaction','get','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','contact','User','fullname','email','interface','channel','motionChannel','fromString','rejectmessage','unix','toString','server','files','message-%s.eml','from','subject','createdAt','Attachment','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','existsSync','push','writeFileSync','download','unlinkSync','eml-format','moment','util','path','lodash','ioredis','html-to-text','../../config/logger','mail-interactions','../../config/environment','../../mysqldb','redis','socket.io-emitter','html-entities','register','jayson/promise','client','http','request','info','MailMessage,\x20%s,\x20%s','request\x20sent','error','code','message','result','status','offset','limit','undefined','count','set','Content-Range','json','update','then','destroy','end','sendStatus','stack','name','send','index','map','MailMessage','rawAttributes','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','filters','pick','where','merge','filter','includeAll','include','findAll','catch','show','params','options','find','body','describe','create','direction','out','secret','split','findOne','MailAccountId','CmList','List','Contacts','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','root','basename','CmContact','defaults','ListId','SendMail','sendMail','messageId','format','stringify','accept'];(function(_0x25806d,_0x115548){var _0x2f08d5=function(_0x5597df){while(--_0x5597df){_0x25806d['push'](_0x25806d['shift']());}};_0x2f08d5(++_0x115548);}(_0x68da,0x1eb));var _0xa68d=function(_0x2166a3,_0x237c50){_0x2166a3=_0x2166a3-0x0;var _0x260035=_0x68da[_0x2166a3];return _0x260035;};'use strict';var emlformat=require(_0xa68d('0x0'));var moment=require(_0xa68d('0x1'));var util=require(_0xa68d('0x2'));var path=require(_0xa68d('0x3'));var fs=require('fs');var _=require(_0xa68d('0x4'));var Redis=require(_0xa68d('0x5'));var htmlToText=require(_0xa68d('0x6'));var interactionService=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var logger=require(_0xa68d('0x7'))('api');var interaction_log=require(_0xa68d('0x7'))(_0xa68d('0x8'));var config=require(_0xa68d('0x9'));var db=require(_0xa68d('0xa'))['db'];config[_0xa68d('0xb')]=_['defaults'](config[_0xa68d('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xa68d('0xc'))(new Redis(config[_0xa68d('0xb')]));var htmlEntities=require(_0xa68d('0xd'));require('./mailMessage.socket')[_0xa68d('0xe')](socket);var jayson=require(_0xa68d('0xf'));var client=jayson[_0xa68d('0x10')]['http']({'port':0x232c});var client9003=jayson[_0xa68d('0x10')][_0xa68d('0x11')]({'port':0x232b});var client9002=jayson[_0xa68d('0x10')][_0xa68d('0x11')]({'port':0x232a});function respondWithRpcPromise(_0x2e7ab2,_0x3b1a11,_0x2edf57,_0x3906e3){return new Promise(function(_0x49ffd8,_0x23e74d){var _0x3d48c7=_0x3906e3||client;return _0x3d48c7[_0xa68d('0x12')](_0x2e7ab2,_0x2edf57)['then'](function(_0x4aa6f4){logger[_0xa68d('0x13')](_0xa68d('0x14'),_0x3b1a11,_0xa68d('0x15'));logger['debug']('MailMessage,\x20%s,\x20%s,\x20%s',_0x3b1a11,_0xa68d('0x15'),JSON['stringify'](_0x4aa6f4));if(_0x4aa6f4[_0xa68d('0x16')]){if(_0x4aa6f4[_0xa68d('0x16')][_0xa68d('0x17')]===0x1f4){logger[_0xa68d('0x16')](_0xa68d('0x14'),_0x3b1a11,_0x4aa6f4[_0xa68d('0x16')][_0xa68d('0x18')]);return _0x23e74d(_0x4aa6f4[_0xa68d('0x16')]['message']);}logger[_0xa68d('0x16')](_0xa68d('0x14'),_0x3b1a11,_0x4aa6f4[_0xa68d('0x16')]['message']);return _0x49ffd8(_0x4aa6f4[_0xa68d('0x16')][_0xa68d('0x18')]);}else{logger[_0xa68d('0x13')](_0xa68d('0x14'),_0x3b1a11,'request\x20sent');_0x49ffd8(_0x4aa6f4[_0xa68d('0x19')]['message']);}})['catch'](function(_0x3c740e){logger[_0xa68d('0x16')](_0xa68d('0x14'),_0x3b1a11,_0x3c740e);_0x23e74d(_0x3c740e);});});}function respondWithResult(_0x5b20fc,_0x557b86){_0x557b86=_0x557b86||0xc8;return function(_0x5333fa){if(_0x5333fa){return _0x5b20fc[_0xa68d('0x1a')](_0x557b86)['json'](_0x5333fa);}};}function respondWithFilteredResult(_0x50a31b,_0x307f31){return function(_0x2ae015){if(_0x2ae015){var _0x3c5df3=typeof _0x307f31[_0xa68d('0x1b')]==='undefined'&&typeof _0x307f31[_0xa68d('0x1c')]===_0xa68d('0x1d');var _0x10e910=_0x2ae015['count'];var _0xdf8aff=_0x3c5df3?0x0:_0x307f31[_0xa68d('0x1b')];var _0x5ec317=_0x3c5df3?_0x2ae015[_0xa68d('0x1e')]:_0x307f31[_0xa68d('0x1b')]+_0x307f31[_0xa68d('0x1c')];var _0x4558b9;if(_0x5ec317>=_0x10e910){_0x5ec317=_0x10e910;_0x4558b9=0xc8;}else{_0x4558b9=0xce;}_0x50a31b[_0xa68d('0x1a')](_0x4558b9);return _0x50a31b[_0xa68d('0x1f')](_0xa68d('0x20'),_0xdf8aff+'-'+_0x5ec317+'/'+_0x10e910)[_0xa68d('0x21')](_0x2ae015);}return null;};}function saveUpdates(_0x3e3f19){return function(_0x4159a4){if(_0x4159a4){return _0x4159a4[_0xa68d('0x22')](_0x3e3f19)[_0xa68d('0x23')](function(_0x25cb58){return _0x25cb58;});}return null;};}function removeEntity(_0x115fe3){return function(_0x171d7f){if(_0x171d7f){return _0x171d7f[_0xa68d('0x24')]()[_0xa68d('0x23')](function(){_0x115fe3[_0xa68d('0x1a')](0xcc)[_0xa68d('0x25')]();});}};}function handleEntityNotFound(_0x18dc5b){return function(_0x1e31dd){if(!_0x1e31dd){_0x18dc5b[_0xa68d('0x26')](0x194);}return _0x1e31dd;};}function handleError(_0x9d8894,_0x7b0ae){_0x7b0ae=_0x7b0ae||0x1f4;return function(_0x2b8598){logger[_0xa68d('0x16')](_0x2b8598[_0xa68d('0x27')]);if(_0x2b8598[_0xa68d('0x28')]){delete _0x2b8598[_0xa68d('0x28')];}_0x9d8894['status'](_0x7b0ae)[_0xa68d('0x29')](_0x2b8598);};}exports[_0xa68d('0x2a')]=function(_0x560440,_0x5181a7){var _0x31341c={},_0x1e2dd3={},_0x333e6e={'count':0x0,'rows':[]};var _0x5c0b5b=_[_0xa68d('0x2b')](db[_0xa68d('0x2c')][_0xa68d('0x2d')],function(_0x456e05){return{'name':_0x456e05['fieldName'],'type':_0x456e05[_0xa68d('0x2e')][_0xa68d('0x2f')]};});_0x1e2dd3[_0xa68d('0x30')]=_[_0xa68d('0x2b')](_0x5c0b5b,_0xa68d('0x28'));_0x1e2dd3[_0xa68d('0x31')]=_[_0xa68d('0x32')](_0x560440[_0xa68d('0x31')]);_0x1e2dd3['filters']=_['intersection'](_0x1e2dd3[_0xa68d('0x30')],_0x1e2dd3['query']);_0x31341c[_0xa68d('0x33')]=_[_0xa68d('0x34')](_0x1e2dd3[_0xa68d('0x30')],qs[_0xa68d('0x35')](_0x560440[_0xa68d('0x31')][_0xa68d('0x35')]));_0x31341c[_0xa68d('0x33')]=_0x31341c[_0xa68d('0x33')][_0xa68d('0x36')]?_0x31341c[_0xa68d('0x33')]:_0x1e2dd3[_0xa68d('0x30')];if(!_0x560440[_0xa68d('0x31')][_0xa68d('0x37')](_0xa68d('0x38'))){_0x31341c[_0xa68d('0x1c')]=qs[_0xa68d('0x1c')](_0x560440['query'][_0xa68d('0x1c')]);_0x31341c[_0xa68d('0x1b')]=qs[_0xa68d('0x1b')](_0x560440['query'][_0xa68d('0x1b')]);}_0x31341c['order']=qs[_0xa68d('0x39')](_0x560440['query'][_0xa68d('0x39')]);_0x31341c['where']=qs[_0xa68d('0x3a')](_[_0xa68d('0x3b')](_0x560440[_0xa68d('0x31')],_0x1e2dd3['filters']),_0x5c0b5b);if(_0x560440['query']['filter']){_0x31341c[_0xa68d('0x3c')]=_[_0xa68d('0x3d')](_0x31341c[_0xa68d('0x3c')],{'$or':_[_0xa68d('0x2b')](_0x5c0b5b,function(_0x317a49){if(_0x317a49[_0xa68d('0x2e')]!=='VIRTUAL'){var _0x10e4fb={};_0x10e4fb[_0x317a49['name']]={'$like':'%'+_0x560440[_0xa68d('0x31')][_0xa68d('0x3e')]+'%'};return _0x10e4fb;}})});}_0x31341c=_['merge']({},_0x31341c,_0x560440['options']);var _0x582778={'where':_0x31341c['where']};return db[_0xa68d('0x2c')][_0xa68d('0x1e')](_0x582778)['then'](function(_0x2709b4){_0x333e6e[_0xa68d('0x1e')]=_0x2709b4;if(_0x560440[_0xa68d('0x31')][_0xa68d('0x3f')]){_0x31341c[_0xa68d('0x40')]=[{'all':!![]}];}return db[_0xa68d('0x2c')][_0xa68d('0x41')](_0x31341c);})[_0xa68d('0x23')](function(_0x4ef417){_0x333e6e['rows']=_0x4ef417;return _0x333e6e;})['then'](respondWithFilteredResult(_0x5181a7,_0x31341c))[_0xa68d('0x42')](handleError(_0x5181a7,null));};exports[_0xa68d('0x43')]=function(_0x3acb05,_0x1bcc0e){var _0x2b0244={'raw':!![],'where':{'id':_0x3acb05[_0xa68d('0x44')]['id']}},_0x3665c6={};_0x3665c6[_0xa68d('0x30')]=_[_0xa68d('0x32')](db[_0xa68d('0x2c')][_0xa68d('0x2d')]);_0x3665c6[_0xa68d('0x31')]=_['keys'](_0x3acb05[_0xa68d('0x31')]);_0x3665c6[_0xa68d('0x3a')]=_['intersection'](_0x3665c6[_0xa68d('0x30')],_0x3665c6[_0xa68d('0x31')]);_0x2b0244['attributes']=_[_0xa68d('0x34')](_0x3665c6[_0xa68d('0x30')],qs[_0xa68d('0x35')](_0x3acb05[_0xa68d('0x31')][_0xa68d('0x35')]));_0x2b0244[_0xa68d('0x33')]=_0x2b0244[_0xa68d('0x33')][_0xa68d('0x36')]?_0x2b0244[_0xa68d('0x33')]:_0x3665c6[_0xa68d('0x30')];if(_0x3acb05['query'][_0xa68d('0x3f')]){_0x2b0244[_0xa68d('0x40')]=[{'all':!![]}];}_0x2b0244=_['merge']({},_0x2b0244,_0x3acb05[_0xa68d('0x45')]);return db[_0xa68d('0x2c')][_0xa68d('0x46')](_0x2b0244)[_0xa68d('0x23')](handleEntityNotFound(_0x1bcc0e,null))[_0xa68d('0x23')](respondWithResult(_0x1bcc0e,null))[_0xa68d('0x42')](handleError(_0x1bcc0e,null));};exports['update']=function(_0x399951,_0x507c7b){if(_0x399951[_0xa68d('0x47')]['id']){delete _0x399951[_0xa68d('0x47')]['id'];}return db[_0xa68d('0x2c')][_0xa68d('0x46')]({'where':{'id':_0x399951[_0xa68d('0x44')]['id']}})['then'](handleEntityNotFound(_0x507c7b,null))[_0xa68d('0x23')](saveUpdates(_0x399951[_0xa68d('0x47')],null))[_0xa68d('0x23')](respondWithResult(_0x507c7b,null))[_0xa68d('0x42')](handleError(_0x507c7b,null));};exports[_0xa68d('0x24')]=function(_0x310811,_0x46ae11){return db[_0xa68d('0x2c')][_0xa68d('0x46')]({'where':{'id':_0x310811[_0xa68d('0x44')]['id']}})[_0xa68d('0x23')](handleEntityNotFound(_0x46ae11,null))[_0xa68d('0x23')](removeEntity(_0x46ae11,null))['catch'](handleError(_0x46ae11,null));};exports[_0xa68d('0x48')]=function(_0xdc293c,_0x2e32cb){return db[_0xa68d('0x2c')][_0xa68d('0x48')]()[_0xa68d('0x23')](respondWithResult(_0x2e32cb,null))[_0xa68d('0x42')](handleError(_0x2e32cb,null));};exports[_0xa68d('0x49')]=function(_0x2fa6c1,_0x2efeba){return db[_0xa68d('0x2c')]['create'](_0x2fa6c1[_0xa68d('0x47')])[_0xa68d('0x23')](function(_0x3cf782){if(_0x3cf782){if(_0x3cf782[_0xa68d('0x4a')]===_0xa68d('0x4b')&&!_0x3cf782[_0xa68d('0x4c')]){var _0x2b83ee,_0x4aebe0,_0x167d60;if(_0x2fa6c1[_0xa68d('0x47')]['to']){_0x4aebe0=_0x2fa6c1['body']['to'][_0xa68d('0x4d')](',')[0x0];}return db['MailAccount'][_0xa68d('0x4e')]({'where':{'id':_0x3cf782[_0xa68d('0x4f')]},'include':[{'model':db[_0xa68d('0x50')],'as':_0xa68d('0x51'),'include':[{'model':db['CmContact'],'as':_0xa68d('0x52'),'where':{'email':_0x4aebe0},'limit':0x1,'order':[['updatedAt',_0xa68d('0x53')]]}]},{'model':db[_0xa68d('0x54')],'as':_0xa68d('0x55'),'raw':!![],'include':[{'model':db[_0xa68d('0x56')],'as':'CloudProvider','raw':!![]}]}]})['then'](function(_0x7bcdad){_0x2b83ee=_0x7bcdad;if(!_0x2b83ee||!_0x2b83ee['Smtp'])return;var _0x5cf2c2=_0x2b83ee[_0xa68d('0x57')]();if(_0x2fa6c1[_0xa68d('0x47')][_0xa68d('0x58')]&&_0x2fa6c1['body'][_0xa68d('0x58')]['length']){for(var _0x2bd6e=0x0;_0x2bd6e<_0x2fa6c1[_0xa68d('0x47')][_0xa68d('0x58')][_0xa68d('0x36')];_0x2bd6e+=0x1){_0x2fa6c1[_0xa68d('0x47')]['attachments'][_0x2bd6e]={'filename':_0x2fa6c1[_0xa68d('0x47')][_0xa68d('0x58')][_0x2bd6e]['name'],'path':path[_0xa68d('0x59')](config[_0xa68d('0x5a')],'server/files/attachments',_0x2fa6c1[_0xa68d('0x47')][_0xa68d('0x58')][_0x2bd6e][_0xa68d('0x5b')])};}}_0x167d60={'account':_0x5cf2c2,'message':_0x2fa6c1[_0xa68d('0x47')]};return;})['then'](function(){if(_0x2b83ee[_0xa68d('0x51')]){if(_0x2b83ee[_0xa68d('0x51')][_0xa68d('0x52')]['length']){return _0x2b83ee['List'][_0xa68d('0x52')][0x0];}else{return db[_0xa68d('0x5c')]['create'](_[_0xa68d('0x5d')](_0x2fa6c1['body'],{'firstName':_0x2fa6c1[_0xa68d('0x47')]['to'],'email':_0x2fa6c1[_0xa68d('0x47')]['to'],'phone':_0x2fa6c1[_0xa68d('0x47')]['to'],'ListId':_0x2b83ee[_0xa68d('0x5e')]}));}}else{throw new Error('List\x20not\x20found');}})[_0xa68d('0x23')](function(){if(_0x167d60){return respondWithRpcPromise(_0xa68d('0x5f'),_0xa68d('0x60'),_0x167d60,client9003)[_0xa68d('0x23')](function(_0x46ea85){return _0x3cf782[_0xa68d('0x22')]({'read':!![],'messageId':_0x46ea85[_0xa68d('0x61')],'sentAt':moment()[_0xa68d('0x62')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0xa68d('0x42')](function(_0x5852d9){logger[_0xa68d('0x16')]('%s',JSON[_0xa68d('0x63')](_0x5852d9));return _0x3cf782;});}return _0x3cf782;});}return _0x3cf782;}})[_0xa68d('0x23')](respondWithResult(_0x2efeba,0xc9))['catch'](handleError(_0x2efeba,null));};exports[_0xa68d('0x64')]=function(_0x3b67a9,_0x125d1a){var _0x22a7a9=_0xa68d('0x65');return interactionService[_0xa68d('0x66')](_0x3b67a9,_0x22a7a9)[_0xa68d('0x23')](respondWithResult(_0x125d1a,null))[_0xa68d('0x42')](handleError(_0x125d1a,null));};exports[_0xa68d('0x67')]=function(_0x6c027a,_0x479ff1){var _0x297c56={'agent':{},'channel':_0xa68d('0x65')};if(_0x6c027a[_0xa68d('0x47')]['id']){delete _0x6c027a[_0xa68d('0x47')]['id'];}_0x6c027a[_0xa68d('0x47')][_0xa68d('0x68')]=_0x6c027a[_0xa68d('0x47')][_0xa68d('0x68')]||_0x6c027a[_0xa68d('0x69')]['id'];_0x297c56[_0xa68d('0x6a')]['id']=_0x6c027a[_0xa68d('0x47')][_0xa68d('0x68')];return db['MailMessage'][_0xa68d('0x46')]({'where':{'id':_0x6c027a[_0xa68d('0x44')]['id'],'UserId':null}})[_0xa68d('0x23')](handleEntityNotFound(_0x479ff1,null))[_0xa68d('0x23')](function(_0x35327e){if(_0x35327e){_0x297c56[_0xa68d('0x18')]=_0x35327e['get']({'plain':!![]});return db[_0xa68d('0x6b')][_0xa68d('0x46')]({'where':{'id':_0x35327e[_0xa68d('0x6c')]}});}return null;})[_0xa68d('0x23')](handleEntityNotFound(_0x479ff1,null))[_0xa68d('0x23')](function(_0x41f0cc){if(_0x41f0cc){_0x297c56[_0xa68d('0x6d')]=_0x41f0cc[_0xa68d('0x6e')]({'plain':!![]});interaction_log[_0xa68d('0x13')](_0xa68d('0x6f'),_0x6c027a[_0xa68d('0x69')]['id'],_0x6c027a['user'][_0xa68d('0x28')],_0x6c027a[_0xa68d('0x69')][_0xa68d('0x70')],_0x297c56['interaction']['id'],_0x6c027a['body']?JSON[_0xa68d('0x63')](_0x6c027a[_0xa68d('0x47')]):'null');return respondWithRpcPromise('RejectMessage',_0xa68d('0x71'),_0x297c56);}return null;})[_0xa68d('0x23')](function(_0x29218f){var _0xd208b2=_0xa68d('0x72')+_0x29218f[_0xa68d('0x18')][_0xa68d('0x73')];return db[_0xa68d('0x74')][_0xa68d('0x31')](_0xd208b2,{'type':db[_0xa68d('0x75')][_0xa68d('0x76')]['SELECT'],'raw':!![]})[_0xa68d('0x23')](function(_0x33c2b7){return _0x33c2b7;});})['then'](function(_0x2bba36){if(_0x2bba36){_0x297c56[_0xa68d('0x18')][_0xa68d('0x77')]=_0x2bba36[0x0];if(!_0x6c027a[_0xa68d('0x47')][_0xa68d('0x68')])return;return db[_0xa68d('0x78')][_0xa68d('0x46')]({'where':{'id':_0x6c027a['body'][_0xa68d('0x68')],'role':_0xa68d('0x6a')},'attributes':['id','name',_0xa68d('0x79'),_0xa68d('0x7a'),'internal'],'raw':!![]});}return null;})[_0xa68d('0x23')](function(_0x5fdc56){if(!_0x5fdc56)return null;_0x297c56[_0xa68d('0x18')][_0xa68d('0x6a')]=_0x5fdc56;return _0x297c56;})[_0xa68d('0x23')](function(_0x1ed30c){if(_0x1ed30c){_0x1ed30c[_0xa68d('0x18')][_0xa68d('0x7b')]=util['format']('SIP/%s',_0x6c027a[_0xa68d('0x69')][_0xa68d('0x28')]);_0x1ed30c['message']['channel']=_0x297c56[_0xa68d('0x7c')];_0x1ed30c[_0xa68d('0x18')][_0xa68d('0x7d')]=_0x297c56[_0xa68d('0x7c')];_0x1ed30c[_0xa68d('0x18')]['event']=_0xa68d('0x67');_0x1ed30c[_0xa68d('0x18')][_0xa68d('0x47')]=htmlToText[_0xa68d('0x7e')](_0x297c56[_0xa68d('0x18')][_0xa68d('0x47')]);respondWithRpcPromise('EventManager','EventManager',{'event':_0xa68d('0x7f'),'message':_0x1ed30c[_0xa68d('0x18')]},client9002);return _0x297c56;}return null;})[_0xa68d('0x23')](respondWithResult(_0x479ff1,null))['catch'](handleError(_0x479ff1,null));};exports['download']=function(_0xb3175d,_0x4b80a7){var _0x55de30=moment()[_0xa68d('0x80')]()[_0xa68d('0x81')]();var _0x1f1fc2=path['join'](config['root'],_0xa68d('0x82'),_0xa68d('0x83'),'tmp');var _0x21611e=path[_0xa68d('0x59')](config[_0xa68d('0x5a')],_0xa68d('0x82'),_0xa68d('0x83'),_0xa68d('0x58'));var _0x33fb71=util[_0xa68d('0x62')](_0xa68d('0x84'),_0x55de30);return db[_0xa68d('0x2c')][_0xa68d('0x46')]({'where':{'id':_0xb3175d[_0xa68d('0x44')]['id']},'attributes':['id','body',_0xa68d('0x85'),'to','cc','bcc',_0xa68d('0x86'),_0xa68d('0x87')],'include':_0xb3175d[_0xa68d('0x31')][_0xa68d('0x58')]?[{'model':db[_0xa68d('0x88')],'as':_0xa68d('0x89')}]:undefined})[_0xa68d('0x23')](handleEntityNotFound(_0x4b80a7,null))[_0xa68d('0x23')](function(_0x559df8){if(_0x559df8){var _0x1d4a5c=_0x559df8;var _0x166eab={'from':_0x1d4a5c[_0xa68d('0x85')],'to':_0x1d4a5c['to'],'subject':_0x1d4a5c['subject'],'html':htmlEntities[_0xa68d('0x8a')](_0x1d4a5c[_0xa68d('0x47')]),'headers':{'Date':moment(_0x1d4a5c['createdAt'])[_0xa68d('0x62')](_0xa68d('0x8b'))},'attachments':[]};if(_0x559df8['cc']){_0x166eab[_0xa68d('0x8c')]['Cc']=_0x559df8['cc'];}if(_0x559df8[_0xa68d('0x8d')]){_0x166eab[_0xa68d('0x8c')][_0xa68d('0x8e')]=_0x559df8[_0xa68d('0x8d')];}return new Promise(function(_0x1d09ab,_0x4ac6c3){if(_0x559df8[_0xa68d('0x89')]){for(var _0x30aa15=0x0;_0x30aa15<_0x559df8[_0xa68d('0x89')][_0xa68d('0x36')];_0x30aa15++){var _0x1d19c3=_0x559df8[_0xa68d('0x89')][_0x30aa15];var _0x207afc=path[_0xa68d('0x59')](_0x21611e,_0x1d19c3['basename']);if(fs[_0xa68d('0x8f')](_0x207afc)){_0x166eab['attachments'][_0xa68d('0x90')]({'name':_0x1d19c3['name'],'contentType':_0x1d19c3[_0xa68d('0x2e')],'data':fs['readFileSync'](_0x207afc)});}}}emlformat['build'](_0x166eab,function(_0x136083,_0x2c7235){if(_0x136083)return _0x4ac6c3(_0x136083);fs[_0xa68d('0x91')](path[_0xa68d('0x59')](_0x1f1fc2,_0x33fb71),_0x2c7235);return _0x1d09ab(_0x2c7235);});});}})[_0xa68d('0x23')](function(_0x365056){if(_0x365056){return _0x4b80a7[_0xa68d('0x92')](path[_0xa68d('0x59')](_0x1f1fc2,_0x33fb71),_0x33fb71,function(_0xdf35df){if(!_0xdf35df)fs[_0xa68d('0x93')](path[_0xa68d('0x59')](_0x1f1fc2,_0x33fb71));});}})[_0xa68d('0x42')](handleError(_0x4b80a7,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 96dd468..08a41d5 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 _0x4d93=['exports','events','../../mysqldb','MailMessage','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x5712f8,_0x17156b){var _0x14a364=function(_0x1da9de){while(--_0x1da9de){_0x5712f8['push'](_0x5712f8['shift']());}};_0x14a364(++_0x17156b);}(_0x4d93,0x169));var _0x34d9=function(_0x53efd8,_0x4610ff){_0x53efd8=_0x53efd8-0x0;var _0x1879d3=_0x4d93[_0x53efd8];return _0x1879d3;};'use strict';var EventEmitter=require(_0x34d9('0x0'));var MailMessage=require(_0x34d9('0x1'))['db'][_0x34d9('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x34d9('0x3')](0x0);var events={'afterCreate':_0x34d9('0x4'),'afterUpdate':'update','afterDestroy':_0x34d9('0x5')};function emitEvent(_0x5263d4){return function(_0x3dc684,_0x4c817a,_0x33063c){MailMessageEvents[_0x34d9('0x6')](_0x5263d4+':'+_0x3dc684['id'],_0x3dc684);MailMessageEvents[_0x34d9('0x6')](_0x5263d4,_0x3dc684);_0x33063c(null);};}for(var e in events){if(events[_0x34d9('0x7')](e)){var event=events[e];MailMessage[_0x34d9('0x8')](e,emitEvent(event));}}module[_0x34d9('0x9')]=MailMessageEvents; \ No newline at end of file +var _0x8308=['exports','events','MailMessage','setMaxListeners','update','emit','hook'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x8308,0x151));var _0x8830=function(_0xd04611,_0x6f7365){_0xd04611=_0xd04611-0x0;var _0x72e2db=_0x8308[_0xd04611];return _0x72e2db;};'use strict';var EventEmitter=require(_0x8830('0x0'));var MailMessage=require('../../mysqldb')['db'][_0x8830('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x8830('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8830('0x3'),'afterDestroy':'remove'};function emitEvent(_0x51f9f1){return function(_0x520ee1,_0x43267c,_0x2e88aa){MailMessageEvents[_0x8830('0x4')](_0x51f9f1+':'+_0x520ee1['id'],_0x520ee1);MailMessageEvents[_0x8830('0x4')](_0x51f9f1,_0x520ee1);_0x2e88aa(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x8830('0x5')](e,emitEvent(event));}}module[_0x8830('0x6')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index bd11f89..faf2c98 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 _0x3d9e=['subject','FULLTEXT','body','models','get','direction','toLowerCase','out','secret','isNil','UserId','MailInteraction','update','createdAt','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','request-promise','path','rimraf','./mailMessage.attributes','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody'];(function(_0x420d3d,_0x31b95d){var _0x3d4235=function(_0x351661){while(--_0x351661){_0x420d3d['push'](_0x420d3d['shift']());}};_0x3d4235(++_0x31b95d);}(_0x3d9e,0x133));var _0xe3d9=function(_0x5caf7e,_0x52e1bc){_0x5caf7e=_0x5caf7e-0x0;var _0x5c3435=_0x3d9e[_0x5caf7e];return _0x5c3435;};'use strict';var _=require(_0xe3d9('0x0'));var util=require('util');var logger=require(_0xe3d9('0x1'))(_0xe3d9('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe3d9('0x3'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0xe3d9('0x4'));var rimraf=require(_0xe3d9('0x5'));var config=require('../../config/environment');var attributes=require(_0xe3d9('0x6'));module['exports']=function(_0x246e06,_0x138cd6){return _0x246e06['define'](_0xe3d9('0x7'),attributes,{'tableName':_0xe3d9('0x8'),'paranoid':![],'indexes':[{'name':_0xe3d9('0x9'),'fields':[_0xe3d9('0x9')]},{'name':_0xe3d9('0xa'),'fields':[_0xe3d9('0xb'),_0xe3d9('0xc')],'type':_0xe3d9('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4a596a,_0x1e7860,_0x4b2222){if(_0x4a596a[_0xe3d9('0xe')]){_0x4a596a[_0xe3d9('0xb')]=htmlToText['fromString'](_0x4a596a['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x4b2222(null,_0x1e7860);},'afterCreate':function(_0x18ca13,_0x573f58,_0x5e95c9){var _0x3921d8=_0x246e06[_0xe3d9('0xf')];var _0x1f75ba=_0x18ca13[_0xe3d9('0x10')]({'plain':!![]});if(_0x1f75ba[_0xe3d9('0x11')][_0xe3d9('0x12')]()==='in'||_0x1f75ba[_0xe3d9('0x11')][_0xe3d9('0x12')]()===_0xe3d9('0x13')&&!_0x1f75ba[_0xe3d9('0x14')]&&!_[_0xe3d9('0x15')](_0x1f75ba[_0xe3d9('0x16')])){_0x3921d8[_0xe3d9('0x17')]['findOne']({'where':{'id':_0x1f75ba['MailInteractionId']}})['then'](function(_0x16436f){if(_0x16436f){_0x16436f[_0xe3d9('0x18')]({'lastMsgAt':_0x1f75ba[_0xe3d9('0x19')],'lastMsgDirection':_0x1f75ba[_0xe3d9('0x11')][_0xe3d9('0x12')]()});}})['catch'](function(_0x3e14fb){console[_0xe3d9('0x1a')](_0x3e14fb);});}_0x5e95c9();}},'charset':_0xe3d9('0x1b'),'collate':_0xe3d9('0x1c')});}; \ No newline at end of file +var _0x5041=['direction','toLowerCase','out','secret','UserId','MailInteraction','MailInteractionId','then','update','catch','error','util','../../config/logger','bluebird','request-promise','path','../../config/environment','./mailMessage.attributes','define','MailMessage','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','fromString','models','get'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x5041,0x12d));var _0x1504=function(_0x2726fe,_0x270860){_0x2726fe=_0x2726fe-0x0;var _0x37108e=_0x5041[_0x2726fe];return _0x37108e;};'use strict';var _=require('lodash');var util=require(_0x1504('0x0'));var logger=require(_0x1504('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1504('0x2'));var rp=require(_0x1504('0x3'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0x1504('0x4'));var rimraf=require('rimraf');var config=require(_0x1504('0x5'));var attributes=require(_0x1504('0x6'));module['exports']=function(_0x482be5,_0x3ae6e2){return _0x482be5[_0x1504('0x7')](_0x1504('0x8'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0x1504('0x9')]},{'name':_0x1504('0xa'),'fields':[_0x1504('0xb'),_0x1504('0xc')],'type':_0x1504('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4b1839,_0x59bdbc,_0x47b399){if(_0x4b1839[_0x1504('0xe')]){_0x4b1839[_0x1504('0xb')]=htmlToText[_0x1504('0xf')](_0x4b1839[_0x1504('0xe')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x47b399(null,_0x59bdbc);},'afterCreate':function(_0x3c91c5,_0x1b315f,_0x301f02){var _0x517ebc=_0x482be5[_0x1504('0x10')];var _0x58ec0b=_0x3c91c5[_0x1504('0x11')]({'plain':!![]});if(_0x58ec0b[_0x1504('0x12')][_0x1504('0x13')]()==='in'||_0x58ec0b[_0x1504('0x12')]['toLowerCase']()===_0x1504('0x14')&&!_0x58ec0b[_0x1504('0x15')]&&!_['isNil'](_0x58ec0b[_0x1504('0x16')])){_0x517ebc[_0x1504('0x17')]['findOne']({'where':{'id':_0x58ec0b[_0x1504('0x18')]}})[_0x1504('0x19')](function(_0x4082e0){if(_0x4082e0){_0x4082e0[_0x1504('0x1a')]({'lastMsgAt':_0x58ec0b['createdAt'],'lastMsgDirection':_0x58ec0b['direction'][_0x1504('0x13')]()});}})[_0x1504('0x1b')](function(_0x455e61){console[_0x1504('0x1c')](_0x455e61);});}_0x301f02();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 6df95fc..f136411 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 _0x1893=['result','MailMessage','body','options','CreateMailMessage','debug','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0xe0d5ef,_0x5e238c){var _0xfa7ccc=function(_0x281a07){while(--_0x281a07){_0xe0d5ef['push'](_0xe0d5ef['shift']());}};_0xfa7ccc(++_0x5e238c);}(_0x1893,0xa2));var _0x3189=function(_0x51bdda,_0x5666ca){_0x51bdda=_0x51bdda-0x0;var _0x998aab=_0x1893[_0x51bdda];return _0x998aab;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3189('0x0'));var BPromise=require(_0x3189('0x1'));var rs=require(_0x3189('0x2'));var fs=require('fs');var Redis=require(_0x3189('0x3'));var db=require(_0x3189('0x4'))['db'];var utils=require(_0x3189('0x5'));var logger=require(_0x3189('0x6'))('rpc');var config=require(_0x3189('0x7'));var jayson=require(_0x3189('0x8'));var client=jayson[_0x3189('0x9')][_0x3189('0xa')]({'port':0x232a});config[_0x3189('0xb')]=_[_0x3189('0xc')](config[_0x3189('0xb')],{'host':_0x3189('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3189('0xb')]));require('./mailMessage.socket')[_0x3189('0xe')](socket);function respondWithRpcPromise(_0x4ac683,_0x3ec9d0,_0x33cdfb){return new BPromise(function(_0xca480c,_0x176799){return client['request'](_0x4ac683,_0x33cdfb)[_0x3189('0xf')](function(_0x149428){logger[_0x3189('0x10')](_0x3189('0x11'),_0x3ec9d0,_0x3189('0x12'));logger['debug'](_0x3189('0x13'),_0x3ec9d0,_0x3189('0x12'),JSON[_0x3189('0x14')](_0x149428));if(_0x149428[_0x3189('0x15')]){if(_0x149428[_0x3189('0x15')][_0x3189('0x16')]===0x1f4){logger[_0x3189('0x15')](_0x3189('0x11'),_0x3ec9d0,_0x149428['error'][_0x3189('0x17')]);return _0x176799(_0x149428[_0x3189('0x15')][_0x3189('0x17')]);}logger[_0x3189('0x15')]('MailMessage,\x20%s,\x20%s',_0x3ec9d0,_0x149428[_0x3189('0x15')]['message']);return _0xca480c(_0x149428['error'][_0x3189('0x17')]);}else{logger['info'](_0x3189('0x11'),_0x3ec9d0,_0x3189('0x12'));_0xca480c(_0x149428[_0x3189('0x18')][_0x3189('0x17')]);}})['catch'](function(_0xd3d5a){logger[_0x3189('0x15')](_0x3189('0x11'),_0x3ec9d0,_0xd3d5a);_0x176799(_0xd3d5a);});});}exports['CreateMailMessage']=function(_0x561265){var _0xb0e89b=this;return new Promise(function(_0x306ed3,_0x2c1e59){return db[_0x3189('0x19')]['create'](_0x561265[_0x3189('0x1a')],{'raw':_0x561265[_0x3189('0x1b')]?_0x561265[_0x3189('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x3189('0xf')](function(_0x47abb4){logger[_0x3189('0x10')](_0x3189('0x1c'),_0x561265);logger[_0x3189('0x1d')](_0x3189('0x1c'),_0x561265,JSON[_0x3189('0x14')](_0x47abb4));_0x306ed3(_0x47abb4);})[_0x3189('0x1e')](function(_0x5a08dc){logger['error'](_0x3189('0x1c'),_0x5a08dc[_0x3189('0x17')],_0x561265);_0x2c1e59(_0xb0e89b[_0x3189('0x15')](0x1f4,_0x5a08dc[_0x3189('0x17')]));});});}; \ No newline at end of file +var _0xbbbc=['CreateMailMessage','MailMessage','create','body','options','raw','then','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','request','info','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','MailMessage,\x20%s,\x20%s','message','result'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xbbbc,0xf6));var _0xcbbb=function(_0x24c38a,_0x3ee208){_0x24c38a=_0x24c38a-0x0;var _0xd55eb7=_0xbbbc[_0x24c38a];return _0xd55eb7;};'use strict';var _=require(_0xcbbb('0x0'));var util=require(_0xcbbb('0x1'));var moment=require(_0xcbbb('0x2'));var BPromise=require(_0xcbbb('0x3'));var rs=require(_0xcbbb('0x4'));var fs=require('fs');var Redis=require(_0xcbbb('0x5'));var db=require(_0xcbbb('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xcbbb('0x7'))(_0xcbbb('0x8'));var config=require(_0xcbbb('0x9'));var jayson=require(_0xcbbb('0xa'));var client=jayson[_0xcbbb('0xb')]['http']({'port':0x232a});config[_0xcbbb('0xc')]=_[_0xcbbb('0xd')](config[_0xcbbb('0xc')],{'host':_0xcbbb('0xe'),'port':0x18eb});var socket=require(_0xcbbb('0xf'))(new Redis(config[_0xcbbb('0xc')]));require(_0xcbbb('0x10'))['register'](socket);function respondWithRpcPromise(_0x225156,_0x4b0138,_0x5893f9){return new BPromise(function(_0x107c35,_0x56c7d0){return client[_0xcbbb('0x11')](_0x225156,_0x5893f9)['then'](function(_0x3766c2){logger[_0xcbbb('0x12')]('MailMessage,\x20%s,\x20%s',_0x4b0138,_0xcbbb('0x13'));logger['debug'](_0xcbbb('0x14'),_0x4b0138,'request\x20sent',JSON[_0xcbbb('0x15')](_0x3766c2));if(_0x3766c2[_0xcbbb('0x16')]){if(_0x3766c2[_0xcbbb('0x16')]['code']===0x1f4){logger[_0xcbbb('0x16')](_0xcbbb('0x17'),_0x4b0138,_0x3766c2[_0xcbbb('0x16')][_0xcbbb('0x18')]);return _0x56c7d0(_0x3766c2['error']['message']);}logger[_0xcbbb('0x16')](_0xcbbb('0x17'),_0x4b0138,_0x3766c2[_0xcbbb('0x16')][_0xcbbb('0x18')]);return _0x107c35(_0x3766c2['error'][_0xcbbb('0x18')]);}else{logger['info'](_0xcbbb('0x17'),_0x4b0138,_0xcbbb('0x13'));_0x107c35(_0x3766c2[_0xcbbb('0x19')]['message']);}})['catch'](function(_0x4bcd9a){logger[_0xcbbb('0x16')](_0xcbbb('0x17'),_0x4b0138,_0x4bcd9a);_0x56c7d0(_0x4bcd9a);});});}exports[_0xcbbb('0x1a')]=function(_0x25e92f){var _0x658337=this;return new Promise(function(_0x1cca90,_0x45de5f){return db[_0xcbbb('0x1b')][_0xcbbb('0x1c')](_0x25e92f[_0xcbbb('0x1d')],{'raw':_0x25e92f['options']?_0x25e92f[_0xcbbb('0x1e')][_0xcbbb('0x1f')]===undefined?!![]:![]:!![]})[_0xcbbb('0x20')](function(_0x42aaf1){logger[_0xcbbb('0x12')](_0xcbbb('0x1a'),_0x25e92f);logger[_0xcbbb('0x21')](_0xcbbb('0x1a'),_0x25e92f,JSON[_0xcbbb('0x15')](_0x42aaf1));_0x1cca90(_0x42aaf1);})['catch'](function(_0xf39ddd){logger[_0xcbbb('0x16')]('CreateMailMessage',_0xf39ddd[_0xcbbb('0x18')],_0x25e92f);_0x45de5f(_0x658337['error'](0x1f4,_0xf39ddd['message']));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 82caa17..77c5a6d 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 _0xa85a=['mailMessage:','save','update','emit','removeListener','register','length'];(function(_0x5df7bb,_0x58a6a4){var _0x419db2=function(_0xbea27e){while(--_0xbea27e){_0x5df7bb['push'](_0x5df7bb['shift']());}};_0x419db2(++_0x58a6a4);}(_0xa85a,0xcc));var _0xaa85=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0xa85a[_0x17b6e3];return _0x3906f3;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0xaa85('0x0'),'remove',_0xaa85('0x1')];function createListener(_0x27d2a2,_0x247039){return function(_0x38e92a){_0x247039[_0xaa85('0x2')](_0x27d2a2,_0x38e92a);};}function removeListener(_0x44e9dc,_0xa9d0b1){return function(){MailMessageEvents[_0xaa85('0x3')](_0x44e9dc,_0xa9d0b1);};}exports[_0xaa85('0x4')]=function(_0x2709d9){for(var _0xdbf70c=0x0,_0x7da8=events[_0xaa85('0x5')];_0xdbf70c<_0x7da8;_0xdbf70c++){var _0x2a00c5=events[_0xdbf70c];var _0x2148b5=createListener(_0xaa85('0x6')+_0x2a00c5,_0x2709d9);MailMessageEvents['on'](_0x2a00c5,_0x2148b5);}}; \ No newline at end of file +var _0x6db1=['remove','update','emit','removeListener','register','length','./mailMessage.events','save'];(function(_0x4b1a91,_0x80b4c4){var _0xc2fa56=function(_0x198f7d){while(--_0x198f7d){_0x4b1a91['push'](_0x4b1a91['shift']());}};_0xc2fa56(++_0x80b4c4);}(_0x6db1,0x13e));var _0x16db=function(_0x4b7873,_0x14bfda){_0x4b7873=_0x4b7873-0x0;var _0x35a5ee=_0x6db1[_0x4b7873];return _0x35a5ee;};'use strict';var MailMessageEvents=require(_0x16db('0x0'));var events=[_0x16db('0x1'),_0x16db('0x2'),_0x16db('0x3')];function createListener(_0x3d461d,_0x368dda){return function(_0x579046){_0x368dda[_0x16db('0x4')](_0x3d461d,_0x579046);};}function removeListener(_0x2520ff,_0x38f9cb){return function(){MailMessageEvents[_0x16db('0x5')](_0x2520ff,_0x38f9cb);};}exports[_0x16db('0x6')]=function(_0x1cf88f){for(var _0x38b8af=0x0,_0x1adae8=events[_0x16db('0x7')];_0x38b8af<_0x1adae8;_0x38b8af++){var _0x400d33=events[_0x38b8af];var _0x1a9012=createListener('mailMessage:'+_0x400d33,_0x1cf88f);MailMessageEvents['on'](_0x400d33,_0x1a9012);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index db8cb03..f91a521 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 _0xe88e=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/members','/:id/teams','getTeams','getAgents','create','addTeams','post','addAgents','put','destroy','delete','exports','multer','util'];(function(_0x2fe50b,_0x155110){var _0x5e4800=function(_0x354497){while(--_0x354497){_0x2fe50b['push'](_0x2fe50b['shift']());}};_0x5e4800(++_0x155110);}(_0xe88e,0x178));var _0xee88=function(_0x4b90c2,_0xaae537){_0x4b90c2=_0x4b90c2-0x0;var _0x59b4c0=_0xe88e[_0x4b90c2];return _0x59b4c0;};'use strict';var multer=require(_0xee88('0x0'));var util=require(_0xee88('0x1'));var path=require(_0xee88('0x2'));var timeout=require(_0xee88('0x3'));var express=require(_0xee88('0x4'));var router=express[_0xee88('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xee88('0x6'));var interaction=require(_0xee88('0x7'));var config=require('../../config/environment');var controller=require(_0xee88('0x8'));router[_0xee88('0x9')]('/',auth[_0xee88('0xa')](),controller[_0xee88('0xb')]);router[_0xee88('0x9')](_0xee88('0xc'),auth[_0xee88('0xa')](),controller[_0xee88('0xd')]);router[_0xee88('0x9')](_0xee88('0xe'),auth[_0xee88('0xa')](),controller['show']);router[_0xee88('0x9')](_0xee88('0xf'),auth[_0xee88('0xa')](),controller['getMembers']);router[_0xee88('0x9')](_0xee88('0x10'),auth[_0xee88('0xa')](),controller[_0xee88('0x11')]);router['get']('/:id/users',auth[_0xee88('0xa')](),controller[_0xee88('0x12')]);router['post']('/',auth[_0xee88('0xa')](),controller[_0xee88('0x13')]);router['post'](_0xee88('0x10'),auth['isAuthenticated'](),controller[_0xee88('0x14')]);router[_0xee88('0x15')]('/:id/users',auth['isAuthenticated'](),controller[_0xee88('0x16')]);router[_0xee88('0x17')](_0xee88('0xe'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0xee88('0xa')](),controller[_0xee88('0x18')]);router[_0xee88('0x19')](_0xee88('0x10'),auth[_0xee88('0xa')](),controller['removeTeams']);router[_0xee88('0x19')]('/:id/users',auth[_0xee88('0xa')](),controller['removeAgents']);module[_0xee88('0x1a')]=router; \ No newline at end of file +var _0x6b1e=['show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','put','update','destroy','delete','removeTeams','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','./mailQueue.controller','get','isAuthenticated','index','/:id'];(function(_0x593752,_0xfc3827){var _0x4612be=function(_0x2d64c6){while(--_0x2d64c6){_0x593752['push'](_0x593752['shift']());}};_0x4612be(++_0xfc3827);}(_0x6b1e,0xe7));var _0xe6b1=function(_0x530699,_0x512be0){_0x530699=_0x530699-0x0;var _0x2d183e=_0x6b1e[_0x530699];return _0x2d183e;};'use strict';var multer=require(_0xe6b1('0x0'));var util=require(_0xe6b1('0x1'));var path=require(_0xe6b1('0x2'));var timeout=require('connect-timeout');var express=require(_0xe6b1('0x3'));var router=express[_0xe6b1('0x4')]();var fs_extra=require(_0xe6b1('0x5'));var auth=require(_0xe6b1('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe6b1('0x7'));router[_0xe6b1('0x8')]('/',auth[_0xe6b1('0x9')](),controller[_0xe6b1('0xa')]);router[_0xe6b1('0x8')]('/describe',auth[_0xe6b1('0x9')](),controller['describe']);router['get'](_0xe6b1('0xb'),auth[_0xe6b1('0x9')](),controller[_0xe6b1('0xc')]);router['get'](_0xe6b1('0xd'),auth[_0xe6b1('0x9')](),controller[_0xe6b1('0xe')]);router['get'](_0xe6b1('0xf'),auth[_0xe6b1('0x9')](),controller[_0xe6b1('0x10')]);router[_0xe6b1('0x8')](_0xe6b1('0x11'),auth['isAuthenticated'](),controller[_0xe6b1('0x12')]);router[_0xe6b1('0x13')]('/',auth[_0xe6b1('0x9')](),controller[_0xe6b1('0x14')]);router[_0xe6b1('0x13')]('/:id/teams',auth[_0xe6b1('0x9')](),controller['addTeams']);router[_0xe6b1('0x13')](_0xe6b1('0x11'),auth[_0xe6b1('0x9')](),controller['addAgents']);router[_0xe6b1('0x15')](_0xe6b1('0xb'),auth[_0xe6b1('0x9')](),controller[_0xe6b1('0x16')]);router['delete'](_0xe6b1('0xb'),auth['isAuthenticated'](),controller[_0xe6b1('0x17')]);router[_0xe6b1('0x18')](_0xe6b1('0xf'),auth[_0xe6b1('0x9')](),controller[_0xe6b1('0x19')]);router[_0xe6b1('0x18')]('/:id/users',auth[_0xe6b1('0x9')](),controller['removeAgents']);module[_0xe6b1('0x1a')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 93e7e71..690a3e9 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 _0x3aed=['beepall','roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x2b559d,_0x1b3307){var _0x25d03a=function(_0x83ea79){while(--_0x83ea79){_0x2b559d['push'](_0x2b559d['shift']());}};_0x25d03a(++_0x1b3307);}(_0x3aed,0x1d6));var _0xd3ae=function(_0x2272b5,_0x362458){_0x2272b5=_0x2272b5-0x0;var _0x110156=_0x3aed[_0x2272b5];return _0x110156;};'use strict';var Sequelize=require(_0xd3ae('0x0'));module[_0xd3ae('0x1')]={'name':{'type':Sequelize[_0xd3ae('0x2')],'unique':_0xd3ae('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xd3ae('0x2')]},'timeout':{'type':Sequelize[_0xd3ae('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd3ae('0x5')](_0xd3ae('0x6'),_0xd3ae('0x7'),_0xd3ae('0x8'))}}; \ No newline at end of file +var _0x471c=['sequelize','exports','STRING','INTEGER','ENUM','rrmemory','beepall'];(function(_0x5a4fa8,_0x1ca50f){var _0x4a2160=function(_0x4f294c){while(--_0x4f294c){_0x5a4fa8['push'](_0x5a4fa8['shift']());}};_0x4a2160(++_0x1ca50f);}(_0x471c,0x1ce));var _0xc471=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x471c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc471('0x0'));module[_0xc471('0x1')]={'name':{'type':Sequelize[_0xc471('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xc471('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc471('0x4')](_0xc471('0x5'),_0xc471('0x6'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 4de713b..9bde826 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 _0x57b4=['from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','removeAgents','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','bluebird','util','lodash','ioredis','../../components/parsers/qs','../../mysqldb','redis','defaults','localhost','./mailQueue.socket','register','json','offset','undefined','limit','count','status','set','Content-Range','update','destroy','MailQueues','UserProfileResource','then','end','sendStatus','error','stack','name','send','map','MailQueue','rawAttributes','type','getOptions','include','query','findAll','catch','model','keys','filters','intersection','attributes','fields','length','merge','options','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','getMembers','UserMailQueue','nolimit','order','sort','where','pick','filter','User','mailPause','createdAt','%s/%s','SIP','getTeams','hasOwnProperty','addTeams','ids','Team','online','voicePause','interface','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','select','field'];(function(_0x5a09e9,_0x391256){var _0x5e4735=function(_0x23d780){while(--_0x23d780){_0x5a09e9['push'](_0x5a09e9['shift']());}};_0x5e4735(++_0x391256);}(_0x57b4,0x174));var _0x457b=function(_0x2839db,_0x1003dd){_0x2839db=_0x2839db-0x0;var _0xd29a37=_0x57b4[_0x2839db];return _0xd29a37;};'use strict';var BPromise=require(_0x457b('0x0'));var util=require(_0x457b('0x1'));var _=require(_0x457b('0x2'));var squel=require('squel');var Redis=require(_0x457b('0x3'));var qs=require(_0x457b('0x4'));var logger=require('../../config/logger')('api');var config=require('../../config/environment');var db=require(_0x457b('0x5'))['db'];config[_0x457b('0x6')]=_[_0x457b('0x7')](config['redis'],{'host':_0x457b('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x457b('0x6')]));require(_0x457b('0x9'))[_0x457b('0xa')](socket);function respondWithStatusCode(_0x6ba95e,_0x4a9bdf){_0x4a9bdf=_0x4a9bdf||0xcc;return function(_0x2acced){if(_0x2acced){return _0x6ba95e['sendStatus'](_0x4a9bdf);}return _0x6ba95e['status'](_0x4a9bdf)['end']();};}function respondWithResult(_0xc6abdf,_0x31a7bd){_0x31a7bd=_0x31a7bd||0xc8;return function(_0x5e12dc){if(_0x5e12dc){return _0xc6abdf['status'](_0x31a7bd)[_0x457b('0xb')](_0x5e12dc);}};}function respondWithFilteredResult(_0x346251,_0x44c8b2){return function(_0x35f469){if(_0x35f469){var _0x338499=typeof _0x44c8b2[_0x457b('0xc')]===_0x457b('0xd')&&typeof _0x44c8b2[_0x457b('0xe')]===_0x457b('0xd');var _0x183d8a=_0x35f469[_0x457b('0xf')];var _0x1530c9=_0x338499?0x0:_0x44c8b2[_0x457b('0xc')];var _0x2e28f0=_0x338499?_0x35f469[_0x457b('0xf')]:_0x44c8b2['offset']+_0x44c8b2[_0x457b('0xe')];var _0x3128bc;if(_0x2e28f0>=_0x183d8a){_0x2e28f0=_0x183d8a;_0x3128bc=0xc8;}else{_0x3128bc=0xce;}_0x346251[_0x457b('0x10')](_0x3128bc);return _0x346251[_0x457b('0x11')](_0x457b('0x12'),_0x1530c9+'-'+_0x2e28f0+'/'+_0x183d8a)[_0x457b('0xb')](_0x35f469);}return null;};}function saveUpdates(_0x55185d){return function(_0x536e2a){if(_0x536e2a){return _0x536e2a[_0x457b('0x13')](_0x55185d)['then'](function(_0x57b6d6){return _0x57b6d6;});}return null;};}function removeEntity(_0x16f432){return function(_0x38f7a7){if(_0x38f7a7){return _0x38f7a7[_0x457b('0x14')]()['then'](function(){var _0x2010f1=_0x38f7a7['get']({'plain':!![]});var _0x5a1da8=_0x457b('0x15');return db[_0x457b('0x16')]['destroy']({'where':{'type':_0x5a1da8,'resourceId':_0x2010f1['id']}})[_0x457b('0x17')](function(){return _0x38f7a7;});})['then'](function(){_0x16f432[_0x457b('0x10')](0xcc)[_0x457b('0x18')]();});}};}function handleEntityNotFound(_0x236d24){return function(_0x2dc386){if(!_0x2dc386){_0x236d24[_0x457b('0x19')](0x194);}return _0x2dc386;};}function handleError(_0x5acabe,_0x5d9da6){_0x5d9da6=_0x5d9da6||0x1f4;return function(_0xdd0cdc){logger[_0x457b('0x1a')](_0xdd0cdc[_0x457b('0x1b')]);if(_0xdd0cdc[_0x457b('0x1c')]){delete _0xdd0cdc['name'];}_0x5acabe[_0x457b('0x10')](_0x5d9da6)[_0x457b('0x1d')](_0xdd0cdc);};}exports['index']=function(_0xbfdc41,_0x37c7ab){var _0x49b0a2={};var _0x1319ef={'count':0x0,'rows':[]};var _0x511f99=_[_0x457b('0x1e')](db[_0x457b('0x1f')][_0x457b('0x20')],function(_0x99d23c){return{'name':_0x99d23c['fieldName'],'type':_0x99d23c[_0x457b('0x21')]['key']};});_0x49b0a2=qs[_0x457b('0x22')](_0x511f99,_0xbfdc41);var _0x12015f={'where':_0x49b0a2['where']};return db[_0x457b('0x1f')]['count'](_0x12015f)[_0x457b('0x17')](function(_0x2ace3e){_0x1319ef[_0x457b('0xf')]=_0x2ace3e;_0x49b0a2['include']=qs[_0x457b('0x23')](_0xbfdc41[_0x457b('0x24')]);return db[_0x457b('0x1f')][_0x457b('0x25')](_0x49b0a2);})[_0x457b('0x17')](function(_0x7988ce){_0x1319ef['rows']=_0x7988ce;return _0x1319ef;})[_0x457b('0x17')](respondWithFilteredResult(_0x37c7ab,_0x49b0a2))[_0x457b('0x26')](handleError(_0x37c7ab,null));};exports['show']=function(_0x3e7923,_0x1734e7){var _0xca2522={'raw':!![],'where':{'id':_0x3e7923['params']['id']}},_0x2fcde3={};_0x2fcde3[_0x457b('0x27')]=_[_0x457b('0x28')](db[_0x457b('0x1f')][_0x457b('0x20')]);_0x2fcde3[_0x457b('0x24')]=_['keys'](_0x3e7923[_0x457b('0x24')]);_0x2fcde3[_0x457b('0x29')]=_[_0x457b('0x2a')](_0x2fcde3[_0x457b('0x27')],_0x2fcde3['query']);_0xca2522[_0x457b('0x2b')]=_[_0x457b('0x2a')](_0x2fcde3[_0x457b('0x27')],qs[_0x457b('0x2c')](_0x3e7923[_0x457b('0x24')][_0x457b('0x2c')]));_0xca2522['attributes']=_0xca2522[_0x457b('0x2b')][_0x457b('0x2d')]?_0xca2522[_0x457b('0x2b')]:_0x2fcde3[_0x457b('0x27')];if(_0x3e7923[_0x457b('0x24')]['includeAll']){_0xca2522[_0x457b('0x23')]=[{'all':!![]}];}_0xca2522=_[_0x457b('0x2e')]({},_0xca2522,_0x3e7923[_0x457b('0x2f')]);return db[_0x457b('0x1f')][_0x457b('0x30')](_0xca2522)['then'](handleEntityNotFound(_0x1734e7,null))[_0x457b('0x17')](respondWithResult(_0x1734e7,null))['catch'](handleError(_0x1734e7,null));};exports[_0x457b('0x31')]=function(_0x4445ab,_0x23e35f){return db[_0x457b('0x1f')][_0x457b('0x31')](_0x4445ab[_0x457b('0x32')],{})[_0x457b('0x17')](function(_0x1d6693){var _0x218518=_0x4445ab[_0x457b('0x33')][_0x457b('0x34')]({'plain':!![]});if(!_0x218518)throw new Error(_0x457b('0x35'));if(_0x218518[_0x457b('0x36')]===_0x457b('0x33')){var _0x24dd3e=_0x1d6693[_0x457b('0x34')]({'plain':!![]});var _0x166e04=_0x457b('0x15');return db[_0x457b('0x37')][_0x457b('0x30')]({'where':{'name':_0x166e04,'userProfileId':_0x218518[_0x457b('0x38')]},'raw':!![]})['then'](function(_0x5e14c2){if(_0x5e14c2&&_0x5e14c2[_0x457b('0x39')]===0x0){return db['UserProfileResource'][_0x457b('0x31')]({'name':_0x24dd3e[_0x457b('0x1c')],'resourceId':_0x24dd3e['id'],'type':_0x5e14c2['name'],'sectionId':_0x5e14c2['id']},{})[_0x457b('0x17')](function(){return _0x1d6693;});}else{return _0x1d6693;}})[_0x457b('0x26')](function(_0x327b95){logger[_0x457b('0x1a')](_0x457b('0x3a'),_0x327b95);throw _0x327b95;});}return _0x1d6693;})[_0x457b('0x17')](respondWithResult(_0x23e35f,0xc9))['catch'](handleError(_0x23e35f,null));};exports[_0x457b('0x13')]=function(_0x5c1f02,_0x8dd913){if(_0x5c1f02[_0x457b('0x32')]['id']){delete _0x5c1f02[_0x457b('0x32')]['id'];}return db[_0x457b('0x1f')][_0x457b('0x30')]({'where':{'id':_0x5c1f02[_0x457b('0x3b')]['id']}})[_0x457b('0x17')](handleEntityNotFound(_0x8dd913,null))[_0x457b('0x17')](saveUpdates(_0x5c1f02[_0x457b('0x32')],null))[_0x457b('0x17')](respondWithResult(_0x8dd913,null))[_0x457b('0x26')](handleError(_0x8dd913,null));};exports[_0x457b('0x14')]=function(_0x25d51b,_0x44ce15){return db[_0x457b('0x1f')][_0x457b('0x30')]({'where':{'id':_0x25d51b[_0x457b('0x3b')]['id']}})['then'](handleEntityNotFound(_0x44ce15,null))[_0x457b('0x17')](removeEntity(_0x44ce15,null))[_0x457b('0x26')](handleError(_0x44ce15,null));};exports['describe']=function(_0x54f533,_0x3e32bd){return db[_0x457b('0x1f')]['describe']()[_0x457b('0x17')](respondWithResult(_0x3e32bd,null))[_0x457b('0x26')](handleError(_0x3e32bd,null));};exports[_0x457b('0x3c')]=function(_0x3b6f99,_0x4d4057){var _0x1a4c3e={'raw':!![],'where':{}},_0x401587={},_0x277ffe;return db[_0x457b('0x1f')]['findOne']({'where':{'id':_0x3b6f99['params']['id']}})[_0x457b('0x17')](handleEntityNotFound(_0x4d4057,null))[_0x457b('0x17')](function(_0xee5646){if(_0xee5646){_0x277ffe=_0xee5646['get']({'plain':!![]});_0x401587[_0x457b('0x27')]=_[_0x457b('0x28')](db[_0x457b('0x3d')][_0x457b('0x20')]);_0x401587['query']=_[_0x457b('0x28')](_0x3b6f99[_0x457b('0x24')]);_0x401587[_0x457b('0x29')]=_[_0x457b('0x2a')](_0x401587[_0x457b('0x27')],_0x401587[_0x457b('0x24')]);_0x1a4c3e['attributes']=_[_0x457b('0x2a')](_0x401587['model'],qs[_0x457b('0x2c')](_0x3b6f99['query'][_0x457b('0x2c')]));_0x1a4c3e['attributes']=_0x1a4c3e[_0x457b('0x2b')][_0x457b('0x2d')]?_0x1a4c3e['attributes']:_0x401587[_0x457b('0x27')];if(!_0x3b6f99['query']['hasOwnProperty'](_0x457b('0x3e'))){_0x1a4c3e['limit']=qs['limit'](_0x3b6f99['query'][_0x457b('0xe')]);_0x1a4c3e[_0x457b('0xc')]=qs[_0x457b('0xc')](_0x3b6f99[_0x457b('0x24')]['offset']);}_0x1a4c3e[_0x457b('0x3f')]=qs[_0x457b('0x40')](_0x3b6f99[_0x457b('0x24')]['sort']);_0x1a4c3e[_0x457b('0x41')]=qs[_0x457b('0x29')](_[_0x457b('0x42')](_0x3b6f99[_0x457b('0x24')],_0x401587[_0x457b('0x29')]));_0x1a4c3e[_0x457b('0x41')]['MailQueueId']=_0xee5646['id'];if(_0x3b6f99[_0x457b('0x24')][_0x457b('0x43')]){_0x1a4c3e[_0x457b('0x41')]=_['merge'](_0x1a4c3e['where'],{'$or':_[_0x457b('0x1e')](_0x1a4c3e['attributes'],function(_0x431d57){var _0x2ed0f7={};_0x2ed0f7[_0x431d57]={'$like':'%'+_0x3b6f99[_0x457b('0x24')][_0x457b('0x43')]+'%'};return _0x2ed0f7;})});}_0x1a4c3e=_[_0x457b('0x2e')]({},_0x1a4c3e,_0x3b6f99[_0x457b('0x2f')]);return db[_0x457b('0x3d')][_0x457b('0x25')](_0x1a4c3e);}})[_0x457b('0x17')](function(_0x91d946){if(_0x91d946){return db[_0x457b('0x44')]['findAndCountAll']({'where':{'id':_[_0x457b('0x1e')](_0x91d946,'UserId'),'role':'agent'},'attributes':['id',_0x457b('0x1c'),_0x457b('0x45'),'updatedAt',_0x457b('0x46')]});}})[_0x457b('0x17')](function(_0x2f956e){if(_0x2f956e){return{'count':_0x2f956e['count'],'rows':_[_0x457b('0x1e')](_0x2f956e['rows'],function(_0x45b28e){return{'membername':_0x45b28e['name'],'UserId':_0x45b28e['id'],'queue_name':_0x277ffe['name'],'MailQueueId':_0x277ffe['id'],'interface':util['format'](_0x457b('0x47'),_0x457b('0x48'),_0x45b28e['name']),'penalty':0x0,'paused':_0x45b28e[_0x457b('0x45')],'createdAt':_0x45b28e[_0x457b('0x46')],'updatedAt':_0x45b28e['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x457b('0x17')](respondWithFilteredResult(_0x4d4057,_0x1a4c3e))[_0x457b('0x26')](handleError(_0x4d4057,null));};exports[_0x457b('0x49')]=function(_0x27dda5,_0x3b94ed){var _0x40449d={};var _0x12f59d={};var _0x30f9c1;var _0xf2e80d;return db[_0x457b('0x1f')]['findOne']({'where':{'id':_0x27dda5['params']['id']}})[_0x457b('0x17')](handleEntityNotFound(_0x3b94ed,null))[_0x457b('0x17')](function(_0x247106){if(_0x247106){_0x30f9c1=_0x247106;_0x12f59d['model']=_[_0x457b('0x28')](db['Team'][_0x457b('0x20')]);_0x12f59d[_0x457b('0x24')]=_[_0x457b('0x28')](_0x27dda5[_0x457b('0x24')]);_0x12f59d[_0x457b('0x29')]=_[_0x457b('0x2a')](_0x12f59d['model'],_0x12f59d[_0x457b('0x24')]);_0x40449d[_0x457b('0x2b')]=_[_0x457b('0x2a')](_0x12f59d['model'],qs['fields'](_0x27dda5['query'][_0x457b('0x2c')]));_0x40449d['attributes']=_0x40449d[_0x457b('0x2b')][_0x457b('0x2d')]?_0x40449d['attributes']:_0x12f59d[_0x457b('0x27')];_0x40449d[_0x457b('0x3f')]=qs['sort'](_0x27dda5['query'][_0x457b('0x40')]);_0x40449d['where']=qs[_0x457b('0x29')](_[_0x457b('0x42')](_0x27dda5[_0x457b('0x24')],_0x12f59d['filters']));if(_0x27dda5['query'][_0x457b('0x43')]){_0x40449d[_0x457b('0x41')]=_[_0x457b('0x2e')](_0x40449d['where'],{'$or':_['map'](_0x40449d[_0x457b('0x2b')],function(_0x3b0d1a){var _0x157efb={};_0x157efb[_0x3b0d1a]={'$like':'%'+_0x27dda5[_0x457b('0x24')]['filter']+'%'};return _0x157efb;})});}_0x40449d=_['merge']({},_0x40449d,_0x27dda5[_0x457b('0x2f')]);return _0x30f9c1['getTeams'](_0x40449d);}})[_0x457b('0x17')](function(_0x4e4d05){if(_0x4e4d05){_0xf2e80d=_0x4e4d05[_0x457b('0x2d')];if(!_0x27dda5[_0x457b('0x24')][_0x457b('0x4a')](_0x457b('0x3e'))){_0x40449d[_0x457b('0xe')]=qs[_0x457b('0xe')](_0x27dda5[_0x457b('0x24')][_0x457b('0xe')]);_0x40449d[_0x457b('0xc')]=qs[_0x457b('0xc')](_0x27dda5[_0x457b('0x24')][_0x457b('0xc')]);}return _0x30f9c1[_0x457b('0x49')](_0x40449d);}})[_0x457b('0x17')](function(_0xdfae4c){if(_0xdfae4c){return _0xdfae4c?{'count':_0xf2e80d,'rows':_0xdfae4c}:null;}})[_0x457b('0x17')](respondWithResult(_0x3b94ed,null))['catch'](handleError(_0x3b94ed,null));};exports[_0x457b('0x4b')]=function(_0x2f94b3,_0x1af1a8){var _0x99f770=_0x2f94b3[_0x457b('0x32')][_0x457b('0x4c')];return db[_0x457b('0x4d')][_0x457b('0x25')]({'where':{'id':_0x99f770},'attributes':['id'],'include':[{'model':db[_0x457b('0x44')],'as':'Agents','attributes':['id','name',_0x457b('0x4e'),_0x457b('0x4f'),_0x457b('0x50')],'raw':!![]}]})[_0x457b('0x17')](function(_0x2a9c71){if(_0x2a9c71){var _0x5c6328=_['flatMap'](_0x2a9c71,function(_0x1288f7){var _0x44ac3d=_0x1288f7['get']({'plain':!![]});return _0x44ac3d[_0x457b('0x51')];});return db[_0x457b('0x1f')][_0x457b('0x30')]({'where':{'id':_0x2f94b3[_0x457b('0x3b')]['id']}})[_0x457b('0x17')](function(_0x16e0ff){return db[_0x457b('0x52')][_0x457b('0x53')](function(_0x457ab9){return _0x16e0ff[_0x457b('0x4b')](_0x99f770,{'transaction':_0x457ab9})[_0x457b('0x17')](function(){return BPromise[_0x457b('0x54')](_0x5c6328,function(_0x24f043){return db[_0x457b('0x3d')][_0x457b('0x55')]({'where':{'UserId':_0x24f043['id'],'MailQueueId':_0x2f94b3[_0x457b('0x3b')]['id']},'transaction':_0x457ab9});});})[_0x457b('0x17')](function(){_0x5c6328[_0x457b('0x56')](function(_0x58a130){socket[_0x457b('0x57')](_0x457b('0x58'),{'UserId':_0x58a130['id'],'MailQueueId':_0x16e0ff['id']});});});});});}})['then'](respondWithStatusCode(_0x1af1a8,null))[_0x457b('0x26')](handleError(_0x1af1a8,null));};exports[_0x457b('0x59')]=function(_0x2df5ce,_0x3598a4){return db['Team'][_0x457b('0x25')]({'where':{'id':_0x2df5ce['query'][_0x457b('0x4c')]},'attributes':['id'],'include':[{'model':db[_0x457b('0x44')],'as':_0x457b('0x51'),'attributes':['id'],'raw':!![]}]})[_0x457b('0x17')](handleEntityNotFound(_0x3598a4,null))[_0x457b('0x17')](function(_0x533fab){var _0x485671=_['map'](_0x533fab,'id');var _0xa5cb43=[];var _0x4c051c=[];var _0x504e18=squel[_0x457b('0x5a')]();_0x504e18[_0x457b('0x5b')]('tq.TeamId')[_0x457b('0x5c')](_0x457b('0x5d'),'tq')[_0x457b('0x5e')](_0x457b('0x5f'),'ut',_0x457b('0x60'))['where']('MailQueueId\x20=\x20?',_0x2df5ce['params']['id']);for(var _0x5886ce=0x0;_0x5886ce<_0x533fab[_0x457b('0x2d')];_0x5886ce+=0x1){let _0x5a07b2=_0x533fab[_0x5886ce];for(var _0x19e792=0x0;_0x19e792<_0x5a07b2['Agents'][_0x457b('0x2d')];_0x19e792+=0x1){let _0x41233e=_0x5a07b2[_0x457b('0x51')][_0x19e792];var _0x22dc85=_0x504e18[_0x457b('0x61')]();_0x22dc85[_0x457b('0x41')](_0x457b('0x62'),_0x41233e['id']);_0x4c051c['push'](db['sequelize'][_0x457b('0x24')](_0x22dc85[_0x457b('0x63')](),{'type':db[_0x457b('0x52')][_0x457b('0x64')][_0x457b('0x65')]})[_0x457b('0x17')](function(_0x3bb3dd){if(_0x3bb3dd[_0x457b('0x2d')]===0x1){return _0x41233e['id'];}else{var _0x396842=_[_0x457b('0x66')](_[_0x457b('0x1e')](_0x3bb3dd,_0x457b('0x67')),function(_0xe30a09){return _[_0x457b('0x68')](_0x485671,_0xe30a09);});if(_0x396842){return _0x41233e['id'];}}}));}}return BPromise[_0x457b('0x69')](_0x4c051c)[_0x457b('0x17')](function(_0x540122){_0xa5cb43=_(_0xa5cb43)[_0x457b('0x6a')](_0x540122)[_0x457b('0x6b')]()[_0x457b('0x6c')]();return db[_0x457b('0x1f')][_0x457b('0x30')]({'where':{'id':_0x2df5ce[_0x457b('0x3b')]['id']}})[_0x457b('0x17')](function(_0x2f6e4e){return db[_0x457b('0x52')]['transaction'](function(_0x5ecc24){return _0x2f6e4e[_0x457b('0x59')](_0x2df5ce[_0x457b('0x24')]['ids'],{'transaction':_0x5ecc24})['then'](function(){if(!_['isEmpty'](_0xa5cb43)){return _0x2f6e4e[_0x457b('0x6d')](_0xa5cb43,{'transaction':_0x5ecc24});}})[_0x457b('0x17')](function(){_0xa5cb43[_0x457b('0x56')](function(_0x4f9ba7){socket['emit'](_0x457b('0x6e'),{'UserId':_0x4f9ba7,'MailQueueId':_0x2f6e4e['id']});});});});});});})[_0x457b('0x17')](respondWithStatusCode(_0x3598a4,null))[_0x457b('0x26')](handleError(_0x3598a4,null));};exports[_0x457b('0x6f')]=function(_0x5d3fff,_0x41554f){return db[_0x457b('0x1f')][_0x457b('0x30')]({'where':{'id':_0x5d3fff['params']['id']}})[_0x457b('0x17')](handleEntityNotFound(_0x41554f,null))[_0x457b('0x17')](function(_0xdec095){if(_0xdec095){return _0xdec095['addAgents'](_0x5d3fff['body']['ids'],_[_0x457b('0x70')](_0x5d3fff[_0x457b('0x32')],[_0x457b('0x4c'),'id'])||{})[_0x457b('0x71')](function(_0x56d9a2){for(var _0x32d61c=0x0;_0x32d61c<_0x5d3fff[_0x457b('0x32')][_0x457b('0x4c')]['length'];_0x32d61c+=0x1){socket[_0x457b('0x57')]('userMailQueue:save',{'UserId':Number(_0x5d3fff[_0x457b('0x32')][_0x457b('0x4c')][_0x32d61c]),'MailQueueId':Number(_0x5d3fff[_0x457b('0x3b')]['id'])});}return _0x56d9a2;});}})['then'](respondWithResult(_0x41554f,null))[_0x457b('0x26')](handleError(_0x41554f,null));};exports[_0x457b('0x6d')]=function(_0x2c6baa,_0x599b00){return db['MailQueue'][_0x457b('0x30')]({'where':{'id':_0x2c6baa['params']['id']}})[_0x457b('0x17')](handleEntityNotFound(_0x599b00,null))[_0x457b('0x17')](function(_0xea24a1){if(_0xea24a1){return _0xea24a1['removeAgents'](_0x2c6baa[_0x457b('0x24')][_0x457b('0x4c')])['then'](function(){if(_[_0x457b('0x72')](_0x2c6baa[_0x457b('0x24')][_0x457b('0x4c')])){for(var _0x38fca2=0x0;_0x38fca2<_0x2c6baa[_0x457b('0x24')][_0x457b('0x4c')][_0x457b('0x2d')];_0x38fca2+=0x1){socket[_0x457b('0x57')](_0x457b('0x6e'),{'UserId':Number(_0x2c6baa[_0x457b('0x24')]['ids'][_0x38fca2]),'MailQueueId':Number(_0x2c6baa['params']['id'])});}}else{socket['emit'](_0x457b('0x6e'),{'UserId':Number(_0x2c6baa[_0x457b('0x24')][_0x457b('0x4c')]),'MailQueueId':Number(_0x2c6baa['params']['id'])});}});}})[_0x457b('0x17')](respondWithStatusCode(_0x599b00,null))[_0x457b('0x26')](handleError(_0x599b00,null));};exports[_0x457b('0x73')]=function(_0x483d01,_0x42739b){var _0x3abb19={};var _0x1b6561={};var _0x590533;var _0x3a2c52;return db[_0x457b('0x1f')]['findOne']({'where':{'id':_0x483d01[_0x457b('0x3b')]['id']}})[_0x457b('0x17')](handleEntityNotFound(_0x42739b,null))[_0x457b('0x17')](function(_0x57153b){if(_0x57153b){_0x590533=_0x57153b;_0x1b6561['model']=_['keys'](db[_0x457b('0x44')][_0x457b('0x20')]);_0x1b6561['query']=_[_0x457b('0x28')](_0x483d01[_0x457b('0x24')]);_0x1b6561['filters']=_[_0x457b('0x2a')](_0x1b6561[_0x457b('0x27')],_0x1b6561[_0x457b('0x24')]);_0x3abb19['attributes']=_[_0x457b('0x2a')](_0x1b6561['model'],qs[_0x457b('0x2c')](_0x483d01['query'][_0x457b('0x2c')]));_0x3abb19[_0x457b('0x2b')]=_0x3abb19[_0x457b('0x2b')][_0x457b('0x2d')]?_0x3abb19[_0x457b('0x2b')]:_0x1b6561[_0x457b('0x27')];_0x3abb19[_0x457b('0x3f')]=qs['sort'](_0x483d01[_0x457b('0x24')][_0x457b('0x40')]);_0x3abb19[_0x457b('0x41')]=qs[_0x457b('0x29')](_[_0x457b('0x42')](_0x483d01['query'],_0x1b6561[_0x457b('0x29')]));if(_0x483d01[_0x457b('0x24')][_0x457b('0x43')]){_0x3abb19[_0x457b('0x41')]=_[_0x457b('0x2e')](_0x3abb19[_0x457b('0x41')],{'$or':_[_0x457b('0x1e')](_0x3abb19[_0x457b('0x2b')],function(_0x152536){var _0x214088={};_0x214088[_0x152536]={'$like':'%'+_0x483d01['query'][_0x457b('0x43')]+'%'};return _0x214088;})});}_0x3abb19=_['merge']({},_0x3abb19,_0x483d01[_0x457b('0x2f')]);return _0x590533['getAgents'](_0x3abb19);}})['then'](function(_0x202a31){if(_0x202a31){_0x3a2c52=_0x202a31[_0x457b('0x2d')];if(!_0x483d01[_0x457b('0x24')][_0x457b('0x4a')]('nolimit')){_0x3abb19[_0x457b('0xe')]=qs[_0x457b('0xe')](_0x483d01['query'][_0x457b('0xe')]);_0x3abb19[_0x457b('0xc')]=qs['offset'](_0x483d01[_0x457b('0x24')][_0x457b('0xc')]);}return _0x590533[_0x457b('0x73')](_0x3abb19);}})[_0x457b('0x17')](function(_0x4c12f5){if(_0x4c12f5){return _0x4c12f5?{'count':_0x3a2c52,'rows':_0x4c12f5}:null;}})[_0x457b('0x17')](respondWithResult(_0x42739b,null))[_0x457b('0x26')](handleError(_0x42739b,null));}; \ No newline at end of file +var _0x2dbd=['value','removeTeams','isEmpty','forEach','addAgents','omit','spread','userMailQueue:save','removeAgents','isArray','userMailQueue:remove','getAgents','bluebird','util','lodash','../../components/parsers/qs','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','status','end','json','offset','undefined','count','limit','set','Content-Range','update','then','get','MailQueues','UserProfileResource','destroy','name','send','index','map','rawAttributes','fieldName','type','where','MailQueue','include','findAll','rows','params','model','keys','query','filters','intersection','attributes','length','includeAll','merge','options','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','describe','getMembers','findOne','UserMailQueue','fields','hasOwnProperty','sort','pick','MailQueueId','filter','User','findAndCountAll','agent','mailPause','createdAt','%s/%s','SIP','getTeams','Team','order','nolimit','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','emit','field','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','toString','SELECT','every','includes','all','compact'];(function(_0x2aa009,_0x5a1f96){var _0x52d850=function(_0x4f7438){while(--_0x4f7438){_0x2aa009['push'](_0x2aa009['shift']());}};_0x52d850(++_0x5a1f96);}(_0x2dbd,0x82));var _0xd2db=function(_0x414c69,_0x1a3e60){_0x414c69=_0x414c69-0x0;var _0x36ee32=_0x2dbd[_0x414c69];return _0x36ee32;};'use strict';var BPromise=require(_0xd2db('0x0'));var util=require(_0xd2db('0x1'));var _=require(_0xd2db('0x2'));var squel=require('squel');var Redis=require('ioredis');var qs=require(_0xd2db('0x3'));var logger=require('../../config/logger')(_0xd2db('0x4'));var config=require('../../config/environment');var db=require(_0xd2db('0x5'))['db'];config[_0xd2db('0x6')]=_[_0xd2db('0x7')](config[_0xd2db('0x6')],{'host':_0xd2db('0x8'),'port':0x18eb});var socket=require(_0xd2db('0x9'))(new Redis(config['redis']));require(_0xd2db('0xa'))[_0xd2db('0xb')](socket);function respondWithStatusCode(_0x486379,_0xd3de46){_0xd3de46=_0xd3de46||0xcc;return function(_0x490385){if(_0x490385){return _0x486379['sendStatus'](_0xd3de46);}return _0x486379[_0xd2db('0xc')](_0xd3de46)[_0xd2db('0xd')]();};}function respondWithResult(_0x4846d9,_0x3bfaae){_0x3bfaae=_0x3bfaae||0xc8;return function(_0x50bcc5){if(_0x50bcc5){return _0x4846d9[_0xd2db('0xc')](_0x3bfaae)[_0xd2db('0xe')](_0x50bcc5);}};}function respondWithFilteredResult(_0x65b309,_0x9bb0b3){return function(_0x3eed88){if(_0x3eed88){var _0x1ff10e=typeof _0x9bb0b3[_0xd2db('0xf')]===_0xd2db('0x10')&&typeof _0x9bb0b3['limit']===_0xd2db('0x10');var _0x239a22=_0x3eed88['count'];var _0x33e892=_0x1ff10e?0x0:_0x9bb0b3[_0xd2db('0xf')];var _0x35a5ce=_0x1ff10e?_0x3eed88[_0xd2db('0x11')]:_0x9bb0b3['offset']+_0x9bb0b3[_0xd2db('0x12')];var _0xfa6238;if(_0x35a5ce>=_0x239a22){_0x35a5ce=_0x239a22;_0xfa6238=0xc8;}else{_0xfa6238=0xce;}_0x65b309[_0xd2db('0xc')](_0xfa6238);return _0x65b309[_0xd2db('0x13')](_0xd2db('0x14'),_0x33e892+'-'+_0x35a5ce+'/'+_0x239a22)[_0xd2db('0xe')](_0x3eed88);}return null;};}function saveUpdates(_0x1991f8){return function(_0x1ec93e){if(_0x1ec93e){return _0x1ec93e[_0xd2db('0x15')](_0x1991f8)[_0xd2db('0x16')](function(_0x24d853){return _0x24d853;});}return null;};}function removeEntity(_0x17a6cf){return function(_0x599423){if(_0x599423){return _0x599423['destroy']()[_0xd2db('0x16')](function(){var _0x3cc6b5=_0x599423[_0xd2db('0x17')]({'plain':!![]});var _0xb67bd4=_0xd2db('0x18');return db[_0xd2db('0x19')][_0xd2db('0x1a')]({'where':{'type':_0xb67bd4,'resourceId':_0x3cc6b5['id']}})[_0xd2db('0x16')](function(){return _0x599423;});})[_0xd2db('0x16')](function(){_0x17a6cf['status'](0xcc)[_0xd2db('0xd')]();});}};}function handleEntityNotFound(_0x15cee1){return function(_0x5d59f8){if(!_0x5d59f8){_0x15cee1['sendStatus'](0x194);}return _0x5d59f8;};}function handleError(_0x119733,_0x35ca9c){_0x35ca9c=_0x35ca9c||0x1f4;return function(_0x25e803){logger['error'](_0x25e803['stack']);if(_0x25e803['name']){delete _0x25e803[_0xd2db('0x1b')];}_0x119733[_0xd2db('0xc')](_0x35ca9c)[_0xd2db('0x1c')](_0x25e803);};}exports[_0xd2db('0x1d')]=function(_0x5c0f89,_0x362a46){var _0x292aaf={};var _0x41d887={'count':0x0,'rows':[]};var _0x423347=_[_0xd2db('0x1e')](db['MailQueue'][_0xd2db('0x1f')],function(_0x4824e3){return{'name':_0x4824e3[_0xd2db('0x20')],'type':_0x4824e3[_0xd2db('0x21')]['key']};});_0x292aaf=qs['getOptions'](_0x423347,_0x5c0f89);var _0x140cea={'where':_0x292aaf[_0xd2db('0x22')]};return db[_0xd2db('0x23')][_0xd2db('0x11')](_0x140cea)[_0xd2db('0x16')](function(_0x20461a){_0x41d887[_0xd2db('0x11')]=_0x20461a;_0x292aaf[_0xd2db('0x24')]=qs[_0xd2db('0x24')](_0x5c0f89['query']);return db['MailQueue'][_0xd2db('0x25')](_0x292aaf);})[_0xd2db('0x16')](function(_0xf76450){_0x41d887[_0xd2db('0x26')]=_0xf76450;return _0x41d887;})['then'](respondWithFilteredResult(_0x362a46,_0x292aaf))['catch'](handleError(_0x362a46,null));};exports['show']=function(_0x59e12c,_0x216b22){var _0x375c3f={'raw':!![],'where':{'id':_0x59e12c[_0xd2db('0x27')]['id']}},_0x27a164={};_0x27a164[_0xd2db('0x28')]=_[_0xd2db('0x29')](db['MailQueue']['rawAttributes']);_0x27a164[_0xd2db('0x2a')]=_['keys'](_0x59e12c[_0xd2db('0x2a')]);_0x27a164[_0xd2db('0x2b')]=_[_0xd2db('0x2c')](_0x27a164[_0xd2db('0x28')],_0x27a164['query']);_0x375c3f[_0xd2db('0x2d')]=_[_0xd2db('0x2c')](_0x27a164[_0xd2db('0x28')],qs['fields'](_0x59e12c[_0xd2db('0x2a')]['fields']));_0x375c3f[_0xd2db('0x2d')]=_0x375c3f[_0xd2db('0x2d')][_0xd2db('0x2e')]?_0x375c3f['attributes']:_0x27a164[_0xd2db('0x28')];if(_0x59e12c[_0xd2db('0x2a')][_0xd2db('0x2f')]){_0x375c3f[_0xd2db('0x24')]=[{'all':!![]}];}_0x375c3f=_[_0xd2db('0x30')]({},_0x375c3f,_0x59e12c[_0xd2db('0x31')]);return db[_0xd2db('0x23')][_0xd2db('0x32')](_0x375c3f)['then'](handleEntityNotFound(_0x216b22,null))[_0xd2db('0x16')](respondWithResult(_0x216b22,null))['catch'](handleError(_0x216b22,null));};exports[_0xd2db('0x33')]=function(_0x1260fe,_0x34a491){return db[_0xd2db('0x23')]['create'](_0x1260fe[_0xd2db('0x34')],{})[_0xd2db('0x16')](function(_0x4c681b){var _0x188158=_0x1260fe[_0xd2db('0x35')][_0xd2db('0x17')]({'plain':!![]});if(!_0x188158)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x188158[_0xd2db('0x36')]===_0xd2db('0x35')){var _0x5479bb=_0x4c681b[_0xd2db('0x17')]({'plain':!![]});var _0x26459c=_0xd2db('0x18');return db[_0xd2db('0x37')][_0xd2db('0x32')]({'where':{'name':_0x26459c,'userProfileId':_0x188158[_0xd2db('0x38')]},'raw':!![]})['then'](function(_0xab8df){if(_0xab8df&&_0xab8df[_0xd2db('0x39')]===0x0){return db[_0xd2db('0x19')]['create']({'name':_0x5479bb[_0xd2db('0x1b')],'resourceId':_0x5479bb['id'],'type':_0xab8df['name'],'sectionId':_0xab8df['id']},{})[_0xd2db('0x16')](function(){return _0x4c681b;});}else{return _0x4c681b;}})['catch'](function(_0x2bd059){logger[_0xd2db('0x3a')](_0xd2db('0x3b'),_0x2bd059);throw _0x2bd059;});}return _0x4c681b;})[_0xd2db('0x16')](respondWithResult(_0x34a491,0xc9))[_0xd2db('0x3c')](handleError(_0x34a491,null));};exports['update']=function(_0x42fe0b,_0x596580){if(_0x42fe0b['body']['id']){delete _0x42fe0b[_0xd2db('0x34')]['id'];}return db[_0xd2db('0x23')][_0xd2db('0x32')]({'where':{'id':_0x42fe0b[_0xd2db('0x27')]['id']}})[_0xd2db('0x16')](handleEntityNotFound(_0x596580,null))[_0xd2db('0x16')](saveUpdates(_0x42fe0b[_0xd2db('0x34')],null))['then'](respondWithResult(_0x596580,null))[_0xd2db('0x3c')](handleError(_0x596580,null));};exports[_0xd2db('0x1a')]=function(_0x351c41,_0x45b14a){return db['MailQueue'][_0xd2db('0x32')]({'where':{'id':_0x351c41['params']['id']}})[_0xd2db('0x16')](handleEntityNotFound(_0x45b14a,null))[_0xd2db('0x16')](removeEntity(_0x45b14a,null))['catch'](handleError(_0x45b14a,null));};exports[_0xd2db('0x3d')]=function(_0x40d25d,_0x244599){return db[_0xd2db('0x23')][_0xd2db('0x3d')]()['then'](respondWithResult(_0x244599,null))['catch'](handleError(_0x244599,null));};exports[_0xd2db('0x3e')]=function(_0x37e15c,_0x4a5e70){var _0x2801c6={'raw':!![],'where':{}},_0x38a09a={},_0x35f0bc;return db[_0xd2db('0x23')][_0xd2db('0x3f')]({'where':{'id':_0x37e15c['params']['id']}})[_0xd2db('0x16')](handleEntityNotFound(_0x4a5e70,null))[_0xd2db('0x16')](function(_0x48390b){if(_0x48390b){_0x35f0bc=_0x48390b[_0xd2db('0x17')]({'plain':!![]});_0x38a09a[_0xd2db('0x28')]=_[_0xd2db('0x29')](db[_0xd2db('0x40')][_0xd2db('0x1f')]);_0x38a09a[_0xd2db('0x2a')]=_[_0xd2db('0x29')](_0x37e15c[_0xd2db('0x2a')]);_0x38a09a['filters']=_[_0xd2db('0x2c')](_0x38a09a[_0xd2db('0x28')],_0x38a09a[_0xd2db('0x2a')]);_0x2801c6[_0xd2db('0x2d')]=_[_0xd2db('0x2c')](_0x38a09a[_0xd2db('0x28')],qs[_0xd2db('0x41')](_0x37e15c[_0xd2db('0x2a')][_0xd2db('0x41')]));_0x2801c6[_0xd2db('0x2d')]=_0x2801c6['attributes'][_0xd2db('0x2e')]?_0x2801c6['attributes']:_0x38a09a['model'];if(!_0x37e15c[_0xd2db('0x2a')][_0xd2db('0x42')]('nolimit')){_0x2801c6[_0xd2db('0x12')]=qs[_0xd2db('0x12')](_0x37e15c[_0xd2db('0x2a')][_0xd2db('0x12')]);_0x2801c6[_0xd2db('0xf')]=qs[_0xd2db('0xf')](_0x37e15c[_0xd2db('0x2a')][_0xd2db('0xf')]);}_0x2801c6['order']=qs[_0xd2db('0x43')](_0x37e15c[_0xd2db('0x2a')][_0xd2db('0x43')]);_0x2801c6[_0xd2db('0x22')]=qs['filters'](_[_0xd2db('0x44')](_0x37e15c['query'],_0x38a09a[_0xd2db('0x2b')]));_0x2801c6['where'][_0xd2db('0x45')]=_0x48390b['id'];if(_0x37e15c[_0xd2db('0x2a')][_0xd2db('0x46')]){_0x2801c6[_0xd2db('0x22')]=_[_0xd2db('0x30')](_0x2801c6['where'],{'$or':_['map'](_0x2801c6[_0xd2db('0x2d')],function(_0x48b77f){var _0x1d5b81={};_0x1d5b81[_0x48b77f]={'$like':'%'+_0x37e15c['query']['filter']+'%'};return _0x1d5b81;})});}_0x2801c6=_[_0xd2db('0x30')]({},_0x2801c6,_0x37e15c[_0xd2db('0x31')]);return db[_0xd2db('0x40')][_0xd2db('0x25')](_0x2801c6);}})['then'](function(_0x5b76db){if(_0x5b76db){return db[_0xd2db('0x47')][_0xd2db('0x48')]({'where':{'id':_[_0xd2db('0x1e')](_0x5b76db,'UserId'),'role':_0xd2db('0x49')},'attributes':['id',_0xd2db('0x1b'),_0xd2db('0x4a'),'updatedAt',_0xd2db('0x4b')]});}})[_0xd2db('0x16')](function(_0x289409){if(_0x289409){return{'count':_0x289409['count'],'rows':_[_0xd2db('0x1e')](_0x289409[_0xd2db('0x26')],function(_0x478f02){return{'membername':_0x478f02[_0xd2db('0x1b')],'UserId':_0x478f02['id'],'queue_name':_0x35f0bc['name'],'MailQueueId':_0x35f0bc['id'],'interface':util['format'](_0xd2db('0x4c'),_0xd2db('0x4d'),_0x478f02['name']),'penalty':0x0,'paused':_0x478f02['mailPause'],'createdAt':_0x478f02[_0xd2db('0x4b')],'updatedAt':_0x478f02['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4a5e70,_0x2801c6))['catch'](handleError(_0x4a5e70,null));};exports[_0xd2db('0x4e')]=function(_0x418d23,_0x216bad){var _0x228a47={};var _0x54969f={};var _0x1a58a7;var _0x1ef129;return db['MailQueue'][_0xd2db('0x3f')]({'where':{'id':_0x418d23[_0xd2db('0x27')]['id']}})[_0xd2db('0x16')](handleEntityNotFound(_0x216bad,null))[_0xd2db('0x16')](function(_0x447e41){if(_0x447e41){_0x1a58a7=_0x447e41;_0x54969f[_0xd2db('0x28')]=_[_0xd2db('0x29')](db[_0xd2db('0x4f')][_0xd2db('0x1f')]);_0x54969f[_0xd2db('0x2a')]=_[_0xd2db('0x29')](_0x418d23[_0xd2db('0x2a')]);_0x54969f['filters']=_[_0xd2db('0x2c')](_0x54969f['model'],_0x54969f[_0xd2db('0x2a')]);_0x228a47[_0xd2db('0x2d')]=_['intersection'](_0x54969f[_0xd2db('0x28')],qs[_0xd2db('0x41')](_0x418d23['query'][_0xd2db('0x41')]));_0x228a47[_0xd2db('0x2d')]=_0x228a47['attributes']['length']?_0x228a47[_0xd2db('0x2d')]:_0x54969f[_0xd2db('0x28')];_0x228a47[_0xd2db('0x50')]=qs[_0xd2db('0x43')](_0x418d23[_0xd2db('0x2a')][_0xd2db('0x43')]);_0x228a47[_0xd2db('0x22')]=qs[_0xd2db('0x2b')](_['pick'](_0x418d23[_0xd2db('0x2a')],_0x54969f[_0xd2db('0x2b')]));if(_0x418d23[_0xd2db('0x2a')][_0xd2db('0x46')]){_0x228a47['where']=_[_0xd2db('0x30')](_0x228a47['where'],{'$or':_[_0xd2db('0x1e')](_0x228a47[_0xd2db('0x2d')],function(_0x5e5530){var _0xd86cb1={};_0xd86cb1[_0x5e5530]={'$like':'%'+_0x418d23[_0xd2db('0x2a')][_0xd2db('0x46')]+'%'};return _0xd86cb1;})});}_0x228a47=_[_0xd2db('0x30')]({},_0x228a47,_0x418d23[_0xd2db('0x31')]);return _0x1a58a7['getTeams'](_0x228a47);}})[_0xd2db('0x16')](function(_0xff1fe8){if(_0xff1fe8){_0x1ef129=_0xff1fe8[_0xd2db('0x2e')];if(!_0x418d23[_0xd2db('0x2a')][_0xd2db('0x42')](_0xd2db('0x51'))){_0x228a47[_0xd2db('0x12')]=qs[_0xd2db('0x12')](_0x418d23[_0xd2db('0x2a')][_0xd2db('0x12')]);_0x228a47[_0xd2db('0xf')]=qs[_0xd2db('0xf')](_0x418d23[_0xd2db('0x2a')][_0xd2db('0xf')]);}return _0x1a58a7[_0xd2db('0x4e')](_0x228a47);}})['then'](function(_0x5cefac){if(_0x5cefac){return _0x5cefac?{'count':_0x1ef129,'rows':_0x5cefac}:null;}})[_0xd2db('0x16')](respondWithResult(_0x216bad,null))[_0xd2db('0x3c')](handleError(_0x216bad,null));};exports[_0xd2db('0x52')]=function(_0x5be1c1,_0x59bdbb){var _0x155539=_0x5be1c1['body'][_0xd2db('0x53')];return db[_0xd2db('0x4f')][_0xd2db('0x25')]({'where':{'id':_0x155539},'attributes':['id'],'include':[{'model':db[_0xd2db('0x47')],'as':_0xd2db('0x54'),'attributes':['id',_0xd2db('0x1b'),_0xd2db('0x55'),_0xd2db('0x56'),_0xd2db('0x57')],'raw':!![]}]})[_0xd2db('0x16')](function(_0x5477a4){if(_0x5477a4){var _0x3b4ff0=_[_0xd2db('0x58')](_0x5477a4,function(_0x5de93e){var _0x18cc20=_0x5de93e[_0xd2db('0x17')]({'plain':!![]});return _0x18cc20[_0xd2db('0x54')];});return db[_0xd2db('0x23')]['find']({'where':{'id':_0x5be1c1[_0xd2db('0x27')]['id']}})[_0xd2db('0x16')](function(_0x3f564c){return db[_0xd2db('0x59')][_0xd2db('0x5a')](function(_0x831659){return _0x3f564c[_0xd2db('0x52')](_0x155539,{'transaction':_0x831659})[_0xd2db('0x16')](function(){return BPromise[_0xd2db('0x5b')](_0x3b4ff0,function(_0x58fdab){return db[_0xd2db('0x40')][_0xd2db('0x5c')]({'where':{'UserId':_0x58fdab['id'],'MailQueueId':_0x5be1c1[_0xd2db('0x27')]['id']},'transaction':_0x831659});});})[_0xd2db('0x16')](function(){_0x3b4ff0['forEach'](function(_0x157a56){socket[_0xd2db('0x5d')]('userMailQueue:save',{'UserId':_0x157a56['id'],'MailQueueId':_0x3f564c['id']});});});});});}})[_0xd2db('0x16')](respondWithStatusCode(_0x59bdbb,null))[_0xd2db('0x3c')](handleError(_0x59bdbb,null));};exports['removeTeams']=function(_0x2cdf30,_0x15bece){return db['Team']['findAll']({'where':{'id':_0x2cdf30[_0xd2db('0x2a')][_0xd2db('0x53')]},'attributes':['id'],'include':[{'model':db[_0xd2db('0x47')],'as':_0xd2db('0x54'),'attributes':['id'],'raw':!![]}]})[_0xd2db('0x16')](handleEntityNotFound(_0x15bece,null))[_0xd2db('0x16')](function(_0x1e92bb){var _0x1b1791=_[_0xd2db('0x1e')](_0x1e92bb,'id');var _0x5aebca=[];var _0x2f9eca=[];var _0x4f1540=squel['select']();_0x4f1540[_0xd2db('0x5e')](_0xd2db('0x5f'))[_0xd2db('0x60')]('team_has_mail_queues','tq')[_0xd2db('0x61')]('user_has_teams','ut',_0xd2db('0x62'))[_0xd2db('0x22')]('MailQueueId\x20=\x20?',_0x2cdf30[_0xd2db('0x27')]['id']);for(var _0x2644dd=0x0;_0x2644dd<_0x1e92bb[_0xd2db('0x2e')];_0x2644dd+=0x1){let _0x34eea6=_0x1e92bb[_0x2644dd];for(var _0x30b00d=0x0;_0x30b00d<_0x34eea6['Agents'][_0xd2db('0x2e')];_0x30b00d+=0x1){let _0xef6828=_0x34eea6[_0xd2db('0x54')][_0x30b00d];var _0x52d5f2=_0x4f1540['clone']();_0x52d5f2[_0xd2db('0x22')](_0xd2db('0x63'),_0xef6828['id']);_0x2f9eca['push'](db[_0xd2db('0x59')][_0xd2db('0x2a')](_0x52d5f2[_0xd2db('0x64')](),{'type':db[_0xd2db('0x59')]['QueryTypes'][_0xd2db('0x65')]})[_0xd2db('0x16')](function(_0x5a23fd){if(_0x5a23fd['length']===0x1){return _0xef6828['id'];}else{var _0x540406=_[_0xd2db('0x66')](_['map'](_0x5a23fd,'TeamId'),function(_0x594d64){return _[_0xd2db('0x67')](_0x1b1791,_0x594d64);});if(_0x540406){return _0xef6828['id'];}}}));}}return BPromise[_0xd2db('0x68')](_0x2f9eca)[_0xd2db('0x16')](function(_0x78a069){_0x5aebca=_(_0x5aebca)['union'](_0x78a069)[_0xd2db('0x69')]()[_0xd2db('0x6a')]();return db[_0xd2db('0x23')][_0xd2db('0x32')]({'where':{'id':_0x2cdf30[_0xd2db('0x27')]['id']}})[_0xd2db('0x16')](function(_0x5e5df0){return db[_0xd2db('0x59')][_0xd2db('0x5a')](function(_0x18ab3a){return _0x5e5df0[_0xd2db('0x6b')](_0x2cdf30[_0xd2db('0x2a')]['ids'],{'transaction':_0x18ab3a})[_0xd2db('0x16')](function(){if(!_[_0xd2db('0x6c')](_0x5aebca)){return _0x5e5df0['removeAgents'](_0x5aebca,{'transaction':_0x18ab3a});}})['then'](function(){_0x5aebca[_0xd2db('0x6d')](function(_0x3a719e){socket['emit']('userMailQueue:remove',{'UserId':_0x3a719e,'MailQueueId':_0x5e5df0['id']});});});});});});})[_0xd2db('0x16')](respondWithStatusCode(_0x15bece,null))[_0xd2db('0x3c')](handleError(_0x15bece,null));};exports[_0xd2db('0x6e')]=function(_0x2f3792,_0x1afeda){return db['MailQueue'][_0xd2db('0x32')]({'where':{'id':_0x2f3792['params']['id']}})['then'](handleEntityNotFound(_0x1afeda,null))['then'](function(_0x51ca73){if(_0x51ca73){return _0x51ca73[_0xd2db('0x6e')](_0x2f3792['body']['ids'],_[_0xd2db('0x6f')](_0x2f3792[_0xd2db('0x34')],['ids','id'])||{})[_0xd2db('0x70')](function(_0x39956f){for(var _0x18b1b8=0x0;_0x18b1b8<_0x2f3792['body'][_0xd2db('0x53')][_0xd2db('0x2e')];_0x18b1b8+=0x1){socket[_0xd2db('0x5d')](_0xd2db('0x71'),{'UserId':Number(_0x2f3792[_0xd2db('0x34')][_0xd2db('0x53')][_0x18b1b8]),'MailQueueId':Number(_0x2f3792['params']['id'])});}return _0x39956f;});}})[_0xd2db('0x16')](respondWithResult(_0x1afeda,null))['catch'](handleError(_0x1afeda,null));};exports['removeAgents']=function(_0x4a6646,_0x5ab344){return db[_0xd2db('0x23')][_0xd2db('0x32')]({'where':{'id':_0x4a6646['params']['id']}})['then'](handleEntityNotFound(_0x5ab344,null))[_0xd2db('0x16')](function(_0x4dcc5f){if(_0x4dcc5f){return _0x4dcc5f[_0xd2db('0x72')](_0x4a6646['query']['ids'])[_0xd2db('0x16')](function(){if(_[_0xd2db('0x73')](_0x4a6646[_0xd2db('0x2a')][_0xd2db('0x53')])){for(var _0x45fbf1=0x0;_0x45fbf1<_0x4a6646['query'][_0xd2db('0x53')][_0xd2db('0x2e')];_0x45fbf1+=0x1){socket[_0xd2db('0x5d')]('userMailQueue:remove',{'UserId':Number(_0x4a6646[_0xd2db('0x2a')][_0xd2db('0x53')][_0x45fbf1]),'MailQueueId':Number(_0x4a6646['params']['id'])});}}else{socket[_0xd2db('0x5d')](_0xd2db('0x74'),{'UserId':Number(_0x4a6646[_0xd2db('0x2a')][_0xd2db('0x53')]),'MailQueueId':Number(_0x4a6646[_0xd2db('0x27')]['id'])});}});}})[_0xd2db('0x16')](respondWithStatusCode(_0x5ab344,null))['catch'](handleError(_0x5ab344,null));};exports[_0xd2db('0x75')]=function(_0x9ae6a0,_0x18a238){var _0xf3c9cd={};var _0x1ae83e={};var _0x151f29;var _0x32f9b0;return db['MailQueue']['findOne']({'where':{'id':_0x9ae6a0['params']['id']}})['then'](handleEntityNotFound(_0x18a238,null))['then'](function(_0x20ddde){if(_0x20ddde){_0x151f29=_0x20ddde;_0x1ae83e['model']=_['keys'](db[_0xd2db('0x47')][_0xd2db('0x1f')]);_0x1ae83e[_0xd2db('0x2a')]=_[_0xd2db('0x29')](_0x9ae6a0[_0xd2db('0x2a')]);_0x1ae83e[_0xd2db('0x2b')]=_[_0xd2db('0x2c')](_0x1ae83e['model'],_0x1ae83e['query']);_0xf3c9cd[_0xd2db('0x2d')]=_[_0xd2db('0x2c')](_0x1ae83e[_0xd2db('0x28')],qs[_0xd2db('0x41')](_0x9ae6a0['query'][_0xd2db('0x41')]));_0xf3c9cd[_0xd2db('0x2d')]=_0xf3c9cd[_0xd2db('0x2d')][_0xd2db('0x2e')]?_0xf3c9cd[_0xd2db('0x2d')]:_0x1ae83e[_0xd2db('0x28')];_0xf3c9cd['order']=qs['sort'](_0x9ae6a0[_0xd2db('0x2a')][_0xd2db('0x43')]);_0xf3c9cd['where']=qs['filters'](_[_0xd2db('0x44')](_0x9ae6a0[_0xd2db('0x2a')],_0x1ae83e[_0xd2db('0x2b')]));if(_0x9ae6a0[_0xd2db('0x2a')][_0xd2db('0x46')]){_0xf3c9cd[_0xd2db('0x22')]=_[_0xd2db('0x30')](_0xf3c9cd['where'],{'$or':_[_0xd2db('0x1e')](_0xf3c9cd[_0xd2db('0x2d')],function(_0x182579){var _0x1d6ff1={};_0x1d6ff1[_0x182579]={'$like':'%'+_0x9ae6a0[_0xd2db('0x2a')][_0xd2db('0x46')]+'%'};return _0x1d6ff1;})});}_0xf3c9cd=_['merge']({},_0xf3c9cd,_0x9ae6a0[_0xd2db('0x31')]);return _0x151f29[_0xd2db('0x75')](_0xf3c9cd);}})['then'](function(_0x205c59){if(_0x205c59){_0x32f9b0=_0x205c59['length'];if(!_0x9ae6a0[_0xd2db('0x2a')]['hasOwnProperty']('nolimit')){_0xf3c9cd[_0xd2db('0x12')]=qs[_0xd2db('0x12')](_0x9ae6a0[_0xd2db('0x2a')]['limit']);_0xf3c9cd[_0xd2db('0xf')]=qs['offset'](_0x9ae6a0[_0xd2db('0x2a')][_0xd2db('0xf')]);}return _0x151f29[_0xd2db('0x75')](_0xf3c9cd);}})[_0xd2db('0x16')](function(_0x262c94){if(_0x262c94){return _0x262c94?{'count':_0x32f9b0,'rows':_0x262c94}:null;}})[_0xd2db('0x16')](respondWithResult(_0x18a238,null))[_0xd2db('0x3c')](handleError(_0x18a238,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 5dbf3d0..114bcea 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 _0xb181=['emit','hasOwnProperty','hook','events','setMaxListeners','save','remove'];(function(_0x328043,_0x3458fb){var _0x1a5cbb=function(_0x11d525){while(--_0x11d525){_0x328043['push'](_0x328043['shift']());}};_0x1a5cbb(++_0x3458fb);}(_0xb181,0x130));var _0x1b18=function(_0x1a3921,_0x586fdd){_0x1a3921=_0x1a3921-0x0;var _0x2a1e32=_0xb181[_0x1a3921];return _0x2a1e32;};'use strict';var EventEmitter=require(_0x1b18('0x0'));var MailQueue=require('../../mysqldb')['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x1b18('0x1')](0x0);var events={'afterCreate':_0x1b18('0x2'),'afterUpdate':'update','afterDestroy':_0x1b18('0x3')};function emitEvent(_0x2a99bf){return function(_0x35ad81,_0x9ea335,_0x49cb5b){MailQueueEvents['emit'](_0x2a99bf+':'+_0x35ad81['id'],_0x35ad81);MailQueueEvents[_0x1b18('0x4')](_0x2a99bf,_0x35ad81);_0x49cb5b(null);};}for(var e in events){if(events[_0x1b18('0x5')](e)){var event=events[e];MailQueue[_0x1b18('0x6')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file +var _0x8c05=['save','update','emit','hasOwnProperty','hook','exports','../../mysqldb','MailQueue','setMaxListeners'];(function(_0x164595,_0x1c5e47){var _0x4ef91a=function(_0xe5f2af){while(--_0xe5f2af){_0x164595['push'](_0x164595['shift']());}};_0x4ef91a(++_0x1c5e47);}(_0x8c05,0x141));var _0x58c0=function(_0x3c96b6,_0xf57a10){_0x3c96b6=_0x3c96b6-0x0;var _0xfaa232=_0x8c05[_0x3c96b6];return _0xfaa232;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0x58c0('0x0'))['db'][_0x58c0('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x58c0('0x2')](0x0);var events={'afterCreate':_0x58c0('0x3'),'afterUpdate':_0x58c0('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3e8330){return function(_0x527b5d,_0x507db6,_0x3dad25){MailQueueEvents[_0x58c0('0x5')](_0x3e8330+':'+_0x527b5d['id'],_0x527b5d);MailQueueEvents[_0x58c0('0x5')](_0x3e8330,_0x527b5d);_0x3dad25(null);};}for(var e in events){if(events[_0x58c0('0x6')](e)){var event=events[e];MailQueue[_0x58c0('0x7')](e,emitEvent(event));}}module[_0x58c0('0x8')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index ee1fd84..8abfd57 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 _0xb8c0=['../../config/logger','moment','request-promise','../../config/environment','exports','define','MailQueue','mail_queues','util'];(function(_0x363cc2,_0x32ae4a){var _0x490814=function(_0x3dc973){while(--_0x3dc973){_0x363cc2['push'](_0x363cc2['shift']());}};_0x490814(++_0x32ae4a);}(_0xb8c0,0x11f));var _0x0b8c=function(_0x2903e7,_0x311fc8){_0x2903e7=_0x2903e7-0x0;var _0x388929=_0xb8c0[_0x2903e7];return _0x388929;};'use strict';var _=require('lodash');var util=require(_0x0b8c('0x0'));var logger=require(_0x0b8c('0x1'))('api');var moment=require(_0x0b8c('0x2'));var BPromise=require('bluebird');var rp=require(_0x0b8c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0b8c('0x4'));var attributes=require('./mailQueue.attributes');module[_0x0b8c('0x5')]=function(_0x3f16b5,_0x10caf7){return _0x3f16b5[_0x0b8c('0x6')](_0x0b8c('0x7'),attributes,{'tableName':_0x0b8c('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaa6d=['lodash','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./mailQueue.attributes','exports','define','MailQueue'];(function(_0x39bdfd,_0x529f3b){var _0x4b0c42=function(_0x4a070c){while(--_0x4a070c){_0x39bdfd['push'](_0x39bdfd['shift']());}};_0x4b0c42(++_0x529f3b);}(_0xaa6d,0xdc));var _0xdaa6=function(_0x44d01f,_0x170753){_0x44d01f=_0x44d01f-0x0;var _0x1232b6=_0xaa6d[_0x44d01f];return _0x1232b6;};'use strict';var _=require(_0xdaa6('0x0'));var util=require(_0xdaa6('0x1'));var logger=require(_0xdaa6('0x2'))('api');var moment=require('moment');var BPromise=require(_0xdaa6('0x3'));var rp=require(_0xdaa6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdaa6('0x5'));var config=require(_0xdaa6('0x6'));var attributes=require(_0xdaa6('0x7'));module[_0xdaa6('0x8')]=function(_0x36686c,_0x804b16){return _0x36686c[_0xdaa6('0x9')](_0xdaa6('0xa'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index ee4bf5b..f3024ff 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 _0xd5b4=['GetMailQueue','ShowMailQueue','find','debug','lodash','util','bluebird','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','then','MailQueue,\x20%s,\x20%s','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','MailQueue','findAll','raw','options','where','limit','include','map','model','attributes'];(function(_0x47f996,_0x121aec){var _0x4670ee=function(_0x3fa561){while(--_0x3fa561){_0x47f996['push'](_0x47f996['shift']());}};_0x4670ee(++_0x121aec);}(_0xd5b4,0xa0));var _0x4d5b=function(_0x2678f6,_0x1fa781){_0x2678f6=_0x2678f6-0x0;var _0x28e5de=_0xd5b4[_0x2678f6];return _0x28e5de;};'use strict';var _=require(_0x4d5b('0x0'));var util=require(_0x4d5b('0x1'));var moment=require('moment');var BPromise=require(_0x4d5b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4d5b('0x3'));var logger=require('../../config/logger')(_0x4d5b('0x4'));var config=require(_0x4d5b('0x5'));var jayson=require(_0x4d5b('0x6'));var client=jayson[_0x4d5b('0x7')][_0x4d5b('0x8')]({'port':0x232a});config['redis']=_[_0x4d5b('0x9')](config['redis'],{'host':_0x4d5b('0xa'),'port':0x18eb});var socket=require(_0x4d5b('0xb'))(new Redis(config['redis']));require(_0x4d5b('0xc'))[_0x4d5b('0xd')](socket);function respondWithRpcPromise(_0x5cadda,_0x3f1394,_0x1e458e){return new BPromise(function(_0x2b350f,_0x433925){return client['request'](_0x5cadda,_0x1e458e)[_0x4d5b('0xe')](function(_0x53bd1f){logger['info'](_0x4d5b('0xf'),_0x3f1394,_0x4d5b('0x10'));logger['debug'](_0x4d5b('0x11'),_0x3f1394,'request\x20sent',JSON[_0x4d5b('0x12')](_0x53bd1f));if(_0x53bd1f[_0x4d5b('0x13')]){if(_0x53bd1f['error'][_0x4d5b('0x14')]===0x1f4){logger['error'](_0x4d5b('0xf'),_0x3f1394,_0x53bd1f[_0x4d5b('0x13')][_0x4d5b('0x15')]);return _0x433925(_0x53bd1f[_0x4d5b('0x13')][_0x4d5b('0x15')]);}logger['error'](_0x4d5b('0xf'),_0x3f1394,_0x53bd1f[_0x4d5b('0x13')]['message']);return _0x2b350f(_0x53bd1f['error']['message']);}else{logger[_0x4d5b('0x16')](_0x4d5b('0xf'),_0x3f1394,_0x4d5b('0x10'));_0x2b350f(_0x53bd1f[_0x4d5b('0x17')][_0x4d5b('0x15')]);}})[_0x4d5b('0x18')](function(_0x5db797){logger[_0x4d5b('0x13')](_0x4d5b('0xf'),_0x3f1394,_0x5db797);_0x433925(_0x5db797);});});}exports['GetMailQueue']=function(_0x27a5b7){var _0x3ed1c2=this;return new Promise(function(_0x2d3de2,_0x25d2fc){return db[_0x4d5b('0x19')][_0x4d5b('0x1a')]({'raw':_0x27a5b7['options']?_0x27a5b7['options'][_0x4d5b('0x1b')]===undefined?!![]:![]:!![],'where':_0x27a5b7[_0x4d5b('0x1c')]?_0x27a5b7[_0x4d5b('0x1c')][_0x4d5b('0x1d')]||null:null,'attributes':_0x27a5b7[_0x4d5b('0x1c')]?_0x27a5b7[_0x4d5b('0x1c')]['attributes']||null:null,'limit':_0x27a5b7[_0x4d5b('0x1c')]?_0x27a5b7[_0x4d5b('0x1c')][_0x4d5b('0x1e')]||null:null,'include':_0x27a5b7[_0x4d5b('0x1c')]?_0x27a5b7['options'][_0x4d5b('0x1f')]?_[_0x4d5b('0x20')](_0x27a5b7[_0x4d5b('0x1c')][_0x4d5b('0x1f')],function(_0x4e1be7){return{'model':db[_0x4e1be7[_0x4d5b('0x21')]],'as':_0x4e1be7['as'],'attributes':_0x4e1be7[_0x4d5b('0x22')],'include':_0x4e1be7[_0x4d5b('0x1f')]?_['map'](_0x4e1be7[_0x4d5b('0x1f')],function(_0x1188d7){return{'model':db[_0x1188d7[_0x4d5b('0x21')]],'as':_0x1188d7['as'],'attributes':_0x1188d7[_0x4d5b('0x22')],'include':_0x1188d7[_0x4d5b('0x1f')]?_[_0x4d5b('0x20')](_0x1188d7[_0x4d5b('0x1f')],function(_0x3e326b){return{'model':db[_0x3e326b[_0x4d5b('0x21')]],'as':_0x3e326b['as'],'attributes':_0x3e326b[_0x4d5b('0x22')]};}):[]};}):[]};}):[]:[]})[_0x4d5b('0xe')](function(_0x5c7dc7){logger[_0x4d5b('0x16')](_0x4d5b('0x23'),_0x27a5b7);logger['debug']('GetMailQueue',_0x27a5b7,JSON[_0x4d5b('0x12')](_0x5c7dc7));_0x2d3de2(_0x5c7dc7);})[_0x4d5b('0x18')](function(_0x13e407){logger[_0x4d5b('0x13')]('GetMailQueue',_0x13e407['message'],_0x27a5b7);_0x25d2fc(_0x3ed1c2['error'](0x1f4,_0x13e407['message']));});});};exports[_0x4d5b('0x24')]=function(_0x23b547){var _0x2654ed=this;return new Promise(function(_0x5e2601,_0x57a52f){return db[_0x4d5b('0x19')][_0x4d5b('0x25')]({'raw':_0x23b547['options']?_0x23b547[_0x4d5b('0x1c')][_0x4d5b('0x1b')]===undefined?!![]:![]:!![],'where':_0x23b547[_0x4d5b('0x1c')]?_0x23b547[_0x4d5b('0x1c')][_0x4d5b('0x1d')]||null:null,'attributes':_0x23b547[_0x4d5b('0x1c')]?_0x23b547['options'][_0x4d5b('0x22')]||null:null,'include':_0x23b547[_0x4d5b('0x1c')]?_0x23b547['options'][_0x4d5b('0x1f')]?_[_0x4d5b('0x20')](_0x23b547[_0x4d5b('0x1c')][_0x4d5b('0x1f')],function(_0x237f2a){return{'model':db[_0x237f2a[_0x4d5b('0x21')]],'as':_0x237f2a['as'],'attributes':_0x237f2a[_0x4d5b('0x22')],'include':_0x237f2a[_0x4d5b('0x1f')]?_[_0x4d5b('0x20')](_0x237f2a[_0x4d5b('0x1f')],function(_0x549a83){return{'model':db[_0x549a83[_0x4d5b('0x21')]],'as':_0x549a83['as'],'attributes':_0x549a83[_0x4d5b('0x22')],'include':_0x549a83[_0x4d5b('0x1f')]?_[_0x4d5b('0x20')](_0x549a83['include'],function(_0x127189){return{'model':db[_0x127189[_0x4d5b('0x21')]],'as':_0x127189['as'],'attributes':_0x127189['attributes']};}):[]};}):[]};}):[]:[]})[_0x4d5b('0xe')](function(_0x4c2c07){logger[_0x4d5b('0x16')]('ShowMailQueue',_0x23b547);logger[_0x4d5b('0x26')](_0x4d5b('0x24'),_0x23b547,JSON[_0x4d5b('0x12')](_0x4c2c07));_0x5e2601(_0x4c2c07);})[_0x4d5b('0x18')](function(_0x33370c){logger[_0x4d5b('0x13')](_0x4d5b('0x24'),_0x33370c['message'],_0x23b547);_0x57a52f(_0x2654ed[_0x4d5b('0x13')](0x1f4,_0x33370c['message']));});});}; \ No newline at end of file +var _0x8f99=['findAll','options','where','include','attributes','map','ShowMailQueue','find','raw','model','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailQueue','MailQueue'];(function(_0x485f35,_0x45a0fc){var _0x2ad118=function(_0x296650){while(--_0x296650){_0x485f35['push'](_0x485f35['shift']());}};_0x2ad118(++_0x45a0fc);}(_0x8f99,0x184));var _0x98f9=function(_0x571513,_0x11e020){_0x571513=_0x571513-0x0;var _0x277712=_0x8f99[_0x571513];return _0x277712;};'use strict';var _=require('lodash');var util=require(_0x98f9('0x0'));var moment=require(_0x98f9('0x1'));var BPromise=require(_0x98f9('0x2'));var rs=require(_0x98f9('0x3'));var fs=require('fs');var Redis=require(_0x98f9('0x4'));var db=require(_0x98f9('0x5'))['db'];var utils=require(_0x98f9('0x6'));var logger=require(_0x98f9('0x7'))('rpc');var config=require(_0x98f9('0x8'));var jayson=require(_0x98f9('0x9'));var client=jayson[_0x98f9('0xa')][_0x98f9('0xb')]({'port':0x232a});config[_0x98f9('0xc')]=_['defaults'](config[_0x98f9('0xc')],{'host':_0x98f9('0xd'),'port':0x18eb});var socket=require(_0x98f9('0xe'))(new Redis(config[_0x98f9('0xc')]));require(_0x98f9('0xf'))[_0x98f9('0x10')](socket);function respondWithRpcPromise(_0xc8a471,_0x5a48c4,_0x3c67ca){return new BPromise(function(_0x413ac9,_0x1f80c6){return client[_0x98f9('0x11')](_0xc8a471,_0x3c67ca)[_0x98f9('0x12')](function(_0xa11eef){logger[_0x98f9('0x13')](_0x98f9('0x14'),_0x5a48c4,_0x98f9('0x15'));logger[_0x98f9('0x16')](_0x98f9('0x17'),_0x5a48c4,_0x98f9('0x15'),JSON[_0x98f9('0x18')](_0xa11eef));if(_0xa11eef[_0x98f9('0x19')]){if(_0xa11eef[_0x98f9('0x19')][_0x98f9('0x1a')]===0x1f4){logger[_0x98f9('0x19')]('MailQueue,\x20%s,\x20%s',_0x5a48c4,_0xa11eef[_0x98f9('0x19')]['message']);return _0x1f80c6(_0xa11eef['error'][_0x98f9('0x1b')]);}logger[_0x98f9('0x19')](_0x98f9('0x14'),_0x5a48c4,_0xa11eef[_0x98f9('0x19')]['message']);return _0x413ac9(_0xa11eef[_0x98f9('0x19')]['message']);}else{logger['info'](_0x98f9('0x14'),_0x5a48c4,_0x98f9('0x15'));_0x413ac9(_0xa11eef[_0x98f9('0x1c')]['message']);}})[_0x98f9('0x1d')](function(_0x32b7f9){logger[_0x98f9('0x19')](_0x98f9('0x14'),_0x5a48c4,_0x32b7f9);_0x1f80c6(_0x32b7f9);});});}exports[_0x98f9('0x1e')]=function(_0x3dd921){var _0x1c0cfc=this;return new Promise(function(_0x27d550,_0x53d012){return db[_0x98f9('0x1f')][_0x98f9('0x20')]({'raw':_0x3dd921[_0x98f9('0x21')]?_0x3dd921[_0x98f9('0x21')]['raw']===undefined?!![]:![]:!![],'where':_0x3dd921[_0x98f9('0x21')]?_0x3dd921[_0x98f9('0x21')][_0x98f9('0x22')]||null:null,'attributes':_0x3dd921[_0x98f9('0x21')]?_0x3dd921[_0x98f9('0x21')]['attributes']||null:null,'limit':_0x3dd921[_0x98f9('0x21')]?_0x3dd921[_0x98f9('0x21')]['limit']||null:null,'include':_0x3dd921[_0x98f9('0x21')]?_0x3dd921[_0x98f9('0x21')][_0x98f9('0x23')]?_['map'](_0x3dd921['options'][_0x98f9('0x23')],function(_0x13612d){return{'model':db[_0x13612d['model']],'as':_0x13612d['as'],'attributes':_0x13612d[_0x98f9('0x24')],'include':_0x13612d[_0x98f9('0x23')]?_[_0x98f9('0x25')](_0x13612d[_0x98f9('0x23')],function(_0x7b4c35){return{'model':db[_0x7b4c35['model']],'as':_0x7b4c35['as'],'attributes':_0x7b4c35['attributes'],'include':_0x7b4c35[_0x98f9('0x23')]?_[_0x98f9('0x25')](_0x7b4c35[_0x98f9('0x23')],function(_0xc3a856){return{'model':db[_0xc3a856['model']],'as':_0xc3a856['as'],'attributes':_0xc3a856[_0x98f9('0x24')]};}):[]};}):[]};}):[]:[]})[_0x98f9('0x12')](function(_0x2e9100){logger[_0x98f9('0x13')](_0x98f9('0x1e'),_0x3dd921);logger['debug'](_0x98f9('0x1e'),_0x3dd921,JSON['stringify'](_0x2e9100));_0x27d550(_0x2e9100);})[_0x98f9('0x1d')](function(_0x233140){logger['error'](_0x98f9('0x1e'),_0x233140[_0x98f9('0x1b')],_0x3dd921);_0x53d012(_0x1c0cfc[_0x98f9('0x19')](0x1f4,_0x233140['message']));});});};exports[_0x98f9('0x26')]=function(_0x107156){var _0x56ffcb=this;return new Promise(function(_0x2af9e4,_0x55b470){return db[_0x98f9('0x1f')][_0x98f9('0x27')]({'raw':_0x107156[_0x98f9('0x21')]?_0x107156[_0x98f9('0x21')][_0x98f9('0x28')]===undefined?!![]:![]:!![],'where':_0x107156[_0x98f9('0x21')]?_0x107156[_0x98f9('0x21')]['where']||null:null,'attributes':_0x107156[_0x98f9('0x21')]?_0x107156[_0x98f9('0x21')][_0x98f9('0x24')]||null:null,'include':_0x107156[_0x98f9('0x21')]?_0x107156[_0x98f9('0x21')][_0x98f9('0x23')]?_[_0x98f9('0x25')](_0x107156[_0x98f9('0x21')][_0x98f9('0x23')],function(_0x262e1d){return{'model':db[_0x262e1d[_0x98f9('0x29')]],'as':_0x262e1d['as'],'attributes':_0x262e1d[_0x98f9('0x24')],'include':_0x262e1d['include']?_[_0x98f9('0x25')](_0x262e1d[_0x98f9('0x23')],function(_0x1806d1){return{'model':db[_0x1806d1[_0x98f9('0x29')]],'as':_0x1806d1['as'],'attributes':_0x1806d1[_0x98f9('0x24')],'include':_0x1806d1[_0x98f9('0x23')]?_[_0x98f9('0x25')](_0x1806d1['include'],function(_0x473712){return{'model':db[_0x473712[_0x98f9('0x29')]],'as':_0x473712['as'],'attributes':_0x473712[_0x98f9('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xb707dd){logger[_0x98f9('0x13')]('ShowMailQueue',_0x107156);logger[_0x98f9('0x16')](_0x98f9('0x26'),_0x107156,JSON['stringify'](_0xb707dd));_0x2af9e4(_0xb707dd);})['catch'](function(_0x1c6cfd){logger['error'](_0x98f9('0x26'),_0x1c6cfd['message'],_0x107156);_0x55b470(_0x56ffcb['error'](0x1f4,_0x1c6cfd[_0x98f9('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index c2ad4f6..51b6b6d 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 _0x1856=['update','emit','removeListener','length','mailQueue:','./mailQueue.events'];(function(_0x4470b4,_0x2d1245){var _0x317e5a=function(_0x398e3d){while(--_0x398e3d){_0x4470b4['push'](_0x4470b4['shift']());}};_0x317e5a(++_0x2d1245);}(_0x1856,0x185));var _0x6185=function(_0x41722d,_0x37d74c){_0x41722d=_0x41722d-0x0;var _0xafc6d1=_0x1856[_0x41722d];return _0xafc6d1;};'use strict';var MailQueueEvents=require(_0x6185('0x0'));var events=['save','remove',_0x6185('0x1')];function createListener(_0x304126,_0x4c9ab7){return function(_0x11ae86){_0x4c9ab7[_0x6185('0x2')](_0x304126,_0x11ae86);};}function removeListener(_0xfd3b0d,_0x2b2dc3){return function(){MailQueueEvents[_0x6185('0x3')](_0xfd3b0d,_0x2b2dc3);};}exports['register']=function(_0x51a08f){for(var _0x3a0676=0x0,_0x1ff3e6=events[_0x6185('0x4')];_0x3a0676<_0x1ff3e6;_0x3a0676++){var _0x56dfa6=events[_0x3a0676];var _0x4d9d86=createListener(_0x6185('0x5')+_0x56dfa6,_0x51a08f);MailQueueEvents['on'](_0x56dfa6,_0x4d9d86);}}; \ No newline at end of file +var _0x15e8=['removeListener','mailQueue:','save','update','emit'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0x15e8,0x13d));var _0x815e=function(_0x514a77,_0x2c8e51){_0x514a77=_0x514a77-0x0;var _0x3c7f46=_0x15e8[_0x514a77];return _0x3c7f46;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0x815e('0x0'),'remove',_0x815e('0x1')];function createListener(_0x7b9f93,_0x3fabf8){return function(_0x1bac02){_0x3fabf8[_0x815e('0x2')](_0x7b9f93,_0x1bac02);};}function removeListener(_0x20bbe6,_0x2dc9cb){return function(){MailQueueEvents[_0x815e('0x3')](_0x20bbe6,_0x2dc9cb);};}exports['register']=function(_0x4147f2){for(var _0xa7cf7d=0x0,_0xcbfe4e=events['length'];_0xa7cf7d<_0xcbfe4e;_0xa7cf7d++){var _0x2563c4=events[_0xa7cf7d];var _0x5798b1=createListener(_0x815e('0x4')+_0x2563c4,_0x4147f2);MailQueueEvents['on'](_0x2563c4,_0x5798b1);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 0f305b9..4987089 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 _0xa200=['put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create'];(function(_0x93f145,_0x2ad475){var _0x5e68ad=function(_0x77d156){while(--_0x77d156){_0x93f145['push'](_0x93f145['shift']());}};_0x5e68ad(++_0x2ad475);}(_0xa200,0x7c));var _0x0a20=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xa200[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0a20('0x0'));var util=require(_0x0a20('0x1'));var path=require(_0x0a20('0x2'));var timeout=require(_0x0a20('0x3'));var express=require(_0x0a20('0x4'));var router=express[_0x0a20('0x5')]();var fs_extra=require(_0x0a20('0x6'));var auth=require(_0x0a20('0x7'));var interaction=require(_0x0a20('0x8'));var config=require(_0x0a20('0x9'));var controller=require(_0x0a20('0xa'));router[_0x0a20('0xb')]('/',auth[_0x0a20('0xc')](),controller[_0x0a20('0xd')]);router[_0x0a20('0xb')](_0x0a20('0xe'),auth['isAuthenticated'](),controller[_0x0a20('0xf')]);router[_0x0a20('0xb')](_0x0a20('0x10'),auth['isAuthenticated'](),controller[_0x0a20('0x11')]);router[_0x0a20('0x12')]('/',auth[_0x0a20('0xc')](),controller[_0x0a20('0x13')]);router[_0x0a20('0x14')](_0x0a20('0x10'),auth[_0x0a20('0xc')](),controller['update']);router[_0x0a20('0x15')](_0x0a20('0x10'),auth[_0x0a20('0xc')](),controller[_0x0a20('0x16')]);module[_0x0a20('0x17')]=router; \ No newline at end of file +var _0x55c8=['post','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x5b8b97,_0x6b4dfa){var _0x1fdf84=function(_0x2ced4c){while(--_0x2ced4c){_0x5b8b97['push'](_0x5b8b97['shift']());}};_0x1fdf84(++_0x6b4dfa);}(_0x55c8,0x7d));var _0x855c=function(_0x5704f0,_0x40fce3){_0x5704f0=_0x5704f0-0x0;var _0x22fade=_0x55c8[_0x5704f0];return _0x22fade;};'use strict';var multer=require('multer');var util=require(_0x855c('0x0'));var path=require(_0x855c('0x1'));var timeout=require(_0x855c('0x2'));var express=require(_0x855c('0x3'));var router=express[_0x855c('0x4')]();var fs_extra=require(_0x855c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x855c('0x6'));var config=require('../../config/environment');var controller=require(_0x855c('0x7'));router[_0x855c('0x8')]('/',auth[_0x855c('0x9')](),controller[_0x855c('0xa')]);router[_0x855c('0x8')](_0x855c('0xb'),auth['isAuthenticated'](),controller[_0x855c('0xc')]);router[_0x855c('0x8')](_0x855c('0xd'),auth[_0x855c('0x9')](),controller[_0x855c('0xe')]);router[_0x855c('0xf')]('/',auth[_0x855c('0x9')](),controller['create']);router['put'](_0x855c('0xd'),auth[_0x855c('0x9')](),controller[_0x855c('0x10')]);router[_0x855c('0x11')](_0x855c('0xd'),auth[_0x855c('0x9')](),controller[_0x855c('0x12')]);module[_0x855c('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 6d09218..cd3e71b 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 _0x05da=['moment','sequelize','STRING','DATE'];(function(_0x47fb59,_0x862899){var _0x2bf187=function(_0x1d629){while(--_0x1d629){_0x47fb59['push'](_0x47fb59['shift']());}};_0x2bf187(++_0x862899);}(_0x05da,0x94));var _0xa05d=function(_0x2b0b50,_0x3f9d7d){_0x2b0b50=_0x2b0b50-0x0;var _0x60755d=_0x05da[_0x2b0b50];return _0x60755d;};'use strict';var moment=require(_0xa05d('0x0'));var Sequelize=require(_0xa05d('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xa05d('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xa05d('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xa05d('0x3')]},'exitAt':{'type':Sequelize[_0xa05d('0x3')]},'reason':{'type':Sequelize[_0xa05d('0x2')]}}; \ No newline at end of file +var _0x22f3=['moment','sequelize','exports','STRING','DATE'];(function(_0x121b1a,_0x42fdb7){var _0x2d89a6=function(_0x1b6027){while(--_0x1b6027){_0x121b1a['push'](_0x121b1a['shift']());}};_0x2d89a6(++_0x42fdb7);}(_0x22f3,0x73));var _0x322f=function(_0x36c0bc,_0x599030){_0x36c0bc=_0x36c0bc-0x0;var _0x44f6c8=_0x22f3[_0x36c0bc];return _0x44f6c8;};'use strict';var moment=require(_0x322f('0x0'));var Sequelize=require(_0x322f('0x1'));module[_0x322f('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x322f('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x322f('0x4')]},'acceptAt':{'type':Sequelize[_0x322f('0x4')]},'exitAt':{'type':Sequelize[_0x322f('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index b26ac38..f720a78 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 _0xc6ac=['filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','show','params','includeAll','include','find','catch','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','then','destroy','end','error','name','send','MailQueueReport','rawAttributes','fieldName','type','key','map','query','keys'];(function(_0x3f5dca,_0x59472b){var _0x5b833a=function(_0x1cb84b){while(--_0x1cb84b){_0x3f5dca['push'](_0x3f5dca['shift']());}};_0x5b833a(++_0x59472b);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x64045a,_0x1c7e70){_0x64045a=_0x64045a-0x0;var _0x38bd10=_0xc6ac[_0x64045a];return _0x38bd10;};'use strict';var emlformat=require(_0xcc6a('0x0'));var rimraf=require(_0xcc6a('0x1'));var zipdir=require(_0xcc6a('0x2'));var jsonpatch=require(_0xcc6a('0x3'));var rp=require(_0xcc6a('0x4'));var moment=require(_0xcc6a('0x5'));var BPromise=require(_0xcc6a('0x6'));var Mustache=require(_0xcc6a('0x7'));var util=require(_0xcc6a('0x8'));var path=require(_0xcc6a('0x9'));var sox=require(_0xcc6a('0xa'));var csv=require(_0xcc6a('0xb'));var ejs=require(_0xcc6a('0xc'));var fs=require('fs');var fs_extra=require(_0xcc6a('0xd'));var _=require('lodash');var squel=require(_0xcc6a('0xe'));var crypto=require(_0xcc6a('0xf'));var jsforce=require(_0xcc6a('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xcc6a('0xb'));var querystring=require(_0xcc6a('0x11'));var Papa=require(_0xcc6a('0x12'));var Redis=require(_0xcc6a('0x13'));var authService=require(_0xcc6a('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xcc6a('0x15'));var hardwareService=require(_0xcc6a('0x16'));var logger=require(_0xcc6a('0x17'))('api');var utils=require(_0xcc6a('0x18'));var config=require(_0xcc6a('0x19'));var licenseUtil=require(_0xcc6a('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x59ce6d,_0xf0f6d5){_0xf0f6d5=_0xf0f6d5||0xcc;return function(_0x211444){if(_0x211444){return _0x59ce6d[_0xcc6a('0x1b')](_0xf0f6d5);}return _0x59ce6d['status'](_0xf0f6d5)['end']();};}function respondWithResult(_0x369dc1,_0xcb9e2e){_0xcb9e2e=_0xcb9e2e||0xc8;return function(_0x43710d){if(_0x43710d){return _0x369dc1[_0xcc6a('0x1c')](_0xcb9e2e)[_0xcc6a('0x1d')](_0x43710d);}};}function respondWithFilteredResult(_0x337ec5,_0x4133fa){return function(_0x403b18){if(_0x403b18){var _0x56ffb0=typeof _0x4133fa['offset']==='undefined'&&typeof _0x4133fa[_0xcc6a('0x1e')]===_0xcc6a('0x1f');var _0x307f2a=_0x403b18[_0xcc6a('0x20')];var _0x33079c=_0x56ffb0?0x0:_0x4133fa[_0xcc6a('0x21')];var _0x2d9585=_0x56ffb0?_0x403b18[_0xcc6a('0x20')]:_0x4133fa[_0xcc6a('0x21')]+_0x4133fa[_0xcc6a('0x1e')];var _0x1d20a3;if(_0x2d9585>=_0x307f2a){_0x2d9585=_0x307f2a;_0x1d20a3=0xc8;}else{_0x1d20a3=0xce;}_0x337ec5['status'](_0x1d20a3);return _0x337ec5[_0xcc6a('0x22')](_0xcc6a('0x23'),_0x33079c+'-'+_0x2d9585+'/'+_0x307f2a)[_0xcc6a('0x1d')](_0x403b18);}return null;};}function patchUpdates(_0x368a6e){return function(_0x1495d8){try{jsonpatch[_0xcc6a('0x24')](_0x1495d8,_0x368a6e,!![]);}catch(_0x36c80f){return BPromise[_0xcc6a('0x25')](_0x36c80f);}return _0x1495d8[_0xcc6a('0x26')]();};}function saveUpdates(_0x19d32c,_0x329d17){return function(_0x845088){if(_0x845088){return _0x845088['update'](_0x19d32c)[_0xcc6a('0x27')](function(_0x3a081e){return _0x3a081e;});}return null;};}function removeEntity(_0x38f812,_0x581aae){return function(_0x10016a){if(_0x10016a){return _0x10016a[_0xcc6a('0x28')]()[_0xcc6a('0x27')](function(){_0x38f812[_0xcc6a('0x1c')](0xcc)[_0xcc6a('0x29')]();});}};}function handleEntityNotFound(_0x5fc697,_0x50abc1){return function(_0x26def8){if(!_0x26def8){_0x5fc697[_0xcc6a('0x1b')](0x194);}return _0x26def8;};}function handleError(_0x3514f3,_0x5f27e5){_0x5f27e5=_0x5f27e5||0x1f4;return function(_0x3afb3a){logger[_0xcc6a('0x2a')](_0x3afb3a['stack']);if(_0x3afb3a[_0xcc6a('0x2b')]){delete _0x3afb3a[_0xcc6a('0x2b')];}_0x3514f3[_0xcc6a('0x1c')](_0x5f27e5)[_0xcc6a('0x2c')](_0x3afb3a);};}exports['index']=function(_0x194aab,_0x3cf14c){var _0x2c6d88={},_0x4f176b={},_0x2590a2={'count':0x0,'rows':[]};var _0x5308d4=_['map'](db[_0xcc6a('0x2d')][_0xcc6a('0x2e')],function(_0x3aa315){return{'name':_0x3aa315[_0xcc6a('0x2f')],'type':_0x3aa315[_0xcc6a('0x30')][_0xcc6a('0x31')]};});_0x4f176b['model']=_[_0xcc6a('0x32')](_0x5308d4,_0xcc6a('0x2b'));_0x4f176b[_0xcc6a('0x33')]=_[_0xcc6a('0x34')](_0x194aab[_0xcc6a('0x33')]);_0x4f176b[_0xcc6a('0x35')]=_[_0xcc6a('0x36')](_0x4f176b[_0xcc6a('0x37')],_0x4f176b['query']);_0x2c6d88[_0xcc6a('0x38')]=_[_0xcc6a('0x36')](_0x4f176b[_0xcc6a('0x37')],qs[_0xcc6a('0x39')](_0x194aab[_0xcc6a('0x33')][_0xcc6a('0x39')]));_0x2c6d88[_0xcc6a('0x38')]=_0x2c6d88['attributes'][_0xcc6a('0x3a')]?_0x2c6d88['attributes']:_0x4f176b['model'];if(!_0x194aab['query'][_0xcc6a('0x3b')](_0xcc6a('0x3c'))){_0x2c6d88[_0xcc6a('0x1e')]=qs[_0xcc6a('0x1e')](_0x194aab[_0xcc6a('0x33')]['limit']);_0x2c6d88['offset']=qs[_0xcc6a('0x21')](_0x194aab[_0xcc6a('0x33')][_0xcc6a('0x21')]);}_0x2c6d88['order']=qs[_0xcc6a('0x3d')](_0x194aab[_0xcc6a('0x33')][_0xcc6a('0x3d')]);_0x2c6d88[_0xcc6a('0x3e')]=qs[_0xcc6a('0x35')](_[_0xcc6a('0x3f')](_0x194aab[_0xcc6a('0x33')],_0x4f176b[_0xcc6a('0x35')]),_0x5308d4);if(_0x194aab[_0xcc6a('0x33')][_0xcc6a('0x40')]){_0x2c6d88[_0xcc6a('0x3e')]=_[_0xcc6a('0x41')](_0x2c6d88[_0xcc6a('0x3e')],{'$or':_[_0xcc6a('0x32')](_0x5308d4,function(_0x262a1e){if(_0x262a1e[_0xcc6a('0x30')]!==_0xcc6a('0x42')){var _0x386cbc={};_0x386cbc[_0x262a1e['name']]={'$like':'%'+_0x194aab['query'][_0xcc6a('0x40')]+'%'};return _0x386cbc;}})});}_0x2c6d88=_[_0xcc6a('0x41')]({},_0x2c6d88,_0x194aab[_0xcc6a('0x43')]);var _0x1fd8e1={'where':_0x2c6d88[_0xcc6a('0x3e')]};return db[_0xcc6a('0x2d')][_0xcc6a('0x20')](_0x1fd8e1)[_0xcc6a('0x27')](function(_0x49b65c){_0x2590a2['count']=_0x49b65c;if(_0x194aab[_0xcc6a('0x33')]['includeAll']){_0x2c6d88['include']=[{'all':!![]}];}return db['MailQueueReport'][_0xcc6a('0x44')](_0x2c6d88);})[_0xcc6a('0x27')](function(_0xb42897){_0x2590a2[_0xcc6a('0x45')]=_0xb42897;return _0x2590a2;})[_0xcc6a('0x27')](respondWithFilteredResult(_0x3cf14c,_0x2c6d88))['catch'](handleError(_0x3cf14c,null));};exports[_0xcc6a('0x46')]=function(_0xfbb079,_0x17e5a0){var _0x2f966f={'raw':!![],'where':{'id':_0xfbb079[_0xcc6a('0x47')]['id']}},_0x14ca90={};_0x14ca90['model']=_[_0xcc6a('0x34')](db[_0xcc6a('0x2d')][_0xcc6a('0x2e')]);_0x14ca90[_0xcc6a('0x33')]=_['keys'](_0xfbb079[_0xcc6a('0x33')]);_0x14ca90['filters']=_[_0xcc6a('0x36')](_0x14ca90[_0xcc6a('0x37')],_0x14ca90[_0xcc6a('0x33')]);_0x2f966f['attributes']=_[_0xcc6a('0x36')](_0x14ca90[_0xcc6a('0x37')],qs[_0xcc6a('0x39')](_0xfbb079['query']['fields']));_0x2f966f[_0xcc6a('0x38')]=_0x2f966f[_0xcc6a('0x38')][_0xcc6a('0x3a')]?_0x2f966f[_0xcc6a('0x38')]:_0x14ca90[_0xcc6a('0x37')];if(_0xfbb079['query'][_0xcc6a('0x48')]){_0x2f966f[_0xcc6a('0x49')]=[{'all':!![]}];}_0x2f966f=_['merge']({},_0x2f966f,_0xfbb079[_0xcc6a('0x43')]);return db[_0xcc6a('0x2d')][_0xcc6a('0x4a')](_0x2f966f)[_0xcc6a('0x27')](handleEntityNotFound(_0x17e5a0,null))[_0xcc6a('0x27')](respondWithResult(_0x17e5a0,null))[_0xcc6a('0x4b')](handleError(_0x17e5a0,null));};exports['create']=function(_0x4e1a0b,_0x47c999){return db[_0xcc6a('0x2d')][_0xcc6a('0x4c')](_0x4e1a0b[_0xcc6a('0x4d')],{})[_0xcc6a('0x27')](respondWithResult(_0x47c999,0xc9))['catch'](handleError(_0x47c999,null));};exports[_0xcc6a('0x4e')]=function(_0x5e7bab,_0x3aa7dd){if(_0x5e7bab[_0xcc6a('0x4d')]['id']){delete _0x5e7bab[_0xcc6a('0x4d')]['id'];}return db[_0xcc6a('0x2d')][_0xcc6a('0x4a')]({'where':{'id':_0x5e7bab[_0xcc6a('0x47')]['id']}})['then'](handleEntityNotFound(_0x3aa7dd,null))[_0xcc6a('0x27')](saveUpdates(_0x5e7bab[_0xcc6a('0x4d')],null))[_0xcc6a('0x27')](respondWithResult(_0x3aa7dd,null))[_0xcc6a('0x4b')](handleError(_0x3aa7dd,null));};exports[_0xcc6a('0x28')]=function(_0x362bf6,_0x431684){return db[_0xcc6a('0x2d')][_0xcc6a('0x4a')]({'where':{'id':_0x362bf6[_0xcc6a('0x47')]['id']}})['then'](handleEntityNotFound(_0x431684,null))[_0xcc6a('0x27')](removeEntity(_0x431684,null))[_0xcc6a('0x4b')](handleError(_0x431684,null));};exports[_0xcc6a('0x4f')]=function(_0x34531d,_0x14f5e5){return db[_0xcc6a('0x2d')]['describe']()['then'](respondWithResult(_0x14f5e5,null))[_0xcc6a('0x4b')](handleError(_0x14f5e5,null));}; \ No newline at end of file +var _0x627e=['limit','count','set','reject','save','then','destroy','error','stack','name','index','MailQueueReport','fieldName','key','map','query','keys','filters','intersection','model','attributes','hasOwnProperty','nolimit','sort','where','pick','type','VIRTUAL','filter','merge','options','rows','catch','params','fields','length','includeAll','include','find','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x3a236f,_0x28488e){var _0x5bf8c2=function(_0xa02005){while(--_0xa02005){_0x3a236f['push'](_0x3a236f['shift']());}};_0x5bf8c2(++_0x28488e);}(_0x627e,0x14a));var _0xe627=function(_0x292bec,_0x29ec50){_0x292bec=_0x292bec-0x0;var _0x231869=_0x627e[_0x292bec];return _0x231869;};'use strict';var emlformat=require(_0xe627('0x0'));var rimraf=require(_0xe627('0x1'));var zipdir=require(_0xe627('0x2'));var jsonpatch=require(_0xe627('0x3'));var rp=require(_0xe627('0x4'));var moment=require('moment');var BPromise=require(_0xe627('0x5'));var Mustache=require(_0xe627('0x6'));var util=require(_0xe627('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe627('0x8'));var fs=require('fs');var fs_extra=require(_0xe627('0x9'));var _=require(_0xe627('0xa'));var squel=require(_0xe627('0xb'));var crypto=require(_0xe627('0xc'));var jsforce=require(_0xe627('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe627('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe627('0xf'));var authService=require(_0xe627('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe627('0x11'));var logger=require(_0xe627('0x12'))(_0xe627('0x13'));var utils=require(_0xe627('0x14'));var config=require(_0xe627('0x15'));var licenseUtil=require(_0xe627('0x16'));var db=require(_0xe627('0x17'))['db'];function respondWithStatusCode(_0x3919be,_0x1922f5){_0x1922f5=_0x1922f5||0xcc;return function(_0x582190){if(_0x582190){return _0x3919be[_0xe627('0x18')](_0x1922f5);}return _0x3919be[_0xe627('0x19')](_0x1922f5)[_0xe627('0x1a')]();};}function respondWithResult(_0x4be370,_0x42dd1c){_0x42dd1c=_0x42dd1c||0xc8;return function(_0x1e2e62){if(_0x1e2e62){return _0x4be370[_0xe627('0x19')](_0x42dd1c)[_0xe627('0x1b')](_0x1e2e62);}};}function respondWithFilteredResult(_0x62896f,_0x6a9a15){return function(_0x271325){if(_0x271325){var _0x54720a=typeof _0x6a9a15[_0xe627('0x1c')]===_0xe627('0x1d')&&typeof _0x6a9a15[_0xe627('0x1e')]===_0xe627('0x1d');var _0x403982=_0x271325[_0xe627('0x1f')];var _0x56559b=_0x54720a?0x0:_0x6a9a15[_0xe627('0x1c')];var _0x538b22=_0x54720a?_0x271325[_0xe627('0x1f')]:_0x6a9a15['offset']+_0x6a9a15[_0xe627('0x1e')];var _0x565213;if(_0x538b22>=_0x403982){_0x538b22=_0x403982;_0x565213=0xc8;}else{_0x565213=0xce;}_0x62896f['status'](_0x565213);return _0x62896f[_0xe627('0x20')]('Content-Range',_0x56559b+'-'+_0x538b22+'/'+_0x403982)[_0xe627('0x1b')](_0x271325);}return null;};}function patchUpdates(_0x3391ce){return function(_0x4adde7){try{jsonpatch['apply'](_0x4adde7,_0x3391ce,!![]);}catch(_0x4ecfa6){return BPromise[_0xe627('0x21')](_0x4ecfa6);}return _0x4adde7[_0xe627('0x22')]();};}function saveUpdates(_0x4e3338,_0x708a8a){return function(_0x33cb27){if(_0x33cb27){return _0x33cb27['update'](_0x4e3338)[_0xe627('0x23')](function(_0x29221b){return _0x29221b;});}return null;};}function removeEntity(_0x52d492,_0x42f3d1){return function(_0x19adbc){if(_0x19adbc){return _0x19adbc[_0xe627('0x24')]()['then'](function(){_0x52d492[_0xe627('0x19')](0xcc)[_0xe627('0x1a')]();});}};}function handleEntityNotFound(_0x1a5081,_0x3ddd8d){return function(_0x4b9ff9){if(!_0x4b9ff9){_0x1a5081[_0xe627('0x18')](0x194);}return _0x4b9ff9;};}function handleError(_0x1fe192,_0x1635a0){_0x1635a0=_0x1635a0||0x1f4;return function(_0x29eb8e){logger[_0xe627('0x25')](_0x29eb8e[_0xe627('0x26')]);if(_0x29eb8e[_0xe627('0x27')]){delete _0x29eb8e[_0xe627('0x27')];}_0x1fe192[_0xe627('0x19')](_0x1635a0)['send'](_0x29eb8e);};}exports[_0xe627('0x28')]=function(_0x5aeba1,_0x5cd7c8){var _0x1e0bd7={},_0xdf63c8={},_0x5799a3={'count':0x0,'rows':[]};var _0x39c23f=_['map'](db[_0xe627('0x29')]['rawAttributes'],function(_0x262253){return{'name':_0x262253[_0xe627('0x2a')],'type':_0x262253['type'][_0xe627('0x2b')]};});_0xdf63c8['model']=_[_0xe627('0x2c')](_0x39c23f,_0xe627('0x27'));_0xdf63c8[_0xe627('0x2d')]=_[_0xe627('0x2e')](_0x5aeba1[_0xe627('0x2d')]);_0xdf63c8[_0xe627('0x2f')]=_[_0xe627('0x30')](_0xdf63c8[_0xe627('0x31')],_0xdf63c8[_0xe627('0x2d')]);_0x1e0bd7[_0xe627('0x32')]=_[_0xe627('0x30')](_0xdf63c8['model'],qs['fields'](_0x5aeba1[_0xe627('0x2d')]['fields']));_0x1e0bd7[_0xe627('0x32')]=_0x1e0bd7['attributes']['length']?_0x1e0bd7[_0xe627('0x32')]:_0xdf63c8['model'];if(!_0x5aeba1['query'][_0xe627('0x33')](_0xe627('0x34'))){_0x1e0bd7[_0xe627('0x1e')]=qs['limit'](_0x5aeba1['query']['limit']);_0x1e0bd7[_0xe627('0x1c')]=qs['offset'](_0x5aeba1[_0xe627('0x2d')][_0xe627('0x1c')]);}_0x1e0bd7['order']=qs[_0xe627('0x35')](_0x5aeba1[_0xe627('0x2d')]['sort']);_0x1e0bd7[_0xe627('0x36')]=qs[_0xe627('0x2f')](_[_0xe627('0x37')](_0x5aeba1[_0xe627('0x2d')],_0xdf63c8[_0xe627('0x2f')]),_0x39c23f);if(_0x5aeba1[_0xe627('0x2d')]['filter']){_0x1e0bd7[_0xe627('0x36')]=_['merge'](_0x1e0bd7[_0xe627('0x36')],{'$or':_['map'](_0x39c23f,function(_0xe90eda){if(_0xe90eda[_0xe627('0x38')]!==_0xe627('0x39')){var _0x21a533={};_0x21a533[_0xe90eda[_0xe627('0x27')]]={'$like':'%'+_0x5aeba1[_0xe627('0x2d')][_0xe627('0x3a')]+'%'};return _0x21a533;}})});}_0x1e0bd7=_[_0xe627('0x3b')]({},_0x1e0bd7,_0x5aeba1[_0xe627('0x3c')]);var _0x415a25={'where':_0x1e0bd7[_0xe627('0x36')]};return db[_0xe627('0x29')][_0xe627('0x1f')](_0x415a25)['then'](function(_0x4ddff5){_0x5799a3['count']=_0x4ddff5;if(_0x5aeba1['query']['includeAll']){_0x1e0bd7['include']=[{'all':!![]}];}return db[_0xe627('0x29')]['findAll'](_0x1e0bd7);})[_0xe627('0x23')](function(_0x59cd6a){_0x5799a3[_0xe627('0x3d')]=_0x59cd6a;return _0x5799a3;})[_0xe627('0x23')](respondWithFilteredResult(_0x5cd7c8,_0x1e0bd7))[_0xe627('0x3e')](handleError(_0x5cd7c8,null));};exports['show']=function(_0x58e110,_0x26064c){var _0x5f3374={'raw':!![],'where':{'id':_0x58e110[_0xe627('0x3f')]['id']}},_0x5e352e={};_0x5e352e['model']=_[_0xe627('0x2e')](db['MailQueueReport']['rawAttributes']);_0x5e352e[_0xe627('0x2d')]=_[_0xe627('0x2e')](_0x58e110[_0xe627('0x2d')]);_0x5e352e['filters']=_['intersection'](_0x5e352e[_0xe627('0x31')],_0x5e352e['query']);_0x5f3374['attributes']=_[_0xe627('0x30')](_0x5e352e[_0xe627('0x31')],qs[_0xe627('0x40')](_0x58e110[_0xe627('0x2d')][_0xe627('0x40')]));_0x5f3374[_0xe627('0x32')]=_0x5f3374['attributes'][_0xe627('0x41')]?_0x5f3374[_0xe627('0x32')]:_0x5e352e['model'];if(_0x58e110['query'][_0xe627('0x42')]){_0x5f3374[_0xe627('0x43')]=[{'all':!![]}];}_0x5f3374=_[_0xe627('0x3b')]({},_0x5f3374,_0x58e110[_0xe627('0x3c')]);return db[_0xe627('0x29')][_0xe627('0x44')](_0x5f3374)[_0xe627('0x23')](handleEntityNotFound(_0x26064c,null))['then'](respondWithResult(_0x26064c,null))[_0xe627('0x3e')](handleError(_0x26064c,null));};exports['create']=function(_0x648456,_0xcd19f5){return db[_0xe627('0x29')]['create'](_0x648456[_0xe627('0x45')],{})['then'](respondWithResult(_0xcd19f5,0xc9))[_0xe627('0x3e')](handleError(_0xcd19f5,null));};exports[_0xe627('0x46')]=function(_0x375e05,_0x30e057){if(_0x375e05[_0xe627('0x45')]['id']){delete _0x375e05['body']['id'];}return db[_0xe627('0x29')][_0xe627('0x44')]({'where':{'id':_0x375e05[_0xe627('0x3f')]['id']}})[_0xe627('0x23')](handleEntityNotFound(_0x30e057,null))[_0xe627('0x23')](saveUpdates(_0x375e05[_0xe627('0x45')],null))[_0xe627('0x23')](respondWithResult(_0x30e057,null))[_0xe627('0x3e')](handleError(_0x30e057,null));};exports[_0xe627('0x24')]=function(_0x3824da,_0x550b74){return db[_0xe627('0x29')][_0xe627('0x44')]({'where':{'id':_0x3824da['params']['id']}})[_0xe627('0x23')](handleEntityNotFound(_0x550b74,null))[_0xe627('0x23')](removeEntity(_0x550b74,null))['catch'](handleError(_0x550b74,null));};exports[_0xe627('0x47')]=function(_0x3a827e,_0x542a4c){return db[_0xe627('0x29')][_0xe627('0x47')]()['then'](respondWithResult(_0x542a4c,null))[_0xe627('0x3e')](handleError(_0x542a4c,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 3005800..095b9a5 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 _0xd05f=['path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','uniqueid','lodash','util','api','moment','bluebird','request-promise'];(function(_0x364062,_0x29f4f6){var _0x5930e7=function(_0x297ead){while(--_0x297ead){_0x364062['push'](_0x364062['shift']());}};_0x5930e7(++_0x29f4f6);}(_0xd05f,0x96));var _0xfd05=function(_0x448333,_0x4a1fe6){_0x448333=_0x448333-0x0;var _0x357457=_0xd05f[_0x448333];return _0x357457;};'use strict';var _=require(_0xfd05('0x0'));var util=require(_0xfd05('0x1'));var logger=require('../../config/logger')(_0xfd05('0x2'));var moment=require(_0xfd05('0x3'));var BPromise=require(_0xfd05('0x4'));var rp=require(_0xfd05('0x5'));var fs=require('fs');var path=require(_0xfd05('0x6'));var rimraf=require(_0xfd05('0x7'));var config=require(_0xfd05('0x8'));var attributes=require(_0xfd05('0x9'));module[_0xfd05('0xa')]=function(_0x3de7da,_0x142f45){return _0x3de7da[_0xfd05('0xb')]('MailQueueReport',attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0xfd05('0xc'),'fields':[_0xfd05('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd714=['MailQueueReport','report_mail_queue','uniqueid','lodash','util','api','moment','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define'];(function(_0x2ccd06,_0x2f6aae){var _0xb17be4=function(_0x1117a5){while(--_0x1117a5){_0x2ccd06['push'](_0x2ccd06['shift']());}};_0xb17be4(++_0x2f6aae);}(_0xd714,0x1e4));var _0x4d71=function(_0x283b55,_0x279bee){_0x283b55=_0x283b55-0x0;var _0x192e58=_0xd714[_0x283b55];return _0x192e58;};'use strict';var _=require(_0x4d71('0x0'));var util=require(_0x4d71('0x1'));var logger=require('../../config/logger')(_0x4d71('0x2'));var moment=require(_0x4d71('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4d71('0x4'));var rimraf=require(_0x4d71('0x5'));var config=require(_0x4d71('0x6'));var attributes=require(_0x4d71('0x7'));module[_0x4d71('0x8')]=function(_0x154fa5,_0x3e04a6){return _0x154fa5[_0x4d71('0x9')](_0x4d71('0xa'),attributes,{'tableName':_0x4d71('0xb'),'paranoid':![],'indexes':[{'name':_0x4d71('0xc'),'fields':[_0x4d71('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 8c70d4e..8470eeb 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 _0xadb5=['MailQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateMailQueueReport','create','options','raw','debug','MailQueueReport','body','attributes','limit','UpdateMailQueueReport','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x57ad75,_0xf30c10){var _0xb06828=function(_0x4332d4){while(--_0x4332d4){_0x57ad75['push'](_0x57ad75['shift']());}};_0xb06828(++_0xf30c10);}(_0xadb5,0xad));var _0x5adb=function(_0xf0534f,_0x43e1c9){_0xf0534f=_0xf0534f-0x0;var _0x298d20=_0xadb5[_0xf0534f];return _0x298d20;};'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']('MailQueueReport,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});}exports[_0x5adb('0x15')]=function(_0x529b65){var _0x3fff62=this;return new Promise(function(_0x5de028,_0x1d9e86){return db['MailQueueReport'][_0x5adb('0x16')](_0x529b65['body'],{'raw':_0x529b65['options']?_0x529b65[_0x5adb('0x17')][_0x5adb('0x18')]===undefined?!![]:![]:!![]})[_0x5adb('0xb')](function(_0x1fd4a7){logger[_0x5adb('0xc')]('CreateMailQueueReport',_0x529b65);logger[_0x5adb('0x19')]('CreateMailQueueReport',_0x529b65,JSON['stringify'](_0x1fd4a7));_0x5de028(_0x1fd4a7);})[_0x5adb('0x14')](function(_0x379b33){logger[_0x5adb('0x10')](_0x5adb('0x15'),_0x379b33[_0x5adb('0x12')],_0x529b65);_0x1d9e86(_0x3fff62[_0x5adb('0x10')](0x1f4,_0x379b33[_0x5adb('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x4b1957){var _0x373cc3=this;return new Promise(function(_0x3220cd,_0x3839fb){return db[_0x5adb('0x1a')]['update'](_0x4b1957[_0x5adb('0x1b')],{'raw':_0x4b1957[_0x5adb('0x17')]?_0x4b1957['options'][_0x5adb('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')]['where']||null:null,'attributes':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')][_0x5adb('0x1c')]||null:null,'limit':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')][_0x5adb('0x1d')]||null:null})['then'](function(_0x49992e){logger['info'](_0x5adb('0x1e'),_0x4b1957);logger[_0x5adb('0x19')](_0x5adb('0x1e'),_0x4b1957,JSON[_0x5adb('0xf')](_0x49992e));_0x3220cd(_0x49992e);})[_0x5adb('0x14')](function(_0x4de310){logger[_0x5adb('0x10')](_0x5adb('0x1e'),_0x4de310[_0x5adb('0x12')],_0x4b1957);_0x3839fb(_0x373cc3[_0x5adb('0x10')](0x1f4,_0x4de310[_0x5adb('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(_0x8ad45d,_0x2c14cd){var _0x1c31b0=function(_0x278393){while(--_0x278393){_0x8ad45d['push'](_0x8ad45d['shift']());}};_0x1c31b0(++_0x2c14cd);}(_0x2ef3,0xba));var _0x32ef=function(_0x486cfb,_0x51722f){_0x486cfb=_0x486cfb-0x0;var _0x381669=_0x2ef3[_0x486cfb];return _0x381669;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});}exports[_0x32ef('0x15')]=function(_0x1a9476){var _0x286bfb=this;return new Promise(function(_0x57863c,_0xbe37f6){return db[_0x32ef('0x16')]['create'](_0x1a9476[_0x32ef('0x17')],{'raw':_0x1a9476[_0x32ef('0x18')]?_0x1a9476[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![]})[_0x32ef('0xb')](function(_0x3aec05){logger['info'](_0x32ef('0x15'),_0x1a9476);logger['debug'](_0x32ef('0x15'),_0x1a9476,JSON[_0x32ef('0x10')](_0x3aec05));_0x57863c(_0x3aec05);})['catch'](function(_0x1af371){logger[_0x32ef('0x11')](_0x32ef('0x15'),_0x1af371['message'],_0x1a9476);_0xbe37f6(_0x286bfb['error'](0x1f4,_0x1af371[_0x32ef('0x13')]));});});};exports[_0x32ef('0x1a')]=function(_0x225feb){var _0x478bef=this;return new Promise(function(_0x59585f,_0x19ea6){return db['MailQueueReport']['update'](_0x225feb[_0x32ef('0x17')],{'raw':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1b')]||null:null,'attributes':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1c')]||null:null,'limit':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')]['limit']||null:null})[_0x32ef('0xb')](function(_0x2f5d06){logger['info'](_0x32ef('0x1a'),_0x225feb);logger[_0x32ef('0x1d')](_0x32ef('0x1a'),_0x225feb,JSON[_0x32ef('0x10')](_0x2f5d06));_0x59585f(_0x2f5d06);})['catch'](function(_0x10e38c){logger[_0x32ef('0x11')](_0x32ef('0x1a'),_0x10e38c[_0x32ef('0x13')],_0x225feb);_0x19ea6(_0x478bef[_0x32ef('0x11')](0x1f4,_0x10e38c[_0x32ef('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index deee669..25eb348 100644 --- a/server/api/mailServerIn/index.js +++ b/server/api/mailServerIn/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x69473,_0x1cbe33){var _0x50bff3=function(_0x241d54){while(--_0x241d54){_0x69473['push'](_0x69473['shift']());}};_0x50bff3(++_0x1cbe33);}(_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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x3ed39d,_0x1b8390){var _0x39ac11=function(_0x3ff587){while(--_0x3ff587){_0x3ed39d['push'](_0x3ed39d['shift']());}};_0x39ac11(++_0x1b8390);}(_0x70e0,0x17b));var _0x070e=function(_0x1681b3,_0x7d09f8){_0x1681b3=_0x1681b3-0x0;var _0x3aee83=_0x70e0[_0x1681b3];return _0x3aee83;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index d18b736..299cea0 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 _0xd4af=['INTEGER','sequelize','exports','STRING','BOOLEAN','INBOX'];(function(_0xd62db,_0x5e81b8){var _0x104c01=function(_0x586a53){while(--_0x586a53){_0xd62db['push'](_0xd62db['shift']());}};_0x104c01(++_0x5e81b8);}(_0xd4af,0xe5));var _0xfd4a=function(_0x139a49,_0x5a4f50){_0x139a49=_0x139a49-0x0;var _0x2d9518=_0xd4af[_0x139a49];return _0x2d9518;};'use strict';var Sequelize=require(_0xfd4a('0x0'));module[_0xfd4a('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xfd4a('0x2')]},'authentication':{'type':Sequelize[_0xfd4a('0x3')],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xfd4a('0x2')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0xfd4a('0x4')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xfd4a('0x5')],'defaultValue':0x5},'service':{'type':Sequelize[_0xfd4a('0x2')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x8858=['INBOX','sequelize','exports','STRING','INTEGER','BOOLEAN'];(function(_0x20234e,_0x367077){var _0x5a0349=function(_0x20b066){while(--_0x20b066){_0x20234e['push'](_0x20234e['shift']());}};_0x5a0349(++_0x367077);}(_0x8858,0xdf));var _0x8885=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x8858[_0x110c3d];return _0x226d67;};'use strict';var Sequelize=require(_0x8885('0x0'));module[_0x8885('0x1')]={'description':{'type':Sequelize[_0x8885('0x2')]},'host':{'type':Sequelize[_0x8885('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0x8885('0x2')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x8885('0x3')]},'tls':{'type':Sequelize[_0x8885('0x4')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x8885('0x2')],'defaultValue':_0x8885('0x5')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x8885('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0x8885('0x2')]},'modernAuthentication':{'type':Sequelize[_0x8885('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index be1c3e4..188267b 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 _0x10d1=['./mailServerIn.attributes','define','MailServerIn','mail_servers_in','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5850a5,_0x163e88){var _0x4ccd59=function(_0x4e94f7){while(--_0x4e94f7){_0x5850a5['push'](_0x5850a5['shift']());}};_0x4ccd59(++_0x163e88);}(_0x10d1,0x170));var _0x110d=function(_0xdb0e85,_0x342441){_0xdb0e85=_0xdb0e85-0x0;var _0x249f87=_0x10d1[_0xdb0e85];return _0x249f87;};'use strict';var _=require(_0x110d('0x0'));var util=require(_0x110d('0x1'));var logger=require(_0x110d('0x2'))('api');var moment=require(_0x110d('0x3'));var BPromise=require(_0x110d('0x4'));var rp=require(_0x110d('0x5'));var fs=require('fs');var path=require(_0x110d('0x6'));var rimraf=require(_0x110d('0x7'));var config=require(_0x110d('0x8'));var attributes=require(_0x110d('0x9'));module['exports']=function(_0x47b7c9,_0x15b27c){return _0x47b7c9[_0x110d('0xa')](_0x110d('0xb'),attributes,{'tableName':_0x110d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc9a4=['exports','mail_servers_in','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x26675d,_0x5857ee){var _0x2e82c6=function(_0x1718c1){while(--_0x1718c1){_0x26675d['push'](_0x26675d['shift']());}};_0x2e82c6(++_0x5857ee);}(_0xc9a4,0x162));var _0x4c9a=function(_0x564c61,_0x54a6d3){_0x564c61=_0x564c61-0x0;var _0x21377b=_0xc9a4[_0x564c61];return _0x21377b;};'use strict';var _=require(_0x4c9a('0x0'));var util=require(_0x4c9a('0x1'));var logger=require(_0x4c9a('0x2'))('api');var moment=require(_0x4c9a('0x3'));var BPromise=require(_0x4c9a('0x4'));var rp=require(_0x4c9a('0x5'));var fs=require('fs');var path=require(_0x4c9a('0x6'));var rimraf=require(_0x4c9a('0x7'));var config=require(_0x4c9a('0x8'));var attributes=require('./mailServerIn.attributes');module[_0x4c9a('0x9')]=function(_0x52fba5,_0x2443fe){return _0x52fba5['define']('MailServerIn',attributes,{'tableName':_0x4c9a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index 62e8de3..319d901 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 _0x95ce=['client','request','then','MailServerIn,\x20%s,\x20%s','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','limit','include','map','model','info','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x227267,_0x548e57){var _0x47e978=function(_0x4ddc41){while(--_0x4ddc41){_0x227267['push'](_0x227267['shift']());}};_0x47e978(++_0x548e57);}(_0x95ce,0x1e6));var _0xe95c=function(_0x3ea7a5,_0x59e8e8){_0x3ea7a5=_0x3ea7a5-0x0;var _0x165fe5=_0x95ce[_0x3ea7a5];return _0x165fe5;};'use strict';var _=require('lodash');var util=require(_0xe95c('0x0'));var moment=require(_0xe95c('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe95c('0x2'));var db=require(_0xe95c('0x3'))['db'];var utils=require(_0xe95c('0x4'));var logger=require(_0xe95c('0x5'))(_0xe95c('0x6'));var config=require(_0xe95c('0x7'));var jayson=require(_0xe95c('0x8'));var client=jayson[_0xe95c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2be11f,_0x467d6f,_0x445413){return new BPromise(function(_0x4f923c,_0x54a1e9){return client[_0xe95c('0xa')](_0x2be11f,_0x445413)[_0xe95c('0xb')](function(_0x16e3ff){logger['info'](_0xe95c('0xc'),_0x467d6f,'request\x20sent');logger['debug'](_0xe95c('0xd'),_0x467d6f,_0xe95c('0xe'),JSON[_0xe95c('0xf')](_0x16e3ff));if(_0x16e3ff['error']){if(_0x16e3ff[_0xe95c('0x10')][_0xe95c('0x11')]===0x1f4){logger['error'](_0xe95c('0xc'),_0x467d6f,_0x16e3ff[_0xe95c('0x10')][_0xe95c('0x12')]);return _0x54a1e9(_0x16e3ff[_0xe95c('0x10')][_0xe95c('0x12')]);}logger[_0xe95c('0x10')]('MailServerIn,\x20%s,\x20%s',_0x467d6f,_0x16e3ff[_0xe95c('0x10')][_0xe95c('0x12')]);return _0x4f923c(_0x16e3ff[_0xe95c('0x10')]['message']);}else{logger['info'](_0xe95c('0xc'),_0x467d6f,_0xe95c('0xe'));_0x4f923c(_0x16e3ff[_0xe95c('0x13')][_0xe95c('0x12')]);}})[_0xe95c('0x14')](function(_0x30662c){logger[_0xe95c('0x10')](_0xe95c('0xc'),_0x467d6f,_0x30662c);_0x54a1e9(_0x30662c);});});}exports[_0xe95c('0x15')]=function(_0x17b96d){var _0x2562aa=this;return new Promise(function(_0x2a5fd8,_0x4dc52c){return db[_0xe95c('0x16')][_0xe95c('0x17')]({'raw':_0x17b96d[_0xe95c('0x18')]?_0x17b96d['options'][_0xe95c('0x19')]===undefined?!![]:![]:!![],'where':_0x17b96d['options']?_0x17b96d[_0xe95c('0x18')][_0xe95c('0x1a')]||null:null,'attributes':_0x17b96d[_0xe95c('0x18')]?_0x17b96d[_0xe95c('0x18')][_0xe95c('0x1b')]||null:null,'limit':_0x17b96d[_0xe95c('0x18')]?_0x17b96d[_0xe95c('0x18')][_0xe95c('0x1c')]||null:null,'include':_0x17b96d[_0xe95c('0x18')]?_0x17b96d[_0xe95c('0x18')][_0xe95c('0x1d')]?_[_0xe95c('0x1e')](_0x17b96d['options'][_0xe95c('0x1d')],function(_0x1f9c5a){return{'model':db[_0x1f9c5a[_0xe95c('0x1f')]],'as':_0x1f9c5a['as'],'attributes':_0x1f9c5a[_0xe95c('0x1b')],'include':_0x1f9c5a[_0xe95c('0x1d')]?_[_0xe95c('0x1e')](_0x1f9c5a['include'],function(_0x2dc218){return{'model':db[_0x2dc218[_0xe95c('0x1f')]],'as':_0x2dc218['as'],'attributes':_0x2dc218['attributes'],'include':_0x2dc218[_0xe95c('0x1d')]?_['map'](_0x2dc218[_0xe95c('0x1d')],function(_0x5d4c50){return{'model':db[_0x5d4c50['model']],'as':_0x5d4c50['as'],'attributes':_0x5d4c50[_0xe95c('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xa1e841){logger[_0xe95c('0x20')](_0xe95c('0x15'),_0x17b96d);logger['debug'](_0xe95c('0x15'),_0x17b96d,JSON[_0xe95c('0xf')](_0xa1e841));_0x2a5fd8(_0xa1e841);})[_0xe95c('0x14')](function(_0x298ff7){logger[_0xe95c('0x10')](_0xe95c('0x15'),_0x298ff7[_0xe95c('0x12')],_0x17b96d);_0x4dc52c(_0x2562aa['error'](0x1f4,_0x298ff7[_0xe95c('0x12')]));});});}; \ No newline at end of file +var _0xc29b=['stringify','error','code','message','result','catch','GetMailServerIn','options','where','attributes','include','map','model','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s'];(function(_0x5e0eec,_0x21bd9e){var _0x3788d3=function(_0x35c44d){while(--_0x35c44d){_0x5e0eec['push'](_0x5e0eec['shift']());}};_0x3788d3(++_0x21bd9e);}(_0xc29b,0x12d));var _0xbc29=function(_0x3a2a5c,_0x4017ea){_0x3a2a5c=_0x3a2a5c-0x0;var _0x5b603e=_0xc29b[_0x3a2a5c];return _0x5b603e;};'use strict';var _=require(_0xbc29('0x0'));var util=require(_0xbc29('0x1'));var moment=require(_0xbc29('0x2'));var BPromise=require('bluebird');var rs=require(_0xbc29('0x3'));var fs=require('fs');var Redis=require(_0xbc29('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbc29('0x5'));var logger=require(_0xbc29('0x6'))(_0xbc29('0x7'));var config=require(_0xbc29('0x8'));var jayson=require(_0xbc29('0x9'));var client=jayson[_0xbc29('0xa')][_0xbc29('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x40f0c9,_0x463e2b,_0x37d9dd){return new BPromise(function(_0x2e5fb7,_0x29b188){return client[_0xbc29('0xc')](_0x40f0c9,_0x37d9dd)[_0xbc29('0xd')](function(_0x320cb4){logger[_0xbc29('0xe')](_0xbc29('0xf'),_0x463e2b,_0xbc29('0x10'));logger[_0xbc29('0x11')](_0xbc29('0x12'),_0x463e2b,'request\x20sent',JSON[_0xbc29('0x13')](_0x320cb4));if(_0x320cb4[_0xbc29('0x14')]){if(_0x320cb4[_0xbc29('0x14')][_0xbc29('0x15')]===0x1f4){logger[_0xbc29('0x14')](_0xbc29('0xf'),_0x463e2b,_0x320cb4[_0xbc29('0x14')]['message']);return _0x29b188(_0x320cb4[_0xbc29('0x14')][_0xbc29('0x16')]);}logger[_0xbc29('0x14')]('MailServerIn,\x20%s,\x20%s',_0x463e2b,_0x320cb4['error'][_0xbc29('0x16')]);return _0x2e5fb7(_0x320cb4['error'][_0xbc29('0x16')]);}else{logger[_0xbc29('0xe')](_0xbc29('0xf'),_0x463e2b,'request\x20sent');_0x2e5fb7(_0x320cb4[_0xbc29('0x17')]['message']);}})[_0xbc29('0x18')](function(_0x3b5bae){logger[_0xbc29('0x14')](_0xbc29('0xf'),_0x463e2b,_0x3b5bae);_0x29b188(_0x3b5bae);});});}exports[_0xbc29('0x19')]=function(_0x42b0be){var _0x56b592=this;return new Promise(function(_0x9e84e3,_0xc4a1c1){return db['MailServerIn']['findAll']({'raw':_0x42b0be[_0xbc29('0x1a')]?_0x42b0be['options']['raw']===undefined?!![]:![]:!![],'where':_0x42b0be[_0xbc29('0x1a')]?_0x42b0be[_0xbc29('0x1a')][_0xbc29('0x1b')]||null:null,'attributes':_0x42b0be[_0xbc29('0x1a')]?_0x42b0be[_0xbc29('0x1a')][_0xbc29('0x1c')]||null:null,'limit':_0x42b0be[_0xbc29('0x1a')]?_0x42b0be[_0xbc29('0x1a')]['limit']||null:null,'include':_0x42b0be[_0xbc29('0x1a')]?_0x42b0be[_0xbc29('0x1a')][_0xbc29('0x1d')]?_[_0xbc29('0x1e')](_0x42b0be[_0xbc29('0x1a')]['include'],function(_0x24523f){return{'model':db[_0x24523f[_0xbc29('0x1f')]],'as':_0x24523f['as'],'attributes':_0x24523f[_0xbc29('0x1c')],'include':_0x24523f[_0xbc29('0x1d')]?_['map'](_0x24523f[_0xbc29('0x1d')],function(_0x3ad136){return{'model':db[_0x3ad136['model']],'as':_0x3ad136['as'],'attributes':_0x3ad136[_0xbc29('0x1c')],'include':_0x3ad136[_0xbc29('0x1d')]?_['map'](_0x3ad136['include'],function(_0x2c7b63){return{'model':db[_0x2c7b63['model']],'as':_0x2c7b63['as'],'attributes':_0x2c7b63['attributes']};}):[]};}):[]};}):[]:[]})[_0xbc29('0xd')](function(_0xf9f8cf){logger[_0xbc29('0xe')]('GetMailServerIn',_0x42b0be);logger[_0xbc29('0x11')](_0xbc29('0x19'),_0x42b0be,JSON[_0xbc29('0x13')](_0xf9f8cf));_0x9e84e3(_0xf9f8cf);})[_0xbc29('0x18')](function(_0x1797c9){logger['error']('GetMailServerIn',_0x1797c9[_0xbc29('0x16')],_0x42b0be);_0xc4a1c1(_0x56b592[_0xbc29('0x14')](0x1f4,_0x1797c9['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 8fc80e1..099a70a 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(_0x1cfa0d,_0x4391f2){var _0xe33279=function(_0x3ce7c1){while(--_0x3ce7c1){_0x1cfa0d['push'](_0x1cfa0d['shift']());}};_0xe33279(++_0x4391f2);}(_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('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 _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x7a54,0x106));var _0x47a5=function(_0x1cc031,_0x44a0b3){_0x1cc031=_0x1cc031-0x0;var _0x3ee64b=_0x7a54[_0x1cc031];return _0x3ee64b;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 59a37ca..cc6497f 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 _0x02ce=['STRING','INTEGER','BOOLEAN','sequelize','exports'];(function(_0x40a777,_0x2b559a){var _0x157353=function(_0xb2ca49){while(--_0xb2ca49){_0x40a777['push'](_0x40a777['shift']());}};_0x157353(++_0x2b559a);}(_0x02ce,0x1ac));var _0xe02c=function(_0x46f4bf,_0x27ea7e){_0x46f4bf=_0x46f4bf-0x0;var _0x4e561a=_0x02ce[_0x46f4bf];return _0x4e561a;};'use strict';var Sequelize=require(_0xe02c('0x0'));module[_0xe02c('0x1')]={'description':{'type':Sequelize[_0xe02c('0x2')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0xe02c('0x2')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xe02c('0x3')]},'secure':{'type':Sequelize[_0xe02c('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0xe02c('0x2')]},'authentication':{'type':Sequelize[_0xe02c('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xe02c('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x5c00=['INTEGER','BOOLEAN','sequelize','exports','STRING'];(function(_0x35d1f9,_0xee484c){var _0x2d7877=function(_0x52117d){while(--_0x52117d){_0x35d1f9['push'](_0x35d1f9['shift']());}};_0x2d7877(++_0xee484c);}(_0x5c00,0x17e));var _0x05c0=function(_0x24875d,_0x4fb24d){_0x24875d=_0x24875d-0x0;var _0x181471=_0x5c00[_0x24875d];return _0x181471;};'use strict';var Sequelize=require(_0x05c0('0x0'));module[_0x05c0('0x1')]={'description':{'type':Sequelize[_0x05c0('0x2')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0x05c0('0x2')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x05c0('0x3')]},'secure':{'type':Sequelize[_0x05c0('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0x05c0('0x2')]},'authentication':{'type':Sequelize[_0x05c0('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index ee57caf..63e9a74 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 _0xc6f7=['error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','VIRTUAL','filter','options','MailServerOut','includeAll','include','findAll','catch','show','params','merge','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc6f7,0x72));var _0x7c6f=function(_0x24711e,_0x463218){_0x24711e=_0x24711e-0x0;var _0x1e82a5=_0xc6f7[_0x24711e];return _0x1e82a5;};'use strict';var emlformat=require(_0x7c6f('0x0'));var rimraf=require(_0x7c6f('0x1'));var zipdir=require(_0x7c6f('0x2'));var jsonpatch=require(_0x7c6f('0x3'));var rp=require(_0x7c6f('0x4'));var moment=require(_0x7c6f('0x5'));var BPromise=require(_0x7c6f('0x6'));var Mustache=require(_0x7c6f('0x7'));var util=require('util');var path=require(_0x7c6f('0x8'));var sox=require(_0x7c6f('0x9'));var csv=require(_0x7c6f('0xa'));var ejs=require(_0x7c6f('0xb'));var fs=require('fs');var fs_extra=require(_0x7c6f('0xc'));var _=require(_0x7c6f('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7c6f('0xe'));var deskjs=require(_0x7c6f('0xf'));var toCsv=require(_0x7c6f('0xa'));var querystring=require(_0x7c6f('0x10'));var Papa=require(_0x7c6f('0x11'));var Redis=require(_0x7c6f('0x12'));var authService=require(_0x7c6f('0x13'));var qs=require(_0x7c6f('0x14'));var as=require(_0x7c6f('0x15'));var hardwareService=require(_0x7c6f('0x16'));var logger=require(_0x7c6f('0x17'))(_0x7c6f('0x18'));var utils=require(_0x7c6f('0x19'));var config=require(_0x7c6f('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x7c6f('0x1b'))['db'];function respondWithStatusCode(_0xe8c540,_0x5929cb){_0x5929cb=_0x5929cb||0xcc;return function(_0x5c637e){if(_0x5c637e){return _0xe8c540[_0x7c6f('0x1c')](_0x5929cb);}return _0xe8c540[_0x7c6f('0x1d')](_0x5929cb)[_0x7c6f('0x1e')]();};}function respondWithResult(_0x478d1e,_0x5195ee){_0x5195ee=_0x5195ee||0xc8;return function(_0x117a4b){if(_0x117a4b){return _0x478d1e[_0x7c6f('0x1d')](_0x5195ee)[_0x7c6f('0x1f')](_0x117a4b);}};}function respondWithFilteredResult(_0xccd25d,_0x24a377){return function(_0x24a706){if(_0x24a706){var _0x200f6e=typeof _0x24a377[_0x7c6f('0x20')]===_0x7c6f('0x21')&&typeof _0x24a377[_0x7c6f('0x22')]==='undefined';var _0x540a70=_0x24a706['count'];var _0x23d656=_0x200f6e?0x0:_0x24a377[_0x7c6f('0x20')];var _0x599ebb=_0x200f6e?_0x24a706[_0x7c6f('0x23')]:_0x24a377[_0x7c6f('0x20')]+_0x24a377['limit'];var _0x32ce1c;if(_0x599ebb>=_0x540a70){_0x599ebb=_0x540a70;_0x32ce1c=0xc8;}else{_0x32ce1c=0xce;}_0xccd25d[_0x7c6f('0x1d')](_0x32ce1c);return _0xccd25d['set'](_0x7c6f('0x24'),_0x23d656+'-'+_0x599ebb+'/'+_0x540a70)[_0x7c6f('0x1f')](_0x24a706);}return null;};}function patchUpdates(_0x251841){return function(_0x505a85){try{jsonpatch[_0x7c6f('0x25')](_0x505a85,_0x251841,!![]);}catch(_0x1d7a47){return BPromise[_0x7c6f('0x26')](_0x1d7a47);}return _0x505a85['save']();};}function saveUpdates(_0x28e0b6,_0x45c4b3){return function(_0x3fabe3){if(_0x3fabe3){return _0x3fabe3[_0x7c6f('0x27')](_0x28e0b6)[_0x7c6f('0x28')](function(_0x957060){return _0x957060;});}return null;};}function removeEntity(_0x37e90e,_0x24307b){return function(_0x2ccd01){if(_0x2ccd01){return _0x2ccd01[_0x7c6f('0x29')]()[_0x7c6f('0x28')](function(){_0x37e90e[_0x7c6f('0x1d')](0xcc)[_0x7c6f('0x1e')]();});}};}function handleEntityNotFound(_0x2b14e4,_0x12a44e){return function(_0x43582b){if(!_0x43582b){_0x2b14e4[_0x7c6f('0x1c')](0x194);}return _0x43582b;};}function handleError(_0x4ee14d,_0xb0854a){_0xb0854a=_0xb0854a||0x1f4;return function(_0xa39389){logger[_0x7c6f('0x2a')](_0xa39389[_0x7c6f('0x2b')]);if(_0xa39389[_0x7c6f('0x2c')]){delete _0xa39389['name'];}_0x4ee14d[_0x7c6f('0x1d')](_0xb0854a)['send'](_0xa39389);};}exports[_0x7c6f('0x2d')]=function(_0x493ea7,_0x5a5eb1){var _0x2f19ab={},_0x22e3c9={},_0x16747e={'count':0x0,'rows':[]};var _0x368ee1=_[_0x7c6f('0x2e')](db['MailServerOut'][_0x7c6f('0x2f')],function(_0x1e8740){return{'name':_0x1e8740[_0x7c6f('0x30')],'type':_0x1e8740[_0x7c6f('0x31')][_0x7c6f('0x32')]};});_0x22e3c9[_0x7c6f('0x33')]=_[_0x7c6f('0x2e')](_0x368ee1,'name');_0x22e3c9[_0x7c6f('0x34')]=_[_0x7c6f('0x35')](_0x493ea7['query']);_0x22e3c9[_0x7c6f('0x36')]=_[_0x7c6f('0x37')](_0x22e3c9[_0x7c6f('0x33')],_0x22e3c9['query']);_0x2f19ab['attributes']=_[_0x7c6f('0x37')](_0x22e3c9[_0x7c6f('0x33')],qs[_0x7c6f('0x38')](_0x493ea7['query']['fields']));_0x2f19ab[_0x7c6f('0x39')]=_0x2f19ab[_0x7c6f('0x39')][_0x7c6f('0x3a')]?_0x2f19ab['attributes']:_0x22e3c9[_0x7c6f('0x33')];if(!_0x493ea7[_0x7c6f('0x34')]['hasOwnProperty'](_0x7c6f('0x3b'))){_0x2f19ab[_0x7c6f('0x22')]=qs[_0x7c6f('0x22')](_0x493ea7[_0x7c6f('0x34')][_0x7c6f('0x22')]);_0x2f19ab[_0x7c6f('0x20')]=qs['offset'](_0x493ea7['query'][_0x7c6f('0x20')]);}_0x2f19ab[_0x7c6f('0x3c')]=qs[_0x7c6f('0x3d')](_0x493ea7[_0x7c6f('0x34')]['sort']);_0x2f19ab[_0x7c6f('0x3e')]=qs[_0x7c6f('0x36')](_[_0x7c6f('0x3f')](_0x493ea7[_0x7c6f('0x34')],_0x22e3c9[_0x7c6f('0x36')]),_0x368ee1);if(_0x493ea7[_0x7c6f('0x34')]['filter']){_0x2f19ab[_0x7c6f('0x3e')]=_['merge'](_0x2f19ab[_0x7c6f('0x3e')],{'$or':_[_0x7c6f('0x2e')](_0x368ee1,function(_0x54f073){if(_0x54f073[_0x7c6f('0x31')]!==_0x7c6f('0x40')){var _0x1e3b60={};_0x1e3b60[_0x54f073[_0x7c6f('0x2c')]]={'$like':'%'+_0x493ea7[_0x7c6f('0x34')][_0x7c6f('0x41')]+'%'};return _0x1e3b60;}})});}_0x2f19ab=_['merge']({},_0x2f19ab,_0x493ea7[_0x7c6f('0x42')]);var _0x40c5f3={'where':_0x2f19ab[_0x7c6f('0x3e')]};return db[_0x7c6f('0x43')][_0x7c6f('0x23')](_0x40c5f3)['then'](function(_0x2611d4){_0x16747e[_0x7c6f('0x23')]=_0x2611d4;if(_0x493ea7[_0x7c6f('0x34')][_0x7c6f('0x44')]){_0x2f19ab[_0x7c6f('0x45')]=[{'all':!![]}];}return db[_0x7c6f('0x43')][_0x7c6f('0x46')](_0x2f19ab);})['then'](function(_0x290cf1){_0x16747e['rows']=_0x290cf1;return _0x16747e;})[_0x7c6f('0x28')](respondWithFilteredResult(_0x5a5eb1,_0x2f19ab))[_0x7c6f('0x47')](handleError(_0x5a5eb1,null));};exports[_0x7c6f('0x48')]=function(_0x28fd03,_0x5b10b1){var _0x23ed0d={'raw':!![],'where':{'id':_0x28fd03[_0x7c6f('0x49')]['id']}},_0x5bca61={};_0x5bca61[_0x7c6f('0x33')]=_[_0x7c6f('0x35')](db[_0x7c6f('0x43')][_0x7c6f('0x2f')]);_0x5bca61[_0x7c6f('0x34')]=_['keys'](_0x28fd03[_0x7c6f('0x34')]);_0x5bca61[_0x7c6f('0x36')]=_['intersection'](_0x5bca61[_0x7c6f('0x33')],_0x5bca61[_0x7c6f('0x34')]);_0x23ed0d[_0x7c6f('0x39')]=_['intersection'](_0x5bca61[_0x7c6f('0x33')],qs['fields'](_0x28fd03[_0x7c6f('0x34')][_0x7c6f('0x38')]));_0x23ed0d[_0x7c6f('0x39')]=_0x23ed0d[_0x7c6f('0x39')][_0x7c6f('0x3a')]?_0x23ed0d['attributes']:_0x5bca61[_0x7c6f('0x33')];if(_0x28fd03[_0x7c6f('0x34')]['includeAll']){_0x23ed0d[_0x7c6f('0x45')]=[{'all':!![]}];}_0x23ed0d=_[_0x7c6f('0x4a')]({},_0x23ed0d,_0x28fd03[_0x7c6f('0x42')]);return db[_0x7c6f('0x43')][_0x7c6f('0x4b')](_0x23ed0d)[_0x7c6f('0x28')](handleEntityNotFound(_0x5b10b1,null))['then'](respondWithResult(_0x5b10b1,null))[_0x7c6f('0x47')](handleError(_0x5b10b1,null));};exports[_0x7c6f('0x4c')]=function(_0x196ff8,_0x582e30){return db[_0x7c6f('0x43')][_0x7c6f('0x4c')](_0x196ff8['body'],{})[_0x7c6f('0x28')](respondWithResult(_0x582e30,0xc9))[_0x7c6f('0x47')](handleError(_0x582e30,null));};exports[_0x7c6f('0x27')]=function(_0xe05bf2,_0x3dfeca){if(_0xe05bf2[_0x7c6f('0x4d')]['id']){delete _0xe05bf2[_0x7c6f('0x4d')]['id'];}return db[_0x7c6f('0x43')][_0x7c6f('0x4b')]({'where':{'id':_0xe05bf2[_0x7c6f('0x49')]['id']}})[_0x7c6f('0x28')](handleEntityNotFound(_0x3dfeca,null))['then'](saveUpdates(_0xe05bf2['body'],null))[_0x7c6f('0x28')](respondWithResult(_0x3dfeca,null))[_0x7c6f('0x47')](handleError(_0x3dfeca,null));};exports['destroy']=function(_0x1c5e2b,_0x554329){return db['MailServerOut'][_0x7c6f('0x4b')]({'where':{'id':_0x1c5e2b[_0x7c6f('0x49')]['id']}})[_0x7c6f('0x28')](handleEntityNotFound(_0x554329,null))[_0x7c6f('0x28')](removeEntity(_0x554329,null))[_0x7c6f('0x47')](handleError(_0x554329,null));}; \ No newline at end of file +var _0x385e=['sendStatus','error','stack','name','index','map','MailServerOut','rawAttributes','fieldName','type','model','query','keys','fields','attributes','hasOwnProperty','nolimit','order','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','include','find','catch','create','body','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','end'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x385e,0x18b));var _0xe385=function(_0x1762b4,_0x33d836){_0x1762b4=_0x1762b4-0x0;var _0x29beda=_0x385e[_0x1762b4];return _0x29beda;};'use strict';var emlformat=require(_0xe385('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe385('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe385('0x2'));var moment=require('moment');var BPromise=require(_0xe385('0x3'));var Mustache=require(_0xe385('0x4'));var util=require(_0xe385('0x5'));var path=require(_0xe385('0x6'));var sox=require(_0xe385('0x7'));var csv=require('to-csv');var ejs=require(_0xe385('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe385('0x9'));var squel=require(_0xe385('0xa'));var crypto=require(_0xe385('0xb'));var jsforce=require(_0xe385('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xe385('0xd'));var querystring=require(_0xe385('0xe'));var Papa=require(_0xe385('0xf'));var Redis=require(_0xe385('0x10'));var authService=require(_0xe385('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe385('0x12'));var hardwareService=require(_0xe385('0x13'));var logger=require(_0xe385('0x14'))(_0xe385('0x15'));var utils=require('../../config/utils');var config=require(_0xe385('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x591883,_0x406b5c){_0x406b5c=_0x406b5c||0xcc;return function(_0x3c60d0){if(_0x3c60d0){return _0x591883['sendStatus'](_0x406b5c);}return _0x591883[_0xe385('0x17')](_0x406b5c)['end']();};}function respondWithResult(_0x359de8,_0x29c825){_0x29c825=_0x29c825||0xc8;return function(_0x2e56b8){if(_0x2e56b8){return _0x359de8['status'](_0x29c825)[_0xe385('0x18')](_0x2e56b8);}};}function respondWithFilteredResult(_0x139a13,_0x49d443){return function(_0x269b70){if(_0x269b70){var _0x428572=typeof _0x49d443[_0xe385('0x19')]===_0xe385('0x1a')&&typeof _0x49d443[_0xe385('0x1b')]===_0xe385('0x1a');var _0x2eb8d9=_0x269b70[_0xe385('0x1c')];var _0x3a0f49=_0x428572?0x0:_0x49d443['offset'];var _0x4aa3c3=_0x428572?_0x269b70[_0xe385('0x1c')]:_0x49d443[_0xe385('0x19')]+_0x49d443[_0xe385('0x1b')];var _0x224b78;if(_0x4aa3c3>=_0x2eb8d9){_0x4aa3c3=_0x2eb8d9;_0x224b78=0xc8;}else{_0x224b78=0xce;}_0x139a13['status'](_0x224b78);return _0x139a13[_0xe385('0x1d')](_0xe385('0x1e'),_0x3a0f49+'-'+_0x4aa3c3+'/'+_0x2eb8d9)[_0xe385('0x18')](_0x269b70);}return null;};}function patchUpdates(_0x19498b){return function(_0x38588e){try{jsonpatch[_0xe385('0x1f')](_0x38588e,_0x19498b,!![]);}catch(_0x537d0d){return BPromise[_0xe385('0x20')](_0x537d0d);}return _0x38588e['save']();};}function saveUpdates(_0x50ab8f,_0x5dadb0){return function(_0x59f99a){if(_0x59f99a){return _0x59f99a[_0xe385('0x21')](_0x50ab8f)[_0xe385('0x22')](function(_0x52fba4){return _0x52fba4;});}return null;};}function removeEntity(_0x5782b0,_0x5c6cc0){return function(_0x4a1dea){if(_0x4a1dea){return _0x4a1dea[_0xe385('0x23')]()[_0xe385('0x22')](function(){_0x5782b0[_0xe385('0x17')](0xcc)[_0xe385('0x24')]();});}};}function handleEntityNotFound(_0x317c92,_0x5b481d){return function(_0x3132c2){if(!_0x3132c2){_0x317c92[_0xe385('0x25')](0x194);}return _0x3132c2;};}function handleError(_0x227a3f,_0x5621de){_0x5621de=_0x5621de||0x1f4;return function(_0x52d97f){logger[_0xe385('0x26')](_0x52d97f[_0xe385('0x27')]);if(_0x52d97f['name']){delete _0x52d97f[_0xe385('0x28')];}_0x227a3f[_0xe385('0x17')](_0x5621de)['send'](_0x52d97f);};}exports[_0xe385('0x29')]=function(_0x35b076,_0x56facd){var _0x41d902={},_0x1f78ea={},_0x210445={'count':0x0,'rows':[]};var _0x97edd6=_[_0xe385('0x2a')](db[_0xe385('0x2b')][_0xe385('0x2c')],function(_0x4e7504){return{'name':_0x4e7504[_0xe385('0x2d')],'type':_0x4e7504[_0xe385('0x2e')]['key']};});_0x1f78ea[_0xe385('0x2f')]=_[_0xe385('0x2a')](_0x97edd6,_0xe385('0x28'));_0x1f78ea[_0xe385('0x30')]=_[_0xe385('0x31')](_0x35b076[_0xe385('0x30')]);_0x1f78ea['filters']=_['intersection'](_0x1f78ea['model'],_0x1f78ea[_0xe385('0x30')]);_0x41d902['attributes']=_['intersection'](_0x1f78ea[_0xe385('0x2f')],qs[_0xe385('0x32')](_0x35b076['query']['fields']));_0x41d902['attributes']=_0x41d902[_0xe385('0x33')]['length']?_0x41d902[_0xe385('0x33')]:_0x1f78ea[_0xe385('0x2f')];if(!_0x35b076[_0xe385('0x30')][_0xe385('0x34')](_0xe385('0x35'))){_0x41d902[_0xe385('0x1b')]=qs['limit'](_0x35b076[_0xe385('0x30')][_0xe385('0x1b')]);_0x41d902[_0xe385('0x19')]=qs['offset'](_0x35b076[_0xe385('0x30')]['offset']);}_0x41d902[_0xe385('0x36')]=qs['sort'](_0x35b076[_0xe385('0x30')]['sort']);_0x41d902[_0xe385('0x37')]=qs[_0xe385('0x38')](_[_0xe385('0x39')](_0x35b076[_0xe385('0x30')],_0x1f78ea[_0xe385('0x38')]),_0x97edd6);if(_0x35b076[_0xe385('0x30')][_0xe385('0x3a')]){_0x41d902['where']=_[_0xe385('0x3b')](_0x41d902[_0xe385('0x37')],{'$or':_[_0xe385('0x2a')](_0x97edd6,function(_0x13480f){if(_0x13480f[_0xe385('0x2e')]!==_0xe385('0x3c')){var _0x48cbfb={};_0x48cbfb[_0x13480f[_0xe385('0x28')]]={'$like':'%'+_0x35b076[_0xe385('0x30')]['filter']+'%'};return _0x48cbfb;}})});}_0x41d902=_[_0xe385('0x3b')]({},_0x41d902,_0x35b076[_0xe385('0x3d')]);var _0x233232={'where':_0x41d902[_0xe385('0x37')]};return db[_0xe385('0x2b')][_0xe385('0x1c')](_0x233232)['then'](function(_0x2e0c3f){_0x210445[_0xe385('0x1c')]=_0x2e0c3f;if(_0x35b076[_0xe385('0x30')][_0xe385('0x3e')]){_0x41d902['include']=[{'all':!![]}];}return db[_0xe385('0x2b')][_0xe385('0x3f')](_0x41d902);})[_0xe385('0x22')](function(_0x4f46c8){_0x210445[_0xe385('0x40')]=_0x4f46c8;return _0x210445;})['then'](respondWithFilteredResult(_0x56facd,_0x41d902))['catch'](handleError(_0x56facd,null));};exports[_0xe385('0x41')]=function(_0x1167a0,_0x6f2b7e){var _0x50e895={'raw':!![],'where':{'id':_0x1167a0[_0xe385('0x42')]['id']}},_0x556674={};_0x556674[_0xe385('0x2f')]=_[_0xe385('0x31')](db['MailServerOut'][_0xe385('0x2c')]);_0x556674['query']=_[_0xe385('0x31')](_0x1167a0[_0xe385('0x30')]);_0x556674[_0xe385('0x38')]=_['intersection'](_0x556674[_0xe385('0x2f')],_0x556674[_0xe385('0x30')]);_0x50e895['attributes']=_['intersection'](_0x556674[_0xe385('0x2f')],qs[_0xe385('0x32')](_0x1167a0[_0xe385('0x30')][_0xe385('0x32')]));_0x50e895[_0xe385('0x33')]=_0x50e895[_0xe385('0x33')]['length']?_0x50e895[_0xe385('0x33')]:_0x556674[_0xe385('0x2f')];if(_0x1167a0[_0xe385('0x30')][_0xe385('0x3e')]){_0x50e895[_0xe385('0x43')]=[{'all':!![]}];}_0x50e895=_[_0xe385('0x3b')]({},_0x50e895,_0x1167a0['options']);return db[_0xe385('0x2b')][_0xe385('0x44')](_0x50e895)['then'](handleEntityNotFound(_0x6f2b7e,null))[_0xe385('0x22')](respondWithResult(_0x6f2b7e,null))[_0xe385('0x45')](handleError(_0x6f2b7e,null));};exports[_0xe385('0x46')]=function(_0x55e074,_0x2529b5){return db['MailServerOut'][_0xe385('0x46')](_0x55e074[_0xe385('0x47')],{})[_0xe385('0x22')](respondWithResult(_0x2529b5,0xc9))[_0xe385('0x45')](handleError(_0x2529b5,null));};exports[_0xe385('0x21')]=function(_0x4428f1,_0x2eca32){if(_0x4428f1['body']['id']){delete _0x4428f1[_0xe385('0x47')]['id'];}return db[_0xe385('0x2b')][_0xe385('0x44')]({'where':{'id':_0x4428f1[_0xe385('0x42')]['id']}})['then'](handleEntityNotFound(_0x2eca32,null))['then'](saveUpdates(_0x4428f1['body'],null))['then'](respondWithResult(_0x2eca32,null))[_0xe385('0x45')](handleError(_0x2eca32,null));};exports['destroy']=function(_0x32127a,_0x3a89b0){return db['MailServerOut'][_0xe385('0x44')]({'where':{'id':_0x32127a[_0xe385('0x42')]['id']}})[_0xe385('0x22')](handleEntityNotFound(_0x3a89b0,null))[_0xe385('0x22')](removeEntity(_0x3a89b0,null))[_0xe385('0x45')](handleError(_0x3a89b0,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index beb4453..0251507 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 _0xd752=['./mailServerOut.attributes','exports','define','MailServerOut','mail_servers_out','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xd752,0x191));var _0x2d75=function(_0x52c538,_0x48f45a){_0x52c538=_0x52c538-0x0;var _0x33cb72=_0xd752[_0x52c538];return _0x33cb72;};'use strict';var _=require(_0x2d75('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2d75('0x1'));var moment=require('moment');var BPromise=require(_0x2d75('0x2'));var rp=require(_0x2d75('0x3'));var fs=require('fs');var path=require(_0x2d75('0x4'));var rimraf=require(_0x2d75('0x5'));var config=require(_0x2d75('0x6'));var attributes=require(_0x2d75('0x7'));module[_0x2d75('0x8')]=function(_0x46ae10,_0x326ce2){return _0x46ae10[_0x2d75('0x9')](_0x2d75('0xa'),attributes,{'tableName':_0x2d75('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x74f8=['bluebird','request-promise','path','rimraf','./mailServerOut.attributes','define','mail_servers_out','util','api'];(function(_0x1103c4,_0x562d1d){var _0x1c19ab=function(_0x10e254){while(--_0x10e254){_0x1103c4['push'](_0x1103c4['shift']());}};_0x1c19ab(++_0x562d1d);}(_0x74f8,0x193));var _0x874f=function(_0x37b7a0,_0x2ee4f5){_0x37b7a0=_0x37b7a0-0x0;var _0x4fb461=_0x74f8[_0x37b7a0];return _0x4fb461;};'use strict';var _=require('lodash');var util=require(_0x874f('0x0'));var logger=require('../../config/logger')(_0x874f('0x1'));var moment=require('moment');var BPromise=require(_0x874f('0x2'));var rp=require(_0x874f('0x3'));var fs=require('fs');var path=require(_0x874f('0x4'));var rimraf=require(_0x874f('0x5'));var config=require('../../config/environment');var attributes=require(_0x874f('0x6'));module['exports']=function(_0x3eb03b,_0x36cbea){return _0x3eb03b[_0x874f('0x7')]('MailServerOut',attributes,{'tableName':_0x874f('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index e1a8a16..c4c30eb 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 _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x278809,_0x2acb3b){var _0x1b1e75=function(_0x374430){while(--_0x374430){_0x278809['push'](_0x278809['shift']());}};_0x1b1e75(++_0x2acb3b);}(_0xc4aa,0x1b7));var _0xac4a=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0xc4aa[_0xaa1b3e];return _0x454d7d;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file +var _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x1b3bee,_0xae2f60){var _0x1efd9f=function(_0x1e2ddf){while(--_0x1e2ddf){_0x1b3bee['push'](_0x1b3bee['shift']());}};_0x1efd9f(++_0xae2f60);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x5f66[_0x4243a3];return _0x1b2a33;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('MailServerOut,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 41a1107..ed3f4b5 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 _0xd4ca=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','index','isAuthenticated','/:id','show','post','create','update','delete','destroy','exports'];(function(_0x50337b,_0x35a8ee){var _0x53d607=function(_0x1c0451){while(--_0x1c0451){_0x50337b['push'](_0x50337b['shift']());}};_0x53d607(++_0x35a8ee);}(_0xd4ca,0x78));var _0xad4c=function(_0x519e56,_0xe2cc6b){_0x519e56=_0x519e56-0x0;var _0xd205ad=_0xd4ca[_0x519e56];return _0xd205ad;};'use strict';var multer=require('multer');var util=require(_0xad4c('0x0'));var path=require(_0xad4c('0x1'));var timeout=require(_0xad4c('0x2'));var express=require(_0xad4c('0x3'));var router=express[_0xad4c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xad4c('0x5'));var interaction=require(_0xad4c('0x6'));var config=require(_0xad4c('0x7'));var controller=require(_0xad4c('0x8'));router[_0xad4c('0x9')]('/',auth['isAuthenticated'](),controller[_0xad4c('0xa')]);router[_0xad4c('0x9')]('/describe',auth[_0xad4c('0xb')](),controller['describe']);router['get'](_0xad4c('0xc'),auth[_0xad4c('0xb')](),controller[_0xad4c('0xd')]);router[_0xad4c('0xe')]('/',auth['isAuthenticated'](),controller[_0xad4c('0xf')]);router['put'](_0xad4c('0xc'),auth['isAuthenticated'](),controller[_0xad4c('0x10')]);router[_0xad4c('0x11')]('/:id',auth[_0xad4c('0xb')](),controller[_0xad4c('0x12')]);module[_0xad4c('0x13')]=router; \ No newline at end of file +var _0xdc0a=['show','post','create','delete','destroy','exports','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','isAuthenticated','index','get','describe','/:id'];(function(_0x17302a,_0x1af632){var _0x70f938=function(_0x25a995){while(--_0x25a995){_0x17302a['push'](_0x17302a['shift']());}};_0x70f938(++_0x1af632);}(_0xdc0a,0x96));var _0xadc0=function(_0x335806,_0x5e7dbf){_0x335806=_0x335806-0x0;var _0x2de72b=_0xdc0a[_0x335806];return _0x2de72b;};'use strict';var multer=require('multer');var util=require(_0xadc0('0x0'));var path=require('path');var timeout=require(_0xadc0('0x1'));var express=require(_0xadc0('0x2'));var router=express['Router']();var fs_extra=require(_0xadc0('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xadc0('0x4'));var config=require(_0xadc0('0x5'));var controller=require(_0xadc0('0x6'));router['get']('/',auth[_0xadc0('0x7')](),controller[_0xadc0('0x8')]);router[_0xadc0('0x9')]('/describe',auth[_0xadc0('0x7')](),controller[_0xadc0('0xa')]);router['get'](_0xadc0('0xb'),auth[_0xadc0('0x7')](),controller[_0xadc0('0xc')]);router[_0xadc0('0xd')]('/',auth[_0xadc0('0x7')](),controller[_0xadc0('0xe')]);router['put'](_0xadc0('0xb'),auth[_0xadc0('0x7')](),controller['update']);router[_0xadc0('0xf')]('/:id',auth[_0xadc0('0x7')](),controller[_0xadc0('0x10')]);module[_0xadc0('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index be14daa..dc72500 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 _0x1db9=['STRING','name','sequelize','exports'];(function(_0x26dc7f,_0x3d6977){var _0x44c839=function(_0x453b8e){while(--_0x453b8e){_0x26dc7f['push'](_0x26dc7f['shift']());}};_0x44c839(++_0x3d6977);}(_0x1db9,0x176));var _0x91db=function(_0x4068e3,_0x288776){_0x4068e3=_0x4068e3-0x0;var _0x208071=_0x1db9[_0x4068e3];return _0x208071;};'use strict';var Sequelize=require(_0x91db('0x0'));module[_0x91db('0x1')]={'name':{'type':Sequelize[_0x91db('0x2')],'unique':_0x91db('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x91db('0x2')]}}; \ No newline at end of file +var _0x2eb2=['name','exports','STRING'];(function(_0x29e3ec,_0x138a18){var _0x25727e=function(_0x2bea0d){while(--_0x2bea0d){_0x29e3ec['push'](_0x29e3ec['shift']());}};_0x25727e(++_0x138a18);}(_0x2eb2,0x19f));var _0x22eb=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0x2eb2[_0x25bea7];return _0x175952;};'use strict';var Sequelize=require('sequelize');module[_0x22eb('0x0')]={'name':{'type':Sequelize[_0x22eb('0x1')],'unique':_0x22eb('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x22eb('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 356d8a7..be823c3 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 _0xccd3=['bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','apply','save','update','then','destroy','stack','name','index','map','MailSubstatus','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','describe','rimraf','fast-json-patch','request-promise'];(function(_0x544baa,_0x1b17fe){var _0x5e8cc1=function(_0x1b55dc){while(--_0x1b55dc){_0x544baa['push'](_0x544baa['shift']());}};_0x5e8cc1(++_0x1b17fe);}(_0xccd3,0xd5));var _0x3ccd=function(_0x1d0fe1,_0x452dbb){_0x1d0fe1=_0x1d0fe1-0x0;var _0x228558=_0xccd3[_0x1d0fe1];return _0x228558;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3ccd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3ccd('0x1'));var rp=require(_0x3ccd('0x2'));var moment=require('moment');var BPromise=require(_0x3ccd('0x3'));var Mustache=require(_0x3ccd('0x4'));var util=require('util');var path=require('path');var sox=require(_0x3ccd('0x5'));var csv=require(_0x3ccd('0x6'));var ejs=require(_0x3ccd('0x7'));var fs=require('fs');var fs_extra=require(_0x3ccd('0x8'));var _=require(_0x3ccd('0x9'));var squel=require(_0x3ccd('0xa'));var crypto=require(_0x3ccd('0xb'));var jsforce=require(_0x3ccd('0xc'));var deskjs=require(_0x3ccd('0xd'));var toCsv=require(_0x3ccd('0x6'));var querystring=require('querystring');var Papa=require(_0x3ccd('0xe'));var Redis=require(_0x3ccd('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x3ccd('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3ccd('0x11'));var logger=require(_0x3ccd('0x12'))(_0x3ccd('0x13'));var utils=require(_0x3ccd('0x14'));var config=require(_0x3ccd('0x15'));var licenseUtil=require(_0x3ccd('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a49af,_0x30cb30){_0x30cb30=_0x30cb30||0xcc;return function(_0x2212b8){if(_0x2212b8){return _0x1a49af[_0x3ccd('0x17')](_0x30cb30);}return _0x1a49af[_0x3ccd('0x18')](_0x30cb30)[_0x3ccd('0x19')]();};}function respondWithResult(_0x37410d,_0x5bf30d){_0x5bf30d=_0x5bf30d||0xc8;return function(_0x225ab0){if(_0x225ab0){return _0x37410d['status'](_0x5bf30d)[_0x3ccd('0x1a')](_0x225ab0);}};}function respondWithFilteredResult(_0x4ed9b9,_0x457b30){return function(_0x2e4dba){if(_0x2e4dba){var _0x1f83df=typeof _0x457b30[_0x3ccd('0x1b')]===_0x3ccd('0x1c')&&typeof _0x457b30['limit']===_0x3ccd('0x1c');var _0x555d75=_0x2e4dba[_0x3ccd('0x1d')];var _0x1272f4=_0x1f83df?0x0:_0x457b30[_0x3ccd('0x1b')];var _0x1ae206=_0x1f83df?_0x2e4dba[_0x3ccd('0x1d')]:_0x457b30[_0x3ccd('0x1b')]+_0x457b30['limit'];var _0x1a37d5;if(_0x1ae206>=_0x555d75){_0x1ae206=_0x555d75;_0x1a37d5=0xc8;}else{_0x1a37d5=0xce;}_0x4ed9b9[_0x3ccd('0x18')](_0x1a37d5);return _0x4ed9b9['set']('Content-Range',_0x1272f4+'-'+_0x1ae206+'/'+_0x555d75)[_0x3ccd('0x1a')](_0x2e4dba);}return null;};}function patchUpdates(_0xf84932){return function(_0x111ac0){try{jsonpatch[_0x3ccd('0x1e')](_0x111ac0,_0xf84932,!![]);}catch(_0x34dbba){return BPromise['reject'](_0x34dbba);}return _0x111ac0[_0x3ccd('0x1f')]();};}function saveUpdates(_0x78d739,_0xf7cdf4){return function(_0x50f579){if(_0x50f579){return _0x50f579[_0x3ccd('0x20')](_0x78d739)[_0x3ccd('0x21')](function(_0xa0488e){return _0xa0488e;});}return null;};}function removeEntity(_0x46ed7c,_0x240748){return function(_0x5ea626){if(_0x5ea626){return _0x5ea626[_0x3ccd('0x22')]()['then'](function(){_0x46ed7c[_0x3ccd('0x18')](0xcc)[_0x3ccd('0x19')]();});}};}function handleEntityNotFound(_0x4c3bfd,_0x3e7763){return function(_0x3b1fd9){if(!_0x3b1fd9){_0x4c3bfd[_0x3ccd('0x17')](0x194);}return _0x3b1fd9;};}function handleError(_0x3558b8,_0x294b5e){_0x294b5e=_0x294b5e||0x1f4;return function(_0x23ef12){logger['error'](_0x23ef12[_0x3ccd('0x23')]);if(_0x23ef12[_0x3ccd('0x24')]){delete _0x23ef12['name'];}_0x3558b8[_0x3ccd('0x18')](_0x294b5e)['send'](_0x23ef12);};}exports[_0x3ccd('0x25')]=function(_0x55fd0f,_0x2a9e24){var _0x388747={},_0x5d23f9={},_0x313df9={'count':0x0,'rows':[]};var _0x8eff11=_[_0x3ccd('0x26')](db[_0x3ccd('0x27')][_0x3ccd('0x28')],function(_0x2614ba){return{'name':_0x2614ba[_0x3ccd('0x29')],'type':_0x2614ba['type'][_0x3ccd('0x2a')]};});_0x5d23f9[_0x3ccd('0x2b')]=_[_0x3ccd('0x26')](_0x8eff11,_0x3ccd('0x24'));_0x5d23f9['query']=_[_0x3ccd('0x2c')](_0x55fd0f[_0x3ccd('0x2d')]);_0x5d23f9[_0x3ccd('0x2e')]=_['intersection'](_0x5d23f9[_0x3ccd('0x2b')],_0x5d23f9['query']);_0x388747['attributes']=_[_0x3ccd('0x2f')](_0x5d23f9[_0x3ccd('0x2b')],qs[_0x3ccd('0x30')](_0x55fd0f[_0x3ccd('0x2d')][_0x3ccd('0x30')]));_0x388747[_0x3ccd('0x31')]=_0x388747['attributes'][_0x3ccd('0x32')]?_0x388747['attributes']:_0x5d23f9[_0x3ccd('0x2b')];if(!_0x55fd0f[_0x3ccd('0x2d')][_0x3ccd('0x33')](_0x3ccd('0x34'))){_0x388747[_0x3ccd('0x35')]=qs['limit'](_0x55fd0f[_0x3ccd('0x2d')]['limit']);_0x388747[_0x3ccd('0x1b')]=qs['offset'](_0x55fd0f['query'][_0x3ccd('0x1b')]);}_0x388747[_0x3ccd('0x36')]=qs['sort'](_0x55fd0f[_0x3ccd('0x2d')]['sort']);_0x388747[_0x3ccd('0x37')]=qs[_0x3ccd('0x2e')](_[_0x3ccd('0x38')](_0x55fd0f[_0x3ccd('0x2d')],_0x5d23f9[_0x3ccd('0x2e')]),_0x8eff11);if(_0x55fd0f[_0x3ccd('0x2d')][_0x3ccd('0x39')]){_0x388747['where']=_[_0x3ccd('0x3a')](_0x388747['where'],{'$or':_[_0x3ccd('0x26')](_0x8eff11,function(_0x34e065){if(_0x34e065[_0x3ccd('0x3b')]!==_0x3ccd('0x3c')){var _0x11a963={};_0x11a963[_0x34e065['name']]={'$like':'%'+_0x55fd0f['query'][_0x3ccd('0x39')]+'%'};return _0x11a963;}})});}_0x388747=_[_0x3ccd('0x3a')]({},_0x388747,_0x55fd0f[_0x3ccd('0x3d')]);var _0x4d7e74={'where':_0x388747[_0x3ccd('0x37')]};return db[_0x3ccd('0x27')][_0x3ccd('0x1d')](_0x4d7e74)[_0x3ccd('0x21')](function(_0x285004){_0x313df9[_0x3ccd('0x1d')]=_0x285004;if(_0x55fd0f[_0x3ccd('0x2d')][_0x3ccd('0x3e')]){_0x388747[_0x3ccd('0x3f')]=[{'all':!![]}];}return db['MailSubstatus']['findAll'](_0x388747);})[_0x3ccd('0x21')](function(_0x2dc9eb){_0x313df9[_0x3ccd('0x40')]=_0x2dc9eb;return _0x313df9;})['then'](respondWithFilteredResult(_0x2a9e24,_0x388747))[_0x3ccd('0x41')](handleError(_0x2a9e24,null));};exports[_0x3ccd('0x42')]=function(_0xa8c34e,_0x54be87){var _0x3344ce={'raw':!![],'where':{'id':_0xa8c34e[_0x3ccd('0x43')]['id']}},_0x3d68ae={};_0x3d68ae[_0x3ccd('0x2b')]=_[_0x3ccd('0x2c')](db[_0x3ccd('0x27')][_0x3ccd('0x28')]);_0x3d68ae[_0x3ccd('0x2d')]=_[_0x3ccd('0x2c')](_0xa8c34e[_0x3ccd('0x2d')]);_0x3d68ae['filters']=_[_0x3ccd('0x2f')](_0x3d68ae['model'],_0x3d68ae[_0x3ccd('0x2d')]);_0x3344ce[_0x3ccd('0x31')]=_[_0x3ccd('0x2f')](_0x3d68ae[_0x3ccd('0x2b')],qs[_0x3ccd('0x30')](_0xa8c34e[_0x3ccd('0x2d')][_0x3ccd('0x30')]));_0x3344ce[_0x3ccd('0x31')]=_0x3344ce[_0x3ccd('0x31')][_0x3ccd('0x32')]?_0x3344ce[_0x3ccd('0x31')]:_0x3d68ae['model'];if(_0xa8c34e[_0x3ccd('0x2d')][_0x3ccd('0x3e')]){_0x3344ce['include']=[{'all':!![]}];}_0x3344ce=_[_0x3ccd('0x3a')]({},_0x3344ce,_0xa8c34e[_0x3ccd('0x3d')]);return db[_0x3ccd('0x27')][_0x3ccd('0x44')](_0x3344ce)[_0x3ccd('0x21')](handleEntityNotFound(_0x54be87,null))[_0x3ccd('0x21')](respondWithResult(_0x54be87,null))[_0x3ccd('0x41')](handleError(_0x54be87,null));};exports['create']=function(_0x5d18ee,_0x400292){return db['MailSubstatus'][_0x3ccd('0x45')](_0x5d18ee['body'],{})['then'](respondWithResult(_0x400292,0xc9))[_0x3ccd('0x41')](handleError(_0x400292,null));};exports[_0x3ccd('0x20')]=function(_0x3f827f,_0x5ef7da){if(_0x3f827f['body']['id']){delete _0x3f827f[_0x3ccd('0x46')]['id'];}return db[_0x3ccd('0x27')][_0x3ccd('0x44')]({'where':{'id':_0x3f827f['params']['id']}})[_0x3ccd('0x21')](handleEntityNotFound(_0x5ef7da,null))[_0x3ccd('0x21')](saveUpdates(_0x3f827f['body'],null))[_0x3ccd('0x21')](respondWithResult(_0x5ef7da,null))['catch'](handleError(_0x5ef7da,null));};exports[_0x3ccd('0x22')]=function(_0x46928b,_0x27ae19){return db[_0x3ccd('0x27')]['find']({'where':{'id':_0x46928b[_0x3ccd('0x43')]['id']}})['then'](handleEntityNotFound(_0x27ae19,null))[_0x3ccd('0x21')](removeEntity(_0x27ae19,null))['catch'](handleError(_0x27ae19,null));};exports[_0x3ccd('0x47')]=function(_0x3a573e,_0x1c903f){return db[_0x3ccd('0x27')][_0x3ccd('0x47')]()[_0x3ccd('0x21')](respondWithResult(_0x1c903f,null))[_0x3ccd('0x41')](handleError(_0x1c903f,null));}; \ No newline at end of file +var _0x4a0d=['map','fieldName','type','key','keys','query','filters','attributes','intersection','model','fields','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','MailSubstatus','count','includeAll','include','rows','catch','show','params','rawAttributes','length','merge','options','create','body','find','describe','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','offset','set','Content-Range','save','update','then','destroy','error','stack','name'];(function(_0x49d054,_0xf1039c){var _0x56d143=function(_0x5efd31){while(--_0x5efd31){_0x49d054['push'](_0x49d054['shift']());}};_0x56d143(++_0xf1039c);}(_0x4a0d,0x199));var _0xd4a0=function(_0x3ec74e,_0x2f6536){_0x3ec74e=_0x3ec74e-0x0;var _0x5a53f9=_0x4a0d[_0x3ec74e];return _0x5a53f9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd4a0('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd4a0('0x1'));var moment=require('moment');var BPromise=require(_0xd4a0('0x2'));var Mustache=require(_0xd4a0('0x3'));var util=require(_0xd4a0('0x4'));var path=require(_0xd4a0('0x5'));var sox=require('sox');var csv=require(_0xd4a0('0x6'));var ejs=require(_0xd4a0('0x7'));var fs=require('fs');var fs_extra=require(_0xd4a0('0x8'));var _=require(_0xd4a0('0x9'));var squel=require('squel');var crypto=require(_0xd4a0('0xa'));var jsforce=require(_0xd4a0('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd4a0('0xc'));var Papa=require(_0xd4a0('0xd'));var Redis=require(_0xd4a0('0xe'));var authService=require(_0xd4a0('0xf'));var qs=require(_0xd4a0('0x10'));var as=require(_0xd4a0('0x11'));var hardwareService=require(_0xd4a0('0x12'));var logger=require(_0xd4a0('0x13'))(_0xd4a0('0x14'));var utils=require(_0xd4a0('0x15'));var config=require(_0xd4a0('0x16'));var licenseUtil=require(_0xd4a0('0x17'));var db=require(_0xd4a0('0x18'))['db'];function respondWithStatusCode(_0x7ab492,_0x13f73a){_0x13f73a=_0x13f73a||0xcc;return function(_0x287099){if(_0x287099){return _0x7ab492[_0xd4a0('0x19')](_0x13f73a);}return _0x7ab492[_0xd4a0('0x1a')](_0x13f73a)[_0xd4a0('0x1b')]();};}function respondWithResult(_0x193269,_0x215c19){_0x215c19=_0x215c19||0xc8;return function(_0x34e460){if(_0x34e460){return _0x193269[_0xd4a0('0x1a')](_0x215c19)[_0xd4a0('0x1c')](_0x34e460);}};}function respondWithFilteredResult(_0x521b3b,_0x3662c6){return function(_0x3fe70b){if(_0x3fe70b){var _0x69cbe8=typeof _0x3662c6['offset']==='undefined'&&typeof _0x3662c6[_0xd4a0('0x1d')]===_0xd4a0('0x1e');var _0x7c6a37=_0x3fe70b['count'];var _0x254d84=_0x69cbe8?0x0:_0x3662c6[_0xd4a0('0x1f')];var _0x271c10=_0x69cbe8?_0x3fe70b['count']:_0x3662c6['offset']+_0x3662c6[_0xd4a0('0x1d')];var _0x28c584;if(_0x271c10>=_0x7c6a37){_0x271c10=_0x7c6a37;_0x28c584=0xc8;}else{_0x28c584=0xce;}_0x521b3b[_0xd4a0('0x1a')](_0x28c584);return _0x521b3b[_0xd4a0('0x20')](_0xd4a0('0x21'),_0x254d84+'-'+_0x271c10+'/'+_0x7c6a37)[_0xd4a0('0x1c')](_0x3fe70b);}return null;};}function patchUpdates(_0x43211b){return function(_0x5a5d91){try{jsonpatch['apply'](_0x5a5d91,_0x43211b,!![]);}catch(_0x5ed29a){return BPromise['reject'](_0x5ed29a);}return _0x5a5d91[_0xd4a0('0x22')]();};}function saveUpdates(_0x1e0218,_0x1f916a){return function(_0x537902){if(_0x537902){return _0x537902[_0xd4a0('0x23')](_0x1e0218)[_0xd4a0('0x24')](function(_0x639684){return _0x639684;});}return null;};}function removeEntity(_0x41e600,_0x2487c2){return function(_0xa00a95){if(_0xa00a95){return _0xa00a95[_0xd4a0('0x25')]()[_0xd4a0('0x24')](function(){_0x41e600['status'](0xcc)[_0xd4a0('0x1b')]();});}};}function handleEntityNotFound(_0xd64a91,_0x5cf41f){return function(_0x4ee875){if(!_0x4ee875){_0xd64a91[_0xd4a0('0x19')](0x194);}return _0x4ee875;};}function handleError(_0x79c8fb,_0x274814){_0x274814=_0x274814||0x1f4;return function(_0x29edbc){logger[_0xd4a0('0x26')](_0x29edbc[_0xd4a0('0x27')]);if(_0x29edbc['name']){delete _0x29edbc[_0xd4a0('0x28')];}_0x79c8fb[_0xd4a0('0x1a')](_0x274814)['send'](_0x29edbc);};}exports['index']=function(_0x4e3cdc,_0x59dffe){var _0x500cc7={},_0x59abe2={},_0x172d90={'count':0x0,'rows':[]};var _0x32f81d=_[_0xd4a0('0x29')](db['MailSubstatus']['rawAttributes'],function(_0x399d2a){return{'name':_0x399d2a[_0xd4a0('0x2a')],'type':_0x399d2a[_0xd4a0('0x2b')][_0xd4a0('0x2c')]};});_0x59abe2['model']=_[_0xd4a0('0x29')](_0x32f81d,_0xd4a0('0x28'));_0x59abe2['query']=_[_0xd4a0('0x2d')](_0x4e3cdc[_0xd4a0('0x2e')]);_0x59abe2[_0xd4a0('0x2f')]=_['intersection'](_0x59abe2['model'],_0x59abe2[_0xd4a0('0x2e')]);_0x500cc7[_0xd4a0('0x30')]=_[_0xd4a0('0x31')](_0x59abe2[_0xd4a0('0x32')],qs[_0xd4a0('0x33')](_0x4e3cdc['query'][_0xd4a0('0x33')]));_0x500cc7['attributes']=_0x500cc7['attributes']['length']?_0x500cc7[_0xd4a0('0x30')]:_0x59abe2[_0xd4a0('0x32')];if(!_0x4e3cdc[_0xd4a0('0x2e')][_0xd4a0('0x34')](_0xd4a0('0x35'))){_0x500cc7[_0xd4a0('0x1d')]=qs[_0xd4a0('0x1d')](_0x4e3cdc['query'][_0xd4a0('0x1d')]);_0x500cc7[_0xd4a0('0x1f')]=qs['offset'](_0x4e3cdc[_0xd4a0('0x2e')][_0xd4a0('0x1f')]);}_0x500cc7['order']=qs[_0xd4a0('0x36')](_0x4e3cdc[_0xd4a0('0x2e')][_0xd4a0('0x36')]);_0x500cc7['where']=qs[_0xd4a0('0x2f')](_[_0xd4a0('0x37')](_0x4e3cdc[_0xd4a0('0x2e')],_0x59abe2[_0xd4a0('0x2f')]),_0x32f81d);if(_0x4e3cdc[_0xd4a0('0x2e')][_0xd4a0('0x38')]){_0x500cc7[_0xd4a0('0x39')]=_['merge'](_0x500cc7[_0xd4a0('0x39')],{'$or':_['map'](_0x32f81d,function(_0x22ddae){if(_0x22ddae['type']!==_0xd4a0('0x3a')){var _0x558188={};_0x558188[_0x22ddae['name']]={'$like':'%'+_0x4e3cdc[_0xd4a0('0x2e')][_0xd4a0('0x38')]+'%'};return _0x558188;}})});}_0x500cc7=_['merge']({},_0x500cc7,_0x4e3cdc['options']);var _0x22e0c0={'where':_0x500cc7[_0xd4a0('0x39')]};return db[_0xd4a0('0x3b')][_0xd4a0('0x3c')](_0x22e0c0)[_0xd4a0('0x24')](function(_0x4f9ddd){_0x172d90['count']=_0x4f9ddd;if(_0x4e3cdc[_0xd4a0('0x2e')][_0xd4a0('0x3d')]){_0x500cc7[_0xd4a0('0x3e')]=[{'all':!![]}];}return db[_0xd4a0('0x3b')]['findAll'](_0x500cc7);})[_0xd4a0('0x24')](function(_0x4dcaf2){_0x172d90[_0xd4a0('0x3f')]=_0x4dcaf2;return _0x172d90;})[_0xd4a0('0x24')](respondWithFilteredResult(_0x59dffe,_0x500cc7))[_0xd4a0('0x40')](handleError(_0x59dffe,null));};exports[_0xd4a0('0x41')]=function(_0x262d1b,_0x3e9d55){var _0x1ca19={'raw':!![],'where':{'id':_0x262d1b[_0xd4a0('0x42')]['id']}},_0x1bba87={};_0x1bba87[_0xd4a0('0x32')]=_[_0xd4a0('0x2d')](db[_0xd4a0('0x3b')][_0xd4a0('0x43')]);_0x1bba87['query']=_[_0xd4a0('0x2d')](_0x262d1b[_0xd4a0('0x2e')]);_0x1bba87[_0xd4a0('0x2f')]=_['intersection'](_0x1bba87[_0xd4a0('0x32')],_0x1bba87[_0xd4a0('0x2e')]);_0x1ca19[_0xd4a0('0x30')]=_['intersection'](_0x1bba87[_0xd4a0('0x32')],qs[_0xd4a0('0x33')](_0x262d1b[_0xd4a0('0x2e')][_0xd4a0('0x33')]));_0x1ca19[_0xd4a0('0x30')]=_0x1ca19[_0xd4a0('0x30')][_0xd4a0('0x44')]?_0x1ca19['attributes']:_0x1bba87[_0xd4a0('0x32')];if(_0x262d1b['query'][_0xd4a0('0x3d')]){_0x1ca19[_0xd4a0('0x3e')]=[{'all':!![]}];}_0x1ca19=_[_0xd4a0('0x45')]({},_0x1ca19,_0x262d1b[_0xd4a0('0x46')]);return db[_0xd4a0('0x3b')]['find'](_0x1ca19)['then'](handleEntityNotFound(_0x3e9d55,null))[_0xd4a0('0x24')](respondWithResult(_0x3e9d55,null))[_0xd4a0('0x40')](handleError(_0x3e9d55,null));};exports[_0xd4a0('0x47')]=function(_0x2fc78a,_0xc2cb57){return db['MailSubstatus'][_0xd4a0('0x47')](_0x2fc78a[_0xd4a0('0x48')],{})[_0xd4a0('0x24')](respondWithResult(_0xc2cb57,0xc9))[_0xd4a0('0x40')](handleError(_0xc2cb57,null));};exports[_0xd4a0('0x23')]=function(_0x20f697,_0x58da24){if(_0x20f697[_0xd4a0('0x48')]['id']){delete _0x20f697[_0xd4a0('0x48')]['id'];}return db[_0xd4a0('0x3b')][_0xd4a0('0x49')]({'where':{'id':_0x20f697['params']['id']}})[_0xd4a0('0x24')](handleEntityNotFound(_0x58da24,null))[_0xd4a0('0x24')](saveUpdates(_0x20f697[_0xd4a0('0x48')],null))[_0xd4a0('0x24')](respondWithResult(_0x58da24,null))[_0xd4a0('0x40')](handleError(_0x58da24,null));};exports['destroy']=function(_0x1c024d,_0x120ce7){return db[_0xd4a0('0x3b')][_0xd4a0('0x49')]({'where':{'id':_0x1c024d['params']['id']}})['then'](handleEntityNotFound(_0x120ce7,null))[_0xd4a0('0x24')](removeEntity(_0x120ce7,null))[_0xd4a0('0x40')](handleError(_0x120ce7,null));};exports[_0xd4a0('0x4a')]=function(_0x3a2808,_0x58510d){return db[_0xd4a0('0x3b')]['describe']()[_0xd4a0('0x24')](respondWithResult(_0x58510d,null))['catch'](handleError(_0x58510d,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index c8dc2a5..70f8e76 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 _0x6a60=['../../mysqldb','MailSubstatus','setMaxListeners','update','emit','exports'];(function(_0x3fad94,_0x48b5ce){var _0x18f2f7=function(_0xfef13){while(--_0xfef13){_0x3fad94['push'](_0x3fad94['shift']());}};_0x18f2f7(++_0x48b5ce);}(_0x6a60,0x16e));var _0x06a6=function(_0x3ddfd5,_0x2183d9){_0x3ddfd5=_0x3ddfd5-0x0;var _0xdeae69=_0x6a60[_0x3ddfd5];return _0xdeae69;};'use strict';var EventEmitter=require('events');var MailSubstatus=require(_0x06a6('0x0'))['db'][_0x06a6('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x06a6('0x2')](0x0);var events={'afterUpdate':_0x06a6('0x3')};function emitEvent(_0x3c4c8a){return function(_0xb845bc,_0x35a957,_0x446724){MailSubstatusEvents[_0x06a6('0x4')](_0x3c4c8a+':'+_0xb845bc['id'],_0xb845bc);MailSubstatusEvents[_0x06a6('0x4')](_0x3c4c8a,_0xb845bc);_0x446724(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus['hook'](e,emitEvent(event));}}module[_0x06a6('0x5')]=MailSubstatusEvents; \ No newline at end of file +var _0x03c0=['hook','exports','events','../../mysqldb','setMaxListeners','update','emit','hasOwnProperty'];(function(_0x3096c8,_0x4cf94c){var _0x4cb984=function(_0x5a1efc){while(--_0x5a1efc){_0x3096c8['push'](_0x3096c8['shift']());}};_0x4cb984(++_0x4cf94c);}(_0x03c0,0x6a));var _0x003c=function(_0x489e3b,_0x4728af){_0x489e3b=_0x489e3b-0x0;var _0x32b6cc=_0x03c0[_0x489e3b];return _0x32b6cc;};'use strict';var EventEmitter=require(_0x003c('0x0'));var MailSubstatus=require(_0x003c('0x1'))['db']['MailSubstatus'];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x003c('0x2')](0x0);var events={'afterUpdate':_0x003c('0x3')};function emitEvent(_0x280924){return function(_0x137f99,_0xe34621,_0x21dc8c){MailSubstatusEvents[_0x003c('0x4')](_0x280924+':'+_0x137f99['id'],_0x137f99);MailSubstatusEvents['emit'](_0x280924,_0x137f99);_0x21dc8c(null);};}for(var e in events){if(events[_0x003c('0x5')](e)){var event=events[e];MailSubstatus[_0x003c('0x6')](e,emitEvent(event));}}module[_0x003c('0x7')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 227b1d1..ac86044 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 _0xe8c3=['./mailSubstatus.attributes','exports','models','define','Condition','update','mailSubstatus','name','then','catch'];(function(_0x4f85a3,_0x50582a){var _0x54e3f5=function(_0x10f6ce){while(--_0x10f6ce){_0x4f85a3['push'](_0x4f85a3['shift']());}};_0x54e3f5(++_0x50582a);}(_0xe8c3,0x168));var _0x3e8c=function(_0x26df48,_0x22aa50){_0x26df48=_0x26df48-0x0;var _0x209047=_0xe8c3[_0x26df48];return _0x209047;};'use strict';var attributes=require(_0x3e8c('0x0'));module[_0x3e8c('0x1')]=function(_0x14d544){var _0x4723b8=_0x14d544[_0x3e8c('0x2')];return _0x14d544[_0x3e8c('0x3')]('MailSubstatus',attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x5c09f8,_0x401600,_0x59d38d){return _0x4723b8[_0x3e8c('0x4')][_0x3e8c('0x5')]({'value':_0x5c09f8['name']},{'where':{'field':_0x3e8c('0x6'),'value':_0x5c09f8['_previousDataValues'][_0x3e8c('0x7')]}})[_0x3e8c('0x8')](function(){_0x59d38d();})[_0x3e8c('0x9')](function(_0x470f2c){_0x59d38d(_0x470f2c);});}}});}; \ No newline at end of file +var _0x7c5f=['MailSubstatus','mail_substatuses','update','mailSubstatus','_previousDataValues','name','then','catch','./mailSubstatus.attributes','exports','define'];(function(_0x238e7a,_0x5b7bea){var _0xb72185=function(_0x4b66d5){while(--_0x4b66d5){_0x238e7a['push'](_0x238e7a['shift']());}};_0xb72185(++_0x5b7bea);}(_0x7c5f,0x1aa));var _0xf7c5=function(_0x5088b8,_0x1770bb){_0x5088b8=_0x5088b8-0x0;var _0x471f79=_0x7c5f[_0x5088b8];return _0x471f79;};'use strict';var attributes=require(_0xf7c5('0x0'));module[_0xf7c5('0x1')]=function(_0x2dff83){var _0x444ee3=_0x2dff83['models'];return _0x2dff83[_0xf7c5('0x2')](_0xf7c5('0x3'),attributes,{'tableName':_0xf7c5('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x3727e1,_0x553bd8,_0x4aa204){return _0x444ee3['Condition'][_0xf7c5('0x5')]({'value':_0x3727e1['name']},{'where':{'field':_0xf7c5('0x6'),'value':_0x3727e1[_0xf7c5('0x7')][_0xf7c5('0x8')]}})[_0xf7c5('0x9')](function(){_0x4aa204();})[_0xf7c5('0xa')](function(_0x2d9762){_0x4aa204(_0x2d9762);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index a723726..0aeccda 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 _0x9374=['debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent'];(function(_0x2b7e9c,_0x236531){var _0x39ac82=function(_0x351563){while(--_0x351563){_0x2b7e9c['push'](_0x2b7e9c['shift']());}};_0x39ac82(++_0x236531);}(_0x9374,0x1ac));var _0x4937=function(_0x33fdd4,_0x3ec50d){_0x33fdd4=_0x33fdd4-0x0;var _0x3eba45=_0x9374[_0x33fdd4];return _0x3eba45;};'use strict';var _=require('lodash');var util=require(_0x4937('0x0'));var moment=require(_0x4937('0x1'));var BPromise=require(_0x4937('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4937('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4937('0x4'));var logger=require(_0x4937('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4937('0x6'));var client=jayson['client'][_0x4937('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3bbe3a,_0x18616b,_0x29f39d){return new BPromise(function(_0x8b2800,_0x179add){return client[_0x4937('0x8')](_0x3bbe3a,_0x29f39d)[_0x4937('0x9')](function(_0x226629){logger[_0x4937('0xa')](_0x4937('0xb'),_0x18616b,_0x4937('0xc'));logger[_0x4937('0xd')](_0x4937('0xe'),_0x18616b,'request\x20sent',JSON[_0x4937('0xf')](_0x226629));if(_0x226629[_0x4937('0x10')]){if(_0x226629['error'][_0x4937('0x11')]===0x1f4){logger[_0x4937('0x10')](_0x4937('0xb'),_0x18616b,_0x226629[_0x4937('0x10')][_0x4937('0x12')]);return _0x179add(_0x226629['error'][_0x4937('0x12')]);}logger[_0x4937('0x10')]('MailSubstatus,\x20%s,\x20%s',_0x18616b,_0x226629[_0x4937('0x10')][_0x4937('0x12')]);return _0x8b2800(_0x226629[_0x4937('0x10')][_0x4937('0x12')]);}else{logger['info'](_0x4937('0xb'),_0x18616b,_0x4937('0xc'));_0x8b2800(_0x226629[_0x4937('0x13')]['message']);}})[_0x4937('0x14')](function(_0x6f9cb7){logger[_0x4937('0x10')](_0x4937('0xb'),_0x18616b,_0x6f9cb7);_0x179add(_0x6f9cb7);});});} \ No newline at end of file +var _0xe103=['../../config/environment','jayson/promise','http','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x44fe6d,_0x4e97c6){var _0x14563a=function(_0x2c5850){while(--_0x2c5850){_0x44fe6d['push'](_0x44fe6d['shift']());}};_0x14563a(++_0x4e97c6);}(_0xe103,0x12f));var _0x3e10=function(_0x52a592,_0x2926b4){_0x52a592=_0x52a592-0x0;var _0x511e55=_0xe103[_0x52a592];return _0x511e55;};'use strict';var _=require(_0x3e10('0x0'));var util=require(_0x3e10('0x1'));var moment=require('moment');var BPromise=require(_0x3e10('0x2'));var rs=require(_0x3e10('0x3'));var fs=require('fs');var Redis=require(_0x3e10('0x4'));var db=require(_0x3e10('0x5'))['db'];var utils=require(_0x3e10('0x6'));var logger=require(_0x3e10('0x7'))(_0x3e10('0x8'));var config=require(_0x3e10('0x9'));var jayson=require(_0x3e10('0xa'));var client=jayson['client'][_0x3e10('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3a1c10,_0x32884d,_0x5a1011){return new BPromise(function(_0x270afe,_0x37f3fb){return client[_0x3e10('0xc')](_0x3a1c10,_0x5a1011)[_0x3e10('0xd')](function(_0x1a1572){logger[_0x3e10('0xe')](_0x3e10('0xf'),_0x32884d,_0x3e10('0x10'));logger['debug'](_0x3e10('0x11'),_0x32884d,'request\x20sent',JSON[_0x3e10('0x12')](_0x1a1572));if(_0x1a1572['error']){if(_0x1a1572[_0x3e10('0x13')][_0x3e10('0x14')]===0x1f4){logger['error'](_0x3e10('0xf'),_0x32884d,_0x1a1572['error'][_0x3e10('0x15')]);return _0x37f3fb(_0x1a1572['error'][_0x3e10('0x15')]);}logger['error'](_0x3e10('0xf'),_0x32884d,_0x1a1572[_0x3e10('0x13')][_0x3e10('0x15')]);return _0x270afe(_0x1a1572[_0x3e10('0x13')][_0x3e10('0x15')]);}else{logger['info'](_0x3e10('0xf'),_0x32884d,_0x3e10('0x10'));_0x270afe(_0x1a1572[_0x3e10('0x16')][_0x3e10('0x15')]);}})[_0x3e10('0x17')](function(_0xf21ebf){logger['error']('MailSubstatus,\x20%s,\x20%s',_0x32884d,_0xf21ebf);_0x37f3fb(_0xf21ebf);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index dd53437..3f3f62b 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 _0x6228=['create','put','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','index','get','/describe','isAuthenticated','/:id'];(function(_0x35de70,_0x28b7fd){var _0xeb27b=function(_0x34088a){while(--_0x34088a){_0x35de70['push'](_0x35de70['shift']());}};_0xeb27b(++_0x28b7fd);}(_0x6228,0x1a1));var _0x8622=function(_0x9efc0b,_0x4e0680){_0x9efc0b=_0x9efc0b-0x0;var _0xf032b=_0x6228[_0x9efc0b];return _0xf032b;};'use strict';var multer=require(_0x8622('0x0'));var util=require('util');var path=require(_0x8622('0x1'));var timeout=require(_0x8622('0x2'));var express=require(_0x8622('0x3'));var router=express[_0x8622('0x4')]();var fs_extra=require(_0x8622('0x5'));var auth=require(_0x8622('0x6'));var interaction=require(_0x8622('0x7'));var config=require(_0x8622('0x8'));var controller=require(_0x8622('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x8622('0xa')]);router[_0x8622('0xb')](_0x8622('0xc'),auth[_0x8622('0xd')](),controller['describe']);router[_0x8622('0xb')](_0x8622('0xe'),auth[_0x8622('0xd')](),controller['show']);router['post']('/',auth[_0x8622('0xd')](),controller[_0x8622('0xf')]);router[_0x8622('0x10')](_0x8622('0xe'),auth[_0x8622('0xd')](),controller['update']);router['delete'](_0x8622('0xe'),auth[_0x8622('0xd')](),controller[_0x8622('0x11')]);module['exports']=router; \ No newline at end of file +var _0x0c51=['get','isAuthenticated','/describe','describe','show','post','put','update','delete','/:id','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x143cfd,_0x1a336e){var _0x2cb5f5=function(_0x1523fa){while(--_0x1523fa){_0x143cfd['push'](_0x143cfd['shift']());}};_0x2cb5f5(++_0x1a336e);}(_0x0c51,0x1df));var _0x10c5=function(_0x280626,_0x51d555){_0x280626=_0x280626-0x0;var _0x4336f1=_0x0c51[_0x280626];return _0x4336f1;};'use strict';var multer=require(_0x10c5('0x0'));var util=require(_0x10c5('0x1'));var path=require('path');var timeout=require(_0x10c5('0x2'));var express=require(_0x10c5('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x10c5('0x4'));var interaction=require(_0x10c5('0x5'));var config=require(_0x10c5('0x6'));var controller=require('./mailTransferReport.controller');router[_0x10c5('0x7')]('/',auth[_0x10c5('0x8')](),controller['index']);router['get'](_0x10c5('0x9'),auth[_0x10c5('0x8')](),controller[_0x10c5('0xa')]);router[_0x10c5('0x7')]('/:id',auth[_0x10c5('0x8')](),controller[_0x10c5('0xb')]);router[_0x10c5('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x10c5('0xd')]('/:id',auth[_0x10c5('0x8')](),controller[_0x10c5('0xe')]);router[_0x10c5('0xf')](_0x10c5('0x10'),auth[_0x10c5('0x8')](),controller['destroy']);module[_0x10c5('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 007f92b..46b19e8 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 _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x20f060,_0xe160c9){var _0x46077c=function(_0x3c615a){while(--_0x3c615a){_0x20f060['push'](_0x20f060['shift']());}};_0x46077c(++_0xe160c9);}(_0x54ef,0x112));var _0xf54e=function(_0x872977,_0x310a3a){_0x872977=_0x872977-0x0;var _0x42f654=_0x54ef[_0x872977];return _0x42f654;};'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 _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x35efd7,_0x5a97e6){var _0x3d9b5d=function(_0x45fa98){while(--_0x45fa98){_0x35efd7['push'](_0x35efd7['shift']());}};_0x3d9b5d(++_0x5a97e6);}(_0xf4eb,0xec));var _0xbf4e=function(_0x163170,_0x19368c){_0x163170=_0x163170-0x0;var _0x5c5b9b=_0xf4eb[_0x163170];return _0x5c5b9b;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 5cae98b..0287270 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 _0x270e=['fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','find','catch','create','body','params','describe','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','update','then','destroy','error','stack','name','index','map','MailTransferReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection'];(function(_0x27bc08,_0x1bd619){var _0x51e98d=function(_0x279226){while(--_0x279226){_0x27bc08['push'](_0x27bc08['shift']());}};_0x51e98d(++_0x1bd619);}(_0x270e,0xab));var _0xe270=function(_0x2f4d7f,_0x62f4b7){_0x2f4d7f=_0x2f4d7f-0x0;var _0x147ba1=_0x270e[_0x2f4d7f];return _0x147ba1;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe270('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe270('0x1'));var moment=require('moment');var BPromise=require(_0xe270('0x2'));var Mustache=require(_0xe270('0x3'));var util=require(_0xe270('0x4'));var path=require(_0xe270('0x5'));var sox=require(_0xe270('0x6'));var csv=require(_0xe270('0x7'));var ejs=require(_0xe270('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe270('0x9'));var squel=require(_0xe270('0xa'));var crypto=require(_0xe270('0xb'));var jsforce=require(_0xe270('0xc'));var deskjs=require(_0xe270('0xd'));var toCsv=require('to-csv');var querystring=require(_0xe270('0xe'));var Papa=require(_0xe270('0xf'));var Redis=require(_0xe270('0x10'));var authService=require(_0xe270('0x11'));var qs=require(_0xe270('0x12'));var as=require(_0xe270('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe270('0x14'))('api');var utils=require(_0xe270('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe270('0x16'))['db'];function respondWithStatusCode(_0x198928,_0x512ad7){_0x512ad7=_0x512ad7||0xcc;return function(_0x22c003){if(_0x22c003){return _0x198928[_0xe270('0x17')](_0x512ad7);}return _0x198928[_0xe270('0x18')](_0x512ad7)[_0xe270('0x19')]();};}function respondWithResult(_0x3fa015,_0x3f20c6){_0x3f20c6=_0x3f20c6||0xc8;return function(_0x26c295){if(_0x26c295){return _0x3fa015[_0xe270('0x18')](_0x3f20c6)[_0xe270('0x1a')](_0x26c295);}};}function respondWithFilteredResult(_0x39d775,_0x3ca150){return function(_0x3f6203){if(_0x3f6203){var _0x15e72c=typeof _0x3ca150[_0xe270('0x1b')]===_0xe270('0x1c')&&typeof _0x3ca150['limit']===_0xe270('0x1c');var _0x6151c8=_0x3f6203[_0xe270('0x1d')];var _0x2a9e1f=_0x15e72c?0x0:_0x3ca150['offset'];var _0x1ff996=_0x15e72c?_0x3f6203[_0xe270('0x1d')]:_0x3ca150[_0xe270('0x1b')]+_0x3ca150[_0xe270('0x1e')];var _0x471a34;if(_0x1ff996>=_0x6151c8){_0x1ff996=_0x6151c8;_0x471a34=0xc8;}else{_0x471a34=0xce;}_0x39d775[_0xe270('0x18')](_0x471a34);return _0x39d775[_0xe270('0x1f')](_0xe270('0x20'),_0x2a9e1f+'-'+_0x1ff996+'/'+_0x6151c8)[_0xe270('0x1a')](_0x3f6203);}return null;};}function patchUpdates(_0x20b0ff){return function(_0x274b4e){try{jsonpatch[_0xe270('0x21')](_0x274b4e,_0x20b0ff,!![]);}catch(_0x49c162){return BPromise['reject'](_0x49c162);}return _0x274b4e['save']();};}function saveUpdates(_0xf9d33d,_0x4e28e7){return function(_0x45279f){if(_0x45279f){return _0x45279f[_0xe270('0x22')](_0xf9d33d)[_0xe270('0x23')](function(_0x20bf88){return _0x20bf88;});}return null;};}function removeEntity(_0x16a872,_0x31ca63){return function(_0x23e0ad){if(_0x23e0ad){return _0x23e0ad[_0xe270('0x24')]()[_0xe270('0x23')](function(){_0x16a872[_0xe270('0x18')](0xcc)[_0xe270('0x19')]();});}};}function handleEntityNotFound(_0x4b2a0f,_0x538c5d){return function(_0x2c111d){if(!_0x2c111d){_0x4b2a0f[_0xe270('0x17')](0x194);}return _0x2c111d;};}function handleError(_0x145705,_0x5a0a56){_0x5a0a56=_0x5a0a56||0x1f4;return function(_0x21f0e6){logger[_0xe270('0x25')](_0x21f0e6[_0xe270('0x26')]);if(_0x21f0e6[_0xe270('0x27')]){delete _0x21f0e6[_0xe270('0x27')];}_0x145705[_0xe270('0x18')](_0x5a0a56)['send'](_0x21f0e6);};}exports[_0xe270('0x28')]=function(_0x578ab7,_0xa85431){var _0x4d54be={},_0x263830={},_0xa6c981={'count':0x0,'rows':[]};var _0x2dd44f=_[_0xe270('0x29')](db[_0xe270('0x2a')][_0xe270('0x2b')],function(_0xaccf74){return{'name':_0xaccf74[_0xe270('0x2c')],'type':_0xaccf74['type'][_0xe270('0x2d')]};});_0x263830[_0xe270('0x2e')]=_[_0xe270('0x29')](_0x2dd44f,_0xe270('0x27'));_0x263830[_0xe270('0x2f')]=_[_0xe270('0x30')](_0x578ab7[_0xe270('0x2f')]);_0x263830[_0xe270('0x31')]=_['intersection'](_0x263830[_0xe270('0x2e')],_0x263830[_0xe270('0x2f')]);_0x4d54be['attributes']=_[_0xe270('0x32')](_0x263830[_0xe270('0x2e')],qs[_0xe270('0x33')](_0x578ab7[_0xe270('0x2f')][_0xe270('0x33')]));_0x4d54be[_0xe270('0x34')]=_0x4d54be[_0xe270('0x34')][_0xe270('0x35')]?_0x4d54be[_0xe270('0x34')]:_0x263830[_0xe270('0x2e')];if(!_0x578ab7[_0xe270('0x2f')][_0xe270('0x36')]('nolimit')){_0x4d54be['limit']=qs[_0xe270('0x1e')](_0x578ab7['query'][_0xe270('0x1e')]);_0x4d54be[_0xe270('0x1b')]=qs['offset'](_0x578ab7['query'][_0xe270('0x1b')]);}_0x4d54be[_0xe270('0x37')]=qs['sort'](_0x578ab7[_0xe270('0x2f')][_0xe270('0x38')]);_0x4d54be[_0xe270('0x39')]=qs[_0xe270('0x31')](_[_0xe270('0x3a')](_0x578ab7[_0xe270('0x2f')],_0x263830['filters']),_0x2dd44f);if(_0x578ab7[_0xe270('0x2f')][_0xe270('0x3b')]){_0x4d54be[_0xe270('0x39')]=_['merge'](_0x4d54be[_0xe270('0x39')],{'$or':_['map'](_0x2dd44f,function(_0x3c7e24){if(_0x3c7e24['type']!==_0xe270('0x3c')){var _0x205156={};_0x205156[_0x3c7e24[_0xe270('0x27')]]={'$like':'%'+_0x578ab7['query'][_0xe270('0x3b')]+'%'};return _0x205156;}})});}_0x4d54be=_[_0xe270('0x3d')]({},_0x4d54be,_0x578ab7[_0xe270('0x3e')]);var _0x2aa8d4={'where':_0x4d54be['where']};return db[_0xe270('0x2a')][_0xe270('0x1d')](_0x2aa8d4)['then'](function(_0x4004e9){_0xa6c981[_0xe270('0x1d')]=_0x4004e9;if(_0x578ab7['query'][_0xe270('0x3f')]){_0x4d54be[_0xe270('0x40')]=[{'all':!![]}];}return db[_0xe270('0x2a')][_0xe270('0x41')](_0x4d54be);})[_0xe270('0x23')](function(_0x23b02c){_0xa6c981[_0xe270('0x42')]=_0x23b02c;return _0xa6c981;})[_0xe270('0x23')](respondWithFilteredResult(_0xa85431,_0x4d54be))['catch'](handleError(_0xa85431,null));};exports[_0xe270('0x43')]=function(_0x4702a2,_0x3569bc){var _0x54caee={'raw':!![],'where':{'id':_0x4702a2['params']['id']}},_0x5cb66c={};_0x5cb66c[_0xe270('0x2e')]=_['keys'](db[_0xe270('0x2a')][_0xe270('0x2b')]);_0x5cb66c[_0xe270('0x2f')]=_['keys'](_0x4702a2['query']);_0x5cb66c[_0xe270('0x31')]=_['intersection'](_0x5cb66c[_0xe270('0x2e')],_0x5cb66c[_0xe270('0x2f')]);_0x54caee[_0xe270('0x34')]=_[_0xe270('0x32')](_0x5cb66c['model'],qs[_0xe270('0x33')](_0x4702a2[_0xe270('0x2f')][_0xe270('0x33')]));_0x54caee[_0xe270('0x34')]=_0x54caee[_0xe270('0x34')][_0xe270('0x35')]?_0x54caee[_0xe270('0x34')]:_0x5cb66c[_0xe270('0x2e')];if(_0x4702a2[_0xe270('0x2f')][_0xe270('0x3f')]){_0x54caee['include']=[{'all':!![]}];}_0x54caee=_[_0xe270('0x3d')]({},_0x54caee,_0x4702a2[_0xe270('0x3e')]);return db[_0xe270('0x2a')][_0xe270('0x44')](_0x54caee)[_0xe270('0x23')](handleEntityNotFound(_0x3569bc,null))['then'](respondWithResult(_0x3569bc,null))[_0xe270('0x45')](handleError(_0x3569bc,null));};exports[_0xe270('0x46')]=function(_0x54d6f6,_0x263a16){return db[_0xe270('0x2a')][_0xe270('0x46')](_0x54d6f6['body'],{})[_0xe270('0x23')](respondWithResult(_0x263a16,0xc9))[_0xe270('0x45')](handleError(_0x263a16,null));};exports[_0xe270('0x22')]=function(_0x2faf27,_0x309a8e){if(_0x2faf27[_0xe270('0x47')]['id']){delete _0x2faf27['body']['id'];}return db[_0xe270('0x2a')][_0xe270('0x44')]({'where':{'id':_0x2faf27[_0xe270('0x48')]['id']}})[_0xe270('0x23')](handleEntityNotFound(_0x309a8e,null))[_0xe270('0x23')](saveUpdates(_0x2faf27[_0xe270('0x47')],null))[_0xe270('0x23')](respondWithResult(_0x309a8e,null))[_0xe270('0x45')](handleError(_0x309a8e,null));};exports[_0xe270('0x24')]=function(_0x5746a1,_0x5e6abc){return db[_0xe270('0x2a')][_0xe270('0x44')]({'where':{'id':_0x5746a1[_0xe270('0x48')]['id']}})[_0xe270('0x23')](handleEntityNotFound(_0x5e6abc,null))[_0xe270('0x23')](removeEntity(_0x5e6abc,null))['catch'](handleError(_0x5e6abc,null));};exports[_0xe270('0x49')]=function(_0x2fe044,_0x49e7c2){return db[_0xe270('0x2a')][_0xe270('0x49')]()[_0xe270('0x23')](respondWithResult(_0x49e7c2,null))[_0xe270('0x45')](handleError(_0x49e7c2,null));}; \ No newline at end of file +var _0x8bf4=['map','MailTransferReport','rawAttributes','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','reject','save','update','destroy','then','end','sendStatus','error','stack','name','send','index'];(function(_0x951e48,_0x422d87){var _0x334df0=function(_0x42c9df){while(--_0x42c9df){_0x951e48['push'](_0x951e48['shift']());}};_0x334df0(++_0x422d87);}(_0x8bf4,0x158));var _0x48bf=function(_0x2cbb74,_0x241c10){_0x2cbb74=_0x2cbb74-0x0;var _0xa6d18=_0x8bf4[_0x2cbb74];return _0xa6d18;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x48bf('0x0'));var jsonpatch=require(_0x48bf('0x1'));var rp=require(_0x48bf('0x2'));var moment=require(_0x48bf('0x3'));var BPromise=require(_0x48bf('0x4'));var Mustache=require('mustache');var util=require(_0x48bf('0x5'));var path=require(_0x48bf('0x6'));var sox=require(_0x48bf('0x7'));var csv=require(_0x48bf('0x8'));var ejs=require(_0x48bf('0x9'));var fs=require('fs');var fs_extra=require(_0x48bf('0xa'));var _=require(_0x48bf('0xb'));var squel=require(_0x48bf('0xc'));var crypto=require(_0x48bf('0xd'));var jsforce=require(_0x48bf('0xe'));var deskjs=require(_0x48bf('0xf'));var toCsv=require(_0x48bf('0x8'));var querystring=require(_0x48bf('0x10'));var Papa=require(_0x48bf('0x11'));var Redis=require(_0x48bf('0x12'));var authService=require(_0x48bf('0x13'));var qs=require(_0x48bf('0x14'));var as=require(_0x48bf('0x15'));var hardwareService=require(_0x48bf('0x16'));var logger=require(_0x48bf('0x17'))(_0x48bf('0x18'));var utils=require(_0x48bf('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x48bf('0x1a'));var db=require(_0x48bf('0x1b'))['db'];function respondWithStatusCode(_0x24df2d,_0x5a0aa8){_0x5a0aa8=_0x5a0aa8||0xcc;return function(_0x314df5){if(_0x314df5){return _0x24df2d['sendStatus'](_0x5a0aa8);}return _0x24df2d['status'](_0x5a0aa8)['end']();};}function respondWithResult(_0x33c342,_0x2efbaf){_0x2efbaf=_0x2efbaf||0xc8;return function(_0x1d8439){if(_0x1d8439){return _0x33c342[_0x48bf('0x1c')](_0x2efbaf)[_0x48bf('0x1d')](_0x1d8439);}};}function respondWithFilteredResult(_0x2af5b6,_0x14b4ff){return function(_0x6a93af){if(_0x6a93af){var _0x49540a=typeof _0x14b4ff[_0x48bf('0x1e')]===_0x48bf('0x1f')&&typeof _0x14b4ff[_0x48bf('0x20')]==='undefined';var _0x1b53f7=_0x6a93af[_0x48bf('0x21')];var _0x4cd244=_0x49540a?0x0:_0x14b4ff[_0x48bf('0x1e')];var _0x2edace=_0x49540a?_0x6a93af[_0x48bf('0x21')]:_0x14b4ff[_0x48bf('0x1e')]+_0x14b4ff[_0x48bf('0x20')];var _0xd394af;if(_0x2edace>=_0x1b53f7){_0x2edace=_0x1b53f7;_0xd394af=0xc8;}else{_0xd394af=0xce;}_0x2af5b6[_0x48bf('0x1c')](_0xd394af);return _0x2af5b6['set']('Content-Range',_0x4cd244+'-'+_0x2edace+'/'+_0x1b53f7)[_0x48bf('0x1d')](_0x6a93af);}return null;};}function patchUpdates(_0x16fd78){return function(_0x526c5c){try{jsonpatch['apply'](_0x526c5c,_0x16fd78,!![]);}catch(_0x2859a7){return BPromise[_0x48bf('0x22')](_0x2859a7);}return _0x526c5c[_0x48bf('0x23')]();};}function saveUpdates(_0x2d94e6,_0x1d49b2){return function(_0x24b099){if(_0x24b099){return _0x24b099[_0x48bf('0x24')](_0x2d94e6)['then'](function(_0x533893){return _0x533893;});}return null;};}function removeEntity(_0x144ba1,_0x1f5630){return function(_0x18183f){if(_0x18183f){return _0x18183f[_0x48bf('0x25')]()[_0x48bf('0x26')](function(){_0x144ba1[_0x48bf('0x1c')](0xcc)[_0x48bf('0x27')]();});}};}function handleEntityNotFound(_0x5ad6df,_0x73c0ff){return function(_0x1c8636){if(!_0x1c8636){_0x5ad6df[_0x48bf('0x28')](0x194);}return _0x1c8636;};}function handleError(_0x26375e,_0x372486){_0x372486=_0x372486||0x1f4;return function(_0x25238b){logger[_0x48bf('0x29')](_0x25238b[_0x48bf('0x2a')]);if(_0x25238b['name']){delete _0x25238b[_0x48bf('0x2b')];}_0x26375e[_0x48bf('0x1c')](_0x372486)[_0x48bf('0x2c')](_0x25238b);};}exports[_0x48bf('0x2d')]=function(_0x487313,_0x4ecdb8){var _0xbe18ed={},_0x15fa96={},_0x3a7d99={'count':0x0,'rows':[]};var _0x536942=_[_0x48bf('0x2e')](db[_0x48bf('0x2f')][_0x48bf('0x30')],function(_0x2db0a9){return{'name':_0x2db0a9['fieldName'],'type':_0x2db0a9[_0x48bf('0x31')][_0x48bf('0x32')]};});_0x15fa96[_0x48bf('0x33')]=_[_0x48bf('0x2e')](_0x536942,_0x48bf('0x2b'));_0x15fa96[_0x48bf('0x34')]=_['keys'](_0x487313[_0x48bf('0x34')]);_0x15fa96['filters']=_['intersection'](_0x15fa96['model'],_0x15fa96[_0x48bf('0x34')]);_0xbe18ed[_0x48bf('0x35')]=_[_0x48bf('0x36')](_0x15fa96[_0x48bf('0x33')],qs[_0x48bf('0x37')](_0x487313['query'][_0x48bf('0x37')]));_0xbe18ed['attributes']=_0xbe18ed[_0x48bf('0x35')][_0x48bf('0x38')]?_0xbe18ed[_0x48bf('0x35')]:_0x15fa96[_0x48bf('0x33')];if(!_0x487313[_0x48bf('0x34')][_0x48bf('0x39')](_0x48bf('0x3a'))){_0xbe18ed[_0x48bf('0x20')]=qs[_0x48bf('0x20')](_0x487313[_0x48bf('0x34')][_0x48bf('0x20')]);_0xbe18ed[_0x48bf('0x1e')]=qs[_0x48bf('0x1e')](_0x487313[_0x48bf('0x34')]['offset']);}_0xbe18ed['order']=qs['sort'](_0x487313['query']['sort']);_0xbe18ed[_0x48bf('0x3b')]=qs['filters'](_[_0x48bf('0x3c')](_0x487313[_0x48bf('0x34')],_0x15fa96[_0x48bf('0x3d')]),_0x536942);if(_0x487313['query'][_0x48bf('0x3e')]){_0xbe18ed[_0x48bf('0x3b')]=_[_0x48bf('0x3f')](_0xbe18ed[_0x48bf('0x3b')],{'$or':_['map'](_0x536942,function(_0x42541f){if(_0x42541f[_0x48bf('0x31')]!==_0x48bf('0x40')){var _0x5e67f7={};_0x5e67f7[_0x42541f[_0x48bf('0x2b')]]={'$like':'%'+_0x487313[_0x48bf('0x34')][_0x48bf('0x3e')]+'%'};return _0x5e67f7;}})});}_0xbe18ed=_[_0x48bf('0x3f')]({},_0xbe18ed,_0x487313[_0x48bf('0x41')]);var _0x1296c7={'where':_0xbe18ed[_0x48bf('0x3b')]};return db['MailTransferReport'][_0x48bf('0x21')](_0x1296c7)['then'](function(_0x422f7f){_0x3a7d99[_0x48bf('0x21')]=_0x422f7f;if(_0x487313[_0x48bf('0x34')][_0x48bf('0x42')]){_0xbe18ed[_0x48bf('0x43')]=[{'all':!![]}];}return db[_0x48bf('0x2f')][_0x48bf('0x44')](_0xbe18ed);})[_0x48bf('0x26')](function(_0xaa8d3d){_0x3a7d99[_0x48bf('0x45')]=_0xaa8d3d;return _0x3a7d99;})['then'](respondWithFilteredResult(_0x4ecdb8,_0xbe18ed))['catch'](handleError(_0x4ecdb8,null));};exports[_0x48bf('0x46')]=function(_0x3fcf14,_0x5ac602){var _0x2ec9ad={'raw':!![],'where':{'id':_0x3fcf14[_0x48bf('0x47')]['id']}},_0x1191b6={};_0x1191b6['model']=_[_0x48bf('0x48')](db['MailTransferReport'][_0x48bf('0x30')]);_0x1191b6[_0x48bf('0x34')]=_['keys'](_0x3fcf14[_0x48bf('0x34')]);_0x1191b6[_0x48bf('0x3d')]=_[_0x48bf('0x36')](_0x1191b6[_0x48bf('0x33')],_0x1191b6[_0x48bf('0x34')]);_0x2ec9ad[_0x48bf('0x35')]=_[_0x48bf('0x36')](_0x1191b6[_0x48bf('0x33')],qs[_0x48bf('0x37')](_0x3fcf14[_0x48bf('0x34')][_0x48bf('0x37')]));_0x2ec9ad['attributes']=_0x2ec9ad[_0x48bf('0x35')]['length']?_0x2ec9ad[_0x48bf('0x35')]:_0x1191b6[_0x48bf('0x33')];if(_0x3fcf14[_0x48bf('0x34')][_0x48bf('0x42')]){_0x2ec9ad[_0x48bf('0x43')]=[{'all':!![]}];}_0x2ec9ad=_[_0x48bf('0x3f')]({},_0x2ec9ad,_0x3fcf14[_0x48bf('0x41')]);return db[_0x48bf('0x2f')][_0x48bf('0x49')](_0x2ec9ad)[_0x48bf('0x26')](handleEntityNotFound(_0x5ac602,null))[_0x48bf('0x26')](respondWithResult(_0x5ac602,null))[_0x48bf('0x4a')](handleError(_0x5ac602,null));};exports[_0x48bf('0x4b')]=function(_0x2d49d9,_0x214b00){return db[_0x48bf('0x2f')]['create'](_0x2d49d9[_0x48bf('0x4c')],{})[_0x48bf('0x26')](respondWithResult(_0x214b00,0xc9))['catch'](handleError(_0x214b00,null));};exports[_0x48bf('0x24')]=function(_0x2a21e6,_0xddfdec){if(_0x2a21e6['body']['id']){delete _0x2a21e6[_0x48bf('0x4c')]['id'];}return db[_0x48bf('0x2f')][_0x48bf('0x49')]({'where':{'id':_0x2a21e6[_0x48bf('0x47')]['id']}})[_0x48bf('0x26')](handleEntityNotFound(_0xddfdec,null))[_0x48bf('0x26')](saveUpdates(_0x2a21e6[_0x48bf('0x4c')],null))['then'](respondWithResult(_0xddfdec,null))[_0x48bf('0x4a')](handleError(_0xddfdec,null));};exports[_0x48bf('0x25')]=function(_0x2cfa86,_0x1bcc52){return db[_0x48bf('0x2f')]['find']({'where':{'id':_0x2cfa86['params']['id']}})[_0x48bf('0x26')](handleEntityNotFound(_0x1bcc52,null))[_0x48bf('0x26')](removeEntity(_0x1bcc52,null))[_0x48bf('0x4a')](handleError(_0x1bcc52,null));};exports['describe']=function(_0x504441,_0x9990b9){return db[_0x48bf('0x2f')][_0x48bf('0x4d')]()[_0x48bf('0x26')](respondWithResult(_0x9990b9,null))[_0x48bf('0x4a')](handleError(_0x9990b9,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 711c056..5236503 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 _0xb18e=['./mailTransferReport.attributes','exports','define','report_mail_transfer','uniqueid','../../config/logger','moment','request-promise','path','../../config/environment'];(function(_0x27e6f9,_0x7454f1){var _0x50b299=function(_0x14bbee){while(--_0x14bbee){_0x27e6f9['push'](_0x27e6f9['shift']());}};_0x50b299(++_0x7454f1);}(_0xb18e,0x181));var _0xeb18=function(_0x1b3564,_0x16c919){_0x1b3564=_0x1b3564-0x0;var _0x504069=_0xb18e[_0x1b3564];return _0x504069;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xeb18('0x0'))('api');var moment=require(_0xeb18('0x1'));var BPromise=require('bluebird');var rp=require(_0xeb18('0x2'));var fs=require('fs');var path=require(_0xeb18('0x3'));var rimraf=require('rimraf');var config=require(_0xeb18('0x4'));var attributes=require(_0xeb18('0x5'));module[_0xeb18('0x6')]=function(_0x409efb,_0x46d281){return _0x409efb[_0xeb18('0x7')]('MailTransferReport',attributes,{'tableName':_0xeb18('0x8'),'paranoid':![],'indexes':[{'name':_0xeb18('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x032a=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes','exports','define','report_mail_transfer'];(function(_0x5b4ceb,_0x7993d8){var _0x452603=function(_0xd56b70){while(--_0xd56b70){_0x5b4ceb['push'](_0x5b4ceb['shift']());}};_0x452603(++_0x7993d8);}(_0x032a,0xf0));var _0xa032=function(_0x3b19ea,_0x518b6b){_0x3b19ea=_0x3b19ea-0x0;var _0x40ece9=_0x032a[_0x3b19ea];return _0x40ece9;};'use strict';var _=require('lodash');var util=require(_0xa032('0x0'));var logger=require('../../config/logger')(_0xa032('0x1'));var moment=require(_0xa032('0x2'));var BPromise=require(_0xa032('0x3'));var rp=require(_0xa032('0x4'));var fs=require('fs');var path=require(_0xa032('0x5'));var rimraf=require(_0xa032('0x6'));var config=require(_0xa032('0x7'));var attributes=require(_0xa032('0x8'));module[_0xa032('0x9')]=function(_0x2b1445,_0x43d0f5){return _0x2b1445[_0xa032('0xa')]('MailTransferReport',attributes,{'tableName':_0xa032('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 524eed7..07ff60b 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 _0x5e02=['error','code','message','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x8eeafb,_0x4c416e){var _0x1d981e=function(_0x4ff80b){while(--_0x4ff80b){_0x8eeafb['push'](_0x8eeafb['shift']());}};_0x1d981e(++_0x4c416e);}(_0x5e02,0x1c7));var _0x25e0=function(_0x23371f,_0x34bf84){_0x23371f=_0x23371f-0x0;var _0x241060=_0x5e02[_0x23371f];return _0x241060;};'use strict';var _=require(_0x25e0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x25e0('0x1'));var fs=require('fs');var Redis=require(_0x25e0('0x2'));var db=require(_0x25e0('0x3'))['db'];var utils=require(_0x25e0('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x25e0('0x5'));var jayson=require(_0x25e0('0x6'));var client=jayson['client'][_0x25e0('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3bb157,_0x287fdd,_0x43fd98){return new BPromise(function(_0x2bda31,_0x2b2101){return client['request'](_0x3bb157,_0x43fd98)['then'](function(_0x4464b7){logger[_0x25e0('0x8')](_0x25e0('0x9'),_0x287fdd,_0x25e0('0xa'));logger[_0x25e0('0xb')](_0x25e0('0xc'),_0x287fdd,_0x25e0('0xa'),JSON['stringify'](_0x4464b7));if(_0x4464b7[_0x25e0('0xd')]){if(_0x4464b7[_0x25e0('0xd')][_0x25e0('0xe')]===0x1f4){logger['error']('MailTransferReport,\x20%s,\x20%s',_0x287fdd,_0x4464b7['error']['message']);return _0x2b2101(_0x4464b7[_0x25e0('0xd')][_0x25e0('0xf')]);}logger['error'](_0x25e0('0x9'),_0x287fdd,_0x4464b7['error'][_0x25e0('0xf')]);return _0x2bda31(_0x4464b7['error'][_0x25e0('0xf')]);}else{logger['info'](_0x25e0('0x9'),_0x287fdd,'request\x20sent');_0x2bda31(_0x4464b7[_0x25e0('0x10')][_0x25e0('0xf')]);}})[_0x25e0('0x11')](function(_0x4420ce){logger[_0x25e0('0xd')]('MailTransferReport,\x20%s,\x20%s',_0x287fdd,_0x4420ce);_0x2b2101(_0x4420ce);});});} \ No newline at end of file +var _0x14e4=['message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x44e4f8,_0x4af8bd){var _0x310967=function(_0x2ffe97){while(--_0x2ffe97){_0x44e4f8['push'](_0x44e4f8['shift']());}};_0x310967(++_0x4af8bd);}(_0x14e4,0x144));var _0x414e=function(_0x4d45cd,_0x144760){_0x4d45cd=_0x4d45cd-0x0;var _0x4ca0f8=_0x14e4[_0x4d45cd];return _0x4ca0f8;};'use strict';var _=require(_0x414e('0x0'));var util=require(_0x414e('0x1'));var moment=require(_0x414e('0x2'));var BPromise=require(_0x414e('0x3'));var rs=require(_0x414e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x414e('0x5'))['db'];var utils=require(_0x414e('0x6'));var logger=require(_0x414e('0x7'))(_0x414e('0x8'));var config=require('../../config/environment');var jayson=require(_0x414e('0x9'));var client=jayson[_0x414e('0xa')][_0x414e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4ca803,_0x466fac,_0x2f1da7){return new BPromise(function(_0x540f36,_0x1043a6){return client['request'](_0x4ca803,_0x2f1da7)[_0x414e('0xc')](function(_0x1e291e){logger[_0x414e('0xd')](_0x414e('0xe'),_0x466fac,_0x414e('0xf'));logger[_0x414e('0x10')](_0x414e('0x11'),_0x466fac,_0x414e('0xf'),JSON[_0x414e('0x12')](_0x1e291e));if(_0x1e291e[_0x414e('0x13')]){if(_0x1e291e[_0x414e('0x13')][_0x414e('0x14')]===0x1f4){logger['error'](_0x414e('0xe'),_0x466fac,_0x1e291e[_0x414e('0x13')][_0x414e('0x15')]);return _0x1043a6(_0x1e291e[_0x414e('0x13')][_0x414e('0x15')]);}logger[_0x414e('0x13')](_0x414e('0xe'),_0x466fac,_0x1e291e['error'][_0x414e('0x15')]);return _0x540f36(_0x1e291e[_0x414e('0x13')][_0x414e('0x15')]);}else{logger[_0x414e('0xd')]('MailTransferReport,\x20%s,\x20%s',_0x466fac,_0x414e('0xf'));_0x540f36(_0x1e291e['result']['message']);}})[_0x414e('0x16')](function(_0x3e7b64){logger[_0x414e('0x13')](_0x414e('0xe'),_0x466fac,_0x3e7b64);_0x1043a6(_0x3e7b64);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 0e9ca14..8075259 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 _0x619a=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index','/describe','describe','create','/:id','update','delete','multer','path','connect-timeout','express','Router'];(function(_0x490605,_0xccbe84){var _0x56a9b7=function(_0x56dccd){while(--_0x56dccd){_0x490605['push'](_0x490605['shift']());}};_0x56a9b7(++_0xccbe84);}(_0x619a,0x1e9));var _0xa619=function(_0x165833,_0x3f430e){_0x165833=_0x165833-0x0;var _0x2ee4ee=_0x619a[_0x165833];return _0x2ee4ee;};'use strict';var multer=require(_0xa619('0x0'));var util=require('util');var path=require(_0xa619('0x1'));var timeout=require(_0xa619('0x2'));var express=require(_0xa619('0x3'));var router=express[_0xa619('0x4')]();var fs_extra=require(_0xa619('0x5'));var auth=require(_0xa619('0x6'));var interaction=require(_0xa619('0x7'));var config=require(_0xa619('0x8'));var controller=require(_0xa619('0x9'));router[_0xa619('0xa')]('/',auth[_0xa619('0xb')](),controller[_0xa619('0xc')]);router[_0xa619('0xa')](_0xa619('0xd'),auth[_0xa619('0xb')](),controller[_0xa619('0xe')]);router[_0xa619('0xa')]('/:id',auth[_0xa619('0xb')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xa619('0xf')]);router['put'](_0xa619('0x10'),auth['isAuthenticated'](),controller[_0xa619('0x11')]);router[_0xa619('0x12')](_0xa619('0x10'),auth[_0xa619('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x02a1=['isAuthenticated','describe','/:id','post','delete','destroy','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x31a9cc,_0x243908){var _0x1e0710=function(_0x399f8b){while(--_0x399f8b){_0x31a9cc['push'](_0x31a9cc['shift']());}};_0x1e0710(++_0x243908);}(_0x02a1,0x141));var _0x102a=function(_0x13850d,_0x35e9b2){_0x13850d=_0x13850d-0x0;var _0xa73b99=_0x02a1[_0x13850d];return _0xa73b99;};'use strict';var multer=require('multer');var util=require(_0x102a('0x0'));var path=require('path');var timeout=require(_0x102a('0x1'));var express=require(_0x102a('0x2'));var router=express[_0x102a('0x3')]();var fs_extra=require(_0x102a('0x4'));var auth=require(_0x102a('0x5'));var interaction=require(_0x102a('0x6'));var config=require(_0x102a('0x7'));var controller=require('./memberReport.controller');router[_0x102a('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x102a('0x8')]('/describe',auth[_0x102a('0x9')](),controller[_0x102a('0xa')]);router['get'](_0x102a('0xb'),auth[_0x102a('0x9')](),controller['show']);router[_0x102a('0xc')]('/',auth[_0x102a('0x9')](),controller['create']);router['put'](_0x102a('0xb'),auth[_0x102a('0x9')](),controller['update']);router[_0x102a('0xd')](_0x102a('0xb'),auth['isAuthenticated'](),controller[_0x102a('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index b778a87..efca95e 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 _0x0449=['duration','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','enterAt','diff','exitAt','setDataValue'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x0449,0x1b8));var _0x9044=function(_0x497676,_0x1f8488){_0x497676=_0x497676-0x0;var _0x82cfb=_0x0449[_0x497676];return _0x82cfb;};'use strict';var Sequelize=require(_0x9044('0x0'));var moment=require('moment');module['exports']={'channel':{'type':Sequelize[_0x9044('0x1')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x9044('0x1')],'defaultValue':_0x9044('0x2'),'comment':_0x9044('0x3')},'duration':{'type':Sequelize[_0x9044('0x4')]},'enterAt':{'type':Sequelize[_0x9044('0x5')]},'exitAt':{'type':Sequelize[_0x9044('0x5')],'set':function(_0xc6e666){var _0x105dfe=moment(_0xc6e666);var _0x25e106=moment(this['getDataValue'](_0x9044('0x6')));var _0x1797e2=_0x105dfe[_0x9044('0x7')](_0x25e106,'seconds');this['setDataValue'](_0x9044('0x8'),_0xc6e666);this[_0x9044('0x9')](_0x9044('0xa'),_0x1797e2>=0x0?_0x1797e2:null);}},'data1':{'type':Sequelize['STRING'],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0x9044('0x1')],'comment':_0x9044('0xb')},'data3':{'type':Sequelize[_0x9044('0x1')],'comment':_0x9044('0xc')},'data4':{'type':Sequelize[_0x9044('0x1')],'comment':_0x9044('0xd')},'data5':{'type':Sequelize[_0x9044('0x1')],'comment':_0x9044('0xe')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0x9044('0x4')]},'uniqueid':{'type':Sequelize[_0x9044('0x1')]}}; \ No newline at end of file +var _0x0478=['talk:[dial\x20string]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','seconds','exitAt','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]'];(function(_0x25d386,_0x108d0d){var _0x857f4a=function(_0x3eb98d){while(--_0x3eb98d){_0x25d386['push'](_0x25d386['shift']());}};_0x857f4a(++_0x108d0d);}(_0x0478,0xde));var _0x8047=function(_0xf799f8,_0x9a23){_0xf799f8=_0xf799f8-0x0;var _0x17ef1b=_0x0478[_0xf799f8];return _0x17ef1b;};'use strict';var Sequelize=require(_0x8047('0x0'));var moment=require(_0x8047('0x1'));module[_0x8047('0x2')]={'channel':{'type':Sequelize[_0x8047('0x3')]},'membername':{'type':Sequelize[_0x8047('0x3')]},'interface':{'type':Sequelize[_0x8047('0x3')]},'type':{'type':Sequelize[_0x8047('0x3')],'defaultValue':_0x8047('0x4'),'comment':_0x8047('0x5')},'duration':{'type':Sequelize[_0x8047('0x6')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x8047('0x7')],'set':function(_0x1d6c29){var _0x336e45=moment(_0x1d6c29);var _0x5259ab=moment(this[_0x8047('0x8')]('enterAt'));var _0x433575=_0x336e45['diff'](_0x5259ab,_0x8047('0x9'));this['setDataValue'](_0x8047('0xa'),_0x1d6c29);this[_0x8047('0xb')](_0x8047('0xc'),_0x433575>=0x0?_0x433575:null);}},'data1':{'type':Sequelize[_0x8047('0x3')],'comment':_0x8047('0xd')},'data2':{'type':Sequelize[_0x8047('0x3')],'comment':_0x8047('0xe')},'data3':{'type':Sequelize[_0x8047('0x3')],'comment':_0x8047('0xf')},'data4':{'type':Sequelize[_0x8047('0x3')],'comment':_0x8047('0x10')},'data5':{'type':Sequelize['STRING'],'comment':'talk:[queue]'},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0x8047('0x6')]},'uniqueid':{'type':Sequelize[_0x8047('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 231fbaf..c9ccab8 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 _0x3e74=['show','params','options','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','json','undefined','limit','offset','count','status','set','Content-Range','apply','save','update','then','destroy','sendStatus','name','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows'];(function(_0x185ed2,_0xb1564a){var _0x11d850=function(_0xfecc87){while(--_0xfecc87){_0x185ed2['push'](_0x185ed2['shift']());}};_0x11d850(++_0xb1564a);}(_0x3e74,0x175));var _0x43e7=function(_0x4b3045,_0xe0f208){_0x4b3045=_0x4b3045-0x0;var _0x1bc426=_0x3e74[_0x4b3045];return _0x1bc426;};'use strict';var emlformat=require(_0x43e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43e7('0x1'));var jsonpatch=require(_0x43e7('0x2'));var rp=require(_0x43e7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x43e7('0x4'));var util=require('util');var path=require(_0x43e7('0x5'));var sox=require(_0x43e7('0x6'));var csv=require(_0x43e7('0x7'));var ejs=require(_0x43e7('0x8'));var fs=require('fs');var fs_extra=require(_0x43e7('0x9'));var _=require('lodash');var squel=require(_0x43e7('0xa'));var crypto=require(_0x43e7('0xb'));var jsforce=require(_0x43e7('0xc'));var deskjs=require(_0x43e7('0xd'));var toCsv=require(_0x43e7('0x7'));var querystring=require('querystring');var Papa=require(_0x43e7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43e7('0xf'));var as=require(_0x43e7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43e7('0x11'))('api');var utils=require(_0x43e7('0x12'));var config=require(_0x43e7('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x43e7('0x14'))['db'];function respondWithStatusCode(_0xc960ea,_0x2718d3){_0x2718d3=_0x2718d3||0xcc;return function(_0x3bb83f){if(_0x3bb83f){return _0xc960ea['sendStatus'](_0x2718d3);}return _0xc960ea['status'](_0x2718d3)[_0x43e7('0x15')]();};}function respondWithResult(_0x21fdd3,_0x44b0bd){_0x44b0bd=_0x44b0bd||0xc8;return function(_0x51b974){if(_0x51b974){return _0x21fdd3['status'](_0x44b0bd)[_0x43e7('0x16')](_0x51b974);}};}function respondWithFilteredResult(_0x14c146,_0x203378){return function(_0x328445){if(_0x328445){var _0x4de324=typeof _0x203378['offset']===_0x43e7('0x17')&&typeof _0x203378[_0x43e7('0x18')]===_0x43e7('0x17');var _0x5d346f=_0x328445['count'];var _0x446986=_0x4de324?0x0:_0x203378[_0x43e7('0x19')];var _0x9037d3=_0x4de324?_0x328445[_0x43e7('0x1a')]:_0x203378[_0x43e7('0x19')]+_0x203378[_0x43e7('0x18')];var _0x619236;if(_0x9037d3>=_0x5d346f){_0x9037d3=_0x5d346f;_0x619236=0xc8;}else{_0x619236=0xce;}_0x14c146[_0x43e7('0x1b')](_0x619236);return _0x14c146[_0x43e7('0x1c')](_0x43e7('0x1d'),_0x446986+'-'+_0x9037d3+'/'+_0x5d346f)[_0x43e7('0x16')](_0x328445);}return null;};}function patchUpdates(_0x177ee1){return function(_0x4b5d64){try{jsonpatch[_0x43e7('0x1e')](_0x4b5d64,_0x177ee1,!![]);}catch(_0x3c6625){return BPromise['reject'](_0x3c6625);}return _0x4b5d64[_0x43e7('0x1f')]();};}function saveUpdates(_0x3e281e,_0x3945bb){return function(_0x28aacc){if(_0x28aacc){return _0x28aacc[_0x43e7('0x20')](_0x3e281e)[_0x43e7('0x21')](function(_0x54a9e7){return _0x54a9e7;});}return null;};}function removeEntity(_0x454359,_0x4eea52){return function(_0x4c9df3){if(_0x4c9df3){return _0x4c9df3[_0x43e7('0x22')]()[_0x43e7('0x21')](function(){_0x454359['status'](0xcc)[_0x43e7('0x15')]();});}};}function handleEntityNotFound(_0x4ca5cf,_0x326dab){return function(_0x5c5e67){if(!_0x5c5e67){_0x4ca5cf[_0x43e7('0x23')](0x194);}return _0x5c5e67;};}function handleError(_0x1b5f50,_0x20888b){_0x20888b=_0x20888b||0x1f4;return function(_0x405f85){logger['error'](_0x405f85['stack']);if(_0x405f85[_0x43e7('0x24')]){delete _0x405f85['name'];}_0x1b5f50[_0x43e7('0x1b')](_0x20888b)[_0x43e7('0x25')](_0x405f85);};}exports[_0x43e7('0x26')]=function(_0xb1fc63,_0x5087d7){var _0x33a1a5={},_0x4690a6={},_0x45b675={'count':0x0,'rows':[]};var _0x50f9f5=_[_0x43e7('0x27')](db[_0x43e7('0x28')][_0x43e7('0x29')],function(_0x31b2a6){return{'name':_0x31b2a6[_0x43e7('0x2a')],'type':_0x31b2a6[_0x43e7('0x2b')][_0x43e7('0x2c')]};});_0x4690a6[_0x43e7('0x2d')]=_[_0x43e7('0x27')](_0x50f9f5,_0x43e7('0x24'));_0x4690a6['query']=_[_0x43e7('0x2e')](_0xb1fc63[_0x43e7('0x2f')]);_0x4690a6[_0x43e7('0x30')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],_0x4690a6['query']);_0x33a1a5[_0x43e7('0x32')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],qs[_0x43e7('0x33')](_0xb1fc63['query']['fields']));_0x33a1a5['attributes']=_0x33a1a5[_0x43e7('0x32')][_0x43e7('0x34')]?_0x33a1a5[_0x43e7('0x32')]:_0x4690a6[_0x43e7('0x2d')];if(!_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x35')]('nolimit')){_0x33a1a5['limit']=qs['limit'](_0xb1fc63['query']['limit']);_0x33a1a5['offset']=qs['offset'](_0xb1fc63[_0x43e7('0x2f')]['offset']);}_0x33a1a5[_0x43e7('0x36')]=qs[_0x43e7('0x37')](_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x37')]);_0x33a1a5[_0x43e7('0x38')]=qs[_0x43e7('0x30')](_[_0x43e7('0x39')](_0xb1fc63['query'],_0x4690a6['filters']),_0x50f9f5);if(_0xb1fc63['query'][_0x43e7('0x3a')]){_0x33a1a5[_0x43e7('0x38')]=_[_0x43e7('0x3b')](_0x33a1a5[_0x43e7('0x38')],{'$or':_[_0x43e7('0x27')](_0x50f9f5,function(_0x1ed538){if(_0x1ed538[_0x43e7('0x2b')]!==_0x43e7('0x3c')){var _0x55c798={};_0x55c798[_0x1ed538[_0x43e7('0x24')]]={'$like':'%'+_0xb1fc63[_0x43e7('0x2f')]['filter']+'%'};return _0x55c798;}})});}_0x33a1a5=_[_0x43e7('0x3b')]({},_0x33a1a5,_0xb1fc63['options']);var _0x44d8e4={'where':_0x33a1a5[_0x43e7('0x38')]};return db[_0x43e7('0x28')][_0x43e7('0x1a')](_0x44d8e4)[_0x43e7('0x21')](function(_0x234d8f){_0x45b675['count']=_0x234d8f;if(_0xb1fc63['query'][_0x43e7('0x3d')]){_0x33a1a5[_0x43e7('0x3e')]=[{'all':!![]}];}return db[_0x43e7('0x28')][_0x43e7('0x3f')](_0x33a1a5);})[_0x43e7('0x21')](function(_0x4a4a85){_0x45b675[_0x43e7('0x40')]=_0x4a4a85;return _0x45b675;})[_0x43e7('0x21')](respondWithFilteredResult(_0x5087d7,_0x33a1a5))['catch'](handleError(_0x5087d7,null));};exports[_0x43e7('0x41')]=function(_0x51a69c,_0x2ad8ef){var _0x504101={'raw':!![],'where':{'id':_0x51a69c[_0x43e7('0x42')]['id']}},_0x3d81ae={};_0x3d81ae[_0x43e7('0x2d')]=_[_0x43e7('0x2e')](db['MemberReport']['rawAttributes']);_0x3d81ae[_0x43e7('0x2f')]=_[_0x43e7('0x2e')](_0x51a69c[_0x43e7('0x2f')]);_0x3d81ae[_0x43e7('0x30')]=_['intersection'](_0x3d81ae['model'],_0x3d81ae['query']);_0x504101[_0x43e7('0x32')]=_['intersection'](_0x3d81ae[_0x43e7('0x2d')],qs['fields'](_0x51a69c['query'][_0x43e7('0x33')]));_0x504101['attributes']=_0x504101[_0x43e7('0x32')][_0x43e7('0x34')]?_0x504101[_0x43e7('0x32')]:_0x3d81ae[_0x43e7('0x2d')];if(_0x51a69c['query'][_0x43e7('0x3d')]){_0x504101[_0x43e7('0x3e')]=[{'all':!![]}];}_0x504101=_[_0x43e7('0x3b')]({},_0x504101,_0x51a69c[_0x43e7('0x43')]);return db[_0x43e7('0x28')][_0x43e7('0x44')](_0x504101)['then'](handleEntityNotFound(_0x2ad8ef,null))['then'](respondWithResult(_0x2ad8ef,null))[_0x43e7('0x45')](handleError(_0x2ad8ef,null));};exports[_0x43e7('0x46')]=function(_0x212841,_0x4c00a8){return db['MemberReport']['create'](_0x212841[_0x43e7('0x47')],{})[_0x43e7('0x21')](respondWithResult(_0x4c00a8,0xc9))['catch'](handleError(_0x4c00a8,null));};exports[_0x43e7('0x20')]=function(_0x47686e,_0x3c96fe){if(_0x47686e['body']['id']){delete _0x47686e['body']['id'];}return db['MemberReport']['find']({'where':{'id':_0x47686e[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x3c96fe,null))['then'](saveUpdates(_0x47686e[_0x43e7('0x47')],null))[_0x43e7('0x21')](respondWithResult(_0x3c96fe,null))[_0x43e7('0x45')](handleError(_0x3c96fe,null));};exports[_0x43e7('0x22')]=function(_0x4a0ce5,_0x2718d5){return db['MemberReport']['find']({'where':{'id':_0x4a0ce5[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x2718d5,null))[_0x43e7('0x21')](removeEntity(_0x2718d5,null))[_0x43e7('0x45')](handleError(_0x2718d5,null));};exports[_0x43e7('0x48')]=function(_0x2351cf,_0x1cd87c){return db[_0x43e7('0x28')][_0x43e7('0x48')]()[_0x43e7('0x21')](respondWithResult(_0x1cd87c,null))['catch'](handleError(_0x1cd87c,null));}; \ No newline at end of file +var _0xedd9=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','find','create','body','update','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','then','end','error','stack','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','name','query'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xedd9,0xfc));var _0x9edd=function(_0x572ef,_0x1c133f){_0x572ef=_0x572ef-0x0;var _0x2cfc61=_0xedd9[_0x572ef];return _0x2cfc61;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9edd('0x0'));var zipdir=require(_0x9edd('0x1'));var jsonpatch=require(_0x9edd('0x2'));var rp=require(_0x9edd('0x3'));var moment=require(_0x9edd('0x4'));var BPromise=require(_0x9edd('0x5'));var Mustache=require(_0x9edd('0x6'));var util=require(_0x9edd('0x7'));var path=require('path');var sox=require(_0x9edd('0x8'));var csv=require(_0x9edd('0x9'));var ejs=require(_0x9edd('0xa'));var fs=require('fs');var fs_extra=require(_0x9edd('0xb'));var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0x9'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var licenseUtil=require(_0x9edd('0x16'));var db=require(_0x9edd('0x17'))['db'];function respondWithStatusCode(_0xfd544a,_0x287ddd){_0x287ddd=_0x287ddd||0xcc;return function(_0x3a7b84){if(_0x3a7b84){return _0xfd544a[_0x9edd('0x18')](_0x287ddd);}return _0xfd544a[_0x9edd('0x19')](_0x287ddd)['end']();};}function respondWithResult(_0x176bfa,_0x44fc7c){_0x44fc7c=_0x44fc7c||0xc8;return function(_0x891832){if(_0x891832){return _0x176bfa[_0x9edd('0x19')](_0x44fc7c)[_0x9edd('0x1a')](_0x891832);}};}function respondWithFilteredResult(_0x338f3c,_0x1042aa){return function(_0x75a4ab){if(_0x75a4ab){var _0x4ea60f=typeof _0x1042aa[_0x9edd('0x1b')]===_0x9edd('0x1c')&&typeof _0x1042aa[_0x9edd('0x1d')]==='undefined';var _0x1b54c0=_0x75a4ab[_0x9edd('0x1e')];var _0x40ba32=_0x4ea60f?0x0:_0x1042aa['offset'];var _0x43dc70=_0x4ea60f?_0x75a4ab['count']:_0x1042aa[_0x9edd('0x1b')]+_0x1042aa[_0x9edd('0x1d')];var _0x4bdb88;if(_0x43dc70>=_0x1b54c0){_0x43dc70=_0x1b54c0;_0x4bdb88=0xc8;}else{_0x4bdb88=0xce;}_0x338f3c['status'](_0x4bdb88);return _0x338f3c[_0x9edd('0x1f')]('Content-Range',_0x40ba32+'-'+_0x43dc70+'/'+_0x1b54c0)[_0x9edd('0x1a')](_0x75a4ab);}return null;};}function patchUpdates(_0x54a03f){return function(_0x535f37){try{jsonpatch[_0x9edd('0x20')](_0x535f37,_0x54a03f,!![]);}catch(_0x1c46a8){return BPromise['reject'](_0x1c46a8);}return _0x535f37['save']();};}function saveUpdates(_0x341d67,_0x186186){return function(_0x477878){if(_0x477878){return _0x477878['update'](_0x341d67)[_0x9edd('0x21')](function(_0x1dca43){return _0x1dca43;});}return null;};}function removeEntity(_0x44a6c1,_0x2ca65f){return function(_0x339a0d){if(_0x339a0d){return _0x339a0d['destroy']()[_0x9edd('0x21')](function(){_0x44a6c1[_0x9edd('0x19')](0xcc)[_0x9edd('0x22')]();});}};}function handleEntityNotFound(_0x2f9f86,_0x310a4d){return function(_0x4d507f){if(!_0x4d507f){_0x2f9f86['sendStatus'](0x194);}return _0x4d507f;};}function handleError(_0x3276ee,_0xfeca7b){_0xfeca7b=_0xfeca7b||0x1f4;return function(_0x8d67aa){logger[_0x9edd('0x23')](_0x8d67aa[_0x9edd('0x24')]);if(_0x8d67aa['name']){delete _0x8d67aa['name'];}_0x3276ee[_0x9edd('0x19')](_0xfeca7b)[_0x9edd('0x25')](_0x8d67aa);};}exports[_0x9edd('0x26')]=function(_0x52746a,_0x238b22){var _0x28cfae={},_0x2ae8dd={},_0x41af53={'count':0x0,'rows':[]};var _0x5eccfb=_[_0x9edd('0x27')](db[_0x9edd('0x28')][_0x9edd('0x29')],function(_0x12c1bc){return{'name':_0x12c1bc[_0x9edd('0x2a')],'type':_0x12c1bc[_0x9edd('0x2b')][_0x9edd('0x2c')]};});_0x2ae8dd[_0x9edd('0x2d')]=_[_0x9edd('0x27')](_0x5eccfb,_0x9edd('0x2e'));_0x2ae8dd[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x52746a[_0x9edd('0x2f')]);_0x2ae8dd[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],_0x2ae8dd[_0x9edd('0x2f')]);_0x28cfae[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],qs[_0x9edd('0x34')](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x28cfae[_0x9edd('0x33')]=_0x28cfae[_0x9edd('0x33')][_0x9edd('0x35')]?_0x28cfae[_0x9edd('0x33')]:_0x2ae8dd[_0x9edd('0x2d')];if(!_0x52746a[_0x9edd('0x2f')][_0x9edd('0x36')](_0x9edd('0x37'))){_0x28cfae[_0x9edd('0x1d')]=qs[_0x9edd('0x1d')](_0x52746a[_0x9edd('0x2f')]['limit']);_0x28cfae[_0x9edd('0x1b')]=qs['offset'](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x1b')]);}_0x28cfae[_0x9edd('0x38')]=qs[_0x9edd('0x39')](_0x52746a[_0x9edd('0x2f')]['sort']);_0x28cfae[_0x9edd('0x3a')]=qs[_0x9edd('0x31')](_[_0x9edd('0x3b')](_0x52746a[_0x9edd('0x2f')],_0x2ae8dd[_0x9edd('0x31')]),_0x5eccfb);if(_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]){_0x28cfae[_0x9edd('0x3a')]=_[_0x9edd('0x3d')](_0x28cfae[_0x9edd('0x3a')],{'$or':_['map'](_0x5eccfb,function(_0x231604){if(_0x231604['type']!==_0x9edd('0x3e')){var _0x5658d6={};_0x5658d6[_0x231604[_0x9edd('0x2e')]]={'$like':'%'+_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]+'%'};return _0x5658d6;}})});}_0x28cfae=_['merge']({},_0x28cfae,_0x52746a[_0x9edd('0x3f')]);var _0xcbd0ef={'where':_0x28cfae[_0x9edd('0x3a')]};return db['MemberReport'][_0x9edd('0x1e')](_0xcbd0ef)['then'](function(_0x1fc4fb){_0x41af53[_0x9edd('0x1e')]=_0x1fc4fb;if(_0x52746a['query'][_0x9edd('0x40')]){_0x28cfae[_0x9edd('0x41')]=[{'all':!![]}];}return db[_0x9edd('0x28')][_0x9edd('0x42')](_0x28cfae);})['then'](function(_0x449f01){_0x41af53['rows']=_0x449f01;return _0x41af53;})[_0x9edd('0x21')](respondWithFilteredResult(_0x238b22,_0x28cfae))[_0x9edd('0x43')](handleError(_0x238b22,null));};exports['show']=function(_0x318757,_0x49a128){var _0x548299={'raw':!![],'where':{'id':_0x318757[_0x9edd('0x44')]['id']}},_0x369b69={};_0x369b69[_0x9edd('0x2d')]=_[_0x9edd('0x30')](db[_0x9edd('0x28')][_0x9edd('0x29')]);_0x369b69[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x318757[_0x9edd('0x2f')]);_0x369b69[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x369b69[_0x9edd('0x2d')],_0x369b69[_0x9edd('0x2f')]);_0x548299[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x369b69['model'],qs[_0x9edd('0x34')](_0x318757[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x548299[_0x9edd('0x33')]=_0x548299[_0x9edd('0x33')][_0x9edd('0x35')]?_0x548299[_0x9edd('0x33')]:_0x369b69['model'];if(_0x318757['query']['includeAll']){_0x548299[_0x9edd('0x41')]=[{'all':!![]}];}_0x548299=_['merge']({},_0x548299,_0x318757[_0x9edd('0x3f')]);return db[_0x9edd('0x28')][_0x9edd('0x45')](_0x548299)[_0x9edd('0x21')](handleEntityNotFound(_0x49a128,null))[_0x9edd('0x21')](respondWithResult(_0x49a128,null))['catch'](handleError(_0x49a128,null));};exports[_0x9edd('0x46')]=function(_0x35e63c,_0x40e33d){return db['MemberReport'][_0x9edd('0x46')](_0x35e63c[_0x9edd('0x47')],{})[_0x9edd('0x21')](respondWithResult(_0x40e33d,0xc9))[_0x9edd('0x43')](handleError(_0x40e33d,null));};exports[_0x9edd('0x48')]=function(_0x35bdec,_0x4d4f33){if(_0x35bdec[_0x9edd('0x47')]['id']){delete _0x35bdec[_0x9edd('0x47')]['id'];}return db['MemberReport'][_0x9edd('0x45')]({'where':{'id':_0x35bdec[_0x9edd('0x44')]['id']}})['then'](handleEntityNotFound(_0x4d4f33,null))[_0x9edd('0x21')](saveUpdates(_0x35bdec[_0x9edd('0x47')],null))[_0x9edd('0x21')](respondWithResult(_0x4d4f33,null))['catch'](handleError(_0x4d4f33,null));};exports[_0x9edd('0x49')]=function(_0x151157,_0x317a60){return db[_0x9edd('0x28')]['find']({'where':{'id':_0x151157[_0x9edd('0x44')]['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x317a60,null))[_0x9edd('0x21')](removeEntity(_0x317a60,null))['catch'](handleError(_0x317a60,null));};exports[_0x9edd('0x4a')]=function(_0x21f6ce,_0x57db43){return db[_0x9edd('0x28')]['describe']()[_0x9edd('0x21')](respondWithResult(_0x57db43,null))[_0x9edd('0x43')](handleError(_0x57db43,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index bbf7d15..b927cb5 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 _0xb3fd=['api','bluebird','request-promise','path','rimraf','../../config/environment','exports','MemberReport','report_member','membername_interface','interface','util','../../config/logger'];(function(_0x203d64,_0x1ec79c){var _0x462ab3=function(_0x55ee6e){while(--_0x55ee6e){_0x203d64['push'](_0x203d64['shift']());}};_0x462ab3(++_0x1ec79c);}(_0xb3fd,0xdb));var _0xdb3f=function(_0x565b5f,_0x187173){_0x565b5f=_0x565b5f-0x0;var _0x263f22=_0xb3fd[_0x565b5f];return _0x263f22;};'use strict';var _=require('lodash');var util=require(_0xdb3f('0x0'));var logger=require(_0xdb3f('0x1'))(_0xdb3f('0x2'));var moment=require('moment');var BPromise=require(_0xdb3f('0x3'));var rp=require(_0xdb3f('0x4'));var fs=require('fs');var path=require(_0xdb3f('0x5'));var rimraf=require(_0xdb3f('0x6'));var config=require(_0xdb3f('0x7'));var attributes=require('./memberReport.attributes');module[_0xdb3f('0x8')]=function(_0x317d72,_0x615643){return _0x317d72['define'](_0xdb3f('0x9'),attributes,{'tableName':_0xdb3f('0xa'),'paranoid':![],'indexes':[{'name':_0xdb3f('0xb'),'fields':['membername',_0xdb3f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7182=['util','../../config/logger','bluebird','path','rimraf','../../config/environment','./memberReport.attributes','define','MemberReport','report_member','membername_interface','membername','interface','lodash'];(function(_0x1eb3f9,_0x4506ef){var _0xe5ede3=function(_0x5e53cf){while(--_0x5e53cf){_0x1eb3f9['push'](_0x1eb3f9['shift']());}};_0xe5ede3(++_0x4506ef);}(_0x7182,0x187));var _0x2718=function(_0x1ae82a,_0x2762d2){_0x1ae82a=_0x1ae82a-0x0;var _0x28f810=_0x7182[_0x1ae82a];return _0x28f810;};'use strict';var _=require(_0x2718('0x0'));var util=require(_0x2718('0x1'));var logger=require(_0x2718('0x2'))('api');var moment=require('moment');var BPromise=require(_0x2718('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2718('0x4'));var rimraf=require(_0x2718('0x5'));var config=require(_0x2718('0x6'));var attributes=require(_0x2718('0x7'));module['exports']=function(_0x19e98f,_0x1e7303){return _0x19e98f[_0x2718('0x8')](_0x2718('0x9'),attributes,{'tableName':_0x2718('0xa'),'paranoid':![],'indexes':[{'name':_0x2718('0xb'),'fields':[_0x2718('0xc'),_0x2718('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index f5c7334..913f893 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 _0xd046=['util','moment','bluebird','ioredis','../../config/logger','../../config/environment','http','MemberReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','GetMemberReport','MemberReport','findAll','options','raw','where','attributes','limit','map','include','model','then','debug','create','body','CreateMemberReport','UpdateMemberReport','update'];(function(_0x188cd9,_0x43fd57){var _0x57f41a=function(_0xee0963){while(--_0xee0963){_0x188cd9['push'](_0x188cd9['shift']());}};_0x57f41a(++_0x43fd57);}(_0xd046,0x129));var _0x6d04=function(_0x597931,_0x8112e0){_0x597931=_0x597931-0x0;var _0x14e151=_0xd046[_0x597931];return _0x14e151;};'use strict';var _=require('lodash');var util=require(_0x6d04('0x0'));var moment=require(_0x6d04('0x1'));var BPromise=require(_0x6d04('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d04('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6d04('0x4'))('rpc');var config=require(_0x6d04('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6d04('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1968c4,_0x4f83bc,_0x569c7b){return new BPromise(function(_0x2e2c01,_0x42aa22){return client['request'](_0x1968c4,_0x569c7b)['then'](function(_0x27a3d6){logger['info'](_0x6d04('0x7'),_0x4f83bc,'request\x20sent');logger['debug']('MemberReport,\x20%s,\x20%s,\x20%s',_0x4f83bc,_0x6d04('0x8'),JSON[_0x6d04('0x9')](_0x27a3d6));if(_0x27a3d6[_0x6d04('0xa')]){if(_0x27a3d6[_0x6d04('0xa')]['code']===0x1f4){logger[_0x6d04('0xa')](_0x6d04('0x7'),_0x4f83bc,_0x27a3d6[_0x6d04('0xa')][_0x6d04('0xb')]);return _0x42aa22(_0x27a3d6[_0x6d04('0xa')][_0x6d04('0xb')]);}logger[_0x6d04('0xa')](_0x6d04('0x7'),_0x4f83bc,_0x27a3d6[_0x6d04('0xa')][_0x6d04('0xb')]);return _0x2e2c01(_0x27a3d6[_0x6d04('0xa')][_0x6d04('0xb')]);}else{logger[_0x6d04('0xc')](_0x6d04('0x7'),_0x4f83bc,_0x6d04('0x8'));_0x2e2c01(_0x27a3d6[_0x6d04('0xd')][_0x6d04('0xb')]);}})[_0x6d04('0xe')](function(_0xed5538){logger[_0x6d04('0xa')](_0x6d04('0x7'),_0x4f83bc,_0xed5538);_0x42aa22(_0xed5538);});});}exports[_0x6d04('0xf')]=function(_0x2bc798){var _0x3ad325=this;return new Promise(function(_0x4e93b5,_0x3657a1){return db[_0x6d04('0x10')][_0x6d04('0x11')]({'raw':_0x2bc798[_0x6d04('0x12')]?_0x2bc798[_0x6d04('0x12')][_0x6d04('0x13')]===undefined?!![]:![]:!![],'where':_0x2bc798[_0x6d04('0x12')]?_0x2bc798[_0x6d04('0x12')][_0x6d04('0x14')]||null:null,'attributes':_0x2bc798[_0x6d04('0x12')]?_0x2bc798[_0x6d04('0x12')][_0x6d04('0x15')]||null:null,'limit':_0x2bc798[_0x6d04('0x12')]?_0x2bc798['options'][_0x6d04('0x16')]||null:null,'include':_0x2bc798[_0x6d04('0x12')]?_0x2bc798['options']['include']?_[_0x6d04('0x17')](_0x2bc798[_0x6d04('0x12')][_0x6d04('0x18')],function(_0xe8f198){return{'model':db[_0xe8f198[_0x6d04('0x19')]],'as':_0xe8f198['as'],'attributes':_0xe8f198[_0x6d04('0x15')],'include':_0xe8f198[_0x6d04('0x18')]?_[_0x6d04('0x17')](_0xe8f198[_0x6d04('0x18')],function(_0x38e90f){return{'model':db[_0x38e90f[_0x6d04('0x19')]],'as':_0x38e90f['as'],'attributes':_0x38e90f[_0x6d04('0x15')],'include':_0x38e90f[_0x6d04('0x18')]?_[_0x6d04('0x17')](_0x38e90f['include'],function(_0x1dc29b){return{'model':db[_0x1dc29b[_0x6d04('0x19')]],'as':_0x1dc29b['as'],'attributes':_0x1dc29b[_0x6d04('0x15')]};}):[]};}):[]};}):[]:[]})[_0x6d04('0x1a')](function(_0x4256a3){logger[_0x6d04('0xc')]('GetMemberReport',_0x2bc798);logger[_0x6d04('0x1b')](_0x6d04('0xf'),_0x2bc798,JSON[_0x6d04('0x9')](_0x4256a3));_0x4e93b5(_0x4256a3);})[_0x6d04('0xe')](function(_0x2ed2bb){logger['error']('GetMemberReport',_0x2ed2bb['message'],_0x2bc798);_0x3657a1(_0x3ad325['error'](0x1f4,_0x2ed2bb[_0x6d04('0xb')]));});});};exports['CreateMemberReport']=function(_0x43eb48){var _0x4ed123=this;return new Promise(function(_0x26be38,_0xee1291){return db[_0x6d04('0x10')][_0x6d04('0x1c')](_0x43eb48[_0x6d04('0x1d')],{'raw':_0x43eb48[_0x6d04('0x12')]?_0x43eb48[_0x6d04('0x12')][_0x6d04('0x13')]===undefined?!![]:![]:!![]})[_0x6d04('0x1a')](function(_0xff4c36){logger['info']('CreateMemberReport',_0x43eb48);logger[_0x6d04('0x1b')](_0x6d04('0x1e'),_0x43eb48,JSON[_0x6d04('0x9')](_0xff4c36));_0x26be38(_0xff4c36);})[_0x6d04('0xe')](function(_0x592f01){logger[_0x6d04('0xa')](_0x6d04('0x1e'),_0x592f01[_0x6d04('0xb')],_0x43eb48);_0xee1291(_0x4ed123[_0x6d04('0xa')](0x1f4,_0x592f01['message']));});});};exports[_0x6d04('0x1f')]=function(_0x1d86d2){var _0x1e03a4=this;return new Promise(function(_0x184da2,_0x2f59ef){return db[_0x6d04('0x10')][_0x6d04('0x20')](_0x1d86d2[_0x6d04('0x1d')],{'raw':_0x1d86d2[_0x6d04('0x12')]?_0x1d86d2[_0x6d04('0x12')][_0x6d04('0x13')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d86d2[_0x6d04('0x12')]?_0x1d86d2[_0x6d04('0x12')][_0x6d04('0x14')]||null:null,'attributes':_0x1d86d2[_0x6d04('0x12')]?_0x1d86d2['options'][_0x6d04('0x15')]||null:null,'limit':_0x1d86d2['options']?_0x1d86d2[_0x6d04('0x12')][_0x6d04('0x16')]||null:null})['then'](function(_0x39991b){logger[_0x6d04('0xc')](_0x6d04('0x1f'),_0x1d86d2);logger[_0x6d04('0x1b')](_0x6d04('0x1f'),_0x1d86d2,JSON[_0x6d04('0x9')](_0x39991b));_0x184da2(_0x39991b);})[_0x6d04('0xe')](function(_0x1246a7){logger['error'](_0x6d04('0x1f'),_0x1246a7[_0x6d04('0xb')],_0x1d86d2);_0x2f59ef(_0x1e03a4[_0x6d04('0xa')](0x1f4,_0x1246a7[_0x6d04('0xb')]));});});}; \ No newline at end of file +var _0x4cff=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','MemberReport,\x20%s,\x20%s','debug','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','message','error','result','catch','MemberReport','options','raw','attributes','limit','include','map','model','GetMemberReport','CreateMemberReport','create','body','update','UpdateMemberReport','lodash','util','bluebird'];(function(_0x3f83db,_0x4606c2){var _0x55e771=function(_0x4600b1){while(--_0x4600b1){_0x3f83db['push'](_0x3f83db['shift']());}};_0x55e771(++_0x4606c2);}(_0x4cff,0x14a));var _0xf4cf=function(_0x35cbd3,_0x3cace9){_0x35cbd3=_0x35cbd3-0x0;var _0xdfd3f7=_0x4cff[_0x35cbd3];return _0xdfd3f7;};'use strict';var _=require(_0xf4cf('0x0'));var util=require(_0xf4cf('0x1'));var moment=require('moment');var BPromise=require(_0xf4cf('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf4cf('0x3'));var db=require(_0xf4cf('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf4cf('0x5'))(_0xf4cf('0x6'));var config=require(_0xf4cf('0x7'));var jayson=require(_0xf4cf('0x8'));var client=jayson[_0xf4cf('0x9')][_0xf4cf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x53a3e6,_0x25d0cf,_0x125a37){return new BPromise(function(_0x1f06c6,_0x3882b2){return client['request'](_0x53a3e6,_0x125a37)[_0xf4cf('0xb')](function(_0x36b238){logger[_0xf4cf('0xc')](_0xf4cf('0xd'),_0x25d0cf,'request\x20sent');logger[_0xf4cf('0xe')](_0xf4cf('0xf'),_0x25d0cf,_0xf4cf('0x10'),JSON[_0xf4cf('0x11')](_0x36b238));if(_0x36b238['error']){if(_0x36b238['error'][_0xf4cf('0x12')]===0x1f4){logger['error']('MemberReport,\x20%s,\x20%s',_0x25d0cf,_0x36b238['error'][_0xf4cf('0x13')]);return _0x3882b2(_0x36b238[_0xf4cf('0x14')][_0xf4cf('0x13')]);}logger[_0xf4cf('0x14')](_0xf4cf('0xd'),_0x25d0cf,_0x36b238[_0xf4cf('0x14')][_0xf4cf('0x13')]);return _0x1f06c6(_0x36b238[_0xf4cf('0x14')][_0xf4cf('0x13')]);}else{logger[_0xf4cf('0xc')]('MemberReport,\x20%s,\x20%s',_0x25d0cf,_0xf4cf('0x10'));_0x1f06c6(_0x36b238[_0xf4cf('0x15')][_0xf4cf('0x13')]);}})[_0xf4cf('0x16')](function(_0x5260aa){logger[_0xf4cf('0x14')](_0xf4cf('0xd'),_0x25d0cf,_0x5260aa);_0x3882b2(_0x5260aa);});});}exports['GetMemberReport']=function(_0x3999e7){var _0x2aa048=this;return new Promise(function(_0x329347,_0x5469e2){return db[_0xf4cf('0x17')]['findAll']({'raw':_0x3999e7[_0xf4cf('0x18')]?_0x3999e7['options'][_0xf4cf('0x19')]===undefined?!![]:![]:!![],'where':_0x3999e7['options']?_0x3999e7['options']['where']||null:null,'attributes':_0x3999e7[_0xf4cf('0x18')]?_0x3999e7[_0xf4cf('0x18')][_0xf4cf('0x1a')]||null:null,'limit':_0x3999e7[_0xf4cf('0x18')]?_0x3999e7[_0xf4cf('0x18')][_0xf4cf('0x1b')]||null:null,'include':_0x3999e7[_0xf4cf('0x18')]?_0x3999e7['options'][_0xf4cf('0x1c')]?_[_0xf4cf('0x1d')](_0x3999e7[_0xf4cf('0x18')][_0xf4cf('0x1c')],function(_0xba64fe){return{'model':db[_0xba64fe[_0xf4cf('0x1e')]],'as':_0xba64fe['as'],'attributes':_0xba64fe['attributes'],'include':_0xba64fe[_0xf4cf('0x1c')]?_[_0xf4cf('0x1d')](_0xba64fe['include'],function(_0x1d26b0){return{'model':db[_0x1d26b0['model']],'as':_0x1d26b0['as'],'attributes':_0x1d26b0['attributes'],'include':_0x1d26b0[_0xf4cf('0x1c')]?_[_0xf4cf('0x1d')](_0x1d26b0['include'],function(_0x230a18){return{'model':db[_0x230a18['model']],'as':_0x230a18['as'],'attributes':_0x230a18[_0xf4cf('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xf4cf('0xb')](function(_0x97e3e4){logger['info']('GetMemberReport',_0x3999e7);logger[_0xf4cf('0xe')](_0xf4cf('0x1f'),_0x3999e7,JSON[_0xf4cf('0x11')](_0x97e3e4));_0x329347(_0x97e3e4);})[_0xf4cf('0x16')](function(_0x164ee8){logger[_0xf4cf('0x14')](_0xf4cf('0x1f'),_0x164ee8['message'],_0x3999e7);_0x5469e2(_0x2aa048[_0xf4cf('0x14')](0x1f4,_0x164ee8[_0xf4cf('0x13')]));});});};exports[_0xf4cf('0x20')]=function(_0x471a0f){var _0x33b5c2=this;return new Promise(function(_0x47de20,_0x5d1dc0){return db[_0xf4cf('0x17')][_0xf4cf('0x21')](_0x471a0f[_0xf4cf('0x22')],{'raw':_0x471a0f[_0xf4cf('0x18')]?_0x471a0f[_0xf4cf('0x18')][_0xf4cf('0x19')]===undefined?!![]:![]:!![]})[_0xf4cf('0xb')](function(_0xe3524d){logger[_0xf4cf('0xc')]('CreateMemberReport',_0x471a0f);logger['debug'](_0xf4cf('0x20'),_0x471a0f,JSON[_0xf4cf('0x11')](_0xe3524d));_0x47de20(_0xe3524d);})[_0xf4cf('0x16')](function(_0x23ca65){logger[_0xf4cf('0x14')]('CreateMemberReport',_0x23ca65[_0xf4cf('0x13')],_0x471a0f);_0x5d1dc0(_0x33b5c2['error'](0x1f4,_0x23ca65[_0xf4cf('0x13')]));});});};exports['UpdateMemberReport']=function(_0x2ef5fe){var _0x22de0d=this;return new Promise(function(_0x28b524,_0x4590ec){return db['MemberReport'][_0xf4cf('0x23')](_0x2ef5fe['body'],{'raw':_0x2ef5fe[_0xf4cf('0x18')]?_0x2ef5fe['options'][_0xf4cf('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ef5fe[_0xf4cf('0x18')]?_0x2ef5fe['options']['where']||null:null,'attributes':_0x2ef5fe[_0xf4cf('0x18')]?_0x2ef5fe[_0xf4cf('0x18')]['attributes']||null:null,'limit':_0x2ef5fe[_0xf4cf('0x18')]?_0x2ef5fe[_0xf4cf('0x18')]['limit']||null:null})['then'](function(_0x33fe63){logger['info'](_0xf4cf('0x24'),_0x2ef5fe);logger[_0xf4cf('0xe')](_0xf4cf('0x24'),_0x2ef5fe,JSON[_0xf4cf('0x11')](_0x33fe63));_0x28b524(_0x33fe63);})[_0xf4cf('0x16')](function(_0xbf80dc){logger[_0xf4cf('0x14')](_0xf4cf('0x24'),_0xbf80dc[_0xf4cf('0x13')],_0x2ef5fe);_0x4590ec(_0x22de0d[_0xf4cf('0x14')](0x1f4,_0xbf80dc[_0xf4cf('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index cb3eb91..8a043ae 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 _0x0795=['../../config/environment','./migration.controller','index','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x35c4ab,_0x236cf3){var _0x18308f=function(_0x4fce24){while(--_0x4fce24){_0x35c4ab['push'](_0x35c4ab['shift']());}};_0x18308f(++_0x236cf3);}(_0x0795,0x14e));var _0x5079=function(_0x39719c,_0x1404a8){_0x39719c=_0x39719c-0x0;var _0x4893f3=_0x0795[_0x39719c];return _0x4893f3;};'use strict';var multer=require(_0x5079('0x0'));var util=require(_0x5079('0x1'));var path=require(_0x5079('0x2'));var timeout=require(_0x5079('0x3'));var express=require('express');var router=express[_0x5079('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5079('0x5'));var interaction=require(_0x5079('0x6'));var config=require(_0x5079('0x7'));var controller=require(_0x5079('0x8'));router['get']('/',controller[_0x5079('0x9')]);module[_0x5079('0xa')]=router; \ No newline at end of file +var _0xa7ee=['util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./migration.controller','get','index','exports','multer'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xa7ee,0x167));var _0xea7e=function(_0x5e6fe1,_0x8f80ad){_0x5e6fe1=_0x5e6fe1-0x0;var _0x5a6018=_0xa7ee[_0x5e6fe1];return _0x5a6018;};'use strict';var multer=require(_0xea7e('0x0'));var util=require(_0xea7e('0x1'));var path=require(_0xea7e('0x2'));var timeout=require(_0xea7e('0x3'));var express=require('express');var router=express[_0xea7e('0x4')]();var fs_extra=require(_0xea7e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xea7e('0x6'));var config=require(_0xea7e('0x7'));var controller=require(_0xea7e('0x8'));router[_0xea7e('0x9')]('/',controller[_0xea7e('0xa')]);module[_0xea7e('0xb')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 4c158d0..f4b6f66 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 _0x02e4=['version','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x02e4,0x89));var _0x402e=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x02e4[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require('sequelize');module[_0x402e('0x0')]={'version':{'type':Sequelize['STRING'],'unique':_0x402e('0x1')}}; \ No newline at end of file +var _0x31b4=['STRING','version','sequelize'];(function(_0x1298ed,_0x39ba63){var _0x56b532=function(_0x46e1eb){while(--_0x46e1eb){_0x1298ed['push'](_0x1298ed['shift']());}};_0x56b532(++_0x39ba63);}(_0x31b4,0x17c));var _0x431b=function(_0x18016c,_0x30943c){_0x18016c=_0x18016c-0x0;var _0x11d63a=_0x31b4[_0x18016c];return _0x11d63a;};'use strict';var Sequelize=require(_0x431b('0x0'));module['exports']={'version':{'type':Sequelize[_0x431b('0x1')],'unique':_0x431b('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 25817a9..6dc0f1f 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 _0xff7b=['undefined','limit','count','set','apply','reject','update','then','destroy','end','error','stack','name','index','map','rawAttributes','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','type','VIRTUAL','merge','options','Migration','include','rows','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xff7b,0xe8));var _0xbff7=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xff7b[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require(_0xbff7('0x0'));var rimraf=require(_0xbff7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbff7('0x2'));var rp=require(_0xbff7('0x3'));var moment=require('moment');var BPromise=require(_0xbff7('0x4'));var Mustache=require(_0xbff7('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbff7('0x6'));var fs=require('fs');var fs_extra=require(_0xbff7('0x7'));var _=require('lodash');var squel=require(_0xbff7('0x8'));var crypto=require(_0xbff7('0x9'));var jsforce=require(_0xbff7('0xa'));var deskjs=require(_0xbff7('0xb'));var toCsv=require(_0xbff7('0xc'));var querystring=require(_0xbff7('0xd'));var Papa=require(_0xbff7('0xe'));var Redis=require(_0xbff7('0xf'));var authService=require(_0xbff7('0x10'));var qs=require(_0xbff7('0x11'));var as=require(_0xbff7('0x12'));var hardwareService=require(_0xbff7('0x13'));var logger=require(_0xbff7('0x14'))('api');var utils=require(_0xbff7('0x15'));var config=require(_0xbff7('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xbff7('0x17'))['db'];function respondWithStatusCode(_0x543c58,_0x26f0d2){_0x26f0d2=_0x26f0d2||0xcc;return function(_0x94bcfa){if(_0x94bcfa){return _0x543c58[_0xbff7('0x18')](_0x26f0d2);}return _0x543c58[_0xbff7('0x19')](_0x26f0d2)['end']();};}function respondWithResult(_0x2df80b,_0x531b96){_0x531b96=_0x531b96||0xc8;return function(_0x1d1145){if(_0x1d1145){return _0x2df80b['status'](_0x531b96)[_0xbff7('0x1a')](_0x1d1145);}};}function respondWithFilteredResult(_0x71be25,_0x4b8b9b){return function(_0x3a3951){if(_0x3a3951){var _0x4d46fa=typeof _0x4b8b9b[_0xbff7('0x1b')]===_0xbff7('0x1c')&&typeof _0x4b8b9b[_0xbff7('0x1d')]===_0xbff7('0x1c');var _0x10618c=_0x3a3951[_0xbff7('0x1e')];var _0x2b4a85=_0x4d46fa?0x0:_0x4b8b9b[_0xbff7('0x1b')];var _0x165a86=_0x4d46fa?_0x3a3951[_0xbff7('0x1e')]:_0x4b8b9b[_0xbff7('0x1b')]+_0x4b8b9b[_0xbff7('0x1d')];var _0x1aecb6;if(_0x165a86>=_0x10618c){_0x165a86=_0x10618c;_0x1aecb6=0xc8;}else{_0x1aecb6=0xce;}_0x71be25[_0xbff7('0x19')](_0x1aecb6);return _0x71be25[_0xbff7('0x1f')]('Content-Range',_0x2b4a85+'-'+_0x165a86+'/'+_0x10618c)['json'](_0x3a3951);}return null;};}function patchUpdates(_0x1a18fb){return function(_0x20e97a){try{jsonpatch[_0xbff7('0x20')](_0x20e97a,_0x1a18fb,!![]);}catch(_0x37bdb6){return BPromise[_0xbff7('0x21')](_0x37bdb6);}return _0x20e97a['save']();};}function saveUpdates(_0x5b7159,_0x12caef){return function(_0x5461f9){if(_0x5461f9){return _0x5461f9[_0xbff7('0x22')](_0x5b7159)[_0xbff7('0x23')](function(_0x4592ee){return _0x4592ee;});}return null;};}function removeEntity(_0x4966f8,_0x5c58a4){return function(_0x339eac){if(_0x339eac){return _0x339eac[_0xbff7('0x24')]()[_0xbff7('0x23')](function(){_0x4966f8[_0xbff7('0x19')](0xcc)[_0xbff7('0x25')]();});}};}function handleEntityNotFound(_0x556978,_0x3381f7){return function(_0x2fdee8){if(!_0x2fdee8){_0x556978[_0xbff7('0x18')](0x194);}return _0x2fdee8;};}function handleError(_0x4ae781,_0x23966f){_0x23966f=_0x23966f||0x1f4;return function(_0x59595e){logger[_0xbff7('0x26')](_0x59595e[_0xbff7('0x27')]);if(_0x59595e[_0xbff7('0x28')]){delete _0x59595e['name'];}_0x4ae781[_0xbff7('0x19')](_0x23966f)['send'](_0x59595e);};}exports[_0xbff7('0x29')]=function(_0x10e074,_0x13cd7d){var _0x292851={},_0x1025d8={},_0x5cb9a7={'count':0x0,'rows':[]};var _0x53447b=_[_0xbff7('0x2a')](db['Migration'][_0xbff7('0x2b')],function(_0x15ea87){return{'name':_0x15ea87['fieldName'],'type':_0x15ea87['type']['key']};});_0x1025d8[_0xbff7('0x2c')]=_[_0xbff7('0x2a')](_0x53447b,_0xbff7('0x28'));_0x1025d8[_0xbff7('0x2d')]=_[_0xbff7('0x2e')](_0x10e074[_0xbff7('0x2d')]);_0x1025d8[_0xbff7('0x2f')]=_['intersection'](_0x1025d8[_0xbff7('0x2c')],_0x1025d8[_0xbff7('0x2d')]);_0x292851[_0xbff7('0x30')]=_[_0xbff7('0x31')](_0x1025d8[_0xbff7('0x2c')],qs['fields'](_0x10e074[_0xbff7('0x2d')][_0xbff7('0x32')]));_0x292851[_0xbff7('0x30')]=_0x292851[_0xbff7('0x30')][_0xbff7('0x33')]?_0x292851[_0xbff7('0x30')]:_0x1025d8[_0xbff7('0x2c')];if(!_0x10e074[_0xbff7('0x2d')][_0xbff7('0x34')](_0xbff7('0x35'))){_0x292851[_0xbff7('0x1d')]=qs[_0xbff7('0x1d')](_0x10e074[_0xbff7('0x2d')]['limit']);_0x292851[_0xbff7('0x1b')]=qs[_0xbff7('0x1b')](_0x10e074[_0xbff7('0x2d')][_0xbff7('0x1b')]);}_0x292851['order']=qs[_0xbff7('0x36')](_0x10e074[_0xbff7('0x2d')][_0xbff7('0x36')]);_0x292851[_0xbff7('0x37')]=qs['filters'](_[_0xbff7('0x38')](_0x10e074[_0xbff7('0x2d')],_0x1025d8[_0xbff7('0x2f')]),_0x53447b);if(_0x10e074[_0xbff7('0x2d')][_0xbff7('0x39')]){_0x292851[_0xbff7('0x37')]=_['merge'](_0x292851[_0xbff7('0x37')],{'$or':_[_0xbff7('0x2a')](_0x53447b,function(_0x5e2ae7){if(_0x5e2ae7[_0xbff7('0x3a')]!==_0xbff7('0x3b')){var _0x45f82f={};_0x45f82f[_0x5e2ae7[_0xbff7('0x28')]]={'$like':'%'+_0x10e074[_0xbff7('0x2d')]['filter']+'%'};return _0x45f82f;}})});}_0x292851=_[_0xbff7('0x3c')]({},_0x292851,_0x10e074[_0xbff7('0x3d')]);var _0x2e966b={'where':_0x292851[_0xbff7('0x37')]};return db[_0xbff7('0x3e')][_0xbff7('0x1e')](_0x2e966b)[_0xbff7('0x23')](function(_0x45e02d){_0x5cb9a7[_0xbff7('0x1e')]=_0x45e02d;if(_0x10e074[_0xbff7('0x2d')]['includeAll']){_0x292851[_0xbff7('0x3f')]=[{'all':!![]}];}return db[_0xbff7('0x3e')]['findAll'](_0x292851);})[_0xbff7('0x23')](function(_0x19456d){_0x5cb9a7[_0xbff7('0x40')]=_0x19456d;return _0x5cb9a7;})[_0xbff7('0x23')](respondWithFilteredResult(_0x13cd7d,_0x292851))['catch'](handleError(_0x13cd7d,null));}; \ No newline at end of file +var _0x20be=['VIRTUAL','options','Migration','then','includeAll','include','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus','send','map','rawAttributes','type','key','model','name','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filter','merge'];(function(_0x28950b,_0x34bd03){var _0x15d6d4=function(_0x554ec2){while(--_0x554ec2){_0x28950b['push'](_0x28950b['shift']());}};_0x15d6d4(++_0x34bd03);}(_0x20be,0xd2));var _0xe20b=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x20be[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0xe20b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe20b('0x1'));var jsonpatch=require(_0xe20b('0x2'));var rp=require('request-promise');var moment=require(_0xe20b('0x3'));var BPromise=require(_0xe20b('0x4'));var Mustache=require(_0xe20b('0x5'));var util=require(_0xe20b('0x6'));var path=require(_0xe20b('0x7'));var sox=require(_0xe20b('0x8'));var csv=require(_0xe20b('0x9'));var ejs=require(_0xe20b('0xa'));var fs=require('fs');var fs_extra=require(_0xe20b('0xb'));var _=require(_0xe20b('0xc'));var squel=require(_0xe20b('0xd'));var crypto=require(_0xe20b('0xe'));var jsforce=require(_0xe20b('0xf'));var deskjs=require(_0xe20b('0x10'));var toCsv=require(_0xe20b('0x9'));var querystring=require(_0xe20b('0x11'));var Papa=require(_0xe20b('0x12'));var Redis=require('ioredis');var authService=require(_0xe20b('0x13'));var qs=require(_0xe20b('0x14'));var as=require(_0xe20b('0x15'));var hardwareService=require(_0xe20b('0x16'));var logger=require('../../config/logger')(_0xe20b('0x17'));var utils=require(_0xe20b('0x18'));var config=require(_0xe20b('0x19'));var licenseUtil=require(_0xe20b('0x1a'));var db=require(_0xe20b('0x1b'))['db'];function respondWithStatusCode(_0x4611a7,_0x1c2668){_0x1c2668=_0x1c2668||0xcc;return function(_0x3ddce0){if(_0x3ddce0){return _0x4611a7['sendStatus'](_0x1c2668);}return _0x4611a7['status'](_0x1c2668)[_0xe20b('0x1c')]();};}function respondWithResult(_0x453a2e,_0xe67c42){_0xe67c42=_0xe67c42||0xc8;return function(_0x34d077){if(_0x34d077){return _0x453a2e[_0xe20b('0x1d')](_0xe67c42)[_0xe20b('0x1e')](_0x34d077);}};}function respondWithFilteredResult(_0x46fead,_0xbf2b7a){return function(_0x30672f){if(_0x30672f){var _0x1d9041=typeof _0xbf2b7a[_0xe20b('0x1f')]===_0xe20b('0x20')&&typeof _0xbf2b7a[_0xe20b('0x21')]==='undefined';var _0x4d08ec=_0x30672f[_0xe20b('0x22')];var _0x3b3ace=_0x1d9041?0x0:_0xbf2b7a[_0xe20b('0x1f')];var _0x5a1999=_0x1d9041?_0x30672f[_0xe20b('0x22')]:_0xbf2b7a[_0xe20b('0x1f')]+_0xbf2b7a[_0xe20b('0x21')];var _0x2d495c;if(_0x5a1999>=_0x4d08ec){_0x5a1999=_0x4d08ec;_0x2d495c=0xc8;}else{_0x2d495c=0xce;}_0x46fead[_0xe20b('0x1d')](_0x2d495c);return _0x46fead[_0xe20b('0x23')](_0xe20b('0x24'),_0x3b3ace+'-'+_0x5a1999+'/'+_0x4d08ec)[_0xe20b('0x1e')](_0x30672f);}return null;};}function patchUpdates(_0x3c40cd){return function(_0x2743a3){try{jsonpatch[_0xe20b('0x25')](_0x2743a3,_0x3c40cd,!![]);}catch(_0x392d70){return BPromise[_0xe20b('0x26')](_0x392d70);}return _0x2743a3[_0xe20b('0x27')]();};}function saveUpdates(_0x2ce475,_0x23b929){return function(_0x3bbe50){if(_0x3bbe50){return _0x3bbe50[_0xe20b('0x28')](_0x2ce475)['then'](function(_0x3f84e0){return _0x3f84e0;});}return null;};}function removeEntity(_0xfa903b,_0x1e9491){return function(_0x353dab){if(_0x353dab){return _0x353dab[_0xe20b('0x29')]()['then'](function(){_0xfa903b[_0xe20b('0x1d')](0xcc)[_0xe20b('0x1c')]();});}};}function handleEntityNotFound(_0x43640e,_0x2ff67a){return function(_0x1a0b2d){if(!_0x1a0b2d){_0x43640e[_0xe20b('0x2a')](0x194);}return _0x1a0b2d;};}function handleError(_0x48a834,_0x560e04){_0x560e04=_0x560e04||0x1f4;return function(_0x1d4c1d){logger['error'](_0x1d4c1d['stack']);if(_0x1d4c1d['name']){delete _0x1d4c1d['name'];}_0x48a834[_0xe20b('0x1d')](_0x560e04)[_0xe20b('0x2b')](_0x1d4c1d);};}exports['index']=function(_0x12da81,_0x3f9d71){var _0xee07cf={},_0x4d7200={},_0x5e12f6={'count':0x0,'rows':[]};var _0x414329=_[_0xe20b('0x2c')](db['Migration'][_0xe20b('0x2d')],function(_0x528b69){return{'name':_0x528b69['fieldName'],'type':_0x528b69[_0xe20b('0x2e')][_0xe20b('0x2f')]};});_0x4d7200[_0xe20b('0x30')]=_[_0xe20b('0x2c')](_0x414329,_0xe20b('0x31'));_0x4d7200[_0xe20b('0x32')]=_['keys'](_0x12da81['query']);_0x4d7200[_0xe20b('0x33')]=_[_0xe20b('0x34')](_0x4d7200[_0xe20b('0x30')],_0x4d7200[_0xe20b('0x32')]);_0xee07cf[_0xe20b('0x35')]=_[_0xe20b('0x34')](_0x4d7200[_0xe20b('0x30')],qs['fields'](_0x12da81[_0xe20b('0x32')][_0xe20b('0x36')]));_0xee07cf[_0xe20b('0x35')]=_0xee07cf['attributes']['length']?_0xee07cf[_0xe20b('0x35')]:_0x4d7200[_0xe20b('0x30')];if(!_0x12da81[_0xe20b('0x32')][_0xe20b('0x37')](_0xe20b('0x38'))){_0xee07cf[_0xe20b('0x21')]=qs[_0xe20b('0x21')](_0x12da81[_0xe20b('0x32')][_0xe20b('0x21')]);_0xee07cf[_0xe20b('0x1f')]=qs['offset'](_0x12da81[_0xe20b('0x32')][_0xe20b('0x1f')]);}_0xee07cf[_0xe20b('0x39')]=qs['sort'](_0x12da81['query']['sort']);_0xee07cf[_0xe20b('0x3a')]=qs['filters'](_[_0xe20b('0x3b')](_0x12da81[_0xe20b('0x32')],_0x4d7200[_0xe20b('0x33')]),_0x414329);if(_0x12da81[_0xe20b('0x32')][_0xe20b('0x3c')]){_0xee07cf['where']=_[_0xe20b('0x3d')](_0xee07cf[_0xe20b('0x3a')],{'$or':_['map'](_0x414329,function(_0x66e100){if(_0x66e100[_0xe20b('0x2e')]!==_0xe20b('0x3e')){var _0x1f1d14={};_0x1f1d14[_0x66e100[_0xe20b('0x31')]]={'$like':'%'+_0x12da81[_0xe20b('0x32')][_0xe20b('0x3c')]+'%'};return _0x1f1d14;}})});}_0xee07cf=_[_0xe20b('0x3d')]({},_0xee07cf,_0x12da81[_0xe20b('0x3f')]);var _0x5934c7={'where':_0xee07cf[_0xe20b('0x3a')]};return db[_0xe20b('0x40')]['count'](_0x5934c7)[_0xe20b('0x41')](function(_0x594b62){_0x5e12f6['count']=_0x594b62;if(_0x12da81[_0xe20b('0x32')][_0xe20b('0x42')]){_0xee07cf[_0xe20b('0x43')]=[{'all':!![]}];}return db[_0xe20b('0x40')]['findAll'](_0xee07cf);})[_0xe20b('0x41')](function(_0x5f2e9d){_0x5e12f6['rows']=_0x5f2e9d;return _0x5e12f6;})[_0xe20b('0x41')](respondWithFilteredResult(_0x3f9d71,_0xee07cf))['catch'](handleError(_0x3f9d71,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 4aa406e..3b5cfe0 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 _0xdfe4=['migrations','util','api','moment','bluebird','request-promise','path','rimraf','./migration.attributes','exports','define','Migration'];(function(_0x394562,_0x4260af){var _0x34c244=function(_0x1c8966){while(--_0x1c8966){_0x394562['push'](_0x394562['shift']());}};_0x34c244(++_0x4260af);}(_0xdfe4,0x175));var _0x4dfe=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xdfe4[_0x30ae5e];return _0x1f2e93;};'use strict';var _=require('lodash');var util=require(_0x4dfe('0x0'));var logger=require('../../config/logger')(_0x4dfe('0x1'));var moment=require(_0x4dfe('0x2'));var BPromise=require(_0x4dfe('0x3'));var rp=require(_0x4dfe('0x4'));var fs=require('fs');var path=require(_0x4dfe('0x5'));var rimraf=require(_0x4dfe('0x6'));var config=require('../../config/environment');var attributes=require(_0x4dfe('0x7'));module[_0x4dfe('0x8')]=function(_0x463f01,_0x5c75d1){return _0x463f01[_0x4dfe('0x9')](_0x4dfe('0xa'),attributes,{'tableName':_0x4dfe('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6452=['../../config/logger','bluebird','path','../../config/environment','./migration.attributes','exports','define','Migration','migrations','lodash','util'];(function(_0xf10840,_0xad3916){var _0x1fdf7e=function(_0x463be3){while(--_0x463be3){_0xf10840['push'](_0xf10840['shift']());}};_0x1fdf7e(++_0xad3916);}(_0x6452,0xda));var _0x2645=function(_0x5a2d95,_0xb362e5){_0x5a2d95=_0x5a2d95-0x0;var _0x2c3986=_0x6452[_0x5a2d95];return _0x2c3986;};'use strict';var _=require(_0x2645('0x0'));var util=require(_0x2645('0x1'));var logger=require(_0x2645('0x2'))('api');var moment=require('moment');var BPromise=require(_0x2645('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2645('0x4'));var rimraf=require('rimraf');var config=require(_0x2645('0x5'));var attributes=require(_0x2645('0x6'));module[_0x2645('0x7')]=function(_0x2b7532,_0x2a3344){return _0x2b7532[_0x2645('0x8')](_0x2645('0x9'),attributes,{'tableName':_0x2645('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index a0cf165..180bad3 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 _0xe28e=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','stringify','error','code','Migration,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x54336b,_0x48b028){var _0x5b64a3=function(_0x4db3e5){while(--_0x4db3e5){_0x54336b['push'](_0x54336b['shift']());}};_0x5b64a3(++_0x48b028);}(_0xe28e,0x1ba));var _0xee28=function(_0x58083f,_0x314c1e){_0x58083f=_0x58083f-0x0;var _0x13d7b7=_0xe28e[_0x58083f];return _0x13d7b7;};'use strict';var _=require(_0xee28('0x0'));var util=require(_0xee28('0x1'));var moment=require(_0xee28('0x2'));var BPromise=require(_0xee28('0x3'));var rs=require(_0xee28('0x4'));var fs=require('fs');var Redis=require(_0xee28('0x5'));var db=require(_0xee28('0x6'))['db'];var utils=require(_0xee28('0x7'));var logger=require(_0xee28('0x8'))(_0xee28('0x9'));var config=require(_0xee28('0xa'));var jayson=require(_0xee28('0xb'));var client=jayson[_0xee28('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x39b337,_0x30224a,_0x3f9bd9){return new BPromise(function(_0x66d0b6,_0x156aad){return client[_0xee28('0xd')](_0x39b337,_0x3f9bd9)[_0xee28('0xe')](function(_0x5d7562){logger['info']('Migration,\x20%s,\x20%s',_0x30224a,_0xee28('0xf'));logger[_0xee28('0x10')]('Migration,\x20%s,\x20%s,\x20%s',_0x30224a,_0xee28('0xf'),JSON[_0xee28('0x11')](_0x5d7562));if(_0x5d7562['error']){if(_0x5d7562[_0xee28('0x12')][_0xee28('0x13')]===0x1f4){logger[_0xee28('0x12')](_0xee28('0x14'),_0x30224a,_0x5d7562[_0xee28('0x12')][_0xee28('0x15')]);return _0x156aad(_0x5d7562[_0xee28('0x12')]['message']);}logger[_0xee28('0x12')](_0xee28('0x14'),_0x30224a,_0x5d7562[_0xee28('0x12')][_0xee28('0x15')]);return _0x66d0b6(_0x5d7562[_0xee28('0x12')]['message']);}else{logger[_0xee28('0x16')](_0xee28('0x14'),_0x30224a,_0xee28('0xf'));_0x66d0b6(_0x5d7562[_0xee28('0x17')][_0xee28('0x15')]);}})[_0xee28('0x18')](function(_0x4c0eb9){logger[_0xee28('0x12')]('Migration,\x20%s,\x20%s',_0x30224a,_0x4c0eb9);_0x156aad(_0x4c0eb9);});});} \ No newline at end of file +var _0xa477=['client','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x11b0f7,_0x383a35){var _0x4b1b77=function(_0x247ad4){while(--_0x247ad4){_0x11b0f7['push'](_0x11b0f7['shift']());}};_0x4b1b77(++_0x383a35);}(_0xa477,0xe6));var _0x7a47=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa477[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0x7a47('0x0'));var util=require(_0x7a47('0x1'));var moment=require('moment');var BPromise=require(_0x7a47('0x2'));var rs=require(_0x7a47('0x3'));var fs=require('fs');var Redis=require(_0x7a47('0x4'));var db=require(_0x7a47('0x5'))['db'];var utils=require(_0x7a47('0x6'));var logger=require(_0x7a47('0x7'))(_0x7a47('0x8'));var config=require('../../config/environment');var jayson=require(_0x7a47('0x9'));var client=jayson[_0x7a47('0xa')][_0x7a47('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4c6e0e,_0x54e9aa,_0x47f594){return new BPromise(function(_0x4276ed,_0x49db4c){return client[_0x7a47('0xc')](_0x4c6e0e,_0x47f594)[_0x7a47('0xd')](function(_0x52eb49){logger[_0x7a47('0xe')](_0x7a47('0xf'),_0x54e9aa,_0x7a47('0x10'));logger[_0x7a47('0x11')](_0x7a47('0x12'),_0x54e9aa,'request\x20sent',JSON[_0x7a47('0x13')](_0x52eb49));if(_0x52eb49[_0x7a47('0x14')]){if(_0x52eb49[_0x7a47('0x14')][_0x7a47('0x15')]===0x1f4){logger['error'](_0x7a47('0xf'),_0x54e9aa,_0x52eb49[_0x7a47('0x14')][_0x7a47('0x16')]);return _0x49db4c(_0x52eb49[_0x7a47('0x14')][_0x7a47('0x16')]);}logger[_0x7a47('0x14')](_0x7a47('0xf'),_0x54e9aa,_0x52eb49[_0x7a47('0x14')]['message']);return _0x4276ed(_0x52eb49[_0x7a47('0x14')][_0x7a47('0x16')]);}else{logger[_0x7a47('0xe')](_0x7a47('0xf'),_0x54e9aa,'request\x20sent');_0x4276ed(_0x52eb49[_0x7a47('0x17')][_0x7a47('0x16')]);}})['catch'](function(_0x4a81fb){logger[_0x7a47('0x14')](_0x7a47('0xf'),_0x54e9aa,_0x4a81fb);_0x49db4c(_0x4a81fb);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 3255504..75e9d27 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 _0x1bec=['path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./network.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports'];(function(_0x38aa55,_0x527d35){var _0x4e951f=function(_0x4c91cb){while(--_0x4c91cb){_0x38aa55['push'](_0x38aa55['shift']());}};_0x4e951f(++_0x527d35);}(_0x1bec,0x168));var _0xc1be=function(_0x264e7f,_0x4b8f91){_0x264e7f=_0x264e7f-0x0;var _0x173e6e=_0x1bec[_0x264e7f];return _0x173e6e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc1be('0x0'));var timeout=require('connect-timeout');var express=require(_0xc1be('0x1'));var router=express[_0xc1be('0x2')]();var fs_extra=require(_0xc1be('0x3'));var auth=require(_0xc1be('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xc1be('0x5'));var controller=require(_0xc1be('0x6'));router[_0xc1be('0x7')]('/',auth[_0xc1be('0x8')](),controller[_0xc1be('0x9')]);router[_0xc1be('0x7')](_0xc1be('0xa'),auth[_0xc1be('0x8')](),controller[_0xc1be('0xb')]);router[_0xc1be('0xc')]('/',auth['isAuthenticated'](),controller[_0xc1be('0xd')]);router[_0xc1be('0xe')](_0xc1be('0xa'),auth['isAuthenticated'](),controller[_0xc1be('0xf')]);router['delete'](_0xc1be('0xa'),auth[_0xc1be('0x8')](),controller[_0xc1be('0x10')]);module[_0xc1be('0x11')]=router; \ No newline at end of file +var _0xb4b6=['../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','create','put','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x584e84,_0x57097f){var _0x57f690=function(_0x2bab55){while(--_0x2bab55){_0x584e84['push'](_0x584e84['shift']());}};_0x57f690(++_0x57097f);}(_0xb4b6,0x7e));var _0x6b4b=function(_0x184101,_0x1bc040){_0x184101=_0x184101-0x0;var _0x5090c8=_0xb4b6[_0x184101];return _0x5090c8;};'use strict';var multer=require('multer');var util=require(_0x6b4b('0x0'));var path=require(_0x6b4b('0x1'));var timeout=require(_0x6b4b('0x2'));var express=require(_0x6b4b('0x3'));var router=express[_0x6b4b('0x4')]();var fs_extra=require(_0x6b4b('0x5'));var auth=require(_0x6b4b('0x6'));var interaction=require(_0x6b4b('0x7'));var config=require(_0x6b4b('0x8'));var controller=require('./network.controller');router[_0x6b4b('0x9')]('/',auth['isAuthenticated'](),controller[_0x6b4b('0xa')]);router[_0x6b4b('0x9')](_0x6b4b('0xb'),auth[_0x6b4b('0xc')](),controller[_0x6b4b('0xd')]);router['post']('/',auth[_0x6b4b('0xc')](),controller[_0x6b4b('0xe')]);router[_0x6b4b('0xf')](_0x6b4b('0xb'),auth[_0x6b4b('0xc')](),controller[_0x6b4b('0x10')]);router[_0x6b4b('0x11')](_0x6b4b('0xb'),auth['isAuthenticated'](),controller[_0x6b4b('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 86d4557..e278126 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 _0x6b91=['stun','STRING','sequelize','exports','ENUM','externip'];(function(_0x2f5b0d,_0x2a64d2){var _0x3530fc=function(_0x5390fe){while(--_0x5390fe){_0x2f5b0d['push'](_0x2f5b0d['shift']());}};_0x3530fc(++_0x2a64d2);}(_0x6b91,0x9e));var _0x16b9=function(_0x481ad0,_0x8f10dc){_0x481ad0=_0x481ad0-0x0;var _0x207245=_0x6b91[_0x481ad0];return _0x207245;};'use strict';var Sequelize=require(_0x16b9('0x0'));module[_0x16b9('0x1')]={'type':{'type':Sequelize[_0x16b9('0x2')]('localnet',_0x16b9('0x3'),_0x16b9('0x4'),'turn')},'value':{'type':Sequelize[_0x16b9('0x5')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x16b9('0x5')]}}; \ No newline at end of file +var _0x29c9=['stun','turn','STRING','sequelize','ENUM','localnet'];(function(_0x1ded0f,_0x2c82a9){var _0x1ad47a=function(_0x5b745b){while(--_0x5b745b){_0x1ded0f['push'](_0x1ded0f['shift']());}};_0x1ad47a(++_0x2c82a9);}(_0x29c9,0xed));var _0x929c=function(_0x283254,_0x4c16a1){_0x283254=_0x283254-0x0;var _0x8488d3=_0x29c9[_0x283254];return _0x8488d3;};'use strict';var Sequelize=require(_0x929c('0x0'));module['exports']={'type':{'type':Sequelize[_0x929c('0x1')](_0x929c('0x2'),'externip',_0x929c('0x3'),_0x929c('0x4'))},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x929c('0x5')]},'password':{'type':Sequelize[_0x929c('0x5')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index fd128f7..7797866 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 _0x3541=['readFileSync','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','TURN','server/files/templates/network.ejs','path','ejs','../../config/logger','api','../../mysqldb','client','request','then','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','json','undefined','limit','count','offset','status','set','update','destroy','end','sendStatus','stack','name','send','index','Network','rawAttributes','type','model','map','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','show','params','intersection','includeAll','find','create','body','toUpperCase','STUN','join','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0x3541,0x19c));var _0x1354=function(_0x4d07cc,_0x587613){_0x4d07cc=_0x4d07cc-0x0;var _0x42de3b=_0x3541[_0x4d07cc];return _0x42de3b;};'use strict';var util=require('util');var path=require(_0x1354('0x0'));var ejs=require(_0x1354('0x1'));var fs=require('fs');var _=require('lodash');var qs=require('../../components/parsers/qs');var logger=require(_0x1354('0x2'))(_0x1354('0x3'));var config=require('../../config/environment');var db=require(_0x1354('0x4'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x1354('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x405d10,_0x52b7e5,_0x22c604,_0x2583b2){return new Promise(function(_0x49d330,_0x3be150){var _0x5491a6=_0x2583b2||client;return _0x5491a6[_0x1354('0x6')](_0x405d10,_0x22c604)[_0x1354('0x7')](function(_0x4a98ba){logger['info'](_0x1354('0x8'),_0x52b7e5,_0x1354('0x9'));logger[_0x1354('0xa')](_0x1354('0xb'),_0x52b7e5,_0x1354('0x9'),JSON['stringify'](_0x4a98ba));if(_0x4a98ba[_0x1354('0xc')]){if(_0x4a98ba[_0x1354('0xc')]['code']===0x1f4){logger[_0x1354('0xc')](_0x1354('0x8'),_0x52b7e5,_0x4a98ba['error'][_0x1354('0xd')]);return _0x3be150(_0x4a98ba[_0x1354('0xc')]['message']);}logger[_0x1354('0xc')](_0x1354('0x8'),_0x52b7e5,_0x4a98ba[_0x1354('0xc')][_0x1354('0xd')]);return _0x49d330(_0x4a98ba[_0x1354('0xc')][_0x1354('0xd')]);}else{logger[_0x1354('0xe')](_0x1354('0x8'),_0x52b7e5,_0x1354('0x9'));_0x49d330(_0x4a98ba[_0x1354('0xf')][_0x1354('0xd')]);}})[_0x1354('0x10')](function(_0x2780c3){logger[_0x1354('0xc')](_0x1354('0x8'),_0x52b7e5,_0x2780c3);_0x3be150(_0x2780c3);});});}function respondWithResult(_0x5a12c9,_0x30cce9){_0x30cce9=_0x30cce9||0xc8;return function(_0x27766b){if(_0x27766b){return _0x5a12c9['status'](_0x30cce9)[_0x1354('0x11')](_0x27766b);}};}function respondWithFilteredResult(_0x38adda,_0x4f25d8){return function(_0x54cdf6){if(_0x54cdf6){var _0x22dda4=typeof _0x4f25d8['offset']===_0x1354('0x12')&&typeof _0x4f25d8[_0x1354('0x13')]==='undefined';var _0x256e4a=_0x54cdf6[_0x1354('0x14')];var _0x11b4da=_0x22dda4?0x0:_0x4f25d8['offset'];var _0x45ebe9=_0x22dda4?_0x54cdf6[_0x1354('0x14')]:_0x4f25d8[_0x1354('0x15')]+_0x4f25d8[_0x1354('0x13')];var _0x2cc2a2;if(_0x45ebe9>=_0x256e4a){_0x45ebe9=_0x256e4a;_0x2cc2a2=0xc8;}else{_0x2cc2a2=0xce;}_0x38adda[_0x1354('0x16')](_0x2cc2a2);return _0x38adda[_0x1354('0x17')]('Content-Range',_0x11b4da+'-'+_0x45ebe9+'/'+_0x256e4a)['json'](_0x54cdf6);}return null;};}function saveUpdates(_0x24307e){return function(_0x2eb3a5){if(_0x2eb3a5){return _0x2eb3a5[_0x1354('0x18')](_0x24307e)[_0x1354('0x7')](function(_0x3f9d84){return _0x3f9d84;});}return null;};}function removeEntity(_0x2e6405){return function(_0x53b15d){if(_0x53b15d){return _0x53b15d[_0x1354('0x19')]()[_0x1354('0x7')](function(){_0x2e6405[_0x1354('0x16')](0xcc)[_0x1354('0x1a')]();});}};}function handleEntityNotFound(_0x5ab6c3){return function(_0x3322d9){if(!_0x3322d9){_0x5ab6c3[_0x1354('0x1b')](0x194);}return _0x3322d9;};}function handleError(_0x594e64,_0x560852){_0x560852=_0x560852||0x1f4;return function(_0x20e2c9){logger[_0x1354('0xc')](_0x20e2c9[_0x1354('0x1c')]);if(_0x20e2c9[_0x1354('0x1d')]){delete _0x20e2c9[_0x1354('0x1d')];}_0x594e64['status'](_0x560852)[_0x1354('0x1e')](_0x20e2c9);};}exports[_0x1354('0x1f')]=function(_0x201035,_0x3234bf){var _0x1c11c9={},_0x15408e={},_0x325be0={'count':0x0,'rows':[]};var _0x599b4d=_['map'](db[_0x1354('0x20')][_0x1354('0x21')],function(_0x128c97){return{'name':_0x128c97['fieldName'],'type':_0x128c97[_0x1354('0x22')]['key']};});_0x15408e[_0x1354('0x23')]=_[_0x1354('0x24')](_0x599b4d,'name');_0x15408e['query']=_[_0x1354('0x25')](_0x201035[_0x1354('0x26')]);_0x15408e[_0x1354('0x27')]=_['intersection'](_0x15408e[_0x1354('0x23')],_0x15408e[_0x1354('0x26')]);_0x1c11c9[_0x1354('0x28')]=_['intersection'](_0x15408e[_0x1354('0x23')],qs[_0x1354('0x29')](_0x201035['query'][_0x1354('0x29')]));_0x1c11c9[_0x1354('0x28')]=_0x1c11c9['attributes'][_0x1354('0x2a')]?_0x1c11c9[_0x1354('0x28')]:_0x15408e[_0x1354('0x23')];if(!_0x201035[_0x1354('0x26')][_0x1354('0x2b')](_0x1354('0x2c'))){_0x1c11c9[_0x1354('0x13')]=qs[_0x1354('0x13')](_0x201035['query']['limit']);_0x1c11c9[_0x1354('0x15')]=qs[_0x1354('0x15')](_0x201035[_0x1354('0x26')]['offset']);}_0x1c11c9['order']=qs[_0x1354('0x2d')](_0x201035[_0x1354('0x26')][_0x1354('0x2d')]);_0x1c11c9['where']=qs['filters'](_[_0x1354('0x2e')](_0x201035[_0x1354('0x26')],_0x15408e[_0x1354('0x27')]),_0x599b4d);if(_0x201035[_0x1354('0x26')][_0x1354('0x2f')]){_0x1c11c9[_0x1354('0x30')]=_[_0x1354('0x31')](_0x1c11c9[_0x1354('0x30')],{'$or':_[_0x1354('0x24')](_0x599b4d,function(_0x55ccfb){if(_0x55ccfb[_0x1354('0x22')]!==_0x1354('0x32')){var _0x554906={};_0x554906[_0x55ccfb[_0x1354('0x1d')]]={'$like':'%'+_0x201035[_0x1354('0x26')]['filter']+'%'};return _0x554906;}})});}_0x1c11c9=_[_0x1354('0x31')]({},_0x1c11c9,_0x201035[_0x1354('0x33')]);var _0xb501b7={'where':_0x1c11c9[_0x1354('0x30')]};return db['Network'][_0x1354('0x14')](_0xb501b7)['then'](function(_0x1a6ece){_0x325be0[_0x1354('0x14')]=_0x1a6ece;if(_0x201035[_0x1354('0x26')]['includeAll']){_0x1c11c9[_0x1354('0x34')]=[{'all':!![]}];}return db['Network'][_0x1354('0x35')](_0x1c11c9);})[_0x1354('0x7')](function(_0x347d6c){_0x325be0['rows']=_0x347d6c;return _0x325be0;})[_0x1354('0x7')](respondWithFilteredResult(_0x3234bf,_0x1c11c9))[_0x1354('0x10')](handleError(_0x3234bf,null));};exports[_0x1354('0x36')]=function(_0xb081ab,_0x3d5e95){var _0x3d8ee5={'raw':!![],'where':{'id':_0xb081ab[_0x1354('0x37')]['id']}},_0x3bab5f={};_0x3bab5f[_0x1354('0x23')]=_[_0x1354('0x25')](db[_0x1354('0x20')]['rawAttributes']);_0x3bab5f[_0x1354('0x26')]=_[_0x1354('0x25')](_0xb081ab[_0x1354('0x26')]);_0x3bab5f[_0x1354('0x27')]=_[_0x1354('0x38')](_0x3bab5f['model'],_0x3bab5f[_0x1354('0x26')]);_0x3d8ee5['attributes']=_[_0x1354('0x38')](_0x3bab5f[_0x1354('0x23')],qs['fields'](_0xb081ab[_0x1354('0x26')][_0x1354('0x29')]));_0x3d8ee5['attributes']=_0x3d8ee5[_0x1354('0x28')]['length']?_0x3d8ee5[_0x1354('0x28')]:_0x3bab5f[_0x1354('0x23')];if(_0xb081ab['query'][_0x1354('0x39')]){_0x3d8ee5[_0x1354('0x34')]=[{'all':!![]}];}_0x3d8ee5=_[_0x1354('0x31')]({},_0x3d8ee5,_0xb081ab[_0x1354('0x33')]);return db['Network'][_0x1354('0x3a')](_0x3d8ee5)[_0x1354('0x7')](handleEntityNotFound(_0x3d5e95,null))[_0x1354('0x7')](respondWithResult(_0x3d5e95,null))[_0x1354('0x10')](handleError(_0x3d5e95,null));};exports['create']=function(_0x5ae282,_0x3d7717){var _0x32a01d;return db[_0x1354('0x20')][_0x1354('0x3b')](_0x5ae282['body'],{'raw':!![]})[_0x1354('0x7')](function(_0x2c97e4){_0x32a01d=_0x2c97e4;return db[_0x1354('0x20')][_0x1354('0x35')]({'where':{'type':_0x5ae282[_0x1354('0x3c')][_0x1354('0x22')]},'raw':!![]});})[_0x1354('0x7')](function(_0x39eebd){if(_0x32a01d[_0x1354('0x22')][_0x1354('0x3d')]()==_0x1354('0x3e')){var _0x237656=fs['readFileSync'](path[_0x1354('0x3f')](config[_0x1354('0x40')],_0x1354('0x41')),_0x1354('0x42'));var _0x29d33d=ejs[_0x1354('0x43')](_0x237656,{'networks':_0x39eebd||[]});fs[_0x1354('0x44')](_0x1354('0x45'),_0x29d33d);return respondWithRpcPromise(_0x1354('0x46'),_0x1354('0x3b'),{'module':_0x1354('0x47')});}else if(_0x32a01d[_0x1354('0x22')][_0x1354('0x3d')]()=='TURN'){var _0x1ae300=fs['readFileSync'](path[_0x1354('0x3f')](config[_0x1354('0x40')],_0x1354('0x48')),'utf8');var _0x5f56f4=ejs['render'](_0x1ae300,{'networks':_0x39eebd||[]});fs[_0x1354('0x44')](_0x1354('0x49'),_0x5f56f4);return respondWithRpcPromise(_0x1354('0x46'),'create',{'module':_0x1354('0x47')});}else{var _0x48ff35=fs[_0x1354('0x4a')](path[_0x1354('0x3f')](config['root'],'server/files/templates/network.ejs'),_0x1354('0x42'));var _0x36b20f=ejs[_0x1354('0x43')](_0x48ff35,{'networks':_0x39eebd||[]});fs[_0x1354('0x44')](util[_0x1354('0x4b')](_0x1354('0x4c'),_0x5ae282[_0x1354('0x3c')][_0x1354('0x22')][_0x1354('0x4d')]()),_0x36b20f);return respondWithRpcPromise(_0x1354('0x46'),_0x1354('0x3b'),{'module':_0x1354('0x4e')});}})[_0x1354('0x7')](function(){return _0x32a01d;})['then'](respondWithResult(_0x3d7717,0xc9))['catch'](handleError(_0x3d7717,null));};exports[_0x1354('0x18')]=function(_0x1aff37,_0x8199fd){var _0x9f808f;return db[_0x1354('0x20')][_0x1354('0x3a')]({'where':{'id':_0x1aff37[_0x1354('0x37')]['id']}})[_0x1354('0x7')](handleEntityNotFound(_0x8199fd,null))[_0x1354('0x7')](saveUpdates(_0x1aff37['body'],null))[_0x1354('0x7')](function(_0xd690d6){if(_0xd690d6){_0x9f808f=_0xd690d6;return db[_0x1354('0x20')]['findAll']({'where':{'type':_0x9f808f['type']},'raw':!![]});}return null;})[_0x1354('0x7')](function(_0x34a6bc){if(_0x9f808f[_0x1354('0x22')][_0x1354('0x3d')]()==_0x1354('0x3e')){var _0x44b64b=fs['readFileSync'](path[_0x1354('0x3f')](config['root'],'server/files/templates/stun_multiple.ejs'),_0x1354('0x42'));var _0x9c56a4=ejs[_0x1354('0x43')](_0x44b64b,{'networks':_0x34a6bc||[]});fs[_0x1354('0x44')](_0x1354('0x45'),_0x9c56a4);return respondWithRpcPromise(_0x1354('0x46'),_0x1354('0x18'),{'module':_0x1354('0x47')});}else if(_0x9f808f['type']['toUpperCase']()==_0x1354('0x4f')){var _0x448efc=fs[_0x1354('0x4a')](path[_0x1354('0x3f')](config[_0x1354('0x40')],_0x1354('0x48')),_0x1354('0x42'));var _0x541ecf=ejs[_0x1354('0x43')](_0x448efc,{'networks':_0x34a6bc||[]});fs[_0x1354('0x44')](_0x1354('0x49'),_0x541ecf);return respondWithRpcPromise(_0x1354('0x46'),_0x1354('0x18'),{'module':'res_stun_monitor.so'});}else{var _0x2070d6=fs[_0x1354('0x4a')](path[_0x1354('0x3f')](config[_0x1354('0x40')],_0x1354('0x50')),_0x1354('0x42'));var _0x3bc97e=ejs[_0x1354('0x43')](_0x2070d6,{'networks':_0x34a6bc||[]});fs['writeFileSync'](util[_0x1354('0x4b')](_0x1354('0x4c'),_0x1aff37[_0x1354('0x3c')][_0x1354('0x22')][_0x1354('0x4d')]()),_0x3bc97e);return respondWithRpcPromise('Reload',_0x1354('0x18'),{'module':_0x1354('0x4e')});}})[_0x1354('0x7')](function(_0x567072){if(_0x567072){return _0x9f808f;}return null;})[_0x1354('0x7')](respondWithResult(_0x8199fd,null))[_0x1354('0x10')](handleError(_0x8199fd,null));};exports[_0x1354('0x19')]=function(_0x1fc827,_0x393d90){var _0x4bf1ae;return db[_0x1354('0x20')][_0x1354('0x3a')]({'where':{'id':_0x1fc827[_0x1354('0x37')]['id']}})['then'](function(_0xcdbc3b){_0x4bf1ae=_0xcdbc3b;return _0xcdbc3b;})[_0x1354('0x7')](handleEntityNotFound(_0x393d90,null))[_0x1354('0x7')](removeEntity(_0x393d90,null))[_0x1354('0x7')](function(){if(_0x4bf1ae){return db[_0x1354('0x20')][_0x1354('0x35')]({'where':{'type':_0x4bf1ae[_0x1354('0x22')]},'raw':!![]});}})[_0x1354('0x7')](function(_0x154d06){if(_0x4bf1ae['type']['toUpperCase']()=='STUN'){var _0x7373ca=fs[_0x1354('0x4a')](path[_0x1354('0x3f')](config['root'],_0x1354('0x41')),_0x1354('0x42'));var _0x2c6120=ejs['render'](_0x7373ca,{'networks':_0x154d06||[]});fs[_0x1354('0x44')]('/etc/asterisk/stun_xcally.conf',_0x2c6120);return respondWithRpcPromise(_0x1354('0x46'),_0x1354('0x19'),{'module':_0x1354('0x47')});}else if(_0x4bf1ae[_0x1354('0x22')][_0x1354('0x3d')]()=='TURN'){var _0x456399=fs[_0x1354('0x4a')](path[_0x1354('0x3f')](config['root'],_0x1354('0x48')),_0x1354('0x42'));var _0x18b3cd=ejs[_0x1354('0x43')](_0x456399,{'networks':_0x154d06||[]});fs[_0x1354('0x44')](_0x1354('0x49'),_0x18b3cd);return respondWithRpcPromise(_0x1354('0x46'),_0x1354('0x19'),{'module':'res_stun_monitor.so'});}else{var _0x58e517=fs[_0x1354('0x4a')](path['join'](config[_0x1354('0x40')],_0x1354('0x50')),_0x1354('0x42'));var _0x2b6599=ejs[_0x1354('0x43')](_0x58e517,{'networks':_0x154d06||[]});fs[_0x1354('0x44')](util[_0x1354('0x4b')](_0x1354('0x4c'),_0x4bf1ae['type']['toLowerCase']()),_0x2b6599);return respondWithRpcPromise(_0x1354('0x46'),_0x1354('0x19'),{'module':_0x1354('0x4e')});}})[_0x1354('0x10')](handleError(_0x393d90,null));}; \ No newline at end of file +var _0x9ae6=['readFileSync','root','writeFileSync','/etc/asterisk/turn_xcally.conf','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','params','server/files/templates/stun_multiple.ejs','/etc/asterisk/stun_xcally.conf','server/files/templates/turn_multiple.ejs','server/files/templates/network.ejs','chan_sip.so','util','path','ejs','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','json','offset','limit','undefined','count','status','set','update','destroy','stack','name','send','index','map','Network','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','keys','find','create','body','toUpperCase','join','utf8','render','Reload','res_stun_monitor.so','TURN'];(function(_0x3a04c6,_0x12a482){var _0xf4131a=function(_0x413ea2){while(--_0x413ea2){_0x3a04c6['push'](_0x3a04c6['shift']());}};_0xf4131a(++_0x12a482);}(_0x9ae6,0xbf));var _0x69ae=function(_0x96a34a,_0x48b3c6){_0x96a34a=_0x96a34a-0x0;var _0x4e325e=_0x9ae6[_0x96a34a];return _0x4e325e;};'use strict';var util=require(_0x69ae('0x0'));var path=require(_0x69ae('0x1'));var ejs=require(_0x69ae('0x2'));var fs=require('fs');var _=require(_0x69ae('0x3'));var qs=require(_0x69ae('0x4'));var logger=require(_0x69ae('0x5'))(_0x69ae('0x6'));var config=require(_0x69ae('0x7'));var db=require(_0x69ae('0x8'))['db'];var jayson=require(_0x69ae('0x9'));var client=jayson[_0x69ae('0xa')][_0x69ae('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x277db0,_0x3d819c,_0x4758fc,_0x454ae1){return new Promise(function(_0x26ac4d,_0x37a138){var _0x9c6203=_0x454ae1||client;return _0x9c6203[_0x69ae('0xc')](_0x277db0,_0x4758fc)[_0x69ae('0xd')](function(_0x481c55){logger['info'](_0x69ae('0xe'),_0x3d819c,_0x69ae('0xf'));logger[_0x69ae('0x10')](_0x69ae('0x11'),_0x3d819c,_0x69ae('0xf'),JSON[_0x69ae('0x12')](_0x481c55));if(_0x481c55[_0x69ae('0x13')]){if(_0x481c55[_0x69ae('0x13')][_0x69ae('0x14')]===0x1f4){logger[_0x69ae('0x13')](_0x69ae('0xe'),_0x3d819c,_0x481c55[_0x69ae('0x13')][_0x69ae('0x15')]);return _0x37a138(_0x481c55[_0x69ae('0x13')]['message']);}logger[_0x69ae('0x13')](_0x69ae('0xe'),_0x3d819c,_0x481c55[_0x69ae('0x13')][_0x69ae('0x15')]);return _0x26ac4d(_0x481c55[_0x69ae('0x13')][_0x69ae('0x15')]);}else{logger['info'](_0x69ae('0xe'),_0x3d819c,_0x69ae('0xf'));_0x26ac4d(_0x481c55[_0x69ae('0x16')][_0x69ae('0x15')]);}})[_0x69ae('0x17')](function(_0x404d5e){logger[_0x69ae('0x13')](_0x69ae('0xe'),_0x3d819c,_0x404d5e);_0x37a138(_0x404d5e);});});}function respondWithResult(_0x4dbf1e,_0x517809){_0x517809=_0x517809||0xc8;return function(_0x1470c2){if(_0x1470c2){return _0x4dbf1e['status'](_0x517809)[_0x69ae('0x18')](_0x1470c2);}};}function respondWithFilteredResult(_0x32e9c2,_0x281587){return function(_0xcf397d){if(_0xcf397d){var _0x59a6ac=typeof _0x281587[_0x69ae('0x19')]==='undefined'&&typeof _0x281587[_0x69ae('0x1a')]===_0x69ae('0x1b');var _0xff891b=_0xcf397d[_0x69ae('0x1c')];var _0x120062=_0x59a6ac?0x0:_0x281587[_0x69ae('0x19')];var _0x382fb0=_0x59a6ac?_0xcf397d['count']:_0x281587[_0x69ae('0x19')]+_0x281587[_0x69ae('0x1a')];var _0x2391dc;if(_0x382fb0>=_0xff891b){_0x382fb0=_0xff891b;_0x2391dc=0xc8;}else{_0x2391dc=0xce;}_0x32e9c2[_0x69ae('0x1d')](_0x2391dc);return _0x32e9c2[_0x69ae('0x1e')]('Content-Range',_0x120062+'-'+_0x382fb0+'/'+_0xff891b)[_0x69ae('0x18')](_0xcf397d);}return null;};}function saveUpdates(_0x2da80a){return function(_0x39c142){if(_0x39c142){return _0x39c142[_0x69ae('0x1f')](_0x2da80a)[_0x69ae('0xd')](function(_0x232391){return _0x232391;});}return null;};}function removeEntity(_0x19a79f){return function(_0x466b0c){if(_0x466b0c){return _0x466b0c[_0x69ae('0x20')]()[_0x69ae('0xd')](function(){_0x19a79f[_0x69ae('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e2c39){return function(_0x5e30d4){if(!_0x5e30d4){_0x1e2c39['sendStatus'](0x194);}return _0x5e30d4;};}function handleError(_0x531964,_0x332c09){_0x332c09=_0x332c09||0x1f4;return function(_0x1e3a18){logger[_0x69ae('0x13')](_0x1e3a18[_0x69ae('0x21')]);if(_0x1e3a18[_0x69ae('0x22')]){delete _0x1e3a18[_0x69ae('0x22')];}_0x531964[_0x69ae('0x1d')](_0x332c09)[_0x69ae('0x23')](_0x1e3a18);};}exports[_0x69ae('0x24')]=function(_0x8a54cb,_0xd6f044){var _0x53471a={},_0x413241={},_0xd739d2={'count':0x0,'rows':[]};var _0x3745c0=_[_0x69ae('0x25')](db[_0x69ae('0x26')][_0x69ae('0x27')],function(_0x32fe2a){return{'name':_0x32fe2a[_0x69ae('0x28')],'type':_0x32fe2a[_0x69ae('0x29')][_0x69ae('0x2a')]};});_0x413241[_0x69ae('0x2b')]=_[_0x69ae('0x25')](_0x3745c0,_0x69ae('0x22'));_0x413241[_0x69ae('0x2c')]=_['keys'](_0x8a54cb[_0x69ae('0x2c')]);_0x413241[_0x69ae('0x2d')]=_[_0x69ae('0x2e')](_0x413241[_0x69ae('0x2b')],_0x413241[_0x69ae('0x2c')]);_0x53471a[_0x69ae('0x2f')]=_[_0x69ae('0x2e')](_0x413241[_0x69ae('0x2b')],qs[_0x69ae('0x30')](_0x8a54cb[_0x69ae('0x2c')][_0x69ae('0x30')]));_0x53471a[_0x69ae('0x2f')]=_0x53471a[_0x69ae('0x2f')][_0x69ae('0x31')]?_0x53471a[_0x69ae('0x2f')]:_0x413241[_0x69ae('0x2b')];if(!_0x8a54cb['query'][_0x69ae('0x32')](_0x69ae('0x33'))){_0x53471a[_0x69ae('0x1a')]=qs[_0x69ae('0x1a')](_0x8a54cb[_0x69ae('0x2c')][_0x69ae('0x1a')]);_0x53471a[_0x69ae('0x19')]=qs[_0x69ae('0x19')](_0x8a54cb[_0x69ae('0x2c')][_0x69ae('0x19')]);}_0x53471a[_0x69ae('0x34')]=qs[_0x69ae('0x35')](_0x8a54cb[_0x69ae('0x2c')][_0x69ae('0x35')]);_0x53471a['where']=qs[_0x69ae('0x2d')](_[_0x69ae('0x36')](_0x8a54cb['query'],_0x413241[_0x69ae('0x2d')]),_0x3745c0);if(_0x8a54cb[_0x69ae('0x2c')][_0x69ae('0x37')]){_0x53471a[_0x69ae('0x38')]=_[_0x69ae('0x39')](_0x53471a['where'],{'$or':_[_0x69ae('0x25')](_0x3745c0,function(_0x38d310){if(_0x38d310[_0x69ae('0x29')]!==_0x69ae('0x3a')){var _0x11e316={};_0x11e316[_0x38d310['name']]={'$like':'%'+_0x8a54cb[_0x69ae('0x2c')]['filter']+'%'};return _0x11e316;}})});}_0x53471a=_[_0x69ae('0x39')]({},_0x53471a,_0x8a54cb[_0x69ae('0x3b')]);var _0x118985={'where':_0x53471a[_0x69ae('0x38')]};return db['Network'][_0x69ae('0x1c')](_0x118985)[_0x69ae('0xd')](function(_0x58a1cc){_0xd739d2[_0x69ae('0x1c')]=_0x58a1cc;if(_0x8a54cb['query'][_0x69ae('0x3c')]){_0x53471a[_0x69ae('0x3d')]=[{'all':!![]}];}return db['Network'][_0x69ae('0x3e')](_0x53471a);})[_0x69ae('0xd')](function(_0x3015df){_0xd739d2[_0x69ae('0x3f')]=_0x3015df;return _0xd739d2;})[_0x69ae('0xd')](respondWithFilteredResult(_0xd6f044,_0x53471a))[_0x69ae('0x17')](handleError(_0xd6f044,null));};exports[_0x69ae('0x40')]=function(_0x55090e,_0x22ed4c){var _0x5b94fa={'raw':!![],'where':{'id':_0x55090e['params']['id']}},_0x1b9ad4={};_0x1b9ad4[_0x69ae('0x2b')]=_[_0x69ae('0x41')](db[_0x69ae('0x26')][_0x69ae('0x27')]);_0x1b9ad4[_0x69ae('0x2c')]=_[_0x69ae('0x41')](_0x55090e[_0x69ae('0x2c')]);_0x1b9ad4[_0x69ae('0x2d')]=_[_0x69ae('0x2e')](_0x1b9ad4[_0x69ae('0x2b')],_0x1b9ad4['query']);_0x5b94fa[_0x69ae('0x2f')]=_['intersection'](_0x1b9ad4[_0x69ae('0x2b')],qs['fields'](_0x55090e[_0x69ae('0x2c')][_0x69ae('0x30')]));_0x5b94fa[_0x69ae('0x2f')]=_0x5b94fa[_0x69ae('0x2f')][_0x69ae('0x31')]?_0x5b94fa[_0x69ae('0x2f')]:_0x1b9ad4[_0x69ae('0x2b')];if(_0x55090e[_0x69ae('0x2c')][_0x69ae('0x3c')]){_0x5b94fa['include']=[{'all':!![]}];}_0x5b94fa=_['merge']({},_0x5b94fa,_0x55090e[_0x69ae('0x3b')]);return db[_0x69ae('0x26')][_0x69ae('0x42')](_0x5b94fa)[_0x69ae('0xd')](handleEntityNotFound(_0x22ed4c,null))[_0x69ae('0xd')](respondWithResult(_0x22ed4c,null))['catch'](handleError(_0x22ed4c,null));};exports[_0x69ae('0x43')]=function(_0x188329,_0x2eac5f){var _0x1b05e4;return db[_0x69ae('0x26')][_0x69ae('0x43')](_0x188329[_0x69ae('0x44')],{'raw':!![]})[_0x69ae('0xd')](function(_0x56bd1e){_0x1b05e4=_0x56bd1e;return db['Network'][_0x69ae('0x3e')]({'where':{'type':_0x188329['body'][_0x69ae('0x29')]},'raw':!![]});})['then'](function(_0x2f84d6){if(_0x1b05e4[_0x69ae('0x29')][_0x69ae('0x45')]()=='STUN'){var _0x451491=fs['readFileSync'](path[_0x69ae('0x46')](config['root'],'server/files/templates/stun_multiple.ejs'),_0x69ae('0x47'));var _0x41906=ejs[_0x69ae('0x48')](_0x451491,{'networks':_0x2f84d6||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x41906);return respondWithRpcPromise(_0x69ae('0x49'),'create',{'module':_0x69ae('0x4a')});}else if(_0x1b05e4[_0x69ae('0x29')][_0x69ae('0x45')]()==_0x69ae('0x4b')){var _0x27d455=fs[_0x69ae('0x4c')](path['join'](config[_0x69ae('0x4d')],'server/files/templates/turn_multiple.ejs'),_0x69ae('0x47'));var _0x130064=ejs['render'](_0x27d455,{'networks':_0x2f84d6||[]});fs[_0x69ae('0x4e')](_0x69ae('0x4f'),_0x130064);return respondWithRpcPromise(_0x69ae('0x49'),_0x69ae('0x43'),{'module':_0x69ae('0x4a')});}else{var _0x35fe1c=fs[_0x69ae('0x4c')](path[_0x69ae('0x46')](config[_0x69ae('0x4d')],'server/files/templates/network.ejs'),_0x69ae('0x47'));var _0x2e02f4=ejs[_0x69ae('0x48')](_0x35fe1c,{'networks':_0x2f84d6||[]});fs[_0x69ae('0x4e')](util[_0x69ae('0x50')](_0x69ae('0x51'),_0x188329[_0x69ae('0x44')]['type'][_0x69ae('0x52')]()),_0x2e02f4);return respondWithRpcPromise('Reload','create',{'module':'chan_sip.so'});}})[_0x69ae('0xd')](function(){return _0x1b05e4;})[_0x69ae('0xd')](respondWithResult(_0x2eac5f,0xc9))[_0x69ae('0x17')](handleError(_0x2eac5f,null));};exports[_0x69ae('0x1f')]=function(_0x228d23,_0x6ecaa7){var _0x38a00a;return db[_0x69ae('0x26')][_0x69ae('0x42')]({'where':{'id':_0x228d23[_0x69ae('0x53')]['id']}})[_0x69ae('0xd')](handleEntityNotFound(_0x6ecaa7,null))[_0x69ae('0xd')](saveUpdates(_0x228d23['body'],null))[_0x69ae('0xd')](function(_0x3ba439){if(_0x3ba439){_0x38a00a=_0x3ba439;return db[_0x69ae('0x26')]['findAll']({'where':{'type':_0x38a00a[_0x69ae('0x29')]},'raw':!![]});}return null;})[_0x69ae('0xd')](function(_0x33071d){if(_0x38a00a[_0x69ae('0x29')][_0x69ae('0x45')]()=='STUN'){var _0x3a4061=fs[_0x69ae('0x4c')](path[_0x69ae('0x46')](config[_0x69ae('0x4d')],_0x69ae('0x54')),_0x69ae('0x47'));var _0x1f9127=ejs[_0x69ae('0x48')](_0x3a4061,{'networks':_0x33071d||[]});fs[_0x69ae('0x4e')](_0x69ae('0x55'),_0x1f9127);return respondWithRpcPromise(_0x69ae('0x49'),_0x69ae('0x1f'),{'module':'res_stun_monitor.so'});}else if(_0x38a00a['type']['toUpperCase']()==_0x69ae('0x4b')){var _0xbf1292=fs[_0x69ae('0x4c')](path[_0x69ae('0x46')](config['root'],_0x69ae('0x56')),_0x69ae('0x47'));var _0x294492=ejs[_0x69ae('0x48')](_0xbf1292,{'networks':_0x33071d||[]});fs[_0x69ae('0x4e')](_0x69ae('0x4f'),_0x294492);return respondWithRpcPromise(_0x69ae('0x49'),_0x69ae('0x1f'),{'module':_0x69ae('0x4a')});}else{var _0x28c217=fs['readFileSync'](path[_0x69ae('0x46')](config[_0x69ae('0x4d')],_0x69ae('0x57')),_0x69ae('0x47'));var _0x3b1791=ejs[_0x69ae('0x48')](_0x28c217,{'networks':_0x33071d||[]});fs[_0x69ae('0x4e')](util[_0x69ae('0x50')](_0x69ae('0x51'),_0x228d23[_0x69ae('0x44')][_0x69ae('0x29')][_0x69ae('0x52')]()),_0x3b1791);return respondWithRpcPromise(_0x69ae('0x49'),_0x69ae('0x1f'),{'module':_0x69ae('0x58')});}})[_0x69ae('0xd')](function(_0x39dae8){if(_0x39dae8){return _0x38a00a;}return null;})['then'](respondWithResult(_0x6ecaa7,null))[_0x69ae('0x17')](handleError(_0x6ecaa7,null));};exports[_0x69ae('0x20')]=function(_0x45c521,_0x40677e){var _0x3a1971;return db[_0x69ae('0x26')][_0x69ae('0x42')]({'where':{'id':_0x45c521[_0x69ae('0x53')]['id']}})[_0x69ae('0xd')](function(_0x9f6172){_0x3a1971=_0x9f6172;return _0x9f6172;})[_0x69ae('0xd')](handleEntityNotFound(_0x40677e,null))[_0x69ae('0xd')](removeEntity(_0x40677e,null))[_0x69ae('0xd')](function(){if(_0x3a1971){return db[_0x69ae('0x26')]['findAll']({'where':{'type':_0x3a1971[_0x69ae('0x29')]},'raw':!![]});}})[_0x69ae('0xd')](function(_0x275404){if(_0x3a1971['type'][_0x69ae('0x45')]()=='STUN'){var _0x688ba2=fs[_0x69ae('0x4c')](path[_0x69ae('0x46')](config['root'],'server/files/templates/stun_multiple.ejs'),_0x69ae('0x47'));var _0x1138ab=ejs[_0x69ae('0x48')](_0x688ba2,{'networks':_0x275404||[]});fs[_0x69ae('0x4e')](_0x69ae('0x55'),_0x1138ab);return respondWithRpcPromise(_0x69ae('0x49'),'destroy',{'module':_0x69ae('0x4a')});}else if(_0x3a1971['type'][_0x69ae('0x45')]()=='TURN'){var _0x3797f5=fs[_0x69ae('0x4c')](path[_0x69ae('0x46')](config['root'],'server/files/templates/turn_multiple.ejs'),_0x69ae('0x47'));var _0x578c05=ejs[_0x69ae('0x48')](_0x3797f5,{'networks':_0x275404||[]});fs[_0x69ae('0x4e')](_0x69ae('0x4f'),_0x578c05);return respondWithRpcPromise(_0x69ae('0x49'),'destroy',{'module':_0x69ae('0x4a')});}else{var _0x1cfc63=fs[_0x69ae('0x4c')](path['join'](config[_0x69ae('0x4d')],'server/files/templates/network.ejs'),_0x69ae('0x47'));var _0x4779cd=ejs[_0x69ae('0x48')](_0x1cfc63,{'networks':_0x275404||[]});fs[_0x69ae('0x4e')](util[_0x69ae('0x50')]('/etc/asterisk/sip_xcally_%s.conf',_0x3a1971[_0x69ae('0x29')]['toLowerCase']()),_0x4779cd);return respondWithRpcPromise(_0x69ae('0x49'),_0x69ae('0x20'),{'module':_0x69ae('0x58')});}})['catch'](handleError(_0x40677e,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 8b282cc..109d59f 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 _0xbb53=['define','Network','network','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x367448,_0x3e9deb){var _0x28b046=function(_0x2c9ff8){while(--_0x2c9ff8){_0x367448['push'](_0x367448['shift']());}};_0x28b046(++_0x3e9deb);}(_0xbb53,0x121));var _0x3bb5=function(_0x13ff20,_0x4e4c58){_0x13ff20=_0x13ff20-0x0;var _0x27bd7f=_0xbb53[_0x13ff20];return _0x27bd7f;};'use strict';var _=require(_0x3bb5('0x0'));var util=require(_0x3bb5('0x1'));var logger=require(_0x3bb5('0x2'))(_0x3bb5('0x3'));var moment=require(_0x3bb5('0x4'));var BPromise=require(_0x3bb5('0x5'));var rp=require(_0x3bb5('0x6'));var fs=require('fs');var path=require(_0x3bb5('0x7'));var rimraf=require(_0x3bb5('0x8'));var config=require(_0x3bb5('0x9'));var attributes=require('./network.attributes');module['exports']=function(_0x23f11e,_0x2460b0){return _0x23f11e[_0x3bb5('0xa')](_0x3bb5('0xb'),attributes,{'tableName':_0x3bb5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x54f3=['api','moment','bluebird','rimraf','../../config/environment','./network.attributes','Network','network','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x54f3,0x120));var _0x354f=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x54f3[_0x46e363];return _0x3fb059;};'use strict';var _=require('lodash');var util=require(_0x354f('0x0'));var logger=require(_0x354f('0x1'))(_0x354f('0x2'));var moment=require(_0x354f('0x3'));var BPromise=require(_0x354f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x354f('0x5'));var config=require(_0x354f('0x6'));var attributes=require(_0x354f('0x7'));module['exports']=function(_0x5618ac,_0x234ac6){return _0x5618ac['define'](_0x354f('0x8'),attributes,{'tableName':_0x354f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index 4b966c9..e5066a6 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7a54,0x106));var _0x47a5=function(_0x1890d5,_0x439325){_0x1890d5=_0x1890d5-0x0;var _0x39ac5e=_0x7a54[_0x1890d5];return _0x39ac5e;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x7a54,0x106));var _0x47a5=function(_0x374020,_0x17f5d1){_0x374020=_0x374020-0x0;var _0x362f9f=_0x7a54[_0x374020];return _0x362f9f;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index fb9c7e1..28febcb 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 _0x7b84=['notify','addAgents','/:id/send','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','create','post','addDisposition'];(function(_0x5c371a,_0x4e70dd){var _0x1dfb09=function(_0xb30d9e){while(--_0xb30d9e){_0x5c371a['push'](_0x5c371a['shift']());}};_0x1dfb09(++_0x4e70dd);}(_0x7b84,0x17c));var _0x47b8=function(_0x4f9750,_0x1174f4){_0x4f9750=_0x4f9750-0x0;var _0x5be57e=_0x7b84[_0x4f9750];return _0x5be57e;};'use strict';var multer=require(_0x47b8('0x0'));var util=require(_0x47b8('0x1'));var path=require(_0x47b8('0x2'));var timeout=require(_0x47b8('0x3'));var express=require(_0x47b8('0x4'));var router=express[_0x47b8('0x5')]();var fs_extra=require(_0x47b8('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x47b8('0x7'));var config=require(_0x47b8('0x8'));var controller=require(_0x47b8('0x9'));router[_0x47b8('0xa')]('/',auth[_0x47b8('0xb')](),controller[_0x47b8('0xc')]);router['get'](_0x47b8('0xd'),auth[_0x47b8('0xb')](),controller[_0x47b8('0xe')]);router[_0x47b8('0xa')](_0x47b8('0xf'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x10')]);router[_0x47b8('0xa')](_0x47b8('0x11'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x12')]);router[_0x47b8('0xa')](_0x47b8('0x13'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x14')]);router[_0x47b8('0xa')](_0x47b8('0x15'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x16')]);router[_0x47b8('0xa')](_0x47b8('0x17'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x18')]);router[_0x47b8('0xa')](_0x47b8('0x19'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x1a')]);router['post']('/',auth[_0x47b8('0xb')](),controller[_0x47b8('0x1b')]);router[_0x47b8('0x1c')](_0x47b8('0x11'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x1d')]);router[_0x47b8('0x1c')]('/:id/canned_answers',auth[_0x47b8('0xb')](),controller['addAnswer']);router['post']('/:id/notify',controller[_0x47b8('0x1e')]);router[_0x47b8('0x1c')](_0x47b8('0x15'),auth['isAuthenticated'](),controller['addApplications']);router['post'](_0x47b8('0x19'),auth['isAuthenticated'](),controller[_0x47b8('0x1f')]);router[_0x47b8('0x1c')](_0x47b8('0x20'),auth[_0x47b8('0xb')](),controller['send']);router[_0x47b8('0x21')](_0x47b8('0xf'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x22')]);router[_0x47b8('0x23')](_0x47b8('0xf'),auth['isAuthenticated'](),controller[_0x47b8('0x24')]);router[_0x47b8('0x23')]('/:id/dispositions',auth[_0x47b8('0xb')](),controller[_0x47b8('0x25')]);router[_0x47b8('0x23')](_0x47b8('0x13'),auth['isAuthenticated'](),controller[_0x47b8('0x26')]);router[_0x47b8('0x23')](_0x47b8('0x19'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x27')]);module[_0x47b8('0x28')]=router; \ No newline at end of file +var _0xa456=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','/describe','describe','/:id/dispositions','getDispositions','getAnswers','/:id/interactions','getInteractions','getAgents','post','create','addAnswer','notify','/:id/applications','/:id/users','/:id/send','send','put','/:id','update','destroy','delete','removeDispositions','/:id/canned_answers','removeAnswers','removeAgents','multer','util'];(function(_0x3ef4f1,_0x5f0f9b){var _0x69953c=function(_0xb4e621){while(--_0xb4e621){_0x3ef4f1['push'](_0x3ef4f1['shift']());}};_0x69953c(++_0x5f0f9b);}(_0xa456,0x142));var _0x6a45=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0xa456[_0x263a74];return _0x2aa86c;};'use strict';var multer=require(_0x6a45('0x0'));var util=require(_0x6a45('0x1'));var path=require(_0x6a45('0x2'));var timeout=require(_0x6a45('0x3'));var express=require('express');var router=express[_0x6a45('0x4')]();var fs_extra=require(_0x6a45('0x5'));var auth=require(_0x6a45('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6a45('0x7'));var controller=require(_0x6a45('0x8'));router[_0x6a45('0x9')]('/',auth[_0x6a45('0xa')](),controller['index']);router[_0x6a45('0x9')](_0x6a45('0xb'),auth[_0x6a45('0xa')](),controller[_0x6a45('0xc')]);router[_0x6a45('0x9')]('/:id',auth[_0x6a45('0xa')](),controller['show']);router[_0x6a45('0x9')](_0x6a45('0xd'),auth[_0x6a45('0xa')](),controller[_0x6a45('0xe')]);router[_0x6a45('0x9')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x6a45('0xf')]);router[_0x6a45('0x9')]('/:id/applications',auth['isAuthenticated'](),controller['getApplications']);router[_0x6a45('0x9')](_0x6a45('0x10'),auth[_0x6a45('0xa')](),controller[_0x6a45('0x11')]);router[_0x6a45('0x9')]('/:id/users',auth['isAuthenticated'](),controller[_0x6a45('0x12')]);router[_0x6a45('0x13')]('/',auth['isAuthenticated'](),controller[_0x6a45('0x14')]);router[_0x6a45('0x13')](_0x6a45('0xd'),auth[_0x6a45('0xa')](),controller['addDisposition']);router['post']('/:id/canned_answers',auth[_0x6a45('0xa')](),controller[_0x6a45('0x15')]);router[_0x6a45('0x13')]('/:id/notify',controller[_0x6a45('0x16')]);router[_0x6a45('0x13')](_0x6a45('0x17'),auth['isAuthenticated'](),controller['addApplications']);router['post'](_0x6a45('0x18'),auth[_0x6a45('0xa')](),controller['addAgents']);router[_0x6a45('0x13')](_0x6a45('0x19'),auth['isAuthenticated'](),controller[_0x6a45('0x1a')]);router[_0x6a45('0x1b')](_0x6a45('0x1c'),auth[_0x6a45('0xa')](),controller[_0x6a45('0x1d')]);router['delete']('/:id',auth[_0x6a45('0xa')](),controller[_0x6a45('0x1e')]);router[_0x6a45('0x1f')](_0x6a45('0xd'),auth[_0x6a45('0xa')](),controller[_0x6a45('0x20')]);router[_0x6a45('0x1f')](_0x6a45('0x21'),auth[_0x6a45('0xa')](),controller[_0x6a45('0x22')]);router[_0x6a45('0x1f')](_0x6a45('0x18'),auth['isAuthenticated'](),controller[_0x6a45('0x23')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index eafbc81..ad8bb20 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 _0x1c83=['mandatoryDispositionPauseId','sequelize','randomstring','exports','name','STRING','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0xda044f,_0x3e4b33){var _0x3758f9=function(_0x45b846){while(--_0x45b846){_0xda044f['push'](_0xda044f['shift']());}};_0x3758f9(++_0x3e4b33);}(_0x1c83,0xd9));var _0x31c8=function(_0x297998,_0x33ab99){_0x297998=_0x297998-0x0;var _0x1926eb=_0x1c83[_0x297998];return _0x1926eb;};'use strict';var Sequelize=require(_0x31c8('0x0'));var rs=require(_0x31c8('0x1'));module[_0x31c8('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x31c8('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x31c8('0x4')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0x31c8('0x4')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x31c8('0x4')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x31c8('0x5')],'defaultValue':function(){return _0x31c8('0x6');}},'notificationSound':{'type':Sequelize[_0x31c8('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x31c8('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x31c8('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x31c8('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x31c8('0x4')]},'queueTransfer':{'type':Sequelize[_0x31c8('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x31c8('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x31c8('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x31c8('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x31c8('0x8')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x31c8('0x7')],'defaultValue':![],'comment':_0x31c8('0x9'),'set':function(_0x2a3fd7){if(!_0x2a3fd7)this[_0x31c8('0xa')](_0x31c8('0xb'),null);this['setDataValue']('mandatoryDisposition',_0x2a3fd7);}}}; \ No newline at end of file +var _0xe7e0=['mandatoryDisposition','exports','STRING','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId'];(function(_0x294288,_0x3005db){var _0x3b0156=function(_0x52b138){while(--_0x52b138){_0x294288['push'](_0x294288['shift']());}};_0x3b0156(++_0x3005db);}(_0xe7e0,0xc7));var _0x0e7e=function(_0x524f7d,_0x20d3f2){_0x524f7d=_0x524f7d-0x0;var _0x5137c9=_0xe7e0[_0x524f7d];return _0x5137c9;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x0e7e('0x0')]={'name':{'type':Sequelize[_0x0e7e('0x1')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x0e7e('0x1')]},'token':{'type':Sequelize[_0x0e7e('0x1')],'defaultValue':function(){return rs[_0x0e7e('0x2')]();}},'replyUri':{'type':Sequelize[_0x0e7e('0x1')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x0e7e('0x3')],'defaultValue':function(){return _0x0e7e('0x4');}},'notificationSound':{'type':Sequelize[_0x0e7e('0x5')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x0e7e('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x0e7e('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x0e7e('0x1')]},'queueTransfer':{'type':Sequelize[_0x0e7e('0x5')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0e7e('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0e7e('0x5')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0e7e('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0e7e('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x0e7e('0x7')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2a3278){if(!_0x2a3278)this[_0x0e7e('0x8')](_0x0e7e('0x9'),null);this[_0x0e7e('0x8')](_0x0e7e('0xa'),_0x2a3278);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 6f82f63..6048372 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 _0x19b5=['List','DESC','OpenchannelApplication','Applications','account','applications','orderBy','priority','asc','Contacts','lastName','threadId','ContactId','OpenchannelInteraction','contact','firstName','messageId','interaction','created','autoclose','push','close','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','queueId','OpenchannelQueue','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','addApplications','Transaction','READ_COMMITTED','finally','send','getApplications','getInteractions','Contact','fullname','Tag','Tags','color','tag','addAgents','ids','omit','spread','emit','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','User','CmList','out','Messages','dataValues','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','status','json','offset','undefined','limit','count','set','apply','update','destroy','get','UserProfileResource','end','stack','name','index','Pause','map','OpenchannelAccount','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','findAll','catch','show','mandatoryDispositionPause','rawAttributes','include','find','create','role','user','OpenchannelAccounts','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','OpenchannelAccountId','Disposition','getDispositions','findOne','order','rows','removeDispositions','addAnswer','CannedAnswer','removeAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','CompanyId','ListId','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','from'];(function(_0x114b7c,_0xc4b93b){var _0x47185f=function(_0x5b4cfa){while(--_0x5b4cfa){_0x114b7c['push'](_0x114b7c['shift']());}};_0x47185f(++_0xc4b93b);}(_0x19b5,0x1b7));var _0x519b=function(_0x5f5c53,_0x2734c3){_0x5f5c53=_0x5f5c53-0x0;var _0x109f1f=_0x19b5[_0x5f5c53];return _0x109f1f;};'use strict';var emlformat=require(_0x519b('0x0'));var rimraf=require(_0x519b('0x1'));var zipdir=require(_0x519b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x519b('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x519b('0x4'));var util=require(_0x519b('0x5'));var path=require(_0x519b('0x6'));var sox=require(_0x519b('0x7'));var csv=require(_0x519b('0x8'));var ejs=require(_0x519b('0x9'));var fs=require('fs');var fs_extra=require(_0x519b('0xa'));var _=require('lodash');var squel=require(_0x519b('0xb'));var crypto=require(_0x519b('0xc'));var jsforce=require(_0x519b('0xd'));var deskjs=require(_0x519b('0xe'));var toCsv=require('to-csv');var querystring=require(_0x519b('0xf'));var Papa=require('papaparse');var Redis=require(_0x519b('0x10'));var authService=require(_0x519b('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x519b('0x12'));var hardwareService=require(_0x519b('0x13'));var logger=require('../../config/logger')(_0x519b('0x14'));var utils=require(_0x519b('0x15'));var config=require(_0x519b('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x519b('0x17'))['db'];config[_0x519b('0x18')]=_[_0x519b('0x19')](config[_0x519b('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x519b('0x1a'))(new Redis(config[_0x519b('0x18')]));require(_0x519b('0x1b'))[_0x519b('0x1c')](socket);var jayson=require(_0x519b('0x1d'));var client=jayson[_0x519b('0x1e')][_0x519b('0x1f')]({'port':0x232c});var client9002=jayson['client'][_0x519b('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x5e6aaa,_0x612b8b,_0x362c1a,_0x17d924){return new BPromise(function(_0x5a0410,_0x48665c){var _0xb693b6=_0x17d924||client;return _0xb693b6[_0x519b('0x20')](_0x5e6aaa,_0x362c1a)[_0x519b('0x21')](function(_0x4144a2){logger[_0x519b('0x22')](_0x519b('0x23'),_0x612b8b,_0x519b('0x24'));logger['debug'](_0x519b('0x25'),_0x612b8b,_0x519b('0x24'),JSON['stringify'](_0x4144a2));if(_0x4144a2[_0x519b('0x26')]){if(_0x4144a2['error'][_0x519b('0x27')]===0x1f4){logger[_0x519b('0x26')](_0x519b('0x23'),_0x612b8b,_0x4144a2[_0x519b('0x26')][_0x519b('0x28')]);return _0x48665c(_0x4144a2['error'][_0x519b('0x28')]);}logger[_0x519b('0x26')](_0x519b('0x23'),_0x612b8b,_0x4144a2[_0x519b('0x26')][_0x519b('0x28')]);return _0x5a0410(_0x4144a2['error'][_0x519b('0x28')]);}else{logger['info'](_0x519b('0x23'),_0x612b8b,_0x519b('0x24'));_0x5a0410(_0x4144a2[_0x519b('0x29')][_0x519b('0x28')]);}})['catch'](function(_0x5affe1){logger[_0x519b('0x26')](_0x519b('0x23'),_0x612b8b,_0x5affe1);_0x48665c(_0x5affe1);});});}function respondWithStatusCode(_0x49832c,_0x31ebf8){_0x31ebf8=_0x31ebf8||0xcc;return function(_0x8dd34f){if(_0x8dd34f){return _0x49832c[_0x519b('0x2a')](_0x31ebf8);}return _0x49832c[_0x519b('0x2b')](_0x31ebf8)['end']();};}function respondWithResult(_0x7d9fcd,_0x4543d7){_0x4543d7=_0x4543d7||0xc8;return function(_0x2b19d4){if(_0x2b19d4){return _0x7d9fcd[_0x519b('0x2b')](_0x4543d7)[_0x519b('0x2c')](_0x2b19d4);}};}function respondWithFilteredResult(_0x4a69d1,_0x57aa0f){return function(_0x354328){if(_0x354328){var _0x1169dd=typeof _0x57aa0f[_0x519b('0x2d')]===_0x519b('0x2e')&&typeof _0x57aa0f[_0x519b('0x2f')]===_0x519b('0x2e');var _0x2e54a3=_0x354328[_0x519b('0x30')];var _0x75bd77=_0x1169dd?0x0:_0x57aa0f[_0x519b('0x2d')];var _0x5d8ec5=_0x1169dd?_0x354328[_0x519b('0x30')]:_0x57aa0f[_0x519b('0x2d')]+_0x57aa0f[_0x519b('0x2f')];var _0xdfdf9f;if(_0x5d8ec5>=_0x2e54a3){_0x5d8ec5=_0x2e54a3;_0xdfdf9f=0xc8;}else{_0xdfdf9f=0xce;}_0x4a69d1[_0x519b('0x2b')](_0xdfdf9f);return _0x4a69d1[_0x519b('0x31')]('Content-Range',_0x75bd77+'-'+_0x5d8ec5+'/'+_0x2e54a3)['json'](_0x354328);}return null;};}function patchUpdates(_0x1990dd){return function(_0x23e646){try{jsonpatch[_0x519b('0x32')](_0x23e646,_0x1990dd,!![]);}catch(_0x3dc90b){return BPromise['reject'](_0x3dc90b);}return _0x23e646['save']();};}function saveUpdates(_0x7d619,_0x1a1f01){return function(_0x59fe9a){if(_0x59fe9a){return _0x59fe9a[_0x519b('0x33')](_0x7d619)[_0x519b('0x21')](function(_0x3e06fe){return _0x3e06fe;});}return null;};}function removeEntity(_0x4eae61,_0x48a579){return function(_0x1362c0){if(_0x1362c0){return _0x1362c0[_0x519b('0x34')]()[_0x519b('0x21')](function(){var _0x487603=_0x1362c0[_0x519b('0x35')]({'plain':!![]});var _0x1227a4='OpenchannelAccounts';return db[_0x519b('0x36')][_0x519b('0x34')]({'where':{'type':_0x1227a4,'resourceId':_0x487603['id']}})[_0x519b('0x21')](function(){return _0x1362c0;});})[_0x519b('0x21')](function(){_0x4eae61[_0x519b('0x2b')](0xcc)[_0x519b('0x37')]();});}};}function handleEntityNotFound(_0x38bffd,_0x4172e7){return function(_0x5523fe){if(!_0x5523fe){_0x38bffd[_0x519b('0x2a')](0x194);}return _0x5523fe;};}function handleError(_0x536fb7,_0x467c10){_0x467c10=_0x467c10||0x1f4;return function(_0xdb7004){logger[_0x519b('0x26')](_0xdb7004[_0x519b('0x38')]);if(_0xdb7004[_0x519b('0x39')]){delete _0xdb7004[_0x519b('0x39')];}_0x536fb7['status'](_0x467c10)['send'](_0xdb7004);};}exports[_0x519b('0x3a')]=function(_0x22eb91,_0x1a2a28){var _0x364fa3={'include':[{'model':db[_0x519b('0x3b')],'as':'mandatoryDispositionPause'}]},_0x47fd2d={},_0x1abf88={'count':0x0,'rows':[]};var _0xedba34=_[_0x519b('0x3c')](db[_0x519b('0x3d')]['rawAttributes'],function(_0x463e1f){return{'name':_0x463e1f[_0x519b('0x3e')],'type':_0x463e1f['type'][_0x519b('0x3f')]};});_0x47fd2d[_0x519b('0x40')]=_[_0x519b('0x3c')](_0xedba34,_0x519b('0x39'));_0x47fd2d[_0x519b('0x41')]=_[_0x519b('0x42')](_0x22eb91[_0x519b('0x41')]);_0x47fd2d[_0x519b('0x43')]=_[_0x519b('0x44')](_0x47fd2d[_0x519b('0x40')],_0x47fd2d['query']);_0x364fa3[_0x519b('0x45')]=_[_0x519b('0x44')](_0x47fd2d[_0x519b('0x40')],qs['fields'](_0x22eb91[_0x519b('0x41')][_0x519b('0x46')]));_0x364fa3['attributes']=_0x364fa3[_0x519b('0x45')][_0x519b('0x47')]?_0x364fa3[_0x519b('0x45')]:_0x47fd2d[_0x519b('0x40')];if(!_0x22eb91['query'][_0x519b('0x48')](_0x519b('0x49'))){_0x364fa3[_0x519b('0x2f')]=qs[_0x519b('0x2f')](_0x22eb91['query'][_0x519b('0x2f')]);_0x364fa3[_0x519b('0x2d')]=qs['offset'](_0x22eb91[_0x519b('0x41')][_0x519b('0x2d')]);}_0x364fa3['order']=qs['sort'](_0x22eb91[_0x519b('0x41')][_0x519b('0x4a')]);_0x364fa3[_0x519b('0x4b')]=qs[_0x519b('0x43')](_[_0x519b('0x4c')](_0x22eb91[_0x519b('0x41')],_0x47fd2d[_0x519b('0x43')]),_0xedba34);if(_0x22eb91[_0x519b('0x41')][_0x519b('0x4d')]){_0x364fa3['where']=_[_0x519b('0x4e')](_0x364fa3[_0x519b('0x4b')],{'$or':_[_0x519b('0x3c')](_0xedba34,function(_0x1acea8){if(_0x1acea8['type']!=='VIRTUAL'){var _0x584dc1={};_0x584dc1[_0x1acea8[_0x519b('0x39')]]={'$like':'%'+_0x22eb91[_0x519b('0x41')][_0x519b('0x4d')]+'%'};return _0x584dc1;}})});}_0x364fa3=_[_0x519b('0x4e')]({},_0x364fa3,_0x22eb91[_0x519b('0x4f')]);var _0x37cded={'where':_0x364fa3[_0x519b('0x4b')]};return db['OpenchannelAccount'][_0x519b('0x30')](_0x37cded)[_0x519b('0x21')](function(_0x1cee0c){_0x1abf88[_0x519b('0x30')]=_0x1cee0c;if(_0x22eb91[_0x519b('0x41')][_0x519b('0x50')]){_0x364fa3['include']=[{'all':!![]}];}return db[_0x519b('0x3d')][_0x519b('0x51')](_0x364fa3);})[_0x519b('0x21')](function(_0x384b78){_0x1abf88['rows']=_0x384b78;return _0x1abf88;})['then'](respondWithFilteredResult(_0x1a2a28,_0x364fa3))[_0x519b('0x52')](handleError(_0x1a2a28,null));};exports[_0x519b('0x53')]=function(_0x8a1775,_0x267882){var _0x1488d7={'raw':![],'where':{'id':_0x8a1775['params']['id']},'include':[{'model':db['Pause'],'as':_0x519b('0x54')}]},_0x8348f={};_0x8348f[_0x519b('0x40')]=_['keys'](db[_0x519b('0x3d')][_0x519b('0x55')]);_0x8348f[_0x519b('0x41')]=_[_0x519b('0x42')](_0x8a1775[_0x519b('0x41')]);_0x8348f[_0x519b('0x43')]=_[_0x519b('0x44')](_0x8348f['model'],_0x8348f[_0x519b('0x41')]);_0x1488d7[_0x519b('0x45')]=_['intersection'](_0x8348f[_0x519b('0x40')],qs[_0x519b('0x46')](_0x8a1775[_0x519b('0x41')][_0x519b('0x46')]));_0x1488d7[_0x519b('0x45')]=_0x1488d7[_0x519b('0x45')][_0x519b('0x47')]?_0x1488d7[_0x519b('0x45')]:_0x8348f[_0x519b('0x40')];if(_0x8a1775['query'][_0x519b('0x50')]){_0x1488d7[_0x519b('0x56')]=[{'all':!![]}];}_0x1488d7=_[_0x519b('0x4e')]({},_0x1488d7,_0x8a1775[_0x519b('0x4f')]);return db[_0x519b('0x3d')][_0x519b('0x57')](_0x1488d7)[_0x519b('0x21')](handleEntityNotFound(_0x267882,null))[_0x519b('0x21')](respondWithResult(_0x267882,null))[_0x519b('0x52')](handleError(_0x267882,null));};exports[_0x519b('0x58')]=function(_0x1b0a77,_0x418a70){return db[_0x519b('0x3d')][_0x519b('0x58')](_0x1b0a77['body'],{})[_0x519b('0x21')](function(_0x5400ca){var _0x37ed23=_0x1b0a77['user'][_0x519b('0x35')]({'plain':!![]});if(!_0x37ed23)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x37ed23[_0x519b('0x59')]===_0x519b('0x5a')){var _0x151900=_0x5400ca[_0x519b('0x35')]({'plain':!![]});var _0x88756e=_0x519b('0x5b');return db[_0x519b('0x5c')][_0x519b('0x57')]({'where':{'name':_0x88756e,'userProfileId':_0x37ed23[_0x519b('0x5d')]},'raw':!![]})[_0x519b('0x21')](function(_0x45c640){if(_0x45c640&&_0x45c640[_0x519b('0x5e')]===0x0){return db['UserProfileResource'][_0x519b('0x58')]({'name':_0x151900[_0x519b('0x39')],'resourceId':_0x151900['id'],'type':_0x45c640[_0x519b('0x39')],'sectionId':_0x45c640['id']},{})[_0x519b('0x21')](function(){return _0x5400ca;});}else{return _0x5400ca;}})[_0x519b('0x52')](function(_0x45872e){logger[_0x519b('0x26')](_0x519b('0x5f'),_0x45872e);throw _0x45872e;});}return _0x5400ca;})[_0x519b('0x21')](respondWithResult(_0x418a70,0xc9))['catch'](handleError(_0x418a70,null));};exports['update']=function(_0x37ce2d,_0x3b4e3a){if(_0x37ce2d[_0x519b('0x60')]['id']){delete _0x37ce2d['body']['id'];}return db[_0x519b('0x3d')]['find']({'where':{'id':_0x37ce2d[_0x519b('0x61')]['id']},'include':[{'model':db['Pause'],'as':_0x519b('0x54')}]})['then'](handleEntityNotFound(_0x3b4e3a,null))[_0x519b('0x21')](saveUpdates(_0x37ce2d['body'],null))[_0x519b('0x21')](respondWithResult(_0x3b4e3a,null))['catch'](handleError(_0x3b4e3a,null));};exports[_0x519b('0x34')]=function(_0x3b37a2,_0xfdef39){return db[_0x519b('0x3d')][_0x519b('0x57')]({'where':{'id':_0x3b37a2[_0x519b('0x61')]['id']}})[_0x519b('0x21')](handleEntityNotFound(_0xfdef39,null))[_0x519b('0x21')](removeEntity(_0xfdef39,null))[_0x519b('0x52')](handleError(_0xfdef39,null));};exports['describe']=function(_0x55f4fd,_0x30e3bf){return db[_0x519b('0x3d')][_0x519b('0x62')]()[_0x519b('0x21')](respondWithResult(_0x30e3bf,null))[_0x519b('0x52')](handleError(_0x30e3bf,null));};exports['addDisposition']=function(_0x2595e6,_0xc827e3,_0x3d23e5){if(_0x2595e6[_0x519b('0x60')]['id']){delete _0x2595e6[_0x519b('0x60')]['id'];}return db[_0x519b('0x3d')]['find']({'where':{'id':_0x2595e6[_0x519b('0x61')]['id']}})[_0x519b('0x21')](handleEntityNotFound(_0xc827e3,null))[_0x519b('0x21')](function(_0x3a2805){if(_0x3a2805){_0x2595e6['body'][_0x519b('0x63')]=_0x3a2805['id'];return db[_0x519b('0x64')][_0x519b('0x58')](_0x2595e6['body']);}})[_0x519b('0x21')](respondWithResult(_0xc827e3,null))[_0x519b('0x52')](handleError(_0xc827e3,null));};exports[_0x519b('0x65')]=function(_0x3401b7,_0x169e53,_0x5a496b){var _0x25fc60={'raw':![],'where':{}};var _0x389f2c={};var _0x4beb6c={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x519b('0x66')]({'where':{'id':_0x3401b7[_0x519b('0x61')]['id']}})['then'](handleEntityNotFound(_0x169e53,null))[_0x519b('0x21')](function(_0x15da5d){if(_0x15da5d){_0x389f2c[_0x519b('0x40')]=_[_0x519b('0x42')](db['Disposition']['rawAttributes']);_0x389f2c[_0x519b('0x41')]=_[_0x519b('0x42')](_0x3401b7[_0x519b('0x41')]);_0x389f2c[_0x519b('0x43')]=_[_0x519b('0x44')](_0x389f2c['model'],_0x389f2c['query']);_0x25fc60[_0x519b('0x45')]=_['intersection'](_0x389f2c[_0x519b('0x40')],qs[_0x519b('0x46')](_0x3401b7[_0x519b('0x41')][_0x519b('0x46')]));_0x25fc60['attributes']=_0x25fc60[_0x519b('0x45')][_0x519b('0x47')]?_0x25fc60[_0x519b('0x45')]:_0x389f2c['model'];if(!_0x3401b7[_0x519b('0x41')][_0x519b('0x48')](_0x519b('0x49'))){_0x25fc60[_0x519b('0x2f')]=qs['limit'](_0x3401b7[_0x519b('0x41')]['limit']);_0x25fc60['offset']=qs['offset'](_0x3401b7[_0x519b('0x41')][_0x519b('0x2d')]);}_0x25fc60[_0x519b('0x67')]=qs[_0x519b('0x4a')](_0x3401b7['query'][_0x519b('0x4a')]);_0x25fc60[_0x519b('0x4b')]=qs[_0x519b('0x43')](_[_0x519b('0x4c')](_0x3401b7[_0x519b('0x41')],_0x389f2c[_0x519b('0x43')]));_0x25fc60['where'][_0x519b('0x63')]=_0x15da5d['id'];if(_0x3401b7['query'][_0x519b('0x4d')]){_0x25fc60['where']=_[_0x519b('0x4e')](_0x25fc60[_0x519b('0x4b')],{'$or':_[_0x519b('0x3c')](_0x25fc60[_0x519b('0x45')],function(_0x2d9fb4){var _0x3c8e8d={};_0x3c8e8d[_0x2d9fb4]={'$like':'%'+_0x3401b7[_0x519b('0x41')]['filter']+'%'};return _0x3c8e8d;})});}_0x25fc60=_['merge']({},_0x25fc60,_0x3401b7[_0x519b('0x4f')]);return db[_0x519b('0x64')][_0x519b('0x30')]({'where':_0x25fc60[_0x519b('0x4b')]})[_0x519b('0x21')](function(_0x15874d){_0x4beb6c['count']=_0x15874d;if(_0x3401b7[_0x519b('0x41')][_0x519b('0x50')]){_0x25fc60['include']=[{'all':!![]}];}return db['Disposition'][_0x519b('0x51')](_0x25fc60);})[_0x519b('0x21')](function(_0x37cd15){_0x4beb6c[_0x519b('0x68')]=_0x37cd15;return _0x4beb6c;});}})[_0x519b('0x21')](respondWithFilteredResult(_0x169e53,_0x25fc60))['catch'](handleError(_0x169e53,null));};exports[_0x519b('0x69')]=function(_0x37c1f9,_0x1b9e74,_0x35ddf8){return db[_0x519b('0x3d')][_0x519b('0x57')]({'where':{'id':_0x37c1f9[_0x519b('0x61')]['id']}})[_0x519b('0x21')](handleEntityNotFound(_0x1b9e74,null))['then'](function(_0x4d7fc8){if(_0x4d7fc8){return _0x4d7fc8[_0x519b('0x69')](_0x37c1f9[_0x519b('0x41')]['ids']);}})[_0x519b('0x21')](respondWithStatusCode(_0x1b9e74,null))['catch'](handleError(_0x1b9e74,null));};exports[_0x519b('0x6a')]=function(_0x4e7ac8,_0x4f9088,_0x4093d6){if(_0x4e7ac8[_0x519b('0x60')]['id']){delete _0x4e7ac8['body']['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x4e7ac8[_0x519b('0x61')]['id']}})[_0x519b('0x21')](handleEntityNotFound(_0x4f9088,null))[_0x519b('0x21')](function(_0x3e9da1){if(_0x3e9da1){_0x4e7ac8[_0x519b('0x60')][_0x519b('0x63')]=_0x3e9da1['id'];return db[_0x519b('0x6b')][_0x519b('0x58')](_0x4e7ac8[_0x519b('0x60')]);}})['then'](respondWithResult(_0x4f9088,null))['catch'](handleError(_0x4f9088,null));};exports['getAnswers']=function(_0x536c6c,_0x1ebcfb,_0x4e2ed8){var _0x35649c={'raw':![],'where':{}};var _0x292bce={};var _0x11f8eb={'count':0x0,'rows':[]};return db[_0x519b('0x3d')][_0x519b('0x66')]({'where':{'id':_0x536c6c[_0x519b('0x61')]['id']}})[_0x519b('0x21')](handleEntityNotFound(_0x1ebcfb,null))[_0x519b('0x21')](function(_0x2522a2){if(_0x2522a2){_0x292bce[_0x519b('0x40')]=_['keys'](db[_0x519b('0x6b')][_0x519b('0x55')]);_0x292bce[_0x519b('0x41')]=_['keys'](_0x536c6c[_0x519b('0x41')]);_0x292bce['filters']=_[_0x519b('0x44')](_0x292bce[_0x519b('0x40')],_0x292bce[_0x519b('0x41')]);_0x35649c['attributes']=_[_0x519b('0x44')](_0x292bce[_0x519b('0x40')],qs[_0x519b('0x46')](_0x536c6c['query'][_0x519b('0x46')]));_0x35649c[_0x519b('0x45')]=_0x35649c[_0x519b('0x45')][_0x519b('0x47')]?_0x35649c[_0x519b('0x45')]:_0x292bce['model'];if(!_0x536c6c['query'][_0x519b('0x48')](_0x519b('0x49'))){_0x35649c[_0x519b('0x2f')]=qs[_0x519b('0x2f')](_0x536c6c[_0x519b('0x41')][_0x519b('0x2f')]);_0x35649c[_0x519b('0x2d')]=qs[_0x519b('0x2d')](_0x536c6c['query']['offset']);}_0x35649c[_0x519b('0x67')]=qs[_0x519b('0x4a')](_0x536c6c['query'][_0x519b('0x4a')]);_0x35649c[_0x519b('0x4b')]=qs['filters'](_['pick'](_0x536c6c[_0x519b('0x41')],_0x292bce['filters']));_0x35649c[_0x519b('0x4b')][_0x519b('0x63')]=_0x2522a2['id'];if(_0x536c6c[_0x519b('0x41')][_0x519b('0x4d')]){_0x35649c[_0x519b('0x4b')]=_[_0x519b('0x4e')](_0x35649c[_0x519b('0x4b')],{'$or':_[_0x519b('0x3c')](_0x35649c['attributes'],function(_0x470db7){var _0x3ec3d7={};_0x3ec3d7[_0x470db7]={'$like':'%'+_0x536c6c[_0x519b('0x41')]['filter']+'%'};return _0x3ec3d7;})});}_0x35649c=_[_0x519b('0x4e')]({},_0x35649c,_0x536c6c[_0x519b('0x4f')]);return db[_0x519b('0x6b')][_0x519b('0x30')]({'where':_0x35649c[_0x519b('0x4b')]})['then'](function(_0x4df3ba){_0x11f8eb[_0x519b('0x30')]=_0x4df3ba;if(_0x536c6c[_0x519b('0x41')][_0x519b('0x50')]){_0x35649c[_0x519b('0x56')]=[{'all':!![]}];}return db['CannedAnswer'][_0x519b('0x51')](_0x35649c);})['then'](function(_0x197be0){_0x11f8eb[_0x519b('0x68')]=_0x197be0;return _0x11f8eb;});}})[_0x519b('0x21')](respondWithFilteredResult(_0x1ebcfb,_0x35649c))['catch'](handleError(_0x1ebcfb,null));};exports[_0x519b('0x6c')]=function(_0x1de959,_0x54e715,_0x2aee26){return db[_0x519b('0x3d')][_0x519b('0x57')]({'where':{'id':_0x1de959[_0x519b('0x61')]['id']}})[_0x519b('0x21')](handleEntityNotFound(_0x54e715,null))[_0x519b('0x21')](function(_0x1be489){if(_0x1be489){return _0x1be489[_0x519b('0x6c')](_0x1de959[_0x519b('0x41')]['ids']);}})[_0x519b('0x21')](respondWithStatusCode(_0x54e715,null))['catch'](handleError(_0x54e715,null));};exports[_0x519b('0x6d')]=function(_0x385d5b,_0x15789f,_0x3849f3){var _0x46c140={'body':_0x385d5b['body'],'channel':_0x519b('0x6e')};var _0x533182=[];var _0x858911=[];var _0x54ef87={};var _0x406152=![];return db[_0x519b('0x6f')][_0x519b('0x62')]()['then'](function(_0x12fc44){if(!_0x12fc44){throw new db[(_0x519b('0x70'))][(_0x519b('0x71'))](_0x519b('0x72'));}_0x533182=_[_0x519b('0x73')](_[_0x519b('0x42')](_0x12fc44),['createdAt',_0x519b('0x74')]);_0x858911=_[_0x519b('0x73')](_[_0x519b('0x42')](_0x12fc44),['createdAt','updatedAt',_0x519b('0x75'),_0x519b('0x76')]);if(_0x385d5b[_0x519b('0x60')]['id']){delete _0x385d5b[_0x519b('0x60')]['id'];}if(_[_0x519b('0x77')](_0x385d5b[_0x519b('0x60')]['from'])){throw new db[(_0x519b('0x70'))]['ValidationError']('from\x20is\x20mandatory');}if(_['isNil'](_0x385d5b['body'][_0x519b('0x60')])||_0x385d5b[_0x519b('0x60')][_0x519b('0x60')]===''){throw new db[(_0x519b('0x70'))][(_0x519b('0x71'))](_0x519b('0x78'));}if(_['isNil'](_0x385d5b[_0x519b('0x60')][_0x519b('0x79')])){throw new db[(_0x519b('0x70'))][(_0x519b('0x71'))](_0x519b('0x7a')+_0x858911);}if(!_['includes'](_0x858911,_0x385d5b[_0x519b('0x60')][_0x519b('0x79')])){throw new db[(_0x519b('0x70'))][(_0x519b('0x71'))](_0x519b('0x7b')+_0x858911);}_0x54ef87[_0x385d5b[_0x519b('0x60')][_0x519b('0x79')]]=_0x385d5b[_0x519b('0x60')][_0x519b('0x7c')];})[_0x519b('0x21')](function(){return db[_0x519b('0x3d')][_0x519b('0x57')]({'where':{'id':_0x385d5b['params']['id']},'include':[{'model':db['CmList'],'as':_0x519b('0x7d'),'include':[{'model':db[_0x519b('0x6f')],'as':'Contacts','where':_0x54ef87,'limit':0x1,'order':[[_0x519b('0x74'),_0x519b('0x7e')]]}]},{'model':db[_0x519b('0x7f')],'as':_0x519b('0x80')}]});})[_0x519b('0x21')](handleEntityNotFound(_0x15789f,null))['then'](function(_0x4cd343){if(_0x4cd343&&_0x4cd343[_0x519b('0x7d')]){_0x46c140[_0x519b('0x81')]=_0x4cd343;_0x46c140[_0x519b('0x82')]=_0x4cd343[_0x519b('0x80')];_0x46c140['list']=_0x4cd343['List'];_0x46c140[_0x519b('0x82')]=_[_0x519b('0x83')](_0x46c140[_0x519b('0x82')],[_0x519b('0x84')],[_0x519b('0x85')]);if(_0x46c140['account'][_0x519b('0x80')]){delete _0x46c140[_0x519b('0x81')]['Applications'];}if(_0x46c140[_0x519b('0x81')]['List']&&_0x46c140[_0x519b('0x81')][_0x519b('0x7d')]['Contacts'][_0x519b('0x47')]){return _0x46c140[_0x519b('0x81')][_0x519b('0x7d')][_0x519b('0x86')][0x0];}var _0x519bd3=_[_0x519b('0x19')](_0x385d5b[_0x519b('0x60')],{'firstName':_0x385d5b[_0x519b('0x60')][_0x519b('0x7c')],'ListId':_0x4cd343[_0x519b('0x76')]});_0x519bd3[_0x385d5b[_0x519b('0x60')][_0x519b('0x79')]]=_0x385d5b[_0x519b('0x60')][_0x519b('0x7c')];return db[_0x519b('0x6f')]['create'](_0x519bd3,{'fields':_0x533182,'raw':!![]});}})[_0x519b('0x21')](handleEntityNotFound(_0x15789f,null))[_0x519b('0x21')](function(_0x588040){_0x46c140['contact']=_0x588040;if(_0x588040){var _0x1915f9={'ContactId':_0x588040['id'],'OpenchannelAccountId':_0x385d5b[_0x519b('0x61')]['id'],'from':(_0x588040['firstName']||'')+'\x20'+(_0x588040[_0x519b('0x87')]||'')};var _0x5690b4={'OpenchannelAccountId':_0x385d5b[_0x519b('0x61')]['id'],'closed':![]};if(_0x385d5b['body'][_0x519b('0x88')]){_0x5690b4[_0x519b('0x88')]=_0x385d5b[_0x519b('0x60')][_0x519b('0x88')];return db['OpenchannelInteraction'][_0x519b('0x57')]({'where':_0x5690b4})[_0x519b('0x21')](function(_0x3f01cf){if(_0x3f01cf){return[_0x3f01cf,![]];}_0x1915f9[_0x519b('0x88')]=_0x385d5b['body'][_0x519b('0x88')];_0x1915f9['externalUrl']=_0x385d5b['body']['externalUrl'];return db['OpenchannelInteraction'][_0x519b('0x58')](_0x1915f9)['then'](function(_0x48d55f){return[_0x48d55f,!![]];});});}else{_0x5690b4[_0x519b('0x88')]=null;}_0x5690b4[_0x519b('0x89')]=_0x588040['id'];return db['OpenchannelInteraction'][_0x519b('0x57')]({'where':_0x5690b4})[_0x519b('0x21')](function(_0x504633){if(_0x504633){return[_0x504633,![]];}return db[_0x519b('0x8a')]['create'](_0x1915f9)[_0x519b('0x21')](function(_0x2ce147){return[_0x2ce147,!![]];});});}})['spread'](function(_0x5ba252,_0x1964a5){if(_0x5ba252){_0x406152=_0x1964a5;if(!_0x1964a5){var _0x755665={'from':(_0x46c140[_0x519b('0x8b')][_0x519b('0x8c')]||'')+'\x20'+(_0x46c140['contact'][_0x519b('0x87')]||'')};if(_0x385d5b['body'][_0x519b('0x88')]&&_0x385d5b[_0x519b('0x60')][_0x519b('0x8d')]&&_0x385d5b[_0x519b('0x60')][_0x519b('0x88')]!=_0x385d5b[_0x519b('0x60')][_0x519b('0x8d')]){_0x755665['threadId']=_0x385d5b[_0x519b('0x60')][_0x519b('0x8d')];}return _0x5ba252['update'](_0x755665);}else{return _0x5ba252;}}})[_0x519b('0x21')](function(_0x4c976d){_0x46c140[_0x519b('0x8e')]=_0x4c976d[_0x519b('0x35')]({'plain':!![]});_0x46c140['interaction']['created']=_0x406152;if(_0x46c140[_0x519b('0x8e')][_0x519b('0x8f')]){if(_0x46c140[_0x519b('0x81')][_0x519b('0x90')]){_0x46c140[_0x519b('0x82')][_0x519b('0x91')]({'id':0x0,'priority':_0x46c140['applications'][_0x519b('0x47')]+0x1,'app':_0x519b('0x92'),'appdata':'unmanaged','interval':_0x519b('0x93')});}}return db[_0x519b('0x94')][_0x519b('0x58')]({'body':_0x385d5b['body'][_0x519b('0x60')],'OpenchannelAccountId':_0x385d5b['params']['id'],'OpenchannelInteractionId':_0x4c976d['id'],'direction':'in','ContactId':_0x46c140[_0x519b('0x8b')]['id'],'AttachmentId':_0x385d5b[_0x519b('0x60')][_0x519b('0x95')]});})[_0x519b('0x21')](function(_0x322093){_0x46c140[_0x519b('0x28')]=_0x322093;if(!_0x46c140[_0x519b('0x8e')][_0x519b('0x96')])return;return db['User'][_0x519b('0x57')]({'attributes':['id','name'],'where':{'id':_0x46c140[_0x519b('0x8e')][_0x519b('0x96')]}});})[_0x519b('0x21')](function(_0x4bfcaf){if(_0x4bfcaf){_0x46c140['applications'][_0x519b('0x97')]({'id':0x0,'priority':0x0,'app':_0x519b('0x98'),'appdata':_0x4bfcaf[_0x519b('0x39')]+','+(_0x46c140[_0x519b('0x81')][_0x519b('0x99')]||0xa),'interval':_0x519b('0x93')});}if(!_0x46c140[_0x519b('0x8e')][_0x519b('0x9a')])return;return db[_0x519b('0x9b')][_0x519b('0x57')]({'attributes':['id',_0x519b('0x39')],'where':{'id':_0x46c140['interaction']['queueId']}});})[_0x519b('0x21')](function(_0x4826e4){if(_0x4826e4){_0x46c140[_0x519b('0x82')][_0x519b('0x97')]({'id':0x0,'priority':0x1,'app':_0x519b('0x9c'),'appdata':_0x4826e4['name']+','+(_0x46c140[_0x519b('0x81')][_0x519b('0x9d')]||0x12c),'interval':_0x519b('0x93')});}return respondWithRpcPromise(_0x519b('0x9e'),_0x519b('0x9f'),_0x46c140);})[_0x519b('0x21')](function(_0x2411bd){respondWithRpcPromise(_0x519b('0xa0'),_0x519b('0xa0'),{'event':_0x519b('0x6d'),'message':_0x2411bd},client9002);return _0x2411bd;})[_0x519b('0x21')](respondWithResult(_0x15789f,null))['catch'](handleError(_0x15789f,null));};exports[_0x519b('0xa1')]=function(_0x290d44,_0x246d0e){var _0x40b310=_0x290d44[_0x519b('0x61')]['id'];var _0x445a31=_0x290d44[_0x519b('0x60')];var _0x291c18=0xc8;var _0x1ee526=null;return db['sequelize']['transaction']({'isolationLevel':db['sequelize'][_0x519b('0xa2')]['ISOLATION_LEVELS'][_0x519b('0xa3')]},function(_0x261f98){return db[_0x519b('0x3d')][_0x519b('0x66')]({'where':{'id':_0x40b310},'transaction':_0x261f98})['then'](function(_0xde3c07){if(_0xde3c07){return db[_0x519b('0x7f')]['destroy']({'where':{'OpenchannelAccountId':_0x40b310},'transaction':_0x261f98})[_0x519b('0x21')](function(){var _0x24c2c9=_['map'](_0x445a31,function(_0x13a481){_0x13a481[_0x519b('0x63')]=_0x40b310;return _0x13a481;});return db[_0x519b('0x7f')]['bulkCreate'](_0x24c2c9,{'transaction':_0x261f98});});}else{_0x291c18=0x194;_0x1ee526=[];}});})['then'](function(){if(_0x291c18!==0x194){return db['OpenchannelApplication']['findAndCountAll']({'where':{'OpenchannelAccountId':_0x40b310},'order':_0x519b('0x84')})[_0x519b('0x21')](function(_0x318b5f){_0x1ee526=_0x318b5f;});}})['catch'](function(_0x34c6af){_0x291c18=0x1f4;logger[_0x519b('0x26')](_0x34c6af[_0x519b('0x38')]);if(_0x34c6af[_0x519b('0x39')]){delete _0x34c6af[_0x519b('0x39')];}_0x1ee526=_0x34c6af;})[_0x519b('0xa4')](function(){if(_0x1ee526===null){_0x246d0e[_0x519b('0x2a')](_0x291c18);}else{if(_0x291c18===0x1f4){_0x246d0e['status'](_0x291c18)[_0x519b('0xa5')](_0x1ee526);}else{_0x246d0e[_0x519b('0x2b')](_0x291c18)[_0x519b('0x2c')](_0x1ee526);}}});};exports[_0x519b('0xa6')]=function(_0x2a2d52,_0x406372,_0x3fb7e0){var _0x1f1a65={};var _0x1f59c7={};var _0x59651c;var _0x50649c;return db[_0x519b('0x3d')]['findOne']({'where':{'id':_0x2a2d52['params']['id']}})[_0x519b('0x21')](handleEntityNotFound(_0x406372,null))[_0x519b('0x21')](function(_0x99f4cc){if(_0x99f4cc){_0x59651c=_0x99f4cc;_0x1f59c7[_0x519b('0x40')]=_[_0x519b('0x42')](db[_0x519b('0x7f')][_0x519b('0x55')]);_0x1f59c7['query']=_['keys'](_0x2a2d52[_0x519b('0x41')]);_0x1f59c7['filters']=_[_0x519b('0x44')](_0x1f59c7['model'],_0x1f59c7[_0x519b('0x41')]);_0x1f1a65[_0x519b('0x45')]=_['intersection'](_0x1f59c7['model'],qs[_0x519b('0x46')](_0x2a2d52[_0x519b('0x41')][_0x519b('0x46')]));_0x1f1a65[_0x519b('0x45')]=_0x1f1a65['attributes'][_0x519b('0x47')]?_0x1f1a65['attributes']:_0x1f59c7[_0x519b('0x40')];_0x1f1a65[_0x519b('0x67')]=qs[_0x519b('0x4a')](_0x2a2d52[_0x519b('0x41')][_0x519b('0x4a')]);_0x1f1a65[_0x519b('0x4b')]=qs['filters'](_['pick'](_0x2a2d52[_0x519b('0x41')],_0x1f59c7[_0x519b('0x43')]));if(_0x2a2d52[_0x519b('0x41')][_0x519b('0x4d')]){_0x1f1a65[_0x519b('0x4b')]=_[_0x519b('0x4e')](_0x1f1a65['where'],{'$or':_[_0x519b('0x3c')](_0x1f1a65[_0x519b('0x45')],function(_0xb05d01){var _0xac855f={};_0xac855f[_0xb05d01]={'$like':'%'+_0x2a2d52['query'][_0x519b('0x4d')]+'%'};return _0xac855f;})});}_0x1f1a65=_['merge']({},_0x1f1a65,_0x2a2d52[_0x519b('0x4f')]);return _0x59651c[_0x519b('0xa6')](_0x1f1a65);}})[_0x519b('0x21')](function(_0xe7c8fa){if(_0xe7c8fa){_0x50649c=_0xe7c8fa[_0x519b('0x47')];if(!_0x2a2d52[_0x519b('0x41')][_0x519b('0x48')](_0x519b('0x49'))){_0x1f1a65[_0x519b('0x2f')]=qs[_0x519b('0x2f')](_0x2a2d52[_0x519b('0x41')][_0x519b('0x2f')]);_0x1f1a65[_0x519b('0x2d')]=qs[_0x519b('0x2d')](_0x2a2d52['query'][_0x519b('0x2d')]);}return _0x59651c[_0x519b('0xa6')](_0x1f1a65);}})[_0x519b('0x21')](function(_0x4b60ea){if(_0x4b60ea){return _0x4b60ea?{'count':_0x50649c,'rows':_0x4b60ea}:null;}})[_0x519b('0x21')](respondWithResult(_0x406372,null))[_0x519b('0x52')](handleError(_0x406372,null));};exports[_0x519b('0xa7')]=function(_0x2abe1b,_0x14fcef,_0x1ca9c8){var _0x50d1e1={'raw':![],'where':{}};var _0x581d5a={};var _0x5d3de9={'count':0x0,'rows':[]};return db[_0x519b('0x3d')]['findOne']({'where':{'id':_0x2abe1b[_0x519b('0x61')]['id']}})[_0x519b('0x21')](handleEntityNotFound(_0x14fcef,null))[_0x519b('0x21')](function(_0x156063){if(_0x156063){_0x581d5a[_0x519b('0x40')]=_['keys'](db['OpenchannelInteraction'][_0x519b('0x55')]);_0x581d5a[_0x519b('0x41')]=_[_0x519b('0x42')](_0x2abe1b[_0x519b('0x41')]);_0x581d5a['filters']=_['intersection'](_0x581d5a[_0x519b('0x40')],_0x581d5a[_0x519b('0x41')]);_0x50d1e1[_0x519b('0x45')]=_[_0x519b('0x44')](_0x581d5a['model'],qs[_0x519b('0x46')](_0x2abe1b['query'][_0x519b('0x46')]));_0x50d1e1[_0x519b('0x45')]=_0x50d1e1[_0x519b('0x45')][_0x519b('0x47')]?_0x50d1e1[_0x519b('0x45')]:_0x581d5a['model'];if(!_0x2abe1b['query'][_0x519b('0x48')](_0x519b('0x49'))){_0x50d1e1[_0x519b('0x2f')]=qs[_0x519b('0x2f')](_0x2abe1b[_0x519b('0x41')][_0x519b('0x2f')]);_0x50d1e1['offset']=qs['offset'](_0x2abe1b[_0x519b('0x41')]['offset']);}_0x50d1e1[_0x519b('0x67')]=qs['sort'](_0x2abe1b[_0x519b('0x41')][_0x519b('0x4a')]);_0x50d1e1[_0x519b('0x4b')]=qs[_0x519b('0x43')](_['pick'](_0x2abe1b[_0x519b('0x41')],_0x581d5a['filters']));_0x50d1e1[_0x519b('0x4b')][_0x519b('0x63')]=_0x156063['id'];if(_0x2abe1b['query'][_0x519b('0x4d')]){_0x50d1e1[_0x519b('0x4b')]=_[_0x519b('0x4e')](_0x50d1e1[_0x519b('0x4b')],{'$or':_[_0x519b('0x3c')](_0x50d1e1[_0x519b('0x45')],function(_0x4d418f){var _0x2806c4={};_0x2806c4[_0x4d418f]={'$like':'%'+_0x2abe1b[_0x519b('0x41')][_0x519b('0x4d')]+'%'};return _0x2806c4;})});}_0x50d1e1=_[_0x519b('0x4e')]({},_0x50d1e1,_0x2abe1b[_0x519b('0x4f')]);return db[_0x519b('0x8a')][_0x519b('0x30')]({'where':_0x50d1e1['where']})[_0x519b('0x21')](function(_0x130b14){_0x5d3de9['count']=_0x130b14;if(_0x2abe1b['query']['includeAll']){_0x50d1e1['include']=[{'model':db[_0x519b('0x6f')],'as':_0x519b('0xa8'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x519b('0x39'),_0x519b('0xa9'),'internal'],'required':![]},{'model':db[_0x519b('0xaa')],'as':_0x519b('0xab'),'attributes':['id',_0x519b('0x39'),_0x519b('0xac')],'where':_0x2abe1b['query'][_0x519b('0xad')]?{'id':_0x2abe1b[_0x519b('0x41')][_0x519b('0xad')]}:undefined,'required':_0x2abe1b[_0x519b('0x41')][_0x519b('0xad')]?!![]:![]}];}return db['OpenchannelInteraction']['findAll'](_0x50d1e1);})[_0x519b('0x21')](function(_0x588e35){_0x5d3de9[_0x519b('0x68')]=_0x588e35;return _0x5d3de9;});}})['then'](respondWithFilteredResult(_0x14fcef,_0x50d1e1))['catch'](handleError(_0x14fcef,null));};exports[_0x519b('0xae')]=function(_0x231fd3,_0x177bae,_0x510d6e){return db[_0x519b('0x3d')][_0x519b('0x57')]({'where':{'id':_0x231fd3[_0x519b('0x61')]['id']}})[_0x519b('0x21')](handleEntityNotFound(_0x177bae,null))[_0x519b('0x21')](function(_0x4a4434){if(_0x4a4434){return _0x4a4434['addAgents'](_0x231fd3[_0x519b('0x60')][_0x519b('0xaf')],_[_0x519b('0xb0')](_0x231fd3[_0x519b('0x60')],[_0x519b('0xaf'),'id'])||{})[_0x519b('0xb1')](function(_0x23f4bd){for(var _0x5d847b=0x0;_0x5d847b<_0x231fd3[_0x519b('0x60')][_0x519b('0xaf')][_0x519b('0x47')];_0x5d847b+=0x1){socket[_0x519b('0xb2')]('userOpenchannelAccount:save',{'UserId':Number(_0x231fd3[_0x519b('0x60')][_0x519b('0xaf')][_0x5d847b]),'OpenchannelAccountId':Number(_0x231fd3[_0x519b('0x61')]['id'])});}return _0x23f4bd;});}})[_0x519b('0x21')](respondWithResult(_0x177bae,null))[_0x519b('0x52')](handleError(_0x177bae,null));};exports[_0x519b('0xb3')]=function(_0x2abd94,_0x5d852a,_0x4dc4a0){return db['OpenchannelAccount']['find']({'where':{'id':_0x2abd94[_0x519b('0x61')]['id']}})[_0x519b('0x21')](handleEntityNotFound(_0x5d852a,null))[_0x519b('0x21')](function(_0x56d8d9){if(_0x56d8d9){return _0x56d8d9['removeAgents'](_0x2abd94[_0x519b('0x41')]['ids'])[_0x519b('0x21')](function(){if(_[_0x519b('0xb4')](_0x2abd94['query']['ids'])){for(var _0xddddbd=0x0;_0xddddbd<_0x2abd94[_0x519b('0x41')][_0x519b('0xaf')][_0x519b('0x47')];_0xddddbd+=0x1){socket[_0x519b('0xb2')](_0x519b('0xb5'),{'UserId':Number(_0x2abd94[_0x519b('0x41')][_0x519b('0xaf')][_0xddddbd]),'OpenchannelAccountId':Number(_0x2abd94[_0x519b('0x61')]['id'])});}}else{socket['emit'](_0x519b('0xb5'),{'UserId':Number(_0x2abd94[_0x519b('0x41')]['ids']),'OpenchannelAccountId':Number(_0x2abd94[_0x519b('0x61')]['id'])});}});}})[_0x519b('0x21')](respondWithStatusCode(_0x5d852a,null))[_0x519b('0x52')](handleError(_0x5d852a,null));};exports[_0x519b('0xb6')]=function(_0x29c00d,_0x19a21c,_0x531475){var _0x45e221={};var _0x3a5c2f={};var _0x14eecb;var _0x4784a9;return db[_0x519b('0x3d')][_0x519b('0x66')]({'where':{'id':_0x29c00d[_0x519b('0x61')]['id']}})[_0x519b('0x21')](handleEntityNotFound(_0x19a21c,null))[_0x519b('0x21')](function(_0x32701a){if(_0x32701a){_0x14eecb=_0x32701a;_0x3a5c2f['model']=_[_0x519b('0x42')](db[_0x519b('0xb7')][_0x519b('0x55')]);_0x3a5c2f['query']=_[_0x519b('0x42')](_0x29c00d[_0x519b('0x41')]);_0x3a5c2f['filters']=_['intersection'](_0x3a5c2f[_0x519b('0x40')],_0x3a5c2f[_0x519b('0x41')]);_0x45e221['attributes']=_['intersection'](_0x3a5c2f[_0x519b('0x40')],qs[_0x519b('0x46')](_0x29c00d['query'][_0x519b('0x46')]));_0x45e221[_0x519b('0x45')]=_0x45e221[_0x519b('0x45')][_0x519b('0x47')]?_0x45e221[_0x519b('0x45')]:_0x3a5c2f['model'];_0x45e221['order']=qs[_0x519b('0x4a')](_0x29c00d[_0x519b('0x41')][_0x519b('0x4a')]);_0x45e221[_0x519b('0x4b')]=qs['filters'](_['pick'](_0x29c00d[_0x519b('0x41')],_0x3a5c2f[_0x519b('0x43')]));if(_0x29c00d[_0x519b('0x41')][_0x519b('0x4d')]){_0x45e221[_0x519b('0x4b')]=_['merge'](_0x45e221['where'],{'$or':_['map'](_0x45e221[_0x519b('0x45')],function(_0x141d79){var _0x34c569={};_0x34c569[_0x141d79]={'$like':'%'+_0x29c00d['query']['filter']+'%'};return _0x34c569;})});}_0x45e221=_[_0x519b('0x4e')]({},_0x45e221,_0x29c00d[_0x519b('0x4f')]);return _0x14eecb[_0x519b('0xb6')](_0x45e221);}})[_0x519b('0x21')](function(_0x3a42b9){if(_0x3a42b9){_0x4784a9=_0x3a42b9[_0x519b('0x47')];if(!_0x29c00d['query'][_0x519b('0x48')]('nolimit')){_0x45e221[_0x519b('0x2f')]=qs[_0x519b('0x2f')](_0x29c00d[_0x519b('0x41')]['limit']);_0x45e221['offset']=qs[_0x519b('0x2d')](_0x29c00d[_0x519b('0x41')][_0x519b('0x2d')]);}return _0x14eecb[_0x519b('0xb6')](_0x45e221);}})['then'](function(_0x3c36ed){if(_0x3c36ed){return _0x3c36ed?{'count':_0x4784a9,'rows':_0x3c36ed}:null;}})[_0x519b('0x21')](respondWithResult(_0x19a21c,null))['catch'](handleError(_0x19a21c,null));};exports[_0x519b('0xa5')]=function(_0x16c9da,_0x429ba7,_0x13eb4a){var _0x3a1d18,_0x2d57d4,_0x2ec6d9;if(_[_0x519b('0x77')](_0x16c9da['body'][_0x519b('0x60')])||_0x16c9da[_0x519b('0x60')]['body']===''){throw new db[(_0x519b('0x70'))][(_0x519b('0x71'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x16c9da[_0x519b('0x60')]['to'])){}_0x3a1d18=_0x16c9da[_0x519b('0x60')]['to'];return db[_0x519b('0x3d')][_0x519b('0x66')]({'where':{'id':_0x16c9da[_0x519b('0x61')]['id']}})[_0x519b('0x21')](handleEntityNotFound(_0x429ba7,null))[_0x519b('0x21')](function(_0x23ba78){if(_0x23ba78){return db[_0x519b('0x3d')][_0x519b('0x57')]({'where':{'id':_0x23ba78['id']},'include':[{'model':db[_0x519b('0xb8')],'as':'List','include':[{'model':db['CmContact'],'as':_0x519b('0x86'),'where':{[_0x23ba78[_0x519b('0x79')]]:_0x3a1d18},'limit':0x1,'order':[[_0x519b('0x74'),_0x519b('0x7e')]]}]}]})[_0x519b('0x21')](handleEntityNotFound(_0x429ba7,null))['then'](function(_0x4e68ad){if(_0x4e68ad&&_0x4e68ad[_0x519b('0x7d')]){_0x2d57d4=_0x4e68ad[_0x519b('0x35')]({'plain':!![]});if(_0x2d57d4['List']&&_0x2d57d4[_0x519b('0x7d')]['Contacts'][_0x519b('0x47')]){return _0x2d57d4[_0x519b('0x7d')][_0x519b('0x86')][0x0];}return db['CmContact'][_0x519b('0x58')](_[_0x519b('0x19')](_0x16c9da[_0x519b('0x60')],{'firstName':_0x3a1d18,[_0x4e68ad['mapKey']]:_0x3a1d18,'phone':_0x3a1d18,'ListId':_0x2d57d4[_0x519b('0x76')]}));}})['then'](handleEntityNotFound(_0x429ba7,null))[_0x519b('0x21')](function(_0x240deb){if(_0x240deb){_0x2ec6d9=_0x240deb;return db[_0x519b('0x8a')][_0x519b('0x57')]({'where':{'ContactId':_0x2ec6d9['id'],'closed':![],'OpenchannelAccountId':_0x2d57d4['id']}})['then'](function(_0x26f4a6){if(_0x26f4a6){return[_0x26f4a6,![]];}return db['OpenchannelInteraction']['create']({'UserId':_0x16c9da[_0x519b('0x5a')]['id'],'ContactId':_0x2ec6d9['id'],'OpenchannelAccountId':_0x2d57d4['id'],'lastMsgDirection':_0x519b('0xb9'),'firstMsgDirection':_0x519b('0xb9'),'Messages':[_[_0x519b('0x4e')](_0x16c9da[_0x519b('0x60')],{'read':![],'body':_0x16c9da['body'][_0x519b('0x60')],'OpenchannelAccountId':_0x2d57d4['id'],'UserId':_0x16c9da['user']['id'],'ContactId':_0x2ec6d9['id']})]},{'include':[{'model':db[_0x519b('0x94')],'as':_0x519b('0xba')}]})['then'](function(_0xd75844){return[_0xd75844,!![]];});});}})[_0x519b('0xb1')](function(_0x8d2ded,_0x5ea0c4){if(_0x5ea0c4){return _0x8d2ded;}return db[_0x519b('0x94')][_0x519b('0x58')](_[_0x519b('0x4e')](_0x16c9da[_0x519b('0x60')],{'read':![],'body':_0x16c9da[_0x519b('0x60')][_0x519b('0x60')],'OpenchannelAccountId':_0x2d57d4['id'],'OpenchannelInteractionId':_0x8d2ded['id'],'UserId':_0x16c9da[_0x519b('0x5a')]['id'],'ContactId':_0x2ec6d9['id']}))[_0x519b('0x21')](function(_0x523913){_0x8d2ded['dataValues'][_0x519b('0xba')]=[];_0x8d2ded[_0x519b('0xbb')][_0x519b('0xba')][_0x519b('0x91')](_0x523913[_0x519b('0xbb')]);return _0x8d2ded;});});}})[_0x519b('0x21')](respondWithResult(_0x429ba7,null))['catch'](handleError(_0x429ba7,null));}; \ No newline at end of file +var _0xada4=['list','orderBy','asc','account','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','autoclose','push','unmanaged','*,*,*,*','OpenchannelMessage','User','agent','waitForTheAssignedAgent','queueId','unshift','queue','waitForTheAssignedQueue','Start','EventManager','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','priority','finally','getApplications','getInteractions','Contact','Owner','internal','Tag','Tags','tag','addAgents','omit','removeAgents','isArray','emit','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','info','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','offset','undefined','count','set','apply','reject','save','update','destroy','OpenchannelAccounts','UserProfileResource','end','stack','name','send','index','Pause','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','OpenchannelAccount','findAll','rows','params','mandatoryDispositionPause','keys','length','find','create','body','user','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','Disposition','getDispositions','findOne','OpenchannelAccountId','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','createdAt','updatedAt','difference','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','OpenchannelApplication','Applications','applications'];(function(_0xc414fb,_0x39ca04){var _0x19ec4d=function(_0x433916){while(--_0x433916){_0xc414fb['push'](_0xc414fb['shift']());}};_0x19ec4d(++_0x39ca04);}(_0xada4,0x1bc));var _0x4ada=function(_0x51a06b,_0x563f1f){_0x51a06b=_0x51a06b-0x0;var _0xd26906=_0xada4[_0x51a06b];return _0xd26906;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4ada('0x0'));var zipdir=require(_0x4ada('0x1'));var jsonpatch=require(_0x4ada('0x2'));var rp=require(_0x4ada('0x3'));var moment=require(_0x4ada('0x4'));var BPromise=require(_0x4ada('0x5'));var Mustache=require(_0x4ada('0x6'));var util=require('util');var path=require(_0x4ada('0x7'));var sox=require(_0x4ada('0x8'));var csv=require(_0x4ada('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4ada('0xa'));var _=require(_0x4ada('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4ada('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x4ada('0x9'));var querystring=require(_0x4ada('0xd'));var Papa=require(_0x4ada('0xe'));var Redis=require(_0x4ada('0xf'));var authService=require(_0x4ada('0x10'));var qs=require(_0x4ada('0x11'));var as=require(_0x4ada('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4ada('0x13'))('api');var utils=require(_0x4ada('0x14'));var config=require(_0x4ada('0x15'));var licenseUtil=require(_0x4ada('0x16'));var db=require(_0x4ada('0x17'))['db'];config[_0x4ada('0x18')]=_[_0x4ada('0x19')](config[_0x4ada('0x18')],{'host':_0x4ada('0x1a'),'port':0x18eb});var socket=require(_0x4ada('0x1b'))(new Redis(config[_0x4ada('0x18')]));require(_0x4ada('0x1c'))[_0x4ada('0x1d')](socket);var jayson=require(_0x4ada('0x1e'));var client=jayson[_0x4ada('0x1f')][_0x4ada('0x20')]({'port':0x232c});var client9002=jayson[_0x4ada('0x1f')][_0x4ada('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x3f34fb,_0x304c9a,_0x40522b,_0x3f6ec8){return new BPromise(function(_0x2951e9,_0x56239a){var _0xfc48ea=_0x3f6ec8||client;return _0xfc48ea[_0x4ada('0x21')](_0x3f34fb,_0x40522b)[_0x4ada('0x22')](function(_0xa67bd5){logger[_0x4ada('0x23')]('OpenchannelAccount,\x20%s,\x20%s',_0x304c9a,'request\x20sent');logger[_0x4ada('0x24')](_0x4ada('0x25'),_0x304c9a,_0x4ada('0x26'),JSON[_0x4ada('0x27')](_0xa67bd5));if(_0xa67bd5[_0x4ada('0x28')]){if(_0xa67bd5[_0x4ada('0x28')][_0x4ada('0x29')]===0x1f4){logger[_0x4ada('0x28')](_0x4ada('0x2a'),_0x304c9a,_0xa67bd5[_0x4ada('0x28')][_0x4ada('0x2b')]);return _0x56239a(_0xa67bd5[_0x4ada('0x28')][_0x4ada('0x2b')]);}logger[_0x4ada('0x28')](_0x4ada('0x2a'),_0x304c9a,_0xa67bd5['error']['message']);return _0x2951e9(_0xa67bd5['error'][_0x4ada('0x2b')]);}else{logger[_0x4ada('0x23')](_0x4ada('0x2a'),_0x304c9a,_0x4ada('0x26'));_0x2951e9(_0xa67bd5[_0x4ada('0x2c')][_0x4ada('0x2b')]);}})[_0x4ada('0x2d')](function(_0x1e6eed){logger[_0x4ada('0x28')]('OpenchannelAccount,\x20%s,\x20%s',_0x304c9a,_0x1e6eed);_0x56239a(_0x1e6eed);});});}function respondWithStatusCode(_0x32846c,_0x2b43e9){_0x2b43e9=_0x2b43e9||0xcc;return function(_0x150086){if(_0x150086){return _0x32846c[_0x4ada('0x2e')](_0x2b43e9);}return _0x32846c['status'](_0x2b43e9)['end']();};}function respondWithResult(_0x1b2a95,_0x414bef){_0x414bef=_0x414bef||0xc8;return function(_0x23ad41){if(_0x23ad41){return _0x1b2a95[_0x4ada('0x2f')](_0x414bef)[_0x4ada('0x30')](_0x23ad41);}};}function respondWithFilteredResult(_0x58e563,_0xfac6fd){return function(_0x7b6193){if(_0x7b6193){var _0x247d5f=typeof _0xfac6fd[_0x4ada('0x31')]===_0x4ada('0x32')&&typeof _0xfac6fd['limit']===_0x4ada('0x32');var _0x1708ea=_0x7b6193[_0x4ada('0x33')];var _0x4159a1=_0x247d5f?0x0:_0xfac6fd['offset'];var _0x4aeaea=_0x247d5f?_0x7b6193['count']:_0xfac6fd[_0x4ada('0x31')]+_0xfac6fd['limit'];var _0xc8d815;if(_0x4aeaea>=_0x1708ea){_0x4aeaea=_0x1708ea;_0xc8d815=0xc8;}else{_0xc8d815=0xce;}_0x58e563[_0x4ada('0x2f')](_0xc8d815);return _0x58e563[_0x4ada('0x34')]('Content-Range',_0x4159a1+'-'+_0x4aeaea+'/'+_0x1708ea)[_0x4ada('0x30')](_0x7b6193);}return null;};}function patchUpdates(_0x3437d0){return function(_0x41013c){try{jsonpatch[_0x4ada('0x35')](_0x41013c,_0x3437d0,!![]);}catch(_0x4d13c5){return BPromise[_0x4ada('0x36')](_0x4d13c5);}return _0x41013c[_0x4ada('0x37')]();};}function saveUpdates(_0xd8daf5,_0x1fb12d){return function(_0x2f86dc){if(_0x2f86dc){return _0x2f86dc[_0x4ada('0x38')](_0xd8daf5)[_0x4ada('0x22')](function(_0x5ebe8d){return _0x5ebe8d;});}return null;};}function removeEntity(_0x57ca4c,_0x526e87){return function(_0x3b96d6){if(_0x3b96d6){return _0x3b96d6[_0x4ada('0x39')]()[_0x4ada('0x22')](function(){var _0x2ed871=_0x3b96d6['get']({'plain':!![]});var _0x404988=_0x4ada('0x3a');return db[_0x4ada('0x3b')][_0x4ada('0x39')]({'where':{'type':_0x404988,'resourceId':_0x2ed871['id']}})[_0x4ada('0x22')](function(){return _0x3b96d6;});})['then'](function(){_0x57ca4c[_0x4ada('0x2f')](0xcc)[_0x4ada('0x3c')]();});}};}function handleEntityNotFound(_0x364369,_0x43fe5d){return function(_0x28f4c9){if(!_0x28f4c9){_0x364369[_0x4ada('0x2e')](0x194);}return _0x28f4c9;};}function handleError(_0xb1df30,_0x3a1ca1){_0x3a1ca1=_0x3a1ca1||0x1f4;return function(_0x3a2c7c){logger[_0x4ada('0x28')](_0x3a2c7c[_0x4ada('0x3d')]);if(_0x3a2c7c[_0x4ada('0x3e')]){delete _0x3a2c7c['name'];}_0xb1df30[_0x4ada('0x2f')](_0x3a1ca1)[_0x4ada('0x3f')](_0x3a2c7c);};}exports[_0x4ada('0x40')]=function(_0x98cd1a,_0x152a58){var _0x2c41ed={'include':[{'model':db[_0x4ada('0x41')],'as':'mandatoryDispositionPause'}]},_0x47cb72={},_0x35d84c={'count':0x0,'rows':[]};var _0xb71764=_[_0x4ada('0x42')](db['OpenchannelAccount'][_0x4ada('0x43')],function(_0x50a4cb){return{'name':_0x50a4cb['fieldName'],'type':_0x50a4cb[_0x4ada('0x44')][_0x4ada('0x45')]};});_0x47cb72[_0x4ada('0x46')]=_[_0x4ada('0x42')](_0xb71764,'name');_0x47cb72[_0x4ada('0x47')]=_['keys'](_0x98cd1a[_0x4ada('0x47')]);_0x47cb72[_0x4ada('0x48')]=_[_0x4ada('0x49')](_0x47cb72[_0x4ada('0x46')],_0x47cb72['query']);_0x2c41ed[_0x4ada('0x4a')]=_['intersection'](_0x47cb72[_0x4ada('0x46')],qs[_0x4ada('0x4b')](_0x98cd1a['query']['fields']));_0x2c41ed[_0x4ada('0x4a')]=_0x2c41ed[_0x4ada('0x4a')]['length']?_0x2c41ed[_0x4ada('0x4a')]:_0x47cb72[_0x4ada('0x46')];if(!_0x98cd1a[_0x4ada('0x47')][_0x4ada('0x4c')](_0x4ada('0x4d'))){_0x2c41ed[_0x4ada('0x4e')]=qs['limit'](_0x98cd1a[_0x4ada('0x47')][_0x4ada('0x4e')]);_0x2c41ed[_0x4ada('0x31')]=qs[_0x4ada('0x31')](_0x98cd1a['query'][_0x4ada('0x31')]);}_0x2c41ed[_0x4ada('0x4f')]=qs[_0x4ada('0x50')](_0x98cd1a[_0x4ada('0x47')][_0x4ada('0x50')]);_0x2c41ed[_0x4ada('0x51')]=qs[_0x4ada('0x48')](_[_0x4ada('0x52')](_0x98cd1a[_0x4ada('0x47')],_0x47cb72[_0x4ada('0x48')]),_0xb71764);if(_0x98cd1a[_0x4ada('0x47')][_0x4ada('0x53')]){_0x2c41ed[_0x4ada('0x51')]=_[_0x4ada('0x54')](_0x2c41ed[_0x4ada('0x51')],{'$or':_[_0x4ada('0x42')](_0xb71764,function(_0x4f9ef4){if(_0x4f9ef4['type']!==_0x4ada('0x55')){var _0x2e0983={};_0x2e0983[_0x4f9ef4[_0x4ada('0x3e')]]={'$like':'%'+_0x98cd1a[_0x4ada('0x47')][_0x4ada('0x53')]+'%'};return _0x2e0983;}})});}_0x2c41ed=_[_0x4ada('0x54')]({},_0x2c41ed,_0x98cd1a[_0x4ada('0x56')]);var _0x43120c={'where':_0x2c41ed['where']};return db['OpenchannelAccount'][_0x4ada('0x33')](_0x43120c)[_0x4ada('0x22')](function(_0x65d567){_0x35d84c[_0x4ada('0x33')]=_0x65d567;if(_0x98cd1a[_0x4ada('0x47')][_0x4ada('0x57')]){_0x2c41ed[_0x4ada('0x58')]=[{'all':!![]}];}return db[_0x4ada('0x59')][_0x4ada('0x5a')](_0x2c41ed);})[_0x4ada('0x22')](function(_0x58b809){_0x35d84c[_0x4ada('0x5b')]=_0x58b809;return _0x35d84c;})[_0x4ada('0x22')](respondWithFilteredResult(_0x152a58,_0x2c41ed))[_0x4ada('0x2d')](handleError(_0x152a58,null));};exports['show']=function(_0x2532a4,_0x10091f){var _0x42710c={'raw':![],'where':{'id':_0x2532a4[_0x4ada('0x5c')]['id']},'include':[{'model':db['Pause'],'as':_0x4ada('0x5d')}]},_0x2a84bb={};_0x2a84bb[_0x4ada('0x46')]=_['keys'](db[_0x4ada('0x59')]['rawAttributes']);_0x2a84bb[_0x4ada('0x47')]=_[_0x4ada('0x5e')](_0x2532a4[_0x4ada('0x47')]);_0x2a84bb['filters']=_['intersection'](_0x2a84bb['model'],_0x2a84bb[_0x4ada('0x47')]);_0x42710c['attributes']=_[_0x4ada('0x49')](_0x2a84bb['model'],qs[_0x4ada('0x4b')](_0x2532a4[_0x4ada('0x47')][_0x4ada('0x4b')]));_0x42710c[_0x4ada('0x4a')]=_0x42710c['attributes'][_0x4ada('0x5f')]?_0x42710c['attributes']:_0x2a84bb[_0x4ada('0x46')];if(_0x2532a4[_0x4ada('0x47')]['includeAll']){_0x42710c[_0x4ada('0x58')]=[{'all':!![]}];}_0x42710c=_[_0x4ada('0x54')]({},_0x42710c,_0x2532a4[_0x4ada('0x56')]);return db[_0x4ada('0x59')][_0x4ada('0x60')](_0x42710c)[_0x4ada('0x22')](handleEntityNotFound(_0x10091f,null))['then'](respondWithResult(_0x10091f,null))['catch'](handleError(_0x10091f,null));};exports[_0x4ada('0x61')]=function(_0x4eb766,_0x22e4d0){return db[_0x4ada('0x59')][_0x4ada('0x61')](_0x4eb766[_0x4ada('0x62')],{})[_0x4ada('0x22')](function(_0x24e6f0){var _0x39d277=_0x4eb766[_0x4ada('0x63')][_0x4ada('0x64')]({'plain':!![]});if(!_0x39d277)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x39d277['role']===_0x4ada('0x63')){var _0x48f752=_0x24e6f0[_0x4ada('0x64')]({'plain':!![]});var _0x2523ca=_0x4ada('0x3a');return db[_0x4ada('0x65')][_0x4ada('0x60')]({'where':{'name':_0x2523ca,'userProfileId':_0x39d277['userProfileId']},'raw':!![]})['then'](function(_0x31efc7){if(_0x31efc7&&_0x31efc7[_0x4ada('0x66')]===0x0){return db[_0x4ada('0x3b')]['create']({'name':_0x48f752['name'],'resourceId':_0x48f752['id'],'type':_0x31efc7[_0x4ada('0x3e')],'sectionId':_0x31efc7['id']},{})['then'](function(){return _0x24e6f0;});}else{return _0x24e6f0;}})['catch'](function(_0x2cd4bb){logger['error'](_0x4ada('0x67'),_0x2cd4bb);throw _0x2cd4bb;});}return _0x24e6f0;})[_0x4ada('0x22')](respondWithResult(_0x22e4d0,0xc9))[_0x4ada('0x2d')](handleError(_0x22e4d0,null));};exports['update']=function(_0x381b52,_0x7a9eff){if(_0x381b52['body']['id']){delete _0x381b52[_0x4ada('0x62')]['id'];}return db[_0x4ada('0x59')]['find']({'where':{'id':_0x381b52[_0x4ada('0x5c')]['id']},'include':[{'model':db[_0x4ada('0x41')],'as':'mandatoryDispositionPause'}]})[_0x4ada('0x22')](handleEntityNotFound(_0x7a9eff,null))[_0x4ada('0x22')](saveUpdates(_0x381b52[_0x4ada('0x62')],null))[_0x4ada('0x22')](respondWithResult(_0x7a9eff,null))[_0x4ada('0x2d')](handleError(_0x7a9eff,null));};exports[_0x4ada('0x39')]=function(_0x28b18a,_0x109df3){return db['OpenchannelAccount'][_0x4ada('0x60')]({'where':{'id':_0x28b18a[_0x4ada('0x5c')]['id']}})[_0x4ada('0x22')](handleEntityNotFound(_0x109df3,null))[_0x4ada('0x22')](removeEntity(_0x109df3,null))[_0x4ada('0x2d')](handleError(_0x109df3,null));};exports[_0x4ada('0x68')]=function(_0x585a8a,_0x210ae2){return db[_0x4ada('0x59')][_0x4ada('0x68')]()[_0x4ada('0x22')](respondWithResult(_0x210ae2,null))[_0x4ada('0x2d')](handleError(_0x210ae2,null));};exports['addDisposition']=function(_0xed9273,_0x54b7f7,_0x427f36){if(_0xed9273['body']['id']){delete _0xed9273['body']['id'];}return db[_0x4ada('0x59')][_0x4ada('0x60')]({'where':{'id':_0xed9273[_0x4ada('0x5c')]['id']}})['then'](handleEntityNotFound(_0x54b7f7,null))['then'](function(_0x5efe9f){if(_0x5efe9f){_0xed9273[_0x4ada('0x62')]['OpenchannelAccountId']=_0x5efe9f['id'];return db[_0x4ada('0x69')][_0x4ada('0x61')](_0xed9273['body']);}})['then'](respondWithResult(_0x54b7f7,null))[_0x4ada('0x2d')](handleError(_0x54b7f7,null));};exports[_0x4ada('0x6a')]=function(_0x3335f4,_0x78716b,_0x2442b3){var _0x50e575={'raw':![],'where':{}};var _0x373265={};var _0x4adbb8={'count':0x0,'rows':[]};return db[_0x4ada('0x59')][_0x4ada('0x6b')]({'where':{'id':_0x3335f4['params']['id']}})[_0x4ada('0x22')](handleEntityNotFound(_0x78716b,null))[_0x4ada('0x22')](function(_0x36a794){if(_0x36a794){_0x373265[_0x4ada('0x46')]=_['keys'](db[_0x4ada('0x69')]['rawAttributes']);_0x373265[_0x4ada('0x47')]=_[_0x4ada('0x5e')](_0x3335f4[_0x4ada('0x47')]);_0x373265[_0x4ada('0x48')]=_[_0x4ada('0x49')](_0x373265[_0x4ada('0x46')],_0x373265[_0x4ada('0x47')]);_0x50e575[_0x4ada('0x4a')]=_['intersection'](_0x373265[_0x4ada('0x46')],qs[_0x4ada('0x4b')](_0x3335f4['query'][_0x4ada('0x4b')]));_0x50e575['attributes']=_0x50e575[_0x4ada('0x4a')][_0x4ada('0x5f')]?_0x50e575[_0x4ada('0x4a')]:_0x373265[_0x4ada('0x46')];if(!_0x3335f4['query'][_0x4ada('0x4c')](_0x4ada('0x4d'))){_0x50e575[_0x4ada('0x4e')]=qs['limit'](_0x3335f4[_0x4ada('0x47')][_0x4ada('0x4e')]);_0x50e575[_0x4ada('0x31')]=qs['offset'](_0x3335f4[_0x4ada('0x47')][_0x4ada('0x31')]);}_0x50e575[_0x4ada('0x4f')]=qs[_0x4ada('0x50')](_0x3335f4[_0x4ada('0x47')][_0x4ada('0x50')]);_0x50e575[_0x4ada('0x51')]=qs[_0x4ada('0x48')](_[_0x4ada('0x52')](_0x3335f4[_0x4ada('0x47')],_0x373265[_0x4ada('0x48')]));_0x50e575['where'][_0x4ada('0x6c')]=_0x36a794['id'];if(_0x3335f4[_0x4ada('0x47')][_0x4ada('0x53')]){_0x50e575[_0x4ada('0x51')]=_[_0x4ada('0x54')](_0x50e575[_0x4ada('0x51')],{'$or':_[_0x4ada('0x42')](_0x50e575[_0x4ada('0x4a')],function(_0x3a3232){var _0x2da02e={};_0x2da02e[_0x3a3232]={'$like':'%'+_0x3335f4[_0x4ada('0x47')]['filter']+'%'};return _0x2da02e;})});}_0x50e575=_['merge']({},_0x50e575,_0x3335f4['options']);return db[_0x4ada('0x69')][_0x4ada('0x33')]({'where':_0x50e575[_0x4ada('0x51')]})[_0x4ada('0x22')](function(_0x44da03){_0x4adbb8['count']=_0x44da03;if(_0x3335f4['query']['includeAll']){_0x50e575[_0x4ada('0x58')]=[{'all':!![]}];}return db[_0x4ada('0x69')][_0x4ada('0x5a')](_0x50e575);})[_0x4ada('0x22')](function(_0x15ce25){_0x4adbb8['rows']=_0x15ce25;return _0x4adbb8;});}})[_0x4ada('0x22')](respondWithFilteredResult(_0x78716b,_0x50e575))[_0x4ada('0x2d')](handleError(_0x78716b,null));};exports['removeDispositions']=function(_0x54f872,_0x4385e5,_0x371cd1){return db['OpenchannelAccount'][_0x4ada('0x60')]({'where':{'id':_0x54f872[_0x4ada('0x5c')]['id']}})[_0x4ada('0x22')](handleEntityNotFound(_0x4385e5,null))[_0x4ada('0x22')](function(_0x38214c){if(_0x38214c){return _0x38214c[_0x4ada('0x6d')](_0x54f872['query'][_0x4ada('0x6e')]);}})[_0x4ada('0x22')](respondWithStatusCode(_0x4385e5,null))[_0x4ada('0x2d')](handleError(_0x4385e5,null));};exports['addAnswer']=function(_0x5ab0bb,_0x132c0a,_0x4d7a23){if(_0x5ab0bb[_0x4ada('0x62')]['id']){delete _0x5ab0bb[_0x4ada('0x62')]['id'];}return db['OpenchannelAccount'][_0x4ada('0x60')]({'where':{'id':_0x5ab0bb[_0x4ada('0x5c')]['id']}})['then'](handleEntityNotFound(_0x132c0a,null))[_0x4ada('0x22')](function(_0x19f9cf){if(_0x19f9cf){_0x5ab0bb[_0x4ada('0x62')][_0x4ada('0x6c')]=_0x19f9cf['id'];return db[_0x4ada('0x6f')][_0x4ada('0x61')](_0x5ab0bb['body']);}})[_0x4ada('0x22')](respondWithResult(_0x132c0a,null))[_0x4ada('0x2d')](handleError(_0x132c0a,null));};exports[_0x4ada('0x70')]=function(_0x327d71,_0x175c73,_0x4d1b2b){var _0x4d43f9={'raw':![],'where':{}};var _0x47e522={};var _0x58c4eb={'count':0x0,'rows':[]};return db[_0x4ada('0x59')][_0x4ada('0x6b')]({'where':{'id':_0x327d71['params']['id']}})[_0x4ada('0x22')](handleEntityNotFound(_0x175c73,null))[_0x4ada('0x22')](function(_0x2e1f68){if(_0x2e1f68){_0x47e522[_0x4ada('0x46')]=_['keys'](db[_0x4ada('0x6f')][_0x4ada('0x43')]);_0x47e522[_0x4ada('0x47')]=_[_0x4ada('0x5e')](_0x327d71['query']);_0x47e522[_0x4ada('0x48')]=_[_0x4ada('0x49')](_0x47e522['model'],_0x47e522[_0x4ada('0x47')]);_0x4d43f9['attributes']=_[_0x4ada('0x49')](_0x47e522['model'],qs['fields'](_0x327d71['query'][_0x4ada('0x4b')]));_0x4d43f9[_0x4ada('0x4a')]=_0x4d43f9['attributes'][_0x4ada('0x5f')]?_0x4d43f9[_0x4ada('0x4a')]:_0x47e522[_0x4ada('0x46')];if(!_0x327d71[_0x4ada('0x47')][_0x4ada('0x4c')](_0x4ada('0x4d'))){_0x4d43f9[_0x4ada('0x4e')]=qs[_0x4ada('0x4e')](_0x327d71['query']['limit']);_0x4d43f9['offset']=qs['offset'](_0x327d71[_0x4ada('0x47')][_0x4ada('0x31')]);}_0x4d43f9[_0x4ada('0x4f')]=qs[_0x4ada('0x50')](_0x327d71[_0x4ada('0x47')][_0x4ada('0x50')]);_0x4d43f9['where']=qs[_0x4ada('0x48')](_[_0x4ada('0x52')](_0x327d71['query'],_0x47e522[_0x4ada('0x48')]));_0x4d43f9[_0x4ada('0x51')][_0x4ada('0x6c')]=_0x2e1f68['id'];if(_0x327d71[_0x4ada('0x47')]['filter']){_0x4d43f9[_0x4ada('0x51')]=_[_0x4ada('0x54')](_0x4d43f9[_0x4ada('0x51')],{'$or':_['map'](_0x4d43f9['attributes'],function(_0x2ac9bc){var _0x107708={};_0x107708[_0x2ac9bc]={'$like':'%'+_0x327d71['query'][_0x4ada('0x53')]+'%'};return _0x107708;})});}_0x4d43f9=_[_0x4ada('0x54')]({},_0x4d43f9,_0x327d71[_0x4ada('0x56')]);return db[_0x4ada('0x6f')]['count']({'where':_0x4d43f9[_0x4ada('0x51')]})[_0x4ada('0x22')](function(_0x2112ed){_0x58c4eb['count']=_0x2112ed;if(_0x327d71['query']['includeAll']){_0x4d43f9[_0x4ada('0x58')]=[{'all':!![]}];}return db[_0x4ada('0x6f')][_0x4ada('0x5a')](_0x4d43f9);})[_0x4ada('0x22')](function(_0x36bc9e){_0x58c4eb[_0x4ada('0x5b')]=_0x36bc9e;return _0x58c4eb;});}})[_0x4ada('0x22')](respondWithFilteredResult(_0x175c73,_0x4d43f9))[_0x4ada('0x2d')](handleError(_0x175c73,null));};exports[_0x4ada('0x71')]=function(_0x55040d,_0x177ed2,_0x74f71d){return db['OpenchannelAccount'][_0x4ada('0x60')]({'where':{'id':_0x55040d[_0x4ada('0x5c')]['id']}})['then'](handleEntityNotFound(_0x177ed2,null))[_0x4ada('0x22')](function(_0x52ea4d){if(_0x52ea4d){return _0x52ea4d[_0x4ada('0x71')](_0x55040d[_0x4ada('0x47')][_0x4ada('0x6e')]);}})[_0x4ada('0x22')](respondWithStatusCode(_0x177ed2,null))[_0x4ada('0x2d')](handleError(_0x177ed2,null));};exports[_0x4ada('0x72')]=function(_0x20764f,_0x1239f6,_0x4506e0){var _0x46768c={'body':_0x20764f[_0x4ada('0x62')],'channel':_0x4ada('0x73')};var _0x39c2fe=[];var _0x18ca87=[];var _0x5a336b={};var _0xd5e437=![];return db[_0x4ada('0x74')][_0x4ada('0x68')]()[_0x4ada('0x22')](function(_0x2f1192){if(!_0x2f1192){throw new db[(_0x4ada('0x75'))][(_0x4ada('0x76'))]('no\x20available\x20attributes');}_0x39c2fe=_['difference'](_['keys'](_0x2f1192),[_0x4ada('0x77'),_0x4ada('0x78')]);_0x18ca87=_[_0x4ada('0x79')](_[_0x4ada('0x5e')](_0x2f1192),[_0x4ada('0x77'),_0x4ada('0x78'),_0x4ada('0x7a'),_0x4ada('0x7b')]);if(_0x20764f[_0x4ada('0x62')]['id']){delete _0x20764f[_0x4ada('0x62')]['id'];}if(_[_0x4ada('0x7c')](_0x20764f[_0x4ada('0x62')][_0x4ada('0x7d')])){throw new db['Sequelize'][(_0x4ada('0x76'))](_0x4ada('0x7e'));}if(_[_0x4ada('0x7c')](_0x20764f['body']['body'])||_0x20764f['body'][_0x4ada('0x62')]===''){throw new db[(_0x4ada('0x75'))]['ValidationError'](_0x4ada('0x7f'));}if(_[_0x4ada('0x7c')](_0x20764f['body'][_0x4ada('0x80')])){throw new db[(_0x4ada('0x75'))][(_0x4ada('0x76'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x18ca87);}if(!_[_0x4ada('0x81')](_0x18ca87,_0x20764f[_0x4ada('0x62')][_0x4ada('0x80')])){throw new db[(_0x4ada('0x75'))][(_0x4ada('0x76'))](_0x4ada('0x82')+_0x18ca87);}_0x5a336b[_0x20764f[_0x4ada('0x62')][_0x4ada('0x80')]]=_0x20764f[_0x4ada('0x62')][_0x4ada('0x7d')];})['then'](function(){return db[_0x4ada('0x59')][_0x4ada('0x60')]({'where':{'id':_0x20764f[_0x4ada('0x5c')]['id']},'include':[{'model':db[_0x4ada('0x83')],'as':_0x4ada('0x84'),'include':[{'model':db[_0x4ada('0x74')],'as':_0x4ada('0x85'),'where':_0x5a336b,'limit':0x1,'order':[['updatedAt',_0x4ada('0x86')]]}]},{'model':db[_0x4ada('0x87')],'as':_0x4ada('0x88')}]});})[_0x4ada('0x22')](handleEntityNotFound(_0x1239f6,null))[_0x4ada('0x22')](function(_0x362e7d){if(_0x362e7d&&_0x362e7d[_0x4ada('0x84')]){_0x46768c['account']=_0x362e7d;_0x46768c[_0x4ada('0x89')]=_0x362e7d['Applications'];_0x46768c[_0x4ada('0x8a')]=_0x362e7d['List'];_0x46768c[_0x4ada('0x89')]=_[_0x4ada('0x8b')](_0x46768c[_0x4ada('0x89')],['priority'],[_0x4ada('0x8c')]);if(_0x46768c[_0x4ada('0x8d')][_0x4ada('0x88')]){delete _0x46768c['account'][_0x4ada('0x88')];}if(_0x46768c[_0x4ada('0x8d')]['List']&&_0x46768c[_0x4ada('0x8d')][_0x4ada('0x84')][_0x4ada('0x85')][_0x4ada('0x5f')]){return _0x46768c[_0x4ada('0x8d')]['List'][_0x4ada('0x85')][0x0];}var _0x6f61b9=_['defaults'](_0x20764f[_0x4ada('0x62')],{'firstName':_0x20764f['body'][_0x4ada('0x7d')],'ListId':_0x362e7d[_0x4ada('0x7b')]});_0x6f61b9[_0x20764f[_0x4ada('0x62')][_0x4ada('0x80')]]=_0x20764f[_0x4ada('0x62')][_0x4ada('0x7d')];return db['CmContact'][_0x4ada('0x61')](_0x6f61b9,{'fields':_0x39c2fe,'raw':!![]});}})[_0x4ada('0x22')](handleEntityNotFound(_0x1239f6,null))[_0x4ada('0x22')](function(_0x4ae44b){_0x46768c[_0x4ada('0x8e')]=_0x4ae44b;if(_0x4ae44b){var _0x46a781={'ContactId':_0x4ae44b['id'],'OpenchannelAccountId':_0x20764f[_0x4ada('0x5c')]['id'],'from':(_0x4ae44b[_0x4ada('0x8f')]||'')+'\x20'+(_0x4ae44b[_0x4ada('0x90')]||'')};var _0x3728bb={'OpenchannelAccountId':_0x20764f[_0x4ada('0x5c')]['id'],'closed':![]};if(_0x20764f[_0x4ada('0x62')][_0x4ada('0x91')]){_0x3728bb['threadId']=_0x20764f['body'][_0x4ada('0x91')];return db[_0x4ada('0x92')]['find']({'where':_0x3728bb})['then'](function(_0x20b458){if(_0x20b458){return[_0x20b458,![]];}_0x46a781['threadId']=_0x20764f[_0x4ada('0x62')]['threadId'];_0x46a781[_0x4ada('0x93')]=_0x20764f[_0x4ada('0x62')][_0x4ada('0x93')];return db['OpenchannelInteraction'][_0x4ada('0x61')](_0x46a781)['then'](function(_0x492904){return[_0x492904,!![]];});});}else{_0x3728bb['threadId']=null;}_0x3728bb[_0x4ada('0x94')]=_0x4ae44b['id'];return db[_0x4ada('0x92')][_0x4ada('0x60')]({'where':_0x3728bb})[_0x4ada('0x22')](function(_0x36eb23){if(_0x36eb23){return[_0x36eb23,![]];}return db[_0x4ada('0x92')][_0x4ada('0x61')](_0x46a781)[_0x4ada('0x22')](function(_0x34695c){return[_0x34695c,!![]];});});}})[_0x4ada('0x95')](function(_0x3d1e1b,_0x2af5fe){if(_0x3d1e1b){_0xd5e437=_0x2af5fe;if(!_0x2af5fe){var _0x2fe371={'from':(_0x46768c['contact'][_0x4ada('0x8f')]||'')+'\x20'+(_0x46768c[_0x4ada('0x8e')]['lastName']||'')};if(_0x20764f['body']['threadId']&&_0x20764f['body'][_0x4ada('0x96')]&&_0x20764f[_0x4ada('0x62')]['threadId']!=_0x20764f['body']['messageId']){_0x2fe371['threadId']=_0x20764f[_0x4ada('0x62')][_0x4ada('0x96')];}return _0x3d1e1b[_0x4ada('0x38')](_0x2fe371);}else{return _0x3d1e1b;}}})[_0x4ada('0x22')](function(_0x2b9d06){_0x46768c['interaction']=_0x2b9d06['get']({'plain':!![]});_0x46768c['interaction']['created']=_0xd5e437;if(_0x46768c[_0x4ada('0x97')][_0x4ada('0x98')]){if(_0x46768c[_0x4ada('0x8d')][_0x4ada('0x99')]){_0x46768c[_0x4ada('0x89')][_0x4ada('0x9a')]({'id':0x0,'priority':_0x46768c[_0x4ada('0x89')][_0x4ada('0x5f')]+0x1,'app':'close','appdata':_0x4ada('0x9b'),'interval':_0x4ada('0x9c')});}}return db[_0x4ada('0x9d')]['create']({'body':_0x20764f['body'][_0x4ada('0x62')],'OpenchannelAccountId':_0x20764f[_0x4ada('0x5c')]['id'],'OpenchannelInteractionId':_0x2b9d06['id'],'direction':'in','ContactId':_0x46768c[_0x4ada('0x8e')]['id'],'AttachmentId':_0x20764f[_0x4ada('0x62')]['AttachmentId']});})[_0x4ada('0x22')](function(_0x432dde){_0x46768c[_0x4ada('0x2b')]=_0x432dde;if(!_0x46768c[_0x4ada('0x97')]['UserId'])return;return db[_0x4ada('0x9e')][_0x4ada('0x60')]({'attributes':['id',_0x4ada('0x3e')],'where':{'id':_0x46768c[_0x4ada('0x97')]['UserId']}});})[_0x4ada('0x22')](function(_0x4950f6){if(_0x4950f6){_0x46768c[_0x4ada('0x89')]['unshift']({'id':0x0,'priority':0x0,'app':_0x4ada('0x9f'),'appdata':_0x4950f6['name']+','+(_0x46768c[_0x4ada('0x8d')][_0x4ada('0xa0')]||0xa),'interval':_0x4ada('0x9c')});}if(!_0x46768c['interaction'][_0x4ada('0xa1')])return;return db['OpenchannelQueue']['find']({'attributes':['id','name'],'where':{'id':_0x46768c[_0x4ada('0x97')][_0x4ada('0xa1')]}});})['then'](function(_0x4a7c1c){if(_0x4a7c1c){_0x46768c[_0x4ada('0x89')][_0x4ada('0xa2')]({'id':0x0,'priority':0x1,'app':_0x4ada('0xa3'),'appdata':_0x4a7c1c['name']+','+(_0x46768c[_0x4ada('0x8d')][_0x4ada('0xa4')]||0x12c),'interval':_0x4ada('0x9c')});}return respondWithRpcPromise(_0x4ada('0xa5'),'startRouting',_0x46768c);})[_0x4ada('0x22')](function(_0x3f17de){respondWithRpcPromise('EventManager',_0x4ada('0xa6'),{'event':_0x4ada('0x72'),'message':_0x3f17de},client9002);return _0x3f17de;})[_0x4ada('0x22')](respondWithResult(_0x1239f6,null))[_0x4ada('0x2d')](handleError(_0x1239f6,null));};exports[_0x4ada('0xa7')]=function(_0x4a3def,_0x3bb607){var _0x1816fc=_0x4a3def[_0x4ada('0x5c')]['id'];var _0xa32cb7=_0x4a3def[_0x4ada('0x62')];var _0x45bd58=0xc8;var _0x2f0a81=null;return db[_0x4ada('0xa8')][_0x4ada('0xa9')]({'isolationLevel':db[_0x4ada('0xa8')][_0x4ada('0xaa')][_0x4ada('0xab')][_0x4ada('0xac')]},function(_0x91c67){return db[_0x4ada('0x59')][_0x4ada('0x6b')]({'where':{'id':_0x1816fc},'transaction':_0x91c67})[_0x4ada('0x22')](function(_0x3e47bd){if(_0x3e47bd){return db['OpenchannelApplication'][_0x4ada('0x39')]({'where':{'OpenchannelAccountId':_0x1816fc},'transaction':_0x91c67})[_0x4ada('0x22')](function(){var _0xcff17d=_[_0x4ada('0x42')](_0xa32cb7,function(_0x1195a3){_0x1195a3[_0x4ada('0x6c')]=_0x1816fc;return _0x1195a3;});return db['OpenchannelApplication'][_0x4ada('0xad')](_0xcff17d,{'transaction':_0x91c67});});}else{_0x45bd58=0x194;_0x2f0a81=[];}});})[_0x4ada('0x22')](function(){if(_0x45bd58!==0x194){return db[_0x4ada('0x87')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x1816fc},'order':_0x4ada('0xae')})[_0x4ada('0x22')](function(_0x17c047){_0x2f0a81=_0x17c047;});}})[_0x4ada('0x2d')](function(_0x43774a){_0x45bd58=0x1f4;logger[_0x4ada('0x28')](_0x43774a['stack']);if(_0x43774a[_0x4ada('0x3e')]){delete _0x43774a[_0x4ada('0x3e')];}_0x2f0a81=_0x43774a;})[_0x4ada('0xaf')](function(){if(_0x2f0a81===null){_0x3bb607[_0x4ada('0x2e')](_0x45bd58);}else{if(_0x45bd58===0x1f4){_0x3bb607[_0x4ada('0x2f')](_0x45bd58)[_0x4ada('0x3f')](_0x2f0a81);}else{_0x3bb607[_0x4ada('0x2f')](_0x45bd58)[_0x4ada('0x30')](_0x2f0a81);}}});};exports['getApplications']=function(_0x4cfcb0,_0x4df25a,_0x339212){var _0x150da0={};var _0x275465={};var _0x33db7c;var _0x961e5f;return db[_0x4ada('0x59')][_0x4ada('0x6b')]({'where':{'id':_0x4cfcb0[_0x4ada('0x5c')]['id']}})[_0x4ada('0x22')](handleEntityNotFound(_0x4df25a,null))[_0x4ada('0x22')](function(_0x40f254){if(_0x40f254){_0x33db7c=_0x40f254;_0x275465[_0x4ada('0x46')]=_['keys'](db[_0x4ada('0x87')][_0x4ada('0x43')]);_0x275465['query']=_['keys'](_0x4cfcb0[_0x4ada('0x47')]);_0x275465[_0x4ada('0x48')]=_[_0x4ada('0x49')](_0x275465[_0x4ada('0x46')],_0x275465[_0x4ada('0x47')]);_0x150da0[_0x4ada('0x4a')]=_['intersection'](_0x275465['model'],qs[_0x4ada('0x4b')](_0x4cfcb0['query'][_0x4ada('0x4b')]));_0x150da0['attributes']=_0x150da0[_0x4ada('0x4a')]['length']?_0x150da0[_0x4ada('0x4a')]:_0x275465[_0x4ada('0x46')];_0x150da0[_0x4ada('0x4f')]=qs[_0x4ada('0x50')](_0x4cfcb0[_0x4ada('0x47')][_0x4ada('0x50')]);_0x150da0[_0x4ada('0x51')]=qs[_0x4ada('0x48')](_[_0x4ada('0x52')](_0x4cfcb0[_0x4ada('0x47')],_0x275465['filters']));if(_0x4cfcb0[_0x4ada('0x47')]['filter']){_0x150da0[_0x4ada('0x51')]=_['merge'](_0x150da0[_0x4ada('0x51')],{'$or':_[_0x4ada('0x42')](_0x150da0['attributes'],function(_0x4a5334){var _0x265e7e={};_0x265e7e[_0x4a5334]={'$like':'%'+_0x4cfcb0[_0x4ada('0x47')][_0x4ada('0x53')]+'%'};return _0x265e7e;})});}_0x150da0=_['merge']({},_0x150da0,_0x4cfcb0['options']);return _0x33db7c[_0x4ada('0xb0')](_0x150da0);}})[_0x4ada('0x22')](function(_0x4c25c2){if(_0x4c25c2){_0x961e5f=_0x4c25c2[_0x4ada('0x5f')];if(!_0x4cfcb0[_0x4ada('0x47')][_0x4ada('0x4c')](_0x4ada('0x4d'))){_0x150da0['limit']=qs[_0x4ada('0x4e')](_0x4cfcb0[_0x4ada('0x47')][_0x4ada('0x4e')]);_0x150da0[_0x4ada('0x31')]=qs[_0x4ada('0x31')](_0x4cfcb0['query'][_0x4ada('0x31')]);}return _0x33db7c[_0x4ada('0xb0')](_0x150da0);}})[_0x4ada('0x22')](function(_0x5e3c8c){if(_0x5e3c8c){return _0x5e3c8c?{'count':_0x961e5f,'rows':_0x5e3c8c}:null;}})[_0x4ada('0x22')](respondWithResult(_0x4df25a,null))['catch'](handleError(_0x4df25a,null));};exports[_0x4ada('0xb1')]=function(_0x4bbed8,_0x421fb9,_0x55b08b){var _0x1e27df={'raw':![],'where':{}};var _0x1ce581={};var _0x605e2d={'count':0x0,'rows':[]};return db[_0x4ada('0x59')][_0x4ada('0x6b')]({'where':{'id':_0x4bbed8[_0x4ada('0x5c')]['id']}})[_0x4ada('0x22')](handleEntityNotFound(_0x421fb9,null))[_0x4ada('0x22')](function(_0x204b82){if(_0x204b82){_0x1ce581[_0x4ada('0x46')]=_['keys'](db[_0x4ada('0x92')][_0x4ada('0x43')]);_0x1ce581[_0x4ada('0x47')]=_['keys'](_0x4bbed8[_0x4ada('0x47')]);_0x1ce581[_0x4ada('0x48')]=_['intersection'](_0x1ce581[_0x4ada('0x46')],_0x1ce581[_0x4ada('0x47')]);_0x1e27df['attributes']=_['intersection'](_0x1ce581[_0x4ada('0x46')],qs['fields'](_0x4bbed8[_0x4ada('0x47')][_0x4ada('0x4b')]));_0x1e27df['attributes']=_0x1e27df[_0x4ada('0x4a')][_0x4ada('0x5f')]?_0x1e27df[_0x4ada('0x4a')]:_0x1ce581[_0x4ada('0x46')];if(!_0x4bbed8[_0x4ada('0x47')][_0x4ada('0x4c')]('nolimit')){_0x1e27df[_0x4ada('0x4e')]=qs[_0x4ada('0x4e')](_0x4bbed8['query'][_0x4ada('0x4e')]);_0x1e27df[_0x4ada('0x31')]=qs['offset'](_0x4bbed8[_0x4ada('0x47')]['offset']);}_0x1e27df[_0x4ada('0x4f')]=qs[_0x4ada('0x50')](_0x4bbed8[_0x4ada('0x47')][_0x4ada('0x50')]);_0x1e27df[_0x4ada('0x51')]=qs[_0x4ada('0x48')](_['pick'](_0x4bbed8[_0x4ada('0x47')],_0x1ce581[_0x4ada('0x48')]));_0x1e27df[_0x4ada('0x51')]['OpenchannelAccountId']=_0x204b82['id'];if(_0x4bbed8['query'][_0x4ada('0x53')]){_0x1e27df[_0x4ada('0x51')]=_[_0x4ada('0x54')](_0x1e27df['where'],{'$or':_['map'](_0x1e27df[_0x4ada('0x4a')],function(_0x6cc71d){var _0x2d6253={};_0x2d6253[_0x6cc71d]={'$like':'%'+_0x4bbed8[_0x4ada('0x47')][_0x4ada('0x53')]+'%'};return _0x2d6253;})});}_0x1e27df=_[_0x4ada('0x54')]({},_0x1e27df,_0x4bbed8['options']);return db['OpenchannelInteraction'][_0x4ada('0x33')]({'where':_0x1e27df[_0x4ada('0x51')]})[_0x4ada('0x22')](function(_0xadb600){_0x605e2d[_0x4ada('0x33')]=_0xadb600;if(_0x4bbed8[_0x4ada('0x47')][_0x4ada('0x57')]){_0x1e27df[_0x4ada('0x58')]=[{'model':db['CmContact'],'as':_0x4ada('0xb2'),'required':![]},{'model':db[_0x4ada('0x9e')],'as':_0x4ada('0xb3'),'attributes':[_0x4ada('0x3e'),'fullname',_0x4ada('0xb4')],'required':![]},{'model':db[_0x4ada('0xb5')],'as':_0x4ada('0xb6'),'attributes':['id','name','color'],'where':_0x4bbed8[_0x4ada('0x47')]['tag']?{'id':_0x4bbed8[_0x4ada('0x47')][_0x4ada('0xb7')]}:undefined,'required':_0x4bbed8[_0x4ada('0x47')][_0x4ada('0xb7')]?!![]:![]}];}return db['OpenchannelInteraction'][_0x4ada('0x5a')](_0x1e27df);})[_0x4ada('0x22')](function(_0x4118b6){_0x605e2d[_0x4ada('0x5b')]=_0x4118b6;return _0x605e2d;});}})[_0x4ada('0x22')](respondWithFilteredResult(_0x421fb9,_0x1e27df))[_0x4ada('0x2d')](handleError(_0x421fb9,null));};exports[_0x4ada('0xb8')]=function(_0x556964,_0x436df9,_0x179811){return db['OpenchannelAccount']['find']({'where':{'id':_0x556964[_0x4ada('0x5c')]['id']}})['then'](handleEntityNotFound(_0x436df9,null))[_0x4ada('0x22')](function(_0x5327ac){if(_0x5327ac){return _0x5327ac[_0x4ada('0xb8')](_0x556964[_0x4ada('0x62')][_0x4ada('0x6e')],_[_0x4ada('0xb9')](_0x556964[_0x4ada('0x62')],[_0x4ada('0x6e'),'id'])||{})[_0x4ada('0x95')](function(_0x162aed){for(var _0x6a8342=0x0;_0x6a8342<_0x556964[_0x4ada('0x62')]['ids']['length'];_0x6a8342+=0x1){socket['emit']('userOpenchannelAccount:save',{'UserId':Number(_0x556964['body'][_0x4ada('0x6e')][_0x6a8342]),'OpenchannelAccountId':Number(_0x556964[_0x4ada('0x5c')]['id'])});}return _0x162aed;});}})[_0x4ada('0x22')](respondWithResult(_0x436df9,null))[_0x4ada('0x2d')](handleError(_0x436df9,null));};exports[_0x4ada('0xba')]=function(_0x1ed298,_0x15dd13,_0x498d83){return db[_0x4ada('0x59')][_0x4ada('0x60')]({'where':{'id':_0x1ed298['params']['id']}})[_0x4ada('0x22')](handleEntityNotFound(_0x15dd13,null))[_0x4ada('0x22')](function(_0x3fe185){if(_0x3fe185){return _0x3fe185[_0x4ada('0xba')](_0x1ed298[_0x4ada('0x47')][_0x4ada('0x6e')])[_0x4ada('0x22')](function(){if(_[_0x4ada('0xbb')](_0x1ed298[_0x4ada('0x47')][_0x4ada('0x6e')])){for(var _0x4ffbd2=0x0;_0x4ffbd2<_0x1ed298[_0x4ada('0x47')][_0x4ada('0x6e')][_0x4ada('0x5f')];_0x4ffbd2+=0x1){socket[_0x4ada('0xbc')](_0x4ada('0xbd'),{'UserId':Number(_0x1ed298['query'][_0x4ada('0x6e')][_0x4ffbd2]),'OpenchannelAccountId':Number(_0x1ed298[_0x4ada('0x5c')]['id'])});}}else{socket[_0x4ada('0xbc')](_0x4ada('0xbd'),{'UserId':Number(_0x1ed298['query'][_0x4ada('0x6e')]),'OpenchannelAccountId':Number(_0x1ed298[_0x4ada('0x5c')]['id'])});}});}})[_0x4ada('0x22')](respondWithStatusCode(_0x15dd13,null))['catch'](handleError(_0x15dd13,null));};exports[_0x4ada('0xbe')]=function(_0x43b980,_0x23df83,_0x3b8e82){var _0x5bca23={};var _0x336448={};var _0x505417;var _0x5b1a25;return db[_0x4ada('0x59')][_0x4ada('0x6b')]({'where':{'id':_0x43b980[_0x4ada('0x5c')]['id']}})[_0x4ada('0x22')](handleEntityNotFound(_0x23df83,null))[_0x4ada('0x22')](function(_0x1565c5){if(_0x1565c5){_0x505417=_0x1565c5;_0x336448[_0x4ada('0x46')]=_[_0x4ada('0x5e')](db['User'][_0x4ada('0x43')]);_0x336448[_0x4ada('0x47')]=_[_0x4ada('0x5e')](_0x43b980['query']);_0x336448['filters']=_[_0x4ada('0x49')](_0x336448['model'],_0x336448[_0x4ada('0x47')]);_0x5bca23[_0x4ada('0x4a')]=_[_0x4ada('0x49')](_0x336448[_0x4ada('0x46')],qs[_0x4ada('0x4b')](_0x43b980['query'][_0x4ada('0x4b')]));_0x5bca23[_0x4ada('0x4a')]=_0x5bca23[_0x4ada('0x4a')][_0x4ada('0x5f')]?_0x5bca23[_0x4ada('0x4a')]:_0x336448[_0x4ada('0x46')];_0x5bca23[_0x4ada('0x4f')]=qs[_0x4ada('0x50')](_0x43b980[_0x4ada('0x47')]['sort']);_0x5bca23[_0x4ada('0x51')]=qs[_0x4ada('0x48')](_[_0x4ada('0x52')](_0x43b980[_0x4ada('0x47')],_0x336448[_0x4ada('0x48')]));if(_0x43b980[_0x4ada('0x47')][_0x4ada('0x53')]){_0x5bca23['where']=_[_0x4ada('0x54')](_0x5bca23[_0x4ada('0x51')],{'$or':_['map'](_0x5bca23[_0x4ada('0x4a')],function(_0x4a1bf3){var _0x445a2d={};_0x445a2d[_0x4a1bf3]={'$like':'%'+_0x43b980[_0x4ada('0x47')][_0x4ada('0x53')]+'%'};return _0x445a2d;})});}_0x5bca23=_[_0x4ada('0x54')]({},_0x5bca23,_0x43b980['options']);return _0x505417[_0x4ada('0xbe')](_0x5bca23);}})[_0x4ada('0x22')](function(_0x377234){if(_0x377234){_0x5b1a25=_0x377234[_0x4ada('0x5f')];if(!_0x43b980['query'][_0x4ada('0x4c')](_0x4ada('0x4d'))){_0x5bca23[_0x4ada('0x4e')]=qs[_0x4ada('0x4e')](_0x43b980[_0x4ada('0x47')]['limit']);_0x5bca23[_0x4ada('0x31')]=qs[_0x4ada('0x31')](_0x43b980['query']['offset']);}return _0x505417[_0x4ada('0xbe')](_0x5bca23);}})[_0x4ada('0x22')](function(_0x284036){if(_0x284036){return _0x284036?{'count':_0x5b1a25,'rows':_0x284036}:null;}})['then'](respondWithResult(_0x23df83,null))[_0x4ada('0x2d')](handleError(_0x23df83,null));};exports['send']=function(_0x2c8df1,_0x176f10,_0x5ba696){var _0x38147d,_0x8f7db4,_0x570ea1;if(_[_0x4ada('0x7c')](_0x2c8df1[_0x4ada('0x62')][_0x4ada('0x62')])||_0x2c8df1[_0x4ada('0x62')][_0x4ada('0x62')]===''){throw new db[(_0x4ada('0x75'))]['ValidationError'](_0x4ada('0x7f'));}if(_[_0x4ada('0x7c')](_0x2c8df1[_0x4ada('0x62')]['to'])){}_0x38147d=_0x2c8df1[_0x4ada('0x62')]['to'];return db['OpenchannelAccount'][_0x4ada('0x6b')]({'where':{'id':_0x2c8df1[_0x4ada('0x5c')]['id']}})[_0x4ada('0x22')](handleEntityNotFound(_0x176f10,null))['then'](function(_0x3f92bd){if(_0x3f92bd){return db[_0x4ada('0x59')]['find']({'where':{'id':_0x3f92bd['id']},'include':[{'model':db[_0x4ada('0x83')],'as':'List','include':[{'model':db[_0x4ada('0x74')],'as':_0x4ada('0x85'),'where':{[_0x3f92bd[_0x4ada('0x80')]]:_0x38147d},'limit':0x1,'order':[[_0x4ada('0x78'),'DESC']]}]}]})[_0x4ada('0x22')](handleEntityNotFound(_0x176f10,null))[_0x4ada('0x22')](function(_0x21fb70){if(_0x21fb70&&_0x21fb70[_0x4ada('0x84')]){_0x8f7db4=_0x21fb70['get']({'plain':!![]});if(_0x8f7db4[_0x4ada('0x84')]&&_0x8f7db4[_0x4ada('0x84')][_0x4ada('0x85')][_0x4ada('0x5f')]){return _0x8f7db4[_0x4ada('0x84')][_0x4ada('0x85')][0x0];}return db[_0x4ada('0x74')][_0x4ada('0x61')](_['defaults'](_0x2c8df1[_0x4ada('0x62')],{'firstName':_0x38147d,[_0x21fb70[_0x4ada('0x80')]]:_0x38147d,'phone':_0x38147d,'ListId':_0x8f7db4[_0x4ada('0x7b')]}));}})[_0x4ada('0x22')](handleEntityNotFound(_0x176f10,null))[_0x4ada('0x22')](function(_0x1a2022){if(_0x1a2022){_0x570ea1=_0x1a2022;return db[_0x4ada('0x92')]['find']({'where':{'ContactId':_0x570ea1['id'],'closed':![],'OpenchannelAccountId':_0x8f7db4['id']}})[_0x4ada('0x22')](function(_0x11a4af){if(_0x11a4af){return[_0x11a4af,![]];}return db[_0x4ada('0x92')][_0x4ada('0x61')]({'UserId':_0x2c8df1[_0x4ada('0x63')]['id'],'ContactId':_0x570ea1['id'],'OpenchannelAccountId':_0x8f7db4['id'],'lastMsgDirection':_0x4ada('0xbf'),'firstMsgDirection':_0x4ada('0xbf'),'Messages':[_['merge'](_0x2c8df1['body'],{'read':![],'body':_0x2c8df1[_0x4ada('0x62')][_0x4ada('0x62')],'OpenchannelAccountId':_0x8f7db4['id'],'UserId':_0x2c8df1[_0x4ada('0x63')]['id'],'ContactId':_0x570ea1['id']})]},{'include':[{'model':db[_0x4ada('0x9d')],'as':_0x4ada('0xc0')}]})[_0x4ada('0x22')](function(_0x565c7a){return[_0x565c7a,!![]];});});}})['spread'](function(_0x46858b,_0x3837ba){if(_0x3837ba){return _0x46858b;}return db[_0x4ada('0x9d')][_0x4ada('0x61')](_[_0x4ada('0x54')](_0x2c8df1[_0x4ada('0x62')],{'read':![],'body':_0x2c8df1[_0x4ada('0x62')][_0x4ada('0x62')],'OpenchannelAccountId':_0x8f7db4['id'],'OpenchannelInteractionId':_0x46858b['id'],'UserId':_0x2c8df1[_0x4ada('0x63')]['id'],'ContactId':_0x570ea1['id']}))[_0x4ada('0x22')](function(_0x13b184){_0x46858b[_0x4ada('0xc1')][_0x4ada('0xc0')]=[];_0x46858b[_0x4ada('0xc1')][_0x4ada('0xc0')][_0x4ada('0x9a')](_0x13b184[_0x4ada('0xc1')]);return _0x46858b;});});}})[_0x4ada('0x22')](respondWithResult(_0x176f10,null))[_0x4ada('0x2d')](handleError(_0x176f10,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 54fe3df..d100026 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 _0xf4eb=['hook','events','update','emit','hasOwnProperty'];(function(_0x5ea60a,_0xd007d4){var _0x1b2359=function(_0x5e4b53){while(--_0x5e4b53){_0x5ea60a['push'](_0x5ea60a['shift']());}};_0x1b2359(++_0xd007d4);}(_0xf4eb,0xec));var _0xbf4e=function(_0x376006,_0x4db369){_0x376006=_0x376006-0x0;var _0x42ca92=_0xf4eb[_0x376006];return _0x42ca92;};'use strict';var EventEmitter=require(_0xbf4e('0x0'));var OpenchannelAccount=require('../../mysqldb')['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xbf4e('0x1'),'afterDestroy':'remove'};function emitEvent(_0x4e7fa7){return function(_0x2e3070,_0x1c7606,_0x32d1d7){OpenchannelAccountEvents[_0xbf4e('0x2')](_0x4e7fa7+':'+_0x2e3070['id'],_0x2e3070);OpenchannelAccountEvents[_0xbf4e('0x2')](_0x4e7fa7,_0x2e3070);_0x32d1d7(null);};}for(var e in events){if(events[_0xbf4e('0x3')](e)){var event=events[e];OpenchannelAccount[_0xbf4e('0x4')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file +var _0xb688=['../../mysqldb','OpenchannelAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x1d06a5,_0x4fc577){var _0xbaab59=function(_0x458664){while(--_0x458664){_0x1d06a5['push'](_0x1d06a5['shift']());}};_0xbaab59(++_0x4fc577);}(_0xb688,0xcf));var _0x8b68=function(_0x53a28a,_0x1ffb7d){_0x53a28a=_0x53a28a-0x0;var _0x178c61=_0xb688[_0x53a28a];return _0x178c61;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0x8b68('0x0'))['db'][_0x8b68('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x8b68('0x2')](0x0);var events={'afterCreate':_0x8b68('0x3'),'afterUpdate':_0x8b68('0x4'),'afterDestroy':_0x8b68('0x5')};function emitEvent(_0x4e281c){return function(_0x41030e,_0x27925d,_0x30f33d){OpenchannelAccountEvents[_0x8b68('0x6')](_0x4e281c+':'+_0x41030e['id'],_0x41030e);OpenchannelAccountEvents['emit'](_0x4e281c,_0x41030e);_0x30f33d(null);};}for(var e in events){if(events[_0x8b68('0x7')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module[_0x8b68('0x8')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 3d1ddf4..d9b9e94 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(_0x4b0061,_0x8a95da){var _0x55c2db=function(_0x2dd1ba){while(--_0x2dd1ba){_0x4b0061['push'](_0x4b0061['shift']());}};_0x55c2db(++_0x8a95da);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'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(_0x2ce5e3,_0x371dc1){var _0x5ced9a=function(_0x1d9e69){while(--_0x1d9e69){_0x2ce5e3['push'](_0x2ce5e3['shift']());}};_0x5ced9a(++_0x371dc1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'openchannel_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.rpc.js b/server/api/openchannelAccount/openchannelAccount.rpc.js index e3bbef6..44a7d34 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 _0x0427=['./openchannelAccount.socket','register','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x55bf9a,_0xc1f45c){var _0x3715e0=function(_0x24aa5f){while(--_0x24aa5f){_0x55bf9a['push'](_0x55bf9a['shift']());}};_0x3715e0(++_0xc1f45c);}(_0x0427,0x137));var _0x7042=function(_0x5ebfb7,_0x42f415){_0x5ebfb7=_0x5ebfb7-0x0;var _0x203f86=_0x0427[_0x5ebfb7];return _0x203f86;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7042('0x0'));var BPromise=require(_0x7042('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7042('0x2'));var db=require(_0x7042('0x3'))['db'];var utils=require(_0x7042('0x4'));var logger=require(_0x7042('0x5'))(_0x7042('0x6'));var config=require(_0x7042('0x7'));var jayson=require(_0x7042('0x8'));var client=jayson['client'][_0x7042('0x9')]({'port':0x232a});config[_0x7042('0xa')]=_[_0x7042('0xb')](config[_0x7042('0xa')],{'host':_0x7042('0xc'),'port':0x18eb});var socket=require(_0x7042('0xd'))(new Redis(config[_0x7042('0xa')]));require(_0x7042('0xe'))[_0x7042('0xf')](socket);function respondWithRpcPromise(_0x5a29aa,_0x326210,_0x5c3f0f){return new BPromise(function(_0x5cf853,_0x50eefb){return client['request'](_0x5a29aa,_0x5c3f0f)[_0x7042('0x10')](function(_0x5636e8){logger[_0x7042('0x11')](_0x7042('0x12'),_0x326210,_0x7042('0x13'));logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x326210,_0x7042('0x13'),JSON[_0x7042('0x14')](_0x5636e8));if(_0x5636e8[_0x7042('0x15')]){if(_0x5636e8[_0x7042('0x15')][_0x7042('0x16')]===0x1f4){logger[_0x7042('0x15')]('OpenchannelAccount,\x20%s,\x20%s',_0x326210,_0x5636e8[_0x7042('0x15')][_0x7042('0x17')]);return _0x50eefb(_0x5636e8[_0x7042('0x15')]['message']);}logger[_0x7042('0x15')](_0x7042('0x12'),_0x326210,_0x5636e8['error'][_0x7042('0x17')]);return _0x5cf853(_0x5636e8['error']['message']);}else{logger[_0x7042('0x11')](_0x7042('0x12'),_0x326210,_0x7042('0x13'));_0x5cf853(_0x5636e8[_0x7042('0x18')][_0x7042('0x17')]);}})['catch'](function(_0x438084){logger[_0x7042('0x15')](_0x7042('0x12'),_0x326210,_0x438084);_0x50eefb(_0x438084);});});} \ No newline at end of file +var _0x6e6c=['OpenchannelAccount,\x20%s,\x20%s','message','catch','lodash','util','bluebird','randomstring','../../config/utils','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','request','then','info','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x598a8b,_0x151600){var _0x2411dd=function(_0x3e9947){while(--_0x3e9947){_0x598a8b['push'](_0x598a8b['shift']());}};_0x2411dd(++_0x151600);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x6e6c[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xc6e6('0x0'));var util=require(_0xc6e6('0x1'));var moment=require('moment');var BPromise=require(_0xc6e6('0x2'));var rs=require(_0xc6e6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc6e6('0x4'));var logger=require('../../config/logger')(_0xc6e6('0x5'));var config=require('../../config/environment');var jayson=require(_0xc6e6('0x6'));var client=jayson[_0xc6e6('0x7')]['http']({'port':0x232a});config[_0xc6e6('0x8')]=_[_0xc6e6('0x9')](config['redis'],{'host':_0xc6e6('0xa'),'port':0x18eb});var socket=require(_0xc6e6('0xb'))(new Redis(config['redis']));require(_0xc6e6('0xc'))['register'](socket);function respondWithRpcPromise(_0x172aa9,_0x3b2f50,_0x29f78a){return new BPromise(function(_0x3ddf6f,_0x12596b){return client[_0xc6e6('0xd')](_0x172aa9,_0x29f78a)[_0xc6e6('0xe')](function(_0x10aae5){logger[_0xc6e6('0xf')]('OpenchannelAccount,\x20%s,\x20%s',_0x3b2f50,_0xc6e6('0x10'));logger['debug'](_0xc6e6('0x11'),_0x3b2f50,_0xc6e6('0x10'),JSON[_0xc6e6('0x12')](_0x10aae5));if(_0x10aae5[_0xc6e6('0x13')]){if(_0x10aae5['error'][_0xc6e6('0x14')]===0x1f4){logger[_0xc6e6('0x13')](_0xc6e6('0x15'),_0x3b2f50,_0x10aae5[_0xc6e6('0x13')][_0xc6e6('0x16')]);return _0x12596b(_0x10aae5['error'][_0xc6e6('0x16')]);}logger[_0xc6e6('0x13')]('OpenchannelAccount,\x20%s,\x20%s',_0x3b2f50,_0x10aae5[_0xc6e6('0x13')][_0xc6e6('0x16')]);return _0x3ddf6f(_0x10aae5[_0xc6e6('0x13')]['message']);}else{logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x3b2f50,_0xc6e6('0x10'));_0x3ddf6f(_0x10aae5['result'][_0xc6e6('0x16')]);}})[_0xc6e6('0x17')](function(_0x1ecc8f){logger[_0xc6e6('0x13')](_0xc6e6('0x15'),_0x3b2f50,_0x1ecc8f);_0x12596b(_0x1ecc8f);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index cb35723..2d49018 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 _0x92f0=['remove','removeListener','register','length','save'];(function(_0xe602,_0x4ffd07){var _0x3283e5=function(_0xbf8e0a){while(--_0xbf8e0a){_0xe602['push'](_0xe602['shift']());}};_0x3283e5(++_0x4ffd07);}(_0x92f0,0x10d));var _0x092f=function(_0x4206f5,_0x21f338){_0x4206f5=_0x4206f5-0x0;var _0xa29cf3=_0x92f0[_0x4206f5];return _0xa29cf3;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0x092f('0x0'),_0x092f('0x1'),'update'];function createListener(_0x6d6daa,_0x2530d4){return function(_0x5e9f2c){_0x2530d4['emit'](_0x6d6daa,_0x5e9f2c);};}function removeListener(_0x16bf0b,_0x2db72b){return function(){OpenchannelAccountEvents[_0x092f('0x2')](_0x16bf0b,_0x2db72b);};}exports[_0x092f('0x3')]=function(_0x2996b0){for(var _0x2b6dcb=0x0,_0x5b5741=events[_0x092f('0x4')];_0x2b6dcb<_0x5b5741;_0x2b6dcb++){var _0x542b99=events[_0x2b6dcb];var _0x1825f7=createListener('openchannelAccount:'+_0x542b99,_0x2996b0);OpenchannelAccountEvents['on'](_0x542b99,_0x1825f7);}}; \ No newline at end of file +var _0x0eaa=['emit','removeListener','register','./openchannelAccount.events','save'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0eaa,0x1c5));var _0xa0ea=function(_0xda2906,_0x998a4a){_0xda2906=_0xda2906-0x0;var _0x1bf955=_0x0eaa[_0xda2906];return _0x1bf955;};'use strict';var OpenchannelAccountEvents=require(_0xa0ea('0x0'));var events=[_0xa0ea('0x1'),'remove','update'];function createListener(_0x17efb8,_0x1fe195){return function(_0x5800e9){_0x1fe195[_0xa0ea('0x2')](_0x17efb8,_0x5800e9);};}function removeListener(_0x1c74b8,_0x30dd52){return function(){OpenchannelAccountEvents[_0xa0ea('0x3')](_0x1c74b8,_0x30dd52);};}exports[_0xa0ea('0x4')]=function(_0x5636ed){for(var _0x3c6586=0x0,_0x521881=events['length'];_0x3c6586<_0x521881;_0x3c6586++){var _0x361178=events[_0x3c6586];var _0x8632a1=createListener('openchannelAccount:'+_0x361178,_0x5636ed);OpenchannelAccountEvents['on'](_0x361178,_0x8632a1);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 11ae256..32f32ad 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 _0x4606=['multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','isAuthenticated','/:id','show','post','update','delete','destroy'];(function(_0x4dd524,_0x2247e5){var _0x482629=function(_0x1fc3a0){while(--_0x1fc3a0){_0x4dd524['push'](_0x4dd524['shift']());}};_0x482629(++_0x2247e5);}(_0x4606,0x1dc));var _0x6460=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4606[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x6460('0x0'));var util=require(_0x6460('0x1'));var path=require(_0x6460('0x2'));var timeout=require('connect-timeout');var express=require(_0x6460('0x3'));var router=express[_0x6460('0x4')]();var fs_extra=require(_0x6460('0x5'));var auth=require(_0x6460('0x6'));var interaction=require(_0x6460('0x7'));var config=require(_0x6460('0x8'));var controller=require(_0x6460('0x9'));router['get']('/',auth[_0x6460('0xa')](),controller['index']);router['get'](_0x6460('0xb'),auth[_0x6460('0xa')](),controller[_0x6460('0xc')]);router[_0x6460('0xd')]('/',auth[_0x6460('0xa')](),controller['create']);router['put']('/:id',auth[_0x6460('0xa')](),controller[_0x6460('0xe')]);router[_0x6460('0xf')]('/:id',auth[_0x6460('0xa')](),controller[_0x6460('0x10')]);module['exports']=router; \ No newline at end of file +var _0x062b=['show','post','create','delete','/:id','destroy','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get'];(function(_0x101dce,_0x3b887c){var _0x5a92bb=function(_0x5bac04){while(--_0x5bac04){_0x101dce['push'](_0x101dce['shift']());}};_0x5a92bb(++_0x3b887c);}(_0x062b,0x1d7));var _0xb062=function(_0x3087bf,_0xb3c0d2){_0x3087bf=_0x3087bf-0x0;var _0x1c4a5e=_0x062b[_0x3087bf];return _0x1c4a5e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb062('0x0'));var timeout=require(_0xb062('0x1'));var express=require('express');var router=express[_0xb062('0x2')]();var fs_extra=require(_0xb062('0x3'));var auth=require(_0xb062('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb062('0x5'));var controller=require('./openchannelApplication.controller');router['get']('/',auth[_0xb062('0x6')](),controller[_0xb062('0x7')]);router[_0xb062('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xb062('0x9')]);router[_0xb062('0xa')]('/',auth[_0xb062('0x6')](),controller[_0xb062('0xb')]);router['put']('/:id',auth[_0xb062('0x6')](),controller['update']);router[_0xb062('0xc')](_0xb062('0xd'),auth[_0xb062('0x6')](),controller[_0xb062('0xe')]);module[_0xb062('0xf')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index f2dabf8..5d8aa68 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 _0xce87=['TEXT','*,*,*,*','sequelize'];(function(_0x5650b4,_0x2723ba){var _0x297a62=function(_0x4ceedf){while(--_0x4ceedf){_0x5650b4['push'](_0x5650b4['shift']());}};_0x297a62(++_0x2723ba);}(_0xce87,0x65));var _0x7ce8=function(_0x536cdf,_0x54ee2a){_0x536cdf=_0x536cdf-0x0;var _0xdc5eac=_0xce87[_0x536cdf];return _0xdc5eac;};'use strict';var Sequelize=require(_0x7ce8('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x7ce8('0x1')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x7ce8('0x2')}}; \ No newline at end of file +var _0xdbc6=['noop','TEXT','*,*,*,*','exports','INTEGER','STRING'];(function(_0x870b62,_0x2143f9){var _0x2dcb39=function(_0x2fb63d){while(--_0x2fb63d){_0x870b62['push'](_0x870b62['shift']());}};_0x2dcb39(++_0x2143f9);}(_0xdbc6,0x1cb));var _0x6dbc=function(_0x481d75,_0x39611d){_0x481d75=_0x481d75-0x0;var _0x52e6f8=_0xdbc6[_0x481d75];return _0x52e6f8;};'use strict';var Sequelize=require('sequelize');module[_0x6dbc('0x0')]={'priority':{'type':Sequelize[_0x6dbc('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x6dbc('0x2')],'allowNull':![],'defaultValue':_0x6dbc('0x3')},'appdata':{'type':Sequelize[_0x6dbc('0x4')]()},'description':{'type':Sequelize[_0x6dbc('0x2')]},'interval':{'type':Sequelize[_0x6dbc('0x2')],'defaultValue':_0x6dbc('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index bdb8539..7683726 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 _0x9adb=['then','destroy','error','stack','name','send','map','OpenchannelApplication','rawAttributes','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','type','VIRTUAL','merge','include','findAll','rows','catch','params','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','save','update'];(function(_0xf88ed6,_0x2f6bc2){var _0x1480a4=function(_0x2a3290){while(--_0x2a3290){_0xf88ed6['push'](_0xf88ed6['shift']());}};_0x1480a4(++_0x2f6bc2);}(_0x9adb,0xb2));var _0xb9ad=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9adb[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xb9ad('0x0'));var rimraf=require(_0xb9ad('0x1'));var zipdir=require(_0xb9ad('0x2'));var jsonpatch=require(_0xb9ad('0x3'));var rp=require(_0xb9ad('0x4'));var moment=require(_0xb9ad('0x5'));var BPromise=require(_0xb9ad('0x6'));var Mustache=require('mustache');var util=require(_0xb9ad('0x7'));var path=require('path');var sox=require(_0xb9ad('0x8'));var csv=require(_0xb9ad('0x9'));var ejs=require(_0xb9ad('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb9ad('0xb'));var squel=require(_0xb9ad('0xc'));var crypto=require('crypto');var jsforce=require(_0xb9ad('0xd'));var deskjs=require(_0xb9ad('0xe'));var toCsv=require(_0xb9ad('0x9'));var querystring=require('querystring');var Papa=require(_0xb9ad('0xf'));var Redis=require(_0xb9ad('0x10'));var authService=require(_0xb9ad('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xb9ad('0x12'));var hardwareService=require(_0xb9ad('0x13'));var logger=require('../../config/logger')(_0xb9ad('0x14'));var utils=require(_0xb9ad('0x15'));var config=require(_0xb9ad('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xb9ad('0x17'))['db'];function respondWithStatusCode(_0x2a2e48,_0x309a9d){_0x309a9d=_0x309a9d||0xcc;return function(_0x4b7670){if(_0x4b7670){return _0x2a2e48[_0xb9ad('0x18')](_0x309a9d);}return _0x2a2e48['status'](_0x309a9d)[_0xb9ad('0x19')]();};}function respondWithResult(_0x5261db,_0x2fe09b){_0x2fe09b=_0x2fe09b||0xc8;return function(_0x7ae4ed){if(_0x7ae4ed){return _0x5261db[_0xb9ad('0x1a')](_0x2fe09b)[_0xb9ad('0x1b')](_0x7ae4ed);}};}function respondWithFilteredResult(_0x1c3218,_0x1d0edb){return function(_0x55c5fb){if(_0x55c5fb){var _0x53d791=typeof _0x1d0edb[_0xb9ad('0x1c')]===_0xb9ad('0x1d')&&typeof _0x1d0edb[_0xb9ad('0x1e')]===_0xb9ad('0x1d');var _0xaa1261=_0x55c5fb['count'];var _0x324a37=_0x53d791?0x0:_0x1d0edb[_0xb9ad('0x1c')];var _0x4cf858=_0x53d791?_0x55c5fb[_0xb9ad('0x1f')]:_0x1d0edb['offset']+_0x1d0edb[_0xb9ad('0x1e')];var _0xef287d;if(_0x4cf858>=_0xaa1261){_0x4cf858=_0xaa1261;_0xef287d=0xc8;}else{_0xef287d=0xce;}_0x1c3218[_0xb9ad('0x1a')](_0xef287d);return _0x1c3218['set'](_0xb9ad('0x20'),_0x324a37+'-'+_0x4cf858+'/'+_0xaa1261)['json'](_0x55c5fb);}return null;};}function patchUpdates(_0x98ab0){return function(_0x590286){try{jsonpatch['apply'](_0x590286,_0x98ab0,!![]);}catch(_0x359ad1){return BPromise['reject'](_0x359ad1);}return _0x590286[_0xb9ad('0x21')]();};}function saveUpdates(_0x160f2a,_0x1fcb6c){return function(_0x12999e){if(_0x12999e){return _0x12999e[_0xb9ad('0x22')](_0x160f2a)[_0xb9ad('0x23')](function(_0x41a07a){return _0x41a07a;});}return null;};}function removeEntity(_0x6e057a,_0x344192){return function(_0x3c04dc){if(_0x3c04dc){return _0x3c04dc[_0xb9ad('0x24')]()[_0xb9ad('0x23')](function(){_0x6e057a[_0xb9ad('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a00c5,_0xa6e9cf){return function(_0x5c80ab){if(!_0x5c80ab){_0x2a00c5['sendStatus'](0x194);}return _0x5c80ab;};}function handleError(_0x22bf80,_0x3f8c2c){_0x3f8c2c=_0x3f8c2c||0x1f4;return function(_0x432ed1){logger[_0xb9ad('0x25')](_0x432ed1[_0xb9ad('0x26')]);if(_0x432ed1[_0xb9ad('0x27')]){delete _0x432ed1[_0xb9ad('0x27')];}_0x22bf80[_0xb9ad('0x1a')](_0x3f8c2c)[_0xb9ad('0x28')](_0x432ed1);};}exports['index']=function(_0x52ed3a,_0x2e18c7){var _0x522075={},_0x2178df={},_0x161abe={'count':0x0,'rows':[]};var _0x48b994=_[_0xb9ad('0x29')](db[_0xb9ad('0x2a')][_0xb9ad('0x2b')],function(_0x1b4b91){return{'name':_0x1b4b91['fieldName'],'type':_0x1b4b91['type'][_0xb9ad('0x2c')]};});_0x2178df[_0xb9ad('0x2d')]=_[_0xb9ad('0x29')](_0x48b994,_0xb9ad('0x27'));_0x2178df[_0xb9ad('0x2e')]=_[_0xb9ad('0x2f')](_0x52ed3a[_0xb9ad('0x2e')]);_0x2178df[_0xb9ad('0x30')]=_['intersection'](_0x2178df[_0xb9ad('0x2d')],_0x2178df[_0xb9ad('0x2e')]);_0x522075[_0xb9ad('0x31')]=_[_0xb9ad('0x32')](_0x2178df[_0xb9ad('0x2d')],qs[_0xb9ad('0x33')](_0x52ed3a[_0xb9ad('0x2e')][_0xb9ad('0x33')]));_0x522075[_0xb9ad('0x31')]=_0x522075[_0xb9ad('0x31')][_0xb9ad('0x34')]?_0x522075[_0xb9ad('0x31')]:_0x2178df[_0xb9ad('0x2d')];if(!_0x52ed3a[_0xb9ad('0x2e')][_0xb9ad('0x35')](_0xb9ad('0x36'))){_0x522075['limit']=qs[_0xb9ad('0x1e')](_0x52ed3a['query'][_0xb9ad('0x1e')]);_0x522075[_0xb9ad('0x1c')]=qs['offset'](_0x52ed3a[_0xb9ad('0x2e')][_0xb9ad('0x1c')]);}_0x522075['order']=qs[_0xb9ad('0x37')](_0x52ed3a[_0xb9ad('0x2e')]['sort']);_0x522075['where']=qs['filters'](_[_0xb9ad('0x38')](_0x52ed3a[_0xb9ad('0x2e')],_0x2178df[_0xb9ad('0x30')]),_0x48b994);if(_0x52ed3a['query'][_0xb9ad('0x39')]){_0x522075[_0xb9ad('0x3a')]=_['merge'](_0x522075['where'],{'$or':_['map'](_0x48b994,function(_0x40e915){if(_0x40e915[_0xb9ad('0x3b')]!==_0xb9ad('0x3c')){var _0x2abf3d={};_0x2abf3d[_0x40e915[_0xb9ad('0x27')]]={'$like':'%'+_0x52ed3a[_0xb9ad('0x2e')][_0xb9ad('0x39')]+'%'};return _0x2abf3d;}})});}_0x522075=_[_0xb9ad('0x3d')]({},_0x522075,_0x52ed3a['options']);var _0x2d4d91={'where':_0x522075[_0xb9ad('0x3a')]};return db[_0xb9ad('0x2a')][_0xb9ad('0x1f')](_0x2d4d91)[_0xb9ad('0x23')](function(_0x78a7f2){_0x161abe[_0xb9ad('0x1f')]=_0x78a7f2;if(_0x52ed3a[_0xb9ad('0x2e')]['includeAll']){_0x522075[_0xb9ad('0x3e')]=[{'all':!![]}];}return db[_0xb9ad('0x2a')][_0xb9ad('0x3f')](_0x522075);})[_0xb9ad('0x23')](function(_0x2e628d){_0x161abe[_0xb9ad('0x40')]=_0x2e628d;return _0x161abe;})[_0xb9ad('0x23')](respondWithFilteredResult(_0x2e18c7,_0x522075))[_0xb9ad('0x41')](handleError(_0x2e18c7,null));};exports['show']=function(_0x5a3722,_0x4bc8f8){var _0xdc7dbc={'raw':!![],'where':{'id':_0x5a3722[_0xb9ad('0x42')]['id']}},_0x5928fb={};_0x5928fb[_0xb9ad('0x2d')]=_[_0xb9ad('0x2f')](db[_0xb9ad('0x2a')][_0xb9ad('0x2b')]);_0x5928fb[_0xb9ad('0x2e')]=_[_0xb9ad('0x2f')](_0x5a3722[_0xb9ad('0x2e')]);_0x5928fb[_0xb9ad('0x30')]=_[_0xb9ad('0x32')](_0x5928fb[_0xb9ad('0x2d')],_0x5928fb[_0xb9ad('0x2e')]);_0xdc7dbc['attributes']=_['intersection'](_0x5928fb[_0xb9ad('0x2d')],qs[_0xb9ad('0x33')](_0x5a3722[_0xb9ad('0x2e')]['fields']));_0xdc7dbc[_0xb9ad('0x31')]=_0xdc7dbc['attributes']['length']?_0xdc7dbc[_0xb9ad('0x31')]:_0x5928fb[_0xb9ad('0x2d')];if(_0x5a3722[_0xb9ad('0x2e')][_0xb9ad('0x43')]){_0xdc7dbc[_0xb9ad('0x3e')]=[{'all':!![]}];}_0xdc7dbc=_[_0xb9ad('0x3d')]({},_0xdc7dbc,_0x5a3722['options']);return db['OpenchannelApplication'][_0xb9ad('0x44')](_0xdc7dbc)[_0xb9ad('0x23')](handleEntityNotFound(_0x4bc8f8,null))['then'](respondWithResult(_0x4bc8f8,null))['catch'](handleError(_0x4bc8f8,null));};exports[_0xb9ad('0x45')]=function(_0x10d53e,_0xbfb9e3){return db['OpenchannelApplication']['create'](_0x10d53e[_0xb9ad('0x46')],{})[_0xb9ad('0x23')](respondWithResult(_0xbfb9e3,0xc9))[_0xb9ad('0x41')](handleError(_0xbfb9e3,null));};exports[_0xb9ad('0x22')]=function(_0x5e3978,_0x22acb2){if(_0x5e3978['body']['id']){delete _0x5e3978[_0xb9ad('0x46')]['id'];}return db['OpenchannelApplication'][_0xb9ad('0x44')]({'where':{'id':_0x5e3978['params']['id']}})['then'](handleEntityNotFound(_0x22acb2,null))[_0xb9ad('0x23')](saveUpdates(_0x5e3978[_0xb9ad('0x46')],null))[_0xb9ad('0x23')](respondWithResult(_0x22acb2,null))['catch'](handleError(_0x22acb2,null));};exports['destroy']=function(_0x5433b8,_0x40b8fc){return db[_0xb9ad('0x2a')][_0xb9ad('0x44')]({'where':{'id':_0x5433b8[_0xb9ad('0x42')]['id']}})[_0xb9ad('0x23')](handleEntityNotFound(_0x40b8fc,null))[_0xb9ad('0x23')](removeEntity(_0x40b8fc,null))[_0xb9ad('0x41')](handleError(_0x40b8fc,null));}; \ No newline at end of file +var _0x6ae7=['findAll','catch','show','params','keys','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','OpenchannelApplication','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','includeAll','include'];(function(_0x4bdda3,_0x25f960){var _0x3f8722=function(_0x341120){while(--_0x341120){_0x4bdda3['push'](_0x4bdda3['shift']());}};_0x3f8722(++_0x25f960);}(_0x6ae7,0x134));var _0x76ae=function(_0x352ebf,_0x111b01){_0x352ebf=_0x352ebf-0x0;var _0x3dfcb1=_0x6ae7[_0x352ebf];return _0x3dfcb1;};'use strict';var emlformat=require(_0x76ae('0x0'));var rimraf=require(_0x76ae('0x1'));var zipdir=require(_0x76ae('0x2'));var jsonpatch=require(_0x76ae('0x3'));var rp=require(_0x76ae('0x4'));var moment=require(_0x76ae('0x5'));var BPromise=require(_0x76ae('0x6'));var Mustache=require(_0x76ae('0x7'));var util=require(_0x76ae('0x8'));var path=require('path');var sox=require(_0x76ae('0x9'));var csv=require(_0x76ae('0xa'));var ejs=require(_0x76ae('0xb'));var fs=require('fs');var fs_extra=require(_0x76ae('0xc'));var _=require('lodash');var squel=require(_0x76ae('0xd'));var crypto=require('crypto');var jsforce=require(_0x76ae('0xe'));var deskjs=require(_0x76ae('0xf'));var toCsv=require(_0x76ae('0xa'));var querystring=require(_0x76ae('0x10'));var Papa=require(_0x76ae('0x11'));var Redis=require(_0x76ae('0x12'));var authService=require(_0x76ae('0x13'));var qs=require(_0x76ae('0x14'));var as=require(_0x76ae('0x15'));var hardwareService=require(_0x76ae('0x16'));var logger=require(_0x76ae('0x17'))('api');var utils=require(_0x76ae('0x18'));var config=require(_0x76ae('0x19'));var licenseUtil=require(_0x76ae('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x15a6da,_0x42edad){_0x42edad=_0x42edad||0xcc;return function(_0xeec77a){if(_0xeec77a){return _0x15a6da['sendStatus'](_0x42edad);}return _0x15a6da[_0x76ae('0x1b')](_0x42edad)[_0x76ae('0x1c')]();};}function respondWithResult(_0x201385,_0x11bde2){_0x11bde2=_0x11bde2||0xc8;return function(_0x5c6942){if(_0x5c6942){return _0x201385[_0x76ae('0x1b')](_0x11bde2)['json'](_0x5c6942);}};}function respondWithFilteredResult(_0x2e3406,_0x5b0b9e){return function(_0x230212){if(_0x230212){var _0x36a5a0=typeof _0x5b0b9e[_0x76ae('0x1d')]===_0x76ae('0x1e')&&typeof _0x5b0b9e[_0x76ae('0x1f')]===_0x76ae('0x1e');var _0x469dfd=_0x230212[_0x76ae('0x20')];var _0x1f4d3e=_0x36a5a0?0x0:_0x5b0b9e[_0x76ae('0x1d')];var _0x4f0e48=_0x36a5a0?_0x230212['count']:_0x5b0b9e[_0x76ae('0x1d')]+_0x5b0b9e[_0x76ae('0x1f')];var _0xc65779;if(_0x4f0e48>=_0x469dfd){_0x4f0e48=_0x469dfd;_0xc65779=0xc8;}else{_0xc65779=0xce;}_0x2e3406[_0x76ae('0x1b')](_0xc65779);return _0x2e3406[_0x76ae('0x21')]('Content-Range',_0x1f4d3e+'-'+_0x4f0e48+'/'+_0x469dfd)['json'](_0x230212);}return null;};}function patchUpdates(_0x31e2a6){return function(_0x55dca8){try{jsonpatch[_0x76ae('0x22')](_0x55dca8,_0x31e2a6,!![]);}catch(_0x4eff61){return BPromise[_0x76ae('0x23')](_0x4eff61);}return _0x55dca8[_0x76ae('0x24')]();};}function saveUpdates(_0x288fb3,_0x31e657){return function(_0x22436f){if(_0x22436f){return _0x22436f[_0x76ae('0x25')](_0x288fb3)[_0x76ae('0x26')](function(_0x24070c){return _0x24070c;});}return null;};}function removeEntity(_0x4683ac,_0x217463){return function(_0x156299){if(_0x156299){return _0x156299[_0x76ae('0x27')]()[_0x76ae('0x26')](function(){_0x4683ac['status'](0xcc)[_0x76ae('0x1c')]();});}};}function handleEntityNotFound(_0x4163b5,_0x4cf694){return function(_0x3a6a69){if(!_0x3a6a69){_0x4163b5[_0x76ae('0x28')](0x194);}return _0x3a6a69;};}function handleError(_0x2e0062,_0x537a7f){_0x537a7f=_0x537a7f||0x1f4;return function(_0x2ebc58){logger[_0x76ae('0x29')](_0x2ebc58[_0x76ae('0x2a')]);if(_0x2ebc58[_0x76ae('0x2b')]){delete _0x2ebc58['name'];}_0x2e0062[_0x76ae('0x1b')](_0x537a7f)['send'](_0x2ebc58);};}exports[_0x76ae('0x2c')]=function(_0x1e5c3f,_0xb924aa){var _0xa9b28d={},_0x36075a={},_0x1aecdf={'count':0x0,'rows':[]};var _0x45e1c6=_[_0x76ae('0x2d')](db[_0x76ae('0x2e')][_0x76ae('0x2f')],function(_0x407118){return{'name':_0x407118[_0x76ae('0x30')],'type':_0x407118[_0x76ae('0x31')][_0x76ae('0x32')]};});_0x36075a[_0x76ae('0x33')]=_[_0x76ae('0x2d')](_0x45e1c6,_0x76ae('0x2b'));_0x36075a['query']=_['keys'](_0x1e5c3f[_0x76ae('0x34')]);_0x36075a[_0x76ae('0x35')]=_['intersection'](_0x36075a[_0x76ae('0x33')],_0x36075a[_0x76ae('0x34')]);_0xa9b28d[_0x76ae('0x36')]=_[_0x76ae('0x37')](_0x36075a[_0x76ae('0x33')],qs[_0x76ae('0x38')](_0x1e5c3f['query'][_0x76ae('0x38')]));_0xa9b28d[_0x76ae('0x36')]=_0xa9b28d[_0x76ae('0x36')][_0x76ae('0x39')]?_0xa9b28d[_0x76ae('0x36')]:_0x36075a[_0x76ae('0x33')];if(!_0x1e5c3f[_0x76ae('0x34')][_0x76ae('0x3a')](_0x76ae('0x3b'))){_0xa9b28d['limit']=qs['limit'](_0x1e5c3f[_0x76ae('0x34')]['limit']);_0xa9b28d[_0x76ae('0x1d')]=qs[_0x76ae('0x1d')](_0x1e5c3f['query'][_0x76ae('0x1d')]);}_0xa9b28d['order']=qs[_0x76ae('0x3c')](_0x1e5c3f[_0x76ae('0x34')]['sort']);_0xa9b28d[_0x76ae('0x3d')]=qs['filters'](_['pick'](_0x1e5c3f[_0x76ae('0x34')],_0x36075a[_0x76ae('0x35')]),_0x45e1c6);if(_0x1e5c3f['query'][_0x76ae('0x3e')]){_0xa9b28d[_0x76ae('0x3d')]=_[_0x76ae('0x3f')](_0xa9b28d[_0x76ae('0x3d')],{'$or':_[_0x76ae('0x2d')](_0x45e1c6,function(_0x579db0){if(_0x579db0['type']!=='VIRTUAL'){var _0x1dad6f={};_0x1dad6f[_0x579db0['name']]={'$like':'%'+_0x1e5c3f[_0x76ae('0x34')][_0x76ae('0x3e')]+'%'};return _0x1dad6f;}})});}_0xa9b28d=_[_0x76ae('0x3f')]({},_0xa9b28d,_0x1e5c3f[_0x76ae('0x40')]);var _0x49e4eb={'where':_0xa9b28d[_0x76ae('0x3d')]};return db[_0x76ae('0x2e')]['count'](_0x49e4eb)[_0x76ae('0x26')](function(_0x5eafd2){_0x1aecdf[_0x76ae('0x20')]=_0x5eafd2;if(_0x1e5c3f[_0x76ae('0x34')][_0x76ae('0x41')]){_0xa9b28d[_0x76ae('0x42')]=[{'all':!![]}];}return db[_0x76ae('0x2e')][_0x76ae('0x43')](_0xa9b28d);})[_0x76ae('0x26')](function(_0xb19cb3){_0x1aecdf['rows']=_0xb19cb3;return _0x1aecdf;})[_0x76ae('0x26')](respondWithFilteredResult(_0xb924aa,_0xa9b28d))[_0x76ae('0x44')](handleError(_0xb924aa,null));};exports[_0x76ae('0x45')]=function(_0x43f8d3,_0x5f2220){var _0x360ee8={'raw':!![],'where':{'id':_0x43f8d3[_0x76ae('0x46')]['id']}},_0x3dfef8={};_0x3dfef8['model']=_[_0x76ae('0x47')](db['OpenchannelApplication'][_0x76ae('0x2f')]);_0x3dfef8[_0x76ae('0x34')]=_[_0x76ae('0x47')](_0x43f8d3[_0x76ae('0x34')]);_0x3dfef8[_0x76ae('0x35')]=_[_0x76ae('0x37')](_0x3dfef8['model'],_0x3dfef8[_0x76ae('0x34')]);_0x360ee8[_0x76ae('0x36')]=_['intersection'](_0x3dfef8[_0x76ae('0x33')],qs[_0x76ae('0x38')](_0x43f8d3[_0x76ae('0x34')][_0x76ae('0x38')]));_0x360ee8['attributes']=_0x360ee8['attributes'][_0x76ae('0x39')]?_0x360ee8[_0x76ae('0x36')]:_0x3dfef8[_0x76ae('0x33')];if(_0x43f8d3['query'][_0x76ae('0x41')]){_0x360ee8[_0x76ae('0x42')]=[{'all':!![]}];}_0x360ee8=_[_0x76ae('0x3f')]({},_0x360ee8,_0x43f8d3['options']);return db['OpenchannelApplication'][_0x76ae('0x48')](_0x360ee8)[_0x76ae('0x26')](handleEntityNotFound(_0x5f2220,null))[_0x76ae('0x26')](respondWithResult(_0x5f2220,null))[_0x76ae('0x44')](handleError(_0x5f2220,null));};exports[_0x76ae('0x49')]=function(_0xeeffa8,_0x1294d0){return db[_0x76ae('0x2e')][_0x76ae('0x49')](_0xeeffa8[_0x76ae('0x4a')],{})[_0x76ae('0x26')](respondWithResult(_0x1294d0,0xc9))[_0x76ae('0x44')](handleError(_0x1294d0,null));};exports[_0x76ae('0x25')]=function(_0xbd728f,_0x389f06){if(_0xbd728f[_0x76ae('0x4a')]['id']){delete _0xbd728f[_0x76ae('0x4a')]['id'];}return db[_0x76ae('0x2e')][_0x76ae('0x48')]({'where':{'id':_0xbd728f[_0x76ae('0x46')]['id']}})[_0x76ae('0x26')](handleEntityNotFound(_0x389f06,null))[_0x76ae('0x26')](saveUpdates(_0xbd728f[_0x76ae('0x4a')],null))['then'](respondWithResult(_0x389f06,null))[_0x76ae('0x44')](handleError(_0x389f06,null));};exports['destroy']=function(_0x29bf6e,_0x1c191a){return db['OpenchannelApplication'][_0x76ae('0x48')]({'where':{'id':_0x29bf6e[_0x76ae('0x46')]['id']}})[_0x76ae('0x26')](handleEntityNotFound(_0x1c191a,null))[_0x76ae('0x26')](removeEntity(_0x1c191a,null))[_0x76ae('0x44')](handleError(_0x1c191a,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 8d81065..bce601c 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 _0xd1b2=['define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x191330,_0x4dac38){var _0x174131=function(_0x3426a8){while(--_0x3426a8){_0x191330['push'](_0x191330['shift']());}};_0x174131(++_0x4dac38);}(_0xd1b2,0x171));var _0x2d1b=function(_0x3326bb,_0x461bd9){_0x3326bb=_0x3326bb-0x0;var _0x5eb850=_0xd1b2[_0x3326bb];return _0x5eb850;};'use strict';var _=require(_0x2d1b('0x0'));var util=require(_0x2d1b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x2d1b('0x2'));var BPromise=require(_0x2d1b('0x3'));var rp=require(_0x2d1b('0x4'));var fs=require('fs');var path=require(_0x2d1b('0x5'));var rimraf=require(_0x2d1b('0x6'));var config=require(_0x2d1b('0x7'));var attributes=require('./openchannelApplication.attributes');module['exports']=function(_0x120112,_0x1e3762){return _0x120112[_0x2d1b('0x8')](_0x2d1b('0x9'),attributes,{'tableName':_0x2d1b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2d1b('0xb'),'collate':_0x2d1b('0xc')});}; \ No newline at end of file +var _0xe0eb=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define','openchannel_applications','utf8mb4','lodash','util','../../config/logger'];(function(_0x3c6ed6,_0x485148){var _0x3a97aa=function(_0x1c8bfa){while(--_0x1c8bfa){_0x3c6ed6['push'](_0x3c6ed6['shift']());}};_0x3a97aa(++_0x485148);}(_0xe0eb,0x1b0));var _0xbe0e=function(_0x1ab180,_0x382b2c){_0x1ab180=_0x1ab180-0x0;var _0xfb2c2d=_0xe0eb[_0x1ab180];return _0xfb2c2d;};'use strict';var _=require(_0xbe0e('0x0'));var util=require(_0xbe0e('0x1'));var logger=require(_0xbe0e('0x2'))(_0xbe0e('0x3'));var moment=require(_0xbe0e('0x4'));var BPromise=require(_0xbe0e('0x5'));var rp=require(_0xbe0e('0x6'));var fs=require('fs');var path=require(_0xbe0e('0x7'));var rimraf=require(_0xbe0e('0x8'));var config=require(_0xbe0e('0x9'));var attributes=require(_0xbe0e('0xa'));module[_0xbe0e('0xb')]=function(_0x129efd,_0x41182f){return _0x129efd[_0xbe0e('0xc')]('OpenchannelApplication',attributes,{'tableName':_0xbe0e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbe0e('0xe'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 6ee430b..3bb2b02 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 _0xa474=['request','then','info','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelApplication,\x20%s,\x20%s','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where','attributes','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x50e0ef,_0x226576){var _0x333457=function(_0x21f557){while(--_0x21f557){_0x50e0ef['push'](_0x50e0ef['shift']());}};_0x333457(++_0x226576);}(_0xa474,0x15f));var _0x4a47=function(_0x248ad0,_0x416197){_0x248ad0=_0x248ad0-0x0;var _0x190d11=_0xa474[_0x248ad0];return _0x190d11;};'use strict';var _=require(_0x4a47('0x0'));var util=require(_0x4a47('0x1'));var moment=require(_0x4a47('0x2'));var BPromise=require(_0x4a47('0x3'));var rs=require(_0x4a47('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4a47('0x5'))['db'];var utils=require(_0x4a47('0x6'));var logger=require(_0x4a47('0x7'))(_0x4a47('0x8'));var config=require('../../config/environment');var jayson=require(_0x4a47('0x9'));var client=jayson[_0x4a47('0xa')][_0x4a47('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x58f7bd,_0x5992f8,_0x2d75f9){return new BPromise(function(_0x15441f,_0xaf0c67){return client[_0x4a47('0xc')](_0x58f7bd,_0x2d75f9)[_0x4a47('0xd')](function(_0x11f3db){logger[_0x4a47('0xe')]('OpenchannelApplication,\x20%s,\x20%s',_0x5992f8,_0x4a47('0xf'));logger[_0x4a47('0x10')](_0x4a47('0x11'),_0x5992f8,_0x4a47('0xf'),JSON[_0x4a47('0x12')](_0x11f3db));if(_0x11f3db['error']){if(_0x11f3db[_0x4a47('0x13')]['code']===0x1f4){logger[_0x4a47('0x13')](_0x4a47('0x14'),_0x5992f8,_0x11f3db[_0x4a47('0x13')][_0x4a47('0x15')]);return _0xaf0c67(_0x11f3db[_0x4a47('0x13')][_0x4a47('0x15')]);}logger[_0x4a47('0x13')](_0x4a47('0x14'),_0x5992f8,_0x11f3db[_0x4a47('0x13')][_0x4a47('0x15')]);return _0x15441f(_0x11f3db[_0x4a47('0x13')]['message']);}else{logger[_0x4a47('0xe')]('OpenchannelApplication,\x20%s,\x20%s',_0x5992f8,_0x4a47('0xf'));_0x15441f(_0x11f3db[_0x4a47('0x16')][_0x4a47('0x15')]);}})[_0x4a47('0x17')](function(_0xddbfda){logger[_0x4a47('0x13')](_0x4a47('0x14'),_0x5992f8,_0xddbfda);_0xaf0c67(_0xddbfda);});});}exports[_0x4a47('0x18')]=function(_0x3cfa63){var _0x21ddc1=this;return new Promise(function(_0x648555,_0x5dea07){return db[_0x4a47('0x19')][_0x4a47('0x1a')](_0x3cfa63[_0x4a47('0x1b')],{'raw':_0x3cfa63['options']?_0x3cfa63[_0x4a47('0x1c')][_0x4a47('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3cfa63[_0x4a47('0x1c')]?_0x3cfa63[_0x4a47('0x1c')][_0x4a47('0x1e')]||null:null,'attributes':_0x3cfa63[_0x4a47('0x1c')]?_0x3cfa63[_0x4a47('0x1c')][_0x4a47('0x1f')]||null:null,'limit':_0x3cfa63['options']?_0x3cfa63[_0x4a47('0x1c')][_0x4a47('0x20')]||null:null})[_0x4a47('0xd')](function(_0x2a41d9){logger[_0x4a47('0xe')]('UpdateOpenchannelApplication',_0x3cfa63);logger['debug'](_0x4a47('0x18'),_0x3cfa63,JSON['stringify'](_0x2a41d9));_0x648555(_0x2a41d9);})['catch'](function(_0x595b71){logger[_0x4a47('0x13')](_0x4a47('0x18'),_0x595b71[_0x4a47('0x15')],_0x3cfa63);_0x5dea07(_0x21ddc1[_0x4a47('0x13')](0x1f4,_0x595b71[_0x4a47('0x15')]));});});}; \ No newline at end of file +var _0x78a8=['update','body','options','raw','where','attributes','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','then','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','UpdateOpenchannelApplication'];(function(_0x50365c,_0x3c0c8b){var _0x330f1e=function(_0x41ad0d){while(--_0x41ad0d){_0x50365c['push'](_0x50365c['shift']());}};_0x330f1e(++_0x3c0c8b);}(_0x78a8,0x1b7));var _0x878a=function(_0x4f123e,_0x10e145){_0x4f123e=_0x4f123e-0x0;var _0xdd2b90=_0x78a8[_0x4f123e];return _0xdd2b90;};'use strict';var _=require(_0x878a('0x0'));var util=require('util');var moment=require(_0x878a('0x1'));var BPromise=require(_0x878a('0x2'));var rs=require(_0x878a('0x3'));var fs=require('fs');var Redis=require(_0x878a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x878a('0x5'));var logger=require(_0x878a('0x6'))(_0x878a('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x878a('0x8')][_0x878a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5f3eb6,_0x1aa22c,_0x5a34f7){return new BPromise(function(_0x2ee23f,_0x718da){return client['request'](_0x5f3eb6,_0x5a34f7)[_0x878a('0xa')](function(_0x2aa2c3){logger['info'](_0x878a('0xb'),_0x1aa22c,_0x878a('0xc'));logger[_0x878a('0xd')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x1aa22c,_0x878a('0xc'),JSON[_0x878a('0xe')](_0x2aa2c3));if(_0x2aa2c3[_0x878a('0xf')]){if(_0x2aa2c3[_0x878a('0xf')][_0x878a('0x10')]===0x1f4){logger['error']('OpenchannelApplication,\x20%s,\x20%s',_0x1aa22c,_0x2aa2c3[_0x878a('0xf')][_0x878a('0x11')]);return _0x718da(_0x2aa2c3[_0x878a('0xf')][_0x878a('0x11')]);}logger[_0x878a('0xf')]('OpenchannelApplication,\x20%s,\x20%s',_0x1aa22c,_0x2aa2c3[_0x878a('0xf')][_0x878a('0x11')]);return _0x2ee23f(_0x2aa2c3['error'][_0x878a('0x11')]);}else{logger[_0x878a('0x12')](_0x878a('0xb'),_0x1aa22c,_0x878a('0xc'));_0x2ee23f(_0x2aa2c3['result']['message']);}})['catch'](function(_0x151626){logger[_0x878a('0xf')](_0x878a('0xb'),_0x1aa22c,_0x151626);_0x718da(_0x151626);});});}exports[_0x878a('0x13')]=function(_0x1856a7){var _0x511d01=this;return new Promise(function(_0x3b952c,_0xd6b073){return db['OpenchannelApplication'][_0x878a('0x14')](_0x1856a7[_0x878a('0x15')],{'raw':_0x1856a7['options']?_0x1856a7[_0x878a('0x16')][_0x878a('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1856a7[_0x878a('0x16')]?_0x1856a7[_0x878a('0x16')][_0x878a('0x18')]||null:null,'attributes':_0x1856a7[_0x878a('0x16')]?_0x1856a7['options'][_0x878a('0x19')]||null:null,'limit':_0x1856a7['options']?_0x1856a7[_0x878a('0x16')]['limit']||null:null})[_0x878a('0xa')](function(_0x1306d1){logger['info'](_0x878a('0x13'),_0x1856a7);logger[_0x878a('0xd')]('UpdateOpenchannelApplication',_0x1856a7,JSON[_0x878a('0xe')](_0x1306d1));_0x3b952c(_0x1306d1);})[_0x878a('0x1a')](function(_0x4a3be0){logger[_0x878a('0xf')](_0x878a('0x13'),_0x4a3be0['message'],_0x1856a7);_0xd6b073(_0x511d01[_0x878a('0xf')](0x1f4,_0x4a3be0[_0x878a('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 001be40..9bf92e0 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 _0xde37=['destroy','removeTags','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment','./openchannelInteraction.controller','isAuthenticated','index','get','/describe','describe','getMessages','/:id/download','download','post','/:id/messages','/:id/tags','tracked','addTags','put','/:id','openchannel','openchannelinteraction:update','update','delete','openchannelinteraction:destroy'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xde37,0x110));var _0x7de3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xde37[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x7de3('0x0'));var util=require(_0x7de3('0x1'));var path=require('path');var timeout=require(_0x7de3('0x2'));var express=require(_0x7de3('0x3'));var router=express[_0x7de3('0x4')]();var fs_extra=require(_0x7de3('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7de3('0x6'));var controller=require(_0x7de3('0x7'));router['get']('/',auth[_0x7de3('0x8')](),controller[_0x7de3('0x9')]);router[_0x7de3('0xa')](_0x7de3('0xb'),auth[_0x7de3('0x8')](),controller[_0x7de3('0xc')]);router[_0x7de3('0xa')]('/:id',auth[_0x7de3('0x8')](),controller['show']);router[_0x7de3('0xa')]('/:id/messages',auth[_0x7de3('0x8')](),controller[_0x7de3('0xd')]);router[_0x7de3('0xa')](_0x7de3('0xe'),auth[_0x7de3('0x8')](),controller[_0x7de3('0xf')]);router['post']('/',auth[_0x7de3('0x8')](),controller['create']);router[_0x7de3('0x10')](_0x7de3('0x11'),auth[_0x7de3('0x8')](),controller['addMessage']);router['post'](_0x7de3('0x12'),auth[_0x7de3('0x8')](),interaction[_0x7de3('0x13')]('openchannel','openchannelinteraction:addtags'),controller[_0x7de3('0x14')]);router[_0x7de3('0x15')](_0x7de3('0x16'),auth[_0x7de3('0x8')](),interaction[_0x7de3('0x13')](_0x7de3('0x17'),_0x7de3('0x18')),controller[_0x7de3('0x19')]);router[_0x7de3('0x1a')]('/:id',auth['isAuthenticated'](),interaction[_0x7de3('0x13')](_0x7de3('0x17'),_0x7de3('0x1b')),controller[_0x7de3('0x1c')]);router[_0x7de3('0x1a')](_0x7de3('0x12'),auth[_0x7de3('0x8')](),controller[_0x7de3('0x1d')]);module['exports']=router; \ No newline at end of file +var _0x4cd3=['addTags','put','openchannelinteraction:update','update','destroy','delete','removeTags','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','./openchannelInteraction.controller','isAuthenticated','/:id','show','/:id/messages','getMessages','get','/:id/download','create','post','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags'];(function(_0x5252b8,_0x56e845){var _0x14bb8e=function(_0x33eaa1){while(--_0x33eaa1){_0x5252b8['push'](_0x5252b8['shift']());}};_0x14bb8e(++_0x56e845);}(_0x4cd3,0x164));var _0x34cd=function(_0x2055a7,_0x415a4c){_0x2055a7=_0x2055a7-0x0;var _0x42a14d=_0x4cd3[_0x2055a7];return _0x42a14d;};'use strict';var multer=require(_0x34cd('0x0'));var util=require(_0x34cd('0x1'));var path=require(_0x34cd('0x2'));var timeout=require('connect-timeout');var express=require(_0x34cd('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x34cd('0x4'));var interaction=require(_0x34cd('0x5'));var config=require('../../config/environment');var controller=require(_0x34cd('0x6'));router['get']('/',auth[_0x34cd('0x7')](),controller['index']);router['get']('/describe',auth[_0x34cd('0x7')](),controller['describe']);router['get'](_0x34cd('0x8'),auth[_0x34cd('0x7')](),controller[_0x34cd('0x9')]);router['get'](_0x34cd('0xa'),auth[_0x34cd('0x7')](),controller[_0x34cd('0xb')]);router[_0x34cd('0xc')](_0x34cd('0xd'),auth[_0x34cd('0x7')](),controller['download']);router['post']('/',auth[_0x34cd('0x7')](),controller[_0x34cd('0xe')]);router[_0x34cd('0xf')]('/:id/messages',auth[_0x34cd('0x7')](),controller[_0x34cd('0x10')]);router[_0x34cd('0xf')](_0x34cd('0x11'),auth[_0x34cd('0x7')](),interaction[_0x34cd('0x12')](_0x34cd('0x13'),_0x34cd('0x14')),controller[_0x34cd('0x15')]);router[_0x34cd('0x16')]('/:id',auth[_0x34cd('0x7')](),interaction[_0x34cd('0x12')](_0x34cd('0x13'),_0x34cd('0x17')),controller[_0x34cd('0x18')]);router['delete'](_0x34cd('0x8'),auth[_0x34cd('0x7')](),interaction[_0x34cd('0x12')](_0x34cd('0x13'),'openchannelinteraction:destroy'),controller[_0x34cd('0x19')]);router[_0x34cd('0x1a')](_0x34cd('0x11'),auth[_0x34cd('0x7')](),controller[_0x34cd('0x1b')]);module[_0x34cd('0x1c')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 841f1c8..91a9b4d 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 _0x9e2a=['ENUM','out','BOOLEAN','sequelize','STRING','DATE'];(function(_0xab2afb,_0x546bfb){var _0x25262b=function(_0x3bd92d){while(--_0x3bd92d){_0xab2afb['push'](_0xab2afb['shift']());}};_0x25262b(++_0x546bfb);}(_0x9e2a,0xe1));var _0xa9e2=function(_0xea3e42,_0x2e43f9){_0xea3e42=_0xea3e42-0x0;var _0x394ae9=_0x9e2a[_0xea3e42];return _0x394ae9;};'use strict';var Sequelize=require(_0xa9e2('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xa9e2('0x1')]},'thirdDisposition':{'type':Sequelize[_0xa9e2('0x1')]},'note':{'type':Sequelize[_0xa9e2('0x1')]},'read1stAt':{'type':Sequelize[_0xa9e2('0x2')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xa9e2('0x3')]('in',_0xa9e2('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0xa9e2('0x3')]('in',_0xa9e2('0x4')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xa9e2('0x1')]},'autoreplyExecuted':{'type':Sequelize[_0xa9e2('0x5')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x6de9=['BOOLEAN','DATE','STRING','ENUM','out','INTEGER','sequelize','exports'];(function(_0x243673,_0x4e8204){var _0x104dc8=function(_0x2db77e){while(--_0x2db77e){_0x243673['push'](_0x243673['shift']());}};_0x104dc8(++_0x4e8204);}(_0x6de9,0xe6));var _0x96de=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x6de9[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0x96de('0x0'));module[_0x96de('0x1')]={'closed':{'type':Sequelize[_0x96de('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x96de('0x3')]},'disposition':{'type':Sequelize[_0x96de('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x96de('0x4')]},'note':{'type':Sequelize[_0x96de('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0x96de('0x4')]},'externalUrl':{'type':Sequelize[_0x96de('0x4')]},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x96de('0x5')]('in',_0x96de('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x96de('0x5')]('in',_0x96de('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0x96de('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x96de('0x7')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 861af0a..b8acc13 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 _0x0255=['type','key','getOptions','findAll','openchannel','catch','show','query','from','params','keys','filters','intersection','model','attributes','fields','include','merge','options','find','create','body','destroy','addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','pick','OpenchannelInteractionId','map','$gte','split','includeAll','addTags','setTags','spread','Tag','emit','removeTags','download','unix','toString','join','root','files','tmp','server','format','transcript-%d-%s.zip','User','fullname','push','CmContact','Contact','lastName','attachments','Attachment','Messages','createdAt','read','OpenchannelAccount','Account','Owner','get','mkdirSync','Openchannel','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','threadId','Public','filter','basename','createReadStream','pipe','createWriteStream','direction','out','System','firstName','renderFile','views','downloadInteraction.ejs','transcript-','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','zip-dir','moment','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','api','../../config/environment','../../mysqldb','redis','localhost','./openchannelInteraction.socket','register','end','json','offset','limit','undefined','count','status','set','Content-Range','update','then','sendStatus','error','stack','name','send','index','OpenchannelInteraction','rawAttributes'];(function(_0x39b6dd,_0xca8511){var _0x32ecce=function(_0x31b287){while(--_0x31b287){_0x39b6dd['push'](_0x39b6dd['shift']());}};_0x32ecce(++_0xca8511);}(_0x0255,0x15f));var _0x5025=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0255[_0x3dd15e];return _0x231fd0;};'use strict';var rimraf=require(_0x5025('0x0'));var zipdir=require(_0x5025('0x1'));var moment=require(_0x5025('0x2'));var util=require('util');var path=require(_0x5025('0x3'));var ejs=require(_0x5025('0x4'));var fs=require('fs');var _=require(_0x5025('0x5'));var Redis=require(_0x5025('0x6'));var interaction=require(_0x5025('0x7'));var qs=require(_0x5025('0x8'));var pdf=require(_0x5025('0x9'));var logger=require('../../config/logger')(_0x5025('0xa'));var config=require(_0x5025('0xb'));var db=require(_0x5025('0xc'))['db'];config[_0x5025('0xd')]=_['defaults'](config[_0x5025('0xd')],{'host':_0x5025('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5025('0xd')]));require(_0x5025('0xf'))[_0x5025('0x10')](socket);function respondWithStatusCode(_0x5c69e1,_0xe60622){_0xe60622=_0xe60622||0xcc;return function(_0x5b00e4){if(_0x5b00e4){return _0x5c69e1['sendStatus'](_0xe60622);}return _0x5c69e1['status'](_0xe60622)[_0x5025('0x11')]();};}function respondWithResult(_0x37c8ca,_0x539253){_0x539253=_0x539253||0xc8;return function(_0x1f4cf3){if(_0x1f4cf3){return _0x37c8ca['status'](_0x539253)[_0x5025('0x12')](_0x1f4cf3);}};}function respondWithFilteredResult(_0x482d91,_0x10e48a){return function(_0x30bcc5){if(_0x30bcc5){var _0x56106e=typeof _0x10e48a[_0x5025('0x13')]==='undefined'&&typeof _0x10e48a[_0x5025('0x14')]===_0x5025('0x15');var _0x57bbac=_0x30bcc5[_0x5025('0x16')];var _0x4205e2=_0x56106e?0x0:_0x10e48a[_0x5025('0x13')];var _0x1fcc33=_0x56106e?_0x30bcc5[_0x5025('0x16')]:_0x10e48a['offset']+_0x10e48a[_0x5025('0x14')];var _0x4b34b4;if(_0x1fcc33>=_0x57bbac){_0x1fcc33=_0x57bbac;_0x4b34b4=0xc8;}else{_0x4b34b4=0xce;}_0x482d91[_0x5025('0x17')](_0x4b34b4);return _0x482d91[_0x5025('0x18')](_0x5025('0x19'),_0x4205e2+'-'+_0x1fcc33+'/'+_0x57bbac)[_0x5025('0x12')](_0x30bcc5);}return null;};}function saveUpdates(_0x19de89){return function(_0x6c79ef){if(_0x6c79ef){return _0x6c79ef[_0x5025('0x1a')](_0x19de89)[_0x5025('0x1b')](function(_0xe837ad){return _0xe837ad;});}return null;};}function removeEntity(_0x27212d){return function(_0x16fda8){if(_0x16fda8){return _0x16fda8['destroy']()[_0x5025('0x1b')](function(){_0x27212d[_0x5025('0x17')](0xcc)[_0x5025('0x11')]();});}};}function handleEntityNotFound(_0x4e8a16){return function(_0x57db5b){if(!_0x57db5b){_0x4e8a16[_0x5025('0x1c')](0x194);}return _0x57db5b;};}function handleError(_0x21a6de,_0x2dad46){_0x2dad46=_0x2dad46||0x1f4;return function(_0x699987){logger[_0x5025('0x1d')](_0x699987[_0x5025('0x1e')]);if(_0x699987[_0x5025('0x1f')]){delete _0x699987['name'];}_0x21a6de[_0x5025('0x17')](_0x2dad46)[_0x5025('0x20')](_0x699987);};}exports[_0x5025('0x21')]=function(_0x5ae0a6,_0x26acc0){var _0x9365d3={};var _0x56b351=_['map'](db[_0x5025('0x22')][_0x5025('0x23')],function(_0x365acf){return{'name':_0x365acf['fieldName'],'type':_0x365acf[_0x5025('0x24')][_0x5025('0x25')]};});_0x9365d3=qs[_0x5025('0x26')](_0x56b351,_0x5ae0a6);return interaction[_0x5025('0x27')](_0x5025('0x28'),_0x5ae0a6['query'],_0x5ae0a6['user'],_0x9365d3,_0x56b351)['then'](respondWithFilteredResult(_0x26acc0,_0x9365d3))[_0x5025('0x29')](handleError(_0x26acc0,null));};exports[_0x5025('0x2a')]=function(_0x181839,_0x2b0d02){var _0x244756={};if(_0x181839[_0x5025('0x2b')][_0x5025('0x24')]&&_0x181839[_0x5025('0x2b')][_0x5025('0x24')]===_0x5025('0x2c')){_0x244756[_0x5025('0x2c')]=_0x181839[_0x5025('0x2d')]['id'];}else{_0x244756['id']=_0x181839[_0x5025('0x2d')]['id'];}var _0x3edb39={'raw':![],'where':_0x244756},_0x3e9e7e={};_0x3e9e7e['model']=_[_0x5025('0x2e')](db[_0x5025('0x22')]['rawAttributes']);_0x3e9e7e[_0x5025('0x2b')]=_[_0x5025('0x2e')](_0x181839[_0x5025('0x2b')]);_0x3e9e7e[_0x5025('0x2f')]=_[_0x5025('0x30')](_0x3e9e7e[_0x5025('0x31')],_0x3e9e7e[_0x5025('0x2b')]);_0x3edb39[_0x5025('0x32')]=_[_0x5025('0x30')](_0x3e9e7e[_0x5025('0x31')],qs['fields'](_0x181839[_0x5025('0x2b')][_0x5025('0x33')]));_0x3edb39['attributes']=_0x3edb39[_0x5025('0x32')]['length']?_0x3edb39['attributes']:_0x3e9e7e[_0x5025('0x31')];if(_0x181839['query']['includeAll']){_0x3edb39[_0x5025('0x34')]=[{'all':!![]}];}_0x3edb39=_[_0x5025('0x35')]({},_0x3edb39,_0x181839[_0x5025('0x36')]);return db[_0x5025('0x22')][_0x5025('0x37')](_0x3edb39)[_0x5025('0x1b')](handleEntityNotFound(_0x2b0d02,null))[_0x5025('0x1b')](respondWithResult(_0x2b0d02,null))[_0x5025('0x29')](handleError(_0x2b0d02,null));};exports[_0x5025('0x38')]=function(_0x5cec5c,_0x67f6bb){return db[_0x5025('0x22')][_0x5025('0x38')](_0x5cec5c[_0x5025('0x39')],{})[_0x5025('0x1b')](respondWithResult(_0x67f6bb,0xc9))[_0x5025('0x29')](handleError(_0x67f6bb,null));};exports[_0x5025('0x1a')]=function(_0x4d8364,_0xed11f3){if(_0x4d8364['body']['id']){delete _0x4d8364[_0x5025('0x39')]['id'];}return db[_0x5025('0x22')][_0x5025('0x37')]({'where':{'id':_0x4d8364['params']['id']}})[_0x5025('0x1b')](handleEntityNotFound(_0xed11f3,null))[_0x5025('0x1b')](saveUpdates(_0x4d8364['body'],null))[_0x5025('0x1b')](respondWithResult(_0xed11f3,null))[_0x5025('0x29')](handleError(_0xed11f3,null));};exports[_0x5025('0x3a')]=function(_0x468f27,_0x152db2){return db[_0x5025('0x22')][_0x5025('0x37')]({'where':{'id':_0x468f27[_0x5025('0x2d')]['id']}})['then'](handleEntityNotFound(_0x152db2,null))[_0x5025('0x1b')](removeEntity(_0x152db2,null))[_0x5025('0x29')](handleError(_0x152db2,null));};exports['describe']=function(_0x2d7631,_0x4b9ea9){return db['OpenchannelInteraction']['describe']()[_0x5025('0x1b')](respondWithResult(_0x4b9ea9,null))[_0x5025('0x29')](handleError(_0x4b9ea9,null));};exports[_0x5025('0x3b')]=function(_0x170692,_0x351528){return db[_0x5025('0x3c')][_0x5025('0x37')]({'where':{'id':_0x170692[_0x5025('0x2d')]['id']}})['then'](handleEntityNotFound(_0x351528,null))[_0x5025('0x1b')](function(_0x12763a){if(_0x12763a){return _0x12763a[_0x5025('0x3b')](_0x170692[_0x5025('0x39')][_0x5025('0x3d')],_[_0x5025('0x3e')](_0x170692[_0x5025('0x39')],['ids','id'])||{});}})[_0x5025('0x1b')](respondWithResult(_0x351528,null))[_0x5025('0x29')](handleError(_0x351528,null));};exports[_0x5025('0x3f')]=function(_0x210e77,_0x1511de){var _0x142ea2={'raw':![],'where':{}};var _0x548cb9={};var _0x3b4754={'count':0x0,'rows':[]};return db[_0x5025('0x22')][_0x5025('0x40')]({'where':{'id':_0x210e77['params']['id']}})['then'](handleEntityNotFound(_0x1511de,null))[_0x5025('0x1b')](function(_0x38d0df){if(_0x38d0df){_0x548cb9[_0x5025('0x31')]=_[_0x5025('0x2e')](db[_0x5025('0x3c')][_0x5025('0x23')]);_0x548cb9[_0x5025('0x2b')]=_[_0x5025('0x2e')](_0x210e77[_0x5025('0x2b')]);_0x548cb9[_0x5025('0x2f')]=_[_0x5025('0x30')](_0x548cb9['model'],_0x548cb9[_0x5025('0x2b')]);_0x142ea2[_0x5025('0x32')]=_[_0x5025('0x30')](_0x548cb9[_0x5025('0x31')],qs['fields'](_0x210e77[_0x5025('0x2b')][_0x5025('0x33')]));_0x142ea2[_0x5025('0x32')]=_0x142ea2['attributes']['length']?_0x142ea2[_0x5025('0x32')]:_0x548cb9['model'];if(!_0x210e77[_0x5025('0x2b')][_0x5025('0x41')](_0x5025('0x42'))){_0x142ea2['limit']=qs[_0x5025('0x14')](_0x210e77[_0x5025('0x2b')][_0x5025('0x14')]);_0x142ea2['offset']=qs[_0x5025('0x13')](_0x210e77['query'][_0x5025('0x13')]);}_0x142ea2[_0x5025('0x43')]=qs[_0x5025('0x44')](_0x210e77[_0x5025('0x2b')]['sort']);_0x142ea2[_0x5025('0x45')]=qs[_0x5025('0x2f')](_[_0x5025('0x46')](_0x210e77[_0x5025('0x2b')],_0x548cb9[_0x5025('0x2f')]));_0x142ea2['where'][_0x5025('0x47')]=_0x38d0df['id'];if(_0x210e77[_0x5025('0x2b')]['filter']){_0x142ea2[_0x5025('0x45')]=_[_0x5025('0x35')](_0x142ea2[_0x5025('0x45')],{'$or':_[_0x5025('0x48')](_0x142ea2[_0x5025('0x32')],function(_0x5be608){var _0x69eb45={};_0x69eb45[_0x5be608]={'$like':'%'+_0x210e77['query']['filter']+'%'};return _0x69eb45;})});}if(_0x210e77[_0x5025('0x2b')]['$gte']){var _0x1fc181=_0x210e77[_0x5025('0x2b')][_0x5025('0x49')][_0x5025('0x4a')](',');var _0x1db80b={};_0x1db80b[_0x1fc181[0x0]]={'$gte':moment(_0x1fc181[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x142ea2[_0x5025('0x45')]=_[_0x5025('0x35')](_0x142ea2['where'],_0x1db80b);}_0x142ea2=_[_0x5025('0x35')]({},_0x142ea2,_0x210e77[_0x5025('0x36')]);return db[_0x5025('0x3c')][_0x5025('0x16')]({'where':_0x142ea2['where']})['then'](function(_0xcfd367){_0x3b4754[_0x5025('0x16')]=_0xcfd367;if(_0x210e77[_0x5025('0x2b')][_0x5025('0x4b')]){_0x142ea2[_0x5025('0x34')]=[{'all':!![]}];}return db[_0x5025('0x3c')][_0x5025('0x27')](_0x142ea2);})[_0x5025('0x1b')](function(_0x1c9b3f){_0x3b4754['rows']=_0x1c9b3f;return _0x3b4754;});}})[_0x5025('0x1b')](respondWithFilteredResult(_0x1511de,_0x142ea2))[_0x5025('0x29')](handleError(_0x1511de,null));};exports[_0x5025('0x4c')]=function(_0x598648,_0x3da74c){return db[_0x5025('0x22')][_0x5025('0x37')]({'where':{'id':_0x598648[_0x5025('0x2d')]['id']}})[_0x5025('0x1b')](handleEntityNotFound(_0x3da74c,null))[_0x5025('0x1b')](function(_0x320b3b){if(_0x320b3b){return _0x320b3b[_0x5025('0x4d')](_0x598648[_0x5025('0x39')][_0x5025('0x3d')],_[_0x5025('0x3e')](_0x598648[_0x5025('0x39')],[_0x5025('0x3d'),'id'])||{})[_0x5025('0x4e')](function(){return db[_0x5025('0x4f')]['findAll']({'attributes':['id','name','color'],'where':{'id':_0x598648[_0x5025('0x39')]['ids']}});})[_0x5025('0x1b')](function(_0x3a6805){socket[_0x5025('0x50')]('openchannelInteractionTags:save',{'id':Number(_0x598648[_0x5025('0x2d')]['id']),'tags':_0x3a6805||[]});return{'id':Number(_0x598648[_0x5025('0x2d')]['id']),'tags':_0x3a6805||[]};});}})[_0x5025('0x1b')](respondWithResult(_0x3da74c,null))[_0x5025('0x29')](handleError(_0x3da74c,null));};exports[_0x5025('0x51')]=function(_0x23cdf5,_0x231dec){return db[_0x5025('0x22')][_0x5025('0x37')]({'where':{'id':_0x23cdf5[_0x5025('0x2d')]['id']}})[_0x5025('0x1b')](handleEntityNotFound(_0x231dec,null))['then'](function(_0x1614ff){if(_0x1614ff){return _0x1614ff['removeTags'](_0x23cdf5['query'][_0x5025('0x3d')]);}})['then'](respondWithStatusCode(_0x231dec,null))[_0x5025('0x29')](handleError(_0x231dec,null));};exports[_0x5025('0x52')]=function(_0x288d17,_0x1dc0f1){var _0x12fac7=moment()[_0x5025('0x53')]()[_0x5025('0x54')]();var _0x20b2e4=path[_0x5025('0x55')](config[_0x5025('0x56')],'server',_0x5025('0x57'),_0x5025('0x58'));var _0x5e9e10=path[_0x5025('0x55')](config[_0x5025('0x56')],_0x5025('0x59'),'files','attachments');var _0x4fffed=path['join'](_0x20b2e4,_0x12fac7);var _0x4e65f0=util[_0x5025('0x5a')](_0x5025('0x5b'),_0x288d17[_0x5025('0x2d')]['id'],_0x12fac7);var _0x4fbc7d=path['join'](_0x20b2e4,_0x4e65f0);var _0x1e31d6=[];_0x1e31d6['push']({'model':db['User'],'as':_0x5025('0x5c'),'attributes':['id',_0x5025('0x5d')],'raw':!![]});_0x1e31d6[_0x5025('0x5e')]({'model':db[_0x5025('0x5f')],'as':_0x5025('0x60'),'attributes':['id','firstName',_0x5025('0x61')],'raw':!![]});if(_0x288d17[_0x5025('0x2b')][_0x5025('0x62')]){_0x1e31d6[_0x5025('0x5e')]({'model':db['Attachment'],'as':_0x5025('0x63'),'raw':!![]});}var _0x4b5793=[{'model':db['OpenchannelMessage'],'as':_0x5025('0x64'),'attributes':['id','body',_0x5025('0x65'),'direction','secret',_0x5025('0x66')],'include':_0x1e31d6}];_0x4b5793[_0x5025('0x5e')]({'model':db[_0x5025('0x67')],'as':_0x5025('0x68'),'attributes':['id','name']});_0x4b5793['push']({'model':db[_0x5025('0x5c')],'as':_0x5025('0x69'),'attributes':['id',_0x5025('0x5d')]});return db[_0x5025('0x22')][_0x5025('0x37')]({'where':{'id':_0x288d17[_0x5025('0x2d')]['id']},'include':_0x4b5793})[_0x5025('0x1b')](handleEntityNotFound(_0x1dc0f1,null))['then'](function(_0x235e2a){if(_0x235e2a){var _0x54e4c7=_0x235e2a[_0x5025('0x6a')]({'plain':!![]});fs[_0x5025('0x6b')](_0x4fffed);var _0x9678c8={'channel':_0x5025('0x6c'),'account':_0x54e4c7[_0x5025('0x68')][_0x5025('0x1f')],'agent':_0x54e4c7[_0x5025('0x69')]?_0x54e4c7[_0x5025('0x69')][_0x5025('0x5d')]:'N.A.','createdAt':moment(_0x54e4c7[_0x5025('0x65')])[_0x5025('0x5a')](_0x5025('0x6d'))[_0x5025('0x54')](),'closedAt':_0x54e4c7[_0x5025('0x6e')]?moment(_0x54e4c7[_0x5025('0x6f')])[_0x5025('0x5a')](_0x5025('0x6d'))['toString']():'','disposition':_0x54e4c7['disposition'],'visibility':_0x54e4c7[_0x5025('0x70')]?_0x5025('0x71'):'Private','messages':_(_0x54e4c7[_0x5025('0x64')])[_0x5025('0x72')]({'secret':![]})[_0x5025('0x48')](function(_0x3b6998){if(_0x3b6998[_0x5025('0x63')]){var _0x3d17a6=path[_0x5025('0x55')](_0x5e9e10,_0x3b6998[_0x5025('0x63')][_0x5025('0x73')]);if(fs['existsSync'](_0x3d17a6)){fs[_0x5025('0x74')](_0x3d17a6)[_0x5025('0x75')](fs[_0x5025('0x76')](path['join'](_0x4fffed,_0x3b6998[_0x5025('0x63')][_0x5025('0x73')])));}}return{'date':moment(_0x3b6998[_0x5025('0x65')])[_0x5025('0x5a')](_0x5025('0x6d'))[_0x5025('0x54')](),'sender':_0x3b6998[_0x5025('0x77')]===_0x5025('0x78')?_0x3b6998[_0x5025('0x5c')]?_0x3b6998[_0x5025('0x5c')][_0x5025('0x5d')]:_0x5025('0x79'):_0x3b6998[_0x5025('0x60')][_0x5025('0x7a')]+(_0x3b6998[_0x5025('0x60')][_0x5025('0x61')]?'\x20'+_0x3b6998['Contact'][_0x5025('0x61')]:''),'body':_0x3b6998[_0x5025('0x63')]?_0x3b6998[_0x5025('0x63')][_0x5025('0x73')]:_0x3b6998['body'],'direction':_0x3b6998['direction']==='out'?'A':'C','secret':_0x3b6998['secret'],'read':_0x3b6998[_0x5025('0x66')],'attachment':_0x3b6998[_0x5025('0x63')]};})['value']()};return ejs[_0x5025('0x7b')](path[_0x5025('0x55')](config[_0x5025('0x56')],'server',_0x5025('0x7c'),_0x5025('0x7d')),{'interaction':_0x9678c8})['then'](function(_0x6a9886){var _0x101c37=path[_0x5025('0x55')](_0x4fffed,_0x5025('0x7e')+_0x54e4c7['id']+'-'+_0x12fac7+'.pdf');var _0x15ba8c={'path':_0x101c37,'channel':_0x5025('0x6c'),'interactionId':_0x54e4c7['id']};return pdf['createPdfFromHTML'](_0x6a9886,_0x15ba8c);})[_0x5025('0x1b')](function(){return new Promise(function(_0x6f1625,_0x5d53c5){zipdir(_0x4fffed,{'saveTo':_0x4fbc7d},function(_0x201978,_0x4b26e5){if(_0x201978)return _0x5d53c5(_0x201978);return _0x6f1625(_0x4b26e5);});})[_0x5025('0x1b')](function(){return new Promise(function(_0x5179f8,_0x4d3019){rimraf(_0x4fffed,function(_0x6eab39){if(_0x6eab39)_0x4d3019(_0x6eab39);return _0x5179f8();});});})[_0x5025('0x1b')](function(){return _0x1dc0f1[_0x5025('0x52')](_0x4fbc7d,_0x4e65f0,function(_0x6ab8fb){if(_0x6ab8fb){logger[_0x5025('0x1d')](_0x5025('0x7f'),_0x6ab8fb);}else{fs[_0x5025('0x80')](_0x4fbc7d);}});});});}else{return _0x1dc0f1['sendStatus'](0xc8);}})[_0x5025('0x29')](handleError(_0x1dc0f1,null));}; \ No newline at end of file +var _0x2ace=['Tag','emit','openchannelInteractionTags:save','removeTags','unix','join','root','server','files','attachments','User','fullname','push','CmContact','firstName','lastName','Attachment','Messages','createdAt','direction','secret','read','OpenchannelAccount','Owner','get','mkdirSync','Openchannel','Account','N.A.','toString','closed','disposition','Public','Private','basename','createReadStream','pipe','createWriteStream','out','Contact','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','download','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','zip-dir','util','path','ejs','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','getOptions','openchannel','query','user','show','params','keys','OpenchannelInteraction','filters','model','fields','attributes','length','includeAll','include','merge','options','find','catch','create','body','describe','addMessage','OpenchannelMessage','omit','ids','getMessages','intersection','hasOwnProperty','sort','where','pick','OpenchannelInteractionId','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags'];(function(_0x169330,_0x56df88){var _0x3c91f8=function(_0x360b24){while(--_0x360b24){_0x169330['push'](_0x169330['shift']());}};_0x3c91f8(++_0x56df88);}(_0x2ace,0xb3));var _0xe2ac=function(_0x1ffd67,_0x1c18ba){_0x1ffd67=_0x1ffd67-0x0;var _0xce170f=_0x2ace[_0x1ffd67];return _0xce170f;};'use strict';var rimraf=require(_0xe2ac('0x0'));var zipdir=require(_0xe2ac('0x1'));var moment=require('moment');var util=require(_0xe2ac('0x2'));var path=require(_0xe2ac('0x3'));var ejs=require(_0xe2ac('0x4'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xe2ac('0x5'));var interaction=require(_0xe2ac('0x6'));var qs=require('../../components/parsers/qs');var pdf=require(_0xe2ac('0x7'));var logger=require(_0xe2ac('0x8'))(_0xe2ac('0x9'));var config=require(_0xe2ac('0xa'));var db=require(_0xe2ac('0xb'))['db'];config[_0xe2ac('0xc')]=_[_0xe2ac('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xe2ac('0xe'))(new Redis(config[_0xe2ac('0xc')]));require(_0xe2ac('0xf'))[_0xe2ac('0x10')](socket);function respondWithStatusCode(_0x42739d,_0x3afa2b){_0x3afa2b=_0x3afa2b||0xcc;return function(_0x193805){if(_0x193805){return _0x42739d[_0xe2ac('0x11')](_0x3afa2b);}return _0x42739d[_0xe2ac('0x12')](_0x3afa2b)[_0xe2ac('0x13')]();};}function respondWithResult(_0x70af91,_0xdde4a1){_0xdde4a1=_0xdde4a1||0xc8;return function(_0x2fe5d3){if(_0x2fe5d3){return _0x70af91['status'](_0xdde4a1)[_0xe2ac('0x14')](_0x2fe5d3);}};}function respondWithFilteredResult(_0x283f72,_0x349a98){return function(_0x508ada){if(_0x508ada){var _0x484b43=typeof _0x349a98[_0xe2ac('0x15')]===_0xe2ac('0x16')&&typeof _0x349a98['limit']===_0xe2ac('0x16');var _0x92d4c3=_0x508ada[_0xe2ac('0x17')];var _0x420213=_0x484b43?0x0:_0x349a98[_0xe2ac('0x15')];var _0x449996=_0x484b43?_0x508ada[_0xe2ac('0x17')]:_0x349a98[_0xe2ac('0x15')]+_0x349a98[_0xe2ac('0x18')];var _0x3c26e7;if(_0x449996>=_0x92d4c3){_0x449996=_0x92d4c3;_0x3c26e7=0xc8;}else{_0x3c26e7=0xce;}_0x283f72[_0xe2ac('0x12')](_0x3c26e7);return _0x283f72[_0xe2ac('0x19')](_0xe2ac('0x1a'),_0x420213+'-'+_0x449996+'/'+_0x92d4c3)[_0xe2ac('0x14')](_0x508ada);}return null;};}function saveUpdates(_0x359322){return function(_0x1f57bd){if(_0x1f57bd){return _0x1f57bd[_0xe2ac('0x1b')](_0x359322)[_0xe2ac('0x1c')](function(_0x2d0a4f){return _0x2d0a4f;});}return null;};}function removeEntity(_0x1a23fd){return function(_0x113174){if(_0x113174){return _0x113174[_0xe2ac('0x1d')]()[_0xe2ac('0x1c')](function(){_0x1a23fd[_0xe2ac('0x12')](0xcc)[_0xe2ac('0x13')]();});}};}function handleEntityNotFound(_0x42617a){return function(_0xfe9e65){if(!_0xfe9e65){_0x42617a[_0xe2ac('0x11')](0x194);}return _0xfe9e65;};}function handleError(_0x7a1388,_0x57903c){_0x57903c=_0x57903c||0x1f4;return function(_0x4a1dd6){logger[_0xe2ac('0x1e')](_0x4a1dd6[_0xe2ac('0x1f')]);if(_0x4a1dd6[_0xe2ac('0x20')]){delete _0x4a1dd6['name'];}_0x7a1388['status'](_0x57903c)[_0xe2ac('0x21')](_0x4a1dd6);};}exports['index']=function(_0x57e234,_0x47f529){var _0x1690a1={};var _0x4c2756=_[_0xe2ac('0x22')](db['OpenchannelInteraction'][_0xe2ac('0x23')],function(_0x56b616){return{'name':_0x56b616[_0xe2ac('0x24')],'type':_0x56b616[_0xe2ac('0x25')][_0xe2ac('0x26')]};});_0x1690a1=qs[_0xe2ac('0x27')](_0x4c2756,_0x57e234);return interaction['findAll'](_0xe2ac('0x28'),_0x57e234[_0xe2ac('0x29')],_0x57e234[_0xe2ac('0x2a')],_0x1690a1,_0x4c2756)['then'](respondWithFilteredResult(_0x47f529,_0x1690a1))['catch'](handleError(_0x47f529,null));};exports[_0xe2ac('0x2b')]=function(_0x589405,_0x139a69){var _0x581924={};if(_0x589405[_0xe2ac('0x29')]['type']&&_0x589405[_0xe2ac('0x29')][_0xe2ac('0x25')]==='from'){_0x581924['from']=_0x589405[_0xe2ac('0x2c')]['id'];}else{_0x581924['id']=_0x589405['params']['id'];}var _0x3c0cdd={'raw':![],'where':_0x581924},_0x3d94f0={};_0x3d94f0['model']=_[_0xe2ac('0x2d')](db[_0xe2ac('0x2e')][_0xe2ac('0x23')]);_0x3d94f0[_0xe2ac('0x29')]=_[_0xe2ac('0x2d')](_0x589405[_0xe2ac('0x29')]);_0x3d94f0[_0xe2ac('0x2f')]=_['intersection'](_0x3d94f0['model'],_0x3d94f0[_0xe2ac('0x29')]);_0x3c0cdd['attributes']=_['intersection'](_0x3d94f0[_0xe2ac('0x30')],qs['fields'](_0x589405[_0xe2ac('0x29')][_0xe2ac('0x31')]));_0x3c0cdd[_0xe2ac('0x32')]=_0x3c0cdd[_0xe2ac('0x32')][_0xe2ac('0x33')]?_0x3c0cdd['attributes']:_0x3d94f0[_0xe2ac('0x30')];if(_0x589405[_0xe2ac('0x29')][_0xe2ac('0x34')]){_0x3c0cdd[_0xe2ac('0x35')]=[{'all':!![]}];}_0x3c0cdd=_[_0xe2ac('0x36')]({},_0x3c0cdd,_0x589405[_0xe2ac('0x37')]);return db[_0xe2ac('0x2e')][_0xe2ac('0x38')](_0x3c0cdd)[_0xe2ac('0x1c')](handleEntityNotFound(_0x139a69,null))['then'](respondWithResult(_0x139a69,null))[_0xe2ac('0x39')](handleError(_0x139a69,null));};exports[_0xe2ac('0x3a')]=function(_0x3ea171,_0x50e8d6){return db[_0xe2ac('0x2e')][_0xe2ac('0x3a')](_0x3ea171[_0xe2ac('0x3b')],{})[_0xe2ac('0x1c')](respondWithResult(_0x50e8d6,0xc9))[_0xe2ac('0x39')](handleError(_0x50e8d6,null));};exports[_0xe2ac('0x1b')]=function(_0x4750f4,_0x94e679){if(_0x4750f4[_0xe2ac('0x3b')]['id']){delete _0x4750f4[_0xe2ac('0x3b')]['id'];}return db[_0xe2ac('0x2e')]['find']({'where':{'id':_0x4750f4['params']['id']}})[_0xe2ac('0x1c')](handleEntityNotFound(_0x94e679,null))[_0xe2ac('0x1c')](saveUpdates(_0x4750f4[_0xe2ac('0x3b')],null))[_0xe2ac('0x1c')](respondWithResult(_0x94e679,null))[_0xe2ac('0x39')](handleError(_0x94e679,null));};exports[_0xe2ac('0x1d')]=function(_0x1c4370,_0x1f88e1){return db[_0xe2ac('0x2e')]['find']({'where':{'id':_0x1c4370[_0xe2ac('0x2c')]['id']}})[_0xe2ac('0x1c')](handleEntityNotFound(_0x1f88e1,null))[_0xe2ac('0x1c')](removeEntity(_0x1f88e1,null))[_0xe2ac('0x39')](handleError(_0x1f88e1,null));};exports['describe']=function(_0x42f6ed,_0x7575c){return db['OpenchannelInteraction'][_0xe2ac('0x3c')]()[_0xe2ac('0x1c')](respondWithResult(_0x7575c,null))[_0xe2ac('0x39')](handleError(_0x7575c,null));};exports[_0xe2ac('0x3d')]=function(_0x1ba65b,_0x11c5d8){return db[_0xe2ac('0x3e')][_0xe2ac('0x38')]({'where':{'id':_0x1ba65b[_0xe2ac('0x2c')]['id']}})[_0xe2ac('0x1c')](handleEntityNotFound(_0x11c5d8,null))[_0xe2ac('0x1c')](function(_0x2003f9){if(_0x2003f9){return _0x2003f9[_0xe2ac('0x3d')](_0x1ba65b[_0xe2ac('0x3b')]['ids'],_[_0xe2ac('0x3f')](_0x1ba65b['body'],[_0xe2ac('0x40'),'id'])||{});}})[_0xe2ac('0x1c')](respondWithResult(_0x11c5d8,null))[_0xe2ac('0x39')](handleError(_0x11c5d8,null));};exports[_0xe2ac('0x41')]=function(_0x533738,_0x5676d2){var _0x2ff505={'raw':![],'where':{}};var _0x39eab6={};var _0x233598={'count':0x0,'rows':[]};return db[_0xe2ac('0x2e')]['findOne']({'where':{'id':_0x533738['params']['id']}})[_0xe2ac('0x1c')](handleEntityNotFound(_0x5676d2,null))['then'](function(_0x208ad0){if(_0x208ad0){_0x39eab6['model']=_[_0xe2ac('0x2d')](db[_0xe2ac('0x3e')][_0xe2ac('0x23')]);_0x39eab6[_0xe2ac('0x29')]=_[_0xe2ac('0x2d')](_0x533738[_0xe2ac('0x29')]);_0x39eab6[_0xe2ac('0x2f')]=_[_0xe2ac('0x42')](_0x39eab6[_0xe2ac('0x30')],_0x39eab6['query']);_0x2ff505[_0xe2ac('0x32')]=_[_0xe2ac('0x42')](_0x39eab6[_0xe2ac('0x30')],qs['fields'](_0x533738[_0xe2ac('0x29')][_0xe2ac('0x31')]));_0x2ff505['attributes']=_0x2ff505[_0xe2ac('0x32')][_0xe2ac('0x33')]?_0x2ff505['attributes']:_0x39eab6[_0xe2ac('0x30')];if(!_0x533738['query'][_0xe2ac('0x43')]('nolimit')){_0x2ff505[_0xe2ac('0x18')]=qs['limit'](_0x533738[_0xe2ac('0x29')]['limit']);_0x2ff505[_0xe2ac('0x15')]=qs['offset'](_0x533738[_0xe2ac('0x29')]['offset']);}_0x2ff505['order']=qs[_0xe2ac('0x44')](_0x533738[_0xe2ac('0x29')][_0xe2ac('0x44')]);_0x2ff505[_0xe2ac('0x45')]=qs[_0xe2ac('0x2f')](_[_0xe2ac('0x46')](_0x533738[_0xe2ac('0x29')],_0x39eab6[_0xe2ac('0x2f')]));_0x2ff505[_0xe2ac('0x45')][_0xe2ac('0x47')]=_0x208ad0['id'];if(_0x533738['query']['filter']){_0x2ff505[_0xe2ac('0x45')]=_[_0xe2ac('0x36')](_0x2ff505[_0xe2ac('0x45')],{'$or':_['map'](_0x2ff505[_0xe2ac('0x32')],function(_0x204619){var _0x22bb47={};_0x22bb47[_0x204619]={'$like':'%'+_0x533738[_0xe2ac('0x29')][_0xe2ac('0x48')]+'%'};return _0x22bb47;})});}if(_0x533738[_0xe2ac('0x29')][_0xe2ac('0x49')]){var _0x284a04=_0x533738[_0xe2ac('0x29')][_0xe2ac('0x49')]['split'](',');var _0x3fee5e={};_0x3fee5e[_0x284a04[0x0]]={'$gte':moment(_0x284a04[0x1])[_0xe2ac('0x4a')](_0xe2ac('0x4b'))};_0x2ff505[_0xe2ac('0x45')]=_[_0xe2ac('0x36')](_0x2ff505[_0xe2ac('0x45')],_0x3fee5e);}_0x2ff505=_[_0xe2ac('0x36')]({},_0x2ff505,_0x533738['options']);return db['OpenchannelMessage'][_0xe2ac('0x17')]({'where':_0x2ff505[_0xe2ac('0x45')]})[_0xe2ac('0x1c')](function(_0x47108d){_0x233598[_0xe2ac('0x17')]=_0x47108d;if(_0x533738[_0xe2ac('0x29')]['includeAll']){_0x2ff505['include']=[{'all':!![]}];}return db[_0xe2ac('0x3e')][_0xe2ac('0x4c')](_0x2ff505);})['then'](function(_0x2370ee){_0x233598['rows']=_0x2370ee;return _0x233598;});}})[_0xe2ac('0x1c')](respondWithFilteredResult(_0x5676d2,_0x2ff505))[_0xe2ac('0x39')](handleError(_0x5676d2,null));};exports[_0xe2ac('0x4d')]=function(_0x35d1d2,_0x1a4b1d){return db[_0xe2ac('0x2e')][_0xe2ac('0x38')]({'where':{'id':_0x35d1d2[_0xe2ac('0x2c')]['id']}})[_0xe2ac('0x1c')](handleEntityNotFound(_0x1a4b1d,null))[_0xe2ac('0x1c')](function(_0x561f8d){if(_0x561f8d){return _0x561f8d[_0xe2ac('0x4e')](_0x35d1d2[_0xe2ac('0x3b')]['ids'],_[_0xe2ac('0x3f')](_0x35d1d2[_0xe2ac('0x3b')],[_0xe2ac('0x40'),'id'])||{})['spread'](function(){return db[_0xe2ac('0x4f')]['findAll']({'attributes':['id',_0xe2ac('0x20'),'color'],'where':{'id':_0x35d1d2[_0xe2ac('0x3b')][_0xe2ac('0x40')]}});})[_0xe2ac('0x1c')](function(_0x63086b){socket[_0xe2ac('0x50')](_0xe2ac('0x51'),{'id':Number(_0x35d1d2[_0xe2ac('0x2c')]['id']),'tags':_0x63086b||[]});return{'id':Number(_0x35d1d2[_0xe2ac('0x2c')]['id']),'tags':_0x63086b||[]};});}})[_0xe2ac('0x1c')](respondWithResult(_0x1a4b1d,null))[_0xe2ac('0x39')](handleError(_0x1a4b1d,null));};exports[_0xe2ac('0x52')]=function(_0x5f41e3,_0x31544b){return db[_0xe2ac('0x2e')][_0xe2ac('0x38')]({'where':{'id':_0x5f41e3[_0xe2ac('0x2c')]['id']}})[_0xe2ac('0x1c')](handleEntityNotFound(_0x31544b,null))[_0xe2ac('0x1c')](function(_0x4ab15f){if(_0x4ab15f){return _0x4ab15f[_0xe2ac('0x52')](_0x5f41e3[_0xe2ac('0x29')][_0xe2ac('0x40')]);}})['then'](respondWithStatusCode(_0x31544b,null))[_0xe2ac('0x39')](handleError(_0x31544b,null));};exports['download']=function(_0x973bf1,_0x6740ec){var _0x4c244f=moment()[_0xe2ac('0x53')]()['toString']();var _0x2d596a=path[_0xe2ac('0x54')](config[_0xe2ac('0x55')],_0xe2ac('0x56'),_0xe2ac('0x57'),'tmp');var _0x6e19d3=path[_0xe2ac('0x54')](config['root'],_0xe2ac('0x56'),'files',_0xe2ac('0x58'));var _0xf1684e=path[_0xe2ac('0x54')](_0x2d596a,_0x4c244f);var _0x415817=util[_0xe2ac('0x4a')]('transcript-%d-%s.zip',_0x973bf1[_0xe2ac('0x2c')]['id'],_0x4c244f);var _0x450928=path[_0xe2ac('0x54')](_0x2d596a,_0x415817);var _0x187022=[];_0x187022['push']({'model':db[_0xe2ac('0x59')],'as':_0xe2ac('0x59'),'attributes':['id',_0xe2ac('0x5a')],'raw':!![]});_0x187022[_0xe2ac('0x5b')]({'model':db[_0xe2ac('0x5c')],'as':'Contact','attributes':['id',_0xe2ac('0x5d'),_0xe2ac('0x5e')],'raw':!![]});if(_0x973bf1[_0xe2ac('0x29')][_0xe2ac('0x58')]){_0x187022[_0xe2ac('0x5b')]({'model':db[_0xe2ac('0x5f')],'as':_0xe2ac('0x5f'),'raw':!![]});}var _0x4c9ade=[{'model':db[_0xe2ac('0x3e')],'as':_0xe2ac('0x60'),'attributes':['id','body',_0xe2ac('0x61'),_0xe2ac('0x62'),_0xe2ac('0x63'),_0xe2ac('0x64')],'include':_0x187022}];_0x4c9ade[_0xe2ac('0x5b')]({'model':db[_0xe2ac('0x65')],'as':'Account','attributes':['id',_0xe2ac('0x20')]});_0x4c9ade[_0xe2ac('0x5b')]({'model':db[_0xe2ac('0x59')],'as':_0xe2ac('0x66'),'attributes':['id',_0xe2ac('0x5a')]});return db[_0xe2ac('0x2e')][_0xe2ac('0x38')]({'where':{'id':_0x973bf1[_0xe2ac('0x2c')]['id']},'include':_0x4c9ade})[_0xe2ac('0x1c')](handleEntityNotFound(_0x6740ec,null))['then'](function(_0x46449e){if(_0x46449e){var _0x5b22e1=_0x46449e[_0xe2ac('0x67')]({'plain':!![]});fs[_0xe2ac('0x68')](_0xf1684e);var _0x144c4f={'channel':_0xe2ac('0x69'),'account':_0x5b22e1[_0xe2ac('0x6a')][_0xe2ac('0x20')],'agent':_0x5b22e1[_0xe2ac('0x66')]?_0x5b22e1['Owner'][_0xe2ac('0x5a')]:_0xe2ac('0x6b'),'createdAt':moment(_0x5b22e1[_0xe2ac('0x61')])[_0xe2ac('0x4a')](_0xe2ac('0x4b'))[_0xe2ac('0x6c')](),'closedAt':_0x5b22e1[_0xe2ac('0x6d')]?moment(_0x5b22e1['closedAt'])[_0xe2ac('0x4a')](_0xe2ac('0x4b'))[_0xe2ac('0x6c')]():'','disposition':_0x5b22e1[_0xe2ac('0x6e')],'visibility':_0x5b22e1['threadId']?_0xe2ac('0x6f'):_0xe2ac('0x70'),'messages':_(_0x5b22e1[_0xe2ac('0x60')])['filter']({'secret':![]})[_0xe2ac('0x22')](function(_0x222838){if(_0x222838['Attachment']){var _0x2e4849=path[_0xe2ac('0x54')](_0x6e19d3,_0x222838['Attachment'][_0xe2ac('0x71')]);if(fs['existsSync'](_0x2e4849)){fs[_0xe2ac('0x72')](_0x2e4849)[_0xe2ac('0x73')](fs[_0xe2ac('0x74')](path[_0xe2ac('0x54')](_0xf1684e,_0x222838[_0xe2ac('0x5f')][_0xe2ac('0x71')])));}}return{'date':moment(_0x222838[_0xe2ac('0x61')])[_0xe2ac('0x4a')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x222838['direction']===_0xe2ac('0x75')?_0x222838['User']?_0x222838['User']['fullname']:'System':_0x222838[_0xe2ac('0x76')][_0xe2ac('0x5d')]+(_0x222838[_0xe2ac('0x76')][_0xe2ac('0x5e')]?'\x20'+_0x222838[_0xe2ac('0x76')][_0xe2ac('0x5e')]:''),'body':_0x222838['Attachment']?_0x222838[_0xe2ac('0x5f')][_0xe2ac('0x71')]:_0x222838[_0xe2ac('0x3b')],'direction':_0x222838['direction']===_0xe2ac('0x75')?'A':'C','secret':_0x222838[_0xe2ac('0x63')],'read':_0x222838[_0xe2ac('0x64')],'attachment':_0x222838['Attachment']};})[_0xe2ac('0x77')]()};return ejs[_0xe2ac('0x78')](path[_0xe2ac('0x54')](config['root'],_0xe2ac('0x56'),_0xe2ac('0x79'),_0xe2ac('0x7a')),{'interaction':_0x144c4f})['then'](function(_0x5ead80){var _0x1ac74a=path[_0xe2ac('0x54')](_0xf1684e,_0xe2ac('0x7b')+_0x5b22e1['id']+'-'+_0x4c244f+_0xe2ac('0x7c'));var _0x1288c9={'path':_0x1ac74a,'channel':_0xe2ac('0x69'),'interactionId':_0x5b22e1['id']};return pdf[_0xe2ac('0x7d')](_0x5ead80,_0x1288c9);})['then'](function(){return new Promise(function(_0x171e2c,_0x4ea669){zipdir(_0xf1684e,{'saveTo':_0x450928},function(_0x2e9ac1,_0x3c8a62){if(_0x2e9ac1)return _0x4ea669(_0x2e9ac1);return _0x171e2c(_0x3c8a62);});})[_0xe2ac('0x1c')](function(){return new Promise(function(_0x1071f5,_0x4f69fd){rimraf(_0xf1684e,function(_0x4ae4fe){if(_0x4ae4fe)_0x4f69fd(_0x4ae4fe);return _0x1071f5();});});})[_0xe2ac('0x1c')](function(){return _0x6740ec[_0xe2ac('0x7e')](_0x450928,_0x415817,function(_0x59cd9d){if(_0x59cd9d){logger['error'](_0xe2ac('0x7f'),_0x59cd9d);}else{fs[_0xe2ac('0x80')](_0x450928);}});});});}else{return _0x6740ec['sendStatus'](0xc8);}})[_0xe2ac('0x39')](handleError(_0x6740ec,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index bfeb12c..74f041a 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 _0xb5be=['catch','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove','getUsers','then','Users','findAll','setDataValue','unreadMessages','length','emit'];(function(_0x35fabd,_0x825452){var _0x61a8ee=function(_0x218f4c){while(--_0x218f4c){_0x35fabd['push'](_0x35fabd['shift']());}};_0x61a8ee(++_0x825452);}(_0xb5be,0x76));var _0xeb5b=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0xb5be[_0x4d613c];return _0x301fe3;};'use strict';var EventEmitter=require(_0xeb5b('0x0'));var OpenchannelInteraction=require(_0xeb5b('0x1'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0xeb5b('0x1'))['db'][_0xeb5b('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xeb5b('0x3')](0x0);var events={'afterCreate':_0xeb5b('0x4'),'afterUpdate':_0xeb5b('0x5'),'afterDestroy':_0xeb5b('0x6')};function emitEvent(_0x17a4dd){return function(_0x13bd80,_0x4c4346,_0x48b7b2){_0x13bd80[_0xeb5b('0x7')]({'attributes':['id'],'raw':!![]})[_0xeb5b('0x8')](function(_0x4380de){_0x13bd80['setDataValue'](_0xeb5b('0x9'),_0x4380de['map'](function(_0x46d1b6){return{'id':_0x46d1b6['id']};}));return OpenchannelMessage[_0xeb5b('0xa')]({'where':{'OpenchannelInteractionId':_0x13bd80['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x511bb5){_0x13bd80[_0xeb5b('0xb')](_0xeb5b('0xc'),_0x511bb5[_0xeb5b('0xd')]);OpenchannelInteractionEvents[_0xeb5b('0xe')](_0x17a4dd+':'+_0x13bd80['id'],_0x13bd80);OpenchannelInteractionEvents[_0xeb5b('0xe')](_0x17a4dd,_0x13bd80);_0x48b7b2(null);})[_0xeb5b('0xf')](_0x48b7b2(null));};}for(var e in events){if(events[_0xeb5b('0x10')](e)){var event=events[e];OpenchannelInteraction[_0xeb5b('0x11')](e,emitEvent(event));}}module[_0xeb5b('0x12')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0xb208=['exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','update','remove','setDataValue','map','findAll','then','unreadMessages','length','emit','hasOwnProperty'];(function(_0x402ba7,_0x34af6c){var _0x330c44=function(_0x1ab909){while(--_0x1ab909){_0x402ba7['push'](_0x402ba7['shift']());}};_0x330c44(++_0x34af6c);}(_0xb208,0x1c3));var _0x8b20=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb208[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0x8b20('0x0'));var OpenchannelInteraction=require(_0x8b20('0x1'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0x8b20('0x1'))['db'][_0x8b20('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x8b20('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8b20('0x4'),'afterDestroy':_0x8b20('0x5')};function emitEvent(_0x375262){return function(_0x462fa6,_0x4c96ab,_0xa7d2a){_0x462fa6['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x132a54){_0x462fa6[_0x8b20('0x6')]('Users',_0x132a54[_0x8b20('0x7')](function(_0x2b73d8){return{'id':_0x2b73d8['id']};}));return OpenchannelMessage[_0x8b20('0x8')]({'where':{'OpenchannelInteractionId':_0x462fa6['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8b20('0x9')](function(_0xe49f9c){_0x462fa6[_0x8b20('0x6')](_0x8b20('0xa'),_0xe49f9c[_0x8b20('0xb')]);OpenchannelInteractionEvents[_0x8b20('0xc')](_0x375262+':'+_0x462fa6['id'],_0x462fa6);OpenchannelInteractionEvents['emit'](_0x375262,_0x462fa6);_0xa7d2a(null);})['catch'](_0xa7d2a(null));};}for(var e in events){if(events[_0x8b20('0xd')](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0x8b20('0xe')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index dd384d6..949bfb2 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 _0xb666=['request-promise','rimraf','../../config/environment','./openchannelInteraction.attributes','OpenchannelInteraction','openchannel_interactions','changed','closed','format','lodash','util'];(function(_0x112694,_0x49b537){var _0x3508af=function(_0x22b2b7){while(--_0x22b2b7){_0x112694['push'](_0x112694['shift']());}};_0x3508af(++_0x49b537);}(_0xb666,0x77));var _0x6b66=function(_0x31a16a,_0x1d60e3){_0x31a16a=_0x31a16a-0x0;var _0x21c892=_0xb666[_0x31a16a];return _0x21c892;};'use strict';var _=require(_0x6b66('0x0'));var util=require(_0x6b66('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6b66('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6b66('0x3'));var config=require(_0x6b66('0x4'));var attributes=require(_0x6b66('0x5'));module['exports']=function(_0x350d08,_0x5b28cf){return _0x350d08['define'](_0x6b66('0x6'),attributes,{'tableName':_0x6b66('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci','hooks':{'beforeUpdate':function(_0x26e3d3,_0x144fc4,_0x21dee8){if(_0x26e3d3[_0x6b66('0x8')](_0x6b66('0x9'))){_0x26e3d3['closedAt']=moment()[_0x6b66('0xa')]('YYYY-MM-DD\x20HH:mm:ss');}_0x21dee8(null,_0x26e3d3);}}});}; \ No newline at end of file +var _0x5d99=['../../config/environment','define','utf8mb4','utf8mb4_unicode_ci','changed','closedAt','format','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0xf0ec6e,_0xa183d3){var _0x8bbc27=function(_0x39822b){while(--_0x39822b){_0xf0ec6e['push'](_0xf0ec6e['shift']());}};_0x8bbc27(++_0xa183d3);}(_0x5d99,0x1b7));var _0x95d9=function(_0x5959c9,_0x2ed153){_0x5959c9=_0x5959c9-0x0;var _0x4ffcbc=_0x5d99[_0x5959c9];return _0x4ffcbc;};'use strict';var _=require(_0x95d9('0x0'));var util=require(_0x95d9('0x1'));var logger=require(_0x95d9('0x2'))(_0x95d9('0x3'));var moment=require(_0x95d9('0x4'));var BPromise=require(_0x95d9('0x5'));var rp=require(_0x95d9('0x6'));var fs=require('fs');var path=require(_0x95d9('0x7'));var rimraf=require(_0x95d9('0x8'));var config=require(_0x95d9('0x9'));var attributes=require('./openchannelInteraction.attributes');module['exports']=function(_0x27d75e,_0x3a2582){return _0x27d75e[_0x95d9('0xa')]('OpenchannelInteraction',attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x95d9('0xb'),'collate':_0x95d9('0xc'),'hooks':{'beforeUpdate':function(_0x59a4e0,_0x27c9d3,_0x467f87){if(_0x59a4e0[_0x95d9('0xd')]('closed')){_0x59a4e0[_0x95d9('0xe')]=moment()[_0x95d9('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x467f87(null,_0x59a4e0);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 1752f8c..be26a28 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 _0x99a8=['info','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','raw','options','attributes','limit','stringify','AddTagsToOpenchannelInteraction','find','where','addTags','omit','ids','spread','AddTags','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','then','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error','code','OpenchannelInteraction,\x20%s,\x20%s','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x99a8,0x92));var _0x899a=function(_0x58c4db,_0x3fcd24){_0x58c4db=_0x58c4db-0x0;var _0x2770f5=_0x99a8[_0x58c4db];return _0x2770f5;};'use strict';var _=require('lodash');var util=require(_0x899a('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x899a('0x1'));var fs=require('fs');var Redis=require(_0x899a('0x2'));var db=require(_0x899a('0x3'))['db'];var utils=require(_0x899a('0x4'));var logger=require(_0x899a('0x5'))(_0x899a('0x6'));var config=require(_0x899a('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x899a('0x8')]({'port':0x232a});config[_0x899a('0x9')]=_['defaults'](config[_0x899a('0x9')],{'host':_0x899a('0xa'),'port':0x18eb});var socket=require(_0x899a('0xb'))(new Redis(config['redis']));require(_0x899a('0xc'))[_0x899a('0xd')](socket);function respondWithRpcPromise(_0x5916f4,_0x226bdf,_0x12db5a){return new BPromise(function(_0x54c8e0,_0x5d89f7){return client['request'](_0x5916f4,_0x12db5a)[_0x899a('0xe')](function(_0x2e6e57){logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0x226bdf,_0x899a('0xf'));logger[_0x899a('0x10')](_0x899a('0x11'),_0x226bdf,'request\x20sent',JSON['stringify'](_0x2e6e57));if(_0x2e6e57[_0x899a('0x12')]){if(_0x2e6e57[_0x899a('0x12')][_0x899a('0x13')]===0x1f4){logger['error'](_0x899a('0x14'),_0x226bdf,_0x2e6e57[_0x899a('0x12')]['message']);return _0x5d89f7(_0x2e6e57['error'][_0x899a('0x15')]);}logger['error'](_0x899a('0x14'),_0x226bdf,_0x2e6e57[_0x899a('0x12')]['message']);return _0x54c8e0(_0x2e6e57['error'][_0x899a('0x15')]);}else{logger[_0x899a('0x16')]('OpenchannelInteraction,\x20%s,\x20%s',_0x226bdf,_0x899a('0xf'));_0x54c8e0(_0x2e6e57[_0x899a('0x17')][_0x899a('0x15')]);}})[_0x899a('0x18')](function(_0xcdc36d){logger['error'](_0x899a('0x14'),_0x226bdf,_0xcdc36d);_0x5d89f7(_0xcdc36d);});});}exports[_0x899a('0x19')]=function(_0x33469d){var _0x4422c5=this;return new Promise(function(_0x3a2e6f,_0x1ebd3e){return db[_0x899a('0x1a')][_0x899a('0x1b')](_0x33469d[_0x899a('0x1c')],{'raw':_0x33469d['options']?_0x33469d['options'][_0x899a('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x33469d[_0x899a('0x1e')]?_0x33469d[_0x899a('0x1e')]['where']||null:null,'attributes':_0x33469d[_0x899a('0x1e')]?_0x33469d[_0x899a('0x1e')][_0x899a('0x1f')]||null:null,'limit':_0x33469d[_0x899a('0x1e')]?_0x33469d[_0x899a('0x1e')][_0x899a('0x20')]||null:null})[_0x899a('0xe')](function(_0x478d33){logger[_0x899a('0x16')](_0x899a('0x19'),_0x33469d);logger[_0x899a('0x10')](_0x899a('0x19'),_0x33469d,JSON[_0x899a('0x21')](_0x478d33));_0x3a2e6f(_0x478d33);})['catch'](function(_0x29e0e5){logger['error'](_0x899a('0x19'),_0x29e0e5[_0x899a('0x15')],_0x33469d);_0x1ebd3e(_0x4422c5['error'](0x1f4,_0x29e0e5[_0x899a('0x15')]));});});};exports[_0x899a('0x22')]=function(_0x25ecda){return new Promise(function(_0x2aa461,_0x23abc4){return db['OpenchannelInteraction'][_0x899a('0x23')]({'where':_0x25ecda['options']?_0x25ecda[_0x899a('0x1e')][_0x899a('0x24')]||null:null})[_0x899a('0xe')](function(_0x146243){if(_0x146243){return _0x146243[_0x899a('0x25')](_0x25ecda[_0x899a('0x1c')]['ids'],_[_0x899a('0x26')](_0x25ecda[_0x899a('0x1c')],[_0x899a('0x27'),'id'])||{});}})[_0x899a('0x28')](function(_0x40dd91){logger['info'](_0x899a('0x29'),_0x25ecda);logger[_0x899a('0x10')](_0x899a('0x29'),_0x25ecda,JSON[_0x899a('0x21')](_0x40dd91));_0x2aa461(_0x40dd91);})[_0x899a('0x18')](function(_0x4f29b3){logger['error'](_0x899a('0x29'),_0x4f29b3[_0x899a('0x15')],_0x25ecda);_0x23abc4(_this[_0x899a('0x12')](0x1f4,_0x4f29b3[_0x899a('0x15')]));});});}; \ No newline at end of file +var _0x44ff=['where','attributes','limit','UpdateOpenchannelInteraction','find','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','OpenchannelInteraction,\x20%s,\x20%s','result','catch','OpenchannelInteraction','body','options','raw'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x44ff,0xad));var _0xf44f=function(_0x339e37,_0x13eb45){_0x339e37=_0x339e37-0x0;var _0xce94dd=_0x44ff[_0x339e37];return _0xce94dd;};'use strict';var _=require(_0xf44f('0x0'));var util=require(_0xf44f('0x1'));var moment=require(_0xf44f('0x2'));var BPromise=require(_0xf44f('0x3'));var rs=require(_0xf44f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf44f('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf44f('0x6'));var config=require('../../config/environment');var jayson=require(_0xf44f('0x7'));var client=jayson[_0xf44f('0x8')][_0xf44f('0x9')]({'port':0x232a});config['redis']=_[_0xf44f('0xa')](config[_0xf44f('0xb')],{'host':_0xf44f('0xc'),'port':0x18eb});var socket=require(_0xf44f('0xd'))(new Redis(config[_0xf44f('0xb')]));require(_0xf44f('0xe'))[_0xf44f('0xf')](socket);function respondWithRpcPromise(_0x168c66,_0x3a987f,_0x17041a){return new BPromise(function(_0x4279d7,_0x44081c){return client[_0xf44f('0x10')](_0x168c66,_0x17041a)[_0xf44f('0x11')](function(_0x2aacd5){logger[_0xf44f('0x12')]('OpenchannelInteraction,\x20%s,\x20%s',_0x3a987f,_0xf44f('0x13'));logger[_0xf44f('0x14')](_0xf44f('0x15'),_0x3a987f,_0xf44f('0x13'),JSON[_0xf44f('0x16')](_0x2aacd5));if(_0x2aacd5[_0xf44f('0x17')]){if(_0x2aacd5['error']['code']===0x1f4){logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x3a987f,_0x2aacd5[_0xf44f('0x17')][_0xf44f('0x18')]);return _0x44081c(_0x2aacd5[_0xf44f('0x17')][_0xf44f('0x18')]);}logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x3a987f,_0x2aacd5[_0xf44f('0x17')][_0xf44f('0x18')]);return _0x4279d7(_0x2aacd5[_0xf44f('0x17')][_0xf44f('0x18')]);}else{logger['info'](_0xf44f('0x19'),_0x3a987f,_0xf44f('0x13'));_0x4279d7(_0x2aacd5[_0xf44f('0x1a')]['message']);}})[_0xf44f('0x1b')](function(_0x595bf6){logger[_0xf44f('0x17')](_0xf44f('0x19'),_0x3a987f,_0x595bf6);_0x44081c(_0x595bf6);});});}exports['UpdateOpenchannelInteraction']=function(_0x1eec2c){var _0x4f7f6a=this;return new Promise(function(_0x5c26df,_0x2e9488){return db[_0xf44f('0x1c')]['update'](_0x1eec2c[_0xf44f('0x1d')],{'raw':_0x1eec2c['options']?_0x1eec2c[_0xf44f('0x1e')][_0xf44f('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1eec2c['options']?_0x1eec2c[_0xf44f('0x1e')][_0xf44f('0x20')]||null:null,'attributes':_0x1eec2c[_0xf44f('0x1e')]?_0x1eec2c['options'][_0xf44f('0x21')]||null:null,'limit':_0x1eec2c[_0xf44f('0x1e')]?_0x1eec2c[_0xf44f('0x1e')][_0xf44f('0x22')]||null:null})[_0xf44f('0x11')](function(_0x1e543b){logger[_0xf44f('0x12')](_0xf44f('0x23'),_0x1eec2c);logger[_0xf44f('0x14')](_0xf44f('0x23'),_0x1eec2c,JSON[_0xf44f('0x16')](_0x1e543b));_0x5c26df(_0x1e543b);})[_0xf44f('0x1b')](function(_0x120067){logger[_0xf44f('0x17')](_0xf44f('0x23'),_0x120067[_0xf44f('0x18')],_0x1eec2c);_0x2e9488(_0x4f7f6a[_0xf44f('0x17')](0x1f4,_0x120067[_0xf44f('0x18')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x258ce8){return new Promise(function(_0x566186,_0x3486b1){return db[_0xf44f('0x1c')][_0xf44f('0x24')]({'where':_0x258ce8[_0xf44f('0x1e')]?_0x258ce8[_0xf44f('0x1e')][_0xf44f('0x20')]||null:null})[_0xf44f('0x11')](function(_0xe014d){if(_0xe014d){return _0xe014d['addTags'](_0x258ce8[_0xf44f('0x1d')][_0xf44f('0x25')],_[_0xf44f('0x26')](_0x258ce8[_0xf44f('0x1d')],[_0xf44f('0x25'),'id'])||{});}})[_0xf44f('0x27')](function(_0x3d33b3){logger[_0xf44f('0x12')](_0xf44f('0x28'),_0x258ce8);logger[_0xf44f('0x14')]('AddTags',_0x258ce8,JSON[_0xf44f('0x16')](_0x3d33b3));_0x566186(_0x3d33b3);})[_0xf44f('0x1b')](function(_0x2f874a){logger[_0xf44f('0x17')](_0xf44f('0x28'),_0x2f874a[_0xf44f('0x18')],_0x258ce8);_0x3486b1(_this[_0xf44f('0x17')](0x1f4,_0x2f874a[_0xf44f('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 021f416..f09bc2f 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 _0xa98e=['save','remove','update','emit','removeListener'];(function(_0x1161da,_0xfaf583){var _0x5bcc5e=function(_0x18f31c){while(--_0x18f31c){_0x1161da['push'](_0x1161da['shift']());}};_0x5bcc5e(++_0xfaf583);}(_0xa98e,0xf5));var _0xea98=function(_0x322f01,_0x28aebf){_0x322f01=_0x322f01-0x0;var _0x2e503e=_0xa98e[_0x322f01];return _0x2e503e;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0xea98('0x0'),_0xea98('0x1'),_0xea98('0x2')];function createListener(_0x516f66,_0x4b7811){return function(_0x5760f1){_0x4b7811[_0xea98('0x3')](_0x516f66,_0x5760f1);};}function removeListener(_0x51e2a8,_0x6d0c14){return function(){OpenchannelInteractionEvents[_0xea98('0x4')](_0x51e2a8,_0x6d0c14);};}exports['register']=function(_0x1f2373){for(var _0xdc7330=0x0,_0x4d5a90=events['length'];_0xdc7330<_0x4d5a90;_0xdc7330++){var _0x122247=events[_0xdc7330];var _0x39f06c=createListener('openchannelInteraction:'+_0x122247,_0x1f2373);OpenchannelInteractionEvents['on'](_0x122247,_0x39f06c);}}; \ No newline at end of file +var _0x474f=['save','remove','update','emit','removeListener','register','length','openchannelInteraction:','./openchannelInteraction.events'];(function(_0x191dff,_0xb60d16){var _0x410a43=function(_0x25ccdc){while(--_0x25ccdc){_0x191dff['push'](_0x191dff['shift']());}};_0x410a43(++_0xb60d16);}(_0x474f,0x167));var _0xf474=function(_0x3e1b91,_0x5e5b26){_0x3e1b91=_0x3e1b91-0x0;var _0x144259=_0x474f[_0x3e1b91];return _0x144259;};'use strict';var OpenchannelInteractionEvents=require(_0xf474('0x0'));var events=[_0xf474('0x1'),_0xf474('0x2'),_0xf474('0x3')];function createListener(_0x178689,_0x51d0c8){return function(_0x5a4713){_0x51d0c8[_0xf474('0x4')](_0x178689,_0x5a4713);};}function removeListener(_0x51d1c4,_0x594003){return function(){OpenchannelInteractionEvents[_0xf474('0x5')](_0x51d1c4,_0x594003);};}exports[_0xf474('0x6')]=function(_0x5524b0){for(var _0x20d33b=0x0,_0x463430=events[_0xf474('0x7')];_0x20d33b<_0x463430;_0x20d33b++){var _0x1bf421=events[_0x20d33b];var _0x2d67f3=createListener(_0xf474('0x8')+_0x1bf421,_0x5524b0);OpenchannelInteractionEvents['on'](_0x1bf421,_0x2d67f3);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 569c8c3..427ddae 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 _0x70e0=['put','update','/:id/accept','accept','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','isAuthenticated','describe','get','/:id','show','post','openchannel','openchannelmessage:create','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x70e0,0x17b));var _0x070e=function(_0x19cee2,_0x3238e2){_0x19cee2=_0x19cee2-0x0;var _0x2a70ee=_0x70e0[_0x19cee2];return _0x2a70ee;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');var controller=require(_0x070e('0x7'));router['get']('/',auth[_0x070e('0x8')](),controller['index']);router['get']('/describe',auth[_0x070e('0x8')](),controller[_0x070e('0x9')]);router[_0x070e('0xa')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0xc')]);router[_0x070e('0xd')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x070e('0xe'),_0x070e('0xf')),controller[_0x070e('0x10')]);router[_0x070e('0x11')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0x12')]);router[_0x070e('0x11')](_0x070e('0x13'),auth[_0x070e('0x8')](),controller[_0x070e('0x14')]);router['put']('/:id/reject',auth[_0x070e('0x8')](),controller['reject']);router['delete']('/:id',auth[_0x070e('0x8')](),controller[_0x070e('0x15')]);module['exports']=router; \ No newline at end of file +var _0xe706=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','create','update','put','/:id/accept','accept','/:id/reject','exports','multer','util','path','express','Router'];(function(_0x382f4f,_0x38a4a3){var _0x35c689=function(_0x5c1abf){while(--_0x5c1abf){_0x382f4f['push'](_0x382f4f['shift']());}};_0x35c689(++_0x38a4a3);}(_0xe706,0xa3));var _0x6e70=function(_0xda6d0f,_0x35e271){_0xda6d0f=_0xda6d0f-0x0;var _0x244540=_0xe706[_0xda6d0f];return _0x244540;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),interaction[_0x6e70('0x12')](_0x6e70('0x13'),_0x6e70('0x14')),controller[_0x6e70('0x15')]);router['put']('/:id',auth[_0x6e70('0xb')](),controller[_0x6e70('0x16')]);router[_0x6e70('0x17')](_0x6e70('0x18'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x19')]);router[_0x6e70('0x17')](_0x6e70('0x1a'),auth['isAuthenticated'](),controller['reject']);router['delete'](_0x6e70('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x6e70('0x1b')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index c00eb26..7685dee 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 _0x0447=['ENUM','out','DATE','STRING','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x272202,_0x569e70){var _0xcad2a7=function(_0x3b39b2){while(--_0x3b39b2){_0x272202['push'](_0x272202['shift']());}};_0xcad2a7(++_0x569e70);}(_0x0447,0x8b));var _0x7044=function(_0x10a546,_0x5ea132){_0x10a546=_0x10a546-0x0;var _0x30e897=_0x0447[_0x10a546];return _0x30e897;};'use strict';var Sequelize=require(_0x7044('0x0'));module[_0x7044('0x1')]={'body':{'type':Sequelize[_0x7044('0x2')](_0x7044('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x7044('0x4')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x7044('0x5')]('in',_0x7044('0x6')),'defaultValue':_0x7044('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0x7044('0x7')]},'providerName':{'type':Sequelize[_0x7044('0x8')]},'providerResponse':{'type':Sequelize[_0x7044('0x2')]}}; \ No newline at end of file +var _0xc06d=['BOOLEAN','ENUM','DATE','sequelize','exports','TEXT','medium'];(function(_0x178f52,_0x5d9675){var _0x556f99=function(_0x4a7b17){while(--_0x4a7b17){_0x178f52['push'](_0x178f52['shift']());}};_0x556f99(++_0x5d9675);}(_0xc06d,0x15a));var _0xdc06=function(_0xd66a9a,_0x1eacb3){_0xd66a9a=_0xd66a9a-0x0;var _0x2f033f=_0xc06d[_0xd66a9a];return _0x2f033f;};'use strict';var Sequelize=require(_0xdc06('0x0'));module[_0xdc06('0x1')]={'body':{'type':Sequelize[_0xdc06('0x2')](_0xdc06('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xdc06('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xdc06('0x5')]('in','out'),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0xdc06('0x6')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xdc06('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index ec4329c..2aae38b 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 _0x8f74=['EventManager','rejectmessage','util','lodash','ioredis','../../components/parsers/qs','../../config/environment','redis','defaults','socket.io-emitter','register','jayson/promise','client','http','../../config/logger','openchannel-interactions','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','status','json','offset','limit','undefined','count','set','Content-Range','destroy','end','sendStatus','stack','name','index','map','OpenchannelMessage','fieldName','type','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','update','body','accept','openchannel','UserId','user','agent','OpenchannelInteractionId','interaction','get','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','contact','User','email','internal','interface','format','SIP/%s','channel','motionChannel','event'];(function(_0x40ad17,_0xe922b4){var _0x3b03ed=function(_0x39f13a){while(--_0x39f13a){_0x40ad17['push'](_0x40ad17['shift']());}};_0x3b03ed(++_0xe922b4);}(_0x8f74,0x196));var _0x48f7=function(_0x1e6db1,_0xb90700){_0x1e6db1=_0x1e6db1-0x0;var _0x55e924=_0x8f74[_0x1e6db1];return _0x55e924;};'use strict';var util=require(_0x48f7('0x0'));var _=require(_0x48f7('0x1'));var Redis=require(_0x48f7('0x2'));var interactionService=require('../../components/interaction/service');var qs=require(_0x48f7('0x3'));var logger=require('../../config/logger')('api');var config=require(_0x48f7('0x4'));var db=require('../../mysqldb')['db'];config[_0x48f7('0x5')]=_[_0x48f7('0x6')](config[_0x48f7('0x5')],{'host':'localhost','port':0x18eb});var socket=require(_0x48f7('0x7'))(new Redis(config[_0x48f7('0x5')]));require('./openchannelMessage.socket')[_0x48f7('0x8')](socket);var jayson=require(_0x48f7('0x9'));var client=jayson[_0x48f7('0xa')][_0x48f7('0xb')]({'port':0x232c});var client9002=jayson[_0x48f7('0xa')][_0x48f7('0xb')]({'port':0x232a});var interaction_log=require(_0x48f7('0xc'))(_0x48f7('0xd'));function respondWithRpcPromise(_0xc44576,_0x1489a8,_0x5b5891,_0x41e8ea){return new Promise(function(_0x507b1a,_0x39399a){var _0x3bb040=_0x41e8ea||client;return _0x3bb040['request'](_0xc44576,_0x5b5891)[_0x48f7('0xe')](function(_0x205ac3){logger['info'](_0x48f7('0xf'),_0x1489a8,_0x48f7('0x10'));logger[_0x48f7('0x11')](_0x48f7('0x12'),_0x1489a8,'request\x20sent',JSON[_0x48f7('0x13')](_0x205ac3));if(_0x205ac3[_0x48f7('0x14')]){if(_0x205ac3[_0x48f7('0x14')]['code']===0x1f4){logger[_0x48f7('0x14')]('OpenchannelMessage,\x20%s,\x20%s',_0x1489a8,_0x205ac3[_0x48f7('0x14')][_0x48f7('0x15')]);return _0x39399a(_0x205ac3['error'][_0x48f7('0x15')]);}logger['error'](_0x48f7('0xf'),_0x1489a8,_0x205ac3['error'][_0x48f7('0x15')]);return _0x507b1a(_0x205ac3[_0x48f7('0x14')][_0x48f7('0x15')]);}else{logger[_0x48f7('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x1489a8,_0x48f7('0x10'));_0x507b1a(_0x205ac3[_0x48f7('0x17')][_0x48f7('0x15')]);}})[_0x48f7('0x18')](function(_0x8fcfcf){logger[_0x48f7('0x14')](_0x48f7('0xf'),_0x1489a8,_0x8fcfcf);_0x39399a(_0x8fcfcf);});});}function respondWithResult(_0x336b6b,_0x2b3fe5){_0x2b3fe5=_0x2b3fe5||0xc8;return function(_0x35a022){if(_0x35a022){return _0x336b6b[_0x48f7('0x19')](_0x2b3fe5)[_0x48f7('0x1a')](_0x35a022);}};}function respondWithFilteredResult(_0x506bb2,_0x5a4473){return function(_0xd187e9){if(_0xd187e9){var _0x58e448=typeof _0x5a4473[_0x48f7('0x1b')]==='undefined'&&typeof _0x5a4473[_0x48f7('0x1c')]===_0x48f7('0x1d');var _0x4c7d45=_0xd187e9[_0x48f7('0x1e')];var _0x5d1ab0=_0x58e448?0x0:_0x5a4473[_0x48f7('0x1b')];var _0x4e5b02=_0x58e448?_0xd187e9['count']:_0x5a4473['offset']+_0x5a4473[_0x48f7('0x1c')];var _0x55e618;if(_0x4e5b02>=_0x4c7d45){_0x4e5b02=_0x4c7d45;_0x55e618=0xc8;}else{_0x55e618=0xce;}_0x506bb2[_0x48f7('0x19')](_0x55e618);return _0x506bb2[_0x48f7('0x1f')](_0x48f7('0x20'),_0x5d1ab0+'-'+_0x4e5b02+'/'+_0x4c7d45)[_0x48f7('0x1a')](_0xd187e9);}return null;};}function saveUpdates(_0x4ac89e){return function(_0x1693e9){if(_0x1693e9){return _0x1693e9['update'](_0x4ac89e)[_0x48f7('0xe')](function(_0x1a5754){return _0x1a5754;});}return null;};}function removeEntity(_0x4eee30){return function(_0x5e075a){if(_0x5e075a){return _0x5e075a[_0x48f7('0x21')]()[_0x48f7('0xe')](function(){_0x4eee30[_0x48f7('0x19')](0xcc)[_0x48f7('0x22')]();});}};}function handleEntityNotFound(_0x52f10a){return function(_0x2d7c9d){if(!_0x2d7c9d){_0x52f10a[_0x48f7('0x23')](0x194);}return _0x2d7c9d;};}function handleError(_0x1a0ffa,_0x2eccfc){_0x2eccfc=_0x2eccfc||0x1f4;return function(_0x23d750){logger[_0x48f7('0x14')](_0x23d750[_0x48f7('0x24')]);if(_0x23d750['name']){delete _0x23d750[_0x48f7('0x25')];}_0x1a0ffa[_0x48f7('0x19')](_0x2eccfc)['send'](_0x23d750);};}exports[_0x48f7('0x26')]=function(_0x63988c,_0xe92bc9){var _0x24f03a={},_0x4982c4={},_0x2968e9={'count':0x0,'rows':[]};var _0x955cd5=_[_0x48f7('0x27')](db[_0x48f7('0x28')]['rawAttributes'],function(_0x10ef2c){return{'name':_0x10ef2c[_0x48f7('0x29')],'type':_0x10ef2c[_0x48f7('0x2a')]['key']};});_0x4982c4['model']=_[_0x48f7('0x27')](_0x955cd5,_0x48f7('0x25'));_0x4982c4['query']=_[_0x48f7('0x2b')](_0x63988c[_0x48f7('0x2c')]);_0x4982c4[_0x48f7('0x2d')]=_[_0x48f7('0x2e')](_0x4982c4[_0x48f7('0x2f')],_0x4982c4[_0x48f7('0x2c')]);_0x24f03a['attributes']=_[_0x48f7('0x2e')](_0x4982c4[_0x48f7('0x2f')],qs[_0x48f7('0x30')](_0x63988c[_0x48f7('0x2c')][_0x48f7('0x30')]));_0x24f03a[_0x48f7('0x31')]=_0x24f03a[_0x48f7('0x31')][_0x48f7('0x32')]?_0x24f03a[_0x48f7('0x31')]:_0x4982c4[_0x48f7('0x2f')];if(!_0x63988c[_0x48f7('0x2c')][_0x48f7('0x33')]('nolimit')){_0x24f03a[_0x48f7('0x1c')]=qs[_0x48f7('0x1c')](_0x63988c[_0x48f7('0x2c')][_0x48f7('0x1c')]);_0x24f03a[_0x48f7('0x1b')]=qs[_0x48f7('0x1b')](_0x63988c[_0x48f7('0x2c')][_0x48f7('0x1b')]);}_0x24f03a[_0x48f7('0x34')]=qs[_0x48f7('0x35')](_0x63988c[_0x48f7('0x2c')][_0x48f7('0x35')]);_0x24f03a[_0x48f7('0x36')]=qs[_0x48f7('0x2d')](_[_0x48f7('0x37')](_0x63988c[_0x48f7('0x2c')],_0x4982c4[_0x48f7('0x2d')]),_0x955cd5);if(_0x63988c['query'][_0x48f7('0x38')]){_0x24f03a['where']=_[_0x48f7('0x39')](_0x24f03a[_0x48f7('0x36')],{'$or':_[_0x48f7('0x27')](_0x955cd5,function(_0x28c427){if(_0x28c427[_0x48f7('0x2a')]!==_0x48f7('0x3a')){var _0x753c8={};_0x753c8[_0x28c427[_0x48f7('0x25')]]={'$like':'%'+_0x63988c[_0x48f7('0x2c')][_0x48f7('0x38')]+'%'};return _0x753c8;}})});}_0x24f03a=_[_0x48f7('0x39')]({},_0x24f03a,_0x63988c[_0x48f7('0x3b')]);var _0x405fd2={'where':_0x24f03a[_0x48f7('0x36')]};return db[_0x48f7('0x28')][_0x48f7('0x1e')](_0x405fd2)[_0x48f7('0xe')](function(_0x51707a){_0x2968e9[_0x48f7('0x1e')]=_0x51707a;if(_0x63988c['query'][_0x48f7('0x3c')]){_0x24f03a[_0x48f7('0x3d')]=[{'all':!![]}];}return db[_0x48f7('0x28')][_0x48f7('0x3e')](_0x24f03a);})['then'](function(_0x3abc31){_0x2968e9[_0x48f7('0x3f')]=_0x3abc31;return _0x2968e9;})[_0x48f7('0xe')](respondWithFilteredResult(_0xe92bc9,_0x24f03a))[_0x48f7('0x18')](handleError(_0xe92bc9,null));};exports[_0x48f7('0x40')]=function(_0x419c1d,_0x3aea20){var _0x5c24c5={'raw':!![],'where':{'id':_0x419c1d[_0x48f7('0x41')]['id']}},_0x48987e={};_0x48987e[_0x48f7('0x2f')]=_[_0x48f7('0x2b')](db['OpenchannelMessage'][_0x48f7('0x42')]);_0x48987e[_0x48f7('0x2c')]=_['keys'](_0x419c1d[_0x48f7('0x2c')]);_0x48987e[_0x48f7('0x2d')]=_['intersection'](_0x48987e[_0x48f7('0x2f')],_0x48987e[_0x48f7('0x2c')]);_0x5c24c5[_0x48f7('0x31')]=_[_0x48f7('0x2e')](_0x48987e['model'],qs['fields'](_0x419c1d[_0x48f7('0x2c')][_0x48f7('0x30')]));_0x5c24c5[_0x48f7('0x31')]=_0x5c24c5['attributes'][_0x48f7('0x32')]?_0x5c24c5[_0x48f7('0x31')]:_0x48987e['model'];if(_0x419c1d[_0x48f7('0x2c')][_0x48f7('0x3c')]){_0x5c24c5[_0x48f7('0x3d')]=[{'all':!![]}];}_0x5c24c5=_[_0x48f7('0x39')]({},_0x5c24c5,_0x419c1d[_0x48f7('0x3b')]);return db['OpenchannelMessage'][_0x48f7('0x43')](_0x5c24c5)[_0x48f7('0xe')](handleEntityNotFound(_0x3aea20,null))['then'](respondWithResult(_0x3aea20,null))['catch'](handleError(_0x3aea20,null));};exports['create']=function(_0x5070c4,_0x3c8db8){return db[_0x48f7('0x28')][_0x48f7('0x44')](_0x5070c4['body'],{})['then'](respondWithResult(_0x3c8db8,0xc9))['catch'](handleError(_0x3c8db8,null));};exports[_0x48f7('0x45')]=function(_0x3452b3,_0x8c8155){if(_0x3452b3[_0x48f7('0x46')]['id']){delete _0x3452b3[_0x48f7('0x46')]['id'];}return db[_0x48f7('0x28')]['find']({'where':{'id':_0x3452b3[_0x48f7('0x41')]['id']}})[_0x48f7('0xe')](handleEntityNotFound(_0x8c8155,null))['then'](saveUpdates(_0x3452b3[_0x48f7('0x46')],null))[_0x48f7('0xe')](respondWithResult(_0x8c8155,null))[_0x48f7('0x18')](handleError(_0x8c8155,null));};exports[_0x48f7('0x21')]=function(_0x4adb72,_0x79a03f){return db[_0x48f7('0x28')][_0x48f7('0x43')]({'where':{'id':_0x4adb72[_0x48f7('0x41')]['id']}})[_0x48f7('0xe')](handleEntityNotFound(_0x79a03f,null))['then'](removeEntity(_0x79a03f,null))[_0x48f7('0x18')](handleError(_0x79a03f,null));};exports['describe']=function(_0x1ed769,_0x4e6a09){return db[_0x48f7('0x28')]['describe']()['then'](respondWithResult(_0x4e6a09,null))['catch'](handleError(_0x4e6a09,null));};exports[_0x48f7('0x47')]=function(_0x57224d,_0x1ac120){var _0x21f67f=_0x48f7('0x48');return interactionService['acceptMessage'](_0x57224d,_0x21f67f)[_0x48f7('0xe')](respondWithResult(_0x1ac120,null))['catch'](handleError(_0x1ac120,null));};exports['reject']=function(_0x4104f2,_0x29c717){var _0x4bed89={'agent':{},'channel':'openchannel'};if(_0x4104f2[_0x48f7('0x46')]['id']){delete _0x4104f2['body']['id'];}_0x4104f2['body'][_0x48f7('0x49')]=_0x4104f2[_0x48f7('0x46')][_0x48f7('0x49')]||_0x4104f2[_0x48f7('0x4a')]['id'];_0x4bed89[_0x48f7('0x4b')]['id']=_0x4104f2[_0x48f7('0x46')][_0x48f7('0x49')];return db[_0x48f7('0x28')][_0x48f7('0x43')]({'where':{'id':_0x4104f2['params']['id'],'UserId':null}})[_0x48f7('0xe')](handleEntityNotFound(_0x29c717,null))[_0x48f7('0xe')](function(_0x215a58){if(_0x215a58){_0x4bed89[_0x48f7('0x15')]=_0x215a58['get']({'plain':!![]});return db['OpenchannelInteraction'][_0x48f7('0x43')]({'where':{'id':_0x215a58[_0x48f7('0x4c')]}});}return null;})[_0x48f7('0xe')](handleEntityNotFound(_0x29c717,null))[_0x48f7('0xe')](function(_0x35465e){if(_0x35465e){_0x4bed89[_0x48f7('0x4d')]=_0x35465e[_0x48f7('0x4e')]({'plain':!![]});interaction_log[_0x48f7('0x16')](_0x48f7('0x4f'),_0x4104f2[_0x48f7('0x4a')]['id'],_0x4104f2[_0x48f7('0x4a')][_0x48f7('0x25')],_0x4104f2['user'][_0x48f7('0x50')],_0x4bed89[_0x48f7('0x4d')]['id'],_0x4104f2[_0x48f7('0x46')]?JSON[_0x48f7('0x13')](_0x4104f2[_0x48f7('0x46')]):_0x48f7('0x51'));return respondWithRpcPromise(_0x48f7('0x52'),_0x48f7('0x53'),_0x4bed89);}return null;})[_0x48f7('0xe')](function(_0x1bad38){var _0x541907=_0x48f7('0x54')+_0x1bad38['message'][_0x48f7('0x55')];return db[_0x48f7('0x56')][_0x48f7('0x2c')](_0x541907,{'type':db[_0x48f7('0x57')][_0x48f7('0x58')]['SELECT'],'raw':!![]})[_0x48f7('0xe')](function(_0x155a5c){return _0x155a5c;});})['then'](function(_0x4b8828){if(_0x4b8828){_0x4bed89['message'][_0x48f7('0x59')]=_0x4b8828[0x0];if(!_0x4104f2[_0x48f7('0x46')][_0x48f7('0x49')])return;return db[_0x48f7('0x5a')]['find']({'where':{'id':_0x4104f2[_0x48f7('0x46')][_0x48f7('0x49')],'role':_0x48f7('0x4b')},'attributes':['id',_0x48f7('0x25'),'fullname',_0x48f7('0x5b'),_0x48f7('0x5c')],'raw':!![]});}return null;})['then'](function(_0x46425c){if(!_0x46425c)return null;_0x4bed89['message'][_0x48f7('0x4b')]=_0x46425c;return _0x4bed89;})[_0x48f7('0xe')](function(_0x2b88b4){if(_0x2b88b4){_0x2b88b4['message'][_0x48f7('0x5d')]=util[_0x48f7('0x5e')](_0x48f7('0x5f'),_0x4104f2['user'][_0x48f7('0x25')]);_0x2b88b4[_0x48f7('0x15')][_0x48f7('0x60')]=_0x4bed89[_0x48f7('0x60')];_0x2b88b4['message'][_0x48f7('0x61')]=_0x4bed89[_0x48f7('0x60')];_0x2b88b4[_0x48f7('0x15')][_0x48f7('0x62')]='reject';respondWithRpcPromise(_0x48f7('0x63'),_0x48f7('0x63'),{'event':_0x48f7('0x64'),'message':_0x2b88b4[_0x48f7('0x15')]},client9002);return _0x4bed89;}return null;})[_0x48f7('0xe')](respondWithResult(_0x29c717,null))[_0x48f7('0x18')](handleError(_0x29c717,null));}; \ No newline at end of file +var _0x64e8=['openchannel-interactions','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','json','offset','limit','undefined','count','set','Content-Range','update','destroy','end','sendStatus','stack','name','map','OpenchannelMessage','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','show','params','includeAll','find','create','body','describe','accept','openchannel','UserId','user','agent','OpenchannelInteraction','OpenchannelInteractionId','interaction','get','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','SIP/%s','reject','EventManager','rejectmessage','util','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','jayson/promise','http','client'];(function(_0x2d16c3,_0x2652c3){var _0x5586e3=function(_0x1182b1){while(--_0x1182b1){_0x2d16c3['push'](_0x2d16c3['shift']());}};_0x5586e3(++_0x2652c3);}(_0x64e8,0x181));var _0x864e=function(_0x18e684,_0x2ec7ff){_0x18e684=_0x18e684-0x0;var _0xbac9f9=_0x64e8[_0x18e684];return _0xbac9f9;};'use strict';var util=require(_0x864e('0x0'));var _=require(_0x864e('0x1'));var Redis=require(_0x864e('0x2'));var interactionService=require(_0x864e('0x3'));var qs=require(_0x864e('0x4'));var logger=require(_0x864e('0x5'))(_0x864e('0x6'));var config=require(_0x864e('0x7'));var db=require(_0x864e('0x8'))['db'];config[_0x864e('0x9')]=_['defaults'](config['redis'],{'host':_0x864e('0xa'),'port':0x18eb});var socket=require(_0x864e('0xb'))(new Redis(config[_0x864e('0x9')]));require('./openchannelMessage.socket')['register'](socket);var jayson=require(_0x864e('0xc'));var client=jayson['client'][_0x864e('0xd')]({'port':0x232c});var client9002=jayson[_0x864e('0xe')][_0x864e('0xd')]({'port':0x232a});var interaction_log=require(_0x864e('0x5'))(_0x864e('0xf'));function respondWithRpcPromise(_0x10c1fe,_0x589383,_0x36d7ea,_0x371b8d){return new Promise(function(_0xa22c22,_0x55cb24){var _0x643f4e=_0x371b8d||client;return _0x643f4e[_0x864e('0x10')](_0x10c1fe,_0x36d7ea)[_0x864e('0x11')](function(_0x59f207){logger[_0x864e('0x12')](_0x864e('0x13'),_0x589383,_0x864e('0x14'));logger[_0x864e('0x15')](_0x864e('0x16'),_0x589383,'request\x20sent',JSON[_0x864e('0x17')](_0x59f207));if(_0x59f207[_0x864e('0x18')]){if(_0x59f207[_0x864e('0x18')][_0x864e('0x19')]===0x1f4){logger[_0x864e('0x18')](_0x864e('0x13'),_0x589383,_0x59f207[_0x864e('0x18')][_0x864e('0x1a')]);return _0x55cb24(_0x59f207[_0x864e('0x18')][_0x864e('0x1a')]);}logger[_0x864e('0x18')]('OpenchannelMessage,\x20%s,\x20%s',_0x589383,_0x59f207[_0x864e('0x18')][_0x864e('0x1a')]);return _0xa22c22(_0x59f207[_0x864e('0x18')][_0x864e('0x1a')]);}else{logger['info'](_0x864e('0x13'),_0x589383,_0x864e('0x14'));_0xa22c22(_0x59f207['result'][_0x864e('0x1a')]);}})[_0x864e('0x1b')](function(_0x5f16d5){logger[_0x864e('0x18')](_0x864e('0x13'),_0x589383,_0x5f16d5);_0x55cb24(_0x5f16d5);});});}function respondWithResult(_0x453c66,_0x40c782){_0x40c782=_0x40c782||0xc8;return function(_0x1e0e1d){if(_0x1e0e1d){return _0x453c66[_0x864e('0x1c')](_0x40c782)[_0x864e('0x1d')](_0x1e0e1d);}};}function respondWithFilteredResult(_0x3d364f,_0xc7680b){return function(_0x37bfe9){if(_0x37bfe9){var _0xc5c5cf=typeof _0xc7680b[_0x864e('0x1e')]==='undefined'&&typeof _0xc7680b[_0x864e('0x1f')]===_0x864e('0x20');var _0x16a988=_0x37bfe9['count'];var _0x59816c=_0xc5c5cf?0x0:_0xc7680b[_0x864e('0x1e')];var _0x357322=_0xc5c5cf?_0x37bfe9[_0x864e('0x21')]:_0xc7680b['offset']+_0xc7680b[_0x864e('0x1f')];var _0x100802;if(_0x357322>=_0x16a988){_0x357322=_0x16a988;_0x100802=0xc8;}else{_0x100802=0xce;}_0x3d364f[_0x864e('0x1c')](_0x100802);return _0x3d364f[_0x864e('0x22')](_0x864e('0x23'),_0x59816c+'-'+_0x357322+'/'+_0x16a988)[_0x864e('0x1d')](_0x37bfe9);}return null;};}function saveUpdates(_0x23d84c){return function(_0x51fb09){if(_0x51fb09){return _0x51fb09[_0x864e('0x24')](_0x23d84c)[_0x864e('0x11')](function(_0xda4954){return _0xda4954;});}return null;};}function removeEntity(_0x922508){return function(_0x4404ed){if(_0x4404ed){return _0x4404ed[_0x864e('0x25')]()[_0x864e('0x11')](function(){_0x922508[_0x864e('0x1c')](0xcc)[_0x864e('0x26')]();});}};}function handleEntityNotFound(_0x45af8f){return function(_0x335d64){if(!_0x335d64){_0x45af8f[_0x864e('0x27')](0x194);}return _0x335d64;};}function handleError(_0x4592d9,_0x3bde65){_0x3bde65=_0x3bde65||0x1f4;return function(_0xeef91c){logger['error'](_0xeef91c[_0x864e('0x28')]);if(_0xeef91c[_0x864e('0x29')]){delete _0xeef91c['name'];}_0x4592d9[_0x864e('0x1c')](_0x3bde65)['send'](_0xeef91c);};}exports['index']=function(_0x241a65,_0x46b5b9){var _0x82dd92={},_0x1ab701={},_0x4c2db2={'count':0x0,'rows':[]};var _0x19f3a7=_[_0x864e('0x2a')](db[_0x864e('0x2b')][_0x864e('0x2c')],function(_0xcc0f26){return{'name':_0xcc0f26[_0x864e('0x2d')],'type':_0xcc0f26[_0x864e('0x2e')][_0x864e('0x2f')]};});_0x1ab701[_0x864e('0x30')]=_['map'](_0x19f3a7,_0x864e('0x29'));_0x1ab701[_0x864e('0x31')]=_['keys'](_0x241a65[_0x864e('0x31')]);_0x1ab701[_0x864e('0x32')]=_['intersection'](_0x1ab701[_0x864e('0x30')],_0x1ab701['query']);_0x82dd92[_0x864e('0x33')]=_[_0x864e('0x34')](_0x1ab701[_0x864e('0x30')],qs['fields'](_0x241a65['query'][_0x864e('0x35')]));_0x82dd92[_0x864e('0x33')]=_0x82dd92[_0x864e('0x33')][_0x864e('0x36')]?_0x82dd92[_0x864e('0x33')]:_0x1ab701[_0x864e('0x30')];if(!_0x241a65[_0x864e('0x31')][_0x864e('0x37')](_0x864e('0x38'))){_0x82dd92['limit']=qs['limit'](_0x241a65[_0x864e('0x31')][_0x864e('0x1f')]);_0x82dd92['offset']=qs[_0x864e('0x1e')](_0x241a65[_0x864e('0x31')]['offset']);}_0x82dd92[_0x864e('0x39')]=qs[_0x864e('0x3a')](_0x241a65[_0x864e('0x31')]['sort']);_0x82dd92['where']=qs[_0x864e('0x32')](_[_0x864e('0x3b')](_0x241a65['query'],_0x1ab701['filters']),_0x19f3a7);if(_0x241a65['query'][_0x864e('0x3c')]){_0x82dd92[_0x864e('0x3d')]=_[_0x864e('0x3e')](_0x82dd92['where'],{'$or':_[_0x864e('0x2a')](_0x19f3a7,function(_0x1e38c7){if(_0x1e38c7['type']!==_0x864e('0x3f')){var _0x962133={};_0x962133[_0x1e38c7[_0x864e('0x29')]]={'$like':'%'+_0x241a65['query'][_0x864e('0x3c')]+'%'};return _0x962133;}})});}_0x82dd92=_[_0x864e('0x3e')]({},_0x82dd92,_0x241a65[_0x864e('0x40')]);var _0x50f1ce={'where':_0x82dd92[_0x864e('0x3d')]};return db[_0x864e('0x2b')][_0x864e('0x21')](_0x50f1ce)[_0x864e('0x11')](function(_0x33b9bf){_0x4c2db2['count']=_0x33b9bf;if(_0x241a65[_0x864e('0x31')]['includeAll']){_0x82dd92[_0x864e('0x41')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x864e('0x42')](_0x82dd92);})[_0x864e('0x11')](function(_0x3c85cf){_0x4c2db2['rows']=_0x3c85cf;return _0x4c2db2;})[_0x864e('0x11')](respondWithFilteredResult(_0x46b5b9,_0x82dd92))['catch'](handleError(_0x46b5b9,null));};exports[_0x864e('0x43')]=function(_0x59f905,_0x4d290f){var _0x5457b6={'raw':!![],'where':{'id':_0x59f905[_0x864e('0x44')]['id']}},_0x585acf={};_0x585acf[_0x864e('0x30')]=_['keys'](db[_0x864e('0x2b')][_0x864e('0x2c')]);_0x585acf[_0x864e('0x31')]=_['keys'](_0x59f905[_0x864e('0x31')]);_0x585acf[_0x864e('0x32')]=_[_0x864e('0x34')](_0x585acf[_0x864e('0x30')],_0x585acf[_0x864e('0x31')]);_0x5457b6[_0x864e('0x33')]=_[_0x864e('0x34')](_0x585acf[_0x864e('0x30')],qs[_0x864e('0x35')](_0x59f905[_0x864e('0x31')][_0x864e('0x35')]));_0x5457b6[_0x864e('0x33')]=_0x5457b6[_0x864e('0x33')]['length']?_0x5457b6[_0x864e('0x33')]:_0x585acf['model'];if(_0x59f905[_0x864e('0x31')][_0x864e('0x45')]){_0x5457b6[_0x864e('0x41')]=[{'all':!![]}];}_0x5457b6=_['merge']({},_0x5457b6,_0x59f905[_0x864e('0x40')]);return db[_0x864e('0x2b')][_0x864e('0x46')](_0x5457b6)[_0x864e('0x11')](handleEntityNotFound(_0x4d290f,null))[_0x864e('0x11')](respondWithResult(_0x4d290f,null))['catch'](handleError(_0x4d290f,null));};exports[_0x864e('0x47')]=function(_0x28c792,_0x21ecc4){return db[_0x864e('0x2b')][_0x864e('0x47')](_0x28c792[_0x864e('0x48')],{})[_0x864e('0x11')](respondWithResult(_0x21ecc4,0xc9))[_0x864e('0x1b')](handleError(_0x21ecc4,null));};exports[_0x864e('0x24')]=function(_0x3d73ed,_0x2544c3){if(_0x3d73ed['body']['id']){delete _0x3d73ed[_0x864e('0x48')]['id'];}return db[_0x864e('0x2b')]['find']({'where':{'id':_0x3d73ed['params']['id']}})[_0x864e('0x11')](handleEntityNotFound(_0x2544c3,null))[_0x864e('0x11')](saveUpdates(_0x3d73ed['body'],null))[_0x864e('0x11')](respondWithResult(_0x2544c3,null))[_0x864e('0x1b')](handleError(_0x2544c3,null));};exports[_0x864e('0x25')]=function(_0x30a1e1,_0x2fe38a){return db[_0x864e('0x2b')]['find']({'where':{'id':_0x30a1e1[_0x864e('0x44')]['id']}})[_0x864e('0x11')](handleEntityNotFound(_0x2fe38a,null))[_0x864e('0x11')](removeEntity(_0x2fe38a,null))[_0x864e('0x1b')](handleError(_0x2fe38a,null));};exports['describe']=function(_0x13ae8b,_0x4318e1){return db[_0x864e('0x2b')][_0x864e('0x49')]()['then'](respondWithResult(_0x4318e1,null))['catch'](handleError(_0x4318e1,null));};exports[_0x864e('0x4a')]=function(_0x2a3c1c,_0x3a6b87){var _0x8b14ef='openchannel';return interactionService['acceptMessage'](_0x2a3c1c,_0x8b14ef)[_0x864e('0x11')](respondWithResult(_0x3a6b87,null))[_0x864e('0x1b')](handleError(_0x3a6b87,null));};exports['reject']=function(_0x588c35,_0x165e79){var _0x5282fe={'agent':{},'channel':_0x864e('0x4b')};if(_0x588c35[_0x864e('0x48')]['id']){delete _0x588c35[_0x864e('0x48')]['id'];}_0x588c35[_0x864e('0x48')][_0x864e('0x4c')]=_0x588c35[_0x864e('0x48')][_0x864e('0x4c')]||_0x588c35[_0x864e('0x4d')]['id'];_0x5282fe[_0x864e('0x4e')]['id']=_0x588c35[_0x864e('0x48')][_0x864e('0x4c')];return db[_0x864e('0x2b')][_0x864e('0x46')]({'where':{'id':_0x588c35[_0x864e('0x44')]['id'],'UserId':null}})[_0x864e('0x11')](handleEntityNotFound(_0x165e79,null))[_0x864e('0x11')](function(_0x4c92ee){if(_0x4c92ee){_0x5282fe[_0x864e('0x1a')]=_0x4c92ee['get']({'plain':!![]});return db[_0x864e('0x4f')]['find']({'where':{'id':_0x4c92ee[_0x864e('0x50')]}});}return null;})[_0x864e('0x11')](handleEntityNotFound(_0x165e79,null))[_0x864e('0x11')](function(_0x308df8){if(_0x308df8){_0x5282fe[_0x864e('0x51')]=_0x308df8[_0x864e('0x52')]({'plain':!![]});interaction_log[_0x864e('0x12')](_0x864e('0x53'),_0x588c35[_0x864e('0x4d')]['id'],_0x588c35[_0x864e('0x4d')]['name'],_0x588c35[_0x864e('0x4d')][_0x864e('0x54')],_0x5282fe[_0x864e('0x51')]['id'],_0x588c35['body']?JSON[_0x864e('0x17')](_0x588c35[_0x864e('0x48')]):'null');return respondWithRpcPromise(_0x864e('0x55'),'rejectMessage',_0x5282fe);}return null;})[_0x864e('0x11')](function(_0x168a25){var _0x270bfa='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x168a25[_0x864e('0x1a')][_0x864e('0x56')];return db[_0x864e('0x57')][_0x864e('0x31')](_0x270bfa,{'type':db[_0x864e('0x58')][_0x864e('0x59')][_0x864e('0x5a')],'raw':!![]})['then'](function(_0x5bb3be){return _0x5bb3be;});})[_0x864e('0x11')](function(_0x2ba28d){if(_0x2ba28d){_0x5282fe[_0x864e('0x1a')][_0x864e('0x5b')]=_0x2ba28d[0x0];if(!_0x588c35[_0x864e('0x48')]['UserId'])return;return db[_0x864e('0x5c')]['find']({'where':{'id':_0x588c35[_0x864e('0x48')][_0x864e('0x4c')],'role':_0x864e('0x4e')},'attributes':['id','name',_0x864e('0x5d'),_0x864e('0x5e'),_0x864e('0x5f')],'raw':!![]});}return null;})['then'](function(_0x2efed9){if(!_0x2efed9)return null;_0x5282fe[_0x864e('0x1a')][_0x864e('0x4e')]=_0x2efed9;return _0x5282fe;})[_0x864e('0x11')](function(_0x16a6f8){if(_0x16a6f8){_0x16a6f8[_0x864e('0x1a')]['interface']=util['format'](_0x864e('0x60'),_0x588c35[_0x864e('0x4d')]['name']);_0x16a6f8['message']['channel']=_0x5282fe['channel'];_0x16a6f8[_0x864e('0x1a')]['motionChannel']=_0x5282fe['channel'];_0x16a6f8[_0x864e('0x1a')]['event']=_0x864e('0x61');respondWithRpcPromise('EventManager',_0x864e('0x62'),{'event':_0x864e('0x63'),'message':_0x16a6f8[_0x864e('0x1a')]},client9002);return _0x5282fe;}return null;})[_0x864e('0x11')](respondWithResult(_0x165e79,null))[_0x864e('0x1b')](handleError(_0x165e79,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 0f71402..19e8114 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 _0xef7a=['update','emit','hook','../../mysqldb','OpenchannelMessage','save'];(function(_0x163374,_0x1b0054){var _0x445d96=function(_0x532d44){while(--_0x532d44){_0x163374['push'](_0x163374['shift']());}};_0x445d96(++_0x1b0054);}(_0xef7a,0x18f));var _0xaef7=function(_0x4f4de2,_0x257b5d){_0x4f4de2=_0x4f4de2-0x0;var _0x1cbf3a=_0xef7a[_0x4f4de2];return _0x1cbf3a;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0xaef7('0x0'))['db'][_0xaef7('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xaef7('0x2'),'afterUpdate':_0xaef7('0x3'),'afterDestroy':'remove'};function emitEvent(_0xc84a73){return function(_0x586df9,_0x4c135a,_0x2b509d){OpenchannelMessageEvents[_0xaef7('0x4')](_0xc84a73+':'+_0x586df9['id'],_0x586df9);OpenchannelMessageEvents[_0xaef7('0x4')](_0xc84a73,_0x586df9);_0x2b509d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0xaef7('0x5')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file +var _0x3d15=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelMessage'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x3d15,0x81));var _0x53d1=function(_0x342967,_0x176fd7){_0x342967=_0x342967-0x0;var _0x393b7e=_0x3d15[_0x342967];return _0x393b7e;};'use strict';var EventEmitter=require(_0x53d1('0x0'));var OpenchannelMessage=require(_0x53d1('0x1'))['db'][_0x53d1('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x53d1('0x3')](0x0);var events={'afterCreate':_0x53d1('0x4'),'afterUpdate':_0x53d1('0x5'),'afterDestroy':_0x53d1('0x6')};function emitEvent(_0x4e85a8){return function(_0x2e2717,_0x1890f2,_0xe53b25){OpenchannelMessageEvents['emit'](_0x4e85a8+':'+_0x2e2717['id'],_0x2e2717);OpenchannelMessageEvents[_0x53d1('0x7')](_0x4e85a8,_0x2e2717);_0xe53b25(null);};}for(var e in events){if(events[_0x53d1('0x8')](e)){var event=events[e];OpenchannelMessage[_0x53d1('0x9')](e,emitEvent(event));}}module[_0x53d1('0xa')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 6e6da9a..2edfe6f 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 _0x83d2=['OpenchannelMessage','openchannel_messages','fti_openchannel_messages','FULLTEXT','models','toLowerCase','direction','out','secret','isNil','UserId','OpenchannelInteraction','findOne','update','createdAt','catch','error','describe','then','find','OpenchannelAccountId','CmContact','Contact','keys','get','info','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','Interactions','length','omit','POST','GET','body','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports'];(function(_0x2b034a,_0xd9088c){var _0x2763f4=function(_0x550dc3){while(--_0x550dc3){_0x2b034a['push'](_0x2b034a['shift']());}};_0x2763f4(++_0xd9088c);}(_0x83d2,0xfa));var _0x283d=function(_0x18f743,_0x2c626b){_0x18f743=_0x18f743-0x0;var _0x5e2d4=_0x83d2[_0x18f743];return _0x5e2d4;};'use strict';var _=require(_0x283d('0x0'));var util=require('util');var logger=require(_0x283d('0x1'))(_0x283d('0x2'));var moment=require('moment');var BPromise=require(_0x283d('0x3'));var rp=require(_0x283d('0x4'));var fs=require('fs');var path=require(_0x283d('0x5'));var rimraf=require(_0x283d('0x6'));var config=require(_0x283d('0x7'));var attributes=require(_0x283d('0x8'));module[_0x283d('0x9')]=function(_0x479dbf,_0x59490d){return _0x479dbf['define'](_0x283d('0xa'),attributes,{'tableName':_0x283d('0xb'),'paranoid':![],'indexes':[{'name':_0x283d('0xc'),'fields':['body'],'type':_0x283d('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4b1231,_0x1bc2da,_0x1b9ef0){var _0x6601a1=_0x479dbf[_0x283d('0xe')];var _0x26d556=_0x4b1231['get']({'plain':!![]});if(_0x26d556['direction'][_0x283d('0xf')]()==='in'||_0x26d556[_0x283d('0x10')]['toLowerCase']()===_0x283d('0x11')&&!_0x26d556[_0x283d('0x12')]&&!_[_0x283d('0x13')](_0x26d556[_0x283d('0x14')])){_0x6601a1[_0x283d('0x15')][_0x283d('0x16')]({'where':{'id':_0x26d556['OpenchannelInteractionId']}})['then'](function(_0x3afe52){if(_0x3afe52){_0x3afe52[_0x283d('0x17')]({'lastMsgAt':_0x26d556[_0x283d('0x18')],'lastMsgDirection':_0x26d556[_0x283d('0x10')][_0x283d('0xf')]()});}})[_0x283d('0x19')](function(_0x453bf5){console[_0x283d('0x1a')](_0x453bf5);});}if(_0x26d556[_0x283d('0x10')]===_0x283d('0x11')&&!_0x26d556[_0x283d('0x12')]){var _0x4a5444;_0x6601a1['CmContact'][_0x283d('0x1b')]()[_0x283d('0x1c')](function(_0x597dde){return _0x6601a1['OpenchannelAccount'][_0x283d('0x1d')]({'where':{'id':_0x26d556[_0x283d('0x1e')]},'include':[{'model':_0x6601a1[_0x283d('0x15')],'as':'Interactions','where':{'id':_0x26d556['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x6601a1[_0x283d('0x1f')],'as':_0x283d('0x20'),'attributes':_[_0x283d('0x21')](_0x597dde)}]}]});})[_0x283d('0x1c')](function(_0x2cb1ce){_0x4a5444=_0x2cb1ce[_0x283d('0x22')]({'plain':!![]});if(_0x4a5444&&_0x4a5444['replyUri']){logger[_0x283d('0x23')]('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util['format'](_0x283d('0x24'),_0x26d556['id'],_0x4a5444[_0x283d('0x25')]));if(_0x4a5444[_0x283d('0x26')]&&_0x4a5444[_0x283d('0x26')][_0x283d('0x27')]){_0x26d556['Interaction']=_[_0x283d('0x28')](_0x4a5444[_0x283d('0x26')][0x0],_0x283d('0x20'));_0x26d556[_0x283d('0x20')]=_0x4a5444[_0x283d('0x26')][0x0][_0x283d('0x20')];}var _0x1bc2da={'method':_0x283d('0x29'),'uri':encodeURI(_0x4a5444[_0x283d('0x25')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x1bc2da['method']){case _0x283d('0x2a'):_0x1bc2da['qs']=_0x26d556;break;case _0x283d('0x29'):_0x1bc2da[_0x283d('0x2b')]=_0x26d556;break;}return rp(_0x1bc2da)[_0x283d('0x1c')](function(_0x3a1d96){logger['info'](_0x283d('0x2c'),_0x283d('0x2d'),util[_0x283d('0x2e')](_0x283d('0x2f'),_0x26d556['id'],_0x4a5444[_0x283d('0x25')]));if(_0x3a1d96[_0x283d('0x2b')][_0x283d('0x30')]&&_0x3a1d96[_0x283d('0x2b')][_0x283d('0x30')]!=_0x26d556[_0x283d('0x31')]['threadId']){return _0x6601a1[_0x283d('0x15')][_0x283d('0x17')]({'threadId':_0x3a1d96[_0x283d('0x2b')][_0x283d('0x30')]},{'where':{'id':_0x26d556[_0x283d('0x31')]['id']}});}else{return;}})['then'](function(){return _0x4b1231['update']({'read':!![]});})[_0x283d('0x19')](function(_0xd0e7d8){logger['error'](_0x283d('0x2c'),'afterCreate',util['inspect'](_0xd0e7d8,{'showHidden':![],'depth':null}));_0x1b9ef0();});}else{_0x1b9ef0();}})['finally'](function(){_0x1b9ef0();});}else{_0x1b9ef0();}}},'charset':_0x283d('0x32'),'collate':_0x283d('0x33')});}; \ No newline at end of file +var _0x1a9f=['rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','createdAt','catch','error','CmContact','describe','find','OpenchannelAccountId','Contact','keys','replyUri','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','Interactions','POST','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','inspect','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1a9f,0x150));var _0xf1a9=function(_0x31b9cf,_0x1a809b){_0x31b9cf=_0x31b9cf-0x0;var _0x357b8a=_0x1a9f[_0x31b9cf];return _0x357b8a;};'use strict';var _=require(_0xf1a9('0x0'));var util=require(_0xf1a9('0x1'));var logger=require(_0xf1a9('0x2'))(_0xf1a9('0x3'));var moment=require(_0xf1a9('0x4'));var BPromise=require(_0xf1a9('0x5'));var rp=require(_0xf1a9('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf1a9('0x7'));var config=require(_0xf1a9('0x8'));var attributes=require(_0xf1a9('0x9'));module[_0xf1a9('0xa')]=function(_0x52cb68,_0x1ff946){return _0x52cb68[_0xf1a9('0xb')](_0xf1a9('0xc'),attributes,{'tableName':_0xf1a9('0xd'),'paranoid':![],'indexes':[{'name':_0xf1a9('0xe'),'fields':[_0xf1a9('0xf')],'type':_0xf1a9('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x148a6f,_0x183f46,_0x2446b4){var _0x471436=_0x52cb68['models'];var _0x3b885c=_0x148a6f[_0xf1a9('0x11')]({'plain':!![]});if(_0x3b885c[_0xf1a9('0x12')][_0xf1a9('0x13')]()==='in'||_0x3b885c['direction']['toLowerCase']()===_0xf1a9('0x14')&&!_0x3b885c[_0xf1a9('0x15')]&&!_[_0xf1a9('0x16')](_0x3b885c['UserId'])){_0x471436[_0xf1a9('0x17')][_0xf1a9('0x18')]({'where':{'id':_0x3b885c[_0xf1a9('0x19')]}})[_0xf1a9('0x1a')](function(_0x29def7){if(_0x29def7){_0x29def7[_0xf1a9('0x1b')]({'lastMsgAt':_0x3b885c[_0xf1a9('0x1c')],'lastMsgDirection':_0x3b885c[_0xf1a9('0x12')][_0xf1a9('0x13')]()});}})[_0xf1a9('0x1d')](function(_0x370746){console[_0xf1a9('0x1e')](_0x370746);});}if(_0x3b885c[_0xf1a9('0x12')]===_0xf1a9('0x14')&&!_0x3b885c[_0xf1a9('0x15')]){var _0x1ce768;_0x471436[_0xf1a9('0x1f')][_0xf1a9('0x20')]()['then'](function(_0x55072c){return _0x471436['OpenchannelAccount'][_0xf1a9('0x21')]({'where':{'id':_0x3b885c[_0xf1a9('0x22')]},'include':[{'model':_0x471436[_0xf1a9('0x17')],'as':'Interactions','where':{'id':_0x3b885c[_0xf1a9('0x19')]},'limit':0x1,'include':[{'model':_0x471436[_0xf1a9('0x1f')],'as':_0xf1a9('0x23'),'attributes':_[_0xf1a9('0x24')](_0x55072c)}]}]});})[_0xf1a9('0x1a')](function(_0x34300d){_0x1ce768=_0x34300d[_0xf1a9('0x11')]({'plain':!![]});if(_0x1ce768&&_0x1ce768[_0xf1a9('0x25')]){logger['info'](_0xf1a9('0x26'),_0xf1a9('0x27'),util[_0xf1a9('0x28')](_0xf1a9('0x29'),_0x3b885c['id'],_0x1ce768[_0xf1a9('0x25')]));if(_0x1ce768[_0xf1a9('0x2a')]&&_0x1ce768['Interactions']['length']){_0x3b885c['Interaction']=_['omit'](_0x1ce768[_0xf1a9('0x2a')][0x0],'Contact');_0x3b885c[_0xf1a9('0x23')]=_0x1ce768['Interactions'][0x0]['Contact'];}var _0x183f46={'method':_0xf1a9('0x2b'),'uri':encodeURI(_0x1ce768[_0xf1a9('0x25')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x183f46['method']){case'GET':_0x183f46['qs']=_0x3b885c;break;case _0xf1a9('0x2b'):_0x183f46['body']=_0x3b885c;break;}return rp(_0x183f46)['then'](function(_0x3ae67c){logger['info'](_0xf1a9('0x26'),'afterCreate',util[_0xf1a9('0x28')](_0xf1a9('0x2c'),_0x3b885c['id'],_0x1ce768[_0xf1a9('0x25')]));if(_0x3ae67c[_0xf1a9('0xf')][_0xf1a9('0x2d')]&&_0x3ae67c[_0xf1a9('0xf')][_0xf1a9('0x2d')]!=_0x3b885c[_0xf1a9('0x2e')]['threadId']){return _0x471436[_0xf1a9('0x17')][_0xf1a9('0x1b')]({'threadId':_0x3ae67c[_0xf1a9('0xf')][_0xf1a9('0x2d')]},{'where':{'id':_0x3b885c[_0xf1a9('0x2e')]['id']}});}else{return;}})[_0xf1a9('0x1a')](function(){return _0x148a6f[_0xf1a9('0x1b')]({'read':!![]});})[_0xf1a9('0x1d')](function(_0xdee7){logger['error']('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util[_0xf1a9('0x2f')](_0xdee7,{'showHidden':![],'depth':null}));_0x2446b4();});}else{_0x2446b4();}})['finally'](function(){_0x2446b4();});}else{_0x2446b4();}}},'charset':'utf8mb4','collate':_0xf1a9('0x30')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 9ece96d..adf83ab 100644 --- a/server/api/openchannelMessage/openchannelMessage.rpc.js +++ b/server/api/openchannelMessage/openchannelMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','OpenchannelMessage','create','options','raw','CreateOpenchannelMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x77123c,_0xbb959e){var _0x4d6c5d=function(_0x487c03){while(--_0x487c03){_0x77123c['push'](_0x77123c['shift']());}};_0x4d6c5d(++_0xbb959e);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2afcfa,_0x456ebd){_0x2afcfa=_0x2afcfa-0x0;var _0x1f012d=_0x5f2f[_0x2afcfa];return _0x1f012d;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});config[_0xf5f2('0xc')]=_[_0xf5f2('0xd')](config['redis'],{'host':_0xf5f2('0xe'),'port':0x18eb});var socket=require(_0xf5f2('0xf'))(new Redis(config[_0xf5f2('0xc')]));require('./openchannelMessage.socket')[_0xf5f2('0x10')](socket);function respondWithRpcPromise(_0x15dd7c,_0x218ae3,_0x4e0e6b){return new BPromise(function(_0x977a59,_0x4ebbbe){return client['request'](_0x15dd7c,_0x4e0e6b)[_0xf5f2('0x11')](function(_0x151aba){logger['info'](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));logger[_0xf5f2('0x14')](_0xf5f2('0x15'),_0x218ae3,_0xf5f2('0x13'),JSON[_0xf5f2('0x16')](_0x151aba));if(_0x151aba['error']){if(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x18')]===0x1f4){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')]['message']);return _0x4ebbbe(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);return _0x977a59(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}else{logger[_0xf5f2('0x1a')](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));_0x977a59(_0x151aba[_0xf5f2('0x1b')][_0xf5f2('0x19')]);}})[_0xf5f2('0x1c')](function(_0x3cf5ea){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x3cf5ea);_0x4ebbbe(_0x3cf5ea);});});}exports['CreateOpenchannelMessage']=function(_0x34706d){var _0x47101e=this;return new Promise(function(_0x49dac2,_0x47acfc){return db[_0xf5f2('0x1d')][_0xf5f2('0x1e')](_0x34706d['body'],{'raw':_0x34706d[_0xf5f2('0x1f')]?_0x34706d[_0xf5f2('0x1f')][_0xf5f2('0x20')]===undefined?!![]:![]:!![]})[_0xf5f2('0x11')](function(_0x36f1cb){logger['info'](_0xf5f2('0x21'),_0x34706d);logger[_0xf5f2('0x14')](_0xf5f2('0x21'),_0x34706d,JSON[_0xf5f2('0x16')](_0x36f1cb));_0x49dac2(_0x36f1cb);})[_0xf5f2('0x1c')](function(_0x5bdf4a){logger['error'](_0xf5f2('0x21'),_0x5bdf4a[_0xf5f2('0x19')],_0x34706d);_0x47acfc(_0x47101e[_0xf5f2('0x17')](0x1f4,_0x5bdf4a[_0xf5f2('0x19')]));});});}; \ No newline at end of file +var _0xdb28=['then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateOpenchannelMessage','OpenchannelMessage','create','body','options','raw','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','request'];(function(_0x51aee3,_0x30c7e4){var _0x346280=function(_0x456939){while(--_0x456939){_0x51aee3['push'](_0x51aee3['shift']());}};_0x346280(++_0x30c7e4);}(_0xdb28,0x106));var _0x8db2=function(_0x59ced6,_0xdc0004){_0x59ced6=_0x59ced6-0x0;var _0x4f9f10=_0xdb28[_0x59ced6];return _0x4f9f10;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});config['redis']=_[_0x8db2('0xb')](config[_0x8db2('0xc')],{'host':_0x8db2('0xd'),'port':0x18eb});var socket=require(_0x8db2('0xe'))(new Redis(config[_0x8db2('0xc')]));require(_0x8db2('0xf'))[_0x8db2('0x10')](socket);function respondWithRpcPromise(_0x4ba340,_0x30dc90,_0x476216){return new BPromise(function(_0x1f62af,_0x57015f){return client[_0x8db2('0x11')](_0x4ba340,_0x476216)[_0x8db2('0x12')](function(_0x576475){logger[_0x8db2('0x13')](_0x8db2('0x14'),_0x30dc90,_0x8db2('0x15'));logger[_0x8db2('0x16')](_0x8db2('0x17'),_0x30dc90,'request\x20sent',JSON['stringify'](_0x576475));if(_0x576475[_0x8db2('0x18')]){if(_0x576475[_0x8db2('0x18')][_0x8db2('0x19')]===0x1f4){logger[_0x8db2('0x18')](_0x8db2('0x14'),_0x30dc90,_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);return _0x57015f(_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);}logger[_0x8db2('0x18')]('OpenchannelMessage,\x20%s,\x20%s',_0x30dc90,_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);return _0x1f62af(_0x576475['error'][_0x8db2('0x1a')]);}else{logger[_0x8db2('0x13')](_0x8db2('0x14'),_0x30dc90,_0x8db2('0x15'));_0x1f62af(_0x576475[_0x8db2('0x1b')][_0x8db2('0x1a')]);}})['catch'](function(_0x5df464){logger[_0x8db2('0x18')](_0x8db2('0x14'),_0x30dc90,_0x5df464);_0x57015f(_0x5df464);});});}exports[_0x8db2('0x1c')]=function(_0x1b64e4){var _0x58562e=this;return new Promise(function(_0x431d60,_0x36a9ff){return db[_0x8db2('0x1d')][_0x8db2('0x1e')](_0x1b64e4[_0x8db2('0x1f')],{'raw':_0x1b64e4['options']?_0x1b64e4[_0x8db2('0x20')][_0x8db2('0x21')]===undefined?!![]:![]:!![]})[_0x8db2('0x12')](function(_0x125be2){logger[_0x8db2('0x13')](_0x8db2('0x1c'),_0x1b64e4);logger[_0x8db2('0x16')]('CreateOpenchannelMessage',_0x1b64e4,JSON[_0x8db2('0x22')](_0x125be2));_0x431d60(_0x125be2);})['catch'](function(_0x5725f0){logger['error']('CreateOpenchannelMessage',_0x5725f0[_0x8db2('0x1a')],_0x1b64e4);_0x36a9ff(_0x58562e[_0x8db2('0x18')](0x1f4,_0x5725f0[_0x8db2('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 7fc7a8d..820666f 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 _0xe63f=['openchannelMessage:','./openchannelMessage.events','remove','update','emit','removeListener'];(function(_0x109eb7,_0x102f08){var _0x299899=function(_0x5c50c5){while(--_0x5c50c5){_0x109eb7['push'](_0x109eb7['shift']());}};_0x299899(++_0x102f08);}(_0xe63f,0x163));var _0xfe63=function(_0xc8ddee,_0x251e0b){_0xc8ddee=_0xc8ddee-0x0;var _0x2daa9d=_0xe63f[_0xc8ddee];return _0x2daa9d;};'use strict';var OpenchannelMessageEvents=require(_0xfe63('0x0'));var events=['save',_0xfe63('0x1'),_0xfe63('0x2')];function createListener(_0xf8596e,_0x377d21){return function(_0x5e9051){_0x377d21[_0xfe63('0x3')](_0xf8596e,_0x5e9051);};}function removeListener(_0x25d703,_0x547609){return function(){OpenchannelMessageEvents[_0xfe63('0x4')](_0x25d703,_0x547609);};}exports['register']=function(_0x4bb882){for(var _0x5813a4=0x0,_0x3e60a2=events['length'];_0x5813a4<_0x3e60a2;_0x5813a4++){var _0x3f928b=events[_0x5813a4];var _0x47d18f=createListener(_0xfe63('0x5')+_0x3f928b,_0x4bb882);OpenchannelMessageEvents['on'](_0x3f928b,_0x47d18f);}}; \ No newline at end of file +var _0xe397=['remove','emit','register','length','./openchannelMessage.events','save'];(function(_0x176329,_0x568c84){var _0x31997c=function(_0x3d64df){while(--_0x3d64df){_0x176329['push'](_0x176329['shift']());}};_0x31997c(++_0x568c84);}(_0xe397,0xac));var _0x7e39=function(_0x58ac34,_0x5b5bfb){_0x58ac34=_0x58ac34-0x0;var _0x3921ab=_0xe397[_0x58ac34];return _0x3921ab;};'use strict';var OpenchannelMessageEvents=require(_0x7e39('0x0'));var events=[_0x7e39('0x1'),_0x7e39('0x2'),'update'];function createListener(_0x1382ff,_0x92070d){return function(_0x117826){_0x92070d[_0x7e39('0x3')](_0x1382ff,_0x117826);};}function removeListener(_0x2e5f77,_0x3ef9d0){return function(){OpenchannelMessageEvents['removeListener'](_0x2e5f77,_0x3ef9d0);};}exports[_0x7e39('0x4')]=function(_0x55b365){for(var _0x21e4df=0x0,_0x28ccef=events[_0x7e39('0x5')];_0x21e4df<_0x28ccef;_0x21e4df++){var _0x51bc8d=events[_0x21e4df];var _0x1262fe=createListener('openchannelMessage:'+_0x51bc8d,_0x55b365);OpenchannelMessageEvents['on'](_0x51bc8d,_0x1262fe);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index c78d375..4cb817c 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 _0xe815=['isAuthenticated','index','/describe','describe','/:id','/:id/members','getMembers','/:id/teams','/:id/users','post','addTeams','addAgents','put','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./openchannelQueue.controller','get'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0xe815,0x13a));var _0x5e81=function(_0x1b0edb,_0x4f7765){_0x1b0edb=_0x1b0edb-0x0;var _0x5d186f=_0xe815[_0x1b0edb];return _0x5d186f;};'use strict';var multer=require(_0x5e81('0x0'));var util=require(_0x5e81('0x1'));var path=require(_0x5e81('0x2'));var timeout=require(_0x5e81('0x3'));var express=require(_0x5e81('0x4'));var router=express[_0x5e81('0x5')]();var fs_extra=require(_0x5e81('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5e81('0x7'));var controller=require(_0x5e81('0x8'));router[_0x5e81('0x9')]('/',auth[_0x5e81('0xa')](),controller[_0x5e81('0xb')]);router[_0x5e81('0x9')](_0x5e81('0xc'),auth[_0x5e81('0xa')](),controller[_0x5e81('0xd')]);router[_0x5e81('0x9')](_0x5e81('0xe'),auth[_0x5e81('0xa')](),controller['show']);router[_0x5e81('0x9')](_0x5e81('0xf'),auth[_0x5e81('0xa')](),controller[_0x5e81('0x10')]);router['get'](_0x5e81('0x11'),auth[_0x5e81('0xa')](),controller['getTeams']);router[_0x5e81('0x9')](_0x5e81('0x12'),auth[_0x5e81('0xa')](),controller['getAgents']);router[_0x5e81('0x13')]('/',auth[_0x5e81('0xa')](),controller['create']);router['post']('/:id/teams',auth[_0x5e81('0xa')](),controller[_0x5e81('0x14')]);router[_0x5e81('0x13')](_0x5e81('0x12'),auth['isAuthenticated'](),controller[_0x5e81('0x15')]);router[_0x5e81('0x16')](_0x5e81('0xe'),auth[_0x5e81('0xa')](),controller['update']);router[_0x5e81('0x17')](_0x5e81('0xe'),auth[_0x5e81('0xa')](),controller[_0x5e81('0x18')]);router[_0x5e81('0x17')](_0x5e81('0x11'),auth['isAuthenticated'](),controller['removeTeams']);router['delete']('/:id/users',auth[_0x5e81('0xa')](),controller[_0x5e81('0x19')]);module[_0x5e81('0x1a')]=router; \ No newline at end of file +var _0xd7cc=['multer','util','path','express','../../components/auth/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','describe','show','/:id/members','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams','addAgents','put','/:id','update','destroy','delete','removeAgents','exports'];(function(_0x4d353b,_0x383c10){var _0x1f11f9=function(_0x2f6a2b){while(--_0x2f6a2b){_0x4d353b['push'](_0x4d353b['shift']());}};_0x1f11f9(++_0x383c10);}(_0xd7cc,0x134));var _0xcd7c=function(_0x4543f4,_0xa0e0fb){_0x4543f4=_0x4543f4-0x0;var _0x556cf7=_0xd7cc[_0x4543f4];return _0x556cf7;};'use strict';var multer=require(_0xcd7c('0x0'));var util=require(_0xcd7c('0x1'));var path=require(_0xcd7c('0x2'));var timeout=require('connect-timeout');var express=require(_0xcd7c('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xcd7c('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xcd7c('0x5'));var controller=require(_0xcd7c('0x6'));router[_0xcd7c('0x7')]('/',auth[_0xcd7c('0x8')](),controller[_0xcd7c('0x9')]);router[_0xcd7c('0x7')]('/describe',auth[_0xcd7c('0x8')](),controller[_0xcd7c('0xa')]);router[_0xcd7c('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xcd7c('0xb')]);router[_0xcd7c('0x7')](_0xcd7c('0xc'),auth[_0xcd7c('0x8')](),controller['getMembers']);router['get']('/:id/teams',auth[_0xcd7c('0x8')](),controller[_0xcd7c('0xd')]);router[_0xcd7c('0x7')](_0xcd7c('0xe'),auth[_0xcd7c('0x8')](),controller[_0xcd7c('0xf')]);router[_0xcd7c('0x10')]('/',auth[_0xcd7c('0x8')](),controller[_0xcd7c('0x11')]);router[_0xcd7c('0x10')](_0xcd7c('0x12'),auth[_0xcd7c('0x8')](),controller[_0xcd7c('0x13')]);router[_0xcd7c('0x10')](_0xcd7c('0xe'),auth[_0xcd7c('0x8')](),controller[_0xcd7c('0x14')]);router[_0xcd7c('0x15')](_0xcd7c('0x16'),auth[_0xcd7c('0x8')](),controller[_0xcd7c('0x17')]);router['delete'](_0xcd7c('0x16'),auth[_0xcd7c('0x8')](),controller[_0xcd7c('0x18')]);router['delete'](_0xcd7c('0x12'),auth['isAuthenticated'](),controller['removeTeams']);router[_0xcd7c('0x19')](_0xcd7c('0xe'),auth[_0xcd7c('0x8')](),controller[_0xcd7c('0x1a')]);module[_0xcd7c('0x1b')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index fd00c50..e57cf15 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 _0x6bab=['STRING','ENUM','rrmemory','sequelize','exports'];(function(_0x499cbf,_0x353dac){var _0x2ed63a=function(_0x5ad634){while(--_0x5ad634){_0x499cbf['push'](_0x499cbf['shift']());}};_0x2ed63a(++_0x353dac);}(_0x6bab,0x1b6));var _0xb6ba=function(_0x34aec4,_0x3801da){_0x34aec4=_0x34aec4-0x0;var _0x51e1a7=_0x6bab[_0x34aec4];return _0x51e1a7;};'use strict';var Sequelize=require(_0xb6ba('0x0'));module[_0xb6ba('0x1')]={'name':{'type':Sequelize[_0xb6ba('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xb6ba('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb6ba('0x3')](_0xb6ba('0x4'),'beepall','roundrobin')}}; \ No newline at end of file +var _0x4a8c=['name','INTEGER','ENUM','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x5488cc,_0x57b187){var _0xa8962e=function(_0x4be4d5){while(--_0x4be4d5){_0x5488cc['push'](_0x5488cc['shift']());}};_0xa8962e(++_0x57b187);}(_0x4a8c,0xf5));var _0xc4a8=function(_0x29d0b0,_0x3c64df){_0x29d0b0=_0x29d0b0-0x0;var _0x482479=_0x4a8c[_0x29d0b0];return _0x482479;};'use strict';var Sequelize=require(_0xc4a8('0x0'));module[_0xc4a8('0x1')]={'name':{'type':Sequelize[_0xc4a8('0x2')],'unique':_0xc4a8('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc4a8('0x2')]},'timeout':{'type':Sequelize[_0xc4a8('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc4a8('0x5')]('rrmemory',_0xc4a8('0x6'),_0xc4a8('0x7'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index eb6204d..989b6f6 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 _0x1351=['../../components/parsers/qs','../../config/logger','api','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./openchannelQueue.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','get','OpenchannelQueues','UserProfileResource','error','name','send','index','map','OpenchannelQueue','fieldName','type','key','getOptions','where','then','include','findAll','catch','params','model','rawAttributes','query','filters','intersection','attributes','fields','length','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','keys','UserOpenchannelQueue','hasOwnProperty','nolimit','order','pick','filter','merge','User','findAndCountAll','UserId','openchannelPause','rows','%s/%s','SIP','updatedAt','getTeams','findOne','sort','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','Team','select','field','tq.TeamId','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','compact','value','isEmpty','removeAgents','userOpenchannelQueue:remove','omit','spread','isArray','getAgents','bluebird','util','lodash','squel','ioredis'];(function(_0x3a7a9c,_0x24f7d6){var _0x59156e=function(_0x5bc930){while(--_0x5bc930){_0x3a7a9c['push'](_0x3a7a9c['shift']());}};_0x59156e(++_0x24f7d6);}(_0x1351,0xf5));var _0x1135=function(_0x173b05,_0x381418){_0x173b05=_0x173b05-0x0;var _0x105c54=_0x1351[_0x173b05];return _0x105c54;};'use strict';var BPromise=require(_0x1135('0x0'));var util=require(_0x1135('0x1'));var _=require(_0x1135('0x2'));var squel=require(_0x1135('0x3'));var Redis=require(_0x1135('0x4'));var qs=require(_0x1135('0x5'));var logger=require(_0x1135('0x6'))(_0x1135('0x7'));var config=require('../../config/environment');var db=require(_0x1135('0x8'))['db'];config['redis']=_[_0x1135('0x9')](config['redis'],{'host':_0x1135('0xa'),'port':0x18eb});var socket=require(_0x1135('0xb'))(new Redis(config[_0x1135('0xc')]));require(_0x1135('0xd'))[_0x1135('0xe')](socket);function respondWithStatusCode(_0x458876,_0x4fd5c0){_0x4fd5c0=_0x4fd5c0||0xcc;return function(_0x46f3f1){if(_0x46f3f1){return _0x458876[_0x1135('0xf')](_0x4fd5c0);}return _0x458876['status'](_0x4fd5c0)[_0x1135('0x10')]();};}function respondWithResult(_0x289035,_0x29a569){_0x29a569=_0x29a569||0xc8;return function(_0x42ea65){if(_0x42ea65){return _0x289035[_0x1135('0x11')](_0x29a569)[_0x1135('0x12')](_0x42ea65);}};}function respondWithFilteredResult(_0x2be0c5,_0x563c71){return function(_0x397133){if(_0x397133){var _0x5cca43=typeof _0x563c71[_0x1135('0x13')]===_0x1135('0x14')&&typeof _0x563c71[_0x1135('0x15')]===_0x1135('0x14');var _0x4c7f33=_0x397133[_0x1135('0x16')];var _0x4fe4d7=_0x5cca43?0x0:_0x563c71[_0x1135('0x13')];var _0x5d4fbf=_0x5cca43?_0x397133[_0x1135('0x16')]:_0x563c71[_0x1135('0x13')]+_0x563c71['limit'];var _0x44020e;if(_0x5d4fbf>=_0x4c7f33){_0x5d4fbf=_0x4c7f33;_0x44020e=0xc8;}else{_0x44020e=0xce;}_0x2be0c5[_0x1135('0x11')](_0x44020e);return _0x2be0c5[_0x1135('0x17')](_0x1135('0x18'),_0x4fe4d7+'-'+_0x5d4fbf+'/'+_0x4c7f33)[_0x1135('0x12')](_0x397133);}return null;};}function saveUpdates(_0x3a9f17){return function(_0x44e933){if(_0x44e933){return _0x44e933[_0x1135('0x19')](_0x3a9f17)['then'](function(_0x58b8dd){return _0x58b8dd;});}return null;};}function removeEntity(_0x5dc772){return function(_0x29af3d){if(_0x29af3d){return _0x29af3d[_0x1135('0x1a')]()['then'](function(){var _0x3ef47c=_0x29af3d[_0x1135('0x1b')]({'plain':!![]});var _0x577f03=_0x1135('0x1c');return db[_0x1135('0x1d')][_0x1135('0x1a')]({'where':{'type':_0x577f03,'resourceId':_0x3ef47c['id']}})['then'](function(){return _0x29af3d;});})['then'](function(){_0x5dc772[_0x1135('0x11')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1bba3e){return function(_0x3d4d5d){if(!_0x3d4d5d){_0x1bba3e[_0x1135('0xf')](0x194);}return _0x3d4d5d;};}function handleError(_0x38755e,_0x4728de){_0x4728de=_0x4728de||0x1f4;return function(_0x117447){logger[_0x1135('0x1e')](_0x117447['stack']);if(_0x117447[_0x1135('0x1f')]){delete _0x117447[_0x1135('0x1f')];}_0x38755e['status'](_0x4728de)[_0x1135('0x20')](_0x117447);};}exports[_0x1135('0x21')]=function(_0x104a3f,_0x45cb64){var _0x247b91={};var _0x17239e={'count':0x0,'rows':[]};var _0x5eac92=_[_0x1135('0x22')](db[_0x1135('0x23')]['rawAttributes'],function(_0x23da0a){return{'name':_0x23da0a[_0x1135('0x24')],'type':_0x23da0a[_0x1135('0x25')][_0x1135('0x26')]};});_0x247b91=qs[_0x1135('0x27')](_0x5eac92,_0x104a3f);var _0x3c75ba={'where':_0x247b91[_0x1135('0x28')]};return db[_0x1135('0x23')][_0x1135('0x16')](_0x3c75ba)[_0x1135('0x29')](function(_0x5299b6){_0x17239e[_0x1135('0x16')]=_0x5299b6;_0x247b91[_0x1135('0x2a')]=qs[_0x1135('0x2a')](_0x104a3f['query']);return db[_0x1135('0x23')][_0x1135('0x2b')](_0x247b91);})[_0x1135('0x29')](function(_0x8dbf1b){_0x17239e['rows']=_0x8dbf1b;return _0x17239e;})[_0x1135('0x29')](respondWithFilteredResult(_0x45cb64,_0x247b91))[_0x1135('0x2c')](handleError(_0x45cb64,null));};exports['show']=function(_0x1043d8,_0x260d33){var _0x1399bf={'raw':!![],'where':{'id':_0x1043d8[_0x1135('0x2d')]['id']}},_0x3fd34e={};_0x3fd34e[_0x1135('0x2e')]=_['keys'](db[_0x1135('0x23')][_0x1135('0x2f')]);_0x3fd34e['query']=_['keys'](_0x1043d8[_0x1135('0x30')]);_0x3fd34e[_0x1135('0x31')]=_[_0x1135('0x32')](_0x3fd34e[_0x1135('0x2e')],_0x3fd34e[_0x1135('0x30')]);_0x1399bf[_0x1135('0x33')]=_[_0x1135('0x32')](_0x3fd34e[_0x1135('0x2e')],qs[_0x1135('0x34')](_0x1043d8[_0x1135('0x30')]['fields']));_0x1399bf[_0x1135('0x33')]=_0x1399bf['attributes'][_0x1135('0x35')]?_0x1399bf[_0x1135('0x33')]:_0x3fd34e['model'];if(_0x1043d8['query']['includeAll']){_0x1399bf['include']=[{'all':!![]}];}_0x1399bf=_['merge']({},_0x1399bf,_0x1043d8[_0x1135('0x36')]);return db[_0x1135('0x23')][_0x1135('0x37')](_0x1399bf)[_0x1135('0x29')](handleEntityNotFound(_0x260d33,null))[_0x1135('0x29')](respondWithResult(_0x260d33,null))[_0x1135('0x2c')](handleError(_0x260d33,null));};exports[_0x1135('0x38')]=function(_0x44bfd4,_0x7a9594){return db[_0x1135('0x23')][_0x1135('0x38')](_0x44bfd4['body'],{})[_0x1135('0x29')](function(_0x2574bc){var _0x4e8d7f=_0x44bfd4[_0x1135('0x39')][_0x1135('0x1b')]({'plain':!![]});if(!_0x4e8d7f)throw new Error(_0x1135('0x3a'));if(_0x4e8d7f[_0x1135('0x3b')]===_0x1135('0x39')){var _0x496c1a=_0x2574bc[_0x1135('0x1b')]({'plain':!![]});var _0xaa34c2=_0x1135('0x1c');return db[_0x1135('0x3c')]['find']({'where':{'name':_0xaa34c2,'userProfileId':_0x4e8d7f[_0x1135('0x3d')]},'raw':!![]})['then'](function(_0x13756c){if(_0x13756c&&_0x13756c[_0x1135('0x3e')]===0x0){return db[_0x1135('0x1d')][_0x1135('0x38')]({'name':_0x496c1a[_0x1135('0x1f')],'resourceId':_0x496c1a['id'],'type':_0x13756c[_0x1135('0x1f')],'sectionId':_0x13756c['id']},{})['then'](function(){return _0x2574bc;});}else{return _0x2574bc;}})[_0x1135('0x2c')](function(_0x17ce6){logger['error'](_0x1135('0x3f'),_0x17ce6);throw _0x17ce6;});}return _0x2574bc;})['then'](respondWithResult(_0x7a9594,0xc9))[_0x1135('0x2c')](handleError(_0x7a9594,null));};exports[_0x1135('0x19')]=function(_0x37add6,_0x4beb71){if(_0x37add6[_0x1135('0x40')]['id']){delete _0x37add6[_0x1135('0x40')]['id'];}return db[_0x1135('0x23')][_0x1135('0x37')]({'where':{'id':_0x37add6[_0x1135('0x2d')]['id']}})[_0x1135('0x29')](handleEntityNotFound(_0x4beb71,null))[_0x1135('0x29')](saveUpdates(_0x37add6[_0x1135('0x40')],null))[_0x1135('0x29')](respondWithResult(_0x4beb71,null))['catch'](handleError(_0x4beb71,null));};exports[_0x1135('0x1a')]=function(_0x40ce22,_0xda0a52){return db[_0x1135('0x23')][_0x1135('0x37')]({'where':{'id':_0x40ce22[_0x1135('0x2d')]['id']}})[_0x1135('0x29')](handleEntityNotFound(_0xda0a52,null))[_0x1135('0x29')](removeEntity(_0xda0a52,null))[_0x1135('0x2c')](handleError(_0xda0a52,null));};exports[_0x1135('0x41')]=function(_0x242c44,_0x45d1aa){return db[_0x1135('0x23')]['describe']()[_0x1135('0x29')](respondWithResult(_0x45d1aa,null))[_0x1135('0x2c')](handleError(_0x45d1aa,null));};exports[_0x1135('0x42')]=function(_0x48f00c,_0x315314){var _0x373354={'raw':!![],'where':{}},_0x30c78c={},_0x4efe08;return db[_0x1135('0x23')]['findOne']({'where':{'id':_0x48f00c[_0x1135('0x2d')]['id']}})['then'](handleEntityNotFound(_0x315314,null))['then'](function(_0xd49f8a){if(_0xd49f8a){_0x4efe08=_0xd49f8a['get']({'plain':!![]});_0x30c78c['model']=_[_0x1135('0x43')](db[_0x1135('0x44')]['rawAttributes']);_0x30c78c[_0x1135('0x30')]=_['keys'](_0x48f00c[_0x1135('0x30')]);_0x30c78c[_0x1135('0x31')]=_[_0x1135('0x32')](_0x30c78c[_0x1135('0x2e')],_0x30c78c[_0x1135('0x30')]);_0x373354[_0x1135('0x33')]=_['intersection'](_0x30c78c[_0x1135('0x2e')],qs[_0x1135('0x34')](_0x48f00c['query'][_0x1135('0x34')]));_0x373354[_0x1135('0x33')]=_0x373354[_0x1135('0x33')][_0x1135('0x35')]?_0x373354[_0x1135('0x33')]:_0x30c78c['model'];if(!_0x48f00c[_0x1135('0x30')][_0x1135('0x45')](_0x1135('0x46'))){_0x373354['limit']=qs['limit'](_0x48f00c[_0x1135('0x30')]['limit']);_0x373354[_0x1135('0x13')]=qs[_0x1135('0x13')](_0x48f00c[_0x1135('0x30')]['offset']);}_0x373354[_0x1135('0x47')]=qs['sort'](_0x48f00c[_0x1135('0x30')]['sort']);_0x373354[_0x1135('0x28')]=qs[_0x1135('0x31')](_[_0x1135('0x48')](_0x48f00c[_0x1135('0x30')],_0x30c78c[_0x1135('0x31')]));_0x373354['where']['OpenchannelQueueId']=_0xd49f8a['id'];if(_0x48f00c[_0x1135('0x30')][_0x1135('0x49')]){_0x373354['where']=_[_0x1135('0x4a')](_0x373354[_0x1135('0x28')],{'$or':_[_0x1135('0x22')](_0x373354[_0x1135('0x33')],function(_0x43d2cb){var _0x2ab869={};_0x2ab869[_0x43d2cb]={'$like':'%'+_0x48f00c[_0x1135('0x30')][_0x1135('0x49')]+'%'};return _0x2ab869;})});}_0x373354=_['merge']({},_0x373354,_0x48f00c[_0x1135('0x36')]);return db[_0x1135('0x44')][_0x1135('0x2b')](_0x373354);}})[_0x1135('0x29')](function(_0x2451d3){if(_0x2451d3){return db[_0x1135('0x4b')][_0x1135('0x4c')]({'where':{'id':_[_0x1135('0x22')](_0x2451d3,_0x1135('0x4d')),'role':'agent'},'attributes':['id',_0x1135('0x1f'),_0x1135('0x4e'),'updatedAt','createdAt']});}})['then'](function(_0x3bae0a){if(_0x3bae0a){return{'count':_0x3bae0a['count'],'rows':_['map'](_0x3bae0a[_0x1135('0x4f')],function(_0x8d3223){return{'membername':_0x8d3223[_0x1135('0x1f')],'UserId':_0x8d3223['id'],'queue_name':_0x4efe08['name'],'OpenchannelQueueId':_0x4efe08['id'],'interface':util['format'](_0x1135('0x50'),_0x1135('0x51'),_0x8d3223['name']),'penalty':0x0,'paused':_0x8d3223[_0x1135('0x4e')],'createdAt':_0x8d3223['createdAt'],'updatedAt':_0x8d3223[_0x1135('0x52')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x1135('0x29')](respondWithFilteredResult(_0x315314,_0x373354))[_0x1135('0x2c')](handleError(_0x315314,null));};exports[_0x1135('0x53')]=function(_0x10810f,_0x1a3ba7){var _0x67e477={};var _0x58d79d={};var _0x476ea6;var _0x2f179f;return db['OpenchannelQueue'][_0x1135('0x54')]({'where':{'id':_0x10810f[_0x1135('0x2d')]['id']}})[_0x1135('0x29')](handleEntityNotFound(_0x1a3ba7,null))[_0x1135('0x29')](function(_0xa7fbb2){if(_0xa7fbb2){_0x476ea6=_0xa7fbb2;_0x58d79d['model']=_[_0x1135('0x43')](db['Team']['rawAttributes']);_0x58d79d[_0x1135('0x30')]=_[_0x1135('0x43')](_0x10810f[_0x1135('0x30')]);_0x58d79d[_0x1135('0x31')]=_[_0x1135('0x32')](_0x58d79d[_0x1135('0x2e')],_0x58d79d[_0x1135('0x30')]);_0x67e477['attributes']=_[_0x1135('0x32')](_0x58d79d['model'],qs[_0x1135('0x34')](_0x10810f[_0x1135('0x30')][_0x1135('0x34')]));_0x67e477['attributes']=_0x67e477[_0x1135('0x33')][_0x1135('0x35')]?_0x67e477['attributes']:_0x58d79d['model'];_0x67e477[_0x1135('0x47')]=qs[_0x1135('0x55')](_0x10810f['query'][_0x1135('0x55')]);_0x67e477[_0x1135('0x28')]=qs[_0x1135('0x31')](_[_0x1135('0x48')](_0x10810f['query'],_0x58d79d[_0x1135('0x31')]));if(_0x10810f['query'][_0x1135('0x49')]){_0x67e477['where']=_[_0x1135('0x4a')](_0x67e477['where'],{'$or':_[_0x1135('0x22')](_0x67e477['attributes'],function(_0x382fe5){var _0x164808={};_0x164808[_0x382fe5]={'$like':'%'+_0x10810f[_0x1135('0x30')][_0x1135('0x49')]+'%'};return _0x164808;})});}_0x67e477=_[_0x1135('0x4a')]({},_0x67e477,_0x10810f[_0x1135('0x36')]);return _0x476ea6[_0x1135('0x53')](_0x67e477);}})[_0x1135('0x29')](function(_0x568b82){if(_0x568b82){_0x2f179f=_0x568b82[_0x1135('0x35')];if(!_0x10810f['query'][_0x1135('0x45')](_0x1135('0x46'))){_0x67e477[_0x1135('0x15')]=qs[_0x1135('0x15')](_0x10810f[_0x1135('0x30')][_0x1135('0x15')]);_0x67e477[_0x1135('0x13')]=qs[_0x1135('0x13')](_0x10810f['query'][_0x1135('0x13')]);}return _0x476ea6[_0x1135('0x53')](_0x67e477);}})[_0x1135('0x29')](function(_0xb1b1fa){if(_0xb1b1fa){return _0xb1b1fa?{'count':_0x2f179f,'rows':_0xb1b1fa}:null;}})[_0x1135('0x29')](respondWithResult(_0x1a3ba7,null))[_0x1135('0x2c')](handleError(_0x1a3ba7,null));};exports[_0x1135('0x56')]=function(_0x1a753a,_0x10db4b){var _0x477003=_0x1a753a[_0x1135('0x40')][_0x1135('0x57')];return db['Team'][_0x1135('0x2b')]({'where':{'id':_0x477003},'attributes':['id'],'include':[{'model':db['User'],'as':_0x1135('0x58'),'attributes':['id',_0x1135('0x1f'),_0x1135('0x59'),_0x1135('0x5a'),_0x1135('0x5b')],'raw':!![]}]})[_0x1135('0x29')](function(_0x53f72d){if(_0x53f72d){var _0x241798=_[_0x1135('0x5c')](_0x53f72d,function(_0x25467){var _0x20358e=_0x25467['get']({'plain':!![]});return _0x20358e[_0x1135('0x58')];});return db[_0x1135('0x23')][_0x1135('0x37')]({'where':{'id':_0x1a753a[_0x1135('0x2d')]['id']}})['then'](function(_0x2ee307){return db[_0x1135('0x5d')][_0x1135('0x5e')](function(_0x286883){return _0x2ee307['addTeams'](_0x477003,{'transaction':_0x286883})[_0x1135('0x29')](function(){return BPromise[_0x1135('0x5f')](_0x241798,function(_0x4b0268){return db[_0x1135('0x44')][_0x1135('0x60')]({'where':{'UserId':_0x4b0268['id'],'OpenchannelQueueId':_0x1a753a[_0x1135('0x2d')]['id']},'transaction':_0x286883});});})[_0x1135('0x29')](function(){_0x241798[_0x1135('0x61')](function(_0x33c93e){socket[_0x1135('0x62')](_0x1135('0x63'),{'UserId':_0x33c93e['id'],'OpenchannelQueueId':_0x2ee307['id']});});});});});}})[_0x1135('0x29')](respondWithStatusCode(_0x10db4b,null))[_0x1135('0x2c')](handleError(_0x10db4b,null));};exports[_0x1135('0x64')]=function(_0x1e7738,_0x1c6086){return db[_0x1135('0x65')][_0x1135('0x2b')]({'where':{'id':_0x1e7738[_0x1135('0x30')][_0x1135('0x57')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x1135('0x58'),'attributes':['id'],'raw':!![]}]})[_0x1135('0x29')](handleEntityNotFound(_0x1c6086,null))[_0x1135('0x29')](function(_0x2d456b){var _0x5c3412=_[_0x1135('0x22')](_0x2d456b,'id');var _0x2364ac=[];var _0x3fa039=[];var _0xd71b8b=squel[_0x1135('0x66')]();_0xd71b8b[_0x1135('0x67')](_0x1135('0x68'))['from']('team_has_openchannel_queues','tq')[_0x1135('0x69')](_0x1135('0x6a'),'ut',_0x1135('0x6b'))[_0x1135('0x28')](_0x1135('0x6c'),_0x1e7738[_0x1135('0x2d')]['id']);for(var _0x1163dc=0x0;_0x1163dc<_0x2d456b['length'];_0x1163dc+=0x1){let _0x55b80d=_0x2d456b[_0x1163dc];for(var _0x24a2bf=0x0;_0x24a2bf<_0x55b80d[_0x1135('0x58')][_0x1135('0x35')];_0x24a2bf+=0x1){let _0x251b7e=_0x55b80d[_0x1135('0x58')][_0x24a2bf];var _0x4ede1b=_0xd71b8b[_0x1135('0x6d')]();_0x4ede1b[_0x1135('0x28')](_0x1135('0x6e'),_0x251b7e['id']);_0x3fa039[_0x1135('0x6f')](db['sequelize']['query'](_0x4ede1b['toString'](),{'type':db[_0x1135('0x5d')][_0x1135('0x70')][_0x1135('0x71')]})[_0x1135('0x29')](function(_0x238637){if(_0x238637[_0x1135('0x35')]===0x1){return _0x251b7e['id'];}else{var _0x50c709=_[_0x1135('0x72')](_[_0x1135('0x22')](_0x238637,_0x1135('0x73')),function(_0x21814c){return _['includes'](_0x5c3412,_0x21814c);});if(_0x50c709){return _0x251b7e['id'];}}}));}}return BPromise['all'](_0x3fa039)[_0x1135('0x29')](function(_0x2ca936){_0x2364ac=_(_0x2364ac)['union'](_0x2ca936)[_0x1135('0x74')]()[_0x1135('0x75')]();return db['OpenchannelQueue'][_0x1135('0x37')]({'where':{'id':_0x1e7738['params']['id']}})[_0x1135('0x29')](function(_0x4bff31){return db[_0x1135('0x5d')][_0x1135('0x5e')](function(_0xb76f2a){return _0x4bff31[_0x1135('0x64')](_0x1e7738[_0x1135('0x30')]['ids'],{'transaction':_0xb76f2a})[_0x1135('0x29')](function(){if(!_[_0x1135('0x76')](_0x2364ac)){return _0x4bff31[_0x1135('0x77')](_0x2364ac,{'transaction':_0xb76f2a});}})['then'](function(){_0x2364ac['forEach'](function(_0x220005){socket[_0x1135('0x62')](_0x1135('0x78'),{'UserId':_0x220005,'OpenchannelQueueId':_0x4bff31['id']});});});});});});})[_0x1135('0x29')](respondWithStatusCode(_0x1c6086,null))['catch'](handleError(_0x1c6086,null));};exports['addAgents']=function(_0x567fa1,_0x2bb788){return db[_0x1135('0x23')]['find']({'where':{'id':_0x567fa1[_0x1135('0x2d')]['id']}})[_0x1135('0x29')](handleEntityNotFound(_0x2bb788,null))['then'](function(_0x193484){if(_0x193484){return _0x193484['addAgents'](_0x567fa1[_0x1135('0x40')][_0x1135('0x57')],_[_0x1135('0x79')](_0x567fa1[_0x1135('0x40')],[_0x1135('0x57'),'id'])||{})[_0x1135('0x7a')](function(_0x31812a){for(var _0x4d0d91=0x0;_0x4d0d91<_0x567fa1['body']['ids']['length'];_0x4d0d91+=0x1){socket[_0x1135('0x62')](_0x1135('0x63'),{'UserId':Number(_0x567fa1[_0x1135('0x40')][_0x1135('0x57')][_0x4d0d91]),'OpenchannelQueueId':Number(_0x567fa1['params']['id'])});}return _0x31812a;});}})[_0x1135('0x29')](respondWithResult(_0x2bb788,null))[_0x1135('0x2c')](handleError(_0x2bb788,null));};exports[_0x1135('0x77')]=function(_0x28f3f0,_0x16373b){return db['OpenchannelQueue'][_0x1135('0x37')]({'where':{'id':_0x28f3f0['params']['id']}})[_0x1135('0x29')](handleEntityNotFound(_0x16373b,null))[_0x1135('0x29')](function(_0x1ed1bd){if(_0x1ed1bd){return _0x1ed1bd[_0x1135('0x77')](_0x28f3f0[_0x1135('0x30')][_0x1135('0x57')])['then'](function(){if(_[_0x1135('0x7b')](_0x28f3f0[_0x1135('0x30')][_0x1135('0x57')])){for(var _0xcb5cf5=0x0;_0xcb5cf5<_0x28f3f0[_0x1135('0x30')]['ids']['length'];_0xcb5cf5+=0x1){socket[_0x1135('0x62')](_0x1135('0x78'),{'UserId':Number(_0x28f3f0[_0x1135('0x30')]['ids'][_0xcb5cf5]),'OpenchannelQueueId':Number(_0x28f3f0['params']['id'])});}}else{socket[_0x1135('0x62')](_0x1135('0x78'),{'UserId':Number(_0x28f3f0[_0x1135('0x30')][_0x1135('0x57')]),'OpenchannelQueueId':Number(_0x28f3f0['params']['id'])});}});}})[_0x1135('0x29')](respondWithStatusCode(_0x16373b,null))[_0x1135('0x2c')](handleError(_0x16373b,null));};exports[_0x1135('0x7c')]=function(_0x3d6a3a,_0x1810a3){var _0x1aacc4={};var _0x357200={};var _0x544ad7;var _0x4d7ed0;return db[_0x1135('0x23')][_0x1135('0x54')]({'where':{'id':_0x3d6a3a['params']['id']}})[_0x1135('0x29')](handleEntityNotFound(_0x1810a3,null))[_0x1135('0x29')](function(_0x316850){if(_0x316850){_0x544ad7=_0x316850;_0x357200['model']=_[_0x1135('0x43')](db[_0x1135('0x4b')][_0x1135('0x2f')]);_0x357200[_0x1135('0x30')]=_[_0x1135('0x43')](_0x3d6a3a[_0x1135('0x30')]);_0x357200['filters']=_['intersection'](_0x357200[_0x1135('0x2e')],_0x357200[_0x1135('0x30')]);_0x1aacc4[_0x1135('0x33')]=_[_0x1135('0x32')](_0x357200[_0x1135('0x2e')],qs['fields'](_0x3d6a3a[_0x1135('0x30')][_0x1135('0x34')]));_0x1aacc4[_0x1135('0x33')]=_0x1aacc4['attributes'][_0x1135('0x35')]?_0x1aacc4['attributes']:_0x357200[_0x1135('0x2e')];_0x1aacc4[_0x1135('0x47')]=qs[_0x1135('0x55')](_0x3d6a3a[_0x1135('0x30')][_0x1135('0x55')]);_0x1aacc4[_0x1135('0x28')]=qs[_0x1135('0x31')](_[_0x1135('0x48')](_0x3d6a3a[_0x1135('0x30')],_0x357200[_0x1135('0x31')]));if(_0x3d6a3a['query']['filter']){_0x1aacc4[_0x1135('0x28')]=_['merge'](_0x1aacc4['where'],{'$or':_['map'](_0x1aacc4[_0x1135('0x33')],function(_0x6d4796){var _0x32bd13={};_0x32bd13[_0x6d4796]={'$like':'%'+_0x3d6a3a['query'][_0x1135('0x49')]+'%'};return _0x32bd13;})});}_0x1aacc4=_['merge']({},_0x1aacc4,_0x3d6a3a[_0x1135('0x36')]);return _0x544ad7[_0x1135('0x7c')](_0x1aacc4);}})['then'](function(_0x13b2a9){if(_0x13b2a9){_0x4d7ed0=_0x13b2a9[_0x1135('0x35')];if(!_0x3d6a3a[_0x1135('0x30')][_0x1135('0x45')]('nolimit')){_0x1aacc4[_0x1135('0x15')]=qs[_0x1135('0x15')](_0x3d6a3a[_0x1135('0x30')][_0x1135('0x15')]);_0x1aacc4[_0x1135('0x13')]=qs['offset'](_0x3d6a3a[_0x1135('0x30')][_0x1135('0x13')]);}return _0x544ad7['getAgents'](_0x1aacc4);}})[_0x1135('0x29')](function(_0x58bd9d){if(_0x58bd9d){return _0x58bd9d?{'count':_0x4d7ed0,'rows':_0x58bd9d}:null;}})[_0x1135('0x29')](respondWithResult(_0x1810a3,null))[_0x1135('0x2c')](handleError(_0x1810a3,null));}; \ No newline at end of file +var _0xcc1f=['lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelQueue.socket','register','status','end','json','undefined','limit','count','offset','Content-Range','update','then','get','OpenchannelQueues','UserProfileResource','stack','name','send','index','map','OpenchannelQueue','fieldName','key','getOptions','where','include','findAll','rows','catch','show','params','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','merge','options','find','create','body','role','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','nolimit','sort','pick','OpenchannelQueueId','filter','User','findAndCountAll','agent','openchannelPause','createdAt','format','SIP','updatedAt','getTeams','Team','hasOwnProperty','addTeams','ids','Agents','online','voicePause','interface','sequelize','transaction','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_openchannel_queues','join','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','push','toString','QueryTypes','every','TeamId','includes','union','value','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','getAgents','order','bluebird','util'];(function(_0xb99421,_0xaab133){var _0x4b3ec7=function(_0x591d1a){while(--_0x591d1a){_0xb99421['push'](_0xb99421['shift']());}};_0x4b3ec7(++_0xaab133);}(_0xcc1f,0x75));var _0xfcc1=function(_0x313f41,_0x17d6a0){_0x313f41=_0x313f41-0x0;var _0x41a004=_0xcc1f[_0x313f41];return _0x41a004;};'use strict';var BPromise=require(_0xfcc1('0x0'));var util=require(_0xfcc1('0x1'));var _=require(_0xfcc1('0x2'));var squel=require(_0xfcc1('0x3'));var Redis=require(_0xfcc1('0x4'));var qs=require(_0xfcc1('0x5'));var logger=require(_0xfcc1('0x6'))('api');var config=require(_0xfcc1('0x7'));var db=require(_0xfcc1('0x8'))['db'];config[_0xfcc1('0x9')]=_[_0xfcc1('0xa')](config[_0xfcc1('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xfcc1('0xb'))(new Redis(config[_0xfcc1('0x9')]));require(_0xfcc1('0xc'))[_0xfcc1('0xd')](socket);function respondWithStatusCode(_0x5eef3e,_0xe67d8b){_0xe67d8b=_0xe67d8b||0xcc;return function(_0x59813f){if(_0x59813f){return _0x5eef3e['sendStatus'](_0xe67d8b);}return _0x5eef3e[_0xfcc1('0xe')](_0xe67d8b)[_0xfcc1('0xf')]();};}function respondWithResult(_0x34b5d7,_0x335fdf){_0x335fdf=_0x335fdf||0xc8;return function(_0x2dd7a2){if(_0x2dd7a2){return _0x34b5d7[_0xfcc1('0xe')](_0x335fdf)[_0xfcc1('0x10')](_0x2dd7a2);}};}function respondWithFilteredResult(_0x3f69b3,_0x285150){return function(_0x1b30f6){if(_0x1b30f6){var _0x34b0b2=typeof _0x285150['offset']===_0xfcc1('0x11')&&typeof _0x285150[_0xfcc1('0x12')]===_0xfcc1('0x11');var _0x24c5da=_0x1b30f6[_0xfcc1('0x13')];var _0x1b7513=_0x34b0b2?0x0:_0x285150['offset'];var _0x174cc7=_0x34b0b2?_0x1b30f6['count']:_0x285150[_0xfcc1('0x14')]+_0x285150[_0xfcc1('0x12')];var _0x356813;if(_0x174cc7>=_0x24c5da){_0x174cc7=_0x24c5da;_0x356813=0xc8;}else{_0x356813=0xce;}_0x3f69b3[_0xfcc1('0xe')](_0x356813);return _0x3f69b3['set'](_0xfcc1('0x15'),_0x1b7513+'-'+_0x174cc7+'/'+_0x24c5da)[_0xfcc1('0x10')](_0x1b30f6);}return null;};}function saveUpdates(_0x4dde28){return function(_0x34bfeb){if(_0x34bfeb){return _0x34bfeb[_0xfcc1('0x16')](_0x4dde28)[_0xfcc1('0x17')](function(_0x1d0828){return _0x1d0828;});}return null;};}function removeEntity(_0x1a0bfd){return function(_0x315935){if(_0x315935){return _0x315935['destroy']()[_0xfcc1('0x17')](function(){var _0x1d748b=_0x315935[_0xfcc1('0x18')]({'plain':!![]});var _0x473ecf=_0xfcc1('0x19');return db[_0xfcc1('0x1a')]['destroy']({'where':{'type':_0x473ecf,'resourceId':_0x1d748b['id']}})[_0xfcc1('0x17')](function(){return _0x315935;});})[_0xfcc1('0x17')](function(){_0x1a0bfd['status'](0xcc)[_0xfcc1('0xf')]();});}};}function handleEntityNotFound(_0x57b7cf){return function(_0x3ab3bc){if(!_0x3ab3bc){_0x57b7cf['sendStatus'](0x194);}return _0x3ab3bc;};}function handleError(_0x4f568a,_0x577d66){_0x577d66=_0x577d66||0x1f4;return function(_0x26e37c){logger['error'](_0x26e37c[_0xfcc1('0x1b')]);if(_0x26e37c[_0xfcc1('0x1c')]){delete _0x26e37c['name'];}_0x4f568a[_0xfcc1('0xe')](_0x577d66)[_0xfcc1('0x1d')](_0x26e37c);};}exports[_0xfcc1('0x1e')]=function(_0xe3f3f7,_0x461cfa){var _0x12d91a={};var _0xd42149={'count':0x0,'rows':[]};var _0x500cb3=_[_0xfcc1('0x1f')](db[_0xfcc1('0x20')]['rawAttributes'],function(_0x15d2dc){return{'name':_0x15d2dc[_0xfcc1('0x21')],'type':_0x15d2dc['type'][_0xfcc1('0x22')]};});_0x12d91a=qs[_0xfcc1('0x23')](_0x500cb3,_0xe3f3f7);var _0x1daff0={'where':_0x12d91a[_0xfcc1('0x24')]};return db[_0xfcc1('0x20')][_0xfcc1('0x13')](_0x1daff0)[_0xfcc1('0x17')](function(_0x2bc897){_0xd42149['count']=_0x2bc897;_0x12d91a[_0xfcc1('0x25')]=qs[_0xfcc1('0x25')](_0xe3f3f7['query']);return db[_0xfcc1('0x20')][_0xfcc1('0x26')](_0x12d91a);})[_0xfcc1('0x17')](function(_0x48a724){_0xd42149[_0xfcc1('0x27')]=_0x48a724;return _0xd42149;})[_0xfcc1('0x17')](respondWithFilteredResult(_0x461cfa,_0x12d91a))[_0xfcc1('0x28')](handleError(_0x461cfa,null));};exports[_0xfcc1('0x29')]=function(_0x3a4d1e,_0x6fbc78){var _0x12a83c={'raw':!![],'where':{'id':_0x3a4d1e[_0xfcc1('0x2a')]['id']}},_0x5831a9={};_0x5831a9[_0xfcc1('0x2b')]=_[_0xfcc1('0x2c')](db['OpenchannelQueue'][_0xfcc1('0x2d')]);_0x5831a9[_0xfcc1('0x2e')]=_[_0xfcc1('0x2c')](_0x3a4d1e['query']);_0x5831a9[_0xfcc1('0x2f')]=_[_0xfcc1('0x30')](_0x5831a9[_0xfcc1('0x2b')],_0x5831a9[_0xfcc1('0x2e')]);_0x12a83c[_0xfcc1('0x31')]=_[_0xfcc1('0x30')](_0x5831a9[_0xfcc1('0x2b')],qs[_0xfcc1('0x32')](_0x3a4d1e[_0xfcc1('0x2e')]['fields']));_0x12a83c[_0xfcc1('0x31')]=_0x12a83c[_0xfcc1('0x31')][_0xfcc1('0x33')]?_0x12a83c['attributes']:_0x5831a9[_0xfcc1('0x2b')];if(_0x3a4d1e[_0xfcc1('0x2e')][_0xfcc1('0x34')]){_0x12a83c[_0xfcc1('0x25')]=[{'all':!![]}];}_0x12a83c=_[_0xfcc1('0x35')]({},_0x12a83c,_0x3a4d1e[_0xfcc1('0x36')]);return db['OpenchannelQueue'][_0xfcc1('0x37')](_0x12a83c)[_0xfcc1('0x17')](handleEntityNotFound(_0x6fbc78,null))[_0xfcc1('0x17')](respondWithResult(_0x6fbc78,null))[_0xfcc1('0x28')](handleError(_0x6fbc78,null));};exports[_0xfcc1('0x38')]=function(_0x59e141,_0x58b9ee){return db['OpenchannelQueue'][_0xfcc1('0x38')](_0x59e141[_0xfcc1('0x39')],{})['then'](function(_0x689582){var _0x33ee7a=_0x59e141['user'][_0xfcc1('0x18')]({'plain':!![]});if(!_0x33ee7a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x33ee7a[_0xfcc1('0x3a')]==='user'){var _0x5525f0=_0x689582[_0xfcc1('0x18')]({'plain':!![]});var _0x2d9464='OpenchannelQueues';return db['UserProfileSection'][_0xfcc1('0x37')]({'where':{'name':_0x2d9464,'userProfileId':_0x33ee7a[_0xfcc1('0x3b')]},'raw':!![]})['then'](function(_0x217f2e){if(_0x217f2e&&_0x217f2e['autoAssociation']===0x0){return db['UserProfileResource'][_0xfcc1('0x38')]({'name':_0x5525f0['name'],'resourceId':_0x5525f0['id'],'type':_0x217f2e[_0xfcc1('0x1c')],'sectionId':_0x217f2e['id']},{})['then'](function(){return _0x689582;});}else{return _0x689582;}})[_0xfcc1('0x28')](function(_0x379a07){logger[_0xfcc1('0x3c')](_0xfcc1('0x3d'),_0x379a07);throw _0x379a07;});}return _0x689582;})[_0xfcc1('0x17')](respondWithResult(_0x58b9ee,0xc9))['catch'](handleError(_0x58b9ee,null));};exports[_0xfcc1('0x16')]=function(_0x2a49ba,_0x13bc81){if(_0x2a49ba[_0xfcc1('0x39')]['id']){delete _0x2a49ba[_0xfcc1('0x39')]['id'];}return db[_0xfcc1('0x20')]['find']({'where':{'id':_0x2a49ba[_0xfcc1('0x2a')]['id']}})[_0xfcc1('0x17')](handleEntityNotFound(_0x13bc81,null))[_0xfcc1('0x17')](saveUpdates(_0x2a49ba[_0xfcc1('0x39')],null))[_0xfcc1('0x17')](respondWithResult(_0x13bc81,null))['catch'](handleError(_0x13bc81,null));};exports['destroy']=function(_0x213f8a,_0x51a7de){return db[_0xfcc1('0x20')]['find']({'where':{'id':_0x213f8a[_0xfcc1('0x2a')]['id']}})['then'](handleEntityNotFound(_0x51a7de,null))['then'](removeEntity(_0x51a7de,null))[_0xfcc1('0x28')](handleError(_0x51a7de,null));};exports[_0xfcc1('0x3e')]=function(_0x116c9b,_0x4b46fa){return db[_0xfcc1('0x20')][_0xfcc1('0x3e')]()['then'](respondWithResult(_0x4b46fa,null))['catch'](handleError(_0x4b46fa,null));};exports[_0xfcc1('0x3f')]=function(_0x474577,_0x1975f4){var _0x4d7726={'raw':!![],'where':{}},_0x1e6afb={},_0x1e6ba1;return db[_0xfcc1('0x20')][_0xfcc1('0x40')]({'where':{'id':_0x474577['params']['id']}})[_0xfcc1('0x17')](handleEntityNotFound(_0x1975f4,null))['then'](function(_0x209191){if(_0x209191){_0x1e6ba1=_0x209191['get']({'plain':!![]});_0x1e6afb['model']=_['keys'](db['UserOpenchannelQueue'][_0xfcc1('0x2d')]);_0x1e6afb['query']=_[_0xfcc1('0x2c')](_0x474577[_0xfcc1('0x2e')]);_0x1e6afb[_0xfcc1('0x2f')]=_[_0xfcc1('0x30')](_0x1e6afb[_0xfcc1('0x2b')],_0x1e6afb['query']);_0x4d7726[_0xfcc1('0x31')]=_[_0xfcc1('0x30')](_0x1e6afb[_0xfcc1('0x2b')],qs['fields'](_0x474577['query'][_0xfcc1('0x32')]));_0x4d7726[_0xfcc1('0x31')]=_0x4d7726['attributes']['length']?_0x4d7726[_0xfcc1('0x31')]:_0x1e6afb[_0xfcc1('0x2b')];if(!_0x474577['query']['hasOwnProperty'](_0xfcc1('0x41'))){_0x4d7726[_0xfcc1('0x12')]=qs[_0xfcc1('0x12')](_0x474577['query'][_0xfcc1('0x12')]);_0x4d7726[_0xfcc1('0x14')]=qs[_0xfcc1('0x14')](_0x474577[_0xfcc1('0x2e')][_0xfcc1('0x14')]);}_0x4d7726['order']=qs[_0xfcc1('0x42')](_0x474577['query'][_0xfcc1('0x42')]);_0x4d7726['where']=qs[_0xfcc1('0x2f')](_[_0xfcc1('0x43')](_0x474577['query'],_0x1e6afb[_0xfcc1('0x2f')]));_0x4d7726['where'][_0xfcc1('0x44')]=_0x209191['id'];if(_0x474577[_0xfcc1('0x2e')][_0xfcc1('0x45')]){_0x4d7726[_0xfcc1('0x24')]=_['merge'](_0x4d7726[_0xfcc1('0x24')],{'$or':_[_0xfcc1('0x1f')](_0x4d7726[_0xfcc1('0x31')],function(_0x559db7){var _0x406bc8={};_0x406bc8[_0x559db7]={'$like':'%'+_0x474577[_0xfcc1('0x2e')][_0xfcc1('0x45')]+'%'};return _0x406bc8;})});}_0x4d7726=_[_0xfcc1('0x35')]({},_0x4d7726,_0x474577[_0xfcc1('0x36')]);return db['UserOpenchannelQueue']['findAll'](_0x4d7726);}})[_0xfcc1('0x17')](function(_0xa78a88){if(_0xa78a88){return db[_0xfcc1('0x46')][_0xfcc1('0x47')]({'where':{'id':_['map'](_0xa78a88,'UserId'),'role':_0xfcc1('0x48')},'attributes':['id',_0xfcc1('0x1c'),_0xfcc1('0x49'),'updatedAt',_0xfcc1('0x4a')]});}})[_0xfcc1('0x17')](function(_0xff8bae){if(_0xff8bae){return{'count':_0xff8bae['count'],'rows':_[_0xfcc1('0x1f')](_0xff8bae[_0xfcc1('0x27')],function(_0x56aa16){return{'membername':_0x56aa16['name'],'UserId':_0x56aa16['id'],'queue_name':_0x1e6ba1[_0xfcc1('0x1c')],'OpenchannelQueueId':_0x1e6ba1['id'],'interface':util[_0xfcc1('0x4b')]('%s/%s',_0xfcc1('0x4c'),_0x56aa16[_0xfcc1('0x1c')]),'penalty':0x0,'paused':_0x56aa16[_0xfcc1('0x49')],'createdAt':_0x56aa16[_0xfcc1('0x4a')],'updatedAt':_0x56aa16[_0xfcc1('0x4d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xfcc1('0x17')](respondWithFilteredResult(_0x1975f4,_0x4d7726))[_0xfcc1('0x28')](handleError(_0x1975f4,null));};exports[_0xfcc1('0x4e')]=function(_0x36bcad,_0x118f64){var _0x2ac97f={};var _0x460b99={};var _0x2af6ae;var _0x250ed8;return db['OpenchannelQueue'][_0xfcc1('0x40')]({'where':{'id':_0x36bcad[_0xfcc1('0x2a')]['id']}})[_0xfcc1('0x17')](handleEntityNotFound(_0x118f64,null))[_0xfcc1('0x17')](function(_0x2b14ef){if(_0x2b14ef){_0x2af6ae=_0x2b14ef;_0x460b99[_0xfcc1('0x2b')]=_[_0xfcc1('0x2c')](db[_0xfcc1('0x4f')][_0xfcc1('0x2d')]);_0x460b99[_0xfcc1('0x2e')]=_[_0xfcc1('0x2c')](_0x36bcad['query']);_0x460b99[_0xfcc1('0x2f')]=_['intersection'](_0x460b99[_0xfcc1('0x2b')],_0x460b99[_0xfcc1('0x2e')]);_0x2ac97f[_0xfcc1('0x31')]=_[_0xfcc1('0x30')](_0x460b99[_0xfcc1('0x2b')],qs[_0xfcc1('0x32')](_0x36bcad[_0xfcc1('0x2e')][_0xfcc1('0x32')]));_0x2ac97f[_0xfcc1('0x31')]=_0x2ac97f[_0xfcc1('0x31')][_0xfcc1('0x33')]?_0x2ac97f[_0xfcc1('0x31')]:_0x460b99['model'];_0x2ac97f['order']=qs[_0xfcc1('0x42')](_0x36bcad[_0xfcc1('0x2e')]['sort']);_0x2ac97f[_0xfcc1('0x24')]=qs['filters'](_[_0xfcc1('0x43')](_0x36bcad[_0xfcc1('0x2e')],_0x460b99[_0xfcc1('0x2f')]));if(_0x36bcad[_0xfcc1('0x2e')][_0xfcc1('0x45')]){_0x2ac97f[_0xfcc1('0x24')]=_['merge'](_0x2ac97f['where'],{'$or':_['map'](_0x2ac97f['attributes'],function(_0x47a1f7){var _0x3db388={};_0x3db388[_0x47a1f7]={'$like':'%'+_0x36bcad['query'][_0xfcc1('0x45')]+'%'};return _0x3db388;})});}_0x2ac97f=_[_0xfcc1('0x35')]({},_0x2ac97f,_0x36bcad[_0xfcc1('0x36')]);return _0x2af6ae['getTeams'](_0x2ac97f);}})[_0xfcc1('0x17')](function(_0x282078){if(_0x282078){_0x250ed8=_0x282078[_0xfcc1('0x33')];if(!_0x36bcad[_0xfcc1('0x2e')][_0xfcc1('0x50')](_0xfcc1('0x41'))){_0x2ac97f[_0xfcc1('0x12')]=qs[_0xfcc1('0x12')](_0x36bcad[_0xfcc1('0x2e')][_0xfcc1('0x12')]);_0x2ac97f[_0xfcc1('0x14')]=qs[_0xfcc1('0x14')](_0x36bcad['query']['offset']);}return _0x2af6ae[_0xfcc1('0x4e')](_0x2ac97f);}})[_0xfcc1('0x17')](function(_0xc48dc7){if(_0xc48dc7){return _0xc48dc7?{'count':_0x250ed8,'rows':_0xc48dc7}:null;}})[_0xfcc1('0x17')](respondWithResult(_0x118f64,null))['catch'](handleError(_0x118f64,null));};exports[_0xfcc1('0x51')]=function(_0x2bd915,_0x13c701){var _0x1d538d=_0x2bd915[_0xfcc1('0x39')][_0xfcc1('0x52')];return db[_0xfcc1('0x4f')][_0xfcc1('0x26')]({'where':{'id':_0x1d538d},'attributes':['id'],'include':[{'model':db['User'],'as':_0xfcc1('0x53'),'attributes':['id','name',_0xfcc1('0x54'),_0xfcc1('0x55'),_0xfcc1('0x56')],'raw':!![]}]})[_0xfcc1('0x17')](function(_0x531e88){if(_0x531e88){var _0x421b83=_['flatMap'](_0x531e88,function(_0x46c0ed){var _0x366e61=_0x46c0ed[_0xfcc1('0x18')]({'plain':!![]});return _0x366e61[_0xfcc1('0x53')];});return db[_0xfcc1('0x20')][_0xfcc1('0x37')]({'where':{'id':_0x2bd915[_0xfcc1('0x2a')]['id']}})[_0xfcc1('0x17')](function(_0x33b0d7){return db[_0xfcc1('0x57')][_0xfcc1('0x58')](function(_0x23d90d){return _0x33b0d7[_0xfcc1('0x51')](_0x1d538d,{'transaction':_0x23d90d})[_0xfcc1('0x17')](function(){return BPromise[_0xfcc1('0x59')](_0x421b83,function(_0x53437a){return db['UserOpenchannelQueue'][_0xfcc1('0x5a')]({'where':{'UserId':_0x53437a['id'],'OpenchannelQueueId':_0x2bd915[_0xfcc1('0x2a')]['id']},'transaction':_0x23d90d});});})[_0xfcc1('0x17')](function(){_0x421b83[_0xfcc1('0x5b')](function(_0x1198e9){socket[_0xfcc1('0x5c')](_0xfcc1('0x5d'),{'UserId':_0x1198e9['id'],'OpenchannelQueueId':_0x33b0d7['id']});});});});});}})[_0xfcc1('0x17')](respondWithStatusCode(_0x13c701,null))[_0xfcc1('0x28')](handleError(_0x13c701,null));};exports[_0xfcc1('0x5e')]=function(_0x326a3b,_0x2a76f3){return db[_0xfcc1('0x4f')]['findAll']({'where':{'id':_0x326a3b[_0xfcc1('0x2e')][_0xfcc1('0x52')]},'attributes':['id'],'include':[{'model':db[_0xfcc1('0x46')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xfcc1('0x17')](handleEntityNotFound(_0x2a76f3,null))[_0xfcc1('0x17')](function(_0x4ca98e){var _0x3a3031=_['map'](_0x4ca98e,'id');var _0x10f184=[];var _0x122b60=[];var _0x31b504=squel[_0xfcc1('0x5f')]();_0x31b504[_0xfcc1('0x60')](_0xfcc1('0x61'))[_0xfcc1('0x62')](_0xfcc1('0x63'),'tq')[_0xfcc1('0x64')]('user_has_teams','ut',_0xfcc1('0x65'))[_0xfcc1('0x24')](_0xfcc1('0x66'),_0x326a3b['params']['id']);for(var _0xafadf=0x0;_0xafadf<_0x4ca98e[_0xfcc1('0x33')];_0xafadf+=0x1){let _0x395c07=_0x4ca98e[_0xafadf];for(var _0x1ea9d4=0x0;_0x1ea9d4<_0x395c07[_0xfcc1('0x53')]['length'];_0x1ea9d4+=0x1){let _0x225788=_0x395c07[_0xfcc1('0x53')][_0x1ea9d4];var _0x39c81a=_0x31b504[_0xfcc1('0x67')]();_0x39c81a[_0xfcc1('0x24')]('ut.UserId\x20=\x20?',_0x225788['id']);_0x122b60[_0xfcc1('0x68')](db['sequelize'][_0xfcc1('0x2e')](_0x39c81a[_0xfcc1('0x69')](),{'type':db[_0xfcc1('0x57')][_0xfcc1('0x6a')]['SELECT']})['then'](function(_0x137f18){if(_0x137f18[_0xfcc1('0x33')]===0x1){return _0x225788['id'];}else{var _0x356d77=_[_0xfcc1('0x6b')](_[_0xfcc1('0x1f')](_0x137f18,_0xfcc1('0x6c')),function(_0xd2cc75){return _[_0xfcc1('0x6d')](_0x3a3031,_0xd2cc75);});if(_0x356d77){return _0x225788['id'];}}}));}}return BPromise['all'](_0x122b60)[_0xfcc1('0x17')](function(_0x159c0c){_0x10f184=_(_0x10f184)[_0xfcc1('0x6e')](_0x159c0c)['compact']()[_0xfcc1('0x6f')]();return db[_0xfcc1('0x20')][_0xfcc1('0x37')]({'where':{'id':_0x326a3b['params']['id']}})[_0xfcc1('0x17')](function(_0x865a74){return db[_0xfcc1('0x57')]['transaction'](function(_0x2dea1f){return _0x865a74[_0xfcc1('0x5e')](_0x326a3b[_0xfcc1('0x2e')][_0xfcc1('0x52')],{'transaction':_0x2dea1f})[_0xfcc1('0x17')](function(){if(!_[_0xfcc1('0x70')](_0x10f184)){return _0x865a74[_0xfcc1('0x71')](_0x10f184,{'transaction':_0x2dea1f});}})['then'](function(){_0x10f184[_0xfcc1('0x5b')](function(_0x587c5e){socket[_0xfcc1('0x5c')](_0xfcc1('0x72'),{'UserId':_0x587c5e,'OpenchannelQueueId':_0x865a74['id']});});});});});});})[_0xfcc1('0x17')](respondWithStatusCode(_0x2a76f3,null))[_0xfcc1('0x28')](handleError(_0x2a76f3,null));};exports['addAgents']=function(_0x287a4f,_0x4f8205){return db[_0xfcc1('0x20')][_0xfcc1('0x37')]({'where':{'id':_0x287a4f['params']['id']}})[_0xfcc1('0x17')](handleEntityNotFound(_0x4f8205,null))[_0xfcc1('0x17')](function(_0x4e2d8e){if(_0x4e2d8e){return _0x4e2d8e[_0xfcc1('0x73')](_0x287a4f[_0xfcc1('0x39')]['ids'],_[_0xfcc1('0x74')](_0x287a4f[_0xfcc1('0x39')],[_0xfcc1('0x52'),'id'])||{})['spread'](function(_0x4cca80){for(var _0x2fcb0b=0x0;_0x2fcb0b<_0x287a4f[_0xfcc1('0x39')][_0xfcc1('0x52')][_0xfcc1('0x33')];_0x2fcb0b+=0x1){socket[_0xfcc1('0x5c')]('userOpenchannelQueue:save',{'UserId':Number(_0x287a4f['body'][_0xfcc1('0x52')][_0x2fcb0b]),'OpenchannelQueueId':Number(_0x287a4f[_0xfcc1('0x2a')]['id'])});}return _0x4cca80;});}})[_0xfcc1('0x17')](respondWithResult(_0x4f8205,null))[_0xfcc1('0x28')](handleError(_0x4f8205,null));};exports[_0xfcc1('0x71')]=function(_0x2c46d2,_0x4c9476){return db[_0xfcc1('0x20')][_0xfcc1('0x37')]({'where':{'id':_0x2c46d2[_0xfcc1('0x2a')]['id']}})['then'](handleEntityNotFound(_0x4c9476,null))[_0xfcc1('0x17')](function(_0x361e5c){if(_0x361e5c){return _0x361e5c['removeAgents'](_0x2c46d2[_0xfcc1('0x2e')]['ids'])[_0xfcc1('0x17')](function(){if(_['isArray'](_0x2c46d2[_0xfcc1('0x2e')]['ids'])){for(var _0x8bb978=0x0;_0x8bb978<_0x2c46d2[_0xfcc1('0x2e')][_0xfcc1('0x52')][_0xfcc1('0x33')];_0x8bb978+=0x1){socket[_0xfcc1('0x5c')](_0xfcc1('0x72'),{'UserId':Number(_0x2c46d2[_0xfcc1('0x2e')][_0xfcc1('0x52')][_0x8bb978]),'OpenchannelQueueId':Number(_0x2c46d2[_0xfcc1('0x2a')]['id'])});}}else{socket[_0xfcc1('0x5c')](_0xfcc1('0x72'),{'UserId':Number(_0x2c46d2['query'][_0xfcc1('0x52')]),'OpenchannelQueueId':Number(_0x2c46d2['params']['id'])});}});}})[_0xfcc1('0x17')](respondWithStatusCode(_0x4c9476,null))[_0xfcc1('0x28')](handleError(_0x4c9476,null));};exports[_0xfcc1('0x75')]=function(_0x21de3c,_0x179834){var _0x3da376={};var _0x31c978={};var _0x330a0f;var _0x4a717a;return db[_0xfcc1('0x20')][_0xfcc1('0x40')]({'where':{'id':_0x21de3c[_0xfcc1('0x2a')]['id']}})[_0xfcc1('0x17')](handleEntityNotFound(_0x179834,null))[_0xfcc1('0x17')](function(_0xfe186b){if(_0xfe186b){_0x330a0f=_0xfe186b;_0x31c978[_0xfcc1('0x2b')]=_[_0xfcc1('0x2c')](db[_0xfcc1('0x46')]['rawAttributes']);_0x31c978[_0xfcc1('0x2e')]=_[_0xfcc1('0x2c')](_0x21de3c[_0xfcc1('0x2e')]);_0x31c978[_0xfcc1('0x2f')]=_[_0xfcc1('0x30')](_0x31c978['model'],_0x31c978['query']);_0x3da376[_0xfcc1('0x31')]=_[_0xfcc1('0x30')](_0x31c978[_0xfcc1('0x2b')],qs[_0xfcc1('0x32')](_0x21de3c[_0xfcc1('0x2e')][_0xfcc1('0x32')]));_0x3da376['attributes']=_0x3da376[_0xfcc1('0x31')][_0xfcc1('0x33')]?_0x3da376[_0xfcc1('0x31')]:_0x31c978[_0xfcc1('0x2b')];_0x3da376[_0xfcc1('0x76')]=qs[_0xfcc1('0x42')](_0x21de3c[_0xfcc1('0x2e')]['sort']);_0x3da376[_0xfcc1('0x24')]=qs[_0xfcc1('0x2f')](_['pick'](_0x21de3c[_0xfcc1('0x2e')],_0x31c978[_0xfcc1('0x2f')]));if(_0x21de3c[_0xfcc1('0x2e')][_0xfcc1('0x45')]){_0x3da376[_0xfcc1('0x24')]=_[_0xfcc1('0x35')](_0x3da376[_0xfcc1('0x24')],{'$or':_[_0xfcc1('0x1f')](_0x3da376[_0xfcc1('0x31')],function(_0xf0f845){var _0x3df616={};_0x3df616[_0xf0f845]={'$like':'%'+_0x21de3c[_0xfcc1('0x2e')][_0xfcc1('0x45')]+'%'};return _0x3df616;})});}_0x3da376=_[_0xfcc1('0x35')]({},_0x3da376,_0x21de3c[_0xfcc1('0x36')]);return _0x330a0f[_0xfcc1('0x75')](_0x3da376);}})[_0xfcc1('0x17')](function(_0x2270ea){if(_0x2270ea){_0x4a717a=_0x2270ea[_0xfcc1('0x33')];if(!_0x21de3c[_0xfcc1('0x2e')][_0xfcc1('0x50')](_0xfcc1('0x41'))){_0x3da376['limit']=qs[_0xfcc1('0x12')](_0x21de3c[_0xfcc1('0x2e')][_0xfcc1('0x12')]);_0x3da376['offset']=qs['offset'](_0x21de3c[_0xfcc1('0x2e')]['offset']);}return _0x330a0f['getAgents'](_0x3da376);}})['then'](function(_0x14b55f){if(_0x14b55f){return _0x14b55f?{'count':_0x4a717a,'rows':_0x14b55f}:null;}})['then'](respondWithResult(_0x179834,null))['catch'](handleError(_0x179834,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 1146a08..8ec1f3b 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 _0x9faa=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x54bbb9,_0x24c53d){var _0x29fd2b=function(_0x4e0ef9){while(--_0x4e0ef9){_0x54bbb9['push'](_0x54bbb9['shift']());}};_0x29fd2b(++_0x24c53d);}(_0x9faa,0x13b));var _0xa9fa=function(_0xb0aaf7,_0x3d73df){_0xb0aaf7=_0xb0aaf7-0x0;var _0x333563=_0x9faa[_0xb0aaf7];return _0x333563;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0xa9fa('0x0'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xa9fa('0x1')](0x0);var events={'afterCreate':_0xa9fa('0x2'),'afterUpdate':_0xa9fa('0x3'),'afterDestroy':_0xa9fa('0x4')};function emitEvent(_0x104e42){return function(_0x5a8542,_0x374dd8,_0x3d3711){OpenchannelQueueEvents[_0xa9fa('0x5')](_0x104e42+':'+_0x5a8542['id'],_0x5a8542);OpenchannelQueueEvents['emit'](_0x104e42,_0x5a8542);_0x3d3711(null);};}for(var e in events){if(events[_0xa9fa('0x6')](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file +var _0xe20e=['save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelQueue','setMaxListeners'];(function(_0x299949,_0x29095d){var _0xa6b08a=function(_0x397f88){while(--_0x397f88){_0x299949['push'](_0x299949['shift']());}};_0xa6b08a(++_0x29095d);}(_0xe20e,0x146));var _0xee20=function(_0x2cfbcf,_0x2cf96f){_0x2cfbcf=_0x2cfbcf-0x0;var _0x41fc13=_0xe20e[_0x2cfbcf];return _0x41fc13;};'use strict';var EventEmitter=require(_0xee20('0x0'));var OpenchannelQueue=require(_0xee20('0x1'))['db'][_0xee20('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xee20('0x3')](0x0);var events={'afterCreate':_0xee20('0x4'),'afterUpdate':'update','afterDestroy':_0xee20('0x5')};function emitEvent(_0x1c9eef){return function(_0x388666,_0x5c3724,_0x1c98bf){OpenchannelQueueEvents[_0xee20('0x6')](_0x1c9eef+':'+_0x388666['id'],_0x388666);OpenchannelQueueEvents['emit'](_0x1c9eef,_0x388666);_0x1c98bf(null);};}for(var e in events){if(events[_0xee20('0x7')](e)){var event=events[e];OpenchannelQueue[_0xee20('0x8')](e,emitEvent(event));}}module[_0xee20('0x9')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 1968bcf..ff9c423 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 _0xcfa2=['exports','OpenchannelQueue','openchannel_queues','lodash','util','../../config/logger','api','path','rimraf','../../config/environment','./openchannelQueue.attributes'];(function(_0x2cc69f,_0x341adc){var _0x4ba756=function(_0x4bb7de){while(--_0x4bb7de){_0x2cc69f['push'](_0x2cc69f['shift']());}};_0x4ba756(++_0x341adc);}(_0xcfa2,0x66));var _0x2cfa=function(_0x5b0166,_0x2bf818){_0x5b0166=_0x5b0166-0x0;var _0x2b43db=_0xcfa2[_0x5b0166];return _0x2b43db;};'use strict';var _=require(_0x2cfa('0x0'));var util=require(_0x2cfa('0x1'));var logger=require(_0x2cfa('0x2'))(_0x2cfa('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2cfa('0x4'));var rimraf=require(_0x2cfa('0x5'));var config=require(_0x2cfa('0x6'));var attributes=require(_0x2cfa('0x7'));module[_0x2cfa('0x8')]=function(_0x58839a,_0x8878d6){return _0x58839a['define'](_0x2cfa('0x9'),attributes,{'tableName':_0x2cfa('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x462a=['openchannel_queues','lodash','api','bluebird','request-promise','path','rimraf','./openchannelQueue.attributes','exports','define','OpenchannelQueue'];(function(_0x412f2c,_0x46c5c2){var _0x4876d9=function(_0x18f331){while(--_0x18f331){_0x412f2c['push'](_0x412f2c['shift']());}};_0x4876d9(++_0x46c5c2);}(_0x462a,0x6f));var _0xa462=function(_0x4ef25d,_0x5c71ca){_0x4ef25d=_0x4ef25d-0x0;var _0x34040f=_0x462a[_0x4ef25d];return _0x34040f;};'use strict';var _=require(_0xa462('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa462('0x1'));var moment=require('moment');var BPromise=require(_0xa462('0x2'));var rp=require(_0xa462('0x3'));var fs=require('fs');var path=require(_0xa462('0x4'));var rimraf=require(_0xa462('0x5'));var config=require('../../config/environment');var attributes=require(_0xa462('0x6'));module[_0xa462('0x7')]=function(_0x573555,_0x1796c4){return _0x573555[_0xa462('0x8')](_0xa462('0x9'),attributes,{'tableName':_0xa462('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index dc85732..6304640 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 _0x1588=['find','raw','where','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','request','then','info','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','OpenchannelQueue,\x20%s,\x20%s','result','catch','GetOpenchannelQueue','OpenchannelQueue','options','attributes','limit','include','map','model','ShowOpenchannelQueue'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x1588,0x75));var _0x8158=function(_0x398aca,_0x481c00){_0x398aca=_0x398aca-0x0;var _0x30dc08=_0x1588[_0x398aca];return _0x30dc08;};'use strict';var _=require(_0x8158('0x0'));var util=require(_0x8158('0x1'));var moment=require(_0x8158('0x2'));var BPromise=require(_0x8158('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8158('0x4'));var db=require(_0x8158('0x5'))['db'];var utils=require(_0x8158('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8158('0x7')][_0x8158('0x8')]({'port':0x232a});config[_0x8158('0x9')]=_[_0x8158('0xa')](config[_0x8158('0x9')],{'host':_0x8158('0xb'),'port':0x18eb});var socket=require(_0x8158('0xc'))(new Redis(config['redis']));require(_0x8158('0xd'))['register'](socket);function respondWithRpcPromise(_0x45dc3b,_0x42922f,_0x1a8b97){return new BPromise(function(_0xdeeb58,_0x3908bf){return client[_0x8158('0xe')](_0x45dc3b,_0x1a8b97)[_0x8158('0xf')](function(_0x5a886c){logger[_0x8158('0x10')]('OpenchannelQueue,\x20%s,\x20%s',_0x42922f,'request\x20sent');logger[_0x8158('0x11')](_0x8158('0x12'),_0x42922f,_0x8158('0x13'),JSON[_0x8158('0x14')](_0x5a886c));if(_0x5a886c[_0x8158('0x15')]){if(_0x5a886c[_0x8158('0x15')]['code']===0x1f4){logger[_0x8158('0x15')]('OpenchannelQueue,\x20%s,\x20%s',_0x42922f,_0x5a886c[_0x8158('0x15')][_0x8158('0x16')]);return _0x3908bf(_0x5a886c[_0x8158('0x15')][_0x8158('0x16')]);}logger['error'](_0x8158('0x17'),_0x42922f,_0x5a886c[_0x8158('0x15')]['message']);return _0xdeeb58(_0x5a886c[_0x8158('0x15')][_0x8158('0x16')]);}else{logger['info'](_0x8158('0x17'),_0x42922f,_0x8158('0x13'));_0xdeeb58(_0x5a886c[_0x8158('0x18')][_0x8158('0x16')]);}})[_0x8158('0x19')](function(_0x302945){logger[_0x8158('0x15')]('OpenchannelQueue,\x20%s,\x20%s',_0x42922f,_0x302945);_0x3908bf(_0x302945);});});}exports[_0x8158('0x1a')]=function(_0x175af3){var _0x2d75d6=this;return new Promise(function(_0x71fcc2,_0x3373fb){return db[_0x8158('0x1b')]['findAll']({'raw':_0x175af3[_0x8158('0x1c')]?_0x175af3[_0x8158('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x175af3[_0x8158('0x1c')]?_0x175af3['options']['where']||null:null,'attributes':_0x175af3[_0x8158('0x1c')]?_0x175af3[_0x8158('0x1c')][_0x8158('0x1d')]||null:null,'limit':_0x175af3[_0x8158('0x1c')]?_0x175af3[_0x8158('0x1c')][_0x8158('0x1e')]||null:null,'include':_0x175af3[_0x8158('0x1c')]?_0x175af3[_0x8158('0x1c')][_0x8158('0x1f')]?_[_0x8158('0x20')](_0x175af3['options'][_0x8158('0x1f')],function(_0x28629b){return{'model':db[_0x28629b['model']],'as':_0x28629b['as'],'attributes':_0x28629b['attributes'],'include':_0x28629b[_0x8158('0x1f')]?_[_0x8158('0x20')](_0x28629b[_0x8158('0x1f')],function(_0x58a6f7){return{'model':db[_0x58a6f7['model']],'as':_0x58a6f7['as'],'attributes':_0x58a6f7[_0x8158('0x1d')],'include':_0x58a6f7['include']?_[_0x8158('0x20')](_0x58a6f7[_0x8158('0x1f')],function(_0x57e152){return{'model':db[_0x57e152[_0x8158('0x21')]],'as':_0x57e152['as'],'attributes':_0x57e152[_0x8158('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x8158('0xf')](function(_0x3ba15d){logger[_0x8158('0x10')](_0x8158('0x1a'),_0x175af3);logger[_0x8158('0x11')]('GetOpenchannelQueue',_0x175af3,JSON[_0x8158('0x14')](_0x3ba15d));_0x71fcc2(_0x3ba15d);})[_0x8158('0x19')](function(_0x3c9df5){logger[_0x8158('0x15')](_0x8158('0x1a'),_0x3c9df5['message'],_0x175af3);_0x3373fb(_0x2d75d6[_0x8158('0x15')](0x1f4,_0x3c9df5[_0x8158('0x16')]));});});};exports[_0x8158('0x22')]=function(_0x1860e0){var _0x5ce24f=this;return new Promise(function(_0x136702,_0x36b8a0){return db[_0x8158('0x1b')][_0x8158('0x23')]({'raw':_0x1860e0[_0x8158('0x1c')]?_0x1860e0['options'][_0x8158('0x24')]===undefined?!![]:![]:!![],'where':_0x1860e0[_0x8158('0x1c')]?_0x1860e0[_0x8158('0x1c')][_0x8158('0x25')]||null:null,'attributes':_0x1860e0['options']?_0x1860e0['options']['attributes']||null:null,'include':_0x1860e0[_0x8158('0x1c')]?_0x1860e0[_0x8158('0x1c')]['include']?_[_0x8158('0x20')](_0x1860e0[_0x8158('0x1c')][_0x8158('0x1f')],function(_0x22fe11){return{'model':db[_0x22fe11[_0x8158('0x21')]],'as':_0x22fe11['as'],'attributes':_0x22fe11[_0x8158('0x1d')],'include':_0x22fe11[_0x8158('0x1f')]?_[_0x8158('0x20')](_0x22fe11['include'],function(_0xf01271){return{'model':db[_0xf01271[_0x8158('0x21')]],'as':_0xf01271['as'],'attributes':_0xf01271[_0x8158('0x1d')],'include':_0xf01271[_0x8158('0x1f')]?_[_0x8158('0x20')](_0xf01271[_0x8158('0x1f')],function(_0x1d9670){return{'model':db[_0x1d9670[_0x8158('0x21')]],'as':_0x1d9670['as'],'attributes':_0x1d9670[_0x8158('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x8158('0xf')](function(_0x3ef2b0){logger[_0x8158('0x10')](_0x8158('0x22'),_0x1860e0);logger[_0x8158('0x11')](_0x8158('0x22'),_0x1860e0,JSON[_0x8158('0x14')](_0x3ef2b0));_0x136702(_0x3ef2b0);})[_0x8158('0x19')](function(_0x39cfd3){logger[_0x8158('0x15')](_0x8158('0x22'),_0x39cfd3[_0x8158('0x16')],_0x1860e0);_0x36b8a0(_0x5ce24f[_0x8158('0x15')](0x1f4,_0x39cfd3['message']));});});}; \ No newline at end of file +var _0x2755=['request','then','request\x20sent','error','code','OpenchannelQueue,\x20%s,\x20%s','message','result','OpenchannelQueue','options','raw','limit','include','attributes','model','map','info','GetOpenchannelQueue','debug','stringify','catch','ShowOpenchannelQueue','find','where','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register'];(function(_0x358d68,_0x229010){var _0x255242=function(_0x5bd780){while(--_0x5bd780){_0x358d68['push'](_0x358d68['shift']());}};_0x255242(++_0x229010);}(_0x2755,0xe0));var _0x5275=function(_0x26daa3,_0x92de6d){_0x26daa3=_0x26daa3-0x0;var _0x49b9ca=_0x2755[_0x26daa3];return _0x49b9ca;};'use strict';var _=require(_0x5275('0x0'));var util=require(_0x5275('0x1'));var moment=require(_0x5275('0x2'));var BPromise=require(_0x5275('0x3'));var rs=require(_0x5275('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5275('0x5'));var logger=require('../../config/logger')(_0x5275('0x6'));var config=require(_0x5275('0x7'));var jayson=require(_0x5275('0x8'));var client=jayson[_0x5275('0x9')][_0x5275('0xa')]({'port':0x232a});config[_0x5275('0xb')]=_[_0x5275('0xc')](config[_0x5275('0xb')],{'host':_0x5275('0xd'),'port':0x18eb});var socket=require(_0x5275('0xe'))(new Redis(config[_0x5275('0xb')]));require('./openchannelQueue.socket')[_0x5275('0xf')](socket);function respondWithRpcPromise(_0x1b3bf0,_0x22c242,_0x2b8d24){return new BPromise(function(_0x1a9900,_0x3a7e4e){return client[_0x5275('0x10')](_0x1b3bf0,_0x2b8d24)[_0x5275('0x11')](function(_0x135929){logger['info']('OpenchannelQueue,\x20%s,\x20%s',_0x22c242,_0x5275('0x12'));logger['debug']('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x22c242,_0x5275('0x12'),JSON['stringify'](_0x135929));if(_0x135929[_0x5275('0x13')]){if(_0x135929['error'][_0x5275('0x14')]===0x1f4){logger[_0x5275('0x13')](_0x5275('0x15'),_0x22c242,_0x135929[_0x5275('0x13')][_0x5275('0x16')]);return _0x3a7e4e(_0x135929[_0x5275('0x13')][_0x5275('0x16')]);}logger[_0x5275('0x13')](_0x5275('0x15'),_0x22c242,_0x135929[_0x5275('0x13')]['message']);return _0x1a9900(_0x135929[_0x5275('0x13')][_0x5275('0x16')]);}else{logger['info'](_0x5275('0x15'),_0x22c242,_0x5275('0x12'));_0x1a9900(_0x135929[_0x5275('0x17')]['message']);}})['catch'](function(_0x46913f){logger[_0x5275('0x13')](_0x5275('0x15'),_0x22c242,_0x46913f);_0x3a7e4e(_0x46913f);});});}exports['GetOpenchannelQueue']=function(_0x5b33ab){var _0x39d211=this;return new Promise(function(_0x4cb15e,_0x260f80){return db[_0x5275('0x18')]['findAll']({'raw':_0x5b33ab[_0x5275('0x19')]?_0x5b33ab[_0x5275('0x19')][_0x5275('0x1a')]===undefined?!![]:![]:!![],'where':_0x5b33ab['options']?_0x5b33ab[_0x5275('0x19')]['where']||null:null,'attributes':_0x5b33ab['options']?_0x5b33ab[_0x5275('0x19')]['attributes']||null:null,'limit':_0x5b33ab[_0x5275('0x19')]?_0x5b33ab[_0x5275('0x19')][_0x5275('0x1b')]||null:null,'include':_0x5b33ab[_0x5275('0x19')]?_0x5b33ab[_0x5275('0x19')][_0x5275('0x1c')]?_['map'](_0x5b33ab[_0x5275('0x19')][_0x5275('0x1c')],function(_0x3fb420){return{'model':db[_0x3fb420['model']],'as':_0x3fb420['as'],'attributes':_0x3fb420[_0x5275('0x1d')],'include':_0x3fb420[_0x5275('0x1c')]?_['map'](_0x3fb420[_0x5275('0x1c')],function(_0xebdf44){return{'model':db[_0xebdf44[_0x5275('0x1e')]],'as':_0xebdf44['as'],'attributes':_0xebdf44[_0x5275('0x1d')],'include':_0xebdf44[_0x5275('0x1c')]?_[_0x5275('0x1f')](_0xebdf44['include'],function(_0x1fe7c9){return{'model':db[_0x1fe7c9['model']],'as':_0x1fe7c9['as'],'attributes':_0x1fe7c9[_0x5275('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5275('0x11')](function(_0x1486b4){logger[_0x5275('0x20')](_0x5275('0x21'),_0x5b33ab);logger[_0x5275('0x22')](_0x5275('0x21'),_0x5b33ab,JSON[_0x5275('0x23')](_0x1486b4));_0x4cb15e(_0x1486b4);})[_0x5275('0x24')](function(_0x3daf9e){logger[_0x5275('0x13')](_0x5275('0x21'),_0x3daf9e[_0x5275('0x16')],_0x5b33ab);_0x260f80(_0x39d211[_0x5275('0x13')](0x1f4,_0x3daf9e[_0x5275('0x16')]));});});};exports[_0x5275('0x25')]=function(_0x4f87c7){var _0x143ec9=this;return new Promise(function(_0x25f8ba,_0x5ebfec){return db[_0x5275('0x18')][_0x5275('0x26')]({'raw':_0x4f87c7[_0x5275('0x19')]?_0x4f87c7[_0x5275('0x19')][_0x5275('0x1a')]===undefined?!![]:![]:!![],'where':_0x4f87c7[_0x5275('0x19')]?_0x4f87c7[_0x5275('0x19')][_0x5275('0x27')]||null:null,'attributes':_0x4f87c7['options']?_0x4f87c7[_0x5275('0x19')][_0x5275('0x1d')]||null:null,'include':_0x4f87c7[_0x5275('0x19')]?_0x4f87c7[_0x5275('0x19')]['include']?_[_0x5275('0x1f')](_0x4f87c7[_0x5275('0x19')]['include'],function(_0x9bb5b3){return{'model':db[_0x9bb5b3[_0x5275('0x1e')]],'as':_0x9bb5b3['as'],'attributes':_0x9bb5b3[_0x5275('0x1d')],'include':_0x9bb5b3[_0x5275('0x1c')]?_['map'](_0x9bb5b3['include'],function(_0x2af46c){return{'model':db[_0x2af46c[_0x5275('0x1e')]],'as':_0x2af46c['as'],'attributes':_0x2af46c['attributes'],'include':_0x2af46c[_0x5275('0x1c')]?_[_0x5275('0x1f')](_0x2af46c[_0x5275('0x1c')],function(_0x4ce492){return{'model':db[_0x4ce492[_0x5275('0x1e')]],'as':_0x4ce492['as'],'attributes':_0x4ce492['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x37b7d2){logger[_0x5275('0x20')](_0x5275('0x25'),_0x4f87c7);logger['debug']('ShowOpenchannelQueue',_0x4f87c7,JSON['stringify'](_0x37b7d2));_0x25f8ba(_0x37b7d2);})[_0x5275('0x24')](function(_0x4fa9e3){logger[_0x5275('0x13')]('ShowOpenchannelQueue',_0x4fa9e3[_0x5275('0x16')],_0x4f87c7);_0x5ebfec(_0x143ec9[_0x5275('0x13')](0x1f4,_0x4fa9e3[_0x5275('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index d052224..66744dd 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 _0xa88d=['openchannelQueue:','./openchannelQueue.events','remove','update','emit','register','length'];(function(_0x25ea21,_0x266c3a){var _0x431523=function(_0x1d1639){while(--_0x1d1639){_0x25ea21['push'](_0x25ea21['shift']());}};_0x431523(++_0x266c3a);}(_0xa88d,0x71));var _0xda88=function(_0x4d39a7,_0x16db64){_0x4d39a7=_0x4d39a7-0x0;var _0x30e04a=_0xa88d[_0x4d39a7];return _0x30e04a;};'use strict';var OpenchannelQueueEvents=require(_0xda88('0x0'));var events=['save',_0xda88('0x1'),_0xda88('0x2')];function createListener(_0x1a730e,_0x20fd01){return function(_0x36bfe8){_0x20fd01[_0xda88('0x3')](_0x1a730e,_0x36bfe8);};}function removeListener(_0x82cdfe,_0x53ba48){return function(){OpenchannelQueueEvents['removeListener'](_0x82cdfe,_0x53ba48);};}exports[_0xda88('0x4')]=function(_0x562dab){for(var _0x4a9465=0x0,_0x4c707c=events[_0xda88('0x5')];_0x4a9465<_0x4c707c;_0x4a9465++){var _0x270fe7=events[_0x4a9465];var _0x1b4ee1=createListener(_0xda88('0x6')+_0x270fe7,_0x562dab);OpenchannelQueueEvents['on'](_0x270fe7,_0x1b4ee1);}}; \ No newline at end of file +var _0x6c1b=['length','save','remove','update','emit','removeListener','register'];(function(_0x3b891a,_0x1d6577){var _0x5d7f88=function(_0x169e74){while(--_0x169e74){_0x3b891a['push'](_0x3b891a['shift']());}};_0x5d7f88(++_0x1d6577);}(_0x6c1b,0x9b));var _0xb6c1=function(_0x3b3ceb,_0x35dc71){_0x3b3ceb=_0x3b3ceb-0x0;var _0x45c88d=_0x6c1b[_0x3b3ceb];return _0x45c88d;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0xb6c1('0x0'),_0xb6c1('0x1'),_0xb6c1('0x2')];function createListener(_0x3e3166,_0x3eb068){return function(_0x12eaa1){_0x3eb068[_0xb6c1('0x3')](_0x3e3166,_0x12eaa1);};}function removeListener(_0x59591d,_0x57b3cf){return function(){OpenchannelQueueEvents[_0xb6c1('0x4')](_0x59591d,_0x57b3cf);};}exports[_0xb6c1('0x5')]=function(_0x452c74){for(var _0x27c2d1=0x0,_0x240bc9=events[_0xb6c1('0x6')];_0x27c2d1<_0x240bc9;_0x27c2d1++){var _0x33af9f=events[_0x27c2d1];var _0x484784=createListener('openchannelQueue:'+_0x33af9f,_0x452c74);OpenchannelQueueEvents['on'](_0x33af9f,_0x484784);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 23e52e6..7624704 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 _0x5d5e=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','isAuthenticated','get','/describe','/:id','show','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x2b8c2f,_0x26343d){var _0x2b23ab=function(_0x57015a){while(--_0x57015a){_0x2b8c2f['push'](_0x2b8c2f['shift']());}};_0x2b23ab(++_0x26343d);}(_0x5d5e,0x152));var _0xe5d5=function(_0x2d2f1f,_0x170b70){_0x2d2f1f=_0x2d2f1f-0x0;var _0x3c7bfb=_0x5d5e[_0x2d2f1f];return _0x3c7bfb;};'use strict';var multer=require(_0xe5d5('0x0'));var util=require(_0xe5d5('0x1'));var path=require(_0xe5d5('0x2'));var timeout=require(_0xe5d5('0x3'));var express=require(_0xe5d5('0x4'));var router=express[_0xe5d5('0x5')]();var fs_extra=require(_0xe5d5('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xe5d5('0x7'));var config=require(_0xe5d5('0x8'));var controller=require(_0xe5d5('0x9'));router['get']('/',auth[_0xe5d5('0xa')](),controller['index']);router[_0xe5d5('0xb')](_0xe5d5('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0xe5d5('0xb')](_0xe5d5('0xd'),auth[_0xe5d5('0xa')](),controller[_0xe5d5('0xe')]);router['post']('/',auth[_0xe5d5('0xa')](),controller['create']);router['put']('/:id',auth[_0xe5d5('0xa')](),controller['update']);router[_0xe5d5('0xf')](_0xe5d5('0xd'),auth['isAuthenticated'](),controller[_0xe5d5('0x10')]);module[_0xe5d5('0x11')]=router; \ No newline at end of file +var _0xad8b=['/:id','post','create','put','delete','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x3515d7,_0x40696a){var _0x50fada=function(_0x26d72f){while(--_0x26d72f){_0x3515d7['push'](_0x3515d7['shift']());}};_0x50fada(++_0x40696a);}(_0xad8b,0x16e));var _0xbad8=function(_0x3dc9dc,_0x232d61){_0x3dc9dc=_0x3dc9dc-0x0;var _0x100498=_0xad8b[_0x3dc9dc];return _0x100498;};'use strict';var multer=require(_0xbad8('0x0'));var util=require(_0xbad8('0x1'));var path=require('path');var timeout=require(_0xbad8('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xbad8('0x3'));var auth=require(_0xbad8('0x4'));var interaction=require(_0xbad8('0x5'));var config=require(_0xbad8('0x6'));var controller=require('./openchannelQueueReport.controller');router[_0xbad8('0x7')]('/',auth[_0xbad8('0x8')](),controller['index']);router[_0xbad8('0x7')]('/describe',auth[_0xbad8('0x8')](),controller['describe']);router[_0xbad8('0x7')](_0xbad8('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xbad8('0xa')]('/',auth[_0xbad8('0x8')](),controller[_0xbad8('0xb')]);router[_0xbad8('0xc')](_0xbad8('0x9'),auth['isAuthenticated'](),controller['update']);router[_0xbad8('0xd')](_0xbad8('0x9'),auth[_0xbad8('0x8')](),controller['destroy']);module[_0xbad8('0xe')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 02a1836..1f69da6 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 _0x3bfc=['moment','sequelize','exports','STRING','DATE'];(function(_0x1f9889,_0x208e7b){var _0x4a4e57=function(_0x970c8d){while(--_0x970c8d){_0x1f9889['push'](_0x1f9889['shift']());}};_0x4a4e57(++_0x208e7b);}(_0x3bfc,0x177));var _0xc3bf=function(_0x45c981,_0x2ad2d4){_0x45c981=_0x45c981-0x0;var _0x4f62c8=_0x3bfc[_0x45c981];return _0x4f62c8;};'use strict';var moment=require(_0xc3bf('0x0'));var Sequelize=require(_0xc3bf('0x1'));module[_0xc3bf('0x2')]={'uniqueid':{'type':Sequelize[_0xc3bf('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xc3bf('0x3')]},'joinAt':{'type':Sequelize[_0xc3bf('0x4')]},'leaveAt':{'type':Sequelize[_0xc3bf('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xc3bf('0x4')]},'reason':{'type':Sequelize[_0xc3bf('0x3')]}}; \ No newline at end of file +var _0xffcf=['moment','sequelize','STRING','DATE'];(function(_0x1a21c4,_0x5644d7){var _0x34385d=function(_0x2e2767){while(--_0x2e2767){_0x1a21c4['push'](_0x1a21c4['shift']());}};_0x34385d(++_0x5644d7);}(_0xffcf,0x180));var _0xfffc=function(_0x19ac6e,_0x435862){_0x19ac6e=_0x19ac6e-0x0;var _0x1cdcf3=_0xffcf[_0x19ac6e];return _0x1cdcf3;};'use strict';var moment=require(_0xfffc('0x0'));var Sequelize=require(_0xfffc('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xfffc('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xfffc('0x3')]},'leaveAt':{'type':Sequelize[_0xfffc('0x3')]},'acceptAt':{'type':Sequelize[_0xfffc('0x3')]},'exitAt':{'type':Sequelize[_0xfffc('0x3')]},'reason':{'type':Sequelize[_0xfffc('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 7385ae4..db69ca5 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 _0x40dd=['set','apply','reject','save','update','then','destroy','end','error','stack','name','index','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','map','VIRTUAL','filter','merge','OpenchannelQueueReport','includeAll','include','findAll','rows','catch','show','params','options','create','body','find','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','count'];(function(_0x98db33,_0x397f20){var _0x5ae63a=function(_0x411f1c){while(--_0x411f1c){_0x98db33['push'](_0x98db33['shift']());}};_0x5ae63a(++_0x397f20);}(_0x40dd,0x169));var _0xd40d=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x40dd[_0xa1e3e3];return _0xc980e9;};'use strict';var emlformat=require(_0xd40d('0x0'));var rimraf=require(_0xd40d('0x1'));var zipdir=require(_0xd40d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd40d('0x3'));var moment=require(_0xd40d('0x4'));var BPromise=require(_0xd40d('0x5'));var Mustache=require(_0xd40d('0x6'));var util=require(_0xd40d('0x7'));var path=require(_0xd40d('0x8'));var sox=require(_0xd40d('0x9'));var csv=require(_0xd40d('0xa'));var ejs=require(_0xd40d('0xb'));var fs=require('fs');var fs_extra=require(_0xd40d('0xc'));var _=require(_0xd40d('0xd'));var squel=require(_0xd40d('0xe'));var crypto=require(_0xd40d('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xd40d('0x10'));var toCsv=require(_0xd40d('0xa'));var querystring=require('querystring');var Papa=require(_0xd40d('0x11'));var Redis=require(_0xd40d('0x12'));var authService=require(_0xd40d('0x13'));var qs=require(_0xd40d('0x14'));var as=require(_0xd40d('0x15'));var hardwareService=require(_0xd40d('0x16'));var logger=require(_0xd40d('0x17'))(_0xd40d('0x18'));var utils=require(_0xd40d('0x19'));var config=require(_0xd40d('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xd40d('0x1b'))['db'];function respondWithStatusCode(_0xdd65c0,_0x440034){_0x440034=_0x440034||0xcc;return function(_0x11e49f){if(_0x11e49f){return _0xdd65c0[_0xd40d('0x1c')](_0x440034);}return _0xdd65c0['status'](_0x440034)['end']();};}function respondWithResult(_0x4decb9,_0x4666e3){_0x4666e3=_0x4666e3||0xc8;return function(_0x1d5176){if(_0x1d5176){return _0x4decb9[_0xd40d('0x1d')](_0x4666e3)[_0xd40d('0x1e')](_0x1d5176);}};}function respondWithFilteredResult(_0x158329,_0x172d05){return function(_0x134eff){if(_0x134eff){var _0x5d8420=typeof _0x172d05[_0xd40d('0x1f')]==='undefined'&&typeof _0x172d05[_0xd40d('0x20')]==='undefined';var _0x271342=_0x134eff[_0xd40d('0x21')];var _0x59a00a=_0x5d8420?0x0:_0x172d05[_0xd40d('0x1f')];var _0x52932e=_0x5d8420?_0x134eff['count']:_0x172d05['offset']+_0x172d05[_0xd40d('0x20')];var _0x5dc74c;if(_0x52932e>=_0x271342){_0x52932e=_0x271342;_0x5dc74c=0xc8;}else{_0x5dc74c=0xce;}_0x158329[_0xd40d('0x1d')](_0x5dc74c);return _0x158329[_0xd40d('0x22')]('Content-Range',_0x59a00a+'-'+_0x52932e+'/'+_0x271342)[_0xd40d('0x1e')](_0x134eff);}return null;};}function patchUpdates(_0x5a1e26){return function(_0x117428){try{jsonpatch[_0xd40d('0x23')](_0x117428,_0x5a1e26,!![]);}catch(_0x4f51e4){return BPromise[_0xd40d('0x24')](_0x4f51e4);}return _0x117428[_0xd40d('0x25')]();};}function saveUpdates(_0x1a89a3,_0x5b25c3){return function(_0x51f396){if(_0x51f396){return _0x51f396[_0xd40d('0x26')](_0x1a89a3)[_0xd40d('0x27')](function(_0x206b53){return _0x206b53;});}return null;};}function removeEntity(_0x516be1,_0x311137){return function(_0xb0b985){if(_0xb0b985){return _0xb0b985[_0xd40d('0x28')]()[_0xd40d('0x27')](function(){_0x516be1[_0xd40d('0x1d')](0xcc)[_0xd40d('0x29')]();});}};}function handleEntityNotFound(_0x49f341,_0x5b52c2){return function(_0x1f921d){if(!_0x1f921d){_0x49f341[_0xd40d('0x1c')](0x194);}return _0x1f921d;};}function handleError(_0x277060,_0x5712c8){_0x5712c8=_0x5712c8||0x1f4;return function(_0x26d0ba){logger[_0xd40d('0x2a')](_0x26d0ba[_0xd40d('0x2b')]);if(_0x26d0ba[_0xd40d('0x2c')]){delete _0x26d0ba[_0xd40d('0x2c')];}_0x277060[_0xd40d('0x1d')](_0x5712c8)['send'](_0x26d0ba);};}exports[_0xd40d('0x2d')]=function(_0x2e12b6,_0x9af341){var _0x78e858={},_0x3dc7ab={},_0xf45938={'count':0x0,'rows':[]};var _0xb45be7=_['map'](db['OpenchannelQueueReport'][_0xd40d('0x2e')],function(_0x49d851){return{'name':_0x49d851[_0xd40d('0x2f')],'type':_0x49d851['type'][_0xd40d('0x30')]};});_0x3dc7ab[_0xd40d('0x31')]=_['map'](_0xb45be7,_0xd40d('0x2c'));_0x3dc7ab[_0xd40d('0x32')]=_[_0xd40d('0x33')](_0x2e12b6['query']);_0x3dc7ab[_0xd40d('0x34')]=_[_0xd40d('0x35')](_0x3dc7ab[_0xd40d('0x31')],_0x3dc7ab[_0xd40d('0x32')]);_0x78e858['attributes']=_['intersection'](_0x3dc7ab[_0xd40d('0x31')],qs['fields'](_0x2e12b6[_0xd40d('0x32')][_0xd40d('0x36')]));_0x78e858[_0xd40d('0x37')]=_0x78e858[_0xd40d('0x37')][_0xd40d('0x38')]?_0x78e858['attributes']:_0x3dc7ab[_0xd40d('0x31')];if(!_0x2e12b6[_0xd40d('0x32')][_0xd40d('0x39')](_0xd40d('0x3a'))){_0x78e858[_0xd40d('0x20')]=qs['limit'](_0x2e12b6['query'][_0xd40d('0x20')]);_0x78e858[_0xd40d('0x1f')]=qs[_0xd40d('0x1f')](_0x2e12b6[_0xd40d('0x32')][_0xd40d('0x1f')]);}_0x78e858[_0xd40d('0x3b')]=qs[_0xd40d('0x3c')](_0x2e12b6['query'][_0xd40d('0x3c')]);_0x78e858[_0xd40d('0x3d')]=qs[_0xd40d('0x34')](_[_0xd40d('0x3e')](_0x2e12b6[_0xd40d('0x32')],_0x3dc7ab[_0xd40d('0x34')]),_0xb45be7);if(_0x2e12b6['query']['filter']){_0x78e858[_0xd40d('0x3d')]=_['merge'](_0x78e858['where'],{'$or':_[_0xd40d('0x3f')](_0xb45be7,function(_0x95af0b){if(_0x95af0b['type']!==_0xd40d('0x40')){var _0x339c24={};_0x339c24[_0x95af0b[_0xd40d('0x2c')]]={'$like':'%'+_0x2e12b6['query'][_0xd40d('0x41')]+'%'};return _0x339c24;}})});}_0x78e858=_[_0xd40d('0x42')]({},_0x78e858,_0x2e12b6['options']);var _0x30a3a0={'where':_0x78e858[_0xd40d('0x3d')]};return db[_0xd40d('0x43')][_0xd40d('0x21')](_0x30a3a0)[_0xd40d('0x27')](function(_0x527a3e){_0xf45938[_0xd40d('0x21')]=_0x527a3e;if(_0x2e12b6[_0xd40d('0x32')][_0xd40d('0x44')]){_0x78e858[_0xd40d('0x45')]=[{'all':!![]}];}return db[_0xd40d('0x43')][_0xd40d('0x46')](_0x78e858);})[_0xd40d('0x27')](function(_0x3a77f5){_0xf45938[_0xd40d('0x47')]=_0x3a77f5;return _0xf45938;})[_0xd40d('0x27')](respondWithFilteredResult(_0x9af341,_0x78e858))[_0xd40d('0x48')](handleError(_0x9af341,null));};exports[_0xd40d('0x49')]=function(_0x7c2bdb,_0x5abbda){var _0x3e45a0={'raw':!![],'where':{'id':_0x7c2bdb[_0xd40d('0x4a')]['id']}},_0x3c0296={};_0x3c0296[_0xd40d('0x31')]=_['keys'](db[_0xd40d('0x43')][_0xd40d('0x2e')]);_0x3c0296[_0xd40d('0x32')]=_[_0xd40d('0x33')](_0x7c2bdb['query']);_0x3c0296['filters']=_[_0xd40d('0x35')](_0x3c0296[_0xd40d('0x31')],_0x3c0296[_0xd40d('0x32')]);_0x3e45a0[_0xd40d('0x37')]=_[_0xd40d('0x35')](_0x3c0296['model'],qs[_0xd40d('0x36')](_0x7c2bdb[_0xd40d('0x32')][_0xd40d('0x36')]));_0x3e45a0[_0xd40d('0x37')]=_0x3e45a0[_0xd40d('0x37')][_0xd40d('0x38')]?_0x3e45a0['attributes']:_0x3c0296[_0xd40d('0x31')];if(_0x7c2bdb['query'][_0xd40d('0x44')]){_0x3e45a0['include']=[{'all':!![]}];}_0x3e45a0=_[_0xd40d('0x42')]({},_0x3e45a0,_0x7c2bdb[_0xd40d('0x4b')]);return db[_0xd40d('0x43')]['find'](_0x3e45a0)[_0xd40d('0x27')](handleEntityNotFound(_0x5abbda,null))[_0xd40d('0x27')](respondWithResult(_0x5abbda,null))[_0xd40d('0x48')](handleError(_0x5abbda,null));};exports[_0xd40d('0x4c')]=function(_0x1103a5,_0x1ed18a){return db['OpenchannelQueueReport'][_0xd40d('0x4c')](_0x1103a5[_0xd40d('0x4d')],{})[_0xd40d('0x27')](respondWithResult(_0x1ed18a,0xc9))['catch'](handleError(_0x1ed18a,null));};exports[_0xd40d('0x26')]=function(_0x1a101e,_0x33a283){if(_0x1a101e[_0xd40d('0x4d')]['id']){delete _0x1a101e[_0xd40d('0x4d')]['id'];}return db[_0xd40d('0x43')][_0xd40d('0x4e')]({'where':{'id':_0x1a101e[_0xd40d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x33a283,null))[_0xd40d('0x27')](saveUpdates(_0x1a101e['body'],null))[_0xd40d('0x27')](respondWithResult(_0x33a283,null))[_0xd40d('0x48')](handleError(_0x33a283,null));};exports['destroy']=function(_0x2545a3,_0x1d3501){return db['OpenchannelQueueReport'][_0xd40d('0x4e')]({'where':{'id':_0x2545a3[_0xd40d('0x4a')]['id']}})[_0xd40d('0x27')](handleEntityNotFound(_0x1d3501,null))['then'](removeEntity(_0x1d3501,null))[_0xd40d('0x48')](handleError(_0x1d3501,null));};exports['describe']=function(_0x1e8fdb,_0x430b0f){return db[_0xd40d('0x43')]['describe']()[_0xd40d('0x27')](respondWithResult(_0x430b0f,null))['catch'](handleError(_0x430b0f,null));}; \ No newline at end of file +var _0x567f=['json','apply','reject','update','then','destroy','error','stack','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range'];(function(_0x88df1b,_0xda41dd){var _0x24af06=function(_0x5014a0){while(--_0x5014a0){_0x88df1b['push'](_0x88df1b['shift']());}};_0x24af06(++_0xda41dd);}(_0x567f,0xc1));var _0xf567=function(_0x49536b,_0x2abe5d){_0x49536b=_0x49536b-0x0;var _0x30de59=_0x567f[_0x49536b];return _0x30de59;};'use strict';var emlformat=require(_0xf567('0x0'));var rimraf=require(_0xf567('0x1'));var zipdir=require(_0xf567('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf567('0x3'));var moment=require('moment');var BPromise=require(_0xf567('0x4'));var Mustache=require(_0xf567('0x5'));var util=require(_0xf567('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xf567('0x7'));var ejs=require(_0xf567('0x8'));var fs=require('fs');var fs_extra=require(_0xf567('0x9'));var _=require(_0xf567('0xa'));var squel=require(_0xf567('0xb'));var crypto=require(_0xf567('0xc'));var jsforce=require(_0xf567('0xd'));var deskjs=require(_0xf567('0xe'));var toCsv=require(_0xf567('0x7'));var querystring=require(_0xf567('0xf'));var Papa=require(_0xf567('0x10'));var Redis=require(_0xf567('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xf567('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf567('0x13'));var logger=require(_0xf567('0x14'))('api');var utils=require(_0xf567('0x15'));var config=require(_0xf567('0x16'));var licenseUtil=require(_0xf567('0x17'));var db=require(_0xf567('0x18'))['db'];function respondWithStatusCode(_0x4ee2f0,_0x3ac9d9){_0x3ac9d9=_0x3ac9d9||0xcc;return function(_0x51828d){if(_0x51828d){return _0x4ee2f0[_0xf567('0x19')](_0x3ac9d9);}return _0x4ee2f0[_0xf567('0x1a')](_0x3ac9d9)['end']();};}function respondWithResult(_0x534602,_0x936626){_0x936626=_0x936626||0xc8;return function(_0x21991b){if(_0x21991b){return _0x534602[_0xf567('0x1a')](_0x936626)['json'](_0x21991b);}};}function respondWithFilteredResult(_0x3c0898,_0xf40b9f){return function(_0x37efa8){if(_0x37efa8){var _0x496143=typeof _0xf40b9f[_0xf567('0x1b')]===_0xf567('0x1c')&&typeof _0xf40b9f[_0xf567('0x1d')]==='undefined';var _0x5ad745=_0x37efa8[_0xf567('0x1e')];var _0x340a36=_0x496143?0x0:_0xf40b9f[_0xf567('0x1b')];var _0x173c1e=_0x496143?_0x37efa8[_0xf567('0x1e')]:_0xf40b9f[_0xf567('0x1b')]+_0xf40b9f[_0xf567('0x1d')];var _0x428bf8;if(_0x173c1e>=_0x5ad745){_0x173c1e=_0x5ad745;_0x428bf8=0xc8;}else{_0x428bf8=0xce;}_0x3c0898[_0xf567('0x1a')](_0x428bf8);return _0x3c0898['set'](_0xf567('0x1f'),_0x340a36+'-'+_0x173c1e+'/'+_0x5ad745)[_0xf567('0x20')](_0x37efa8);}return null;};}function patchUpdates(_0x46ee1a){return function(_0x216677){try{jsonpatch[_0xf567('0x21')](_0x216677,_0x46ee1a,!![]);}catch(_0x1d0091){return BPromise[_0xf567('0x22')](_0x1d0091);}return _0x216677['save']();};}function saveUpdates(_0x76fdd5,_0x20fad7){return function(_0x1644a7){if(_0x1644a7){return _0x1644a7[_0xf567('0x23')](_0x76fdd5)[_0xf567('0x24')](function(_0x58147a){return _0x58147a;});}return null;};}function removeEntity(_0x5bb6a7,_0x101af1){return function(_0x54730d){if(_0x54730d){return _0x54730d[_0xf567('0x25')]()[_0xf567('0x24')](function(){_0x5bb6a7[_0xf567('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a7fd8,_0x46e12b){return function(_0x6741b7){if(!_0x6741b7){_0x3a7fd8[_0xf567('0x19')](0x194);}return _0x6741b7;};}function handleError(_0x27bfbe,_0x1413aa){_0x1413aa=_0x1413aa||0x1f4;return function(_0x421e9e){logger[_0xf567('0x26')](_0x421e9e[_0xf567('0x27')]);if(_0x421e9e['name']){delete _0x421e9e[_0xf567('0x28')];}_0x27bfbe[_0xf567('0x1a')](_0x1413aa)[_0xf567('0x29')](_0x421e9e);};}exports[_0xf567('0x2a')]=function(_0x3d5813,_0x201d5d){var _0x3255d2={},_0x338a26={},_0x40003e={'count':0x0,'rows':[]};var _0x16810f=_[_0xf567('0x2b')](db[_0xf567('0x2c')][_0xf567('0x2d')],function(_0x44c13f){return{'name':_0x44c13f[_0xf567('0x2e')],'type':_0x44c13f[_0xf567('0x2f')]['key']};});_0x338a26[_0xf567('0x30')]=_[_0xf567('0x2b')](_0x16810f,_0xf567('0x28'));_0x338a26[_0xf567('0x31')]=_[_0xf567('0x32')](_0x3d5813[_0xf567('0x31')]);_0x338a26[_0xf567('0x33')]=_[_0xf567('0x34')](_0x338a26['model'],_0x338a26[_0xf567('0x31')]);_0x3255d2[_0xf567('0x35')]=_['intersection'](_0x338a26['model'],qs[_0xf567('0x36')](_0x3d5813[_0xf567('0x31')]['fields']));_0x3255d2[_0xf567('0x35')]=_0x3255d2['attributes']['length']?_0x3255d2[_0xf567('0x35')]:_0x338a26[_0xf567('0x30')];if(!_0x3d5813[_0xf567('0x31')][_0xf567('0x37')]('nolimit')){_0x3255d2[_0xf567('0x1d')]=qs['limit'](_0x3d5813[_0xf567('0x31')][_0xf567('0x1d')]);_0x3255d2[_0xf567('0x1b')]=qs[_0xf567('0x1b')](_0x3d5813[_0xf567('0x31')][_0xf567('0x1b')]);}_0x3255d2[_0xf567('0x38')]=qs[_0xf567('0x39')](_0x3d5813[_0xf567('0x31')][_0xf567('0x39')]);_0x3255d2[_0xf567('0x3a')]=qs[_0xf567('0x33')](_['pick'](_0x3d5813['query'],_0x338a26[_0xf567('0x33')]),_0x16810f);if(_0x3d5813['query']['filter']){_0x3255d2[_0xf567('0x3a')]=_['merge'](_0x3255d2[_0xf567('0x3a')],{'$or':_[_0xf567('0x2b')](_0x16810f,function(_0x5df27f){if(_0x5df27f[_0xf567('0x2f')]!==_0xf567('0x3b')){var _0x3600d5={};_0x3600d5[_0x5df27f[_0xf567('0x28')]]={'$like':'%'+_0x3d5813['query'][_0xf567('0x3c')]+'%'};return _0x3600d5;}})});}_0x3255d2=_[_0xf567('0x3d')]({},_0x3255d2,_0x3d5813[_0xf567('0x3e')]);var _0x6a7404={'where':_0x3255d2['where']};return db[_0xf567('0x2c')][_0xf567('0x1e')](_0x6a7404)['then'](function(_0x3046e8){_0x40003e[_0xf567('0x1e')]=_0x3046e8;if(_0x3d5813['query'][_0xf567('0x3f')]){_0x3255d2[_0xf567('0x40')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0xf567('0x41')](_0x3255d2);})['then'](function(_0x46d6a1){_0x40003e[_0xf567('0x42')]=_0x46d6a1;return _0x40003e;})['then'](respondWithFilteredResult(_0x201d5d,_0x3255d2))[_0xf567('0x43')](handleError(_0x201d5d,null));};exports[_0xf567('0x44')]=function(_0x474fdb,_0x3a73d1){var _0x2e2e92={'raw':!![],'where':{'id':_0x474fdb[_0xf567('0x45')]['id']}},_0x45c4cc={};_0x45c4cc[_0xf567('0x30')]=_[_0xf567('0x32')](db[_0xf567('0x2c')]['rawAttributes']);_0x45c4cc[_0xf567('0x31')]=_[_0xf567('0x32')](_0x474fdb['query']);_0x45c4cc['filters']=_[_0xf567('0x34')](_0x45c4cc[_0xf567('0x30')],_0x45c4cc['query']);_0x2e2e92[_0xf567('0x35')]=_[_0xf567('0x34')](_0x45c4cc['model'],qs[_0xf567('0x36')](_0x474fdb['query'][_0xf567('0x36')]));_0x2e2e92[_0xf567('0x35')]=_0x2e2e92[_0xf567('0x35')][_0xf567('0x46')]?_0x2e2e92[_0xf567('0x35')]:_0x45c4cc[_0xf567('0x30')];if(_0x474fdb[_0xf567('0x31')]['includeAll']){_0x2e2e92[_0xf567('0x40')]=[{'all':!![]}];}_0x2e2e92=_[_0xf567('0x3d')]({},_0x2e2e92,_0x474fdb[_0xf567('0x3e')]);return db[_0xf567('0x2c')][_0xf567('0x47')](_0x2e2e92)[_0xf567('0x24')](handleEntityNotFound(_0x3a73d1,null))[_0xf567('0x24')](respondWithResult(_0x3a73d1,null))[_0xf567('0x43')](handleError(_0x3a73d1,null));};exports['create']=function(_0x82c694,_0x4896d4){return db[_0xf567('0x2c')][_0xf567('0x48')](_0x82c694[_0xf567('0x49')],{})[_0xf567('0x24')](respondWithResult(_0x4896d4,0xc9))['catch'](handleError(_0x4896d4,null));};exports['update']=function(_0x26f8e0,_0x2b3a91){if(_0x26f8e0[_0xf567('0x49')]['id']){delete _0x26f8e0[_0xf567('0x49')]['id'];}return db[_0xf567('0x2c')][_0xf567('0x47')]({'where':{'id':_0x26f8e0['params']['id']}})['then'](handleEntityNotFound(_0x2b3a91,null))[_0xf567('0x24')](saveUpdates(_0x26f8e0['body'],null))['then'](respondWithResult(_0x2b3a91,null))[_0xf567('0x43')](handleError(_0x2b3a91,null));};exports[_0xf567('0x25')]=function(_0x534348,_0x498c7b){return db[_0xf567('0x2c')]['find']({'where':{'id':_0x534348['params']['id']}})['then'](handleEntityNotFound(_0x498c7b,null))[_0xf567('0x24')](removeEntity(_0x498c7b,null))[_0xf567('0x43')](handleError(_0x498c7b,null));};exports['describe']=function(_0x4e49c1,_0x4c4d1f){return db[_0xf567('0x2c')][_0xf567('0x4a')]()[_0xf567('0x24')](respondWithResult(_0x4c4d1f,null))[_0xf567('0x43')](handleError(_0x4c4d1f,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 8880636..ece795a 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 _0x814b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','uniqueid','lodash','util'];(function(_0x28e74e,_0x53fdf1){var _0xb45ac1=function(_0x311a7a){while(--_0x311a7a){_0x28e74e['push'](_0x28e74e['shift']());}};_0xb45ac1(++_0x53fdf1);}(_0x814b,0x1a2));var _0xb814=function(_0x56c70f,_0x4e4493){_0x56c70f=_0x56c70f-0x0;var _0x3812ed=_0x814b[_0x56c70f];return _0x3812ed;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'report_openchannel_queue','paranoid':![],'indexes':[{'name':_0xb814('0xd'),'fields':[_0xb814('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc4aa=['bluebird','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','../../config/logger','api','moment'];(function(_0x224b00,_0x2024df){var _0x2896b4=function(_0x3f75c9){while(--_0x3f75c9){_0x224b00['push'](_0x224b00['shift']());}};_0x2896b4(++_0x2024df);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0xc4aa[_0x3b0731];return _0x4204d7;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 207ec57..ed1ec5f 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 _0x9c00=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','create','body','options','raw','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','OpenchannelQueueReport','where','attributes','limit','lodash','util','randomstring','ioredis'];(function(_0x57411a,_0x59328f){var _0xd487ba=function(_0x2fb456){while(--_0x2fb456){_0x57411a['push'](_0x57411a['shift']());}};_0xd487ba(++_0x59328f);}(_0x9c00,0x1a0));var _0x09c0=function(_0x5227ab,_0x514da4){_0x5227ab=_0x5227ab-0x0;var _0x3dc702=_0x9c00[_0x5227ab];return _0x3dc702;};'use strict';var _=require(_0x09c0('0x0'));var util=require(_0x09c0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x09c0('0x2'));var fs=require('fs');var Redis=require(_0x09c0('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x09c0('0x4'));var logger=require(_0x09c0('0x5'))(_0x09c0('0x6'));var config=require(_0x09c0('0x7'));var jayson=require(_0x09c0('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1f3d7e,_0x17d11f,_0x1b633b){return new BPromise(function(_0x3187aa,_0x17cd9d){return client['request'](_0x1f3d7e,_0x1b633b)[_0x09c0('0x9')](function(_0x1c1246){logger[_0x09c0('0xa')](_0x09c0('0xb'),_0x17d11f,_0x09c0('0xc'));logger[_0x09c0('0xd')](_0x09c0('0xe'),_0x17d11f,_0x09c0('0xc'),JSON[_0x09c0('0xf')](_0x1c1246));if(_0x1c1246[_0x09c0('0x10')]){if(_0x1c1246[_0x09c0('0x10')][_0x09c0('0x11')]===0x1f4){logger[_0x09c0('0x10')](_0x09c0('0xb'),_0x17d11f,_0x1c1246[_0x09c0('0x10')][_0x09c0('0x12')]);return _0x17cd9d(_0x1c1246[_0x09c0('0x10')][_0x09c0('0x12')]);}logger[_0x09c0('0x10')](_0x09c0('0xb'),_0x17d11f,_0x1c1246[_0x09c0('0x10')][_0x09c0('0x12')]);return _0x3187aa(_0x1c1246[_0x09c0('0x10')][_0x09c0('0x12')]);}else{logger[_0x09c0('0xa')](_0x09c0('0xb'),_0x17d11f,'request\x20sent');_0x3187aa(_0x1c1246['result']['message']);}})[_0x09c0('0x13')](function(_0x11f4b2){logger[_0x09c0('0x10')](_0x09c0('0xb'),_0x17d11f,_0x11f4b2);_0x17cd9d(_0x11f4b2);});});}exports['CreateOpenchannelQueueReport']=function(_0x2c4440){var _0x4aa8a5=this;return new Promise(function(_0x4c29a7,_0x2c12da){return db['OpenchannelQueueReport'][_0x09c0('0x14')](_0x2c4440[_0x09c0('0x15')],{'raw':_0x2c4440[_0x09c0('0x16')]?_0x2c4440['options'][_0x09c0('0x17')]===undefined?!![]:![]:!![]})[_0x09c0('0x9')](function(_0x8ad645){logger[_0x09c0('0xa')](_0x09c0('0x18'),_0x2c4440);logger[_0x09c0('0xd')](_0x09c0('0x18'),_0x2c4440,JSON['stringify'](_0x8ad645));_0x4c29a7(_0x8ad645);})[_0x09c0('0x13')](function(_0x46f171){logger[_0x09c0('0x10')](_0x09c0('0x18'),_0x46f171['message'],_0x2c4440);_0x2c12da(_0x4aa8a5['error'](0x1f4,_0x46f171[_0x09c0('0x12')]));});});};exports[_0x09c0('0x19')]=function(_0x1e8a1c){var _0x3a5370=this;return new Promise(function(_0x491e6f,_0x42ebfc){return db[_0x09c0('0x1a')]['update'](_0x1e8a1c[_0x09c0('0x15')],{'raw':_0x1e8a1c[_0x09c0('0x16')]?_0x1e8a1c[_0x09c0('0x16')][_0x09c0('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e8a1c[_0x09c0('0x16')]?_0x1e8a1c[_0x09c0('0x16')][_0x09c0('0x1b')]||null:null,'attributes':_0x1e8a1c[_0x09c0('0x16')]?_0x1e8a1c[_0x09c0('0x16')][_0x09c0('0x1c')]||null:null,'limit':_0x1e8a1c[_0x09c0('0x16')]?_0x1e8a1c['options'][_0x09c0('0x1d')]||null:null})[_0x09c0('0x9')](function(_0x53a7b8){logger[_0x09c0('0xa')]('UpdateOpenchannelQueueReport',_0x1e8a1c);logger[_0x09c0('0xd')]('UpdateOpenchannelQueueReport',_0x1e8a1c,JSON[_0x09c0('0xf')](_0x53a7b8));_0x491e6f(_0x53a7b8);})[_0x09c0('0x13')](function(_0x108409){logger[_0x09c0('0x10')]('UpdateOpenchannelQueueReport',_0x108409['message'],_0x1e8a1c);_0x42ebfc(_0x3a5370[_0x09c0('0x10')](0x1f4,_0x108409[_0x09c0('0x12')]));});});}; \ No newline at end of file +var _0xfcbb=['body','raw','where','attributes','limit','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelQueueReport,\x20%s,\x20%s','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','options','UpdateOpenchannelQueueReport','update'];(function(_0x82e2cf,_0x351e10){var _0x8bc00f=function(_0x408f57){while(--_0x408f57){_0x82e2cf['push'](_0x82e2cf['shift']());}};_0x8bc00f(++_0x351e10);}(_0xfcbb,0x10d));var _0xbfcb=function(_0x131edc,_0x251ac4){_0x131edc=_0x131edc-0x0;var _0x648d58=_0xfcbb[_0x131edc];return _0x648d58;};'use strict';var _=require(_0xbfcb('0x0'));var util=require(_0xbfcb('0x1'));var moment=require(_0xbfcb('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbfcb('0x3'));var db=require(_0xbfcb('0x4'))['db'];var utils=require(_0xbfcb('0x5'));var logger=require(_0xbfcb('0x6'))(_0xbfcb('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbfcb('0x8')][_0xbfcb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x8d4e6a,_0x2df839,_0x288ee5){return new BPromise(function(_0x2f875c,_0x49717b){return client['request'](_0x8d4e6a,_0x288ee5)[_0xbfcb('0xa')](function(_0x331173){logger[_0xbfcb('0xb')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x2df839,_0xbfcb('0xc'));logger[_0xbfcb('0xd')](_0xbfcb('0xe'),_0x2df839,_0xbfcb('0xc'),JSON[_0xbfcb('0xf')](_0x331173));if(_0x331173[_0xbfcb('0x10')]){if(_0x331173['error'][_0xbfcb('0x11')]===0x1f4){logger[_0xbfcb('0x10')](_0xbfcb('0x12'),_0x2df839,_0x331173[_0xbfcb('0x10')]['message']);return _0x49717b(_0x331173[_0xbfcb('0x10')]['message']);}logger[_0xbfcb('0x10')](_0xbfcb('0x12'),_0x2df839,_0x331173[_0xbfcb('0x10')][_0xbfcb('0x13')]);return _0x2f875c(_0x331173[_0xbfcb('0x10')][_0xbfcb('0x13')]);}else{logger[_0xbfcb('0xb')](_0xbfcb('0x12'),_0x2df839,_0xbfcb('0xc'));_0x2f875c(_0x331173[_0xbfcb('0x14')][_0xbfcb('0x13')]);}})[_0xbfcb('0x15')](function(_0x26f335){logger[_0xbfcb('0x10')](_0xbfcb('0x12'),_0x2df839,_0x26f335);_0x49717b(_0x26f335);});});}exports[_0xbfcb('0x16')]=function(_0xba1d6){var _0x38689e=this;return new Promise(function(_0x3404aa,_0x46b8d2){return db[_0xbfcb('0x17')][_0xbfcb('0x18')](_0xba1d6['body'],{'raw':_0xba1d6[_0xbfcb('0x19')]?_0xba1d6[_0xbfcb('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xbfcb('0xa')](function(_0x1a7225){logger['info']('CreateOpenchannelQueueReport',_0xba1d6);logger[_0xbfcb('0xd')](_0xbfcb('0x16'),_0xba1d6,JSON[_0xbfcb('0xf')](_0x1a7225));_0x3404aa(_0x1a7225);})[_0xbfcb('0x15')](function(_0x1c5924){logger['error'](_0xbfcb('0x16'),_0x1c5924[_0xbfcb('0x13')],_0xba1d6);_0x46b8d2(_0x38689e[_0xbfcb('0x10')](0x1f4,_0x1c5924[_0xbfcb('0x13')]));});});};exports[_0xbfcb('0x1a')]=function(_0x19616c){var _0x69c8e9=this;return new Promise(function(_0x14e43c,_0x11f6f7){return db[_0xbfcb('0x17')][_0xbfcb('0x1b')](_0x19616c[_0xbfcb('0x1c')],{'raw':_0x19616c[_0xbfcb('0x19')]?_0x19616c[_0xbfcb('0x19')][_0xbfcb('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19616c[_0xbfcb('0x19')]?_0x19616c['options'][_0xbfcb('0x1e')]||null:null,'attributes':_0x19616c[_0xbfcb('0x19')]?_0x19616c['options'][_0xbfcb('0x1f')]||null:null,'limit':_0x19616c[_0xbfcb('0x19')]?_0x19616c[_0xbfcb('0x19')][_0xbfcb('0x20')]||null:null})[_0xbfcb('0xa')](function(_0x3542e9){logger[_0xbfcb('0xb')](_0xbfcb('0x1a'),_0x19616c);logger[_0xbfcb('0xd')](_0xbfcb('0x1a'),_0x19616c,JSON['stringify'](_0x3542e9));_0x14e43c(_0x3542e9);})[_0xbfcb('0x15')](function(_0x3aa3cd){logger[_0xbfcb('0x10')](_0xbfcb('0x1a'),_0x3aa3cd[_0xbfcb('0x13')],_0x19616c);_0x11f6f7(_0x69c8e9[_0xbfcb('0x10')](0x1f4,_0x3aa3cd[_0xbfcb('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 0c82ea3..f624f28 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 _0xf3fb=['describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get'];(function(_0xd02def,_0x144f25){var _0x2e8374=function(_0x5ceb35){while(--_0x5ceb35){_0xd02def['push'](_0xd02def['shift']());}};_0x2e8374(++_0x144f25);}(_0xf3fb,0xc6));var _0xbf3f=function(_0x458363,_0x1675db){_0x458363=_0x458363-0x0;var _0x4d0290=_0xf3fb[_0x458363];return _0x4d0290;};'use strict';var multer=require(_0xbf3f('0x0'));var util=require(_0xbf3f('0x1'));var path=require('path');var timeout=require(_0xbf3f('0x2'));var express=require(_0xbf3f('0x3'));var router=express[_0xbf3f('0x4')]();var fs_extra=require(_0xbf3f('0x5'));var auth=require(_0xbf3f('0x6'));var interaction=require(_0xbf3f('0x7'));var config=require(_0xbf3f('0x8'));var controller=require('./openchannelTransferReport.controller');router['get']('/',auth[_0xbf3f('0x9')](),controller[_0xbf3f('0xa')]);router[_0xbf3f('0xb')]('/describe',auth[_0xbf3f('0x9')](),controller[_0xbf3f('0xc')]);router[_0xbf3f('0xb')](_0xbf3f('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xbf3f('0xe')]('/',auth[_0xbf3f('0x9')](),controller[_0xbf3f('0xf')]);router[_0xbf3f('0x10')](_0xbf3f('0xd'),auth[_0xbf3f('0x9')](),controller[_0xbf3f('0x11')]);router[_0xbf3f('0x12')](_0xbf3f('0xd'),auth[_0xbf3f('0x9')](),controller[_0xbf3f('0x13')]);module[_0xbf3f('0x14')]=router; \ No newline at end of file +var _0x2184=['Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','/:id','show','create','put','update','delete','exports','multer','util','path','connect-timeout','express'];(function(_0x40acaf,_0x5b87da){var _0x579e9f=function(_0x5153e9){while(--_0x5153e9){_0x40acaf['push'](_0x40acaf['shift']());}};_0x579e9f(++_0x5b87da);}(_0x2184,0x6d));var _0x4218=function(_0x10b4db,_0x5da334){_0x10b4db=_0x10b4db-0x0;var _0x2e738e=_0x2184[_0x10b4db];return _0x2e738e;};'use strict';var multer=require(_0x4218('0x0'));var util=require(_0x4218('0x1'));var path=require(_0x4218('0x2'));var timeout=require(_0x4218('0x3'));var express=require(_0x4218('0x4'));var router=express[_0x4218('0x5')]();var fs_extra=require(_0x4218('0x6'));var auth=require(_0x4218('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x4218('0x8'));var controller=require('./openchannelTransferReport.controller');router[_0x4218('0x9')]('/',auth[_0x4218('0xa')](),controller['index']);router[_0x4218('0x9')](_0x4218('0xb'),auth[_0x4218('0xa')](),controller['describe']);router[_0x4218('0x9')](_0x4218('0xc'),auth['isAuthenticated'](),controller[_0x4218('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4218('0xe')]);router[_0x4218('0xf')](_0x4218('0xc'),auth[_0x4218('0xa')](),controller[_0x4218('0x10')]);router[_0x4218('0x11')]('/:id',auth[_0x4218('0xa')](),controller['destroy']);module[_0x4218('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index dc50d3c..ccd2c98 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 _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x1ef1e1,_0x1898cc){var _0x12e953=function(_0x28aa96){while(--_0x28aa96){_0x1ef1e1['push'](_0x1ef1e1['shift']());}};_0x12e953(++_0x1898cc);}(_0xcb91,0x1a9));var _0x1cb9=function(_0xf26c2e,_0x56c3ea){_0xf26c2e=_0xf26c2e-0x0;var _0x46ecb4=_0xcb91[_0xf26c2e];return _0x46ecb4;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file +var _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x2c7377,_0x32ade5){var _0x35e181=function(_0x1be1e6){while(--_0x1be1e6){_0x2c7377['push'](_0x2c7377['shift']());}};_0x35e181(++_0x32ade5);}(_0x9c44,0x178));var _0x49c4=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x9c44[_0x255d5b];return _0x3e141a;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index b35ff10..522b19e 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 _0x702e=['index','rawAttributes','type','key','map','query','intersection','model','fields','attributes','hasOwnProperty','nolimit','sort','where','filters','pick','merge','VIRTUAL','filter','options','OpenchannelTransferReport','includeAll','include','rows','catch','show','params','keys','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name'];(function(_0x596776,_0x209317){var _0x153c39=function(_0x371fd5){while(--_0x371fd5){_0x596776['push'](_0x596776['shift']());}};_0x153c39(++_0x209317);}(_0x702e,0x6c));var _0xe702=function(_0x2809be,_0x2203d7){_0x2809be=_0x2809be-0x0;var _0x366785=_0x702e[_0x2809be];return _0x366785;};'use strict';var emlformat=require(_0xe702('0x0'));var rimraf=require(_0xe702('0x1'));var zipdir=require(_0xe702('0x2'));var jsonpatch=require(_0xe702('0x3'));var rp=require(_0xe702('0x4'));var moment=require(_0xe702('0x5'));var BPromise=require(_0xe702('0x6'));var Mustache=require(_0xe702('0x7'));var util=require(_0xe702('0x8'));var path=require(_0xe702('0x9'));var sox=require(_0xe702('0xa'));var csv=require(_0xe702('0xb'));var ejs=require(_0xe702('0xc'));var fs=require('fs');var fs_extra=require(_0xe702('0xd'));var _=require(_0xe702('0xe'));var squel=require(_0xe702('0xf'));var crypto=require(_0xe702('0x10'));var jsforce=require(_0xe702('0x11'));var deskjs=require(_0xe702('0x12'));var toCsv=require(_0xe702('0xb'));var querystring=require(_0xe702('0x13'));var Papa=require('papaparse');var Redis=require(_0xe702('0x14'));var authService=require(_0xe702('0x15'));var qs=require(_0xe702('0x16'));var as=require(_0xe702('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe702('0x18'));var utils=require(_0xe702('0x19'));var config=require(_0xe702('0x1a'));var licenseUtil=require(_0xe702('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ba9c3,_0x4f1c84){_0x4f1c84=_0x4f1c84||0xcc;return function(_0x239f8c){if(_0x239f8c){return _0x1ba9c3[_0xe702('0x1c')](_0x4f1c84);}return _0x1ba9c3[_0xe702('0x1d')](_0x4f1c84)['end']();};}function respondWithResult(_0x140b86,_0x526a11){_0x526a11=_0x526a11||0xc8;return function(_0x4d877e){if(_0x4d877e){return _0x140b86['status'](_0x526a11)[_0xe702('0x1e')](_0x4d877e);}};}function respondWithFilteredResult(_0xffbce5,_0x708469){return function(_0x1e514c){if(_0x1e514c){var _0x128b7b=typeof _0x708469['offset']==='undefined'&&typeof _0x708469['limit']===_0xe702('0x1f');var _0x3c1f35=_0x1e514c[_0xe702('0x20')];var _0x2f4ffe=_0x128b7b?0x0:_0x708469[_0xe702('0x21')];var _0x3553f8=_0x128b7b?_0x1e514c[_0xe702('0x20')]:_0x708469[_0xe702('0x21')]+_0x708469[_0xe702('0x22')];var _0x3df82f;if(_0x3553f8>=_0x3c1f35){_0x3553f8=_0x3c1f35;_0x3df82f=0xc8;}else{_0x3df82f=0xce;}_0xffbce5[_0xe702('0x1d')](_0x3df82f);return _0xffbce5[_0xe702('0x23')](_0xe702('0x24'),_0x2f4ffe+'-'+_0x3553f8+'/'+_0x3c1f35)['json'](_0x1e514c);}return null;};}function patchUpdates(_0x748a61){return function(_0x317ddc){try{jsonpatch[_0xe702('0x25')](_0x317ddc,_0x748a61,!![]);}catch(_0x53d850){return BPromise[_0xe702('0x26')](_0x53d850);}return _0x317ddc['save']();};}function saveUpdates(_0x5ec413,_0x37bf6f){return function(_0x25f75b){if(_0x25f75b){return _0x25f75b[_0xe702('0x27')](_0x5ec413)[_0xe702('0x28')](function(_0x45c796){return _0x45c796;});}return null;};}function removeEntity(_0x1e1723,_0x42734f){return function(_0x492550){if(_0x492550){return _0x492550[_0xe702('0x29')]()[_0xe702('0x28')](function(){_0x1e1723['status'](0xcc)[_0xe702('0x2a')]();});}};}function handleEntityNotFound(_0x3979ba,_0x101a26){return function(_0x3351cc){if(!_0x3351cc){_0x3979ba['sendStatus'](0x194);}return _0x3351cc;};}function handleError(_0x1b4c06,_0x2cf88d){_0x2cf88d=_0x2cf88d||0x1f4;return function(_0xd35b7b){logger[_0xe702('0x2b')](_0xd35b7b[_0xe702('0x2c')]);if(_0xd35b7b[_0xe702('0x2d')]){delete _0xd35b7b[_0xe702('0x2d')];}_0x1b4c06['status'](_0x2cf88d)['send'](_0xd35b7b);};}exports[_0xe702('0x2e')]=function(_0x35bb9e,_0x2fb024){var _0x463f3e={},_0x253c57={},_0x439987={'count':0x0,'rows':[]};var _0x166699=_['map'](db['OpenchannelTransferReport'][_0xe702('0x2f')],function(_0x43fe0b){return{'name':_0x43fe0b['fieldName'],'type':_0x43fe0b[_0xe702('0x30')][_0xe702('0x31')]};});_0x253c57['model']=_[_0xe702('0x32')](_0x166699,_0xe702('0x2d'));_0x253c57[_0xe702('0x33')]=_['keys'](_0x35bb9e[_0xe702('0x33')]);_0x253c57['filters']=_[_0xe702('0x34')](_0x253c57[_0xe702('0x35')],_0x253c57[_0xe702('0x33')]);_0x463f3e['attributes']=_[_0xe702('0x34')](_0x253c57[_0xe702('0x35')],qs[_0xe702('0x36')](_0x35bb9e[_0xe702('0x33')][_0xe702('0x36')]));_0x463f3e[_0xe702('0x37')]=_0x463f3e['attributes']['length']?_0x463f3e[_0xe702('0x37')]:_0x253c57[_0xe702('0x35')];if(!_0x35bb9e['query'][_0xe702('0x38')](_0xe702('0x39'))){_0x463f3e[_0xe702('0x22')]=qs[_0xe702('0x22')](_0x35bb9e['query'][_0xe702('0x22')]);_0x463f3e[_0xe702('0x21')]=qs[_0xe702('0x21')](_0x35bb9e[_0xe702('0x33')][_0xe702('0x21')]);}_0x463f3e['order']=qs[_0xe702('0x3a')](_0x35bb9e['query'][_0xe702('0x3a')]);_0x463f3e[_0xe702('0x3b')]=qs[_0xe702('0x3c')](_[_0xe702('0x3d')](_0x35bb9e[_0xe702('0x33')],_0x253c57[_0xe702('0x3c')]),_0x166699);if(_0x35bb9e['query']['filter']){_0x463f3e[_0xe702('0x3b')]=_[_0xe702('0x3e')](_0x463f3e[_0xe702('0x3b')],{'$or':_[_0xe702('0x32')](_0x166699,function(_0x538395){if(_0x538395['type']!==_0xe702('0x3f')){var _0x4fa45a={};_0x4fa45a[_0x538395[_0xe702('0x2d')]]={'$like':'%'+_0x35bb9e[_0xe702('0x33')][_0xe702('0x40')]+'%'};return _0x4fa45a;}})});}_0x463f3e=_[_0xe702('0x3e')]({},_0x463f3e,_0x35bb9e[_0xe702('0x41')]);var _0x3f561f={'where':_0x463f3e[_0xe702('0x3b')]};return db[_0xe702('0x42')]['count'](_0x3f561f)[_0xe702('0x28')](function(_0xee4e24){_0x439987['count']=_0xee4e24;if(_0x35bb9e['query'][_0xe702('0x43')]){_0x463f3e[_0xe702('0x44')]=[{'all':!![]}];}return db[_0xe702('0x42')]['findAll'](_0x463f3e);})['then'](function(_0x53d052){_0x439987[_0xe702('0x45')]=_0x53d052;return _0x439987;})['then'](respondWithFilteredResult(_0x2fb024,_0x463f3e))[_0xe702('0x46')](handleError(_0x2fb024,null));};exports[_0xe702('0x47')]=function(_0x571bd5,_0x226eb5){var _0xb2af78={'raw':!![],'where':{'id':_0x571bd5[_0xe702('0x48')]['id']}},_0x38f098={};_0x38f098[_0xe702('0x35')]=_['keys'](db[_0xe702('0x42')][_0xe702('0x2f')]);_0x38f098[_0xe702('0x33')]=_[_0xe702('0x49')](_0x571bd5['query']);_0x38f098['filters']=_['intersection'](_0x38f098['model'],_0x38f098[_0xe702('0x33')]);_0xb2af78[_0xe702('0x37')]=_['intersection'](_0x38f098[_0xe702('0x35')],qs[_0xe702('0x36')](_0x571bd5[_0xe702('0x33')][_0xe702('0x36')]));_0xb2af78['attributes']=_0xb2af78[_0xe702('0x37')]['length']?_0xb2af78[_0xe702('0x37')]:_0x38f098[_0xe702('0x35')];if(_0x571bd5[_0xe702('0x33')][_0xe702('0x43')]){_0xb2af78[_0xe702('0x44')]=[{'all':!![]}];}_0xb2af78=_[_0xe702('0x3e')]({},_0xb2af78,_0x571bd5[_0xe702('0x41')]);return db[_0xe702('0x42')]['find'](_0xb2af78)[_0xe702('0x28')](handleEntityNotFound(_0x226eb5,null))[_0xe702('0x28')](respondWithResult(_0x226eb5,null))[_0xe702('0x46')](handleError(_0x226eb5,null));};exports[_0xe702('0x4a')]=function(_0xe674ca,_0x3f7c6d){return db[_0xe702('0x42')][_0xe702('0x4a')](_0xe674ca[_0xe702('0x4b')],{})['then'](respondWithResult(_0x3f7c6d,0xc9))['catch'](handleError(_0x3f7c6d,null));};exports['update']=function(_0x4d52ae,_0xd9e418){if(_0x4d52ae[_0xe702('0x4b')]['id']){delete _0x4d52ae[_0xe702('0x4b')]['id'];}return db['OpenchannelTransferReport']['find']({'where':{'id':_0x4d52ae['params']['id']}})[_0xe702('0x28')](handleEntityNotFound(_0xd9e418,null))[_0xe702('0x28')](saveUpdates(_0x4d52ae[_0xe702('0x4b')],null))[_0xe702('0x28')](respondWithResult(_0xd9e418,null))[_0xe702('0x46')](handleError(_0xd9e418,null));};exports['destroy']=function(_0x48a996,_0x26e332){return db[_0xe702('0x42')][_0xe702('0x4c')]({'where':{'id':_0x48a996['params']['id']}})[_0xe702('0x28')](handleEntityNotFound(_0x26e332,null))[_0xe702('0x28')](removeEntity(_0x26e332,null))[_0xe702('0x46')](handleError(_0x26e332,null));};exports['describe']=function(_0x194403,_0x4e8f08){return db[_0xe702('0x42')]['describe']()['then'](respondWithResult(_0x4e8f08,null))[_0xe702('0x46')](handleError(_0x4e8f08,null));}; \ No newline at end of file +var _0x2721=['mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','reject','save','update','destroy','then','name','send','index','map','OpenchannelTransferReport','rawAttributes','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','show','find','catch','create','body','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x447f9b,_0x5d18c6){var _0xcfee4e=function(_0x15cea3){while(--_0x15cea3){_0x447f9b['push'](_0x447f9b['shift']());}};_0xcfee4e(++_0x5d18c6);}(_0x2721,0x1c3));var _0x1272=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0x2721[_0x5f309e];return _0x487b5e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1272('0x0'));var zipdir=require(_0x1272('0x1'));var jsonpatch=require(_0x1272('0x2'));var rp=require(_0x1272('0x3'));var moment=require(_0x1272('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1272('0x5'));var util=require(_0x1272('0x6'));var path=require(_0x1272('0x7'));var sox=require('sox');var csv=require(_0x1272('0x8'));var ejs=require(_0x1272('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1272('0xa'));var squel=require(_0x1272('0xb'));var crypto=require(_0x1272('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1272('0xd'));var toCsv=require(_0x1272('0x8'));var querystring=require(_0x1272('0xe'));var Papa=require(_0x1272('0xf'));var Redis=require(_0x1272('0x10'));var authService=require(_0x1272('0x11'));var qs=require(_0x1272('0x12'));var as=require(_0x1272('0x13'));var hardwareService=require(_0x1272('0x14'));var logger=require('../../config/logger')(_0x1272('0x15'));var utils=require('../../config/utils');var config=require(_0x1272('0x16'));var licenseUtil=require(_0x1272('0x17'));var db=require(_0x1272('0x18'))['db'];function respondWithStatusCode(_0x12b1ae,_0x2ffe35){_0x2ffe35=_0x2ffe35||0xcc;return function(_0x5ebe8e){if(_0x5ebe8e){return _0x12b1ae[_0x1272('0x19')](_0x2ffe35);}return _0x12b1ae[_0x1272('0x1a')](_0x2ffe35)[_0x1272('0x1b')]();};}function respondWithResult(_0x5d78d6,_0x11738d){_0x11738d=_0x11738d||0xc8;return function(_0x281f96){if(_0x281f96){return _0x5d78d6['status'](_0x11738d)['json'](_0x281f96);}};}function respondWithFilteredResult(_0x33710f,_0x212140){return function(_0x105f0b){if(_0x105f0b){var _0x4c5f1a=typeof _0x212140[_0x1272('0x1c')]==='undefined'&&typeof _0x212140[_0x1272('0x1d')]===_0x1272('0x1e');var _0x1f9e25=_0x105f0b['count'];var _0x594848=_0x4c5f1a?0x0:_0x212140[_0x1272('0x1c')];var _0x468a88=_0x4c5f1a?_0x105f0b[_0x1272('0x1f')]:_0x212140[_0x1272('0x1c')]+_0x212140[_0x1272('0x1d')];var _0x52534a;if(_0x468a88>=_0x1f9e25){_0x468a88=_0x1f9e25;_0x52534a=0xc8;}else{_0x52534a=0xce;}_0x33710f[_0x1272('0x1a')](_0x52534a);return _0x33710f[_0x1272('0x20')](_0x1272('0x21'),_0x594848+'-'+_0x468a88+'/'+_0x1f9e25)[_0x1272('0x22')](_0x105f0b);}return null;};}function patchUpdates(_0x41ce09){return function(_0xba9878){try{jsonpatch['apply'](_0xba9878,_0x41ce09,!![]);}catch(_0x17ecc2){return BPromise[_0x1272('0x23')](_0x17ecc2);}return _0xba9878[_0x1272('0x24')]();};}function saveUpdates(_0x2a991e,_0x142f91){return function(_0x17d648){if(_0x17d648){return _0x17d648[_0x1272('0x25')](_0x2a991e)['then'](function(_0x330fec){return _0x330fec;});}return null;};}function removeEntity(_0x50190e,_0x43e892){return function(_0x2e7ac6){if(_0x2e7ac6){return _0x2e7ac6[_0x1272('0x26')]()[_0x1272('0x27')](function(){_0x50190e['status'](0xcc)[_0x1272('0x1b')]();});}};}function handleEntityNotFound(_0x581994,_0x409b9f){return function(_0x585bc5){if(!_0x585bc5){_0x581994['sendStatus'](0x194);}return _0x585bc5;};}function handleError(_0x134511,_0x4fc0f5){_0x4fc0f5=_0x4fc0f5||0x1f4;return function(_0x4ca777){logger['error'](_0x4ca777['stack']);if(_0x4ca777['name']){delete _0x4ca777[_0x1272('0x28')];}_0x134511[_0x1272('0x1a')](_0x4fc0f5)[_0x1272('0x29')](_0x4ca777);};}exports[_0x1272('0x2a')]=function(_0x47c51a,_0x3cf2c7){var _0xcd4f26={},_0x314773={},_0x4b159c={'count':0x0,'rows':[]};var _0x3dc9e1=_[_0x1272('0x2b')](db[_0x1272('0x2c')][_0x1272('0x2d')],function(_0x2b7375){return{'name':_0x2b7375['fieldName'],'type':_0x2b7375['type'][_0x1272('0x2e')]};});_0x314773[_0x1272('0x2f')]=_[_0x1272('0x2b')](_0x3dc9e1,_0x1272('0x28'));_0x314773[_0x1272('0x30')]=_[_0x1272('0x31')](_0x47c51a[_0x1272('0x30')]);_0x314773['filters']=_[_0x1272('0x32')](_0x314773[_0x1272('0x2f')],_0x314773[_0x1272('0x30')]);_0xcd4f26['attributes']=_['intersection'](_0x314773[_0x1272('0x2f')],qs[_0x1272('0x33')](_0x47c51a[_0x1272('0x30')][_0x1272('0x33')]));_0xcd4f26[_0x1272('0x34')]=_0xcd4f26[_0x1272('0x34')][_0x1272('0x35')]?_0xcd4f26[_0x1272('0x34')]:_0x314773['model'];if(!_0x47c51a[_0x1272('0x30')][_0x1272('0x36')](_0x1272('0x37'))){_0xcd4f26[_0x1272('0x1d')]=qs[_0x1272('0x1d')](_0x47c51a[_0x1272('0x30')]['limit']);_0xcd4f26[_0x1272('0x1c')]=qs[_0x1272('0x1c')](_0x47c51a[_0x1272('0x30')][_0x1272('0x1c')]);}_0xcd4f26[_0x1272('0x38')]=qs['sort'](_0x47c51a[_0x1272('0x30')][_0x1272('0x39')]);_0xcd4f26[_0x1272('0x3a')]=qs[_0x1272('0x3b')](_[_0x1272('0x3c')](_0x47c51a[_0x1272('0x30')],_0x314773[_0x1272('0x3b')]),_0x3dc9e1);if(_0x47c51a[_0x1272('0x30')][_0x1272('0x3d')]){_0xcd4f26[_0x1272('0x3a')]=_[_0x1272('0x3e')](_0xcd4f26[_0x1272('0x3a')],{'$or':_[_0x1272('0x2b')](_0x3dc9e1,function(_0x478066){if(_0x478066[_0x1272('0x3f')]!==_0x1272('0x40')){var _0x416b47={};_0x416b47[_0x478066['name']]={'$like':'%'+_0x47c51a[_0x1272('0x30')][_0x1272('0x3d')]+'%'};return _0x416b47;}})});}_0xcd4f26=_['merge']({},_0xcd4f26,_0x47c51a[_0x1272('0x41')]);var _0x480798={'where':_0xcd4f26['where']};return db[_0x1272('0x2c')][_0x1272('0x1f')](_0x480798)[_0x1272('0x27')](function(_0x1bca54){_0x4b159c[_0x1272('0x1f')]=_0x1bca54;if(_0x47c51a[_0x1272('0x30')][_0x1272('0x42')]){_0xcd4f26[_0x1272('0x43')]=[{'all':!![]}];}return db[_0x1272('0x2c')]['findAll'](_0xcd4f26);})[_0x1272('0x27')](function(_0x454c66){_0x4b159c[_0x1272('0x44')]=_0x454c66;return _0x4b159c;})['then'](respondWithFilteredResult(_0x3cf2c7,_0xcd4f26))['catch'](handleError(_0x3cf2c7,null));};exports[_0x1272('0x45')]=function(_0x1fe3de,_0x58d46d){var _0x33dee0={'raw':!![],'where':{'id':_0x1fe3de['params']['id']}},_0xe69223={};_0xe69223['model']=_['keys'](db[_0x1272('0x2c')]['rawAttributes']);_0xe69223[_0x1272('0x30')]=_[_0x1272('0x31')](_0x1fe3de[_0x1272('0x30')]);_0xe69223[_0x1272('0x3b')]=_[_0x1272('0x32')](_0xe69223['model'],_0xe69223[_0x1272('0x30')]);_0x33dee0[_0x1272('0x34')]=_[_0x1272('0x32')](_0xe69223[_0x1272('0x2f')],qs[_0x1272('0x33')](_0x1fe3de[_0x1272('0x30')][_0x1272('0x33')]));_0x33dee0[_0x1272('0x34')]=_0x33dee0[_0x1272('0x34')][_0x1272('0x35')]?_0x33dee0[_0x1272('0x34')]:_0xe69223[_0x1272('0x2f')];if(_0x1fe3de['query']['includeAll']){_0x33dee0[_0x1272('0x43')]=[{'all':!![]}];}_0x33dee0=_[_0x1272('0x3e')]({},_0x33dee0,_0x1fe3de['options']);return db[_0x1272('0x2c')][_0x1272('0x46')](_0x33dee0)[_0x1272('0x27')](handleEntityNotFound(_0x58d46d,null))[_0x1272('0x27')](respondWithResult(_0x58d46d,null))[_0x1272('0x47')](handleError(_0x58d46d,null));};exports[_0x1272('0x48')]=function(_0x22f536,_0x148e80){return db[_0x1272('0x2c')][_0x1272('0x48')](_0x22f536[_0x1272('0x49')],{})[_0x1272('0x27')](respondWithResult(_0x148e80,0xc9))[_0x1272('0x47')](handleError(_0x148e80,null));};exports[_0x1272('0x25')]=function(_0x4f0dba,_0x51c6c0){if(_0x4f0dba['body']['id']){delete _0x4f0dba[_0x1272('0x49')]['id'];}return db['OpenchannelTransferReport']['find']({'where':{'id':_0x4f0dba['params']['id']}})[_0x1272('0x27')](handleEntityNotFound(_0x51c6c0,null))['then'](saveUpdates(_0x4f0dba[_0x1272('0x49')],null))[_0x1272('0x27')](respondWithResult(_0x51c6c0,null))[_0x1272('0x47')](handleError(_0x51c6c0,null));};exports[_0x1272('0x26')]=function(_0x3cc266,_0x3d2475){return db[_0x1272('0x2c')][_0x1272('0x46')]({'where':{'id':_0x3cc266[_0x1272('0x4a')]['id']}})[_0x1272('0x27')](handleEntityNotFound(_0x3d2475,null))[_0x1272('0x27')](removeEntity(_0x3d2475,null))['catch'](handleError(_0x3d2475,null));};exports[_0x1272('0x4b')]=function(_0x1b7025,_0x2312fc){return db['OpenchannelTransferReport'][_0x1272('0x4b')]()[_0x1272('0x27')](respondWithResult(_0x2312fc,null))['catch'](handleError(_0x2312fc,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 171b043..d947b15 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 _0xc3af=['OpenchannelTransferReport','report_openchannel_transfer','uniqueid','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xc3af,0x1ed));var _0xfc3a=function(_0xbec8e6,_0x2841b5){_0xbec8e6=_0xbec8e6-0x0;var _0x4aa6f2=_0xc3af[_0xbec8e6];return _0x4aa6f2;};'use strict';var _=require('lodash');var util=require(_0xfc3a('0x0'));var logger=require(_0xfc3a('0x1'))(_0xfc3a('0x2'));var moment=require(_0xfc3a('0x3'));var BPromise=require('bluebird');var rp=require(_0xfc3a('0x4'));var fs=require('fs');var path=require(_0xfc3a('0x5'));var rimraf=require(_0xfc3a('0x6'));var config=require(_0xfc3a('0x7'));var attributes=require(_0xfc3a('0x8'));module[_0xfc3a('0x9')]=function(_0x5b9801,_0x20ad00){return _0x5b9801[_0xfc3a('0xa')](_0xfc3a('0xb'),attributes,{'tableName':_0xfc3a('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xfc3a('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2a51=['OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','api','moment','request-promise','../../config/environment','./openchannelTransferReport.attributes','exports','define'];(function(_0x584d66,_0x596890){var _0x2e8f1c=function(_0x58afac){while(--_0x58afac){_0x584d66['push'](_0x584d66['shift']());}};_0x2e8f1c(++_0x596890);}(_0x2a51,0x1d7));var _0x12a5=function(_0x3f1431,_0x361a12){_0x3f1431=_0x3f1431-0x0;var _0x3e780f=_0x2a51[_0x3f1431];return _0x3e780f;};'use strict';var _=require(_0x12a5('0x0'));var util=require(_0x12a5('0x1'));var logger=require('../../config/logger')(_0x12a5('0x2'));var moment=require(_0x12a5('0x3'));var BPromise=require('bluebird');var rp=require(_0x12a5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x12a5('0x5'));var attributes=require(_0x12a5('0x6'));module[_0x12a5('0x7')]=function(_0x30adef,_0x55214c){return _0x30adef[_0x12a5('0x8')](_0x12a5('0x9'),attributes,{'tableName':_0x12a5('0xa'),'paranoid':![],'indexes':[{'name':_0x12a5('0xb'),'fields':[_0x12a5('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 3a9f541..66accab 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 _0x02a7=['../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','OpenchannelTransferReport,\x20%s,\x20%s','message','result','util','randomstring','ioredis','../../mysqldb'];(function(_0xc0e74b,_0x4792f5){var _0x141d3c=function(_0x154848){while(--_0x154848){_0xc0e74b['push'](_0xc0e74b['shift']());}};_0x141d3c(++_0x4792f5);}(_0x02a7,0x7a));var _0x702a=function(_0x3b2f79,_0x6a7b4d){_0x3b2f79=_0x3b2f79-0x0;var _0x26e44e=_0x02a7[_0x3b2f79];return _0x26e44e;};'use strict';var _=require('lodash');var util=require(_0x702a('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x702a('0x1'));var fs=require('fs');var Redis=require(_0x702a('0x2'));var db=require(_0x702a('0x3'))['db'];var utils=require(_0x702a('0x4'));var logger=require(_0x702a('0x5'))(_0x702a('0x6'));var config=require(_0x702a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x702a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x26b25e,_0x1aa2c2,_0x3f2954){return new BPromise(function(_0x161dee,_0x430cf3){return client[_0x702a('0x9')](_0x26b25e,_0x3f2954)[_0x702a('0xa')](function(_0x48469e){logger[_0x702a('0xb')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x1aa2c2,'request\x20sent');logger[_0x702a('0xc')](_0x702a('0xd'),_0x1aa2c2,_0x702a('0xe'),JSON[_0x702a('0xf')](_0x48469e));if(_0x48469e['error']){if(_0x48469e[_0x702a('0x10')][_0x702a('0x11')]===0x1f4){logger[_0x702a('0x10')](_0x702a('0x12'),_0x1aa2c2,_0x48469e[_0x702a('0x10')][_0x702a('0x13')]);return _0x430cf3(_0x48469e[_0x702a('0x10')]['message']);}logger['error'](_0x702a('0x12'),_0x1aa2c2,_0x48469e['error']['message']);return _0x161dee(_0x48469e['error']['message']);}else{logger['info'](_0x702a('0x12'),_0x1aa2c2,_0x702a('0xe'));_0x161dee(_0x48469e[_0x702a('0x14')]['message']);}})['catch'](function(_0x506772){logger[_0x702a('0x10')](_0x702a('0x12'),_0x1aa2c2,_0x506772);_0x430cf3(_0x506772);});});} \ No newline at end of file +var _0x078c=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','code','error','OpenchannelTransferReport,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird'];(function(_0x24ac52,_0x33f5b8){var _0x4f4f21=function(_0x4dfe2c){while(--_0x4dfe2c){_0x24ac52['push'](_0x24ac52['shift']());}};_0x4f4f21(++_0x33f5b8);}(_0x078c,0x19f));var _0xc078=function(_0x30bd66,_0x36a93d){_0x30bd66=_0x30bd66-0x0;var _0x74c9dd=_0x078c[_0x30bd66];return _0x74c9dd;};'use strict';var _=require(_0xc078('0x0'));var util=require('util');var moment=require(_0xc078('0x1'));var BPromise=require(_0xc078('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc078('0x3'));var db=require(_0xc078('0x4'))['db'];var utils=require(_0xc078('0x5'));var logger=require(_0xc078('0x6'))('rpc');var config=require(_0xc078('0x7'));var jayson=require(_0xc078('0x8'));var client=jayson[_0xc078('0x9')][_0xc078('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x40e428,_0x1705b0,_0x22661e){return new BPromise(function(_0x4030b1,_0x4d56df){return client['request'](_0x40e428,_0x22661e)['then'](function(_0x28dc54){logger[_0xc078('0xb')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x1705b0,_0xc078('0xc'));logger[_0xc078('0xd')](_0xc078('0xe'),_0x1705b0,_0xc078('0xc'),JSON[_0xc078('0xf')](_0x28dc54));if(_0x28dc54['error']){if(_0x28dc54['error'][_0xc078('0x10')]===0x1f4){logger[_0xc078('0x11')](_0xc078('0x12'),_0x1705b0,_0x28dc54[_0xc078('0x11')][_0xc078('0x13')]);return _0x4d56df(_0x28dc54[_0xc078('0x11')][_0xc078('0x13')]);}logger[_0xc078('0x11')](_0xc078('0x12'),_0x1705b0,_0x28dc54[_0xc078('0x11')][_0xc078('0x13')]);return _0x4030b1(_0x28dc54[_0xc078('0x11')][_0xc078('0x13')]);}else{logger[_0xc078('0xb')](_0xc078('0x12'),_0x1705b0,'request\x20sent');_0x4030b1(_0x28dc54[_0xc078('0x14')][_0xc078('0x13')]);}})[_0xc078('0x15')](function(_0x595b14){logger[_0xc078('0x11')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x1705b0,_0x595b14);_0x4d56df(_0x595b14);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 840572a..65a81bd 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 _0xc922=['isAuthenticated','show','post','put','update','delete','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id'];(function(_0x39e71b,_0x1514e6){var _0x10e46f=function(_0x4548a4){while(--_0x4548a4){_0x39e71b['push'](_0x39e71b['shift']());}};_0x10e46f(++_0x1514e6);}(_0xc922,0x1b0));var _0x2c92=function(_0x3c5e09,_0x351c27){_0x3c5e09=_0x3c5e09-0x0;var _0x278b2a=_0xc922[_0x3c5e09];return _0x278b2a;};'use strict';var multer=require('multer');var util=require(_0x2c92('0x0'));var path=require('path');var timeout=require(_0x2c92('0x1'));var express=require(_0x2c92('0x2'));var router=express['Router']();var fs_extra=require(_0x2c92('0x3'));var auth=require(_0x2c92('0x4'));var interaction=require(_0x2c92('0x5'));var config=require(_0x2c92('0x6'));var controller=require('./pause.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x2c92('0x7')]);router[_0x2c92('0x8')](_0x2c92('0x9'),auth[_0x2c92('0xa')](),controller[_0x2c92('0xb')]);router[_0x2c92('0xc')]('/',auth[_0x2c92('0xa')](),controller['create']);router[_0x2c92('0xd')]('/:id',auth[_0x2c92('0xa')](),controller[_0x2c92('0xe')]);router[_0x2c92('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x2c92('0x10')]=router; \ No newline at end of file +var _0x7efa=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','index','/:id','show','post','create','delete','destroy','exports','multer'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x7efa,0x68));var _0xa7ef=function(_0xadde88,_0x58ad47){_0xadde88=_0xadde88-0x0;var _0x3b8eb6=_0x7efa[_0xadde88];return _0x3b8eb6;};'use strict';var multer=require(_0xa7ef('0x0'));var util=require(_0xa7ef('0x1'));var path=require(_0xa7ef('0x2'));var timeout=require(_0xa7ef('0x3'));var express=require(_0xa7ef('0x4'));var router=express[_0xa7ef('0x5')]();var fs_extra=require(_0xa7ef('0x6'));var auth=require(_0xa7ef('0x7'));var interaction=require(_0xa7ef('0x8'));var config=require(_0xa7ef('0x9'));var controller=require(_0xa7ef('0xa'));router[_0xa7ef('0xb')]('/',auth[_0xa7ef('0xc')](),controller[_0xa7ef('0xd')]);router['get'](_0xa7ef('0xe'),auth[_0xa7ef('0xc')](),controller[_0xa7ef('0xf')]);router[_0xa7ef('0x10')]('/',auth[_0xa7ef('0xc')](),controller[_0xa7ef('0x11')]);router['put'](_0xa7ef('0xe'),auth[_0xa7ef('0xc')](),controller['update']);router[_0xa7ef('0x12')]('/:id',auth[_0xa7ef('0xc')](),controller[_0xa7ef('0x13')]);module[_0xa7ef('0x14')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index e97ff32..0cb4c25 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 _0xfba9=['name','sequelize','STRING'];(function(_0x4d1dfc,_0x253877){var _0x5d611a=function(_0x400dbf){while(--_0x400dbf){_0x4d1dfc['push'](_0x4d1dfc['shift']());}};_0x5d611a(++_0x253877);}(_0xfba9,0x160));var _0x9fba=function(_0x4d7988,_0x4c62e3){_0x4d7988=_0x4d7988-0x0;var _0x97e287=_0xfba9[_0x4d7988];return _0x97e287;};'use strict';var Sequelize=require(_0x9fba('0x0'));module['exports']={'name':{'type':Sequelize[_0x9fba('0x1')],'unique':_0x9fba('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x9fba('0x1')]}}; \ No newline at end of file +var _0x1b9d=['name','STRING','exports'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x1b9d,0xa7));var _0xd1b9=function(_0xdb951d,_0x1dc42b){_0xdb951d=_0xdb951d-0x0;var _0x5e789e=_0x1b9d[_0xdb951d];return _0x5e789e;};'use strict';var Sequelize=require('sequelize');module[_0xd1b9('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xd1b9('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0xd1b9('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index a2dd468..2756f0a 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 _0x1a3d=['destroy','get','Pauses','UserProfileResource','end','error','stack','name','send','index','map','Pause','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','keys','length','find','catch','create','role','UserProfileSection','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1a3d,0x129));var _0xd1a3=function(_0x17b4a7,_0x5816fb){_0x17b4a7=_0x17b4a7-0x0;var _0x5d8597=_0x1a3d[_0x17b4a7];return _0x5d8597;};'use strict';var emlformat=require(_0xd1a3('0x0'));var rimraf=require(_0xd1a3('0x1'));var zipdir=require(_0xd1a3('0x2'));var jsonpatch=require(_0xd1a3('0x3'));var rp=require(_0xd1a3('0x4'));var moment=require(_0xd1a3('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd1a3('0x6'));var util=require(_0xd1a3('0x7'));var path=require(_0xd1a3('0x8'));var sox=require(_0xd1a3('0x9'));var csv=require('to-csv');var ejs=require(_0xd1a3('0xa'));var fs=require('fs');var fs_extra=require(_0xd1a3('0xb'));var _=require(_0xd1a3('0xc'));var squel=require(_0xd1a3('0xd'));var crypto=require(_0xd1a3('0xe'));var jsforce=require(_0xd1a3('0xf'));var deskjs=require(_0xd1a3('0x10'));var toCsv=require(_0xd1a3('0x11'));var querystring=require(_0xd1a3('0x12'));var Papa=require('papaparse');var Redis=require(_0xd1a3('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd1a3('0x14'));var logger=require(_0xd1a3('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xd1a3('0x16'));var licenseUtil=require(_0xd1a3('0x17'));var db=require(_0xd1a3('0x18'))['db'];function respondWithStatusCode(_0x31916d,_0x12239c){_0x12239c=_0x12239c||0xcc;return function(_0x4f6c27){if(_0x4f6c27){return _0x31916d[_0xd1a3('0x19')](_0x12239c);}return _0x31916d[_0xd1a3('0x1a')](_0x12239c)['end']();};}function respondWithResult(_0x37dfc0,_0x32407a){_0x32407a=_0x32407a||0xc8;return function(_0x36dd05){if(_0x36dd05){return _0x37dfc0[_0xd1a3('0x1a')](_0x32407a)[_0xd1a3('0x1b')](_0x36dd05);}};}function respondWithFilteredResult(_0x53df78,_0x52a8df){return function(_0x5b8689){if(_0x5b8689){var _0x9e298e=typeof _0x52a8df[_0xd1a3('0x1c')]===_0xd1a3('0x1d')&&typeof _0x52a8df[_0xd1a3('0x1e')]===_0xd1a3('0x1d');var _0x500766=_0x5b8689[_0xd1a3('0x1f')];var _0x38f4fc=_0x9e298e?0x0:_0x52a8df[_0xd1a3('0x1c')];var _0x442f36=_0x9e298e?_0x5b8689[_0xd1a3('0x1f')]:_0x52a8df['offset']+_0x52a8df[_0xd1a3('0x1e')];var _0x2dff2a;if(_0x442f36>=_0x500766){_0x442f36=_0x500766;_0x2dff2a=0xc8;}else{_0x2dff2a=0xce;}_0x53df78['status'](_0x2dff2a);return _0x53df78[_0xd1a3('0x20')](_0xd1a3('0x21'),_0x38f4fc+'-'+_0x442f36+'/'+_0x500766)['json'](_0x5b8689);}return null;};}function patchUpdates(_0x177514){return function(_0x453331){try{jsonpatch[_0xd1a3('0x22')](_0x453331,_0x177514,!![]);}catch(_0x4f1d0b){return BPromise[_0xd1a3('0x23')](_0x4f1d0b);}return _0x453331[_0xd1a3('0x24')]();};}function saveUpdates(_0x4577c0,_0x10bfc6){return function(_0x26e691){if(_0x26e691){return _0x26e691[_0xd1a3('0x25')](_0x4577c0)[_0xd1a3('0x26')](function(_0x28e600){return _0x28e600;});}return null;};}function removeEntity(_0x3467d0,_0x57c26e){return function(_0x381221){if(_0x381221){return _0x381221[_0xd1a3('0x27')]()['then'](function(){var _0x18a5ef=_0x381221[_0xd1a3('0x28')]({'plain':!![]});var _0xf03b6a=_0xd1a3('0x29');return db[_0xd1a3('0x2a')][_0xd1a3('0x27')]({'where':{'type':_0xf03b6a,'resourceId':_0x18a5ef['id']}})[_0xd1a3('0x26')](function(){return _0x381221;});})[_0xd1a3('0x26')](function(){_0x3467d0[_0xd1a3('0x1a')](0xcc)[_0xd1a3('0x2b')]();});}};}function handleEntityNotFound(_0x4202ed,_0x1c9ad0){return function(_0x464b37){if(!_0x464b37){_0x4202ed[_0xd1a3('0x19')](0x194);}return _0x464b37;};}function handleError(_0x64aa46,_0x517f8d){_0x517f8d=_0x517f8d||0x1f4;return function(_0x53d6cc){logger[_0xd1a3('0x2c')](_0x53d6cc[_0xd1a3('0x2d')]);if(_0x53d6cc['name']){delete _0x53d6cc[_0xd1a3('0x2e')];}_0x64aa46[_0xd1a3('0x1a')](_0x517f8d)[_0xd1a3('0x2f')](_0x53d6cc);};}exports[_0xd1a3('0x30')]=function(_0x772b5c,_0x3c720d){var _0x51da64={},_0x4f461d={},_0x11ab91={'count':0x0,'rows':[]};var _0x10caa8=_[_0xd1a3('0x31')](db[_0xd1a3('0x32')][_0xd1a3('0x33')],function(_0x4db474){return{'name':_0x4db474[_0xd1a3('0x34')],'type':_0x4db474[_0xd1a3('0x35')][_0xd1a3('0x36')]};});_0x4f461d[_0xd1a3('0x37')]=_['map'](_0x10caa8,_0xd1a3('0x2e'));_0x4f461d['query']=_['keys'](_0x772b5c[_0xd1a3('0x38')]);_0x4f461d['filters']=_[_0xd1a3('0x39')](_0x4f461d[_0xd1a3('0x37')],_0x4f461d[_0xd1a3('0x38')]);_0x51da64['attributes']=_['intersection'](_0x4f461d[_0xd1a3('0x37')],qs[_0xd1a3('0x3a')](_0x772b5c['query']['fields']));_0x51da64[_0xd1a3('0x3b')]=_0x51da64['attributes']['length']?_0x51da64[_0xd1a3('0x3b')]:_0x4f461d[_0xd1a3('0x37')];if(!_0x772b5c['query']['hasOwnProperty'](_0xd1a3('0x3c'))){_0x51da64[_0xd1a3('0x1e')]=qs['limit'](_0x772b5c['query']['limit']);_0x51da64['offset']=qs[_0xd1a3('0x1c')](_0x772b5c[_0xd1a3('0x38')][_0xd1a3('0x1c')]);}_0x51da64[_0xd1a3('0x3d')]=qs[_0xd1a3('0x3e')](_0x772b5c[_0xd1a3('0x38')][_0xd1a3('0x3e')]);_0x51da64[_0xd1a3('0x3f')]=qs[_0xd1a3('0x40')](_[_0xd1a3('0x41')](_0x772b5c[_0xd1a3('0x38')],_0x4f461d[_0xd1a3('0x40')]),_0x10caa8);if(_0x772b5c[_0xd1a3('0x38')]['filter']){_0x51da64[_0xd1a3('0x3f')]=_[_0xd1a3('0x42')](_0x51da64[_0xd1a3('0x3f')],{'$or':_[_0xd1a3('0x31')](_0x10caa8,function(_0x537a1e){if(_0x537a1e[_0xd1a3('0x35')]!==_0xd1a3('0x43')){var _0x3dc69b={};_0x3dc69b[_0x537a1e[_0xd1a3('0x2e')]]={'$like':'%'+_0x772b5c['query'][_0xd1a3('0x44')]+'%'};return _0x3dc69b;}})});}_0x51da64=_[_0xd1a3('0x42')]({},_0x51da64,_0x772b5c[_0xd1a3('0x45')]);var _0x4583bb={'where':_0x51da64[_0xd1a3('0x3f')]};return db[_0xd1a3('0x32')][_0xd1a3('0x1f')](_0x4583bb)[_0xd1a3('0x26')](function(_0x21e035){_0x11ab91[_0xd1a3('0x1f')]=_0x21e035;if(_0x772b5c[_0xd1a3('0x38')][_0xd1a3('0x46')]){_0x51da64[_0xd1a3('0x47')]=[{'all':!![]}];}return db['Pause'][_0xd1a3('0x48')](_0x51da64);})[_0xd1a3('0x26')](function(_0x3b62dd){_0x11ab91[_0xd1a3('0x49')]=_0x3b62dd;return _0x11ab91;})[_0xd1a3('0x26')](respondWithFilteredResult(_0x3c720d,_0x51da64))['catch'](handleError(_0x3c720d,null));};exports[_0xd1a3('0x4a')]=function(_0x10ecdd,_0xdafe58){var _0x1162f1={'raw':!![],'where':{'id':_0x10ecdd[_0xd1a3('0x4b')]['id']}},_0x1b3f8e={};_0x1b3f8e[_0xd1a3('0x37')]=_[_0xd1a3('0x4c')](db['Pause']['rawAttributes']);_0x1b3f8e[_0xd1a3('0x38')]=_[_0xd1a3('0x4c')](_0x10ecdd[_0xd1a3('0x38')]);_0x1b3f8e[_0xd1a3('0x40')]=_[_0xd1a3('0x39')](_0x1b3f8e[_0xd1a3('0x37')],_0x1b3f8e[_0xd1a3('0x38')]);_0x1162f1[_0xd1a3('0x3b')]=_['intersection'](_0x1b3f8e[_0xd1a3('0x37')],qs['fields'](_0x10ecdd[_0xd1a3('0x38')]['fields']));_0x1162f1[_0xd1a3('0x3b')]=_0x1162f1[_0xd1a3('0x3b')][_0xd1a3('0x4d')]?_0x1162f1[_0xd1a3('0x3b')]:_0x1b3f8e[_0xd1a3('0x37')];if(_0x10ecdd[_0xd1a3('0x38')][_0xd1a3('0x46')]){_0x1162f1['include']=[{'all':!![]}];}_0x1162f1=_[_0xd1a3('0x42')]({},_0x1162f1,_0x10ecdd['options']);return db[_0xd1a3('0x32')][_0xd1a3('0x4e')](_0x1162f1)[_0xd1a3('0x26')](handleEntityNotFound(_0xdafe58,null))[_0xd1a3('0x26')](respondWithResult(_0xdafe58,null))[_0xd1a3('0x4f')](handleError(_0xdafe58,null));};exports[_0xd1a3('0x50')]=function(_0x52225b,_0x2c62a8){return db[_0xd1a3('0x32')][_0xd1a3('0x50')](_0x52225b['body'],{})[_0xd1a3('0x26')](function(_0x2edf74){var _0x120c22=_0x52225b['user'][_0xd1a3('0x28')]({'plain':!![]});if(!_0x120c22)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x120c22[_0xd1a3('0x51')]==='user'){var _0x5dbbe6=_0x2edf74[_0xd1a3('0x28')]({'plain':!![]});var _0x35bd16=_0xd1a3('0x29');return db[_0xd1a3('0x52')][_0xd1a3('0x4e')]({'where':{'name':_0x35bd16,'userProfileId':_0x120c22['userProfileId']},'raw':!![]})[_0xd1a3('0x26')](function(_0x2e86d7){if(_0x2e86d7&&_0x2e86d7['autoAssociation']===0x0){return db[_0xd1a3('0x2a')][_0xd1a3('0x50')]({'name':_0x5dbbe6['name'],'resourceId':_0x5dbbe6['id'],'type':_0x2e86d7[_0xd1a3('0x2e')],'sectionId':_0x2e86d7['id']},{})[_0xd1a3('0x26')](function(){return _0x2edf74;});}else{return _0x2edf74;}})[_0xd1a3('0x4f')](function(_0x2dfe42){logger[_0xd1a3('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2dfe42);throw _0x2dfe42;});}return _0x2edf74;})[_0xd1a3('0x26')](respondWithResult(_0x2c62a8,0xc9))[_0xd1a3('0x4f')](handleError(_0x2c62a8,null));};exports[_0xd1a3('0x25')]=function(_0x5cea79,_0x47dcb6){if(_0x5cea79['body']['id']){delete _0x5cea79[_0xd1a3('0x53')]['id'];}return db[_0xd1a3('0x32')][_0xd1a3('0x4e')]({'where':{'id':_0x5cea79[_0xd1a3('0x4b')]['id']}})[_0xd1a3('0x26')](handleEntityNotFound(_0x47dcb6,null))[_0xd1a3('0x26')](saveUpdates(_0x5cea79[_0xd1a3('0x53')],null))[_0xd1a3('0x26')](respondWithResult(_0x47dcb6,null))[_0xd1a3('0x4f')](handleError(_0x47dcb6,null));};exports[_0xd1a3('0x27')]=function(_0x58e0b6,_0x1f3da2){return db[_0xd1a3('0x32')][_0xd1a3('0x4e')]({'where':{'id':_0x58e0b6[_0xd1a3('0x4b')]['id']}})[_0xd1a3('0x26')](handleEntityNotFound(_0x1f3da2,null))[_0xd1a3('0x26')](removeEntity(_0x1f3da2,null))[_0xd1a3('0x4f')](handleError(_0x1f3da2,null));}; \ No newline at end of file +var _0x3c73=['fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','params','rawAttributes','includeAll','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','update','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','Pauses','UserProfileResource','end','error','stack','name','send','map','Pause','type','key','model','query','filters','intersection','attributes'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x3c73,0x163));var _0x33c7=function(_0x272127,_0x2b458e){_0x272127=_0x272127-0x0;var _0x64ed4f=_0x3c73[_0x272127];return _0x64ed4f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x33c7('0x0'));var jsonpatch=require(_0x33c7('0x1'));var rp=require(_0x33c7('0x2'));var moment=require(_0x33c7('0x3'));var BPromise=require(_0x33c7('0x4'));var Mustache=require(_0x33c7('0x5'));var util=require('util');var path=require(_0x33c7('0x6'));var sox=require(_0x33c7('0x7'));var csv=require('to-csv');var ejs=require(_0x33c7('0x8'));var fs=require('fs');var fs_extra=require(_0x33c7('0x9'));var _=require(_0x33c7('0xa'));var squel=require(_0x33c7('0xb'));var crypto=require('crypto');var jsforce=require(_0x33c7('0xc'));var deskjs=require(_0x33c7('0xd'));var toCsv=require(_0x33c7('0xe'));var querystring=require(_0x33c7('0xf'));var Papa=require(_0x33c7('0x10'));var Redis=require(_0x33c7('0x11'));var authService=require(_0x33c7('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x33c7('0x13'));var hardwareService=require(_0x33c7('0x14'));var logger=require('../../config/logger')(_0x33c7('0x15'));var utils=require(_0x33c7('0x16'));var config=require(_0x33c7('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x33c7('0x18'))['db'];function respondWithStatusCode(_0x2a50e8,_0x1c0eec){_0x1c0eec=_0x1c0eec||0xcc;return function(_0x6145d7){if(_0x6145d7){return _0x2a50e8[_0x33c7('0x19')](_0x1c0eec);}return _0x2a50e8[_0x33c7('0x1a')](_0x1c0eec)['end']();};}function respondWithResult(_0xbf64a2,_0x193006){_0x193006=_0x193006||0xc8;return function(_0x58d370){if(_0x58d370){return _0xbf64a2[_0x33c7('0x1a')](_0x193006)[_0x33c7('0x1b')](_0x58d370);}};}function respondWithFilteredResult(_0x53076f,_0x3f1309){return function(_0x2ab6ef){if(_0x2ab6ef){var _0x82bc01=typeof _0x3f1309[_0x33c7('0x1c')]==='undefined'&&typeof _0x3f1309[_0x33c7('0x1d')]===_0x33c7('0x1e');var _0x18301b=_0x2ab6ef[_0x33c7('0x1f')];var _0x379735=_0x82bc01?0x0:_0x3f1309[_0x33c7('0x1c')];var _0x336fd3=_0x82bc01?_0x2ab6ef[_0x33c7('0x1f')]:_0x3f1309[_0x33c7('0x1c')]+_0x3f1309[_0x33c7('0x1d')];var _0x5b5e5d;if(_0x336fd3>=_0x18301b){_0x336fd3=_0x18301b;_0x5b5e5d=0xc8;}else{_0x5b5e5d=0xce;}_0x53076f[_0x33c7('0x1a')](_0x5b5e5d);return _0x53076f[_0x33c7('0x20')](_0x33c7('0x21'),_0x379735+'-'+_0x336fd3+'/'+_0x18301b)[_0x33c7('0x1b')](_0x2ab6ef);}return null;};}function patchUpdates(_0x3b6333){return function(_0x40f1f7){try{jsonpatch[_0x33c7('0x22')](_0x40f1f7,_0x3b6333,!![]);}catch(_0x3ef444){return BPromise[_0x33c7('0x23')](_0x3ef444);}return _0x40f1f7[_0x33c7('0x24')]();};}function saveUpdates(_0x21221f,_0x8c5c2b){return function(_0x47e461){if(_0x47e461){return _0x47e461['update'](_0x21221f)[_0x33c7('0x25')](function(_0xfc5e22){return _0xfc5e22;});}return null;};}function removeEntity(_0x22f949,_0x2395fa){return function(_0xb23ec4){if(_0xb23ec4){return _0xb23ec4[_0x33c7('0x26')]()[_0x33c7('0x25')](function(){var _0x3f2710=_0xb23ec4['get']({'plain':!![]});var _0x423fc7=_0x33c7('0x27');return db[_0x33c7('0x28')][_0x33c7('0x26')]({'where':{'type':_0x423fc7,'resourceId':_0x3f2710['id']}})[_0x33c7('0x25')](function(){return _0xb23ec4;});})[_0x33c7('0x25')](function(){_0x22f949[_0x33c7('0x1a')](0xcc)[_0x33c7('0x29')]();});}};}function handleEntityNotFound(_0x4b4e4f,_0x356a4a){return function(_0x59e5bd){if(!_0x59e5bd){_0x4b4e4f[_0x33c7('0x19')](0x194);}return _0x59e5bd;};}function handleError(_0x3a4be2,_0x185c4a){_0x185c4a=_0x185c4a||0x1f4;return function(_0x5a34e1){logger[_0x33c7('0x2a')](_0x5a34e1[_0x33c7('0x2b')]);if(_0x5a34e1[_0x33c7('0x2c')]){delete _0x5a34e1[_0x33c7('0x2c')];}_0x3a4be2[_0x33c7('0x1a')](_0x185c4a)[_0x33c7('0x2d')](_0x5a34e1);};}exports['index']=function(_0x3472a3,_0x63459e){var _0x1d7135={},_0x351b7a={},_0x105133={'count':0x0,'rows':[]};var _0x2e068e=_[_0x33c7('0x2e')](db[_0x33c7('0x2f')]['rawAttributes'],function(_0x3ef7aa){return{'name':_0x3ef7aa['fieldName'],'type':_0x3ef7aa[_0x33c7('0x30')][_0x33c7('0x31')]};});_0x351b7a[_0x33c7('0x32')]=_[_0x33c7('0x2e')](_0x2e068e,_0x33c7('0x2c'));_0x351b7a[_0x33c7('0x33')]=_['keys'](_0x3472a3[_0x33c7('0x33')]);_0x351b7a[_0x33c7('0x34')]=_[_0x33c7('0x35')](_0x351b7a[_0x33c7('0x32')],_0x351b7a['query']);_0x1d7135[_0x33c7('0x36')]=_['intersection'](_0x351b7a[_0x33c7('0x32')],qs[_0x33c7('0x37')](_0x3472a3[_0x33c7('0x33')][_0x33c7('0x37')]));_0x1d7135[_0x33c7('0x36')]=_0x1d7135['attributes'][_0x33c7('0x38')]?_0x1d7135[_0x33c7('0x36')]:_0x351b7a[_0x33c7('0x32')];if(!_0x3472a3['query'][_0x33c7('0x39')](_0x33c7('0x3a'))){_0x1d7135[_0x33c7('0x1d')]=qs[_0x33c7('0x1d')](_0x3472a3['query'][_0x33c7('0x1d')]);_0x1d7135['offset']=qs[_0x33c7('0x1c')](_0x3472a3[_0x33c7('0x33')]['offset']);}_0x1d7135[_0x33c7('0x3b')]=qs[_0x33c7('0x3c')](_0x3472a3[_0x33c7('0x33')][_0x33c7('0x3c')]);_0x1d7135[_0x33c7('0x3d')]=qs['filters'](_[_0x33c7('0x3e')](_0x3472a3['query'],_0x351b7a[_0x33c7('0x34')]),_0x2e068e);if(_0x3472a3[_0x33c7('0x33')][_0x33c7('0x3f')]){_0x1d7135[_0x33c7('0x3d')]=_['merge'](_0x1d7135[_0x33c7('0x3d')],{'$or':_[_0x33c7('0x2e')](_0x2e068e,function(_0x16facf){if(_0x16facf[_0x33c7('0x30')]!==_0x33c7('0x40')){var _0x26b145={};_0x26b145[_0x16facf[_0x33c7('0x2c')]]={'$like':'%'+_0x3472a3[_0x33c7('0x33')][_0x33c7('0x3f')]+'%'};return _0x26b145;}})});}_0x1d7135=_[_0x33c7('0x41')]({},_0x1d7135,_0x3472a3[_0x33c7('0x42')]);var _0x283d10={'where':_0x1d7135[_0x33c7('0x3d')]};return db['Pause'][_0x33c7('0x1f')](_0x283d10)[_0x33c7('0x25')](function(_0x5c8043){_0x105133[_0x33c7('0x1f')]=_0x5c8043;if(_0x3472a3[_0x33c7('0x33')]['includeAll']){_0x1d7135[_0x33c7('0x43')]=[{'all':!![]}];}return db[_0x33c7('0x2f')][_0x33c7('0x44')](_0x1d7135);})[_0x33c7('0x25')](function(_0x12c43d){_0x105133['rows']=_0x12c43d;return _0x105133;})[_0x33c7('0x25')](respondWithFilteredResult(_0x63459e,_0x1d7135))['catch'](handleError(_0x63459e,null));};exports['show']=function(_0x282f75,_0x1a30c2){var _0x4c8d2d={'raw':!![],'where':{'id':_0x282f75[_0x33c7('0x45')]['id']}},_0x31deb4={};_0x31deb4[_0x33c7('0x32')]=_['keys'](db[_0x33c7('0x2f')][_0x33c7('0x46')]);_0x31deb4[_0x33c7('0x33')]=_['keys'](_0x282f75[_0x33c7('0x33')]);_0x31deb4[_0x33c7('0x34')]=_['intersection'](_0x31deb4['model'],_0x31deb4[_0x33c7('0x33')]);_0x4c8d2d['attributes']=_[_0x33c7('0x35')](_0x31deb4[_0x33c7('0x32')],qs[_0x33c7('0x37')](_0x282f75[_0x33c7('0x33')][_0x33c7('0x37')]));_0x4c8d2d[_0x33c7('0x36')]=_0x4c8d2d[_0x33c7('0x36')]['length']?_0x4c8d2d['attributes']:_0x31deb4[_0x33c7('0x32')];if(_0x282f75[_0x33c7('0x33')][_0x33c7('0x47')]){_0x4c8d2d[_0x33c7('0x43')]=[{'all':!![]}];}_0x4c8d2d=_[_0x33c7('0x41')]({},_0x4c8d2d,_0x282f75['options']);return db[_0x33c7('0x2f')][_0x33c7('0x48')](_0x4c8d2d)[_0x33c7('0x25')](handleEntityNotFound(_0x1a30c2,null))['then'](respondWithResult(_0x1a30c2,null))[_0x33c7('0x49')](handleError(_0x1a30c2,null));};exports[_0x33c7('0x4a')]=function(_0x4429bc,_0x36e9c2){return db['Pause'][_0x33c7('0x4a')](_0x4429bc[_0x33c7('0x4b')],{})[_0x33c7('0x25')](function(_0x3c5ec5){var _0x34478c=_0x4429bc[_0x33c7('0x4c')][_0x33c7('0x4d')]({'plain':!![]});if(!_0x34478c)throw new Error(_0x33c7('0x4e'));if(_0x34478c[_0x33c7('0x4f')]===_0x33c7('0x4c')){var _0x5c595f=_0x3c5ec5[_0x33c7('0x4d')]({'plain':!![]});var _0x4955da=_0x33c7('0x27');return db['UserProfileSection']['find']({'where':{'name':_0x4955da,'userProfileId':_0x34478c[_0x33c7('0x50')]},'raw':!![]})[_0x33c7('0x25')](function(_0x3cc353){if(_0x3cc353&&_0x3cc353['autoAssociation']===0x0){return db[_0x33c7('0x28')][_0x33c7('0x4a')]({'name':_0x5c595f['name'],'resourceId':_0x5c595f['id'],'type':_0x3cc353[_0x33c7('0x2c')],'sectionId':_0x3cc353['id']},{})['then'](function(){return _0x3c5ec5;});}else{return _0x3c5ec5;}})[_0x33c7('0x49')](function(_0x581904){logger[_0x33c7('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x581904);throw _0x581904;});}return _0x3c5ec5;})[_0x33c7('0x25')](respondWithResult(_0x36e9c2,0xc9))[_0x33c7('0x49')](handleError(_0x36e9c2,null));};exports[_0x33c7('0x51')]=function(_0x51366d,_0xad0c70){if(_0x51366d[_0x33c7('0x4b')]['id']){delete _0x51366d[_0x33c7('0x4b')]['id'];}return db[_0x33c7('0x2f')][_0x33c7('0x48')]({'where':{'id':_0x51366d[_0x33c7('0x45')]['id']}})[_0x33c7('0x25')](handleEntityNotFound(_0xad0c70,null))['then'](saveUpdates(_0x51366d[_0x33c7('0x4b')],null))[_0x33c7('0x25')](respondWithResult(_0xad0c70,null))[_0x33c7('0x49')](handleError(_0xad0c70,null));};exports[_0x33c7('0x26')]=function(_0x271e5b,_0x12320f){return db['Pause'][_0x33c7('0x48')]({'where':{'id':_0x271e5b[_0x33c7('0x45')]['id']}})[_0x33c7('0x25')](handleEntityNotFound(_0x12320f,null))[_0x33c7('0x25')](removeEntity(_0x12320f,null))[_0x33c7('0x49')](handleError(_0x12320f,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 65ac498..753543d 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 _0xabce=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','define','tools_pauses','lodash'];(function(_0x2e89ae,_0x184867){var _0x3e65cb=function(_0x1b0d79){while(--_0x1b0d79){_0x2e89ae['push'](_0x2e89ae['shift']());}};_0x3e65cb(++_0x184867);}(_0xabce,0x103));var _0xeabc=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xabce[_0x92c450];return _0x2a9599;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var logger=require(_0xeabc('0x2'))(_0xeabc('0x3'));var moment=require(_0xeabc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeabc('0x5'));var rimraf=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var attributes=require('./pause.attributes');module['exports']=function(_0x1b07a8,_0x52a4d7){return _0x1b07a8[_0xeabc('0x8')]('Pause',attributes,{'tableName':_0xeabc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe14b=['bluebird','path','./pause.attributes','exports','define','Pause','tools_pauses','lodash','util','moment'];(function(_0x4838e6,_0x193bd9){var _0x2893ce=function(_0x4c05f7){while(--_0x4c05f7){_0x4838e6['push'](_0x4838e6['shift']());}};_0x2893ce(++_0x193bd9);}(_0xe14b,0x93));var _0xbe14=function(_0x73c054,_0x13a967){_0x73c054=_0x73c054-0x0;var _0xf62ca4=_0xe14b[_0x73c054];return _0xf62ca4;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 18a5213..f2b17ab 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x340209,_0x3f3fda){var _0x1dcef=function(_0x350558){while(--_0x350558){_0x340209['push'](_0x340209['shift']());}};_0x1dcef(++_0x3f3fda);}(_0xb10b,0x12a));var _0xbb10=function(_0xa6180a,_0x508ff9){_0xa6180a=_0xa6180a-0x0;var _0x10f626=_0xb10b[_0xa6180a];return _0x10f626;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x818f5a,_0x257ad4){var _0x4d9014=function(_0x2d51c5){while(--_0x2d51c5){_0x818f5a['push'](_0x818f5a['shift']());}};_0x4d9014(++_0x257ad4);}(_0xb10b,0x12a));var _0xbb10=function(_0x3b0d98,_0x346f06){_0x3b0d98=_0x3b0d98-0x0;var _0x296885=_0xb10b[_0x3b0d98];return _0x296885;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index bf6dc72..4c41179 100644 --- a/server/api/plugin/index.js +++ b/server/api/plugin/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0faf=['extname','now','post','single','file','webhookPost','put','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','isAuthenticated','index','get','/webhook','webhookGet','/:id','/:id/download','download','diskStorage','join','server/files/plugins','originalname','replace','basename'];(function(_0x18b191,_0x4e0684){var _0x43e146=function(_0x4b464e){while(--_0x4b464e){_0x18b191['push'](_0x18b191['shift']());}};_0x43e146(++_0x4e0684);}(_0x0faf,0x132));var _0xf0fa=function(_0x197065,_0x2e79d0){_0x197065=_0x197065-0x0;var _0x3d9404=_0x0faf[_0x197065];return _0x3d9404;};'use strict';var multer=require(_0xf0fa('0x0'));var util=require('util');var path=require(_0xf0fa('0x1'));var timeout=require(_0xf0fa('0x2'));var express=require(_0xf0fa('0x3'));var router=express[_0xf0fa('0x4')]();var fs_extra=require(_0xf0fa('0x5'));var auth=require(_0xf0fa('0x6'));var interaction=require(_0xf0fa('0x7'));var config=require(_0xf0fa('0x8'));var controller=require(_0xf0fa('0x9'));router['get']('/',auth[_0xf0fa('0xa')](),controller[_0xf0fa('0xb')]);router[_0xf0fa('0xc')](_0xf0fa('0xd'),controller[_0xf0fa('0xe')]);router['get'](_0xf0fa('0xf'),auth[_0xf0fa('0xa')](),controller['show']);router['get'](_0xf0fa('0x10'),auth[_0xf0fa('0xa')](),controller[_0xf0fa('0x11')]);var upload=multer({'storage':multer[_0xf0fa('0x12')]({'destination':function(_0x2bd807,_0x1151ea,_0x379ff6){_0x379ff6(null,path[_0xf0fa('0x13')](config['root'],_0xf0fa('0x14')));},'filename':function(_0x5b38fa,_0x2f46ff,_0x521034){_0x2f46ff[_0xf0fa('0x15')]=_0x2f46ff[_0xf0fa('0x15')][_0xf0fa('0x16')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x521034(null,util['format']('%s-%s%s',path[_0xf0fa('0x17')](_0x2f46ff['originalname'],path[_0xf0fa('0x18')](_0x2f46ff[_0xf0fa('0x15')])),Date[_0xf0fa('0x19')](),path[_0xf0fa('0x18')](_0x2f46ff[_0xf0fa('0x15')])));}})});router[_0xf0fa('0x1a')]('/',upload[_0xf0fa('0x1b')](_0xf0fa('0x1c')),controller['upload']);router[_0xf0fa('0x1a')](_0xf0fa('0xd'),controller[_0xf0fa('0x1d')]);router[_0xf0fa('0x1e')](_0xf0fa('0xf'),auth[_0xf0fa('0xa')](),controller['update']);router['delete'](_0xf0fa('0xf'),auth[_0xf0fa('0xa')](),controller[_0xf0fa('0x1f')]);module[_0xf0fa('0x20')]=router; \ No newline at end of file +var _0xb903=['replace','basename','originalname','now','extname','post','single','/webhook','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','index','webhookGet','/:id','isAuthenticated','join','root'];(function(_0x5ea58c,_0x3e6d96){var _0x4d45d0=function(_0x192308){while(--_0x192308){_0x5ea58c['push'](_0x5ea58c['shift']());}};_0x4d45d0(++_0x3e6d96);}(_0xb903,0x185));var _0x3b90=function(_0x4065df,_0x99785b){_0x4065df=_0x4065df-0x0;var _0x4dca58=_0xb903[_0x4065df];return _0x4dca58;};'use strict';var multer=require(_0x3b90('0x0'));var util=require(_0x3b90('0x1'));var path=require(_0x3b90('0x2'));var timeout=require(_0x3b90('0x3'));var express=require('express');var router=express[_0x3b90('0x4')]();var fs_extra=require(_0x3b90('0x5'));var auth=require(_0x3b90('0x6'));var interaction=require(_0x3b90('0x7'));var config=require(_0x3b90('0x8'));var controller=require(_0x3b90('0x9'));router[_0x3b90('0xa')]('/',auth['isAuthenticated'](),controller[_0x3b90('0xb')]);router['get']('/webhook',controller[_0x3b90('0xc')]);router[_0x3b90('0xa')](_0x3b90('0xd'),auth[_0x3b90('0xe')](),controller['show']);router['get']('/:id/download',auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x336913,_0x5af39c,_0x574955){_0x574955(null,path[_0x3b90('0xf')](config[_0x3b90('0x10')],'server/files/plugins'));},'filename':function(_0x45b75f,_0x174c0d,_0x43c08c){_0x174c0d['originalname']=_0x174c0d['originalname'][_0x3b90('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x43c08c(null,util['format']('%s-%s%s',path[_0x3b90('0x12')](_0x174c0d[_0x3b90('0x13')],path['extname'](_0x174c0d['originalname'])),Date[_0x3b90('0x14')](),path[_0x3b90('0x15')](_0x174c0d[_0x3b90('0x13')])));}})});router[_0x3b90('0x16')]('/',upload[_0x3b90('0x17')]('file'),controller['upload']);router[_0x3b90('0x16')](_0x3b90('0x18'),controller['webhookPost']);router[_0x3b90('0x19')](_0x3b90('0xd'),auth[_0x3b90('0xe')](),controller[_0x3b90('0x1a')]);router['delete'](_0x3b90('0xd'),auth['isAuthenticated'](),controller[_0x3b90('0x1b')]);module[_0x3b90('0x1c')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 5462ba3..f590260 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 _0x2aa5=['STRING','html','TEXT','BOOLEAN','ENUM','adminOnly','agentOnly','always','never','sequelize'];(function(_0x5ecbe8,_0x42522f){var _0x1c6e21=function(_0x593f92){while(--_0x593f92){_0x5ecbe8['push'](_0x5ecbe8['shift']());}};_0x1c6e21(++_0x42522f);}(_0x2aa5,0xdb));var _0x52aa=function(_0x284502,_0x3f325b){_0x284502=_0x284502-0x0;var _0x8d1249=_0x2aa5[_0x284502];return _0x8d1249;};'use strict';var Sequelize=require(_0x52aa('0x0'));module['exports']={'name':{'type':Sequelize[_0x52aa('0x1')]},'type':{'type':Sequelize['ENUM'](_0x52aa('0x2'),'script')},'description':{'type':Sequelize[_0x52aa('0x3')]},'version':{'type':Sequelize[_0x52aa('0x3')]},'path':{'type':Sequelize[_0x52aa('0x1')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0x52aa('0x4')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0x52aa('0x5')](_0x52aa('0x6'),_0x52aa('0x7'),_0x52aa('0x8'),_0x52aa('0x9')),'defaultValue':_0x52aa('0x8'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0x52aa('0x1')]},'adminUrl':{'type':Sequelize[_0x52aa('0x1')]},'agentUrl':{'type':Sequelize[_0x52aa('0x1')]},'scriptName':{'type':Sequelize[_0x52aa('0x1')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xfdd2=['TEXT','BOOLEAN','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','exports','STRING','ENUM','html'];(function(_0x1d2e88,_0xd590b6){var _0x1d762e=function(_0x1a337a){while(--_0x1a337a){_0x1d2e88['push'](_0x1d2e88['shift']());}};_0x1d762e(++_0xd590b6);}(_0xfdd2,0xc4));var _0x2fdd=function(_0x11ce46,_0x177a85){_0x11ce46=_0x11ce46-0x0;var _0x368a1e=_0xfdd2[_0x11ce46];return _0x368a1e;};'use strict';var Sequelize=require('sequelize');module[_0x2fdd('0x0')]={'name':{'type':Sequelize[_0x2fdd('0x1')]},'type':{'type':Sequelize[_0x2fdd('0x2')](_0x2fdd('0x3'),'script')},'description':{'type':Sequelize[_0x2fdd('0x4')]},'version':{'type':Sequelize[_0x2fdd('0x4')]},'path':{'type':Sequelize[_0x2fdd('0x1')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0x2fdd('0x5')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0x2fdd('0x2')]('adminOnly',_0x2fdd('0x6'),_0x2fdd('0x7'),_0x2fdd('0x8')),'defaultValue':_0x2fdd('0x7'),'comment':_0x2fdd('0x9')},'icon':{'type':Sequelize[_0x2fdd('0x1')]},'adminUrl':{'type':Sequelize[_0x2fdd('0x1')]},'agentUrl':{'type':Sequelize[_0x2fdd('0x1')]},'scriptName':{'type':Sequelize[_0x2fdd('0x1')]},'scriptPath':{'type':Sequelize[_0x2fdd('0x1')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 6e9d3ff..5b8d579 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 _0x39b4=['name','index','Plugin','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','keys','include','options','find','download','params','join','root','format','basename','createWriteStream','zip','warning','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','Error','pipe','glob','**/*','server/files/plugins','dirname','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','%s.zip','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','Download\x20completed','info','Temporary\x20file\x20removed','filename','file','Plugin\x20upload\x20filepath:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','Invalid\x20manifest:\x20name\x20missing','type','Invalid\x20manifest:\x20type\x20missing','version','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','Warning:\x20admin\x20view\x20not\x20specified','plugins','test','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','send','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','update','delete','webhookGet','resolve','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','json','encoding','method','%s%s','headers','content-type','endsWith','statusCode','webhookPost','\x27PATH\x27\x20parameter\x20not\x20specified','content-length','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','extract-zip','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./plugin.socket','register','end','status','offset','undefined','count','limit','set','Content-Range','apply','save','destroy','then','Plugins','sendStatus','error','stack'];(function(_0x2af361,_0x1539a3){var _0x2ad1ae=function(_0x4d8c3a){while(--_0x4d8c3a){_0x2af361['push'](_0x2af361['shift']());}};_0x2ad1ae(++_0x1539a3);}(_0x39b4,0x80));var _0x439b=function(_0x59b248,_0xb30266){_0x59b248=_0x59b248-0x0;var _0x4dfac9=_0x39b4[_0x59b248];return _0x4dfac9;};'use strict';var emlformat=require(_0x439b('0x0'));var rimraf=require(_0x439b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x439b('0x2'));var rp=require(_0x439b('0x3'));var moment=require(_0x439b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x439b('0x5'));var util=require(_0x439b('0x6'));var path=require(_0x439b('0x7'));var sox=require(_0x439b('0x8'));var csv=require(_0x439b('0x9'));var ejs=require(_0x439b('0xa'));var fs=require('fs');var fs_extra=require(_0x439b('0xb'));var _=require('lodash');var squel=require(_0x439b('0xc'));var crypto=require(_0x439b('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x439b('0xe'));var Papa=require(_0x439b('0xf'));var extract=require(_0x439b('0x10'));var rimraf=require(_0x439b('0x1'));var archiver=require('archiver');var Redis=require(_0x439b('0x11'));var authService=require(_0x439b('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x439b('0x13'));var hardwareService=require(_0x439b('0x14'));var logger=require(_0x439b('0x15'))('api');var utils=require(_0x439b('0x16'));var config=require(_0x439b('0x17'));var licenseUtil=require(_0x439b('0x18'));var db=require(_0x439b('0x19'))['db'];config['redis']=_[_0x439b('0x1a')](config[_0x439b('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x439b('0x1c'))(new Redis(config['redis']));require(_0x439b('0x1d'))[_0x439b('0x1e')](socket);function respondWithStatusCode(_0x42a787,_0x3062cc){_0x3062cc=_0x3062cc||0xcc;return function(_0x2a68d4){if(_0x2a68d4){return _0x42a787['sendStatus'](_0x3062cc);}return _0x42a787['status'](_0x3062cc)[_0x439b('0x1f')]();};}function respondWithResult(_0x23054e,_0x269a07){_0x269a07=_0x269a07||0xc8;return function(_0x2fecc7){if(_0x2fecc7){return _0x23054e[_0x439b('0x20')](_0x269a07)['json'](_0x2fecc7);}};}function respondWithFilteredResult(_0x41a809,_0x30f2a8){return function(_0x1c8af4){if(_0x1c8af4){var _0x5bf1c1=typeof _0x30f2a8[_0x439b('0x21')]===_0x439b('0x22')&&typeof _0x30f2a8['limit']===_0x439b('0x22');var _0x302022=_0x1c8af4[_0x439b('0x23')];var _0x18a839=_0x5bf1c1?0x0:_0x30f2a8[_0x439b('0x21')];var _0x1825d1=_0x5bf1c1?_0x1c8af4[_0x439b('0x23')]:_0x30f2a8[_0x439b('0x21')]+_0x30f2a8[_0x439b('0x24')];var _0x7d663;if(_0x1825d1>=_0x302022){_0x1825d1=_0x302022;_0x7d663=0xc8;}else{_0x7d663=0xce;}_0x41a809['status'](_0x7d663);return _0x41a809[_0x439b('0x25')](_0x439b('0x26'),_0x18a839+'-'+_0x1825d1+'/'+_0x302022)['json'](_0x1c8af4);}return null;};}function patchUpdates(_0x5a6dfd){return function(_0x6e473){try{jsonpatch[_0x439b('0x27')](_0x6e473,_0x5a6dfd,!![]);}catch(_0x1e11d7){return BPromise['reject'](_0x1e11d7);}return _0x6e473[_0x439b('0x28')]();};}function saveUpdates(_0x34368a,_0x2c2866){return function(_0x37c7a5){if(_0x37c7a5){return _0x37c7a5['update'](_0x34368a)['then'](function(_0x32889e){return _0x32889e;});}return null;};}function removeEntity(_0xda9fef,_0x445279){return function(_0x54b303){if(_0x54b303){return _0x54b303[_0x439b('0x29')]()[_0x439b('0x2a')](function(){var _0x5d45aa=_0x54b303['get']({'plain':!![]});var _0x1bac8a=_0x439b('0x2b');return db['UserProfileResource'][_0x439b('0x29')]({'where':{'type':_0x1bac8a,'resourceId':_0x5d45aa['id']}})[_0x439b('0x2a')](function(){return _0x54b303;});})[_0x439b('0x2a')](function(){_0xda9fef[_0x439b('0x20')](0xcc)[_0x439b('0x1f')]();});}};}function handleEntityNotFound(_0x8f4d94,_0x5a03f1){return function(_0x1088d9){if(!_0x1088d9){_0x8f4d94[_0x439b('0x2c')](0x194);}return _0x1088d9;};}function handleError(_0x32231f,_0x16ab2f){_0x16ab2f=_0x16ab2f||0x1f4;return function(_0x1cc427){logger[_0x439b('0x2d')](_0x1cc427[_0x439b('0x2e')]);if(_0x1cc427[_0x439b('0x2f')]){delete _0x1cc427['name'];}_0x32231f[_0x439b('0x20')](_0x16ab2f)['send'](_0x1cc427);};}exports[_0x439b('0x30')]=function(_0x123f79,_0x287a9f){var _0x442161={},_0x159fe5={},_0xb02656={'count':0x0,'rows':[]};var _0x9aa20f=_['map'](db[_0x439b('0x31')][_0x439b('0x32')],function(_0x12e236){return{'name':_0x12e236[_0x439b('0x33')],'type':_0x12e236['type'][_0x439b('0x34')]};});_0x159fe5[_0x439b('0x35')]=_[_0x439b('0x36')](_0x9aa20f,'name');_0x159fe5[_0x439b('0x37')]=_['keys'](_0x123f79['query']);_0x159fe5[_0x439b('0x38')]=_[_0x439b('0x39')](_0x159fe5['model'],_0x159fe5[_0x439b('0x37')]);_0x442161[_0x439b('0x3a')]=_[_0x439b('0x39')](_0x159fe5[_0x439b('0x35')],qs['fields'](_0x123f79['query'][_0x439b('0x3b')]));_0x442161['attributes']=_0x442161[_0x439b('0x3a')][_0x439b('0x3c')]?_0x442161[_0x439b('0x3a')]:_0x159fe5['model'];if(!_0x123f79[_0x439b('0x37')][_0x439b('0x3d')](_0x439b('0x3e'))){_0x442161[_0x439b('0x24')]=qs[_0x439b('0x24')](_0x123f79[_0x439b('0x37')][_0x439b('0x24')]);_0x442161['offset']=qs[_0x439b('0x21')](_0x123f79['query'][_0x439b('0x21')]);}_0x442161['order']=qs[_0x439b('0x3f')](_0x123f79[_0x439b('0x37')][_0x439b('0x3f')]);_0x442161[_0x439b('0x40')]=qs[_0x439b('0x38')](_[_0x439b('0x41')](_0x123f79[_0x439b('0x37')],_0x159fe5[_0x439b('0x38')]),_0x9aa20f);if(_0x123f79[_0x439b('0x37')][_0x439b('0x42')]){_0x442161['where']=_[_0x439b('0x43')](_0x442161[_0x439b('0x40')],{'$or':_[_0x439b('0x36')](_0x9aa20f,function(_0x598a79){if(_0x598a79['type']!==_0x439b('0x44')){var _0x5a910f={};_0x5a910f[_0x598a79['name']]={'$like':'%'+_0x123f79[_0x439b('0x37')][_0x439b('0x42')]+'%'};return _0x5a910f;}})});}_0x442161=_[_0x439b('0x43')]({},_0x442161,_0x123f79['options']);var _0x43d865={'where':_0x442161[_0x439b('0x40')]};return db[_0x439b('0x31')][_0x439b('0x23')](_0x43d865)['then'](function(_0xc1a92f){_0xb02656['count']=_0xc1a92f;if(_0x123f79['query'][_0x439b('0x45')]){_0x442161['include']=[{'all':!![]}];}return db[_0x439b('0x31')][_0x439b('0x46')](_0x442161);})[_0x439b('0x2a')](function(_0x556073){_0xb02656[_0x439b('0x47')]=_0x556073;return _0xb02656;})[_0x439b('0x2a')](respondWithFilteredResult(_0x287a9f,_0x442161))[_0x439b('0x48')](handleError(_0x287a9f,null));};exports[_0x439b('0x49')]=function(_0xd74cac,_0x1ce791){var _0x10cfdd={'raw':!![],'where':{'id':_0xd74cac['params']['id']}},_0x960337={};_0x960337[_0x439b('0x35')]=_[_0x439b('0x4a')](db[_0x439b('0x31')]['rawAttributes']);_0x960337['query']=_[_0x439b('0x4a')](_0xd74cac[_0x439b('0x37')]);_0x960337[_0x439b('0x38')]=_[_0x439b('0x39')](_0x960337[_0x439b('0x35')],_0x960337[_0x439b('0x37')]);_0x10cfdd[_0x439b('0x3a')]=_[_0x439b('0x39')](_0x960337[_0x439b('0x35')],qs[_0x439b('0x3b')](_0xd74cac[_0x439b('0x37')]['fields']));_0x10cfdd['attributes']=_0x10cfdd['attributes'][_0x439b('0x3c')]?_0x10cfdd[_0x439b('0x3a')]:_0x960337[_0x439b('0x35')];if(_0xd74cac[_0x439b('0x37')][_0x439b('0x45')]){_0x10cfdd[_0x439b('0x4b')]=[{'all':!![]}];}_0x10cfdd=_[_0x439b('0x43')]({},_0x10cfdd,_0xd74cac[_0x439b('0x4c')]);return db[_0x439b('0x31')][_0x439b('0x4d')](_0x10cfdd)[_0x439b('0x2a')](handleEntityNotFound(_0x1ce791,null))[_0x439b('0x2a')](respondWithResult(_0x1ce791,null))[_0x439b('0x48')](handleError(_0x1ce791,null));};exports[_0x439b('0x4e')]=function(_0x5e25c8,_0x3651e7,_0x5595c9){return db['Plugin'][_0x439b('0x4d')]({'where':{'id':_0x5e25c8[_0x439b('0x4f')]['id']},'attributes':[_0x439b('0x2f'),_0x439b('0x7')],'raw':!![]})[_0x439b('0x2a')](handleEntityNotFound(_0x3651e7,null))[_0x439b('0x2a')](function(_0x2c386f){if(_0x2c386f){var _0x32e639=path[_0x439b('0x50')](config[_0x439b('0x51')],'server/files/plugins',util[_0x439b('0x52')]('%s.zip',path[_0x439b('0x53')](_0x2c386f['path'])));var _0x3e4c78=fs[_0x439b('0x54')](_0x32e639);var _0x4cc2f7=archiver(_0x439b('0x55'),{'zlib':{'level':0x9}});_0x4cc2f7['on'](_0x439b('0x56'),function(_0x41af31){if(_0x41af31['code']==='ENOENT'){logger['error'](_0x41af31);}else{throw new db['Sequelize']['Error'](_0x439b('0x57'));}});_0x4cc2f7['on']('error',function(_0x2e9d77){throw new db[(_0x439b('0x58'))][(_0x439b('0x59'))](_0x439b('0x57'));});_0x4cc2f7[_0x439b('0x5a')](_0x3e4c78);_0x4cc2f7[_0x439b('0x5b')](_0x439b('0x5c'),{'cwd':path[_0x439b('0x50')](config[_0x439b('0x51')],_0x439b('0x5d'),path[_0x439b('0x5e')](_0x2c386f[_0x439b('0x7')])),'ignore':[path[_0x439b('0x50')](path['basename'](_0x2c386f['path']),'node_modules/**/*'),path['join'](path[_0x439b('0x53')](_0x2c386f['path']),_0x439b('0x5f'))],'nodir':!![]})[_0x439b('0x60')]();_0x3e4c78['on'](_0x439b('0x61'),function(){if(!fs[_0x439b('0x62')](_0x32e639)){throw new db[(_0x439b('0x58'))][(_0x439b('0x59'))](_0x439b('0x63'));}return _0x3651e7['download'](_0x32e639,util['format'](_0x439b('0x64'),path[_0x439b('0x53')](_0x2c386f[_0x439b('0x7')])),function(_0x2fadf7){if(_0x2fadf7){throw new db[(_0x439b('0x58'))]['Error'](_0x439b('0x65'));}fs[_0x439b('0x66')](_0x32e639);logger['info'](_0x439b('0x67'));logger[_0x439b('0x68')](_0x439b('0x69'));});});}return null;})['catch'](handleError(_0x3651e7,null));};exports['upload']=function(_0x8c868,_0x2eec58,_0x3b2dcd){var _0x4deba6=path[_0x439b('0x53')](_0x8c868['file'][_0x439b('0x6a')],path['extname'](_0x8c868[_0x439b('0x6b')][_0x439b('0x6a')]));var _0xd77823=path[_0x439b('0x50')](config[_0x439b('0x51')],_0x439b('0x5d'),_0x8c868[_0x439b('0x6b')]['filename']);var _0x176414=path['join'](config[_0x439b('0x51')],'server/files/plugins',_0x4deba6);logger[_0x439b('0x68')](_0x439b('0x6c'),_0xd77823);logger[_0x439b('0x68')]('Plugin\x20upload\x20destination:\x20%s',_0x176414);try{fs[_0x439b('0x6d')](_0xd77823,parseInt(_0x439b('0x6e'),0x8));extract(_0xd77823,{'dir':_0x176414},function(_0x3884d9){if(_0x3884d9){logger['error'](_0x3884d9);handleError(_0x3884d9,!![]);};var _0x2aaf74=fs[_0x439b('0x6f')](_0x176414);if(_0x2aaf74[_0x439b('0x3c')]>0x1){removeReferences(_0xd77823,_0x176414);logger[_0x439b('0x2d')]('Invalid\x20plugin\x20structure');return _0x3b2dcd(new Error(_0x439b('0x70')));}var _0x1099c3=fs['lstatSync'](path['join'](_0x176414,_0x2aaf74[0x0]));if(_0x1099c3[_0x439b('0x71')]()){removeReferences(_0xd77823,_0x176414);logger[_0x439b('0x2d')](_0x439b('0x70'));return _0x3b2dcd(new Error(_0x439b('0x70')));}if(_0x1099c3[_0x439b('0x72')]()){var _0x44a56d=fs['readdirSync'](path[_0x439b('0x50')](_0x176414,_0x2aaf74[0x0]));if(_0x44a56d[_0x439b('0x3c')]===0x0){removeReferences(_0xd77823,_0x176414);logger[_0x439b('0x2d')](_0x439b('0x70'));return _0x3b2dcd(new Error(_0x439b('0x70')));}var _0x4bf854=_0x44a56d[_0x439b('0x73')](function(_0xe606a9){return _0xe606a9===_0x439b('0x74');});if(!_0x4bf854){return _0x3b2dcd(new Error(_0x439b('0x75')));}var _0x1a0de7=fs[_0x439b('0x76')](path[_0x439b('0x50')](_0x176414,_0x2aaf74[0x0],_0x439b('0x74')));var _0x41cfa4=JSON['parse'](_0x1a0de7);if(_0x439b('0x22')==typeof _0x41cfa4['name']){return _0x3b2dcd(new Error(_0x439b('0x77')));}if('undefined'==typeof _0x41cfa4[_0x439b('0x78')]){return _0x3b2dcd(new Error(_0x439b('0x79')));}if('undefined'==typeof _0x41cfa4[_0x439b('0x7a')]){return _0x3b2dcd(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0x439b('0x22')==typeof _0x41cfa4[_0x439b('0x7b')]){return _0x3b2dcd(new Error(_0x439b('0x7c')));}if(_0x41cfa4['type']===_0x439b('0x7d')){if('undefined'==typeof _0x41cfa4[_0x439b('0x7b')][_0x439b('0x7e')]){return _0x3b2dcd(new Error(_0x439b('0x7f')));}if('undefined'==typeof _0x41cfa4[_0x439b('0x7b')]['views'][_0x439b('0x80')]&&_0x439b('0x22')==typeof _0x41cfa4[_0x439b('0x7b')]['views'][_0x439b('0x81')]){return _0x3b2dcd(new Error(_0x439b('0x82')));}}else if(_0x41cfa4[_0x439b('0x78')]===_0x439b('0x83')){if(_0x439b('0x22')==typeof _0x41cfa4[_0x439b('0x7b')][_0x439b('0x84')]){return _0x3b2dcd(new Error(_0x439b('0x85')));}if(_0x439b('0x22')==typeof _0x41cfa4[_0x439b('0x7b')][_0x439b('0x86')]){return _0x3b2dcd(new Error(_0x439b('0x87')));}}else{return _0x3b2dcd(new Error(_0x439b('0x88')));}var _0x345bae=_0x41cfa4[_0x439b('0x2f')];var _0x3d66e1=_0x41cfa4[_0x439b('0x89')];var _0x765045=_0x41cfa4['type'];var _0x40a011=_0x41cfa4['sidebar']?_0x41cfa4[_0x439b('0x8a')]:_0x439b('0x8b');var _0x57496f=_0x41cfa4[_0x439b('0x8c')]?_0x41cfa4[_0x439b('0x8c')]:'icon-apps';var _0x54b7e9='';var _0x18cdc7='';var _0x262988='';var _0x572c85='';var _0x3966ce=_0x41cfa4[_0x439b('0x7a')];if(_0x765045==='html'){if(_0x439b('0x22')!=typeof _0x41cfa4[_0x439b('0x7b')][_0x439b('0x7e')][_0x439b('0x80')]){var _0x207995=_0x41cfa4[_0x439b('0x7b')]['views'][_0x439b('0x80')];if(!/^(f|ht)tps?:\/\//i['test'](_0x207995)){_0x54b7e9=path[_0x439b('0x50')]('plugins',_0x4deba6,_0x2aaf74[0x0],_0x207995);}else{_0x54b7e9=_0x207995;}}else{logger['info'](_0x439b('0x8d'));}if(_0x439b('0x22')!=typeof _0x41cfa4[_0x439b('0x7b')][_0x439b('0x7e')][_0x439b('0x81')]){var _0x3abdce=_0x41cfa4['parameters']['views'][_0x439b('0x81')];if(!/^(f|ht)tps?:\/\//i['test'](_0x3abdce)){_0x18cdc7=path[_0x439b('0x50')](_0x439b('0x8e'),_0x4deba6,_0x2aaf74[0x0],_0x3abdce);}else{_0x18cdc7=_0x3abdce;}}else{logger['info']('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x765045===_0x439b('0x83')){_0x262988=_0x41cfa4['parameters'][_0x439b('0x84')];_0x572c85=_0x41cfa4[_0x439b('0x7b')][_0x439b('0x86')];if(_0x439b('0x22')!=typeof _0x41cfa4[_0x439b('0x7b')][_0x439b('0x7e')]){if('undefined'!=typeof _0x41cfa4['parameters'][_0x439b('0x7e')][_0x439b('0x80')]){var _0x207995=_0x41cfa4[_0x439b('0x7b')][_0x439b('0x7e')][_0x439b('0x80')];if(!/^(f|ht)tps?:\/\//i[_0x439b('0x8f')](_0x207995)){_0x54b7e9=path[_0x439b('0x50')](_0x439b('0x8e'),_0x4deba6,_0x2aaf74[0x0],_0x207995);}else{_0x54b7e9=_0x207995;}}if(_0x439b('0x22')!=typeof _0x41cfa4[_0x439b('0x7b')][_0x439b('0x7e')]['agent']){var _0x3abdce=_0x41cfa4[_0x439b('0x7b')][_0x439b('0x7e')][_0x439b('0x81')];if(!/^(f|ht)tps?:\/\//i[_0x439b('0x8f')](_0x3abdce)){_0x18cdc7=path[_0x439b('0x50')](_0x439b('0x8e'),_0x4deba6,_0x2aaf74[0x0],_0x3abdce);}else{_0x18cdc7=_0x3abdce;}}}}var _0x290b07={'name':_0x345bae,'description':_0x3d66e1,'path':path[_0x439b('0x50')](_0x4deba6,_0x2aaf74[0x0]),'type':_0x765045,'sidebar':_0x40a011,'icon':_0x57496f,'adminUrl':_0x54b7e9,'agentUrl':_0x18cdc7,'scriptName':_0x262988,'scriptPath':_0x572c85,'version':_0x3966ce};removeReferences(_0xd77823,null);return db[_0x439b('0x31')][_0x439b('0x90')](_0x290b07)['then'](function(_0x395778){var _0x4e85bc={'role':_0x8c868[_0x439b('0x91')][_0x439b('0x92')],'userProfileId':_0x8c868[_0x439b('0x91')][_0x439b('0x93')]};if(!_0x4e85bc)throw new Error(_0x439b('0x94'));if(_0x4e85bc[_0x439b('0x92')]===_0x439b('0x95')){var _0x5f5603=_0x395778[_0x439b('0x96')]({'plain':!![]});return db['UserProfileSection'][_0x439b('0x4d')]({'where':{'name':'Plugins','userProfileId':_0x4e85bc[_0x439b('0x93')]},'raw':!![]})['then'](function(_0x4e5037){if(_0x4e5037&&_0x4e5037['autoAssociation']===0x0){return db[_0x439b('0x97')][_0x439b('0x90')]({'name':_0x5f5603[_0x439b('0x2f')],'resourceId':_0x5f5603['id'],'type':_0x4e5037[_0x439b('0x2f')],'sectionId':_0x4e5037['id']},{})['then'](function(){return _0x395778;});}else{return _0x395778;}})[_0x439b('0x48')](function(_0x12c309){logger[_0x439b('0x2d')](_0x439b('0x98'),_0x12c309);throw _0x12c309;});}return _0x395778;})['then'](respondWithResult(_0x2eec58,null))['catch'](handleError(_0x2eec58,null));}});}catch(_0x5c29be){_0x2eec58[_0x439b('0x20')](0x1f4)[_0x439b('0x99')](_0x5c29be);}};function removeReferences(_0x1470a8,_0x1bffd4){try{if(_0x1470a8){fs[_0x439b('0x66')](_0x1470a8);logger[_0x439b('0x68')](_0x439b('0x9a'));}if(_0x1bffd4){rimraf(_0x1bffd4,function(){});logger[_0x439b('0x68')](_0x439b('0x9b'));}}catch(_0x21e539){logger[_0x439b('0x2d')](_0x21e539);}}exports[_0x439b('0x9c')]=function(_0x10bed6,_0x589d78,_0x1997d2){return db[_0x439b('0x31')][_0x439b('0x4d')]({'where':{'id':_0x10bed6[_0x439b('0x4f')]['id']}})[_0x439b('0x2a')](handleEntityNotFound(_0x589d78,null))['then'](saveUpdates(_0x10bed6[_0x439b('0x91')],null))[_0x439b('0x2a')](respondWithResult(_0x589d78,null))['catch'](handleError(_0x589d78,null));};exports[_0x439b('0x9d')]=function(_0x2c0202,_0xd71026,_0x1beaf5){return db['Plugin'][_0x439b('0x4d')]({'where':{'id':_0x2c0202[_0x439b('0x4f')]['id']}})['then'](function(_0x57c08a){if(_0x57c08a){return _0x57c08a[_0x439b('0x29')]();}})[_0x439b('0x2a')](function(_0x46c3d7){rimraf(path[_0x439b('0x50')](config[_0x439b('0x51')],_0x439b('0x5d'),path[_0x439b('0x5e')](_0x46c3d7[_0x439b('0x7')])),function(){});return _0x46c3d7;})[_0x439b('0x2a')](handleEntityNotFound(_0xd71026,null))[_0x439b('0x2a')](respondWithStatusCode(_0xd71026,null))[_0x439b('0x48')](handleError(_0xd71026,null));};exports[_0x439b('0x9e')]=function(_0x272270,_0x1bbf9a,_0x1d4594){return BPromise[_0x439b('0x9f')]()[_0x439b('0x2a')](function(){if(!_0x272270[_0x439b('0x37')][_0x439b('0x7')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x272270[_0x439b('0x37')][_0x439b('0xa0')]){throw new Error(_0x439b('0xa1'));}var _0x509af9=_0x272270[_0x439b('0x37')][_0x439b('0xa2')]?_0x272270['query'][_0x439b('0xa2')]+':'+_0x272270[_0x439b('0x37')]['port']:_0x439b('0xa3')+_0x272270[_0x439b('0x37')][_0x439b('0xa0')];var _0x2b7948=_0x272270['query']['json']?_0x272270[_0x439b('0x37')][_0x439b('0xa4')]:!![];var _0x7f3ab8=_0x272270[_0x439b('0x37')][_0x439b('0xa5')]?_0x272270['query'][_0x439b('0xa5')]:null;var _0x432cd0={'method':_0x272270[_0x439b('0xa6')],'uri':util['format'](_0x439b('0xa7'),_0x509af9,_0x272270[_0x439b('0x37')][_0x439b('0x7')]),'json':_0x2b7948,'resolveWithFullResponse':!![],'encoding':_0x7f3ab8,'qs':_0x272270[_0x439b('0x37')]};if(_0x272270[_0x439b('0xa8')]){_0x432cd0['headers']=_0x272270['headers'];if(_0x432cd0[_0x439b('0xa8')]['content-length']){delete _0x432cd0['headers']['content-length'];}}if(_0x432cd0[_0x439b('0xa8')][_0x439b('0xa9')]){delete _0x432cd0[_0x439b('0xa8')][_0x439b('0xa9')];}return rp(_0x432cd0);})[_0x439b('0x2a')](function(_0x28214b){if(_0x28214b){_0x1bbf9a[_0x439b('0x25')](_0x28214b[_0x439b('0xa8')]);logger['info'](_0x28214b[_0x439b('0x91')]);if(_[_0x439b('0xaa')](_0x272270['query']['path'],_0x439b('0x4e'))&&_0x28214b[_0x439b('0xab')]==0x1f4){return _0x1bbf9a[_0x439b('0x2c')](_0x28214b[_0x439b('0xab')]);}else{return _0x1bbf9a[_0x439b('0x20')](_0x28214b[_0x439b('0xab')])[_0x439b('0x99')](_0x28214b[_0x439b('0x91')]);}}else{return _0x1bbf9a['sendStatus'](0xc8);}})[_0x439b('0x48')](handleError(_0x1bbf9a,null));};exports[_0x439b('0xac')]=function(_0x7f9c86,_0x2c54f0,_0x3f636d){return BPromise[_0x439b('0x9f')]()[_0x439b('0x2a')](function(){if(!_0x7f9c86[_0x439b('0x37')][_0x439b('0x7')]){throw new Error(_0x439b('0xad'));}if(!_0x7f9c86[_0x439b('0x37')][_0x439b('0xa0')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x5aca83=_0x7f9c86[_0x439b('0x37')][_0x439b('0xa2')]?_0x7f9c86[_0x439b('0x37')][_0x439b('0xa2')]+':'+_0x7f9c86[_0x439b('0x37')]['port']:'http://localhost:'+_0x7f9c86[_0x439b('0x37')][_0x439b('0xa0')];var _0xca254e=_0x7f9c86[_0x439b('0x37')]['json']?_0x7f9c86[_0x439b('0x37')][_0x439b('0xa4')]:!![];var _0x6091d9=_0x7f9c86[_0x439b('0x37')]['encoding']?_0x7f9c86['query'][_0x439b('0xa5')]:null;var _0x5ae2f9={'method':_0x7f9c86[_0x439b('0xa6')],'uri':util['format']('%s%s',_0x5aca83,_0x7f9c86[_0x439b('0x37')]['path']),'json':_0xca254e,'resolveWithFullResponse':!![],'encoding':_0x6091d9,'body':_0x7f9c86[_0x439b('0x91')]};if(_0x7f9c86[_0x439b('0xa8')]){_0x5ae2f9[_0x439b('0xa8')]=_0x7f9c86[_0x439b('0xa8')];if(_0x5ae2f9[_0x439b('0xa8')][_0x439b('0xae')]){delete _0x5ae2f9[_0x439b('0xa8')][_0x439b('0xae')];}}if(_0x5ae2f9['headers'][_0x439b('0xa9')]){delete _0x5ae2f9['headers'][_0x439b('0xa9')];}return rp(_0x5ae2f9);})[_0x439b('0x2a')](function(_0x28f8f7){if(_0x28f8f7){_0x2c54f0[_0x439b('0x25')](_0x28f8f7[_0x439b('0xa8')]);logger[_0x439b('0x68')](_0x28f8f7[_0x439b('0x91')]);return _0x2c54f0[_0x439b('0x20')](_0x28f8f7[_0x439b('0xab')])[_0x439b('0x99')](_0x28f8f7[_0x439b('0x91')]);}else{return _0x2c54f0['sendStatus'](0xc8);}})[_0x439b('0x48')](handleError(_0x2c54f0,null));}; \ No newline at end of file +var _0xbd75=['Invalid\x20manifest:\x20name\x20missing','version','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','script','scriptName','test','create','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Plugins','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','port','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','eml-format','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','extract-zip','rimraf','archiver','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./plugin.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','get','UserProfileResource','error','name','send','index','map','rawAttributes','type','key','model','keys','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','Plugin','includeAll','include','findAll','rows','params','find','catch','download','join','format','%s.zip','basename','createWriteStream','warning','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','root','server/files/plugins','dirname','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','chmodSync','0777','readdirSync','lstatSync','isFile','Invalid\x20plugin\x20structure','some','manifest.json','parse'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xbd75,0x190));var _0x5bd7=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xbd75[_0x4e676e];return _0x336a3c;};'use strict';var emlformat=require(_0x5bd7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5bd7('0x1'));var jsonpatch=require(_0x5bd7('0x2'));var rp=require(_0x5bd7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5bd7('0x4'));var path=require(_0x5bd7('0x5'));var sox=require(_0x5bd7('0x6'));var csv=require(_0x5bd7('0x7'));var ejs=require(_0x5bd7('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5bd7('0x9'));var crypto=require(_0x5bd7('0xa'));var jsforce=require(_0x5bd7('0xb'));var deskjs=require(_0x5bd7('0xc'));var toCsv=require(_0x5bd7('0x7'));var querystring=require(_0x5bd7('0xd'));var Papa=require(_0x5bd7('0xe'));var extract=require(_0x5bd7('0xf'));var rimraf=require(_0x5bd7('0x10'));var archiver=require(_0x5bd7('0x11'));var Redis=require(_0x5bd7('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x5bd7('0x13'));var as=require(_0x5bd7('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5bd7('0x15'))(_0x5bd7('0x16'));var utils=require(_0x5bd7('0x17'));var config=require(_0x5bd7('0x18'));var licenseUtil=require(_0x5bd7('0x19'));var db=require(_0x5bd7('0x1a'))['db'];config['redis']=_[_0x5bd7('0x1b')](config['redis'],{'host':_0x5bd7('0x1c'),'port':0x18eb});var socket=require(_0x5bd7('0x1d'))(new Redis(config[_0x5bd7('0x1e')]));require(_0x5bd7('0x1f'))[_0x5bd7('0x20')](socket);function respondWithStatusCode(_0x240706,_0xf56ec3){_0xf56ec3=_0xf56ec3||0xcc;return function(_0x3c6d24){if(_0x3c6d24){return _0x240706[_0x5bd7('0x21')](_0xf56ec3);}return _0x240706[_0x5bd7('0x22')](_0xf56ec3)[_0x5bd7('0x23')]();};}function respondWithResult(_0x11d59d,_0x1a4176){_0x1a4176=_0x1a4176||0xc8;return function(_0x313130){if(_0x313130){return _0x11d59d[_0x5bd7('0x22')](_0x1a4176)[_0x5bd7('0x24')](_0x313130);}};}function respondWithFilteredResult(_0x3b8879,_0x1dc7c6){return function(_0x36add3){if(_0x36add3){var _0x5ea69a=typeof _0x1dc7c6['offset']===_0x5bd7('0x25')&&typeof _0x1dc7c6[_0x5bd7('0x26')]===_0x5bd7('0x25');var _0x53bd9e=_0x36add3[_0x5bd7('0x27')];var _0x2c6bda=_0x5ea69a?0x0:_0x1dc7c6[_0x5bd7('0x28')];var _0x1dbfc8=_0x5ea69a?_0x36add3[_0x5bd7('0x27')]:_0x1dc7c6['offset']+_0x1dc7c6[_0x5bd7('0x26')];var _0x34bc16;if(_0x1dbfc8>=_0x53bd9e){_0x1dbfc8=_0x53bd9e;_0x34bc16=0xc8;}else{_0x34bc16=0xce;}_0x3b8879[_0x5bd7('0x22')](_0x34bc16);return _0x3b8879[_0x5bd7('0x29')]('Content-Range',_0x2c6bda+'-'+_0x1dbfc8+'/'+_0x53bd9e)['json'](_0x36add3);}return null;};}function patchUpdates(_0x53d15f){return function(_0x59bd00){try{jsonpatch[_0x5bd7('0x2a')](_0x59bd00,_0x53d15f,!![]);}catch(_0x4f2491){return BPromise[_0x5bd7('0x2b')](_0x4f2491);}return _0x59bd00[_0x5bd7('0x2c')]();};}function saveUpdates(_0x380da5,_0x5cce7a){return function(_0x237085){if(_0x237085){return _0x237085[_0x5bd7('0x2d')](_0x380da5)[_0x5bd7('0x2e')](function(_0x4cac61){return _0x4cac61;});}return null;};}function removeEntity(_0x3a9ef9,_0x121a3c){return function(_0x31d6d3){if(_0x31d6d3){return _0x31d6d3[_0x5bd7('0x2f')]()[_0x5bd7('0x2e')](function(){var _0x32ed76=_0x31d6d3[_0x5bd7('0x30')]({'plain':!![]});var _0x5c8d60='Plugins';return db[_0x5bd7('0x31')][_0x5bd7('0x2f')]({'where':{'type':_0x5c8d60,'resourceId':_0x32ed76['id']}})[_0x5bd7('0x2e')](function(){return _0x31d6d3;});})[_0x5bd7('0x2e')](function(){_0x3a9ef9[_0x5bd7('0x22')](0xcc)[_0x5bd7('0x23')]();});}};}function handleEntityNotFound(_0x337824,_0x2e1173){return function(_0x50d4c4){if(!_0x50d4c4){_0x337824['sendStatus'](0x194);}return _0x50d4c4;};}function handleError(_0x2616f7,_0x521e80){_0x521e80=_0x521e80||0x1f4;return function(_0x5c9d74){logger[_0x5bd7('0x32')](_0x5c9d74['stack']);if(_0x5c9d74[_0x5bd7('0x33')]){delete _0x5c9d74['name'];}_0x2616f7['status'](_0x521e80)[_0x5bd7('0x34')](_0x5c9d74);};}exports[_0x5bd7('0x35')]=function(_0x418ab2,_0xe548eb){var _0x152986={},_0x2ec3d1={},_0x2e3ac1={'count':0x0,'rows':[]};var _0x1e36ee=_[_0x5bd7('0x36')](db['Plugin'][_0x5bd7('0x37')],function(_0x39df8c){return{'name':_0x39df8c['fieldName'],'type':_0x39df8c[_0x5bd7('0x38')][_0x5bd7('0x39')]};});_0x2ec3d1[_0x5bd7('0x3a')]=_['map'](_0x1e36ee,'name');_0x2ec3d1['query']=_[_0x5bd7('0x3b')](_0x418ab2[_0x5bd7('0x3c')]);_0x2ec3d1['filters']=_[_0x5bd7('0x3d')](_0x2ec3d1[_0x5bd7('0x3a')],_0x2ec3d1[_0x5bd7('0x3c')]);_0x152986[_0x5bd7('0x3e')]=_[_0x5bd7('0x3d')](_0x2ec3d1[_0x5bd7('0x3a')],qs[_0x5bd7('0x3f')](_0x418ab2['query'][_0x5bd7('0x3f')]));_0x152986[_0x5bd7('0x3e')]=_0x152986[_0x5bd7('0x3e')][_0x5bd7('0x40')]?_0x152986['attributes']:_0x2ec3d1['model'];if(!_0x418ab2[_0x5bd7('0x3c')]['hasOwnProperty'](_0x5bd7('0x41'))){_0x152986[_0x5bd7('0x26')]=qs[_0x5bd7('0x26')](_0x418ab2[_0x5bd7('0x3c')][_0x5bd7('0x26')]);_0x152986[_0x5bd7('0x28')]=qs[_0x5bd7('0x28')](_0x418ab2[_0x5bd7('0x3c')][_0x5bd7('0x28')]);}_0x152986[_0x5bd7('0x42')]=qs[_0x5bd7('0x43')](_0x418ab2[_0x5bd7('0x3c')][_0x5bd7('0x43')]);_0x152986[_0x5bd7('0x44')]=qs[_0x5bd7('0x45')](_['pick'](_0x418ab2[_0x5bd7('0x3c')],_0x2ec3d1[_0x5bd7('0x45')]),_0x1e36ee);if(_0x418ab2[_0x5bd7('0x3c')][_0x5bd7('0x46')]){_0x152986[_0x5bd7('0x44')]=_['merge'](_0x152986[_0x5bd7('0x44')],{'$or':_['map'](_0x1e36ee,function(_0xa7f1f1){if(_0xa7f1f1[_0x5bd7('0x38')]!==_0x5bd7('0x47')){var _0x4e57c2={};_0x4e57c2[_0xa7f1f1['name']]={'$like':'%'+_0x418ab2['query'][_0x5bd7('0x46')]+'%'};return _0x4e57c2;}})});}_0x152986=_[_0x5bd7('0x48')]({},_0x152986,_0x418ab2[_0x5bd7('0x49')]);var _0x211417={'where':_0x152986[_0x5bd7('0x44')]};return db[_0x5bd7('0x4a')][_0x5bd7('0x27')](_0x211417)[_0x5bd7('0x2e')](function(_0x26a630){_0x2e3ac1[_0x5bd7('0x27')]=_0x26a630;if(_0x418ab2[_0x5bd7('0x3c')][_0x5bd7('0x4b')]){_0x152986[_0x5bd7('0x4c')]=[{'all':!![]}];}return db[_0x5bd7('0x4a')][_0x5bd7('0x4d')](_0x152986);})[_0x5bd7('0x2e')](function(_0x5e0557){_0x2e3ac1[_0x5bd7('0x4e')]=_0x5e0557;return _0x2e3ac1;})['then'](respondWithFilteredResult(_0xe548eb,_0x152986))['catch'](handleError(_0xe548eb,null));};exports['show']=function(_0x51c48f,_0x3d5fe9){var _0x463ace={'raw':!![],'where':{'id':_0x51c48f[_0x5bd7('0x4f')]['id']}},_0x1a0f76={};_0x1a0f76[_0x5bd7('0x3a')]=_[_0x5bd7('0x3b')](db[_0x5bd7('0x4a')]['rawAttributes']);_0x1a0f76[_0x5bd7('0x3c')]=_[_0x5bd7('0x3b')](_0x51c48f['query']);_0x1a0f76['filters']=_['intersection'](_0x1a0f76[_0x5bd7('0x3a')],_0x1a0f76['query']);_0x463ace[_0x5bd7('0x3e')]=_[_0x5bd7('0x3d')](_0x1a0f76[_0x5bd7('0x3a')],qs[_0x5bd7('0x3f')](_0x51c48f['query']['fields']));_0x463ace['attributes']=_0x463ace[_0x5bd7('0x3e')][_0x5bd7('0x40')]?_0x463ace[_0x5bd7('0x3e')]:_0x1a0f76[_0x5bd7('0x3a')];if(_0x51c48f[_0x5bd7('0x3c')]['includeAll']){_0x463ace[_0x5bd7('0x4c')]=[{'all':!![]}];}_0x463ace=_['merge']({},_0x463ace,_0x51c48f[_0x5bd7('0x49')]);return db[_0x5bd7('0x4a')][_0x5bd7('0x50')](_0x463ace)[_0x5bd7('0x2e')](handleEntityNotFound(_0x3d5fe9,null))['then'](respondWithResult(_0x3d5fe9,null))[_0x5bd7('0x51')](handleError(_0x3d5fe9,null));};exports[_0x5bd7('0x52')]=function(_0x5a8933,_0xb9b892,_0x2de5d2){return db['Plugin']['find']({'where':{'id':_0x5a8933[_0x5bd7('0x4f')]['id']},'attributes':[_0x5bd7('0x33'),_0x5bd7('0x5')],'raw':!![]})[_0x5bd7('0x2e')](handleEntityNotFound(_0xb9b892,null))[_0x5bd7('0x2e')](function(_0x517067){if(_0x517067){var _0x3bcb38=path[_0x5bd7('0x53')](config['root'],'server/files/plugins',util[_0x5bd7('0x54')](_0x5bd7('0x55'),path[_0x5bd7('0x56')](_0x517067[_0x5bd7('0x5')])));var _0x57a10e=fs[_0x5bd7('0x57')](_0x3bcb38);var _0x4984b9=archiver('zip',{'zlib':{'level':0x9}});_0x4984b9['on'](_0x5bd7('0x58'),function(_0x2dc6f7){if(_0x2dc6f7['code']==='ENOENT'){logger[_0x5bd7('0x32')](_0x2dc6f7);}else{throw new db[(_0x5bd7('0x59'))][(_0x5bd7('0x5a'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x4984b9['on'](_0x5bd7('0x32'),function(_0x46a0e1){throw new db['Sequelize']['Error'](_0x5bd7('0x5b'));});_0x4984b9[_0x5bd7('0x5c')](_0x57a10e);_0x4984b9[_0x5bd7('0x5d')](_0x5bd7('0x5e'),{'cwd':path[_0x5bd7('0x53')](config[_0x5bd7('0x5f')],_0x5bd7('0x60'),path[_0x5bd7('0x61')](_0x517067[_0x5bd7('0x5')])),'ignore':[path[_0x5bd7('0x53')](path[_0x5bd7('0x56')](_0x517067['path']),_0x5bd7('0x62')),path[_0x5bd7('0x53')](path['basename'](_0x517067['path']),_0x5bd7('0x63'))],'nodir':!![]})[_0x5bd7('0x64')]();_0x57a10e['on'](_0x5bd7('0x65'),function(){if(!fs[_0x5bd7('0x66')](_0x3bcb38)){throw new db['Sequelize']['Error'](_0x5bd7('0x67'));}return _0xb9b892[_0x5bd7('0x52')](_0x3bcb38,util['format'](_0x5bd7('0x55'),path['basename'](_0x517067['path'])),function(_0x1063d9){if(_0x1063d9){throw new db[(_0x5bd7('0x59'))]['Error'](_0x5bd7('0x68'));}fs[_0x5bd7('0x69')](_0x3bcb38);logger[_0x5bd7('0x6a')](_0x5bd7('0x6b'));logger[_0x5bd7('0x6a')](_0x5bd7('0x6c'));});});}return null;})[_0x5bd7('0x51')](handleError(_0xb9b892,null));};exports['upload']=function(_0x1decf3,_0x18c4ce,_0x6054b6){var _0x2a6322=path[_0x5bd7('0x56')](_0x1decf3[_0x5bd7('0x6d')][_0x5bd7('0x6e')],path[_0x5bd7('0x6f')](_0x1decf3[_0x5bd7('0x6d')][_0x5bd7('0x6e')]));var _0x450bae=path[_0x5bd7('0x53')](config[_0x5bd7('0x5f')],_0x5bd7('0x60'),_0x1decf3[_0x5bd7('0x6d')][_0x5bd7('0x6e')]);var _0x184dcc=path[_0x5bd7('0x53')](config[_0x5bd7('0x5f')],_0x5bd7('0x60'),_0x2a6322);logger[_0x5bd7('0x6a')](_0x5bd7('0x70'),_0x450bae);logger['info']('Plugin\x20upload\x20destination:\x20%s',_0x184dcc);try{fs[_0x5bd7('0x71')](_0x450bae,parseInt(_0x5bd7('0x72'),0x8));extract(_0x450bae,{'dir':_0x184dcc},function(_0x439337){if(_0x439337){logger[_0x5bd7('0x32')](_0x439337);handleError(_0x439337,!![]);};var _0x485a6d=fs[_0x5bd7('0x73')](_0x184dcc);if(_0x485a6d[_0x5bd7('0x40')]>0x1){removeReferences(_0x450bae,_0x184dcc);logger['error']('Invalid\x20plugin\x20structure');return _0x6054b6(new Error('Invalid\x20plugin\x20structure'));}var _0x3e5338=fs[_0x5bd7('0x74')](path['join'](_0x184dcc,_0x485a6d[0x0]));if(_0x3e5338[_0x5bd7('0x75')]()){removeReferences(_0x450bae,_0x184dcc);logger[_0x5bd7('0x32')](_0x5bd7('0x76'));return _0x6054b6(new Error(_0x5bd7('0x76')));}if(_0x3e5338['isDirectory']()){var _0xe76bc6=fs['readdirSync'](path[_0x5bd7('0x53')](_0x184dcc,_0x485a6d[0x0]));if(_0xe76bc6[_0x5bd7('0x40')]===0x0){removeReferences(_0x450bae,_0x184dcc);logger[_0x5bd7('0x32')](_0x5bd7('0x76'));return _0x6054b6(new Error(_0x5bd7('0x76')));}var _0x31cc49=_0xe76bc6[_0x5bd7('0x77')](function(_0x42d1d7){return _0x42d1d7===_0x5bd7('0x78');});if(!_0x31cc49){return _0x6054b6(new Error('Plugin\x20manifest\x20missing'));}var _0x3cc4a3=fs['readFileSync'](path[_0x5bd7('0x53')](_0x184dcc,_0x485a6d[0x0],_0x5bd7('0x78')));var _0x3d4f47=JSON[_0x5bd7('0x79')](_0x3cc4a3);if('undefined'==typeof _0x3d4f47[_0x5bd7('0x33')]){return _0x6054b6(new Error(_0x5bd7('0x7a')));}if(_0x5bd7('0x25')==typeof _0x3d4f47[_0x5bd7('0x38')]){return _0x6054b6(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0x5bd7('0x25')==typeof _0x3d4f47[_0x5bd7('0x7b')]){return _0x6054b6(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0x5bd7('0x25')==typeof _0x3d4f47[_0x5bd7('0x7c')]){return _0x6054b6(new Error(_0x5bd7('0x7d')));}if(_0x3d4f47[_0x5bd7('0x38')]===_0x5bd7('0x7e')){if(_0x5bd7('0x25')==typeof _0x3d4f47[_0x5bd7('0x7c')]['views']){return _0x6054b6(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0x5bd7('0x25')==typeof _0x3d4f47['parameters'][_0x5bd7('0x7f')][_0x5bd7('0x80')]&&_0x5bd7('0x25')==typeof _0x3d4f47[_0x5bd7('0x7c')][_0x5bd7('0x7f')][_0x5bd7('0x81')]){return _0x6054b6(new Error(_0x5bd7('0x82')));}}else if(_0x3d4f47[_0x5bd7('0x38')]==='script'){if(_0x5bd7('0x25')==typeof _0x3d4f47['parameters']['scriptName']){return _0x6054b6(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0x5bd7('0x25')==typeof _0x3d4f47['parameters'][_0x5bd7('0x83')]){return _0x6054b6(new Error(_0x5bd7('0x84')));}}else{return _0x6054b6(new Error(_0x5bd7('0x85')));}var _0x32fac4=_0x3d4f47[_0x5bd7('0x33')];var _0x1c5d92=_0x3d4f47[_0x5bd7('0x86')];var _0x1d0ceb=_0x3d4f47[_0x5bd7('0x38')];var _0x3479b6=_0x3d4f47[_0x5bd7('0x87')]?_0x3d4f47[_0x5bd7('0x87')]:_0x5bd7('0x88');var _0x56d832=_0x3d4f47[_0x5bd7('0x89')]?_0x3d4f47[_0x5bd7('0x89')]:_0x5bd7('0x8a');var _0x46af48='';var _0x58fc73='';var _0x4c571b='';var _0x4f413b='';var _0x3dc6fd=_0x3d4f47[_0x5bd7('0x7b')];if(_0x1d0ceb===_0x5bd7('0x7e')){if('undefined'!=typeof _0x3d4f47[_0x5bd7('0x7c')][_0x5bd7('0x7f')][_0x5bd7('0x80')]){var _0x14f74f=_0x3d4f47['parameters'][_0x5bd7('0x7f')][_0x5bd7('0x80')];if(!/^(f|ht)tps?:\/\//i['test'](_0x14f74f)){_0x46af48=path[_0x5bd7('0x53')](_0x5bd7('0x8b'),_0x2a6322,_0x485a6d[0x0],_0x14f74f);}else{_0x46af48=_0x14f74f;}}else{logger[_0x5bd7('0x6a')](_0x5bd7('0x8c'));}if(_0x5bd7('0x25')!=typeof _0x3d4f47[_0x5bd7('0x7c')][_0x5bd7('0x7f')][_0x5bd7('0x81')]){var _0x3e6614=_0x3d4f47[_0x5bd7('0x7c')][_0x5bd7('0x7f')][_0x5bd7('0x81')];if(!/^(f|ht)tps?:\/\//i['test'](_0x3e6614)){_0x58fc73=path[_0x5bd7('0x53')](_0x5bd7('0x8b'),_0x2a6322,_0x485a6d[0x0],_0x3e6614);}else{_0x58fc73=_0x3e6614;}}else{logger[_0x5bd7('0x6a')](_0x5bd7('0x8d'));}}else if(_0x1d0ceb===_0x5bd7('0x8e')){_0x4c571b=_0x3d4f47[_0x5bd7('0x7c')][_0x5bd7('0x8f')];_0x4f413b=_0x3d4f47[_0x5bd7('0x7c')]['scriptPath'];if(_0x5bd7('0x25')!=typeof _0x3d4f47[_0x5bd7('0x7c')]['views']){if(_0x5bd7('0x25')!=typeof _0x3d4f47['parameters'][_0x5bd7('0x7f')][_0x5bd7('0x80')]){var _0x14f74f=_0x3d4f47[_0x5bd7('0x7c')][_0x5bd7('0x7f')][_0x5bd7('0x80')];if(!/^(f|ht)tps?:\/\//i[_0x5bd7('0x90')](_0x14f74f)){_0x46af48=path['join'](_0x5bd7('0x8b'),_0x2a6322,_0x485a6d[0x0],_0x14f74f);}else{_0x46af48=_0x14f74f;}}if(_0x5bd7('0x25')!=typeof _0x3d4f47[_0x5bd7('0x7c')][_0x5bd7('0x7f')]['agent']){var _0x3e6614=_0x3d4f47['parameters']['views'][_0x5bd7('0x81')];if(!/^(f|ht)tps?:\/\//i[_0x5bd7('0x90')](_0x3e6614)){_0x58fc73=path['join'](_0x5bd7('0x8b'),_0x2a6322,_0x485a6d[0x0],_0x3e6614);}else{_0x58fc73=_0x3e6614;}}}}var _0x535fa2={'name':_0x32fac4,'description':_0x1c5d92,'path':path[_0x5bd7('0x53')](_0x2a6322,_0x485a6d[0x0]),'type':_0x1d0ceb,'sidebar':_0x3479b6,'icon':_0x56d832,'adminUrl':_0x46af48,'agentUrl':_0x58fc73,'scriptName':_0x4c571b,'scriptPath':_0x4f413b,'version':_0x3dc6fd};removeReferences(_0x450bae,null);return db[_0x5bd7('0x4a')][_0x5bd7('0x91')](_0x535fa2)['then'](function(_0x5b8bc3){var _0x2422dc={'role':_0x1decf3[_0x5bd7('0x92')][_0x5bd7('0x93')],'userProfileId':_0x1decf3[_0x5bd7('0x92')]['userProfileId']};if(!_0x2422dc)throw new Error(_0x5bd7('0x94'));if(_0x2422dc[_0x5bd7('0x93')]===_0x5bd7('0x95')){var _0x4c4971=_0x5b8bc3[_0x5bd7('0x30')]({'plain':!![]});return db[_0x5bd7('0x96')][_0x5bd7('0x50')]({'where':{'name':_0x5bd7('0x97'),'userProfileId':_0x2422dc[_0x5bd7('0x98')]},'raw':!![]})['then'](function(_0x127a8f){if(_0x127a8f&&_0x127a8f[_0x5bd7('0x99')]===0x0){return db[_0x5bd7('0x31')][_0x5bd7('0x91')]({'name':_0x4c4971[_0x5bd7('0x33')],'resourceId':_0x4c4971['id'],'type':_0x127a8f[_0x5bd7('0x33')],'sectionId':_0x127a8f['id']},{})[_0x5bd7('0x2e')](function(){return _0x5b8bc3;});}else{return _0x5b8bc3;}})['catch'](function(_0x47f12b){logger[_0x5bd7('0x32')](_0x5bd7('0x9a'),_0x47f12b);throw _0x47f12b;});}return _0x5b8bc3;})[_0x5bd7('0x2e')](respondWithResult(_0x18c4ce,null))[_0x5bd7('0x51')](handleError(_0x18c4ce,null));}});}catch(_0x13a23b){_0x18c4ce[_0x5bd7('0x22')](0x1f4)['send'](_0x13a23b);}};function removeReferences(_0x4fcaad,_0x2bf2a4){try{if(_0x4fcaad){fs[_0x5bd7('0x69')](_0x4fcaad);logger[_0x5bd7('0x6a')](_0x5bd7('0x9b'));}if(_0x2bf2a4){rimraf(_0x2bf2a4,function(){});logger[_0x5bd7('0x6a')](_0x5bd7('0x9c'));}}catch(_0x453bda){logger[_0x5bd7('0x32')](_0x453bda);}}exports[_0x5bd7('0x2d')]=function(_0x2af67a,_0x3bb951,_0x1701f5){return db[_0x5bd7('0x4a')]['find']({'where':{'id':_0x2af67a['params']['id']}})['then'](handleEntityNotFound(_0x3bb951,null))[_0x5bd7('0x2e')](saveUpdates(_0x2af67a[_0x5bd7('0x92')],null))[_0x5bd7('0x2e')](respondWithResult(_0x3bb951,null))[_0x5bd7('0x51')](handleError(_0x3bb951,null));};exports[_0x5bd7('0x9d')]=function(_0x1326c2,_0x32d5be,_0x25fa5c){return db[_0x5bd7('0x4a')][_0x5bd7('0x50')]({'where':{'id':_0x1326c2[_0x5bd7('0x4f')]['id']}})[_0x5bd7('0x2e')](function(_0x526a5c){if(_0x526a5c){return _0x526a5c['destroy']();}})['then'](function(_0x2365cb){rimraf(path['join'](config[_0x5bd7('0x5f')],_0x5bd7('0x60'),path[_0x5bd7('0x61')](_0x2365cb[_0x5bd7('0x5')])),function(){});return _0x2365cb;})[_0x5bd7('0x2e')](handleEntityNotFound(_0x32d5be,null))[_0x5bd7('0x2e')](respondWithStatusCode(_0x32d5be,null))[_0x5bd7('0x51')](handleError(_0x32d5be,null));};exports[_0x5bd7('0x9e')]=function(_0x43c388,_0x23a6df,_0x5284a6){return BPromise[_0x5bd7('0x9f')]()[_0x5bd7('0x2e')](function(){if(!_0x43c388[_0x5bd7('0x3c')]['path']){throw new Error(_0x5bd7('0xa0'));}if(!_0x43c388[_0x5bd7('0x3c')]['port']){throw new Error(_0x5bd7('0xa1'));}var _0x4e7e8f=_0x43c388[_0x5bd7('0x3c')][_0x5bd7('0xa2')]?_0x43c388['query'][_0x5bd7('0xa2')]+':'+_0x43c388[_0x5bd7('0x3c')]['port']:_0x5bd7('0xa3')+_0x43c388['query'][_0x5bd7('0xa4')];var _0x476c7d=_0x43c388[_0x5bd7('0x3c')][_0x5bd7('0x24')]?_0x43c388[_0x5bd7('0x3c')][_0x5bd7('0x24')]:!![];var _0x29abbe=_0x43c388[_0x5bd7('0x3c')][_0x5bd7('0xa5')]?_0x43c388[_0x5bd7('0x3c')][_0x5bd7('0xa5')]:null;var _0x3f0013={'method':_0x43c388[_0x5bd7('0xa6')],'uri':util['format'](_0x5bd7('0xa7'),_0x4e7e8f,_0x43c388['query'][_0x5bd7('0x5')]),'json':_0x476c7d,'resolveWithFullResponse':!![],'encoding':_0x29abbe,'qs':_0x43c388[_0x5bd7('0x3c')]};if(_0x43c388['headers']){_0x3f0013['headers']=_0x43c388[_0x5bd7('0xa8')];if(_0x3f0013[_0x5bd7('0xa8')]['content-length']){delete _0x3f0013[_0x5bd7('0xa8')][_0x5bd7('0xa9')];}}if(_0x3f0013['headers'][_0x5bd7('0xaa')]){delete _0x3f0013[_0x5bd7('0xa8')][_0x5bd7('0xaa')];}return rp(_0x3f0013);})[_0x5bd7('0x2e')](function(_0x275d2c){if(_0x275d2c){_0x23a6df[_0x5bd7('0x29')](_0x275d2c[_0x5bd7('0xa8')]);logger['info'](_0x275d2c[_0x5bd7('0x92')]);if(_[_0x5bd7('0xab')](_0x43c388[_0x5bd7('0x3c')]['path'],_0x5bd7('0x52'))&&_0x275d2c['statusCode']==0x1f4){return _0x23a6df[_0x5bd7('0x21')](_0x275d2c[_0x5bd7('0xac')]);}else{return _0x23a6df[_0x5bd7('0x22')](_0x275d2c[_0x5bd7('0xac')])[_0x5bd7('0x34')](_0x275d2c['body']);}}else{return _0x23a6df[_0x5bd7('0x21')](0xc8);}})[_0x5bd7('0x51')](handleError(_0x23a6df,null));};exports[_0x5bd7('0xad')]=function(_0x49c34c,_0x1d0181,_0x20bd9a){return BPromise[_0x5bd7('0x9f')]()[_0x5bd7('0x2e')](function(){if(!_0x49c34c[_0x5bd7('0x3c')]['path']){throw new Error(_0x5bd7('0xa0'));}if(!_0x49c34c[_0x5bd7('0x3c')]['port']){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x3beacf=_0x49c34c[_0x5bd7('0x3c')][_0x5bd7('0xa2')]?_0x49c34c[_0x5bd7('0x3c')]['hostname']+':'+_0x49c34c[_0x5bd7('0x3c')][_0x5bd7('0xa4')]:_0x5bd7('0xa3')+_0x49c34c[_0x5bd7('0x3c')]['port'];var _0x567539=_0x49c34c[_0x5bd7('0x3c')][_0x5bd7('0x24')]?_0x49c34c[_0x5bd7('0x3c')][_0x5bd7('0x24')]:!![];var _0x4c0450=_0x49c34c[_0x5bd7('0x3c')][_0x5bd7('0xa5')]?_0x49c34c[_0x5bd7('0x3c')]['encoding']:null;var _0x56486b={'method':_0x49c34c[_0x5bd7('0xa6')],'uri':util[_0x5bd7('0x54')]('%s%s',_0x3beacf,_0x49c34c['query'][_0x5bd7('0x5')]),'json':_0x567539,'resolveWithFullResponse':!![],'encoding':_0x4c0450,'body':_0x49c34c[_0x5bd7('0x92')]};if(_0x49c34c[_0x5bd7('0xa8')]){_0x56486b[_0x5bd7('0xa8')]=_0x49c34c[_0x5bd7('0xa8')];if(_0x56486b['headers'][_0x5bd7('0xa9')]){delete _0x56486b[_0x5bd7('0xa8')]['content-length'];}}if(_0x56486b['headers']['content-type']){delete _0x56486b[_0x5bd7('0xa8')][_0x5bd7('0xaa')];}return rp(_0x56486b);})[_0x5bd7('0x2e')](function(_0x23f3a3){if(_0x23f3a3){_0x1d0181[_0x5bd7('0x29')](_0x23f3a3['headers']);logger[_0x5bd7('0x6a')](_0x23f3a3[_0x5bd7('0x92')]);return _0x1d0181[_0x5bd7('0x22')](_0x23f3a3['statusCode'])[_0x5bd7('0x34')](_0x23f3a3[_0x5bd7('0x92')]);}else{return _0x1d0181[_0x5bd7('0x21')](0xc8);}})['catch'](handleError(_0x1d0181,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 891f686..82febf2 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 _0x363e=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x363e,0x179));var _0xe363=function(_0x577ce5,_0x22755d){_0x577ce5=_0x577ce5-0x0;var _0x971df8=_0x363e[_0x577ce5];return _0x971df8;};'use strict';var EventEmitter=require(_0xe363('0x0'));var Plugin=require(_0xe363('0x1'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0xe363('0x2')](0x0);var events={'afterCreate':_0xe363('0x3'),'afterUpdate':_0xe363('0x4'),'afterDestroy':_0xe363('0x5')};function emitEvent(_0x179157){return function(_0x3809ea,_0x6e174a,_0x11775e){PluginEvents[_0xe363('0x6')](_0x179157+':'+_0x3809ea['id'],_0x3809ea);PluginEvents[_0xe363('0x6')](_0x179157,_0x3809ea);_0x11775e(null);};}for(var e in events){if(events[_0xe363('0x7')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0xe363('0x8')]=PluginEvents; \ No newline at end of file +var _0xb7ac=['emit','hasOwnProperty','events','../../mysqldb','Plugin','setMaxListeners','save','remove'];(function(_0x136e17,_0x3515eb){var _0x5189f6=function(_0x34e91f){while(--_0x34e91f){_0x136e17['push'](_0x136e17['shift']());}};_0x5189f6(++_0x3515eb);}(_0xb7ac,0x18a));var _0xcb7a=function(_0x17220d,_0x5e615e){_0x17220d=_0x17220d-0x0;var _0x5e1f4b=_0xb7ac[_0x17220d];return _0x5e1f4b;};'use strict';var EventEmitter=require(_0xcb7a('0x0'));var Plugin=require(_0xcb7a('0x1'))['db'][_0xcb7a('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0xcb7a('0x3')](0x0);var events={'afterCreate':_0xcb7a('0x4'),'afterUpdate':'update','afterDestroy':_0xcb7a('0x5')};function emitEvent(_0x4817ac){return function(_0x41408c,_0xaa5a21,_0x50be72){PluginEvents[_0xcb7a('0x6')](_0x4817ac+':'+_0x41408c['id'],_0x41408c);PluginEvents[_0xcb7a('0x6')](_0x4817ac,_0x41408c);_0x50be72(null);};}for(var e in events){if(events[_0xcb7a('0x7')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 19b9567..ab82091 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 _0xc859=['moment','bluebird','path','rimraf','../../config/environment','exports','define','plugins','lodash','util','../../config/logger'];(function(_0x57f76c,_0xc7eee9){var _0x20a028=function(_0x5e6d6a){while(--_0x5e6d6a){_0x57f76c['push'](_0x57f76c['shift']());}};_0x20a028(++_0xc7eee9);}(_0xc859,0xb8));var _0x9c85=function(_0x28d18d,_0x55896b){_0x28d18d=_0x28d18d-0x0;var _0x470640=_0xc859[_0x28d18d];return _0x470640;};'use strict';var _=require(_0x9c85('0x0'));var util=require(_0x9c85('0x1'));var logger=require(_0x9c85('0x2'))('api');var moment=require(_0x9c85('0x3'));var BPromise=require(_0x9c85('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9c85('0x5'));var rimraf=require(_0x9c85('0x6'));var config=require(_0x9c85('0x7'));var attributes=require('./plugin.attributes');module[_0x9c85('0x8')]=function(_0x445353,_0x4b2b2e){return _0x445353[_0x9c85('0x9')]('Plugin',attributes,{'tableName':_0x9c85('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf8d5=['bluebird','path','rimraf','../../config/environment','./plugin.attributes','exports','define','Plugin','plugins','lodash','util','../../config/logger','api'];(function(_0x35d9af,_0x5a6d19){var _0x1b38fe=function(_0x2a11f6){while(--_0x2a11f6){_0x35d9af['push'](_0x35d9af['shift']());}};_0x1b38fe(++_0x5a6d19);}(_0xf8d5,0xcc));var _0x5f8d=function(_0xfab1f0,_0x3a7a02){_0xfab1f0=_0xfab1f0-0x0;var _0x4d2d14=_0xf8d5[_0xfab1f0];return _0x4d2d14;};'use strict';var _=require(_0x5f8d('0x0'));var util=require(_0x5f8d('0x1'));var logger=require(_0x5f8d('0x2'))(_0x5f8d('0x3'));var moment=require('moment');var BPromise=require(_0x5f8d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5f8d('0x5'));var rimraf=require(_0x5f8d('0x6'));var config=require(_0x5f8d('0x7'));var attributes=require(_0x5f8d('0x8'));module[_0x5f8d('0x9')]=function(_0x4a7d5e,_0x2c7a26){return _0x4a7d5e[_0x5f8d('0xa')](_0x5f8d('0xb'),attributes,{'tableName':_0x5f8d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index b4fda6e..5a56590 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 _0x7366=['debug','stringify','error','code','message','result','catch','Plugin','create','body','options','raw','CreatePlugin','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./plugin.socket','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent'];(function(_0x5a34d6,_0x56792c){var _0x3a5000=function(_0x27cdd2){while(--_0x27cdd2){_0x5a34d6['push'](_0x5a34d6['shift']());}};_0x3a5000(++_0x56792c);}(_0x7366,0x1c7));var _0x6736=function(_0x2b778d,_0x5dd9e4){_0x2b778d=_0x2b778d-0x0;var _0x46a581=_0x7366[_0x2b778d];return _0x46a581;};'use strict';var _=require('lodash');var util=require(_0x6736('0x0'));var moment=require(_0x6736('0x1'));var BPromise=require(_0x6736('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6736('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6736('0x4'));var logger=require(_0x6736('0x5'))(_0x6736('0x6'));var config=require(_0x6736('0x7'));var jayson=require(_0x6736('0x8'));var client=jayson[_0x6736('0x9')]['http']({'port':0x232a});config['redis']=_[_0x6736('0xa')](config[_0x6736('0xb')],{'host':_0x6736('0xc'),'port':0x18eb});var socket=require(_0x6736('0xd'))(new Redis(config[_0x6736('0xb')]));require(_0x6736('0xe'))[_0x6736('0xf')](socket);function respondWithRpcPromise(_0x4037e3,_0x424f0a,_0x437e61){return new BPromise(function(_0x379ea8,_0x1aea1f){return client[_0x6736('0x10')](_0x4037e3,_0x437e61)[_0x6736('0x11')](function(_0x4fe9c5){logger[_0x6736('0x12')](_0x6736('0x13'),_0x424f0a,_0x6736('0x14'));logger[_0x6736('0x15')]('Plugin,\x20%s,\x20%s,\x20%s',_0x424f0a,'request\x20sent',JSON[_0x6736('0x16')](_0x4fe9c5));if(_0x4fe9c5[_0x6736('0x17')]){if(_0x4fe9c5[_0x6736('0x17')][_0x6736('0x18')]===0x1f4){logger['error'](_0x6736('0x13'),_0x424f0a,_0x4fe9c5[_0x6736('0x17')][_0x6736('0x19')]);return _0x1aea1f(_0x4fe9c5[_0x6736('0x17')]['message']);}logger[_0x6736('0x17')](_0x6736('0x13'),_0x424f0a,_0x4fe9c5[_0x6736('0x17')][_0x6736('0x19')]);return _0x379ea8(_0x4fe9c5['error']['message']);}else{logger[_0x6736('0x12')](_0x6736('0x13'),_0x424f0a,_0x6736('0x14'));_0x379ea8(_0x4fe9c5[_0x6736('0x1a')][_0x6736('0x19')]);}})[_0x6736('0x1b')](function(_0x5f3d97){logger[_0x6736('0x17')]('Plugin,\x20%s,\x20%s',_0x424f0a,_0x5f3d97);_0x1aea1f(_0x5f3d97);});});}exports['CreatePlugin']=function(_0xaf0a7c){var _0x31010f=this;return new Promise(function(_0x1f6af9,_0xee3b4a){return db[_0x6736('0x1c')][_0x6736('0x1d')](_0xaf0a7c[_0x6736('0x1e')],{'raw':_0xaf0a7c[_0x6736('0x1f')]?_0xaf0a7c[_0x6736('0x1f')][_0x6736('0x20')]===undefined?!![]:![]:!![]})[_0x6736('0x11')](function(_0x326b23){logger[_0x6736('0x12')](_0x6736('0x21'),_0xaf0a7c);logger['debug'](_0x6736('0x21'),_0xaf0a7c,JSON[_0x6736('0x16')](_0x326b23));_0x1f6af9(_0x326b23);})['catch'](function(_0x1a672e){logger['error'](_0x6736('0x21'),_0x1a672e[_0x6736('0x19')],_0xaf0a7c);_0xee3b4a(_0x31010f['error'](0x1f4,_0x1a672e[_0x6736('0x19')]));});});}; \ No newline at end of file +var _0xd838=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','localhost','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreatePlugin','Plugin','body','options','lodash'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xd838,0x95));var _0x8d83=function(_0x3c06c9,_0x43f29f){_0x3c06c9=_0x3c06c9-0x0;var _0x18a92f=_0xd838[_0x3c06c9];return _0x18a92f;};'use strict';var _=require(_0x8d83('0x0'));var util=require(_0x8d83('0x1'));var moment=require(_0x8d83('0x2'));var BPromise=require(_0x8d83('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8d83('0x4'));var db=require(_0x8d83('0x5'))['db'];var utils=require(_0x8d83('0x6'));var logger=require(_0x8d83('0x7'))(_0x8d83('0x8'));var config=require(_0x8d83('0x9'));var jayson=require(_0x8d83('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0x8d83('0xb')]=_['defaults'](config['redis'],{'host':_0x8d83('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8d83('0xb')]));require('./plugin.socket')[_0x8d83('0xd')](socket);function respondWithRpcPromise(_0x224013,_0x307088,_0x145af8){return new BPromise(function(_0xb0cefe,_0x202d88){return client[_0x8d83('0xe')](_0x224013,_0x145af8)[_0x8d83('0xf')](function(_0x3b088b){logger[_0x8d83('0x10')](_0x8d83('0x11'),_0x307088,_0x8d83('0x12'));logger[_0x8d83('0x13')]('Plugin,\x20%s,\x20%s,\x20%s',_0x307088,_0x8d83('0x12'),JSON[_0x8d83('0x14')](_0x3b088b));if(_0x3b088b[_0x8d83('0x15')]){if(_0x3b088b['error'][_0x8d83('0x16')]===0x1f4){logger[_0x8d83('0x15')](_0x8d83('0x11'),_0x307088,_0x3b088b[_0x8d83('0x15')][_0x8d83('0x17')]);return _0x202d88(_0x3b088b['error'][_0x8d83('0x17')]);}logger[_0x8d83('0x15')](_0x8d83('0x11'),_0x307088,_0x3b088b[_0x8d83('0x15')]['message']);return _0xb0cefe(_0x3b088b[_0x8d83('0x15')]['message']);}else{logger[_0x8d83('0x10')](_0x8d83('0x11'),_0x307088,_0x8d83('0x12'));_0xb0cefe(_0x3b088b[_0x8d83('0x18')][_0x8d83('0x17')]);}})[_0x8d83('0x19')](function(_0x13acc8){logger[_0x8d83('0x15')]('Plugin,\x20%s,\x20%s',_0x307088,_0x13acc8);_0x202d88(_0x13acc8);});});}exports[_0x8d83('0x1a')]=function(_0x64d924){var _0x265299=this;return new Promise(function(_0x35560f,_0x604132){return db[_0x8d83('0x1b')]['create'](_0x64d924[_0x8d83('0x1c')],{'raw':_0x64d924[_0x8d83('0x1d')]?_0x64d924[_0x8d83('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x8d83('0xf')](function(_0x3b5512){logger['info'](_0x8d83('0x1a'),_0x64d924);logger[_0x8d83('0x13')]('CreatePlugin',_0x64d924,JSON[_0x8d83('0x14')](_0x3b5512));_0x35560f(_0x3b5512);})[_0x8d83('0x19')](function(_0x547b7a){logger['error'](_0x8d83('0x1a'),_0x547b7a[_0x8d83('0x17')],_0x64d924);_0x604132(_0x265299[_0x8d83('0x15')](0x1f4,_0x547b7a[_0x8d83('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 57db92a..c0e2e26 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 _0xdae6=['register','length','./plugin.events','save','update','emit'];(function(_0x2cf97a,_0x336128){var _0x435f47=function(_0x11c869){while(--_0x11c869){_0x2cf97a['push'](_0x2cf97a['shift']());}};_0x435f47(++_0x336128);}(_0xdae6,0x110));var _0x6dae=function(_0x546703,_0x1941cc){_0x546703=_0x546703-0x0;var _0x865ad8=_0xdae6[_0x546703];return _0x865ad8;};'use strict';var PluginEvents=require(_0x6dae('0x0'));var events=[_0x6dae('0x1'),'remove',_0x6dae('0x2')];function createListener(_0x349f4e,_0x5408f4){return function(_0x38d188){_0x5408f4[_0x6dae('0x3')](_0x349f4e,_0x38d188);};}function removeListener(_0x531b28,_0x452665){return function(){PluginEvents['removeListener'](_0x531b28,_0x452665);};}exports[_0x6dae('0x4')]=function(_0x5c98ca){for(var _0x2e076c=0x0,_0x249375=events[_0x6dae('0x5')];_0x2e076c<_0x249375;_0x2e076c++){var _0x4e1e2a=events[_0x2e076c];var _0x297aeb=createListener('plugin:'+_0x4e1e2a,_0x5c98ca);PluginEvents['on'](_0x4e1e2a,_0x297aeb);}}; \ No newline at end of file +var _0x0158=['emit','removeListener','register','length','plugin:','./plugin.events','save'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0158,0x155));var _0x8015=function(_0x3d9872,_0x28f80a){_0x3d9872=_0x3d9872-0x0;var _0x48d36c=_0x0158[_0x3d9872];return _0x48d36c;};'use strict';var PluginEvents=require(_0x8015('0x0'));var events=[_0x8015('0x1'),'remove','update'];function createListener(_0x1a98e9,_0x1fe845){return function(_0x1ecbd1){_0x1fe845[_0x8015('0x2')](_0x1a98e9,_0x1ecbd1);};}function removeListener(_0x1b70d9,_0x4e9e53){return function(){PluginEvents[_0x8015('0x3')](_0x1b70d9,_0x4e9e53);};}exports[_0x8015('0x4')]=function(_0x112b1e){for(var _0x21af6a=0x0,_0x4b67a5=events[_0x8015('0x5')];_0x21af6a<_0x4b67a5;_0x21af6a++){var _0x469972=events[_0x21af6a];var _0x296430=createListener(_0x8015('0x6')+_0x469972,_0x112b1e);PluginEvents['on'](_0x469972,_0x296430);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 258e7dd..536ab62 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(_0x267120,_0x413c07){var _0x54d790=function(_0x1a65d5){while(--_0x1a65d5){_0x267120['push'](_0x267120['shift']());}};_0x54d790(++_0x413c07);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./pm2.controller');router['get']('/',auth[_0x0a9e('0x3')](),controller['index']);router[_0x0a9e('0x4')](_0x0a9e('0x5'),auth[_0x0a9e('0x3')](),controller[_0x0a9e('0x6')]);router[_0x0a9e('0x7')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x8')]);router[_0x0a9e('0x9')](_0x0a9e('0x5'),auth['isAuthenticated'](),controller['update']);router[_0x0a9e('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);module[_0x0a9e('0xc')]=router; \ No newline at end of file +var _0xa9e0=['create','put','delete','destroy','exports','express','Router','../../components/auth/service','isAuthenticated','get','/:id','show','post'];(function(_0x2e262f,_0x497433){var _0xac129a=function(_0x214e2c){while(--_0x214e2c){_0x2e262f['push'](_0x2e262f['shift']());}};_0xac129a(++_0x497433);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./pm2.controller');router['get']('/',auth[_0x0a9e('0x3')](),controller['index']);router[_0x0a9e('0x4')](_0x0a9e('0x5'),auth[_0x0a9e('0x3')](),controller[_0x0a9e('0x6')]);router[_0x0a9e('0x7')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x8')]);router[_0x0a9e('0x9')](_0x0a9e('0x5'),auth['isAuthenticated'](),controller['update']);router[_0x0a9e('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);module[_0x0a9e('0xc')]=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index 7028ff2..1aed71a 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 _0x668b=['index','list','then','reject','express','motion2','length','show','describe','create','body','join','../../files/plugins','cwd','dirname','start','dump','catch','restart','stop','params','destroy','delete','Unknown\x20id','lodash','../../config/pm2','api','path','exec','status','json','error','stack','name','send','npm\x20install','info'];(function(_0x5b5862,_0x3e710f){var _0x18966f=function(_0x20ef1d){while(--_0x20ef1d){_0x5b5862['push'](_0x5b5862['shift']());}};_0x18966f(++_0x3e710f);}(_0x668b,0x140));var _0xb668=function(_0x514c15,_0x486901){_0x514c15=_0x514c15-0x0;var _0x16283e=_0x668b[_0x514c15];return _0x16283e;};'use strict';var _=require(_0xb668('0x0'));var pm2=require(_0xb668('0x1'));var logger=require('../../config/logger')(_0xb668('0x2'));var path=require(_0xb668('0x3'));var exec=require('child_process')[_0xb668('0x4')];var BPromise=require('bluebird');function handleEntityNotFound(_0x2fab11,_0x4092a6){return function(_0x2960f5){if(!_0x2960f5){_0x2fab11['sendStatus'](0x194);;}return _0x2960f5;};}function respondWithResult(_0x9b99a8,_0x296fa9){_0x296fa9=_0x296fa9||0xc8;return function(_0x3be92e){if(_0x3be92e){return _0x9b99a8[_0xb668('0x5')](_0x296fa9)[_0xb668('0x6')](_0x3be92e);}return null;};}function handleError(_0x3f01bc,_0x517fc5){_0x517fc5=_0x517fc5||0x1f4;return function(_0x11bb5e){logger[_0xb668('0x7')](_0x11bb5e[_0xb668('0x8')]);if(_0x11bb5e[_0xb668('0x9')]){delete _0x11bb5e[_0xb668('0x9')];}_0x3f01bc[_0xb668('0x5')](_0x517fc5)[_0xb668('0xa')](_0x11bb5e);};}function execChildProcess(){return new BPromise(function(_0x3616e9,_0x567ea9){exec(_0xb668('0xb'),function(_0x27dbf7,_0x27de15,_0x2ea5fc){logger[_0xb668('0xc')](_0x27de15);logger[_0xb668('0xc')](_0x2ea5fc);if(_0x27dbf7){logger[_0xb668('0x7')](_0x27dbf7);return _0x567ea9(_0x27dbf7);}return _0x3616e9(_0x27de15);});});}exports[_0xb668('0xd')]=function(_0x3e5be0,_0x25c5c5){return pm2[_0xb668('0xe')]()[_0xb668('0xf')](function(_0x3aed25){if(_0x3aed25){var _0xd0450f=_[_0xb668('0x10')](_0x3aed25,function(_0x3b0c84){return _0x3b0c84[_0xb668('0x9')]===_0xb668('0x11')||_0x3b0c84[_0xb668('0x9')]===_0xb668('0x12');});return{'rows':_0xd0450f,'count':_0xd0450f[_0xb668('0x13')]};}return null;})[_0xb668('0xf')](respondWithResult(_0x25c5c5,null))['catch'](handleError(_0x25c5c5,null));};exports[_0xb668('0x14')]=function(_0x567ad7,_0x30742a){return pm2[_0xb668('0x15')](_0x567ad7['params']['id'])[_0xb668('0xf')](respondWithResult(_0x30742a,null))[_0xb668('0xf')](handleEntityNotFound(_0x30742a,null))['catch'](handleError(_0x30742a,null));};exports[_0xb668('0x16')]=function(_0x5b31ab,_0x12fb3f){if(_0x5b31ab[_0xb668('0x17')][_0xb668('0x9')]&&_0x5b31ab[_0xb668('0x17')]['script']){var _0x2b7f96=path[_0xb668('0x18')](__dirname,_0xb668('0x19'),_0x5b31ab['body']['script']);var _0x43a70b=process[_0xb668('0x1a')]();process['chdir'](path[_0xb668('0x1b')](_0x2b7f96));return execChildProcess()['then'](function(_0x2f1394){process['chdir'](_0x43a70b);return pm2[_0xb668('0x1c')]({'name':_0x5b31ab[_0xb668('0x17')][_0xb668('0x9')],'script':_0x2b7f96});})[_0xb668('0xf')](function(_0x2a5b3d){pm2[_0xb668('0x1d')]();return _0x2a5b3d[0x0];})['then'](respondWithResult(_0x12fb3f,0xc9))[_0xb668('0x1e')](handleError(_0x12fb3f,null));}else{return _0x12fb3f[_0xb668('0x5')](0x1f4)[_0xb668('0xa')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports['update']=function(_0xe62fce,_0x2a826d){if(_0xe62fce[_0xb668('0x17')]['id']){delete _0xe62fce['body']['id'];}var _0x3a2543={'online':_0xb668('0x1f'),'stopped':_0xb668('0x20')};if(_0x3a2543['hasOwnProperty'](_0xe62fce['body'][_0xb668('0x5')])){return pm2[_0x3a2543[_0xe62fce[_0xb668('0x17')]['status']]](_0xe62fce[_0xb668('0x21')]['id'])[_0xb668('0xf')](respondWithResult(_0x2a826d,0xc8))[_0xb668('0x1e')](handleError(_0x2a826d,null));}else{return _0x2a826d[_0xb668('0x5')](0x1f4)[_0xb668('0xa')]({'message':'Unknown\x20status'});}};exports[_0xb668('0x22')]=function(_0x3bd27c,_0x5dfa2c){if(_0x3bd27c[_0xb668('0x17')]['id']){delete _0x3bd27c['body']['id'];}if(_0x3bd27c[_0xb668('0x21')]['id']){return pm2[_0xb668('0x23')](_0x3bd27c[_0xb668('0x21')]['id'])[_0xb668('0xf')](function(_0x2e40dd){pm2[_0xb668('0x1d')]();return _0x2e40dd[0x0];})[_0xb668('0xf')](respondWithResult(_0x5dfa2c,null))[_0xb668('0x1e')](handleError(_0x5dfa2c,null));}else{return _0x5dfa2c[_0xb668('0x5')](0x1f4)['send']({'message':_0xb668('0x24')});}}; \ No newline at end of file +var _0x0565=['script','../../files/plugins','cwd','chdir','send','update','restart','stop','hasOwnProperty','params','Unknown\x20status','delete','dump','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','path','child_process','exec','bluebird','sendStatus','error','stack','name','status','npm\x20install','index','list','then','reject','express','length','catch','show','describe','body'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x0565,0xf2));var _0x5056=function(_0x342700,_0x569f75){_0x342700=_0x342700-0x0;var _0x53406f=_0x0565[_0x342700];return _0x53406f;};'use strict';var _=require(_0x5056('0x0'));var pm2=require(_0x5056('0x1'));var logger=require(_0x5056('0x2'))(_0x5056('0x3'));var path=require(_0x5056('0x4'));var exec=require(_0x5056('0x5'))[_0x5056('0x6')];var BPromise=require(_0x5056('0x7'));function handleEntityNotFound(_0x3657a8,_0x2b0883){return function(_0x554040){if(!_0x554040){_0x3657a8[_0x5056('0x8')](0x194);;}return _0x554040;};}function respondWithResult(_0x105ea8,_0x1143df){_0x1143df=_0x1143df||0xc8;return function(_0x22afb7){if(_0x22afb7){return _0x105ea8['status'](_0x1143df)['json'](_0x22afb7);}return null;};}function handleError(_0x38f74,_0x223c92){_0x223c92=_0x223c92||0x1f4;return function(_0x417065){logger[_0x5056('0x9')](_0x417065[_0x5056('0xa')]);if(_0x417065[_0x5056('0xb')]){delete _0x417065[_0x5056('0xb')];}_0x38f74[_0x5056('0xc')](_0x223c92)['send'](_0x417065);};}function execChildProcess(){return new BPromise(function(_0x78f7e4,_0xf04ea3){exec(_0x5056('0xd'),function(_0x5ab4b2,_0x4c0255,_0x17f43e){logger['info'](_0x4c0255);logger['info'](_0x17f43e);if(_0x5ab4b2){logger['error'](_0x5ab4b2);return _0xf04ea3(_0x5ab4b2);}return _0x78f7e4(_0x4c0255);});});}exports[_0x5056('0xe')]=function(_0x4b183a,_0x3e523b){return pm2[_0x5056('0xf')]()[_0x5056('0x10')](function(_0x543cee){if(_0x543cee){var _0x1e8b64=_[_0x5056('0x11')](_0x543cee,function(_0x15f52d){return _0x15f52d[_0x5056('0xb')]===_0x5056('0x12')||_0x15f52d[_0x5056('0xb')]==='motion2';});return{'rows':_0x1e8b64,'count':_0x1e8b64[_0x5056('0x13')]};}return null;})['then'](respondWithResult(_0x3e523b,null))[_0x5056('0x14')](handleError(_0x3e523b,null));};exports[_0x5056('0x15')]=function(_0x1c0ee9,_0x1f2ac6){return pm2[_0x5056('0x16')](_0x1c0ee9['params']['id'])[_0x5056('0x10')](respondWithResult(_0x1f2ac6,null))[_0x5056('0x10')](handleEntityNotFound(_0x1f2ac6,null))['catch'](handleError(_0x1f2ac6,null));};exports['create']=function(_0x20776c,_0x517bf3){if(_0x20776c[_0x5056('0x17')][_0x5056('0xb')]&&_0x20776c[_0x5056('0x17')][_0x5056('0x18')]){var _0x33035c=path['join'](__dirname,_0x5056('0x19'),_0x20776c[_0x5056('0x17')]['script']);var _0x271efc=process[_0x5056('0x1a')]();process[_0x5056('0x1b')](path['dirname'](_0x33035c));return execChildProcess()[_0x5056('0x10')](function(_0x26a3c2){process['chdir'](_0x271efc);return pm2['start']({'name':_0x20776c[_0x5056('0x17')][_0x5056('0xb')],'script':_0x33035c});})[_0x5056('0x10')](function(_0x37f7b5){pm2['dump']();return _0x37f7b5[0x0];})[_0x5056('0x10')](respondWithResult(_0x517bf3,0xc9))[_0x5056('0x14')](handleError(_0x517bf3,null));}else{return _0x517bf3['status'](0x1f4)[_0x5056('0x1c')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x5056('0x1d')]=function(_0x39d539,_0x1106e5){if(_0x39d539[_0x5056('0x17')]['id']){delete _0x39d539[_0x5056('0x17')]['id'];}var _0x50f2a8={'online':_0x5056('0x1e'),'stopped':_0x5056('0x1f')};if(_0x50f2a8[_0x5056('0x20')](_0x39d539[_0x5056('0x17')]['status'])){return pm2[_0x50f2a8[_0x39d539[_0x5056('0x17')]['status']]](_0x39d539[_0x5056('0x21')]['id'])['then'](respondWithResult(_0x1106e5,0xc8))['catch'](handleError(_0x1106e5,null));}else{return _0x1106e5['status'](0x1f4)[_0x5056('0x1c')]({'message':_0x5056('0x22')});}};exports['destroy']=function(_0x27f4be,_0x2c5728){if(_0x27f4be[_0x5056('0x17')]['id']){delete _0x27f4be[_0x5056('0x17')]['id'];}if(_0x27f4be[_0x5056('0x21')]['id']){return pm2[_0x5056('0x23')](_0x27f4be[_0x5056('0x21')]['id'])[_0x5056('0x10')](function(_0xd1aa24){pm2[_0x5056('0x24')]();return _0xd1aa24[0x0];})[_0x5056('0x10')](respondWithResult(_0x2c5728,null))['catch'](handleError(_0x2c5728,null));}else{return _0x2c5728['status'](0x1f4)[_0x5056('0x1c')]({'message':_0x5056('0x25')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 2f75c58..9a86bc4 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 _0x830b=['getAgents','/queues','getQueues','express','Router','../../components/auth/service','./realtime.controller','get','/agents','isAuthenticated'];(function(_0x1cfa0d,_0x4391f2){var _0xe33279=function(_0x3ce7c1){while(--_0x3ce7c1){_0x1cfa0d['push'](_0x1cfa0d['shift']());}};_0xe33279(++_0x4391f2);}(_0x830b,0x175));var _0xb830=function(_0x5f5a99,_0x18f74c){_0x5f5a99=_0x5f5a99-0x0;var _0x5c7bfa=_0x830b[_0x5f5a99];return _0x5c7bfa;};'use strict';var express=require(_0xb830('0x0'));var router=express[_0xb830('0x1')]();var auth=require(_0xb830('0x2'));var controller=require(_0xb830('0x3'));router[_0xb830('0x4')](_0xb830('0x5'),auth[_0xb830('0x6')](),controller[_0xb830('0x7')]);router['get'](_0xb830('0x8'),auth[_0xb830('0x6')](),controller[_0xb830('0x9')]);module['exports']=router; \ No newline at end of file +var _0x5c03=['express','Router','../../components/auth/service','./realtime.controller','get','/agents','getAgents','/queues','isAuthenticated','exports'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x5c03,0x10e));var _0x35c0=function(_0x47a349,_0x4699d9){_0x47a349=_0x47a349-0x0;var _0x18ab75=_0x5c03[_0x47a349];return _0x18ab75;};'use strict';var express=require(_0x35c0('0x0'));var router=express[_0x35c0('0x1')]();var auth=require(_0x35c0('0x2'));var controller=require(_0x35c0('0x3'));router[_0x35c0('0x4')](_0x35c0('0x5'),auth['isAuthenticated'](),controller[_0x35c0('0x6')]);router['get'](_0x35c0('0x7'),auth[_0x35c0('0x8')](),controller['getQueues']);module[_0x35c0('0x9')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index bb9f029..6a7d390 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 _0x86fd=['initializeQueues','catch','lodash','../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','offset','limit','undefined','count','set','Content-Range','json','query','globalQueueFilter','globalStatusFilter','pauseTypeFilter','pause','*pause','resolve','then','channel','format','Channel\x20parameter\x20%s\x20is\x20invalid','sort','includes','globalStatus','fields','order','getAgentIdsByQueues','getRealtimeAgents','getSortedAgentsIdsByStatus','getAgentIdsByStatus','map','User','rawAttributes','key','role','agent','getOptions','raw','sequelize','literal','FIELD(id,','push','Pause','forEach','where','merge','user','userProfileId','online','extraQueryConditions','assign','omit','UserProfile','getResources','findAndCountAll','rows','find','filterAgentAttributes','getAgentStatus','voiceStatus','talking','pick','getQueues','isValidChannel','toLowerCase','startCase','Queue','fieldName','type','name','voice','dialActive','dialMethod','outbound','QueueCampaigns','Queues','filter','getRealtimeQueues'];(function(_0x3ca476,_0x3066a0){var _0x32f811=function(_0x1035e3){while(--_0x1035e3){_0x3ca476['push'](_0x3ca476['shift']());}};_0x32f811(++_0x3066a0);}(_0x86fd,0xaa));var _0xd86f=function(_0x21090b,_0x39dd3b){_0x21090b=_0x21090b-0x0;var _0x3c68d7=_0x86fd[_0x21090b];return _0x3c68d7;};'use strict';var _=require(_0xd86f('0x0'));var util=require('util');var rta=require(_0xd86f('0x1'));var rtq=require(_0xd86f('0x2'));var qs=require(_0xd86f('0x3'));var utils=require(_0xd86f('0x4'));var db=require(_0xd86f('0x5'))['db'];var APIBadRequestError=require(_0xd86f('0x6'))['APIBadRequestError'];var APIHandleError=require(_0xd86f('0x6'))['handleError'];function respondWithFilteredResult(_0x2c1c61,_0x681252){return function(_0x39c20f){if(_0x39c20f){var _0x5eddd5=typeof _0x681252[_0xd86f('0x7')]==='undefined'&&typeof _0x681252[_0xd86f('0x8')]===_0xd86f('0x9');var _0x792917=_0x39c20f['count'];var _0x3ee5f8=_0x5eddd5?0x0:_0x681252[_0xd86f('0x7')];var _0x2857a2=_0x5eddd5?_0x39c20f[_0xd86f('0xa')]:_0x681252[_0xd86f('0x7')]+_0x681252[_0xd86f('0x8')];var _0x2b377c;if(_0x2857a2>=_0x792917){_0x2857a2=_0x792917;_0x2b377c=0xc8;}else{_0x2b377c=0xce;}_0x2c1c61['status'](_0x2b377c);return _0x2c1c61[_0xd86f('0xb')](_0xd86f('0xc'),_0x3ee5f8+'-'+_0x2857a2+'/'+_0x792917)[_0xd86f('0xd')](_0x39c20f);}return null;};}exports['getAgents']=function(_0x3cc48e,_0x307eca){var _0x252d77={'count':0x0,'rows':[]};var _0x3f16b4={};var _0x5a3114;var _0x4b64ea=utils['getChannels']();var _0xaaa2f7;var _0xf91887;var _0x3d4b53=_0x3cc48e[_0xd86f('0xe')][_0xd86f('0xf')];var _0x2f5567=_0x3cc48e['query'][_0xd86f('0x10')];var _0x3297a8=_0x3cc48e[_0xd86f('0xe')][_0xd86f('0x11')];var _0x20f7fd=_0x2f5567===_0xd86f('0x12')||_0x2f5567===_0xd86f('0x13')?!![]:![];var _0x217ed1=[];var _0x2b977a;var _0x5d5881;Promise[_0xd86f('0x14')]()[_0xd86f('0x15')](function(){if(_0x3cc48e['query'][_0xd86f('0x16')]){if(!utils['isValidChannel'](_0x3cc48e[_0xd86f('0xe')][_0xd86f('0x16')])){throw new APIBadRequestError(util[_0xd86f('0x17')](_0xd86f('0x18'),_0x3cc48e[_0xd86f('0xe')][_0xd86f('0x16')]));}_0x5a3114=_0x3cc48e[_0xd86f('0xe')][_0xd86f('0x16')]['toLowerCase']();}if(!_0x3cc48e[_0xd86f('0xe')][_0xd86f('0x19')]||!_0x3cc48e[_0xd86f('0xe')][_0xd86f('0x19')][_0xd86f('0x1a')](_0xd86f('0x1b'))){_0x3cc48e[_0xd86f('0xe')][_0xd86f('0x19')]=rta['validateSortParameter'](_0x3cc48e[_0xd86f('0xe')][_0xd86f('0x19')]);return;}var _0x2329e5=rta['getUpdatedSortOptions'](_0x3cc48e[_0xd86f('0xe')][_0xd86f('0x19')]);_0x3cc48e[_0xd86f('0xe')][_0xd86f('0x19')]=_0x2329e5[_0xd86f('0x1c')]['join'](',');_0x2b977a=_0x2329e5[_0xd86f('0x1d')];})[_0xd86f('0x15')](function(){if(!_0x3d4b53){return[];}return rta[_0xd86f('0x1e')](_0x3d4b53,_0x5a3114);})[_0xd86f('0x15')](function(_0x2cabe9){_0x217ed1=_0x2cabe9;return rta[_0xd86f('0x1f')]();})[_0xd86f('0x15')](function(_0x425823){_0xf91887=_0x425823['rows'];if((!_0x2f5567||_0x20f7fd)&&!_0x2b977a){return _0x217ed1;}if(_0x2b977a&&!_0x2f5567){return rta[_0xd86f('0x20')](_0xf91887,_0x217ed1,_0x2b977a);}else{return rta[_0xd86f('0x21')](_0xf91887,_0x217ed1,_0x2f5567);}})[_0xd86f('0x15')](function(_0x3e3489){_0x217ed1=_0x3e3489;var _0x3a8302=![];if(_0x217ed1['length']===0x0){if(_0x3d4b53||_0x2f5567){_0x3a8302=!![];}if(_0x20f7fd){_0x3a8302=![];}}if(_0x3a8302){return _0x252d77;}var _0x389d7f=_[_0xd86f('0x22')](db[_0xd86f('0x23')][_0xd86f('0x24')],function(_0x131d75){return{'name':_0x131d75['fieldName'],'type':_0x131d75['type'][_0xd86f('0x25')]};});_0x3cc48e['query'][_0xd86f('0x26')]=_0xd86f('0x27');_0x3f16b4=qs[_0xd86f('0x28')](_0x389d7f,_0x3cc48e);_0x3f16b4[_0xd86f('0x29')]=!![];var _0x154b5f=[];if(_0x217ed1['length']>0x0){_0x154b5f['push']({'id':{'$in':_0x217ed1}});if(_0x2b977a&&!_0x2f5567){_0x5d5881=[db[_0xd86f('0x2a')][_0xd86f('0x2b')](_0xd86f('0x2c')+_0x217ed1+')')];_0x3f16b4[_0xd86f('0x1d')]=_0x5d5881;}}if(_0x20f7fd){_0x4b64ea['forEach'](function(_0x3bb489){var _0x1139ec=!![];if(_0x2f5567===_0xd86f('0x13')&&_0x5a3114!==_0x3bb489){_0x1139ec=![];}_0x154b5f[_0xd86f('0x2d')]({[_0x3bb489+_0xd86f('0x2e')]:_0x1139ec});});if(_0x3297a8){_0x154b5f[_0xd86f('0x2d')]({'pauseType':_0x3297a8});}}else if(_0x2f5567){_0x4b64ea[_0xd86f('0x2f')](function(_0x5e088c){_0x154b5f[_0xd86f('0x2d')]({[_0x5e088c+_0xd86f('0x2e')]:![]});});}_0x3f16b4[_0xd86f('0x30')]=_[_0xd86f('0x31')](_0x3f16b4['where'],{'$and':_0x154b5f});if(_0x3cc48e[_0xd86f('0x32')][_0xd86f('0x26')]===_0xd86f('0x32')){var _0x2751d3={'params':{'id':_0x3cc48e[_0xd86f('0x32')][_0xd86f('0x33')]},'query':{'section':'Agents','role':'agent','raw':!![],'ids':_0x217ed1,'customSorting':_0x5d5881}};if(_0x3cc48e[_0xd86f('0xe')][_0xd86f('0x34')]){_0x2751d3[_0xd86f('0xe')]['online']=!![];}if(_0x20f7fd){_0x2751d3[_0xd86f('0xe')][_0xd86f('0x35')]=_0x154b5f;}_0x2751d3[_0xd86f('0xe')]=Object[_0xd86f('0x36')](_0x2751d3[_0xd86f('0xe')],_[_0xd86f('0x37')](_0x3cc48e[_0xd86f('0xe')],'id'));return db[_0xd86f('0x38')][_0xd86f('0x39')](_0x2751d3);}return db['User'][_0xd86f('0x3a')](_0x3f16b4);})[_0xd86f('0x15')](function(_0x2c7ea1){_0x252d77[_0xd86f('0xa')]=_0x2c7ea1[_0xd86f('0xa')];_0xaaa2f7=_0x2c7ea1[_0xd86f('0x3b')];return _0xaaa2f7[_0xd86f('0x22')](function(_0xb47261){var _0x112686=_[_0xd86f('0x3c')](_0xf91887,['id',_0xb47261['id']]);if(_0x112686){var _0x4d45d0=rta[_0xd86f('0x3d')](_0x112686);_[_0xd86f('0x31')](_0xb47261,_0x4d45d0);}_0xb47261[_0xd86f('0x1b')]=rta[_0xd86f('0x3e')](_0xb47261);if(_0xb47261[_0xd86f('0x1b')][_0xd86f('0x1a')](_0xd86f('0x12'))){_0x4b64ea[_0xd86f('0x2f')](function(_0x5a8986){if(_0xb47261[_0x5a8986+'Pause']){if(_0x5a8986==='voice'){if(_0xb47261[_0xd86f('0x3f')]!==_0xd86f('0x40')){_0xb47261[_0xd86f('0x3f')]='pause';}}else{_0xb47261[_0x5a8986+'Status']=_0xd86f('0x12');}}});}return _0xb47261;});})[_0xd86f('0x15')](function(_0xfe2c70){if(!_0x2b977a||_0x5d5881){return _0xfe2c70;}return rta['sortAgentsByStatus'](_0xfe2c70,_0x2b977a);})[_0xd86f('0x15')](function(_0x76ae16){var _0x1a5a08=rta['getRealtimeAgentsQueryFields']();_0x252d77[_0xd86f('0x3b')]=_0x76ae16[_0xd86f('0x22')](function(_0x527f34){return _[_0xd86f('0x41')](_0x527f34,_0x1a5a08);});return _0x252d77;})['then'](respondWithFilteredResult(_0x307eca,_0x3f16b4))['catch'](APIHandleError(_0x307eca));};exports[_0xd86f('0x42')]=function(_0xf098e9,_0x3624f1){var _0x4275aa={'count':0x0,'rows':[]};var _0x3773d8={};var _0x1d12ef;var _0x4417d9;var _0x4671b3;Promise[_0xd86f('0x14')]()[_0xd86f('0x15')](function(){if(_0xf098e9[_0xd86f('0xe')][_0xd86f('0x16')]){if(!utils[_0xd86f('0x43')](_0xf098e9[_0xd86f('0xe')][_0xd86f('0x16')])){throw new APIBadRequestError(util[_0xd86f('0x17')](_0xd86f('0x18'),_0xf098e9[_0xd86f('0xe')]['channel']));}_0x1d12ef=_0xf098e9[_0xd86f('0xe')][_0xd86f('0x16')][_0xd86f('0x44')]();}var _0x1be5fc=_[_0xd86f('0x45')](_0x1d12ef)+_0xd86f('0x46');var _0x372ee9=_[_0xd86f('0x22')](db[_0x1be5fc][_0xd86f('0x24')],function(_0x516994){return{'name':_0x516994[_0xd86f('0x47')],'type':_0x516994[_0xd86f('0x48')]['key']};});if(!_0xf098e9['query'][_0xd86f('0x1c')]){var _0x116c9a=['id',_0xd86f('0x49')];if(_0x1d12ef===_0xd86f('0x4a')){_0x116c9a[_0xd86f('0x2d')](_0xd86f('0x48'));if(_0xf098e9['query'][_0xd86f('0x48')]==='outbound'){_0x116c9a[_0xd86f('0x2d')]([_0xd86f('0x4b'),_0xd86f('0x4c')]);}}_0xf098e9[_0xd86f('0xe')][_0xd86f('0x1c')]=_0x116c9a['join'](',');}_0x3773d8=qs['getOptions'](_0x372ee9,_0xf098e9);if(_0xf098e9[_0xd86f('0x32')][_0xd86f('0x26')]===_0xd86f('0x32')){var _0x10706c={'params':{'id':_0xf098e9[_0xd86f('0x32')][_0xd86f('0x33')]},'query':{'section':_0x1d12ef===_0xd86f('0x4a')&&_0xf098e9[_0xd86f('0xe')]['type']===_0xd86f('0x4d')?_0xd86f('0x4e'):_[_0xd86f('0x45')](_0x1d12ef)+_0xd86f('0x4f'),'type':_0xf098e9[_0xd86f('0xe')]['type'],'nolimit':!![],'sort':_0xd86f('0x49'),'filter':_0xf098e9[_0xd86f('0xe')][_0xd86f('0x50')]}};_0x10706c['query']=Object['assign'](_0x10706c['query'],_0xf098e9[_0xd86f('0xe')]);delete _0x10706c[_0xd86f('0xe')]['id'];return db[_0xd86f('0x38')]['getResources'](_0x10706c);}return db[_0x1be5fc][_0xd86f('0x3a')](_0x3773d8);})[_0xd86f('0x15')](function(_0x53910a){_0x4275aa[_0xd86f('0xa')]=_0x53910a[_0xd86f('0xa')];_0x4417d9=_0x53910a['rows'];return rtq[_0xd86f('0x51')](_0xf098e9,_0x1d12ef);})[_0xd86f('0x15')](function(_0xa2a85a){_0x4671b3=_0xa2a85a[_0xd86f('0x3b')];return rtq[_0xd86f('0x52')](_0x4417d9,_0x4671b3,_0x1d12ef,_0xf098e9[_0xd86f('0xe')][_0xd86f('0x48')]);})['then'](function(_0x490f41){_0x4275aa[_0xd86f('0x3b')]=_0x490f41;return _0x4275aa;})[_0xd86f('0x15')](respondWithFilteredResult(_0x3624f1,_0x3773d8))[_0xd86f('0x53')](APIHandleError(_0x3624f1));}; \ No newline at end of file +var _0x1683=['order','forEach','*pause','Pause','merge','user','online','extraQueryConditions','assign','omit','UserProfile','getResources','findAndCountAll','rows','find','filterAgentAttributes','getAgentStatus','pause','voice','voiceStatus','talking','Status','sortAgentsByStatus','getRealtimeAgentsQueryFields','map','pick','getQueues','isValidChannel','toLowerCase','Queue','type','outbound','dialMethod','userProfileId','QueueCampaigns','startCase','Queues','name','getRealtimeQueues','initializeQueues','catch','util','../../components/realtime/agents','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','APIBadRequestError','offset','undefined','limit','count','status','Content-Range','json','getAgents','getChannels','query','globalQueueFilter','globalStatusFilter','pauseTypeFilter','resolve','then','channel','format','Channel\x20parameter\x20%s\x20is\x20invalid','sort','includes','globalStatus','validateSortParameter','fields','join','getAgentIdsByQueues','getRealtimeAgents','getSortedAgentsIdsByStatus','getAgentIdsByStatus','User','rawAttributes','fieldName','key','role','agent','getOptions','raw','length','push','sequelize','FIELD(id,'];(function(_0x2048c7,_0x4e13d1){var _0x2ac7c3=function(_0x1bc414){while(--_0x1bc414){_0x2048c7['push'](_0x2048c7['shift']());}};_0x2ac7c3(++_0x4e13d1);}(_0x1683,0x81));var _0x3168=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x1683[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var util=require(_0x3168('0x0'));var rta=require(_0x3168('0x1'));var rtq=require('../../components/realtime/queues');var qs=require(_0x3168('0x2'));var utils=require(_0x3168('0x3'));var db=require(_0x3168('0x4'))['db'];var APIBadRequestError=require(_0x3168('0x5'))[_0x3168('0x6')];var APIHandleError=require(_0x3168('0x5'))['handleError'];function respondWithFilteredResult(_0x47e4fe,_0x5f0185){return function(_0x3664f7){if(_0x3664f7){var _0x2d49f2=typeof _0x5f0185[_0x3168('0x7')]===_0x3168('0x8')&&typeof _0x5f0185[_0x3168('0x9')]===_0x3168('0x8');var _0x148606=_0x3664f7['count'];var _0x48ec80=_0x2d49f2?0x0:_0x5f0185[_0x3168('0x7')];var _0x370b8f=_0x2d49f2?_0x3664f7[_0x3168('0xa')]:_0x5f0185[_0x3168('0x7')]+_0x5f0185[_0x3168('0x9')];var _0x221952;if(_0x370b8f>=_0x148606){_0x370b8f=_0x148606;_0x221952=0xc8;}else{_0x221952=0xce;}_0x47e4fe[_0x3168('0xb')](_0x221952);return _0x47e4fe['set'](_0x3168('0xc'),_0x48ec80+'-'+_0x370b8f+'/'+_0x148606)[_0x3168('0xd')](_0x3664f7);}return null;};}exports[_0x3168('0xe')]=function(_0x3c99d3,_0x1ac095){var _0x133423={'count':0x0,'rows':[]};var _0x256318={};var _0x1acb95;var _0x4fb75c=utils[_0x3168('0xf')]();var _0x49e4e4;var _0x52eb55;var _0x408f37=_0x3c99d3[_0x3168('0x10')][_0x3168('0x11')];var _0x537cfd=_0x3c99d3[_0x3168('0x10')][_0x3168('0x12')];var _0x3fe995=_0x3c99d3[_0x3168('0x10')][_0x3168('0x13')];var _0x2196ae=_0x537cfd==='pause'||_0x537cfd==='*pause'?!![]:![];var _0x1dc1ce=[];var _0x5584e2;var _0x2f44b0;Promise[_0x3168('0x14')]()[_0x3168('0x15')](function(){if(_0x3c99d3[_0x3168('0x10')][_0x3168('0x16')]){if(!utils['isValidChannel'](_0x3c99d3[_0x3168('0x10')][_0x3168('0x16')])){throw new APIBadRequestError(util[_0x3168('0x17')](_0x3168('0x18'),_0x3c99d3['query']['channel']));}_0x1acb95=_0x3c99d3[_0x3168('0x10')][_0x3168('0x16')]['toLowerCase']();}if(!_0x3c99d3[_0x3168('0x10')][_0x3168('0x19')]||!_0x3c99d3[_0x3168('0x10')][_0x3168('0x19')][_0x3168('0x1a')](_0x3168('0x1b'))){_0x3c99d3['query'][_0x3168('0x19')]=rta[_0x3168('0x1c')](_0x3c99d3['query'][_0x3168('0x19')]);return;}var _0x4b7f97=rta['getUpdatedSortOptions'](_0x3c99d3[_0x3168('0x10')]['sort']);_0x3c99d3[_0x3168('0x10')][_0x3168('0x19')]=_0x4b7f97[_0x3168('0x1d')][_0x3168('0x1e')](',');_0x5584e2=_0x4b7f97['order'];})['then'](function(){if(!_0x408f37){return[];}return rta[_0x3168('0x1f')](_0x408f37,_0x1acb95);})['then'](function(_0xdf7a36){_0x1dc1ce=_0xdf7a36;return rta[_0x3168('0x20')]();})[_0x3168('0x15')](function(_0x40619a){_0x52eb55=_0x40619a['rows'];if((!_0x537cfd||_0x2196ae)&&!_0x5584e2){return _0x1dc1ce;}if(_0x5584e2&&!_0x537cfd){return rta[_0x3168('0x21')](_0x52eb55,_0x1dc1ce,_0x5584e2);}else{return rta[_0x3168('0x22')](_0x52eb55,_0x1dc1ce,_0x537cfd);}})['then'](function(_0x4812bf){_0x1dc1ce=_0x4812bf;var _0x13ce5c=![];if(_0x1dc1ce['length']===0x0){if(_0x408f37||_0x537cfd){_0x13ce5c=!![];}if(_0x2196ae){_0x13ce5c=![];}}if(_0x13ce5c){return _0x133423;}var _0x3f76ef=_['map'](db[_0x3168('0x23')][_0x3168('0x24')],function(_0x1551be){return{'name':_0x1551be[_0x3168('0x25')],'type':_0x1551be['type'][_0x3168('0x26')]};});_0x3c99d3[_0x3168('0x10')][_0x3168('0x27')]=_0x3168('0x28');_0x256318=qs[_0x3168('0x29')](_0x3f76ef,_0x3c99d3);_0x256318[_0x3168('0x2a')]=!![];var _0x495b28=[];if(_0x1dc1ce[_0x3168('0x2b')]>0x0){_0x495b28[_0x3168('0x2c')]({'id':{'$in':_0x1dc1ce}});if(_0x5584e2&&!_0x537cfd){_0x2f44b0=[db[_0x3168('0x2d')]['literal'](_0x3168('0x2e')+_0x1dc1ce+')')];_0x256318[_0x3168('0x2f')]=_0x2f44b0;}}if(_0x2196ae){_0x4fb75c[_0x3168('0x30')](function(_0x2423e2){var _0x13df49=!![];if(_0x537cfd===_0x3168('0x31')&&_0x1acb95!==_0x2423e2){_0x13df49=![];}_0x495b28['push']({[_0x2423e2+'Pause']:_0x13df49});});if(_0x3fe995){_0x495b28[_0x3168('0x2c')]({'pauseType':_0x3fe995});}}else if(_0x537cfd){_0x4fb75c[_0x3168('0x30')](function(_0xd15b4e){_0x495b28['push']({[_0xd15b4e+_0x3168('0x32')]:![]});});}_0x256318['where']=_[_0x3168('0x33')](_0x256318['where'],{'$and':_0x495b28});if(_0x3c99d3['user']['role']===_0x3168('0x34')){var _0x1fb49d={'params':{'id':_0x3c99d3[_0x3168('0x34')]['userProfileId']},'query':{'section':'Agents','role':_0x3168('0x28'),'raw':!![],'ids':_0x1dc1ce,'customSorting':_0x2f44b0}};if(_0x3c99d3[_0x3168('0x10')][_0x3168('0x35')]){_0x1fb49d['query']['online']=!![];}if(_0x2196ae){_0x1fb49d[_0x3168('0x10')][_0x3168('0x36')]=_0x495b28;}_0x1fb49d['query']=Object[_0x3168('0x37')](_0x1fb49d[_0x3168('0x10')],_[_0x3168('0x38')](_0x3c99d3['query'],'id'));return db[_0x3168('0x39')][_0x3168('0x3a')](_0x1fb49d);}return db[_0x3168('0x23')][_0x3168('0x3b')](_0x256318);})[_0x3168('0x15')](function(_0x202e9c){_0x133423[_0x3168('0xa')]=_0x202e9c[_0x3168('0xa')];_0x49e4e4=_0x202e9c[_0x3168('0x3c')];return _0x49e4e4['map'](function(_0x11a7aa){var _0x533a8b=_[_0x3168('0x3d')](_0x52eb55,['id',_0x11a7aa['id']]);if(_0x533a8b){var _0x457c12=rta[_0x3168('0x3e')](_0x533a8b);_[_0x3168('0x33')](_0x11a7aa,_0x457c12);}_0x11a7aa['globalStatus']=rta[_0x3168('0x3f')](_0x11a7aa);if(_0x11a7aa[_0x3168('0x1b')][_0x3168('0x1a')](_0x3168('0x40'))){_0x4fb75c[_0x3168('0x30')](function(_0x381898){if(_0x11a7aa[_0x381898+_0x3168('0x32')]){if(_0x381898===_0x3168('0x41')){if(_0x11a7aa[_0x3168('0x42')]!==_0x3168('0x43')){_0x11a7aa['voiceStatus']='pause';}}else{_0x11a7aa[_0x381898+_0x3168('0x44')]='pause';}}});}return _0x11a7aa;});})[_0x3168('0x15')](function(_0x47c2a7){if(!_0x5584e2||_0x2f44b0){return _0x47c2a7;}return rta[_0x3168('0x45')](_0x47c2a7,_0x5584e2);})['then'](function(_0x1adba5){var _0x156a96=rta[_0x3168('0x46')]();_0x133423['rows']=_0x1adba5[_0x3168('0x47')](function(_0x496890){return _[_0x3168('0x48')](_0x496890,_0x156a96);});return _0x133423;})[_0x3168('0x15')](respondWithFilteredResult(_0x1ac095,_0x256318))['catch'](APIHandleError(_0x1ac095));};exports[_0x3168('0x49')]=function(_0x5a0961,_0x3f1a6e){var _0x5e4afc={'count':0x0,'rows':[]};var _0x571a20={};var _0x38dc85;var _0x35794a;var _0x238675;Promise[_0x3168('0x14')]()['then'](function(){if(_0x5a0961[_0x3168('0x10')][_0x3168('0x16')]){if(!utils[_0x3168('0x4a')](_0x5a0961[_0x3168('0x10')][_0x3168('0x16')])){throw new APIBadRequestError(util['format'](_0x3168('0x18'),_0x5a0961[_0x3168('0x10')][_0x3168('0x16')]));}_0x38dc85=_0x5a0961['query']['channel'][_0x3168('0x4b')]();}var _0x257a85=_['startCase'](_0x38dc85)+_0x3168('0x4c');var _0x580192=_[_0x3168('0x47')](db[_0x257a85][_0x3168('0x24')],function(_0x3cb734){return{'name':_0x3cb734['fieldName'],'type':_0x3cb734[_0x3168('0x4d')][_0x3168('0x26')]};});if(!_0x5a0961[_0x3168('0x10')][_0x3168('0x1d')]){var _0x391dc1=['id','name'];if(_0x38dc85===_0x3168('0x41')){_0x391dc1[_0x3168('0x2c')](_0x3168('0x4d'));if(_0x5a0961[_0x3168('0x10')][_0x3168('0x4d')]===_0x3168('0x4e')){_0x391dc1['push'](['dialActive',_0x3168('0x4f')]);}}_0x5a0961[_0x3168('0x10')][_0x3168('0x1d')]=_0x391dc1[_0x3168('0x1e')](',');}_0x571a20=qs[_0x3168('0x29')](_0x580192,_0x5a0961);if(_0x5a0961[_0x3168('0x34')][_0x3168('0x27')]==='user'){var _0x20b3aa={'params':{'id':_0x5a0961['user'][_0x3168('0x50')]},'query':{'section':_0x38dc85===_0x3168('0x41')&&_0x5a0961[_0x3168('0x10')][_0x3168('0x4d')]==='outbound'?_0x3168('0x51'):_[_0x3168('0x52')](_0x38dc85)+_0x3168('0x53'),'type':_0x5a0961[_0x3168('0x10')][_0x3168('0x4d')],'nolimit':!![],'sort':_0x3168('0x54'),'filter':_0x5a0961[_0x3168('0x10')]['filter']}};_0x20b3aa[_0x3168('0x10')]=Object[_0x3168('0x37')](_0x20b3aa['query'],_0x5a0961['query']);delete _0x20b3aa[_0x3168('0x10')]['id'];return db[_0x3168('0x39')][_0x3168('0x3a')](_0x20b3aa);}return db[_0x257a85][_0x3168('0x3b')](_0x571a20);})[_0x3168('0x15')](function(_0x1ccba6){_0x5e4afc[_0x3168('0xa')]=_0x1ccba6[_0x3168('0xa')];_0x35794a=_0x1ccba6[_0x3168('0x3c')];return rtq[_0x3168('0x55')](_0x5a0961,_0x38dc85);})[_0x3168('0x15')](function(_0x6eb177){_0x238675=_0x6eb177[_0x3168('0x3c')];return rtq[_0x3168('0x56')](_0x35794a,_0x238675,_0x38dc85,_0x5a0961[_0x3168('0x10')]['type']);})['then'](function(_0x38b748){_0x5e4afc[_0x3168('0x3c')]=_0x38b748;return _0x5e4afc;})[_0x3168('0x15')](respondWithFilteredResult(_0x3f1a6e,_0x571a20))[_0x3168('0x57')](APIHandleError(_0x3f1a6e));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index a1a353a..9a5a75d 100644 --- a/server/api/reportAgentPreview/index.js +++ b/server/api/reportAgentPreview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x3ed5fb,_0x1be775){var _0x4327c2=function(_0x2d5f2b){while(--_0x2d5f2b){_0x3ed5fb['push'](_0x3ed5fb['shift']());}};_0x4327c2(++_0x1be775);}(_0x70e0,0x17b));var _0x070e=function(_0x359970,_0x4618eb){_0x359970=_0x359970-0x0;var _0xf32d92=_0x70e0[_0x359970];return _0xf32d92;};'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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1f0fa6,_0x267e0b){var _0x457cb7=function(_0x548ce9){while(--_0x548ce9){_0x1f0fa6['push'](_0x1f0fa6['shift']());}};_0x457cb7(++_0x267e0b);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 86dfb5e..fd40a58 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 _0x7923=['INTEGER','STRING','DATE','sequelize','exports'];(function(_0x3dadaa,_0x79d509){var _0x339ad4=function(_0x26e100){while(--_0x26e100){_0x3dadaa['push'](_0x3dadaa['shift']());}};_0x339ad4(++_0x79d509);}(_0x7923,0x8f));var _0x3792=function(_0x4ed16c,_0x4ead33){_0x4ed16c=_0x4ed16c-0x0;var _0x5b0af5=_0x7923[_0x4ed16c];return _0x5b0af5;};'use strict';var Sequelize=require(_0x3792('0x0'));module[_0x3792('0x1')]={'state':{'type':Sequelize[_0x3792('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x3792('0x3')]},'scheduledat':{'type':Sequelize[_0x3792('0x4')]},'uniqueid':{'type':Sequelize[_0x3792('0x3')]},'starttime':{'type':Sequelize[_0x3792('0x4')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x3792('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x3792('0x3')]}}; \ No newline at end of file +var _0xc1c6=['DATE','STRING','sequelize','exports','INTEGER'];(function(_0x61b81f,_0x56878d){var _0x87a3d2=function(_0x265de9){while(--_0x265de9){_0x61b81f['push'](_0x61b81f['shift']());}};_0x87a3d2(++_0x56878d);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x4d6dd0,_0x462567){_0x4d6dd0=_0x4d6dd0-0x0;var _0x1fb742=_0xc1c6[_0x4d6dd0];return _0x1fb742;};'use strict';var Sequelize=require(_0x6c1c('0x0'));module[_0x6c1c('0x1')]={'state':{'type':Sequelize[_0x6c1c('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x6c1c('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x6c1c('0x3')]},'responsetime':{'type':Sequelize[_0x6c1c('0x3')]},'ringtime':{'type':Sequelize[_0x6c1c('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x6c1c('0x4')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 6db4874..86b82f6 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 _0x52f2=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./reportAgentPreview.attributes','define','ReportAgentPreview','report_agent_preview','lodash','util'];(function(_0x3aef0f,_0x513c63){var _0x1ed516=function(_0x567588){while(--_0x567588){_0x3aef0f['push'](_0x3aef0f['shift']());}};_0x1ed516(++_0x513c63);}(_0x52f2,0x11c));var _0x252f=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0x52f2[_0x54d4fe];return _0x1ab5bb;};'use strict';var _=require(_0x252f('0x0'));var util=require(_0x252f('0x1'));var logger=require(_0x252f('0x2'))(_0x252f('0x3'));var moment=require(_0x252f('0x4'));var BPromise=require(_0x252f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x252f('0x6'));var rimraf=require(_0x252f('0x7'));var config=require(_0x252f('0x8'));var attributes=require(_0x252f('0x9'));module['exports']=function(_0x5419eb,_0x2f7fde){return _0x5419eb[_0x252f('0xa')](_0x252f('0xb'),attributes,{'tableName':_0x252f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x268a=['./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x525335,_0x35fe4e){var _0x29c6af=function(_0x31c4c3){while(--_0x31c4c3){_0x525335['push'](_0x525335['shift']());}};_0x29c6af(++_0x35fe4e);}(_0x268a,0x171));var _0xa268=function(_0x3ec1da,_0x1e36f5){_0x3ec1da=_0x3ec1da-0x0;var _0x472358=_0x268a[_0x3ec1da];return _0x472358;};'use strict';var _=require(_0xa268('0x0'));var util=require('util');var logger=require(_0xa268('0x1'))(_0xa268('0x2'));var moment=require(_0xa268('0x3'));var BPromise=require(_0xa268('0x4'));var rp=require(_0xa268('0x5'));var fs=require('fs');var path=require(_0xa268('0x6'));var rimraf=require(_0xa268('0x7'));var config=require(_0xa268('0x8'));var attributes=require(_0xa268('0x9'));module[_0xa268('0xa')]=function(_0x1a1c81,_0x88f69e){return _0x1a1c81[_0xa268('0xb')](_0xa268('0xc'),attributes,{'tableName':_0xa268('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index c159429..659cc16 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 _0x701b=['catch','ReportAgentPreview','body','options','raw','then','CreateReportAgentPreview','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x701b,0x16f));var _0xb701=function(_0x356ff1,_0x13194a){_0x356ff1=_0x356ff1-0x0;var _0x19a90a=_0x701b[_0x356ff1];return _0x19a90a;};'use strict';var _=require(_0xb701('0x0'));var util=require(_0xb701('0x1'));var moment=require(_0xb701('0x2'));var BPromise=require(_0xb701('0x3'));var rs=require(_0xb701('0x4'));var fs=require('fs');var Redis=require(_0xb701('0x5'));var db=require(_0xb701('0x6'))['db'];var utils=require(_0xb701('0x7'));var logger=require(_0xb701('0x8'))(_0xb701('0x9'));var config=require(_0xb701('0xa'));var jayson=require(_0xb701('0xb'));var client=jayson[_0xb701('0xc')][_0xb701('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x23cf96,_0x5ec158,_0x14fec2){return new BPromise(function(_0x3bd424,_0x4c179f){return client[_0xb701('0xe')](_0x23cf96,_0x14fec2)['then'](function(_0x394c5e){logger[_0xb701('0xf')](_0xb701('0x10'),_0x5ec158,_0xb701('0x11'));logger['debug'](_0xb701('0x12'),_0x5ec158,_0xb701('0x11'),JSON[_0xb701('0x13')](_0x394c5e));if(_0x394c5e['error']){if(_0x394c5e[_0xb701('0x14')][_0xb701('0x15')]===0x1f4){logger[_0xb701('0x14')](_0xb701('0x10'),_0x5ec158,_0x394c5e[_0xb701('0x14')]['message']);return _0x4c179f(_0x394c5e[_0xb701('0x14')][_0xb701('0x16')]);}logger[_0xb701('0x14')](_0xb701('0x10'),_0x5ec158,_0x394c5e[_0xb701('0x14')][_0xb701('0x16')]);return _0x3bd424(_0x394c5e[_0xb701('0x14')]['message']);}else{logger['info'](_0xb701('0x10'),_0x5ec158,_0xb701('0x11'));_0x3bd424(_0x394c5e['result'][_0xb701('0x16')]);}})[_0xb701('0x17')](function(_0x5d1992){logger['error'](_0xb701('0x10'),_0x5ec158,_0x5d1992);_0x4c179f(_0x5d1992);});});}exports['CreateReportAgentPreview']=function(_0x183b13){var _0x22d1d9=this;return new Promise(function(_0x44933b,_0x2b6c19){return db[_0xb701('0x18')]['create'](_0x183b13[_0xb701('0x19')],{'raw':_0x183b13[_0xb701('0x1a')]?_0x183b13[_0xb701('0x1a')][_0xb701('0x1b')]===undefined?!![]:![]:!![]})[_0xb701('0x1c')](function(_0x1d902e){logger[_0xb701('0xf')](_0xb701('0x1d'),_0x183b13);logger['debug'](_0xb701('0x1d'),_0x183b13,JSON[_0xb701('0x13')](_0x1d902e));_0x44933b(_0x1d902e);})[_0xb701('0x17')](function(_0x22cddc){logger['error']('CreateReportAgentPreview',_0x22cddc[_0xb701('0x16')],_0x183b13);_0x2b6c19(_0x22d1d9['error'](0x1f4,_0x22cddc[_0xb701('0x16')]));});});}; \ No newline at end of file +var _0x2749=['info','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateReportAgentPreview','create','raw','then'];(function(_0x236f82,_0x38df0c){var _0x16720c=function(_0x33fd48){while(--_0x33fd48){_0x236f82['push'](_0x236f82['shift']());}};_0x16720c(++_0x38df0c);}(_0x2749,0x6e));var _0x9274=function(_0x4b86f1,_0x2dc384){_0x4b86f1=_0x4b86f1-0x0;var _0x399e75=_0x2749[_0x4b86f1];return _0x399e75;};'use strict';var _=require(_0x9274('0x0'));var util=require(_0x9274('0x1'));var moment=require(_0x9274('0x2'));var BPromise=require(_0x9274('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9274('0x4'));var db=require(_0x9274('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9274('0x6'))(_0x9274('0x7'));var config=require('../../config/environment');var jayson=require(_0x9274('0x8'));var client=jayson[_0x9274('0x9')][_0x9274('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4f9ae7,_0x1ea8c3,_0xb662f){return new BPromise(function(_0x29700c,_0x28bf23){return client[_0x9274('0xb')](_0x4f9ae7,_0xb662f)['then'](function(_0x5d960b){logger['info'](_0x9274('0xc'),_0x1ea8c3,_0x9274('0xd'));logger[_0x9274('0xe')](_0x9274('0xf'),_0x1ea8c3,'request\x20sent',JSON['stringify'](_0x5d960b));if(_0x5d960b[_0x9274('0x10')]){if(_0x5d960b[_0x9274('0x10')][_0x9274('0x11')]===0x1f4){logger[_0x9274('0x10')]('ReportAgentPreview,\x20%s,\x20%s',_0x1ea8c3,_0x5d960b['error'][_0x9274('0x12')]);return _0x28bf23(_0x5d960b[_0x9274('0x10')][_0x9274('0x12')]);}logger[_0x9274('0x10')]('ReportAgentPreview,\x20%s,\x20%s',_0x1ea8c3,_0x5d960b[_0x9274('0x10')]['message']);return _0x29700c(_0x5d960b['error'][_0x9274('0x12')]);}else{logger['info']('ReportAgentPreview,\x20%s,\x20%s',_0x1ea8c3,'request\x20sent');_0x29700c(_0x5d960b[_0x9274('0x13')][_0x9274('0x12')]);}})[_0x9274('0x14')](function(_0x2b3d06){logger[_0x9274('0x10')](_0x9274('0xc'),_0x1ea8c3,_0x2b3d06);_0x28bf23(_0x2b3d06);});});}exports[_0x9274('0x15')]=function(_0x149276){var _0x2d431e=this;return new Promise(function(_0x29e853,_0x1a8377){return db['ReportAgentPreview'][_0x9274('0x16')](_0x149276['body'],{'raw':_0x149276['options']?_0x149276['options'][_0x9274('0x17')]===undefined?!![]:![]:!![]})[_0x9274('0x18')](function(_0x3897d4){logger[_0x9274('0x19')](_0x9274('0x15'),_0x149276);logger[_0x9274('0xe')]('CreateReportAgentPreview',_0x149276,JSON[_0x9274('0x1a')](_0x3897d4));_0x29e853(_0x3897d4);})[_0x9274('0x14')](function(_0x6e6415){logger['error']('CreateReportAgentPreview',_0x6e6415[_0x9274('0x12')],_0x149276);_0x1a8377(_0x2d431e['error'](0x1f4,_0x6e6415['message']));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 51080e3..2a43968 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 _0x5a9c=['/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','post','queueNotify','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/openchannel/queues/:id/notify','openchannel','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','/sms/queues/:id','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','util','path','express','Router','../../components/auth/service','./rpc.controller','/voice/channels','isAuthenticated','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','get','/voice/channels/:uniqueid/stopmixmonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','/sms/queues','smsQueues','/whatsapp/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels'];(function(_0x504b32,_0x183b43){var _0x117d62=function(_0x13a6ec){while(--_0x13a6ec){_0x504b32['push'](_0x504b32['shift']());}};_0x117d62(++_0x183b43);}(_0x5a9c,0xcb));var _0xc5a9=function(_0x18db9f,_0x52c3a6){_0x18db9f=_0x18db9f-0x0;var _0x2b840c=_0x5a9c[_0x18db9f];return _0x2b840c;};'use strict';var multer=require('multer');var util=require(_0xc5a9('0x0'));var path=require(_0xc5a9('0x1'));var express=require(_0xc5a9('0x2'));var router=express[_0xc5a9('0x3')]();var auth=require(_0xc5a9('0x4'));var controller=require(_0xc5a9('0x5'));router['get'](_0xc5a9('0x6'),auth[_0xc5a9('0x7')](),controller['voiceChannels']);router['get'](_0xc5a9('0x8'),auth[_0xc5a9('0x7')](),controller[_0xc5a9('0x9')]);router[_0xc5a9('0xa')](_0xc5a9('0xb'),auth[_0xc5a9('0x7')](),controller['voiceChannelStopMixMonitor']);router[_0xc5a9('0xa')](_0xc5a9('0xc'),auth['isAuthenticated'](),controller[_0xc5a9('0xd')]);router[_0xc5a9('0xa')](_0xc5a9('0xe'),auth[_0xc5a9('0x7')](),controller[_0xc5a9('0xf')]);router[_0xc5a9('0xa')](_0xc5a9('0x10'),auth[_0xc5a9('0x7')](),controller[_0xc5a9('0x11')]);router[_0xc5a9('0xa')](_0xc5a9('0x12'),auth[_0xc5a9('0x7')](),controller[_0xc5a9('0x13')]);router[_0xc5a9('0xa')](_0xc5a9('0x14'),auth[_0xc5a9('0x7')](),controller['openchannelQueues']);router[_0xc5a9('0xa')](_0xc5a9('0x15'),auth[_0xc5a9('0x7')](),controller[_0xc5a9('0x16')]);router[_0xc5a9('0xa')](_0xc5a9('0x17'),auth[_0xc5a9('0x7')](),controller['whatsappQueues']);router[_0xc5a9('0xa')]('/fax/queues',auth['isAuthenticated'](),controller[_0xc5a9('0x18')]);router['get'](_0xc5a9('0x19'),auth[_0xc5a9('0x7')](),controller[_0xc5a9('0x1a')]);router[_0xc5a9('0xa')](_0xc5a9('0x1b'),auth[_0xc5a9('0x7')](),controller[_0xc5a9('0x1c')]);router[_0xc5a9('0xa')](_0xc5a9('0x1d'),auth[_0xc5a9('0x7')](),controller['voiceQueuesChannel']);router[_0xc5a9('0xa')]('/voice/queues/channels/:uniqueid/hangup',auth[_0xc5a9('0x7')](),controller['voiceQueuesChannelHangup']);router['get'](_0xc5a9('0x1e'),auth[_0xc5a9('0x7')](),controller[_0xc5a9('0x1f')]);router[_0xc5a9('0xa')](_0xc5a9('0x20'),auth['isAuthenticated'](),controller[_0xc5a9('0x21')]);router[_0xc5a9('0x22')](_0xc5a9('0x20'),auth['isAuthenticated'](),controller[_0xc5a9('0x23')]);router[_0xc5a9('0xa')](_0xc5a9('0x24'),auth[_0xc5a9('0x7')](),controller[_0xc5a9('0x25')]);router[_0xc5a9('0xa')](_0xc5a9('0x26'),auth[_0xc5a9('0x7')](),controller[_0xc5a9('0x27')]);router['get'](_0xc5a9('0x28'),auth[_0xc5a9('0x7')](),controller[_0xc5a9('0x29')]);router[_0xc5a9('0x22')](_0xc5a9('0x2a'),auth[_0xc5a9('0x7')](),controller[_0xc5a9('0x2b')]);router['get'](_0xc5a9('0x2c'),auth[_0xc5a9('0x7')](),controller[_0xc5a9('0x2d')]);router[_0xc5a9('0xa')](_0xc5a9('0x2e'),auth[_0xc5a9('0x7')](),controller[_0xc5a9('0x2f')]);router[_0xc5a9('0xa')](_0xc5a9('0x30'),auth[_0xc5a9('0x7')](),controller[_0xc5a9('0x31')]);router[_0xc5a9('0xa')](_0xc5a9('0x32'),auth['isAuthenticated'](),controller[_0xc5a9('0x33')]);router[_0xc5a9('0xa')](_0xc5a9('0x34'),auth[_0xc5a9('0x7')](),controller[_0xc5a9('0x35')]);router[_0xc5a9('0xa')]('/mail/queues/waitinginteractions',auth[_0xc5a9('0x7')](),controller[_0xc5a9('0x36')]);router[_0xc5a9('0xa')]('/openchannel/queues/waitinginteractions',auth[_0xc5a9('0x7')](),controller[_0xc5a9('0x37')]);router['get']('/openchannel/queues/:id/waitinginteractions',auth[_0xc5a9('0x7')](),controller['openchannelQueuesIdWaitingInteractions']);router[_0xc5a9('0xa')](_0xc5a9('0x38'),auth['isAuthenticated'](),controller[_0xc5a9('0x39')]);router[_0xc5a9('0xa')]('/whatsapp/queues/waitinginteractions',auth[_0xc5a9('0x7')](),controller[_0xc5a9('0x3a')]);router[_0xc5a9('0xa')]('/fax/queues/waitinginteractions',auth[_0xc5a9('0x7')](),controller['faxQueuesWaitingInteractions']);router[_0xc5a9('0x3b')]('/mail/queues/:id/notify',auth[_0xc5a9('0x7')](),controller[_0xc5a9('0x3c')]('mail'));router[_0xc5a9('0xa')](_0xc5a9('0x3d'),auth['isAuthenticated'](),controller[_0xc5a9('0x3e')]);router[_0xc5a9('0x3b')](_0xc5a9('0x3f'),auth[_0xc5a9('0x7')](),controller[_0xc5a9('0x3c')](_0xc5a9('0x40')));router[_0xc5a9('0xa')](_0xc5a9('0x41'),auth[_0xc5a9('0x7')](),controller[_0xc5a9('0x42')]);router[_0xc5a9('0x3b')](_0xc5a9('0x43'),auth[_0xc5a9('0x7')](),controller[_0xc5a9('0x3c')](_0xc5a9('0x44')));router[_0xc5a9('0xa')]('/fax/queues/:id',auth[_0xc5a9('0x7')](),controller['showFaxQueues']);router['post'](_0xc5a9('0x45'),auth[_0xc5a9('0x7')](),controller['queueNotify'](_0xc5a9('0x46')));router[_0xc5a9('0xa')]('/openchannel/queues/:id',auth[_0xc5a9('0x7')](),controller[_0xc5a9('0x47')]);router[_0xc5a9('0x3b')](_0xc5a9('0x48'),auth[_0xc5a9('0x7')](),controller['queueNotify'](_0xc5a9('0x49')));router['post'](_0xc5a9('0x4a'),auth[_0xc5a9('0x7')](),controller[_0xc5a9('0x3c')]('whatsapp'));router[_0xc5a9('0xa')](_0xc5a9('0x4b'),auth[_0xc5a9('0x7')](),controller['showSmsQueues']);router[_0xc5a9('0xa')](_0xc5a9('0x4c'),auth[_0xc5a9('0x7')](),controller[_0xc5a9('0x4d')]);router['post'](_0xc5a9('0x4e'),auth['isAuthenticated'](),controller[_0xc5a9('0x4f')]);module[_0xc5a9('0x50')]=router; \ No newline at end of file +var _0x92d6=['isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','/chat/queues','chatQueues','mailQueues','mailAccounts','openchannelQueues','/sms/queues','smsQueues','/fax/queues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','/agents/:id/capacity','/telephones','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','showFaxQueues','post','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','multer','util','path','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels'];(function(_0x582f8b,_0x27e0d6){var _0x46cfcc=function(_0x47ea87){while(--_0x47ea87){_0x582f8b['push'](_0x582f8b['shift']());}};_0x46cfcc(++_0x27e0d6);}(_0x92d6,0x14b));var _0x692d=function(_0x273699,_0x34dcf6){_0x273699=_0x273699-0x0;var _0x4625c5=_0x92d6[_0x273699];return _0x4625c5;};'use strict';var multer=require(_0x692d('0x0'));var util=require(_0x692d('0x1'));var path=require(_0x692d('0x2'));var express=require(_0x692d('0x3'));var router=express[_0x692d('0x4')]();var auth=require(_0x692d('0x5'));var controller=require(_0x692d('0x6'));router[_0x692d('0x7')](_0x692d('0x8'),auth[_0x692d('0x9')](),controller[_0x692d('0xa')]);router[_0x692d('0x7')](_0x692d('0xb'),auth['isAuthenticated'](),controller[_0x692d('0xc')]);router[_0x692d('0x7')](_0x692d('0xd'),auth[_0x692d('0x9')](),controller[_0x692d('0xe')]);router[_0x692d('0x7')](_0x692d('0xf'),auth[_0x692d('0x9')](),controller['voiceQueues']);router['get'](_0x692d('0x10'),auth[_0x692d('0x9')](),controller[_0x692d('0x11')]);router['get']('/mail/queues',auth[_0x692d('0x9')](),controller[_0x692d('0x12')]);router['get']('/mail/accounts',auth[_0x692d('0x9')](),controller[_0x692d('0x13')]);router[_0x692d('0x7')]('/openchannel/queues',auth[_0x692d('0x9')](),controller[_0x692d('0x14')]);router[_0x692d('0x7')](_0x692d('0x15'),auth['isAuthenticated'](),controller[_0x692d('0x16')]);router[_0x692d('0x7')]('/whatsapp/queues',auth[_0x692d('0x9')](),controller['whatsappQueues']);router[_0x692d('0x7')](_0x692d('0x17'),auth['isAuthenticated'](),controller['faxQueues']);router[_0x692d('0x7')](_0x692d('0x18'),auth[_0x692d('0x9')](),controller[_0x692d('0x19')]);router[_0x692d('0x7')](_0x692d('0x1a'),auth[_0x692d('0x9')](),controller[_0x692d('0x1b')]);router[_0x692d('0x7')](_0x692d('0x1c'),auth[_0x692d('0x9')](),controller[_0x692d('0x1d')]);router['get']('/voice/queues/channels/:uniqueid/hangup',auth['isAuthenticated'](),controller[_0x692d('0x1e')]);router[_0x692d('0x7')](_0x692d('0x1f'),auth[_0x692d('0x9')](),controller[_0x692d('0x20')]);router[_0x692d('0x7')](_0x692d('0x21'),auth['isAuthenticated'](),controller[_0x692d('0x22')]);router[_0x692d('0x23')](_0x692d('0x21'),auth[_0x692d('0x9')](),controller[_0x692d('0x24')]);router['get'](_0x692d('0x25'),auth[_0x692d('0x9')](),controller[_0x692d('0x26')]);router['get'](_0x692d('0x27'),auth['isAuthenticated'](),controller[_0x692d('0x28')]);router[_0x692d('0x7')](_0x692d('0x29'),auth[_0x692d('0x9')](),controller[_0x692d('0x2a')]);router[_0x692d('0x23')](_0x692d('0x2b'),auth[_0x692d('0x9')](),controller['agentCapacity']);router['get'](_0x692d('0x2c'),auth['isAuthenticated'](),controller['telephones']);router[_0x692d('0x7')]('/trunks',auth['isAuthenticated'](),controller[_0x692d('0x2d')]);router['get'](_0x692d('0x2e'),auth[_0x692d('0x9')](),controller[_0x692d('0x2f')]);router[_0x692d('0x7')](_0x692d('0x30'),auth[_0x692d('0x9')](),controller[_0x692d('0x31')]);router['get'](_0x692d('0x32'),auth[_0x692d('0x9')](),controller['chatQueuesWaitingInteractions']);router['get'](_0x692d('0x33'),auth[_0x692d('0x9')](),controller[_0x692d('0x34')]);router['get'](_0x692d('0x35'),auth[_0x692d('0x9')](),controller[_0x692d('0x36')]);router[_0x692d('0x7')](_0x692d('0x37'),auth[_0x692d('0x9')](),controller[_0x692d('0x38')]);router[_0x692d('0x7')](_0x692d('0x39'),auth[_0x692d('0x9')](),controller[_0x692d('0x3a')]);router[_0x692d('0x7')]('/whatsapp/queues/waitinginteractions',auth[_0x692d('0x9')](),controller[_0x692d('0x3b')]);router[_0x692d('0x7')]('/fax/queues/waitinginteractions',auth[_0x692d('0x9')](),controller[_0x692d('0x3c')]);router['post'](_0x692d('0x3d'),auth['isAuthenticated'](),controller[_0x692d('0x3e')](_0x692d('0x3f')));router[_0x692d('0x7')](_0x692d('0x40'),auth['isAuthenticated'](),controller[_0x692d('0x41')]);router['post'](_0x692d('0x42'),auth[_0x692d('0x9')](),controller[_0x692d('0x3e')](_0x692d('0x43')));router[_0x692d('0x7')](_0x692d('0x44'),auth[_0x692d('0x9')](),controller[_0x692d('0x45')]);router['post'](_0x692d('0x46'),auth['isAuthenticated'](),controller[_0x692d('0x3e')](_0x692d('0x47')));router[_0x692d('0x7')]('/fax/queues/:id',auth[_0x692d('0x9')](),controller[_0x692d('0x48')]);router[_0x692d('0x49')]('/openchannel/queues/:id/notify',auth['isAuthenticated'](),controller[_0x692d('0x3e')](_0x692d('0x4a')));router[_0x692d('0x7')](_0x692d('0x4b'),auth[_0x692d('0x9')](),controller[_0x692d('0x4c')]);router[_0x692d('0x49')](_0x692d('0x4d'),auth[_0x692d('0x9')](),controller[_0x692d('0x3e')](_0x692d('0x4e')));router[_0x692d('0x49')](_0x692d('0x4f'),auth[_0x692d('0x9')](),controller[_0x692d('0x3e')]('whatsapp'));router[_0x692d('0x7')](_0x692d('0x50'),auth[_0x692d('0x9')](),controller[_0x692d('0x51')]);router[_0x692d('0x7')](_0x692d('0x52'),auth['isAuthenticated'](),controller[_0x692d('0x53')]);router[_0x692d('0x49')](_0x692d('0x54'),auth[_0x692d('0x9')](),controller['agentNotify']);module['exports']=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index d7efe2c..6b1287d 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 _0xb10b=['showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','queue_id','uniq','value','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','capitalize','Website','Account','Queue','\x20Queue\x20not\x20found','Message','findOne','messageId','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','InteractionId','From','QueueId','TransferReport','create','*,*,*,*','agentNotify','channel','chat','User','Agent\x20not\x20found','Start','agentTransferTimeout','bluebird','lodash','util','../../mysqldb','api','jayson/promise','client','http','request','then','error','message','result','status','json','stack','name','send','isNil','rows','find','voiceChannels','query','catch','voiceChannelMixMonitor','merge','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','params','voiceQueues','showVoiceQueues','VoiceQueues','UpdateVoiceQueue','body','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','user','hasOwnProperty','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','MemberReport','findOrCreate','SIP/%s','interface','agent','AgentCapacity','capacity','telephones','Telephones','trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','MailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','faxQueues','FaxQueues'];(function(_0x39e2d7,_0x1b15f6){var _0x413d0d=function(_0x3af71d){while(--_0x3af71d){_0x39e2d7['push'](_0x39e2d7['shift']());}};_0x413d0d(++_0x1b15f6);}(_0xb10b,0x12a));var _0xbb10=function(_0x36cba4,_0x53a452){_0x36cba4=_0x36cba4-0x0;var _0xcc6047=_0xb10b[_0x36cba4];return _0xcc6047;};'use strict';var BPromise=require(_0xbb10('0x0'));var moment=require('moment');var _=require(_0xbb10('0x1'));var util=require(_0xbb10('0x2'));var db=require(_0xbb10('0x3'))['db'];var logger=require('../../config/logger')(_0xbb10('0x4'));var jayson=require(_0xbb10('0x5'));var amiClient=jayson[_0xbb10('0x6')][_0xbb10('0x7')]({'port':0x232a});var mailClient=jayson[_0xbb10('0x6')][_0xbb10('0x7')]({'port':0x232b});var routingClient=jayson['client'][_0xbb10('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){var _0x1c3ee5=_0x1b9e94?_0x1b9e94:amiClient;return _0x1c3ee5[_0xbb10('0x8')](_0x3cdd53,_0x513741)[_0xbb10('0x9')](function(_0x229887){if(_0x229887[_0xbb10('0xa')]){if(_0x229887['error']['code']===0x1f4){return _0x21370f(_0x229887[_0xbb10('0xa')][_0xbb10('0xb')]);}return _0x3fb675(_0x229887[_0xbb10('0xa')]['message']);}else{_0x3fb675(_0x229887[_0xbb10('0xc')]);}})['catch'](function(_0x44fb19){_0x21370f(_0x44fb19);});});}function respondWithResult(_0x916a32,_0x285009){_0x285009=_0x285009||0xc8;return function(_0x193a27){if(_0x193a27){return _0x916a32[_0xbb10('0xd')](_0x285009)[_0xbb10('0xe')](_0x193a27);}return _0x916a32['sendStatus'](0x194);};}function handleError(_0x26e021,_0x42d7e4){_0x42d7e4=_0x42d7e4||0x1f4;return function(_0x45b9d6){logger[_0xbb10('0xa')](_0x45b9d6[_0xbb10('0xf')]);if(_0x45b9d6[_0xbb10('0x10')]){delete _0x45b9d6[_0xbb10('0x10')];}_0x26e021[_0xbb10('0xd')](_0x42d7e4)[_0xbb10('0x11')](_0x45b9d6);};}function findById(_0x2b184e){return function(_0x4a2bfc){if(!_[_0xbb10('0x12')](_0x2b184e)&&!_[_0xbb10('0x12')](_0x4a2bfc)&&!_[_0xbb10('0x12')](_0x4a2bfc[_0xbb10('0x13')])){return _[_0xbb10('0x14')](_0x4a2bfc[_0xbb10('0x13')],function(_0x575cca){return _0x575cca['id']==_0x2b184e;});}return null;};}exports[_0xbb10('0x15')]=function(_0xbf2906,_0xe1c665){return respondWithRpcPromise('VoiceChannels',_0xbf2906[_0xbb10('0x16')])[_0xbb10('0x9')](respondWithResult(_0xe1c665,null))[_0xbb10('0x17')](handleError(_0xe1c665,null));};exports[_0xbb10('0x18')]=function(_0xdf237d,_0x44e563){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0xbb10('0x19')](_0xdf237d[_0xbb10('0x16')],_0xdf237d['params']))['then'](respondWithResult(_0x44e563,null))[_0xbb10('0x17')](handleError(_0x44e563,null));};exports[_0xbb10('0x1a')]=function(_0x2e911d,_0x317da4){return respondWithRpcPromise(_0xbb10('0x1b'),_[_0xbb10('0x19')](_0x2e911d[_0xbb10('0x16')],_0x2e911d[_0xbb10('0x1c')]))[_0xbb10('0x9')](respondWithResult(_0x317da4,null))[_0xbb10('0x17')](handleError(_0x317da4,null));};exports[_0xbb10('0x1d')]=function(_0x26ad93,_0x537898){return respondWithRpcPromise('VoiceQueues',_0x26ad93['query'])[_0xbb10('0x9')](respondWithResult(_0x537898,null))[_0xbb10('0x17')](handleError(_0x537898,null));};exports[_0xbb10('0x1e')]=function(_0x4e25ff,_0x2fdde9){return respondWithRpcPromise(_0xbb10('0x1f'),_0x4e25ff[_0xbb10('0x16')])[_0xbb10('0x9')](findById(_0x4e25ff[_0xbb10('0x1c')]['id']))[_0xbb10('0x9')](respondWithResult(_0x2fdde9,null))[_0xbb10('0x17')](handleError(_0x2fdde9,null));};exports['updateVoiceQueue']=function(_0x3796c7,_0x21ac54){return respondWithRpcPromise(_0xbb10('0x20'),_[_0xbb10('0x19')](_0x3796c7[_0xbb10('0x21')],_0x3796c7[_0xbb10('0x1c')]))['then'](respondWithResult(_0x21ac54,null))[_0xbb10('0x17')](handleError(_0x21ac54,null));};exports['voiceQueuesPreview']=function(_0x448d5c,_0x56f2da){return respondWithRpcPromise(_0xbb10('0x22'),_[_0xbb10('0x19')](_0x448d5c[_0xbb10('0x16')],_0x448d5c['params']))['then'](respondWithResult(_0x56f2da,null))[_0xbb10('0x17')](handleError(_0x56f2da,null));};exports[_0xbb10('0x23')]=function(_0x4f590d,_0x359ad4){return respondWithRpcPromise(_0xbb10('0x24'),_0x4f590d[_0xbb10('0x16')])[_0xbb10('0x9')](respondWithResult(_0x359ad4,null))[_0xbb10('0x17')](handleError(_0x359ad4,null));};exports[_0xbb10('0x25')]=function(_0xf85197,_0x4975f5){return respondWithRpcPromise(_0xbb10('0x26'),_[_0xbb10('0x19')](_0xf85197[_0xbb10('0x16')],_0xf85197[_0xbb10('0x1c')]))[_0xbb10('0x9')](respondWithResult(_0x4975f5,null))[_0xbb10('0x17')](handleError(_0x4975f5,null));};exports[_0xbb10('0x27')]=function(_0x10202c,_0x3c8d7d){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0xbb10('0x19')](_0x10202c[_0xbb10('0x16')],_0x10202c[_0xbb10('0x1c')]))[_0xbb10('0x9')](respondWithResult(_0x3c8d7d,null))['catch'](handleError(_0x3c8d7d,null));};exports[_0xbb10('0x28')]=function(_0x5de37b,_0x4e2754){return respondWithRpcPromise(_0xbb10('0x29'),_[_0xbb10('0x19')](_0x5de37b[_0xbb10('0x16')],_0x5de37b[_0xbb10('0x1c')]))[_0xbb10('0x9')](respondWithResult(_0x4e2754,null))[_0xbb10('0x17')](handleError(_0x4e2754,null));};exports['outbound']=function(_0x1e5bbd,_0x25d72f){return respondWithRpcPromise('Outbound',_0x1e5bbd['query'])['then'](respondWithResult(_0x25d72f,null))[_0xbb10('0x17')](handleError(_0x25d72f,null));};exports[_0xbb10('0x2a')]=function(_0x2b658a,_0x4d5a9b){return respondWithRpcPromise(_0xbb10('0x2b'),_0x2b658a[_0xbb10('0x16')])[_0xbb10('0x9')](respondWithResult(_0x4d5a9b,null))['catch'](handleError(_0x4d5a9b,null));};exports[_0xbb10('0x2c')]=function(_0x12238a,_0x1dcd38){var _0x446f49;return respondWithRpcPromise('Agents',_0x12238a[_0xbb10('0x16')])[_0xbb10('0x9')](function(_0x5835fd){_0x446f49=_0x5835fd;return respondWithRpcPromise(_0xbb10('0x2d'),_0x12238a[_0xbb10('0x16')],routingClient);})[_0xbb10('0x9')](function(_0x3a9934){return _[_0xbb10('0x19')]({},_0x3a9934,_0x446f49);})[_0xbb10('0x9')](respondWithResult(_0x1dcd38,null))['catch'](handleError(_0x1dcd38,null));};exports[_0xbb10('0x2e')]=function(_0x1c7fae,_0x3e7b4c){if(_0x1c7fae[_0xbb10('0x21')]&&_0x1c7fae['body'][_0xbb10('0x2f')]&&_0x1c7fae[_0xbb10('0x30')]&&_0x1c7fae[_0xbb10('0x30')][_0xbb10('0x10')]){for(var _0x5e2cfa in _0x1c7fae[_0xbb10('0x21')][_0xbb10('0x2f')]){if(_0x1c7fae['body']['interaction'][_0xbb10('0x31')](_0x5e2cfa)){db['MemberReport'][_0xbb10('0x32')]({'where':{'channel':_0x5e2cfa,'membername':_0x1c7fae[_0xbb10('0x30')]['name'],'type':_0xbb10('0x33'),'exitAt':null,'uniqueid':_0x1c7fae[_0xbb10('0x21')][_0xbb10('0x2f')][_0x5e2cfa]&&_0x1c7fae['body'][_0xbb10('0x2f')][_0x5e2cfa][_0xbb10('0x34')]?{'$notIn':_0x1c7fae[_0xbb10('0x21')][_0xbb10('0x2f')][_0x5e2cfa]}:{'$ne':null}}})[_0xbb10('0x9')](function(_0x19f94d){var _0x190781=moment()[_0xbb10('0x35')](_0xbb10('0x36'));for(var _0x43b948=0x0,_0x197871=_0x19f94d[_0xbb10('0x34')];_0x43b948<_0x197871;_0x43b948+=0x1){_0x19f94d[_0x43b948]['updateAttributes']({'exitAt':_0x190781});}});for(var _0x426b95=0x0;_0x426b95<_0x1c7fae[_0xbb10('0x21')]['interaction'][_0x5e2cfa][_0xbb10('0x34')];_0x426b95+=0x1){db[_0xbb10('0x37')][_0xbb10('0x38')]({'where':{'channel':_0x5e2cfa,'membername':_0x1c7fae[_0xbb10('0x30')][_0xbb10('0x10')],'type':_0xbb10('0x33'),'uniqueid':_0x1c7fae[_0xbb10('0x21')]['interaction'][_0x5e2cfa][_0x426b95],'exitAt':null},'defaults':{'channel':_0x5e2cfa,'membername':_0x1c7fae['user'][_0xbb10('0x10')],'interface':_[_0xbb10('0x12')](_0x1c7fae[_0xbb10('0x30')]['interface'])?util['format'](_0xbb10('0x39'),_0x1c7fae[_0xbb10('0x30')][_0xbb10('0x10')]):_0x1c7fae[_0xbb10('0x30')][_0xbb10('0x3a')],'type':_0xbb10('0x33'),'enterAt':moment()[_0xbb10('0x35')](_0xbb10('0x36')),'role':_0xbb10('0x3b'),'internal':_0x1c7fae[_0xbb10('0x30')]['internal'],'uniqueid':_0x1c7fae['body'][_0xbb10('0x2f')][_0x5e2cfa][_0x426b95]}});}}}}return respondWithRpcPromise(_0xbb10('0x3c'),{'id':_0x1c7fae[_0xbb10('0x1c')]['id'],'capacity':_0x1c7fae[_0xbb10('0x21')][_0xbb10('0x3d')]},routingClient)[_0xbb10('0x9')](respondWithResult(_0x3e7b4c,null))[_0xbb10('0x17')](handleError(_0x3e7b4c,null));};exports[_0xbb10('0x3e')]=function(_0x1c0d8f,_0x1214f7){return respondWithRpcPromise(_0xbb10('0x3f'),_0x1c0d8f[_0xbb10('0x16')])[_0xbb10('0x9')](respondWithResult(_0x1214f7,null))[_0xbb10('0x17')](handleError(_0x1214f7,null));};exports[_0xbb10('0x40')]=function(_0x547a7a,_0x124052){return respondWithRpcPromise('Trunks',_0x547a7a[_0xbb10('0x16')])[_0xbb10('0x9')](respondWithResult(_0x124052,null))[_0xbb10('0x17')](handleError(_0x124052,null));};exports[_0xbb10('0x41')]=function(_0x26e66e,_0x32d8e9){return respondWithRpcPromise(_0xbb10('0x42'),_0x26e66e[_0xbb10('0x16')])[_0xbb10('0x9')](respondWithResult(_0x32d8e9,null))[_0xbb10('0x17')](handleError(_0x32d8e9,null));};exports[_0xbb10('0x43')]=function(_0x1c2dce,_0x1d49e1){return respondWithRpcPromise(_0xbb10('0x44'),_0x1c2dce[_0xbb10('0x16')],routingClient)['then'](respondWithResult(_0x1d49e1,null))[_0xbb10('0x17')](handleError(_0x1d49e1,null));};exports[_0xbb10('0x45')]=function(_0x1b83a9,_0x4ce8e7){return respondWithRpcPromise(_0xbb10('0x44'),_0x1b83a9[_0xbb10('0x16')],routingClient)['then'](findById(_0x1b83a9[_0xbb10('0x1c')]['id']))[_0xbb10('0x9')](respondWithResult(_0x4ce8e7,null))[_0xbb10('0x17')](handleError(_0x4ce8e7,null));};exports[_0xbb10('0x46')]=function(_0x432728,_0x22de7f){return respondWithRpcPromise(_0xbb10('0x47'),_0x432728[_0xbb10('0x16')],routingClient)[_0xbb10('0x9')](respondWithResult(_0x22de7f,null))[_0xbb10('0x17')](handleError(_0x22de7f,null));};exports[_0xbb10('0x48')]=function(_0x2a1ce1,_0x16932f){return respondWithRpcPromise('MailQueues',_0x2a1ce1['query'],routingClient)[_0xbb10('0x9')](findById(_0x2a1ce1[_0xbb10('0x1c')]['id']))[_0xbb10('0x9')](respondWithResult(_0x16932f,null))[_0xbb10('0x17')](handleError(_0x16932f,null));};exports['mailAccounts']=function(_0x506498,_0x79411e){return respondWithRpcPromise(_0xbb10('0x49'),_0x506498[_0xbb10('0x16')],mailClient)[_0xbb10('0x9')](respondWithResult(_0x79411e,null))[_0xbb10('0x17')](handleError(_0x79411e,null));};exports[_0xbb10('0x4a')]=function(_0x45c0dc,_0x4a5fb9){return respondWithRpcPromise(_0xbb10('0x4b'),_0x45c0dc[_0xbb10('0x16')],routingClient)['then'](respondWithResult(_0x4a5fb9,null))['catch'](handleError(_0x4a5fb9,null));};exports['showOpenchannelQueues']=function(_0x32c1e8,_0x31c727){return respondWithRpcPromise(_0xbb10('0x4b'),_0x32c1e8['query'],routingClient)['then'](findById(_0x32c1e8['params']['id']))[_0xbb10('0x9')](respondWithResult(_0x31c727,null))[_0xbb10('0x17')](handleError(_0x31c727,null));};exports[_0xbb10('0x4c')]=function(_0x4e9fbd,_0xa1bbd9){return respondWithRpcPromise(_0xbb10('0x4d'),_0x4e9fbd['query'],routingClient)['then'](respondWithResult(_0xa1bbd9,null))[_0xbb10('0x17')](handleError(_0xa1bbd9,null));};exports[_0xbb10('0x4e')]=function(_0xd77753,_0x237246){return respondWithRpcPromise('SmsQueues',_0xd77753[_0xbb10('0x16')],routingClient)[_0xbb10('0x9')](findById(_0xd77753[_0xbb10('0x1c')]['id']))['then'](respondWithResult(_0x237246,null))[_0xbb10('0x17')](handleError(_0x237246,null));};exports[_0xbb10('0x4f')]=function(_0x3e3617,_0x5b2bd4){return respondWithRpcPromise(_0xbb10('0x50'),_0x3e3617[_0xbb10('0x16')],routingClient)[_0xbb10('0x9')](respondWithResult(_0x5b2bd4,null))[_0xbb10('0x17')](handleError(_0x5b2bd4,null));};exports['showWhatsappQueues']=function(_0x251417,_0x258e55){return respondWithRpcPromise(_0xbb10('0x50'),_0x251417[_0xbb10('0x16')],routingClient)['then'](findById(_0x251417[_0xbb10('0x1c')]['id']))[_0xbb10('0x9')](respondWithResult(_0x258e55,null))[_0xbb10('0x17')](handleError(_0x258e55,null));};exports[_0xbb10('0x51')]=function(_0x12f750,_0x17807e){return respondWithRpcPromise(_0xbb10('0x52'),_0x12f750['query'],routingClient)['then'](respondWithResult(_0x17807e,null))['catch'](handleError(_0x17807e,null));};exports[_0xbb10('0x53')]=function(_0x9c672d,_0x3eda96){return respondWithRpcPromise('FaxQueues',_0x9c672d['query'],routingClient)[_0xbb10('0x9')](findById(_0x9c672d[_0xbb10('0x1c')]['id']))[_0xbb10('0x9')](respondWithResult(_0x3eda96,null))[_0xbb10('0x17')](handleError(_0x3eda96,null));};exports[_0xbb10('0x54')]=function(_0x1ad2ed,_0x4cf2f3){return respondWithRpcPromise(_0xbb10('0x55'),_0x1ad2ed[_0xbb10('0x16')])[_0xbb10('0x9')](respondWithResult(_0x4cf2f3,null))[_0xbb10('0x17')](handleError(_0x4cf2f3,null));};exports[_0xbb10('0x56')]=function(_0x5bfc68,_0x56094a){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x5bfc68[_0xbb10('0x16')],routingClient)[_0xbb10('0x9')](respondWithResult(_0x56094a,null))[_0xbb10('0x17')](handleError(_0x56094a,null));};exports[_0xbb10('0x57')]=function(_0x2f7d2a,_0x1d40b8){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x2f7d2a[_0xbb10('0x16')],routingClient)['then'](respondWithResult(_0x1d40b8,null))['catch'](handleError(_0x1d40b8,null));};exports['openchannelQueuesWaitingInteractions']=function(_0xdf634f,_0x13040d){return respondWithRpcPromise(_0xbb10('0x58'),_0xdf634f[_0xbb10('0x16')],routingClient)['then'](respondWithResult(_0x13040d,null))[_0xbb10('0x17')](handleError(_0x13040d,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x576179,_0x165fe9){return respondWithRpcPromise(_0xbb10('0x58'),_0x576179[_0xbb10('0x16')],routingClient)[_0xbb10('0x9')](function(_0xfa3c7c){if(_0x576179['query'][_0xbb10('0x59')]!==undefined){var _0x19fcec=_(_0xfa3c7c[_0xbb10('0x13')])[_0xbb10('0x5a')]([_0x576179[_0xbb10('0x16')][_0xbb10('0x59')],_0x576179[_0xbb10('0x1c')]['id']])['map'](_0xbb10('0x5b'))[_0xbb10('0x5c')]()[_0xbb10('0x5d')]();return _0xfa3c7c[_0xbb10('0x13')][_0xbb10('0x5a')](function(_0x172be3){return _0x19fcec[_0xbb10('0x5e')](_0x172be3[_0xbb10('0x5b')])>-0x1;});}else{return _0xfa3c7c['rows'][_0xbb10('0x5a')](function(_0x218690){return _0x218690[_0xbb10('0x5b')]===parseInt(_0x576179['params']['id']);});}})['then'](respondWithResult(_0x165fe9,null))['catch'](handleError(_0x165fe9,null));};exports[_0xbb10('0x5f')]=function(_0x5a3c44,_0x4e3d6a){return respondWithRpcPromise(_0xbb10('0x60'),_0x5a3c44[_0xbb10('0x16')],routingClient)[_0xbb10('0x9')](respondWithResult(_0x4e3d6a,null))[_0xbb10('0x17')](handleError(_0x4e3d6a,null));};exports[_0xbb10('0x61')]=function(_0x24dca6,_0x33116){return respondWithRpcPromise(_0xbb10('0x62'),_0x24dca6[_0xbb10('0x16')],routingClient)['then'](respondWithResult(_0x33116,null))[_0xbb10('0x17')](handleError(_0x33116,null));};exports[_0xbb10('0x63')]=function(_0x46b6d2,_0x35b811){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x46b6d2['query'],routingClient)[_0xbb10('0x9')](respondWithResult(_0x35b811,null))[_0xbb10('0x17')](handleError(_0x35b811,null));};exports[_0xbb10('0x64')]=function(_0x32bb25){return function(_0x5ee705,_0x17d596){var _0x275bce,_0x3f0d74;var _0xf7b3e1=_[_0xbb10('0x65')](_0x32bb25);var _0x517185=_0x32bb25==='chat'?_0xbb10('0x66'):_0xbb10('0x67');return db[_0xf7b3e1+_0xbb10('0x68')]['findOne']({'raw':!![],'where':{'id':_0x5ee705[_0xbb10('0x1c')]['id']}})[_0xbb10('0x9')](function(_0x50bcc9){if(_['isNil'](_0x50bcc9)){throw new Error(_0xf7b3e1+_0xbb10('0x69'));}_0x275bce=_0x50bcc9;return db[_0xf7b3e1+_0xbb10('0x6a')][_0xbb10('0x6b')]({'where':{'id':_0x5ee705['body'][_0xbb10('0x6c')]},'include':[{'model':db[_0xf7b3e1+_0xbb10('0x6d')],'as':_0xbb10('0x6d')},{'model':db[_0xf7b3e1+_0x517185],'as':_0xbb10('0x67')}]});})[_0xbb10('0x9')](function(_0x5de006){if(_[_0xbb10('0x12')](_0x5de006)){throw new Error(_0xf7b3e1+_0xbb10('0x6e'));}_0x3f0d74=_0x5de006;return _0x5de006[_0xbb10('0x6f')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x3367d4={'uniqueid':_0x32bb25+'.'+_0x3f0d74['id']+'.'+_0x3f0d74[_0xbb10('0x6d')]['id'],'FromUserId':_0x5ee705[_0xbb10('0x30')]['id'],'type':_0xbb10('0x70')};_0x3367d4[_0xf7b3e1+_0xbb10('0x71')]=_0x3f0d74['id'];_0x3367d4[_0xf7b3e1+_0xbb10('0x72')]=_0x3f0d74[_0xbb10('0x6d')]['id'];_0x3367d4[_0xbb10('0x73')+_0xf7b3e1+_0x517185+'Id']=_0x3f0d74[_0xbb10('0x67')]['id'];_0x3367d4['To'+_0xf7b3e1+_0xbb10('0x74')]=_0x275bce['id'];return db[_0xf7b3e1+_0xbb10('0x75')][_0xbb10('0x76')](_0x3367d4);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x32bb25,'interaction':_0x3f0d74[_0xbb10('0x6d')],'message':_0x3f0d74,'account':_0x3f0d74[_0xbb10('0x67')],'applications':[{'id':0x0,'priority':0x1,'app':_0xbb10('0x70'),'appdata':_0x275bce[_0xbb10('0x10')]+','+(_0x3f0d74[_0xbb10('0x67')]['queueTransferTimeout']||0x12c),'interval':_0xbb10('0x77')}],'transfer':!![]},routingClient);})[_0xbb10('0x9')](respondWithResult(_0x17d596,null))[_0xbb10('0x17')](handleError(_0x17d596,null));};};exports[_0xbb10('0x78')]=function(_0x19694d,_0x379d49){var _0x546db5,_0xb25e71;if(_[_0xbb10('0x12')](_0x19694d['body'][_0xbb10('0x79')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0xc53c87=_0x19694d[_0xbb10('0x21')][_0xbb10('0x79')];var _0xa99bf5=_[_0xbb10('0x65')](_0xc53c87);var _0x556d7b=_0xc53c87===_0xbb10('0x7a')?'Website':_0xbb10('0x67');return db[_0xbb10('0x7b')]['findOne']({'raw':!![],'where':{'id':_0x19694d['params']['id'],'role':_0xbb10('0x3b')}})[_0xbb10('0x9')](function(_0x1b77c2){if(_[_0xbb10('0x12')](_0x1b77c2)){throw new Error(_0xbb10('0x7c'));}_0x546db5=_0x1b77c2;return db[_0xa99bf5+_0xbb10('0x6a')][_0xbb10('0x6b')]({'where':{'id':_0x19694d[_0xbb10('0x21')][_0xbb10('0x6c')]},'include':[{'model':db[_0xa99bf5+_0xbb10('0x6d')],'as':_0xbb10('0x6d')},{'model':db[_0xa99bf5+_0x556d7b],'as':'Account'}]});})[_0xbb10('0x9')](function(_0x3eeceb){if(_[_0xbb10('0x12')](_0x3eeceb)){throw new Error(_0xa99bf5+_0xbb10('0x6e'));}_0xb25e71=_0x3eeceb;return _0x3eeceb[_0xbb10('0x6f')]({'read':0x0,'readAt':null,'UserId':null});})[_0xbb10('0x9')](function(){var _0xfefa17={'uniqueid':_0xc53c87+'.'+_0xb25e71['id']+'.'+_0xb25e71[_0xbb10('0x6d')]['id'],'FromUserId':_0x19694d[_0xbb10('0x30')]['id'],'type':_0xbb10('0x3b'),'ToUserId':_0x546db5['id']};_0xfefa17[_0xa99bf5+_0xbb10('0x71')]=_0xb25e71['id'];_0xfefa17[_0xa99bf5+_0xbb10('0x72')]=_0xb25e71['Interaction']['id'];_0xfefa17[_0xbb10('0x73')+_0xa99bf5+_0x556d7b+'Id']=_0xb25e71['Account']['id'];return db[_0xa99bf5+_0xbb10('0x75')][_0xbb10('0x76')](_0xfefa17);})[_0xbb10('0x9')](function(){return respondWithRpcPromise(_0xbb10('0x7d'),{'channel':_0xc53c87,'interaction':_0xb25e71[_0xbb10('0x6d')],'message':_0xb25e71,'account':_0xb25e71['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0xbb10('0x3b'),'appdata':_0x546db5[_0xbb10('0x10')]+','+(_0xb25e71[_0xbb10('0x67')][_0xbb10('0x7e')]||0x12c),'interval':_0xbb10('0x77')}],'transfer':!![]},routingClient);})[_0xbb10('0x9')](respondWithResult(_0x379d49,null))['catch'](handleError(_0x379d49,null));}; \ No newline at end of file +var _0xbaf0=['MailQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','map','queue_id','value','indexOf','smsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','Account','\x20Message\x20not\x20found','update','queue','From','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','Website','Agent\x20not\x20found','InteractionId','agentTransferTimeout','moment','lodash','util','../../mysqldb','../../config/logger','api','client','http','request','then','error','code','message','result','status','sendStatus','stack','name','isNil','rows','voiceChannels','VoiceChannels','catch','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','query','params','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','hasOwnProperty','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','SIP/%s','agent','internal','AgentCapacity','capacity','telephones','Telephones','trunks','Campaigns','chatQueues','ChatQueues','showChatQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','showSmsQueues','WhatsappQueues','showWhatsappQueues','faxQueues','showFaxQueues','FaxQueues','faxAccounts','FaxAccounts','mailQueuesWaitingInteractions'];(function(_0xe56773,_0x4be7df){var _0x40edbe=function(_0x4f2306){while(--_0x4f2306){_0xe56773['push'](_0xe56773['shift']());}};_0x40edbe(++_0x4be7df);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbaf0[_0x2b4411];return _0x8e41ef;};'use strict';var BPromise=require('bluebird');var moment=require(_0x0baf('0x0'));var _=require(_0x0baf('0x1'));var util=require(_0x0baf('0x2'));var db=require(_0x0baf('0x3'))['db'];var logger=require(_0x0baf('0x4'))(_0x0baf('0x5'));var jayson=require('jayson/promise');var amiClient=jayson[_0x0baf('0x6')][_0x0baf('0x7')]({'port':0x232a});var mailClient=jayson[_0x0baf('0x6')][_0x0baf('0x7')]({'port':0x232b});var routingClient=jayson[_0x0baf('0x6')][_0x0baf('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){var _0x5f20aa=_0x1d0a0d?_0x1d0a0d:amiClient;return _0x5f20aa[_0x0baf('0x8')](_0x1a10b1,_0x2dcaac)[_0x0baf('0x9')](function(_0x465528){if(_0x465528[_0x0baf('0xa')]){if(_0x465528[_0x0baf('0xa')][_0x0baf('0xb')]===0x1f4){return _0x11b947(_0x465528[_0x0baf('0xa')][_0x0baf('0xc')]);}return _0x5f5030(_0x465528[_0x0baf('0xa')][_0x0baf('0xc')]);}else{_0x5f5030(_0x465528[_0x0baf('0xd')]);}})['catch'](function(_0x5a53e2){_0x11b947(_0x5a53e2);});});}function respondWithResult(_0x465dd7,_0xe4378c){_0xe4378c=_0xe4378c||0xc8;return function(_0x5db689){if(_0x5db689){return _0x465dd7[_0x0baf('0xe')](_0xe4378c)['json'](_0x5db689);}return _0x465dd7[_0x0baf('0xf')](0x194);};}function handleError(_0x49e44b,_0x1c76a8){_0x1c76a8=_0x1c76a8||0x1f4;return function(_0x1f50c3){logger[_0x0baf('0xa')](_0x1f50c3[_0x0baf('0x10')]);if(_0x1f50c3[_0x0baf('0x11')]){delete _0x1f50c3[_0x0baf('0x11')];}_0x49e44b['status'](_0x1c76a8)['send'](_0x1f50c3);};}function findById(_0x2312c7){return function(_0x38395b){if(!_[_0x0baf('0x12')](_0x2312c7)&&!_[_0x0baf('0x12')](_0x38395b)&&!_[_0x0baf('0x12')](_0x38395b[_0x0baf('0x13')])){return _['find'](_0x38395b[_0x0baf('0x13')],function(_0xfbecec){return _0xfbecec['id']==_0x2312c7;});}return null;};}exports[_0x0baf('0x14')]=function(_0x3e9cb4,_0x47070d){return respondWithRpcPromise(_0x0baf('0x15'),_0x3e9cb4['query'])['then'](respondWithResult(_0x47070d,null))[_0x0baf('0x16')](handleError(_0x47070d,null));};exports[_0x0baf('0x17')]=function(_0x32e839,_0x1848e8){return respondWithRpcPromise(_0x0baf('0x18'),_[_0x0baf('0x19')](_0x32e839[_0x0baf('0x1a')],_0x32e839[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x1848e8,null))[_0x0baf('0x16')](handleError(_0x1848e8,null));};exports['voiceChannelStopMixMonitor']=function(_0x334bd6,_0x482522){return respondWithRpcPromise(_0x0baf('0x1c'),_['merge'](_0x334bd6['query'],_0x334bd6[_0x0baf('0x1b')]))['then'](respondWithResult(_0x482522,null))['catch'](handleError(_0x482522,null));};exports[_0x0baf('0x1d')]=function(_0x27b59c,_0x34e264){return respondWithRpcPromise(_0x0baf('0x1e'),_0x27b59c[_0x0baf('0x1a')])['then'](respondWithResult(_0x34e264,null))[_0x0baf('0x16')](handleError(_0x34e264,null));};exports[_0x0baf('0x1f')]=function(_0x1ca35a,_0x366e71){return respondWithRpcPromise(_0x0baf('0x1e'),_0x1ca35a[_0x0baf('0x1a')])[_0x0baf('0x9')](findById(_0x1ca35a['params']['id']))[_0x0baf('0x9')](respondWithResult(_0x366e71,null))[_0x0baf('0x16')](handleError(_0x366e71,null));};exports[_0x0baf('0x20')]=function(_0x265915,_0x55c715){return respondWithRpcPromise(_0x0baf('0x21'),_[_0x0baf('0x19')](_0x265915['body'],_0x265915[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x55c715,null))[_0x0baf('0x16')](handleError(_0x55c715,null));};exports[_0x0baf('0x22')]=function(_0xd14f0f,_0x366924){return respondWithRpcPromise(_0x0baf('0x23'),_['merge'](_0xd14f0f[_0x0baf('0x1a')],_0xd14f0f[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x366924,null))[_0x0baf('0x16')](handleError(_0x366924,null));};exports[_0x0baf('0x24')]=function(_0x275ea1,_0x2fc983){return respondWithRpcPromise(_0x0baf('0x25'),_0x275ea1[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0x2fc983,null))[_0x0baf('0x16')](handleError(_0x2fc983,null));};exports[_0x0baf('0x26')]=function(_0x45294a,_0x3a3353){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x0baf('0x19')](_0x45294a['query'],_0x45294a[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x3a3353,null))[_0x0baf('0x16')](handleError(_0x3a3353,null));};exports[_0x0baf('0x27')]=function(_0x5300a5,_0x1a2b03){return respondWithRpcPromise(_0x0baf('0x28'),_['merge'](_0x5300a5[_0x0baf('0x1a')],_0x5300a5[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x1a2b03,null))[_0x0baf('0x16')](handleError(_0x1a2b03,null));};exports[_0x0baf('0x29')]=function(_0x1b0991,_0xe03d82){return respondWithRpcPromise(_0x0baf('0x2a'),_['merge'](_0x1b0991[_0x0baf('0x1a')],_0x1b0991[_0x0baf('0x1b')]))['then'](respondWithResult(_0xe03d82,null))[_0x0baf('0x16')](handleError(_0xe03d82,null));};exports['outbound']=function(_0x5c545f,_0x11bc49){return respondWithRpcPromise(_0x0baf('0x2b'),_0x5c545f['query'])['then'](respondWithResult(_0x11bc49,null))[_0x0baf('0x16')](handleError(_0x11bc49,null));};exports[_0x0baf('0x2c')]=function(_0x3412bc,_0xb2d9ab){return respondWithRpcPromise(_0x0baf('0x2d'),_0x3412bc[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0xb2d9ab,null))[_0x0baf('0x16')](handleError(_0xb2d9ab,null));};exports[_0x0baf('0x2e')]=function(_0x36c6d2,_0x200864){var _0x148540;return respondWithRpcPromise(_0x0baf('0x2f'),_0x36c6d2[_0x0baf('0x1a')])['then'](function(_0x3573ce){_0x148540=_0x3573ce;return respondWithRpcPromise(_0x0baf('0x2f'),_0x36c6d2['query'],routingClient);})[_0x0baf('0x9')](function(_0x324369){return _[_0x0baf('0x19')]({},_0x324369,_0x148540);})[_0x0baf('0x9')](respondWithResult(_0x200864,null))[_0x0baf('0x16')](handleError(_0x200864,null));};exports[_0x0baf('0x30')]=function(_0x57b581,_0x23ad34){if(_0x57b581[_0x0baf('0x31')]&&_0x57b581['body'][_0x0baf('0x32')]&&_0x57b581[_0x0baf('0x33')]&&_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')]){for(var _0x504031 in _0x57b581[_0x0baf('0x31')][_0x0baf('0x32')]){if(_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x0baf('0x34')](_0x504031)){db[_0x0baf('0x35')][_0x0baf('0x36')]({'where':{'channel':_0x504031,'membername':_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')],'type':_0x0baf('0x37'),'exitAt':null,'uniqueid':_0x57b581['body'][_0x0baf('0x32')][_0x504031]&&_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x504031][_0x0baf('0x38')]?{'$notIn':_0x57b581[_0x0baf('0x31')]['interaction'][_0x504031]}:{'$ne':null}}})[_0x0baf('0x9')](function(_0x310240){var _0x27c3ee=moment()[_0x0baf('0x39')](_0x0baf('0x3a'));for(var _0x54ed41=0x0,_0x2a0924=_0x310240[_0x0baf('0x38')];_0x54ed41<_0x2a0924;_0x54ed41+=0x1){_0x310240[_0x54ed41][_0x0baf('0x3b')]({'exitAt':_0x27c3ee});}});for(var _0x1522b0=0x0;_0x1522b0<_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x504031][_0x0baf('0x38')];_0x1522b0+=0x1){db['MemberReport'][_0x0baf('0x3c')]({'where':{'channel':_0x504031,'membername':_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')],'type':'INTERACTION','uniqueid':_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x504031][_0x1522b0],'exitAt':null},'defaults':{'channel':_0x504031,'membername':_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')],'interface':_[_0x0baf('0x12')](_0x57b581[_0x0baf('0x33')][_0x0baf('0x3d')])?util['format'](_0x0baf('0x3e'),_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')]):_0x57b581[_0x0baf('0x33')][_0x0baf('0x3d')],'type':_0x0baf('0x37'),'enterAt':moment()[_0x0baf('0x39')](_0x0baf('0x3a')),'role':_0x0baf('0x3f'),'internal':_0x57b581[_0x0baf('0x33')][_0x0baf('0x40')],'uniqueid':_0x57b581['body']['interaction'][_0x504031][_0x1522b0]}});}}}}return respondWithRpcPromise(_0x0baf('0x41'),{'id':_0x57b581[_0x0baf('0x1b')]['id'],'capacity':_0x57b581[_0x0baf('0x31')][_0x0baf('0x42')]},routingClient)[_0x0baf('0x9')](respondWithResult(_0x23ad34,null))[_0x0baf('0x16')](handleError(_0x23ad34,null));};exports[_0x0baf('0x43')]=function(_0x4b492c,_0x3fe534){return respondWithRpcPromise(_0x0baf('0x44'),_0x4b492c[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0x3fe534,null))[_0x0baf('0x16')](handleError(_0x3fe534,null));};exports[_0x0baf('0x45')]=function(_0x5e1849,_0x3eebe5){return respondWithRpcPromise('Trunks',_0x5e1849[_0x0baf('0x1a')])['then'](respondWithResult(_0x3eebe5,null))[_0x0baf('0x16')](handleError(_0x3eebe5,null));};exports['campaigns']=function(_0x35b1a5,_0x4c035b){return respondWithRpcPromise(_0x0baf('0x46'),_0x35b1a5[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0x4c035b,null))[_0x0baf('0x16')](handleError(_0x4c035b,null));};exports[_0x0baf('0x47')]=function(_0x576475,_0x21f179){return respondWithRpcPromise(_0x0baf('0x48'),_0x576475[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x21f179,null))[_0x0baf('0x16')](handleError(_0x21f179,null));};exports[_0x0baf('0x49')]=function(_0x480834,_0x402f4d){return respondWithRpcPromise(_0x0baf('0x48'),_0x480834[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](findById(_0x480834[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0x402f4d,null))[_0x0baf('0x16')](handleError(_0x402f4d,null));};exports['mailQueues']=function(_0x48e855,_0x23f6ea){return respondWithRpcPromise(_0x0baf('0x4a'),_0x48e855[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x23f6ea,null))[_0x0baf('0x16')](handleError(_0x23f6ea,null));};exports[_0x0baf('0x4b')]=function(_0xaa4293,_0x14a667){return respondWithRpcPromise(_0x0baf('0x4a'),_0xaa4293['query'],routingClient)[_0x0baf('0x9')](findById(_0xaa4293[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0x14a667,null))[_0x0baf('0x16')](handleError(_0x14a667,null));};exports[_0x0baf('0x4c')]=function(_0xebfc0c,_0x26f5c9){return respondWithRpcPromise('MailAccounts',_0xebfc0c[_0x0baf('0x1a')],mailClient)[_0x0baf('0x9')](respondWithResult(_0x26f5c9,null))[_0x0baf('0x16')](handleError(_0x26f5c9,null));};exports[_0x0baf('0x4d')]=function(_0x1c7d88,_0x1a6d22){return respondWithRpcPromise(_0x0baf('0x4e'),_0x1c7d88[_0x0baf('0x1a')],routingClient)['then'](respondWithResult(_0x1a6d22,null))[_0x0baf('0x16')](handleError(_0x1a6d22,null));};exports['showOpenchannelQueues']=function(_0x3c00e7,_0x5f2fbe){return respondWithRpcPromise('OpenchannelQueues',_0x3c00e7[_0x0baf('0x1a')],routingClient)['then'](findById(_0x3c00e7[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0x5f2fbe,null))['catch'](handleError(_0x5f2fbe,null));};exports[_0x0baf('0x4f')]=function(_0xfb6708,_0x156572){return respondWithRpcPromise('SmsQueues',_0xfb6708['query'],routingClient)[_0x0baf('0x9')](respondWithResult(_0x156572,null))[_0x0baf('0x16')](handleError(_0x156572,null));};exports[_0x0baf('0x50')]=function(_0x7f49e,_0x784e1a){return respondWithRpcPromise('SmsQueues',_0x7f49e[_0x0baf('0x1a')],routingClient)['then'](findById(_0x7f49e['params']['id']))['then'](respondWithResult(_0x784e1a,null))[_0x0baf('0x16')](handleError(_0x784e1a,null));};exports['whatsappQueues']=function(_0x4946d4,_0x11a81e){return respondWithRpcPromise(_0x0baf('0x51'),_0x4946d4[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x11a81e,null))[_0x0baf('0x16')](handleError(_0x11a81e,null));};exports[_0x0baf('0x52')]=function(_0x4c05d6,_0xec3b32){return respondWithRpcPromise(_0x0baf('0x51'),_0x4c05d6[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](findById(_0x4c05d6[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0xec3b32,null))['catch'](handleError(_0xec3b32,null));};exports[_0x0baf('0x53')]=function(_0x468363,_0x29fd46){return respondWithRpcPromise('FaxQueues',_0x468363[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x29fd46,null))[_0x0baf('0x16')](handleError(_0x29fd46,null));};exports[_0x0baf('0x54')]=function(_0x125906,_0x27a959){return respondWithRpcPromise(_0x0baf('0x55'),_0x125906['query'],routingClient)['then'](findById(_0x125906['params']['id']))[_0x0baf('0x9')](respondWithResult(_0x27a959,null))[_0x0baf('0x16')](handleError(_0x27a959,null));};exports[_0x0baf('0x56')]=function(_0x12b9b5,_0x3e65d4){return respondWithRpcPromise(_0x0baf('0x57'),_0x12b9b5['query'])['then'](respondWithResult(_0x3e65d4,null))[_0x0baf('0x16')](handleError(_0x3e65d4,null));};exports['chatQueuesWaitingInteractions']=function(_0x22cd07,_0x3e9b79){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x22cd07[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x3e9b79,null))[_0x0baf('0x16')](handleError(_0x3e9b79,null));};exports[_0x0baf('0x58')]=function(_0x115ff5,_0x33a5af){return respondWithRpcPromise(_0x0baf('0x59'),_0x115ff5[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x33a5af,null))['catch'](handleError(_0x33a5af,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x58a079,_0x493784){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x58a079[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x493784,null))[_0x0baf('0x16')](handleError(_0x493784,null));};exports[_0x0baf('0x5a')]=function(_0x5093f5,_0x1be7f2){return respondWithRpcPromise(_0x0baf('0x5b'),_0x5093f5['query'],routingClient)['then'](function(_0x43aecd){if(_0x5093f5[_0x0baf('0x1a')][_0x0baf('0x5c')]!==undefined){var _0x442e5f=_(_0x43aecd[_0x0baf('0x13')])[_0x0baf('0x5d')]([_0x5093f5[_0x0baf('0x1a')][_0x0baf('0x5c')],_0x5093f5['params']['id']])[_0x0baf('0x5e')](_0x0baf('0x5f'))['uniq']()[_0x0baf('0x60')]();return _0x43aecd[_0x0baf('0x13')]['filter'](function(_0x97d385){return _0x442e5f[_0x0baf('0x61')](_0x97d385[_0x0baf('0x5f')])>-0x1;});}else{return _0x43aecd[_0x0baf('0x13')][_0x0baf('0x5d')](function(_0x4fc5af){return _0x4fc5af['queue_id']===parseInt(_0x5093f5[_0x0baf('0x1b')]['id']);});}})[_0x0baf('0x9')](respondWithResult(_0x1be7f2,null))['catch'](handleError(_0x1be7f2,null));};exports[_0x0baf('0x62')]=function(_0x59dad5,_0x21ad25){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x59dad5[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x21ad25,null))[_0x0baf('0x16')](handleError(_0x21ad25,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x3c2bc1,_0x5008c5){return respondWithRpcPromise(_0x0baf('0x63'),_0x3c2bc1[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x5008c5,null))[_0x0baf('0x16')](handleError(_0x5008c5,null));};exports[_0x0baf('0x64')]=function(_0x52e845,_0x866e6e){return respondWithRpcPromise(_0x0baf('0x65'),_0x52e845['query'],routingClient)[_0x0baf('0x9')](respondWithResult(_0x866e6e,null))[_0x0baf('0x16')](handleError(_0x866e6e,null));};exports[_0x0baf('0x66')]=function(_0x379c54){return function(_0x1cbbcc,_0x250df2){var _0xa4fd1b,_0x1cda78;var _0x44ef57=_[_0x0baf('0x67')](_0x379c54);var _0x3b7abf=_0x379c54===_0x0baf('0x68')?'Website':'Account';return db[_0x44ef57+_0x0baf('0x69')][_0x0baf('0x6a')]({'raw':!![],'where':{'id':_0x1cbbcc[_0x0baf('0x1b')]['id']}})['then'](function(_0x507783){if(_[_0x0baf('0x12')](_0x507783)){throw new Error(_0x44ef57+_0x0baf('0x6b'));}_0xa4fd1b=_0x507783;return db[_0x44ef57+_0x0baf('0x6c')][_0x0baf('0x6a')]({'where':{'id':_0x1cbbcc[_0x0baf('0x31')][_0x0baf('0x6d')]},'include':[{'model':db[_0x44ef57+_0x0baf('0x6e')],'as':_0x0baf('0x6e')},{'model':db[_0x44ef57+_0x3b7abf],'as':_0x0baf('0x6f')}]});})['then'](function(_0x1590a5){if(_[_0x0baf('0x12')](_0x1590a5)){throw new Error(_0x44ef57+_0x0baf('0x70'));}_0x1cda78=_0x1590a5;return _0x1590a5[_0x0baf('0x71')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x5d26e6={'uniqueid':_0x379c54+'.'+_0x1cda78['id']+'.'+_0x1cda78['Interaction']['id'],'FromUserId':_0x1cbbcc[_0x0baf('0x33')]['id'],'type':_0x0baf('0x72')};_0x5d26e6[_0x44ef57+'MessageId']=_0x1cda78['id'];_0x5d26e6[_0x44ef57+'InteractionId']=_0x1cda78[_0x0baf('0x6e')]['id'];_0x5d26e6[_0x0baf('0x73')+_0x44ef57+_0x3b7abf+'Id']=_0x1cda78['Account']['id'];_0x5d26e6['To'+_0x44ef57+_0x0baf('0x74')]=_0xa4fd1b['id'];return db[_0x44ef57+_0x0baf('0x75')][_0x0baf('0x76')](_0x5d26e6);})[_0x0baf('0x9')](function(){return respondWithRpcPromise(_0x0baf('0x77'),{'channel':_0x379c54,'interaction':_0x1cda78[_0x0baf('0x6e')],'message':_0x1cda78,'account':_0x1cda78[_0x0baf('0x6f')],'applications':[{'id':0x0,'priority':0x1,'app':_0x0baf('0x72'),'appdata':_0xa4fd1b[_0x0baf('0x11')]+','+(_0x1cda78[_0x0baf('0x6f')][_0x0baf('0x78')]||0x12c),'interval':_0x0baf('0x79')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x250df2,null))[_0x0baf('0x16')](handleError(_0x250df2,null));};};exports[_0x0baf('0x7a')]=function(_0x1e1adb,_0x3bd15b){var _0x3c37b4,_0x195303;if(_['isNil'](_0x1e1adb[_0x0baf('0x31')][_0x0baf('0x7b')])){throw new Error(_0x0baf('0x7c'));}var _0x457ae8=_0x1e1adb[_0x0baf('0x31')]['channel'];var _0x3761b5=_[_0x0baf('0x67')](_0x457ae8);var _0x2eae1b=_0x457ae8===_0x0baf('0x68')?_0x0baf('0x7d'):'Account';return db['User'][_0x0baf('0x6a')]({'raw':!![],'where':{'id':_0x1e1adb['params']['id'],'role':_0x0baf('0x3f')}})['then'](function(_0x32d8b6){if(_[_0x0baf('0x12')](_0x32d8b6)){throw new Error(_0x0baf('0x7e'));}_0x3c37b4=_0x32d8b6;return db[_0x3761b5+_0x0baf('0x6c')]['findOne']({'where':{'id':_0x1e1adb[_0x0baf('0x31')][_0x0baf('0x6d')]},'include':[{'model':db[_0x3761b5+_0x0baf('0x6e')],'as':'Interaction'},{'model':db[_0x3761b5+_0x2eae1b],'as':'Account'}]});})['then'](function(_0x4d4884){if(_[_0x0baf('0x12')](_0x4d4884)){throw new Error(_0x3761b5+_0x0baf('0x70'));}_0x195303=_0x4d4884;return _0x4d4884[_0x0baf('0x71')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0baf('0x9')](function(){var _0x597830={'uniqueid':_0x457ae8+'.'+_0x195303['id']+'.'+_0x195303[_0x0baf('0x6e')]['id'],'FromUserId':_0x1e1adb[_0x0baf('0x33')]['id'],'type':_0x0baf('0x3f'),'ToUserId':_0x3c37b4['id']};_0x597830[_0x3761b5+'MessageId']=_0x195303['id'];_0x597830[_0x3761b5+_0x0baf('0x7f')]=_0x195303[_0x0baf('0x6e')]['id'];_0x597830['From'+_0x3761b5+_0x2eae1b+'Id']=_0x195303[_0x0baf('0x6f')]['id'];return db[_0x3761b5+'TransferReport'][_0x0baf('0x76')](_0x597830);})[_0x0baf('0x9')](function(){return respondWithRpcPromise(_0x0baf('0x77'),{'channel':_0x457ae8,'interaction':_0x195303[_0x0baf('0x6e')],'message':_0x195303,'account':_0x195303['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x3c37b4[_0x0baf('0x11')]+','+(_0x195303['Account'][_0x0baf('0x80')]||0x12c),'interval':_0x0baf('0x79')}],'transfer':!![]},routingClient);})[_0x0baf('0x9')](respondWithResult(_0x3bd15b,null))[_0x0baf('0x16')](handleError(_0x3bd15b,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 887ec42..3bddcc9 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 _0xd709=['Router','../../components/auth/service','../../components/interaction/service','./schedule.controller','isAuthenticated','index','get','/:id','show','run','put','update','destroy','exports','util','path','connect-timeout','express'];(function(_0x5eb06f,_0x57f2de){var _0x2d51df=function(_0x20c3a8){while(--_0x20c3a8){_0x5eb06f['push'](_0x5eb06f['shift']());}};_0x2d51df(++_0x57f2de);}(_0xd709,0x1f4));var _0x9d70=function(_0x424b65,_0x411d03){_0x424b65=_0x424b65-0x0;var _0x110cea=_0xd709[_0x424b65];return _0x110cea;};'use strict';var multer=require('multer');var util=require(_0x9d70('0x0'));var path=require(_0x9d70('0x1'));var timeout=require(_0x9d70('0x2'));var express=require(_0x9d70('0x3'));var router=express[_0x9d70('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9d70('0x5'));var interaction=require(_0x9d70('0x6'));var config=require('../../config/environment');var controller=require(_0x9d70('0x7'));router['get']('/',auth[_0x9d70('0x8')](),controller[_0x9d70('0x9')]);router[_0x9d70('0xa')](_0x9d70('0xb'),auth[_0x9d70('0x8')](),controller[_0x9d70('0xc')]);router[_0x9d70('0xa')]('/:id/run',auth[_0x9d70('0x8')](),controller[_0x9d70('0xd')]);router['post']('/',auth[_0x9d70('0x8')](),controller['create']);router[_0x9d70('0xe')](_0x9d70('0xb'),auth[_0x9d70('0x8')](),controller[_0x9d70('0xf')]);router['delete']('/:id',auth[_0x9d70('0x8')](),controller[_0x9d70('0x10')]);module[_0x9d70('0x11')]=router; \ No newline at end of file +var _0xa328=['create','put','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./schedule.controller','isAuthenticated','index','get','/:id','/:id/run','run','post'];(function(_0x6c735d,_0x4e819e){var _0x246f43=function(_0x1787e1){while(--_0x1787e1){_0x6c735d['push'](_0x6c735d['shift']());}};_0x246f43(++_0x4e819e);}(_0xa328,0x108));var _0x8a32=function(_0x2d1971,_0x20b764){_0x2d1971=_0x2d1971-0x0;var _0x4d7759=_0xa328[_0x2d1971];return _0x4d7759;};'use strict';var multer=require(_0x8a32('0x0'));var util=require(_0x8a32('0x1'));var path=require('path');var timeout=require(_0x8a32('0x2'));var express=require(_0x8a32('0x3'));var router=express[_0x8a32('0x4')]();var fs_extra=require(_0x8a32('0x5'));var auth=require(_0x8a32('0x6'));var interaction=require(_0x8a32('0x7'));var config=require('../../config/environment');var controller=require(_0x8a32('0x8'));router['get']('/',auth[_0x8a32('0x9')](),controller[_0x8a32('0xa')]);router[_0x8a32('0xb')](_0x8a32('0xc'),auth[_0x8a32('0x9')](),controller['show']);router['get'](_0x8a32('0xd'),auth[_0x8a32('0x9')](),controller[_0x8a32('0xe')]);router[_0x8a32('0xf')]('/',auth['isAuthenticated'](),controller[_0x8a32('0x10')]);router[_0x8a32('0x11')](_0x8a32('0xc'),auth[_0x8a32('0x9')](),controller['update']);router['delete'](_0x8a32('0xc'),auth[_0x8a32('0x9')](),controller[_0x8a32('0x12')]);module[_0x8a32('0x13')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 450d3d4..e001591 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 _0xf932=['0\x200\x20*\x20*\x20*','INTEGER','ENUM','years','weeks','days','minutes','pdf','xlsx','csv','default','custom','TEXT','sequelize','exports','STRING','BOOLEAN'];(function(_0x5a9d09,_0x555798){var _0x7f892d=function(_0x25a086){while(--_0x25a086){_0x5a9d09['push'](_0x5a9d09['shift']());}};_0x7f892d(++_0x555798);}(_0xf932,0x194));var _0x2f93=function(_0x3d3e0a,_0x5b246d){_0x3d3e0a=_0x3d3e0a-0x0;var _0x3955d3=_0xf932[_0x3d3e0a];return _0x3955d3;};'use strict';var Sequelize=require(_0x2f93('0x0'));module[_0x2f93('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x2f93('0x2')]},'active':{'type':Sequelize[_0x2f93('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x2f93('0x2')],'allowNull':![],'defaultValue':_0x2f93('0x4')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x2f93('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x2f93('0x6')](_0x2f93('0x7'),'quarters','months',_0x2f93('0x8'),_0x2f93('0x9'),'hours',_0x2f93('0xa')),'allowNull':![],'defaultValue':_0x2f93('0x9')},'output':{'type':Sequelize[_0x2f93('0x6')]('csv',_0x2f93('0xb'),_0x2f93('0xc')),'allowNull':![],'defaultValue':_0x2f93('0xd')},'type':{'type':Sequelize['ENUM']('custom',_0x2f93('0xe')),'allowNull':![],'defaultValue':_0x2f93('0xf')},'sendMail':{'type':Sequelize[_0x2f93('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x2f93('0x2')]},'cc':{'type':Sequelize[_0x2f93('0x10')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0x2f93('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x22ec=['custom','default','TEXT','sequelize','STRING','BOOLEAN','DATE','ENUM','years','quarters','weeks','days','hours','minutes','csv','xlsx'];(function(_0x36e518,_0x14ad30){var _0x444725=function(_0xa3a442){while(--_0xa3a442){_0x36e518['push'](_0x36e518['shift']());}};_0x444725(++_0x14ad30);}(_0x22ec,0x193));var _0xc22e=function(_0x5e44ba,_0x23ee70){_0x5e44ba=_0x5e44ba-0x0;var _0x55c91f=_0x22ec[_0x5e44ba];return _0x55c91f;};'use strict';var Sequelize=require(_0xc22e('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xc22e('0x1')]},'active':{'type':Sequelize[_0xc22e('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xc22e('0x1')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0xc22e('0x3')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xc22e('0x4')](_0xc22e('0x5'),_0xc22e('0x6'),'months',_0xc22e('0x7'),_0xc22e('0x8'),_0xc22e('0x9'),_0xc22e('0xa')),'allowNull':![],'defaultValue':_0xc22e('0x8')},'output':{'type':Sequelize[_0xc22e('0x4')](_0xc22e('0xb'),'pdf',_0xc22e('0xc')),'allowNull':![],'defaultValue':_0xc22e('0xb')},'type':{'type':Sequelize[_0xc22e('0x4')](_0xc22e('0xd'),_0xc22e('0xe')),'allowNull':![],'defaultValue':_0xc22e('0xd')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xc22e('0xf')]},'bcc':{'type':Sequelize[_0xc22e('0xf')]},'sendIfEmpty':{'type':Sequelize[_0xc22e('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 877d3a9..caf5835 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 _0x884c=['zip-dir','fast-json-patch','request-promise','bluebird','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','Scheduler','UserProfileResource','sendStatus','error','stack','name','send','index','map','Schedule','fieldName','type','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','intersection','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','../../config/schedule','run','eml-format','rimraf'];(function(_0x42f2a5,_0x3fd9a3){var _0x56d5b6=function(_0x53e87b){while(--_0x53e87b){_0x42f2a5['push'](_0x42f2a5['shift']());}};_0x56d5b6(++_0x3fd9a3);}(_0x884c,0x142));var _0xc884=function(_0x5bb3a6,_0xc89ee3){_0x5bb3a6=_0x5bb3a6-0x0;var _0x279273=_0x884c[_0x5bb3a6];return _0x279273;};'use strict';var emlformat=require(_0xc884('0x0'));var rimraf=require(_0xc884('0x1'));var zipdir=require(_0xc884('0x2'));var jsonpatch=require(_0xc884('0x3'));var rp=require(_0xc884('0x4'));var moment=require('moment');var BPromise=require(_0xc884('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc884('0x6'));var squel=require(_0xc884('0x7'));var crypto=require(_0xc884('0x8'));var jsforce=require(_0xc884('0x9'));var deskjs=require(_0xc884('0xa'));var toCsv=require(_0xc884('0xb'));var querystring=require(_0xc884('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc884('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xc884('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc884('0xf'))('api');var utils=require(_0xc884('0x10'));var config=require(_0xc884('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0xc884('0x12'))['db'];function respondWithStatusCode(_0x5247be,_0x18b3b6){_0x18b3b6=_0x18b3b6||0xcc;return function(_0x300657){if(_0x300657){return _0x5247be['sendStatus'](_0x18b3b6);}return _0x5247be[_0xc884('0x13')](_0x18b3b6)[_0xc884('0x14')]();};}function respondWithResult(_0xd14464,_0x302b80){_0x302b80=_0x302b80||0xc8;return function(_0x1f83f3){if(_0x1f83f3){return _0xd14464[_0xc884('0x13')](_0x302b80)['json'](_0x1f83f3);}};}function respondWithFilteredResult(_0x31a714,_0x32f151){return function(_0x2855d4){if(_0x2855d4){var _0xa4a24d=typeof _0x32f151[_0xc884('0x15')]==='undefined'&&typeof _0x32f151[_0xc884('0x16')]===_0xc884('0x17');var _0x27eb17=_0x2855d4[_0xc884('0x18')];var _0xf264e0=_0xa4a24d?0x0:_0x32f151[_0xc884('0x15')];var _0x446af9=_0xa4a24d?_0x2855d4[_0xc884('0x18')]:_0x32f151[_0xc884('0x15')]+_0x32f151[_0xc884('0x16')];var _0x111ccf;if(_0x446af9>=_0x27eb17){_0x446af9=_0x27eb17;_0x111ccf=0xc8;}else{_0x111ccf=0xce;}_0x31a714['status'](_0x111ccf);return _0x31a714[_0xc884('0x19')](_0xc884('0x1a'),_0xf264e0+'-'+_0x446af9+'/'+_0x27eb17)[_0xc884('0x1b')](_0x2855d4);}return null;};}function patchUpdates(_0x5e933b){return function(_0x300ed8){try{jsonpatch[_0xc884('0x1c')](_0x300ed8,_0x5e933b,!![]);}catch(_0x380ee8){return BPromise[_0xc884('0x1d')](_0x380ee8);}return _0x300ed8[_0xc884('0x1e')]();};}function saveUpdates(_0x1c86bf,_0x4113da){return function(_0x53cfe0){if(_0x53cfe0){return _0x53cfe0[_0xc884('0x1f')](_0x1c86bf)[_0xc884('0x20')](function(_0x71ce6){return _0x71ce6;});}return null;};}function removeEntity(_0x5d5336,_0x20dde9){return function(_0x1fe593){if(_0x1fe593){return _0x1fe593[_0xc884('0x21')]()[_0xc884('0x20')](function(){var _0x3ac4c0=_0x1fe593[_0xc884('0x22')]({'plain':!![]});var _0x2f2284=_0xc884('0x23');return db[_0xc884('0x24')]['destroy']({'where':{'type':_0x2f2284,'resourceId':_0x3ac4c0['id']}})['then'](function(){return _0x1fe593;});})[_0xc884('0x20')](function(){_0x5d5336[_0xc884('0x13')](0xcc)[_0xc884('0x14')]();});}};}function handleEntityNotFound(_0x40f0c7,_0x2a2bcb){return function(_0xa46813){if(!_0xa46813){_0x40f0c7[_0xc884('0x25')](0x194);}return _0xa46813;};}function handleError(_0x44bd91,_0x4beb0c){_0x4beb0c=_0x4beb0c||0x1f4;return function(_0x3dfb8f){logger[_0xc884('0x26')](_0x3dfb8f[_0xc884('0x27')]);if(_0x3dfb8f[_0xc884('0x28')]){delete _0x3dfb8f[_0xc884('0x28')];}_0x44bd91[_0xc884('0x13')](_0x4beb0c)[_0xc884('0x29')](_0x3dfb8f);};}exports[_0xc884('0x2a')]=function(_0x21a42d,_0x1faaa7){var _0x33482a={},_0x3bf2fb={},_0x2ee0c5={'count':0x0,'rows':[]};var _0x5b67b4=_[_0xc884('0x2b')](db[_0xc884('0x2c')]['rawAttributes'],function(_0x5b7f4f){return{'name':_0x5b7f4f[_0xc884('0x2d')],'type':_0x5b7f4f[_0xc884('0x2e')]['key']};});_0x3bf2fb[_0xc884('0x2f')]=_[_0xc884('0x2b')](_0x5b67b4,_0xc884('0x28'));_0x3bf2fb[_0xc884('0x30')]=_[_0xc884('0x31')](_0x21a42d[_0xc884('0x30')]);_0x3bf2fb[_0xc884('0x32')]=_['intersection'](_0x3bf2fb['model'],_0x3bf2fb['query']);_0x33482a[_0xc884('0x33')]=_['intersection'](_0x3bf2fb[_0xc884('0x2f')],qs[_0xc884('0x34')](_0x21a42d[_0xc884('0x30')][_0xc884('0x34')]));_0x33482a[_0xc884('0x33')]=_0x33482a['attributes'][_0xc884('0x35')]?_0x33482a['attributes']:_0x3bf2fb[_0xc884('0x2f')];if(!_0x21a42d[_0xc884('0x30')][_0xc884('0x36')](_0xc884('0x37'))){_0x33482a[_0xc884('0x16')]=qs[_0xc884('0x16')](_0x21a42d[_0xc884('0x30')][_0xc884('0x16')]);_0x33482a[_0xc884('0x15')]=qs['offset'](_0x21a42d[_0xc884('0x30')][_0xc884('0x15')]);}_0x33482a[_0xc884('0x38')]=qs[_0xc884('0x39')](_0x21a42d['query'][_0xc884('0x39')]);_0x33482a[_0xc884('0x3a')]=qs[_0xc884('0x32')](_[_0xc884('0x3b')](_0x21a42d['query'],_0x3bf2fb['filters']),_0x5b67b4);if(_0x21a42d[_0xc884('0x30')][_0xc884('0x3c')]){_0x33482a[_0xc884('0x3a')]=_[_0xc884('0x3d')](_0x33482a['where'],{'$or':_[_0xc884('0x2b')](_0x5b67b4,function(_0x253f69){if(_0x253f69['type']!==_0xc884('0x3e')){var _0x16a35c={};_0x16a35c[_0x253f69[_0xc884('0x28')]]={'$like':'%'+_0x21a42d[_0xc884('0x30')][_0xc884('0x3c')]+'%'};return _0x16a35c;}})});}_0x33482a=_[_0xc884('0x3d')]({},_0x33482a,_0x21a42d[_0xc884('0x3f')]);var _0x55aa2d={'where':_0x33482a[_0xc884('0x3a')]};return db[_0xc884('0x2c')][_0xc884('0x18')](_0x55aa2d)[_0xc884('0x20')](function(_0x476a8b){_0x2ee0c5[_0xc884('0x18')]=_0x476a8b;if(_0x21a42d[_0xc884('0x30')]['includeAll']){_0x33482a[_0xc884('0x40')]=[{'all':!![]}];}return db[_0xc884('0x2c')][_0xc884('0x41')](_0x33482a);})[_0xc884('0x20')](function(_0x31c527){_0x2ee0c5[_0xc884('0x42')]=_0x31c527;return _0x2ee0c5;})[_0xc884('0x20')](respondWithFilteredResult(_0x1faaa7,_0x33482a))[_0xc884('0x43')](handleError(_0x1faaa7,null));};exports[_0xc884('0x44')]=function(_0x13ebef,_0x29aec1){var _0x5ec48a={'raw':![],'where':{'id':_0x13ebef[_0xc884('0x45')]['id']}},_0x526bd6={};_0x526bd6[_0xc884('0x2f')]=_[_0xc884('0x31')](db[_0xc884('0x2c')]['rawAttributes']);_0x526bd6[_0xc884('0x30')]=_[_0xc884('0x31')](_0x13ebef[_0xc884('0x30')]);_0x526bd6['filters']=_[_0xc884('0x46')](_0x526bd6[_0xc884('0x2f')],_0x526bd6[_0xc884('0x30')]);_0x5ec48a['attributes']=_[_0xc884('0x46')](_0x526bd6[_0xc884('0x2f')],qs[_0xc884('0x34')](_0x13ebef[_0xc884('0x30')][_0xc884('0x34')]));_0x5ec48a[_0xc884('0x33')]=_0x5ec48a[_0xc884('0x33')][_0xc884('0x35')]?_0x5ec48a[_0xc884('0x33')]:_0x526bd6[_0xc884('0x2f')];if(_0x13ebef[_0xc884('0x30')]['includeAll']){_0x5ec48a[_0xc884('0x40')]=[{'all':!![]}];}_0x5ec48a=_['merge']({},_0x5ec48a,_0x13ebef[_0xc884('0x3f')]);return db[_0xc884('0x2c')][_0xc884('0x47')](_0x5ec48a)['then'](handleEntityNotFound(_0x29aec1,null))['then'](respondWithResult(_0x29aec1,null))[_0xc884('0x43')](handleError(_0x29aec1,null));};exports['create']=function(_0x1ac905,_0x40cc2d){return db[_0xc884('0x2c')][_0xc884('0x48')](_0x1ac905['body'],{})[_0xc884('0x20')](function(_0x25a7fe){var _0x299c8d=_0x1ac905['user'][_0xc884('0x22')]({'plain':!![]});if(!_0x299c8d)throw new Error(_0xc884('0x49'));if(_0x299c8d[_0xc884('0x4a')]===_0xc884('0x4b')){var _0xc168ab=_0x25a7fe['get']({'plain':!![]});var _0x148e2c='Scheduler';return db[_0xc884('0x4c')]['find']({'where':{'name':_0x148e2c,'userProfileId':_0x299c8d['userProfileId']},'raw':!![]})[_0xc884('0x20')](function(_0x5234c0){if(_0x5234c0&&_0x5234c0['autoAssociation']===0x0){return db['UserProfileResource'][_0xc884('0x48')]({'name':_0xc168ab[_0xc884('0x28')],'resourceId':_0xc168ab['id'],'type':_0x5234c0[_0xc884('0x28')],'sectionId':_0x5234c0['id']},{})[_0xc884('0x20')](function(){return _0x25a7fe;});}else{return _0x25a7fe;}})[_0xc884('0x43')](function(_0x507390){logger[_0xc884('0x26')](_0xc884('0x4d'),_0x507390);throw _0x507390;});}return _0x25a7fe;})[_0xc884('0x20')](respondWithResult(_0x40cc2d,0xc9))[_0xc884('0x43')](handleError(_0x40cc2d,null));};exports[_0xc884('0x1f')]=function(_0xfb9bbe,_0x7fd73c){if(_0xfb9bbe[_0xc884('0x4e')]['id']){delete _0xfb9bbe[_0xc884('0x4e')]['id'];}return db['Schedule'][_0xc884('0x47')]({'where':{'id':_0xfb9bbe[_0xc884('0x45')]['id']}})['then'](handleEntityNotFound(_0x7fd73c,null))[_0xc884('0x20')](saveUpdates(_0xfb9bbe[_0xc884('0x4e')],null))['then'](respondWithResult(_0x7fd73c,null))[_0xc884('0x43')](handleError(_0x7fd73c,null));};exports[_0xc884('0x21')]=function(_0x4f72fd,_0x1ea470){return db[_0xc884('0x2c')]['find']({'where':{'id':_0x4f72fd[_0xc884('0x45')]['id']}})[_0xc884('0x20')](handleEntityNotFound(_0x1ea470,null))[_0xc884('0x20')](removeEntity(_0x1ea470,null))['catch'](handleError(_0x1ea470,null));};exports['run']=function(_0x575068,_0x4a5941,_0x48187f){var _0x77748f=require(_0xc884('0x4f'));return db[_0xc884('0x2c')]['find']({'where':{'id':_0x575068['params']['id']},'raw':!![]})[_0xc884('0x20')](handleEntityNotFound(_0x4a5941,null))[_0xc884('0x20')](function(){_0x77748f[_0xc884('0x50')](_0x575068[_0xc884('0x45')]['id']);})[_0xc884('0x20')](respondWithStatusCode(_0x4a5941,null))[_0xc884('0x43')](handleError(_0x4a5941,null));}; \ No newline at end of file +var _0x40a1=['eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','update','then','destroy','get','Scheduler','UserProfileResource','error','name','index','map','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','pick','merge','where','VIRTUAL','includeAll','include','Schedule','findAll','rows','show','rawAttributes','keys','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','run'];(function(_0x527824,_0xc824a9){var _0xc8b8ed=function(_0x1b0e19){while(--_0x1b0e19){_0x527824['push'](_0x527824['shift']());}};_0xc8b8ed(++_0xc824a9);}(_0x40a1,0x158));var _0x140a=function(_0x460d04,_0x2210e5){_0x460d04=_0x460d04-0x0;var _0x144806=_0x40a1[_0x460d04];return _0x144806;};'use strict';var emlformat=require(_0x140a('0x0'));var rimraf=require(_0x140a('0x1'));var zipdir=require(_0x140a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x140a('0x3'));var moment=require('moment');var BPromise=require(_0x140a('0x4'));var Mustache=require(_0x140a('0x5'));var util=require(_0x140a('0x6'));var path=require(_0x140a('0x7'));var sox=require('sox');var csv=require(_0x140a('0x8'));var ejs=require(_0x140a('0x9'));var fs=require('fs');var fs_extra=require(_0x140a('0xa'));var _=require(_0x140a('0xb'));var squel=require(_0x140a('0xc'));var crypto=require(_0x140a('0xd'));var jsforce=require(_0x140a('0xe'));var deskjs=require(_0x140a('0xf'));var toCsv=require(_0x140a('0x8'));var querystring=require(_0x140a('0x10'));var Papa=require(_0x140a('0x11'));var Redis=require(_0x140a('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x140a('0x13'));var as=require(_0x140a('0x14'));var hardwareService=require(_0x140a('0x15'));var logger=require(_0x140a('0x16'))(_0x140a('0x17'));var utils=require(_0x140a('0x18'));var config=require(_0x140a('0x19'));var licenseUtil=require(_0x140a('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x252456,_0x23617d){_0x23617d=_0x23617d||0xcc;return function(_0x2bd17a){if(_0x2bd17a){return _0x252456[_0x140a('0x1b')](_0x23617d);}return _0x252456[_0x140a('0x1c')](_0x23617d)[_0x140a('0x1d')]();};}function respondWithResult(_0x22ef50,_0x7bb051){_0x7bb051=_0x7bb051||0xc8;return function(_0x3033eb){if(_0x3033eb){return _0x22ef50[_0x140a('0x1c')](_0x7bb051)[_0x140a('0x1e')](_0x3033eb);}};}function respondWithFilteredResult(_0x4b2050,_0x33ba83){return function(_0xf2a076){if(_0xf2a076){var _0x4edad1=typeof _0x33ba83[_0x140a('0x1f')]==='undefined'&&typeof _0x33ba83['limit']===_0x140a('0x20');var _0x4ed74a=_0xf2a076[_0x140a('0x21')];var _0x22e8ca=_0x4edad1?0x0:_0x33ba83[_0x140a('0x1f')];var _0x7a23d7=_0x4edad1?_0xf2a076['count']:_0x33ba83[_0x140a('0x1f')]+_0x33ba83['limit'];var _0x2abfc9;if(_0x7a23d7>=_0x4ed74a){_0x7a23d7=_0x4ed74a;_0x2abfc9=0xc8;}else{_0x2abfc9=0xce;}_0x4b2050[_0x140a('0x1c')](_0x2abfc9);return _0x4b2050[_0x140a('0x22')](_0x140a('0x23'),_0x22e8ca+'-'+_0x7a23d7+'/'+_0x4ed74a)[_0x140a('0x1e')](_0xf2a076);}return null;};}function patchUpdates(_0x127f81){return function(_0x48a76b){try{jsonpatch[_0x140a('0x24')](_0x48a76b,_0x127f81,!![]);}catch(_0x16a8e8){return BPromise[_0x140a('0x25')](_0x16a8e8);}return _0x48a76b['save']();};}function saveUpdates(_0x28cea4,_0x745a4a){return function(_0x7aeb7){if(_0x7aeb7){return _0x7aeb7[_0x140a('0x26')](_0x28cea4)[_0x140a('0x27')](function(_0x3242e3){return _0x3242e3;});}return null;};}function removeEntity(_0x40da75,_0x11242d){return function(_0x1a0fa2){if(_0x1a0fa2){return _0x1a0fa2[_0x140a('0x28')]()[_0x140a('0x27')](function(){var _0x26b295=_0x1a0fa2[_0x140a('0x29')]({'plain':!![]});var _0x31e2b7=_0x140a('0x2a');return db[_0x140a('0x2b')][_0x140a('0x28')]({'where':{'type':_0x31e2b7,'resourceId':_0x26b295['id']}})[_0x140a('0x27')](function(){return _0x1a0fa2;});})[_0x140a('0x27')](function(){_0x40da75['status'](0xcc)[_0x140a('0x1d')]();});}};}function handleEntityNotFound(_0x43bcc8,_0x261452){return function(_0x56cebf){if(!_0x56cebf){_0x43bcc8[_0x140a('0x1b')](0x194);}return _0x56cebf;};}function handleError(_0xb29488,_0x556f1f){_0x556f1f=_0x556f1f||0x1f4;return function(_0x29e3a1){logger[_0x140a('0x2c')](_0x29e3a1['stack']);if(_0x29e3a1[_0x140a('0x2d')]){delete _0x29e3a1[_0x140a('0x2d')];}_0xb29488[_0x140a('0x1c')](_0x556f1f)['send'](_0x29e3a1);};}exports[_0x140a('0x2e')]=function(_0x39a54b,_0x3a2095){var _0x57d3f9={},_0x49a8c1={},_0x1fe785={'count':0x0,'rows':[]};var _0x15ff61=_[_0x140a('0x2f')](db['Schedule']['rawAttributes'],function(_0x5bf0b0){return{'name':_0x5bf0b0[_0x140a('0x30')],'type':_0x5bf0b0[_0x140a('0x31')][_0x140a('0x32')]};});_0x49a8c1[_0x140a('0x33')]=_[_0x140a('0x2f')](_0x15ff61,_0x140a('0x2d'));_0x49a8c1['query']=_['keys'](_0x39a54b[_0x140a('0x34')]);_0x49a8c1[_0x140a('0x35')]=_[_0x140a('0x36')](_0x49a8c1['model'],_0x49a8c1['query']);_0x57d3f9[_0x140a('0x37')]=_[_0x140a('0x36')](_0x49a8c1[_0x140a('0x33')],qs[_0x140a('0x38')](_0x39a54b['query']['fields']));_0x57d3f9['attributes']=_0x57d3f9[_0x140a('0x37')][_0x140a('0x39')]?_0x57d3f9['attributes']:_0x49a8c1[_0x140a('0x33')];if(!_0x39a54b['query'][_0x140a('0x3a')](_0x140a('0x3b'))){_0x57d3f9[_0x140a('0x3c')]=qs[_0x140a('0x3c')](_0x39a54b[_0x140a('0x34')][_0x140a('0x3c')]);_0x57d3f9['offset']=qs[_0x140a('0x1f')](_0x39a54b[_0x140a('0x34')][_0x140a('0x1f')]);}_0x57d3f9['order']=qs[_0x140a('0x3d')](_0x39a54b[_0x140a('0x34')][_0x140a('0x3d')]);_0x57d3f9['where']=qs[_0x140a('0x35')](_[_0x140a('0x3e')](_0x39a54b['query'],_0x49a8c1[_0x140a('0x35')]),_0x15ff61);if(_0x39a54b[_0x140a('0x34')]['filter']){_0x57d3f9['where']=_[_0x140a('0x3f')](_0x57d3f9[_0x140a('0x40')],{'$or':_['map'](_0x15ff61,function(_0x1324d5){if(_0x1324d5['type']!==_0x140a('0x41')){var _0x26f07e={};_0x26f07e[_0x1324d5[_0x140a('0x2d')]]={'$like':'%'+_0x39a54b[_0x140a('0x34')]['filter']+'%'};return _0x26f07e;}})});}_0x57d3f9=_[_0x140a('0x3f')]({},_0x57d3f9,_0x39a54b['options']);var _0x4e5a5e={'where':_0x57d3f9[_0x140a('0x40')]};return db['Schedule'][_0x140a('0x21')](_0x4e5a5e)[_0x140a('0x27')](function(_0x1c3d56){_0x1fe785['count']=_0x1c3d56;if(_0x39a54b[_0x140a('0x34')][_0x140a('0x42')]){_0x57d3f9[_0x140a('0x43')]=[{'all':!![]}];}return db[_0x140a('0x44')][_0x140a('0x45')](_0x57d3f9);})[_0x140a('0x27')](function(_0x2d55ad){_0x1fe785[_0x140a('0x46')]=_0x2d55ad;return _0x1fe785;})[_0x140a('0x27')](respondWithFilteredResult(_0x3a2095,_0x57d3f9))['catch'](handleError(_0x3a2095,null));};exports[_0x140a('0x47')]=function(_0x248773,_0x5babfc){var _0x9d766a={'raw':![],'where':{'id':_0x248773['params']['id']}},_0x31f8c7={};_0x31f8c7[_0x140a('0x33')]=_['keys'](db[_0x140a('0x44')][_0x140a('0x48')]);_0x31f8c7['query']=_[_0x140a('0x49')](_0x248773[_0x140a('0x34')]);_0x31f8c7[_0x140a('0x35')]=_[_0x140a('0x36')](_0x31f8c7[_0x140a('0x33')],_0x31f8c7['query']);_0x9d766a[_0x140a('0x37')]=_['intersection'](_0x31f8c7[_0x140a('0x33')],qs[_0x140a('0x38')](_0x248773[_0x140a('0x34')][_0x140a('0x38')]));_0x9d766a[_0x140a('0x37')]=_0x9d766a[_0x140a('0x37')][_0x140a('0x39')]?_0x9d766a[_0x140a('0x37')]:_0x31f8c7[_0x140a('0x33')];if(_0x248773[_0x140a('0x34')][_0x140a('0x42')]){_0x9d766a[_0x140a('0x43')]=[{'all':!![]}];}_0x9d766a=_[_0x140a('0x3f')]({},_0x9d766a,_0x248773['options']);return db[_0x140a('0x44')][_0x140a('0x4a')](_0x9d766a)[_0x140a('0x27')](handleEntityNotFound(_0x5babfc,null))[_0x140a('0x27')](respondWithResult(_0x5babfc,null))['catch'](handleError(_0x5babfc,null));};exports[_0x140a('0x4b')]=function(_0x20de48,_0x18cfca){return db['Schedule'][_0x140a('0x4b')](_0x20de48['body'],{})[_0x140a('0x27')](function(_0x5f2dc7){var _0x3ab1d4=_0x20de48['user'][_0x140a('0x29')]({'plain':!![]});if(!_0x3ab1d4)throw new Error(_0x140a('0x4c'));if(_0x3ab1d4[_0x140a('0x4d')]===_0x140a('0x4e')){var _0x40693c=_0x5f2dc7[_0x140a('0x29')]({'plain':!![]});var _0x1bf892=_0x140a('0x2a');return db['UserProfileSection']['find']({'where':{'name':_0x1bf892,'userProfileId':_0x3ab1d4[_0x140a('0x4f')]},'raw':!![]})['then'](function(_0x1cff4d){if(_0x1cff4d&&_0x1cff4d[_0x140a('0x50')]===0x0){return db['UserProfileResource'][_0x140a('0x4b')]({'name':_0x40693c[_0x140a('0x2d')],'resourceId':_0x40693c['id'],'type':_0x1cff4d[_0x140a('0x2d')],'sectionId':_0x1cff4d['id']},{})[_0x140a('0x27')](function(){return _0x5f2dc7;});}else{return _0x5f2dc7;}})[_0x140a('0x51')](function(_0x17a207){logger['error'](_0x140a('0x52'),_0x17a207);throw _0x17a207;});}return _0x5f2dc7;})[_0x140a('0x27')](respondWithResult(_0x18cfca,0xc9))[_0x140a('0x51')](handleError(_0x18cfca,null));};exports[_0x140a('0x26')]=function(_0x20ad2c,_0x269f1d){if(_0x20ad2c['body']['id']){delete _0x20ad2c['body']['id'];}return db['Schedule'][_0x140a('0x4a')]({'where':{'id':_0x20ad2c['params']['id']}})['then'](handleEntityNotFound(_0x269f1d,null))[_0x140a('0x27')](saveUpdates(_0x20ad2c[_0x140a('0x53')],null))[_0x140a('0x27')](respondWithResult(_0x269f1d,null))[_0x140a('0x51')](handleError(_0x269f1d,null));};exports['destroy']=function(_0xac9210,_0x4b9737){return db[_0x140a('0x44')][_0x140a('0x4a')]({'where':{'id':_0xac9210[_0x140a('0x54')]['id']}})[_0x140a('0x27')](handleEntityNotFound(_0x4b9737,null))[_0x140a('0x27')](removeEntity(_0x4b9737,null))['catch'](handleError(_0x4b9737,null));};exports['run']=function(_0x330b49,_0x467d08,_0x3a1fe){var _0x33c6ec=require('../../config/schedule');return db[_0x140a('0x44')][_0x140a('0x4a')]({'where':{'id':_0x330b49['params']['id']},'raw':!![]})[_0x140a('0x27')](handleEntityNotFound(_0x467d08,null))[_0x140a('0x27')](function(){_0x33c6ec[_0x140a('0x55')](_0x330b49[_0x140a('0x54')]['id']);})[_0x140a('0x27')](respondWithStatusCode(_0x467d08,null))['catch'](handleError(_0x467d08,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 0fe3ab8..23d7fe2 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 _0xaa3b=['rimraf','../../config/environment','./schedule.attributes','exports','define','Schedule','tools_schedules','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x472ca8,_0x2c8c37){var _0x14c783=function(_0x1689cf){while(--_0x1689cf){_0x472ca8['push'](_0x472ca8['shift']());}};_0x14c783(++_0x2c8c37);}(_0xaa3b,0x181));var _0xbaa3=function(_0x1c6664,_0x45566e){_0x1c6664=_0x1c6664-0x0;var _0x33124b=_0xaa3b[_0x1c6664];return _0x33124b;};'use strict';var _=require(_0xbaa3('0x0'));var util=require(_0xbaa3('0x1'));var logger=require(_0xbaa3('0x2'))(_0xbaa3('0x3'));var moment=require(_0xbaa3('0x4'));var BPromise=require(_0xbaa3('0x5'));var rp=require(_0xbaa3('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbaa3('0x7'));var config=require(_0xbaa3('0x8'));var attributes=require(_0xbaa3('0x9'));module[_0xbaa3('0xa')]=function(_0x1f95ad,_0x2e69bd){return _0x1f95ad[_0xbaa3('0xb')](_0xbaa3('0xc'),attributes,{'tableName':_0xbaa3('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5fca=['../../config/logger','moment','bluebird','request-promise','path','rimraf','exports','define','Schedule','lodash','util'];(function(_0x521865,_0xb5ffc3){var _0x54c30f=function(_0x4b7c34){while(--_0x4b7c34){_0x521865['push'](_0x521865['shift']());}};_0x54c30f(++_0xb5ffc3);}(_0x5fca,0x1ab));var _0xa5fc=function(_0x506d83,_0x1899e9){_0x506d83=_0x506d83-0x0;var _0x335e8b=_0x5fca[_0x506d83];return _0x335e8b;};'use strict';var _=require(_0xa5fc('0x0'));var util=require(_0xa5fc('0x1'));var logger=require(_0xa5fc('0x2'))('api');var moment=require(_0xa5fc('0x3'));var BPromise=require(_0xa5fc('0x4'));var rp=require(_0xa5fc('0x5'));var fs=require('fs');var path=require(_0xa5fc('0x6'));var rimraf=require(_0xa5fc('0x7'));var config=require('../../config/environment');var attributes=require('./schedule.attributes');module[_0xa5fc('0x8')]=function(_0x4559d0,_0x1c7da1){return _0x4559d0[_0xa5fc('0x9')](_0xa5fc('0xa'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index c745fff..9036c25 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 _0xcc5a=['result','catch','lodash','util','moment','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Schedule,\x20%s,\x20%s'];(function(_0x19b3f9,_0xade753){var _0x18c3f6=function(_0x21439f){while(--_0x21439f){_0x19b3f9['push'](_0x19b3f9['shift']());}};_0x18c3f6(++_0xade753);}(_0xcc5a,0x144));var _0xacc5=function(_0x59d0cc,_0xa7c52b){_0x59d0cc=_0x59d0cc-0x0;var _0x2ae79f=_0xcc5a[_0x59d0cc];return _0x2ae79f;};'use strict';var _=require(_0xacc5('0x0'));var util=require(_0xacc5('0x1'));var moment=require(_0xacc5('0x2'));var BPromise=require('bluebird');var rs=require(_0xacc5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xacc5('0x4'))(_0xacc5('0x5'));var config=require(_0xacc5('0x6'));var jayson=require(_0xacc5('0x7'));var client=jayson[_0xacc5('0x8')][_0xacc5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5c5c6e,_0x433fe6,_0x24ad95){return new BPromise(function(_0x2209b2,_0x4b28ac){return client[_0xacc5('0xa')](_0x5c5c6e,_0x24ad95)[_0xacc5('0xb')](function(_0x52ebd8){logger[_0xacc5('0xc')]('Schedule,\x20%s,\x20%s',_0x433fe6,_0xacc5('0xd'));logger[_0xacc5('0xe')](_0xacc5('0xf'),_0x433fe6,_0xacc5('0xd'),JSON[_0xacc5('0x10')](_0x52ebd8));if(_0x52ebd8[_0xacc5('0x11')]){if(_0x52ebd8[_0xacc5('0x11')][_0xacc5('0x12')]===0x1f4){logger['error']('Schedule,\x20%s,\x20%s',_0x433fe6,_0x52ebd8[_0xacc5('0x11')][_0xacc5('0x13')]);return _0x4b28ac(_0x52ebd8['error'][_0xacc5('0x13')]);}logger[_0xacc5('0x11')](_0xacc5('0x14'),_0x433fe6,_0x52ebd8['error'][_0xacc5('0x13')]);return _0x2209b2(_0x52ebd8[_0xacc5('0x11')][_0xacc5('0x13')]);}else{logger['info'](_0xacc5('0x14'),_0x433fe6,_0xacc5('0xd'));_0x2209b2(_0x52ebd8[_0xacc5('0x15')]['message']);}})[_0xacc5('0x16')](function(_0x611e8e){logger[_0xacc5('0x11')]('Schedule,\x20%s,\x20%s',_0x433fe6,_0x611e8e);_0x4b28ac(_0x611e8e);});});} \ No newline at end of file +var _0xacbc=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment'];(function(_0x56b5d1,_0x59be02){var _0x5bfe4a=function(_0x9ed053){while(--_0x9ed053){_0x56b5d1['push'](_0x56b5d1['shift']());}};_0x5bfe4a(++_0x59be02);}(_0xacbc,0x13f));var _0xcacb=function(_0x60b6df,_0xcbc63d){_0x60b6df=_0x60b6df-0x0;var _0x58dcf1=_0xacbc[_0x60b6df];return _0x58dcf1;};'use strict';var _=require(_0xcacb('0x0'));var util=require(_0xcacb('0x1'));var moment=require(_0xcacb('0x2'));var BPromise=require('bluebird');var rs=require(_0xcacb('0x3'));var fs=require('fs');var Redis=require(_0xcacb('0x4'));var db=require(_0xcacb('0x5'))['db'];var utils=require(_0xcacb('0x6'));var logger=require('../../config/logger')(_0xcacb('0x7'));var config=require(_0xcacb('0x8'));var jayson=require(_0xcacb('0x9'));var client=jayson[_0xcacb('0xa')][_0xcacb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1330ad,_0x452287,_0x34c36f){return new BPromise(function(_0x5347ac,_0x269449){return client[_0xcacb('0xc')](_0x1330ad,_0x34c36f)[_0xcacb('0xd')](function(_0x37168f){logger[_0xcacb('0xe')](_0xcacb('0xf'),_0x452287,_0xcacb('0x10'));logger[_0xcacb('0x11')](_0xcacb('0x12'),_0x452287,_0xcacb('0x10'),JSON[_0xcacb('0x13')](_0x37168f));if(_0x37168f[_0xcacb('0x14')]){if(_0x37168f[_0xcacb('0x14')]['code']===0x1f4){logger[_0xcacb('0x14')](_0xcacb('0xf'),_0x452287,_0x37168f[_0xcacb('0x14')][_0xcacb('0x15')]);return _0x269449(_0x37168f[_0xcacb('0x14')][_0xcacb('0x15')]);}logger[_0xcacb('0x14')](_0xcacb('0xf'),_0x452287,_0x37168f[_0xcacb('0x14')][_0xcacb('0x15')]);return _0x5347ac(_0x37168f[_0xcacb('0x14')][_0xcacb('0x15')]);}else{logger[_0xcacb('0xe')](_0xcacb('0xf'),_0x452287,'request\x20sent');_0x5347ac(_0x37168f[_0xcacb('0x16')][_0xcacb('0x15')]);}})['catch'](function(_0x435f39){logger[_0xcacb('0x14')](_0xcacb('0xf'),_0x452287,_0x435f39);_0x269449(_0x435f39);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index d7305c7..b632919 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 _0xc02d=['../../components/interaction/service','get','isAuthenticated','index','/:id','/:id/download','download','post','create','put','update','destroy','exports','multer','util','connect-timeout','fs-extra'];(function(_0xd88549,_0x23b388){var _0x35c1e1=function(_0x5c8389){while(--_0x5c8389){_0xd88549['push'](_0xd88549['shift']());}};_0x35c1e1(++_0x23b388);}(_0xc02d,0xc8));var _0xdc02=function(_0x2d6f34,_0x2c7d59){_0x2d6f34=_0x2d6f34-0x0;var _0x10e098=_0xc02d[_0x2d6f34];return _0x10e098;};'use strict';var multer=require(_0xdc02('0x0'));var util=require(_0xdc02('0x1'));var path=require('path');var timeout=require(_0xdc02('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xdc02('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xdc02('0x4'));var config=require('../../config/environment');var controller=require('./screenRecording.controller');router[_0xdc02('0x5')]('/',auth[_0xdc02('0x6')](),controller[_0xdc02('0x7')]);router[_0xdc02('0x5')]('/describe',auth[_0xdc02('0x6')](),controller['describe']);router[_0xdc02('0x5')](_0xdc02('0x8'),auth['isAuthenticated'](),controller['show']);router[_0xdc02('0x5')](_0xdc02('0x9'),auth[_0xdc02('0x6')](),controller[_0xdc02('0xa')]);router[_0xdc02('0xb')]('/',auth[_0xdc02('0x6')](),controller[_0xdc02('0xc')]);router[_0xdc02('0xd')](_0xdc02('0x8'),auth[_0xdc02('0x6')](),controller[_0xdc02('0xe')]);router['delete'](_0xdc02('0x8'),auth[_0xdc02('0x6')](),controller[_0xdc02('0xf')]);module[_0xdc02('0x10')]=router; \ No newline at end of file +var _0x2b41=['exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','isAuthenticated','index','get','describe','/:id','download','create','put','delete','destroy'];(function(_0x43bafa,_0xf7eef0){var _0x2389a4=function(_0x4e5cbb){while(--_0x4e5cbb){_0x43bafa['push'](_0x43bafa['shift']());}};_0x2389a4(++_0xf7eef0);}(_0x2b41,0x191));var _0x12b4=function(_0x91340d,_0x13ee89){_0x91340d=_0x91340d-0x0;var _0x4d935f=_0x2b41[_0x91340d];return _0x4d935f;};'use strict';var multer=require(_0x12b4('0x0'));var util=require(_0x12b4('0x1'));var path=require(_0x12b4('0x2'));var timeout=require('connect-timeout');var express=require(_0x12b4('0x3'));var router=express[_0x12b4('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x12b4('0x5'));var interaction=require(_0x12b4('0x6'));var config=require(_0x12b4('0x7'));var controller=require(_0x12b4('0x8'));router['get']('/',auth[_0x12b4('0x9')](),controller[_0x12b4('0xa')]);router[_0x12b4('0xb')]('/describe',auth['isAuthenticated'](),controller[_0x12b4('0xc')]);router[_0x12b4('0xb')](_0x12b4('0xd'),auth[_0x12b4('0x9')](),controller['show']);router[_0x12b4('0xb')]('/:id/download',auth[_0x12b4('0x9')](),controller[_0x12b4('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x12b4('0xf')]);router[_0x12b4('0x10')]('/:id',auth[_0x12b4('0x9')](),controller['update']);router[_0x12b4('0x11')]('/:id',auth[_0x12b4('0x9')](),controller[_0x12b4('0x12')]);module[_0x12b4('0x13')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 18f8589..7da7445 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 _0x677a=['MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','sequelize','path','../../config/environment','exports','VIRTUAL','getDataValue','extname','value','STRING','replace','setDataValue','startedAt','subtract','closedAt','duration','DATE','format'];(function(_0x524b52,_0x183069){var _0x420161=function(_0x18f36a){while(--_0x18f36a){_0x524b52['push'](_0x524b52['shift']());}};_0x420161(++_0x183069);}(_0x677a,0xd6));var _0xa677=function(_0x12bb14,_0x2268b9){_0x12bb14=_0x12bb14-0x0;var _0xcc7709=_0x677a[_0x12bb14];return _0xcc7709;};'use strict';var Sequelize=require(_0xa677('0x0'));var moment=require('moment');var path=require(_0xa677('0x1'));var config=require(_0xa677('0x2'));module[_0xa677('0x3')]={'format':{'type':Sequelize[_0xa677('0x4')],'get':function(){return this[_0xa677('0x5')]('value')?path[_0xa677('0x6')](this[_0xa677('0x5')](_0xa677('0x7'))):undefined;}},'interactionid':{'type':Sequelize[_0xa677('0x8')]},'channel':{'type':Sequelize[_0xa677('0x8')]},'value':{'type':Sequelize['STRING'],'set':function(_0x303092){var _0x1c997f=_0x303092[_0xa677('0x9')](/\\/g,'/');this[_0xa677('0xa')]('value',_0x1c997f);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x43d392){this['setDataValue'](_0xa677('0xb'),moment()[_0xa677('0xc')](_0x43d392,'ms'));this['setDataValue'](_0xa677('0xd'),moment());this[_0xa677('0xa')](_0xa677('0xe'),_0x43d392);}},'startedAt':{'type':Sequelize[_0xa677('0xf')],'get':function(){return moment(this['getDataValue'](_0xa677('0xb')))[_0xa677('0x10')](_0xa677('0x11'))[_0xa677('0x12')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xa677('0x5')]('closedAt'))[_0xa677('0x10')](_0xa677('0x11'))[_0xa677('0x12')]();}},'createdAt':{'type':Sequelize[_0xa677('0xf')],'get':function(){return moment(this[_0xa677('0x5')](_0xa677('0x13')))[_0xa677('0x10')](_0xa677('0x11'))[_0xa677('0x12')]();}},'updatedAt':{'type':Sequelize[_0xa677('0xf')],'get':function(){return moment(this[_0xa677('0x5')](_0xa677('0x14')))[_0xa677('0x10')](_0xa677('0x11'))['toString']();}}}; \ No newline at end of file +var _0xbbdd=['DATE','getDataValue','closedAt','format','updatedAt','moment','../../config/environment','exports','extname','STRING','replace','setDataValue','value','INTEGER','startedAt','subtract','duration','MM-DD-YYYY\x20HH:mm','toString'];(function(_0x2a4143,_0x2164f0){var _0xf2950f=function(_0x3b9fe7){while(--_0x3b9fe7){_0x2a4143['push'](_0x2a4143['shift']());}};_0xf2950f(++_0x2164f0);}(_0xbbdd,0x1ba));var _0xdbbd=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0xbbdd[_0x255d5b];return _0x3e141a;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xdbbd('0x0'));var path=require('path');var config=require(_0xdbbd('0x1'));module[_0xdbbd('0x2')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue']('value')?path[_0xdbbd('0x3')](this['getDataValue']('value')):undefined;}},'interactionid':{'type':Sequelize[_0xdbbd('0x4')]},'channel':{'type':Sequelize[_0xdbbd('0x4')]},'value':{'type':Sequelize[_0xdbbd('0x4')],'set':function(_0x44beae){var _0x59b866=_0x44beae[_0xdbbd('0x5')](/\\/g,'/');this[_0xdbbd('0x6')](_0xdbbd('0x7'),_0x59b866);}},'rating':{'type':Sequelize[_0xdbbd('0x8')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xdbbd('0x8')],'set':function(_0x38198c){this[_0xdbbd('0x6')](_0xdbbd('0x9'),moment()[_0xdbbd('0xa')](_0x38198c,'ms'));this[_0xdbbd('0x6')]('closedAt',moment());this[_0xdbbd('0x6')](_0xdbbd('0xb'),_0x38198c);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue']('startedAt'))['format'](_0xdbbd('0xc'))[_0xdbbd('0xd')]();}},'closedAt':{'type':Sequelize[_0xdbbd('0xe')],'get':function(){return moment(this[_0xdbbd('0xf')](_0xdbbd('0x10')))[_0xdbbd('0x11')](_0xdbbd('0xc'))['toString']();}},'createdAt':{'type':Sequelize[_0xdbbd('0xe')],'get':function(){return moment(this[_0xdbbd('0xf')]('createdAt'))[_0xdbbd('0x11')](_0xdbbd('0xc'))[_0xdbbd('0xd')]();}},'updatedAt':{'type':Sequelize[_0xdbbd('0xe')],'get':function(){return moment(this['getDataValue'](_0xdbbd('0x12')))[_0xdbbd('0x11')]('MM-DD-YYYY\x20HH:mm')[_0xdbbd('0xd')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 64052ec..7f7143b 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 _0x33c5=['download','uniqueid','join','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','ScreenRecording\x20not\x20found','filename','unlink','message','Not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','rimraf','zip-dir','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/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','stack','name','send','index','map','ScreenRecording','type','key','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','length','order','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','show','params','include','find','catch','create','body','duration','createdAt','closedAt','value','describe'];(function(_0x5080f9,_0x421c0c){var _0x2c1121=function(_0x17d787){while(--_0x17d787){_0x5080f9['push'](_0x5080f9['shift']());}};_0x2c1121(++_0x421c0c);}(_0x33c5,0xe6));var _0x533c=function(_0x16539a,_0x31409a){_0x16539a=_0x16539a-0x0;var _0x200796=_0x33c5[_0x16539a];return _0x200796;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x533c('0x0'));var zipdir=require(_0x533c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x533c('0x2'));var moment=require(_0x533c('0x3'));var BPromise=require(_0x533c('0x4'));var Mustache=require(_0x533c('0x5'));var util=require(_0x533c('0x6'));var path=require('path');var sox=require(_0x533c('0x7'));var csv=require(_0x533c('0x8'));var ejs=require(_0x533c('0x9'));var fs=require('fs');var fs_extra=require(_0x533c('0xa'));var _=require(_0x533c('0xb'));var squel=require(_0x533c('0xc'));var crypto=require(_0x533c('0xd'));var jsforce=require(_0x533c('0xe'));var deskjs=require(_0x533c('0xf'));var toCsv=require(_0x533c('0x8'));var querystring=require(_0x533c('0x10'));var Papa=require(_0x533c('0x11'));var Redis=require(_0x533c('0x12'));var authService=require(_0x533c('0x13'));var qs=require(_0x533c('0x14'));var as=require(_0x533c('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x533c('0x16'))(_0x533c('0x17'));var utils=require(_0x533c('0x18'));var config=require(_0x533c('0x19'));var licenseUtil=require(_0x533c('0x1a'));var db=require(_0x533c('0x1b'))['db'];function respondWithStatusCode(_0x530e10,_0x5c9462){_0x5c9462=_0x5c9462||0xcc;return function(_0xf93007){if(_0xf93007){return _0x530e10[_0x533c('0x1c')](_0x5c9462);}return _0x530e10[_0x533c('0x1d')](_0x5c9462)[_0x533c('0x1e')]();};}function respondWithResult(_0x1a2a83,_0x8d7c66){_0x8d7c66=_0x8d7c66||0xc8;return function(_0xa616ca){if(_0xa616ca){return _0x1a2a83['status'](_0x8d7c66)[_0x533c('0x1f')](_0xa616ca);}};}function respondWithFilteredResult(_0x7c1d33,_0x3f4a5c){return function(_0x3e544f){if(_0x3e544f){var _0x56dfb7=typeof _0x3f4a5c[_0x533c('0x20')]===_0x533c('0x21')&&typeof _0x3f4a5c[_0x533c('0x22')]===_0x533c('0x21');var _0x2854ab=_0x3e544f[_0x533c('0x23')];var _0x1f0a72=_0x56dfb7?0x0:_0x3f4a5c[_0x533c('0x20')];var _0x1f9f85=_0x56dfb7?_0x3e544f[_0x533c('0x23')]:_0x3f4a5c[_0x533c('0x20')]+_0x3f4a5c[_0x533c('0x22')];var _0x78dd72;if(_0x1f9f85>=_0x2854ab){_0x1f9f85=_0x2854ab;_0x78dd72=0xc8;}else{_0x78dd72=0xce;}_0x7c1d33[_0x533c('0x1d')](_0x78dd72);return _0x7c1d33[_0x533c('0x24')](_0x533c('0x25'),_0x1f0a72+'-'+_0x1f9f85+'/'+_0x2854ab)[_0x533c('0x1f')](_0x3e544f);}return null;};}function patchUpdates(_0x2bc58f){return function(_0x4ba0bd){try{jsonpatch[_0x533c('0x26')](_0x4ba0bd,_0x2bc58f,!![]);}catch(_0x51785c){return BPromise['reject'](_0x51785c);}return _0x4ba0bd[_0x533c('0x27')]();};}function saveUpdates(_0x36d4e4,_0x5f5090){return function(_0x21dfd3){if(_0x21dfd3){return _0x21dfd3[_0x533c('0x28')](_0x36d4e4)[_0x533c('0x29')](function(_0x3dd249){return _0x3dd249;});}return null;};}function removeEntity(_0x5ebbe0,_0x3762f7){return function(_0x42c87b){if(_0x42c87b){return _0x42c87b[_0x533c('0x2a')]()[_0x533c('0x29')](function(){_0x5ebbe0[_0x533c('0x1d')](0xcc)[_0x533c('0x1e')]();});}};}function handleEntityNotFound(_0xb51a5,_0x43f669){return function(_0xb1c937){if(!_0xb1c937){_0xb51a5[_0x533c('0x1c')](0x194);}return _0xb1c937;};}function handleError(_0x4d47d0,_0x11d775){_0x11d775=_0x11d775||0x1f4;return function(_0xfab4da){logger['error'](_0xfab4da[_0x533c('0x2b')]);if(_0xfab4da['name']){delete _0xfab4da[_0x533c('0x2c')];}_0x4d47d0[_0x533c('0x1d')](_0x11d775)[_0x533c('0x2d')](_0xfab4da);};}exports[_0x533c('0x2e')]=function(_0x425f60,_0x146a8e){var _0x212d1b={},_0x38d886={},_0x3c559b={'count':0x0,'rows':[]};var _0x2fc7fa=_[_0x533c('0x2f')](db[_0x533c('0x30')]['rawAttributes'],function(_0x370263){return{'name':_0x370263['fieldName'],'type':_0x370263[_0x533c('0x31')][_0x533c('0x32')]};});_0x38d886[_0x533c('0x33')]=_[_0x533c('0x34')](_[_0x533c('0x2f')](_0x2fc7fa,_0x533c('0x2c')),[_0x533c('0x35')]);_0x38d886[_0x533c('0x36')]=_[_0x533c('0x37')](_0x425f60[_0x533c('0x36')]);_0x38d886[_0x533c('0x38')]=_[_0x533c('0x39')](_0x38d886[_0x533c('0x33')],_0x38d886[_0x533c('0x36')]);_0x212d1b[_0x533c('0x3a')]=_['intersection'](_0x38d886[_0x533c('0x33')],qs[_0x533c('0x3b')](_0x425f60[_0x533c('0x36')][_0x533c('0x3b')]));_0x212d1b['attributes']=_0x212d1b[_0x533c('0x3a')][_0x533c('0x3c')]?_0x212d1b[_0x533c('0x3a')]:_0x38d886[_0x533c('0x33')];if(!_0x425f60[_0x533c('0x36')]['hasOwnProperty']('nolimit')){_0x212d1b['limit']=qs['limit'](_0x425f60['query'][_0x533c('0x22')]);_0x212d1b['offset']=qs[_0x533c('0x20')](_0x425f60['query'][_0x533c('0x20')]);}_0x212d1b[_0x533c('0x3d')]=qs[_0x533c('0x3e')](_0x425f60['query'][_0x533c('0x3e')]);_0x212d1b[_0x533c('0x3f')]=qs[_0x533c('0x38')](_['pick'](_0x425f60[_0x533c('0x36')],_0x38d886[_0x533c('0x38')]),_0x2fc7fa);if(_0x425f60[_0x533c('0x36')]['filter']){_0x212d1b[_0x533c('0x3f')]=_[_0x533c('0x40')](_0x212d1b[_0x533c('0x3f')],{'$or':_[_0x533c('0x2f')](_0x2fc7fa,function(_0x454dbc){if(_0x454dbc[_0x533c('0x31')]!==_0x533c('0x41')){var _0x2dbd81={};_0x2dbd81[_0x454dbc[_0x533c('0x2c')]]={'$like':'%'+_0x425f60[_0x533c('0x36')][_0x533c('0x42')]+'%'};return _0x2dbd81;}})});}_0x212d1b=_['merge']({},_0x212d1b,_0x425f60[_0x533c('0x43')]);var _0x784493={'where':_0x212d1b[_0x533c('0x3f')]};return db[_0x533c('0x30')][_0x533c('0x23')](_0x784493)[_0x533c('0x29')](function(_0x5d2bf9){_0x3c559b[_0x533c('0x23')]=_0x5d2bf9;if(_0x425f60[_0x533c('0x36')][_0x533c('0x44')]){_0x212d1b['include']=[{'all':!![]}];}return db[_0x533c('0x30')][_0x533c('0x45')](_0x212d1b);})[_0x533c('0x29')](function(_0x1abd47){_0x3c559b['rows']=_0x1abd47;return _0x3c559b;})[_0x533c('0x29')](respondWithFilteredResult(_0x146a8e,_0x212d1b))['catch'](handleError(_0x146a8e,null));};exports[_0x533c('0x46')]=function(_0x39034e,_0x55a372){var _0x3f4015={'raw':![],'where':{'id':_0x39034e[_0x533c('0x47')]['id']}},_0x3f1e47={};_0x3f1e47['model']=_['keys'](db['ScreenRecording']['rawAttributes']);_0x3f1e47[_0x533c('0x36')]=_['keys'](_0x39034e[_0x533c('0x36')]);_0x3f1e47['filters']=_[_0x533c('0x39')](_0x3f1e47['model'],_0x3f1e47[_0x533c('0x36')]);_0x3f4015[_0x533c('0x3a')]=_['intersection'](_0x3f1e47[_0x533c('0x33')],qs[_0x533c('0x3b')](_0x39034e[_0x533c('0x36')][_0x533c('0x3b')]));_0x3f4015[_0x533c('0x3a')]=_0x3f4015['attributes'][_0x533c('0x3c')]?_0x3f4015[_0x533c('0x3a')]:_0x3f1e47[_0x533c('0x33')];if(_0x39034e[_0x533c('0x36')]['includeAll']){_0x3f4015[_0x533c('0x48')]=[{'all':!![]}];}_0x3f4015=_[_0x533c('0x40')]({},_0x3f4015,_0x39034e['options']);return db['ScreenRecording'][_0x533c('0x49')](_0x3f4015)['then'](handleEntityNotFound(_0x55a372,null))[_0x533c('0x29')](respondWithResult(_0x55a372,null))[_0x533c('0x4a')](handleError(_0x55a372,null));};exports[_0x533c('0x4b')]=function(_0x471c59,_0xe9354a){return db[_0x533c('0x30')][_0x533c('0x4b')](_0x471c59[_0x533c('0x4c')],{})['then'](respondWithResult(_0xe9354a,0xc9))[_0x533c('0x4a')](handleError(_0xe9354a,null));};exports[_0x533c('0x28')]=function(_0xaaf682,_0x57c6c6){if(_0xaaf682[_0x533c('0x4c')]['id']){delete _0xaaf682[_0x533c('0x4c')]['id'];}delete _0xaaf682['body'][_0x533c('0x4d')];delete _0xaaf682['body'][_0x533c('0x4e')];delete _0xaaf682[_0x533c('0x4c')][_0x533c('0x4f')];delete _0xaaf682[_0x533c('0x4c')][_0x533c('0x50')];return db[_0x533c('0x30')][_0x533c('0x49')]({'where':{'id':_0xaaf682['params']['id']}})[_0x533c('0x29')](handleEntityNotFound(_0x57c6c6,null))[_0x533c('0x29')](saveUpdates(_0xaaf682[_0x533c('0x4c')],null))[_0x533c('0x29')](respondWithResult(_0x57c6c6,null))[_0x533c('0x4a')](handleError(_0x57c6c6,null));};exports[_0x533c('0x51')]=function(_0x3eb174,_0x50d5a2){return db['ScreenRecording']['describe']()['then'](respondWithResult(_0x50d5a2,null))[_0x533c('0x4a')](handleError(_0x50d5a2,null));};exports[_0x533c('0x52')]=function(_0x5c5dd0,_0xac086b,_0x1da579){var _0x2f6794=require('../../components/encryptor');var _0x1de19e=![];var _0x564a31={};if(_0x5c5dd0['query'][_0x533c('0x31')]&&_0x5c5dd0[_0x533c('0x36')][_0x533c('0x31')]===_0x533c('0x53')){_0x564a31[_0x533c('0x53')]=_0x5c5dd0[_0x533c('0x47')]['id'];}else{_0x564a31['id']=_0x5c5dd0[_0x533c('0x47')]['id'];}return db['ScreenRecording'][_0x533c('0x49')]({'where':_0x564a31,'attributes':['id','value'],'raw':!![]})[_0x533c('0x29')](handleEntityNotFound(_0xac086b,null))[_0x533c('0x29')](function(_0x274686){if(_0x274686){var _0x2c7600=path[_0x533c('0x54')](config[_0x533c('0x55')],_0x533c('0x56'),_0x274686[_0x533c('0x50')]);var _0x58f528=util[_0x533c('0x35')](_0x533c('0x57'),_0x2c7600);if(fs[_0x533c('0x58')](_0x58f528)){_0x1de19e=!![];return _0x2f6794[_0x533c('0x59')](_0x58f528,_0x2c7600,config[_0x533c('0x5a')][_0x533c('0x5b')])['then'](function(){return _0x274686;});}return _0x274686;}})[_0x533c('0x29')](function(_0x554a9f){if(_0x554a9f){var _0x43383e=path[_0x533c('0x54')](config[_0x533c('0x55')],_0x533c('0x56'),_0x554a9f[_0x533c('0x50')]);if(!fs[_0x533c('0x58')](_0x43383e)){throw new db['Sequelize']['ValidationError'](_0x533c('0x5c'));}if(_0x554a9f[_0x533c('0x5d')]){return _0xac086b[_0x533c('0x52')](_0x43383e,_0x554a9f[_0x533c('0x5d')]+path['extname'](_0x43383e),function(){if(_0x1de19e){fs[_0x533c('0x5e')](_0x43383e);}});}else{return _0xac086b[_0x533c('0x52')](_0x43383e,function(_0x8e04c7){if(_0x1de19e){fs[_0x533c('0x5e')](_0x43383e);}});}}})[_0x533c('0x4a')](function(_0x2f2863){if(_0x2f2863[_0x533c('0x5f')]===_0x533c('0x5c')){_0xac086b[_0x533c('0x1d')](0x194)[_0x533c('0x2d')](_0x533c('0x60'));}else{return handleError(_0xac086b,null);}});};exports[_0x533c('0x2a')]=function(_0x13a7f2,_0xea6ea2){return db[_0x533c('0x30')][_0x533c('0x49')]({'where':{'id':_0x13a7f2[_0x533c('0x47')]['id']}})['then'](function(_0x31bba1){if(_['isNil'](_0x31bba1)){throw new ReferenceError('Entity\x20not\x20found');}return _0x31bba1;})[_0x533c('0x29')](function(_0xb23f94){var _0x965b85=path[_0x533c('0x54')](config[_0x533c('0x55')],_0x533c('0x56'),_0xb23f94[_0x533c('0x50')]);logger['info'](_0x533c('0x61'),_0x965b85);if(!_[_0x533c('0x62')](_0xb23f94['value'])&&fs[_0x533c('0x58')](_0x965b85)){logger[_0x533c('0x63')](_0x533c('0x64')+_0x965b85+_0x533c('0x65'));fs['unlinkSync'](_0x965b85);}_0x965b85=_0x965b85+_0x533c('0x66');if(!_[_0x533c('0x62')](_0xb23f94['value'])&&fs[_0x533c('0x58')](_0x965b85)){logger[_0x533c('0x63')]('File:\x20\x22'+_0x965b85+_0x533c('0x65'));fs[_0x533c('0x67')](_0x965b85);}return _0xb23f94;})['then'](function(_0x444f46){if(!_0x444f46)throw new InternalError();return _0x444f46['destroy']();})['then'](function(){_0xea6ea2[_0x533c('0x1d')](0xcc)[_0x533c('0x1e')]();})[_0x533c('0x4a')](handleError(_0xea6ea2,null));}; \ No newline at end of file +var _0xee14=['path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','ScreenRecording','includeAll','include','findAll','rows','catch','params','find','create','body','duration','describe','../../components/encryptor','uniqueid','value','server/files/screen_recordings','existsSync','decryptFile','secrets','recording','root','Sequelize','ValidationError','filename','download','unlink','ScreenRecording\x20not\x20found','isNil','Entity\x20not\x20found','join','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x30a19d,_0x4588c7){var _0x3d60e8=function(_0x1b96cd){while(--_0x1b96cd){_0x30a19d['push'](_0x30a19d['shift']());}};_0x3d60e8(++_0x4588c7);}(_0xee14,0x13a));var _0x4ee1=function(_0x29ecb0,_0x632aa6){_0x29ecb0=_0x29ecb0-0x0;var _0x1d37bf=_0xee14[_0x29ecb0];return _0x1d37bf;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4ee1('0x0'));var jsonpatch=require(_0x4ee1('0x1'));var rp=require(_0x4ee1('0x2'));var moment=require(_0x4ee1('0x3'));var BPromise=require(_0x4ee1('0x4'));var Mustache=require(_0x4ee1('0x5'));var util=require(_0x4ee1('0x6'));var path=require(_0x4ee1('0x7'));var sox=require(_0x4ee1('0x8'));var csv=require('to-csv');var ejs=require(_0x4ee1('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4ee1('0xa'));var squel=require(_0x4ee1('0xb'));var crypto=require(_0x4ee1('0xc'));var jsforce=require(_0x4ee1('0xd'));var deskjs=require(_0x4ee1('0xe'));var toCsv=require(_0x4ee1('0xf'));var querystring=require('querystring');var Papa=require(_0x4ee1('0x10'));var Redis=require(_0x4ee1('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4ee1('0x12'));var as=require(_0x4ee1('0x13'));var hardwareService=require(_0x4ee1('0x14'));var logger=require(_0x4ee1('0x15'))('api');var utils=require(_0x4ee1('0x16'));var config=require(_0x4ee1('0x17'));var licenseUtil=require(_0x4ee1('0x18'));var db=require(_0x4ee1('0x19'))['db'];function respondWithStatusCode(_0x2f864e,_0x174427){_0x174427=_0x174427||0xcc;return function(_0x5616d6){if(_0x5616d6){return _0x2f864e[_0x4ee1('0x1a')](_0x174427);}return _0x2f864e[_0x4ee1('0x1b')](_0x174427)[_0x4ee1('0x1c')]();};}function respondWithResult(_0x24a915,_0x46d2c2){_0x46d2c2=_0x46d2c2||0xc8;return function(_0x1c342a){if(_0x1c342a){return _0x24a915[_0x4ee1('0x1b')](_0x46d2c2)[_0x4ee1('0x1d')](_0x1c342a);}};}function respondWithFilteredResult(_0xb7eafd,_0x4e3490){return function(_0x2f9194){if(_0x2f9194){var _0x38008f=typeof _0x4e3490[_0x4ee1('0x1e')]===_0x4ee1('0x1f')&&typeof _0x4e3490[_0x4ee1('0x20')]===_0x4ee1('0x1f');var _0x2eff91=_0x2f9194[_0x4ee1('0x21')];var _0x360056=_0x38008f?0x0:_0x4e3490[_0x4ee1('0x1e')];var _0x274de5=_0x38008f?_0x2f9194['count']:_0x4e3490[_0x4ee1('0x1e')]+_0x4e3490[_0x4ee1('0x20')];var _0x173388;if(_0x274de5>=_0x2eff91){_0x274de5=_0x2eff91;_0x173388=0xc8;}else{_0x173388=0xce;}_0xb7eafd[_0x4ee1('0x1b')](_0x173388);return _0xb7eafd[_0x4ee1('0x22')](_0x4ee1('0x23'),_0x360056+'-'+_0x274de5+'/'+_0x2eff91)['json'](_0x2f9194);}return null;};}function patchUpdates(_0x8a631f){return function(_0x333e96){try{jsonpatch[_0x4ee1('0x24')](_0x333e96,_0x8a631f,!![]);}catch(_0x3f0d59){return BPromise[_0x4ee1('0x25')](_0x3f0d59);}return _0x333e96[_0x4ee1('0x26')]();};}function saveUpdates(_0x328f21,_0x40fd98){return function(_0x1dc1a8){if(_0x1dc1a8){return _0x1dc1a8[_0x4ee1('0x27')](_0x328f21)['then'](function(_0x53d43f){return _0x53d43f;});}return null;};}function removeEntity(_0x14110c,_0x459e2e){return function(_0xaf87e7){if(_0xaf87e7){return _0xaf87e7[_0x4ee1('0x28')]()[_0x4ee1('0x29')](function(){_0x14110c[_0x4ee1('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5cc0b5,_0x442c71){return function(_0x28b7e1){if(!_0x28b7e1){_0x5cc0b5['sendStatus'](0x194);}return _0x28b7e1;};}function handleError(_0x35900d,_0x213db8){_0x213db8=_0x213db8||0x1f4;return function(_0x36654c){logger[_0x4ee1('0x2a')](_0x36654c[_0x4ee1('0x2b')]);if(_0x36654c[_0x4ee1('0x2c')]){delete _0x36654c[_0x4ee1('0x2c')];}_0x35900d['status'](_0x213db8)[_0x4ee1('0x2d')](_0x36654c);};}exports['index']=function(_0x4746c2,_0x4ec408){var _0x3dc870={},_0x1d91be={},_0x59a34e={'count':0x0,'rows':[]};var _0x13944c=_[_0x4ee1('0x2e')](db['ScreenRecording'][_0x4ee1('0x2f')],function(_0x5b3792){return{'name':_0x5b3792[_0x4ee1('0x30')],'type':_0x5b3792[_0x4ee1('0x31')][_0x4ee1('0x32')]};});_0x1d91be[_0x4ee1('0x33')]=_[_0x4ee1('0x34')](_['map'](_0x13944c,_0x4ee1('0x2c')),[_0x4ee1('0x35')]);_0x1d91be[_0x4ee1('0x36')]=_[_0x4ee1('0x37')](_0x4746c2[_0x4ee1('0x36')]);_0x1d91be[_0x4ee1('0x38')]=_['intersection'](_0x1d91be['model'],_0x1d91be[_0x4ee1('0x36')]);_0x3dc870[_0x4ee1('0x39')]=_[_0x4ee1('0x3a')](_0x1d91be['model'],qs[_0x4ee1('0x3b')](_0x4746c2[_0x4ee1('0x36')][_0x4ee1('0x3b')]));_0x3dc870[_0x4ee1('0x39')]=_0x3dc870[_0x4ee1('0x39')][_0x4ee1('0x3c')]?_0x3dc870[_0x4ee1('0x39')]:_0x1d91be[_0x4ee1('0x33')];if(!_0x4746c2[_0x4ee1('0x36')][_0x4ee1('0x3d')](_0x4ee1('0x3e'))){_0x3dc870[_0x4ee1('0x20')]=qs[_0x4ee1('0x20')](_0x4746c2['query'][_0x4ee1('0x20')]);_0x3dc870[_0x4ee1('0x1e')]=qs[_0x4ee1('0x1e')](_0x4746c2['query']['offset']);}_0x3dc870[_0x4ee1('0x3f')]=qs[_0x4ee1('0x40')](_0x4746c2[_0x4ee1('0x36')][_0x4ee1('0x40')]);_0x3dc870['where']=qs[_0x4ee1('0x38')](_[_0x4ee1('0x41')](_0x4746c2[_0x4ee1('0x36')],_0x1d91be[_0x4ee1('0x38')]),_0x13944c);if(_0x4746c2[_0x4ee1('0x36')][_0x4ee1('0x42')]){_0x3dc870[_0x4ee1('0x43')]=_[_0x4ee1('0x44')](_0x3dc870['where'],{'$or':_[_0x4ee1('0x2e')](_0x13944c,function(_0x1116b4){if(_0x1116b4[_0x4ee1('0x31')]!==_0x4ee1('0x45')){var _0x45bb22={};_0x45bb22[_0x1116b4[_0x4ee1('0x2c')]]={'$like':'%'+_0x4746c2['query'][_0x4ee1('0x42')]+'%'};return _0x45bb22;}})});}_0x3dc870=_[_0x4ee1('0x44')]({},_0x3dc870,_0x4746c2[_0x4ee1('0x46')]);var _0x333690={'where':_0x3dc870[_0x4ee1('0x43')]};return db[_0x4ee1('0x47')][_0x4ee1('0x21')](_0x333690)[_0x4ee1('0x29')](function(_0x23bb5f){_0x59a34e[_0x4ee1('0x21')]=_0x23bb5f;if(_0x4746c2[_0x4ee1('0x36')][_0x4ee1('0x48')]){_0x3dc870[_0x4ee1('0x49')]=[{'all':!![]}];}return db['ScreenRecording'][_0x4ee1('0x4a')](_0x3dc870);})[_0x4ee1('0x29')](function(_0x5ee7b4){_0x59a34e[_0x4ee1('0x4b')]=_0x5ee7b4;return _0x59a34e;})['then'](respondWithFilteredResult(_0x4ec408,_0x3dc870))[_0x4ee1('0x4c')](handleError(_0x4ec408,null));};exports['show']=function(_0x14c333,_0xc7580c){var _0x557126={'raw':![],'where':{'id':_0x14c333[_0x4ee1('0x4d')]['id']}},_0x25d683={};_0x25d683[_0x4ee1('0x33')]=_[_0x4ee1('0x37')](db['ScreenRecording'][_0x4ee1('0x2f')]);_0x25d683[_0x4ee1('0x36')]=_[_0x4ee1('0x37')](_0x14c333['query']);_0x25d683['filters']=_[_0x4ee1('0x3a')](_0x25d683[_0x4ee1('0x33')],_0x25d683[_0x4ee1('0x36')]);_0x557126[_0x4ee1('0x39')]=_[_0x4ee1('0x3a')](_0x25d683['model'],qs['fields'](_0x14c333[_0x4ee1('0x36')][_0x4ee1('0x3b')]));_0x557126[_0x4ee1('0x39')]=_0x557126[_0x4ee1('0x39')]['length']?_0x557126[_0x4ee1('0x39')]:_0x25d683[_0x4ee1('0x33')];if(_0x14c333['query'][_0x4ee1('0x48')]){_0x557126[_0x4ee1('0x49')]=[{'all':!![]}];}_0x557126=_[_0x4ee1('0x44')]({},_0x557126,_0x14c333[_0x4ee1('0x46')]);return db[_0x4ee1('0x47')][_0x4ee1('0x4e')](_0x557126)[_0x4ee1('0x29')](handleEntityNotFound(_0xc7580c,null))[_0x4ee1('0x29')](respondWithResult(_0xc7580c,null))[_0x4ee1('0x4c')](handleError(_0xc7580c,null));};exports['create']=function(_0x49b667,_0x1a972b){return db[_0x4ee1('0x47')][_0x4ee1('0x4f')](_0x49b667[_0x4ee1('0x50')],{})['then'](respondWithResult(_0x1a972b,0xc9))[_0x4ee1('0x4c')](handleError(_0x1a972b,null));};exports[_0x4ee1('0x27')]=function(_0x42dd8d,_0x2bc77f){if(_0x42dd8d[_0x4ee1('0x50')]['id']){delete _0x42dd8d['body']['id'];}delete _0x42dd8d[_0x4ee1('0x50')][_0x4ee1('0x51')];delete _0x42dd8d[_0x4ee1('0x50')]['createdAt'];delete _0x42dd8d[_0x4ee1('0x50')]['closedAt'];delete _0x42dd8d[_0x4ee1('0x50')]['value'];return db[_0x4ee1('0x47')]['find']({'where':{'id':_0x42dd8d[_0x4ee1('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2bc77f,null))[_0x4ee1('0x29')](saveUpdates(_0x42dd8d[_0x4ee1('0x50')],null))[_0x4ee1('0x29')](respondWithResult(_0x2bc77f,null))['catch'](handleError(_0x2bc77f,null));};exports[_0x4ee1('0x52')]=function(_0x4118d7,_0xcdb873){return db[_0x4ee1('0x47')][_0x4ee1('0x52')]()[_0x4ee1('0x29')](respondWithResult(_0xcdb873,null))[_0x4ee1('0x4c')](handleError(_0xcdb873,null));};exports['download']=function(_0x4c4178,_0x1feb78,_0xcddc5d){var _0xf58cd8=require(_0x4ee1('0x53'));var _0x44e65f=![];var _0x31e82d={};if(_0x4c4178[_0x4ee1('0x36')][_0x4ee1('0x31')]&&_0x4c4178[_0x4ee1('0x36')][_0x4ee1('0x31')]===_0x4ee1('0x54')){_0x31e82d[_0x4ee1('0x54')]=_0x4c4178[_0x4ee1('0x4d')]['id'];}else{_0x31e82d['id']=_0x4c4178['params']['id'];}return db[_0x4ee1('0x47')]['find']({'where':_0x31e82d,'attributes':['id',_0x4ee1('0x55')],'raw':!![]})[_0x4ee1('0x29')](handleEntityNotFound(_0x1feb78,null))['then'](function(_0x1e0aac){if(_0x1e0aac){var _0x184e36=path['join'](config['root'],_0x4ee1('0x56'),_0x1e0aac['value']);var _0x1ce99e=util[_0x4ee1('0x35')]('%s.cypher',_0x184e36);if(fs[_0x4ee1('0x57')](_0x1ce99e)){_0x44e65f=!![];return _0xf58cd8[_0x4ee1('0x58')](_0x1ce99e,_0x184e36,config[_0x4ee1('0x59')][_0x4ee1('0x5a')])[_0x4ee1('0x29')](function(){return _0x1e0aac;});}return _0x1e0aac;}})[_0x4ee1('0x29')](function(_0x11f619){if(_0x11f619){var _0x5f5694=path['join'](config[_0x4ee1('0x5b')],_0x4ee1('0x56'),_0x11f619['value']);if(!fs[_0x4ee1('0x57')](_0x5f5694)){throw new db[(_0x4ee1('0x5c'))][(_0x4ee1('0x5d'))]('ScreenRecording\x20not\x20found');}if(_0x11f619[_0x4ee1('0x5e')]){return _0x1feb78['download'](_0x5f5694,_0x11f619[_0x4ee1('0x5e')]+path['extname'](_0x5f5694),function(){if(_0x44e65f){fs['unlink'](_0x5f5694);}});}else{return _0x1feb78[_0x4ee1('0x5f')](_0x5f5694,function(_0x16fcd0){if(_0x44e65f){fs[_0x4ee1('0x60')](_0x5f5694);}});}}})[_0x4ee1('0x4c')](function(_0x38e889){if(_0x38e889['message']===_0x4ee1('0x61')){_0x1feb78[_0x4ee1('0x1b')](0x194)[_0x4ee1('0x2d')]('Not\x20found');}else{return handleError(_0x1feb78,null);}});};exports[_0x4ee1('0x28')]=function(_0x109dc6,_0x3fdd61){return db[_0x4ee1('0x47')][_0x4ee1('0x4e')]({'where':{'id':_0x109dc6[_0x4ee1('0x4d')]['id']}})[_0x4ee1('0x29')](function(_0x20ca0b){if(_[_0x4ee1('0x62')](_0x20ca0b)){throw new ReferenceError(_0x4ee1('0x63'));}return _0x20ca0b;})[_0x4ee1('0x29')](function(_0x38e86f){var _0x5d396c=path[_0x4ee1('0x64')](config['root'],_0x4ee1('0x56'),_0x38e86f['value']);logger[_0x4ee1('0x65')](_0x4ee1('0x66'),_0x5d396c);if(!_[_0x4ee1('0x62')](_0x38e86f[_0x4ee1('0x55')])&&fs[_0x4ee1('0x57')](_0x5d396c)){logger[_0x4ee1('0x65')](_0x4ee1('0x67')+_0x5d396c+_0x4ee1('0x68'));fs[_0x4ee1('0x69')](_0x5d396c);}_0x5d396c=_0x5d396c+_0x4ee1('0x6a');if(!_[_0x4ee1('0x62')](_0x38e86f[_0x4ee1('0x55')])&&fs['existsSync'](_0x5d396c)){logger[_0x4ee1('0x65')](_0x4ee1('0x67')+_0x5d396c+_0x4ee1('0x68'));fs['unlinkSync'](_0x5d396c);}return _0x38e86f;})['then'](function(_0x40dac3){if(!_0x40dac3)throw new InternalError();return _0x40dac3[_0x4ee1('0x28')]();})['then'](function(){_0x3fdd61[_0x4ee1('0x1b')](0xcc)[_0x4ee1('0x1c')]();})[_0x4ee1('0x4c')](handleError(_0x3fdd61,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index a15527e..d6deda3 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 _0xf15d=['../../config/environment','./screenRecording.attributes','exports','ScreenRecording','screen_recordings','interactionid','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x4d0c6f,_0x49959a){var _0x28bde5=function(_0x22fedb){while(--_0x22fedb){_0x4d0c6f['push'](_0x4d0c6f['shift']());}};_0x28bde5(++_0x49959a);}(_0xf15d,0x8a));var _0xdf15=function(_0x4941ce,_0x307c6a){_0x4941ce=_0x4941ce-0x0;var _0x5aed09=_0xf15d[_0x4941ce];return _0x5aed09;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xdf15('0x0'))('api');var moment=require('moment');var BPromise=require(_0xdf15('0x1'));var rp=require(_0xdf15('0x2'));var fs=require('fs');var path=require(_0xdf15('0x3'));var rimraf=require(_0xdf15('0x4'));var config=require(_0xdf15('0x5'));var attributes=require(_0xdf15('0x6'));module[_0xdf15('0x7')]=function(_0x2bed49,_0x5eb688){return _0x2bed49['define'](_0xdf15('0x8'),attributes,{'tableName':_0xdf15('0x9'),'paranoid':![],'indexes':[{'name':_0xdf15('0xa'),'fields':[_0xdf15('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe69f=['bluebird','request-promise','path','rimraf','../../config/environment','./screenRecording.attributes','exports','ScreenRecording','screen_recordings','interactionid','lodash','api','moment'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xe69f,0x14f));var _0xfe69=function(_0x1b8a7f,_0x567dd1){_0x1b8a7f=_0x1b8a7f-0x0;var _0x177b52=_0xe69f[_0x1b8a7f];return _0x177b52;};'use strict';var _=require(_0xfe69('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xfe69('0x1'));var moment=require(_0xfe69('0x2'));var BPromise=require(_0xfe69('0x3'));var rp=require(_0xfe69('0x4'));var fs=require('fs');var path=require(_0xfe69('0x5'));var rimraf=require(_0xfe69('0x6'));var config=require(_0xfe69('0x7'));var attributes=require(_0xfe69('0x8'));module[_0xfe69('0x9')]=function(_0x5ae3a4,_0x1f4ca8){return _0x5ae3a4['define'](_0xfe69('0xa'),attributes,{'tableName':_0xfe69('0xb'),'paranoid':![],'indexes':[{'name':_0xfe69('0xc'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 91bd3d8..386d2ab 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 _0x8c29=['result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x1284dd,_0x5e3473){var _0x12d015=function(_0x63e5ee){while(--_0x63e5ee){_0x1284dd['push'](_0x1284dd['shift']());}};_0x12d015(++_0x5e3473);}(_0x8c29,0x86));var _0x98c2=function(_0x3e8fc1,_0x598549){_0x3e8fc1=_0x3e8fc1-0x0;var _0x2c8f88=_0x8c29[_0x3e8fc1];return _0x2c8f88;};'use strict';var _=require(_0x98c2('0x0'));var util=require(_0x98c2('0x1'));var moment=require(_0x98c2('0x2'));var BPromise=require('bluebird');var rs=require(_0x98c2('0x3'));var fs=require('fs');var Redis=require(_0x98c2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x98c2('0x5'));var logger=require(_0x98c2('0x6'))(_0x98c2('0x7'));var config=require(_0x98c2('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x98c2('0x9')][_0x98c2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b72d3,_0x50d4f3,_0x4eae10){return new BPromise(function(_0x26df4b,_0x37334f){return client[_0x98c2('0xb')](_0x2b72d3,_0x4eae10)['then'](function(_0x282099){logger[_0x98c2('0xc')](_0x98c2('0xd'),_0x50d4f3,_0x98c2('0xe'));logger[_0x98c2('0xf')]('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x50d4f3,_0x98c2('0xe'),JSON[_0x98c2('0x10')](_0x282099));if(_0x282099[_0x98c2('0x11')]){if(_0x282099[_0x98c2('0x11')][_0x98c2('0x12')]===0x1f4){logger['error']('ScreenRecording,\x20%s,\x20%s',_0x50d4f3,_0x282099[_0x98c2('0x11')]['message']);return _0x37334f(_0x282099[_0x98c2('0x11')]['message']);}logger[_0x98c2('0x11')](_0x98c2('0xd'),_0x50d4f3,_0x282099[_0x98c2('0x11')][_0x98c2('0x13')]);return _0x26df4b(_0x282099['error'][_0x98c2('0x13')]);}else{logger[_0x98c2('0xc')](_0x98c2('0xd'),_0x50d4f3,'request\x20sent');_0x26df4b(_0x282099[_0x98c2('0x14')][_0x98c2('0x13')]);}})[_0x98c2('0x15')](function(_0x557eeb){logger[_0x98c2('0x11')]('ScreenRecording,\x20%s,\x20%s',_0x50d4f3,_0x557eeb);_0x37334f(_0x557eeb);});});} \ No newline at end of file +var _0xf720=['code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x42a055,_0xb9776f){var _0x5a64b4=function(_0x431eaf){while(--_0x431eaf){_0x42a055['push'](_0x42a055['shift']());}};_0x5a64b4(++_0xb9776f);}(_0xf720,0x124));var _0x0f72=function(_0x5292af,_0x30f880){_0x5292af=_0x5292af-0x0;var _0x1b5b2a=_0xf720[_0x5292af];return _0x1b5b2a;};'use strict';var _=require(_0x0f72('0x0'));var util=require(_0x0f72('0x1'));var moment=require('moment');var BPromise=require(_0x0f72('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0f72('0x3'));var db=require(_0x0f72('0x4'))['db'];var utils=require(_0x0f72('0x5'));var logger=require(_0x0f72('0x6'))(_0x0f72('0x7'));var config=require(_0x0f72('0x8'));var jayson=require(_0x0f72('0x9'));var client=jayson[_0x0f72('0xa')][_0x0f72('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5d4b43,_0x71552a,_0x4e2daa){return new BPromise(function(_0x404450,_0x261c1d){return client[_0x0f72('0xc')](_0x5d4b43,_0x4e2daa)[_0x0f72('0xd')](function(_0x192010){logger[_0x0f72('0xe')](_0x0f72('0xf'),_0x71552a,_0x0f72('0x10'));logger['debug'](_0x0f72('0x11'),_0x71552a,'request\x20sent',JSON[_0x0f72('0x12')](_0x192010));if(_0x192010[_0x0f72('0x13')]){if(_0x192010[_0x0f72('0x13')][_0x0f72('0x14')]===0x1f4){logger[_0x0f72('0x13')](_0x0f72('0xf'),_0x71552a,_0x192010['error'][_0x0f72('0x15')]);return _0x261c1d(_0x192010[_0x0f72('0x13')][_0x0f72('0x15')]);}logger[_0x0f72('0x13')](_0x0f72('0xf'),_0x71552a,_0x192010[_0x0f72('0x13')][_0x0f72('0x15')]);return _0x404450(_0x192010[_0x0f72('0x13')][_0x0f72('0x15')]);}else{logger[_0x0f72('0xe')](_0x0f72('0xf'),_0x71552a,_0x0f72('0x10'));_0x404450(_0x192010[_0x0f72('0x16')][_0x0f72('0x15')]);}})[_0x0f72('0x17')](function(_0x79026d){logger['error'](_0x0f72('0xf'),_0x71552a,_0x79026d);_0x261c1d(_0x79026d);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index c2a06fc..9ff6ce9 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 _0x5b7b=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/now','getDate','/:id','show','getLogo','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getFavicon','join','format','%s%s','logo','extname','originalname','post','/:id/logo','single','file','addLogo','diskStorage','logologin','/:id/logo_login','root','server/files/images/logos/','addPreferred','favicon','/:id/favicon','put','exports','multer','path','connect-timeout'];(function(_0x12cbc9,_0x51222d){var _0x43ef8b=function(_0x52154b){while(--_0x52154b){_0x12cbc9['push'](_0x12cbc9['shift']());}};_0x43ef8b(++_0x51222d);}(_0x5b7b,0xd9));var _0xb5b7=function(_0x2f965f,_0x100aca){_0x2f965f=_0x2f965f-0x0;var _0x73f2b9=_0x5b7b[_0x2f965f];return _0x73f2b9;};'use strict';var multer=require(_0xb5b7('0x0'));var util=require('util');var path=require(_0xb5b7('0x1'));var timeout=require(_0xb5b7('0x2'));var express=require(_0xb5b7('0x3'));var router=express[_0xb5b7('0x4')]();var fs_extra=require(_0xb5b7('0x5'));var auth=require(_0xb5b7('0x6'));var interaction=require(_0xb5b7('0x7'));var config=require(_0xb5b7('0x8'));var controller=require(_0xb5b7('0x9'));router[_0xb5b7('0xa')]('/',auth[_0xb5b7('0xb')](),controller[_0xb5b7('0xc')]);router[_0xb5b7('0xa')](_0xb5b7('0xd'),controller[_0xb5b7('0xe')]);router['get'](_0xb5b7('0xf'),controller[_0xb5b7('0x10')]);router[_0xb5b7('0xa')]('/:id/logo',controller[_0xb5b7('0x11')]);router[_0xb5b7('0xa')]('/:id/logo_login',controller[_0xb5b7('0x12')]);router['get'](_0xb5b7('0x13'),controller[_0xb5b7('0x14')]);router[_0xb5b7('0xa')](_0xb5b7('0x15'),controller['getPreferred']);router[_0xb5b7('0xa')]('/:id/favicon',controller[_0xb5b7('0x16')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x312c33,_0x18568a,_0x16b620){_0x16b620(null,path[_0xb5b7('0x17')](config['root'],'server/files/images/logos/'));},'filename':function(_0x3a6bc0,_0x3da58e,_0x869820){_0x869820(null,util[_0xb5b7('0x18')](_0xb5b7('0x19'),_0xb5b7('0x1a'),path[_0xb5b7('0x1b')](_0x3da58e[_0xb5b7('0x1c')])));}})});router[_0xb5b7('0x1d')](_0xb5b7('0x1e'),upload[_0xb5b7('0x1f')](_0xb5b7('0x20')),controller[_0xb5b7('0x21')]);var upload=multer({'storage':multer[_0xb5b7('0x22')]({'destination':function(_0x2c782b,_0x56783a,_0x2ab56c){_0x2ab56c(null,path[_0xb5b7('0x17')](config['root'],'server/files/images/logos/'));},'filename':function(_0x3bf4b2,_0x2d2e1f,_0xc92b25){_0xc92b25(null,util[_0xb5b7('0x18')](_0xb5b7('0x19'),_0xb5b7('0x23'),path['extname'](_0x2d2e1f[_0xb5b7('0x1c')])));}})});router[_0xb5b7('0x1d')](_0xb5b7('0x24'),upload['single'](_0xb5b7('0x20')),controller['addLogoLogin']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x113dfc,_0x4983a9,_0x28d2c0){_0x28d2c0(null,path['join'](config[_0xb5b7('0x25')],_0xb5b7('0x26')));},'filename':function(_0x456d53,_0x55554e,_0x3cc941){_0x3cc941(null,util[_0xb5b7('0x18')](_0xb5b7('0x19'),'preferred',path[_0xb5b7('0x1b')](_0x55554e[_0xb5b7('0x1c')])));}})});router['post'](_0xb5b7('0x15'),upload[_0xb5b7('0x1f')](_0xb5b7('0x20')),controller[_0xb5b7('0x27')]);var upload=multer({'storage':multer[_0xb5b7('0x22')]({'destination':function(_0x55ed15,_0xb6d531,_0x566bf7){_0x566bf7(null,path[_0xb5b7('0x17')](config['root'],_0xb5b7('0x26')));},'filename':function(_0x27fa02,_0x361273,_0x5d6b98){_0x5d6b98(null,util[_0xb5b7('0x18')](_0xb5b7('0x19'),_0xb5b7('0x28'),path[_0xb5b7('0x1b')](_0x361273[_0xb5b7('0x1c')])));}})});router[_0xb5b7('0x1d')](_0xb5b7('0x29'),upload['single'](_0xb5b7('0x20')),controller['addFavicon']);router[_0xb5b7('0x2a')](_0xb5b7('0xf'),auth[_0xb5b7('0xb')](),controller['update']);module[_0xb5b7('0x2b')]=router; \ No newline at end of file +var _0x81dc=['server/files/images/logos/','format','logologin','addLogoLogin','preferred','addPreferred','favicon','addFavicon','put','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/now','getDate','/:id','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','/:id/favicon','getFavicon','diskStorage','root','%s%s','logo','extname','originalname','post','single','file','addLogo','join'];(function(_0x46f9,_0x41b032){var _0x44e46f=function(_0x2fff17){while(--_0x2fff17){_0x46f9['push'](_0x46f9['shift']());}};_0x44e46f(++_0x41b032);}(_0x81dc,0xef));var _0xc81d=function(_0x34f701,_0x37e407){_0x34f701=_0x34f701-0x0;var _0x3e2429=_0x81dc[_0x34f701];return _0x3e2429;};'use strict';var multer=require('multer');var util=require(_0xc81d('0x0'));var path=require(_0xc81d('0x1'));var timeout=require(_0xc81d('0x2'));var express=require(_0xc81d('0x3'));var router=express[_0xc81d('0x4')]();var fs_extra=require(_0xc81d('0x5'));var auth=require(_0xc81d('0x6'));var interaction=require(_0xc81d('0x7'));var config=require(_0xc81d('0x8'));var controller=require(_0xc81d('0x9'));router[_0xc81d('0xa')]('/',auth[_0xc81d('0xb')](),controller[_0xc81d('0xc')]);router[_0xc81d('0xa')](_0xc81d('0xd'),controller[_0xc81d('0xe')]);router[_0xc81d('0xa')](_0xc81d('0xf'),controller[_0xc81d('0x10')]);router[_0xc81d('0xa')](_0xc81d('0x11'),controller[_0xc81d('0x12')]);router[_0xc81d('0xa')](_0xc81d('0x13'),controller[_0xc81d('0x14')]);router['get'](_0xc81d('0x15'),controller[_0xc81d('0x16')]);router[_0xc81d('0xa')](_0xc81d('0x17'),controller['getPreferred']);router[_0xc81d('0xa')](_0xc81d('0x18'),controller[_0xc81d('0x19')]);var upload=multer({'storage':multer[_0xc81d('0x1a')]({'destination':function(_0x314b0e,_0x507c2f,_0x1aa4c7){_0x1aa4c7(null,path['join'](config[_0xc81d('0x1b')],'server/files/images/logos/'));},'filename':function(_0x22bcc1,_0x5d92a9,_0x72357c){_0x72357c(null,util['format'](_0xc81d('0x1c'),_0xc81d('0x1d'),path[_0xc81d('0x1e')](_0x5d92a9[_0xc81d('0x1f')])));}})});router[_0xc81d('0x20')](_0xc81d('0x11'),upload[_0xc81d('0x21')](_0xc81d('0x22')),controller[_0xc81d('0x23')]);var upload=multer({'storage':multer[_0xc81d('0x1a')]({'destination':function(_0x56c96b,_0x578204,_0x6d86f5){_0x6d86f5(null,path[_0xc81d('0x24')](config[_0xc81d('0x1b')],_0xc81d('0x25')));},'filename':function(_0xd04b6a,_0x283cfc,_0x3568bd){_0x3568bd(null,util[_0xc81d('0x26')](_0xc81d('0x1c'),_0xc81d('0x27'),path[_0xc81d('0x1e')](_0x283cfc[_0xc81d('0x1f')])));}})});router[_0xc81d('0x20')](_0xc81d('0x13'),upload[_0xc81d('0x21')](_0xc81d('0x22')),controller[_0xc81d('0x28')]);var upload=multer({'storage':multer[_0xc81d('0x1a')]({'destination':function(_0x45881a,_0x550fa8,_0x44ba23){_0x44ba23(null,path[_0xc81d('0x24')](config[_0xc81d('0x1b')],_0xc81d('0x25')));},'filename':function(_0x392b7a,_0xc23bb8,_0x25818b){_0x25818b(null,util['format'](_0xc81d('0x1c'),_0xc81d('0x29'),path[_0xc81d('0x1e')](_0xc23bb8[_0xc81d('0x1f')])));}})});router[_0xc81d('0x20')]('/:id/preferred',upload[_0xc81d('0x21')](_0xc81d('0x22')),controller[_0xc81d('0x2a')]);var upload=multer({'storage':multer[_0xc81d('0x1a')]({'destination':function(_0x12d5e0,_0x199035,_0x2df4f3){_0x2df4f3(null,path[_0xc81d('0x24')](config[_0xc81d('0x1b')],_0xc81d('0x25')));},'filename':function(_0xfe694d,_0x1214bd,_0x1eeae7){_0x1eeae7(null,util['format']('%s%s',_0xc81d('0x2b'),path[_0xc81d('0x1e')](_0x1214bd[_0xc81d('0x1f')])));}})});router[_0xc81d('0x20')](_0xc81d('0x18'),upload[_0xc81d('0x21')](_0xc81d('0x22')),controller[_0xc81d('0x2c')]);router[_0xc81d('0x2d')]('/:id',auth['isAuthenticated'](),controller['update']);module['exports']=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 67b49a7..22a16b2 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 _0x51c2=['INTEGER','min_internal','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','sequelize'];(function(_0x1c9d0e,_0x3f4701){var _0x918fbb=function(_0x284970){while(--_0x284970){_0x1c9d0e['push'](_0x1c9d0e['shift']());}};_0x918fbb(++_0x3f4701);}(_0x51c2,0xe5));var _0x251c=function(_0x2405bc,_0x2f28a1){_0x2405bc=_0x2405bc-0x0;var _0x5272d4=_0x51c2[_0x2405bc];return _0x5272d4;};'use strict';var Sequelize=require(_0x251c('0x0'));module['exports']={'min_internal':{'type':Sequelize[_0x251c('0x1')](0xb),'unique':_0x251c('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x251c('0x1')](0xb),'unique':_0x251c('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x251c('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x251c('0x4')],'defaultValue':_0x251c('0x5')},'logo':{'type':Sequelize[_0x251c('0x4')]},'defaultLogo':{'type':Sequelize[_0x251c('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x251c('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x251c('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x251c('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x251c('0x4')]},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize[_0x251c('0x4')]},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x251c('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x251c('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x251c('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x251c('0x4')],'defaultValue':_0x251c('0x7')},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize[_0x251c('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x251c('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x251c('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x251c('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x251c('0x8')},'chatTimeout':{'type':Sequelize[_0x251c('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x251c('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x251c('0x4')]},'defaultPreferred':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x251c('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x251c('0x4')]},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x251c('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x251c('0x1')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x251c('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x251c('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x251c('0x1')]},'transcribeRegion':{'type':Sequelize['STRING']},'sentiment':{'type':Sequelize[_0x251c('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x251c('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x251c('0x1')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize[_0x251c('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x251c('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x251c('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x251c('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x251c('0x1')](0x2)[_0x251c('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x251c('0x1')](0x2)[_0x251c('0x9')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x251c('0x1')](0x2)[_0x251c('0x9')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize['INTEGER'](0x2)[_0x251c('0x9')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x251c('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x251c('0x1')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x251c('0x1')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x251c('0x1')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x251c('0x1')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x251c('0x1')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x251c('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x251c('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize['INTEGER'],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x251c('0x1')],'defaultValue':0x14},'filterFullName':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x32e8=['STRING','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','sequelize','INTEGER','min_internal','min_mailbox'];(function(_0x34c7bc,_0x47d8f3){var _0x522052=function(_0x49885b){while(--_0x49885b){_0x34c7bc['push'](_0x34c7bc['shift']());}};_0x522052(++_0x47d8f3);}(_0x32e8,0x137));var _0x832e=function(_0x4b5813,_0x5769de){_0x4b5813=_0x4b5813-0x0;var _0x423465=_0x32e8[_0x4b5813];return _0x423465;};'use strict';var Sequelize=require(_0x832e('0x0'));module['exports']={'min_internal':{'type':Sequelize[_0x832e('0x1')](0xb),'unique':_0x832e('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x832e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x832e('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x832e('0x4')],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize[_0x832e('0x4')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x832e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x832e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x832e('0x5')],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x832e('0x5')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x832e('0x4')]},'turnaddr':{'type':Sequelize[_0x832e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x832e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x832e('0x5')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x832e('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x832e('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x832e('0x5')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x832e('0x4')],'defaultValue':_0x832e('0x6')},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize[_0x832e('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x832e('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x832e('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x832e('0x4')],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x832e('0x5')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x832e('0x4')]},'defaultPreferred':{'type':Sequelize[_0x832e('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x832e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x832e('0x1')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x832e('0x1')],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize[_0x832e('0x5')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x832e('0x1')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x832e('0x5')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x832e('0x1')]},'transcribeRegion':{'type':Sequelize[_0x832e('0x4')]},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x832e('0x5')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize['INTEGER']},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x832e('0x4')]},'bucket':{'type':Sequelize[_0x832e('0x4')]},'googleSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x832e('0x5')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x832e('0x5')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x832e('0x1')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x832e('0x5')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x832e('0x1')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x832e('0x1')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x832e('0x1')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x832e('0x1')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x832e('0x5')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x832e('0x5')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x832e('0x5')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x832e('0x1')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize[_0x832e('0x5')],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x832e('0x1')],'defaultValue':0x14},'filterFullName':{'type':Sequelize[_0x832e('0x5')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 372a6e5..c03a6aa 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 _0x8413=['format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','then','info','request\x20sent','debug','stringify','error','code','Setting,\x20%s,\x20%s','message','result','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','name','send','index','map','Setting','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','catch','show','options','find','body','file','filename','addLogoLogin','loginLogo','getLogo','server/files/images/logos','getLicense','params','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','logo','join','toLower','root','default_logo.svg','default','upperFirst','existsSync','ValidationError','\x20not\x20found','default_loginLogo.svg','custom','download','gdpr','securePassword','getPreferred','default_preferred.png','addFavicon','default_favicon.ico','Sequelize','getDate','utcOffset'];(function(_0x3b4492,_0x1b2243){var _0x424f09=function(_0x5cae17){while(--_0x5cae17){_0x3b4492['push'](_0x3b4492['shift']());}};_0x424f09(++_0x1b2243);}(_0x8413,0x7b));var _0x3841=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x8413[_0x5447fd];return _0x15b28a;};'use strict';var emlformat=require(_0x3841('0x0'));var rimraf=require(_0x3841('0x1'));var zipdir=require(_0x3841('0x2'));var jsonpatch=require(_0x3841('0x3'));var rp=require(_0x3841('0x4'));var moment=require(_0x3841('0x5'));var BPromise=require(_0x3841('0x6'));var Mustache=require(_0x3841('0x7'));var util=require(_0x3841('0x8'));var path=require('path');var sox=require(_0x3841('0x9'));var csv=require(_0x3841('0xa'));var ejs=require(_0x3841('0xb'));var fs=require('fs');var fs_extra=require(_0x3841('0xc'));var _=require(_0x3841('0xd'));var squel=require('squel');var crypto=require(_0x3841('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x3841('0xf'));var toCsv=require(_0x3841('0xa'));var querystring=require(_0x3841('0x10'));var Papa=require(_0x3841('0x11'));var Redis=require(_0x3841('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x3841('0x13'));var as=require(_0x3841('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3841('0x15'))(_0x3841('0x16'));var utils=require(_0x3841('0x17'));var config=require(_0x3841('0x18'));var licenseUtil=require(_0x3841('0x19'));var db=require(_0x3841('0x1a'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x3841('0x1b')][_0x3841('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x515f33,_0x1b8642,_0x16a67a,_0x9febdd){return new BPromise(function(_0xa61092,_0xf0bbb4){var _0x3ce674=_0x9febdd||client;return _0x3ce674['request'](_0x515f33,_0x16a67a)[_0x3841('0x1d')](function(_0x577cf3){logger[_0x3841('0x1e')]('Setting,\x20%s,\x20%s',_0x1b8642,_0x3841('0x1f'));logger[_0x3841('0x20')]('Setting,\x20%s,\x20%s,\x20%s',_0x1b8642,'request\x20sent',JSON[_0x3841('0x21')](_0x577cf3));if(_0x577cf3[_0x3841('0x22')]){if(_0x577cf3[_0x3841('0x22')][_0x3841('0x23')]===0x1f4){logger[_0x3841('0x22')](_0x3841('0x24'),_0x1b8642,_0x577cf3['error'][_0x3841('0x25')]);return _0xf0bbb4(_0x577cf3['error'][_0x3841('0x25')]);}logger[_0x3841('0x22')]('Setting,\x20%s,\x20%s',_0x1b8642,_0x577cf3['error'][_0x3841('0x25')]);return _0xa61092(_0x577cf3['error'][_0x3841('0x25')]);}else{logger[_0x3841('0x1e')]('Setting,\x20%s,\x20%s',_0x1b8642,_0x3841('0x1f'));_0xa61092(_0x577cf3[_0x3841('0x26')][_0x3841('0x25')]);}})['catch'](function(_0x57c8d5){logger[_0x3841('0x22')](_0x3841('0x24'),_0x1b8642,_0x57c8d5);_0xf0bbb4(_0x57c8d5);});});}function respondWithStatusCode(_0x160f86,_0x363c58){_0x363c58=_0x363c58||0xcc;return function(_0x279353){if(_0x279353){return _0x160f86[_0x3841('0x27')](_0x363c58);}return _0x160f86[_0x3841('0x28')](_0x363c58)[_0x3841('0x29')]();};}function respondWithResult(_0x4f7161,_0x38fa26){_0x38fa26=_0x38fa26||0xc8;return function(_0x455bd0){if(_0x455bd0){return _0x4f7161[_0x3841('0x28')](_0x38fa26)[_0x3841('0x2a')](_0x455bd0);}};}function respondWithFilteredResult(_0x231546,_0x5c069b){return function(_0x18387d){if(_0x18387d){var _0x5d8c15=typeof _0x5c069b['offset']===_0x3841('0x2b')&&typeof _0x5c069b[_0x3841('0x2c')]==='undefined';var _0x14a27b=_0x18387d[_0x3841('0x2d')];var _0x10c0b4=_0x5d8c15?0x0:_0x5c069b[_0x3841('0x2e')];var _0x431572=_0x5d8c15?_0x18387d['count']:_0x5c069b[_0x3841('0x2e')]+_0x5c069b[_0x3841('0x2c')];var _0x353e8b;if(_0x431572>=_0x14a27b){_0x431572=_0x14a27b;_0x353e8b=0xc8;}else{_0x353e8b=0xce;}_0x231546[_0x3841('0x28')](_0x353e8b);return _0x231546[_0x3841('0x2f')](_0x3841('0x30'),_0x10c0b4+'-'+_0x431572+'/'+_0x14a27b)[_0x3841('0x2a')](_0x18387d);}return null;};}function patchUpdates(_0x4b2335){return function(_0x26e0bf){try{jsonpatch[_0x3841('0x31')](_0x26e0bf,_0x4b2335,!![]);}catch(_0x398e27){return BPromise[_0x3841('0x32')](_0x398e27);}return _0x26e0bf[_0x3841('0x33')]();};}function saveUpdates(_0x2a385a,_0x3d3586){return function(_0x5d7a16){if(_0x5d7a16){return _0x5d7a16[_0x3841('0x34')](_0x2a385a)[_0x3841('0x1d')](function(_0x1896da){return _0x1896da;});}return null;};}function removeEntity(_0x741e99,_0x5a919e){return function(_0x3ba2bd){if(_0x3ba2bd){return _0x3ba2bd[_0x3841('0x35')]()[_0x3841('0x1d')](function(){_0x741e99[_0x3841('0x28')](0xcc)[_0x3841('0x29')]();});}};}function handleEntityNotFound(_0x2c858d,_0x24b134){return function(_0x4c4fa6){if(!_0x4c4fa6){_0x2c858d['sendStatus'](0x194);}return _0x4c4fa6;};}function handleError(_0x3adb90,_0x1eabdb){_0x1eabdb=_0x1eabdb||0x1f4;return function(_0x586c9f){logger[_0x3841('0x22')](_0x586c9f['stack']);if(_0x586c9f[_0x3841('0x36')]){delete _0x586c9f[_0x3841('0x36')];}_0x3adb90[_0x3841('0x28')](_0x1eabdb)[_0x3841('0x37')](_0x586c9f);};}exports[_0x3841('0x38')]=function(_0x25f14d,_0x30ccb9){var _0x2305d6={},_0x324d3e={},_0x2c3278={'count':0x0,'rows':[]};var _0x4fea90=_[_0x3841('0x39')](db[_0x3841('0x3a')]['rawAttributes'],function(_0x373d01){return{'name':_0x373d01[_0x3841('0x3b')],'type':_0x373d01['type'][_0x3841('0x3c')]};});_0x324d3e[_0x3841('0x3d')]=_[_0x3841('0x39')](_0x4fea90,_0x3841('0x36'));_0x324d3e[_0x3841('0x3e')]=_[_0x3841('0x3f')](_0x25f14d[_0x3841('0x3e')]);_0x324d3e[_0x3841('0x40')]=_[_0x3841('0x41')](_0x324d3e[_0x3841('0x3d')],_0x324d3e[_0x3841('0x3e')]);_0x2305d6[_0x3841('0x42')]=_[_0x3841('0x41')](_0x324d3e[_0x3841('0x3d')],qs['fields'](_0x25f14d[_0x3841('0x3e')][_0x3841('0x43')]));_0x2305d6['attributes']=_0x2305d6['attributes'][_0x3841('0x44')]?_0x2305d6[_0x3841('0x42')]:_0x324d3e[_0x3841('0x3d')];if(!_0x25f14d['query'][_0x3841('0x45')]('nolimit')){_0x2305d6[_0x3841('0x2c')]=qs[_0x3841('0x2c')](_0x25f14d[_0x3841('0x3e')][_0x3841('0x2c')]);_0x2305d6['offset']=qs[_0x3841('0x2e')](_0x25f14d[_0x3841('0x3e')][_0x3841('0x2e')]);}_0x2305d6[_0x3841('0x46')]=qs[_0x3841('0x47')](_0x25f14d[_0x3841('0x3e')]['sort']);_0x2305d6[_0x3841('0x48')]=qs[_0x3841('0x40')](_[_0x3841('0x49')](_0x25f14d[_0x3841('0x3e')],_0x324d3e['filters']),_0x4fea90);if(_0x25f14d[_0x3841('0x3e')][_0x3841('0x4a')]){_0x2305d6[_0x3841('0x48')]=_[_0x3841('0x4b')](_0x2305d6[_0x3841('0x48')],{'$or':_[_0x3841('0x39')](_0x4fea90,function(_0x37383e){if(_0x37383e[_0x3841('0x4c')]!==_0x3841('0x4d')){var _0x2e82ae={};_0x2e82ae[_0x37383e['name']]={'$like':'%'+_0x25f14d[_0x3841('0x3e')]['filter']+'%'};return _0x2e82ae;}})});}_0x2305d6=_[_0x3841('0x4b')]({},_0x2305d6,_0x25f14d['options']);var _0x4d1d94={'where':_0x2305d6[_0x3841('0x48')]};return db[_0x3841('0x3a')]['count'](_0x4d1d94)[_0x3841('0x1d')](function(_0x359de0){_0x2c3278[_0x3841('0x2d')]=_0x359de0;if(_0x25f14d[_0x3841('0x3e')][_0x3841('0x4e')]){_0x2305d6[_0x3841('0x4f')]=[{'all':!![]}];}return db[_0x3841('0x3a')]['findAll'](_0x2305d6);})[_0x3841('0x1d')](function(_0xb54851){_0x2c3278['rows']=_0xb54851;return _0x2c3278;})[_0x3841('0x1d')](respondWithFilteredResult(_0x30ccb9,_0x2305d6))[_0x3841('0x50')](handleError(_0x30ccb9,null));};exports[_0x3841('0x51')]=function(_0x4eb39c,_0x4f4990){var _0x8eef78={'raw':![],'where':{'id':_0x4eb39c['params']['id']}},_0x536042={};_0x536042[_0x3841('0x3d')]=_['keys'](db[_0x3841('0x3a')]['rawAttributes']);_0x536042[_0x3841('0x3e')]=_[_0x3841('0x3f')](_0x4eb39c[_0x3841('0x3e')]);_0x536042[_0x3841('0x40')]=_[_0x3841('0x41')](_0x536042[_0x3841('0x3d')],_0x536042['query']);_0x8eef78['attributes']=_[_0x3841('0x41')](_0x536042[_0x3841('0x3d')],qs['fields'](_0x4eb39c[_0x3841('0x3e')][_0x3841('0x43')]));_0x8eef78[_0x3841('0x42')]=_0x8eef78[_0x3841('0x42')][_0x3841('0x44')]?_0x8eef78['attributes']:_0x536042['model'];if(_0x4eb39c[_0x3841('0x3e')][_0x3841('0x4e')]){_0x8eef78[_0x3841('0x4f')]=[{'all':!![]}];}_0x8eef78=_[_0x3841('0x4b')]({},_0x8eef78,_0x4eb39c[_0x3841('0x52')]);return db[_0x3841('0x3a')][_0x3841('0x53')](_0x8eef78)[_0x3841('0x1d')](handleEntityNotFound(_0x4f4990,null))[_0x3841('0x1d')](respondWithResult(_0x4f4990,null))[_0x3841('0x50')](handleError(_0x4f4990,null));};exports[_0x3841('0x34')]=function(_0x565ad0,_0x358d85){if(_0x565ad0[_0x3841('0x54')]['id']){delete _0x565ad0[_0x3841('0x54')]['id'];}return db[_0x3841('0x3a')][_0x3841('0x53')]({'where':{'id':_0x565ad0['params']['id']}})[_0x3841('0x1d')](handleEntityNotFound(_0x358d85,null))[_0x3841('0x1d')](saveUpdates(_0x565ad0[_0x3841('0x54')],null))['then'](respondWithResult(_0x358d85,null))[_0x3841('0x50')](handleError(_0x358d85,null));};exports['addLogo']=function(_0x83d14c,_0x5625e6,_0x3c3461){if(_0x83d14c[_0x3841('0x55')]&&_0x83d14c[_0x3841('0x55')][_0x3841('0x56')]){_0x83d14c['body']['logo']=_0x83d14c[_0x3841('0x55')]['filename'];}return db[_0x3841('0x3a')][_0x3841('0x53')]({'where':{'id':_0x83d14c['params']['id']}})[_0x3841('0x1d')](handleEntityNotFound(_0x5625e6,null))['then'](saveUpdates(_0x83d14c['body'],null))[_0x3841('0x1d')](respondWithResult(_0x5625e6,null))[_0x3841('0x50')](handleError(_0x5625e6,null));};exports[_0x3841('0x57')]=function(_0x3a6f15,_0xc8d877,_0x9b4e71){if(_0x3a6f15[_0x3841('0x55')]&&_0x3a6f15[_0x3841('0x55')][_0x3841('0x56')]){_0x3a6f15[_0x3841('0x54')][_0x3841('0x58')]=_0x3a6f15[_0x3841('0x55')]['filename'];}return db[_0x3841('0x3a')]['find']({'where':{'id':_0x3a6f15['params']['id']}})[_0x3841('0x1d')](handleEntityNotFound(_0xc8d877,null))['then'](saveUpdates(_0x3a6f15[_0x3841('0x54')],null))[_0x3841('0x1d')](respondWithResult(_0xc8d877,null))['catch'](handleError(_0xc8d877,null));};var utilLicense=require(_0x3841('0x19'));exports[_0x3841('0x59')]=function(_0x5bc3a7,_0x521da0,_0x411913){var _0x4a8448=_0x3841('0x5a');var _0x45cd2e={'custom':![]};return utilLicense[_0x3841('0x5b')]()[_0x3841('0x1d')](function(_0x22d5c9){if(_0x22d5c9){_0x45cd2e=_0x22d5c9;}return db[_0x3841('0x3a')][_0x3841('0x53')]({'where':{'id':_0x5bc3a7[_0x3841('0x5c')]['id']},'attributes':['logo',_0x3841('0x58'),_0x3841('0x5d'),_0x3841('0x5e'),_0x3841('0x5f'),_0x3841('0x60'),_0x3841('0x61'),_0x3841('0x62')],'raw':!![]});})['then'](handleEntityNotFound(_0x521da0,null))[_0x3841('0x1d')](function(_0x156bcd){if(_0x156bcd){var _0x2f3068=_0x156bcd[_0x3841('0x63')]&&fs['existsSync'](path[_0x3841('0x64')](config['root'],_0x4a8448,_[_0x3841('0x65')](_0x156bcd[_0x3841('0x63')])))?path[_0x3841('0x64')](config[_0x3841('0x66')],_0x4a8448,_[_0x3841('0x65')](_0x156bcd['logo'])):path[_0x3841('0x64')](config[_0x3841('0x66')],_0x4a8448,_['toLower'](_0x3841('0x67')));var _0x4a3fee=_0x3841('0x68')+_[_0x3841('0x69')]('logo');if(_0x156bcd[_0x4a3fee]||!_0x45cd2e['custom']){_0x2f3068=path[_0x3841('0x64')](config[_0x3841('0x66')],_0x4a8448,_[_0x3841('0x65')](_0x3841('0x67')));}if(!fs[_0x3841('0x6a')](_0x2f3068)){throw new db['Sequelize'][(_0x3841('0x6b'))](_[_0x3841('0x69')]('logo')+_0x3841('0x6c'));}return _0x521da0['download'](_0x2f3068);}})[_0x3841('0x50')](handleError(_0x521da0,null));};var utilLicense=require(_0x3841('0x19'));exports['getLogoLogin']=function(_0x2c05f9,_0x304216,_0x1da72b){var _0x3b672c=_0x3841('0x5a');var _0x2ca07f={'custom':![]};return utilLicense[_0x3841('0x5b')]()['then'](function(_0x501770){if(_0x501770){_0x2ca07f=_0x501770;}return db[_0x3841('0x3a')]['find']({'where':{'id':_0x2c05f9['params']['id']},'attributes':[_0x3841('0x63'),_0x3841('0x58'),_0x3841('0x5d'),_0x3841('0x5e'),_0x3841('0x5f'),_0x3841('0x60'),_0x3841('0x61'),_0x3841('0x62')],'raw':!![]});})[_0x3841('0x1d')](handleEntityNotFound(_0x304216,null))[_0x3841('0x1d')](function(_0x233da2){if(_0x233da2){var _0x52840e=_0x233da2[_0x3841('0x58')]&&fs[_0x3841('0x6a')](path[_0x3841('0x64')](config['root'],_0x3b672c,_[_0x3841('0x65')](_0x233da2[_0x3841('0x58')])))?path[_0x3841('0x64')](config['root'],_0x3b672c,_[_0x3841('0x65')](_0x233da2[_0x3841('0x58')])):path['join'](config[_0x3841('0x66')],_0x3b672c,_[_0x3841('0x65')](_0x3841('0x6d')));var _0x149b92='default'+_[_0x3841('0x69')](_0x3841('0x58'));if(_0x233da2[_0x149b92]||!_0x2ca07f[_0x3841('0x6e')]){_0x52840e=path[_0x3841('0x64')](config[_0x3841('0x66')],_0x3b672c,_[_0x3841('0x65')](_0x3841('0x6d')));}if(!fs['existsSync'](_0x52840e)){throw new db['Sequelize'][(_0x3841('0x6b'))](_[_0x3841('0x69')](_0x3841('0x58'))+_0x3841('0x6c'));}return _0x304216[_0x3841('0x6f')](_0x52840e);}})['catch'](handleError(_0x304216,null));};exports[_0x3841('0x70')]=function(_0x1346cb,_0x37f7e4){return db[_0x3841('0x3a')][_0x3841('0x53')]({'where':{'id':_0x1346cb[_0x3841('0x5c')]['id']},'attributes':[_0x3841('0x71')]})[_0x3841('0x1d')](respondWithResult(_0x37f7e4,null))['catch'](handleError(_0x37f7e4,null));};exports['addPreferred']=function(_0x2154ff,_0xeb0cd,_0x247b9c){if(_0x2154ff[_0x3841('0x55')]&&_0x2154ff[_0x3841('0x55')][_0x3841('0x56')]){_0x2154ff['body']['preferred']=_0x2154ff['file']['filename'];}return db[_0x3841('0x3a')][_0x3841('0x53')]({'where':{'id':_0x2154ff[_0x3841('0x5c')]['id']}})[_0x3841('0x1d')](handleEntityNotFound(_0xeb0cd,null))[_0x3841('0x1d')](saveUpdates(_0x2154ff[_0x3841('0x54')],null))[_0x3841('0x1d')](respondWithResult(_0xeb0cd,null))[_0x3841('0x50')](handleError(_0xeb0cd,null));};var utilLicense=require(_0x3841('0x19'));exports[_0x3841('0x72')]=function(_0x5bd926,_0x212eed,_0x4f3efa){var _0x242918=_0x3841('0x5a');var _0x1dc563={'custom':![]};return utilLicense['getLicense']()[_0x3841('0x1d')](function(_0x49d91b){if(_0x49d91b){_0x1dc563=_0x49d91b;}return db[_0x3841('0x3a')]['find']({'where':{'id':_0x5bd926['params']['id']},'attributes':['logo',_0x3841('0x58'),_0x3841('0x5d'),'favicon','defaultLogo',_0x3841('0x60'),_0x3841('0x61'),_0x3841('0x62')],'raw':!![]});})[_0x3841('0x1d')](handleEntityNotFound(_0x212eed,null))[_0x3841('0x1d')](function(_0x613e0d){if(_0x613e0d){var _0x4fac5f=_0x613e0d[_0x3841('0x5d')]&&fs['existsSync'](path[_0x3841('0x64')](config[_0x3841('0x66')],_0x242918,_[_0x3841('0x65')](_0x613e0d[_0x3841('0x5d')])))?path[_0x3841('0x64')](config[_0x3841('0x66')],_0x242918,_[_0x3841('0x65')](_0x613e0d[_0x3841('0x5d')])):path[_0x3841('0x64')](config[_0x3841('0x66')],_0x242918,_['toLower'](_0x3841('0x73')));var _0x42e8b7='default'+_[_0x3841('0x69')](_0x3841('0x5d'));if(_0x613e0d[_0x42e8b7]||!_0x1dc563['custom']||!_0x1dc563['preferred']){_0x4fac5f=path[_0x3841('0x64')](config['root'],_0x242918,_[_0x3841('0x65')](_0x3841('0x73')));}if(!fs['existsSync'](_0x4fac5f)){throw new db['Sequelize'][(_0x3841('0x6b'))](_[_0x3841('0x69')]('preferred')+'\x20not\x20found');}return _0x212eed[_0x3841('0x6f')](_0x4fac5f);}})[_0x3841('0x50')](handleError(_0x212eed,null));};exports[_0x3841('0x74')]=function(_0x500b8c,_0x4f5bf4,_0x5ac7f4){if(_0x500b8c['file']&&_0x500b8c[_0x3841('0x55')][_0x3841('0x56')]){_0x500b8c[_0x3841('0x54')][_0x3841('0x5e')]=_0x500b8c[_0x3841('0x55')]['filename'];}return db[_0x3841('0x3a')][_0x3841('0x53')]({'where':{'id':_0x500b8c[_0x3841('0x5c')]['id']}})[_0x3841('0x1d')](handleEntityNotFound(_0x4f5bf4,null))[_0x3841('0x1d')](saveUpdates(_0x500b8c[_0x3841('0x54')],null))['then'](respondWithResult(_0x4f5bf4,null))[_0x3841('0x50')](handleError(_0x4f5bf4,null));};var utilLicense=require('../../config/license/util');exports['getFavicon']=function(_0x152a47,_0x9ed367,_0xf3471a){var _0x30ada7=_0x3841('0x5a');var _0xadefe3={'custom':![]};return utilLicense[_0x3841('0x5b')]()['then'](function(_0x203244){if(_0x203244){_0xadefe3=_0x203244;}return db['Setting']['find']({'where':{'id':_0x152a47['params']['id']},'attributes':['logo',_0x3841('0x58'),_0x3841('0x5d'),'favicon',_0x3841('0x5f'),_0x3841('0x60'),_0x3841('0x61'),_0x3841('0x62')],'raw':!![]});})[_0x3841('0x1d')](handleEntityNotFound(_0x9ed367,null))[_0x3841('0x1d')](function(_0x4e80a5){if(_0x4e80a5){var _0x3bf4d1=_0x4e80a5[_0x3841('0x5e')]&&fs[_0x3841('0x6a')](path[_0x3841('0x64')](config['root'],_0x30ada7,_[_0x3841('0x65')](_0x4e80a5[_0x3841('0x5e')])))?path[_0x3841('0x64')](config[_0x3841('0x66')],_0x30ada7,_[_0x3841('0x65')](_0x4e80a5[_0x3841('0x5e')])):path[_0x3841('0x64')](config['root'],_0x30ada7,_['toLower'](_0x3841('0x75')));var _0x3094fb=_0x3841('0x68')+_['upperFirst'](_0x3841('0x5e'));if(_0x4e80a5[_0x3094fb]||!_0xadefe3[_0x3841('0x6e')]){_0x3bf4d1=path[_0x3841('0x64')](config[_0x3841('0x66')],_0x30ada7,_[_0x3841('0x65')](_0x3841('0x75')));}if(!fs[_0x3841('0x6a')](_0x3bf4d1)){throw new db[(_0x3841('0x76'))][(_0x3841('0x6b'))](_[_0x3841('0x69')](_0x3841('0x5e'))+'\x20not\x20found');}return _0x9ed367[_0x3841('0x6f')](_0x3bf4d1);}})[_0x3841('0x50')](handleError(_0x9ed367,null));};exports[_0x3841('0x77')]=function(_0x463679,_0x57b313){var _0x5a1d79={'offset':moment()[_0x3841('0x78')]()};_0x5a1d79['now']=moment()[_0x3841('0x78')](_0x5a1d79[_0x3841('0x2e')])[_0x3841('0x79')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x57b313['status'](0xc8)[_0x3841('0x37')](_0x5a1d79);}; \ No newline at end of file +var _0x8a13=['error','code','message','result','sendStatus','status','json','offset','undefined','limit','count','apply','save','update','end','stack','name','send','index','map','Setting','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','options','includeAll','include','rows','catch','show','body','find','file','filename','logo','params','addLogoLogin','loginLogo','../../config/license/util','getLogo','server/files/images/logos','getLicense','preferred','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','upperFirst','ValidationError','\x20not\x20found','download','getLogoLogin','default_loginLogo.svg','default','custom','Sequelize','gdpr','securePassword','addPreferred','default_preferred.png','addFavicon','getFavicon','favicon','default_favicon.ico','getDate','now','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x263fcc,_0x38c118){var _0x25a0a1=function(_0x5af6b2){while(--_0x5af6b2){_0x263fcc['push'](_0x263fcc['shift']());}};_0x25a0a1(++_0x38c118);}(_0x8a13,0xd6));var _0x38a1=function(_0x53f0db,_0x35c67c){_0x53f0db=_0x53f0db-0x0;var _0xae0a5c=_0x8a13[_0x53f0db];return _0xae0a5c;};'use strict';var emlformat=require(_0x38a1('0x0'));var rimraf=require(_0x38a1('0x1'));var zipdir=require(_0x38a1('0x2'));var jsonpatch=require(_0x38a1('0x3'));var rp=require(_0x38a1('0x4'));var moment=require(_0x38a1('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x38a1('0x6'));var util=require(_0x38a1('0x7'));var path=require(_0x38a1('0x8'));var sox=require(_0x38a1('0x9'));var csv=require(_0x38a1('0xa'));var ejs=require(_0x38a1('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x38a1('0xc'));var crypto=require(_0x38a1('0xd'));var jsforce=require(_0x38a1('0xe'));var deskjs=require(_0x38a1('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x38a1('0x10'));var Redis=require('ioredis');var authService=require(_0x38a1('0x11'));var qs=require(_0x38a1('0x12'));var as=require(_0x38a1('0x13'));var hardwareService=require(_0x38a1('0x14'));var logger=require(_0x38a1('0x15'))(_0x38a1('0x16'));var utils=require(_0x38a1('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x38a1('0x18'))['db'];var jayson=require(_0x38a1('0x19'));var client=jayson[_0x38a1('0x1a')][_0x38a1('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x3f2bba,_0x9278d,_0x339d87,_0x31eb8d){return new BPromise(function(_0x507b7d,_0x3fd09d){var _0x24fa88=_0x31eb8d||client;return _0x24fa88[_0x38a1('0x1c')](_0x3f2bba,_0x339d87)[_0x38a1('0x1d')](function(_0x382938){logger[_0x38a1('0x1e')](_0x38a1('0x1f'),_0x9278d,'request\x20sent');logger[_0x38a1('0x20')](_0x38a1('0x21'),_0x9278d,_0x38a1('0x22'),JSON[_0x38a1('0x23')](_0x382938));if(_0x382938[_0x38a1('0x24')]){if(_0x382938[_0x38a1('0x24')][_0x38a1('0x25')]===0x1f4){logger[_0x38a1('0x24')](_0x38a1('0x1f'),_0x9278d,_0x382938['error'][_0x38a1('0x26')]);return _0x3fd09d(_0x382938[_0x38a1('0x24')][_0x38a1('0x26')]);}logger[_0x38a1('0x24')](_0x38a1('0x1f'),_0x9278d,_0x382938[_0x38a1('0x24')]['message']);return _0x507b7d(_0x382938[_0x38a1('0x24')][_0x38a1('0x26')]);}else{logger['info'](_0x38a1('0x1f'),_0x9278d,'request\x20sent');_0x507b7d(_0x382938[_0x38a1('0x27')]['message']);}})['catch'](function(_0x10a4ca){logger[_0x38a1('0x24')](_0x38a1('0x1f'),_0x9278d,_0x10a4ca);_0x3fd09d(_0x10a4ca);});});}function respondWithStatusCode(_0x4d3dcc,_0x5a0f18){_0x5a0f18=_0x5a0f18||0xcc;return function(_0x56b8a7){if(_0x56b8a7){return _0x4d3dcc[_0x38a1('0x28')](_0x5a0f18);}return _0x4d3dcc[_0x38a1('0x29')](_0x5a0f18)['end']();};}function respondWithResult(_0x325d6d,_0x1d15e1){_0x1d15e1=_0x1d15e1||0xc8;return function(_0x34737c){if(_0x34737c){return _0x325d6d['status'](_0x1d15e1)[_0x38a1('0x2a')](_0x34737c);}};}function respondWithFilteredResult(_0x5469d1,_0x147b56){return function(_0x870241){if(_0x870241){var _0x11c95c=typeof _0x147b56[_0x38a1('0x2b')]===_0x38a1('0x2c')&&typeof _0x147b56[_0x38a1('0x2d')]===_0x38a1('0x2c');var _0x587db1=_0x870241[_0x38a1('0x2e')];var _0x2ed540=_0x11c95c?0x0:_0x147b56[_0x38a1('0x2b')];var _0x4da6cd=_0x11c95c?_0x870241[_0x38a1('0x2e')]:_0x147b56[_0x38a1('0x2b')]+_0x147b56[_0x38a1('0x2d')];var _0x6ecdb3;if(_0x4da6cd>=_0x587db1){_0x4da6cd=_0x587db1;_0x6ecdb3=0xc8;}else{_0x6ecdb3=0xce;}_0x5469d1['status'](_0x6ecdb3);return _0x5469d1['set']('Content-Range',_0x2ed540+'-'+_0x4da6cd+'/'+_0x587db1)[_0x38a1('0x2a')](_0x870241);}return null;};}function patchUpdates(_0xcf853c){return function(_0x3972fe){try{jsonpatch[_0x38a1('0x2f')](_0x3972fe,_0xcf853c,!![]);}catch(_0x40b793){return BPromise['reject'](_0x40b793);}return _0x3972fe[_0x38a1('0x30')]();};}function saveUpdates(_0x274155,_0x513cbc){return function(_0x27cf25){if(_0x27cf25){return _0x27cf25[_0x38a1('0x31')](_0x274155)[_0x38a1('0x1d')](function(_0x36f70f){return _0x36f70f;});}return null;};}function removeEntity(_0x35302f,_0x57c3c5){return function(_0x5b8bd0){if(_0x5b8bd0){return _0x5b8bd0['destroy']()[_0x38a1('0x1d')](function(){_0x35302f[_0x38a1('0x29')](0xcc)[_0x38a1('0x32')]();});}};}function handleEntityNotFound(_0x331f30,_0x2a9c38){return function(_0x7f0441){if(!_0x7f0441){_0x331f30['sendStatus'](0x194);}return _0x7f0441;};}function handleError(_0x276153,_0x58ebd4){_0x58ebd4=_0x58ebd4||0x1f4;return function(_0x26baff){logger['error'](_0x26baff[_0x38a1('0x33')]);if(_0x26baff[_0x38a1('0x34')]){delete _0x26baff[_0x38a1('0x34')];}_0x276153['status'](_0x58ebd4)[_0x38a1('0x35')](_0x26baff);};}exports[_0x38a1('0x36')]=function(_0x2881cb,_0x2f26e3){var _0x271473={},_0x4eb0ee={},_0x306ac1={'count':0x0,'rows':[]};var _0x470972=_[_0x38a1('0x37')](db[_0x38a1('0x38')][_0x38a1('0x39')],function(_0x5aebc9){return{'name':_0x5aebc9[_0x38a1('0x3a')],'type':_0x5aebc9[_0x38a1('0x3b')][_0x38a1('0x3c')]};});_0x4eb0ee[_0x38a1('0x3d')]=_['map'](_0x470972,'name');_0x4eb0ee[_0x38a1('0x3e')]=_[_0x38a1('0x3f')](_0x2881cb['query']);_0x4eb0ee['filters']=_['intersection'](_0x4eb0ee['model'],_0x4eb0ee[_0x38a1('0x3e')]);_0x271473[_0x38a1('0x40')]=_[_0x38a1('0x41')](_0x4eb0ee['model'],qs[_0x38a1('0x42')](_0x2881cb[_0x38a1('0x3e')][_0x38a1('0x42')]));_0x271473['attributes']=_0x271473[_0x38a1('0x40')][_0x38a1('0x43')]?_0x271473['attributes']:_0x4eb0ee['model'];if(!_0x2881cb[_0x38a1('0x3e')][_0x38a1('0x44')](_0x38a1('0x45'))){_0x271473[_0x38a1('0x2d')]=qs[_0x38a1('0x2d')](_0x2881cb[_0x38a1('0x3e')][_0x38a1('0x2d')]);_0x271473[_0x38a1('0x2b')]=qs['offset'](_0x2881cb[_0x38a1('0x3e')][_0x38a1('0x2b')]);}_0x271473[_0x38a1('0x46')]=qs[_0x38a1('0x47')](_0x2881cb[_0x38a1('0x3e')][_0x38a1('0x47')]);_0x271473[_0x38a1('0x48')]=qs[_0x38a1('0x49')](_['pick'](_0x2881cb['query'],_0x4eb0ee[_0x38a1('0x49')]),_0x470972);if(_0x2881cb[_0x38a1('0x3e')][_0x38a1('0x4a')]){_0x271473['where']=_['merge'](_0x271473[_0x38a1('0x48')],{'$or':_['map'](_0x470972,function(_0x2b5694){if(_0x2b5694[_0x38a1('0x3b')]!=='VIRTUAL'){var _0x58d4b4={};_0x58d4b4[_0x2b5694[_0x38a1('0x34')]]={'$like':'%'+_0x2881cb['query'][_0x38a1('0x4a')]+'%'};return _0x58d4b4;}})});}_0x271473=_['merge']({},_0x271473,_0x2881cb[_0x38a1('0x4b')]);var _0x4db067={'where':_0x271473[_0x38a1('0x48')]};return db[_0x38a1('0x38')]['count'](_0x4db067)[_0x38a1('0x1d')](function(_0x40cb14){_0x306ac1['count']=_0x40cb14;if(_0x2881cb[_0x38a1('0x3e')][_0x38a1('0x4c')]){_0x271473[_0x38a1('0x4d')]=[{'all':!![]}];}return db[_0x38a1('0x38')]['findAll'](_0x271473);})[_0x38a1('0x1d')](function(_0x481dd7){_0x306ac1[_0x38a1('0x4e')]=_0x481dd7;return _0x306ac1;})[_0x38a1('0x1d')](respondWithFilteredResult(_0x2f26e3,_0x271473))[_0x38a1('0x4f')](handleError(_0x2f26e3,null));};exports[_0x38a1('0x50')]=function(_0x283d63,_0x28f33f){var _0x500c61={'raw':![],'where':{'id':_0x283d63['params']['id']}},_0xa946a1={};_0xa946a1[_0x38a1('0x3d')]=_[_0x38a1('0x3f')](db['Setting'][_0x38a1('0x39')]);_0xa946a1[_0x38a1('0x3e')]=_['keys'](_0x283d63['query']);_0xa946a1[_0x38a1('0x49')]=_[_0x38a1('0x41')](_0xa946a1['model'],_0xa946a1['query']);_0x500c61[_0x38a1('0x40')]=_[_0x38a1('0x41')](_0xa946a1[_0x38a1('0x3d')],qs[_0x38a1('0x42')](_0x283d63[_0x38a1('0x3e')][_0x38a1('0x42')]));_0x500c61[_0x38a1('0x40')]=_0x500c61[_0x38a1('0x40')][_0x38a1('0x43')]?_0x500c61[_0x38a1('0x40')]:_0xa946a1[_0x38a1('0x3d')];if(_0x283d63[_0x38a1('0x3e')][_0x38a1('0x4c')]){_0x500c61['include']=[{'all':!![]}];}_0x500c61=_['merge']({},_0x500c61,_0x283d63[_0x38a1('0x4b')]);return db[_0x38a1('0x38')]['find'](_0x500c61)[_0x38a1('0x1d')](handleEntityNotFound(_0x28f33f,null))['then'](respondWithResult(_0x28f33f,null))[_0x38a1('0x4f')](handleError(_0x28f33f,null));};exports[_0x38a1('0x31')]=function(_0x3e8cc6,_0x5c1589){if(_0x3e8cc6[_0x38a1('0x51')]['id']){delete _0x3e8cc6[_0x38a1('0x51')]['id'];}return db[_0x38a1('0x38')][_0x38a1('0x52')]({'where':{'id':_0x3e8cc6['params']['id']}})[_0x38a1('0x1d')](handleEntityNotFound(_0x5c1589,null))[_0x38a1('0x1d')](saveUpdates(_0x3e8cc6['body'],null))[_0x38a1('0x1d')](respondWithResult(_0x5c1589,null))[_0x38a1('0x4f')](handleError(_0x5c1589,null));};exports['addLogo']=function(_0x4153ef,_0x401e69,_0xf573cd){if(_0x4153ef[_0x38a1('0x53')]&&_0x4153ef['file'][_0x38a1('0x54')]){_0x4153ef[_0x38a1('0x51')][_0x38a1('0x55')]=_0x4153ef[_0x38a1('0x53')]['filename'];}return db['Setting']['find']({'where':{'id':_0x4153ef[_0x38a1('0x56')]['id']}})[_0x38a1('0x1d')](handleEntityNotFound(_0x401e69,null))[_0x38a1('0x1d')](saveUpdates(_0x4153ef[_0x38a1('0x51')],null))['then'](respondWithResult(_0x401e69,null))[_0x38a1('0x4f')](handleError(_0x401e69,null));};exports[_0x38a1('0x57')]=function(_0x1e99ed,_0x4001c,_0xa4ec6e){if(_0x1e99ed[_0x38a1('0x53')]&&_0x1e99ed[_0x38a1('0x53')][_0x38a1('0x54')]){_0x1e99ed[_0x38a1('0x51')][_0x38a1('0x58')]=_0x1e99ed[_0x38a1('0x53')][_0x38a1('0x54')];}return db['Setting'][_0x38a1('0x52')]({'where':{'id':_0x1e99ed[_0x38a1('0x56')]['id']}})[_0x38a1('0x1d')](handleEntityNotFound(_0x4001c,null))[_0x38a1('0x1d')](saveUpdates(_0x1e99ed['body'],null))['then'](respondWithResult(_0x4001c,null))['catch'](handleError(_0x4001c,null));};var utilLicense=require(_0x38a1('0x59'));exports[_0x38a1('0x5a')]=function(_0x3c3d2d,_0x124f13,_0x41452e){var _0x2e8254=_0x38a1('0x5b');var _0x4d78eb={'custom':![]};return utilLicense[_0x38a1('0x5c')]()[_0x38a1('0x1d')](function(_0x367e14){if(_0x367e14){_0x4d78eb=_0x367e14;}return db[_0x38a1('0x38')][_0x38a1('0x52')]({'where':{'id':_0x3c3d2d['params']['id']},'attributes':[_0x38a1('0x55'),_0x38a1('0x58'),_0x38a1('0x5d'),'favicon',_0x38a1('0x5e'),_0x38a1('0x5f'),_0x38a1('0x60'),_0x38a1('0x61')],'raw':!![]});})[_0x38a1('0x1d')](handleEntityNotFound(_0x124f13,null))[_0x38a1('0x1d')](function(_0x565e60){if(_0x565e60){var _0x42971f=_0x565e60[_0x38a1('0x55')]&&fs[_0x38a1('0x62')](path[_0x38a1('0x63')](config[_0x38a1('0x64')],_0x2e8254,_['toLower'](_0x565e60['logo'])))?path[_0x38a1('0x63')](config[_0x38a1('0x64')],_0x2e8254,_[_0x38a1('0x65')](_0x565e60['logo'])):path[_0x38a1('0x63')](config[_0x38a1('0x64')],_0x2e8254,_['toLower'](_0x38a1('0x66')));var _0x463225='default'+_[_0x38a1('0x67')]('logo');if(_0x565e60[_0x463225]||!_0x4d78eb['custom']){_0x42971f=path[_0x38a1('0x63')](config[_0x38a1('0x64')],_0x2e8254,_['toLower'](_0x38a1('0x66')));}if(!fs[_0x38a1('0x62')](_0x42971f)){throw new db['Sequelize'][(_0x38a1('0x68'))](_[_0x38a1('0x67')]('logo')+_0x38a1('0x69'));}return _0x124f13[_0x38a1('0x6a')](_0x42971f);}})[_0x38a1('0x4f')](handleError(_0x124f13,null));};var utilLicense=require(_0x38a1('0x59'));exports[_0x38a1('0x6b')]=function(_0x5f4a1c,_0x3544dc,_0x59539a){var _0x2b5fe1='server/files/images/logos';var _0x2e876b={'custom':![]};return utilLicense[_0x38a1('0x5c')]()['then'](function(_0x2a0e5b){if(_0x2a0e5b){_0x2e876b=_0x2a0e5b;}return db['Setting'][_0x38a1('0x52')]({'where':{'id':_0x5f4a1c[_0x38a1('0x56')]['id']},'attributes':[_0x38a1('0x55'),'loginLogo','preferred','favicon',_0x38a1('0x5e'),'defaultLoginLogo',_0x38a1('0x60'),_0x38a1('0x61')],'raw':!![]});})[_0x38a1('0x1d')](handleEntityNotFound(_0x3544dc,null))[_0x38a1('0x1d')](function(_0x170ff1){if(_0x170ff1){var _0x7aeea6=_0x170ff1[_0x38a1('0x58')]&&fs[_0x38a1('0x62')](path[_0x38a1('0x63')](config['root'],_0x2b5fe1,_[_0x38a1('0x65')](_0x170ff1[_0x38a1('0x58')])))?path[_0x38a1('0x63')](config['root'],_0x2b5fe1,_['toLower'](_0x170ff1[_0x38a1('0x58')])):path[_0x38a1('0x63')](config[_0x38a1('0x64')],_0x2b5fe1,_[_0x38a1('0x65')](_0x38a1('0x6c')));var _0x175282=_0x38a1('0x6d')+_[_0x38a1('0x67')](_0x38a1('0x58'));if(_0x170ff1[_0x175282]||!_0x2e876b[_0x38a1('0x6e')]){_0x7aeea6=path[_0x38a1('0x63')](config[_0x38a1('0x64')],_0x2b5fe1,_[_0x38a1('0x65')](_0x38a1('0x6c')));}if(!fs['existsSync'](_0x7aeea6)){throw new db[(_0x38a1('0x6f'))][(_0x38a1('0x68'))](_[_0x38a1('0x67')]('loginLogo')+'\x20not\x20found');}return _0x3544dc[_0x38a1('0x6a')](_0x7aeea6);}})[_0x38a1('0x4f')](handleError(_0x3544dc,null));};exports[_0x38a1('0x70')]=function(_0x1e8496,_0x58ec41){return db[_0x38a1('0x38')][_0x38a1('0x52')]({'where':{'id':_0x1e8496['params']['id']},'attributes':[_0x38a1('0x71')]})['then'](respondWithResult(_0x58ec41,null))['catch'](handleError(_0x58ec41,null));};exports[_0x38a1('0x72')]=function(_0x1fdc13,_0x38f9ca,_0x530b75){if(_0x1fdc13['file']&&_0x1fdc13['file'][_0x38a1('0x54')]){_0x1fdc13['body'][_0x38a1('0x5d')]=_0x1fdc13[_0x38a1('0x53')][_0x38a1('0x54')];}return db[_0x38a1('0x38')][_0x38a1('0x52')]({'where':{'id':_0x1fdc13['params']['id']}})[_0x38a1('0x1d')](handleEntityNotFound(_0x38f9ca,null))[_0x38a1('0x1d')](saveUpdates(_0x1fdc13[_0x38a1('0x51')],null))[_0x38a1('0x1d')](respondWithResult(_0x38f9ca,null))[_0x38a1('0x4f')](handleError(_0x38f9ca,null));};var utilLicense=require(_0x38a1('0x59'));exports['getPreferred']=function(_0x726796,_0x12051f,_0x5e0792){var _0x17334b=_0x38a1('0x5b');var _0x12ae6c={'custom':![]};return utilLicense[_0x38a1('0x5c')]()['then'](function(_0x17d0d2){if(_0x17d0d2){_0x12ae6c=_0x17d0d2;}return db[_0x38a1('0x38')][_0x38a1('0x52')]({'where':{'id':_0x726796[_0x38a1('0x56')]['id']},'attributes':[_0x38a1('0x55'),'loginLogo',_0x38a1('0x5d'),'favicon',_0x38a1('0x5e'),'defaultLoginLogo','defaultPreferred',_0x38a1('0x61')],'raw':!![]});})['then'](handleEntityNotFound(_0x12051f,null))[_0x38a1('0x1d')](function(_0x46c419){if(_0x46c419){var _0x417395=_0x46c419[_0x38a1('0x5d')]&&fs['existsSync'](path['join'](config[_0x38a1('0x64')],_0x17334b,_['toLower'](_0x46c419[_0x38a1('0x5d')])))?path[_0x38a1('0x63')](config[_0x38a1('0x64')],_0x17334b,_[_0x38a1('0x65')](_0x46c419[_0x38a1('0x5d')])):path[_0x38a1('0x63')](config[_0x38a1('0x64')],_0x17334b,_[_0x38a1('0x65')](_0x38a1('0x73')));var _0xcd73e3=_0x38a1('0x6d')+_['upperFirst'](_0x38a1('0x5d'));if(_0x46c419[_0xcd73e3]||!_0x12ae6c[_0x38a1('0x6e')]||!_0x12ae6c[_0x38a1('0x5d')]){_0x417395=path[_0x38a1('0x63')](config['root'],_0x17334b,_[_0x38a1('0x65')]('default_preferred.png'));}if(!fs['existsSync'](_0x417395)){throw new db[(_0x38a1('0x6f'))][(_0x38a1('0x68'))](_[_0x38a1('0x67')](_0x38a1('0x5d'))+_0x38a1('0x69'));}return _0x12051f[_0x38a1('0x6a')](_0x417395);}})[_0x38a1('0x4f')](handleError(_0x12051f,null));};exports[_0x38a1('0x74')]=function(_0x52b0d7,_0x15c027,_0xc05a0c){if(_0x52b0d7[_0x38a1('0x53')]&&_0x52b0d7[_0x38a1('0x53')]['filename']){_0x52b0d7[_0x38a1('0x51')]['favicon']=_0x52b0d7[_0x38a1('0x53')][_0x38a1('0x54')];}return db[_0x38a1('0x38')]['find']({'where':{'id':_0x52b0d7[_0x38a1('0x56')]['id']}})[_0x38a1('0x1d')](handleEntityNotFound(_0x15c027,null))[_0x38a1('0x1d')](saveUpdates(_0x52b0d7['body'],null))[_0x38a1('0x1d')](respondWithResult(_0x15c027,null))[_0x38a1('0x4f')](handleError(_0x15c027,null));};var utilLicense=require(_0x38a1('0x59'));exports[_0x38a1('0x75')]=function(_0xcbfd02,_0x4dbdc9,_0x10d584){var _0x6324c7='server/files/images/logos';var _0x5653ef={'custom':![]};return utilLicense[_0x38a1('0x5c')]()['then'](function(_0x1480af){if(_0x1480af){_0x5653ef=_0x1480af;}return db[_0x38a1('0x38')]['find']({'where':{'id':_0xcbfd02[_0x38a1('0x56')]['id']},'attributes':['logo',_0x38a1('0x58'),_0x38a1('0x5d'),'favicon',_0x38a1('0x5e'),_0x38a1('0x5f'),_0x38a1('0x60'),_0x38a1('0x61')],'raw':!![]});})[_0x38a1('0x1d')](handleEntityNotFound(_0x4dbdc9,null))[_0x38a1('0x1d')](function(_0x522af4){if(_0x522af4){var _0x32239c=_0x522af4[_0x38a1('0x76')]&&fs[_0x38a1('0x62')](path[_0x38a1('0x63')](config['root'],_0x6324c7,_[_0x38a1('0x65')](_0x522af4[_0x38a1('0x76')])))?path['join'](config[_0x38a1('0x64')],_0x6324c7,_[_0x38a1('0x65')](_0x522af4['favicon'])):path['join'](config[_0x38a1('0x64')],_0x6324c7,_[_0x38a1('0x65')](_0x38a1('0x77')));var _0x54f7ee=_0x38a1('0x6d')+_[_0x38a1('0x67')](_0x38a1('0x76'));if(_0x522af4[_0x54f7ee]||!_0x5653ef['custom']){_0x32239c=path['join'](config['root'],_0x6324c7,_[_0x38a1('0x65')](_0x38a1('0x77')));}if(!fs['existsSync'](_0x32239c)){throw new db['Sequelize']['ValidationError'](_[_0x38a1('0x67')](_0x38a1('0x76'))+'\x20not\x20found');}return _0x4dbdc9[_0x38a1('0x6a')](_0x32239c);}})[_0x38a1('0x4f')](handleError(_0x4dbdc9,null));};exports[_0x38a1('0x78')]=function(_0x26aac7,_0x3c518c){var _0x6b1260={'offset':moment()['utcOffset']()};_0x6b1260[_0x38a1('0x79')]=moment()[_0x38a1('0x7a')](_0x6b1260[_0x38a1('0x2b')])[_0x38a1('0x7b')](_0x38a1('0x7c'));return _0x3c518c[_0x38a1('0x29')](0xc8)['send'](_0x6b1260);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 8a9b725..8244379 100644 --- a/server/api/setting/setting.model.js +++ b/server/api/setting/setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['define','settings','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports'];(function(_0xcc3caf,_0x11800f){var _0x5d1173=function(_0x398db1){while(--_0x398db1){_0xcc3caf['push'](_0xcc3caf['shift']());}};_0x5d1173(++_0x11800f);}(_0x008c,0x188));var _0xc008=function(_0x49e66,_0x43f4b9){_0x49e66=_0x49e66-0x0;var _0x545549=_0x008c[_0x49e66];return _0x545549;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('Setting',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Setting','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./setting.attributes'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 291ac2c..cb8e2e2 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 _0x0fc8=['map','model','attributes','then','catch','lodash','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','client','http','request','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ShowSetting','Setting','find','options','raw','where','include'];(function(_0x795db4,_0x30eb2c){var _0x1cc503=function(_0x2baeb9){while(--_0x2baeb9){_0x795db4['push'](_0x795db4['shift']());}};_0x1cc503(++_0x30eb2c);}(_0x0fc8,0x1c5));var _0x80fc=function(_0x4d8f02,_0x10b286){_0x4d8f02=_0x4d8f02-0x0;var _0x3883b5=_0x0fc8[_0x4d8f02];return _0x3883b5;};'use strict';var _=require(_0x80fc('0x0'));var util=require('util');var moment=require(_0x80fc('0x1'));var BPromise=require(_0x80fc('0x2'));var rs=require(_0x80fc('0x3'));var fs=require('fs');var Redis=require(_0x80fc('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x80fc('0x5'));var config=require(_0x80fc('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x80fc('0x7')][_0x80fc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x579e8d,_0x32795c,_0x81b99d){return new BPromise(function(_0x569ce2,_0x452b95){return client[_0x80fc('0x9')](_0x579e8d,_0x81b99d)['then'](function(_0x1536fa){logger[_0x80fc('0xa')](_0x80fc('0xb'),_0x32795c,_0x80fc('0xc'));logger[_0x80fc('0xd')](_0x80fc('0xe'),_0x32795c,_0x80fc('0xc'),JSON[_0x80fc('0xf')](_0x1536fa));if(_0x1536fa[_0x80fc('0x10')]){if(_0x1536fa[_0x80fc('0x10')][_0x80fc('0x11')]===0x1f4){logger[_0x80fc('0x10')](_0x80fc('0xb'),_0x32795c,_0x1536fa[_0x80fc('0x10')]['message']);return _0x452b95(_0x1536fa[_0x80fc('0x10')]['message']);}logger[_0x80fc('0x10')](_0x80fc('0xb'),_0x32795c,_0x1536fa['error'][_0x80fc('0x12')]);return _0x569ce2(_0x1536fa[_0x80fc('0x10')]['message']);}else{logger[_0x80fc('0xa')](_0x80fc('0xb'),_0x32795c,'request\x20sent');_0x569ce2(_0x1536fa[_0x80fc('0x13')]['message']);}})['catch'](function(_0x2c0729){logger['error']('Setting,\x20%s,\x20%s',_0x32795c,_0x2c0729);_0x452b95(_0x2c0729);});});}exports[_0x80fc('0x14')]=function(_0x11ec75){var _0x434d10=this;return new Promise(function(_0x203abe,_0x10ca10){return db[_0x80fc('0x15')][_0x80fc('0x16')]({'raw':_0x11ec75[_0x80fc('0x17')]?_0x11ec75[_0x80fc('0x17')][_0x80fc('0x18')]===undefined?!![]:![]:!![],'where':_0x11ec75[_0x80fc('0x17')]?_0x11ec75[_0x80fc('0x17')][_0x80fc('0x19')]||null:null,'attributes':_0x11ec75['options']?_0x11ec75['options']['attributes']||null:null,'include':_0x11ec75[_0x80fc('0x17')]?_0x11ec75[_0x80fc('0x17')][_0x80fc('0x1a')]?_[_0x80fc('0x1b')](_0x11ec75[_0x80fc('0x17')][_0x80fc('0x1a')],function(_0x5f0053){return{'model':db[_0x5f0053[_0x80fc('0x1c')]],'as':_0x5f0053['as'],'attributes':_0x5f0053[_0x80fc('0x1d')],'include':_0x5f0053['include']?_[_0x80fc('0x1b')](_0x5f0053[_0x80fc('0x1a')],function(_0x55bbdf){return{'model':db[_0x55bbdf[_0x80fc('0x1c')]],'as':_0x55bbdf['as'],'attributes':_0x55bbdf[_0x80fc('0x1d')],'include':_0x55bbdf[_0x80fc('0x1a')]?_[_0x80fc('0x1b')](_0x55bbdf[_0x80fc('0x1a')],function(_0x48cb48){return{'model':db[_0x48cb48[_0x80fc('0x1c')]],'as':_0x48cb48['as'],'attributes':_0x48cb48[_0x80fc('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x80fc('0x1e')](function(_0x34118e){logger[_0x80fc('0xa')](_0x80fc('0x14'),_0x11ec75);logger[_0x80fc('0xd')](_0x80fc('0x14'),_0x11ec75,JSON[_0x80fc('0xf')](_0x34118e));_0x203abe(_0x34118e);})[_0x80fc('0x1f')](function(_0x707656){logger[_0x80fc('0x10')]('ShowSetting',_0x707656[_0x80fc('0x12')],_0x11ec75);_0x10ca10(_0x434d10['error'](0x1f4,_0x707656['message']));});});}; \ No newline at end of file +var _0xfb9b=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','Setting,\x20%s,\x20%s','message','info','result','catch','Setting','find','options','where','attributes','include','map','model','ShowSetting','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0xba768,_0x5ac737){var _0x4c64af=function(_0x49aea6){while(--_0x49aea6){_0xba768['push'](_0xba768['shift']());}};_0x4c64af(++_0x5ac737);}(_0xfb9b,0x1aa));var _0xbfb9=function(_0x35c292,_0x36bb88){_0x35c292=_0x35c292-0x0;var _0x16a3a5=_0xfb9b[_0x35c292];return _0x16a3a5;};'use strict';var _=require(_0xbfb9('0x0'));var util=require(_0xbfb9('0x1'));var moment=require(_0xbfb9('0x2'));var BPromise=require(_0xbfb9('0x3'));var rs=require(_0xbfb9('0x4'));var fs=require('fs');var Redis=require(_0xbfb9('0x5'));var db=require(_0xbfb9('0x6'))['db'];var utils=require(_0xbfb9('0x7'));var logger=require(_0xbfb9('0x8'))(_0xbfb9('0x9'));var config=require(_0xbfb9('0xa'));var jayson=require(_0xbfb9('0xb'));var client=jayson[_0xbfb9('0xc')][_0xbfb9('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x38f582,_0x16025c,_0x27032e){return new BPromise(function(_0xed1f7e,_0x47632c){return client[_0xbfb9('0xe')](_0x38f582,_0x27032e)[_0xbfb9('0xf')](function(_0x3c9465){logger['info']('Setting,\x20%s,\x20%s',_0x16025c,_0xbfb9('0x10'));logger[_0xbfb9('0x11')](_0xbfb9('0x12'),_0x16025c,_0xbfb9('0x10'),JSON[_0xbfb9('0x13')](_0x3c9465));if(_0x3c9465[_0xbfb9('0x14')]){if(_0x3c9465[_0xbfb9('0x14')][_0xbfb9('0x15')]===0x1f4){logger[_0xbfb9('0x14')](_0xbfb9('0x16'),_0x16025c,_0x3c9465['error'][_0xbfb9('0x17')]);return _0x47632c(_0x3c9465['error'][_0xbfb9('0x17')]);}logger['error'](_0xbfb9('0x16'),_0x16025c,_0x3c9465['error'][_0xbfb9('0x17')]);return _0xed1f7e(_0x3c9465[_0xbfb9('0x14')][_0xbfb9('0x17')]);}else{logger[_0xbfb9('0x18')](_0xbfb9('0x16'),_0x16025c,_0xbfb9('0x10'));_0xed1f7e(_0x3c9465[_0xbfb9('0x19')][_0xbfb9('0x17')]);}})[_0xbfb9('0x1a')](function(_0x297d43){logger[_0xbfb9('0x14')](_0xbfb9('0x16'),_0x16025c,_0x297d43);_0x47632c(_0x297d43);});});}exports['ShowSetting']=function(_0x3a1f63){var _0x2fc74e=this;return new Promise(function(_0x7c9fd2,_0x5bffa0){return db[_0xbfb9('0x1b')][_0xbfb9('0x1c')]({'raw':_0x3a1f63[_0xbfb9('0x1d')]?_0x3a1f63[_0xbfb9('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x3a1f63[_0xbfb9('0x1d')]?_0x3a1f63['options'][_0xbfb9('0x1e')]||null:null,'attributes':_0x3a1f63['options']?_0x3a1f63[_0xbfb9('0x1d')][_0xbfb9('0x1f')]||null:null,'include':_0x3a1f63[_0xbfb9('0x1d')]?_0x3a1f63[_0xbfb9('0x1d')][_0xbfb9('0x20')]?_[_0xbfb9('0x21')](_0x3a1f63['options'][_0xbfb9('0x20')],function(_0x43fac9){return{'model':db[_0x43fac9['model']],'as':_0x43fac9['as'],'attributes':_0x43fac9[_0xbfb9('0x1f')],'include':_0x43fac9[_0xbfb9('0x20')]?_[_0xbfb9('0x21')](_0x43fac9[_0xbfb9('0x20')],function(_0x47f0eb){return{'model':db[_0x47f0eb[_0xbfb9('0x22')]],'as':_0x47f0eb['as'],'attributes':_0x47f0eb[_0xbfb9('0x1f')],'include':_0x47f0eb[_0xbfb9('0x20')]?_[_0xbfb9('0x21')](_0x47f0eb[_0xbfb9('0x20')],function(_0x5fb011){return{'model':db[_0x5fb011['model']],'as':_0x5fb011['as'],'attributes':_0x5fb011[_0xbfb9('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xbfb9('0xf')](function(_0x30664e){logger[_0xbfb9('0x18')](_0xbfb9('0x23'),_0x3a1f63);logger[_0xbfb9('0x11')]('ShowSetting',_0x3a1f63,JSON[_0xbfb9('0x13')](_0x30664e));_0x7c9fd2(_0x30664e);})[_0xbfb9('0x1a')](function(_0x52ba84){logger[_0xbfb9('0x14')](_0xbfb9('0x23'),_0x52ba84[_0xbfb9('0x17')],_0x3a1f63);_0x5bffa0(_0x2fc74e[_0xbfb9('0x14')](0x1f4,_0x52ba84['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 1b22203..f96c899 100644 --- a/server/api/smsAccount/index.js +++ b/server/api/smsAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['getInteractions','/:id/status','statusGet','/:id/users','post','create','addAnswer','/:id/notify','notify','addApplications','send','status','addAgents','put','/:id','update','delete','destroy','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','index','/describe','isAuthenticated','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications'];(function(_0x2f2a83,_0x4b14a6){var _0x54fc5c=function(_0xbe81bf){while(--_0xbe81bf){_0x2f2a83['push'](_0x2f2a83['shift']());}};_0x54fc5c(++_0x4b14a6);}(_0x7a54,0x106));var _0x47a5=function(_0x22652b,_0x4b70ef){_0x22652b=_0x22652b-0x0;var _0x43912f=_0x7a54[_0x22652b];return _0x43912f;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/canned_answers',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x9')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x9')]('/:id/interactions',auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);router[_0x47a5('0x9')](_0x47a5('0x13'),controller[_0x47a5('0x14')]);router[_0x47a5('0x9')](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller['getAgents']);router[_0x47a5('0x16')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x17')]);router[_0x47a5('0x16')](_0x47a5('0xd'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x47a5('0x16')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x47a5('0x18')]);router[_0x47a5('0x16')](_0x47a5('0x19'),controller[_0x47a5('0x1a')]);router[_0x47a5('0x16')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x1b')]);router[_0x47a5('0x16')]('/:id/send',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1c')]);router['post'](_0x47a5('0x13'),controller[_0x47a5('0x1d')]);router[_0x47a5('0x16')]('/:id/users',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1e')]);router[_0x47a5('0x1f')](_0x47a5('0x20'),auth['isAuthenticated'](),controller[_0x47a5('0x21')]);router[_0x47a5('0x22')]('/:id',auth[_0x47a5('0xc')](),controller[_0x47a5('0x23')]);router[_0x47a5('0x22')](_0x47a5('0xd'),auth[_0x47a5('0xc')](),controller['removeDispositions']);router['delete'](_0x47a5('0x24'),auth['isAuthenticated'](),controller[_0x47a5('0x25')]);router['delete'](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x26')]);module[_0x47a5('0x27')]=router; \ No newline at end of file +var _0x7a54=['getInteractions','/:id/status','statusGet','/:id/users','post','create','addAnswer','/:id/notify','notify','addApplications','send','status','addAgents','put','/:id','update','delete','destroy','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','index','/describe','isAuthenticated','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications'];(function(_0x189ce9,_0x17cb4f){var _0x4261a1=function(_0x4431d8){while(--_0x4431d8){_0x189ce9['push'](_0x189ce9['shift']());}};_0x4261a1(++_0x17cb4f);}(_0x7a54,0x106));var _0x47a5=function(_0x441881,_0x3935ae){_0x441881=_0x441881-0x0;var _0x3e4394=_0x7a54[_0x441881];return _0x3e4394;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/canned_answers',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x9')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x9')]('/:id/interactions',auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);router[_0x47a5('0x9')](_0x47a5('0x13'),controller[_0x47a5('0x14')]);router[_0x47a5('0x9')](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller['getAgents']);router[_0x47a5('0x16')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x17')]);router[_0x47a5('0x16')](_0x47a5('0xd'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x47a5('0x16')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x47a5('0x18')]);router[_0x47a5('0x16')](_0x47a5('0x19'),controller[_0x47a5('0x1a')]);router[_0x47a5('0x16')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x1b')]);router[_0x47a5('0x16')]('/:id/send',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1c')]);router['post'](_0x47a5('0x13'),controller[_0x47a5('0x1d')]);router[_0x47a5('0x16')]('/:id/users',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1e')]);router[_0x47a5('0x1f')](_0x47a5('0x20'),auth['isAuthenticated'](),controller[_0x47a5('0x21')]);router[_0x47a5('0x22')]('/:id',auth[_0x47a5('0xc')](),controller[_0x47a5('0x23')]);router[_0x47a5('0x22')](_0x47a5('0xd'),auth[_0x47a5('0xc')](),controller['removeDispositions']);router['delete'](_0x47a5('0x24'),auth['isAuthenticated'](),controller[_0x47a5('0x25')]);router['delete'](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x26')]);module[_0x47a5('0x27')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 4bc392d..38d010a 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 _0x56f9=['BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','twilio','skebby','connectel','clicksend','plivo','clickatell','bandwidth','infobip','intelepeer'];(function(_0x59ca6b,_0x13ba69){var _0x355907=function(_0x4b20df){while(--_0x4b20df){_0x59ca6b['push'](_0x59ca6b['shift']());}};_0x355907(++_0x13ba69);}(_0x56f9,0x64));var _0x956f=function(_0x4772bd,_0x2faf18){_0x4772bd=_0x4772bd-0x0;var _0xeeb033=_0x56f9[_0x4772bd];return _0xeeb033;};'use strict';var Sequelize=require(_0x956f('0x0'));var rs=require(_0x956f('0x1'));module[_0x956f('0x2')]={'name':{'type':Sequelize[_0x956f('0x3')],'unique':_0x956f('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x956f('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x956f('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x956f('0x3')],'defaultValue':function(){return rs[_0x956f('0x5')]();}},'phone':{'type':Sequelize[_0x956f('0x3')]},'type':{'type':Sequelize['ENUM'](_0x956f('0x6'),_0x956f('0x7'),_0x956f('0x8'),_0x956f('0x9'),_0x956f('0xa'),_0x956f('0xb'),_0x956f('0xc'),'csc',_0x956f('0xd'),_0x956f('0xe'))},'accountSid':{'type':Sequelize[_0x956f('0x3')]},'authId':{'type':Sequelize[_0x956f('0x3')]},'authToken':{'type':Sequelize[_0x956f('0x3')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0x956f('0x3')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x956f('0x3')]},'applicationId':{'type':Sequelize[_0x956f('0x3')]},'accountId':{'type':Sequelize[_0x956f('0x3')]},'senderString':{'type':Sequelize[_0x956f('0x3')]},'deliveryReport':{'type':Sequelize[_0x956f('0xf')],'defaultValue':![]},'description':{'type':Sequelize[_0x956f('0x3')]},'notificationTemplate':{'type':Sequelize[_0x956f('0x10')],'defaultValue':function(){return _0x956f('0x11');}},'notificationSound':{'type':Sequelize[_0x956f('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x956f('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x956f('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x956f('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x956f('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x956f('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x956f('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x956f('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x956f('0x13')},'mandatoryDisposition':{'type':Sequelize[_0x956f('0xf')],'defaultValue':![],'comment':_0x956f('0x14'),'set':function(_0x8dd7c){if(!_0x8dd7c)this[_0x956f('0x15')]('mandatoryDispositionPauseId',null);this[_0x956f('0x15')](_0x956f('0x16'),_0x8dd7c);}}}; \ No newline at end of file +var _0xd2cb=['plivo','clickatell','bandwidth','infobip','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','generate','ENUM','skebby','connectel','clicksend'];(function(_0xf024be,_0x55a7e3){var _0x2dad1e=function(_0x81bb62){while(--_0x81bb62){_0xf024be['push'](_0xf024be['shift']());}};_0x2dad1e(++_0x55a7e3);}(_0xd2cb,0xe9));var _0xbd2c=function(_0x159b72,_0x183756){_0x159b72=_0x159b72-0x0;var _0x4fa7b7=_0xd2cb[_0x159b72];return _0x4fa7b7;};'use strict';var Sequelize=require(_0xbd2c('0x0'));var rs=require('randomstring');module[_0xbd2c('0x1')]={'name':{'type':Sequelize[_0xbd2c('0x2')],'unique':_0xbd2c('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xbd2c('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0xbd2c('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0xbd2c('0x2')],'defaultValue':function(){return rs[_0xbd2c('0x4')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xbd2c('0x5')]('twilio',_0xbd2c('0x6'),_0xbd2c('0x7'),_0xbd2c('0x8'),_0xbd2c('0x9'),_0xbd2c('0xa'),_0xbd2c('0xb'),'csc',_0xbd2c('0xc'),'intelepeer')},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0xbd2c('0x2')]},'authToken':{'type':Sequelize[_0xbd2c('0x2')]},'smsMethod':{'type':Sequelize[_0xbd2c('0x5')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xbd2c('0x2')]},'apiKey':{'type':Sequelize[_0xbd2c('0x2')]},'applicationId':{'type':Sequelize[_0xbd2c('0x2')]},'accountId':{'type':Sequelize[_0xbd2c('0x2')]},'senderString':{'type':Sequelize[_0xbd2c('0x2')]},'deliveryReport':{'type':Sequelize[_0xbd2c('0xd')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xbd2c('0xe')],'defaultValue':function(){return _0xbd2c('0xf');}},'notificationSound':{'type':Sequelize[_0xbd2c('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xbd2c('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xbd2c('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xbd2c('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xbd2c('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xbd2c('0x10')],'comment':_0xbd2c('0x11')},'mandatoryDisposition':{'type':Sequelize[_0xbd2c('0xd')],'defaultValue':![],'comment':_0xbd2c('0x12'),'set':function(_0x5c0134){if(!_0x5c0134)this[_0xbd2c('0x13')](_0xbd2c('0x14'),null);this['setDataValue'](_0xbd2c('0x15'),_0x5c0134);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 35d8550..6ed80e7 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 _0xb234=['body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','omit','contact','SmsInteraction','spread','interaction','autoclose','push','close','unmanaged','created','SmsMessage','ContactId','AttachmentId','UserId','User','*,*,*,*','queueId','unshift','queue','waitForTheAssignedQueue','startRouting','entity\x20found','text/xml','\x0a','addApplications','sequelize','transaction','ISOLATION_LEVELS','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','Contact','Owner','fullname','tag','List','DESC','out','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','connectel','statusInt','requestid','status_code','infobip','groupName','intelepeer','redif','DELIVERED','RECEIVED_BY_RECIPIENT','bandwidth','message-delivered','DELIVRD','ACCEPTD','statusGet','message-id','state','emit','userSmsAccount:save','removeAgents','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./smsAccount.socket','register','jayson/promise','client','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','get','SmsAccounts','UserProfileResource','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','SmsAccount','includeAll','include','findAll','rows','params','rawAttributes','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','nolimit','filter','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','sms','SmsApplication','Applications','account','applications','orderBy','priority','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','twilio','from','From','Body','messageId','MessageSid','skebby','sender','text','clicksend','message_id','plivo','Text','MessageUUID','results','csc','originatingAddress','clickatell','fromNumber','replyMessageId','refid','from\x20is\x20mandatory','isNil'];(function(_0x6ad6c6,_0x6574fe){var _0x24a815=function(_0x2e2eb6){while(--_0x2e2eb6){_0x6ad6c6['push'](_0x6ad6c6['shift']());}};_0x24a815(++_0x6574fe);}(_0xb234,0x129));var _0x4b23=function(_0x2f948b,_0x49323c){_0x2f948b=_0x2f948b-0x0;var _0x3ae457=_0xb234[_0x2f948b];return _0x3ae457;};'use strict';var emlformat=require(_0x4b23('0x0'));var rimraf=require(_0x4b23('0x1'));var zipdir=require(_0x4b23('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4b23('0x3'));var moment=require(_0x4b23('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4b23('0x5'));var util=require(_0x4b23('0x6'));var path=require(_0x4b23('0x7'));var sox=require(_0x4b23('0x8'));var csv=require(_0x4b23('0x9'));var ejs=require(_0x4b23('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4b23('0xb'));var squel=require('squel');var crypto=require(_0x4b23('0xc'));var jsforce=require(_0x4b23('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x4b23('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4b23('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x4b23('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4b23('0x10'))('api');var utils=require('../../config/utils');var config=require(_0x4b23('0x11'));var licenseUtil=require(_0x4b23('0x12'));var db=require(_0x4b23('0x13'))['db'];config[_0x4b23('0x14')]=_[_0x4b23('0x15')](config[_0x4b23('0x14')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4b23('0x16'))[_0x4b23('0x17')](socket);var jayson=require(_0x4b23('0x18'));var client=jayson[_0x4b23('0x19')]['http']({'port':0x232c});function respondWithRpcPromise(_0x2fb586,_0x25716e,_0x44abea,_0x28b317){return new BPromise(function(_0x5d81d3,_0x23de4a){var _0x4d82cd=_0x28b317||client;return _0x4d82cd[_0x4b23('0x1a')](_0x2fb586,_0x44abea)[_0x4b23('0x1b')](function(_0x2539e0){logger[_0x4b23('0x1c')](_0x4b23('0x1d'),_0x25716e,_0x4b23('0x1e'));logger[_0x4b23('0x1f')](_0x4b23('0x20'),_0x25716e,_0x4b23('0x1e'),JSON[_0x4b23('0x21')](_0x2539e0));if(_0x2539e0[_0x4b23('0x22')]){if(_0x2539e0[_0x4b23('0x22')][_0x4b23('0x23')]===0x1f4){logger['error'](_0x4b23('0x1d'),_0x25716e,_0x2539e0[_0x4b23('0x22')][_0x4b23('0x24')]);return _0x23de4a(_0x2539e0[_0x4b23('0x22')][_0x4b23('0x24')]);}logger[_0x4b23('0x22')](_0x4b23('0x1d'),_0x25716e,_0x2539e0['error'][_0x4b23('0x24')]);return _0x5d81d3(_0x2539e0['error']['message']);}else{logger[_0x4b23('0x1c')](_0x4b23('0x1d'),_0x25716e,'request\x20sent');_0x5d81d3(_0x2539e0[_0x4b23('0x25')]['message']);}})[_0x4b23('0x26')](function(_0x169912){logger['error'](_0x4b23('0x1d'),_0x25716e,_0x169912);_0x23de4a(_0x169912);});});}function respondWithStatusCode(_0x512a4f,_0xec7381){_0xec7381=_0xec7381||0xcc;return function(_0x2de841){if(_0x2de841){return _0x512a4f['sendStatus'](_0xec7381);}return _0x512a4f[_0x4b23('0x27')](_0xec7381)[_0x4b23('0x28')]();};}function respondWithResult(_0x2f065d,_0x1d8ec8){_0x1d8ec8=_0x1d8ec8||0xc8;return function(_0x1de464){if(_0x1de464){return _0x2f065d[_0x4b23('0x27')](_0x1d8ec8)[_0x4b23('0x29')](_0x1de464);}};}function respondWithFilteredResult(_0x3ddb66,_0x165bd8){return function(_0x2f664a){if(_0x2f664a){var _0x36aa2d=typeof _0x165bd8[_0x4b23('0x2a')]===_0x4b23('0x2b')&&typeof _0x165bd8[_0x4b23('0x2c')]===_0x4b23('0x2b');var _0x2df17d=_0x2f664a['count'];var _0x406f6f=_0x36aa2d?0x0:_0x165bd8[_0x4b23('0x2a')];var _0x116b2a=_0x36aa2d?_0x2f664a[_0x4b23('0x2d')]:_0x165bd8[_0x4b23('0x2a')]+_0x165bd8[_0x4b23('0x2c')];var _0x462035;if(_0x116b2a>=_0x2df17d){_0x116b2a=_0x2df17d;_0x462035=0xc8;}else{_0x462035=0xce;}_0x3ddb66[_0x4b23('0x27')](_0x462035);return _0x3ddb66[_0x4b23('0x2e')](_0x4b23('0x2f'),_0x406f6f+'-'+_0x116b2a+'/'+_0x2df17d)[_0x4b23('0x29')](_0x2f664a);}return null;};}function patchUpdates(_0x4c9740){return function(_0x18e814){try{jsonpatch[_0x4b23('0x30')](_0x18e814,_0x4c9740,!![]);}catch(_0x337ad7){return BPromise['reject'](_0x337ad7);}return _0x18e814[_0x4b23('0x31')]();};}function saveUpdates(_0xd43f42,_0x5d564b){return function(_0x36a2a5){if(_0x36a2a5){return _0x36a2a5[_0x4b23('0x32')](_0xd43f42)[_0x4b23('0x1b')](function(_0x4611ba){return _0x4611ba;});}return null;};}function removeEntity(_0x140a63,_0x2d67b0){return function(_0x359f53){if(_0x359f53){return _0x359f53[_0x4b23('0x33')]()[_0x4b23('0x1b')](function(){var _0x43c052=_0x359f53[_0x4b23('0x34')]({'plain':!![]});var _0x874cc6=_0x4b23('0x35');return db[_0x4b23('0x36')][_0x4b23('0x33')]({'where':{'type':_0x874cc6,'resourceId':_0x43c052['id']}})[_0x4b23('0x1b')](function(){return _0x359f53;});})[_0x4b23('0x1b')](function(){_0x140a63[_0x4b23('0x27')](0xcc)[_0x4b23('0x28')]();});}};}function handleEntityNotFound(_0x3fe35b,_0x2ab5f1){return function(_0x289460){if(!_0x289460){_0x3fe35b[_0x4b23('0x37')](0x194);}return _0x289460;};}function handleError(_0x4cf053,_0x460a3e){_0x460a3e=_0x460a3e||0x1f4;return function(_0x1e2cd0){logger[_0x4b23('0x22')](_0x1e2cd0[_0x4b23('0x38')]);if(_0x1e2cd0[_0x4b23('0x39')]){delete _0x1e2cd0['name'];}_0x4cf053[_0x4b23('0x27')](_0x460a3e)[_0x4b23('0x3a')](_0x1e2cd0);};}exports[_0x4b23('0x3b')]=function(_0x2ea8cd,_0x2fbf90){var _0xf630e0={'include':[{'model':db[_0x4b23('0x3c')],'as':_0x4b23('0x3d')}]},_0x138e52={},_0x2c5808={'count':0x0,'rows':[]};var _0x5b9e18=_[_0x4b23('0x3e')](db['SmsAccount']['rawAttributes'],function(_0x1483ab){return{'name':_0x1483ab[_0x4b23('0x3f')],'type':_0x1483ab[_0x4b23('0x40')][_0x4b23('0x41')]};});_0x138e52[_0x4b23('0x42')]=_[_0x4b23('0x3e')](_0x5b9e18,_0x4b23('0x39'));_0x138e52[_0x4b23('0x43')]=_[_0x4b23('0x44')](_0x2ea8cd[_0x4b23('0x43')]);_0x138e52[_0x4b23('0x45')]=_[_0x4b23('0x46')](_0x138e52[_0x4b23('0x42')],_0x138e52['query']);_0xf630e0[_0x4b23('0x47')]=_[_0x4b23('0x46')](_0x138e52[_0x4b23('0x42')],qs[_0x4b23('0x48')](_0x2ea8cd[_0x4b23('0x43')][_0x4b23('0x48')]));_0xf630e0[_0x4b23('0x47')]=_0xf630e0[_0x4b23('0x47')]['length']?_0xf630e0[_0x4b23('0x47')]:_0x138e52[_0x4b23('0x42')];if(!_0x2ea8cd[_0x4b23('0x43')][_0x4b23('0x49')]('nolimit')){_0xf630e0['limit']=qs['limit'](_0x2ea8cd['query'][_0x4b23('0x2c')]);_0xf630e0[_0x4b23('0x2a')]=qs[_0x4b23('0x2a')](_0x2ea8cd[_0x4b23('0x43')][_0x4b23('0x2a')]);}_0xf630e0[_0x4b23('0x4a')]=qs[_0x4b23('0x4b')](_0x2ea8cd['query']['sort']);_0xf630e0[_0x4b23('0x4c')]=qs[_0x4b23('0x45')](_[_0x4b23('0x4d')](_0x2ea8cd[_0x4b23('0x43')],_0x138e52[_0x4b23('0x45')]),_0x5b9e18);if(_0x2ea8cd[_0x4b23('0x43')]['filter']){_0xf630e0[_0x4b23('0x4c')]=_[_0x4b23('0x4e')](_0xf630e0['where'],{'$or':_[_0x4b23('0x3e')](_0x5b9e18,function(_0x1d4896){if(_0x1d4896['type']!==_0x4b23('0x4f')){var _0x3b4887={};_0x3b4887[_0x1d4896[_0x4b23('0x39')]]={'$like':'%'+_0x2ea8cd[_0x4b23('0x43')]['filter']+'%'};return _0x3b4887;}})});}_0xf630e0=_[_0x4b23('0x4e')]({},_0xf630e0,_0x2ea8cd[_0x4b23('0x50')]);var _0x211ea0={'where':_0xf630e0['where']};return db[_0x4b23('0x51')][_0x4b23('0x2d')](_0x211ea0)['then'](function(_0x40bf00){_0x2c5808[_0x4b23('0x2d')]=_0x40bf00;if(_0x2ea8cd[_0x4b23('0x43')][_0x4b23('0x52')]){_0xf630e0[_0x4b23('0x53')]=[{'all':!![]}];}return db['SmsAccount'][_0x4b23('0x54')](_0xf630e0);})['then'](function(_0x222e7d){_0x2c5808[_0x4b23('0x55')]=_0x222e7d;return _0x2c5808;})[_0x4b23('0x1b')](respondWithFilteredResult(_0x2fbf90,_0xf630e0))[_0x4b23('0x26')](handleError(_0x2fbf90,null));};exports['show']=function(_0x14eb25,_0x41bc67){var _0x6c5f8f={'raw':![],'where':{'id':_0x14eb25[_0x4b23('0x56')]['id']},'include':[{'model':db[_0x4b23('0x3c')],'as':_0x4b23('0x3d')}]},_0x59b648={};_0x59b648[_0x4b23('0x42')]=_['keys'](db['SmsAccount'][_0x4b23('0x57')]);_0x59b648[_0x4b23('0x43')]=_['keys'](_0x14eb25[_0x4b23('0x43')]);_0x59b648[_0x4b23('0x45')]=_[_0x4b23('0x46')](_0x59b648[_0x4b23('0x42')],_0x59b648['query']);_0x6c5f8f['attributes']=_['intersection'](_0x59b648[_0x4b23('0x42')],qs[_0x4b23('0x48')](_0x14eb25[_0x4b23('0x43')][_0x4b23('0x48')]));_0x6c5f8f[_0x4b23('0x47')]=_0x6c5f8f['attributes'][_0x4b23('0x58')]?_0x6c5f8f[_0x4b23('0x47')]:_0x59b648[_0x4b23('0x42')];if(_0x14eb25[_0x4b23('0x43')][_0x4b23('0x52')]){_0x6c5f8f['include']=[{'all':!![]}];}_0x6c5f8f=_[_0x4b23('0x4e')]({},_0x6c5f8f,_0x14eb25[_0x4b23('0x50')]);return db[_0x4b23('0x51')][_0x4b23('0x59')](_0x6c5f8f)[_0x4b23('0x1b')](handleEntityNotFound(_0x41bc67,null))[_0x4b23('0x1b')](respondWithResult(_0x41bc67,null))[_0x4b23('0x26')](handleError(_0x41bc67,null));};exports[_0x4b23('0x5a')]=function(_0x49ba66,_0x25b9ad){return db[_0x4b23('0x51')][_0x4b23('0x5a')](_0x49ba66[_0x4b23('0x5b')],{})[_0x4b23('0x1b')](function(_0x1738b2){var _0xe90d=_0x49ba66[_0x4b23('0x5c')][_0x4b23('0x34')]({'plain':!![]});if(!_0xe90d)throw new Error(_0x4b23('0x5d'));if(_0xe90d[_0x4b23('0x5e')]==='user'){var _0x30308d=_0x1738b2[_0x4b23('0x34')]({'plain':!![]});var _0x1e7297=_0x4b23('0x35');return db['UserProfileSection'][_0x4b23('0x59')]({'where':{'name':_0x1e7297,'userProfileId':_0xe90d[_0x4b23('0x5f')]},'raw':!![]})[_0x4b23('0x1b')](function(_0x37d29b){if(_0x37d29b&&_0x37d29b[_0x4b23('0x60')]===0x0){return db['UserProfileResource']['create']({'name':_0x30308d[_0x4b23('0x39')],'resourceId':_0x30308d['id'],'type':_0x37d29b['name'],'sectionId':_0x37d29b['id']},{})[_0x4b23('0x1b')](function(){return _0x1738b2;});}else{return _0x1738b2;}})[_0x4b23('0x26')](function(_0x322502){logger['error'](_0x4b23('0x61'),_0x322502);throw _0x322502;});}return _0x1738b2;})[_0x4b23('0x1b')](respondWithResult(_0x25b9ad,0xc9))['catch'](handleError(_0x25b9ad,null));};exports[_0x4b23('0x32')]=function(_0xc42c1c,_0x15dfde){if(_0xc42c1c[_0x4b23('0x5b')]['id']){delete _0xc42c1c[_0x4b23('0x5b')]['id'];}return db['SmsAccount'][_0x4b23('0x59')]({'where':{'id':_0xc42c1c['params']['id']},'include':[{'model':db[_0x4b23('0x3c')],'as':_0x4b23('0x3d')}]})[_0x4b23('0x1b')](handleEntityNotFound(_0x15dfde,null))[_0x4b23('0x1b')](saveUpdates(_0xc42c1c[_0x4b23('0x5b')],null))['then'](respondWithResult(_0x15dfde,null))[_0x4b23('0x26')](handleError(_0x15dfde,null));};exports[_0x4b23('0x33')]=function(_0x16f61b,_0x455bb0){return db[_0x4b23('0x51')]['find']({'where':{'id':_0x16f61b[_0x4b23('0x56')]['id']}})[_0x4b23('0x1b')](handleEntityNotFound(_0x455bb0,null))['then'](removeEntity(_0x455bb0,null))[_0x4b23('0x26')](handleError(_0x455bb0,null));};exports[_0x4b23('0x62')]=function(_0x3d64a9,_0x15e509){return db[_0x4b23('0x51')][_0x4b23('0x62')]()[_0x4b23('0x1b')](respondWithResult(_0x15e509,null))[_0x4b23('0x26')](handleError(_0x15e509,null));};exports[_0x4b23('0x63')]=function(_0x19c31d,_0x10dc5a,_0x335db1){if(_0x19c31d['body']['id']){delete _0x19c31d[_0x4b23('0x5b')]['id'];}return db[_0x4b23('0x51')][_0x4b23('0x59')]({'where':{'id':_0x19c31d['params']['id']}})[_0x4b23('0x1b')](handleEntityNotFound(_0x10dc5a,null))['then'](function(_0x515531){if(_0x515531){_0x19c31d['body'][_0x4b23('0x64')]=_0x515531['id'];return db[_0x4b23('0x65')][_0x4b23('0x5a')](_0x19c31d[_0x4b23('0x5b')]);}})[_0x4b23('0x1b')](respondWithResult(_0x10dc5a,null))[_0x4b23('0x26')](handleError(_0x10dc5a,null));};exports[_0x4b23('0x66')]=function(_0x12a92c,_0x178f58,_0x480081){var _0x2578d7={'raw':![],'where':{}};var _0x473bd1={};var _0x41c637={'count':0x0,'rows':[]};return db['SmsAccount'][_0x4b23('0x67')]({'where':{'id':_0x12a92c[_0x4b23('0x56')]['id']}})[_0x4b23('0x1b')](handleEntityNotFound(_0x178f58,null))[_0x4b23('0x1b')](function(_0x1cd144){if(_0x1cd144){_0x473bd1['model']=_[_0x4b23('0x44')](db['Disposition']['rawAttributes']);_0x473bd1[_0x4b23('0x43')]=_[_0x4b23('0x44')](_0x12a92c[_0x4b23('0x43')]);_0x473bd1[_0x4b23('0x45')]=_[_0x4b23('0x46')](_0x473bd1[_0x4b23('0x42')],_0x473bd1[_0x4b23('0x43')]);_0x2578d7[_0x4b23('0x47')]=_[_0x4b23('0x46')](_0x473bd1['model'],qs[_0x4b23('0x48')](_0x12a92c[_0x4b23('0x43')][_0x4b23('0x48')]));_0x2578d7['attributes']=_0x2578d7['attributes']['length']?_0x2578d7[_0x4b23('0x47')]:_0x473bd1[_0x4b23('0x42')];if(!_0x12a92c['query']['hasOwnProperty'](_0x4b23('0x68'))){_0x2578d7[_0x4b23('0x2c')]=qs[_0x4b23('0x2c')](_0x12a92c['query'][_0x4b23('0x2c')]);_0x2578d7[_0x4b23('0x2a')]=qs[_0x4b23('0x2a')](_0x12a92c['query'][_0x4b23('0x2a')]);}_0x2578d7[_0x4b23('0x4a')]=qs[_0x4b23('0x4b')](_0x12a92c['query'][_0x4b23('0x4b')]);_0x2578d7[_0x4b23('0x4c')]=qs[_0x4b23('0x45')](_[_0x4b23('0x4d')](_0x12a92c[_0x4b23('0x43')],_0x473bd1['filters']));_0x2578d7[_0x4b23('0x4c')][_0x4b23('0x64')]=_0x1cd144['id'];if(_0x12a92c[_0x4b23('0x43')][_0x4b23('0x69')]){_0x2578d7[_0x4b23('0x4c')]=_[_0x4b23('0x4e')](_0x2578d7['where'],{'$or':_['map'](_0x2578d7[_0x4b23('0x47')],function(_0xbb3acc){var _0x4c9bcb={};_0x4c9bcb[_0xbb3acc]={'$like':'%'+_0x12a92c[_0x4b23('0x43')][_0x4b23('0x69')]+'%'};return _0x4c9bcb;})});}_0x2578d7=_['merge']({},_0x2578d7,_0x12a92c[_0x4b23('0x50')]);return db[_0x4b23('0x65')][_0x4b23('0x2d')]({'where':_0x2578d7[_0x4b23('0x4c')]})['then'](function(_0x1e661d){_0x41c637[_0x4b23('0x2d')]=_0x1e661d;if(_0x12a92c[_0x4b23('0x43')]['includeAll']){_0x2578d7[_0x4b23('0x53')]=[{'all':!![]}];}return db[_0x4b23('0x65')][_0x4b23('0x54')](_0x2578d7);})[_0x4b23('0x1b')](function(_0x5a1747){_0x41c637[_0x4b23('0x55')]=_0x5a1747;return _0x41c637;});}})[_0x4b23('0x1b')](respondWithFilteredResult(_0x178f58,_0x2578d7))[_0x4b23('0x26')](handleError(_0x178f58,null));};exports[_0x4b23('0x6a')]=function(_0x122165,_0x4bd25f,_0x336443){return db[_0x4b23('0x51')][_0x4b23('0x59')]({'where':{'id':_0x122165['params']['id']}})[_0x4b23('0x1b')](handleEntityNotFound(_0x4bd25f,null))[_0x4b23('0x1b')](function(_0x2060d6){if(_0x2060d6){return _0x2060d6[_0x4b23('0x6a')](_0x122165['query'][_0x4b23('0x6b')]);}})['then'](respondWithStatusCode(_0x4bd25f,null))[_0x4b23('0x26')](handleError(_0x4bd25f,null));};exports[_0x4b23('0x6c')]=function(_0x20cc87,_0x34f462,_0x3535a1){if(_0x20cc87[_0x4b23('0x5b')]['id']){delete _0x20cc87[_0x4b23('0x5b')]['id'];}return db[_0x4b23('0x51')][_0x4b23('0x59')]({'where':{'id':_0x20cc87[_0x4b23('0x56')]['id']}})['then'](handleEntityNotFound(_0x34f462,null))[_0x4b23('0x1b')](function(_0x37d14e){if(_0x37d14e){_0x20cc87[_0x4b23('0x5b')][_0x4b23('0x64')]=_0x37d14e['id'];return db[_0x4b23('0x6d')][_0x4b23('0x5a')](_0x20cc87[_0x4b23('0x5b')]);}})['then'](respondWithResult(_0x34f462,null))[_0x4b23('0x26')](handleError(_0x34f462,null));};exports[_0x4b23('0x6e')]=function(_0x4ffaec,_0x3a6c7d,_0x2691cc){var _0x17403a={'raw':![],'where':{}};var _0x2b9165={};var _0xa88a2f={'count':0x0,'rows':[]};return db['SmsAccount'][_0x4b23('0x67')]({'where':{'id':_0x4ffaec[_0x4b23('0x56')]['id']}})[_0x4b23('0x1b')](handleEntityNotFound(_0x3a6c7d,null))['then'](function(_0x4a9cfd){if(_0x4a9cfd){_0x2b9165['model']=_[_0x4b23('0x44')](db[_0x4b23('0x6d')]['rawAttributes']);_0x2b9165[_0x4b23('0x43')]=_[_0x4b23('0x44')](_0x4ffaec['query']);_0x2b9165[_0x4b23('0x45')]=_[_0x4b23('0x46')](_0x2b9165['model'],_0x2b9165['query']);_0x17403a['attributes']=_[_0x4b23('0x46')](_0x2b9165['model'],qs[_0x4b23('0x48')](_0x4ffaec['query']['fields']));_0x17403a[_0x4b23('0x47')]=_0x17403a[_0x4b23('0x47')]['length']?_0x17403a[_0x4b23('0x47')]:_0x2b9165[_0x4b23('0x42')];if(!_0x4ffaec[_0x4b23('0x43')][_0x4b23('0x49')]('nolimit')){_0x17403a['limit']=qs[_0x4b23('0x2c')](_0x4ffaec[_0x4b23('0x43')][_0x4b23('0x2c')]);_0x17403a[_0x4b23('0x2a')]=qs['offset'](_0x4ffaec[_0x4b23('0x43')][_0x4b23('0x2a')]);}_0x17403a[_0x4b23('0x4a')]=qs[_0x4b23('0x4b')](_0x4ffaec[_0x4b23('0x43')][_0x4b23('0x4b')]);_0x17403a[_0x4b23('0x4c')]=qs[_0x4b23('0x45')](_[_0x4b23('0x4d')](_0x4ffaec[_0x4b23('0x43')],_0x2b9165[_0x4b23('0x45')]));_0x17403a['where']['SmsAccountId']=_0x4a9cfd['id'];if(_0x4ffaec[_0x4b23('0x43')][_0x4b23('0x69')]){_0x17403a[_0x4b23('0x4c')]=_['merge'](_0x17403a['where'],{'$or':_['map'](_0x17403a[_0x4b23('0x47')],function(_0x5edce3){var _0x437713={};_0x437713[_0x5edce3]={'$like':'%'+_0x4ffaec['query'][_0x4b23('0x69')]+'%'};return _0x437713;})});}_0x17403a=_['merge']({},_0x17403a,_0x4ffaec[_0x4b23('0x50')]);return db['CannedAnswer']['count']({'where':_0x17403a[_0x4b23('0x4c')]})[_0x4b23('0x1b')](function(_0x43feba){_0xa88a2f[_0x4b23('0x2d')]=_0x43feba;if(_0x4ffaec[_0x4b23('0x43')][_0x4b23('0x52')]){_0x17403a[_0x4b23('0x53')]=[{'all':!![]}];}return db[_0x4b23('0x6d')]['findAll'](_0x17403a);})[_0x4b23('0x1b')](function(_0x2887c9){_0xa88a2f[_0x4b23('0x55')]=_0x2887c9;return _0xa88a2f;});}})['then'](respondWithFilteredResult(_0x3a6c7d,_0x17403a))[_0x4b23('0x26')](handleError(_0x3a6c7d,null));};exports[_0x4b23('0x6f')]=function(_0x176fae,_0x27f9b4,_0x59cc31){return db[_0x4b23('0x51')]['find']({'where':{'id':_0x176fae['params']['id']}})['then'](handleEntityNotFound(_0x27f9b4,null))['then'](function(_0x4f7744){if(_0x4f7744){return _0x4f7744[_0x4b23('0x6f')](_0x176fae['query'][_0x4b23('0x6b')]);}})['then'](respondWithStatusCode(_0x27f9b4,null))[_0x4b23('0x26')](handleError(_0x27f9b4,null));};exports['notify']=function(_0x2a5be4,_0x4f29ac,_0x3a8e85){var _0x1c9bf0={'channel':_0x4b23('0x70')};var _0xab340f=[];var _0x420b3a=[];var _0x58faaf={};return db[_0x4b23('0x51')][_0x4b23('0x59')]({'where':{'id':_0x2a5be4[_0x4b23('0x56')]['id']},'include':[{'model':db[_0x4b23('0x71')],'as':_0x4b23('0x72')}]})[_0x4b23('0x1b')](handleEntityNotFound(_0x4f29ac,null))['then'](function(_0x5895f8){_0x1c9bf0[_0x4b23('0x73')]=_0x5895f8;_0x1c9bf0[_0x4b23('0x74')]=_[_0x4b23('0x75')](_0x5895f8['Applications'],[_0x4b23('0x76')],[_0x4b23('0x77')]);if(_0x1c9bf0[_0x4b23('0x73')][_0x4b23('0x72')]){delete _0x1c9bf0['account']['Applications'];}return db[_0x4b23('0x78')][_0x4b23('0x62')]();})[_0x4b23('0x1b')](function(_0x190d26){if(!_0x190d26){throw new db[(_0x4b23('0x79'))][(_0x4b23('0x7a'))](_0x4b23('0x7b'));}_0xab340f=_[_0x4b23('0x7c')](_[_0x4b23('0x44')](_0x190d26),[_0x4b23('0x7d'),_0x4b23('0x7e')]);_0x420b3a=_[_0x4b23('0x7c')](_[_0x4b23('0x44')](_0x190d26),['createdAt',_0x4b23('0x7e'),'CompanyId',_0x4b23('0x7f')]);_0x1c9bf0[_0x4b23('0x5b')]={'mapKey':'mobile'};if(_0x1c9bf0[_0x4b23('0x73')][_0x4b23('0x40')]){switch(_0x1c9bf0[_0x4b23('0x73')][_0x4b23('0x40')]){case _0x4b23('0x80'):_0x1c9bf0['body'][_0x4b23('0x81')]=_0x2a5be4['body'][_0x4b23('0x82')];_0x1c9bf0['body'][_0x4b23('0x5b')]=_0x2a5be4[_0x4b23('0x5b')][_0x4b23('0x83')];_0x1c9bf0[_0x4b23('0x5b')][_0x4b23('0x84')]=_0x2a5be4[_0x4b23('0x5b')][_0x4b23('0x85')];break;case _0x4b23('0x86'):_0x1c9bf0[_0x4b23('0x5b')][_0x4b23('0x81')]='+'+_0x2a5be4[_0x4b23('0x5b')][_0x4b23('0x87')];_0x1c9bf0[_0x4b23('0x5b')]['body']=_0x2a5be4[_0x4b23('0x5b')][_0x4b23('0x88')];break;case'connectel':_0x1c9bf0['body']['from']=_0x2a5be4[_0x4b23('0x5b')]['from'];_0x1c9bf0[_0x4b23('0x5b')][_0x4b23('0x5b')]=_0x2a5be4['body'][_0x4b23('0x24')];break;case _0x4b23('0x89'):_0x1c9bf0[_0x4b23('0x5b')]['from']=_0x2a5be4[_0x4b23('0x5b')][_0x4b23('0x81')];_0x1c9bf0[_0x4b23('0x5b')][_0x4b23('0x5b')]=_0x2a5be4[_0x4b23('0x5b')][_0x4b23('0x5b')];_0x1c9bf0['body'][_0x4b23('0x84')]=_0x2a5be4['body'][_0x4b23('0x8a')];break;case _0x4b23('0x8b'):_0x1c9bf0['body']['from']=_0x2a5be4['body'][_0x4b23('0x82')];_0x1c9bf0[_0x4b23('0x5b')][_0x4b23('0x5b')]=_0x2a5be4['body'][_0x4b23('0x8c')];_0x1c9bf0[_0x4b23('0x5b')][_0x4b23('0x84')]=_0x2a5be4[_0x4b23('0x5b')][_0x4b23('0x8d')];break;case'infobip':_0x1c9bf0[_0x4b23('0x5b')][_0x4b23('0x81')]='+'+_0x2a5be4[_0x4b23('0x5b')][_0x4b23('0x8e')][0x0][_0x4b23('0x81')];_0x1c9bf0[_0x4b23('0x5b')][_0x4b23('0x5b')]=_0x2a5be4[_0x4b23('0x5b')][_0x4b23('0x8e')][0x0][_0x4b23('0x88')];_0x1c9bf0[_0x4b23('0x5b')][_0x4b23('0x84')]=_0x2a5be4[_0x4b23('0x5b')]['results'][0x0][_0x4b23('0x84')];break;case _0x4b23('0x8f'):_0x1c9bf0['body'][_0x4b23('0x81')]=_0x2a5be4[_0x4b23('0x5b')][_0x4b23('0x90')];_0x1c9bf0['body'][_0x4b23('0x5b')]=_0x2a5be4['body']['segmentedMessage'][_0x4b23('0x24')];break;case _0x4b23('0x91'):_0x1c9bf0['body']['from']=_0x2a5be4[_0x4b23('0x5b')][_0x4b23('0x92')];_0x1c9bf0[_0x4b23('0x5b')][_0x4b23('0x5b')]=_0x2a5be4[_0x4b23('0x5b')]['text'];_0x1c9bf0[_0x4b23('0x5b')][_0x4b23('0x84')]=_0x2a5be4['body'][_0x4b23('0x93')];break;case'bandwidth':_0x1c9bf0['body']['messageId']=_0x2a5be4[_0x4b23('0x5b')][0x0][_0x4b23('0x24')]['id'];_0x1c9bf0[_0x4b23('0x5b')][_0x4b23('0x81')]=_0x2a5be4[_0x4b23('0x5b')][0x0][_0x4b23('0x24')]['from'];_0x1c9bf0[_0x4b23('0x5b')]['body']=_0x2a5be4[_0x4b23('0x5b')][0x0]['message']['text'];break;case'intelepeer':_0x1c9bf0['body'][_0x4b23('0x81')]=_0x2a5be4[_0x4b23('0x5b')]['from'];_0x1c9bf0['body'][_0x4b23('0x5b')]=_0x2a5be4['body']['message'];_0x1c9bf0[_0x4b23('0x5b')][_0x4b23('0x84')]=_0x2a5be4['body'][_0x4b23('0x94')];break;}}if(_0x1c9bf0[_0x4b23('0x5b')]['id']){delete _0x1c9bf0[_0x4b23('0x5b')]['id'];}if(_['isNil'](_0x1c9bf0[_0x4b23('0x5b')][_0x4b23('0x81')])){throw new db[(_0x4b23('0x79'))][(_0x4b23('0x7a'))](_0x4b23('0x95'));}if(_[_0x4b23('0x96')](_0x1c9bf0[_0x4b23('0x5b')]['body'])||_0x1c9bf0['body'][_0x4b23('0x5b')]===''){throw new db[(_0x4b23('0x79'))]['ValidationError'](_0x4b23('0x97'));}if(_['isNil'](_0x1c9bf0[_0x4b23('0x5b')][_0x4b23('0x98')])){throw new db[(_0x4b23('0x79'))][(_0x4b23('0x7a'))](_0x4b23('0x99')+_0x420b3a);}if(!_['includes'](_0x420b3a,_0x1c9bf0[_0x4b23('0x5b')][_0x4b23('0x98')])){throw new db[(_0x4b23('0x79'))][(_0x4b23('0x7a'))](_0x4b23('0x9a')+_0x420b3a);}_0x58faaf[_0x1c9bf0[_0x4b23('0x5b')][_0x4b23('0x98')]]=_0x1c9bf0[_0x4b23('0x5b')][_0x4b23('0x81')];return db[_0x4b23('0x9b')][_0x4b23('0x59')]({'where':{'id':_0x1c9bf0[_0x4b23('0x73')][_0x4b23('0x7f')]},'include':[{'model':db[_0x4b23('0x78')],'as':_0x4b23('0x9c'),'where':_0x58faaf,'limit':0x1,'order':[[_0x4b23('0x7e'),'DESC']]}]});})['then'](handleEntityNotFound(_0x4f29ac,null))['then'](function(_0x484838){if(_0x484838){_0x1c9bf0['list']=_[_0x4b23('0x9d')](_0x484838,[_0x4b23('0x9c')]);if(_0x484838[_0x4b23('0x9c')]['length']){return _0x484838[_0x4b23('0x9c')][0x0];}var _0x3e2493=_['defaults'](_0x1c9bf0[_0x4b23('0x5b')],{'firstName':_0x1c9bf0[_0x4b23('0x5b')][_0x4b23('0x81')],'ListId':_0x484838['id']});_0x3e2493[_0x1c9bf0[_0x4b23('0x5b')][_0x4b23('0x98')]]=_0x1c9bf0[_0x4b23('0x5b')]['from'];return db[_0x4b23('0x78')]['create'](_0x3e2493,{'fields':_0xab340f,'raw':!![]});}})[_0x4b23('0x1b')](handleEntityNotFound(_0x4f29ac,null))[_0x4b23('0x1b')](function(_0x291f64){if(_0x291f64){_0x1c9bf0[_0x4b23('0x9e')]=_0x291f64;var _0x2a8b98={'ContactId':_0x291f64['id'],'phone':_0x1c9bf0[_0x4b23('0x5b')][_0x4b23('0x81')],'SmsAccountId':_0x2a5be4[_0x4b23('0x56')]['id']};var _0xe59041={'ContactId':_0x291f64['id'],'SmsAccountId':_0x2a5be4[_0x4b23('0x56')]['id'],'closed':![]};return db['SmsInteraction'][_0x4b23('0x59')]({'where':_0xe59041})[_0x4b23('0x1b')](function(_0x498247){if(_0x498247){return[_0x498247,![]];}return db[_0x4b23('0x9f')]['create'](_0x2a8b98)[_0x4b23('0x1b')](function(_0x54323b){return[_0x54323b,!![]];});});}})[_0x4b23('0xa0')](function(_0x133b96,_0x329bed){_0x1c9bf0[_0x4b23('0xa1')]=_0x133b96[_0x4b23('0x34')]({'plain':!![]});_0x1c9bf0[_0x4b23('0xa1')]['created']=![];if(_0x329bed){if(_0x1c9bf0[_0x4b23('0x73')][_0x4b23('0xa2')]){_0x1c9bf0[_0x4b23('0x74')][_0x4b23('0xa3')]({'id':0x0,'priority':_0x1c9bf0[_0x4b23('0x74')][_0x4b23('0x58')]+0x1,'app':_0x4b23('0xa4'),'appdata':_0x4b23('0xa5'),'interval':'*,*,*,*'});}_0x1c9bf0[_0x4b23('0xa1')][_0x4b23('0xa6')]=!![];}return db[_0x4b23('0xa7')][_0x4b23('0x5a')]({'phone':_0x1c9bf0[_0x4b23('0x5b')]['from'],'messageId':_0x1c9bf0[_0x4b23('0x5b')][_0x4b23('0x84')],'body':_0x1c9bf0[_0x4b23('0x5b')][_0x4b23('0x5b')],'SmsAccountId':_0x2a5be4['params']['id'],'SmsInteractionId':_0x133b96['id'],'direction':'in','ContactId':_0x133b96[_0x4b23('0xa8')],'AttachmentId':_0x1c9bf0[_0x4b23('0x5b')][_0x4b23('0xa9')]});})[_0x4b23('0x1b')](function(_0xce1d63){_0x1c9bf0[_0x4b23('0x24')]=_0xce1d63;if(!_0x1c9bf0[_0x4b23('0xa1')][_0x4b23('0xaa')])return;return db[_0x4b23('0xab')][_0x4b23('0x59')]({'attributes':['id',_0x4b23('0x39')],'where':{'id':_0x1c9bf0[_0x4b23('0xa1')][_0x4b23('0xaa')]}});})[_0x4b23('0x1b')](function(_0x454ba5){if(_0x454ba5){_0x1c9bf0['applications']['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x454ba5[_0x4b23('0x39')]+','+(_0x1c9bf0[_0x4b23('0x73')]['waitForTheAssignedAgent']||0xa),'interval':_0x4b23('0xac')});}if(!_0x1c9bf0[_0x4b23('0xa1')]['queueId'])return;return db['SmsQueue'][_0x4b23('0x59')]({'attributes':['id',_0x4b23('0x39')],'where':{'id':_0x1c9bf0[_0x4b23('0xa1')][_0x4b23('0xad')]}});})[_0x4b23('0x1b')](function(_0x4a3019){if(_0x4a3019){_0x1c9bf0[_0x4b23('0x74')][_0x4b23('0xae')]({'id':0x0,'priority':0x1,'app':_0x4b23('0xaf'),'appdata':_0x4a3019[_0x4b23('0x39')]+','+(_0x1c9bf0[_0x4b23('0x73')][_0x4b23('0xb0')]||0x12c),'interval':_0x4b23('0xac')});}return respondWithRpcPromise('Start',_0x4b23('0xb1'),_0x1c9bf0);})['then'](function(_0xd213bc){if(_0xd213bc){var _0x3cc9c8=0xc8;var _0x292f02='receiveMessage';logger[_0x4b23('0x1c')](_0x4b23('0x20'),_0x292f02,_0x3cc9c8,_0x4b23('0xb2'));logger[_0x4b23('0x1f')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x292f02,_0x3cc9c8,_0x4b23('0xb2'),JSON[_0x4b23('0x21')](_0xd213bc));if(_0x1c9bf0[_0x4b23('0x73')][_0x4b23('0x40')]===_0x4b23('0x80')){return _0x4f29ac['status'](_0x3cc9c8)[_0x4b23('0x2e')]('Content-Type',_0x4b23('0xb3'))[_0x4b23('0x3a')](_0x4b23('0xb4'));}else{return _0x4f29ac[_0x4b23('0x27')](_0x3cc9c8)['json'](_0xd213bc);}}})[_0x4b23('0x26')](handleError(_0x4f29ac,null));};exports[_0x4b23('0xb5')]=function(_0x4bfbd3,_0x6f4161){var _0x1ecde5=_0x4bfbd3[_0x4b23('0x56')]['id'];var _0xd8c929=_0x4bfbd3[_0x4b23('0x5b')];var _0x28bae1=0xc8;var _0x222a43=null;return db[_0x4b23('0xb6')][_0x4b23('0xb7')]({'isolationLevel':db[_0x4b23('0xb6')]['Transaction'][_0x4b23('0xb8')]['READ_COMMITTED']},function(_0x337f83){return db[_0x4b23('0x51')][_0x4b23('0x67')]({'where':{'id':_0x1ecde5},'transaction':_0x337f83})[_0x4b23('0x1b')](function(_0x46df47){if(_0x46df47){return db[_0x4b23('0x71')][_0x4b23('0x33')]({'where':{'SmsAccountId':_0x1ecde5},'transaction':_0x337f83})[_0x4b23('0x1b')](function(){var _0x5dd816=_['map'](_0xd8c929,function(_0x40f3d0){_0x40f3d0['SmsAccountId']=_0x1ecde5;return _0x40f3d0;});return db['SmsApplication'][_0x4b23('0xb9')](_0x5dd816,{'transaction':_0x337f83});});}else{_0x28bae1=0x194;_0x222a43=[];}});})['then'](function(){if(_0x28bae1!==0x194){return db['SmsApplication'][_0x4b23('0xba')]({'where':{'SmsAccountId':_0x1ecde5},'order':_0x4b23('0x76')})[_0x4b23('0x1b')](function(_0x4b34ba){_0x222a43=_0x4b34ba;});}})['catch'](function(_0x829e2a){_0x28bae1=0x1f4;logger[_0x4b23('0x22')](_0x829e2a[_0x4b23('0x38')]);if(_0x829e2a['name']){delete _0x829e2a[_0x4b23('0x39')];}_0x222a43=_0x829e2a;})[_0x4b23('0xbb')](function(){if(_0x222a43===null){_0x6f4161[_0x4b23('0x37')](_0x28bae1);}else{if(_0x28bae1===0x1f4){_0x6f4161[_0x4b23('0x27')](_0x28bae1)[_0x4b23('0x3a')](_0x222a43);}else{_0x6f4161['status'](_0x28bae1)[_0x4b23('0x29')](_0x222a43);}}});};exports['getApplications']=function(_0x198d06,_0x8ad11c,_0x364b4c){var _0x65601b={};var _0xfa387c={};var _0x3f2704;var _0x49b6a;return db[_0x4b23('0x51')][_0x4b23('0x67')]({'where':{'id':_0x198d06[_0x4b23('0x56')]['id']}})[_0x4b23('0x1b')](handleEntityNotFound(_0x8ad11c,null))[_0x4b23('0x1b')](function(_0x24788a){if(_0x24788a){_0x3f2704=_0x24788a;_0xfa387c[_0x4b23('0x42')]=_[_0x4b23('0x44')](db[_0x4b23('0x71')][_0x4b23('0x57')]);_0xfa387c[_0x4b23('0x43')]=_[_0x4b23('0x44')](_0x198d06[_0x4b23('0x43')]);_0xfa387c['filters']=_[_0x4b23('0x46')](_0xfa387c[_0x4b23('0x42')],_0xfa387c[_0x4b23('0x43')]);_0x65601b[_0x4b23('0x47')]=_[_0x4b23('0x46')](_0xfa387c[_0x4b23('0x42')],qs[_0x4b23('0x48')](_0x198d06['query'][_0x4b23('0x48')]));_0x65601b[_0x4b23('0x47')]=_0x65601b[_0x4b23('0x47')][_0x4b23('0x58')]?_0x65601b[_0x4b23('0x47')]:_0xfa387c[_0x4b23('0x42')];_0x65601b[_0x4b23('0x4a')]=qs['sort'](_0x198d06[_0x4b23('0x43')]['sort']);_0x65601b[_0x4b23('0x4c')]=qs[_0x4b23('0x45')](_[_0x4b23('0x4d')](_0x198d06[_0x4b23('0x43')],_0xfa387c[_0x4b23('0x45')]));if(_0x198d06[_0x4b23('0x43')][_0x4b23('0x69')]){_0x65601b[_0x4b23('0x4c')]=_['merge'](_0x65601b[_0x4b23('0x4c')],{'$or':_['map'](_0x65601b[_0x4b23('0x47')],function(_0x4ad98b){var _0x36dccc={};_0x36dccc[_0x4ad98b]={'$like':'%'+_0x198d06['query'][_0x4b23('0x69')]+'%'};return _0x36dccc;})});}_0x65601b=_[_0x4b23('0x4e')]({},_0x65601b,_0x198d06[_0x4b23('0x50')]);return _0x3f2704[_0x4b23('0xbc')](_0x65601b);}})[_0x4b23('0x1b')](function(_0x1addc7){if(_0x1addc7){_0x49b6a=_0x1addc7[_0x4b23('0x58')];if(!_0x198d06[_0x4b23('0x43')]['hasOwnProperty'](_0x4b23('0x68'))){_0x65601b[_0x4b23('0x2c')]=qs[_0x4b23('0x2c')](_0x198d06['query'][_0x4b23('0x2c')]);_0x65601b[_0x4b23('0x2a')]=qs['offset'](_0x198d06['query'][_0x4b23('0x2a')]);}return _0x3f2704['getApplications'](_0x65601b);}})[_0x4b23('0x1b')](function(_0x4337f6){if(_0x4337f6){return _0x4337f6?{'count':_0x49b6a,'rows':_0x4337f6}:null;}})['then'](respondWithResult(_0x8ad11c,null))[_0x4b23('0x26')](handleError(_0x8ad11c,null));};exports[_0x4b23('0xbd')]=function(_0x57540c,_0x9dbcf5,_0x52c49d){var _0x379b87={'raw':![],'where':{}};var _0x1ff507={};var _0xdc78ed={'count':0x0,'rows':[]};return db['SmsAccount'][_0x4b23('0x67')]({'where':{'id':_0x57540c[_0x4b23('0x56')]['id']}})[_0x4b23('0x1b')](handleEntityNotFound(_0x9dbcf5,null))[_0x4b23('0x1b')](function(_0x9534fc){if(_0x9534fc){_0x1ff507[_0x4b23('0x42')]=_[_0x4b23('0x44')](db[_0x4b23('0x9f')][_0x4b23('0x57')]);_0x1ff507['query']=_[_0x4b23('0x44')](_0x57540c['query']);_0x1ff507[_0x4b23('0x45')]=_[_0x4b23('0x46')](_0x1ff507[_0x4b23('0x42')],_0x1ff507[_0x4b23('0x43')]);_0x379b87[_0x4b23('0x47')]=_[_0x4b23('0x46')](_0x1ff507[_0x4b23('0x42')],qs['fields'](_0x57540c[_0x4b23('0x43')]['fields']));_0x379b87[_0x4b23('0x47')]=_0x379b87[_0x4b23('0x47')][_0x4b23('0x58')]?_0x379b87[_0x4b23('0x47')]:_0x1ff507['model'];if(!_0x57540c['query']['hasOwnProperty'](_0x4b23('0x68'))){_0x379b87[_0x4b23('0x2c')]=qs[_0x4b23('0x2c')](_0x57540c[_0x4b23('0x43')][_0x4b23('0x2c')]);_0x379b87[_0x4b23('0x2a')]=qs[_0x4b23('0x2a')](_0x57540c[_0x4b23('0x43')][_0x4b23('0x2a')]);}_0x379b87[_0x4b23('0x4a')]=qs[_0x4b23('0x4b')](_0x57540c['query'][_0x4b23('0x4b')]);_0x379b87['where']=qs['filters'](_[_0x4b23('0x4d')](_0x57540c[_0x4b23('0x43')],_0x1ff507['filters']));_0x379b87[_0x4b23('0x4c')][_0x4b23('0x64')]=_0x9534fc['id'];if(_0x57540c[_0x4b23('0x43')][_0x4b23('0x69')]){_0x379b87['where']=_[_0x4b23('0x4e')](_0x379b87[_0x4b23('0x4c')],{'$or':_['map'](_0x379b87[_0x4b23('0x47')],function(_0x453b3f){var _0x2cd3a1={};_0x2cd3a1[_0x453b3f]={'$like':'%'+_0x57540c[_0x4b23('0x43')][_0x4b23('0x69')]+'%'};return _0x2cd3a1;})});}_0x379b87=_[_0x4b23('0x4e')]({},_0x379b87,_0x57540c[_0x4b23('0x50')]);return db[_0x4b23('0x9f')]['count']({'where':_0x379b87[_0x4b23('0x4c')]})[_0x4b23('0x1b')](function(_0x35c942){_0xdc78ed[_0x4b23('0x2d')]=_0x35c942;if(_0x57540c[_0x4b23('0x43')][_0x4b23('0x52')]){_0x379b87[_0x4b23('0x53')]=[{'model':db['CmContact'],'as':_0x4b23('0xbe'),'required':![]},{'model':db['User'],'as':_0x4b23('0xbf'),'attributes':[_0x4b23('0x39'),_0x4b23('0xc0'),'internal'],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id','name','color'],'where':_0x57540c[_0x4b23('0x43')][_0x4b23('0xc1')]?{'id':_0x57540c[_0x4b23('0x43')]['tag']}:undefined,'required':_0x57540c[_0x4b23('0x43')][_0x4b23('0xc1')]?!![]:![]}];}return db['SmsInteraction']['findAll'](_0x379b87);})[_0x4b23('0x1b')](function(_0x4ac8b1){_0xdc78ed[_0x4b23('0x55')]=_0x4ac8b1;return _0xdc78ed;});}})['then'](respondWithFilteredResult(_0x9dbcf5,_0x379b87))[_0x4b23('0x26')](handleError(_0x9dbcf5,null));};exports[_0x4b23('0x3a')]=function(_0x3aa9fc,_0x109a72,_0x49b3b2){var _0x5d343e,_0x1ad8fe,_0x1b87e;if(_[_0x4b23('0x96')](_0x3aa9fc[_0x4b23('0x5b')][_0x4b23('0x5b')])||_0x3aa9fc[_0x4b23('0x5b')][_0x4b23('0x5b')]===''){throw new db[(_0x4b23('0x79'))][(_0x4b23('0x7a'))](_0x4b23('0x97'));}if(_[_0x4b23('0x96')](_0x3aa9fc[_0x4b23('0x5b')]['to'])){throw new db[(_0x4b23('0x79'))]['ValidationError']('to\x20is\x20mandatory');}_0x5d343e=_0x3aa9fc[_0x4b23('0x5b')]['to'];return db[_0x4b23('0x51')][_0x4b23('0x59')]({'where':{'id':_0x3aa9fc[_0x4b23('0x56')]['id']},'include':[{'model':db[_0x4b23('0x9b')],'as':_0x4b23('0xc2'),'include':[{'model':db[_0x4b23('0x78')],'as':_0x4b23('0x9c'),'where':{'mobile':_0x5d343e},'limit':0x1,'order':[[_0x4b23('0x7e'),_0x4b23('0xc3')]]}]}]})[_0x4b23('0x1b')](handleEntityNotFound(_0x109a72,null))[_0x4b23('0x1b')](function(_0x1eca83){if(_0x1eca83&&_0x1eca83[_0x4b23('0xc2')]){_0x1ad8fe=_0x1eca83[_0x4b23('0x34')]({'plain':!![]});if(_0x1ad8fe[_0x4b23('0xc2')]&&_0x1ad8fe['List'][_0x4b23('0x9c')][_0x4b23('0x58')]){return _0x1ad8fe[_0x4b23('0xc2')][_0x4b23('0x9c')][0x0];}return db[_0x4b23('0x78')][_0x4b23('0x5a')](_[_0x4b23('0x15')](_0x3aa9fc[_0x4b23('0x5b')],{'firstName':_0x5d343e,'mobile':_0x5d343e,'phone':_0x5d343e,'ListId':_0x1ad8fe['ListId']}));}})['then'](handleEntityNotFound(_0x109a72,null))['then'](function(_0x1a7095){if(_0x1a7095){_0x1b87e=_0x1a7095;return db[_0x4b23('0x9f')][_0x4b23('0x59')]({'where':{'ContactId':_0x1b87e['id'],'closed':![],'SmsAccountId':_0x1ad8fe['id']}})[_0x4b23('0x1b')](function(_0x533967){if(_0x533967){return[_0x533967,![]];}return db[_0x4b23('0x9f')][_0x4b23('0x5a')]({'UserId':_0x3aa9fc[_0x4b23('0x5c')]['id'],'ContactId':_0x1b87e['id'],'SmsAccountId':_0x1ad8fe['id'],'phone':_0x5d343e,'firstMsgDirection':_0x4b23('0xc4'),'Messages':[_[_0x4b23('0x4e')](_0x3aa9fc[_0x4b23('0x5b')],{'read':![],'body':_0x3aa9fc[_0x4b23('0x5b')]['body'],'phone':_0x5d343e,'SmsAccountId':_0x1ad8fe['id'],'UserId':_0x3aa9fc[_0x4b23('0x5c')]['id'],'ContactId':_0x1b87e['id']})]},{'include':[{'model':db[_0x4b23('0xa7')],'as':'Messages'}]})[_0x4b23('0x1b')](function(_0x14e82e){return[_0x14e82e,!![]];});});}})[_0x4b23('0xa0')](function(_0x570f4f,_0x3d3022){if(_0x3d3022){return _0x570f4f;}return db[_0x4b23('0xa7')][_0x4b23('0x5a')](_['merge'](_0x3aa9fc[_0x4b23('0x5b')],{'read':![],'body':_0x3aa9fc[_0x4b23('0x5b')][_0x4b23('0x5b')],'phone':_0x5d343e,'SmsAccountId':_0x1ad8fe['id'],'SmsInteractionId':_0x570f4f['id'],'UserId':_0x3aa9fc[_0x4b23('0x5c')]['id'],'ContactId':_0x1b87e['id']}))['then'](function(_0x106586){_0x570f4f['dataValues'][_0x4b23('0xc5')]=[];_0x570f4f[_0x4b23('0xc6')][_0x4b23('0xc5')][_0x4b23('0xa3')](_0x106586[_0x4b23('0xc6')]);return _0x570f4f;});})[_0x4b23('0x1b')](respondWithResult(_0x109a72,null))[_0x4b23('0x26')](handleError(_0x109a72,null));};exports[_0x4b23('0x27')]=function(_0x9deea9,_0x181bd3,_0x808289){if(_0x9deea9[_0x4b23('0x5b')]['id']){delete _0x9deea9[_0x4b23('0x5b')]['id'];}var _0x14c59f,_0x53f799,_0x7c1500;return db[_0x4b23('0x51')]['find']({'where':{'id':_0x9deea9['params']['id']}})['then'](handleEntityNotFound(_0x181bd3,null))[_0x4b23('0x1b')](function(_0x38f3d4){if(_0x38f3d4){_0x7c1500=_0x38f3d4;logger['debug'](_0x4b23('0x20'),_0x4b23('0x27'),_0x4b23('0xc7'),_0x38f3d4['type'],util[_0x4b23('0xc8')](_0x9deea9[_0x4b23('0x5b')],{'showHidden':![],'depth':null}));switch(_0x38f3d4[_0x4b23('0x40')]){case _0x4b23('0x86'):if(_0x9deea9['body'][_0x4b23('0xc9')]&&_0x9deea9[_0x4b23('0x5b')]['status']){_0x53f799=_0x9deea9[_0x4b23('0x5b')][_0x4b23('0x27')];return db['SmsMessage'][_0x4b23('0x59')]({'where':{'messageId':_0x9deea9[_0x4b23('0x5b')][_0x4b23('0xc9')]}});}break;case _0x4b23('0xca'):if(_0x9deea9['body']['requestid']&&_0x9deea9['body'][_0x4b23('0xcb')]){_0x53f799=_0x9deea9[_0x4b23('0x5b')]['statusInt'];return db[_0x4b23('0xa7')][_0x4b23('0x59')]({'where':{'messageId':_0x9deea9[_0x4b23('0x5b')][_0x4b23('0xcc')]}});}break;case _0x4b23('0x89'):if(_0x9deea9[_0x4b23('0x5b')]['message_id']&&_0x9deea9[_0x4b23('0x5b')][_0x4b23('0xcd')]){_0x53f799=_0x9deea9[_0x4b23('0x5b')][_0x4b23('0xcd')];return db[_0x4b23('0xa7')][_0x4b23('0x59')]({'where':{'messageId':_0x9deea9['body'][_0x4b23('0x8a')]}});}break;case _0x4b23('0xce'):var _0x5aa30d=_0x9deea9[_0x4b23('0x5b')][_0x4b23('0x8e')][0x0];if(_0x5aa30d['messageId']&&_0x5aa30d[_0x4b23('0x27')][_0x4b23('0xcf')]==='DELIVERED'){_0x53f799=_0x5aa30d[_0x4b23('0x27')][_0x4b23('0xcf')];return db[_0x4b23('0xa7')][_0x4b23('0x59')]({'where':{'messageId':_0x5aa30d[_0x4b23('0x84')]}});}break;case _0x4b23('0x91'):if(_0x9deea9[_0x4b23('0x5b')]['messageId']&&_0x9deea9[_0x4b23('0x5b')][_0x4b23('0x27')]){_0x53f799=_0x9deea9['body'][_0x4b23('0x27')];return db[_0x4b23('0xa7')][_0x4b23('0x59')]({'where':{'messageId':_0x9deea9[_0x4b23('0x5b')]['messageId']}});}break;case'bandwidth':if(_0x9deea9['body'][0x0][_0x4b23('0x24')]['id']){_0x53f799=_0x9deea9[_0x4b23('0x5b')][0x0][_0x4b23('0x40')];return db['SmsMessage'][_0x4b23('0x59')]({'where':{'messageId':_0x9deea9[_0x4b23('0x5b')][0x0][_0x4b23('0x24')]['id']}});}break;case _0x4b23('0xd0'):if(_0x9deea9[_0x4b23('0x5b')][_0x4b23('0xd1')]&&_0x9deea9[_0x4b23('0x5b')]['status']){_0x53f799=_0x9deea9['body'][_0x4b23('0x27')];return db[_0x4b23('0xa7')][_0x4b23('0x59')]({'where':{'messageId':_0x9deea9[_0x4b23('0x5b')]['redif']}});}break;}}})['then'](handleEntityNotFound(_0x181bd3,null))[_0x4b23('0x1b')](function(_0x415d6d){if(_0x415d6d){_0x14c59f=_0x415d6d;switch(_0x7c1500['type']){case _0x4b23('0x86'):if(_0x53f799===_0x4b23('0xd2')){return _0x14c59f[_0x4b23('0x32')]({'read':!![]});}else{logger['error'](_0x4b23('0x20'),_0x4b23('0x27'),'skebby',util[_0x4b23('0xc8')](_0x9deea9[_0x4b23('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x4b23('0xca'):if(_0x53f799==='1'){return _0x14c59f[_0x4b23('0x32')]({'read':!![]});}else{logger[_0x4b23('0x22')](_0x4b23('0x20'),'status','skebby',util[_0x4b23('0xc8')](_0x9deea9['body'],{'showHidden':![],'depth':null}));}break;case _0x4b23('0x89'):if(!_0x9deea9['body']['error_code']&&_0x53f799>=0xc8&&_0x53f799<=0xce){return _0x14c59f[_0x4b23('0x32')]({'read':!![]});}else{logger[_0x4b23('0x22')](_0x4b23('0x20'),'status',_0x4b23('0x89'),util[_0x4b23('0xc8')](_0x9deea9[_0x4b23('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x4b23('0xce'):var _0x3bdc9b=_0x9deea9[_0x4b23('0x5b')][_0x4b23('0x8e')][0x0];if(_0x3bdc9b[_0x4b23('0x27')][_0x4b23('0xcf')]===_0x4b23('0xd2')){return _0x14c59f['update']({'read':!![]});}else{logger[_0x4b23('0x22')](_0x4b23('0x20'),'status','infobip',util['inspect'](_0x9deea9[_0x4b23('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x4b23('0x91'):if(_0x53f799=='DELIVERED_TO_GATEWAY'||_0x53f799==_0x4b23('0xd3')){return _0x14c59f[_0x4b23('0x32')]({'read':!![]});}else{logger['error'](_0x4b23('0x20'),_0x4b23('0x27'),_0x4b23('0x91'),util[_0x4b23('0xc8')](_0x9deea9[_0x4b23('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x4b23('0xd4'):if(_0x53f799==_0x4b23('0xd5')){return _0x14c59f[_0x4b23('0x32')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4b23('0x27'),_0x4b23('0xd4'),util[_0x4b23('0xc8')](_0x9deea9[_0x4b23('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x4b23('0xd0'):if(_0x53f799===_0x4b23('0xd6')||_0x53f799===_0x4b23('0xd7')){return _0x14c59f['update']({'read':!![]});}else{logger[_0x4b23('0x22')](_0x4b23('0x20'),_0x4b23('0x27'),_0x4b23('0xd0'),util[_0x4b23('0xc8')](_0x9deea9[_0x4b23('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x14c59f;}})[_0x4b23('0x1b')](respondWithResult(_0x181bd3,null))[_0x4b23('0x26')](handleError(_0x181bd3,null));};exports[_0x4b23('0xd8')]=function(_0x4e1662,_0x398a23,_0x9e9565){var _0x1f9200,_0x10d8f0,_0x3adcca;return db[_0x4b23('0x51')][_0x4b23('0x59')]({'where':{'id':_0x4e1662[_0x4b23('0x56')]['id']}})['then'](handleEntityNotFound(_0x398a23,null))[_0x4b23('0x1b')](function(_0x3e0430){if(_0x3e0430){_0x3adcca=_0x3e0430;logger['debug'](_0x4b23('0x20'),_0x4b23('0x27'),'received\x20delivery\x20report\x20from',_0x3e0430['type'],util[_0x4b23('0xc8')](_0x4e1662[_0x4b23('0x43')],{'showHidden':![],'depth':null}));switch(_0x3e0430[_0x4b23('0x40')]){case _0x4b23('0x8f'):if(_0x4e1662[_0x4b23('0x43')][_0x4b23('0xd9')]&&_0x4e1662[_0x4b23('0x43')][_0x4b23('0xda')]){_0x10d8f0=_0x4e1662[_0x4b23('0x43')][_0x4b23('0xda')];return db[_0x4b23('0xa7')][_0x4b23('0x59')]({'where':{'messageId':_0x4e1662['query'][_0x4b23('0xd9')]}});}break;}}})[_0x4b23('0x1b')](handleEntityNotFound(_0x398a23,null))[_0x4b23('0x1b')](function(_0x1416d2){if(_0x1416d2){_0x1f9200=_0x1416d2;switch(_0x3adcca[_0x4b23('0x40')]){case _0x4b23('0x8f'):if(_0x10d8f0==='2'||_0x10d8f0==='6'){return _0x1f9200[_0x4b23('0x32')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4b23('0x27'),'csc',util[_0x4b23('0xc8')](_0x4e1662[_0x4b23('0x43')],{'showHidden':![],'depth':null}));};break;}return _0x1f9200;}})[_0x4b23('0x1b')](respondWithResult(_0x398a23,null))[_0x4b23('0x26')](handleError(_0x398a23,null));};exports['addAgents']=function(_0x456763,_0x141379,_0x571779){return db['SmsAccount'][_0x4b23('0x59')]({'where':{'id':_0x456763[_0x4b23('0x56')]['id']}})[_0x4b23('0x1b')](handleEntityNotFound(_0x141379,null))[_0x4b23('0x1b')](function(_0xe7c4cd){if(_0xe7c4cd){return _0xe7c4cd['addAgents'](_0x456763['body'][_0x4b23('0x6b')],_[_0x4b23('0x9d')](_0x456763[_0x4b23('0x5b')],[_0x4b23('0x6b'),'id'])||{})[_0x4b23('0xa0')](function(_0xfc45eb){for(var _0x74ac8f=0x0;_0x74ac8f<_0x456763[_0x4b23('0x5b')]['ids']['length'];_0x74ac8f+=0x1){socket[_0x4b23('0xdb')](_0x4b23('0xdc'),{'UserId':Number(_0x456763[_0x4b23('0x5b')]['ids'][_0x74ac8f]),'SmsAccountId':Number(_0x456763['params']['id'])});}return _0xfc45eb;});}})[_0x4b23('0x1b')](respondWithResult(_0x141379,null))['catch'](handleError(_0x141379,null));};exports[_0x4b23('0xdd')]=function(_0x49cb0e,_0x4c0f14,_0x744060){return db['SmsAccount']['find']({'where':{'id':_0x49cb0e['params']['id']}})[_0x4b23('0x1b')](handleEntityNotFound(_0x4c0f14,null))['then'](function(_0x32808e){if(_0x32808e){return _0x32808e['removeAgents'](_0x49cb0e['query'][_0x4b23('0x6b')])[_0x4b23('0x1b')](function(){if(_['isArray'](_0x49cb0e[_0x4b23('0x43')]['ids'])){for(var _0x5aed78=0x0;_0x5aed78<_0x49cb0e[_0x4b23('0x43')][_0x4b23('0x6b')]['length'];_0x5aed78+=0x1){socket[_0x4b23('0xdb')](_0x4b23('0xde'),{'UserId':Number(_0x49cb0e['query']['ids'][_0x5aed78]),'SmsAccountId':Number(_0x49cb0e['params']['id'])});}}else{socket[_0x4b23('0xdb')](_0x4b23('0xde'),{'UserId':Number(_0x49cb0e[_0x4b23('0x43')]['ids']),'SmsAccountId':Number(_0x49cb0e[_0x4b23('0x56')]['id'])});}});}})[_0x4b23('0x1b')](respondWithStatusCode(_0x4c0f14,null))[_0x4b23('0x26')](handleError(_0x4c0f14,null));};exports[_0x4b23('0xdf')]=function(_0x230bd7,_0x4c1132,_0x214147){var _0x189641={};var _0x454f1e={};var _0x502174;var _0x457e53;return db[_0x4b23('0x51')]['findOne']({'where':{'id':_0x230bd7[_0x4b23('0x56')]['id']}})[_0x4b23('0x1b')](handleEntityNotFound(_0x4c1132,null))['then'](function(_0x2165f3){if(_0x2165f3){_0x502174=_0x2165f3;_0x454f1e[_0x4b23('0x42')]=_[_0x4b23('0x44')](db[_0x4b23('0xab')][_0x4b23('0x57')]);_0x454f1e[_0x4b23('0x43')]=_[_0x4b23('0x44')](_0x230bd7[_0x4b23('0x43')]);_0x454f1e[_0x4b23('0x45')]=_[_0x4b23('0x46')](_0x454f1e[_0x4b23('0x42')],_0x454f1e[_0x4b23('0x43')]);_0x189641[_0x4b23('0x47')]=_[_0x4b23('0x46')](_0x454f1e[_0x4b23('0x42')],qs[_0x4b23('0x48')](_0x230bd7['query'][_0x4b23('0x48')]));_0x189641[_0x4b23('0x47')]=_0x189641[_0x4b23('0x47')][_0x4b23('0x58')]?_0x189641[_0x4b23('0x47')]:_0x454f1e[_0x4b23('0x42')];_0x189641[_0x4b23('0x4a')]=qs[_0x4b23('0x4b')](_0x230bd7[_0x4b23('0x43')]['sort']);_0x189641[_0x4b23('0x4c')]=qs[_0x4b23('0x45')](_[_0x4b23('0x4d')](_0x230bd7[_0x4b23('0x43')],_0x454f1e[_0x4b23('0x45')]));if(_0x230bd7[_0x4b23('0x43')]['filter']){_0x189641[_0x4b23('0x4c')]=_[_0x4b23('0x4e')](_0x189641[_0x4b23('0x4c')],{'$or':_[_0x4b23('0x3e')](_0x189641[_0x4b23('0x47')],function(_0x14d9dd){var _0x445e9b={};_0x445e9b[_0x14d9dd]={'$like':'%'+_0x230bd7[_0x4b23('0x43')][_0x4b23('0x69')]+'%'};return _0x445e9b;})});}_0x189641=_[_0x4b23('0x4e')]({},_0x189641,_0x230bd7[_0x4b23('0x50')]);return _0x502174[_0x4b23('0xdf')](_0x189641);}})[_0x4b23('0x1b')](function(_0x462f24){if(_0x462f24){_0x457e53=_0x462f24[_0x4b23('0x58')];if(!_0x230bd7['query']['hasOwnProperty'](_0x4b23('0x68'))){_0x189641['limit']=qs[_0x4b23('0x2c')](_0x230bd7[_0x4b23('0x43')][_0x4b23('0x2c')]);_0x189641[_0x4b23('0x2a')]=qs[_0x4b23('0x2a')](_0x230bd7['query']['offset']);}return _0x502174[_0x4b23('0xdf')](_0x189641);}})[_0x4b23('0x1b')](function(_0x3b05ad){if(_0x3b05ad){return _0x3b05ad?{'count':_0x457e53,'rows':_0x3b05ad}:null;}})[_0x4b23('0x1b')](respondWithResult(_0x4c1132,null))[_0x4b23('0x26')](handleError(_0x4c1132,null));}; \ No newline at end of file +var _0x3789=['transaction','Transaction','READ_COMMITTED','bulkCreate','findAndCountAll','priority','getApplications','order','getInteractions','fullname','internal','tag','to\x20is\x20mandatory','CmList','List','defaults','out','SmsMessage','Messages','dataValues','debug','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','status_code','groupName','DELIVERED','redif','clicksend','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','message-id','state','addAgents','emit','userSmsAccount:save','isArray','userSmsAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','moment','mustache','util','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','register','client','request','then','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','get','SmsAccounts','UserProfileResource','sendStatus','stack','name','send','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','type','VIRTUAL','merge','SmsAccount','includeAll','include','rows','show','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','Disposition','getDispositions','findOne','findAll','removeDispositions','ids','addAnswer','SmsAccountId','CannedAnswer','getAnswers','removeAnswers','notify','sms','SmsApplication','Applications','account','applications','orderBy','asc','CmContact','Sequelize','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','MessageSid','skebby','text','connectel','messageId','message_id','plivo','From','Text','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','DESC','list','omit','contact','SmsInteraction','spread','interaction','created','autoclose','push','close','*,*,*,*','ContactId','AttachmentId','UserId','User','queueId','SmsQueue','unshift','queue','waitForTheAssignedQueue','Start','startRouting','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','text/xml','\x0a','addApplications','sequelize'];(function(_0x37ac9d,_0xafe035){var _0x2c01a2=function(_0x950449){while(--_0x950449){_0x37ac9d['push'](_0x37ac9d['shift']());}};_0x2c01a2(++_0xafe035);}(_0x3789,0x1f2));var _0x9378=function(_0x17c6de,_0x5ed89b){_0x17c6de=_0x17c6de-0x0;var _0x19fb8f=_0x3789[_0x17c6de];return _0x19fb8f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9378('0x0'));var zipdir=require(_0x9378('0x1'));var jsonpatch=require(_0x9378('0x2'));var rp=require('request-promise');var moment=require(_0x9378('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9378('0x4'));var util=require(_0x9378('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9378('0x6'));var fs=require('fs');var fs_extra=require(_0x9378('0x7'));var _=require('lodash');var squel=require(_0x9378('0x8'));var crypto=require(_0x9378('0x9'));var jsforce=require(_0x9378('0xa'));var deskjs=require(_0x9378('0xb'));var toCsv=require(_0x9378('0xc'));var querystring=require(_0x9378('0xd'));var Papa=require(_0x9378('0xe'));var Redis=require('ioredis');var authService=require(_0x9378('0xf'));var qs=require(_0x9378('0x10'));var as=require(_0x9378('0x11'));var hardwareService=require(_0x9378('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x9378('0x13'));var licenseUtil=require(_0x9378('0x14'));var db=require(_0x9378('0x15'))['db'];config[_0x9378('0x16')]=_['defaults'](config[_0x9378('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x9378('0x17'))(new Redis(config[_0x9378('0x16')]));require('./smsAccount.socket')[_0x9378('0x18')](socket);var jayson=require('jayson/promise');var client=jayson[_0x9378('0x19')]['http']({'port':0x232c});function respondWithRpcPromise(_0xb36906,_0x3a0b46,_0x262dd7,_0x382551){return new BPromise(function(_0x40ea3d,_0x56627b){var _0x49617a=_0x382551||client;return _0x49617a[_0x9378('0x1a')](_0xb36906,_0x262dd7)[_0x9378('0x1b')](function(_0x1991bb){logger['info'](_0x9378('0x1c'),_0x3a0b46,_0x9378('0x1d'));logger['debug'](_0x9378('0x1e'),_0x3a0b46,_0x9378('0x1d'),JSON[_0x9378('0x1f')](_0x1991bb));if(_0x1991bb['error']){if(_0x1991bb[_0x9378('0x20')]['code']===0x1f4){logger[_0x9378('0x20')](_0x9378('0x1c'),_0x3a0b46,_0x1991bb[_0x9378('0x20')][_0x9378('0x21')]);return _0x56627b(_0x1991bb[_0x9378('0x20')][_0x9378('0x21')]);}logger[_0x9378('0x20')](_0x9378('0x1c'),_0x3a0b46,_0x1991bb[_0x9378('0x20')][_0x9378('0x21')]);return _0x40ea3d(_0x1991bb[_0x9378('0x20')][_0x9378('0x21')]);}else{logger[_0x9378('0x22')](_0x9378('0x1c'),_0x3a0b46,_0x9378('0x1d'));_0x40ea3d(_0x1991bb[_0x9378('0x23')]['message']);}})[_0x9378('0x24')](function(_0x437e8e){logger['error']('SmsAccount,\x20%s,\x20%s',_0x3a0b46,_0x437e8e);_0x56627b(_0x437e8e);});});}function respondWithStatusCode(_0x5f058e,_0x4ccd2c){_0x4ccd2c=_0x4ccd2c||0xcc;return function(_0x56a626){if(_0x56a626){return _0x5f058e['sendStatus'](_0x4ccd2c);}return _0x5f058e[_0x9378('0x25')](_0x4ccd2c)[_0x9378('0x26')]();};}function respondWithResult(_0x4c2781,_0x5243f8){_0x5243f8=_0x5243f8||0xc8;return function(_0x3bc43f){if(_0x3bc43f){return _0x4c2781[_0x9378('0x25')](_0x5243f8)[_0x9378('0x27')](_0x3bc43f);}};}function respondWithFilteredResult(_0x1b41a4,_0x34528f){return function(_0xbbc4b5){if(_0xbbc4b5){var _0x22c3f0=typeof _0x34528f['offset']===_0x9378('0x28')&&typeof _0x34528f[_0x9378('0x29')]===_0x9378('0x28');var _0x5ac86d=_0xbbc4b5[_0x9378('0x2a')];var _0x50cda3=_0x22c3f0?0x0:_0x34528f[_0x9378('0x2b')];var _0x4e7097=_0x22c3f0?_0xbbc4b5['count']:_0x34528f[_0x9378('0x2b')]+_0x34528f[_0x9378('0x29')];var _0x45403d;if(_0x4e7097>=_0x5ac86d){_0x4e7097=_0x5ac86d;_0x45403d=0xc8;}else{_0x45403d=0xce;}_0x1b41a4['status'](_0x45403d);return _0x1b41a4[_0x9378('0x2c')](_0x9378('0x2d'),_0x50cda3+'-'+_0x4e7097+'/'+_0x5ac86d)[_0x9378('0x27')](_0xbbc4b5);}return null;};}function patchUpdates(_0x1bd18f){return function(_0x3a8ce0){try{jsonpatch[_0x9378('0x2e')](_0x3a8ce0,_0x1bd18f,!![]);}catch(_0x59d4cc){return BPromise[_0x9378('0x2f')](_0x59d4cc);}return _0x3a8ce0[_0x9378('0x30')]();};}function saveUpdates(_0x1b1399,_0x87c084){return function(_0x274851){if(_0x274851){return _0x274851[_0x9378('0x31')](_0x1b1399)[_0x9378('0x1b')](function(_0xd62e03){return _0xd62e03;});}return null;};}function removeEntity(_0x5e59e2,_0x4263cc){return function(_0x141bba){if(_0x141bba){return _0x141bba[_0x9378('0x32')]()[_0x9378('0x1b')](function(){var _0x1a2173=_0x141bba[_0x9378('0x33')]({'plain':!![]});var _0x23947b=_0x9378('0x34');return db[_0x9378('0x35')]['destroy']({'where':{'type':_0x23947b,'resourceId':_0x1a2173['id']}})['then'](function(){return _0x141bba;});})['then'](function(){_0x5e59e2[_0x9378('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5caf18,_0x70c855){return function(_0x21ee62){if(!_0x21ee62){_0x5caf18[_0x9378('0x36')](0x194);}return _0x21ee62;};}function handleError(_0x1811fa,_0x32d352){_0x32d352=_0x32d352||0x1f4;return function(_0x293547){logger['error'](_0x293547[_0x9378('0x37')]);if(_0x293547[_0x9378('0x38')]){delete _0x293547[_0x9378('0x38')];}_0x1811fa[_0x9378('0x25')](_0x32d352)[_0x9378('0x39')](_0x293547);};}exports['index']=function(_0x44d4ac,_0x31cfcd){var _0x36fa98={'include':[{'model':db[_0x9378('0x3a')],'as':_0x9378('0x3b')}]},_0x2111f0={},_0x47c3b0={'count':0x0,'rows':[]};var _0x49d0b2=_[_0x9378('0x3c')](db['SmsAccount'][_0x9378('0x3d')],function(_0x1179cd){return{'name':_0x1179cd[_0x9378('0x3e')],'type':_0x1179cd['type'][_0x9378('0x3f')]};});_0x2111f0['model']=_[_0x9378('0x3c')](_0x49d0b2,_0x9378('0x38'));_0x2111f0[_0x9378('0x40')]=_[_0x9378('0x41')](_0x44d4ac[_0x9378('0x40')]);_0x2111f0[_0x9378('0x42')]=_[_0x9378('0x43')](_0x2111f0[_0x9378('0x44')],_0x2111f0[_0x9378('0x40')]);_0x36fa98[_0x9378('0x45')]=_['intersection'](_0x2111f0[_0x9378('0x44')],qs[_0x9378('0x46')](_0x44d4ac['query'][_0x9378('0x46')]));_0x36fa98[_0x9378('0x45')]=_0x36fa98[_0x9378('0x45')][_0x9378('0x47')]?_0x36fa98[_0x9378('0x45')]:_0x2111f0[_0x9378('0x44')];if(!_0x44d4ac[_0x9378('0x40')][_0x9378('0x48')](_0x9378('0x49'))){_0x36fa98['limit']=qs[_0x9378('0x29')](_0x44d4ac['query']['limit']);_0x36fa98[_0x9378('0x2b')]=qs[_0x9378('0x2b')](_0x44d4ac[_0x9378('0x40')]['offset']);}_0x36fa98['order']=qs[_0x9378('0x4a')](_0x44d4ac[_0x9378('0x40')]['sort']);_0x36fa98[_0x9378('0x4b')]=qs['filters'](_[_0x9378('0x4c')](_0x44d4ac['query'],_0x2111f0['filters']),_0x49d0b2);if(_0x44d4ac[_0x9378('0x40')][_0x9378('0x4d')]){_0x36fa98[_0x9378('0x4b')]=_['merge'](_0x36fa98[_0x9378('0x4b')],{'$or':_['map'](_0x49d0b2,function(_0x7b0427){if(_0x7b0427[_0x9378('0x4e')]!==_0x9378('0x4f')){var _0x5eb5a2={};_0x5eb5a2[_0x7b0427['name']]={'$like':'%'+_0x44d4ac[_0x9378('0x40')][_0x9378('0x4d')]+'%'};return _0x5eb5a2;}})});}_0x36fa98=_[_0x9378('0x50')]({},_0x36fa98,_0x44d4ac['options']);var _0x406227={'where':_0x36fa98[_0x9378('0x4b')]};return db[_0x9378('0x51')][_0x9378('0x2a')](_0x406227)['then'](function(_0x558159){_0x47c3b0[_0x9378('0x2a')]=_0x558159;if(_0x44d4ac[_0x9378('0x40')][_0x9378('0x52')]){_0x36fa98[_0x9378('0x53')]=[{'all':!![]}];}return db[_0x9378('0x51')]['findAll'](_0x36fa98);})[_0x9378('0x1b')](function(_0x183351){_0x47c3b0[_0x9378('0x54')]=_0x183351;return _0x47c3b0;})['then'](respondWithFilteredResult(_0x31cfcd,_0x36fa98))[_0x9378('0x24')](handleError(_0x31cfcd,null));};exports[_0x9378('0x55')]=function(_0x26fc6a,_0x5b56a0){var _0xaee957={'raw':![],'where':{'id':_0x26fc6a[_0x9378('0x56')]['id']},'include':[{'model':db[_0x9378('0x3a')],'as':_0x9378('0x3b')}]},_0x38fdc7={};_0x38fdc7['model']=_[_0x9378('0x41')](db[_0x9378('0x51')]['rawAttributes']);_0x38fdc7[_0x9378('0x40')]=_['keys'](_0x26fc6a[_0x9378('0x40')]);_0x38fdc7['filters']=_[_0x9378('0x43')](_0x38fdc7[_0x9378('0x44')],_0x38fdc7[_0x9378('0x40')]);_0xaee957[_0x9378('0x45')]=_[_0x9378('0x43')](_0x38fdc7[_0x9378('0x44')],qs[_0x9378('0x46')](_0x26fc6a[_0x9378('0x40')][_0x9378('0x46')]));_0xaee957['attributes']=_0xaee957[_0x9378('0x45')]['length']?_0xaee957[_0x9378('0x45')]:_0x38fdc7[_0x9378('0x44')];if(_0x26fc6a[_0x9378('0x40')][_0x9378('0x52')]){_0xaee957['include']=[{'all':!![]}];}_0xaee957=_[_0x9378('0x50')]({},_0xaee957,_0x26fc6a[_0x9378('0x57')]);return db[_0x9378('0x51')][_0x9378('0x58')](_0xaee957)['then'](handleEntityNotFound(_0x5b56a0,null))[_0x9378('0x1b')](respondWithResult(_0x5b56a0,null))[_0x9378('0x24')](handleError(_0x5b56a0,null));};exports[_0x9378('0x59')]=function(_0x2e4ea6,_0x2b129c){return db[_0x9378('0x51')][_0x9378('0x59')](_0x2e4ea6[_0x9378('0x5a')],{})['then'](function(_0x5999f5){var _0x57e8d7=_0x2e4ea6[_0x9378('0x5b')][_0x9378('0x33')]({'plain':!![]});if(!_0x57e8d7)throw new Error(_0x9378('0x5c'));if(_0x57e8d7[_0x9378('0x5d')]===_0x9378('0x5b')){var _0x4c6127=_0x5999f5[_0x9378('0x33')]({'plain':!![]});var _0x264f6b=_0x9378('0x34');return db['UserProfileSection'][_0x9378('0x58')]({'where':{'name':_0x264f6b,'userProfileId':_0x57e8d7['userProfileId']},'raw':!![]})['then'](function(_0x4efcef){if(_0x4efcef&&_0x4efcef['autoAssociation']===0x0){return db[_0x9378('0x35')][_0x9378('0x59')]({'name':_0x4c6127[_0x9378('0x38')],'resourceId':_0x4c6127['id'],'type':_0x4efcef[_0x9378('0x38')],'sectionId':_0x4efcef['id']},{})[_0x9378('0x1b')](function(){return _0x5999f5;});}else{return _0x5999f5;}})[_0x9378('0x24')](function(_0x5b0e95){logger[_0x9378('0x20')](_0x9378('0x5e'),_0x5b0e95);throw _0x5b0e95;});}return _0x5999f5;})[_0x9378('0x1b')](respondWithResult(_0x2b129c,0xc9))[_0x9378('0x24')](handleError(_0x2b129c,null));};exports['update']=function(_0x11ff5d,_0x3e232f){if(_0x11ff5d[_0x9378('0x5a')]['id']){delete _0x11ff5d[_0x9378('0x5a')]['id'];}return db[_0x9378('0x51')][_0x9378('0x58')]({'where':{'id':_0x11ff5d[_0x9378('0x56')]['id']},'include':[{'model':db[_0x9378('0x3a')],'as':_0x9378('0x3b')}]})[_0x9378('0x1b')](handleEntityNotFound(_0x3e232f,null))[_0x9378('0x1b')](saveUpdates(_0x11ff5d['body'],null))[_0x9378('0x1b')](respondWithResult(_0x3e232f,null))[_0x9378('0x24')](handleError(_0x3e232f,null));};exports[_0x9378('0x32')]=function(_0x588e69,_0x16d568){return db[_0x9378('0x51')]['find']({'where':{'id':_0x588e69[_0x9378('0x56')]['id']}})[_0x9378('0x1b')](handleEntityNotFound(_0x16d568,null))[_0x9378('0x1b')](removeEntity(_0x16d568,null))['catch'](handleError(_0x16d568,null));};exports[_0x9378('0x5f')]=function(_0x3320a6,_0x4cbe2c){return db[_0x9378('0x51')][_0x9378('0x5f')]()[_0x9378('0x1b')](respondWithResult(_0x4cbe2c,null))[_0x9378('0x24')](handleError(_0x4cbe2c,null));};exports['addDisposition']=function(_0x173283,_0x548910,_0x4a0fb6){if(_0x173283[_0x9378('0x5a')]['id']){delete _0x173283[_0x9378('0x5a')]['id'];}return db[_0x9378('0x51')]['find']({'where':{'id':_0x173283[_0x9378('0x56')]['id']}})['then'](handleEntityNotFound(_0x548910,null))['then'](function(_0x43b549){if(_0x43b549){_0x173283[_0x9378('0x5a')]['SmsAccountId']=_0x43b549['id'];return db[_0x9378('0x60')][_0x9378('0x59')](_0x173283[_0x9378('0x5a')]);}})[_0x9378('0x1b')](respondWithResult(_0x548910,null))[_0x9378('0x24')](handleError(_0x548910,null));};exports[_0x9378('0x61')]=function(_0x58a995,_0x209672,_0x27c7cf){var _0x2329af={'raw':![],'where':{}};var _0x230efc={};var _0x36ee95={'count':0x0,'rows':[]};return db[_0x9378('0x51')][_0x9378('0x62')]({'where':{'id':_0x58a995[_0x9378('0x56')]['id']}})[_0x9378('0x1b')](handleEntityNotFound(_0x209672,null))[_0x9378('0x1b')](function(_0x165d1a){if(_0x165d1a){_0x230efc['model']=_[_0x9378('0x41')](db[_0x9378('0x60')]['rawAttributes']);_0x230efc[_0x9378('0x40')]=_[_0x9378('0x41')](_0x58a995[_0x9378('0x40')]);_0x230efc[_0x9378('0x42')]=_[_0x9378('0x43')](_0x230efc[_0x9378('0x44')],_0x230efc[_0x9378('0x40')]);_0x2329af['attributes']=_['intersection'](_0x230efc[_0x9378('0x44')],qs[_0x9378('0x46')](_0x58a995['query']['fields']));_0x2329af['attributes']=_0x2329af['attributes'][_0x9378('0x47')]?_0x2329af[_0x9378('0x45')]:_0x230efc[_0x9378('0x44')];if(!_0x58a995[_0x9378('0x40')][_0x9378('0x48')](_0x9378('0x49'))){_0x2329af[_0x9378('0x29')]=qs[_0x9378('0x29')](_0x58a995['query'][_0x9378('0x29')]);_0x2329af[_0x9378('0x2b')]=qs[_0x9378('0x2b')](_0x58a995[_0x9378('0x40')][_0x9378('0x2b')]);}_0x2329af['order']=qs[_0x9378('0x4a')](_0x58a995[_0x9378('0x40')]['sort']);_0x2329af[_0x9378('0x4b')]=qs[_0x9378('0x42')](_[_0x9378('0x4c')](_0x58a995[_0x9378('0x40')],_0x230efc[_0x9378('0x42')]));_0x2329af[_0x9378('0x4b')]['SmsAccountId']=_0x165d1a['id'];if(_0x58a995[_0x9378('0x40')][_0x9378('0x4d')]){_0x2329af[_0x9378('0x4b')]=_[_0x9378('0x50')](_0x2329af[_0x9378('0x4b')],{'$or':_[_0x9378('0x3c')](_0x2329af[_0x9378('0x45')],function(_0x56aed9){var _0x5523f2={};_0x5523f2[_0x56aed9]={'$like':'%'+_0x58a995[_0x9378('0x40')][_0x9378('0x4d')]+'%'};return _0x5523f2;})});}_0x2329af=_[_0x9378('0x50')]({},_0x2329af,_0x58a995[_0x9378('0x57')]);return db['Disposition'][_0x9378('0x2a')]({'where':_0x2329af[_0x9378('0x4b')]})[_0x9378('0x1b')](function(_0x5db8d9){_0x36ee95[_0x9378('0x2a')]=_0x5db8d9;if(_0x58a995[_0x9378('0x40')]['includeAll']){_0x2329af[_0x9378('0x53')]=[{'all':!![]}];}return db[_0x9378('0x60')][_0x9378('0x63')](_0x2329af);})[_0x9378('0x1b')](function(_0x2da2b0){_0x36ee95['rows']=_0x2da2b0;return _0x36ee95;});}})['then'](respondWithFilteredResult(_0x209672,_0x2329af))[_0x9378('0x24')](handleError(_0x209672,null));};exports[_0x9378('0x64')]=function(_0x3d348b,_0x14e6ba,_0x5ce235){return db[_0x9378('0x51')]['find']({'where':{'id':_0x3d348b[_0x9378('0x56')]['id']}})['then'](handleEntityNotFound(_0x14e6ba,null))[_0x9378('0x1b')](function(_0x35ce65){if(_0x35ce65){return _0x35ce65[_0x9378('0x64')](_0x3d348b[_0x9378('0x40')][_0x9378('0x65')]);}})[_0x9378('0x1b')](respondWithStatusCode(_0x14e6ba,null))[_0x9378('0x24')](handleError(_0x14e6ba,null));};exports[_0x9378('0x66')]=function(_0x477e49,_0x2b268a,_0x317fc9){if(_0x477e49['body']['id']){delete _0x477e49[_0x9378('0x5a')]['id'];}return db[_0x9378('0x51')][_0x9378('0x58')]({'where':{'id':_0x477e49[_0x9378('0x56')]['id']}})[_0x9378('0x1b')](handleEntityNotFound(_0x2b268a,null))[_0x9378('0x1b')](function(_0x335cfb){if(_0x335cfb){_0x477e49[_0x9378('0x5a')][_0x9378('0x67')]=_0x335cfb['id'];return db[_0x9378('0x68')]['create'](_0x477e49[_0x9378('0x5a')]);}})[_0x9378('0x1b')](respondWithResult(_0x2b268a,null))[_0x9378('0x24')](handleError(_0x2b268a,null));};exports[_0x9378('0x69')]=function(_0xcf1bd5,_0x29cd36,_0x38f2f4){var _0x1df29a={'raw':![],'where':{}};var _0x68fc66={};var _0x237656={'count':0x0,'rows':[]};return db[_0x9378('0x51')][_0x9378('0x62')]({'where':{'id':_0xcf1bd5['params']['id']}})[_0x9378('0x1b')](handleEntityNotFound(_0x29cd36,null))[_0x9378('0x1b')](function(_0x595523){if(_0x595523){_0x68fc66[_0x9378('0x44')]=_['keys'](db[_0x9378('0x68')][_0x9378('0x3d')]);_0x68fc66[_0x9378('0x40')]=_[_0x9378('0x41')](_0xcf1bd5['query']);_0x68fc66['filters']=_[_0x9378('0x43')](_0x68fc66[_0x9378('0x44')],_0x68fc66[_0x9378('0x40')]);_0x1df29a[_0x9378('0x45')]=_[_0x9378('0x43')](_0x68fc66[_0x9378('0x44')],qs[_0x9378('0x46')](_0xcf1bd5['query'][_0x9378('0x46')]));_0x1df29a[_0x9378('0x45')]=_0x1df29a[_0x9378('0x45')]['length']?_0x1df29a['attributes']:_0x68fc66['model'];if(!_0xcf1bd5[_0x9378('0x40')][_0x9378('0x48')](_0x9378('0x49'))){_0x1df29a[_0x9378('0x29')]=qs[_0x9378('0x29')](_0xcf1bd5['query'][_0x9378('0x29')]);_0x1df29a[_0x9378('0x2b')]=qs[_0x9378('0x2b')](_0xcf1bd5['query']['offset']);}_0x1df29a['order']=qs[_0x9378('0x4a')](_0xcf1bd5[_0x9378('0x40')][_0x9378('0x4a')]);_0x1df29a['where']=qs['filters'](_[_0x9378('0x4c')](_0xcf1bd5['query'],_0x68fc66[_0x9378('0x42')]));_0x1df29a[_0x9378('0x4b')][_0x9378('0x67')]=_0x595523['id'];if(_0xcf1bd5[_0x9378('0x40')][_0x9378('0x4d')]){_0x1df29a[_0x9378('0x4b')]=_[_0x9378('0x50')](_0x1df29a[_0x9378('0x4b')],{'$or':_[_0x9378('0x3c')](_0x1df29a[_0x9378('0x45')],function(_0x4ca90b){var _0x446a20={};_0x446a20[_0x4ca90b]={'$like':'%'+_0xcf1bd5[_0x9378('0x40')][_0x9378('0x4d')]+'%'};return _0x446a20;})});}_0x1df29a=_['merge']({},_0x1df29a,_0xcf1bd5['options']);return db['CannedAnswer'][_0x9378('0x2a')]({'where':_0x1df29a['where']})['then'](function(_0x1e1c24){_0x237656[_0x9378('0x2a')]=_0x1e1c24;if(_0xcf1bd5[_0x9378('0x40')][_0x9378('0x52')]){_0x1df29a[_0x9378('0x53')]=[{'all':!![]}];}return db['CannedAnswer'][_0x9378('0x63')](_0x1df29a);})['then'](function(_0x2cdd10){_0x237656[_0x9378('0x54')]=_0x2cdd10;return _0x237656;});}})['then'](respondWithFilteredResult(_0x29cd36,_0x1df29a))[_0x9378('0x24')](handleError(_0x29cd36,null));};exports[_0x9378('0x6a')]=function(_0x319c44,_0x5a0690,_0x40e255){return db[_0x9378('0x51')]['find']({'where':{'id':_0x319c44[_0x9378('0x56')]['id']}})['then'](handleEntityNotFound(_0x5a0690,null))[_0x9378('0x1b')](function(_0x6e2f8e){if(_0x6e2f8e){return _0x6e2f8e['removeAnswers'](_0x319c44['query']['ids']);}})[_0x9378('0x1b')](respondWithStatusCode(_0x5a0690,null))['catch'](handleError(_0x5a0690,null));};exports[_0x9378('0x6b')]=function(_0x161235,_0x68bf13,_0x7d8fa5){var _0x107902={'channel':_0x9378('0x6c')};var _0x3d7dd0=[];var _0x5f7585=[];var _0x3ee219={};return db[_0x9378('0x51')][_0x9378('0x58')]({'where':{'id':_0x161235[_0x9378('0x56')]['id']},'include':[{'model':db[_0x9378('0x6d')],'as':_0x9378('0x6e')}]})[_0x9378('0x1b')](handleEntityNotFound(_0x68bf13,null))[_0x9378('0x1b')](function(_0xc43398){_0x107902[_0x9378('0x6f')]=_0xc43398;_0x107902[_0x9378('0x70')]=_[_0x9378('0x71')](_0xc43398[_0x9378('0x6e')],['priority'],[_0x9378('0x72')]);if(_0x107902['account'][_0x9378('0x6e')]){delete _0x107902['account'][_0x9378('0x6e')];}return db[_0x9378('0x73')][_0x9378('0x5f')]();})[_0x9378('0x1b')](function(_0x5e8a39){if(!_0x5e8a39){throw new db[(_0x9378('0x74'))]['ValidationError']('no\x20available\x20attributes');}_0x3d7dd0=_[_0x9378('0x75')](_[_0x9378('0x41')](_0x5e8a39),[_0x9378('0x76'),_0x9378('0x77')]);_0x5f7585=_[_0x9378('0x75')](_[_0x9378('0x41')](_0x5e8a39),[_0x9378('0x76'),_0x9378('0x77'),_0x9378('0x78'),_0x9378('0x79')]);_0x107902[_0x9378('0x5a')]={'mapKey':_0x9378('0x7a')};if(_0x107902['account'][_0x9378('0x4e')]){switch(_0x107902['account'][_0x9378('0x4e')]){case _0x9378('0x7b'):_0x107902['body'][_0x9378('0x7c')]=_0x161235[_0x9378('0x5a')]['From'];_0x107902[_0x9378('0x5a')][_0x9378('0x5a')]=_0x161235[_0x9378('0x5a')]['Body'];_0x107902[_0x9378('0x5a')]['messageId']=_0x161235['body'][_0x9378('0x7d')];break;case _0x9378('0x7e'):_0x107902['body']['from']='+'+_0x161235['body']['sender'];_0x107902[_0x9378('0x5a')][_0x9378('0x5a')]=_0x161235[_0x9378('0x5a')][_0x9378('0x7f')];break;case _0x9378('0x80'):_0x107902[_0x9378('0x5a')][_0x9378('0x7c')]=_0x161235[_0x9378('0x5a')]['from'];_0x107902[_0x9378('0x5a')][_0x9378('0x5a')]=_0x161235[_0x9378('0x5a')][_0x9378('0x21')];break;case'clicksend':_0x107902['body'][_0x9378('0x7c')]=_0x161235[_0x9378('0x5a')][_0x9378('0x7c')];_0x107902[_0x9378('0x5a')][_0x9378('0x5a')]=_0x161235[_0x9378('0x5a')][_0x9378('0x5a')];_0x107902[_0x9378('0x5a')][_0x9378('0x81')]=_0x161235[_0x9378('0x5a')][_0x9378('0x82')];break;case _0x9378('0x83'):_0x107902[_0x9378('0x5a')]['from']=_0x161235[_0x9378('0x5a')][_0x9378('0x84')];_0x107902['body'][_0x9378('0x5a')]=_0x161235['body'][_0x9378('0x85')];_0x107902[_0x9378('0x5a')][_0x9378('0x81')]=_0x161235[_0x9378('0x5a')]['MessageUUID'];break;case _0x9378('0x86'):_0x107902[_0x9378('0x5a')]['from']='+'+_0x161235['body'][_0x9378('0x87')][0x0][_0x9378('0x7c')];_0x107902[_0x9378('0x5a')]['body']=_0x161235[_0x9378('0x5a')][_0x9378('0x87')][0x0][_0x9378('0x7f')];_0x107902[_0x9378('0x5a')][_0x9378('0x81')]=_0x161235['body'][_0x9378('0x87')][0x0][_0x9378('0x81')];break;case _0x9378('0x88'):_0x107902[_0x9378('0x5a')]['from']=_0x161235[_0x9378('0x5a')][_0x9378('0x89')];_0x107902['body'][_0x9378('0x5a')]=_0x161235[_0x9378('0x5a')][_0x9378('0x8a')]['message'];break;case _0x9378('0x8b'):_0x107902['body']['from']=_0x161235[_0x9378('0x5a')][_0x9378('0x8c')];_0x107902[_0x9378('0x5a')][_0x9378('0x5a')]=_0x161235[_0x9378('0x5a')][_0x9378('0x7f')];_0x107902[_0x9378('0x5a')][_0x9378('0x81')]=_0x161235[_0x9378('0x5a')][_0x9378('0x8d')];break;case _0x9378('0x8e'):_0x107902['body']['messageId']=_0x161235['body'][0x0][_0x9378('0x21')]['id'];_0x107902[_0x9378('0x5a')][_0x9378('0x7c')]=_0x161235[_0x9378('0x5a')][0x0]['message'][_0x9378('0x7c')];_0x107902[_0x9378('0x5a')]['body']=_0x161235[_0x9378('0x5a')][0x0][_0x9378('0x21')]['text'];break;case _0x9378('0x8f'):_0x107902[_0x9378('0x5a')][_0x9378('0x7c')]=_0x161235[_0x9378('0x5a')][_0x9378('0x7c')];_0x107902['body'][_0x9378('0x5a')]=_0x161235[_0x9378('0x5a')][_0x9378('0x21')];_0x107902[_0x9378('0x5a')][_0x9378('0x81')]=_0x161235[_0x9378('0x5a')][_0x9378('0x90')];break;}}if(_0x107902[_0x9378('0x5a')]['id']){delete _0x107902[_0x9378('0x5a')]['id'];}if(_[_0x9378('0x91')](_0x107902[_0x9378('0x5a')][_0x9378('0x7c')])){throw new db[(_0x9378('0x74'))][(_0x9378('0x92'))](_0x9378('0x93'));}if(_[_0x9378('0x91')](_0x107902[_0x9378('0x5a')][_0x9378('0x5a')])||_0x107902[_0x9378('0x5a')][_0x9378('0x5a')]===''){throw new db[(_0x9378('0x74'))][(_0x9378('0x92'))](_0x9378('0x94'));}if(_['isNil'](_0x107902['body'][_0x9378('0x95')])){throw new db['Sequelize']['ValidationError'](_0x9378('0x96')+_0x5f7585);}if(!_[_0x9378('0x97')](_0x5f7585,_0x107902[_0x9378('0x5a')][_0x9378('0x95')])){throw new db[(_0x9378('0x74'))][(_0x9378('0x92'))](_0x9378('0x98')+_0x5f7585);}_0x3ee219[_0x107902[_0x9378('0x5a')][_0x9378('0x95')]]=_0x107902['body'][_0x9378('0x7c')];return db['CmList'][_0x9378('0x58')]({'where':{'id':_0x107902[_0x9378('0x6f')]['ListId']},'include':[{'model':db['CmContact'],'as':_0x9378('0x99'),'where':_0x3ee219,'limit':0x1,'order':[['updatedAt',_0x9378('0x9a')]]}]});})[_0x9378('0x1b')](handleEntityNotFound(_0x68bf13,null))[_0x9378('0x1b')](function(_0x43fb19){if(_0x43fb19){_0x107902[_0x9378('0x9b')]=_[_0x9378('0x9c')](_0x43fb19,['Contacts']);if(_0x43fb19[_0x9378('0x99')][_0x9378('0x47')]){return _0x43fb19[_0x9378('0x99')][0x0];}var _0x41d406=_['defaults'](_0x107902[_0x9378('0x5a')],{'firstName':_0x107902[_0x9378('0x5a')][_0x9378('0x7c')],'ListId':_0x43fb19['id']});_0x41d406[_0x107902['body'][_0x9378('0x95')]]=_0x107902[_0x9378('0x5a')][_0x9378('0x7c')];return db[_0x9378('0x73')][_0x9378('0x59')](_0x41d406,{'fields':_0x3d7dd0,'raw':!![]});}})['then'](handleEntityNotFound(_0x68bf13,null))[_0x9378('0x1b')](function(_0xc12601){if(_0xc12601){_0x107902[_0x9378('0x9d')]=_0xc12601;var _0x24dfff={'ContactId':_0xc12601['id'],'phone':_0x107902[_0x9378('0x5a')][_0x9378('0x7c')],'SmsAccountId':_0x161235[_0x9378('0x56')]['id']};var _0x1ba8ef={'ContactId':_0xc12601['id'],'SmsAccountId':_0x161235[_0x9378('0x56')]['id'],'closed':![]};return db['SmsInteraction'][_0x9378('0x58')]({'where':_0x1ba8ef})[_0x9378('0x1b')](function(_0x21e9d4){if(_0x21e9d4){return[_0x21e9d4,![]];}return db[_0x9378('0x9e')][_0x9378('0x59')](_0x24dfff)[_0x9378('0x1b')](function(_0x30f903){return[_0x30f903,!![]];});});}})[_0x9378('0x9f')](function(_0x5ddef6,_0x43398a){_0x107902[_0x9378('0xa0')]=_0x5ddef6[_0x9378('0x33')]({'plain':!![]});_0x107902[_0x9378('0xa0')][_0x9378('0xa1')]=![];if(_0x43398a){if(_0x107902['account'][_0x9378('0xa2')]){_0x107902['applications'][_0x9378('0xa3')]({'id':0x0,'priority':_0x107902[_0x9378('0x70')]['length']+0x1,'app':_0x9378('0xa4'),'appdata':'unmanaged','interval':_0x9378('0xa5')});}_0x107902['interaction'][_0x9378('0xa1')]=!![];}return db['SmsMessage'][_0x9378('0x59')]({'phone':_0x107902['body'][_0x9378('0x7c')],'messageId':_0x107902[_0x9378('0x5a')][_0x9378('0x81')],'body':_0x107902['body'][_0x9378('0x5a')],'SmsAccountId':_0x161235[_0x9378('0x56')]['id'],'SmsInteractionId':_0x5ddef6['id'],'direction':'in','ContactId':_0x5ddef6[_0x9378('0xa6')],'AttachmentId':_0x107902[_0x9378('0x5a')][_0x9378('0xa7')]});})[_0x9378('0x1b')](function(_0x212b55){_0x107902[_0x9378('0x21')]=_0x212b55;if(!_0x107902[_0x9378('0xa0')][_0x9378('0xa8')])return;return db[_0x9378('0xa9')][_0x9378('0x58')]({'attributes':['id',_0x9378('0x38')],'where':{'id':_0x107902[_0x9378('0xa0')]['UserId']}});})[_0x9378('0x1b')](function(_0x40115c){if(_0x40115c){_0x107902[_0x9378('0x70')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x40115c[_0x9378('0x38')]+','+(_0x107902[_0x9378('0x6f')]['waitForTheAssignedAgent']||0xa),'interval':_0x9378('0xa5')});}if(!_0x107902['interaction'][_0x9378('0xaa')])return;return db[_0x9378('0xab')][_0x9378('0x58')]({'attributes':['id','name'],'where':{'id':_0x107902['interaction']['queueId']}});})[_0x9378('0x1b')](function(_0x321dbe){if(_0x321dbe){_0x107902['applications'][_0x9378('0xac')]({'id':0x0,'priority':0x1,'app':_0x9378('0xad'),'appdata':_0x321dbe[_0x9378('0x38')]+','+(_0x107902['account'][_0x9378('0xae')]||0x12c),'interval':_0x9378('0xa5')});}return respondWithRpcPromise(_0x9378('0xaf'),_0x9378('0xb0'),_0x107902);})[_0x9378('0x1b')](function(_0x57484b){if(_0x57484b){var _0x1593b4=0xc8;var _0x5530af='receiveMessage';logger['info'](_0x9378('0x1e'),_0x5530af,_0x1593b4,'entity\x20found');logger['debug'](_0x9378('0xb1'),_0x5530af,_0x1593b4,_0x9378('0xb2'),JSON[_0x9378('0x1f')](_0x57484b));if(_0x107902[_0x9378('0x6f')][_0x9378('0x4e')]===_0x9378('0x7b')){return _0x68bf13[_0x9378('0x25')](_0x1593b4)[_0x9378('0x2c')]('Content-Type',_0x9378('0xb3'))['send'](_0x9378('0xb4'));}else{return _0x68bf13['status'](_0x1593b4)[_0x9378('0x27')](_0x57484b);}}})['catch'](handleError(_0x68bf13,null));};exports[_0x9378('0xb5')]=function(_0x127745,_0x2901e6){var _0x325622=_0x127745[_0x9378('0x56')]['id'];var _0x2547d5=_0x127745[_0x9378('0x5a')];var _0x51c2d6=0xc8;var _0x3e62dd=null;return db[_0x9378('0xb6')][_0x9378('0xb7')]({'isolationLevel':db[_0x9378('0xb6')][_0x9378('0xb8')]['ISOLATION_LEVELS'][_0x9378('0xb9')]},function(_0x9d7ba2){return db['SmsAccount'][_0x9378('0x62')]({'where':{'id':_0x325622},'transaction':_0x9d7ba2})[_0x9378('0x1b')](function(_0x2e120b){if(_0x2e120b){return db[_0x9378('0x6d')]['destroy']({'where':{'SmsAccountId':_0x325622},'transaction':_0x9d7ba2})[_0x9378('0x1b')](function(){var _0xbc83a7=_[_0x9378('0x3c')](_0x2547d5,function(_0x3d0014){_0x3d0014[_0x9378('0x67')]=_0x325622;return _0x3d0014;});return db[_0x9378('0x6d')][_0x9378('0xba')](_0xbc83a7,{'transaction':_0x9d7ba2});});}else{_0x51c2d6=0x194;_0x3e62dd=[];}});})[_0x9378('0x1b')](function(){if(_0x51c2d6!==0x194){return db[_0x9378('0x6d')][_0x9378('0xbb')]({'where':{'SmsAccountId':_0x325622},'order':_0x9378('0xbc')})[_0x9378('0x1b')](function(_0x1174b2){_0x3e62dd=_0x1174b2;});}})[_0x9378('0x24')](function(_0x212640){_0x51c2d6=0x1f4;logger['error'](_0x212640[_0x9378('0x37')]);if(_0x212640[_0x9378('0x38')]){delete _0x212640[_0x9378('0x38')];}_0x3e62dd=_0x212640;})['finally'](function(){if(_0x3e62dd===null){_0x2901e6['sendStatus'](_0x51c2d6);}else{if(_0x51c2d6===0x1f4){_0x2901e6[_0x9378('0x25')](_0x51c2d6)['send'](_0x3e62dd);}else{_0x2901e6['status'](_0x51c2d6)['json'](_0x3e62dd);}}});};exports[_0x9378('0xbd')]=function(_0x3c41fc,_0x59ea64,_0x2ceb21){var _0x480c08={};var _0x7392b1={};var _0x213940;var _0x36e2e7;return db[_0x9378('0x51')][_0x9378('0x62')]({'where':{'id':_0x3c41fc[_0x9378('0x56')]['id']}})[_0x9378('0x1b')](handleEntityNotFound(_0x59ea64,null))['then'](function(_0x3384d1){if(_0x3384d1){_0x213940=_0x3384d1;_0x7392b1['model']=_['keys'](db[_0x9378('0x6d')][_0x9378('0x3d')]);_0x7392b1[_0x9378('0x40')]=_[_0x9378('0x41')](_0x3c41fc[_0x9378('0x40')]);_0x7392b1[_0x9378('0x42')]=_[_0x9378('0x43')](_0x7392b1[_0x9378('0x44')],_0x7392b1['query']);_0x480c08[_0x9378('0x45')]=_[_0x9378('0x43')](_0x7392b1[_0x9378('0x44')],qs[_0x9378('0x46')](_0x3c41fc['query'][_0x9378('0x46')]));_0x480c08[_0x9378('0x45')]=_0x480c08[_0x9378('0x45')][_0x9378('0x47')]?_0x480c08['attributes']:_0x7392b1[_0x9378('0x44')];_0x480c08[_0x9378('0xbe')]=qs[_0x9378('0x4a')](_0x3c41fc[_0x9378('0x40')][_0x9378('0x4a')]);_0x480c08['where']=qs[_0x9378('0x42')](_[_0x9378('0x4c')](_0x3c41fc[_0x9378('0x40')],_0x7392b1[_0x9378('0x42')]));if(_0x3c41fc[_0x9378('0x40')][_0x9378('0x4d')]){_0x480c08[_0x9378('0x4b')]=_[_0x9378('0x50')](_0x480c08[_0x9378('0x4b')],{'$or':_[_0x9378('0x3c')](_0x480c08['attributes'],function(_0x5efc9a){var _0x3d7777={};_0x3d7777[_0x5efc9a]={'$like':'%'+_0x3c41fc[_0x9378('0x40')][_0x9378('0x4d')]+'%'};return _0x3d7777;})});}_0x480c08=_[_0x9378('0x50')]({},_0x480c08,_0x3c41fc[_0x9378('0x57')]);return _0x213940[_0x9378('0xbd')](_0x480c08);}})[_0x9378('0x1b')](function(_0x25fd5d){if(_0x25fd5d){_0x36e2e7=_0x25fd5d[_0x9378('0x47')];if(!_0x3c41fc['query'][_0x9378('0x48')](_0x9378('0x49'))){_0x480c08[_0x9378('0x29')]=qs[_0x9378('0x29')](_0x3c41fc[_0x9378('0x40')][_0x9378('0x29')]);_0x480c08[_0x9378('0x2b')]=qs[_0x9378('0x2b')](_0x3c41fc[_0x9378('0x40')][_0x9378('0x2b')]);}return _0x213940[_0x9378('0xbd')](_0x480c08);}})['then'](function(_0x328915){if(_0x328915){return _0x328915?{'count':_0x36e2e7,'rows':_0x328915}:null;}})[_0x9378('0x1b')](respondWithResult(_0x59ea64,null))['catch'](handleError(_0x59ea64,null));};exports[_0x9378('0xbf')]=function(_0x599d68,_0xc26f4f,_0x5ab610){var _0x6de770={'raw':![],'where':{}};var _0x18e280={};var _0x43a6b7={'count':0x0,'rows':[]};return db[_0x9378('0x51')][_0x9378('0x62')]({'where':{'id':_0x599d68[_0x9378('0x56')]['id']}})[_0x9378('0x1b')](handleEntityNotFound(_0xc26f4f,null))[_0x9378('0x1b')](function(_0x3b617a){if(_0x3b617a){_0x18e280[_0x9378('0x44')]=_['keys'](db[_0x9378('0x9e')][_0x9378('0x3d')]);_0x18e280['query']=_[_0x9378('0x41')](_0x599d68['query']);_0x18e280[_0x9378('0x42')]=_[_0x9378('0x43')](_0x18e280[_0x9378('0x44')],_0x18e280[_0x9378('0x40')]);_0x6de770[_0x9378('0x45')]=_[_0x9378('0x43')](_0x18e280[_0x9378('0x44')],qs[_0x9378('0x46')](_0x599d68[_0x9378('0x40')][_0x9378('0x46')]));_0x6de770[_0x9378('0x45')]=_0x6de770[_0x9378('0x45')][_0x9378('0x47')]?_0x6de770[_0x9378('0x45')]:_0x18e280[_0x9378('0x44')];if(!_0x599d68['query'][_0x9378('0x48')](_0x9378('0x49'))){_0x6de770['limit']=qs[_0x9378('0x29')](_0x599d68[_0x9378('0x40')][_0x9378('0x29')]);_0x6de770[_0x9378('0x2b')]=qs['offset'](_0x599d68['query'][_0x9378('0x2b')]);}_0x6de770[_0x9378('0xbe')]=qs[_0x9378('0x4a')](_0x599d68['query'][_0x9378('0x4a')]);_0x6de770[_0x9378('0x4b')]=qs[_0x9378('0x42')](_[_0x9378('0x4c')](_0x599d68['query'],_0x18e280[_0x9378('0x42')]));_0x6de770[_0x9378('0x4b')][_0x9378('0x67')]=_0x3b617a['id'];if(_0x599d68['query'][_0x9378('0x4d')]){_0x6de770[_0x9378('0x4b')]=_[_0x9378('0x50')](_0x6de770[_0x9378('0x4b')],{'$or':_[_0x9378('0x3c')](_0x6de770['attributes'],function(_0x3b1015){var _0x339198={};_0x339198[_0x3b1015]={'$like':'%'+_0x599d68['query'][_0x9378('0x4d')]+'%'};return _0x339198;})});}_0x6de770=_[_0x9378('0x50')]({},_0x6de770,_0x599d68['options']);return db[_0x9378('0x9e')][_0x9378('0x2a')]({'where':_0x6de770[_0x9378('0x4b')]})[_0x9378('0x1b')](function(_0x419d10){_0x43a6b7['count']=_0x419d10;if(_0x599d68['query'][_0x9378('0x52')]){_0x6de770[_0x9378('0x53')]=[{'model':db[_0x9378('0x73')],'as':'Contact','required':![]},{'model':db[_0x9378('0xa9')],'as':'Owner','attributes':[_0x9378('0x38'),_0x9378('0xc0'),_0x9378('0xc1')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x9378('0x38'),'color'],'where':_0x599d68['query'][_0x9378('0xc2')]?{'id':_0x599d68[_0x9378('0x40')][_0x9378('0xc2')]}:undefined,'required':_0x599d68[_0x9378('0x40')]['tag']?!![]:![]}];}return db['SmsInteraction'][_0x9378('0x63')](_0x6de770);})[_0x9378('0x1b')](function(_0x5e11be){_0x43a6b7[_0x9378('0x54')]=_0x5e11be;return _0x43a6b7;});}})['then'](respondWithFilteredResult(_0xc26f4f,_0x6de770))[_0x9378('0x24')](handleError(_0xc26f4f,null));};exports[_0x9378('0x39')]=function(_0x2da856,_0x1882d4,_0x66ad8e){var _0x13b009,_0x3ce0f9,_0x4eb64e;if(_[_0x9378('0x91')](_0x2da856[_0x9378('0x5a')][_0x9378('0x5a')])||_0x2da856[_0x9378('0x5a')][_0x9378('0x5a')]===''){throw new db[(_0x9378('0x74'))][(_0x9378('0x92'))](_0x9378('0x94'));}if(_[_0x9378('0x91')](_0x2da856[_0x9378('0x5a')]['to'])){throw new db[(_0x9378('0x74'))][(_0x9378('0x92'))](_0x9378('0xc3'));}_0x13b009=_0x2da856[_0x9378('0x5a')]['to'];return db[_0x9378('0x51')][_0x9378('0x58')]({'where':{'id':_0x2da856[_0x9378('0x56')]['id']},'include':[{'model':db[_0x9378('0xc4')],'as':'List','include':[{'model':db[_0x9378('0x73')],'as':_0x9378('0x99'),'where':{'mobile':_0x13b009},'limit':0x1,'order':[[_0x9378('0x77'),_0x9378('0x9a')]]}]}]})['then'](handleEntityNotFound(_0x1882d4,null))['then'](function(_0x1a1334){if(_0x1a1334&&_0x1a1334['List']){_0x3ce0f9=_0x1a1334[_0x9378('0x33')]({'plain':!![]});if(_0x3ce0f9['List']&&_0x3ce0f9[_0x9378('0xc5')][_0x9378('0x99')][_0x9378('0x47')]){return _0x3ce0f9[_0x9378('0xc5')][_0x9378('0x99')][0x0];}return db[_0x9378('0x73')][_0x9378('0x59')](_[_0x9378('0xc6')](_0x2da856[_0x9378('0x5a')],{'firstName':_0x13b009,'mobile':_0x13b009,'phone':_0x13b009,'ListId':_0x3ce0f9[_0x9378('0x79')]}));}})[_0x9378('0x1b')](handleEntityNotFound(_0x1882d4,null))[_0x9378('0x1b')](function(_0x564c55){if(_0x564c55){_0x4eb64e=_0x564c55;return db[_0x9378('0x9e')][_0x9378('0x58')]({'where':{'ContactId':_0x4eb64e['id'],'closed':![],'SmsAccountId':_0x3ce0f9['id']}})[_0x9378('0x1b')](function(_0x38a036){if(_0x38a036){return[_0x38a036,![]];}return db[_0x9378('0x9e')]['create']({'UserId':_0x2da856['user']['id'],'ContactId':_0x4eb64e['id'],'SmsAccountId':_0x3ce0f9['id'],'phone':_0x13b009,'firstMsgDirection':_0x9378('0xc7'),'Messages':[_[_0x9378('0x50')](_0x2da856['body'],{'read':![],'body':_0x2da856[_0x9378('0x5a')][_0x9378('0x5a')],'phone':_0x13b009,'SmsAccountId':_0x3ce0f9['id'],'UserId':_0x2da856[_0x9378('0x5b')]['id'],'ContactId':_0x4eb64e['id']})]},{'include':[{'model':db[_0x9378('0xc8')],'as':_0x9378('0xc9')}]})['then'](function(_0x5acb13){return[_0x5acb13,!![]];});});}})[_0x9378('0x9f')](function(_0x57d774,_0x46664d){if(_0x46664d){return _0x57d774;}return db[_0x9378('0xc8')][_0x9378('0x59')](_[_0x9378('0x50')](_0x2da856['body'],{'read':![],'body':_0x2da856[_0x9378('0x5a')][_0x9378('0x5a')],'phone':_0x13b009,'SmsAccountId':_0x3ce0f9['id'],'SmsInteractionId':_0x57d774['id'],'UserId':_0x2da856['user']['id'],'ContactId':_0x4eb64e['id']}))[_0x9378('0x1b')](function(_0x132dc0){_0x57d774[_0x9378('0xca')][_0x9378('0xc9')]=[];_0x57d774['dataValues'][_0x9378('0xc9')][_0x9378('0xa3')](_0x132dc0['dataValues']);return _0x57d774;});})['then'](respondWithResult(_0x1882d4,null))[_0x9378('0x24')](handleError(_0x1882d4,null));};exports['status']=function(_0x597e6f,_0x3677bd,_0x14580b){if(_0x597e6f['body']['id']){delete _0x597e6f[_0x9378('0x5a')]['id'];}var _0x2eea21,_0x5439c8,_0x5d9c33;return db['SmsAccount']['find']({'where':{'id':_0x597e6f[_0x9378('0x56')]['id']}})[_0x9378('0x1b')](handleEntityNotFound(_0x3677bd,null))[_0x9378('0x1b')](function(_0x23b07){if(_0x23b07){_0x5d9c33=_0x23b07;logger[_0x9378('0xcb')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x9378('0x25'),_0x9378('0xcc'),_0x23b07[_0x9378('0x4e')],util[_0x9378('0xcd')](_0x597e6f['body'],{'showHidden':![],'depth':null}));switch(_0x23b07[_0x9378('0x4e')]){case _0x9378('0x7e'):if(_0x597e6f[_0x9378('0x5a')][_0x9378('0xce')]&&_0x597e6f[_0x9378('0x5a')][_0x9378('0x25')]){_0x5439c8=_0x597e6f[_0x9378('0x5a')][_0x9378('0x25')];return db['SmsMessage'][_0x9378('0x58')]({'where':{'messageId':_0x597e6f[_0x9378('0x5a')]['skebby_dispatch_id']}});}break;case'connectel':if(_0x597e6f[_0x9378('0x5a')][_0x9378('0xcf')]&&_0x597e6f['body']['statusInt']){_0x5439c8=_0x597e6f[_0x9378('0x5a')][_0x9378('0xd0')];return db[_0x9378('0xc8')][_0x9378('0x58')]({'where':{'messageId':_0x597e6f[_0x9378('0x5a')][_0x9378('0xcf')]}});}break;case'clicksend':if(_0x597e6f[_0x9378('0x5a')][_0x9378('0x82')]&&_0x597e6f['body'][_0x9378('0xd1')]){_0x5439c8=_0x597e6f[_0x9378('0x5a')][_0x9378('0xd1')];return db[_0x9378('0xc8')][_0x9378('0x58')]({'where':{'messageId':_0x597e6f[_0x9378('0x5a')][_0x9378('0x82')]}});}break;case'infobip':var _0x2f49e0=_0x597e6f['body'][_0x9378('0x87')][0x0];if(_0x2f49e0[_0x9378('0x81')]&&_0x2f49e0[_0x9378('0x25')][_0x9378('0xd2')]===_0x9378('0xd3')){_0x5439c8=_0x2f49e0[_0x9378('0x25')][_0x9378('0xd2')];return db[_0x9378('0xc8')][_0x9378('0x58')]({'where':{'messageId':_0x2f49e0[_0x9378('0x81')]}});}break;case _0x9378('0x8b'):if(_0x597e6f[_0x9378('0x5a')][_0x9378('0x81')]&&_0x597e6f['body'][_0x9378('0x25')]){_0x5439c8=_0x597e6f['body']['status'];return db[_0x9378('0xc8')][_0x9378('0x58')]({'where':{'messageId':_0x597e6f['body']['messageId']}});}break;case _0x9378('0x8e'):if(_0x597e6f[_0x9378('0x5a')][0x0]['message']['id']){_0x5439c8=_0x597e6f['body'][0x0][_0x9378('0x4e')];return db[_0x9378('0xc8')][_0x9378('0x58')]({'where':{'messageId':_0x597e6f['body'][0x0][_0x9378('0x21')]['id']}});}break;case _0x9378('0x8f'):if(_0x597e6f[_0x9378('0x5a')][_0x9378('0xd4')]&&_0x597e6f[_0x9378('0x5a')][_0x9378('0x25')]){_0x5439c8=_0x597e6f[_0x9378('0x5a')]['status'];return db[_0x9378('0xc8')]['find']({'where':{'messageId':_0x597e6f[_0x9378('0x5a')]['redif']}});}break;}}})[_0x9378('0x1b')](handleEntityNotFound(_0x3677bd,null))[_0x9378('0x1b')](function(_0x2a7a89){if(_0x2a7a89){_0x2eea21=_0x2a7a89;switch(_0x5d9c33[_0x9378('0x4e')]){case _0x9378('0x7e'):if(_0x5439c8===_0x9378('0xd3')){return _0x2eea21[_0x9378('0x31')]({'read':!![]});}else{logger[_0x9378('0x20')](_0x9378('0x1e'),'status',_0x9378('0x7e'),util[_0x9378('0xcd')](_0x597e6f[_0x9378('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x9378('0x80'):if(_0x5439c8==='1'){return _0x2eea21[_0x9378('0x31')]({'read':!![]});}else{logger[_0x9378('0x20')](_0x9378('0x1e'),_0x9378('0x25'),'skebby',util['inspect'](_0x597e6f['body'],{'showHidden':![],'depth':null}));}break;case _0x9378('0xd5'):if(!_0x597e6f['body'][_0x9378('0xd6')]&&_0x5439c8>=0xc8&&_0x5439c8<=0xce){return _0x2eea21[_0x9378('0x31')]({'read':!![]});}else{logger['error'](_0x9378('0x1e'),_0x9378('0x25'),_0x9378('0xd5'),util[_0x9378('0xcd')](_0x597e6f[_0x9378('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x9378('0x86'):var _0x1df8ca=_0x597e6f[_0x9378('0x5a')][_0x9378('0x87')][0x0];if(_0x1df8ca[_0x9378('0x25')][_0x9378('0xd2')]===_0x9378('0xd3')){return _0x2eea21[_0x9378('0x31')]({'read':!![]});}else{logger['error'](_0x9378('0x1e'),_0x9378('0x25'),_0x9378('0x86'),util['inspect'](_0x597e6f[_0x9378('0x5a')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x5439c8==_0x9378('0xd7')||_0x5439c8==_0x9378('0xd8')){return _0x2eea21[_0x9378('0x31')]({'read':!![]});}else{logger[_0x9378('0x20')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x9378('0x8b'),util[_0x9378('0xcd')](_0x597e6f[_0x9378('0x5a')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x5439c8==_0x9378('0xd9')){return _0x2eea21['update']({'read':!![]});}else{logger[_0x9378('0x20')](_0x9378('0x1e'),_0x9378('0x25'),_0x9378('0x8e'),util[_0x9378('0xcd')](_0x597e6f['body'],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x5439c8===_0x9378('0xda')||_0x5439c8==='ACCEPTD'){return _0x2eea21['update']({'read':!![]});}else{logger[_0x9378('0x20')](_0x9378('0x1e'),_0x9378('0x25'),'intelepeer',util[_0x9378('0xcd')](_0x597e6f['body'],{'showHidden':![],'depth':null}));}break;}return _0x2eea21;}})['then'](respondWithResult(_0x3677bd,null))['catch'](handleError(_0x3677bd,null));};exports['statusGet']=function(_0x1f8fc1,_0x38c1dc,_0x5807f1){var _0x1ca234,_0x4d8efe,_0x1f8437;return db[_0x9378('0x51')]['find']({'where':{'id':_0x1f8fc1['params']['id']}})[_0x9378('0x1b')](handleEntityNotFound(_0x38c1dc,null))[_0x9378('0x1b')](function(_0x104842){if(_0x104842){_0x1f8437=_0x104842;logger['debug'](_0x9378('0x1e'),_0x9378('0x25'),_0x9378('0xcc'),_0x104842[_0x9378('0x4e')],util[_0x9378('0xcd')](_0x1f8fc1[_0x9378('0x40')],{'showHidden':![],'depth':null}));switch(_0x104842[_0x9378('0x4e')]){case'csc':if(_0x1f8fc1[_0x9378('0x40')][_0x9378('0xdb')]&&_0x1f8fc1[_0x9378('0x40')][_0x9378('0xdc')]){_0x4d8efe=_0x1f8fc1[_0x9378('0x40')][_0x9378('0xdc')];return db[_0x9378('0xc8')][_0x9378('0x58')]({'where':{'messageId':_0x1f8fc1['query'][_0x9378('0xdb')]}});}break;}}})['then'](handleEntityNotFound(_0x38c1dc,null))[_0x9378('0x1b')](function(_0x459d9a){if(_0x459d9a){_0x1ca234=_0x459d9a;switch(_0x1f8437['type']){case _0x9378('0x88'):if(_0x4d8efe==='2'||_0x4d8efe==='6'){return _0x1ca234[_0x9378('0x31')]({'read':!![]});}else{logger[_0x9378('0x20')](_0x9378('0x1e'),_0x9378('0x25'),_0x9378('0x88'),util['inspect'](_0x1f8fc1[_0x9378('0x40')],{'showHidden':![],'depth':null}));};break;}return _0x1ca234;}})[_0x9378('0x1b')](respondWithResult(_0x38c1dc,null))[_0x9378('0x24')](handleError(_0x38c1dc,null));};exports[_0x9378('0xdd')]=function(_0x443d79,_0x232935,_0x343f41){return db[_0x9378('0x51')][_0x9378('0x58')]({'where':{'id':_0x443d79[_0x9378('0x56')]['id']}})[_0x9378('0x1b')](handleEntityNotFound(_0x232935,null))[_0x9378('0x1b')](function(_0x3127ae){if(_0x3127ae){return _0x3127ae['addAgents'](_0x443d79['body'][_0x9378('0x65')],_[_0x9378('0x9c')](_0x443d79[_0x9378('0x5a')],[_0x9378('0x65'),'id'])||{})[_0x9378('0x9f')](function(_0x13ace7){for(var _0x1cd33e=0x0;_0x1cd33e<_0x443d79['body'][_0x9378('0x65')]['length'];_0x1cd33e+=0x1){socket[_0x9378('0xde')](_0x9378('0xdf'),{'UserId':Number(_0x443d79[_0x9378('0x5a')][_0x9378('0x65')][_0x1cd33e]),'SmsAccountId':Number(_0x443d79[_0x9378('0x56')]['id'])});}return _0x13ace7;});}})['then'](respondWithResult(_0x232935,null))[_0x9378('0x24')](handleError(_0x232935,null));};exports['removeAgents']=function(_0x453cab,_0x1cdfd2,_0xcfaff6){return db[_0x9378('0x51')][_0x9378('0x58')]({'where':{'id':_0x453cab[_0x9378('0x56')]['id']}})[_0x9378('0x1b')](handleEntityNotFound(_0x1cdfd2,null))[_0x9378('0x1b')](function(_0xfe92ad){if(_0xfe92ad){return _0xfe92ad['removeAgents'](_0x453cab[_0x9378('0x40')][_0x9378('0x65')])[_0x9378('0x1b')](function(){if(_[_0x9378('0xe0')](_0x453cab[_0x9378('0x40')]['ids'])){for(var _0x36792b=0x0;_0x36792b<_0x453cab['query']['ids'][_0x9378('0x47')];_0x36792b+=0x1){socket[_0x9378('0xde')](_0x9378('0xe1'),{'UserId':Number(_0x453cab[_0x9378('0x40')][_0x9378('0x65')][_0x36792b]),'SmsAccountId':Number(_0x453cab['params']['id'])});}}else{socket['emit'](_0x9378('0xe1'),{'UserId':Number(_0x453cab['query'][_0x9378('0x65')]),'SmsAccountId':Number(_0x453cab[_0x9378('0x56')]['id'])});}});}})[_0x9378('0x1b')](respondWithStatusCode(_0x1cdfd2,null))[_0x9378('0x24')](handleError(_0x1cdfd2,null));};exports[_0x9378('0xe2')]=function(_0x26ee43,_0x3377d9,_0x345c79){var _0x11d97c={};var _0x4794f1={};var _0x25a234;var _0x3e57e3;return db[_0x9378('0x51')][_0x9378('0x62')]({'where':{'id':_0x26ee43['params']['id']}})['then'](handleEntityNotFound(_0x3377d9,null))[_0x9378('0x1b')](function(_0x10ba4a){if(_0x10ba4a){_0x25a234=_0x10ba4a;_0x4794f1['model']=_[_0x9378('0x41')](db[_0x9378('0xa9')]['rawAttributes']);_0x4794f1[_0x9378('0x40')]=_[_0x9378('0x41')](_0x26ee43[_0x9378('0x40')]);_0x4794f1['filters']=_[_0x9378('0x43')](_0x4794f1[_0x9378('0x44')],_0x4794f1[_0x9378('0x40')]);_0x11d97c[_0x9378('0x45')]=_['intersection'](_0x4794f1[_0x9378('0x44')],qs[_0x9378('0x46')](_0x26ee43[_0x9378('0x40')][_0x9378('0x46')]));_0x11d97c[_0x9378('0x45')]=_0x11d97c['attributes']['length']?_0x11d97c[_0x9378('0x45')]:_0x4794f1['model'];_0x11d97c[_0x9378('0xbe')]=qs[_0x9378('0x4a')](_0x26ee43[_0x9378('0x40')][_0x9378('0x4a')]);_0x11d97c[_0x9378('0x4b')]=qs[_0x9378('0x42')](_[_0x9378('0x4c')](_0x26ee43[_0x9378('0x40')],_0x4794f1[_0x9378('0x42')]));if(_0x26ee43[_0x9378('0x40')][_0x9378('0x4d')]){_0x11d97c[_0x9378('0x4b')]=_[_0x9378('0x50')](_0x11d97c[_0x9378('0x4b')],{'$or':_['map'](_0x11d97c[_0x9378('0x45')],function(_0x3ae732){var _0xa21355={};_0xa21355[_0x3ae732]={'$like':'%'+_0x26ee43[_0x9378('0x40')][_0x9378('0x4d')]+'%'};return _0xa21355;})});}_0x11d97c=_[_0x9378('0x50')]({},_0x11d97c,_0x26ee43[_0x9378('0x57')]);return _0x25a234[_0x9378('0xe2')](_0x11d97c);}})[_0x9378('0x1b')](function(_0x374658){if(_0x374658){_0x3e57e3=_0x374658[_0x9378('0x47')];if(!_0x26ee43['query'][_0x9378('0x48')](_0x9378('0x49'))){_0x11d97c[_0x9378('0x29')]=qs[_0x9378('0x29')](_0x26ee43[_0x9378('0x40')]['limit']);_0x11d97c[_0x9378('0x2b')]=qs[_0x9378('0x2b')](_0x26ee43['query']['offset']);}return _0x25a234[_0x9378('0xe2')](_0x11d97c);}})[_0x9378('0x1b')](function(_0x36216e){if(_0x36216e){return _0x36216e?{'count':_0x3e57e3,'rows':_0x36216e}:null;}})[_0x9378('0x1b')](respondWithResult(_0x3377d9,null))[_0x9378('0x24')](handleError(_0x3377d9,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 1cd0ab4..d8e1875 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 _0x048d=['update','remove','emit','hasOwnProperty','hook','exports','setMaxListeners','save'];(function(_0x281834,_0x5a69de){var _0xbeb0f4=function(_0x14bffe){while(--_0x14bffe){_0x281834['push'](_0x281834['shift']());}};_0xbeb0f4(++_0x5a69de);}(_0x048d,0xae));var _0xd048=function(_0x55e645,_0x2e8017){_0x55e645=_0x55e645-0x0;var _0x34c1c3=_0x048d[_0x55e645];return _0x34c1c3;};'use strict';var EventEmitter=require('events');var SmsAccount=require('../../mysqldb')['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xd048('0x0')](0x0);var events={'afterCreate':_0xd048('0x1'),'afterUpdate':_0xd048('0x2'),'afterDestroy':_0xd048('0x3')};function emitEvent(_0x5e6469){return function(_0xe365cc,_0x4c00ed,_0x5cf7b2){SmsAccountEvents[_0xd048('0x4')](_0x5e6469+':'+_0xe365cc['id'],_0xe365cc);SmsAccountEvents[_0xd048('0x4')](_0x5e6469,_0xe365cc);_0x5cf7b2(null);};}for(var e in events){if(events[_0xd048('0x5')](e)){var event=events[e];SmsAccount[_0xd048('0x6')](e,emitEvent(event));}}module[_0xd048('0x7')]=SmsAccountEvents; \ No newline at end of file +var _0x1a64=['exports','events','SmsAccount','save','update','emit','hook'];(function(_0x4f20ec,_0x46903e){var _0x1a8012=function(_0x37bbcb){while(--_0x37bbcb){_0x4f20ec['push'](_0x4f20ec['shift']());}};_0x1a8012(++_0x46903e);}(_0x1a64,0x16d));var _0x41a6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1a64[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x41a6('0x0'));var SmsAccount=require('../../mysqldb')['db'][_0x41a6('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x41a6('0x2'),'afterUpdate':_0x41a6('0x3'),'afterDestroy':'remove'};function emitEvent(_0x276545){return function(_0x16218e,_0x140318,_0x5083c2){SmsAccountEvents[_0x41a6('0x4')](_0x276545+':'+_0x16218e['id'],_0x16218e);SmsAccountEvents[_0x41a6('0x4')](_0x276545,_0x16218e);_0x5083c2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0x41a6('0x5')](e,emitEvent(event));}}module[_0x41a6('0x6')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 17085da..18bc6e6 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 _0x841b=['util','api','moment','request-promise','rimraf','../../config/environment','exports','define','SmsAccount','sms_accounts','lodash'];(function(_0x35fdc1,_0xbcacf8){var _0x1f8548=function(_0x24d8d9){while(--_0x24d8d9){_0x35fdc1['push'](_0x35fdc1['shift']());}};_0x1f8548(++_0xbcacf8);}(_0x841b,0xba));var _0xb841=function(_0x299ecf,_0x5e642b){_0x299ecf=_0x299ecf-0x0;var _0x4813c9=_0x841b[_0x299ecf];return _0x4813c9;};'use strict';var _=require(_0xb841('0x0'));var util=require(_0xb841('0x1'));var logger=require('../../config/logger')(_0xb841('0x2'));var moment=require(_0xb841('0x3'));var BPromise=require('bluebird');var rp=require(_0xb841('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb841('0x5'));var config=require(_0xb841('0x6'));var attributes=require('./smsAccount.attributes');module[_0xb841('0x7')]=function(_0x292c51,_0x5380db){return _0x292c51[_0xb841('0x8')](_0xb841('0x9'),attributes,{'tableName':_0xb841('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x76cd=['bluebird','request-promise','path','./smsAccount.attributes','define','SmsAccount','sms_accounts','lodash','../../config/logger','api','moment'];(function(_0x53b0e5,_0x26a000){var _0x545130=function(_0x16ea13){while(--_0x16ea13){_0x53b0e5['push'](_0x53b0e5['shift']());}};_0x545130(++_0x26a000);}(_0x76cd,0x6a));var _0xd76c=function(_0x1c4ea3,_0x5ec757){_0x1c4ea3=_0x1c4ea3-0x0;var _0x319753=_0x76cd[_0x1c4ea3];return _0x319753;};'use strict';var _=require(_0xd76c('0x0'));var util=require('util');var logger=require(_0xd76c('0x1'))(_0xd76c('0x2'));var moment=require(_0xd76c('0x3'));var BPromise=require(_0xd76c('0x4'));var rp=require(_0xd76c('0x5'));var fs=require('fs');var path=require(_0xd76c('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd76c('0x7'));module['exports']=function(_0x4685ba,_0x36061a){return _0x4685ba[_0xd76c('0x8')](_0xd76c('0x9'),attributes,{'tableName':_0xd76c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index 64474e0..89a89c2 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 _0x112c=['code','message','result','catch','ShowSmsAccount','SmsAccount','find','options','raw','where','attributes','include','map','model','stringify','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','localhost','redis','./smsAccount.socket','register','then','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','error'];(function(_0x32a554,_0x37ad7b){var _0x5ce71c=function(_0x1f670d){while(--_0x1f670d){_0x32a554['push'](_0x32a554['shift']());}};_0x5ce71c(++_0x37ad7b);}(_0x112c,0x177));var _0xc112=function(_0x37c17b,_0x4d0cff){_0x37c17b=_0x37c17b-0x0;var _0x138ca9=_0x112c[_0x37c17b];return _0x138ca9;};'use strict';var _=require(_0xc112('0x0'));var util=require(_0xc112('0x1'));var moment=require(_0xc112('0x2'));var BPromise=require('bluebird');var rs=require(_0xc112('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc112('0x4'))['db'];var utils=require(_0xc112('0x5'));var logger=require(_0xc112('0x6'))(_0xc112('0x7'));var config=require(_0xc112('0x8'));var jayson=require(_0xc112('0x9'));var client=jayson[_0xc112('0xa')][_0xc112('0xb')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xc112('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc112('0xd')]));require(_0xc112('0xe'))[_0xc112('0xf')](socket);function respondWithRpcPromise(_0x538d90,_0x4d8855,_0x2db783){return new BPromise(function(_0x901c54,_0x3172c7){return client['request'](_0x538d90,_0x2db783)[_0xc112('0x10')](function(_0x5a689c){logger['info'](_0xc112('0x11'),_0x4d8855,_0xc112('0x12'));logger[_0xc112('0x13')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4d8855,_0xc112('0x12'),JSON['stringify'](_0x5a689c));if(_0x5a689c[_0xc112('0x14')]){if(_0x5a689c[_0xc112('0x14')][_0xc112('0x15')]===0x1f4){logger[_0xc112('0x14')](_0xc112('0x11'),_0x4d8855,_0x5a689c[_0xc112('0x14')][_0xc112('0x16')]);return _0x3172c7(_0x5a689c[_0xc112('0x14')][_0xc112('0x16')]);}logger['error'](_0xc112('0x11'),_0x4d8855,_0x5a689c[_0xc112('0x14')][_0xc112('0x16')]);return _0x901c54(_0x5a689c[_0xc112('0x14')][_0xc112('0x16')]);}else{logger['info'](_0xc112('0x11'),_0x4d8855,_0xc112('0x12'));_0x901c54(_0x5a689c[_0xc112('0x17')][_0xc112('0x16')]);}})[_0xc112('0x18')](function(_0x36faa0){logger[_0xc112('0x14')](_0xc112('0x11'),_0x4d8855,_0x36faa0);_0x3172c7(_0x36faa0);});});}exports[_0xc112('0x19')]=function(_0x49d0c7){var _0x20023a=this;return new Promise(function(_0x43eb5e,_0x14bfbc){return db[_0xc112('0x1a')][_0xc112('0x1b')]({'raw':_0x49d0c7[_0xc112('0x1c')]?_0x49d0c7[_0xc112('0x1c')][_0xc112('0x1d')]===undefined?!![]:![]:!![],'where':_0x49d0c7[_0xc112('0x1c')]?_0x49d0c7['options'][_0xc112('0x1e')]||null:null,'attributes':_0x49d0c7[_0xc112('0x1c')]?_0x49d0c7[_0xc112('0x1c')][_0xc112('0x1f')]||null:null,'include':_0x49d0c7[_0xc112('0x1c')]?_0x49d0c7[_0xc112('0x1c')][_0xc112('0x20')]?_[_0xc112('0x21')](_0x49d0c7['options']['include'],function(_0x59a177){return{'model':db[_0x59a177[_0xc112('0x22')]],'as':_0x59a177['as'],'attributes':_0x59a177[_0xc112('0x1f')],'include':_0x59a177[_0xc112('0x20')]?_['map'](_0x59a177[_0xc112('0x20')],function(_0x207859){return{'model':db[_0x207859[_0xc112('0x22')]],'as':_0x207859['as'],'attributes':_0x207859[_0xc112('0x1f')],'include':_0x207859['include']?_['map'](_0x207859[_0xc112('0x20')],function(_0x2dd975){return{'model':db[_0x2dd975[_0xc112('0x22')]],'as':_0x2dd975['as'],'attributes':_0x2dd975['attributes']};}):[]};}):[]};}):[]:[]})[_0xc112('0x10')](function(_0x134d5e){logger['info'](_0xc112('0x19'),_0x49d0c7);logger['debug'](_0xc112('0x19'),_0x49d0c7,JSON[_0xc112('0x23')](_0x134d5e));_0x43eb5e(_0x134d5e);})[_0xc112('0x18')](function(_0x37e4ea){logger[_0xc112('0x14')](_0xc112('0x19'),_0x37e4ea[_0xc112('0x16')],_0x49d0c7);_0x14bfbc(_0x20023a[_0xc112('0x14')](0x1f4,_0x37e4ea['message']));});});}; \ No newline at end of file +var _0x8387=['result','catch','ShowSmsAccount','SmsAccount','options','raw','where','attributes','include','map','model','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./smsAccount.socket','register','request','then','info','request\x20sent','stringify','code','error','message','SmsAccount,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8387,0xc9));var _0x7838=function(_0xa808d9,_0x186110){_0xa808d9=_0xa808d9-0x0;var _0x2ae6af=_0x8387[_0xa808d9];return _0x2ae6af;};'use strict';var _=require(_0x7838('0x0'));var util=require(_0x7838('0x1'));var moment=require(_0x7838('0x2'));var BPromise=require(_0x7838('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7838('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7838('0x5'));var logger=require(_0x7838('0x6'))(_0x7838('0x7'));var config=require(_0x7838('0x8'));var jayson=require(_0x7838('0x9'));var client=jayson[_0x7838('0xa')][_0x7838('0xb')]({'port':0x232a});config['redis']=_[_0x7838('0xc')](config[_0x7838('0xd')],{'host':_0x7838('0xe'),'port':0x18eb});var socket=require(_0x7838('0xf'))(new Redis(config[_0x7838('0xd')]));require(_0x7838('0x10'))[_0x7838('0x11')](socket);function respondWithRpcPromise(_0x4980f4,_0x32d4a5,_0x47fcfd){return new BPromise(function(_0x1135af,_0x19b9f2){return client[_0x7838('0x12')](_0x4980f4,_0x47fcfd)[_0x7838('0x13')](function(_0x14cebc){logger[_0x7838('0x14')]('SmsAccount,\x20%s,\x20%s',_0x32d4a5,_0x7838('0x15'));logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x32d4a5,_0x7838('0x15'),JSON[_0x7838('0x16')](_0x14cebc));if(_0x14cebc['error']){if(_0x14cebc['error'][_0x7838('0x17')]===0x1f4){logger[_0x7838('0x18')]('SmsAccount,\x20%s,\x20%s',_0x32d4a5,_0x14cebc[_0x7838('0x18')][_0x7838('0x19')]);return _0x19b9f2(_0x14cebc[_0x7838('0x18')][_0x7838('0x19')]);}logger[_0x7838('0x18')](_0x7838('0x1a'),_0x32d4a5,_0x14cebc[_0x7838('0x18')]['message']);return _0x1135af(_0x14cebc[_0x7838('0x18')][_0x7838('0x19')]);}else{logger[_0x7838('0x14')](_0x7838('0x1a'),_0x32d4a5,_0x7838('0x15'));_0x1135af(_0x14cebc[_0x7838('0x1b')][_0x7838('0x19')]);}})[_0x7838('0x1c')](function(_0x523d49){logger[_0x7838('0x18')](_0x7838('0x1a'),_0x32d4a5,_0x523d49);_0x19b9f2(_0x523d49);});});}exports[_0x7838('0x1d')]=function(_0x5a403e){var _0x4ad624=this;return new Promise(function(_0x4b6dc6,_0x297dd8){return db[_0x7838('0x1e')]['find']({'raw':_0x5a403e[_0x7838('0x1f')]?_0x5a403e['options'][_0x7838('0x20')]===undefined?!![]:![]:!![],'where':_0x5a403e[_0x7838('0x1f')]?_0x5a403e[_0x7838('0x1f')][_0x7838('0x21')]||null:null,'attributes':_0x5a403e[_0x7838('0x1f')]?_0x5a403e[_0x7838('0x1f')][_0x7838('0x22')]||null:null,'include':_0x5a403e[_0x7838('0x1f')]?_0x5a403e[_0x7838('0x1f')][_0x7838('0x23')]?_[_0x7838('0x24')](_0x5a403e['options'][_0x7838('0x23')],function(_0x5f0412){return{'model':db[_0x5f0412['model']],'as':_0x5f0412['as'],'attributes':_0x5f0412[_0x7838('0x22')],'include':_0x5f0412['include']?_['map'](_0x5f0412['include'],function(_0x387660){return{'model':db[_0x387660[_0x7838('0x25')]],'as':_0x387660['as'],'attributes':_0x387660[_0x7838('0x22')],'include':_0x387660['include']?_['map'](_0x387660[_0x7838('0x23')],function(_0x2c0394){return{'model':db[_0x2c0394[_0x7838('0x25')]],'as':_0x2c0394['as'],'attributes':_0x2c0394['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5cbd45){logger[_0x7838('0x14')](_0x7838('0x1d'),_0x5a403e);logger['debug']('ShowSmsAccount',_0x5a403e,JSON['stringify'](_0x5cbd45));_0x4b6dc6(_0x5cbd45);})[_0x7838('0x1c')](function(_0x4afb9b){logger[_0x7838('0x18')]('ShowSmsAccount',_0x4afb9b[_0x7838('0x19')],_0x5a403e);_0x297dd8(_0x4ad624[_0x7838('0x18')](0x1f4,_0x4afb9b['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 4595384..70da6eb 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(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'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(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index c399d8a..a276579 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 _0x34e8=['../../config/environment','./smsApplication.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x8343ba,_0x217a01){var _0x3b10ff=function(_0x3afe94){while(--_0x3afe94){_0x8343ba['push'](_0x8343ba['shift']());}};_0x3b10ff(++_0x217a01);}(_0x34e8,0x12c));var _0x834e=function(_0x150fdf,_0x224f2b){_0x150fdf=_0x150fdf-0x0;var _0x46b40a=_0x34e8[_0x150fdf];return _0x46b40a;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var fs_extra=require(_0x834e('0x5'));var auth=require(_0x834e('0x6'));var interaction=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var controller=require(_0x834e('0x9'));router[_0x834e('0xa')]('/',auth['isAuthenticated'](),controller[_0x834e('0xb')]);router['get'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0xe')]);router[_0x834e('0xf')]('/',auth[_0x834e('0xd')](),controller[_0x834e('0x10')]);router[_0x834e('0x11')](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0x12')]);router[_0x834e('0x13')](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0x14')]);module[_0x834e('0x15')]=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(_0x54791b,_0x3caee7){var _0x280dca=function(_0x1a13bc){while(--_0x1a13bc){_0x54791b['push'](_0x54791b['shift']());}};_0x280dca(++_0x3caee7);}(_0x008c,0x188));var _0xc008=function(_0x525864,_0x1bb3ea){_0x525864=_0x525864-0x0;var _0x4f9964=_0x008c[_0x525864];return _0x4f9964;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc008('0xe')](_0xc008('0xf'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xc008('0xf'),auth[_0xc008('0xb')](),controller['destroy']);module[_0xc008('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 8685774..ce73f84 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 _0x80c7=['INTEGER','STRING','*,*,*,*','sequelize','exports'];(function(_0x17d322,_0x271d5b){var _0x182072=function(_0x2ead33){while(--_0x2ead33){_0x17d322['push'](_0x17d322['shift']());}};_0x182072(++_0x271d5b);}(_0x80c7,0x1b1));var _0x780c=function(_0x3e12b1,_0x2367a4){_0x3e12b1=_0x3e12b1-0x0;var _0x1ac0de=_0x80c7[_0x3e12b1];return _0x1ac0de;};'use strict';var Sequelize=require(_0x780c('0x0'));module[_0x780c('0x1')]={'priority':{'type':Sequelize[_0x780c('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x780c('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x780c('0x3')]},'interval':{'type':Sequelize[_0x780c('0x3')],'defaultValue':_0x780c('0x4')}}; \ No newline at end of file +var _0xf171=['exports','INTEGER','STRING','noop','TEXT'];(function(_0x3146d7,_0x4de04b){var _0x11e7a8=function(_0x134642){while(--_0x134642){_0x3146d7['push'](_0x3146d7['shift']());}};_0x11e7a8(++_0x4de04b);}(_0xf171,0x1d6));var _0x1f17=function(_0x27604f,_0x5ae336){_0x27604f=_0x27604f-0x0;var _0x40d189=_0xf171[_0x27604f];return _0x40d189;};'use strict';var Sequelize=require('sequelize');module[_0x1f17('0x0')]={'priority':{'type':Sequelize[_0x1f17('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x1f17('0x2')],'allowNull':![],'defaultValue':_0x1f17('0x3')},'appdata':{'type':Sequelize[_0x1f17('0x4')]()},'description':{'type':Sequelize[_0x1f17('0x2')]},'interval':{'type':Sequelize[_0x1f17('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 3e61761..f73ec73 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 _0xe7c6=['VIRTUAL','options','includeAll','findAll','rows','catch','params','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/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','map','SmsApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge'];(function(_0x427d3a,_0x23724c){var _0xe5c521=function(_0x77b277){while(--_0x77b277){_0x427d3a['push'](_0x427d3a['shift']());}};_0xe5c521(++_0x23724c);}(_0xe7c6,0x1ea));var _0x6e7c=function(_0x526fb9,_0x3f433a){_0x526fb9=_0x526fb9-0x0;var _0x4d1eb8=_0xe7c6[_0x526fb9];return _0x4d1eb8;};'use strict';var emlformat=require(_0x6e7c('0x0'));var rimraf=require(_0x6e7c('0x1'));var zipdir=require(_0x6e7c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6e7c('0x3'));var moment=require(_0x6e7c('0x4'));var BPromise=require(_0x6e7c('0x5'));var Mustache=require(_0x6e7c('0x6'));var util=require(_0x6e7c('0x7'));var path=require(_0x6e7c('0x8'));var sox=require(_0x6e7c('0x9'));var csv=require(_0x6e7c('0xa'));var ejs=require(_0x6e7c('0xb'));var fs=require('fs');var fs_extra=require(_0x6e7c('0xc'));var _=require(_0x6e7c('0xd'));var squel=require('squel');var crypto=require(_0x6e7c('0xe'));var jsforce=require(_0x6e7c('0xf'));var deskjs=require(_0x6e7c('0x10'));var toCsv=require(_0x6e7c('0xa'));var querystring=require(_0x6e7c('0x11'));var Papa=require(_0x6e7c('0x12'));var Redis=require(_0x6e7c('0x13'));var authService=require(_0x6e7c('0x14'));var qs=require(_0x6e7c('0x15'));var as=require(_0x6e7c('0x16'));var hardwareService=require(_0x6e7c('0x17'));var logger=require(_0x6e7c('0x18'))(_0x6e7c('0x19'));var utils=require(_0x6e7c('0x1a'));var config=require(_0x6e7c('0x1b'));var licenseUtil=require(_0x6e7c('0x1c'));var db=require(_0x6e7c('0x1d'))['db'];function respondWithStatusCode(_0x4af10f,_0x4d9c0f){_0x4d9c0f=_0x4d9c0f||0xcc;return function(_0x2f9059){if(_0x2f9059){return _0x4af10f[_0x6e7c('0x1e')](_0x4d9c0f);}return _0x4af10f[_0x6e7c('0x1f')](_0x4d9c0f)[_0x6e7c('0x20')]();};}function respondWithResult(_0x2dea32,_0x3faedc){_0x3faedc=_0x3faedc||0xc8;return function(_0x5e7998){if(_0x5e7998){return _0x2dea32[_0x6e7c('0x1f')](_0x3faedc)[_0x6e7c('0x21')](_0x5e7998);}};}function respondWithFilteredResult(_0x395ccf,_0x50244f){return function(_0x352e10){if(_0x352e10){var _0x1e684f=typeof _0x50244f[_0x6e7c('0x22')]===_0x6e7c('0x23')&&typeof _0x50244f[_0x6e7c('0x24')]===_0x6e7c('0x23');var _0x5dbe83=_0x352e10[_0x6e7c('0x25')];var _0x127d6e=_0x1e684f?0x0:_0x50244f[_0x6e7c('0x22')];var _0x429b9c=_0x1e684f?_0x352e10[_0x6e7c('0x25')]:_0x50244f['offset']+_0x50244f['limit'];var _0xd443fe;if(_0x429b9c>=_0x5dbe83){_0x429b9c=_0x5dbe83;_0xd443fe=0xc8;}else{_0xd443fe=0xce;}_0x395ccf['status'](_0xd443fe);return _0x395ccf[_0x6e7c('0x26')](_0x6e7c('0x27'),_0x127d6e+'-'+_0x429b9c+'/'+_0x5dbe83)[_0x6e7c('0x21')](_0x352e10);}return null;};}function patchUpdates(_0x2b0233){return function(_0x9ff368){try{jsonpatch[_0x6e7c('0x28')](_0x9ff368,_0x2b0233,!![]);}catch(_0x17f3c){return BPromise[_0x6e7c('0x29')](_0x17f3c);}return _0x9ff368[_0x6e7c('0x2a')]();};}function saveUpdates(_0x10872c,_0xc6657d){return function(_0x254f9c){if(_0x254f9c){return _0x254f9c[_0x6e7c('0x2b')](_0x10872c)[_0x6e7c('0x2c')](function(_0xc46f37){return _0xc46f37;});}return null;};}function removeEntity(_0x1715ad,_0x203ff1){return function(_0x1a3f2c){if(_0x1a3f2c){return _0x1a3f2c[_0x6e7c('0x2d')]()[_0x6e7c('0x2c')](function(){_0x1715ad[_0x6e7c('0x1f')](0xcc)[_0x6e7c('0x20')]();});}};}function handleEntityNotFound(_0x2830eb,_0x569757){return function(_0x309275){if(!_0x309275){_0x2830eb[_0x6e7c('0x1e')](0x194);}return _0x309275;};}function handleError(_0x388f0e,_0x2c474b){_0x2c474b=_0x2c474b||0x1f4;return function(_0x5008db){logger[_0x6e7c('0x2e')](_0x5008db[_0x6e7c('0x2f')]);if(_0x5008db[_0x6e7c('0x30')]){delete _0x5008db['name'];}_0x388f0e['status'](_0x2c474b)['send'](_0x5008db);};}exports['index']=function(_0x4fb96a,_0x135f51){var _0x2819af={},_0x3cc12a={},_0x387449={'count':0x0,'rows':[]};var _0x53c2fe=_[_0x6e7c('0x31')](db[_0x6e7c('0x32')][_0x6e7c('0x33')],function(_0x4cfdd4){return{'name':_0x4cfdd4[_0x6e7c('0x34')],'type':_0x4cfdd4[_0x6e7c('0x35')][_0x6e7c('0x36')]};});_0x3cc12a[_0x6e7c('0x37')]=_['map'](_0x53c2fe,_0x6e7c('0x30'));_0x3cc12a[_0x6e7c('0x38')]=_[_0x6e7c('0x39')](_0x4fb96a[_0x6e7c('0x38')]);_0x3cc12a[_0x6e7c('0x3a')]=_[_0x6e7c('0x3b')](_0x3cc12a[_0x6e7c('0x37')],_0x3cc12a[_0x6e7c('0x38')]);_0x2819af[_0x6e7c('0x3c')]=_['intersection'](_0x3cc12a[_0x6e7c('0x37')],qs[_0x6e7c('0x3d')](_0x4fb96a[_0x6e7c('0x38')][_0x6e7c('0x3d')]));_0x2819af[_0x6e7c('0x3c')]=_0x2819af[_0x6e7c('0x3c')][_0x6e7c('0x3e')]?_0x2819af[_0x6e7c('0x3c')]:_0x3cc12a[_0x6e7c('0x37')];if(!_0x4fb96a[_0x6e7c('0x38')][_0x6e7c('0x3f')](_0x6e7c('0x40'))){_0x2819af[_0x6e7c('0x24')]=qs[_0x6e7c('0x24')](_0x4fb96a[_0x6e7c('0x38')][_0x6e7c('0x24')]);_0x2819af[_0x6e7c('0x22')]=qs[_0x6e7c('0x22')](_0x4fb96a[_0x6e7c('0x38')][_0x6e7c('0x22')]);}_0x2819af['order']=qs['sort'](_0x4fb96a['query'][_0x6e7c('0x41')]);_0x2819af[_0x6e7c('0x42')]=qs[_0x6e7c('0x3a')](_[_0x6e7c('0x43')](_0x4fb96a[_0x6e7c('0x38')],_0x3cc12a[_0x6e7c('0x3a')]),_0x53c2fe);if(_0x4fb96a['query'][_0x6e7c('0x44')]){_0x2819af[_0x6e7c('0x42')]=_[_0x6e7c('0x45')](_0x2819af['where'],{'$or':_['map'](_0x53c2fe,function(_0x3592de){if(_0x3592de[_0x6e7c('0x35')]!==_0x6e7c('0x46')){var _0x25e516={};_0x25e516[_0x3592de[_0x6e7c('0x30')]]={'$like':'%'+_0x4fb96a[_0x6e7c('0x38')][_0x6e7c('0x44')]+'%'};return _0x25e516;}})});}_0x2819af=_[_0x6e7c('0x45')]({},_0x2819af,_0x4fb96a[_0x6e7c('0x47')]);var _0x35daac={'where':_0x2819af[_0x6e7c('0x42')]};return db[_0x6e7c('0x32')]['count'](_0x35daac)[_0x6e7c('0x2c')](function(_0x174286){_0x387449['count']=_0x174286;if(_0x4fb96a['query'][_0x6e7c('0x48')]){_0x2819af['include']=[{'all':!![]}];}return db[_0x6e7c('0x32')][_0x6e7c('0x49')](_0x2819af);})['then'](function(_0xadd908){_0x387449[_0x6e7c('0x4a')]=_0xadd908;return _0x387449;})[_0x6e7c('0x2c')](respondWithFilteredResult(_0x135f51,_0x2819af))[_0x6e7c('0x4b')](handleError(_0x135f51,null));};exports['show']=function(_0x2e3994,_0x1b273e){var _0x259cc8={'raw':!![],'where':{'id':_0x2e3994[_0x6e7c('0x4c')]['id']}},_0x5b930e={};_0x5b930e[_0x6e7c('0x37')]=_['keys'](db[_0x6e7c('0x32')][_0x6e7c('0x33')]);_0x5b930e[_0x6e7c('0x38')]=_[_0x6e7c('0x39')](_0x2e3994[_0x6e7c('0x38')]);_0x5b930e[_0x6e7c('0x3a')]=_[_0x6e7c('0x3b')](_0x5b930e[_0x6e7c('0x37')],_0x5b930e[_0x6e7c('0x38')]);_0x259cc8[_0x6e7c('0x3c')]=_['intersection'](_0x5b930e['model'],qs[_0x6e7c('0x3d')](_0x2e3994[_0x6e7c('0x38')]['fields']));_0x259cc8[_0x6e7c('0x3c')]=_0x259cc8[_0x6e7c('0x3c')][_0x6e7c('0x3e')]?_0x259cc8['attributes']:_0x5b930e[_0x6e7c('0x37')];if(_0x2e3994[_0x6e7c('0x38')][_0x6e7c('0x48')]){_0x259cc8['include']=[{'all':!![]}];}_0x259cc8=_[_0x6e7c('0x45')]({},_0x259cc8,_0x2e3994[_0x6e7c('0x47')]);return db['SmsApplication'][_0x6e7c('0x4d')](_0x259cc8)[_0x6e7c('0x2c')](handleEntityNotFound(_0x1b273e,null))['then'](respondWithResult(_0x1b273e,null))[_0x6e7c('0x4b')](handleError(_0x1b273e,null));};exports[_0x6e7c('0x4e')]=function(_0x52b393,_0x42edef){return db[_0x6e7c('0x32')][_0x6e7c('0x4e')](_0x52b393[_0x6e7c('0x4f')],{})[_0x6e7c('0x2c')](respondWithResult(_0x42edef,0xc9))[_0x6e7c('0x4b')](handleError(_0x42edef,null));};exports['update']=function(_0x209c81,_0x398209){if(_0x209c81[_0x6e7c('0x4f')]['id']){delete _0x209c81[_0x6e7c('0x4f')]['id'];}return db[_0x6e7c('0x32')][_0x6e7c('0x4d')]({'where':{'id':_0x209c81[_0x6e7c('0x4c')]['id']}})[_0x6e7c('0x2c')](handleEntityNotFound(_0x398209,null))[_0x6e7c('0x2c')](saveUpdates(_0x209c81[_0x6e7c('0x4f')],null))[_0x6e7c('0x2c')](respondWithResult(_0x398209,null))[_0x6e7c('0x4b')](handleError(_0x398209,null));};exports[_0x6e7c('0x2d')]=function(_0x1859fb,_0x4f2a20){return db[_0x6e7c('0x32')][_0x6e7c('0x4d')]({'where':{'id':_0x1859fb['params']['id']}})[_0x6e7c('0x2c')](handleEntityNotFound(_0x4f2a20,null))[_0x6e7c('0x2c')](removeEntity(_0x4f2a20,null))[_0x6e7c('0x4b')](handleError(_0x4f2a20,null));}; \ No newline at end of file +var _0xf745=['save','then','stack','name','index','map','SmsApplication','fieldName','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','include','findAll','rows','catch','show','rawAttributes','options','find','create','body','params','destroy','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','undefined','limit','count','apply'];(function(_0x292f35,_0x72e859){var _0x288e75=function(_0x1bba68){while(--_0x1bba68){_0x292f35['push'](_0x292f35['shift']());}};_0x288e75(++_0x72e859);}(_0xf745,0x6d));var _0x5f74=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xf745[_0x432682];return _0x463d05;};'use strict';var emlformat=require(_0x5f74('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5f74('0x1'));var rp=require(_0x5f74('0x2'));var moment=require(_0x5f74('0x3'));var BPromise=require(_0x5f74('0x4'));var Mustache=require(_0x5f74('0x5'));var util=require(_0x5f74('0x6'));var path=require(_0x5f74('0x7'));var sox=require(_0x5f74('0x8'));var csv=require(_0x5f74('0x9'));var ejs=require(_0x5f74('0xa'));var fs=require('fs');var fs_extra=require(_0x5f74('0xb'));var _=require('lodash');var squel=require(_0x5f74('0xc'));var crypto=require(_0x5f74('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5f74('0xe'));var toCsv=require(_0x5f74('0x9'));var querystring=require(_0x5f74('0xf'));var Papa=require(_0x5f74('0x10'));var Redis=require(_0x5f74('0x11'));var authService=require(_0x5f74('0x12'));var qs=require(_0x5f74('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5f74('0x14'));var logger=require(_0x5f74('0x15'))(_0x5f74('0x16'));var utils=require(_0x5f74('0x17'));var config=require(_0x5f74('0x18'));var licenseUtil=require(_0x5f74('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x593344,_0x1c9a00){_0x1c9a00=_0x1c9a00||0xcc;return function(_0x3b468f){if(_0x3b468f){return _0x593344['sendStatus'](_0x1c9a00);}return _0x593344[_0x5f74('0x1a')](_0x1c9a00)['end']();};}function respondWithResult(_0x11e9d5,_0x5e5585){_0x5e5585=_0x5e5585||0xc8;return function(_0x2afe84){if(_0x2afe84){return _0x11e9d5[_0x5f74('0x1a')](_0x5e5585)[_0x5f74('0x1b')](_0x2afe84);}};}function respondWithFilteredResult(_0x31e86b,_0x69f889){return function(_0x3d48e3){if(_0x3d48e3){var _0x101603=typeof _0x69f889[_0x5f74('0x1c')]===_0x5f74('0x1d')&&typeof _0x69f889[_0x5f74('0x1e')]===_0x5f74('0x1d');var _0x211bc5=_0x3d48e3[_0x5f74('0x1f')];var _0x17f1db=_0x101603?0x0:_0x69f889['offset'];var _0x490497=_0x101603?_0x3d48e3[_0x5f74('0x1f')]:_0x69f889['offset']+_0x69f889[_0x5f74('0x1e')];var _0x45b518;if(_0x490497>=_0x211bc5){_0x490497=_0x211bc5;_0x45b518=0xc8;}else{_0x45b518=0xce;}_0x31e86b[_0x5f74('0x1a')](_0x45b518);return _0x31e86b['set']('Content-Range',_0x17f1db+'-'+_0x490497+'/'+_0x211bc5)[_0x5f74('0x1b')](_0x3d48e3);}return null;};}function patchUpdates(_0x2c501c){return function(_0x312af8){try{jsonpatch[_0x5f74('0x20')](_0x312af8,_0x2c501c,!![]);}catch(_0x21b43a){return BPromise['reject'](_0x21b43a);}return _0x312af8[_0x5f74('0x21')]();};}function saveUpdates(_0x13f35c,_0x13ef3a){return function(_0x2b12df){if(_0x2b12df){return _0x2b12df['update'](_0x13f35c)[_0x5f74('0x22')](function(_0x1f0f92){return _0x1f0f92;});}return null;};}function removeEntity(_0x3fc0df,_0x12b46f){return function(_0x275aa4){if(_0x275aa4){return _0x275aa4['destroy']()[_0x5f74('0x22')](function(){_0x3fc0df['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x182c62,_0x93a913){return function(_0x4b83f8){if(!_0x4b83f8){_0x182c62['sendStatus'](0x194);}return _0x4b83f8;};}function handleError(_0x5efd8c,_0x6e911b){_0x6e911b=_0x6e911b||0x1f4;return function(_0x46a432){logger['error'](_0x46a432[_0x5f74('0x23')]);if(_0x46a432[_0x5f74('0x24')]){delete _0x46a432['name'];}_0x5efd8c[_0x5f74('0x1a')](_0x6e911b)['send'](_0x46a432);};}exports[_0x5f74('0x25')]=function(_0x4e8770,_0x1eab55){var _0x1593b1={},_0x45928a={},_0xc87c4b={'count':0x0,'rows':[]};var _0x29cefb=_[_0x5f74('0x26')](db[_0x5f74('0x27')]['rawAttributes'],function(_0x567a11){return{'name':_0x567a11[_0x5f74('0x28')],'type':_0x567a11['type'][_0x5f74('0x29')]};});_0x45928a[_0x5f74('0x2a')]=_['map'](_0x29cefb,'name');_0x45928a[_0x5f74('0x2b')]=_[_0x5f74('0x2c')](_0x4e8770[_0x5f74('0x2b')]);_0x45928a['filters']=_[_0x5f74('0x2d')](_0x45928a[_0x5f74('0x2a')],_0x45928a['query']);_0x1593b1[_0x5f74('0x2e')]=_[_0x5f74('0x2d')](_0x45928a[_0x5f74('0x2a')],qs[_0x5f74('0x2f')](_0x4e8770[_0x5f74('0x2b')][_0x5f74('0x2f')]));_0x1593b1[_0x5f74('0x2e')]=_0x1593b1[_0x5f74('0x2e')][_0x5f74('0x30')]?_0x1593b1[_0x5f74('0x2e')]:_0x45928a[_0x5f74('0x2a')];if(!_0x4e8770[_0x5f74('0x2b')]['hasOwnProperty'](_0x5f74('0x31'))){_0x1593b1[_0x5f74('0x1e')]=qs[_0x5f74('0x1e')](_0x4e8770['query'][_0x5f74('0x1e')]);_0x1593b1[_0x5f74('0x1c')]=qs[_0x5f74('0x1c')](_0x4e8770['query']['offset']);}_0x1593b1[_0x5f74('0x32')]=qs['sort'](_0x4e8770[_0x5f74('0x2b')][_0x5f74('0x33')]);_0x1593b1['where']=qs[_0x5f74('0x34')](_[_0x5f74('0x35')](_0x4e8770[_0x5f74('0x2b')],_0x45928a[_0x5f74('0x34')]),_0x29cefb);if(_0x4e8770[_0x5f74('0x2b')][_0x5f74('0x36')]){_0x1593b1[_0x5f74('0x37')]=_[_0x5f74('0x38')](_0x1593b1[_0x5f74('0x37')],{'$or':_['map'](_0x29cefb,function(_0x54c3b1){if(_0x54c3b1[_0x5f74('0x39')]!==_0x5f74('0x3a')){var _0x6cb3ab={};_0x6cb3ab[_0x54c3b1[_0x5f74('0x24')]]={'$like':'%'+_0x4e8770[_0x5f74('0x2b')][_0x5f74('0x36')]+'%'};return _0x6cb3ab;}})});}_0x1593b1=_[_0x5f74('0x38')]({},_0x1593b1,_0x4e8770['options']);var _0x2f634c={'where':_0x1593b1['where']};return db[_0x5f74('0x27')]['count'](_0x2f634c)[_0x5f74('0x22')](function(_0x5c4cfe){_0xc87c4b[_0x5f74('0x1f')]=_0x5c4cfe;if(_0x4e8770[_0x5f74('0x2b')]['includeAll']){_0x1593b1[_0x5f74('0x3b')]=[{'all':!![]}];}return db[_0x5f74('0x27')][_0x5f74('0x3c')](_0x1593b1);})['then'](function(_0x2a9fd4){_0xc87c4b[_0x5f74('0x3d')]=_0x2a9fd4;return _0xc87c4b;})[_0x5f74('0x22')](respondWithFilteredResult(_0x1eab55,_0x1593b1))[_0x5f74('0x3e')](handleError(_0x1eab55,null));};exports[_0x5f74('0x3f')]=function(_0x23d1fb,_0x43dc0c){var _0x3c9b41={'raw':!![],'where':{'id':_0x23d1fb['params']['id']}},_0x53d3e4={};_0x53d3e4[_0x5f74('0x2a')]=_[_0x5f74('0x2c')](db['SmsApplication'][_0x5f74('0x40')]);_0x53d3e4[_0x5f74('0x2b')]=_[_0x5f74('0x2c')](_0x23d1fb[_0x5f74('0x2b')]);_0x53d3e4[_0x5f74('0x34')]=_[_0x5f74('0x2d')](_0x53d3e4[_0x5f74('0x2a')],_0x53d3e4['query']);_0x3c9b41[_0x5f74('0x2e')]=_['intersection'](_0x53d3e4[_0x5f74('0x2a')],qs[_0x5f74('0x2f')](_0x23d1fb[_0x5f74('0x2b')][_0x5f74('0x2f')]));_0x3c9b41['attributes']=_0x3c9b41[_0x5f74('0x2e')][_0x5f74('0x30')]?_0x3c9b41[_0x5f74('0x2e')]:_0x53d3e4['model'];if(_0x23d1fb[_0x5f74('0x2b')]['includeAll']){_0x3c9b41[_0x5f74('0x3b')]=[{'all':!![]}];}_0x3c9b41=_[_0x5f74('0x38')]({},_0x3c9b41,_0x23d1fb[_0x5f74('0x41')]);return db['SmsApplication'][_0x5f74('0x42')](_0x3c9b41)[_0x5f74('0x22')](handleEntityNotFound(_0x43dc0c,null))[_0x5f74('0x22')](respondWithResult(_0x43dc0c,null))['catch'](handleError(_0x43dc0c,null));};exports[_0x5f74('0x43')]=function(_0x2014b7,_0x157d2a){return db[_0x5f74('0x27')][_0x5f74('0x43')](_0x2014b7['body'],{})[_0x5f74('0x22')](respondWithResult(_0x157d2a,0xc9))[_0x5f74('0x3e')](handleError(_0x157d2a,null));};exports['update']=function(_0x358f15,_0x5791b1){if(_0x358f15['body']['id']){delete _0x358f15[_0x5f74('0x44')]['id'];}return db[_0x5f74('0x27')]['find']({'where':{'id':_0x358f15[_0x5f74('0x45')]['id']}})['then'](handleEntityNotFound(_0x5791b1,null))[_0x5f74('0x22')](saveUpdates(_0x358f15['body'],null))[_0x5f74('0x22')](respondWithResult(_0x5791b1,null))[_0x5f74('0x3e')](handleError(_0x5791b1,null));};exports[_0x5f74('0x46')]=function(_0x4d0a91,_0x552fdc){return db[_0x5f74('0x27')]['find']({'where':{'id':_0x4d0a91[_0x5f74('0x45')]['id']}})[_0x5f74('0x22')](handleEntityNotFound(_0x552fdc,null))['then'](removeEntity(_0x552fdc,null))[_0x5f74('0x3e')](handleError(_0x552fdc,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index ef1a3e5..6f7861c 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 _0xdbad=['api','moment','request-promise','path','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','lodash','util','../../config/logger'];(function(_0x537e73,_0x36dbe7){var _0x43c134=function(_0x34575f){while(--_0x34575f){_0x537e73['push'](_0x537e73['shift']());}};_0x43c134(++_0x36dbe7);}(_0xdbad,0x8d));var _0xddba=function(_0x5ef56f,_0x313b19){_0x5ef56f=_0x5ef56f-0x0;var _0x4fe05d=_0xdbad[_0x5ef56f];return _0x4fe05d;};'use strict';var _=require(_0xddba('0x0'));var util=require(_0xddba('0x1'));var logger=require(_0xddba('0x2'))(_0xddba('0x3'));var moment=require(_0xddba('0x4'));var BPromise=require('bluebird');var rp=require(_0xddba('0x5'));var fs=require('fs');var path=require(_0xddba('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xddba('0x7'));module[_0xddba('0x8')]=function(_0x52d9da,_0x4140c8){return _0x52d9da[_0xddba('0x9')](_0xddba('0xa'),attributes,{'tableName':_0xddba('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x3cbd=['moment','bluebird','request-promise','path','rimraf','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','utf8mb4_unicode_ci','../../config/logger','api'];(function(_0x15e0d2,_0x8333c){var _0x45bb73=function(_0x52cb41){while(--_0x52cb41){_0x15e0d2['push'](_0x15e0d2['shift']());}};_0x45bb73(++_0x8333c);}(_0x3cbd,0x184));var _0xd3cb=function(_0x42d645,_0x61c13f){_0x42d645=_0x42d645-0x0;var _0x448a1=_0x3cbd[_0x42d645];return _0x448a1;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd3cb('0x0'))(_0xd3cb('0x1'));var moment=require(_0xd3cb('0x2'));var BPromise=require(_0xd3cb('0x3'));var rp=require(_0xd3cb('0x4'));var fs=require('fs');var path=require(_0xd3cb('0x5'));var rimraf=require(_0xd3cb('0x6'));var config=require('../../config/environment');var attributes=require(_0xd3cb('0x7'));module[_0xd3cb('0x8')]=function(_0x2fe7da,_0x252dc0){return _0x2fe7da[_0xd3cb('0x9')](_0xd3cb('0xa'),attributes,{'tableName':_0xd3cb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xd3cb('0xc')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 9dd2d91..222a4f5 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 _0x6e1c=['rpc','../../config/environment','jayson/promise','client','http','request','info','SmsApplication,\x20%s,\x20%s','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x582076,_0x61857f){var _0x3558ad=function(_0x3a47e7){while(--_0x3a47e7){_0x582076['push'](_0x582076['shift']());}};_0x3558ad(++_0x61857f);}(_0x6e1c,0xb6));var _0xc6e1=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6e1c[_0x14add3];return _0x4a174f;};'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')]('SmsApplication,\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);});});} \ No newline at end of file +var _0x79d7=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','info','SmsApplication,\x20%s,\x20%s','request\x20sent','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x79d7,0x9c));var _0x779d=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x79d7[_0x46698a];return _0x356db0;};'use strict';var _=require(_0x779d('0x0'));var util=require('util');var moment=require(_0x779d('0x1'));var BPromise=require(_0x779d('0x2'));var rs=require(_0x779d('0x3'));var fs=require('fs');var Redis=require(_0x779d('0x4'));var db=require(_0x779d('0x5'))['db'];var utils=require(_0x779d('0x6'));var logger=require('../../config/logger')(_0x779d('0x7'));var config=require(_0x779d('0x8'));var jayson=require(_0x779d('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x227c87,_0x4c7fb4,_0xc067dd){return new BPromise(function(_0x2f83f6,_0x4c7c92){return client['request'](_0x227c87,_0xc067dd)['then'](function(_0x5b4ef2){logger[_0x779d('0xa')](_0x779d('0xb'),_0x4c7fb4,_0x779d('0xc'));logger['debug'](_0x779d('0xd'),_0x4c7fb4,'request\x20sent',JSON[_0x779d('0xe')](_0x5b4ef2));if(_0x5b4ef2['error']){if(_0x5b4ef2[_0x779d('0xf')][_0x779d('0x10')]===0x1f4){logger[_0x779d('0xf')]('SmsApplication,\x20%s,\x20%s',_0x4c7fb4,_0x5b4ef2[_0x779d('0xf')][_0x779d('0x11')]);return _0x4c7c92(_0x5b4ef2[_0x779d('0xf')][_0x779d('0x11')]);}logger[_0x779d('0xf')](_0x779d('0xb'),_0x4c7fb4,_0x5b4ef2['error'][_0x779d('0x11')]);return _0x2f83f6(_0x5b4ef2[_0x779d('0xf')][_0x779d('0x11')]);}else{logger[_0x779d('0xa')](_0x779d('0xb'),_0x4c7fb4,'request\x20sent');_0x2f83f6(_0x5b4ef2[_0x779d('0x12')][_0x779d('0x11')]);}})[_0x779d('0x13')](function(_0x4cc248){logger[_0x779d('0xf')](_0x779d('0xb'),_0x4c7fb4,_0x4cc248);_0x4c7c92(_0x4cc248);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 0b0f185..b2afd35 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 _0x5c00=['smsinteraction:addtags','addTags','/:id','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','removeTags','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','show','/:id/messages','getMessages','post','create','addMessage','/:id/tags','tracked','sms'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x5c00,0x17e));var _0x05c0=function(_0x4361c1,_0x175703){_0x4361c1=_0x4361c1-0x0;var _0x7d47bd=_0x5c00[_0x4361c1];return _0x7d47bd;};'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('./smsInteraction.controller');router[_0x05c0('0x8')]('/',auth[_0x05c0('0x9')](),controller[_0x05c0('0xa')]);router[_0x05c0('0x8')]('/describe',auth[_0x05c0('0x9')](),controller[_0x05c0('0xb')]);router[_0x05c0('0x8')]('/:id',auth[_0x05c0('0x9')](),controller[_0x05c0('0xc')]);router[_0x05c0('0x8')](_0x05c0('0xd'),auth[_0x05c0('0x9')](),controller[_0x05c0('0xe')]);router['get']('/:id/download',auth[_0x05c0('0x9')](),controller['download']);router[_0x05c0('0xf')]('/',auth[_0x05c0('0x9')](),controller[_0x05c0('0x10')]);router['post'](_0x05c0('0xd'),auth['isAuthenticated'](),controller[_0x05c0('0x11')]);router[_0x05c0('0xf')](_0x05c0('0x12'),auth[_0x05c0('0x9')](),interaction[_0x05c0('0x13')](_0x05c0('0x14'),_0x05c0('0x15')),controller[_0x05c0('0x16')]);router['put'](_0x05c0('0x17'),auth[_0x05c0('0x9')](),interaction[_0x05c0('0x13')](_0x05c0('0x14'),_0x05c0('0x18')),controller[_0x05c0('0x19')]);router[_0x05c0('0x1a')](_0x05c0('0x17'),auth[_0x05c0('0x9')](),interaction['tracked'](_0x05c0('0x14'),_0x05c0('0x1b')),controller[_0x05c0('0x1c')]);router['delete'](_0x05c0('0x12'),auth[_0x05c0('0x9')](),controller[_0x05c0('0x1d')]);module[_0x05c0('0x1e')]=router; \ No newline at end of file +var _0x6e6c=['create','addMessage','tracked','sms','smsinteraction:addtags','addTags','/:id','smsinteraction:update','update','smsinteraction:destroy','destroy','delete','/:id/tags','removeTags','exports','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id/messages','getMessages','/:id/download','download','post'];(function(_0x4ffbc3,_0x51ea74){var _0x2d4b85=function(_0x1bdcd6){while(--_0x1bdcd6){_0x4ffbc3['push'](_0x4ffbc3['shift']());}};_0x2d4b85(++_0x51ea74);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x6e6c[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0xc6e6('0x0'));var util=require(_0xc6e6('0x1'));var path=require('path');var timeout=require(_0xc6e6('0x2'));var express=require(_0xc6e6('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc6e6('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xc6e6('0x5'));var controller=require('./smsInteraction.controller');router[_0xc6e6('0x6')]('/',auth[_0xc6e6('0x7')](),controller['index']);router[_0xc6e6('0x6')](_0xc6e6('0x8'),auth['isAuthenticated'](),controller[_0xc6e6('0x9')]);router[_0xc6e6('0x6')]('/:id',auth[_0xc6e6('0x7')](),controller['show']);router[_0xc6e6('0x6')](_0xc6e6('0xa'),auth[_0xc6e6('0x7')](),controller[_0xc6e6('0xb')]);router[_0xc6e6('0x6')](_0xc6e6('0xc'),auth[_0xc6e6('0x7')](),controller[_0xc6e6('0xd')]);router[_0xc6e6('0xe')]('/',auth['isAuthenticated'](),controller[_0xc6e6('0xf')]);router['post'](_0xc6e6('0xa'),auth[_0xc6e6('0x7')](),controller[_0xc6e6('0x10')]);router[_0xc6e6('0xe')]('/:id/tags',auth[_0xc6e6('0x7')](),interaction[_0xc6e6('0x11')](_0xc6e6('0x12'),_0xc6e6('0x13')),controller[_0xc6e6('0x14')]);router['put'](_0xc6e6('0x15'),auth[_0xc6e6('0x7')](),interaction['tracked'](_0xc6e6('0x12'),_0xc6e6('0x16')),controller[_0xc6e6('0x17')]);router['delete']('/:id',auth['isAuthenticated'](),interaction[_0xc6e6('0x11')]('sms',_0xc6e6('0x18')),controller[_0xc6e6('0x19')]);router[_0xc6e6('0x1a')](_0xc6e6('0x1b'),auth[_0xc6e6('0x7')](),controller[_0xc6e6('0x1c')]);module[_0xc6e6('0x1d')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 82e5549..550853c 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 _0xdbc6=['exports','DATE','STRING','ENUM','out','BOOLEAN','INTEGER'];(function(_0x388f52,_0x4c652c){var _0x121252=function(_0x5936ff){while(--_0x5936ff){_0x388f52['push'](_0x388f52['shift']());}};_0x121252(++_0x4c652c);}(_0xdbc6,0x13b));var _0x6dbc=function(_0x348ded,_0x3d0e22){_0x348ded=_0x348ded-0x0;var _0x2d652e=_0xdbc6[_0x348ded];return _0x2d652e;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x6dbc('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x6dbc('0x1')]},'disposition':{'type':Sequelize[_0x6dbc('0x2')]},'secondDisposition':{'type':Sequelize[_0x6dbc('0x2')]},'thirdDisposition':{'type':Sequelize[_0x6dbc('0x2')]},'note':{'type':Sequelize[_0x6dbc('0x2')]},'phone':{'type':Sequelize[_0x6dbc('0x2')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x6dbc('0x3')]('in',_0x6dbc('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x6dbc('0x3')]('in',_0x6dbc('0x4')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x6dbc('0x5')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x6dbc('0x6')]}}; \ No newline at end of file +var _0x6829=['ENUM','out','BOOLEAN','sequelize','moment','STRING','DATE'];(function(_0x363848,_0x46a12b){var _0x38e6ef=function(_0x15ab7e){while(--_0x15ab7e){_0x363848['push'](_0x363848['shift']());}};_0x38e6ef(++_0x46a12b);}(_0x6829,0x14c));var _0x9682=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x6829[_0x5f0089];return _0x193892;};'use strict';var Sequelize=require(_0x9682('0x0'));var moment=require(_0x9682('0x1'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x9682('0x2')]},'secondDisposition':{'type':Sequelize[_0x9682('0x2')]},'thirdDisposition':{'type':Sequelize[_0x9682('0x2')]},'note':{'type':Sequelize[_0x9682('0x2')]},'phone':{'type':Sequelize[_0x9682('0x2')]},'read1stAt':{'type':Sequelize[_0x9682('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x9682('0x4')]('in',_0x9682('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x9682('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x9682('0x4')]('in',_0x9682('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x9682('0x6')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 82ce702..0e1982e 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 _0xc7d3=['lastName','secret','value','renderFile','views','downloadInteraction.ejs','.pdf','unlinkSync','zip-dir','moment','bluebird','path','ejs','lodash','ioredis','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','status','end','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','sendStatus','error','stack','name','send','rawAttributes','type','key','getOptions','sms','query','user','catch','show','params','model','keys','SmsInteraction','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','create','body','describe','SmsMessage','addMessage','omit','ids','getMessages','findOne','hasOwnProperty','sort','where','pick','filter','map','$gte','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','spread','Tag','findAll','color','emit','smsInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','format','User','fullname','CmContact','Contact','firstName','Messages','direction','read','push','SmsAccount','Account','Owner','get','mkdirSync','Sms','closedAt','disposition','createdAt','System'];(function(_0x3c5ef3,_0x23f977){var _0x43d971=function(_0x5dc15a){while(--_0x5dc15a){_0x3c5ef3['push'](_0x3c5ef3['shift']());}};_0x43d971(++_0x23f977);}(_0xc7d3,0x1e8));var _0x3c7d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc7d3[_0x3dd15e];return _0x231fd0;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x3c7d('0x0'));var moment=require(_0x3c7d('0x1'));var BPromise=require(_0x3c7d('0x2'));var util=require('util');var path=require(_0x3c7d('0x3'));var ejs=require(_0x3c7d('0x4'));var fs=require('fs');var _=require(_0x3c7d('0x5'));var Redis=require(_0x3c7d('0x6'));var interaction=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var pdf=require(_0x3c7d('0x7'));var logger=require(_0x3c7d('0x8'))(_0x3c7d('0x9'));var config=require(_0x3c7d('0xa'));var db=require(_0x3c7d('0xb'))['db'];config[_0x3c7d('0xc')]=_[_0x3c7d('0xd')](config[_0x3c7d('0xc')],{'host':_0x3c7d('0xe'),'port':0x18eb});var socket=require(_0x3c7d('0xf'))(new Redis(config[_0x3c7d('0xc')]));require(_0x3c7d('0x10'))[_0x3c7d('0x11')](socket);function respondWithStatusCode(_0x46b0bf,_0xec958f){_0xec958f=_0xec958f||0xcc;return function(_0x210796){if(_0x210796){return _0x46b0bf['sendStatus'](_0xec958f);}return _0x46b0bf[_0x3c7d('0x12')](_0xec958f)[_0x3c7d('0x13')]();};}function respondWithResult(_0x2953af,_0x715e1d){_0x715e1d=_0x715e1d||0xc8;return function(_0x364af1){if(_0x364af1){return _0x2953af[_0x3c7d('0x12')](_0x715e1d)[_0x3c7d('0x14')](_0x364af1);}};}function respondWithFilteredResult(_0x4a6934,_0x561d44){return function(_0x5f3bee){if(_0x5f3bee){var _0x250fdb=typeof _0x561d44[_0x3c7d('0x15')]===_0x3c7d('0x16')&&typeof _0x561d44['limit']==='undefined';var _0x42d928=_0x5f3bee[_0x3c7d('0x17')];var _0x23bbe1=_0x250fdb?0x0:_0x561d44[_0x3c7d('0x15')];var _0x2f4586=_0x250fdb?_0x5f3bee[_0x3c7d('0x17')]:_0x561d44[_0x3c7d('0x15')]+_0x561d44[_0x3c7d('0x18')];var _0x508813;if(_0x2f4586>=_0x42d928){_0x2f4586=_0x42d928;_0x508813=0xc8;}else{_0x508813=0xce;}_0x4a6934[_0x3c7d('0x12')](_0x508813);return _0x4a6934[_0x3c7d('0x19')](_0x3c7d('0x1a'),_0x23bbe1+'-'+_0x2f4586+'/'+_0x42d928)[_0x3c7d('0x14')](_0x5f3bee);}return null;};}function saveUpdates(_0x47961b){return function(_0x381079){if(_0x381079){return _0x381079[_0x3c7d('0x1b')](_0x47961b)[_0x3c7d('0x1c')](function(_0x3646c4){return _0x3646c4;});}return null;};}function removeEntity(_0x5bcea1){return function(_0x53f518){if(_0x53f518){return _0x53f518[_0x3c7d('0x1d')]()[_0x3c7d('0x1c')](function(){_0x5bcea1[_0x3c7d('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4783c9){return function(_0x4eb075){if(!_0x4eb075){_0x4783c9[_0x3c7d('0x1e')](0x194);}return _0x4eb075;};}function handleError(_0x3bb5b9,_0x460aa6){_0x460aa6=_0x460aa6||0x1f4;return function(_0x557655){logger[_0x3c7d('0x1f')](_0x557655[_0x3c7d('0x20')]);if(_0x557655[_0x3c7d('0x21')]){delete _0x557655[_0x3c7d('0x21')];}_0x3bb5b9[_0x3c7d('0x12')](_0x460aa6)[_0x3c7d('0x22')](_0x557655);};}exports['index']=function(_0x679088,_0x5e67eb){var _0x3cde58={};var _0x39050e=_['map'](db['SmsInteraction'][_0x3c7d('0x23')],function(_0x4519f0){return{'name':_0x4519f0['fieldName'],'type':_0x4519f0[_0x3c7d('0x24')][_0x3c7d('0x25')]};});_0x3cde58=qs[_0x3c7d('0x26')](_0x39050e,_0x679088);return interaction['findAll'](_0x3c7d('0x27'),_0x679088[_0x3c7d('0x28')],_0x679088[_0x3c7d('0x29')],_0x3cde58,_0x39050e)['then'](respondWithFilteredResult(_0x5e67eb,_0x3cde58))[_0x3c7d('0x2a')](handleError(_0x5e67eb,null));};exports[_0x3c7d('0x2b')]=function(_0xe68b9f,_0x56f727){var _0x1506e7={'raw':![],'where':{'id':_0xe68b9f[_0x3c7d('0x2c')]['id']}},_0x55dabb={};_0x55dabb[_0x3c7d('0x2d')]=_[_0x3c7d('0x2e')](db[_0x3c7d('0x2f')][_0x3c7d('0x23')]);_0x55dabb[_0x3c7d('0x28')]=_[_0x3c7d('0x2e')](_0xe68b9f['query']);_0x55dabb[_0x3c7d('0x30')]=_[_0x3c7d('0x31')](_0x55dabb[_0x3c7d('0x2d')],_0x55dabb[_0x3c7d('0x28')]);_0x1506e7[_0x3c7d('0x32')]=_[_0x3c7d('0x31')](_0x55dabb[_0x3c7d('0x2d')],qs[_0x3c7d('0x33')](_0xe68b9f[_0x3c7d('0x28')][_0x3c7d('0x33')]));_0x1506e7[_0x3c7d('0x32')]=_0x1506e7[_0x3c7d('0x32')][_0x3c7d('0x34')]?_0x1506e7[_0x3c7d('0x32')]:_0x55dabb[_0x3c7d('0x2d')];if(_0xe68b9f['query'][_0x3c7d('0x35')]){_0x1506e7[_0x3c7d('0x36')]=[{'all':!![]}];}_0x1506e7=_[_0x3c7d('0x37')]({},_0x1506e7,_0xe68b9f[_0x3c7d('0x38')]);return db[_0x3c7d('0x2f')][_0x3c7d('0x39')](_0x1506e7)['then'](handleEntityNotFound(_0x56f727,null))[_0x3c7d('0x1c')](respondWithResult(_0x56f727,null))[_0x3c7d('0x2a')](handleError(_0x56f727,null));};exports[_0x3c7d('0x3a')]=function(_0x2f3509,_0x152521){return db[_0x3c7d('0x2f')][_0x3c7d('0x3a')](_0x2f3509[_0x3c7d('0x3b')],{})[_0x3c7d('0x1c')](respondWithResult(_0x152521,0xc9))[_0x3c7d('0x2a')](handleError(_0x152521,null));};exports['update']=function(_0x120f35,_0x2b6504){if(_0x120f35[_0x3c7d('0x3b')]['id']){delete _0x120f35[_0x3c7d('0x3b')]['id'];}return db[_0x3c7d('0x2f')][_0x3c7d('0x39')]({'where':{'id':_0x120f35[_0x3c7d('0x2c')]['id']}})[_0x3c7d('0x1c')](handleEntityNotFound(_0x2b6504,null))[_0x3c7d('0x1c')](saveUpdates(_0x120f35['body'],null))['then'](respondWithResult(_0x2b6504,null))['catch'](handleError(_0x2b6504,null));};exports[_0x3c7d('0x1d')]=function(_0x5208a1,_0x15593b){return db[_0x3c7d('0x2f')][_0x3c7d('0x39')]({'where':{'id':_0x5208a1[_0x3c7d('0x2c')]['id']}})['then'](handleEntityNotFound(_0x15593b,null))[_0x3c7d('0x1c')](removeEntity(_0x15593b,null))[_0x3c7d('0x2a')](handleError(_0x15593b,null));};exports[_0x3c7d('0x3c')]=function(_0x522ed6,_0x40eab3){return db[_0x3c7d('0x2f')]['describe']()['then'](respondWithResult(_0x40eab3,null))[_0x3c7d('0x2a')](handleError(_0x40eab3,null));};exports['addMessage']=function(_0x1bbd8e,_0x2da129){return db[_0x3c7d('0x3d')][_0x3c7d('0x39')]({'where':{'id':_0x1bbd8e[_0x3c7d('0x2c')]['id']}})[_0x3c7d('0x1c')](handleEntityNotFound(_0x2da129,null))[_0x3c7d('0x1c')](function(_0x5cb663){if(_0x5cb663){return _0x5cb663[_0x3c7d('0x3e')](_0x1bbd8e[_0x3c7d('0x3b')]['ids'],_[_0x3c7d('0x3f')](_0x1bbd8e[_0x3c7d('0x3b')],[_0x3c7d('0x40'),'id'])||{});}})[_0x3c7d('0x1c')](respondWithResult(_0x2da129,null))[_0x3c7d('0x2a')](handleError(_0x2da129,null));};exports[_0x3c7d('0x41')]=function(_0x16ab37,_0x226c0a){var _0x424949={'raw':![],'where':{}};var _0x288821={};var _0x2ecf05={'count':0x0,'rows':[]};return db['SmsInteraction'][_0x3c7d('0x42')]({'where':{'id':_0x16ab37['params']['id']}})[_0x3c7d('0x1c')](handleEntityNotFound(_0x226c0a,null))[_0x3c7d('0x1c')](function(_0x15fc06){if(_0x15fc06){_0x288821[_0x3c7d('0x2d')]=_[_0x3c7d('0x2e')](db[_0x3c7d('0x3d')][_0x3c7d('0x23')]);_0x288821[_0x3c7d('0x28')]=_[_0x3c7d('0x2e')](_0x16ab37[_0x3c7d('0x28')]);_0x288821[_0x3c7d('0x30')]=_[_0x3c7d('0x31')](_0x288821['model'],_0x288821[_0x3c7d('0x28')]);_0x424949[_0x3c7d('0x32')]=_['intersection'](_0x288821[_0x3c7d('0x2d')],qs[_0x3c7d('0x33')](_0x16ab37[_0x3c7d('0x28')]['fields']));_0x424949['attributes']=_0x424949['attributes']['length']?_0x424949[_0x3c7d('0x32')]:_0x288821['model'];if(!_0x16ab37['query'][_0x3c7d('0x43')]('nolimit')){_0x424949[_0x3c7d('0x18')]=qs[_0x3c7d('0x18')](_0x16ab37[_0x3c7d('0x28')][_0x3c7d('0x18')]);_0x424949[_0x3c7d('0x15')]=qs['offset'](_0x16ab37[_0x3c7d('0x28')][_0x3c7d('0x15')]);}_0x424949['order']=qs[_0x3c7d('0x44')](_0x16ab37[_0x3c7d('0x28')][_0x3c7d('0x44')]);_0x424949[_0x3c7d('0x45')]=qs[_0x3c7d('0x30')](_[_0x3c7d('0x46')](_0x16ab37[_0x3c7d('0x28')],_0x288821[_0x3c7d('0x30')]));_0x424949[_0x3c7d('0x45')]['SmsInteractionId']=_0x15fc06['id'];if(_0x16ab37['query'][_0x3c7d('0x47')]){_0x424949[_0x3c7d('0x45')]=_[_0x3c7d('0x37')](_0x424949['where'],{'$or':_[_0x3c7d('0x48')](_0x424949['attributes'],function(_0x51cf9b){var _0xf29893={};_0xf29893[_0x51cf9b]={'$like':'%'+_0x16ab37['query']['filter']+'%'};return _0xf29893;})});}if(_0x16ab37['query'][_0x3c7d('0x49')]){var _0x9b2d03=_0x16ab37['query'][_0x3c7d('0x49')]['split'](',');var _0x489386={};_0x489386[_0x9b2d03[0x0]]={'$gte':moment(_0x9b2d03[0x1])['format'](_0x3c7d('0x4a'))};_0x424949[_0x3c7d('0x45')]=_[_0x3c7d('0x37')](_0x424949[_0x3c7d('0x45')],_0x489386);}_0x424949=_[_0x3c7d('0x37')]({},_0x424949,_0x16ab37[_0x3c7d('0x38')]);return db[_0x3c7d('0x3d')]['count']({'where':_0x424949[_0x3c7d('0x45')]})[_0x3c7d('0x1c')](function(_0x32d1fa){_0x2ecf05[_0x3c7d('0x17')]=_0x32d1fa;if(_0x16ab37[_0x3c7d('0x28')][_0x3c7d('0x35')]){_0x424949[_0x3c7d('0x36')]=[{'all':!![]}];}return db[_0x3c7d('0x3d')]['findAll'](_0x424949);})[_0x3c7d('0x1c')](function(_0x12404a){_0x2ecf05['rows']=_0x12404a;return _0x2ecf05;});}})[_0x3c7d('0x1c')](respondWithFilteredResult(_0x226c0a,_0x424949))[_0x3c7d('0x2a')](handleError(_0x226c0a,null));};exports[_0x3c7d('0x4b')]=function(_0x368abd,_0x40e163){return db[_0x3c7d('0x2f')][_0x3c7d('0x39')]({'where':{'id':_0x368abd['params']['id']}})[_0x3c7d('0x1c')](handleEntityNotFound(_0x40e163,null))[_0x3c7d('0x1c')](function(_0x1697c2){if(_0x1697c2){return _0x1697c2[_0x3c7d('0x4c')](_0x368abd[_0x3c7d('0x3b')]['ids'],_[_0x3c7d('0x3f')](_0x368abd[_0x3c7d('0x3b')],[_0x3c7d('0x40'),'id'])||{})[_0x3c7d('0x4d')](function(){return db[_0x3c7d('0x4e')][_0x3c7d('0x4f')]({'attributes':['id',_0x3c7d('0x21'),_0x3c7d('0x50')],'where':{'id':_0x368abd['body'][_0x3c7d('0x40')]}});})[_0x3c7d('0x1c')](function(_0x26075b){socket[_0x3c7d('0x51')](_0x3c7d('0x52'),{'id':Number(_0x368abd[_0x3c7d('0x2c')]['id']),'tags':_0x26075b||[]});return{'id':Number(_0x368abd[_0x3c7d('0x2c')]['id']),'tags':_0x26075b||[]};});}})[_0x3c7d('0x1c')](respondWithResult(_0x40e163,null))['catch'](handleError(_0x40e163,null));};exports[_0x3c7d('0x53')]=function(_0x16e717,_0xdc3358){return db[_0x3c7d('0x2f')][_0x3c7d('0x39')]({'where':{'id':_0x16e717[_0x3c7d('0x2c')]['id']}})[_0x3c7d('0x1c')](handleEntityNotFound(_0xdc3358,null))[_0x3c7d('0x1c')](function(_0x5ecc96){if(_0x5ecc96){return _0x5ecc96[_0x3c7d('0x53')](_0x16e717[_0x3c7d('0x28')]['ids']);}})['then'](respondWithStatusCode(_0xdc3358,null))[_0x3c7d('0x2a')](handleError(_0xdc3358,null));};exports[_0x3c7d('0x54')]=function(_0x525bf7,_0x4fb2e8){var _0x5594aa=moment()[_0x3c7d('0x55')]()[_0x3c7d('0x56')]();var _0x404250=path[_0x3c7d('0x57')](config[_0x3c7d('0x58')],_0x3c7d('0x59'),_0x3c7d('0x5a'),_0x3c7d('0x5b'));var _0x52de22=path['join'](_0x404250,_0x5594aa);var _0x20ccf1=util[_0x3c7d('0x5c')]('transcript-%d-%s.zip',_0x525bf7[_0x3c7d('0x2c')]['id'],_0x5594aa);var _0x5971d1=path[_0x3c7d('0x57')](_0x404250,_0x20ccf1);var _0x28d22c=[];_0x28d22c['push']({'model':db[_0x3c7d('0x5d')],'as':_0x3c7d('0x5d'),'attributes':['id',_0x3c7d('0x5e')],'raw':!![]});_0x28d22c['push']({'model':db[_0x3c7d('0x5f')],'as':_0x3c7d('0x60'),'attributes':['id',_0x3c7d('0x61'),'lastName'],'raw':!![]});var _0x3ce7d9=[{'model':db[_0x3c7d('0x3d')],'as':_0x3c7d('0x62'),'attributes':['id','body','createdAt',_0x3c7d('0x63'),'secret',_0x3c7d('0x64')],'include':_0x28d22c}];_0x3ce7d9[_0x3c7d('0x65')]({'model':db[_0x3c7d('0x66')],'as':_0x3c7d('0x67'),'attributes':['id',_0x3c7d('0x21')]});_0x3ce7d9[_0x3c7d('0x65')]({'model':db[_0x3c7d('0x5d')],'as':_0x3c7d('0x68'),'attributes':['id','fullname']});return db[_0x3c7d('0x2f')][_0x3c7d('0x39')]({'where':{'id':_0x525bf7['params']['id']},'include':_0x3ce7d9})[_0x3c7d('0x1c')](handleEntityNotFound(_0x4fb2e8,null))[_0x3c7d('0x1c')](function(_0x55336d){if(_0x55336d){var _0x245ad8=_0x55336d[_0x3c7d('0x69')]({'plain':!![]});fs[_0x3c7d('0x6a')](_0x52de22);var _0x3d76e9={'channel':_0x3c7d('0x6b'),'account':_0x245ad8[_0x3c7d('0x67')][_0x3c7d('0x21')],'agent':_0x245ad8[_0x3c7d('0x68')]?_0x245ad8[_0x3c7d('0x68')][_0x3c7d('0x5e')]:'N.A.','createdAt':moment(_0x245ad8['createdAt'])[_0x3c7d('0x5c')](_0x3c7d('0x4a'))[_0x3c7d('0x56')](),'closedAt':_0x245ad8['closed']?moment(_0x245ad8[_0x3c7d('0x6c')])[_0x3c7d('0x5c')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x245ad8[_0x3c7d('0x6d')],'messages':_(_0x245ad8[_0x3c7d('0x62')])['filter']({'secret':![]})[_0x3c7d('0x48')](function(_0x5d8286){return{'date':moment(_0x5d8286[_0x3c7d('0x6e')])[_0x3c7d('0x5c')](_0x3c7d('0x4a'))[_0x3c7d('0x56')](),'sender':_0x5d8286['direction']==='out'?_0x5d8286[_0x3c7d('0x5d')]?_0x5d8286[_0x3c7d('0x5d')]['fullname']:_0x3c7d('0x6f'):_0x5d8286['Contact'][_0x3c7d('0x61')]+(_0x5d8286[_0x3c7d('0x60')][_0x3c7d('0x70')]?'\x20'+_0x5d8286['Contact'][_0x3c7d('0x70')]:''),'body':_0x5d8286[_0x3c7d('0x3b')],'direction':_0x5d8286[_0x3c7d('0x63')]==='out'?'A':'C','secret':_0x5d8286[_0x3c7d('0x71')],'read':_0x5d8286['read']};})[_0x3c7d('0x72')]()};return ejs[_0x3c7d('0x73')](path['join'](config[_0x3c7d('0x58')],'server',_0x3c7d('0x74'),_0x3c7d('0x75')),{'interaction':_0x3d76e9})[_0x3c7d('0x1c')](function(_0x4f2ceb){var _0x4011aa=path['join'](_0x52de22,'transcript-'+_0x245ad8['id']+'-'+_0x5594aa+_0x3c7d('0x76'));var _0x24f9e2={'path':_0x4011aa,'channel':_0x3c7d('0x6b'),'interactionId':_0x245ad8['id']};return pdf['createPdfFromHTML'](_0x4f2ceb,_0x24f9e2);})['then'](function(){return new BPromise(function(_0x225409,_0x3ac67d){zipdir(_0x52de22,{'saveTo':_0x5971d1},function(_0x56130e,_0x3ec78c){if(_0x56130e)return _0x3ac67d(_0x56130e);return _0x225409(_0x3ec78c);});})[_0x3c7d('0x1c')](function(){return new BPromise(function(_0x493092,_0x337f24){rimraf(_0x52de22,function(_0x40fb85){if(_0x40fb85)_0x337f24(_0x40fb85);return _0x493092();});});})[_0x3c7d('0x1c')](function(){return _0x4fb2e8[_0x3c7d('0x54')](_0x5971d1,_0x20ccf1,function(_0x2eadc2){if(_0x2eadc2){console['log']('err',_0x2eadc2);}else{fs[_0x3c7d('0x77')](_0x5971d1);}});});});}else{return _0x4fb2e8[_0x3c7d('0x1e')](0xc8);}})[_0x3c7d('0x2a')](handleError(_0x4fb2e8,null));}; \ No newline at end of file +var _0x36c3=['SmsMessage','addMessage','omit','getMessages','hasOwnProperty','nolimit','order','sort','where','SmsInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','options','include','rows','addTags','setTags','ids','spread','Tag','emit','smsInteractionTags:save','removeTags','download','unix','toString','join','root','files','tmp','User','fullname','push','CmContact','Contact','firstName','Messages','createdAt','direction','secret','read','SmsAccount','Account','Owner','mkdirSync','Sms','N.A.','closed','closedAt','out','System','lastName','value','server','views','createPdfFromHTML','log','err','unlinkSync','zip-dir','moment','bluebird','util','ejs','lodash','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','update','destroy','then','error','stack','name','send','index','SmsInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','sms','query','catch','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','merge','find','create','body','describe'];(function(_0x53ff8,_0x23e2f9){var _0x212442=function(_0xcb6971){while(--_0xcb6971){_0x53ff8['push'](_0x53ff8['shift']());}};_0x212442(++_0x23e2f9);}(_0x36c3,0x132));var _0x336c=function(_0x12ae97,_0x385f36){_0x12ae97=_0x12ae97-0x0;var _0xb50847=_0x36c3[_0x12ae97];return _0xb50847;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x336c('0x0'));var moment=require(_0x336c('0x1'));var BPromise=require(_0x336c('0x2'));var util=require(_0x336c('0x3'));var path=require('path');var ejs=require(_0x336c('0x4'));var fs=require('fs');var _=require(_0x336c('0x5'));var Redis=require('ioredis');var interaction=require(_0x336c('0x6'));var qs=require(_0x336c('0x7'));var pdf=require('../../components/export/pdf');var logger=require(_0x336c('0x8'))(_0x336c('0x9'));var config=require(_0x336c('0xa'));var db=require(_0x336c('0xb'))['db'];config[_0x336c('0xc')]=_[_0x336c('0xd')](config[_0x336c('0xc')],{'host':_0x336c('0xe'),'port':0x18eb});var socket=require(_0x336c('0xf'))(new Redis(config['redis']));require(_0x336c('0x10'))[_0x336c('0x11')](socket);function respondWithStatusCode(_0x5e7b4f,_0x2965a3){_0x2965a3=_0x2965a3||0xcc;return function(_0x2d58cf){if(_0x2d58cf){return _0x5e7b4f[_0x336c('0x12')](_0x2965a3);}return _0x5e7b4f[_0x336c('0x13')](_0x2965a3)[_0x336c('0x14')]();};}function respondWithResult(_0x379b03,_0x2ce64b){_0x2ce64b=_0x2ce64b||0xc8;return function(_0x4110a4){if(_0x4110a4){return _0x379b03['status'](_0x2ce64b)[_0x336c('0x15')](_0x4110a4);}};}function respondWithFilteredResult(_0x39f82d,_0x320427){return function(_0x402e52){if(_0x402e52){var _0x13e96a=typeof _0x320427[_0x336c('0x16')]===_0x336c('0x17')&&typeof _0x320427['limit']===_0x336c('0x17');var _0x114ef7=_0x402e52[_0x336c('0x18')];var _0x1089d6=_0x13e96a?0x0:_0x320427[_0x336c('0x16')];var _0x3dbc86=_0x13e96a?_0x402e52[_0x336c('0x18')]:_0x320427['offset']+_0x320427[_0x336c('0x19')];var _0x572e99;if(_0x3dbc86>=_0x114ef7){_0x3dbc86=_0x114ef7;_0x572e99=0xc8;}else{_0x572e99=0xce;}_0x39f82d[_0x336c('0x13')](_0x572e99);return _0x39f82d[_0x336c('0x1a')]('Content-Range',_0x1089d6+'-'+_0x3dbc86+'/'+_0x114ef7)[_0x336c('0x15')](_0x402e52);}return null;};}function saveUpdates(_0x35bc32){return function(_0x595ba8){if(_0x595ba8){return _0x595ba8[_0x336c('0x1b')](_0x35bc32)['then'](function(_0x1f48af){return _0x1f48af;});}return null;};}function removeEntity(_0x56b971){return function(_0x19843e){if(_0x19843e){return _0x19843e[_0x336c('0x1c')]()[_0x336c('0x1d')](function(){_0x56b971[_0x336c('0x13')](0xcc)[_0x336c('0x14')]();});}};}function handleEntityNotFound(_0x3d5981){return function(_0xf1d6e8){if(!_0xf1d6e8){_0x3d5981[_0x336c('0x12')](0x194);}return _0xf1d6e8;};}function handleError(_0x597567,_0x50945e){_0x50945e=_0x50945e||0x1f4;return function(_0x11759d){logger[_0x336c('0x1e')](_0x11759d[_0x336c('0x1f')]);if(_0x11759d[_0x336c('0x20')]){delete _0x11759d[_0x336c('0x20')];}_0x597567['status'](_0x50945e)[_0x336c('0x21')](_0x11759d);};}exports[_0x336c('0x22')]=function(_0x33c083,_0x127792){var _0x3fb9d8={};var _0x3f5ca8=_['map'](db[_0x336c('0x23')][_0x336c('0x24')],function(_0x3ac93f){return{'name':_0x3ac93f[_0x336c('0x25')],'type':_0x3ac93f[_0x336c('0x26')][_0x336c('0x27')]};});_0x3fb9d8=qs[_0x336c('0x28')](_0x3f5ca8,_0x33c083);return interaction[_0x336c('0x29')](_0x336c('0x2a'),_0x33c083[_0x336c('0x2b')],_0x33c083['user'],_0x3fb9d8,_0x3f5ca8)[_0x336c('0x1d')](respondWithFilteredResult(_0x127792,_0x3fb9d8))[_0x336c('0x2c')](handleError(_0x127792,null));};exports[_0x336c('0x2d')]=function(_0x2c4c7d,_0x466fe7){var _0x1ba26e={'raw':![],'where':{'id':_0x2c4c7d[_0x336c('0x2e')]['id']}},_0x556e7c={};_0x556e7c[_0x336c('0x2f')]=_[_0x336c('0x30')](db[_0x336c('0x23')][_0x336c('0x24')]);_0x556e7c[_0x336c('0x2b')]=_['keys'](_0x2c4c7d[_0x336c('0x2b')]);_0x556e7c[_0x336c('0x31')]=_[_0x336c('0x32')](_0x556e7c[_0x336c('0x2f')],_0x556e7c['query']);_0x1ba26e[_0x336c('0x33')]=_[_0x336c('0x32')](_0x556e7c[_0x336c('0x2f')],qs[_0x336c('0x34')](_0x2c4c7d[_0x336c('0x2b')]['fields']));_0x1ba26e['attributes']=_0x1ba26e[_0x336c('0x33')][_0x336c('0x35')]?_0x1ba26e['attributes']:_0x556e7c[_0x336c('0x2f')];if(_0x2c4c7d[_0x336c('0x2b')][_0x336c('0x36')]){_0x1ba26e['include']=[{'all':!![]}];}_0x1ba26e=_[_0x336c('0x37')]({},_0x1ba26e,_0x2c4c7d['options']);return db[_0x336c('0x23')][_0x336c('0x38')](_0x1ba26e)[_0x336c('0x1d')](handleEntityNotFound(_0x466fe7,null))['then'](respondWithResult(_0x466fe7,null))[_0x336c('0x2c')](handleError(_0x466fe7,null));};exports['create']=function(_0x1e2b8b,_0x53f4d4){return db[_0x336c('0x23')][_0x336c('0x39')](_0x1e2b8b[_0x336c('0x3a')],{})[_0x336c('0x1d')](respondWithResult(_0x53f4d4,0xc9))[_0x336c('0x2c')](handleError(_0x53f4d4,null));};exports[_0x336c('0x1b')]=function(_0x3f7e5a,_0x4c895b){if(_0x3f7e5a[_0x336c('0x3a')]['id']){delete _0x3f7e5a[_0x336c('0x3a')]['id'];}return db[_0x336c('0x23')][_0x336c('0x38')]({'where':{'id':_0x3f7e5a[_0x336c('0x2e')]['id']}})[_0x336c('0x1d')](handleEntityNotFound(_0x4c895b,null))[_0x336c('0x1d')](saveUpdates(_0x3f7e5a['body'],null))[_0x336c('0x1d')](respondWithResult(_0x4c895b,null))['catch'](handleError(_0x4c895b,null));};exports[_0x336c('0x1c')]=function(_0x426005,_0x50718b){return db[_0x336c('0x23')][_0x336c('0x38')]({'where':{'id':_0x426005[_0x336c('0x2e')]['id']}})[_0x336c('0x1d')](handleEntityNotFound(_0x50718b,null))[_0x336c('0x1d')](removeEntity(_0x50718b,null))[_0x336c('0x2c')](handleError(_0x50718b,null));};exports['describe']=function(_0x3b046a,_0x442c4d){return db[_0x336c('0x23')][_0x336c('0x3b')]()['then'](respondWithResult(_0x442c4d,null))[_0x336c('0x2c')](handleError(_0x442c4d,null));};exports['addMessage']=function(_0x5dea1f,_0x147201){return db[_0x336c('0x3c')][_0x336c('0x38')]({'where':{'id':_0x5dea1f[_0x336c('0x2e')]['id']}})[_0x336c('0x1d')](handleEntityNotFound(_0x147201,null))[_0x336c('0x1d')](function(_0x427d88){if(_0x427d88){return _0x427d88[_0x336c('0x3d')](_0x5dea1f['body']['ids'],_[_0x336c('0x3e')](_0x5dea1f['body'],['ids','id'])||{});}})[_0x336c('0x1d')](respondWithResult(_0x147201,null))[_0x336c('0x2c')](handleError(_0x147201,null));};exports[_0x336c('0x3f')]=function(_0x4b0019,_0x53522b){var _0x571678={'raw':![],'where':{}};var _0x168b83={};var _0x40ca4d={'count':0x0,'rows':[]};return db[_0x336c('0x23')]['findOne']({'where':{'id':_0x4b0019['params']['id']}})['then'](handleEntityNotFound(_0x53522b,null))['then'](function(_0x1f5932){if(_0x1f5932){_0x168b83[_0x336c('0x2f')]=_['keys'](db['SmsMessage']['rawAttributes']);_0x168b83[_0x336c('0x2b')]=_[_0x336c('0x30')](_0x4b0019[_0x336c('0x2b')]);_0x168b83[_0x336c('0x31')]=_[_0x336c('0x32')](_0x168b83[_0x336c('0x2f')],_0x168b83[_0x336c('0x2b')]);_0x571678[_0x336c('0x33')]=_[_0x336c('0x32')](_0x168b83[_0x336c('0x2f')],qs[_0x336c('0x34')](_0x4b0019[_0x336c('0x2b')][_0x336c('0x34')]));_0x571678[_0x336c('0x33')]=_0x571678[_0x336c('0x33')][_0x336c('0x35')]?_0x571678[_0x336c('0x33')]:_0x168b83[_0x336c('0x2f')];if(!_0x4b0019[_0x336c('0x2b')][_0x336c('0x40')](_0x336c('0x41'))){_0x571678['limit']=qs[_0x336c('0x19')](_0x4b0019[_0x336c('0x2b')][_0x336c('0x19')]);_0x571678['offset']=qs['offset'](_0x4b0019['query'][_0x336c('0x16')]);}_0x571678[_0x336c('0x42')]=qs[_0x336c('0x43')](_0x4b0019['query'][_0x336c('0x43')]);_0x571678[_0x336c('0x44')]=qs[_0x336c('0x31')](_['pick'](_0x4b0019[_0x336c('0x2b')],_0x168b83[_0x336c('0x31')]));_0x571678[_0x336c('0x44')][_0x336c('0x45')]=_0x1f5932['id'];if(_0x4b0019[_0x336c('0x2b')]['filter']){_0x571678[_0x336c('0x44')]=_[_0x336c('0x37')](_0x571678[_0x336c('0x44')],{'$or':_['map'](_0x571678[_0x336c('0x33')],function(_0x1f6db8){var _0x1ce07b={};_0x1ce07b[_0x1f6db8]={'$like':'%'+_0x4b0019[_0x336c('0x2b')][_0x336c('0x46')]+'%'};return _0x1ce07b;})});}if(_0x4b0019['query']['$gte']){var _0x549fc4=_0x4b0019[_0x336c('0x2b')][_0x336c('0x47')][_0x336c('0x48')](',');var _0x2f403d={};_0x2f403d[_0x549fc4[0x0]]={'$gte':moment(_0x549fc4[0x1])[_0x336c('0x49')](_0x336c('0x4a'))};_0x571678[_0x336c('0x44')]=_[_0x336c('0x37')](_0x571678[_0x336c('0x44')],_0x2f403d);}_0x571678=_['merge']({},_0x571678,_0x4b0019[_0x336c('0x4b')]);return db[_0x336c('0x3c')][_0x336c('0x18')]({'where':_0x571678[_0x336c('0x44')]})[_0x336c('0x1d')](function(_0x150cfb){_0x40ca4d[_0x336c('0x18')]=_0x150cfb;if(_0x4b0019[_0x336c('0x2b')]['includeAll']){_0x571678[_0x336c('0x4c')]=[{'all':!![]}];}return db[_0x336c('0x3c')][_0x336c('0x29')](_0x571678);})['then'](function(_0x1f3016){_0x40ca4d[_0x336c('0x4d')]=_0x1f3016;return _0x40ca4d;});}})[_0x336c('0x1d')](respondWithFilteredResult(_0x53522b,_0x571678))['catch'](handleError(_0x53522b,null));};exports[_0x336c('0x4e')]=function(_0x1d8a6c,_0x17078d){return db[_0x336c('0x23')][_0x336c('0x38')]({'where':{'id':_0x1d8a6c['params']['id']}})[_0x336c('0x1d')](handleEntityNotFound(_0x17078d,null))['then'](function(_0x2adf6d){if(_0x2adf6d){return _0x2adf6d[_0x336c('0x4f')](_0x1d8a6c['body'][_0x336c('0x50')],_['omit'](_0x1d8a6c[_0x336c('0x3a')],[_0x336c('0x50'),'id'])||{})[_0x336c('0x51')](function(){return db[_0x336c('0x52')][_0x336c('0x29')]({'attributes':['id',_0x336c('0x20'),'color'],'where':{'id':_0x1d8a6c[_0x336c('0x3a')][_0x336c('0x50')]}});})[_0x336c('0x1d')](function(_0xc0d554){socket[_0x336c('0x53')](_0x336c('0x54'),{'id':Number(_0x1d8a6c[_0x336c('0x2e')]['id']),'tags':_0xc0d554||[]});return{'id':Number(_0x1d8a6c[_0x336c('0x2e')]['id']),'tags':_0xc0d554||[]};});}})[_0x336c('0x1d')](respondWithResult(_0x17078d,null))[_0x336c('0x2c')](handleError(_0x17078d,null));};exports[_0x336c('0x55')]=function(_0x5dfa49,_0x18b28c){return db[_0x336c('0x23')][_0x336c('0x38')]({'where':{'id':_0x5dfa49[_0x336c('0x2e')]['id']}})['then'](handleEntityNotFound(_0x18b28c,null))[_0x336c('0x1d')](function(_0x19fccf){if(_0x19fccf){return _0x19fccf[_0x336c('0x55')](_0x5dfa49[_0x336c('0x2b')]['ids']);}})[_0x336c('0x1d')](respondWithStatusCode(_0x18b28c,null))[_0x336c('0x2c')](handleError(_0x18b28c,null));};exports[_0x336c('0x56')]=function(_0x537de5,_0x486aa5){var _0x3e7885=moment()[_0x336c('0x57')]()[_0x336c('0x58')]();var _0x4a7edf=path[_0x336c('0x59')](config[_0x336c('0x5a')],'server',_0x336c('0x5b'),_0x336c('0x5c'));var _0x4191e7=path['join'](_0x4a7edf,_0x3e7885);var _0x3fd449=util['format']('transcript-%d-%s.zip',_0x537de5[_0x336c('0x2e')]['id'],_0x3e7885);var _0x76a03f=path['join'](_0x4a7edf,_0x3fd449);var _0x39c675=[];_0x39c675['push']({'model':db[_0x336c('0x5d')],'as':_0x336c('0x5d'),'attributes':['id',_0x336c('0x5e')],'raw':!![]});_0x39c675[_0x336c('0x5f')]({'model':db[_0x336c('0x60')],'as':_0x336c('0x61'),'attributes':['id',_0x336c('0x62'),'lastName'],'raw':!![]});var _0x4a57e9=[{'model':db[_0x336c('0x3c')],'as':_0x336c('0x63'),'attributes':['id','body',_0x336c('0x64'),_0x336c('0x65'),_0x336c('0x66'),_0x336c('0x67')],'include':_0x39c675}];_0x4a57e9[_0x336c('0x5f')]({'model':db[_0x336c('0x68')],'as':_0x336c('0x69'),'attributes':['id',_0x336c('0x20')]});_0x4a57e9[_0x336c('0x5f')]({'model':db[_0x336c('0x5d')],'as':_0x336c('0x6a'),'attributes':['id',_0x336c('0x5e')]});return db[_0x336c('0x23')][_0x336c('0x38')]({'where':{'id':_0x537de5['params']['id']},'include':_0x4a57e9})[_0x336c('0x1d')](handleEntityNotFound(_0x486aa5,null))['then'](function(_0x5f0461){if(_0x5f0461){var _0x4d796e=_0x5f0461['get']({'plain':!![]});fs[_0x336c('0x6b')](_0x4191e7);var _0xef4e87={'channel':_0x336c('0x6c'),'account':_0x4d796e[_0x336c('0x69')][_0x336c('0x20')],'agent':_0x4d796e[_0x336c('0x6a')]?_0x4d796e[_0x336c('0x6a')][_0x336c('0x5e')]:_0x336c('0x6d'),'createdAt':moment(_0x4d796e['createdAt'])[_0x336c('0x49')](_0x336c('0x4a'))[_0x336c('0x58')](),'closedAt':_0x4d796e[_0x336c('0x6e')]?moment(_0x4d796e[_0x336c('0x6f')])['format'](_0x336c('0x4a'))['toString']():'','disposition':_0x4d796e['disposition'],'messages':_(_0x4d796e[_0x336c('0x63')])[_0x336c('0x46')]({'secret':![]})['map'](function(_0x319a15){return{'date':moment(_0x319a15['createdAt'])[_0x336c('0x49')](_0x336c('0x4a'))[_0x336c('0x58')](),'sender':_0x319a15[_0x336c('0x65')]===_0x336c('0x70')?_0x319a15[_0x336c('0x5d')]?_0x319a15[_0x336c('0x5d')][_0x336c('0x5e')]:_0x336c('0x71'):_0x319a15[_0x336c('0x61')][_0x336c('0x62')]+(_0x319a15['Contact'][_0x336c('0x72')]?'\x20'+_0x319a15['Contact'][_0x336c('0x72')]:''),'body':_0x319a15[_0x336c('0x3a')],'direction':_0x319a15[_0x336c('0x65')]==='out'?'A':'C','secret':_0x319a15['secret'],'read':_0x319a15[_0x336c('0x67')]};})[_0x336c('0x73')]()};return ejs['renderFile'](path[_0x336c('0x59')](config['root'],_0x336c('0x74'),_0x336c('0x75'),'downloadInteraction.ejs'),{'interaction':_0xef4e87})[_0x336c('0x1d')](function(_0x12279e){var _0x5aab6b=path[_0x336c('0x59')](_0x4191e7,'transcript-'+_0x4d796e['id']+'-'+_0x3e7885+'.pdf');var _0x1170c5={'path':_0x5aab6b,'channel':_0x336c('0x6c'),'interactionId':_0x4d796e['id']};return pdf[_0x336c('0x76')](_0x12279e,_0x1170c5);})[_0x336c('0x1d')](function(){return new BPromise(function(_0x15de48,_0x574f93){zipdir(_0x4191e7,{'saveTo':_0x76a03f},function(_0x1f9816,_0x4d9f7b){if(_0x1f9816)return _0x574f93(_0x1f9816);return _0x15de48(_0x4d9f7b);});})[_0x336c('0x1d')](function(){return new BPromise(function(_0x3cbe8f,_0x3c6aec){rimraf(_0x4191e7,function(_0x34d7f9){if(_0x34d7f9)_0x3c6aec(_0x34d7f9);return _0x3cbe8f();});});})['then'](function(){return _0x486aa5['download'](_0x76a03f,_0x3fd449,function(_0x2bfef2){if(_0x2bfef2){console[_0x336c('0x77')](_0x336c('0x78'),_0x2bfef2);}else{fs[_0x336c('0x79')](_0x76a03f);}});});});}else{return _0x486aa5[_0x336c('0x12')](0xc8);}})[_0x336c('0x2c')](handleError(_0x486aa5,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 0f10bed..f5a79cd 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 _0xadb5=['update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','catch','hasOwnProperty','exports','../../mysqldb','SmsMessage','setMaxListeners'];(function(_0x5a7f5f,_0xf95293){var _0x205d32=function(_0x12f654){while(--_0x12f654){_0x5a7f5f['push'](_0x5a7f5f['shift']());}};_0x205d32(++_0xf95293);}(_0xadb5,0xad));var _0x5adb=function(_0x36b32d,_0x2b265d){_0x36b32d=_0x36b32d-0x0;var _0x3d3efe=_0xadb5[_0x36b32d];return _0x3d3efe;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0x5adb('0x0'))['db']['SmsInteraction'];var SmsMessage=require(_0x5adb('0x0'))['db'][_0x5adb('0x1')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x5adb('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5adb('0x3'),'afterDestroy':_0x5adb('0x4')};function emitEvent(_0x2e3ef4){return function(_0x4cb1d1,_0x35a5d3,_0x168d89){_0x4cb1d1[_0x5adb('0x5')]({'attributes':['id'],'raw':!![]})[_0x5adb('0x6')](function(_0xdf3776){_0x4cb1d1[_0x5adb('0x7')](_0x5adb('0x8'),_0xdf3776[_0x5adb('0x9')](function(_0x41261c){return{'id':_0x41261c['id']};}));return SmsMessage[_0x5adb('0xa')]({'where':{'SmsInteractionId':_0x4cb1d1['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5adb('0x6')](function(_0x336bad){_0x4cb1d1[_0x5adb('0x7')](_0x5adb('0xb'),_0x336bad['length']);SmsInteractionEvents['emit'](_0x2e3ef4+':'+_0x4cb1d1['id'],_0x4cb1d1);SmsInteractionEvents[_0x5adb('0xc')](_0x2e3ef4,_0x4cb1d1);_0x168d89(null);})[_0x5adb('0xd')](_0x168d89(null));};}for(var e in events){if(events[_0x5adb('0xe')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x5adb('0xf')]=SmsInteractionEvents; \ No newline at end of file +var _0x1893=['SmsInteraction','../../mysqldb','SmsMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports'];(function(_0x13640e,_0x303d5d){var _0x4bc04d=function(_0x522dbb){while(--_0x522dbb){_0x13640e['push'](_0x13640e['shift']());}};_0x4bc04d(++_0x303d5d);}(_0x1893,0xa2));var _0x3189=function(_0x63de62,_0xe5cc89){_0x63de62=_0x63de62-0x0;var _0x3daddf=_0x1893[_0x63de62];return _0x3daddf;};'use strict';var EventEmitter=require('events');var SmsInteraction=require('../../mysqldb')['db'][_0x3189('0x0')];var SmsMessage=require(_0x3189('0x1'))['db'][_0x3189('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x3189('0x3')](0x0);var events={'afterCreate':_0x3189('0x4'),'afterUpdate':_0x3189('0x5'),'afterDestroy':_0x3189('0x6')};function emitEvent(_0x5371db){return function(_0x27445,_0x4faebf,_0x2333e6){_0x27445[_0x3189('0x7')]({'attributes':['id'],'raw':!![]})[_0x3189('0x8')](function(_0x118970){_0x27445[_0x3189('0x9')](_0x3189('0xa'),_0x118970['map'](function(_0x1d5f6a){return{'id':_0x1d5f6a['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x27445['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3189('0x8')](function(_0x4ac683){_0x27445[_0x3189('0x9')](_0x3189('0xb'),_0x4ac683[_0x3189('0xc')]);SmsInteractionEvents[_0x3189('0xd')](_0x5371db+':'+_0x27445['id'],_0x27445);SmsInteractionEvents['emit'](_0x5371db,_0x27445);_0x2333e6(null);})[_0x3189('0xe')](_0x2333e6(null));};}for(var e in events){if(events[_0x3189('0xf')](e)){var event=events[e];SmsInteraction[_0x3189('0x10')](e,emitEvent(event));}}module[_0x3189('0x11')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 4343c17..782c057 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 _0xe667=['bluebird','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','sms_interactions','closedAt','format','lodash','util','../../config/logger','moment'];(function(_0x5efae6,_0x342ade){var _0x23106f=function(_0x505fda){while(--_0x505fda){_0x5efae6['push'](_0x5efae6['shift']());}};_0x23106f(++_0x342ade);}(_0xe667,0x176));var _0x7e66=function(_0x59fda2,_0x37526f){_0x59fda2=_0x59fda2-0x0;var _0x482102=_0xe667[_0x59fda2];return _0x482102;};'use strict';var _=require(_0x7e66('0x0'));var util=require(_0x7e66('0x1'));var logger=require(_0x7e66('0x2'))('api');var moment=require(_0x7e66('0x3'));var BPromise=require(_0x7e66('0x4'));var rp=require(_0x7e66('0x5'));var fs=require('fs');var path=require(_0x7e66('0x6'));var rimraf=require(_0x7e66('0x7'));var config=require(_0x7e66('0x8'));var attributes=require(_0x7e66('0x9'));module[_0x7e66('0xa')]=function(_0x201d2f,_0xcd2439){return _0x201d2f['define']('SmsInteraction',attributes,{'tableName':_0x7e66('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x37884b,_0x446178,_0x682b95){if(_0x37884b['changed']('closed')){_0x37884b[_0x7e66('0xc')]=moment()[_0x7e66('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x682b95(null,_0x37884b);}}});}; \ No newline at end of file +var _0x2901=['./smsInteraction.attributes','exports','SmsInteraction','sms_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x239bb5,_0x144952){var _0x15e817=function(_0x3beea9){while(--_0x3beea9){_0x239bb5['push'](_0x239bb5['shift']());}};_0x15e817(++_0x144952);}(_0x2901,0x1d4));var _0x1290=function(_0x46716c,_0x437635){_0x46716c=_0x46716c-0x0;var _0xfe64d=_0x2901[_0x46716c];return _0xfe64d;};'use strict';var _=require(_0x1290('0x0'));var util=require('util');var logger=require(_0x1290('0x1'))(_0x1290('0x2'));var moment=require(_0x1290('0x3'));var BPromise=require(_0x1290('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1290('0x5'));var rimraf=require(_0x1290('0x6'));var config=require(_0x1290('0x7'));var attributes=require(_0x1290('0x8'));module[_0x1290('0x9')]=function(_0x418a31,_0x243e97){return _0x418a31['define'](_0x1290('0xa'),attributes,{'tableName':_0x1290('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1e5af0,_0x511dbd,_0x24955c){if(_0x1e5af0[_0x1290('0xc')](_0x1290('0xd'))){_0x1e5af0[_0x1290('0xe')]=moment()[_0x1290('0xf')](_0x1290('0x10'));}_0x24955c(null,_0x1e5af0);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 237a313..911c435 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 _0x0b26=['find','addTags','body','ids','omit','spread','AddTags','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./smsInteraction.socket','register','request','then','info','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','error','SmsInteraction,\x20%s,\x20%s','message','result','catch','UpdateSmsInteraction','SmsInteraction','options','raw','where','attributes','limit'];(function(_0x3b7e18,_0xb04a03){var _0x2a48cd=function(_0x137c08){while(--_0x137c08){_0x3b7e18['push'](_0x3b7e18['shift']());}};_0x2a48cd(++_0xb04a03);}(_0x0b26,0xab));var _0x60b2=function(_0x57928b,_0x29a111){_0x57928b=_0x57928b-0x0;var _0x49aad6=_0x0b26[_0x57928b];return _0x49aad6;};'use strict';var _=require(_0x60b2('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x60b2('0x1'));var rs=require(_0x60b2('0x2'));var fs=require('fs');var Redis=require(_0x60b2('0x3'));var db=require(_0x60b2('0x4'))['db'];var utils=require(_0x60b2('0x5'));var logger=require('../../config/logger')(_0x60b2('0x6'));var config=require(_0x60b2('0x7'));var jayson=require(_0x60b2('0x8'));var client=jayson[_0x60b2('0x9')][_0x60b2('0xa')]({'port':0x232a});config[_0x60b2('0xb')]=_[_0x60b2('0xc')](config['redis'],{'host':_0x60b2('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x60b2('0xe'))[_0x60b2('0xf')](socket);function respondWithRpcPromise(_0x432bb1,_0xa8d767,_0x13b0ad){return new BPromise(function(_0x19a2ac,_0x2b0155){return client[_0x60b2('0x10')](_0x432bb1,_0x13b0ad)[_0x60b2('0x11')](function(_0x2bb00e){logger[_0x60b2('0x12')]('SmsInteraction,\x20%s,\x20%s',_0xa8d767,_0x60b2('0x13'));logger[_0x60b2('0x14')](_0x60b2('0x15'),_0xa8d767,_0x60b2('0x13'),JSON['stringify'](_0x2bb00e));if(_0x2bb00e[_0x60b2('0x16')]){if(_0x2bb00e[_0x60b2('0x16')]['code']===0x1f4){logger[_0x60b2('0x16')](_0x60b2('0x17'),_0xa8d767,_0x2bb00e[_0x60b2('0x16')][_0x60b2('0x18')]);return _0x2b0155(_0x2bb00e['error'][_0x60b2('0x18')]);}logger[_0x60b2('0x16')](_0x60b2('0x17'),_0xa8d767,_0x2bb00e[_0x60b2('0x16')]['message']);return _0x19a2ac(_0x2bb00e[_0x60b2('0x16')][_0x60b2('0x18')]);}else{logger[_0x60b2('0x12')](_0x60b2('0x17'),_0xa8d767,'request\x20sent');_0x19a2ac(_0x2bb00e[_0x60b2('0x19')][_0x60b2('0x18')]);}})[_0x60b2('0x1a')](function(_0x59c047){logger[_0x60b2('0x16')]('SmsInteraction,\x20%s,\x20%s',_0xa8d767,_0x59c047);_0x2b0155(_0x59c047);});});}exports[_0x60b2('0x1b')]=function(_0x2fdd11){var _0x2be5c2=this;return new Promise(function(_0x1e696b,_0x5a7b5f){return db[_0x60b2('0x1c')]['update'](_0x2fdd11['body'],{'raw':_0x2fdd11['options']?_0x2fdd11[_0x60b2('0x1d')][_0x60b2('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2fdd11[_0x60b2('0x1d')]?_0x2fdd11[_0x60b2('0x1d')][_0x60b2('0x1f')]||null:null,'attributes':_0x2fdd11[_0x60b2('0x1d')]?_0x2fdd11[_0x60b2('0x1d')][_0x60b2('0x20')]||null:null,'limit':_0x2fdd11[_0x60b2('0x1d')]?_0x2fdd11[_0x60b2('0x1d')][_0x60b2('0x21')]||null:null})[_0x60b2('0x11')](function(_0xb39669){logger['info'](_0x60b2('0x1b'),_0x2fdd11);logger[_0x60b2('0x14')](_0x60b2('0x1b'),_0x2fdd11,JSON['stringify'](_0xb39669));_0x1e696b(_0xb39669);})['catch'](function(_0x2ac3d0){logger[_0x60b2('0x16')](_0x60b2('0x1b'),_0x2ac3d0[_0x60b2('0x18')],_0x2fdd11);_0x5a7b5f(_0x2be5c2[_0x60b2('0x16')](0x1f4,_0x2ac3d0[_0x60b2('0x18')]));});});};exports['AddTagsToSmsInteraction']=function(_0x2a5913){return new Promise(function(_0x570381,_0x46b9ce){return db[_0x60b2('0x1c')][_0x60b2('0x22')]({'where':_0x2a5913[_0x60b2('0x1d')]?_0x2a5913[_0x60b2('0x1d')][_0x60b2('0x1f')]||null:null})[_0x60b2('0x11')](function(_0x1db6f3){if(_0x1db6f3){return _0x1db6f3[_0x60b2('0x23')](_0x2a5913[_0x60b2('0x24')][_0x60b2('0x25')],_[_0x60b2('0x26')](_0x2a5913[_0x60b2('0x24')],[_0x60b2('0x25'),'id'])||{});}})[_0x60b2('0x27')](function(_0x4e4867){logger[_0x60b2('0x12')](_0x60b2('0x28'),_0x2a5913);logger['debug'](_0x60b2('0x28'),_0x2a5913,JSON['stringify'](_0x4e4867));_0x570381(_0x4e4867);})['catch'](function(_0x4f6342){logger['error'](_0x60b2('0x28'),_0x4f6342[_0x60b2('0x18')],_0x2a5913);_0x46b9ce(_this[_0x60b2('0x16')](0x1f4,_0x4f6342['message']));});});}; \ No newline at end of file +var _0x8fea=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','defaults','localhost','./smsInteraction.socket','register','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','UpdateSmsInteraction','SmsInteraction','update','body','options','where','attributes','limit','stringify','catch','AddTagsToSmsInteraction','find','addTags','ids','AddTags','lodash','bluebird','randomstring'];(function(_0x2c0f14,_0x543765){var _0x57b26=function(_0x20c81e){while(--_0x20c81e){_0x2c0f14['push'](_0x2c0f14['shift']());}};_0x57b26(++_0x543765);}(_0x8fea,0xe7));var _0xa8fe=function(_0x494c6f,_0x54dbe7){_0x494c6f=_0x494c6f-0x0;var _0x4c9c08=_0x8fea[_0x494c6f];return _0x4c9c08;};'use strict';var _=require(_0xa8fe('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa8fe('0x1'));var rs=require(_0xa8fe('0x2'));var fs=require('fs');var Redis=require(_0xa8fe('0x3'));var db=require(_0xa8fe('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa8fe('0x5'))(_0xa8fe('0x6'));var config=require(_0xa8fe('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa8fe('0x8')][_0xa8fe('0x9')]({'port':0x232a});config['redis']=_[_0xa8fe('0xa')](config['redis'],{'host':_0xa8fe('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa8fe('0xc'))[_0xa8fe('0xd')](socket);function respondWithRpcPromise(_0x232bac,_0x2ba2a1,_0x3eda6a){return new BPromise(function(_0x5543e4,_0xbdb0a8){return client['request'](_0x232bac,_0x3eda6a)[_0xa8fe('0xe')](function(_0x199ce9){logger[_0xa8fe('0xf')](_0xa8fe('0x10'),_0x2ba2a1,_0xa8fe('0x11'));logger[_0xa8fe('0x12')](_0xa8fe('0x13'),_0x2ba2a1,_0xa8fe('0x11'),JSON['stringify'](_0x199ce9));if(_0x199ce9['error']){if(_0x199ce9[_0xa8fe('0x14')][_0xa8fe('0x15')]===0x1f4){logger['error'](_0xa8fe('0x10'),_0x2ba2a1,_0x199ce9[_0xa8fe('0x14')][_0xa8fe('0x16')]);return _0xbdb0a8(_0x199ce9['error'][_0xa8fe('0x16')]);}logger[_0xa8fe('0x14')]('SmsInteraction,\x20%s,\x20%s',_0x2ba2a1,_0x199ce9[_0xa8fe('0x14')]['message']);return _0x5543e4(_0x199ce9[_0xa8fe('0x14')][_0xa8fe('0x16')]);}else{logger[_0xa8fe('0xf')](_0xa8fe('0x10'),_0x2ba2a1,'request\x20sent');_0x5543e4(_0x199ce9[_0xa8fe('0x17')][_0xa8fe('0x16')]);}})['catch'](function(_0x4988d1){logger[_0xa8fe('0x14')](_0xa8fe('0x10'),_0x2ba2a1,_0x4988d1);_0xbdb0a8(_0x4988d1);});});}exports[_0xa8fe('0x18')]=function(_0x374c04){var _0x96023f=this;return new Promise(function(_0x37cc84,_0x5a82ef){return db[_0xa8fe('0x19')][_0xa8fe('0x1a')](_0x374c04[_0xa8fe('0x1b')],{'raw':_0x374c04['options']?_0x374c04[_0xa8fe('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x374c04[_0xa8fe('0x1c')]?_0x374c04[_0xa8fe('0x1c')][_0xa8fe('0x1d')]||null:null,'attributes':_0x374c04['options']?_0x374c04[_0xa8fe('0x1c')][_0xa8fe('0x1e')]||null:null,'limit':_0x374c04['options']?_0x374c04['options'][_0xa8fe('0x1f')]||null:null})[_0xa8fe('0xe')](function(_0x4adacc){logger[_0xa8fe('0xf')]('UpdateSmsInteraction',_0x374c04);logger[_0xa8fe('0x12')]('UpdateSmsInteraction',_0x374c04,JSON[_0xa8fe('0x20')](_0x4adacc));_0x37cc84(_0x4adacc);})[_0xa8fe('0x21')](function(_0x3b1444){logger[_0xa8fe('0x14')](_0xa8fe('0x18'),_0x3b1444[_0xa8fe('0x16')],_0x374c04);_0x5a82ef(_0x96023f[_0xa8fe('0x14')](0x1f4,_0x3b1444[_0xa8fe('0x16')]));});});};exports[_0xa8fe('0x22')]=function(_0x1acba1){return new Promise(function(_0x578509,_0x3abd54){return db['SmsInteraction'][_0xa8fe('0x23')]({'where':_0x1acba1[_0xa8fe('0x1c')]?_0x1acba1[_0xa8fe('0x1c')][_0xa8fe('0x1d')]||null:null})[_0xa8fe('0xe')](function(_0x2a878c){if(_0x2a878c){return _0x2a878c[_0xa8fe('0x24')](_0x1acba1[_0xa8fe('0x1b')][_0xa8fe('0x25')],_['omit'](_0x1acba1[_0xa8fe('0x1b')],[_0xa8fe('0x25'),'id'])||{});}})['spread'](function(_0x2df74a){logger[_0xa8fe('0xf')]('AddTags',_0x1acba1);logger['debug'](_0xa8fe('0x26'),_0x1acba1,JSON[_0xa8fe('0x20')](_0x2df74a));_0x578509(_0x2df74a);})[_0xa8fe('0x21')](function(_0x319a72){logger[_0xa8fe('0x14')](_0xa8fe('0x26'),_0x319a72[_0xa8fe('0x16')],_0x1acba1);_0x3abd54(_this[_0xa8fe('0x14')](0x1f4,_0x319a72[_0xa8fe('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 46b4bf4..b4abcb0 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 _0x8c3b=['register','length','smsInteraction:','remove','emit'];(function(_0x192738,_0x2ed0b5){var _0x254bcc=function(_0x16b41c){while(--_0x16b41c){_0x192738['push'](_0x192738['shift']());}};_0x254bcc(++_0x2ed0b5);}(_0x8c3b,0x1a7));var _0xb8c3=function(_0x29b327,_0x195857){_0x29b327=_0x29b327-0x0;var _0x476a38=_0x8c3b[_0x29b327];return _0x476a38;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=['save',_0xb8c3('0x0'),'update'];function createListener(_0x4a6c88,_0x124d7b){return function(_0x5b0c7a){_0x124d7b[_0xb8c3('0x1')](_0x4a6c88,_0x5b0c7a);};}function removeListener(_0x403481,_0x46077f){return function(){SmsInteractionEvents['removeListener'](_0x403481,_0x46077f);};}exports[_0xb8c3('0x2')]=function(_0x3b0540){for(var _0x3c7ac8=0x0,_0x5f0eda=events[_0xb8c3('0x3')];_0x3c7ac8<_0x5f0eda;_0x3c7ac8++){var _0x2a3a14=events[_0x3c7ac8];var _0x59ba82=createListener(_0xb8c3('0x4')+_0x2a3a14,_0x3b0540);SmsInteractionEvents['on'](_0x2a3a14,_0x59ba82);}}; \ No newline at end of file +var _0x31ee=['smsInteraction:','./smsInteraction.events','save','remove','emit','register','length'];(function(_0x2ef8c1,_0x2f72f4){var _0x288305=function(_0x56244b){while(--_0x56244b){_0x2ef8c1['push'](_0x2ef8c1['shift']());}};_0x288305(++_0x2f72f4);}(_0x31ee,0x120));var _0xe31e=function(_0x5e454a,_0x2c949c){_0x5e454a=_0x5e454a-0x0;var _0x2bafa1=_0x31ee[_0x5e454a];return _0x2bafa1;};'use strict';var SmsInteractionEvents=require(_0xe31e('0x0'));var events=[_0xe31e('0x1'),_0xe31e('0x2'),'update'];function createListener(_0x567759,_0x496099){return function(_0x461ae2){_0x496099[_0xe31e('0x3')](_0x567759,_0x461ae2);};}function removeListener(_0x3e460e,_0x3dc35f){return function(){SmsInteractionEvents['removeListener'](_0x3e460e,_0x3dc35f);};}exports[_0xe31e('0x4')]=function(_0x239fb2){for(var _0x4d9857=0x0,_0x177a90=events[_0xe31e('0x5')];_0x4d9857<_0x177a90;_0x4d9857++){var _0x9b43d1=events[_0x4d9857];var _0x51b236=createListener(_0xe31e('0x6')+_0x9b43d1,_0x239fb2);SmsInteractionEvents['on'](_0x9b43d1,_0x51b236);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 4a3ef0b..44d2ece 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 _0x0498=['update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','express','Router','./smsMessage.controller','isAuthenticated','index','describe','tracked','sms','smsmessage:create','create','post','/:id/status','status','put','/:id'];(function(_0x589aee,_0x140a03){var _0x2f5ed4=function(_0x3d224f){while(--_0x3d224f){_0x589aee['push'](_0x589aee['shift']());}};_0x2f5ed4(++_0x140a03);}(_0x0498,0x1dc));var _0x8049=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x0498[_0x432682];return _0x463d05;};'use strict';var multer=require(_0x8049('0x0'));var util=require(_0x8049('0x1'));var path=require(_0x8049('0x2'));var timeout=require('connect-timeout');var express=require(_0x8049('0x3'));var router=express[_0x8049('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(_0x8049('0x5'));router['get']('/',auth[_0x8049('0x6')](),controller[_0x8049('0x7')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x8049('0x8')]);router['get']('/:id',auth[_0x8049('0x6')](),controller['show']);router['post']('/',auth[_0x8049('0x6')](),interaction[_0x8049('0x9')](_0x8049('0xa'),_0x8049('0xb')),controller[_0x8049('0xc')]);router[_0x8049('0xd')](_0x8049('0xe'),controller[_0x8049('0xf')]);router[_0x8049('0x10')](_0x8049('0x11'),auth[_0x8049('0x6')](),controller[_0x8049('0x12')]);router[_0x8049('0x10')](_0x8049('0x13'),auth[_0x8049('0x6')](),controller[_0x8049('0x14')]);router['put'](_0x8049('0x15'),auth['isAuthenticated'](),controller[_0x8049('0x16')]);router[_0x8049('0x17')](_0x8049('0x11'),auth['isAuthenticated'](),controller[_0x8049('0x18')]);module[_0x8049('0x19')]=router; \ No newline at end of file +var _0xdac7=['multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','sms','smsmessage:create','create','update','/:id/accept','accept','put','/:id/reject','reject','exports'];(function(_0x35ec00,_0x12ad42){var _0x8fdad5=function(_0x3f4158){while(--_0x3f4158){_0x35ec00['push'](_0x35ec00['shift']());}};_0x8fdad5(++_0x12ad42);}(_0xdac7,0x180));var _0x7dac=function(_0x47a52b,_0x117767){_0x47a52b=_0x47a52b-0x0;var _0x575dd7=_0xdac7[_0x47a52b];return _0x575dd7;};'use strict';var multer=require(_0x7dac('0x0'));var util=require(_0x7dac('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7dac('0x2')]();var fs_extra=require(_0x7dac('0x3'));var auth=require(_0x7dac('0x4'));var interaction=require(_0x7dac('0x5'));var config=require('../../config/environment');var controller=require('./smsMessage.controller');router['get']('/',auth[_0x7dac('0x6')](),controller[_0x7dac('0x7')]);router['get'](_0x7dac('0x8'),auth['isAuthenticated'](),controller[_0x7dac('0x9')]);router['get'](_0x7dac('0xa'),auth[_0x7dac('0x6')](),controller[_0x7dac('0xb')]);router[_0x7dac('0xc')]('/',auth[_0x7dac('0x6')](),interaction[_0x7dac('0xd')](_0x7dac('0xe'),_0x7dac('0xf')),controller[_0x7dac('0x10')]);router[_0x7dac('0xc')]('/:id/status',controller['status']);router['put'](_0x7dac('0xa'),auth['isAuthenticated'](),controller[_0x7dac('0x11')]);router['put'](_0x7dac('0x12'),auth[_0x7dac('0x6')](),controller[_0x7dac('0x13')]);router[_0x7dac('0x14')](_0x7dac('0x15'),auth[_0x7dac('0x6')](),controller[_0x7dac('0x16')]);router['delete'](_0x7dac('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x7dac('0x17')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index e19c07f..da9b4ce 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 _0xab3d=['out','STRING','DATE','TEXT','sequelize','exports','medium','BOOLEAN','ENUM'];(function(_0x5a4bf6,_0x5cb349){var _0x8c3b38=function(_0x67895e){while(--_0x67895e){_0x5a4bf6['push'](_0x5a4bf6['shift']());}};_0x8c3b38(++_0x5cb349);}(_0xab3d,0x82));var _0xdab3=function(_0x4d928a,_0x44d8cc){_0x4d928a=_0x4d928a-0x0;var _0x1d9540=_0xab3d[_0x4d928a];return _0x1d9540;};'use strict';var Sequelize=require(_0xdab3('0x0'));module[_0xdab3('0x1')]={'body':{'type':Sequelize['TEXT'](_0xdab3('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xdab3('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xdab3('0x4')]('in',_0xdab3('0x5')),'defaultValue':_0xdab3('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xdab3('0x6')](0xbe)},'phone':{'type':Sequelize[_0xdab3('0x6')]},'readAt':{'type':Sequelize[_0xdab3('0x7')]},'secret':{'type':Sequelize[_0xdab3('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xdab3('0x6')]},'providerResponse':{'type':Sequelize[_0xdab3('0x8')]}}; \ No newline at end of file +var _0x6a3b=['exports','TEXT','medium','ENUM','out','STRING','DATE'];(function(_0x9db88,_0x110607){var _0x3ecd4c=function(_0x16eb66){while(--_0x16eb66){_0x9db88['push'](_0x9db88['shift']());}};_0x3ecd4c(++_0x110607);}(_0x6a3b,0x134));var _0xb6a3=function(_0x19cc9d,_0x259def){_0x19cc9d=_0x19cc9d-0x0;var _0x81ce21=_0x6a3b[_0x19cc9d];return _0x81ce21;};'use strict';var Sequelize=require('sequelize');module[_0xb6a3('0x0')]={'body':{'type':Sequelize[_0xb6a3('0x1')](_0xb6a3('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xb6a3('0x3')]('in','out'),'defaultValue':_0xb6a3('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xb6a3('0x5')](0xbe)},'phone':{'type':Sequelize[_0xb6a3('0x5')]},'readAt':{'type':Sequelize[_0xb6a3('0x6')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0xb6a3('0x5')]},'providerResponse':{'type':Sequelize[_0xb6a3('0x1')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index c0f49ab..add4e55 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 _0xc69b=['lodash','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','offset','limit','undefined','count','json','destroy','end','sendStatus','stack','name','send','index','map','rawAttributes','type','key','query','keys','filters','model','attributes','intersection','fields','nolimit','where','pick','filter','merge','VIRTUAL','options','SmsMessage','includeAll','include','show','params','create','body','update','find','describe','accept','sms','acceptMessage','reject','UserId','user','get','SmsInteraction','SmsInteractionId','interaction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','User','agent','email','internal','interface','format','channel','motionChannel','event','EventManager','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','delivered','infobip','results','DELIVERED','util'];(function(_0x3cbb14,_0x3c95a7){var _0x2bfb35=function(_0x384c4d){while(--_0x384c4d){_0x3cbb14['push'](_0x3cbb14['shift']());}};_0x2bfb35(++_0x3c95a7);}(_0xc69b,0x1d3));var _0xbc69=function(_0x4f3c9b,_0x28e078){_0x4f3c9b=_0x4f3c9b-0x0;var _0x84e58a=_0xc69b[_0x4f3c9b];return _0x84e58a;};'use strict';var util=require(_0xbc69('0x0'));var _=require(_0xbc69('0x1'));var Redis=require('ioredis');var interactionService=require(_0xbc69('0x2'));var qs=require(_0xbc69('0x3'));var logger=require(_0xbc69('0x4'))(_0xbc69('0x5'));var config=require(_0xbc69('0x6'));var db=require(_0xbc69('0x7'))['db'];config[_0xbc69('0x8')]=_[_0xbc69('0x9')](config[_0xbc69('0x8')],{'host':_0xbc69('0xa'),'port':0x18eb});var socket=require(_0xbc69('0xb'))(new Redis(config['redis']));require(_0xbc69('0xc'))[_0xbc69('0xd')](socket);var jayson=require(_0xbc69('0xe'));var client=jayson[_0xbc69('0xf')]['http']({'port':0x232c});var client9002=jayson[_0xbc69('0xf')][_0xbc69('0x10')]({'port':0x232a});var interaction_log=require(_0xbc69('0x4'))('sms-interactions');function respondWithRpcPromise(_0x15df1c,_0x54dd94,_0x5d91d4,_0x17934f){return new Promise(function(_0x479b01,_0x1425ce){var _0x1db934=_0x17934f||client;return _0x1db934['request'](_0x15df1c,_0x5d91d4)[_0xbc69('0x11')](function(_0x42f446){logger[_0xbc69('0x12')](_0xbc69('0x13'),_0x54dd94,_0xbc69('0x14'));logger[_0xbc69('0x15')](_0xbc69('0x16'),_0x54dd94,_0xbc69('0x14'),JSON[_0xbc69('0x17')](_0x42f446));if(_0x42f446[_0xbc69('0x18')]){if(_0x42f446['error'][_0xbc69('0x19')]===0x1f4){logger[_0xbc69('0x18')](_0xbc69('0x13'),_0x54dd94,_0x42f446[_0xbc69('0x18')][_0xbc69('0x1a')]);return _0x1425ce(_0x42f446['error']['message']);}logger[_0xbc69('0x18')](_0xbc69('0x13'),_0x54dd94,_0x42f446[_0xbc69('0x18')]['message']);return _0x479b01(_0x42f446['error'][_0xbc69('0x1a')]);}else{logger[_0xbc69('0x12')](_0xbc69('0x13'),_0x54dd94,_0xbc69('0x14'));_0x479b01(_0x42f446[_0xbc69('0x1b')][_0xbc69('0x1a')]);}})[_0xbc69('0x1c')](function(_0x544564){logger['error'](_0xbc69('0x13'),_0x54dd94,_0x544564);_0x1425ce(_0x544564);});});}function respondWithResult(_0x141319,_0x1802cc){_0x1802cc=_0x1802cc||0xc8;return function(_0x384121){if(_0x384121){return _0x141319[_0xbc69('0x1d')](_0x1802cc)['json'](_0x384121);}};}function respondWithFilteredResult(_0x28c38b,_0x22cc8b){return function(_0x13bde1){if(_0x13bde1){var _0x2ec91a=typeof _0x22cc8b[_0xbc69('0x1e')]==='undefined'&&typeof _0x22cc8b[_0xbc69('0x1f')]===_0xbc69('0x20');var _0x342806=_0x13bde1[_0xbc69('0x21')];var _0x56c0da=_0x2ec91a?0x0:_0x22cc8b[_0xbc69('0x1e')];var _0xc40abc=_0x2ec91a?_0x13bde1[_0xbc69('0x21')]:_0x22cc8b[_0xbc69('0x1e')]+_0x22cc8b[_0xbc69('0x1f')];var _0xe14436;if(_0xc40abc>=_0x342806){_0xc40abc=_0x342806;_0xe14436=0xc8;}else{_0xe14436=0xce;}_0x28c38b[_0xbc69('0x1d')](_0xe14436);return _0x28c38b['set']('Content-Range',_0x56c0da+'-'+_0xc40abc+'/'+_0x342806)[_0xbc69('0x22')](_0x13bde1);}return null;};}function saveUpdates(_0x276d20){return function(_0x7df4d6){if(_0x7df4d6){return _0x7df4d6['update'](_0x276d20)[_0xbc69('0x11')](function(_0x556258){return _0x556258;});}return null;};}function removeEntity(_0x14daa0){return function(_0x26594e){if(_0x26594e){return _0x26594e[_0xbc69('0x23')]()[_0xbc69('0x11')](function(){_0x14daa0[_0xbc69('0x1d')](0xcc)[_0xbc69('0x24')]();});}};}function handleEntityNotFound(_0x1e41ae){return function(_0x5d42ca){if(!_0x5d42ca){_0x1e41ae[_0xbc69('0x25')](0x194);}return _0x5d42ca;};}function handleError(_0x544d96,_0x407871){_0x407871=_0x407871||0x1f4;return function(_0x4566b5){logger[_0xbc69('0x18')](_0x4566b5[_0xbc69('0x26')]);if(_0x4566b5[_0xbc69('0x27')]){delete _0x4566b5[_0xbc69('0x27')];}_0x544d96[_0xbc69('0x1d')](_0x407871)[_0xbc69('0x28')](_0x4566b5);};}exports[_0xbc69('0x29')]=function(_0x5b064a,_0x1595ca){var _0x5289d6={},_0x1cde35={},_0x25cf75={'count':0x0,'rows':[]};var _0x15720f=_[_0xbc69('0x2a')](db['SmsMessage'][_0xbc69('0x2b')],function(_0x2c3bff){return{'name':_0x2c3bff['fieldName'],'type':_0x2c3bff[_0xbc69('0x2c')][_0xbc69('0x2d')]};});_0x1cde35['model']=_[_0xbc69('0x2a')](_0x15720f,'name');_0x1cde35[_0xbc69('0x2e')]=_[_0xbc69('0x2f')](_0x5b064a[_0xbc69('0x2e')]);_0x1cde35[_0xbc69('0x30')]=_['intersection'](_0x1cde35[_0xbc69('0x31')],_0x1cde35[_0xbc69('0x2e')]);_0x5289d6[_0xbc69('0x32')]=_[_0xbc69('0x33')](_0x1cde35[_0xbc69('0x31')],qs[_0xbc69('0x34')](_0x5b064a['query']['fields']));_0x5289d6[_0xbc69('0x32')]=_0x5289d6['attributes']['length']?_0x5289d6[_0xbc69('0x32')]:_0x1cde35[_0xbc69('0x31')];if(!_0x5b064a[_0xbc69('0x2e')]['hasOwnProperty'](_0xbc69('0x35'))){_0x5289d6['limit']=qs[_0xbc69('0x1f')](_0x5b064a[_0xbc69('0x2e')][_0xbc69('0x1f')]);_0x5289d6[_0xbc69('0x1e')]=qs[_0xbc69('0x1e')](_0x5b064a[_0xbc69('0x2e')][_0xbc69('0x1e')]);}_0x5289d6['order']=qs['sort'](_0x5b064a[_0xbc69('0x2e')]['sort']);_0x5289d6[_0xbc69('0x36')]=qs[_0xbc69('0x30')](_[_0xbc69('0x37')](_0x5b064a['query'],_0x1cde35[_0xbc69('0x30')]),_0x15720f);if(_0x5b064a[_0xbc69('0x2e')][_0xbc69('0x38')]){_0x5289d6[_0xbc69('0x36')]=_[_0xbc69('0x39')](_0x5289d6[_0xbc69('0x36')],{'$or':_[_0xbc69('0x2a')](_0x15720f,function(_0x299909){if(_0x299909[_0xbc69('0x2c')]!==_0xbc69('0x3a')){var _0x44e4e0={};_0x44e4e0[_0x299909[_0xbc69('0x27')]]={'$like':'%'+_0x5b064a[_0xbc69('0x2e')][_0xbc69('0x38')]+'%'};return _0x44e4e0;}})});}_0x5289d6=_[_0xbc69('0x39')]({},_0x5289d6,_0x5b064a[_0xbc69('0x3b')]);var _0x1cb4f3={'where':_0x5289d6[_0xbc69('0x36')]};return db[_0xbc69('0x3c')][_0xbc69('0x21')](_0x1cb4f3)[_0xbc69('0x11')](function(_0x1d8a68){_0x25cf75[_0xbc69('0x21')]=_0x1d8a68;if(_0x5b064a[_0xbc69('0x2e')][_0xbc69('0x3d')]){_0x5289d6[_0xbc69('0x3e')]=[{'all':!![]}];}return db[_0xbc69('0x3c')]['findAll'](_0x5289d6);})['then'](function(_0x3cd2fd){_0x25cf75['rows']=_0x3cd2fd;return _0x25cf75;})['then'](respondWithFilteredResult(_0x1595ca,_0x5289d6))['catch'](handleError(_0x1595ca,null));};exports[_0xbc69('0x3f')]=function(_0x36653c,_0x56f855){var _0x4a5501={'raw':!![],'where':{'id':_0x36653c[_0xbc69('0x40')]['id']}},_0x1a07f7={};_0x1a07f7[_0xbc69('0x31')]=_[_0xbc69('0x2f')](db['SmsMessage'][_0xbc69('0x2b')]);_0x1a07f7[_0xbc69('0x2e')]=_[_0xbc69('0x2f')](_0x36653c[_0xbc69('0x2e')]);_0x1a07f7[_0xbc69('0x30')]=_[_0xbc69('0x33')](_0x1a07f7[_0xbc69('0x31')],_0x1a07f7[_0xbc69('0x2e')]);_0x4a5501[_0xbc69('0x32')]=_[_0xbc69('0x33')](_0x1a07f7['model'],qs[_0xbc69('0x34')](_0x36653c['query'][_0xbc69('0x34')]));_0x4a5501[_0xbc69('0x32')]=_0x4a5501['attributes']['length']?_0x4a5501['attributes']:_0x1a07f7['model'];if(_0x36653c['query'][_0xbc69('0x3d')]){_0x4a5501['include']=[{'all':!![]}];}_0x4a5501=_[_0xbc69('0x39')]({},_0x4a5501,_0x36653c[_0xbc69('0x3b')]);return db[_0xbc69('0x3c')]['find'](_0x4a5501)['then'](handleEntityNotFound(_0x56f855,null))['then'](respondWithResult(_0x56f855,null))['catch'](handleError(_0x56f855,null));};exports[_0xbc69('0x41')]=function(_0x22be72,_0x2c8e0f){return db[_0xbc69('0x3c')][_0xbc69('0x41')](_0x22be72[_0xbc69('0x42')],{})['then'](respondWithResult(_0x2c8e0f,0xc9))[_0xbc69('0x1c')](handleError(_0x2c8e0f,null));};exports[_0xbc69('0x43')]=function(_0x502085,_0x2738ad){if(_0x502085[_0xbc69('0x42')]['id']){delete _0x502085['body']['id'];}return db[_0xbc69('0x3c')][_0xbc69('0x44')]({'where':{'id':_0x502085[_0xbc69('0x40')]['id']}})['then'](handleEntityNotFound(_0x2738ad,null))['then'](saveUpdates(_0x502085[_0xbc69('0x42')],null))['then'](respondWithResult(_0x2738ad,null))[_0xbc69('0x1c')](handleError(_0x2738ad,null));};exports[_0xbc69('0x23')]=function(_0xf9d5b2,_0x3e6d79){return db['SmsMessage'][_0xbc69('0x44')]({'where':{'id':_0xf9d5b2[_0xbc69('0x40')]['id']}})[_0xbc69('0x11')](handleEntityNotFound(_0x3e6d79,null))[_0xbc69('0x11')](removeEntity(_0x3e6d79,null))[_0xbc69('0x1c')](handleError(_0x3e6d79,null));};exports[_0xbc69('0x45')]=function(_0x829dc0,_0x2ce006){return db[_0xbc69('0x3c')]['describe']()[_0xbc69('0x11')](respondWithResult(_0x2ce006,null))[_0xbc69('0x1c')](handleError(_0x2ce006,null));};exports[_0xbc69('0x46')]=function(_0x3a857c,_0xd674ce){var _0x5cab24=_0xbc69('0x47');return interactionService[_0xbc69('0x48')](_0x3a857c,_0x5cab24)[_0xbc69('0x11')](respondWithResult(_0xd674ce,null))[_0xbc69('0x1c')](handleError(_0xd674ce,null));};exports[_0xbc69('0x49')]=function(_0x5d69a5,_0x3633aa){var _0x54d845={'agent':{},'channel':'sms'};if(_0x5d69a5[_0xbc69('0x42')]['id']){delete _0x5d69a5[_0xbc69('0x42')]['id'];}_0x5d69a5[_0xbc69('0x42')][_0xbc69('0x4a')]=_0x5d69a5[_0xbc69('0x42')][_0xbc69('0x4a')]||_0x5d69a5[_0xbc69('0x4b')]['id'];_0x54d845['agent']['id']=_0x5d69a5[_0xbc69('0x42')][_0xbc69('0x4a')];return db['SmsMessage'][_0xbc69('0x44')]({'where':{'id':_0x5d69a5['params']['id'],'UserId':null}})[_0xbc69('0x11')](handleEntityNotFound(_0x3633aa,null))[_0xbc69('0x11')](function(_0xcd5f93){if(_0xcd5f93){_0x54d845[_0xbc69('0x1a')]=_0xcd5f93[_0xbc69('0x4c')]({'plain':!![]});return db[_0xbc69('0x4d')]['find']({'where':{'id':_0xcd5f93[_0xbc69('0x4e')]}});}return null;})[_0xbc69('0x11')](handleEntityNotFound(_0x3633aa,null))[_0xbc69('0x11')](function(_0x2f4b29){if(_0x2f4b29){_0x54d845[_0xbc69('0x4f')]=_0x2f4b29['get']({'plain':!![]});interaction_log[_0xbc69('0x12')](_0xbc69('0x50'),_0x5d69a5[_0xbc69('0x4b')]['id'],_0x5d69a5[_0xbc69('0x4b')][_0xbc69('0x27')],_0x5d69a5[_0xbc69('0x4b')][_0xbc69('0x51')],_0x54d845[_0xbc69('0x4f')]['id'],_0x5d69a5[_0xbc69('0x42')]?JSON[_0xbc69('0x17')](_0x5d69a5[_0xbc69('0x42')]):_0xbc69('0x52'));return respondWithRpcPromise(_0xbc69('0x53'),_0xbc69('0x54'),_0x54d845);}return null;})[_0xbc69('0x11')](function(_0x156d36){var _0x8ef1bb=_0xbc69('0x55')+_0x156d36[_0xbc69('0x1a')]['ContactId'];return db[_0xbc69('0x56')][_0xbc69('0x2e')](_0x8ef1bb,{'type':db[_0xbc69('0x57')][_0xbc69('0x58')][_0xbc69('0x59')],'raw':!![]})[_0xbc69('0x11')](function(_0x16f38d){return _0x16f38d;});})[_0xbc69('0x11')](function(_0x31ce0b){if(_0x31ce0b){_0x54d845[_0xbc69('0x1a')]['contact']=_0x31ce0b[0x0];if(!_0x5d69a5[_0xbc69('0x42')][_0xbc69('0x4a')])return;return db[_0xbc69('0x5a')]['find']({'where':{'id':_0x5d69a5[_0xbc69('0x42')][_0xbc69('0x4a')],'role':_0xbc69('0x5b')},'attributes':['id',_0xbc69('0x27'),'fullname',_0xbc69('0x5c'),_0xbc69('0x5d')],'raw':!![]});}return null;})['then'](function(_0x68265b){if(!_0x68265b)return null;_0x54d845['message'][_0xbc69('0x5b')]=_0x68265b;return _0x54d845;})[_0xbc69('0x11')](function(_0x181a4d){if(_0x181a4d){_0x181a4d[_0xbc69('0x1a')][_0xbc69('0x5e')]=util[_0xbc69('0x5f')]('SIP/%s',_0x5d69a5[_0xbc69('0x4b')][_0xbc69('0x27')]);_0x181a4d[_0xbc69('0x1a')][_0xbc69('0x60')]=_0x54d845['channel'];_0x181a4d['message'][_0xbc69('0x61')]=_0x54d845[_0xbc69('0x60')];_0x181a4d['message'][_0xbc69('0x62')]=_0xbc69('0x49');respondWithRpcPromise(_0xbc69('0x63'),_0xbc69('0x63'),{'event':_0xbc69('0x64'),'message':_0x181a4d[_0xbc69('0x1a')]},client9002);return _0x54d845;}return null;})[_0xbc69('0x11')](respondWithResult(_0x3633aa,null))['catch'](handleError(_0x3633aa,null));};exports['status']=function(_0x781f7e,_0x53e271){if(_0x781f7e[_0xbc69('0x42')]['id']){delete _0x781f7e[_0xbc69('0x42')]['id'];}var _0x3e530f;return db['SmsMessage']['find']({'where':{'id':_0x781f7e['params']['id']}})[_0xbc69('0x11')](handleEntityNotFound(_0x53e271,null))['then'](function(_0x2e64ba){if(_0x2e64ba){_0x3e530f=_0x2e64ba;return db[_0xbc69('0x65')][_0xbc69('0x44')]({'where':{'id':_0x2e64ba[_0xbc69('0x66')]}});}})[_0xbc69('0x11')](handleEntityNotFound(_0x53e271,null))[_0xbc69('0x11')](function(_0x233015){if(_0x233015){logger['debug'](_0xbc69('0x16'),_0xbc69('0x1d'),_0xbc69('0x67'),_0x233015[_0xbc69('0x2c')],util[_0xbc69('0x68')](_0x781f7e['body'],{'showHidden':![],'depth':null}));switch(_0x233015['type']){case _0xbc69('0x69'):if(_0x781f7e[_0xbc69('0x42')][_0xbc69('0x6a')]&&_0x781f7e[_0xbc69('0x42')][_0xbc69('0x6a')]===_0x3e530f[_0xbc69('0x6b')]){return _0x3e530f['update']({'read':!![]});}else{logger[_0xbc69('0x18')](_0xbc69('0x6c'),_0xbc69('0x1d'),_0xbc69('0x69'),util[_0xbc69('0x68')](_0x781f7e['body'],{'showHidden':![],'depth':null}));}break;case _0xbc69('0x6d'):if(_0x781f7e[_0xbc69('0x42')][_0xbc69('0x6e')]&&_0x781f7e[_0xbc69('0x42')][_0xbc69('0x6e')]===_0x3e530f['messageId']&&_[_0xbc69('0x6f')]([_0xbc69('0x70'),_0xbc69('0x71')],_0x781f7e[_0xbc69('0x42')]['Status'])>=0x0){return _0x3e530f[_0xbc69('0x43')]({'read':!![]});}else{logger[_0xbc69('0x18')](_0xbc69('0x6c'),_0xbc69('0x1d'),'plivio',util[_0xbc69('0x68')](_0x781f7e[_0xbc69('0x42')],{'showHidden':![],'depth':null}));}break;case _0xbc69('0x72'):var _0x4c511d=_0x781f7e[_0xbc69('0x42')][_0xbc69('0x73')][0x0];if(_0x4c511d[_0xbc69('0x1d')]['groupName']===_0xbc69('0x74')){return _0x3e530f[_0xbc69('0x43')]({'read':!![]});}else{logger[_0xbc69('0x18')](_0xbc69('0x6c'),'status','infobip',util[_0xbc69('0x68')](_0x781f7e['body'],{'showHidden':![],'depth':null}));}break;}return _0x3e530f;}})['then'](respondWithResult(_0x53e271,null))['catch'](handleError(_0x53e271,null));}; \ No newline at end of file +var _0xf05f=['include','findAll','rows','show','params','includeAll','options','find','create','body','describe','accept','sms','acceptMessage','reject','UserId','agent','get','SmsInteraction','SmsInteractionId','interaction','user','role','null','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','contact','User','email','internal','interface','format','SIP/%s','channel','motionChannel','event','EventManager','rejectmessage','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','plivio','infobip','results','groupName','DELIVERED','lodash','ioredis','../../components/interaction/service','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','client','http','sms-interactions','request','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','SmsMessage,\x20%s,\x20%s','message','result','catch','status','json','offset','undefined','count','limit','set','update','then','destroy','sendStatus','stack','name','send','index','SmsMessage','rawAttributes','fieldName','type','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','VIRTUAL','filter','merge'];(function(_0x263b78,_0x324a64){var _0x7f7c24=function(_0x47ae12){while(--_0x47ae12){_0x263b78['push'](_0x263b78['shift']());}};_0x7f7c24(++_0x324a64);}(_0xf05f,0xae));var _0xff05=function(_0x5b733c,_0x489127){_0x5b733c=_0x5b733c-0x0;var _0x58f479=_0xf05f[_0x5b733c];return _0x58f479;};'use strict';var util=require('util');var _=require(_0xff05('0x0'));var Redis=require(_0xff05('0x1'));var interactionService=require(_0xff05('0x2'));var qs=require('../../components/parsers/qs');var logger=require(_0xff05('0x3'))(_0xff05('0x4'));var config=require(_0xff05('0x5'));var db=require(_0xff05('0x6'))['db'];config[_0xff05('0x7')]=_[_0xff05('0x8')](config[_0xff05('0x7')],{'host':_0xff05('0x9'),'port':0x18eb});var socket=require(_0xff05('0xa'))(new Redis(config[_0xff05('0x7')]));require(_0xff05('0xb'))[_0xff05('0xc')](socket);var jayson=require('jayson/promise');var client=jayson[_0xff05('0xd')][_0xff05('0xe')]({'port':0x232c});var client9002=jayson[_0xff05('0xd')][_0xff05('0xe')]({'port':0x232a});var interaction_log=require('../../config/logger')(_0xff05('0xf'));function respondWithRpcPromise(_0xf2714d,_0x1386d8,_0x2239b8,_0x4184ab){return new Promise(function(_0x1387db,_0x544787){var _0x56b9f4=_0x4184ab||client;return _0x56b9f4[_0xff05('0x10')](_0xf2714d,_0x2239b8)['then'](function(_0x321f6b){logger[_0xff05('0x11')]('SmsMessage,\x20%s,\x20%s',_0x1386d8,_0xff05('0x12'));logger[_0xff05('0x13')](_0xff05('0x14'),_0x1386d8,_0xff05('0x12'),JSON[_0xff05('0x15')](_0x321f6b));if(_0x321f6b[_0xff05('0x16')]){if(_0x321f6b[_0xff05('0x16')]['code']===0x1f4){logger[_0xff05('0x16')](_0xff05('0x17'),_0x1386d8,_0x321f6b['error'][_0xff05('0x18')]);return _0x544787(_0x321f6b[_0xff05('0x16')][_0xff05('0x18')]);}logger[_0xff05('0x16')]('SmsMessage,\x20%s,\x20%s',_0x1386d8,_0x321f6b[_0xff05('0x16')][_0xff05('0x18')]);return _0x1387db(_0x321f6b[_0xff05('0x16')][_0xff05('0x18')]);}else{logger[_0xff05('0x11')]('SmsMessage,\x20%s,\x20%s',_0x1386d8,_0xff05('0x12'));_0x1387db(_0x321f6b[_0xff05('0x19')][_0xff05('0x18')]);}})[_0xff05('0x1a')](function(_0x2f0aa3){logger[_0xff05('0x16')](_0xff05('0x17'),_0x1386d8,_0x2f0aa3);_0x544787(_0x2f0aa3);});});}function respondWithResult(_0x583760,_0x51effa){_0x51effa=_0x51effa||0xc8;return function(_0x323f38){if(_0x323f38){return _0x583760[_0xff05('0x1b')](_0x51effa)[_0xff05('0x1c')](_0x323f38);}};}function respondWithFilteredResult(_0x46db74,_0x5c5b76){return function(_0x127ac8){if(_0x127ac8){var _0x248cbb=typeof _0x5c5b76[_0xff05('0x1d')]===_0xff05('0x1e')&&typeof _0x5c5b76['limit']==='undefined';var _0xee3fdb=_0x127ac8[_0xff05('0x1f')];var _0x1be604=_0x248cbb?0x0:_0x5c5b76['offset'];var _0x2e3153=_0x248cbb?_0x127ac8[_0xff05('0x1f')]:_0x5c5b76['offset']+_0x5c5b76[_0xff05('0x20')];var _0x40f2b0;if(_0x2e3153>=_0xee3fdb){_0x2e3153=_0xee3fdb;_0x40f2b0=0xc8;}else{_0x40f2b0=0xce;}_0x46db74[_0xff05('0x1b')](_0x40f2b0);return _0x46db74[_0xff05('0x21')]('Content-Range',_0x1be604+'-'+_0x2e3153+'/'+_0xee3fdb)[_0xff05('0x1c')](_0x127ac8);}return null;};}function saveUpdates(_0x197729){return function(_0x5da657){if(_0x5da657){return _0x5da657[_0xff05('0x22')](_0x197729)[_0xff05('0x23')](function(_0x4b4d03){return _0x4b4d03;});}return null;};}function removeEntity(_0x2b9d1a){return function(_0x49c1ec){if(_0x49c1ec){return _0x49c1ec[_0xff05('0x24')]()['then'](function(){_0x2b9d1a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x437a02){return function(_0x462e64){if(!_0x462e64){_0x437a02[_0xff05('0x25')](0x194);}return _0x462e64;};}function handleError(_0x1ef71e,_0xf4abef){_0xf4abef=_0xf4abef||0x1f4;return function(_0x163a09){logger[_0xff05('0x16')](_0x163a09[_0xff05('0x26')]);if(_0x163a09[_0xff05('0x27')]){delete _0x163a09['name'];}_0x1ef71e[_0xff05('0x1b')](_0xf4abef)[_0xff05('0x28')](_0x163a09);};}exports[_0xff05('0x29')]=function(_0x58feb1,_0x17ad3f){var _0x34fc1f={},_0x3a9882={},_0x41a175={'count':0x0,'rows':[]};var _0x2d7021=_['map'](db[_0xff05('0x2a')][_0xff05('0x2b')],function(_0x4e291c){return{'name':_0x4e291c[_0xff05('0x2c')],'type':_0x4e291c[_0xff05('0x2d')]['key']};});_0x3a9882[_0xff05('0x2e')]=_[_0xff05('0x2f')](_0x2d7021,_0xff05('0x27'));_0x3a9882[_0xff05('0x30')]=_[_0xff05('0x31')](_0x58feb1[_0xff05('0x30')]);_0x3a9882[_0xff05('0x32')]=_['intersection'](_0x3a9882['model'],_0x3a9882[_0xff05('0x30')]);_0x34fc1f[_0xff05('0x33')]=_[_0xff05('0x34')](_0x3a9882[_0xff05('0x2e')],qs[_0xff05('0x35')](_0x58feb1[_0xff05('0x30')][_0xff05('0x35')]));_0x34fc1f[_0xff05('0x33')]=_0x34fc1f[_0xff05('0x33')][_0xff05('0x36')]?_0x34fc1f[_0xff05('0x33')]:_0x3a9882['model'];if(!_0x58feb1[_0xff05('0x30')][_0xff05('0x37')](_0xff05('0x38'))){_0x34fc1f[_0xff05('0x20')]=qs[_0xff05('0x20')](_0x58feb1['query']['limit']);_0x34fc1f['offset']=qs[_0xff05('0x1d')](_0x58feb1[_0xff05('0x30')]['offset']);}_0x34fc1f['order']=qs[_0xff05('0x39')](_0x58feb1['query'][_0xff05('0x39')]);_0x34fc1f[_0xff05('0x3a')]=qs[_0xff05('0x32')](_['pick'](_0x58feb1['query'],_0x3a9882[_0xff05('0x32')]),_0x2d7021);if(_0x58feb1[_0xff05('0x30')]['filter']){_0x34fc1f[_0xff05('0x3a')]=_['merge'](_0x34fc1f[_0xff05('0x3a')],{'$or':_[_0xff05('0x2f')](_0x2d7021,function(_0x4a4069){if(_0x4a4069[_0xff05('0x2d')]!==_0xff05('0x3b')){var _0x21c3fd={};_0x21c3fd[_0x4a4069[_0xff05('0x27')]]={'$like':'%'+_0x58feb1[_0xff05('0x30')][_0xff05('0x3c')]+'%'};return _0x21c3fd;}})});}_0x34fc1f=_[_0xff05('0x3d')]({},_0x34fc1f,_0x58feb1['options']);var _0x5f5749={'where':_0x34fc1f[_0xff05('0x3a')]};return db['SmsMessage'][_0xff05('0x1f')](_0x5f5749)[_0xff05('0x23')](function(_0x5bb5a8){_0x41a175[_0xff05('0x1f')]=_0x5bb5a8;if(_0x58feb1[_0xff05('0x30')]['includeAll']){_0x34fc1f[_0xff05('0x3e')]=[{'all':!![]}];}return db[_0xff05('0x2a')][_0xff05('0x3f')](_0x34fc1f);})['then'](function(_0x31a220){_0x41a175[_0xff05('0x40')]=_0x31a220;return _0x41a175;})[_0xff05('0x23')](respondWithFilteredResult(_0x17ad3f,_0x34fc1f))['catch'](handleError(_0x17ad3f,null));};exports[_0xff05('0x41')]=function(_0x3fc847,_0x55ab13){var _0xa2b3bd={'raw':!![],'where':{'id':_0x3fc847[_0xff05('0x42')]['id']}},_0x3d8a6d={};_0x3d8a6d[_0xff05('0x2e')]=_['keys'](db[_0xff05('0x2a')][_0xff05('0x2b')]);_0x3d8a6d[_0xff05('0x30')]=_['keys'](_0x3fc847['query']);_0x3d8a6d[_0xff05('0x32')]=_[_0xff05('0x34')](_0x3d8a6d[_0xff05('0x2e')],_0x3d8a6d['query']);_0xa2b3bd['attributes']=_[_0xff05('0x34')](_0x3d8a6d[_0xff05('0x2e')],qs[_0xff05('0x35')](_0x3fc847[_0xff05('0x30')]['fields']));_0xa2b3bd[_0xff05('0x33')]=_0xa2b3bd[_0xff05('0x33')]['length']?_0xa2b3bd['attributes']:_0x3d8a6d['model'];if(_0x3fc847['query'][_0xff05('0x43')]){_0xa2b3bd[_0xff05('0x3e')]=[{'all':!![]}];}_0xa2b3bd=_[_0xff05('0x3d')]({},_0xa2b3bd,_0x3fc847[_0xff05('0x44')]);return db['SmsMessage'][_0xff05('0x45')](_0xa2b3bd)['then'](handleEntityNotFound(_0x55ab13,null))[_0xff05('0x23')](respondWithResult(_0x55ab13,null))[_0xff05('0x1a')](handleError(_0x55ab13,null));};exports[_0xff05('0x46')]=function(_0x397a44,_0xc19dfd){return db[_0xff05('0x2a')][_0xff05('0x46')](_0x397a44[_0xff05('0x47')],{})[_0xff05('0x23')](respondWithResult(_0xc19dfd,0xc9))[_0xff05('0x1a')](handleError(_0xc19dfd,null));};exports['update']=function(_0xe462a4,_0x30070a){if(_0xe462a4['body']['id']){delete _0xe462a4[_0xff05('0x47')]['id'];}return db[_0xff05('0x2a')][_0xff05('0x45')]({'where':{'id':_0xe462a4[_0xff05('0x42')]['id']}})[_0xff05('0x23')](handleEntityNotFound(_0x30070a,null))[_0xff05('0x23')](saveUpdates(_0xe462a4['body'],null))[_0xff05('0x23')](respondWithResult(_0x30070a,null))[_0xff05('0x1a')](handleError(_0x30070a,null));};exports[_0xff05('0x24')]=function(_0x5d6e2e,_0x3a7d1f){return db[_0xff05('0x2a')][_0xff05('0x45')]({'where':{'id':_0x5d6e2e['params']['id']}})[_0xff05('0x23')](handleEntityNotFound(_0x3a7d1f,null))[_0xff05('0x23')](removeEntity(_0x3a7d1f,null))[_0xff05('0x1a')](handleError(_0x3a7d1f,null));};exports['describe']=function(_0x283fac,_0x32cde2){return db['SmsMessage'][_0xff05('0x48')]()[_0xff05('0x23')](respondWithResult(_0x32cde2,null))['catch'](handleError(_0x32cde2,null));};exports[_0xff05('0x49')]=function(_0x2654c3,_0x3c7db9){var _0x50031c=_0xff05('0x4a');return interactionService[_0xff05('0x4b')](_0x2654c3,_0x50031c)[_0xff05('0x23')](respondWithResult(_0x3c7db9,null))[_0xff05('0x1a')](handleError(_0x3c7db9,null));};exports[_0xff05('0x4c')]=function(_0x5dc7a7,_0x24adfa){var _0x44e52e={'agent':{},'channel':_0xff05('0x4a')};if(_0x5dc7a7[_0xff05('0x47')]['id']){delete _0x5dc7a7['body']['id'];}_0x5dc7a7[_0xff05('0x47')][_0xff05('0x4d')]=_0x5dc7a7[_0xff05('0x47')]['UserId']||_0x5dc7a7['user']['id'];_0x44e52e[_0xff05('0x4e')]['id']=_0x5dc7a7[_0xff05('0x47')][_0xff05('0x4d')];return db[_0xff05('0x2a')][_0xff05('0x45')]({'where':{'id':_0x5dc7a7[_0xff05('0x42')]['id'],'UserId':null}})[_0xff05('0x23')](handleEntityNotFound(_0x24adfa,null))[_0xff05('0x23')](function(_0x5f16e0){if(_0x5f16e0){_0x44e52e['message']=_0x5f16e0[_0xff05('0x4f')]({'plain':!![]});return db[_0xff05('0x50')]['find']({'where':{'id':_0x5f16e0[_0xff05('0x51')]}});}return null;})['then'](handleEntityNotFound(_0x24adfa,null))[_0xff05('0x23')](function(_0x4c99b8){if(_0x4c99b8){_0x44e52e[_0xff05('0x52')]=_0x4c99b8[_0xff05('0x4f')]({'plain':!![]});interaction_log[_0xff05('0x11')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5dc7a7[_0xff05('0x53')]['id'],_0x5dc7a7[_0xff05('0x53')][_0xff05('0x27')],_0x5dc7a7[_0xff05('0x53')][_0xff05('0x54')],_0x44e52e[_0xff05('0x52')]['id'],_0x5dc7a7[_0xff05('0x47')]?JSON[_0xff05('0x15')](_0x5dc7a7['body']):_0xff05('0x55'));return respondWithRpcPromise('RejectMessage',_0xff05('0x56'),_0x44e52e);}return null;})[_0xff05('0x23')](function(_0xfeed25){var _0x4db8f1=_0xff05('0x57')+_0xfeed25[_0xff05('0x18')][_0xff05('0x58')];return db['sequelize'][_0xff05('0x30')](_0x4db8f1,{'type':db[_0xff05('0x59')][_0xff05('0x5a')]['SELECT'],'raw':!![]})[_0xff05('0x23')](function(_0xf6b4e0){return _0xf6b4e0;});})[_0xff05('0x23')](function(_0x3a3883){if(_0x3a3883){_0x44e52e[_0xff05('0x18')][_0xff05('0x5b')]=_0x3a3883[0x0];if(!_0x5dc7a7[_0xff05('0x47')][_0xff05('0x4d')])return;return db[_0xff05('0x5c')][_0xff05('0x45')]({'where':{'id':_0x5dc7a7['body'][_0xff05('0x4d')],'role':_0xff05('0x4e')},'attributes':['id',_0xff05('0x27'),'fullname',_0xff05('0x5d'),_0xff05('0x5e')],'raw':!![]});}return null;})[_0xff05('0x23')](function(_0x4e361f){if(!_0x4e361f)return null;_0x44e52e[_0xff05('0x18')][_0xff05('0x4e')]=_0x4e361f;return _0x44e52e;})[_0xff05('0x23')](function(_0x128803){if(_0x128803){_0x128803[_0xff05('0x18')][_0xff05('0x5f')]=util[_0xff05('0x60')](_0xff05('0x61'),_0x5dc7a7['user']['name']);_0x128803['message'][_0xff05('0x62')]=_0x44e52e[_0xff05('0x62')];_0x128803[_0xff05('0x18')][_0xff05('0x63')]=_0x44e52e[_0xff05('0x62')];_0x128803[_0xff05('0x18')][_0xff05('0x64')]='reject';respondWithRpcPromise('EventManager',_0xff05('0x65'),{'event':_0xff05('0x66'),'message':_0x128803[_0xff05('0x18')]},client9002);return _0x44e52e;}return null;})[_0xff05('0x23')](respondWithResult(_0x24adfa,null))['catch'](handleError(_0x24adfa,null));};exports[_0xff05('0x1b')]=function(_0x4574e4,_0x30eb21){if(_0x4574e4['body']['id']){delete _0x4574e4[_0xff05('0x47')]['id'];}var _0x505ce7;return db[_0xff05('0x2a')][_0xff05('0x45')]({'where':{'id':_0x4574e4[_0xff05('0x42')]['id']}})[_0xff05('0x23')](handleEntityNotFound(_0x30eb21,null))[_0xff05('0x23')](function(_0x14bb82){if(_0x14bb82){_0x505ce7=_0x14bb82;return db['SmsAccount'][_0xff05('0x45')]({'where':{'id':_0x14bb82['SmsAccountId']}});}})[_0xff05('0x23')](handleEntityNotFound(_0x30eb21,null))[_0xff05('0x23')](function(_0x16bad5){if(_0x16bad5){logger[_0xff05('0x13')](_0xff05('0x14'),_0xff05('0x1b'),_0xff05('0x67'),_0x16bad5[_0xff05('0x2d')],util[_0xff05('0x68')](_0x4574e4[_0xff05('0x47')],{'showHidden':![],'depth':null}));switch(_0x16bad5[_0xff05('0x2d')]){case _0xff05('0x69'):if(_0x4574e4[_0xff05('0x47')][_0xff05('0x6a')]&&_0x4574e4[_0xff05('0x47')][_0xff05('0x6a')]===_0x505ce7[_0xff05('0x6b')]){return _0x505ce7[_0xff05('0x22')]({'read':!![]});}else{logger[_0xff05('0x16')](_0xff05('0x6c'),_0xff05('0x1b'),_0xff05('0x69'),util[_0xff05('0x68')](_0x4574e4[_0xff05('0x47')],{'showHidden':![],'depth':null}));}break;case _0xff05('0x6d'):if(_0x4574e4[_0xff05('0x47')]['MessageUUID']&&_0x4574e4['body'][_0xff05('0x6e')]===_0x505ce7[_0xff05('0x6b')]&&_[_0xff05('0x6f')]([_0xff05('0x70'),'delivered'],_0x4574e4[_0xff05('0x47')]['Status'])>=0x0){return _0x505ce7[_0xff05('0x22')]({'read':!![]});}else{logger['error'](_0xff05('0x6c'),'status',_0xff05('0x71'),util[_0xff05('0x68')](_0x4574e4[_0xff05('0x47')],{'showHidden':![],'depth':null}));}break;case _0xff05('0x72'):var _0x2b1ec0=_0x4574e4[_0xff05('0x47')][_0xff05('0x73')][0x0];if(_0x2b1ec0[_0xff05('0x1b')][_0xff05('0x74')]===_0xff05('0x75')){return _0x505ce7['update']({'read':!![]});}else{logger['error'](_0xff05('0x6c'),_0xff05('0x1b'),'infobip',util[_0xff05('0x68')](_0x4574e4[_0xff05('0x47')],{'showHidden':![],'depth':null}));}break;}return _0x505ce7;}})[_0xff05('0x23')](respondWithResult(_0x30eb21,null))['catch'](handleError(_0x30eb21,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 18a1c39..be35646 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 _0x3a59=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsMessage','setMaxListeners'];(function(_0x5ce15c,_0x19c917){var _0x36e4f5=function(_0x50fa90){while(--_0x50fa90){_0x5ce15c['push'](_0x5ce15c['shift']());}};_0x36e4f5(++_0x19c917);}(_0x3a59,0x193));var _0x93a5=function(_0x1abeb2,_0x79f462){_0x1abeb2=_0x1abeb2-0x0;var _0x48da20=_0x3a59[_0x1abeb2];return _0x48da20;};'use strict';var EventEmitter=require(_0x93a5('0x0'));var SmsMessage=require(_0x93a5('0x1'))['db'][_0x93a5('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x93a5('0x3')](0x0);var events={'afterCreate':_0x93a5('0x4'),'afterUpdate':_0x93a5('0x5'),'afterDestroy':_0x93a5('0x6')};function emitEvent(_0x5336d6){return function(_0x1035d7,_0x4dfa43,_0x5687c1){SmsMessageEvents[_0x93a5('0x7')](_0x5336d6+':'+_0x1035d7['id'],_0x1035d7);SmsMessageEvents[_0x93a5('0x7')](_0x5336d6,_0x1035d7);_0x5687c1(null);};}for(var e in events){if(events[_0x93a5('0x8')](e)){var event=events[e];SmsMessage[_0x93a5('0x9')](e,emitEvent(event));}}module[_0x93a5('0xa')]=SmsMessageEvents; \ No newline at end of file +var _0x07f2=['emit','hasOwnProperty','hook','../../mysqldb','SmsMessage','setMaxListeners','save','update','remove'];(function(_0x1bc013,_0x7771c6){var _0x55df36=function(_0x1c02e0){while(--_0x1c02e0){_0x1bc013['push'](_0x1bc013['shift']());}};_0x55df36(++_0x7771c6);}(_0x07f2,0x1c5));var _0x207f=function(_0x238387,_0x5c51c6){_0x238387=_0x238387-0x0;var _0x3b5e7a=_0x07f2[_0x238387];return _0x3b5e7a;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0x207f('0x0'))['db'][_0x207f('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x207f('0x2')](0x0);var events={'afterCreate':_0x207f('0x3'),'afterUpdate':_0x207f('0x4'),'afterDestroy':_0x207f('0x5')};function emitEvent(_0x149d70){return function(_0x101c02,_0xd41a64,_0x51af54){SmsMessageEvents[_0x207f('0x6')](_0x149d70+':'+_0x101c02['id'],_0x101c02);SmsMessageEvents['emit'](_0x149d70,_0x101c02);_0x51af54(null);};}for(var e in events){if(events[_0x207f('0x7')](e)){var event=events[e];SmsMessage[_0x207f('0x8')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 1789a4f..adffb41 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 _0x4968=['https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','application/json','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','intelepeer','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','body','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','UserId','findOne','then','update','createdAt','catch','error','find','SmsAccountId','type','twilio','authToken','messages','create','phone','/api/sms/messages/','/status?token=','sid','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=','&password=','GET','split','sms','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','senderString','POST','https://smsapi.connectel.se/api/v2/send/','connectel','Missing\x20parameters:\x20authToken','clicksend','format','%s:%s','https://rest.clicksend.com/v3/sms/send','http_code','data','queued_count','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','authId','Basic\x20%s','toString','base64','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/sms/2/text/advanced','remote','token','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','timestamp','sort','length','md5','digest','hex','signature=','keys','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','apiMessageId','bandwidth','accountId','/messages'];(function(_0x16ea87,_0x378d8b){var _0x6e7b1c=function(_0x26306e){while(--_0x26306e){_0x16ea87['push'](_0x16ea87['shift']());}};_0x6e7b1c(++_0x378d8b);}(_0x4968,0x85));var _0x8496=function(_0x5dc4f7,_0x4308e8){_0x5dc4f7=_0x5dc4f7-0x0;var _0x42100c=_0x4968[_0x5dc4f7];return _0x42100c;};'use strict';var _=require(_0x8496('0x0'));var util=require(_0x8496('0x1'));var logger=require(_0x8496('0x2'))(_0x8496('0x3'));var moment=require(_0x8496('0x4'));var BPromise=require(_0x8496('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8496('0x6'));var rimraf=require(_0x8496('0x7'));var config=require(_0x8496('0x8'));var attributes=require(_0x8496('0x9'));module[_0x8496('0xa')]=function(_0x4596dd,_0x54f85f){return _0x4596dd[_0x8496('0xb')](_0x8496('0xc'),attributes,{'tableName':_0x8496('0xd'),'paranoid':![],'indexes':[{'name':_0x8496('0xe'),'fields':[_0x8496('0xe')]},{'name':'fti_sms_messages','fields':[_0x8496('0xf')],'type':_0x8496('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4aded1,_0x431c67,_0x1e5a12){var _0x362d07=_0x4596dd['models'];var _0x40792c=_0x4aded1[_0x8496('0x11')]({'plain':!![]});if(_0x40792c[_0x8496('0x12')][_0x8496('0x13')]()==='in'||_0x40792c[_0x8496('0x12')][_0x8496('0x13')]()===_0x8496('0x14')&&!_0x40792c[_0x8496('0x15')]&&!_[_0x8496('0x16')](_0x40792c[_0x8496('0x17')])&&!_[_0x8496('0x16')](_0x40792c['SmsInteractionId'])){_0x362d07['SmsInteraction'][_0x8496('0x18')]({'where':{'id':_0x40792c['SmsInteractionId']}})[_0x8496('0x19')](function(_0x4d5aec){if(_0x4d5aec){_0x4d5aec[_0x8496('0x1a')]({'lastMsgAt':_0x40792c[_0x8496('0x1b')],'lastMsgDirection':_0x40792c[_0x8496('0x12')]['toLowerCase']()});}})[_0x8496('0x1c')](function(_0x512f5d){console[_0x8496('0x1d')](_0x512f5d);});}if(_0x40792c[_0x8496('0x12')]==='out'&&!_0x40792c[_0x8496('0x15')]){var _0x21d264;_0x362d07['SmsAccount'][_0x8496('0x1e')]({'where':{'id':_0x40792c[_0x8496('0x1f')]},'raw':!![]})[_0x8496('0x19')](function(_0x510e30){_0x21d264=_0x510e30;if(_0x21d264&&_0x21d264['type']){switch(_0x21d264[_0x8496('0x20')]){case _0x8496('0x21'):var _0x125568=require('twilio');if(_0x21d264['accountSid']&&_0x21d264[_0x8496('0x22')]&&_0x21d264['phone']){var _0x369db3=new _0x125568(_0x21d264['accountSid'],_0x21d264[_0x8496('0x22')]);_0x369db3[_0x8496('0x23')][_0x8496('0x24')]({'body':_0x40792c[_0x8496('0xf')],'to':_0x40792c[_0x8496('0x25')],'from':_0x21d264['phone'],'statusCallback':_0x21d264['remote']+_0x8496('0x26')+_0x40792c['id']+_0x8496('0x27')+_0x21d264['token']})[_0x8496('0x19')](function(_0x4fb2e8){if(_0x4fb2e8[_0x8496('0x28')]){return _0x4aded1['update']({'messageId':_0x4fb2e8[_0x8496('0x28')]});}})[_0x8496('0x1c')](function(_0x591a27){logger[_0x8496('0x1d')](_0x8496('0x29'),_0x8496('0x2a'),_0x8496('0x21'),util[_0x8496('0x2b')](_0x591a27,{'showHidden':![],'depth':null}));});}else{logger[_0x8496('0x1d')](_0x8496('0x29'),_0x8496('0x2a'),_0x8496('0x21'),_0x8496('0x2c'));}break;case _0x8496('0x2d'):var _0xd65e1b=_0x8496('0x2e');if(_0x21d264[_0x8496('0x2f')]&&_0x21d264[_0x8496('0x30')]){var _0x10cea8={'recipient':[_0x40792c[_0x8496('0x25')]],'message':_0x40792c[_0x8496('0xf')],'message_type':_0x21d264['smsMethod']};if(_0x21d264[_0x8496('0x31')]&&_0x21d264[_0x8496('0x31')]!=='SI'){_0x10cea8[_0x8496('0x32')]=_0x21d264[_0x8496('0x25')];}var _0x37b75c={'url':_0xd65e1b+_0x8496('0x33')+_0x21d264[_0x8496('0x2f')]+_0x8496('0x34')+_0x21d264['password'],'method':_0x8496('0x35')};rp(_0x37b75c)['then'](function(_0x8995b4){var _0xfad93d=_0x8995b4[_0x8496('0x36')](';');var _0x5ba874={'user_key':_0xfad93d[0x0],'session_key':_0xfad93d[0x1]};_0x37b75c={'url':_0xd65e1b+_0x8496('0x37'),'method':'POST','headers':{'user_key':_0x5ba874[_0x8496('0x38')],'Session_key':_0x5ba874[_0x8496('0x39')]},'json':!![],'body':_0x10cea8};return rp(_0x37b75c);})[_0x8496('0x19')](function(_0x48726b){if(_0x48726b[_0x8496('0x3a')]>=0x1){var _0x98329d={'messageId':_0x48726b[_0x8496('0x3b')]};if(_0x21d264[_0x8496('0x31')]!=='GP'||!_0x21d264[_0x8496('0x3c')]){_0x98329d[_0x8496('0x3d')]=!![];}return _0x4aded1[_0x8496('0x1a')](_0x98329d);}else{return logger[_0x8496('0x1d')](_0x8496('0x29'),_0x8496('0x2a'),_0x8496('0x2d'),util['inspect'](_0x48726b,{'showHidden':![],'depth':null}));}})[_0x8496('0x1c')](function(_0x25c7f1){return logger[_0x8496('0x1d')](_0x8496('0x29'),_0x8496('0x2a'),_0x8496('0x2d'),util['inspect'](_0x25c7f1,{'showHidden':![],'depth':null}));});}else{logger[_0x8496('0x1d')](_0x8496('0x29'),_0x8496('0x2a'),_0x8496('0x2d'),'Missing\x20parameters:\x20username,\x20password');}break;case'connectel':if(_0x21d264['authToken']){var _0x2455fd={'recipient':_0x40792c[_0x8496('0x25')],'message':_0x40792c[_0x8496('0xf')],'sender':_0x21d264[_0x8496('0x3e')]||_0x21d264[_0x8496('0x25')],'authorization':_0x21d264['authToken']};var _0x431c67={'method':_0x8496('0x3f'),'uri':_0x8496('0x40'),'body':_0x2455fd,'json':!![]};rp(_0x431c67)[_0x8496('0x19')](function(_0x56e323){var _0x35920b={'messageId':_0x56e323['requestid']};if(!_0x21d264[_0x8496('0x3c')]){_0x35920b[_0x8496('0x3d')]=!![];}return _0x4aded1[_0x8496('0x1a')](_0x35920b);})['catch'](function(_0xf998e5){logger[_0x8496('0x1d')](_0x8496('0x29'),_0x8496('0x2a'),_0x8496('0x41'),util[_0x8496('0x2b')](_0xf998e5,{'showHidden':![],'depth':null}));});}else{logger[_0x8496('0x1d')](_0x8496('0x29'),'afterCreate',_0x8496('0x41'),_0x8496('0x42'));}break;case _0x8496('0x43'):if(_0x21d264['username']&&_0x21d264[_0x8496('0x30')]){var _0x2455fd={'messages':[{'source':'xCALLY\x20Motion','to':_0x40792c[_0x8496('0x25')],'body':_0x40792c[_0x8496('0xf')],'from':_0x21d264[_0x8496('0x3e')]||_0x21d264[_0x8496('0x25')]}]};var _0x23c4de=util[_0x8496('0x44')](_0x8496('0x45'),_0x21d264[_0x8496('0x2f')],_0x21d264['password']);var _0x431c67={'method':_0x8496('0x3f'),'uri':_0x8496('0x46'),'body':_0x2455fd,'headers':{'Authorization':util[_0x8496('0x44')]('Basic\x20%s',new Buffer(_0x23c4de)['toString']('base64'))},'json':!![]};rp(_0x431c67)[_0x8496('0x19')](function(_0x14c027){if(_0x14c027[_0x8496('0x47')]>=0xc8&&_0x14c027['http_code']<=0xce){if(_0x14c027[_0x8496('0x48')]&&_0x14c027[_0x8496('0x48')][_0x8496('0x49')]>0x0){var _0x4d6e04=_['head'](_0x14c027[_0x8496('0x48')][_0x8496('0x23')]);var _0x294a25={'messageId':_0x4d6e04['message_id']};if(!_0x21d264['deliveryReport']){_0x294a25[_0x8496('0x3d')]=!![];}return _0x4aded1[_0x8496('0x1a')](_0x294a25);}else{logger[_0x8496('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8496('0x2a'),_0x8496('0x4a'),util['inspect'](_0x14c027,{'showHidden':![],'depth':null}));}}else{logger['error'](_0x8496('0x29'),'afterCreate',_0x8496('0x4a'),util['inspect'](_0x14c027,{'showHidden':![],'depth':null}));}})[_0x8496('0x1c')](function(_0x527d61){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x8496('0x4a'),util[_0x8496('0x2b')](_0x527d61,{'showHidden':![],'depth':null}));});}else{logger[_0x8496('0x1d')](_0x8496('0x29'),_0x8496('0x2a'),'clickSend',_0x8496('0x4b'));}break;case _0x8496('0x4c'):if(_0x21d264[_0x8496('0x4d')]&&_0x21d264['authToken']){var _0x2455fd={'dst':_0x40792c[_0x8496('0x25')],'text':_0x40792c['body'],'src':_0x21d264[_0x8496('0x3e')]||_0x21d264[_0x8496('0x25')],'url':_0x21d264['remote']+_0x8496('0x26')+_0x40792c['id']+'/status?token='+_0x21d264['token']};var _0x23c4de=util[_0x8496('0x44')](_0x8496('0x45'),_0x21d264[_0x8496('0x4d')],_0x21d264['authToken']);var _0x431c67={'method':_0x8496('0x3f'),'uri':util[_0x8496('0x44')]('https://api.plivo.com/v1/Account/%s/Message/',_0x21d264[_0x8496('0x4d')]),'body':_0x2455fd,'headers':{'Authorization':util[_0x8496('0x44')](_0x8496('0x4e'),new Buffer(_0x23c4de)[_0x8496('0x4f')](_0x8496('0x50')))},'json':!![]};rp(_0x431c67)[_0x8496('0x19')](function(_0x54bb02){var _0x6302e5={'messageId':_0x54bb02[_0x8496('0x51')][0x0]};return _0x4aded1[_0x8496('0x1a')](_0x6302e5);})[_0x8496('0x1c')](function(_0x32dafa){logger[_0x8496('0x1d')](_0x8496('0x29'),_0x8496('0x2a'),_0x8496('0x4c'),util[_0x8496('0x2b')](_0x32dafa,{'showHidden':![],'depth':null}));});}else{logger[_0x8496('0x1d')](_0x8496('0x29'),'afterCreate',_0x8496('0x4c'),_0x8496('0x52'));}break;case _0x8496('0x53'):if(_0x21d264[_0x8496('0x2f')]&&_0x21d264['password']){if(_0x21d264[_0x8496('0x54')]){var _0x2cdf78={'method':_0x8496('0x3f'),'uri':_0x21d264[_0x8496('0x54')]+'/auth/1/session','body':{'username':_0x21d264[_0x8496('0x2f')],'password':_0x21d264[_0x8496('0x30')]},'json':!![]};return rp(_0x2cdf78)[_0x8496('0x19')](function(_0x499362){var _0x7e7272={'method':_0x8496('0x3f'),'uri':_0x21d264[_0x8496('0x54')]+_0x8496('0x55'),'body':{'messages':[{'from':_0x21d264['phone'],'destinations':[{'to':_0x40792c[_0x8496('0x25')]}],'text':_0x40792c['body'],'notifyUrl':_0x21d264[_0x8496('0x56')]+_0x8496('0x26')+_0x40792c['id']+'/status?token='+_0x21d264[_0x8496('0x57')],'notifyContentType':'application/json','callbackData':_0x21d264[_0x8496('0x25')]+';'+_0x40792c[_0x8496('0xf')]}]},'headers':{'Authorization':_0x8496('0x58')+_0x499362[_0x8496('0x57')]},'json':!![]};return rp(_0x7e7272)['then'](function(_0x265062){if(_0x265062[_0x8496('0x23')]){var _0x349df8={'messageId':_0x265062['messages'][0x0][_0x8496('0xe')]};if(!_0x21d264[_0x8496('0x3c')]){_0x349df8[_0x8496('0x3d')]=!![];}return _0x4aded1[_0x8496('0x1a')](_0x349df8);}else{return logger[_0x8496('0x1d')](_0x8496('0x29'),_0x8496('0x2a'),_0x8496('0x53'),util[_0x8496('0x2b')](_0x265062,{'showHidden':![],'depth':null}));}});})[_0x8496('0x1c')](function(_0x2fbcb5){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8496('0x2a'),_0x8496('0x53'),util['inspect'](_0x2fbcb5,{'showHidden':![],'depth':null}));});}else{logger[_0x8496('0x1d')](_0x8496('0x29'),'afterCreate',_0x8496('0x53'),_0x8496('0x59'));}}else{logger[_0x8496('0x1d')](_0x8496('0x29'),'afterCreate',_0x8496('0x53'),_0x8496('0x4b'));}break;case _0x8496('0x5a'):var _0x185099=require(_0x8496('0x5b'));if(_0x21d264[_0x8496('0x5c')]){var _0x1f1338={};_0x1f1338['login']=_0x21d264['username'];_0x1f1338['phone']=_0x40792c['phone'];_0x1f1338[_0x8496('0x32')]=_0x21d264['phone'];_0x1f1338['text']=_0x40792c[_0x8496('0xf')];_0x1f1338[_0x8496('0x5d')]=+new Date();var _0xb04db6='';var _0x121590='';var _0x232c49=Object['keys'](_0x1f1338);_0x232c49[_0x8496('0x5e')]();for(var _0x5430c1=0x0;_0x5430c1<_0x232c49[_0x8496('0x5f')];_0x5430c1++){if(_0xb04db6!=''){_0xb04db6+='&';}_0xb04db6+=_0x232c49[_0x5430c1]+'='+encodeURIComponent(_0x1f1338[_0x232c49[_0x5430c1]]);_0x121590+=_0x1f1338[_0x232c49[_0x5430c1]];}_0x121590+=_0x21d264[_0x8496('0x5c')];_0x121590=_0x185099['createHash'](_0x8496('0x60'))['update'](_0x121590)[_0x8496('0x61')](_0x8496('0x62'));if(_0xb04db6!==''){_0xb04db6+='&';}_0xb04db6+=_0x8496('0x63')+_0x121590;var _0x37b75c={'method':'GET','uri':_0x21d264[_0x8496('0x54')]+'/external/get/send.php?'+_0xb04db6,'json':!![]};return rp(_0x37b75c)[_0x8496('0x19')](function(_0x334186){var _0x4a83a5=Object[_0x8496('0x64')](_0x334186);if(_0x334186[_0x4a83a5[0x0]][_0x8496('0x1d')]&&parseInt(_0x334186[_0x4a83a5[0x0]]['error'])===0x0){var _0x20e0b4={'messageId':_0x334186[_0x4a83a5[0x0]]['id_sms']};if(!_0x21d264[_0x8496('0x3c')]){_0x20e0b4[_0x8496('0x3d')]=!![];}return _0x4aded1['update'](_0x20e0b4);}else{return logger[_0x8496('0x1d')](_0x8496('0x29'),'afterCreate',_0x8496('0x5a'),util[_0x8496('0x2b')](_0x334186[_0x8496('0x1d')],{'showHidden':![],'depth':null}));}})[_0x8496('0x1c')](function(_0x448962){return logger[_0x8496('0x1d')](_0x8496('0x29'),_0x8496('0x2a'),_0x8496('0x5a'),util[_0x8496('0x2b')](_0x448962,{'showHidden':![],'depth':null}));});}else{logger[_0x8496('0x1d')](_0x8496('0x29'),_0x8496('0x2a'),_0x8496('0x5a'),_0x8496('0x65'));}break;case _0x8496('0x66'):if(_0x21d264['apiKey']){var _0x53a2bb={'method':'POST','uri':_0x8496('0x67'),'headers':{'Authorization':_0x21d264[_0x8496('0x5c')]},'body':{'content':_0x40792c[_0x8496('0xf')],'to':[_0x40792c[_0x8496('0x25')]],'from':_0x21d264['phone'],'binary':![],'clientMessageId':_0x8496('0x68'),'charset':'UTF-8'},'json':!![]};rp(_0x53a2bb)[_0x8496('0x19')](function(_0x232009){if(!_0x232009[_0x8496('0x1d')]){var _0xee3316={'messageId':_0x232009[_0x8496('0x23')][0x0][_0x8496('0x69')]};if(!_0x21d264['deliveryReport']){_0xee3316[_0x8496('0x3d')]=!![];}return _0x4aded1[_0x8496('0x1a')](_0xee3316);}else{return logger['error'](_0x8496('0x29'),'afterCreate',_0x8496('0x66'),util[_0x8496('0x2b')](_0x232009[_0x8496('0x1d')],{'showHidden':![],'depth':null}));}})[_0x8496('0x1c')](function(_0x43ee6e){return logger['error'](_0x8496('0x29'),'afterCreate',_0x8496('0x66'),util['inspect'](_0x43ee6e,{'showHidden':![],'depth':null}));});}else{logger[_0x8496('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8496('0x2a'),_0x8496('0x66'),_0x8496('0x65'));}break;case _0x8496('0x6a'):if(_0x21d264[_0x8496('0x2f')]&&_0x21d264[_0x8496('0x30')]){var _0x23c4de=util[_0x8496('0x44')]('%s:%s',_0x21d264[_0x8496('0x2f')],_0x21d264['password']);var _0x431c67={'method':_0x8496('0x3f'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x21d264[_0x8496('0x6b')]+_0x8496('0x6c'),'body':{'to':[_0x40792c[_0x8496('0x25')]],'text':_0x40792c['body'],'from':_0x21d264[_0x8496('0x25')],'applicationId':_0x21d264['applicationId']},'headers':{'Authorization':util[_0x8496('0x44')]('Basic\x20%s',new Buffer(_0x23c4de)[_0x8496('0x4f')](_0x8496('0x50')))},'json':!![]};rp(_0x431c67)[_0x8496('0x19')](function(_0x2eac91){if(_0x2eac91['id']){var _0x1d7665={'messageId':_0x2eac91['id']};return _0x4aded1[_0x8496('0x1a')](_0x1d7665);}else{logger[_0x8496('0x1d')](_0x8496('0x29'),_0x8496('0x2a'),_0x8496('0x6a'),util['inspect'](_0x2eac91,{'showHidden':![],'depth':null}));}})[_0x8496('0x1c')](function(_0x562b79){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8496('0x2a'),_0x8496('0x6a'),util[_0x8496('0x2b')](_0x562b79,{'showHidden':![],'depth':null}));});}else{logger[_0x8496('0x1d')](_0x8496('0x29'),_0x8496('0x2a'),_0x8496('0x6a'),_0x8496('0x4b'));}break;case'intelepeer':if(_0x21d264['apiKey']){var _0x16f318={};var _0x37b75c={'method':_0x8496('0x3f'),'uri':_0x8496('0x6d'),'headers':{'Authorization':_0x8496('0x6e')+_0x21d264[_0x8496('0x5c')],'Content-Type':_0x8496('0x6f')},'body':{'from':_0x21d264[_0x8496('0x25')],'to':_0x40792c[_0x8496('0x25')],'text':_0x40792c[_0x8496('0xf')]},'json':!![]};return rp(_0x37b75c)[_0x8496('0x19')](function(_0x896aa7){if(_0x896aa7[_0x8496('0x70')]==0xca){_0x16f318[_0x8496('0x71')]=_0x896aa7;var _0x5e38d1={'method':'POST','uri':_0x8496('0x72'),'headers':{'Authorization':_0x8496('0x6e')+_0x21d264[_0x8496('0x5c')],'Content-Type':'application/json'},'body':{'refid':_0x16f318[_0x8496('0x71')][_0x8496('0x73')]},'json':!![]};return rp(_0x5e38d1)[_0x8496('0x19')](function(_0x44338b){_0x16f318[_0x8496('0x74')]=_0x44338b;var _0x17130d={'messageId':_0x16f318[_0x8496('0x71')][_0x8496('0x73')],'read':!![]};return _0x4aded1[_0x8496('0x1a')](_0x17130d);});}else{return logger[_0x8496('0x1d')](_0x8496('0x29'),_0x8496('0x2a'),_0x8496('0x75'),util['inspect'](_0x896aa7,{'showHidden':![],'depth':null}));}})[_0x8496('0x1c')](function(_0x3784ca){return logger['error'](_0x8496('0x29'),'afterCreate',_0x8496('0x75'),util[_0x8496('0x2b')](_0x3784ca,{'showHidden':![],'depth':null}));});}else{return logger[_0x8496('0x1d')](_0x8496('0x29'),_0x8496('0x2a'),_0x8496('0x75'),'Token\x20not\x20received');}break;}}})[_0x8496('0x76')](function(){_0x1e5a12();});}else{_0x1e5a12();}}},'charset':_0x8496('0x77'),'collate':_0x8496('0x78')});}; \ No newline at end of file +var _0xcc27=['total_sent','internal_order_id','deliveryReport','read','inspect','Missing\x20parameters:\x20username,\x20password','connectel','senderString','requestid','clicksend','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','http_code','data','queued_count','head','message_id','clickSend','authId','toString','base64','message_uuid','plivo','Missing\x20parameters:\x20authId,\x20authToken','/auth/1/session','application/json','infobip','Missing\x20parameters:\x20base_url','csc','crypto','login','sender','text','timestamp','keys','length','apiKey','createHash','md5','hex','signature=','baseUrl','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','accountId','/messages','applicationId','bandwidth','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','status','refid','intelepeer','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./smsMessage.attributes','define','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','UserId','SmsInteractionId','SmsInteraction','findOne','then','createdAt','catch','error','SmsAccount','find','type','twilio','accountSid','phone','authToken','messages','create','remote','/api/sms/messages/','/status?token=','token','sid','update','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','login?username=','GET','sms','POST','user_key','session_key'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0xcc27,0xbe));var _0x7cc2=function(_0x46dfca,_0x2f7f9c){_0x46dfca=_0x46dfca-0x0;var _0x5defd7=_0xcc27[_0x46dfca];return _0x5defd7;};'use strict';var _=require(_0x7cc2('0x0'));var util=require(_0x7cc2('0x1'));var logger=require(_0x7cc2('0x2'))(_0x7cc2('0x3'));var moment=require(_0x7cc2('0x4'));var BPromise=require(_0x7cc2('0x5'));var rp=require(_0x7cc2('0x6'));var fs=require('fs');var path=require(_0x7cc2('0x7'));var rimraf=require('rimraf');var config=require(_0x7cc2('0x8'));var attributes=require(_0x7cc2('0x9'));module['exports']=function(_0xabc502,_0x27af23){return _0xabc502[_0x7cc2('0xa')]('SmsMessage',attributes,{'tableName':_0x7cc2('0xb'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x7cc2('0xc')]},{'name':_0x7cc2('0xd'),'fields':[_0x7cc2('0xe')],'type':_0x7cc2('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x445f28,_0x104cd9,_0x20fc4f){var _0x4591b6=_0xabc502[_0x7cc2('0x10')];var _0x21b268=_0x445f28['get']({'plain':!![]});if(_0x21b268[_0x7cc2('0x11')][_0x7cc2('0x12')]()==='in'||_0x21b268[_0x7cc2('0x11')][_0x7cc2('0x12')]()===_0x7cc2('0x13')&&!_0x21b268[_0x7cc2('0x14')]&&!_['isNil'](_0x21b268[_0x7cc2('0x15')])&&!_['isNil'](_0x21b268[_0x7cc2('0x16')])){_0x4591b6[_0x7cc2('0x17')][_0x7cc2('0x18')]({'where':{'id':_0x21b268[_0x7cc2('0x16')]}})[_0x7cc2('0x19')](function(_0x4411ca){if(_0x4411ca){_0x4411ca['update']({'lastMsgAt':_0x21b268[_0x7cc2('0x1a')],'lastMsgDirection':_0x21b268[_0x7cc2('0x11')]['toLowerCase']()});}})[_0x7cc2('0x1b')](function(_0x40ac0e){console[_0x7cc2('0x1c')](_0x40ac0e);});}if(_0x21b268[_0x7cc2('0x11')]===_0x7cc2('0x13')&&!_0x21b268[_0x7cc2('0x14')]){var _0x2c8ad0;_0x4591b6[_0x7cc2('0x1d')][_0x7cc2('0x1e')]({'where':{'id':_0x21b268['SmsAccountId']},'raw':!![]})['then'](function(_0x570be9){_0x2c8ad0=_0x570be9;if(_0x2c8ad0&&_0x2c8ad0[_0x7cc2('0x1f')]){switch(_0x2c8ad0[_0x7cc2('0x1f')]){case _0x7cc2('0x20'):var _0x133203=require(_0x7cc2('0x20'));if(_0x2c8ad0[_0x7cc2('0x21')]&&_0x2c8ad0['authToken']&&_0x2c8ad0[_0x7cc2('0x22')]){var _0xfe0afc=new _0x133203(_0x2c8ad0[_0x7cc2('0x21')],_0x2c8ad0[_0x7cc2('0x23')]);_0xfe0afc[_0x7cc2('0x24')][_0x7cc2('0x25')]({'body':_0x21b268[_0x7cc2('0xe')],'to':_0x21b268[_0x7cc2('0x22')],'from':_0x2c8ad0[_0x7cc2('0x22')],'statusCallback':_0x2c8ad0[_0x7cc2('0x26')]+_0x7cc2('0x27')+_0x21b268['id']+_0x7cc2('0x28')+_0x2c8ad0[_0x7cc2('0x29')]})[_0x7cc2('0x19')](function(_0x5b1f85){if(_0x5b1f85[_0x7cc2('0x2a')]){return _0x445f28[_0x7cc2('0x2b')]({'messageId':_0x5b1f85[_0x7cc2('0x2a')]});}})[_0x7cc2('0x1b')](function(_0x1740ea){logger[_0x7cc2('0x1c')](_0x7cc2('0x2c'),_0x7cc2('0x2d'),_0x7cc2('0x20'),util['inspect'](_0x1740ea,{'showHidden':![],'depth':null}));});}else{logger[_0x7cc2('0x1c')](_0x7cc2('0x2c'),'afterCreate','twilio',_0x7cc2('0x2e'));}break;case _0x7cc2('0x2f'):var _0x33e5da=_0x7cc2('0x30');if(_0x2c8ad0[_0x7cc2('0x31')]&&_0x2c8ad0[_0x7cc2('0x32')]){var _0x39c981={'recipient':[_0x21b268['phone']],'message':_0x21b268['body'],'message_type':_0x2c8ad0[_0x7cc2('0x33')]};if(_0x2c8ad0['smsMethod']&&_0x2c8ad0[_0x7cc2('0x33')]!=='SI'){_0x39c981['sender']=_0x2c8ad0['phone'];}var _0x370e00={'url':_0x33e5da+_0x7cc2('0x34')+_0x2c8ad0[_0x7cc2('0x31')]+'&password='+_0x2c8ad0[_0x7cc2('0x32')],'method':_0x7cc2('0x35')};rp(_0x370e00)[_0x7cc2('0x19')](function(_0x4de9bd){var _0x365d56=_0x4de9bd['split'](';');var _0x59147d={'user_key':_0x365d56[0x0],'session_key':_0x365d56[0x1]};_0x370e00={'url':_0x33e5da+_0x7cc2('0x36'),'method':_0x7cc2('0x37'),'headers':{'user_key':_0x59147d[_0x7cc2('0x38')],'Session_key':_0x59147d[_0x7cc2('0x39')]},'json':!![],'body':_0x39c981};return rp(_0x370e00);})[_0x7cc2('0x19')](function(_0x44fab2){if(_0x44fab2[_0x7cc2('0x3a')]>=0x1){var _0x4ef2aa={'messageId':_0x44fab2[_0x7cc2('0x3b')]};if(_0x2c8ad0[_0x7cc2('0x33')]!=='GP'||!_0x2c8ad0[_0x7cc2('0x3c')]){_0x4ef2aa[_0x7cc2('0x3d')]=!![];}return _0x445f28[_0x7cc2('0x2b')](_0x4ef2aa);}else{return logger[_0x7cc2('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7cc2('0x2d'),_0x7cc2('0x2f'),util[_0x7cc2('0x3e')](_0x44fab2,{'showHidden':![],'depth':null}));}})[_0x7cc2('0x1b')](function(_0x350843){return logger[_0x7cc2('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7cc2('0x2d'),_0x7cc2('0x2f'),util[_0x7cc2('0x3e')](_0x350843,{'showHidden':![],'depth':null}));});}else{logger[_0x7cc2('0x1c')](_0x7cc2('0x2c'),_0x7cc2('0x2d'),'skebby',_0x7cc2('0x3f'));}break;case _0x7cc2('0x40'):if(_0x2c8ad0[_0x7cc2('0x23')]){var _0xa9ab30={'recipient':_0x21b268['phone'],'message':_0x21b268[_0x7cc2('0xe')],'sender':_0x2c8ad0[_0x7cc2('0x41')]||_0x2c8ad0['phone'],'authorization':_0x2c8ad0['authToken']};var _0x104cd9={'method':_0x7cc2('0x37'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0xa9ab30,'json':!![]};rp(_0x104cd9)['then'](function(_0x5774f7){var _0x363ff3={'messageId':_0x5774f7[_0x7cc2('0x42')]};if(!_0x2c8ad0[_0x7cc2('0x3c')]){_0x363ff3[_0x7cc2('0x3d')]=!![];}return _0x445f28[_0x7cc2('0x2b')](_0x363ff3);})[_0x7cc2('0x1b')](function(_0x423117){logger[_0x7cc2('0x1c')](_0x7cc2('0x2c'),'afterCreate',_0x7cc2('0x40'),util[_0x7cc2('0x3e')](_0x423117,{'showHidden':![],'depth':null}));});}else{logger[_0x7cc2('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7cc2('0x2d'),_0x7cc2('0x40'),'Missing\x20parameters:\x20authToken');}break;case _0x7cc2('0x43'):if(_0x2c8ad0[_0x7cc2('0x31')]&&_0x2c8ad0[_0x7cc2('0x32')]){var _0xa9ab30={'messages':[{'source':'xCALLY\x20Motion','to':_0x21b268[_0x7cc2('0x22')],'body':_0x21b268[_0x7cc2('0xe')],'from':_0x2c8ad0['senderString']||_0x2c8ad0[_0x7cc2('0x22')]}]};var _0x4b5da4=util[_0x7cc2('0x44')](_0x7cc2('0x45'),_0x2c8ad0[_0x7cc2('0x31')],_0x2c8ad0[_0x7cc2('0x32')]);var _0x104cd9={'method':_0x7cc2('0x37'),'uri':_0x7cc2('0x46'),'body':_0xa9ab30,'headers':{'Authorization':util[_0x7cc2('0x44')](_0x7cc2('0x47'),new Buffer(_0x4b5da4)['toString']('base64'))},'json':!![]};rp(_0x104cd9)['then'](function(_0x4aca7c){if(_0x4aca7c[_0x7cc2('0x48')]>=0xc8&&_0x4aca7c[_0x7cc2('0x48')]<=0xce){if(_0x4aca7c[_0x7cc2('0x49')]&&_0x4aca7c[_0x7cc2('0x49')][_0x7cc2('0x4a')]>0x0){var _0x3f5873=_[_0x7cc2('0x4b')](_0x4aca7c[_0x7cc2('0x49')][_0x7cc2('0x24')]);var _0x4f1424={'messageId':_0x3f5873[_0x7cc2('0x4c')]};if(!_0x2c8ad0[_0x7cc2('0x3c')]){_0x4f1424[_0x7cc2('0x3d')]=!![];}return _0x445f28[_0x7cc2('0x2b')](_0x4f1424);}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7cc2('0x2d'),_0x7cc2('0x4d'),util[_0x7cc2('0x3e')](_0x4aca7c,{'showHidden':![],'depth':null}));}}else{logger[_0x7cc2('0x1c')](_0x7cc2('0x2c'),_0x7cc2('0x2d'),_0x7cc2('0x4d'),util[_0x7cc2('0x3e')](_0x4aca7c,{'showHidden':![],'depth':null}));}})[_0x7cc2('0x1b')](function(_0x33a6d4){logger[_0x7cc2('0x1c')](_0x7cc2('0x2c'),_0x7cc2('0x2d'),_0x7cc2('0x4d'),util['inspect'](_0x33a6d4,{'showHidden':![],'depth':null}));});}else{logger[_0x7cc2('0x1c')](_0x7cc2('0x2c'),_0x7cc2('0x2d'),'clickSend',_0x7cc2('0x3f'));}break;case'plivo':if(_0x2c8ad0[_0x7cc2('0x4e')]&&_0x2c8ad0['authToken']){var _0xa9ab30={'dst':_0x21b268['phone'],'text':_0x21b268[_0x7cc2('0xe')],'src':_0x2c8ad0[_0x7cc2('0x41')]||_0x2c8ad0[_0x7cc2('0x22')],'url':_0x2c8ad0['remote']+_0x7cc2('0x27')+_0x21b268['id']+'/status?token='+_0x2c8ad0[_0x7cc2('0x29')]};var _0x4b5da4=util[_0x7cc2('0x44')](_0x7cc2('0x45'),_0x2c8ad0['authId'],_0x2c8ad0[_0x7cc2('0x23')]);var _0x104cd9={'method':_0x7cc2('0x37'),'uri':util[_0x7cc2('0x44')]('https://api.plivo.com/v1/Account/%s/Message/',_0x2c8ad0[_0x7cc2('0x4e')]),'body':_0xa9ab30,'headers':{'Authorization':util[_0x7cc2('0x44')](_0x7cc2('0x47'),new Buffer(_0x4b5da4)[_0x7cc2('0x4f')](_0x7cc2('0x50')))},'json':!![]};rp(_0x104cd9)[_0x7cc2('0x19')](function(_0x21343c){var _0x12b629={'messageId':_0x21343c[_0x7cc2('0x51')][0x0]};return _0x445f28[_0x7cc2('0x2b')](_0x12b629);})[_0x7cc2('0x1b')](function(_0x5485a4){logger[_0x7cc2('0x1c')](_0x7cc2('0x2c'),'afterCreate',_0x7cc2('0x52'),util[_0x7cc2('0x3e')](_0x5485a4,{'showHidden':![],'depth':null}));});}else{logger[_0x7cc2('0x1c')](_0x7cc2('0x2c'),_0x7cc2('0x2d'),'plivo',_0x7cc2('0x53'));}break;case'infobip':if(_0x2c8ad0[_0x7cc2('0x31')]&&_0x2c8ad0[_0x7cc2('0x32')]){if(_0x2c8ad0['baseUrl']){var _0x30edd2={'method':_0x7cc2('0x37'),'uri':_0x2c8ad0['baseUrl']+_0x7cc2('0x54'),'body':{'username':_0x2c8ad0[_0x7cc2('0x31')],'password':_0x2c8ad0['password']},'json':!![]};return rp(_0x30edd2)[_0x7cc2('0x19')](function(_0x1aec49){var _0x3f4e32={'method':'POST','uri':_0x2c8ad0['baseUrl']+'/sms/2/text/advanced','body':{'messages':[{'from':_0x2c8ad0[_0x7cc2('0x22')],'destinations':[{'to':_0x21b268[_0x7cc2('0x22')]}],'text':_0x21b268[_0x7cc2('0xe')],'notifyUrl':_0x2c8ad0[_0x7cc2('0x26')]+_0x7cc2('0x27')+_0x21b268['id']+_0x7cc2('0x28')+_0x2c8ad0['token'],'notifyContentType':_0x7cc2('0x55'),'callbackData':_0x2c8ad0[_0x7cc2('0x22')]+';'+_0x21b268[_0x7cc2('0xe')]}]},'headers':{'Authorization':'IBSSO\x20'+_0x1aec49[_0x7cc2('0x29')]},'json':!![]};return rp(_0x3f4e32)[_0x7cc2('0x19')](function(_0x1e474f){if(_0x1e474f[_0x7cc2('0x24')]){var _0x2004a2={'messageId':_0x1e474f[_0x7cc2('0x24')][0x0][_0x7cc2('0xc')]};if(!_0x2c8ad0[_0x7cc2('0x3c')]){_0x2004a2[_0x7cc2('0x3d')]=!![];}return _0x445f28[_0x7cc2('0x2b')](_0x2004a2);}else{return logger[_0x7cc2('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7cc2('0x2d'),_0x7cc2('0x56'),util['inspect'](_0x1e474f,{'showHidden':![],'depth':null}));}});})[_0x7cc2('0x1b')](function(_0x4db180){return logger[_0x7cc2('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7cc2('0x2d'),_0x7cc2('0x56'),util[_0x7cc2('0x3e')](_0x4db180,{'showHidden':![],'depth':null}));});}else{logger[_0x7cc2('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7cc2('0x2d'),_0x7cc2('0x56'),_0x7cc2('0x57'));}}else{logger[_0x7cc2('0x1c')](_0x7cc2('0x2c'),_0x7cc2('0x2d'),_0x7cc2('0x56'),_0x7cc2('0x3f'));}break;case _0x7cc2('0x58'):var _0x2d4b66=require(_0x7cc2('0x59'));if(_0x2c8ad0['apiKey']){var _0x12e520={};_0x12e520[_0x7cc2('0x5a')]=_0x2c8ad0[_0x7cc2('0x31')];_0x12e520['phone']=_0x21b268[_0x7cc2('0x22')];_0x12e520[_0x7cc2('0x5b')]=_0x2c8ad0[_0x7cc2('0x22')];_0x12e520[_0x7cc2('0x5c')]=_0x21b268[_0x7cc2('0xe')];_0x12e520[_0x7cc2('0x5d')]=+new Date();var _0x491823='';var _0xd9e5a3='';var _0x11ad87=Object[_0x7cc2('0x5e')](_0x12e520);_0x11ad87['sort']();for(var _0x4185a5=0x0;_0x4185a5<_0x11ad87[_0x7cc2('0x5f')];_0x4185a5++){if(_0x491823!=''){_0x491823+='&';}_0x491823+=_0x11ad87[_0x4185a5]+'='+encodeURIComponent(_0x12e520[_0x11ad87[_0x4185a5]]);_0xd9e5a3+=_0x12e520[_0x11ad87[_0x4185a5]];}_0xd9e5a3+=_0x2c8ad0[_0x7cc2('0x60')];_0xd9e5a3=_0x2d4b66[_0x7cc2('0x61')](_0x7cc2('0x62'))[_0x7cc2('0x2b')](_0xd9e5a3)['digest'](_0x7cc2('0x63'));if(_0x491823!==''){_0x491823+='&';}_0x491823+=_0x7cc2('0x64')+_0xd9e5a3;var _0x370e00={'method':_0x7cc2('0x35'),'uri':_0x2c8ad0[_0x7cc2('0x65')]+_0x7cc2('0x66')+_0x491823,'json':!![]};return rp(_0x370e00)[_0x7cc2('0x19')](function(_0x1d9c1c){var _0x3af2e5=Object[_0x7cc2('0x5e')](_0x1d9c1c);if(_0x1d9c1c[_0x3af2e5[0x0]][_0x7cc2('0x1c')]&&parseInt(_0x1d9c1c[_0x3af2e5[0x0]][_0x7cc2('0x1c')])===0x0){var _0x3f4234={'messageId':_0x1d9c1c[_0x3af2e5[0x0]][_0x7cc2('0x67')]};if(!_0x2c8ad0[_0x7cc2('0x3c')]){_0x3f4234[_0x7cc2('0x3d')]=!![];}return _0x445f28[_0x7cc2('0x2b')](_0x3f4234);}else{return logger[_0x7cc2('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7cc2('0x2d'),_0x7cc2('0x58'),util[_0x7cc2('0x3e')](_0x1d9c1c['error'],{'showHidden':![],'depth':null}));}})[_0x7cc2('0x1b')](function(_0x288484){return logger[_0x7cc2('0x1c')](_0x7cc2('0x2c'),_0x7cc2('0x2d'),_0x7cc2('0x58'),util['inspect'](_0x288484,{'showHidden':![],'depth':null}));});}else{logger[_0x7cc2('0x1c')](_0x7cc2('0x2c'),_0x7cc2('0x2d'),_0x7cc2('0x58'),_0x7cc2('0x68'));}break;case _0x7cc2('0x69'):if(_0x2c8ad0['apiKey']){var _0x3cb428={'method':_0x7cc2('0x37'),'uri':_0x7cc2('0x6a'),'headers':{'Authorization':_0x2c8ad0['apiKey']},'body':{'content':_0x21b268[_0x7cc2('0xe')],'to':[_0x21b268[_0x7cc2('0x22')]],'from':_0x2c8ad0[_0x7cc2('0x22')],'binary':![],'clientMessageId':_0x7cc2('0x6b'),'charset':_0x7cc2('0x6c')},'json':!![]};rp(_0x3cb428)['then'](function(_0x138a6a){if(!_0x138a6a['error']){var _0x2c19a3={'messageId':_0x138a6a[_0x7cc2('0x24')][0x0][_0x7cc2('0x6d')]};if(!_0x2c8ad0[_0x7cc2('0x3c')]){_0x2c19a3[_0x7cc2('0x3d')]=!![];}return _0x445f28[_0x7cc2('0x2b')](_0x2c19a3);}else{return logger[_0x7cc2('0x1c')](_0x7cc2('0x2c'),_0x7cc2('0x2d'),_0x7cc2('0x69'),util[_0x7cc2('0x3e')](_0x138a6a['error'],{'showHidden':![],'depth':null}));}})[_0x7cc2('0x1b')](function(_0x379518){return logger[_0x7cc2('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7cc2('0x2d'),_0x7cc2('0x69'),util['inspect'](_0x379518,{'showHidden':![],'depth':null}));});}else{logger[_0x7cc2('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7cc2('0x2d'),_0x7cc2('0x69'),_0x7cc2('0x68'));}break;case'bandwidth':if(_0x2c8ad0[_0x7cc2('0x31')]&&_0x2c8ad0['password']){var _0x4b5da4=util[_0x7cc2('0x44')](_0x7cc2('0x45'),_0x2c8ad0[_0x7cc2('0x31')],_0x2c8ad0[_0x7cc2('0x32')]);var _0x104cd9={'method':_0x7cc2('0x37'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x2c8ad0[_0x7cc2('0x6e')]+_0x7cc2('0x6f'),'body':{'to':[_0x21b268[_0x7cc2('0x22')]],'text':_0x21b268['body'],'from':_0x2c8ad0[_0x7cc2('0x22')],'applicationId':_0x2c8ad0[_0x7cc2('0x70')]},'headers':{'Authorization':util['format'](_0x7cc2('0x47'),new Buffer(_0x4b5da4)[_0x7cc2('0x4f')](_0x7cc2('0x50')))},'json':!![]};rp(_0x104cd9)['then'](function(_0x59ef01){if(_0x59ef01['id']){var _0x5ba963={'messageId':_0x59ef01['id']};return _0x445f28['update'](_0x5ba963);}else{logger['error'](_0x7cc2('0x2c'),_0x7cc2('0x2d'),_0x7cc2('0x71'),util['inspect'](_0x59ef01,{'showHidden':![],'depth':null}));}})[_0x7cc2('0x1b')](function(_0x40604a){logger['error'](_0x7cc2('0x2c'),_0x7cc2('0x2d'),'bandwidth',util['inspect'](_0x40604a,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x7cc2('0x2c'),'afterCreate',_0x7cc2('0x71'),_0x7cc2('0x3f'));}break;case'intelepeer':if(_0x2c8ad0[_0x7cc2('0x60')]){var _0x906d83={};var _0x370e00={'method':'POST','uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0x7cc2('0x72')+_0x2c8ad0[_0x7cc2('0x60')],'Content-Type':_0x7cc2('0x55')},'body':{'from':_0x2c8ad0[_0x7cc2('0x22')],'to':_0x21b268[_0x7cc2('0x22')],'text':_0x21b268[_0x7cc2('0xe')]},'json':!![]};return rp(_0x370e00)[_0x7cc2('0x19')](function(_0x1cca6b){if(_0x1cca6b[_0x7cc2('0x73')]==0xca){_0x906d83[_0x7cc2('0x74')]=_0x1cca6b;var _0x2a2694={'method':'POST','uri':_0x7cc2('0x75'),'headers':{'Authorization':'Bearer\x20'+_0x2c8ad0[_0x7cc2('0x60')],'Content-Type':_0x7cc2('0x55')},'body':{'refid':_0x906d83[_0x7cc2('0x74')]['refid']},'json':!![]};return rp(_0x2a2694)[_0x7cc2('0x19')](function(_0x23221b){_0x906d83[_0x7cc2('0x76')]=_0x23221b;var _0x5f0228={'messageId':_0x906d83[_0x7cc2('0x74')][_0x7cc2('0x77')],'read':!![]};return _0x445f28['update'](_0x5f0228);});}else{return logger[_0x7cc2('0x1c')](_0x7cc2('0x2c'),'afterCreate',_0x7cc2('0x78'),util[_0x7cc2('0x3e')](_0x1cca6b,{'showHidden':![],'depth':null}));}})['catch'](function(_0x58c7af){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7cc2('0x2d'),_0x7cc2('0x78'),util[_0x7cc2('0x3e')](_0x58c7af,{'showHidden':![],'depth':null}));});}else{return logger[_0x7cc2('0x1c')](_0x7cc2('0x2c'),_0x7cc2('0x2d'),'intelepeer','Token\x20not\x20received');}break;}}})[_0x7cc2('0x79')](function(){_0x20fc4f();});}else{_0x20fc4f();}}},'charset':_0x7cc2('0x7a'),'collate':_0x7cc2('0x7b')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 83f122b..fe3bf7c 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 _0x4744=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSmsMessage','SmsMessage','create','body','options','debug','lodash','util','bluebird','randomstring','ioredis'];(function(_0x4b2952,_0x38d09a){var _0x281c6b=function(_0x5925b3){while(--_0x5925b3){_0x4b2952['push'](_0x4b2952['shift']());}};_0x281c6b(++_0x38d09a);}(_0x4744,0x1c2));var _0x4474=function(_0x32c872,_0x4e59fc){_0x32c872=_0x32c872-0x0;var _0x36a6f9=_0x4744[_0x32c872];return _0x36a6f9;};'use strict';var _=require(_0x4474('0x0'));var util=require(_0x4474('0x1'));var moment=require('moment');var BPromise=require(_0x4474('0x2'));var rs=require(_0x4474('0x3'));var fs=require('fs');var Redis=require(_0x4474('0x4'));var db=require(_0x4474('0x5'))['db'];var utils=require(_0x4474('0x6'));var logger=require(_0x4474('0x7'))('rpc');var config=require(_0x4474('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4474('0x9')][_0x4474('0xa')]({'port':0x232a});config[_0x4474('0xb')]=_[_0x4474('0xc')](config['redis'],{'host':_0x4474('0xd'),'port':0x18eb});var socket=require(_0x4474('0xe'))(new Redis(config[_0x4474('0xb')]));require(_0x4474('0xf'))[_0x4474('0x10')](socket);function respondWithRpcPromise(_0x497a6f,_0x34e5eb,_0x30bdf9){return new BPromise(function(_0x248230,_0x266de2){return client[_0x4474('0x11')](_0x497a6f,_0x30bdf9)[_0x4474('0x12')](function(_0x2901a4){logger[_0x4474('0x13')](_0x4474('0x14'),_0x34e5eb,_0x4474('0x15'));logger['debug'](_0x4474('0x16'),_0x34e5eb,_0x4474('0x15'),JSON[_0x4474('0x17')](_0x2901a4));if(_0x2901a4[_0x4474('0x18')]){if(_0x2901a4['error'][_0x4474('0x19')]===0x1f4){logger['error']('SmsMessage,\x20%s,\x20%s',_0x34e5eb,_0x2901a4[_0x4474('0x18')][_0x4474('0x1a')]);return _0x266de2(_0x2901a4[_0x4474('0x18')][_0x4474('0x1a')]);}logger[_0x4474('0x18')](_0x4474('0x14'),_0x34e5eb,_0x2901a4['error']['message']);return _0x248230(_0x2901a4[_0x4474('0x18')][_0x4474('0x1a')]);}else{logger[_0x4474('0x13')](_0x4474('0x14'),_0x34e5eb,_0x4474('0x15'));_0x248230(_0x2901a4[_0x4474('0x1b')]['message']);}})[_0x4474('0x1c')](function(_0x42d282){logger[_0x4474('0x18')](_0x4474('0x14'),_0x34e5eb,_0x42d282);_0x266de2(_0x42d282);});});}exports[_0x4474('0x1d')]=function(_0x6feb20){var _0x1ea484=this;return new Promise(function(_0x4c91d7,_0x22cc1c){return db[_0x4474('0x1e')][_0x4474('0x1f')](_0x6feb20[_0x4474('0x20')],{'raw':_0x6feb20[_0x4474('0x21')]?_0x6feb20[_0x4474('0x21')]['raw']===undefined?!![]:![]:!![]})[_0x4474('0x12')](function(_0x2e1c27){logger['info'](_0x4474('0x1d'),_0x6feb20);logger[_0x4474('0x22')](_0x4474('0x1d'),_0x6feb20,JSON['stringify'](_0x2e1c27));_0x4c91d7(_0x2e1c27);})[_0x4474('0x1c')](function(_0x992d5f){logger['error'](_0x4474('0x1d'),_0x992d5f[_0x4474('0x1a')],_0x6feb20);_0x22cc1c(_0x1ea484[_0x4474('0x18')](0x1f4,_0x992d5f[_0x4474('0x1a')]));});});}; \ No newline at end of file +var _0x3027=['raw','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','defaults','redis','localhost','socket.io-emitter','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateSmsMessage','create','body','options'];(function(_0x4f50a6,_0x3d2b69){var _0x531ac9=function(_0x473b82){while(--_0x473b82){_0x4f50a6['push'](_0x4f50a6['shift']());}};_0x531ac9(++_0x3d2b69);}(_0x3027,0xa2));var _0x7302=function(_0x2d3127,_0x5c8089){_0x2d3127=_0x2d3127-0x0;var _0x470537=_0x3027[_0x2d3127];return _0x470537;};'use strict';var _=require(_0x7302('0x0'));var util=require(_0x7302('0x1'));var moment=require(_0x7302('0x2'));var BPromise=require(_0x7302('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7302('0x4'));var db=require(_0x7302('0x5'))['db'];var utils=require(_0x7302('0x6'));var logger=require(_0x7302('0x7'))(_0x7302('0x8'));var config=require(_0x7302('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7302('0xa')]({'port':0x232a});config['redis']=_[_0x7302('0xb')](config[_0x7302('0xc')],{'host':_0x7302('0xd'),'port':0x18eb});var socket=require(_0x7302('0xe'))(new Redis(config[_0x7302('0xc')]));require('./smsMessage.socket')['register'](socket);function respondWithRpcPromise(_0xdc803c,_0x23cfa0,_0x430718){return new BPromise(function(_0x6afb41,_0x4bbfbb){return client[_0x7302('0xf')](_0xdc803c,_0x430718)[_0x7302('0x10')](function(_0x3cbd18){logger[_0x7302('0x11')](_0x7302('0x12'),_0x23cfa0,_0x7302('0x13'));logger['debug'](_0x7302('0x14'),_0x23cfa0,_0x7302('0x13'),JSON[_0x7302('0x15')](_0x3cbd18));if(_0x3cbd18[_0x7302('0x16')]){if(_0x3cbd18['error'][_0x7302('0x17')]===0x1f4){logger[_0x7302('0x16')]('SmsMessage,\x20%s,\x20%s',_0x23cfa0,_0x3cbd18[_0x7302('0x16')][_0x7302('0x18')]);return _0x4bbfbb(_0x3cbd18['error'][_0x7302('0x18')]);}logger[_0x7302('0x16')](_0x7302('0x12'),_0x23cfa0,_0x3cbd18[_0x7302('0x16')][_0x7302('0x18')]);return _0x6afb41(_0x3cbd18[_0x7302('0x16')][_0x7302('0x18')]);}else{logger['info'](_0x7302('0x12'),_0x23cfa0,_0x7302('0x13'));_0x6afb41(_0x3cbd18['result'][_0x7302('0x18')]);}})[_0x7302('0x19')](function(_0x1f40bb){logger['error']('SmsMessage,\x20%s,\x20%s',_0x23cfa0,_0x1f40bb);_0x4bbfbb(_0x1f40bb);});});}exports[_0x7302('0x1a')]=function(_0xa30ad8){var _0x1f6dae=this;return new Promise(function(_0x58138d,_0xbab172){return db['SmsMessage'][_0x7302('0x1b')](_0xa30ad8[_0x7302('0x1c')],{'raw':_0xa30ad8[_0x7302('0x1d')]?_0xa30ad8['options'][_0x7302('0x1e')]===undefined?!![]:![]:!![]})[_0x7302('0x10')](function(_0x28338f){logger['info'](_0x7302('0x1a'),_0xa30ad8);logger[_0x7302('0x1f')]('CreateSmsMessage',_0xa30ad8,JSON[_0x7302('0x15')](_0x28338f));_0x58138d(_0x28338f);})[_0x7302('0x19')](function(_0xfcb6b7){logger[_0x7302('0x16')](_0x7302('0x1a'),_0xfcb6b7[_0x7302('0x18')],_0xa30ad8);_0xbab172(_0x1f6dae[_0x7302('0x16')](0x1f4,_0xfcb6b7[_0x7302('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index c04bf94..887d85f 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 _0x9f1b=['remove','emit','removeListener','length','./smsMessage.events'];(function(_0x45beb2,_0x2144ae){var _0x1167af=function(_0x199954){while(--_0x199954){_0x45beb2['push'](_0x45beb2['shift']());}};_0x1167af(++_0x2144ae);}(_0x9f1b,0x14e));var _0xb9f1=function(_0x1244f3,_0x48ab9d){_0x1244f3=_0x1244f3-0x0;var _0x4b22d6=_0x9f1b[_0x1244f3];return _0x4b22d6;};'use strict';var SmsMessageEvents=require(_0xb9f1('0x0'));var events=['save',_0xb9f1('0x1'),'update'];function createListener(_0x338c93,_0x4b6358){return function(_0x263a5b){_0x4b6358[_0xb9f1('0x2')](_0x338c93,_0x263a5b);};}function removeListener(_0x517ae8,_0x30d08c){return function(){SmsMessageEvents[_0xb9f1('0x3')](_0x517ae8,_0x30d08c);};}exports['register']=function(_0x37b75b){for(var _0x25bcbb=0x0,_0x4641d2=events[_0xb9f1('0x4')];_0x25bcbb<_0x4641d2;_0x25bcbb++){var _0x153e89=events[_0x25bcbb];var _0x1c73f2=createListener('smsMessage:'+_0x153e89,_0x37b75b);SmsMessageEvents['on'](_0x153e89,_0x1c73f2);}}; \ No newline at end of file +var _0x76b4=['emit','removeListener','register','length','smsMessage:','save','remove','update'];(function(_0x47bd90,_0x367edd){var _0x3e85f8=function(_0x13ce89){while(--_0x13ce89){_0x47bd90['push'](_0x47bd90['shift']());}};_0x3e85f8(++_0x367edd);}(_0x76b4,0xd5));var _0x476b=function(_0x95a65b,_0x59995e){_0x95a65b=_0x95a65b-0x0;var _0x193100=_0x76b4[_0x95a65b];return _0x193100;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0x476b('0x0'),_0x476b('0x1'),_0x476b('0x2')];function createListener(_0x3d1567,_0x2f33e4){return function(_0x523511){_0x2f33e4[_0x476b('0x3')](_0x3d1567,_0x523511);};}function removeListener(_0x423003,_0x152f84){return function(){SmsMessageEvents[_0x476b('0x4')](_0x423003,_0x152f84);};}exports[_0x476b('0x5')]=function(_0xcebda2){for(var _0x12f1c9=0x0,_0x527f7c=events[_0x476b('0x6')];_0x12f1c9<_0x527f7c;_0x12f1c9++){var _0xe64522=events[_0x12f1c9];var _0x13ac83=createListener(_0x476b('0x7')+_0xe64522,_0xcebda2);SmsMessageEvents['on'](_0xe64522,_0x13ac83);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 8acaac9..38ec00b 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 _0xc101=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','getMembers','/:id/teams','getTeams','post','create','/:id/users','update','delete','destroy','removeTeams','exports','multer','path','connect-timeout'];(function(_0x4b22c1,_0x2988d9){var _0x4767ce=function(_0x146c54){while(--_0x146c54){_0x4b22c1['push'](_0x4b22c1['shift']());}};_0x4767ce(++_0x2988d9);}(_0xc101,0xcd));var _0x1c10=function(_0x3e44fa,_0x75ed2a){_0x3e44fa=_0x3e44fa-0x0;var _0x2a0aba=_0xc101[_0x3e44fa];return _0x2a0aba;};'use strict';var multer=require(_0x1c10('0x0'));var util=require('util');var path=require(_0x1c10('0x1'));var timeout=require(_0x1c10('0x2'));var express=require(_0x1c10('0x3'));var router=express['Router']();var fs_extra=require(_0x1c10('0x4'));var auth=require(_0x1c10('0x5'));var interaction=require(_0x1c10('0x6'));var config=require(_0x1c10('0x7'));var controller=require(_0x1c10('0x8'));router[_0x1c10('0x9')]('/',auth['isAuthenticated'](),controller[_0x1c10('0xa')]);router[_0x1c10('0x9')](_0x1c10('0xb'),auth[_0x1c10('0xc')](),controller[_0x1c10('0xd')]);router[_0x1c10('0x9')](_0x1c10('0xe'),auth[_0x1c10('0xc')](),controller['show']);router[_0x1c10('0x9')]('/:id/members',auth[_0x1c10('0xc')](),controller[_0x1c10('0xf')]);router[_0x1c10('0x9')](_0x1c10('0x10'),auth[_0x1c10('0xc')](),controller[_0x1c10('0x11')]);router[_0x1c10('0x9')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0x1c10('0x12')]('/',auth[_0x1c10('0xc')](),controller[_0x1c10('0x13')]);router[_0x1c10('0x12')]('/:id/teams',auth[_0x1c10('0xc')](),controller['addTeams']);router[_0x1c10('0x12')](_0x1c10('0x14'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0x1c10('0xe'),auth[_0x1c10('0xc')](),controller[_0x1c10('0x15')]);router[_0x1c10('0x16')](_0x1c10('0xe'),auth[_0x1c10('0xc')](),controller[_0x1c10('0x17')]);router[_0x1c10('0x16')](_0x1c10('0x10'),auth[_0x1c10('0xc')](),controller[_0x1c10('0x18')]);router[_0x1c10('0x16')](_0x1c10('0x14'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x1c10('0x19')]=router; \ No newline at end of file +var _0x47bd=['get','isAuthenticated','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','put','update','destroy','delete','removeTeams','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller'];(function(_0x4b468b,_0x49c47e){var _0x2890ac=function(_0x16f8a3){while(--_0x16f8a3){_0x4b468b['push'](_0x4b468b['shift']());}};_0x2890ac(++_0x49c47e);}(_0x47bd,0xab));var _0xd47b=function(_0x76756e,_0x7c88ed){_0x76756e=_0x76756e-0x0;var _0x51436b=_0x47bd[_0x76756e];return _0x51436b;};'use strict';var multer=require(_0xd47b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd47b('0x1'));var express=require(_0xd47b('0x2'));var router=express[_0xd47b('0x3')]();var fs_extra=require(_0xd47b('0x4'));var auth=require(_0xd47b('0x5'));var interaction=require(_0xd47b('0x6'));var config=require(_0xd47b('0x7'));var controller=require(_0xd47b('0x8'));router[_0xd47b('0x9')]('/',auth[_0xd47b('0xa')](),controller['index']);router[_0xd47b('0x9')](_0xd47b('0xb'),auth['isAuthenticated'](),controller[_0xd47b('0xc')]);router[_0xd47b('0x9')](_0xd47b('0xd'),auth['isAuthenticated'](),controller[_0xd47b('0xe')]);router[_0xd47b('0x9')](_0xd47b('0xf'),auth[_0xd47b('0xa')](),controller[_0xd47b('0x10')]);router[_0xd47b('0x9')](_0xd47b('0x11'),auth['isAuthenticated'](),controller[_0xd47b('0x12')]);router['get'](_0xd47b('0x13'),auth[_0xd47b('0xa')](),controller[_0xd47b('0x14')]);router[_0xd47b('0x15')]('/',auth[_0xd47b('0xa')](),controller[_0xd47b('0x16')]);router[_0xd47b('0x15')](_0xd47b('0x11'),auth[_0xd47b('0xa')](),controller[_0xd47b('0x17')]);router[_0xd47b('0x15')](_0xd47b('0x13'),auth[_0xd47b('0xa')](),controller['addAgents']);router[_0xd47b('0x18')](_0xd47b('0xd'),auth[_0xd47b('0xa')](),controller[_0xd47b('0x19')]);router['delete'](_0xd47b('0xd'),auth[_0xd47b('0xa')](),controller[_0xd47b('0x1a')]);router[_0xd47b('0x1b')]('/:id/teams',auth[_0xd47b('0xa')](),controller[_0xd47b('0x1c')]);router[_0xd47b('0x1b')](_0xd47b('0x13'),auth[_0xd47b('0xa')](),controller['removeAgents']);module[_0xd47b('0x1d')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 477820e..30c9175 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 _0x7ad9=['INTEGER','ENUM','rrmemory','roundrobin','sequelize','exports','STRING','name'];(function(_0x1a72b8,_0x1e4f4b){var _0x39f72d=function(_0x35aef1){while(--_0x35aef1){_0x1a72b8['push'](_0x1a72b8['shift']());}};_0x39f72d(++_0x1e4f4b);}(_0x7ad9,0x104));var _0x97ad=function(_0x5aa2a1,_0xd9c1c9){_0x5aa2a1=_0x5aa2a1-0x0;var _0x1a9949=_0x7ad9[_0x5aa2a1];return _0x1a9949;};'use strict';var Sequelize=require(_0x97ad('0x0'));module[_0x97ad('0x1')]={'name':{'type':Sequelize[_0x97ad('0x2')],'unique':_0x97ad('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x97ad('0x2')]},'timeout':{'type':Sequelize[_0x97ad('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x97ad('0x5')](_0x97ad('0x6'),'beepall',_0x97ad('0x7'))}}; \ No newline at end of file +var _0xc114=['exports','STRING','INTEGER','rrmemory','beepall','roundrobin','sequelize'];(function(_0x2698e3,_0x3dc553){var _0x162cff=function(_0x3dbd27){while(--_0x3dbd27){_0x2698e3['push'](_0x2698e3['shift']());}};_0x162cff(++_0x3dc553);}(_0xc114,0x11e));var _0x4c11=function(_0x514f80,_0x5cfd7a){_0x514f80=_0x514f80-0x0;var _0x54ed3b=_0xc114[_0x514f80];return _0x54ed3b;};'use strict';var Sequelize=require(_0x4c11('0x0'));module[_0x4c11('0x1')]={'name':{'type':Sequelize[_0x4c11('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x4c11('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x4c11('0x4'),_0x4c11('0x5'),_0x4c11('0x6'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 5dfc43d..bcd01e8 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 _0x5f66=['show','params','model','keys','intersection','attributes','fields','includeAll','merge','options','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SmsQueues','find','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','rawAttributes','filters','hasOwnProperty','order','sort','pick','map','UserSmsQueue','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','%s/%s','SIP','getTeams','length','filter','nolimit','ids','Team','Agents','interface','flatMap','sequelize','transaction','addTeams','forEach','emit','userSmsQueue:save','removeTeams','select','tq.TeamId','team_has_sms_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','includes','all','compact','value','isEmpty','removeAgents','userSmsQueue:remove','addAgents','spread','isArray','findOne','getAgents','util','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','defaults','redis','./smsQueue.socket','register','end','json','offset','limit','undefined','count','status','update','then','UserProfileResource','destroy','sendStatus','stack','name','send','index','fieldName','key','getOptions','where','SmsQueue','include','query','findAll','catch'];(function(_0x1e9449,_0x422da){var _0x1740ab=function(_0x2562b8){while(--_0x2562b8){_0x1e9449['push'](_0x1e9449['shift']());}};_0x1740ab(++_0x422da);}(_0x5f66,0x1a0));var _0x65f6=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x5f66[_0x36eaaa];return _0x461349;};'use strict';var BPromise=require('bluebird');var util=require(_0x65f6('0x0'));var _=require('lodash');var squel=require(_0x65f6('0x1'));var Redis=require(_0x65f6('0x2'));var qs=require(_0x65f6('0x3'));var logger=require(_0x65f6('0x4'))(_0x65f6('0x5'));var config=require('../../config/environment');var db=require(_0x65f6('0x6'))['db'];config['redis']=_[_0x65f6('0x7')](config[_0x65f6('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x65f6('0x8')]));require(_0x65f6('0x9'))[_0x65f6('0xa')](socket);function respondWithStatusCode(_0x8f6451,_0xc44c70){_0xc44c70=_0xc44c70||0xcc;return function(_0x14f4c7){if(_0x14f4c7){return _0x8f6451['sendStatus'](_0xc44c70);}return _0x8f6451['status'](_0xc44c70)[_0x65f6('0xb')]();};}function respondWithResult(_0x2f6d5b,_0x264647){_0x264647=_0x264647||0xc8;return function(_0x25c416){if(_0x25c416){return _0x2f6d5b['status'](_0x264647)[_0x65f6('0xc')](_0x25c416);}};}function respondWithFilteredResult(_0x571436,_0x497cf3){return function(_0x2d2dfa){if(_0x2d2dfa){var _0x576875=typeof _0x497cf3[_0x65f6('0xd')]==='undefined'&&typeof _0x497cf3[_0x65f6('0xe')]===_0x65f6('0xf');var _0x2c4ee5=_0x2d2dfa[_0x65f6('0x10')];var _0x369f96=_0x576875?0x0:_0x497cf3[_0x65f6('0xd')];var _0x44144b=_0x576875?_0x2d2dfa[_0x65f6('0x10')]:_0x497cf3[_0x65f6('0xd')]+_0x497cf3[_0x65f6('0xe')];var _0x59154e;if(_0x44144b>=_0x2c4ee5){_0x44144b=_0x2c4ee5;_0x59154e=0xc8;}else{_0x59154e=0xce;}_0x571436[_0x65f6('0x11')](_0x59154e);return _0x571436['set']('Content-Range',_0x369f96+'-'+_0x44144b+'/'+_0x2c4ee5)[_0x65f6('0xc')](_0x2d2dfa);}return null;};}function saveUpdates(_0x5c69f8){return function(_0x37330d){if(_0x37330d){return _0x37330d[_0x65f6('0x12')](_0x5c69f8)[_0x65f6('0x13')](function(_0x1f974c){return _0x1f974c;});}return null;};}function removeEntity(_0xc8660c){return function(_0x18380e){if(_0x18380e){return _0x18380e['destroy']()['then'](function(){var _0x2d538c=_0x18380e['get']({'plain':!![]});var _0x4c81f3='SmsQueues';return db[_0x65f6('0x14')][_0x65f6('0x15')]({'where':{'type':_0x4c81f3,'resourceId':_0x2d538c['id']}})['then'](function(){return _0x18380e;});})[_0x65f6('0x13')](function(){_0xc8660c[_0x65f6('0x11')](0xcc)[_0x65f6('0xb')]();});}};}function handleEntityNotFound(_0x3876ed){return function(_0x219ab2){if(!_0x219ab2){_0x3876ed[_0x65f6('0x16')](0x194);}return _0x219ab2;};}function handleError(_0x581374,_0x197a49){_0x197a49=_0x197a49||0x1f4;return function(_0x4bb39e){logger['error'](_0x4bb39e[_0x65f6('0x17')]);if(_0x4bb39e[_0x65f6('0x18')]){delete _0x4bb39e['name'];}_0x581374[_0x65f6('0x11')](_0x197a49)[_0x65f6('0x19')](_0x4bb39e);};}exports[_0x65f6('0x1a')]=function(_0x2774a1,_0x4f5a69){var _0x9d7bb0={};var _0x59ea32={'count':0x0,'rows':[]};var _0x20a161=_['map'](db['SmsQueue']['rawAttributes'],function(_0x29abdb){return{'name':_0x29abdb[_0x65f6('0x1b')],'type':_0x29abdb['type'][_0x65f6('0x1c')]};});_0x9d7bb0=qs[_0x65f6('0x1d')](_0x20a161,_0x2774a1);var _0x52277c={'where':_0x9d7bb0[_0x65f6('0x1e')]};return db[_0x65f6('0x1f')][_0x65f6('0x10')](_0x52277c)['then'](function(_0x4ac04b){_0x59ea32['count']=_0x4ac04b;_0x9d7bb0[_0x65f6('0x20')]=qs[_0x65f6('0x20')](_0x2774a1[_0x65f6('0x21')]);return db[_0x65f6('0x1f')][_0x65f6('0x22')](_0x9d7bb0);})[_0x65f6('0x13')](function(_0x144e55){_0x59ea32['rows']=_0x144e55;return _0x59ea32;})['then'](respondWithFilteredResult(_0x4f5a69,_0x9d7bb0))[_0x65f6('0x23')](handleError(_0x4f5a69,null));};exports[_0x65f6('0x24')]=function(_0x5878bc,_0x4e50c0){var _0x10b368={'raw':!![],'where':{'id':_0x5878bc[_0x65f6('0x25')]['id']}},_0x1ce43c={};_0x1ce43c[_0x65f6('0x26')]=_[_0x65f6('0x27')](db[_0x65f6('0x1f')]['rawAttributes']);_0x1ce43c[_0x65f6('0x21')]=_[_0x65f6('0x27')](_0x5878bc[_0x65f6('0x21')]);_0x1ce43c['filters']=_[_0x65f6('0x28')](_0x1ce43c[_0x65f6('0x26')],_0x1ce43c[_0x65f6('0x21')]);_0x10b368[_0x65f6('0x29')]=_[_0x65f6('0x28')](_0x1ce43c[_0x65f6('0x26')],qs['fields'](_0x5878bc[_0x65f6('0x21')][_0x65f6('0x2a')]));_0x10b368['attributes']=_0x10b368[_0x65f6('0x29')]['length']?_0x10b368[_0x65f6('0x29')]:_0x1ce43c['model'];if(_0x5878bc[_0x65f6('0x21')][_0x65f6('0x2b')]){_0x10b368['include']=[{'all':!![]}];}_0x10b368=_[_0x65f6('0x2c')]({},_0x10b368,_0x5878bc[_0x65f6('0x2d')]);return db[_0x65f6('0x1f')]['find'](_0x10b368)['then'](handleEntityNotFound(_0x4e50c0,null))[_0x65f6('0x13')](respondWithResult(_0x4e50c0,null))['catch'](handleError(_0x4e50c0,null));};exports[_0x65f6('0x2e')]=function(_0x4e6653,_0x22d760){return db[_0x65f6('0x1f')]['create'](_0x4e6653[_0x65f6('0x2f')],{})['then'](function(_0x5edd04){var _0x71b16b=_0x4e6653[_0x65f6('0x30')][_0x65f6('0x31')]({'plain':!![]});if(!_0x71b16b)throw new Error(_0x65f6('0x32'));if(_0x71b16b[_0x65f6('0x33')]===_0x65f6('0x30')){var _0x1a55da=_0x5edd04[_0x65f6('0x31')]({'plain':!![]});var _0x4f933b=_0x65f6('0x34');return db['UserProfileSection'][_0x65f6('0x35')]({'where':{'name':_0x4f933b,'userProfileId':_0x71b16b[_0x65f6('0x36')]},'raw':!![]})[_0x65f6('0x13')](function(_0x2ea7f7){if(_0x2ea7f7&&_0x2ea7f7['autoAssociation']===0x0){return db[_0x65f6('0x14')][_0x65f6('0x2e')]({'name':_0x1a55da[_0x65f6('0x18')],'resourceId':_0x1a55da['id'],'type':_0x2ea7f7[_0x65f6('0x18')],'sectionId':_0x2ea7f7['id']},{})[_0x65f6('0x13')](function(){return _0x5edd04;});}else{return _0x5edd04;}})[_0x65f6('0x23')](function(_0xed4c96){logger[_0x65f6('0x37')](_0x65f6('0x38'),_0xed4c96);throw _0xed4c96;});}return _0x5edd04;})['then'](respondWithResult(_0x22d760,0xc9))[_0x65f6('0x23')](handleError(_0x22d760,null));};exports[_0x65f6('0x12')]=function(_0x377ae5,_0x181798){if(_0x377ae5[_0x65f6('0x2f')]['id']){delete _0x377ae5[_0x65f6('0x2f')]['id'];}return db[_0x65f6('0x1f')][_0x65f6('0x35')]({'where':{'id':_0x377ae5[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x181798,null))[_0x65f6('0x13')](saveUpdates(_0x377ae5[_0x65f6('0x2f')],null))[_0x65f6('0x13')](respondWithResult(_0x181798,null))[_0x65f6('0x23')](handleError(_0x181798,null));};exports[_0x65f6('0x15')]=function(_0x2cb38d,_0x5119ee){return db[_0x65f6('0x1f')][_0x65f6('0x35')]({'where':{'id':_0x2cb38d[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x5119ee,null))['then'](removeEntity(_0x5119ee,null))[_0x65f6('0x23')](handleError(_0x5119ee,null));};exports[_0x65f6('0x39')]=function(_0x2b01eb,_0x5e69b4){return db[_0x65f6('0x1f')][_0x65f6('0x39')]()[_0x65f6('0x13')](respondWithResult(_0x5e69b4,null))[_0x65f6('0x23')](handleError(_0x5e69b4,null));};exports['getMembers']=function(_0x2ec114,_0x512527){var _0x3f1baa={'raw':!![],'where':{}},_0x6968b={},_0x577c93;return db[_0x65f6('0x1f')]['findOne']({'where':{'id':_0x2ec114[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x512527,null))[_0x65f6('0x13')](function(_0xc0db01){if(_0xc0db01){_0x577c93=_0xc0db01[_0x65f6('0x31')]({'plain':!![]});_0x6968b[_0x65f6('0x26')]=_['keys'](db['UserSmsQueue'][_0x65f6('0x3a')]);_0x6968b[_0x65f6('0x21')]=_[_0x65f6('0x27')](_0x2ec114[_0x65f6('0x21')]);_0x6968b[_0x65f6('0x3b')]=_[_0x65f6('0x28')](_0x6968b[_0x65f6('0x26')],_0x6968b[_0x65f6('0x21')]);_0x3f1baa[_0x65f6('0x29')]=_['intersection'](_0x6968b[_0x65f6('0x26')],qs[_0x65f6('0x2a')](_0x2ec114[_0x65f6('0x21')]['fields']));_0x3f1baa[_0x65f6('0x29')]=_0x3f1baa[_0x65f6('0x29')]['length']?_0x3f1baa[_0x65f6('0x29')]:_0x6968b[_0x65f6('0x26')];if(!_0x2ec114['query'][_0x65f6('0x3c')]('nolimit')){_0x3f1baa[_0x65f6('0xe')]=qs[_0x65f6('0xe')](_0x2ec114[_0x65f6('0x21')]['limit']);_0x3f1baa[_0x65f6('0xd')]=qs[_0x65f6('0xd')](_0x2ec114['query'][_0x65f6('0xd')]);}_0x3f1baa[_0x65f6('0x3d')]=qs['sort'](_0x2ec114[_0x65f6('0x21')][_0x65f6('0x3e')]);_0x3f1baa[_0x65f6('0x1e')]=qs[_0x65f6('0x3b')](_[_0x65f6('0x3f')](_0x2ec114[_0x65f6('0x21')],_0x6968b[_0x65f6('0x3b')]));_0x3f1baa[_0x65f6('0x1e')]['SmsQueueId']=_0xc0db01['id'];if(_0x2ec114['query']['filter']){_0x3f1baa[_0x65f6('0x1e')]=_[_0x65f6('0x2c')](_0x3f1baa[_0x65f6('0x1e')],{'$or':_[_0x65f6('0x40')](_0x3f1baa['attributes'],function(_0x183c08){var _0x2032b9={};_0x2032b9[_0x183c08]={'$like':'%'+_0x2ec114[_0x65f6('0x21')]['filter']+'%'};return _0x2032b9;})});}_0x3f1baa=_[_0x65f6('0x2c')]({},_0x3f1baa,_0x2ec114[_0x65f6('0x2d')]);return db[_0x65f6('0x41')]['findAll'](_0x3f1baa);}})['then'](function(_0x1d337d){if(_0x1d337d){return db[_0x65f6('0x42')][_0x65f6('0x43')]({'where':{'id':_[_0x65f6('0x40')](_0x1d337d,_0x65f6('0x44')),'role':_0x65f6('0x45')},'attributes':['id',_0x65f6('0x18'),_0x65f6('0x46'),_0x65f6('0x47'),_0x65f6('0x48')]});}})[_0x65f6('0x13')](function(_0x141fcc){if(_0x141fcc){return{'count':_0x141fcc[_0x65f6('0x10')],'rows':_[_0x65f6('0x40')](_0x141fcc['rows'],function(_0x47610a){return{'membername':_0x47610a[_0x65f6('0x18')],'UserId':_0x47610a['id'],'queue_name':_0x577c93[_0x65f6('0x18')],'SmsQueueId':_0x577c93['id'],'interface':util['format'](_0x65f6('0x49'),_0x65f6('0x4a'),_0x47610a[_0x65f6('0x18')]),'penalty':0x0,'paused':_0x47610a[_0x65f6('0x46')],'createdAt':_0x47610a['createdAt'],'updatedAt':_0x47610a[_0x65f6('0x47')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x65f6('0x13')](respondWithFilteredResult(_0x512527,_0x3f1baa))[_0x65f6('0x23')](handleError(_0x512527,null));};exports[_0x65f6('0x4b')]=function(_0x553ff0,_0x2923ff){var _0x2fc20f={};var _0x5c55e4={};var _0x28682b;var _0x26481e;return db[_0x65f6('0x1f')]['findOne']({'where':{'id':_0x553ff0[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x2923ff,null))[_0x65f6('0x13')](function(_0x3c23e3){if(_0x3c23e3){_0x28682b=_0x3c23e3;_0x5c55e4[_0x65f6('0x26')]=_[_0x65f6('0x27')](db['Team']['rawAttributes']);_0x5c55e4['query']=_[_0x65f6('0x27')](_0x553ff0[_0x65f6('0x21')]);_0x5c55e4[_0x65f6('0x3b')]=_[_0x65f6('0x28')](_0x5c55e4[_0x65f6('0x26')],_0x5c55e4[_0x65f6('0x21')]);_0x2fc20f['attributes']=_[_0x65f6('0x28')](_0x5c55e4[_0x65f6('0x26')],qs['fields'](_0x553ff0[_0x65f6('0x21')][_0x65f6('0x2a')]));_0x2fc20f[_0x65f6('0x29')]=_0x2fc20f['attributes'][_0x65f6('0x4c')]?_0x2fc20f[_0x65f6('0x29')]:_0x5c55e4['model'];_0x2fc20f[_0x65f6('0x3d')]=qs[_0x65f6('0x3e')](_0x553ff0[_0x65f6('0x21')][_0x65f6('0x3e')]);_0x2fc20f[_0x65f6('0x1e')]=qs[_0x65f6('0x3b')](_[_0x65f6('0x3f')](_0x553ff0['query'],_0x5c55e4['filters']));if(_0x553ff0[_0x65f6('0x21')][_0x65f6('0x4d')]){_0x2fc20f['where']=_[_0x65f6('0x2c')](_0x2fc20f['where'],{'$or':_[_0x65f6('0x40')](_0x2fc20f['attributes'],function(_0x440df1){var _0xdc8989={};_0xdc8989[_0x440df1]={'$like':'%'+_0x553ff0[_0x65f6('0x21')][_0x65f6('0x4d')]+'%'};return _0xdc8989;})});}_0x2fc20f=_[_0x65f6('0x2c')]({},_0x2fc20f,_0x553ff0[_0x65f6('0x2d')]);return _0x28682b[_0x65f6('0x4b')](_0x2fc20f);}})[_0x65f6('0x13')](function(_0x2405a7){if(_0x2405a7){_0x26481e=_0x2405a7['length'];if(!_0x553ff0['query'][_0x65f6('0x3c')](_0x65f6('0x4e'))){_0x2fc20f[_0x65f6('0xe')]=qs['limit'](_0x553ff0['query'][_0x65f6('0xe')]);_0x2fc20f[_0x65f6('0xd')]=qs[_0x65f6('0xd')](_0x553ff0[_0x65f6('0x21')][_0x65f6('0xd')]);}return _0x28682b[_0x65f6('0x4b')](_0x2fc20f);}})['then'](function(_0x4f42ae){if(_0x4f42ae){return _0x4f42ae?{'count':_0x26481e,'rows':_0x4f42ae}:null;}})[_0x65f6('0x13')](respondWithResult(_0x2923ff,null))[_0x65f6('0x23')](handleError(_0x2923ff,null));};exports['addTeams']=function(_0x219bf8,_0x4a8b60){var _0x254e9f=_0x219bf8[_0x65f6('0x2f')][_0x65f6('0x4f')];return db[_0x65f6('0x50')]['findAll']({'where':{'id':_0x254e9f},'attributes':['id'],'include':[{'model':db[_0x65f6('0x42')],'as':_0x65f6('0x51'),'attributes':['id',_0x65f6('0x18'),'online','voicePause',_0x65f6('0x52')],'raw':!![]}]})['then'](function(_0x305967){if(_0x305967){var _0xf6de=_[_0x65f6('0x53')](_0x305967,function(_0x354b90){var _0x512776=_0x354b90['get']({'plain':!![]});return _0x512776['Agents'];});return db[_0x65f6('0x1f')][_0x65f6('0x35')]({'where':{'id':_0x219bf8[_0x65f6('0x25')]['id']}})['then'](function(_0x46cbde){return db[_0x65f6('0x54')][_0x65f6('0x55')](function(_0x49cee2){return _0x46cbde[_0x65f6('0x56')](_0x254e9f,{'transaction':_0x49cee2})[_0x65f6('0x13')](function(){return BPromise['each'](_0xf6de,function(_0x758e80){return db[_0x65f6('0x41')]['findOrCreate']({'where':{'UserId':_0x758e80['id'],'SmsQueueId':_0x219bf8[_0x65f6('0x25')]['id']},'transaction':_0x49cee2});});})['then'](function(){_0xf6de[_0x65f6('0x57')](function(_0x55ea91){socket[_0x65f6('0x58')](_0x65f6('0x59'),{'UserId':_0x55ea91['id'],'SmsQueueId':_0x46cbde['id']});});});});});}})['then'](respondWithStatusCode(_0x4a8b60,null))[_0x65f6('0x23')](handleError(_0x4a8b60,null));};exports[_0x65f6('0x5a')]=function(_0x2a700b,_0x299b85){return db[_0x65f6('0x50')][_0x65f6('0x22')]({'where':{'id':_0x2a700b[_0x65f6('0x21')][_0x65f6('0x4f')]},'attributes':['id'],'include':[{'model':db[_0x65f6('0x42')],'as':_0x65f6('0x51'),'attributes':['id'],'raw':!![]}]})[_0x65f6('0x13')](handleEntityNotFound(_0x299b85,null))['then'](function(_0x10a661){var _0x1cf1bd=_[_0x65f6('0x40')](_0x10a661,'id');var _0x219e42=[];var _0x5694f9=[];var _0x453080=squel[_0x65f6('0x5b')]();_0x453080['field'](_0x65f6('0x5c'))['from'](_0x65f6('0x5d'),'tq')['join'](_0x65f6('0x5e'),'ut',_0x65f6('0x5f'))['where']('SmsQueueId\x20=\x20?',_0x2a700b[_0x65f6('0x25')]['id']);for(var _0x413c21=0x0;_0x413c21<_0x10a661['length'];_0x413c21+=0x1){let _0x2d86c8=_0x10a661[_0x413c21];for(var _0x3b3bd5=0x0;_0x3b3bd5<_0x2d86c8[_0x65f6('0x51')]['length'];_0x3b3bd5+=0x1){let _0x1348ec=_0x2d86c8[_0x65f6('0x51')][_0x3b3bd5];var _0x5889dc=_0x453080[_0x65f6('0x60')]();_0x5889dc['where'](_0x65f6('0x61'),_0x1348ec['id']);_0x5694f9['push'](db['sequelize'][_0x65f6('0x21')](_0x5889dc[_0x65f6('0x62')](),{'type':db[_0x65f6('0x54')][_0x65f6('0x63')][_0x65f6('0x64')]})[_0x65f6('0x13')](function(_0x1ac46f){if(_0x1ac46f[_0x65f6('0x4c')]===0x1){return _0x1348ec['id'];}else{var _0x4d66fe=_['every'](_[_0x65f6('0x40')](_0x1ac46f,'TeamId'),function(_0x1ee28a){return _[_0x65f6('0x65')](_0x1cf1bd,_0x1ee28a);});if(_0x4d66fe){return _0x1348ec['id'];}}}));}}return BPromise[_0x65f6('0x66')](_0x5694f9)[_0x65f6('0x13')](function(_0x43127b){_0x219e42=_(_0x219e42)['union'](_0x43127b)[_0x65f6('0x67')]()[_0x65f6('0x68')]();return db[_0x65f6('0x1f')]['find']({'where':{'id':_0x2a700b[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](function(_0x4254c2){return db[_0x65f6('0x54')][_0x65f6('0x55')](function(_0x16bf93){return _0x4254c2['removeTeams'](_0x2a700b['query'][_0x65f6('0x4f')],{'transaction':_0x16bf93})[_0x65f6('0x13')](function(){if(!_[_0x65f6('0x69')](_0x219e42)){return _0x4254c2[_0x65f6('0x6a')](_0x219e42,{'transaction':_0x16bf93});}})['then'](function(){_0x219e42['forEach'](function(_0x336076){socket[_0x65f6('0x58')](_0x65f6('0x6b'),{'UserId':_0x336076,'SmsQueueId':_0x4254c2['id']});});});});});});})[_0x65f6('0x13')](respondWithStatusCode(_0x299b85,null))[_0x65f6('0x23')](handleError(_0x299b85,null));};exports[_0x65f6('0x6c')]=function(_0x5daaf4,_0x4d607a){return db['SmsQueue'][_0x65f6('0x35')]({'where':{'id':_0x5daaf4[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x4d607a,null))[_0x65f6('0x13')](function(_0x53b11c){if(_0x53b11c){return _0x53b11c['addAgents'](_0x5daaf4[_0x65f6('0x2f')][_0x65f6('0x4f')],_['omit'](_0x5daaf4[_0x65f6('0x2f')],['ids','id'])||{})[_0x65f6('0x6d')](function(_0x4f3ef8){for(var _0x3a30ed=0x0;_0x3a30ed<_0x5daaf4[_0x65f6('0x2f')]['ids'][_0x65f6('0x4c')];_0x3a30ed+=0x1){socket[_0x65f6('0x58')](_0x65f6('0x59'),{'UserId':Number(_0x5daaf4[_0x65f6('0x2f')][_0x65f6('0x4f')][_0x3a30ed]),'SmsQueueId':Number(_0x5daaf4[_0x65f6('0x25')]['id'])});}return _0x4f3ef8;});}})['then'](respondWithResult(_0x4d607a,null))[_0x65f6('0x23')](handleError(_0x4d607a,null));};exports['removeAgents']=function(_0x24495c,_0x56336a){return db[_0x65f6('0x1f')][_0x65f6('0x35')]({'where':{'id':_0x24495c[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x56336a,null))['then'](function(_0x2b6f98){if(_0x2b6f98){return _0x2b6f98[_0x65f6('0x6a')](_0x24495c[_0x65f6('0x21')]['ids'])['then'](function(){if(_[_0x65f6('0x6e')](_0x24495c[_0x65f6('0x21')]['ids'])){for(var _0x180cde=0x0;_0x180cde<_0x24495c[_0x65f6('0x21')][_0x65f6('0x4f')]['length'];_0x180cde+=0x1){socket[_0x65f6('0x58')](_0x65f6('0x6b'),{'UserId':Number(_0x24495c['query'][_0x65f6('0x4f')][_0x180cde]),'SmsQueueId':Number(_0x24495c[_0x65f6('0x25')]['id'])});}}else{socket[_0x65f6('0x58')]('userSmsQueue:remove',{'UserId':Number(_0x24495c[_0x65f6('0x21')][_0x65f6('0x4f')]),'SmsQueueId':Number(_0x24495c[_0x65f6('0x25')]['id'])});}});}})['then'](respondWithStatusCode(_0x56336a,null))[_0x65f6('0x23')](handleError(_0x56336a,null));};exports['getAgents']=function(_0x1beaa7,_0x87a9e4){var _0x31ec61={};var _0x22be6e={};var _0x29b2de;var _0x430fb8;return db['SmsQueue'][_0x65f6('0x6f')]({'where':{'id':_0x1beaa7[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x87a9e4,null))[_0x65f6('0x13')](function(_0x207d15){if(_0x207d15){_0x29b2de=_0x207d15;_0x22be6e['model']=_['keys'](db['User'][_0x65f6('0x3a')]);_0x22be6e[_0x65f6('0x21')]=_[_0x65f6('0x27')](_0x1beaa7['query']);_0x22be6e[_0x65f6('0x3b')]=_['intersection'](_0x22be6e['model'],_0x22be6e[_0x65f6('0x21')]);_0x31ec61[_0x65f6('0x29')]=_['intersection'](_0x22be6e[_0x65f6('0x26')],qs[_0x65f6('0x2a')](_0x1beaa7[_0x65f6('0x21')][_0x65f6('0x2a')]));_0x31ec61[_0x65f6('0x29')]=_0x31ec61[_0x65f6('0x29')][_0x65f6('0x4c')]?_0x31ec61[_0x65f6('0x29')]:_0x22be6e[_0x65f6('0x26')];_0x31ec61[_0x65f6('0x3d')]=qs[_0x65f6('0x3e')](_0x1beaa7[_0x65f6('0x21')]['sort']);_0x31ec61[_0x65f6('0x1e')]=qs['filters'](_['pick'](_0x1beaa7[_0x65f6('0x21')],_0x22be6e[_0x65f6('0x3b')]));if(_0x1beaa7[_0x65f6('0x21')][_0x65f6('0x4d')]){_0x31ec61['where']=_[_0x65f6('0x2c')](_0x31ec61['where'],{'$or':_['map'](_0x31ec61[_0x65f6('0x29')],function(_0x99fe6e){var _0x1a7e52={};_0x1a7e52[_0x99fe6e]={'$like':'%'+_0x1beaa7[_0x65f6('0x21')][_0x65f6('0x4d')]+'%'};return _0x1a7e52;})});}_0x31ec61=_[_0x65f6('0x2c')]({},_0x31ec61,_0x1beaa7['options']);return _0x29b2de[_0x65f6('0x70')](_0x31ec61);}})['then'](function(_0x1ef2a0){if(_0x1ef2a0){_0x430fb8=_0x1ef2a0[_0x65f6('0x4c')];if(!_0x1beaa7[_0x65f6('0x21')]['hasOwnProperty'](_0x65f6('0x4e'))){_0x31ec61['limit']=qs['limit'](_0x1beaa7[_0x65f6('0x21')][_0x65f6('0xe')]);_0x31ec61[_0x65f6('0xd')]=qs[_0x65f6('0xd')](_0x1beaa7[_0x65f6('0x21')]['offset']);}return _0x29b2de[_0x65f6('0x70')](_0x31ec61);}})[_0x65f6('0x13')](function(_0x3bebe3){if(_0x3bebe3){return _0x3bebe3?{'count':_0x430fb8,'rows':_0x3bebe3}:null;}})[_0x65f6('0x13')](respondWithResult(_0x87a9e4,null))['catch'](handleError(_0x87a9e4,null));}; \ No newline at end of file +var _0x2ef3=['intersection','attributes','model','fields','length','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','update','describe','getMembers','findOne','UserSmsQueue','filters','hasOwnProperty','order','sort','pick','SmsQueueId','filter','User','findAndCountAll','agent','updatedAt','createdAt','SIP','getTeams','Team','nolimit','addTeams','ids','online','voicePause','flatMap','each','findOrCreate','removeTeams','Agents','select','field','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','push','sequelize','toString','QueryTypes','TeamId','union','compact','value','transaction','isEmpty','emit','addAgents','spread','userSmsQueue:save','removeAgents','isArray','userSmsQueue:remove','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','redis','defaults','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','then','destroy','get','SmsQueues','UserProfileResource','name','map','SmsQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','findAll','rows','catch','show','params','keys'];(function(_0x37c934,_0x304df7){var _0x564c63=function(_0x2bcc82){while(--_0x2bcc82){_0x37c934['push'](_0x37c934['shift']());}};_0x564c63(++_0x304df7);}(_0x2ef3,0xba));var _0x32ef=function(_0x188323,_0x63a0cc){_0x188323=_0x188323-0x0;var _0x5662fe=_0x2ef3[_0x188323];return _0x5662fe;};'use strict';var BPromise=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var _=require(_0x32ef('0x2'));var squel=require(_0x32ef('0x3'));var Redis=require(_0x32ef('0x4'));var qs=require(_0x32ef('0x5'));var logger=require('../../config/logger')(_0x32ef('0x6'));var config=require(_0x32ef('0x7'));var db=require('../../mysqldb')['db'];config[_0x32ef('0x8')]=_[_0x32ef('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x32ef('0xa'))(new Redis(config[_0x32ef('0x8')]));require(_0x32ef('0xb'))[_0x32ef('0xc')](socket);function respondWithStatusCode(_0x234863,_0x298066){_0x298066=_0x298066||0xcc;return function(_0x2484a0){if(_0x2484a0){return _0x234863[_0x32ef('0xd')](_0x298066);}return _0x234863[_0x32ef('0xe')](_0x298066)[_0x32ef('0xf')]();};}function respondWithResult(_0x56eb42,_0x5780e9){_0x5780e9=_0x5780e9||0xc8;return function(_0x401d0b){if(_0x401d0b){return _0x56eb42[_0x32ef('0xe')](_0x5780e9)[_0x32ef('0x10')](_0x401d0b);}};}function respondWithFilteredResult(_0x1499c2,_0x5af651){return function(_0x193714){if(_0x193714){var _0x5afcc2=typeof _0x5af651[_0x32ef('0x11')]==='undefined'&&typeof _0x5af651[_0x32ef('0x12')]===_0x32ef('0x13');var _0x5c3eb9=_0x193714['count'];var _0x19ce1=_0x5afcc2?0x0:_0x5af651['offset'];var _0x326fce=_0x5afcc2?_0x193714[_0x32ef('0x14')]:_0x5af651[_0x32ef('0x11')]+_0x5af651[_0x32ef('0x12')];var _0x57aff1;if(_0x326fce>=_0x5c3eb9){_0x326fce=_0x5c3eb9;_0x57aff1=0xc8;}else{_0x57aff1=0xce;}_0x1499c2['status'](_0x57aff1);return _0x1499c2['set'](_0x32ef('0x15'),_0x19ce1+'-'+_0x326fce+'/'+_0x5c3eb9)[_0x32ef('0x10')](_0x193714);}return null;};}function saveUpdates(_0xb5aed2){return function(_0x53a5ca){if(_0x53a5ca){return _0x53a5ca['update'](_0xb5aed2)[_0x32ef('0x16')](function(_0x1a9476){return _0x1a9476;});}return null;};}function removeEntity(_0x286bfb){return function(_0x57863c){if(_0x57863c){return _0x57863c[_0x32ef('0x17')]()[_0x32ef('0x16')](function(){var _0x4f4c98=_0x57863c[_0x32ef('0x18')]({'plain':!![]});var _0x314ef1=_0x32ef('0x19');return db[_0x32ef('0x1a')][_0x32ef('0x17')]({'where':{'type':_0x314ef1,'resourceId':_0x4f4c98['id']}})[_0x32ef('0x16')](function(){return _0x57863c;});})['then'](function(){_0x286bfb[_0x32ef('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x309866){return function(_0x3a20ca){if(!_0x3a20ca){_0x309866['sendStatus'](0x194);}return _0x3a20ca;};}function handleError(_0x1af371,_0x97780){_0x97780=_0x97780||0x1f4;return function(_0x5e8898){logger['error'](_0x5e8898['stack']);if(_0x5e8898[_0x32ef('0x1b')]){delete _0x5e8898[_0x32ef('0x1b')];}_0x1af371[_0x32ef('0xe')](_0x97780)['send'](_0x5e8898);};}exports['index']=function(_0x19ea6,_0x4d584b){var _0x51a412={};var _0x278495={'count':0x0,'rows':[]};var _0x14d4b3=_[_0x32ef('0x1c')](db[_0x32ef('0x1d')][_0x32ef('0x1e')],function(_0x234175){return{'name':_0x234175[_0x32ef('0x1f')],'type':_0x234175[_0x32ef('0x20')][_0x32ef('0x21')]};});_0x51a412=qs[_0x32ef('0x22')](_0x14d4b3,_0x19ea6);var _0x1335e2={'where':_0x51a412[_0x32ef('0x23')]};return db['SmsQueue'][_0x32ef('0x14')](_0x1335e2)[_0x32ef('0x16')](function(_0x5a04cd){_0x278495[_0x32ef('0x14')]=_0x5a04cd;_0x51a412[_0x32ef('0x24')]=qs[_0x32ef('0x24')](_0x19ea6[_0x32ef('0x25')]);return db['SmsQueue'][_0x32ef('0x26')](_0x51a412);})[_0x32ef('0x16')](function(_0x31dbc3){_0x278495[_0x32ef('0x27')]=_0x31dbc3;return _0x278495;})[_0x32ef('0x16')](respondWithFilteredResult(_0x4d584b,_0x51a412))[_0x32ef('0x28')](handleError(_0x4d584b,null));};exports[_0x32ef('0x29')]=function(_0x575f3e,_0x36ac37){var _0x537214={'raw':!![],'where':{'id':_0x575f3e[_0x32ef('0x2a')]['id']}},_0x38bf73={};_0x38bf73['model']=_[_0x32ef('0x2b')](db[_0x32ef('0x1d')][_0x32ef('0x1e')]);_0x38bf73[_0x32ef('0x25')]=_[_0x32ef('0x2b')](_0x575f3e['query']);_0x38bf73['filters']=_[_0x32ef('0x2c')](_0x38bf73['model'],_0x38bf73[_0x32ef('0x25')]);_0x537214[_0x32ef('0x2d')]=_[_0x32ef('0x2c')](_0x38bf73[_0x32ef('0x2e')],qs[_0x32ef('0x2f')](_0x575f3e[_0x32ef('0x25')]['fields']));_0x537214['attributes']=_0x537214['attributes'][_0x32ef('0x30')]?_0x537214[_0x32ef('0x2d')]:_0x38bf73[_0x32ef('0x2e')];if(_0x575f3e['query']['includeAll']){_0x537214[_0x32ef('0x24')]=[{'all':!![]}];}_0x537214=_[_0x32ef('0x31')]({},_0x537214,_0x575f3e[_0x32ef('0x32')]);return db['SmsQueue']['find'](_0x537214)[_0x32ef('0x16')](handleEntityNotFound(_0x36ac37,null))[_0x32ef('0x16')](respondWithResult(_0x36ac37,null))[_0x32ef('0x28')](handleError(_0x36ac37,null));};exports[_0x32ef('0x33')]=function(_0x3a7c49,_0x211c79){return db[_0x32ef('0x1d')][_0x32ef('0x33')](_0x3a7c49[_0x32ef('0x34')],{})['then'](function(_0x3a4a99){var _0x36e374=_0x3a7c49[_0x32ef('0x35')]['get']({'plain':!![]});if(!_0x36e374)throw new Error(_0x32ef('0x36'));if(_0x36e374[_0x32ef('0x37')]===_0x32ef('0x35')){var _0x393a89=_0x3a4a99[_0x32ef('0x18')]({'plain':!![]});var _0x33a0fb=_0x32ef('0x19');return db[_0x32ef('0x38')][_0x32ef('0x39')]({'where':{'name':_0x33a0fb,'userProfileId':_0x36e374[_0x32ef('0x3a')]},'raw':!![]})[_0x32ef('0x16')](function(_0x4615b4){if(_0x4615b4&&_0x4615b4['autoAssociation']===0x0){return db[_0x32ef('0x1a')][_0x32ef('0x33')]({'name':_0x393a89[_0x32ef('0x1b')],'resourceId':_0x393a89['id'],'type':_0x4615b4[_0x32ef('0x1b')],'sectionId':_0x4615b4['id']},{})[_0x32ef('0x16')](function(){return _0x3a4a99;});}else{return _0x3a4a99;}})[_0x32ef('0x28')](function(_0x3c0e44){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3c0e44);throw _0x3c0e44;});}return _0x3a4a99;})[_0x32ef('0x16')](respondWithResult(_0x211c79,0xc9))[_0x32ef('0x28')](handleError(_0x211c79,null));};exports[_0x32ef('0x3b')]=function(_0x765c63,_0x5dca14){if(_0x765c63[_0x32ef('0x34')]['id']){delete _0x765c63[_0x32ef('0x34')]['id'];}return db['SmsQueue'][_0x32ef('0x39')]({'where':{'id':_0x765c63['params']['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x5dca14,null))[_0x32ef('0x16')](saveUpdates(_0x765c63[_0x32ef('0x34')],null))[_0x32ef('0x16')](respondWithResult(_0x5dca14,null))[_0x32ef('0x28')](handleError(_0x5dca14,null));};exports[_0x32ef('0x17')]=function(_0x321ef7,_0x3d35a1){return db[_0x32ef('0x1d')][_0x32ef('0x39')]({'where':{'id':_0x321ef7['params']['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x3d35a1,null))['then'](removeEntity(_0x3d35a1,null))[_0x32ef('0x28')](handleError(_0x3d35a1,null));};exports[_0x32ef('0x3c')]=function(_0x2dd94f,_0x4d8393){return db[_0x32ef('0x1d')][_0x32ef('0x3c')]()[_0x32ef('0x16')](respondWithResult(_0x4d8393,null))[_0x32ef('0x28')](handleError(_0x4d8393,null));};exports[_0x32ef('0x3d')]=function(_0x40bf12,_0x12c9e6){var _0x47dbe1={'raw':!![],'where':{}},_0x5cb6fc={},_0x36252c;return db[_0x32ef('0x1d')][_0x32ef('0x3e')]({'where':{'id':_0x40bf12[_0x32ef('0x2a')]['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x12c9e6,null))[_0x32ef('0x16')](function(_0x44ad11){if(_0x44ad11){_0x36252c=_0x44ad11[_0x32ef('0x18')]({'plain':!![]});_0x5cb6fc[_0x32ef('0x2e')]=_[_0x32ef('0x2b')](db[_0x32ef('0x3f')][_0x32ef('0x1e')]);_0x5cb6fc[_0x32ef('0x25')]=_['keys'](_0x40bf12[_0x32ef('0x25')]);_0x5cb6fc[_0x32ef('0x40')]=_[_0x32ef('0x2c')](_0x5cb6fc[_0x32ef('0x2e')],_0x5cb6fc[_0x32ef('0x25')]);_0x47dbe1[_0x32ef('0x2d')]=_[_0x32ef('0x2c')](_0x5cb6fc[_0x32ef('0x2e')],qs[_0x32ef('0x2f')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x2f')]));_0x47dbe1[_0x32ef('0x2d')]=_0x47dbe1[_0x32ef('0x2d')][_0x32ef('0x30')]?_0x47dbe1[_0x32ef('0x2d')]:_0x5cb6fc[_0x32ef('0x2e')];if(!_0x40bf12[_0x32ef('0x25')][_0x32ef('0x41')]('nolimit')){_0x47dbe1['limit']=qs[_0x32ef('0x12')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x12')]);_0x47dbe1[_0x32ef('0x11')]=qs[_0x32ef('0x11')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x11')]);}_0x47dbe1[_0x32ef('0x42')]=qs[_0x32ef('0x43')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x43')]);_0x47dbe1['where']=qs[_0x32ef('0x40')](_[_0x32ef('0x44')](_0x40bf12[_0x32ef('0x25')],_0x5cb6fc[_0x32ef('0x40')]));_0x47dbe1[_0x32ef('0x23')][_0x32ef('0x45')]=_0x44ad11['id'];if(_0x40bf12['query'][_0x32ef('0x46')]){_0x47dbe1[_0x32ef('0x23')]=_[_0x32ef('0x31')](_0x47dbe1['where'],{'$or':_[_0x32ef('0x1c')](_0x47dbe1['attributes'],function(_0x2ee3dd){var _0xbe35b={};_0xbe35b[_0x2ee3dd]={'$like':'%'+_0x40bf12['query'][_0x32ef('0x46')]+'%'};return _0xbe35b;})});}_0x47dbe1=_['merge']({},_0x47dbe1,_0x40bf12[_0x32ef('0x32')]);return db[_0x32ef('0x3f')][_0x32ef('0x26')](_0x47dbe1);}})[_0x32ef('0x16')](function(_0x2c7bee){if(_0x2c7bee){return db[_0x32ef('0x47')][_0x32ef('0x48')]({'where':{'id':_['map'](_0x2c7bee,'UserId'),'role':_0x32ef('0x49')},'attributes':['id','name','smsPause',_0x32ef('0x4a'),_0x32ef('0x4b')]});}})[_0x32ef('0x16')](function(_0x6aae59){if(_0x6aae59){return{'count':_0x6aae59[_0x32ef('0x14')],'rows':_[_0x32ef('0x1c')](_0x6aae59[_0x32ef('0x27')],function(_0x4249c3){return{'membername':_0x4249c3[_0x32ef('0x1b')],'UserId':_0x4249c3['id'],'queue_name':_0x36252c[_0x32ef('0x1b')],'SmsQueueId':_0x36252c['id'],'interface':util['format']('%s/%s',_0x32ef('0x4c'),_0x4249c3[_0x32ef('0x1b')]),'penalty':0x0,'paused':_0x4249c3['smsPause'],'createdAt':_0x4249c3[_0x32ef('0x4b')],'updatedAt':_0x4249c3[_0x32ef('0x4a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x32ef('0x16')](respondWithFilteredResult(_0x12c9e6,_0x47dbe1))['catch'](handleError(_0x12c9e6,null));};exports[_0x32ef('0x4d')]=function(_0x3c31d0,_0x20dcc5){var _0x52dfe0={};var _0x5e6030={};var _0x13ea1a;var _0x47d8bf;return db[_0x32ef('0x1d')]['findOne']({'where':{'id':_0x3c31d0['params']['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x20dcc5,null))[_0x32ef('0x16')](function(_0x10cb37){if(_0x10cb37){_0x13ea1a=_0x10cb37;_0x5e6030['model']=_[_0x32ef('0x2b')](db[_0x32ef('0x4e')][_0x32ef('0x1e')]);_0x5e6030['query']=_[_0x32ef('0x2b')](_0x3c31d0[_0x32ef('0x25')]);_0x5e6030['filters']=_['intersection'](_0x5e6030[_0x32ef('0x2e')],_0x5e6030[_0x32ef('0x25')]);_0x52dfe0[_0x32ef('0x2d')]=_[_0x32ef('0x2c')](_0x5e6030[_0x32ef('0x2e')],qs[_0x32ef('0x2f')](_0x3c31d0['query'][_0x32ef('0x2f')]));_0x52dfe0[_0x32ef('0x2d')]=_0x52dfe0[_0x32ef('0x2d')][_0x32ef('0x30')]?_0x52dfe0[_0x32ef('0x2d')]:_0x5e6030[_0x32ef('0x2e')];_0x52dfe0[_0x32ef('0x42')]=qs[_0x32ef('0x43')](_0x3c31d0[_0x32ef('0x25')]['sort']);_0x52dfe0[_0x32ef('0x23')]=qs[_0x32ef('0x40')](_[_0x32ef('0x44')](_0x3c31d0[_0x32ef('0x25')],_0x5e6030[_0x32ef('0x40')]));if(_0x3c31d0['query']['filter']){_0x52dfe0[_0x32ef('0x23')]=_[_0x32ef('0x31')](_0x52dfe0[_0x32ef('0x23')],{'$or':_[_0x32ef('0x1c')](_0x52dfe0[_0x32ef('0x2d')],function(_0x526fb1){var _0x3372d9={};_0x3372d9[_0x526fb1]={'$like':'%'+_0x3c31d0['query'][_0x32ef('0x46')]+'%'};return _0x3372d9;})});}_0x52dfe0=_[_0x32ef('0x31')]({},_0x52dfe0,_0x3c31d0['options']);return _0x13ea1a['getTeams'](_0x52dfe0);}})[_0x32ef('0x16')](function(_0x1538d0){if(_0x1538d0){_0x47d8bf=_0x1538d0[_0x32ef('0x30')];if(!_0x3c31d0['query']['hasOwnProperty'](_0x32ef('0x4f'))){_0x52dfe0[_0x32ef('0x12')]=qs[_0x32ef('0x12')](_0x3c31d0[_0x32ef('0x25')]['limit']);_0x52dfe0[_0x32ef('0x11')]=qs[_0x32ef('0x11')](_0x3c31d0[_0x32ef('0x25')][_0x32ef('0x11')]);}return _0x13ea1a[_0x32ef('0x4d')](_0x52dfe0);}})[_0x32ef('0x16')](function(_0x43b176){if(_0x43b176){return _0x43b176?{'count':_0x47d8bf,'rows':_0x43b176}:null;}})[_0x32ef('0x16')](respondWithResult(_0x20dcc5,null))[_0x32ef('0x28')](handleError(_0x20dcc5,null));};exports[_0x32ef('0x50')]=function(_0x132d9f,_0x3978cb){var _0x52b32f=_0x132d9f['body'][_0x32ef('0x51')];return db[_0x32ef('0x4e')]['findAll']({'where':{'id':_0x52b32f},'attributes':['id'],'include':[{'model':db[_0x32ef('0x47')],'as':'Agents','attributes':['id',_0x32ef('0x1b'),_0x32ef('0x52'),_0x32ef('0x53'),'interface'],'raw':!![]}]})[_0x32ef('0x16')](function(_0x4978a6){if(_0x4978a6){var _0x141fec=_[_0x32ef('0x54')](_0x4978a6,function(_0x47e3cc){var _0x4c70e0=_0x47e3cc[_0x32ef('0x18')]({'plain':!![]});return _0x4c70e0['Agents'];});return db[_0x32ef('0x1d')]['find']({'where':{'id':_0x132d9f[_0x32ef('0x2a')]['id']}})[_0x32ef('0x16')](function(_0x1adcb8){return db['sequelize']['transaction'](function(_0x4f1b94){return _0x1adcb8[_0x32ef('0x50')](_0x52b32f,{'transaction':_0x4f1b94})['then'](function(){return BPromise[_0x32ef('0x55')](_0x141fec,function(_0x13a374){return db[_0x32ef('0x3f')][_0x32ef('0x56')]({'where':{'UserId':_0x13a374['id'],'SmsQueueId':_0x132d9f[_0x32ef('0x2a')]['id']},'transaction':_0x4f1b94});});})[_0x32ef('0x16')](function(){_0x141fec['forEach'](function(_0x3d9245){socket['emit']('userSmsQueue:save',{'UserId':_0x3d9245['id'],'SmsQueueId':_0x1adcb8['id']});});});});});}})[_0x32ef('0x16')](respondWithStatusCode(_0x3978cb,null))['catch'](handleError(_0x3978cb,null));};exports[_0x32ef('0x57')]=function(_0x313798,_0x4d64ec){return db[_0x32ef('0x4e')][_0x32ef('0x26')]({'where':{'id':_0x313798[_0x32ef('0x25')][_0x32ef('0x51')]},'attributes':['id'],'include':[{'model':db[_0x32ef('0x47')],'as':_0x32ef('0x58'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4d64ec,null))['then'](function(_0x35b10d){var _0x5e0b55=_[_0x32ef('0x1c')](_0x35b10d,'id');var _0x266688=[];var _0x114d8e=[];var _0x1782a5=squel[_0x32ef('0x59')]();_0x1782a5[_0x32ef('0x5a')]('tq.TeamId')[_0x32ef('0x5b')](_0x32ef('0x5c'),'tq')[_0x32ef('0x5d')](_0x32ef('0x5e'),'ut',_0x32ef('0x5f'))['where']('SmsQueueId\x20=\x20?',_0x313798[_0x32ef('0x2a')]['id']);for(var _0x904a4f=0x0;_0x904a4f<_0x35b10d['length'];_0x904a4f+=0x1){let _0x211fb1=_0x35b10d[_0x904a4f];for(var _0x2e333d=0x0;_0x2e333d<_0x211fb1[_0x32ef('0x58')][_0x32ef('0x30')];_0x2e333d+=0x1){let _0xc3664d=_0x211fb1[_0x32ef('0x58')][_0x2e333d];var _0xfb4845=_0x1782a5[_0x32ef('0x60')]();_0xfb4845[_0x32ef('0x23')]('ut.UserId\x20=\x20?',_0xc3664d['id']);_0x114d8e[_0x32ef('0x61')](db[_0x32ef('0x62')]['query'](_0xfb4845[_0x32ef('0x63')](),{'type':db['sequelize'][_0x32ef('0x64')]['SELECT']})[_0x32ef('0x16')](function(_0x39300f){if(_0x39300f[_0x32ef('0x30')]===0x1){return _0xc3664d['id'];}else{var _0x3e000c=_['every'](_[_0x32ef('0x1c')](_0x39300f,_0x32ef('0x65')),function(_0x31f99f){return _['includes'](_0x5e0b55,_0x31f99f);});if(_0x3e000c){return _0xc3664d['id'];}}}));}}return BPromise['all'](_0x114d8e)['then'](function(_0x1aff33){_0x266688=_(_0x266688)[_0x32ef('0x66')](_0x1aff33)[_0x32ef('0x67')]()[_0x32ef('0x68')]();return db[_0x32ef('0x1d')]['find']({'where':{'id':_0x313798[_0x32ef('0x2a')]['id']}})['then'](function(_0x471de6){return db[_0x32ef('0x62')][_0x32ef('0x69')](function(_0x4baa7a){return _0x471de6[_0x32ef('0x57')](_0x313798[_0x32ef('0x25')][_0x32ef('0x51')],{'transaction':_0x4baa7a})[_0x32ef('0x16')](function(){if(!_[_0x32ef('0x6a')](_0x266688)){return _0x471de6['removeAgents'](_0x266688,{'transaction':_0x4baa7a});}})[_0x32ef('0x16')](function(){_0x266688['forEach'](function(_0x4f0433){socket[_0x32ef('0x6b')]('userSmsQueue:remove',{'UserId':_0x4f0433,'SmsQueueId':_0x471de6['id']});});});});});});})['then'](respondWithStatusCode(_0x4d64ec,null))[_0x32ef('0x28')](handleError(_0x4d64ec,null));};exports[_0x32ef('0x6c')]=function(_0xf6bc02,_0x3b9896){return db['SmsQueue'][_0x32ef('0x39')]({'where':{'id':_0xf6bc02['params']['id']}})['then'](handleEntityNotFound(_0x3b9896,null))[_0x32ef('0x16')](function(_0x56aede){if(_0x56aede){return _0x56aede[_0x32ef('0x6c')](_0xf6bc02[_0x32ef('0x34')][_0x32ef('0x51')],_['omit'](_0xf6bc02['body'],[_0x32ef('0x51'),'id'])||{})[_0x32ef('0x6d')](function(_0x2c4a3c){for(var _0x3741f8=0x0;_0x3741f8<_0xf6bc02[_0x32ef('0x34')][_0x32ef('0x51')][_0x32ef('0x30')];_0x3741f8+=0x1){socket['emit'](_0x32ef('0x6e'),{'UserId':Number(_0xf6bc02[_0x32ef('0x34')][_0x32ef('0x51')][_0x3741f8]),'SmsQueueId':Number(_0xf6bc02[_0x32ef('0x2a')]['id'])});}return _0x2c4a3c;});}})['then'](respondWithResult(_0x3b9896,null))['catch'](handleError(_0x3b9896,null));};exports[_0x32ef('0x6f')]=function(_0x5eb320,_0x116951){return db[_0x32ef('0x1d')]['find']({'where':{'id':_0x5eb320['params']['id']}})['then'](handleEntityNotFound(_0x116951,null))[_0x32ef('0x16')](function(_0x33f6c3){if(_0x33f6c3){return _0x33f6c3[_0x32ef('0x6f')](_0x5eb320[_0x32ef('0x25')]['ids'])[_0x32ef('0x16')](function(){if(_[_0x32ef('0x70')](_0x5eb320[_0x32ef('0x25')]['ids'])){for(var _0x2895ad=0x0;_0x2895ad<_0x5eb320['query'][_0x32ef('0x51')][_0x32ef('0x30')];_0x2895ad+=0x1){socket['emit']('userSmsQueue:remove',{'UserId':Number(_0x5eb320[_0x32ef('0x25')][_0x32ef('0x51')][_0x2895ad]),'SmsQueueId':Number(_0x5eb320[_0x32ef('0x2a')]['id'])});}}else{socket[_0x32ef('0x6b')](_0x32ef('0x71'),{'UserId':Number(_0x5eb320[_0x32ef('0x25')][_0x32ef('0x51')]),'SmsQueueId':Number(_0x5eb320[_0x32ef('0x2a')]['id'])});}});}})[_0x32ef('0x16')](respondWithStatusCode(_0x116951,null))['catch'](handleError(_0x116951,null));};exports[_0x32ef('0x72')]=function(_0x583290,_0x22d657){var _0x7e47b9={};var _0x1d9d57={};var _0x18cf5d;var _0x102f2f;return db['SmsQueue'][_0x32ef('0x3e')]({'where':{'id':_0x583290[_0x32ef('0x2a')]['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x22d657,null))[_0x32ef('0x16')](function(_0x1db74d){if(_0x1db74d){_0x18cf5d=_0x1db74d;_0x1d9d57[_0x32ef('0x2e')]=_[_0x32ef('0x2b')](db[_0x32ef('0x47')][_0x32ef('0x1e')]);_0x1d9d57['query']=_['keys'](_0x583290['query']);_0x1d9d57[_0x32ef('0x40')]=_[_0x32ef('0x2c')](_0x1d9d57['model'],_0x1d9d57[_0x32ef('0x25')]);_0x7e47b9['attributes']=_[_0x32ef('0x2c')](_0x1d9d57['model'],qs['fields'](_0x583290[_0x32ef('0x25')][_0x32ef('0x2f')]));_0x7e47b9[_0x32ef('0x2d')]=_0x7e47b9[_0x32ef('0x2d')][_0x32ef('0x30')]?_0x7e47b9['attributes']:_0x1d9d57[_0x32ef('0x2e')];_0x7e47b9['order']=qs[_0x32ef('0x43')](_0x583290['query']['sort']);_0x7e47b9['where']=qs['filters'](_['pick'](_0x583290[_0x32ef('0x25')],_0x1d9d57[_0x32ef('0x40')]));if(_0x583290['query'][_0x32ef('0x46')]){_0x7e47b9[_0x32ef('0x23')]=_[_0x32ef('0x31')](_0x7e47b9[_0x32ef('0x23')],{'$or':_[_0x32ef('0x1c')](_0x7e47b9[_0x32ef('0x2d')],function(_0x59f0aa){var _0x2ac861={};_0x2ac861[_0x59f0aa]={'$like':'%'+_0x583290['query'][_0x32ef('0x46')]+'%'};return _0x2ac861;})});}_0x7e47b9=_[_0x32ef('0x31')]({},_0x7e47b9,_0x583290['options']);return _0x18cf5d[_0x32ef('0x72')](_0x7e47b9);}})['then'](function(_0x4557b0){if(_0x4557b0){_0x102f2f=_0x4557b0[_0x32ef('0x30')];if(!_0x583290[_0x32ef('0x25')][_0x32ef('0x41')]('nolimit')){_0x7e47b9[_0x32ef('0x12')]=qs[_0x32ef('0x12')](_0x583290[_0x32ef('0x25')][_0x32ef('0x12')]);_0x7e47b9['offset']=qs[_0x32ef('0x11')](_0x583290['query'][_0x32ef('0x11')]);}return _0x18cf5d[_0x32ef('0x72')](_0x7e47b9);}})[_0x32ef('0x16')](function(_0x28ef17){if(_0x28ef17){return _0x28ef17?{'count':_0x102f2f,'rows':_0x28ef17}:null;}})[_0x32ef('0x16')](respondWithResult(_0x22d657,null))[_0x32ef('0x28')](handleError(_0x22d657,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 9e0dbe3..557a79b 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 _0x2a5e=['events','../../mysqldb','SmsQueue','setMaxListeners','save','remove','emit','hook','exports'];(function(_0x1363ae,_0x158004){var _0x4eeaac=function(_0x2e7fee){while(--_0x2e7fee){_0x1363ae['push'](_0x1363ae['shift']());}};_0x4eeaac(++_0x158004);}(_0x2a5e,0x1ef));var _0xe2a5=function(_0xe94afa,_0x5b0a05){_0xe94afa=_0xe94afa-0x0;var _0x5b6179=_0x2a5e[_0xe94afa];return _0x5b6179;};'use strict';var EventEmitter=require(_0xe2a5('0x0'));var SmsQueue=require(_0xe2a5('0x1'))['db'][_0xe2a5('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xe2a5('0x3')](0x0);var events={'afterCreate':_0xe2a5('0x4'),'afterUpdate':'update','afterDestroy':_0xe2a5('0x5')};function emitEvent(_0x574a6d){return function(_0x488a3d,_0x4039ab,_0x28ebf2){SmsQueueEvents[_0xe2a5('0x6')](_0x574a6d+':'+_0x488a3d['id'],_0x488a3d);SmsQueueEvents[_0xe2a5('0x6')](_0x574a6d,_0x488a3d);_0x28ebf2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0xe2a5('0x7')](e,emitEvent(event));}}module[_0xe2a5('0x8')]=SmsQueueEvents; \ No newline at end of file +var _0xd5c4=['hasOwnProperty','../../mysqldb','SmsQueue','save','update','remove','emit'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0xd5c4,0x17b));var _0x4d5c=function(_0x2724ad,_0x1a3275){_0x2724ad=_0x2724ad-0x0;var _0x3a1e2e=_0xd5c4[_0x2724ad];return _0x3a1e2e;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0x4d5c('0x0'))['db'][_0x4d5c('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4d5c('0x2'),'afterUpdate':_0x4d5c('0x3'),'afterDestroy':_0x4d5c('0x4')};function emitEvent(_0x3202a5){return function(_0x3a4d31,_0x349ad7,_0x596658){SmsQueueEvents[_0x4d5c('0x5')](_0x3202a5+':'+_0x3a4d31['id'],_0x3a4d31);SmsQueueEvents[_0x4d5c('0x5')](_0x3202a5,_0x3a4d31);_0x596658(null);};}for(var e in events){if(events[_0x4d5c('0x6')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index fb5696b..b4d51c1 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 _0x501d=['./smsQueue.attributes','define','SmsQueue','sms_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x5bb8d8,_0x21a57f){var _0x34adbb=function(_0x358b70){while(--_0x358b70){_0x5bb8d8['push'](_0x5bb8d8['shift']());}};_0x34adbb(++_0x21a57f);}(_0x501d,0x94));var _0xd501=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x501d[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0xd501('0x0'));var util=require(_0xd501('0x1'));var logger=require(_0xd501('0x2'))('api');var moment=require(_0xd501('0x3'));var BPromise=require(_0xd501('0x4'));var rp=require(_0xd501('0x5'));var fs=require('fs');var path=require(_0xd501('0x6'));var rimraf=require('rimraf');var config=require(_0xd501('0x7'));var attributes=require(_0xd501('0x8'));module['exports']=function(_0x55df5c,_0x9643a6){return _0x55df5c[_0xd501('0x9')](_0xd501('0xa'),attributes,{'tableName':_0xd501('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x22dd=['path','rimraf','../../config/environment','exports','define','SmsQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x22dd,0x199));var _0xd22d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x22dd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd22d('0x0'));var util=require(_0xd22d('0x1'));var logger=require(_0xd22d('0x2'))(_0xd22d('0x3'));var moment=require(_0xd22d('0x4'));var BPromise=require(_0xd22d('0x5'));var rp=require(_0xd22d('0x6'));var fs=require('fs');var path=require(_0xd22d('0x7'));var rimraf=require(_0xd22d('0x8'));var config=require(_0xd22d('0x9'));var attributes=require('./smsQueue.attributes');module[_0xd22d('0xa')]=function(_0x483f07,_0x1bb377){return _0x483f07[_0xd22d('0xb')](_0xd22d('0xc'),attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index 6dba4d6..7bfdbf0 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 _0xaf92=['debug','ShowSmsQueue','find','raw','where','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','GetSmsQueue','SmsQueue','options','limit','include','map','attributes','model'];(function(_0x59e73b,_0x572fab){var _0x2ccff4=function(_0x205266){while(--_0x205266){_0x59e73b['push'](_0x59e73b['shift']());}};_0x2ccff4(++_0x572fab);}(_0xaf92,0xa1));var _0x2af9=function(_0x15c3e0,_0x320c34){_0x15c3e0=_0x15c3e0-0x0;var _0x2f3a01=_0xaf92[_0x15c3e0];return _0x2f3a01;};'use strict';var _=require(_0x2af9('0x0'));var util=require('util');var moment=require(_0x2af9('0x1'));var BPromise=require(_0x2af9('0x2'));var rs=require(_0x2af9('0x3'));var fs=require('fs');var Redis=require(_0x2af9('0x4'));var db=require(_0x2af9('0x5'))['db'];var utils=require(_0x2af9('0x6'));var logger=require('../../config/logger')(_0x2af9('0x7'));var config=require(_0x2af9('0x8'));var jayson=require(_0x2af9('0x9'));var client=jayson[_0x2af9('0xa')][_0x2af9('0xb')]({'port':0x232a});config[_0x2af9('0xc')]=_[_0x2af9('0xd')](config[_0x2af9('0xc')],{'host':_0x2af9('0xe'),'port':0x18eb});var socket=require(_0x2af9('0xf'))(new Redis(config[_0x2af9('0xc')]));require('./smsQueue.socket')[_0x2af9('0x10')](socket);function respondWithRpcPromise(_0x204a6b,_0x3b52f6,_0x5b5df0){return new BPromise(function(_0x284631,_0x393001){return client[_0x2af9('0x11')](_0x204a6b,_0x5b5df0)[_0x2af9('0x12')](function(_0x19af72){logger[_0x2af9('0x13')](_0x2af9('0x14'),_0x3b52f6,_0x2af9('0x15'));logger['debug'](_0x2af9('0x16'),_0x3b52f6,_0x2af9('0x15'),JSON[_0x2af9('0x17')](_0x19af72));if(_0x19af72[_0x2af9('0x18')]){if(_0x19af72[_0x2af9('0x18')]['code']===0x1f4){logger[_0x2af9('0x18')](_0x2af9('0x14'),_0x3b52f6,_0x19af72['error']['message']);return _0x393001(_0x19af72['error']['message']);}logger[_0x2af9('0x18')](_0x2af9('0x14'),_0x3b52f6,_0x19af72['error']['message']);return _0x284631(_0x19af72[_0x2af9('0x18')]['message']);}else{logger[_0x2af9('0x13')](_0x2af9('0x14'),_0x3b52f6,_0x2af9('0x15'));_0x284631(_0x19af72['result'][_0x2af9('0x19')]);}})['catch'](function(_0x33bf3a){logger[_0x2af9('0x18')](_0x2af9('0x14'),_0x3b52f6,_0x33bf3a);_0x393001(_0x33bf3a);});});}exports[_0x2af9('0x1a')]=function(_0xa9fac2){var _0x4e180b=this;return new Promise(function(_0x2bc7b1,_0x22d545){return db[_0x2af9('0x1b')]['findAll']({'raw':_0xa9fac2['options']?_0xa9fac2[_0x2af9('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0xa9fac2[_0x2af9('0x1c')]?_0xa9fac2[_0x2af9('0x1c')]['where']||null:null,'attributes':_0xa9fac2['options']?_0xa9fac2[_0x2af9('0x1c')]['attributes']||null:null,'limit':_0xa9fac2[_0x2af9('0x1c')]?_0xa9fac2[_0x2af9('0x1c')][_0x2af9('0x1d')]||null:null,'include':_0xa9fac2['options']?_0xa9fac2[_0x2af9('0x1c')][_0x2af9('0x1e')]?_[_0x2af9('0x1f')](_0xa9fac2['options'][_0x2af9('0x1e')],function(_0x2fb722){return{'model':db[_0x2fb722['model']],'as':_0x2fb722['as'],'attributes':_0x2fb722[_0x2af9('0x20')],'include':_0x2fb722[_0x2af9('0x1e')]?_[_0x2af9('0x1f')](_0x2fb722[_0x2af9('0x1e')],function(_0xe4ce58){return{'model':db[_0xe4ce58[_0x2af9('0x21')]],'as':_0xe4ce58['as'],'attributes':_0xe4ce58[_0x2af9('0x20')],'include':_0xe4ce58[_0x2af9('0x1e')]?_[_0x2af9('0x1f')](_0xe4ce58[_0x2af9('0x1e')],function(_0x45f68d){return{'model':db[_0x45f68d['model']],'as':_0x45f68d['as'],'attributes':_0x45f68d['attributes']};}):[]};}):[]};}):[]:[]})[_0x2af9('0x12')](function(_0x426195){logger[_0x2af9('0x13')](_0x2af9('0x1a'),_0xa9fac2);logger[_0x2af9('0x22')]('GetSmsQueue',_0xa9fac2,JSON['stringify'](_0x426195));_0x2bc7b1(_0x426195);})['catch'](function(_0x1ab9df){logger[_0x2af9('0x18')](_0x2af9('0x1a'),_0x1ab9df[_0x2af9('0x19')],_0xa9fac2);_0x22d545(_0x4e180b[_0x2af9('0x18')](0x1f4,_0x1ab9df[_0x2af9('0x19')]));});});};exports[_0x2af9('0x23')]=function(_0x550575){var _0x10df4f=this;return new Promise(function(_0x549ef3,_0x592ea5){return db[_0x2af9('0x1b')][_0x2af9('0x24')]({'raw':_0x550575[_0x2af9('0x1c')]?_0x550575[_0x2af9('0x1c')][_0x2af9('0x25')]===undefined?!![]:![]:!![],'where':_0x550575['options']?_0x550575[_0x2af9('0x1c')][_0x2af9('0x26')]||null:null,'attributes':_0x550575['options']?_0x550575['options'][_0x2af9('0x20')]||null:null,'include':_0x550575[_0x2af9('0x1c')]?_0x550575[_0x2af9('0x1c')][_0x2af9('0x1e')]?_[_0x2af9('0x1f')](_0x550575[_0x2af9('0x1c')][_0x2af9('0x1e')],function(_0x444cd3){return{'model':db[_0x444cd3[_0x2af9('0x21')]],'as':_0x444cd3['as'],'attributes':_0x444cd3['attributes'],'include':_0x444cd3['include']?_[_0x2af9('0x1f')](_0x444cd3['include'],function(_0xe0ecf9){return{'model':db[_0xe0ecf9[_0x2af9('0x21')]],'as':_0xe0ecf9['as'],'attributes':_0xe0ecf9[_0x2af9('0x20')],'include':_0xe0ecf9[_0x2af9('0x1e')]?_[_0x2af9('0x1f')](_0xe0ecf9['include'],function(_0x4f83be){return{'model':db[_0x4f83be[_0x2af9('0x21')]],'as':_0x4f83be['as'],'attributes':_0x4f83be[_0x2af9('0x20')]};}):[]};}):[]};}):[]:[]})[_0x2af9('0x12')](function(_0x1a6437){logger['info'](_0x2af9('0x23'),_0x550575);logger['debug'](_0x2af9('0x23'),_0x550575,JSON[_0x2af9('0x17')](_0x1a6437));_0x549ef3(_0x1a6437);})['catch'](function(_0x5ab357){logger[_0x2af9('0x18')](_0x2af9('0x23'),_0x5ab357['message'],_0x550575);_0x592ea5(_0x10df4f[_0x2af9('0x18')](0x1f4,_0x5ab357['message']));});});}; \ No newline at end of file +var _0x2f79=['SmsQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','findAll','options','raw','attributes','limit','model','include','map','then','GetSmsQueue','stringify','ShowSmsQueue','where','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','localhost','socket.io-emitter','redis','register','request','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x14883e,_0x21af3c){var _0x25b8f7=function(_0x3ab3e8){while(--_0x3ab3e8){_0x14883e['push'](_0x14883e['shift']());}};_0x25b8f7(++_0x21af3c);}(_0x2f79,0xe0));var _0x92f7=function(_0x307ef5,_0x5dbf62){_0x307ef5=_0x307ef5-0x0;var _0x378b98=_0x2f79[_0x307ef5];return _0x378b98;};'use strict';var _=require(_0x92f7('0x0'));var util=require(_0x92f7('0x1'));var moment=require(_0x92f7('0x2'));var BPromise=require('bluebird');var rs=require(_0x92f7('0x3'));var fs=require('fs');var Redis=require(_0x92f7('0x4'));var db=require(_0x92f7('0x5'))['db'];var utils=require(_0x92f7('0x6'));var logger=require(_0x92f7('0x7'))(_0x92f7('0x8'));var config=require(_0x92f7('0x9'));var jayson=require(_0x92f7('0xa'));var client=jayson[_0x92f7('0xb')][_0x92f7('0xc')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x92f7('0xd'),'port':0x18eb});var socket=require(_0x92f7('0xe'))(new Redis(config[_0x92f7('0xf')]));require('./smsQueue.socket')[_0x92f7('0x10')](socket);function respondWithRpcPromise(_0x5dd9c2,_0x3ce27b,_0x3f591f){return new BPromise(function(_0x4488c9,_0x50c4e8){return client[_0x92f7('0x11')](_0x5dd9c2,_0x3f591f)['then'](function(_0x377b87){logger[_0x92f7('0x12')](_0x92f7('0x13'),_0x3ce27b,_0x92f7('0x14'));logger[_0x92f7('0x15')](_0x92f7('0x16'),_0x3ce27b,_0x92f7('0x14'),JSON['stringify'](_0x377b87));if(_0x377b87[_0x92f7('0x17')]){if(_0x377b87['error'][_0x92f7('0x18')]===0x1f4){logger[_0x92f7('0x17')](_0x92f7('0x13'),_0x3ce27b,_0x377b87['error']['message']);return _0x50c4e8(_0x377b87[_0x92f7('0x17')][_0x92f7('0x19')]);}logger[_0x92f7('0x17')](_0x92f7('0x13'),_0x3ce27b,_0x377b87[_0x92f7('0x17')][_0x92f7('0x19')]);return _0x4488c9(_0x377b87[_0x92f7('0x17')][_0x92f7('0x19')]);}else{logger[_0x92f7('0x12')](_0x92f7('0x13'),_0x3ce27b,_0x92f7('0x14'));_0x4488c9(_0x377b87[_0x92f7('0x1a')][_0x92f7('0x19')]);}})[_0x92f7('0x1b')](function(_0x598fcf){logger[_0x92f7('0x17')](_0x92f7('0x13'),_0x3ce27b,_0x598fcf);_0x50c4e8(_0x598fcf);});});}exports['GetSmsQueue']=function(_0x1052bb){var _0x5a17ae=this;return new Promise(function(_0x3cf802,_0x19ef90){return db['SmsQueue'][_0x92f7('0x1c')]({'raw':_0x1052bb[_0x92f7('0x1d')]?_0x1052bb[_0x92f7('0x1d')][_0x92f7('0x1e')]===undefined?!![]:![]:!![],'where':_0x1052bb[_0x92f7('0x1d')]?_0x1052bb[_0x92f7('0x1d')]['where']||null:null,'attributes':_0x1052bb[_0x92f7('0x1d')]?_0x1052bb['options'][_0x92f7('0x1f')]||null:null,'limit':_0x1052bb['options']?_0x1052bb[_0x92f7('0x1d')][_0x92f7('0x20')]||null:null,'include':_0x1052bb[_0x92f7('0x1d')]?_0x1052bb[_0x92f7('0x1d')]['include']?_['map'](_0x1052bb[_0x92f7('0x1d')]['include'],function(_0x56e186){return{'model':db[_0x56e186[_0x92f7('0x21')]],'as':_0x56e186['as'],'attributes':_0x56e186[_0x92f7('0x1f')],'include':_0x56e186[_0x92f7('0x22')]?_[_0x92f7('0x23')](_0x56e186[_0x92f7('0x22')],function(_0x14a721){return{'model':db[_0x14a721[_0x92f7('0x21')]],'as':_0x14a721['as'],'attributes':_0x14a721[_0x92f7('0x1f')],'include':_0x14a721[_0x92f7('0x22')]?_['map'](_0x14a721['include'],function(_0x5927a3){return{'model':db[_0x5927a3[_0x92f7('0x21')]],'as':_0x5927a3['as'],'attributes':_0x5927a3[_0x92f7('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x92f7('0x24')](function(_0x422785){logger[_0x92f7('0x12')]('GetSmsQueue',_0x1052bb);logger[_0x92f7('0x15')](_0x92f7('0x25'),_0x1052bb,JSON[_0x92f7('0x26')](_0x422785));_0x3cf802(_0x422785);})[_0x92f7('0x1b')](function(_0x45bf57){logger[_0x92f7('0x17')](_0x92f7('0x25'),_0x45bf57[_0x92f7('0x19')],_0x1052bb);_0x19ef90(_0x5a17ae[_0x92f7('0x17')](0x1f4,_0x45bf57[_0x92f7('0x19')]));});});};exports[_0x92f7('0x27')]=function(_0x161d0b){var _0x4081e3=this;return new Promise(function(_0x176c33,_0x4fac8c){return db['SmsQueue']['find']({'raw':_0x161d0b[_0x92f7('0x1d')]?_0x161d0b[_0x92f7('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x161d0b[_0x92f7('0x1d')]?_0x161d0b[_0x92f7('0x1d')][_0x92f7('0x28')]||null:null,'attributes':_0x161d0b[_0x92f7('0x1d')]?_0x161d0b[_0x92f7('0x1d')][_0x92f7('0x1f')]||null:null,'include':_0x161d0b[_0x92f7('0x1d')]?_0x161d0b[_0x92f7('0x1d')]['include']?_[_0x92f7('0x23')](_0x161d0b[_0x92f7('0x1d')][_0x92f7('0x22')],function(_0x322de7){return{'model':db[_0x322de7[_0x92f7('0x21')]],'as':_0x322de7['as'],'attributes':_0x322de7[_0x92f7('0x1f')],'include':_0x322de7[_0x92f7('0x22')]?_['map'](_0x322de7[_0x92f7('0x22')],function(_0x44ead3){return{'model':db[_0x44ead3[_0x92f7('0x21')]],'as':_0x44ead3['as'],'attributes':_0x44ead3[_0x92f7('0x1f')],'include':_0x44ead3[_0x92f7('0x22')]?_[_0x92f7('0x23')](_0x44ead3[_0x92f7('0x22')],function(_0x41c663){return{'model':db[_0x41c663[_0x92f7('0x21')]],'as':_0x41c663['as'],'attributes':_0x41c663[_0x92f7('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x92f7('0x24')](function(_0x13335b){logger[_0x92f7('0x12')]('ShowSmsQueue',_0x161d0b);logger[_0x92f7('0x15')](_0x92f7('0x27'),_0x161d0b,JSON[_0x92f7('0x26')](_0x13335b));_0x176c33(_0x13335b);})[_0x92f7('0x1b')](function(_0x57750e){logger[_0x92f7('0x17')](_0x92f7('0x27'),_0x57750e[_0x92f7('0x19')],_0x161d0b);_0x4fac8c(_0x4081e3['error'](0x1f4,_0x57750e['message']));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index f757f55..b6eed87 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 _0x99aa=['register','length','./smsQueue.events','remove','update','emit','removeListener'];(function(_0x4bea9f,_0x4b6d15){var _0x56afa2=function(_0x560108){while(--_0x560108){_0x4bea9f['push'](_0x4bea9f['shift']());}};_0x56afa2(++_0x4b6d15);}(_0x99aa,0x64));var _0xa99a=function(_0x68108e,_0x9cfc45){_0x68108e=_0x68108e-0x0;var _0x4c770a=_0x99aa[_0x68108e];return _0x4c770a;};'use strict';var SmsQueueEvents=require(_0xa99a('0x0'));var events=['save',_0xa99a('0x1'),_0xa99a('0x2')];function createListener(_0x2e9944,_0x13ff2b){return function(_0x450cab){_0x13ff2b[_0xa99a('0x3')](_0x2e9944,_0x450cab);};}function removeListener(_0x1baf06,_0x43953f){return function(){SmsQueueEvents[_0xa99a('0x4')](_0x1baf06,_0x43953f);};}exports[_0xa99a('0x5')]=function(_0x33b6ea){for(var _0x4de474=0x0,_0x26ba1d=events[_0xa99a('0x6')];_0x4de474<_0x26ba1d;_0x4de474++){var _0x3af48a=events[_0x4de474];var _0x38517f=createListener('smsQueue:'+_0x3af48a,_0x33b6ea);SmsQueueEvents['on'](_0x3af48a,_0x38517f);}}; \ No newline at end of file +var _0x978a=['save','removeListener','register','length'];(function(_0x1af98d,_0x3c608e){var _0x3553ea=function(_0x5668a4){while(--_0x5668a4){_0x1af98d['push'](_0x1af98d['shift']());}};_0x3553ea(++_0x3c608e);}(_0x978a,0x80));var _0xa978=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x978a[_0x3dd15e];return _0x231fd0;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0xa978('0x0'),'remove','update'];function createListener(_0x18d8d5,_0x16f69c){return function(_0x2bc7e5){_0x16f69c['emit'](_0x18d8d5,_0x2bc7e5);};}function removeListener(_0x112320,_0x235f3f){return function(){SmsQueueEvents[_0xa978('0x1')](_0x112320,_0x235f3f);};}exports[_0xa978('0x2')]=function(_0x330bd4){for(var _0x1de11e=0x0,_0x3716fb=events[_0xa978('0x3')];_0x1de11e<_0x3716fb;_0x1de11e++){var _0x5eff7b=events[_0x1de11e];var _0x1bccfa=createListener('smsQueue:'+_0x5eff7b,_0x330bd4);SmsQueueEvents['on'](_0x5eff7b,_0x1bccfa);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 4d78752..e785ccb 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 _0x5ce1=['update','delete','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','index','/describe','/:id','isAuthenticated','post','create'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5ce1,0xd4));var _0x15ce=function(_0x219b00,_0x236fdc){_0x219b00=_0x219b00-0x0;var _0x4ea221=_0x5ce1[_0x219b00];return _0x4ea221;};'use strict';var multer=require('multer');var util=require(_0x15ce('0x0'));var path=require(_0x15ce('0x1'));var timeout=require(_0x15ce('0x2'));var express=require('express');var router=express[_0x15ce('0x3')]();var fs_extra=require(_0x15ce('0x4'));var auth=require(_0x15ce('0x5'));var interaction=require(_0x15ce('0x6'));var config=require(_0x15ce('0x7'));var controller=require(_0x15ce('0x8'));router[_0x15ce('0x9')]('/',auth['isAuthenticated'](),controller[_0x15ce('0xa')]);router[_0x15ce('0x9')](_0x15ce('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x15ce('0x9')](_0x15ce('0xc'),auth[_0x15ce('0xd')](),controller['show']);router[_0x15ce('0xe')]('/',auth[_0x15ce('0xd')](),controller[_0x15ce('0xf')]);router['put'](_0x15ce('0xc'),auth['isAuthenticated'](),controller[_0x15ce('0x10')]);router[_0x15ce('0x11')](_0x15ce('0xc'),auth[_0x15ce('0xd')](),controller['destroy']);module[_0x15ce('0x12')]=router; \ No newline at end of file +var _0x891b=['show','post','put','update','delete','destroy','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsQueueReport.controller','get','index','describe','/:id','isAuthenticated'];(function(_0x522d99,_0x3f19c0){var _0x323c13=function(_0x3e9ddf){while(--_0x3e9ddf){_0x522d99['push'](_0x522d99['shift']());}};_0x323c13(++_0x3f19c0);}(_0x891b,0xc5));var _0xb891=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x891b[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb891('0x0'));var timeout=require(_0xb891('0x1'));var express=require('express');var router=express[_0xb891('0x2')]();var fs_extra=require(_0xb891('0x3'));var auth=require(_0xb891('0x4'));var interaction=require(_0xb891('0x5'));var config=require('../../config/environment');var controller=require(_0xb891('0x6'));router[_0xb891('0x7')]('/',auth['isAuthenticated'](),controller[_0xb891('0x8')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xb891('0x9')]);router[_0xb891('0x7')](_0xb891('0xa'),auth[_0xb891('0xb')](),controller[_0xb891('0xc')]);router[_0xb891('0xd')]('/',auth[_0xb891('0xb')](),controller['create']);router[_0xb891('0xe')](_0xb891('0xa'),auth[_0xb891('0xb')](),controller[_0xb891('0xf')]);router[_0xb891('0x10')](_0xb891('0xa'),auth[_0xb891('0xb')](),controller[_0xb891('0x11')]);module[_0xb891('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 21ecfdc..6dc7059 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 _0x343e=['STRING','DATE','moment','exports'];(function(_0x91ed5c,_0xdb6b34){var _0x2387d8=function(_0x1a9d15){while(--_0x1a9d15){_0x91ed5c['push'](_0x91ed5c['shift']());}};_0x2387d8(++_0xdb6b34);}(_0x343e,0x9a));var _0xe343=function(_0x1efdb3,_0x3964fe){_0x1efdb3=_0x1efdb3-0x0;var _0x465d8f=_0x343e[_0x1efdb3];return _0x465d8f;};'use strict';var moment=require(_0xe343('0x0'));var Sequelize=require('sequelize');module[_0xe343('0x1')]={'uniqueid':{'type':Sequelize[_0xe343('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xe343('0x2')]},'joinAt':{'type':Sequelize[_0xe343('0x3')]},'leaveAt':{'type':Sequelize[_0xe343('0x3')]},'acceptAt':{'type':Sequelize[_0xe343('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4534=['DATE','moment','sequelize','exports','STRING'];(function(_0x3e0191,_0x1d4b20){var _0xf2ae83=function(_0x277210){while(--_0x277210){_0x3e0191['push'](_0x3e0191['shift']());}};_0xf2ae83(++_0x1d4b20);}(_0x4534,0x141));var _0x4453=function(_0x1d54e1,_0x5ea0e4){_0x1d54e1=_0x1d54e1-0x0;var _0x2add35=_0x4534[_0x1d54e1];return _0x2add35;};'use strict';var moment=require(_0x4453('0x0'));var Sequelize=require(_0x4453('0x1'));module[_0x4453('0x2')]={'uniqueid':{'type':Sequelize[_0x4453('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x4453('0x4')]},'leaveAt':{'type':Sequelize[_0x4453('0x4')]},'acceptAt':{'type':Sequelize[_0x4453('0x4')]},'exitAt':{'type':Sequelize[_0x4453('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index e927b82..0a7ce99 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 _0xf837=['length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','include','findAll','rows','params','create','catch','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','apply','reject','save','update','then','end','sendStatus','error','name','send','index','map','SmsQueueReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf837,0x1d1));var _0x7f83=function(_0x39c778,_0x4328f3){_0x39c778=_0x39c778-0x0;var _0x32301d=_0xf837[_0x39c778];return _0x32301d;};'use strict';var emlformat=require(_0x7f83('0x0'));var rimraf=require(_0x7f83('0x1'));var zipdir=require(_0x7f83('0x2'));var jsonpatch=require(_0x7f83('0x3'));var rp=require(_0x7f83('0x4'));var moment=require(_0x7f83('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7f83('0x6'));var path=require(_0x7f83('0x7'));var sox=require('sox');var csv=require(_0x7f83('0x8'));var ejs=require(_0x7f83('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7f83('0xa'));var squel=require(_0x7f83('0xb'));var crypto=require('crypto');var jsforce=require(_0x7f83('0xc'));var deskjs=require(_0x7f83('0xd'));var toCsv=require(_0x7f83('0x8'));var querystring=require(_0x7f83('0xe'));var Papa=require(_0x7f83('0xf'));var Redis=require('ioredis');var authService=require(_0x7f83('0x10'));var qs=require(_0x7f83('0x11'));var as=require(_0x7f83('0x12'));var hardwareService=require(_0x7f83('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x7f83('0x14'));var config=require(_0x7f83('0x15'));var licenseUtil=require(_0x7f83('0x16'));var db=require(_0x7f83('0x17'))['db'];function respondWithStatusCode(_0xce771d,_0x68dd5b){_0x68dd5b=_0x68dd5b||0xcc;return function(_0xd7378a){if(_0xd7378a){return _0xce771d['sendStatus'](_0x68dd5b);}return _0xce771d[_0x7f83('0x18')](_0x68dd5b)['end']();};}function respondWithResult(_0x3a013e,_0x16ab17){_0x16ab17=_0x16ab17||0xc8;return function(_0x2f3a0d){if(_0x2f3a0d){return _0x3a013e[_0x7f83('0x18')](_0x16ab17)[_0x7f83('0x19')](_0x2f3a0d);}};}function respondWithFilteredResult(_0x39e275,_0x3c6bc7){return function(_0x15da46){if(_0x15da46){var _0x3c377b=typeof _0x3c6bc7[_0x7f83('0x1a')]===_0x7f83('0x1b')&&typeof _0x3c6bc7[_0x7f83('0x1c')]===_0x7f83('0x1b');var _0x48c0f6=_0x15da46[_0x7f83('0x1d')];var _0x487232=_0x3c377b?0x0:_0x3c6bc7['offset'];var _0x476a70=_0x3c377b?_0x15da46['count']:_0x3c6bc7[_0x7f83('0x1a')]+_0x3c6bc7[_0x7f83('0x1c')];var _0xdc029;if(_0x476a70>=_0x48c0f6){_0x476a70=_0x48c0f6;_0xdc029=0xc8;}else{_0xdc029=0xce;}_0x39e275[_0x7f83('0x18')](_0xdc029);return _0x39e275['set']('Content-Range',_0x487232+'-'+_0x476a70+'/'+_0x48c0f6)[_0x7f83('0x19')](_0x15da46);}return null;};}function patchUpdates(_0x15f1b8){return function(_0x2d45f5){try{jsonpatch[_0x7f83('0x1e')](_0x2d45f5,_0x15f1b8,!![]);}catch(_0xa5155){return BPromise[_0x7f83('0x1f')](_0xa5155);}return _0x2d45f5[_0x7f83('0x20')]();};}function saveUpdates(_0x632f5c,_0x22efba){return function(_0x233a63){if(_0x233a63){return _0x233a63[_0x7f83('0x21')](_0x632f5c)[_0x7f83('0x22')](function(_0x27de70){return _0x27de70;});}return null;};}function removeEntity(_0x213578,_0x37e199){return function(_0x49acdd){if(_0x49acdd){return _0x49acdd['destroy']()[_0x7f83('0x22')](function(){_0x213578['status'](0xcc)[_0x7f83('0x23')]();});}};}function handleEntityNotFound(_0x231037,_0x3c9720){return function(_0x23b3a3){if(!_0x23b3a3){_0x231037[_0x7f83('0x24')](0x194);}return _0x23b3a3;};}function handleError(_0x21e4de,_0x39fabc){_0x39fabc=_0x39fabc||0x1f4;return function(_0xac865e){logger[_0x7f83('0x25')](_0xac865e['stack']);if(_0xac865e[_0x7f83('0x26')]){delete _0xac865e[_0x7f83('0x26')];}_0x21e4de[_0x7f83('0x18')](_0x39fabc)[_0x7f83('0x27')](_0xac865e);};}exports[_0x7f83('0x28')]=function(_0x4eea77,_0x357ce0){var _0x30b212={},_0x4f9542={},_0x565b11={'count':0x0,'rows':[]};var _0x46cda4=_[_0x7f83('0x29')](db[_0x7f83('0x2a')][_0x7f83('0x2b')],function(_0x5cb83d){return{'name':_0x5cb83d[_0x7f83('0x2c')],'type':_0x5cb83d[_0x7f83('0x2d')][_0x7f83('0x2e')]};});_0x4f9542[_0x7f83('0x2f')]=_[_0x7f83('0x29')](_0x46cda4,_0x7f83('0x26'));_0x4f9542[_0x7f83('0x30')]=_[_0x7f83('0x31')](_0x4eea77[_0x7f83('0x30')]);_0x4f9542['filters']=_[_0x7f83('0x32')](_0x4f9542['model'],_0x4f9542[_0x7f83('0x30')]);_0x30b212['attributes']=_['intersection'](_0x4f9542[_0x7f83('0x2f')],qs[_0x7f83('0x33')](_0x4eea77[_0x7f83('0x30')]['fields']));_0x30b212[_0x7f83('0x34')]=_0x30b212[_0x7f83('0x34')][_0x7f83('0x35')]?_0x30b212['attributes']:_0x4f9542[_0x7f83('0x2f')];if(!_0x4eea77['query'][_0x7f83('0x36')](_0x7f83('0x37'))){_0x30b212[_0x7f83('0x1c')]=qs[_0x7f83('0x1c')](_0x4eea77[_0x7f83('0x30')]['limit']);_0x30b212[_0x7f83('0x1a')]=qs[_0x7f83('0x1a')](_0x4eea77['query'][_0x7f83('0x1a')]);}_0x30b212[_0x7f83('0x38')]=qs[_0x7f83('0x39')](_0x4eea77[_0x7f83('0x30')][_0x7f83('0x39')]);_0x30b212[_0x7f83('0x3a')]=qs[_0x7f83('0x3b')](_[_0x7f83('0x3c')](_0x4eea77[_0x7f83('0x30')],_0x4f9542[_0x7f83('0x3b')]),_0x46cda4);if(_0x4eea77[_0x7f83('0x30')][_0x7f83('0x3d')]){_0x30b212[_0x7f83('0x3a')]=_['merge'](_0x30b212['where'],{'$or':_[_0x7f83('0x29')](_0x46cda4,function(_0x21d290){if(_0x21d290[_0x7f83('0x2d')]!=='VIRTUAL'){var _0x273f65={};_0x273f65[_0x21d290[_0x7f83('0x26')]]={'$like':'%'+_0x4eea77[_0x7f83('0x30')][_0x7f83('0x3d')]+'%'};return _0x273f65;}})});}_0x30b212=_[_0x7f83('0x3e')]({},_0x30b212,_0x4eea77[_0x7f83('0x3f')]);var _0xe13b61={'where':_0x30b212[_0x7f83('0x3a')]};return db[_0x7f83('0x2a')][_0x7f83('0x1d')](_0xe13b61)['then'](function(_0x1c31a2){_0x565b11['count']=_0x1c31a2;if(_0x4eea77[_0x7f83('0x30')]['includeAll']){_0x30b212[_0x7f83('0x40')]=[{'all':!![]}];}return db[_0x7f83('0x2a')][_0x7f83('0x41')](_0x30b212);})['then'](function(_0x4c6fb6){_0x565b11[_0x7f83('0x42')]=_0x4c6fb6;return _0x565b11;})['then'](respondWithFilteredResult(_0x357ce0,_0x30b212))['catch'](handleError(_0x357ce0,null));};exports['show']=function(_0x402f6d,_0x53cb35){var _0x115a00={'raw':!![],'where':{'id':_0x402f6d[_0x7f83('0x43')]['id']}},_0x5b13e1={};_0x5b13e1['model']=_['keys'](db[_0x7f83('0x2a')][_0x7f83('0x2b')]);_0x5b13e1[_0x7f83('0x30')]=_[_0x7f83('0x31')](_0x402f6d[_0x7f83('0x30')]);_0x5b13e1['filters']=_['intersection'](_0x5b13e1[_0x7f83('0x2f')],_0x5b13e1[_0x7f83('0x30')]);_0x115a00[_0x7f83('0x34')]=_[_0x7f83('0x32')](_0x5b13e1[_0x7f83('0x2f')],qs[_0x7f83('0x33')](_0x402f6d[_0x7f83('0x30')][_0x7f83('0x33')]));_0x115a00[_0x7f83('0x34')]=_0x115a00[_0x7f83('0x34')][_0x7f83('0x35')]?_0x115a00[_0x7f83('0x34')]:_0x5b13e1[_0x7f83('0x2f')];if(_0x402f6d['query']['includeAll']){_0x115a00[_0x7f83('0x40')]=[{'all':!![]}];}_0x115a00=_[_0x7f83('0x3e')]({},_0x115a00,_0x402f6d[_0x7f83('0x3f')]);return db[_0x7f83('0x2a')]['find'](_0x115a00)[_0x7f83('0x22')](handleEntityNotFound(_0x53cb35,null))['then'](respondWithResult(_0x53cb35,null))['catch'](handleError(_0x53cb35,null));};exports[_0x7f83('0x44')]=function(_0x343406,_0x5e53c6){return db[_0x7f83('0x2a')][_0x7f83('0x44')](_0x343406['body'],{})[_0x7f83('0x22')](respondWithResult(_0x5e53c6,0xc9))[_0x7f83('0x45')](handleError(_0x5e53c6,null));};exports['update']=function(_0x44b648,_0x1976d5){if(_0x44b648[_0x7f83('0x46')]['id']){delete _0x44b648[_0x7f83('0x46')]['id'];}return db['SmsQueueReport'][_0x7f83('0x47')]({'where':{'id':_0x44b648[_0x7f83('0x43')]['id']}})[_0x7f83('0x22')](handleEntityNotFound(_0x1976d5,null))[_0x7f83('0x22')](saveUpdates(_0x44b648[_0x7f83('0x46')],null))[_0x7f83('0x22')](respondWithResult(_0x1976d5,null))[_0x7f83('0x45')](handleError(_0x1976d5,null));};exports[_0x7f83('0x48')]=function(_0x5a80e9,_0x3aa916){return db['SmsQueueReport'][_0x7f83('0x47')]({'where':{'id':_0x5a80e9[_0x7f83('0x43')]['id']}})['then'](handleEntityNotFound(_0x3aa916,null))['then'](removeEntity(_0x3aa916,null))[_0x7f83('0x45')](handleError(_0x3aa916,null));};exports[_0x7f83('0x49')]=function(_0x441d28,_0x30fac3){return db['SmsQueueReport'][_0x7f83('0x49')]()['then'](respondWithResult(_0x30fac3,null))['catch'](handleError(_0x30fac3,null));}; \ No newline at end of file +var _0x0ee0=['sort','pick','filter','where','merge','VIRTUAL','SmsQueueReport','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','eml-format','zip-dir','moment','bluebird','mustache','path','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order'];(function(_0x191154,_0x56f74c){var _0x3dcd73=function(_0x51c321){while(--_0x51c321){_0x191154['push'](_0x191154['shift']());}};_0x3dcd73(++_0x56f74c);}(_0x0ee0,0x1b6));var _0x00ee=function(_0x517cba,_0xf0be72){_0x517cba=_0x517cba-0x0;var _0x4ecca7=_0x0ee0[_0x517cba];return _0x4ecca7;};'use strict';var emlformat=require(_0x00ee('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x00ee('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x00ee('0x2'));var BPromise=require(_0x00ee('0x3'));var Mustache=require(_0x00ee('0x4'));var util=require('util');var path=require(_0x00ee('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x00ee('0x6'));var fs=require('fs');var fs_extra=require(_0x00ee('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x00ee('0x8'));var jsforce=require(_0x00ee('0x9'));var deskjs=require(_0x00ee('0xa'));var toCsv=require(_0x00ee('0xb'));var querystring=require(_0x00ee('0xc'));var Papa=require('papaparse');var Redis=require(_0x00ee('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x00ee('0xe'));var as=require(_0x00ee('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x00ee('0x10'))(_0x00ee('0x11'));var utils=require(_0x00ee('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x00ee('0x13'));var db=require(_0x00ee('0x14'))['db'];function respondWithStatusCode(_0x128627,_0x2c86b8){_0x2c86b8=_0x2c86b8||0xcc;return function(_0x3caa69){if(_0x3caa69){return _0x128627[_0x00ee('0x15')](_0x2c86b8);}return _0x128627[_0x00ee('0x16')](_0x2c86b8)[_0x00ee('0x17')]();};}function respondWithResult(_0x5c64d7,_0x1cd271){_0x1cd271=_0x1cd271||0xc8;return function(_0x596ee9){if(_0x596ee9){return _0x5c64d7[_0x00ee('0x16')](_0x1cd271)[_0x00ee('0x18')](_0x596ee9);}};}function respondWithFilteredResult(_0x1329d6,_0x50a478){return function(_0x247a91){if(_0x247a91){var _0x33e1fc=typeof _0x50a478[_0x00ee('0x19')]===_0x00ee('0x1a')&&typeof _0x50a478[_0x00ee('0x1b')]==='undefined';var _0x4cd656=_0x247a91[_0x00ee('0x1c')];var _0x18540b=_0x33e1fc?0x0:_0x50a478[_0x00ee('0x19')];var _0x1f7dfd=_0x33e1fc?_0x247a91['count']:_0x50a478[_0x00ee('0x19')]+_0x50a478[_0x00ee('0x1b')];var _0x56bac4;if(_0x1f7dfd>=_0x4cd656){_0x1f7dfd=_0x4cd656;_0x56bac4=0xc8;}else{_0x56bac4=0xce;}_0x1329d6[_0x00ee('0x16')](_0x56bac4);return _0x1329d6['set']('Content-Range',_0x18540b+'-'+_0x1f7dfd+'/'+_0x4cd656)[_0x00ee('0x18')](_0x247a91);}return null;};}function patchUpdates(_0x14981d){return function(_0x4554bf){try{jsonpatch['apply'](_0x4554bf,_0x14981d,!![]);}catch(_0x49819e){return BPromise[_0x00ee('0x1d')](_0x49819e);}return _0x4554bf[_0x00ee('0x1e')]();};}function saveUpdates(_0x1c0275,_0x10ce6d){return function(_0x28ba96){if(_0x28ba96){return _0x28ba96[_0x00ee('0x1f')](_0x1c0275)[_0x00ee('0x20')](function(_0xa4b25f){return _0xa4b25f;});}return null;};}function removeEntity(_0x15388a,_0x59d951){return function(_0x46f98b){if(_0x46f98b){return _0x46f98b[_0x00ee('0x21')]()['then'](function(){_0x15388a['status'](0xcc)[_0x00ee('0x17')]();});}};}function handleEntityNotFound(_0x38102b,_0x1a8e49){return function(_0xf6e238){if(!_0xf6e238){_0x38102b['sendStatus'](0x194);}return _0xf6e238;};}function handleError(_0x455f51,_0x551fb0){_0x551fb0=_0x551fb0||0x1f4;return function(_0x4081e1){logger[_0x00ee('0x22')](_0x4081e1[_0x00ee('0x23')]);if(_0x4081e1[_0x00ee('0x24')]){delete _0x4081e1[_0x00ee('0x24')];}_0x455f51[_0x00ee('0x16')](_0x551fb0)[_0x00ee('0x25')](_0x4081e1);};}exports['index']=function(_0xa4ea0b,_0x4c9abf){var _0x2d0868={},_0x165339={},_0x5064ae={'count':0x0,'rows':[]};var _0x41ee04=_[_0x00ee('0x26')](db['SmsQueueReport'][_0x00ee('0x27')],function(_0x3120b8){return{'name':_0x3120b8[_0x00ee('0x28')],'type':_0x3120b8[_0x00ee('0x29')]['key']};});_0x165339[_0x00ee('0x2a')]=_[_0x00ee('0x26')](_0x41ee04,_0x00ee('0x24'));_0x165339[_0x00ee('0x2b')]=_[_0x00ee('0x2c')](_0xa4ea0b[_0x00ee('0x2b')]);_0x165339[_0x00ee('0x2d')]=_[_0x00ee('0x2e')](_0x165339['model'],_0x165339['query']);_0x2d0868[_0x00ee('0x2f')]=_['intersection'](_0x165339[_0x00ee('0x2a')],qs[_0x00ee('0x30')](_0xa4ea0b[_0x00ee('0x2b')][_0x00ee('0x30')]));_0x2d0868['attributes']=_0x2d0868[_0x00ee('0x2f')][_0x00ee('0x31')]?_0x2d0868[_0x00ee('0x2f')]:_0x165339[_0x00ee('0x2a')];if(!_0xa4ea0b[_0x00ee('0x2b')]['hasOwnProperty'](_0x00ee('0x32'))){_0x2d0868['limit']=qs[_0x00ee('0x1b')](_0xa4ea0b[_0x00ee('0x2b')][_0x00ee('0x1b')]);_0x2d0868[_0x00ee('0x19')]=qs[_0x00ee('0x19')](_0xa4ea0b[_0x00ee('0x2b')][_0x00ee('0x19')]);}_0x2d0868[_0x00ee('0x33')]=qs[_0x00ee('0x34')](_0xa4ea0b[_0x00ee('0x2b')][_0x00ee('0x34')]);_0x2d0868['where']=qs[_0x00ee('0x2d')](_[_0x00ee('0x35')](_0xa4ea0b[_0x00ee('0x2b')],_0x165339['filters']),_0x41ee04);if(_0xa4ea0b['query'][_0x00ee('0x36')]){_0x2d0868[_0x00ee('0x37')]=_[_0x00ee('0x38')](_0x2d0868[_0x00ee('0x37')],{'$or':_['map'](_0x41ee04,function(_0x57ee5a){if(_0x57ee5a[_0x00ee('0x29')]!==_0x00ee('0x39')){var _0x2c098a={};_0x2c098a[_0x57ee5a['name']]={'$like':'%'+_0xa4ea0b['query'][_0x00ee('0x36')]+'%'};return _0x2c098a;}})});}_0x2d0868=_[_0x00ee('0x38')]({},_0x2d0868,_0xa4ea0b['options']);var _0x38fdd1={'where':_0x2d0868[_0x00ee('0x37')]};return db[_0x00ee('0x3a')][_0x00ee('0x1c')](_0x38fdd1)['then'](function(_0x2c9aa9){_0x5064ae[_0x00ee('0x1c')]=_0x2c9aa9;if(_0xa4ea0b[_0x00ee('0x2b')][_0x00ee('0x3b')]){_0x2d0868[_0x00ee('0x3c')]=[{'all':!![]}];}return db[_0x00ee('0x3a')][_0x00ee('0x3d')](_0x2d0868);})[_0x00ee('0x20')](function(_0x37a4d4){_0x5064ae[_0x00ee('0x3e')]=_0x37a4d4;return _0x5064ae;})[_0x00ee('0x20')](respondWithFilteredResult(_0x4c9abf,_0x2d0868))[_0x00ee('0x3f')](handleError(_0x4c9abf,null));};exports[_0x00ee('0x40')]=function(_0x84e7f9,_0x3910a8){var _0x278764={'raw':!![],'where':{'id':_0x84e7f9['params']['id']}},_0x1d5f0d={};_0x1d5f0d[_0x00ee('0x2a')]=_[_0x00ee('0x2c')](db[_0x00ee('0x3a')][_0x00ee('0x27')]);_0x1d5f0d['query']=_[_0x00ee('0x2c')](_0x84e7f9[_0x00ee('0x2b')]);_0x1d5f0d[_0x00ee('0x2d')]=_[_0x00ee('0x2e')](_0x1d5f0d[_0x00ee('0x2a')],_0x1d5f0d['query']);_0x278764[_0x00ee('0x2f')]=_['intersection'](_0x1d5f0d[_0x00ee('0x2a')],qs[_0x00ee('0x30')](_0x84e7f9[_0x00ee('0x2b')]['fields']));_0x278764[_0x00ee('0x2f')]=_0x278764[_0x00ee('0x2f')]['length']?_0x278764[_0x00ee('0x2f')]:_0x1d5f0d['model'];if(_0x84e7f9[_0x00ee('0x2b')]['includeAll']){_0x278764['include']=[{'all':!![]}];}_0x278764=_[_0x00ee('0x38')]({},_0x278764,_0x84e7f9['options']);return db[_0x00ee('0x3a')][_0x00ee('0x41')](_0x278764)[_0x00ee('0x20')](handleEntityNotFound(_0x3910a8,null))[_0x00ee('0x20')](respondWithResult(_0x3910a8,null))['catch'](handleError(_0x3910a8,null));};exports[_0x00ee('0x42')]=function(_0x5303bf,_0x30517d){return db[_0x00ee('0x3a')]['create'](_0x5303bf[_0x00ee('0x43')],{})[_0x00ee('0x20')](respondWithResult(_0x30517d,0xc9))[_0x00ee('0x3f')](handleError(_0x30517d,null));};exports[_0x00ee('0x1f')]=function(_0x52e6ba,_0x2e211b){if(_0x52e6ba[_0x00ee('0x43')]['id']){delete _0x52e6ba[_0x00ee('0x43')]['id'];}return db[_0x00ee('0x3a')][_0x00ee('0x41')]({'where':{'id':_0x52e6ba[_0x00ee('0x44')]['id']}})[_0x00ee('0x20')](handleEntityNotFound(_0x2e211b,null))['then'](saveUpdates(_0x52e6ba[_0x00ee('0x43')],null))[_0x00ee('0x20')](respondWithResult(_0x2e211b,null))[_0x00ee('0x3f')](handleError(_0x2e211b,null));};exports[_0x00ee('0x21')]=function(_0x4e987f,_0x4e1f52){return db[_0x00ee('0x3a')]['find']({'where':{'id':_0x4e987f['params']['id']}})[_0x00ee('0x20')](handleEntityNotFound(_0x4e1f52,null))[_0x00ee('0x20')](removeEntity(_0x4e1f52,null))[_0x00ee('0x3f')](handleError(_0x4e1f52,null));};exports[_0x00ee('0x45')]=function(_0x120f09,_0x461afc){return db[_0x00ee('0x3a')]['describe']()[_0x00ee('0x20')](respondWithResult(_0x461afc,null))['catch'](handleError(_0x461afc,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index b958621..b4b8e58 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 _0xcb91=['path','rimraf','./smsQueueReport.attributes','exports','define','report_sms_queue','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x5c950c,_0x475951){var _0x34c645=function(_0x5427b5){while(--_0x5427b5){_0x5c950c['push'](_0x5c950c['shift']());}};_0x34c645(++_0x475951);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0xcb91[_0x18ab2a];return _0x16dcee;};'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 +var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util'];(function(_0x1aa13e,_0x12a40b){var _0x1144bd=function(_0x5f5cae){while(--_0x5f5cae){_0x1aa13e['push'](_0x1aa13e['shift']());}};_0x1144bd(++_0x12a40b);}(_0xe706,0xa3));var _0x6e70=function(_0x3318c3,_0x35066){_0x3318c3=_0x3318c3-0x0;var _0x15c002=_0xe706[_0x3318c3];return _0x15c002;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index c90024d..5875377 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 _0xfffc=['update','where','limit','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','SmsQueueReport,\x20%s,\x20%s','message','result','catch','SmsQueueReport','body','options','raw','then','CreateSmsQueueReport','UpdateSmsQueueReport'];(function(_0x55c121,_0x18ffa8){var _0x197d07=function(_0x1600a2){while(--_0x1600a2){_0x55c121['push'](_0x55c121['shift']());}};_0x197d07(++_0x18ffa8);}(_0xfffc,0x1d4));var _0xcfff=function(_0x499ea4,_0x254251){_0x499ea4=_0x499ea4-0x0;var _0x154ea3=_0xfffc[_0x499ea4];return _0x154ea3;};'use strict';var _=require('lodash');var util=require(_0xcfff('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcfff('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcfff('0x2'))['db'];var utils=require(_0xcfff('0x3'));var logger=require(_0xcfff('0x4'))(_0xcfff('0x5'));var config=require(_0xcfff('0x6'));var jayson=require(_0xcfff('0x7'));var client=jayson[_0xcfff('0x8')][_0xcfff('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2cc189,_0x5c3caa,_0x592484){return new BPromise(function(_0x43a909,_0x3fc907){return client[_0xcfff('0xa')](_0x2cc189,_0x592484)['then'](function(_0x357289){logger[_0xcfff('0xb')]('SmsQueueReport,\x20%s,\x20%s',_0x5c3caa,'request\x20sent');logger[_0xcfff('0xc')](_0xcfff('0xd'),_0x5c3caa,_0xcfff('0xe'),JSON[_0xcfff('0xf')](_0x357289));if(_0x357289[_0xcfff('0x10')]){if(_0x357289[_0xcfff('0x10')]['code']===0x1f4){logger[_0xcfff('0x10')](_0xcfff('0x11'),_0x5c3caa,_0x357289['error'][_0xcfff('0x12')]);return _0x3fc907(_0x357289[_0xcfff('0x10')][_0xcfff('0x12')]);}logger[_0xcfff('0x10')]('SmsQueueReport,\x20%s,\x20%s',_0x5c3caa,_0x357289['error'][_0xcfff('0x12')]);return _0x43a909(_0x357289[_0xcfff('0x10')][_0xcfff('0x12')]);}else{logger[_0xcfff('0xb')](_0xcfff('0x11'),_0x5c3caa,_0xcfff('0xe'));_0x43a909(_0x357289[_0xcfff('0x13')][_0xcfff('0x12')]);}})[_0xcfff('0x14')](function(_0x1a054d){logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x5c3caa,_0x1a054d);_0x3fc907(_0x1a054d);});});}exports['CreateSmsQueueReport']=function(_0x4b6f87){var _0x37d09a=this;return new Promise(function(_0x3338b7,_0x364d27){return db[_0xcfff('0x15')]['create'](_0x4b6f87[_0xcfff('0x16')],{'raw':_0x4b6f87[_0xcfff('0x17')]?_0x4b6f87[_0xcfff('0x17')][_0xcfff('0x18')]===undefined?!![]:![]:!![]})[_0xcfff('0x19')](function(_0x5ddd0d){logger[_0xcfff('0xb')](_0xcfff('0x1a'),_0x4b6f87);logger[_0xcfff('0xc')]('CreateSmsQueueReport',_0x4b6f87,JSON['stringify'](_0x5ddd0d));_0x3338b7(_0x5ddd0d);})[_0xcfff('0x14')](function(_0x58220c){logger[_0xcfff('0x10')](_0xcfff('0x1a'),_0x58220c['message'],_0x4b6f87);_0x364d27(_0x37d09a[_0xcfff('0x10')](0x1f4,_0x58220c['message']));});});};exports[_0xcfff('0x1b')]=function(_0x47245a){var _0x1efd4a=this;return new Promise(function(_0x44b07f,_0x30fad3){return db['SmsQueueReport'][_0xcfff('0x1c')](_0x47245a[_0xcfff('0x16')],{'raw':_0x47245a[_0xcfff('0x17')]?_0x47245a[_0xcfff('0x17')][_0xcfff('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x47245a[_0xcfff('0x17')]?_0x47245a[_0xcfff('0x17')][_0xcfff('0x1d')]||null:null,'attributes':_0x47245a['options']?_0x47245a[_0xcfff('0x17')]['attributes']||null:null,'limit':_0x47245a[_0xcfff('0x17')]?_0x47245a[_0xcfff('0x17')][_0xcfff('0x1e')]||null:null})[_0xcfff('0x19')](function(_0x2032d5){logger['info'](_0xcfff('0x1b'),_0x47245a);logger[_0xcfff('0xc')](_0xcfff('0x1b'),_0x47245a,JSON[_0xcfff('0xf')](_0x2032d5));_0x44b07f(_0x2032d5);})['catch'](function(_0x331d4d){logger[_0xcfff('0x10')](_0xcfff('0x1b'),_0x331d4d[_0xcfff('0x12')],_0x47245a);_0x30fad3(_0x1efd4a[_0xcfff('0x10')](0x1f4,_0x331d4d['message']));});});}; \ No newline at end of file +var _0x23d6=['CreateSmsQueueReport','SmsQueueReport','create','options','raw','UpdateSmsQueueReport','body','where','attributes','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','SmsQueueReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch'];(function(_0x15fd49,_0x5d2aec){var _0xb0523=function(_0x1e2799){while(--_0x1e2799){_0x15fd49['push'](_0x15fd49['shift']());}};_0xb0523(++_0x5d2aec);}(_0x23d6,0x85));var _0x623d=function(_0x3e4cd9,_0x50d11c){_0x3e4cd9=_0x3e4cd9-0x0;var _0x4fa571=_0x23d6[_0x3e4cd9];return _0x4fa571;};'use strict';var _=require(_0x623d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x623d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x623d('0x2'));var db=require(_0x623d('0x3'))['db'];var utils=require(_0x623d('0x4'));var logger=require(_0x623d('0x5'))(_0x623d('0x6'));var config=require(_0x623d('0x7'));var jayson=require(_0x623d('0x8'));var client=jayson[_0x623d('0x9')][_0x623d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x340c70,_0x1287a1,_0x98d458){return new BPromise(function(_0x4b0ac3,_0x5770fd){return client['request'](_0x340c70,_0x98d458)[_0x623d('0xb')](function(_0x57a22b){logger['info'](_0x623d('0xc'),_0x1287a1,'request\x20sent');logger[_0x623d('0xd')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x1287a1,_0x623d('0xe'),JSON[_0x623d('0xf')](_0x57a22b));if(_0x57a22b[_0x623d('0x10')]){if(_0x57a22b['error'][_0x623d('0x11')]===0x1f4){logger[_0x623d('0x10')](_0x623d('0xc'),_0x1287a1,_0x57a22b[_0x623d('0x10')][_0x623d('0x12')]);return _0x5770fd(_0x57a22b[_0x623d('0x10')]['message']);}logger[_0x623d('0x10')](_0x623d('0xc'),_0x1287a1,_0x57a22b[_0x623d('0x10')][_0x623d('0x12')]);return _0x4b0ac3(_0x57a22b[_0x623d('0x10')][_0x623d('0x12')]);}else{logger[_0x623d('0x13')](_0x623d('0xc'),_0x1287a1,_0x623d('0xe'));_0x4b0ac3(_0x57a22b[_0x623d('0x14')][_0x623d('0x12')]);}})[_0x623d('0x15')](function(_0x57d80c){logger[_0x623d('0x10')](_0x623d('0xc'),_0x1287a1,_0x57d80c);_0x5770fd(_0x57d80c);});});}exports[_0x623d('0x16')]=function(_0x2e2749){var _0x423014=this;return new Promise(function(_0x429242,_0x3e3ad4){return db[_0x623d('0x17')][_0x623d('0x18')](_0x2e2749['body'],{'raw':_0x2e2749[_0x623d('0x19')]?_0x2e2749['options'][_0x623d('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x50b7d9){logger[_0x623d('0x13')](_0x623d('0x16'),_0x2e2749);logger['debug'](_0x623d('0x16'),_0x2e2749,JSON[_0x623d('0xf')](_0x50b7d9));_0x429242(_0x50b7d9);})[_0x623d('0x15')](function(_0x49648c){logger[_0x623d('0x10')](_0x623d('0x16'),_0x49648c['message'],_0x2e2749);_0x3e3ad4(_0x423014['error'](0x1f4,_0x49648c[_0x623d('0x12')]));});});};exports[_0x623d('0x1b')]=function(_0x373db9){var _0x3ff6c0=this;return new Promise(function(_0x5cd253,_0x1f383b){return db[_0x623d('0x17')]['update'](_0x373db9[_0x623d('0x1c')],{'raw':_0x373db9[_0x623d('0x19')]?_0x373db9[_0x623d('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x373db9[_0x623d('0x19')]?_0x373db9[_0x623d('0x19')][_0x623d('0x1d')]||null:null,'attributes':_0x373db9[_0x623d('0x19')]?_0x373db9[_0x623d('0x19')][_0x623d('0x1e')]||null:null,'limit':_0x373db9[_0x623d('0x19')]?_0x373db9[_0x623d('0x19')]['limit']||null:null})['then'](function(_0x41e6b3){logger[_0x623d('0x13')](_0x623d('0x1b'),_0x373db9);logger[_0x623d('0xd')](_0x623d('0x1b'),_0x373db9,JSON[_0x623d('0xf')](_0x41e6b3));_0x5cd253(_0x41e6b3);})[_0x623d('0x15')](function(_0x37a71f){logger[_0x623d('0x10')](_0x623d('0x1b'),_0x37a71f[_0x623d('0x12')],_0x373db9);_0x1f383b(_0x3ff6c0['error'](0x1f4,_0x37a71f[_0x623d('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index bc705d9..f9f24b7 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 _0x99c9=['describe','/:id','show','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/describe'];(function(_0x19f06c,_0x223211){var _0x2c6450=function(_0x3d8a82){while(--_0x3d8a82){_0x19f06c['push'](_0x19f06c['shift']());}};_0x2c6450(++_0x223211);}(_0x99c9,0x13c));var _0x999c=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x99c9[_0x5f3f88];return _0xd08119;};'use strict';var multer=require(_0x999c('0x0'));var util=require(_0x999c('0x1'));var path=require(_0x999c('0x2'));var timeout=require(_0x999c('0x3'));var express=require(_0x999c('0x4'));var router=express[_0x999c('0x5')]();var fs_extra=require(_0x999c('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x999c('0x7'));var config=require(_0x999c('0x8'));var controller=require(_0x999c('0x9'));router[_0x999c('0xa')]('/',auth[_0x999c('0xb')](),controller[_0x999c('0xc')]);router[_0x999c('0xa')](_0x999c('0xd'),auth[_0x999c('0xb')](),controller[_0x999c('0xe')]);router[_0x999c('0xa')](_0x999c('0xf'),auth[_0x999c('0xb')](),controller[_0x999c('0x10')]);router['post']('/',auth[_0x999c('0xb')](),controller[_0x999c('0x11')]);router['put'](_0x999c('0xf'),auth[_0x999c('0xb')](),controller[_0x999c('0x12')]);router[_0x999c('0x13')](_0x999c('0xf'),auth[_0x999c('0xb')](),controller[_0x999c('0x14')]);module[_0x999c('0x15')]=router; \ No newline at end of file +var _0x6b8f=['destroy','exports','util','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./smsTransferReport.controller','get','index','/describe','isAuthenticated','/:id','show','post','create','put'];(function(_0x76fea7,_0x164167){var _0x3183c0=function(_0x1f4a4f){while(--_0x1f4a4f){_0x76fea7['push'](_0x76fea7['shift']());}};_0x3183c0(++_0x164167);}(_0x6b8f,0x1bc));var _0xf6b8=function(_0x4ebbe6,_0x316dcd){_0x4ebbe6=_0x4ebbe6-0x0;var _0x34f522=_0x6b8f[_0x4ebbe6];return _0x34f522;};'use strict';var multer=require('multer');var util=require(_0xf6b8('0x0'));var path=require('path');var timeout=require(_0xf6b8('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf6b8('0x2'));var auth=require(_0xf6b8('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xf6b8('0x4'));var controller=require(_0xf6b8('0x5'));router[_0xf6b8('0x6')]('/',auth['isAuthenticated'](),controller[_0xf6b8('0x7')]);router[_0xf6b8('0x6')](_0xf6b8('0x8'),auth[_0xf6b8('0x9')](),controller['describe']);router['get'](_0xf6b8('0xa'),auth['isAuthenticated'](),controller[_0xf6b8('0xb')]);router[_0xf6b8('0xc')]('/',auth[_0xf6b8('0x9')](),controller[_0xf6b8('0xd')]);router[_0xf6b8('0xe')](_0xf6b8('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xf6b8('0xa'),auth[_0xf6b8('0x9')](),controller[_0xf6b8('0xf')]);module[_0xf6b8('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index baed137..782b72b 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 _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0xe11bcd,_0x188db1){var _0x527db7=function(_0xa8f63b){while(--_0xa8f63b){_0xe11bcd['push'](_0xe11bcd['shift']());}};_0x527db7(++_0x188db1);}(_0xf4eb,0xec));var _0xbf4e=function(_0x132c37,_0x512735){_0x132c37=_0x132c37-0x0;var _0x67a062=_0xf4eb[_0x132c37];return _0x67a062;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file +var _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x4d4593,_0x2579d0){var _0x83986f=function(_0x151a84){while(--_0x151a84){_0x4d4593['push'](_0x4d4593['shift']());}};_0x83986f(++_0x2579d0);}(_0xedd9,0xfc));var _0x9edd=function(_0x8f75c4,_0x5dac6f){_0x8f75c4=_0x8f75c4-0x0;var _0x37c2d4=_0xedd9[_0x8f75c4];return _0x37c2d4;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 7e191c3..21a7fc2 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 _0x0ec2=['map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','includeAll','create','body','params','destroy','describe','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','error','stack','name','index','SmsTransferReport','rawAttributes','fieldName','type','key','model'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x0ec2,0x69));var _0x20ec=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x0ec2[_0x30ae5e];return _0x1f2e93;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x20ec('0x0'));var zipdir=require(_0x20ec('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x20ec('0x2'));var moment=require(_0x20ec('0x3'));var BPromise=require(_0x20ec('0x4'));var Mustache=require('mustache');var util=require(_0x20ec('0x5'));var path=require(_0x20ec('0x6'));var sox=require('sox');var csv=require(_0x20ec('0x7'));var ejs=require(_0x20ec('0x8'));var fs=require('fs');var fs_extra=require(_0x20ec('0x9'));var _=require(_0x20ec('0xa'));var squel=require(_0x20ec('0xb'));var crypto=require(_0x20ec('0xc'));var jsforce=require(_0x20ec('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x20ec('0x7'));var querystring=require(_0x20ec('0xe'));var Papa=require(_0x20ec('0xf'));var Redis=require(_0x20ec('0x10'));var authService=require(_0x20ec('0x11'));var qs=require(_0x20ec('0x12'));var as=require(_0x20ec('0x13'));var hardwareService=require(_0x20ec('0x14'));var logger=require(_0x20ec('0x15'))(_0x20ec('0x16'));var utils=require('../../config/utils');var config=require(_0x20ec('0x17'));var licenseUtil=require(_0x20ec('0x18'));var db=require(_0x20ec('0x19'))['db'];function respondWithStatusCode(_0x5a5aa9,_0x2e94ef){_0x2e94ef=_0x2e94ef||0xcc;return function(_0x18d65f){if(_0x18d65f){return _0x5a5aa9[_0x20ec('0x1a')](_0x2e94ef);}return _0x5a5aa9[_0x20ec('0x1b')](_0x2e94ef)[_0x20ec('0x1c')]();};}function respondWithResult(_0x1ff3c1,_0x144eef){_0x144eef=_0x144eef||0xc8;return function(_0x356d26){if(_0x356d26){return _0x1ff3c1[_0x20ec('0x1b')](_0x144eef)[_0x20ec('0x1d')](_0x356d26);}};}function respondWithFilteredResult(_0x3c2afe,_0xd339a1){return function(_0x73b39d){if(_0x73b39d){var _0x128739=typeof _0xd339a1[_0x20ec('0x1e')]===_0x20ec('0x1f')&&typeof _0xd339a1['limit']===_0x20ec('0x1f');var _0x1a9d8d=_0x73b39d[_0x20ec('0x20')];var _0x12da4c=_0x128739?0x0:_0xd339a1[_0x20ec('0x1e')];var _0x1df4b8=_0x128739?_0x73b39d[_0x20ec('0x20')]:_0xd339a1[_0x20ec('0x1e')]+_0xd339a1['limit'];var _0x425175;if(_0x1df4b8>=_0x1a9d8d){_0x1df4b8=_0x1a9d8d;_0x425175=0xc8;}else{_0x425175=0xce;}_0x3c2afe[_0x20ec('0x1b')](_0x425175);return _0x3c2afe[_0x20ec('0x21')](_0x20ec('0x22'),_0x12da4c+'-'+_0x1df4b8+'/'+_0x1a9d8d)['json'](_0x73b39d);}return null;};}function patchUpdates(_0x5e7fbb){return function(_0x3c6b10){try{jsonpatch[_0x20ec('0x23')](_0x3c6b10,_0x5e7fbb,!![]);}catch(_0x520b4a){return BPromise[_0x20ec('0x24')](_0x520b4a);}return _0x3c6b10[_0x20ec('0x25')]();};}function saveUpdates(_0x47e76b,_0x5b0bf2){return function(_0xed0777){if(_0xed0777){return _0xed0777['update'](_0x47e76b)[_0x20ec('0x26')](function(_0x1eda7d){return _0x1eda7d;});}return null;};}function removeEntity(_0x43aeb6,_0x4b37a3){return function(_0x2e4cbb){if(_0x2e4cbb){return _0x2e4cbb['destroy']()['then'](function(){_0x43aeb6[_0x20ec('0x1b')](0xcc)[_0x20ec('0x1c')]();});}};}function handleEntityNotFound(_0x148cc2,_0x3c6a92){return function(_0x6dc90e){if(!_0x6dc90e){_0x148cc2[_0x20ec('0x1a')](0x194);}return _0x6dc90e;};}function handleError(_0x20ab3e,_0x5b1d09){_0x5b1d09=_0x5b1d09||0x1f4;return function(_0x1e7787){logger[_0x20ec('0x27')](_0x1e7787[_0x20ec('0x28')]);if(_0x1e7787[_0x20ec('0x29')]){delete _0x1e7787[_0x20ec('0x29')];}_0x20ab3e['status'](_0x5b1d09)['send'](_0x1e7787);};}exports[_0x20ec('0x2a')]=function(_0x14d906,_0x7ba37b){var _0x3b38ad={},_0x7613c9={},_0x3f97fd={'count':0x0,'rows':[]};var _0x57c61d=_['map'](db[_0x20ec('0x2b')][_0x20ec('0x2c')],function(_0x2226e6){return{'name':_0x2226e6[_0x20ec('0x2d')],'type':_0x2226e6[_0x20ec('0x2e')][_0x20ec('0x2f')]};});_0x7613c9[_0x20ec('0x30')]=_[_0x20ec('0x31')](_0x57c61d,_0x20ec('0x29'));_0x7613c9[_0x20ec('0x32')]=_[_0x20ec('0x33')](_0x14d906['query']);_0x7613c9[_0x20ec('0x34')]=_[_0x20ec('0x35')](_0x7613c9[_0x20ec('0x30')],_0x7613c9[_0x20ec('0x32')]);_0x3b38ad[_0x20ec('0x36')]=_[_0x20ec('0x35')](_0x7613c9[_0x20ec('0x30')],qs[_0x20ec('0x37')](_0x14d906[_0x20ec('0x32')][_0x20ec('0x37')]));_0x3b38ad[_0x20ec('0x36')]=_0x3b38ad[_0x20ec('0x36')][_0x20ec('0x38')]?_0x3b38ad['attributes']:_0x7613c9[_0x20ec('0x30')];if(!_0x14d906[_0x20ec('0x32')][_0x20ec('0x39')](_0x20ec('0x3a'))){_0x3b38ad['limit']=qs[_0x20ec('0x3b')](_0x14d906['query'][_0x20ec('0x3b')]);_0x3b38ad[_0x20ec('0x1e')]=qs[_0x20ec('0x1e')](_0x14d906[_0x20ec('0x32')][_0x20ec('0x1e')]);}_0x3b38ad[_0x20ec('0x3c')]=qs[_0x20ec('0x3d')](_0x14d906[_0x20ec('0x32')][_0x20ec('0x3d')]);_0x3b38ad[_0x20ec('0x3e')]=qs['filters'](_[_0x20ec('0x3f')](_0x14d906[_0x20ec('0x32')],_0x7613c9['filters']),_0x57c61d);if(_0x14d906[_0x20ec('0x32')][_0x20ec('0x40')]){_0x3b38ad['where']=_[_0x20ec('0x41')](_0x3b38ad[_0x20ec('0x3e')],{'$or':_[_0x20ec('0x31')](_0x57c61d,function(_0x7166e6){if(_0x7166e6[_0x20ec('0x2e')]!=='VIRTUAL'){var _0x2872f2={};_0x2872f2[_0x7166e6[_0x20ec('0x29')]]={'$like':'%'+_0x14d906['query'][_0x20ec('0x40')]+'%'};return _0x2872f2;}})});}_0x3b38ad=_[_0x20ec('0x41')]({},_0x3b38ad,_0x14d906[_0x20ec('0x42')]);var _0x4e7b41={'where':_0x3b38ad[_0x20ec('0x3e')]};return db['SmsTransferReport'][_0x20ec('0x20')](_0x4e7b41)[_0x20ec('0x26')](function(_0xe4c1cd){_0x3f97fd[_0x20ec('0x20')]=_0xe4c1cd;if(_0x14d906[_0x20ec('0x32')]['includeAll']){_0x3b38ad[_0x20ec('0x43')]=[{'all':!![]}];}return db[_0x20ec('0x2b')][_0x20ec('0x44')](_0x3b38ad);})[_0x20ec('0x26')](function(_0x33eacb){_0x3f97fd[_0x20ec('0x45')]=_0x33eacb;return _0x3f97fd;})[_0x20ec('0x26')](respondWithFilteredResult(_0x7ba37b,_0x3b38ad))[_0x20ec('0x46')](handleError(_0x7ba37b,null));};exports['show']=function(_0xb6e39c,_0x19128b){var _0x459aa0={'raw':!![],'where':{'id':_0xb6e39c['params']['id']}},_0x394b39={};_0x394b39['model']=_[_0x20ec('0x33')](db[_0x20ec('0x2b')][_0x20ec('0x2c')]);_0x394b39[_0x20ec('0x32')]=_[_0x20ec('0x33')](_0xb6e39c[_0x20ec('0x32')]);_0x394b39[_0x20ec('0x34')]=_[_0x20ec('0x35')](_0x394b39[_0x20ec('0x30')],_0x394b39[_0x20ec('0x32')]);_0x459aa0[_0x20ec('0x36')]=_[_0x20ec('0x35')](_0x394b39['model'],qs['fields'](_0xb6e39c['query'][_0x20ec('0x37')]));_0x459aa0[_0x20ec('0x36')]=_0x459aa0[_0x20ec('0x36')]['length']?_0x459aa0[_0x20ec('0x36')]:_0x394b39[_0x20ec('0x30')];if(_0xb6e39c[_0x20ec('0x32')][_0x20ec('0x47')]){_0x459aa0['include']=[{'all':!![]}];}_0x459aa0=_[_0x20ec('0x41')]({},_0x459aa0,_0xb6e39c['options']);return db[_0x20ec('0x2b')]['find'](_0x459aa0)[_0x20ec('0x26')](handleEntityNotFound(_0x19128b,null))[_0x20ec('0x26')](respondWithResult(_0x19128b,null))[_0x20ec('0x46')](handleError(_0x19128b,null));};exports[_0x20ec('0x48')]=function(_0x2c5668,_0x17323b){return db[_0x20ec('0x2b')][_0x20ec('0x48')](_0x2c5668[_0x20ec('0x49')],{})[_0x20ec('0x26')](respondWithResult(_0x17323b,0xc9))[_0x20ec('0x46')](handleError(_0x17323b,null));};exports['update']=function(_0x3da00c,_0x24bc0f){if(_0x3da00c['body']['id']){delete _0x3da00c[_0x20ec('0x49')]['id'];}return db[_0x20ec('0x2b')]['find']({'where':{'id':_0x3da00c[_0x20ec('0x4a')]['id']}})[_0x20ec('0x26')](handleEntityNotFound(_0x24bc0f,null))[_0x20ec('0x26')](saveUpdates(_0x3da00c[_0x20ec('0x49')],null))[_0x20ec('0x26')](respondWithResult(_0x24bc0f,null))[_0x20ec('0x46')](handleError(_0x24bc0f,null));};exports[_0x20ec('0x4b')]=function(_0x4fcacb,_0x2557a4){return db[_0x20ec('0x2b')]['find']({'where':{'id':_0x4fcacb[_0x20ec('0x4a')]['id']}})[_0x20ec('0x26')](handleEntityNotFound(_0x2557a4,null))['then'](removeEntity(_0x2557a4,null))[_0x20ec('0x46')](handleError(_0x2557a4,null));};exports['describe']=function(_0x75f8c4,_0x1239cb){return db[_0x20ec('0x2b')][_0x20ec('0x4c')]()[_0x20ec('0x26')](respondWithResult(_0x1239cb,null))[_0x20ec('0x46')](handleError(_0x1239cb,null));}; \ No newline at end of file +var _0x774d=['merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','stack','name','send','map','SmsTransferReport','fieldName','type','key','query','keys','model','intersection','fields','attributes','length','nolimit','order','sort','filters','filter','where'];(function(_0x2253ea,_0x6320e){var _0x2d046c=function(_0x707761){while(--_0x707761){_0x2253ea['push'](_0x2253ea['shift']());}};_0x2d046c(++_0x6320e);}(_0x774d,0x1d6));var _0xd774=function(_0x4c5c4c,_0x3ba16b){_0x4c5c4c=_0x4c5c4c-0x0;var _0x499e4b=_0x774d[_0x4c5c4c];return _0x499e4b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd774('0x0'));var zipdir=require(_0xd774('0x1'));var jsonpatch=require(_0xd774('0x2'));var rp=require(_0xd774('0x3'));var moment=require(_0xd774('0x4'));var BPromise=require(_0xd774('0x5'));var Mustache=require(_0xd774('0x6'));var util=require(_0xd774('0x7'));var path=require(_0xd774('0x8'));var sox=require(_0xd774('0x9'));var csv=require(_0xd774('0xa'));var ejs=require(_0xd774('0xb'));var fs=require('fs');var fs_extra=require(_0xd774('0xc'));var _=require(_0xd774('0xd'));var squel=require(_0xd774('0xe'));var crypto=require('crypto');var jsforce=require(_0xd774('0xf'));var deskjs=require(_0xd774('0x10'));var toCsv=require(_0xd774('0xa'));var querystring=require(_0xd774('0x11'));var Papa=require('papaparse');var Redis=require(_0xd774('0x12'));var authService=require(_0xd774('0x13'));var qs=require(_0xd774('0x14'));var as=require(_0xd774('0x15'));var hardwareService=require(_0xd774('0x16'));var logger=require('../../config/logger')(_0xd774('0x17'));var utils=require(_0xd774('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xd774('0x19'));var db=require(_0xd774('0x1a'))['db'];function respondWithStatusCode(_0xe6ce5a,_0x9b91d3){_0x9b91d3=_0x9b91d3||0xcc;return function(_0x4ed04e){if(_0x4ed04e){return _0xe6ce5a[_0xd774('0x1b')](_0x9b91d3);}return _0xe6ce5a[_0xd774('0x1c')](_0x9b91d3)[_0xd774('0x1d')]();};}function respondWithResult(_0x2a6268,_0x286c09){_0x286c09=_0x286c09||0xc8;return function(_0x2b51b2){if(_0x2b51b2){return _0x2a6268[_0xd774('0x1c')](_0x286c09)['json'](_0x2b51b2);}};}function respondWithFilteredResult(_0x41dd8e,_0x3428b0){return function(_0x422128){if(_0x422128){var _0x133bee=typeof _0x3428b0[_0xd774('0x1e')]==='undefined'&&typeof _0x3428b0[_0xd774('0x1f')]===_0xd774('0x20');var _0x1b2d5a=_0x422128[_0xd774('0x21')];var _0x3487a1=_0x133bee?0x0:_0x3428b0['offset'];var _0x3c1fb9=_0x133bee?_0x422128['count']:_0x3428b0[_0xd774('0x1e')]+_0x3428b0[_0xd774('0x1f')];var _0x3d0854;if(_0x3c1fb9>=_0x1b2d5a){_0x3c1fb9=_0x1b2d5a;_0x3d0854=0xc8;}else{_0x3d0854=0xce;}_0x41dd8e['status'](_0x3d0854);return _0x41dd8e[_0xd774('0x22')](_0xd774('0x23'),_0x3487a1+'-'+_0x3c1fb9+'/'+_0x1b2d5a)['json'](_0x422128);}return null;};}function patchUpdates(_0x1d4ec6){return function(_0x54b745){try{jsonpatch['apply'](_0x54b745,_0x1d4ec6,!![]);}catch(_0x18f4d1){return BPromise[_0xd774('0x24')](_0x18f4d1);}return _0x54b745[_0xd774('0x25')]();};}function saveUpdates(_0x4f4a18,_0x26ac8b){return function(_0xeafd9f){if(_0xeafd9f){return _0xeafd9f[_0xd774('0x26')](_0x4f4a18)[_0xd774('0x27')](function(_0x367fa7){return _0x367fa7;});}return null;};}function removeEntity(_0x4d4694,_0x1171f1){return function(_0x125de9){if(_0x125de9){return _0x125de9[_0xd774('0x28')]()[_0xd774('0x27')](function(){_0x4d4694['status'](0xcc)[_0xd774('0x1d')]();});}};}function handleEntityNotFound(_0x578474,_0x166234){return function(_0x2b4b14){if(!_0x2b4b14){_0x578474[_0xd774('0x1b')](0x194);}return _0x2b4b14;};}function handleError(_0x59cd89,_0x22d171){_0x22d171=_0x22d171||0x1f4;return function(_0x39ef38){logger['error'](_0x39ef38[_0xd774('0x29')]);if(_0x39ef38[_0xd774('0x2a')]){delete _0x39ef38[_0xd774('0x2a')];}_0x59cd89['status'](_0x22d171)[_0xd774('0x2b')](_0x39ef38);};}exports['index']=function(_0x53057f,_0x10786d){var _0x13bfe8={},_0x1ec183={},_0x3029a4={'count':0x0,'rows':[]};var _0x26f4d6=_[_0xd774('0x2c')](db[_0xd774('0x2d')]['rawAttributes'],function(_0x4f0b79){return{'name':_0x4f0b79[_0xd774('0x2e')],'type':_0x4f0b79[_0xd774('0x2f')][_0xd774('0x30')]};});_0x1ec183['model']=_[_0xd774('0x2c')](_0x26f4d6,'name');_0x1ec183[_0xd774('0x31')]=_[_0xd774('0x32')](_0x53057f[_0xd774('0x31')]);_0x1ec183['filters']=_['intersection'](_0x1ec183[_0xd774('0x33')],_0x1ec183[_0xd774('0x31')]);_0x13bfe8['attributes']=_[_0xd774('0x34')](_0x1ec183[_0xd774('0x33')],qs[_0xd774('0x35')](_0x53057f[_0xd774('0x31')][_0xd774('0x35')]));_0x13bfe8[_0xd774('0x36')]=_0x13bfe8[_0xd774('0x36')][_0xd774('0x37')]?_0x13bfe8[_0xd774('0x36')]:_0x1ec183[_0xd774('0x33')];if(!_0x53057f[_0xd774('0x31')]['hasOwnProperty'](_0xd774('0x38'))){_0x13bfe8[_0xd774('0x1f')]=qs['limit'](_0x53057f[_0xd774('0x31')][_0xd774('0x1f')]);_0x13bfe8[_0xd774('0x1e')]=qs[_0xd774('0x1e')](_0x53057f['query'][_0xd774('0x1e')]);}_0x13bfe8[_0xd774('0x39')]=qs[_0xd774('0x3a')](_0x53057f[_0xd774('0x31')][_0xd774('0x3a')]);_0x13bfe8['where']=qs[_0xd774('0x3b')](_['pick'](_0x53057f['query'],_0x1ec183['filters']),_0x26f4d6);if(_0x53057f[_0xd774('0x31')][_0xd774('0x3c')]){_0x13bfe8[_0xd774('0x3d')]=_[_0xd774('0x3e')](_0x13bfe8['where'],{'$or':_[_0xd774('0x2c')](_0x26f4d6,function(_0x31365a){if(_0x31365a[_0xd774('0x2f')]!==_0xd774('0x3f')){var _0x593240={};_0x593240[_0x31365a[_0xd774('0x2a')]]={'$like':'%'+_0x53057f['query']['filter']+'%'};return _0x593240;}})});}_0x13bfe8=_[_0xd774('0x3e')]({},_0x13bfe8,_0x53057f[_0xd774('0x40')]);var _0x4148a2={'where':_0x13bfe8['where']};return db['SmsTransferReport'][_0xd774('0x21')](_0x4148a2)[_0xd774('0x27')](function(_0x33ff70){_0x3029a4[_0xd774('0x21')]=_0x33ff70;if(_0x53057f[_0xd774('0x31')][_0xd774('0x41')]){_0x13bfe8[_0xd774('0x42')]=[{'all':!![]}];}return db['SmsTransferReport'][_0xd774('0x43')](_0x13bfe8);})[_0xd774('0x27')](function(_0x202494){_0x3029a4[_0xd774('0x44')]=_0x202494;return _0x3029a4;})['then'](respondWithFilteredResult(_0x10786d,_0x13bfe8))['catch'](handleError(_0x10786d,null));};exports[_0xd774('0x45')]=function(_0x5dbaa3,_0x1967e8){var _0x5b89f4={'raw':!![],'where':{'id':_0x5dbaa3[_0xd774('0x46')]['id']}},_0x3429f3={};_0x3429f3['model']=_['keys'](db['SmsTransferReport']['rawAttributes']);_0x3429f3['query']=_[_0xd774('0x32')](_0x5dbaa3[_0xd774('0x31')]);_0x3429f3['filters']=_[_0xd774('0x34')](_0x3429f3[_0xd774('0x33')],_0x3429f3[_0xd774('0x31')]);_0x5b89f4[_0xd774('0x36')]=_['intersection'](_0x3429f3['model'],qs[_0xd774('0x35')](_0x5dbaa3[_0xd774('0x31')]['fields']));_0x5b89f4['attributes']=_0x5b89f4[_0xd774('0x36')][_0xd774('0x37')]?_0x5b89f4[_0xd774('0x36')]:_0x3429f3['model'];if(_0x5dbaa3[_0xd774('0x31')]['includeAll']){_0x5b89f4[_0xd774('0x42')]=[{'all':!![]}];}_0x5b89f4=_[_0xd774('0x3e')]({},_0x5b89f4,_0x5dbaa3[_0xd774('0x40')]);return db[_0xd774('0x2d')][_0xd774('0x47')](_0x5b89f4)[_0xd774('0x27')](handleEntityNotFound(_0x1967e8,null))[_0xd774('0x27')](respondWithResult(_0x1967e8,null))[_0xd774('0x48')](handleError(_0x1967e8,null));};exports[_0xd774('0x49')]=function(_0x178f4b,_0x240882){return db[_0xd774('0x2d')][_0xd774('0x49')](_0x178f4b['body'],{})['then'](respondWithResult(_0x240882,0xc9))[_0xd774('0x48')](handleError(_0x240882,null));};exports[_0xd774('0x26')]=function(_0xb23b03,_0x4d5eef){if(_0xb23b03['body']['id']){delete _0xb23b03['body']['id'];}return db[_0xd774('0x2d')][_0xd774('0x47')]({'where':{'id':_0xb23b03[_0xd774('0x46')]['id']}})[_0xd774('0x27')](handleEntityNotFound(_0x4d5eef,null))[_0xd774('0x27')](saveUpdates(_0xb23b03[_0xd774('0x4a')],null))['then'](respondWithResult(_0x4d5eef,null))[_0xd774('0x48')](handleError(_0x4d5eef,null));};exports['destroy']=function(_0x32f5fd,_0x2f2b4e){return db[_0xd774('0x2d')][_0xd774('0x47')]({'where':{'id':_0x32f5fd[_0xd774('0x46')]['id']}})[_0xd774('0x27')](handleEntityNotFound(_0x2f2b4e,null))[_0xd774('0x27')](removeEntity(_0x2f2b4e,null))[_0xd774('0x48')](handleError(_0x2f2b4e,null));};exports[_0xd774('0x4b')]=function(_0x5c1aa0,_0x141235){return db[_0xd774('0x2d')][_0xd774('0x4b')]()[_0xd774('0x27')](respondWithResult(_0x141235,null))[_0xd774('0x48')](handleError(_0x141235,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 52fa585..e124977 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 _0xd8ba=['SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./smsTransferReport.attributes','exports','define'];(function(_0x5c0adf,_0x4f791a){var _0x326d00=function(_0x438487){while(--_0x438487){_0x5c0adf['push'](_0x5c0adf['shift']());}};_0x326d00(++_0x4f791a);}(_0xd8ba,0x12f));var _0xad8b=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xd8ba[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0xad8b('0x0'));var util=require(_0xad8b('0x1'));var logger=require(_0xad8b('0x2'))(_0xad8b('0x3'));var moment=require(_0xad8b('0x4'));var BPromise=require(_0xad8b('0x5'));var rp=require(_0xad8b('0x6'));var fs=require('fs');var path=require(_0xad8b('0x7'));var rimraf=require(_0xad8b('0x8'));var config=require('../../config/environment');var attributes=require(_0xad8b('0x9'));module[_0xad8b('0xa')]=function(_0x1632cf,_0xe4c3c1){return _0x1632cf[_0xad8b('0xb')](_0xad8b('0xc'),attributes,{'tableName':_0xad8b('0xd'),'paranoid':![],'indexes':[{'name':_0xad8b('0xe'),'fields':[_0xad8b('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x48d0=['path','rimraf','./smsTransferReport.attributes','exports','define','SmsTransferReport','uniqueid','lodash','util','api','moment','bluebird'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x48d0,0xd3));var _0x048d=function(_0x275ac9,_0xf34c64){_0x275ac9=_0x275ac9-0x0;var _0x444f73=_0x48d0[_0x275ac9];return _0x444f73;};'use strict';var _=require(_0x048d('0x0'));var util=require(_0x048d('0x1'));var logger=require('../../config/logger')(_0x048d('0x2'));var moment=require(_0x048d('0x3'));var BPromise=require(_0x048d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x048d('0x5'));var rimraf=require(_0x048d('0x6'));var config=require('../../config/environment');var attributes=require(_0x048d('0x7'));module[_0x048d('0x8')]=function(_0x14b983,_0x49c342){return _0x14b983[_0x048d('0x9')](_0x048d('0xa'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0x048d('0xb'),'fields':[_0x048d('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 1726a43..2a23a81 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 _0x31af=['client','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x31af,0xde));var _0xf31a=function(_0xb4c17c,_0x2c12ba){_0xb4c17c=_0xb4c17c-0x0;var _0x3c343c=_0x31af[_0xb4c17c];return _0x3c343c;};'use strict';var _=require(_0xf31a('0x0'));var util=require(_0xf31a('0x1'));var moment=require(_0xf31a('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf31a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf31a('0x4'));var logger=require(_0xf31a('0x5'))(_0xf31a('0x6'));var config=require(_0xf31a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf31a('0x8')][_0xf31a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x405926,_0x1dc7cc,_0x47b7a1){return new BPromise(function(_0x31f8e7,_0xe5778a){return client[_0xf31a('0xa')](_0x405926,_0x47b7a1)[_0xf31a('0xb')](function(_0x48cc46){logger[_0xf31a('0xc')](_0xf31a('0xd'),_0x1dc7cc,_0xf31a('0xe'));logger[_0xf31a('0xf')](_0xf31a('0x10'),_0x1dc7cc,'request\x20sent',JSON[_0xf31a('0x11')](_0x48cc46));if(_0x48cc46[_0xf31a('0x12')]){if(_0x48cc46[_0xf31a('0x12')][_0xf31a('0x13')]===0x1f4){logger['error'](_0xf31a('0xd'),_0x1dc7cc,_0x48cc46[_0xf31a('0x12')]['message']);return _0xe5778a(_0x48cc46[_0xf31a('0x12')][_0xf31a('0x14')]);}logger[_0xf31a('0x12')](_0xf31a('0xd'),_0x1dc7cc,_0x48cc46[_0xf31a('0x12')][_0xf31a('0x14')]);return _0x31f8e7(_0x48cc46[_0xf31a('0x12')][_0xf31a('0x14')]);}else{logger[_0xf31a('0xc')](_0xf31a('0xd'),_0x1dc7cc,_0xf31a('0xe'));_0x31f8e7(_0x48cc46[_0xf31a('0x15')][_0xf31a('0x14')]);}})[_0xf31a('0x16')](function(_0x1429c8){logger['error'](_0xf31a('0xd'),_0x1dc7cc,_0x1429c8);_0xe5778a(_0x1429c8);});});} \ No newline at end of file +var _0x3f27=['../../config/utils','jayson/promise','client','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x3f27,0x1f4));var _0x73f2=function(_0x2afcb4,_0x5380f8){_0x2afcb4=_0x2afcb4-0x0;var _0x4576f1=_0x3f27[_0x2afcb4];return _0x4576f1;};'use strict';var _=require(_0x73f2('0x0'));var util=require(_0x73f2('0x1'));var moment=require(_0x73f2('0x2'));var BPromise=require(_0x73f2('0x3'));var rs=require(_0x73f2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x73f2('0x5'))['db'];var utils=require(_0x73f2('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x73f2('0x7'));var client=jayson[_0x73f2('0x8')][_0x73f2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4aa8ec,_0x10af7a,_0x5efe60){return new BPromise(function(_0x521fc9,_0xa2ea48){return client[_0x73f2('0xa')](_0x4aa8ec,_0x5efe60)[_0x73f2('0xb')](function(_0x3bf117){logger[_0x73f2('0xc')](_0x73f2('0xd'),_0x10af7a,'request\x20sent');logger[_0x73f2('0xe')](_0x73f2('0xf'),_0x10af7a,_0x73f2('0x10'),JSON['stringify'](_0x3bf117));if(_0x3bf117['error']){if(_0x3bf117['error'][_0x73f2('0x11')]===0x1f4){logger[_0x73f2('0x12')](_0x73f2('0xd'),_0x10af7a,_0x3bf117[_0x73f2('0x12')][_0x73f2('0x13')]);return _0xa2ea48(_0x3bf117[_0x73f2('0x12')][_0x73f2('0x13')]);}logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x10af7a,_0x3bf117[_0x73f2('0x12')][_0x73f2('0x13')]);return _0x521fc9(_0x3bf117['error']['message']);}else{logger[_0x73f2('0xc')](_0x73f2('0xd'),_0x10af7a,_0x73f2('0x10'));_0x521fc9(_0x3bf117[_0x73f2('0x14')][_0x73f2('0x13')]);}})[_0x73f2('0x15')](function(_0x32e9c6){logger[_0x73f2('0x12')](_0x73f2('0xd'),_0x10af7a,_0x32e9c6);_0xa2ea48(_0x32e9c6);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 568d7f0..621c766 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 _0xd444=['../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','/:id','isAuthenticated','show','download','diskStorage','join','root','server/files/sounds/original/','originalname','format','%s-%s%s','basename','now','extname','post','single','file','put','delete','multer','path','connect-timeout','Router'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0xd444,0x6c));var _0x4d44=function(_0x83af7f,_0x49c6fd){_0x83af7f=_0x83af7f-0x0;var _0x32d85c=_0xd444[_0x83af7f];return _0x32d85c;};'use strict';var multer=require(_0x4d44('0x0'));var util=require('util');var path=require(_0x4d44('0x1'));var timeout=require(_0x4d44('0x2'));var express=require('express');var router=express[_0x4d44('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4d44('0x4'));var interaction=require(_0x4d44('0x5'));var config=require(_0x4d44('0x6'));var controller=require(_0x4d44('0x7'));router[_0x4d44('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4d44('0x8')](_0x4d44('0x9'),auth[_0x4d44('0xa')](),controller[_0x4d44('0xb')]);router[_0x4d44('0x8')]('/:id/download',auth[_0x4d44('0xa')](),controller[_0x4d44('0xc')]);var upload=multer({'storage':multer[_0x4d44('0xd')]({'destination':function(_0x4f5371,_0x1eed18,_0x2bccd7){_0x2bccd7(null,path[_0x4d44('0xe')](config[_0x4d44('0xf')],_0x4d44('0x10')));},'filename':function(_0x5d78a0,_0x1fd104,_0x380263){_0x1fd104[_0x4d44('0x11')]=_0x1fd104[_0x4d44('0x11')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x380263(null,util[_0x4d44('0x12')](_0x4d44('0x13'),path[_0x4d44('0x14')](_0x1fd104[_0x4d44('0x11')],path['extname'](_0x1fd104[_0x4d44('0x11')])),Date[_0x4d44('0x15')](),path[_0x4d44('0x16')](_0x1fd104[_0x4d44('0x11')])));}})});router[_0x4d44('0x17')]('/',upload[_0x4d44('0x18')](_0x4d44('0x19')),controller['create']);router[_0x4d44('0x1a')](_0x4d44('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x4d44('0x1b')](_0x4d44('0x9'),auth[_0x4d44('0xa')](),controller[_0x4d44('0x1b')]);module['exports']=router; \ No newline at end of file +var _0xd59e=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./sound.controller','get','isAuthenticated','index','/:id','show','diskStorage','root','server/files/sounds/original/','originalname','replace','%s-%s%s','basename','extname','post','single','create','put','update','exports','multer','util','path','connect-timeout','express'];(function(_0x130211,_0x4df156){var _0x594030=function(_0x3b4504){while(--_0x3b4504){_0x130211['push'](_0x130211['shift']());}};_0x594030(++_0x4df156);}(_0xd59e,0x8c));var _0xed59=function(_0x43c8a8,_0x15fe00){_0x43c8a8=_0x43c8a8-0x0;var _0x3aebde=_0xd59e[_0x43c8a8];return _0x3aebde;};'use strict';var multer=require(_0xed59('0x0'));var util=require(_0xed59('0x1'));var path=require(_0xed59('0x2'));var timeout=require(_0xed59('0x3'));var express=require(_0xed59('0x4'));var router=express[_0xed59('0x5')]();var fs_extra=require(_0xed59('0x6'));var auth=require(_0xed59('0x7'));var interaction=require(_0xed59('0x8'));var config=require('../../config/environment');var controller=require(_0xed59('0x9'));router[_0xed59('0xa')]('/',auth[_0xed59('0xb')](),controller[_0xed59('0xc')]);router[_0xed59('0xa')](_0xed59('0xd'),auth['isAuthenticated'](),controller[_0xed59('0xe')]);router['get']('/:id/download',auth[_0xed59('0xb')](),controller['download']);var upload=multer({'storage':multer[_0xed59('0xf')]({'destination':function(_0x5c871c,_0x31c09f,_0xa707a){_0xa707a(null,path['join'](config[_0xed59('0x10')],_0xed59('0x11')));},'filename':function(_0x479359,_0x286646,_0x468d2a){_0x286646['originalname']=_0x286646[_0xed59('0x12')][_0xed59('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x468d2a(null,util['format'](_0xed59('0x14'),path[_0xed59('0x15')](_0x286646[_0xed59('0x12')],path[_0xed59('0x16')](_0x286646['originalname'])),Date['now'](),path['extname'](_0x286646[_0xed59('0x12')])));}})});router[_0xed59('0x17')]('/',upload[_0xed59('0x18')]('file'),controller[_0xed59('0x19')]);router[_0xed59('0x1a')](_0xed59('0xd'),auth['isAuthenticated'](),controller[_0xed59('0x1b')]);router['delete'](_0xed59('0xd'),auth[_0xed59('0xb')](),controller['delete']);module[_0xed59('0x1c')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index a67b710..e7a8da9 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 _0x299a=['BIGINT','INTEGER','sequelize','STRING','name','FLOAT'];(function(_0x26662c,_0x36b7e6){var _0x1f7040=function(_0x420912){while(--_0x420912){_0x26662c['push'](_0x26662c['shift']());}};_0x1f7040(++_0x36b7e6);}(_0x299a,0xb0));var _0xa299=function(_0x5c7b94,_0x761646){_0x5c7b94=_0x5c7b94-0x0;var _0x37edb3=_0x299a[_0x5c7b94];return _0x37edb3;};'use strict';var Sequelize=require(_0xa299('0x0'));module['exports']={'name':{'type':Sequelize[_0xa299('0x1')],'unique':_0xa299('0x2'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0xa299('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0xa299('0x1')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0xa299('0x3')]},'original_sampleCount':{'type':Sequelize[_0xa299('0x4')]},'original_channelCount':{'type':Sequelize[_0xa299('0x5')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0xa299('0x5')]},'converted_format':{'type':Sequelize[_0xa299('0x1')]},'converted_duration':{'type':Sequelize[_0xa299('0x3')]},'converted_sampleCount':{'type':Sequelize[_0xa299('0x4')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0xa299('0x4')]},'converted_sampleRate':{'type':Sequelize[_0xa299('0x5')]}}; \ No newline at end of file +var _0x3b1e=['FLOAT','BIGINT','INTEGER','exports','name','STRING'];(function(_0x5b70f0,_0x189655){var _0x49a246=function(_0x25cd5c){while(--_0x25cd5c){_0x5b70f0['push'](_0x5b70f0['shift']());}};_0x49a246(++_0x189655);}(_0x3b1e,0x9f));var _0xe3b1=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3b1e[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0xe3b1('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xe3b1('0x1'),'allowNull':![]},'save_name':{'type':Sequelize[_0xe3b1('0x2')]},'display_name':{'type':Sequelize[_0xe3b1('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0xe3b1('0x2')]},'original_format':{'type':Sequelize[_0xe3b1('0x2')]},'original_duration':{'type':Sequelize[_0xe3b1('0x3')]},'original_sampleCount':{'type':Sequelize[_0xe3b1('0x4')]},'original_channelCount':{'type':Sequelize[_0xe3b1('0x5')]},'original_bitRate':{'type':Sequelize[_0xe3b1('0x4')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0xe3b1('0x3')]},'converted_sampleCount':{'type':Sequelize[_0xe3b1('0x4')]},'converted_channelCount':{'type':Sequelize[_0xe3b1('0x5')]},'converted_bitRate':{'type':Sequelize[_0xe3b1('0x4')]},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 1de82db..dc99f81 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 _0x8024=['include','options','find','download','params','save_name','converted_format','join','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','format','%s.%s','create','originalname','extname','basename','filename','file','server/files/sounds/original','Sound\x20upload\x20filepath:\x20%s','info','Sound\x20upload\x20destination:\x20%s','transcode','wav','src','duration','original_sampleCount','sampleCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','chmodSync','0777','role','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','Sounds','userProfileId','autoAssociation','update','description','delete','original_format','unlinkSync','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','status','Content-Range','apply','save','then','destroy','UserProfileResource','error','stack','name','send','index','map','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','Sound','includeAll','findAll','rows','catch','show','rawAttributes','keys'];(function(_0xe8d963,_0x2a4ec0){var _0x1965d1=function(_0x44e87e){while(--_0x44e87e){_0xe8d963['push'](_0xe8d963['shift']());}};_0x1965d1(++_0x2a4ec0);}(_0x8024,0xb2));var _0x4802=function(_0x3d1d42,_0x28accd){_0x3d1d42=_0x3d1d42-0x0;var _0x3e9e29=_0x8024[_0x3d1d42];return _0x3e9e29;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4802('0x0'));var zipdir=require(_0x4802('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4802('0x2'));var moment=require('moment');var BPromise=require(_0x4802('0x3'));var Mustache=require(_0x4802('0x4'));var util=require(_0x4802('0x5'));var path=require(_0x4802('0x6'));var sox=require(_0x4802('0x7'));var csv=require(_0x4802('0x8'));var ejs=require(_0x4802('0x9'));var fs=require('fs');var fs_extra=require(_0x4802('0xa'));var _=require(_0x4802('0xb'));var squel=require(_0x4802('0xc'));var crypto=require('crypto');var jsforce=require(_0x4802('0xd'));var deskjs=require(_0x4802('0xe'));var toCsv=require('to-csv');var querystring=require(_0x4802('0xf'));var Papa=require(_0x4802('0x10'));var Redis=require('ioredis');var authService=require(_0x4802('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4802('0x12'));var hardwareService=require(_0x4802('0x13'));var logger=require(_0x4802('0x14'))(_0x4802('0x15'));var utils=require(_0x4802('0x16'));var config=require(_0x4802('0x17'));var licenseUtil=require(_0x4802('0x18'));var db=require(_0x4802('0x19'))['db'];function respondWithStatusCode(_0x2accff,_0x13ff18){_0x13ff18=_0x13ff18||0xcc;return function(_0xf029b8){if(_0xf029b8){return _0x2accff[_0x4802('0x1a')](_0x13ff18);}return _0x2accff['status'](_0x13ff18)[_0x4802('0x1b')]();};}function respondWithResult(_0x58fbaa,_0x2288cd){_0x2288cd=_0x2288cd||0xc8;return function(_0x4f7a19){if(_0x4f7a19){return _0x58fbaa['status'](_0x2288cd)[_0x4802('0x1c')](_0x4f7a19);}};}function respondWithFilteredResult(_0x4d086f,_0x24b9a6){return function(_0x1a6e92){if(_0x1a6e92){var _0x3a24f=typeof _0x24b9a6[_0x4802('0x1d')]==='undefined'&&typeof _0x24b9a6['limit']===_0x4802('0x1e');var _0x38d5b4=_0x1a6e92[_0x4802('0x1f')];var _0x22639d=_0x3a24f?0x0:_0x24b9a6[_0x4802('0x1d')];var _0x33e151=_0x3a24f?_0x1a6e92[_0x4802('0x1f')]:_0x24b9a6['offset']+_0x24b9a6[_0x4802('0x20')];var _0x96cc74;if(_0x33e151>=_0x38d5b4){_0x33e151=_0x38d5b4;_0x96cc74=0xc8;}else{_0x96cc74=0xce;}_0x4d086f[_0x4802('0x21')](_0x96cc74);return _0x4d086f['set'](_0x4802('0x22'),_0x22639d+'-'+_0x33e151+'/'+_0x38d5b4)[_0x4802('0x1c')](_0x1a6e92);}return null;};}function patchUpdates(_0x2e523c){return function(_0x427b73){try{jsonpatch[_0x4802('0x23')](_0x427b73,_0x2e523c,!![]);}catch(_0x4f0438){return BPromise['reject'](_0x4f0438);}return _0x427b73[_0x4802('0x24')]();};}function saveUpdates(_0x5c3261,_0x226ed5){return function(_0x542cb6){if(_0x542cb6){return _0x542cb6['update'](_0x5c3261)[_0x4802('0x25')](function(_0x44515a){return _0x44515a;});}return null;};}function removeEntity(_0x2c2fd8,_0x390608){return function(_0x21850b){if(_0x21850b){return _0x21850b[_0x4802('0x26')]()[_0x4802('0x25')](function(){var _0x108e7c=_0x21850b['get']({'plain':!![]});var _0x22eccb='Sounds';return db[_0x4802('0x27')][_0x4802('0x26')]({'where':{'type':_0x22eccb,'resourceId':_0x108e7c['id']}})[_0x4802('0x25')](function(){return _0x21850b;});})[_0x4802('0x25')](function(){_0x2c2fd8['status'](0xcc)[_0x4802('0x1b')]();});}};}function handleEntityNotFound(_0x454b1a,_0x515330){return function(_0x125173){if(!_0x125173){_0x454b1a[_0x4802('0x1a')](0x194);}return _0x125173;};}function handleError(_0x5714dc,_0x3d506a){_0x3d506a=_0x3d506a||0x1f4;return function(_0x675b53){logger[_0x4802('0x28')](_0x675b53[_0x4802('0x29')]);if(_0x675b53['name']){delete _0x675b53[_0x4802('0x2a')];}_0x5714dc[_0x4802('0x21')](_0x3d506a)[_0x4802('0x2b')](_0x675b53);};}exports[_0x4802('0x2c')]=function(_0x26b7fe,_0x1cabbd){var _0x4147c9={},_0x740c82={},_0x5546a6={'count':0x0,'rows':[]};var _0x29229e=_[_0x4802('0x2d')](db['Sound']['rawAttributes'],function(_0x14c399){return{'name':_0x14c399[_0x4802('0x2e')],'type':_0x14c399[_0x4802('0x2f')][_0x4802('0x30')]};});_0x740c82[_0x4802('0x31')]=_[_0x4802('0x2d')](_0x29229e,_0x4802('0x2a'));_0x740c82[_0x4802('0x32')]=_['keys'](_0x26b7fe['query']);_0x740c82[_0x4802('0x33')]=_[_0x4802('0x34')](_0x740c82[_0x4802('0x31')],_0x740c82[_0x4802('0x32')]);_0x4147c9[_0x4802('0x35')]=_[_0x4802('0x34')](_0x740c82[_0x4802('0x31')],qs[_0x4802('0x36')](_0x26b7fe[_0x4802('0x32')]['fields']));_0x4147c9['attributes']=_0x4147c9['attributes'][_0x4802('0x37')]?_0x4147c9[_0x4802('0x35')]:_0x740c82[_0x4802('0x31')];if(!_0x26b7fe[_0x4802('0x32')][_0x4802('0x38')](_0x4802('0x39'))){_0x4147c9[_0x4802('0x20')]=qs[_0x4802('0x20')](_0x26b7fe[_0x4802('0x32')][_0x4802('0x20')]);_0x4147c9['offset']=qs[_0x4802('0x1d')](_0x26b7fe[_0x4802('0x32')][_0x4802('0x1d')]);}_0x4147c9[_0x4802('0x3a')]=qs[_0x4802('0x3b')](_0x26b7fe[_0x4802('0x32')]['sort']);_0x4147c9[_0x4802('0x3c')]=qs['filters'](_['pick'](_0x26b7fe[_0x4802('0x32')],_0x740c82[_0x4802('0x33')]),_0x29229e);if(_0x26b7fe['query'][_0x4802('0x3d')]){_0x4147c9[_0x4802('0x3c')]=_[_0x4802('0x3e')](_0x4147c9[_0x4802('0x3c')],{'$or':_[_0x4802('0x2d')](_0x29229e,function(_0x2cf719){if(_0x2cf719[_0x4802('0x2f')]!==_0x4802('0x3f')){var _0xcdd866={};_0xcdd866[_0x2cf719[_0x4802('0x2a')]]={'$like':'%'+_0x26b7fe[_0x4802('0x32')][_0x4802('0x3d')]+'%'};return _0xcdd866;}})});}_0x4147c9=_[_0x4802('0x3e')]({},_0x4147c9,_0x26b7fe['options']);var _0x42a33c={'where':_0x4147c9[_0x4802('0x3c')]};return db[_0x4802('0x40')][_0x4802('0x1f')](_0x42a33c)[_0x4802('0x25')](function(_0x46d128){_0x5546a6['count']=_0x46d128;if(_0x26b7fe[_0x4802('0x32')][_0x4802('0x41')]){_0x4147c9['include']=[{'all':!![]}];}return db[_0x4802('0x40')][_0x4802('0x42')](_0x4147c9);})[_0x4802('0x25')](function(_0x58ed2){_0x5546a6[_0x4802('0x43')]=_0x58ed2;return _0x5546a6;})[_0x4802('0x25')](respondWithFilteredResult(_0x1cabbd,_0x4147c9))[_0x4802('0x44')](handleError(_0x1cabbd,null));};exports[_0x4802('0x45')]=function(_0x2a84ba,_0x17d05d){var _0x5a1140={'raw':!![],'where':{'id':_0x2a84ba['params']['id']}},_0x33d371={};_0x33d371[_0x4802('0x31')]=_['keys'](db[_0x4802('0x40')][_0x4802('0x46')]);_0x33d371[_0x4802('0x32')]=_[_0x4802('0x47')](_0x2a84ba[_0x4802('0x32')]);_0x33d371[_0x4802('0x33')]=_[_0x4802('0x34')](_0x33d371[_0x4802('0x31')],_0x33d371[_0x4802('0x32')]);_0x5a1140[_0x4802('0x35')]=_['intersection'](_0x33d371['model'],qs[_0x4802('0x36')](_0x2a84ba['query'][_0x4802('0x36')]));_0x5a1140[_0x4802('0x35')]=_0x5a1140[_0x4802('0x35')][_0x4802('0x37')]?_0x5a1140[_0x4802('0x35')]:_0x33d371['model'];if(_0x2a84ba[_0x4802('0x32')][_0x4802('0x41')]){_0x5a1140[_0x4802('0x48')]=[{'all':!![]}];}_0x5a1140=_[_0x4802('0x3e')]({},_0x5a1140,_0x2a84ba[_0x4802('0x49')]);return db['Sound'][_0x4802('0x4a')](_0x5a1140)[_0x4802('0x25')](handleEntityNotFound(_0x17d05d,null))[_0x4802('0x25')](respondWithResult(_0x17d05d,null))[_0x4802('0x44')](handleError(_0x17d05d,null));};exports[_0x4802('0x4b')]=function(_0x50f3a7,_0x233f14,_0x1d7b63){return db[_0x4802('0x40')][_0x4802('0x4a')]({'where':{'id':_0x50f3a7[_0x4802('0x4c')]['id']},'attributes':[_0x4802('0x2a'),_0x4802('0x4d'),_0x4802('0x4e')],'raw':!![]})[_0x4802('0x25')](handleEntityNotFound(_0x233f14,null))['then'](function(_0x297112){if(_0x297112){if(!fs['existsSync'](path[_0x4802('0x4f')](config[_0x4802('0x50')],_0x4802('0x51'),_0x297112['save_name']+'.'+_0x297112[_0x4802('0x4e')]))){throw new db[(_0x4802('0x52'))][(_0x4802('0x53'))](_0x4802('0x54'));}return _0x233f14[_0x4802('0x4b')](path[_0x4802('0x4f')](config[_0x4802('0x50')],_0x4802('0x51'),util[_0x4802('0x55')](_0x4802('0x56'),_0x297112[_0x4802('0x4d')],_0x297112['converted_format'])),util[_0x4802('0x55')](_0x4802('0x56'),_0x297112[_0x4802('0x2a')],_0x297112[_0x4802('0x4e')]));}return null;})[_0x4802('0x44')](handleError(_0x233f14,null));};exports[_0x4802('0x57')]=function(_0x52656a,_0x488fdf,_0x23295e){var _0x291a8e={'name':path['basename'](_0x52656a['file'][_0x4802('0x58')],path[_0x4802('0x59')](_0x52656a['file'][_0x4802('0x58')])),'save_name':path[_0x4802('0x5a')](_0x52656a['file'][_0x4802('0x5b')],path[_0x4802('0x59')](_0x52656a[_0x4802('0x5c')]['filename'])),'original_format':path[_0x4802('0x59')](_0x52656a['file'][_0x4802('0x58')])['substring'](0x1),'converted_format':'wav'};var _0x34acc1=path[_0x4802('0x4f')](config[_0x4802('0x50')],_0x4802('0x5d'),_0x52656a['file'][_0x4802('0x5b')]);var _0x7412ab=path[_0x4802('0x4f')](config[_0x4802('0x50')],_0x4802('0x51'),util[_0x4802('0x55')](_0x4802('0x56'),path[_0x4802('0x5a')](_0x52656a[_0x4802('0x5c')]['filename'],path[_0x4802('0x59')](_0x52656a[_0x4802('0x5c')]['filename'])),_0x291a8e['converted_format']));logger['info'](_0x4802('0x5e'),_0x34acc1);logger[_0x4802('0x5f')](_0x4802('0x60'),_0x7412ab);try{fs['chmodSync'](_0x34acc1,parseInt('0777',0x8));var _0x58a82f=sox[_0x4802('0x61')](_0x34acc1,_0x7412ab,{'sampleRate':0x1f40,'format':_0x4802('0x62'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x58a82f['on']('error',function(_0x4610d5){fs['unlinkSync'](_0x34acc1);_0x488fdf[_0x4802('0x21')](0x1f4)[_0x4802('0x2b')](_0x4610d5);});_0x58a82f['on'](_0x4802('0x63'),function(_0x3cc43b){_0x291a8e['original_duration']=isNaN(_0x3cc43b[_0x4802('0x64')])?null:_0x3cc43b[_0x4802('0x64')]*0x3e8;_0x291a8e[_0x4802('0x65')]=isNaN(_0x3cc43b['sampleCount'])?null:_0x3cc43b[_0x4802('0x66')];_0x291a8e['original_channelCount']=isNaN(_0x3cc43b[_0x4802('0x67')])?null:_0x3cc43b[_0x4802('0x67')];_0x291a8e[_0x4802('0x68')]=isNaN(_0x3cc43b[_0x4802('0x69')])?null:_0x3cc43b[_0x4802('0x69')];_0x291a8e[_0x4802('0x6a')]=isNaN(_0x3cc43b[_0x4802('0x6b')])?null:_0x3cc43b[_0x4802('0x6b')];});_0x58a82f['on'](_0x4802('0x6c'),function(_0xa3a17f){_0x291a8e[_0x4802('0x6d')]=isNaN(_0xa3a17f[_0x4802('0x64')])?null:_0xa3a17f[_0x4802('0x64')]*0x3e8;_0x291a8e[_0x4802('0x6e')]=isNaN(_0xa3a17f[_0x4802('0x66')])?null:_0xa3a17f[_0x4802('0x66')];_0x291a8e[_0x4802('0x6f')]=isNaN(_0xa3a17f[_0x4802('0x67')])?null:_0xa3a17f[_0x4802('0x67')];_0x291a8e['converted_bitRate']=isNaN(_0xa3a17f['bitRate'])?null:_0xa3a17f[_0x4802('0x69')];_0x291a8e['converted_sampleRate']=isNaN(_0xa3a17f['sampleRate'])?null:_0xa3a17f[_0x4802('0x6b')];});_0x58a82f['on']('end',function(){fs[_0x4802('0x70')](_0x7412ab,parseInt(_0x4802('0x71'),0x8));return db[_0x4802('0x40')]['create'](_0x291a8e)[_0x4802('0x25')](function(_0x42387f){var _0xb925e7={'role':_0x52656a['body'][_0x4802('0x72')],'userProfileId':_0x52656a[_0x4802('0x73')]['userProfileId']};if(!_0xb925e7)throw new Error(_0x4802('0x74'));if(_0xb925e7[_0x4802('0x72')]==='user'){var _0x43ed88=_0x42387f['get']({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0x4802('0x75'),'userProfileId':_0xb925e7[_0x4802('0x76')]},'raw':!![]})['then'](function(_0x4addb9){if(_0x4addb9&&_0x4addb9[_0x4802('0x77')]===0x0){return db['UserProfileResource'][_0x4802('0x57')]({'name':_0x43ed88['name'],'resourceId':_0x43ed88['id'],'type':_0x4addb9[_0x4802('0x2a')],'sectionId':_0x4addb9['id']},{})[_0x4802('0x25')](function(){return _0x42387f;});}else{return _0x42387f;}})[_0x4802('0x44')](function(_0x2c767a){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2c767a);throw _0x2c767a;});}return _0x42387f;})['then'](respondWithResult(_0x488fdf,null))[_0x4802('0x44')](handleError(_0x488fdf,null));});_0x58a82f['start']();}catch(_0x468417){_0x488fdf[_0x4802('0x21')](0x1f4)['send'](_0x468417);}};exports[_0x4802('0x78')]=function(_0x24383d,_0x57ef9a,_0x22c0b3){return db['Sound'][_0x4802('0x4a')]({'where':{'id':_0x24383d['params']['id']}})[_0x4802('0x25')](handleEntityNotFound(_0x57ef9a,null))[_0x4802('0x25')](saveUpdates(_['pick'](_0x24383d[_0x4802('0x73')],[_0x4802('0x2a'),_0x4802('0x79')]),null))[_0x4802('0x25')](respondWithResult(_0x57ef9a,null))[_0x4802('0x44')](handleError(_0x57ef9a,null));};exports[_0x4802('0x7a')]=function(_0x46fdc2,_0x1f3e75,_0x1cb6a9){return db['Sound'][_0x4802('0x4a')]({'where':{'id':_0x46fdc2[_0x4802('0x4c')]['id']}})['then'](function(_0x1c48fb){if(_0x1c48fb){return _0x1c48fb[_0x4802('0x26')]();}})[_0x4802('0x25')](function(_0x272c98){var _0x3e2b32=path[_0x4802('0x4f')](config[_0x4802('0x50')],_0x4802('0x5d'),util[_0x4802('0x55')]('%s.%s',_0x272c98['save_name'],_0x272c98[_0x4802('0x7b')]));var _0x2012d0=path['join'](config[_0x4802('0x50')],_0x4802('0x51'),util[_0x4802('0x55')](_0x4802('0x56'),_0x272c98[_0x4802('0x4d')],_0x272c98[_0x4802('0x4e')]));fs[_0x4802('0x7c')](_0x3e2b32);fs[_0x4802('0x7c')](_0x2012d0);return _0x272c98;})[_0x4802('0x25')](function(_0x103475){if(_0x103475){return _0x1f3e75[_0x4802('0x21')](0xcc)[_0x4802('0x1b')]();}})['then'](handleEntityNotFound(_0x1f3e75,null))[_0x4802('0x44')](handleError(_0x1f3e75,null));}; \ No newline at end of file +var _0xb5c3=['hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','merge','includeAll','include','findAll','rows','catch','show','params','keys','find','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','Sequelize','Sound\x20not\x20found','download','format','%s.%s','create','file','originalname','extname','filename','substring','wav','basename','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_channelCount','converted_bitRate','converted_sampleRate','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','body','description','delete','server/files/sounds/original','original_format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','limit','undefined','count','set','apply','update','then','destroy','Sounds','UserProfileResource','end','sendStatus','error','stack','name','send','index','map','Sound','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields','length'];(function(_0x3b4b83,_0xeaf2db){var _0x3542b7=function(_0x5a18d2){while(--_0x5a18d2){_0x3b4b83['push'](_0x3b4b83['shift']());}};_0x3542b7(++_0xeaf2db);}(_0xb5c3,0x1bd));var _0x3b5c=function(_0x219d53,_0x23ea68){_0x219d53=_0x219d53-0x0;var _0x4b39de=_0xb5c3[_0x219d53];return _0x4b39de;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3b5c('0x0'));var zipdir=require(_0x3b5c('0x1'));var jsonpatch=require(_0x3b5c('0x2'));var rp=require('request-promise');var moment=require(_0x3b5c('0x3'));var BPromise=require(_0x3b5c('0x4'));var Mustache=require(_0x3b5c('0x5'));var util=require(_0x3b5c('0x6'));var path=require(_0x3b5c('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3b5c('0x8'));var crypto=require(_0x3b5c('0x9'));var jsforce=require(_0x3b5c('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x3b5c('0xb'));var querystring=require('querystring');var Papa=require(_0x3b5c('0xc'));var Redis=require(_0x3b5c('0xd'));var authService=require(_0x3b5c('0xe'));var qs=require(_0x3b5c('0xf'));var as=require(_0x3b5c('0x10'));var hardwareService=require(_0x3b5c('0x11'));var logger=require(_0x3b5c('0x12'))(_0x3b5c('0x13'));var utils=require(_0x3b5c('0x14'));var config=require(_0x3b5c('0x15'));var licenseUtil=require(_0x3b5c('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x48c5c3,_0xa204ac){_0xa204ac=_0xa204ac||0xcc;return function(_0x4baa4e){if(_0x4baa4e){return _0x48c5c3['sendStatus'](_0xa204ac);}return _0x48c5c3['status'](_0xa204ac)['end']();};}function respondWithResult(_0x57af18,_0x3a3340){_0x3a3340=_0x3a3340||0xc8;return function(_0x20ed61){if(_0x20ed61){return _0x57af18[_0x3b5c('0x17')](_0x3a3340)[_0x3b5c('0x18')](_0x20ed61);}};}function respondWithFilteredResult(_0x25fe34,_0x121d9f){return function(_0x2bf5bb){if(_0x2bf5bb){var _0x45d43b=typeof _0x121d9f[_0x3b5c('0x19')]==='undefined'&&typeof _0x121d9f[_0x3b5c('0x1a')]===_0x3b5c('0x1b');var _0x3a988f=_0x2bf5bb[_0x3b5c('0x1c')];var _0x1400e5=_0x45d43b?0x0:_0x121d9f[_0x3b5c('0x19')];var _0x36d2ef=_0x45d43b?_0x2bf5bb['count']:_0x121d9f[_0x3b5c('0x19')]+_0x121d9f[_0x3b5c('0x1a')];var _0x126f44;if(_0x36d2ef>=_0x3a988f){_0x36d2ef=_0x3a988f;_0x126f44=0xc8;}else{_0x126f44=0xce;}_0x25fe34[_0x3b5c('0x17')](_0x126f44);return _0x25fe34[_0x3b5c('0x1d')]('Content-Range',_0x1400e5+'-'+_0x36d2ef+'/'+_0x3a988f)[_0x3b5c('0x18')](_0x2bf5bb);}return null;};}function patchUpdates(_0x3b70e0){return function(_0x4f5f73){try{jsonpatch[_0x3b5c('0x1e')](_0x4f5f73,_0x3b70e0,!![]);}catch(_0x1ec59c){return BPromise['reject'](_0x1ec59c);}return _0x4f5f73['save']();};}function saveUpdates(_0x1245cc,_0xae8369){return function(_0x321da0){if(_0x321da0){return _0x321da0[_0x3b5c('0x1f')](_0x1245cc)[_0x3b5c('0x20')](function(_0x5bfd47){return _0x5bfd47;});}return null;};}function removeEntity(_0x200904,_0x4cb29b){return function(_0x79366b){if(_0x79366b){return _0x79366b[_0x3b5c('0x21')]()['then'](function(){var _0x319b75=_0x79366b['get']({'plain':!![]});var _0x1c02b9=_0x3b5c('0x22');return db[_0x3b5c('0x23')]['destroy']({'where':{'type':_0x1c02b9,'resourceId':_0x319b75['id']}})[_0x3b5c('0x20')](function(){return _0x79366b;});})[_0x3b5c('0x20')](function(){_0x200904[_0x3b5c('0x17')](0xcc)[_0x3b5c('0x24')]();});}};}function handleEntityNotFound(_0xb7bf10,_0x47e3e6){return function(_0x4c46da){if(!_0x4c46da){_0xb7bf10[_0x3b5c('0x25')](0x194);}return _0x4c46da;};}function handleError(_0x4797e7,_0x3b4958){_0x3b4958=_0x3b4958||0x1f4;return function(_0x5d8ba4){logger[_0x3b5c('0x26')](_0x5d8ba4[_0x3b5c('0x27')]);if(_0x5d8ba4[_0x3b5c('0x28')]){delete _0x5d8ba4[_0x3b5c('0x28')];}_0x4797e7[_0x3b5c('0x17')](_0x3b4958)[_0x3b5c('0x29')](_0x5d8ba4);};}exports[_0x3b5c('0x2a')]=function(_0x418bf8,_0x4bad48){var _0x1a9f7a={},_0x427542={},_0x3f9226={'count':0x0,'rows':[]};var _0x1de879=_[_0x3b5c('0x2b')](db[_0x3b5c('0x2c')][_0x3b5c('0x2d')],function(_0x2e1c05){return{'name':_0x2e1c05[_0x3b5c('0x2e')],'type':_0x2e1c05[_0x3b5c('0x2f')]['key']};});_0x427542[_0x3b5c('0x30')]=_[_0x3b5c('0x2b')](_0x1de879,'name');_0x427542[_0x3b5c('0x31')]=_['keys'](_0x418bf8[_0x3b5c('0x31')]);_0x427542[_0x3b5c('0x32')]=_['intersection'](_0x427542[_0x3b5c('0x30')],_0x427542[_0x3b5c('0x31')]);_0x1a9f7a[_0x3b5c('0x33')]=_[_0x3b5c('0x34')](_0x427542[_0x3b5c('0x30')],qs[_0x3b5c('0x35')](_0x418bf8[_0x3b5c('0x31')]['fields']));_0x1a9f7a['attributes']=_0x1a9f7a[_0x3b5c('0x33')][_0x3b5c('0x36')]?_0x1a9f7a['attributes']:_0x427542[_0x3b5c('0x30')];if(!_0x418bf8[_0x3b5c('0x31')][_0x3b5c('0x37')](_0x3b5c('0x38'))){_0x1a9f7a['limit']=qs[_0x3b5c('0x1a')](_0x418bf8[_0x3b5c('0x31')]['limit']);_0x1a9f7a[_0x3b5c('0x19')]=qs[_0x3b5c('0x19')](_0x418bf8[_0x3b5c('0x31')][_0x3b5c('0x19')]);}_0x1a9f7a['order']=qs[_0x3b5c('0x39')](_0x418bf8[_0x3b5c('0x31')][_0x3b5c('0x39')]);_0x1a9f7a[_0x3b5c('0x3a')]=qs[_0x3b5c('0x32')](_[_0x3b5c('0x3b')](_0x418bf8['query'],_0x427542['filters']),_0x1de879);if(_0x418bf8[_0x3b5c('0x31')]['filter']){_0x1a9f7a['where']=_['merge'](_0x1a9f7a[_0x3b5c('0x3a')],{'$or':_['map'](_0x1de879,function(_0x2a0e6a){if(_0x2a0e6a[_0x3b5c('0x2f')]!==_0x3b5c('0x3c')){var _0x46fbe0={};_0x46fbe0[_0x2a0e6a[_0x3b5c('0x28')]]={'$like':'%'+_0x418bf8['query'][_0x3b5c('0x3d')]+'%'};return _0x46fbe0;}})});}_0x1a9f7a=_[_0x3b5c('0x3e')]({},_0x1a9f7a,_0x418bf8['options']);var _0x28029f={'where':_0x1a9f7a[_0x3b5c('0x3a')]};return db[_0x3b5c('0x2c')][_0x3b5c('0x1c')](_0x28029f)[_0x3b5c('0x20')](function(_0x57a399){_0x3f9226['count']=_0x57a399;if(_0x418bf8[_0x3b5c('0x31')][_0x3b5c('0x3f')]){_0x1a9f7a[_0x3b5c('0x40')]=[{'all':!![]}];}return db[_0x3b5c('0x2c')][_0x3b5c('0x41')](_0x1a9f7a);})[_0x3b5c('0x20')](function(_0x4f4aa9){_0x3f9226[_0x3b5c('0x42')]=_0x4f4aa9;return _0x3f9226;})[_0x3b5c('0x20')](respondWithFilteredResult(_0x4bad48,_0x1a9f7a))[_0x3b5c('0x43')](handleError(_0x4bad48,null));};exports[_0x3b5c('0x44')]=function(_0x2d9fc8,_0x12203a){var _0x1a9e33={'raw':!![],'where':{'id':_0x2d9fc8[_0x3b5c('0x45')]['id']}},_0x56e20d={};_0x56e20d[_0x3b5c('0x30')]=_[_0x3b5c('0x46')](db[_0x3b5c('0x2c')][_0x3b5c('0x2d')]);_0x56e20d[_0x3b5c('0x31')]=_['keys'](_0x2d9fc8['query']);_0x56e20d[_0x3b5c('0x32')]=_[_0x3b5c('0x34')](_0x56e20d[_0x3b5c('0x30')],_0x56e20d['query']);_0x1a9e33[_0x3b5c('0x33')]=_['intersection'](_0x56e20d[_0x3b5c('0x30')],qs[_0x3b5c('0x35')](_0x2d9fc8['query'][_0x3b5c('0x35')]));_0x1a9e33[_0x3b5c('0x33')]=_0x1a9e33[_0x3b5c('0x33')][_0x3b5c('0x36')]?_0x1a9e33[_0x3b5c('0x33')]:_0x56e20d[_0x3b5c('0x30')];if(_0x2d9fc8[_0x3b5c('0x31')]['includeAll']){_0x1a9e33['include']=[{'all':!![]}];}_0x1a9e33=_['merge']({},_0x1a9e33,_0x2d9fc8['options']);return db[_0x3b5c('0x2c')]['find'](_0x1a9e33)[_0x3b5c('0x20')](handleEntityNotFound(_0x12203a,null))[_0x3b5c('0x20')](respondWithResult(_0x12203a,null))[_0x3b5c('0x43')](handleError(_0x12203a,null));};exports['download']=function(_0x296a72,_0x599437,_0x250864){return db[_0x3b5c('0x2c')][_0x3b5c('0x47')]({'where':{'id':_0x296a72[_0x3b5c('0x45')]['id']},'attributes':[_0x3b5c('0x28'),_0x3b5c('0x48'),_0x3b5c('0x49')],'raw':!![]})['then'](handleEntityNotFound(_0x599437,null))[_0x3b5c('0x20')](function(_0x563bad){if(_0x563bad){if(!fs[_0x3b5c('0x4a')](path[_0x3b5c('0x4b')](config[_0x3b5c('0x4c')],_0x3b5c('0x4d'),_0x563bad[_0x3b5c('0x48')]+'.'+_0x563bad[_0x3b5c('0x49')]))){throw new db[(_0x3b5c('0x4e'))]['ValidationError'](_0x3b5c('0x4f'));}return _0x599437[_0x3b5c('0x50')](path['join'](config[_0x3b5c('0x4c')],'server/files/sounds/converted',util[_0x3b5c('0x51')](_0x3b5c('0x52'),_0x563bad[_0x3b5c('0x48')],_0x563bad[_0x3b5c('0x49')])),util[_0x3b5c('0x51')]('%s.%s',_0x563bad[_0x3b5c('0x28')],_0x563bad['converted_format']));}return null;})[_0x3b5c('0x43')](handleError(_0x599437,null));};exports[_0x3b5c('0x53')]=function(_0x49ba0b,_0x15892f,_0x3d9a13){var _0x4cf832={'name':path['basename'](_0x49ba0b[_0x3b5c('0x54')][_0x3b5c('0x55')],path[_0x3b5c('0x56')](_0x49ba0b['file'][_0x3b5c('0x55')])),'save_name':path['basename'](_0x49ba0b['file'][_0x3b5c('0x57')],path[_0x3b5c('0x56')](_0x49ba0b[_0x3b5c('0x54')][_0x3b5c('0x57')])),'original_format':path[_0x3b5c('0x56')](_0x49ba0b[_0x3b5c('0x54')]['originalname'])[_0x3b5c('0x58')](0x1),'converted_format':_0x3b5c('0x59')};var _0x42635a=path['join'](config[_0x3b5c('0x4c')],'server/files/sounds/original',_0x49ba0b[_0x3b5c('0x54')][_0x3b5c('0x57')]);var _0x1ab079=path[_0x3b5c('0x4b')](config[_0x3b5c('0x4c')],_0x3b5c('0x4d'),util['format'](_0x3b5c('0x52'),path[_0x3b5c('0x5a')](_0x49ba0b[_0x3b5c('0x54')][_0x3b5c('0x57')],path[_0x3b5c('0x56')](_0x49ba0b[_0x3b5c('0x54')]['filename'])),_0x4cf832[_0x3b5c('0x49')]));logger[_0x3b5c('0x5b')](_0x3b5c('0x5c'),_0x42635a);logger[_0x3b5c('0x5b')](_0x3b5c('0x5d'),_0x1ab079);try{fs[_0x3b5c('0x5e')](_0x42635a,parseInt(_0x3b5c('0x5f'),0x8));var _0x32c8b9=sox[_0x3b5c('0x60')](_0x42635a,_0x1ab079,{'sampleRate':0x1f40,'format':_0x3b5c('0x59'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x32c8b9['on'](_0x3b5c('0x26'),function(_0x1a4d2d){fs[_0x3b5c('0x61')](_0x42635a);_0x15892f['status'](0x1f4)[_0x3b5c('0x29')](_0x1a4d2d);});_0x32c8b9['on'](_0x3b5c('0x62'),function(_0x39eb76){_0x4cf832[_0x3b5c('0x63')]=isNaN(_0x39eb76[_0x3b5c('0x64')])?null:_0x39eb76[_0x3b5c('0x64')]*0x3e8;_0x4cf832[_0x3b5c('0x65')]=isNaN(_0x39eb76[_0x3b5c('0x66')])?null:_0x39eb76[_0x3b5c('0x66')];_0x4cf832[_0x3b5c('0x67')]=isNaN(_0x39eb76[_0x3b5c('0x68')])?null:_0x39eb76[_0x3b5c('0x68')];_0x4cf832['original_bitRate']=isNaN(_0x39eb76[_0x3b5c('0x69')])?null:_0x39eb76[_0x3b5c('0x69')];_0x4cf832[_0x3b5c('0x6a')]=isNaN(_0x39eb76['sampleRate'])?null:_0x39eb76[_0x3b5c('0x6b')];});_0x32c8b9['on'](_0x3b5c('0x6c'),function(_0x17ea87){_0x4cf832[_0x3b5c('0x6d')]=isNaN(_0x17ea87['duration'])?null:_0x17ea87['duration']*0x3e8;_0x4cf832['converted_sampleCount']=isNaN(_0x17ea87[_0x3b5c('0x66')])?null:_0x17ea87[_0x3b5c('0x66')];_0x4cf832[_0x3b5c('0x6e')]=isNaN(_0x17ea87[_0x3b5c('0x68')])?null:_0x17ea87['channelCount'];_0x4cf832[_0x3b5c('0x6f')]=isNaN(_0x17ea87[_0x3b5c('0x69')])?null:_0x17ea87[_0x3b5c('0x69')];_0x4cf832[_0x3b5c('0x70')]=isNaN(_0x17ea87[_0x3b5c('0x6b')])?null:_0x17ea87[_0x3b5c('0x6b')];});_0x32c8b9['on'](_0x3b5c('0x24'),function(){fs[_0x3b5c('0x5e')](_0x1ab079,parseInt(_0x3b5c('0x5f'),0x8));return db['Sound'][_0x3b5c('0x53')](_0x4cf832)[_0x3b5c('0x20')](function(_0x4d137d){var _0x38a198={'role':_0x49ba0b['body'][_0x3b5c('0x71')],'userProfileId':_0x49ba0b['body'][_0x3b5c('0x72')]};if(!_0x38a198)throw new Error(_0x3b5c('0x73'));if(_0x38a198[_0x3b5c('0x71')]===_0x3b5c('0x74')){var _0x1a3230=_0x4d137d['get']({'plain':!![]});return db[_0x3b5c('0x75')][_0x3b5c('0x47')]({'where':{'name':'Sounds','userProfileId':_0x38a198[_0x3b5c('0x72')]},'raw':!![]})['then'](function(_0xad06f4){if(_0xad06f4&&_0xad06f4['autoAssociation']===0x0){return db[_0x3b5c('0x23')][_0x3b5c('0x53')]({'name':_0x1a3230['name'],'resourceId':_0x1a3230['id'],'type':_0xad06f4[_0x3b5c('0x28')],'sectionId':_0xad06f4['id']},{})['then'](function(){return _0x4d137d;});}else{return _0x4d137d;}})[_0x3b5c('0x43')](function(_0x17abbb){logger[_0x3b5c('0x26')](_0x3b5c('0x76'),_0x17abbb);throw _0x17abbb;});}return _0x4d137d;})['then'](respondWithResult(_0x15892f,null))[_0x3b5c('0x43')](handleError(_0x15892f,null));});_0x32c8b9[_0x3b5c('0x77')]();}catch(_0x2d1f5c){_0x15892f[_0x3b5c('0x17')](0x1f4)['send'](_0x2d1f5c);}};exports[_0x3b5c('0x1f')]=function(_0x2edd23,_0x8bb4bd,_0x347e46){return db[_0x3b5c('0x2c')][_0x3b5c('0x47')]({'where':{'id':_0x2edd23[_0x3b5c('0x45')]['id']}})['then'](handleEntityNotFound(_0x8bb4bd,null))[_0x3b5c('0x20')](saveUpdates(_['pick'](_0x2edd23[_0x3b5c('0x78')],[_0x3b5c('0x28'),_0x3b5c('0x79')]),null))[_0x3b5c('0x20')](respondWithResult(_0x8bb4bd,null))[_0x3b5c('0x43')](handleError(_0x8bb4bd,null));};exports[_0x3b5c('0x7a')]=function(_0x40100e,_0x2f03f4,_0x4fc673){return db[_0x3b5c('0x2c')][_0x3b5c('0x47')]({'where':{'id':_0x40100e[_0x3b5c('0x45')]['id']}})['then'](function(_0xe2f45b){if(_0xe2f45b){return _0xe2f45b[_0x3b5c('0x21')]();}})[_0x3b5c('0x20')](function(_0x15cb35){var _0xdc1d68=path['join'](config[_0x3b5c('0x4c')],_0x3b5c('0x7b'),util[_0x3b5c('0x51')](_0x3b5c('0x52'),_0x15cb35[_0x3b5c('0x48')],_0x15cb35[_0x3b5c('0x7c')]));var _0x3e45c9=path[_0x3b5c('0x4b')](config['root'],_0x3b5c('0x4d'),util[_0x3b5c('0x51')]('%s.%s',_0x15cb35[_0x3b5c('0x48')],_0x15cb35['converted_format']));fs['unlinkSync'](_0xdc1d68);fs[_0x3b5c('0x61')](_0x3e45c9);return _0x15cb35;})[_0x3b5c('0x20')](function(_0x4e44ad){if(_0x4e44ad){return _0x2f03f4[_0x3b5c('0x17')](0xcc)['end']();}})['then'](handleEntityNotFound(_0x2f03f4,null))[_0x3b5c('0x43')](handleError(_0x2f03f4,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index e6d6b94..ac5e6a4 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 _0xecd7=['moment','bluebird','request-promise','path','../../config/environment','./sound.attributes','define','Sound','tools_sounds','util','../../config/logger'];(function(_0x3e0184,_0x52a4fb){var _0xcc1067=function(_0x2e3735){while(--_0x2e3735){_0x3e0184['push'](_0x3e0184['shift']());}};_0xcc1067(++_0x52a4fb);}(_0xecd7,0xf0));var _0x7ecd=function(_0x5c7403,_0x4bf9f0){_0x5c7403=_0x5c7403-0x0;var _0x101e87=_0xecd7[_0x5c7403];return _0x101e87;};'use strict';var _=require('lodash');var util=require(_0x7ecd('0x0'));var logger=require(_0x7ecd('0x1'))('api');var moment=require(_0x7ecd('0x2'));var BPromise=require(_0x7ecd('0x3'));var rp=require(_0x7ecd('0x4'));var fs=require('fs');var path=require(_0x7ecd('0x5'));var rimraf=require('rimraf');var config=require(_0x7ecd('0x6'));var attributes=require(_0x7ecd('0x7'));module['exports']=function(_0x1d39c7,_0x7bec9d){return _0x1d39c7[_0x7ecd('0x8')](_0x7ecd('0x9'),attributes,{'tableName':_0x7ecd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x80dc=['bluebird','request-promise','path','rimraf','../../config/environment','./sound.attributes','exports','define','Sound','tools_sounds','lodash','util','moment'];(function(_0x5033cb,_0x110dff){var _0x5cd0b3=function(_0x4787bb){while(--_0x4787bb){_0x5033cb['push'](_0x5033cb['shift']());}};_0x5cd0b3(++_0x110dff);}(_0x80dc,0xda));var _0xc80d=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x80dc[_0x13b8f3];return _0x1a6d06;};'use strict';var _=require(_0xc80d('0x0'));var util=require(_0xc80d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xc80d('0x2'));var BPromise=require(_0xc80d('0x3'));var rp=require(_0xc80d('0x4'));var fs=require('fs');var path=require(_0xc80d('0x5'));var rimraf=require(_0xc80d('0x6'));var config=require(_0xc80d('0x7'));var attributes=require(_0xc80d('0x8'));module[_0xc80d('0x9')]=function(_0x27a76c,_0x1b6b8f){return _0x27a76c[_0xc80d('0xa')](_0xc80d('0xb'),attributes,{'tableName':_0xc80d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 7676629..2f014ce 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 _0x9746=['request\x20sent','result','catch','ShowSound','Sound','find','options','raw','attributes','include','map','model','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','Sound,\x20%s,\x20%s','debug','Sound,\x20%s,\x20%s,\x20%s','error','code','message','info'];(function(_0x309643,_0x45fc34){var _0x2a6f10=function(_0x485986){while(--_0x485986){_0x309643['push'](_0x309643['shift']());}};_0x2a6f10(++_0x45fc34);}(_0x9746,0x1db));var _0x6974=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x9746[_0x55e08b];return _0xd1a7ff;};'use strict';var _=require(_0x6974('0x0'));var util=require(_0x6974('0x1'));var moment=require(_0x6974('0x2'));var BPromise=require(_0x6974('0x3'));var rs=require(_0x6974('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6974('0x5'))['db'];var utils=require(_0x6974('0x6'));var logger=require('../../config/logger')(_0x6974('0x7'));var config=require(_0x6974('0x8'));var jayson=require(_0x6974('0x9'));var client=jayson[_0x6974('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x506d55,_0x59c6e5,_0x964f46){return new BPromise(function(_0x39cf58,_0x19206e){return client[_0x6974('0xb')](_0x506d55,_0x964f46)[_0x6974('0xc')](function(_0x1db7ae){logger['info'](_0x6974('0xd'),_0x59c6e5,'request\x20sent');logger[_0x6974('0xe')](_0x6974('0xf'),_0x59c6e5,'request\x20sent',JSON['stringify'](_0x1db7ae));if(_0x1db7ae[_0x6974('0x10')]){if(_0x1db7ae[_0x6974('0x10')][_0x6974('0x11')]===0x1f4){logger[_0x6974('0x10')]('Sound,\x20%s,\x20%s',_0x59c6e5,_0x1db7ae[_0x6974('0x10')]['message']);return _0x19206e(_0x1db7ae[_0x6974('0x10')][_0x6974('0x12')]);}logger[_0x6974('0x10')](_0x6974('0xd'),_0x59c6e5,_0x1db7ae[_0x6974('0x10')]['message']);return _0x39cf58(_0x1db7ae[_0x6974('0x10')][_0x6974('0x12')]);}else{logger[_0x6974('0x13')](_0x6974('0xd'),_0x59c6e5,_0x6974('0x14'));_0x39cf58(_0x1db7ae[_0x6974('0x15')][_0x6974('0x12')]);}})[_0x6974('0x16')](function(_0xe6944){logger[_0x6974('0x10')]('Sound,\x20%s,\x20%s',_0x59c6e5,_0xe6944);_0x19206e(_0xe6944);});});}exports[_0x6974('0x17')]=function(_0x3fe092){var _0x18c8cb=this;return new Promise(function(_0x675787,_0x11e7dd){return db[_0x6974('0x18')][_0x6974('0x19')]({'raw':_0x3fe092[_0x6974('0x1a')]?_0x3fe092[_0x6974('0x1a')][_0x6974('0x1b')]===undefined?!![]:![]:!![],'where':_0x3fe092[_0x6974('0x1a')]?_0x3fe092[_0x6974('0x1a')]['where']||null:null,'attributes':_0x3fe092[_0x6974('0x1a')]?_0x3fe092[_0x6974('0x1a')][_0x6974('0x1c')]||null:null,'include':_0x3fe092[_0x6974('0x1a')]?_0x3fe092[_0x6974('0x1a')][_0x6974('0x1d')]?_[_0x6974('0x1e')](_0x3fe092[_0x6974('0x1a')][_0x6974('0x1d')],function(_0x4c2ad1){return{'model':db[_0x4c2ad1['model']],'as':_0x4c2ad1['as'],'attributes':_0x4c2ad1[_0x6974('0x1c')],'include':_0x4c2ad1[_0x6974('0x1d')]?_[_0x6974('0x1e')](_0x4c2ad1[_0x6974('0x1d')],function(_0x5ec9bd){return{'model':db[_0x5ec9bd[_0x6974('0x1f')]],'as':_0x5ec9bd['as'],'attributes':_0x5ec9bd[_0x6974('0x1c')],'include':_0x5ec9bd[_0x6974('0x1d')]?_['map'](_0x5ec9bd[_0x6974('0x1d')],function(_0xa3a271){return{'model':db[_0xa3a271[_0x6974('0x1f')]],'as':_0xa3a271['as'],'attributes':_0xa3a271[_0x6974('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x6974('0xc')](function(_0x174ee3){logger[_0x6974('0x13')]('ShowSound',_0x3fe092);logger[_0x6974('0xe')](_0x6974('0x17'),_0x3fe092,JSON[_0x6974('0x20')](_0x174ee3));_0x675787(_0x174ee3);})[_0x6974('0x16')](function(_0x305c27){logger[_0x6974('0x10')](_0x6974('0x17'),_0x305c27[_0x6974('0x12')],_0x3fe092);_0x11e7dd(_0x18c8cb[_0x6974('0x10')](0x1f4,_0x305c27['message']));});});}; \ No newline at end of file +var _0x59d4=['code','message','result','catch','ShowSound','Sound','find','options','where','attributes','include','model','map','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0x59d4,0x70));var _0x459d=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x59d4[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x459d('0x0'));var util=require(_0x459d('0x1'));var moment=require('moment');var BPromise=require(_0x459d('0x2'));var rs=require(_0x459d('0x3'));var fs=require('fs');var Redis=require(_0x459d('0x4'));var db=require(_0x459d('0x5'))['db'];var utils=require(_0x459d('0x6'));var logger=require(_0x459d('0x7'))(_0x459d('0x8'));var config=require(_0x459d('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x459d('0xa')][_0x459d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3aaaf5,_0x40ac66,_0x31a265){return new BPromise(function(_0x5a7c8f,_0x53dc13){return client['request'](_0x3aaaf5,_0x31a265)[_0x459d('0xc')](function(_0x307036){logger[_0x459d('0xd')](_0x459d('0xe'),_0x40ac66,_0x459d('0xf'));logger[_0x459d('0x10')](_0x459d('0x11'),_0x40ac66,_0x459d('0xf'),JSON[_0x459d('0x12')](_0x307036));if(_0x307036[_0x459d('0x13')]){if(_0x307036['error'][_0x459d('0x14')]===0x1f4){logger[_0x459d('0x13')](_0x459d('0xe'),_0x40ac66,_0x307036[_0x459d('0x13')][_0x459d('0x15')]);return _0x53dc13(_0x307036['error'][_0x459d('0x15')]);}logger[_0x459d('0x13')](_0x459d('0xe'),_0x40ac66,_0x307036['error'][_0x459d('0x15')]);return _0x5a7c8f(_0x307036[_0x459d('0x13')][_0x459d('0x15')]);}else{logger[_0x459d('0xd')](_0x459d('0xe'),_0x40ac66,_0x459d('0xf'));_0x5a7c8f(_0x307036[_0x459d('0x16')]['message']);}})[_0x459d('0x17')](function(_0x154953){logger[_0x459d('0x13')](_0x459d('0xe'),_0x40ac66,_0x154953);_0x53dc13(_0x154953);});});}exports[_0x459d('0x18')]=function(_0x4e1f3e){var _0x11a12a=this;return new Promise(function(_0x136a57,_0x20f176){return db[_0x459d('0x19')][_0x459d('0x1a')]({'raw':_0x4e1f3e['options']?_0x4e1f3e[_0x459d('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x4e1f3e['options']?_0x4e1f3e[_0x459d('0x1b')][_0x459d('0x1c')]||null:null,'attributes':_0x4e1f3e['options']?_0x4e1f3e[_0x459d('0x1b')][_0x459d('0x1d')]||null:null,'include':_0x4e1f3e['options']?_0x4e1f3e[_0x459d('0x1b')][_0x459d('0x1e')]?_['map'](_0x4e1f3e[_0x459d('0x1b')][_0x459d('0x1e')],function(_0x46c9d1){return{'model':db[_0x46c9d1[_0x459d('0x1f')]],'as':_0x46c9d1['as'],'attributes':_0x46c9d1[_0x459d('0x1d')],'include':_0x46c9d1['include']?_[_0x459d('0x20')](_0x46c9d1[_0x459d('0x1e')],function(_0x5f26ba){return{'model':db[_0x5f26ba['model']],'as':_0x5f26ba['as'],'attributes':_0x5f26ba[_0x459d('0x1d')],'include':_0x5f26ba['include']?_['map'](_0x5f26ba['include'],function(_0x293ba8){return{'model':db[_0x293ba8[_0x459d('0x1f')]],'as':_0x293ba8['as'],'attributes':_0x293ba8['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x31aa5c){logger[_0x459d('0xd')](_0x459d('0x18'),_0x4e1f3e);logger[_0x459d('0x10')](_0x459d('0x18'),_0x4e1f3e,JSON[_0x459d('0x12')](_0x31aa5c));_0x136a57(_0x31aa5c);})[_0x459d('0x17')](function(_0x1f8836){logger[_0x459d('0x13')](_0x459d('0x18'),_0x1f8836[_0x459d('0x15')],_0x4e1f3e);_0x20f176(_0x11a12a[_0x459d('0x13')](0x1f4,_0x1f8836[_0x459d('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 79f83c6..e9de655 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 _0xda3f=['../../config/environment','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','util','path','fs-extra','../../components/interaction/service'];(function(_0x374f59,_0x5c2098){var _0x408ead=function(_0x3e6b54){while(--_0x3e6b54){_0x374f59['push'](_0x374f59['shift']());}};_0x408ead(++_0x5c2098);}(_0xda3f,0xec));var _0xfda3=function(_0x941437,_0x1de3f0){_0x941437=_0x941437-0x0;var _0x3b85de=_0xda3f[_0x941437];return _0x3b85de;};'use strict';var multer=require('multer');var util=require(_0xfda3('0x0'));var path=require(_0xfda3('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xfda3('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xfda3('0x3'));var config=require(_0xfda3('0x4'));var controller=require('./squareMessage.controller');router[_0xfda3('0x5')]('/',auth[_0xfda3('0x6')](),controller['index']);router['get'](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0x8')]);router[_0xfda3('0x9')]('/',auth[_0xfda3('0x6')](),controller[_0xfda3('0xa')]);router[_0xfda3('0xb')](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0xc')]);router[_0xfda3('0xd')](_0xfda3('0x7'),auth['isAuthenticated'](),controller[_0xfda3('0xe')]);module[_0xfda3('0xf')]=router; \ No newline at end of file +var _0x5eb8=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','show','put','update','delete','exports','path','connect-timeout','express','Router'];(function(_0x4fbad6,_0x3eb736){var _0x5a4bc9=function(_0x1753c4){while(--_0x1753c4){_0x4fbad6['push'](_0x4fbad6['shift']());}};_0x5a4bc9(++_0x3eb736);}(_0x5eb8,0xb0));var _0x85eb=function(_0x1c30bf,_0x247c31){_0x1c30bf=_0x1c30bf-0x0;var _0x255b5e=_0x5eb8[_0x1c30bf];return _0x255b5e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x85eb('0x0'));var timeout=require(_0x85eb('0x1'));var express=require(_0x85eb('0x2'));var router=express[_0x85eb('0x3')]();var fs_extra=require(_0x85eb('0x4'));var auth=require(_0x85eb('0x5'));var interaction=require(_0x85eb('0x6'));var config=require(_0x85eb('0x7'));var controller=require(_0x85eb('0x8'));router[_0x85eb('0x9')]('/',auth[_0x85eb('0xa')](),controller[_0x85eb('0xb')]);router['get'](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xd')]);router['post']('/',auth[_0x85eb('0xa')](),controller['create']);router[_0x85eb('0xe')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xf')]);router[_0x85eb('0x10')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller['destroy']);module[_0x85eb('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 2b6df15..6983a86 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 _0x749e=['ENUM','out','exports','STRING'];(function(_0xbe31d1,_0x126345){var _0x7bd03=function(_0xbcacac){while(--_0xbcacac){_0xbe31d1['push'](_0xbe31d1['shift']());}};_0x7bd03(++_0x126345);}(_0x749e,0x192));var _0xe749=function(_0x46c25e,_0x3d84fa){_0x46c25e=_0x46c25e-0x0;var _0x4d1bcf=_0x749e[_0x46c25e];return _0x4d1bcf;};'use strict';var Sequelize=require('sequelize');module[_0xe749('0x0')]={'uniqueid':{'type':Sequelize[_0xe749('0x1')]},'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0xe749('0x2')]('in','out'),'defaultValue':_0xe749('0x3'),'allowNull':![]},'providerName':{'type':Sequelize[_0xe749('0x1')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x2056=['sequelize','exports','TEXT','medium','ENUM','out','STRING'];(function(_0xe501ff,_0x955b7e){var _0x17135d=function(_0x8e3458){while(--_0x8e3458){_0xe501ff['push'](_0xe501ff['shift']());}};_0x17135d(++_0x955b7e);}(_0x2056,0x142));var _0x6205=function(_0x5a7f64,_0x347d57){_0x5a7f64=_0x5a7f64-0x0;var _0x3d30f1=_0x2056[_0x5a7f64];return _0x3d30f1;};'use strict';var Sequelize=require(_0x6205('0x0'));module[_0x6205('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0x6205('0x2')](_0x6205('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x6205('0x4')]('in',_0x6205('0x5')),'defaultValue':_0x6205('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0x6205('0x6')]},'providerResponse':{'type':Sequelize[_0x6205('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 0629ad1..117b547 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 _0x2ebd=['eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','count','offset','limit','set','json','apply','reject','update','then','destroy','error','stack','name','send','index','SquareMessage','rawAttributes','type','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body'];(function(_0x2a880e,_0x44beb7){var _0x45e0ce=function(_0x10cbc2){while(--_0x10cbc2){_0x2a880e['push'](_0x2a880e['shift']());}};_0x45e0ce(++_0x44beb7);}(_0x2ebd,0x1c8));var _0xd2eb=function(_0x51db4c,_0x3b58bc){_0x51db4c=_0x51db4c-0x0;var _0x5b8a76=_0x2ebd[_0x51db4c];return _0x5b8a76;};'use strict';var emlformat=require(_0xd2eb('0x0'));var rimraf=require(_0xd2eb('0x1'));var zipdir=require(_0xd2eb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd2eb('0x3'));var BPromise=require(_0xd2eb('0x4'));var Mustache=require(_0xd2eb('0x5'));var util=require(_0xd2eb('0x6'));var path=require(_0xd2eb('0x7'));var sox=require(_0xd2eb('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd2eb('0x9'));var _=require(_0xd2eb('0xa'));var squel=require(_0xd2eb('0xb'));var crypto=require(_0xd2eb('0xc'));var jsforce=require(_0xd2eb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd2eb('0xe'));var querystring=require(_0xd2eb('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd2eb('0x10'));var qs=require(_0xd2eb('0x11'));var as=require(_0xd2eb('0x12'));var hardwareService=require(_0xd2eb('0x13'));var logger=require(_0xd2eb('0x14'))(_0xd2eb('0x15'));var utils=require(_0xd2eb('0x16'));var config=require(_0xd2eb('0x17'));var licenseUtil=require(_0xd2eb('0x18'));var db=require(_0xd2eb('0x19'))['db'];function respondWithStatusCode(_0x3f694e,_0x2af8b6){_0x2af8b6=_0x2af8b6||0xcc;return function(_0x47f354){if(_0x47f354){return _0x3f694e[_0xd2eb('0x1a')](_0x2af8b6);}return _0x3f694e['status'](_0x2af8b6)[_0xd2eb('0x1b')]();};}function respondWithResult(_0x7c192a,_0x503cd1){_0x503cd1=_0x503cd1||0xc8;return function(_0xd4024){if(_0xd4024){return _0x7c192a[_0xd2eb('0x1c')](_0x503cd1)['json'](_0xd4024);}};}function respondWithFilteredResult(_0xa4f6c4,_0xa042c9){return function(_0x216f82){if(_0x216f82){var _0x4bf46e=typeof _0xa042c9['offset']===_0xd2eb('0x1d')&&typeof _0xa042c9['limit']==='undefined';var _0x8555b=_0x216f82[_0xd2eb('0x1e')];var _0x561e13=_0x4bf46e?0x0:_0xa042c9[_0xd2eb('0x1f')];var _0x2b3a76=_0x4bf46e?_0x216f82[_0xd2eb('0x1e')]:_0xa042c9[_0xd2eb('0x1f')]+_0xa042c9[_0xd2eb('0x20')];var _0x154349;if(_0x2b3a76>=_0x8555b){_0x2b3a76=_0x8555b;_0x154349=0xc8;}else{_0x154349=0xce;}_0xa4f6c4[_0xd2eb('0x1c')](_0x154349);return _0xa4f6c4[_0xd2eb('0x21')]('Content-Range',_0x561e13+'-'+_0x2b3a76+'/'+_0x8555b)[_0xd2eb('0x22')](_0x216f82);}return null;};}function patchUpdates(_0x4d57ee){return function(_0x328a07){try{jsonpatch[_0xd2eb('0x23')](_0x328a07,_0x4d57ee,!![]);}catch(_0x2a9a90){return BPromise[_0xd2eb('0x24')](_0x2a9a90);}return _0x328a07['save']();};}function saveUpdates(_0x27c797,_0x442eb4){return function(_0x47bc42){if(_0x47bc42){return _0x47bc42[_0xd2eb('0x25')](_0x27c797)[_0xd2eb('0x26')](function(_0x3bacd7){return _0x3bacd7;});}return null;};}function removeEntity(_0x2a9967,_0x2bc69a){return function(_0x27a3b4){if(_0x27a3b4){return _0x27a3b4[_0xd2eb('0x27')]()[_0xd2eb('0x26')](function(){_0x2a9967['status'](0xcc)[_0xd2eb('0x1b')]();});}};}function handleEntityNotFound(_0x443842,_0x22329f){return function(_0x3e6eb1){if(!_0x3e6eb1){_0x443842[_0xd2eb('0x1a')](0x194);}return _0x3e6eb1;};}function handleError(_0x221406,_0xe72bbb){_0xe72bbb=_0xe72bbb||0x1f4;return function(_0x2f0fd1){logger[_0xd2eb('0x28')](_0x2f0fd1[_0xd2eb('0x29')]);if(_0x2f0fd1[_0xd2eb('0x2a')]){delete _0x2f0fd1[_0xd2eb('0x2a')];}_0x221406[_0xd2eb('0x1c')](_0xe72bbb)[_0xd2eb('0x2b')](_0x2f0fd1);};}exports[_0xd2eb('0x2c')]=function(_0x39ee3d,_0x448973){var _0x6996b={},_0x6998b1={},_0x39ed9d={'count':0x0,'rows':[]};var _0x20d8dd=_['map'](db[_0xd2eb('0x2d')][_0xd2eb('0x2e')],function(_0x41030b){return{'name':_0x41030b['fieldName'],'type':_0x41030b[_0xd2eb('0x2f')]['key']};});_0x6998b1[_0xd2eb('0x30')]=_[_0xd2eb('0x31')](_0x20d8dd,'name');_0x6998b1[_0xd2eb('0x32')]=_[_0xd2eb('0x33')](_0x39ee3d[_0xd2eb('0x32')]);_0x6998b1[_0xd2eb('0x34')]=_[_0xd2eb('0x35')](_0x6998b1[_0xd2eb('0x30')],_0x6998b1['query']);_0x6996b['attributes']=_[_0xd2eb('0x35')](_0x6998b1['model'],qs['fields'](_0x39ee3d[_0xd2eb('0x32')]['fields']));_0x6996b[_0xd2eb('0x36')]=_0x6996b['attributes'][_0xd2eb('0x37')]?_0x6996b[_0xd2eb('0x36')]:_0x6998b1['model'];if(!_0x39ee3d['query'][_0xd2eb('0x38')]('nolimit')){_0x6996b[_0xd2eb('0x20')]=qs[_0xd2eb('0x20')](_0x39ee3d[_0xd2eb('0x32')]['limit']);_0x6996b['offset']=qs[_0xd2eb('0x1f')](_0x39ee3d['query'][_0xd2eb('0x1f')]);}_0x6996b[_0xd2eb('0x39')]=qs[_0xd2eb('0x3a')](_0x39ee3d[_0xd2eb('0x32')]['sort']);_0x6996b[_0xd2eb('0x3b')]=qs['filters'](_[_0xd2eb('0x3c')](_0x39ee3d['query'],_0x6998b1[_0xd2eb('0x34')]),_0x20d8dd);if(_0x39ee3d[_0xd2eb('0x32')][_0xd2eb('0x3d')]){_0x6996b[_0xd2eb('0x3b')]=_[_0xd2eb('0x3e')](_0x6996b[_0xd2eb('0x3b')],{'$or':_[_0xd2eb('0x31')](_0x20d8dd,function(_0x15da99){if(_0x15da99[_0xd2eb('0x2f')]!==_0xd2eb('0x3f')){var _0x5cc289={};_0x5cc289[_0x15da99[_0xd2eb('0x2a')]]={'$like':'%'+_0x39ee3d[_0xd2eb('0x32')]['filter']+'%'};return _0x5cc289;}})});}_0x6996b=_[_0xd2eb('0x3e')]({},_0x6996b,_0x39ee3d[_0xd2eb('0x40')]);var _0x326a5e={'where':_0x6996b[_0xd2eb('0x3b')]};return db['SquareMessage'][_0xd2eb('0x1e')](_0x326a5e)['then'](function(_0x49b97a){_0x39ed9d[_0xd2eb('0x1e')]=_0x49b97a;if(_0x39ee3d['query'][_0xd2eb('0x41')]){_0x6996b[_0xd2eb('0x42')]=[{'all':!![]}];}return db[_0xd2eb('0x2d')][_0xd2eb('0x43')](_0x6996b);})[_0xd2eb('0x26')](function(_0x5d4314){_0x39ed9d[_0xd2eb('0x44')]=_0x5d4314;return _0x39ed9d;})[_0xd2eb('0x26')](respondWithFilteredResult(_0x448973,_0x6996b))[_0xd2eb('0x45')](handleError(_0x448973,null));};exports[_0xd2eb('0x46')]=function(_0x31698c,_0x4ec8b3){var _0x2f45eb={'raw':!![],'where':{'id':_0x31698c[_0xd2eb('0x47')]['id']}},_0x442e2a={};_0x442e2a[_0xd2eb('0x30')]=_['keys'](db[_0xd2eb('0x2d')]['rawAttributes']);_0x442e2a[_0xd2eb('0x32')]=_['keys'](_0x31698c[_0xd2eb('0x32')]);_0x442e2a[_0xd2eb('0x34')]=_[_0xd2eb('0x35')](_0x442e2a[_0xd2eb('0x30')],_0x442e2a[_0xd2eb('0x32')]);_0x2f45eb['attributes']=_[_0xd2eb('0x35')](_0x442e2a[_0xd2eb('0x30')],qs['fields'](_0x31698c[_0xd2eb('0x32')][_0xd2eb('0x48')]));_0x2f45eb[_0xd2eb('0x36')]=_0x2f45eb[_0xd2eb('0x36')][_0xd2eb('0x37')]?_0x2f45eb[_0xd2eb('0x36')]:_0x442e2a[_0xd2eb('0x30')];if(_0x31698c[_0xd2eb('0x32')][_0xd2eb('0x41')]){_0x2f45eb['include']=[{'all':!![]}];}_0x2f45eb=_[_0xd2eb('0x3e')]({},_0x2f45eb,_0x31698c['options']);return db[_0xd2eb('0x2d')][_0xd2eb('0x49')](_0x2f45eb)[_0xd2eb('0x26')](handleEntityNotFound(_0x4ec8b3,null))[_0xd2eb('0x26')](respondWithResult(_0x4ec8b3,null))[_0xd2eb('0x45')](handleError(_0x4ec8b3,null));};exports[_0xd2eb('0x4a')]=function(_0x737c60,_0x436c22){return db[_0xd2eb('0x2d')][_0xd2eb('0x4a')](_0x737c60[_0xd2eb('0x4b')],{})[_0xd2eb('0x26')](respondWithResult(_0x436c22,0xc9))[_0xd2eb('0x45')](handleError(_0x436c22,null));};exports[_0xd2eb('0x25')]=function(_0x375da1,_0x2f079c){if(_0x375da1[_0xd2eb('0x4b')]['id']){delete _0x375da1[_0xd2eb('0x4b')]['id'];}return db[_0xd2eb('0x2d')][_0xd2eb('0x49')]({'where':{'id':_0x375da1[_0xd2eb('0x47')]['id']}})[_0xd2eb('0x26')](handleEntityNotFound(_0x2f079c,null))[_0xd2eb('0x26')](saveUpdates(_0x375da1['body'],null))[_0xd2eb('0x26')](respondWithResult(_0x2f079c,null))[_0xd2eb('0x45')](handleError(_0x2f079c,null));};exports[_0xd2eb('0x27')]=function(_0x543cc4,_0x1b8bb9){return db['SquareMessage']['find']({'where':{'id':_0x543cc4[_0xd2eb('0x47')]['id']}})[_0xd2eb('0x26')](handleEntityNotFound(_0x1b8bb9,null))['then'](removeEntity(_0x1b8bb9,null))[_0xd2eb('0x45')](handleError(_0x1b8bb9,null));}; \ No newline at end of file +var _0x714d=['zip-dir','request-promise','moment','bluebird','util','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','count','status','Content-Range','apply','reject','save','update','then','destroy','name','send','index','map','SquareMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','findAll','rows','catch','show','params','fields','length','include','options','find','create','body','rimraf'];(function(_0x558bc1,_0x308d0c){var _0x3e9e05=function(_0x42bf65){while(--_0x42bf65){_0x558bc1['push'](_0x558bc1['shift']());}};_0x3e9e05(++_0x308d0c);}(_0x714d,0x167));var _0xd714=function(_0x22faeb,_0x2af181){_0x22faeb=_0x22faeb-0x0;var _0x2fc703=_0x714d[_0x22faeb];return _0x2fc703;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd714('0x0'));var zipdir=require(_0xd714('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd714('0x2'));var moment=require(_0xd714('0x3'));var BPromise=require(_0xd714('0x4'));var Mustache=require('mustache');var util=require(_0xd714('0x5'));var path=require('path');var sox=require(_0xd714('0x6'));var csv=require('to-csv');var ejs=require(_0xd714('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd714('0x8'));var squel=require(_0xd714('0x9'));var crypto=require('crypto');var jsforce=require(_0xd714('0xa'));var deskjs=require(_0xd714('0xb'));var toCsv=require(_0xd714('0xc'));var querystring=require(_0xd714('0xd'));var Papa=require(_0xd714('0xe'));var Redis=require('ioredis');var authService=require(_0xd714('0xf'));var qs=require(_0xd714('0x10'));var as=require(_0xd714('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd714('0x12'))(_0xd714('0x13'));var utils=require('../../config/utils');var config=require(_0xd714('0x14'));var licenseUtil=require(_0xd714('0x15'));var db=require(_0xd714('0x16'))['db'];function respondWithStatusCode(_0x2aa4c0,_0x67a855){_0x67a855=_0x67a855||0xcc;return function(_0x5cd551){if(_0x5cd551){return _0x2aa4c0[_0xd714('0x17')](_0x67a855);}return _0x2aa4c0['status'](_0x67a855)[_0xd714('0x18')]();};}function respondWithResult(_0x4c8ca6,_0x112c68){_0x112c68=_0x112c68||0xc8;return function(_0x4a280a){if(_0x4a280a){return _0x4c8ca6['status'](_0x112c68)[_0xd714('0x19')](_0x4a280a);}};}function respondWithFilteredResult(_0x5db3a3,_0x322b33){return function(_0x1d9294){if(_0x1d9294){var _0x45a0a9=typeof _0x322b33[_0xd714('0x1a')]==='undefined'&&typeof _0x322b33[_0xd714('0x1b')]==='undefined';var _0x556e7f=_0x1d9294[_0xd714('0x1c')];var _0x167f32=_0x45a0a9?0x0:_0x322b33['offset'];var _0x2e1af1=_0x45a0a9?_0x1d9294[_0xd714('0x1c')]:_0x322b33[_0xd714('0x1a')]+_0x322b33[_0xd714('0x1b')];var _0x38c5ee;if(_0x2e1af1>=_0x556e7f){_0x2e1af1=_0x556e7f;_0x38c5ee=0xc8;}else{_0x38c5ee=0xce;}_0x5db3a3[_0xd714('0x1d')](_0x38c5ee);return _0x5db3a3['set'](_0xd714('0x1e'),_0x167f32+'-'+_0x2e1af1+'/'+_0x556e7f)['json'](_0x1d9294);}return null;};}function patchUpdates(_0x387688){return function(_0x17ba41){try{jsonpatch[_0xd714('0x1f')](_0x17ba41,_0x387688,!![]);}catch(_0xe1dc79){return BPromise[_0xd714('0x20')](_0xe1dc79);}return _0x17ba41[_0xd714('0x21')]();};}function saveUpdates(_0x4eabdd,_0x1c0c4b){return function(_0x2fbf0a){if(_0x2fbf0a){return _0x2fbf0a[_0xd714('0x22')](_0x4eabdd)[_0xd714('0x23')](function(_0xffcfd0){return _0xffcfd0;});}return null;};}function removeEntity(_0x32854f,_0x4e0756){return function(_0x1ebceb){if(_0x1ebceb){return _0x1ebceb[_0xd714('0x24')]()[_0xd714('0x23')](function(){_0x32854f[_0xd714('0x1d')](0xcc)[_0xd714('0x18')]();});}};}function handleEntityNotFound(_0x1bdd2e,_0x1f8e01){return function(_0x2a914b){if(!_0x2a914b){_0x1bdd2e[_0xd714('0x17')](0x194);}return _0x2a914b;};}function handleError(_0x34e03c,_0x1539ad){_0x1539ad=_0x1539ad||0x1f4;return function(_0x3f4d6b){logger['error'](_0x3f4d6b['stack']);if(_0x3f4d6b[_0xd714('0x25')]){delete _0x3f4d6b[_0xd714('0x25')];}_0x34e03c[_0xd714('0x1d')](_0x1539ad)[_0xd714('0x26')](_0x3f4d6b);};}exports[_0xd714('0x27')]=function(_0x4d27ae,_0x4ff215){var _0x2eea83={},_0x2c303b={},_0x2e96ac={'count':0x0,'rows':[]};var _0x4e9d75=_[_0xd714('0x28')](db[_0xd714('0x29')][_0xd714('0x2a')],function(_0x28d704){return{'name':_0x28d704[_0xd714('0x2b')],'type':_0x28d704[_0xd714('0x2c')][_0xd714('0x2d')]};});_0x2c303b[_0xd714('0x2e')]=_[_0xd714('0x28')](_0x4e9d75,_0xd714('0x25'));_0x2c303b[_0xd714('0x2f')]=_[_0xd714('0x30')](_0x4d27ae[_0xd714('0x2f')]);_0x2c303b[_0xd714('0x31')]=_[_0xd714('0x32')](_0x2c303b['model'],_0x2c303b[_0xd714('0x2f')]);_0x2eea83[_0xd714('0x33')]=_[_0xd714('0x32')](_0x2c303b[_0xd714('0x2e')],qs['fields'](_0x4d27ae['query']['fields']));_0x2eea83[_0xd714('0x33')]=_0x2eea83[_0xd714('0x33')]['length']?_0x2eea83[_0xd714('0x33')]:_0x2c303b[_0xd714('0x2e')];if(!_0x4d27ae[_0xd714('0x2f')]['hasOwnProperty']('nolimit')){_0x2eea83[_0xd714('0x1b')]=qs[_0xd714('0x1b')](_0x4d27ae[_0xd714('0x2f')][_0xd714('0x1b')]);_0x2eea83[_0xd714('0x1a')]=qs[_0xd714('0x1a')](_0x4d27ae[_0xd714('0x2f')][_0xd714('0x1a')]);}_0x2eea83[_0xd714('0x34')]=qs[_0xd714('0x35')](_0x4d27ae[_0xd714('0x2f')][_0xd714('0x35')]);_0x2eea83[_0xd714('0x36')]=qs[_0xd714('0x31')](_[_0xd714('0x37')](_0x4d27ae['query'],_0x2c303b[_0xd714('0x31')]),_0x4e9d75);if(_0x4d27ae['query'][_0xd714('0x38')]){_0x2eea83[_0xd714('0x36')]=_['merge'](_0x2eea83['where'],{'$or':_[_0xd714('0x28')](_0x4e9d75,function(_0x8767b2){if(_0x8767b2[_0xd714('0x2c')]!==_0xd714('0x39')){var _0x457350={};_0x457350[_0x8767b2[_0xd714('0x25')]]={'$like':'%'+_0x4d27ae['query'][_0xd714('0x38')]+'%'};return _0x457350;}})});}_0x2eea83=_[_0xd714('0x3a')]({},_0x2eea83,_0x4d27ae['options']);var _0x58dd45={'where':_0x2eea83[_0xd714('0x36')]};return db[_0xd714('0x29')][_0xd714('0x1c')](_0x58dd45)[_0xd714('0x23')](function(_0x14fe1b){_0x2e96ac[_0xd714('0x1c')]=_0x14fe1b;if(_0x4d27ae[_0xd714('0x2f')][_0xd714('0x3b')]){_0x2eea83['include']=[{'all':!![]}];}return db[_0xd714('0x29')][_0xd714('0x3c')](_0x2eea83);})['then'](function(_0x122a64){_0x2e96ac[_0xd714('0x3d')]=_0x122a64;return _0x2e96ac;})[_0xd714('0x23')](respondWithFilteredResult(_0x4ff215,_0x2eea83))[_0xd714('0x3e')](handleError(_0x4ff215,null));};exports[_0xd714('0x3f')]=function(_0x19b088,_0x385161){var _0x2cf60d={'raw':!![],'where':{'id':_0x19b088[_0xd714('0x40')]['id']}},_0x4f9bc7={};_0x4f9bc7[_0xd714('0x2e')]=_[_0xd714('0x30')](db[_0xd714('0x29')]['rawAttributes']);_0x4f9bc7[_0xd714('0x2f')]=_[_0xd714('0x30')](_0x19b088[_0xd714('0x2f')]);_0x4f9bc7[_0xd714('0x31')]=_[_0xd714('0x32')](_0x4f9bc7[_0xd714('0x2e')],_0x4f9bc7[_0xd714('0x2f')]);_0x2cf60d[_0xd714('0x33')]=_[_0xd714('0x32')](_0x4f9bc7['model'],qs['fields'](_0x19b088[_0xd714('0x2f')][_0xd714('0x41')]));_0x2cf60d[_0xd714('0x33')]=_0x2cf60d[_0xd714('0x33')][_0xd714('0x42')]?_0x2cf60d[_0xd714('0x33')]:_0x4f9bc7[_0xd714('0x2e')];if(_0x19b088[_0xd714('0x2f')]['includeAll']){_0x2cf60d[_0xd714('0x43')]=[{'all':!![]}];}_0x2cf60d=_[_0xd714('0x3a')]({},_0x2cf60d,_0x19b088[_0xd714('0x44')]);return db[_0xd714('0x29')][_0xd714('0x45')](_0x2cf60d)[_0xd714('0x23')](handleEntityNotFound(_0x385161,null))[_0xd714('0x23')](respondWithResult(_0x385161,null))[_0xd714('0x3e')](handleError(_0x385161,null));};exports[_0xd714('0x46')]=function(_0x5781e4,_0x4981d8){return db['SquareMessage'][_0xd714('0x46')](_0x5781e4[_0xd714('0x47')],{})['then'](respondWithResult(_0x4981d8,0xc9))[_0xd714('0x3e')](handleError(_0x4981d8,null));};exports[_0xd714('0x22')]=function(_0x50db5b,_0x197a92){if(_0x50db5b['body']['id']){delete _0x50db5b[_0xd714('0x47')]['id'];}return db[_0xd714('0x29')]['find']({'where':{'id':_0x50db5b['params']['id']}})[_0xd714('0x23')](handleEntityNotFound(_0x197a92,null))[_0xd714('0x23')](saveUpdates(_0x50db5b['body'],null))[_0xd714('0x23')](respondWithResult(_0x197a92,null))[_0xd714('0x3e')](handleError(_0x197a92,null));};exports[_0xd714('0x24')]=function(_0x5c1c63,_0xa4445c){return db['SquareMessage'][_0xd714('0x45')]({'where':{'id':_0x5c1c63[_0xd714('0x40')]['id']}})['then'](handleEntityNotFound(_0xa4445c,null))['then'](removeEntity(_0xa4445c,null))['catch'](handleError(_0xa4445c,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 2728378..92964fa 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 _0x58c1=['square_messages','util','../../config/logger','bluebird','request-promise','../../config/environment','./squareMessage.attributes','exports','define'];(function(_0x1278b6,_0x24252e){var _0x2cff42=function(_0x46b845){while(--_0x46b845){_0x1278b6['push'](_0x1278b6['shift']());}};_0x2cff42(++_0x24252e);}(_0x58c1,0x1b1));var _0x158c=function(_0x5ef2d7,_0x17b418){_0x5ef2d7=_0x5ef2d7-0x0;var _0x5398c4=_0x58c1[_0x5ef2d7];return _0x5398c4;};'use strict';var _=require('lodash');var util=require(_0x158c('0x0'));var logger=require(_0x158c('0x1'))('api');var moment=require('moment');var BPromise=require(_0x158c('0x2'));var rp=require(_0x158c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x158c('0x4'));var attributes=require(_0x158c('0x5'));module[_0x158c('0x6')]=function(_0x344bd9,_0x1b4a7a){return _0x344bd9[_0x158c('0x7')]('SquareMessage',attributes,{'tableName':_0x158c('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5d6e=['square_messages','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./squareMessage.attributes','SquareMessage'];(function(_0x2040b3,_0xb0abee){var _0x478d15=function(_0x5befdf){while(--_0x5befdf){_0x2040b3['push'](_0x2040b3['shift']());}};_0x478d15(++_0xb0abee);}(_0x5d6e,0xfe));var _0xe5d6=function(_0x15a34f,_0x1378ba){_0x15a34f=_0x15a34f-0x0;var _0x2e7b6b=_0x5d6e[_0x15a34f];return _0x2e7b6b;};'use strict';var _=require(_0xe5d6('0x0'));var util=require(_0xe5d6('0x1'));var logger=require(_0xe5d6('0x2'))(_0xe5d6('0x3'));var moment=require('moment');var BPromise=require(_0xe5d6('0x4'));var rp=require(_0xe5d6('0x5'));var fs=require('fs');var path=require(_0xe5d6('0x6'));var rimraf=require('rimraf');var config=require(_0xe5d6('0x7'));var attributes=require(_0xe5d6('0x8'));module['exports']=function(_0x319f83,_0x157c66){return _0x319f83['define'](_0xe5d6('0x9'),attributes,{'tableName':_0xe5d6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index d2183f2..52a2e81 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 _0xdcd6=['jayson/promise','http','request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateSquareMessage','SquareMessage','create','body','options','raw','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0xdcd6,0xa5));var _0x6dcd=function(_0x284bc3,_0x22dffe){_0x284bc3=_0x284bc3-0x0;var _0x41ac81=_0xdcd6[_0x284bc3];return _0x41ac81;};'use strict';var _=require(_0x6dcd('0x0'));var util=require(_0x6dcd('0x1'));var moment=require(_0x6dcd('0x2'));var BPromise=require(_0x6dcd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6dcd('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6dcd('0x5'));var logger=require(_0x6dcd('0x6'))(_0x6dcd('0x7'));var config=require(_0x6dcd('0x8'));var jayson=require(_0x6dcd('0x9'));var client=jayson['client'][_0x6dcd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x7c4faa,_0x604f0e,_0x168abd){return new BPromise(function(_0x5b0d73,_0x4eb85b){return client[_0x6dcd('0xb')](_0x7c4faa,_0x168abd)[_0x6dcd('0xc')](function(_0x6f28fd){logger[_0x6dcd('0xd')](_0x6dcd('0xe'),_0x604f0e,_0x6dcd('0xf'));logger[_0x6dcd('0x10')](_0x6dcd('0x11'),_0x604f0e,_0x6dcd('0xf'),JSON[_0x6dcd('0x12')](_0x6f28fd));if(_0x6f28fd['error']){if(_0x6f28fd[_0x6dcd('0x13')]['code']===0x1f4){logger[_0x6dcd('0x13')](_0x6dcd('0xe'),_0x604f0e,_0x6f28fd['error']['message']);return _0x4eb85b(_0x6f28fd[_0x6dcd('0x13')][_0x6dcd('0x14')]);}logger[_0x6dcd('0x13')](_0x6dcd('0xe'),_0x604f0e,_0x6f28fd[_0x6dcd('0x13')]['message']);return _0x5b0d73(_0x6f28fd[_0x6dcd('0x13')]['message']);}else{logger[_0x6dcd('0xd')]('SquareMessage,\x20%s,\x20%s',_0x604f0e,_0x6dcd('0xf'));_0x5b0d73(_0x6f28fd[_0x6dcd('0x15')]['message']);}})[_0x6dcd('0x16')](function(_0x180b75){logger[_0x6dcd('0x13')]('SquareMessage,\x20%s,\x20%s',_0x604f0e,_0x180b75);_0x4eb85b(_0x180b75);});});}exports[_0x6dcd('0x17')]=function(_0x154fe8){var _0xe2dc12=this;return new Promise(function(_0x44ac56,_0xbae24d){return db[_0x6dcd('0x18')][_0x6dcd('0x19')](_0x154fe8[_0x6dcd('0x1a')],{'raw':_0x154fe8[_0x6dcd('0x1b')]?_0x154fe8[_0x6dcd('0x1b')][_0x6dcd('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x2e7673){logger[_0x6dcd('0xd')]('CreateSquareMessage',_0x154fe8);logger[_0x6dcd('0x10')](_0x6dcd('0x17'),_0x154fe8,JSON[_0x6dcd('0x12')](_0x2e7673));_0x44ac56(_0x2e7673);})['catch'](function(_0x3abdf6){logger[_0x6dcd('0x13')](_0x6dcd('0x17'),_0x3abdf6['message'],_0x154fe8);_0xbae24d(_0xe2dc12[_0x6dcd('0x13')](0x1f4,_0x3abdf6[_0x6dcd('0x14')]));});});}; \ No newline at end of file +var _0x8c4c=['request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateSquareMessage','SquareMessage','create','body','options','raw','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http'];(function(_0x35fb81,_0x5e750d){var _0x15440b=function(_0x3a924f){while(--_0x3a924f){_0x35fb81['push'](_0x35fb81['shift']());}};_0x15440b(++_0x5e750d);}(_0x8c4c,0x65));var _0xc8c4=function(_0x237d31,_0x3428d4){_0x237d31=_0x237d31-0x0;var _0x49fb19=_0x8c4c[_0x237d31];return _0x49fb19;};'use strict';var _=require(_0xc8c4('0x0'));var util=require(_0xc8c4('0x1'));var moment=require(_0xc8c4('0x2'));var BPromise=require(_0xc8c4('0x3'));var rs=require(_0xc8c4('0x4'));var fs=require('fs');var Redis=require(_0xc8c4('0x5'));var db=require(_0xc8c4('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xc8c4('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc8c4('0x8'));var client=jayson[_0xc8c4('0x9')][_0xc8c4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x591c24,_0x4e7a59,_0x5da2e7){return new BPromise(function(_0x254a99,_0x33f0ec){return client[_0xc8c4('0xb')](_0x591c24,_0x5da2e7)[_0xc8c4('0xc')](function(_0x51cc0a){logger[_0xc8c4('0xd')](_0xc8c4('0xe'),_0x4e7a59,_0xc8c4('0xf'));logger['debug']('SquareMessage,\x20%s,\x20%s,\x20%s',_0x4e7a59,_0xc8c4('0xf'),JSON[_0xc8c4('0x10')](_0x51cc0a));if(_0x51cc0a[_0xc8c4('0x11')]){if(_0x51cc0a['error']['code']===0x1f4){logger[_0xc8c4('0x11')]('SquareMessage,\x20%s,\x20%s',_0x4e7a59,_0x51cc0a['error'][_0xc8c4('0x12')]);return _0x33f0ec(_0x51cc0a[_0xc8c4('0x11')][_0xc8c4('0x12')]);}logger[_0xc8c4('0x11')]('SquareMessage,\x20%s,\x20%s',_0x4e7a59,_0x51cc0a[_0xc8c4('0x11')]['message']);return _0x254a99(_0x51cc0a['error']['message']);}else{logger[_0xc8c4('0xd')](_0xc8c4('0xe'),_0x4e7a59,'request\x20sent');_0x254a99(_0x51cc0a[_0xc8c4('0x13')][_0xc8c4('0x12')]);}})[_0xc8c4('0x14')](function(_0x3601ff){logger[_0xc8c4('0x11')]('SquareMessage,\x20%s,\x20%s',_0x4e7a59,_0x3601ff);_0x33f0ec(_0x3601ff);});});}exports[_0xc8c4('0x15')]=function(_0x36f5e6){var _0x24ac2c=this;return new Promise(function(_0x1b37a1,_0x523ce7){return db[_0xc8c4('0x16')][_0xc8c4('0x17')](_0x36f5e6[_0xc8c4('0x18')],{'raw':_0x36f5e6[_0xc8c4('0x19')]?_0x36f5e6[_0xc8c4('0x19')][_0xc8c4('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x542edf){logger['info']('CreateSquareMessage',_0x36f5e6);logger[_0xc8c4('0x1b')](_0xc8c4('0x15'),_0x36f5e6,JSON['stringify'](_0x542edf));_0x1b37a1(_0x542edf);})[_0xc8c4('0x14')](function(_0x474478){logger['error'](_0xc8c4('0x15'),_0x474478['message'],_0x36f5e6);_0x523ce7(_0x24ac2c[_0xc8c4('0x11')](0x1f4,_0x474478[_0xc8c4('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 68f9518..25b1ab6 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 _0x4432=['path','Router','fs-extra','../../components/auth/service','../../config/environment','./squareOdbc.controller','isAuthenticated','index','get','/:id','show','/:id/test','15s','test','post','create','put','update','delete','exports','util'];(function(_0x3b8c45,_0x2a410b){var _0x3980d6=function(_0xa40d9e){while(--_0xa40d9e){_0x3b8c45['push'](_0x3b8c45['shift']());}};_0x3980d6(++_0x2a410b);}(_0x4432,0x164));var _0x2443=function(_0x45b97f,_0x3b9d0e){_0x45b97f=_0x45b97f-0x0;var _0x3911a2=_0x4432[_0x45b97f];return _0x3911a2;};'use strict';var multer=require('multer');var util=require(_0x2443('0x0'));var path=require(_0x2443('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2443('0x2')]();var fs_extra=require(_0x2443('0x3'));var auth=require(_0x2443('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2443('0x5'));var controller=require(_0x2443('0x6'));router['get']('/',auth[_0x2443('0x7')](),controller[_0x2443('0x8')]);router[_0x2443('0x9')](_0x2443('0xa'),auth['isAuthenticated'](),controller[_0x2443('0xb')]);router['get'](_0x2443('0xc'),auth[_0x2443('0x7')](),timeout(_0x2443('0xd')),controller[_0x2443('0xe')]);router[_0x2443('0xf')]('/',auth[_0x2443('0x7')](),controller[_0x2443('0x10')]);router[_0x2443('0x11')](_0x2443('0xa'),auth[_0x2443('0x7')](),controller[_0x2443('0x12')]);router[_0x2443('0x13')](_0x2443('0xa'),auth[_0x2443('0x7')](),controller['destroy']);module[_0x2443('0x14')]=router; \ No newline at end of file +var _0x048b=['fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id','show','/:id/test','15s','test','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x5649b2,_0x3eb78c){var _0x51d2ad=function(_0x1e9864){while(--_0x1e9864){_0x5649b2['push'](_0x5649b2['shift']());}};_0x51d2ad(++_0x3eb78c);}(_0x048b,0x198));var _0xb048=function(_0x42e64d,_0x2eeba9){_0x42e64d=_0x42e64d-0x0;var _0x5a8603=_0x048b[_0x42e64d];return _0x5a8603;};'use strict';var multer=require(_0xb048('0x0'));var util=require(_0xb048('0x1'));var path=require(_0xb048('0x2'));var timeout=require(_0xb048('0x3'));var express=require(_0xb048('0x4'));var router=express[_0xb048('0x5')]();var fs_extra=require(_0xb048('0x6'));var auth=require(_0xb048('0x7'));var interaction=require(_0xb048('0x8'));var config=require('../../config/environment');var controller=require('./squareOdbc.controller');router['get']('/',auth[_0xb048('0x9')](),controller[_0xb048('0xa')]);router[_0xb048('0xb')](_0xb048('0xc'),auth[_0xb048('0x9')](),controller[_0xb048('0xd')]);router['get'](_0xb048('0xe'),auth['isAuthenticated'](),timeout(_0xb048('0xf')),controller[_0xb048('0x10')]);router[_0xb048('0x11')]('/',auth[_0xb048('0x9')](),controller['create']);router[_0xb048('0x12')](_0xb048('0xc'),auth[_0xb048('0x9')](),controller[_0xb048('0x13')]);router[_0xb048('0x14')](_0xb048('0xc'),auth['isAuthenticated'](),controller[_0xb048('0x15')]);module[_0xb048('0x16')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 437ca09..2fb1c21 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 _0x0ca7=['STRING','sequelize','exports','name'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0ca7,0x11d));var _0x70ca=function(_0x1cd585,_0x54276b){_0x1cd585=_0x1cd585-0x0;var _0x3ca87f=_0x0ca7[_0x1cd585];return _0x3ca87f;};'use strict';var Sequelize=require(_0x70ca('0x0'));module[_0x70ca('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x70ca('0x2'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x70ca('0x3')]}}; \ No newline at end of file +var _0xf068=['STRING','sequelize','exports','name'];(function(_0x592566,_0x15f055){var _0x4383e5=function(_0x7cfe5a){while(--_0x7cfe5a){_0x592566['push'](_0x592566['shift']());}};_0x4383e5(++_0x15f055);}(_0xf068,0x129));var _0x8f06=function(_0x547f6c,_0x1e1698){_0x547f6c=_0x547f6c-0x0;var _0x2b9b23=_0xf068[_0x547f6c];return _0x2b9b23;};'use strict';var Sequelize=require(_0x8f06('0x0'));module[_0x8f06('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x8f06('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0x8f06('0x3')]},'description':{'type':Sequelize[_0x8f06('0x3')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 8c062f1..3bdaf1e 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 _0x30c1=['hasOwnProperty','nolimit','sort','pick','filters','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','keys','rawAttributes','find','create','body','user','ODBC','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','test','dsn','odbc','openSync','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','lodash','crypto','to-csv','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','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','get','UserProfileResource','error','send','index','map','SquareOdbc','key','name','query','intersection','model','attributes','fields'];(function(_0x930779,_0x29d865){var _0x1a3652=function(_0x208d4e){while(--_0x208d4e){_0x930779['push'](_0x930779['shift']());}};_0x1a3652(++_0x29d865);}(_0x30c1,0xc4));var _0x130c=function(_0x56bc0a,_0x42a7cf){_0x56bc0a=_0x56bc0a-0x0;var _0x521c65=_0x30c1[_0x56bc0a];return _0x521c65;};'use strict';var emlformat=require(_0x130c('0x0'));var rimraf=require(_0x130c('0x1'));var zipdir=require(_0x130c('0x2'));var jsonpatch=require(_0x130c('0x3'));var rp=require('request-promise');var moment=require(_0x130c('0x4'));var BPromise=require(_0x130c('0x5'));var Mustache=require(_0x130c('0x6'));var util=require(_0x130c('0x7'));var path=require(_0x130c('0x8'));var sox=require(_0x130c('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x130c('0xa'));var squel=require('squel');var crypto=require(_0x130c('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x130c('0xc'));var querystring=require(_0x130c('0xd'));var Papa=require(_0x130c('0xe'));var Redis=require('ioredis');var authService=require(_0x130c('0xf'));var qs=require(_0x130c('0x10'));var as=require(_0x130c('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x130c('0x12'))(_0x130c('0x13'));var utils=require(_0x130c('0x14'));var config=require(_0x130c('0x15'));var licenseUtil=require(_0x130c('0x16'));var db=require(_0x130c('0x17'))['db'];function respondWithStatusCode(_0xbe6697,_0x241192){_0x241192=_0x241192||0xcc;return function(_0x240b7b){if(_0x240b7b){return _0xbe6697[_0x130c('0x18')](_0x241192);}return _0xbe6697[_0x130c('0x19')](_0x241192)[_0x130c('0x1a')]();};}function respondWithResult(_0x13d239,_0x1c7062){_0x1c7062=_0x1c7062||0xc8;return function(_0x512268){if(_0x512268){return _0x13d239[_0x130c('0x19')](_0x1c7062)[_0x130c('0x1b')](_0x512268);}};}function respondWithFilteredResult(_0x5055c5,_0x4fdfa4){return function(_0x550751){if(_0x550751){var _0x485138=typeof _0x4fdfa4[_0x130c('0x1c')]===_0x130c('0x1d')&&typeof _0x4fdfa4['limit']===_0x130c('0x1d');var _0x3ada6a=_0x550751[_0x130c('0x1e')];var _0x4cc53b=_0x485138?0x0:_0x4fdfa4['offset'];var _0x311c7d=_0x485138?_0x550751['count']:_0x4fdfa4['offset']+_0x4fdfa4[_0x130c('0x1f')];var _0x551a24;if(_0x311c7d>=_0x3ada6a){_0x311c7d=_0x3ada6a;_0x551a24=0xc8;}else{_0x551a24=0xce;}_0x5055c5[_0x130c('0x19')](_0x551a24);return _0x5055c5[_0x130c('0x20')](_0x130c('0x21'),_0x4cc53b+'-'+_0x311c7d+'/'+_0x3ada6a)['json'](_0x550751);}return null;};}function patchUpdates(_0x563398){return function(_0x2a86a9){try{jsonpatch['apply'](_0x2a86a9,_0x563398,!![]);}catch(_0x3d8199){return BPromise[_0x130c('0x22')](_0x3d8199);}return _0x2a86a9[_0x130c('0x23')]();};}function saveUpdates(_0x440035,_0x4f6c14){return function(_0x5234ac){if(_0x5234ac){return _0x5234ac[_0x130c('0x24')](_0x440035)[_0x130c('0x25')](function(_0x512e78){return _0x512e78;});}return null;};}function removeEntity(_0x426909,_0x4cfa3b){return function(_0x6f8822){if(_0x6f8822){return _0x6f8822[_0x130c('0x26')]()['then'](function(){var _0x126e83=_0x6f8822[_0x130c('0x27')]({'plain':!![]});var _0x4d34fc='ODBC';return db[_0x130c('0x28')][_0x130c('0x26')]({'where':{'type':_0x4d34fc,'resourceId':_0x126e83['id']}})[_0x130c('0x25')](function(){return _0x6f8822;});})[_0x130c('0x25')](function(){_0x426909[_0x130c('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x427630,_0xfcef9a){return function(_0x353854){if(!_0x353854){_0x427630[_0x130c('0x18')](0x194);}return _0x353854;};}function handleError(_0x4e857f,_0x133341){_0x133341=_0x133341||0x1f4;return function(_0x1bb469){logger[_0x130c('0x29')](_0x1bb469['stack']);if(_0x1bb469['name']){delete _0x1bb469['name'];}_0x4e857f[_0x130c('0x19')](_0x133341)[_0x130c('0x2a')](_0x1bb469);};}exports[_0x130c('0x2b')]=function(_0x4a79f3,_0x5612ca){var _0x1a3c80={},_0x3b86ac={},_0x2d6e35={'count':0x0,'rows':[]};var _0x274e65=_[_0x130c('0x2c')](db[_0x130c('0x2d')]['rawAttributes'],function(_0x46c453){return{'name':_0x46c453['fieldName'],'type':_0x46c453['type'][_0x130c('0x2e')]};});_0x3b86ac['model']=_[_0x130c('0x2c')](_0x274e65,_0x130c('0x2f'));_0x3b86ac[_0x130c('0x30')]=_['keys'](_0x4a79f3[_0x130c('0x30')]);_0x3b86ac['filters']=_[_0x130c('0x31')](_0x3b86ac[_0x130c('0x32')],_0x3b86ac[_0x130c('0x30')]);_0x1a3c80[_0x130c('0x33')]=_[_0x130c('0x31')](_0x3b86ac[_0x130c('0x32')],qs['fields'](_0x4a79f3[_0x130c('0x30')][_0x130c('0x34')]));_0x1a3c80[_0x130c('0x33')]=_0x1a3c80[_0x130c('0x33')]['length']?_0x1a3c80[_0x130c('0x33')]:_0x3b86ac[_0x130c('0x32')];if(!_0x4a79f3[_0x130c('0x30')][_0x130c('0x35')](_0x130c('0x36'))){_0x1a3c80[_0x130c('0x1f')]=qs[_0x130c('0x1f')](_0x4a79f3[_0x130c('0x30')][_0x130c('0x1f')]);_0x1a3c80[_0x130c('0x1c')]=qs[_0x130c('0x1c')](_0x4a79f3[_0x130c('0x30')][_0x130c('0x1c')]);}_0x1a3c80['order']=qs[_0x130c('0x37')](_0x4a79f3[_0x130c('0x30')][_0x130c('0x37')]);_0x1a3c80['where']=qs['filters'](_[_0x130c('0x38')](_0x4a79f3[_0x130c('0x30')],_0x3b86ac[_0x130c('0x39')]),_0x274e65);if(_0x4a79f3[_0x130c('0x30')][_0x130c('0x3a')]){_0x1a3c80[_0x130c('0x3b')]=_[_0x130c('0x3c')](_0x1a3c80['where'],{'$or':_[_0x130c('0x2c')](_0x274e65,function(_0x59b348){if(_0x59b348['type']!==_0x130c('0x3d')){var _0x1ec386={};_0x1ec386[_0x59b348['name']]={'$like':'%'+_0x4a79f3[_0x130c('0x30')][_0x130c('0x3a')]+'%'};return _0x1ec386;}})});}_0x1a3c80=_[_0x130c('0x3c')]({},_0x1a3c80,_0x4a79f3[_0x130c('0x3e')]);var _0x58cc4c={'where':_0x1a3c80[_0x130c('0x3b')]};return db['SquareOdbc'][_0x130c('0x1e')](_0x58cc4c)[_0x130c('0x25')](function(_0x22a4e0){_0x2d6e35[_0x130c('0x1e')]=_0x22a4e0;if(_0x4a79f3[_0x130c('0x30')][_0x130c('0x3f')]){_0x1a3c80[_0x130c('0x40')]=[{'all':!![]}];}return db[_0x130c('0x2d')][_0x130c('0x41')](_0x1a3c80);})[_0x130c('0x25')](function(_0x3a0f72){_0x2d6e35[_0x130c('0x42')]=_0x3a0f72;return _0x2d6e35;})[_0x130c('0x25')](respondWithFilteredResult(_0x5612ca,_0x1a3c80))[_0x130c('0x43')](handleError(_0x5612ca,null));};exports['show']=function(_0x20b7f3,_0x42036e){var _0x127c2e={'raw':!![],'where':{'id':_0x20b7f3['params']['id']}},_0x12b1fa={};_0x12b1fa[_0x130c('0x32')]=_[_0x130c('0x44')](db[_0x130c('0x2d')][_0x130c('0x45')]);_0x12b1fa[_0x130c('0x30')]=_[_0x130c('0x44')](_0x20b7f3['query']);_0x12b1fa[_0x130c('0x39')]=_[_0x130c('0x31')](_0x12b1fa['model'],_0x12b1fa[_0x130c('0x30')]);_0x127c2e[_0x130c('0x33')]=_[_0x130c('0x31')](_0x12b1fa[_0x130c('0x32')],qs[_0x130c('0x34')](_0x20b7f3[_0x130c('0x30')]['fields']));_0x127c2e[_0x130c('0x33')]=_0x127c2e[_0x130c('0x33')]['length']?_0x127c2e[_0x130c('0x33')]:_0x12b1fa[_0x130c('0x32')];if(_0x20b7f3[_0x130c('0x30')][_0x130c('0x3f')]){_0x127c2e[_0x130c('0x40')]=[{'all':!![]}];}_0x127c2e=_['merge']({},_0x127c2e,_0x20b7f3[_0x130c('0x3e')]);return db[_0x130c('0x2d')][_0x130c('0x46')](_0x127c2e)[_0x130c('0x25')](handleEntityNotFound(_0x42036e,null))[_0x130c('0x25')](respondWithResult(_0x42036e,null))['catch'](handleError(_0x42036e,null));};exports[_0x130c('0x47')]=function(_0x2f15d9,_0x693bf){return db['SquareOdbc']['create'](_0x2f15d9[_0x130c('0x48')],{})[_0x130c('0x25')](function(_0x2ddd78){var _0x14f8ae=_0x2f15d9[_0x130c('0x49')][_0x130c('0x27')]({'plain':!![]});if(!_0x14f8ae)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x14f8ae['role']===_0x130c('0x49')){var _0x378851=_0x2ddd78[_0x130c('0x27')]({'plain':!![]});var _0x4f2850=_0x130c('0x4a');return db[_0x130c('0x4b')][_0x130c('0x46')]({'where':{'name':_0x4f2850,'userProfileId':_0x14f8ae['userProfileId']},'raw':!![]})[_0x130c('0x25')](function(_0x496ee6){if(_0x496ee6&&_0x496ee6[_0x130c('0x4c')]===0x0){return db[_0x130c('0x28')][_0x130c('0x47')]({'name':_0x378851[_0x130c('0x2f')],'resourceId':_0x378851['id'],'type':_0x496ee6[_0x130c('0x2f')],'sectionId':_0x496ee6['id']},{})[_0x130c('0x25')](function(){return _0x2ddd78;});}else{return _0x2ddd78;}})['catch'](function(_0x17e65d){logger[_0x130c('0x29')](_0x130c('0x4d'),_0x17e65d);throw _0x17e65d;});}return _0x2ddd78;})['then'](respondWithResult(_0x693bf,0xc9))[_0x130c('0x43')](handleError(_0x693bf,null));};exports[_0x130c('0x24')]=function(_0x5425fb,_0x54b92c){if(_0x5425fb[_0x130c('0x48')]['id']){delete _0x5425fb[_0x130c('0x48')]['id'];}return db[_0x130c('0x2d')]['find']({'where':{'id':_0x5425fb[_0x130c('0x4e')]['id']}})[_0x130c('0x25')](handleEntityNotFound(_0x54b92c,null))[_0x130c('0x25')](saveUpdates(_0x5425fb[_0x130c('0x48')],null))[_0x130c('0x25')](respondWithResult(_0x54b92c,null))[_0x130c('0x43')](handleError(_0x54b92c,null));};exports[_0x130c('0x26')]=function(_0x32c833,_0x33223e){return db[_0x130c('0x2d')][_0x130c('0x46')]({'where':{'id':_0x32c833[_0x130c('0x4e')]['id']}})[_0x130c('0x25')](handleEntityNotFound(_0x33223e,null))['then'](removeEntity(_0x33223e,null))['catch'](handleError(_0x33223e,null));};exports[_0x130c('0x4f')]=function(_0x10a056,_0x24043a,_0x2d54bc){var _0x438a59;return db[_0x130c('0x2d')][_0x130c('0x46')]({'where':{'id':_0x10a056[_0x130c('0x4e')]['id']},'attributes':['id',_0x130c('0x50')]})['then'](handleEntityNotFound(_0x24043a,null))[_0x130c('0x25')](function(_0x2ea7f9){if(_0x2ea7f9){var _0x510095=require(_0x130c('0x51'))();_0x510095[_0x130c('0x52')](_0x2ea7f9[_0x130c('0x50')]);_0x510095['closeSync']();return _0x2ea7f9;}})[_0x130c('0x25')](respondWithResult(_0x24043a,null))[_0x130c('0x43')](handleError(_0x24043a,null));}; \ No newline at end of file +var _0x05b2=['fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','undefined','limit','count','offset','set','Content-Range','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','index','map','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','VIRTUAL','includeAll','SquareOdbc','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','ODBC','UserProfileSection','userProfileId','autoAssociation','test','dsn','odbc','openSync','closeSync','eml-format','rimraf','zip-dir'];(function(_0x49f6ae,_0x2f75b6){var _0x3e4d37=function(_0x372c54){while(--_0x372c54){_0x49f6ae['push'](_0x49f6ae['shift']());}};_0x3e4d37(++_0x2f75b6);}(_0x05b2,0x1a1));var _0x205b=function(_0x5bb607,_0x13435b){_0x5bb607=_0x5bb607-0x0;var _0x3b1657=_0x05b2[_0x5bb607];return _0x3b1657;};'use strict';var emlformat=require(_0x205b('0x0'));var rimraf=require(_0x205b('0x1'));var zipdir=require(_0x205b('0x2'));var jsonpatch=require(_0x205b('0x3'));var rp=require(_0x205b('0x4'));var moment=require('moment');var BPromise=require(_0x205b('0x5'));var Mustache=require(_0x205b('0x6'));var util=require(_0x205b('0x7'));var path=require(_0x205b('0x8'));var sox=require('sox');var csv=require(_0x205b('0x9'));var ejs=require(_0x205b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x205b('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x205b('0xc'));var deskjs=require(_0x205b('0xd'));var toCsv=require(_0x205b('0x9'));var querystring=require('querystring');var Papa=require(_0x205b('0xe'));var Redis=require('ioredis');var authService=require(_0x205b('0xf'));var qs=require(_0x205b('0x10'));var as=require(_0x205b('0x11'));var hardwareService=require(_0x205b('0x12'));var logger=require(_0x205b('0x13'))(_0x205b('0x14'));var utils=require(_0x205b('0x15'));var config=require(_0x205b('0x16'));var licenseUtil=require(_0x205b('0x17'));var db=require(_0x205b('0x18'))['db'];function respondWithStatusCode(_0x3ca599,_0x222bb7){_0x222bb7=_0x222bb7||0xcc;return function(_0x1dd99d){if(_0x1dd99d){return _0x3ca599['sendStatus'](_0x222bb7);}return _0x3ca599['status'](_0x222bb7)[_0x205b('0x19')]();};}function respondWithResult(_0xe327a5,_0x4b69ab){_0x4b69ab=_0x4b69ab||0xc8;return function(_0xeffc48){if(_0xeffc48){return _0xe327a5[_0x205b('0x1a')](_0x4b69ab)[_0x205b('0x1b')](_0xeffc48);}};}function respondWithFilteredResult(_0x1a370e,_0x156267){return function(_0xd20fe5){if(_0xd20fe5){var _0x3c8d72=typeof _0x156267['offset']===_0x205b('0x1c')&&typeof _0x156267[_0x205b('0x1d')]===_0x205b('0x1c');var _0x33e210=_0xd20fe5[_0x205b('0x1e')];var _0x5950cb=_0x3c8d72?0x0:_0x156267[_0x205b('0x1f')];var _0x53d0d3=_0x3c8d72?_0xd20fe5[_0x205b('0x1e')]:_0x156267[_0x205b('0x1f')]+_0x156267[_0x205b('0x1d')];var _0x190ea3;if(_0x53d0d3>=_0x33e210){_0x53d0d3=_0x33e210;_0x190ea3=0xc8;}else{_0x190ea3=0xce;}_0x1a370e['status'](_0x190ea3);return _0x1a370e[_0x205b('0x20')](_0x205b('0x21'),_0x5950cb+'-'+_0x53d0d3+'/'+_0x33e210)[_0x205b('0x1b')](_0xd20fe5);}return null;};}function patchUpdates(_0x28d529){return function(_0x3c21cc){try{jsonpatch['apply'](_0x3c21cc,_0x28d529,!![]);}catch(_0x45bfa5){return BPromise['reject'](_0x45bfa5);}return _0x3c21cc['save']();};}function saveUpdates(_0x3beb91,_0x17e7b2){return function(_0x479a0f){if(_0x479a0f){return _0x479a0f[_0x205b('0x22')](_0x3beb91)[_0x205b('0x23')](function(_0x227578){return _0x227578;});}return null;};}function removeEntity(_0x24dbe9,_0x295657){return function(_0x269ace){if(_0x269ace){return _0x269ace[_0x205b('0x24')]()['then'](function(){var _0x5dafb2=_0x269ace[_0x205b('0x25')]({'plain':!![]});var _0x1f4fa1='ODBC';return db[_0x205b('0x26')][_0x205b('0x24')]({'where':{'type':_0x1f4fa1,'resourceId':_0x5dafb2['id']}})[_0x205b('0x23')](function(){return _0x269ace;});})['then'](function(){_0x24dbe9['status'](0xcc)[_0x205b('0x19')]();});}};}function handleEntityNotFound(_0xe99c6c,_0x4e2c57){return function(_0x259dbb){if(!_0x259dbb){_0xe99c6c[_0x205b('0x27')](0x194);}return _0x259dbb;};}function handleError(_0x3a4809,_0x575455){_0x575455=_0x575455||0x1f4;return function(_0x800fb3){logger[_0x205b('0x28')](_0x800fb3[_0x205b('0x29')]);if(_0x800fb3[_0x205b('0x2a')]){delete _0x800fb3[_0x205b('0x2a')];}_0x3a4809[_0x205b('0x1a')](_0x575455)['send'](_0x800fb3);};}exports[_0x205b('0x2b')]=function(_0x4862fb,_0x18f445){var _0x4c68d2={},_0x4f2ada={},_0x46eff6={'count':0x0,'rows':[]};var _0x1950d1=_[_0x205b('0x2c')](db['SquareOdbc']['rawAttributes'],function(_0x210471){return{'name':_0x210471[_0x205b('0x2d')],'type':_0x210471['type'][_0x205b('0x2e')]};});_0x4f2ada[_0x205b('0x2f')]=_[_0x205b('0x2c')](_0x1950d1,_0x205b('0x2a'));_0x4f2ada[_0x205b('0x30')]=_[_0x205b('0x31')](_0x4862fb[_0x205b('0x30')]);_0x4f2ada['filters']=_[_0x205b('0x32')](_0x4f2ada[_0x205b('0x2f')],_0x4f2ada[_0x205b('0x30')]);_0x4c68d2[_0x205b('0x33')]=_[_0x205b('0x32')](_0x4f2ada[_0x205b('0x2f')],qs[_0x205b('0x34')](_0x4862fb[_0x205b('0x30')][_0x205b('0x34')]));_0x4c68d2['attributes']=_0x4c68d2[_0x205b('0x33')][_0x205b('0x35')]?_0x4c68d2[_0x205b('0x33')]:_0x4f2ada[_0x205b('0x2f')];if(!_0x4862fb[_0x205b('0x30')][_0x205b('0x36')](_0x205b('0x37'))){_0x4c68d2[_0x205b('0x1d')]=qs['limit'](_0x4862fb[_0x205b('0x30')][_0x205b('0x1d')]);_0x4c68d2[_0x205b('0x1f')]=qs[_0x205b('0x1f')](_0x4862fb['query'][_0x205b('0x1f')]);}_0x4c68d2['order']=qs[_0x205b('0x38')](_0x4862fb[_0x205b('0x30')][_0x205b('0x38')]);_0x4c68d2[_0x205b('0x39')]=qs['filters'](_[_0x205b('0x3a')](_0x4862fb[_0x205b('0x30')],_0x4f2ada[_0x205b('0x3b')]),_0x1950d1);if(_0x4862fb[_0x205b('0x30')][_0x205b('0x3c')]){_0x4c68d2[_0x205b('0x39')]=_[_0x205b('0x3d')](_0x4c68d2[_0x205b('0x39')],{'$or':_[_0x205b('0x2c')](_0x1950d1,function(_0x2ff5ec){if(_0x2ff5ec['type']!==_0x205b('0x3e')){var _0x4309a3={};_0x4309a3[_0x2ff5ec[_0x205b('0x2a')]]={'$like':'%'+_0x4862fb[_0x205b('0x30')][_0x205b('0x3c')]+'%'};return _0x4309a3;}})});}_0x4c68d2=_[_0x205b('0x3d')]({},_0x4c68d2,_0x4862fb['options']);var _0x2f163e={'where':_0x4c68d2['where']};return db['SquareOdbc'][_0x205b('0x1e')](_0x2f163e)[_0x205b('0x23')](function(_0x6d7d02){_0x46eff6[_0x205b('0x1e')]=_0x6d7d02;if(_0x4862fb[_0x205b('0x30')][_0x205b('0x3f')]){_0x4c68d2['include']=[{'all':!![]}];}return db[_0x205b('0x40')][_0x205b('0x41')](_0x4c68d2);})[_0x205b('0x23')](function(_0x1e7365){_0x46eff6[_0x205b('0x42')]=_0x1e7365;return _0x46eff6;})[_0x205b('0x23')](respondWithFilteredResult(_0x18f445,_0x4c68d2))[_0x205b('0x43')](handleError(_0x18f445,null));};exports[_0x205b('0x44')]=function(_0x1989ef,_0x53237b){var _0xb6f5da={'raw':!![],'where':{'id':_0x1989ef[_0x205b('0x45')]['id']}},_0x5b2b5b={};_0x5b2b5b['model']=_[_0x205b('0x31')](db[_0x205b('0x40')][_0x205b('0x46')]);_0x5b2b5b[_0x205b('0x30')]=_['keys'](_0x1989ef[_0x205b('0x30')]);_0x5b2b5b[_0x205b('0x3b')]=_['intersection'](_0x5b2b5b[_0x205b('0x2f')],_0x5b2b5b[_0x205b('0x30')]);_0xb6f5da[_0x205b('0x33')]=_[_0x205b('0x32')](_0x5b2b5b[_0x205b('0x2f')],qs[_0x205b('0x34')](_0x1989ef[_0x205b('0x30')][_0x205b('0x34')]));_0xb6f5da[_0x205b('0x33')]=_0xb6f5da[_0x205b('0x33')]['length']?_0xb6f5da[_0x205b('0x33')]:_0x5b2b5b[_0x205b('0x2f')];if(_0x1989ef['query'][_0x205b('0x3f')]){_0xb6f5da['include']=[{'all':!![]}];}_0xb6f5da=_['merge']({},_0xb6f5da,_0x1989ef[_0x205b('0x47')]);return db[_0x205b('0x40')][_0x205b('0x48')](_0xb6f5da)[_0x205b('0x23')](handleEntityNotFound(_0x53237b,null))[_0x205b('0x23')](respondWithResult(_0x53237b,null))[_0x205b('0x43')](handleError(_0x53237b,null));};exports[_0x205b('0x49')]=function(_0xb7afc5,_0x42b69b){return db[_0x205b('0x40')]['create'](_0xb7afc5[_0x205b('0x4a')],{})[_0x205b('0x23')](function(_0x349f81){var _0x11f0a6=_0xb7afc5['user'][_0x205b('0x25')]({'plain':!![]});if(!_0x11f0a6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x11f0a6['role']==='user'){var _0x22e6ab=_0x349f81[_0x205b('0x25')]({'plain':!![]});var _0x4c833b=_0x205b('0x4b');return db[_0x205b('0x4c')][_0x205b('0x48')]({'where':{'name':_0x4c833b,'userProfileId':_0x11f0a6[_0x205b('0x4d')]},'raw':!![]})['then'](function(_0x14abef){if(_0x14abef&&_0x14abef[_0x205b('0x4e')]===0x0){return db[_0x205b('0x26')][_0x205b('0x49')]({'name':_0x22e6ab[_0x205b('0x2a')],'resourceId':_0x22e6ab['id'],'type':_0x14abef[_0x205b('0x2a')],'sectionId':_0x14abef['id']},{})[_0x205b('0x23')](function(){return _0x349f81;});}else{return _0x349f81;}})[_0x205b('0x43')](function(_0x1457b5){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1457b5);throw _0x1457b5;});}return _0x349f81;})['then'](respondWithResult(_0x42b69b,0xc9))[_0x205b('0x43')](handleError(_0x42b69b,null));};exports[_0x205b('0x22')]=function(_0x519047,_0x52e973){if(_0x519047[_0x205b('0x4a')]['id']){delete _0x519047[_0x205b('0x4a')]['id'];}return db[_0x205b('0x40')][_0x205b('0x48')]({'where':{'id':_0x519047[_0x205b('0x45')]['id']}})[_0x205b('0x23')](handleEntityNotFound(_0x52e973,null))[_0x205b('0x23')](saveUpdates(_0x519047['body'],null))[_0x205b('0x23')](respondWithResult(_0x52e973,null))[_0x205b('0x43')](handleError(_0x52e973,null));};exports['destroy']=function(_0x15edb1,_0x3a1f31){return db['SquareOdbc'][_0x205b('0x48')]({'where':{'id':_0x15edb1[_0x205b('0x45')]['id']}})[_0x205b('0x23')](handleEntityNotFound(_0x3a1f31,null))[_0x205b('0x23')](removeEntity(_0x3a1f31,null))[_0x205b('0x43')](handleError(_0x3a1f31,null));};exports[_0x205b('0x4f')]=function(_0x3130af,_0x38376c,_0x3652a0){var _0x42f578;return db[_0x205b('0x40')][_0x205b('0x48')]({'where':{'id':_0x3130af[_0x205b('0x45')]['id']},'attributes':['id',_0x205b('0x50')]})['then'](handleEntityNotFound(_0x38376c,null))[_0x205b('0x23')](function(_0x2548cd){if(_0x2548cd){var _0x955655=require(_0x205b('0x51'))();_0x955655[_0x205b('0x52')](_0x2548cd[_0x205b('0x50')]);_0x955655[_0x205b('0x53')]();return _0x2548cd;}})[_0x205b('0x23')](respondWithResult(_0x38376c,null))[_0x205b('0x43')](handleError(_0x38376c,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 1b1be93..c0f7b6c 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 _0xbd45=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SquareOdbc','square_odbc','lodash','util','../../config/logger'];(function(_0x3aa8b3,_0x23041c){var _0x1b2379=function(_0xf25113){while(--_0xf25113){_0x3aa8b3['push'](_0x3aa8b3['shift']());}};_0x1b2379(++_0x23041c);}(_0xbd45,0x193));var _0x5bd4=function(_0x18d012,_0x2f6968){_0x18d012=_0x18d012-0x0;var _0x47d115=_0xbd45[_0x18d012];return _0x47d115;};'use strict';var _=require(_0x5bd4('0x0'));var util=require(_0x5bd4('0x1'));var logger=require(_0x5bd4('0x2'))(_0x5bd4('0x3'));var moment=require(_0x5bd4('0x4'));var BPromise=require(_0x5bd4('0x5'));var rp=require(_0x5bd4('0x6'));var fs=require('fs');var path=require(_0x5bd4('0x7'));var rimraf=require(_0x5bd4('0x8'));var config=require(_0x5bd4('0x9'));var attributes=require('./squareOdbc.attributes');module[_0x5bd4('0xa')]=function(_0x4d4a53,_0x235b7b){return _0x4d4a53[_0x5bd4('0xb')](_0x5bd4('0xc'),attributes,{'tableName':_0x5bd4('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfabe=['square_odbc','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./squareOdbc.attributes','define'];(function(_0x16b561,_0x5a914f){var _0x22599f=function(_0x27ce85){while(--_0x27ce85){_0x16b561['push'](_0x16b561['shift']());}};_0x22599f(++_0x5a914f);}(_0xfabe,0x64));var _0xefab=function(_0x403f61,_0x5b324b){_0x403f61=_0x403f61-0x0;var _0x36cedc=_0xfabe[_0x403f61];return _0x36cedc;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xefab('0x0'))(_0xefab('0x1'));var moment=require(_0xefab('0x2'));var BPromise=require(_0xefab('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xefab('0x4'));var config=require(_0xefab('0x5'));var attributes=require(_0xefab('0x6'));module['exports']=function(_0xd4e1a1,_0x4a285c){return _0xd4e1a1[_0xefab('0x7')]('SquareOdbc',attributes,{'tableName':_0xefab('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index 631469a..2f530d3 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 _0x5308=['../../config/environment','client','http','request','info','SquareOdbc,\x20%s,\x20%s','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','SquareOdbc','options','raw','where','attributes','map','include','model','then','debug','ShowSquareOdbc','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1e925e,_0x21f88e){var _0x56098e=function(_0x2bc666){while(--_0x2bc666){_0x1e925e['push'](_0x1e925e['shift']());}};_0x56098e(++_0x21f88e);}(_0x5308,0x1d8));var _0x8530=function(_0x58e469,_0x95ee3e){_0x58e469=_0x58e469-0x0;var _0x4c01c5=_0x5308[_0x58e469];return _0x4c01c5;};'use strict';var _=require(_0x8530('0x0'));var util=require('util');var moment=require(_0x8530('0x1'));var BPromise=require(_0x8530('0x2'));var rs=require(_0x8530('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8530('0x4'))['db'];var utils=require(_0x8530('0x5'));var logger=require(_0x8530('0x6'))(_0x8530('0x7'));var config=require(_0x8530('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8530('0x9')][_0x8530('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1002e3,_0x543b90,_0x42e37b){return new BPromise(function(_0x36289e,_0x13ef98){return client[_0x8530('0xb')](_0x1002e3,_0x42e37b)['then'](function(_0x329fcd){logger[_0x8530('0xc')](_0x8530('0xd'),_0x543b90,'request\x20sent');logger['debug'](_0x8530('0xe'),_0x543b90,'request\x20sent',JSON[_0x8530('0xf')](_0x329fcd));if(_0x329fcd[_0x8530('0x10')]){if(_0x329fcd['error']['code']===0x1f4){logger['error'](_0x8530('0xd'),_0x543b90,_0x329fcd[_0x8530('0x10')][_0x8530('0x11')]);return _0x13ef98(_0x329fcd[_0x8530('0x10')]['message']);}logger[_0x8530('0x10')](_0x8530('0xd'),_0x543b90,_0x329fcd['error'][_0x8530('0x11')]);return _0x36289e(_0x329fcd[_0x8530('0x10')][_0x8530('0x11')]);}else{logger['info'](_0x8530('0xd'),_0x543b90,_0x8530('0x12'));_0x36289e(_0x329fcd[_0x8530('0x13')][_0x8530('0x11')]);}})[_0x8530('0x14')](function(_0x20df03){logger[_0x8530('0x10')](_0x8530('0xd'),_0x543b90,_0x20df03);_0x13ef98(_0x20df03);});});}exports['ShowSquareOdbc']=function(_0x39b8a9){var _0x3755f9=this;return new Promise(function(_0x88f24e,_0x2bbdc1){return db[_0x8530('0x15')]['find']({'raw':_0x39b8a9[_0x8530('0x16')]?_0x39b8a9['options'][_0x8530('0x17')]===undefined?!![]:![]:!![],'where':_0x39b8a9['options']?_0x39b8a9['options'][_0x8530('0x18')]||null:null,'attributes':_0x39b8a9['options']?_0x39b8a9[_0x8530('0x16')][_0x8530('0x19')]||null:null,'include':_0x39b8a9['options']?_0x39b8a9['options']['include']?_[_0x8530('0x1a')](_0x39b8a9['options'][_0x8530('0x1b')],function(_0x2a6220){return{'model':db[_0x2a6220[_0x8530('0x1c')]],'as':_0x2a6220['as'],'attributes':_0x2a6220[_0x8530('0x19')],'include':_0x2a6220[_0x8530('0x1b')]?_[_0x8530('0x1a')](_0x2a6220['include'],function(_0x120586){return{'model':db[_0x120586[_0x8530('0x1c')]],'as':_0x120586['as'],'attributes':_0x120586[_0x8530('0x19')],'include':_0x120586[_0x8530('0x1b')]?_[_0x8530('0x1a')](_0x120586['include'],function(_0x4045b9){return{'model':db[_0x4045b9[_0x8530('0x1c')]],'as':_0x4045b9['as'],'attributes':_0x4045b9[_0x8530('0x19')]};}):[]};}):[]};}):[]:[]})[_0x8530('0x1d')](function(_0x2d35c0){logger[_0x8530('0xc')]('ShowSquareOdbc',_0x39b8a9);logger[_0x8530('0x1e')](_0x8530('0x1f'),_0x39b8a9,JSON['stringify'](_0x2d35c0));_0x88f24e(_0x2d35c0);})[_0x8530('0x14')](function(_0x26ee5a){logger[_0x8530('0x10')](_0x8530('0x1f'),_0x26ee5a[_0x8530('0x11')],_0x39b8a9);_0x2bbdc1(_0x3755f9['error'](0x1f4,_0x26ee5a[_0x8530('0x11')]));});});}; \ No newline at end of file +var _0x8eed=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','where','attributes','map','include','model','lodash','randomstring'];(function(_0x35061d,_0x26ba40){var _0x1398bc=function(_0x24edce){while(--_0x24edce){_0x35061d['push'](_0x35061d['shift']());}};_0x1398bc(++_0x26ba40);}(_0x8eed,0x1cf));var _0xd8ee=function(_0x265d09,_0x1ada63){_0x265d09=_0x265d09-0x0;var _0x1798b9=_0x8eed[_0x265d09];return _0x1798b9;};'use strict';var _=require(_0xd8ee('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd8ee('0x1'));var fs=require('fs');var Redis=require(_0xd8ee('0x2'));var db=require(_0xd8ee('0x3'))['db'];var utils=require(_0xd8ee('0x4'));var logger=require(_0xd8ee('0x5'))(_0xd8ee('0x6'));var config=require('../../config/environment');var jayson=require(_0xd8ee('0x7'));var client=jayson[_0xd8ee('0x8')][_0xd8ee('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x379501,_0x26191d,_0x12850f){return new BPromise(function(_0x58ba77,_0x21f668){return client[_0xd8ee('0xa')](_0x379501,_0x12850f)[_0xd8ee('0xb')](function(_0x4a9722){logger[_0xd8ee('0xc')](_0xd8ee('0xd'),_0x26191d,_0xd8ee('0xe'));logger['debug']('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x26191d,_0xd8ee('0xe'),JSON[_0xd8ee('0xf')](_0x4a9722));if(_0x4a9722[_0xd8ee('0x10')]){if(_0x4a9722[_0xd8ee('0x10')][_0xd8ee('0x11')]===0x1f4){logger['error'](_0xd8ee('0xd'),_0x26191d,_0x4a9722[_0xd8ee('0x10')][_0xd8ee('0x12')]);return _0x21f668(_0x4a9722['error']['message']);}logger['error'](_0xd8ee('0xd'),_0x26191d,_0x4a9722[_0xd8ee('0x10')]['message']);return _0x58ba77(_0x4a9722['error']['message']);}else{logger[_0xd8ee('0xc')]('SquareOdbc,\x20%s,\x20%s',_0x26191d,_0xd8ee('0xe'));_0x58ba77(_0x4a9722[_0xd8ee('0x13')][_0xd8ee('0x12')]);}})[_0xd8ee('0x14')](function(_0x2b745b){logger[_0xd8ee('0x10')](_0xd8ee('0xd'),_0x26191d,_0x2b745b);_0x21f668(_0x2b745b);});});}exports[_0xd8ee('0x15')]=function(_0x46e69c){var _0x4469c8=this;return new Promise(function(_0x3130f7,_0x127424){return db[_0xd8ee('0x16')][_0xd8ee('0x17')]({'raw':_0x46e69c[_0xd8ee('0x18')]?_0x46e69c['options'][_0xd8ee('0x19')]===undefined?!![]:![]:!![],'where':_0x46e69c['options']?_0x46e69c[_0xd8ee('0x18')][_0xd8ee('0x1a')]||null:null,'attributes':_0x46e69c[_0xd8ee('0x18')]?_0x46e69c[_0xd8ee('0x18')][_0xd8ee('0x1b')]||null:null,'include':_0x46e69c[_0xd8ee('0x18')]?_0x46e69c[_0xd8ee('0x18')]['include']?_[_0xd8ee('0x1c')](_0x46e69c[_0xd8ee('0x18')][_0xd8ee('0x1d')],function(_0x2c936c){return{'model':db[_0x2c936c[_0xd8ee('0x1e')]],'as':_0x2c936c['as'],'attributes':_0x2c936c[_0xd8ee('0x1b')],'include':_0x2c936c[_0xd8ee('0x1d')]?_['map'](_0x2c936c['include'],function(_0x43460b){return{'model':db[_0x43460b[_0xd8ee('0x1e')]],'as':_0x43460b['as'],'attributes':_0x43460b['attributes'],'include':_0x43460b[_0xd8ee('0x1d')]?_[_0xd8ee('0x1c')](_0x43460b[_0xd8ee('0x1d')],function(_0x3bb696){return{'model':db[_0x3bb696['model']],'as':_0x3bb696['as'],'attributes':_0x3bb696[_0xd8ee('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xd8ee('0xb')](function(_0x959bff){logger['info'](_0xd8ee('0x15'),_0x46e69c);logger['debug']('ShowSquareOdbc',_0x46e69c,JSON[_0xd8ee('0xf')](_0x959bff));_0x3130f7(_0x959bff);})[_0xd8ee('0x14')](function(_0x543b7c){logger['error'](_0xd8ee('0x15'),_0x543b7c[_0xd8ee('0x12')],_0x46e69c);_0x127424(_0x4469c8[_0xd8ee('0x10')](0x1f4,_0x543b7c['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index e12723a..a25a439 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 _0xe305=['path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe305,0x1d3));var _0x5e30=function(_0x23957f,_0x122338){_0x23957f=_0x23957f-0x0;var _0x1291cb=_0xe305[_0x23957f];return _0x1291cb;};'use strict';var multer=require('multer');var util=require(_0x5e30('0x0'));var path=require(_0x5e30('0x1'));var timeout=require(_0x5e30('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5e30('0x3'));var interaction=require(_0x5e30('0x4'));var config=require(_0x5e30('0x5'));var controller=require(_0x5e30('0x6'));router[_0x5e30('0x7')]('/',auth[_0x5e30('0x8')](),controller[_0x5e30('0x9')]);router[_0x5e30('0x7')](_0x5e30('0xa'),auth['isAuthenticated'](),controller[_0x5e30('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x5e30('0xc')]);router[_0x5e30('0xd')]('/:id',auth[_0x5e30('0x8')](),controller[_0x5e30('0xe')]);router[_0x5e30('0xf')](_0x5e30('0xa'),auth['isAuthenticated'](),controller[_0x5e30('0x10')]);module[_0x5e30('0x11')]=router; \ No newline at end of file +var _0x106e=['delete','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','post','create','put','/:id','update'];(function(_0x2ca466,_0x4b6a9a){var _0x601be8=function(_0x116009){while(--_0x116009){_0x2ca466['push'](_0x2ca466['shift']());}};_0x601be8(++_0x4b6a9a);}(_0x106e,0x112));var _0xe106=function(_0x4df7da,_0x20ced8){_0x4df7da=_0x4df7da-0x0;var _0x29cb0f=_0x106e[_0x4df7da];return _0x29cb0f;};'use strict';var multer=require(_0xe106('0x0'));var util=require(_0xe106('0x1'));var path=require(_0xe106('0x2'));var timeout=require(_0xe106('0x3'));var express=require(_0xe106('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe106('0x5'));var config=require(_0xe106('0x6'));var controller=require('./squareProject.controller');router[_0xe106('0x7')]('/',auth['isAuthenticated'](),controller[_0xe106('0x8')]);router[_0xe106('0x7')]('/:id',auth[_0xe106('0x9')](),controller['show']);router[_0xe106('0xa')]('/',auth[_0xe106('0x9')](),controller[_0xe106('0xb')]);router[_0xe106('0xc')](_0xe106('0xd'),auth[_0xe106('0x9')](),controller[_0xe106('0xe')]);router[_0xe106('0xf')](_0xe106('0xd'),auth[_0xe106('0x9')](),controller['destroy']);module[_0xe106('0x10')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 42e9015..ce19be5 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 _0x2c70=['getDataValue','preproduction','toString','utf8','BLOB','long','production','DATE','sequelize','STRING','TEXT'];(function(_0x4b6484,_0x13a951){var _0x48bec3=function(_0x531efe){while(--_0x531efe){_0x4b6484['push'](_0x4b6484['shift']());}};_0x48bec3(++_0x13a951);}(_0x2c70,0x19f));var _0x02c7=function(_0x37931a,_0x37f53c){_0x37931a=_0x37931a-0x0;var _0x506e66=_0x2c70[_0x37931a];return _0x506e66;};'use strict';var Sequelize=require(_0x02c7('0x0'));module['exports']={'name':{'type':Sequelize[_0x02c7('0x1')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0x02c7('0x2')]},'preproduction':{'type':Sequelize['BLOB']('long'),'get':function(){if(this[_0x02c7('0x3')](_0x02c7('0x4'))){return this['getDataValue'](_0x02c7('0x4'))[_0x02c7('0x5')](_0x02c7('0x6'));}}},'production':{'type':Sequelize[_0x02c7('0x7')](_0x02c7('0x8')),'get':function(){if(this[_0x02c7('0x3')](_0x02c7('0x9'))){return this['getDataValue'](_0x02c7('0x9'))['toString'](_0x02c7('0x6'));}}},'savedAt':{'type':Sequelize[_0x02c7('0xa')]},'publishedAt':{'type':Sequelize[_0x02c7('0xa')]}}; \ No newline at end of file +var _0xa921=['production','DATE','STRING','BLOB','long','getDataValue','preproduction','toString','utf8'];(function(_0x3e0517,_0x2eb50a){var _0x6df7f6=function(_0x35b55b){while(--_0x35b55b){_0x3e0517['push'](_0x3e0517['shift']());}};_0x6df7f6(++_0x2eb50a);}(_0xa921,0x77));var _0x1a92=function(_0x2ee454,_0x381b26){_0x2ee454=_0x2ee454-0x0;var _0x26e0c4=_0xa921[_0x2ee454];return _0x26e0c4;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x1a92('0x0')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x1a92('0x0')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0x1a92('0x1')](_0x1a92('0x2')),'get':function(){if(this[_0x1a92('0x3')]('preproduction')){return this['getDataValue'](_0x1a92('0x4'))[_0x1a92('0x5')](_0x1a92('0x6'));}}},'production':{'type':Sequelize[_0x1a92('0x1')](_0x1a92('0x2')),'get':function(){if(this['getDataValue'](_0x1a92('0x7'))){return this[_0x1a92('0x3')]('production')[_0x1a92('0x5')]('utf8');}}},'savedAt':{'type':Sequelize[_0x1a92('0x8')]},'publishedAt':{'type':Sequelize[_0x1a92('0x8')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index bc04229..adad219 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 _0x9364=['UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','lodash','../../config/logger','api','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','./squareProject.socket','register','status','json','offset','undefined','limit','count','set','update','then','get','SquareProjects','UserProfileResource','destroy','redis','publish','agi','stringify','end','name','send','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','type','VIRTUAL','merge','SquareProject','include','rows','catch','show','includeAll','find','create','body','user'];(function(_0x45fa43,_0x489dfe){var _0x477cc2=function(_0x44a8d8){while(--_0x44a8d8){_0x45fa43['push'](_0x45fa43['shift']());}};_0x477cc2(++_0x489dfe);}(_0x9364,0x87));var _0x4936=function(_0xc93a87,_0x43e41d){_0xc93a87=_0xc93a87-0x0;var _0x2dca8a=_0x9364[_0xc93a87];return _0x2dca8a;};'use strict';var _=require(_0x4936('0x0'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x4936('0x1'))(_0x4936('0x2'));var config=require(_0x4936('0x3'));var db=require(_0x4936('0x4'))['db'];config['redis']=_[_0x4936('0x5')](config['redis'],{'host':_0x4936('0x6'),'port':0x18eb});var socket=require(_0x4936('0x7'))(new Redis(config['redis']));require(_0x4936('0x8'))[_0x4936('0x9')](socket);function respondWithResult(_0x382f06,_0x3b2d2b){_0x3b2d2b=_0x3b2d2b||0xc8;return function(_0x3ceb86){if(_0x3ceb86){return _0x382f06[_0x4936('0xa')](_0x3b2d2b)[_0x4936('0xb')](_0x3ceb86);}};}function respondWithFilteredResult(_0xccb12a,_0x6d67c4){return function(_0x165e85){if(_0x165e85){var _0x3c4566=typeof _0x6d67c4[_0x4936('0xc')]===_0x4936('0xd')&&typeof _0x6d67c4[_0x4936('0xe')]===_0x4936('0xd');var _0x352d44=_0x165e85['count'];var _0x13c57e=_0x3c4566?0x0:_0x6d67c4[_0x4936('0xc')];var _0x49ca8b=_0x3c4566?_0x165e85[_0x4936('0xf')]:_0x6d67c4['offset']+_0x6d67c4[_0x4936('0xe')];var _0x28d618;if(_0x49ca8b>=_0x352d44){_0x49ca8b=_0x352d44;_0x28d618=0xc8;}else{_0x28d618=0xce;}_0xccb12a[_0x4936('0xa')](_0x28d618);return _0xccb12a[_0x4936('0x10')]('Content-Range',_0x13c57e+'-'+_0x49ca8b+'/'+_0x352d44)[_0x4936('0xb')](_0x165e85);}return null;};}function saveUpdates(_0x4a8a23){return function(_0x272228){if(_0x272228){return _0x272228[_0x4936('0x11')](_0x4a8a23)[_0x4936('0x12')](function(_0x574148){return _0x574148;});}return null;};}function removeEntity(_0xfbe6ad){return function(_0x49b4cb){if(_0x49b4cb){return _0x49b4cb['destroy']()[_0x4936('0x12')](function(){var _0x297585=_0x49b4cb[_0x4936('0x13')]({'plain':!![]});var _0x42d165=_0x4936('0x14');return db[_0x4936('0x15')][_0x4936('0x16')]({'where':{'type':_0x42d165,'resourceId':_0x297585['id']}})[_0x4936('0x12')](function(){return _0x49b4cb;});})[_0x4936('0x12')](function(){var _0x3b9476=new Redis(config[_0x4936('0x17')]);_0x3b9476[_0x4936('0x18')](_0x4936('0x19'),JSON[_0x4936('0x1a')]({'id':_0x49b4cb['id'],'deleted':!![]}));})[_0x4936('0x12')](function(){_0xfbe6ad[_0x4936('0xa')](0xcc)[_0x4936('0x1b')]();});}};}function handleEntityNotFound(_0x1290f){return function(_0x3682e3){if(!_0x3682e3){_0x1290f['sendStatus'](0x194);}return _0x3682e3;};}function handleError(_0x13b7b3,_0x4ebfb0){_0x4ebfb0=_0x4ebfb0||0x1f4;return function(_0x15d999){logger['error'](_0x15d999['stack']);if(_0x15d999[_0x4936('0x1c')]){delete _0x15d999[_0x4936('0x1c')];}_0x13b7b3['status'](_0x4ebfb0)[_0x4936('0x1d')](_0x15d999);};}exports['index']=function(_0x4c5afc,_0x4f2bc3){var _0x1af963={},_0x1fce61={},_0x520607={'count':0x0,'rows':[]};var _0x1dd72d=_[_0x4936('0x1e')](db['SquareProject'][_0x4936('0x1f')],function(_0x41eaca){return{'name':_0x41eaca[_0x4936('0x20')],'type':_0x41eaca['type'][_0x4936('0x21')]};});_0x1fce61[_0x4936('0x22')]=_['map'](_0x1dd72d,'name');_0x1fce61[_0x4936('0x23')]=_[_0x4936('0x24')](_0x4c5afc['query']);_0x1fce61[_0x4936('0x25')]=_[_0x4936('0x26')](_0x1fce61[_0x4936('0x22')],_0x1fce61[_0x4936('0x23')]);_0x1af963[_0x4936('0x27')]=_[_0x4936('0x26')](_0x1fce61[_0x4936('0x22')],qs[_0x4936('0x28')](_0x4c5afc[_0x4936('0x23')][_0x4936('0x28')]));_0x1af963[_0x4936('0x27')]=_0x1af963[_0x4936('0x27')][_0x4936('0x29')]?_0x1af963[_0x4936('0x27')]:_0x1fce61['model'];if(!_0x4c5afc['query']['hasOwnProperty'](_0x4936('0x2a'))){_0x1af963[_0x4936('0xe')]=qs['limit'](_0x4c5afc[_0x4936('0x23')]['limit']);_0x1af963['offset']=qs[_0x4936('0xc')](_0x4c5afc[_0x4936('0x23')][_0x4936('0xc')]);}_0x1af963[_0x4936('0x2b')]=qs['sort'](_0x4c5afc[_0x4936('0x23')][_0x4936('0x2c')]);_0x1af963[_0x4936('0x2d')]=qs['filters'](_['pick'](_0x4c5afc['query'],_0x1fce61[_0x4936('0x25')]),_0x1dd72d);if(_0x4c5afc[_0x4936('0x23')][_0x4936('0x2e')]){_0x1af963[_0x4936('0x2d')]=_['merge'](_0x1af963['where'],{'$or':_[_0x4936('0x1e')](_0x1dd72d,function(_0xe6d58c){if(_0xe6d58c[_0x4936('0x2f')]!==_0x4936('0x30')){var _0x472b53={};_0x472b53[_0xe6d58c[_0x4936('0x1c')]]={'$like':'%'+_0x4c5afc[_0x4936('0x23')][_0x4936('0x2e')]+'%'};return _0x472b53;}})});}_0x1af963=_[_0x4936('0x31')]({},_0x1af963,_0x4c5afc['options']);var _0x322a9d={'where':_0x1af963[_0x4936('0x2d')]};return db[_0x4936('0x32')]['count'](_0x322a9d)[_0x4936('0x12')](function(_0x2d0d99){_0x520607[_0x4936('0xf')]=_0x2d0d99;if(_0x4c5afc[_0x4936('0x23')]['includeAll']){_0x1af963[_0x4936('0x33')]=[{'all':!![]}];}return db[_0x4936('0x32')]['findAll'](_0x1af963);})['then'](function(_0x3242c6){_0x520607[_0x4936('0x34')]=_0x3242c6;return _0x520607;})[_0x4936('0x12')](respondWithFilteredResult(_0x4f2bc3,_0x1af963))[_0x4936('0x35')](handleError(_0x4f2bc3,null));};exports[_0x4936('0x36')]=function(_0x534089,_0x2c41a9){var _0x1dd1fb={'raw':![],'where':{'id':_0x534089['params']['id']}},_0x5a9049={};_0x5a9049['model']=_['keys'](db['SquareProject'][_0x4936('0x1f')]);_0x5a9049['query']=_[_0x4936('0x24')](_0x534089[_0x4936('0x23')]);_0x5a9049['filters']=_[_0x4936('0x26')](_0x5a9049[_0x4936('0x22')],_0x5a9049[_0x4936('0x23')]);_0x1dd1fb[_0x4936('0x27')]=_['intersection'](_0x5a9049['model'],qs[_0x4936('0x28')](_0x534089[_0x4936('0x23')]['fields']));_0x1dd1fb['attributes']=_0x1dd1fb[_0x4936('0x27')][_0x4936('0x29')]?_0x1dd1fb[_0x4936('0x27')]:_0x5a9049[_0x4936('0x22')];if(_0x534089[_0x4936('0x23')][_0x4936('0x37')]){_0x1dd1fb[_0x4936('0x33')]=[{'all':!![]}];}_0x1dd1fb=_[_0x4936('0x31')]({},_0x1dd1fb,_0x534089['options']);return db[_0x4936('0x32')][_0x4936('0x38')](_0x1dd1fb)[_0x4936('0x12')](handleEntityNotFound(_0x2c41a9,null))[_0x4936('0x12')](respondWithResult(_0x2c41a9,null))[_0x4936('0x35')](handleError(_0x2c41a9,null));};exports[_0x4936('0x39')]=function(_0x252ef6,_0x5ace68){return db['SquareProject'][_0x4936('0x39')](_0x252ef6[_0x4936('0x3a')],{})['then'](function(_0x2d2cca){var _0x1e514b=_0x252ef6[_0x4936('0x3b')]['get']({'plain':!![]});if(!_0x1e514b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1e514b['role']==='user'){var _0xdb9bcf=_0x2d2cca[_0x4936('0x13')]({'plain':!![]});var _0x2def18=_0x4936('0x14');return db[_0x4936('0x3c')][_0x4936('0x38')]({'where':{'name':_0x2def18,'userProfileId':_0x1e514b['userProfileId']},'raw':!![]})['then'](function(_0x2854bc){if(_0x2854bc&&_0x2854bc[_0x4936('0x3d')]===0x0){return db[_0x4936('0x15')][_0x4936('0x39')]({'name':_0xdb9bcf[_0x4936('0x1c')],'resourceId':_0xdb9bcf['id'],'type':_0x2854bc[_0x4936('0x1c')],'sectionId':_0x2854bc['id']},{})[_0x4936('0x12')](function(){return _0x2d2cca;});}else{return _0x2d2cca;}})[_0x4936('0x35')](function(_0x94c19c){logger[_0x4936('0x3e')](_0x4936('0x3f'),_0x94c19c);throw _0x94c19c;});}return _0x2d2cca;})[_0x4936('0x12')](respondWithResult(_0x5ace68,0xc9))['catch'](handleError(_0x5ace68,null));};exports[_0x4936('0x11')]=function(_0x2f910b,_0x5c96d8){if(_0x2f910b['body']['id']){delete _0x2f910b[_0x4936('0x3a')]['id'];}return db[_0x4936('0x32')][_0x4936('0x38')]({'where':{'id':_0x2f910b[_0x4936('0x40')]['id']}})['then'](handleEntityNotFound(_0x5c96d8,null))[_0x4936('0x12')](saveUpdates(_0x2f910b['body'],null))[_0x4936('0x12')](function(_0x343f76){if(!_0x343f76)return;var _0x38e8ba=_0x343f76['get']({'plain':!![]});return _0x38e8ba;})[_0x4936('0x12')](function(_0x10e07e){var _0x6fe5a6=new Redis(config['redis']);_0x6fe5a6[_0x4936('0x18')]('agi',JSON[_0x4936('0x1a')](_['pick'](_0x10e07e,['id',_0x4936('0x1c'),'production'])));return _0x10e07e;})[_0x4936('0x12')](respondWithResult(_0x5c96d8,null))[_0x4936('0x35')](handleError(_0x5c96d8,null));};exports[_0x4936('0x16')]=function(_0x5817e7,_0x16c221){return db[_0x4936('0x32')]['find']({'where':{'id':_0x5817e7[_0x4936('0x40')]['id']}})[_0x4936('0x12')](handleEntityNotFound(_0x16c221,null))[_0x4936('0x12')](removeEntity(_0x16c221,null))[_0x4936('0x35')](handleError(_0x16c221,null));}; \ No newline at end of file +var _0xd08c=['name','send','rawAttributes','type','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','SquareProject','includeAll','rows','show','params','keys','include','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','publish','production','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./squareProject.socket','register','json','offset','limit','count','status','set','Content-Range','update','then','SquareProjects','UserProfileResource','destroy','agi','stringify','end','sendStatus','error','stack'];(function(_0x1381ab,_0x5b4ee0){var _0x1eedb6=function(_0x4a930d){while(--_0x4a930d){_0x1381ab['push'](_0x1381ab['shift']());}};_0x1eedb6(++_0x5b4ee0);}(_0xd08c,0x106));var _0xcd08=function(_0x287591,_0x18897d){_0x287591=_0x287591-0x0;var _0x366699=_0xd08c[_0x287591];return _0x366699;};'use strict';var _=require(_0xcd08('0x0'));var Redis=require(_0xcd08('0x1'));var qs=require(_0xcd08('0x2'));var logger=require(_0xcd08('0x3'))(_0xcd08('0x4'));var config=require(_0xcd08('0x5'));var db=require(_0xcd08('0x6'))['db'];config[_0xcd08('0x7')]=_[_0xcd08('0x8')](config[_0xcd08('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0xcd08('0x9'))(new Redis(config[_0xcd08('0x7')]));require(_0xcd08('0xa'))[_0xcd08('0xb')](socket);function respondWithResult(_0x3d9189,_0x125995){_0x125995=_0x125995||0xc8;return function(_0x18b411){if(_0x18b411){return _0x3d9189['status'](_0x125995)[_0xcd08('0xc')](_0x18b411);}};}function respondWithFilteredResult(_0x32f04d,_0x2fc649){return function(_0x2ae9bb){if(_0x2ae9bb){var _0x1d787f=typeof _0x2fc649[_0xcd08('0xd')]==='undefined'&&typeof _0x2fc649[_0xcd08('0xe')]==='undefined';var _0x575603=_0x2ae9bb[_0xcd08('0xf')];var _0x332a8a=_0x1d787f?0x0:_0x2fc649['offset'];var _0x322380=_0x1d787f?_0x2ae9bb[_0xcd08('0xf')]:_0x2fc649[_0xcd08('0xd')]+_0x2fc649[_0xcd08('0xe')];var _0x59d11a;if(_0x322380>=_0x575603){_0x322380=_0x575603;_0x59d11a=0xc8;}else{_0x59d11a=0xce;}_0x32f04d[_0xcd08('0x10')](_0x59d11a);return _0x32f04d[_0xcd08('0x11')](_0xcd08('0x12'),_0x332a8a+'-'+_0x322380+'/'+_0x575603)[_0xcd08('0xc')](_0x2ae9bb);}return null;};}function saveUpdates(_0x4595cf){return function(_0x26b992){if(_0x26b992){return _0x26b992[_0xcd08('0x13')](_0x4595cf)['then'](function(_0x26f49f){return _0x26f49f;});}return null;};}function removeEntity(_0x9fae20){return function(_0x25dd4d){if(_0x25dd4d){return _0x25dd4d['destroy']()[_0xcd08('0x14')](function(){var _0x3321be=_0x25dd4d['get']({'plain':!![]});var _0xb77830=_0xcd08('0x15');return db[_0xcd08('0x16')][_0xcd08('0x17')]({'where':{'type':_0xb77830,'resourceId':_0x3321be['id']}})['then'](function(){return _0x25dd4d;});})[_0xcd08('0x14')](function(){var _0x1a1a7b=new Redis(config[_0xcd08('0x7')]);_0x1a1a7b['publish'](_0xcd08('0x18'),JSON[_0xcd08('0x19')]({'id':_0x25dd4d['id'],'deleted':!![]}));})['then'](function(){_0x9fae20['status'](0xcc)[_0xcd08('0x1a')]();});}};}function handleEntityNotFound(_0x1f38e2){return function(_0xd65530){if(!_0xd65530){_0x1f38e2[_0xcd08('0x1b')](0x194);}return _0xd65530;};}function handleError(_0x2b4269,_0x56536e){_0x56536e=_0x56536e||0x1f4;return function(_0x5193e2){logger[_0xcd08('0x1c')](_0x5193e2[_0xcd08('0x1d')]);if(_0x5193e2[_0xcd08('0x1e')]){delete _0x5193e2['name'];}_0x2b4269[_0xcd08('0x10')](_0x56536e)[_0xcd08('0x1f')](_0x5193e2);};}exports['index']=function(_0x3e62c6,_0x4faf03){var _0x4e99fe={},_0x1ee1e9={},_0x2aed41={'count':0x0,'rows':[]};var _0x2c834c=_['map'](db['SquareProject'][_0xcd08('0x20')],function(_0x4a39cd){return{'name':_0x4a39cd['fieldName'],'type':_0x4a39cd[_0xcd08('0x21')][_0xcd08('0x22')]};});_0x1ee1e9[_0xcd08('0x23')]=_[_0xcd08('0x24')](_0x2c834c,'name');_0x1ee1e9['query']=_['keys'](_0x3e62c6[_0xcd08('0x25')]);_0x1ee1e9[_0xcd08('0x26')]=_['intersection'](_0x1ee1e9[_0xcd08('0x23')],_0x1ee1e9[_0xcd08('0x25')]);_0x4e99fe[_0xcd08('0x27')]=_[_0xcd08('0x28')](_0x1ee1e9[_0xcd08('0x23')],qs['fields'](_0x3e62c6[_0xcd08('0x25')][_0xcd08('0x29')]));_0x4e99fe[_0xcd08('0x27')]=_0x4e99fe[_0xcd08('0x27')][_0xcd08('0x2a')]?_0x4e99fe['attributes']:_0x1ee1e9[_0xcd08('0x23')];if(!_0x3e62c6[_0xcd08('0x25')][_0xcd08('0x2b')](_0xcd08('0x2c'))){_0x4e99fe[_0xcd08('0xe')]=qs[_0xcd08('0xe')](_0x3e62c6[_0xcd08('0x25')][_0xcd08('0xe')]);_0x4e99fe['offset']=qs[_0xcd08('0xd')](_0x3e62c6[_0xcd08('0x25')][_0xcd08('0xd')]);}_0x4e99fe[_0xcd08('0x2d')]=qs[_0xcd08('0x2e')](_0x3e62c6[_0xcd08('0x25')][_0xcd08('0x2e')]);_0x4e99fe[_0xcd08('0x2f')]=qs[_0xcd08('0x26')](_[_0xcd08('0x30')](_0x3e62c6[_0xcd08('0x25')],_0x1ee1e9[_0xcd08('0x26')]),_0x2c834c);if(_0x3e62c6[_0xcd08('0x25')]['filter']){_0x4e99fe[_0xcd08('0x2f')]=_[_0xcd08('0x31')](_0x4e99fe[_0xcd08('0x2f')],{'$or':_[_0xcd08('0x24')](_0x2c834c,function(_0x176d48){if(_0x176d48[_0xcd08('0x21')]!==_0xcd08('0x32')){var _0x2a34b4={};_0x2a34b4[_0x176d48[_0xcd08('0x1e')]]={'$like':'%'+_0x3e62c6[_0xcd08('0x25')][_0xcd08('0x33')]+'%'};return _0x2a34b4;}})});}_0x4e99fe=_[_0xcd08('0x31')]({},_0x4e99fe,_0x3e62c6[_0xcd08('0x34')]);var _0x564f73={'where':_0x4e99fe[_0xcd08('0x2f')]};return db[_0xcd08('0x35')][_0xcd08('0xf')](_0x564f73)[_0xcd08('0x14')](function(_0x434cb0){_0x2aed41[_0xcd08('0xf')]=_0x434cb0;if(_0x3e62c6[_0xcd08('0x25')][_0xcd08('0x36')]){_0x4e99fe['include']=[{'all':!![]}];}return db[_0xcd08('0x35')]['findAll'](_0x4e99fe);})[_0xcd08('0x14')](function(_0x1035f2){_0x2aed41[_0xcd08('0x37')]=_0x1035f2;return _0x2aed41;})[_0xcd08('0x14')](respondWithFilteredResult(_0x4faf03,_0x4e99fe))['catch'](handleError(_0x4faf03,null));};exports[_0xcd08('0x38')]=function(_0x349913,_0xb8d9a3){var _0x4f9d46={'raw':![],'where':{'id':_0x349913[_0xcd08('0x39')]['id']}},_0x440208={};_0x440208[_0xcd08('0x23')]=_[_0xcd08('0x3a')](db[_0xcd08('0x35')]['rawAttributes']);_0x440208[_0xcd08('0x25')]=_['keys'](_0x349913['query']);_0x440208['filters']=_['intersection'](_0x440208['model'],_0x440208[_0xcd08('0x25')]);_0x4f9d46[_0xcd08('0x27')]=_[_0xcd08('0x28')](_0x440208['model'],qs[_0xcd08('0x29')](_0x349913['query'][_0xcd08('0x29')]));_0x4f9d46[_0xcd08('0x27')]=_0x4f9d46[_0xcd08('0x27')]['length']?_0x4f9d46[_0xcd08('0x27')]:_0x440208[_0xcd08('0x23')];if(_0x349913['query'][_0xcd08('0x36')]){_0x4f9d46[_0xcd08('0x3b')]=[{'all':!![]}];}_0x4f9d46=_[_0xcd08('0x31')]({},_0x4f9d46,_0x349913['options']);return db['SquareProject'][_0xcd08('0x3c')](_0x4f9d46)[_0xcd08('0x14')](handleEntityNotFound(_0xb8d9a3,null))[_0xcd08('0x14')](respondWithResult(_0xb8d9a3,null))['catch'](handleError(_0xb8d9a3,null));};exports['create']=function(_0x1e32d1,_0x431757){return db[_0xcd08('0x35')][_0xcd08('0x3d')](_0x1e32d1[_0xcd08('0x3e')],{})[_0xcd08('0x14')](function(_0x2d6429){var _0x166abe=_0x1e32d1['user'][_0xcd08('0x3f')]({'plain':!![]});if(!_0x166abe)throw new Error(_0xcd08('0x40'));if(_0x166abe['role']===_0xcd08('0x41')){var _0x1eb04c=_0x2d6429[_0xcd08('0x3f')]({'plain':!![]});var _0x50d1d5='SquareProjects';return db[_0xcd08('0x42')]['find']({'where':{'name':_0x50d1d5,'userProfileId':_0x166abe[_0xcd08('0x43')]},'raw':!![]})[_0xcd08('0x14')](function(_0x2ee848){if(_0x2ee848&&_0x2ee848[_0xcd08('0x44')]===0x0){return db['UserProfileResource'][_0xcd08('0x3d')]({'name':_0x1eb04c[_0xcd08('0x1e')],'resourceId':_0x1eb04c['id'],'type':_0x2ee848['name'],'sectionId':_0x2ee848['id']},{})[_0xcd08('0x14')](function(){return _0x2d6429;});}else{return _0x2d6429;}})[_0xcd08('0x45')](function(_0x56fb3b){logger[_0xcd08('0x1c')](_0xcd08('0x46'),_0x56fb3b);throw _0x56fb3b;});}return _0x2d6429;})[_0xcd08('0x14')](respondWithResult(_0x431757,0xc9))[_0xcd08('0x45')](handleError(_0x431757,null));};exports['update']=function(_0xcfed66,_0x687df4){if(_0xcfed66['body']['id']){delete _0xcfed66['body']['id'];}return db[_0xcd08('0x35')][_0xcd08('0x3c')]({'where':{'id':_0xcfed66[_0xcd08('0x39')]['id']}})[_0xcd08('0x14')](handleEntityNotFound(_0x687df4,null))['then'](saveUpdates(_0xcfed66[_0xcd08('0x3e')],null))[_0xcd08('0x14')](function(_0x11d16d){if(!_0x11d16d)return;var _0x3351f2=_0x11d16d[_0xcd08('0x3f')]({'plain':!![]});return _0x3351f2;})[_0xcd08('0x14')](function(_0x3613bd){var _0xeca697=new Redis(config[_0xcd08('0x7')]);_0xeca697[_0xcd08('0x47')]('agi',JSON[_0xcd08('0x19')](_[_0xcd08('0x30')](_0x3613bd,['id',_0xcd08('0x1e'),_0xcd08('0x48')])));return _0x3613bd;})[_0xcd08('0x14')](respondWithResult(_0x687df4,null))[_0xcd08('0x45')](handleError(_0x687df4,null));};exports[_0xcd08('0x17')]=function(_0x580d55,_0x51b518){return db[_0xcd08('0x35')][_0xcd08('0x3c')]({'where':{'id':_0x580d55[_0xcd08('0x39')]['id']}})[_0xcd08('0x14')](handleEntityNotFound(_0x51b518,null))['then'](removeEntity(_0x51b518,null))[_0xcd08('0x45')](handleError(_0x51b518,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index a8874a8..0088e71 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 _0x1428=['save','update','remove','emit','exports','../../mysqldb','SquareProject','setMaxListeners'];(function(_0x415d7c,_0x39dec4){var _0x2e5f18=function(_0x419155){while(--_0x419155){_0x415d7c['push'](_0x415d7c['shift']());}};_0x2e5f18(++_0x39dec4);}(_0x1428,0x16d));var _0x8142=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x1428[_0x47e7cb];return _0x2a8874;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0x8142('0x0'))['db'][_0x8142('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x8142('0x2')](0x0);var events={'afterCreate':_0x8142('0x3'),'afterUpdate':_0x8142('0x4'),'afterDestroy':_0x8142('0x5')};function emitEvent(_0x1b818c){return function(_0x40bb74,_0xdc5a1d,_0x11a92e){SquareProjectEvents[_0x8142('0x6')](_0x1b818c+':'+_0x40bb74['id'],_0x40bb74);SquareProjectEvents[_0x8142('0x6')](_0x1b818c,_0x40bb74);_0x11a92e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0x8142('0x7')]=SquareProjectEvents; \ No newline at end of file +var _0x04d0=['setMaxListeners','save','remove','emit','hook','exports','../../mysqldb','SquareProject'];(function(_0x2b15f6,_0x46662a){var _0x5435bd=function(_0x54e57f){while(--_0x54e57f){_0x2b15f6['push'](_0x2b15f6['shift']());}};_0x5435bd(++_0x46662a);}(_0x04d0,0x116));var _0x004d=function(_0x47ae21,_0x4b4d66){_0x47ae21=_0x47ae21-0x0;var _0x4727e6=_0x04d0[_0x47ae21];return _0x4727e6;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0x004d('0x0'))['db'][_0x004d('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x004d('0x2')](0x0);var events={'afterCreate':_0x004d('0x3'),'afterUpdate':'update','afterDestroy':_0x004d('0x4')};function emitEvent(_0x261318){return function(_0x1c0723,_0x386955,_0x4a4057){SquareProjectEvents[_0x004d('0x5')](_0x261318+':'+_0x1c0723['id'],_0x1c0723);SquareProjectEvents[_0x004d('0x5')](_0x261318,_0x1c0723);_0x4a4057(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0x004d('0x6')](e,emitEvent(event));}}module[_0x004d('0x7')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index ae964a1..9512ebf 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 _0x320e=['YYYY-MM-DD\x20HH:mm:ss','publishedAt','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','SquareProject','square_projects','changed','preproduction','savedAt','format'];(function(_0x1a0600,_0x41feef){var _0x734670=function(_0x2da4e4){while(--_0x2da4e4){_0x1a0600['push'](_0x1a0600['shift']());}};_0x734670(++_0x41feef);}(_0x320e,0x8a));var _0xe320=function(_0x1bb80c,_0x26d406){_0x1bb80c=_0x1bb80c-0x0;var _0x368f16=_0x320e[_0x1bb80c];return _0x368f16;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe320('0x0'))(_0xe320('0x1'));var moment=require(_0xe320('0x2'));var BPromise=require(_0xe320('0x3'));var rp=require(_0xe320('0x4'));var fs=require('fs');var path=require(_0xe320('0x5'));var rimraf=require(_0xe320('0x6'));var config=require('../../config/environment');var attributes=require('./squareProject.attributes');module[_0xe320('0x7')]=function(_0x288efb,_0x21ac59){return _0x288efb[_0xe320('0x8')](_0xe320('0x9'),attributes,{'tableName':_0xe320('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xdf521f,_0x28a2ee,_0x490830){if(_0xdf521f[_0xe320('0xb')](_0xe320('0xc'))){_0xdf521f[_0xe320('0xd')]=moment()[_0xe320('0xe')](_0xe320('0xf'));}if(_0xdf521f[_0xe320('0xb')]('production')){_0xdf521f[_0xe320('0x10')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x490830(null,_0xdf521f);}}});}; \ No newline at end of file +var _0xa267=['changed','preproduction','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','format','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','SquareProject'];(function(_0x13d153,_0x3edda1){var _0x508a08=function(_0x465db7){while(--_0x465db7){_0x13d153['push'](_0x13d153['shift']());}};_0x508a08(++_0x3edda1);}(_0xa267,0x7d));var _0x7a26=function(_0x282e68,_0x185883){_0x282e68=_0x282e68-0x0;var _0xa4ad78=_0xa267[_0x282e68];return _0xa4ad78;};'use strict';var _=require(_0x7a26('0x0'));var util=require('util');var logger=require(_0x7a26('0x1'))(_0x7a26('0x2'));var moment=require(_0x7a26('0x3'));var BPromise=require('bluebird');var rp=require(_0x7a26('0x4'));var fs=require('fs');var path=require(_0x7a26('0x5'));var rimraf=require(_0x7a26('0x6'));var config=require(_0x7a26('0x7'));var attributes=require('./squareProject.attributes');module[_0x7a26('0x8')]=function(_0x47e1c5,_0x4e1c56){return _0x47e1c5[_0x7a26('0x9')](_0x7a26('0xa'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x16eac4,_0x4aebb5,_0xb10360){if(_0x16eac4[_0x7a26('0xb')](_0x7a26('0xc'))){_0x16eac4['savedAt']=moment()['format'](_0x7a26('0xd'));}if(_0x16eac4[_0x7a26('0xb')](_0x7a26('0xe'))){_0x16eac4[_0x7a26('0xf')]=moment()[_0x7a26('0x10')](_0x7a26('0xd'));}_0xb10360(null,_0x16eac4);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 3b63c54..bbb5aaa 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 _0x4354=['redis','localhost','socket.io-emitter','./squareProject.socket','register','GetSquareProjects','SquareProject','options','raw','where','limit','include','map','model','attributes','then','info','debug','catch','error','message','ShowSquareProject','stringify','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0xada054,_0x79cdfc){var _0x135102=function(_0x34499c){while(--_0x34499c){_0xada054['push'](_0xada054['shift']());}};_0x135102(++_0x79cdfc);}(_0x4354,0xf7));var _0x4435=function(_0x4c69ac,_0x4418ea){_0x4c69ac=_0x4c69ac-0x0;var _0x13d05e=_0x4354[_0x4c69ac];return _0x13d05e;};'use strict';var _=require('lodash');var Redis=require(_0x4435('0x0'));var db=require(_0x4435('0x1'))['db'];var logger=require(_0x4435('0x2'))(_0x4435('0x3'));var config=require(_0x4435('0x4'));config[_0x4435('0x5')]=_['defaults'](config[_0x4435('0x5')],{'host':_0x4435('0x6'),'port':0x18eb});var socket=require(_0x4435('0x7'))(new Redis(config['redis']));require(_0x4435('0x8'))[_0x4435('0x9')](socket);exports[_0x4435('0xa')]=function(_0x1e9504){var _0x486d4d=this;return new Promise(function(_0x40ac3b,_0x5cf680){return db[_0x4435('0xb')]['findAll']({'raw':_0x1e9504[_0x4435('0xc')]?_0x1e9504[_0x4435('0xc')][_0x4435('0xd')]===undefined?!![]:![]:!![],'where':_0x1e9504[_0x4435('0xc')]?_0x1e9504[_0x4435('0xc')][_0x4435('0xe')]||null:null,'attributes':_0x1e9504['options']?_0x1e9504['options']['attributes']||null:null,'limit':_0x1e9504['options']?_0x1e9504[_0x4435('0xc')][_0x4435('0xf')]||null:null,'include':_0x1e9504[_0x4435('0xc')]?_0x1e9504[_0x4435('0xc')][_0x4435('0x10')]?_[_0x4435('0x11')](_0x1e9504[_0x4435('0xc')][_0x4435('0x10')],function(_0x499f9d){return{'model':db[_0x499f9d[_0x4435('0x12')]],'as':_0x499f9d['as'],'attributes':_0x499f9d['attributes'],'include':_0x499f9d[_0x4435('0x10')]?_[_0x4435('0x11')](_0x499f9d[_0x4435('0x10')],function(_0x5f4da4){return{'model':db[_0x5f4da4[_0x4435('0x12')]],'as':_0x5f4da4['as'],'attributes':_0x5f4da4['attributes'],'include':_0x5f4da4[_0x4435('0x10')]?_[_0x4435('0x11')](_0x5f4da4[_0x4435('0x10')],function(_0x2a6e05){return{'model':db[_0x2a6e05[_0x4435('0x12')]],'as':_0x2a6e05['as'],'attributes':_0x2a6e05[_0x4435('0x13')]};}):[]};}):[]};}):[]:[]})[_0x4435('0x14')](function(_0x273450){logger[_0x4435('0x15')](_0x4435('0xa'),_0x1e9504);logger[_0x4435('0x16')]('GetSquareProjects',_0x1e9504,JSON['stringify'](_0x273450));_0x40ac3b(_0x273450);})[_0x4435('0x17')](function(_0x5daa19){logger[_0x4435('0x18')]('GetSquareProjects',_0x5daa19[_0x4435('0x19')],_0x1e9504);_0x5cf680(_0x486d4d[_0x4435('0x18')](0x1f4,_0x5daa19[_0x4435('0x19')]));});});};exports[_0x4435('0x1a')]=function(_0x28d3c7){var _0x127c7c=this;return new Promise(function(_0x398d1e,_0x202ad3){return db[_0x4435('0xb')]['find']({'raw':_0x28d3c7[_0x4435('0xc')]?_0x28d3c7['options'][_0x4435('0xd')]===undefined?!![]:![]:!![],'where':_0x28d3c7[_0x4435('0xc')]?_0x28d3c7['options'][_0x4435('0xe')]||null:null,'attributes':_0x28d3c7[_0x4435('0xc')]?_0x28d3c7['options'][_0x4435('0x13')]||null:null,'include':_0x28d3c7['options']?_0x28d3c7[_0x4435('0xc')]['include']?_[_0x4435('0x11')](_0x28d3c7[_0x4435('0xc')][_0x4435('0x10')],function(_0x1698a8){return{'model':db[_0x1698a8[_0x4435('0x12')]],'as':_0x1698a8['as'],'attributes':_0x1698a8[_0x4435('0x13')],'include':_0x1698a8['include']?_[_0x4435('0x11')](_0x1698a8['include'],function(_0x51200d){return{'model':db[_0x51200d[_0x4435('0x12')]],'as':_0x51200d['as'],'attributes':_0x51200d['attributes'],'include':_0x51200d[_0x4435('0x10')]?_['map'](_0x51200d[_0x4435('0x10')],function(_0x4c7f18){return{'model':db[_0x4c7f18[_0x4435('0x12')]],'as':_0x4c7f18['as'],'attributes':_0x4c7f18[_0x4435('0x13')]};}):[]};}):[]};}):[]:[]})[_0x4435('0x14')](function(_0x142803){logger['info']('ShowSquareProject',_0x28d3c7);logger['debug'](_0x4435('0x1a'),_0x28d3c7,JSON[_0x4435('0x1b')](_0x142803));_0x398d1e(_0x142803);})[_0x4435('0x17')](function(_0x41e157){logger[_0x4435('0x18')](_0x4435('0x1a'),_0x41e157[_0x4435('0x19')],_0x28d3c7);_0x202ad3(_0x127c7c[_0x4435('0x18')](0x1f4,_0x41e157[_0x4435('0x19')]));});});}; \ No newline at end of file +var _0xf96d=['redis','socket.io-emitter','./squareProject.socket','register','GetSquareProjects','SquareProject','findAll','options','where','attributes','include','map','model','then','info','debug','stringify','catch','error','message','ShowSquareProject','raw','lodash','ioredis','../../mysqldb','rpc','defaults'];(function(_0x476b00,_0x250877){var _0x44ec8e=function(_0xec6b23){while(--_0xec6b23){_0x476b00['push'](_0x476b00['shift']());}};_0x44ec8e(++_0x250877);}(_0xf96d,0x175));var _0xdf96=function(_0xe11b4c,_0x2c4c64){_0xe11b4c=_0xe11b4c-0x0;var _0x4688b7=_0xf96d[_0xe11b4c];return _0x4688b7;};'use strict';var _=require(_0xdf96('0x0'));var Redis=require(_0xdf96('0x1'));var db=require(_0xdf96('0x2'))['db'];var logger=require('../../config/logger')(_0xdf96('0x3'));var config=require('../../config/environment');config['redis']=_[_0xdf96('0x4')](config[_0xdf96('0x5')],{'host':'localhost','port':0x18eb});var socket=require(_0xdf96('0x6'))(new Redis(config[_0xdf96('0x5')]));require(_0xdf96('0x7'))[_0xdf96('0x8')](socket);exports[_0xdf96('0x9')]=function(_0x5c452c){var _0x17abe5=this;return new Promise(function(_0x1bb6cb,_0x249ae6){return db[_0xdf96('0xa')][_0xdf96('0xb')]({'raw':_0x5c452c[_0xdf96('0xc')]?_0x5c452c[_0xdf96('0xc')]['raw']===undefined?!![]:![]:!![],'where':_0x5c452c[_0xdf96('0xc')]?_0x5c452c[_0xdf96('0xc')][_0xdf96('0xd')]||null:null,'attributes':_0x5c452c['options']?_0x5c452c['options'][_0xdf96('0xe')]||null:null,'limit':_0x5c452c[_0xdf96('0xc')]?_0x5c452c[_0xdf96('0xc')]['limit']||null:null,'include':_0x5c452c[_0xdf96('0xc')]?_0x5c452c[_0xdf96('0xc')][_0xdf96('0xf')]?_[_0xdf96('0x10')](_0x5c452c[_0xdf96('0xc')][_0xdf96('0xf')],function(_0x5b25ee){return{'model':db[_0x5b25ee[_0xdf96('0x11')]],'as':_0x5b25ee['as'],'attributes':_0x5b25ee[_0xdf96('0xe')],'include':_0x5b25ee[_0xdf96('0xf')]?_['map'](_0x5b25ee[_0xdf96('0xf')],function(_0x1c8fc3){return{'model':db[_0x1c8fc3[_0xdf96('0x11')]],'as':_0x1c8fc3['as'],'attributes':_0x1c8fc3[_0xdf96('0xe')],'include':_0x1c8fc3[_0xdf96('0xf')]?_['map'](_0x1c8fc3[_0xdf96('0xf')],function(_0x81965c){return{'model':db[_0x81965c['model']],'as':_0x81965c['as'],'attributes':_0x81965c[_0xdf96('0xe')]};}):[]};}):[]};}):[]:[]})[_0xdf96('0x12')](function(_0x1e95a5){logger[_0xdf96('0x13')](_0xdf96('0x9'),_0x5c452c);logger[_0xdf96('0x14')](_0xdf96('0x9'),_0x5c452c,JSON[_0xdf96('0x15')](_0x1e95a5));_0x1bb6cb(_0x1e95a5);})[_0xdf96('0x16')](function(_0x15c98a){logger[_0xdf96('0x17')](_0xdf96('0x9'),_0x15c98a['message'],_0x5c452c);_0x249ae6(_0x17abe5['error'](0x1f4,_0x15c98a[_0xdf96('0x18')]));});});};exports[_0xdf96('0x19')]=function(_0xc354be){var _0x45302d=this;return new Promise(function(_0x29427c,_0x1e275c){return db['SquareProject']['find']({'raw':_0xc354be['options']?_0xc354be[_0xdf96('0xc')][_0xdf96('0x1a')]===undefined?!![]:![]:!![],'where':_0xc354be[_0xdf96('0xc')]?_0xc354be[_0xdf96('0xc')][_0xdf96('0xd')]||null:null,'attributes':_0xc354be['options']?_0xc354be[_0xdf96('0xc')][_0xdf96('0xe')]||null:null,'include':_0xc354be[_0xdf96('0xc')]?_0xc354be[_0xdf96('0xc')][_0xdf96('0xf')]?_[_0xdf96('0x10')](_0xc354be['options'][_0xdf96('0xf')],function(_0x3f99d0){return{'model':db[_0x3f99d0['model']],'as':_0x3f99d0['as'],'attributes':_0x3f99d0[_0xdf96('0xe')],'include':_0x3f99d0[_0xdf96('0xf')]?_[_0xdf96('0x10')](_0x3f99d0[_0xdf96('0xf')],function(_0x3d5318){return{'model':db[_0x3d5318[_0xdf96('0x11')]],'as':_0x3d5318['as'],'attributes':_0x3d5318[_0xdf96('0xe')],'include':_0x3d5318['include']?_[_0xdf96('0x10')](_0x3d5318[_0xdf96('0xf')],function(_0x4a4bef){return{'model':db[_0x4a4bef[_0xdf96('0x11')]],'as':_0x4a4bef['as'],'attributes':_0x4a4bef['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2bda0a){logger[_0xdf96('0x13')](_0xdf96('0x19'),_0xc354be);logger[_0xdf96('0x14')]('ShowSquareProject',_0xc354be,JSON[_0xdf96('0x15')](_0x2bda0a));_0x29427c(_0x2bda0a);})['catch'](function(_0x27f369){logger[_0xdf96('0x17')]('ShowSquareProject',_0x27f369[_0xdf96('0x18')],_0xc354be);_0x1e275c(_0x45302d[_0xdf96('0x17')](0x1f4,_0x27f369[_0xdf96('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 18436ce..66a4120 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 _0xa8da=['save','remove','update','register','length','squareProject:'];(function(_0x281ba3,_0x35f75b){var _0x51cf9c=function(_0x14818f){while(--_0x14818f){_0x281ba3['push'](_0x281ba3['shift']());}};_0x51cf9c(++_0x35f75b);}(_0xa8da,0x17a));var _0xaa8d=function(_0x22e059,_0x32975e){_0x22e059=_0x22e059-0x0;var _0x41c11e=_0xa8da[_0x22e059];return _0x41c11e;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0xaa8d('0x0'),_0xaa8d('0x1'),_0xaa8d('0x2')];function createListener(_0x321dd3,_0x440a03){return function(_0x1c7cd4){_0x440a03['emit'](_0x321dd3,_0x1c7cd4);};}function removeListener(_0x1c56e9,_0x772789){return function(){SquareProjectEvents['removeListener'](_0x1c56e9,_0x772789);};}exports[_0xaa8d('0x3')]=function(_0x3c67e1){for(var _0xa2b1d8=0x0,_0x20bbf0=events[_0xaa8d('0x4')];_0xa2b1d8<_0x20bbf0;_0xa2b1d8++){var _0x319db6=events[_0xa2b1d8];var _0x3b3e21=createListener(_0xaa8d('0x5')+_0x319db6,_0x3c67e1);SquareProjectEvents['on'](_0x319db6,_0x3b3e21);}}; \ No newline at end of file +var _0xc527=['length','squareProject:','./squareProject.events','remove','emit','removeListener'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0xc527,0x1e2));var _0x7c52=function(_0x204477,_0x2f9915){_0x204477=_0x204477-0x0;var _0x1a5ef9=_0xc527[_0x204477];return _0x1a5ef9;};'use strict';var SquareProjectEvents=require(_0x7c52('0x0'));var events=['save',_0x7c52('0x1'),'update'];function createListener(_0x543093,_0xe576d9){return function(_0x4a112d){_0xe576d9[_0x7c52('0x2')](_0x543093,_0x4a112d);};}function removeListener(_0x136798,_0x581a71){return function(){SquareProjectEvents[_0x7c52('0x3')](_0x136798,_0x581a71);};}exports['register']=function(_0x580fbb){for(var _0x31648e=0x0,_0x4f77bf=events[_0x7c52('0x4')];_0x31648e<_0x4f77bf;_0x31648e++){var _0x3e9457=events[_0x31648e];var _0x23a08c=createListener(_0x7c52('0x5')+_0x3e9457,_0x580fbb);SquareProjectEvents['on'](_0x3e9457,_0x23a08c);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 6ed86b0..7bfb609 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(_0x64e597,_0x1f5e9d){var _0x14a6c3=function(_0x21b19f){while(--_0x21b19f){_0x64e597['push'](_0x64e597['shift']());}};_0x14a6c3(++_0x1f5e9d);}(_0x4975,0x86));var _0x5497=function(_0x391287,_0x2acad8){_0x391287=_0x391287-0x0;var _0x53fa94=_0x4975[_0x391287];return _0x53fa94;};'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 _0xc4aa=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./squareRecording.controller','get','isAuthenticated','index','/:id','/:id/download','download','create','put','delete'];(function(_0x18758d,_0x292dfe){var _0x49d650=function(_0x34fdee){while(--_0x34fdee){_0x18758d['push'](_0x18758d['shift']());}};_0x49d650(++_0x292dfe);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0xc4aa[_0x4d613c];return _0x301fe3;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xac4a('0x6'));var controller=require(_0xac4a('0x7'));router[_0xac4a('0x8')]('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xa')]);router[_0xac4a('0x8')](_0xac4a('0xb'),auth[_0xac4a('0x9')](),controller['show']);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xd')]);router['post']('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xe')]);router[_0xac4a('0xf')]('/:id',auth[_0xac4a('0x9')](),controller['update']);router[_0xac4a('0x10')]('/:id',auth[_0xac4a('0x9')](),controller[_0xac4a('0x11')]);module[_0xac4a('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index b6262b7..4278644 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 _0xac31=['STRING','VIRTUAL','savePath','lastIndexOf','sequelize','exports'];(function(_0x3ec5ce,_0x4b97aa){var _0x3a9e68=function(_0x2e2be4){while(--_0x2e2be4){_0x3ec5ce['push'](_0x3ec5ce['shift']());}};_0x3a9e68(++_0x4b97aa);}(_0xac31,0xca));var _0x1ac3=function(_0x4ae1c9,_0x99b14a){_0x4ae1c9=_0x4ae1c9-0x0;var _0x5af8e4=_0xac31[_0x4ae1c9];return _0x5af8e4;};'use strict';var Sequelize=require(_0x1ac3('0x0'));module[_0x1ac3('0x1')]={'uniqueid':{'type':Sequelize[_0x1ac3('0x2')]},'callerid':{'type':Sequelize[_0x1ac3('0x2')]},'calleridname':{'type':Sequelize[_0x1ac3('0x2')]},'context':{'type':Sequelize[_0x1ac3('0x2')]},'extension':{'type':Sequelize[_0x1ac3('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x1ac3('0x2')]},'dnid':{'type':Sequelize[_0x1ac3('0x2')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0x1ac3('0x2')]},'savePath':{'type':Sequelize[_0x1ac3('0x2')]},'format':{'type':Sequelize[_0x1ac3('0x3')],'get':function(){var _0x1be223='';var _0x157604=this['getDataValue'](_0x1ac3('0x4'));if(_0x157604){_0x1be223=_0x157604['substring'](_0x157604[_0x1ac3('0x5')]('.'));}return _0x1be223;}}}; \ No newline at end of file +var _0x6f47=['savePath','substring','lastIndexOf','exports','STRING','VIRTUAL','getDataValue'];(function(_0x2b898b,_0x1b3bda){var _0x59cd44=function(_0x242858){while(--_0x242858){_0x2b898b['push'](_0x2b898b['shift']());}};_0x59cd44(++_0x1b3bda);}(_0x6f47,0xc7));var _0x76f4=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0x6f47[_0x50007c];return _0x5c1ec7;};'use strict';var Sequelize=require('sequelize');module[_0x76f4('0x0')]={'uniqueid':{'type':Sequelize[_0x76f4('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x76f4('0x1')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x76f4('0x1')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x76f4('0x1')]},'dnid':{'type':Sequelize[_0x76f4('0x1')]},'projectName':{'type':Sequelize[_0x76f4('0x1')]},'saveName':{'type':Sequelize[_0x76f4('0x1')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0x76f4('0x1')]},'format':{'type':Sequelize[_0x76f4('0x2')],'get':function(){var _0x2176a7='';var _0x497f99=this[_0x76f4('0x3')](_0x76f4('0x4'));if(_0x497f99){_0x2176a7=_0x497f99[_0x76f4('0x5')](_0x497f99[_0x76f4('0x6')]('.'));}return _0x2176a7;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index b043d9d..c28169e 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 _0x5acf=['query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','where','merge','VIRTUAL','filter','options','include','findAll','params','keys','includeAll','find','catch','create','body','download','../../components/encryptor','uniqueid','savePath','filename','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','extname','unlink','message','SquareRecording\x20not\x20found','Not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','.cypher','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','map','SquareRecording','rawAttributes','fieldName','type','key','model'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x5acf,0xec));var _0xf5ac=function(_0x4d7d5c,_0x1a456d){_0x4d7d5c=_0x4d7d5c-0x0;var _0x2c0910=_0x5acf[_0x4d7d5c];return _0x2c0910;};'use strict';var emlformat=require(_0xf5ac('0x0'));var rimraf=require(_0xf5ac('0x1'));var zipdir=require(_0xf5ac('0x2'));var jsonpatch=require(_0xf5ac('0x3'));var rp=require(_0xf5ac('0x4'));var moment=require('moment');var BPromise=require(_0xf5ac('0x5'));var Mustache=require(_0xf5ac('0x6'));var util=require(_0xf5ac('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xf5ac('0x8'));var ejs=require(_0xf5ac('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf5ac('0xa'));var squel=require(_0xf5ac('0xb'));var crypto=require('crypto');var jsforce=require(_0xf5ac('0xc'));var deskjs=require(_0xf5ac('0xd'));var toCsv=require('to-csv');var querystring=require(_0xf5ac('0xe'));var Papa=require(_0xf5ac('0xf'));var Redis=require(_0xf5ac('0x10'));var authService=require(_0xf5ac('0x11'));var qs=require(_0xf5ac('0x12'));var as=require(_0xf5ac('0x13'));var hardwareService=require(_0xf5ac('0x14'));var logger=require(_0xf5ac('0x15'))(_0xf5ac('0x16'));var utils=require(_0xf5ac('0x17'));var config=require(_0xf5ac('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xf5ac('0x19'))['db'];function respondWithStatusCode(_0x53b110,_0x482e72){_0x482e72=_0x482e72||0xcc;return function(_0x2d15b6){if(_0x2d15b6){return _0x53b110[_0xf5ac('0x1a')](_0x482e72);}return _0x53b110[_0xf5ac('0x1b')](_0x482e72)[_0xf5ac('0x1c')]();};}function respondWithResult(_0x39fa5e,_0x4c975f){_0x4c975f=_0x4c975f||0xc8;return function(_0x275cae){if(_0x275cae){return _0x39fa5e[_0xf5ac('0x1b')](_0x4c975f)[_0xf5ac('0x1d')](_0x275cae);}};}function respondWithFilteredResult(_0x38e229,_0x139487){return function(_0x2ac5f5){if(_0x2ac5f5){var _0x2b1f26=typeof _0x139487[_0xf5ac('0x1e')]==='undefined'&&typeof _0x139487[_0xf5ac('0x1f')]===_0xf5ac('0x20');var _0x589f57=_0x2ac5f5[_0xf5ac('0x21')];var _0x5b8e8a=_0x2b1f26?0x0:_0x139487[_0xf5ac('0x1e')];var _0x1d3c0e=_0x2b1f26?_0x2ac5f5[_0xf5ac('0x21')]:_0x139487[_0xf5ac('0x1e')]+_0x139487[_0xf5ac('0x1f')];var _0xac3a95;if(_0x1d3c0e>=_0x589f57){_0x1d3c0e=_0x589f57;_0xac3a95=0xc8;}else{_0xac3a95=0xce;}_0x38e229['status'](_0xac3a95);return _0x38e229[_0xf5ac('0x22')](_0xf5ac('0x23'),_0x5b8e8a+'-'+_0x1d3c0e+'/'+_0x589f57)['json'](_0x2ac5f5);}return null;};}function patchUpdates(_0x1f4a2d){return function(_0x3e7d9d){try{jsonpatch[_0xf5ac('0x24')](_0x3e7d9d,_0x1f4a2d,!![]);}catch(_0x6f8c7a){return BPromise[_0xf5ac('0x25')](_0x6f8c7a);}return _0x3e7d9d[_0xf5ac('0x26')]();};}function saveUpdates(_0x49011a,_0x36cdb3){return function(_0x38b980){if(_0x38b980){return _0x38b980[_0xf5ac('0x27')](_0x49011a)[_0xf5ac('0x28')](function(_0x3970c8){return _0x3970c8;});}return null;};}function removeEntity(_0x41713a,_0x490fb2){return function(_0x3b645d){if(_0x3b645d){return _0x3b645d[_0xf5ac('0x29')]()[_0xf5ac('0x28')](function(){_0x41713a[_0xf5ac('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39464f,_0x4b797c){return function(_0x3aa23a){if(!_0x3aa23a){_0x39464f[_0xf5ac('0x1a')](0x194);}return _0x3aa23a;};}function handleError(_0x16040e,_0x435f14){_0x435f14=_0x435f14||0x1f4;return function(_0x3033f4){logger['error'](_0x3033f4[_0xf5ac('0x2a')]);if(_0x3033f4[_0xf5ac('0x2b')]){delete _0x3033f4[_0xf5ac('0x2b')];}_0x16040e['status'](_0x435f14)[_0xf5ac('0x2c')](_0x3033f4);};}exports['index']=function(_0x617af1,_0x36b400){var _0x4a552b={},_0x525050={},_0x2d7363={'count':0x0,'rows':[]};var _0x110660=_[_0xf5ac('0x2d')](db[_0xf5ac('0x2e')][_0xf5ac('0x2f')],function(_0x3ee77b){return{'name':_0x3ee77b[_0xf5ac('0x30')],'type':_0x3ee77b[_0xf5ac('0x31')][_0xf5ac('0x32')]};});_0x525050[_0xf5ac('0x33')]=_['map'](_0x110660,_0xf5ac('0x2b'));_0x525050[_0xf5ac('0x34')]=_['keys'](_0x617af1[_0xf5ac('0x34')]);_0x525050[_0xf5ac('0x35')]=_[_0xf5ac('0x36')](_0x525050['model'],_0x525050[_0xf5ac('0x34')]);_0x4a552b['attributes']=_[_0xf5ac('0x36')](_0x525050[_0xf5ac('0x33')],qs[_0xf5ac('0x37')](_0x617af1[_0xf5ac('0x34')][_0xf5ac('0x37')]));_0x4a552b[_0xf5ac('0x38')]=_0x4a552b['attributes'][_0xf5ac('0x39')]?_0x4a552b[_0xf5ac('0x38')]:_0x525050['model'];if(!_0x617af1[_0xf5ac('0x34')][_0xf5ac('0x3a')](_0xf5ac('0x3b'))){_0x4a552b[_0xf5ac('0x1f')]=qs[_0xf5ac('0x1f')](_0x617af1[_0xf5ac('0x34')][_0xf5ac('0x1f')]);_0x4a552b[_0xf5ac('0x1e')]=qs[_0xf5ac('0x1e')](_0x617af1[_0xf5ac('0x34')][_0xf5ac('0x1e')]);}_0x4a552b['order']=qs['sort'](_0x617af1[_0xf5ac('0x34')]['sort']);_0x4a552b[_0xf5ac('0x3c')]=qs[_0xf5ac('0x35')](_['pick'](_0x617af1[_0xf5ac('0x34')],_0x525050[_0xf5ac('0x35')]),_0x110660);if(_0x617af1[_0xf5ac('0x34')]['filter']){_0x4a552b[_0xf5ac('0x3c')]=_[_0xf5ac('0x3d')](_0x4a552b['where'],{'$or':_['map'](_0x110660,function(_0xc9a99f){if(_0xc9a99f[_0xf5ac('0x31')]!==_0xf5ac('0x3e')){var _0x36d172={};_0x36d172[_0xc9a99f[_0xf5ac('0x2b')]]={'$like':'%'+_0x617af1['query'][_0xf5ac('0x3f')]+'%'};return _0x36d172;}})});}_0x4a552b=_[_0xf5ac('0x3d')]({},_0x4a552b,_0x617af1[_0xf5ac('0x40')]);var _0x53eaac={'where':_0x4a552b[_0xf5ac('0x3c')]};return db[_0xf5ac('0x2e')]['count'](_0x53eaac)[_0xf5ac('0x28')](function(_0x2b5600){_0x2d7363['count']=_0x2b5600;if(_0x617af1[_0xf5ac('0x34')]['includeAll']){_0x4a552b[_0xf5ac('0x41')]=[{'all':!![]}];}return db[_0xf5ac('0x2e')][_0xf5ac('0x42')](_0x4a552b);})[_0xf5ac('0x28')](function(_0x2dae02){_0x2d7363['rows']=_0x2dae02;return _0x2d7363;})[_0xf5ac('0x28')](respondWithFilteredResult(_0x36b400,_0x4a552b))['catch'](handleError(_0x36b400,null));};exports['show']=function(_0x182645,_0x567c0d){var _0x56b39d={'raw':!![],'where':{'id':_0x182645[_0xf5ac('0x43')]['id']}},_0x241e01={};_0x241e01['model']=_[_0xf5ac('0x44')](db['SquareRecording'][_0xf5ac('0x2f')]);_0x241e01[_0xf5ac('0x34')]=_[_0xf5ac('0x44')](_0x182645[_0xf5ac('0x34')]);_0x241e01['filters']=_[_0xf5ac('0x36')](_0x241e01['model'],_0x241e01['query']);_0x56b39d[_0xf5ac('0x38')]=_[_0xf5ac('0x36')](_0x241e01[_0xf5ac('0x33')],qs[_0xf5ac('0x37')](_0x182645[_0xf5ac('0x34')][_0xf5ac('0x37')]));_0x56b39d['attributes']=_0x56b39d[_0xf5ac('0x38')][_0xf5ac('0x39')]?_0x56b39d[_0xf5ac('0x38')]:_0x241e01['model'];if(_0x182645[_0xf5ac('0x34')][_0xf5ac('0x45')]){_0x56b39d['include']=[{'all':!![]}];}_0x56b39d=_[_0xf5ac('0x3d')]({},_0x56b39d,_0x182645[_0xf5ac('0x40')]);return db[_0xf5ac('0x2e')][_0xf5ac('0x46')](_0x56b39d)[_0xf5ac('0x28')](handleEntityNotFound(_0x567c0d,null))[_0xf5ac('0x28')](respondWithResult(_0x567c0d,null))[_0xf5ac('0x47')](handleError(_0x567c0d,null));};exports['create']=function(_0x56cbee,_0x2704f5){return db[_0xf5ac('0x2e')][_0xf5ac('0x48')](_0x56cbee[_0xf5ac('0x49')],{})[_0xf5ac('0x28')](respondWithResult(_0x2704f5,0xc9))[_0xf5ac('0x47')](handleError(_0x2704f5,null));};exports['update']=function(_0x39740c,_0x4b2b9f){if(_0x39740c[_0xf5ac('0x49')]['id']){delete _0x39740c['body']['id'];}return db[_0xf5ac('0x2e')][_0xf5ac('0x46')]({'where':{'id':_0x39740c['params']['id']}})['then'](handleEntityNotFound(_0x4b2b9f,null))['then'](saveUpdates(_0x39740c['body'],null))[_0xf5ac('0x28')](respondWithResult(_0x4b2b9f,null))['catch'](handleError(_0x4b2b9f,null));};exports[_0xf5ac('0x4a')]=function(_0x430d1c,_0x2d7c6e,_0x4ac31b){var _0x1bdaea=require(_0xf5ac('0x4b'));var _0x265a7a=![];var _0x3eaae0={};if(_0x430d1c[_0xf5ac('0x34')][_0xf5ac('0x31')]&&_0x430d1c[_0xf5ac('0x34')][_0xf5ac('0x31')]===_0xf5ac('0x4c')){_0x3eaae0[_0xf5ac('0x4c')]=_0x430d1c[_0xf5ac('0x43')]['id'];}else{_0x3eaae0['id']=_0x430d1c[_0xf5ac('0x43')]['id'];}return db[_0xf5ac('0x2e')]['find']({'where':_0x3eaae0,'attributes':['id',_0xf5ac('0x4d'),_0xf5ac('0x4e')],'raw':!![]})['then'](handleEntityNotFound(_0x2d7c6e,null))[_0xf5ac('0x28')](function(_0x49eea6){if(_0x49eea6){var _0x52ae69=_0x49eea6[_0xf5ac('0x4d')];var _0xdb070d=util['format'](_0xf5ac('0x4f'),_0x52ae69);if(fs[_0xf5ac('0x50')](_0xdb070d)){_0x265a7a=!![];return _0x1bdaea[_0xf5ac('0x51')](_0xdb070d,_0x52ae69,config[_0xf5ac('0x52')][_0xf5ac('0x53')])[_0xf5ac('0x28')](function(){return _0x49eea6;});}return _0x49eea6;}})['then'](function(_0x423385){if(_0x423385){var _0x296689=_0x423385[_0xf5ac('0x4d')];if(!fs[_0xf5ac('0x50')](_0x296689)){throw new db[(_0xf5ac('0x54'))]['ValidationError']('SquareRecording\x20not\x20found');}if(_0x423385[_0xf5ac('0x4e')]){return _0x2d7c6e['download'](_0x296689,_0x423385['filename']+path[_0xf5ac('0x55')](_0x296689),function(){if(_0x265a7a){fs[_0xf5ac('0x56')](_0x296689);}});}else{return _0x2d7c6e['download'](_0x296689,function(_0x12f62e){if(_0x265a7a){fs[_0xf5ac('0x56')](_0x296689);}});}}})[_0xf5ac('0x47')](function(_0x3ef7ed){if(_0x3ef7ed[_0xf5ac('0x57')]===_0xf5ac('0x58')){_0x2d7c6e['status'](0x194)[_0xf5ac('0x2c')](_0xf5ac('0x59'));}else{return handleError(_0x2d7c6e,null);}});};exports[_0xf5ac('0x29')]=function(_0x3ab61f,_0x35a32c){return db[_0xf5ac('0x2e')][_0xf5ac('0x46')]({'where':{'id':_0x3ab61f[_0xf5ac('0x43')]['id']}})[_0xf5ac('0x28')](function(_0x568985){if(_['isNil'](_0x568985)){throw new ReferenceError('Entity\x20not\x20found');}return _0x568985;})['then'](function(_0x15ada6){var _0x5f52f9=_0x15ada6['savePath'];logger[_0xf5ac('0x5a')](_0xf5ac('0x5b'),_0x5f52f9);if(!_[_0xf5ac('0x5c')](_0x15ada6[_0xf5ac('0x4d')])&&fs[_0xf5ac('0x50')](_0x5f52f9)){logger[_0xf5ac('0x5a')](_0xf5ac('0x5d')+_0x5f52f9+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x5f52f9);}_0x5f52f9=_0x5f52f9+_0xf5ac('0x5e');if(!_[_0xf5ac('0x5c')](_0x15ada6[_0xf5ac('0x4d')])&&fs[_0xf5ac('0x50')](_0x5f52f9)){logger[_0xf5ac('0x5a')](_0xf5ac('0x5d')+_0x5f52f9+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xf5ac('0x5f')](_0x5f52f9);}return _0x15ada6;})[_0xf5ac('0x28')](function(_0x24aa90){if(!_0x24aa90)throw new InternalError();return _0x24aa90[_0xf5ac('0x29')]();})[_0xf5ac('0x28')](function(){_0x35a32c[_0xf5ac('0x1b')](0xcc)[_0xf5ac('0x1c')]();})[_0xf5ac('0x47')](handleError(_0x35a32c,null));}; \ No newline at end of file +var _0x103e=['jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','SquareRecording','rawAttributes','fieldName','type','key','keys','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','includeAll','include','rows','catch','show','params','options','create','body','find','../../components/encryptor','savePath','format','%s.cypher','existsSync','decryptFile','secrets','Sequelize','ValidationError','SquareRecording\x20not\x20found','filename','download','extname','unlink','message','Not\x20found','isNil','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','ejs','fs-extra','lodash','squel'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0x103e,0x114));var _0xe103=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x103e[_0x502c7d];return _0x30b7ed;};'use strict';var emlformat=require(_0xe103('0x0'));var rimraf=require(_0xe103('0x1'));var zipdir=require(_0xe103('0x2'));var jsonpatch=require(_0xe103('0x3'));var rp=require('request-promise');var moment=require(_0xe103('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe103('0x5'));var util=require(_0xe103('0x6'));var path=require('path');var sox=require(_0xe103('0x7'));var csv=require('to-csv');var ejs=require(_0xe103('0x8'));var fs=require('fs');var fs_extra=require(_0xe103('0x9'));var _=require(_0xe103('0xa'));var squel=require(_0xe103('0xb'));var crypto=require('crypto');var jsforce=require(_0xe103('0xc'));var deskjs=require(_0xe103('0xd'));var toCsv=require(_0xe103('0xe'));var querystring=require(_0xe103('0xf'));var Papa=require('papaparse');var Redis=require(_0xe103('0x10'));var authService=require(_0xe103('0x11'));var qs=require(_0xe103('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xe103('0x13'));var config=require(_0xe103('0x14'));var licenseUtil=require(_0xe103('0x15'));var db=require(_0xe103('0x16'))['db'];function respondWithStatusCode(_0x4ac10d,_0x35aa5b){_0x35aa5b=_0x35aa5b||0xcc;return function(_0x24eae7){if(_0x24eae7){return _0x4ac10d[_0xe103('0x17')](_0x35aa5b);}return _0x4ac10d['status'](_0x35aa5b)[_0xe103('0x18')]();};}function respondWithResult(_0x34019d,_0xd28974){_0xd28974=_0xd28974||0xc8;return function(_0x70c2dc){if(_0x70c2dc){return _0x34019d['status'](_0xd28974)[_0xe103('0x19')](_0x70c2dc);}};}function respondWithFilteredResult(_0x34e0c9,_0x533919){return function(_0x5cad96){if(_0x5cad96){var _0x47b7ae=typeof _0x533919[_0xe103('0x1a')]===_0xe103('0x1b')&&typeof _0x533919[_0xe103('0x1c')]===_0xe103('0x1b');var _0x10502a=_0x5cad96[_0xe103('0x1d')];var _0x1babfa=_0x47b7ae?0x0:_0x533919[_0xe103('0x1a')];var _0x247bd6=_0x47b7ae?_0x5cad96[_0xe103('0x1d')]:_0x533919[_0xe103('0x1a')]+_0x533919[_0xe103('0x1c')];var _0x26d260;if(_0x247bd6>=_0x10502a){_0x247bd6=_0x10502a;_0x26d260=0xc8;}else{_0x26d260=0xce;}_0x34e0c9[_0xe103('0x1e')](_0x26d260);return _0x34e0c9['set'](_0xe103('0x1f'),_0x1babfa+'-'+_0x247bd6+'/'+_0x10502a)[_0xe103('0x19')](_0x5cad96);}return null;};}function patchUpdates(_0x51eab6){return function(_0x3df2b4){try{jsonpatch[_0xe103('0x20')](_0x3df2b4,_0x51eab6,!![]);}catch(_0x29f2af){return BPromise[_0xe103('0x21')](_0x29f2af);}return _0x3df2b4[_0xe103('0x22')]();};}function saveUpdates(_0x47ff08,_0x1631a7){return function(_0x13f6ac){if(_0x13f6ac){return _0x13f6ac[_0xe103('0x23')](_0x47ff08)[_0xe103('0x24')](function(_0x5e7f73){return _0x5e7f73;});}return null;};}function removeEntity(_0xc89376,_0x574259){return function(_0x30a4f9){if(_0x30a4f9){return _0x30a4f9['destroy']()[_0xe103('0x24')](function(){_0xc89376[_0xe103('0x1e')](0xcc)[_0xe103('0x18')]();});}};}function handleEntityNotFound(_0x57fad7,_0x122898){return function(_0x15fc5f){if(!_0x15fc5f){_0x57fad7[_0xe103('0x17')](0x194);}return _0x15fc5f;};}function handleError(_0x23017f,_0x16bcb7){_0x16bcb7=_0x16bcb7||0x1f4;return function(_0x5f32fd){logger[_0xe103('0x25')](_0x5f32fd[_0xe103('0x26')]);if(_0x5f32fd[_0xe103('0x27')]){delete _0x5f32fd[_0xe103('0x27')];}_0x23017f[_0xe103('0x1e')](_0x16bcb7)[_0xe103('0x28')](_0x5f32fd);};}exports[_0xe103('0x29')]=function(_0x18c767,_0x4a1377){var _0x5cfbdd={},_0x3b5507={},_0x1f50e4={'count':0x0,'rows':[]};var _0x13a2ba=_[_0xe103('0x2a')](db[_0xe103('0x2b')][_0xe103('0x2c')],function(_0x505f83){return{'name':_0x505f83[_0xe103('0x2d')],'type':_0x505f83[_0xe103('0x2e')][_0xe103('0x2f')]};});_0x3b5507['model']=_[_0xe103('0x2a')](_0x13a2ba,_0xe103('0x27'));_0x3b5507['query']=_[_0xe103('0x30')](_0x18c767['query']);_0x3b5507['filters']=_[_0xe103('0x31')](_0x3b5507[_0xe103('0x32')],_0x3b5507[_0xe103('0x33')]);_0x5cfbdd[_0xe103('0x34')]=_[_0xe103('0x31')](_0x3b5507[_0xe103('0x32')],qs[_0xe103('0x35')](_0x18c767['query'][_0xe103('0x35')]));_0x5cfbdd[_0xe103('0x34')]=_0x5cfbdd['attributes'][_0xe103('0x36')]?_0x5cfbdd[_0xe103('0x34')]:_0x3b5507[_0xe103('0x32')];if(!_0x18c767[_0xe103('0x33')][_0xe103('0x37')](_0xe103('0x38'))){_0x5cfbdd[_0xe103('0x1c')]=qs['limit'](_0x18c767[_0xe103('0x33')]['limit']);_0x5cfbdd['offset']=qs[_0xe103('0x1a')](_0x18c767[_0xe103('0x33')][_0xe103('0x1a')]);}_0x5cfbdd[_0xe103('0x39')]=qs[_0xe103('0x3a')](_0x18c767[_0xe103('0x33')]['sort']);_0x5cfbdd['where']=qs[_0xe103('0x3b')](_['pick'](_0x18c767[_0xe103('0x33')],_0x3b5507[_0xe103('0x3b')]),_0x13a2ba);if(_0x18c767[_0xe103('0x33')][_0xe103('0x3c')]){_0x5cfbdd[_0xe103('0x3d')]=_[_0xe103('0x3e')](_0x5cfbdd[_0xe103('0x3d')],{'$or':_[_0xe103('0x2a')](_0x13a2ba,function(_0x1db54c){if(_0x1db54c['type']!=='VIRTUAL'){var _0x4707a8={};_0x4707a8[_0x1db54c[_0xe103('0x27')]]={'$like':'%'+_0x18c767[_0xe103('0x33')][_0xe103('0x3c')]+'%'};return _0x4707a8;}})});}_0x5cfbdd=_['merge']({},_0x5cfbdd,_0x18c767['options']);var _0x4b072c={'where':_0x5cfbdd[_0xe103('0x3d')]};return db[_0xe103('0x2b')]['count'](_0x4b072c)[_0xe103('0x24')](function(_0x480236){_0x1f50e4['count']=_0x480236;if(_0x18c767[_0xe103('0x33')][_0xe103('0x3f')]){_0x5cfbdd[_0xe103('0x40')]=[{'all':!![]}];}return db[_0xe103('0x2b')]['findAll'](_0x5cfbdd);})[_0xe103('0x24')](function(_0x5cb02a){_0x1f50e4[_0xe103('0x41')]=_0x5cb02a;return _0x1f50e4;})[_0xe103('0x24')](respondWithFilteredResult(_0x4a1377,_0x5cfbdd))[_0xe103('0x42')](handleError(_0x4a1377,null));};exports[_0xe103('0x43')]=function(_0x579743,_0x395a4f){var _0x13c429={'raw':!![],'where':{'id':_0x579743[_0xe103('0x44')]['id']}},_0x14cb8c={};_0x14cb8c[_0xe103('0x32')]=_[_0xe103('0x30')](db['SquareRecording'][_0xe103('0x2c')]);_0x14cb8c['query']=_[_0xe103('0x30')](_0x579743[_0xe103('0x33')]);_0x14cb8c[_0xe103('0x3b')]=_[_0xe103('0x31')](_0x14cb8c[_0xe103('0x32')],_0x14cb8c['query']);_0x13c429[_0xe103('0x34')]=_['intersection'](_0x14cb8c[_0xe103('0x32')],qs[_0xe103('0x35')](_0x579743['query'][_0xe103('0x35')]));_0x13c429['attributes']=_0x13c429[_0xe103('0x34')][_0xe103('0x36')]?_0x13c429[_0xe103('0x34')]:_0x14cb8c[_0xe103('0x32')];if(_0x579743[_0xe103('0x33')][_0xe103('0x3f')]){_0x13c429['include']=[{'all':!![]}];}_0x13c429=_['merge']({},_0x13c429,_0x579743[_0xe103('0x45')]);return db['SquareRecording']['find'](_0x13c429)[_0xe103('0x24')](handleEntityNotFound(_0x395a4f,null))[_0xe103('0x24')](respondWithResult(_0x395a4f,null))['catch'](handleError(_0x395a4f,null));};exports[_0xe103('0x46')]=function(_0x3606cd,_0x3adfa9){return db[_0xe103('0x2b')][_0xe103('0x46')](_0x3606cd[_0xe103('0x47')],{})[_0xe103('0x24')](respondWithResult(_0x3adfa9,0xc9))[_0xe103('0x42')](handleError(_0x3adfa9,null));};exports['update']=function(_0x7aab6f,_0x98dfb2){if(_0x7aab6f[_0xe103('0x47')]['id']){delete _0x7aab6f[_0xe103('0x47')]['id'];}return db[_0xe103('0x2b')][_0xe103('0x48')]({'where':{'id':_0x7aab6f[_0xe103('0x44')]['id']}})[_0xe103('0x24')](handleEntityNotFound(_0x98dfb2,null))[_0xe103('0x24')](saveUpdates(_0x7aab6f[_0xe103('0x47')],null))[_0xe103('0x24')](respondWithResult(_0x98dfb2,null))['catch'](handleError(_0x98dfb2,null));};exports['download']=function(_0xbf930a,_0x559dd1,_0x1cbb90){var _0x31a9e4=require(_0xe103('0x49'));var _0xa44eac=![];var _0x495dda={};if(_0xbf930a[_0xe103('0x33')]['type']&&_0xbf930a[_0xe103('0x33')][_0xe103('0x2e')]==='uniqueid'){_0x495dda['uniqueid']=_0xbf930a[_0xe103('0x44')]['id'];}else{_0x495dda['id']=_0xbf930a[_0xe103('0x44')]['id'];}return db[_0xe103('0x2b')][_0xe103('0x48')]({'where':_0x495dda,'attributes':['id','savePath','filename'],'raw':!![]})[_0xe103('0x24')](handleEntityNotFound(_0x559dd1,null))['then'](function(_0x4408d0){if(_0x4408d0){var _0x26e3d1=_0x4408d0[_0xe103('0x4a')];var _0x494216=util[_0xe103('0x4b')](_0xe103('0x4c'),_0x26e3d1);if(fs[_0xe103('0x4d')](_0x494216)){_0xa44eac=!![];return _0x31a9e4[_0xe103('0x4e')](_0x494216,_0x26e3d1,config[_0xe103('0x4f')]['recording'])[_0xe103('0x24')](function(){return _0x4408d0;});}return _0x4408d0;}})[_0xe103('0x24')](function(_0x166685){if(_0x166685){var _0x46f43b=_0x166685[_0xe103('0x4a')];if(!fs['existsSync'](_0x46f43b)){throw new db[(_0xe103('0x50'))][(_0xe103('0x51'))](_0xe103('0x52'));}if(_0x166685[_0xe103('0x53')]){return _0x559dd1[_0xe103('0x54')](_0x46f43b,_0x166685[_0xe103('0x53')]+path[_0xe103('0x55')](_0x46f43b),function(){if(_0xa44eac){fs['unlink'](_0x46f43b);}});}else{return _0x559dd1[_0xe103('0x54')](_0x46f43b,function(_0x4e50a5){if(_0xa44eac){fs[_0xe103('0x56')](_0x46f43b);}});}}})['catch'](function(_0x2f75bb){if(_0x2f75bb[_0xe103('0x57')]===_0xe103('0x52')){_0x559dd1[_0xe103('0x1e')](0x194)[_0xe103('0x28')](_0xe103('0x58'));}else{return handleError(_0x559dd1,null);}});};exports['destroy']=function(_0x48d4e7,_0x56ef89){return db['SquareRecording']['find']({'where':{'id':_0x48d4e7[_0xe103('0x44')]['id']}})[_0xe103('0x24')](function(_0xfe7474){if(_[_0xe103('0x59')](_0xfe7474)){throw new ReferenceError(_0xe103('0x5a'));}return _0xfe7474;})['then'](function(_0x11f8ba){var _0x221246=_0x11f8ba['savePath'];logger[_0xe103('0x5b')]('cancellazione\x20fisica\x20documento\x20%s',_0x221246);if(!_[_0xe103('0x59')](_0x11f8ba['savePath'])&&fs[_0xe103('0x4d')](_0x221246)){logger[_0xe103('0x5b')](_0xe103('0x5c')+_0x221246+_0xe103('0x5d'));fs[_0xe103('0x5e')](_0x221246);}_0x221246=_0x221246+_0xe103('0x5f');if(!_[_0xe103('0x59')](_0x11f8ba['savePath'])&&fs[_0xe103('0x4d')](_0x221246)){logger[_0xe103('0x5b')]('File:\x20\x22'+_0x221246+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x221246);}return _0x11f8ba;})[_0xe103('0x24')](function(_0x2b03c2){if(!_0x2b03c2)throw new InternalError();return _0x2b03c2['destroy']();})[_0xe103('0x24')](function(){_0x56ef89[_0xe103('0x1e')](0xcc)['end']();})[_0xe103('0x42')](handleError(_0x56ef89,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 03c1bae..82bdde4 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 _0x9e54=['lodash','util','bluebird','request-promise','path','../../config/environment','./squareRecording.attributes','SquareRecording'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x9e54,0x88));var _0x49e5=function(_0x336595,_0x413e3d){_0x336595=_0x336595-0x0;var _0x600f95=_0x9e54[_0x336595];return _0x600f95;};'use strict';var _=require(_0x49e5('0x0'));var util=require(_0x49e5('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x49e5('0x2'));var rp=require(_0x49e5('0x3'));var fs=require('fs');var path=require(_0x49e5('0x4'));var rimraf=require('rimraf');var config=require(_0x49e5('0x5'));var attributes=require(_0x49e5('0x6'));module['exports']=function(_0xa16cfa,_0x57486f){return _0xa16cfa['define'](_0x49e5('0x7'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0954=['bluebird','request-promise','path','rimraf','../../config/environment','./squareRecording.attributes','define','SquareRecording','square_recordings','lodash','../../config/logger','api'];(function(_0x419550,_0x15cdf1){var _0x55f9ef=function(_0x44f707){while(--_0x44f707){_0x419550['push'](_0x419550['shift']());}};_0x55f9ef(++_0x15cdf1);}(_0x0954,0x135));var _0x4095=function(_0x36f47c,_0x38ef4d){_0x36f47c=_0x36f47c-0x0;var _0x296c55=_0x0954[_0x36f47c];return _0x296c55;};'use strict';var _=require(_0x4095('0x0'));var util=require('util');var logger=require(_0x4095('0x1'))(_0x4095('0x2'));var moment=require('moment');var BPromise=require(_0x4095('0x3'));var rp=require(_0x4095('0x4'));var fs=require('fs');var path=require(_0x4095('0x5'));var rimraf=require(_0x4095('0x6'));var config=require(_0x4095('0x7'));var attributes=require(_0x4095('0x8'));module['exports']=function(_0x543154,_0x57ad9c){return _0x543154[_0x4095('0x9')](_0x4095('0xa'),attributes,{'tableName':_0x4095('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index 9a28224..84d40fd 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 _0x5f2f=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','SquareRecording,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CreateSquareRecording','SquareRecording','create','body','options','raw','lodash'];(function(_0x4da196,_0x357dc9){var _0x375df3=function(_0x366603){while(--_0x366603){_0x4da196['push'](_0x4da196['shift']());}};_0x375df3(++_0x357dc9);}(_0x5f2f,0x73));var _0xf5f2=function(_0x385304,_0xd75c30){_0x385304=_0x385304-0x0;var _0x2ac3d2=_0x5f2f[_0x385304];return _0x2ac3d2;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});}exports[_0xf5f2('0x17')]=function(_0x20fccd){var _0x28e097=this;return new Promise(function(_0x4ff59b,_0x3ee69){return db[_0xf5f2('0x18')][_0xf5f2('0x19')](_0x20fccd[_0xf5f2('0x1a')],{'raw':_0x20fccd['options']?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x47acfc){logger[_0xf5f2('0xd')](_0xf5f2('0x17'),_0x20fccd);logger['debug'](_0xf5f2('0x17'),_0x20fccd,JSON[_0xf5f2('0x10')](_0x47acfc));_0x4ff59b(_0x47acfc);})[_0xf5f2('0x16')](function(_0x39c024){logger[_0xf5f2('0x11')]('CreateSquareRecording',_0x39c024[_0xf5f2('0x13')],_0x20fccd);_0x3ee69(_0x28e097[_0xf5f2('0x11')](0x1f4,_0x39c024[_0xf5f2('0x13')]));});});}; \ No newline at end of file +var _0xdd07=['SquareRecording,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','SquareRecording','options','raw','CreateSquareRecording','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdd07,0x123));var _0x7dd0=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xdd07[_0x5d2803];return _0xdcad2c;};'use strict';var _=require(_0x7dd0('0x0'));var util=require(_0x7dd0('0x1'));var moment=require(_0x7dd0('0x2'));var BPromise=require(_0x7dd0('0x3'));var rs=require(_0x7dd0('0x4'));var fs=require('fs');var Redis=require(_0x7dd0('0x5'));var db=require(_0x7dd0('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x7dd0('0x7'))('rpc');var config=require(_0x7dd0('0x8'));var jayson=require(_0x7dd0('0x9'));var client=jayson['client'][_0x7dd0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ab6e6,_0x21d045,_0x3fa866){return new BPromise(function(_0x21c7c5,_0x2c4793){return client[_0x7dd0('0xb')](_0x1ab6e6,_0x3fa866)[_0x7dd0('0xc')](function(_0xf64db4){logger[_0x7dd0('0xd')](_0x7dd0('0xe'),_0x21d045,_0x7dd0('0xf'));logger[_0x7dd0('0x10')](_0x7dd0('0x11'),_0x21d045,_0x7dd0('0xf'),JSON[_0x7dd0('0x12')](_0xf64db4));if(_0xf64db4['error']){if(_0xf64db4['error'][_0x7dd0('0x13')]===0x1f4){logger[_0x7dd0('0x14')]('SquareRecording,\x20%s,\x20%s',_0x21d045,_0xf64db4['error'][_0x7dd0('0x15')]);return _0x2c4793(_0xf64db4[_0x7dd0('0x14')][_0x7dd0('0x15')]);}logger[_0x7dd0('0x14')]('SquareRecording,\x20%s,\x20%s',_0x21d045,_0xf64db4['error'][_0x7dd0('0x15')]);return _0x21c7c5(_0xf64db4[_0x7dd0('0x14')][_0x7dd0('0x15')]);}else{logger[_0x7dd0('0xd')](_0x7dd0('0xe'),_0x21d045,_0x7dd0('0xf'));_0x21c7c5(_0xf64db4[_0x7dd0('0x16')][_0x7dd0('0x15')]);}})[_0x7dd0('0x17')](function(_0x2c1053){logger[_0x7dd0('0x14')](_0x7dd0('0xe'),_0x21d045,_0x2c1053);_0x2c4793(_0x2c1053);});});}exports['CreateSquareRecording']=function(_0x59ec5c){var _0x1d6830=this;return new Promise(function(_0x23b1bd,_0x441ac1){return db[_0x7dd0('0x18')]['create'](_0x59ec5c['body'],{'raw':_0x59ec5c[_0x7dd0('0x19')]?_0x59ec5c[_0x7dd0('0x19')][_0x7dd0('0x1a')]===undefined?!![]:![]:!![]})[_0x7dd0('0xc')](function(_0x1e6954){logger[_0x7dd0('0xd')](_0x7dd0('0x1b'),_0x59ec5c);logger[_0x7dd0('0x10')](_0x7dd0('0x1b'),_0x59ec5c,JSON[_0x7dd0('0x12')](_0x1e6954));_0x23b1bd(_0x1e6954);})[_0x7dd0('0x17')](function(_0x49d2b6){logger[_0x7dd0('0x14')](_0x7dd0('0x1b'),_0x49d2b6[_0x7dd0('0x15')],_0x59ec5c);_0x441ac1(_0x1d6830[_0x7dd0('0x14')](0x1f4,_0x49d2b6[_0x7dd0('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index b5c1cd2..d0313a0 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(_0x1ee4fd,_0x2cbfc8){var _0x26cc5e=function(_0x18b62c){while(--_0x18b62c){_0x1ee4fd['push'](_0x1ee4fd['shift']());}};_0x26cc5e(++_0x2cbfc8);}(_0xbaf0,0x12a));var _0x0baf=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xbaf0[_0x4cf98e];return _0x1623ac;};'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 _0xe706=['/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index'];(function(_0x283e7e,_0x513284){var _0x50b0c6=function(_0x409b0e){while(--_0x409b0e){_0x283e7e['push'](_0x283e7e['shift']());}};_0x50b0c6(++_0x513284);}(_0xe706,0xa3));var _0x6e70=function(_0x2e50a2,_0x27f31e){_0x2e50a2=_0x2e50a2-0x0;var _0x47e5de=_0xe706[_0x2e50a2];return _0x47e5de;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller['update']);router['delete'](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x14')]);module[_0x6e70('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 707a9a0..15c14f3 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 _0x4bcc=['exports','STRING','DATE','BOOLEAN'];(function(_0x33cece,_0x54b9da){var _0x1a2efd=function(_0x3745e6){while(--_0x3745e6){_0x33cece['push'](_0x33cece['shift']());}};_0x1a2efd(++_0x54b9da);}(_0x4bcc,0x1a8));var _0xc4bc=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x4bcc[_0x580576];return _0x3f55a0;};'use strict';var Sequelize=require('sequelize');module[_0xc4bc('0x0')]={'network':{'type':Sequelize[_0xc4bc('0x1')]},'network_script':{'type':Sequelize[_0xc4bc('0x1')]},'request':{'type':Sequelize[_0xc4bc('0x1')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xc4bc('0x1')]},'type':{'type':Sequelize[_0xc4bc('0x1')]},'uniqueid':{'type':Sequelize[_0xc4bc('0x1')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xc4bc('0x1')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0xc4bc('0x1')]},'callingtns':{'type':Sequelize[_0xc4bc('0x1')]},'dnid':{'type':Sequelize[_0xc4bc('0x1')]},'rdnis':{'type':Sequelize[_0xc4bc('0x1')]},'context':{'type':Sequelize[_0xc4bc('0x1')]},'extension':{'type':Sequelize[_0xc4bc('0x1')]},'priority':{'type':Sequelize[_0xc4bc('0x1')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xc4bc('0x1')]},'threadid':{'type':Sequelize[_0xc4bc('0x1')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xc4bc('0x2')]},'leaveAt':{'type':Sequelize[_0xc4bc('0x2')]},'bot':{'type':Sequelize[_0xc4bc('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xd04f=['exports','STRING','sequelize'];(function(_0x2797d0,_0x3a6a05){var _0x3dfa6d=function(_0x209d12){while(--_0x209d12){_0x2797d0['push'](_0x2797d0['shift']());}};_0x3dfa6d(++_0x3a6a05);}(_0xd04f,0x1d9));var _0xfd04=function(_0x35496e,_0x4a468f){_0x35496e=_0x35496e-0x0;var _0x357746=_0xd04f[_0x35496e];return _0x357746;};'use strict';var Sequelize=require(_0xfd04('0x0'));module[_0xfd04('0x1')]={'network':{'type':Sequelize[_0xfd04('0x2')]},'network_script':{'type':Sequelize[_0xfd04('0x2')]},'request':{'type':Sequelize[_0xfd04('0x2')]},'channel':{'type':Sequelize[_0xfd04('0x2')]},'language':{'type':Sequelize[_0xfd04('0x2')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xfd04('0x2')]},'version':{'type':Sequelize[_0xfd04('0x2')]},'callerid':{'type':Sequelize[_0xfd04('0x2')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0xfd04('0x2')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0xfd04('0x2')]},'dnid':{'type':Sequelize[_0xfd04('0x2')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xfd04('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xfd04('0x2')]},'enhanced':{'type':Sequelize[_0xfd04('0x2')]},'accountcode':{'type':Sequelize[_0xfd04('0x2')]},'threadid':{'type':Sequelize[_0xfd04('0x2')]},'project_name':{'type':Sequelize[_0xfd04('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 0ae0269..57cc379 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 _0xa8d2=['query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','findAll','catch','include','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','SquareReport','rawAttributes','key','model','keys'];(function(_0x38523c,_0x219644){var _0x429e6a=function(_0x10d799){while(--_0x10d799){_0x38523c['push'](_0x38523c['shift']());}};_0x429e6a(++_0x219644);}(_0xa8d2,0x1da));var _0x2a8d=function(_0x83c1af,_0x24ef2a){_0x83c1af=_0x83c1af-0x0;var _0xa9f3e=_0xa8d2[_0x83c1af];return _0xa9f3e;};'use strict';var emlformat=require(_0x2a8d('0x0'));var rimraf=require(_0x2a8d('0x1'));var zipdir=require(_0x2a8d('0x2'));var jsonpatch=require(_0x2a8d('0x3'));var rp=require(_0x2a8d('0x4'));var moment=require('moment');var BPromise=require(_0x2a8d('0x5'));var Mustache=require(_0x2a8d('0x6'));var util=require('util');var path=require(_0x2a8d('0x7'));var sox=require('sox');var csv=require(_0x2a8d('0x8'));var ejs=require(_0x2a8d('0x9'));var fs=require('fs');var fs_extra=require(_0x2a8d('0xa'));var _=require(_0x2a8d('0xb'));var squel=require(_0x2a8d('0xc'));var crypto=require(_0x2a8d('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x2a8d('0xe'));var toCsv=require('to-csv');var querystring=require(_0x2a8d('0xf'));var Papa=require(_0x2a8d('0x10'));var Redis=require(_0x2a8d('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2a8d('0x12'));var hardwareService=require(_0x2a8d('0x13'));var logger=require(_0x2a8d('0x14'))(_0x2a8d('0x15'));var utils=require('../../config/utils');var config=require(_0x2a8d('0x16'));var licenseUtil=require(_0x2a8d('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x244e11,_0x1f688f){_0x1f688f=_0x1f688f||0xcc;return function(_0x239319){if(_0x239319){return _0x244e11[_0x2a8d('0x18')](_0x1f688f);}return _0x244e11['status'](_0x1f688f)['end']();};}function respondWithResult(_0x298601,_0x352d44){_0x352d44=_0x352d44||0xc8;return function(_0x1cf83c){if(_0x1cf83c){return _0x298601[_0x2a8d('0x19')](_0x352d44)[_0x2a8d('0x1a')](_0x1cf83c);}};}function respondWithFilteredResult(_0x7c1b92,_0x3f1b08){return function(_0x34b7e8){if(_0x34b7e8){var _0x46f46f=typeof _0x3f1b08[_0x2a8d('0x1b')]===_0x2a8d('0x1c')&&typeof _0x3f1b08[_0x2a8d('0x1d')]===_0x2a8d('0x1c');var _0xa0938d=_0x34b7e8['count'];var _0x4694ee=_0x46f46f?0x0:_0x3f1b08[_0x2a8d('0x1b')];var _0x535f0a=_0x46f46f?_0x34b7e8[_0x2a8d('0x1e')]:_0x3f1b08[_0x2a8d('0x1b')]+_0x3f1b08[_0x2a8d('0x1d')];var _0x26d403;if(_0x535f0a>=_0xa0938d){_0x535f0a=_0xa0938d;_0x26d403=0xc8;}else{_0x26d403=0xce;}_0x7c1b92[_0x2a8d('0x19')](_0x26d403);return _0x7c1b92[_0x2a8d('0x1f')](_0x2a8d('0x20'),_0x4694ee+'-'+_0x535f0a+'/'+_0xa0938d)[_0x2a8d('0x1a')](_0x34b7e8);}return null;};}function patchUpdates(_0xff6d1c){return function(_0x29d950){try{jsonpatch[_0x2a8d('0x21')](_0x29d950,_0xff6d1c,!![]);}catch(_0xff67){return BPromise[_0x2a8d('0x22')](_0xff67);}return _0x29d950[_0x2a8d('0x23')]();};}function saveUpdates(_0x35f22f,_0x4fd3b6){return function(_0x53f411){if(_0x53f411){return _0x53f411[_0x2a8d('0x24')](_0x35f22f)[_0x2a8d('0x25')](function(_0x51da14){return _0x51da14;});}return null;};}function removeEntity(_0x154bcd,_0x3f7790){return function(_0x366b94){if(_0x366b94){return _0x366b94[_0x2a8d('0x26')]()[_0x2a8d('0x25')](function(){_0x154bcd[_0x2a8d('0x19')](0xcc)[_0x2a8d('0x27')]();});}};}function handleEntityNotFound(_0x2f51a4,_0x1f9807){return function(_0x8f36ff){if(!_0x8f36ff){_0x2f51a4[_0x2a8d('0x18')](0x194);}return _0x8f36ff;};}function handleError(_0x299d63,_0x2337ca){_0x2337ca=_0x2337ca||0x1f4;return function(_0x5102a5){logger[_0x2a8d('0x28')](_0x5102a5[_0x2a8d('0x29')]);if(_0x5102a5['name']){delete _0x5102a5[_0x2a8d('0x2a')];}_0x299d63['status'](_0x2337ca)[_0x2a8d('0x2b')](_0x5102a5);};}exports[_0x2a8d('0x2c')]=function(_0x3cd896,_0x23b90e){var _0x45a011={},_0x3a3038={},_0x3e7922={'count':0x0,'rows':[]};var _0x47d049=_[_0x2a8d('0x2d')](db[_0x2a8d('0x2e')][_0x2a8d('0x2f')],function(_0x4efdcc){return{'name':_0x4efdcc['fieldName'],'type':_0x4efdcc['type'][_0x2a8d('0x30')]};});_0x3a3038[_0x2a8d('0x31')]=_[_0x2a8d('0x2d')](_0x47d049,'name');_0x3a3038['query']=_[_0x2a8d('0x32')](_0x3cd896[_0x2a8d('0x33')]);_0x3a3038[_0x2a8d('0x34')]=_[_0x2a8d('0x35')](_0x3a3038['model'],_0x3a3038[_0x2a8d('0x33')]);_0x45a011['attributes']=_[_0x2a8d('0x35')](_0x3a3038[_0x2a8d('0x31')],qs[_0x2a8d('0x36')](_0x3cd896[_0x2a8d('0x33')]['fields']));_0x45a011[_0x2a8d('0x37')]=_0x45a011[_0x2a8d('0x37')][_0x2a8d('0x38')]?_0x45a011[_0x2a8d('0x37')]:_0x3a3038[_0x2a8d('0x31')];if(!_0x3cd896[_0x2a8d('0x33')][_0x2a8d('0x39')]('nolimit')){_0x45a011[_0x2a8d('0x1d')]=qs['limit'](_0x3cd896[_0x2a8d('0x33')][_0x2a8d('0x1d')]);_0x45a011[_0x2a8d('0x1b')]=qs[_0x2a8d('0x1b')](_0x3cd896[_0x2a8d('0x33')]['offset']);}_0x45a011[_0x2a8d('0x3a')]=qs[_0x2a8d('0x3b')](_0x3cd896[_0x2a8d('0x33')][_0x2a8d('0x3b')]);_0x45a011[_0x2a8d('0x3c')]=qs['filters'](_['pick'](_0x3cd896[_0x2a8d('0x33')],_0x3a3038[_0x2a8d('0x34')]),_0x47d049);if(_0x3cd896['query'][_0x2a8d('0x3d')]){_0x45a011[_0x2a8d('0x3c')]=_[_0x2a8d('0x3e')](_0x45a011[_0x2a8d('0x3c')],{'$or':_[_0x2a8d('0x2d')](_0x47d049,function(_0x26cc94){if(_0x26cc94[_0x2a8d('0x3f')]!==_0x2a8d('0x40')){var _0x101073={};_0x101073[_0x26cc94[_0x2a8d('0x2a')]]={'$like':'%'+_0x3cd896['query'][_0x2a8d('0x3d')]+'%'};return _0x101073;}})});}_0x45a011=_['merge']({},_0x45a011,_0x3cd896[_0x2a8d('0x41')]);var _0x2aad84={'where':_0x45a011[_0x2a8d('0x3c')]};return db['SquareReport'][_0x2a8d('0x1e')](_0x2aad84)[_0x2a8d('0x25')](function(_0x4f76a1){_0x3e7922[_0x2a8d('0x1e')]=_0x4f76a1;if(_0x3cd896[_0x2a8d('0x33')][_0x2a8d('0x42')]){_0x45a011['include']=[{'all':!![]}];}return db[_0x2a8d('0x2e')][_0x2a8d('0x43')](_0x45a011);})['then'](function(_0x4bc5e8){_0x3e7922['rows']=_0x4bc5e8;return _0x3e7922;})[_0x2a8d('0x25')](respondWithFilteredResult(_0x23b90e,_0x45a011))[_0x2a8d('0x44')](handleError(_0x23b90e,null));};exports['show']=function(_0x2ed6ad,_0x21428e){var _0x576eee={'raw':!![],'where':{'id':_0x2ed6ad['params']['id']}},_0x2d7d16={};_0x2d7d16[_0x2a8d('0x31')]=_[_0x2a8d('0x32')](db['SquareReport'][_0x2a8d('0x2f')]);_0x2d7d16[_0x2a8d('0x33')]=_[_0x2a8d('0x32')](_0x2ed6ad[_0x2a8d('0x33')]);_0x2d7d16['filters']=_[_0x2a8d('0x35')](_0x2d7d16[_0x2a8d('0x31')],_0x2d7d16[_0x2a8d('0x33')]);_0x576eee[_0x2a8d('0x37')]=_[_0x2a8d('0x35')](_0x2d7d16['model'],qs[_0x2a8d('0x36')](_0x2ed6ad[_0x2a8d('0x33')][_0x2a8d('0x36')]));_0x576eee[_0x2a8d('0x37')]=_0x576eee[_0x2a8d('0x37')][_0x2a8d('0x38')]?_0x576eee[_0x2a8d('0x37')]:_0x2d7d16[_0x2a8d('0x31')];if(_0x2ed6ad['query'][_0x2a8d('0x42')]){_0x576eee[_0x2a8d('0x45')]=[{'all':!![]}];}_0x576eee=_[_0x2a8d('0x3e')]({},_0x576eee,_0x2ed6ad[_0x2a8d('0x41')]);return db[_0x2a8d('0x2e')][_0x2a8d('0x46')](_0x576eee)[_0x2a8d('0x25')](handleEntityNotFound(_0x21428e,null))[_0x2a8d('0x25')](respondWithResult(_0x21428e,null))[_0x2a8d('0x44')](handleError(_0x21428e,null));};exports['create']=function(_0xb884d0,_0x5de958){return db['SquareReport'][_0x2a8d('0x47')](_0xb884d0[_0x2a8d('0x48')],{})[_0x2a8d('0x25')](respondWithResult(_0x5de958,0xc9))[_0x2a8d('0x44')](handleError(_0x5de958,null));};exports[_0x2a8d('0x24')]=function(_0x406699,_0x405cd6){if(_0x406699[_0x2a8d('0x48')]['id']){delete _0x406699[_0x2a8d('0x48')]['id'];}return db[_0x2a8d('0x2e')]['find']({'where':{'id':_0x406699['params']['id']}})['then'](handleEntityNotFound(_0x405cd6,null))[_0x2a8d('0x25')](saveUpdates(_0x406699['body'],null))[_0x2a8d('0x25')](respondWithResult(_0x405cd6,null))['catch'](handleError(_0x405cd6,null));};exports[_0x2a8d('0x26')]=function(_0x2cde99,_0x418aba){return db[_0x2a8d('0x2e')][_0x2a8d('0x46')]({'where':{'id':_0x2cde99[_0x2a8d('0x49')]['id']}})['then'](handleEntityNotFound(_0x418aba,null))['then'](removeEntity(_0x418aba,null))[_0x2a8d('0x44')](handleError(_0x418aba,null));};exports['describe']=function(_0x42b851,_0x555359){return db[_0x2a8d('0x2e')][_0x2a8d('0x4a')]()[_0x2a8d('0x25')](respondWithResult(_0x555359,null))[_0x2a8d('0x44')](handleError(_0x555359,null));}; \ No newline at end of file +var _0xa393=['lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','save','then','destroy','error','stack','name','send','index','map','SquareReport','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','to-csv','ejs','fs-extra'];(function(_0x37b7b6,_0x165a5c){var _0x10c4c3=function(_0x16d71e){while(--_0x16d71e){_0x37b7b6['push'](_0x37b7b6['shift']());}};_0x10c4c3(++_0x165a5c);}(_0xa393,0x11f));var _0x3a39=function(_0x1f36bb,_0x8af718){_0x1f36bb=_0x1f36bb-0x0;var _0xaf97fa=_0xa393[_0x1f36bb];return _0xaf97fa;};'use strict';var emlformat=require(_0x3a39('0x0'));var rimraf=require(_0x3a39('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3a39('0x2'));var rp=require(_0x3a39('0x3'));var moment=require(_0x3a39('0x4'));var BPromise=require(_0x3a39('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x3a39('0x6'));var ejs=require(_0x3a39('0x7'));var fs=require('fs');var fs_extra=require(_0x3a39('0x8'));var _=require(_0x3a39('0x9'));var squel=require('squel');var crypto=require(_0x3a39('0xa'));var jsforce=require(_0x3a39('0xb'));var deskjs=require(_0x3a39('0xc'));var toCsv=require('to-csv');var querystring=require(_0x3a39('0xd'));var Papa=require(_0x3a39('0xe'));var Redis=require(_0x3a39('0xf'));var authService=require(_0x3a39('0x10'));var qs=require(_0x3a39('0x11'));var as=require(_0x3a39('0x12'));var hardwareService=require(_0x3a39('0x13'));var logger=require('../../config/logger')(_0x3a39('0x14'));var utils=require('../../config/utils');var config=require(_0x3a39('0x15'));var licenseUtil=require(_0x3a39('0x16'));var db=require(_0x3a39('0x17'))['db'];function respondWithStatusCode(_0x21cbcb,_0x1ec2fb){_0x1ec2fb=_0x1ec2fb||0xcc;return function(_0x27e76){if(_0x27e76){return _0x21cbcb[_0x3a39('0x18')](_0x1ec2fb);}return _0x21cbcb[_0x3a39('0x19')](_0x1ec2fb)[_0x3a39('0x1a')]();};}function respondWithResult(_0x2614a0,_0x4f1fa7){_0x4f1fa7=_0x4f1fa7||0xc8;return function(_0x588c2b){if(_0x588c2b){return _0x2614a0[_0x3a39('0x19')](_0x4f1fa7)[_0x3a39('0x1b')](_0x588c2b);}};}function respondWithFilteredResult(_0x2e1b73,_0x5c72aa){return function(_0x50abf0){if(_0x50abf0){var _0x22729e=typeof _0x5c72aa[_0x3a39('0x1c')]==='undefined'&&typeof _0x5c72aa[_0x3a39('0x1d')]===_0x3a39('0x1e');var _0x464995=_0x50abf0[_0x3a39('0x1f')];var _0x37caed=_0x22729e?0x0:_0x5c72aa[_0x3a39('0x1c')];var _0x3b98ce=_0x22729e?_0x50abf0[_0x3a39('0x1f')]:_0x5c72aa[_0x3a39('0x1c')]+_0x5c72aa[_0x3a39('0x1d')];var _0x3c60b6;if(_0x3b98ce>=_0x464995){_0x3b98ce=_0x464995;_0x3c60b6=0xc8;}else{_0x3c60b6=0xce;}_0x2e1b73[_0x3a39('0x19')](_0x3c60b6);return _0x2e1b73['set'](_0x3a39('0x20'),_0x37caed+'-'+_0x3b98ce+'/'+_0x464995)['json'](_0x50abf0);}return null;};}function patchUpdates(_0x32e1da){return function(_0x1382c3){try{jsonpatch[_0x3a39('0x21')](_0x1382c3,_0x32e1da,!![]);}catch(_0x33f9ee){return BPromise['reject'](_0x33f9ee);}return _0x1382c3[_0x3a39('0x22')]();};}function saveUpdates(_0x24815c,_0x312525){return function(_0x5524d5){if(_0x5524d5){return _0x5524d5['update'](_0x24815c)[_0x3a39('0x23')](function(_0x4d70d0){return _0x4d70d0;});}return null;};}function removeEntity(_0x6d92e,_0x410d07){return function(_0x2d9bb3){if(_0x2d9bb3){return _0x2d9bb3[_0x3a39('0x24')]()[_0x3a39('0x23')](function(){_0x6d92e[_0x3a39('0x19')](0xcc)[_0x3a39('0x1a')]();});}};}function handleEntityNotFound(_0x573a4a,_0x3df153){return function(_0x12f6b0){if(!_0x12f6b0){_0x573a4a['sendStatus'](0x194);}return _0x12f6b0;};}function handleError(_0x5bdfb5,_0x344b39){_0x344b39=_0x344b39||0x1f4;return function(_0x13c2af){logger[_0x3a39('0x25')](_0x13c2af[_0x3a39('0x26')]);if(_0x13c2af[_0x3a39('0x27')]){delete _0x13c2af['name'];}_0x5bdfb5[_0x3a39('0x19')](_0x344b39)[_0x3a39('0x28')](_0x13c2af);};}exports[_0x3a39('0x29')]=function(_0x1862f6,_0xda2053){var _0x3fea3b={},_0x285b94={},_0x4d5bf8={'count':0x0,'rows':[]};var _0x210420=_[_0x3a39('0x2a')](db[_0x3a39('0x2b')][_0x3a39('0x2c')],function(_0x5e01aa){return{'name':_0x5e01aa['fieldName'],'type':_0x5e01aa['type'][_0x3a39('0x2d')]};});_0x285b94[_0x3a39('0x2e')]=_[_0x3a39('0x2a')](_0x210420,_0x3a39('0x27'));_0x285b94[_0x3a39('0x2f')]=_[_0x3a39('0x30')](_0x1862f6[_0x3a39('0x2f')]);_0x285b94[_0x3a39('0x31')]=_[_0x3a39('0x32')](_0x285b94[_0x3a39('0x2e')],_0x285b94[_0x3a39('0x2f')]);_0x3fea3b['attributes']=_[_0x3a39('0x32')](_0x285b94[_0x3a39('0x2e')],qs[_0x3a39('0x33')](_0x1862f6[_0x3a39('0x2f')][_0x3a39('0x33')]));_0x3fea3b[_0x3a39('0x34')]=_0x3fea3b[_0x3a39('0x34')]['length']?_0x3fea3b[_0x3a39('0x34')]:_0x285b94[_0x3a39('0x2e')];if(!_0x1862f6[_0x3a39('0x2f')][_0x3a39('0x35')](_0x3a39('0x36'))){_0x3fea3b[_0x3a39('0x1d')]=qs[_0x3a39('0x1d')](_0x1862f6[_0x3a39('0x2f')][_0x3a39('0x1d')]);_0x3fea3b[_0x3a39('0x1c')]=qs[_0x3a39('0x1c')](_0x1862f6[_0x3a39('0x2f')][_0x3a39('0x1c')]);}_0x3fea3b[_0x3a39('0x37')]=qs[_0x3a39('0x38')](_0x1862f6['query'][_0x3a39('0x38')]);_0x3fea3b['where']=qs[_0x3a39('0x31')](_[_0x3a39('0x39')](_0x1862f6[_0x3a39('0x2f')],_0x285b94[_0x3a39('0x31')]),_0x210420);if(_0x1862f6[_0x3a39('0x2f')][_0x3a39('0x3a')]){_0x3fea3b[_0x3a39('0x3b')]=_[_0x3a39('0x3c')](_0x3fea3b[_0x3a39('0x3b')],{'$or':_[_0x3a39('0x2a')](_0x210420,function(_0x4a201b){if(_0x4a201b[_0x3a39('0x3d')]!==_0x3a39('0x3e')){var _0x5cb7db={};_0x5cb7db[_0x4a201b['name']]={'$like':'%'+_0x1862f6['query'][_0x3a39('0x3a')]+'%'};return _0x5cb7db;}})});}_0x3fea3b=_[_0x3a39('0x3c')]({},_0x3fea3b,_0x1862f6[_0x3a39('0x3f')]);var _0x20fdf2={'where':_0x3fea3b[_0x3a39('0x3b')]};return db[_0x3a39('0x2b')][_0x3a39('0x1f')](_0x20fdf2)[_0x3a39('0x23')](function(_0x1fcc82){_0x4d5bf8[_0x3a39('0x1f')]=_0x1fcc82;if(_0x1862f6[_0x3a39('0x2f')][_0x3a39('0x40')]){_0x3fea3b['include']=[{'all':!![]}];}return db[_0x3a39('0x2b')][_0x3a39('0x41')](_0x3fea3b);})[_0x3a39('0x23')](function(_0x14abf7){_0x4d5bf8[_0x3a39('0x42')]=_0x14abf7;return _0x4d5bf8;})[_0x3a39('0x23')](respondWithFilteredResult(_0xda2053,_0x3fea3b))[_0x3a39('0x43')](handleError(_0xda2053,null));};exports[_0x3a39('0x44')]=function(_0x5524fe,_0x3256a7){var _0x2f1041={'raw':!![],'where':{'id':_0x5524fe[_0x3a39('0x45')]['id']}},_0x49e488={};_0x49e488[_0x3a39('0x2e')]=_['keys'](db[_0x3a39('0x2b')][_0x3a39('0x2c')]);_0x49e488['query']=_[_0x3a39('0x30')](_0x5524fe[_0x3a39('0x2f')]);_0x49e488[_0x3a39('0x31')]=_['intersection'](_0x49e488[_0x3a39('0x2e')],_0x49e488[_0x3a39('0x2f')]);_0x2f1041[_0x3a39('0x34')]=_[_0x3a39('0x32')](_0x49e488[_0x3a39('0x2e')],qs[_0x3a39('0x33')](_0x5524fe[_0x3a39('0x2f')][_0x3a39('0x33')]));_0x2f1041[_0x3a39('0x34')]=_0x2f1041[_0x3a39('0x34')]['length']?_0x2f1041['attributes']:_0x49e488[_0x3a39('0x2e')];if(_0x5524fe[_0x3a39('0x2f')]['includeAll']){_0x2f1041[_0x3a39('0x46')]=[{'all':!![]}];}_0x2f1041=_[_0x3a39('0x3c')]({},_0x2f1041,_0x5524fe[_0x3a39('0x3f')]);return db['SquareReport'][_0x3a39('0x47')](_0x2f1041)[_0x3a39('0x23')](handleEntityNotFound(_0x3256a7,null))[_0x3a39('0x23')](respondWithResult(_0x3256a7,null))['catch'](handleError(_0x3256a7,null));};exports[_0x3a39('0x48')]=function(_0x10b7c2,_0x1b4b78){return db[_0x3a39('0x2b')][_0x3a39('0x48')](_0x10b7c2[_0x3a39('0x49')],{})[_0x3a39('0x23')](respondWithResult(_0x1b4b78,0xc9))['catch'](handleError(_0x1b4b78,null));};exports['update']=function(_0x226676,_0x4f3ef2){if(_0x226676[_0x3a39('0x49')]['id']){delete _0x226676['body']['id'];}return db[_0x3a39('0x2b')][_0x3a39('0x47')]({'where':{'id':_0x226676[_0x3a39('0x45')]['id']}})[_0x3a39('0x23')](handleEntityNotFound(_0x4f3ef2,null))[_0x3a39('0x23')](saveUpdates(_0x226676['body'],null))[_0x3a39('0x23')](respondWithResult(_0x4f3ef2,null))[_0x3a39('0x43')](handleError(_0x4f3ef2,null));};exports[_0x3a39('0x24')]=function(_0x1cc77d,_0x2e1d9e){return db[_0x3a39('0x2b')][_0x3a39('0x47')]({'where':{'id':_0x1cc77d[_0x3a39('0x45')]['id']}})[_0x3a39('0x23')](handleEntityNotFound(_0x2e1d9e,null))[_0x3a39('0x23')](removeEntity(_0x2e1d9e,null))['catch'](handleError(_0x2e1d9e,null));};exports['describe']=function(_0x2ce458,_0x5d295f){return db[_0x3a39('0x2b')]['describe']()[_0x3a39('0x23')](respondWithResult(_0x5d295f,null))[_0x3a39('0x43')](handleError(_0x5d295f,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 32fd4ef..de3afc9 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 _0xcf73=['bluebird','request-promise','rimraf','./squareReport.attributes','exports','SquareReport','report_square','project_name','leaveAt','lodash','util','../../config/logger','api','moment'];(function(_0x20e5d0,_0x1f9854){var _0x492c0d=function(_0x5d9496){while(--_0x5d9496){_0x20e5d0['push'](_0x20e5d0['shift']());}};_0x492c0d(++_0x1f9854);}(_0xcf73,0x113));var _0x3cf7=function(_0x1280b7,_0x33482f){_0x1280b7=_0x1280b7-0x0;var _0x11928e=_0xcf73[_0x1280b7];return _0x11928e;};'use strict';var _=require(_0x3cf7('0x0'));var util=require(_0x3cf7('0x1'));var logger=require(_0x3cf7('0x2'))(_0x3cf7('0x3'));var moment=require(_0x3cf7('0x4'));var BPromise=require(_0x3cf7('0x5'));var rp=require(_0x3cf7('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3cf7('0x7'));var config=require('../../config/environment');var attributes=require(_0x3cf7('0x8'));module[_0x3cf7('0x9')]=function(_0x153f32,_0x28ea6f){return _0x153f32['define'](_0x3cf7('0xa'),attributes,{'tableName':_0x3cf7('0xb'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':['uniqueid',_0x3cf7('0xc')]},{'name':_0x3cf7('0xd'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file +var _0x4c78=['moment','bluebird','request-promise','../../config/environment','./squareReport.attributes','exports','define','SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash','../../config/logger','api'];(function(_0x4f75b5,_0x4db76d){var _0x5c263b=function(_0x31e622){while(--_0x31e622){_0x4f75b5['push'](_0x4f75b5['shift']());}};_0x5c263b(++_0x4db76d);}(_0x4c78,0x1cd));var _0x84c7=function(_0x308f0e,_0x233ecf){_0x308f0e=_0x308f0e-0x0;var _0x3ef423=_0x4c78[_0x308f0e];return _0x3ef423;};'use strict';var _=require(_0x84c7('0x0'));var util=require('util');var logger=require(_0x84c7('0x1'))(_0x84c7('0x2'));var moment=require(_0x84c7('0x3'));var BPromise=require(_0x84c7('0x4'));var rp=require(_0x84c7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x84c7('0x6'));var attributes=require(_0x84c7('0x7'));module[_0x84c7('0x8')]=function(_0x1ecbe9,_0x333979){return _0x1ecbe9[_0x84c7('0x9')](_0x84c7('0xa'),attributes,{'tableName':_0x84c7('0xb'),'paranoid':![],'indexes':[{'name':_0x84c7('0xc'),'fields':[_0x84c7('0xd'),_0x84c7('0xe')]},{'name':_0x84c7('0xf'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index f727e71..36f8b52 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 _0x5ffc=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','SquareReport,\x20%s,\x20%s','message','catch','CreateSquareReport','body','options','raw','UpdateSquareReport','SquareReport','where','attributes','limit','lodash','util','moment','bluebird','randomstring'];(function(_0x3cef5e,_0x1b95ae){var _0x20b9c2=function(_0x35a6e4){while(--_0x35a6e4){_0x3cef5e['push'](_0x3cef5e['shift']());}};_0x20b9c2(++_0x1b95ae);}(_0x5ffc,0x19f));var _0xc5ff=function(_0x2aa733,_0xcde568){_0x2aa733=_0x2aa733-0x0;var _0x2bcf85=_0x5ffc[_0x2aa733];return _0x2bcf85;};'use strict';var _=require(_0xc5ff('0x0'));var util=require(_0xc5ff('0x1'));var moment=require(_0xc5ff('0x2'));var BPromise=require(_0xc5ff('0x3'));var rs=require(_0xc5ff('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc5ff('0x5'))['db'];var utils=require(_0xc5ff('0x6'));var logger=require(_0xc5ff('0x7'))(_0xc5ff('0x8'));var config=require(_0xc5ff('0x9'));var jayson=require(_0xc5ff('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3a2a2f,_0x31ee4a,_0x551db6){return new BPromise(function(_0x305404,_0x5b1758){return client['request'](_0x3a2a2f,_0x551db6)[_0xc5ff('0xb')](function(_0x3e3da3){logger[_0xc5ff('0xc')]('SquareReport,\x20%s,\x20%s',_0x31ee4a,_0xc5ff('0xd'));logger[_0xc5ff('0xe')](_0xc5ff('0xf'),_0x31ee4a,_0xc5ff('0xd'),JSON[_0xc5ff('0x10')](_0x3e3da3));if(_0x3e3da3[_0xc5ff('0x11')]){if(_0x3e3da3[_0xc5ff('0x11')]['code']===0x1f4){logger[_0xc5ff('0x11')](_0xc5ff('0x12'),_0x31ee4a,_0x3e3da3[_0xc5ff('0x11')]['message']);return _0x5b1758(_0x3e3da3['error'][_0xc5ff('0x13')]);}logger[_0xc5ff('0x11')]('SquareReport,\x20%s,\x20%s',_0x31ee4a,_0x3e3da3['error'][_0xc5ff('0x13')]);return _0x305404(_0x3e3da3[_0xc5ff('0x11')]['message']);}else{logger['info'](_0xc5ff('0x12'),_0x31ee4a,_0xc5ff('0xd'));_0x305404(_0x3e3da3['result']['message']);}})[_0xc5ff('0x14')](function(_0x23bb8f){logger['error'](_0xc5ff('0x12'),_0x31ee4a,_0x23bb8f);_0x5b1758(_0x23bb8f);});});}exports[_0xc5ff('0x15')]=function(_0xe2da2e){var _0xde8308=this;return new Promise(function(_0x27feca,_0x4ac582){return db['SquareReport']['create'](_0xe2da2e[_0xc5ff('0x16')],{'raw':_0xe2da2e[_0xc5ff('0x17')]?_0xe2da2e['options'][_0xc5ff('0x18')]===undefined?!![]:![]:!![]})[_0xc5ff('0xb')](function(_0x36f948){logger[_0xc5ff('0xc')](_0xc5ff('0x15'),_0xe2da2e);logger[_0xc5ff('0xe')]('CreateSquareReport',_0xe2da2e,JSON[_0xc5ff('0x10')](_0x36f948));_0x27feca(_0x36f948);})[_0xc5ff('0x14')](function(_0x5a04d7){logger[_0xc5ff('0x11')](_0xc5ff('0x15'),_0x5a04d7['message'],_0xe2da2e);_0x4ac582(_0xde8308[_0xc5ff('0x11')](0x1f4,_0x5a04d7[_0xc5ff('0x13')]));});});};exports[_0xc5ff('0x19')]=function(_0x41292a){var _0x549390=this;return new Promise(function(_0x308df6,_0x122ecb){return db[_0xc5ff('0x1a')]['update'](_0x41292a['body'],{'raw':_0x41292a[_0xc5ff('0x17')]?_0x41292a[_0xc5ff('0x17')][_0xc5ff('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x41292a[_0xc5ff('0x17')]?_0x41292a[_0xc5ff('0x17')][_0xc5ff('0x1b')]||null:null,'attributes':_0x41292a['options']?_0x41292a[_0xc5ff('0x17')][_0xc5ff('0x1c')]||null:null,'limit':_0x41292a[_0xc5ff('0x17')]?_0x41292a['options'][_0xc5ff('0x1d')]||null:null})[_0xc5ff('0xb')](function(_0x122a8d){logger[_0xc5ff('0xc')](_0xc5ff('0x19'),_0x41292a);logger['debug'](_0xc5ff('0x19'),_0x41292a,JSON[_0xc5ff('0x10')](_0x122a8d));_0x308df6(_0x122a8d);})['catch'](function(_0x319424){logger[_0xc5ff('0x11')](_0xc5ff('0x19'),_0x319424['message'],_0x41292a);_0x122ecb(_0x549390[_0xc5ff('0x11')](0x1f4,_0x319424['message']));});});}; \ No newline at end of file +var _0xa528=['UpdateSquareReport','SquareReport','update','body','where','attributes','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','then','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','error','code','SquareReport,\x20%s,\x20%s','message','info','result','catch','CreateSquareReport','options','raw'];(function(_0x35b082,_0x411b54){var _0x2c589c=function(_0x5ff13c){while(--_0x5ff13c){_0x35b082['push'](_0x35b082['shift']());}};_0x2c589c(++_0x411b54);}(_0xa528,0x19a));var _0x8a52=function(_0x561f25,_0x2d95c1){_0x561f25=_0x561f25-0x0;var _0x150e4c=_0xa528[_0x561f25];return _0x150e4c;};'use strict';var _=require(_0x8a52('0x0'));var util=require('util');var moment=require(_0x8a52('0x1'));var BPromise=require(_0x8a52('0x2'));var rs=require(_0x8a52('0x3'));var fs=require('fs');var Redis=require(_0x8a52('0x4'));var db=require(_0x8a52('0x5'))['db'];var utils=require(_0x8a52('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x8a52('0x7'));var client=jayson[_0x8a52('0x8')][_0x8a52('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x18bcd8,_0x2b1eb4,_0x1cece5){return new BPromise(function(_0x589912,_0x153e41){return client['request'](_0x18bcd8,_0x1cece5)[_0x8a52('0xa')](function(_0x5a0396){logger['info']('SquareReport,\x20%s,\x20%s',_0x2b1eb4,_0x8a52('0xb'));logger[_0x8a52('0xc')](_0x8a52('0xd'),_0x2b1eb4,_0x8a52('0xb'),JSON['stringify'](_0x5a0396));if(_0x5a0396[_0x8a52('0xe')]){if(_0x5a0396['error'][_0x8a52('0xf')]===0x1f4){logger['error'](_0x8a52('0x10'),_0x2b1eb4,_0x5a0396['error']['message']);return _0x153e41(_0x5a0396[_0x8a52('0xe')][_0x8a52('0x11')]);}logger['error'](_0x8a52('0x10'),_0x2b1eb4,_0x5a0396[_0x8a52('0xe')][_0x8a52('0x11')]);return _0x589912(_0x5a0396[_0x8a52('0xe')]['message']);}else{logger[_0x8a52('0x12')](_0x8a52('0x10'),_0x2b1eb4,'request\x20sent');_0x589912(_0x5a0396[_0x8a52('0x13')][_0x8a52('0x11')]);}})[_0x8a52('0x14')](function(_0x404d19){logger[_0x8a52('0xe')](_0x8a52('0x10'),_0x2b1eb4,_0x404d19);_0x153e41(_0x404d19);});});}exports[_0x8a52('0x15')]=function(_0x40fc42){var _0x25730f=this;return new Promise(function(_0x559814,_0x45af08){return db['SquareReport']['create'](_0x40fc42['body'],{'raw':_0x40fc42[_0x8a52('0x16')]?_0x40fc42[_0x8a52('0x16')][_0x8a52('0x17')]===undefined?!![]:![]:!![]})[_0x8a52('0xa')](function(_0x260764){logger['info'](_0x8a52('0x15'),_0x40fc42);logger['debug'](_0x8a52('0x15'),_0x40fc42,JSON['stringify'](_0x260764));_0x559814(_0x260764);})[_0x8a52('0x14')](function(_0x78f8ae){logger[_0x8a52('0xe')](_0x8a52('0x15'),_0x78f8ae[_0x8a52('0x11')],_0x40fc42);_0x45af08(_0x25730f[_0x8a52('0xe')](0x1f4,_0x78f8ae[_0x8a52('0x11')]));});});};exports[_0x8a52('0x18')]=function(_0xfb008e){var _0x327c69=this;return new Promise(function(_0x3ac64c,_0x94fc1d){return db[_0x8a52('0x19')][_0x8a52('0x1a')](_0xfb008e[_0x8a52('0x1b')],{'raw':_0xfb008e['options']?_0xfb008e['options'][_0x8a52('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xfb008e[_0x8a52('0x16')]?_0xfb008e[_0x8a52('0x16')][_0x8a52('0x1c')]||null:null,'attributes':_0xfb008e[_0x8a52('0x16')]?_0xfb008e[_0x8a52('0x16')][_0x8a52('0x1d')]||null:null,'limit':_0xfb008e[_0x8a52('0x16')]?_0xfb008e['options']['limit']||null:null})['then'](function(_0x3e771c){logger['info'](_0x8a52('0x18'),_0xfb008e);logger['debug'](_0x8a52('0x18'),_0xfb008e,JSON[_0x8a52('0x1e')](_0x3e771c));_0x3ac64c(_0x3e771c);})[_0x8a52('0x14')](function(_0x5cd81b){logger[_0x8a52('0xe')](_0x8a52('0x18'),_0x5cd81b[_0x8a52('0x11')],_0xfb008e);_0x94fc1d(_0x327c69[_0x8a52('0xe')](0x1f4,_0x5cd81b[_0x8a52('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 591fd97..985becb 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 _0x913c=['isAuthenticated','/describe','describe','/:id','post','create','put','update','delete','destroy','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get'];(function(_0x39ab75,_0x5d9f40){var _0x594e9e=function(_0x434f80){while(--_0x434f80){_0x39ab75['push'](_0x39ab75['shift']());}};_0x594e9e(++_0x5d9f40);}(_0x913c,0xd0));var _0xc913=function(_0x3ec117,_0x319fd8){_0x3ec117=_0x3ec117-0x0;var _0x53f1ba=_0x913c[_0x3ec117];return _0x53f1ba;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xc913('0x0'));var express=require(_0xc913('0x1'));var router=express[_0xc913('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xc913('0x3'));var interaction=require(_0xc913('0x4'));var config=require(_0xc913('0x5'));var controller=require(_0xc913('0x6'));router[_0xc913('0x7')]('/',auth[_0xc913('0x8')](),controller['index']);router[_0xc913('0x7')](_0xc913('0x9'),auth[_0xc913('0x8')](),controller[_0xc913('0xa')]);router[_0xc913('0x7')](_0xc913('0xb'),auth[_0xc913('0x8')](),controller['show']);router[_0xc913('0xc')]('/',auth[_0xc913('0x8')](),controller[_0xc913('0xd')]);router[_0xc913('0xe')](_0xc913('0xb'),auth[_0xc913('0x8')](),controller[_0xc913('0xf')]);router[_0xc913('0x10')](_0xc913('0xb'),auth['isAuthenticated'](),controller[_0xc913('0x11')]);module['exports']=router; \ No newline at end of file +var _0x4fc1=['delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../config/environment','index','get','/describe','describe','/:id','isAuthenticated','show','post','create','put','update'];(function(_0xb9622e,_0x91225d){var _0x12969e=function(_0x5e8b52){while(--_0x5e8b52){_0xb9622e['push'](_0xb9622e['shift']());}};_0x12969e(++_0x91225d);}(_0x4fc1,0x157));var _0x14fc=function(_0x31bf34,_0x4f7be3){_0x31bf34=_0x31bf34-0x0;var _0x2bb4dc=_0x4fc1[_0x31bf34];return _0x2bb4dc;};'use strict';var multer=require(_0x14fc('0x0'));var util=require(_0x14fc('0x1'));var path=require(_0x14fc('0x2'));var timeout=require(_0x14fc('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x14fc('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x14fc('0x5'));var controller=require('./squareReportDetail.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x14fc('0x6')]);router[_0x14fc('0x7')](_0x14fc('0x8'),auth['isAuthenticated'](),controller[_0x14fc('0x9')]);router['get'](_0x14fc('0xa'),auth[_0x14fc('0xb')](),controller[_0x14fc('0xc')]);router[_0x14fc('0xd')]('/',auth['isAuthenticated'](),controller[_0x14fc('0xe')]);router[_0x14fc('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x14fc('0x10')]);router[_0x14fc('0x11')]('/:id',auth[_0x14fc('0xb')](),controller[_0x14fc('0x12')]);module[_0x14fc('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 7d6e0b2..79bbd98 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 _0x2fb1=['sequelize','STRING','TEXT'];(function(_0x3241ee,_0x37dc59){var _0x5845f7=function(_0x552acd){while(--_0x552acd){_0x3241ee['push'](_0x3241ee['shift']());}};_0x5845f7(++_0x37dc59);}(_0x2fb1,0xd8));var _0x12fb=function(_0x502c4d,_0x44e6a4){_0x502c4d=_0x502c4d-0x0;var _0x24ce60=_0x2fb1[_0x502c4d];return _0x24ce60;};'use strict';var Sequelize=require(_0x12fb('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0x12fb('0x1')]},'data':{'type':Sequelize[_0x12fb('0x2')]},'project_name':{'type':Sequelize[_0x12fb('0x1')]},'callerid':{'type':Sequelize[_0x12fb('0x1')]}}; \ No newline at end of file +var _0xc326=['sequelize','exports','STRING','TEXT'];(function(_0xa98302,_0x844f27){var _0x1ad8e3=function(_0x57e51d){while(--_0x57e51d){_0xa98302['push'](_0xa98302['shift']());}};_0x1ad8e3(++_0x844f27);}(_0xc326,0x138));var _0x6c32=function(_0x1b4f21,_0x11fd2f){_0x1b4f21=_0x1b4f21-0x0;var _0x29e871=_0xc326[_0x1b4f21];return _0x29e871;};'use strict';var Sequelize=require(_0x6c32('0x0'));module[_0x6c32('0x1')]={'uniqueid':{'type':Sequelize[_0x6c32('0x2')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0x6c32('0x2')]},'data':{'type':Sequelize[_0x6c32('0x3')]},'project_name':{'type':Sequelize[_0x6c32('0x2')]},'callerid':{'type':Sequelize[_0x6c32('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index dea0686..9cd46a9 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 _0xd002=['lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','map','SquareDetailsReport','rawAttributes','type','keys','query','filters','model','attributes','intersection','fields','nolimit','limit','offset','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','length','find','create','body','params','describe','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs'];(function(_0x1c8790,_0x7fca0e){var _0x5cab4c=function(_0x461964){while(--_0x461964){_0x1c8790['push'](_0x1c8790['shift']());}};_0x5cab4c(++_0x7fca0e);}(_0xd002,0x10f));var _0x2d00=function(_0x1e4806,_0x4d70f1){_0x1e4806=_0x1e4806-0x0;var _0x24b274=_0xd002[_0x1e4806];return _0x24b274;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2d00('0x0'));var jsonpatch=require(_0x2d00('0x1'));var rp=require(_0x2d00('0x2'));var moment=require(_0x2d00('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2d00('0x4'));var util=require('util');var path=require(_0x2d00('0x5'));var sox=require(_0x2d00('0x6'));var csv=require(_0x2d00('0x7'));var ejs=require(_0x2d00('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2d00('0x9'));var squel=require('squel');var crypto=require(_0x2d00('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x2d00('0xb'));var toCsv=require(_0x2d00('0x7'));var querystring=require(_0x2d00('0xc'));var Papa=require(_0x2d00('0xd'));var Redis=require('ioredis');var authService=require(_0x2d00('0xe'));var qs=require(_0x2d00('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2d00('0x10'))(_0x2d00('0x11'));var utils=require(_0x2d00('0x12'));var config=require(_0x2d00('0x13'));var licenseUtil=require(_0x2d00('0x14'));var db=require(_0x2d00('0x15'))['db'];function respondWithStatusCode(_0x256e32,_0x31dcf6){_0x31dcf6=_0x31dcf6||0xcc;return function(_0x1dd136){if(_0x1dd136){return _0x256e32[_0x2d00('0x16')](_0x31dcf6);}return _0x256e32[_0x2d00('0x17')](_0x31dcf6)[_0x2d00('0x18')]();};}function respondWithResult(_0x3a1be2,_0x82aa18){_0x82aa18=_0x82aa18||0xc8;return function(_0x2c73d0){if(_0x2c73d0){return _0x3a1be2[_0x2d00('0x17')](_0x82aa18)[_0x2d00('0x19')](_0x2c73d0);}};}function respondWithFilteredResult(_0x49bdd4,_0x1735a0){return function(_0x20bd1d){if(_0x20bd1d){var _0x1ea470=typeof _0x1735a0['offset']===_0x2d00('0x1a')&&typeof _0x1735a0['limit']===_0x2d00('0x1a');var _0x3f18c1=_0x20bd1d[_0x2d00('0x1b')];var _0x2e27c6=_0x1ea470?0x0:_0x1735a0['offset'];var _0x8205d7=_0x1ea470?_0x20bd1d[_0x2d00('0x1b')]:_0x1735a0['offset']+_0x1735a0['limit'];var _0x5eded3;if(_0x8205d7>=_0x3f18c1){_0x8205d7=_0x3f18c1;_0x5eded3=0xc8;}else{_0x5eded3=0xce;}_0x49bdd4[_0x2d00('0x17')](_0x5eded3);return _0x49bdd4[_0x2d00('0x1c')]('Content-Range',_0x2e27c6+'-'+_0x8205d7+'/'+_0x3f18c1)['json'](_0x20bd1d);}return null;};}function patchUpdates(_0x363121){return function(_0x619562){try{jsonpatch[_0x2d00('0x1d')](_0x619562,_0x363121,!![]);}catch(_0x5c4b86){return BPromise[_0x2d00('0x1e')](_0x5c4b86);}return _0x619562[_0x2d00('0x1f')]();};}function saveUpdates(_0x96fae3,_0x1a83f6){return function(_0x150caf){if(_0x150caf){return _0x150caf[_0x2d00('0x20')](_0x96fae3)[_0x2d00('0x21')](function(_0x5203a7){return _0x5203a7;});}return null;};}function removeEntity(_0xe95d23,_0x53d5e8){return function(_0x40bb6d){if(_0x40bb6d){return _0x40bb6d[_0x2d00('0x22')]()[_0x2d00('0x21')](function(){_0xe95d23[_0x2d00('0x17')](0xcc)[_0x2d00('0x18')]();});}};}function handleEntityNotFound(_0x33c3ba,_0x267c3f){return function(_0x128efa){if(!_0x128efa){_0x33c3ba[_0x2d00('0x16')](0x194);}return _0x128efa;};}function handleError(_0xcbdc2,_0x31100d){_0x31100d=_0x31100d||0x1f4;return function(_0x45fe72){logger[_0x2d00('0x23')](_0x45fe72[_0x2d00('0x24')]);if(_0x45fe72[_0x2d00('0x25')]){delete _0x45fe72[_0x2d00('0x25')];}_0xcbdc2[_0x2d00('0x17')](_0x31100d)[_0x2d00('0x26')](_0x45fe72);};}exports['index']=function(_0x39cda3,_0x4cbafe){var _0x2cd822={},_0x438161={},_0x40dcae={'count':0x0,'rows':[]};var _0x115641=_[_0x2d00('0x27')](db[_0x2d00('0x28')][_0x2d00('0x29')],function(_0x363cc1){return{'name':_0x363cc1['fieldName'],'type':_0x363cc1[_0x2d00('0x2a')]['key']};});_0x438161['model']=_[_0x2d00('0x27')](_0x115641,_0x2d00('0x25'));_0x438161['query']=_[_0x2d00('0x2b')](_0x39cda3[_0x2d00('0x2c')]);_0x438161[_0x2d00('0x2d')]=_['intersection'](_0x438161[_0x2d00('0x2e')],_0x438161['query']);_0x2cd822[_0x2d00('0x2f')]=_[_0x2d00('0x30')](_0x438161['model'],qs['fields'](_0x39cda3[_0x2d00('0x2c')][_0x2d00('0x31')]));_0x2cd822['attributes']=_0x2cd822[_0x2d00('0x2f')]['length']?_0x2cd822[_0x2d00('0x2f')]:_0x438161[_0x2d00('0x2e')];if(!_0x39cda3[_0x2d00('0x2c')]['hasOwnProperty'](_0x2d00('0x32'))){_0x2cd822[_0x2d00('0x33')]=qs['limit'](_0x39cda3[_0x2d00('0x2c')]['limit']);_0x2cd822[_0x2d00('0x34')]=qs['offset'](_0x39cda3[_0x2d00('0x2c')][_0x2d00('0x34')]);}_0x2cd822['order']=qs[_0x2d00('0x35')](_0x39cda3[_0x2d00('0x2c')][_0x2d00('0x35')]);_0x2cd822[_0x2d00('0x36')]=qs[_0x2d00('0x2d')](_[_0x2d00('0x37')](_0x39cda3[_0x2d00('0x2c')],_0x438161['filters']),_0x115641);if(_0x39cda3[_0x2d00('0x2c')][_0x2d00('0x38')]){_0x2cd822['where']=_['merge'](_0x2cd822['where'],{'$or':_[_0x2d00('0x27')](_0x115641,function(_0x426f4a){if(_0x426f4a[_0x2d00('0x2a')]!==_0x2d00('0x39')){var _0x2ea2e6={};_0x2ea2e6[_0x426f4a[_0x2d00('0x25')]]={'$like':'%'+_0x39cda3['query']['filter']+'%'};return _0x2ea2e6;}})});}_0x2cd822=_[_0x2d00('0x3a')]({},_0x2cd822,_0x39cda3[_0x2d00('0x3b')]);var _0x9ba242={'where':_0x2cd822['where']};return db[_0x2d00('0x28')][_0x2d00('0x1b')](_0x9ba242)['then'](function(_0x431b30){_0x40dcae[_0x2d00('0x1b')]=_0x431b30;if(_0x39cda3[_0x2d00('0x2c')][_0x2d00('0x3c')]){_0x2cd822['include']=[{'all':!![]}];}return db[_0x2d00('0x28')][_0x2d00('0x3d')](_0x2cd822);})[_0x2d00('0x21')](function(_0x4fdced){_0x40dcae[_0x2d00('0x3e')]=_0x4fdced;return _0x40dcae;})[_0x2d00('0x21')](respondWithFilteredResult(_0x4cbafe,_0x2cd822))[_0x2d00('0x3f')](handleError(_0x4cbafe,null));};exports['show']=function(_0x2aec50,_0x305be6){var _0x1679e8={'raw':!![],'where':{'id':_0x2aec50['params']['id']}},_0x6160df={};_0x6160df['model']=_[_0x2d00('0x2b')](db[_0x2d00('0x28')][_0x2d00('0x29')]);_0x6160df[_0x2d00('0x2c')]=_['keys'](_0x2aec50[_0x2d00('0x2c')]);_0x6160df[_0x2d00('0x2d')]=_[_0x2d00('0x30')](_0x6160df[_0x2d00('0x2e')],_0x6160df[_0x2d00('0x2c')]);_0x1679e8['attributes']=_['intersection'](_0x6160df[_0x2d00('0x2e')],qs[_0x2d00('0x31')](_0x2aec50[_0x2d00('0x2c')][_0x2d00('0x31')]));_0x1679e8[_0x2d00('0x2f')]=_0x1679e8['attributes'][_0x2d00('0x40')]?_0x1679e8[_0x2d00('0x2f')]:_0x6160df['model'];if(_0x2aec50[_0x2d00('0x2c')][_0x2d00('0x3c')]){_0x1679e8['include']=[{'all':!![]}];}_0x1679e8=_[_0x2d00('0x3a')]({},_0x1679e8,_0x2aec50['options']);return db[_0x2d00('0x28')][_0x2d00('0x41')](_0x1679e8)[_0x2d00('0x21')](handleEntityNotFound(_0x305be6,null))['then'](respondWithResult(_0x305be6,null))[_0x2d00('0x3f')](handleError(_0x305be6,null));};exports[_0x2d00('0x42')]=function(_0x446006,_0x21d392){return db['SquareDetailsReport'][_0x2d00('0x42')](_0x446006['body'],{})['then'](respondWithResult(_0x21d392,0xc9))['catch'](handleError(_0x21d392,null));};exports['update']=function(_0x11c4ce,_0x3e39dc){if(_0x11c4ce[_0x2d00('0x43')]['id']){delete _0x11c4ce[_0x2d00('0x43')]['id'];}return db['SquareDetailsReport'][_0x2d00('0x41')]({'where':{'id':_0x11c4ce['params']['id']}})[_0x2d00('0x21')](handleEntityNotFound(_0x3e39dc,null))[_0x2d00('0x21')](saveUpdates(_0x11c4ce[_0x2d00('0x43')],null))[_0x2d00('0x21')](respondWithResult(_0x3e39dc,null))[_0x2d00('0x3f')](handleError(_0x3e39dc,null));};exports[_0x2d00('0x22')]=function(_0x1176d7,_0x4291a3){return db[_0x2d00('0x28')]['find']({'where':{'id':_0x1176d7[_0x2d00('0x44')]['id']}})[_0x2d00('0x21')](handleEntityNotFound(_0x4291a3,null))[_0x2d00('0x21')](removeEntity(_0x4291a3,null))[_0x2d00('0x3f')](handleError(_0x4291a3,null));};exports[_0x2d00('0x45')]=function(_0xa7cf44,_0x10403d){return db['SquareDetailsReport'][_0x2d00('0x45')]()[_0x2d00('0x21')](respondWithResult(_0x10403d,null))[_0x2d00('0x3f')](handleError(_0x10403d,null));}; \ No newline at end of file +var _0xfbd5=['undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','filter','SquareDetailsReport','includeAll','include','findAll','rows','show','params','rawAttributes','options','find','create','body','catch','describe','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x34c6fd,_0x422e41){var _0x129d3d=function(_0x1f92c1){while(--_0x1f92c1){_0x34c6fd['push'](_0x34c6fd['shift']());}};_0x129d3d(++_0x422e41);}(_0xfbd5,0x7e));var _0x5fbd=function(_0x13b5b2,_0x514cc6){_0x13b5b2=_0x13b5b2-0x0;var _0x46d405=_0xfbd5[_0x13b5b2];return _0x46d405;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5fbd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5fbd('0x1'));var rp=require('request-promise');var moment=require(_0x5fbd('0x2'));var BPromise=require(_0x5fbd('0x3'));var Mustache=require(_0x5fbd('0x4'));var util=require(_0x5fbd('0x5'));var path=require(_0x5fbd('0x6'));var sox=require(_0x5fbd('0x7'));var csv=require(_0x5fbd('0x8'));var ejs=require(_0x5fbd('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5fbd('0xa'));var squel=require(_0x5fbd('0xb'));var crypto=require('crypto');var jsforce=require(_0x5fbd('0xc'));var deskjs=require(_0x5fbd('0xd'));var toCsv=require(_0x5fbd('0x8'));var querystring=require(_0x5fbd('0xe'));var Papa=require(_0x5fbd('0xf'));var Redis=require(_0x5fbd('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5fbd('0x11'));var hardwareService=require(_0x5fbd('0x12'));var logger=require(_0x5fbd('0x13'))(_0x5fbd('0x14'));var utils=require(_0x5fbd('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5fbd('0x16'))['db'];function respondWithStatusCode(_0x4ab436,_0x36a9e3){_0x36a9e3=_0x36a9e3||0xcc;return function(_0x1381cd){if(_0x1381cd){return _0x4ab436[_0x5fbd('0x17')](_0x36a9e3);}return _0x4ab436[_0x5fbd('0x18')](_0x36a9e3)[_0x5fbd('0x19')]();};}function respondWithResult(_0x4035ce,_0x40f09d){_0x40f09d=_0x40f09d||0xc8;return function(_0x1b6bc8){if(_0x1b6bc8){return _0x4035ce[_0x5fbd('0x18')](_0x40f09d)[_0x5fbd('0x1a')](_0x1b6bc8);}};}function respondWithFilteredResult(_0x38ca9a,_0xecfad1){return function(_0x5f3f90){if(_0x5f3f90){var _0x1245b4=typeof _0xecfad1[_0x5fbd('0x1b')]==='undefined'&&typeof _0xecfad1['limit']===_0x5fbd('0x1c');var _0x10f939=_0x5f3f90[_0x5fbd('0x1d')];var _0x2f53f6=_0x1245b4?0x0:_0xecfad1[_0x5fbd('0x1b')];var _0x3ac8d0=_0x1245b4?_0x5f3f90[_0x5fbd('0x1d')]:_0xecfad1[_0x5fbd('0x1b')]+_0xecfad1[_0x5fbd('0x1e')];var _0x459f5d;if(_0x3ac8d0>=_0x10f939){_0x3ac8d0=_0x10f939;_0x459f5d=0xc8;}else{_0x459f5d=0xce;}_0x38ca9a['status'](_0x459f5d);return _0x38ca9a[_0x5fbd('0x1f')](_0x5fbd('0x20'),_0x2f53f6+'-'+_0x3ac8d0+'/'+_0x10f939)['json'](_0x5f3f90);}return null;};}function patchUpdates(_0x148902){return function(_0x8888d1){try{jsonpatch[_0x5fbd('0x21')](_0x8888d1,_0x148902,!![]);}catch(_0x58d458){return BPromise[_0x5fbd('0x22')](_0x58d458);}return _0x8888d1[_0x5fbd('0x23')]();};}function saveUpdates(_0x5f21d6,_0x21a4ba){return function(_0x35afe1){if(_0x35afe1){return _0x35afe1[_0x5fbd('0x24')](_0x5f21d6)[_0x5fbd('0x25')](function(_0x124962){return _0x124962;});}return null;};}function removeEntity(_0x2d0550,_0x5cb89c){return function(_0x1669e4){if(_0x1669e4){return _0x1669e4[_0x5fbd('0x26')]()[_0x5fbd('0x25')](function(){_0x2d0550['status'](0xcc)[_0x5fbd('0x19')]();});}};}function handleEntityNotFound(_0x352c1f,_0x35d284){return function(_0x58357a){if(!_0x58357a){_0x352c1f[_0x5fbd('0x17')](0x194);}return _0x58357a;};}function handleError(_0xe7fece,_0x4ba541){_0x4ba541=_0x4ba541||0x1f4;return function(_0x22e397){logger[_0x5fbd('0x27')](_0x22e397[_0x5fbd('0x28')]);if(_0x22e397[_0x5fbd('0x29')]){delete _0x22e397[_0x5fbd('0x29')];}_0xe7fece[_0x5fbd('0x18')](_0x4ba541)[_0x5fbd('0x2a')](_0x22e397);};}exports[_0x5fbd('0x2b')]=function(_0x25ba65,_0x48898b){var _0x3bb223={},_0x29e3e5={},_0x5a99b3={'count':0x0,'rows':[]};var _0x3cb464=_[_0x5fbd('0x2c')](db['SquareDetailsReport']['rawAttributes'],function(_0x12de0e){return{'name':_0x12de0e[_0x5fbd('0x2d')],'type':_0x12de0e[_0x5fbd('0x2e')][_0x5fbd('0x2f')]};});_0x29e3e5[_0x5fbd('0x30')]=_[_0x5fbd('0x2c')](_0x3cb464,_0x5fbd('0x29'));_0x29e3e5['query']=_[_0x5fbd('0x31')](_0x25ba65[_0x5fbd('0x32')]);_0x29e3e5['filters']=_[_0x5fbd('0x33')](_0x29e3e5['model'],_0x29e3e5[_0x5fbd('0x32')]);_0x3bb223['attributes']=_[_0x5fbd('0x33')](_0x29e3e5[_0x5fbd('0x30')],qs[_0x5fbd('0x34')](_0x25ba65[_0x5fbd('0x32')][_0x5fbd('0x34')]));_0x3bb223[_0x5fbd('0x35')]=_0x3bb223[_0x5fbd('0x35')][_0x5fbd('0x36')]?_0x3bb223[_0x5fbd('0x35')]:_0x29e3e5[_0x5fbd('0x30')];if(!_0x25ba65[_0x5fbd('0x32')][_0x5fbd('0x37')](_0x5fbd('0x38'))){_0x3bb223[_0x5fbd('0x1e')]=qs[_0x5fbd('0x1e')](_0x25ba65['query'][_0x5fbd('0x1e')]);_0x3bb223[_0x5fbd('0x1b')]=qs[_0x5fbd('0x1b')](_0x25ba65[_0x5fbd('0x32')][_0x5fbd('0x1b')]);}_0x3bb223[_0x5fbd('0x39')]=qs['sort'](_0x25ba65['query'][_0x5fbd('0x3a')]);_0x3bb223[_0x5fbd('0x3b')]=qs[_0x5fbd('0x3c')](_['pick'](_0x25ba65['query'],_0x29e3e5[_0x5fbd('0x3c')]),_0x3cb464);if(_0x25ba65[_0x5fbd('0x32')]['filter']){_0x3bb223[_0x5fbd('0x3b')]=_[_0x5fbd('0x3d')](_0x3bb223[_0x5fbd('0x3b')],{'$or':_['map'](_0x3cb464,function(_0x2a11dd){if(_0x2a11dd[_0x5fbd('0x2e')]!=='VIRTUAL'){var _0x380e3b={};_0x380e3b[_0x2a11dd[_0x5fbd('0x29')]]={'$like':'%'+_0x25ba65['query'][_0x5fbd('0x3e')]+'%'};return _0x380e3b;}})});}_0x3bb223=_[_0x5fbd('0x3d')]({},_0x3bb223,_0x25ba65['options']);var _0x354c97={'where':_0x3bb223[_0x5fbd('0x3b')]};return db[_0x5fbd('0x3f')][_0x5fbd('0x1d')](_0x354c97)[_0x5fbd('0x25')](function(_0x424b3d){_0x5a99b3[_0x5fbd('0x1d')]=_0x424b3d;if(_0x25ba65[_0x5fbd('0x32')][_0x5fbd('0x40')]){_0x3bb223[_0x5fbd('0x41')]=[{'all':!![]}];}return db[_0x5fbd('0x3f')][_0x5fbd('0x42')](_0x3bb223);})[_0x5fbd('0x25')](function(_0x530af5){_0x5a99b3[_0x5fbd('0x43')]=_0x530af5;return _0x5a99b3;})[_0x5fbd('0x25')](respondWithFilteredResult(_0x48898b,_0x3bb223))['catch'](handleError(_0x48898b,null));};exports[_0x5fbd('0x44')]=function(_0x32615f,_0x13787d){var _0xb95ff0={'raw':!![],'where':{'id':_0x32615f[_0x5fbd('0x45')]['id']}},_0x24575c={};_0x24575c[_0x5fbd('0x30')]=_[_0x5fbd('0x31')](db[_0x5fbd('0x3f')][_0x5fbd('0x46')]);_0x24575c['query']=_[_0x5fbd('0x31')](_0x32615f[_0x5fbd('0x32')]);_0x24575c[_0x5fbd('0x3c')]=_[_0x5fbd('0x33')](_0x24575c[_0x5fbd('0x30')],_0x24575c[_0x5fbd('0x32')]);_0xb95ff0[_0x5fbd('0x35')]=_[_0x5fbd('0x33')](_0x24575c[_0x5fbd('0x30')],qs['fields'](_0x32615f[_0x5fbd('0x32')][_0x5fbd('0x34')]));_0xb95ff0[_0x5fbd('0x35')]=_0xb95ff0[_0x5fbd('0x35')][_0x5fbd('0x36')]?_0xb95ff0[_0x5fbd('0x35')]:_0x24575c['model'];if(_0x32615f[_0x5fbd('0x32')][_0x5fbd('0x40')]){_0xb95ff0[_0x5fbd('0x41')]=[{'all':!![]}];}_0xb95ff0=_[_0x5fbd('0x3d')]({},_0xb95ff0,_0x32615f[_0x5fbd('0x47')]);return db[_0x5fbd('0x3f')][_0x5fbd('0x48')](_0xb95ff0)[_0x5fbd('0x25')](handleEntityNotFound(_0x13787d,null))['then'](respondWithResult(_0x13787d,null))['catch'](handleError(_0x13787d,null));};exports[_0x5fbd('0x49')]=function(_0x239f79,_0x1e808c){return db[_0x5fbd('0x3f')][_0x5fbd('0x49')](_0x239f79[_0x5fbd('0x4a')],{})[_0x5fbd('0x25')](respondWithResult(_0x1e808c,0xc9))[_0x5fbd('0x4b')](handleError(_0x1e808c,null));};exports[_0x5fbd('0x24')]=function(_0xd8b187,_0x20301f){if(_0xd8b187[_0x5fbd('0x4a')]['id']){delete _0xd8b187[_0x5fbd('0x4a')]['id'];}return db[_0x5fbd('0x3f')][_0x5fbd('0x48')]({'where':{'id':_0xd8b187[_0x5fbd('0x45')]['id']}})[_0x5fbd('0x25')](handleEntityNotFound(_0x20301f,null))[_0x5fbd('0x25')](saveUpdates(_0xd8b187[_0x5fbd('0x4a')],null))[_0x5fbd('0x25')](respondWithResult(_0x20301f,null))['catch'](handleError(_0x20301f,null));};exports['destroy']=function(_0x188187,_0x31873a){return db[_0x5fbd('0x3f')][_0x5fbd('0x48')]({'where':{'id':_0x188187[_0x5fbd('0x45')]['id']}})[_0x5fbd('0x25')](handleEntityNotFound(_0x31873a,null))[_0x5fbd('0x25')](removeEntity(_0x31873a,null))['catch'](handleError(_0x31873a,null));};exports[_0x5fbd('0x4c')]=function(_0x38b430,_0x40a261){return db['SquareDetailsReport']['describe']()[_0x5fbd('0x25')](respondWithResult(_0x40a261,null))[_0x5fbd('0x4b')](handleError(_0x40a261,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 1189b07..57344c3 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 _0x8425=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details','lodash','util','../../config/logger','api'];(function(_0x1ac2c2,_0x21d7bf){var _0x5d508f=function(_0x2b4e3c){while(--_0x2b4e3c){_0x1ac2c2['push'](_0x1ac2c2['shift']());}};_0x5d508f(++_0x21d7bf);}(_0x8425,0x65));var _0x5842=function(_0x582978,_0xfc1e41){_0x582978=_0x582978-0x0;var _0x124132=_0x8425[_0x582978];return _0x124132;};'use strict';var _=require(_0x5842('0x0'));var util=require(_0x5842('0x1'));var logger=require(_0x5842('0x2'))(_0x5842('0x3'));var moment=require(_0x5842('0x4'));var BPromise=require(_0x5842('0x5'));var rp=require(_0x5842('0x6'));var fs=require('fs');var path=require(_0x5842('0x7'));var rimraf=require(_0x5842('0x8'));var config=require(_0x5842('0x9'));var attributes=require(_0x5842('0xa'));module[_0x5842('0xb')]=function(_0x2e717b,_0x2f9d45){return _0x2e717b[_0x5842('0xc')](_0x5842('0xd'),attributes,{'tableName':_0x5842('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe39e=['rimraf','../../config/environment','exports','define','SquareDetailsReport','report_square_details','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x509dd5,_0x1a1337){var _0x1f5775=function(_0x199500){while(--_0x199500){_0x509dd5['push'](_0x509dd5['shift']());}};_0x1f5775(++_0x1a1337);}(_0xe39e,0x1a6));var _0xee39=function(_0x6f1031,_0x3c0a6f){_0x6f1031=_0x6f1031-0x0;var _0x4e1b8d=_0xe39e[_0x6f1031];return _0x4e1b8d;};'use strict';var _=require('lodash');var util=require(_0xee39('0x0'));var logger=require(_0xee39('0x1'))(_0xee39('0x2'));var moment=require(_0xee39('0x3'));var BPromise=require(_0xee39('0x4'));var rp=require(_0xee39('0x5'));var fs=require('fs');var path=require(_0xee39('0x6'));var rimraf=require(_0xee39('0x7'));var config=require(_0xee39('0x8'));var attributes=require('./squareReportDetail.attributes');module[_0xee39('0x9')]=function(_0x41de74,_0x3951c4){return _0x41de74[_0xee39('0xa')](_0xee39('0xb'),attributes,{'tableName':_0xee39('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index bc82c8d..5b9f33d 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 _0x8f4c=['SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x528673,_0x38fabf){var _0x7b85b8=function(_0x53ec07){while(--_0x53ec07){_0x528673['push'](_0x528673['shift']());}};_0x7b85b8(++_0x38fabf);}(_0x8f4c,0x113));var _0xc8f4=function(_0x2e34f8,_0x53a191){_0x2e34f8=_0x2e34f8-0x0;var _0x2b147a=_0x8f4c[_0x2e34f8];return _0x2b147a;};'use strict';var _=require(_0xc8f4('0x0'));var util=require(_0xc8f4('0x1'));var moment=require(_0xc8f4('0x2'));var BPromise=require(_0xc8f4('0x3'));var rs=require(_0xc8f4('0x4'));var fs=require('fs');var Redis=require(_0xc8f4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc8f4('0x6'));var logger=require(_0xc8f4('0x7'))(_0xc8f4('0x8'));var config=require('../../config/environment');var jayson=require(_0xc8f4('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x520063,_0x373506,_0x48c39d){return new BPromise(function(_0x3ea9a2,_0x3a9ab1){return client[_0xc8f4('0xa')](_0x520063,_0x48c39d)[_0xc8f4('0xb')](function(_0x34f05f){logger['info'](_0xc8f4('0xc'),_0x373506,_0xc8f4('0xd'));logger[_0xc8f4('0xe')](_0xc8f4('0xf'),_0x373506,'request\x20sent',JSON[_0xc8f4('0x10')](_0x34f05f));if(_0x34f05f['error']){if(_0x34f05f[_0xc8f4('0x11')][_0xc8f4('0x12')]===0x1f4){logger[_0xc8f4('0x11')](_0xc8f4('0xc'),_0x373506,_0x34f05f[_0xc8f4('0x11')]['message']);return _0x3a9ab1(_0x34f05f[_0xc8f4('0x11')][_0xc8f4('0x13')]);}logger[_0xc8f4('0x11')](_0xc8f4('0xc'),_0x373506,_0x34f05f[_0xc8f4('0x11')][_0xc8f4('0x13')]);return _0x3ea9a2(_0x34f05f['error'][_0xc8f4('0x13')]);}else{logger[_0xc8f4('0x14')](_0xc8f4('0xc'),_0x373506,_0xc8f4('0xd'));_0x3ea9a2(_0x34f05f[_0xc8f4('0x15')]['message']);}})[_0xc8f4('0x16')](function(_0x4d2b77){logger['error'](_0xc8f4('0xc'),_0x373506,_0x4d2b77);_0x3a9ab1(_0x4d2b77);});});}exports[_0xc8f4('0x17')]=function(_0x108076){var _0x7bb973=this;return new Promise(function(_0x4763c1,_0x374761){return db[_0xc8f4('0x18')][_0xc8f4('0x19')](_0x108076[_0xc8f4('0x1a')],{'raw':_0x108076[_0xc8f4('0x1b')]?_0x108076[_0xc8f4('0x1b')][_0xc8f4('0x1c')]===undefined?!![]:![]:!![]})[_0xc8f4('0xb')](function(_0x5f3264){logger[_0xc8f4('0x14')](_0xc8f4('0x17'),_0x108076);logger[_0xc8f4('0xe')](_0xc8f4('0x17'),_0x108076,JSON[_0xc8f4('0x10')](_0x5f3264));_0x4763c1(_0x5f3264);})[_0xc8f4('0x16')](function(_0xaeee7d){logger[_0xc8f4('0x11')]('CreateSquareDetailsReport',_0xaeee7d[_0xc8f4('0x13')],_0x108076);_0x374761(_0x7bb973[_0xc8f4('0x11')](0x1f4,_0xaeee7d[_0xc8f4('0x13')]));});});}; \ No newline at end of file +var _0xdd4f=['options','raw','catch','lodash','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','SquareDetailsReport,\x20%s,\x20%s','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','CreateSquareDetailsReport','SquareDetailsReport','create'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x155107,_0x1b4bef){_0x155107=_0x155107-0x0;var _0x569c25=_0xdd4f[_0x155107];return _0x569c25;};'use strict';var _=require(_0xfdd4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfdd4('0x1'));var fs=require('fs');var Redis=require(_0xfdd4('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xfdd4('0x3'));var logger=require(_0xfdd4('0x4'))(_0xfdd4('0x5'));var config=require('../../config/environment');var jayson=require(_0xfdd4('0x6'));var client=jayson[_0xfdd4('0x7')][_0xfdd4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x307ac6,_0x3c72d4,_0x51acd6){return new BPromise(function(_0x3cd8e6,_0x563ae6){return client[_0xfdd4('0x9')](_0x307ac6,_0x51acd6)[_0xfdd4('0xa')](function(_0x1e823e){logger['info'](_0xfdd4('0xb'),_0x3c72d4,'request\x20sent');logger[_0xfdd4('0xc')](_0xfdd4('0xd'),_0x3c72d4,_0xfdd4('0xe'),JSON[_0xfdd4('0xf')](_0x1e823e));if(_0x1e823e[_0xfdd4('0x10')]){if(_0x1e823e[_0xfdd4('0x10')][_0xfdd4('0x11')]===0x1f4){logger[_0xfdd4('0x10')](_0xfdd4('0xb'),_0x3c72d4,_0x1e823e[_0xfdd4('0x10')][_0xfdd4('0x12')]);return _0x563ae6(_0x1e823e['error'][_0xfdd4('0x12')]);}logger[_0xfdd4('0x10')](_0xfdd4('0xb'),_0x3c72d4,_0x1e823e['error'][_0xfdd4('0x12')]);return _0x3cd8e6(_0x1e823e['error'][_0xfdd4('0x12')]);}else{logger[_0xfdd4('0x13')](_0xfdd4('0xb'),_0x3c72d4,_0xfdd4('0xe'));_0x3cd8e6(_0x1e823e[_0xfdd4('0x14')]['message']);}})['catch'](function(_0x559c77){logger[_0xfdd4('0x10')](_0xfdd4('0xb'),_0x3c72d4,_0x559c77);_0x563ae6(_0x559c77);});});}exports[_0xfdd4('0x15')]=function(_0x2ccc88){var _0x32b5f7=this;return new Promise(function(_0x33d752,_0x1746e1){return db[_0xfdd4('0x16')][_0xfdd4('0x17')](_0x2ccc88['body'],{'raw':_0x2ccc88[_0xfdd4('0x18')]?_0x2ccc88[_0xfdd4('0x18')][_0xfdd4('0x19')]===undefined?!![]:![]:!![]})[_0xfdd4('0xa')](function(_0x1454f1){logger[_0xfdd4('0x13')](_0xfdd4('0x15'),_0x2ccc88);logger[_0xfdd4('0xc')]('CreateSquareDetailsReport',_0x2ccc88,JSON[_0xfdd4('0xf')](_0x1454f1));_0x33d752(_0x1454f1);})[_0xfdd4('0x1a')](function(_0x2a24e8){logger[_0xfdd4('0x10')](_0xfdd4('0x15'),_0x2a24e8[_0xfdd4('0x12')],_0x2ccc88);_0x1746e1(_0x32b5f7[_0xfdd4('0x10')](0x1f4,_0x2a24e8[_0xfdd4('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 98241ce..8370c1e 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 _0x467f=['../../components/auth/service','./system.controller','get','index','/process/:pid/kill','isAuthenticated'];(function(_0x5d80de,_0x2cf15d){var _0x1c7556=function(_0x5bd806){while(--_0x5bd806){_0x5d80de['push'](_0x5d80de['shift']());}};_0x1c7556(++_0x2cf15d);}(_0x467f,0x1b0));var _0xf467=function(_0x38537f,_0x252124){_0x38537f=_0x38537f-0x0;var _0x141e23=_0x467f[_0x38537f];return _0x141e23;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0xf467('0x0'));var controller=require(_0xf467('0x1'));router[_0xf467('0x2')]('/',auth['isAuthenticated'](),controller[_0xf467('0x3')]);router[_0xf467('0x2')](_0xf467('0x4'),auth[_0xf467('0x5')](),controller['killProcess']);module['exports']=router; \ No newline at end of file +var _0x4a28=['/process/:pid/kill','exports','Router','../../components/auth/service','./system.controller','get','index'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0x4a28,0x183));var _0x84a2=function(_0x3dd203,_0x3238f7){_0x3dd203=_0x3dd203-0x0;var _0x3b6867=_0x4a28[_0x3dd203];return _0x3b6867;};'use strict';var express=require('express');var router=express[_0x84a2('0x0')]();var auth=require(_0x84a2('0x1'));var controller=require(_0x84a2('0x2'));router[_0x84a2('0x3')]('/',auth['isAuthenticated'](),controller[_0x84a2('0x4')]);router[_0x84a2('0x3')](_0x84a2('0x5'),auth['isAuthenticated'](),controller['killProcess']);module[_0x84a2('0x6')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 74b6278..4a0bdf7 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 _0xbb42=['send','index','then','json','catch','killProcess','components/import/cm','format','pid','split','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','params','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status'];(function(_0x52d453,_0x9c8293){var _0x16b462=function(_0xeaa7f0){while(--_0xeaa7f0){_0x52d453['push'](_0x52d453['shift']());}};_0x16b462(++_0x9c8293);}(_0xbb42,0x80));var _0x2bb4=function(_0xe2be6b,_0x32bfdd){_0xe2be6b=_0xe2be6b-0x0;var _0x379cdf=_0xbb42[_0xe2be6b];return _0x379cdf;};'use strict';var info=require(_0x2bb4('0x0'));var exec=require(_0x2bb4('0x1'))[_0x2bb4('0x2')];var logger=require('../../config/logger')(_0x2bb4('0x3'));var util=require(_0x2bb4('0x4'));var BPromise=require(_0x2bb4('0x5'));var _=require(_0x2bb4('0x6'));function handleError(_0x152c0a,_0x238d88,_0x73b374){_0x238d88=_0x238d88||0x1f4;return function(_0x31c81e){logger[_0x2bb4('0x7')](_0x2bb4('0x8'),_0x73b374,_0x238d88,util[_0x2bb4('0x9')](_0x31c81e,{'showHidden':![],'depth':null}));delete _0x31c81e[_0x2bb4('0xa')];_0x152c0a[_0x2bb4('0xb')](_0x238d88)[_0x2bb4('0xc')](_0x31c81e);};}exports[_0x2bb4('0xd')]=function(_0x130440,_0x538656){return info['getAllData']()[_0x2bb4('0xe')](function(_0x4c8f20){return _0x538656[_0x2bb4('0xb')](0xc8)[_0x2bb4('0xf')](_0x4c8f20);})[_0x2bb4('0x10')](function(_0x1f87c2){return _0x538656['status'](0x1f4)[_0x2bb4('0xf')](_0x1f87c2);});};exports[_0x2bb4('0x11')]=function(_0x2267cb,_0x95477e){var _0x5ddf1c=[_0x2bb4('0x12')];return new BPromise(function(_0x1c978b,_0x37695c){return exec(util[_0x2bb4('0x13')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x2267cb['params'][_0x2bb4('0x14')]),function(_0x171cda,_0x2a34c3,_0x5dfe9c){if(_0x171cda){return _0x37695c(_0x171cda);}return _0x1c978b(_0x2a34c3);});})[_0x2bb4('0xe')](function(_0x35d5cb){var _0x20948c=![];var _0x16493c=_0x35d5cb[_0x2bb4('0x15')](/\n/);for(var _0x5712ef=0x0,_0x50f98e=_0x5ddf1c['length'];_0x5712ef<_0x50f98e,_0x20948c===![];_0x5712ef+=0x1){if(_0x35d5cb[_0x2bb4('0x16')](_0x5ddf1c[_0x5712ef])>=0x0){_0x20948c=!![];}}if(!_0x20948c){throw new Error(util[_0x2bb4('0x13')](_0x2bb4('0x17'),_0x2267cb[_0x2bb4('0x18')][_0x2bb4('0x14')]));}process[_0x2bb4('0x19')](_0x2267cb[_0x2bb4('0x18')][_0x2bb4('0x14')],_0x2bb4('0x1a'));return _0x95477e[_0x2bb4('0xb')](0xc8)['json']({'message':util[_0x2bb4('0x13')](_0x2bb4('0x1b'),_0x2267cb[_0x2bb4('0x18')][_0x2bb4('0x14')])});})[_0x2bb4('0x10')](handleError(_0x95477e,null,_0x2bb4('0x11')));}; \ No newline at end of file +var _0x479c=['pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','exec','api','util','bluebird','lodash','inspect','name','send','index','then','status','catch','json','killProcess','components/import/cm','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params'];(function(_0x289891,_0x49a0fa){var _0x31cf2e=function(_0x8cebce){while(--_0x8cebce){_0x289891['push'](_0x289891['shift']());}};_0x31cf2e(++_0x49a0fa);}(_0x479c,0xe8));var _0xc479=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x479c[_0x2c7618];return _0x5ce3f0;};'use strict';var info=require(_0xc479('0x0'));var exec=require('child_process')[_0xc479('0x1')];var logger=require('../../config/logger')(_0xc479('0x2'));var util=require(_0xc479('0x3'));var BPromise=require(_0xc479('0x4'));var _=require(_0xc479('0x5'));function handleError(_0x5e6c7e,_0x3e77ff,_0x47079b){_0x3e77ff=_0x3e77ff||0x1f4;return function(_0xc359b6){logger['error']('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x47079b,_0x3e77ff,util[_0xc479('0x6')](_0xc359b6,{'showHidden':![],'depth':null}));delete _0xc359b6[_0xc479('0x7')];_0x5e6c7e['status'](_0x3e77ff)[_0xc479('0x8')](_0xc359b6);};}exports[_0xc479('0x9')]=function(_0x20ec94,_0x290512){return info['getAllData']()[_0xc479('0xa')](function(_0x419988){return _0x290512[_0xc479('0xb')](0xc8)['json'](_0x419988);})[_0xc479('0xc')](function(_0x4fb48c){return _0x290512['status'](0x1f4)[_0xc479('0xd')](_0x4fb48c);});};exports[_0xc479('0xe')]=function(_0x59269a,_0x205441){var _0x59e293=[_0xc479('0xf')];return new BPromise(function(_0x328b54,_0x5203d6){return exec(util['format'](_0xc479('0x10'),_0x59269a[_0xc479('0x11')][_0xc479('0x12')]),function(_0x5721e5,_0x388cd6,_0xd40a89){if(_0x5721e5){return _0x5203d6(_0x5721e5);}return _0x328b54(_0x388cd6);});})['then'](function(_0xde9940){var _0x13e1dd=![];var _0x7cdbd4=_0xde9940[_0xc479('0x13')](/\n/);for(var _0x10b7fd=0x0,_0x14105d=_0x59e293[_0xc479('0x14')];_0x10b7fd<_0x14105d,_0x13e1dd===![];_0x10b7fd+=0x1){if(_0xde9940[_0xc479('0x15')](_0x59e293[_0x10b7fd])>=0x0){_0x13e1dd=!![];}}if(!_0x13e1dd){throw new Error(util['format'](_0xc479('0x16'),_0x59269a['params'][_0xc479('0x12')]));}process[_0xc479('0x17')](_0x59269a['params'][_0xc479('0x12')],'SIGINT');return _0x205441[_0xc479('0xb')](0xc8)[_0xc479('0xd')]({'message':util['format'](_0xc479('0x18'),_0x59269a[_0xc479('0x11')]['pid'])});})[_0xc479('0xc')](handleError(_0x205441,null,'killProcess'));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 5d9d9b5..ef6fa87 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 _0x702d=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','describe','/:id','isAuthenticated','show','post','create','put','update','destroy','exports','multer','util','path'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x702d,0x147));var _0xd702=function(_0x457160,_0x2835a4){_0x457160=_0x457160-0x0;var _0x16e52b=_0x702d[_0x457160];return _0x16e52b;};'use strict';var multer=require(_0xd702('0x0'));var util=require(_0xd702('0x1'));var path=require(_0xd702('0x2'));var timeout=require(_0xd702('0x3'));var express=require(_0xd702('0x4'));var router=express['Router']();var fs_extra=require(_0xd702('0x5'));var auth=require(_0xd702('0x6'));var interaction=require(_0xd702('0x7'));var config=require(_0xd702('0x8'));var controller=require('./tag.controller');router[_0xd702('0x9')]('/',auth['isAuthenticated'](),controller[_0xd702('0xa')]);router[_0xd702('0x9')](_0xd702('0xb'),auth['isAuthenticated'](),controller[_0xd702('0xc')]);router['get'](_0xd702('0xd'),auth[_0xd702('0xe')](),controller[_0xd702('0xf')]);router[_0xd702('0x10')]('/',auth[_0xd702('0xe')](),controller[_0xd702('0x11')]);router[_0xd702('0x12')](_0xd702('0xd'),auth[_0xd702('0xe')](),controller[_0xd702('0x13')]);router['delete']('/:id',auth[_0xd702('0xe')](),controller[_0xd702('0x14')]);module[_0xd702('0x15')]=router; \ No newline at end of file +var _0xe5b3=['../../config/environment','./tag.controller','get','index','isAuthenticated','describe','/:id','post','create','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x106c21,_0x39371e){var _0x5a12fc=function(_0x1a1fb7){while(--_0x1a1fb7){_0x106c21['push'](_0x106c21['shift']());}};_0x5a12fc(++_0x39371e);}(_0xe5b3,0x133));var _0x3e5b=function(_0x2e5798,_0x174511){_0x2e5798=_0x2e5798-0x0;var _0x29741c=_0xe5b3[_0x2e5798];return _0x29741c;};'use strict';var multer=require('multer');var util=require(_0x3e5b('0x0'));var path=require(_0x3e5b('0x1'));var timeout=require(_0x3e5b('0x2'));var express=require(_0x3e5b('0x3'));var router=express[_0x3e5b('0x4')]();var fs_extra=require(_0x3e5b('0x5'));var auth=require(_0x3e5b('0x6'));var interaction=require(_0x3e5b('0x7'));var config=require(_0x3e5b('0x8'));var controller=require(_0x3e5b('0x9'));router[_0x3e5b('0xa')]('/',auth['isAuthenticated'](),controller[_0x3e5b('0xb')]);router[_0x3e5b('0xa')]('/describe',auth[_0x3e5b('0xc')](),controller[_0x3e5b('0xd')]);router[_0x3e5b('0xa')](_0x3e5b('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x3e5b('0xf')]('/',auth[_0x3e5b('0xc')](),controller[_0x3e5b('0x10')]);router[_0x3e5b('0x11')](_0x3e5b('0xe'),auth['isAuthenticated'](),controller[_0x3e5b('0x12')]);router['delete'](_0x3e5b('0xe'),auth[_0x3e5b('0xc')](),controller[_0x3e5b('0x13')]);module[_0x3e5b('0x14')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 46fa746..d734c5a 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 _0x09dd=['STRING','name','#0091EA','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x09dd,0xb7));var _0xd09d=function(_0x28a6ad,_0x351697){_0x28a6ad=_0x28a6ad-0x0;var _0xbb804=_0x09dd[_0x28a6ad];return _0xbb804;};'use strict';var Sequelize=require(_0xd09d('0x0'));module[_0xd09d('0x1')]={'name':{'type':Sequelize[_0xd09d('0x2')],'unique':_0xd09d('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xd09d('0x2')],'defaultValue':_0xd09d('0x4')},'description':{'type':Sequelize[_0xd09d('0x2')]}}; \ No newline at end of file +var _0xbca8=['sequelize','exports','STRING','name'];(function(_0x3093fe,_0x5a0cff){var _0x31517d=function(_0x4a6eba){while(--_0x4a6eba){_0x3093fe['push'](_0x3093fe['shift']());}};_0x31517d(++_0x5a0cff);}(_0xbca8,0xcc));var _0x8bca=function(_0x5d1f87,_0x2d807a){_0x5d1f87=_0x5d1f87-0x0;var _0x48b897=_0xbca8[_0x5d1f87];return _0x48b897;};'use strict';var Sequelize=require(_0x8bca('0x0'));module[_0x8bca('0x1')]={'name':{'type':Sequelize[_0x8bca('0x2')],'unique':_0x8bca('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x8bca('0x2')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0x8bca('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index da7646b..604b680 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 _0x847d=['user','role','Tags','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','Tag','rawAttributes','fieldName','type','key','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','merge','where','VIRTUAL','options','includeAll','show','keys','find','catch','create','body'];(function(_0x298c24,_0x2847b4){var _0x5b5772=function(_0x4ad68d){while(--_0x4ad68d){_0x298c24['push'](_0x298c24['shift']());}};_0x5b5772(++_0x2847b4);}(_0x847d,0xf8));var _0xd847=function(_0x3b1b23,_0x21bccd){_0x3b1b23=_0x3b1b23-0x0;var _0x1efc85=_0x847d[_0x3b1b23];return _0x1efc85;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd847('0x0'));var zipdir=require(_0xd847('0x1'));var jsonpatch=require(_0xd847('0x2'));var rp=require(_0xd847('0x3'));var moment=require(_0xd847('0x4'));var BPromise=require(_0xd847('0x5'));var Mustache=require(_0xd847('0x6'));var util=require('util');var path=require(_0xd847('0x7'));var sox=require(_0xd847('0x8'));var csv=require(_0xd847('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd847('0xa'));var _=require(_0xd847('0xb'));var squel=require('squel');var crypto=require(_0xd847('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xd847('0xd'));var toCsv=require(_0xd847('0x9'));var querystring=require(_0xd847('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd847('0xf'));var qs=require(_0xd847('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd847('0x11'));var logger=require(_0xd847('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xd847('0x13'));var licenseUtil=require(_0xd847('0x14'));var db=require(_0xd847('0x15'))['db'];function respondWithStatusCode(_0x3f5935,_0x40b2a5){_0x40b2a5=_0x40b2a5||0xcc;return function(_0x5a99b2){if(_0x5a99b2){return _0x3f5935[_0xd847('0x16')](_0x40b2a5);}return _0x3f5935[_0xd847('0x17')](_0x40b2a5)['end']();};}function respondWithResult(_0x36d17a,_0x3386fa){_0x3386fa=_0x3386fa||0xc8;return function(_0x5753ba){if(_0x5753ba){return _0x36d17a[_0xd847('0x17')](_0x3386fa)[_0xd847('0x18')](_0x5753ba);}};}function respondWithFilteredResult(_0x1e87ce,_0xa957c6){return function(_0x7b9337){if(_0x7b9337){var _0x15738=typeof _0xa957c6['offset']==='undefined'&&typeof _0xa957c6[_0xd847('0x19')]==='undefined';var _0x5db30b=_0x7b9337['count'];var _0x56fa2d=_0x15738?0x0:_0xa957c6[_0xd847('0x1a')];var _0xdc9166=_0x15738?_0x7b9337[_0xd847('0x1b')]:_0xa957c6[_0xd847('0x1a')]+_0xa957c6[_0xd847('0x19')];var _0x53027f;if(_0xdc9166>=_0x5db30b){_0xdc9166=_0x5db30b;_0x53027f=0xc8;}else{_0x53027f=0xce;}_0x1e87ce[_0xd847('0x17')](_0x53027f);return _0x1e87ce[_0xd847('0x1c')](_0xd847('0x1d'),_0x56fa2d+'-'+_0xdc9166+'/'+_0x5db30b)[_0xd847('0x18')](_0x7b9337);}return null;};}function patchUpdates(_0x37e01c){return function(_0x512c41){try{jsonpatch[_0xd847('0x1e')](_0x512c41,_0x37e01c,!![]);}catch(_0x4c2c6c){return BPromise[_0xd847('0x1f')](_0x4c2c6c);}return _0x512c41[_0xd847('0x20')]();};}function saveUpdates(_0x2363ba,_0x544ec2){return function(_0x4b9035){if(_0x4b9035){return _0x4b9035[_0xd847('0x21')](_0x2363ba)[_0xd847('0x22')](function(_0x1d91a1){return _0x1d91a1;});}return null;};}function removeEntity(_0x44213a,_0x506435){return function(_0x1796e2){if(_0x1796e2){return _0x1796e2[_0xd847('0x23')]()['then'](function(){var _0x1b2039=_0x1796e2[_0xd847('0x24')]({'plain':!![]});var _0x3d7a90='Tags';return db[_0xd847('0x25')][_0xd847('0x23')]({'where':{'type':_0x3d7a90,'resourceId':_0x1b2039['id']}})[_0xd847('0x22')](function(){return _0x1796e2;});})[_0xd847('0x22')](function(){_0x44213a[_0xd847('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14eb0f,_0x1b6ac1){return function(_0x85ff76){if(!_0x85ff76){_0x14eb0f[_0xd847('0x16')](0x194);}return _0x85ff76;};}function handleError(_0x2da5fc,_0x187e01){_0x187e01=_0x187e01||0x1f4;return function(_0x2c9297){logger[_0xd847('0x26')](_0x2c9297[_0xd847('0x27')]);if(_0x2c9297[_0xd847('0x28')]){delete _0x2c9297['name'];}_0x2da5fc[_0xd847('0x17')](_0x187e01)[_0xd847('0x29')](_0x2c9297);};}exports[_0xd847('0x2a')]=function(_0x262e0e,_0xe380ff){var _0x2c4a24={},_0x58ca2f={},_0x283a54={'count':0x0,'rows':[]};var _0x5b8cbf=_[_0xd847('0x2b')](db[_0xd847('0x2c')][_0xd847('0x2d')],function(_0x2c0127){return{'name':_0x2c0127[_0xd847('0x2e')],'type':_0x2c0127[_0xd847('0x2f')][_0xd847('0x30')]};});_0x58ca2f['model']=_[_0xd847('0x2b')](_0x5b8cbf,_0xd847('0x28'));_0x58ca2f['query']=_['keys'](_0x262e0e[_0xd847('0x31')]);_0x58ca2f['filters']=_['intersection'](_0x58ca2f[_0xd847('0x32')],_0x58ca2f[_0xd847('0x31')]);_0x2c4a24[_0xd847('0x33')]=_[_0xd847('0x34')](_0x58ca2f[_0xd847('0x32')],qs[_0xd847('0x35')](_0x262e0e[_0xd847('0x31')][_0xd847('0x35')]));_0x2c4a24[_0xd847('0x33')]=_0x2c4a24[_0xd847('0x33')][_0xd847('0x36')]?_0x2c4a24[_0xd847('0x33')]:_0x58ca2f['model'];if(!_0x262e0e[_0xd847('0x31')][_0xd847('0x37')](_0xd847('0x38'))){_0x2c4a24['limit']=qs[_0xd847('0x19')](_0x262e0e[_0xd847('0x31')][_0xd847('0x19')]);_0x2c4a24[_0xd847('0x1a')]=qs[_0xd847('0x1a')](_0x262e0e[_0xd847('0x31')]['offset']);}_0x2c4a24['order']=qs[_0xd847('0x39')](_0x262e0e[_0xd847('0x31')][_0xd847('0x39')]);_0x2c4a24['where']=qs[_0xd847('0x3a')](_[_0xd847('0x3b')](_0x262e0e[_0xd847('0x31')],_0x58ca2f['filters']),_0x5b8cbf);if(_0x262e0e[_0xd847('0x31')][_0xd847('0x3c')]){_0x2c4a24['where']=_[_0xd847('0x3d')](_0x2c4a24[_0xd847('0x3e')],{'$or':_['map'](_0x5b8cbf,function(_0x5189b4){if(_0x5189b4[_0xd847('0x2f')]!==_0xd847('0x3f')){var _0x52398d={};_0x52398d[_0x5189b4['name']]={'$like':'%'+_0x262e0e[_0xd847('0x31')][_0xd847('0x3c')]+'%'};return _0x52398d;}})});}_0x2c4a24=_[_0xd847('0x3d')]({},_0x2c4a24,_0x262e0e[_0xd847('0x40')]);var _0x215f9b={'where':_0x2c4a24[_0xd847('0x3e')]};return db[_0xd847('0x2c')]['count'](_0x215f9b)[_0xd847('0x22')](function(_0x141cd0){_0x283a54[_0xd847('0x1b')]=_0x141cd0;if(_0x262e0e[_0xd847('0x31')][_0xd847('0x41')]){_0x2c4a24['include']=[{'all':!![]}];}return db[_0xd847('0x2c')]['findAll'](_0x2c4a24);})[_0xd847('0x22')](function(_0x1fe350){_0x283a54['rows']=_0x1fe350;return _0x283a54;})[_0xd847('0x22')](respondWithFilteredResult(_0xe380ff,_0x2c4a24))['catch'](handleError(_0xe380ff,null));};exports[_0xd847('0x42')]=function(_0x31b0bc,_0x476dee){var _0x6409fb={'raw':!![],'where':{'id':_0x31b0bc['params']['id']}},_0x5317c9={};_0x5317c9[_0xd847('0x32')]=_[_0xd847('0x43')](db['Tag']['rawAttributes']);_0x5317c9[_0xd847('0x31')]=_['keys'](_0x31b0bc['query']);_0x5317c9['filters']=_[_0xd847('0x34')](_0x5317c9[_0xd847('0x32')],_0x5317c9['query']);_0x6409fb['attributes']=_[_0xd847('0x34')](_0x5317c9[_0xd847('0x32')],qs[_0xd847('0x35')](_0x31b0bc[_0xd847('0x31')][_0xd847('0x35')]));_0x6409fb['attributes']=_0x6409fb[_0xd847('0x33')]['length']?_0x6409fb[_0xd847('0x33')]:_0x5317c9[_0xd847('0x32')];if(_0x31b0bc['query'][_0xd847('0x41')]){_0x6409fb['include']=[{'all':!![]}];}_0x6409fb=_[_0xd847('0x3d')]({},_0x6409fb,_0x31b0bc[_0xd847('0x40')]);return db[_0xd847('0x2c')][_0xd847('0x44')](_0x6409fb)['then'](handleEntityNotFound(_0x476dee,null))['then'](respondWithResult(_0x476dee,null))[_0xd847('0x45')](handleError(_0x476dee,null));};exports[_0xd847('0x46')]=function(_0x516a97,_0x56f7f6){return db[_0xd847('0x2c')]['create'](_0x516a97[_0xd847('0x47')],{})[_0xd847('0x22')](function(_0x455f9b){var _0xe16325=_0x516a97[_0xd847('0x48')][_0xd847('0x24')]({'plain':!![]});if(!_0xe16325)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xe16325[_0xd847('0x49')]===_0xd847('0x48')){var _0x414e56=_0x455f9b[_0xd847('0x24')]({'plain':!![]});var _0x3c96a5=_0xd847('0x4a');return db[_0xd847('0x4b')][_0xd847('0x44')]({'where':{'name':_0x3c96a5,'userProfileId':_0xe16325[_0xd847('0x4c')]},'raw':!![]})['then'](function(_0x344a30){if(_0x344a30&&_0x344a30['autoAssociation']===0x0){return db['UserProfileResource'][_0xd847('0x46')]({'name':_0x414e56['name'],'resourceId':_0x414e56['id'],'type':_0x344a30[_0xd847('0x28')],'sectionId':_0x344a30['id']},{})[_0xd847('0x22')](function(){return _0x455f9b;});}else{return _0x455f9b;}})[_0xd847('0x45')](function(_0x1b3e44){logger[_0xd847('0x26')](_0xd847('0x4d'),_0x1b3e44);throw _0x1b3e44;});}return _0x455f9b;})[_0xd847('0x22')](respondWithResult(_0x56f7f6,0xc9))[_0xd847('0x45')](handleError(_0x56f7f6,null));};exports[_0xd847('0x21')]=function(_0x507a7f,_0xf82600){if(_0x507a7f[_0xd847('0x47')]['id']){delete _0x507a7f['body']['id'];}return db[_0xd847('0x2c')][_0xd847('0x44')]({'where':{'id':_0x507a7f['params']['id']}})[_0xd847('0x22')](handleEntityNotFound(_0xf82600,null))[_0xd847('0x22')](saveUpdates(_0x507a7f[_0xd847('0x47')],null))['then'](respondWithResult(_0xf82600,null))[_0xd847('0x45')](handleError(_0xf82600,null));};exports['destroy']=function(_0x49c336,_0x3cab30){return db[_0xd847('0x2c')][_0xd847('0x44')]({'where':{'id':_0x49c336[_0xd847('0x4e')]['id']}})[_0xd847('0x22')](handleEntityNotFound(_0x3cab30,null))['then'](removeEntity(_0x3cab30,null))['catch'](handleError(_0x3cab30,null));};exports[_0xd847('0x4f')]=function(_0x1b74f0,_0x3d1d11){return db[_0xd847('0x2c')][_0xd847('0x4f')]()[_0xd847('0x22')](respondWithResult(_0x3d1d11,null))[_0xd847('0x45')](handleError(_0x3d1d11,null));}; \ No newline at end of file +var _0x9c50=['Tag','rawAttributes','type','model','query','keys','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','filter','merge','options','includeAll','findAll','catch','show','params','intersection','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','describe','fast-json-patch','moment','util','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','end','offset','undefined','limit','count','status','set','Content-Range','apply','then','destroy','get','Tags','sendStatus','stack','name','map'];(function(_0x19a49f,_0x444d74){var _0x5351ae=function(_0x58b1ed){while(--_0x58b1ed){_0x19a49f['push'](_0x19a49f['shift']());}};_0x5351ae(++_0x444d74);}(_0x9c50,0xec));var _0x09c5=function(_0x8fca14,_0x47c0f9){_0x8fca14=_0x8fca14-0x0;var _0x3656e0=_0x9c50[_0x8fca14];return _0x3656e0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x09c5('0x0'));var rp=require('request-promise');var moment=require(_0x09c5('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x09c5('0x2'));var path=require(_0x09c5('0x3'));var sox=require('sox');var csv=require(_0x09c5('0x4'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x09c5('0x5'));var _=require(_0x09c5('0x6'));var squel=require(_0x09c5('0x7'));var crypto=require('crypto');var jsforce=require(_0x09c5('0x8'));var deskjs=require(_0x09c5('0x9'));var toCsv=require(_0x09c5('0x4'));var querystring=require(_0x09c5('0xa'));var Papa=require('papaparse');var Redis=require(_0x09c5('0xb'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x09c5('0xc'));var hardwareService=require(_0x09c5('0xd'));var logger=require(_0x09c5('0xe'))(_0x09c5('0xf'));var utils=require('../../config/utils');var config=require(_0x09c5('0x10'));var licenseUtil=require(_0x09c5('0x11'));var db=require(_0x09c5('0x12'))['db'];function respondWithStatusCode(_0x249d1f,_0x25ed17){_0x25ed17=_0x25ed17||0xcc;return function(_0x3e4eba){if(_0x3e4eba){return _0x249d1f['sendStatus'](_0x25ed17);}return _0x249d1f['status'](_0x25ed17)[_0x09c5('0x13')]();};}function respondWithResult(_0x216624,_0x3900cc){_0x3900cc=_0x3900cc||0xc8;return function(_0x380922){if(_0x380922){return _0x216624['status'](_0x3900cc)['json'](_0x380922);}};}function respondWithFilteredResult(_0x46e6e9,_0x4d6342){return function(_0x4dad31){if(_0x4dad31){var _0x5cb726=typeof _0x4d6342[_0x09c5('0x14')]===_0x09c5('0x15')&&typeof _0x4d6342[_0x09c5('0x16')]===_0x09c5('0x15');var _0x2891fb=_0x4dad31[_0x09c5('0x17')];var _0x1040b1=_0x5cb726?0x0:_0x4d6342[_0x09c5('0x14')];var _0x38e59e=_0x5cb726?_0x4dad31[_0x09c5('0x17')]:_0x4d6342['offset']+_0x4d6342[_0x09c5('0x16')];var _0x3e6f5f;if(_0x38e59e>=_0x2891fb){_0x38e59e=_0x2891fb;_0x3e6f5f=0xc8;}else{_0x3e6f5f=0xce;}_0x46e6e9[_0x09c5('0x18')](_0x3e6f5f);return _0x46e6e9[_0x09c5('0x19')](_0x09c5('0x1a'),_0x1040b1+'-'+_0x38e59e+'/'+_0x2891fb)['json'](_0x4dad31);}return null;};}function patchUpdates(_0x4648fc){return function(_0x39fb75){try{jsonpatch[_0x09c5('0x1b')](_0x39fb75,_0x4648fc,!![]);}catch(_0x159c94){return BPromise['reject'](_0x159c94);}return _0x39fb75['save']();};}function saveUpdates(_0x37da46,_0x3383bb){return function(_0x32fe62){if(_0x32fe62){return _0x32fe62['update'](_0x37da46)[_0x09c5('0x1c')](function(_0xa687ac){return _0xa687ac;});}return null;};}function removeEntity(_0x48e2ef,_0x365e6d){return function(_0x5cdc52){if(_0x5cdc52){return _0x5cdc52[_0x09c5('0x1d')]()['then'](function(){var _0x476a72=_0x5cdc52[_0x09c5('0x1e')]({'plain':!![]});var _0x356001=_0x09c5('0x1f');return db['UserProfileResource'][_0x09c5('0x1d')]({'where':{'type':_0x356001,'resourceId':_0x476a72['id']}})[_0x09c5('0x1c')](function(){return _0x5cdc52;});})[_0x09c5('0x1c')](function(){_0x48e2ef['status'](0xcc)[_0x09c5('0x13')]();});}};}function handleEntityNotFound(_0x2d3f1f,_0x3aa452){return function(_0x416881){if(!_0x416881){_0x2d3f1f[_0x09c5('0x20')](0x194);}return _0x416881;};}function handleError(_0x406f32,_0x159652){_0x159652=_0x159652||0x1f4;return function(_0x53e126){logger['error'](_0x53e126[_0x09c5('0x21')]);if(_0x53e126['name']){delete _0x53e126[_0x09c5('0x22')];}_0x406f32[_0x09c5('0x18')](_0x159652)['send'](_0x53e126);};}exports['index']=function(_0x2ca501,_0x52ef10){var _0x33ab28={},_0x172fc0={},_0x3c67ba={'count':0x0,'rows':[]};var _0x52904f=_[_0x09c5('0x23')](db[_0x09c5('0x24')][_0x09c5('0x25')],function(_0x592259){return{'name':_0x592259['fieldName'],'type':_0x592259[_0x09c5('0x26')]['key']};});_0x172fc0[_0x09c5('0x27')]=_[_0x09c5('0x23')](_0x52904f,_0x09c5('0x22'));_0x172fc0[_0x09c5('0x28')]=_[_0x09c5('0x29')](_0x2ca501[_0x09c5('0x28')]);_0x172fc0['filters']=_['intersection'](_0x172fc0[_0x09c5('0x27')],_0x172fc0[_0x09c5('0x28')]);_0x33ab28[_0x09c5('0x2a')]=_['intersection'](_0x172fc0[_0x09c5('0x27')],qs[_0x09c5('0x2b')](_0x2ca501[_0x09c5('0x28')][_0x09c5('0x2b')]));_0x33ab28[_0x09c5('0x2a')]=_0x33ab28[_0x09c5('0x2a')][_0x09c5('0x2c')]?_0x33ab28[_0x09c5('0x2a')]:_0x172fc0[_0x09c5('0x27')];if(!_0x2ca501[_0x09c5('0x28')][_0x09c5('0x2d')]('nolimit')){_0x33ab28[_0x09c5('0x16')]=qs[_0x09c5('0x16')](_0x2ca501[_0x09c5('0x28')][_0x09c5('0x16')]);_0x33ab28['offset']=qs[_0x09c5('0x14')](_0x2ca501[_0x09c5('0x28')][_0x09c5('0x14')]);}_0x33ab28['order']=qs[_0x09c5('0x2e')](_0x2ca501[_0x09c5('0x28')][_0x09c5('0x2e')]);_0x33ab28[_0x09c5('0x2f')]=qs[_0x09c5('0x30')](_[_0x09c5('0x31')](_0x2ca501[_0x09c5('0x28')],_0x172fc0[_0x09c5('0x30')]),_0x52904f);if(_0x2ca501['query'][_0x09c5('0x32')]){_0x33ab28[_0x09c5('0x2f')]=_[_0x09c5('0x33')](_0x33ab28[_0x09c5('0x2f')],{'$or':_['map'](_0x52904f,function(_0x3fbcec){if(_0x3fbcec['type']!=='VIRTUAL'){var _0x1835d5={};_0x1835d5[_0x3fbcec[_0x09c5('0x22')]]={'$like':'%'+_0x2ca501['query'][_0x09c5('0x32')]+'%'};return _0x1835d5;}})});}_0x33ab28=_[_0x09c5('0x33')]({},_0x33ab28,_0x2ca501[_0x09c5('0x34')]);var _0x4c98e6={'where':_0x33ab28[_0x09c5('0x2f')]};return db[_0x09c5('0x24')][_0x09c5('0x17')](_0x4c98e6)[_0x09c5('0x1c')](function(_0x126404){_0x3c67ba[_0x09c5('0x17')]=_0x126404;if(_0x2ca501['query'][_0x09c5('0x35')]){_0x33ab28['include']=[{'all':!![]}];}return db[_0x09c5('0x24')][_0x09c5('0x36')](_0x33ab28);})[_0x09c5('0x1c')](function(_0x3f76d6){_0x3c67ba['rows']=_0x3f76d6;return _0x3c67ba;})[_0x09c5('0x1c')](respondWithFilteredResult(_0x52ef10,_0x33ab28))[_0x09c5('0x37')](handleError(_0x52ef10,null));};exports[_0x09c5('0x38')]=function(_0x5a391b,_0x159936){var _0xf525a4={'raw':!![],'where':{'id':_0x5a391b[_0x09c5('0x39')]['id']}},_0x4a27be={};_0x4a27be[_0x09c5('0x27')]=_[_0x09c5('0x29')](db[_0x09c5('0x24')]['rawAttributes']);_0x4a27be[_0x09c5('0x28')]=_['keys'](_0x5a391b[_0x09c5('0x28')]);_0x4a27be[_0x09c5('0x30')]=_[_0x09c5('0x3a')](_0x4a27be['model'],_0x4a27be[_0x09c5('0x28')]);_0xf525a4[_0x09c5('0x2a')]=_[_0x09c5('0x3a')](_0x4a27be[_0x09c5('0x27')],qs[_0x09c5('0x2b')](_0x5a391b['query'][_0x09c5('0x2b')]));_0xf525a4[_0x09c5('0x2a')]=_0xf525a4[_0x09c5('0x2a')][_0x09c5('0x2c')]?_0xf525a4[_0x09c5('0x2a')]:_0x4a27be[_0x09c5('0x27')];if(_0x5a391b[_0x09c5('0x28')][_0x09c5('0x35')]){_0xf525a4['include']=[{'all':!![]}];}_0xf525a4=_[_0x09c5('0x33')]({},_0xf525a4,_0x5a391b[_0x09c5('0x34')]);return db['Tag'][_0x09c5('0x3b')](_0xf525a4)[_0x09c5('0x1c')](handleEntityNotFound(_0x159936,null))[_0x09c5('0x1c')](respondWithResult(_0x159936,null))[_0x09c5('0x37')](handleError(_0x159936,null));};exports['create']=function(_0x377634,_0x271ddb){return db['Tag'][_0x09c5('0x3c')](_0x377634[_0x09c5('0x3d')],{})[_0x09c5('0x1c')](function(_0x1fabf4){var _0x4880ab=_0x377634[_0x09c5('0x3e')]['get']({'plain':!![]});if(!_0x4880ab)throw new Error(_0x09c5('0x3f'));if(_0x4880ab[_0x09c5('0x40')]===_0x09c5('0x3e')){var _0x8a376c=_0x1fabf4[_0x09c5('0x1e')]({'plain':!![]});var _0x3a7554=_0x09c5('0x1f');return db['UserProfileSection'][_0x09c5('0x3b')]({'where':{'name':_0x3a7554,'userProfileId':_0x4880ab[_0x09c5('0x41')]},'raw':!![]})[_0x09c5('0x1c')](function(_0x3034cb){if(_0x3034cb&&_0x3034cb[_0x09c5('0x42')]===0x0){return db['UserProfileResource'][_0x09c5('0x3c')]({'name':_0x8a376c[_0x09c5('0x22')],'resourceId':_0x8a376c['id'],'type':_0x3034cb[_0x09c5('0x22')],'sectionId':_0x3034cb['id']},{})[_0x09c5('0x1c')](function(){return _0x1fabf4;});}else{return _0x1fabf4;}})['catch'](function(_0x12c295){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x12c295);throw _0x12c295;});}return _0x1fabf4;})[_0x09c5('0x1c')](respondWithResult(_0x271ddb,0xc9))[_0x09c5('0x37')](handleError(_0x271ddb,null));};exports['update']=function(_0x30e321,_0x3d5ab1){if(_0x30e321[_0x09c5('0x3d')]['id']){delete _0x30e321['body']['id'];}return db['Tag'][_0x09c5('0x3b')]({'where':{'id':_0x30e321[_0x09c5('0x39')]['id']}})[_0x09c5('0x1c')](handleEntityNotFound(_0x3d5ab1,null))[_0x09c5('0x1c')](saveUpdates(_0x30e321[_0x09c5('0x3d')],null))[_0x09c5('0x1c')](respondWithResult(_0x3d5ab1,null))[_0x09c5('0x37')](handleError(_0x3d5ab1,null));};exports[_0x09c5('0x1d')]=function(_0x3b0484,_0x5b16fa){return db['Tag'][_0x09c5('0x3b')]({'where':{'id':_0x3b0484[_0x09c5('0x39')]['id']}})[_0x09c5('0x1c')](handleEntityNotFound(_0x5b16fa,null))[_0x09c5('0x1c')](removeEntity(_0x5b16fa,null))[_0x09c5('0x37')](handleError(_0x5b16fa,null));};exports[_0x09c5('0x43')]=function(_0x25fc64,_0x2beb88){return db[_0x09c5('0x24')]['describe']()[_0x09c5('0x1c')](respondWithResult(_0x2beb88,null))[_0x09c5('0x37')](handleError(_0x2beb88,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 9d0294b..ea1e48d 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 _0xf03c=['Tag','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./tag.attributes','exports','define'];(function(_0x14a866,_0x2615de){var _0x4d3401=function(_0x4f0069){while(--_0x4f0069){_0x14a866['push'](_0x14a866['shift']());}};_0x4d3401(++_0x2615de);}(_0xf03c,0x199));var _0xcf03=function(_0x40f800,_0x26c66e){_0x40f800=_0x40f800-0x0;var _0x3b3685=_0xf03c[_0x40f800];return _0x3b3685;};'use strict';var _=require(_0xcf03('0x0'));var util=require(_0xcf03('0x1'));var logger=require(_0xcf03('0x2'))('api');var moment=require(_0xcf03('0x3'));var BPromise=require(_0xcf03('0x4'));var rp=require(_0xcf03('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcf03('0x6'));var config=require(_0xcf03('0x7'));var attributes=require(_0xcf03('0x8'));module[_0xcf03('0x9')]=function(_0x367a9a,_0x46348d){return _0x367a9a[_0xcf03('0xa')](_0xcf03('0xb'),attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0d00=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./tag.attributes','define','tools_tags','lodash','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0d00,0x189));var _0x00d0=function(_0xaf29da,_0x117f5a){_0xaf29da=_0xaf29da-0x0;var _0x295c51=_0x0d00[_0xaf29da];return _0x295c51;};'use strict';var _=require(_0x00d0('0x0'));var util=require(_0x00d0('0x1'));var logger=require(_0x00d0('0x2'))(_0x00d0('0x3'));var moment=require(_0x00d0('0x4'));var BPromise=require(_0x00d0('0x5'));var rp=require(_0x00d0('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x00d0('0x7'));var config=require(_0x00d0('0x8'));var attributes=require(_0x00d0('0x9'));module['exports']=function(_0x30ebde,_0x5fe624){return _0x30ebde[_0x00d0('0xa')]('Tag',attributes,{'tableName':_0x00d0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index 562050e..a79e017 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 _0x4c6d=['result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','Tag,\x20%s,\x20%s','debug','Tag,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0x546e49,_0x349453){var _0x47e655=function(_0x27fbbd){while(--_0x27fbbd){_0x546e49['push'](_0x546e49['shift']());}};_0x47e655(++_0x349453);}(_0x4c6d,0x1d0));var _0xd4c6=function(_0x33afe7,_0x1d96a9){_0x33afe7=_0x33afe7-0x0;var _0x50ad5f=_0x4c6d[_0x33afe7];return _0x50ad5f;};'use strict';var _=require(_0xd4c6('0x0'));var util=require(_0xd4c6('0x1'));var moment=require(_0xd4c6('0x2'));var BPromise=require(_0xd4c6('0x3'));var rs=require(_0xd4c6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd4c6('0x5'))['db'];var utils=require(_0xd4c6('0x6'));var logger=require(_0xd4c6('0x7'))('rpc');var config=require(_0xd4c6('0x8'));var jayson=require(_0xd4c6('0x9'));var client=jayson['client'][_0xd4c6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x316314,_0x4329e3,_0x5d4fce){return new BPromise(function(_0x440ee3,_0x19ce1c){return client[_0xd4c6('0xb')](_0x316314,_0x5d4fce)['then'](function(_0xe2f90b){logger[_0xd4c6('0xc')](_0xd4c6('0xd'),_0x4329e3,'request\x20sent');logger[_0xd4c6('0xe')](_0xd4c6('0xf'),_0x4329e3,_0xd4c6('0x10'),JSON[_0xd4c6('0x11')](_0xe2f90b));if(_0xe2f90b[_0xd4c6('0x12')]){if(_0xe2f90b[_0xd4c6('0x12')]['code']===0x1f4){logger['error'](_0xd4c6('0xd'),_0x4329e3,_0xe2f90b['error'][_0xd4c6('0x13')]);return _0x19ce1c(_0xe2f90b[_0xd4c6('0x12')][_0xd4c6('0x13')]);}logger[_0xd4c6('0x12')](_0xd4c6('0xd'),_0x4329e3,_0xe2f90b[_0xd4c6('0x12')][_0xd4c6('0x13')]);return _0x440ee3(_0xe2f90b['error']['message']);}else{logger[_0xd4c6('0xc')](_0xd4c6('0xd'),_0x4329e3,_0xd4c6('0x10'));_0x440ee3(_0xe2f90b[_0xd4c6('0x14')][_0xd4c6('0x13')]);}})[_0xd4c6('0x15')](function(_0xe52075){logger['error'](_0xd4c6('0xd'),_0x4329e3,_0xe52075);_0x19ce1c(_0xe52075);});});} \ No newline at end of file +var _0xe107=['then','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','error','code','message','info','lodash','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise'];(function(_0x1636eb,_0x3098af){var _0x1bb4f4=function(_0x5ddc29){while(--_0x5ddc29){_0x1636eb['push'](_0x1636eb['shift']());}};_0x1bb4f4(++_0x3098af);}(_0xe107,0xb3));var _0x7e10=function(_0x295bce,_0x225c90){_0x295bce=_0x295bce-0x0;var _0x5c3f99=_0xe107[_0x295bce];return _0x5c3f99;};'use strict';var _=require(_0x7e10('0x0'));var util=require('util');var moment=require(_0x7e10('0x1'));var BPromise=require(_0x7e10('0x2'));var rs=require(_0x7e10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7e10('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7e10('0x5'));var config=require(_0x7e10('0x6'));var jayson=require(_0x7e10('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1dd3de,_0x7378b3,_0x156c56){return new BPromise(function(_0x3413f7,_0x493958){return client['request'](_0x1dd3de,_0x156c56)[_0x7e10('0x8')](function(_0x490a7a){logger['info'](_0x7e10('0x9'),_0x7378b3,_0x7e10('0xa'));logger[_0x7e10('0xb')](_0x7e10('0xc'),_0x7378b3,_0x7e10('0xa'),JSON['stringify'](_0x490a7a));if(_0x490a7a[_0x7e10('0xd')]){if(_0x490a7a['error'][_0x7e10('0xe')]===0x1f4){logger[_0x7e10('0xd')](_0x7e10('0x9'),_0x7378b3,_0x490a7a['error'][_0x7e10('0xf')]);return _0x493958(_0x490a7a[_0x7e10('0xd')][_0x7e10('0xf')]);}logger[_0x7e10('0xd')](_0x7e10('0x9'),_0x7378b3,_0x490a7a[_0x7e10('0xd')][_0x7e10('0xf')]);return _0x3413f7(_0x490a7a[_0x7e10('0xd')]['message']);}else{logger[_0x7e10('0x10')](_0x7e10('0x9'),_0x7378b3,'request\x20sent');_0x3413f7(_0x490a7a['result'][_0x7e10('0xf')]);}})['catch'](function(_0xe1abd2){logger[_0x7e10('0xd')](_0x7e10('0x9'),_0x7378b3,_0xe1abd2);_0x493958(_0xe1abd2);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 82db054..080fbd5 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(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'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(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index cf8bcc1..4ef94c1 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 _0xe706=['STRING','sequelize','exports'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xe706,0xa3));var _0x6e70=function(_0x275293,_0x31bf61){_0x275293=_0x275293-0x0;var _0x539b28=_0xe706[_0x275293];return _0x539b28;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'name':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x6e70('0x2')]}}; \ No newline at end of file +var _0x757a=['exports','STRING'];(function(_0xfabbed,_0x436c20){var _0x5857f1=function(_0x36ce8e){while(--_0x36ce8e){_0xfabbed['push'](_0xfabbed['shift']());}};_0x5857f1(++_0x436c20);}(_0x757a,0xde));var _0xa757=function(_0x2beef3,_0x5bd175){_0x2beef3=_0x2beef3-0x0;var _0x135114=_0x757a[_0x2beef3];return _0x135114;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index b161398..fca5e09 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 _0xab30=['register','sendStatus','status','end','json','undefined','limit','offset','apply','reject','update','then','error','stack','name','send','index','map','Team','type','key','model','query','filters','intersection','fields','attributes','nolimit','order','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','keys','length','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Teams','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','sequelize','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','SELECT','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','QueryTypes','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SmsQueueId','UserSmsQueue','destroy','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','TeamVoicePrefix','VoicePrefixId','getQueues','channel','isValidChannel','Unknown\x20channel','capitalize','toLowerCase','pick','addQueues','findOne','Queues','removeQueues','ValidationError','remove','addAgents','isArray','ids','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','transaction','Voice','through','penalty','QueueId','TeamVoiceQueue','User','Queue','Queue:save','online','voicePause','UserVoiceQueueRt','isNil','interface','format','SIP/%s','all','UserVoicePrefix','upsert','removeAgents','Queue:remove','getAgents','hasOwnProperty','eml-format','rimraf','zip-dir','request-promise','moment','mustache','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','../../mysqldb','redis','defaults','localhost','socket.io-emitter'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xab30,0x1b7));var _0x0ab3=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xab30[_0x40a045];return _0x1a687c;};'use strict';var emlformat=require(_0x0ab3('0x0'));var rimraf=require(_0x0ab3('0x1'));var zipdir=require(_0x0ab3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0ab3('0x3'));var moment=require(_0x0ab3('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0ab3('0x5'));var util=require('util');var path=require('path');var sox=require(_0x0ab3('0x6'));var csv=require(_0x0ab3('0x7'));var ejs=require(_0x0ab3('0x8'));var fs=require('fs');var fs_extra=require(_0x0ab3('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x0ab3('0xa'));var jsforce=require(_0x0ab3('0xb'));var deskjs=require(_0x0ab3('0xc'));var toCsv=require(_0x0ab3('0x7'));var querystring=require(_0x0ab3('0xd'));var Papa=require(_0x0ab3('0xe'));var Redis=require(_0x0ab3('0xf'));var authService=require(_0x0ab3('0x10'));var qs=require(_0x0ab3('0x11'));var as=require(_0x0ab3('0x12'));var hardwareService=require(_0x0ab3('0x13'));var logger=require(_0x0ab3('0x14'))(_0x0ab3('0x15'));var utils=require(_0x0ab3('0x16'));var config=require(_0x0ab3('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x0ab3('0x18'))['db'];config[_0x0ab3('0x19')]=_[_0x0ab3('0x1a')](config[_0x0ab3('0x19')],{'host':_0x0ab3('0x1b'),'port':0x18eb});var socket=require(_0x0ab3('0x1c'))(new Redis(config[_0x0ab3('0x19')]));require('./team.socket')[_0x0ab3('0x1d')](socket);function respondWithStatusCode(_0x2b8a6d,_0x541c1c){_0x541c1c=_0x541c1c||0xcc;return function(_0x35c41f){if(_0x35c41f){return _0x2b8a6d[_0x0ab3('0x1e')](_0x541c1c);}return _0x2b8a6d[_0x0ab3('0x1f')](_0x541c1c)[_0x0ab3('0x20')]();};}function respondWithResult(_0x177e51,_0x47caeb){_0x47caeb=_0x47caeb||0xc8;return function(_0x5c2a30){if(_0x5c2a30){return _0x177e51['status'](_0x47caeb)[_0x0ab3('0x21')](_0x5c2a30);}};}function respondWithFilteredResult(_0x1a7fe0,_0x40bfae){return function(_0x54dece){if(_0x54dece){var _0x36145f=typeof _0x40bfae['offset']===_0x0ab3('0x22')&&typeof _0x40bfae[_0x0ab3('0x23')]==='undefined';var _0x4fc9ff=_0x54dece['count'];var _0x1c2aa5=_0x36145f?0x0:_0x40bfae[_0x0ab3('0x24')];var _0x12f2d1=_0x36145f?_0x54dece['count']:_0x40bfae[_0x0ab3('0x24')]+_0x40bfae['limit'];var _0x40769d;if(_0x12f2d1>=_0x4fc9ff){_0x12f2d1=_0x4fc9ff;_0x40769d=0xc8;}else{_0x40769d=0xce;}_0x1a7fe0[_0x0ab3('0x1f')](_0x40769d);return _0x1a7fe0['set']('Content-Range',_0x1c2aa5+'-'+_0x12f2d1+'/'+_0x4fc9ff)[_0x0ab3('0x21')](_0x54dece);}return null;};}function patchUpdates(_0x3cb6ea){return function(_0x140254){try{jsonpatch[_0x0ab3('0x25')](_0x140254,_0x3cb6ea,!![]);}catch(_0x35b186){return BPromise[_0x0ab3('0x26')](_0x35b186);}return _0x140254['save']();};}function saveUpdates(_0x3e4bbe,_0x6fe744){return function(_0x29a2ef){if(_0x29a2ef){return _0x29a2ef[_0x0ab3('0x27')](_0x3e4bbe)[_0x0ab3('0x28')](function(_0x4816fd){return _0x4816fd;});}return null;};}function handleEntityNotFound(_0x52cd3c,_0x1059a3){return function(_0x14deb8){if(!_0x14deb8){_0x52cd3c[_0x0ab3('0x1e')](0x194);}return _0x14deb8;};}function handleError(_0x1a03de,_0x3c856a){_0x3c856a=_0x3c856a||0x1f4;return function(_0x904a15){logger[_0x0ab3('0x29')](_0x904a15[_0x0ab3('0x2a')]);if(_0x904a15['name']){delete _0x904a15[_0x0ab3('0x2b')];}_0x1a03de[_0x0ab3('0x1f')](_0x3c856a)[_0x0ab3('0x2c')](_0x904a15);};}exports[_0x0ab3('0x2d')]=function(_0x1fb8ef,_0x5691ad){var _0x1c49d9={},_0x3dd308={},_0x4c876e={'count':0x0,'rows':[]};var _0xfb7958=_[_0x0ab3('0x2e')](db[_0x0ab3('0x2f')]['rawAttributes'],function(_0x2e92bc){return{'name':_0x2e92bc['fieldName'],'type':_0x2e92bc[_0x0ab3('0x30')][_0x0ab3('0x31')]};});_0x3dd308[_0x0ab3('0x32')]=_['map'](_0xfb7958,_0x0ab3('0x2b'));_0x3dd308[_0x0ab3('0x33')]=_['keys'](_0x1fb8ef[_0x0ab3('0x33')]);_0x3dd308[_0x0ab3('0x34')]=_[_0x0ab3('0x35')](_0x3dd308[_0x0ab3('0x32')],_0x3dd308[_0x0ab3('0x33')]);_0x1c49d9['attributes']=_[_0x0ab3('0x35')](_0x3dd308[_0x0ab3('0x32')],qs[_0x0ab3('0x36')](_0x1fb8ef[_0x0ab3('0x33')]['fields']));_0x1c49d9[_0x0ab3('0x37')]=_0x1c49d9[_0x0ab3('0x37')]['length']?_0x1c49d9[_0x0ab3('0x37')]:_0x3dd308[_0x0ab3('0x32')];if(!_0x1fb8ef[_0x0ab3('0x33')]['hasOwnProperty'](_0x0ab3('0x38'))){_0x1c49d9[_0x0ab3('0x23')]=qs[_0x0ab3('0x23')](_0x1fb8ef['query']['limit']);_0x1c49d9['offset']=qs[_0x0ab3('0x24')](_0x1fb8ef['query'][_0x0ab3('0x24')]);}_0x1c49d9[_0x0ab3('0x39')]=qs[_0x0ab3('0x3a')](_0x1fb8ef['query'][_0x0ab3('0x3a')]);_0x1c49d9[_0x0ab3('0x3b')]=qs[_0x0ab3('0x34')](_['pick'](_0x1fb8ef[_0x0ab3('0x33')],_0x3dd308[_0x0ab3('0x34')]),_0xfb7958);if(_0x1fb8ef['query'][_0x0ab3('0x3c')]){_0x1c49d9[_0x0ab3('0x3b')]=_[_0x0ab3('0x3d')](_0x1c49d9[_0x0ab3('0x3b')],{'$or':_[_0x0ab3('0x2e')](_0xfb7958,function(_0x144ca4){if(_0x144ca4[_0x0ab3('0x30')]!==_0x0ab3('0x3e')){var _0x4fc7a6={};_0x4fc7a6[_0x144ca4[_0x0ab3('0x2b')]]={'$like':'%'+_0x1fb8ef['query'][_0x0ab3('0x3c')]+'%'};return _0x4fc7a6;}})});}_0x1c49d9=_[_0x0ab3('0x3d')]({},_0x1c49d9,_0x1fb8ef[_0x0ab3('0x3f')]);var _0x492fd2={'where':_0x1c49d9[_0x0ab3('0x3b')]};return db[_0x0ab3('0x2f')][_0x0ab3('0x40')](_0x492fd2)['then'](function(_0xb1761c){_0x4c876e[_0x0ab3('0x40')]=_0xb1761c;if(_0x1fb8ef['query'][_0x0ab3('0x41')]){_0x1c49d9[_0x0ab3('0x42')]=[{'all':!![]}];}return db[_0x0ab3('0x2f')][_0x0ab3('0x43')](_0x1c49d9);})[_0x0ab3('0x28')](function(_0x7e93fd){_0x4c876e[_0x0ab3('0x44')]=_0x7e93fd;return _0x4c876e;})[_0x0ab3('0x28')](respondWithFilteredResult(_0x5691ad,_0x1c49d9))[_0x0ab3('0x45')](handleError(_0x5691ad,null));};exports[_0x0ab3('0x46')]=function(_0x3946d1,_0x4c08da){var _0x2eaf16={'raw':![],'where':{'id':_0x3946d1[_0x0ab3('0x47')]['id']}},_0xad55dc={};_0xad55dc['model']=_['keys'](db[_0x0ab3('0x2f')][_0x0ab3('0x48')]);_0xad55dc[_0x0ab3('0x33')]=_[_0x0ab3('0x49')](_0x3946d1['query']);_0xad55dc[_0x0ab3('0x34')]=_[_0x0ab3('0x35')](_0xad55dc[_0x0ab3('0x32')],_0xad55dc['query']);_0x2eaf16[_0x0ab3('0x37')]=_[_0x0ab3('0x35')](_0xad55dc[_0x0ab3('0x32')],qs['fields'](_0x3946d1['query'][_0x0ab3('0x36')]));_0x2eaf16['attributes']=_0x2eaf16[_0x0ab3('0x37')][_0x0ab3('0x4a')]?_0x2eaf16[_0x0ab3('0x37')]:_0xad55dc[_0x0ab3('0x32')];if(_0x3946d1[_0x0ab3('0x33')]['includeAll']){_0x2eaf16['include']=[{'all':!![]}];}_0x2eaf16=_[_0x0ab3('0x3d')]({},_0x2eaf16,_0x3946d1[_0x0ab3('0x3f')]);return db[_0x0ab3('0x2f')][_0x0ab3('0x4b')](_0x2eaf16)['then'](handleEntityNotFound(_0x4c08da,null))['then'](respondWithResult(_0x4c08da,null))[_0x0ab3('0x45')](handleError(_0x4c08da,null));};exports[_0x0ab3('0x4c')]=function(_0x1a8791,_0x197d8c){return db[_0x0ab3('0x2f')]['create'](_0x1a8791[_0x0ab3('0x4d')],{})[_0x0ab3('0x28')](function(_0x53db52){var _0x2fe675=_0x1a8791['user'][_0x0ab3('0x4e')]({'plain':!![]});if(!_0x2fe675)throw new Error(_0x0ab3('0x4f'));if(_0x2fe675[_0x0ab3('0x50')]===_0x0ab3('0x51')){var _0x19e27d=_0x53db52[_0x0ab3('0x4e')]({'plain':!![]});var _0x5970a2=_0x0ab3('0x52');return db['UserProfileSection']['find']({'where':{'name':_0x5970a2,'userProfileId':_0x2fe675[_0x0ab3('0x53')]},'raw':!![]})[_0x0ab3('0x28')](function(_0x10b7fd){if(_0x10b7fd&&_0x10b7fd[_0x0ab3('0x54')]===0x0){return db[_0x0ab3('0x55')][_0x0ab3('0x4c')]({'name':_0x19e27d['name'],'resourceId':_0x19e27d['id'],'type':_0x10b7fd[_0x0ab3('0x2b')],'sectionId':_0x10b7fd['id']},{})[_0x0ab3('0x28')](function(){return _0x53db52;});}else{return _0x53db52;}})[_0x0ab3('0x45')](function(_0xe6615d){logger['error'](_0x0ab3('0x56'),_0xe6615d);throw _0xe6615d;});}return _0x53db52;})[_0x0ab3('0x28')](respondWithResult(_0x197d8c,0xc9))['catch'](handleError(_0x197d8c,null));};exports[_0x0ab3('0x27')]=function(_0x3721d8,_0x37df2d){if(_0x3721d8[_0x0ab3('0x4d')]['id']){delete _0x3721d8[_0x0ab3('0x4d')]['id'];}return db['Team']['find']({'where':{'id':_0x3721d8[_0x0ab3('0x47')]['id']}})[_0x0ab3('0x28')](handleEntityNotFound(_0x37df2d,null))[_0x0ab3('0x28')](saveUpdates(_0x3721d8[_0x0ab3('0x4d')],null))['then'](respondWithResult(_0x37df2d,null))[_0x0ab3('0x45')](handleError(_0x37df2d,null));};exports['destroy']=function(_0x3d4c9c,_0x154efa){var _0x3b7d54=_0x3d4c9c[_0x0ab3('0x47')]['id'];var _0x5d31e9=[];return db[_0x0ab3('0x57')]['transaction'](function(_0x9693c1){var _0x56c7a4=_0x0ab3('0x58')+_0x3b7d54;return db[_0x0ab3('0x57')][_0x0ab3('0x33')](_0x56c7a4,{'type':db[_0x0ab3('0x59')]['QueryTypes'][_0x0ab3('0x5a')],'raw':!![],'transaction':_0x9693c1})[_0x0ab3('0x28')](function(_0x2fc6bb){_0x5d31e9=_['map'](_0x2fc6bb,function(_0x28fe12){return Number(_0x28fe12['UserId']);});})['then'](function(){var _0x178517=_0x0ab3('0x5b')+_0x3b7d54;return db['sequelize'][_0x0ab3('0x33')](_0x178517,{'type':db[_0x0ab3('0x59')][_0x0ab3('0x5c')][_0x0ab3('0x5a')],'raw':!![],'transaction':_0x9693c1});})['then'](function(_0x433f1c){var _0x4ef045=_[_0x0ab3('0x2e')](_0x433f1c,function(_0x5912b2){return Number(_0x5912b2['VoiceQueueId']);});return db['UserVoiceQueue']['destroy']({'where':{'UserId':{'$in':_0x5d31e9},'VoiceQueueId':{'$in':_0x4ef045}},'transaction':_0x9693c1});})[_0x0ab3('0x28')](function(){var _0x2c2586=_0x0ab3('0x5d')+_0x3b7d54;return db[_0x0ab3('0x57')][_0x0ab3('0x33')](_0x2c2586,{'type':db[_0x0ab3('0x59')][_0x0ab3('0x5c')]['SELECT'],'raw':!![],'transaction':_0x9693c1});})[_0x0ab3('0x28')](function(_0x4b1fee){var _0x92bd15=_['map'](_0x4b1fee,function(_0x3577a2){return Number(_0x3577a2[_0x0ab3('0x5e')]);});return db[_0x0ab3('0x5f')]['destroy']({'where':{'UserId':{'$in':_0x5d31e9},'MailQueueId':{'$in':_0x92bd15}},'transaction':_0x9693c1});})[_0x0ab3('0x28')](function(){var _0x1bbda3='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x3b7d54;return db['sequelize'][_0x0ab3('0x33')](_0x1bbda3,{'type':db['Sequelize'][_0x0ab3('0x5c')][_0x0ab3('0x5a')],'raw':!![],'transaction':_0x9693c1});})['then'](function(_0x4bf8bc){var _0xbb262d=_[_0x0ab3('0x2e')](_0x4bf8bc,function(_0x57588e){return Number(_0x57588e[_0x0ab3('0x60')]);});return db[_0x0ab3('0x61')][_0x0ab3('0x62')]({'where':{'UserId':{'$in':_0x5d31e9},'SmsQueueId':{'$in':_0xbb262d}},'transaction':_0x9693c1});})[_0x0ab3('0x28')](function(){var _0x2f1453=_0x0ab3('0x63')+_0x3b7d54;return db[_0x0ab3('0x57')][_0x0ab3('0x33')](_0x2f1453,{'type':db[_0x0ab3('0x59')]['QueryTypes'][_0x0ab3('0x5a')],'raw':!![],'transaction':_0x9693c1});})['then'](function(_0x3a027d){var _0xb3d6a6=_[_0x0ab3('0x2e')](_0x3a027d,function(_0x22786b){return Number(_0x22786b['ChatQueueId']);});return db[_0x0ab3('0x64')][_0x0ab3('0x62')]({'where':{'UserId':{'$in':_0x5d31e9},'ChatQueueId':{'$in':_0xb3d6a6}},'transaction':_0x9693c1});})[_0x0ab3('0x28')](function(){var _0x4c10f1=_0x0ab3('0x65')+_0x3b7d54;return db[_0x0ab3('0x57')][_0x0ab3('0x33')](_0x4c10f1,{'type':db[_0x0ab3('0x59')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x9693c1});})[_0x0ab3('0x28')](function(_0x2da9ab){var _0x13720a=_['map'](_0x2da9ab,function(_0x214272){return Number(_0x214272[_0x0ab3('0x66')]);});return db[_0x0ab3('0x67')][_0x0ab3('0x62')]({'where':{'UserId':{'$in':_0x5d31e9},'FaxQueueId':{'$in':_0x13720a}},'transaction':_0x9693c1});})[_0x0ab3('0x28')](function(){var _0x4d0170=_0x0ab3('0x68')+_0x3b7d54;return db[_0x0ab3('0x57')][_0x0ab3('0x33')](_0x4d0170,{'type':db['Sequelize'][_0x0ab3('0x5c')]['SELECT'],'raw':!![],'transaction':_0x9693c1});})[_0x0ab3('0x28')](function(_0x2ba4f5){var _0x1d43e7=_[_0x0ab3('0x2e')](_0x2ba4f5,function(_0x575392){return Number(_0x575392[_0x0ab3('0x69')]);});return db[_0x0ab3('0x6a')]['destroy']({'where':{'UserId':{'$in':_0x5d31e9},'OpenchannelQueueId':{'$in':_0x1d43e7}},'transaction':_0x9693c1});})['then'](function(){var _0x4170a0=_0x0ab3('0x6b')+_0x3b7d54;return db[_0x0ab3('0x57')][_0x0ab3('0x33')](_0x4170a0,{'type':db[_0x0ab3('0x59')][_0x0ab3('0x5c')][_0x0ab3('0x5a')],'raw':!![],'transaction':_0x9693c1});})[_0x0ab3('0x28')](function(_0x272889){var _0x2f92e0=_[_0x0ab3('0x2e')](_0x272889,function(_0x4569cb){return Number(_0x4569cb[_0x0ab3('0x6c')]);});return db['UserWhatsappQueue']['destroy']({'where':{'UserId':{'$in':_0x5d31e9},'WhatsappQueueId':{'$in':_0x2f92e0}},'transaction':_0x9693c1});})[_0x0ab3('0x28')](function(){return db[_0x0ab3('0x6d')]['find']({'where':{'TeamId':_0x3b7d54}});})[_0x0ab3('0x28')](function(_0x4e6591){if(_0x4e6591===null){return;}return db['UserVoicePrefix'][_0x0ab3('0x62')]({'where':{'UserId':{'$in':_0x5d31e9},'VoicePrefixId':_0x4e6591[_0x0ab3('0x6e')]},'transaction':_0x9693c1});})['then'](function(){return db[_0x0ab3('0x2f')][_0x0ab3('0x62')]({'where':{'id':_0x3b7d54},'cascade':!![],'transaction':_0x9693c1});})[_0x0ab3('0x28')](function(_0x43c45d){if(_0x43c45d===0x0){_0x154efa[_0x0ab3('0x1e')](0x194);}else{return db[_0x0ab3('0x55')][_0x0ab3('0x62')]({'where':{'type':'Teams','resourceId':_0x3b7d54},'cascade':!![],'transaction':_0x9693c1})[_0x0ab3('0x28')](function(){_0x154efa[_0x0ab3('0x1f')](0xcc)['end']();});}})[_0x0ab3('0x45')](function(_0x56dfba){_0x154efa[_0x0ab3('0x1f')](0x1f4)[_0x0ab3('0x2c')](_0x56dfba);});});};exports[_0x0ab3('0x6f')]=function(_0x39b0a0,_0x49081c,_0x848968){return db[_0x0ab3('0x2f')]['findOne']({'where':{'id':_0x39b0a0[_0x0ab3('0x47')]['id']}})['then'](handleEntityNotFound(_0x49081c,null))[_0x0ab3('0x28')](function(_0x57453b){if(!_0x39b0a0[_0x0ab3('0x33')][_0x0ab3('0x70')]||!utils[_0x0ab3('0x71')](_0x39b0a0['query'][_0x0ab3('0x70')])){throw new db[(_0x0ab3('0x59'))]['ValidationError'](_0x0ab3('0x72'));}var _0xb93f27={};var _0x2901a7={};_0x2901a7[_0x0ab3('0x32')]=_[_0x0ab3('0x49')](db[_[_0x0ab3('0x73')](_0x39b0a0['query']['channel'][_0x0ab3('0x74')]())+'Queue']['rawAttributes']);_0x2901a7['query']=_[_0x0ab3('0x49')](_0x39b0a0[_0x0ab3('0x33')]);_0x2901a7['filters']=_['intersection'](_0x2901a7[_0x0ab3('0x32')],_0x2901a7['query']);_0xb93f27[_0x0ab3('0x37')]=_[_0x0ab3('0x35')](_0x2901a7[_0x0ab3('0x32')],qs[_0x0ab3('0x36')](_0x39b0a0[_0x0ab3('0x33')]['fields']));_0xb93f27[_0x0ab3('0x37')]=_0xb93f27['attributes'][_0x0ab3('0x4a')]?_0xb93f27[_0x0ab3('0x37')]:_0x2901a7[_0x0ab3('0x32')];_0xb93f27[_0x0ab3('0x23')]=qs[_0x0ab3('0x23')](_0x39b0a0[_0x0ab3('0x33')][_0x0ab3('0x23')]);_0xb93f27[_0x0ab3('0x24')]=qs[_0x0ab3('0x24')](_0x39b0a0[_0x0ab3('0x33')][_0x0ab3('0x24')]);_0xb93f27[_0x0ab3('0x39')]=qs[_0x0ab3('0x3a')](_0x39b0a0[_0x0ab3('0x33')]['sort']);_0xb93f27['where']=qs[_0x0ab3('0x34')](_[_0x0ab3('0x75')](_0x39b0a0['query'],_0x2901a7['filters']));_0xb93f27=_[_0x0ab3('0x3d')]({},_0xb93f27,_0x39b0a0[_0x0ab3('0x3f')]);return _0x57453b[_0x0ab3('0x4e')+_[_0x0ab3('0x73')](_0x39b0a0[_0x0ab3('0x33')][_0x0ab3('0x70')][_0x0ab3('0x74')]())+'Queues'](_0xb93f27);})[_0x0ab3('0x28')](respondWithResult(_0x49081c,null))[_0x0ab3('0x45')](handleError(_0x49081c,null));};exports[_0x0ab3('0x76')]=function(_0x2d6984,_0x8b4c61,_0x4f61b0){return db['Team'][_0x0ab3('0x77')]({'where':{'id':_0x2d6984[_0x0ab3('0x47')]['id']}})[_0x0ab3('0x28')](function(_0x14150c){if(_0x14150c){if(!_0x2d6984[_0x0ab3('0x4d')][_0x0ab3('0x70')]||!utils[_0x0ab3('0x71')](_0x2d6984[_0x0ab3('0x4d')][_0x0ab3('0x70')])){throw new db[(_0x0ab3('0x59'))]['ValidationError']('Unknown\x20channel');}return _0x14150c['add'+_['capitalize'](_0x2d6984[_0x0ab3('0x4d')][_0x0ab3('0x70')][_0x0ab3('0x74')]())+_0x0ab3('0x78')](_0x2d6984[_0x0ab3('0x4d')]['ids']);}return null;})[_0x0ab3('0x28')](handleEntityNotFound(_0x8b4c61,null))[_0x0ab3('0x28')](respondWithStatusCode(_0x8b4c61,null))[_0x0ab3('0x45')](handleError(_0x8b4c61,null));};exports[_0x0ab3('0x79')]=function(_0x4b1907,_0x2a6948,_0x1c8740){return db[_0x0ab3('0x2f')][_0x0ab3('0x77')]({'where':{'id':_0x4b1907[_0x0ab3('0x47')]['id']}})[_0x0ab3('0x28')](function(_0x16944f){if(_0x16944f){if(!_0x4b1907[_0x0ab3('0x33')][_0x0ab3('0x70')]||!utils[_0x0ab3('0x71')](_0x4b1907[_0x0ab3('0x33')][_0x0ab3('0x70')])){throw new db[(_0x0ab3('0x59'))][(_0x0ab3('0x7a'))](_0x0ab3('0x72'));}return _0x16944f[_0x0ab3('0x7b')+_[_0x0ab3('0x73')](_0x4b1907[_0x0ab3('0x33')][_0x0ab3('0x70')][_0x0ab3('0x74')]())+'Queues'](_0x4b1907[_0x0ab3('0x33')]['ids']);}return null;})[_0x0ab3('0x28')](handleEntityNotFound(_0x2a6948,null))[_0x0ab3('0x28')](respondWithStatusCode(_0x2a6948,null))[_0x0ab3('0x45')](handleError(_0x2a6948,null));};exports[_0x0ab3('0x7c')]=function(_0x51b4e2,_0x27d224){var _0x59172f=_[_0x0ab3('0x7d')](_0x51b4e2[_0x0ab3('0x4d')][_0x0ab3('0x7e')])?_0x51b4e2[_0x0ab3('0x4d')][_0x0ab3('0x7e')]:[_0x51b4e2[_0x0ab3('0x4d')]['ids']];var _0x2b11e9=_0x51b4e2[_0x0ab3('0x47')]['id'];return db[_0x0ab3('0x2f')]['find']({'where':{'id':_0x2b11e9}})['then'](handleEntityNotFound(_0x27d224,null))['then'](function(_0x405cc0){if(_0x405cc0){var _0x1da661=['Voice',_0x0ab3('0x7f'),_0x0ab3('0x80'),_0x0ab3('0x81'),_0x0ab3('0x82'),_0x0ab3('0x83'),_0x0ab3('0x84')];return db[_0x0ab3('0x57')][_0x0ab3('0x85')](function(_0x25bd50){var _0x1ba0d2=_[_0x0ab3('0x2e')](_0x1da661,function(_0x2b4b70){var _0x384908={'attributes':['id','name']};if(_0x2b4b70===_0x0ab3('0x86')){_0x384908[_0x0ab3('0x87')]={'attributes':[_0x0ab3('0x88')]};}return _0x405cc0['get'+_0x2b4b70+_0x0ab3('0x78')](_0x384908)[_0x0ab3('0x28')](function(_0x1cecee){var _0x2f26ee=_[_0x0ab3('0x2e')](_0x1cecee,function(_0x47a782){var _0x2e9089=_['map'](_0x59172f,function(_0x5bb894){var _0x1c8901={'where':{'UserId':_0x5bb894,[_0x2b4b70+_0x0ab3('0x89')]:_0x47a782['id']},'transaction':_0x25bd50};if(_0x2b4b70===_0x0ab3('0x86')){_0x1c8901[_0x0ab3('0x1a')]={'penalty':_0x47a782[_0x0ab3('0x8a')]['penalty']};}return db[_0x0ab3('0x8b')+_0x2b4b70+_0x0ab3('0x8c')]['findOrCreate'](_0x1c8901)[_0x0ab3('0x28')](function(){socket['emit'](_0x0ab3('0x51')+_0x2b4b70+_0x0ab3('0x8d'),{'UserId':_0x5bb894,[_0x2b4b70+'QueueId']:_0x47a782['id']});if(_0x2b4b70!=='Voice'){return;}return db['User']['findAll']({'where':{'id':_0x59172f,'online':0x1},'attributes':['id',_0x0ab3('0x2b'),_0x0ab3('0x8e'),_0x0ab3('0x8f'),'interface'],'raw':!![]})['then'](function(_0x32e2b6){var _0x65ec39=_[_0x0ab3('0x2e')](_0x32e2b6,function(_0x3ed511){return db[_0x0ab3('0x90')]['upsert']({'membername':_0x3ed511[_0x0ab3('0x2b')],'UserId':_0x3ed511['id'],'queue_name':_0x47a782[_0x0ab3('0x2b')],'VoiceQueueId':_0x47a782['id'],'interface':_[_0x0ab3('0x91')](_0x3ed511[_0x0ab3('0x92')])?util[_0x0ab3('0x93')](_0x0ab3('0x94'),_0x3ed511[_0x0ab3('0x2b')]):_0x3ed511[_0x0ab3('0x92')],'paused':_0x3ed511[_0x0ab3('0x8f')]||![],'penalty':_0x47a782['TeamVoiceQueue']['penalty']},{'transaction':_0x25bd50});});return Promise[_0x0ab3('0x95')](_0x65ec39);});});});return Promise[_0x0ab3('0x95')](_0x2e9089);});return Promise[_0x0ab3('0x95')](_0x2f26ee);})[_0x0ab3('0x28')](function(){return db[_0x0ab3('0x6d')][_0x0ab3('0x77')]({'where':{'teamId':_0x2b11e9}})[_0x0ab3('0x28')](function(_0x3c860c){if(_0x3c860c){var _0x3ea9f1=_[_0x0ab3('0x2e')](_0x59172f,function(_0x356fb7){db[_0x0ab3('0x96')][_0x0ab3('0x97')]({'UserId':_0x356fb7,'VoicePrefixId':_0x3c860c[_0x0ab3('0x6e')]});});return Promise[_0x0ab3('0x95')](_0x3ea9f1);}});});});return Promise['all'](_0x1ba0d2)['then'](function(){return _0x405cc0[_0x0ab3('0x7c')](_0x59172f,{'transaction':_0x25bd50})['spread'](function(_0x554003){return _0x554003;});});});}})['then'](respondWithResult(_0x27d224,null))[_0x0ab3('0x45')](handleError(_0x27d224,null));};exports[_0x0ab3('0x98')]=function(_0x1e8f6f,_0x3073dc){var _0x57d02a=_[_0x0ab3('0x7d')](_0x1e8f6f['query'][_0x0ab3('0x7e')])?_0x1e8f6f[_0x0ab3('0x33')][_0x0ab3('0x7e')]:[_0x1e8f6f[_0x0ab3('0x33')][_0x0ab3('0x7e')]];var _0x3c8a5b=_0x1e8f6f[_0x0ab3('0x47')]['id'];return db[_0x0ab3('0x2f')][_0x0ab3('0x4b')]({'where':{'id':_0x3c8a5b}})[_0x0ab3('0x28')](handleEntityNotFound(_0x3073dc,null))['then'](function(_0x4080e7){if(_0x4080e7){var _0x2af2c3=['Voice',_0x0ab3('0x7f'),_0x0ab3('0x80'),_0x0ab3('0x81'),_0x0ab3('0x82'),'Openchannel',_0x0ab3('0x84')];return db['sequelize']['transaction'](function(_0x390f0a){var _0x498cdb=_['map'](_0x2af2c3,function(_0x24b56d){var _0x2d06f7={'attributes':['id','name']};return _0x4080e7[_0x0ab3('0x4e')+_0x24b56d+'Queues'](_0x2d06f7)[_0x0ab3('0x28')](function(_0x47af14){var _0x14a730=_[_0x0ab3('0x2e')](_0x47af14,function(_0x5f3f82){return _0x5f3f82[_0x0ab3('0x98')](_0x57d02a,{'transaction':_0x390f0a})[_0x0ab3('0x28')](function(){var _0x2ebb81=_[_0x0ab3('0x2e')](_0x57d02a,function(_0x54e8fb){socket['emit'](_0x0ab3('0x51')+_0x24b56d+_0x0ab3('0x99'),{'UserId':Number(_0x54e8fb),[_0x24b56d+_0x0ab3('0x89')]:_0x5f3f82['id']});if(_0x24b56d!==_0x0ab3('0x86')){return;}return db[_0x0ab3('0x90')]['destroy']({'where':{'VoiceQueueId':_0x5f3f82['id'],'UserId':_0x54e8fb},'transaction':_0x390f0a});});return Promise[_0x0ab3('0x95')](_0x2ebb81);});});return Promise[_0x0ab3('0x95')](_0x14a730);});});return Promise[_0x0ab3('0x95')](_0x498cdb)[_0x0ab3('0x28')](function(){return _0x4080e7[_0x0ab3('0x98')](_0x57d02a,{'transaction':_0x390f0a});})['then'](function(){return db[_0x0ab3('0x6d')][_0x0ab3('0x77')]({'where':{'teamId':_0x3c8a5b}})[_0x0ab3('0x28')](function(_0x402e7a){if(_0x402e7a){var _0x2535e4=_[_0x0ab3('0x2e')](_0x57d02a,function(_0x348ab7){db[_0x0ab3('0x96')][_0x0ab3('0x62')]({'where':{'UserId':_0x348ab7,'VoicePrefixId':_0x402e7a['VoicePrefixId']}});});return Promise['all'](_0x2535e4);}});});});}})[_0x0ab3('0x28')](respondWithStatusCode(_0x3073dc,null))['catch'](handleError(_0x3073dc,null));};exports[_0x0ab3('0x9a')]=function(_0x2eb986,_0x25d88b,_0x4ce857){var _0x18cbca={};var _0x227115={};var _0x12f9ab;var _0x3b829d;return db[_0x0ab3('0x2f')]['findOne']({'where':{'id':_0x2eb986['params']['id']}})[_0x0ab3('0x28')](handleEntityNotFound(_0x25d88b,null))[_0x0ab3('0x28')](function(_0x20f82e){if(_0x20f82e){_0x12f9ab=_0x20f82e;_0x227115[_0x0ab3('0x32')]=_[_0x0ab3('0x49')](db[_0x0ab3('0x8b')]['rawAttributes']);_0x227115[_0x0ab3('0x33')]=_[_0x0ab3('0x49')](_0x2eb986[_0x0ab3('0x33')]);_0x227115[_0x0ab3('0x34')]=_['intersection'](_0x227115['model'],_0x227115[_0x0ab3('0x33')]);_0x18cbca[_0x0ab3('0x37')]=_[_0x0ab3('0x35')](_0x227115[_0x0ab3('0x32')],qs['fields'](_0x2eb986['query'][_0x0ab3('0x36')]));_0x18cbca[_0x0ab3('0x37')]=_0x18cbca[_0x0ab3('0x37')]['length']?_0x18cbca[_0x0ab3('0x37')]:_0x227115[_0x0ab3('0x32')];_0x18cbca[_0x0ab3('0x39')]=qs[_0x0ab3('0x3a')](_0x2eb986[_0x0ab3('0x33')][_0x0ab3('0x3a')]);_0x18cbca[_0x0ab3('0x3b')]=qs[_0x0ab3('0x34')](_['pick'](_0x2eb986[_0x0ab3('0x33')],_0x227115[_0x0ab3('0x34')]));if(_0x2eb986[_0x0ab3('0x33')]['filter']){_0x18cbca[_0x0ab3('0x3b')]=_[_0x0ab3('0x3d')](_0x18cbca[_0x0ab3('0x3b')],{'$or':_[_0x0ab3('0x2e')](_0x18cbca[_0x0ab3('0x37')],function(_0x41caf0){var _0x13c0f0={};_0x13c0f0[_0x41caf0]={'$like':'%'+_0x2eb986[_0x0ab3('0x33')]['filter']+'%'};return _0x13c0f0;})});}_0x18cbca=_[_0x0ab3('0x3d')]({},_0x18cbca,_0x2eb986[_0x0ab3('0x3f')]);return _0x12f9ab[_0x0ab3('0x9a')](_0x18cbca);}})[_0x0ab3('0x28')](function(_0x539a75){if(_0x539a75){_0x3b829d=_0x539a75[_0x0ab3('0x4a')];if(!_0x2eb986['query'][_0x0ab3('0x9b')](_0x0ab3('0x38'))){_0x18cbca['limit']=qs[_0x0ab3('0x23')](_0x2eb986[_0x0ab3('0x33')][_0x0ab3('0x23')]);_0x18cbca[_0x0ab3('0x24')]=qs['offset'](_0x2eb986[_0x0ab3('0x33')][_0x0ab3('0x24')]);}return _0x12f9ab['getAgents'](_0x18cbca);}})[_0x0ab3('0x28')](function(_0x1c36cc){if(_0x1c36cc){return _0x1c36cc?{'count':_0x3b829d,'rows':_0x1c36cc}:null;}})[_0x0ab3('0x28')](respondWithResult(_0x25d88b,null))[_0x0ab3('0x45')](handleError(_0x25d88b,null));}; \ No newline at end of file +var _0xfc5d=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','sendStatus','error','name','send','index','map','Team','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','length','options','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','QueryTypes','VoiceQueueId','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','UserProfileResource','Teams','getQueues','findOne','isValidChannel','channel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','addQueues','Queues','ids','remove','addAgents','Voice','Chat','Mail','Fax','Openchannel','Whatsapp','through','QueueId','TeamVoiceQueue','penalty','User','findOrCreate','emit','Queue:save','online','voicePause','interface','upsert','format','SIP/%s','all','spread','removeAgents','isArray','Sms','Queue:remove','UserVoiceQueueRt','getAgents','pick','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis'];(function(_0x21aec3,_0x5c97e9){var _0x288bbc=function(_0x2283fe){while(--_0x2283fe){_0x21aec3['push'](_0x21aec3['shift']());}};_0x288bbc(++_0x5c97e9);}(_0xfc5d,0x8e));var _0xdfc5=function(_0x5576a8,_0xc20c2e){_0x5576a8=_0x5576a8-0x0;var _0x3dbfe8=_0xfc5d[_0x5576a8];return _0x3dbfe8;};'use strict';var emlformat=require(_0xdfc5('0x0'));var rimraf=require(_0xdfc5('0x1'));var zipdir=require(_0xdfc5('0x2'));var jsonpatch=require(_0xdfc5('0x3'));var rp=require(_0xdfc5('0x4'));var moment=require(_0xdfc5('0x5'));var BPromise=require(_0xdfc5('0x6'));var Mustache=require(_0xdfc5('0x7'));var util=require(_0xdfc5('0x8'));var path=require(_0xdfc5('0x9'));var sox=require('sox');var csv=require(_0xdfc5('0xa'));var ejs=require(_0xdfc5('0xb'));var fs=require('fs');var fs_extra=require(_0xdfc5('0xc'));var _=require(_0xdfc5('0xd'));var squel=require('squel');var crypto=require(_0xdfc5('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xdfc5('0xf'));var toCsv=require(_0xdfc5('0xa'));var querystring=require(_0xdfc5('0x10'));var Papa=require(_0xdfc5('0x11'));var Redis=require(_0xdfc5('0x12'));var authService=require(_0xdfc5('0x13'));var qs=require(_0xdfc5('0x14'));var as=require(_0xdfc5('0x15'));var hardwareService=require(_0xdfc5('0x16'));var logger=require(_0xdfc5('0x17'))('api');var utils=require(_0xdfc5('0x18'));var config=require(_0xdfc5('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xdfc5('0x1a'))['db'];config[_0xdfc5('0x1b')]=_[_0xdfc5('0x1c')](config['redis'],{'host':_0xdfc5('0x1d'),'port':0x18eb});var socket=require(_0xdfc5('0x1e'))(new Redis(config[_0xdfc5('0x1b')]));require(_0xdfc5('0x1f'))['register'](socket);function respondWithStatusCode(_0x5684a0,_0x17c951){_0x17c951=_0x17c951||0xcc;return function(_0x59cf5a){if(_0x59cf5a){return _0x5684a0['sendStatus'](_0x17c951);}return _0x5684a0[_0xdfc5('0x20')](_0x17c951)[_0xdfc5('0x21')]();};}function respondWithResult(_0x524ca2,_0x3af208){_0x3af208=_0x3af208||0xc8;return function(_0x533f7d){if(_0x533f7d){return _0x524ca2[_0xdfc5('0x20')](_0x3af208)[_0xdfc5('0x22')](_0x533f7d);}};}function respondWithFilteredResult(_0x5cb666,_0x5c60c6){return function(_0x46212f){if(_0x46212f){var _0xd4f67=typeof _0x5c60c6[_0xdfc5('0x23')]===_0xdfc5('0x24')&&typeof _0x5c60c6['limit']===_0xdfc5('0x24');var _0x3e7829=_0x46212f[_0xdfc5('0x25')];var _0x31955b=_0xd4f67?0x0:_0x5c60c6[_0xdfc5('0x23')];var _0x50b1fe=_0xd4f67?_0x46212f[_0xdfc5('0x25')]:_0x5c60c6[_0xdfc5('0x23')]+_0x5c60c6[_0xdfc5('0x26')];var _0x402fe7;if(_0x50b1fe>=_0x3e7829){_0x50b1fe=_0x3e7829;_0x402fe7=0xc8;}else{_0x402fe7=0xce;}_0x5cb666[_0xdfc5('0x20')](_0x402fe7);return _0x5cb666[_0xdfc5('0x27')](_0xdfc5('0x28'),_0x31955b+'-'+_0x50b1fe+'/'+_0x3e7829)[_0xdfc5('0x22')](_0x46212f);}return null;};}function patchUpdates(_0x5e72c6){return function(_0x5dcbde){try{jsonpatch[_0xdfc5('0x29')](_0x5dcbde,_0x5e72c6,!![]);}catch(_0x11a166){return BPromise[_0xdfc5('0x2a')](_0x11a166);}return _0x5dcbde['save']();};}function saveUpdates(_0x3edbb7,_0x1b3529){return function(_0x4f08fb){if(_0x4f08fb){return _0x4f08fb[_0xdfc5('0x2b')](_0x3edbb7)[_0xdfc5('0x2c')](function(_0x2460f5){return _0x2460f5;});}return null;};}function handleEntityNotFound(_0x5e515d,_0x1c3f3c){return function(_0x56ee28){if(!_0x56ee28){_0x5e515d[_0xdfc5('0x2d')](0x194);}return _0x56ee28;};}function handleError(_0x1ecc73,_0xea44e1){_0xea44e1=_0xea44e1||0x1f4;return function(_0x1e84d6){logger[_0xdfc5('0x2e')](_0x1e84d6['stack']);if(_0x1e84d6[_0xdfc5('0x2f')]){delete _0x1e84d6[_0xdfc5('0x2f')];}_0x1ecc73[_0xdfc5('0x20')](_0xea44e1)[_0xdfc5('0x30')](_0x1e84d6);};}exports[_0xdfc5('0x31')]=function(_0x57040f,_0x19405b){var _0x25fd14={},_0x1f3ec0={},_0x1b0328={'count':0x0,'rows':[]};var _0xd7dc7b=_[_0xdfc5('0x32')](db[_0xdfc5('0x33')][_0xdfc5('0x34')],function(_0x16c94d){return{'name':_0x16c94d['fieldName'],'type':_0x16c94d[_0xdfc5('0x35')]['key']};});_0x1f3ec0[_0xdfc5('0x36')]=_['map'](_0xd7dc7b,_0xdfc5('0x2f'));_0x1f3ec0[_0xdfc5('0x37')]=_[_0xdfc5('0x38')](_0x57040f[_0xdfc5('0x37')]);_0x1f3ec0[_0xdfc5('0x39')]=_[_0xdfc5('0x3a')](_0x1f3ec0[_0xdfc5('0x36')],_0x1f3ec0[_0xdfc5('0x37')]);_0x25fd14[_0xdfc5('0x3b')]=_[_0xdfc5('0x3a')](_0x1f3ec0[_0xdfc5('0x36')],qs[_0xdfc5('0x3c')](_0x57040f[_0xdfc5('0x37')][_0xdfc5('0x3c')]));_0x25fd14[_0xdfc5('0x3b')]=_0x25fd14[_0xdfc5('0x3b')]['length']?_0x25fd14[_0xdfc5('0x3b')]:_0x1f3ec0[_0xdfc5('0x36')];if(!_0x57040f[_0xdfc5('0x37')]['hasOwnProperty'](_0xdfc5('0x3d'))){_0x25fd14[_0xdfc5('0x26')]=qs['limit'](_0x57040f[_0xdfc5('0x37')][_0xdfc5('0x26')]);_0x25fd14[_0xdfc5('0x23')]=qs[_0xdfc5('0x23')](_0x57040f[_0xdfc5('0x37')][_0xdfc5('0x23')]);}_0x25fd14[_0xdfc5('0x3e')]=qs[_0xdfc5('0x3f')](_0x57040f['query']['sort']);_0x25fd14[_0xdfc5('0x40')]=qs[_0xdfc5('0x39')](_['pick'](_0x57040f['query'],_0x1f3ec0[_0xdfc5('0x39')]),_0xd7dc7b);if(_0x57040f['query'][_0xdfc5('0x41')]){_0x25fd14[_0xdfc5('0x40')]=_[_0xdfc5('0x42')](_0x25fd14['where'],{'$or':_[_0xdfc5('0x32')](_0xd7dc7b,function(_0x4ba4ca){if(_0x4ba4ca[_0xdfc5('0x35')]!==_0xdfc5('0x43')){var _0x380652={};_0x380652[_0x4ba4ca['name']]={'$like':'%'+_0x57040f['query'][_0xdfc5('0x41')]+'%'};return _0x380652;}})});}_0x25fd14=_[_0xdfc5('0x42')]({},_0x25fd14,_0x57040f['options']);var _0x731245={'where':_0x25fd14[_0xdfc5('0x40')]};return db[_0xdfc5('0x33')]['count'](_0x731245)['then'](function(_0x249f97){_0x1b0328[_0xdfc5('0x25')]=_0x249f97;if(_0x57040f[_0xdfc5('0x37')][_0xdfc5('0x44')]){_0x25fd14[_0xdfc5('0x45')]=[{'all':!![]}];}return db[_0xdfc5('0x33')][_0xdfc5('0x46')](_0x25fd14);})['then'](function(_0x49af08){_0x1b0328[_0xdfc5('0x47')]=_0x49af08;return _0x1b0328;})[_0xdfc5('0x2c')](respondWithFilteredResult(_0x19405b,_0x25fd14))[_0xdfc5('0x48')](handleError(_0x19405b,null));};exports['show']=function(_0x128890,_0x300e09){var _0x522af5={'raw':![],'where':{'id':_0x128890[_0xdfc5('0x49')]['id']}},_0x322c7c={};_0x322c7c[_0xdfc5('0x36')]=_['keys'](db[_0xdfc5('0x33')][_0xdfc5('0x34')]);_0x322c7c[_0xdfc5('0x37')]=_[_0xdfc5('0x38')](_0x128890['query']);_0x322c7c['filters']=_[_0xdfc5('0x3a')](_0x322c7c[_0xdfc5('0x36')],_0x322c7c[_0xdfc5('0x37')]);_0x522af5['attributes']=_['intersection'](_0x322c7c['model'],qs[_0xdfc5('0x3c')](_0x128890[_0xdfc5('0x37')]['fields']));_0x522af5[_0xdfc5('0x3b')]=_0x522af5[_0xdfc5('0x3b')][_0xdfc5('0x4a')]?_0x522af5[_0xdfc5('0x3b')]:_0x322c7c[_0xdfc5('0x36')];if(_0x128890[_0xdfc5('0x37')]['includeAll']){_0x522af5[_0xdfc5('0x45')]=[{'all':!![]}];}_0x522af5=_['merge']({},_0x522af5,_0x128890[_0xdfc5('0x4b')]);return db['Team'][_0xdfc5('0x4c')](_0x522af5)[_0xdfc5('0x2c')](handleEntityNotFound(_0x300e09,null))[_0xdfc5('0x2c')](respondWithResult(_0x300e09,null))[_0xdfc5('0x48')](handleError(_0x300e09,null));};exports['create']=function(_0x4050d6,_0x39ba52){return db[_0xdfc5('0x33')][_0xdfc5('0x4d')](_0x4050d6['body'],{})['then'](function(_0x4806a2){var _0x132304=_0x4050d6[_0xdfc5('0x4e')][_0xdfc5('0x4f')]({'plain':!![]});if(!_0x132304)throw new Error(_0xdfc5('0x50'));if(_0x132304[_0xdfc5('0x51')]==='user'){var _0x265501=_0x4806a2[_0xdfc5('0x4f')]({'plain':!![]});var _0x41fd91='Teams';return db[_0xdfc5('0x52')][_0xdfc5('0x4c')]({'where':{'name':_0x41fd91,'userProfileId':_0x132304['userProfileId']},'raw':!![]})['then'](function(_0x252a5e){if(_0x252a5e&&_0x252a5e[_0xdfc5('0x53')]===0x0){return db['UserProfileResource'][_0xdfc5('0x4d')]({'name':_0x265501[_0xdfc5('0x2f')],'resourceId':_0x265501['id'],'type':_0x252a5e[_0xdfc5('0x2f')],'sectionId':_0x252a5e['id']},{})[_0xdfc5('0x2c')](function(){return _0x4806a2;});}else{return _0x4806a2;}})[_0xdfc5('0x48')](function(_0x10b829){logger['error'](_0xdfc5('0x54'),_0x10b829);throw _0x10b829;});}return _0x4806a2;})[_0xdfc5('0x2c')](respondWithResult(_0x39ba52,0xc9))[_0xdfc5('0x48')](handleError(_0x39ba52,null));};exports['update']=function(_0x274404,_0x40a9f0){if(_0x274404[_0xdfc5('0x55')]['id']){delete _0x274404[_0xdfc5('0x55')]['id'];}return db[_0xdfc5('0x33')][_0xdfc5('0x4c')]({'where':{'id':_0x274404[_0xdfc5('0x49')]['id']}})[_0xdfc5('0x2c')](handleEntityNotFound(_0x40a9f0,null))[_0xdfc5('0x2c')](saveUpdates(_0x274404['body'],null))[_0xdfc5('0x2c')](respondWithResult(_0x40a9f0,null))[_0xdfc5('0x48')](handleError(_0x40a9f0,null));};exports[_0xdfc5('0x56')]=function(_0x6b6324,_0x185334){var _0x17c07d=_0x6b6324[_0xdfc5('0x49')]['id'];var _0x79df6e=[];return db[_0xdfc5('0x57')][_0xdfc5('0x58')](function(_0x360b1a){var _0x2c58f9=_0xdfc5('0x59')+_0x17c07d;return db[_0xdfc5('0x57')][_0xdfc5('0x37')](_0x2c58f9,{'type':db[_0xdfc5('0x5a')]['QueryTypes'][_0xdfc5('0x5b')],'raw':!![],'transaction':_0x360b1a})[_0xdfc5('0x2c')](function(_0x4d16a2){_0x79df6e=_[_0xdfc5('0x32')](_0x4d16a2,function(_0x40e414){return Number(_0x40e414[_0xdfc5('0x5c')]);});})[_0xdfc5('0x2c')](function(){var _0x3a280c=_0xdfc5('0x5d')+_0x17c07d;return db[_0xdfc5('0x57')][_0xdfc5('0x37')](_0x3a280c,{'type':db[_0xdfc5('0x5a')][_0xdfc5('0x5e')][_0xdfc5('0x5b')],'raw':!![],'transaction':_0x360b1a});})[_0xdfc5('0x2c')](function(_0x4de69f){var _0x1d6468=_[_0xdfc5('0x32')](_0x4de69f,function(_0x1eef38){return Number(_0x1eef38[_0xdfc5('0x5f')]);});return db['UserVoiceQueue'][_0xdfc5('0x56')]({'where':{'UserId':{'$in':_0x79df6e},'VoiceQueueId':{'$in':_0x1d6468}},'transaction':_0x360b1a});})[_0xdfc5('0x2c')](function(){var _0x4368e3=_0xdfc5('0x60')+_0x17c07d;return db[_0xdfc5('0x57')]['query'](_0x4368e3,{'type':db[_0xdfc5('0x5a')][_0xdfc5('0x5e')][_0xdfc5('0x5b')],'raw':!![],'transaction':_0x360b1a});})[_0xdfc5('0x2c')](function(_0xae72d0){var _0x2bf76b=_[_0xdfc5('0x32')](_0xae72d0,function(_0x321cff){return Number(_0x321cff[_0xdfc5('0x61')]);});return db[_0xdfc5('0x62')][_0xdfc5('0x56')]({'where':{'UserId':{'$in':_0x79df6e},'MailQueueId':{'$in':_0x2bf76b}},'transaction':_0x360b1a});})['then'](function(){var _0x188a5b=_0xdfc5('0x63')+_0x17c07d;return db[_0xdfc5('0x57')]['query'](_0x188a5b,{'type':db[_0xdfc5('0x5a')][_0xdfc5('0x5e')]['SELECT'],'raw':!![],'transaction':_0x360b1a});})[_0xdfc5('0x2c')](function(_0x4986b9){var _0x4de1e3=_['map'](_0x4986b9,function(_0x1d44f9){return Number(_0x1d44f9[_0xdfc5('0x64')]);});return db['UserSmsQueue']['destroy']({'where':{'UserId':{'$in':_0x79df6e},'SmsQueueId':{'$in':_0x4de1e3}},'transaction':_0x360b1a});})[_0xdfc5('0x2c')](function(){var _0x459798=_0xdfc5('0x65')+_0x17c07d;return db[_0xdfc5('0x57')]['query'](_0x459798,{'type':db[_0xdfc5('0x5a')][_0xdfc5('0x5e')][_0xdfc5('0x5b')],'raw':!![],'transaction':_0x360b1a});})['then'](function(_0x5e644a){var _0x4d99d3=_[_0xdfc5('0x32')](_0x5e644a,function(_0x5f1a8d){return Number(_0x5f1a8d[_0xdfc5('0x66')]);});return db[_0xdfc5('0x67')][_0xdfc5('0x56')]({'where':{'UserId':{'$in':_0x79df6e},'ChatQueueId':{'$in':_0x4d99d3}},'transaction':_0x360b1a});})[_0xdfc5('0x2c')](function(){var _0x38da0e='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x17c07d;return db[_0xdfc5('0x57')][_0xdfc5('0x37')](_0x38da0e,{'type':db[_0xdfc5('0x5a')]['QueryTypes'][_0xdfc5('0x5b')],'raw':!![],'transaction':_0x360b1a});})[_0xdfc5('0x2c')](function(_0x1823a6){var _0x33076c=_['map'](_0x1823a6,function(_0x2c691f){return Number(_0x2c691f[_0xdfc5('0x68')]);});return db[_0xdfc5('0x69')][_0xdfc5('0x56')]({'where':{'UserId':{'$in':_0x79df6e},'FaxQueueId':{'$in':_0x33076c}},'transaction':_0x360b1a});})[_0xdfc5('0x2c')](function(){var _0x5ce065=_0xdfc5('0x6a')+_0x17c07d;return db[_0xdfc5('0x57')][_0xdfc5('0x37')](_0x5ce065,{'type':db[_0xdfc5('0x5a')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x360b1a});})[_0xdfc5('0x2c')](function(_0x560b31){var _0x3c79fb=_['map'](_0x560b31,function(_0x1c2b58){return Number(_0x1c2b58[_0xdfc5('0x6b')]);});return db[_0xdfc5('0x6c')][_0xdfc5('0x56')]({'where':{'UserId':{'$in':_0x79df6e},'OpenchannelQueueId':{'$in':_0x3c79fb}},'transaction':_0x360b1a});})[_0xdfc5('0x2c')](function(){var _0x47e59e=_0xdfc5('0x6d')+_0x17c07d;return db[_0xdfc5('0x57')][_0xdfc5('0x37')](_0x47e59e,{'type':db[_0xdfc5('0x5a')]['QueryTypes'][_0xdfc5('0x5b')],'raw':!![],'transaction':_0x360b1a});})[_0xdfc5('0x2c')](function(_0x31ce2a){var _0x549098=_[_0xdfc5('0x32')](_0x31ce2a,function(_0x3bd6d3){return Number(_0x3bd6d3[_0xdfc5('0x6e')]);});return db[_0xdfc5('0x6f')][_0xdfc5('0x56')]({'where':{'UserId':{'$in':_0x79df6e},'WhatsappQueueId':{'$in':_0x549098}},'transaction':_0x360b1a});})[_0xdfc5('0x2c')](function(){return db[_0xdfc5('0x70')][_0xdfc5('0x4c')]({'where':{'TeamId':_0x17c07d}});})[_0xdfc5('0x2c')](function(_0x47619d){if(_0x47619d===null){return;}return db[_0xdfc5('0x71')]['destroy']({'where':{'UserId':{'$in':_0x79df6e},'VoicePrefixId':_0x47619d[_0xdfc5('0x72')]},'transaction':_0x360b1a});})[_0xdfc5('0x2c')](function(){return db[_0xdfc5('0x33')][_0xdfc5('0x56')]({'where':{'id':_0x17c07d},'cascade':!![],'transaction':_0x360b1a});})[_0xdfc5('0x2c')](function(_0x3c1e47){if(_0x3c1e47===0x0){_0x185334[_0xdfc5('0x2d')](0x194);}else{return db[_0xdfc5('0x73')]['destroy']({'where':{'type':_0xdfc5('0x74'),'resourceId':_0x17c07d},'cascade':!![],'transaction':_0x360b1a})[_0xdfc5('0x2c')](function(){_0x185334[_0xdfc5('0x20')](0xcc)['end']();});}})[_0xdfc5('0x48')](function(_0x2bf3ce){_0x185334[_0xdfc5('0x20')](0x1f4)['send'](_0x2bf3ce);});});};exports[_0xdfc5('0x75')]=function(_0x4935ff,_0x3d1a72,_0x12f7a1){return db[_0xdfc5('0x33')][_0xdfc5('0x76')]({'where':{'id':_0x4935ff[_0xdfc5('0x49')]['id']}})['then'](handleEntityNotFound(_0x3d1a72,null))[_0xdfc5('0x2c')](function(_0x287ef2){if(!_0x4935ff['query']['channel']||!utils[_0xdfc5('0x77')](_0x4935ff[_0xdfc5('0x37')][_0xdfc5('0x78')])){throw new db[(_0xdfc5('0x5a'))][(_0xdfc5('0x79'))](_0xdfc5('0x7a'));}var _0x3c18cb={};var _0x587d2f={};_0x587d2f[_0xdfc5('0x36')]=_['keys'](db[_[_0xdfc5('0x7b')](_0x4935ff[_0xdfc5('0x37')][_0xdfc5('0x78')][_0xdfc5('0x7c')]())+_0xdfc5('0x7d')][_0xdfc5('0x34')]);_0x587d2f[_0xdfc5('0x37')]=_[_0xdfc5('0x38')](_0x4935ff[_0xdfc5('0x37')]);_0x587d2f[_0xdfc5('0x39')]=_[_0xdfc5('0x3a')](_0x587d2f[_0xdfc5('0x36')],_0x587d2f[_0xdfc5('0x37')]);_0x3c18cb[_0xdfc5('0x3b')]=_[_0xdfc5('0x3a')](_0x587d2f[_0xdfc5('0x36')],qs['fields'](_0x4935ff[_0xdfc5('0x37')]['fields']));_0x3c18cb[_0xdfc5('0x3b')]=_0x3c18cb['attributes'][_0xdfc5('0x4a')]?_0x3c18cb[_0xdfc5('0x3b')]:_0x587d2f[_0xdfc5('0x36')];_0x3c18cb[_0xdfc5('0x26')]=qs[_0xdfc5('0x26')](_0x4935ff[_0xdfc5('0x37')][_0xdfc5('0x26')]);_0x3c18cb[_0xdfc5('0x23')]=qs['offset'](_0x4935ff[_0xdfc5('0x37')][_0xdfc5('0x23')]);_0x3c18cb[_0xdfc5('0x3e')]=qs[_0xdfc5('0x3f')](_0x4935ff[_0xdfc5('0x37')]['sort']);_0x3c18cb[_0xdfc5('0x40')]=qs[_0xdfc5('0x39')](_['pick'](_0x4935ff['query'],_0x587d2f[_0xdfc5('0x39')]));_0x3c18cb=_['merge']({},_0x3c18cb,_0x4935ff[_0xdfc5('0x4b')]);return _0x287ef2['get'+_[_0xdfc5('0x7b')](_0x4935ff[_0xdfc5('0x37')][_0xdfc5('0x78')][_0xdfc5('0x7c')]())+'Queues'](_0x3c18cb);})[_0xdfc5('0x2c')](respondWithResult(_0x3d1a72,null))[_0xdfc5('0x48')](handleError(_0x3d1a72,null));};exports[_0xdfc5('0x7e')]=function(_0x208a14,_0x40d5dd,_0x18423b){return db['Team'][_0xdfc5('0x76')]({'where':{'id':_0x208a14[_0xdfc5('0x49')]['id']}})[_0xdfc5('0x2c')](function(_0x432ae1){if(_0x432ae1){if(!_0x208a14[_0xdfc5('0x55')][_0xdfc5('0x78')]||!utils[_0xdfc5('0x77')](_0x208a14[_0xdfc5('0x55')][_0xdfc5('0x78')])){throw new db[(_0xdfc5('0x5a'))][(_0xdfc5('0x79'))]('Unknown\x20channel');}return _0x432ae1['add'+_[_0xdfc5('0x7b')](_0x208a14[_0xdfc5('0x55')][_0xdfc5('0x78')][_0xdfc5('0x7c')]())+_0xdfc5('0x7f')](_0x208a14[_0xdfc5('0x55')][_0xdfc5('0x80')]);}return null;})[_0xdfc5('0x2c')](handleEntityNotFound(_0x40d5dd,null))['then'](respondWithStatusCode(_0x40d5dd,null))[_0xdfc5('0x48')](handleError(_0x40d5dd,null));};exports['removeQueues']=function(_0x21241c,_0x37ab31,_0x47923b){return db[_0xdfc5('0x33')]['findOne']({'where':{'id':_0x21241c[_0xdfc5('0x49')]['id']}})[_0xdfc5('0x2c')](function(_0x2d77e2){if(_0x2d77e2){if(!_0x21241c['query'][_0xdfc5('0x78')]||!utils[_0xdfc5('0x77')](_0x21241c[_0xdfc5('0x37')][_0xdfc5('0x78')])){throw new db[(_0xdfc5('0x5a'))][(_0xdfc5('0x79'))](_0xdfc5('0x7a'));}return _0x2d77e2[_0xdfc5('0x81')+_['capitalize'](_0x21241c[_0xdfc5('0x37')][_0xdfc5('0x78')][_0xdfc5('0x7c')]())+'Queues'](_0x21241c[_0xdfc5('0x37')][_0xdfc5('0x80')]);}return null;})['then'](handleEntityNotFound(_0x37ab31,null))[_0xdfc5('0x2c')](respondWithStatusCode(_0x37ab31,null))[_0xdfc5('0x48')](handleError(_0x37ab31,null));};exports[_0xdfc5('0x82')]=function(_0x34adb5,_0x5a0c72){var _0x3d8ff3=_['isArray'](_0x34adb5[_0xdfc5('0x55')]['ids'])?_0x34adb5[_0xdfc5('0x55')]['ids']:[_0x34adb5[_0xdfc5('0x55')]['ids']];var _0x4791ab=_0x34adb5[_0xdfc5('0x49')]['id'];return db[_0xdfc5('0x33')][_0xdfc5('0x4c')]({'where':{'id':_0x4791ab}})[_0xdfc5('0x2c')](handleEntityNotFound(_0x5a0c72,null))['then'](function(_0x5913ff){if(_0x5913ff){var _0x1af56d=[_0xdfc5('0x83'),_0xdfc5('0x84'),_0xdfc5('0x85'),'Sms',_0xdfc5('0x86'),_0xdfc5('0x87'),_0xdfc5('0x88')];return db[_0xdfc5('0x57')][_0xdfc5('0x58')](function(_0x4cde8a){var _0x4cbec6=_[_0xdfc5('0x32')](_0x1af56d,function(_0xf5fc26){var _0x542b87={'attributes':['id','name']};if(_0xf5fc26===_0xdfc5('0x83')){_0x542b87[_0xdfc5('0x89')]={'attributes':['penalty']};}return _0x5913ff[_0xdfc5('0x4f')+_0xf5fc26+_0xdfc5('0x7f')](_0x542b87)[_0xdfc5('0x2c')](function(_0x20f376){var _0x3a1a63=_[_0xdfc5('0x32')](_0x20f376,function(_0x2fd08d){var _0x1383ec=_[_0xdfc5('0x32')](_0x3d8ff3,function(_0x20bfa0){var _0x4d228c={'where':{'UserId':_0x20bfa0,[_0xf5fc26+_0xdfc5('0x8a')]:_0x2fd08d['id']},'transaction':_0x4cde8a};if(_0xf5fc26===_0xdfc5('0x83')){_0x4d228c[_0xdfc5('0x1c')]={'penalty':_0x2fd08d[_0xdfc5('0x8b')][_0xdfc5('0x8c')]};}return db[_0xdfc5('0x8d')+_0xf5fc26+_0xdfc5('0x7d')][_0xdfc5('0x8e')](_0x4d228c)['then'](function(){socket[_0xdfc5('0x8f')](_0xdfc5('0x4e')+_0xf5fc26+_0xdfc5('0x90'),{'UserId':_0x20bfa0,[_0xf5fc26+_0xdfc5('0x8a')]:_0x2fd08d['id']});if(_0xf5fc26!=='Voice'){return;}return db[_0xdfc5('0x8d')][_0xdfc5('0x46')]({'where':{'id':_0x3d8ff3,'online':0x1},'attributes':['id',_0xdfc5('0x2f'),_0xdfc5('0x91'),_0xdfc5('0x92'),_0xdfc5('0x93')],'raw':!![]})[_0xdfc5('0x2c')](function(_0x449433){var _0x4930dd=_['map'](_0x449433,function(_0x2e19dd){return db['UserVoiceQueueRt'][_0xdfc5('0x94')]({'membername':_0x2e19dd['name'],'UserId':_0x2e19dd['id'],'queue_name':_0x2fd08d[_0xdfc5('0x2f')],'VoiceQueueId':_0x2fd08d['id'],'interface':_['isNil'](_0x2e19dd[_0xdfc5('0x93')])?util[_0xdfc5('0x95')](_0xdfc5('0x96'),_0x2e19dd[_0xdfc5('0x2f')]):_0x2e19dd[_0xdfc5('0x93')],'paused':_0x2e19dd[_0xdfc5('0x92')]||![],'penalty':_0x2fd08d[_0xdfc5('0x8b')]['penalty']},{'transaction':_0x4cde8a});});return Promise[_0xdfc5('0x97')](_0x4930dd);});});});return Promise[_0xdfc5('0x97')](_0x1383ec);});return Promise[_0xdfc5('0x97')](_0x3a1a63);})[_0xdfc5('0x2c')](function(){return db[_0xdfc5('0x70')][_0xdfc5('0x76')]({'where':{'teamId':_0x4791ab}})['then'](function(_0x1a69fd){if(_0x1a69fd){var _0x5b4a08=_['map'](_0x3d8ff3,function(_0x59184d){db['UserVoicePrefix'][_0xdfc5('0x94')]({'UserId':_0x59184d,'VoicePrefixId':_0x1a69fd[_0xdfc5('0x72')]});});return Promise[_0xdfc5('0x97')](_0x5b4a08);}});});});return Promise[_0xdfc5('0x97')](_0x4cbec6)[_0xdfc5('0x2c')](function(){return _0x5913ff[_0xdfc5('0x82')](_0x3d8ff3,{'transaction':_0x4cde8a})[_0xdfc5('0x98')](function(_0x3af5ab){return _0x3af5ab;});});});}})[_0xdfc5('0x2c')](respondWithResult(_0x5a0c72,null))[_0xdfc5('0x48')](handleError(_0x5a0c72,null));};exports[_0xdfc5('0x99')]=function(_0x3148ef,_0x580433){var _0x493692=_[_0xdfc5('0x9a')](_0x3148ef[_0xdfc5('0x37')][_0xdfc5('0x80')])?_0x3148ef[_0xdfc5('0x37')][_0xdfc5('0x80')]:[_0x3148ef[_0xdfc5('0x37')]['ids']];var _0x5047b9=_0x3148ef[_0xdfc5('0x49')]['id'];return db[_0xdfc5('0x33')][_0xdfc5('0x4c')]({'where':{'id':_0x5047b9}})[_0xdfc5('0x2c')](handleEntityNotFound(_0x580433,null))[_0xdfc5('0x2c')](function(_0x37f410){if(_0x37f410){var _0x3acc36=[_0xdfc5('0x83'),_0xdfc5('0x84'),_0xdfc5('0x85'),_0xdfc5('0x9b'),_0xdfc5('0x86'),'Openchannel',_0xdfc5('0x88')];return db[_0xdfc5('0x57')][_0xdfc5('0x58')](function(_0x4f3e10){var _0x10f71d=_[_0xdfc5('0x32')](_0x3acc36,function(_0x233dbc){var _0x1250eb={'attributes':['id',_0xdfc5('0x2f')]};return _0x37f410['get'+_0x233dbc+'Queues'](_0x1250eb)[_0xdfc5('0x2c')](function(_0x509df6){var _0x188d5e=_[_0xdfc5('0x32')](_0x509df6,function(_0x155e57){return _0x155e57['removeAgents'](_0x493692,{'transaction':_0x4f3e10})[_0xdfc5('0x2c')](function(){var _0xbaec88=_['map'](_0x493692,function(_0x333cb){socket[_0xdfc5('0x8f')]('user'+_0x233dbc+_0xdfc5('0x9c'),{'UserId':Number(_0x333cb),[_0x233dbc+_0xdfc5('0x8a')]:_0x155e57['id']});if(_0x233dbc!==_0xdfc5('0x83')){return;}return db[_0xdfc5('0x9d')][_0xdfc5('0x56')]({'where':{'VoiceQueueId':_0x155e57['id'],'UserId':_0x333cb},'transaction':_0x4f3e10});});return Promise[_0xdfc5('0x97')](_0xbaec88);});});return Promise[_0xdfc5('0x97')](_0x188d5e);});});return Promise[_0xdfc5('0x97')](_0x10f71d)[_0xdfc5('0x2c')](function(){return _0x37f410[_0xdfc5('0x99')](_0x493692,{'transaction':_0x4f3e10});})[_0xdfc5('0x2c')](function(){return db[_0xdfc5('0x70')]['findOne']({'where':{'teamId':_0x5047b9}})[_0xdfc5('0x2c')](function(_0x2faa27){if(_0x2faa27){var _0xd3c9f=_[_0xdfc5('0x32')](_0x493692,function(_0x242d07){db['UserVoicePrefix'][_0xdfc5('0x56')]({'where':{'UserId':_0x242d07,'VoicePrefixId':_0x2faa27[_0xdfc5('0x72')]}});});return Promise[_0xdfc5('0x97')](_0xd3c9f);}});});});}})[_0xdfc5('0x2c')](respondWithStatusCode(_0x580433,null))['catch'](handleError(_0x580433,null));};exports[_0xdfc5('0x9e')]=function(_0x2a13b8,_0x280b2e,_0x157eb1){var _0x539540={};var _0x3c1e55={};var _0x2bd4e0;var _0x8cd655;return db[_0xdfc5('0x33')][_0xdfc5('0x76')]({'where':{'id':_0x2a13b8[_0xdfc5('0x49')]['id']}})['then'](handleEntityNotFound(_0x280b2e,null))[_0xdfc5('0x2c')](function(_0x57975d){if(_0x57975d){_0x2bd4e0=_0x57975d;_0x3c1e55[_0xdfc5('0x36')]=_[_0xdfc5('0x38')](db[_0xdfc5('0x8d')][_0xdfc5('0x34')]);_0x3c1e55[_0xdfc5('0x37')]=_[_0xdfc5('0x38')](_0x2a13b8['query']);_0x3c1e55[_0xdfc5('0x39')]=_[_0xdfc5('0x3a')](_0x3c1e55['model'],_0x3c1e55['query']);_0x539540['attributes']=_['intersection'](_0x3c1e55[_0xdfc5('0x36')],qs[_0xdfc5('0x3c')](_0x2a13b8[_0xdfc5('0x37')][_0xdfc5('0x3c')]));_0x539540['attributes']=_0x539540[_0xdfc5('0x3b')][_0xdfc5('0x4a')]?_0x539540[_0xdfc5('0x3b')]:_0x3c1e55[_0xdfc5('0x36')];_0x539540[_0xdfc5('0x3e')]=qs[_0xdfc5('0x3f')](_0x2a13b8[_0xdfc5('0x37')][_0xdfc5('0x3f')]);_0x539540[_0xdfc5('0x40')]=qs[_0xdfc5('0x39')](_[_0xdfc5('0x9f')](_0x2a13b8[_0xdfc5('0x37')],_0x3c1e55[_0xdfc5('0x39')]));if(_0x2a13b8[_0xdfc5('0x37')]['filter']){_0x539540['where']=_[_0xdfc5('0x42')](_0x539540['where'],{'$or':_['map'](_0x539540[_0xdfc5('0x3b')],function(_0x1d3ae1){var _0x15df79={};_0x15df79[_0x1d3ae1]={'$like':'%'+_0x2a13b8[_0xdfc5('0x37')][_0xdfc5('0x41')]+'%'};return _0x15df79;})});}_0x539540=_[_0xdfc5('0x42')]({},_0x539540,_0x2a13b8[_0xdfc5('0x4b')]);return _0x2bd4e0[_0xdfc5('0x9e')](_0x539540);}})[_0xdfc5('0x2c')](function(_0x178422){if(_0x178422){_0x8cd655=_0x178422[_0xdfc5('0x4a')];if(!_0x2a13b8[_0xdfc5('0x37')][_0xdfc5('0xa0')]('nolimit')){_0x539540[_0xdfc5('0x26')]=qs['limit'](_0x2a13b8[_0xdfc5('0x37')][_0xdfc5('0x26')]);_0x539540[_0xdfc5('0x23')]=qs[_0xdfc5('0x23')](_0x2a13b8['query'][_0xdfc5('0x23')]);}return _0x2bd4e0[_0xdfc5('0x9e')](_0x539540);}})[_0xdfc5('0x2c')](function(_0x39ee29){if(_0x39ee29){return _0x39ee29?{'count':_0x8cd655,'rows':_0x39ee29}:null;}})[_0xdfc5('0x2c')](respondWithResult(_0x280b2e,null))[_0xdfc5('0x48')](handleError(_0x280b2e,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 7c7aa54..e9b71cb 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 _0x0f6d=['Team','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x11c4fa,_0x3d68f0){var _0x12e9aa=function(_0x417aa1){while(--_0x417aa1){_0x11c4fa['push'](_0x11c4fa['shift']());}};_0x12e9aa(++_0x3d68f0);}(_0x0f6d,0x182));var _0xd0f6=function(_0x5f1cf8,_0x5e0923){_0x5f1cf8=_0x5f1cf8-0x0;var _0x27d0fa=_0x0f6d[_0x5f1cf8];return _0x27d0fa;};'use strict';var EventEmitter=require(_0xd0f6('0x0'));var Team=require('../../mysqldb')['db'][_0xd0f6('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0xd0f6('0x2')](0x0);var events={'afterCreate':_0xd0f6('0x3'),'afterUpdate':_0xd0f6('0x4'),'afterDestroy':_0xd0f6('0x5')};function emitEvent(_0xc7a282){return function(_0x280457,_0x3bbffe,_0x4c73dc){TeamEvents[_0xd0f6('0x6')](_0xc7a282+':'+_0x280457['id'],_0x280457);TeamEvents['emit'](_0xc7a282,_0x280457);_0x4c73dc(null);};}for(var e in events){if(events[_0xd0f6('0x7')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0xd0f6('0x8')]=TeamEvents; \ No newline at end of file +var _0xcb0e=['remove','emit','hook','exports','../../mysqldb','Team','setMaxListeners','save','update'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0xcb0e,0x151));var _0xecb0=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcb0e[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require('events');var Team=require(_0xecb0('0x0'))['db'][_0xecb0('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0xecb0('0x2')](0x0);var events={'afterCreate':_0xecb0('0x3'),'afterUpdate':_0xecb0('0x4'),'afterDestroy':_0xecb0('0x5')};function emitEvent(_0x142fd4){return function(_0x20f3d7,_0x1bab66,_0x3827a2){TeamEvents[_0xecb0('0x6')](_0x142fd4+':'+_0x20f3d7['id'],_0x20f3d7);TeamEvents['emit'](_0x142fd4,_0x20f3d7);_0x3827a2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0xecb0('0x7')](e,emitEvent(event));}}module[_0xecb0('0x8')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 7629608..bd89273 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 _0x70fb=['lodash','then','exports','Team','teams','Mail','Sms','Whatsapp','resolve','map','all'];(function(_0x5d1fb1,_0x38fc17){var _0x243ca5=function(_0x406242){while(--_0x406242){_0x5d1fb1['push'](_0x5d1fb1['shift']());}};_0x243ca5(++_0x38fc17);}(_0x70fb,0x197));var _0xb70f=function(_0x4ec7f2,_0x3d92d2){_0x4ec7f2=_0x4ec7f2-0x0;var _0x118004=_0x70fb[_0x4ec7f2];return _0x118004;};'use strict';var _=require(_0xb70f('0x0'));var attributes=require('./team.attributes');function getQueuesByChannel(_0x166c6a,_0x5bd2cf){var _0x1f5f0b='get'+_0x5bd2cf+'Queues';return _0x166c6a[_0x1f5f0b]()[_0xb70f('0x1')](function(_0x323f7e){return _['map'](_0x323f7e,function(_0x16761c){_0x16761c['setDataValue']('channel',_0x5bd2cf);return _0x16761c;});})['catch'](function(_0x500f3e){throw _0x500f3e;});}module[_0xb70f('0x2')]=function(_0xf2f7ab){return _0xf2f7ab['define'](_0xb70f('0x3'),attributes,{'tableName':_0xb70f('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x3c3c51=this;var _0x1e87d1=['Chat','Fax',_0xb70f('0x5'),'Openchannel',_0xb70f('0x6'),'Voice',_0xb70f('0x7')];return Promise[_0xb70f('0x8')]()[_0xb70f('0x1')](function(){var _0x7ef30f=_[_0xb70f('0x9')](_0x1e87d1,function(_0x212a24){return getQueuesByChannel(_0x3c3c51,_0x212a24);});return Promise[_0xb70f('0xa')](_0x7ef30f);})['catch'](function(_0x39f22e){throw _0x39f22e;});}}});}; \ No newline at end of file +var _0x706e=['Queues','then','channel','exports','define','Team','teams','Fax','Sms','Whatsapp','resolve','map','all','lodash','./team.attributes'];(function(_0x5201a0,_0x388ee9){var _0x3926e2=function(_0x4a4634){while(--_0x4a4634){_0x5201a0['push'](_0x5201a0['shift']());}};_0x3926e2(++_0x388ee9);}(_0x706e,0xdf));var _0xe706=function(_0x2b6008,_0x40950d){_0x2b6008=_0x2b6008-0x0;var _0x3e19f4=_0x706e[_0x2b6008];return _0x3e19f4;};'use strict';var _=require(_0xe706('0x0'));var attributes=require(_0xe706('0x1'));function getQueuesByChannel(_0x2513ea,_0x1ad308){var _0x2eb3ac='get'+_0x1ad308+_0xe706('0x2');return _0x2513ea[_0x2eb3ac]()[_0xe706('0x3')](function(_0x4d2237){return _['map'](_0x4d2237,function(_0x57cf05){_0x57cf05['setDataValue'](_0xe706('0x4'),_0x1ad308);return _0x57cf05;});})['catch'](function(_0x4a43b0){throw _0x4a43b0;});}module[_0xe706('0x5')]=function(_0x585947){return _0x585947[_0xe706('0x6')](_0xe706('0x7'),attributes,{'tableName':_0xe706('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x3fc4ce=this;var _0x502015=['Chat',_0xe706('0x9'),'Mail','Openchannel',_0xe706('0xa'),'Voice',_0xe706('0xb')];return Promise[_0xe706('0xc')]()['then'](function(){var _0x4223c2=_[_0xe706('0xd')](_0x502015,function(_0xd9ef1b){return getQueuesByChannel(_0x3fc4ce,_0xd9ef1b);});return Promise[_0xe706('0xe')](_0x4223c2);})['catch'](function(_0x58fef4){throw _0x58fef4;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 3a50aeb..6a5b793 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 _0x5756=['socket.io-emitter','redis','register','then','request\x20sent','debug','stringify','error','code','message','info','result','Team,\x20%s,\x20%s','lodash','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','defaults'];(function(_0x44d81a,_0x46f7a5){var _0x1b01cc=function(_0x5c3375){while(--_0x5c3375){_0x44d81a['push'](_0x44d81a['shift']());}};_0x1b01cc(++_0x46f7a5);}(_0x5756,0xdc));var _0x6575=function(_0x365eff,_0x40f55c){_0x365eff=_0x365eff-0x0;var _0x2bf075=_0x5756[_0x365eff];return _0x2bf075;};'use strict';var _=require(_0x6575('0x0'));var util=require('util');var moment=require(_0x6575('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6575('0x2'));var db=require(_0x6575('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x6575('0x4'))(_0x6575('0x5'));var config=require(_0x6575('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x6575('0x7')][_0x6575('0x8')]({'port':0x232a});config['redis']=_[_0x6575('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6575('0xa'))(new Redis(config[_0x6575('0xb')]));require('./team.socket')[_0x6575('0xc')](socket);function respondWithRpcPromise(_0x5730e2,_0x533c94,_0x255f57){return new BPromise(function(_0x2649df,_0xd50bec){return client['request'](_0x5730e2,_0x255f57)[_0x6575('0xd')](function(_0x4b865c){logger['info']('Team,\x20%s,\x20%s',_0x533c94,_0x6575('0xe'));logger[_0x6575('0xf')]('Team,\x20%s,\x20%s,\x20%s',_0x533c94,_0x6575('0xe'),JSON[_0x6575('0x10')](_0x4b865c));if(_0x4b865c['error']){if(_0x4b865c[_0x6575('0x11')][_0x6575('0x12')]===0x1f4){logger['error']('Team,\x20%s,\x20%s',_0x533c94,_0x4b865c['error'][_0x6575('0x13')]);return _0xd50bec(_0x4b865c[_0x6575('0x11')][_0x6575('0x13')]);}logger['error']('Team,\x20%s,\x20%s',_0x533c94,_0x4b865c[_0x6575('0x11')]['message']);return _0x2649df(_0x4b865c['error']['message']);}else{logger[_0x6575('0x14')]('Team,\x20%s,\x20%s',_0x533c94,_0x6575('0xe'));_0x2649df(_0x4b865c[_0x6575('0x15')][_0x6575('0x13')]);}})['catch'](function(_0x224f8f){logger[_0x6575('0x11')](_0x6575('0x16'),_0x533c94,_0x224f8f);_0xd50bec(_0x224f8f);});});} \ No newline at end of file +var _0xc75f=['error','message','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','./team.socket','register','request','then','info','Team,\x20%s,\x20%s','debug','Team,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x530c42,_0x261342){var _0x4009e6=function(_0x5db539){while(--_0x5db539){_0x530c42['push'](_0x530c42['shift']());}};_0x4009e6(++_0x261342);}(_0xc75f,0xc2));var _0xfc75=function(_0xb5abf7,_0x76e61f){_0xb5abf7=_0xb5abf7-0x0;var _0x1ef30c=_0xc75f[_0xb5abf7];return _0x1ef30c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfc75('0x0'));var BPromise=require('bluebird');var rs=require(_0xfc75('0x1'));var fs=require('fs');var Redis=require(_0xfc75('0x2'));var db=require(_0xfc75('0x3'))['db'];var utils=require(_0xfc75('0x4'));var logger=require(_0xfc75('0x5'))(_0xfc75('0x6'));var config=require(_0xfc75('0x7'));var jayson=require(_0xfc75('0x8'));var client=jayson['client'][_0xfc75('0x9')]({'port':0x232a});config['redis']=_[_0xfc75('0xa')](config[_0xfc75('0xb')],{'host':_0xfc75('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xfc75('0xd'))[_0xfc75('0xe')](socket);function respondWithRpcPromise(_0x277dfe,_0x24c6bd,_0x4dba23){return new BPromise(function(_0x338b68,_0x301540){return client[_0xfc75('0xf')](_0x277dfe,_0x4dba23)[_0xfc75('0x10')](function(_0x534fd3){logger[_0xfc75('0x11')](_0xfc75('0x12'),_0x24c6bd,'request\x20sent');logger[_0xfc75('0x13')](_0xfc75('0x14'),_0x24c6bd,_0xfc75('0x15'),JSON['stringify'](_0x534fd3));if(_0x534fd3[_0xfc75('0x16')]){if(_0x534fd3['error']['code']===0x1f4){logger['error'](_0xfc75('0x12'),_0x24c6bd,_0x534fd3[_0xfc75('0x16')]['message']);return _0x301540(_0x534fd3[_0xfc75('0x16')][_0xfc75('0x17')]);}logger[_0xfc75('0x16')](_0xfc75('0x12'),_0x24c6bd,_0x534fd3[_0xfc75('0x16')]['message']);return _0x338b68(_0x534fd3['error'][_0xfc75('0x17')]);}else{logger[_0xfc75('0x11')](_0xfc75('0x12'),_0x24c6bd,'request\x20sent');_0x338b68(_0x534fd3['result'][_0xfc75('0x17')]);}})['catch'](function(_0xd91b79){logger[_0xfc75('0x16')](_0xfc75('0x12'),_0x24c6bd,_0xd91b79);_0x301540(_0xd91b79);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 504f74a..62fedbf 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 _0x9703=['register','length','team:','remove','update','removeListener'];(function(_0x34fd8c,_0x315ec6){var _0x512ba0=function(_0x49cc25){while(--_0x49cc25){_0x34fd8c['push'](_0x34fd8c['shift']());}};_0x512ba0(++_0x315ec6);}(_0x9703,0xdb));var _0x3970=function(_0x29b564,_0x2d95bd){_0x29b564=_0x29b564-0x0;var _0xae0676=_0x9703[_0x29b564];return _0xae0676;};'use strict';var TeamEvents=require('./team.events');var events=['save',_0x3970('0x0'),_0x3970('0x1')];function createListener(_0x3ed006,_0x58168c){return function(_0x1fb9af){_0x58168c['emit'](_0x3ed006,_0x1fb9af);};}function removeListener(_0x2312a5,_0x5edd50){return function(){TeamEvents[_0x3970('0x2')](_0x2312a5,_0x5edd50);};}exports[_0x3970('0x3')]=function(_0x5cdfda){for(var _0x5669ec=0x0,_0x21986b=events[_0x3970('0x4')];_0x5669ec<_0x21986b;_0x5669ec++){var _0x282355=events[_0x5669ec];var _0x41d4d1=createListener(_0x3970('0x5')+_0x282355,_0x5cdfda);TeamEvents['on'](_0x282355,_0x41d4d1);}}; \ No newline at end of file +var _0x7c80=['save','removeListener','length','team:','./team.events'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x7c80,0xa4));var _0x07c8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7c80[_0x3dd15e];return _0x231fd0;};'use strict';var TeamEvents=require(_0x07c8('0x0'));var events=[_0x07c8('0x1'),'remove','update'];function createListener(_0x25073e,_0x17fa86){return function(_0xae0c43){_0x17fa86['emit'](_0x25073e,_0xae0c43);};}function removeListener(_0x19356e,_0x750fb2){return function(){TeamEvents[_0x07c8('0x2')](_0x19356e,_0x750fb2);};}exports['register']=function(_0xfe1ead){for(var _0x56b8ca=0x0,_0x4a5354=events[_0x07c8('0x3')];_0x56b8ca<_0x4a5354;_0x56b8ca++){var _0xc0c7bf=events[_0x56b8ca];var _0x32d564=createListener(_0x07c8('0x4')+_0xc0c7bf,_0xfe1ead);TeamEvents['on'](_0xc0c7bf,_0x32d564);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 4c2fdc8..4e82337 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 _0x03bc=['sequelize','INTEGER'];(function(_0x2ec23a,_0xeda41){var _0x108a11=function(_0x56d905){while(--_0x56d905){_0x2ec23a['push'](_0x2ec23a['shift']());}};_0x108a11(++_0xeda41);}(_0x03bc,0xb8));var _0xc03b=function(_0x45b131,_0x1bcbd2){_0x45b131=_0x45b131-0x0;var _0x54d307=_0x03bc[_0x45b131];return _0x54d307;};'use strict';var Sequelize=require(_0xc03b('0x0'));module['exports']={'TeamId':{'type':Sequelize[_0xc03b('0x1')]},'VoicePrefixId':{'type':Sequelize[_0xc03b('0x1')]}}; \ No newline at end of file +var _0x51c4=['exports','INTEGER'];(function(_0x1f73c6,_0x15a636){var _0xce442d=function(_0x5f34b1){while(--_0x5f34b1){_0x1f73c6['push'](_0x1f73c6['shift']());}};_0xce442d(++_0x15a636);}(_0x51c4,0x192));var _0x451c=function(_0x5584dc,_0x409d2f){_0x5584dc=_0x5584dc-0x0;var _0x126ec4=_0x51c4[_0x5584dc];return _0x126ec4;};'use strict';var Sequelize=require('sequelize');module[_0x451c('0x0')]={'TeamId':{'type':Sequelize[_0x451c('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x451c('0x1')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index ea326db..cae55db 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 _0x5269=['lodash','bluebird','request-promise','path','./teamVoicePrefix.attributes','define','TeamVoicePrefix','team_has_voice_prefixes'];(function(_0x5cf295,_0x5ecf49){var _0x353098=function(_0x2c45e7){while(--_0x2c45e7){_0x5cf295['push'](_0x5cf295['shift']());}};_0x353098(++_0x5ecf49);}(_0x5269,0x150));var _0x9526=function(_0x4d1d72,_0x2f77d8){_0x4d1d72=_0x4d1d72-0x0;var _0x455123=_0x5269[_0x4d1d72];return _0x455123;};'use strict';var _=require(_0x9526('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x9526('0x1'));var rp=require(_0x9526('0x2'));var fs=require('fs');var path=require(_0x9526('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9526('0x4'));module['exports']=function(_0x15d394,_0x9cf5eb){return _0x15d394[_0x9526('0x5')](_0x9526('0x6'),attributes,{'tableName':_0x9526('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdbfc=['util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./teamVoicePrefix.attributes','TeamVoicePrefix','team_has_voice_prefixes','lodash'];(function(_0x52085a,_0x3717ca){var _0x5afc1a=function(_0x2aa175){while(--_0x2aa175){_0x52085a['push'](_0x52085a['shift']());}};_0x5afc1a(++_0x3717ca);}(_0xdbfc,0x11d));var _0xcdbf=function(_0x4cdc81,_0x29fe4b){_0x4cdc81=_0x4cdc81-0x0;var _0x274af3=_0xdbfc[_0x4cdc81];return _0x274af3;};'use strict';var _=require(_0xcdbf('0x0'));var util=require(_0xcdbf('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xcdbf('0x2'));var BPromise=require(_0xcdbf('0x3'));var rp=require(_0xcdbf('0x4'));var fs=require('fs');var path=require(_0xcdbf('0x5'));var rimraf=require(_0xcdbf('0x6'));var config=require(_0xcdbf('0x7'));var attributes=require(_0xcdbf('0x8'));module['exports']=function(_0x3ffa10,_0x4129cf){return _0x3ffa10['define'](_0xcdbf('0x9'),attributes,{'tableName':_0xcdbf('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 2c544d8..76653b3 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x41425c,_0x559f66){var _0x49a245=function(_0x22d187){while(--_0x22d187){_0x41425c['push'](_0x41425c['shift']());}};_0x49a245(++_0x559f66);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x80f51a,_0x32e95e){_0x80f51a=_0x80f51a-0x0;var _0x327148=_0xcb91[_0x80f51a];return _0x327148;};'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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x4b719b,_0x440b42){var _0x90fbee=function(_0xccfd7e){while(--_0xccfd7e){_0x4b719b['push'](_0x4b719b['shift']());}};_0x90fbee(++_0x440b42);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 05130f6..39cbf69 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 _0x3b78=['exports','INTEGER','sequelize'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x3b78,0xaa));var _0x83b7=function(_0x421b7b,_0x566ee9){_0x421b7b=_0x421b7b-0x0;var _0x2c472c=_0x3b78[_0x421b7b];return _0x2c472c;};'use strict';var Sequelize=require(_0x83b7('0x0'));module[_0x83b7('0x1')]={'penalty':{'type':Sequelize[_0x83b7('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x681b=['sequelize'];(function(_0x51a255,_0x35b735){var _0x11896b=function(_0x29cbc5){while(--_0x29cbc5){_0x51a255['push'](_0x51a255['shift']());}};_0x11896b(++_0x35b735);}(_0x681b,0x143));var _0xb681=function(_0x43fdb1,_0x123a0c){_0x43fdb1=_0x43fdb1-0x0;var _0x3315e7=_0x681b[_0x43fdb1];return _0x3315e7;};'use strict';var Sequelize=require(_0xb681('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 562832c..562698d 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 _0xeb5d=['util','../../config/logger','api','moment','path','rimraf','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','team_has_voice_queues'];(function(_0xd34f49,_0x5aad69){var _0x498d6c=function(_0x6c3e51){while(--_0x6c3e51){_0xd34f49['push'](_0xd34f49['shift']());}};_0x498d6c(++_0x5aad69);}(_0xeb5d,0x16b));var _0xdeb5=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xeb5d[_0x27af45];return _0x18df21;};'use strict';var _=require('lodash');var util=require(_0xdeb5('0x0'));var logger=require(_0xdeb5('0x1'))(_0xdeb5('0x2'));var moment=require(_0xdeb5('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xdeb5('0x4'));var rimraf=require(_0xdeb5('0x5'));var config=require('../../config/environment');var attributes=require(_0xdeb5('0x6'));module[_0xdeb5('0x7')]=function(_0x164ecb,_0x33af72){return _0x164ecb[_0xdeb5('0x8')](_0xdeb5('0x9'),attributes,{'tableName':_0xdeb5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x222f=['define','team_has_voice_queues','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x8e624d,_0x2da1f6){var _0x12bd8d=function(_0x48cf6b){while(--_0x48cf6b){_0x8e624d['push'](_0x8e624d['shift']());}};_0x12bd8d(++_0x2da1f6);}(_0x222f,0x1a4));var _0xf222=function(_0x17a750,_0x8b9552){_0x17a750=_0x17a750-0x0;var _0x307b72=_0x222f[_0x17a750];return _0x307b72;};'use strict';var _=require(_0xf222('0x0'));var util=require(_0xf222('0x1'));var logger=require(_0xf222('0x2'))(_0xf222('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf222('0x4'));var fs=require('fs');var path=require(_0xf222('0x5'));var rimraf=require(_0xf222('0x6'));var config=require(_0xf222('0x7'));var attributes=require('./teamVoiceQueue.attributes');module[_0xf222('0x8')]=function(_0x54a758,_0x112e6d){return _0x54a758[_0xf222('0x9')]('TeamVoiceQueue',attributes,{'tableName':_0xf222('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index f91c019..8b7a40e 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 _0x2188=['TeamVoiceQueue,\x20%s,\x20%s','debug','error','message','request\x20sent','result','lodash','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','client','http','request','info'];(function(_0x14d7d6,_0x57bcd5){var _0x5d900b=function(_0x528c1b){while(--_0x528c1b){_0x14d7d6['push'](_0x14d7d6['shift']());}};_0x5d900b(++_0x57bcd5);}(_0x2188,0x1d6));var _0x8218=function(_0x47e954,_0x3b972b){_0x47e954=_0x47e954-0x0;var _0x5911e4=_0x2188[_0x47e954];return _0x5911e4;};'use strict';var _=require(_0x8218('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x8218('0x1'));var rs=require(_0x8218('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8218('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x8218('0x4'))(_0x8218('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8218('0x6')][_0x8218('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xd416ac,_0x5f6617,_0x113802){return new BPromise(function(_0x298d38,_0x20d3d){return client[_0x8218('0x8')](_0xd416ac,_0x113802)['then'](function(_0x1baafc){logger[_0x8218('0x9')](_0x8218('0xa'),_0x5f6617,'request\x20sent');logger[_0x8218('0xb')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x5f6617,'request\x20sent',JSON['stringify'](_0x1baafc));if(_0x1baafc['error']){if(_0x1baafc[_0x8218('0xc')]['code']===0x1f4){logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x5f6617,_0x1baafc[_0x8218('0xc')][_0x8218('0xd')]);return _0x20d3d(_0x1baafc[_0x8218('0xc')][_0x8218('0xd')]);}logger[_0x8218('0xc')](_0x8218('0xa'),_0x5f6617,_0x1baafc[_0x8218('0xc')][_0x8218('0xd')]);return _0x298d38(_0x1baafc[_0x8218('0xc')][_0x8218('0xd')]);}else{logger[_0x8218('0x9')]('TeamVoiceQueue,\x20%s,\x20%s',_0x5f6617,_0x8218('0xe'));_0x298d38(_0x1baafc[_0x8218('0xf')]['message']);}})['catch'](function(_0x40482c){logger[_0x8218('0xc')](_0x8218('0xa'),_0x5f6617,_0x40482c);_0x20d3d(_0x40482c);});});} \ No newline at end of file +var _0xc688=['result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','request','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x52fa1e,_0x39a40f){var _0x26849d=function(_0x4e52c3){while(--_0x4e52c3){_0x52fa1e['push'](_0x52fa1e['shift']());}};_0x26849d(++_0x39a40f);}(_0xc688,0xc0));var _0x8c68=function(_0x314feb,_0xd07315){_0x314feb=_0x314feb-0x0;var _0xd89a42=_0xc688[_0x314feb];return _0xd89a42;};'use strict';var _=require(_0x8c68('0x0'));var util=require(_0x8c68('0x1'));var moment=require('moment');var BPromise=require(_0x8c68('0x2'));var rs=require(_0x8c68('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8c68('0x4'))['db'];var utils=require(_0x8c68('0x5'));var logger=require('../../config/logger')(_0x8c68('0x6'));var config=require('../../config/environment');var jayson=require(_0x8c68('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x529400,_0x17f5a3,_0x5e62be){return new BPromise(function(_0x496f4f,_0x26f8dd){return client[_0x8c68('0x8')](_0x529400,_0x5e62be)['then'](function(_0x33b768){logger['info'](_0x8c68('0x9'),_0x17f5a3,_0x8c68('0xa'));logger[_0x8c68('0xb')](_0x8c68('0xc'),_0x17f5a3,'request\x20sent',JSON[_0x8c68('0xd')](_0x33b768));if(_0x33b768[_0x8c68('0xe')]){if(_0x33b768[_0x8c68('0xe')]['code']===0x1f4){logger[_0x8c68('0xe')](_0x8c68('0x9'),_0x17f5a3,_0x33b768[_0x8c68('0xe')][_0x8c68('0xf')]);return _0x26f8dd(_0x33b768[_0x8c68('0xe')][_0x8c68('0xf')]);}logger[_0x8c68('0xe')](_0x8c68('0x9'),_0x17f5a3,_0x33b768[_0x8c68('0xe')]['message']);return _0x496f4f(_0x33b768[_0x8c68('0xe')]['message']);}else{logger[_0x8c68('0x10')]('TeamVoiceQueue,\x20%s,\x20%s',_0x17f5a3,'request\x20sent');_0x496f4f(_0x33b768[_0x8c68('0x11')]['message']);}})[_0x8c68('0x12')](function(_0x406e70){logger[_0x8c68('0xe')]('TeamVoiceQueue,\x20%s,\x20%s',_0x17f5a3,_0x406e70);_0x26f8dd(_0x406e70);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 765432a..7fa65b6 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 _0xd052=['path','express','../../components/auth/service','../../config/environment','./template.controller','isAuthenticated','index','get','/:id','show','post','create','put','destroy','exports'];(function(_0x594a0a,_0x432ae7){var _0x5ed9be=function(_0x5a4942){while(--_0x5a4942){_0x594a0a['push'](_0x594a0a['shift']());}};_0x5ed9be(++_0x432ae7);}(_0xd052,0x69));var _0x2d05=function(_0x259d09,_0xbe1403){_0x259d09=_0x259d09-0x0;var _0x205ca8=_0xd052[_0x259d09];return _0x205ca8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2d05('0x0'));var timeout=require('connect-timeout');var express=require(_0x2d05('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2d05('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x2d05('0x3'));var controller=require(_0x2d05('0x4'));router['get']('/',auth[_0x2d05('0x5')](),controller[_0x2d05('0x6')]);router[_0x2d05('0x7')](_0x2d05('0x8'),auth[_0x2d05('0x5')](),controller[_0x2d05('0x9')]);router[_0x2d05('0xa')]('/',auth[_0x2d05('0x5')](),controller[_0x2d05('0xb')]);router[_0x2d05('0xc')](_0x2d05('0x8'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x2d05('0x8'),auth[_0x2d05('0x5')](),controller[_0x2d05('0xd')]);module[_0x2d05('0xe')]=router; \ No newline at end of file +var _0x5ae9=['/:id','post','create','put','update','delete','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index'];(function(_0x44c29b,_0x269e15){var _0x4f3f87=function(_0x5b85f1){while(--_0x5b85f1){_0x44c29b['push'](_0x44c29b['shift']());}};_0x4f3f87(++_0x269e15);}(_0x5ae9,0x19b));var _0x95ae=function(_0x295df8,_0x1f9924){_0x295df8=_0x295df8-0x0;var _0x1c4b61=_0x5ae9[_0x295df8];return _0x1c4b61;};'use strict';var multer=require(_0x95ae('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x95ae('0x1'));var express=require(_0x95ae('0x2'));var router=express['Router']();var fs_extra=require(_0x95ae('0x3'));var auth=require(_0x95ae('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x95ae('0x5'));var controller=require('./template.controller');router[_0x95ae('0x6')]('/',auth[_0x95ae('0x7')](),controller[_0x95ae('0x8')]);router[_0x95ae('0x6')](_0x95ae('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x95ae('0xa')]('/',auth[_0x95ae('0x7')](),controller[_0x95ae('0xb')]);router[_0x95ae('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x95ae('0xd')]);router[_0x95ae('0xe')](_0x95ae('0x9'),auth[_0x95ae('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index b8a33e5..ac1c53b 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 _0x55b7=['TEXT','exports','STRING'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x55b7,0x190));var _0x755b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x55b7[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0x755b('0x0')]={'name':{'type':Sequelize[_0x755b('0x1')]},'description':{'type':Sequelize[_0x755b('0x1')]},'html':{'type':Sequelize[_0x755b('0x2')]}}; \ No newline at end of file +var _0x6a8d=['STRING','TEXT','sequelize','exports'];(function(_0x2ab6f2,_0x29649b){var _0x1aa9f4=function(_0xd7dc5e){while(--_0xd7dc5e){_0x2ab6f2['push'](_0x2ab6f2['shift']());}};_0x1aa9f4(++_0x29649b);}(_0x6a8d,0x15a));var _0xd6a8=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0x6a8d[_0x5f309e];return _0x487b5e;};'use strict';var Sequelize=require(_0xd6a8('0x0'));module[_0xd6a8('0x1')]={'name':{'type':Sequelize[_0xd6a8('0x2')]},'description':{'type':Sequelize[_0xd6a8('0x2')]},'html':{'type':Sequelize[_0xd6a8('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index da2a86e..00d4620 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 _0x7f1a=['to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','Templates','UserProfileResource','error','name','send','index','map','Template','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox'];(function(_0xc9275e,_0x4cc1ba){var _0x5162d4=function(_0x52ef80){while(--_0x52ef80){_0xc9275e['push'](_0xc9275e['shift']());}};_0x5162d4(++_0x4cc1ba);}(_0x7f1a,0xf0));var _0xa7f1=function(_0x391316,_0x3a4682){_0x391316=_0x391316-0x0;var _0x4386de=_0x7f1a[_0x391316];return _0x4386de;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa7f1('0x0'));var zipdir=require(_0xa7f1('0x1'));var jsonpatch=require(_0xa7f1('0x2'));var rp=require(_0xa7f1('0x3'));var moment=require(_0xa7f1('0x4'));var BPromise=require(_0xa7f1('0x5'));var Mustache=require(_0xa7f1('0x6'));var util=require(_0xa7f1('0x7'));var path=require('path');var sox=require(_0xa7f1('0x8'));var csv=require(_0xa7f1('0x9'));var ejs=require(_0xa7f1('0xa'));var fs=require('fs');var fs_extra=require(_0xa7f1('0xb'));var _=require(_0xa7f1('0xc'));var squel=require(_0xa7f1('0xd'));var crypto=require(_0xa7f1('0xe'));var jsforce=require(_0xa7f1('0xf'));var deskjs=require(_0xa7f1('0x10'));var toCsv=require(_0xa7f1('0x9'));var querystring=require(_0xa7f1('0x11'));var Papa=require('papaparse');var Redis=require(_0xa7f1('0x12'));var authService=require(_0xa7f1('0x13'));var qs=require(_0xa7f1('0x14'));var as=require(_0xa7f1('0x15'));var hardwareService=require(_0xa7f1('0x16'));var logger=require(_0xa7f1('0x17'))(_0xa7f1('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa7f1('0x19'))['db'];function respondWithStatusCode(_0x2b7afb,_0x37ab71){_0x37ab71=_0x37ab71||0xcc;return function(_0x542657){if(_0x542657){return _0x2b7afb[_0xa7f1('0x1a')](_0x37ab71);}return _0x2b7afb['status'](_0x37ab71)[_0xa7f1('0x1b')]();};}function respondWithResult(_0x3e94dd,_0x44f7ff){_0x44f7ff=_0x44f7ff||0xc8;return function(_0xe8bfdc){if(_0xe8bfdc){return _0x3e94dd[_0xa7f1('0x1c')](_0x44f7ff)['json'](_0xe8bfdc);}};}function respondWithFilteredResult(_0x776a28,_0xd78a67){return function(_0x387619){if(_0x387619){var _0xc8084c=typeof _0xd78a67[_0xa7f1('0x1d')]===_0xa7f1('0x1e')&&typeof _0xd78a67['limit']==='undefined';var _0xf4e135=_0x387619['count'];var _0x3fcdc7=_0xc8084c?0x0:_0xd78a67[_0xa7f1('0x1d')];var _0x48cc96=_0xc8084c?_0x387619[_0xa7f1('0x1f')]:_0xd78a67[_0xa7f1('0x1d')]+_0xd78a67[_0xa7f1('0x20')];var _0xab3f87;if(_0x48cc96>=_0xf4e135){_0x48cc96=_0xf4e135;_0xab3f87=0xc8;}else{_0xab3f87=0xce;}_0x776a28[_0xa7f1('0x1c')](_0xab3f87);return _0x776a28[_0xa7f1('0x21')](_0xa7f1('0x22'),_0x3fcdc7+'-'+_0x48cc96+'/'+_0xf4e135)['json'](_0x387619);}return null;};}function patchUpdates(_0x376c35){return function(_0x5190b8){try{jsonpatch[_0xa7f1('0x23')](_0x5190b8,_0x376c35,!![]);}catch(_0x3b51cd){return BPromise[_0xa7f1('0x24')](_0x3b51cd);}return _0x5190b8[_0xa7f1('0x25')]();};}function saveUpdates(_0x57390d,_0x5f5106){return function(_0x13173b){if(_0x13173b){return _0x13173b[_0xa7f1('0x26')](_0x57390d)[_0xa7f1('0x27')](function(_0x5e7e2f){return _0x5e7e2f;});}return null;};}function removeEntity(_0x35e74e,_0x2de2f1){return function(_0x3f777b){if(_0x3f777b){return _0x3f777b[_0xa7f1('0x28')]()[_0xa7f1('0x27')](function(){var _0x592fb0=_0x3f777b['get']({'plain':!![]});var _0x9504e2=_0xa7f1('0x29');return db[_0xa7f1('0x2a')][_0xa7f1('0x28')]({'where':{'type':_0x9504e2,'resourceId':_0x592fb0['id']}})[_0xa7f1('0x27')](function(){return _0x3f777b;});})[_0xa7f1('0x27')](function(){_0x35e74e['status'](0xcc)[_0xa7f1('0x1b')]();});}};}function handleEntityNotFound(_0x50ed78,_0x385591){return function(_0x5a830d){if(!_0x5a830d){_0x50ed78[_0xa7f1('0x1a')](0x194);}return _0x5a830d;};}function handleError(_0x51dbf4,_0xa92e95){_0xa92e95=_0xa92e95||0x1f4;return function(_0x111d8a){logger[_0xa7f1('0x2b')](_0x111d8a['stack']);if(_0x111d8a[_0xa7f1('0x2c')]){delete _0x111d8a[_0xa7f1('0x2c')];}_0x51dbf4[_0xa7f1('0x1c')](_0xa92e95)[_0xa7f1('0x2d')](_0x111d8a);};}exports[_0xa7f1('0x2e')]=function(_0x34dbb7,_0x3a06a3){var _0x16e13a={},_0x1b032a={},_0x4df347={'count':0x0,'rows':[]};var _0x41197e=_[_0xa7f1('0x2f')](db[_0xa7f1('0x30')][_0xa7f1('0x31')],function(_0x5322ac){return{'name':_0x5322ac[_0xa7f1('0x32')],'type':_0x5322ac[_0xa7f1('0x33')][_0xa7f1('0x34')]};});_0x1b032a[_0xa7f1('0x35')]=_[_0xa7f1('0x2f')](_0x41197e,_0xa7f1('0x2c'));_0x1b032a[_0xa7f1('0x36')]=_[_0xa7f1('0x37')](_0x34dbb7[_0xa7f1('0x36')]);_0x1b032a[_0xa7f1('0x38')]=_[_0xa7f1('0x39')](_0x1b032a[_0xa7f1('0x35')],_0x1b032a['query']);_0x16e13a[_0xa7f1('0x3a')]=_[_0xa7f1('0x39')](_0x1b032a[_0xa7f1('0x35')],qs[_0xa7f1('0x3b')](_0x34dbb7[_0xa7f1('0x36')][_0xa7f1('0x3b')]));_0x16e13a[_0xa7f1('0x3a')]=_0x16e13a[_0xa7f1('0x3a')][_0xa7f1('0x3c')]?_0x16e13a[_0xa7f1('0x3a')]:_0x1b032a[_0xa7f1('0x35')];if(!_0x34dbb7['query']['hasOwnProperty'](_0xa7f1('0x3d'))){_0x16e13a[_0xa7f1('0x20')]=qs[_0xa7f1('0x20')](_0x34dbb7[_0xa7f1('0x36')][_0xa7f1('0x20')]);_0x16e13a[_0xa7f1('0x1d')]=qs['offset'](_0x34dbb7['query'][_0xa7f1('0x1d')]);}_0x16e13a['order']=qs[_0xa7f1('0x3e')](_0x34dbb7[_0xa7f1('0x36')][_0xa7f1('0x3e')]);_0x16e13a[_0xa7f1('0x3f')]=qs[_0xa7f1('0x38')](_[_0xa7f1('0x40')](_0x34dbb7[_0xa7f1('0x36')],_0x1b032a[_0xa7f1('0x38')]),_0x41197e);if(_0x34dbb7[_0xa7f1('0x36')][_0xa7f1('0x41')]){_0x16e13a[_0xa7f1('0x3f')]=_[_0xa7f1('0x42')](_0x16e13a['where'],{'$or':_[_0xa7f1('0x2f')](_0x41197e,function(_0x132517){if(_0x132517[_0xa7f1('0x33')]!=='VIRTUAL'){var _0x3338a9={};_0x3338a9[_0x132517[_0xa7f1('0x2c')]]={'$like':'%'+_0x34dbb7['query'][_0xa7f1('0x41')]+'%'};return _0x3338a9;}})});}_0x16e13a=_['merge']({},_0x16e13a,_0x34dbb7[_0xa7f1('0x43')]);var _0x310ca5={'where':_0x16e13a['where']};return db['Template'][_0xa7f1('0x1f')](_0x310ca5)[_0xa7f1('0x27')](function(_0x186306){_0x4df347['count']=_0x186306;if(_0x34dbb7[_0xa7f1('0x36')][_0xa7f1('0x44')]){_0x16e13a[_0xa7f1('0x45')]=[{'all':!![]}];}return db[_0xa7f1('0x30')][_0xa7f1('0x46')](_0x16e13a);})[_0xa7f1('0x27')](function(_0xaa92e5){_0x4df347['rows']=_0xaa92e5;return _0x4df347;})['then'](respondWithFilteredResult(_0x3a06a3,_0x16e13a))[_0xa7f1('0x47')](handleError(_0x3a06a3,null));};exports[_0xa7f1('0x48')]=function(_0xd49cc0,_0x59656d){var _0xc4680b={'raw':!![],'where':{'id':_0xd49cc0[_0xa7f1('0x49')]['id']}},_0x47a889={};_0x47a889[_0xa7f1('0x35')]=_[_0xa7f1('0x37')](db[_0xa7f1('0x30')][_0xa7f1('0x31')]);_0x47a889[_0xa7f1('0x36')]=_[_0xa7f1('0x37')](_0xd49cc0[_0xa7f1('0x36')]);_0x47a889['filters']=_[_0xa7f1('0x39')](_0x47a889['model'],_0x47a889[_0xa7f1('0x36')]);_0xc4680b[_0xa7f1('0x3a')]=_[_0xa7f1('0x39')](_0x47a889['model'],qs['fields'](_0xd49cc0[_0xa7f1('0x36')][_0xa7f1('0x3b')]));_0xc4680b['attributes']=_0xc4680b[_0xa7f1('0x3a')]['length']?_0xc4680b[_0xa7f1('0x3a')]:_0x47a889['model'];if(_0xd49cc0['query'][_0xa7f1('0x44')]){_0xc4680b[_0xa7f1('0x45')]=[{'all':!![]}];}_0xc4680b=_[_0xa7f1('0x42')]({},_0xc4680b,_0xd49cc0[_0xa7f1('0x43')]);return db['Template']['find'](_0xc4680b)['then'](handleEntityNotFound(_0x59656d,null))[_0xa7f1('0x27')](respondWithResult(_0x59656d,null))[_0xa7f1('0x47')](handleError(_0x59656d,null));};exports[_0xa7f1('0x4a')]=function(_0xb31064,_0x1bceaa){return db[_0xa7f1('0x30')][_0xa7f1('0x4a')](_0xb31064['body'],{})[_0xa7f1('0x27')](function(_0x32df4b){var _0x3c0a11=_0xb31064[_0xa7f1('0x4b')]['get']({'plain':!![]});if(!_0x3c0a11)throw new Error(_0xa7f1('0x4c'));if(_0x3c0a11[_0xa7f1('0x4d')]===_0xa7f1('0x4b')){var _0x595b92=_0x32df4b[_0xa7f1('0x4e')]({'plain':!![]});var _0x3b2606='Templates';return db[_0xa7f1('0x4f')][_0xa7f1('0x50')]({'where':{'name':_0x3b2606,'userProfileId':_0x3c0a11['userProfileId']},'raw':!![]})[_0xa7f1('0x27')](function(_0x3f5c21){if(_0x3f5c21&&_0x3f5c21['autoAssociation']===0x0){return db['UserProfileResource'][_0xa7f1('0x4a')]({'name':_0x595b92['name'],'resourceId':_0x595b92['id'],'type':_0x3f5c21['name'],'sectionId':_0x3f5c21['id']},{})[_0xa7f1('0x27')](function(){return _0x32df4b;});}else{return _0x32df4b;}})[_0xa7f1('0x47')](function(_0x2369c3){logger['error'](_0xa7f1('0x51'),_0x2369c3);throw _0x2369c3;});}return _0x32df4b;})['then'](respondWithResult(_0x1bceaa,0xc9))['catch'](handleError(_0x1bceaa,null));};exports[_0xa7f1('0x26')]=function(_0x18fed1,_0x33baf2){if(_0x18fed1['body']['id']){delete _0x18fed1[_0xa7f1('0x52')]['id'];}return db[_0xa7f1('0x30')][_0xa7f1('0x50')]({'where':{'id':_0x18fed1[_0xa7f1('0x49')]['id']}})[_0xa7f1('0x27')](handleEntityNotFound(_0x33baf2,null))['then'](saveUpdates(_0x18fed1[_0xa7f1('0x52')],null))[_0xa7f1('0x27')](respondWithResult(_0x33baf2,null))['catch'](handleError(_0x33baf2,null));};exports['destroy']=function(_0x53415b,_0x52bb49){return db['Template'][_0xa7f1('0x50')]({'where':{'id':_0x53415b[_0xa7f1('0x49')]['id']}})['then'](handleEntityNotFound(_0x52bb49,null))['then'](removeEntity(_0x52bb49,null))[_0xa7f1('0x47')](handleError(_0x52bb49,null));}; \ No newline at end of file +var _0x9b95=['Templates','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','count','set','Content-Range','save','update','then','get','UserProfileResource','destroy','error','name','send','index','map','Template','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','where','filter','merge','options','includeAll','include','rows','catch','show','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x19cf1d,_0xee9800){var _0x1f57d9=function(_0x26161e){while(--_0x26161e){_0x19cf1d['push'](_0x19cf1d['shift']());}};_0x1f57d9(++_0xee9800);}(_0x9b95,0x140));var _0x59b9=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x9b95[_0x57b54c];return _0x59cc19;};'use strict';var emlformat=require(_0x59b9('0x0'));var rimraf=require(_0x59b9('0x1'));var zipdir=require(_0x59b9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x59b9('0x3'));var BPromise=require(_0x59b9('0x4'));var Mustache=require(_0x59b9('0x5'));var util=require('util');var path=require(_0x59b9('0x6'));var sox=require(_0x59b9('0x7'));var csv=require(_0x59b9('0x8'));var ejs=require(_0x59b9('0x9'));var fs=require('fs');var fs_extra=require(_0x59b9('0xa'));var _=require('lodash');var squel=require(_0x59b9('0xb'));var crypto=require(_0x59b9('0xc'));var jsforce=require(_0x59b9('0xd'));var deskjs=require(_0x59b9('0xe'));var toCsv=require('to-csv');var querystring=require(_0x59b9('0xf'));var Papa=require(_0x59b9('0x10'));var Redis=require('ioredis');var authService=require(_0x59b9('0x11'));var qs=require(_0x59b9('0x12'));var as=require(_0x59b9('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x59b9('0x14'))(_0x59b9('0x15'));var utils=require(_0x59b9('0x16'));var config=require(_0x59b9('0x17'));var licenseUtil=require(_0x59b9('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1adb23,_0x2c7c53){_0x2c7c53=_0x2c7c53||0xcc;return function(_0x52ffde){if(_0x52ffde){return _0x1adb23[_0x59b9('0x19')](_0x2c7c53);}return _0x1adb23[_0x59b9('0x1a')](_0x2c7c53)['end']();};}function respondWithResult(_0x1592a0,_0x521527){_0x521527=_0x521527||0xc8;return function(_0x148f77){if(_0x148f77){return _0x1592a0[_0x59b9('0x1a')](_0x521527)[_0x59b9('0x1b')](_0x148f77);}};}function respondWithFilteredResult(_0x3ad99e,_0x47774c){return function(_0x3c2c89){if(_0x3c2c89){var _0x194741=typeof _0x47774c[_0x59b9('0x1c')]==='undefined'&&typeof _0x47774c[_0x59b9('0x1d')]==='undefined';var _0x4c4176=_0x3c2c89[_0x59b9('0x1e')];var _0x3668b6=_0x194741?0x0:_0x47774c[_0x59b9('0x1c')];var _0x27bd2f=_0x194741?_0x3c2c89[_0x59b9('0x1e')]:_0x47774c[_0x59b9('0x1c')]+_0x47774c['limit'];var _0x3e1324;if(_0x27bd2f>=_0x4c4176){_0x27bd2f=_0x4c4176;_0x3e1324=0xc8;}else{_0x3e1324=0xce;}_0x3ad99e['status'](_0x3e1324);return _0x3ad99e[_0x59b9('0x1f')](_0x59b9('0x20'),_0x3668b6+'-'+_0x27bd2f+'/'+_0x4c4176)['json'](_0x3c2c89);}return null;};}function patchUpdates(_0x659604){return function(_0x163465){try{jsonpatch['apply'](_0x163465,_0x659604,!![]);}catch(_0x38fa6b){return BPromise['reject'](_0x38fa6b);}return _0x163465[_0x59b9('0x21')]();};}function saveUpdates(_0x466b46,_0x4a5255){return function(_0x53f1a5){if(_0x53f1a5){return _0x53f1a5[_0x59b9('0x22')](_0x466b46)[_0x59b9('0x23')](function(_0x2d0cdd){return _0x2d0cdd;});}return null;};}function removeEntity(_0x1ef329,_0x2b0239){return function(_0x3be726){if(_0x3be726){return _0x3be726['destroy']()['then'](function(){var _0xd2f002=_0x3be726[_0x59b9('0x24')]({'plain':!![]});var _0x5956ee='Templates';return db[_0x59b9('0x25')][_0x59b9('0x26')]({'where':{'type':_0x5956ee,'resourceId':_0xd2f002['id']}})[_0x59b9('0x23')](function(){return _0x3be726;});})[_0x59b9('0x23')](function(){_0x1ef329['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f84f7,_0x5a3a74){return function(_0x2606b8){if(!_0x2606b8){_0x4f84f7[_0x59b9('0x19')](0x194);}return _0x2606b8;};}function handleError(_0x443cbe,_0x46a34a){_0x46a34a=_0x46a34a||0x1f4;return function(_0x2dce68){logger[_0x59b9('0x27')](_0x2dce68['stack']);if(_0x2dce68[_0x59b9('0x28')]){delete _0x2dce68[_0x59b9('0x28')];}_0x443cbe[_0x59b9('0x1a')](_0x46a34a)[_0x59b9('0x29')](_0x2dce68);};}exports[_0x59b9('0x2a')]=function(_0x51d310,_0x4ae442){var _0x4426be={},_0x390ffc={},_0x623fb4={'count':0x0,'rows':[]};var _0x1a5c99=_[_0x59b9('0x2b')](db[_0x59b9('0x2c')][_0x59b9('0x2d')],function(_0x26473b){return{'name':_0x26473b[_0x59b9('0x2e')],'type':_0x26473b[_0x59b9('0x2f')][_0x59b9('0x30')]};});_0x390ffc[_0x59b9('0x31')]=_[_0x59b9('0x2b')](_0x1a5c99,_0x59b9('0x28'));_0x390ffc['query']=_[_0x59b9('0x32')](_0x51d310[_0x59b9('0x33')]);_0x390ffc[_0x59b9('0x34')]=_['intersection'](_0x390ffc[_0x59b9('0x31')],_0x390ffc['query']);_0x4426be['attributes']=_[_0x59b9('0x35')](_0x390ffc[_0x59b9('0x31')],qs[_0x59b9('0x36')](_0x51d310[_0x59b9('0x33')][_0x59b9('0x36')]));_0x4426be[_0x59b9('0x37')]=_0x4426be[_0x59b9('0x37')]['length']?_0x4426be['attributes']:_0x390ffc[_0x59b9('0x31')];if(!_0x51d310['query'][_0x59b9('0x38')](_0x59b9('0x39'))){_0x4426be[_0x59b9('0x1d')]=qs[_0x59b9('0x1d')](_0x51d310[_0x59b9('0x33')]['limit']);_0x4426be[_0x59b9('0x1c')]=qs['offset'](_0x51d310['query']['offset']);}_0x4426be['order']=qs['sort'](_0x51d310[_0x59b9('0x33')]['sort']);_0x4426be[_0x59b9('0x3a')]=qs[_0x59b9('0x34')](_['pick'](_0x51d310[_0x59b9('0x33')],_0x390ffc[_0x59b9('0x34')]),_0x1a5c99);if(_0x51d310['query'][_0x59b9('0x3b')]){_0x4426be[_0x59b9('0x3a')]=_['merge'](_0x4426be[_0x59b9('0x3a')],{'$or':_['map'](_0x1a5c99,function(_0x309992){if(_0x309992[_0x59b9('0x2f')]!=='VIRTUAL'){var _0x38fccb={};_0x38fccb[_0x309992[_0x59b9('0x28')]]={'$like':'%'+_0x51d310[_0x59b9('0x33')][_0x59b9('0x3b')]+'%'};return _0x38fccb;}})});}_0x4426be=_[_0x59b9('0x3c')]({},_0x4426be,_0x51d310[_0x59b9('0x3d')]);var _0x4d002d={'where':_0x4426be['where']};return db[_0x59b9('0x2c')][_0x59b9('0x1e')](_0x4d002d)[_0x59b9('0x23')](function(_0x5de33a){_0x623fb4['count']=_0x5de33a;if(_0x51d310['query'][_0x59b9('0x3e')]){_0x4426be[_0x59b9('0x3f')]=[{'all':!![]}];}return db['Template']['findAll'](_0x4426be);})[_0x59b9('0x23')](function(_0x185cde){_0x623fb4[_0x59b9('0x40')]=_0x185cde;return _0x623fb4;})['then'](respondWithFilteredResult(_0x4ae442,_0x4426be))[_0x59b9('0x41')](handleError(_0x4ae442,null));};exports[_0x59b9('0x42')]=function(_0x56ba23,_0x1304ba){var _0x54cdcf={'raw':!![],'where':{'id':_0x56ba23[_0x59b9('0x43')]['id']}},_0x1704ba={};_0x1704ba[_0x59b9('0x31')]=_[_0x59b9('0x32')](db[_0x59b9('0x2c')][_0x59b9('0x2d')]);_0x1704ba['query']=_[_0x59b9('0x32')](_0x56ba23[_0x59b9('0x33')]);_0x1704ba['filters']=_[_0x59b9('0x35')](_0x1704ba[_0x59b9('0x31')],_0x1704ba['query']);_0x54cdcf[_0x59b9('0x37')]=_['intersection'](_0x1704ba[_0x59b9('0x31')],qs[_0x59b9('0x36')](_0x56ba23[_0x59b9('0x33')]['fields']));_0x54cdcf[_0x59b9('0x37')]=_0x54cdcf[_0x59b9('0x37')][_0x59b9('0x44')]?_0x54cdcf['attributes']:_0x1704ba[_0x59b9('0x31')];if(_0x56ba23[_0x59b9('0x33')][_0x59b9('0x3e')]){_0x54cdcf[_0x59b9('0x3f')]=[{'all':!![]}];}_0x54cdcf=_['merge']({},_0x54cdcf,_0x56ba23[_0x59b9('0x3d')]);return db[_0x59b9('0x2c')][_0x59b9('0x45')](_0x54cdcf)[_0x59b9('0x23')](handleEntityNotFound(_0x1304ba,null))[_0x59b9('0x23')](respondWithResult(_0x1304ba,null))[_0x59b9('0x41')](handleError(_0x1304ba,null));};exports[_0x59b9('0x46')]=function(_0x1f3e76,_0x5207d8){return db[_0x59b9('0x2c')]['create'](_0x1f3e76[_0x59b9('0x47')],{})[_0x59b9('0x23')](function(_0x494cde){var _0xd24357=_0x1f3e76[_0x59b9('0x48')][_0x59b9('0x24')]({'plain':!![]});if(!_0xd24357)throw new Error(_0x59b9('0x49'));if(_0xd24357[_0x59b9('0x4a')]==='user'){var _0x1cd41f=_0x494cde[_0x59b9('0x24')]({'plain':!![]});var _0x398fc0=_0x59b9('0x4b');return db[_0x59b9('0x4c')]['find']({'where':{'name':_0x398fc0,'userProfileId':_0xd24357['userProfileId']},'raw':!![]})['then'](function(_0x4fbb44){if(_0x4fbb44&&_0x4fbb44[_0x59b9('0x4d')]===0x0){return db[_0x59b9('0x25')][_0x59b9('0x46')]({'name':_0x1cd41f[_0x59b9('0x28')],'resourceId':_0x1cd41f['id'],'type':_0x4fbb44[_0x59b9('0x28')],'sectionId':_0x4fbb44['id']},{})[_0x59b9('0x23')](function(){return _0x494cde;});}else{return _0x494cde;}})[_0x59b9('0x41')](function(_0x312496){logger[_0x59b9('0x27')](_0x59b9('0x4e'),_0x312496);throw _0x312496;});}return _0x494cde;})[_0x59b9('0x23')](respondWithResult(_0x5207d8,0xc9))[_0x59b9('0x41')](handleError(_0x5207d8,null));};exports['update']=function(_0x58384c,_0x4db0dc){if(_0x58384c[_0x59b9('0x47')]['id']){delete _0x58384c[_0x59b9('0x47')]['id'];}return db[_0x59b9('0x2c')]['find']({'where':{'id':_0x58384c[_0x59b9('0x43')]['id']}})['then'](handleEntityNotFound(_0x4db0dc,null))['then'](saveUpdates(_0x58384c[_0x59b9('0x47')],null))[_0x59b9('0x23')](respondWithResult(_0x4db0dc,null))[_0x59b9('0x41')](handleError(_0x4db0dc,null));};exports['destroy']=function(_0x5abc95,_0x9814ff){return db['Template']['find']({'where':{'id':_0x5abc95['params']['id']}})[_0x59b9('0x23')](handleEntityNotFound(_0x9814ff,null))[_0x59b9('0x23')](removeEntity(_0x9814ff,null))['catch'](handleError(_0x9814ff,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 8e56208..0110ddf 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 _0xa38c=['tools_templates','util','../../config/logger','moment','bluebird','request-promise','path','exports','define','Template'];(function(_0xf73c09,_0x4e424e){var _0xa8923c=function(_0x4831c1){while(--_0x4831c1){_0xf73c09['push'](_0xf73c09['shift']());}};_0xa8923c(++_0x4e424e);}(_0xa38c,0x8d));var _0xca38=function(_0x1c4782,_0x1e01ba){_0x1c4782=_0x1c4782-0x0;var _0x254980=_0xa38c[_0x1c4782];return _0x254980;};'use strict';var _=require('lodash');var util=require(_0xca38('0x0'));var logger=require(_0xca38('0x1'))('api');var moment=require(_0xca38('0x2'));var BPromise=require(_0xca38('0x3'));var rp=require(_0xca38('0x4'));var fs=require('fs');var path=require(_0xca38('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./template.attributes');module[_0xca38('0x6')]=function(_0x313e10,_0x140403){return _0x313e10[_0xca38('0x7')](_0xca38('0x8'),attributes,{'tableName':_0xca38('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5bcd=['tools_templates','lodash','util','api','moment','bluebird','path','rimraf','./template.attributes','define','Template'];(function(_0x32be82,_0x21b592){var _0x35aa04=function(_0x3d59ca){while(--_0x3d59ca){_0x32be82['push'](_0x32be82['shift']());}};_0x35aa04(++_0x21b592);}(_0x5bcd,0x1ae));var _0xd5bc=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0x5bcd[_0x1b349a];return _0x5d1f7c;};'use strict';var _=require(_0xd5bc('0x0'));var util=require(_0xd5bc('0x1'));var logger=require('../../config/logger')(_0xd5bc('0x2'));var moment=require(_0xd5bc('0x3'));var BPromise=require(_0xd5bc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd5bc('0x5'));var rimraf=require(_0xd5bc('0x6'));var config=require('../../config/environment');var attributes=require(_0xd5bc('0x7'));module['exports']=function(_0x43ce6e,_0x42b041){return _0x43ce6e[_0xd5bc('0x8')](_0xd5bc('0x9'),attributes,{'tableName':_0xd5bc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index 42de67b..939c581 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 _0xcf9d=['stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','error','code','message','Template,\x20%s,\x20%s','result','catch','GetTemplate','findAll','options','raw','where','attributes','limit','include','map','model'];(function(_0xf2ab1c,_0x308826){var _0x210ffd=function(_0x101a2b){while(--_0x101a2b){_0xf2ab1c['push'](_0xf2ab1c['shift']());}};_0x210ffd(++_0x308826);}(_0xcf9d,0x1ae));var _0xdcf9=function(_0x2b3648,_0x490851){_0x2b3648=_0x2b3648-0x0;var _0x551f94=_0xcf9d[_0x2b3648];return _0x551f94;};'use strict';var _=require('lodash');var util=require(_0xdcf9('0x0'));var moment=require(_0xdcf9('0x1'));var BPromise=require(_0xdcf9('0x2'));var rs=require(_0xdcf9('0x3'));var fs=require('fs');var Redis=require(_0xdcf9('0x4'));var db=require(_0xdcf9('0x5'))['db'];var utils=require(_0xdcf9('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xdcf9('0x7'));var jayson=require(_0xdcf9('0x8'));var client=jayson['client'][_0xdcf9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x56efb2,_0xf78464,_0x9da4e2){return new BPromise(function(_0x54d1fd,_0x59621d){return client[_0xdcf9('0xa')](_0x56efb2,_0x9da4e2)[_0xdcf9('0xb')](function(_0x50f1b8){logger[_0xdcf9('0xc')]('Template,\x20%s,\x20%s',_0xf78464,_0xdcf9('0xd'));logger[_0xdcf9('0xe')](_0xdcf9('0xf'),_0xf78464,_0xdcf9('0xd'),JSON['stringify'](_0x50f1b8));if(_0x50f1b8[_0xdcf9('0x10')]){if(_0x50f1b8['error'][_0xdcf9('0x11')]===0x1f4){logger[_0xdcf9('0x10')]('Template,\x20%s,\x20%s',_0xf78464,_0x50f1b8[_0xdcf9('0x10')][_0xdcf9('0x12')]);return _0x59621d(_0x50f1b8['error'][_0xdcf9('0x12')]);}logger['error']('Template,\x20%s,\x20%s',_0xf78464,_0x50f1b8[_0xdcf9('0x10')]['message']);return _0x54d1fd(_0x50f1b8['error'][_0xdcf9('0x12')]);}else{logger[_0xdcf9('0xc')](_0xdcf9('0x13'),_0xf78464,_0xdcf9('0xd'));_0x54d1fd(_0x50f1b8[_0xdcf9('0x14')]['message']);}})[_0xdcf9('0x15')](function(_0x544ab1){logger[_0xdcf9('0x10')]('Template,\x20%s,\x20%s',_0xf78464,_0x544ab1);_0x59621d(_0x544ab1);});});}exports[_0xdcf9('0x16')]=function(_0x28cb5c){var _0x300a50=this;return new Promise(function(_0x5088bd,_0x3db447){return db['Template'][_0xdcf9('0x17')]({'raw':_0x28cb5c['options']?_0x28cb5c[_0xdcf9('0x18')][_0xdcf9('0x19')]===undefined?!![]:![]:!![],'where':_0x28cb5c[_0xdcf9('0x18')]?_0x28cb5c[_0xdcf9('0x18')][_0xdcf9('0x1a')]||null:null,'attributes':_0x28cb5c[_0xdcf9('0x18')]?_0x28cb5c[_0xdcf9('0x18')][_0xdcf9('0x1b')]||null:null,'limit':_0x28cb5c[_0xdcf9('0x18')]?_0x28cb5c['options'][_0xdcf9('0x1c')]||null:null,'include':_0x28cb5c[_0xdcf9('0x18')]?_0x28cb5c['options'][_0xdcf9('0x1d')]?_[_0xdcf9('0x1e')](_0x28cb5c[_0xdcf9('0x18')]['include'],function(_0x12688f){return{'model':db[_0x12688f[_0xdcf9('0x1f')]],'as':_0x12688f['as'],'attributes':_0x12688f[_0xdcf9('0x1b')],'include':_0x12688f[_0xdcf9('0x1d')]?_[_0xdcf9('0x1e')](_0x12688f['include'],function(_0x1051d3){return{'model':db[_0x1051d3[_0xdcf9('0x1f')]],'as':_0x1051d3['as'],'attributes':_0x1051d3['attributes'],'include':_0x1051d3[_0xdcf9('0x1d')]?_[_0xdcf9('0x1e')](_0x1051d3[_0xdcf9('0x1d')],function(_0x513651){return{'model':db[_0x513651['model']],'as':_0x513651['as'],'attributes':_0x513651[_0xdcf9('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xdcf9('0xb')](function(_0x57f405){logger[_0xdcf9('0xc')](_0xdcf9('0x16'),_0x28cb5c);logger[_0xdcf9('0xe')]('GetTemplate',_0x28cb5c,JSON[_0xdcf9('0x20')](_0x57f405));_0x5088bd(_0x57f405);})[_0xdcf9('0x15')](function(_0x473c66){logger['error'](_0xdcf9('0x16'),_0x473c66[_0xdcf9('0x12')],_0x28cb5c);_0x3db447(_0x300a50[_0xdcf9('0x10')](0x1f4,_0x473c66['message']));});});}; \ No newline at end of file +var _0x0d9e=['request\x20sent','error','message','result','catch','GetTemplate','Template','options','raw','attributes','limit','include','map','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','Template,\x20%s,\x20%s','debug','Template,\x20%s,\x20%s,\x20%s'];(function(_0x390da6,_0x5d43a5){var _0x456107=function(_0x28c53b){while(--_0x28c53b){_0x390da6['push'](_0x390da6['shift']());}};_0x456107(++_0x5d43a5);}(_0x0d9e,0x14c));var _0xe0d9=function(_0x59bd6b,_0x4e653f){_0x59bd6b=_0x59bd6b-0x0;var _0x61afe=_0x0d9e[_0x59bd6b];return _0x61afe;};'use strict';var _=require(_0xe0d9('0x0'));var util=require(_0xe0d9('0x1'));var moment=require(_0xe0d9('0x2'));var BPromise=require(_0xe0d9('0x3'));var rs=require(_0xe0d9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe0d9('0x5'))['db'];var utils=require(_0xe0d9('0x6'));var logger=require(_0xe0d9('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe0d9('0x8'));var client=jayson['client'][_0xe0d9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x341bb1,_0x183bd9,_0x2320a5){return new BPromise(function(_0x2ec4d4,_0x39a611){return client[_0xe0d9('0xa')](_0x341bb1,_0x2320a5)[_0xe0d9('0xb')](function(_0x4eb561){logger[_0xe0d9('0xc')](_0xe0d9('0xd'),_0x183bd9,'request\x20sent');logger[_0xe0d9('0xe')](_0xe0d9('0xf'),_0x183bd9,_0xe0d9('0x10'),JSON['stringify'](_0x4eb561));if(_0x4eb561[_0xe0d9('0x11')]){if(_0x4eb561[_0xe0d9('0x11')]['code']===0x1f4){logger['error']('Template,\x20%s,\x20%s',_0x183bd9,_0x4eb561[_0xe0d9('0x11')]['message']);return _0x39a611(_0x4eb561[_0xe0d9('0x11')][_0xe0d9('0x12')]);}logger['error'](_0xe0d9('0xd'),_0x183bd9,_0x4eb561[_0xe0d9('0x11')]['message']);return _0x2ec4d4(_0x4eb561[_0xe0d9('0x11')]['message']);}else{logger[_0xe0d9('0xc')](_0xe0d9('0xd'),_0x183bd9,'request\x20sent');_0x2ec4d4(_0x4eb561[_0xe0d9('0x13')][_0xe0d9('0x12')]);}})[_0xe0d9('0x14')](function(_0x8284c3){logger[_0xe0d9('0x11')](_0xe0d9('0xd'),_0x183bd9,_0x8284c3);_0x39a611(_0x8284c3);});});}exports[_0xe0d9('0x15')]=function(_0x51895b){var _0x1b1f44=this;return new Promise(function(_0x5bba4c,_0x39d067){return db[_0xe0d9('0x16')]['findAll']({'raw':_0x51895b[_0xe0d9('0x17')]?_0x51895b[_0xe0d9('0x17')][_0xe0d9('0x18')]===undefined?!![]:![]:!![],'where':_0x51895b['options']?_0x51895b[_0xe0d9('0x17')]['where']||null:null,'attributes':_0x51895b[_0xe0d9('0x17')]?_0x51895b['options'][_0xe0d9('0x19')]||null:null,'limit':_0x51895b[_0xe0d9('0x17')]?_0x51895b['options'][_0xe0d9('0x1a')]||null:null,'include':_0x51895b['options']?_0x51895b[_0xe0d9('0x17')][_0xe0d9('0x1b')]?_[_0xe0d9('0x1c')](_0x51895b[_0xe0d9('0x17')]['include'],function(_0xde1569){return{'model':db[_0xde1569['model']],'as':_0xde1569['as'],'attributes':_0xde1569['attributes'],'include':_0xde1569[_0xe0d9('0x1b')]?_[_0xe0d9('0x1c')](_0xde1569[_0xe0d9('0x1b')],function(_0x1215e0){return{'model':db[_0x1215e0['model']],'as':_0x1215e0['as'],'attributes':_0x1215e0[_0xe0d9('0x19')],'include':_0x1215e0['include']?_[_0xe0d9('0x1c')](_0x1215e0[_0xe0d9('0x1b')],function(_0x2fa302){return{'model':db[_0x2fa302['model']],'as':_0x2fa302['as'],'attributes':_0x2fa302[_0xe0d9('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4b4ea7){logger['info']('GetTemplate',_0x51895b);logger['debug']('GetTemplate',_0x51895b,JSON['stringify'](_0x4b4ea7));_0x5bba4c(_0x4b4ea7);})[_0xe0d9('0x14')](function(_0x3c645e){logger[_0xe0d9('0x11')]('GetTemplate',_0x3c645e[_0xe0d9('0x12')],_0x51895b);_0x39d067(_0x1b1f44[_0xe0d9('0x11')](0x1f4,_0x3c645e[_0xe0d9('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 59138b8..37cc9ae 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 _0x75a2=['update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','/:id','/:id/all_conditions','getAnyConditions','getActions','post','create','addAllCondition','addAnyCondition','/:id/actions','addAction','put'];(function(_0x9aab40,_0x41367c){var _0x2bd78d=function(_0x2999cd){while(--_0x2999cd){_0x9aab40['push'](_0x9aab40['shift']());}};_0x2bd78d(++_0x41367c);}(_0x75a2,0x85));var _0x275a=function(_0x301d01,_0x5f14b2){_0x301d01=_0x301d01-0x0;var _0x4b3439=_0x75a2[_0x301d01];return _0x4b3439;};'use strict';var multer=require(_0x275a('0x0'));var util=require(_0x275a('0x1'));var path=require(_0x275a('0x2'));var timeout=require(_0x275a('0x3'));var express=require(_0x275a('0x4'));var router=express['Router']();var fs_extra=require(_0x275a('0x5'));var auth=require(_0x275a('0x6'));var interaction=require(_0x275a('0x7'));var config=require(_0x275a('0x8'));var controller=require(_0x275a('0x9'));router[_0x275a('0xa')]('/',auth[_0x275a('0xb')](),controller['index']);router[_0x275a('0xa')](_0x275a('0xc'),auth[_0x275a('0xb')](),controller['show']);router[_0x275a('0xa')](_0x275a('0xd'),auth[_0x275a('0xb')](),controller['getAllConditions']);router[_0x275a('0xa')]('/:id/any_conditions',auth['isAuthenticated'](),controller[_0x275a('0xe')]);router['get']('/:id/actions',auth['isAuthenticated'](),controller[_0x275a('0xf')]);router[_0x275a('0x10')]('/',auth[_0x275a('0xb')](),controller[_0x275a('0x11')]);router['post']('/:id/all_conditions',auth[_0x275a('0xb')](),controller[_0x275a('0x12')]);router[_0x275a('0x10')]('/:id/any_conditions',auth[_0x275a('0xb')](),controller[_0x275a('0x13')]);router[_0x275a('0x10')](_0x275a('0x14'),auth[_0x275a('0xb')](),controller[_0x275a('0x15')]);router[_0x275a('0x16')](_0x275a('0xc'),auth[_0x275a('0xb')](),controller[_0x275a('0x17')]);router[_0x275a('0x18')](_0x275a('0xc'),auth[_0x275a('0xb')](),controller[_0x275a('0x19')]);module['exports']=router; \ No newline at end of file +var _0x17a5=['get','isAuthenticated','/:id','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','create','addAllCondition','addAnyCondition','addAction','update','delete','destroy','exports','util','path','express','fs-extra','../../components/interaction/service','./trigger.controller'];(function(_0x34b888,_0x2afae9){var _0x5c6703=function(_0x389a6d){while(--_0x389a6d){_0x34b888['push'](_0x34b888['shift']());}};_0x5c6703(++_0x2afae9);}(_0x17a5,0x1d5));var _0x517a=function(_0x4025df,_0x5bdc3a){_0x4025df=_0x4025df-0x0;var _0x3caeca=_0x17a5[_0x4025df];return _0x3caeca;};'use strict';var multer=require('multer');var util=require(_0x517a('0x0'));var path=require(_0x517a('0x1'));var timeout=require('connect-timeout');var express=require(_0x517a('0x2'));var router=express['Router']();var fs_extra=require(_0x517a('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x517a('0x4'));var config=require('../../config/environment');var controller=require(_0x517a('0x5'));router[_0x517a('0x6')]('/',auth[_0x517a('0x7')](),controller['index']);router[_0x517a('0x6')](_0x517a('0x8'),auth[_0x517a('0x7')](),controller[_0x517a('0x9')]);router[_0x517a('0x6')](_0x517a('0xa'),auth[_0x517a('0x7')](),controller[_0x517a('0xb')]);router[_0x517a('0x6')](_0x517a('0xc'),auth[_0x517a('0x7')](),controller[_0x517a('0xd')]);router[_0x517a('0x6')](_0x517a('0xe'),auth['isAuthenticated'](),controller[_0x517a('0xf')]);router[_0x517a('0x10')]('/',auth['isAuthenticated'](),controller[_0x517a('0x11')]);router[_0x517a('0x10')](_0x517a('0xa'),auth[_0x517a('0x7')](),controller[_0x517a('0x12')]);router[_0x517a('0x10')]('/:id/any_conditions',auth[_0x517a('0x7')](),controller[_0x517a('0x13')]);router[_0x517a('0x10')](_0x517a('0xe'),auth['isAuthenticated'](),controller[_0x517a('0x14')]);router['put'](_0x517a('0x8'),auth[_0x517a('0x7')](),controller[_0x517a('0x15')]);router[_0x517a('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x517a('0x17')]);module[_0x517a('0x18')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index da763ee..db4fc52 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 _0xd083=['exports','STRING','BOOLEAN','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd083,0x19b));var _0x3d08=function(_0x11ca63,_0xea9f9c){_0x11ca63=_0x11ca63-0x0;var _0x41f1f6=_0xd083[_0x11ca63];return _0x41f1f6;};'use strict';var Sequelize=require(_0x3d08('0x0'));module[_0x3d08('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3d08('0x2')]},'status':{'type':Sequelize[_0x3d08('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x8f35=['exports','STRING','BOOLEAN','sequelize'];(function(_0x166ba2,_0x165751){var _0x19d4ba=function(_0x34a40d){while(--_0x34a40d){_0x166ba2['push'](_0x166ba2['shift']());}};_0x19d4ba(++_0x165751);}(_0x8f35,0x107));var _0x58f3=function(_0x11c573,_0x9e7c6e){_0x11c573=_0x11c573-0x0;var _0x6b72de=_0x8f35[_0x11c573];return _0x6b72de;};'use strict';var Sequelize=require(_0x58f3('0x0'));module[_0x58f3('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x58f3('0x2')]},'description':{'type':Sequelize[_0x58f3('0x2')]},'status':{'type':Sequelize[_0x58f3('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index fe01acb..ca00221 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 _0xe1f7=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/license/util','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','Triggers','UserProfileResource','sendStatus','error','stack','name','index','map','Trigger','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','find','catch','create','body','user','role','get','userProfileId','autoAssociation','addAllCondition','Condition','addAnyCondition','TriggerAnyId','findOne','rawAttributes','order','getAllConditions','addAction','TriggerId','Action','getActions'];(function(_0x4a972d,_0xff9622){var _0x54267c=function(_0x21135b){while(--_0x21135b){_0x4a972d['push'](_0x4a972d['shift']());}};_0x54267c(++_0xff9622);}(_0xe1f7,0x168));var _0x7e1f=function(_0x35b195,_0x8893d5){_0x35b195=_0x35b195-0x0;var _0x2433bf=_0xe1f7[_0x35b195];return _0x2433bf;};'use strict';var emlformat=require(_0x7e1f('0x0'));var rimraf=require(_0x7e1f('0x1'));var zipdir=require(_0x7e1f('0x2'));var jsonpatch=require(_0x7e1f('0x3'));var rp=require(_0x7e1f('0x4'));var moment=require(_0x7e1f('0x5'));var BPromise=require(_0x7e1f('0x6'));var Mustache=require(_0x7e1f('0x7'));var util=require(_0x7e1f('0x8'));var path=require('path');var sox=require(_0x7e1f('0x9'));var csv=require('to-csv');var ejs=require(_0x7e1f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7e1f('0xb'));var squel=require('squel');var crypto=require(_0x7e1f('0xc'));var jsforce=require(_0x7e1f('0xd'));var deskjs=require(_0x7e1f('0xe'));var toCsv=require(_0x7e1f('0xf'));var querystring=require('querystring');var Papa=require(_0x7e1f('0x10'));var Redis=require(_0x7e1f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x7e1f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7e1f('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x7e1f('0x14'));var licenseUtil=require(_0x7e1f('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x47f9b0,_0x1e74dc){_0x1e74dc=_0x1e74dc||0xcc;return function(_0x296441){if(_0x296441){return _0x47f9b0['sendStatus'](_0x1e74dc);}return _0x47f9b0[_0x7e1f('0x16')](_0x1e74dc)[_0x7e1f('0x17')]();};}function respondWithResult(_0x405f66,_0xd1622a){_0xd1622a=_0xd1622a||0xc8;return function(_0x7e096b){if(_0x7e096b){return _0x405f66['status'](_0xd1622a)[_0x7e1f('0x18')](_0x7e096b);}};}function respondWithFilteredResult(_0x30fa00,_0x4654c5){return function(_0x358518){if(_0x358518){var _0x5dd5cb=typeof _0x4654c5[_0x7e1f('0x19')]==='undefined'&&typeof _0x4654c5[_0x7e1f('0x1a')]===_0x7e1f('0x1b');var _0x54f302=_0x358518[_0x7e1f('0x1c')];var _0x120800=_0x5dd5cb?0x0:_0x4654c5[_0x7e1f('0x19')];var _0x38f3be=_0x5dd5cb?_0x358518['count']:_0x4654c5[_0x7e1f('0x19')]+_0x4654c5[_0x7e1f('0x1a')];var _0x34a7c2;if(_0x38f3be>=_0x54f302){_0x38f3be=_0x54f302;_0x34a7c2=0xc8;}else{_0x34a7c2=0xce;}_0x30fa00[_0x7e1f('0x16')](_0x34a7c2);return _0x30fa00[_0x7e1f('0x1d')](_0x7e1f('0x1e'),_0x120800+'-'+_0x38f3be+'/'+_0x54f302)[_0x7e1f('0x18')](_0x358518);}return null;};}function patchUpdates(_0x13e0ad){return function(_0x5ec5db){try{jsonpatch[_0x7e1f('0x1f')](_0x5ec5db,_0x13e0ad,!![]);}catch(_0x207ca4){return BPromise['reject'](_0x207ca4);}return _0x5ec5db[_0x7e1f('0x20')]();};}function saveUpdates(_0x482551,_0x13a8fa){return function(_0x3cf89c){if(_0x3cf89c){return _0x3cf89c[_0x7e1f('0x21')](_0x482551)[_0x7e1f('0x22')](function(_0x202d23){return _0x202d23;});}return null;};}function removeEntity(_0x52c6da,_0x312544){return function(_0x1e6611){if(_0x1e6611){return _0x1e6611[_0x7e1f('0x23')]()['then'](function(){var _0x5cfe67=_0x1e6611['get']({'plain':!![]});var _0x16f03e=_0x7e1f('0x24');return db[_0x7e1f('0x25')][_0x7e1f('0x23')]({'where':{'type':_0x16f03e,'resourceId':_0x5cfe67['id']}})[_0x7e1f('0x22')](function(){return _0x1e6611;});})[_0x7e1f('0x22')](function(){_0x52c6da[_0x7e1f('0x16')](0xcc)[_0x7e1f('0x17')]();});}};}function handleEntityNotFound(_0x253f0e,_0x53b8aa){return function(_0x3cb307){if(!_0x3cb307){_0x253f0e[_0x7e1f('0x26')](0x194);}return _0x3cb307;};}function handleError(_0x15c033,_0x14d626){_0x14d626=_0x14d626||0x1f4;return function(_0x486ae5){logger[_0x7e1f('0x27')](_0x486ae5[_0x7e1f('0x28')]);if(_0x486ae5[_0x7e1f('0x29')]){delete _0x486ae5[_0x7e1f('0x29')];}_0x15c033[_0x7e1f('0x16')](_0x14d626)['send'](_0x486ae5);};}exports[_0x7e1f('0x2a')]=function(_0x2eae59,_0x1f4305){var _0x3cb4fe={},_0x1d7783={},_0x2dcac5={'count':0x0,'rows':[]};var _0x43e485=_[_0x7e1f('0x2b')](db[_0x7e1f('0x2c')]['rawAttributes'],function(_0x397fc4){return{'name':_0x397fc4[_0x7e1f('0x2d')],'type':_0x397fc4['type'][_0x7e1f('0x2e')]};});_0x1d7783[_0x7e1f('0x2f')]=_[_0x7e1f('0x2b')](_0x43e485,'name');_0x1d7783[_0x7e1f('0x30')]=_[_0x7e1f('0x31')](_0x2eae59[_0x7e1f('0x30')]);_0x1d7783[_0x7e1f('0x32')]=_['intersection'](_0x1d7783[_0x7e1f('0x2f')],_0x1d7783[_0x7e1f('0x30')]);_0x3cb4fe[_0x7e1f('0x33')]=_[_0x7e1f('0x34')](_0x1d7783[_0x7e1f('0x2f')],qs['fields'](_0x2eae59[_0x7e1f('0x30')][_0x7e1f('0x35')]));_0x3cb4fe[_0x7e1f('0x33')]=_0x3cb4fe[_0x7e1f('0x33')][_0x7e1f('0x36')]?_0x3cb4fe['attributes']:_0x1d7783[_0x7e1f('0x2f')];if(!_0x2eae59[_0x7e1f('0x30')][_0x7e1f('0x37')](_0x7e1f('0x38'))){_0x3cb4fe[_0x7e1f('0x1a')]=qs[_0x7e1f('0x1a')](_0x2eae59[_0x7e1f('0x30')][_0x7e1f('0x1a')]);_0x3cb4fe['offset']=qs[_0x7e1f('0x19')](_0x2eae59[_0x7e1f('0x30')]['offset']);}_0x3cb4fe['order']=qs[_0x7e1f('0x39')](_0x2eae59[_0x7e1f('0x30')]['sort']);_0x3cb4fe[_0x7e1f('0x3a')]=qs[_0x7e1f('0x32')](_[_0x7e1f('0x3b')](_0x2eae59[_0x7e1f('0x30')],_0x1d7783[_0x7e1f('0x32')]),_0x43e485);if(_0x2eae59[_0x7e1f('0x30')][_0x7e1f('0x3c')]){_0x3cb4fe[_0x7e1f('0x3a')]=_[_0x7e1f('0x3d')](_0x3cb4fe[_0x7e1f('0x3a')],{'$or':_[_0x7e1f('0x2b')](_0x43e485,function(_0x57bd7e){if(_0x57bd7e['type']!==_0x7e1f('0x3e')){var _0x48fc17={};_0x48fc17[_0x57bd7e[_0x7e1f('0x29')]]={'$like':'%'+_0x2eae59[_0x7e1f('0x30')][_0x7e1f('0x3c')]+'%'};return _0x48fc17;}})});}_0x3cb4fe=_[_0x7e1f('0x3d')]({},_0x3cb4fe,_0x2eae59[_0x7e1f('0x3f')]);var _0x32a24e={'where':_0x3cb4fe[_0x7e1f('0x3a')]};return db[_0x7e1f('0x2c')][_0x7e1f('0x1c')](_0x32a24e)[_0x7e1f('0x22')](function(_0x5c049c){_0x2dcac5[_0x7e1f('0x1c')]=_0x5c049c;if(_0x2eae59['query'][_0x7e1f('0x40')]){_0x3cb4fe[_0x7e1f('0x41')]=[{'all':!![]}];}return db[_0x7e1f('0x2c')]['findAll'](_0x3cb4fe);})[_0x7e1f('0x22')](function(_0x554663){_0x2dcac5[_0x7e1f('0x42')]=_0x554663;return _0x2dcac5;})['then'](respondWithFilteredResult(_0x1f4305,_0x3cb4fe))['catch'](handleError(_0x1f4305,null));};exports[_0x7e1f('0x43')]=function(_0x28f9bd,_0x594db6){var _0x1a8611={'raw':![],'where':{'id':_0x28f9bd[_0x7e1f('0x44')]['id']}},_0x4c63c7={};_0x4c63c7['model']=_[_0x7e1f('0x31')](db[_0x7e1f('0x2c')]['rawAttributes']);_0x4c63c7['query']=_[_0x7e1f('0x31')](_0x28f9bd[_0x7e1f('0x30')]);_0x4c63c7[_0x7e1f('0x32')]=_[_0x7e1f('0x34')](_0x4c63c7[_0x7e1f('0x2f')],_0x4c63c7[_0x7e1f('0x30')]);_0x1a8611[_0x7e1f('0x33')]=_[_0x7e1f('0x34')](_0x4c63c7[_0x7e1f('0x2f')],qs[_0x7e1f('0x35')](_0x28f9bd['query']['fields']));_0x1a8611[_0x7e1f('0x33')]=_0x1a8611[_0x7e1f('0x33')][_0x7e1f('0x36')]?_0x1a8611[_0x7e1f('0x33')]:_0x4c63c7['model'];if(_0x28f9bd['query'][_0x7e1f('0x40')]){_0x1a8611[_0x7e1f('0x41')]=[{'all':!![]}];}_0x1a8611=_[_0x7e1f('0x3d')]({},_0x1a8611,_0x28f9bd['options']);return db['Trigger'][_0x7e1f('0x45')](_0x1a8611)[_0x7e1f('0x22')](handleEntityNotFound(_0x594db6,null))['then'](respondWithResult(_0x594db6,null))[_0x7e1f('0x46')](handleError(_0x594db6,null));};exports['create']=function(_0x27b3d2,_0x406fad){return db['Trigger'][_0x7e1f('0x47')](_0x27b3d2[_0x7e1f('0x48')],{})[_0x7e1f('0x22')](function(_0x52b7a0){var _0x1a89f3=_0x27b3d2[_0x7e1f('0x49')]['get']({'plain':!![]});if(!_0x1a89f3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1a89f3[_0x7e1f('0x4a')]===_0x7e1f('0x49')){var _0x1b3035=_0x52b7a0[_0x7e1f('0x4b')]({'plain':!![]});var _0x4e9051=_0x7e1f('0x24');return db['UserProfileSection'][_0x7e1f('0x45')]({'where':{'name':_0x4e9051,'userProfileId':_0x1a89f3[_0x7e1f('0x4c')]},'raw':!![]})[_0x7e1f('0x22')](function(_0x2c67d8){if(_0x2c67d8&&_0x2c67d8[_0x7e1f('0x4d')]===0x0){return db[_0x7e1f('0x25')][_0x7e1f('0x47')]({'name':_0x1b3035[_0x7e1f('0x29')],'resourceId':_0x1b3035['id'],'type':_0x2c67d8['name'],'sectionId':_0x2c67d8['id']},{})[_0x7e1f('0x22')](function(){return _0x52b7a0;});}else{return _0x52b7a0;}})[_0x7e1f('0x46')](function(_0x4ad10e){logger[_0x7e1f('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4ad10e);throw _0x4ad10e;});}return _0x52b7a0;})[_0x7e1f('0x22')](respondWithResult(_0x406fad,0xc9))[_0x7e1f('0x46')](handleError(_0x406fad,null));};exports[_0x7e1f('0x21')]=function(_0x30b44d,_0x5b9a80){if(_0x30b44d[_0x7e1f('0x48')]['id']){delete _0x30b44d[_0x7e1f('0x48')]['id'];}return db[_0x7e1f('0x2c')][_0x7e1f('0x45')]({'where':{'id':_0x30b44d[_0x7e1f('0x44')]['id']}})[_0x7e1f('0x22')](handleEntityNotFound(_0x5b9a80,null))['then'](saveUpdates(_0x30b44d[_0x7e1f('0x48')],null))[_0x7e1f('0x22')](respondWithResult(_0x5b9a80,null))[_0x7e1f('0x46')](handleError(_0x5b9a80,null));};exports['destroy']=function(_0x5dd808,_0x19fa54){return db[_0x7e1f('0x2c')][_0x7e1f('0x45')]({'where':{'id':_0x5dd808[_0x7e1f('0x44')]['id']}})['then'](handleEntityNotFound(_0x19fa54,null))['then'](removeEntity(_0x19fa54,null))['catch'](handleError(_0x19fa54,null));};exports[_0x7e1f('0x4e')]=function(_0x591dd8,_0x2beac4,_0x576d87){if(_0x591dd8[_0x7e1f('0x48')]['id']){delete _0x591dd8[_0x7e1f('0x48')]['id'];}return db[_0x7e1f('0x2c')][_0x7e1f('0x45')]({'where':{'id':_0x591dd8[_0x7e1f('0x44')]['id']}})[_0x7e1f('0x22')](handleEntityNotFound(_0x2beac4,null))[_0x7e1f('0x22')](function(_0x3cfdac){if(_0x3cfdac){_0x591dd8['body']['TriggerAllId']=_0x3cfdac['id'];return db[_0x7e1f('0x4f')]['create'](_0x591dd8['body']);}})[_0x7e1f('0x22')](respondWithResult(_0x2beac4,null))[_0x7e1f('0x46')](handleError(_0x2beac4,null));};exports[_0x7e1f('0x50')]=function(_0x3e59f5,_0x27b2b9,_0x44b4a9){if(_0x3e59f5[_0x7e1f('0x48')]['id']){delete _0x3e59f5['body']['id'];}return db[_0x7e1f('0x2c')][_0x7e1f('0x45')]({'where':{'id':_0x3e59f5['params']['id']}})['then'](handleEntityNotFound(_0x27b2b9,null))[_0x7e1f('0x22')](function(_0x295644){if(_0x295644){_0x3e59f5[_0x7e1f('0x48')][_0x7e1f('0x51')]=_0x295644['id'];return db[_0x7e1f('0x4f')][_0x7e1f('0x47')](_0x3e59f5[_0x7e1f('0x48')]);}})['then'](respondWithResult(_0x27b2b9,null))[_0x7e1f('0x46')](handleError(_0x27b2b9,null));};exports['getAllConditions']=function(_0x442906,_0x10d8d2,_0x26b6ca){var _0x11c6aa={};var _0x491cf8={};var _0x3f4c4d;var _0x52d106;return db[_0x7e1f('0x2c')][_0x7e1f('0x52')]({'where':{'id':_0x442906[_0x7e1f('0x44')]['id']}})[_0x7e1f('0x22')](handleEntityNotFound(_0x10d8d2,null))['then'](function(_0x1bac2c){if(_0x1bac2c){_0x3f4c4d=_0x1bac2c;_0x491cf8['model']=_[_0x7e1f('0x31')](db['Condition'][_0x7e1f('0x53')]);_0x491cf8[_0x7e1f('0x30')]=_['keys'](_0x442906['query']);_0x491cf8[_0x7e1f('0x32')]=_[_0x7e1f('0x34')](_0x491cf8[_0x7e1f('0x2f')],_0x491cf8[_0x7e1f('0x30')]);_0x11c6aa[_0x7e1f('0x33')]=_[_0x7e1f('0x34')](_0x491cf8[_0x7e1f('0x2f')],qs[_0x7e1f('0x35')](_0x442906[_0x7e1f('0x30')][_0x7e1f('0x35')]));_0x11c6aa[_0x7e1f('0x33')]=_0x11c6aa[_0x7e1f('0x33')][_0x7e1f('0x36')]?_0x11c6aa[_0x7e1f('0x33')]:_0x491cf8[_0x7e1f('0x2f')];_0x11c6aa[_0x7e1f('0x54')]=qs[_0x7e1f('0x39')](_0x442906[_0x7e1f('0x30')][_0x7e1f('0x39')]);_0x11c6aa[_0x7e1f('0x3a')]=qs[_0x7e1f('0x32')](_[_0x7e1f('0x3b')](_0x442906[_0x7e1f('0x30')],_0x491cf8['filters']));if(_0x442906[_0x7e1f('0x30')]['filter']){_0x11c6aa[_0x7e1f('0x3a')]=_['merge'](_0x11c6aa[_0x7e1f('0x3a')],{'$or':_[_0x7e1f('0x2b')](_0x11c6aa[_0x7e1f('0x33')],function(_0x442f90){var _0x2f7b5b={};_0x2f7b5b[_0x442f90]={'$like':'%'+_0x442906[_0x7e1f('0x30')][_0x7e1f('0x3c')]+'%'};return _0x2f7b5b;})});}_0x11c6aa=_['merge']({},_0x11c6aa,_0x442906[_0x7e1f('0x3f')]);return _0x3f4c4d['getAllConditions'](_0x11c6aa);}})['then'](function(_0x39430a){if(_0x39430a){_0x52d106=_0x39430a[_0x7e1f('0x36')];if(!_0x442906['query'][_0x7e1f('0x37')](_0x7e1f('0x38'))){_0x11c6aa[_0x7e1f('0x1a')]=qs['limit'](_0x442906[_0x7e1f('0x30')]['limit']);_0x11c6aa[_0x7e1f('0x19')]=qs[_0x7e1f('0x19')](_0x442906[_0x7e1f('0x30')][_0x7e1f('0x19')]);}return _0x3f4c4d[_0x7e1f('0x55')](_0x11c6aa);}})[_0x7e1f('0x22')](function(_0x3e7297){if(_0x3e7297){return _0x3e7297?{'count':_0x52d106,'rows':_0x3e7297}:null;}})[_0x7e1f('0x22')](respondWithResult(_0x10d8d2,null))[_0x7e1f('0x46')](handleError(_0x10d8d2,null));};exports['getAnyConditions']=function(_0x3a4b38,_0x571b00,_0x3f3e5a){var _0x12b97a={};var _0x145111={};var _0x3d0ed0;var _0x2dc5c9;return db[_0x7e1f('0x2c')][_0x7e1f('0x52')]({'where':{'id':_0x3a4b38['params']['id']}})[_0x7e1f('0x22')](handleEntityNotFound(_0x571b00,null))[_0x7e1f('0x22')](function(_0x7431e6){if(_0x7431e6){_0x3d0ed0=_0x7431e6;_0x145111['model']=_[_0x7e1f('0x31')](db[_0x7e1f('0x4f')][_0x7e1f('0x53')]);_0x145111[_0x7e1f('0x30')]=_['keys'](_0x3a4b38[_0x7e1f('0x30')]);_0x145111[_0x7e1f('0x32')]=_['intersection'](_0x145111[_0x7e1f('0x2f')],_0x145111[_0x7e1f('0x30')]);_0x12b97a[_0x7e1f('0x33')]=_[_0x7e1f('0x34')](_0x145111[_0x7e1f('0x2f')],qs[_0x7e1f('0x35')](_0x3a4b38[_0x7e1f('0x30')][_0x7e1f('0x35')]));_0x12b97a[_0x7e1f('0x33')]=_0x12b97a[_0x7e1f('0x33')][_0x7e1f('0x36')]?_0x12b97a[_0x7e1f('0x33')]:_0x145111[_0x7e1f('0x2f')];_0x12b97a[_0x7e1f('0x54')]=qs[_0x7e1f('0x39')](_0x3a4b38[_0x7e1f('0x30')]['sort']);_0x12b97a[_0x7e1f('0x3a')]=qs[_0x7e1f('0x32')](_[_0x7e1f('0x3b')](_0x3a4b38[_0x7e1f('0x30')],_0x145111[_0x7e1f('0x32')]));if(_0x3a4b38['query'][_0x7e1f('0x3c')]){_0x12b97a[_0x7e1f('0x3a')]=_[_0x7e1f('0x3d')](_0x12b97a[_0x7e1f('0x3a')],{'$or':_[_0x7e1f('0x2b')](_0x12b97a[_0x7e1f('0x33')],function(_0x1dd4bc){var _0x17609c={};_0x17609c[_0x1dd4bc]={'$like':'%'+_0x3a4b38[_0x7e1f('0x30')][_0x7e1f('0x3c')]+'%'};return _0x17609c;})});}_0x12b97a=_[_0x7e1f('0x3d')]({},_0x12b97a,_0x3a4b38[_0x7e1f('0x3f')]);return _0x3d0ed0['getAnyConditions'](_0x12b97a);}})['then'](function(_0x2580b1){if(_0x2580b1){_0x2dc5c9=_0x2580b1[_0x7e1f('0x36')];if(!_0x3a4b38[_0x7e1f('0x30')][_0x7e1f('0x37')](_0x7e1f('0x38'))){_0x12b97a['limit']=qs['limit'](_0x3a4b38[_0x7e1f('0x30')][_0x7e1f('0x1a')]);_0x12b97a[_0x7e1f('0x19')]=qs[_0x7e1f('0x19')](_0x3a4b38[_0x7e1f('0x30')][_0x7e1f('0x19')]);}return _0x3d0ed0['getAnyConditions'](_0x12b97a);}})[_0x7e1f('0x22')](function(_0x5e8cbc){if(_0x5e8cbc){return _0x5e8cbc?{'count':_0x2dc5c9,'rows':_0x5e8cbc}:null;}})['then'](respondWithResult(_0x571b00,null))[_0x7e1f('0x46')](handleError(_0x571b00,null));};exports[_0x7e1f('0x56')]=function(_0x19968e,_0x3a23fa,_0xbbcfc7){if(_0x19968e[_0x7e1f('0x48')]['id']){delete _0x19968e[_0x7e1f('0x48')]['id'];}return db['Trigger'][_0x7e1f('0x45')]({'where':{'id':_0x19968e[_0x7e1f('0x44')]['id']}})[_0x7e1f('0x22')](handleEntityNotFound(_0x3a23fa,null))[_0x7e1f('0x22')](function(_0x3e2dc6){if(_0x3e2dc6){_0x19968e[_0x7e1f('0x48')][_0x7e1f('0x57')]=_0x3e2dc6['id'];return db[_0x7e1f('0x58')]['create'](_0x19968e[_0x7e1f('0x48')]);}})[_0x7e1f('0x22')](respondWithResult(_0x3a23fa,null))[_0x7e1f('0x46')](handleError(_0x3a23fa,null));};exports[_0x7e1f('0x59')]=function(_0x336ad5,_0x1c8a3c,_0xf7bffb){var _0xbcbd9f={};var _0x18fd39={};var _0x5d0e28;var _0x591d05;return db[_0x7e1f('0x2c')][_0x7e1f('0x52')]({'where':{'id':_0x336ad5[_0x7e1f('0x44')]['id']}})['then'](handleEntityNotFound(_0x1c8a3c,null))['then'](function(_0x74c3d9){if(_0x74c3d9){_0x5d0e28=_0x74c3d9;_0x18fd39[_0x7e1f('0x2f')]=_[_0x7e1f('0x31')](db[_0x7e1f('0x58')][_0x7e1f('0x53')]);_0x18fd39[_0x7e1f('0x30')]=_[_0x7e1f('0x31')](_0x336ad5[_0x7e1f('0x30')]);_0x18fd39['filters']=_['intersection'](_0x18fd39[_0x7e1f('0x2f')],_0x18fd39['query']);_0xbcbd9f['attributes']=_[_0x7e1f('0x34')](_0x18fd39[_0x7e1f('0x2f')],qs[_0x7e1f('0x35')](_0x336ad5[_0x7e1f('0x30')]['fields']));_0xbcbd9f[_0x7e1f('0x33')]=_0xbcbd9f[_0x7e1f('0x33')]['length']?_0xbcbd9f[_0x7e1f('0x33')]:_0x18fd39[_0x7e1f('0x2f')];_0xbcbd9f[_0x7e1f('0x54')]=qs[_0x7e1f('0x39')](_0x336ad5['query'][_0x7e1f('0x39')]);_0xbcbd9f[_0x7e1f('0x3a')]=qs['filters'](_[_0x7e1f('0x3b')](_0x336ad5[_0x7e1f('0x30')],_0x18fd39[_0x7e1f('0x32')]));if(_0x336ad5['query'][_0x7e1f('0x3c')]){_0xbcbd9f['where']=_['merge'](_0xbcbd9f[_0x7e1f('0x3a')],{'$or':_[_0x7e1f('0x2b')](_0xbcbd9f['attributes'],function(_0x5affd5){var _0x42ed5f={};_0x42ed5f[_0x5affd5]={'$like':'%'+_0x336ad5[_0x7e1f('0x30')]['filter']+'%'};return _0x42ed5f;})});}_0xbcbd9f=_[_0x7e1f('0x3d')]({},_0xbcbd9f,_0x336ad5[_0x7e1f('0x3f')]);return _0x5d0e28[_0x7e1f('0x59')](_0xbcbd9f);}})['then'](function(_0x1d24b5){if(_0x1d24b5){_0x591d05=_0x1d24b5[_0x7e1f('0x36')];if(!_0x336ad5[_0x7e1f('0x30')][_0x7e1f('0x37')](_0x7e1f('0x38'))){_0xbcbd9f[_0x7e1f('0x1a')]=qs[_0x7e1f('0x1a')](_0x336ad5[_0x7e1f('0x30')][_0x7e1f('0x1a')]);_0xbcbd9f[_0x7e1f('0x19')]=qs['offset'](_0x336ad5[_0x7e1f('0x30')]['offset']);}return _0x5d0e28[_0x7e1f('0x59')](_0xbcbd9f);}})[_0x7e1f('0x22')](function(_0x57fd87){if(_0x57fd87){return _0x57fd87?{'count':_0x591d05,'rows':_0x57fd87}:null;}})[_0x7e1f('0x22')](respondWithResult(_0x1c8a3c,null))[_0x7e1f('0x46')](handleError(_0x1c8a3c,null));}; \ No newline at end of file +var _0x0750=['get','Triggers','UserProfileResource','end','error','stack','name','send','index','map','Trigger','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','user','role','autoAssociation','addAllCondition','TriggerAllId','TriggerAnyId','Condition','getAllConditions','findOne','order','sort','getAnyConditions','addAction','getActions','Action','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy'];(function(_0x59eacf,_0x56ec4a){var _0x5d74f2=function(_0x5476ed){while(--_0x5476ed){_0x59eacf['push'](_0x59eacf['shift']());}};_0x5d74f2(++_0x56ec4a);}(_0x0750,0xee));var _0x0075=function(_0x12794e,_0x340e2e){_0x12794e=_0x12794e-0x0;var _0x1e9570=_0x0750[_0x12794e];return _0x1e9570;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0075('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0075('0x1'));var rp=require('request-promise');var moment=require(_0x0075('0x2'));var BPromise=require(_0x0075('0x3'));var Mustache=require(_0x0075('0x4'));var util=require(_0x0075('0x5'));var path=require(_0x0075('0x6'));var sox=require('sox');var csv=require(_0x0075('0x7'));var ejs=require(_0x0075('0x8'));var fs=require('fs');var fs_extra=require(_0x0075('0x9'));var _=require('lodash');var squel=require(_0x0075('0xa'));var crypto=require(_0x0075('0xb'));var jsforce=require(_0x0075('0xc'));var deskjs=require(_0x0075('0xd'));var toCsv=require(_0x0075('0x7'));var querystring=require('querystring');var Papa=require(_0x0075('0xe'));var Redis=require(_0x0075('0xf'));var authService=require(_0x0075('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x0075('0x11'));var hardwareService=require(_0x0075('0x12'));var logger=require(_0x0075('0x13'))(_0x0075('0x14'));var utils=require(_0x0075('0x15'));var config=require(_0x0075('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x0075('0x17'))['db'];function respondWithStatusCode(_0xeffcd6,_0x804896){_0x804896=_0x804896||0xcc;return function(_0x2ce03d){if(_0x2ce03d){return _0xeffcd6['sendStatus'](_0x804896);}return _0xeffcd6['status'](_0x804896)['end']();};}function respondWithResult(_0x36a91f,_0x33420c){_0x33420c=_0x33420c||0xc8;return function(_0x201019){if(_0x201019){return _0x36a91f[_0x0075('0x18')](_0x33420c)[_0x0075('0x19')](_0x201019);}};}function respondWithFilteredResult(_0x5cc928,_0x4e49aa){return function(_0x7687e1){if(_0x7687e1){var _0xe9fae6=typeof _0x4e49aa['offset']===_0x0075('0x1a')&&typeof _0x4e49aa[_0x0075('0x1b')]==='undefined';var _0x2349ea=_0x7687e1[_0x0075('0x1c')];var _0xa6bc00=_0xe9fae6?0x0:_0x4e49aa['offset'];var _0x6a3b4a=_0xe9fae6?_0x7687e1[_0x0075('0x1c')]:_0x4e49aa[_0x0075('0x1d')]+_0x4e49aa['limit'];var _0x1032eb;if(_0x6a3b4a>=_0x2349ea){_0x6a3b4a=_0x2349ea;_0x1032eb=0xc8;}else{_0x1032eb=0xce;}_0x5cc928[_0x0075('0x18')](_0x1032eb);return _0x5cc928[_0x0075('0x1e')](_0x0075('0x1f'),_0xa6bc00+'-'+_0x6a3b4a+'/'+_0x2349ea)[_0x0075('0x19')](_0x7687e1);}return null;};}function patchUpdates(_0x23f5ef){return function(_0x214a8f){try{jsonpatch[_0x0075('0x20')](_0x214a8f,_0x23f5ef,!![]);}catch(_0x23561b){return BPromise[_0x0075('0x21')](_0x23561b);}return _0x214a8f[_0x0075('0x22')]();};}function saveUpdates(_0x4602a7,_0x359c4e){return function(_0x480646){if(_0x480646){return _0x480646[_0x0075('0x23')](_0x4602a7)[_0x0075('0x24')](function(_0x4a9bf0){return _0x4a9bf0;});}return null;};}function removeEntity(_0x11d5fe,_0x38c7c7){return function(_0x44d897){if(_0x44d897){return _0x44d897[_0x0075('0x25')]()[_0x0075('0x24')](function(){var _0x43b32d=_0x44d897[_0x0075('0x26')]({'plain':!![]});var _0x327845=_0x0075('0x27');return db[_0x0075('0x28')][_0x0075('0x25')]({'where':{'type':_0x327845,'resourceId':_0x43b32d['id']}})['then'](function(){return _0x44d897;});})[_0x0075('0x24')](function(){_0x11d5fe[_0x0075('0x18')](0xcc)[_0x0075('0x29')]();});}};}function handleEntityNotFound(_0x2b3c98,_0x19dd54){return function(_0x1f18e7){if(!_0x1f18e7){_0x2b3c98['sendStatus'](0x194);}return _0x1f18e7;};}function handleError(_0x42b1e5,_0x24b811){_0x24b811=_0x24b811||0x1f4;return function(_0x147403){logger[_0x0075('0x2a')](_0x147403[_0x0075('0x2b')]);if(_0x147403['name']){delete _0x147403[_0x0075('0x2c')];}_0x42b1e5[_0x0075('0x18')](_0x24b811)[_0x0075('0x2d')](_0x147403);};}exports[_0x0075('0x2e')]=function(_0x13504c,_0x1f2967){var _0x44c8e4={},_0x3ad30e={},_0xb8dac9={'count':0x0,'rows':[]};var _0x43f60b=_[_0x0075('0x2f')](db[_0x0075('0x30')]['rawAttributes'],function(_0x49cbaa){return{'name':_0x49cbaa['fieldName'],'type':_0x49cbaa[_0x0075('0x31')]['key']};});_0x3ad30e[_0x0075('0x32')]=_[_0x0075('0x2f')](_0x43f60b,_0x0075('0x2c'));_0x3ad30e[_0x0075('0x33')]=_[_0x0075('0x34')](_0x13504c[_0x0075('0x33')]);_0x3ad30e['filters']=_[_0x0075('0x35')](_0x3ad30e[_0x0075('0x32')],_0x3ad30e[_0x0075('0x33')]);_0x44c8e4[_0x0075('0x36')]=_['intersection'](_0x3ad30e['model'],qs[_0x0075('0x37')](_0x13504c['query'][_0x0075('0x37')]));_0x44c8e4[_0x0075('0x36')]=_0x44c8e4[_0x0075('0x36')][_0x0075('0x38')]?_0x44c8e4['attributes']:_0x3ad30e[_0x0075('0x32')];if(!_0x13504c[_0x0075('0x33')][_0x0075('0x39')](_0x0075('0x3a'))){_0x44c8e4[_0x0075('0x1b')]=qs[_0x0075('0x1b')](_0x13504c[_0x0075('0x33')][_0x0075('0x1b')]);_0x44c8e4[_0x0075('0x1d')]=qs[_0x0075('0x1d')](_0x13504c['query'][_0x0075('0x1d')]);}_0x44c8e4['order']=qs['sort'](_0x13504c[_0x0075('0x33')]['sort']);_0x44c8e4[_0x0075('0x3b')]=qs[_0x0075('0x3c')](_[_0x0075('0x3d')](_0x13504c[_0x0075('0x33')],_0x3ad30e[_0x0075('0x3c')]),_0x43f60b);if(_0x13504c[_0x0075('0x33')][_0x0075('0x3e')]){_0x44c8e4[_0x0075('0x3b')]=_[_0x0075('0x3f')](_0x44c8e4[_0x0075('0x3b')],{'$or':_['map'](_0x43f60b,function(_0x489978){if(_0x489978[_0x0075('0x31')]!==_0x0075('0x40')){var _0x5b8594={};_0x5b8594[_0x489978[_0x0075('0x2c')]]={'$like':'%'+_0x13504c['query'][_0x0075('0x3e')]+'%'};return _0x5b8594;}})});}_0x44c8e4=_['merge']({},_0x44c8e4,_0x13504c[_0x0075('0x41')]);var _0x5c3ba3={'where':_0x44c8e4[_0x0075('0x3b')]};return db[_0x0075('0x30')][_0x0075('0x1c')](_0x5c3ba3)[_0x0075('0x24')](function(_0x260956){_0xb8dac9[_0x0075('0x1c')]=_0x260956;if(_0x13504c[_0x0075('0x33')][_0x0075('0x42')]){_0x44c8e4[_0x0075('0x43')]=[{'all':!![]}];}return db['Trigger'][_0x0075('0x44')](_0x44c8e4);})[_0x0075('0x24')](function(_0x1d3f6e){_0xb8dac9[_0x0075('0x45')]=_0x1d3f6e;return _0xb8dac9;})[_0x0075('0x24')](respondWithFilteredResult(_0x1f2967,_0x44c8e4))[_0x0075('0x46')](handleError(_0x1f2967,null));};exports[_0x0075('0x47')]=function(_0x778f0f,_0x48efbc){var _0x55b861={'raw':![],'where':{'id':_0x778f0f[_0x0075('0x48')]['id']}},_0x3fab76={};_0x3fab76[_0x0075('0x32')]=_[_0x0075('0x34')](db['Trigger'][_0x0075('0x49')]);_0x3fab76[_0x0075('0x33')]=_[_0x0075('0x34')](_0x778f0f['query']);_0x3fab76[_0x0075('0x3c')]=_[_0x0075('0x35')](_0x3fab76[_0x0075('0x32')],_0x3fab76[_0x0075('0x33')]);_0x55b861[_0x0075('0x36')]=_[_0x0075('0x35')](_0x3fab76['model'],qs[_0x0075('0x37')](_0x778f0f[_0x0075('0x33')][_0x0075('0x37')]));_0x55b861[_0x0075('0x36')]=_0x55b861[_0x0075('0x36')][_0x0075('0x38')]?_0x55b861[_0x0075('0x36')]:_0x3fab76[_0x0075('0x32')];if(_0x778f0f['query'][_0x0075('0x42')]){_0x55b861[_0x0075('0x43')]=[{'all':!![]}];}_0x55b861=_['merge']({},_0x55b861,_0x778f0f[_0x0075('0x41')]);return db['Trigger'][_0x0075('0x4a')](_0x55b861)[_0x0075('0x24')](handleEntityNotFound(_0x48efbc,null))[_0x0075('0x24')](respondWithResult(_0x48efbc,null))[_0x0075('0x46')](handleError(_0x48efbc,null));};exports[_0x0075('0x4b')]=function(_0x51c902,_0x200e45){return db[_0x0075('0x30')]['create'](_0x51c902[_0x0075('0x4c')],{})[_0x0075('0x24')](function(_0x28564d){var _0x30f8b6=_0x51c902[_0x0075('0x4d')][_0x0075('0x26')]({'plain':!![]});if(!_0x30f8b6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x30f8b6[_0x0075('0x4e')]===_0x0075('0x4d')){var _0x2881ae=_0x28564d['get']({'plain':!![]});var _0x214fa0=_0x0075('0x27');return db['UserProfileSection'][_0x0075('0x4a')]({'where':{'name':_0x214fa0,'userProfileId':_0x30f8b6['userProfileId']},'raw':!![]})[_0x0075('0x24')](function(_0x10d4d3){if(_0x10d4d3&&_0x10d4d3[_0x0075('0x4f')]===0x0){return db[_0x0075('0x28')]['create']({'name':_0x2881ae[_0x0075('0x2c')],'resourceId':_0x2881ae['id'],'type':_0x10d4d3[_0x0075('0x2c')],'sectionId':_0x10d4d3['id']},{})[_0x0075('0x24')](function(){return _0x28564d;});}else{return _0x28564d;}})[_0x0075('0x46')](function(_0x231ff3){logger[_0x0075('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x231ff3);throw _0x231ff3;});}return _0x28564d;})[_0x0075('0x24')](respondWithResult(_0x200e45,0xc9))[_0x0075('0x46')](handleError(_0x200e45,null));};exports['update']=function(_0x1b325c,_0x333f66){if(_0x1b325c[_0x0075('0x4c')]['id']){delete _0x1b325c[_0x0075('0x4c')]['id'];}return db[_0x0075('0x30')][_0x0075('0x4a')]({'where':{'id':_0x1b325c[_0x0075('0x48')]['id']}})[_0x0075('0x24')](handleEntityNotFound(_0x333f66,null))[_0x0075('0x24')](saveUpdates(_0x1b325c[_0x0075('0x4c')],null))[_0x0075('0x24')](respondWithResult(_0x333f66,null))[_0x0075('0x46')](handleError(_0x333f66,null));};exports[_0x0075('0x25')]=function(_0x455e5a,_0x4cc7e7){return db[_0x0075('0x30')]['find']({'where':{'id':_0x455e5a[_0x0075('0x48')]['id']}})[_0x0075('0x24')](handleEntityNotFound(_0x4cc7e7,null))[_0x0075('0x24')](removeEntity(_0x4cc7e7,null))['catch'](handleError(_0x4cc7e7,null));};exports[_0x0075('0x50')]=function(_0xb3ce0,_0x6fb952,_0x11bbdf){if(_0xb3ce0[_0x0075('0x4c')]['id']){delete _0xb3ce0[_0x0075('0x4c')]['id'];}return db[_0x0075('0x30')][_0x0075('0x4a')]({'where':{'id':_0xb3ce0['params']['id']}})[_0x0075('0x24')](handleEntityNotFound(_0x6fb952,null))[_0x0075('0x24')](function(_0x109b81){if(_0x109b81){_0xb3ce0[_0x0075('0x4c')][_0x0075('0x51')]=_0x109b81['id'];return db['Condition'][_0x0075('0x4b')](_0xb3ce0[_0x0075('0x4c')]);}})[_0x0075('0x24')](respondWithResult(_0x6fb952,null))[_0x0075('0x46')](handleError(_0x6fb952,null));};exports['addAnyCondition']=function(_0x441c58,_0x14850b,_0xe0ad30){if(_0x441c58[_0x0075('0x4c')]['id']){delete _0x441c58[_0x0075('0x4c')]['id'];}return db[_0x0075('0x30')][_0x0075('0x4a')]({'where':{'id':_0x441c58['params']['id']}})[_0x0075('0x24')](handleEntityNotFound(_0x14850b,null))['then'](function(_0x2fe36d){if(_0x2fe36d){_0x441c58['body'][_0x0075('0x52')]=_0x2fe36d['id'];return db[_0x0075('0x53')]['create'](_0x441c58[_0x0075('0x4c')]);}})['then'](respondWithResult(_0x14850b,null))[_0x0075('0x46')](handleError(_0x14850b,null));};exports[_0x0075('0x54')]=function(_0x52eab9,_0x5c85f5,_0x12c389){var _0x125fce={};var _0x290d7c={};var _0x44b3ea;var _0x5dff6e;return db[_0x0075('0x30')][_0x0075('0x55')]({'where':{'id':_0x52eab9['params']['id']}})[_0x0075('0x24')](handleEntityNotFound(_0x5c85f5,null))[_0x0075('0x24')](function(_0x528749){if(_0x528749){_0x44b3ea=_0x528749;_0x290d7c[_0x0075('0x32')]=_[_0x0075('0x34')](db['Condition'][_0x0075('0x49')]);_0x290d7c[_0x0075('0x33')]=_[_0x0075('0x34')](_0x52eab9[_0x0075('0x33')]);_0x290d7c[_0x0075('0x3c')]=_[_0x0075('0x35')](_0x290d7c[_0x0075('0x32')],_0x290d7c[_0x0075('0x33')]);_0x125fce[_0x0075('0x36')]=_['intersection'](_0x290d7c[_0x0075('0x32')],qs[_0x0075('0x37')](_0x52eab9[_0x0075('0x33')]['fields']));_0x125fce[_0x0075('0x36')]=_0x125fce[_0x0075('0x36')]['length']?_0x125fce[_0x0075('0x36')]:_0x290d7c[_0x0075('0x32')];_0x125fce[_0x0075('0x56')]=qs['sort'](_0x52eab9[_0x0075('0x33')][_0x0075('0x57')]);_0x125fce[_0x0075('0x3b')]=qs['filters'](_[_0x0075('0x3d')](_0x52eab9[_0x0075('0x33')],_0x290d7c['filters']));if(_0x52eab9['query'][_0x0075('0x3e')]){_0x125fce[_0x0075('0x3b')]=_[_0x0075('0x3f')](_0x125fce[_0x0075('0x3b')],{'$or':_[_0x0075('0x2f')](_0x125fce['attributes'],function(_0x383f3c){var _0x4b4ad4={};_0x4b4ad4[_0x383f3c]={'$like':'%'+_0x52eab9[_0x0075('0x33')][_0x0075('0x3e')]+'%'};return _0x4b4ad4;})});}_0x125fce=_[_0x0075('0x3f')]({},_0x125fce,_0x52eab9['options']);return _0x44b3ea[_0x0075('0x54')](_0x125fce);}})[_0x0075('0x24')](function(_0x2fad4c){if(_0x2fad4c){_0x5dff6e=_0x2fad4c[_0x0075('0x38')];if(!_0x52eab9[_0x0075('0x33')][_0x0075('0x39')](_0x0075('0x3a'))){_0x125fce[_0x0075('0x1b')]=qs['limit'](_0x52eab9[_0x0075('0x33')]['limit']);_0x125fce[_0x0075('0x1d')]=qs[_0x0075('0x1d')](_0x52eab9[_0x0075('0x33')]['offset']);}return _0x44b3ea[_0x0075('0x54')](_0x125fce);}})[_0x0075('0x24')](function(_0x23650f){if(_0x23650f){return _0x23650f?{'count':_0x5dff6e,'rows':_0x23650f}:null;}})[_0x0075('0x24')](respondWithResult(_0x5c85f5,null))[_0x0075('0x46')](handleError(_0x5c85f5,null));};exports[_0x0075('0x58')]=function(_0x1dc9b6,_0x48f4ac,_0x4ab033){var _0x18358b={};var _0x54e713={};var _0x2cddb8;var _0x26ef01;return db[_0x0075('0x30')][_0x0075('0x55')]({'where':{'id':_0x1dc9b6[_0x0075('0x48')]['id']}})[_0x0075('0x24')](handleEntityNotFound(_0x48f4ac,null))[_0x0075('0x24')](function(_0x478fb0){if(_0x478fb0){_0x2cddb8=_0x478fb0;_0x54e713['model']=_['keys'](db[_0x0075('0x53')][_0x0075('0x49')]);_0x54e713[_0x0075('0x33')]=_[_0x0075('0x34')](_0x1dc9b6[_0x0075('0x33')]);_0x54e713[_0x0075('0x3c')]=_[_0x0075('0x35')](_0x54e713[_0x0075('0x32')],_0x54e713[_0x0075('0x33')]);_0x18358b[_0x0075('0x36')]=_[_0x0075('0x35')](_0x54e713[_0x0075('0x32')],qs[_0x0075('0x37')](_0x1dc9b6[_0x0075('0x33')][_0x0075('0x37')]));_0x18358b['attributes']=_0x18358b[_0x0075('0x36')][_0x0075('0x38')]?_0x18358b['attributes']:_0x54e713['model'];_0x18358b[_0x0075('0x56')]=qs[_0x0075('0x57')](_0x1dc9b6[_0x0075('0x33')][_0x0075('0x57')]);_0x18358b['where']=qs['filters'](_['pick'](_0x1dc9b6[_0x0075('0x33')],_0x54e713['filters']));if(_0x1dc9b6['query'][_0x0075('0x3e')]){_0x18358b[_0x0075('0x3b')]=_[_0x0075('0x3f')](_0x18358b[_0x0075('0x3b')],{'$or':_[_0x0075('0x2f')](_0x18358b[_0x0075('0x36')],function(_0x119784){var _0x98e120={};_0x98e120[_0x119784]={'$like':'%'+_0x1dc9b6[_0x0075('0x33')]['filter']+'%'};return _0x98e120;})});}_0x18358b=_[_0x0075('0x3f')]({},_0x18358b,_0x1dc9b6[_0x0075('0x41')]);return _0x2cddb8['getAnyConditions'](_0x18358b);}})[_0x0075('0x24')](function(_0x57e1a5){if(_0x57e1a5){_0x26ef01=_0x57e1a5['length'];if(!_0x1dc9b6[_0x0075('0x33')][_0x0075('0x39')](_0x0075('0x3a'))){_0x18358b[_0x0075('0x1b')]=qs[_0x0075('0x1b')](_0x1dc9b6['query'][_0x0075('0x1b')]);_0x18358b[_0x0075('0x1d')]=qs[_0x0075('0x1d')](_0x1dc9b6[_0x0075('0x33')]['offset']);}return _0x2cddb8['getAnyConditions'](_0x18358b);}})[_0x0075('0x24')](function(_0x404c7c){if(_0x404c7c){return _0x404c7c?{'count':_0x26ef01,'rows':_0x404c7c}:null;}})['then'](respondWithResult(_0x48f4ac,null))[_0x0075('0x46')](handleError(_0x48f4ac,null));};exports[_0x0075('0x59')]=function(_0x2355d4,_0x5f4b87,_0x213416){if(_0x2355d4[_0x0075('0x4c')]['id']){delete _0x2355d4[_0x0075('0x4c')]['id'];}return db[_0x0075('0x30')][_0x0075('0x4a')]({'where':{'id':_0x2355d4[_0x0075('0x48')]['id']}})[_0x0075('0x24')](handleEntityNotFound(_0x5f4b87,null))[_0x0075('0x24')](function(_0x3943e4){if(_0x3943e4){_0x2355d4[_0x0075('0x4c')]['TriggerId']=_0x3943e4['id'];return db['Action']['create'](_0x2355d4[_0x0075('0x4c')]);}})[_0x0075('0x24')](respondWithResult(_0x5f4b87,null))[_0x0075('0x46')](handleError(_0x5f4b87,null));};exports[_0x0075('0x5a')]=function(_0x463a9b,_0x169a10,_0x501b0e){var _0x48acd7={};var _0x2915b5={};var _0x3b8025;var _0x4de09b;return db[_0x0075('0x30')][_0x0075('0x55')]({'where':{'id':_0x463a9b[_0x0075('0x48')]['id']}})['then'](handleEntityNotFound(_0x169a10,null))[_0x0075('0x24')](function(_0x5c572d){if(_0x5c572d){_0x3b8025=_0x5c572d;_0x2915b5[_0x0075('0x32')]=_[_0x0075('0x34')](db[_0x0075('0x5b')]['rawAttributes']);_0x2915b5[_0x0075('0x33')]=_[_0x0075('0x34')](_0x463a9b[_0x0075('0x33')]);_0x2915b5[_0x0075('0x3c')]=_[_0x0075('0x35')](_0x2915b5[_0x0075('0x32')],_0x2915b5[_0x0075('0x33')]);_0x48acd7['attributes']=_['intersection'](_0x2915b5[_0x0075('0x32')],qs[_0x0075('0x37')](_0x463a9b[_0x0075('0x33')][_0x0075('0x37')]));_0x48acd7[_0x0075('0x36')]=_0x48acd7[_0x0075('0x36')]['length']?_0x48acd7[_0x0075('0x36')]:_0x2915b5['model'];_0x48acd7['order']=qs['sort'](_0x463a9b[_0x0075('0x33')][_0x0075('0x57')]);_0x48acd7['where']=qs['filters'](_[_0x0075('0x3d')](_0x463a9b[_0x0075('0x33')],_0x2915b5[_0x0075('0x3c')]));if(_0x463a9b[_0x0075('0x33')][_0x0075('0x3e')]){_0x48acd7['where']=_[_0x0075('0x3f')](_0x48acd7[_0x0075('0x3b')],{'$or':_['map'](_0x48acd7[_0x0075('0x36')],function(_0x4ae8ba){var _0x2743ce={};_0x2743ce[_0x4ae8ba]={'$like':'%'+_0x463a9b[_0x0075('0x33')][_0x0075('0x3e')]+'%'};return _0x2743ce;})});}_0x48acd7=_[_0x0075('0x3f')]({},_0x48acd7,_0x463a9b[_0x0075('0x41')]);return _0x3b8025[_0x0075('0x5a')](_0x48acd7);}})[_0x0075('0x24')](function(_0x15e05a){if(_0x15e05a){_0x4de09b=_0x15e05a[_0x0075('0x38')];if(!_0x463a9b[_0x0075('0x33')][_0x0075('0x39')](_0x0075('0x3a'))){_0x48acd7['limit']=qs['limit'](_0x463a9b[_0x0075('0x33')][_0x0075('0x1b')]);_0x48acd7[_0x0075('0x1d')]=qs[_0x0075('0x1d')](_0x463a9b['query']['offset']);}return _0x3b8025['getActions'](_0x48acd7);}})[_0x0075('0x24')](function(_0xa3b1){if(_0xa3b1){return _0xa3b1?{'count':_0x4de09b,'rows':_0xa3b1}:null;}})[_0x0075('0x24')](respondWithResult(_0x169a10,null))[_0x0075('0x46')](handleError(_0x169a10,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index b6c7f15..9ef4cb3 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 _0xc770=['path','rimraf','../../config/environment','./trigger.attributes','exports','define','tools_triggers','lodash','util','moment','bluebird','request-promise'];(function(_0x429113,_0x5859eb){var _0x27fe3=function(_0x2f432f){while(--_0x2f432f){_0x429113['push'](_0x429113['shift']());}};_0x27fe3(++_0x5859eb);}(_0xc770,0xd3));var _0x0c77=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc770[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0c77('0x0'));var util=require(_0x0c77('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0c77('0x2'));var BPromise=require(_0x0c77('0x3'));var rp=require(_0x0c77('0x4'));var fs=require('fs');var path=require(_0x0c77('0x5'));var rimraf=require(_0x0c77('0x6'));var config=require(_0x0c77('0x7'));var attributes=require(_0x0c77('0x8'));module[_0x0c77('0x9')]=function(_0x575bb3,_0x26a0ff){return _0x575bb3[_0x0c77('0xa')]('Trigger',attributes,{'tableName':_0x0c77('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb6f1=['lodash','../../config/logger','moment','bluebird','request-promise','rimraf','./trigger.attributes','exports','Trigger','tools_triggers'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0xb6f1,0x118));var _0x1b6f=function(_0x7729b1,_0x468322){_0x7729b1=_0x7729b1-0x0;var _0x349504=_0xb6f1[_0x7729b1];return _0x349504;};'use strict';var _=require(_0x1b6f('0x0'));var util=require('util');var logger=require(_0x1b6f('0x1'))('api');var moment=require(_0x1b6f('0x2'));var BPromise=require(_0x1b6f('0x3'));var rp=require(_0x1b6f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1b6f('0x5'));var config=require('../../config/environment');var attributes=require(_0x1b6f('0x6'));module[_0x1b6f('0x7')]=function(_0xd4703b,_0x493c91){return _0xd4703b['define'](_0x1b6f('0x8'),attributes,{'tableName':_0x1b6f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 986a3f1..2b28adf 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 _0x2185=['rpc','client','http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','Trigger','options','raw','attributes','limit','map','include','model','GetTrigger','ShowTrigger','find','util','moment','bluebird','randomstring','../../config/utils','../../config/logger'];(function(_0x2a1f92,_0x4800bf){var _0x4e4962=function(_0x27e672){while(--_0x27e672){_0x2a1f92['push'](_0x2a1f92['shift']());}};_0x4e4962(++_0x4800bf);}(_0x2185,0xc0));var _0x5218=function(_0x55a284,_0x5c59cc){_0x55a284=_0x55a284-0x0;var _0x409fed=_0x2185[_0x55a284];return _0x409fed;};'use strict';var _=require('lodash');var util=require(_0x5218('0x0'));var moment=require(_0x5218('0x1'));var BPromise=require(_0x5218('0x2'));var rs=require(_0x5218('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5218('0x4'));var logger=require(_0x5218('0x5'))(_0x5218('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5218('0x7')][_0x5218('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x21aadc,_0x4d1f0e,_0x2a0edd){return new BPromise(function(_0xa7c697,_0x680957){return client[_0x5218('0x9')](_0x21aadc,_0x2a0edd)[_0x5218('0xa')](function(_0x67a52e){logger[_0x5218('0xb')](_0x5218('0xc'),_0x4d1f0e,_0x5218('0xd'));logger[_0x5218('0xe')](_0x5218('0xf'),_0x4d1f0e,'request\x20sent',JSON[_0x5218('0x10')](_0x67a52e));if(_0x67a52e['error']){if(_0x67a52e['error'][_0x5218('0x11')]===0x1f4){logger[_0x5218('0x12')](_0x5218('0xc'),_0x4d1f0e,_0x67a52e['error']['message']);return _0x680957(_0x67a52e['error'][_0x5218('0x13')]);}logger[_0x5218('0x12')](_0x5218('0xc'),_0x4d1f0e,_0x67a52e[_0x5218('0x12')][_0x5218('0x13')]);return _0xa7c697(_0x67a52e[_0x5218('0x12')]['message']);}else{logger['info']('Trigger,\x20%s,\x20%s',_0x4d1f0e,_0x5218('0xd'));_0xa7c697(_0x67a52e[_0x5218('0x14')][_0x5218('0x13')]);}})[_0x5218('0x15')](function(_0x21a43d){logger[_0x5218('0x12')]('Trigger,\x20%s,\x20%s',_0x4d1f0e,_0x21a43d);_0x680957(_0x21a43d);});});}exports['GetTrigger']=function(_0x5a4673){var _0x3aedb9=this;return new Promise(function(_0x4dbd43,_0x368929){return db[_0x5218('0x16')]['findAll']({'raw':_0x5a4673[_0x5218('0x17')]?_0x5a4673[_0x5218('0x17')][_0x5218('0x18')]===undefined?!![]:![]:!![],'where':_0x5a4673['options']?_0x5a4673[_0x5218('0x17')]['where']||null:null,'attributes':_0x5a4673[_0x5218('0x17')]?_0x5a4673['options'][_0x5218('0x19')]||null:null,'limit':_0x5a4673[_0x5218('0x17')]?_0x5a4673[_0x5218('0x17')][_0x5218('0x1a')]||null:null,'include':_0x5a4673[_0x5218('0x17')]?_0x5a4673[_0x5218('0x17')]['include']?_[_0x5218('0x1b')](_0x5a4673[_0x5218('0x17')][_0x5218('0x1c')],function(_0x2ce579){return{'model':db[_0x2ce579[_0x5218('0x1d')]],'as':_0x2ce579['as'],'attributes':_0x2ce579[_0x5218('0x19')],'include':_0x2ce579['include']?_[_0x5218('0x1b')](_0x2ce579[_0x5218('0x1c')],function(_0x3e3cb4){return{'model':db[_0x3e3cb4[_0x5218('0x1d')]],'as':_0x3e3cb4['as'],'attributes':_0x3e3cb4[_0x5218('0x19')],'include':_0x3e3cb4[_0x5218('0x1c')]?_['map'](_0x3e3cb4[_0x5218('0x1c')],function(_0x494223){return{'model':db[_0x494223[_0x5218('0x1d')]],'as':_0x494223['as'],'attributes':_0x494223['attributes']};}):[]};}):[]};}):[]:[]})[_0x5218('0xa')](function(_0x4bf229){logger[_0x5218('0xb')]('GetTrigger',_0x5a4673);logger[_0x5218('0xe')](_0x5218('0x1e'),_0x5a4673,JSON[_0x5218('0x10')](_0x4bf229));_0x4dbd43(_0x4bf229);})[_0x5218('0x15')](function(_0x4747ef){logger[_0x5218('0x12')](_0x5218('0x1e'),_0x4747ef[_0x5218('0x13')],_0x5a4673);_0x368929(_0x3aedb9[_0x5218('0x12')](0x1f4,_0x4747ef['message']));});});};exports[_0x5218('0x1f')]=function(_0x1bd78e){var _0x28617d=this;return new Promise(function(_0x3b7e8a,_0x5ef621){return db[_0x5218('0x16')][_0x5218('0x20')]({'raw':_0x1bd78e['options']?_0x1bd78e[_0x5218('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x1bd78e[_0x5218('0x17')]?_0x1bd78e['options']['where']||null:null,'attributes':_0x1bd78e[_0x5218('0x17')]?_0x1bd78e[_0x5218('0x17')][_0x5218('0x19')]||null:null,'include':_0x1bd78e['options']?_0x1bd78e['options']['include']?_[_0x5218('0x1b')](_0x1bd78e[_0x5218('0x17')][_0x5218('0x1c')],function(_0x3e8e3c){return{'model':db[_0x3e8e3c['model']],'as':_0x3e8e3c['as'],'attributes':_0x3e8e3c[_0x5218('0x19')],'include':_0x3e8e3c[_0x5218('0x1c')]?_[_0x5218('0x1b')](_0x3e8e3c[_0x5218('0x1c')],function(_0xde2d19){return{'model':db[_0xde2d19[_0x5218('0x1d')]],'as':_0xde2d19['as'],'attributes':_0xde2d19[_0x5218('0x19')],'include':_0xde2d19['include']?_[_0x5218('0x1b')](_0xde2d19['include'],function(_0x57cbba){return{'model':db[_0x57cbba[_0x5218('0x1d')]],'as':_0x57cbba['as'],'attributes':_0x57cbba[_0x5218('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3a28f4){logger[_0x5218('0xb')](_0x5218('0x1f'),_0x1bd78e);logger[_0x5218('0xe')](_0x5218('0x1f'),_0x1bd78e,JSON[_0x5218('0x10')](_0x3a28f4));_0x3b7e8a(_0x3a28f4);})[_0x5218('0x15')](function(_0x34c6bf){logger[_0x5218('0x12')](_0x5218('0x1f'),_0x34c6bf[_0x5218('0x13')],_0x1bd78e);_0x5ef621(_0x28617d[_0x5218('0x12')](0x1f4,_0x34c6bf[_0x5218('0x13')]));});});}; \ No newline at end of file +var _0x136a=['randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','debug','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Trigger,\x20%s,\x20%s','message','result','catch','GetTrigger','Trigger','findAll','options','raw','where','limit','include','map','model','attributes','info','ShowTrigger','find','lodash','util','bluebird'];(function(_0x114c53,_0x2249c6){var _0x4e0c14=function(_0x1fe406){while(--_0x1fe406){_0x114c53['push'](_0x114c53['shift']());}};_0x4e0c14(++_0x2249c6);}(_0x136a,0xb1));var _0xa136=function(_0x379e39,_0x4cfac5){_0x379e39=_0x379e39-0x0;var _0x23dbef=_0x136a[_0x379e39];return _0x23dbef;};'use strict';var _=require(_0xa136('0x0'));var util=require(_0xa136('0x1'));var moment=require('moment');var BPromise=require(_0xa136('0x2'));var rs=require(_0xa136('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa136('0x4'));var logger=require(_0xa136('0x5'))(_0xa136('0x6'));var config=require(_0xa136('0x7'));var jayson=require(_0xa136('0x8'));var client=jayson['client'][_0xa136('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x520027,_0x4f9ec6,_0x2038e2){return new BPromise(function(_0x5cf7f1,_0xf00dc9){return client[_0xa136('0xa')](_0x520027,_0x2038e2)[_0xa136('0xb')](function(_0x1f3547){logger['info']('Trigger,\x20%s,\x20%s',_0x4f9ec6,'request\x20sent');logger[_0xa136('0xc')](_0xa136('0xd'),_0x4f9ec6,_0xa136('0xe'),JSON[_0xa136('0xf')](_0x1f3547));if(_0x1f3547[_0xa136('0x10')]){if(_0x1f3547['error'][_0xa136('0x11')]===0x1f4){logger[_0xa136('0x10')](_0xa136('0x12'),_0x4f9ec6,_0x1f3547[_0xa136('0x10')][_0xa136('0x13')]);return _0xf00dc9(_0x1f3547[_0xa136('0x10')]['message']);}logger[_0xa136('0x10')](_0xa136('0x12'),_0x4f9ec6,_0x1f3547['error']['message']);return _0x5cf7f1(_0x1f3547[_0xa136('0x10')][_0xa136('0x13')]);}else{logger['info'](_0xa136('0x12'),_0x4f9ec6,'request\x20sent');_0x5cf7f1(_0x1f3547[_0xa136('0x14')][_0xa136('0x13')]);}})[_0xa136('0x15')](function(_0x449750){logger[_0xa136('0x10')](_0xa136('0x12'),_0x4f9ec6,_0x449750);_0xf00dc9(_0x449750);});});}exports[_0xa136('0x16')]=function(_0x19d224){var _0x3cabaa=this;return new Promise(function(_0x48cb94,_0x494c02){return db[_0xa136('0x17')][_0xa136('0x18')]({'raw':_0x19d224[_0xa136('0x19')]?_0x19d224['options'][_0xa136('0x1a')]===undefined?!![]:![]:!![],'where':_0x19d224[_0xa136('0x19')]?_0x19d224[_0xa136('0x19')][_0xa136('0x1b')]||null:null,'attributes':_0x19d224['options']?_0x19d224[_0xa136('0x19')]['attributes']||null:null,'limit':_0x19d224['options']?_0x19d224[_0xa136('0x19')][_0xa136('0x1c')]||null:null,'include':_0x19d224[_0xa136('0x19')]?_0x19d224[_0xa136('0x19')][_0xa136('0x1d')]?_[_0xa136('0x1e')](_0x19d224[_0xa136('0x19')]['include'],function(_0x22653b){return{'model':db[_0x22653b[_0xa136('0x1f')]],'as':_0x22653b['as'],'attributes':_0x22653b['attributes'],'include':_0x22653b[_0xa136('0x1d')]?_[_0xa136('0x1e')](_0x22653b[_0xa136('0x1d')],function(_0x3700b1){return{'model':db[_0x3700b1['model']],'as':_0x3700b1['as'],'attributes':_0x3700b1[_0xa136('0x20')],'include':_0x3700b1[_0xa136('0x1d')]?_['map'](_0x3700b1[_0xa136('0x1d')],function(_0x987fca){return{'model':db[_0x987fca[_0xa136('0x1f')]],'as':_0x987fca['as'],'attributes':_0x987fca[_0xa136('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x51c84d){logger[_0xa136('0x21')](_0xa136('0x16'),_0x19d224);logger['debug'](_0xa136('0x16'),_0x19d224,JSON[_0xa136('0xf')](_0x51c84d));_0x48cb94(_0x51c84d);})[_0xa136('0x15')](function(_0x3403a0){logger[_0xa136('0x10')]('GetTrigger',_0x3403a0[_0xa136('0x13')],_0x19d224);_0x494c02(_0x3cabaa[_0xa136('0x10')](0x1f4,_0x3403a0[_0xa136('0x13')]));});});};exports[_0xa136('0x22')]=function(_0x1dd950){var _0x41c6c0=this;return new Promise(function(_0x25af06,_0x4d3eb1){return db['Trigger'][_0xa136('0x23')]({'raw':_0x1dd950[_0xa136('0x19')]?_0x1dd950[_0xa136('0x19')][_0xa136('0x1a')]===undefined?!![]:![]:!![],'where':_0x1dd950[_0xa136('0x19')]?_0x1dd950[_0xa136('0x19')]['where']||null:null,'attributes':_0x1dd950[_0xa136('0x19')]?_0x1dd950[_0xa136('0x19')][_0xa136('0x20')]||null:null,'include':_0x1dd950['options']?_0x1dd950['options'][_0xa136('0x1d')]?_[_0xa136('0x1e')](_0x1dd950[_0xa136('0x19')][_0xa136('0x1d')],function(_0x4335ee){return{'model':db[_0x4335ee[_0xa136('0x1f')]],'as':_0x4335ee['as'],'attributes':_0x4335ee[_0xa136('0x20')],'include':_0x4335ee[_0xa136('0x1d')]?_['map'](_0x4335ee[_0xa136('0x1d')],function(_0x171d0b){return{'model':db[_0x171d0b['model']],'as':_0x171d0b['as'],'attributes':_0x171d0b[_0xa136('0x20')],'include':_0x171d0b[_0xa136('0x1d')]?_[_0xa136('0x1e')](_0x171d0b[_0xa136('0x1d')],function(_0x3ed98e){return{'model':db[_0x3ed98e[_0xa136('0x1f')]],'as':_0x3ed98e['as'],'attributes':_0x3ed98e[_0xa136('0x20')]};}):[]};}):[]};}):[]:[]})[_0xa136('0xb')](function(_0x426163){logger[_0xa136('0x21')](_0xa136('0x22'),_0x1dd950);logger[_0xa136('0xc')]('ShowTrigger',_0x1dd950,JSON['stringify'](_0x426163));_0x25af06(_0x426163);})[_0xa136('0x15')](function(_0x14ede7){logger['error'](_0xa136('0x22'),_0x14ede7[_0xa136('0x13')],_0x1dd950);_0x4d3eb1(_0x41c6c0[_0xa136('0x10')](0x1f4,_0x14ede7[_0xa136('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index bf38ce3..ec90497 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 _0x3079=['clone','put','/:id','update','delete','destroy','exports','path','fs-extra','../../components/auth/service','./trunk.controller','get','isAuthenticated','index','post','/:id/clone'];(function(_0x121bed,_0x387a8f){var _0x4927e5=function(_0x86a801){while(--_0x86a801){_0x121bed['push'](_0x121bed['shift']());}};_0x4927e5(++_0x387a8f);}(_0x3079,0x117));var _0x9307=function(_0x45f41d,_0x58de63){_0x45f41d=_0x45f41d-0x0;var _0xd61905=_0x3079[_0x45f41d];return _0xd61905;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9307('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x9307('0x1'));var auth=require(_0x9307('0x2'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9307('0x3'));router[_0x9307('0x4')]('/',auth[_0x9307('0x5')](),controller[_0x9307('0x6')]);router[_0x9307('0x4')]('/:id',auth[_0x9307('0x5')](),controller['show']);router[_0x9307('0x7')](_0x9307('0x8'),auth[_0x9307('0x5')](),controller[_0x9307('0x9')]);router[_0x9307('0x7')]('/',auth[_0x9307('0x5')](),controller['create']);router[_0x9307('0xa')](_0x9307('0xb'),auth[_0x9307('0x5')](),controller[_0x9307('0xc')]);router[_0x9307('0xd')](_0x9307('0xb'),auth[_0x9307('0x5')](),controller[_0x9307('0xe')]);module[_0x9307('0xf')]=router; \ No newline at end of file +var _0xedba=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','index','/:id','isAuthenticated','post','clone','create','put','update','delete','destroy','exports','multer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xedba,0x18b));var _0xaedb=function(_0x2a98a9,_0x122e19){_0x2a98a9=_0x2a98a9-0x0;var _0x4a2509=_0xedba[_0x2a98a9];return _0x4a2509;};'use strict';var multer=require(_0xaedb('0x0'));var util=require('util');var path=require(_0xaedb('0x1'));var timeout=require(_0xaedb('0x2'));var express=require(_0xaedb('0x3'));var router=express[_0xaedb('0x4')]();var fs_extra=require(_0xaedb('0x5'));var auth=require(_0xaedb('0x6'));var interaction=require(_0xaedb('0x7'));var config=require(_0xaedb('0x8'));var controller=require(_0xaedb('0x9'));router[_0xaedb('0xa')]('/',auth['isAuthenticated'](),controller[_0xaedb('0xb')]);router[_0xaedb('0xa')](_0xaedb('0xc'),auth[_0xaedb('0xd')](),controller['show']);router[_0xaedb('0xe')]('/:id/clone',auth[_0xaedb('0xd')](),controller[_0xaedb('0xf')]);router[_0xaedb('0xe')]('/',auth[_0xaedb('0xd')](),controller[_0xaedb('0x10')]);router[_0xaedb('0x11')]('/:id',auth[_0xaedb('0xd')](),controller[_0xaedb('0x12')]);router[_0xaedb('0x13')](_0xaedb('0xc'),auth[_0xaedb('0xd')](),controller[_0xaedb('0x14')]);module[_0xaedb('0x15')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 219b11c..9caf890 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 _0xf9a7=['update','outgoing','nat','all','ulaw;alaw;gsm','setDataValue','allow','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER','\x22\x22\x20<>','accept','originate','uac','uas','pai','fingerprint','certificate','active','passive','actpass','dynamic','update,nonat','sequelize','exports','STRING','name','ENUM','friend','user','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','shortinfo','inband','rfc2833','yes','nonat'];(function(_0x588901,_0x17249f){var _0x39c89c=function(_0x566dce){while(--_0x566dce){_0x588901['push'](_0x588901['shift']());}};_0x39c89c(++_0x17249f);}(_0xf9a7,0x1da));var _0x7f9a=function(_0x468d4f,_0x2096e7){_0x468d4f=_0x468d4f-0x0;var _0x1e6665=_0xf9a7[_0x468d4f];return _0x1e6665;};'use strict';var Sequelize=require(_0x7f9a('0x0'));module[_0x7f9a('0x1')]={'name':{'type':Sequelize[_0x7f9a('0x2')],'allowNull':![],'unique':_0x7f9a('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x7f9a('0x4')](_0x7f9a('0x5'),_0x7f9a('0x6'),'peer'),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x7f9a('0x2')],'allowNull':![],'defaultValue':_0x7f9a('0x7')},'callingpres':{'type':Sequelize[_0x7f9a('0x4')](_0x7f9a('0x8'),_0x7f9a('0x9'),'ALLOWED_FAILED_SCREEN',_0x7f9a('0xa'),_0x7f9a('0xb'),_0x7f9a('0xc'),_0x7f9a('0xd'),_0x7f9a('0xe'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0x7f9a('0x2')]},'remotesecret':{'type':Sequelize[_0x7f9a('0x2')]},'transport':{'type':Sequelize['STRING'],'defaultValue':_0x7f9a('0xf'),'set':function(_0x289976){this['setDataValue'](_0x7f9a('0x10'),_0x289976?_0x289976[_0x7f9a('0x11')](','):null);},'get':function(){return this[_0x7f9a('0x12')](_0x7f9a('0x10'))?this[_0x7f9a('0x12')](_0x7f9a('0x10'))[_0x7f9a('0x13')](','):null;},'comment':_0x7f9a('0x14')},'dtmfmode':{'type':Sequelize[_0x7f9a('0x4')]('rfc2833','info',_0x7f9a('0x15'),_0x7f9a('0x16'),'auto'),'defaultValue':_0x7f9a('0x17')},'directmedia':{'type':Sequelize[_0x7f9a('0x4')](_0x7f9a('0x18'),'no',_0x7f9a('0x19'),_0x7f9a('0x1a'),_0x7f9a('0x1b')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x7f9a('0x4')](_0x7f9a('0x18'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x7f9a('0x2')]},'directmediadeny':{'type':Sequelize[_0x7f9a('0x2')]},'nat':{'type':Sequelize['STRING'],'defaultValue':'force_rport,comedia','set':function(_0x1d948b){this['setDataValue'](_0x7f9a('0x1c'),_0x1d948b?_0x1d948b[_0x7f9a('0x11')](','):null);},'get':function(){return this[_0x7f9a('0x12')](_0x7f9a('0x1c'))?this[_0x7f9a('0x12')](_0x7f9a('0x1c'))[_0x7f9a('0x13')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x7f9a('0x2')]},'namedcallgroup':{'type':Sequelize[_0x7f9a('0x2')]},'pickupgroup':{'type':Sequelize[_0x7f9a('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x7f9a('0x2')]},'language':{'type':Sequelize[_0x7f9a('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x7f9a('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x7f9a('0x2')],'defaultValue':_0x7f9a('0x1d')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x7f9a('0x1e'),'set':function(_0x3a67bb){this[_0x7f9a('0x1f')](_0x7f9a('0x20'),_0x3a67bb?_0x3a67bb[_0x7f9a('0x11')](';'):_0x7f9a('0x1e'));},'get':function(){return this[_0x7f9a('0x12')](_0x7f9a('0x20'))?this['getDataValue']('allow')[_0x7f9a('0x13')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0x7f9a('0x18'),'no')},'insecure':{'type':Sequelize[_0x7f9a('0x2')],'defaultValue':_0x7f9a('0x21'),'set':function(_0x58fbd7){this['setDataValue'](_0x7f9a('0x22'),_0x58fbd7?_0x58fbd7[_0x7f9a('0x11')](','):null);},'get':function(){return this[_0x7f9a('0x12')](_0x7f9a('0x22'))?this['getDataValue'](_0x7f9a('0x22'))[_0x7f9a('0x13')](','):null;},'comment':_0x7f9a('0x23')},'trustrpid':{'type':Sequelize['ENUM'](_0x7f9a('0x18'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x7f9a('0x4')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x7f9a('0x4')](_0x7f9a('0x18'),'no','never')},'promiscredir':{'type':Sequelize[_0x7f9a('0x4')](_0x7f9a('0x18'),'no')},'useclientcode':{'type':Sequelize['ENUM'](_0x7f9a('0x18'),'no')},'accountcode':{'type':Sequelize[_0x7f9a('0x24')](0xb)},'setvar':{'type':Sequelize[_0x7f9a('0x2')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0x7f9a('0x25')},'amaflags':{'type':Sequelize[_0x7f9a('0x2')]},'callcounter':{'type':Sequelize[_0x7f9a('0x4')](_0x7f9a('0x18'),'no'),'defaultValue':_0x7f9a('0x18')},'busylevel':{'type':Sequelize[_0x7f9a('0x24')](0xb)},'allowoverlap':{'type':Sequelize[_0x7f9a('0x4')](_0x7f9a('0x18'),'no')},'allowsubscribe':{'type':Sequelize[_0x7f9a('0x4')](_0x7f9a('0x18'),'no')},'allowtransfer':{'type':Sequelize[_0x7f9a('0x4')](_0x7f9a('0x18'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM']('yes','no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0x7f9a('0x2')]},'videosupport':{'type':Sequelize['ENUM']('yes','no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x7f9a('0x24')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x7f9a('0x4')](_0x7f9a('0x18'),'no')},'mailbox':{'type':Sequelize[_0x7f9a('0x2')]},'session_timers':{'type':Sequelize[_0x7f9a('0x4')](_0x7f9a('0x26'),'refuse',_0x7f9a('0x27'))},'session_expires':{'type':Sequelize[_0x7f9a('0x24')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0x7f9a('0x4')](_0x7f9a('0x28'),_0x7f9a('0x29')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x7f9a('0x2')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0x7f9a('0x2')]},'port':{'type':Sequelize[_0x7f9a('0x24')](0x5)},'qualify':{'type':Sequelize[_0x7f9a('0x4')](_0x7f9a('0x18'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0x7f9a('0x2')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x7f9a('0x24')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0x7f9a('0x18'),'no',_0x7f9a('0x2a')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x7f9a('0x2')]},'callbackextension':{'type':Sequelize[_0x7f9a('0x2')]},'timert1':{'type':Sequelize[_0x7f9a('0x24')](0xb)},'timerb':{'type':Sequelize[_0x7f9a('0x24')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0x7f9a('0x2')]},'contactacl':{'type':Sequelize[_0x7f9a('0x2')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0x7f9a('0x2')]},'maxforwards':{'type':Sequelize[_0x7f9a('0x24')](0xb)},'encryption':{'type':Sequelize[_0x7f9a('0x4')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x7f9a('0x4')](_0x7f9a('0x18'),'no')},'force_avp':{'type':Sequelize['ENUM']('yes','no')},'icesupport':{'type':Sequelize['ENUM'](_0x7f9a('0x18'),'no')},'dtlsenable':{'type':Sequelize[_0x7f9a('0x4')]('yes','no')},'dtlsverify':{'type':Sequelize[_0x7f9a('0x4')](_0x7f9a('0x18'),'no',_0x7f9a('0x2b'),_0x7f9a('0x2c'))},'dtlsrekey':{'type':Sequelize[_0x7f9a('0x24')](0xb)},'dtlscertfile':{'type':Sequelize[_0x7f9a('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0x7f9a('0x2')]},'dtlscipher':{'type':Sequelize[_0x7f9a('0x2')]},'dtlscafile':{'type':Sequelize[_0x7f9a('0x2')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0x7f9a('0x4')](_0x7f9a('0x2d'),_0x7f9a('0x2e'),_0x7f9a('0x2f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x7f9a('0x2')]},'usereqphone':{'type':Sequelize[_0x7f9a('0x4')](_0x7f9a('0x18'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x7f9a('0x2')]},'recordofffeature':{'type':Sequelize[_0x7f9a('0x2')]},'call_limit':{'type':Sequelize[_0x7f9a('0x24')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x7f9a('0x4')](_0x7f9a('0x18'),'no')},'subscribemwi':{'type':Sequelize[_0x7f9a('0x4')](_0x7f9a('0x18'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0x7f9a('0x2')]},'mohsuggest':{'type':Sequelize[_0x7f9a('0x2')]},'parkinglot':{'type':Sequelize[_0x7f9a('0x2')]},'description':{'type':Sequelize[_0x7f9a('0x2')]},'host':{'type':Sequelize['STRING'],'defaultValue':_0x7f9a('0x30')},'canreinvite':{'type':Sequelize[_0x7f9a('0x4')]('yes','no',_0x7f9a('0x19'),_0x7f9a('0x1a'),_0x7f9a('0x31')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x7f9a('0x2')]},'otherFields':{'type':Sequelize[_0x7f9a('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x7f9a('0x2')],'defaultValue':'no'}}; \ No newline at end of file +var _0x0e53=['sequelize','exports','STRING','name','ENUM','friend','user','peer','from-voip-provider','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','setDataValue','getDataValue','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','shortinfo','inband','rfc2833','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','pai','fingerprint','certificate','active','actpass','dynamic','update,nonat'];(function(_0x3ae74c,_0x11e077){var _0x118428=function(_0x507225){while(--_0x507225){_0x3ae74c['push'](_0x3ae74c['shift']());}};_0x118428(++_0x11e077);}(_0x0e53,0x1a8));var _0x30e5=function(_0x18a682,_0x403797){_0x18a682=_0x18a682-0x0;var _0x43413f=_0x0e53[_0x18a682];return _0x43413f;};'use strict';var Sequelize=require(_0x30e5('0x0'));module[_0x30e5('0x1')]={'name':{'type':Sequelize[_0x30e5('0x2')],'allowNull':![],'unique':_0x30e5('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x30e5('0x4')](_0x30e5('0x5'),_0x30e5('0x6'),_0x30e5('0x7')),'allowNull':![],'defaultValue':_0x30e5('0x5')},'context':{'type':Sequelize[_0x30e5('0x2')],'allowNull':![],'defaultValue':_0x30e5('0x8')},'callingpres':{'type':Sequelize[_0x30e5('0x4')]('ALLOWED_NOT_SCREENED',_0x30e5('0x9'),'ALLOWED_FAILED_SCREEN',_0x30e5('0xa'),_0x30e5('0xb'),_0x30e5('0xc'),_0x30e5('0xd'),'PROHIB')},'deny':{'type':Sequelize[_0x30e5('0x2')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0x30e5('0x2')]},'md5secret':{'type':Sequelize[_0x30e5('0x2')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0x30e5('0x2')],'defaultValue':_0x30e5('0xe'),'set':function(_0x5e66b3){this[_0x30e5('0xf')]('transport',_0x5e66b3?_0x5e66b3['join'](','):null);},'get':function(){return this[_0x30e5('0x10')](_0x30e5('0x11'))?this[_0x30e5('0x10')]('transport')[_0x30e5('0x12')](','):null;},'comment':_0x30e5('0x13')},'dtmfmode':{'type':Sequelize[_0x30e5('0x4')]('rfc2833','info',_0x30e5('0x14'),_0x30e5('0x15'),'auto'),'defaultValue':_0x30e5('0x16')},'directmedia':{'type':Sequelize[_0x30e5('0x4')](_0x30e5('0x17'),'no',_0x30e5('0x18'),_0x30e5('0x19'),_0x30e5('0x1a')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x30e5('0x4')](_0x30e5('0x17'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x30e5('0x2')]},'directmediadeny':{'type':Sequelize[_0x30e5('0x2')]},'nat':{'type':Sequelize[_0x30e5('0x2')],'defaultValue':_0x30e5('0x1b'),'set':function(_0x3ce3f3){this[_0x30e5('0xf')](_0x30e5('0x1c'),_0x3ce3f3?_0x3ce3f3['join'](','):null);},'get':function(){return this[_0x30e5('0x10')](_0x30e5('0x1c'))?this['getDataValue'](_0x30e5('0x1c'))[_0x30e5('0x12')](','):null;},'comment':_0x30e5('0x1d')},'callgroup':{'type':Sequelize[_0x30e5('0x2')]},'namedcallgroup':{'type':Sequelize[_0x30e5('0x2')]},'pickupgroup':{'type':Sequelize[_0x30e5('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x30e5('0x2')]},'language':{'type':Sequelize[_0x30e5('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x30e5('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x30e5('0x2')],'defaultValue':_0x30e5('0x1e')},'allow':{'type':Sequelize[_0x30e5('0x2')],'allowNull':![],'defaultValue':_0x30e5('0x1f'),'set':function(_0x16bb82){this[_0x30e5('0xf')](_0x30e5('0x20'),_0x16bb82?_0x16bb82[_0x30e5('0x21')](';'):_0x30e5('0x1f'));},'get':function(){return this[_0x30e5('0x10')](_0x30e5('0x20'))?this[_0x30e5('0x10')](_0x30e5('0x20'))[_0x30e5('0x12')](';'):null;},'comment':_0x30e5('0x22')},'autoframing':{'type':Sequelize[_0x30e5('0x4')](_0x30e5('0x17'),'no')},'insecure':{'type':Sequelize[_0x30e5('0x2')],'defaultValue':_0x30e5('0x23'),'set':function(_0x129202){this[_0x30e5('0xf')](_0x30e5('0x24'),_0x129202?_0x129202[_0x30e5('0x21')](','):null);},'get':function(){return this[_0x30e5('0x10')](_0x30e5('0x24'))?this['getDataValue']('insecure')[_0x30e5('0x12')](','):null;},'comment':_0x30e5('0x25')},'trustrpid':{'type':Sequelize[_0x30e5('0x4')](_0x30e5('0x17'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x30e5('0x4')](_0x30e5('0x17'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x30e5('0x4')]('yes','no','never')},'promiscredir':{'type':Sequelize['ENUM']('yes','no')},'useclientcode':{'type':Sequelize[_0x30e5('0x4')](_0x30e5('0x17'),'no')},'accountcode':{'type':Sequelize[_0x30e5('0x26')](0xb)},'setvar':{'type':Sequelize[_0x30e5('0x2')]},'callerid':{'type':Sequelize[_0x30e5('0x2')],'defaultValue':_0x30e5('0x27')},'amaflags':{'type':Sequelize[_0x30e5('0x2')]},'callcounter':{'type':Sequelize['ENUM'](_0x30e5('0x17'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x30e5('0x26')](0xb)},'allowoverlap':{'type':Sequelize[_0x30e5('0x4')](_0x30e5('0x17'),'no')},'allowsubscribe':{'type':Sequelize[_0x30e5('0x4')](_0x30e5('0x17'),'no')},'allowtransfer':{'type':Sequelize[_0x30e5('0x4')]('yes','no')},'ignoresdpversion':{'type':Sequelize[_0x30e5('0x4')]('yes','no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0x30e5('0x2')]},'videosupport':{'type':Sequelize['ENUM'](_0x30e5('0x17'),'no',_0x30e5('0x28')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x30e5('0x26')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x30e5('0x4')](_0x30e5('0x17'),'no')},'mailbox':{'type':Sequelize[_0x30e5('0x2')]},'session_timers':{'type':Sequelize[_0x30e5('0x4')](_0x30e5('0x29'),_0x30e5('0x2a'),_0x30e5('0x2b'))},'session_expires':{'type':Sequelize[_0x30e5('0x26')](0xb)},'session_minse':{'type':Sequelize[_0x30e5('0x26')](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0x30e5('0x2c'),_0x30e5('0x2d')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x30e5('0x2')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0x30e5('0x2')]},'port':{'type':Sequelize[_0x30e5('0x26')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0x30e5('0x17'),'no'),'defaultValue':_0x30e5('0x17')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x30e5('0x26')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x30e5('0x26')](0xb)},'sendrpid':{'type':Sequelize[_0x30e5('0x4')](_0x30e5('0x17'),'no',_0x30e5('0x2e')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0x30e5('0x2')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0x30e5('0x26')](0xb)},'qualifyfreq':{'type':Sequelize[_0x30e5('0x26')](0xb)},'contactpermit':{'type':Sequelize[_0x30e5('0x2')]},'contactdeny':{'type':Sequelize[_0x30e5('0x2')]},'contactacl':{'type':Sequelize[_0x30e5('0x2')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0x30e5('0x4')](_0x30e5('0x17'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x30e5('0x4')]('yes','no')},'force_avp':{'type':Sequelize[_0x30e5('0x4')](_0x30e5('0x17'),'no')},'icesupport':{'type':Sequelize['ENUM'](_0x30e5('0x17'),'no')},'dtlsenable':{'type':Sequelize['ENUM'](_0x30e5('0x17'),'no')},'dtlsverify':{'type':Sequelize[_0x30e5('0x4')]('yes','no',_0x30e5('0x2f'),_0x30e5('0x30'))},'dtlsrekey':{'type':Sequelize[_0x30e5('0x26')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0x30e5('0x2')]},'dtlscipher':{'type':Sequelize[_0x30e5('0x2')]},'dtlscafile':{'type':Sequelize[_0x30e5('0x2')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0x30e5('0x4')](_0x30e5('0x31'),'passive',_0x30e5('0x32')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x30e5('0x2')]},'usereqphone':{'type':Sequelize[_0x30e5('0x4')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0x30e5('0x2')]},'call_limit':{'type':Sequelize[_0x30e5('0x26')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM']('yes','no')},'subscribemwi':{'type':Sequelize[_0x30e5('0x4')]('yes','no')},'vmexten':{'type':Sequelize[_0x30e5('0x2')]},'mohinterpret':{'type':Sequelize[_0x30e5('0x2')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x30e5('0x2')]},'host':{'type':Sequelize[_0x30e5('0x2')],'defaultValue':_0x30e5('0x33')},'canreinvite':{'type':Sequelize['ENUM'](_0x30e5('0x17'),'no',_0x30e5('0x18'),'update',_0x30e5('0x34')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x30e5('0x2')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x30e5('0x2')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index 3a8e95f..1bbea00 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 _0x54ef=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','include','find','get','updatedAt','omit','body','createdAt','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','server/files/templates/trunk.ejs','utf8','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','userProfileId','root','chan_sip.so','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','http','request','info','Trunk,\x20%s,\x20%s','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','Trunks','UserProfileResource','name','send','index','map','Trunk','rawAttributes','fieldName','type','key','model','query','keys','filters'];(function(_0x58903f,_0x3587d3){var _0x5226b1=function(_0x51a02a){while(--_0x51a02a){_0x58903f['push'](_0x58903f['shift']());}};_0x5226b1(++_0x3587d3);}(_0x54ef,0x112));var _0xf54e=function(_0x88c2f,_0x36c681){_0x88c2f=_0x88c2f-0x0;var _0x52f41c=_0x54ef[_0x88c2f];return _0x52f41c;};'use strict';var emlformat=require(_0xf54e('0x0'));var rimraf=require(_0xf54e('0x1'));var zipdir=require(_0xf54e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf54e('0x3'));var moment=require(_0xf54e('0x4'));var BPromise=require(_0xf54e('0x5'));var Mustache=require(_0xf54e('0x6'));var util=require(_0xf54e('0x7'));var path=require(_0xf54e('0x8'));var sox=require(_0xf54e('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf54e('0xa'));var _=require(_0xf54e('0xb'));var squel=require(_0xf54e('0xc'));var crypto=require('crypto');var jsforce=require(_0xf54e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf54e('0xe'));var querystring=require(_0xf54e('0xf'));var Papa=require('papaparse');var Redis=require(_0xf54e('0x10'));var authService=require(_0xf54e('0x11'));var qs=require(_0xf54e('0x12'));var as=require(_0xf54e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf54e('0x14'))(_0xf54e('0x15'));var utils=require(_0xf54e('0x16'));var config=require(_0xf54e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xf54e('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0xf54e('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x2033e9,_0x28f776,_0x380f26,_0x5644aa){return new BPromise(function(_0x331732,_0x1bbeaa){var _0x1855fe=_0x5644aa||client;return _0x1855fe[_0xf54e('0x1a')](_0x2033e9,_0x380f26)['then'](function(_0x2366ee){logger[_0xf54e('0x1b')](_0xf54e('0x1c'),_0x28f776,'request\x20sent');logger['debug'](_0xf54e('0x1d'),_0x28f776,_0xf54e('0x1e'),JSON[_0xf54e('0x1f')](_0x2366ee));if(_0x2366ee[_0xf54e('0x20')]){if(_0x2366ee[_0xf54e('0x20')][_0xf54e('0x21')]===0x1f4){logger[_0xf54e('0x20')](_0xf54e('0x1c'),_0x28f776,_0x2366ee[_0xf54e('0x20')][_0xf54e('0x22')]);return _0x1bbeaa(_0x2366ee[_0xf54e('0x20')]['message']);}logger['error'](_0xf54e('0x1c'),_0x28f776,_0x2366ee['error'][_0xf54e('0x22')]);return _0x331732(_0x2366ee[_0xf54e('0x20')][_0xf54e('0x22')]);}else{logger[_0xf54e('0x1b')](_0xf54e('0x1c'),_0x28f776,_0xf54e('0x1e'));_0x331732(_0x2366ee[_0xf54e('0x23')][_0xf54e('0x22')]);}})[_0xf54e('0x24')](function(_0x5f9eea){logger[_0xf54e('0x20')]('Trunk,\x20%s,\x20%s',_0x28f776,_0x5f9eea);_0x1bbeaa(_0x5f9eea);});});}function respondWithStatusCode(_0x6f6d29,_0x54f914){_0x54f914=_0x54f914||0xcc;return function(_0x264a8f){if(_0x264a8f){return _0x6f6d29[_0xf54e('0x25')](_0x54f914);}return _0x6f6d29[_0xf54e('0x26')](_0x54f914)[_0xf54e('0x27')]();};}function respondWithResult(_0x3805a7,_0x160160){_0x160160=_0x160160||0xc8;return function(_0x1e08d1){if(_0x1e08d1){return _0x3805a7[_0xf54e('0x26')](_0x160160)[_0xf54e('0x28')](_0x1e08d1);}};}function respondWithFilteredResult(_0x33457f,_0xf6cdd7){return function(_0x39c0ae){if(_0x39c0ae){var _0x2ea001=typeof _0xf6cdd7['offset']===_0xf54e('0x29')&&typeof _0xf6cdd7['limit']===_0xf54e('0x29');var _0x5e63f4=_0x39c0ae[_0xf54e('0x2a')];var _0x269f47=_0x2ea001?0x0:_0xf6cdd7[_0xf54e('0x2b')];var _0xa13cd0=_0x2ea001?_0x39c0ae[_0xf54e('0x2a')]:_0xf6cdd7[_0xf54e('0x2b')]+_0xf6cdd7[_0xf54e('0x2c')];var _0x54bd8f;if(_0xa13cd0>=_0x5e63f4){_0xa13cd0=_0x5e63f4;_0x54bd8f=0xc8;}else{_0x54bd8f=0xce;}_0x33457f['status'](_0x54bd8f);return _0x33457f[_0xf54e('0x2d')](_0xf54e('0x2e'),_0x269f47+'-'+_0xa13cd0+'/'+_0x5e63f4)[_0xf54e('0x28')](_0x39c0ae);}return null;};}function patchUpdates(_0x16d00f){return function(_0xb2d4c4){try{jsonpatch[_0xf54e('0x2f')](_0xb2d4c4,_0x16d00f,!![]);}catch(_0x2b5408){return BPromise[_0xf54e('0x30')](_0x2b5408);}return _0xb2d4c4[_0xf54e('0x31')]();};}function saveUpdates(_0x12edc3,_0x5ea0cc){return function(_0x5f29d3){if(_0x5f29d3){return _0x5f29d3[_0xf54e('0x32')](_0x12edc3)[_0xf54e('0x33')](function(_0x4d8fdd){return _0x4d8fdd;});}return null;};}function removeEntity(_0x3e319c,_0x82e313){return function(_0x379110){if(_0x379110){return _0x379110[_0xf54e('0x34')]()['then'](function(){var _0x54bea4=_0x379110['get']({'plain':!![]});var _0x3c0cca=_0xf54e('0x35');return db[_0xf54e('0x36')][_0xf54e('0x34')]({'where':{'type':_0x3c0cca,'resourceId':_0x54bea4['id']}})[_0xf54e('0x33')](function(){return _0x379110;});})[_0xf54e('0x33')](function(){_0x3e319c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x530cee,_0xc04e04){return function(_0x734187){if(!_0x734187){_0x530cee['sendStatus'](0x194);}return _0x734187;};}function handleError(_0x4d9b06,_0xda1d10){_0xda1d10=_0xda1d10||0x1f4;return function(_0x2c0d30){logger[_0xf54e('0x20')](_0x2c0d30['stack']);if(_0x2c0d30[_0xf54e('0x37')]){delete _0x2c0d30[_0xf54e('0x37')];}_0x4d9b06['status'](_0xda1d10)[_0xf54e('0x38')](_0x2c0d30);};}exports[_0xf54e('0x39')]=function(_0x5af03,_0x1eeeb4){var _0x12ef97={},_0x199056={},_0x4e00b7={'count':0x0,'rows':[]};var _0x5d45cf=_[_0xf54e('0x3a')](db[_0xf54e('0x3b')][_0xf54e('0x3c')],function(_0x4b1f84){return{'name':_0x4b1f84[_0xf54e('0x3d')],'type':_0x4b1f84[_0xf54e('0x3e')][_0xf54e('0x3f')]};});_0x199056[_0xf54e('0x40')]=_[_0xf54e('0x3a')](_0x5d45cf,_0xf54e('0x37'));_0x199056[_0xf54e('0x41')]=_[_0xf54e('0x42')](_0x5af03[_0xf54e('0x41')]);_0x199056[_0xf54e('0x43')]=_[_0xf54e('0x44')](_0x199056[_0xf54e('0x40')],_0x199056[_0xf54e('0x41')]);_0x12ef97[_0xf54e('0x45')]=_[_0xf54e('0x44')](_0x199056['model'],qs['fields'](_0x5af03['query'][_0xf54e('0x46')]));_0x12ef97[_0xf54e('0x45')]=_0x12ef97['attributes'][_0xf54e('0x47')]?_0x12ef97[_0xf54e('0x45')]:_0x199056[_0xf54e('0x40')];if(!_0x5af03['query'][_0xf54e('0x48')](_0xf54e('0x49'))){_0x12ef97[_0xf54e('0x2c')]=qs[_0xf54e('0x2c')](_0x5af03[_0xf54e('0x41')][_0xf54e('0x2c')]);_0x12ef97[_0xf54e('0x2b')]=qs[_0xf54e('0x2b')](_0x5af03[_0xf54e('0x41')]['offset']);}_0x12ef97[_0xf54e('0x4a')]=qs[_0xf54e('0x4b')](_0x5af03[_0xf54e('0x41')][_0xf54e('0x4b')]);_0x12ef97[_0xf54e('0x4c')]=qs[_0xf54e('0x43')](_['pick'](_0x5af03[_0xf54e('0x41')],_0x199056['filters']),_0x5d45cf);if(_0x5af03[_0xf54e('0x41')]['filter']){_0x12ef97[_0xf54e('0x4c')]=_[_0xf54e('0x4d')](_0x12ef97[_0xf54e('0x4c')],{'$or':_['map'](_0x5d45cf,function(_0x1af35d){if(_0x1af35d[_0xf54e('0x3e')]!==_0xf54e('0x4e')){var _0x32fb46={};_0x32fb46[_0x1af35d[_0xf54e('0x37')]]={'$like':'%'+_0x5af03['query'][_0xf54e('0x4f')]+'%'};return _0x32fb46;}})});}_0x12ef97=_[_0xf54e('0x4d')]({},_0x12ef97,_0x5af03[_0xf54e('0x50')]);var _0x45592b={'where':_0x12ef97['where']};return db[_0xf54e('0x3b')][_0xf54e('0x2a')](_0x45592b)['then'](function(_0x22c842){_0x4e00b7[_0xf54e('0x2a')]=_0x22c842;if(_0x5af03[_0xf54e('0x41')][_0xf54e('0x51')]){_0x12ef97['include']=[{'all':!![]}];}return db[_0xf54e('0x3b')][_0xf54e('0x52')](_0x12ef97);})[_0xf54e('0x33')](function(_0xb4654f){_0x4e00b7[_0xf54e('0x53')]=_0xb4654f;return _0x4e00b7;})[_0xf54e('0x33')](respondWithFilteredResult(_0x1eeeb4,_0x12ef97))[_0xf54e('0x24')](handleError(_0x1eeeb4,null));};exports[_0xf54e('0x54')]=function(_0x15bfef,_0x21f2f8){var _0xaf9bf0={'raw':![],'where':{'id':_0x15bfef[_0xf54e('0x55')]['id']}},_0x1f4cf8={};_0x1f4cf8[_0xf54e('0x40')]=_[_0xf54e('0x42')](db[_0xf54e('0x3b')][_0xf54e('0x3c')]);_0x1f4cf8[_0xf54e('0x41')]=_[_0xf54e('0x42')](_0x15bfef[_0xf54e('0x41')]);_0x1f4cf8['filters']=_['intersection'](_0x1f4cf8[_0xf54e('0x40')],_0x1f4cf8[_0xf54e('0x41')]);_0xaf9bf0[_0xf54e('0x45')]=_[_0xf54e('0x44')](_0x1f4cf8[_0xf54e('0x40')],qs[_0xf54e('0x46')](_0x15bfef[_0xf54e('0x41')][_0xf54e('0x46')]));_0xaf9bf0[_0xf54e('0x45')]=_0xaf9bf0[_0xf54e('0x45')][_0xf54e('0x47')]?_0xaf9bf0['attributes']:_0x1f4cf8[_0xf54e('0x40')];if(_0x15bfef[_0xf54e('0x41')][_0xf54e('0x51')]){_0xaf9bf0[_0xf54e('0x56')]=[{'all':!![]}];}_0xaf9bf0=_[_0xf54e('0x4d')]({},_0xaf9bf0,_0x15bfef[_0xf54e('0x50')]);return db[_0xf54e('0x3b')]['find'](_0xaf9bf0)[_0xf54e('0x33')](handleEntityNotFound(_0x21f2f8,null))[_0xf54e('0x33')](respondWithResult(_0x21f2f8,null))[_0xf54e('0x24')](handleError(_0x21f2f8,null));};exports['clone']=function(_0x3ce832,_0x54ac1a){var _0x465a0f={'where':{'id':_0x3ce832[_0xf54e('0x55')]['id']}},_0x400ee0={};_0x400ee0['model']=_[_0xf54e('0x42')](db[_0xf54e('0x3b')][_0xf54e('0x3c')]);_0x465a0f[_0xf54e('0x45')]=_[_0xf54e('0x44')](_0x400ee0[_0xf54e('0x40')],qs[_0xf54e('0x46')](_0x3ce832['query']['fields']));_0x465a0f[_0xf54e('0x45')]=_0x465a0f[_0xf54e('0x45')]['length']?_0x465a0f[_0xf54e('0x45')]:_0x400ee0['model'];if(_0x3ce832[_0xf54e('0x41')]['includeAll']){_0x465a0f[_0xf54e('0x56')]=[{'all':!![]}];}_0x465a0f=_[_0xf54e('0x4d')]({},_0x465a0f,_0x3ce832[_0xf54e('0x50')]);return db[_0xf54e('0x3b')][_0xf54e('0x57')](_0x465a0f)[_0xf54e('0x33')](handleEntityNotFound(_0x54ac1a,null))['then'](function(_0x479572){if(_0x479572){var _0x79345=_0x479572[_0xf54e('0x58')]({'plain':!![]});_0x79345=qs['omit'](_0x79345,['id','createdAt',_0xf54e('0x59')]);_0x3ce832['body']=_[_0xf54e('0x5a')](_0x3ce832[_0xf54e('0x5b')],['id',_0xf54e('0x5c'),_0xf54e('0x59')]);return db[_0xf54e('0x3b')][_0xf54e('0x5d')](_[_0xf54e('0x4d')](_0x79345,_0x3ce832[_0xf54e('0x5b')]),{'include':_0x3ce832[_0xf54e('0x41')][_0xf54e('0x51')]?[{'all':!![]}]:undefined})[_0xf54e('0x33')](function(_0x2c6d0e){var _0x65bdf2=_0x3ce832[_0xf54e('0x5e')]['get']({'plain':!![]});if(!_0x65bdf2)throw new Error(_0xf54e('0x5f'));if(_0x65bdf2[_0xf54e('0x60')]===_0xf54e('0x5e')){var _0x11908b=_0x2c6d0e[_0xf54e('0x58')]({'plain':!![]});var _0x494629=_0xf54e('0x35');return db[_0xf54e('0x61')]['find']({'where':{'name':_0x494629,'userProfileId':_0x65bdf2['userProfileId']},'raw':!![]})[_0xf54e('0x33')](function(_0x4b4a2f){if(_0x4b4a2f&&_0x4b4a2f[_0xf54e('0x62')]===0x0){return db[_0xf54e('0x36')][_0xf54e('0x5d')]({'name':_0x11908b[_0xf54e('0x37')],'resourceId':_0x11908b['id'],'type':_0x4b4a2f['name'],'sectionId':_0x4b4a2f['id']},{})[_0xf54e('0x33')](function(){return _0x2c6d0e;});}else{return _0x2c6d0e;}})['catch'](function(_0x3800d4){logger[_0xf54e('0x20')](_0xf54e('0x63'),_0x3800d4);throw _0x3800d4;});}return _0x2c6d0e;});}})['then'](respondWithResult(_0x54ac1a,0xc9))[_0xf54e('0x24')](handleError(_0x54ac1a,null));};exports['create']=function(_0x3f7224,_0x3e2101,_0x5500d7){var _0x380b4f;return db['Trunk'][_0xf54e('0x5d')](_0x3f7224[_0xf54e('0x5b')],{'raw':!![]})[_0xf54e('0x33')](function(_0x38405c){_0x380b4f=_0x38405c;return db[_0xf54e('0x3b')]['findAll']({'raw':!![]});})[_0xf54e('0x33')](function(_0x1d18d3){var _0x57db6f=fs[_0xf54e('0x64')](path[_0xf54e('0x65')](config['root'],_0xf54e('0x66')),_0xf54e('0x67'));var _0x309895=fs['readFileSync'](path[_0xf54e('0x65')](config['root'],_0xf54e('0x68')),_0xf54e('0x67'));var _0x5e45e7=ejs[_0xf54e('0x69')](_0x57db6f,{'trunks':_0x1d18d3||[]});fs[_0xf54e('0x6a')](_0xf54e('0x6b'),_0x5e45e7);if(_0x380b4f[_0xf54e('0x6c')]){var _0x38bf71=ejs[_0xf54e('0x69')](_0x309895,{'trunks':_0x1d18d3||[]});fs[_0xf54e('0x6a')](_0xf54e('0x6d'),_0x38bf71);}})[_0xf54e('0x33')](function(){return respondWithRpcPromise(_0xf54e('0x6e'),_0xf54e('0x5d'),{'module':'chan_sip.so'});})[_0xf54e('0x33')](function(){var _0x2c20b5=_0x3f7224[_0xf54e('0x5e')]['get']({'plain':!![]});if(!_0x2c20b5)throw new Error(_0xf54e('0x5f'));if(_0x2c20b5[_0xf54e('0x60')]===_0xf54e('0x5e')){var _0x13db3e=_0x380b4f[_0xf54e('0x58')]({'plain':!![]});return db[_0xf54e('0x61')][_0xf54e('0x57')]({'where':{'name':'Trunks','userProfileId':_0x2c20b5[_0xf54e('0x6f')]},'raw':!![]})[_0xf54e('0x33')](function(_0x261c39){if(_0x261c39&&_0x261c39['autoAssociation']===0x0){return db[_0xf54e('0x36')][_0xf54e('0x5d')]({'name':_0x13db3e[_0xf54e('0x37')],'resourceId':_0x13db3e['id'],'type':_0x261c39[_0xf54e('0x37')],'sectionId':_0x261c39['id']},{})['then'](function(){return _0x380b4f;});}else{return _0x380b4f;}})['catch'](function(_0x25d05e){logger[_0xf54e('0x20')](_0xf54e('0x63'),_0x25d05e);throw _0x25d05e;});}return _0x380b4f;})[_0xf54e('0x33')](respondWithResult(_0x3e2101,0xc9))[_0xf54e('0x24')](handleError(_0x3e2101,null));};exports[_0xf54e('0x32')]=function(_0x35b5a4,_0x3b2a3e,_0xf5108b){var _0x205b47;return db['Trunk'][_0xf54e('0x57')]({'where':{'id':_0x35b5a4[_0xf54e('0x55')]['id']}})[_0xf54e('0x33')](handleEntityNotFound(_0x3b2a3e,null))[_0xf54e('0x33')](saveUpdates(_0x35b5a4['body'],null))[_0xf54e('0x33')](function(_0x1de6dd){if(_0x1de6dd){_0x205b47=_0x1de6dd;return db[_0xf54e('0x3b')][_0xf54e('0x52')]({'raw':!![]});}})['then'](function(_0x394862){if(_0x394862){var _0x4876b5=fs[_0xf54e('0x64')](path['join'](config['root'],_0xf54e('0x66')),_0xf54e('0x67'));var _0x1e2834=fs[_0xf54e('0x64')](path[_0xf54e('0x65')](config[_0xf54e('0x70')],_0xf54e('0x68')),_0xf54e('0x67'));var _0x8093bc=ejs['render'](_0x4876b5,{'trunks':_0x394862||[]});fs[_0xf54e('0x6a')](_0xf54e('0x6b'),_0x8093bc);var _0x4ce10=ejs[_0xf54e('0x69')](_0x1e2834,{'trunks':_0x394862||[]});fs[_0xf54e('0x6a')](_0xf54e('0x6d'),_0x4ce10);return respondWithRpcPromise(_0xf54e('0x6e'),_0xf54e('0x32'),{'module':_0xf54e('0x71')});}return null;})[_0xf54e('0x33')](function(_0x11dec2){if(_0x11dec2){return _0x205b47;}})[_0xf54e('0x33')](respondWithResult(_0x3b2a3e,null))['catch'](handleError(_0x3b2a3e,null));};exports[_0xf54e('0x34')]=function(_0x1cfa09,_0x59acbc,_0x4a0614){var _0x85b108;return db[_0xf54e('0x3b')][_0xf54e('0x57')]({'where':{'id':_0x1cfa09[_0xf54e('0x55')]['id']}})[_0xf54e('0x33')](handleEntityNotFound(_0x59acbc,null))[_0xf54e('0x33')](removeEntity(_0x59acbc,null))[_0xf54e('0x33')](function(){return db[_0xf54e('0x3b')][_0xf54e('0x52')]({'raw':!![]});})['then'](function(_0x2bb31f){var _0x3c222a=fs[_0xf54e('0x64')](path['join'](config[_0xf54e('0x70')],'server/files/templates/trunk.ejs'),_0xf54e('0x67'));var _0x57bc6f=fs[_0xf54e('0x64')](path[_0xf54e('0x65')](config['root'],'server/files/templates/registry.ejs'),_0xf54e('0x67'));var _0x632240=ejs[_0xf54e('0x69')](_0x3c222a,{'trunks':_0x2bb31f});var _0x406261=ejs[_0xf54e('0x69')](_0x57bc6f,{'trunks':_0x2bb31f});fs['writeFileSync']('/etc/asterisk/sip_xcally_trunks.conf',_0x632240);fs[_0xf54e('0x6a')](_0xf54e('0x6d'),_0x406261);return respondWithRpcPromise(_0xf54e('0x6e'),_0xf54e('0x34'),{'module':_0xf54e('0x71')});})[_0xf54e('0x24')](handleError(_0x59acbc,null));}; \ No newline at end of file +var _0xb821=['model','map','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','Trunk','includeAll','findAll','intersection','length','include','find','params','get','omit','createdAt','updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','server/files/templates/trunk.ejs','utf8','join','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','UserProfileSection','root','rimraf','zip-dir','moment','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','stringify','code','Trunk,\x20%s,\x20%s','error','message','info','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','Trunks','name','send','index','rawAttributes','fieldName','key'];(function(_0x140298,_0xe43336){var _0x163e2c=function(_0x56029d){while(--_0x56029d){_0x140298['push'](_0x140298['shift']());}};_0x163e2c(++_0xe43336);}(_0xb821,0xa7));var _0x1b82=function(_0x17bcbc,_0x23d40d){_0x17bcbc=_0x17bcbc-0x0;var _0x58361d=_0xb821[_0x17bcbc];return _0x58361d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1b82('0x0'));var zipdir=require(_0x1b82('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1b82('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1b82('0x3'));var path=require(_0x1b82('0x4'));var sox=require(_0x1b82('0x5'));var csv=require(_0x1b82('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1b82('0x7'));var _=require(_0x1b82('0x8'));var squel=require(_0x1b82('0x9'));var crypto=require(_0x1b82('0xa'));var jsforce=require(_0x1b82('0xb'));var deskjs=require(_0x1b82('0xc'));var toCsv=require(_0x1b82('0x6'));var querystring=require(_0x1b82('0xd'));var Papa=require(_0x1b82('0xe'));var Redis=require('ioredis');var authService=require(_0x1b82('0xf'));var qs=require(_0x1b82('0x10'));var as=require(_0x1b82('0x11'));var hardwareService=require(_0x1b82('0x12'));var logger=require(_0x1b82('0x13'))(_0x1b82('0x14'));var utils=require(_0x1b82('0x15'));var config=require(_0x1b82('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x1b82('0x17'))['db'];var jayson=require(_0x1b82('0x18'));var client=jayson[_0x1b82('0x19')][_0x1b82('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x50aed7,_0x1a6285,_0x5767aa,_0x54915f){return new BPromise(function(_0x1e553a,_0x4bf75b){var _0x1cffd1=_0x54915f||client;return _0x1cffd1[_0x1b82('0x1b')](_0x50aed7,_0x5767aa)['then'](function(_0x46c2cf){logger['info']('Trunk,\x20%s,\x20%s',_0x1a6285,_0x1b82('0x1c'));logger['debug'](_0x1b82('0x1d'),_0x1a6285,_0x1b82('0x1c'),JSON[_0x1b82('0x1e')](_0x46c2cf));if(_0x46c2cf['error']){if(_0x46c2cf['error'][_0x1b82('0x1f')]===0x1f4){logger['error'](_0x1b82('0x20'),_0x1a6285,_0x46c2cf[_0x1b82('0x21')][_0x1b82('0x22')]);return _0x4bf75b(_0x46c2cf['error'][_0x1b82('0x22')]);}logger[_0x1b82('0x21')](_0x1b82('0x20'),_0x1a6285,_0x46c2cf[_0x1b82('0x21')][_0x1b82('0x22')]);return _0x1e553a(_0x46c2cf['error'][_0x1b82('0x22')]);}else{logger[_0x1b82('0x23')](_0x1b82('0x20'),_0x1a6285,_0x1b82('0x1c'));_0x1e553a(_0x46c2cf[_0x1b82('0x24')][_0x1b82('0x22')]);}})[_0x1b82('0x25')](function(_0x486e92){logger[_0x1b82('0x21')](_0x1b82('0x20'),_0x1a6285,_0x486e92);_0x4bf75b(_0x486e92);});});}function respondWithStatusCode(_0x5b8d09,_0x561d78){_0x561d78=_0x561d78||0xcc;return function(_0x225b81){if(_0x225b81){return _0x5b8d09[_0x1b82('0x26')](_0x561d78);}return _0x5b8d09['status'](_0x561d78)[_0x1b82('0x27')]();};}function respondWithResult(_0x4db690,_0x5cd458){_0x5cd458=_0x5cd458||0xc8;return function(_0x5f556b){if(_0x5f556b){return _0x4db690[_0x1b82('0x28')](_0x5cd458)[_0x1b82('0x29')](_0x5f556b);}};}function respondWithFilteredResult(_0xfd00d1,_0x257b79){return function(_0x548a3b){if(_0x548a3b){var _0x222483=typeof _0x257b79[_0x1b82('0x2a')]===_0x1b82('0x2b')&&typeof _0x257b79[_0x1b82('0x2c')]===_0x1b82('0x2b');var _0x1b8b6f=_0x548a3b[_0x1b82('0x2d')];var _0x21ea34=_0x222483?0x0:_0x257b79[_0x1b82('0x2a')];var _0x1f9c6b=_0x222483?_0x548a3b[_0x1b82('0x2d')]:_0x257b79[_0x1b82('0x2a')]+_0x257b79[_0x1b82('0x2c')];var _0x5ea890;if(_0x1f9c6b>=_0x1b8b6f){_0x1f9c6b=_0x1b8b6f;_0x5ea890=0xc8;}else{_0x5ea890=0xce;}_0xfd00d1[_0x1b82('0x28')](_0x5ea890);return _0xfd00d1[_0x1b82('0x2e')](_0x1b82('0x2f'),_0x21ea34+'-'+_0x1f9c6b+'/'+_0x1b8b6f)[_0x1b82('0x29')](_0x548a3b);}return null;};}function patchUpdates(_0x18e4ff){return function(_0x115ce7){try{jsonpatch[_0x1b82('0x30')](_0x115ce7,_0x18e4ff,!![]);}catch(_0x46575f){return BPromise[_0x1b82('0x31')](_0x46575f);}return _0x115ce7[_0x1b82('0x32')]();};}function saveUpdates(_0x501ab0,_0x225c06){return function(_0x29a31e){if(_0x29a31e){return _0x29a31e[_0x1b82('0x33')](_0x501ab0)[_0x1b82('0x34')](function(_0x5b7b18){return _0x5b7b18;});}return null;};}function removeEntity(_0x474218,_0xbf65a){return function(_0x544bd5){if(_0x544bd5){return _0x544bd5[_0x1b82('0x35')]()[_0x1b82('0x34')](function(){var _0x365c3c=_0x544bd5['get']({'plain':!![]});var _0x5efb8e=_0x1b82('0x36');return db['UserProfileResource']['destroy']({'where':{'type':_0x5efb8e,'resourceId':_0x365c3c['id']}})[_0x1b82('0x34')](function(){return _0x544bd5;});})[_0x1b82('0x34')](function(){_0x474218[_0x1b82('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42a64e,_0x366db3){return function(_0xea774a){if(!_0xea774a){_0x42a64e[_0x1b82('0x26')](0x194);}return _0xea774a;};}function handleError(_0x4dd64a,_0x42c1c4){_0x42c1c4=_0x42c1c4||0x1f4;return function(_0x1cd7de){logger[_0x1b82('0x21')](_0x1cd7de['stack']);if(_0x1cd7de['name']){delete _0x1cd7de[_0x1b82('0x37')];}_0x4dd64a['status'](_0x42c1c4)[_0x1b82('0x38')](_0x1cd7de);};}exports[_0x1b82('0x39')]=function(_0x286b4b,_0x348880){var _0x1255db={},_0x3ab35c={},_0x39fe4a={'count':0x0,'rows':[]};var _0x1368df=_['map'](db['Trunk'][_0x1b82('0x3a')],function(_0x5f4baf){return{'name':_0x5f4baf[_0x1b82('0x3b')],'type':_0x5f4baf['type'][_0x1b82('0x3c')]};});_0x3ab35c[_0x1b82('0x3d')]=_[_0x1b82('0x3e')](_0x1368df,_0x1b82('0x37'));_0x3ab35c[_0x1b82('0x3f')]=_[_0x1b82('0x40')](_0x286b4b['query']);_0x3ab35c[_0x1b82('0x41')]=_['intersection'](_0x3ab35c[_0x1b82('0x3d')],_0x3ab35c['query']);_0x1255db[_0x1b82('0x42')]=_['intersection'](_0x3ab35c['model'],qs[_0x1b82('0x43')](_0x286b4b[_0x1b82('0x3f')][_0x1b82('0x43')]));_0x1255db[_0x1b82('0x42')]=_0x1255db[_0x1b82('0x42')]['length']?_0x1255db[_0x1b82('0x42')]:_0x3ab35c['model'];if(!_0x286b4b[_0x1b82('0x3f')][_0x1b82('0x44')](_0x1b82('0x45'))){_0x1255db[_0x1b82('0x2c')]=qs[_0x1b82('0x2c')](_0x286b4b['query'][_0x1b82('0x2c')]);_0x1255db['offset']=qs[_0x1b82('0x2a')](_0x286b4b[_0x1b82('0x3f')]['offset']);}_0x1255db[_0x1b82('0x46')]=qs[_0x1b82('0x47')](_0x286b4b[_0x1b82('0x3f')][_0x1b82('0x47')]);_0x1255db[_0x1b82('0x48')]=qs[_0x1b82('0x41')](_[_0x1b82('0x49')](_0x286b4b['query'],_0x3ab35c[_0x1b82('0x41')]),_0x1368df);if(_0x286b4b['query'][_0x1b82('0x4a')]){_0x1255db[_0x1b82('0x48')]=_[_0x1b82('0x4b')](_0x1255db[_0x1b82('0x48')],{'$or':_[_0x1b82('0x3e')](_0x1368df,function(_0x1d24d6){if(_0x1d24d6[_0x1b82('0x4c')]!==_0x1b82('0x4d')){var _0x192ce3={};_0x192ce3[_0x1d24d6[_0x1b82('0x37')]]={'$like':'%'+_0x286b4b[_0x1b82('0x3f')][_0x1b82('0x4a')]+'%'};return _0x192ce3;}})});}_0x1255db=_[_0x1b82('0x4b')]({},_0x1255db,_0x286b4b[_0x1b82('0x4e')]);var _0x4fb92f={'where':_0x1255db['where']};return db[_0x1b82('0x4f')]['count'](_0x4fb92f)[_0x1b82('0x34')](function(_0x3df0af){_0x39fe4a[_0x1b82('0x2d')]=_0x3df0af;if(_0x286b4b['query'][_0x1b82('0x50')]){_0x1255db['include']=[{'all':!![]}];}return db['Trunk'][_0x1b82('0x51')](_0x1255db);})[_0x1b82('0x34')](function(_0x242324){_0x39fe4a['rows']=_0x242324;return _0x39fe4a;})[_0x1b82('0x34')](respondWithFilteredResult(_0x348880,_0x1255db))[_0x1b82('0x25')](handleError(_0x348880,null));};exports['show']=function(_0x5ca898,_0x106282){var _0x2e676a={'raw':![],'where':{'id':_0x5ca898['params']['id']}},_0x2dc53e={};_0x2dc53e[_0x1b82('0x3d')]=_[_0x1b82('0x40')](db[_0x1b82('0x4f')][_0x1b82('0x3a')]);_0x2dc53e[_0x1b82('0x3f')]=_[_0x1b82('0x40')](_0x5ca898['query']);_0x2dc53e[_0x1b82('0x41')]=_['intersection'](_0x2dc53e[_0x1b82('0x3d')],_0x2dc53e[_0x1b82('0x3f')]);_0x2e676a['attributes']=_[_0x1b82('0x52')](_0x2dc53e['model'],qs[_0x1b82('0x43')](_0x5ca898[_0x1b82('0x3f')][_0x1b82('0x43')]));_0x2e676a[_0x1b82('0x42')]=_0x2e676a[_0x1b82('0x42')][_0x1b82('0x53')]?_0x2e676a['attributes']:_0x2dc53e['model'];if(_0x5ca898[_0x1b82('0x3f')][_0x1b82('0x50')]){_0x2e676a[_0x1b82('0x54')]=[{'all':!![]}];}_0x2e676a=_[_0x1b82('0x4b')]({},_0x2e676a,_0x5ca898[_0x1b82('0x4e')]);return db[_0x1b82('0x4f')][_0x1b82('0x55')](_0x2e676a)[_0x1b82('0x34')](handleEntityNotFound(_0x106282,null))['then'](respondWithResult(_0x106282,null))['catch'](handleError(_0x106282,null));};exports['clone']=function(_0x2658b5,_0x2a95d2){var _0x207f1c={'where':{'id':_0x2658b5[_0x1b82('0x56')]['id']}},_0x27ad80={};_0x27ad80[_0x1b82('0x3d')]=_[_0x1b82('0x40')](db['Trunk'][_0x1b82('0x3a')]);_0x207f1c[_0x1b82('0x42')]=_[_0x1b82('0x52')](_0x27ad80[_0x1b82('0x3d')],qs[_0x1b82('0x43')](_0x2658b5[_0x1b82('0x3f')][_0x1b82('0x43')]));_0x207f1c[_0x1b82('0x42')]=_0x207f1c['attributes'][_0x1b82('0x53')]?_0x207f1c[_0x1b82('0x42')]:_0x27ad80[_0x1b82('0x3d')];if(_0x2658b5[_0x1b82('0x3f')][_0x1b82('0x50')]){_0x207f1c['include']=[{'all':!![]}];}_0x207f1c=_['merge']({},_0x207f1c,_0x2658b5[_0x1b82('0x4e')]);return db[_0x1b82('0x4f')][_0x1b82('0x55')](_0x207f1c)[_0x1b82('0x34')](handleEntityNotFound(_0x2a95d2,null))['then'](function(_0x170905){if(_0x170905){var _0x352603=_0x170905[_0x1b82('0x57')]({'plain':!![]});_0x352603=qs[_0x1b82('0x58')](_0x352603,['id',_0x1b82('0x59'),_0x1b82('0x5a')]);_0x2658b5[_0x1b82('0x5b')]=_[_0x1b82('0x58')](_0x2658b5[_0x1b82('0x5b')],['id',_0x1b82('0x59'),'updatedAt']);return db[_0x1b82('0x4f')][_0x1b82('0x5c')](_['merge'](_0x352603,_0x2658b5[_0x1b82('0x5b')]),{'include':_0x2658b5[_0x1b82('0x3f')][_0x1b82('0x50')]?[{'all':!![]}]:undefined})[_0x1b82('0x34')](function(_0x4b26c4){var _0x30f13a=_0x2658b5[_0x1b82('0x5d')][_0x1b82('0x57')]({'plain':!![]});if(!_0x30f13a)throw new Error(_0x1b82('0x5e'));if(_0x30f13a[_0x1b82('0x5f')]===_0x1b82('0x5d')){var _0x4e8fa2=_0x4b26c4[_0x1b82('0x57')]({'plain':!![]});var _0x5267c3=_0x1b82('0x36');return db['UserProfileSection'][_0x1b82('0x55')]({'where':{'name':_0x5267c3,'userProfileId':_0x30f13a[_0x1b82('0x60')]},'raw':!![]})[_0x1b82('0x34')](function(_0x2db0fe){if(_0x2db0fe&&_0x2db0fe[_0x1b82('0x61')]===0x0){return db[_0x1b82('0x62')][_0x1b82('0x5c')]({'name':_0x4e8fa2['name'],'resourceId':_0x4e8fa2['id'],'type':_0x2db0fe[_0x1b82('0x37')],'sectionId':_0x2db0fe['id']},{})[_0x1b82('0x34')](function(){return _0x4b26c4;});}else{return _0x4b26c4;}})[_0x1b82('0x25')](function(_0x2de10c){logger[_0x1b82('0x21')](_0x1b82('0x63'),_0x2de10c);throw _0x2de10c;});}return _0x4b26c4;});}})[_0x1b82('0x34')](respondWithResult(_0x2a95d2,0xc9))[_0x1b82('0x25')](handleError(_0x2a95d2,null));};exports[_0x1b82('0x5c')]=function(_0x3f7690,_0x1873de,_0xe31cbc){var _0x1ef92c;return db['Trunk'][_0x1b82('0x5c')](_0x3f7690[_0x1b82('0x5b')],{'raw':!![]})[_0x1b82('0x34')](function(_0x4a229e){_0x1ef92c=_0x4a229e;return db[_0x1b82('0x4f')][_0x1b82('0x51')]({'raw':!![]});})['then'](function(_0x3bf106){var _0x5cc386=fs[_0x1b82('0x64')](path['join'](config['root'],_0x1b82('0x65')),_0x1b82('0x66'));var _0x3b4088=fs[_0x1b82('0x64')](path[_0x1b82('0x67')](config['root'],_0x1b82('0x68')),'utf8');var _0x143689=ejs[_0x1b82('0x69')](_0x5cc386,{'trunks':_0x3bf106||[]});fs[_0x1b82('0x6a')](_0x1b82('0x6b'),_0x143689);if(_0x1ef92c[_0x1b82('0x6c')]){var _0x29c42e=ejs[_0x1b82('0x69')](_0x3b4088,{'trunks':_0x3bf106||[]});fs[_0x1b82('0x6a')](_0x1b82('0x6d'),_0x29c42e);}})[_0x1b82('0x34')](function(){return respondWithRpcPromise(_0x1b82('0x6e'),'create',{'module':_0x1b82('0x6f')});})['then'](function(){var _0x4c2e52=_0x3f7690[_0x1b82('0x5d')][_0x1b82('0x57')]({'plain':!![]});if(!_0x4c2e52)throw new Error(_0x1b82('0x5e'));if(_0x4c2e52[_0x1b82('0x5f')]===_0x1b82('0x5d')){var _0x1dd3a1=_0x1ef92c[_0x1b82('0x57')]({'plain':!![]});return db[_0x1b82('0x70')][_0x1b82('0x55')]({'where':{'name':_0x1b82('0x36'),'userProfileId':_0x4c2e52['userProfileId']},'raw':!![]})[_0x1b82('0x34')](function(_0x4d496b){if(_0x4d496b&&_0x4d496b[_0x1b82('0x61')]===0x0){return db['UserProfileResource'][_0x1b82('0x5c')]({'name':_0x1dd3a1[_0x1b82('0x37')],'resourceId':_0x1dd3a1['id'],'type':_0x4d496b[_0x1b82('0x37')],'sectionId':_0x4d496b['id']},{})[_0x1b82('0x34')](function(){return _0x1ef92c;});}else{return _0x1ef92c;}})[_0x1b82('0x25')](function(_0x49a202){logger[_0x1b82('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x49a202);throw _0x49a202;});}return _0x1ef92c;})['then'](respondWithResult(_0x1873de,0xc9))[_0x1b82('0x25')](handleError(_0x1873de,null));};exports[_0x1b82('0x33')]=function(_0x1a4826,_0x4d986c,_0x2e9191){var _0x52f16e;return db[_0x1b82('0x4f')]['find']({'where':{'id':_0x1a4826[_0x1b82('0x56')]['id']}})[_0x1b82('0x34')](handleEntityNotFound(_0x4d986c,null))[_0x1b82('0x34')](saveUpdates(_0x1a4826[_0x1b82('0x5b')],null))['then'](function(_0x46cae4){if(_0x46cae4){_0x52f16e=_0x46cae4;return db['Trunk'][_0x1b82('0x51')]({'raw':!![]});}})[_0x1b82('0x34')](function(_0x1095fb){if(_0x1095fb){var _0x185fce=fs[_0x1b82('0x64')](path['join'](config[_0x1b82('0x71')],'server/files/templates/trunk.ejs'),_0x1b82('0x66'));var _0x5ce247=fs[_0x1b82('0x64')](path[_0x1b82('0x67')](config[_0x1b82('0x71')],'server/files/templates/registry.ejs'),_0x1b82('0x66'));var _0x31a56e=ejs[_0x1b82('0x69')](_0x185fce,{'trunks':_0x1095fb||[]});fs['writeFileSync'](_0x1b82('0x6b'),_0x31a56e);var _0x396272=ejs[_0x1b82('0x69')](_0x5ce247,{'trunks':_0x1095fb||[]});fs[_0x1b82('0x6a')](_0x1b82('0x6d'),_0x396272);return respondWithRpcPromise('Reload',_0x1b82('0x33'),{'module':'chan_sip.so'});}return null;})['then'](function(_0x2759ac){if(_0x2759ac){return _0x52f16e;}})['then'](respondWithResult(_0x4d986c,null))[_0x1b82('0x25')](handleError(_0x4d986c,null));};exports[_0x1b82('0x35')]=function(_0x5f349f,_0x3e17b0,_0x391207){var _0x553ac5;return db['Trunk']['find']({'where':{'id':_0x5f349f['params']['id']}})[_0x1b82('0x34')](handleEntityNotFound(_0x3e17b0,null))[_0x1b82('0x34')](removeEntity(_0x3e17b0,null))[_0x1b82('0x34')](function(){return db['Trunk'][_0x1b82('0x51')]({'raw':!![]});})['then'](function(_0x7d95b6){var _0x372c3b=fs[_0x1b82('0x64')](path[_0x1b82('0x67')](config['root'],_0x1b82('0x65')),_0x1b82('0x66'));var _0x14510c=fs[_0x1b82('0x64')](path[_0x1b82('0x67')](config[_0x1b82('0x71')],_0x1b82('0x68')),'utf8');var _0x58e180=ejs[_0x1b82('0x69')](_0x372c3b,{'trunks':_0x7d95b6});var _0x531d3f=ejs['render'](_0x14510c,{'trunks':_0x7d95b6});fs[_0x1b82('0x6a')](_0x1b82('0x6b'),_0x58e180);fs[_0x1b82('0x6a')]('/etc/asterisk/sip_xcally_registers.conf',_0x531d3f);return respondWithRpcPromise(_0x1b82('0x6e'),'destroy',{'module':_0x1b82('0x6f')});})[_0x1b82('0x25')](handleError(_0x3e17b0,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index c081227..a60fce4 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 _0xd5cc=['lodash','util','../../config/logger','api','bluebird','rimraf','./trunk.attributes','define','Trunk'];(function(_0x198fc6,_0x5eaee9){var _0x4376bb=function(_0x4b3241){while(--_0x4b3241){_0x198fc6['push'](_0x198fc6['shift']());}};_0x4376bb(++_0x5eaee9);}(_0xd5cc,0x183));var _0xcd5c=function(_0x48f10d,_0x3ee406){_0x48f10d=_0x48f10d-0x0;var _0x3877ef=_0xd5cc[_0x48f10d];return _0x3877ef;};'use strict';var _=require(_0xcd5c('0x0'));var util=require(_0xcd5c('0x1'));var logger=require(_0xcd5c('0x2'))(_0xcd5c('0x3'));var moment=require('moment');var BPromise=require(_0xcd5c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xcd5c('0x5'));var config=require('../../config/environment');var attributes=require(_0xcd5c('0x6'));module['exports']=function(_0x2c10e2,_0x113d72){return _0x2c10e2[_0xcd5c('0x7')](_0xcd5c('0x8'),attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe253=['path','rimraf','../../config/environment','./trunk.attributes','exports','define','Trunk','tools_trunks','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x79b53e,_0x108f8d){var _0x2d4d6c=function(_0x256d7f){while(--_0x256d7f){_0x79b53e['push'](_0x79b53e['shift']());}};_0x2d4d6c(++_0x108f8d);}(_0xe253,0x1bb));var _0x3e25=function(_0x14dcf8,_0x551815){_0x14dcf8=_0x14dcf8-0x0;var _0x53698e=_0xe253[_0x14dcf8];return _0x53698e;};'use strict';var _=require(_0x3e25('0x0'));var util=require(_0x3e25('0x1'));var logger=require(_0x3e25('0x2'))(_0x3e25('0x3'));var moment=require(_0x3e25('0x4'));var BPromise=require(_0x3e25('0x5'));var rp=require(_0x3e25('0x6'));var fs=require('fs');var path=require(_0x3e25('0x7'));var rimraf=require(_0x3e25('0x8'));var config=require(_0x3e25('0x9'));var attributes=require(_0x3e25('0xa'));module[_0x3e25('0xb')]=function(_0x498429,_0xd9cce5){return _0x498429[_0x3e25('0xc')](_0x3e25('0xd'),attributes,{'tableName':_0x3e25('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index c04a165..27f3ee7 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 _0xb095=['info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','GetTrunk','Trunk','options','raw','attributes','limit','include','map','model','stringify','catch','find','where','lodash','randomstring','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then'];(function(_0x1b81ed,_0x239c78){var _0x3a78a4=function(_0x3ad52f){while(--_0x3ad52f){_0x1b81ed['push'](_0x1b81ed['shift']());}};_0x3a78a4(++_0x239c78);}(_0xb095,0x1b9));var _0x5b09=function(_0x19af8b,_0x30fb4d){_0x19af8b=_0x19af8b-0x0;var _0x39ec8b=_0xb095[_0x19af8b];return _0x39ec8b;};'use strict';var _=require(_0x5b09('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5b09('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5b09('0x2'))['db'];var utils=require(_0x5b09('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x5b09('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x5b09('0x5')][_0x5b09('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x26aaa8,_0x1eb4d1,_0x323cca){return new BPromise(function(_0x96006a,_0xe51017){return client[_0x5b09('0x7')](_0x26aaa8,_0x323cca)[_0x5b09('0x8')](function(_0x3946cd){logger[_0x5b09('0x9')](_0x5b09('0xa'),_0x1eb4d1,'request\x20sent');logger[_0x5b09('0xb')](_0x5b09('0xc'),_0x1eb4d1,_0x5b09('0xd'),JSON['stringify'](_0x3946cd));if(_0x3946cd['error']){if(_0x3946cd[_0x5b09('0xe')][_0x5b09('0xf')]===0x1f4){logger['error']('Trunk,\x20%s,\x20%s',_0x1eb4d1,_0x3946cd[_0x5b09('0xe')][_0x5b09('0x10')]);return _0xe51017(_0x3946cd[_0x5b09('0xe')][_0x5b09('0x10')]);}logger['error'](_0x5b09('0xa'),_0x1eb4d1,_0x3946cd[_0x5b09('0xe')][_0x5b09('0x10')]);return _0x96006a(_0x3946cd[_0x5b09('0xe')]['message']);}else{logger['info'](_0x5b09('0xa'),_0x1eb4d1,_0x5b09('0xd'));_0x96006a(_0x3946cd['result'][_0x5b09('0x10')]);}})['catch'](function(_0x30e5fb){logger[_0x5b09('0xe')](_0x5b09('0xa'),_0x1eb4d1,_0x30e5fb);_0xe51017(_0x30e5fb);});});}exports[_0x5b09('0x11')]=function(_0x3861cf){var _0x3720aa=this;return new Promise(function(_0x53f9c0,_0x4d2d72){return db[_0x5b09('0x12')]['findAll']({'raw':_0x3861cf[_0x5b09('0x13')]?_0x3861cf[_0x5b09('0x13')][_0x5b09('0x14')]===undefined?!![]:![]:!![],'where':_0x3861cf['options']?_0x3861cf[_0x5b09('0x13')]['where']||null:null,'attributes':_0x3861cf[_0x5b09('0x13')]?_0x3861cf[_0x5b09('0x13')][_0x5b09('0x15')]||null:null,'limit':_0x3861cf['options']?_0x3861cf['options'][_0x5b09('0x16')]||null:null,'include':_0x3861cf[_0x5b09('0x13')]?_0x3861cf['options'][_0x5b09('0x17')]?_[_0x5b09('0x18')](_0x3861cf[_0x5b09('0x13')][_0x5b09('0x17')],function(_0x8f5636){return{'model':db[_0x8f5636[_0x5b09('0x19')]],'as':_0x8f5636['as'],'attributes':_0x8f5636['attributes'],'include':_0x8f5636[_0x5b09('0x17')]?_[_0x5b09('0x18')](_0x8f5636[_0x5b09('0x17')],function(_0x37e7d3){return{'model':db[_0x37e7d3['model']],'as':_0x37e7d3['as'],'attributes':_0x37e7d3[_0x5b09('0x15')],'include':_0x37e7d3[_0x5b09('0x17')]?_['map'](_0x37e7d3[_0x5b09('0x17')],function(_0x339ab1){return{'model':db[_0x339ab1[_0x5b09('0x19')]],'as':_0x339ab1['as'],'attributes':_0x339ab1[_0x5b09('0x15')]};}):[]};}):[]};}):[]:[]})[_0x5b09('0x8')](function(_0x58f681){logger[_0x5b09('0x9')]('GetTrunk',_0x3861cf);logger[_0x5b09('0xb')]('GetTrunk',_0x3861cf,JSON[_0x5b09('0x1a')](_0x58f681));_0x53f9c0(_0x58f681);})[_0x5b09('0x1b')](function(_0x1a98d5){logger['error'](_0x5b09('0x11'),_0x1a98d5[_0x5b09('0x10')],_0x3861cf);_0x4d2d72(_0x3720aa['error'](0x1f4,_0x1a98d5[_0x5b09('0x10')]));});});};exports['ShowTrunk']=function(_0xa6797d){var _0x5bd340=this;return new Promise(function(_0xd37e75,_0x45d3d1){return db['Trunk'][_0x5b09('0x1c')]({'raw':_0xa6797d[_0x5b09('0x13')]?_0xa6797d[_0x5b09('0x13')][_0x5b09('0x14')]===undefined?!![]:![]:!![],'where':_0xa6797d[_0x5b09('0x13')]?_0xa6797d['options'][_0x5b09('0x1d')]||null:null,'attributes':_0xa6797d[_0x5b09('0x13')]?_0xa6797d[_0x5b09('0x13')][_0x5b09('0x15')]||null:null,'include':_0xa6797d[_0x5b09('0x13')]?_0xa6797d[_0x5b09('0x13')][_0x5b09('0x17')]?_['map'](_0xa6797d['options'][_0x5b09('0x17')],function(_0x33407a){return{'model':db[_0x33407a[_0x5b09('0x19')]],'as':_0x33407a['as'],'attributes':_0x33407a[_0x5b09('0x15')],'include':_0x33407a['include']?_[_0x5b09('0x18')](_0x33407a[_0x5b09('0x17')],function(_0x53960a){return{'model':db[_0x53960a['model']],'as':_0x53960a['as'],'attributes':_0x53960a['attributes'],'include':_0x53960a[_0x5b09('0x17')]?_[_0x5b09('0x18')](_0x53960a[_0x5b09('0x17')],function(_0x1eb624){return{'model':db[_0x1eb624[_0x5b09('0x19')]],'as':_0x1eb624['as'],'attributes':_0x1eb624[_0x5b09('0x15')]};}):[]};}):[]};}):[]:[]})[_0x5b09('0x8')](function(_0x60b5bd){logger[_0x5b09('0x9')]('ShowTrunk',_0xa6797d);logger[_0x5b09('0xb')]('ShowTrunk',_0xa6797d,JSON[_0x5b09('0x1a')](_0x60b5bd));_0xd37e75(_0x60b5bd);})[_0x5b09('0x1b')](function(_0x3b9c3d){logger['error']('ShowTrunk',_0x3b9c3d['message'],_0xa6797d);_0x45d3d1(_0x5bd340['error'](0x1f4,_0x3b9c3d[_0x5b09('0x10')]));});});}; \ No newline at end of file +var _0xae5d=['message','result','catch','GetTrunk','Trunk','findAll','options','raw','attributes','include','map','model','ShowTrunk','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','info','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','Trunk,\x20%s,\x20%s'];(function(_0x28d175,_0x5449c6){var _0x1ad2b0=function(_0x2cd124){while(--_0x2cd124){_0x28d175['push'](_0x28d175['shift']());}};_0x1ad2b0(++_0x5449c6);}(_0xae5d,0x1bf));var _0xdae5=function(_0x528497,_0x147e87){_0x528497=_0x528497-0x0;var _0x392d59=_0xae5d[_0x528497];return _0x392d59;};'use strict';var _=require(_0xdae5('0x0'));var util=require(_0xdae5('0x1'));var moment=require(_0xdae5('0x2'));var BPromise=require(_0xdae5('0x3'));var rs=require(_0xdae5('0x4'));var fs=require('fs');var Redis=require(_0xdae5('0x5'));var db=require(_0xdae5('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xdae5('0x7'))(_0xdae5('0x8'));var config=require(_0xdae5('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xdae5('0xa')][_0xdae5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xf0b042,_0x2d1152,_0x2de0cb){return new BPromise(function(_0x248d14,_0x477102){return client['request'](_0xf0b042,_0x2de0cb)[_0xdae5('0xc')](function(_0x331bc2){logger[_0xdae5('0xd')]('Trunk,\x20%s,\x20%s',_0x2d1152,_0xdae5('0xe'));logger[_0xdae5('0xf')](_0xdae5('0x10'),_0x2d1152,_0xdae5('0xe'),JSON[_0xdae5('0x11')](_0x331bc2));if(_0x331bc2[_0xdae5('0x12')]){if(_0x331bc2[_0xdae5('0x12')][_0xdae5('0x13')]===0x1f4){logger[_0xdae5('0x12')](_0xdae5('0x14'),_0x2d1152,_0x331bc2[_0xdae5('0x12')]['message']);return _0x477102(_0x331bc2[_0xdae5('0x12')][_0xdae5('0x15')]);}logger[_0xdae5('0x12')](_0xdae5('0x14'),_0x2d1152,_0x331bc2[_0xdae5('0x12')]['message']);return _0x248d14(_0x331bc2['error'][_0xdae5('0x15')]);}else{logger[_0xdae5('0xd')]('Trunk,\x20%s,\x20%s',_0x2d1152,_0xdae5('0xe'));_0x248d14(_0x331bc2[_0xdae5('0x16')][_0xdae5('0x15')]);}})[_0xdae5('0x17')](function(_0x355e0f){logger[_0xdae5('0x12')](_0xdae5('0x14'),_0x2d1152,_0x355e0f);_0x477102(_0x355e0f);});});}exports[_0xdae5('0x18')]=function(_0xe16b02){var _0xe12615=this;return new Promise(function(_0x1664ca,_0xb3c32e){return db[_0xdae5('0x19')][_0xdae5('0x1a')]({'raw':_0xe16b02[_0xdae5('0x1b')]?_0xe16b02[_0xdae5('0x1b')][_0xdae5('0x1c')]===undefined?!![]:![]:!![],'where':_0xe16b02[_0xdae5('0x1b')]?_0xe16b02[_0xdae5('0x1b')]['where']||null:null,'attributes':_0xe16b02[_0xdae5('0x1b')]?_0xe16b02[_0xdae5('0x1b')][_0xdae5('0x1d')]||null:null,'limit':_0xe16b02[_0xdae5('0x1b')]?_0xe16b02[_0xdae5('0x1b')]['limit']||null:null,'include':_0xe16b02[_0xdae5('0x1b')]?_0xe16b02[_0xdae5('0x1b')][_0xdae5('0x1e')]?_[_0xdae5('0x1f')](_0xe16b02[_0xdae5('0x1b')]['include'],function(_0x4b5aee){return{'model':db[_0x4b5aee[_0xdae5('0x20')]],'as':_0x4b5aee['as'],'attributes':_0x4b5aee[_0xdae5('0x1d')],'include':_0x4b5aee[_0xdae5('0x1e')]?_[_0xdae5('0x1f')](_0x4b5aee[_0xdae5('0x1e')],function(_0x17c4b7){return{'model':db[_0x17c4b7[_0xdae5('0x20')]],'as':_0x17c4b7['as'],'attributes':_0x17c4b7[_0xdae5('0x1d')],'include':_0x17c4b7[_0xdae5('0x1e')]?_['map'](_0x17c4b7[_0xdae5('0x1e')],function(_0x49fedd){return{'model':db[_0x49fedd[_0xdae5('0x20')]],'as':_0x49fedd['as'],'attributes':_0x49fedd[_0xdae5('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xdae5('0xc')](function(_0x11dfcb){logger[_0xdae5('0xd')]('GetTrunk',_0xe16b02);logger['debug'](_0xdae5('0x18'),_0xe16b02,JSON[_0xdae5('0x11')](_0x11dfcb));_0x1664ca(_0x11dfcb);})[_0xdae5('0x17')](function(_0x434d82){logger[_0xdae5('0x12')](_0xdae5('0x18'),_0x434d82['message'],_0xe16b02);_0xb3c32e(_0xe12615['error'](0x1f4,_0x434d82[_0xdae5('0x15')]));});});};exports[_0xdae5('0x21')]=function(_0xabd0ff){var _0x4a7a5d=this;return new Promise(function(_0x24f7e6,_0x573367){return db['Trunk'][_0xdae5('0x22')]({'raw':_0xabd0ff['options']?_0xabd0ff[_0xdae5('0x1b')][_0xdae5('0x1c')]===undefined?!![]:![]:!![],'where':_0xabd0ff[_0xdae5('0x1b')]?_0xabd0ff[_0xdae5('0x1b')][_0xdae5('0x23')]||null:null,'attributes':_0xabd0ff[_0xdae5('0x1b')]?_0xabd0ff[_0xdae5('0x1b')][_0xdae5('0x1d')]||null:null,'include':_0xabd0ff[_0xdae5('0x1b')]?_0xabd0ff['options'][_0xdae5('0x1e')]?_[_0xdae5('0x1f')](_0xabd0ff[_0xdae5('0x1b')][_0xdae5('0x1e')],function(_0x2651fa){return{'model':db[_0x2651fa[_0xdae5('0x20')]],'as':_0x2651fa['as'],'attributes':_0x2651fa[_0xdae5('0x1d')],'include':_0x2651fa[_0xdae5('0x1e')]?_[_0xdae5('0x1f')](_0x2651fa[_0xdae5('0x1e')],function(_0x22e8ad){return{'model':db[_0x22e8ad['model']],'as':_0x22e8ad['as'],'attributes':_0x22e8ad[_0xdae5('0x1d')],'include':_0x22e8ad[_0xdae5('0x1e')]?_['map'](_0x22e8ad[_0xdae5('0x1e')],function(_0x456455){return{'model':db[_0x456455[_0xdae5('0x20')]],'as':_0x456455['as'],'attributes':_0x456455[_0xdae5('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4aeaa7){logger[_0xdae5('0xd')](_0xdae5('0x21'),_0xabd0ff);logger[_0xdae5('0xf')](_0xdae5('0x21'),_0xabd0ff,JSON[_0xdae5('0x11')](_0x4aeaa7));_0x24f7e6(_0x4aeaa7);})[_0xdae5('0x17')](function(_0x585a9a){logger['error']('ShowTrunk',_0x585a9a[_0xdae5('0x15')],_0xabd0ff);_0x573367(_0x4a7a5d[_0xdae5('0x12')](0x1f4,_0x585a9a['message']));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 42b1a29..bd438f2 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 _0xc27e=['put','/:id','isAuthenticated','exports','express','../../components/auth/service','./user-setting.controller'];(function(_0x3fed94,_0x261090){var _0x56834b=function(_0x3a7892){while(--_0x3a7892){_0x3fed94['push'](_0x3fed94['shift']());}};_0x56834b(++_0x261090);}(_0xc27e,0xd6));var _0xec27=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc27e[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0xec27('0x0'));var router=express['Router']();var auth=require(_0xec27('0x1'));var controller=require(_0xec27('0x2'));router[_0xec27('0x3')](_0xec27('0x4'),auth[_0xec27('0x5')](),controller['update']);module[_0xec27('0x6')]=router; \ No newline at end of file +var _0x6acb=['/:id','update','exports','express','Router','../../components/auth/service','./user-setting.controller','put'];(function(_0x5b4be0,_0x437d4e){var _0x20d112=function(_0x34823b){while(--_0x34823b){_0x5b4be0['push'](_0x5b4be0['shift']());}};_0x20d112(++_0x437d4e);}(_0x6acb,0x1a3));var _0xb6ac=function(_0x539bde,_0x14b7db){_0x539bde=_0x539bde-0x0;var _0x1718d4=_0x6acb[_0x539bde];return _0x1718d4;};'use strict';var express=require(_0xb6ac('0x0'));var router=express[_0xb6ac('0x1')]();var auth=require(_0xb6ac('0x2'));var controller=require(_0xb6ac('0x3'));router[_0xb6ac('0x4')](_0xb6ac('0x5'),auth['isAuthenticated'](),controller[_0xb6ac('0x6')]);module[_0xb6ac('0x7')]=router; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.attributes.js b/server/api/user-setting/user-setting.attributes.js index cb122fe..22f24a5 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 _0xa892=['sequelize','warning','info','exports','ENUM','BOOLEAN','TEXT','DATE','INTEGER','UserId'];(function(_0x1210b7,_0x3cd395){var _0x527fd8=function(_0x17c334){while(--_0x17c334){_0x1210b7['push'](_0x1210b7['shift']());}};_0x527fd8(++_0x3cd395);}(_0xa892,0x8c));var _0x2a89=function(_0x5d3f71,_0x3dfdc6){_0x5d3f71=_0x5d3f71-0x0;var _0x1e1dad=_0xa892[_0x5d3f71];return _0x1e1dad;};'use strict';var Sequelize=require(_0x2a89('0x0'));const CLIENT_SIDE_LOG_LEVELS=['error',_0x2a89('0x1'),_0x2a89('0x2'),'debug'];module[_0x2a89('0x3')]={'clientSideLoggingLevel':{'type':Sequelize[_0x2a89('0x4')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':'error','validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x2a89('0x5')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x2a89('0x6')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x2a89('0x7')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x2a89('0x8')],'unique':_0x2a89('0x9')}}; \ No newline at end of file +var _0xbfec=['INTEGER','error','warning','info','exports','BOOLEAN','DATE'];(function(_0x59d12e,_0x1128ff){var _0x2f5ee4=function(_0x213beb){while(--_0x213beb){_0x59d12e['push'](_0x59d12e['shift']());}};_0x2f5ee4(++_0x1128ff);}(_0xbfec,0xc5));var _0xcbfe=function(_0x5e863d,_0x608db1){_0x5e863d=_0x5e863d-0x0;var _0x474f4a=_0xbfec[_0x5e863d];return _0x474f4a;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=[_0xcbfe('0x0'),_0xcbfe('0x1'),_0xcbfe('0x2'),'debug'];module[_0xcbfe('0x3')]={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xcbfe('0x0'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xcbfe('0x4')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize['TEXT'],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xcbfe('0x5')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xcbfe('0x6')],'unique':'UserId'}}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index a2b33e8..60b377e 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 _0xc2cc=['send','user','role','params','UserSetting','find','catch','ioredis','../../config/logger','api','../../mysqldb','redis','register','defaults','json','update','then','sendStatus','error','name','status'];(function(_0x543d85,_0x17fe21){var _0x478ac1=function(_0x498ba4){while(--_0x498ba4){_0x543d85['push'](_0x543d85['shift']());}};_0x478ac1(++_0x17fe21);}(_0xc2cc,0x70));var _0xcc2c=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xc2cc[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require('lodash');var Redis=require(_0xcc2c('0x0'));var logger=require(_0xcc2c('0x1'))(_0xcc2c('0x2'));var config=require('../../config/environment');var db=require(_0xcc2c('0x3'))['db'];var socket=require('socket.io-emitter')(new Redis(config[_0xcc2c('0x4')]));require('./user-setting.socket')[_0xcc2c('0x5')](socket);config['redis']=_[_0xcc2c('0x6')](config['redis'],{'host':'localhost','port':0x18eb});function respondWithResult(_0x475a85,_0x4ab837){_0x4ab837=_0x4ab837||0xc8;return function(_0x144b90){if(_0x144b90){return _0x475a85['status'](_0x4ab837)[_0xcc2c('0x7')](_0x144b90);}};}function saveUpdates(_0x58c80c){return function(_0x56bb36){if(_0x56bb36){return _0x56bb36[_0xcc2c('0x8')](_0x58c80c)[_0xcc2c('0x9')](function(_0x233e31){return _0x233e31;});}return null;};}function handleEntityNotFound(_0x3b3481){return function(_0x2325be){if(!_0x2325be){_0x3b3481[_0xcc2c('0xa')](0x194);}return _0x2325be;};}function handleError(_0xb51804,_0x1c18a8){_0x1c18a8=_0x1c18a8||0x1f4;return function(_0x49853b){logger[_0xcc2c('0xb')](_0x49853b['stack']);if(_0x49853b[_0xcc2c('0xc')]){delete _0x49853b[_0xcc2c('0xc')];}_0xb51804[_0xcc2c('0xd')](_0x1c18a8)[_0xcc2c('0xe')](_0x49853b);};}exports['update']=function(_0x51bd29,_0x4d52fe){if(_0x51bd29[_0xcc2c('0xf')][_0xcc2c('0x10')]!=='admin')throw new Error('Unauthorized');if(isNaN(Number(_0x51bd29[_0xcc2c('0x11')]['id'])))throw new Error('Invalid\x20user\x20setting\x20id');return db[_0xcc2c('0x12')][_0xcc2c('0x13')]({'where':{'id':_0x51bd29[_0xcc2c('0x11')]['id']}})[_0xcc2c('0x9')](handleEntityNotFound(_0x4d52fe,null))['then'](saveUpdates(_0x51bd29['body'],null))[_0xcc2c('0x9')](respondWithResult(_0x4d52fe,null))[_0xcc2c('0x14')](handleError(_0x4d52fe,null));}; \ No newline at end of file +var _0xf874=['redis','register','defaults','localhost','status','then','sendStatus','stack','name','update','role','Unauthorized','params','UserSetting','find','body','catch','../../config/logger','api','../../config/environment','../../mysqldb','socket.io-emitter'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0xf874,0xed));var _0x4f87=function(_0x43cdb4,_0x275cc3){_0x43cdb4=_0x43cdb4-0x0;var _0x1ef622=_0xf874[_0x43cdb4];return _0x1ef622;};'use strict';var _=require('lodash');var Redis=require('ioredis');var logger=require(_0x4f87('0x0'))(_0x4f87('0x1'));var config=require(_0x4f87('0x2'));var db=require(_0x4f87('0x3'))['db'];var socket=require(_0x4f87('0x4'))(new Redis(config[_0x4f87('0x5')]));require('./user-setting.socket')[_0x4f87('0x6')](socket);config[_0x4f87('0x5')]=_[_0x4f87('0x7')](config[_0x4f87('0x5')],{'host':_0x4f87('0x8'),'port':0x18eb});function respondWithResult(_0x44fea6,_0x4a0662){_0x4a0662=_0x4a0662||0xc8;return function(_0x3a89e3){if(_0x3a89e3){return _0x44fea6[_0x4f87('0x9')](_0x4a0662)['json'](_0x3a89e3);}};}function saveUpdates(_0x38991f){return function(_0x363642){if(_0x363642){return _0x363642['update'](_0x38991f)[_0x4f87('0xa')](function(_0x1bf29c){return _0x1bf29c;});}return null;};}function handleEntityNotFound(_0x3493fb){return function(_0xbdd68f){if(!_0xbdd68f){_0x3493fb[_0x4f87('0xb')](0x194);}return _0xbdd68f;};}function handleError(_0x1edfc1,_0xb63ffc){_0xb63ffc=_0xb63ffc||0x1f4;return function(_0x510063){logger['error'](_0x510063[_0x4f87('0xc')]);if(_0x510063[_0x4f87('0xd')]){delete _0x510063[_0x4f87('0xd')];}_0x1edfc1['status'](_0xb63ffc)['send'](_0x510063);};}exports[_0x4f87('0xe')]=function(_0x430bc4,_0x3c4afd){if(_0x430bc4['user'][_0x4f87('0xf')]!=='admin')throw new Error(_0x4f87('0x10'));if(isNaN(Number(_0x430bc4[_0x4f87('0x11')]['id'])))throw new Error('Invalid\x20user\x20setting\x20id');return db[_0x4f87('0x12')][_0x4f87('0x13')]({'where':{'id':_0x430bc4[_0x4f87('0x11')]['id']}})[_0x4f87('0xa')](handleEntityNotFound(_0x3c4afd,null))[_0x4f87('0xa')](saveUpdates(_0x430bc4[_0x4f87('0x14')],null))['then'](respondWithResult(_0x3c4afd,null))[_0x4f87('0x15')](handleError(_0x3c4afd,null));}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.events.js b/server/api/user-setting/user-setting.events.js index f594d2a..d634251 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 _0xe3d0=['save','update','remove','emit','hasOwnProperty','hook','../../mysqldb','setMaxListeners'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0xe3d0,0x156));var _0x0e3d=function(_0x4c9596,_0x1839bb){_0x4c9596=_0x4c9596-0x0;var _0xc9ae9e=_0xe3d0[_0x4c9596];return _0xc9ae9e;};'use strict';var EventEmitter=require('events');var UserSetting=require(_0x0e3d('0x0'))['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x0e3d('0x1')](0x0);var events={'afterCreate':_0x0e3d('0x2'),'afterUpdate':_0x0e3d('0x3'),'afterDestroy':_0x0e3d('0x4')};function emitEvent(_0x4c5556){return function(_0x98d7ff,_0x3513b4,_0x45f3ad){UserSettingEvents[_0x0e3d('0x5')](_0x4c5556+':'+_0x98d7ff['id'],_0x98d7ff);UserSettingEvents[_0x0e3d('0x5')](_0x4c5556,_0x98d7ff);_0x45f3ad(null);};}for(var e in events){if(events[_0x0e3d('0x6')](e)){var event=events[e];UserSetting[_0x0e3d('0x7')](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file +var _0xf5ca=['emit','hasOwnProperty','hook','events','UserSetting','save','remove'];(function(_0x2e2b9f,_0x889cc1){var _0x38cf60=function(_0x8b0ed1){while(--_0x8b0ed1){_0x2e2b9f['push'](_0x2e2b9f['shift']());}};_0x38cf60(++_0x889cc1);}(_0xf5ca,0x13e));var _0xaf5c=function(_0x56af5c,_0x29e3b7){_0x56af5c=_0x56af5c-0x0;var _0x449bba=_0xf5ca[_0x56af5c];return _0x449bba;};'use strict';var EventEmitter=require(_0xaf5c('0x0'));var UserSetting=require('../../mysqldb')['db'][_0xaf5c('0x1')];var UserSettingEvents=new EventEmitter();UserSettingEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xaf5c('0x2'),'afterUpdate':'update','afterDestroy':_0xaf5c('0x3')};function emitEvent(_0x36f432){return function(_0x534f9c,_0x15c282,_0x5ddb23){UserSettingEvents[_0xaf5c('0x4')](_0x36f432+':'+_0x534f9c['id'],_0x534f9c);UserSettingEvents['emit'](_0x36f432,_0x534f9c);_0x5ddb23(null);};}for(var e in events){if(events[_0xaf5c('0x5')](e)){var event=events[e];UserSetting[_0xaf5c('0x6')](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index 6878019..cc7469e 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 _0x515d=['clientSideLoggingEnabled','clientSideLoggingEnabledSince','exports','define','UserSetting','user_settings'];(function(_0x1a8987,_0x344a5c){var _0x5f420b=function(_0x29c8bc){while(--_0x29c8bc){_0x1a8987['push'](_0x1a8987['shift']());}};_0x5f420b(++_0x344a5c);}(_0x515d,0x104));var _0xd515=function(_0x3ce793,_0x3edc1b){_0x3ce793=_0x3ce793-0x0;var _0x3261d1=_0x515d[_0x3ce793];return _0x3261d1;};'use strict';var attributes=require('./user-setting.attributes');module[_0xd515('0x0')]=function(_0x28ae67){return _0x28ae67[_0xd515('0x1')](_0xd515('0x2'),attributes,{'tableName':_0xd515('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4240ce){if(!_0x4240ce[_0xd515('0x4')])_0x4240ce[_0xd515('0x5')]=null;else if(_0x4240ce['clientSideLoggingEnabledSince']===null)_0x4240ce[_0xd515('0x5')]=new Date();}}});}; \ No newline at end of file +var _0xb74d=['clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','UserSetting'];(function(_0x1ba4bd,_0x2e3473){var _0x3e3d53=function(_0xf0f5fa){while(--_0xf0f5fa){_0x1ba4bd['push'](_0x1ba4bd['shift']());}};_0x3e3d53(++_0x2e3473);}(_0xb74d,0x16e));var _0xdb74=function(_0x173113,_0x316a7c){_0x173113=_0x173113-0x0;var _0x3bea89=_0xb74d[_0x173113];return _0x3bea89;};'use strict';var attributes=require(_0xdb74('0x0'));module['exports']=function(_0x350d0d){return _0x350d0d['define'](_0xdb74('0x1'),attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1ba155){if(!_0x1ba155[_0xdb74('0x2')])_0x1ba155[_0xdb74('0x3')]=null;else if(_0x1ba155['clientSideLoggingEnabledSince']===null)_0x1ba155[_0xdb74('0x3')]=new Date();}}});}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index 9ecf879..10fabf0 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 _0xe99c=['remove','update','emit','user-setting:update:user-','register','length','user-setting:','./user-setting.events'];(function(_0x3c1304,_0x219ae5){var _0x11b071=function(_0x2c1d0d){while(--_0x2c1d0d){_0x3c1304['push'](_0x3c1304['shift']());}};_0x11b071(++_0x219ae5);}(_0xe99c,0x197));var _0xce99=function(_0x38310e,_0x18443b){_0x38310e=_0x38310e-0x0;var _0x13a5a8=_0xe99c[_0x38310e];return _0x13a5a8;};'use strict';var UserSettingEvents=require(_0xce99('0x0'));var events=['save',_0xce99('0x1'),_0xce99('0x2')];function createListener(_0x12e339,_0x3b01de){return function(_0x228cea){_0x3b01de[_0xce99('0x3')](_0x12e339,_0x228cea);if(_0x12e339==='user-setting:update'){_0x3b01de['emit'](_0xce99('0x4')+_0x228cea['UserId'],_0x228cea);}};}exports[_0xce99('0x5')]=function(_0x58e2aa){for(var _0x3755dd=0x0,_0x380c7c=events[_0xce99('0x6')];_0x3755dd<_0x380c7c;_0x3755dd++){var _0x732cca=events[_0x3755dd];var _0x39df1c=createListener(_0xce99('0x7')+_0x732cca,_0x58e2aa);UserSettingEvents['on'](_0x732cca,_0x39df1c);}}; \ No newline at end of file +var _0xeae6=['user-setting:update:user-','UserId','register','length','user-setting:','./user-setting.events','save','remove','emit','user-setting:update'];(function(_0x4a5c95,_0x31a29b){var _0x238e7c=function(_0x2ff156){while(--_0x2ff156){_0x4a5c95['push'](_0x4a5c95['shift']());}};_0x238e7c(++_0x31a29b);}(_0xeae6,0xe1));var _0x6eae=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xeae6[_0x20a584];return _0x4b41a8;};'use strict';var UserSettingEvents=require(_0x6eae('0x0'));var events=[_0x6eae('0x1'),_0x6eae('0x2'),'update'];function createListener(_0x3dc3b8,_0x219436){return function(_0x1a2c08){_0x219436[_0x6eae('0x3')](_0x3dc3b8,_0x1a2c08);if(_0x3dc3b8===_0x6eae('0x4')){_0x219436[_0x6eae('0x3')](_0x6eae('0x5')+_0x1a2c08[_0x6eae('0x6')],_0x1a2c08);}};}exports[_0x6eae('0x7')]=function(_0xdef88f){for(var _0x2ba6e7=0x0,_0x5ac310=events[_0x6eae('0x8')];_0x2ba6e7<_0x5ac310;_0x2ba6e7++){var _0x185756=events[_0x2ba6e7];var _0x17df66=createListener(_0x6eae('0x9')+_0x185756,_0xdef88f);UserSettingEvents['on'](_0x185756,_0x17df66);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 4304e13..1df951e 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 _0x004d=['/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','getAgents','/:id/prefixes','getVoicePrefixes','getFaxAccounts','/:id/mail_accounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','/:id/chat_websites','getChatWebsites','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','addContacts','post','/create_many','bulkCreate','addQueues','diskStorage','join','root','server/files/images/','format','%s-%s','now','originalname','single','file','addAvatar','/:id/login','login','logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','addWhatsappInteractions','/:id/fax_accounts','addSmsAccounts','addChatWebsites','/:id/whatsapp_accounts','addWhatsappAccounts','createApiKey','update','/:id/password','changePassword','delete','removeQueues','removeTeams','destroy','removeChatInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeWhatsappInteractions','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeApiKey','/:id/messengerSoundNotification','messengerSoundNotification','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./user.controller','isAuthenticated','index','get','describe','/whoami','whoami','getPresence','/:id','/:id/avatar','/:id/open_tabs','/:id/contacts','getContacts','/:id/queues','/:id/queues_rt','getGroups','/:id/recordings','getRecordings','getScreenRecordings','getChatInteractions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions'];(function(_0x513bf1,_0x5595e6){var _0x3b42e3=function(_0x13e7bf){while(--_0x13e7bf){_0x513bf1['push'](_0x513bf1['shift']());}};_0x3b42e3(++_0x5595e6);}(_0x004d,0xc1));var _0xd004=function(_0x5b4425,_0x1304dc){_0x5b4425=_0x5b4425-0x0;var _0x16712e=_0x004d[_0x5b4425];return _0x16712e;};'use strict';var multer=require(_0xd004('0x0'));var util=require('util');var path=require(_0xd004('0x1'));var timeout=require(_0xd004('0x2'));var express=require(_0xd004('0x3'));var router=express[_0xd004('0x4')]();var fs_extra=require(_0xd004('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd004('0x6'));var config=require(_0xd004('0x7'));var controller=require(_0xd004('0x8'));router['get']('/',auth[_0xd004('0x9')](),controller[_0xd004('0xa')]);router[_0xd004('0xb')]('/describe',auth['isAuthenticated'](),controller[_0xd004('0xc')]);router[_0xd004('0xb')](_0xd004('0xd'),auth[_0xd004('0x9')](),controller[_0xd004('0xe')]);router['get']('/presence',auth[_0xd004('0x9')](),controller[_0xd004('0xf')]);router[_0xd004('0xb')](_0xd004('0x10'),auth[_0xd004('0x9')](),controller['show']);router[_0xd004('0xb')](_0xd004('0x11'),controller['getAvatar']);router[_0xd004('0xb')](_0xd004('0x12'),auth[_0xd004('0x9')](),controller['getOpenTabs']);router[_0xd004('0xb')](_0xd004('0x13'),auth[_0xd004('0x9')](),controller[_0xd004('0x14')]);router[_0xd004('0xb')](_0xd004('0x15'),auth[_0xd004('0x9')](),controller['getQueues']);router[_0xd004('0xb')](_0xd004('0x16'),auth['isAuthenticated'](),controller['getVoiceQueuesRt']);router[_0xd004('0xb')]('/:id/groups',auth[_0xd004('0x9')](),controller[_0xd004('0x17')]);router[_0xd004('0xb')](_0xd004('0x18'),auth['isAuthenticated'](),controller[_0xd004('0x19')]);router[_0xd004('0xb')]('/:id/screen_recordings',auth['isAuthenticated'](),controller[_0xd004('0x1a')]);router[_0xd004('0xb')]('/:id/chat/interactions',auth[_0xd004('0x9')](),controller[_0xd004('0x1b')]);router[_0xd004('0xb')]('/:id/openchannel/interactions',auth[_0xd004('0x9')](),controller[_0xd004('0x1c')]);router['get'](_0xd004('0x1d'),auth[_0xd004('0x9')](),controller[_0xd004('0x1e')]);router[_0xd004('0xb')](_0xd004('0x1f'),auth[_0xd004('0x9')](),controller[_0xd004('0x20')]);router[_0xd004('0xb')](_0xd004('0x21'),auth[_0xd004('0x9')](),controller[_0xd004('0x22')]);router[_0xd004('0xb')](_0xd004('0x23'),auth[_0xd004('0x9')](),controller[_0xd004('0x24')]);router['get'](_0xd004('0x25'),auth['isAuthenticated'](),controller[_0xd004('0x26')]);router[_0xd004('0xb')](_0xd004('0x27'),auth['isAuthenticated'](),controller[_0xd004('0x28')]);router[_0xd004('0xb')]('/:id/agents',auth[_0xd004('0x9')](),controller[_0xd004('0x29')]);router[_0xd004('0xb')](_0xd004('0x2a'),auth[_0xd004('0x9')](),controller[_0xd004('0x2b')]);router[_0xd004('0xb')]('/:id/fax_accounts',auth[_0xd004('0x9')](),controller[_0xd004('0x2c')]);router[_0xd004('0xb')](_0xd004('0x2d'),auth[_0xd004('0x9')](),controller['getMailAccounts']);router['get'](_0xd004('0x2e'),auth[_0xd004('0x9')](),controller[_0xd004('0x2f')]);router[_0xd004('0xb')](_0xd004('0x30'),auth[_0xd004('0x9')](),controller['getSmsAccounts']);router[_0xd004('0xb')](_0xd004('0x31'),auth[_0xd004('0x9')](),controller[_0xd004('0x32')]);router['get']('/:id/whatsapp_accounts',auth[_0xd004('0x9')](),controller[_0xd004('0x33')]);router[_0xd004('0xb')](_0xd004('0x34'),auth[_0xd004('0x9')](),controller[_0xd004('0x35')]);router[_0xd004('0xb')](_0xd004('0x36'),auth[_0xd004('0x9')](),controller['getApiKey']);router['post'](_0xd004('0x13'),auth[_0xd004('0x9')](),controller[_0xd004('0x37')]);router[_0xd004('0x38')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd004('0x38')](_0xd004('0x39'),auth[_0xd004('0x9')](),controller[_0xd004('0x3a')]);router[_0xd004('0x38')](_0xd004('0x15'),auth['isAuthenticated'](),controller[_0xd004('0x3b')]);var upload=multer({'storage':multer[_0xd004('0x3c')]({'destination':function(_0x1d0aa8,_0x12111a,_0x33580a){_0x33580a(null,path[_0xd004('0x3d')](config[_0xd004('0x3e')],_0xd004('0x3f')));},'filename':function(_0x87725f,_0xc8f3b2,_0x2da273){_0x2da273(null,util[_0xd004('0x40')](_0xd004('0x41'),Date[_0xd004('0x42')](),_0xc8f3b2[_0xd004('0x43')]));}})});router[_0xd004('0x38')]('/:id/avatar',upload[_0xd004('0x44')](_0xd004('0x45')),controller[_0xd004('0x46')]);router[_0xd004('0x38')](_0xd004('0x47'),auth[_0xd004('0x9')](),controller[_0xd004('0x48')]);router[_0xd004('0x38')]('/:id/logout',auth[_0xd004('0x9')](),controller[_0xd004('0x49')]);router[_0xd004('0x38')](_0xd004('0x4a'),auth[_0xd004('0x9')](),controller[_0xd004('0x4b')]);router['post'](_0xd004('0x4c'),auth[_0xd004('0x9')](),controller[_0xd004('0x4d')]);router['post'](_0xd004('0x25'),auth[_0xd004('0x9')](),controller[_0xd004('0x4e')]);router[_0xd004('0x38')](_0xd004('0x4f'),auth[_0xd004('0x9')](),controller[_0xd004('0x50')]);router[_0xd004('0x38')](_0xd004('0x51'),auth[_0xd004('0x9')](),controller[_0xd004('0x52')]);router[_0xd004('0x38')]('/:id/fax_interactions',auth[_0xd004('0x9')](),controller['addFaxInteractions']);router[_0xd004('0x38')](_0xd004('0x53'),auth[_0xd004('0x9')](),controller[_0xd004('0x54')]);router[_0xd004('0x38')](_0xd004('0x55'),auth['isAuthenticated'](),controller[_0xd004('0x56')]);router['post']('/:id/whatsapp_interactions',auth['isAuthenticated'](),controller[_0xd004('0x57')]);router['post'](_0xd004('0x58'),auth[_0xd004('0x9')](),controller['addFaxAccounts']);router['post'](_0xd004('0x2d'),auth[_0xd004('0x9')](),controller['addMailAccounts']);router['post'](_0xd004('0x2e'),auth[_0xd004('0x9')](),controller['addOpenchannelAccounts']);router[_0xd004('0x38')](_0xd004('0x30'),auth[_0xd004('0x9')](),controller[_0xd004('0x59')]);router[_0xd004('0x38')]('/:id/chat_websites',auth[_0xd004('0x9')](),controller[_0xd004('0x5a')]);router[_0xd004('0x38')](_0xd004('0x5b'),auth[_0xd004('0x9')](),controller[_0xd004('0x5c')]);router[_0xd004('0x38')](_0xd004('0x36'),auth[_0xd004('0x9')](),controller[_0xd004('0x5d')]);router['put'](_0xd004('0x10'),auth[_0xd004('0x9')](),controller[_0xd004('0x5e')]);router['put'](_0xd004('0x5f'),auth['isAuthenticated'](),controller[_0xd004('0x60')]);router[_0xd004('0x61')](_0xd004('0x15'),auth[_0xd004('0x9')](),controller[_0xd004('0x62')]);router[_0xd004('0x61')](_0xd004('0x25'),auth['isAuthenticated'](),controller[_0xd004('0x63')]);router[_0xd004('0x61')](_0xd004('0x10'),auth[_0xd004('0x9')](),controller[_0xd004('0x64')]);router[_0xd004('0x61')]('/:id/chat_interactions',auth[_0xd004('0x9')](),controller[_0xd004('0x65')]);router[_0xd004('0x61')]('/:id/mail_interactions',auth['isAuthenticated'](),controller['removeMailInteractions']);router[_0xd004('0x61')]('/:id/fax_interactions',auth[_0xd004('0x9')](),controller[_0xd004('0x66')]);router['delete'](_0xd004('0x53'),auth['isAuthenticated'](),controller[_0xd004('0x67')]);router[_0xd004('0x61')](_0xd004('0x55'),auth[_0xd004('0x9')](),controller[_0xd004('0x68')]);router[_0xd004('0x61')](_0xd004('0x69'),auth[_0xd004('0x9')](),controller[_0xd004('0x6a')]);router[_0xd004('0x61')](_0xd004('0x58'),auth['isAuthenticated'](),controller['removeFaxAccounts']);router[_0xd004('0x61')](_0xd004('0x2d'),auth['isAuthenticated'](),controller[_0xd004('0x6b')]);router['delete'](_0xd004('0x2e'),auth[_0xd004('0x9')](),controller[_0xd004('0x6c')]);router[_0xd004('0x61')]('/:id/sms_accounts',auth[_0xd004('0x9')](),controller[_0xd004('0x6d')]);router[_0xd004('0x61')](_0xd004('0x31'),auth[_0xd004('0x9')](),controller['removeChatWebsites']);router[_0xd004('0x61')](_0xd004('0x5b'),auth['isAuthenticated'](),controller['removeWhatsappAccounts']);router[_0xd004('0x61')](_0xd004('0x36'),auth[_0xd004('0x9')](),controller[_0xd004('0x6e')]);router[_0xd004('0x38')](_0xd004('0x6f'),auth[_0xd004('0x9')](),controller[_0xd004('0x70')]);module[_0xd004('0x71')]=router; \ No newline at end of file +var _0x9209=['removeFaxAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeApiKey','/:id/messengerSoundNotification','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','isAuthenticated','index','get','/describe','describe','/whoami','whoami','/presence','getPresence','/:id','/:id/open_tabs','/:id/contacts','getContacts','getQueues','/:id/queues_rt','getVoiceQueuesRt','getGroups','/:id/recordings','/:id/screen_recordings','getScreenRecordings','getChatInteractions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','/:id/fax/interactions','getFaxInteractions','getWhatsappInteractions','/:id/teams','getTeams','/:id/agents','getVoicePrefixes','/:id/fax_accounts','/:id/mail_accounts','getMailAccounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','addContacts','post','create','/create_many','diskStorage','join','server/files/images/','%s-%s','now','originalname','/:id/avatar','single','file','/:id/login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/whatsapp_interactions','addFaxAccounts','/:id/openchannel_accounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','createApiKey','put','update','/:id/password','/:id/queues','removeQueues','delete','removeTeams','removeMailInteractions','/:id/fax_interactions','removeFaxInteractions','removeOpenchannelInteractions','removeWhatsappInteractions'];(function(_0xdd31c,_0x484018){var _0x11b6ce=function(_0x178aca){while(--_0x178aca){_0xdd31c['push'](_0xdd31c['shift']());}};_0x11b6ce(++_0x484018);}(_0x9209,0x1ba));var _0x9920=function(_0x53e700,_0x58b114){_0x53e700=_0x53e700-0x0;var _0x430235=_0x9209[_0x53e700];return _0x430235;};'use strict';var multer=require(_0x9920('0x0'));var util=require(_0x9920('0x1'));var path=require(_0x9920('0x2'));var timeout=require(_0x9920('0x3'));var express=require(_0x9920('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9920('0x5'));var interaction=require(_0x9920('0x6'));var config=require(_0x9920('0x7'));var controller=require(_0x9920('0x8'));router['get']('/',auth[_0x9920('0x9')](),controller[_0x9920('0xa')]);router[_0x9920('0xb')](_0x9920('0xc'),auth[_0x9920('0x9')](),controller[_0x9920('0xd')]);router[_0x9920('0xb')](_0x9920('0xe'),auth[_0x9920('0x9')](),controller[_0x9920('0xf')]);router['get'](_0x9920('0x10'),auth[_0x9920('0x9')](),controller[_0x9920('0x11')]);router[_0x9920('0xb')](_0x9920('0x12'),auth[_0x9920('0x9')](),controller['show']);router[_0x9920('0xb')]('/:id/avatar',controller['getAvatar']);router[_0x9920('0xb')](_0x9920('0x13'),auth['isAuthenticated'](),controller['getOpenTabs']);router[_0x9920('0xb')](_0x9920('0x14'),auth['isAuthenticated'](),controller[_0x9920('0x15')]);router['get']('/:id/queues',auth[_0x9920('0x9')](),controller[_0x9920('0x16')]);router[_0x9920('0xb')](_0x9920('0x17'),auth['isAuthenticated'](),controller[_0x9920('0x18')]);router[_0x9920('0xb')]('/:id/groups',auth[_0x9920('0x9')](),controller[_0x9920('0x19')]);router[_0x9920('0xb')](_0x9920('0x1a'),auth[_0x9920('0x9')](),controller['getRecordings']);router['get'](_0x9920('0x1b'),auth['isAuthenticated'](),controller[_0x9920('0x1c')]);router[_0x9920('0xb')]('/:id/chat/interactions',auth['isAuthenticated'](),controller[_0x9920('0x1d')]);router[_0x9920('0xb')]('/:id/openchannel/interactions',auth[_0x9920('0x9')](),controller[_0x9920('0x1e')]);router[_0x9920('0xb')](_0x9920('0x1f'),auth[_0x9920('0x9')](),controller[_0x9920('0x20')]);router[_0x9920('0xb')](_0x9920('0x21'),auth[_0x9920('0x9')](),controller['getSmsInteractions']);router['get'](_0x9920('0x22'),auth[_0x9920('0x9')](),controller[_0x9920('0x23')]);router[_0x9920('0xb')]('/:id/whatsapp/interactions',auth['isAuthenticated'](),controller[_0x9920('0x24')]);router[_0x9920('0xb')](_0x9920('0x25'),auth[_0x9920('0x9')](),controller[_0x9920('0x26')]);router[_0x9920('0xb')]('/:id/lists',auth[_0x9920('0x9')](),controller['getLists']);router[_0x9920('0xb')](_0x9920('0x27'),auth[_0x9920('0x9')](),controller['getAgents']);router[_0x9920('0xb')]('/:id/prefixes',auth[_0x9920('0x9')](),controller[_0x9920('0x28')]);router['get'](_0x9920('0x29'),auth[_0x9920('0x9')](),controller['getFaxAccounts']);router['get'](_0x9920('0x2a'),auth[_0x9920('0x9')](),controller[_0x9920('0x2b')]);router['get']('/:id/openchannel_accounts',auth['isAuthenticated'](),controller[_0x9920('0x2c')]);router[_0x9920('0xb')](_0x9920('0x2d'),auth[_0x9920('0x9')](),controller[_0x9920('0x2e')]);router[_0x9920('0xb')](_0x9920('0x2f'),auth[_0x9920('0x9')](),controller[_0x9920('0x30')]);router[_0x9920('0xb')](_0x9920('0x31'),auth['isAuthenticated'](),controller[_0x9920('0x32')]);router[_0x9920('0xb')](_0x9920('0x33'),auth[_0x9920('0x9')](),controller[_0x9920('0x34')]);router[_0x9920('0xb')](_0x9920('0x35'),auth['isAuthenticated'](),controller[_0x9920('0x36')]);router['post']('/:id/contacts',auth[_0x9920('0x9')](),controller[_0x9920('0x37')]);router[_0x9920('0x38')]('/',auth[_0x9920('0x9')](),controller[_0x9920('0x39')]);router[_0x9920('0x38')](_0x9920('0x3a'),auth['isAuthenticated'](),controller['bulkCreate']);router[_0x9920('0x38')]('/:id/queues',auth[_0x9920('0x9')](),controller['addQueues']);var upload=multer({'storage':multer[_0x9920('0x3b')]({'destination':function(_0x337e91,_0x1b337f,_0x21ea8a){_0x21ea8a(null,path[_0x9920('0x3c')](config['root'],_0x9920('0x3d')));},'filename':function(_0x22dd34,_0x142cc9,_0x509efb){_0x509efb(null,util['format'](_0x9920('0x3e'),Date[_0x9920('0x3f')](),_0x142cc9[_0x9920('0x40')]));}})});router[_0x9920('0x38')](_0x9920('0x41'),upload[_0x9920('0x42')](_0x9920('0x43')),controller['addAvatar']);router['post'](_0x9920('0x44'),auth[_0x9920('0x9')](),controller['login']);router[_0x9920('0x38')](_0x9920('0x45'),auth['isAuthenticated'](),controller[_0x9920('0x46')]);router[_0x9920('0x38')](_0x9920('0x47'),auth[_0x9920('0x9')](),controller[_0x9920('0x48')]);router[_0x9920('0x38')](_0x9920('0x49'),auth['isAuthenticated'](),controller[_0x9920('0x4a')]);router['post'](_0x9920('0x25'),auth[_0x9920('0x9')](),controller[_0x9920('0x4b')]);router[_0x9920('0x38')](_0x9920('0x4c'),auth[_0x9920('0x9')](),controller[_0x9920('0x4d')]);router['post'](_0x9920('0x4e'),auth['isAuthenticated'](),controller[_0x9920('0x4f')]);router[_0x9920('0x38')]('/:id/fax_interactions',auth['isAuthenticated'](),controller[_0x9920('0x50')]);router[_0x9920('0x38')](_0x9920('0x51'),auth[_0x9920('0x9')](),controller[_0x9920('0x52')]);router[_0x9920('0x38')]('/:id/openchannel_interactions',auth[_0x9920('0x9')](),controller['addOpenchannelInteractions']);router[_0x9920('0x38')](_0x9920('0x53'),auth[_0x9920('0x9')](),controller['addWhatsappInteractions']);router[_0x9920('0x38')](_0x9920('0x29'),auth[_0x9920('0x9')](),controller[_0x9920('0x54')]);router['post'](_0x9920('0x2a'),auth[_0x9920('0x9')](),controller['addMailAccounts']);router[_0x9920('0x38')](_0x9920('0x55'),auth[_0x9920('0x9')](),controller[_0x9920('0x56')]);router[_0x9920('0x38')](_0x9920('0x2d'),auth[_0x9920('0x9')](),controller[_0x9920('0x57')]);router[_0x9920('0x38')](_0x9920('0x2f'),auth[_0x9920('0x9')](),controller[_0x9920('0x58')]);router[_0x9920('0x38')](_0x9920('0x31'),auth[_0x9920('0x9')](),controller[_0x9920('0x59')]);router[_0x9920('0x38')](_0x9920('0x35'),auth[_0x9920('0x9')](),controller[_0x9920('0x5a')]);router[_0x9920('0x5b')](_0x9920('0x12'),auth['isAuthenticated'](),controller[_0x9920('0x5c')]);router[_0x9920('0x5b')](_0x9920('0x5d'),auth[_0x9920('0x9')](),controller['changePassword']);router['delete'](_0x9920('0x5e'),auth['isAuthenticated'](),controller[_0x9920('0x5f')]);router[_0x9920('0x60')](_0x9920('0x25'),auth[_0x9920('0x9')](),controller[_0x9920('0x61')]);router[_0x9920('0x60')](_0x9920('0x12'),auth[_0x9920('0x9')](),controller['destroy']);router[_0x9920('0x60')](_0x9920('0x4c'),auth[_0x9920('0x9')](),controller['removeChatInteractions']);router['delete'](_0x9920('0x4e'),auth['isAuthenticated'](),controller[_0x9920('0x62')]);router[_0x9920('0x60')](_0x9920('0x63'),auth[_0x9920('0x9')](),controller[_0x9920('0x64')]);router['delete'](_0x9920('0x51'),auth['isAuthenticated'](),controller['removeSmsInteractions']);router['delete']('/:id/openchannel_interactions',auth[_0x9920('0x9')](),controller[_0x9920('0x65')]);router[_0x9920('0x60')]('/:id/whatsapp_interactions',auth[_0x9920('0x9')](),controller[_0x9920('0x66')]);router[_0x9920('0x60')](_0x9920('0x29'),auth[_0x9920('0x9')](),controller[_0x9920('0x67')]);router[_0x9920('0x60')]('/:id/mail_accounts',auth[_0x9920('0x9')](),controller['removeMailAccounts']);router[_0x9920('0x60')]('/:id/openchannel_accounts',auth[_0x9920('0x9')](),controller[_0x9920('0x68')]);router[_0x9920('0x60')](_0x9920('0x2d'),auth[_0x9920('0x9')](),controller[_0x9920('0x69')]);router[_0x9920('0x60')](_0x9920('0x2f'),auth[_0x9920('0x9')](),controller['removeChatWebsites']);router[_0x9920('0x60')](_0x9920('0x31'),auth[_0x9920('0x9')](),controller['removeWhatsappAccounts']);router[_0x9920('0x60')](_0x9920('0x35'),auth['isAuthenticated'](),controller[_0x9920('0x6a')]);router['post'](_0x9920('0x6b'),auth[_0x9920('0x9')](),controller['messengerSoundNotification']);module[_0x9920('0x6c')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index aea225d..a253599 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 _0x231b=['passive','actpass','update,nonat','TEXT','showWebBar','wss','encryption','avpf','force_avp','dtlsverify','dtlscertfile','dtlsprivatekey','rtcp_mux','icesupport','dtlssetup','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','util','STRING','name','The\x20name\x20of\x20the\x20user','setDataValue','fullname','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','admin','user','agent','telephone','local','INTEGER','accountcode','callerid','format','DATE','BOOLEAN','DEFAULT\x20PAUSE','ENUM','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','join','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','rfc2833','yes','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','active'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x231b,0x182));var _0xb231=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0x231b[_0x12fc8d];return _0x3f9d04;};'use strict';var Sequelize=require(_0xb231('0x0'));var moment=require(_0xb231('0x1'));var util=require(_0xb231('0x2'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0xb231('0x3')],'allowNull':![],'unique':_0xb231('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x139ade){this['setDataValue'](_0xb231('0x4'),_0x139ade);this['setDataValue']('defaultuser',_0x139ade);},'comment':_0xb231('0x5')},'fullname':{'type':Sequelize[_0xb231('0x3')],'allowNull':![],'set':function(_0x213191){this[_0xb231('0x6')](_0xb231('0x7'),_0x213191);this['setDataValue']('callerid',util['format'](_0xb231('0x8'),_0x213191,this[_0xb231('0x9')](_0xb231('0xa'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xb231('0xb'),'validate':{'isEmail':!![]},'set':function(_0x36dd9c){if(_0x36dd9c){this[_0xb231('0x6')]('email',_0x36dd9c[_0xb231('0xc')]());}}},'role':{'type':Sequelize['ENUM'](_0xb231('0xd'),_0xb231('0xe'),_0xb231('0xf'),_0xb231('0x10')),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xb231('0x3')],'defaultValue':_0xb231('0x11')},'internal':{'type':Sequelize[_0xb231('0x12')](0xb),'allowNull':![],'unique':'internal','set':function(_0x2bc681){this[_0xb231('0x6')](_0xb231('0xa'),_0x2bc681);this['setDataValue'](_0xb231('0x13'),_0x2bc681);this['setDataValue'](_0xb231('0x14'),util[_0xb231('0x15')](_0xb231('0x8'),this['getDataValue'](_0xb231('0x7')),_0x2bc681));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xb231('0x3')]},'mobile':{'type':Sequelize[_0xb231('0x3')]},'address':{'type':Sequelize[_0xb231('0x3')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0xb231('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xb231('0x3')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xb231('0x16')]},'voicePause':{'type':Sequelize[_0xb231('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xb231('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xb231('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xb231('0x17')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xb231('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xb231('0x3')],'defaultValue':_0xb231('0x18')},'lastPauseAt':{'type':Sequelize[_0xb231('0x16')]},'chatCapacity':{'type':Sequelize[_0xb231('0x12')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xb231('0x12')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xb231('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xb231('0x12')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xb231('0x12')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xb231('0x12')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xb231('0x17')],'defaultValue':![]},'description':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![]},'host':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0xb231('0x12')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xb231('0x12')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xb231('0x19')](_0xb231('0x1a'),_0xb231('0xe'),_0xb231('0x1b')),'allowNull':!![],'defaultValue':_0xb231('0x1a')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xb231('0x1c')},'callingpres':{'type':Sequelize[_0xb231('0x19')](_0xb231('0x1d'),_0xb231('0x1e'),'ALLOWED_FAILED_SCREEN',_0xb231('0x1f'),_0xb231('0x20'),_0xb231('0x21'),_0xb231('0x22'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xb231('0x23'),'set':function(_0x26bac9){this[_0xb231('0x6')]('transport',_0x26bac9?_0x26bac9[_0xb231('0x24')](','):null);},'get':function(){return this[_0xb231('0x9')](_0xb231('0x25'))?this['getDataValue'](_0xb231('0x25'))[_0xb231('0x26')](','):null;},'comment':_0xb231('0x27')},'dtmfmode':{'type':Sequelize[_0xb231('0x19')]('rfc2833',_0xb231('0x28'),_0xb231('0x29'),_0xb231('0x2a'),'auto'),'allowNull':!![],'defaultValue':_0xb231('0x2b')},'directmedia':{'type':Sequelize[_0xb231('0x19')](_0xb231('0x2c'),'no','nonat',_0xb231('0x2d'),_0xb231('0x2e')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xb231('0x19')](_0xb231('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![]},'nat':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![],'defaultValue':_0xb231('0x2f'),'set':function(_0xdc56eb){this[_0xb231('0x6')](_0xb231('0x30'),_0xdc56eb?_0xdc56eb[_0xb231('0x24')](','):null);},'get':function(){return this[_0xb231('0x9')]('nat')?this[_0xb231('0x9')](_0xb231('0x30'))[_0xb231('0x26')](','):null;},'comment':_0xb231('0x31')},'callgroup':{'type':Sequelize[_0xb231('0x3')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0xb231('0x3')]},'language':{'type':Sequelize[_0xb231('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0xb231('0x3')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xb231('0x32'),'set':function(_0x2595ff){this[_0xb231('0x6')](_0xb231('0x33'),_0x2595ff?_0x2595ff[_0xb231('0x24')](';'):_0xb231('0x32'));},'get':function(){return this['getDataValue'](_0xb231('0x33'))?this[_0xb231('0x9')](_0xb231('0x33'))[_0xb231('0x26')](';'):null;},'comment':_0xb231('0x34')},'autoframing':{'type':Sequelize[_0xb231('0x19')](_0xb231('0x2c'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![],'set':function(_0x2b6872){this[_0xb231('0x6')]('insecure',_0x2b6872?_0x2b6872[_0xb231('0x24')](','):null);},'get':function(){return this[_0xb231('0x9')]('insecure')?this[_0xb231('0x9')](_0xb231('0x35'))[_0xb231('0x26')](','):null;},'comment':_0xb231('0x36')},'trustrpid':{'type':Sequelize[_0xb231('0x19')](_0xb231('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xb231('0x19')](_0xb231('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM']('yes','no',_0xb231('0x37')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xb231('0x19')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xb231('0x19')](_0xb231('0x2c'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![],'defaultValue':_0xb231('0x38')},'amaflags':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xb231('0x19')](_0xb231('0x2c'),'no'),'allowNull':!![],'defaultValue':_0xb231('0x2c')},'busylevel':{'type':Sequelize[_0xb231('0x12')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xb231('0x19')]('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xb231('0x19')]('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xb231('0x19')](_0xb231('0x2c'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xb231('0x19')]('yes','no',_0xb231('0x39')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xb231('0x12')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xb231('0x19')](_0xb231('0x2c'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xb231('0x19')](_0xb231('0x3a'),_0xb231('0x3b'),_0xb231('0x3c')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xb231('0x12')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xb231('0x12')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xb231('0x19')](_0xb231('0x3d'),_0xb231('0x3e')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xb231('0x19')](_0xb231('0x2c'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xb231('0x12')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xb231('0x12')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xb231('0x12')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xb231('0x19')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xb231('0x12')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xb231('0x12')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0xb231('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xb231('0x19')](_0xb231('0x2c'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xb231('0x19')](_0xb231('0x2c'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0xb231('0x2c'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0xb231('0x2c'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xb231('0x19')](_0xb231('0x2c'),'no','fingerprint','certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xb231('0x12')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xb231('0x19')](_0xb231('0x3f'),_0xb231('0x40'),_0xb231('0x41')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xb231('0x19')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xb231('0x12')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xb231('0x19')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xb231('0x19')](_0xb231('0x2c'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xb231('0x19')](_0xb231('0x2c'),'no','nonat',_0xb231('0x2d'),_0xb231('0x42')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xb231('0x3')]},'resetPasswordExpires':{'type':Sequelize[_0xb231('0x16')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xb231('0x43')]},'showWebBar':{'type':Sequelize[_0xb231('0x12')],'defaultValue':0x0,'set':function(_0x2be83a){this[_0xb231('0x6')](_0xb231('0x44'),_0x2be83a);var _0x50830e=this['get']({'plain':!![]});switch(_0x2be83a){case 0x0:case 0x1:var _0x39b556=_0x50830e[_0xb231('0x25')]?_['isArray'](_0x50830e['transport'])?_0x50830e['transport'][_0xb231('0x24')]():_0x50830e[_0xb231('0x25')]:'udp';if(_0x39b556===_0xb231('0x45')){_0x39b556='udp';}this[_0xb231('0x6')](_0xb231('0x25'),_0x39b556);this[_0xb231('0x6')](_0xb231('0x46'),'no');this[_0xb231('0x6')](_0xb231('0x47'),null);this[_0xb231('0x6')](_0xb231('0x48'),null);this['setDataValue']('icesupport',null);this[_0xb231('0x6')]('dtlsenable',null);this[_0xb231('0x6')](_0xb231('0x49'),null);this[_0xb231('0x6')]('dtlssetup',null);this[_0xb231('0x6')](_0xb231('0x4a'),null);this[_0xb231('0x6')](_0xb231('0x4b'),null);this[_0xb231('0x6')](_0xb231('0x4c'),'no');break;case 0x2:this[_0xb231('0x6')](_0xb231('0x25'),_0xb231('0x45'));this[_0xb231('0x6')](_0xb231('0x46'),'yes');this[_0xb231('0x6')](_0xb231('0x47'),_0xb231('0x2c'));this[_0xb231('0x6')](_0xb231('0x48'),'yes');this[_0xb231('0x6')](_0xb231('0x4d'),_0xb231('0x2c'));this[_0xb231('0x6')]('dtlsenable',_0xb231('0x2c'));this[_0xb231('0x6')](_0xb231('0x49'),'no');this['setDataValue'](_0xb231('0x4e'),'actpass');this[_0xb231('0x6')]('dtlscertfile',_0x50830e['dtlscertfile']||_0xb231('0x4f'));this['setDataValue'](_0xb231('0x4b'),_0x50830e[_0xb231('0x4b')]||_0xb231('0x50'));this['setDataValue'](_0xb231('0x4c'),_0xb231('0x2c'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x2a4cc2){this[_0xb231('0x6')](_0xb231('0x51'),_0x2a4cc2?_0x2a4cc2[_0xb231('0x24')](','):[]);},'get':function(){return this[_0xb231('0x9')](_0xb231('0x51'))?_['map'](this['getDataValue'](_0xb231('0x51'))[_0xb231('0x26')](','),function(_0x1ccf2e){return parseInt(_0x1ccf2e,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0xb231('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0xb231('0x17')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xb231('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xb231('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xb231('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xb231('0x17')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xb231('0x12')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xb231('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0xb231('0x2c'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xb231('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xb231('0x3')]},'phoneBarEnableJaws':{'type':Sequelize[_0xb231('0x17')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xb231('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xb231('0x52')],'get':function(){return this[_0xb231('0x9')]('phoneBarEnableScreenRecordingByAgent')?this[_0xb231('0x9')](_0xb231('0x53')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xb231('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xb231('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xb231('0x17')],'defaultValue':![]},'interface':{'type':Sequelize[_0xb231('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xb231('0x17')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xb231('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xb231('0x17')],'defaultValue':![],'set':function(_0x532f5c){if(typeof _0x532f5c===_0xb231('0x54')){var _0x3e30b8=_0x532f5c==='1'?!![]:_0x532f5c==='0'?![]:_0x532f5c===_0xb231('0x55')?!![]:_0x532f5c==='false'?![]:![];this[_0xb231('0x6')]('screenrecording',_0x3e30b8);}else{this[_0xb231('0x6')](_0xb231('0x56'),_0x532f5c);}}},'blocked':{'type':Sequelize[_0xb231('0x17')],'defaultValue':![],'set':function(_0x59e1d0){this[_0xb231('0x6')](_0xb231('0x57'),_0x59e1d0);if(_0x59e1d0===!![]){this[_0xb231('0x6')](_0xb231('0x58'),moment());this[_0xb231('0x6')](_0xb231('0x59'),0x0);}else{this[_0xb231('0x6')](_0xb231('0x58'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xb231('0x12')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xb231('0x17')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xb231('0x17')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xb231('0x12')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xb231('0x17')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xb231('0x17')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0xb231('0x17')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0xb231('0x17')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0xb231('0x12')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0xb231('0x17')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0xb231('0x17')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0xb231('0x12')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0xb231('0x17')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0xb231('0x12')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0xb231('0x17')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0xb231('0x17')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0xb231('0x12')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0xb231('0x17')],'defaultValue':![]}}; \ No newline at end of file +var _0x248e=['info','inband','auto','yes','nonat','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','allow','ulaw;alaw;gsm','split','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','always','accept','originate','uac','uas','active','passive','actpass','update','update,nonat','TEXT','transport','wss','encryption','avpf','dtlsverify','dtlscertfile','dtlsprivatekey','rtcp_mux','force_avp','icesupport','dtlsenable','dtlssetup','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blocked','loginAttempts','blockedAt','UNSIGNED','sequelize','moment','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','email','ENUM','admin','user','local','internal','accountcode','getDataValue','DATE','BOOLEAN','DEFAULT\x20PAUSE','INTEGER','dynamic','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833'];(function(_0x12d033,_0x25fa2f){var _0x3b4e80=function(_0x46c1f4){while(--_0x46c1f4){_0x12d033['push'](_0x12d033['shift']());}};_0x3b4e80(++_0x25fa2f);}(_0x248e,0x1e8));var _0xe248=function(_0x5c78ff,_0x3a219f){_0x5c78ff=_0x5c78ff-0x0;var _0x50a1fa=_0x248e[_0x5c78ff];return _0x50a1fa;};'use strict';var Sequelize=require(_0xe248('0x0'));var moment=require(_0xe248('0x1'));var util=require('util');var _=require(_0xe248('0x2'));module[_0xe248('0x3')]={'name':{'type':Sequelize[_0xe248('0x4')],'allowNull':![],'unique':_0xe248('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x4a041b){this['setDataValue'](_0xe248('0x5'),_0x4a041b);this[_0xe248('0x6')](_0xe248('0x7'),_0x4a041b);},'comment':_0xe248('0x8')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x58fe76){this[_0xe248('0x6')](_0xe248('0x9'),_0x58fe76);this['setDataValue'](_0xe248('0xa'),util[_0xe248('0xb')](_0xe248('0xc'),_0x58fe76,this['getDataValue']('internal')));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xe248('0x4')],'allowNull':![],'unique':_0xe248('0xd'),'validate':{'isEmail':!![]},'set':function(_0xfd59b4){if(_0xfd59b4){this['setDataValue']('email',_0xfd59b4['toLowerCase']());}}},'role':{'type':Sequelize[_0xe248('0xe')](_0xe248('0xf'),_0xe248('0x10'),'agent','telephone'),'allowNull':![]},'password':{'type':Sequelize[_0xe248('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xe248('0x4')],'defaultValue':_0xe248('0x11')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0xe248('0x12'),'set':function(_0x353a6c){this[_0xe248('0x6')](_0xe248('0x12'),_0x353a6c);this[_0xe248('0x6')](_0xe248('0x13'),_0x353a6c);this[_0xe248('0x6')](_0xe248('0xa'),util['format']('\x22%s\x22\x20<%s>',this[_0xe248('0x14')]('fullname'),_0x353a6c));}},'salt':{'type':Sequelize[_0xe248('0x4')]},'phone':{'type':Sequelize[_0xe248('0x4')]},'mobile':{'type':Sequelize[_0xe248('0x4')]},'address':{'type':Sequelize[_0xe248('0x4')]},'zipcode':{'type':Sequelize[_0xe248('0x4')]},'userpic':{'type':Sequelize[_0xe248('0x4')]},'city':{'type':Sequelize[_0xe248('0x4')]},'country':{'type':Sequelize[_0xe248('0x4')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xe248('0x15')]},'voicePause':{'type':Sequelize[_0xe248('0x16')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xe248('0x16')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xe248('0x16')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xe248('0x16')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xe248('0x4')],'defaultValue':_0xe248('0x17')},'lastPauseAt':{'type':Sequelize[_0xe248('0x15')]},'chatCapacity':{'type':Sequelize[_0xe248('0x18')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xe248('0x18')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xe248('0x18')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xe248('0x18')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xe248('0x16')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xe248('0x18')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xe248('0x18')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xe248('0x16')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xe248('0x18')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xe248('0x16')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xe248('0x16')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xe248('0x16')],'defaultValue':![]},'description':{'type':Sequelize[_0xe248('0x4')],'allowNull':!![]},'host':{'type':Sequelize[_0xe248('0x4')],'allowNull':!![],'defaultValue':_0xe248('0x19')},'ipaddr':{'type':Sequelize[_0xe248('0x4')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xe248('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize[_0xe248('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xe248('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xe248('0x18')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM']('friend',_0xe248('0x10'),_0xe248('0x1a')),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize[_0xe248('0x4')],'allowNull':!![],'defaultValue':_0xe248('0x1b')},'callingpres':{'type':Sequelize[_0xe248('0xe')](_0xe248('0x1c'),_0xe248('0x1d'),_0xe248('0x1e'),_0xe248('0x1f'),_0xe248('0x20'),_0xe248('0x21'),_0xe248('0x22'),_0xe248('0x23')),'allowNull':!![]},'deny':{'type':Sequelize[_0xe248('0x4')],'allowNull':!![]},'permit':{'type':Sequelize[_0xe248('0x4')],'allowNull':!![]},'secret':{'type':Sequelize[_0xe248('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xe248('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xe248('0x4')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xe248('0x24'),'set':function(_0x548d89){this[_0xe248('0x6')]('transport',_0x548d89?_0x548d89[_0xe248('0x25')](','):null);},'get':function(){return this[_0xe248('0x14')]('transport')?this[_0xe248('0x14')]('transport')['split'](','):null;},'comment':_0xe248('0x26')},'dtmfmode':{'type':Sequelize[_0xe248('0xe')](_0xe248('0x27'),_0xe248('0x28'),'shortinfo',_0xe248('0x29'),_0xe248('0x2a')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM'](_0xe248('0x2b'),'no',_0xe248('0x2c'),'update','outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xe248('0xe')](_0xe248('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xe248('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xe248('0x4')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x29cf80){this[_0xe248('0x6')]('nat',_0x29cf80?_0x29cf80['join'](','):null);},'get':function(){return this['getDataValue'](_0xe248('0x2d'))?this['getDataValue'](_0xe248('0x2d'))['split'](','):null;},'comment':_0xe248('0x2e')},'callgroup':{'type':Sequelize[_0xe248('0x4')]},'namedcallgroup':{'type':Sequelize[_0xe248('0x4')]},'pickupgroup':{'type':Sequelize[_0xe248('0x4')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xe248('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0xe248('0x4')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x25ec9e){this[_0xe248('0x6')](_0xe248('0x2f'),_0x25ec9e?_0x25ec9e[_0xe248('0x25')](';'):_0xe248('0x30'));},'get':function(){return this[_0xe248('0x14')](_0xe248('0x2f'))?this[_0xe248('0x14')](_0xe248('0x2f'))[_0xe248('0x31')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0xe248('0xe')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x4f3ed5){this[_0xe248('0x6')](_0xe248('0x32'),_0x4f3ed5?_0x4f3ed5[_0xe248('0x25')](','):null);},'get':function(){return this['getDataValue']('insecure')?this[_0xe248('0x14')](_0xe248('0x32'))['split'](','):null;},'comment':_0xe248('0x33')},'trustrpid':{'type':Sequelize[_0xe248('0xe')](_0xe248('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xe248('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xe248('0xe')](_0xe248('0x2b'),'no',_0xe248('0x34')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xe248('0xe')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0xe248('0x2b'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xe248('0x18')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xe248('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xe248('0x4')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0xe248('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':_0xe248('0x2b')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xe248('0xe')](_0xe248('0x2b'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xe248('0xe')](_0xe248('0x2b'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xe248('0xe')](_0xe248('0x2b'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xe248('0xe')](_0xe248('0x2b'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xe248('0x4')],'allowNull':!![]},'template':{'type':Sequelize[_0xe248('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM']('yes','no',_0xe248('0x35')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xe248('0xe')](_0xe248('0x36'),'refuse',_0xe248('0x37')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xe248('0x18')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xe248('0x18')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xe248('0xe')](_0xe248('0x38'),_0xe248('0x39')),'allowNull':!![],'defaultValue':_0xe248('0x39')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0xe248('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xe248('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xe248('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':_0xe248('0x2b')},'keepalive':{'type':Sequelize[_0xe248('0x18')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xe248('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xe248('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xe248('0x18')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xe248('0x18')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0xe248('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xe248('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xe248('0x18')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xe248('0x18')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xe248('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xe248('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xe248('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xe248('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xe248('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xe248('0x18')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xe248('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xe248('0xe')](_0xe248('0x2b'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xe248('0xe')](_0xe248('0x2b'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xe248('0xe')](_0xe248('0x2b'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xe248('0xe')](_0xe248('0x2b'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xe248('0xe')](_0xe248('0x2b'),'no','fingerprint','certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xe248('0x18')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xe248('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xe248('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xe248('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0xe248('0x3a'),_0xe248('0x3b'),_0xe248('0x3c')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xe248('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xe248('0xe')](_0xe248('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xe248('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xe248('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xe248('0x18')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xe248('0xe')](_0xe248('0x2b'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xe248('0xe')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xe248('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xe248('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xe248('0xe')](_0xe248('0x2b'),'no','nonat',_0xe248('0x3d'),_0xe248('0x3e')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xe248('0x16')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xe248('0x4')]},'resetPasswordExpires':{'type':Sequelize[_0xe248('0x15')]},'passwordResetAt':{'type':Sequelize[_0xe248('0x15')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xe248('0x3f')]},'showWebBar':{'type':Sequelize[_0xe248('0x18')],'defaultValue':0x0,'set':function(_0x49588b){this['setDataValue']('showWebBar',_0x49588b);var _0x76ffe4=this['get']({'plain':!![]});switch(_0x49588b){case 0x0:case 0x1:var _0x3a3ea5=_0x76ffe4[_0xe248('0x40')]?_['isArray'](_0x76ffe4[_0xe248('0x40')])?_0x76ffe4[_0xe248('0x40')][_0xe248('0x25')]():_0x76ffe4[_0xe248('0x40')]:_0xe248('0x24');if(_0x3a3ea5===_0xe248('0x41')){_0x3a3ea5=_0xe248('0x24');}this[_0xe248('0x6')](_0xe248('0x40'),_0x3a3ea5);this[_0xe248('0x6')](_0xe248('0x42'),'no');this['setDataValue'](_0xe248('0x43'),null);this[_0xe248('0x6')]('force_avp',null);this[_0xe248('0x6')]('icesupport',null);this[_0xe248('0x6')]('dtlsenable',null);this[_0xe248('0x6')](_0xe248('0x44'),null);this['setDataValue']('dtlssetup',null);this[_0xe248('0x6')](_0xe248('0x45'),null);this[_0xe248('0x6')](_0xe248('0x46'),null);this[_0xe248('0x6')](_0xe248('0x47'),'no');break;case 0x2:this['setDataValue']('transport','wss');this['setDataValue'](_0xe248('0x42'),_0xe248('0x2b'));this[_0xe248('0x6')](_0xe248('0x43'),'yes');this['setDataValue'](_0xe248('0x48'),_0xe248('0x2b'));this[_0xe248('0x6')](_0xe248('0x49'),'yes');this[_0xe248('0x6')](_0xe248('0x4a'),_0xe248('0x2b'));this[_0xe248('0x6')](_0xe248('0x44'),'no');this[_0xe248('0x6')](_0xe248('0x4b'),_0xe248('0x3c'));this[_0xe248('0x6')](_0xe248('0x45'),_0x76ffe4['dtlscertfile']||'/etc/pki/tls/certs/motion.crt');this[_0xe248('0x6')](_0xe248('0x46'),_0x76ffe4[_0xe248('0x46')]||_0xe248('0x4c'));this['setDataValue'](_0xe248('0x47'),_0xe248('0x2b'));break;default:}}},'permissions':{'type':Sequelize[_0xe248('0x3f')],'set':function(_0x1b9334){this['setDataValue'](_0xe248('0x4d'),_0x1b9334?_0x1b9334[_0xe248('0x25')](','):[]);},'get':function(){return this[_0xe248('0x14')]('permissions')?_[_0xe248('0x4e')](this[_0xe248('0x14')](_0xe248('0x4d'))[_0xe248('0x31')](','),function(_0x91f010){return parseInt(_0x91f010,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xe248('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xe248('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0xe248('0x4')]},'phoneBarUnconditional':{'type':Sequelize[_0xe248('0x16')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xe248('0x16')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xe248('0x16')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xe248('0x16')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xe248('0x16')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xe248('0x18')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xe248('0x18')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xe248('0xe')](_0xe248('0x2b'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xe248('0x16')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xe248('0x4')]},'phoneBarEnableJaws':{'type':Sequelize[_0xe248('0x16')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xe248('0x16')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xe248('0x4f')],'get':function(){return this[_0xe248('0x14')](_0xe248('0x50'))?this['getDataValue'](_0xe248('0x50')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xe248('0x16')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xe248('0x16')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xe248('0x16')],'defaultValue':![]},'interface':{'type':Sequelize[_0xe248('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xe248('0x16')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xe248('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xe248('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x3f6af8){if(typeof _0x3f6af8==='string'){var _0x3c814c=_0x3f6af8==='1'?!![]:_0x3f6af8==='0'?![]:_0x3f6af8===_0xe248('0x51')?!![]:_0x3f6af8===_0xe248('0x52')?![]:![];this[_0xe248('0x6')](_0xe248('0x53'),_0x3c814c);}else{this[_0xe248('0x6')]('screenrecording',_0x3f6af8);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x39c86e){this['setDataValue'](_0xe248('0x54'),_0x39c86e);if(_0x39c86e===!![]){this['setDataValue']('blockedAt',moment());this['setDataValue'](_0xe248('0x55'),0x0);}else{this[_0xe248('0x6')](_0xe248('0x56'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xe248('0x16')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xe248('0x18')](0x5)[_0xe248('0x57')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xe248('0x16')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xe248('0x16')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0xe248('0x16')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xe248('0x16')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0xe248('0x16')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0xe248('0x18')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0xe248('0x16')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0xe248('0x18')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0xe248('0x18')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0xe248('0x16')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0xe248('0x18')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0xe248('0x16')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0xe248('0x18')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0xe248('0x16')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0xe248('0x18')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0xe248('0x16')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 9e9f96b..995aadc 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 _0x1ced=['col','asc','desc','substring','uniqBy','orderBy','getRealtimeAgents','offline','unavailable','voiceStatus','busy','slice','charAt','SELECT','select','field','ui.','InteractionId','ui.createdAt','user_has_','_interactions','ui.UserId\x20=\x20?','OpenTabs','messengerSoundNotification','util','path','lodash','squel','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../errors/api','APIBadRequestError','APINotFoundError','APIForbiddenrror','../../mysqldb','socket.io-emitter','redis','./user.socket','register','defaults','localhost','client','http','sendStatus','status','json','offset','limit','undefined','count','request','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','update','then','role','agent','emit','userNotification:recalc:','destroy','get','admin','Users','user','Agents','telephone','filter','map','value','includes','find','name','UserProfileResource','end','stack','User','fieldName','type','key','salt','previousPasswords','resetPasswordToken','md5secret','index','getOptions','where','query','includeAll','include','true','UserSetting','attributes','findAll','rows','openTabs','length','push','chat','dataValues','fax','whatsapp','all','show','userSetting','options','openchannel','body','params','describe','addContacts','ids','omit','internal','Setting','findById','validatePasswordPattern','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','from','voicemail','VoiceMail','password','fullname','email','permissions','101','102','104','106','108','109','100','111','114','create','Unauthorized','checkUserLimits','settingsEnabled','userProfileId','Telephones','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','UserProfileSection','isEmpty','compact','oldPassword','newPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','passwordHistoryLimit','validatePasswordHistory','updatePasswordsHistory','addQueues','channel','online','loginInPause','voicePause','isValidChannel','Unknown\x20channel','add','Queues','penalty','spread','toLowerCase','QueueId','voice','interface','format','SIP/%s','UserVoiceQueueRt','upsert','removeQueues','remove','isArray','capitalize','Queue:remove','addAvatar','userpic','getAvatar','join','root','download','server/files/images/','mail','ChatOpenTabs','CHAT','createdAt','FaxOpenTabs','FAX','OpenchannelOpenTabs','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','concat','getContacts','findOne','User\x20with\x20id\x20%s\x20not\x20found','hasOwnProperty','CmList','List','color','tag','getQueues','keys','Queue','filters','intersection','model','order','sort','merge','nolimit','getVoiceQueuesRt','fields','pick','getGroups','rawAttributes','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','getOpenchannelInteractions','OpenchannelInteraction','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','FaxInteraction','getWhatsappInteractions','login','phone','mobile','intrf','user:forcelogout','x-forwarded-for','remoteAddress','socket','connection','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','UserVoiceQueue.penalty','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','device','LOGININPAUSE','MemberReport','isMiddleware','resolve','logout','pause','QueuePause','updateAttributes','PAUSE','DEFAULT\x20PAUSE','Channel\x20parameter\x20%s\x20is\x20invalid','mailPause','chatPause','faxPause','openchannelPause','smsPause','whatsappPause','pauseType','lastPauseAt','unpause','getTeams','addTeams','transaction','Team','getAssociatedQueues','getDataValue','Voice','UserVoicePrefix','VoicePrefixId','Queue:save','removeTeams','Query\x20parameter\x20\x27ids\x27\x20is\x20required','flattenDeep','getLists','getVoiceQueues','values','You\x20can\x27t\x20delete\x20yourself','CmHopper','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','user_has_sms_interactions:save','removeSmsInteractions','addOpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','removeWhatsappInteractions','getVoicePrefixes','getFaxAccounts','addFaxAccounts','MailAccount','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','SmsAccount','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getScheduledCalls','$and','$or','$gt','$lt','$lte','$ne','$eq','$between','$notBetween','$notIn','$like','$notLike','$notILike','$overlap','$contains','$contained','$any','lastName','CmContact','Contact','dialActive','VoiceQueue','retrieveApiKey','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','token','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','send','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','getPresence','idle','unknown','ringing','queues','inbound','getAgents','lower'];(function(_0x1f77a4,_0x2e20fb){var _0x1fba5c=function(_0x45a518){while(--_0x45a518){_0x1f77a4['push'](_0x1f77a4['shift']());}};_0x1fba5c(++_0x2e20fb);}(_0x1ced,0x1a8));var _0xd1ce=function(_0x2a931f,_0x1d76ea){_0x2a931f=_0x2a931f-0x0;var _0x57ceb8=_0x1ced[_0x2a931f];return _0x57ceb8;};'use strict';var moment=require('moment');var util=require(_0xd1ce('0x0'));var path=require(_0xd1ce('0x1'));var fs=require('fs');var _=require(_0xd1ce('0x2'));var squel=require(_0xd1ce('0x3'));var Redis=require(_0xd1ce('0x4'));var jayson=require('jayson/promise');var authService=require('../../components/auth/service');var contacts=require(_0xd1ce('0x5'));var qs=require(_0xd1ce('0x6'));var rta=require('../../components/realtime/agents');var logger=require(_0xd1ce('0x7'))(_0xd1ce('0x8'));var utils=require(_0xd1ce('0x9'));var config=require(_0xd1ce('0xa'));var licenseUtil=require('../../config/license/util');var APIBadRequestError=require(_0xd1ce('0xb'))[_0xd1ce('0xc')];var APINotFoundError=require('../../errors/api')[_0xd1ce('0xd')];var APIForbiddenError=require(_0xd1ce('0xb'))[_0xd1ce('0xe')];var APIHandleError=require('../../errors/api')['handleError'];var db=require(_0xd1ce('0xf'))['db'];var socket=require(_0xd1ce('0x10'))(new Redis(config[_0xd1ce('0x11')]));require(_0xd1ce('0x12'))[_0xd1ce('0x13')](socket);config[_0xd1ce('0x11')]=_[_0xd1ce('0x14')](config[_0xd1ce('0x11')],{'host':_0xd1ce('0x15'),'port':0x18eb});var amiClient=jayson[_0xd1ce('0x16')][_0xd1ce('0x17')]({'port':0x232a});var values;function respondWithStatusCode(_0x1867c7,_0x24d222){_0x24d222=_0x24d222||0xcc;return function(_0x417b24){if(_0x417b24){return _0x1867c7[_0xd1ce('0x18')](_0x24d222);}return _0x1867c7[_0xd1ce('0x19')](_0x24d222)['end']();};}function respondWithResult(_0xd6b99a,_0x29ef77){_0x29ef77=_0x29ef77||0xc8;return function(_0x38625a){if(_0x38625a){return _0xd6b99a['status'](_0x29ef77)[_0xd1ce('0x1a')](_0x38625a);}};}function respondWithFilteredResult(_0x51a35f,_0x4b63cb){return function(_0x3964cc){if(_0x3964cc){var _0x53ac36=typeof _0x4b63cb[_0xd1ce('0x1b')]==='undefined'&&typeof _0x4b63cb[_0xd1ce('0x1c')]===_0xd1ce('0x1d');var _0x3309e3=_0x3964cc[_0xd1ce('0x1e')];var _0x39ccda=_0x53ac36?0x0:_0x4b63cb[_0xd1ce('0x1b')];var _0x1f6497=_0x53ac36?_0x3964cc[_0xd1ce('0x1e')]:_0x4b63cb[_0xd1ce('0x1b')]+_0x4b63cb['limit'];var _0x3f666a;if(_0x1f6497>=_0x3309e3){_0x1f6497=_0x3309e3;_0x3f666a=0xc8;}else{_0x3f666a=0xce;}_0x51a35f[_0xd1ce('0x19')](_0x3f666a);return _0x51a35f['set']('Content-Range',_0x39ccda+'-'+_0x1f6497+'/'+_0x3309e3)[_0xd1ce('0x1a')](_0x3964cc);}return null;};}function respondWithRpcPromise(_0x27b554,_0xb27dfb,_0x8c17e8,_0x5aaf16){return new Promise(function(_0x526401,_0x3ded28){var _0x37db24=_0x5aaf16||amiClient;return _0x37db24[_0xd1ce('0x1f')](_0x27b554,_0x8c17e8)['then'](function(_0x3bc6fa){logger['info'](_0xd1ce('0x20'),_0xb27dfb,_0xd1ce('0x21'));logger[_0xd1ce('0x22')](_0xd1ce('0x23'),_0xb27dfb,_0xd1ce('0x21'),JSON['stringify'](_0x3bc6fa));if(_0x3bc6fa[_0xd1ce('0x24')]){if(_0x3bc6fa[_0xd1ce('0x24')][_0xd1ce('0x25')]===0x1f4){logger[_0xd1ce('0x24')]('User,\x20%s,\x20%s',_0xb27dfb,_0x3bc6fa[_0xd1ce('0x24')][_0xd1ce('0x26')]);return _0x3ded28(_0x3bc6fa[_0xd1ce('0x24')]['message']);}logger[_0xd1ce('0x24')](_0xd1ce('0x20'),_0xb27dfb,_0x3bc6fa[_0xd1ce('0x24')][_0xd1ce('0x26')]);return _0x526401(_0x3bc6fa[_0xd1ce('0x24')][_0xd1ce('0x26')]);}else{logger[_0xd1ce('0x27')](_0xd1ce('0x20'),_0xb27dfb,'request\x20sent');_0x526401(_0x3bc6fa[_0xd1ce('0x28')][_0xd1ce('0x26')]);}})[_0xd1ce('0x29')](function(_0x9241e5){logger[_0xd1ce('0x24')](_0xd1ce('0x20'),_0xb27dfb,_0x9241e5);_0x3ded28(_0x9241e5);});});}function saveUpdates(_0x1a7eda){return function(_0x50067d){if(_0x50067d){return _0x50067d[_0xd1ce('0x2a')](_0x1a7eda)[_0xd1ce('0x2b')](function(_0x123204){if(_0x123204[_0xd1ce('0x2c')]===_0xd1ce('0x2d')){socket[_0xd1ce('0x2e')](_0xd1ce('0x2f')+_0x123204['id'],_0x123204);}return _0x123204;});}return null;};}function removeEntity(_0x596955,_0x2079e3){return function(_0x22115c){if(_0x22115c){return _0x22115c[_0xd1ce('0x30')]({'transaction':_0x2079e3})[_0xd1ce('0x2b')](function(){var _0x1a68ff=_0x22115c[_0xd1ce('0x31')]({'plain':!![]});if(_0x1a68ff[_0xd1ce('0x2c')]===_0xd1ce('0x32'))return;var _0x3d9014=[{'name':_0xd1ce('0x33'),'value':_0xd1ce('0x34'),'ignore':!![]},{'name':_0xd1ce('0x35'),'value':_0xd1ce('0x2d'),'ignore':![]},{'name':'Telephones','value':_0xd1ce('0x36'),'ignore':![]}];var _0x45c1f7=_(_0x3d9014)[_0xd1ce('0x37')]('ignore')[_0xd1ce('0x38')](_0xd1ce('0x39'))[_0xd1ce('0x39')]();if(_[_0xd1ce('0x3a')](_0x45c1f7,_0x1a68ff[_0xd1ce('0x2c')])){return;}var _0x1ab5ee=_[_0xd1ce('0x3b')](_0x3d9014,[_0xd1ce('0x39'),_0x1a68ff[_0xd1ce('0x2c')]])[_0xd1ce('0x3c')];return db[_0xd1ce('0x3d')][_0xd1ce('0x30')]({'where':{'type':_0x1ab5ee,'resourceId':_0x1a68ff['id']},'transaction':_0x2079e3})['then'](function(){return _0x22115c;});})[_0xd1ce('0x2b')](function(){_0x596955['status'](0xcc)[_0xd1ce('0x3e')]();});}};}function handleEntityNotFound(_0xb01dab){return function(_0x28d332){if(!_0x28d332){_0xb01dab[_0xd1ce('0x18')](0x194);}return _0x28d332;};}function handleError(_0x224117,_0x46bda8){_0x46bda8=_0x46bda8||0x1f4;return function(_0x3a6491){logger[_0xd1ce('0x24')](_0x3a6491[_0xd1ce('0x3f')]);if(_0x3a6491[_0xd1ce('0x3c')]){delete _0x3a6491['name'];}_0x224117['status'](_0x46bda8)['send'](_0x3a6491);};}function getUserAttributes(){return _(db[_0xd1ce('0x40')]['rawAttributes'])[_0xd1ce('0x38')](function(_0x18fc98){return{'name':_0x18fc98[_0xd1ce('0x41')],'type':_0x18fc98[_0xd1ce('0x42')][_0xd1ce('0x43')]};})['filter'](function(_0xa6dea5){return!['password',_0xd1ce('0x44'),_0xd1ce('0x45'),_0xd1ce('0x46'),'resetPasswordExpires',_0xd1ce('0x47')]['includes'](_0xa6dea5[_0xd1ce('0x3c')]);})[_0xd1ce('0x39')]();}exports[_0xd1ce('0x48')]=function(_0x202652,_0x45c525){var _0x3cd1a4={},_0x5be2cf={'count':0x0,'rows':[]};var _0x28e2e7=getUserAttributes();_0x3cd1a4=qs[_0xd1ce('0x49')](_0x28e2e7,_0x202652);var _0x120f74={'where':_0x3cd1a4[_0xd1ce('0x4a')]};return db[_0xd1ce('0x40')]['count'](_0x120f74)['then'](function(_0x2fa131){_0x5be2cf[_0xd1ce('0x1e')]=_0x2fa131;if(_0x202652[_0xd1ce('0x4b')][_0xd1ce('0x4c')]){_0x3cd1a4[_0xd1ce('0x4d')]=[{'all':!![]}];}if(_0x202652[_0xd1ce('0x4b')]['userSetting']===_0xd1ce('0x4e')){_0x3cd1a4[_0xd1ce('0x4d')]=[{'model':db[_0xd1ce('0x4f')],'as':'userSetting'}];}if(!_[_0xd1ce('0x3a')](_0x3cd1a4[_0xd1ce('0x50')],'id')){_0x3cd1a4['attributes']['push']('id');}return db['User'][_0xd1ce('0x51')](_0x3cd1a4);})['then'](function(_0x4ebe73){_0x5be2cf[_0xd1ce('0x52')]=_0x4ebe73;if(_0x202652[_0xd1ce('0x4b')][_0xd1ce('0x53')]==='true'){var _0x5d0738=[];for(var _0x57050d=0x0;_0x57050d<_0x5be2cf[_0xd1ce('0x52')][_0xd1ce('0x54')];_0x57050d++){_0x5d0738[_0xd1ce('0x55')](get_open_tabs(_0xd1ce('0x56'),_0x5be2cf[_0xd1ce('0x52')][_0x57050d][_0xd1ce('0x57')]));_0x5d0738['push'](get_open_tabs('sms',_0x5be2cf['rows'][_0x57050d][_0xd1ce('0x57')]));_0x5d0738['push'](get_open_tabs(_0xd1ce('0x58'),_0x5be2cf[_0xd1ce('0x52')][_0x57050d][_0xd1ce('0x57')]));_0x5d0738[_0xd1ce('0x55')](get_open_tabs('mail',_0x5be2cf[_0xd1ce('0x52')][_0x57050d][_0xd1ce('0x57')]));_0x5d0738['push'](get_open_tabs('openchannel',_0x5be2cf['rows'][_0x57050d][_0xd1ce('0x57')]));_0x5d0738[_0xd1ce('0x55')](get_open_tabs(_0xd1ce('0x59'),_0x5be2cf[_0xd1ce('0x52')][_0x57050d][_0xd1ce('0x57')]));}return Promise[_0xd1ce('0x5a')](_0x5d0738)[_0xd1ce('0x2b')](function(){return _0x5be2cf;});}else{return _0x5be2cf;}})[_0xd1ce('0x2b')](respondWithFilteredResult(_0x45c525,_0x3cd1a4))[_0xd1ce('0x29')](handleError(_0x45c525,null));};exports[_0xd1ce('0x5b')]=function(_0x1bca26,_0x2ba88b){var _0x4f6c5f=getUserAttributes();_0x1bca26['query']['id']=_0x1bca26['params']['id'];var _0x136a9e=qs[_0xd1ce('0x49')](_0x4f6c5f,_0x1bca26);if(_0x1bca26[_0xd1ce('0x4b')][_0xd1ce('0x4c')]){_0x136a9e[_0xd1ce('0x4d')]=[{'all':!![]}];}if(_0x1bca26[_0xd1ce('0x4b')][_0xd1ce('0x5c')]===_0xd1ce('0x4e')){_0x136a9e[_0xd1ce('0x4d')]=[{'model':db[_0xd1ce('0x4f')],'as':_0xd1ce('0x5c')}];}_0x136a9e=_['merge']({},_0x136a9e,_0x1bca26[_0xd1ce('0x5d')]);if(!_['includes'](_0x136a9e[_0xd1ce('0x50')],'id')){_0x136a9e[_0xd1ce('0x50')][_0xd1ce('0x55')]('id');}return db[_0xd1ce('0x40')][_0xd1ce('0x3b')](_0x136a9e)[_0xd1ce('0x2b')](handleEntityNotFound(_0x2ba88b,null))[_0xd1ce('0x2b')](function(_0x71bc3a){var _0x52eb62=[];values=_0x71bc3a;if(_0x1bca26[_0xd1ce('0x4b')][_0xd1ce('0x53')]===_0xd1ce('0x4e')){_0x52eb62['push'](get_open_tabs(_0xd1ce('0x56'),_0x71bc3a[_0xd1ce('0x57')]));_0x52eb62[_0xd1ce('0x55')](get_open_tabs('sms',_0x71bc3a['dataValues']));_0x52eb62[_0xd1ce('0x55')](get_open_tabs(_0xd1ce('0x5e'),_0x71bc3a[_0xd1ce('0x57')]));_0x52eb62[_0xd1ce('0x55')](get_open_tabs(_0xd1ce('0x59'),_0x71bc3a['dataValues']));_0x52eb62[_0xd1ce('0x55')](get_open_tabs(_0xd1ce('0x58'),_0x71bc3a[_0xd1ce('0x57')]));_0x52eb62[_0xd1ce('0x55')](get_open_tabs('mail',_0x71bc3a[_0xd1ce('0x57')]));return Promise['all'](_0x52eb62);}else{return values;}})[_0xd1ce('0x2b')](function(){return values;})[_0xd1ce('0x2b')](respondWithResult(_0x2ba88b,null))[_0xd1ce('0x29')](handleError(_0x2ba88b,null));};exports['update']=function(_0x1bb6e5,_0x957bff){if(_0x1bb6e5[_0xd1ce('0x5f')]['id']){delete _0x1bb6e5[_0xd1ce('0x5f')]['id'];}delete _0x1bb6e5[_0xd1ce('0x5f')][_0xd1ce('0x2c')];return db[_0xd1ce('0x40')][_0xd1ce('0x3b')]({'where':{'id':_0x1bb6e5[_0xd1ce('0x60')]['id']}})['then'](handleEntityNotFound(_0x957bff,null))['then'](saveUpdates(_0x1bb6e5[_0xd1ce('0x5f')],null))[_0xd1ce('0x2b')](respondWithResult(_0x957bff,null))[_0xd1ce('0x29')](handleError(_0x957bff,null));};exports[_0xd1ce('0x61')]=function(_0x5cfa8c,_0x5cff51){return db[_0xd1ce('0x40')][_0xd1ce('0x61')]()[_0xd1ce('0x2b')](respondWithResult(_0x5cff51,null))['catch'](handleError(_0x5cff51,null));};exports[_0xd1ce('0x62')]=function(_0x53f92a,_0x574b35){return db[_0xd1ce('0x40')]['find']({'where':{'id':_0x53f92a[_0xd1ce('0x60')]['id']}})[_0xd1ce('0x2b')](handleEntityNotFound(_0x574b35,null))[_0xd1ce('0x2b')](function(_0x537652){if(_0x537652){return _0x537652[_0xd1ce('0x62')](_0x53f92a[_0xd1ce('0x5f')][_0xd1ce('0x63')],_[_0xd1ce('0x64')](_0x53f92a['body'],[_0xd1ce('0x63'),'id'])||{});}})['then'](respondWithResult(_0x574b35,null))[_0xd1ce('0x29')](handleError(_0x574b35,null));};function validateUser(_0x411bba){return new Promise(function(_0x2558c2,_0x5d68f9){if(_0x411bba[_0xd1ce('0x65')])return _0x2558c2(_0x411bba);return db[_0xd1ce('0x66')][_0xd1ce('0x67')](0x1)['then'](function(_0x119d8e){if(_0x119d8e['securePassword'])authService[_0xd1ce('0x68')](_0x411bba['password']);db[_0xd1ce('0x40')][_0xd1ce('0x69')]('internal')[_0xd1ce('0x2b')](function(_0x35684b){if(_[_0xd1ce('0x6a')](_0x35684b)){_0x411bba[_0xd1ce('0x65')]=_0x119d8e[_0xd1ce('0x6b')]||0x1;return;}if(_[_0xd1ce('0x6a')](_0x119d8e['min_internal'])||_0x119d8e[_0xd1ce('0x6b')]===_0x35684b){_0x411bba[_0xd1ce('0x65')]=_0x35684b+0x1;return;}if(_0x119d8e['min_internal']>_0x35684b){_0x411bba['internal']=_0x119d8e[_0xd1ce('0x6b')];return;}return db[_0xd1ce('0x6c')][_0xd1ce('0x4b')](_0xd1ce('0x6d'),{'type':db[_0xd1ce('0x6c')][_0xd1ce('0x6e')]['SELECT']})[_0xd1ce('0x2b')](function(_0x109d9a){if(_0x109d9a&&_0x109d9a[_0xd1ce('0x54')]){for(var _0x438638=0x0,_0xb86303=_0x109d9a['length'];_0x438638<_0xb86303&&_[_0xd1ce('0x6a')](_0x411bba[_0xd1ce('0x65')]);_0x438638++){if(_0x119d8e[_0xd1ce('0x6b')]<=_0x109d9a[_0x438638]['from']){_0x411bba['internal']=_0x109d9a[_0x438638][_0xd1ce('0x6f')];}else if(_0x119d8e['min_internal']>_0x109d9a[_0x438638][_0xd1ce('0x6f')]&&_0x119d8e[_0xd1ce('0x6b')]<=_0x109d9a[_0x438638]['to']){_0x411bba[_0xd1ce('0x65')]=_0x119d8e['min_internal'];}}}if(_[_0xd1ce('0x6a')](_0x411bba[_0xd1ce('0x65')])){_0x411bba[_0xd1ce('0x65')]=_0x35684b+0x1;}return _0x2558c2(_0x411bba);});});})[_0xd1ce('0x29')](function(_0x43520c){_0x5d68f9(_0x43520c);});});}function updateUser(_0x2e0aee){return new Promise(function(_0x35f041,_0x406559){try{if(_0x2e0aee[_0xd1ce('0x70')]){_0x2e0aee['mailbox']=_0x2e0aee[_0xd1ce('0x65')];_0x2e0aee[_0xd1ce('0x71')]={'mailbox':_0x2e0aee[_0xd1ce('0x65')],'password':_0x2e0aee[_0xd1ce('0x72')],'fullname':_0x2e0aee[_0xd1ce('0x73')],'email':_0x2e0aee[_0xd1ce('0x74')]};}if(_0x2e0aee[_0xd1ce('0x2c')]==='agent'){if(!_0x2e0aee['permissions'])_0x2e0aee[_0xd1ce('0x75')]=[_0xd1ce('0x76'),_0xd1ce('0x77'),'103','113','110',_0xd1ce('0x78'),'105',_0xd1ce('0x79'),'107',_0xd1ce('0x7a'),_0xd1ce('0x7b'),_0xd1ce('0x7c'),_0xd1ce('0x7d'),_0xd1ce('0x7e'),'115'];}_0x35f041(_0x2e0aee);}catch(_0x1c2d20){_0x406559(_0x1c2d20);}});}exports[_0xd1ce('0x7f')]=function(_0x285430,_0x30c741){if(_0x285430[_0xd1ce('0x34')][_0xd1ce('0x2c')]==='agent')throw new Error(_0xd1ce('0x80'));if(_0x285430['body']['role']===_0xd1ce('0x34')&&_0x285430['user'][_0xd1ce('0x2c')]!==_0xd1ce('0x32')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x285430[_0xd1ce('0x5f')][_0xd1ce('0x2c')]===_0xd1ce('0x32')&&_0x285430[_0xd1ce('0x34')][_0xd1ce('0x2c')]!==_0xd1ce('0x32')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0xd1ce('0x81')]([_0x285430[_0xd1ce('0x5f')]])[_0xd1ce('0x2b')](function(){return validateUser(_0x285430['body']);})[_0xd1ce('0x2b')](function(_0x3429bb){return updateUser(_0x3429bb)['then'](function(_0x4708cd){if(_0x4708cd[_0xd1ce('0x2c')]===_0xd1ce('0x32')){_0x4708cd['settingsEnabled']=_0x285430[_0xd1ce('0x34')][_0xd1ce('0x82')];delete _0x4708cd[_0xd1ce('0x83')];}return _0x4708cd;});})[_0xd1ce('0x2b')](function(_0x5013f8){return db['User'][_0xd1ce('0x7f')](_0x5013f8,{'include':[{'model':db[_0xd1ce('0x71')],'as':_0xd1ce('0x71')}]});})[_0xd1ce('0x2b')](function(_0x2489fc){if(_0x285430[_0xd1ce('0x5f')]['role']===_0xd1ce('0x34'))return _0x2489fc;if(_0x285430[_0xd1ce('0x34')][_0xd1ce('0x2c')]!==_0xd1ce('0x34'))return _0x2489fc;return db['UserProfileSection'][_0xd1ce('0x3b')]({'where':{'name':_0x2489fc[_0xd1ce('0x2c')]===_0xd1ce('0x2d')?_0xd1ce('0x35'):_0xd1ce('0x84'),'userProfileId':_0x285430[_0xd1ce('0x34')]['userProfileId']},'raw':!![]})[_0xd1ce('0x2b')](function(_0x922df6){if(!_0x922df6||_0x922df6[_0xd1ce('0x85')]!=0x0)return _0x2489fc;return db[_0xd1ce('0x3d')]['create']({'name':_0x2489fc[_0xd1ce('0x3c')],'resourceId':_0x2489fc['id'],'type':_0x922df6[_0xd1ce('0x3c')],'sectionId':_0x922df6['id']},{})['then'](function(){return _0x2489fc;});})[_0xd1ce('0x29')](function(_0x3e4e50){logger['error'](_0xd1ce('0x86'),_0x3e4e50);throw _0x3e4e50;});})[_0xd1ce('0x2b')](respondWithResult(_0x30c741,0xc9))[_0xd1ce('0x29')](handleError(_0x30c741,null));};exports[_0xd1ce('0x87')]=function(_0x566b69,_0x4e6774){var _0x2643c7=_0x566b69['body'];var _0x46dac4=[];if(_0x566b69[_0xd1ce('0x34')]['role']===_0xd1ce('0x2d'))throw new Error(_0xd1ce('0x80'));if(_[_0xd1ce('0x88')](_0x2643c7,['role',_0xd1ce('0x34')])&&_0x566b69[_0xd1ce('0x34')][_0xd1ce('0x2c')]!=='admin'){throw new Error(_0xd1ce('0x89'));}if(_[_0xd1ce('0x88')](_0x2643c7,['role',_0xd1ce('0x32')])&&_0x566b69[_0xd1ce('0x34')][_0xd1ce('0x2c')]!=='admin'){throw new Error(_0xd1ce('0x8a'));}return licenseUtil[_0xd1ce('0x81')](_0x2643c7)[_0xd1ce('0x2b')](function(){return validateUser(_0x2643c7[0x0]);})[_0xd1ce('0x2b')](function(){for(var _0x4d36bd=0x1;_0x4d36bd<_0x2643c7[_0xd1ce('0x54')];_0x4d36bd++){var _0x49860b=_0x2643c7[_0x4d36bd-0x1][_0xd1ce('0x65')];if(!_0x2643c7[_0x4d36bd]['internal'])_0x2643c7[_0x4d36bd][_0xd1ce('0x65')]=_0x49860b+0x1;_0x46dac4['push'](validateUser(_0x2643c7[_0x4d36bd]));}return Promise[_0xd1ce('0x5a')](_0x46dac4);})['then'](function(){_0x46dac4=[];for(var _0x3f43cb=0x0;_0x3f43cb<_0x2643c7[_0xd1ce('0x54')];_0x3f43cb++){_0x46dac4[_0xd1ce('0x55')](updateUser(_0x2643c7[_0x3f43cb]));}return Promise[_0xd1ce('0x5a')](_0x46dac4);})[_0xd1ce('0x2b')](function(){_0x46dac4=_0x2643c7[_0xd1ce('0x38')](function(_0x510b4c){return db[_0xd1ce('0x40')]['create'](_0x510b4c,{'include':[{'model':db[_0xd1ce('0x71')],'as':_0xd1ce('0x71')}]})[_0xd1ce('0x2b')](function(_0x344bcd){_0x510b4c['id']=_0x344bcd['id'];return _0x510b4c;});});return Promise[_0xd1ce('0x5a')](_0x46dac4);})[_0xd1ce('0x2b')](function(_0x393942){if(_0x566b69['body'][_0xd1ce('0x2c')]===_0xd1ce('0x34'))return _0x393942;if(_0x566b69[_0xd1ce('0x34')]['role']!==_0xd1ce('0x34'))return _0x393942;var _0x3cc96c=_['some'](_0x393942,function(_0x5ea575){return _0x5ea575[_0xd1ce('0x2c')]===_0xd1ce('0x2d')||_0x5ea575['role']===_0xd1ce('0x36');});if(!_0x3cc96c)return _0x393942;return db[_0xd1ce('0x8b')][_0xd1ce('0x51')]({'where':{'name':{'$or':[_0xd1ce('0x35'),_0xd1ce('0x84')]},'userProfileId':_0x566b69['user'][_0xd1ce('0x83')]},'raw':!![]})['then'](function(_0x1a0a44){if(_[_0xd1ce('0x8c')](_0x1a0a44)||!_[_0xd1ce('0x88')](_0x1a0a44,[_0xd1ce('0x85'),0x0]))return _0x393942;_0x46dac4=[];var _0x1ef110=_(_0x1a0a44)[_0xd1ce('0x38')](function(_0x1228df){if(_0x1228df[_0xd1ce('0x85')]===0x1)return;return _0x1228df[_0xd1ce('0x3c')]===_0xd1ce('0x35')?_0xd1ce('0x2d'):_0xd1ce('0x36');})[_0xd1ce('0x8d')]()[_0xd1ce('0x39')]();for(var _0x1b4625=0x0;_0x1b4625<_0x393942[_0xd1ce('0x54')];_0x1b4625++){if(!_[_0xd1ce('0x3a')](_0x1ef110,_0x393942[_0x1b4625]['role']))return;var _0x5a5128=_0x393942[_0x1b4625]['role']===_0xd1ce('0x2d')?_0xd1ce('0x35'):_0xd1ce('0x84');_0x46dac4[_0xd1ce('0x55')](db[_0xd1ce('0x3d')][_0xd1ce('0x7f')]({'name':_0x393942[_0x1b4625]['name'],'resourceId':_0x393942[_0x1b4625]['id'],'type':_0x5a5128,'sectionId':_[_0xd1ce('0x3b')](_0x1a0a44,['name',_0x5a5128])['id']},{}));}return Promise[_0xd1ce('0x5a')](_0x46dac4);});})[_0xd1ce('0x2b')](respondWithResult(_0x4e6774,0xc9))[_0xd1ce('0x29')](handleError(_0x4e6774,null));};exports['changePassword']=function(_0x333684,_0x41f77d){if(_0x333684[_0xd1ce('0x5f')]['id']){delete _0x333684[_0xd1ce('0x5f')]['id'];}return db['User'][_0xd1ce('0x3b')]({'where':{'id':_0x333684[_0xd1ce('0x60')]['id']}})[_0xd1ce('0x2b')](function(_0x5594fe){if(!_0x5594fe)return null;if(_0x5594fe['id']===_0x333684['user']['id']){if(!_0x333684[_0xd1ce('0x5f')][_0xd1ce('0x8e')]||!_0x333684[_0xd1ce('0x5f')][_0xd1ce('0x8f')]){throw new db[(_0xd1ce('0x90'))][(_0xd1ce('0x91'))](_0xd1ce('0x92'));}if(!_0x5594fe[_0xd1ce('0x93')](_0x333684[_0xd1ce('0x5f')][_0xd1ce('0x8e')])){throw new db[(_0xd1ce('0x90'))][(_0xd1ce('0x91'))](_0xd1ce('0x94'));}if(_0x333684[_0xd1ce('0x5f')][_0xd1ce('0x8e')]===_0x333684[_0xd1ce('0x5f')]['newPassword']){throw new db[(_0xd1ce('0x90'))][(_0xd1ce('0x91'))](_0xd1ce('0x95'));}}else if(_0x333684[_0xd1ce('0x34')][_0xd1ce('0x2c')]===_0xd1ce('0x32')){if(!_0x333684[_0xd1ce('0x5f')]['newPassword']){throw new db[(_0xd1ce('0x90'))][(_0xd1ce('0x91'))](_0xd1ce('0x96'));}}else if(_0x333684[_0xd1ce('0x34')][_0xd1ce('0x2c')]===_0xd1ce('0x34')){if(!_0x333684[_0xd1ce('0x5f')][_0xd1ce('0x8f')]){throw new db[(_0xd1ce('0x90'))][(_0xd1ce('0x91'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x5594fe['role']!=='agent'){throw new db[(_0xd1ce('0x90'))]['ValidationError']('Unauthorized');}}else{throw new db[(_0xd1ce('0x90'))]['ValidationError'](_0xd1ce('0x80'));}return _0x5594fe;})[_0xd1ce('0x2b')](handleEntityNotFound(_0x41f77d,null))[_0xd1ce('0x2b')](function(_0x400765){return db[_0xd1ce('0x66')]['findOne']({'attributes':['id','securePassword','enforcePasswordHistory',_0xd1ce('0x97')]})[_0xd1ce('0x2b')](function(_0xc61494){if(_0xc61494['securePassword'])authService[_0xd1ce('0x68')](_0x333684[_0xd1ce('0x5f')]['newPassword']);if(!_0xc61494['enforcePasswordHistory']||!_0x400765['previousPasswords'])return _0x400765;authService[_0xd1ce('0x98')](_0x333684['body'][_0xd1ce('0x8f')],_0x400765[_0xd1ce('0x45')],_0xc61494['passwordHistoryLimit']);return _0x400765;})[_0xd1ce('0x2b')](saveUpdates({'password':_0x333684['body'][_0xd1ce('0x8f')],'passwordResetAt':_0x333684[_0xd1ce('0x34')]['id']==_0x333684[_0xd1ce('0x60')]['id']?moment():null,'previousPasswords':authService[_0xd1ce('0x99')](_0x333684['body'][_0xd1ce('0x8f')],_0x400765[_0xd1ce('0x45')])},null));})[_0xd1ce('0x2b')](respondWithResult(_0x41f77d,null))['catch'](handleError(_0x41f77d,null));};exports[_0xd1ce('0x9a')]=function(_0x412948,_0x2dec41){var _0x32a698=_0x412948['body'][_0xd1ce('0x9b')];return db['User'][_0xd1ce('0x3b')]({'where':{'id':_0x412948['params']['id']},'attributes':['id',_0xd1ce('0x3c'),_0xd1ce('0x2c'),_0xd1ce('0x9c'),_0xd1ce('0x9d'),_0xd1ce('0x9e'),'interface']})['then'](handleEntityNotFound(_0x2dec41,null))[_0xd1ce('0x2b')](function(_0x36f009){if(_0x36f009){if(!utils[_0xd1ce('0x9f')](_0x32a698)){throw new db[(_0xd1ce('0x90'))][(_0xd1ce('0x91'))](_0xd1ce('0xa0'));}return _0x36f009[_0xd1ce('0xa1')+_['capitalize'](_0x32a698['toLowerCase']())+_0xd1ce('0xa2')](_0x412948['body'][_0xd1ce('0x63')],{'penalty':_0x412948['body'][_0xd1ce('0xa3')]||0x0})[_0xd1ce('0xa4')](function(_0x273d6f){for(var _0x9c5182=0x0;_0x9c5182<_0x412948['body'][_0xd1ce('0x63')][_0xd1ce('0x54')];_0x9c5182+=0x1){var _0x1b4cae={'UserId':Number(_0x412948[_0xd1ce('0x60')]['id'])};_0x1b4cae[_['capitalize'](_0x32a698[_0xd1ce('0xa5')]())+_0xd1ce('0xa6')]=Number(_0x412948[_0xd1ce('0x5f')][_0xd1ce('0x63')][_0x9c5182]);socket[_0xd1ce('0x2e')](_0xd1ce('0x34')+_['capitalize'](_0x32a698['toLowerCase']())+'Queue:save',_0x1b4cae);}return _0x273d6f;})[_0xd1ce('0x2b')](function(){if(_0x32a698===_0xd1ce('0xa7')){return db['VoiceQueue']['findAll']({'where':{'id':_0x412948[_0xd1ce('0x5f')][_0xd1ce('0x63')]||[]},'raw':!![],'attributes':['id',_0xd1ce('0x3c')]});}})[_0xd1ce('0x2b')](function(_0x2fad2f){var _0x44f443=_0x36f009[_0xd1ce('0x31')]({'plain':!![]});var _0x21aebb=[];if(_0x32a698===_0xd1ce('0xa7')&&_0x44f443[_0xd1ce('0x2c')]===_0xd1ce('0x2d')&&_0x44f443[_0xd1ce('0x9c')]){for(let _0x3cf6bd=0x0;_0x3cf6bd<_0x2fad2f[_0xd1ce('0x54')];_0x3cf6bd+=0x1){_0x21aebb[_0xd1ce('0x55')]({'membername':_0x44f443[_0xd1ce('0x3c')],'UserId':_0x44f443['id'],'queue_name':_0x2fad2f[_0x3cf6bd][_0xd1ce('0x3c')],'VoiceQueueId':_0x2fad2f[_0x3cf6bd]['id'],'interface':_[_0xd1ce('0x6a')](_0x44f443[_0xd1ce('0xa8')])?util[_0xd1ce('0xa9')](_0xd1ce('0xaa'),_0x44f443['name']):_0x44f443[_0xd1ce('0xa8')],'paused':_0x44f443[_0xd1ce('0x9e')]||![],'penalty':_0x412948[_0xd1ce('0x5f')][_0xd1ce('0xa3')]||0x0});}return Promise[_0xd1ce('0x5a')](_0x21aebb['map'](function(_0x288956){return db[_0xd1ce('0xab')][_0xd1ce('0xac')](_0x288956);}));}return _0x36f009;});}})[_0xd1ce('0x2b')](respondWithStatusCode(_0x2dec41,null))[_0xd1ce('0x29')](handleError(_0x2dec41,null));};exports[_0xd1ce('0xad')]=function(_0x19fbde,_0xf0eb2){var _0x6a2c4d,_0x4a6792;return db['User'][_0xd1ce('0x3b')]({'where':{'id':_0x19fbde[_0xd1ce('0x60')]['id']},'attributes':['id',_0xd1ce('0x3c'),_0xd1ce('0x2c')]})[_0xd1ce('0x2b')](handleEntityNotFound(_0xf0eb2,null))[_0xd1ce('0x2b')](function(_0x3fda95){if(_0x3fda95){_0x6a2c4d=_0x3fda95;if(!_0x19fbde[_0xd1ce('0x4b')][_0xd1ce('0x9b')]||!utils[_0xd1ce('0x9f')](_0x19fbde[_0xd1ce('0x4b')]['channel'])){throw new db[(_0xd1ce('0x90'))][(_0xd1ce('0x91'))](_0xd1ce('0xa0'));}return _0x3fda95[_0xd1ce('0xae')+_['capitalize'](_0x19fbde['query']['channel']['toLowerCase']())+_0xd1ce('0xa2')](_0x19fbde[_0xd1ce('0x4b')][_0xd1ce('0x63')]);}})['then'](function(_0x9bb81c){if(_[_0xd1ce('0xaf')](_0x19fbde[_0xd1ce('0x4b')][_0xd1ce('0x63')])){for(var _0x4ff03f=0x0;_0x4ff03f<_0x19fbde['query'][_0xd1ce('0x63')][_0xd1ce('0x54')];_0x4ff03f+=0x1){_0x4a6792={'UserId':Number(_0x19fbde[_0xd1ce('0x60')]['id'])};_0x4a6792[_[_0xd1ce('0xb0')](_0x19fbde['query']['channel']['toLowerCase']())+_0xd1ce('0xa6')]=Number(_0x19fbde[_0xd1ce('0x4b')][_0xd1ce('0x63')][_0x4ff03f]);socket[_0xd1ce('0x2e')](_0xd1ce('0x34')+_[_0xd1ce('0xb0')](_0x19fbde[_0xd1ce('0x4b')][_0xd1ce('0x9b')][_0xd1ce('0xa5')]())+_0xd1ce('0xb1'),_0x4a6792);}}else{_0x4a6792={'UserId':Number(_0x19fbde[_0xd1ce('0x60')]['id'])};_0x4a6792[_[_0xd1ce('0xb0')](_0x19fbde['query'][_0xd1ce('0x9b')][_0xd1ce('0xa5')]())+_0xd1ce('0xa6')]=Number(_0x19fbde[_0xd1ce('0x4b')][_0xd1ce('0x63')]);socket[_0xd1ce('0x2e')](_0xd1ce('0x34')+_['capitalize'](_0x19fbde[_0xd1ce('0x4b')][_0xd1ce('0x9b')][_0xd1ce('0xa5')]())+_0xd1ce('0xb1'),_0x4a6792);}return _0x9bb81c;})[_0xd1ce('0x2b')](function(){if(_0x19fbde[_0xd1ce('0x4b')][_0xd1ce('0x9b')]===_0xd1ce('0xa7')){return db[_0xd1ce('0xab')]['destroy']({'where':{'UserId':_0x19fbde[_0xd1ce('0x60')]['id'],'VoiceQueueId':_0x19fbde['query']['ids']},'individualHooks':!![]})[_0xd1ce('0x2b')](function(){return _0x6a2c4d;});}return _0x6a2c4d;})[_0xd1ce('0x2b')](respondWithStatusCode(_0xf0eb2,null))['catch'](handleError(_0xf0eb2,null));};exports[_0xd1ce('0xb2')]=function(_0x3cd060,_0x2158d4){_0x3cd060['body'][_0xd1ce('0xb3')]=_0x3cd060['file']['filename'];return db[_0xd1ce('0x40')]['find']({'where':{'id':_0x3cd060['params']['id']}})[_0xd1ce('0x2b')](handleEntityNotFound(_0x2158d4,null))[_0xd1ce('0x2b')](saveUpdates(_0x3cd060['body'],null))[_0xd1ce('0x2b')](respondWithResult(_0x2158d4,null))[_0xd1ce('0x29')](handleError(_0x2158d4,null));};exports[_0xd1ce('0xb4')]=function(_0x1580bc,_0x4aefb3){var _0x544967=path[_0xd1ce('0xb5')](config[_0xd1ce('0xb6')],'server/files/images/logos/default_profile.png');return db[_0xd1ce('0x40')][_0xd1ce('0x3b')]({'where':{'id':_0x1580bc[_0xd1ce('0x60')]['id']},'attributes':['id',_0xd1ce('0xb3')],'raw':!![]})[_0xd1ce('0x2b')](handleEntityNotFound(_0x4aefb3,null))[_0xd1ce('0x2b')](function(_0x53e696){if(_0x53e696){if(_[_0xd1ce('0x6a')](_0x53e696['userpic'])){return _0x4aefb3[_0xd1ce('0xb7')](_0x544967);}else{if(!fs['existsSync'](path[_0xd1ce('0xb5')](config[_0xd1ce('0xb6')],_0xd1ce('0xb8'),_0x53e696['userpic']))){return _0x4aefb3[_0xd1ce('0xb7')](_0x544967);}return _0x4aefb3[_0xd1ce('0xb7')](path[_0xd1ce('0xb5')](config[_0xd1ce('0xb6')],_0xd1ce('0xb8'),_0x53e696[_0xd1ce('0xb3')]));}}})[_0xd1ce('0x29')](handleError(_0x4aefb3,null));};exports['getOpenTabs']=function(_0x5874c7,_0x4875f8){return db[_0xd1ce('0x40')][_0xd1ce('0x3b')]({'where':{'id':_0x5874c7[_0xd1ce('0x60')]['id']},'attributes':['id']})[_0xd1ce('0x2b')](handleEntityNotFound(_0x4875f8,null))[_0xd1ce('0x2b')](function(_0x1ac220){var _0x5acee0=[];values=_0x1ac220['dataValues'];_0x5acee0[_0xd1ce('0x55')](get_open_tabs(_0xd1ce('0x56'),_0x1ac220[_0xd1ce('0x57')]));_0x5acee0[_0xd1ce('0x55')](get_open_tabs('sms',_0x1ac220[_0xd1ce('0x57')]));_0x5acee0[_0xd1ce('0x55')](get_open_tabs('openchannel',_0x1ac220[_0xd1ce('0x57')]));_0x5acee0[_0xd1ce('0x55')](get_open_tabs(_0xd1ce('0x59'),_0x1ac220[_0xd1ce('0x57')]));_0x5acee0['push'](get_open_tabs(_0xd1ce('0x58'),_0x1ac220[_0xd1ce('0x57')]));_0x5acee0['push'](get_open_tabs(_0xd1ce('0xb9'),_0x1ac220[_0xd1ce('0x57')]));return Promise['all'](_0x5acee0);})['then'](function(_0x96d5bb){if(_0x96d5bb){var _0x2c6ab7=_['map'](values[_0xd1ce('0xba')],function(_0x2f9260){return{'channel':_0xd1ce('0xbb'),'id':_0x2f9260['id'],'createdAt':_0x2f9260[_0xd1ce('0xbc')]};});var _0x57459c=_[_0xd1ce('0x38')](values[_0xd1ce('0xbd')],function(_0x170012){return{'channel':_0xd1ce('0xbe'),'id':_0x170012['id'],'createdAt':_0x170012['createdAt']};});var _0x4c402c=_[_0xd1ce('0x38')](values[_0xd1ce('0xbf')],function(_0x4e2fb4){return{'channel':'OPENCHANNEL','id':_0x4e2fb4['id'],'createdAt':_0x4e2fb4[_0xd1ce('0xbc')]};});var _0x5868c3=_[_0xd1ce('0x38')](values['MailOpenTabs'],function(_0x381a1b){return{'channel':_0xd1ce('0xc0'),'id':_0x381a1b['id'],'createdAt':_0x381a1b[_0xd1ce('0xbc')]};});var _0x140e12=_[_0xd1ce('0x38')](values[_0xd1ce('0xc1')],function(_0x46213a){return{'channel':_0xd1ce('0xc2'),'id':_0x46213a['id'],'createdAt':_0x46213a[_0xd1ce('0xbc')]};});var _0x46ae0f=_['map'](values[_0xd1ce('0xc3')],function(_0x48b0e3){return{'channel':_0xd1ce('0xc4'),'id':_0x48b0e3['id'],'createdAt':_0x48b0e3[_0xd1ce('0xbc')]};});var _0xa92c73=_[_0xd1ce('0xc5')](_0x2c6ab7,_0x57459c,_0x4c402c,_0x5868c3,_0x140e12,_0x46ae0f);var _0x8f8193={'count':_0xa92c73[_0xd1ce('0x54')],'rows':_0xa92c73};return _0x8f8193;}else return null;})[_0xd1ce('0x2b')](respondWithResult(_0x4875f8,null))[_0xd1ce('0x29')](handleError(_0x4875f8,null));};exports[_0xd1ce('0xc6')]=function(_0xa54604,_0x552015){var _0x475125={};return db[_0xd1ce('0x40')][_0xd1ce('0xc7')]({'where':{'id':_0xa54604[_0xd1ce('0x60')]['id']}})[_0xd1ce('0x2b')](function(_0x5136f1){if(!_0x5136f1){throw new APINotFoundError(util[_0xd1ce('0xa9')](_0xd1ce('0xc8'),_0xa54604[_0xd1ce('0x60')]['id']));}return contacts[_0xd1ce('0x61')]();})[_0xd1ce('0x2b')](function(_0x358058){_0xa54604[_0xd1ce('0x4b')][_0xd1ce('0x40')]=_0xa54604[_0xd1ce('0x60')]['id'];_0x475125=qs['getOptions'](_0x358058,_0xa54604);if(_0xa54604[_0xd1ce('0x4b')][_0xd1ce('0xc9')]('includeAll')){_0x475125[_0xd1ce('0x4d')]=[{'model':db[_0xd1ce('0xca')],'as':_0xd1ce('0xcb'),'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0xd1ce('0x3c'),_0xd1ce('0xcc')],'where':_0xa54604['query']['tag']?{'id':_0xa54604['query'][_0xd1ce('0xcd')]}:undefined,'required':_0xa54604[_0xd1ce('0x4b')][_0xd1ce('0xcd')]?!![]:![]}];}return contacts['findAll'](_0xa54604[_0xd1ce('0x4b')],_0xa54604[_0xd1ce('0x34')],_0x475125,_0x358058);})['then'](respondWithFilteredResult(_0x552015,_0x475125))[_0xd1ce('0x29')](APIHandleError(_0x552015));};exports[_0xd1ce('0xce')]=function(_0x5c6a14,_0x3596fe){var _0x315d65;var _0x79d1ac={};var _0x2f4208;return db[_0xd1ce('0x40')][_0xd1ce('0xc7')]({'where':{'id':_0x5c6a14[_0xd1ce('0x60')]['id']},'attributes':['id',_0xd1ce('0x3c'),_0xd1ce('0x2c')]})[_0xd1ce('0x2b')](handleEntityNotFound(_0x3596fe,null))[_0xd1ce('0x2b')](function(_0xba3e4c){if(!utils[_0xd1ce('0x9f')](_0x5c6a14['query'][_0xd1ce('0x9b')])){throw new db['Sequelize']['ValidationError'](_0xd1ce('0xa0'));}_0x315d65=_0xba3e4c;var _0x5b740c={};_0x5b740c['model']=_[_0xd1ce('0xcf')](db[_['capitalize'](_0x5c6a14['query'][_0xd1ce('0x9b')])+_0xd1ce('0xd0')]['rawAttributes']);_0x5b740c['query']=_[_0xd1ce('0xcf')](_0x5c6a14[_0xd1ce('0x4b')]);_0x5b740c[_0xd1ce('0xd1')]=_[_0xd1ce('0xd2')](_0x5b740c[_0xd1ce('0xd3')],_0x5b740c[_0xd1ce('0x4b')]);_0x79d1ac[_0xd1ce('0x50')]=_['intersection'](_0x5b740c[_0xd1ce('0xd3')],qs['fields'](_0x5c6a14['query']['fields']));_0x79d1ac[_0xd1ce('0x50')]=_0x79d1ac[_0xd1ce('0x50')]['length']?_0x79d1ac[_0xd1ce('0x50')]:_0x5b740c[_0xd1ce('0xd3')];_0x79d1ac[_0xd1ce('0xd4')]=qs[_0xd1ce('0xd5')](_0x5c6a14[_0xd1ce('0x4b')][_0xd1ce('0xd5')]);_0x79d1ac[_0xd1ce('0x4a')]=qs[_0xd1ce('0xd1')](_['pick'](_0x5c6a14[_0xd1ce('0x4b')],_0x5b740c['filters']));if(_0x5c6a14[_0xd1ce('0x4b')][_0xd1ce('0x37')]){_0x79d1ac['where']=_[_0xd1ce('0xd6')](_0x79d1ac[_0xd1ce('0x4a')],{'$or':_[_0xd1ce('0x38')](_0x79d1ac[_0xd1ce('0x50')],function(_0x9db00e){var _0x59f8fb={};_0x59f8fb[_0x9db00e]={'$like':'%'+_0x5c6a14[_0xd1ce('0x4b')]['filter']+'%'};return _0x59f8fb;})});}_0x79d1ac=_['merge']({},_0x79d1ac,_0x5c6a14[_0xd1ce('0x5d')]);switch(_0x315d65[_0xd1ce('0x2c')]){case _0xd1ce('0x32'):return db[_[_0xd1ce('0xb0')](_0x5c6a14['query']['channel'])+_0xd1ce('0xd0')][_0xd1ce('0x51')](_0x79d1ac);case _0xd1ce('0x34'):case _0xd1ce('0x2d'):return _0x315d65['get'+_[_0xd1ce('0xb0')](_0x5c6a14[_0xd1ce('0x4b')]['channel'])+_0xd1ce('0xa2')](_0x79d1ac);default:throw new db['Sequelize'][(_0xd1ce('0x91'))]('Unknown\x20role');}})[_0xd1ce('0x2b')](function(_0x653aa5){_0x2f4208=_0x653aa5[_0xd1ce('0x54')];if(!_0x5c6a14[_0xd1ce('0x4b')]['hasOwnProperty'](_0xd1ce('0xd7'))){_0x79d1ac[_0xd1ce('0x1c')]=qs[_0xd1ce('0x1c')](_0x5c6a14[_0xd1ce('0x4b')][_0xd1ce('0x1c')]);_0x79d1ac['offset']=qs[_0xd1ce('0x1b')](_0x5c6a14[_0xd1ce('0x4b')][_0xd1ce('0x1b')]);}switch(_0x315d65[_0xd1ce('0x2c')]){case'admin':return db[_[_0xd1ce('0xb0')](_0x5c6a14[_0xd1ce('0x4b')][_0xd1ce('0x9b')])+_0xd1ce('0xd0')][_0xd1ce('0x51')](_0x79d1ac);case _0xd1ce('0x34'):case _0xd1ce('0x2d'):return _0x315d65[_0xd1ce('0x31')+_[_0xd1ce('0xb0')](_0x5c6a14[_0xd1ce('0x4b')]['channel'])+_0xd1ce('0xa2')](_0x79d1ac);}})[_0xd1ce('0x2b')](function(_0x5cb00a){return{'count':_0x2f4208,'rows':_0x5cb00a};})[_0xd1ce('0x2b')](respondWithResult(_0x3596fe,null))[_0xd1ce('0x29')](handleError(_0x3596fe,null));};exports[_0xd1ce('0xd8')]=function(_0x589d07,_0x128676){var _0x1759a5={};var _0x77077d={};var _0x590cbd;var _0xd780c8;return db['User']['findOne']({'where':{'id':_0x589d07['params']['id']}})[_0xd1ce('0x2b')](handleEntityNotFound(_0x128676,null))['then'](function(_0x3cb8c1){if(_0x3cb8c1){_0x590cbd=_0x3cb8c1;_0x77077d['model']=_[_0xd1ce('0xcf')](db[_0xd1ce('0xab')]['rawAttributes']);_0x77077d[_0xd1ce('0x4b')]=_[_0xd1ce('0xcf')](_0x589d07[_0xd1ce('0x4b')]);_0x77077d[_0xd1ce('0xd1')]=_[_0xd1ce('0xd2')](_0x77077d[_0xd1ce('0xd3')],_0x77077d['query']);_0x1759a5[_0xd1ce('0x50')]=_[_0xd1ce('0xd2')](_0x77077d[_0xd1ce('0xd3')],qs[_0xd1ce('0xd9')](_0x589d07[_0xd1ce('0x4b')]['fields']));_0x1759a5[_0xd1ce('0x50')]=_0x1759a5[_0xd1ce('0x50')][_0xd1ce('0x54')]?_0x1759a5[_0xd1ce('0x50')]:_0x77077d[_0xd1ce('0xd3')];_0x1759a5[_0xd1ce('0xd4')]=qs[_0xd1ce('0xd5')](_0x589d07[_0xd1ce('0x4b')]['sort']);_0x1759a5[_0xd1ce('0x4a')]=qs[_0xd1ce('0xd1')](_[_0xd1ce('0xda')](_0x589d07[_0xd1ce('0x4b')],_0x77077d[_0xd1ce('0xd1')]));if(_0x589d07[_0xd1ce('0x4b')][_0xd1ce('0x37')]){_0x1759a5[_0xd1ce('0x4a')]=_['merge'](_0x1759a5[_0xd1ce('0x4a')],{'$or':_[_0xd1ce('0x38')](_0x1759a5[_0xd1ce('0x50')],function(_0x1ce25c){var _0x532200={};_0x532200[_0x1ce25c]={'$like':'%'+_0x589d07[_0xd1ce('0x4b')][_0xd1ce('0x37')]+'%'};return _0x532200;})});}_0x1759a5=_['merge']({},_0x1759a5,_0x589d07[_0xd1ce('0x5d')]);return _0x590cbd['getVoiceQueuesRt'](_0x1759a5);}})['then'](function(_0x2cce4a){if(_0x2cce4a){_0xd780c8=_0x2cce4a['length'];if(!_0x589d07['query'][_0xd1ce('0xc9')](_0xd1ce('0xd7'))){_0x1759a5[_0xd1ce('0x1c')]=qs[_0xd1ce('0x1c')](_0x589d07[_0xd1ce('0x4b')][_0xd1ce('0x1c')]);_0x1759a5[_0xd1ce('0x1b')]=qs['offset'](_0x589d07['query']['offset']);}return _0x590cbd['getVoiceQueuesRt'](_0x1759a5);}})[_0xd1ce('0x2b')](function(_0x15d9bf){if(_0x15d9bf){return _0x15d9bf?{'count':_0xd780c8,'rows':_0x15d9bf}:null;}})[_0xd1ce('0x2b')](respondWithResult(_0x128676,null))[_0xd1ce('0x29')](handleError(_0x128676,null));};exports[_0xd1ce('0xdb')]=function(_0x4a3376,_0x54d433){var _0x257dce={};var _0x231af6={};var _0x411aa7;var _0x460389;return db[_0xd1ce('0x40')][_0xd1ce('0xc7')]({'where':{'id':_0x4a3376[_0xd1ce('0x60')]['id']}})[_0xd1ce('0x2b')](handleEntityNotFound(_0x54d433,null))[_0xd1ce('0x2b')](function(_0x340b1f){if(_0x340b1f){_0x411aa7=_0x340b1f;_0x231af6['model']=_[_0xd1ce('0xcf')](db['ChatGroup'][_0xd1ce('0xdc')]);_0x231af6[_0xd1ce('0x4b')]=_[_0xd1ce('0xcf')](_0x4a3376[_0xd1ce('0x4b')]);_0x231af6[_0xd1ce('0xd1')]=_['intersection'](_0x231af6['model'],_0x231af6[_0xd1ce('0x4b')]);_0x257dce[_0xd1ce('0x50')]=_[_0xd1ce('0xd2')](_0x231af6[_0xd1ce('0xd3')],qs['fields'](_0x4a3376[_0xd1ce('0x4b')]['fields']));_0x257dce['attributes']=_0x257dce[_0xd1ce('0x50')][_0xd1ce('0x54')]?_0x257dce[_0xd1ce('0x50')]:_0x231af6[_0xd1ce('0xd3')];_0x257dce['order']=qs['sort'](_0x4a3376[_0xd1ce('0x4b')][_0xd1ce('0xd5')]);_0x257dce[_0xd1ce('0x4a')]=qs[_0xd1ce('0xd1')](_[_0xd1ce('0xda')](_0x4a3376[_0xd1ce('0x4b')],_0x231af6[_0xd1ce('0xd1')]));if(_0x4a3376[_0xd1ce('0x4b')]['filter']){_0x257dce[_0xd1ce('0x4a')]=_['merge'](_0x257dce[_0xd1ce('0x4a')],{'$or':_[_0xd1ce('0x38')](_0x257dce['attributes'],function(_0x42e16d){var _0x19fb5a={};_0x19fb5a[_0x42e16d]={'$like':'%'+_0x4a3376[_0xd1ce('0x4b')]['filter']+'%'};return _0x19fb5a;})});}_0x257dce=_[_0xd1ce('0xd6')]({},_0x257dce,_0x4a3376[_0xd1ce('0x5d')]);return _0x411aa7['getGroups'](_0x257dce);}})[_0xd1ce('0x2b')](function(_0x1fae08){if(_0x1fae08){_0x460389=_0x1fae08[_0xd1ce('0x54')];if(!_0x4a3376[_0xd1ce('0x4b')]['hasOwnProperty'](_0xd1ce('0xd7'))){_0x257dce[_0xd1ce('0x1c')]=qs[_0xd1ce('0x1c')](_0x4a3376[_0xd1ce('0x4b')]['limit']);_0x257dce['offset']=qs[_0xd1ce('0x1b')](_0x4a3376[_0xd1ce('0x4b')]['offset']);}return _0x411aa7[_0xd1ce('0xdb')](_0x257dce);}})[_0xd1ce('0x2b')](function(_0x4fac7d){if(_0x4fac7d){return _0x4fac7d?{'count':_0x460389,'rows':_0x4fac7d}:null;}})[_0xd1ce('0x2b')](respondWithResult(_0x54d433,null))[_0xd1ce('0x29')](handleError(_0x54d433,null));};exports[_0xd1ce('0xdd')]=function(_0x47767a,_0x1fbd8a){var _0x235209={'raw':!![],'where':{}};var _0x4ca0cc={};var _0x38218e={'count':0x0,'rows':[]};return db[_0xd1ce('0x40')][_0xd1ce('0xc7')]({'where':{'id':_0x47767a[_0xd1ce('0x60')]['id']}})[_0xd1ce('0x2b')](handleEntityNotFound(_0x1fbd8a,null))[_0xd1ce('0x2b')](function(_0x2f7997){if(_0x2f7997){_0x4ca0cc[_0xd1ce('0xd3')]=_[_0xd1ce('0xcf')](db[_0xd1ce('0xde')][_0xd1ce('0xdc')]);_0x4ca0cc[_0xd1ce('0x4b')]=_['keys'](_0x47767a[_0xd1ce('0x4b')]);_0x4ca0cc[_0xd1ce('0xd1')]=_['intersection'](_0x4ca0cc[_0xd1ce('0xd3')],_0x4ca0cc[_0xd1ce('0x4b')]);_0x235209[_0xd1ce('0x50')]=_[_0xd1ce('0xd2')](_0x4ca0cc[_0xd1ce('0xd3')],qs[_0xd1ce('0xd9')](_0x47767a[_0xd1ce('0x4b')][_0xd1ce('0xd9')]));_0x235209['attributes']=_0x235209[_0xd1ce('0x50')][_0xd1ce('0x54')]?_0x235209[_0xd1ce('0x50')]:_0x4ca0cc[_0xd1ce('0xd3')];if(!_0x47767a['query'][_0xd1ce('0xc9')]('nolimit')){_0x235209[_0xd1ce('0x1c')]=qs[_0xd1ce('0x1c')](_0x47767a[_0xd1ce('0x4b')][_0xd1ce('0x1c')]);_0x235209[_0xd1ce('0x1b')]=qs[_0xd1ce('0x1b')](_0x47767a[_0xd1ce('0x4b')][_0xd1ce('0x1b')]);}_0x235209['order']=qs[_0xd1ce('0xd5')](_0x47767a[_0xd1ce('0x4b')][_0xd1ce('0xd5')]);_0x235209[_0xd1ce('0x4a')]=qs[_0xd1ce('0xd1')](_[_0xd1ce('0xda')](_0x47767a['query'],_0x4ca0cc[_0xd1ce('0xd1')]));_0x235209['where'][_0xd1ce('0xdf')]=_0x2f7997['id'];if(_0x47767a[_0xd1ce('0x4b')][_0xd1ce('0x37')]){_0x235209[_0xd1ce('0x4a')]=_['merge'](_0x235209[_0xd1ce('0x4a')],{'$or':_[_0xd1ce('0x38')](_0x235209[_0xd1ce('0x50')],function(_0x126c01){var _0x3ee8b8={};_0x3ee8b8[_0x126c01]={'$like':'%'+_0x47767a['query']['filter']+'%'};return _0x3ee8b8;})});}_0x235209=_['merge']({},_0x235209,_0x47767a[_0xd1ce('0x5d')]);return db['VoiceRecording'][_0xd1ce('0x1e')]({'where':_0x235209[_0xd1ce('0x4a')]})[_0xd1ce('0x2b')](function(_0x4ded38){_0x38218e['count']=_0x4ded38;if(_0x47767a['query'][_0xd1ce('0x4c')]){_0x235209[_0xd1ce('0x4d')]=[{'all':!![]}];}return db[_0xd1ce('0xde')][_0xd1ce('0x51')](_0x235209);})['then'](function(_0x4f216f){_0x38218e[_0xd1ce('0x52')]=_0x4f216f;return _0x38218e;});}})[_0xd1ce('0x2b')](respondWithFilteredResult(_0x1fbd8a,_0x235209))[_0xd1ce('0x29')](handleError(_0x1fbd8a,null));};exports[_0xd1ce('0xe0')]=function(_0x348291,_0x3bc9d2){var _0x39c4ce={'raw':!![],'where':{}};var _0xb6ab07={};var _0x4aca30={'count':0x0,'rows':[]};return db[_0xd1ce('0x40')][_0xd1ce('0xc7')]({'where':{'id':_0x348291[_0xd1ce('0x60')]['id']}})[_0xd1ce('0x2b')](handleEntityNotFound(_0x3bc9d2,null))[_0xd1ce('0x2b')](function(_0x6a97f6){if(_0x6a97f6){_0xb6ab07['model']=_[_0xd1ce('0xcf')](db[_0xd1ce('0xe1')][_0xd1ce('0xdc')]);_0xb6ab07['query']=_[_0xd1ce('0xcf')](_0x348291[_0xd1ce('0x4b')]);_0xb6ab07[_0xd1ce('0xd1')]=_[_0xd1ce('0xd2')](_0xb6ab07[_0xd1ce('0xd3')],_0xb6ab07[_0xd1ce('0x4b')]);_0x39c4ce[_0xd1ce('0x50')]=_[_0xd1ce('0xd2')](_0xb6ab07[_0xd1ce('0xd3')],qs[_0xd1ce('0xd9')](_0x348291[_0xd1ce('0x4b')]['fields']));_0x39c4ce['attributes']=_0x39c4ce[_0xd1ce('0x50')][_0xd1ce('0x54')]?_0x39c4ce[_0xd1ce('0x50')]:_0xb6ab07[_0xd1ce('0xd3')];if(!_0x348291[_0xd1ce('0x4b')][_0xd1ce('0xc9')](_0xd1ce('0xd7'))){_0x39c4ce[_0xd1ce('0x1c')]=qs[_0xd1ce('0x1c')](_0x348291[_0xd1ce('0x4b')]['limit']);_0x39c4ce[_0xd1ce('0x1b')]=qs[_0xd1ce('0x1b')](_0x348291[_0xd1ce('0x4b')][_0xd1ce('0x1b')]);}_0x39c4ce[_0xd1ce('0xd4')]=qs[_0xd1ce('0xd5')](_0x348291[_0xd1ce('0x4b')]['sort']);_0x39c4ce[_0xd1ce('0x4a')]=qs[_0xd1ce('0xd1')](_[_0xd1ce('0xda')](_0x348291[_0xd1ce('0x4b')],_0xb6ab07[_0xd1ce('0xd1')]));_0x39c4ce['where'][_0xd1ce('0xdf')]=_0x6a97f6['id'];if(_0x348291[_0xd1ce('0x4b')]['filter']){_0x39c4ce[_0xd1ce('0x4a')]=_[_0xd1ce('0xd6')](_0x39c4ce['where'],{'$or':_[_0xd1ce('0x38')](_0x39c4ce['attributes'],function(_0x58240c){var _0x84f13d={};_0x84f13d[_0x58240c]={'$like':'%'+_0x348291[_0xd1ce('0x4b')][_0xd1ce('0x37')]+'%'};return _0x84f13d;})});}_0x39c4ce=_['merge']({},_0x39c4ce,_0x348291['options']);return db[_0xd1ce('0xe1')][_0xd1ce('0x1e')]({'where':_0x39c4ce[_0xd1ce('0x4a')]})[_0xd1ce('0x2b')](function(_0x15bab8){_0x4aca30['count']=_0x15bab8;if(_0x348291[_0xd1ce('0x4b')][_0xd1ce('0x4c')]){_0x39c4ce['include']=[{'all':!![]}];}return db['ScreenRecording'][_0xd1ce('0x51')](_0x39c4ce);})['then'](function(_0x2316fa){_0x4aca30['rows']=_0x2316fa;return _0x4aca30;});}})['then'](respondWithFilteredResult(_0x3bc9d2,_0x39c4ce))['catch'](handleError(_0x3bc9d2,null));};exports['getChatInteractions']=function(_0x41d149,_0x36cd63){var _0x464d42={};var _0x44784c={};var _0x397b42;var _0x340f4a;return db[_0xd1ce('0x40')][_0xd1ce('0xc7')]({'where':{'id':_0x41d149[_0xd1ce('0x60')]['id']}})['then'](handleEntityNotFound(_0x36cd63,null))[_0xd1ce('0x2b')](function(_0x488679){if(_0x488679){_0x397b42=_0x488679;_0x44784c[_0xd1ce('0xd3')]=_[_0xd1ce('0xcf')](db['ChatInteraction']['rawAttributes']);_0x44784c[_0xd1ce('0x4b')]=_[_0xd1ce('0xcf')](_0x41d149[_0xd1ce('0x4b')]);_0x44784c[_0xd1ce('0xd1')]=_[_0xd1ce('0xd2')](_0x44784c[_0xd1ce('0xd3')],_0x44784c[_0xd1ce('0x4b')]);_0x464d42[_0xd1ce('0x50')]=_[_0xd1ce('0xd2')](_0x44784c['model'],qs[_0xd1ce('0xd9')](_0x41d149['query'][_0xd1ce('0xd9')]));_0x464d42[_0xd1ce('0x50')]=_0x464d42[_0xd1ce('0x50')][_0xd1ce('0x54')]?_0x464d42[_0xd1ce('0x50')]:_0x44784c[_0xd1ce('0xd3')];_0x464d42['order']=qs[_0xd1ce('0xd5')](_0x41d149['query'][_0xd1ce('0xd5')]);_0x464d42[_0xd1ce('0x4a')]=qs['filters'](_[_0xd1ce('0xda')](_0x41d149[_0xd1ce('0x4b')],_0x44784c[_0xd1ce('0xd1')]));if(_0x41d149[_0xd1ce('0x4b')]['filter']){_0x464d42[_0xd1ce('0x4a')]=_[_0xd1ce('0xd6')](_0x464d42[_0xd1ce('0x4a')],{'$or':_[_0xd1ce('0x38')](_0x464d42[_0xd1ce('0x50')],function(_0x2df22b){var _0x4f3258={};_0x4f3258[_0x2df22b]={'$like':'%'+_0x41d149[_0xd1ce('0x4b')][_0xd1ce('0x37')]+'%'};return _0x4f3258;})});}_0x464d42=_[_0xd1ce('0xd6')]({},_0x464d42,_0x41d149[_0xd1ce('0x5d')]);return _0x397b42[_0xd1ce('0xe2')](_0x464d42);}})[_0xd1ce('0x2b')](function(_0x3c7645){if(_0x3c7645){_0x340f4a=_0x3c7645['length'];if(!_0x41d149[_0xd1ce('0x4b')]['hasOwnProperty'](_0xd1ce('0xd7'))){_0x464d42['limit']=qs[_0xd1ce('0x1c')](_0x41d149['query']['limit']);_0x464d42['offset']=qs[_0xd1ce('0x1b')](_0x41d149['query'][_0xd1ce('0x1b')]);}return _0x397b42[_0xd1ce('0xe2')](_0x464d42);}})[_0xd1ce('0x2b')](function(_0x36afc4){if(_0x36afc4){return _0x36afc4?{'count':_0x340f4a,'rows':_0x36afc4}:null;}})[_0xd1ce('0x2b')](respondWithResult(_0x36cd63,null))[_0xd1ce('0x29')](handleError(_0x36cd63,null));};exports[_0xd1ce('0xe3')]=function(_0x34aee5,_0x17cd49){var _0x975a53={};var _0x282716={};var _0xc6c65;var _0x4c3271;return db[_0xd1ce('0x40')][_0xd1ce('0xc7')]({'where':{'id':_0x34aee5[_0xd1ce('0x60')]['id']}})[_0xd1ce('0x2b')](handleEntityNotFound(_0x17cd49,null))[_0xd1ce('0x2b')](function(_0x10e2d2){if(_0x10e2d2){_0xc6c65=_0x10e2d2;_0x282716[_0xd1ce('0xd3')]=_[_0xd1ce('0xcf')](db[_0xd1ce('0xe4')]['rawAttributes']);_0x282716[_0xd1ce('0x4b')]=_[_0xd1ce('0xcf')](_0x34aee5[_0xd1ce('0x4b')]);_0x282716[_0xd1ce('0xd1')]=_[_0xd1ce('0xd2')](_0x282716[_0xd1ce('0xd3')],_0x282716[_0xd1ce('0x4b')]);_0x975a53[_0xd1ce('0x50')]=_[_0xd1ce('0xd2')](_0x282716[_0xd1ce('0xd3')],qs[_0xd1ce('0xd9')](_0x34aee5[_0xd1ce('0x4b')][_0xd1ce('0xd9')]));_0x975a53[_0xd1ce('0x50')]=_0x975a53[_0xd1ce('0x50')][_0xd1ce('0x54')]?_0x975a53[_0xd1ce('0x50')]:_0x282716[_0xd1ce('0xd3')];_0x975a53[_0xd1ce('0xd4')]=qs[_0xd1ce('0xd5')](_0x34aee5[_0xd1ce('0x4b')][_0xd1ce('0xd5')]);_0x975a53[_0xd1ce('0x4a')]=qs[_0xd1ce('0xd1')](_[_0xd1ce('0xda')](_0x34aee5['query'],_0x282716[_0xd1ce('0xd1')]));if(_0x34aee5[_0xd1ce('0x4b')][_0xd1ce('0x37')]){_0x975a53[_0xd1ce('0x4a')]=_[_0xd1ce('0xd6')](_0x975a53['where'],{'$or':_['map'](_0x975a53[_0xd1ce('0x50')],function(_0x279ffd){var _0x11f1d7={};_0x11f1d7[_0x279ffd]={'$like':'%'+_0x34aee5[_0xd1ce('0x4b')]['filter']+'%'};return _0x11f1d7;})});}_0x975a53=_[_0xd1ce('0xd6')]({},_0x975a53,_0x34aee5[_0xd1ce('0x5d')]);return _0xc6c65['getOpenchannelInteractions'](_0x975a53);}})['then'](function(_0x5c7b87){if(_0x5c7b87){_0x4c3271=_0x5c7b87['length'];if(!_0x34aee5[_0xd1ce('0x4b')][_0xd1ce('0xc9')]('nolimit')){_0x975a53['limit']=qs[_0xd1ce('0x1c')](_0x34aee5[_0xd1ce('0x4b')][_0xd1ce('0x1c')]);_0x975a53['offset']=qs['offset'](_0x34aee5[_0xd1ce('0x4b')]['offset']);}return _0xc6c65[_0xd1ce('0xe3')](_0x975a53);}})['then'](function(_0x357d9e){if(_0x357d9e){return _0x357d9e?{'count':_0x4c3271,'rows':_0x357d9e}:null;}})[_0xd1ce('0x2b')](respondWithResult(_0x17cd49,null))[_0xd1ce('0x29')](handleError(_0x17cd49,null));};exports['getMailInteractions']=function(_0x4f5511,_0x15921d){var _0x4c6b3a={'raw':!![],'where':{}};var _0x5692bc={};var _0x4a7147={'count':0x0,'rows':[]};return db[_0xd1ce('0x40')][_0xd1ce('0xc7')]({'where':{'id':_0x4f5511['params']['id']}})[_0xd1ce('0x2b')](handleEntityNotFound(_0x15921d,null))[_0xd1ce('0x2b')](function(_0x29170e){if(_0x29170e){_0x5692bc[_0xd1ce('0xd3')]=_[_0xd1ce('0xcf')](db[_0xd1ce('0xe5')][_0xd1ce('0xdc')]);_0x5692bc['query']=_[_0xd1ce('0xcf')](_0x4f5511[_0xd1ce('0x4b')]);_0x5692bc['filters']=_[_0xd1ce('0xd2')](_0x5692bc[_0xd1ce('0xd3')],_0x5692bc[_0xd1ce('0x4b')]);_0x4c6b3a['attributes']=_[_0xd1ce('0xd2')](_0x5692bc[_0xd1ce('0xd3')],qs['fields'](_0x4f5511['query'][_0xd1ce('0xd9')]));_0x4c6b3a['attributes']=_0x4c6b3a[_0xd1ce('0x50')][_0xd1ce('0x54')]?_0x4c6b3a[_0xd1ce('0x50')]:_0x5692bc[_0xd1ce('0xd3')];if(!_0x4f5511[_0xd1ce('0x4b')]['hasOwnProperty']('nolimit')){_0x4c6b3a[_0xd1ce('0x1c')]=qs[_0xd1ce('0x1c')](_0x4f5511[_0xd1ce('0x4b')]['limit']);_0x4c6b3a[_0xd1ce('0x1b')]=qs['offset'](_0x4f5511[_0xd1ce('0x4b')][_0xd1ce('0x1b')]);}_0x4c6b3a[_0xd1ce('0xd4')]=qs['sort'](_0x4f5511[_0xd1ce('0x4b')]['sort']);_0x4c6b3a[_0xd1ce('0x4a')]=qs['filters'](_[_0xd1ce('0xda')](_0x4f5511['query'],_0x5692bc[_0xd1ce('0xd1')]));_0x4c6b3a[_0xd1ce('0x4a')][_0xd1ce('0xdf')]=_0x29170e['id'];if(_0x4f5511[_0xd1ce('0x4b')][_0xd1ce('0x37')]){_0x4c6b3a[_0xd1ce('0x4a')]=_[_0xd1ce('0xd6')](_0x4c6b3a[_0xd1ce('0x4a')],{'$or':_['map'](_0x4c6b3a[_0xd1ce('0x50')],function(_0x24562a){var _0x436ffa={};_0x436ffa[_0x24562a]={'$like':'%'+_0x4f5511[_0xd1ce('0x4b')][_0xd1ce('0x37')]+'%'};return _0x436ffa;})});}_0x4c6b3a=_['merge']({},_0x4c6b3a,_0x4f5511[_0xd1ce('0x5d')]);return db[_0xd1ce('0xe5')]['count']({'where':_0x4c6b3a[_0xd1ce('0x4a')]})['then'](function(_0x155b84){_0x4a7147['count']=_0x155b84;if(_0x4f5511[_0xd1ce('0x4b')][_0xd1ce('0x4c')]){_0x4c6b3a[_0xd1ce('0x4d')]=[{'all':!![]}];}return db[_0xd1ce('0xe5')]['findAll'](_0x4c6b3a);})[_0xd1ce('0x2b')](function(_0x403f8c){_0x4a7147['rows']=_0x403f8c;return _0x4a7147;});}})[_0xd1ce('0x2b')](respondWithFilteredResult(_0x15921d,_0x4c6b3a))[_0xd1ce('0x29')](handleError(_0x15921d,null));};exports[_0xd1ce('0xe6')]=function(_0x2f507d,_0x11180c){var _0xe9fcb8={};var _0x5693ef={};var _0x343c24;var _0x1ae40a;return db[_0xd1ce('0x40')][_0xd1ce('0xc7')]({'where':{'id':_0x2f507d[_0xd1ce('0x60')]['id']}})[_0xd1ce('0x2b')](handleEntityNotFound(_0x11180c,null))[_0xd1ce('0x2b')](function(_0x32c3da){if(_0x32c3da){_0x343c24=_0x32c3da;_0x5693ef[_0xd1ce('0xd3')]=_['keys'](db[_0xd1ce('0xe7')]['rawAttributes']);_0x5693ef[_0xd1ce('0x4b')]=_[_0xd1ce('0xcf')](_0x2f507d[_0xd1ce('0x4b')]);_0x5693ef['filters']=_[_0xd1ce('0xd2')](_0x5693ef[_0xd1ce('0xd3')],_0x5693ef[_0xd1ce('0x4b')]);_0xe9fcb8[_0xd1ce('0x50')]=_[_0xd1ce('0xd2')](_0x5693ef['model'],qs[_0xd1ce('0xd9')](_0x2f507d[_0xd1ce('0x4b')][_0xd1ce('0xd9')]));_0xe9fcb8[_0xd1ce('0x50')]=_0xe9fcb8[_0xd1ce('0x50')]['length']?_0xe9fcb8[_0xd1ce('0x50')]:_0x5693ef[_0xd1ce('0xd3')];_0xe9fcb8[_0xd1ce('0xd4')]=qs[_0xd1ce('0xd5')](_0x2f507d[_0xd1ce('0x4b')][_0xd1ce('0xd5')]);_0xe9fcb8['where']=qs[_0xd1ce('0xd1')](_[_0xd1ce('0xda')](_0x2f507d[_0xd1ce('0x4b')],_0x5693ef[_0xd1ce('0xd1')]));if(_0x2f507d[_0xd1ce('0x4b')][_0xd1ce('0x37')]){_0xe9fcb8[_0xd1ce('0x4a')]=_['merge'](_0xe9fcb8[_0xd1ce('0x4a')],{'$or':_[_0xd1ce('0x38')](_0xe9fcb8['attributes'],function(_0x57fa30){var _0x194385={};_0x194385[_0x57fa30]={'$like':'%'+_0x2f507d['query'][_0xd1ce('0x37')]+'%'};return _0x194385;})});}_0xe9fcb8=_[_0xd1ce('0xd6')]({},_0xe9fcb8,_0x2f507d[_0xd1ce('0x5d')]);return _0x343c24[_0xd1ce('0xe6')](_0xe9fcb8);}})[_0xd1ce('0x2b')](function(_0x4cef00){if(_0x4cef00){_0x1ae40a=_0x4cef00[_0xd1ce('0x54')];if(!_0x2f507d['query']['hasOwnProperty']('nolimit')){_0xe9fcb8[_0xd1ce('0x1c')]=qs['limit'](_0x2f507d[_0xd1ce('0x4b')][_0xd1ce('0x1c')]);_0xe9fcb8[_0xd1ce('0x1b')]=qs['offset'](_0x2f507d[_0xd1ce('0x4b')][_0xd1ce('0x1b')]);}return _0x343c24[_0xd1ce('0xe6')](_0xe9fcb8);}})[_0xd1ce('0x2b')](function(_0x34a3a5){if(_0x34a3a5){return _0x34a3a5?{'count':_0x1ae40a,'rows':_0x34a3a5}:null;}})[_0xd1ce('0x2b')](respondWithResult(_0x11180c,null))[_0xd1ce('0x29')](handleError(_0x11180c,null));};exports[_0xd1ce('0xe8')]=function(_0x54e46d,_0x44c3a6){var _0x2d14fc={};var _0x286a75={};var _0x1a0572;var _0x39e474;return db[_0xd1ce('0x40')][_0xd1ce('0xc7')]({'where':{'id':_0x54e46d[_0xd1ce('0x60')]['id']}})['then'](handleEntityNotFound(_0x44c3a6,null))[_0xd1ce('0x2b')](function(_0x1cf76e){if(_0x1cf76e){_0x1a0572=_0x1cf76e;_0x286a75[_0xd1ce('0xd3')]=_[_0xd1ce('0xcf')](db[_0xd1ce('0xe9')][_0xd1ce('0xdc')]);_0x286a75[_0xd1ce('0x4b')]=_[_0xd1ce('0xcf')](_0x54e46d[_0xd1ce('0x4b')]);_0x286a75[_0xd1ce('0xd1')]=_[_0xd1ce('0xd2')](_0x286a75[_0xd1ce('0xd3')],_0x286a75[_0xd1ce('0x4b')]);_0x2d14fc['attributes']=_[_0xd1ce('0xd2')](_0x286a75[_0xd1ce('0xd3')],qs[_0xd1ce('0xd9')](_0x54e46d[_0xd1ce('0x4b')][_0xd1ce('0xd9')]));_0x2d14fc['attributes']=_0x2d14fc['attributes'][_0xd1ce('0x54')]?_0x2d14fc[_0xd1ce('0x50')]:_0x286a75[_0xd1ce('0xd3')];_0x2d14fc[_0xd1ce('0xd4')]=qs[_0xd1ce('0xd5')](_0x54e46d['query']['sort']);_0x2d14fc[_0xd1ce('0x4a')]=qs[_0xd1ce('0xd1')](_['pick'](_0x54e46d[_0xd1ce('0x4b')],_0x286a75[_0xd1ce('0xd1')]));if(_0x54e46d['query'][_0xd1ce('0x37')]){_0x2d14fc[_0xd1ce('0x4a')]=_[_0xd1ce('0xd6')](_0x2d14fc[_0xd1ce('0x4a')],{'$or':_[_0xd1ce('0x38')](_0x2d14fc[_0xd1ce('0x50')],function(_0x3cc6d0){var _0x177cd4={};_0x177cd4[_0x3cc6d0]={'$like':'%'+_0x54e46d[_0xd1ce('0x4b')][_0xd1ce('0x37')]+'%'};return _0x177cd4;})});}_0x2d14fc=_[_0xd1ce('0xd6')]({},_0x2d14fc,_0x54e46d[_0xd1ce('0x5d')]);return _0x1a0572[_0xd1ce('0xe8')](_0x2d14fc);}})[_0xd1ce('0x2b')](function(_0x4cbfbe){if(_0x4cbfbe){_0x39e474=_0x4cbfbe[_0xd1ce('0x54')];if(!_0x54e46d[_0xd1ce('0x4b')][_0xd1ce('0xc9')](_0xd1ce('0xd7'))){_0x2d14fc[_0xd1ce('0x1c')]=qs[_0xd1ce('0x1c')](_0x54e46d[_0xd1ce('0x4b')][_0xd1ce('0x1c')]);_0x2d14fc[_0xd1ce('0x1b')]=qs[_0xd1ce('0x1b')](_0x54e46d[_0xd1ce('0x4b')][_0xd1ce('0x1b')]);}return _0x1a0572['getFaxInteractions'](_0x2d14fc);}})[_0xd1ce('0x2b')](function(_0x2ebacf){if(_0x2ebacf){return _0x2ebacf?{'count':_0x39e474,'rows':_0x2ebacf}:null;}})[_0xd1ce('0x2b')](respondWithResult(_0x44c3a6,null))[_0xd1ce('0x29')](handleError(_0x44c3a6,null));};exports[_0xd1ce('0xea')]=function(_0x303b1c,_0x564e62){var _0x323bba={};var _0xd5c34e={};var _0x585112;var _0x5039b8;return db[_0xd1ce('0x40')][_0xd1ce('0xc7')]({'where':{'id':_0x303b1c[_0xd1ce('0x60')]['id']}})[_0xd1ce('0x2b')](handleEntityNotFound(_0x564e62,null))[_0xd1ce('0x2b')](function(_0x25edcb){if(_0x25edcb){_0x585112=_0x25edcb;_0xd5c34e[_0xd1ce('0xd3')]=_[_0xd1ce('0xcf')](db['WhatsappInteraction']['rawAttributes']);_0xd5c34e[_0xd1ce('0x4b')]=_['keys'](_0x303b1c['query']);_0xd5c34e['filters']=_[_0xd1ce('0xd2')](_0xd5c34e[_0xd1ce('0xd3')],_0xd5c34e[_0xd1ce('0x4b')]);_0x323bba[_0xd1ce('0x50')]=_['intersection'](_0xd5c34e[_0xd1ce('0xd3')],qs[_0xd1ce('0xd9')](_0x303b1c[_0xd1ce('0x4b')][_0xd1ce('0xd9')]));_0x323bba[_0xd1ce('0x50')]=_0x323bba[_0xd1ce('0x50')][_0xd1ce('0x54')]?_0x323bba[_0xd1ce('0x50')]:_0xd5c34e['model'];_0x323bba[_0xd1ce('0xd4')]=qs[_0xd1ce('0xd5')](_0x303b1c[_0xd1ce('0x4b')]['sort']);_0x323bba[_0xd1ce('0x4a')]=qs[_0xd1ce('0xd1')](_[_0xd1ce('0xda')](_0x303b1c[_0xd1ce('0x4b')],_0xd5c34e['filters']));if(_0x303b1c[_0xd1ce('0x4b')][_0xd1ce('0x37')]){_0x323bba['where']=_[_0xd1ce('0xd6')](_0x323bba[_0xd1ce('0x4a')],{'$or':_[_0xd1ce('0x38')](_0x323bba[_0xd1ce('0x50')],function(_0x1471ce){var _0xfc487c={};_0xfc487c[_0x1471ce]={'$like':'%'+_0x303b1c[_0xd1ce('0x4b')][_0xd1ce('0x37')]+'%'};return _0xfc487c;})});}_0x323bba=_[_0xd1ce('0xd6')]({},_0x323bba,_0x303b1c[_0xd1ce('0x5d')]);return _0x585112[_0xd1ce('0xea')](_0x323bba);}})[_0xd1ce('0x2b')](function(_0x5ce444){if(_0x5ce444){_0x5039b8=_0x5ce444[_0xd1ce('0x54')];if(!_0x303b1c[_0xd1ce('0x4b')]['hasOwnProperty'](_0xd1ce('0xd7'))){_0x323bba[_0xd1ce('0x1c')]=qs[_0xd1ce('0x1c')](_0x303b1c[_0xd1ce('0x4b')]['limit']);_0x323bba[_0xd1ce('0x1b')]=qs[_0xd1ce('0x1b')](_0x303b1c['query'][_0xd1ce('0x1b')]);}return _0x585112[_0xd1ce('0xea')](_0x323bba);}})[_0xd1ce('0x2b')](function(_0xd64af2){if(_0xd64af2){return _0xd64af2?{'count':_0x5039b8,'rows':_0xd64af2}:null;}})['then'](respondWithResult(_0x564e62,null))[_0xd1ce('0x29')](handleError(_0x564e62,null));};exports[_0xd1ce('0xeb')]=function(_0x540ff7,_0x7a67b,_0x41223d){var _0xf251f9;var _0x12877d;var _0x3b9a99;var _0x86df0a=!_['isNil'](_0x540ff7[_0xd1ce('0x60')]['id'])?_0x540ff7['params']['id']:!_[_0xd1ce('0x6a')](_0x540ff7[_0xd1ce('0x34')]['id'])?_0x540ff7[_0xd1ce('0x34')]['id']:null;return db[_0xd1ce('0x40')][_0xd1ce('0x3b')]({'where':{'id':_0x86df0a,'role':{'$or':['admin',_0xd1ce('0x34'),_0xd1ce('0x2d')]}},'attributes':['id',_0xd1ce('0x3c'),_0xd1ce('0xec'),_0xd1ce('0xed'),_0xd1ce('0x2c'),_0xd1ce('0x65'),_0xd1ce('0x9d')]})['then'](function(_0x43d8b3){if(_0x43d8b3){if(_0x43d8b3[_0xd1ce('0x2c')]===_0xd1ce('0x2d')){_0xf251f9=_0x43d8b3;if(_0x540ff7[_0xd1ce('0x5f')][_0xd1ce('0xa8')]){_0x3b9a99=util[_0xd1ce('0xa9')]('LOCAL/%s@from-sip/n',_0xf251f9[_0x540ff7[_0xd1ce('0x5f')][_0xd1ce('0xa8')]]);}else if(_0x540ff7[_0xd1ce('0x5f')]['intrf']){_0x3b9a99=util[_0xd1ce('0xa9')](_0xd1ce('0xaa'),_0x540ff7[_0xd1ce('0x5f')][_0xd1ce('0xee')]);}else{_0x3b9a99=util['format'](_0xd1ce('0xaa'),_0xf251f9[_0xd1ce('0x3c')]);}socket['to'](util[_0xd1ce('0xa9')]('user:%s',_0xf251f9[_0xd1ce('0x3c')]))[_0xd1ce('0x2e')](_0xd1ce('0xef'),{'user':{'id':_0xf251f9['id'],'name':_0xf251f9[_0xd1ce('0x3c')]},'ip':_0x540ff7['headers'][_0xd1ce('0xf0')]||_0x540ff7['connection'][_0xd1ce('0xf1')]||_0x540ff7[_0xd1ce('0xf2')]['remoteAddress']||_0x540ff7[_0xd1ce('0xf3')][_0xd1ce('0xf2')]['remoteAddress']});return new Promise(function(_0x1c0ac6,_0x50e421){db[_0xd1ce('0x6c')]['transaction']()[_0xd1ce('0x2b')](_0x20256b=>{db[_0xd1ce('0xab')][_0xd1ce('0x30')]({'where':{'membername':_0xf251f9[_0xd1ce('0x3c')]},'individualHooks':!![]},{'transaction':_0x20256b})[_0xd1ce('0x2b')](function(){return _0x20256b['commit']();})[_0xd1ce('0x2b')](_0x1c0ac6)[_0xd1ce('0x29')](_0x50e421);});});}}else{throw new db[(_0xd1ce('0x90'))][(_0xd1ce('0x91'))](_0xd1ce('0xf4'));}})[_0xd1ce('0x2b')](function(){if(_0xf251f9){return _0xf251f9['getVoiceQueues']({'raw':!![]});}})[_0xd1ce('0x2b')](function(_0x39cc8e){if(_0xf251f9){if(_0x39cc8e){_0x12877d=_0x39cc8e;if(_0x12877d[_0xd1ce('0x54')]){var _0x402449=_0x12877d['map'](function(_0x3a42a9){return{'membername':_0xf251f9[_0xd1ce('0x3c')],'UserId':_0xf251f9['id'],'queue_name':_0x3a42a9[_0xd1ce('0x3c')],'VoiceQueueId':_0x3a42a9['id'],'interface':_0x3b9a99,'paused':_0xf251f9[_0xd1ce('0x9d')]||![],'penalty':_0x3a42a9[_0xd1ce('0xf5')]||0x0};});return db[_0xd1ce('0xab')][_0xd1ce('0x87')](_0x402449);}}}})[_0xd1ce('0x2b')](function(){if(_0xf251f9){return db['MemberReport']['findAll']({'where':{'membername':_0xf251f9[_0xd1ce('0x3c')],'exitAt':null}});}})['then'](function(_0xa64211){if(_0xf251f9){var _0xf57f2c=[];_0xa64211[_0xd1ce('0xf6')](function(_0x48fdee){_0xf57f2c[_0xd1ce('0x55')](_0x48fdee['update']({'exitAt':moment()[_0xd1ce('0xa9')](_0xd1ce('0xf7'))}));});return Promise[_0xd1ce('0x5a')](_0xf57f2c);}})[_0xd1ce('0x2b')](function(){if(_0xf251f9){var _0x37004d=[];var _0x37f90c=[];var _0x94114d=utils[_0xd1ce('0xf8')]();var _0x28bd8b={'membername':_0xf251f9[_0xd1ce('0x3c')],'interface':_0x3b9a99,'enterAt':moment()[_0xd1ce('0xa9')](_0xd1ce('0xf7')),'role':_0xf251f9[_0xd1ce('0x2c')],'internal':_0xf251f9[_0xd1ce('0x65')]};_0x94114d[_0xd1ce('0xf6')](function(_0x3eb4dd){_0x37004d[_0xd1ce('0x55')](_[_0xd1ce('0xd6')]({'channel':_0x3eb4dd,'type':_0xd1ce('0xf9'),'data1':_0x540ff7[_0xd1ce('0x5f')][_0xd1ce('0xfa')],'data2':_0x3b9a99},_0x28bd8b));if(_0xf251f9['loginInPause']){_0x37f90c[_0xd1ce('0x55')](_[_0xd1ce('0xd6')]({'channel':_0x3eb4dd,'type':'PAUSE','data1':_0xd1ce('0xfb')},_0x28bd8b));}});return db[_0xd1ce('0xfc')][_0xd1ce('0x87')](_0x37004d[_0xd1ce('0xc5')](_0x37f90c),{'individualHooks':!![]});}})['then'](function(){if(_0xf251f9){return _0xf251f9['update']({'online':!![],'lastLoginAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0xf251f9[_0xd1ce('0x9d')]||![],'mailPause':_0xf251f9[_0xd1ce('0x9d')]||![],'chatPause':_0xf251f9[_0xd1ce('0x9d')]||![],'faxPause':_0xf251f9[_0xd1ce('0x9d')]||![],'smsPause':_0xf251f9[_0xd1ce('0x9d')]||![],'openchannelPause':_0xf251f9[_0xd1ce('0x9d')]||![],'whatsappPause':_0xf251f9[_0xd1ce('0x9d')]||![],'pauseType':_0xf251f9[_0xd1ce('0x9d')]?_0xd1ce('0xfb'):null,'interface':_0x3b9a99,'lastPauseAt':moment()[_0xd1ce('0xa9')](_0xd1ce('0xf7'))});}})[_0xd1ce('0x2b')](function(_0xb65c10){if(_0x540ff7[_0xd1ce('0xfd')]){return _0x41223d();}else{return Promise[_0xd1ce('0xfe')](_0xb65c10)[_0xd1ce('0x2b')](respondWithResult(_0x7a67b,null));}})[_0xd1ce('0x29')](handleError(_0x7a67b,null));};exports[_0xd1ce('0xff')]=function(_0x462f77,_0x338c02){var _0x59b6da;return db[_0xd1ce('0x40')][_0xd1ce('0x3b')]({'where':{'id':_0x462f77[_0xd1ce('0x60')]['id'],'role':_0xd1ce('0x2d')},'attributes':['id',_0xd1ce('0x3c'),'role']})[_0xd1ce('0x2b')](handleEntityNotFound(_0x338c02,null))[_0xd1ce('0x2b')](function(_0x250fc8){if(_0x250fc8){_0x59b6da=_0x250fc8;return db[_0xd1ce('0xab')]['destroy']({'where':{'membername':_0x59b6da['name']},'individualHooks':!![]});}})[_0xd1ce('0x2b')](function(){return db[_0xd1ce('0xfc')][_0xd1ce('0x51')]({'where':{'membername':_0x59b6da[_0xd1ce('0x3c')],'exitAt':null}});})[_0xd1ce('0x2b')](function(_0x3690c1){var _0x5e276b=[];_0x3690c1[_0xd1ce('0xf6')](function(_0x2c8dd8){_0x5e276b[_0xd1ce('0x55')](_0x2c8dd8[_0xd1ce('0x2a')]({'exitAt':moment()[_0xd1ce('0xa9')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0xd1ce('0x5a')](_0x5e276b);})[_0xd1ce('0x2b')](function(){return _0x59b6da[_0xd1ce('0x2a')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xd1ce('0x2b')](respondWithResult(_0x338c02,null))[_0xd1ce('0x29')](handleError(_0x338c02,null));};exports[_0xd1ce('0x100')]=function(_0x158729,_0x4ea14d){var _0x2beaf7;return db[_0xd1ce('0xab')][_0xd1ce('0x2a')]({'paused':0x1},{'where':{'UserId':_0x158729[_0xd1ce('0x60')]['id']},'individualHooks':!![]})[_0xd1ce('0x2b')](function(){return db[_0xd1ce('0x40')][_0xd1ce('0x3b')]({'where':{'id':_0x158729[_0xd1ce('0x60')]['id'],'role':_0xd1ce('0x2d')},'attributes':['id',_0xd1ce('0x3c'),_0xd1ce('0x2c'),'internal',_0xd1ce('0xa8'),'online']});})[_0xd1ce('0x2b')](handleEntityNotFound(_0x4ea14d,null))['then'](function(_0x438967){if(_0x438967){_0x2beaf7=_0x438967;return respondWithRpcPromise(_0xd1ce('0x101'),_0xd1ce('0x100'),{'id':_0x2beaf7['id'],'name':_0x2beaf7[_0xd1ce('0x3c')],'pause':!![]});}})[_0xd1ce('0x2b')](function(){if(_0x2beaf7){return db[_0xd1ce('0xfc')]['findAll']({'where':{'membername':_0x2beaf7['name'],'type':'PAUSE','exitAt':null}});}})[_0xd1ce('0x2b')](function(_0x5adeea){if(_0x5adeea[_0xd1ce('0x54')]){var _0x1cff47=moment()[_0xd1ce('0xa9')](_0xd1ce('0xf7'));for(var _0x59ef80=0x0,_0x1a26f1=_0x5adeea[_0xd1ce('0x54')];_0x59ef80<_0x1a26f1;_0x59ef80++){_0x5adeea[_0x59ef80][_0xd1ce('0x102')]({'exitAt':_0x1cff47});}}})[_0xd1ce('0x2b')](function(){var _0x5957b8=[];var _0x2d2c90=utils[_0xd1ce('0xf8')]();_0x2d2c90['forEach'](function(_0x57c560){_0x5957b8[_0xd1ce('0x55')]({'channel':_0x57c560,'membername':_0x2beaf7[_0xd1ce('0x3c')],'interface':_[_0xd1ce('0x6a')](_0x2beaf7[_0xd1ce('0xa8')])?util[_0xd1ce('0xa9')]('SIP/%s',_0x2beaf7['name']):_0x2beaf7[_0xd1ce('0xa8')],'type':_0xd1ce('0x103'),'enterAt':moment()['format'](_0xd1ce('0xf7')),'data1':_0x158729['body'][_0xd1ce('0x42')]||_0xd1ce('0x104'),'role':_0x2beaf7['role'],'internal':_0x2beaf7['internal']});});return db[_0xd1ce('0xfc')][_0xd1ce('0x87')](_0x5957b8,{'individualHooks':!![]});})['then'](function(){return _0x2beaf7[_0xd1ce('0x2a')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x158729['body'][_0xd1ce('0x42')]||_0xd1ce('0x104'),'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});})[_0xd1ce('0x2b')](respondWithResult(_0x4ea14d,null))[_0xd1ce('0x29')](handleError(_0x4ea14d,null));};exports['unpause']=function(_0x1aac9a,_0x501a77){if(_0x1aac9a[_0xd1ce('0x5f')][_0xd1ce('0x9b')]&&!utils['isValidChannel'](_0x1aac9a[_0xd1ce('0x5f')]['channel'])){throw new APIBadRequestError(util[_0xd1ce('0xa9')](_0xd1ce('0x105'),_0x1aac9a[_0xd1ce('0x5f')]['channel']));}return db[_0xd1ce('0x40')][_0xd1ce('0x3b')]({'where':{'id':_0x1aac9a[_0xd1ce('0x60')]['id']},'attributes':['id',_0xd1ce('0x3c'),_0xd1ce('0x2c'),_0xd1ce('0x65'),'interface',_0xd1ce('0x9c'),_0xd1ce('0x9e'),_0xd1ce('0x106'),_0xd1ce('0x107'),_0xd1ce('0x108'),_0xd1ce('0x109'),_0xd1ce('0x10a'),_0xd1ce('0x10b'),_0xd1ce('0x10c'),_0xd1ce('0x10d')]})[_0xd1ce('0x2b')](function(_0x1beee8){if(!_0x1beee8){throw new APINotFoundError(util['format'](_0xd1ce('0xc8'),_0x1aac9a['params']['id']));}return _0x1beee8[_0xd1ce('0x10e')](_0x1aac9a[_0xd1ce('0x5f')][_0xd1ce('0x9b')]);})[_0xd1ce('0x2b')](respondWithResult(_0x501a77,null))[_0xd1ce('0x29')](APIHandleError(_0x501a77));};exports[_0xd1ce('0x10f')]=function(_0x5c6fd1,_0xf66c80){var _0x32bd4c={};var _0x201549={};var _0x3df822;var _0xb93c2b;return db[_0xd1ce('0x40')][_0xd1ce('0xc7')]({'where':{'id':_0x5c6fd1['params']['id']}})[_0xd1ce('0x2b')](handleEntityNotFound(_0xf66c80,null))[_0xd1ce('0x2b')](function(_0x95736f){if(_0x95736f){_0x3df822=_0x95736f;_0x201549[_0xd1ce('0xd3')]=_[_0xd1ce('0xcf')](db['Team']['rawAttributes']);_0x201549['query']=_['keys'](_0x5c6fd1[_0xd1ce('0x4b')]);_0x201549[_0xd1ce('0xd1')]=_['intersection'](_0x201549[_0xd1ce('0xd3')],_0x201549[_0xd1ce('0x4b')]);_0x32bd4c[_0xd1ce('0x50')]=_['intersection'](_0x201549[_0xd1ce('0xd3')],qs['fields'](_0x5c6fd1[_0xd1ce('0x4b')][_0xd1ce('0xd9')]));_0x32bd4c[_0xd1ce('0x50')]=_0x32bd4c[_0xd1ce('0x50')][_0xd1ce('0x54')]?_0x32bd4c[_0xd1ce('0x50')]:_0x201549['model'];_0x32bd4c[_0xd1ce('0xd4')]=qs[_0xd1ce('0xd5')](_0x5c6fd1['query'][_0xd1ce('0xd5')]);_0x32bd4c[_0xd1ce('0x4a')]=qs[_0xd1ce('0xd1')](_['pick'](_0x5c6fd1[_0xd1ce('0x4b')],_0x201549[_0xd1ce('0xd1')]));if(_0x5c6fd1[_0xd1ce('0x4b')][_0xd1ce('0x37')]){_0x32bd4c[_0xd1ce('0x4a')]=_[_0xd1ce('0xd6')](_0x32bd4c[_0xd1ce('0x4a')],{'$or':_[_0xd1ce('0x38')](_0x32bd4c['attributes'],function(_0x447754){var _0x35993c={};_0x35993c[_0x447754]={'$like':'%'+_0x5c6fd1[_0xd1ce('0x4b')][_0xd1ce('0x37')]+'%'};return _0x35993c;})});}_0x32bd4c=_[_0xd1ce('0xd6')]({},_0x32bd4c,_0x5c6fd1[_0xd1ce('0x5d')]);return _0x3df822[_0xd1ce('0x10f')](_0x32bd4c);}})[_0xd1ce('0x2b')](function(_0x2c906d){if(_0x2c906d){_0xb93c2b=_0x2c906d[_0xd1ce('0x54')];if(!_0x5c6fd1[_0xd1ce('0x4b')]['hasOwnProperty'](_0xd1ce('0xd7'))){_0x32bd4c[_0xd1ce('0x1c')]=qs[_0xd1ce('0x1c')](_0x5c6fd1['query'][_0xd1ce('0x1c')]);_0x32bd4c[_0xd1ce('0x1b')]=qs[_0xd1ce('0x1b')](_0x5c6fd1['query'][_0xd1ce('0x1b')]);}return _0x3df822['getTeams'](_0x32bd4c);}})[_0xd1ce('0x2b')](function(_0x2465eb){if(_0x2465eb){return _0x2465eb?{'count':_0xb93c2b,'rows':_0x2465eb}:null;}})[_0xd1ce('0x2b')](respondWithResult(_0xf66c80,null))['catch'](handleError(_0xf66c80,null));};exports[_0xd1ce('0x110')]=function(_0x510382,_0x33fcb0){var _0x3651b5=_0x510382[_0xd1ce('0x60')]['id'];var _0x1aaad9=_0x510382[_0xd1ce('0x5f')]?_0x510382[_0xd1ce('0x5f')][_0xd1ce('0x63')]:null;var _0x46dc69=[];return Promise[_0xd1ce('0xfe')]()[_0xd1ce('0x2b')](function(){if(!_0x1aaad9)throw new APIBadRequestError('Body\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0xd1ce('0x2b')](function(){return db['User'][_0xd1ce('0xc7')]({'where':{'id':_0x3651b5}});})[_0xd1ce('0x2b')](function(_0x3ab50b){if(!_0x3ab50b)throw new APINotFoundError(util['format'](_0xd1ce('0xc8'),_0x510382[_0xd1ce('0x60')]['id']));return db[_0xd1ce('0x6c')][_0xd1ce('0x111')](function(_0x5e871e){return _0x3ab50b[_0xd1ce('0x110')](_0x1aaad9,{'transaction':_0x5e871e})['then'](function(){return db[_0xd1ce('0x112')]['findAll']({'where':{'id':{'$in':_0x1aaad9}}});})['then'](function(_0x289c54){var _0x3d191b=_[_0xd1ce('0x38')](_0x289c54,function(_0x512f4a){return _0x512f4a[_0xd1ce('0x113')]();});return Promise[_0xd1ce('0x5a')](_0x3d191b);})[_0xd1ce('0x2b')](function(_0xb1e3a1){_0x46dc69=_['flattenDeep'](_0xb1e3a1);var _0x2685b0=_['map'](_0x46dc69,function(_0x150bbf){return _0x150bbf['addAgent'](_0x3ab50b['id'],{'transaction':_0x5e871e});});return Promise[_0xd1ce('0x5a')](_0x2685b0);})[_0xd1ce('0x2b')](function(){if(!_0x3ab50b[_0xd1ce('0x9c')])return;var _0xfc8e41=_[_0xd1ce('0x37')](_0x46dc69,function(_0x82cba7){return _0x82cba7[_0xd1ce('0x114')]('channel')===_0xd1ce('0x115');});var _0x1d8b72=_['map'](_0xfc8e41,function(_0x2ee055){return db['UserVoiceQueueRt'][_0xd1ce('0xac')]({'membername':_0x3ab50b['name'],'UserId':_0x3ab50b['id'],'queue_name':_0x2ee055[_0xd1ce('0x3c')],'VoiceQueueId':_0x2ee055['id'],'interface':_[_0xd1ce('0x6a')](_0x3ab50b[_0xd1ce('0xa8')])?util[_0xd1ce('0xa9')](_0xd1ce('0xaa'),_0x3ab50b['name']):_0x3ab50b[_0xd1ce('0xa8')],'paused':_0x3ab50b[_0xd1ce('0x9e')]||![],'penalty':_0x3ab50b[_0xd1ce('0xa3')]},{'transaction':_0x5e871e});});return Promise[_0xd1ce('0x5a')](_0x1d8b72);})[_0xd1ce('0x2b')](function(){return db['TeamVoicePrefix'][_0xd1ce('0x51')]({'where':{'teamId':{'$in':_0x1aaad9}}});})['then'](function(_0x4bd0fc){var _0x17f623=_[_0xd1ce('0x38')](_0x4bd0fc,function(_0x30f8d5){return db[_0xd1ce('0x116')]['create']({'UserId':_0x3ab50b['id'],'VoicePrefixId':_0x30f8d5[_0xd1ce('0x117')]},{'transaction':_0x5e871e});});return Promise['all'](_0x17f623);});});})[_0xd1ce('0x2b')](function(){for(var _0x1052d2=0x0;_0x1052d2<_0x46dc69[_0xd1ce('0x54')];_0x1052d2++){var _0x2c1c28=_0x46dc69[_0x1052d2]['getDataValue'](_0xd1ce('0x9b'));var _0x35b479=_0x2c1c28+_0xd1ce('0xa6');socket[_0xd1ce('0x2e')](_0xd1ce('0x34')+_0x2c1c28+_0xd1ce('0x118'),{'UserId':_0x3651b5,['queueField']:_0x46dc69[_0x1052d2]['id']});}})[_0xd1ce('0x2b')](respondWithStatusCode(_0x33fcb0,null))[_0xd1ce('0x29')](APIHandleError(_0x33fcb0));};exports[_0xd1ce('0x119')]=function(_0x33c84c,_0x1bdd39){var _0x4ae26d=_0x33c84c['params']['id'];var _0x3b135=null;if(_0x33c84c[_0xd1ce('0x4b')]['ids']){_0x3b135=_['isArray'](_0x33c84c[_0xd1ce('0x4b')][_0xd1ce('0x63')])?_0x33c84c['query']['ids']:[_0x33c84c[_0xd1ce('0x4b')][_0xd1ce('0x63')]];}var _0x138a0a=[];return Promise['resolve']()[_0xd1ce('0x2b')](function(){if(!_0x3b135)throw new APIBadRequestError(_0xd1ce('0x11a'));})[_0xd1ce('0x2b')](function(){return db[_0xd1ce('0x40')][_0xd1ce('0xc7')]({'where':{'id':_0x4ae26d}});})[_0xd1ce('0x2b')](function(_0x26d50b){if(!_0x26d50b)throw new APINotFoundError(util[_0xd1ce('0xa9')](_0xd1ce('0xc8'),_0x33c84c['params']['id']));return db[_0xd1ce('0x6c')][_0xd1ce('0x111')](function(_0x5b296e){return _0x26d50b[_0xd1ce('0x119')](_0x3b135,{'transaction':_0x5b296e})[_0xd1ce('0x2b')](function(){return db[_0xd1ce('0x112')][_0xd1ce('0x51')]({'where':{'id':{'$in':_0x3b135}}});})[_0xd1ce('0x2b')](function(_0x15be85){var _0x45b48f=_[_0xd1ce('0x38')](_0x15be85,function(_0x58bcdb){return _0x58bcdb[_0xd1ce('0x113')]();});return Promise[_0xd1ce('0x5a')](_0x45b48f);})[_0xd1ce('0x2b')](function(_0x238303){_0x138a0a=_[_0xd1ce('0x11b')](_0x238303);var _0x30f23f=_[_0xd1ce('0x38')](_0x138a0a,function(_0x4a310c){return _0x4a310c['removeAgent'](_0x26d50b['id'],{'transaction':_0x5b296e});});return Promise[_0xd1ce('0x5a')](_0x30f23f);})[_0xd1ce('0x2b')](function(){if(!_0x26d50b['online'])return;var _0xcaf439=_[_0xd1ce('0x37')](_0x138a0a,function(_0x142a72){return _0x142a72[_0xd1ce('0x114')](_0xd1ce('0x9b'))===_0xd1ce('0x115');});var _0x265bd7=_[_0xd1ce('0x38')](_0xcaf439,function(_0x28f3f1){return db[_0xd1ce('0xab')][_0xd1ce('0x30')]({'where':{'VoiceQueueId':_0x28f3f1['id'],'UserId':_0x26d50b['id']},'transaction':_0x5b296e});});return Promise['all'](_0x265bd7);})[_0xd1ce('0x2b')](function(){return db['TeamVoicePrefix']['findAll']({'where':{'teamId':{'$in':_0x3b135}}});})[_0xd1ce('0x2b')](function(_0x304bbc){var _0x43e31c=_[_0xd1ce('0x38')](_0x304bbc,function(_0x389112){return db['UserVoicePrefix'][_0xd1ce('0x30')]({'where':{'UserId':_0x26d50b['id'],'VoicePrefixId':_0x389112[_0xd1ce('0x117')]}},{'transaction':_0x5b296e});});return Promise[_0xd1ce('0x5a')](_0x43e31c);});});})[_0xd1ce('0x2b')](function(){for(var _0x1d2c26=0x0;_0x1d2c26<_0x138a0a[_0xd1ce('0x54')];_0x1d2c26++){var _0x43b38e=_0x138a0a[_0x1d2c26][_0xd1ce('0x114')](_0xd1ce('0x9b'));var _0x325bfb=_0x43b38e+_0xd1ce('0xa6');socket[_0xd1ce('0x2e')](_0xd1ce('0x34')+_0x43b38e+'Queue:remove',{'UserId':_0x4ae26d,['queueField']:_0x138a0a[_0x1d2c26]['id']});}})[_0xd1ce('0x2b')](respondWithStatusCode(_0x1bdd39,null))[_0xd1ce('0x29')](APIHandleError(_0x1bdd39));};exports[_0xd1ce('0x11c')]=function(_0x40fe97,_0x433fe2){var _0x5c11bb={};var _0x263579={};var _0x1650f4;var _0x275852;return db[_0xd1ce('0x40')][_0xd1ce('0xc7')]({'where':{'id':_0x40fe97['params']['id']}})['then'](handleEntityNotFound(_0x433fe2,null))[_0xd1ce('0x2b')](function(_0x339d40){if(_0x339d40){_0x1650f4=_0x339d40;_0x263579[_0xd1ce('0xd3')]=_[_0xd1ce('0xcf')](db[_0xd1ce('0xca')]['rawAttributes']);_0x263579[_0xd1ce('0x4b')]=_[_0xd1ce('0xcf')](_0x40fe97[_0xd1ce('0x4b')]);_0x263579[_0xd1ce('0xd1')]=_['intersection'](_0x263579[_0xd1ce('0xd3')],_0x263579[_0xd1ce('0x4b')]);_0x5c11bb[_0xd1ce('0x50')]=_['intersection'](_0x263579[_0xd1ce('0xd3')],qs[_0xd1ce('0xd9')](_0x40fe97[_0xd1ce('0x4b')][_0xd1ce('0xd9')]));_0x5c11bb[_0xd1ce('0x50')]=_0x5c11bb['attributes'][_0xd1ce('0x54')]?_0x5c11bb[_0xd1ce('0x50')]:_0x263579[_0xd1ce('0xd3')];_0x5c11bb['order']=qs[_0xd1ce('0xd5')](_0x40fe97[_0xd1ce('0x4b')][_0xd1ce('0xd5')]);_0x5c11bb[_0xd1ce('0x4a')]=qs['filters'](_[_0xd1ce('0xda')](_0x40fe97['query'],_0x263579[_0xd1ce('0xd1')]));if(_0x40fe97[_0xd1ce('0x4b')][_0xd1ce('0x37')]){_0x5c11bb['where']=_[_0xd1ce('0xd6')](_0x5c11bb[_0xd1ce('0x4a')],{'$or':_[_0xd1ce('0x38')](_0x5c11bb['attributes'],function(_0xe54bb3){var _0x54c0e1={};_0x54c0e1[_0xe54bb3]={'$like':'%'+_0x40fe97[_0xd1ce('0x4b')][_0xd1ce('0x37')]+'%'};return _0x54c0e1;})});}_0x5c11bb=_['merge']({},_0x5c11bb,_0x40fe97['options']);return _0x1650f4[_0xd1ce('0x11c')](_0x5c11bb);}})[_0xd1ce('0x2b')](function(_0x50d0cf){if(_0x50d0cf){_0x275852=_0x50d0cf[_0xd1ce('0x54')];if(!_0x40fe97['query'][_0xd1ce('0xc9')](_0xd1ce('0xd7'))){_0x5c11bb[_0xd1ce('0x1c')]=qs[_0xd1ce('0x1c')](_0x40fe97[_0xd1ce('0x4b')]['limit']);_0x5c11bb['offset']=qs['offset'](_0x40fe97[_0xd1ce('0x4b')][_0xd1ce('0x1b')]);}return _0x1650f4['getLists'](_0x5c11bb);}})[_0xd1ce('0x2b')](function(_0x55caf7){if(_0x55caf7){return _0x55caf7?{'count':_0x275852,'rows':_0x55caf7}:null;}})[_0xd1ce('0x2b')](respondWithResult(_0x433fe2,null))['catch'](handleError(_0x433fe2,null));};exports['getAgents']=function(_0x2e8dfb,_0x3a98a4){var _0x12b604={};var _0x246ce2={};var _0x739364;return db[_0xd1ce('0x40')][_0xd1ce('0xc7')]({'where':{'id':_0x2e8dfb[_0xd1ce('0x60')]['id']}})[_0xd1ce('0x2b')](handleEntityNotFound(_0x3a98a4,null))[_0xd1ce('0x2b')](function(_0x1df666){if(_0x1df666){_0x739364=_0x1df666;_0x246ce2[_0xd1ce('0xd3')]=_[_0xd1ce('0xcf')](db[_0xd1ce('0x40')]['rawAttributes']);_0x246ce2[_0xd1ce('0x4b')]=_['keys'](_0x2e8dfb['query']);_0x246ce2[_0xd1ce('0xd1')]=_[_0xd1ce('0xd2')](_0x246ce2[_0xd1ce('0xd3')],_0x246ce2[_0xd1ce('0x4b')]);_0x12b604[_0xd1ce('0x50')]=_[_0xd1ce('0xd2')](_0x246ce2[_0xd1ce('0xd3')],qs['fields'](_0x2e8dfb['query'][_0xd1ce('0xd9')]));_0x12b604['attributes']=_0x12b604[_0xd1ce('0x50')][_0xd1ce('0x54')]?_0x12b604['attributes']:_0x246ce2[_0xd1ce('0xd3')];_0x12b604[_0xd1ce('0xd4')]=qs['sort'](_0x2e8dfb['query'][_0xd1ce('0xd5')]);_0x12b604[_0xd1ce('0x4a')]=qs[_0xd1ce('0xd1')](_[_0xd1ce('0xda')](_0x2e8dfb['query'],_0x246ce2[_0xd1ce('0xd1')]));if(_0x2e8dfb['query'][_0xd1ce('0x37')]){_0x12b604[_0xd1ce('0x4a')]=_['merge'](_0x12b604[_0xd1ce('0x4a')],{'$or':_[_0xd1ce('0x38')](_0x12b604['attributes'],function(_0x1a7c13){var _0x245fcd={};_0x245fcd[_0x1a7c13]={'$like':'%'+_0x2e8dfb['query'][_0xd1ce('0x37')]+'%'};return _0x245fcd;})});}_0x12b604[_0xd1ce('0xd3')]=db[_0xd1ce('0x40')];_0x12b604['as']='Agents';_0x12b604=_[_0xd1ce('0xd6')]({},_0x12b604,_0x2e8dfb[_0xd1ce('0x5d')]);return _0x739364[_0xd1ce('0x11d')]({'include':[_0x12b604]});}})[_0xd1ce('0x2b')](function(_0x32807f){if(_0x32807f){var _0xe87e55={},_0x51963d=[];for(var _0xcb9af4=0x0;_0xcb9af4<_0x32807f[_0xd1ce('0x54')];_0xcb9af4+=0x1){for(var _0x4ca98b=0x0,_0x37bf24;_0x4ca98b<_0x32807f[_0xcb9af4][_0xd1ce('0x35')][_0xd1ce('0x54')];_0x4ca98b+=0x1){_0x37bf24=_0x32807f[_0xcb9af4][_0xd1ce('0x35')][_0x4ca98b][_0xd1ce('0x31')]({'plain':!![]});_0xe87e55[_0x37bf24['id']]=_0x37bf24;}}_0xe87e55=_[_0xd1ce('0x11e')](_0xe87e55);for(var _0x330214=qs[_0xd1ce('0x1b')](_0x2e8dfb[_0xd1ce('0x4b')][_0xd1ce('0x1b')]);_0x330214<_0xe87e55['length']&&_0x51963d[_0xd1ce('0x54')]=_0x2ff896){_0x8d34aa=_0x2ff896;_0x5b31eb=0xc8;}else{_0x5b31eb=0xce;}_0x2ea094[_0x6c10('0x18')](_0x5b31eb);return _0x2ea094[_0x6c10('0x1f')](_0x6c10('0x20'),_0x3ca76e+'-'+_0x8d34aa+'/'+_0x2ff896)[_0x6c10('0x1a')](_0x1fa391);}return null;};}function respondWithRpcPromise(_0x41146b,_0x59a95e,_0x4389f5,_0x5d4335){return new Promise(function(_0x4be5ab,_0x228314){var _0x44fe97=_0x5d4335||amiClient;return _0x44fe97[_0x6c10('0x21')](_0x41146b,_0x4389f5)[_0x6c10('0x22')](function(_0x102ab7){logger[_0x6c10('0x23')](_0x6c10('0x24'),_0x59a95e,_0x6c10('0x25'));logger['debug'](_0x6c10('0x26'),_0x59a95e,'request\x20sent',JSON['stringify'](_0x102ab7));if(_0x102ab7[_0x6c10('0x27')]){if(_0x102ab7[_0x6c10('0x27')][_0x6c10('0x28')]===0x1f4){logger[_0x6c10('0x27')](_0x6c10('0x24'),_0x59a95e,_0x102ab7[_0x6c10('0x27')][_0x6c10('0x29')]);return _0x228314(_0x102ab7[_0x6c10('0x27')]['message']);}logger[_0x6c10('0x27')](_0x6c10('0x24'),_0x59a95e,_0x102ab7[_0x6c10('0x27')]['message']);return _0x4be5ab(_0x102ab7['error']['message']);}else{logger[_0x6c10('0x23')]('User,\x20%s,\x20%s',_0x59a95e,_0x6c10('0x25'));_0x4be5ab(_0x102ab7[_0x6c10('0x2a')]['message']);}})['catch'](function(_0x2cd9f6){logger[_0x6c10('0x27')](_0x6c10('0x24'),_0x59a95e,_0x2cd9f6);_0x228314(_0x2cd9f6);});});}function saveUpdates(_0x4c3334){return function(_0x21c6e3){if(_0x21c6e3){return _0x21c6e3[_0x6c10('0x2b')](_0x4c3334)['then'](function(_0x3eb037){if(_0x3eb037['role']===_0x6c10('0x2c')){socket[_0x6c10('0x2d')](_0x6c10('0x2e')+_0x3eb037['id'],_0x3eb037);}return _0x3eb037;});}return null;};}function removeEntity(_0x25c94a,_0x41ef11){return function(_0x11d9a3){if(_0x11d9a3){return _0x11d9a3[_0x6c10('0x2f')]({'transaction':_0x41ef11})['then'](function(){var _0x191ed7=_0x11d9a3[_0x6c10('0x30')]({'plain':!![]});if(_0x191ed7[_0x6c10('0x31')]===_0x6c10('0x32'))return;var _0x4464cc=[{'name':_0x6c10('0x33'),'value':_0x6c10('0x34'),'ignore':!![]},{'name':_0x6c10('0x35'),'value':_0x6c10('0x2c'),'ignore':![]},{'name':_0x6c10('0x36'),'value':_0x6c10('0x37'),'ignore':![]}];var _0x7c6a2c=_(_0x4464cc)[_0x6c10('0x38')](_0x6c10('0x39'))[_0x6c10('0x3a')](_0x6c10('0x3b'))[_0x6c10('0x3b')]();if(_['includes'](_0x7c6a2c,_0x191ed7[_0x6c10('0x31')])){return;}var _0x3b415a=_['find'](_0x4464cc,[_0x6c10('0x3b'),_0x191ed7[_0x6c10('0x31')]])[_0x6c10('0x3c')];return db[_0x6c10('0x3d')][_0x6c10('0x2f')]({'where':{'type':_0x3b415a,'resourceId':_0x191ed7['id']},'transaction':_0x41ef11})[_0x6c10('0x22')](function(){return _0x11d9a3;});})[_0x6c10('0x22')](function(){_0x25c94a[_0x6c10('0x18')](0xcc)[_0x6c10('0x19')]();});}};}function handleEntityNotFound(_0x3818f7){return function(_0x35e287){if(!_0x35e287){_0x3818f7[_0x6c10('0x17')](0x194);}return _0x35e287;};}function handleError(_0x189c0c,_0x28ee53){_0x28ee53=_0x28ee53||0x1f4;return function(_0x12a4a4){logger['error'](_0x12a4a4[_0x6c10('0x3e')]);if(_0x12a4a4['name']){delete _0x12a4a4[_0x6c10('0x3c')];}_0x189c0c[_0x6c10('0x18')](_0x28ee53)[_0x6c10('0x3f')](_0x12a4a4);};}function getUserAttributes(){return _(db[_0x6c10('0x40')][_0x6c10('0x41')])['map'](function(_0xd0ab7a){return{'name':_0xd0ab7a[_0x6c10('0x42')],'type':_0xd0ab7a[_0x6c10('0x43')][_0x6c10('0x44')]};})[_0x6c10('0x38')](function(_0x3eeee6){return![_0x6c10('0x45'),_0x6c10('0x46'),_0x6c10('0x47'),_0x6c10('0x48'),'resetPasswordExpires',_0x6c10('0x49')][_0x6c10('0x4a')](_0x3eeee6[_0x6c10('0x3c')]);})[_0x6c10('0x3b')]();}exports['index']=function(_0x341289,_0x6641f3){var _0x19f1e4={},_0x411ece={'count':0x0,'rows':[]};var _0x2e0707=getUserAttributes();_0x19f1e4=qs[_0x6c10('0x4b')](_0x2e0707,_0x341289);var _0x288906={'where':_0x19f1e4[_0x6c10('0x4c')]};return db['User']['count'](_0x288906)[_0x6c10('0x22')](function(_0x206285){_0x411ece[_0x6c10('0x1e')]=_0x206285;if(_0x341289[_0x6c10('0x4d')][_0x6c10('0x4e')]){_0x19f1e4[_0x6c10('0x4f')]=[{'all':!![]}];}if(_0x341289[_0x6c10('0x4d')][_0x6c10('0x50')]===_0x6c10('0x51')){_0x19f1e4[_0x6c10('0x4f')]=[{'model':db[_0x6c10('0x52')],'as':_0x6c10('0x50')}];}if(!_[_0x6c10('0x4a')](_0x19f1e4['attributes'],'id')){_0x19f1e4[_0x6c10('0x53')][_0x6c10('0x54')]('id');}return db['User'][_0x6c10('0x55')](_0x19f1e4);})['then'](function(_0x523bbf){_0x411ece[_0x6c10('0x56')]=_0x523bbf;if(_0x341289['query']['openTabs']===_0x6c10('0x51')){var _0x5a8a64=[];for(var _0x3a1376=0x0;_0x3a1376<_0x411ece[_0x6c10('0x56')][_0x6c10('0x57')];_0x3a1376++){_0x5a8a64[_0x6c10('0x54')](get_open_tabs(_0x6c10('0x58'),_0x411ece['rows'][_0x3a1376][_0x6c10('0x59')]));_0x5a8a64[_0x6c10('0x54')](get_open_tabs(_0x6c10('0x5a'),_0x411ece[_0x6c10('0x56')][_0x3a1376][_0x6c10('0x59')]));_0x5a8a64['push'](get_open_tabs(_0x6c10('0x5b'),_0x411ece[_0x6c10('0x56')][_0x3a1376][_0x6c10('0x59')]));_0x5a8a64[_0x6c10('0x54')](get_open_tabs(_0x6c10('0x5c'),_0x411ece[_0x6c10('0x56')][_0x3a1376]['dataValues']));_0x5a8a64[_0x6c10('0x54')](get_open_tabs(_0x6c10('0x5d'),_0x411ece[_0x6c10('0x56')][_0x3a1376][_0x6c10('0x59')]));_0x5a8a64[_0x6c10('0x54')](get_open_tabs('whatsapp',_0x411ece['rows'][_0x3a1376][_0x6c10('0x59')]));}return Promise[_0x6c10('0x5e')](_0x5a8a64)['then'](function(){return _0x411ece;});}else{return _0x411ece;}})['then'](respondWithFilteredResult(_0x6641f3,_0x19f1e4))[_0x6c10('0x5f')](handleError(_0x6641f3,null));};exports[_0x6c10('0x60')]=function(_0x5c8107,_0x2313d3){var _0xb49a5c=getUserAttributes();_0x5c8107[_0x6c10('0x4d')]['id']=_0x5c8107[_0x6c10('0x61')]['id'];var _0x3528b3=qs['getOptions'](_0xb49a5c,_0x5c8107);if(_0x5c8107[_0x6c10('0x4d')][_0x6c10('0x4e')]){_0x3528b3['include']=[{'all':!![]}];}if(_0x5c8107[_0x6c10('0x4d')][_0x6c10('0x50')]===_0x6c10('0x51')){_0x3528b3[_0x6c10('0x4f')]=[{'model':db[_0x6c10('0x52')],'as':_0x6c10('0x50')}];}_0x3528b3=_[_0x6c10('0x62')]({},_0x3528b3,_0x5c8107[_0x6c10('0x63')]);if(!_[_0x6c10('0x4a')](_0x3528b3[_0x6c10('0x53')],'id')){_0x3528b3['attributes'][_0x6c10('0x54')]('id');}return db[_0x6c10('0x40')]['find'](_0x3528b3)[_0x6c10('0x22')](handleEntityNotFound(_0x2313d3,null))['then'](function(_0x1e4801){var _0x4f93fa=[];values=_0x1e4801;if(_0x5c8107['query']['openTabs']==='true'){_0x4f93fa['push'](get_open_tabs('chat',_0x1e4801[_0x6c10('0x59')]));_0x4f93fa[_0x6c10('0x54')](get_open_tabs(_0x6c10('0x5a'),_0x1e4801[_0x6c10('0x59')]));_0x4f93fa['push'](get_open_tabs(_0x6c10('0x5d'),_0x1e4801[_0x6c10('0x59')]));_0x4f93fa[_0x6c10('0x54')](get_open_tabs('whatsapp',_0x1e4801[_0x6c10('0x59')]));_0x4f93fa[_0x6c10('0x54')](get_open_tabs(_0x6c10('0x5b'),_0x1e4801[_0x6c10('0x59')]));_0x4f93fa[_0x6c10('0x54')](get_open_tabs(_0x6c10('0x5c'),_0x1e4801[_0x6c10('0x59')]));return Promise['all'](_0x4f93fa);}else{return values;}})[_0x6c10('0x22')](function(){return values;})[_0x6c10('0x22')](respondWithResult(_0x2313d3,null))[_0x6c10('0x5f')](handleError(_0x2313d3,null));};exports['update']=function(_0x2a98ac,_0x2103c6){if(_0x2a98ac[_0x6c10('0x64')]['id']){delete _0x2a98ac[_0x6c10('0x64')]['id'];}delete _0x2a98ac[_0x6c10('0x64')][_0x6c10('0x31')];return db['User'][_0x6c10('0x65')]({'where':{'id':_0x2a98ac[_0x6c10('0x61')]['id']}})[_0x6c10('0x22')](handleEntityNotFound(_0x2103c6,null))[_0x6c10('0x22')](saveUpdates(_0x2a98ac[_0x6c10('0x64')],null))[_0x6c10('0x22')](respondWithResult(_0x2103c6,null))[_0x6c10('0x5f')](handleError(_0x2103c6,null));};exports[_0x6c10('0x66')]=function(_0x624f1d,_0x4872cb){return db[_0x6c10('0x40')]['describe']()['then'](respondWithResult(_0x4872cb,null))[_0x6c10('0x5f')](handleError(_0x4872cb,null));};exports[_0x6c10('0x67')]=function(_0x59843a,_0x462d50){return db['User']['find']({'where':{'id':_0x59843a[_0x6c10('0x61')]['id']}})['then'](handleEntityNotFound(_0x462d50,null))[_0x6c10('0x22')](function(_0x34183b){if(_0x34183b){return _0x34183b[_0x6c10('0x67')](_0x59843a[_0x6c10('0x64')][_0x6c10('0x68')],_['omit'](_0x59843a[_0x6c10('0x64')],[_0x6c10('0x68'),'id'])||{});}})[_0x6c10('0x22')](respondWithResult(_0x462d50,null))['catch'](handleError(_0x462d50,null));};function validateUser(_0x2780e0){return new Promise(function(_0x2bc5d6,_0x38b6a8){if(_0x2780e0['internal'])return _0x2bc5d6(_0x2780e0);return db[_0x6c10('0x69')]['findById'](0x1)[_0x6c10('0x22')](function(_0x56f2a1){if(_0x56f2a1[_0x6c10('0x6a')])authService['validatePasswordPattern'](_0x2780e0[_0x6c10('0x45')]);db[_0x6c10('0x40')][_0x6c10('0x6b')](_0x6c10('0x6c'))[_0x6c10('0x22')](function(_0x2b0fcb){if(_[_0x6c10('0x6d')](_0x2b0fcb)){_0x2780e0[_0x6c10('0x6c')]=_0x56f2a1[_0x6c10('0x6e')]||0x1;return;}if(_[_0x6c10('0x6d')](_0x56f2a1[_0x6c10('0x6e')])||_0x56f2a1[_0x6c10('0x6e')]===_0x2b0fcb){_0x2780e0[_0x6c10('0x6c')]=_0x2b0fcb+0x1;return;}if(_0x56f2a1[_0x6c10('0x6e')]>_0x2b0fcb){_0x2780e0[_0x6c10('0x6c')]=_0x56f2a1[_0x6c10('0x6e')];return;}return db[_0x6c10('0x6f')][_0x6c10('0x4d')]('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db['sequelize']['QueryTypes'][_0x6c10('0x70')]})[_0x6c10('0x22')](function(_0x33b167){if(_0x33b167&&_0x33b167[_0x6c10('0x57')]){for(var _0x254912=0x0,_0x5816cf=_0x33b167[_0x6c10('0x57')];_0x254912<_0x5816cf&&_[_0x6c10('0x6d')](_0x2780e0[_0x6c10('0x6c')]);_0x254912++){if(_0x56f2a1[_0x6c10('0x6e')]<=_0x33b167[_0x254912][_0x6c10('0x71')]){_0x2780e0[_0x6c10('0x6c')]=_0x33b167[_0x254912][_0x6c10('0x71')];}else if(_0x56f2a1[_0x6c10('0x6e')]>_0x33b167[_0x254912][_0x6c10('0x71')]&&_0x56f2a1[_0x6c10('0x6e')]<=_0x33b167[_0x254912]['to']){_0x2780e0[_0x6c10('0x6c')]=_0x56f2a1[_0x6c10('0x6e')];}}}if(_[_0x6c10('0x6d')](_0x2780e0['internal'])){_0x2780e0[_0x6c10('0x6c')]=_0x2b0fcb+0x1;}return _0x2bc5d6(_0x2780e0);});});})['catch'](function(_0x2034f2){_0x38b6a8(_0x2034f2);});});}function updateUser(_0x1f0c28){return new Promise(function(_0x5cb9e2,_0x7b4ccd){try{if(_0x1f0c28[_0x6c10('0x72')]){_0x1f0c28[_0x6c10('0x73')]=_0x1f0c28[_0x6c10('0x6c')];_0x1f0c28['VoiceMail']={'mailbox':_0x1f0c28[_0x6c10('0x6c')],'password':_0x1f0c28[_0x6c10('0x45')],'fullname':_0x1f0c28['fullname'],'email':_0x1f0c28[_0x6c10('0x74')]};}if(_0x1f0c28['role']===_0x6c10('0x2c')){if(!_0x1f0c28[_0x6c10('0x75')])_0x1f0c28[_0x6c10('0x75')]=[_0x6c10('0x76'),_0x6c10('0x77'),_0x6c10('0x78'),'113',_0x6c10('0x79'),'104','105','106',_0x6c10('0x7a'),_0x6c10('0x7b'),'109',_0x6c10('0x7c'),'111','114','115'];}_0x5cb9e2(_0x1f0c28);}catch(_0x48dbc6){_0x7b4ccd(_0x48dbc6);}});}exports['create']=function(_0x90b59f,_0x10f875){if(_0x90b59f[_0x6c10('0x34')][_0x6c10('0x31')]===_0x6c10('0x2c'))throw new Error(_0x6c10('0x7d'));if(_0x90b59f['body']['role']===_0x6c10('0x34')&&_0x90b59f[_0x6c10('0x34')][_0x6c10('0x31')]!==_0x6c10('0x32')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x90b59f[_0x6c10('0x64')]['role']===_0x6c10('0x32')&&_0x90b59f[_0x6c10('0x34')][_0x6c10('0x31')]!==_0x6c10('0x32')){throw new Error(_0x6c10('0x7e'));}return licenseUtil[_0x6c10('0x7f')]([_0x90b59f[_0x6c10('0x64')]])[_0x6c10('0x22')](function(){return validateUser(_0x90b59f['body']);})['then'](function(_0x191218){return updateUser(_0x191218)[_0x6c10('0x22')](function(_0xe6d03){if(_0xe6d03[_0x6c10('0x31')]===_0x6c10('0x32')){_0xe6d03['settingsEnabled']=_0x90b59f[_0x6c10('0x34')]['settingsEnabled'];delete _0xe6d03[_0x6c10('0x80')];}return _0xe6d03;});})['then'](function(_0x317cd2){return db[_0x6c10('0x40')][_0x6c10('0x81')](_0x317cd2,{'include':[{'model':db[_0x6c10('0x82')],'as':_0x6c10('0x82')}]});})[_0x6c10('0x22')](function(_0x29056a){if(_0x90b59f['body']['role']==='user')return _0x29056a;if(_0x90b59f[_0x6c10('0x34')][_0x6c10('0x31')]!==_0x6c10('0x34'))return _0x29056a;return db[_0x6c10('0x83')][_0x6c10('0x65')]({'where':{'name':_0x29056a[_0x6c10('0x31')]===_0x6c10('0x2c')?_0x6c10('0x35'):_0x6c10('0x36'),'userProfileId':_0x90b59f[_0x6c10('0x34')]['userProfileId']},'raw':!![]})[_0x6c10('0x22')](function(_0x128b7a){if(!_0x128b7a||_0x128b7a[_0x6c10('0x84')]!=0x0)return _0x29056a;return db[_0x6c10('0x3d')][_0x6c10('0x81')]({'name':_0x29056a['name'],'resourceId':_0x29056a['id'],'type':_0x128b7a[_0x6c10('0x3c')],'sectionId':_0x128b7a['id']},{})[_0x6c10('0x22')](function(){return _0x29056a;});})['catch'](function(_0x3cb4fe){logger['error'](_0x6c10('0x85'),_0x3cb4fe);throw _0x3cb4fe;});})[_0x6c10('0x22')](respondWithResult(_0x10f875,0xc9))[_0x6c10('0x5f')](handleError(_0x10f875,null));};exports['bulkCreate']=function(_0x248232,_0x45fef9){var _0x713e3c=_0x248232[_0x6c10('0x64')];var _0x3deba7=[];if(_0x248232[_0x6c10('0x34')][_0x6c10('0x31')]===_0x6c10('0x2c'))throw new Error(_0x6c10('0x7d'));if(_[_0x6c10('0x86')](_0x713e3c,[_0x6c10('0x31'),_0x6c10('0x34')])&&_0x248232['user'][_0x6c10('0x31')]!==_0x6c10('0x32')){throw new Error(_0x6c10('0x87'));}if(_['some'](_0x713e3c,[_0x6c10('0x31'),_0x6c10('0x32')])&&_0x248232[_0x6c10('0x34')][_0x6c10('0x31')]!==_0x6c10('0x32')){throw new Error(_0x6c10('0x88'));}return licenseUtil['checkUserLimits'](_0x713e3c)[_0x6c10('0x22')](function(){return validateUser(_0x713e3c[0x0]);})[_0x6c10('0x22')](function(){for(var _0x5e203e=0x1;_0x5e203e<_0x713e3c['length'];_0x5e203e++){var _0x336978=_0x713e3c[_0x5e203e-0x1][_0x6c10('0x6c')];if(!_0x713e3c[_0x5e203e][_0x6c10('0x6c')])_0x713e3c[_0x5e203e]['internal']=_0x336978+0x1;_0x3deba7[_0x6c10('0x54')](validateUser(_0x713e3c[_0x5e203e]));}return Promise[_0x6c10('0x5e')](_0x3deba7);})['then'](function(){_0x3deba7=[];for(var _0x283aa2=0x0;_0x283aa2<_0x713e3c[_0x6c10('0x57')];_0x283aa2++){_0x3deba7['push'](updateUser(_0x713e3c[_0x283aa2]));}return Promise[_0x6c10('0x5e')](_0x3deba7);})['then'](function(){_0x3deba7=_0x713e3c[_0x6c10('0x3a')](function(_0x40684f){return db[_0x6c10('0x40')][_0x6c10('0x81')](_0x40684f,{'include':[{'model':db['VoiceMail'],'as':_0x6c10('0x82')}]})['then'](function(_0x508f1e){_0x40684f['id']=_0x508f1e['id'];return _0x40684f;});});return Promise['all'](_0x3deba7);})[_0x6c10('0x22')](function(_0x3d6cb5){if(_0x248232[_0x6c10('0x64')][_0x6c10('0x31')]===_0x6c10('0x34'))return _0x3d6cb5;if(_0x248232[_0x6c10('0x34')][_0x6c10('0x31')]!==_0x6c10('0x34'))return _0x3d6cb5;var _0x15a3e1=_[_0x6c10('0x86')](_0x3d6cb5,function(_0x4afd32){return _0x4afd32[_0x6c10('0x31')]===_0x6c10('0x2c')||_0x4afd32['role']===_0x6c10('0x37');});if(!_0x15a3e1)return _0x3d6cb5;return db[_0x6c10('0x83')]['findAll']({'where':{'name':{'$or':[_0x6c10('0x35'),_0x6c10('0x36')]},'userProfileId':_0x248232[_0x6c10('0x34')][_0x6c10('0x80')]},'raw':!![]})[_0x6c10('0x22')](function(_0x46cf8f){if(_['isEmpty'](_0x46cf8f)||!_['some'](_0x46cf8f,[_0x6c10('0x84'),0x0]))return _0x3d6cb5;_0x3deba7=[];var _0x13b5b3=_(_0x46cf8f)[_0x6c10('0x3a')](function(_0x939b10){if(_0x939b10[_0x6c10('0x84')]===0x1)return;return _0x939b10[_0x6c10('0x3c')]===_0x6c10('0x35')?'agent':_0x6c10('0x37');})[_0x6c10('0x89')]()[_0x6c10('0x3b')]();for(var _0x12260f=0x0;_0x12260f<_0x3d6cb5['length'];_0x12260f++){if(!_[_0x6c10('0x4a')](_0x13b5b3,_0x3d6cb5[_0x12260f]['role']))return;var _0x5813b4=_0x3d6cb5[_0x12260f][_0x6c10('0x31')]===_0x6c10('0x2c')?'Agents':'Telephones';_0x3deba7[_0x6c10('0x54')](db[_0x6c10('0x3d')]['create']({'name':_0x3d6cb5[_0x12260f]['name'],'resourceId':_0x3d6cb5[_0x12260f]['id'],'type':_0x5813b4,'sectionId':_[_0x6c10('0x65')](_0x46cf8f,['name',_0x5813b4])['id']},{}));}return Promise[_0x6c10('0x5e')](_0x3deba7);});})[_0x6c10('0x22')](respondWithResult(_0x45fef9,0xc9))['catch'](handleError(_0x45fef9,null));};exports[_0x6c10('0x8a')]=function(_0x48f445,_0x174fa1){if(_0x48f445['body']['id']){delete _0x48f445['body']['id'];}return db[_0x6c10('0x40')][_0x6c10('0x65')]({'where':{'id':_0x48f445[_0x6c10('0x61')]['id']}})[_0x6c10('0x22')](function(_0x3a7a59){if(!_0x3a7a59)return null;if(_0x3a7a59['id']===_0x48f445[_0x6c10('0x34')]['id']){if(!_0x48f445[_0x6c10('0x64')][_0x6c10('0x8b')]||!_0x48f445[_0x6c10('0x64')][_0x6c10('0x8c')]){throw new db['Sequelize'][(_0x6c10('0x8d'))](_0x6c10('0x8e'));}if(!_0x3a7a59['authenticate'](_0x48f445[_0x6c10('0x64')]['oldPassword'])){throw new db['Sequelize'][(_0x6c10('0x8d'))](_0x6c10('0x8f'));}if(_0x48f445['body'][_0x6c10('0x8b')]===_0x48f445['body'][_0x6c10('0x8c')]){throw new db[(_0x6c10('0x90'))][(_0x6c10('0x8d'))](_0x6c10('0x91'));}}else if(_0x48f445['user'][_0x6c10('0x31')]===_0x6c10('0x32')){if(!_0x48f445[_0x6c10('0x64')]['newPassword']){throw new db[(_0x6c10('0x90'))]['ValidationError'](_0x6c10('0x92'));}}else if(_0x48f445[_0x6c10('0x34')][_0x6c10('0x31')]===_0x6c10('0x34')){if(!_0x48f445['body']['newPassword']){throw new db[(_0x6c10('0x90'))][(_0x6c10('0x8d'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x3a7a59['role']!==_0x6c10('0x2c')){throw new db[(_0x6c10('0x90'))][(_0x6c10('0x8d'))](_0x6c10('0x7d'));}}else{throw new db[(_0x6c10('0x90'))][(_0x6c10('0x8d'))](_0x6c10('0x7d'));}return _0x3a7a59;})[_0x6c10('0x22')](handleEntityNotFound(_0x174fa1,null))['then'](function(_0x4e9142){return db[_0x6c10('0x69')]['findOne']({'attributes':['id',_0x6c10('0x6a'),_0x6c10('0x93'),_0x6c10('0x94')]})[_0x6c10('0x22')](function(_0x4dee8d){if(_0x4dee8d[_0x6c10('0x6a')])authService[_0x6c10('0x95')](_0x48f445[_0x6c10('0x64')][_0x6c10('0x8c')]);if(!_0x4dee8d['enforcePasswordHistory']||!_0x4e9142[_0x6c10('0x47')])return _0x4e9142;authService[_0x6c10('0x96')](_0x48f445['body'][_0x6c10('0x8c')],_0x4e9142['previousPasswords'],_0x4dee8d['passwordHistoryLimit']);return _0x4e9142;})[_0x6c10('0x22')](saveUpdates({'password':_0x48f445[_0x6c10('0x64')][_0x6c10('0x8c')],'passwordResetAt':_0x48f445[_0x6c10('0x34')]['id']==_0x48f445['params']['id']?moment():null,'previousPasswords':authService[_0x6c10('0x97')](_0x48f445['body']['newPassword'],_0x4e9142[_0x6c10('0x47')])},null));})[_0x6c10('0x22')](respondWithResult(_0x174fa1,null))['catch'](handleError(_0x174fa1,null));};exports['addQueues']=function(_0x4e8fef,_0x528410){var _0x3eca88=_0x4e8fef[_0x6c10('0x64')][_0x6c10('0x98')];return db['User']['find']({'where':{'id':_0x4e8fef[_0x6c10('0x61')]['id']},'attributes':['id',_0x6c10('0x3c'),'role',_0x6c10('0x99'),'loginInPause',_0x6c10('0x9a'),_0x6c10('0x9b')]})[_0x6c10('0x22')](handleEntityNotFound(_0x528410,null))[_0x6c10('0x22')](function(_0x333c73){if(_0x333c73){if(!utils[_0x6c10('0x9c')](_0x3eca88)){throw new db[(_0x6c10('0x90'))]['ValidationError'](_0x6c10('0x9d'));}return _0x333c73[_0x6c10('0x9e')+_[_0x6c10('0x9f')](_0x3eca88[_0x6c10('0xa0')]())+_0x6c10('0xa1')](_0x4e8fef['body'][_0x6c10('0x68')],{'penalty':_0x4e8fef['body'][_0x6c10('0xa2')]||0x0})[_0x6c10('0xa3')](function(_0x51c207){for(var _0x49668a=0x0;_0x49668a<_0x4e8fef[_0x6c10('0x64')][_0x6c10('0x68')][_0x6c10('0x57')];_0x49668a+=0x1){var _0x275e2f={'UserId':Number(_0x4e8fef[_0x6c10('0x61')]['id'])};_0x275e2f[_[_0x6c10('0x9f')](_0x3eca88[_0x6c10('0xa0')]())+_0x6c10('0xa4')]=Number(_0x4e8fef['body']['ids'][_0x49668a]);socket[_0x6c10('0x2d')](_0x6c10('0x34')+_['capitalize'](_0x3eca88['toLowerCase']())+_0x6c10('0xa5'),_0x275e2f);}return _0x51c207;})[_0x6c10('0x22')](function(){if(_0x3eca88==='voice'){return db['VoiceQueue'][_0x6c10('0x55')]({'where':{'id':_0x4e8fef[_0x6c10('0x64')][_0x6c10('0x68')]||[]},'raw':!![],'attributes':['id','name']});}})[_0x6c10('0x22')](function(_0x25442d){var _0x32321e=_0x333c73[_0x6c10('0x30')]({'plain':!![]});var _0x2742f4=[];if(_0x3eca88==='voice'&&_0x32321e[_0x6c10('0x31')]===_0x6c10('0x2c')&&_0x32321e['online']){for(let _0x133e14=0x0;_0x133e14<_0x25442d['length'];_0x133e14+=0x1){_0x2742f4[_0x6c10('0x54')]({'membername':_0x32321e[_0x6c10('0x3c')],'UserId':_0x32321e['id'],'queue_name':_0x25442d[_0x133e14][_0x6c10('0x3c')],'VoiceQueueId':_0x25442d[_0x133e14]['id'],'interface':_[_0x6c10('0x6d')](_0x32321e[_0x6c10('0x9b')])?util[_0x6c10('0xa6')]('SIP/%s',_0x32321e[_0x6c10('0x3c')]):_0x32321e[_0x6c10('0x9b')],'paused':_0x32321e['voicePause']||![],'penalty':_0x4e8fef[_0x6c10('0x64')]['penalty']||0x0});}return Promise[_0x6c10('0x5e')](_0x2742f4[_0x6c10('0x3a')](function(_0x250f62){return db['UserVoiceQueueRt'][_0x6c10('0xa7')](_0x250f62);}));}return _0x333c73;});}})['then'](respondWithStatusCode(_0x528410,null))['catch'](handleError(_0x528410,null));};exports['removeQueues']=function(_0x18449b,_0x384e4e){var _0x408c83,_0x6ca022;return db[_0x6c10('0x40')]['find']({'where':{'id':_0x18449b[_0x6c10('0x61')]['id']},'attributes':['id',_0x6c10('0x3c'),'role']})[_0x6c10('0x22')](handleEntityNotFound(_0x384e4e,null))[_0x6c10('0x22')](function(_0x380bbd){if(_0x380bbd){_0x408c83=_0x380bbd;if(!_0x18449b[_0x6c10('0x4d')][_0x6c10('0x98')]||!utils[_0x6c10('0x9c')](_0x18449b[_0x6c10('0x4d')]['channel'])){throw new db['Sequelize'][(_0x6c10('0x8d'))](_0x6c10('0x9d'));}return _0x380bbd[_0x6c10('0xa8')+_[_0x6c10('0x9f')](_0x18449b[_0x6c10('0x4d')]['channel']['toLowerCase']())+'Queues'](_0x18449b[_0x6c10('0x4d')]['ids']);}})[_0x6c10('0x22')](function(_0x3050b6){if(_[_0x6c10('0xa9')](_0x18449b[_0x6c10('0x4d')][_0x6c10('0x68')])){for(var _0x46246c=0x0;_0x46246c<_0x18449b[_0x6c10('0x4d')][_0x6c10('0x68')]['length'];_0x46246c+=0x1){_0x6ca022={'UserId':Number(_0x18449b[_0x6c10('0x61')]['id'])};_0x6ca022[_[_0x6c10('0x9f')](_0x18449b[_0x6c10('0x4d')][_0x6c10('0x98')][_0x6c10('0xa0')]())+_0x6c10('0xa4')]=Number(_0x18449b[_0x6c10('0x4d')]['ids'][_0x46246c]);socket[_0x6c10('0x2d')]('user'+_['capitalize'](_0x18449b[_0x6c10('0x4d')][_0x6c10('0x98')][_0x6c10('0xa0')]())+_0x6c10('0xaa'),_0x6ca022);}}else{_0x6ca022={'UserId':Number(_0x18449b['params']['id'])};_0x6ca022[_['capitalize'](_0x18449b[_0x6c10('0x4d')][_0x6c10('0x98')][_0x6c10('0xa0')]())+'QueueId']=Number(_0x18449b[_0x6c10('0x4d')][_0x6c10('0x68')]);socket[_0x6c10('0x2d')]('user'+_[_0x6c10('0x9f')](_0x18449b[_0x6c10('0x4d')][_0x6c10('0x98')]['toLowerCase']())+_0x6c10('0xaa'),_0x6ca022);}return _0x3050b6;})[_0x6c10('0x22')](function(){if(_0x18449b[_0x6c10('0x4d')][_0x6c10('0x98')]==='voice'){return db[_0x6c10('0xab')][_0x6c10('0x2f')]({'where':{'UserId':_0x18449b[_0x6c10('0x61')]['id'],'VoiceQueueId':_0x18449b['query'][_0x6c10('0x68')]},'individualHooks':!![]})[_0x6c10('0x22')](function(){return _0x408c83;});}return _0x408c83;})[_0x6c10('0x22')](respondWithStatusCode(_0x384e4e,null))[_0x6c10('0x5f')](handleError(_0x384e4e,null));};exports['addAvatar']=function(_0x31f5c7,_0x2c55fb){_0x31f5c7[_0x6c10('0x64')][_0x6c10('0xac')]=_0x31f5c7['file'][_0x6c10('0xad')];return db[_0x6c10('0x40')][_0x6c10('0x65')]({'where':{'id':_0x31f5c7[_0x6c10('0x61')]['id']}})[_0x6c10('0x22')](handleEntityNotFound(_0x2c55fb,null))[_0x6c10('0x22')](saveUpdates(_0x31f5c7[_0x6c10('0x64')],null))[_0x6c10('0x22')](respondWithResult(_0x2c55fb,null))[_0x6c10('0x5f')](handleError(_0x2c55fb,null));};exports[_0x6c10('0xae')]=function(_0x4762de,_0x26fce6){var _0x1e0853=path['join'](config['root'],'server/files/images/logos/default_profile.png');return db['User'][_0x6c10('0x65')]({'where':{'id':_0x4762de['params']['id']},'attributes':['id','userpic'],'raw':!![]})[_0x6c10('0x22')](handleEntityNotFound(_0x26fce6,null))['then'](function(_0x5ee2b7){if(_0x5ee2b7){if(_['isNil'](_0x5ee2b7[_0x6c10('0xac')])){return _0x26fce6['download'](_0x1e0853);}else{if(!fs[_0x6c10('0xaf')](path[_0x6c10('0xb0')](config[_0x6c10('0xb1')],_0x6c10('0xb2'),_0x5ee2b7[_0x6c10('0xac')]))){return _0x26fce6['download'](_0x1e0853);}return _0x26fce6[_0x6c10('0xb3')](path[_0x6c10('0xb0')](config[_0x6c10('0xb1')],_0x6c10('0xb2'),_0x5ee2b7[_0x6c10('0xac')]));}}})['catch'](handleError(_0x26fce6,null));};exports[_0x6c10('0xb4')]=function(_0x50513b,_0x5d45e0){return db[_0x6c10('0x40')][_0x6c10('0x65')]({'where':{'id':_0x50513b[_0x6c10('0x61')]['id']},'attributes':['id']})[_0x6c10('0x22')](handleEntityNotFound(_0x5d45e0,null))[_0x6c10('0x22')](function(_0x2b10d8){var _0x135c37=[];values=_0x2b10d8[_0x6c10('0x59')];_0x135c37[_0x6c10('0x54')](get_open_tabs(_0x6c10('0x58'),_0x2b10d8[_0x6c10('0x59')]));_0x135c37[_0x6c10('0x54')](get_open_tabs(_0x6c10('0x5a'),_0x2b10d8[_0x6c10('0x59')]));_0x135c37[_0x6c10('0x54')](get_open_tabs(_0x6c10('0x5d'),_0x2b10d8[_0x6c10('0x59')]));_0x135c37[_0x6c10('0x54')](get_open_tabs(_0x6c10('0xb5'),_0x2b10d8[_0x6c10('0x59')]));_0x135c37['push'](get_open_tabs(_0x6c10('0x5b'),_0x2b10d8['dataValues']));_0x135c37['push'](get_open_tabs(_0x6c10('0x5c'),_0x2b10d8['dataValues']));return Promise[_0x6c10('0x5e')](_0x135c37);})['then'](function(_0x3d04cc){if(_0x3d04cc){var _0x400ee3=_[_0x6c10('0x3a')](values[_0x6c10('0xb6')],function(_0x102126){return{'channel':'CHAT','id':_0x102126['id'],'createdAt':_0x102126[_0x6c10('0xb7')]};});var _0x361f53=_[_0x6c10('0x3a')](values[_0x6c10('0xb8')],function(_0x24acd6){return{'channel':_0x6c10('0xb9'),'id':_0x24acd6['id'],'createdAt':_0x24acd6['createdAt']};});var _0x1d3d33=_[_0x6c10('0x3a')](values['OpenchannelOpenTabs'],function(_0x11f48c){return{'channel':_0x6c10('0xba'),'id':_0x11f48c['id'],'createdAt':_0x11f48c[_0x6c10('0xb7')]};});var _0x549422=_[_0x6c10('0x3a')](values['MailOpenTabs'],function(_0x184c76){return{'channel':_0x6c10('0xbb'),'id':_0x184c76['id'],'createdAt':_0x184c76['createdAt']};});var _0x53c271=_[_0x6c10('0x3a')](values[_0x6c10('0xbc')],function(_0x53a607){return{'channel':_0x6c10('0xbd'),'id':_0x53a607['id'],'createdAt':_0x53a607[_0x6c10('0xb7')]};});var _0x4fbc3a=_['map'](values[_0x6c10('0xbe')],function(_0x2c68aa){return{'channel':_0x6c10('0xbf'),'id':_0x2c68aa['id'],'createdAt':_0x2c68aa[_0x6c10('0xb7')]};});var _0x4b1b1a=_[_0x6c10('0xc0')](_0x400ee3,_0x361f53,_0x1d3d33,_0x549422,_0x53c271,_0x4fbc3a);var _0x1dd0d3={'count':_0x4b1b1a[_0x6c10('0x57')],'rows':_0x4b1b1a};return _0x1dd0d3;}else return null;})[_0x6c10('0x22')](respondWithResult(_0x5d45e0,null))[_0x6c10('0x5f')](handleError(_0x5d45e0,null));};exports[_0x6c10('0xc1')]=function(_0x3596bb,_0x436ec5){var _0x46a65d={};return db[_0x6c10('0x40')][_0x6c10('0xc2')]({'where':{'id':_0x3596bb[_0x6c10('0x61')]['id']}})[_0x6c10('0x22')](function(_0x1d347e){if(!_0x1d347e){throw new APINotFoundError(util[_0x6c10('0xa6')](_0x6c10('0xc3'),_0x3596bb[_0x6c10('0x61')]['id']));}return contacts[_0x6c10('0x66')]();})[_0x6c10('0x22')](function(_0x2e8c85){_0x3596bb[_0x6c10('0x4d')][_0x6c10('0x40')]=_0x3596bb[_0x6c10('0x61')]['id'];_0x46a65d=qs[_0x6c10('0x4b')](_0x2e8c85,_0x3596bb);if(_0x3596bb['query'][_0x6c10('0xc4')](_0x6c10('0x4e'))){_0x46a65d[_0x6c10('0x4f')]=[{'model':db[_0x6c10('0xc5')],'as':'List','required':![]},{'model':db[_0x6c10('0xc6')],'as':_0x6c10('0xc7'),'attributes':['id',_0x6c10('0x3c'),_0x6c10('0xc8')],'where':_0x3596bb[_0x6c10('0x4d')][_0x6c10('0xc9')]?{'id':_0x3596bb[_0x6c10('0x4d')]['tag']}:undefined,'required':_0x3596bb[_0x6c10('0x4d')][_0x6c10('0xc9')]?!![]:![]}];}return contacts[_0x6c10('0x55')](_0x3596bb[_0x6c10('0x4d')],_0x3596bb[_0x6c10('0x34')],_0x46a65d,_0x2e8c85);})[_0x6c10('0x22')](respondWithFilteredResult(_0x436ec5,_0x46a65d))[_0x6c10('0x5f')](APIHandleError(_0x436ec5));};exports['getQueues']=function(_0x341c16,_0x581994){var _0x2d3b42;var _0x2c4f9a={};var _0x468306;return db[_0x6c10('0x40')][_0x6c10('0xc2')]({'where':{'id':_0x341c16['params']['id']},'attributes':['id',_0x6c10('0x3c'),_0x6c10('0x31')]})[_0x6c10('0x22')](handleEntityNotFound(_0x581994,null))[_0x6c10('0x22')](function(_0x32902c){if(!utils[_0x6c10('0x9c')](_0x341c16[_0x6c10('0x4d')][_0x6c10('0x98')])){throw new db[(_0x6c10('0x90'))][(_0x6c10('0x8d'))]('Unknown\x20channel');}_0x2d3b42=_0x32902c;var _0x45db34={};_0x45db34[_0x6c10('0xca')]=_[_0x6c10('0xcb')](db[_['capitalize'](_0x341c16[_0x6c10('0x4d')][_0x6c10('0x98')])+_0x6c10('0xcc')][_0x6c10('0x41')]);_0x45db34['query']=_[_0x6c10('0xcb')](_0x341c16[_0x6c10('0x4d')]);_0x45db34[_0x6c10('0xcd')]=_[_0x6c10('0xce')](_0x45db34[_0x6c10('0xca')],_0x45db34[_0x6c10('0x4d')]);_0x2c4f9a[_0x6c10('0x53')]=_['intersection'](_0x45db34['model'],qs[_0x6c10('0xcf')](_0x341c16['query'][_0x6c10('0xcf')]));_0x2c4f9a[_0x6c10('0x53')]=_0x2c4f9a[_0x6c10('0x53')][_0x6c10('0x57')]?_0x2c4f9a[_0x6c10('0x53')]:_0x45db34[_0x6c10('0xca')];_0x2c4f9a[_0x6c10('0xd0')]=qs[_0x6c10('0xd1')](_0x341c16[_0x6c10('0x4d')]['sort']);_0x2c4f9a[_0x6c10('0x4c')]=qs[_0x6c10('0xcd')](_['pick'](_0x341c16[_0x6c10('0x4d')],_0x45db34[_0x6c10('0xcd')]));if(_0x341c16[_0x6c10('0x4d')][_0x6c10('0x38')]){_0x2c4f9a['where']=_[_0x6c10('0x62')](_0x2c4f9a[_0x6c10('0x4c')],{'$or':_[_0x6c10('0x3a')](_0x2c4f9a[_0x6c10('0x53')],function(_0x5673f4){var _0x379643={};_0x379643[_0x5673f4]={'$like':'%'+_0x341c16[_0x6c10('0x4d')][_0x6c10('0x38')]+'%'};return _0x379643;})});}_0x2c4f9a=_[_0x6c10('0x62')]({},_0x2c4f9a,_0x341c16[_0x6c10('0x63')]);switch(_0x2d3b42['role']){case'admin':return db[_[_0x6c10('0x9f')](_0x341c16[_0x6c10('0x4d')][_0x6c10('0x98')])+_0x6c10('0xcc')][_0x6c10('0x55')](_0x2c4f9a);case'user':case _0x6c10('0x2c'):return _0x2d3b42[_0x6c10('0x30')+_['capitalize'](_0x341c16[_0x6c10('0x4d')][_0x6c10('0x98')])+_0x6c10('0xa1')](_0x2c4f9a);default:throw new db['Sequelize'][(_0x6c10('0x8d'))](_0x6c10('0xd2'));}})[_0x6c10('0x22')](function(_0x469260){_0x468306=_0x469260[_0x6c10('0x57')];if(!_0x341c16[_0x6c10('0x4d')][_0x6c10('0xc4')](_0x6c10('0xd3'))){_0x2c4f9a[_0x6c10('0x1d')]=qs[_0x6c10('0x1d')](_0x341c16[_0x6c10('0x4d')][_0x6c10('0x1d')]);_0x2c4f9a[_0x6c10('0x1b')]=qs[_0x6c10('0x1b')](_0x341c16[_0x6c10('0x4d')][_0x6c10('0x1b')]);}switch(_0x2d3b42[_0x6c10('0x31')]){case'admin':return db[_[_0x6c10('0x9f')](_0x341c16[_0x6c10('0x4d')][_0x6c10('0x98')])+_0x6c10('0xcc')][_0x6c10('0x55')](_0x2c4f9a);case _0x6c10('0x34'):case _0x6c10('0x2c'):return _0x2d3b42['get'+_[_0x6c10('0x9f')](_0x341c16[_0x6c10('0x4d')]['channel'])+_0x6c10('0xa1')](_0x2c4f9a);}})['then'](function(_0x350ba8){return{'count':_0x468306,'rows':_0x350ba8};})[_0x6c10('0x22')](respondWithResult(_0x581994,null))['catch'](handleError(_0x581994,null));};exports[_0x6c10('0xd4')]=function(_0xe3ba50,_0x3aa02d){var _0x54094a={};var _0x55e7d3={};var _0xc9190e;var _0x17f34b;return db[_0x6c10('0x40')][_0x6c10('0xc2')]({'where':{'id':_0xe3ba50[_0x6c10('0x61')]['id']}})[_0x6c10('0x22')](handleEntityNotFound(_0x3aa02d,null))[_0x6c10('0x22')](function(_0x58c4ee){if(_0x58c4ee){_0xc9190e=_0x58c4ee;_0x55e7d3[_0x6c10('0xca')]=_[_0x6c10('0xcb')](db[_0x6c10('0xab')]['rawAttributes']);_0x55e7d3[_0x6c10('0x4d')]=_['keys'](_0xe3ba50[_0x6c10('0x4d')]);_0x55e7d3[_0x6c10('0xcd')]=_['intersection'](_0x55e7d3[_0x6c10('0xca')],_0x55e7d3['query']);_0x54094a[_0x6c10('0x53')]=_[_0x6c10('0xce')](_0x55e7d3['model'],qs['fields'](_0xe3ba50['query'][_0x6c10('0xcf')]));_0x54094a[_0x6c10('0x53')]=_0x54094a['attributes'][_0x6c10('0x57')]?_0x54094a[_0x6c10('0x53')]:_0x55e7d3[_0x6c10('0xca')];_0x54094a['order']=qs['sort'](_0xe3ba50['query']['sort']);_0x54094a[_0x6c10('0x4c')]=qs[_0x6c10('0xcd')](_['pick'](_0xe3ba50[_0x6c10('0x4d')],_0x55e7d3['filters']));if(_0xe3ba50[_0x6c10('0x4d')]['filter']){_0x54094a['where']=_[_0x6c10('0x62')](_0x54094a['where'],{'$or':_[_0x6c10('0x3a')](_0x54094a[_0x6c10('0x53')],function(_0x2789fc){var _0x44dbc2={};_0x44dbc2[_0x2789fc]={'$like':'%'+_0xe3ba50[_0x6c10('0x4d')][_0x6c10('0x38')]+'%'};return _0x44dbc2;})});}_0x54094a=_[_0x6c10('0x62')]({},_0x54094a,_0xe3ba50[_0x6c10('0x63')]);return _0xc9190e[_0x6c10('0xd4')](_0x54094a);}})['then'](function(_0x559445){if(_0x559445){_0x17f34b=_0x559445['length'];if(!_0xe3ba50['query'][_0x6c10('0xc4')]('nolimit')){_0x54094a['limit']=qs[_0x6c10('0x1d')](_0xe3ba50['query'][_0x6c10('0x1d')]);_0x54094a[_0x6c10('0x1b')]=qs[_0x6c10('0x1b')](_0xe3ba50[_0x6c10('0x4d')][_0x6c10('0x1b')]);}return _0xc9190e[_0x6c10('0xd4')](_0x54094a);}})[_0x6c10('0x22')](function(_0x2ba9a5){if(_0x2ba9a5){return _0x2ba9a5?{'count':_0x17f34b,'rows':_0x2ba9a5}:null;}})['then'](respondWithResult(_0x3aa02d,null))[_0x6c10('0x5f')](handleError(_0x3aa02d,null));};exports[_0x6c10('0xd5')]=function(_0x338721,_0x2dbe59){var _0x475d88={};var _0x3bfe53={};var _0x47934a;var _0x284bc1;return db[_0x6c10('0x40')][_0x6c10('0xc2')]({'where':{'id':_0x338721[_0x6c10('0x61')]['id']}})['then'](handleEntityNotFound(_0x2dbe59,null))[_0x6c10('0x22')](function(_0x1b0d0c){if(_0x1b0d0c){_0x47934a=_0x1b0d0c;_0x3bfe53[_0x6c10('0xca')]=_['keys'](db[_0x6c10('0xd6')][_0x6c10('0x41')]);_0x3bfe53[_0x6c10('0x4d')]=_[_0x6c10('0xcb')](_0x338721[_0x6c10('0x4d')]);_0x3bfe53['filters']=_[_0x6c10('0xce')](_0x3bfe53['model'],_0x3bfe53[_0x6c10('0x4d')]);_0x475d88[_0x6c10('0x53')]=_[_0x6c10('0xce')](_0x3bfe53['model'],qs['fields'](_0x338721[_0x6c10('0x4d')][_0x6c10('0xcf')]));_0x475d88['attributes']=_0x475d88[_0x6c10('0x53')][_0x6c10('0x57')]?_0x475d88['attributes']:_0x3bfe53[_0x6c10('0xca')];_0x475d88[_0x6c10('0xd0')]=qs[_0x6c10('0xd1')](_0x338721[_0x6c10('0x4d')][_0x6c10('0xd1')]);_0x475d88[_0x6c10('0x4c')]=qs['filters'](_[_0x6c10('0xd7')](_0x338721['query'],_0x3bfe53[_0x6c10('0xcd')]));if(_0x338721[_0x6c10('0x4d')][_0x6c10('0x38')]){_0x475d88[_0x6c10('0x4c')]=_['merge'](_0x475d88['where'],{'$or':_['map'](_0x475d88['attributes'],function(_0x56acb0){var _0x1c58d9={};_0x1c58d9[_0x56acb0]={'$like':'%'+_0x338721[_0x6c10('0x4d')][_0x6c10('0x38')]+'%'};return _0x1c58d9;})});}_0x475d88=_[_0x6c10('0x62')]({},_0x475d88,_0x338721['options']);return _0x47934a[_0x6c10('0xd5')](_0x475d88);}})[_0x6c10('0x22')](function(_0x237db0){if(_0x237db0){_0x284bc1=_0x237db0['length'];if(!_0x338721[_0x6c10('0x4d')]['hasOwnProperty'](_0x6c10('0xd3'))){_0x475d88[_0x6c10('0x1d')]=qs[_0x6c10('0x1d')](_0x338721[_0x6c10('0x4d')][_0x6c10('0x1d')]);_0x475d88[_0x6c10('0x1b')]=qs[_0x6c10('0x1b')](_0x338721['query'][_0x6c10('0x1b')]);}return _0x47934a[_0x6c10('0xd5')](_0x475d88);}})[_0x6c10('0x22')](function(_0x1e2ea8){if(_0x1e2ea8){return _0x1e2ea8?{'count':_0x284bc1,'rows':_0x1e2ea8}:null;}})['then'](respondWithResult(_0x2dbe59,null))['catch'](handleError(_0x2dbe59,null));};exports[_0x6c10('0xd8')]=function(_0x2d1026,_0x2831ee){var _0x46f4e3={'raw':!![],'where':{}};var _0x1e6852={};var _0x186a31={'count':0x0,'rows':[]};return db[_0x6c10('0x40')][_0x6c10('0xc2')]({'where':{'id':_0x2d1026[_0x6c10('0x61')]['id']}})[_0x6c10('0x22')](handleEntityNotFound(_0x2831ee,null))['then'](function(_0xbf1d88){if(_0xbf1d88){_0x1e6852['model']=_[_0x6c10('0xcb')](db[_0x6c10('0xd9')][_0x6c10('0x41')]);_0x1e6852['query']=_[_0x6c10('0xcb')](_0x2d1026[_0x6c10('0x4d')]);_0x1e6852[_0x6c10('0xcd')]=_[_0x6c10('0xce')](_0x1e6852[_0x6c10('0xca')],_0x1e6852[_0x6c10('0x4d')]);_0x46f4e3['attributes']=_[_0x6c10('0xce')](_0x1e6852[_0x6c10('0xca')],qs[_0x6c10('0xcf')](_0x2d1026['query'][_0x6c10('0xcf')]));_0x46f4e3['attributes']=_0x46f4e3[_0x6c10('0x53')]['length']?_0x46f4e3[_0x6c10('0x53')]:_0x1e6852[_0x6c10('0xca')];if(!_0x2d1026[_0x6c10('0x4d')][_0x6c10('0xc4')](_0x6c10('0xd3'))){_0x46f4e3[_0x6c10('0x1d')]=qs[_0x6c10('0x1d')](_0x2d1026[_0x6c10('0x4d')][_0x6c10('0x1d')]);_0x46f4e3[_0x6c10('0x1b')]=qs[_0x6c10('0x1b')](_0x2d1026[_0x6c10('0x4d')][_0x6c10('0x1b')]);}_0x46f4e3[_0x6c10('0xd0')]=qs['sort'](_0x2d1026['query'][_0x6c10('0xd1')]);_0x46f4e3[_0x6c10('0x4c')]=qs[_0x6c10('0xcd')](_[_0x6c10('0xd7')](_0x2d1026[_0x6c10('0x4d')],_0x1e6852[_0x6c10('0xcd')]));_0x46f4e3[_0x6c10('0x4c')][_0x6c10('0xda')]=_0xbf1d88['id'];if(_0x2d1026['query'][_0x6c10('0x38')]){_0x46f4e3[_0x6c10('0x4c')]=_[_0x6c10('0x62')](_0x46f4e3[_0x6c10('0x4c')],{'$or':_[_0x6c10('0x3a')](_0x46f4e3[_0x6c10('0x53')],function(_0x2990c0){var _0x28089d={};_0x28089d[_0x2990c0]={'$like':'%'+_0x2d1026[_0x6c10('0x4d')][_0x6c10('0x38')]+'%'};return _0x28089d;})});}_0x46f4e3=_['merge']({},_0x46f4e3,_0x2d1026[_0x6c10('0x63')]);return db[_0x6c10('0xd9')][_0x6c10('0x1e')]({'where':_0x46f4e3[_0x6c10('0x4c')]})[_0x6c10('0x22')](function(_0x17c05e){_0x186a31['count']=_0x17c05e;if(_0x2d1026['query'][_0x6c10('0x4e')]){_0x46f4e3[_0x6c10('0x4f')]=[{'all':!![]}];}return db[_0x6c10('0xd9')][_0x6c10('0x55')](_0x46f4e3);})['then'](function(_0x103eea){_0x186a31[_0x6c10('0x56')]=_0x103eea;return _0x186a31;});}})[_0x6c10('0x22')](respondWithFilteredResult(_0x2831ee,_0x46f4e3))[_0x6c10('0x5f')](handleError(_0x2831ee,null));};exports[_0x6c10('0xdb')]=function(_0xc4b789,_0xef2a0){var _0x47b44d={'raw':!![],'where':{}};var _0x333195={};var _0x4f2ecc={'count':0x0,'rows':[]};return db['User'][_0x6c10('0xc2')]({'where':{'id':_0xc4b789['params']['id']}})['then'](handleEntityNotFound(_0xef2a0,null))[_0x6c10('0x22')](function(_0x147fe5){if(_0x147fe5){_0x333195[_0x6c10('0xca')]=_['keys'](db[_0x6c10('0xdc')]['rawAttributes']);_0x333195[_0x6c10('0x4d')]=_['keys'](_0xc4b789[_0x6c10('0x4d')]);_0x333195['filters']=_['intersection'](_0x333195[_0x6c10('0xca')],_0x333195['query']);_0x47b44d[_0x6c10('0x53')]=_['intersection'](_0x333195[_0x6c10('0xca')],qs['fields'](_0xc4b789[_0x6c10('0x4d')][_0x6c10('0xcf')]));_0x47b44d[_0x6c10('0x53')]=_0x47b44d[_0x6c10('0x53')]['length']?_0x47b44d[_0x6c10('0x53')]:_0x333195['model'];if(!_0xc4b789[_0x6c10('0x4d')][_0x6c10('0xc4')](_0x6c10('0xd3'))){_0x47b44d[_0x6c10('0x1d')]=qs[_0x6c10('0x1d')](_0xc4b789['query'][_0x6c10('0x1d')]);_0x47b44d['offset']=qs[_0x6c10('0x1b')](_0xc4b789[_0x6c10('0x4d')][_0x6c10('0x1b')]);}_0x47b44d[_0x6c10('0xd0')]=qs[_0x6c10('0xd1')](_0xc4b789[_0x6c10('0x4d')]['sort']);_0x47b44d[_0x6c10('0x4c')]=qs[_0x6c10('0xcd')](_[_0x6c10('0xd7')](_0xc4b789[_0x6c10('0x4d')],_0x333195[_0x6c10('0xcd')]));_0x47b44d['where'][_0x6c10('0xda')]=_0x147fe5['id'];if(_0xc4b789[_0x6c10('0x4d')]['filter']){_0x47b44d[_0x6c10('0x4c')]=_[_0x6c10('0x62')](_0x47b44d[_0x6c10('0x4c')],{'$or':_[_0x6c10('0x3a')](_0x47b44d[_0x6c10('0x53')],function(_0x238a2e){var _0xd744f4={};_0xd744f4[_0x238a2e]={'$like':'%'+_0xc4b789[_0x6c10('0x4d')][_0x6c10('0x38')]+'%'};return _0xd744f4;})});}_0x47b44d=_[_0x6c10('0x62')]({},_0x47b44d,_0xc4b789['options']);return db['ScreenRecording'][_0x6c10('0x1e')]({'where':_0x47b44d[_0x6c10('0x4c')]})[_0x6c10('0x22')](function(_0x3105a1){_0x4f2ecc[_0x6c10('0x1e')]=_0x3105a1;if(_0xc4b789[_0x6c10('0x4d')][_0x6c10('0x4e')]){_0x47b44d['include']=[{'all':!![]}];}return db[_0x6c10('0xdc')][_0x6c10('0x55')](_0x47b44d);})[_0x6c10('0x22')](function(_0x69d565){_0x4f2ecc[_0x6c10('0x56')]=_0x69d565;return _0x4f2ecc;});}})['then'](respondWithFilteredResult(_0xef2a0,_0x47b44d))[_0x6c10('0x5f')](handleError(_0xef2a0,null));};exports['getChatInteractions']=function(_0x1e8d83,_0x36c02c){var _0x28afb6={};var _0x1c5a05={};var _0xb4fc6f;var _0x599096;return db['User'][_0x6c10('0xc2')]({'where':{'id':_0x1e8d83['params']['id']}})[_0x6c10('0x22')](handleEntityNotFound(_0x36c02c,null))[_0x6c10('0x22')](function(_0x27d2f5){if(_0x27d2f5){_0xb4fc6f=_0x27d2f5;_0x1c5a05['model']=_[_0x6c10('0xcb')](db['ChatInteraction'][_0x6c10('0x41')]);_0x1c5a05[_0x6c10('0x4d')]=_[_0x6c10('0xcb')](_0x1e8d83['query']);_0x1c5a05[_0x6c10('0xcd')]=_[_0x6c10('0xce')](_0x1c5a05[_0x6c10('0xca')],_0x1c5a05[_0x6c10('0x4d')]);_0x28afb6[_0x6c10('0x53')]=_['intersection'](_0x1c5a05[_0x6c10('0xca')],qs[_0x6c10('0xcf')](_0x1e8d83[_0x6c10('0x4d')]['fields']));_0x28afb6[_0x6c10('0x53')]=_0x28afb6[_0x6c10('0x53')]['length']?_0x28afb6[_0x6c10('0x53')]:_0x1c5a05[_0x6c10('0xca')];_0x28afb6[_0x6c10('0xd0')]=qs[_0x6c10('0xd1')](_0x1e8d83[_0x6c10('0x4d')][_0x6c10('0xd1')]);_0x28afb6[_0x6c10('0x4c')]=qs[_0x6c10('0xcd')](_['pick'](_0x1e8d83['query'],_0x1c5a05[_0x6c10('0xcd')]));if(_0x1e8d83['query'][_0x6c10('0x38')]){_0x28afb6['where']=_['merge'](_0x28afb6[_0x6c10('0x4c')],{'$or':_['map'](_0x28afb6[_0x6c10('0x53')],function(_0x4a688b){var _0x50ed5b={};_0x50ed5b[_0x4a688b]={'$like':'%'+_0x1e8d83[_0x6c10('0x4d')]['filter']+'%'};return _0x50ed5b;})});}_0x28afb6=_[_0x6c10('0x62')]({},_0x28afb6,_0x1e8d83[_0x6c10('0x63')]);return _0xb4fc6f[_0x6c10('0xdd')](_0x28afb6);}})[_0x6c10('0x22')](function(_0x28d04d){if(_0x28d04d){_0x599096=_0x28d04d[_0x6c10('0x57')];if(!_0x1e8d83[_0x6c10('0x4d')][_0x6c10('0xc4')](_0x6c10('0xd3'))){_0x28afb6[_0x6c10('0x1d')]=qs[_0x6c10('0x1d')](_0x1e8d83[_0x6c10('0x4d')][_0x6c10('0x1d')]);_0x28afb6['offset']=qs[_0x6c10('0x1b')](_0x1e8d83['query']['offset']);}return _0xb4fc6f[_0x6c10('0xdd')](_0x28afb6);}})[_0x6c10('0x22')](function(_0x2f544f){if(_0x2f544f){return _0x2f544f?{'count':_0x599096,'rows':_0x2f544f}:null;}})[_0x6c10('0x22')](respondWithResult(_0x36c02c,null))['catch'](handleError(_0x36c02c,null));};exports['getOpenchannelInteractions']=function(_0x4772a6,_0x271147){var _0x29d1c8={};var _0x2e41b0={};var _0x1ed6c6;var _0x43b5c8;return db[_0x6c10('0x40')]['findOne']({'where':{'id':_0x4772a6[_0x6c10('0x61')]['id']}})[_0x6c10('0x22')](handleEntityNotFound(_0x271147,null))['then'](function(_0x352255){if(_0x352255){_0x1ed6c6=_0x352255;_0x2e41b0[_0x6c10('0xca')]=_['keys'](db[_0x6c10('0xde')][_0x6c10('0x41')]);_0x2e41b0[_0x6c10('0x4d')]=_[_0x6c10('0xcb')](_0x4772a6['query']);_0x2e41b0[_0x6c10('0xcd')]=_['intersection'](_0x2e41b0['model'],_0x2e41b0[_0x6c10('0x4d')]);_0x29d1c8[_0x6c10('0x53')]=_[_0x6c10('0xce')](_0x2e41b0['model'],qs['fields'](_0x4772a6[_0x6c10('0x4d')][_0x6c10('0xcf')]));_0x29d1c8[_0x6c10('0x53')]=_0x29d1c8[_0x6c10('0x53')][_0x6c10('0x57')]?_0x29d1c8['attributes']:_0x2e41b0['model'];_0x29d1c8[_0x6c10('0xd0')]=qs['sort'](_0x4772a6[_0x6c10('0x4d')][_0x6c10('0xd1')]);_0x29d1c8[_0x6c10('0x4c')]=qs[_0x6c10('0xcd')](_[_0x6c10('0xd7')](_0x4772a6[_0x6c10('0x4d')],_0x2e41b0['filters']));if(_0x4772a6[_0x6c10('0x4d')][_0x6c10('0x38')]){_0x29d1c8[_0x6c10('0x4c')]=_[_0x6c10('0x62')](_0x29d1c8['where'],{'$or':_[_0x6c10('0x3a')](_0x29d1c8[_0x6c10('0x53')],function(_0x4e248c){var _0x4b25e5={};_0x4b25e5[_0x4e248c]={'$like':'%'+_0x4772a6[_0x6c10('0x4d')][_0x6c10('0x38')]+'%'};return _0x4b25e5;})});}_0x29d1c8=_[_0x6c10('0x62')]({},_0x29d1c8,_0x4772a6[_0x6c10('0x63')]);return _0x1ed6c6[_0x6c10('0xdf')](_0x29d1c8);}})[_0x6c10('0x22')](function(_0x128cb7){if(_0x128cb7){_0x43b5c8=_0x128cb7[_0x6c10('0x57')];if(!_0x4772a6['query']['hasOwnProperty'](_0x6c10('0xd3'))){_0x29d1c8[_0x6c10('0x1d')]=qs[_0x6c10('0x1d')](_0x4772a6['query'][_0x6c10('0x1d')]);_0x29d1c8['offset']=qs[_0x6c10('0x1b')](_0x4772a6[_0x6c10('0x4d')][_0x6c10('0x1b')]);}return _0x1ed6c6[_0x6c10('0xdf')](_0x29d1c8);}})[_0x6c10('0x22')](function(_0x93a65){if(_0x93a65){return _0x93a65?{'count':_0x43b5c8,'rows':_0x93a65}:null;}})['then'](respondWithResult(_0x271147,null))[_0x6c10('0x5f')](handleError(_0x271147,null));};exports['getMailInteractions']=function(_0x368587,_0x3a5575){var _0x55e972={'raw':!![],'where':{}};var _0x3c9f48={};var _0xe70482={'count':0x0,'rows':[]};return db['User'][_0x6c10('0xc2')]({'where':{'id':_0x368587[_0x6c10('0x61')]['id']}})[_0x6c10('0x22')](handleEntityNotFound(_0x3a5575,null))[_0x6c10('0x22')](function(_0x3b8d20){if(_0x3b8d20){_0x3c9f48[_0x6c10('0xca')]=_[_0x6c10('0xcb')](db['MailInteraction'][_0x6c10('0x41')]);_0x3c9f48[_0x6c10('0x4d')]=_['keys'](_0x368587['query']);_0x3c9f48[_0x6c10('0xcd')]=_['intersection'](_0x3c9f48[_0x6c10('0xca')],_0x3c9f48[_0x6c10('0x4d')]);_0x55e972[_0x6c10('0x53')]=_[_0x6c10('0xce')](_0x3c9f48['model'],qs[_0x6c10('0xcf')](_0x368587[_0x6c10('0x4d')][_0x6c10('0xcf')]));_0x55e972[_0x6c10('0x53')]=_0x55e972['attributes'][_0x6c10('0x57')]?_0x55e972[_0x6c10('0x53')]:_0x3c9f48[_0x6c10('0xca')];if(!_0x368587['query'][_0x6c10('0xc4')]('nolimit')){_0x55e972[_0x6c10('0x1d')]=qs[_0x6c10('0x1d')](_0x368587[_0x6c10('0x4d')][_0x6c10('0x1d')]);_0x55e972[_0x6c10('0x1b')]=qs[_0x6c10('0x1b')](_0x368587[_0x6c10('0x4d')][_0x6c10('0x1b')]);}_0x55e972['order']=qs[_0x6c10('0xd1')](_0x368587[_0x6c10('0x4d')]['sort']);_0x55e972[_0x6c10('0x4c')]=qs[_0x6c10('0xcd')](_[_0x6c10('0xd7')](_0x368587['query'],_0x3c9f48[_0x6c10('0xcd')]));_0x55e972[_0x6c10('0x4c')]['UserId']=_0x3b8d20['id'];if(_0x368587[_0x6c10('0x4d')][_0x6c10('0x38')]){_0x55e972[_0x6c10('0x4c')]=_[_0x6c10('0x62')](_0x55e972['where'],{'$or':_['map'](_0x55e972[_0x6c10('0x53')],function(_0x2c5d86){var _0x4452cb={};_0x4452cb[_0x2c5d86]={'$like':'%'+_0x368587['query'][_0x6c10('0x38')]+'%'};return _0x4452cb;})});}_0x55e972=_[_0x6c10('0x62')]({},_0x55e972,_0x368587[_0x6c10('0x63')]);return db[_0x6c10('0xe0')][_0x6c10('0x1e')]({'where':_0x55e972[_0x6c10('0x4c')]})[_0x6c10('0x22')](function(_0x17f33b){_0xe70482[_0x6c10('0x1e')]=_0x17f33b;if(_0x368587[_0x6c10('0x4d')][_0x6c10('0x4e')]){_0x55e972[_0x6c10('0x4f')]=[{'all':!![]}];}return db['MailInteraction'][_0x6c10('0x55')](_0x55e972);})[_0x6c10('0x22')](function(_0x264fd9){_0xe70482[_0x6c10('0x56')]=_0x264fd9;return _0xe70482;});}})['then'](respondWithFilteredResult(_0x3a5575,_0x55e972))[_0x6c10('0x5f')](handleError(_0x3a5575,null));};exports[_0x6c10('0xe1')]=function(_0x539ea0,_0x4add99){var _0x40521f={};var _0x470b99={};var _0x4cf1c5;var _0x6ad0;return db[_0x6c10('0x40')]['findOne']({'where':{'id':_0x539ea0[_0x6c10('0x61')]['id']}})[_0x6c10('0x22')](handleEntityNotFound(_0x4add99,null))[_0x6c10('0x22')](function(_0x599ec9){if(_0x599ec9){_0x4cf1c5=_0x599ec9;_0x470b99[_0x6c10('0xca')]=_[_0x6c10('0xcb')](db[_0x6c10('0xe2')][_0x6c10('0x41')]);_0x470b99[_0x6c10('0x4d')]=_['keys'](_0x539ea0[_0x6c10('0x4d')]);_0x470b99[_0x6c10('0xcd')]=_[_0x6c10('0xce')](_0x470b99['model'],_0x470b99['query']);_0x40521f['attributes']=_['intersection'](_0x470b99[_0x6c10('0xca')],qs['fields'](_0x539ea0['query'][_0x6c10('0xcf')]));_0x40521f[_0x6c10('0x53')]=_0x40521f['attributes']['length']?_0x40521f[_0x6c10('0x53')]:_0x470b99['model'];_0x40521f[_0x6c10('0xd0')]=qs[_0x6c10('0xd1')](_0x539ea0[_0x6c10('0x4d')][_0x6c10('0xd1')]);_0x40521f['where']=qs[_0x6c10('0xcd')](_['pick'](_0x539ea0['query'],_0x470b99['filters']));if(_0x539ea0[_0x6c10('0x4d')][_0x6c10('0x38')]){_0x40521f['where']=_[_0x6c10('0x62')](_0x40521f[_0x6c10('0x4c')],{'$or':_[_0x6c10('0x3a')](_0x40521f[_0x6c10('0x53')],function(_0x2acf46){var _0x2dff73={};_0x2dff73[_0x2acf46]={'$like':'%'+_0x539ea0[_0x6c10('0x4d')][_0x6c10('0x38')]+'%'};return _0x2dff73;})});}_0x40521f=_['merge']({},_0x40521f,_0x539ea0[_0x6c10('0x63')]);return _0x4cf1c5['getSmsInteractions'](_0x40521f);}})[_0x6c10('0x22')](function(_0x1f7797){if(_0x1f7797){_0x6ad0=_0x1f7797[_0x6c10('0x57')];if(!_0x539ea0['query'][_0x6c10('0xc4')](_0x6c10('0xd3'))){_0x40521f[_0x6c10('0x1d')]=qs[_0x6c10('0x1d')](_0x539ea0['query'][_0x6c10('0x1d')]);_0x40521f[_0x6c10('0x1b')]=qs[_0x6c10('0x1b')](_0x539ea0[_0x6c10('0x4d')]['offset']);}return _0x4cf1c5[_0x6c10('0xe1')](_0x40521f);}})[_0x6c10('0x22')](function(_0x44865c){if(_0x44865c){return _0x44865c?{'count':_0x6ad0,'rows':_0x44865c}:null;}})[_0x6c10('0x22')](respondWithResult(_0x4add99,null))['catch'](handleError(_0x4add99,null));};exports[_0x6c10('0xe3')]=function(_0x4f2d9f,_0x7aa065){var _0x1e2520={};var _0x44caec={};var _0x21f6ac;var _0x44d931;return db['User'][_0x6c10('0xc2')]({'where':{'id':_0x4f2d9f['params']['id']}})[_0x6c10('0x22')](handleEntityNotFound(_0x7aa065,null))[_0x6c10('0x22')](function(_0x409f9a){if(_0x409f9a){_0x21f6ac=_0x409f9a;_0x44caec['model']=_['keys'](db[_0x6c10('0xe4')][_0x6c10('0x41')]);_0x44caec[_0x6c10('0x4d')]=_['keys'](_0x4f2d9f[_0x6c10('0x4d')]);_0x44caec['filters']=_[_0x6c10('0xce')](_0x44caec[_0x6c10('0xca')],_0x44caec[_0x6c10('0x4d')]);_0x1e2520[_0x6c10('0x53')]=_[_0x6c10('0xce')](_0x44caec[_0x6c10('0xca')],qs[_0x6c10('0xcf')](_0x4f2d9f[_0x6c10('0x4d')][_0x6c10('0xcf')]));_0x1e2520['attributes']=_0x1e2520[_0x6c10('0x53')]['length']?_0x1e2520[_0x6c10('0x53')]:_0x44caec[_0x6c10('0xca')];_0x1e2520[_0x6c10('0xd0')]=qs[_0x6c10('0xd1')](_0x4f2d9f[_0x6c10('0x4d')][_0x6c10('0xd1')]);_0x1e2520[_0x6c10('0x4c')]=qs[_0x6c10('0xcd')](_['pick'](_0x4f2d9f[_0x6c10('0x4d')],_0x44caec['filters']));if(_0x4f2d9f['query'][_0x6c10('0x38')]){_0x1e2520[_0x6c10('0x4c')]=_[_0x6c10('0x62')](_0x1e2520[_0x6c10('0x4c')],{'$or':_[_0x6c10('0x3a')](_0x1e2520['attributes'],function(_0x154067){var _0x5083cf={};_0x5083cf[_0x154067]={'$like':'%'+_0x4f2d9f['query'][_0x6c10('0x38')]+'%'};return _0x5083cf;})});}_0x1e2520=_[_0x6c10('0x62')]({},_0x1e2520,_0x4f2d9f[_0x6c10('0x63')]);return _0x21f6ac[_0x6c10('0xe3')](_0x1e2520);}})[_0x6c10('0x22')](function(_0x4735fb){if(_0x4735fb){_0x44d931=_0x4735fb[_0x6c10('0x57')];if(!_0x4f2d9f[_0x6c10('0x4d')][_0x6c10('0xc4')]('nolimit')){_0x1e2520['limit']=qs['limit'](_0x4f2d9f[_0x6c10('0x4d')][_0x6c10('0x1d')]);_0x1e2520[_0x6c10('0x1b')]=qs[_0x6c10('0x1b')](_0x4f2d9f['query'][_0x6c10('0x1b')]);}return _0x21f6ac[_0x6c10('0xe3')](_0x1e2520);}})[_0x6c10('0x22')](function(_0x15552e){if(_0x15552e){return _0x15552e?{'count':_0x44d931,'rows':_0x15552e}:null;}})[_0x6c10('0x22')](respondWithResult(_0x7aa065,null))['catch'](handleError(_0x7aa065,null));};exports[_0x6c10('0xe5')]=function(_0x1ce8a9,_0x368bb3){var _0x3a0be5={};var _0x5a5b44={};var _0x2eca59;var _0x446331;return db[_0x6c10('0x40')]['findOne']({'where':{'id':_0x1ce8a9[_0x6c10('0x61')]['id']}})[_0x6c10('0x22')](handleEntityNotFound(_0x368bb3,null))[_0x6c10('0x22')](function(_0x4b363d){if(_0x4b363d){_0x2eca59=_0x4b363d;_0x5a5b44[_0x6c10('0xca')]=_['keys'](db[_0x6c10('0xe6')][_0x6c10('0x41')]);_0x5a5b44[_0x6c10('0x4d')]=_[_0x6c10('0xcb')](_0x1ce8a9[_0x6c10('0x4d')]);_0x5a5b44['filters']=_['intersection'](_0x5a5b44[_0x6c10('0xca')],_0x5a5b44[_0x6c10('0x4d')]);_0x3a0be5['attributes']=_['intersection'](_0x5a5b44['model'],qs['fields'](_0x1ce8a9[_0x6c10('0x4d')]['fields']));_0x3a0be5[_0x6c10('0x53')]=_0x3a0be5[_0x6c10('0x53')][_0x6c10('0x57')]?_0x3a0be5[_0x6c10('0x53')]:_0x5a5b44[_0x6c10('0xca')];_0x3a0be5['order']=qs[_0x6c10('0xd1')](_0x1ce8a9[_0x6c10('0x4d')]['sort']);_0x3a0be5[_0x6c10('0x4c')]=qs[_0x6c10('0xcd')](_[_0x6c10('0xd7')](_0x1ce8a9['query'],_0x5a5b44['filters']));if(_0x1ce8a9['query'][_0x6c10('0x38')]){_0x3a0be5[_0x6c10('0x4c')]=_[_0x6c10('0x62')](_0x3a0be5[_0x6c10('0x4c')],{'$or':_['map'](_0x3a0be5['attributes'],function(_0x1621cb){var _0x34c7d6={};_0x34c7d6[_0x1621cb]={'$like':'%'+_0x1ce8a9[_0x6c10('0x4d')][_0x6c10('0x38')]+'%'};return _0x34c7d6;})});}_0x3a0be5=_[_0x6c10('0x62')]({},_0x3a0be5,_0x1ce8a9[_0x6c10('0x63')]);return _0x2eca59[_0x6c10('0xe5')](_0x3a0be5);}})[_0x6c10('0x22')](function(_0x411cd1){if(_0x411cd1){_0x446331=_0x411cd1[_0x6c10('0x57')];if(!_0x1ce8a9[_0x6c10('0x4d')][_0x6c10('0xc4')]('nolimit')){_0x3a0be5[_0x6c10('0x1d')]=qs[_0x6c10('0x1d')](_0x1ce8a9[_0x6c10('0x4d')][_0x6c10('0x1d')]);_0x3a0be5[_0x6c10('0x1b')]=qs[_0x6c10('0x1b')](_0x1ce8a9[_0x6c10('0x4d')][_0x6c10('0x1b')]);}return _0x2eca59['getWhatsappInteractions'](_0x3a0be5);}})[_0x6c10('0x22')](function(_0xa665be){if(_0xa665be){return _0xa665be?{'count':_0x446331,'rows':_0xa665be}:null;}})[_0x6c10('0x22')](respondWithResult(_0x368bb3,null))[_0x6c10('0x5f')](handleError(_0x368bb3,null));};exports[_0x6c10('0xe7')]=function(_0x109d83,_0x125bc1,_0x217b9f){var _0x579a1e;var _0x44bc93;var _0x564f18;var _0x376068=!_[_0x6c10('0x6d')](_0x109d83[_0x6c10('0x61')]['id'])?_0x109d83[_0x6c10('0x61')]['id']:!_['isNil'](_0x109d83['user']['id'])?_0x109d83[_0x6c10('0x34')]['id']:null;return db[_0x6c10('0x40')]['find']({'where':{'id':_0x376068,'role':{'$or':[_0x6c10('0x32'),_0x6c10('0x34'),_0x6c10('0x2c')]}},'attributes':['id',_0x6c10('0x3c'),_0x6c10('0xe8'),_0x6c10('0xe9'),'role','internal','loginInPause']})[_0x6c10('0x22')](function(_0xfed740){if(_0xfed740){if(_0xfed740[_0x6c10('0x31')]==='agent'){_0x579a1e=_0xfed740;if(_0x109d83[_0x6c10('0x64')]['interface']){_0x564f18=util['format']('LOCAL/%s@from-sip/n',_0x579a1e[_0x109d83[_0x6c10('0x64')]['interface']]);}else if(_0x109d83['body'][_0x6c10('0xea')]){_0x564f18=util['format'](_0x6c10('0xeb'),_0x109d83[_0x6c10('0x64')][_0x6c10('0xea')]);}else{_0x564f18=util[_0x6c10('0xa6')]('SIP/%s',_0x579a1e['name']);}socket['to'](util['format'](_0x6c10('0xec'),_0x579a1e[_0x6c10('0x3c')]))['emit'](_0x6c10('0xed'),{'user':{'id':_0x579a1e['id'],'name':_0x579a1e[_0x6c10('0x3c')]},'ip':_0x109d83[_0x6c10('0xee')][_0x6c10('0xef')]||_0x109d83[_0x6c10('0xf0')][_0x6c10('0xf1')]||_0x109d83[_0x6c10('0xf2')][_0x6c10('0xf1')]||_0x109d83['connection'][_0x6c10('0xf2')][_0x6c10('0xf1')]});return new Promise(function(_0x4d2f49,_0x6bfca9){db[_0x6c10('0x6f')]['transaction']()['then'](_0x178baf=>{db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x579a1e[_0x6c10('0x3c')]},'individualHooks':!![]},{'transaction':_0x178baf})[_0x6c10('0x22')](function(){return _0x178baf[_0x6c10('0xf3')]();})[_0x6c10('0x22')](_0x4d2f49)[_0x6c10('0x5f')](_0x6bfca9);});});}}else{throw new db[(_0x6c10('0x90'))]['ValidationError'](_0x6c10('0xf4'));}})[_0x6c10('0x22')](function(){if(_0x579a1e){return _0x579a1e['getVoiceQueues']({'raw':!![]});}})[_0x6c10('0x22')](function(_0x1a1644){if(_0x579a1e){if(_0x1a1644){_0x44bc93=_0x1a1644;if(_0x44bc93[_0x6c10('0x57')]){var _0x3212bf=_0x44bc93['map'](function(_0x47af9c){return{'membername':_0x579a1e['name'],'UserId':_0x579a1e['id'],'queue_name':_0x47af9c[_0x6c10('0x3c')],'VoiceQueueId':_0x47af9c['id'],'interface':_0x564f18,'paused':_0x579a1e[_0x6c10('0xf5')]||![],'penalty':_0x47af9c[_0x6c10('0xf6')]||0x0};});return db[_0x6c10('0xab')]['bulkCreate'](_0x3212bf);}}}})[_0x6c10('0x22')](function(){if(_0x579a1e){return db[_0x6c10('0xf7')][_0x6c10('0x55')]({'where':{'membername':_0x579a1e[_0x6c10('0x3c')],'exitAt':null}});}})[_0x6c10('0x22')](function(_0x3c435e){if(_0x579a1e){var _0x12d7c2=[];_0x3c435e[_0x6c10('0xf8')](function(_0x114178){_0x12d7c2[_0x6c10('0x54')](_0x114178['update']({'exitAt':moment()[_0x6c10('0xa6')](_0x6c10('0xf9'))}));});return Promise[_0x6c10('0x5e')](_0x12d7c2);}})[_0x6c10('0x22')](function(){if(_0x579a1e){var _0x50162b=[];var _0x2a31e1=[];var _0x225b73=utils[_0x6c10('0xfa')]();var _0x45df1e={'membername':_0x579a1e[_0x6c10('0x3c')],'interface':_0x564f18,'enterAt':moment()[_0x6c10('0xa6')](_0x6c10('0xf9')),'role':_0x579a1e['role'],'internal':_0x579a1e[_0x6c10('0x6c')]};_0x225b73[_0x6c10('0xf8')](function(_0x12eb7d){_0x50162b['push'](_[_0x6c10('0x62')]({'channel':_0x12eb7d,'type':_0x6c10('0xfb'),'data1':_0x109d83[_0x6c10('0x64')][_0x6c10('0xfc')],'data2':_0x564f18},_0x45df1e));if(_0x579a1e['loginInPause']){_0x2a31e1[_0x6c10('0x54')](_[_0x6c10('0x62')]({'channel':_0x12eb7d,'type':'PAUSE','data1':'LOGININPAUSE'},_0x45df1e));}});return db[_0x6c10('0xf7')][_0x6c10('0xfd')](_0x50162b[_0x6c10('0xc0')](_0x2a31e1),{'individualHooks':!![]});}})[_0x6c10('0x22')](function(){if(_0x579a1e){return _0x579a1e[_0x6c10('0x2b')]({'online':!![],'lastLoginAt':moment()[_0x6c10('0xa6')](_0x6c10('0xf9')),'voicePause':_0x579a1e[_0x6c10('0xf5')]||![],'mailPause':_0x579a1e['loginInPause']||![],'chatPause':_0x579a1e['loginInPause']||![],'faxPause':_0x579a1e['loginInPause']||![],'smsPause':_0x579a1e[_0x6c10('0xf5')]||![],'openchannelPause':_0x579a1e['loginInPause']||![],'whatsappPause':_0x579a1e['loginInPause']||![],'pauseType':_0x579a1e[_0x6c10('0xf5')]?'LOGININPAUSE':null,'interface':_0x564f18,'lastPauseAt':moment()['format'](_0x6c10('0xf9'))});}})[_0x6c10('0x22')](function(_0x29a300){if(_0x109d83[_0x6c10('0xfe')]){return _0x217b9f();}else{return Promise[_0x6c10('0xff')](_0x29a300)[_0x6c10('0x22')](respondWithResult(_0x125bc1,null));}})[_0x6c10('0x5f')](handleError(_0x125bc1,null));};exports['logout']=function(_0x500489,_0x4382b6){var _0x56f077;return db[_0x6c10('0x40')]['find']({'where':{'id':_0x500489[_0x6c10('0x61')]['id'],'role':'agent'},'attributes':['id',_0x6c10('0x3c'),_0x6c10('0x31')]})[_0x6c10('0x22')](handleEntityNotFound(_0x4382b6,null))[_0x6c10('0x22')](function(_0x4a9d9a){if(_0x4a9d9a){_0x56f077=_0x4a9d9a;return db[_0x6c10('0xab')][_0x6c10('0x2f')]({'where':{'membername':_0x56f077[_0x6c10('0x3c')]},'individualHooks':!![]});}})[_0x6c10('0x22')](function(){return db['MemberReport'][_0x6c10('0x55')]({'where':{'membername':_0x56f077[_0x6c10('0x3c')],'exitAt':null}});})[_0x6c10('0x22')](function(_0x14f862){var _0x14b9c5=[];_0x14f862[_0x6c10('0xf8')](function(_0x4bc0a7){_0x14b9c5[_0x6c10('0x54')](_0x4bc0a7[_0x6c10('0x2b')]({'exitAt':moment()[_0x6c10('0xa6')](_0x6c10('0xf9'))}));});return Promise[_0x6c10('0x5e')](_0x14b9c5);})[_0x6c10('0x22')](function(){return _0x56f077[_0x6c10('0x2b')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x6c10('0x22')](respondWithResult(_0x4382b6,null))[_0x6c10('0x5f')](handleError(_0x4382b6,null));};exports['pause']=function(_0xf15f57,_0x4d5ca5){var _0x4a58ad;return db[_0x6c10('0xab')]['update']({'paused':0x1},{'where':{'UserId':_0xf15f57['params']['id']},'individualHooks':!![]})[_0x6c10('0x22')](function(){return db[_0x6c10('0x40')][_0x6c10('0x65')]({'where':{'id':_0xf15f57[_0x6c10('0x61')]['id'],'role':_0x6c10('0x2c')},'attributes':['id',_0x6c10('0x3c'),'role',_0x6c10('0x6c'),'interface','online']});})[_0x6c10('0x22')](handleEntityNotFound(_0x4d5ca5,null))['then'](function(_0x3fa4f6){if(_0x3fa4f6){_0x4a58ad=_0x3fa4f6;return respondWithRpcPromise('QueuePause','pause',{'id':_0x4a58ad['id'],'name':_0x4a58ad[_0x6c10('0x3c')],'pause':!![]});}})[_0x6c10('0x22')](function(){if(_0x4a58ad){return db[_0x6c10('0xf7')][_0x6c10('0x55')]({'where':{'membername':_0x4a58ad[_0x6c10('0x3c')],'type':_0x6c10('0x100'),'exitAt':null}});}})[_0x6c10('0x22')](function(_0x46cd1e){if(_0x46cd1e[_0x6c10('0x57')]){var _0x429533=moment()[_0x6c10('0xa6')](_0x6c10('0xf9'));for(var _0x4c6963=0x0,_0x407003=_0x46cd1e[_0x6c10('0x57')];_0x4c6963<_0x407003;_0x4c6963++){_0x46cd1e[_0x4c6963]['updateAttributes']({'exitAt':_0x429533});}}})[_0x6c10('0x22')](function(){var _0x547df0=[];var _0x13ee5d=utils[_0x6c10('0xfa')]();_0x13ee5d[_0x6c10('0xf8')](function(_0x3cd329){_0x547df0[_0x6c10('0x54')]({'channel':_0x3cd329,'membername':_0x4a58ad[_0x6c10('0x3c')],'interface':_[_0x6c10('0x6d')](_0x4a58ad[_0x6c10('0x9b')])?util['format']('SIP/%s',_0x4a58ad[_0x6c10('0x3c')]):_0x4a58ad['interface'],'type':_0x6c10('0x100'),'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0xf15f57[_0x6c10('0x64')]['type']||_0x6c10('0x101'),'role':_0x4a58ad[_0x6c10('0x31')],'internal':_0x4a58ad[_0x6c10('0x6c')]});});return db[_0x6c10('0xf7')][_0x6c10('0xfd')](_0x547df0,{'individualHooks':!![]});})[_0x6c10('0x22')](function(){return _0x4a58ad[_0x6c10('0x2b')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0xf15f57[_0x6c10('0x64')]['type']||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x6c10('0xa6')](_0x6c10('0xf9'))});})[_0x6c10('0x22')](respondWithResult(_0x4d5ca5,null))[_0x6c10('0x5f')](handleError(_0x4d5ca5,null));};exports['unpause']=function(_0x3baf43,_0xc86a8e){if(_0x3baf43[_0x6c10('0x64')][_0x6c10('0x98')]&&!utils[_0x6c10('0x9c')](_0x3baf43[_0x6c10('0x64')]['channel'])){throw new APIBadRequestError(util[_0x6c10('0xa6')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x3baf43['body'][_0x6c10('0x98')]));}return db[_0x6c10('0x40')][_0x6c10('0x65')]({'where':{'id':_0x3baf43[_0x6c10('0x61')]['id']},'attributes':['id','name',_0x6c10('0x31'),_0x6c10('0x6c'),'interface',_0x6c10('0x99'),_0x6c10('0x9a'),_0x6c10('0x102'),_0x6c10('0x103'),_0x6c10('0x104'),_0x6c10('0x105'),'smsPause',_0x6c10('0x106'),'pauseType',_0x6c10('0x107')]})[_0x6c10('0x22')](function(_0x13efe6){if(!_0x13efe6){throw new APINotFoundError(util[_0x6c10('0xa6')](_0x6c10('0xc3'),_0x3baf43[_0x6c10('0x61')]['id']));}return _0x13efe6[_0x6c10('0x108')](_0x3baf43[_0x6c10('0x64')][_0x6c10('0x98')]);})[_0x6c10('0x22')](respondWithResult(_0xc86a8e,null))['catch'](APIHandleError(_0xc86a8e));};exports['getTeams']=function(_0x497042,_0xce73c7){var _0x4d49e9={};var _0x3c1e34={};var _0x1f9b14;var _0x1a0264;return db[_0x6c10('0x40')][_0x6c10('0xc2')]({'where':{'id':_0x497042[_0x6c10('0x61')]['id']}})[_0x6c10('0x22')](handleEntityNotFound(_0xce73c7,null))[_0x6c10('0x22')](function(_0x3a7abd){if(_0x3a7abd){_0x1f9b14=_0x3a7abd;_0x3c1e34['model']=_[_0x6c10('0xcb')](db[_0x6c10('0x109')][_0x6c10('0x41')]);_0x3c1e34[_0x6c10('0x4d')]=_[_0x6c10('0xcb')](_0x497042['query']);_0x3c1e34[_0x6c10('0xcd')]=_[_0x6c10('0xce')](_0x3c1e34[_0x6c10('0xca')],_0x3c1e34[_0x6c10('0x4d')]);_0x4d49e9[_0x6c10('0x53')]=_[_0x6c10('0xce')](_0x3c1e34[_0x6c10('0xca')],qs['fields'](_0x497042['query'][_0x6c10('0xcf')]));_0x4d49e9['attributes']=_0x4d49e9[_0x6c10('0x53')][_0x6c10('0x57')]?_0x4d49e9[_0x6c10('0x53')]:_0x3c1e34['model'];_0x4d49e9['order']=qs['sort'](_0x497042[_0x6c10('0x4d')][_0x6c10('0xd1')]);_0x4d49e9['where']=qs[_0x6c10('0xcd')](_[_0x6c10('0xd7')](_0x497042[_0x6c10('0x4d')],_0x3c1e34[_0x6c10('0xcd')]));if(_0x497042[_0x6c10('0x4d')][_0x6c10('0x38')]){_0x4d49e9[_0x6c10('0x4c')]=_[_0x6c10('0x62')](_0x4d49e9['where'],{'$or':_[_0x6c10('0x3a')](_0x4d49e9[_0x6c10('0x53')],function(_0x2bf91e){var _0x27db11={};_0x27db11[_0x2bf91e]={'$like':'%'+_0x497042[_0x6c10('0x4d')][_0x6c10('0x38')]+'%'};return _0x27db11;})});}_0x4d49e9=_['merge']({},_0x4d49e9,_0x497042[_0x6c10('0x63')]);return _0x1f9b14[_0x6c10('0x10a')](_0x4d49e9);}})[_0x6c10('0x22')](function(_0x348ac2){if(_0x348ac2){_0x1a0264=_0x348ac2[_0x6c10('0x57')];if(!_0x497042[_0x6c10('0x4d')][_0x6c10('0xc4')](_0x6c10('0xd3'))){_0x4d49e9['limit']=qs['limit'](_0x497042['query'][_0x6c10('0x1d')]);_0x4d49e9[_0x6c10('0x1b')]=qs[_0x6c10('0x1b')](_0x497042['query']['offset']);}return _0x1f9b14[_0x6c10('0x10a')](_0x4d49e9);}})[_0x6c10('0x22')](function(_0x1c2618){if(_0x1c2618){return _0x1c2618?{'count':_0x1a0264,'rows':_0x1c2618}:null;}})[_0x6c10('0x22')](respondWithResult(_0xce73c7,null))['catch'](handleError(_0xce73c7,null));};exports[_0x6c10('0x10b')]=function(_0x530fa9,_0x21ad67){var _0x1c182c=_0x530fa9['params']['id'];var _0x4735e1=_0x530fa9['body']?_0x530fa9[_0x6c10('0x64')][_0x6c10('0x68')]:null;var _0x3dd792=[];return Promise[_0x6c10('0xff')]()[_0x6c10('0x22')](function(){if(!_0x4735e1)throw new APIBadRequestError(_0x6c10('0x10c'));})['then'](function(){return db[_0x6c10('0x40')][_0x6c10('0xc2')]({'where':{'id':_0x1c182c}});})[_0x6c10('0x22')](function(_0x351a7a){if(!_0x351a7a)throw new APINotFoundError(util[_0x6c10('0xa6')](_0x6c10('0xc3'),_0x530fa9[_0x6c10('0x61')]['id']));return db['sequelize'][_0x6c10('0x10d')](function(_0x1851fb){return _0x351a7a['addTeams'](_0x4735e1,{'transaction':_0x1851fb})[_0x6c10('0x22')](function(){return db[_0x6c10('0x109')][_0x6c10('0x55')]({'where':{'id':{'$in':_0x4735e1}}});})[_0x6c10('0x22')](function(_0x52db9a){var _0x7dc052=_[_0x6c10('0x3a')](_0x52db9a,function(_0x5bd653){return _0x5bd653[_0x6c10('0x10e')]();});return Promise['all'](_0x7dc052);})[_0x6c10('0x22')](function(_0x1fafaf){_0x3dd792=_[_0x6c10('0x10f')](_0x1fafaf);var _0x22c47b=_[_0x6c10('0x3a')](_0x3dd792,function(_0x4ae744){return _0x4ae744[_0x6c10('0x110')](_0x351a7a['id'],{'transaction':_0x1851fb});});return Promise[_0x6c10('0x5e')](_0x22c47b);})[_0x6c10('0x22')](function(){if(!_0x351a7a[_0x6c10('0x99')])return;var _0x5b8bf2=_['filter'](_0x3dd792,function(_0x2c54db){return _0x2c54db['getDataValue'](_0x6c10('0x98'))==='Voice';});var _0x43e207=_[_0x6c10('0x3a')](_0x5b8bf2,function(_0x19e2e4){return db[_0x6c10('0xab')][_0x6c10('0xa7')]({'membername':_0x351a7a[_0x6c10('0x3c')],'UserId':_0x351a7a['id'],'queue_name':_0x19e2e4['name'],'VoiceQueueId':_0x19e2e4['id'],'interface':_[_0x6c10('0x6d')](_0x351a7a[_0x6c10('0x9b')])?util[_0x6c10('0xa6')](_0x6c10('0xeb'),_0x351a7a['name']):_0x351a7a[_0x6c10('0x9b')],'paused':_0x351a7a[_0x6c10('0x9a')]||![],'penalty':_0x351a7a['penalty']},{'transaction':_0x1851fb});});return Promise['all'](_0x43e207);})[_0x6c10('0x22')](function(){return db[_0x6c10('0x111')]['findAll']({'where':{'teamId':{'$in':_0x4735e1}}});})[_0x6c10('0x22')](function(_0x247baf){var _0x2f3876=_['map'](_0x247baf,function(_0x4b44f4){return db['UserVoicePrefix']['create']({'UserId':_0x351a7a['id'],'VoicePrefixId':_0x4b44f4[_0x6c10('0x112')]},{'transaction':_0x1851fb});});return Promise[_0x6c10('0x5e')](_0x2f3876);});});})[_0x6c10('0x22')](function(){for(var _0x484b20=0x0;_0x484b20<_0x3dd792[_0x6c10('0x57')];_0x484b20++){var _0x32f229=_0x3dd792[_0x484b20]['getDataValue']('channel');var _0x83e4c2=_0x32f229+'QueueId';socket['emit'](_0x6c10('0x34')+_0x32f229+_0x6c10('0xa5'),{'UserId':_0x1c182c,['queueField']:_0x3dd792[_0x484b20]['id']});}})['then'](respondWithStatusCode(_0x21ad67,null))[_0x6c10('0x5f')](APIHandleError(_0x21ad67));};exports[_0x6c10('0x113')]=function(_0x370950,_0x40956f){var _0x3211b6=_0x370950[_0x6c10('0x61')]['id'];var _0x14d403=null;if(_0x370950[_0x6c10('0x4d')][_0x6c10('0x68')]){_0x14d403=_[_0x6c10('0xa9')](_0x370950[_0x6c10('0x4d')]['ids'])?_0x370950['query'][_0x6c10('0x68')]:[_0x370950['query']['ids']];}var _0x3a1363=[];return Promise['resolve']()[_0x6c10('0x22')](function(){if(!_0x14d403)throw new APIBadRequestError(_0x6c10('0x114'));})[_0x6c10('0x22')](function(){return db[_0x6c10('0x40')][_0x6c10('0xc2')]({'where':{'id':_0x3211b6}});})[_0x6c10('0x22')](function(_0x1e83a7){if(!_0x1e83a7)throw new APINotFoundError(util[_0x6c10('0xa6')](_0x6c10('0xc3'),_0x370950[_0x6c10('0x61')]['id']));return db[_0x6c10('0x6f')][_0x6c10('0x10d')](function(_0x55e3a1){return _0x1e83a7[_0x6c10('0x113')](_0x14d403,{'transaction':_0x55e3a1})[_0x6c10('0x22')](function(){return db['Team'][_0x6c10('0x55')]({'where':{'id':{'$in':_0x14d403}}});})['then'](function(_0x400192){var _0x12503e=_[_0x6c10('0x3a')](_0x400192,function(_0x483310){return _0x483310['getAssociatedQueues']();});return Promise[_0x6c10('0x5e')](_0x12503e);})[_0x6c10('0x22')](function(_0x332049){_0x3a1363=_[_0x6c10('0x10f')](_0x332049);var _0x146427=_[_0x6c10('0x3a')](_0x3a1363,function(_0x5360af){return _0x5360af[_0x6c10('0x115')](_0x1e83a7['id'],{'transaction':_0x55e3a1});});return Promise['all'](_0x146427);})[_0x6c10('0x22')](function(){if(!_0x1e83a7['online'])return;var _0x3c9f84=_[_0x6c10('0x38')](_0x3a1363,function(_0x51dfe4){return _0x51dfe4[_0x6c10('0x116')]('channel')===_0x6c10('0x117');});var _0x4d05a5=_[_0x6c10('0x3a')](_0x3c9f84,function(_0x2c5c2e){return db[_0x6c10('0xab')][_0x6c10('0x2f')]({'where':{'VoiceQueueId':_0x2c5c2e['id'],'UserId':_0x1e83a7['id']},'transaction':_0x55e3a1});});return Promise[_0x6c10('0x5e')](_0x4d05a5);})['then'](function(){return db[_0x6c10('0x111')][_0x6c10('0x55')]({'where':{'teamId':{'$in':_0x14d403}}});})['then'](function(_0x2234ff){var _0x43969e=_['map'](_0x2234ff,function(_0x714908){return db[_0x6c10('0x118')][_0x6c10('0x2f')]({'where':{'UserId':_0x1e83a7['id'],'VoicePrefixId':_0x714908['VoicePrefixId']}},{'transaction':_0x55e3a1});});return Promise[_0x6c10('0x5e')](_0x43969e);});});})['then'](function(){for(var _0x5d71a1=0x0;_0x5d71a1<_0x3a1363[_0x6c10('0x57')];_0x5d71a1++){var _0x58628a=_0x3a1363[_0x5d71a1][_0x6c10('0x116')](_0x6c10('0x98'));var _0x367873=_0x58628a+_0x6c10('0xa4');socket[_0x6c10('0x2d')](_0x6c10('0x34')+_0x58628a+'Queue:remove',{'UserId':_0x3211b6,['queueField']:_0x3a1363[_0x5d71a1]['id']});}})[_0x6c10('0x22')](respondWithStatusCode(_0x40956f,null))[_0x6c10('0x5f')](APIHandleError(_0x40956f));};exports[_0x6c10('0x119')]=function(_0x295715,_0x3a4d18){var _0x4a7f93={};var _0x23712d={};var _0xe8f34e;var _0xcad7e9;return db[_0x6c10('0x40')][_0x6c10('0xc2')]({'where':{'id':_0x295715[_0x6c10('0x61')]['id']}})[_0x6c10('0x22')](handleEntityNotFound(_0x3a4d18,null))[_0x6c10('0x22')](function(_0x426c1c){if(_0x426c1c){_0xe8f34e=_0x426c1c;_0x23712d[_0x6c10('0xca')]=_[_0x6c10('0xcb')](db[_0x6c10('0xc5')][_0x6c10('0x41')]);_0x23712d[_0x6c10('0x4d')]=_[_0x6c10('0xcb')](_0x295715[_0x6c10('0x4d')]);_0x23712d['filters']=_['intersection'](_0x23712d['model'],_0x23712d[_0x6c10('0x4d')]);_0x4a7f93[_0x6c10('0x53')]=_[_0x6c10('0xce')](_0x23712d[_0x6c10('0xca')],qs['fields'](_0x295715['query']['fields']));_0x4a7f93['attributes']=_0x4a7f93[_0x6c10('0x53')]['length']?_0x4a7f93[_0x6c10('0x53')]:_0x23712d[_0x6c10('0xca')];_0x4a7f93[_0x6c10('0xd0')]=qs['sort'](_0x295715[_0x6c10('0x4d')][_0x6c10('0xd1')]);_0x4a7f93['where']=qs['filters'](_[_0x6c10('0xd7')](_0x295715[_0x6c10('0x4d')],_0x23712d[_0x6c10('0xcd')]));if(_0x295715[_0x6c10('0x4d')]['filter']){_0x4a7f93['where']=_[_0x6c10('0x62')](_0x4a7f93[_0x6c10('0x4c')],{'$or':_[_0x6c10('0x3a')](_0x4a7f93[_0x6c10('0x53')],function(_0x4cba0b){var _0xbe5372={};_0xbe5372[_0x4cba0b]={'$like':'%'+_0x295715['query'][_0x6c10('0x38')]+'%'};return _0xbe5372;})});}_0x4a7f93=_[_0x6c10('0x62')]({},_0x4a7f93,_0x295715[_0x6c10('0x63')]);return _0xe8f34e['getLists'](_0x4a7f93);}})[_0x6c10('0x22')](function(_0x4bfbb5){if(_0x4bfbb5){_0xcad7e9=_0x4bfbb5[_0x6c10('0x57')];if(!_0x295715[_0x6c10('0x4d')][_0x6c10('0xc4')]('nolimit')){_0x4a7f93[_0x6c10('0x1d')]=qs['limit'](_0x295715['query']['limit']);_0x4a7f93[_0x6c10('0x1b')]=qs[_0x6c10('0x1b')](_0x295715['query']['offset']);}return _0xe8f34e[_0x6c10('0x119')](_0x4a7f93);}})[_0x6c10('0x22')](function(_0x351764){if(_0x351764){return _0x351764?{'count':_0xcad7e9,'rows':_0x351764}:null;}})['then'](respondWithResult(_0x3a4d18,null))[_0x6c10('0x5f')](handleError(_0x3a4d18,null));};exports['getAgents']=function(_0x32a4c0,_0x180a83){var _0x1bff58={};var _0xa344df={};var _0x3b1eb5;return db[_0x6c10('0x40')][_0x6c10('0xc2')]({'where':{'id':_0x32a4c0['params']['id']}})[_0x6c10('0x22')](handleEntityNotFound(_0x180a83,null))[_0x6c10('0x22')](function(_0x3c66b7){if(_0x3c66b7){_0x3b1eb5=_0x3c66b7;_0xa344df['model']=_[_0x6c10('0xcb')](db[_0x6c10('0x40')]['rawAttributes']);_0xa344df['query']=_['keys'](_0x32a4c0['query']);_0xa344df[_0x6c10('0xcd')]=_[_0x6c10('0xce')](_0xa344df['model'],_0xa344df[_0x6c10('0x4d')]);_0x1bff58[_0x6c10('0x53')]=_['intersection'](_0xa344df[_0x6c10('0xca')],qs[_0x6c10('0xcf')](_0x32a4c0['query'][_0x6c10('0xcf')]));_0x1bff58[_0x6c10('0x53')]=_0x1bff58[_0x6c10('0x53')][_0x6c10('0x57')]?_0x1bff58[_0x6c10('0x53')]:_0xa344df[_0x6c10('0xca')];_0x1bff58[_0x6c10('0xd0')]=qs[_0x6c10('0xd1')](_0x32a4c0[_0x6c10('0x4d')][_0x6c10('0xd1')]);_0x1bff58[_0x6c10('0x4c')]=qs[_0x6c10('0xcd')](_[_0x6c10('0xd7')](_0x32a4c0[_0x6c10('0x4d')],_0xa344df[_0x6c10('0xcd')]));if(_0x32a4c0[_0x6c10('0x4d')][_0x6c10('0x38')]){_0x1bff58[_0x6c10('0x4c')]=_[_0x6c10('0x62')](_0x1bff58[_0x6c10('0x4c')],{'$or':_[_0x6c10('0x3a')](_0x1bff58['attributes'],function(_0x4df064){var _0x51c9a1={};_0x51c9a1[_0x4df064]={'$like':'%'+_0x32a4c0[_0x6c10('0x4d')]['filter']+'%'};return _0x51c9a1;})});}_0x1bff58[_0x6c10('0xca')]=db[_0x6c10('0x40')];_0x1bff58['as']=_0x6c10('0x35');_0x1bff58=_[_0x6c10('0x62')]({},_0x1bff58,_0x32a4c0[_0x6c10('0x63')]);return _0x3b1eb5[_0x6c10('0x11a')]({'include':[_0x1bff58]});}})['then'](function(_0x1b8d1a){if(_0x1b8d1a){var _0x15898d={},_0x4863f9=[];for(var _0x4b4409=0x0;_0x4b4409<_0x1b8d1a['length'];_0x4b4409+=0x1){for(var _0x579483=0x0,_0x415d6f;_0x579483<_0x1b8d1a[_0x4b4409]['Agents'][_0x6c10('0x57')];_0x579483+=0x1){_0x415d6f=_0x1b8d1a[_0x4b4409][_0x6c10('0x35')][_0x579483][_0x6c10('0x30')]({'plain':!![]});_0x15898d[_0x415d6f['id']]=_0x415d6f;}}_0x15898d=_[_0x6c10('0x11b')](_0x15898d);for(var _0x500c6a=qs[_0x6c10('0x1b')](_0x32a4c0[_0x6c10('0x4d')][_0x6c10('0x1b')]);_0x500c6a<_0x15898d[_0x6c10('0x57')]&&_0x4863f9[_0x6c10('0x57')]=_0x57e5eb[_0x1f99('0x4d')]){throw new Error(_0x1f99('0x4e'));}})[_0x1f99('0x19')](function(){if(_0x15bbc4){return db[_0x1f99('0x2a')][_0x1f99('0x44')]({'where':{'membername':_0x15bbc4['name']},'individualHooks':!![]});}})[_0x1f99('0x19')](function(){if(_0x15bbc4){return _0x15bbc4[_0x1f99('0x4f')]({'raw':!![]});}})[_0x1f99('0x19')](function(_0x1c2b93){if(_0x15bbc4){if(_0x1c2b93){var _0x4e0971=[];_0x35baa7=_0x1c2b93;if(_0x35baa7[_0x1f99('0x2d')]){for(var _0x49c088=0x0;_0x49c088<_0x35baa7[_0x1f99('0x2d')];_0x49c088++){_0x4e0971[_0x1f99('0x50')](db[_0x1f99('0x2a')][_0x1f99('0x51')]({'membername':_0x15bbc4[_0x1f99('0x23')],'UserId':_0x15bbc4['id'],'queue_name':_0x35baa7[_0x49c088][_0x1f99('0x23')],'VoiceQueueId':_0x35baa7[_0x49c088]['id'],'interface':_0x511085,'paused':_0x15bbc4['loginInPause']||![],'penalty':_0x35baa7[_0x49c088][_0x1f99('0x52')]||0x0}));}return BPromise['all'](_0x4e0971);}}}})['then'](function(){if(_0x15bbc4){return db[_0x1f99('0x37')][_0x1f99('0x10')]({'where':{'membername':_0x15bbc4[_0x1f99('0x23')],'exitAt':null}});}})[_0x1f99('0x19')](function(_0x1ee0d8){if(_0x15bbc4){if(_0x1ee0d8&&_0x1ee0d8[_0x1f99('0x2d')]){var _0x1a2643=[];_0x1ee0d8[_0x1f99('0x31')](function(_0x1f6f76){_0x1a2643[_0x1f99('0x50')](_0x1f6f76[_0x1f99('0x2b')]({'exitAt':moment()[_0x1f99('0x27')](_0x1f99('0x2e'))}));});return BPromise['all'](_0x1a2643);}}})[_0x1f99('0x19')](function(){if(_0x15bbc4){var _0x1283a8=[];var _0x595299=[];var _0x4092dc=utils[_0x1f99('0x30')]();var _0x3e1196={'membername':_0x15bbc4[_0x1f99('0x23')],'interface':_0x511085,'enterAt':moment()['format'](_0x1f99('0x2e')),'role':_0x15bbc4[_0x1f99('0x24')],'internal':_0x15bbc4[_0x1f99('0x25')]};_0x4092dc['forEach'](function(_0x1e7ae7){_0x1283a8[_0x1f99('0x50')](_[_0x1f99('0x53')]({'channel':_0x1e7ae7,'type':_0x1f99('0x54'),'data1':_0x1f99('0x55'),'data2':_0x511085},_0x3e1196));if(_0x15bbc4[_0x1f99('0x48')]){_0x595299[_0x1f99('0x50')](_[_0x1f99('0x53')]({'channel':_0x1e7ae7,'type':'PAUSE','data1':_0x1f99('0x56')},_0x3e1196));}});return db[_0x1f99('0x37')]['bulkCreate'](_0x1283a8[_0x1f99('0x57')](_0x595299),{'individualHooks':!![]});}})['then'](function(){if(_0x15bbc4){return _0x15bbc4[_0x1f99('0x2b')]({'online':!![],'lastLoginAt':moment()[_0x1f99('0x27')](_0x1f99('0x2e')),'voicePause':_0x15bbc4[_0x1f99('0x48')]||![],'mailPause':_0x15bbc4[_0x1f99('0x48')]||![],'chatPause':_0x15bbc4[_0x1f99('0x48')]||![],'faxPause':_0x15bbc4[_0x1f99('0x48')]||![],'smsPause':_0x15bbc4[_0x1f99('0x48')]||![],'openchannelPause':_0x15bbc4[_0x1f99('0x48')]||![],'pauseType':_0x15bbc4['loginInPause']?'LOGININPAUSE':null,'lastPauseAt':moment()[_0x1f99('0x27')](_0x1f99('0x2e')),'interface':_0x511085});}})[_0x1f99('0x19')](function(_0x13e38c){_0x2fb1da(_0x13e38c);})[_0x1f99('0x1d')](function(_0x204200){_0x26e18a(_0x200878['error'](0x1f4,_0x204200[_0x1f99('0x1f')]));});});}; \ No newline at end of file +var _0xb771=['concat','loginInPause','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','localhost','socket.io-emitter','redis','register','GetUser','User','findAll','options','where','attributes','include','map','model','debug','stringify','catch','error','message','find','raw','info','ShowUser','PauseUser','role','internal','interface','then','format','User\x20with\x20id\x20%s\x20not\x20found','params','update','MemberReport','PAUSE','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','getChannels','forEach','push','name','isNil','SIP/%s','type','DEFAULT\x20PAUSE','uniqueid','bulkCreate','body','UnpauseUser','channel','isValidChannel','Channel\x20parameter\x20%s\x20is\x20invalid','findOne','online','voicePause','mailPause','chatPause','openchannelPause','smsPause','whatsappPause','pauseType','lastPauseAt','unpause','LogoutUser','destroy','all','LoginUser','mobile','phone','count','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','UserVoiceQueueRt','getVoiceQueues','upsert','UserVoiceQueue.penalty','merge','callysquare','LOGININPAUSE'];(function(_0x46f3e9,_0x55631d){var _0x316982=function(_0x319c16){while(--_0x319c16){_0x46f3e9['push'](_0x46f3e9['shift']());}};_0x316982(++_0x55631d);}(_0xb771,0xb6));var _0x1b77=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xb771[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0x1b77('0x0'));var util=require('util');var moment=require(_0x1b77('0x1'));var BPromise=require('bluebird');var Redis=require(_0x1b77('0x2'));var db=require(_0x1b77('0x3'))['db'];var utils=require(_0x1b77('0x4'));var logger=require(_0x1b77('0x5'))(_0x1b77('0x6'));var config=require(_0x1b77('0x7'));config['redis']=_['defaults'](config['redis'],{'host':_0x1b77('0x8'),'port':0x18eb});var socket=require(_0x1b77('0x9'))(new Redis(config[_0x1b77('0xa')]));require('./user.socket')[_0x1b77('0xb')](socket);exports[_0x1b77('0xc')]=function(_0x2874dd){var _0x50466f=this;return new Promise(function(_0x531c4e,_0x515d05){return db[_0x1b77('0xd')][_0x1b77('0xe')]({'raw':_0x2874dd[_0x1b77('0xf')]?_0x2874dd['options']['raw']===undefined?!![]:![]:!![],'where':_0x2874dd[_0x1b77('0xf')]?_0x2874dd['options'][_0x1b77('0x10')]||null:null,'attributes':_0x2874dd[_0x1b77('0xf')]?_0x2874dd[_0x1b77('0xf')][_0x1b77('0x11')]||null:null,'limit':_0x2874dd[_0x1b77('0xf')]?_0x2874dd[_0x1b77('0xf')]['limit']||null:null,'include':_0x2874dd[_0x1b77('0xf')]?_0x2874dd[_0x1b77('0xf')][_0x1b77('0x12')]?_[_0x1b77('0x13')](_0x2874dd[_0x1b77('0xf')]['include'],function(_0x2ee268){return{'model':db[_0x2ee268[_0x1b77('0x14')]],'as':_0x2ee268['as'],'attributes':_0x2ee268[_0x1b77('0x11')],'include':_0x2ee268[_0x1b77('0x12')]?_[_0x1b77('0x13')](_0x2ee268[_0x1b77('0x12')],function(_0x842e05){return{'model':db[_0x842e05[_0x1b77('0x14')]],'as':_0x842e05['as'],'attributes':_0x842e05[_0x1b77('0x11')],'include':_0x842e05[_0x1b77('0x12')]?_[_0x1b77('0x13')](_0x842e05[_0x1b77('0x12')],function(_0x1e7e37){return{'model':db[_0x1e7e37[_0x1b77('0x14')]],'as':_0x1e7e37['as'],'attributes':_0x1e7e37[_0x1b77('0x11')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x141e91){logger['info'](_0x1b77('0xc'),_0x2874dd);logger[_0x1b77('0x15')]('GetUser',_0x2874dd,JSON[_0x1b77('0x16')](_0x141e91));_0x531c4e(_0x141e91);})[_0x1b77('0x17')](function(_0x1f1d2e){logger[_0x1b77('0x18')](_0x1b77('0xc'),_0x1f1d2e['message'],_0x2874dd);_0x515d05(_0x50466f[_0x1b77('0x18')](0x1f4,_0x1f1d2e[_0x1b77('0x19')]));});});};exports['ShowUser']=function(_0x16df3a){var _0xaa84be=this;return new Promise(function(_0x1d0e10,_0x30ea50){return db['User'][_0x1b77('0x1a')]({'raw':_0x16df3a[_0x1b77('0xf')]?_0x16df3a[_0x1b77('0xf')][_0x1b77('0x1b')]===undefined?!![]:![]:!![],'where':_0x16df3a['options']?_0x16df3a['options'][_0x1b77('0x10')]||null:null,'attributes':_0x16df3a[_0x1b77('0xf')]?_0x16df3a[_0x1b77('0xf')]['attributes']||null:null,'include':_0x16df3a[_0x1b77('0xf')]?_0x16df3a['options'][_0x1b77('0x12')]?_[_0x1b77('0x13')](_0x16df3a[_0x1b77('0xf')][_0x1b77('0x12')],function(_0x4410ce){return{'model':db[_0x4410ce['model']],'as':_0x4410ce['as'],'attributes':_0x4410ce[_0x1b77('0x11')],'include':_0x4410ce[_0x1b77('0x12')]?_['map'](_0x4410ce[_0x1b77('0x12')],function(_0x262c33){return{'model':db[_0x262c33['model']],'as':_0x262c33['as'],'attributes':_0x262c33[_0x1b77('0x11')],'include':_0x262c33[_0x1b77('0x12')]?_[_0x1b77('0x13')](_0x262c33['include'],function(_0x2fefa6){return{'model':db[_0x2fefa6[_0x1b77('0x14')]],'as':_0x2fefa6['as'],'attributes':_0x2fefa6[_0x1b77('0x11')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3cb319){logger[_0x1b77('0x1c')]('ShowUser',_0x16df3a);logger['debug'](_0x1b77('0x1d'),_0x16df3a,JSON[_0x1b77('0x16')](_0x3cb319));_0x1d0e10(_0x3cb319);})[_0x1b77('0x17')](function(_0x49003a){logger[_0x1b77('0x18')](_0x1b77('0x1d'),_0x49003a['message'],_0x16df3a);_0x30ea50(_0xaa84be[_0x1b77('0x18')](0x1f4,_0x49003a['message']));});});};exports[_0x1b77('0x1e')]=function(_0xbd5605){var _0x20cb39;return db['User'][_0x1b77('0x1a')]({'where':_0xbd5605[_0x1b77('0xf')][_0x1b77('0x10')]||{},'attributes':['id','name',_0x1b77('0x1f'),_0x1b77('0x20'),_0x1b77('0x21')]})[_0x1b77('0x22')](function(_0x403e7e){if(!_0x403e7e){throw new Error(util[_0x1b77('0x23')](_0x1b77('0x24'),_0xbd5605[_0x1b77('0x25')]['id']));}_0x20cb39=_0x403e7e;return db['UserVoiceQueueRt'][_0x1b77('0x26')]({'paused':0x1},{'where':{'UserId':_0x20cb39['id']},'individualHooks':!![]});})['then'](function(){return db[_0x1b77('0x27')][_0x1b77('0xe')]({'where':{'membername':_0x20cb39['name'],'type':_0x1b77('0x28'),'exitAt':null}});})[_0x1b77('0x22')](function(_0x979848){if(_0x979848&&_0x979848['length']){var _0x154314=moment()[_0x1b77('0x23')](_0x1b77('0x29'));for(var _0x5ca057=0x0,_0x3a533c=_0x979848[_0x1b77('0x2a')];_0x5ca057<_0x3a533c;_0x5ca057++){_0x979848[_0x5ca057][_0x1b77('0x2b')]({'exitAt':_0x154314});}}})[_0x1b77('0x22')](function(){var _0x1d654b=[];var _0x547861=utils[_0x1b77('0x2c')]();_0x547861[_0x1b77('0x2d')](function(_0x5042d0){_0x1d654b[_0x1b77('0x2e')]({'channel':_0x5042d0,'membername':_0x20cb39[_0x1b77('0x2f')],'interface':_[_0x1b77('0x30')](_0x20cb39['interface'])?util['format'](_0x1b77('0x31'),_0x20cb39[_0x1b77('0x2f')]):_0x20cb39['interface'],'type':_0x1b77('0x28'),'enterAt':moment()[_0x1b77('0x23')](_0x1b77('0x29')),'data1':_0xbd5605['body'][_0x1b77('0x32')]||_0x1b77('0x33'),'role':_0x20cb39[_0x1b77('0x1f')],'internal':_0x20cb39[_0x1b77('0x20')],'uniqueid':_0xbd5605['body'][_0x1b77('0x34')]||null});});return db['MemberReport'][_0x1b77('0x35')](_0x1d654b,{'individualHooks':!![]});})[_0x1b77('0x22')](function(){return _0x20cb39['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0xbd5605[_0x1b77('0x36')]['type']||_0x1b77('0x33'),'lastPauseAt':moment()[_0x1b77('0x23')](_0x1b77('0x29'))});})[_0x1b77('0x17')](function(_0x37d941){throw _0x37d941;});};exports[_0x1b77('0x37')]=function(_0x57f4f2){return Promise['resolve']()[_0x1b77('0x22')](function(){if(_0x57f4f2['body'][_0x1b77('0x38')]&&!utils[_0x1b77('0x39')](_0x57f4f2[_0x1b77('0x36')][_0x1b77('0x38')])){throw new Error(util[_0x1b77('0x23')](_0x1b77('0x3a'),_0x57f4f2[_0x1b77('0x36')][_0x1b77('0x38')]));}return db[_0x1b77('0xd')][_0x1b77('0x3b')]({'where':_0x57f4f2[_0x1b77('0xf')][_0x1b77('0x10')]||{},'attributes':['id',_0x1b77('0x2f'),_0x1b77('0x1f'),'internal',_0x1b77('0x21'),_0x1b77('0x3c'),_0x1b77('0x3d'),_0x1b77('0x3e'),_0x1b77('0x3f'),'faxPause',_0x1b77('0x40'),_0x1b77('0x41'),_0x1b77('0x42'),_0x1b77('0x43'),_0x1b77('0x44')]});})[_0x1b77('0x22')](function(_0x2f238c){if(!_0x2f238c){throw new Error(util[_0x1b77('0x23')](_0x1b77('0x24'),_0x57f4f2['params']['id']));}return _0x2f238c[_0x1b77('0x45')](_0x57f4f2['body'][_0x1b77('0x38')],'system');})[_0x1b77('0x17')](function(_0x4faeb8){throw _0x4faeb8;});};exports[_0x1b77('0x46')]=function(_0x48e3b9){var _0x4ce71f=this;return new Promise(function(_0x37474e,_0x1d1c56){var _0x2151b9;return db[_0x1b77('0xd')][_0x1b77('0x3b')]({'where':_0x48e3b9[_0x1b77('0xf')][_0x1b77('0x10')]||{},'attributes':['id','name']})[_0x1b77('0x22')](function(_0x1d9ea3){if(_0x1d9ea3){_0x2151b9=_0x1d9ea3;return db['UserVoiceQueueRt'][_0x1b77('0x47')]({'where':{'membername':_0x2151b9[_0x1b77('0x2f')]},'individualHooks':!![]});}})[_0x1b77('0x22')](function(){if(_0x2151b9){return db[_0x1b77('0x27')][_0x1b77('0xe')]({'where':{'membername':_0x2151b9[_0x1b77('0x2f')],'exitAt':null}});}})['then'](function(_0x1a699c){if(_0x2151b9){if(_0x1a699c&&_0x1a699c[_0x1b77('0x2a')]){var _0x715fe3=[];_0x1a699c[_0x1b77('0x2d')](function(_0x25a68f){_0x715fe3['push'](_0x25a68f[_0x1b77('0x26')]({'exitAt':moment()[_0x1b77('0x23')](_0x1b77('0x29'))}));});return BPromise[_0x1b77('0x48')](_0x715fe3);}}})['then'](function(){if(_0x2151b9){return _0x2151b9[_0x1b77('0x26')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x1b77('0x22')](function(_0x4951b2){_0x37474e(_0x4951b2);})[_0x1b77('0x17')](function(_0x4ca487){_0x1d1c56(_0x4ce71f[_0x1b77('0x18')](0x1f4,_0x4ca487['message']));});});};exports[_0x1b77('0x49')]=function(_0x3962bf){var _0x3d1aef=this;return new Promise(function(_0x31e6c8,_0x3ab49c){var _0x3e0bf3;var _0xa7297;var _0x3fe39b;var _0x64cc29;return db['User'][_0x1b77('0x3b')]({'where':_0x3962bf[_0x1b77('0xf')][_0x1b77('0x10')]||{},'attributes':['id',_0x1b77('0x2f'),_0x1b77('0x1f'),_0x1b77('0x4a'),_0x1b77('0x4b'),_0x1b77('0x20'),'loginInPause',_0x1b77('0x21')]})[_0x1b77('0x22')](function(_0x2aff3d){if(_0x2aff3d){_0x3e0bf3=_0x2aff3d;_0x64cc29=_0x3962bf[_0x1b77('0x36')]['interface']?_0x3962bf['body'][_0x1b77('0x21')]:util[_0x1b77('0x23')](_0x1b77('0x31'),_0x3e0bf3[_0x1b77('0x2f')]);return db['User'][_0x1b77('0x4c')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x3e0bf3['id']}}});}})[_0x1b77('0x22')](function(_0x7345ce){if(_0x7345ce){_0x3fe39b=_0x7345ce;return require(_0x1b77('0x4d'))[_0x1b77('0x4e')]();}})[_0x1b77('0x22')](function(_0x3104aa){if(_0x3104aa&&_0x3104aa[_0x1b77('0x4f')]&&_0x3fe39b>=_0x3104aa[_0x1b77('0x4f')]){throw new Error(_0x1b77('0x50'));}})[_0x1b77('0x22')](function(){if(_0x3e0bf3){return db[_0x1b77('0x51')][_0x1b77('0x47')]({'where':{'membername':_0x3e0bf3['name']},'individualHooks':!![]});}})[_0x1b77('0x22')](function(){if(_0x3e0bf3){return _0x3e0bf3[_0x1b77('0x52')]({'raw':!![]});}})[_0x1b77('0x22')](function(_0x5ea78a){if(_0x3e0bf3){if(_0x5ea78a){var _0x1c2389=[];_0xa7297=_0x5ea78a;if(_0xa7297[_0x1b77('0x2a')]){for(var _0x4d44e4=0x0;_0x4d44e4<_0xa7297[_0x1b77('0x2a')];_0x4d44e4++){_0x1c2389['push'](db['UserVoiceQueueRt'][_0x1b77('0x53')]({'membername':_0x3e0bf3[_0x1b77('0x2f')],'UserId':_0x3e0bf3['id'],'queue_name':_0xa7297[_0x4d44e4]['name'],'VoiceQueueId':_0xa7297[_0x4d44e4]['id'],'interface':_0x64cc29,'paused':_0x3e0bf3['loginInPause']||![],'penalty':_0xa7297[_0x4d44e4][_0x1b77('0x54')]||0x0}));}return BPromise[_0x1b77('0x48')](_0x1c2389);}}}})[_0x1b77('0x22')](function(){if(_0x3e0bf3){return db[_0x1b77('0x27')][_0x1b77('0xe')]({'where':{'membername':_0x3e0bf3[_0x1b77('0x2f')],'exitAt':null}});}})[_0x1b77('0x22')](function(_0x2e0372){if(_0x3e0bf3){if(_0x2e0372&&_0x2e0372[_0x1b77('0x2a')]){var _0x28ed4e=[];_0x2e0372[_0x1b77('0x2d')](function(_0x3ac8b2){_0x28ed4e[_0x1b77('0x2e')](_0x3ac8b2['update']({'exitAt':moment()[_0x1b77('0x23')](_0x1b77('0x29'))}));});return BPromise[_0x1b77('0x48')](_0x28ed4e);}}})['then'](function(){if(_0x3e0bf3){var _0x32c3cc=[];var _0x38469d=[];var _0x3a1cfb=utils[_0x1b77('0x2c')]();var _0xa742a4={'membername':_0x3e0bf3['name'],'interface':_0x64cc29,'enterAt':moment()['format'](_0x1b77('0x29')),'role':_0x3e0bf3[_0x1b77('0x1f')],'internal':_0x3e0bf3[_0x1b77('0x20')]};_0x3a1cfb[_0x1b77('0x2d')](function(_0x13bbb1){_0x32c3cc[_0x1b77('0x2e')](_[_0x1b77('0x55')]({'channel':_0x13bbb1,'type':'LOGIN','data1':_0x1b77('0x56'),'data2':_0x64cc29},_0xa742a4));if(_0x3e0bf3['loginInPause']){_0x38469d[_0x1b77('0x2e')](_[_0x1b77('0x55')]({'channel':_0x13bbb1,'type':_0x1b77('0x28'),'data1':_0x1b77('0x57')},_0xa742a4));}});return db[_0x1b77('0x27')][_0x1b77('0x35')](_0x32c3cc[_0x1b77('0x58')](_0x38469d),{'individualHooks':!![]});}})['then'](function(){if(_0x3e0bf3){return _0x3e0bf3[_0x1b77('0x26')]({'online':!![],'lastLoginAt':moment()[_0x1b77('0x23')](_0x1b77('0x29')),'voicePause':_0x3e0bf3[_0x1b77('0x59')]||![],'mailPause':_0x3e0bf3[_0x1b77('0x59')]||![],'chatPause':_0x3e0bf3[_0x1b77('0x59')]||![],'faxPause':_0x3e0bf3['loginInPause']||![],'smsPause':_0x3e0bf3[_0x1b77('0x59')]||![],'openchannelPause':_0x3e0bf3[_0x1b77('0x59')]||![],'pauseType':_0x3e0bf3['loginInPause']?_0x1b77('0x57'):null,'lastPauseAt':moment()[_0x1b77('0x23')](_0x1b77('0x29')),'interface':_0x64cc29});}})[_0x1b77('0x22')](function(_0x2826a1){_0x31e6c8(_0x2826a1);})['catch'](function(_0x88ba48){_0x3ab49c(_0x3d1aef[_0x1b77('0x18')](0x1f4,_0x88ba48[_0x1b77('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 9de0944..d7a3863 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 _0xe521=['update','emit','removeListener','length','user:','save','remove'];(function(_0x467e92,_0x52a4e1){var _0x29f7e0=function(_0x5e4339){while(--_0x5e4339){_0x467e92['push'](_0x467e92['shift']());}};_0x29f7e0(++_0x52a4e1);}(_0xe521,0x139));var _0x1e52=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe521[_0x3dd15e];return _0x231fd0;};'use strict';var UserEvents=require('./user.events');var events=[_0x1e52('0x0'),_0x1e52('0x1'),_0x1e52('0x2')];function createListener(_0x1b6bba,_0x20b5ae){return function(_0x229a2b){_0x20b5ae[_0x1e52('0x3')](_0x1b6bba,_0x229a2b);};}function removeListener(_0x1303c9,_0x5eb055){return function(){UserEvents[_0x1e52('0x4')](_0x1303c9,_0x5eb055);};}exports['register']=function(_0x3673c7){for(var _0x20ae8e=0x0,_0x3a5251=events[_0x1e52('0x5')];_0x20ae8e<_0x3a5251;_0x20ae8e++){var _0x4de1c5=events[_0x20ae8e];var _0x22d557=createListener(_0x1e52('0x6')+_0x4de1c5,_0x3673c7);UserEvents['on'](_0x4de1c5,_0x22d557);}}; \ No newline at end of file +var _0x17f2=['emit','removeListener','register','length','user:','./user.events','save','remove','update'];(function(_0x384d39,_0xf060fc){var _0x13bf22=function(_0x5d83f2){while(--_0x5d83f2){_0x384d39['push'](_0x384d39['shift']());}};_0x13bf22(++_0xf060fc);}(_0x17f2,0x176));var _0x217f=function(_0x16a637,_0x5eb627){_0x16a637=_0x16a637-0x0;var _0x25126d=_0x17f2[_0x16a637];return _0x25126d;};'use strict';var UserEvents=require(_0x217f('0x0'));var events=[_0x217f('0x1'),_0x217f('0x2'),_0x217f('0x3')];function createListener(_0x152333,_0x234e51){return function(_0x7af6ef){_0x234e51[_0x217f('0x4')](_0x152333,_0x7af6ef);};}function removeListener(_0xb8ca66,_0x4bd44c){return function(){UserEvents[_0x217f('0x5')](_0xb8ca66,_0x4bd44c);};}exports[_0x217f('0x6')]=function(_0x24c184){for(var _0x1cade0=0x0,_0x4c918c=events[_0x217f('0x7')];_0x1cade0<_0x4c918c;_0x1cade0++){var _0x46714e=events[_0x1cade0];var _0x4f8130=createListener(_0x217f('0x8')+_0x46714e,_0x24c184);UserEvents['on'](_0x46714e,_0x4f8130);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 84c2a6d..451b5e3 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x5c5fa0,_0x1f6c00){var _0x4101fc=function(_0x8f79c0){while(--_0x8f79c0){_0x5c5fa0['push'](_0x5c5fa0['shift']());}};_0x4101fc(++_0x1f6c00);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x3e1fe8,_0x223c26){var _0x55d8e5=function(_0x15cd31){while(--_0x15cd31){_0x3e1fe8['push'](_0x3e1fe8['shift']());}};_0x55d8e5(++_0x223c26);}(_0x9c44,0x178));var _0x49c4=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x9c44[_0x279d37];return _0x530173;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index b97d7d0..83fae4a 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 _0xe617=['exports','INTEGER','sequelize'];(function(_0xa34669,_0x128815){var _0x65e5d2=function(_0x183d91){while(--_0x183d91){_0xa34669['push'](_0xa34669['shift']());}};_0x65e5d2(++_0x128815);}(_0xe617,0x17c));var _0x7e61=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe617[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x7e61('0x0'));module[_0x7e61('0x1')]={'penalty':{'type':Sequelize[_0x7e61('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x61d0=['INTEGER','sequelize','exports'];(function(_0x34f7d1,_0x3495b5){var _0x4cdd94=function(_0xcbb513){while(--_0xcbb513){_0x34f7d1['push'](_0x34f7d1['shift']());}};_0x4cdd94(++_0x3495b5);}(_0x61d0,0x181));var _0x061d=function(_0xa6cc5c,_0x239c99){_0xa6cc5c=_0xa6cc5c-0x0;var _0x44803d=_0x61d0[_0xa6cc5c];return _0x44803d;};'use strict';var Sequelize=require(_0x061d('0x0'));module[_0x061d('0x1')]={'penalty':{'type':Sequelize[_0x061d('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 72e1ddc..39ea591 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 _0xc4d2=['exports','define','user_has_chat_queues','lodash','../../config/logger','api','moment','request-promise','rimraf','./userChatQueue.attributes'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc4d2,0x17f));var _0x2c4d=function(_0xe18561,_0x3884b0){_0xe18561=_0xe18561-0x0;var _0xc52ff4=_0xc4d2[_0xe18561];return _0xc52ff4;};'use strict';var _=require(_0x2c4d('0x0'));var util=require('util');var logger=require(_0x2c4d('0x1'))(_0x2c4d('0x2'));var moment=require(_0x2c4d('0x3'));var BPromise=require('bluebird');var rp=require(_0x2c4d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2c4d('0x5'));var config=require('../../config/environment');var attributes=require(_0x2c4d('0x6'));module[_0x2c4d('0x7')]=function(_0x3abb2a,_0x288e87){return _0x3abb2a[_0x2c4d('0x8')]('UserChatQueue',attributes,{'tableName':_0x2c4d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e41=['util','api','request-promise','rimraf','../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue','lodash'];(function(_0x117276,_0x2c725e){var _0x51b05f=function(_0x3c933c){while(--_0x3c933c){_0x117276['push'](_0x117276['shift']());}};_0x51b05f(++_0x2c725e);}(_0x3e41,0x167));var _0x13e4=function(_0x1ed8a8,_0x2b9844){_0x1ed8a8=_0x1ed8a8-0x0;var _0x464835=_0x3e41[_0x1ed8a8];return _0x464835;};'use strict';var _=require(_0x13e4('0x0'));var util=require(_0x13e4('0x1'));var logger=require('../../config/logger')(_0x13e4('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x13e4('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x13e4('0x4'));var config=require(_0x13e4('0x5'));var attributes=require(_0x13e4('0x6'));module[_0x13e4('0x7')]=function(_0x5648c8,_0x4078cd){return _0x5648c8[_0x13e4('0x8')](_0x13e4('0x9'),attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index f3d6970..bec4de5 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 _0x46e4=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','UserChatQueue,\x20%s,\x20%s','message','util','bluebird','ioredis'];(function(_0x33d431,_0xf591fb){var _0xad1bc8=function(_0x3c0b5a){while(--_0x3c0b5a){_0x33d431['push'](_0x33d431['shift']());}};_0xad1bc8(++_0xf591fb);}(_0x46e4,0x13d));var _0x446e=function(_0x27b4c7,_0xd847e6){_0x27b4c7=_0x27b4c7-0x0;var _0x3000b9=_0x46e4[_0x27b4c7];return _0x3000b9;};'use strict';var _=require('lodash');var util=require(_0x446e('0x0'));var moment=require('moment');var BPromise=require(_0x446e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x446e('0x2'));var db=require(_0x446e('0x3'))['db'];var utils=require(_0x446e('0x4'));var logger=require(_0x446e('0x5'))(_0x446e('0x6'));var config=require(_0x446e('0x7'));var jayson=require(_0x446e('0x8'));var client=jayson['client'][_0x446e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x21f963,_0x646536,_0x26e9df){return new BPromise(function(_0x140920,_0x419e38){return client[_0x446e('0xa')](_0x21f963,_0x26e9df)[_0x446e('0xb')](function(_0x16b367){logger[_0x446e('0xc')]('UserChatQueue,\x20%s,\x20%s',_0x646536,_0x446e('0xd'));logger[_0x446e('0xe')](_0x446e('0xf'),_0x646536,_0x446e('0xd'),JSON[_0x446e('0x10')](_0x16b367));if(_0x16b367[_0x446e('0x11')]){if(_0x16b367[_0x446e('0x11')]['code']===0x1f4){logger[_0x446e('0x11')](_0x446e('0x12'),_0x646536,_0x16b367[_0x446e('0x11')]['message']);return _0x419e38(_0x16b367[_0x446e('0x11')][_0x446e('0x13')]);}logger[_0x446e('0x11')](_0x446e('0x12'),_0x646536,_0x16b367[_0x446e('0x11')][_0x446e('0x13')]);return _0x140920(_0x16b367[_0x446e('0x11')][_0x446e('0x13')]);}else{logger[_0x446e('0xc')]('UserChatQueue,\x20%s,\x20%s',_0x646536,_0x446e('0xd'));_0x140920(_0x16b367['result'][_0x446e('0x13')]);}})['catch'](function(_0x578aa0){logger[_0x446e('0x11')]('UserChatQueue,\x20%s,\x20%s',_0x646536,_0x578aa0);_0x419e38(_0x578aa0);});});} \ No newline at end of file +var _0xd124=['http','request','info','UserChatQueue,\x20%s,\x20%s','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client'];(function(_0x37b13b,_0x3afcd1){var _0x1b0adb=function(_0x3195e0){while(--_0x3195e0){_0x37b13b['push'](_0x37b13b['shift']());}};_0x1b0adb(++_0x3afcd1);}(_0xd124,0xc8));var _0x4d12=function(_0x1acb60,_0x38caf5){_0x1acb60=_0x1acb60-0x0;var _0xb3cb64=_0xd124[_0x1acb60];return _0xb3cb64;};'use strict';var _=require(_0x4d12('0x0'));var util=require(_0x4d12('0x1'));var moment=require(_0x4d12('0x2'));var BPromise=require(_0x4d12('0x3'));var rs=require(_0x4d12('0x4'));var fs=require('fs');var Redis=require(_0x4d12('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4d12('0x6'))(_0x4d12('0x7'));var config=require(_0x4d12('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4d12('0x9')][_0x4d12('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2dc792,_0x367284,_0x3dfeb3){return new BPromise(function(_0x1e020a,_0x21f2ff){return client[_0x4d12('0xb')](_0x2dc792,_0x3dfeb3)['then'](function(_0x5a21c8){logger[_0x4d12('0xc')](_0x4d12('0xd'),_0x367284,'request\x20sent');logger[_0x4d12('0xe')](_0x4d12('0xf'),_0x367284,_0x4d12('0x10'),JSON['stringify'](_0x5a21c8));if(_0x5a21c8[_0x4d12('0x11')]){if(_0x5a21c8[_0x4d12('0x11')][_0x4d12('0x12')]===0x1f4){logger[_0x4d12('0x11')](_0x4d12('0xd'),_0x367284,_0x5a21c8[_0x4d12('0x11')][_0x4d12('0x13')]);return _0x21f2ff(_0x5a21c8[_0x4d12('0x11')][_0x4d12('0x13')]);}logger['error'](_0x4d12('0xd'),_0x367284,_0x5a21c8['error'][_0x4d12('0x13')]);return _0x1e020a(_0x5a21c8[_0x4d12('0x11')][_0x4d12('0x13')]);}else{logger[_0x4d12('0xc')](_0x4d12('0xd'),_0x367284,_0x4d12('0x10'));_0x1e020a(_0x5a21c8[_0x4d12('0x14')][_0x4d12('0x13')]);}})['catch'](function(_0x2e4390){logger[_0x4d12('0x11')](_0x4d12('0xd'),_0x367284,_0x2e4390);_0x21f2ff(_0x2e4390);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index cbe69a1..a0e0ea8 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x41974d,_0x1e20a0){var _0x1985de=function(_0x41c676){while(--_0x41c676){_0x41974d['push'](_0x41974d['shift']());}};_0x1985de(++_0x1e20a0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x36f2b2,_0x4dea08){var _0x4a0f99=function(_0x5442b9){while(--_0x5442b9){_0x36f2b2['push'](_0x36f2b2['shift']());}};_0x4a0f99(++_0x4dea08);}(_0x9c44,0x178));var _0x49c4=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x9c44[_0x422905];return _0x33dc6c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 5215d17..f116344 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 _0xe3d9=['sequelize','exports','INTEGER','STRING'];(function(_0x1e2475,_0x55a8fd){var _0x5e19cb=function(_0x25d2e2){while(--_0x25d2e2){_0x1e2475['push'](_0x1e2475['shift']());}};_0x5e19cb(++_0x55a8fd);}(_0xe3d9,0x9c));var _0x9e3d=function(_0x45de9f,_0x3aabdc){_0x45de9f=_0x45de9f-0x0;var _0x5c5712=_0xe3d9[_0x45de9f];return _0x5c5712;};'use strict';var Sequelize=require(_0x9e3d('0x0'));module[_0x9e3d('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x9e3d('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x9e3d('0x3')]}}; \ No newline at end of file +var _0x07ae=['STRING','sequelize','exports','INTEGER'];(function(_0x57cc3f,_0x5da014){var _0xa3008c=function(_0x18b703){while(--_0x18b703){_0x57cc3f['push'](_0x57cc3f['shift']());}};_0xa3008c(++_0x5da014);}(_0x07ae,0xd9));var _0xe07a=function(_0x10c317,_0x36f012){_0x10c317=_0x10c317-0x0;var _0x556cb4=_0x07ae[_0x10c317];return _0x556cb4;};'use strict';var Sequelize=require(_0xe07a('0x0'));module[_0xe07a('0x1')]={'penalty':{'type':Sequelize[_0xe07a('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xe07a('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xe07a('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 849ac4a..b1a633e 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 _0xa9f0=['rimraf','../../config/environment','./userFaxQueue.attributes','UserFaxQueue','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x3d934e,_0x2a9c59){var _0x2c02c7=function(_0x375560){while(--_0x375560){_0x3d934e['push'](_0x3d934e['shift']());}};_0x2c02c7(++_0x2a9c59);}(_0xa9f0,0x1da));var _0x0a9f=function(_0x381389,_0x516390){_0x381389=_0x381389-0x0;var _0xa1c8eb=_0xa9f0[_0x381389];return _0xa1c8eb;};'use strict';var _=require('lodash');var util=require(_0x0a9f('0x0'));var logger=require(_0x0a9f('0x1'))('api');var moment=require(_0x0a9f('0x2'));var BPromise=require(_0x0a9f('0x3'));var rp=require(_0x0a9f('0x4'));var fs=require('fs');var path=require(_0x0a9f('0x5'));var rimraf=require(_0x0a9f('0x6'));var config=require(_0x0a9f('0x7'));var attributes=require(_0x0a9f('0x8'));module['exports']=function(_0x5b3998,_0x856a72){return _0x5b3998['define'](_0x0a9f('0x9'),attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc4ba=['user_has_fax_queues','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./userFaxQueue.attributes','exports','define'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc4ba,0xd9));var _0xac4b=function(_0x3f54e1,_0x2aac41){_0x3f54e1=_0x3f54e1-0x0;var _0x5a0d29=_0xc4ba[_0x3f54e1];return _0x5a0d29;};'use strict';var _=require(_0xac4b('0x0'));var util=require(_0xac4b('0x1'));var logger=require(_0xac4b('0x2'))(_0xac4b('0x3'));var moment=require(_0xac4b('0x4'));var BPromise=require(_0xac4b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xac4b('0x6'));var rimraf=require(_0xac4b('0x7'));var config=require('../../config/environment');var attributes=require(_0xac4b('0x8'));module[_0xac4b('0x9')]=function(_0x5d3cb4,_0x306446){return _0x5d3cb4[_0xac4b('0xa')]('UserFaxQueue',attributes,{'tableName':_0xac4b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index a5f4320..305fd5b 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 _0xbe4d=['message','UserFaxQueue,\x20%s,\x20%s','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','info','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xbe4d,0x1ba));var _0xdbe4=function(_0x235320,_0x40bb62){_0x235320=_0x235320-0x0;var _0x88857d=_0xbe4d[_0x235320];return _0x88857d;};'use strict';var _=require(_0xdbe4('0x0'));var util=require('util');var moment=require(_0xdbe4('0x1'));var BPromise=require(_0xdbe4('0x2'));var rs=require(_0xdbe4('0x3'));var fs=require('fs');var Redis=require(_0xdbe4('0x4'));var db=require(_0xdbe4('0x5'))['db'];var utils=require(_0xdbe4('0x6'));var logger=require(_0xdbe4('0x7'))('rpc');var config=require(_0xdbe4('0x8'));var jayson=require(_0xdbe4('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3fe59a,_0x22696f,_0x99283a){return new BPromise(function(_0x4e984b,_0x23a046){return client[_0xdbe4('0xa')](_0x3fe59a,_0x99283a)['then'](function(_0x4acdca){logger[_0xdbe4('0xb')]('UserFaxQueue,\x20%s,\x20%s',_0x22696f,_0xdbe4('0xc'));logger[_0xdbe4('0xd')](_0xdbe4('0xe'),_0x22696f,'request\x20sent',JSON[_0xdbe4('0xf')](_0x4acdca));if(_0x4acdca[_0xdbe4('0x10')]){if(_0x4acdca[_0xdbe4('0x10')][_0xdbe4('0x11')]===0x1f4){logger[_0xdbe4('0x10')]('UserFaxQueue,\x20%s,\x20%s',_0x22696f,_0x4acdca['error'][_0xdbe4('0x12')]);return _0x23a046(_0x4acdca[_0xdbe4('0x10')][_0xdbe4('0x12')]);}logger['error'](_0xdbe4('0x13'),_0x22696f,_0x4acdca[_0xdbe4('0x10')][_0xdbe4('0x12')]);return _0x4e984b(_0x4acdca[_0xdbe4('0x10')][_0xdbe4('0x12')]);}else{logger[_0xdbe4('0xb')](_0xdbe4('0x13'),_0x22696f,_0xdbe4('0xc'));_0x4e984b(_0x4acdca['result'][_0xdbe4('0x12')]);}})['catch'](function(_0x4f1d4b){logger[_0xdbe4('0x10')]('UserFaxQueue,\x20%s,\x20%s',_0x22696f,_0x4f1d4b);_0x23a046(_0x4f1d4b);});});} \ No newline at end of file +var _0x9bf0=['client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x40b981,_0x4e835e){var _0x24f9ee=function(_0x493484){while(--_0x493484){_0x40b981['push'](_0x40b981['shift']());}};_0x24f9ee(++_0x4e835e);}(_0x9bf0,0xc5));var _0x09bf=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0x9bf0[_0x243b2f];return _0xcb3c2d;};'use strict';var _=require(_0x09bf('0x0'));var util=require(_0x09bf('0x1'));var moment=require(_0x09bf('0x2'));var BPromise=require(_0x09bf('0x3'));var rs=require(_0x09bf('0x4'));var fs=require('fs');var Redis=require(_0x09bf('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x09bf('0x6'));var logger=require(_0x09bf('0x7'))(_0x09bf('0x8'));var config=require(_0x09bf('0x9'));var jayson=require(_0x09bf('0xa'));var client=jayson[_0x09bf('0xb')][_0x09bf('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x15fb41,_0x204b53,_0x3b766c){return new BPromise(function(_0x413d67,_0x57959e){return client[_0x09bf('0xd')](_0x15fb41,_0x3b766c)[_0x09bf('0xe')](function(_0x22d052){logger[_0x09bf('0xf')](_0x09bf('0x10'),_0x204b53,_0x09bf('0x11'));logger[_0x09bf('0x12')](_0x09bf('0x13'),_0x204b53,_0x09bf('0x11'),JSON[_0x09bf('0x14')](_0x22d052));if(_0x22d052[_0x09bf('0x15')]){if(_0x22d052[_0x09bf('0x15')][_0x09bf('0x16')]===0x1f4){logger[_0x09bf('0x15')](_0x09bf('0x10'),_0x204b53,_0x22d052[_0x09bf('0x15')]['message']);return _0x57959e(_0x22d052['error']['message']);}logger['error'](_0x09bf('0x10'),_0x204b53,_0x22d052[_0x09bf('0x15')]['message']);return _0x413d67(_0x22d052[_0x09bf('0x15')][_0x09bf('0x17')]);}else{logger[_0x09bf('0xf')](_0x09bf('0x10'),_0x204b53,_0x09bf('0x11'));_0x413d67(_0x22d052[_0x09bf('0x18')][_0x09bf('0x17')]);}})[_0x09bf('0x19')](function(_0x495e70){logger[_0x09bf('0x15')](_0x09bf('0x10'),_0x204b53,_0x495e70);_0x57959e(_0x495e70);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 61b7831..452a01e 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x47d028,_0x32f0c7){var _0x4ddf14=function(_0x5c0041){while(--_0x5c0041){_0x47d028['push'](_0x47d028['shift']());}};_0x4ddf14(++_0x32f0c7);}(_0x70e0,0x17b));var _0x070e=function(_0x51fb84,_0x1c7f04){_0x51fb84=_0x51fb84-0x0;var _0x1ac65f=_0x70e0[_0x51fb84];return _0x1ac65f;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x47eaa6,_0x4d264d){var _0x3e38ba=function(_0x3d66ad){while(--_0x3d66ad){_0x47eaa6['push'](_0x47eaa6['shift']());}};_0x3e38ba(++_0x4d264d);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index ac9850c..c9ebe29 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 _0xb557=['INTEGER','sequelize','exports'];(function(_0x9a993c,_0x4a507f){var _0x2662b8=function(_0x303fbd){while(--_0x303fbd){_0x9a993c['push'](_0x9a993c['shift']());}};_0x2662b8(++_0x4a507f);}(_0xb557,0xee));var _0x7b55=function(_0x270e9d,_0x23e20b){_0x270e9d=_0x270e9d-0x0;var _0x5076f5=_0xb557[_0x270e9d];return _0x5076f5;};'use strict';var Sequelize=require(_0x7b55('0x0'));module[_0x7b55('0x1')]={'penalty':{'type':Sequelize[_0x7b55('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb33d=['sequelize','exports'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xb33d,0x72));var _0xdb33=function(_0x18af13,_0x1a0693){_0x18af13=_0x18af13-0x0;var _0x37a567=_0xb33d[_0x18af13];return _0x37a567;};'use strict';var Sequelize=require(_0xdb33('0x0'));module[_0xdb33('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 230901c..8713959 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 _0x89c0=['request-promise','path','../../config/environment','exports','define','UserMailQueue','user_has_mail_queues','lodash','util','../../config/logger','api','moment'];(function(_0x379586,_0x5a6641){var _0x31775b=function(_0x11577d){while(--_0x11577d){_0x379586['push'](_0x379586['shift']());}};_0x31775b(++_0x5a6641);}(_0x89c0,0x193));var _0x089c=function(_0x130616,_0x2f330c){_0x130616=_0x130616-0x0;var _0x37e6e9=_0x89c0[_0x130616];return _0x37e6e9;};'use strict';var _=require(_0x089c('0x0'));var util=require(_0x089c('0x1'));var logger=require(_0x089c('0x2'))(_0x089c('0x3'));var moment=require(_0x089c('0x4'));var BPromise=require('bluebird');var rp=require(_0x089c('0x5'));var fs=require('fs');var path=require(_0x089c('0x6'));var rimraf=require('rimraf');var config=require(_0x089c('0x7'));var attributes=require('./userMailQueue.attributes');module[_0x089c('0x8')]=function(_0x2f06f5,_0x1ba5a0){return _0x2f06f5[_0x089c('0x9')](_0x089c('0xa'),attributes,{'tableName':_0x089c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x88d4=['util','api','moment','request-promise','rimraf','../../config/environment','define','UserMailQueue','lodash'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x88d4,0x143));var _0x488d=function(_0x1540ce,_0x1814b0){_0x1540ce=_0x1540ce-0x0;var _0x1b6e26=_0x88d4[_0x1540ce];return _0x1b6e26;};'use strict';var _=require(_0x488d('0x0'));var util=require(_0x488d('0x1'));var logger=require('../../config/logger')(_0x488d('0x2'));var moment=require(_0x488d('0x3'));var BPromise=require('bluebird');var rp=require(_0x488d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x488d('0x5'));var config=require(_0x488d('0x6'));var attributes=require('./userMailQueue.attributes');module['exports']=function(_0x1e7a51,_0x23d432){return _0x1e7a51[_0x488d('0x7')](_0x488d('0x8'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index b9170dc..1796a7a 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 _0xe14b=['../../config/environment','jayson/promise','client','http','then','info','UserMailQueue,\x20%s,\x20%s','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils'];(function(_0x5c3028,_0x3b1fa4){var _0x409263=function(_0xe9479f){while(--_0xe9479f){_0x5c3028['push'](_0x5c3028['shift']());}};_0x409263(++_0x3b1fa4);}(_0xe14b,0x93));var _0xbe14=function(_0x690d91,_0x5787ae){_0x690d91=_0x690d91-0x0;var _0x4ba822=_0xe14b[_0x690d91];return _0x4ba822;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe14('0x2'));var fs=require('fs');var Redis=require(_0xbe14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe14('0x5'));var jayson=require(_0xbe14('0x6'));var client=jayson[_0xbe14('0x7')][_0xbe14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){return client['request'](_0x1d9ade,_0x196fca)[_0xbe14('0x9')](function(_0x6fceff){logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,'request\x20sent');logger['debug'](_0xbe14('0xc'),_0x39387e,_0xbe14('0xd'),JSON['stringify'](_0x6fceff));if(_0x6fceff[_0xbe14('0xe')]){if(_0x6fceff[_0xbe14('0xe')][_0xbe14('0xf')]===0x1f4){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x50f909(_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);}logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x566ae7(_0x6fceff['error']['message']);}else{logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,_0xbe14('0xd'));_0x566ae7(_0x6fceff[_0xbe14('0x11')]['message']);}})[_0xbe14('0x12')](function(_0xe9c3ec){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0xe9c3ec);_0x50f909(_0xe9c3ec);});});} \ No newline at end of file +var _0x7fbe=['request','then','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x3f749f,_0x110493){var _0x179d54=function(_0x53767d){while(--_0x53767d){_0x3f749f['push'](_0x3f749f['shift']());}};_0x179d54(++_0x110493);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x17b287,_0x4bed1c){_0x17b287=_0x17b287-0x0;var _0x177054=_0x7fbe[_0x17b287];return _0x177054;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7fb('0x0'));var BPromise=require(_0xe7fb('0x1'));var rs=require(_0xe7fb('0x2'));var fs=require('fs');var Redis=require(_0xe7fb('0x3'));var db=require(_0xe7fb('0x4'))['db'];var utils=require(_0xe7fb('0x5'));var logger=require(_0xe7fb('0x6'))(_0xe7fb('0x7'));var config=require(_0xe7fb('0x8'));var jayson=require(_0xe7fb('0x9'));var client=jayson[_0xe7fb('0xa')][_0xe7fb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24cd67,_0x1f943f,_0x5ad75b){return new BPromise(function(_0x213ebc,_0x228f6b){return client[_0xe7fb('0xc')](_0x24cd67,_0x5ad75b)[_0xe7fb('0xd')](function(_0x4ba197){logger['info'](_0xe7fb('0xe'),_0x1f943f,_0xe7fb('0xf'));logger[_0xe7fb('0x10')](_0xe7fb('0x11'),_0x1f943f,_0xe7fb('0xf'),JSON[_0xe7fb('0x12')](_0x4ba197));if(_0x4ba197[_0xe7fb('0x13')]){if(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x14')]===0x1f4){logger[_0xe7fb('0x13')](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);return _0x228f6b(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')]['message']);return _0x213ebc(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}else{logger['info'](_0xe7fb('0xe'),_0x1f943f,'request\x20sent');_0x213ebc(_0x4ba197[_0xe7fb('0x16')][_0xe7fb('0x15')]);}})[_0xe7fb('0x17')](function(_0x17e8a8){logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x17e8a8);_0x228f6b(_0x17e8a8);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 7c17b96..ec8ddc1 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 _0x52f9=['isAuthenticated','sendUserNotification','exports','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./userNotification.controller','post'];(function(_0xa4c85,_0x2b52a7){var _0x172c1f=function(_0x149473){while(--_0x149473){_0xa4c85['push'](_0xa4c85['shift']());}};_0x172c1f(++_0x2b52a7);}(_0x52f9,0x125));var _0x952f=function(_0x379465,_0x51b06a){_0x379465=_0x379465-0x0;var _0x5c85f0=_0x52f9[_0x379465];return _0x5c85f0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x952f('0x0'));var timeout=require(_0x952f('0x1'));var express=require(_0x952f('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x952f('0x3'));var interaction=require(_0x952f('0x4'));var config=require('../../config/environment');var controller=require(_0x952f('0x5'));router[_0x952f('0x6')]('/',auth[_0x952f('0x7')](),controller[_0x952f('0x8')]);module[_0x952f('0x9')]=router; \ No newline at end of file +var _0x9974=['../../config/environment','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2a1e27,_0x4b3603){var _0x369b9f=function(_0x46e93b){while(--_0x46e93b){_0x2a1e27['push'](_0x2a1e27['shift']());}};_0x369b9f(++_0x4b3603);}(_0x9974,0x157));var _0x4997=function(_0x1844ee,_0x2b3651){_0x1844ee=_0x1844ee-0x0;var _0x3acb93=_0x9974[_0x1844ee];return _0x3acb93;};'use strict';var multer=require(_0x4997('0x0'));var util=require('util');var path=require(_0x4997('0x1'));var timeout=require(_0x4997('0x2'));var express=require(_0x4997('0x3'));var router=express[_0x4997('0x4')]();var fs_extra=require(_0x4997('0x5'));var auth=require(_0x4997('0x6'));var interaction=require(_0x4997('0x7'));var config=require(_0x4997('0x8'));var controller=require('./userNotification.controller');router['post']('/',auth['isAuthenticated'](),controller['sendUserNotification']);module['exports']=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 64969d5..e1a2cd1 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 _0xcac4=['BOOLEAN','exports','TEXT','STRING'];(function(_0x3bf543,_0x29f3af){var _0x23e596=function(_0x142b82){while(--_0x142b82){_0x3bf543['push'](_0x3bf543['shift']());}};_0x23e596(++_0x29f3af);}(_0xcac4,0x109));var _0x4cac=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0xcac4[_0xefd519];return _0x4bb882;};'use strict';var Sequelize=require('sequelize');module[_0x4cac('0x0')]={'body':{'type':Sequelize[_0x4cac('0x1')]},'senderName':{'type':Sequelize[_0x4cac('0x2')]},'recipientsId':{'type':Sequelize[_0x4cac('0x1')]},'recipientsDescription':{'type':Sequelize[_0x4cac('0x2')]},'beep':{'type':Sequelize[_0x4cac('0x3')]}}; \ No newline at end of file +var _0x236b=['BOOLEAN','sequelize','exports','TEXT','STRING'];(function(_0x4cd665,_0x44f698){var _0x3b3ab6=function(_0x3646a7){while(--_0x3646a7){_0x4cd665['push'](_0x4cd665['shift']());}};_0x3b3ab6(++_0x44f698);}(_0x236b,0x146));var _0xb236=function(_0x430a77,_0x613e38){_0x430a77=_0x430a77-0x0;var _0x2c19f2=_0x236b[_0x430a77];return _0x2c19f2;};'use strict';var Sequelize=require(_0xb236('0x0'));module[_0xb236('0x1')]={'body':{'type':Sequelize[_0xb236('0x2')]},'senderName':{'type':Sequelize[_0xb236('0x3')]},'recipientsId':{'type':Sequelize[_0xb236('0x2')]},'recipientsDescription':{'type':Sequelize[_0xb236('0x3')]},'beep':{'type':Sequelize[_0xb236('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index c5cda27..1ad0736 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 _0x13f3=['destroy','stack','name','send','sendUserNotification','body','text','hasOwnProperty','TemplateId','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Sequelize','Missing\x20\x27view\x27\x20parameter','recipients','error','faxqueue','smsqueue','voicequeue','whatsappqueue','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','beep','SenderId','recipientsId','sortBy','sequelize','transaction','create','recipient','emit','userNotification:send','catch','Template','findOne','html','render','User','union','queue','Queue','ids','forEach','push','all','flatten','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then'];(function(_0x34e9bd,_0xbd53e6){var _0x11ca97=function(_0x13fb89){while(--_0x13fb89){_0x34e9bd['push'](_0x34e9bd['shift']());}};_0x11ca97(++_0xbd53e6);}(_0x13f3,0x16b));var _0x313f=function(_0x39ffd1,_0x299703){_0x39ffd1=_0x39ffd1-0x0;var _0x31267e=_0x13f3[_0x39ffd1];return _0x31267e;};'use strict';var emlformat=require(_0x313f('0x0'));var rimraf=require(_0x313f('0x1'));var zipdir=require(_0x313f('0x2'));var jsonpatch=require(_0x313f('0x3'));var rp=require(_0x313f('0x4'));var moment=require('moment');var BPromise=require(_0x313f('0x5'));var Mustache=require(_0x313f('0x6'));var util=require(_0x313f('0x7'));var path=require(_0x313f('0x8'));var sox=require(_0x313f('0x9'));var csv=require(_0x313f('0xa'));var ejs=require(_0x313f('0xb'));var fs=require('fs');var fs_extra=require(_0x313f('0xc'));var _=require(_0x313f('0xd'));var squel=require(_0x313f('0xe'));var crypto=require(_0x313f('0xf'));var jsforce=require(_0x313f('0x10'));var deskjs=require(_0x313f('0x11'));var toCsv=require(_0x313f('0xa'));var querystring=require(_0x313f('0x12'));var Papa=require(_0x313f('0x13'));var Redis=require(_0x313f('0x14'));var authService=require(_0x313f('0x15'));var qs=require(_0x313f('0x16'));var as=require(_0x313f('0x17'));var hardwareService=require(_0x313f('0x18'));var logger=require(_0x313f('0x19'))('api');var utils=require(_0x313f('0x1a'));var config=require(_0x313f('0x1b'));var licenseUtil=require(_0x313f('0x1c'));var db=require(_0x313f('0x1d'))['db'];config[_0x313f('0x1e')]=_[_0x313f('0x1f')](config['redis'],{'host':_0x313f('0x20'),'port':0x18eb});var socket=require(_0x313f('0x21'))(new Redis(config['redis']));require(_0x313f('0x22'))[_0x313f('0x23')](socket);function respondWithStatusCode(_0x52e65a,_0x38516d){_0x38516d=_0x38516d||0xcc;return function(_0x37491e){if(_0x37491e){return _0x52e65a['sendStatus'](_0x38516d);}return _0x52e65a[_0x313f('0x24')](_0x38516d)[_0x313f('0x25')]();};}function respondWithResult(_0x24e657,_0x73e8fd){_0x73e8fd=_0x73e8fd||0xc8;return function(_0x4fce67){if(_0x4fce67){return _0x24e657[_0x313f('0x24')](_0x73e8fd)[_0x313f('0x26')](_0x4fce67);}};}function respondWithFilteredResult(_0x39a571,_0xa40135){return function(_0x1dd178){if(_0x1dd178){var _0x2a5747=typeof _0xa40135[_0x313f('0x27')]===_0x313f('0x28')&&typeof _0xa40135[_0x313f('0x29')]===_0x313f('0x28');var _0x40edfb=_0x1dd178['count'];var _0x6a0535=_0x2a5747?0x0:_0xa40135[_0x313f('0x27')];var _0x1e0506=_0x2a5747?_0x1dd178[_0x313f('0x2a')]:_0xa40135[_0x313f('0x27')]+_0xa40135['limit'];var _0x13269b;if(_0x1e0506>=_0x40edfb){_0x1e0506=_0x40edfb;_0x13269b=0xc8;}else{_0x13269b=0xce;}_0x39a571[_0x313f('0x24')](_0x13269b);return _0x39a571[_0x313f('0x2b')](_0x313f('0x2c'),_0x6a0535+'-'+_0x1e0506+'/'+_0x40edfb)[_0x313f('0x26')](_0x1dd178);}return null;};}function patchUpdates(_0x2cb232){return function(_0x4595bd){try{jsonpatch['apply'](_0x4595bd,_0x2cb232,!![]);}catch(_0x3e4902){return BPromise[_0x313f('0x2d')](_0x3e4902);}return _0x4595bd[_0x313f('0x2e')]();};}function saveUpdates(_0x25ac00,_0x7a9e2a){return function(_0x1fb7d7){if(_0x1fb7d7){return _0x1fb7d7[_0x313f('0x2f')](_0x25ac00)[_0x313f('0x30')](function(_0x39005c){return _0x39005c;});}return null;};}function removeEntity(_0x3ba8eb,_0x3594e3){return function(_0x4058fa){if(_0x4058fa){return _0x4058fa[_0x313f('0x31')]()['then'](function(){_0x3ba8eb[_0x313f('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd66ecd,_0x78f948){return function(_0x4bf1bc){if(!_0x4bf1bc){_0xd66ecd['sendStatus'](0x194);}return _0x4bf1bc;};}function handleError(_0x4c735a,_0x202447){_0x202447=_0x202447||0x1f4;return function(_0x463aa8){logger['error'](_0x463aa8[_0x313f('0x32')]);if(_0x463aa8[_0x313f('0x33')]){delete _0x463aa8[_0x313f('0x33')];}_0x4c735a[_0x313f('0x24')](_0x202447)[_0x313f('0x34')](_0x463aa8);};}exports[_0x313f('0x35')]=function(_0x36424d,_0x2586aa,_0x4fc4a9){if(!_0x36424d[_0x313f('0x36')]['hasOwnProperty'](_0x313f('0x37'))&&!_0x36424d[_0x313f('0x36')][_0x313f('0x38')](_0x313f('0x39'))){throw new db['Sequelize'][(_0x313f('0x3a'))](_0x313f('0x3b'));}else{if(_0x36424d[_0x313f('0x36')][_0x313f('0x38')](_0x313f('0x39'))&&!_0x36424d[_0x313f('0x36')][_0x313f('0x38')](_0x313f('0x3c'))){throw new db[(_0x313f('0x3d'))]['ValidationError'](_0x313f('0x3e'));}if(!_0x36424d[_0x313f('0x36')]['hasOwnProperty']('recipients')){throw new db['Sequelize'][(_0x313f('0x3a'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x616a53=JSON['parse'](_0x36424d[_0x313f('0x36')][_0x313f('0x3f')]);}catch(_0x13d76c){logger[_0x313f('0x40')](_0x13d76c);throw new db[(_0x313f('0x3d'))][(_0x313f('0x3a'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x14dc39=['chatqueue',_0x313f('0x41'),'mailqueue','openchannelqueue',_0x313f('0x42'),_0x313f('0x43'),_0x313f('0x44'),'team',_0x313f('0x45')];if(_[_0x313f('0x46')](_0x616a53,function(_0x538fd5){return!_[_0x313f('0x47')](_0x14dc39,_0x538fd5[_0x313f('0x48')][_0x313f('0x49')]());})){throw new db[(_0x313f('0x3d'))][(_0x313f('0x3a'))](_0x313f('0x4a'));}}}var _0x1f0288={};_0x1f0288[_0x313f('0x4b')]=_0x36424d[_0x313f('0x36')]['hasOwnProperty'](_0x313f('0x4b'))?_0x36424d['body'][_0x313f('0x4b')]:_0x36424d[_0x313f('0x45')][_0x313f('0x4c')];_0x1f0288[_0x313f('0x4d')]=_['isEmpty'](_0x36424d['body'][_0x313f('0x4d')])?null:_0x36424d[_0x313f('0x36')][_0x313f('0x4d')];_0x1f0288[_0x313f('0x4e')]=_0x36424d[_0x313f('0x36')][_0x313f('0x4e')]||![];_0x1f0288[_0x313f('0x4f')]=_0x36424d[_0x313f('0x45')]['id'];return getContent(_0x36424d['body'])[_0x313f('0x30')](function(_0x6315b8){_0x1f0288[_0x313f('0x36')]=_0x6315b8;return getRecipients(_0x616a53);})[_0x313f('0x30')](function(_0x5b1e7f){_0x1f0288[_0x313f('0x50')]=_[_0x313f('0x51')](_0x5b1e7f)['join'](',');return db[_0x313f('0x52')][_0x313f('0x53')](function(_0x22cb4d){return db['UserNotification'][_0x313f('0x54')](_0x1f0288,{'raw':!![],'transaction':_0x22cb4d})[_0x313f('0x30')](function(_0x28887e){var _0xef1728={'sender':_0x1f0288[_0x313f('0x4b')],'description':_0x1f0288[_0x313f('0x4d')],'content':_0x1f0288[_0x313f('0x36')],'beep':_0x1f0288[_0x313f('0x4e')]};_0x5b1e7f['forEach'](function(_0x81529e){_0xef1728[_0x313f('0x55')]=_0x81529e;socket[_0x313f('0x56')](_0x313f('0x57'),_0xef1728);});return _0x28887e;});});})[_0x313f('0x30')](respondWithResult(_0x2586aa,0xc9))[_0x313f('0x58')](handleError(_0x2586aa,null));};function getContent(_0x3a7811){return new BPromise(function(_0x301a98,_0x20daa8){if(_0x3a7811[_0x313f('0x37')]){_0x301a98(_0x3a7811[_0x313f('0x37')]);return;}return db[_0x313f('0x59')][_0x313f('0x5a')]({'attributes':[_0x313f('0x5b')],'where':{'id':_0x3a7811[_0x313f('0x39')]},'raw':!![]})['then'](function(_0x72698b){if(!_0x72698b)throw new db[(_0x313f('0x3d'))][(_0x313f('0x3a'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x1ec0ec=Mustache[_0x313f('0x5c')](_0x72698b[_0x313f('0x5b')],_0x3a7811[_0x313f('0x3c')]);_0x301a98(_0x1ec0ec);})[_0x313f('0x58')](function(_0x144427){_0x20daa8(_0x144427);});});}function getRecipients(_0x9ba8f8){return new BPromise(function(_0x3cbcf2,_0x4f89b5){var _0x37be11=[];var _0x35d36f=[];_0x9ba8f8['forEach'](function(_0xcfe255){var _0x4802ce=_['startCase'](_0xcfe255['model'][_0x313f('0x49')]());if(_0x4802ce===_0x313f('0x5d')){_0x37be11=_[_0x313f('0x5e')](_0x37be11,_0xcfe255['ids']);}else{if(_[_0x313f('0x47')](_0x4802ce,_0x313f('0x5f')))_0x4802ce=_0x4802ce['replace']('queue',_0x313f('0x60'));_0xcfe255[_0x313f('0x61')][_0x313f('0x62')](function(_0x27cb52){_0x35d36f[_0x313f('0x63')](getAgents(_0x4802ce,_0x27cb52));});}});return BPromise[_0x313f('0x64')](_0x35d36f)[_0x313f('0x30')](function(_0x1b6d92){_0x37be11=_[_0x313f('0x5e')](_0x37be11,_[_0x313f('0x65')](_0x1b6d92));_0x3cbcf2(_0x37be11);})[_0x313f('0x58')](function(_0x51ebc1){_0x4f89b5(_0x51ebc1);});});}function getAgents(_0x214994,_0x15e126){return new BPromise(function(_0x374ee1,_0x171aea){return db[_0x214994][_0x313f('0x5a')]({'where':{'id':_0x15e126}})[_0x313f('0x30')](function(_0x3d94a9){return _0x3d94a9['getAgents']({'attributes':['id'],'raw':!![]})[_0x313f('0x30')](function(_0x5524a4){var _0x4d560b=_[_0x313f('0x66')](_0x5524a4,'id');_0x374ee1(_0x4d560b);});})[_0x313f('0x58')](function(_0x549be0){_0x171aea(_0x549be0);});});} \ No newline at end of file +var _0xb101=['destroy','error','name','sendUserNotification','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','body','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','includes','model','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','beep','SenderId','recipientsId','sortBy','join','transaction','UserNotification','create','forEach','recipient','emit','catch','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','toLowerCase','User','union','ids','queue','replace','push','all','findOne','getAgents','map','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','update','then'];(function(_0xae1a83,_0x1980d4){var _0xdb9da8=function(_0x36fc99){while(--_0x36fc99){_0xae1a83['push'](_0xae1a83['shift']());}};_0xdb9da8(++_0x1980d4);}(_0xb101,0x95));var _0x1b10=function(_0x359dec,_0x1b6e69){_0x359dec=_0x359dec-0x0;var _0x3c8c12=_0xb101[_0x359dec];return _0x3c8c12;};'use strict';var emlformat=require(_0x1b10('0x0'));var rimraf=require(_0x1b10('0x1'));var zipdir=require(_0x1b10('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1b10('0x3'));var moment=require(_0x1b10('0x4'));var BPromise=require(_0x1b10('0x5'));var Mustache=require(_0x1b10('0x6'));var util=require('util');var path=require('path');var sox=require(_0x1b10('0x7'));var csv=require(_0x1b10('0x8'));var ejs=require(_0x1b10('0x9'));var fs=require('fs');var fs_extra=require(_0x1b10('0xa'));var _=require(_0x1b10('0xb'));var squel=require(_0x1b10('0xc'));var crypto=require(_0x1b10('0xd'));var jsforce=require(_0x1b10('0xe'));var deskjs=require(_0x1b10('0xf'));var toCsv=require('to-csv');var querystring=require(_0x1b10('0x10'));var Papa=require('papaparse');var Redis=require(_0x1b10('0x11'));var authService=require(_0x1b10('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1b10('0x13'));var logger=require('../../config/logger')(_0x1b10('0x14'));var utils=require(_0x1b10('0x15'));var config=require(_0x1b10('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x1b10('0x17'))['db'];config[_0x1b10('0x18')]=_['defaults'](config[_0x1b10('0x18')],{'host':_0x1b10('0x19'),'port':0x18eb});var socket=require(_0x1b10('0x1a'))(new Redis(config[_0x1b10('0x18')]));require('./userNotification.socket')['register'](socket);function respondWithStatusCode(_0x9c3945,_0x4497da){_0x4497da=_0x4497da||0xcc;return function(_0x3cbde0){if(_0x3cbde0){return _0x9c3945[_0x1b10('0x1b')](_0x4497da);}return _0x9c3945[_0x1b10('0x1c')](_0x4497da)[_0x1b10('0x1d')]();};}function respondWithResult(_0x454601,_0x4e91c6){_0x4e91c6=_0x4e91c6||0xc8;return function(_0x15af5e){if(_0x15af5e){return _0x454601[_0x1b10('0x1c')](_0x4e91c6)['json'](_0x15af5e);}};}function respondWithFilteredResult(_0x5cdaea,_0x36a891){return function(_0x2f134c){if(_0x2f134c){var _0x3cc4f7=typeof _0x36a891[_0x1b10('0x1e')]===_0x1b10('0x1f')&&typeof _0x36a891['limit']==='undefined';var _0x1c68d5=_0x2f134c[_0x1b10('0x20')];var _0x433072=_0x3cc4f7?0x0:_0x36a891[_0x1b10('0x1e')];var _0x1b8ed4=_0x3cc4f7?_0x2f134c[_0x1b10('0x20')]:_0x36a891[_0x1b10('0x1e')]+_0x36a891[_0x1b10('0x21')];var _0x327a16;if(_0x1b8ed4>=_0x1c68d5){_0x1b8ed4=_0x1c68d5;_0x327a16=0xc8;}else{_0x327a16=0xce;}_0x5cdaea[_0x1b10('0x1c')](_0x327a16);return _0x5cdaea[_0x1b10('0x22')](_0x1b10('0x23'),_0x433072+'-'+_0x1b8ed4+'/'+_0x1c68d5)[_0x1b10('0x24')](_0x2f134c);}return null;};}function patchUpdates(_0x123bf5){return function(_0x40dd43){try{jsonpatch[_0x1b10('0x25')](_0x40dd43,_0x123bf5,!![]);}catch(_0x24134e){return BPromise[_0x1b10('0x26')](_0x24134e);}return _0x40dd43['save']();};}function saveUpdates(_0x549f62,_0x361490){return function(_0x553140){if(_0x553140){return _0x553140[_0x1b10('0x27')](_0x549f62)[_0x1b10('0x28')](function(_0x549b1d){return _0x549b1d;});}return null;};}function removeEntity(_0x2f5456,_0x23f1d2){return function(_0x5aaa5a){if(_0x5aaa5a){return _0x5aaa5a[_0x1b10('0x29')]()[_0x1b10('0x28')](function(){_0x2f5456[_0x1b10('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x602d9f,_0x8e8137){return function(_0x3a53b6){if(!_0x3a53b6){_0x602d9f[_0x1b10('0x1b')](0x194);}return _0x3a53b6;};}function handleError(_0x7b1560,_0x8614a0){_0x8614a0=_0x8614a0||0x1f4;return function(_0x1abf76){logger[_0x1b10('0x2a')](_0x1abf76['stack']);if(_0x1abf76[_0x1b10('0x2b')]){delete _0x1abf76[_0x1b10('0x2b')];}_0x7b1560['status'](_0x8614a0)['send'](_0x1abf76);};}exports[_0x1b10('0x2c')]=function(_0x32fdc6,_0x3187e6,_0x5b84f7){if(!_0x32fdc6['body'][_0x1b10('0x2d')](_0x1b10('0x2e'))&&!_0x32fdc6['body'][_0x1b10('0x2d')](_0x1b10('0x2f'))){throw new db[(_0x1b10('0x30'))][(_0x1b10('0x31'))](_0x1b10('0x32'));}else{if(_0x32fdc6[_0x1b10('0x33')][_0x1b10('0x2d')](_0x1b10('0x2f'))&&!_0x32fdc6[_0x1b10('0x33')][_0x1b10('0x2d')](_0x1b10('0x34'))){throw new db[(_0x1b10('0x30'))][(_0x1b10('0x31'))](_0x1b10('0x35'));}if(!_0x32fdc6[_0x1b10('0x33')][_0x1b10('0x2d')](_0x1b10('0x36'))){throw new db[(_0x1b10('0x30'))][(_0x1b10('0x31'))](_0x1b10('0x37'));}else{try{var _0x1dd174=JSON['parse'](_0x32fdc6[_0x1b10('0x33')]['recipients']);}catch(_0x331020){logger[_0x1b10('0x2a')](_0x331020);throw new db['Sequelize'][(_0x1b10('0x31'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x5bb1dc=['chatqueue','faxqueue',_0x1b10('0x38'),_0x1b10('0x39'),_0x1b10('0x3a'),_0x1b10('0x3b'),_0x1b10('0x3c'),_0x1b10('0x3d'),_0x1b10('0x3e')];if(_['some'](_0x1dd174,function(_0x590bfd){return!_[_0x1b10('0x3f')](_0x5bb1dc,_0x590bfd[_0x1b10('0x40')]['toLowerCase']());})){throw new db[(_0x1b10('0x30'))][(_0x1b10('0x31'))](_0x1b10('0x41'));}}}var _0xf8ae8={};_0xf8ae8[_0x1b10('0x42')]=_0x32fdc6['body'][_0x1b10('0x2d')](_0x1b10('0x42'))?_0x32fdc6[_0x1b10('0x33')][_0x1b10('0x42')]:_0x32fdc6['user'][_0x1b10('0x43')];_0xf8ae8[_0x1b10('0x44')]=_['isEmpty'](_0x32fdc6['body'][_0x1b10('0x44')])?null:_0x32fdc6[_0x1b10('0x33')][_0x1b10('0x44')];_0xf8ae8[_0x1b10('0x45')]=_0x32fdc6['body']['beep']||![];_0xf8ae8[_0x1b10('0x46')]=_0x32fdc6[_0x1b10('0x3e')]['id'];return getContent(_0x32fdc6[_0x1b10('0x33')])[_0x1b10('0x28')](function(_0x3cd002){_0xf8ae8[_0x1b10('0x33')]=_0x3cd002;return getRecipients(_0x1dd174);})[_0x1b10('0x28')](function(_0x2f6347){_0xf8ae8[_0x1b10('0x47')]=_[_0x1b10('0x48')](_0x2f6347)[_0x1b10('0x49')](',');return db['sequelize'][_0x1b10('0x4a')](function(_0x4ce980){return db[_0x1b10('0x4b')][_0x1b10('0x4c')](_0xf8ae8,{'raw':!![],'transaction':_0x4ce980})[_0x1b10('0x28')](function(_0x1e21df){var _0x5590df={'sender':_0xf8ae8['senderName'],'description':_0xf8ae8[_0x1b10('0x44')],'content':_0xf8ae8[_0x1b10('0x33')],'beep':_0xf8ae8[_0x1b10('0x45')]};_0x2f6347[_0x1b10('0x4d')](function(_0x23fd78){_0x5590df[_0x1b10('0x4e')]=_0x23fd78;socket[_0x1b10('0x4f')]('userNotification:send',_0x5590df);});return _0x1e21df;});});})[_0x1b10('0x28')](respondWithResult(_0x3187e6,0xc9))[_0x1b10('0x50')](handleError(_0x3187e6,null));};function getContent(_0x16a9d4){return new BPromise(function(_0x530d87,_0x35ec76){if(_0x16a9d4[_0x1b10('0x2e')]){_0x530d87(_0x16a9d4[_0x1b10('0x2e')]);return;}return db['Template']['findOne']({'attributes':[_0x1b10('0x51')],'where':{'id':_0x16a9d4['TemplateId']},'raw':!![]})[_0x1b10('0x28')](function(_0x11c3b0){if(!_0x11c3b0)throw new db[(_0x1b10('0x30'))][(_0x1b10('0x31'))](_0x1b10('0x52'));var _0x4b584a=Mustache[_0x1b10('0x53')](_0x11c3b0[_0x1b10('0x51')],_0x16a9d4['view']);_0x530d87(_0x4b584a);})['catch'](function(_0x333bfe){_0x35ec76(_0x333bfe);});});}function getRecipients(_0x1a4e3a){return new BPromise(function(_0x3760d5,_0x3c6de9){var _0x1115b7=[];var _0x289249=[];_0x1a4e3a['forEach'](function(_0x21d8b0){var _0x5bb92d=_['startCase'](_0x21d8b0[_0x1b10('0x40')][_0x1b10('0x54')]());if(_0x5bb92d===_0x1b10('0x55')){_0x1115b7=_[_0x1b10('0x56')](_0x1115b7,_0x21d8b0[_0x1b10('0x57')]);}else{if(_['includes'](_0x5bb92d,_0x1b10('0x58')))_0x5bb92d=_0x5bb92d[_0x1b10('0x59')]('queue','Queue');_0x21d8b0[_0x1b10('0x57')][_0x1b10('0x4d')](function(_0x5ec203){_0x289249[_0x1b10('0x5a')](getAgents(_0x5bb92d,_0x5ec203));});}});return BPromise[_0x1b10('0x5b')](_0x289249)[_0x1b10('0x28')](function(_0x20a740){_0x1115b7=_[_0x1b10('0x56')](_0x1115b7,_['flatten'](_0x20a740));_0x3760d5(_0x1115b7);})[_0x1b10('0x50')](function(_0x8d4f92){_0x3c6de9(_0x8d4f92);});});}function getAgents(_0x3ac750,_0x5d54a6){return new BPromise(function(_0x44e8b5,_0x207e7c){return db[_0x3ac750][_0x1b10('0x5c')]({'where':{'id':_0x5d54a6}})['then'](function(_0x554b20){return _0x554b20[_0x1b10('0x5d')]({'attributes':['id'],'raw':!![]})[_0x1b10('0x28')](function(_0xf68793){var _0x1325f2=_[_0x1b10('0x5e')](_0xf68793,'id');_0x44e8b5(_0x1325f2);});})[_0x1b10('0x50')](function(_0x30c401){_0x207e7c(_0x30c401);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 9962190..6c79454 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 _0xc25a=['remove','emit','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x19b813,_0xa845af){var _0x234f54=function(_0x4d71df){while(--_0x4d71df){_0x19b813['push'](_0x19b813['shift']());}};_0x234f54(++_0xa845af);}(_0xc25a,0x1e3));var _0xac25=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0xc25a[_0x819464];return _0x49dcc0;};'use strict';var EventEmitter=require(_0xac25('0x0'));var UserNotification=require(_0xac25('0x1'))['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xac25('0x2')](0x0);var events={'afterCreate':_0xac25('0x3'),'afterUpdate':_0xac25('0x4'),'afterDestroy':_0xac25('0x5')};function emitEvent(_0x21b464){return function(_0x2f6cfd,_0xea8bcc,_0x48dee2){UserNotificationEvents[_0xac25('0x6')](_0x21b464+':'+_0x2f6cfd['id'],_0x2f6cfd);UserNotificationEvents[_0xac25('0x6')](_0x21b464,_0x2f6cfd);_0x48dee2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module[_0xac25('0x7')]=UserNotificationEvents; \ No newline at end of file +var _0x1437=['hook','exports','events','../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x2ceba7,_0x451ce4){var _0x5348eb=function(_0x3596fc){while(--_0x3596fc){_0x2ceba7['push'](_0x2ceba7['shift']());}};_0x5348eb(++_0x451ce4);}(_0x1437,0x16a));var _0x7143=function(_0x5c3df3,_0x3a87bf){_0x5c3df3=_0x5c3df3-0x0;var _0x30154e=_0x1437[_0x5c3df3];return _0x30154e;};'use strict';var EventEmitter=require(_0x7143('0x0'));var UserNotification=require(_0x7143('0x1'))['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x7143('0x2')](0x0);var events={'afterCreate':_0x7143('0x3'),'afterUpdate':_0x7143('0x4'),'afterDestroy':'remove'};function emitEvent(_0x485347){return function(_0x3fc626,_0x3f6420,_0xd47c7){UserNotificationEvents[_0x7143('0x5')](_0x485347+':'+_0x3fc626['id'],_0x3fc626);UserNotificationEvents[_0x7143('0x5')](_0x485347,_0x3fc626);_0xd47c7(null);};}for(var e in events){if(events[_0x7143('0x6')](e)){var event=events[e];UserNotification[_0x7143('0x7')](e,emitEvent(event));}}module[_0x7143('0x8')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index a057c99..596869f 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 _0xdbcc=['define','UserNotification','userNotifications','utf8mb4_unicode_ci','lodash','util','api','request-promise','rimraf','../../config/environment','./userNotification.attributes','exports'];(function(_0x4fb1b8,_0x32d98d){var _0x146c71=function(_0x4bb74e){while(--_0x4bb74e){_0x4fb1b8['push'](_0x4fb1b8['shift']());}};_0x146c71(++_0x32d98d);}(_0xdbcc,0x184));var _0xcdbc=function(_0x68bb97,_0x5f3b08){_0x68bb97=_0x68bb97-0x0;var _0x1e5373=_0xdbcc[_0x68bb97];return _0x1e5373;};'use strict';var _=require(_0xcdbc('0x0'));var util=require(_0xcdbc('0x1'));var logger=require('../../config/logger')(_0xcdbc('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xcdbc('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcdbc('0x4'));var config=require(_0xcdbc('0x5'));var attributes=require(_0xcdbc('0x6'));module[_0xcdbc('0x7')]=function(_0x3d8957,_0xd506d1){return _0x3d8957[_0xcdbc('0x8')](_0xcdbc('0x9'),attributes,{'tableName':_0xcdbc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xcdbc('0xb')});}; \ No newline at end of file +var _0x3a49=['userNotifications','utf8mb4_unicode_ci','lodash','util','api','request-promise','path','rimraf','../../config/environment'];(function(_0x2b6854,_0xf09496){var _0x3a17df=function(_0x580a7a){while(--_0x580a7a){_0x2b6854['push'](_0x2b6854['shift']());}};_0x3a17df(++_0xf09496);}(_0x3a49,0x1a0));var _0x93a4=function(_0x1b6a0f,_0x54ee7){_0x1b6a0f=_0x1b6a0f-0x0;var _0x62078f=_0x3a49[_0x1b6a0f];return _0x62078f;};'use strict';var _=require(_0x93a4('0x0'));var util=require(_0x93a4('0x1'));var logger=require('../../config/logger')(_0x93a4('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x93a4('0x3'));var fs=require('fs');var path=require(_0x93a4('0x4'));var rimraf=require(_0x93a4('0x5'));var config=require(_0x93a4('0x6'));var attributes=require('./userNotification.attributes');module['exports']=function(_0xa57d1d,_0x430edb){return _0xa57d1d['define']('UserNotification',attributes,{'tableName':_0x93a4('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x93a4('0x8')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index a1a4334..b62182a 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 _0x7198=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./userNotification.socket','request','then','info','UserNotification,\x20%s,\x20%s','debug','request\x20sent','stringify','error'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x7198,0x18c));var _0x8719=function(_0x3c4a49,_0x27ff89){_0x3c4a49=_0x3c4a49-0x0;var _0x2ef69d=_0x7198[_0x3c4a49];return _0x2ef69d;};'use strict';var _=require(_0x8719('0x0'));var util=require(_0x8719('0x1'));var moment=require(_0x8719('0x2'));var BPromise=require(_0x8719('0x3'));var rs=require(_0x8719('0x4'));var fs=require('fs');var Redis=require(_0x8719('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8719('0x6'));var logger=require('../../config/logger')(_0x8719('0x7'));var config=require(_0x8719('0x8'));var jayson=require(_0x8719('0x9'));var client=jayson['client'][_0x8719('0xa')]({'port':0x232a});config['redis']=_[_0x8719('0xb')](config[_0x8719('0xc')],{'host':_0x8719('0xd'),'port':0x18eb});var socket=require(_0x8719('0xe'))(new Redis(config['redis']));require(_0x8719('0xf'))['register'](socket);function respondWithRpcPromise(_0x1bba9f,_0x10b3f6,_0x37661d){return new BPromise(function(_0x1b5eb3,_0x3d325d){return client[_0x8719('0x10')](_0x1bba9f,_0x37661d)[_0x8719('0x11')](function(_0x5c2f7d){logger[_0x8719('0x12')](_0x8719('0x13'),_0x10b3f6,'request\x20sent');logger[_0x8719('0x14')]('UserNotification,\x20%s,\x20%s,\x20%s',_0x10b3f6,_0x8719('0x15'),JSON[_0x8719('0x16')](_0x5c2f7d));if(_0x5c2f7d[_0x8719('0x17')]){if(_0x5c2f7d[_0x8719('0x17')][_0x8719('0x18')]===0x1f4){logger[_0x8719('0x17')](_0x8719('0x13'),_0x10b3f6,_0x5c2f7d[_0x8719('0x17')][_0x8719('0x19')]);return _0x3d325d(_0x5c2f7d[_0x8719('0x17')]['message']);}logger[_0x8719('0x17')](_0x8719('0x13'),_0x10b3f6,_0x5c2f7d[_0x8719('0x17')][_0x8719('0x19')]);return _0x1b5eb3(_0x5c2f7d[_0x8719('0x17')]['message']);}else{logger['info'](_0x8719('0x13'),_0x10b3f6,'request\x20sent');_0x1b5eb3(_0x5c2f7d[_0x8719('0x1a')][_0x8719('0x19')]);}})[_0x8719('0x1b')](function(_0x4f4094){logger['error'](_0x8719('0x13'),_0x10b3f6,_0x4f4094);_0x3d325d(_0x4f4094);});});} \ No newline at end of file +var _0xe7fe=['error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./userNotification.socket','register','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x149d65,_0x4e029f){var _0x4ae3f6=function(_0x3f0397){while(--_0x3f0397){_0x149d65['push'](_0x149d65['shift']());}};_0x4ae3f6(++_0x4e029f);}(_0xe7fe,0x1ea));var _0xee7f=function(_0x3455bd,_0x1a0fec){_0x3455bd=_0x3455bd-0x0;var _0x3148ce=_0xe7fe[_0x3455bd];return _0x3148ce;};'use strict';var _=require(_0xee7f('0x0'));var util=require(_0xee7f('0x1'));var moment=require(_0xee7f('0x2'));var BPromise=require(_0xee7f('0x3'));var rs=require(_0xee7f('0x4'));var fs=require('fs');var Redis=require(_0xee7f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xee7f('0x6'));var logger=require(_0xee7f('0x7'))('rpc');var config=require(_0xee7f('0x8'));var jayson=require(_0xee7f('0x9'));var client=jayson[_0xee7f('0xa')][_0xee7f('0xb')]({'port':0x232a});config[_0xee7f('0xc')]=_['defaults'](config['redis'],{'host':_0xee7f('0xd'),'port':0x18eb});var socket=require(_0xee7f('0xe'))(new Redis(config[_0xee7f('0xc')]));require(_0xee7f('0xf'))[_0xee7f('0x10')](socket);function respondWithRpcPromise(_0x1addbe,_0x1e7d6a,_0x409508){return new BPromise(function(_0x3c47f7,_0x58fa67){return client['request'](_0x1addbe,_0x409508)['then'](function(_0x136195){logger[_0xee7f('0x11')](_0xee7f('0x12'),_0x1e7d6a,_0xee7f('0x13'));logger[_0xee7f('0x14')](_0xee7f('0x15'),_0x1e7d6a,_0xee7f('0x13'),JSON[_0xee7f('0x16')](_0x136195));if(_0x136195[_0xee7f('0x17')]){if(_0x136195[_0xee7f('0x17')][_0xee7f('0x18')]===0x1f4){logger[_0xee7f('0x17')](_0xee7f('0x12'),_0x1e7d6a,_0x136195[_0xee7f('0x17')]['message']);return _0x58fa67(_0x136195[_0xee7f('0x17')][_0xee7f('0x19')]);}logger['error'](_0xee7f('0x12'),_0x1e7d6a,_0x136195[_0xee7f('0x17')][_0xee7f('0x19')]);return _0x3c47f7(_0x136195['error']['message']);}else{logger[_0xee7f('0x11')](_0xee7f('0x12'),_0x1e7d6a,_0xee7f('0x13'));_0x3c47f7(_0x136195[_0xee7f('0x1a')][_0xee7f('0x19')]);}})['catch'](function(_0x265c22){logger['error'](_0xee7f('0x12'),_0x1e7d6a,_0x265c22);_0x58fa67(_0x265c22);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 7e71da8..412d929 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 _0x423a=['save','update','emit','removeListener','register','length','./userNotification.events'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x423a,0x1cd));var _0xa423=function(_0x4b4d09,_0x2da2ba){_0x4b4d09=_0x4b4d09-0x0;var _0x4769dd=_0x423a[_0x4b4d09];return _0x4769dd;};'use strict';var UserNotificationEvents=require(_0xa423('0x0'));var events=[_0xa423('0x1'),'remove',_0xa423('0x2')];function createListener(_0x5ca797,_0x31d6ca){return function(_0x5d31c2){_0x31d6ca[_0xa423('0x3')](_0x5ca797,_0x5d31c2);};}function removeListener(_0x426f4c,_0x5f9c88){return function(){UserNotificationEvents[_0xa423('0x4')](_0x426f4c,_0x5f9c88);};}exports[_0xa423('0x5')]=function(_0x1211d3){for(var _0x696f0f=0x0,_0x577268=events[_0xa423('0x6')];_0x696f0f<_0x577268;_0x696f0f++){var _0x2b0497=events[_0x696f0f];var _0x301a69=createListener('userNotification:'+_0x2b0497,_0x1211d3);UserNotificationEvents['on'](_0x2b0497,_0x301a69);}}; \ No newline at end of file +var _0xfa17=['removeListener','userNotification:','./userNotification.events','save','remove','update'];(function(_0x174605,_0x3474e1){var _0xaa6a5b=function(_0x394500){while(--_0x394500){_0x174605['push'](_0x174605['shift']());}};_0xaa6a5b(++_0x3474e1);}(_0xfa17,0xce));var _0x7fa1=function(_0x12fc34,_0x342831){_0x12fc34=_0x12fc34-0x0;var _0x27a778=_0xfa17[_0x12fc34];return _0x27a778;};'use strict';var UserNotificationEvents=require(_0x7fa1('0x0'));var events=[_0x7fa1('0x1'),_0x7fa1('0x2'),_0x7fa1('0x3')];function createListener(_0x7b50aa,_0xacfbfd){return function(_0x3af81a){_0xacfbfd['emit'](_0x7b50aa,_0x3af81a);};}function removeListener(_0x1316b5,_0xaec72d){return function(){UserNotificationEvents[_0x7fa1('0x4')](_0x1316b5,_0xaec72d);};}exports['register']=function(_0x2f64cf){for(var _0x126b52=0x0,_0x57f0eb=events['length'];_0x126b52<_0x57f0eb;_0x126b52++){var _0x5738fc=events[_0x126b52];var _0x56069a=createListener(_0x7fa1('0x5')+_0x5738fc,_0x2f64cf);UserNotificationEvents['on'](_0x5738fc,_0x56069a);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 9d70f87..cff68f4 100644 --- a/server/api/userOpenchannelQueue/index.js +++ b/server/api/userOpenchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x23e9af,_0x29c52c){var _0x2c4f8b=function(_0x1beca1){while(--_0x1beca1){_0x23e9af['push'](_0x23e9af['shift']());}};_0x2c4f8b(++_0x29c52c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x1eff59,_0x195aa6){var _0xa061cd=function(_0x5daf00){while(--_0x5daf00){_0x1eff59['push'](_0x1eff59['shift']());}};_0xa061cd(++_0x195aa6);}(_0x9c44,0x178));var _0x49c4=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x9c44[_0x255d5b];return _0x3e141a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index e53d4c4..e1b964b 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 _0x09f4=['INTEGER','exports'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x09f4,0x1a5));var _0x409f=function(_0x581ff8,_0x1f7b92){_0x581ff8=_0x581ff8-0x0;var _0x4e30b7=_0x09f4[_0x581ff8];return _0x4e30b7;};'use strict';var Sequelize=require('sequelize');module[_0x409f('0x0')]={'penalty':{'type':Sequelize[_0x409f('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5e4b=['INTEGER','sequelize','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5e4b,0x1ab));var _0xb5e4=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x5e4b[_0x30ae5e];return _0x1f2e93;};'use strict';var Sequelize=require(_0xb5e4('0x0'));module[_0xb5e4('0x1')]={'penalty':{'type':Sequelize[_0xb5e4('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 6674717..cb5d588 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 _0xeaf4=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userOpenchannelQueue.attributes','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0xeaf4,0x9a));var _0x4eaf=function(_0x3728ca,_0x4ab0b9){_0x3728ca=_0x3728ca-0x0;var _0x32eade=_0xeaf4[_0x3728ca];return _0x32eade;};'use strict';var _=require(_0x4eaf('0x0'));var util=require(_0x4eaf('0x1'));var logger=require(_0x4eaf('0x2'))(_0x4eaf('0x3'));var moment=require(_0x4eaf('0x4'));var BPromise=require(_0x4eaf('0x5'));var rp=require(_0x4eaf('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4eaf('0x7'));var config=require(_0x4eaf('0x8'));var attributes=require(_0x4eaf('0x9'));module['exports']=function(_0x14bb6a,_0x2eda71){return _0x14bb6a['define'](_0x4eaf('0xa'),attributes,{'tableName':_0x4eaf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x556b=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./userOpenchannelQueue.attributes','exports','define','user_has_openchannel_queues'];(function(_0x438693,_0x3f7d95){var _0x31efd2=function(_0x3e1560){while(--_0x3e1560){_0x438693['push'](_0x438693['shift']());}};_0x31efd2(++_0x3f7d95);}(_0x556b,0x1e1));var _0xb556=function(_0x5de8ca,_0x2dd6b1){_0x5de8ca=_0x5de8ca-0x0;var _0x3c3f5b=_0x556b[_0x5de8ca];return _0x3c3f5b;};'use strict';var _=require(_0xb556('0x0'));var util=require(_0xb556('0x1'));var logger=require(_0xb556('0x2'))(_0xb556('0x3'));var moment=require(_0xb556('0x4'));var BPromise=require(_0xb556('0x5'));var rp=require(_0xb556('0x6'));var fs=require('fs');var path=require(_0xb556('0x7'));var rimraf=require(_0xb556('0x8'));var config=require('../../config/environment');var attributes=require(_0xb556('0x9'));module[_0xb556('0xa')]=function(_0x32217b,_0x3f00a5){return _0x32217b[_0xb556('0xb')]('UserOpenchannelQueue',attributes,{'tableName':_0xb556('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index 616fe79..6f966f7 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 _0x58c8=['request','then','UserOpenchannelQueue,\x20%s,\x20%s','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','request\x20sent','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x5e247f,_0x1007f8){var _0x16bf0a=function(_0x493496){while(--_0x493496){_0x5e247f['push'](_0x5e247f['shift']());}};_0x16bf0a(++_0x1007f8);}(_0x58c8,0x1d9));var _0x858c=function(_0x496f22,_0x3ab002){_0x496f22=_0x496f22-0x0;var _0x58d4f8=_0x58c8[_0x496f22];return _0x58d4f8;};'use strict';var _=require('lodash');var util=require(_0x858c('0x0'));var moment=require('moment');var BPromise=require(_0x858c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x858c('0x2'));var db=require(_0x858c('0x3'))['db'];var utils=require(_0x858c('0x4'));var logger=require(_0x858c('0x5'))(_0x858c('0x6'));var config=require(_0x858c('0x7'));var jayson=require(_0x858c('0x8'));var client=jayson[_0x858c('0x9')][_0x858c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x44ea8e,_0x505ba8,_0x54e592){return new BPromise(function(_0xa04765,_0x3d6b4c){return client[_0x858c('0xb')](_0x44ea8e,_0x54e592)[_0x858c('0xc')](function(_0x1a35ac){logger['info'](_0x858c('0xd'),_0x505ba8,'request\x20sent');logger[_0x858c('0xe')](_0x858c('0xf'),_0x505ba8,'request\x20sent',JSON[_0x858c('0x10')](_0x1a35ac));if(_0x1a35ac[_0x858c('0x11')]){if(_0x1a35ac[_0x858c('0x11')]['code']===0x1f4){logger['error'](_0x858c('0xd'),_0x505ba8,_0x1a35ac[_0x858c('0x11')]['message']);return _0x3d6b4c(_0x1a35ac[_0x858c('0x11')][_0x858c('0x12')]);}logger[_0x858c('0x11')](_0x858c('0xd'),_0x505ba8,_0x1a35ac[_0x858c('0x11')][_0x858c('0x12')]);return _0xa04765(_0x1a35ac[_0x858c('0x11')][_0x858c('0x12')]);}else{logger[_0x858c('0x13')](_0x858c('0xd'),_0x505ba8,_0x858c('0x14'));_0xa04765(_0x1a35ac['result'][_0x858c('0x12')]);}})[_0x858c('0x15')](function(_0x2ac60a){logger[_0x858c('0x11')](_0x858c('0xd'),_0x505ba8,_0x2ac60a);_0x3d6b4c(_0x2ac60a);});});} \ No newline at end of file +var _0x5b5f=['then','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserOpenchannelQueue,\x20%s,\x20%s','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','request'];(function(_0x47abd8,_0x43a755){var _0x1fc84a=function(_0x1b552b){while(--_0x1b552b){_0x47abd8['push'](_0x47abd8['shift']());}};_0x1fc84a(++_0x43a755);}(_0x5b5f,0x1ac));var _0xf5b5=function(_0x22c08b,_0x5ef5f0){_0x22c08b=_0x22c08b-0x0;var _0x439d18=_0x5b5f[_0x22c08b];return _0x439d18;};'use strict';var _=require('lodash');var util=require(_0xf5b5('0x0'));var moment=require('moment');var BPromise=require(_0xf5b5('0x1'));var rs=require(_0xf5b5('0x2'));var fs=require('fs');var Redis=require(_0xf5b5('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf5b5('0x4'));var logger=require('../../config/logger')(_0xf5b5('0x5'));var config=require(_0xf5b5('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xf5b5('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45645b,_0x7e3422,_0x1530c3){return new BPromise(function(_0x1b4053,_0x18efb7){return client[_0xf5b5('0x8')](_0x45645b,_0x1530c3)[_0xf5b5('0x9')](function(_0x4b323c){logger['info']('UserOpenchannelQueue,\x20%s,\x20%s',_0x7e3422,_0xf5b5('0xa'));logger['debug'](_0xf5b5('0xb'),_0x7e3422,'request\x20sent',JSON[_0xf5b5('0xc')](_0x4b323c));if(_0x4b323c[_0xf5b5('0xd')]){if(_0x4b323c[_0xf5b5('0xd')][_0xf5b5('0xe')]===0x1f4){logger[_0xf5b5('0xd')](_0xf5b5('0xf'),_0x7e3422,_0x4b323c[_0xf5b5('0xd')]['message']);return _0x18efb7(_0x4b323c[_0xf5b5('0xd')][_0xf5b5('0x10')]);}logger[_0xf5b5('0xd')](_0xf5b5('0xf'),_0x7e3422,_0x4b323c[_0xf5b5('0xd')][_0xf5b5('0x10')]);return _0x1b4053(_0x4b323c[_0xf5b5('0xd')][_0xf5b5('0x10')]);}else{logger['info'](_0xf5b5('0xf'),_0x7e3422,'request\x20sent');_0x1b4053(_0x4b323c[_0xf5b5('0x11')]['message']);}})[_0xf5b5('0x12')](function(_0x2b6218){logger[_0xf5b5('0xd')](_0xf5b5('0xf'),_0x7e3422,_0x2b6218);_0x18efb7(_0x2b6218);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index d500869..52ab261 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 _0x580f=['/:id/resources','getResources','post','create','clone','addSections','put','destroy','delete','removeResources','exports','multer','util','path','express','Router','fs-extra','../../config/environment','./userProfile.controller','isAuthenticated','index','get','describe','/:id','/:id/sections','getSections'];(function(_0x997fc1,_0x5c50a9){var _0x3dbf14=function(_0x392a0d){while(--_0x392a0d){_0x997fc1['push'](_0x997fc1['shift']());}};_0x3dbf14(++_0x5c50a9);}(_0x580f,0x129));var _0xf580=function(_0x53892d,_0x5217a5){_0x53892d=_0x53892d-0x0;var _0x239f82=_0x580f[_0x53892d];return _0x239f82;};'use strict';var multer=require(_0xf580('0x0'));var util=require(_0xf580('0x1'));var path=require(_0xf580('0x2'));var timeout=require('connect-timeout');var express=require(_0xf580('0x3'));var router=express[_0xf580('0x4')]();var fs_extra=require(_0xf580('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf580('0x6'));var controller=require(_0xf580('0x7'));router['get']('/',auth[_0xf580('0x8')](),controller[_0xf580('0x9')]);router[_0xf580('0xa')]('/describe',auth[_0xf580('0x8')](),controller[_0xf580('0xb')]);router[_0xf580('0xa')](_0xf580('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xf580('0xa')](_0xf580('0xd'),auth[_0xf580('0x8')](),controller[_0xf580('0xe')]);router[_0xf580('0xa')](_0xf580('0xf'),auth[_0xf580('0x8')](),controller[_0xf580('0x10')]);router[_0xf580('0x11')]('/',auth[_0xf580('0x8')](),controller[_0xf580('0x12')]);router[_0xf580('0x11')]('/:id/clone',auth[_0xf580('0x8')](),controller[_0xf580('0x13')]);router[_0xf580('0x11')]('/:id/sections',auth[_0xf580('0x8')](),controller[_0xf580('0x14')]);router['post']('/:id/resources',auth[_0xf580('0x8')](),controller['addResources']);router[_0xf580('0x15')]('/:id',auth[_0xf580('0x8')](),controller['update']);router['delete']('/:id',auth[_0xf580('0x8')](),controller[_0xf580('0x16')]);router['delete'](_0xf580('0xd'),auth['isAuthenticated'](),controller['removeSections']);router[_0xf580('0x17')]('/:id/resources',auth['isAuthenticated'](),controller[_0xf580('0x18')]);module[_0xf580('0x19')]=router; \ No newline at end of file +var _0xafa4=['fs-extra','../../components/interaction/service','./userProfile.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/sections','getResources','post','create','/:id/clone','clone','addSections','addResources','update','delete','destroy','removeSections','/:id/resources','removeResources','multer','util','path','connect-timeout','express','Router'];(function(_0x1a6c4b,_0x3842d9){var _0x3617be=function(_0x45d5c0){while(--_0x45d5c0){_0x1a6c4b['push'](_0x1a6c4b['shift']());}};_0x3617be(++_0x3842d9);}(_0xafa4,0x1ca));var _0x4afa=function(_0x1151c5,_0x3a81b1){_0x1151c5=_0x1151c5-0x0;var _0x2beb31=_0xafa4[_0x1151c5];return _0x2beb31;};'use strict';var multer=require(_0x4afa('0x0'));var util=require(_0x4afa('0x1'));var path=require(_0x4afa('0x2'));var timeout=require(_0x4afa('0x3'));var express=require(_0x4afa('0x4'));var router=express[_0x4afa('0x5')]();var fs_extra=require(_0x4afa('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x4afa('0x7'));var config=require('../../config/environment');var controller=require(_0x4afa('0x8'));router[_0x4afa('0x9')]('/',auth[_0x4afa('0xa')](),controller[_0x4afa('0xb')]);router[_0x4afa('0x9')](_0x4afa('0xc'),auth['isAuthenticated'](),controller[_0x4afa('0xd')]);router[_0x4afa('0x9')](_0x4afa('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x4afa('0x9')](_0x4afa('0xf'),auth[_0x4afa('0xa')](),controller['getSections']);router[_0x4afa('0x9')]('/:id/resources',auth[_0x4afa('0xa')](),controller[_0x4afa('0x10')]);router[_0x4afa('0x11')]('/',auth['isAuthenticated'](),controller[_0x4afa('0x12')]);router['post'](_0x4afa('0x13'),auth['isAuthenticated'](),controller[_0x4afa('0x14')]);router[_0x4afa('0x11')]('/:id/sections',auth[_0x4afa('0xa')](),controller[_0x4afa('0x15')]);router[_0x4afa('0x11')]('/:id/resources',auth[_0x4afa('0xa')](),controller[_0x4afa('0x16')]);router['put'](_0x4afa('0xe'),auth[_0x4afa('0xa')](),controller[_0x4afa('0x17')]);router[_0x4afa('0x18')](_0x4afa('0xe'),auth['isAuthenticated'](),controller[_0x4afa('0x19')]);router['delete']('/:id/sections',auth[_0x4afa('0xa')](),controller[_0x4afa('0x1a')]);router[_0x4afa('0x18')](_0x4afa('0x1b'),auth[_0x4afa('0xa')](),controller[_0x4afa('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 71491c6..1f6a27a 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 _0x7a5b=['split','BOOLEAN','sequelize','name','STRING','crudPermissions','join','getDataValue'];(function(_0x3d8ca8,_0x1a9764){var _0x517e45=function(_0x641ad9){while(--_0x641ad9){_0x3d8ca8['push'](_0x3d8ca8['shift']());}};_0x517e45(++_0x1a9764);}(_0x7a5b,0x182));var _0xb7a5=function(_0x842063,_0x418163){_0x842063=_0x842063-0x0;var _0x3e5d72=_0x7a5b[_0x842063];return _0x3e5d72;};'use strict';var Sequelize=require(_0xb7a5('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xb7a5('0x1')},'crudPermissions':{'type':Sequelize[_0xb7a5('0x2')],'set':function(_0x329323){this['setDataValue'](_0xb7a5('0x3'),_0x329323?_0x329323[_0xb7a5('0x4')](''):[]);},'get':function(){return this['getDataValue'](_0xb7a5('0x3'))?this[_0xb7a5('0x5')]('crudPermissions')[_0xb7a5('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xb7a5('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xb7a5('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xb7a5('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xb7a5('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xadea=['exports','name','setDataValue','crudPermissions','join','getDataValue','split','STRING','BOOLEAN','sequelize'];(function(_0x3f5ec3,_0x455528){var _0x257bc5=function(_0x550451){while(--_0x550451){_0x3f5ec3['push'](_0x3f5ec3['shift']());}};_0x257bc5(++_0x455528);}(_0xadea,0x17b));var _0xaade=function(_0x39d6a8,_0xc9c91a){_0x39d6a8=_0x39d6a8-0x0;var _0x93f3db=_0xadea[_0x39d6a8];return _0x93f3db;};'use strict';var Sequelize=require(_0xaade('0x0'));module[_0xaade('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xaade('0x2')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x37744a){this[_0xaade('0x3')](_0xaade('0x4'),_0x37744a?_0x37744a[_0xaade('0x5')](''):[]);},'get':function(){return this[_0xaade('0x6')](_0xaade('0x4'))?this[_0xaade('0x6')](_0xaade('0x4'))[_0xaade('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xaade('0x8')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xaade('0x9')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xaade('0x9')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xaade('0x9')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xaade('0x9')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xaade('0x9')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xaade('0x9')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xaade('0x9')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index efc5737..d81237e 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 _0xa9bd=['sequelize','transaction','UserProfileSection','each','autoAssociation','UserProfileResource','userProfileId','Resources','addSections','push','removeSections','ids','enabled','includes','sectionId','subsections','concat','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','nolimit','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','localhost','socket.io-emitter','redis','register','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','error','stack','name','send','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','pick','filter','merge','where','VIRTUAL','includeAll','include','UserProfile','findAll','rows','catch','show','params','options','find','create','body','clone','get','omit','createdAt','updatedAt'];(function(_0x132d9e,_0x4a0839){var _0x40b733=function(_0x30c113){while(--_0x30c113){_0x132d9e['push'](_0x132d9e['shift']());}};_0x40b733(++_0x4a0839);}(_0xa9bd,0x1d6));var _0xda9b=function(_0x3110c6,_0x49b355){_0x3110c6=_0x3110c6-0x0;var _0x442977=_0xa9bd[_0x3110c6];return _0x442977;};'use strict';var emlformat=require(_0xda9b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xda9b('0x1'));var rp=require(_0xda9b('0x2'));var moment=require(_0xda9b('0x3'));var BPromise=require(_0xda9b('0x4'));var Mustache=require(_0xda9b('0x5'));var util=require(_0xda9b('0x6'));var path=require(_0xda9b('0x7'));var sox=require(_0xda9b('0x8'));var csv=require(_0xda9b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xda9b('0xa'));var _=require(_0xda9b('0xb'));var squel=require(_0xda9b('0xc'));var crypto=require(_0xda9b('0xd'));var jsforce=require(_0xda9b('0xe'));var deskjs=require(_0xda9b('0xf'));var toCsv=require('to-csv');var querystring=require(_0xda9b('0x10'));var Papa=require(_0xda9b('0x11'));var Redis=require(_0xda9b('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xda9b('0x13'));var as=require(_0xda9b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xda9b('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xda9b('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xda9b('0x17'),'port':0x18eb});var socket=require(_0xda9b('0x18'))(new Redis(config[_0xda9b('0x19')]));require('./userProfile.socket')[_0xda9b('0x1a')](socket);function respondWithStatusCode(_0x240db8,_0x3dd888){_0x3dd888=_0x3dd888||0xcc;return function(_0x13f5d8){if(_0x13f5d8){return _0x240db8['sendStatus'](_0x3dd888);}return _0x240db8[_0xda9b('0x1b')](_0x3dd888)[_0xda9b('0x1c')]();};}function respondWithResult(_0x22fb1f,_0x4030da){_0x4030da=_0x4030da||0xc8;return function(_0x3d1971){if(_0x3d1971){return _0x22fb1f[_0xda9b('0x1b')](_0x4030da)[_0xda9b('0x1d')](_0x3d1971);}};}function respondWithFilteredResult(_0x3aeddb,_0xf4a06a){return function(_0x54b5b2){if(_0x54b5b2){var _0x38b9d6=typeof _0xf4a06a[_0xda9b('0x1e')]===_0xda9b('0x1f')&&typeof _0xf4a06a[_0xda9b('0x20')]===_0xda9b('0x1f');var _0x49b52d=_0x54b5b2['count'];var _0x33e225=_0x38b9d6?0x0:_0xf4a06a[_0xda9b('0x1e')];var _0x5a4bcb=_0x38b9d6?_0x54b5b2[_0xda9b('0x21')]:_0xf4a06a[_0xda9b('0x1e')]+_0xf4a06a[_0xda9b('0x20')];var _0x5818f4;if(_0x5a4bcb>=_0x49b52d){_0x5a4bcb=_0x49b52d;_0x5818f4=0xc8;}else{_0x5818f4=0xce;}_0x3aeddb[_0xda9b('0x1b')](_0x5818f4);return _0x3aeddb[_0xda9b('0x22')](_0xda9b('0x23'),_0x33e225+'-'+_0x5a4bcb+'/'+_0x49b52d)['json'](_0x54b5b2);}return null;};}function patchUpdates(_0x3881fc){return function(_0xb48841){try{jsonpatch['apply'](_0xb48841,_0x3881fc,!![]);}catch(_0x5771cf){return BPromise['reject'](_0x5771cf);}return _0xb48841[_0xda9b('0x24')]();};}function saveUpdates(_0x3b3dd8,_0x1d27c2){return function(_0x41cfc3){if(_0x41cfc3){return _0x41cfc3[_0xda9b('0x25')](_0x3b3dd8)[_0xda9b('0x26')](function(_0x230e5c){return _0x230e5c;});}return null;};}function removeEntity(_0x52098b,_0x469017){return function(_0x422f91){if(_0x422f91){return _0x422f91[_0xda9b('0x27')]()[_0xda9b('0x26')](function(){_0x52098b[_0xda9b('0x1b')](0xcc)[_0xda9b('0x1c')]();});}};}function handleEntityNotFound(_0x1c860f,_0x296796){return function(_0x218d06){if(!_0x218d06){_0x1c860f['sendStatus'](0x194);}return _0x218d06;};}function handleError(_0x36613c,_0x4f1436){_0x4f1436=_0x4f1436||0x1f4;return function(_0xd89dbb){logger[_0xda9b('0x28')](_0xd89dbb[_0xda9b('0x29')]);if(_0xd89dbb[_0xda9b('0x2a')]){delete _0xd89dbb['name'];}_0x36613c[_0xda9b('0x1b')](_0x4f1436)[_0xda9b('0x2b')](_0xd89dbb);};}exports['index']=function(_0xc8391b,_0x36e4ef){var _0x2ccbc7={},_0x40deef={},_0x5d4b6b={'count':0x0,'rows':[]};var _0x3450d0=_['map'](db['UserProfile'][_0xda9b('0x2c')],function(_0x106be8){return{'name':_0x106be8[_0xda9b('0x2d')],'type':_0x106be8[_0xda9b('0x2e')][_0xda9b('0x2f')]};});_0x40deef[_0xda9b('0x30')]=_[_0xda9b('0x31')](_0x3450d0,_0xda9b('0x2a'));_0x40deef[_0xda9b('0x32')]=_[_0xda9b('0x33')](_0xc8391b['query']);_0x40deef[_0xda9b('0x34')]=_[_0xda9b('0x35')](_0x40deef[_0xda9b('0x30')],_0x40deef['query']);_0x2ccbc7[_0xda9b('0x36')]=_['intersection'](_0x40deef[_0xda9b('0x30')],qs[_0xda9b('0x37')](_0xc8391b[_0xda9b('0x32')][_0xda9b('0x37')]));_0x2ccbc7[_0xda9b('0x36')]=_0x2ccbc7[_0xda9b('0x36')][_0xda9b('0x38')]?_0x2ccbc7['attributes']:_0x40deef[_0xda9b('0x30')];if(!_0xc8391b[_0xda9b('0x32')][_0xda9b('0x39')]('nolimit')){_0x2ccbc7[_0xda9b('0x20')]=qs['limit'](_0xc8391b['query'][_0xda9b('0x20')]);_0x2ccbc7[_0xda9b('0x1e')]=qs[_0xda9b('0x1e')](_0xc8391b[_0xda9b('0x32')][_0xda9b('0x1e')]);}_0x2ccbc7['order']=qs['sort'](_0xc8391b[_0xda9b('0x32')]['sort']);_0x2ccbc7['where']=qs[_0xda9b('0x34')](_[_0xda9b('0x3a')](_0xc8391b[_0xda9b('0x32')],_0x40deef[_0xda9b('0x34')]),_0x3450d0);if(_0xc8391b[_0xda9b('0x32')][_0xda9b('0x3b')]){_0x2ccbc7['where']=_[_0xda9b('0x3c')](_0x2ccbc7[_0xda9b('0x3d')],{'$or':_['map'](_0x3450d0,function(_0x6e03c3){if(_0x6e03c3[_0xda9b('0x2e')]!==_0xda9b('0x3e')){var _0x2b8b2b={};_0x2b8b2b[_0x6e03c3[_0xda9b('0x2a')]]={'$like':'%'+_0xc8391b[_0xda9b('0x32')][_0xda9b('0x3b')]+'%'};return _0x2b8b2b;}})});}_0x2ccbc7=_[_0xda9b('0x3c')]({},_0x2ccbc7,_0xc8391b['options']);var _0x57f6b7={'where':_0x2ccbc7[_0xda9b('0x3d')]};return db['UserProfile']['count'](_0x57f6b7)[_0xda9b('0x26')](function(_0x1badf1){_0x5d4b6b['count']=_0x1badf1;if(_0xc8391b['query'][_0xda9b('0x3f')]){_0x2ccbc7[_0xda9b('0x40')]=[{'all':!![]}];}return db[_0xda9b('0x41')][_0xda9b('0x42')](_0x2ccbc7);})[_0xda9b('0x26')](function(_0x4bd7a8){_0x5d4b6b[_0xda9b('0x43')]=_0x4bd7a8;return _0x5d4b6b;})['then'](respondWithFilteredResult(_0x36e4ef,_0x2ccbc7))[_0xda9b('0x44')](handleError(_0x36e4ef,null));};exports[_0xda9b('0x45')]=function(_0x37cc5a,_0x3aeb72){var _0x2d60fd={'raw':![],'where':{'id':_0x37cc5a[_0xda9b('0x46')]['id']}},_0x437836={};_0x437836[_0xda9b('0x30')]=_['keys'](db[_0xda9b('0x41')][_0xda9b('0x2c')]);_0x437836[_0xda9b('0x32')]=_[_0xda9b('0x33')](_0x37cc5a['query']);_0x437836[_0xda9b('0x34')]=_[_0xda9b('0x35')](_0x437836[_0xda9b('0x30')],_0x437836[_0xda9b('0x32')]);_0x2d60fd[_0xda9b('0x36')]=_[_0xda9b('0x35')](_0x437836['model'],qs['fields'](_0x37cc5a[_0xda9b('0x32')][_0xda9b('0x37')]));_0x2d60fd[_0xda9b('0x36')]=_0x2d60fd['attributes'][_0xda9b('0x38')]?_0x2d60fd['attributes']:_0x437836[_0xda9b('0x30')];if(_0x37cc5a[_0xda9b('0x32')][_0xda9b('0x3f')]){_0x2d60fd[_0xda9b('0x40')]=[{'all':!![]}];}_0x2d60fd=_[_0xda9b('0x3c')]({},_0x2d60fd,_0x37cc5a[_0xda9b('0x47')]);return db[_0xda9b('0x41')][_0xda9b('0x48')](_0x2d60fd)[_0xda9b('0x26')](handleEntityNotFound(_0x3aeb72,null))[_0xda9b('0x26')](respondWithResult(_0x3aeb72,null))[_0xda9b('0x44')](handleError(_0x3aeb72,null));};exports[_0xda9b('0x49')]=function(_0xa0d0c3,_0x5d06ff){return db[_0xda9b('0x41')][_0xda9b('0x49')](_0xa0d0c3[_0xda9b('0x4a')],{})[_0xda9b('0x26')](respondWithResult(_0x5d06ff,0xc9))[_0xda9b('0x44')](handleError(_0x5d06ff,null));};exports[_0xda9b('0x4b')]=function(_0x4e3ab7,_0x3da320){var _0x2e76c0={'where':{'id':_0x4e3ab7[_0xda9b('0x46')]['id']}},_0x10f6d8={};_0x10f6d8[_0xda9b('0x30')]=_[_0xda9b('0x33')](db[_0xda9b('0x41')][_0xda9b('0x2c')]);_0x2e76c0['attributes']=_[_0xda9b('0x35')](_0x10f6d8['model'],qs['fields'](_0x4e3ab7[_0xda9b('0x32')][_0xda9b('0x37')]));_0x2e76c0['attributes']=_0x2e76c0[_0xda9b('0x36')][_0xda9b('0x38')]?_0x2e76c0['attributes']:_0x10f6d8[_0xda9b('0x30')];if(_0x4e3ab7['query'][_0xda9b('0x3f')]){_0x2e76c0[_0xda9b('0x40')]=[{'all':!![]}];}_0x2e76c0=_['merge']({},_0x2e76c0,_0x4e3ab7['options']);return db[_0xda9b('0x41')][_0xda9b('0x48')](_0x2e76c0)[_0xda9b('0x26')](handleEntityNotFound(_0x3da320,null))[_0xda9b('0x26')](function(_0x48867e){if(_0x48867e){var _0x4479c9=_0x48867e[_0xda9b('0x4c')]({'plain':!![]});_0x4479c9=qs[_0xda9b('0x4d')](_0x4479c9,['id',_0xda9b('0x4e'),_0xda9b('0x4f'),'crudPermissions']);_0x4e3ab7['body']=_['omit'](_0x4e3ab7[_0xda9b('0x4a')],['id',_0xda9b('0x4e'),'updatedAt']);return db[_0xda9b('0x50')][_0xda9b('0x51')](function(_0x5a4fb5){return db[_0xda9b('0x41')]['create'](_[_0xda9b('0x3c')](_0x4479c9,_0x4e3ab7['body']),{'include':_0x4e3ab7[_0xda9b('0x32')][_0xda9b('0x3f')]?[{'all':!![]}]:undefined,'transaction':_0x5a4fb5})[_0xda9b('0x26')](function(_0xe5a97c){var _0x47ec9d=_0xe5a97c['get']({'plain':!![]});return db[_0xda9b('0x52')]['findAll']({'where':{'userProfileId':_0x4e3ab7['params']['id']},'raw':!![]})[_0xda9b('0x26')](function(_0x144438){if(_0x144438){return BPromise[_0xda9b('0x53')](_0x144438,function(_0x53999b){return new BPromise(function(_0x20c391,_0x47eeaa){if(_0x53999b[_0xda9b('0x54')]===null||_0x53999b[_0xda9b('0x54')]===0x1)_0x20c391(null);return db[_0xda9b('0x55')][_0xda9b('0x42')]({'where':{'sectionId':_0x53999b['id']},'raw':!![]})[_0xda9b('0x26')](function(_0xe8f733){var _0x21b28b=_[_0xda9b('0x31')](_0xe8f733,function(_0x42c547){return qs[_0xda9b('0x4d')](_0x42c547,['id',_0xda9b('0x4e'),_0xda9b('0x4f'),'sectionId']);});_0x20c391(_0x21b28b);})[_0xda9b('0x44')](function(_0x481df0){_0x47eeaa(_0x481df0);});})[_0xda9b('0x26')](function(_0xe8ac8f){var _0x252c17=qs[_0xda9b('0x4d')](_0x53999b,['id',_0xda9b('0x4e'),_0xda9b('0x4f')]);_0x252c17[_0xda9b('0x56')]=_0x47ec9d['id'];if(_0xe8ac8f)_0x252c17[_0xda9b('0x57')]=_0xe8ac8f;return _0x252c17;})[_0xda9b('0x26')](function(_0x3d2bbd){return db[_0xda9b('0x52')][_0xda9b('0x49')](_0x3d2bbd,{'include':[{'model':db[_0xda9b('0x55')],'as':_0xda9b('0x57')}],'raw':!![],'transaction':_0x5a4fb5});});})[_0xda9b('0x26')](function(){return _0x47ec9d;});}});});});}})[_0xda9b('0x26')](respondWithResult(_0x3da320,0xc9))[_0xda9b('0x44')](handleError(_0x3da320,null));};exports['update']=function(_0x1ff0e8,_0xbb2691){if(_0x1ff0e8['body']['id']){delete _0x1ff0e8[_0xda9b('0x4a')]['id'];}return db[_0xda9b('0x41')][_0xda9b('0x48')]({'where':{'id':_0x1ff0e8['params']['id']}})['then'](handleEntityNotFound(_0xbb2691,null))['then'](saveUpdates(_0x1ff0e8['body'],null))[_0xda9b('0x26')](respondWithResult(_0xbb2691,null))[_0xda9b('0x44')](handleError(_0xbb2691,null));};exports[_0xda9b('0x27')]=function(_0x28bf8c,_0x3212e6){return db[_0xda9b('0x41')]['find']({'where':{'id':_0x28bf8c[_0xda9b('0x46')]['id']}})[_0xda9b('0x26')](handleEntityNotFound(_0x3212e6,null))[_0xda9b('0x26')](removeEntity(_0x3212e6,null))[_0xda9b('0x44')](handleError(_0x3212e6,null));};exports['describe']=function(_0x4cc1e6,_0x5c15a4){return db[_0xda9b('0x41')]['describe']()[_0xda9b('0x26')](respondWithResult(_0x5c15a4,null))[_0xda9b('0x44')](handleError(_0x5c15a4,null));};exports[_0xda9b('0x58')]=function(_0x10fd56,_0x35382e){var _0x5cc0a8=_0x10fd56[_0xda9b('0x4a')];return db['UserProfile'][_0xda9b('0x48')]({'where':{'id':_0x10fd56[_0xda9b('0x46')]['id']}})[_0xda9b('0x26')](handleEntityNotFound(_0x35382e,null))['then'](function(_0x1f78b3){if(_0x1f78b3){return db[_0xda9b('0x50')]['transaction'](function(_0x56baf8){return db['UserProfileSection'][_0xda9b('0x27')]({'where':{'userProfileId':_0x10fd56['params']['id'],'sectionId':_[_0xda9b('0x31')](_0x5cc0a8,function(_0x34af01){return _0x34af01['sectionId'];})},'transaction':_0x56baf8})['then'](function(){var _0x49ed92=_[_0xda9b('0x31')](_0x5cc0a8,function(_0x27690f){_0x27690f['userProfileId']=_0x10fd56['params']['id'];return _0x27690f;});var _0x275c92=[];return BPromise['each'](_0x49ed92,function(_0x43e83b){return db[_0xda9b('0x52')][_0xda9b('0x49')](_0x43e83b,{'include':[{'model':db[_0xda9b('0x55')],'as':'Resources'}],'raw':!![],'transaction':_0x56baf8})[_0xda9b('0x26')](function(_0x485210){_0x275c92[_0xda9b('0x59')](_0x485210['get']({'plain':!![]}));});})['then'](function(){return _0x275c92;});});});}})['then'](function(_0x637e7b){return _0x637e7b;})[_0xda9b('0x26')](respondWithResult(_0x35382e,null))[_0xda9b('0x44')](handleError(_0x35382e,null));};exports[_0xda9b('0x5a')]=function(_0x360342,_0x44aece){var _0x2452cc;return db[_0xda9b('0x41')]['find']({'where':{'id':_0x360342[_0xda9b('0x46')]['id']},'attributes':['id',_0xda9b('0x2a')]})[_0xda9b('0x26')](handleEntityNotFound(_0x44aece,null))[_0xda9b('0x26')](function(_0x3dc281){if(_0x3dc281){_0x2452cc=_0x3dc281;return db[_0xda9b('0x52')][_0xda9b('0x27')]({'where':{'userProfileId':_0x360342[_0xda9b('0x46')]['id'],'sectionId':_0x360342['query'][_0xda9b('0x5b')]}});}})[_0xda9b('0x26')](function(){return _0x2452cc;})[_0xda9b('0x26')](respondWithStatusCode(_0x44aece,null))[_0xda9b('0x44')](handleError(_0x44aece,null));};exports['getSections']=function(_0x4e778b,_0x3a6dbd){var _0x30ceae=[];var _0x1010eb=[];return db[_0xda9b('0x52')]['findAll']({'where':{'userProfileId':_0x4e778b['params']['id']},'raw':!![]})[_0xda9b('0x26')](function(_0x34937f){_0x30ceae=_[_0xda9b('0x3b')](_0x34937f,function(_0x1fb1f8){return _0x1fb1f8[_0xda9b('0x5c')]===0x1||_[_0xda9b('0x5d')]([0x3eb,0x709],_0x1fb1f8[_0xda9b('0x5e')]);});if(!_['isEmpty'](_0x30ceae)){return _[_0xda9b('0x31')](_0x30ceae,function(_0x25ac01){return _0x25ac01['sectionId'];});}else{return;}})['then'](function(_0x48685c){if(_0x48685c)_0x1010eb=_0x48685c;if(_[_0xda9b('0x5d')](_0x1010eb,0x64)){var _0x1ac399=_[_0xda9b('0x48')](_0x30ceae,{'sectionId':0x64});return hasDefaultDashboard(_0x1ac399)[_0xda9b('0x26')](function(_0x373e68){return _[_0xda9b('0x31')](_0x30ceae,function(_0xbc002f){if(_0xbc002f[_0xda9b('0x5e')]===0x64){_0xbc002f[_0xda9b('0x5f')]=_0x373e68;}return _0xbc002f;});});}else{return;}})[_0xda9b('0x26')](function(_0x4933c6){if(_0x4933c6)_0x30ceae=_0x4933c6;if(_[_0xda9b('0x5d')](_0x1010eb,0x3eb)){var _0x963ea1=_[_0xda9b('0x48')](_0x30ceae,{'sectionId':0x3eb});return getCustomDashboards(_0x963ea1)['then'](function(_0x53b5b7){return _[_0xda9b('0x31')](_0x30ceae,function(_0x324b56){if(_0x963ea1[_0xda9b('0x5c')]){if(_0x324b56['sectionId']===0x3eb){_0x324b56[_0xda9b('0x5f')]=_0x53b5b7;}}else{if(_0x324b56[_0xda9b('0x5e')]===0x64){if(!_0x324b56[_0xda9b('0x5f')]){_0x324b56['subsections']=[];}_0x324b56['subsections']=_0x324b56['subsections'][_0xda9b('0x60')](_0x53b5b7);}}return _0x324b56;});});}else{return;}})[_0xda9b('0x26')](function(_0x4d1137){if(_0x4d1137)_0x30ceae=_0x4d1137;if(_[_0xda9b('0x5d')](_0x1010eb,0x709)){var _0x2e4df9=_['find'](_0x30ceae,{'sectionId':0x709});return getPlugins(_0x2e4df9)[_0xda9b('0x26')](function(_0x1900b1){if(_0x2e4df9[_0xda9b('0x5c')]){return _[_0xda9b('0x31')](_0x30ceae,function(_0x181b35){if(_0x181b35[_0xda9b('0x5e')]===0x709){_0x181b35[_0xda9b('0x5f')]=_0x1900b1;}return _0x181b35;});}else{var _0x48ea7e={'sectionId':0x76c,'enabled':0x1,'subsections':_0x1900b1};var _0x4478a3=_['map'](_0x30ceae);_0x4478a3['push'](_0x48ea7e);return _0x4478a3;}});}else{return;}})[_0xda9b('0x26')](function(_0xa50e7){if(_0xa50e7)_0x30ceae=_0xa50e7;return _[_0xda9b('0x3b')](_0x30ceae,[_0xda9b('0x5c'),0x1]);})['then'](respondWithResult(_0x3a6dbd,null))[_0xda9b('0x44')](handleError(_0x3a6dbd,null));};function hasDefaultDashboard(_0x546bbd){var _0x286187=[0x65];return new BPromise(function(_0x1ab387,_0x5d58e5){try{if(_0x546bbd[_0xda9b('0x54')]){_0x1ab387(_0x286187);}else{return db[_0xda9b('0x55')][_0xda9b('0x61')]({'where':{'sectionId':_0x546bbd['id']},'raw':!![]})[_0xda9b('0x26')](function(_0x572b59){_0x572b59?_0x1ab387(_0x286187):_0x1ab387();});}}catch(_0x2dfcc1){_0x5d58e5(_0x2dfcc1);}});}function getCustomDashboards(_0x4cb888){var _0x2eae36=[];return new BPromise(function(_0x203274,_0x553506){try{if(_0x4cb888[_0xda9b('0x54')]){return db[_0xda9b('0x62')][_0xda9b('0x42')]({'raw':!![]})[_0xda9b('0x26')](function(_0x441843){_0x441843[_0xda9b('0x63')](function(_0x5b8564){_0x2eae36[_0xda9b('0x59')](_0x5b8564['id']+0x1869f);});_0x203274(_0x2eae36);});}else{return db[_0xda9b('0x55')]['findAll']({'where':{'sectionId':_0x4cb888['id']},'raw':!![]})[_0xda9b('0x26')](function(_0x5cf320){_0x5cf320['forEach'](function(_0x1f612f){_0x2eae36[_0xda9b('0x59')](_0x1f612f[_0xda9b('0x64')]+0x1869f);});_0x203274(_0x2eae36);});}}catch(_0x1a115f){_0x553506(_0x1a115f);}});}function getPlugins(_0x4db009){var _0x312987=[];return new BPromise(function(_0x1ab6f4,_0x1c570e){try{if(_0x4db009['autoAssociation']){return db[_0xda9b('0x65')]['findAll']({'raw':!![]})[_0xda9b('0x26')](function(_0x5154da){_0x5154da[_0xda9b('0x63')](function(_0xc6bef2){_0x312987[_0xda9b('0x59')](_0xc6bef2['id']+0x15b38);});_0x1ab6f4(_0x312987);});}else{return db[_0xda9b('0x55')][_0xda9b('0x42')]({'where':{'sectionId':_0x4db009['id']},'raw':!![]})['then'](function(_0xdda288){_0xdda288[_0xda9b('0x63')](function(_0x57cc28){_0x312987['push'](_0x57cc28['resourceId']+0x15b38);});_0x1ab6f4(_0x312987);});}}catch(_0x56f221){_0x1c570e(_0x56f221);}});}exports[_0xda9b('0x66')]=function(_0x388201,_0x7a0deb){return db[_0xda9b('0x41')]['find']({'where':{'id':_0x388201['params']['id']}})[_0xda9b('0x26')](handleEntityNotFound(_0x7a0deb,null))[_0xda9b('0x26')](function(_0x57dc71){if(_0x57dc71){return db[_0xda9b('0x50')]['transaction'](function(_0x477767){return db[_0xda9b('0x52')]['findAll']({'where':{'userProfileId':_0x388201['params']['id']},'attributes':['id'],'raw':!![]})[_0xda9b('0x26')](function(_0x22e19f){if(_0x22e19f){return db[_0xda9b('0x52')][_0xda9b('0x27')]({'where':{'userProfileId':_0x388201[_0xda9b('0x46')]['id'],'id':_[_0xda9b('0x31')](_0x22e19f,function(_0x4f355c){return _0x4f355c['id'];})},'transaction':_0x477767});}})[_0xda9b('0x26')](function(_0x19018b){var _0x549a45=_[_0xda9b('0x31')](_0x388201['body'],function(_0x9abb67){_0x9abb67[_0xda9b('0x56')]=_0x388201['params']['id'];return _0x9abb67;});return db['UserProfileSection'][_0xda9b('0x67')](_0x549a45,{'raw':!![],'transaction':_0x477767});})[_0xda9b('0x26')](function(_0x470d5d){var _0x420448=_[_0xda9b('0x3b')](_[_0xda9b('0x31')](_0x470d5d,function(_0x40ded4){return _0x40ded4['get']({'plain':!![]});}),{'includeAll':![]});if(_0x420448){return db['UserProfileSection'][_0xda9b('0x42')]({'where':{'userProfileId':_0x388201['params']['id'],'sectionId':_[_0xda9b('0x31')](_0x420448,function(_0x299f80){return _0x299f80[_0xda9b('0x5e')];})},'attributes':['id',_0xda9b('0x5e')],'raw':!![]})[_0xda9b('0x26')](function(_0x4370cd){var _0x314f7d=_['map'](_0x388201[_0xda9b('0x4a')],function(_0x27215d){_0x27215d[_0xda9b('0x56')]=_0x388201[_0xda9b('0x46')]['id'];return _0x27215d;});return db['UserProfileResource'][_0xda9b('0x67')](_0x314f7d,{'raw':!![],'transaction':_0x477767});});}})[_0xda9b('0x44')](handleError(_0x7a0deb,null));});}})['then'](function(_0x1d5ec0){var _0x596183=_['map'](_0x1d5ec0,function(_0x3bd2df){return _0x3bd2df[_0xda9b('0x4c')]({'plain':!![]});});})[_0xda9b('0x26')](respondWithResult(_0x7a0deb,null))[_0xda9b('0x44')](handleError(_0x7a0deb,null));};exports[_0xda9b('0x68')]=function(_0x300440,_0x594767,_0x41b01b){return db[_0xda9b('0x41')][_0xda9b('0x48')]({'where':{'id':_0x300440[_0xda9b('0x46')]['id']}})[_0xda9b('0x26')](handleEntityNotFound(_0x594767,null))[_0xda9b('0x26')](function(_0x32a7d4){if(_0x32a7d4){return _0x32a7d4[_0xda9b('0x68')](_0x300440[_0xda9b('0x32')][_0xda9b('0x5b')]);}})[_0xda9b('0x26')](respondWithStatusCode(_0x594767,null))[_0xda9b('0x44')](handleError(_0x594767,null));};exports[_0xda9b('0x69')]=function(_0x222b5f,_0x298843){var _0xf933c7={};if(!_0x222b5f['query'][_0xda9b('0x6a')])throw new Error(_0xda9b('0x6b'));if(!_0x222b5f[_0xda9b('0x32')][_0xda9b('0x39')](_0xda9b('0x6c'))){_0xf933c7[_0xda9b('0x20')]=qs[_0xda9b('0x20')](_0x222b5f[_0xda9b('0x32')][_0xda9b('0x20')]);_0xf933c7[_0xda9b('0x1e')]=qs[_0xda9b('0x1e')](_0x222b5f['query']['offset']);}return db[_0xda9b('0x41')][_0xda9b('0x48')]({'where':{'id':_0x222b5f[_0xda9b('0x46')]['id']}})[_0xda9b('0x26')](function(_0x204a89){if(!_0x204a89)throw new Error(_0xda9b('0x6d')+_0x222b5f[_0xda9b('0x46')]['id']);return db[_0xda9b('0x41')][_0xda9b('0x69')](_0x222b5f);})[_0xda9b('0x26')](respondWithFilteredResult(_0x298843,_0xf933c7))['catch'](handleError(_0x298843,null));}; \ No newline at end of file +var _0x2602=['removeResources','getResources','section','Missing\x20section\x20parameter','nolimit','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','offset','undefined','limit','count','Content-Range','json','update','then','destroy','end','error','stack','name','send','index','map','UserProfile','rawAttributes','type','key','query','keys','filters','model','attributes','intersection','fields','length','order','sort','pick','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','get','omit','updatedAt','crudPermissions','createdAt','sequelize','transaction','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','UserProfileSection','describe','addSections','push','getSections','filter','enabled','includes','isEmpty','subsections','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate'];(function(_0x19cb41,_0x29f528){var _0x4e8d7a=function(_0x5d2108){while(--_0x5d2108){_0x19cb41['push'](_0x19cb41['shift']());}};_0x4e8d7a(++_0x29f528);}(_0x2602,0x1ca));var _0x2260=function(_0x19dd4a,_0x4be76a){_0x19dd4a=_0x19dd4a-0x0;var _0x3b1a8f=_0x2602[_0x19dd4a];return _0x3b1a8f;};'use strict';var emlformat=require(_0x2260('0x0'));var rimraf=require(_0x2260('0x1'));var zipdir=require(_0x2260('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2260('0x3'));var BPromise=require(_0x2260('0x4'));var Mustache=require(_0x2260('0x5'));var util=require('util');var path=require(_0x2260('0x6'));var sox=require(_0x2260('0x7'));var csv=require('to-csv');var ejs=require(_0x2260('0x8'));var fs=require('fs');var fs_extra=require(_0x2260('0x9'));var _=require(_0x2260('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2260('0xb'));var querystring=require(_0x2260('0xc'));var Papa=require(_0x2260('0xd'));var Redis=require('ioredis');var authService=require(_0x2260('0xe'));var qs=require(_0x2260('0xf'));var as=require(_0x2260('0x10'));var hardwareService=require(_0x2260('0x11'));var logger=require(_0x2260('0x12'))(_0x2260('0x13'));var utils=require(_0x2260('0x14'));var config=require(_0x2260('0x15'));var licenseUtil=require(_0x2260('0x16'));var db=require(_0x2260('0x17'))['db'];config[_0x2260('0x18')]=_[_0x2260('0x19')](config[_0x2260('0x18')],{'host':_0x2260('0x1a'),'port':0x18eb});var socket=require(_0x2260('0x1b'))(new Redis(config[_0x2260('0x18')]));require(_0x2260('0x1c'))[_0x2260('0x1d')](socket);function respondWithStatusCode(_0x27812b,_0x49682b){_0x49682b=_0x49682b||0xcc;return function(_0x9c26ac){if(_0x9c26ac){return _0x27812b[_0x2260('0x1e')](_0x49682b);}return _0x27812b[_0x2260('0x1f')](_0x49682b)['end']();};}function respondWithResult(_0x46f519,_0x2cec33){_0x2cec33=_0x2cec33||0xc8;return function(_0x11a161){if(_0x11a161){return _0x46f519[_0x2260('0x1f')](_0x2cec33)['json'](_0x11a161);}};}function respondWithFilteredResult(_0x511e6c,_0x3a9cb8){return function(_0xc22355){if(_0xc22355){var _0x45767c=typeof _0x3a9cb8[_0x2260('0x20')]===_0x2260('0x21')&&typeof _0x3a9cb8[_0x2260('0x22')]===_0x2260('0x21');var _0xe13959=_0xc22355[_0x2260('0x23')];var _0x40c0e0=_0x45767c?0x0:_0x3a9cb8['offset'];var _0x1f42e9=_0x45767c?_0xc22355['count']:_0x3a9cb8[_0x2260('0x20')]+_0x3a9cb8[_0x2260('0x22')];var _0x3f714a;if(_0x1f42e9>=_0xe13959){_0x1f42e9=_0xe13959;_0x3f714a=0xc8;}else{_0x3f714a=0xce;}_0x511e6c[_0x2260('0x1f')](_0x3f714a);return _0x511e6c['set'](_0x2260('0x24'),_0x40c0e0+'-'+_0x1f42e9+'/'+_0xe13959)[_0x2260('0x25')](_0xc22355);}return null;};}function patchUpdates(_0x3fa978){return function(_0x2e88e4){try{jsonpatch['apply'](_0x2e88e4,_0x3fa978,!![]);}catch(_0x5e66de){return BPromise['reject'](_0x5e66de);}return _0x2e88e4['save']();};}function saveUpdates(_0x5edcc8,_0x2b4fc3){return function(_0x3fd978){if(_0x3fd978){return _0x3fd978[_0x2260('0x26')](_0x5edcc8)[_0x2260('0x27')](function(_0x5342b3){return _0x5342b3;});}return null;};}function removeEntity(_0x1c9f2e,_0x3bb8e1){return function(_0x1308d4){if(_0x1308d4){return _0x1308d4[_0x2260('0x28')]()[_0x2260('0x27')](function(){_0x1c9f2e[_0x2260('0x1f')](0xcc)[_0x2260('0x29')]();});}};}function handleEntityNotFound(_0x53b58a,_0x1f616a){return function(_0x11ac00){if(!_0x11ac00){_0x53b58a[_0x2260('0x1e')](0x194);}return _0x11ac00;};}function handleError(_0x4ff607,_0x34bd93){_0x34bd93=_0x34bd93||0x1f4;return function(_0x5b2df7){logger[_0x2260('0x2a')](_0x5b2df7[_0x2260('0x2b')]);if(_0x5b2df7[_0x2260('0x2c')]){delete _0x5b2df7['name'];}_0x4ff607[_0x2260('0x1f')](_0x34bd93)[_0x2260('0x2d')](_0x5b2df7);};}exports[_0x2260('0x2e')]=function(_0x533dda,_0x2f3d05){var _0x42c523={},_0xc69186={},_0x3c07fe={'count':0x0,'rows':[]};var _0x38c118=_[_0x2260('0x2f')](db[_0x2260('0x30')][_0x2260('0x31')],function(_0x2b10cc){return{'name':_0x2b10cc['fieldName'],'type':_0x2b10cc[_0x2260('0x32')][_0x2260('0x33')]};});_0xc69186['model']=_[_0x2260('0x2f')](_0x38c118,_0x2260('0x2c'));_0xc69186[_0x2260('0x34')]=_[_0x2260('0x35')](_0x533dda[_0x2260('0x34')]);_0xc69186[_0x2260('0x36')]=_['intersection'](_0xc69186[_0x2260('0x37')],_0xc69186['query']);_0x42c523[_0x2260('0x38')]=_[_0x2260('0x39')](_0xc69186['model'],qs[_0x2260('0x3a')](_0x533dda[_0x2260('0x34')][_0x2260('0x3a')]));_0x42c523[_0x2260('0x38')]=_0x42c523[_0x2260('0x38')][_0x2260('0x3b')]?_0x42c523[_0x2260('0x38')]:_0xc69186[_0x2260('0x37')];if(!_0x533dda[_0x2260('0x34')]['hasOwnProperty']('nolimit')){_0x42c523['limit']=qs[_0x2260('0x22')](_0x533dda[_0x2260('0x34')][_0x2260('0x22')]);_0x42c523['offset']=qs['offset'](_0x533dda[_0x2260('0x34')][_0x2260('0x20')]);}_0x42c523[_0x2260('0x3c')]=qs[_0x2260('0x3d')](_0x533dda[_0x2260('0x34')][_0x2260('0x3d')]);_0x42c523['where']=qs[_0x2260('0x36')](_[_0x2260('0x3e')](_0x533dda['query'],_0xc69186['filters']),_0x38c118);if(_0x533dda[_0x2260('0x34')]['filter']){_0x42c523[_0x2260('0x3f')]=_[_0x2260('0x40')](_0x42c523[_0x2260('0x3f')],{'$or':_['map'](_0x38c118,function(_0x5357f8){if(_0x5357f8['type']!==_0x2260('0x41')){var _0x3e8e17={};_0x3e8e17[_0x5357f8['name']]={'$like':'%'+_0x533dda[_0x2260('0x34')]['filter']+'%'};return _0x3e8e17;}})});}_0x42c523=_[_0x2260('0x40')]({},_0x42c523,_0x533dda[_0x2260('0x42')]);var _0x4d65d6={'where':_0x42c523['where']};return db[_0x2260('0x30')][_0x2260('0x23')](_0x4d65d6)['then'](function(_0x4c83f7){_0x3c07fe['count']=_0x4c83f7;if(_0x533dda['query'][_0x2260('0x43')]){_0x42c523[_0x2260('0x44')]=[{'all':!![]}];}return db['UserProfile'][_0x2260('0x45')](_0x42c523);})[_0x2260('0x27')](function(_0x3db8f3){_0x3c07fe[_0x2260('0x46')]=_0x3db8f3;return _0x3c07fe;})[_0x2260('0x27')](respondWithFilteredResult(_0x2f3d05,_0x42c523))[_0x2260('0x47')](handleError(_0x2f3d05,null));};exports[_0x2260('0x48')]=function(_0x57de7f,_0x268dc8){var _0x5b1dd4={'raw':![],'where':{'id':_0x57de7f[_0x2260('0x49')]['id']}},_0x479569={};_0x479569['model']=_[_0x2260('0x35')](db[_0x2260('0x30')][_0x2260('0x31')]);_0x479569[_0x2260('0x34')]=_[_0x2260('0x35')](_0x57de7f[_0x2260('0x34')]);_0x479569['filters']=_[_0x2260('0x39')](_0x479569[_0x2260('0x37')],_0x479569[_0x2260('0x34')]);_0x5b1dd4[_0x2260('0x38')]=_['intersection'](_0x479569[_0x2260('0x37')],qs[_0x2260('0x3a')](_0x57de7f['query']['fields']));_0x5b1dd4[_0x2260('0x38')]=_0x5b1dd4[_0x2260('0x38')]['length']?_0x5b1dd4[_0x2260('0x38')]:_0x479569[_0x2260('0x37')];if(_0x57de7f[_0x2260('0x34')][_0x2260('0x43')]){_0x5b1dd4[_0x2260('0x44')]=[{'all':!![]}];}_0x5b1dd4=_[_0x2260('0x40')]({},_0x5b1dd4,_0x57de7f['options']);return db[_0x2260('0x30')]['find'](_0x5b1dd4)['then'](handleEntityNotFound(_0x268dc8,null))[_0x2260('0x27')](respondWithResult(_0x268dc8,null))[_0x2260('0x47')](handleError(_0x268dc8,null));};exports[_0x2260('0x4a')]=function(_0x2f7ea1,_0x21a39d){return db[_0x2260('0x30')][_0x2260('0x4a')](_0x2f7ea1[_0x2260('0x4b')],{})[_0x2260('0x27')](respondWithResult(_0x21a39d,0xc9))[_0x2260('0x47')](handleError(_0x21a39d,null));};exports['clone']=function(_0x4fc974,_0x427b30){var _0x96c720={'where':{'id':_0x4fc974['params']['id']}},_0x55e2bd={};_0x55e2bd[_0x2260('0x37')]=_[_0x2260('0x35')](db[_0x2260('0x30')]['rawAttributes']);_0x96c720['attributes']=_['intersection'](_0x55e2bd[_0x2260('0x37')],qs['fields'](_0x4fc974['query']['fields']));_0x96c720[_0x2260('0x38')]=_0x96c720[_0x2260('0x38')][_0x2260('0x3b')]?_0x96c720['attributes']:_0x55e2bd[_0x2260('0x37')];if(_0x4fc974['query']['includeAll']){_0x96c720['include']=[{'all':!![]}];}_0x96c720=_['merge']({},_0x96c720,_0x4fc974['options']);return db['UserProfile'][_0x2260('0x4c')](_0x96c720)['then'](handleEntityNotFound(_0x427b30,null))['then'](function(_0x13a3c5){if(_0x13a3c5){var _0x181136=_0x13a3c5[_0x2260('0x4d')]({'plain':!![]});_0x181136=qs[_0x2260('0x4e')](_0x181136,['id','createdAt',_0x2260('0x4f'),_0x2260('0x50')]);_0x4fc974['body']=_[_0x2260('0x4e')](_0x4fc974[_0x2260('0x4b')],['id',_0x2260('0x51'),_0x2260('0x4f')]);return db[_0x2260('0x52')][_0x2260('0x53')](function(_0x11d522){return db['UserProfile'][_0x2260('0x4a')](_['merge'](_0x181136,_0x4fc974['body']),{'include':_0x4fc974['query'][_0x2260('0x43')]?[{'all':!![]}]:undefined,'transaction':_0x11d522})[_0x2260('0x27')](function(_0x4f42a4){var _0x4cb9ed=_0x4f42a4[_0x2260('0x4d')]({'plain':!![]});return db['UserProfileSection'][_0x2260('0x45')]({'where':{'userProfileId':_0x4fc974['params']['id']},'raw':!![]})[_0x2260('0x27')](function(_0x2ca46e){if(_0x2ca46e){return BPromise[_0x2260('0x54')](_0x2ca46e,function(_0x58dbc3){return new BPromise(function(_0x2f3745,_0x2e0662){if(_0x58dbc3[_0x2260('0x55')]===null||_0x58dbc3['autoAssociation']===0x1)_0x2f3745(null);return db[_0x2260('0x56')]['findAll']({'where':{'sectionId':_0x58dbc3['id']},'raw':!![]})['then'](function(_0x58fe21){var _0x41b025=_['map'](_0x58fe21,function(_0x41c382){return qs[_0x2260('0x4e')](_0x41c382,['id',_0x2260('0x51'),_0x2260('0x4f'),_0x2260('0x57')]);});_0x2f3745(_0x41b025);})[_0x2260('0x47')](function(_0x1418a9){_0x2e0662(_0x1418a9);});})[_0x2260('0x27')](function(_0x43354c){var _0x33105b=qs[_0x2260('0x4e')](_0x58dbc3,['id',_0x2260('0x51'),_0x2260('0x4f')]);_0x33105b[_0x2260('0x58')]=_0x4cb9ed['id'];if(_0x43354c)_0x33105b[_0x2260('0x59')]=_0x43354c;return _0x33105b;})[_0x2260('0x27')](function(_0x317c34){return db[_0x2260('0x5a')]['create'](_0x317c34,{'include':[{'model':db['UserProfileResource'],'as':_0x2260('0x59')}],'raw':!![],'transaction':_0x11d522});});})[_0x2260('0x27')](function(){return _0x4cb9ed;});}});});});}})['then'](respondWithResult(_0x427b30,0xc9))[_0x2260('0x47')](handleError(_0x427b30,null));};exports[_0x2260('0x26')]=function(_0x477266,_0x5b4fda){if(_0x477266[_0x2260('0x4b')]['id']){delete _0x477266[_0x2260('0x4b')]['id'];}return db[_0x2260('0x30')]['find']({'where':{'id':_0x477266[_0x2260('0x49')]['id']}})[_0x2260('0x27')](handleEntityNotFound(_0x5b4fda,null))[_0x2260('0x27')](saveUpdates(_0x477266[_0x2260('0x4b')],null))[_0x2260('0x27')](respondWithResult(_0x5b4fda,null))['catch'](handleError(_0x5b4fda,null));};exports['destroy']=function(_0xa23d8b,_0x17dc61){return db[_0x2260('0x30')][_0x2260('0x4c')]({'where':{'id':_0xa23d8b[_0x2260('0x49')]['id']}})['then'](handleEntityNotFound(_0x17dc61,null))['then'](removeEntity(_0x17dc61,null))[_0x2260('0x47')](handleError(_0x17dc61,null));};exports[_0x2260('0x5b')]=function(_0x58d892,_0x5bf334){return db[_0x2260('0x30')][_0x2260('0x5b')]()[_0x2260('0x27')](respondWithResult(_0x5bf334,null))[_0x2260('0x47')](handleError(_0x5bf334,null));};exports[_0x2260('0x5c')]=function(_0x3e086d,_0x16844f){var _0x42cf8f=_0x3e086d['body'];return db[_0x2260('0x30')]['find']({'where':{'id':_0x3e086d['params']['id']}})[_0x2260('0x27')](handleEntityNotFound(_0x16844f,null))[_0x2260('0x27')](function(_0x43f3f2){if(_0x43f3f2){return db[_0x2260('0x52')][_0x2260('0x53')](function(_0xbb77ac){return db['UserProfileSection'][_0x2260('0x28')]({'where':{'userProfileId':_0x3e086d[_0x2260('0x49')]['id'],'sectionId':_[_0x2260('0x2f')](_0x42cf8f,function(_0x28ec05){return _0x28ec05[_0x2260('0x57')];})},'transaction':_0xbb77ac})[_0x2260('0x27')](function(){var _0x23f474=_['map'](_0x42cf8f,function(_0x388a00){_0x388a00[_0x2260('0x58')]=_0x3e086d['params']['id'];return _0x388a00;});var _0x18b30f=[];return BPromise['each'](_0x23f474,function(_0x2f3585){return db[_0x2260('0x5a')][_0x2260('0x4a')](_0x2f3585,{'include':[{'model':db[_0x2260('0x56')],'as':'Resources'}],'raw':!![],'transaction':_0xbb77ac})[_0x2260('0x27')](function(_0x986465){_0x18b30f[_0x2260('0x5d')](_0x986465['get']({'plain':!![]}));});})[_0x2260('0x27')](function(){return _0x18b30f;});});});}})[_0x2260('0x27')](function(_0x3005bc){return _0x3005bc;})[_0x2260('0x27')](respondWithResult(_0x16844f,null))[_0x2260('0x47')](handleError(_0x16844f,null));};exports['removeSections']=function(_0x47f69a,_0x5b9cfc){var _0x1db4a5;return db[_0x2260('0x30')][_0x2260('0x4c')]({'where':{'id':_0x47f69a['params']['id']},'attributes':['id',_0x2260('0x2c')]})['then'](handleEntityNotFound(_0x5b9cfc,null))[_0x2260('0x27')](function(_0x5c259d){if(_0x5c259d){_0x1db4a5=_0x5c259d;return db[_0x2260('0x5a')][_0x2260('0x28')]({'where':{'userProfileId':_0x47f69a[_0x2260('0x49')]['id'],'sectionId':_0x47f69a['query']['ids']}});}})[_0x2260('0x27')](function(){return _0x1db4a5;})['then'](respondWithStatusCode(_0x5b9cfc,null))[_0x2260('0x47')](handleError(_0x5b9cfc,null));};exports[_0x2260('0x5e')]=function(_0x443b70,_0x1d6b0a){var _0x19d94f=[];var _0x60939=[];return db[_0x2260('0x5a')][_0x2260('0x45')]({'where':{'userProfileId':_0x443b70[_0x2260('0x49')]['id']},'raw':!![]})[_0x2260('0x27')](function(_0x34ec2d){_0x19d94f=_[_0x2260('0x5f')](_0x34ec2d,function(_0x4c31bf){return _0x4c31bf[_0x2260('0x60')]===0x1||_[_0x2260('0x61')]([0x3eb,0x709],_0x4c31bf[_0x2260('0x57')]);});if(!_[_0x2260('0x62')](_0x19d94f)){return _['map'](_0x19d94f,function(_0xf66bda){return _0xf66bda[_0x2260('0x57')];});}else{return;}})[_0x2260('0x27')](function(_0x25ff74){if(_0x25ff74)_0x60939=_0x25ff74;if(_[_0x2260('0x61')](_0x60939,0x64)){var _0x142fc5=_[_0x2260('0x4c')](_0x19d94f,{'sectionId':0x64});return hasDefaultDashboard(_0x142fc5)[_0x2260('0x27')](function(_0x453a51){return _[_0x2260('0x2f')](_0x19d94f,function(_0x341632){if(_0x341632[_0x2260('0x57')]===0x64){_0x341632[_0x2260('0x63')]=_0x453a51;}return _0x341632;});});}else{return;}})[_0x2260('0x27')](function(_0x263e9b){if(_0x263e9b)_0x19d94f=_0x263e9b;if(_[_0x2260('0x61')](_0x60939,0x3eb)){var _0x18ede8=_[_0x2260('0x4c')](_0x19d94f,{'sectionId':0x3eb});return getCustomDashboards(_0x18ede8)[_0x2260('0x27')](function(_0x88509c){return _['map'](_0x19d94f,function(_0x136d25){if(_0x18ede8[_0x2260('0x60')]){if(_0x136d25[_0x2260('0x57')]===0x3eb){_0x136d25[_0x2260('0x63')]=_0x88509c;}}else{if(_0x136d25[_0x2260('0x57')]===0x64){if(!_0x136d25[_0x2260('0x63')]){_0x136d25[_0x2260('0x63')]=[];}_0x136d25[_0x2260('0x63')]=_0x136d25[_0x2260('0x63')]['concat'](_0x88509c);}}return _0x136d25;});});}else{return;}})['then'](function(_0x512e96){if(_0x512e96)_0x19d94f=_0x512e96;if(_[_0x2260('0x61')](_0x60939,0x709)){var _0x15764e=_[_0x2260('0x4c')](_0x19d94f,{'sectionId':0x709});return getPlugins(_0x15764e)[_0x2260('0x27')](function(_0x175320){if(_0x15764e[_0x2260('0x60')]){return _[_0x2260('0x2f')](_0x19d94f,function(_0x4ffa1c){if(_0x4ffa1c[_0x2260('0x57')]===0x709){_0x4ffa1c[_0x2260('0x63')]=_0x175320;}return _0x4ffa1c;});}else{var _0x14ec38={'sectionId':0x76c,'enabled':0x1,'subsections':_0x175320};var _0x617e9=_[_0x2260('0x2f')](_0x19d94f);_0x617e9[_0x2260('0x5d')](_0x14ec38);return _0x617e9;}});}else{return;}})['then'](function(_0x483029){if(_0x483029)_0x19d94f=_0x483029;return _[_0x2260('0x5f')](_0x19d94f,['enabled',0x1]);})[_0x2260('0x27')](respondWithResult(_0x1d6b0a,null))['catch'](handleError(_0x1d6b0a,null));};function hasDefaultDashboard(_0x2f90bf){var _0x1ed12d=[0x65];return new BPromise(function(_0x1c7659,_0x9b4447){try{if(_0x2f90bf[_0x2260('0x55')]){_0x1c7659(_0x1ed12d);}else{return db[_0x2260('0x56')][_0x2260('0x64')]({'where':{'sectionId':_0x2f90bf['id']},'raw':!![]})['then'](function(_0x3e4d88){_0x3e4d88?_0x1c7659(_0x1ed12d):_0x1c7659();});}}catch(_0x1a899a){_0x9b4447(_0x1a899a);}});}function getCustomDashboards(_0x486883){var _0x7f9a0f=[];return new BPromise(function(_0x393920,_0x5235da){try{if(_0x486883[_0x2260('0x55')]){return db[_0x2260('0x65')][_0x2260('0x45')]({'raw':!![]})[_0x2260('0x27')](function(_0x3151c1){_0x3151c1[_0x2260('0x66')](function(_0xa85066){_0x7f9a0f['push'](_0xa85066['id']+0x1869f);});_0x393920(_0x7f9a0f);});}else{return db[_0x2260('0x56')]['findAll']({'where':{'sectionId':_0x486883['id']},'raw':!![]})['then'](function(_0x4921b8){_0x4921b8[_0x2260('0x66')](function(_0x46558c){_0x7f9a0f['push'](_0x46558c[_0x2260('0x67')]+0x1869f);});_0x393920(_0x7f9a0f);});}}catch(_0x1eb9b6){_0x5235da(_0x1eb9b6);}});}function getPlugins(_0x118936){var _0xcde8da=[];return new BPromise(function(_0x307e68,_0x1297c3){try{if(_0x118936[_0x2260('0x55')]){return db[_0x2260('0x68')][_0x2260('0x45')]({'raw':!![]})['then'](function(_0xfa635e){_0xfa635e[_0x2260('0x66')](function(_0x634423){_0xcde8da[_0x2260('0x5d')](_0x634423['id']+0x15b38);});_0x307e68(_0xcde8da);});}else{return db[_0x2260('0x56')][_0x2260('0x45')]({'where':{'sectionId':_0x118936['id']},'raw':!![]})[_0x2260('0x27')](function(_0x1e3cd0){_0x1e3cd0[_0x2260('0x66')](function(_0x577625){_0xcde8da[_0x2260('0x5d')](_0x577625[_0x2260('0x67')]+0x15b38);});_0x307e68(_0xcde8da);});}}catch(_0xb5f25c){_0x1297c3(_0xb5f25c);}});}exports[_0x2260('0x69')]=function(_0x4bf7d2,_0x1d7f45){return db['UserProfile'][_0x2260('0x4c')]({'where':{'id':_0x4bf7d2[_0x2260('0x49')]['id']}})[_0x2260('0x27')](handleEntityNotFound(_0x1d7f45,null))[_0x2260('0x27')](function(_0x175d22){if(_0x175d22){return db[_0x2260('0x52')][_0x2260('0x53')](function(_0x10d4ff){return db[_0x2260('0x5a')]['findAll']({'where':{'userProfileId':_0x4bf7d2['params']['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x33f7c9){if(_0x33f7c9){return db['UserProfileSection'][_0x2260('0x28')]({'where':{'userProfileId':_0x4bf7d2['params']['id'],'id':_[_0x2260('0x2f')](_0x33f7c9,function(_0x1b13e3){return _0x1b13e3['id'];})},'transaction':_0x10d4ff});}})[_0x2260('0x27')](function(_0x319fee){var _0xdb44f3=_[_0x2260('0x2f')](_0x4bf7d2[_0x2260('0x4b')],function(_0x5433c2){_0x5433c2[_0x2260('0x58')]=_0x4bf7d2[_0x2260('0x49')]['id'];return _0x5433c2;});return db[_0x2260('0x5a')]['bulkCreate'](_0xdb44f3,{'raw':!![],'transaction':_0x10d4ff});})[_0x2260('0x27')](function(_0x3214f6){var _0x4b55e7=_[_0x2260('0x5f')](_[_0x2260('0x2f')](_0x3214f6,function(_0x111cda){return _0x111cda[_0x2260('0x4d')]({'plain':!![]});}),{'includeAll':![]});if(_0x4b55e7){return db[_0x2260('0x5a')]['findAll']({'where':{'userProfileId':_0x4bf7d2[_0x2260('0x49')]['id'],'sectionId':_[_0x2260('0x2f')](_0x4b55e7,function(_0x1b35bf){return _0x1b35bf[_0x2260('0x57')];})},'attributes':['id',_0x2260('0x57')],'raw':!![]})[_0x2260('0x27')](function(_0x18f4be){var _0x55fbaa=_[_0x2260('0x2f')](_0x4bf7d2[_0x2260('0x4b')],function(_0x2b9988){_0x2b9988['userProfileId']=_0x4bf7d2[_0x2260('0x49')]['id'];return _0x2b9988;});return db[_0x2260('0x56')][_0x2260('0x6a')](_0x55fbaa,{'raw':!![],'transaction':_0x10d4ff});});}})[_0x2260('0x47')](handleError(_0x1d7f45,null));});}})['then'](function(_0x3652fb){var _0x1deb32=_['map'](_0x3652fb,function(_0x4469b2){return _0x4469b2[_0x2260('0x4d')]({'plain':!![]});});})[_0x2260('0x27')](respondWithResult(_0x1d7f45,null))[_0x2260('0x47')](handleError(_0x1d7f45,null));};exports[_0x2260('0x6b')]=function(_0x492d71,_0x1dcc16,_0x5434be){return db['UserProfile']['find']({'where':{'id':_0x492d71[_0x2260('0x49')]['id']}})[_0x2260('0x27')](handleEntityNotFound(_0x1dcc16,null))[_0x2260('0x27')](function(_0x1bc403){if(_0x1bc403){return _0x1bc403['removeResources'](_0x492d71[_0x2260('0x34')]['ids']);}})[_0x2260('0x27')](respondWithStatusCode(_0x1dcc16,null))[_0x2260('0x47')](handleError(_0x1dcc16,null));};exports[_0x2260('0x6c')]=function(_0x2a1e7d,_0x2736b4){var _0x51cd91={};if(!_0x2a1e7d[_0x2260('0x34')][_0x2260('0x6d')])throw new Error(_0x2260('0x6e'));if(!_0x2a1e7d[_0x2260('0x34')]['hasOwnProperty'](_0x2260('0x6f'))){_0x51cd91[_0x2260('0x22')]=qs[_0x2260('0x22')](_0x2a1e7d[_0x2260('0x34')][_0x2260('0x22')]);_0x51cd91[_0x2260('0x20')]=qs[_0x2260('0x20')](_0x2a1e7d[_0x2260('0x34')][_0x2260('0x20')]);}return db[_0x2260('0x30')]['find']({'where':{'id':_0x2a1e7d[_0x2260('0x49')]['id']}})['then'](function(_0x47af1f){if(!_0x47af1f)throw new Error(_0x2260('0x70')+_0x2a1e7d[_0x2260('0x49')]['id']);return db[_0x2260('0x30')][_0x2260('0x6c')](_0x2a1e7d);})[_0x2260('0x27')](respondWithFilteredResult(_0x2736b4,_0x51cd91))[_0x2260('0x47')](handleError(_0x2736b4,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index ee2ed0a..8947f92 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 _0xcf71=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserProfile','setMaxListeners'];(function(_0x47123a,_0x5dd137){var _0x2546cb=function(_0x110f67){while(--_0x110f67){_0x47123a['push'](_0x47123a['shift']());}};_0x2546cb(++_0x5dd137);}(_0xcf71,0xba));var _0x1cf7=function(_0x8a2dae,_0x2a21a7){_0x8a2dae=_0x8a2dae-0x0;var _0x308f20=_0xcf71[_0x8a2dae];return _0x308f20;};'use strict';var EventEmitter=require(_0x1cf7('0x0'));var UserProfile=require(_0x1cf7('0x1'))['db'][_0x1cf7('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x1cf7('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1cf7('0x4'),'afterDestroy':_0x1cf7('0x5')};function emitEvent(_0xcc31bf){return function(_0x21307d,_0x11e462,_0x14d074){UserProfileEvents[_0x1cf7('0x6')](_0xcc31bf+':'+_0x21307d['id'],_0x21307d);UserProfileEvents[_0x1cf7('0x6')](_0xcc31bf,_0x21307d);_0x14d074(null);};}for(var e in events){if(events[_0x1cf7('0x7')](e)){var event=events[e];UserProfile[_0x1cf7('0x8')](e,emitEvent(event));}}module[_0x1cf7('0x9')]=UserProfileEvents; \ No newline at end of file +var _0xda81=['exports','events','../../mysqldb','UserProfile','save','update','remove','emit','hook'];(function(_0x45fc5b,_0x1e2464){var _0x4731ae=function(_0x4998af){while(--_0x4998af){_0x45fc5b['push'](_0x45fc5b['shift']());}};_0x4731ae(++_0x1e2464);}(_0xda81,0x1c3));var _0x1da8=function(_0x158169,_0x2b1193){_0x158169=_0x158169-0x0;var _0x16b5c2=_0xda81[_0x158169];return _0x16b5c2;};'use strict';var EventEmitter=require(_0x1da8('0x0'));var UserProfile=require(_0x1da8('0x1'))['db'][_0x1da8('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1da8('0x3'),'afterUpdate':_0x1da8('0x4'),'afterDestroy':_0x1da8('0x5')};function emitEvent(_0x177870){return function(_0x48421c,_0x3357ac,_0x2692c1){UserProfileEvents['emit'](_0x177870+':'+_0x48421c['id'],_0x48421c);UserProfileEvents[_0x1da8('0x6')](_0x177870,_0x48421c);_0x2692c1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0x1da8('0x7')](e,emitEvent(event));}}module[_0x1da8('0x8')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index b302ced..b3e2b76 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 _0x4523=['MailAccount','mailsubstatuses','openchannelqueues','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','teams','Team','voicequeues','users','agents','telephones','admin','zendeskaccounts','ZendeskAccount','salesforceaccounts','freshdeskaccounts','FreshdeskAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','dispositions','customdashboards','intervals','pauses','Pause','scheduler','sounds','tags','templates','Template','triggers','Trigger','trunks','variables','plugins','Plugin','extractedreports','metrics','AnalyticMetric','charAt','slice','Sequelize','QueryTypes','SELECT','select','ui.','InteractionId','ui.createdAt','from','where','ui.UserId\x20=\x20?','sequelize','toString','OpenTabs','define','../../components/parsers/qs','query','mergeResources','Invalid\x20section\x20\x27','length','push','UserProfileSection','find','params','all','ignore','isEmpty','autoAssociation','rawAttributes','keys','filters','attributes','fields','nolimit','limit','offset','order','sort','pick','merge','key','VIRTUAL','foreignKey','forEach','options','includeAll','include','reportType','reportId','DefaultReports','custom','CustomReports','rows','ids','customSorting','extraQueryConditions','count','Tag','Tags','color','tag','openTabs','true','chat','dataValues','fax','openchannel','lodash','./userProfile.attributes','filter','value','findAll','then','associatedResources','map','catch','field','model','name','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','JscriptyProject','contacts','CmContact','Lists','ListId','lists','CmList','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','contexts','voicemails','VoiceMail','voicerecordings','Agents','membername','User','role','agent','Telephones','telephone','VoiceQueues','queue','VoiceQueue','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','ivrcampaigns','Campaign','MailQueue','mailaccounts'];(function(_0x113afc,_0x2c7d5a){var _0x3a9219=function(_0xca2d6b){while(--_0xca2d6b){_0x113afc['push'](_0x113afc['shift']());}};_0x3a9219(++_0x2c7d5a);}(_0x4523,0x1ea));var _0x3452=function(_0x5abbc8,_0xdfe0d6){_0x5abbc8=_0x5abbc8-0x0;var _0x2195d1=_0x4523[_0x5abbc8];return _0x2195d1;};'use strict';var _=require(_0x3452('0x0'));var attributes=require(_0x3452('0x1'));var squel=require('squel');module['exports']=function(_0x7b84a3){var _0x5e0f6b=_0x7b84a3['models'];function _0x69c96b(_0x3e3c9c,_0x42fdd5){return new Promise(function(_0x34aea5,_0x14d6fa){if(!_0x42fdd5)return _0x34aea5(null);var _0x1adde2=_0x42fdd5[_0x3452('0x2')]?{[_0x42fdd5[_0x3452('0x2')]['field']]:_0x42fdd5['filter'][_0x3452('0x3')]}:undefined;return _0x5e0f6b[_0x3e3c9c][_0x3452('0x4')]({'where':_0x1adde2,'raw':!![]})[_0x3452('0x5')](function(_0x573a96){_0x42fdd5[_0x3452('0x6')]=_[_0x3452('0x7')](_0x573a96,'id');_0x34aea5(_0x42fdd5);})[_0x3452('0x8')](function(_0x369d7a){_0x14d6fa(_0x369d7a);});});}function _0x33ef4c(_0x600a8a,_0x2d71df){return new Promise(function(_0x531e0a,_0xde0315){var _0x528eae=_0x600a8a[_0x3452('0x2')]?{[_0x600a8a[_0x3452('0x2')][_0x3452('0x9')]]:_0x600a8a[_0x3452('0x2')]['value']}:undefined;return _0x5e0f6b[_0x600a8a[_0x3452('0xa')]][_0x3452('0x4')]({'where':_0x528eae,'raw':!![]})[_0x3452('0x5')](function(_0x21e93f){_0x2d71df[_0x3452('0x6')]=_[_0x3452('0x7')](_0x21e93f,function(_0x4f5c9c){return _0x4f5c9c[_0x3452('0xb')];});_0x531e0a(_0x2d71df);})[_0x3452('0x8')](function(_0x5bb58a){_0xde0315(_0x5bb58a);});});}function _0x371f50(_0x28c61d,_0x1b0f03,_0x419cd5){if(!_0x1b0f03)return Promise[_0x3452('0xc')](null);return new Promise(function(_0x56e94f,_0x5564b7){return _0x5e0f6b[_0x3452('0xd')][_0x3452('0x4')]({'where':{'sectionId':_0x1b0f03['id']},'raw':!![]})[_0x3452('0x5')](function(_0x3a210c){if(_0x28c61d[_0x3452('0x9')]&&_0x28c61d[_0x3452('0x9')]!=='id'){_0x1b0f03['associatedResources']=_[_0x3452('0x7')](_0x3a210c,function(_0x35de40){return _0x35de40[_0x28c61d['field']];});}else{if(_0x419cd5===_0x3452('0xe')){_0x1b0f03[_0x3452('0x6')]=_[_0x3452('0x7')](_0x3a210c,function(_0x274bfc){return{'id':_0x274bfc[_0x3452('0xf')],'type':_0x274bfc[_0x3452('0x10')]};});}else{_0x1b0f03[_0x3452('0x6')]=_[_0x3452('0x7')](_0x3a210c,function(_0x29c22f){return _0x29c22f['resourceId'];});}}_0x56e94f(_0x1b0f03);})['catch'](function(_0x25e317){_0x5564b7(_0x25e317);});});}function _0x357c8f(_0x42e679,_0x2232c3){var _0x3aa4b6={'parentSections':[]};switch(_0x42e679[_0x3452('0x11')]()){case _0x3452('0x12'):_0x3aa4b6[_0x3452('0x13')]=_0x3452('0x14');break;case'odbc':_0x3aa4b6[_0x3452('0x13')]=_0x3452('0x15');break;case _0x3452('0x16'):_0x3aa4b6['childModel']=_0x3452('0x17');_0x3aa4b6[_0x3452('0x18')]=[{'name':_0x3452('0x19'),'field':_0x3452('0xb'),'foreignKey':'projectName'}];break;case'projects':_0x3aa4b6[_0x3452('0x13')]=_0x3452('0x1a');break;case _0x3452('0x1b'):_0x3aa4b6[_0x3452('0x13')]=_0x3452('0x1c');_0x3aa4b6['parentSections']=[{'name':_0x3452('0x1d'),'field':'id','foreignKey':_0x3452('0x1e')}];break;case _0x3452('0x1f'):_0x3aa4b6[_0x3452('0x13')]=_0x3452('0x20');break;case'companies':_0x3aa4b6[_0x3452('0x13')]=_0x3452('0x21');break;case _0x3452('0x22'):_0x3aa4b6[_0x3452('0x13')]=_0x3452('0x23');break;case _0x3452('0x24'):_0x3aa4b6[_0x3452('0x13')]=_0x3452('0x25');break;case _0x3452('0x26'):_0x3aa4b6[_0x3452('0x13')]=_0x3452('0x27');break;case'faxqueues':_0x3aa4b6['childModel']=_0x3452('0x28');break;case _0x3452('0x29'):_0x3aa4b6[_0x3452('0x13')]=_0x3452('0x2a');break;case _0x3452('0x2b'):case _0x3452('0x2c'):case _0x3452('0x2d'):_0x3aa4b6[_0x3452('0x13')]='VoiceExtension';break;case _0x3452('0x2e'):_0x3aa4b6['childModel']='VoiceContext';break;case _0x3452('0x2f'):_0x3aa4b6[_0x3452('0x13')]=_0x3452('0x30');break;case _0x3452('0x31'):_0x3aa4b6[_0x3452('0x13')]='VoiceRecording';_0x3aa4b6[_0x3452('0x18')]=[{'name':_0x3452('0x32'),'field':_0x3452('0xb'),'foreignKey':_0x3452('0x33'),'model':_0x3452('0x34'),'filter':{'field':_0x3452('0x35'),'value':[_0x3452('0x36')]}},{'name':_0x3452('0x37'),'field':_0x3452('0xb'),'foreignKey':'membername','model':_0x3452('0x34'),'filter':{'field':_0x3452('0x35'),'value':[_0x3452('0x38')]}},{'name':_0x3452('0x39'),'field':_0x3452('0xb'),'foreignKey':_0x3452('0x3a'),'model':_0x3452('0x3b'),'filter':{'field':_0x3452('0x10'),'value':['inbound']}},{'name':_0x3452('0x3c'),'field':_0x3452('0xb'),'foreignKey':_0x3452('0x3a'),'model':_0x3452('0x3b'),'filter':{'field':_0x3452('0x10'),'value':[_0x3452('0x3d')]}}];break;case _0x3452('0x3e'):_0x3aa4b6[_0x3452('0x13')]=_0x3452('0x3f');break;case _0x3452('0x40'):_0x3aa4b6[_0x3452('0x13')]=_0x3452('0x41');break;case _0x3452('0x42'):_0x3aa4b6[_0x3452('0x13')]='VoicePrefix';break;case _0x3452('0x43'):_0x3aa4b6['childModel']=_0x3452('0x44');break;case'mailqueues':_0x3aa4b6[_0x3452('0x13')]=_0x3452('0x45');break;case _0x3452('0x46'):_0x3aa4b6[_0x3452('0x13')]=_0x3452('0x47');break;case _0x3452('0x48'):_0x3aa4b6[_0x3452('0x13')]='MailSubstatus';break;case _0x3452('0x49'):_0x3aa4b6['childModel']='OpenchannelQueue';break;case'openchannelaccounts':_0x3aa4b6[_0x3452('0x13')]=_0x3452('0x4a');break;case _0x3452('0x4b'):_0x3aa4b6[_0x3452('0x13')]=_0x3452('0x4c');break;case _0x3452('0x4d'):_0x3aa4b6[_0x3452('0x13')]=_0x3452('0x4e');break;case _0x3452('0x4f'):_0x3aa4b6[_0x3452('0x13')]=_0x3452('0x50');break;case _0x3452('0x51'):_0x3aa4b6['childModel']='WhatsappAccount';break;case _0x3452('0x52'):_0x3aa4b6[_0x3452('0x13')]=_0x3452('0x53');break;case _0x3452('0x54'):case'queuecampaigns':_0x3aa4b6[_0x3452('0x13')]=_0x3452('0x3b');if(_0x2232c3){_0x3aa4b6[_0x3452('0x18')]=[{'name':'VoiceQueues'},{'name':'QueueCampaigns'}];}break;case _0x3452('0x55'):case _0x3452('0x56'):case _0x3452('0x57'):_0x3aa4b6[_0x3452('0x13')]=_0x3452('0x34');if(_0x2232c3){_0x3aa4b6[_0x3452('0x18')]=[{'name':'Users','filter':{'field':_0x3452('0x35'),'value':[_0x3452('0x58'),'user']},'ignore':!![]},{'name':_0x3452('0x32')},{'name':_0x3452('0x37')}];}break;case _0x3452('0x59'):_0x3aa4b6[_0x3452('0x13')]=_0x3452('0x5a');break;case _0x3452('0x5b'):_0x3aa4b6['childModel']='SalesforceAccount';break;case _0x3452('0x5c'):_0x3aa4b6[_0x3452('0x13')]=_0x3452('0x5d');break;case'sugarcrmaccounts':_0x3aa4b6[_0x3452('0x13')]='SugarcrmAccount';break;case _0x3452('0x5e'):_0x3aa4b6[_0x3452('0x13')]=_0x3452('0x5f');break;case _0x3452('0x60'):_0x3aa4b6[_0x3452('0x13')]=_0x3452('0x61');break;case _0x3452('0x62'):_0x3aa4b6[_0x3452('0x13')]=_0x3452('0x34');break;case _0x3452('0x63'):_0x3aa4b6[_0x3452('0x13')]='CannedAnswer';break;case _0x3452('0x64'):_0x3aa4b6[_0x3452('0x13')]='Disposition';break;case _0x3452('0x65'):_0x3aa4b6[_0x3452('0x13')]='Dashboard';break;case _0x3452('0x66'):_0x3aa4b6['childModel']='Interval';break;case _0x3452('0x67'):_0x3aa4b6[_0x3452('0x13')]=_0x3452('0x68');break;case _0x3452('0x69'):_0x3aa4b6[_0x3452('0x13')]='Schedule';break;case _0x3452('0x6a'):_0x3aa4b6[_0x3452('0x13')]='Sound';break;case _0x3452('0x6b'):_0x3aa4b6[_0x3452('0x13')]='Tag';break;case _0x3452('0x6c'):_0x3aa4b6[_0x3452('0x13')]=_0x3452('0x6d');break;case _0x3452('0x6e'):_0x3aa4b6[_0x3452('0x13')]=_0x3452('0x6f');break;case _0x3452('0x70'):_0x3aa4b6[_0x3452('0x13')]='Trunk';break;case _0x3452('0x71'):_0x3aa4b6[_0x3452('0x13')]='Variable';break;case _0x3452('0x72'):_0x3aa4b6[_0x3452('0x13')]=_0x3452('0x73');break;case _0x3452('0x74'):_0x3aa4b6[_0x3452('0x13')]=_0x3452('0xe');_0x3aa4b6[_0x3452('0x18')]=[{'name':'Reports','field':'id','foreignKey':'reportId'}];break;case _0x3452('0x75'):_0x3aa4b6['childModel']=_0x3452('0x76');break;}return _0x3aa4b6;}function _0x440648(_0x32563d,_0x25df29){var _0xe20c79=_0x32563d[_0x3452('0x77')](0x0)['toUpperCase']()+_0x32563d[_0x3452('0x78')](0x1);var _0x432f66={'type':_0x5e0f6b[_0x3452('0x79')][_0x3452('0x7a')][_0x3452('0x7b')],'raw':!![]};return new Promise(function(_0x5999e7,_0x5b17f3){var _0x9be59a=squel[_0x3452('0x7c')]()[_0x3452('0x9')](_0x3452('0x7d')+_0xe20c79+_0x3452('0x7e'),'id')[_0x3452('0x9')](_0x3452('0x7f'))[_0x3452('0x80')]('user_has_'+_0x32563d+'_interactions','ui')[_0x3452('0x81')](_0x3452('0x82'),_0x25df29['id']);return _0x5e0f6b[_0x3452('0x83')]['query'](_0x9be59a[_0x3452('0x84')](),_0x432f66)[_0x3452('0x5')](function(_0x2ba902){_0x25df29[_0xe20c79+_0x3452('0x85')]=_0x2ba902;_0x5999e7(_0x2ba902);})['catch'](function(_0x44d189){_0x5b17f3(_0x44d189);});});}return _0x7b84a3[_0x3452('0x86')]('UserProfile',attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x5af87b){var _0x29318d=require(_0x3452('0x87'));var _0x56bb05={'raw':_0x5af87b[_0x3452('0x88')]['raw'],'where':{}};var _0x245c54={};var _0x41f92={'count':0x0,'rows':[]};var _0x54427e=_0x5af87b[_0x3452('0x88')]['section'];var _0x35580c=_0x5af87b['query'][_0x3452('0x89')]||![];var _0x2ed631=_0x357c8f(_0x54427e,_0x35580c);if(!_0x2ed631[_0x3452('0x13')])throw new Error(_0x3452('0x8a')+_0x54427e+'\x27');var _0x1abb3a=[{'name':_0x54427e}];if(!_['isEmpty'](_0x2ed631[_0x3452('0x18')]))_0x1abb3a=_0x2ed631[_0x3452('0x18')];var _0x187676=[];for(var _0x220b66=0x0;_0x220b66<_0x1abb3a[_0x3452('0x8b')];_0x220b66++){_0x187676[_0x3452('0x8c')](_0x5e0f6b[_0x3452('0x8d')][_0x3452('0x8e')]({'where':{'userProfileId':_0x5af87b[_0x3452('0x8f')]['id'],'name':_0x1abb3a[_0x220b66]['name']},'raw':!![]}));}return Promise[_0x3452('0x90')](_0x187676)[_0x3452('0x5')](function(_0x2ef3cb){var _0x73d214=_['filter'](_0x2ef3cb,function(_0x1b54c2){return _0x1b54c2?_0x1b54c2:undefined;});var _0x265205=_[_0x3452('0x2')](_0x1abb3a,[_0x3452('0x91'),!![]]);var _0x1f408e=_[_0x3452('0x92')](_0x73d214)&&_['isEmpty'](_0x265205)?null:_['union'](_0x265205,_0x73d214);if(!_0x1f408e)return null;var _0x2dd751=[];for(var _0x1eb22a=0x0;_0x1eb22a<_0x1f408e[_0x3452('0x8b')];_0x1eb22a++){var _0x442767=_[_0x3452('0x8e')](_0x1abb3a,function(_0x576e04){return _0x1f408e[_0x1eb22a]?_0x576e04['name']===_0x1f408e[_0x1eb22a][_0x3452('0xb')]:null;});if(_0x442767){if(_0x1f408e[_0x1eb22a]['ignore']){_0x2dd751[_0x3452('0x8c')](_0x69c96b(_0x2ed631[_0x3452('0x13')],_0x1f408e[_0x1eb22a]));}else{if(!_0x1f408e[_0x1eb22a][_0x3452('0x93')]){_0x2dd751['push'](_0x371f50(_0x442767,_0x1f408e[_0x1eb22a],_0x2ed631[_0x3452('0x13')]));}else{if(_0x442767[_0x3452('0xa')]){_0x2dd751[_0x3452('0x8c')](_0x33ef4c(_0x442767,_0x1f408e[_0x1eb22a]));}}}}}return Promise['all'](_0x2dd751);})[_0x3452('0x5')](function(_0x3a7874){var _0x45ad03=_0x3a7874;var _0x47f006=null;if(_0x45ad03){_0x47f006=_0x45ad03[_0x3452('0x8b')]===0x1?_0x45ad03[0x0]:null;}if(!_0x47f006&&!_0x45ad03)return _0x41f92;var _0x652114=_0x5e0f6b[_0x2ed631[_0x3452('0x13')]][_0x3452('0x94')];_0x245c54['model']=_['keys'](_0x652114);_0x245c54[_0x3452('0x88')]=_[_0x3452('0x95')](_0x5af87b[_0x3452('0x88')]);_0x245c54[_0x3452('0x96')]=_['intersection'](_0x245c54[_0x3452('0xa')],_0x245c54[_0x3452('0x88')]);_0x56bb05[_0x3452('0x97')]=_['intersection'](_0x245c54[_0x3452('0xa')],_0x29318d['fields'](_0x5af87b['query'][_0x3452('0x98')]));_0x56bb05[_0x3452('0x97')]=_0x56bb05[_0x3452('0x97')]['length']?_0x56bb05[_0x3452('0x97')]:_0x245c54[_0x3452('0xa')];if(!_0x5af87b[_0x3452('0x88')]['hasOwnProperty'](_0x3452('0x99'))){_0x56bb05[_0x3452('0x9a')]=_0x29318d[_0x3452('0x9a')](_0x5af87b[_0x3452('0x88')][_0x3452('0x9a')]);_0x56bb05['offset']=_0x29318d[_0x3452('0x9b')](_0x5af87b['query'][_0x3452('0x9b')]);}_0x56bb05[_0x3452('0x9c')]=_0x29318d[_0x3452('0x9d')](_0x5af87b[_0x3452('0x88')][_0x3452('0x9d')]);_0x56bb05[_0x3452('0x81')]=_0x29318d[_0x3452('0x96')](_[_0x3452('0x9e')](_0x5af87b[_0x3452('0x88')],_0x245c54[_0x3452('0x96')]));if(_0x5af87b['query'][_0x3452('0x2')]){_0x56bb05['where']=_[_0x3452('0x9f')](_0x56bb05[_0x3452('0x81')],{'$or':_['map'](_0x652114,function(_0x57d0f4){if(_0x57d0f4[_0x3452('0x10')][_0x3452('0xa0')]!==_0x3452('0xa1')){var _0x3b6e7b={};_0x3b6e7b[_0x57d0f4['field']]={'$like':'%'+_0x5af87b[_0x3452('0x88')][_0x3452('0x2')]+'%'};return _0x3b6e7b;}})});}var _0x148688=[];var _0x6bdca7=null;var _0x4dbd40={};if(_0x47f006){_0x6bdca7=_[_0x3452('0x8e')](_0x1abb3a,[_0x3452('0xb'),_0x47f006[_0x3452('0xb')]]);if(_0x6bdca7['field']){_0x4dbd40={};if(_0x2ed631[_0x3452('0x13')]===_0x3452('0xe')){_0x4dbd40[_0x6bdca7[_0x3452('0xa2')]]=_[_0x3452('0x7')](_0x47f006['associatedResources'],'id');}else{_0x4dbd40[_0x6bdca7['foreignKey']]=_0x47f006['associatedResources'];}_0x148688[_0x3452('0x8c')](_0x4dbd40);}else{_0x56bb05['where']['id']=_0x47f006[_0x3452('0x6')];}}else{for(var _0x4302b2=0x0;_0x4302b2<_0x45ad03[_0x3452('0x8b')];_0x4302b2++){_0x6bdca7=_[_0x3452('0x8e')](_0x1abb3a,[_0x3452('0xb'),_0x45ad03[_0x4302b2][_0x3452('0xb')]]);if(_0x6bdca7[_0x3452('0x9')]){_0x4dbd40={};_0x4dbd40[_0x6bdca7[_0x3452('0xa2')]]=_0x45ad03[_0x4302b2][_0x3452('0x6')];_0x148688[_0x3452('0x8c')](_0x4dbd40);}else{if(!_0x56bb05[_0x3452('0x81')]['id'])_0x56bb05[_0x3452('0x81')]['id']=[];_0x45ad03[_0x4302b2][_0x3452('0x6')][_0x3452('0xa3')](function(_0x1d87f0){_0x56bb05[_0x3452('0x81')]['id'][_0x3452('0x8c')](_0x1d87f0);});}}}if(!_[_0x3452('0x92')](_0x148688)){_0x56bb05['where']=_[_0x3452('0x9f')](_0x56bb05[_0x3452('0x81')],{'$and':{'$or':_0x148688}});}_0x56bb05=_['merge']({},_0x56bb05,_0x5af87b[_0x3452('0xa4')]);if(_0x47f006&&!_0x47f006[_0x3452('0x93')]&&_0x2ed631[_0x3452('0x13')]===_0x3452('0xe')){if(_0x5af87b[_0x3452('0x88')][_0x3452('0xa5')]){_0x56bb05[_0x3452('0xa6')]=[{'all':!![]}];}return _0x5e0f6b[_0x2ed631['childModel']]['findAll'](_0x56bb05)[_0x3452('0x5')](function(_0x5748e3){var _0x433723=[];_0x5748e3[_0x3452('0xa3')](function(_0x45db28){var _0xa1a814;switch(_0x45db28[_0x3452('0xa7')]){case'default':_0xa1a814=_[_0x3452('0x8e')](_0x47f006['associatedResources'],function(_0x542bf1){return _0x542bf1['id']===_0x45db28[_0x3452('0xa8')]&&_0x542bf1[_0x3452('0x10')]===_0x3452('0xa9');});break;case _0x3452('0xaa'):_0xa1a814=_[_0x3452('0x8e')](_0x47f006['associatedResources'],function(_0x23ba32){return _0x23ba32['id']===_0x45db28[_0x3452('0xa8')]&&_0x23ba32[_0x3452('0x10')]===_0x3452('0xab');});break;}if(_0xa1a814)_0x433723[_0x3452('0x8c')](_0x45db28);});_0x41f92['count']=_0x433723['length'];_0x41f92[_0x3452('0xac')]=_0x433723;return _0x41f92;});}else{if(!_[_0x3452('0x92')](_0x5af87b[_0x3452('0x88')][_0x3452('0xad')])){_0x56bb05[_0x3452('0x81')]['id']=_0x56bb05[_0x3452('0x81')]['id']?_['intersection'](_0x56bb05[_0x3452('0x81')]['id'],_0x5af87b[_0x3452('0x88')]['ids']):_0x5af87b[_0x3452('0x88')]['ids'];if(_0x5af87b['query'][_0x3452('0xae')]){_0x56bb05['order']=_0x5af87b['query'][_0x3452('0xae')];}}if(_0x5af87b['query'][_0x3452('0xaf')]){_0x56bb05[_0x3452('0x81')]=_[_0x3452('0x9f')](_0x56bb05[_0x3452('0x81')],{'$and':_0x5af87b[_0x3452('0x88')][_0x3452('0xaf')]});}return _0x5e0f6b[_0x2ed631['childModel']]['count']({'where':_0x56bb05[_0x3452('0x81')]})['then'](function(_0x2df46f){_0x41f92[_0x3452('0xb0')]=_0x2df46f;if(_0x5af87b[_0x3452('0x88')][_0x3452('0xa5')]){if(_0x2ed631[_0x3452('0x13')]===_0x3452('0x1c')){_0x56bb05[_0x3452('0xa6')]=[{'model':_0x5e0f6b[_0x3452('0xb1')],'as':_0x3452('0xb2'),'attributes':['id',_0x3452('0xb'),_0x3452('0xb3')],'required':_0x5af87b[_0x3452('0x88')][_0x3452('0xb4')]?!![]:![]},{'model':_0x5e0f6b[_0x3452('0xb1')],'as':'ThroughTags','attributes':['id','name','color'],'through':_0x5af87b[_0x3452('0x88')]['tag']?{'attributes':[],'where':{'TagId':_0x5af87b[_0x3452('0x88')]['tag']||undefined}}:{},'required':_0x5af87b[_0x3452('0x88')][_0x3452('0xb4')]?!![]:![]}];}else{_0x56bb05[_0x3452('0xa6')]=[{'all':!![]}];}}return _0x5e0f6b[_0x2ed631[_0x3452('0x13')]][_0x3452('0x4')](_0x56bb05);})[_0x3452('0x5')](function(_0x19ebc6){_0x41f92['rows']=_0x19ebc6;if(_0x54427e===_0x3452('0x32')&&_0x5af87b[_0x3452('0x88')][_0x3452('0xb5')]===_0x3452('0xb6')){var _0x3d1609=[];for(var _0xd50abc=0x0;_0xd50abc<_0x41f92['rows'][_0x3452('0x8b')];_0xd50abc++){_0x3d1609[_0x3452('0x8c')](_0x440648(_0x3452('0xb7'),_0x41f92[_0x3452('0xac')][_0xd50abc][_0x3452('0xb8')]));_0x3d1609['push'](_0x440648('sms',_0x41f92[_0x3452('0xac')][_0xd50abc][_0x3452('0xb8')]));_0x3d1609[_0x3452('0x8c')](_0x440648(_0x3452('0xb9'),_0x41f92['rows'][_0xd50abc][_0x3452('0xb8')]));_0x3d1609[_0x3452('0x8c')](_0x440648('mail',_0x41f92['rows'][_0xd50abc][_0x3452('0xb8')]));_0x3d1609[_0x3452('0x8c')](_0x440648(_0x3452('0xba'),_0x41f92[_0x3452('0xac')][_0xd50abc][_0x3452('0xb8')]));_0x3d1609[_0x3452('0x8c')](_0x440648('whatsapp',_0x41f92[_0x3452('0xac')][_0xd50abc]['dataValues']));}return Promise[_0x3452('0x90')](_0x3d1609)[_0x3452('0x5')](function(){return _0x41f92;});}return _0x41f92;});}});}}});}; \ No newline at end of file +var _0x7009=['ChatQueue','chatwebsites','ChatWebsite','faxqueues','faxaccounts','outboundroutes','VoiceExtension','contexts','voicemails','VoiceMail','VoiceRecording','Agents','membername','User','role','agent','queue','VoiceQueue','inbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','whatsappaccounts','WhatsappAccount','Team','queuecampaigns','VoiceQueues','QueueCampaigns','users','agents','telephones','Users','admin','user','Telephones','ZendeskAccount','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','ZohoAccount','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','scheduler','Schedule','sounds','Sound','Tag','Template','Trigger','trunks','Variable','plugins','Plugin','extractedreports','Reports','reportId','AnalyticMetric','toUpperCase','slice','Sequelize','QueryTypes','select','user_has_','where','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','define','UserProfile','user_profiles','../../components/parsers/qs','raw','section','mergeResources','Invalid\x20section\x20\x27','length','push','UserProfileSection','find','params','all','ignore','isEmpty','union','rawAttributes','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','pick','merge','VIRTUAL','foreignKey','autoAssociation','includeAll','include','forEach','default','custom','CustomReports','count','ids','customSorting','extraQueryConditions','Tags','color','tag','true','rows','chat','dataValues','sms','fax','mail','whatsapp','lodash','./userProfile.attributes','exports','models','filter','field','value','findAll','associatedResources','map','catch','model','then','name','resolve','UserProfileResource','AnalyticExtractedReport','type','resourceId','toLowerCase','squareprojects','childModel','odbc','SquareOdbc','SquareRecording','parentSections','projectName','projects','JscriptyProject','CmContact','ListId','lists','CmList','CmCompany','globalcustomfields','chatqueues'];(function(_0x316f6a,_0x1d27ff){var _0x26948a=function(_0x2a35ab){while(--_0x2a35ab){_0x316f6a['push'](_0x316f6a['shift']());}};_0x26948a(++_0x1d27ff);}(_0x7009,0x97));var _0x9700=function(_0x380c2d,_0x2f9ea1){_0x380c2d=_0x380c2d-0x0;var _0x5c5bde=_0x7009[_0x380c2d];return _0x5c5bde;};'use strict';var _=require(_0x9700('0x0'));var attributes=require(_0x9700('0x1'));var squel=require('squel');module[_0x9700('0x2')]=function(_0x5959ec){var _0x159cef=_0x5959ec[_0x9700('0x3')];function _0x1b64a9(_0x1b4ac9,_0x35a654){return new Promise(function(_0x445365,_0x42cb93){if(!_0x35a654)return _0x445365(null);var _0x3419f8=_0x35a654['filter']?{[_0x35a654[_0x9700('0x4')][_0x9700('0x5')]]:_0x35a654['filter'][_0x9700('0x6')]}:undefined;return _0x159cef[_0x1b4ac9][_0x9700('0x7')]({'where':_0x3419f8,'raw':!![]})['then'](function(_0x432ac5){_0x35a654[_0x9700('0x8')]=_[_0x9700('0x9')](_0x432ac5,'id');_0x445365(_0x35a654);})[_0x9700('0xa')](function(_0x3324a5){_0x42cb93(_0x3324a5);});});}function _0x4d7592(_0x32b5e9,_0x2e9b41){return new Promise(function(_0x5b7b40,_0xcf88db){var _0x4e208e=_0x32b5e9[_0x9700('0x4')]?{[_0x32b5e9[_0x9700('0x4')][_0x9700('0x5')]]:_0x32b5e9[_0x9700('0x4')][_0x9700('0x6')]}:undefined;return _0x159cef[_0x32b5e9[_0x9700('0xb')]][_0x9700('0x7')]({'where':_0x4e208e,'raw':!![]})[_0x9700('0xc')](function(_0x3eab69){_0x2e9b41['associatedResources']=_[_0x9700('0x9')](_0x3eab69,function(_0x59cbb8){return _0x59cbb8[_0x9700('0xd')];});_0x5b7b40(_0x2e9b41);})[_0x9700('0xa')](function(_0xa39b5c){_0xcf88db(_0xa39b5c);});});}function _0x29596e(_0x3499b2,_0x4d5f44,_0xbf952d){if(!_0x4d5f44)return Promise[_0x9700('0xe')](null);return new Promise(function(_0x3cf2dc,_0x4c1370){return _0x159cef[_0x9700('0xf')][_0x9700('0x7')]({'where':{'sectionId':_0x4d5f44['id']},'raw':!![]})[_0x9700('0xc')](function(_0x15890f){if(_0x3499b2[_0x9700('0x5')]&&_0x3499b2[_0x9700('0x5')]!=='id'){_0x4d5f44[_0x9700('0x8')]=_[_0x9700('0x9')](_0x15890f,function(_0x19f4a4){return _0x19f4a4[_0x3499b2['field']];});}else{if(_0xbf952d===_0x9700('0x10')){_0x4d5f44[_0x9700('0x8')]=_[_0x9700('0x9')](_0x15890f,function(_0x2e9c4a){return{'id':_0x2e9c4a['resourceId'],'type':_0x2e9c4a[_0x9700('0x11')]};});}else{_0x4d5f44[_0x9700('0x8')]=_['map'](_0x15890f,function(_0x5f26c9){return _0x5f26c9[_0x9700('0x12')];});}}_0x3cf2dc(_0x4d5f44);})['catch'](function(_0x1e675d){_0x4c1370(_0x1e675d);});});}function _0x50fb34(_0x1dd9d1,_0xf3e96){var _0x10e052={'parentSections':[]};switch(_0x1dd9d1[_0x9700('0x13')]()){case _0x9700('0x14'):_0x10e052[_0x9700('0x15')]='SquareProject';break;case _0x9700('0x16'):_0x10e052[_0x9700('0x15')]=_0x9700('0x17');break;case'squarerecordings':_0x10e052[_0x9700('0x15')]=_0x9700('0x18');_0x10e052[_0x9700('0x19')]=[{'name':'SquareProjects','field':_0x9700('0xd'),'foreignKey':_0x9700('0x1a')}];break;case _0x9700('0x1b'):_0x10e052[_0x9700('0x15')]=_0x9700('0x1c');break;case'contacts':_0x10e052[_0x9700('0x15')]=_0x9700('0x1d');_0x10e052[_0x9700('0x19')]=[{'name':'Lists','field':'id','foreignKey':_0x9700('0x1e')}];break;case _0x9700('0x1f'):_0x10e052[_0x9700('0x15')]=_0x9700('0x20');break;case'companies':_0x10e052['childModel']=_0x9700('0x21');break;case _0x9700('0x22'):_0x10e052[_0x9700('0x15')]='CmCustomField';break;case _0x9700('0x23'):_0x10e052[_0x9700('0x15')]=_0x9700('0x24');break;case _0x9700('0x25'):_0x10e052[_0x9700('0x15')]=_0x9700('0x26');break;case _0x9700('0x27'):_0x10e052['childModel']='FaxQueue';break;case _0x9700('0x28'):_0x10e052[_0x9700('0x15')]='FaxAccount';break;case'inboundroutes':case'internalroutes':case _0x9700('0x29'):_0x10e052[_0x9700('0x15')]=_0x9700('0x2a');break;case _0x9700('0x2b'):_0x10e052[_0x9700('0x15')]='VoiceContext';break;case _0x9700('0x2c'):_0x10e052[_0x9700('0x15')]=_0x9700('0x2d');break;case'voicerecordings':_0x10e052['childModel']=_0x9700('0x2e');_0x10e052[_0x9700('0x19')]=[{'name':_0x9700('0x2f'),'field':'name','foreignKey':_0x9700('0x30'),'model':_0x9700('0x31'),'filter':{'field':_0x9700('0x32'),'value':[_0x9700('0x33')]}},{'name':'Telephones','field':'name','foreignKey':'membername','model':'User','filter':{'field':_0x9700('0x32'),'value':['telephone']}},{'name':'VoiceQueues','field':'name','foreignKey':_0x9700('0x34'),'model':_0x9700('0x35'),'filter':{'field':_0x9700('0x11'),'value':[_0x9700('0x36')]}},{'name':'QueueCampaigns','field':'name','foreignKey':'queue','model':_0x9700('0x35'),'filter':{'field':_0x9700('0x11'),'value':['outbound']}}];break;case _0x9700('0x37'):_0x10e052[_0x9700('0x15')]=_0x9700('0x38');break;case _0x9700('0x39'):_0x10e052[_0x9700('0x15')]=_0x9700('0x3a');break;case'voiceprefixes':_0x10e052['childModel']='VoicePrefix';break;case _0x9700('0x3b'):_0x10e052['childModel']=_0x9700('0x3c');break;case _0x9700('0x3d'):_0x10e052[_0x9700('0x15')]=_0x9700('0x3e');break;case _0x9700('0x3f'):_0x10e052['childModel']=_0x9700('0x40');break;case'mailsubstatuses':_0x10e052['childModel']='MailSubstatus';break;case _0x9700('0x41'):_0x10e052[_0x9700('0x15')]=_0x9700('0x42');break;case _0x9700('0x43'):_0x10e052['childModel']=_0x9700('0x44');break;case _0x9700('0x45'):_0x10e052[_0x9700('0x15')]=_0x9700('0x46');break;case _0x9700('0x47'):_0x10e052[_0x9700('0x15')]=_0x9700('0x48');break;case _0x9700('0x49'):_0x10e052[_0x9700('0x15')]='WhatsappQueue';break;case _0x9700('0x4a'):_0x10e052['childModel']=_0x9700('0x4b');break;case'teams':_0x10e052[_0x9700('0x15')]=_0x9700('0x4c');break;case'voicequeues':case _0x9700('0x4d'):_0x10e052[_0x9700('0x15')]=_0x9700('0x35');if(_0xf3e96){_0x10e052[_0x9700('0x19')]=[{'name':_0x9700('0x4e')},{'name':_0x9700('0x4f')}];}break;case _0x9700('0x50'):case _0x9700('0x51'):case _0x9700('0x52'):_0x10e052['childModel']=_0x9700('0x31');if(_0xf3e96){_0x10e052[_0x9700('0x19')]=[{'name':_0x9700('0x53'),'filter':{'field':_0x9700('0x32'),'value':[_0x9700('0x54'),_0x9700('0x55')]},'ignore':!![]},{'name':'Agents'},{'name':_0x9700('0x56')}];}break;case'zendeskaccounts':_0x10e052[_0x9700('0x15')]=_0x9700('0x57');break;case'salesforceaccounts':_0x10e052[_0x9700('0x15')]=_0x9700('0x58');break;case _0x9700('0x59'):_0x10e052[_0x9700('0x15')]=_0x9700('0x5a');break;case _0x9700('0x5b'):_0x10e052['childModel']=_0x9700('0x5c');break;case _0x9700('0x5d'):_0x10e052['childModel']=_0x9700('0x5e');break;case'zohoaccounts':_0x10e052[_0x9700('0x15')]=_0x9700('0x5f');break;case'vtigeraccounts':_0x10e052[_0x9700('0x15')]=_0x9700('0x31');break;case _0x9700('0x60'):_0x10e052[_0x9700('0x15')]=_0x9700('0x61');break;case _0x9700('0x62'):_0x10e052['childModel']=_0x9700('0x63');break;case _0x9700('0x64'):_0x10e052[_0x9700('0x15')]=_0x9700('0x65');break;case _0x9700('0x66'):_0x10e052['childModel']=_0x9700('0x67');break;case _0x9700('0x68'):_0x10e052[_0x9700('0x15')]='Pause';break;case _0x9700('0x69'):_0x10e052[_0x9700('0x15')]=_0x9700('0x6a');break;case _0x9700('0x6b'):_0x10e052['childModel']=_0x9700('0x6c');break;case'tags':_0x10e052[_0x9700('0x15')]=_0x9700('0x6d');break;case'templates':_0x10e052[_0x9700('0x15')]=_0x9700('0x6e');break;case'triggers':_0x10e052[_0x9700('0x15')]=_0x9700('0x6f');break;case _0x9700('0x70'):_0x10e052['childModel']='Trunk';break;case'variables':_0x10e052[_0x9700('0x15')]=_0x9700('0x71');break;case _0x9700('0x72'):_0x10e052[_0x9700('0x15')]=_0x9700('0x73');break;case _0x9700('0x74'):_0x10e052[_0x9700('0x15')]=_0x9700('0x10');_0x10e052[_0x9700('0x19')]=[{'name':_0x9700('0x75'),'field':'id','foreignKey':_0x9700('0x76')}];break;case'metrics':_0x10e052[_0x9700('0x15')]=_0x9700('0x77');break;}return _0x10e052;}function _0x49f69e(_0x34f628,_0x4a6c1c){var _0x4e93e7=_0x34f628['charAt'](0x0)[_0x9700('0x78')]()+_0x34f628[_0x9700('0x79')](0x1);var _0x4c0c44={'type':_0x159cef[_0x9700('0x7a')][_0x9700('0x7b')]['SELECT'],'raw':!![]};return new Promise(function(_0x355781,_0x382ff3){var _0x287c3b=squel[_0x9700('0x7c')]()[_0x9700('0x5')]('ui.'+_0x4e93e7+'InteractionId','id')[_0x9700('0x5')]('ui.createdAt')['from'](_0x9700('0x7d')+_0x34f628+'_interactions','ui')[_0x9700('0x7e')](_0x9700('0x7f'),_0x4a6c1c['id']);return _0x159cef[_0x9700('0x80')][_0x9700('0x81')](_0x287c3b[_0x9700('0x82')](),_0x4c0c44)[_0x9700('0xc')](function(_0x11b1c9){_0x4a6c1c[_0x4e93e7+_0x9700('0x83')]=_0x11b1c9;_0x355781(_0x11b1c9);})[_0x9700('0xa')](function(_0x1e2ceb){_0x382ff3(_0x1e2ceb);});});}return _0x5959ec[_0x9700('0x84')](_0x9700('0x85'),attributes,{'tableName':_0x9700('0x86'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x45ceb7){var _0x5857c6=require(_0x9700('0x87'));var _0x207d16={'raw':_0x45ceb7[_0x9700('0x81')][_0x9700('0x88')],'where':{}};var _0x1de894={};var _0x2a4dd1={'count':0x0,'rows':[]};var _0x4987bb=_0x45ceb7['query'][_0x9700('0x89')];var _0x3e694c=_0x45ceb7[_0x9700('0x81')][_0x9700('0x8a')]||![];var _0x37cbff=_0x50fb34(_0x4987bb,_0x3e694c);if(!_0x37cbff[_0x9700('0x15')])throw new Error(_0x9700('0x8b')+_0x4987bb+'\x27');var _0x267266=[{'name':_0x4987bb}];if(!_['isEmpty'](_0x37cbff['parentSections']))_0x267266=_0x37cbff[_0x9700('0x19')];var _0x25d514=[];for(var _0x162958=0x0;_0x162958<_0x267266[_0x9700('0x8c')];_0x162958++){_0x25d514[_0x9700('0x8d')](_0x159cef[_0x9700('0x8e')][_0x9700('0x8f')]({'where':{'userProfileId':_0x45ceb7[_0x9700('0x90')]['id'],'name':_0x267266[_0x162958][_0x9700('0xd')]},'raw':!![]}));}return Promise[_0x9700('0x91')](_0x25d514)[_0x9700('0xc')](function(_0x5973eb){var _0x42aaaa=_[_0x9700('0x4')](_0x5973eb,function(_0x5dadd4){return _0x5dadd4?_0x5dadd4:undefined;});var _0x19b1c7=_['filter'](_0x267266,[_0x9700('0x92'),!![]]);var _0x3a74ce=_[_0x9700('0x93')](_0x42aaaa)&&_[_0x9700('0x93')](_0x19b1c7)?null:_[_0x9700('0x94')](_0x19b1c7,_0x42aaaa);if(!_0x3a74ce)return null;var _0x3426a5=[];for(var _0x9139b=0x0;_0x9139b<_0x3a74ce[_0x9700('0x8c')];_0x9139b++){var _0xcdfae7=_[_0x9700('0x8f')](_0x267266,function(_0x17e254){return _0x3a74ce[_0x9139b]?_0x17e254[_0x9700('0xd')]===_0x3a74ce[_0x9139b][_0x9700('0xd')]:null;});if(_0xcdfae7){if(_0x3a74ce[_0x9139b][_0x9700('0x92')]){_0x3426a5[_0x9700('0x8d')](_0x1b64a9(_0x37cbff['childModel'],_0x3a74ce[_0x9139b]));}else{if(!_0x3a74ce[_0x9139b]['autoAssociation']){_0x3426a5[_0x9700('0x8d')](_0x29596e(_0xcdfae7,_0x3a74ce[_0x9139b],_0x37cbff['childModel']));}else{if(_0xcdfae7[_0x9700('0xb')]){_0x3426a5[_0x9700('0x8d')](_0x4d7592(_0xcdfae7,_0x3a74ce[_0x9139b]));}}}}}return Promise[_0x9700('0x91')](_0x3426a5);})[_0x9700('0xc')](function(_0x1de75a){var _0x55dc70=_0x1de75a;var _0x81c797=null;if(_0x55dc70){_0x81c797=_0x55dc70[_0x9700('0x8c')]===0x1?_0x55dc70[0x0]:null;}if(!_0x81c797&&!_0x55dc70)return _0x2a4dd1;var _0x9ca2ce=_0x159cef[_0x37cbff[_0x9700('0x15')]][_0x9700('0x95')];_0x1de894[_0x9700('0xb')]=_[_0x9700('0x96')](_0x9ca2ce);_0x1de894[_0x9700('0x81')]=_[_0x9700('0x96')](_0x45ceb7[_0x9700('0x81')]);_0x1de894[_0x9700('0x97')]=_[_0x9700('0x98')](_0x1de894['model'],_0x1de894[_0x9700('0x81')]);_0x207d16[_0x9700('0x99')]=_[_0x9700('0x98')](_0x1de894[_0x9700('0xb')],_0x5857c6[_0x9700('0x9a')](_0x45ceb7[_0x9700('0x81')][_0x9700('0x9a')]));_0x207d16['attributes']=_0x207d16[_0x9700('0x99')][_0x9700('0x8c')]?_0x207d16[_0x9700('0x99')]:_0x1de894['model'];if(!_0x45ceb7[_0x9700('0x81')][_0x9700('0x9b')](_0x9700('0x9c'))){_0x207d16[_0x9700('0x9d')]=_0x5857c6['limit'](_0x45ceb7[_0x9700('0x81')][_0x9700('0x9d')]);_0x207d16['offset']=_0x5857c6['offset'](_0x45ceb7[_0x9700('0x81')][_0x9700('0x9e')]);}_0x207d16[_0x9700('0x9f')]=_0x5857c6[_0x9700('0xa0')](_0x45ceb7[_0x9700('0x81')][_0x9700('0xa0')]);_0x207d16[_0x9700('0x7e')]=_0x5857c6[_0x9700('0x97')](_[_0x9700('0xa1')](_0x45ceb7['query'],_0x1de894[_0x9700('0x97')]));if(_0x45ceb7[_0x9700('0x81')][_0x9700('0x4')]){_0x207d16[_0x9700('0x7e')]=_[_0x9700('0xa2')](_0x207d16[_0x9700('0x7e')],{'$or':_[_0x9700('0x9')](_0x9ca2ce,function(_0x56a5a5){if(_0x56a5a5[_0x9700('0x11')]['key']!==_0x9700('0xa3')){var _0x1bd7d1={};_0x1bd7d1[_0x56a5a5[_0x9700('0x5')]]={'$like':'%'+_0x45ceb7[_0x9700('0x81')][_0x9700('0x4')]+'%'};return _0x1bd7d1;}})});}var _0x311a26=[];var _0x40191e=null;var _0x527633={};if(_0x81c797){_0x40191e=_['find'](_0x267266,[_0x9700('0xd'),_0x81c797[_0x9700('0xd')]]);if(_0x40191e[_0x9700('0x5')]){_0x527633={};if(_0x37cbff[_0x9700('0x15')]==='AnalyticExtractedReport'){_0x527633[_0x40191e[_0x9700('0xa4')]]=_[_0x9700('0x9')](_0x81c797['associatedResources'],'id');}else{_0x527633[_0x40191e['foreignKey']]=_0x81c797[_0x9700('0x8')];}_0x311a26[_0x9700('0x8d')](_0x527633);}else{_0x207d16[_0x9700('0x7e')]['id']=_0x81c797[_0x9700('0x8')];}}else{for(var _0x48daba=0x0;_0x48daba<_0x55dc70[_0x9700('0x8c')];_0x48daba++){_0x40191e=_['find'](_0x267266,['name',_0x55dc70[_0x48daba][_0x9700('0xd')]]);if(_0x40191e[_0x9700('0x5')]){_0x527633={};_0x527633[_0x40191e[_0x9700('0xa4')]]=_0x55dc70[_0x48daba][_0x9700('0x8')];_0x311a26[_0x9700('0x8d')](_0x527633);}else{if(!_0x207d16[_0x9700('0x7e')]['id'])_0x207d16['where']['id']=[];_0x55dc70[_0x48daba]['associatedResources']['forEach'](function(_0x2700b6){_0x207d16[_0x9700('0x7e')]['id']['push'](_0x2700b6);});}}}if(!_[_0x9700('0x93')](_0x311a26)){_0x207d16[_0x9700('0x7e')]=_[_0x9700('0xa2')](_0x207d16['where'],{'$and':{'$or':_0x311a26}});}_0x207d16=_[_0x9700('0xa2')]({},_0x207d16,_0x45ceb7['options']);if(_0x81c797&&!_0x81c797[_0x9700('0xa5')]&&_0x37cbff[_0x9700('0x15')]===_0x9700('0x10')){if(_0x45ceb7[_0x9700('0x81')][_0x9700('0xa6')]){_0x207d16[_0x9700('0xa7')]=[{'all':!![]}];}return _0x159cef[_0x37cbff[_0x9700('0x15')]]['findAll'](_0x207d16)[_0x9700('0xc')](function(_0x21f8f9){var _0x1c158a=[];_0x21f8f9[_0x9700('0xa8')](function(_0xd5c9df){var _0x4afa6e;switch(_0xd5c9df['reportType']){case _0x9700('0xa9'):_0x4afa6e=_['find'](_0x81c797[_0x9700('0x8')],function(_0x21e6af){return _0x21e6af['id']===_0xd5c9df['reportId']&&_0x21e6af[_0x9700('0x11')]==='DefaultReports';});break;case _0x9700('0xaa'):_0x4afa6e=_['find'](_0x81c797['associatedResources'],function(_0x1bfc06){return _0x1bfc06['id']===_0xd5c9df['reportId']&&_0x1bfc06[_0x9700('0x11')]===_0x9700('0xab');});break;}if(_0x4afa6e)_0x1c158a[_0x9700('0x8d')](_0xd5c9df);});_0x2a4dd1[_0x9700('0xac')]=_0x1c158a[_0x9700('0x8c')];_0x2a4dd1['rows']=_0x1c158a;return _0x2a4dd1;});}else{if(!_['isEmpty'](_0x45ceb7[_0x9700('0x81')][_0x9700('0xad')])){_0x207d16[_0x9700('0x7e')]['id']=_0x207d16['where']['id']?_['intersection'](_0x207d16[_0x9700('0x7e')]['id'],_0x45ceb7[_0x9700('0x81')][_0x9700('0xad')]):_0x45ceb7[_0x9700('0x81')]['ids'];if(_0x45ceb7[_0x9700('0x81')][_0x9700('0xae')]){_0x207d16[_0x9700('0x9f')]=_0x45ceb7[_0x9700('0x81')][_0x9700('0xae')];}}if(_0x45ceb7[_0x9700('0x81')][_0x9700('0xaf')]){_0x207d16[_0x9700('0x7e')]=_[_0x9700('0xa2')](_0x207d16[_0x9700('0x7e')],{'$and':_0x45ceb7[_0x9700('0x81')][_0x9700('0xaf')]});}return _0x159cef[_0x37cbff['childModel']][_0x9700('0xac')]({'where':_0x207d16['where']})[_0x9700('0xc')](function(_0x327f6e){_0x2a4dd1[_0x9700('0xac')]=_0x327f6e;if(_0x45ceb7['query'][_0x9700('0xa6')]){if(_0x37cbff[_0x9700('0x15')]===_0x9700('0x1d')){_0x207d16[_0x9700('0xa7')]=[{'model':_0x159cef['Tag'],'as':_0x9700('0xb0'),'attributes':['id',_0x9700('0xd'),_0x9700('0xb1')],'required':_0x45ceb7[_0x9700('0x81')][_0x9700('0xb2')]?!![]:![]},{'model':_0x159cef[_0x9700('0x6d')],'as':'ThroughTags','attributes':['id',_0x9700('0xd'),'color'],'through':_0x45ceb7[_0x9700('0x81')][_0x9700('0xb2')]?{'attributes':[],'where':{'TagId':_0x45ceb7[_0x9700('0x81')][_0x9700('0xb2')]||undefined}}:{},'required':_0x45ceb7[_0x9700('0x81')]['tag']?!![]:![]}];}else{_0x207d16[_0x9700('0xa7')]=[{'all':!![]}];}}return _0x159cef[_0x37cbff[_0x9700('0x15')]]['findAll'](_0x207d16);})['then'](function(_0x108aff){_0x2a4dd1['rows']=_0x108aff;if(_0x4987bb===_0x9700('0x2f')&&_0x45ceb7[_0x9700('0x81')]['openTabs']===_0x9700('0xb3')){var _0x57d64c=[];for(var _0xb719e5=0x0;_0xb719e5<_0x2a4dd1[_0x9700('0xb4')][_0x9700('0x8c')];_0xb719e5++){_0x57d64c[_0x9700('0x8d')](_0x49f69e(_0x9700('0xb5'),_0x2a4dd1[_0x9700('0xb4')][_0xb719e5][_0x9700('0xb6')]));_0x57d64c[_0x9700('0x8d')](_0x49f69e(_0x9700('0xb7'),_0x2a4dd1[_0x9700('0xb4')][_0xb719e5]['dataValues']));_0x57d64c[_0x9700('0x8d')](_0x49f69e(_0x9700('0xb8'),_0x2a4dd1[_0x9700('0xb4')][_0xb719e5][_0x9700('0xb6')]));_0x57d64c[_0x9700('0x8d')](_0x49f69e(_0x9700('0xb9'),_0x2a4dd1[_0x9700('0xb4')][_0xb719e5][_0x9700('0xb6')]));_0x57d64c[_0x9700('0x8d')](_0x49f69e('openchannel',_0x2a4dd1['rows'][_0xb719e5][_0x9700('0xb6')]));_0x57d64c[_0x9700('0x8d')](_0x49f69e(_0x9700('0xba'),_0x2a4dd1[_0x9700('0xb4')][_0xb719e5]['dataValues']));}return Promise[_0x9700('0x91')](_0x57d64c)[_0x9700('0xc')](function(){return _0x2a4dd1;});}return _0x2a4dd1;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 5590991..917def4 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 _0xf811=['http','defaults','redis','localhost','./userProfile.socket','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x33c3f7,_0x530749){var _0x56158a=function(_0x2c53f3){while(--_0x2c53f3){_0x33c3f7['push'](_0x33c3f7['shift']());}};_0x56158a(++_0x530749);}(_0xf811,0x6f));var _0x1f81=function(_0x5317b5,_0x4dfd6e){_0x5317b5=_0x5317b5-0x0;var _0x3b7ce2=_0xf811[_0x5317b5];return _0x3b7ce2;};'use strict';var _=require(_0x1f81('0x0'));var util=require(_0x1f81('0x1'));var moment=require(_0x1f81('0x2'));var BPromise=require(_0x1f81('0x3'));var rs=require(_0x1f81('0x4'));var fs=require('fs');var Redis=require(_0x1f81('0x5'));var db=require(_0x1f81('0x6'))['db'];var utils=require(_0x1f81('0x7'));var logger=require(_0x1f81('0x8'))(_0x1f81('0x9'));var config=require(_0x1f81('0xa'));var jayson=require(_0x1f81('0xb'));var client=jayson[_0x1f81('0xc')][_0x1f81('0xd')]({'port':0x232a});config['redis']=_[_0x1f81('0xe')](config[_0x1f81('0xf')],{'host':_0x1f81('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1f81('0xf')]));require(_0x1f81('0x11'))['register'](socket);function respondWithRpcPromise(_0x2ce4d7,_0x56b05d,_0x1978e5){return new BPromise(function(_0xf59298,_0x12859d){return client[_0x1f81('0x12')](_0x2ce4d7,_0x1978e5)[_0x1f81('0x13')](function(_0x36ccd8){logger[_0x1f81('0x14')](_0x1f81('0x15'),_0x56b05d,_0x1f81('0x16'));logger[_0x1f81('0x17')](_0x1f81('0x18'),_0x56b05d,_0x1f81('0x16'),JSON[_0x1f81('0x19')](_0x36ccd8));if(_0x36ccd8[_0x1f81('0x1a')]){if(_0x36ccd8[_0x1f81('0x1a')][_0x1f81('0x1b')]===0x1f4){logger['error'](_0x1f81('0x15'),_0x56b05d,_0x36ccd8[_0x1f81('0x1a')]['message']);return _0x12859d(_0x36ccd8['error'][_0x1f81('0x1c')]);}logger[_0x1f81('0x1a')]('UserProfile,\x20%s,\x20%s',_0x56b05d,_0x36ccd8[_0x1f81('0x1a')][_0x1f81('0x1c')]);return _0xf59298(_0x36ccd8[_0x1f81('0x1a')][_0x1f81('0x1c')]);}else{logger['info']('UserProfile,\x20%s,\x20%s',_0x56b05d,_0x1f81('0x16'));_0xf59298(_0x36ccd8[_0x1f81('0x1d')]['message']);}})[_0x1f81('0x1e')](function(_0x5310fb){logger[_0x1f81('0x1a')](_0x1f81('0x15'),_0x56b05d,_0x5310fb);_0x12859d(_0x5310fb);});});} \ No newline at end of file +var _0x496e=['info','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfile,\x20%s,\x20%s','message','request\x20sent','result','catch','util','moment','bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','request','then'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x496e,0x1a0));var _0xe496=function(_0x32ba54,_0x2f21c9){_0x32ba54=_0x32ba54-0x0;var _0x309210=_0x496e[_0x32ba54];return _0x309210;};'use strict';var _=require('lodash');var util=require(_0xe496('0x0'));var moment=require(_0xe496('0x1'));var BPromise=require(_0xe496('0x2'));var rs=require(_0xe496('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe496('0x4'))('rpc');var config=require(_0xe496('0x5'));var jayson=require(_0xe496('0x6'));var client=jayson[_0xe496('0x7')][_0xe496('0x8')]({'port':0x232a});config[_0xe496('0x9')]=_[_0xe496('0xa')](config[_0xe496('0x9')],{'host':_0xe496('0xb'),'port':0x18eb});var socket=require(_0xe496('0xc'))(new Redis(config[_0xe496('0x9')]));require(_0xe496('0xd'))['register'](socket);function respondWithRpcPromise(_0x4a4caa,_0x37c55b,_0x5ca4d4){return new BPromise(function(_0x2e679b,_0x44936f){return client[_0xe496('0xe')](_0x4a4caa,_0x5ca4d4)[_0xe496('0xf')](function(_0x19d4fa){logger[_0xe496('0x10')]('UserProfile,\x20%s,\x20%s',_0x37c55b,'request\x20sent');logger[_0xe496('0x11')](_0xe496('0x12'),_0x37c55b,'request\x20sent',JSON[_0xe496('0x13')](_0x19d4fa));if(_0x19d4fa[_0xe496('0x14')]){if(_0x19d4fa[_0xe496('0x14')][_0xe496('0x15')]===0x1f4){logger['error'](_0xe496('0x16'),_0x37c55b,_0x19d4fa['error'][_0xe496('0x17')]);return _0x44936f(_0x19d4fa['error'][_0xe496('0x17')]);}logger[_0xe496('0x14')](_0xe496('0x16'),_0x37c55b,_0x19d4fa[_0xe496('0x14')]['message']);return _0x2e679b(_0x19d4fa[_0xe496('0x14')][_0xe496('0x17')]);}else{logger['info'](_0xe496('0x16'),_0x37c55b,_0xe496('0x18'));_0x2e679b(_0x19d4fa[_0xe496('0x19')][_0xe496('0x17')]);}})[_0xe496('0x1a')](function(_0x25e42d){logger[_0xe496('0x14')](_0xe496('0x16'),_0x37c55b,_0x25e42d);_0x44936f(_0x25e42d);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index d4af528..e2294a8 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 _0xfdb1=['removeListener','register','length','userProfile:','./userProfile.events','save','remove','update','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfdb1,0xb8));var _0x1fdb=function(_0x451c2c,_0x5c5f2d){_0x451c2c=_0x451c2c-0x0;var _0x50fb6d=_0xfdb1[_0x451c2c];return _0x50fb6d;};'use strict';var UserProfileEvents=require(_0x1fdb('0x0'));var events=[_0x1fdb('0x1'),_0x1fdb('0x2'),_0x1fdb('0x3')];function createListener(_0x189379,_0x289688){return function(_0x57ac63){_0x289688[_0x1fdb('0x4')](_0x189379,_0x57ac63);};}function removeListener(_0x2e6200,_0x4fec6e){return function(){UserProfileEvents[_0x1fdb('0x5')](_0x2e6200,_0x4fec6e);};}exports[_0x1fdb('0x6')]=function(_0x5b1b48){for(var _0x4d7ca5=0x0,_0xaa42ab=events[_0x1fdb('0x7')];_0x4d7ca5<_0xaa42ab;_0x4d7ca5++){var _0x44d3cb=events[_0x4d7ca5];var _0xc4936a=createListener(_0x1fdb('0x8')+_0x44d3cb,_0x5b1b48);UserProfileEvents['on'](_0x44d3cb,_0xc4936a);}}; \ No newline at end of file +var _0x7b13=['register','userProfile:','save','remove','emit','removeListener'];(function(_0x20525e,_0xe542d6){var _0x134d04=function(_0x4e562e){while(--_0x4e562e){_0x20525e['push'](_0x20525e['shift']());}};_0x134d04(++_0xe542d6);}(_0x7b13,0x98));var _0x37b1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7b13[_0x3dd15e];return _0x231fd0;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0x37b1('0x0'),_0x37b1('0x1'),'update'];function createListener(_0x225443,_0x5978ee){return function(_0xd8fcf5){_0x5978ee[_0x37b1('0x2')](_0x225443,_0xd8fcf5);};}function removeListener(_0x96edc2,_0x424610){return function(){UserProfileEvents[_0x37b1('0x3')](_0x96edc2,_0x424610);};}exports[_0x37b1('0x4')]=function(_0x2d71c4){for(var _0x4b6343=0x0,_0x76623=events['length'];_0x4b6343<_0x76623;_0x4b6343++){var _0x2a5542=events[_0x4b6343];var _0x55b8ea=createListener(_0x37b1('0x5')+_0x2a5542,_0x2d71c4);UserProfileEvents['on'](_0x2a5542,_0x55b8ea);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index f06877a..7d528ab 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 _0x1b30=['show','post','isAuthenticated','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','index','/describe','describe','/:id'];(function(_0x2c6e49,_0x3da2b3){var _0x22bc43=function(_0x5765fc){while(--_0x5765fc){_0x2c6e49['push'](_0x2c6e49['shift']());}};_0x22bc43(++_0x3da2b3);}(_0x1b30,0x194));var _0x01b3=function(_0x2b50e8,_0x580617){_0x2b50e8=_0x2b50e8-0x0;var _0x6fe287=_0x1b30[_0x2b50e8];return _0x6fe287;};'use strict';var multer=require(_0x01b3('0x0'));var util=require('util');var path=require(_0x01b3('0x1'));var timeout=require(_0x01b3('0x2'));var express=require(_0x01b3('0x3'));var router=express[_0x01b3('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x01b3('0x5'));var interaction=require(_0x01b3('0x6'));var config=require(_0x01b3('0x7'));var controller=require(_0x01b3('0x8'));router[_0x01b3('0x9')]('/',auth['isAuthenticated'](),controller[_0x01b3('0xa')]);router[_0x01b3('0x9')](_0x01b3('0xb'),auth['isAuthenticated'](),controller[_0x01b3('0xc')]);router[_0x01b3('0x9')](_0x01b3('0xd'),auth['isAuthenticated'](),controller[_0x01b3('0xe')]);router[_0x01b3('0xf')]('/',auth[_0x01b3('0x10')](),controller['create']);router[_0x01b3('0x11')](_0x01b3('0xd'),auth[_0x01b3('0x10')](),controller[_0x01b3('0x12')]);router[_0x01b3('0x13')](_0x01b3('0xd'),auth[_0x01b3('0x10')](),controller[_0x01b3('0x14')]);module[_0x01b3('0x15')]=router; \ No newline at end of file +var _0x62f0=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','describe','/:id','show','create','put','update','delete','exports','path','connect-timeout'];(function(_0x277cc3,_0x57f209){var _0x254e9e=function(_0x25164b){while(--_0x25164b){_0x277cc3['push'](_0x277cc3['shift']());}};_0x254e9e(++_0x57f209);}(_0x62f0,0x1ae));var _0x062f=function(_0x3eec42,_0x192ed2){_0x3eec42=_0x3eec42-0x0;var _0x110bf0=_0x62f0[_0x3eec42];return _0x110bf0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x062f('0x0'));var timeout=require(_0x062f('0x1'));var express=require(_0x062f('0x2'));var router=express[_0x062f('0x3')]();var fs_extra=require(_0x062f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x062f('0x5'));var config=require(_0x062f('0x6'));var controller=require(_0x062f('0x7'));router[_0x062f('0x8')]('/',auth[_0x062f('0x9')](),controller['index']);router[_0x062f('0x8')]('/describe',auth[_0x062f('0x9')](),controller[_0x062f('0xa')]);router[_0x062f('0x8')](_0x062f('0xb'),auth[_0x062f('0x9')](),controller[_0x062f('0xc')]);router['post']('/',auth[_0x062f('0x9')](),controller[_0x062f('0xd')]);router[_0x062f('0xe')](_0x062f('0xb'),auth['isAuthenticated'](),controller[_0x062f('0xf')]);router[_0x062f('0x10')](_0x062f('0xb'),auth[_0x062f('0x9')](),controller['destroy']);module[_0x062f('0x11')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 8e3bf74..8fae9ce 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 _0x5c7b=['exports','INTEGER'];(function(_0x2a6f2f,_0x512904){var _0x335dfc=function(_0x1bab2b){while(--_0x1bab2b){_0x2a6f2f['push'](_0x2a6f2f['shift']());}};_0x335dfc(++_0x512904);}(_0x5c7b,0xac));var _0xb5c7=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0x5c7b[_0x1ccdf7];return _0x52a0ae;};'use strict';var Sequelize=require('sequelize');module[_0xb5c7('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0xb5c7('0x1')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xe949=['sequelize','exports','STRING','INTEGER'];(function(_0xe85784,_0x29ae67){var _0x58c202=function(_0x21c96e){while(--_0x21c96e){_0xe85784['push'](_0xe85784['shift']());}};_0x58c202(++_0x29ae67);}(_0xe949,0x1bc));var _0x9e94=function(_0x4abe9f,_0x26c82f){_0x4abe9f=_0x4abe9f-0x0;var _0x38ca35=_0xe949[_0x4abe9f];return _0x38ca35;};'use strict';var Sequelize=require(_0x9e94('0x0'));module[_0x9e94('0x1')]={'name':{'type':Sequelize[_0x9e94('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x9e94('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x9e94('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index fccafbc..13c3118 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 _0x7880=['destroy','error','stack','name','send','index','UserProfileResource','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','keys','options','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','limit','set','json','apply','reject','save','update','then'];(function(_0xe6beba,_0x3f15d1){var _0x2f1c08=function(_0x2e7d9f){while(--_0x2e7d9f){_0xe6beba['push'](_0xe6beba['shift']());}};_0x2f1c08(++_0x3f15d1);}(_0x7880,0x1f4));var _0x0788=function(_0x3e9ef3,_0x21a7e4){_0x3e9ef3=_0x3e9ef3-0x0;var _0x333748=_0x7880[_0x3e9ef3];return _0x333748;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0788('0x0'));var zipdir=require(_0x0788('0x1'));var jsonpatch=require(_0x0788('0x2'));var rp=require(_0x0788('0x3'));var moment=require(_0x0788('0x4'));var BPromise=require(_0x0788('0x5'));var Mustache=require('mustache');var util=require(_0x0788('0x6'));var path=require(_0x0788('0x7'));var sox=require(_0x0788('0x8'));var csv=require(_0x0788('0x9'));var ejs=require(_0x0788('0xa'));var fs=require('fs');var fs_extra=require(_0x0788('0xb'));var _=require(_0x0788('0xc'));var squel=require(_0x0788('0xd'));var crypto=require(_0x0788('0xe'));var jsforce=require(_0x0788('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x0788('0x9'));var querystring=require('querystring');var Papa=require(_0x0788('0x10'));var Redis=require('ioredis');var authService=require(_0x0788('0x11'));var qs=require(_0x0788('0x12'));var as=require(_0x0788('0x13'));var hardwareService=require(_0x0788('0x14'));var logger=require(_0x0788('0x15'))('api');var utils=require(_0x0788('0x16'));var config=require(_0x0788('0x17'));var licenseUtil=require(_0x0788('0x18'));var db=require(_0x0788('0x19'))['db'];function respondWithStatusCode(_0x311729,_0xce4342){_0xce4342=_0xce4342||0xcc;return function(_0x261ebc){if(_0x261ebc){return _0x311729['sendStatus'](_0xce4342);}return _0x311729[_0x0788('0x1a')](_0xce4342)[_0x0788('0x1b')]();};}function respondWithResult(_0x3bdcdf,_0x13cf07){_0x13cf07=_0x13cf07||0xc8;return function(_0x51e5d3){if(_0x51e5d3){return _0x3bdcdf[_0x0788('0x1a')](_0x13cf07)['json'](_0x51e5d3);}};}function respondWithFilteredResult(_0x195f14,_0x170d56){return function(_0x3fd1e4){if(_0x3fd1e4){var _0xb406fb=typeof _0x170d56[_0x0788('0x1c')]===_0x0788('0x1d')&&typeof _0x170d56['limit']==='undefined';var _0x17d805=_0x3fd1e4[_0x0788('0x1e')];var _0x5b2bdc=_0xb406fb?0x0:_0x170d56[_0x0788('0x1c')];var _0x415f19=_0xb406fb?_0x3fd1e4[_0x0788('0x1e')]:_0x170d56['offset']+_0x170d56[_0x0788('0x1f')];var _0x3fb723;if(_0x415f19>=_0x17d805){_0x415f19=_0x17d805;_0x3fb723=0xc8;}else{_0x3fb723=0xce;}_0x195f14['status'](_0x3fb723);return _0x195f14[_0x0788('0x20')]('Content-Range',_0x5b2bdc+'-'+_0x415f19+'/'+_0x17d805)[_0x0788('0x21')](_0x3fd1e4);}return null;};}function patchUpdates(_0x48bc5f){return function(_0x17cca3){try{jsonpatch[_0x0788('0x22')](_0x17cca3,_0x48bc5f,!![]);}catch(_0x18ff22){return BPromise[_0x0788('0x23')](_0x18ff22);}return _0x17cca3[_0x0788('0x24')]();};}function saveUpdates(_0x4f0005,_0x48ec43){return function(_0x2270d4){if(_0x2270d4){return _0x2270d4[_0x0788('0x25')](_0x4f0005)[_0x0788('0x26')](function(_0x7a99a1){return _0x7a99a1;});}return null;};}function removeEntity(_0x5ba1da,_0x4d5c93){return function(_0x79204e){if(_0x79204e){return _0x79204e[_0x0788('0x27')]()[_0x0788('0x26')](function(){_0x5ba1da['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x240459,_0xa1f7dc){return function(_0x5f2dda){if(!_0x5f2dda){_0x240459['sendStatus'](0x194);}return _0x5f2dda;};}function handleError(_0x5a54a5,_0x44798c){_0x44798c=_0x44798c||0x1f4;return function(_0x57fda1){logger[_0x0788('0x28')](_0x57fda1[_0x0788('0x29')]);if(_0x57fda1[_0x0788('0x2a')]){delete _0x57fda1[_0x0788('0x2a')];}_0x5a54a5[_0x0788('0x1a')](_0x44798c)[_0x0788('0x2b')](_0x57fda1);};}exports[_0x0788('0x2c')]=function(_0x3ffe4f,_0x5b7594){var _0x5a5178={},_0x3c5246={},_0x40d345={'count':0x0,'rows':[]};var _0x54979a=_['map'](db[_0x0788('0x2d')][_0x0788('0x2e')],function(_0x20fcd8){return{'name':_0x20fcd8[_0x0788('0x2f')],'type':_0x20fcd8[_0x0788('0x30')][_0x0788('0x31')]};});_0x3c5246[_0x0788('0x32')]=_[_0x0788('0x33')](_0x54979a,_0x0788('0x2a'));_0x3c5246[_0x0788('0x34')]=_['keys'](_0x3ffe4f[_0x0788('0x34')]);_0x3c5246[_0x0788('0x35')]=_[_0x0788('0x36')](_0x3c5246[_0x0788('0x32')],_0x3c5246[_0x0788('0x34')]);_0x5a5178[_0x0788('0x37')]=_[_0x0788('0x36')](_0x3c5246[_0x0788('0x32')],qs[_0x0788('0x38')](_0x3ffe4f[_0x0788('0x34')]['fields']));_0x5a5178['attributes']=_0x5a5178['attributes']['length']?_0x5a5178['attributes']:_0x3c5246['model'];if(!_0x3ffe4f[_0x0788('0x34')][_0x0788('0x39')](_0x0788('0x3a'))){_0x5a5178['limit']=qs[_0x0788('0x1f')](_0x3ffe4f[_0x0788('0x34')][_0x0788('0x1f')]);_0x5a5178[_0x0788('0x1c')]=qs['offset'](_0x3ffe4f[_0x0788('0x34')]['offset']);}_0x5a5178[_0x0788('0x3b')]=qs['sort'](_0x3ffe4f[_0x0788('0x34')][_0x0788('0x3c')]);_0x5a5178['where']=qs[_0x0788('0x35')](_[_0x0788('0x3d')](_0x3ffe4f['query'],_0x3c5246[_0x0788('0x35')]),_0x54979a);if(_0x3ffe4f['query'][_0x0788('0x3e')]){_0x5a5178['where']=_[_0x0788('0x3f')](_0x5a5178['where'],{'$or':_[_0x0788('0x33')](_0x54979a,function(_0x57fec9){if(_0x57fec9['type']!==_0x0788('0x40')){var _0x68d9d4={};_0x68d9d4[_0x57fec9[_0x0788('0x2a')]]={'$like':'%'+_0x3ffe4f[_0x0788('0x34')][_0x0788('0x3e')]+'%'};return _0x68d9d4;}})});}_0x5a5178=_['merge']({},_0x5a5178,_0x3ffe4f['options']);var _0x530d83={'where':_0x5a5178['where']};return db[_0x0788('0x2d')][_0x0788('0x1e')](_0x530d83)[_0x0788('0x26')](function(_0x358a22){_0x40d345[_0x0788('0x1e')]=_0x358a22;if(_0x3ffe4f['query']['includeAll']){_0x5a5178[_0x0788('0x41')]=[{'all':!![]}];}return db[_0x0788('0x2d')][_0x0788('0x42')](_0x5a5178);})[_0x0788('0x26')](function(_0x236b63){_0x40d345[_0x0788('0x43')]=_0x236b63;return _0x40d345;})[_0x0788('0x26')](respondWithFilteredResult(_0x5b7594,_0x5a5178))[_0x0788('0x44')](handleError(_0x5b7594,null));};exports[_0x0788('0x45')]=function(_0x50e8f5,_0x5581e6){var _0x441aec={'raw':![],'where':{'id':_0x50e8f5[_0x0788('0x46')]['id']}},_0x1d579d={};_0x1d579d['model']=_['keys'](db['UserProfileResource'][_0x0788('0x2e')]);_0x1d579d[_0x0788('0x34')]=_[_0x0788('0x47')](_0x50e8f5[_0x0788('0x34')]);_0x1d579d[_0x0788('0x35')]=_[_0x0788('0x36')](_0x1d579d[_0x0788('0x32')],_0x1d579d[_0x0788('0x34')]);_0x441aec['attributes']=_[_0x0788('0x36')](_0x1d579d[_0x0788('0x32')],qs[_0x0788('0x38')](_0x50e8f5[_0x0788('0x34')]['fields']));_0x441aec[_0x0788('0x37')]=_0x441aec[_0x0788('0x37')]['length']?_0x441aec['attributes']:_0x1d579d['model'];if(_0x50e8f5[_0x0788('0x34')]['includeAll']){_0x441aec[_0x0788('0x41')]=[{'all':!![]}];}_0x441aec=_[_0x0788('0x3f')]({},_0x441aec,_0x50e8f5[_0x0788('0x48')]);return db[_0x0788('0x2d')][_0x0788('0x49')](_0x441aec)[_0x0788('0x26')](handleEntityNotFound(_0x5581e6,null))[_0x0788('0x26')](respondWithResult(_0x5581e6,null))[_0x0788('0x44')](handleError(_0x5581e6,null));};exports['create']=function(_0x4c6366,_0x39c3cc){return db[_0x0788('0x2d')][_0x0788('0x4a')](_0x4c6366['body'],{})[_0x0788('0x26')](respondWithResult(_0x39c3cc,0xc9))[_0x0788('0x44')](handleError(_0x39c3cc,null));};exports[_0x0788('0x25')]=function(_0x4563cd,_0x2395ad){if(_0x4563cd['body']['id']){delete _0x4563cd['body']['id'];}return db[_0x0788('0x2d')][_0x0788('0x49')]({'where':{'id':_0x4563cd['params']['id']}})[_0x0788('0x26')](handleEntityNotFound(_0x2395ad,null))['then'](saveUpdates(_0x4563cd[_0x0788('0x4b')],null))[_0x0788('0x26')](respondWithResult(_0x2395ad,null))[_0x0788('0x44')](handleError(_0x2395ad,null));};exports[_0x0788('0x27')]=function(_0x3c757a,_0x379928){return db[_0x0788('0x2d')][_0x0788('0x49')]({'where':{'id':_0x3c757a['params']['id']}})[_0x0788('0x26')](handleEntityNotFound(_0x379928,null))[_0x0788('0x26')](removeEntity(_0x379928,null))[_0x0788('0x44')](handleError(_0x379928,null));};exports['describe']=function(_0x1693d0,_0x5d32ae){return db['UserProfileResource'][_0x0788('0x4c')]()[_0x0788('0x26')](respondWithResult(_0x5d32ae,null))[_0x0788('0x44')](handleError(_0x5d32ae,null));}; \ No newline at end of file +var _0xfcf0=['nolimit','order','sort','where','VIRTUAL','filter','includeAll','include','catch','params','merge','options','create','body','find','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','update','then','destroy','error','stack','name','send','index','UserProfileResource','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0xfcf0,0x138));var _0x0fcf=function(_0x26b80e,_0x5c9333){_0x26b80e=_0x26b80e-0x0;var _0x84a8a8=_0xfcf0[_0x26b80e];return _0x84a8a8;};'use strict';var emlformat=require(_0x0fcf('0x0'));var rimraf=require(_0x0fcf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0fcf('0x2'));var rp=require(_0x0fcf('0x3'));var moment=require(_0x0fcf('0x4'));var BPromise=require(_0x0fcf('0x5'));var Mustache=require('mustache');var util=require(_0x0fcf('0x6'));var path=require(_0x0fcf('0x7'));var sox=require(_0x0fcf('0x8'));var csv=require(_0x0fcf('0x9'));var ejs=require(_0x0fcf('0xa'));var fs=require('fs');var fs_extra=require(_0x0fcf('0xb'));var _=require(_0x0fcf('0xc'));var squel=require(_0x0fcf('0xd'));var crypto=require('crypto');var jsforce=require(_0x0fcf('0xe'));var deskjs=require(_0x0fcf('0xf'));var toCsv=require(_0x0fcf('0x9'));var querystring=require('querystring');var Papa=require(_0x0fcf('0x10'));var Redis=require(_0x0fcf('0x11'));var authService=require(_0x0fcf('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0fcf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0fcf('0x14'))(_0x0fcf('0x15'));var utils=require(_0x0fcf('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0fcf('0x17'))['db'];function respondWithStatusCode(_0x3c999e,_0x4b4904){_0x4b4904=_0x4b4904||0xcc;return function(_0x20153d){if(_0x20153d){return _0x3c999e[_0x0fcf('0x18')](_0x4b4904);}return _0x3c999e[_0x0fcf('0x19')](_0x4b4904)[_0x0fcf('0x1a')]();};}function respondWithResult(_0x25fadc,_0x48bba6){_0x48bba6=_0x48bba6||0xc8;return function(_0xa32692){if(_0xa32692){return _0x25fadc[_0x0fcf('0x19')](_0x48bba6)[_0x0fcf('0x1b')](_0xa32692);}};}function respondWithFilteredResult(_0x5e867f,_0x3c09c4){return function(_0x610106){if(_0x610106){var _0x445207=typeof _0x3c09c4[_0x0fcf('0x1c')]==='undefined'&&typeof _0x3c09c4[_0x0fcf('0x1d')]===_0x0fcf('0x1e');var _0x1a8477=_0x610106[_0x0fcf('0x1f')];var _0x19cfbd=_0x445207?0x0:_0x3c09c4['offset'];var _0x18ea32=_0x445207?_0x610106[_0x0fcf('0x1f')]:_0x3c09c4['offset']+_0x3c09c4[_0x0fcf('0x1d')];var _0x1b9a90;if(_0x18ea32>=_0x1a8477){_0x18ea32=_0x1a8477;_0x1b9a90=0xc8;}else{_0x1b9a90=0xce;}_0x5e867f['status'](_0x1b9a90);return _0x5e867f[_0x0fcf('0x20')]('Content-Range',_0x19cfbd+'-'+_0x18ea32+'/'+_0x1a8477)[_0x0fcf('0x1b')](_0x610106);}return null;};}function patchUpdates(_0x13454e){return function(_0x5c8279){try{jsonpatch[_0x0fcf('0x21')](_0x5c8279,_0x13454e,!![]);}catch(_0x3f28d0){return BPromise[_0x0fcf('0x22')](_0x3f28d0);}return _0x5c8279['save']();};}function saveUpdates(_0x2f03ce,_0x1dafc8){return function(_0x196d30){if(_0x196d30){return _0x196d30[_0x0fcf('0x23')](_0x2f03ce)[_0x0fcf('0x24')](function(_0x30e1b0){return _0x30e1b0;});}return null;};}function removeEntity(_0x5841a9,_0x2eef74){return function(_0x253641){if(_0x253641){return _0x253641[_0x0fcf('0x25')]()[_0x0fcf('0x24')](function(){_0x5841a9[_0x0fcf('0x19')](0xcc)[_0x0fcf('0x1a')]();});}};}function handleEntityNotFound(_0x2ce990,_0x18f269){return function(_0x117510){if(!_0x117510){_0x2ce990['sendStatus'](0x194);}return _0x117510;};}function handleError(_0x18965e,_0xc107a){_0xc107a=_0xc107a||0x1f4;return function(_0x41b7a2){logger[_0x0fcf('0x26')](_0x41b7a2[_0x0fcf('0x27')]);if(_0x41b7a2[_0x0fcf('0x28')]){delete _0x41b7a2[_0x0fcf('0x28')];}_0x18965e['status'](_0xc107a)[_0x0fcf('0x29')](_0x41b7a2);};}exports[_0x0fcf('0x2a')]=function(_0x200517,_0x35180d){var _0x49fd0e={},_0x5d9bcd={},_0x4af80d={'count':0x0,'rows':[]};var _0x428194=_['map'](db[_0x0fcf('0x2b')][_0x0fcf('0x2c')],function(_0x56a416){return{'name':_0x56a416[_0x0fcf('0x2d')],'type':_0x56a416[_0x0fcf('0x2e')][_0x0fcf('0x2f')]};});_0x5d9bcd[_0x0fcf('0x30')]=_[_0x0fcf('0x31')](_0x428194,_0x0fcf('0x28'));_0x5d9bcd['query']=_[_0x0fcf('0x32')](_0x200517[_0x0fcf('0x33')]);_0x5d9bcd[_0x0fcf('0x34')]=_[_0x0fcf('0x35')](_0x5d9bcd[_0x0fcf('0x30')],_0x5d9bcd[_0x0fcf('0x33')]);_0x49fd0e['attributes']=_[_0x0fcf('0x35')](_0x5d9bcd[_0x0fcf('0x30')],qs[_0x0fcf('0x36')](_0x200517[_0x0fcf('0x33')][_0x0fcf('0x36')]));_0x49fd0e[_0x0fcf('0x37')]=_0x49fd0e[_0x0fcf('0x37')][_0x0fcf('0x38')]?_0x49fd0e[_0x0fcf('0x37')]:_0x5d9bcd[_0x0fcf('0x30')];if(!_0x200517[_0x0fcf('0x33')][_0x0fcf('0x39')](_0x0fcf('0x3a'))){_0x49fd0e[_0x0fcf('0x1d')]=qs['limit'](_0x200517['query'][_0x0fcf('0x1d')]);_0x49fd0e['offset']=qs['offset'](_0x200517[_0x0fcf('0x33')][_0x0fcf('0x1c')]);}_0x49fd0e[_0x0fcf('0x3b')]=qs['sort'](_0x200517['query'][_0x0fcf('0x3c')]);_0x49fd0e[_0x0fcf('0x3d')]=qs[_0x0fcf('0x34')](_['pick'](_0x200517[_0x0fcf('0x33')],_0x5d9bcd[_0x0fcf('0x34')]),_0x428194);if(_0x200517[_0x0fcf('0x33')]['filter']){_0x49fd0e['where']=_['merge'](_0x49fd0e[_0x0fcf('0x3d')],{'$or':_[_0x0fcf('0x31')](_0x428194,function(_0xdfdd1){if(_0xdfdd1[_0x0fcf('0x2e')]!==_0x0fcf('0x3e')){var _0x4be8eb={};_0x4be8eb[_0xdfdd1[_0x0fcf('0x28')]]={'$like':'%'+_0x200517[_0x0fcf('0x33')][_0x0fcf('0x3f')]+'%'};return _0x4be8eb;}})});}_0x49fd0e=_['merge']({},_0x49fd0e,_0x200517['options']);var _0x13e4b2={'where':_0x49fd0e[_0x0fcf('0x3d')]};return db[_0x0fcf('0x2b')][_0x0fcf('0x1f')](_0x13e4b2)[_0x0fcf('0x24')](function(_0x4c6669){_0x4af80d[_0x0fcf('0x1f')]=_0x4c6669;if(_0x200517[_0x0fcf('0x33')][_0x0fcf('0x40')]){_0x49fd0e[_0x0fcf('0x41')]=[{'all':!![]}];}return db['UserProfileResource']['findAll'](_0x49fd0e);})[_0x0fcf('0x24')](function(_0x2444a6){_0x4af80d['rows']=_0x2444a6;return _0x4af80d;})[_0x0fcf('0x24')](respondWithFilteredResult(_0x35180d,_0x49fd0e))[_0x0fcf('0x42')](handleError(_0x35180d,null));};exports['show']=function(_0x237fa6,_0xfc2f2b){var _0x44eb03={'raw':![],'where':{'id':_0x237fa6[_0x0fcf('0x43')]['id']}},_0x1f322b={};_0x1f322b['model']=_[_0x0fcf('0x32')](db[_0x0fcf('0x2b')]['rawAttributes']);_0x1f322b['query']=_[_0x0fcf('0x32')](_0x237fa6['query']);_0x1f322b['filters']=_[_0x0fcf('0x35')](_0x1f322b[_0x0fcf('0x30')],_0x1f322b[_0x0fcf('0x33')]);_0x44eb03[_0x0fcf('0x37')]=_[_0x0fcf('0x35')](_0x1f322b[_0x0fcf('0x30')],qs[_0x0fcf('0x36')](_0x237fa6[_0x0fcf('0x33')][_0x0fcf('0x36')]));_0x44eb03[_0x0fcf('0x37')]=_0x44eb03['attributes'][_0x0fcf('0x38')]?_0x44eb03[_0x0fcf('0x37')]:_0x1f322b[_0x0fcf('0x30')];if(_0x237fa6['query']['includeAll']){_0x44eb03[_0x0fcf('0x41')]=[{'all':!![]}];}_0x44eb03=_[_0x0fcf('0x44')]({},_0x44eb03,_0x237fa6[_0x0fcf('0x45')]);return db[_0x0fcf('0x2b')]['find'](_0x44eb03)['then'](handleEntityNotFound(_0xfc2f2b,null))[_0x0fcf('0x24')](respondWithResult(_0xfc2f2b,null))[_0x0fcf('0x42')](handleError(_0xfc2f2b,null));};exports[_0x0fcf('0x46')]=function(_0x1fb83d,_0x345188){return db[_0x0fcf('0x2b')][_0x0fcf('0x46')](_0x1fb83d[_0x0fcf('0x47')],{})['then'](respondWithResult(_0x345188,0xc9))['catch'](handleError(_0x345188,null));};exports[_0x0fcf('0x23')]=function(_0x243699,_0x28d2f4){if(_0x243699[_0x0fcf('0x47')]['id']){delete _0x243699[_0x0fcf('0x47')]['id'];}return db[_0x0fcf('0x2b')]['find']({'where':{'id':_0x243699[_0x0fcf('0x43')]['id']}})[_0x0fcf('0x24')](handleEntityNotFound(_0x28d2f4,null))['then'](saveUpdates(_0x243699[_0x0fcf('0x47')],null))[_0x0fcf('0x24')](respondWithResult(_0x28d2f4,null))[_0x0fcf('0x42')](handleError(_0x28d2f4,null));};exports[_0x0fcf('0x25')]=function(_0x5435c0,_0xc514bf){return db[_0x0fcf('0x2b')][_0x0fcf('0x48')]({'where':{'id':_0x5435c0[_0x0fcf('0x43')]['id']}})[_0x0fcf('0x24')](handleEntityNotFound(_0xc514bf,null))[_0x0fcf('0x24')](removeEntity(_0xc514bf,null))[_0x0fcf('0x42')](handleError(_0xc514bf,null));};exports[_0x0fcf('0x49')]=function(_0x389d71,_0x3a473c){return db[_0x0fcf('0x2b')][_0x0fcf('0x49')]()[_0x0fcf('0x24')](respondWithResult(_0x3a473c,null))[_0x0fcf('0x42')](handleError(_0x3a473c,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index f3e040b..7ab9cd0 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 _0x7d5a=['compositeIndex','resourceId','sectionId','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','UserProfileResource','user_profile_has_resources'];(function(_0x2c449c,_0x4c5246){var _0x28716e=function(_0x4689b4){while(--_0x4689b4){_0x2c449c['push'](_0x2c449c['shift']());}};_0x28716e(++_0x4c5246);}(_0x7d5a,0xb3));var _0xa7d5=function(_0x2f9158,_0x2c4a50){_0x2f9158=_0x2f9158-0x0;var _0x137a95=_0x7d5a[_0x2f9158];return _0x137a95;};'use strict';var _=require(_0xa7d5('0x0'));var util=require(_0xa7d5('0x1'));var logger=require(_0xa7d5('0x2'))(_0xa7d5('0x3'));var moment=require(_0xa7d5('0x4'));var BPromise=require('bluebird');var rp=require(_0xa7d5('0x5'));var fs=require('fs');var path=require(_0xa7d5('0x6'));var rimraf=require(_0xa7d5('0x7'));var config=require(_0xa7d5('0x8'));var attributes=require('./userProfileResource.attributes');module[_0xa7d5('0x9')]=function(_0x4dba85,_0x429820){return _0x4dba85[_0xa7d5('0xa')](_0xa7d5('0xb'),attributes,{'tableName':_0xa7d5('0xc'),'paranoid':![],'indexes':[{'name':_0xa7d5('0xd'),'fields':[_0xa7d5('0xe'),_0xa7d5('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1810=['user_profile_has_resources','compositeIndex','resourceId','sectionId','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','define'];(function(_0x51408a,_0x5002c0){var _0x147451=function(_0x18340b){while(--_0x18340b){_0x51408a['push'](_0x51408a['shift']());}};_0x147451(++_0x5002c0);}(_0x1810,0xf4));var _0x0181=function(_0x4102a1,_0x2baefd){_0x4102a1=_0x4102a1-0x0;var _0x443434=_0x1810[_0x4102a1];return _0x443434;};'use strict';var _=require(_0x0181('0x0'));var util=require(_0x0181('0x1'));var logger=require(_0x0181('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0181('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0181('0x4'));var rimraf=require(_0x0181('0x5'));var config=require(_0x0181('0x6'));var attributes=require('./userProfileResource.attributes');module['exports']=function(_0x5d0f8a,_0x308a8a){return _0x5d0f8a[_0x0181('0x7')]('UserProfileResource',attributes,{'tableName':_0x0181('0x8'),'paranoid':![],'indexes':[{'name':_0x0181('0x9'),'fields':[_0x0181('0xa'),_0x0181('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index e06f26b..adf9674 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 _0x0b1d=['then','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x4402e5,_0x584d28){var _0x3f67f8=function(_0xf93cf9){while(--_0xf93cf9){_0x4402e5['push'](_0x4402e5['shift']());}};_0x3f67f8(++_0x584d28);}(_0x0b1d,0x108));var _0xd0b1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0b1d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd0b1('0x0'));var util=require(_0xd0b1('0x1'));var moment=require('moment');var BPromise=require(_0xd0b1('0x2'));var rs=require(_0xd0b1('0x3'));var fs=require('fs');var Redis=require(_0xd0b1('0x4'));var db=require(_0xd0b1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd0b1('0x6'))(_0xd0b1('0x7'));var config=require(_0xd0b1('0x8'));var jayson=require(_0xd0b1('0x9'));var client=jayson[_0xd0b1('0xa')][_0xd0b1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3faf65,_0x1dadb5,_0x53994c){return new BPromise(function(_0x2cff2f,_0x52b7ce){return client['request'](_0x3faf65,_0x53994c)[_0xd0b1('0xc')](function(_0x965bbc){logger['info'](_0xd0b1('0xd'),_0x1dadb5,_0xd0b1('0xe'));logger[_0xd0b1('0xf')](_0xd0b1('0x10'),_0x1dadb5,_0xd0b1('0xe'),JSON[_0xd0b1('0x11')](_0x965bbc));if(_0x965bbc['error']){if(_0x965bbc['error'][_0xd0b1('0x12')]===0x1f4){logger['error'](_0xd0b1('0xd'),_0x1dadb5,_0x965bbc[_0xd0b1('0x13')][_0xd0b1('0x14')]);return _0x52b7ce(_0x965bbc[_0xd0b1('0x13')]['message']);}logger[_0xd0b1('0x13')](_0xd0b1('0xd'),_0x1dadb5,_0x965bbc['error']['message']);return _0x2cff2f(_0x965bbc[_0xd0b1('0x13')][_0xd0b1('0x14')]);}else{logger[_0xd0b1('0x15')](_0xd0b1('0xd'),_0x1dadb5,_0xd0b1('0xe'));_0x2cff2f(_0x965bbc['result']['message']);}})[_0xd0b1('0x16')](function(_0x179e80){logger[_0xd0b1('0x13')](_0xd0b1('0xd'),_0x1dadb5,_0x179e80);_0x52b7ce(_0x179e80);});});} \ No newline at end of file +var _0x649c=['UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x649c,0xc6));var _0xc649=function(_0x391310,_0x206430){_0x391310=_0x391310-0x0;var _0x542665=_0x649c[_0x391310];return _0x542665;};'use strict';var _=require(_0xc649('0x0'));var util=require('util');var moment=require(_0xc649('0x1'));var BPromise=require(_0xc649('0x2'));var rs=require(_0xc649('0x3'));var fs=require('fs');var Redis=require(_0xc649('0x4'));var db=require(_0xc649('0x5'))['db'];var utils=require(_0xc649('0x6'));var logger=require(_0xc649('0x7'))(_0xc649('0x8'));var config=require(_0xc649('0x9'));var jayson=require(_0xc649('0xa'));var client=jayson[_0xc649('0xb')][_0xc649('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x8c6074,_0x3698ec,_0x1654fb){return new BPromise(function(_0x5f15f7,_0x512762){return client[_0xc649('0xd')](_0x8c6074,_0x1654fb)[_0xc649('0xe')](function(_0x249609){logger['info'](_0xc649('0xf'),_0x3698ec,_0xc649('0x10'));logger[_0xc649('0x11')](_0xc649('0x12'),_0x3698ec,_0xc649('0x10'),JSON[_0xc649('0x13')](_0x249609));if(_0x249609[_0xc649('0x14')]){if(_0x249609[_0xc649('0x14')][_0xc649('0x15')]===0x1f4){logger[_0xc649('0x14')]('UserProfileResource,\x20%s,\x20%s',_0x3698ec,_0x249609[_0xc649('0x14')][_0xc649('0x16')]);return _0x512762(_0x249609[_0xc649('0x14')][_0xc649('0x16')]);}logger[_0xc649('0x14')](_0xc649('0xf'),_0x3698ec,_0x249609[_0xc649('0x14')][_0xc649('0x16')]);return _0x5f15f7(_0x249609[_0xc649('0x14')][_0xc649('0x16')]);}else{logger['info']('UserProfileResource,\x20%s,\x20%s',_0x3698ec,_0xc649('0x10'));_0x5f15f7(_0x249609['result']['message']);}})[_0xc649('0x17')](function(_0x9cf89a){logger[_0xc649('0x14')]('UserProfileResource,\x20%s,\x20%s',_0x3698ec,_0x9cf89a);_0x512762(_0x9cf89a);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index c3cb63f..475952e 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 _0x0d43=['update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id','show','post','create','put'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x0d43,0xa4));var _0x30d4=function(_0x506cbf,_0xb7e1d8){_0x506cbf=_0x506cbf-0x0;var _0x5513f1=_0x0d43[_0x506cbf];return _0x5513f1;};'use strict';var multer=require('multer');var util=require(_0x30d4('0x0'));var path=require(_0x30d4('0x1'));var timeout=require(_0x30d4('0x2'));var express=require(_0x30d4('0x3'));var router=express[_0x30d4('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x30d4('0x5'));var interaction=require(_0x30d4('0x6'));var config=require(_0x30d4('0x7'));var controller=require('./userProfileSection.controller');router[_0x30d4('0x8')]('/',auth[_0x30d4('0x9')](),controller['index']);router[_0x30d4('0x8')](_0x30d4('0xa'),auth[_0x30d4('0x9')](),controller['describe']);router[_0x30d4('0x8')](_0x30d4('0xb'),auth[_0x30d4('0x9')](),controller[_0x30d4('0xc')]);router[_0x30d4('0xd')]('/',auth[_0x30d4('0x9')](),controller[_0x30d4('0xe')]);router[_0x30d4('0xf')](_0x30d4('0xb'),auth[_0x30d4('0x9')](),controller[_0x30d4('0x10')]);router[_0x30d4('0x11')](_0x30d4('0xb'),auth['isAuthenticated'](),controller[_0x30d4('0x12')]);module[_0x30d4('0x13')]=router; \ No newline at end of file +var _0x9614=['fs-extra','../../components/auth/service','../../components/interaction/service','./userProfileSection.controller','isAuthenticated','index','get','/describe','describe','/:id','post','put','update','delete','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x3d54bd,_0x4383d2){var _0x4a88ec=function(_0xdaf377){while(--_0xdaf377){_0x3d54bd['push'](_0x3d54bd['shift']());}};_0x4a88ec(++_0x4383d2);}(_0x9614,0xe1));var _0x4961=function(_0x1ff329,_0x33e086){_0x1ff329=_0x1ff329-0x0;var _0x28501d=_0x9614[_0x1ff329];return _0x28501d;};'use strict';var multer=require(_0x4961('0x0'));var util=require(_0x4961('0x1'));var path=require(_0x4961('0x2'));var timeout=require(_0x4961('0x3'));var express=require(_0x4961('0x4'));var router=express[_0x4961('0x5')]();var fs_extra=require(_0x4961('0x6'));var auth=require(_0x4961('0x7'));var interaction=require(_0x4961('0x8'));var config=require('../../config/environment');var controller=require(_0x4961('0x9'));router['get']('/',auth[_0x4961('0xa')](),controller[_0x4961('0xb')]);router[_0x4961('0xc')](_0x4961('0xd'),auth[_0x4961('0xa')](),controller[_0x4961('0xe')]);router[_0x4961('0xc')](_0x4961('0xf'),auth[_0x4961('0xa')](),controller['show']);router[_0x4961('0x10')]('/',auth[_0x4961('0xa')](),controller['create']);router[_0x4961('0x11')](_0x4961('0xf'),auth[_0x4961('0xa')](),controller[_0x4961('0x12')]);router[_0x4961('0x13')]('/:id',auth[_0x4961('0xa')](),controller['destroy']);module[_0x4961('0x14')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 38476b7..1e3bbcc 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 _0x63a5=['STRING','INTEGER','BOOLEAN','setDataValue','getDataValue','crudPermissions','sequelize','exports'];(function(_0x48b5e0,_0xb3826){var _0x4287ea=function(_0x14519e){while(--_0x14519e){_0x48b5e0['push'](_0x48b5e0['shift']());}};_0x4287ea(++_0xb3826);}(_0x63a5,0x18e));var _0x563a=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x63a5[_0x53ccf2];return _0x5a2964;};'use strict';var Sequelize=require(_0x563a('0x0'));module[_0x563a('0x1')]={'name':{'type':Sequelize[_0x563a('0x2')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0x563a('0x3')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x563a('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x563a('0x2')],'set':function(_0x386400){this[_0x563a('0x5')]('crudPermissions',_0x386400?_0x386400['join'](''):[]);},'get':function(){return this[_0x563a('0x6')]('crudPermissions')?this[_0x563a('0x6')](_0x563a('0x7'))['split'](''):[];}}}; \ No newline at end of file +var _0xbc9d=['sequelize','exports','STRING','INTEGER','setDataValue','crudPermissions','join','getDataValue','split'];(function(_0x4445a9,_0x4d7cc8){var _0x18d7f8=function(_0x232a8c){while(--_0x232a8c){_0x4445a9['push'](_0x4445a9['shift']());}};_0x18d7f8(++_0x4d7cc8);}(_0xbc9d,0xb4));var _0xdbc9=function(_0x247161,_0x2578bc){_0x247161=_0x247161-0x0;var _0x4972d2=_0xbc9d[_0x247161];return _0x4972d2;};'use strict';var Sequelize=require(_0xdbc9('0x0'));module[_0xdbc9('0x1')]={'name':{'type':Sequelize[_0xdbc9('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0xdbc9('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xdbc9('0x3')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x2aba48){this[_0xdbc9('0x4')](_0xdbc9('0x5'),_0x2aba48?_0x2aba48[_0xdbc9('0x6')](''):[]);},'get':function(){return this[_0xdbc9('0x7')](_0xdbc9('0x5'))?this[_0xdbc9('0x7')]('crudPermissions')[_0xdbc9('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index b46b98b..fd96da2 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 _0xda09=['query','keys','attributes','intersection','hasOwnProperty','nolimit','order','sort','where','filters','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','UserProfileSection','fields','length','find','create','body','params','eml-format','rimraf','moment','mustache','util','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','../../config/environment','../../mysqldb','end','json','offset','undefined','limit','count','status','set','apply','save','update','then','destroy','sendStatus','name','send','index','map','rawAttributes','fieldName','key','model'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xda09,0xa9));var _0x9da0=function(_0x42ca44,_0x526db0){_0x42ca44=_0x42ca44-0x0;var _0x396f9a=_0xda09[_0x42ca44];return _0x396f9a;};'use strict';var emlformat=require(_0x9da0('0x0'));var rimraf=require(_0x9da0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9da0('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x9da0('0x3'));var util=require(_0x9da0('0x4'));var path=require(_0x9da0('0x5'));var sox=require(_0x9da0('0x6'));var csv=require(_0x9da0('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9da0('0x8'));var _=require('lodash');var squel=require(_0x9da0('0x9'));var crypto=require(_0x9da0('0xa'));var jsforce=require(_0x9da0('0xb'));var deskjs=require(_0x9da0('0xc'));var toCsv=require('to-csv');var querystring=require(_0x9da0('0xd'));var Papa=require(_0x9da0('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9da0('0xf'));var as=require(_0x9da0('0x10'));var hardwareService=require(_0x9da0('0x11'));var logger=require(_0x9da0('0x12'))(_0x9da0('0x13'));var utils=require('../../config/utils');var config=require(_0x9da0('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x9da0('0x15'))['db'];function respondWithStatusCode(_0xf3362b,_0x5a5d71){_0x5a5d71=_0x5a5d71||0xcc;return function(_0x257f76){if(_0x257f76){return _0xf3362b['sendStatus'](_0x5a5d71);}return _0xf3362b['status'](_0x5a5d71)[_0x9da0('0x16')]();};}function respondWithResult(_0x50fc2e,_0x4e5f4a){_0x4e5f4a=_0x4e5f4a||0xc8;return function(_0x55f46f){if(_0x55f46f){return _0x50fc2e['status'](_0x4e5f4a)[_0x9da0('0x17')](_0x55f46f);}};}function respondWithFilteredResult(_0x47c19c,_0x56ca75){return function(_0x21c810){if(_0x21c810){var _0x3871e3=typeof _0x56ca75[_0x9da0('0x18')]===_0x9da0('0x19')&&typeof _0x56ca75[_0x9da0('0x1a')]==='undefined';var _0x51122b=_0x21c810[_0x9da0('0x1b')];var _0x46d736=_0x3871e3?0x0:_0x56ca75[_0x9da0('0x18')];var _0x41e5ca=_0x3871e3?_0x21c810[_0x9da0('0x1b')]:_0x56ca75[_0x9da0('0x18')]+_0x56ca75[_0x9da0('0x1a')];var _0x21c512;if(_0x41e5ca>=_0x51122b){_0x41e5ca=_0x51122b;_0x21c512=0xc8;}else{_0x21c512=0xce;}_0x47c19c[_0x9da0('0x1c')](_0x21c512);return _0x47c19c[_0x9da0('0x1d')]('Content-Range',_0x46d736+'-'+_0x41e5ca+'/'+_0x51122b)[_0x9da0('0x17')](_0x21c810);}return null;};}function patchUpdates(_0xd8a85d){return function(_0x286f4d){try{jsonpatch[_0x9da0('0x1e')](_0x286f4d,_0xd8a85d,!![]);}catch(_0x2e19d5){return BPromise['reject'](_0x2e19d5);}return _0x286f4d[_0x9da0('0x1f')]();};}function saveUpdates(_0x2d0117,_0x46a5bd){return function(_0x5ce2ef){if(_0x5ce2ef){return _0x5ce2ef[_0x9da0('0x20')](_0x2d0117)[_0x9da0('0x21')](function(_0x1c9657){return _0x1c9657;});}return null;};}function removeEntity(_0x445d20,_0x237395){return function(_0x402265){if(_0x402265){return _0x402265[_0x9da0('0x22')]()[_0x9da0('0x21')](function(){_0x445d20[_0x9da0('0x1c')](0xcc)[_0x9da0('0x16')]();});}};}function handleEntityNotFound(_0x19e4e3,_0x46705e){return function(_0x592089){if(!_0x592089){_0x19e4e3[_0x9da0('0x23')](0x194);}return _0x592089;};}function handleError(_0x2a6e38,_0x444a15){_0x444a15=_0x444a15||0x1f4;return function(_0x1e2b8f){logger['error'](_0x1e2b8f['stack']);if(_0x1e2b8f[_0x9da0('0x24')]){delete _0x1e2b8f['name'];}_0x2a6e38['status'](_0x444a15)[_0x9da0('0x25')](_0x1e2b8f);};}exports[_0x9da0('0x26')]=function(_0x1465fa,_0x591768){var _0x3aba4d={},_0x7985bf={},_0x216b50={'count':0x0,'rows':[]};var _0x474e13=_[_0x9da0('0x27')](db['UserProfileSection'][_0x9da0('0x28')],function(_0x2e0503){return{'name':_0x2e0503[_0x9da0('0x29')],'type':_0x2e0503['type'][_0x9da0('0x2a')]};});_0x7985bf[_0x9da0('0x2b')]=_[_0x9da0('0x27')](_0x474e13,_0x9da0('0x24'));_0x7985bf[_0x9da0('0x2c')]=_[_0x9da0('0x2d')](_0x1465fa[_0x9da0('0x2c')]);_0x7985bf['filters']=_['intersection'](_0x7985bf[_0x9da0('0x2b')],_0x7985bf[_0x9da0('0x2c')]);_0x3aba4d[_0x9da0('0x2e')]=_[_0x9da0('0x2f')](_0x7985bf[_0x9da0('0x2b')],qs['fields'](_0x1465fa[_0x9da0('0x2c')]['fields']));_0x3aba4d[_0x9da0('0x2e')]=_0x3aba4d['attributes']['length']?_0x3aba4d['attributes']:_0x7985bf[_0x9da0('0x2b')];if(!_0x1465fa[_0x9da0('0x2c')][_0x9da0('0x30')](_0x9da0('0x31'))){_0x3aba4d[_0x9da0('0x1a')]=qs[_0x9da0('0x1a')](_0x1465fa[_0x9da0('0x2c')][_0x9da0('0x1a')]);_0x3aba4d[_0x9da0('0x18')]=qs[_0x9da0('0x18')](_0x1465fa[_0x9da0('0x2c')][_0x9da0('0x18')]);}_0x3aba4d[_0x9da0('0x32')]=qs[_0x9da0('0x33')](_0x1465fa[_0x9da0('0x2c')][_0x9da0('0x33')]);_0x3aba4d[_0x9da0('0x34')]=qs[_0x9da0('0x35')](_['pick'](_0x1465fa[_0x9da0('0x2c')],_0x7985bf['filters']),_0x474e13);if(_0x1465fa['query']['filter']){_0x3aba4d[_0x9da0('0x34')]=_[_0x9da0('0x36')](_0x3aba4d[_0x9da0('0x34')],{'$or':_[_0x9da0('0x27')](_0x474e13,function(_0x6d849c){if(_0x6d849c[_0x9da0('0x37')]!==_0x9da0('0x38')){var _0x717ab={};_0x717ab[_0x6d849c[_0x9da0('0x24')]]={'$like':'%'+_0x1465fa[_0x9da0('0x2c')]['filter']+'%'};return _0x717ab;}})});}_0x3aba4d=_[_0x9da0('0x36')]({},_0x3aba4d,_0x1465fa[_0x9da0('0x39')]);var _0x5979bd={'where':_0x3aba4d['where']};return db['UserProfileSection']['count'](_0x5979bd)[_0x9da0('0x21')](function(_0x22273e){_0x216b50[_0x9da0('0x1b')]=_0x22273e;if(_0x1465fa['query'][_0x9da0('0x3a')]){_0x3aba4d[_0x9da0('0x3b')]=[{'all':!![]}];}return db['UserProfileSection'][_0x9da0('0x3c')](_0x3aba4d);})[_0x9da0('0x21')](function(_0xebbd5d){_0x216b50[_0x9da0('0x3d')]=_0xebbd5d;return _0x216b50;})[_0x9da0('0x21')](respondWithFilteredResult(_0x591768,_0x3aba4d))[_0x9da0('0x3e')](handleError(_0x591768,null));};exports[_0x9da0('0x3f')]=function(_0x460743,_0x414f5d){var _0x3dd539={'raw':![],'where':{'id':_0x460743['params']['id']}},_0x27c84d={};_0x27c84d[_0x9da0('0x2b')]=_['keys'](db[_0x9da0('0x40')][_0x9da0('0x28')]);_0x27c84d['query']=_['keys'](_0x460743[_0x9da0('0x2c')]);_0x27c84d[_0x9da0('0x35')]=_[_0x9da0('0x2f')](_0x27c84d[_0x9da0('0x2b')],_0x27c84d[_0x9da0('0x2c')]);_0x3dd539[_0x9da0('0x2e')]=_[_0x9da0('0x2f')](_0x27c84d[_0x9da0('0x2b')],qs[_0x9da0('0x41')](_0x460743['query'][_0x9da0('0x41')]));_0x3dd539[_0x9da0('0x2e')]=_0x3dd539[_0x9da0('0x2e')][_0x9da0('0x42')]?_0x3dd539[_0x9da0('0x2e')]:_0x27c84d['model'];if(_0x460743[_0x9da0('0x2c')][_0x9da0('0x3a')]){_0x3dd539[_0x9da0('0x3b')]=[{'all':!![]}];}_0x3dd539=_['merge']({},_0x3dd539,_0x460743[_0x9da0('0x39')]);return db[_0x9da0('0x40')][_0x9da0('0x43')](_0x3dd539)[_0x9da0('0x21')](handleEntityNotFound(_0x414f5d,null))['then'](respondWithResult(_0x414f5d,null))[_0x9da0('0x3e')](handleError(_0x414f5d,null));};exports['create']=function(_0x54f300,_0x59c958){return db[_0x9da0('0x40')][_0x9da0('0x44')](_0x54f300[_0x9da0('0x45')],{})['then'](respondWithResult(_0x59c958,0xc9))['catch'](handleError(_0x59c958,null));};exports['update']=function(_0x1a70af,_0x571f91){if(_0x1a70af[_0x9da0('0x45')]['id']){delete _0x1a70af['body']['id'];}return db[_0x9da0('0x40')][_0x9da0('0x43')]({'where':{'id':_0x1a70af[_0x9da0('0x46')]['id']}})[_0x9da0('0x21')](handleEntityNotFound(_0x571f91,null))[_0x9da0('0x21')](saveUpdates(_0x1a70af['body'],null))['then'](respondWithResult(_0x571f91,null))[_0x9da0('0x3e')](handleError(_0x571f91,null));};exports[_0x9da0('0x22')]=function(_0x4b3b3d,_0x1c0526){return db[_0x9da0('0x40')][_0x9da0('0x43')]({'where':{'id':_0x4b3b3d[_0x9da0('0x46')]['id']}})[_0x9da0('0x21')](handleEntityNotFound(_0x1c0526,null))['then'](removeEntity(_0x1c0526,null))[_0x9da0('0x3e')](handleError(_0x1c0526,null));};exports['describe']=function(_0x533fcf,_0x38e8a4){return db[_0x9da0('0x40')]['describe']()[_0x9da0('0x21')](respondWithResult(_0x38e8a4,null))['catch'](handleError(_0x38e8a4,null));}; \ No newline at end of file +var _0x7a4a=['show','params','rawAttributes','catch','create','body','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','UserProfileSection','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','sort','where','merge','VIRTUAL','options','includeAll','include','findAll'];(function(_0x29274f,_0x28b52c){var _0x440b83=function(_0x11ae48){while(--_0x11ae48){_0x29274f['push'](_0x29274f['shift']());}};_0x440b83(++_0x28b52c);}(_0x7a4a,0x9a));var _0xa7a4=function(_0x1d9d12,_0x2c7d98){_0x1d9d12=_0x1d9d12-0x0;var _0x4f680e=_0x7a4a[_0x1d9d12];return _0x4f680e;};'use strict';var emlformat=require(_0xa7a4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa7a4('0x1'));var jsonpatch=require(_0xa7a4('0x2'));var rp=require(_0xa7a4('0x3'));var moment=require(_0xa7a4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa7a4('0x5'));var util=require('util');var path=require(_0xa7a4('0x6'));var sox=require(_0xa7a4('0x7'));var csv=require(_0xa7a4('0x8'));var ejs=require(_0xa7a4('0x9'));var fs=require('fs');var fs_extra=require(_0xa7a4('0xa'));var _=require(_0xa7a4('0xb'));var squel=require(_0xa7a4('0xc'));var crypto=require(_0xa7a4('0xd'));var jsforce=require(_0xa7a4('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa7a4('0x8'));var querystring=require('querystring');var Papa=require(_0xa7a4('0xf'));var Redis=require(_0xa7a4('0x10'));var authService=require(_0xa7a4('0x11'));var qs=require(_0xa7a4('0x12'));var as=require(_0xa7a4('0x13'));var hardwareService=require(_0xa7a4('0x14'));var logger=require(_0xa7a4('0x15'))(_0xa7a4('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa7a4('0x17'))['db'];function respondWithStatusCode(_0x40cc45,_0x34546c){_0x34546c=_0x34546c||0xcc;return function(_0x6f5ff0){if(_0x6f5ff0){return _0x40cc45[_0xa7a4('0x18')](_0x34546c);}return _0x40cc45[_0xa7a4('0x19')](_0x34546c)[_0xa7a4('0x1a')]();};}function respondWithResult(_0x589c83,_0x3d08b5){_0x3d08b5=_0x3d08b5||0xc8;return function(_0x3e6350){if(_0x3e6350){return _0x589c83[_0xa7a4('0x19')](_0x3d08b5)[_0xa7a4('0x1b')](_0x3e6350);}};}function respondWithFilteredResult(_0x292a2e,_0x54bf4f){return function(_0x1ae1b8){if(_0x1ae1b8){var _0x39053f=typeof _0x54bf4f[_0xa7a4('0x1c')]===_0xa7a4('0x1d')&&typeof _0x54bf4f[_0xa7a4('0x1e')]==='undefined';var _0x187af5=_0x1ae1b8['count'];var _0x5cecc0=_0x39053f?0x0:_0x54bf4f[_0xa7a4('0x1c')];var _0x28a79e=_0x39053f?_0x1ae1b8[_0xa7a4('0x1f')]:_0x54bf4f[_0xa7a4('0x1c')]+_0x54bf4f['limit'];var _0x3c19e8;if(_0x28a79e>=_0x187af5){_0x28a79e=_0x187af5;_0x3c19e8=0xc8;}else{_0x3c19e8=0xce;}_0x292a2e[_0xa7a4('0x19')](_0x3c19e8);return _0x292a2e[_0xa7a4('0x20')](_0xa7a4('0x21'),_0x5cecc0+'-'+_0x28a79e+'/'+_0x187af5)['json'](_0x1ae1b8);}return null;};}function patchUpdates(_0x4ad0d9){return function(_0x9d9836){try{jsonpatch[_0xa7a4('0x22')](_0x9d9836,_0x4ad0d9,!![]);}catch(_0x38e76c){return BPromise[_0xa7a4('0x23')](_0x38e76c);}return _0x9d9836['save']();};}function saveUpdates(_0x2dbb36,_0x55f645){return function(_0x526ac7){if(_0x526ac7){return _0x526ac7[_0xa7a4('0x24')](_0x2dbb36)[_0xa7a4('0x25')](function(_0x23893b){return _0x23893b;});}return null;};}function removeEntity(_0x507398,_0x148888){return function(_0x2c1680){if(_0x2c1680){return _0x2c1680[_0xa7a4('0x26')]()[_0xa7a4('0x25')](function(){_0x507398[_0xa7a4('0x19')](0xcc)[_0xa7a4('0x1a')]();});}};}function handleEntityNotFound(_0x349d2b,_0x113a62){return function(_0x49d40d){if(!_0x49d40d){_0x349d2b[_0xa7a4('0x18')](0x194);}return _0x49d40d;};}function handleError(_0x50fd98,_0x445eeb){_0x445eeb=_0x445eeb||0x1f4;return function(_0x1ca8c7){logger[_0xa7a4('0x27')](_0x1ca8c7[_0xa7a4('0x28')]);if(_0x1ca8c7['name']){delete _0x1ca8c7[_0xa7a4('0x29')];}_0x50fd98['status'](_0x445eeb)[_0xa7a4('0x2a')](_0x1ca8c7);};}exports[_0xa7a4('0x2b')]=function(_0x1ee614,_0x228eb2){var _0x476e66={},_0x3fbf5e={},_0x3c761e={'count':0x0,'rows':[]};var _0x9ca7c6=_[_0xa7a4('0x2c')](db[_0xa7a4('0x2d')]['rawAttributes'],function(_0x26e7ee){return{'name':_0x26e7ee[_0xa7a4('0x2e')],'type':_0x26e7ee[_0xa7a4('0x2f')][_0xa7a4('0x30')]};});_0x3fbf5e[_0xa7a4('0x31')]=_[_0xa7a4('0x2c')](_0x9ca7c6,'name');_0x3fbf5e[_0xa7a4('0x32')]=_[_0xa7a4('0x33')](_0x1ee614['query']);_0x3fbf5e[_0xa7a4('0x34')]=_[_0xa7a4('0x35')](_0x3fbf5e[_0xa7a4('0x31')],_0x3fbf5e[_0xa7a4('0x32')]);_0x476e66[_0xa7a4('0x36')]=_['intersection'](_0x3fbf5e[_0xa7a4('0x31')],qs[_0xa7a4('0x37')](_0x1ee614[_0xa7a4('0x32')]['fields']));_0x476e66[_0xa7a4('0x36')]=_0x476e66[_0xa7a4('0x36')]['length']?_0x476e66[_0xa7a4('0x36')]:_0x3fbf5e[_0xa7a4('0x31')];if(!_0x1ee614['query']['hasOwnProperty'](_0xa7a4('0x38'))){_0x476e66['limit']=qs[_0xa7a4('0x1e')](_0x1ee614['query']['limit']);_0x476e66[_0xa7a4('0x1c')]=qs[_0xa7a4('0x1c')](_0x1ee614[_0xa7a4('0x32')][_0xa7a4('0x1c')]);}_0x476e66['order']=qs[_0xa7a4('0x39')](_0x1ee614[_0xa7a4('0x32')]['sort']);_0x476e66[_0xa7a4('0x3a')]=qs[_0xa7a4('0x34')](_['pick'](_0x1ee614[_0xa7a4('0x32')],_0x3fbf5e[_0xa7a4('0x34')]),_0x9ca7c6);if(_0x1ee614[_0xa7a4('0x32')]['filter']){_0x476e66['where']=_[_0xa7a4('0x3b')](_0x476e66['where'],{'$or':_[_0xa7a4('0x2c')](_0x9ca7c6,function(_0x2a5230){if(_0x2a5230['type']!==_0xa7a4('0x3c')){var _0x1174e0={};_0x1174e0[_0x2a5230[_0xa7a4('0x29')]]={'$like':'%'+_0x1ee614['query']['filter']+'%'};return _0x1174e0;}})});}_0x476e66=_[_0xa7a4('0x3b')]({},_0x476e66,_0x1ee614[_0xa7a4('0x3d')]);var _0x5e6922={'where':_0x476e66[_0xa7a4('0x3a')]};return db[_0xa7a4('0x2d')][_0xa7a4('0x1f')](_0x5e6922)[_0xa7a4('0x25')](function(_0x32e534){_0x3c761e['count']=_0x32e534;if(_0x1ee614[_0xa7a4('0x32')][_0xa7a4('0x3e')]){_0x476e66[_0xa7a4('0x3f')]=[{'all':!![]}];}return db[_0xa7a4('0x2d')][_0xa7a4('0x40')](_0x476e66);})[_0xa7a4('0x25')](function(_0x19df6f){_0x3c761e['rows']=_0x19df6f;return _0x3c761e;})[_0xa7a4('0x25')](respondWithFilteredResult(_0x228eb2,_0x476e66))['catch'](handleError(_0x228eb2,null));};exports[_0xa7a4('0x41')]=function(_0x4f92e3,_0x2e1126){var _0x3935a5={'raw':![],'where':{'id':_0x4f92e3[_0xa7a4('0x42')]['id']}},_0x30e3ed={};_0x30e3ed[_0xa7a4('0x31')]=_[_0xa7a4('0x33')](db[_0xa7a4('0x2d')][_0xa7a4('0x43')]);_0x30e3ed['query']=_['keys'](_0x4f92e3[_0xa7a4('0x32')]);_0x30e3ed['filters']=_[_0xa7a4('0x35')](_0x30e3ed[_0xa7a4('0x31')],_0x30e3ed[_0xa7a4('0x32')]);_0x3935a5[_0xa7a4('0x36')]=_[_0xa7a4('0x35')](_0x30e3ed[_0xa7a4('0x31')],qs[_0xa7a4('0x37')](_0x4f92e3[_0xa7a4('0x32')][_0xa7a4('0x37')]));_0x3935a5[_0xa7a4('0x36')]=_0x3935a5['attributes']['length']?_0x3935a5['attributes']:_0x30e3ed['model'];if(_0x4f92e3[_0xa7a4('0x32')]['includeAll']){_0x3935a5[_0xa7a4('0x3f')]=[{'all':!![]}];}_0x3935a5=_[_0xa7a4('0x3b')]({},_0x3935a5,_0x4f92e3['options']);return db[_0xa7a4('0x2d')]['find'](_0x3935a5)[_0xa7a4('0x25')](handleEntityNotFound(_0x2e1126,null))[_0xa7a4('0x25')](respondWithResult(_0x2e1126,null))[_0xa7a4('0x44')](handleError(_0x2e1126,null));};exports[_0xa7a4('0x45')]=function(_0x54016a,_0x112767){return db['UserProfileSection']['create'](_0x54016a[_0xa7a4('0x46')],{})[_0xa7a4('0x25')](respondWithResult(_0x112767,0xc9))[_0xa7a4('0x44')](handleError(_0x112767,null));};exports['update']=function(_0x49b43d,_0x21c09e){if(_0x49b43d[_0xa7a4('0x46')]['id']){delete _0x49b43d['body']['id'];}return db[_0xa7a4('0x2d')]['find']({'where':{'id':_0x49b43d[_0xa7a4('0x42')]['id']}})['then'](handleEntityNotFound(_0x21c09e,null))[_0xa7a4('0x25')](saveUpdates(_0x49b43d[_0xa7a4('0x46')],null))[_0xa7a4('0x25')](respondWithResult(_0x21c09e,null))[_0xa7a4('0x44')](handleError(_0x21c09e,null));};exports['destroy']=function(_0xbba08d,_0x1597d7){return db[_0xa7a4('0x2d')][_0xa7a4('0x47')]({'where':{'id':_0xbba08d[_0xa7a4('0x42')]['id']}})[_0xa7a4('0x25')](handleEntityNotFound(_0x1597d7,null))[_0xa7a4('0x25')](removeEntity(_0x1597d7,null))['catch'](handleError(_0x1597d7,null));};exports['describe']=function(_0x258db7,_0x58f742){return db[_0xa7a4('0x2d')][_0xa7a4('0x48')]()[_0xa7a4('0x25')](respondWithResult(_0x58f742,null))['catch'](handleError(_0x58f742,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index a9caad3..b897fb6 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 _0x0d79=['../../config/logger','api','moment','bluebird','request-promise','path','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash','util'];(function(_0x50b37a,_0x538054){var _0xf9328=function(_0x54bbc7){while(--_0x54bbc7){_0x50b37a['push'](_0x50b37a['shift']());}};_0xf9328(++_0x538054);}(_0x0d79,0x6e));var _0x90d7=function(_0x21f2cf,_0x1417ea){_0x21f2cf=_0x21f2cf-0x0;var _0x50d69c=_0x0d79[_0x21f2cf];return _0x50d69c;};'use strict';var _=require(_0x90d7('0x0'));var util=require(_0x90d7('0x1'));var logger=require(_0x90d7('0x2'))(_0x90d7('0x3'));var moment=require(_0x90d7('0x4'));var BPromise=require(_0x90d7('0x5'));var rp=require(_0x90d7('0x6'));var fs=require('fs');var path=require(_0x90d7('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x90d7('0x8'));module[_0x90d7('0x9')]=function(_0x5dbac8,_0x165f83){return _0x5dbac8[_0x90d7('0xa')](_0x90d7('0xb'),attributes,{'tableName':_0x90d7('0xc'),'paranoid':![],'indexes':[{'name':_0x90d7('0xd'),'fields':[_0x90d7('0xe'),_0x90d7('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa490=['path','rimraf','./userProfileSection.attributes','define','compositeIndex','sectionId','../../config/logger','api','moment','bluebird'];(function(_0x4bb419,_0x12ee51){var _0x102f88=function(_0x11965a){while(--_0x11965a){_0x4bb419['push'](_0x4bb419['shift']());}};_0x102f88(++_0x12ee51);}(_0xa490,0xce));var _0x0a49=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa490[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0a49('0x0'))(_0x0a49('0x1'));var moment=require(_0x0a49('0x2'));var BPromise=require(_0x0a49('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a49('0x4'));var rimraf=require(_0x0a49('0x5'));var config=require('../../config/environment');var attributes=require(_0x0a49('0x6'));module['exports']=function(_0x449cf8,_0x1b2a55){return _0x449cf8[_0x0a49('0x7')]('UserProfileSection',attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0x0a49('0x8'),'fields':[_0x0a49('0x9'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 29bad43..0cad2c1 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 _0xa25d=['code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x5bf3ca,_0x49d7a9){var _0x315700=function(_0x5e50b6){while(--_0x5e50b6){_0x5bf3ca['push'](_0x5bf3ca['shift']());}};_0x315700(++_0x49d7a9);}(_0xa25d,0xca));var _0xda25=function(_0x421c11,_0xcf7560){_0x421c11=_0x421c11-0x0;var _0x317709=_0xa25d[_0x421c11];return _0x317709;};'use strict';var _=require(_0xda25('0x0'));var util=require(_0xda25('0x1'));var moment=require(_0xda25('0x2'));var BPromise=require('bluebird');var rs=require(_0xda25('0x3'));var fs=require('fs');var Redis=require(_0xda25('0x4'));var db=require(_0xda25('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xda25('0x6'));var config=require(_0xda25('0x7'));var jayson=require(_0xda25('0x8'));var client=jayson[_0xda25('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d7bec,_0x33006e,_0x3b9286){return new BPromise(function(_0x15a1eb,_0x2d2aa8){return client[_0xda25('0xa')](_0x2d7bec,_0x3b9286)[_0xda25('0xb')](function(_0x595620){logger[_0xda25('0xc')](_0xda25('0xd'),_0x33006e,_0xda25('0xe'));logger[_0xda25('0xf')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x33006e,_0xda25('0xe'),JSON[_0xda25('0x10')](_0x595620));if(_0x595620[_0xda25('0x11')]){if(_0x595620['error'][_0xda25('0x12')]===0x1f4){logger['error'](_0xda25('0xd'),_0x33006e,_0x595620['error']['message']);return _0x2d2aa8(_0x595620[_0xda25('0x11')][_0xda25('0x13')]);}logger[_0xda25('0x11')](_0xda25('0xd'),_0x33006e,_0x595620['error']['message']);return _0x15a1eb(_0x595620[_0xda25('0x11')]['message']);}else{logger[_0xda25('0xc')](_0xda25('0xd'),_0x33006e,_0xda25('0xe'));_0x15a1eb(_0x595620[_0xda25('0x14')]['message']);}})[_0xda25('0x15')](function(_0x499392){logger[_0xda25('0x11')]('UserProfileSection,\x20%s,\x20%s',_0x33006e,_0x499392);_0x2d2aa8(_0x499392);});});} \ No newline at end of file +var _0xd87f=['debug','stringify','error','message','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','info','UserProfileSection,\x20%s,\x20%s','request\x20sent'];(function(_0xe11185,_0x301ca4){var _0x8d9deb=function(_0xd98940){while(--_0xd98940){_0xe11185['push'](_0xe11185['shift']());}};_0x8d9deb(++_0x301ca4);}(_0xd87f,0x137));var _0xfd87=function(_0x2906df,_0x1584f1){_0x2906df=_0x2906df-0x0;var _0x41d153=_0xd87f[_0x2906df];return _0x41d153;};'use strict';var _=require(_0xfd87('0x0'));var util=require(_0xfd87('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfd87('0x2'));var fs=require('fs');var Redis=require(_0xfd87('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xfd87('0x4'));var logger=require(_0xfd87('0x5'))('rpc');var config=require(_0xfd87('0x6'));var jayson=require(_0xfd87('0x7'));var client=jayson[_0xfd87('0x8')][_0xfd87('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5c014a,_0x475dc0,_0x516112){return new BPromise(function(_0x533235,_0x150899){return client['request'](_0x5c014a,_0x516112)['then'](function(_0x38d3a4){logger[_0xfd87('0xa')](_0xfd87('0xb'),_0x475dc0,_0xfd87('0xc'));logger[_0xfd87('0xd')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x475dc0,_0xfd87('0xc'),JSON[_0xfd87('0xe')](_0x38d3a4));if(_0x38d3a4[_0xfd87('0xf')]){if(_0x38d3a4[_0xfd87('0xf')]['code']===0x1f4){logger[_0xfd87('0xf')](_0xfd87('0xb'),_0x475dc0,_0x38d3a4[_0xfd87('0xf')]['message']);return _0x150899(_0x38d3a4['error']['message']);}logger['error']('UserProfileSection,\x20%s,\x20%s',_0x475dc0,_0x38d3a4[_0xfd87('0xf')][_0xfd87('0x10')]);return _0x533235(_0x38d3a4[_0xfd87('0xf')]['message']);}else{logger[_0xfd87('0xa')](_0xfd87('0xb'),_0x475dc0,'request\x20sent');_0x533235(_0x38d3a4['result'][_0xfd87('0x10')]);}})[_0xfd87('0x11')](function(_0x14d58f){logger['error'](_0xfd87('0xb'),_0x475dc0,_0x14d58f);_0x150899(_0x14d58f);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 5c52a65..9ecf836 100644 --- a/server/api/userSmsQueue/index.js +++ b/server/api/userSmsQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x4369c3,_0x43b3b0){var _0x464a8f=function(_0x509da1){while(--_0x509da1){_0x4369c3['push'](_0x4369c3['shift']());}};_0x464a8f(++_0x43b3b0);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x55e1d1,_0x3c9376){_0x55e1d1=_0x55e1d1-0x0;var _0x1165db=_0xcb91[_0x55e1d1];return _0x1165db;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x4da133,_0x44c50d){var _0x3420c7=function(_0x273b3c){while(--_0x273b3c){_0x4da133['push'](_0x4da133['shift']());}};_0x3420c7(++_0x44c50d);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x340756,_0xad31ae){_0x340756=_0x340756-0x0;var _0x2ef745=_0xcb91[_0x340756];return _0x2ef745;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 58ec2c7..fe6466a 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 _0xdbb3=['sequelize','exports','INTEGER'];(function(_0x33fda5,_0x11c4f6){var _0x48d0b6=function(_0x4bcdd6){while(--_0x4bcdd6){_0x33fda5['push'](_0x33fda5['shift']());}};_0x48d0b6(++_0x11c4f6);}(_0xdbb3,0x1c2));var _0x3dbb=function(_0x257642,_0x270a80){_0x257642=_0x257642-0x0;var _0x3d813b=_0xdbb3[_0x257642];return _0x3d813b;};'use strict';var Sequelize=require(_0x3dbb('0x0'));module[_0x3dbb('0x1')]={'penalty':{'type':Sequelize[_0x3dbb('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x4111=['INTEGER','sequelize','exports'];(function(_0x5b812d,_0x4c1e61){var _0x8fc38a=function(_0x2a181e){while(--_0x2a181e){_0x5b812d['push'](_0x5b812d['shift']());}};_0x8fc38a(++_0x4c1e61);}(_0x4111,0x91));var _0x1411=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4111[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x1411('0x0'));module[_0x1411('0x1')]={'penalty':{'type':Sequelize[_0x1411('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 837262d..0aececf 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 _0x6363=['define','UserSmsQueue','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports'];(function(_0x20c0aa,_0x270220){var _0x61fb00=function(_0x2f9b3a){while(--_0x2f9b3a){_0x20c0aa['push'](_0x20c0aa['shift']());}};_0x61fb00(++_0x270220);}(_0x6363,0x13a));var _0x3636=function(_0x3e60d5,_0x545ca8){_0x3e60d5=_0x3e60d5-0x0;var _0x3c31e7=_0x6363[_0x3e60d5];return _0x3c31e7;};'use strict';var _=require(_0x3636('0x0'));var util=require('util');var logger=require(_0x3636('0x1'))(_0x3636('0x2'));var moment=require(_0x3636('0x3'));var BPromise=require(_0x3636('0x4'));var rp=require(_0x3636('0x5'));var fs=require('fs');var path=require(_0x3636('0x6'));var rimraf=require(_0x3636('0x7'));var config=require(_0x3636('0x8'));var attributes=require(_0x3636('0x9'));module[_0x3636('0xa')]=function(_0x15728f,_0x1f94ef){return _0x15728f[_0x3636('0xb')](_0x3636('0xc'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4975=['./userSmsQueue.attributes','exports','UserSmsQueue','user_has_sms_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x124ac5,_0x4244b0){var _0x2344cb=function(_0x28f45f){while(--_0x28f45f){_0x124ac5['push'](_0x124ac5['shift']());}};_0x2344cb(++_0x4244b0);}(_0x4975,0x86));var _0x5497=function(_0x3ac1b3,_0x31e264){_0x3ac1b3=_0x3ac1b3-0x0;var _0x1c5006=_0x4975[_0x3ac1b3];return _0x1c5006;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var logger=require(_0x5497('0x1'))(_0x5497('0x2'));var moment=require(_0x5497('0x3'));var BPromise=require(_0x5497('0x4'));var rp=require(_0x5497('0x5'));var fs=require('fs');var path=require(_0x5497('0x6'));var rimraf=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var attributes=require(_0x5497('0x9'));module[_0x5497('0xa')]=function(_0x539a27,_0x37e48d){return _0x539a27['define'](_0x5497('0xb'),attributes,{'tableName':_0x5497('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index 10ccbb1..3c550ef 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 _0x6976=['UserSmsQueue,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x207c3a,_0x3f7ced){var _0x4bc16a=function(_0x30bbfb){while(--_0x30bbfb){_0x207c3a['push'](_0x207c3a['shift']());}};_0x4bc16a(++_0x3f7ced);}(_0x6976,0x94));var _0x6697=function(_0x59c0bf,_0x4bb8dd){_0x59c0bf=_0x59c0bf-0x0;var _0x27f763=_0x6976[_0x59c0bf];return _0x27f763;};'use strict';var _=require('lodash');var util=require(_0x6697('0x0'));var moment=require(_0x6697('0x1'));var BPromise=require(_0x6697('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6697('0x3'));var db=require(_0x6697('0x4'))['db'];var utils=require(_0x6697('0x5'));var logger=require('../../config/logger')(_0x6697('0x6'));var config=require(_0x6697('0x7'));var jayson=require(_0x6697('0x8'));var client=jayson[_0x6697('0x9')][_0x6697('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x276440,_0x10207f,_0x305d33){return new BPromise(function(_0xd94080,_0x2b5084){return client[_0x6697('0xb')](_0x276440,_0x305d33)[_0x6697('0xc')](function(_0x12d1b6){logger[_0x6697('0xd')]('UserSmsQueue,\x20%s,\x20%s',_0x10207f,_0x6697('0xe'));logger[_0x6697('0xf')](_0x6697('0x10'),_0x10207f,'request\x20sent',JSON[_0x6697('0x11')](_0x12d1b6));if(_0x12d1b6['error']){if(_0x12d1b6[_0x6697('0x12')][_0x6697('0x13')]===0x1f4){logger[_0x6697('0x12')](_0x6697('0x14'),_0x10207f,_0x12d1b6[_0x6697('0x12')][_0x6697('0x15')]);return _0x2b5084(_0x12d1b6[_0x6697('0x12')]['message']);}logger[_0x6697('0x12')]('UserSmsQueue,\x20%s,\x20%s',_0x10207f,_0x12d1b6[_0x6697('0x12')][_0x6697('0x15')]);return _0xd94080(_0x12d1b6[_0x6697('0x12')][_0x6697('0x15')]);}else{logger[_0x6697('0xd')]('UserSmsQueue,\x20%s,\x20%s',_0x10207f,_0x6697('0xe'));_0xd94080(_0x12d1b6[_0x6697('0x16')][_0x6697('0x15')]);}})[_0x6697('0x17')](function(_0x5cacc2){logger[_0x6697('0x12')](_0x6697('0x14'),_0x10207f,_0x5cacc2);_0x2b5084(_0x5cacc2);});});} \ No newline at end of file +var _0x5145=['jayson/promise','client','request','then','info','UserSmsQueue,\x20%s,\x20%s','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x17e4a7,_0x390e95){var _0x4e2274=function(_0x2aa7f9){while(--_0x2aa7f9){_0x17e4a7['push'](_0x17e4a7['shift']());}};_0x4e2274(++_0x390e95);}(_0x5145,0x147));var _0x5514=function(_0x55f68a,_0x22ef41){_0x55f68a=_0x55f68a-0x0;var _0x3e62dc=_0x5145[_0x55f68a];return _0x3e62dc;};'use strict';var _=require(_0x5514('0x0'));var util=require('util');var moment=require(_0x5514('0x1'));var BPromise=require(_0x5514('0x2'));var rs=require(_0x5514('0x3'));var fs=require('fs');var Redis=require(_0x5514('0x4'));var db=require(_0x5514('0x5'))['db'];var utils=require(_0x5514('0x6'));var logger=require(_0x5514('0x7'))(_0x5514('0x8'));var config=require('../../config/environment');var jayson=require(_0x5514('0x9'));var client=jayson[_0x5514('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3f9083,_0x583f1f,_0x46868f){return new BPromise(function(_0xae917,_0x5f0b8c){return client[_0x5514('0xb')](_0x3f9083,_0x46868f)[_0x5514('0xc')](function(_0xd3da46){logger[_0x5514('0xd')](_0x5514('0xe'),_0x583f1f,'request\x20sent');logger[_0x5514('0xf')](_0x5514('0x10'),_0x583f1f,_0x5514('0x11'),JSON[_0x5514('0x12')](_0xd3da46));if(_0xd3da46[_0x5514('0x13')]){if(_0xd3da46['error'][_0x5514('0x14')]===0x1f4){logger[_0x5514('0x13')]('UserSmsQueue,\x20%s,\x20%s',_0x583f1f,_0xd3da46['error']['message']);return _0x5f0b8c(_0xd3da46['error'][_0x5514('0x15')]);}logger[_0x5514('0x13')](_0x5514('0xe'),_0x583f1f,_0xd3da46[_0x5514('0x13')]['message']);return _0xae917(_0xd3da46[_0x5514('0x13')][_0x5514('0x15')]);}else{logger['info'](_0x5514('0xe'),_0x583f1f,_0x5514('0x11'));_0xae917(_0xd3da46[_0x5514('0x16')]['message']);}})[_0x5514('0x17')](function(_0x48415b){logger[_0x5514('0x13')](_0x5514('0xe'),_0x583f1f,_0x48415b);_0x5f0b8c(_0x48415b);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 44c0b52..b43ac24 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 _0xe6b5=['exports','INTEGER','sequelize'];(function(_0x1445bd,_0x2f9f08){var _0x52d18=function(_0x3819f8){while(--_0x3819f8){_0x1445bd['push'](_0x1445bd['shift']());}};_0x52d18(++_0x2f9f08);}(_0xe6b5,0x15e));var _0x5e6b=function(_0x53c393,_0x2cd57a){_0x53c393=_0x53c393-0x0;var _0xc1ae94=_0xe6b5[_0x53c393];return _0xc1ae94;};'use strict';var Sequelize=require(_0x5e6b('0x0'));module[_0x5e6b('0x1')]={'UserId':{'type':Sequelize[_0x5e6b('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x5e6b('0x2')]}}; \ No newline at end of file +var _0xcd65=['INTEGER','sequelize','exports'];(function(_0x3ac30b,_0x40909e){var _0x2839da=function(_0x274954){while(--_0x274954){_0x3ac30b['push'](_0x3ac30b['shift']());}};_0x2839da(++_0x40909e);}(_0xcd65,0x70));var _0x5cd6=function(_0x5c6994,_0x19ad9a){_0x5c6994=_0x5c6994-0x0;var _0x1d5c84=_0xcd65[_0x5c6994];return _0x1d5c84;};'use strict';var Sequelize=require(_0x5cd6('0x0'));module[_0x5cd6('0x1')]={'UserId':{'type':Sequelize[_0x5cd6('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x5cd6('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 57eaf1d..81eefa9 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(_0x49bc80,_0x1a6618){var _0x1e991e=function(_0x4623eb){while(--_0x4623eb){_0x49bc80['push'](_0x49bc80['shift']());}};_0x1e991e(++_0x1a6618);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'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(_0x238cc3,_0x2701a4){var _0x5acbec=function(_0x21d742){while(--_0x21d742){_0x238cc3['push'](_0x238cc3['shift']());}};_0x5acbec(++_0x2701a4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index dd5d10b..4bf1ef5 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x233d1b,_0x29b05f){var _0x351a6a=function(_0x5b3124){while(--_0x5b3124){_0x233d1b['push'](_0x233d1b['shift']());}};_0x351a6a(++_0x29b05f);}(_0xedd9,0xfc));var _0x9edd=function(_0x4d3287,_0xe83871){_0x4d3287=_0x4d3287-0x0;var _0x3e46fc=_0xedd9[_0x4d3287];return _0x3e46fc;};'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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x262a91,_0x4d3739){var _0x5dcb6b=function(_0x5df927){while(--_0x5df927){_0x262a91['push'](_0x262a91['shift']());}};_0x5dcb6b(++_0x4d3739);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 6d76c86..4e5e188 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 _0x295e=['sequelize','exports','INTEGER'];(function(_0x3f3dbe,_0x53a140){var _0x32f74a=function(_0x27fd91){while(--_0x27fd91){_0x3f3dbe['push'](_0x3f3dbe['shift']());}};_0x32f74a(++_0x53a140);}(_0x295e,0x18c));var _0xe295=function(_0x2757d3,_0xccc660){_0x2757d3=_0x2757d3-0x0;var _0x363899=_0x295e[_0x2757d3];return _0x363899;};'use strict';var Sequelize=require(_0xe295('0x0'));module[_0xe295('0x1')]={'penalty':{'type':Sequelize[_0xe295('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x20ef=['exports','INTEGER','sequelize'];(function(_0x73dcd,_0x482364){var _0x4949fa=function(_0x593f20){while(--_0x593f20){_0x73dcd['push'](_0x73dcd['shift']());}};_0x4949fa(++_0x482364);}(_0x20ef,0xe6));var _0xf20e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x20ef[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xf20e('0x0'));module[_0xf20e('0x1')]={'penalty':{'type':Sequelize[_0xf20e('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 5afd6e6..fa1a92b 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 _0x38f3=['define','UserVoiceQueue','user_has_voice_queues','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./userVoiceQueue.attributes'];(function(_0x38aa40,_0x995dd6){var _0x76fb8a=function(_0x2d0ac2){while(--_0x2d0ac2){_0x38aa40['push'](_0x38aa40['shift']());}};_0x76fb8a(++_0x995dd6);}(_0x38f3,0x1e4));var _0x338f=function(_0x423e15,_0x12b2b2){_0x423e15=_0x423e15-0x0;var _0x184279=_0x38f3[_0x423e15];return _0x184279;};'use strict';var _=require(_0x338f('0x0'));var util=require(_0x338f('0x1'));var logger=require(_0x338f('0x2'))(_0x338f('0x3'));var moment=require(_0x338f('0x4'));var BPromise=require(_0x338f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x338f('0x6'));var rimraf=require(_0x338f('0x7'));var config=require(_0x338f('0x8'));var attributes=require(_0x338f('0x9'));module['exports']=function(_0x19e30a,_0x5afbf6){return _0x19e30a[_0x338f('0xa')](_0x338f('0xb'),attributes,{'tableName':_0x338f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x388e=['rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','user_has_voice_queues','lodash','util','../../config/logger','moment','bluebird'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x388e,0x1b3));var _0xe388=function(_0x3fb07b,_0xd0a899){_0x3fb07b=_0x3fb07b-0x0;var _0x2ba88c=_0x388e[_0x3fb07b];return _0x2ba88c;};'use strict';var _=require(_0xe388('0x0'));var util=require(_0xe388('0x1'));var logger=require(_0xe388('0x2'))('api');var moment=require(_0xe388('0x3'));var BPromise=require(_0xe388('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe388('0x5'));var config=require(_0xe388('0x6'));var attributes=require(_0xe388('0x7'));module[_0xe388('0x8')]=function(_0x5c54fe,_0x3e4bdc){return _0x5c54fe[_0xe388('0x9')]('UserVoiceQueue',attributes,{'tableName':_0xe388('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 0258363..52afd42 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 _0x206f=['info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x54dc1b,_0x4414d2){var _0x1fa39f=function(_0x4a4250){while(--_0x4a4250){_0x54dc1b['push'](_0x54dc1b['shift']());}};_0x1fa39f(++_0x4414d2);}(_0x206f,0x169));var _0xf206=function(_0x4e7600,_0x48966d){_0x4e7600=_0x4e7600-0x0;var _0x40d38f=_0x206f[_0x4e7600];return _0x40d38f;};'use strict';var _=require(_0xf206('0x0'));var util=require('util');var moment=require(_0xf206('0x1'));var BPromise=require(_0xf206('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf206('0x3'));var db=require(_0xf206('0x4'))['db'];var utils=require(_0xf206('0x5'));var logger=require(_0xf206('0x6'))(_0xf206('0x7'));var config=require(_0xf206('0x8'));var jayson=require(_0xf206('0x9'));var client=jayson[_0xf206('0xa')][_0xf206('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f16c9,_0x49767d,_0x194391){return new BPromise(function(_0x400c23,_0x4c99ab){return client['request'](_0x3f16c9,_0x194391)[_0xf206('0xc')](function(_0x572734){logger[_0xf206('0xd')](_0xf206('0xe'),_0x49767d,_0xf206('0xf'));logger[_0xf206('0x10')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x49767d,'request\x20sent',JSON['stringify'](_0x572734));if(_0x572734[_0xf206('0x11')]){if(_0x572734[_0xf206('0x11')][_0xf206('0x12')]===0x1f4){logger[_0xf206('0x11')](_0xf206('0xe'),_0x49767d,_0x572734[_0xf206('0x11')][_0xf206('0x13')]);return _0x4c99ab(_0x572734[_0xf206('0x11')][_0xf206('0x13')]);}logger[_0xf206('0x11')]('UserVoiceQueue,\x20%s,\x20%s',_0x49767d,_0x572734[_0xf206('0x11')]['message']);return _0x400c23(_0x572734[_0xf206('0x11')][_0xf206('0x13')]);}else{logger[_0xf206('0xd')](_0xf206('0xe'),_0x49767d,'request\x20sent');_0x400c23(_0x572734[_0xf206('0x14')][_0xf206('0x13')]);}})[_0xf206('0x15')](function(_0x52e598){logger[_0xf206('0x11')](_0xf206('0xe'),_0x49767d,_0x52e598);_0x4c99ab(_0x52e598);});});} \ No newline at end of file +var _0x9dae=['debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','UserVoiceQueue,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info'];(function(_0x370db5,_0x194270){var _0x297dc5=function(_0x59f402){while(--_0x59f402){_0x370db5['push'](_0x370db5['shift']());}};_0x297dc5(++_0x194270);}(_0x9dae,0x76));var _0xe9da=function(_0x1e8447,_0x3e1ae5){_0x1e8447=_0x1e8447-0x0;var _0x1ba6b0=_0x9dae[_0x1e8447];return _0x1ba6b0;};'use strict';var _=require(_0xe9da('0x0'));var util=require('util');var moment=require(_0xe9da('0x1'));var BPromise=require(_0xe9da('0x2'));var rs=require(_0xe9da('0x3'));var fs=require('fs');var Redis=require(_0xe9da('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe9da('0x5'));var logger=require(_0xe9da('0x6'))(_0xe9da('0x7'));var config=require(_0xe9da('0x8'));var jayson=require(_0xe9da('0x9'));var client=jayson['client'][_0xe9da('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x52d476,_0x3afcf6,_0x3fee26){return new BPromise(function(_0x150040,_0xde3ca4){return client[_0xe9da('0xb')](_0x52d476,_0x3fee26)[_0xe9da('0xc')](function(_0x12a530){logger[_0xe9da('0xd')]('UserVoiceQueue,\x20%s,\x20%s',_0x3afcf6,'request\x20sent');logger[_0xe9da('0xe')](_0xe9da('0xf'),_0x3afcf6,_0xe9da('0x10'),JSON[_0xe9da('0x11')](_0x12a530));if(_0x12a530[_0xe9da('0x12')]){if(_0x12a530[_0xe9da('0x12')]['code']===0x1f4){logger['error'](_0xe9da('0x13'),_0x3afcf6,_0x12a530[_0xe9da('0x12')][_0xe9da('0x14')]);return _0xde3ca4(_0x12a530['error'][_0xe9da('0x14')]);}logger[_0xe9da('0x12')](_0xe9da('0x13'),_0x3afcf6,_0x12a530[_0xe9da('0x12')]['message']);return _0x150040(_0x12a530['error'][_0xe9da('0x14')]);}else{logger[_0xe9da('0xd')](_0xe9da('0x13'),_0x3afcf6,_0xe9da('0x10'));_0x150040(_0x12a530['result']['message']);}})[_0xe9da('0x15')](function(_0x305cf1){logger[_0xe9da('0x12')](_0xe9da('0x13'),_0x3afcf6,_0x305cf1);_0xde3ca4(_0x305cf1);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index b33a8e0..ef83437 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(_0x4c58fd,_0x34e817){var _0x5eef21=function(_0x2a8b58){while(--_0x2a8b58){_0x4c58fd['push'](_0x4c58fd['shift']());}};_0x5eef21(++_0x34e817);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x473097,_0x3268db){var _0x2c50e3=function(_0x14562f){while(--_0x14562f){_0x473097['push'](_0x473097['shift']());}};_0x2c50e3(++_0x3268db);}(_0x70e0,0x17b));var _0x070e=function(_0x4c1496,_0x4269f4){_0x4c1496=_0x4c1496-0x0;var _0x3918e9=_0x70e0[_0x4c1496];return _0x3918e9;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index f6a6900..4ab6fc2 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 _0x0f50=['queue_interface','exports','INTEGER','Required\x20by\x20Asterisk','STRING'];(function(_0x3f0f60,_0x521048){var _0x3e955f=function(_0x1d9db8){while(--_0x1d9db8){_0x3f0f60['push'](_0x3f0f60['shift']());}};_0x3e955f(++_0x521048);}(_0x0f50,0x6f));var _0x00f5=function(_0x3b9ae3,_0x7f545e){_0x3b9ae3=_0x3b9ae3-0x0;var _0x2a0d41=_0x0f50[_0x3b9ae3];return _0x2a0d41;};'use strict';var Sequelize=require('sequelize');module[_0x00f5('0x0')]={'uniqueid':{'type':Sequelize[_0x00f5('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x00f5('0x2')},'membername':{'type':Sequelize[_0x00f5('0x3')],'allowNull':![],'comment':_0x00f5('0x2')},'UserId':{'type':Sequelize[_0x00f5('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x00f5('0x4'),'comment':_0x00f5('0x2')},'VoiceQueueId':{'type':Sequelize[_0x00f5('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0x00f5('0x3')],'allowNull':![],'unique':'queue_interface','comment':_0x00f5('0x2')},'penalty':{'type':Sequelize[_0x00f5('0x1')](0xb),'defaultValue':0x0,'comment':_0x00f5('0x2')},'paused':{'type':Sequelize[_0x00f5('0x1')](0xb),'defaultValue':0x0,'comment':_0x00f5('0x2')}}; \ No newline at end of file +var _0x67e2=['exports','Required\x20by\x20Asterisk','STRING','INTEGER','queue_interface','sequelize'];(function(_0x589764,_0x4dd7f0){var _0x3847e6=function(_0x5c6c54){while(--_0x5c6c54){_0x589764['push'](_0x589764['shift']());}};_0x3847e6(++_0x4dd7f0);}(_0x67e2,0x16d));var _0x267e=function(_0x160ccd,_0x10f9f8){_0x160ccd=_0x160ccd-0x0;var _0x8668df=_0x67e2[_0x160ccd];return _0x8668df;};'use strict';var Sequelize=require(_0x267e('0x0'));module[_0x267e('0x1')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0x267e('0x2')},'membername':{'type':Sequelize[_0x267e('0x3')],'allowNull':![],'comment':_0x267e('0x2')},'UserId':{'type':Sequelize[_0x267e('0x4')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x267e('0x3')],'allowNull':![],'unique':_0x267e('0x5'),'comment':_0x267e('0x2')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0x267e('0x3')],'allowNull':![],'unique':_0x267e('0x5'),'comment':_0x267e('0x2')},'penalty':{'type':Sequelize[_0x267e('0x4')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0x267e('0x4')](0xb),'defaultValue':0x0,'comment':_0x267e('0x2')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 57e9fcb..76b173a 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 _0x283a=['save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners'];(function(_0x3815f0,_0x1dd83c){var _0xeaa08b=function(_0x461e0d){while(--_0x461e0d){_0x3815f0['push'](_0x3815f0['shift']());}};_0xeaa08b(++_0x1dd83c);}(_0x283a,0x150));var _0xa283=function(_0xb24fad,_0xd58756){_0xb24fad=_0xb24fad-0x0;var _0x173226=_0x283a[_0xb24fad];return _0x173226;};'use strict';var EventEmitter=require(_0xa283('0x0'));var UserVoiceQueueRt=require(_0xa283('0x1'))['db'][_0xa283('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xa283('0x3')](0x0);var events={'afterCreate':_0xa283('0x4'),'afterUpdate':_0xa283('0x5'),'afterDestroy':_0xa283('0x6')};function emitEvent(_0x1cf23b){return function(_0xb8a01f,_0x557927,_0x435934){UserVoiceQueueRtEvents[_0xa283('0x7')](_0x1cf23b+':'+_0xb8a01f['id'],_0xb8a01f);UserVoiceQueueRtEvents[_0xa283('0x7')](_0x1cf23b,_0xb8a01f);_0x435934(null);};}for(var e in events){if(events[_0xa283('0x8')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0xa283('0x9')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x023e=['emit','hasOwnProperty','hook','exports','../../mysqldb','save','update','remove'];(function(_0x21afd5,_0x57b9ba){var _0x59b71d=function(_0x4e4a15){while(--_0x4e4a15){_0x21afd5['push'](_0x21afd5['shift']());}};_0x59b71d(++_0x57b9ba);}(_0x023e,0x19c));var _0xe023=function(_0x3de328,_0x406810){_0x3de328=_0x3de328-0x0;var _0x54a585=_0x023e[_0x3de328];return _0x54a585;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0xe023('0x0'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe023('0x1'),'afterUpdate':_0xe023('0x2'),'afterDestroy':_0xe023('0x3')};function emitEvent(_0x537107){return function(_0xbbad49,_0xff4c6b,_0x429d1a){UserVoiceQueueRtEvents[_0xe023('0x4')](_0x537107+':'+_0xbbad49['id'],_0xbbad49);UserVoiceQueueRtEvents[_0xe023('0x4')](_0x537107,_0xbbad49);_0x429d1a(null);};}for(var e in events){if(events[_0xe023('0x5')](e)){var event=events[e];UserVoiceQueueRt[_0xe023('0x6')](e,emitEvent(event));}}module[_0xe023('0x7')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index ab5350d..f72d643 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 _0x8c14=['exports','define','user_has_voice_queues_rt','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userVoiceQueueRt.attributes'];(function(_0x4a920c,_0x54b35e){var _0x3f7c0c=function(_0x109aa2){while(--_0x109aa2){_0x4a920c['push'](_0x4a920c['shift']());}};_0x3f7c0c(++_0x54b35e);}(_0x8c14,0xff));var _0x48c1=function(_0x383cdb,_0x1470f9){_0x383cdb=_0x383cdb-0x0;var _0x379295=_0x8c14[_0x383cdb];return _0x379295;};'use strict';var _=require(_0x48c1('0x0'));var util=require(_0x48c1('0x1'));var logger=require('../../config/logger')(_0x48c1('0x2'));var moment=require(_0x48c1('0x3'));var BPromise=require(_0x48c1('0x4'));var rp=require(_0x48c1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x48c1('0x6'));var config=require(_0x48c1('0x7'));var attributes=require(_0x48c1('0x8'));module[_0x48c1('0x9')]=function(_0xfaa511,_0x22fa5a){return _0xfaa511[_0x48c1('0xa')]('UserVoiceQueueRt',attributes,{'tableName':_0x48c1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x373f=['exports','UserVoiceQueueRt','user_has_voice_queues_rt','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x14c72b,_0x583726){var _0x5796b4=function(_0xca8165){while(--_0xca8165){_0x14c72b['push'](_0x14c72b['shift']());}};_0x5796b4(++_0x583726);}(_0x373f,0x108));var _0xf373=function(_0x116e3e,_0x3ad9ec){_0x116e3e=_0x116e3e-0x0;var _0x47b759=_0x373f[_0x116e3e];return _0x47b759;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xf373('0x0'));var moment=require(_0xf373('0x1'));var BPromise=require('bluebird');var rp=require(_0xf373('0x2'));var fs=require('fs');var path=require(_0xf373('0x3'));var rimraf=require(_0xf373('0x4'));var config=require(_0xf373('0x5'));var attributes=require('./userVoiceQueueRt.attributes');module[_0xf373('0x6')]=function(_0x32e9c9,_0x30c387){return _0x32e9c9['define'](_0xf373('0x7'),attributes,{'tableName':_0xf373('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index b429bd0..3f142e3 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 _0xc051=['error','code','message','result','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','sequelize','COUNT','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','then','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./userVoiceQueueRt.socket','register','request','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2d84ee,_0x27624d){var _0x148672=function(_0x39396f){while(--_0x39396f){_0x2d84ee['push'](_0x2d84ee['shift']());}};_0x148672(++_0x27624d);}(_0xc051,0xc8));var _0x1c05=function(_0x5ac2f9,_0x40298b){_0x5ac2f9=_0x5ac2f9-0x0;var _0x342cc3=_0xc051[_0x5ac2f9];return _0x342cc3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1c05('0x0'));var BPromise=require(_0x1c05('0x1'));var rs=require(_0x1c05('0x2'));var fs=require('fs');var Redis=require(_0x1c05('0x3'));var db=require(_0x1c05('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1c05('0x5'))(_0x1c05('0x6'));var config=require('../../config/environment');var jayson=require(_0x1c05('0x7'));var client=jayson[_0x1c05('0x8')][_0x1c05('0x9')]({'port':0x232a});config[_0x1c05('0xa')]=_[_0x1c05('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1c05('0xc'))(new Redis(config[_0x1c05('0xa')]));require(_0x1c05('0xd'))[_0x1c05('0xe')](socket);function respondWithRpcPromise(_0xad1f7a,_0x1d2cc5,_0x43556e){return new BPromise(function(_0x193692,_0x4bd341){return client[_0x1c05('0xf')](_0xad1f7a,_0x43556e)['then'](function(_0x1fb9b0){logger[_0x1c05('0x10')](_0x1c05('0x11'),_0x1d2cc5,_0x1c05('0x12'));logger[_0x1c05('0x13')](_0x1c05('0x14'),_0x1d2cc5,_0x1c05('0x12'),JSON[_0x1c05('0x15')](_0x1fb9b0));if(_0x1fb9b0[_0x1c05('0x16')]){if(_0x1fb9b0[_0x1c05('0x16')][_0x1c05('0x17')]===0x1f4){logger[_0x1c05('0x16')](_0x1c05('0x11'),_0x1d2cc5,_0x1fb9b0[_0x1c05('0x16')][_0x1c05('0x18')]);return _0x4bd341(_0x1fb9b0[_0x1c05('0x16')][_0x1c05('0x18')]);}logger[_0x1c05('0x16')](_0x1c05('0x11'),_0x1d2cc5,_0x1fb9b0[_0x1c05('0x16')][_0x1c05('0x18')]);return _0x193692(_0x1fb9b0[_0x1c05('0x16')][_0x1c05('0x18')]);}else{logger[_0x1c05('0x10')](_0x1c05('0x11'),_0x1d2cc5,_0x1c05('0x12'));_0x193692(_0x1fb9b0[_0x1c05('0x19')][_0x1c05('0x18')]);}})['catch'](function(_0x9e6337){logger[_0x1c05('0x16')](_0x1c05('0x11'),_0x1d2cc5,_0x9e6337);_0x4bd341(_0x9e6337);});});}exports[_0x1c05('0x1a')]=function(_0x3a99dc){var _0x5c917e=this;return new Promise(function(_0x37e7cb,_0x4224f9){return db[_0x1c05('0x1b')][_0x1c05('0x1c')]({'raw':_0x3a99dc[_0x1c05('0x1d')]?_0x3a99dc[_0x1c05('0x1d')][_0x1c05('0x1e')]===undefined?!![]:![]:!![],'where':_0x3a99dc[_0x1c05('0x1d')]?_0x3a99dc[_0x1c05('0x1d')]['where']||null:null,'attributes':[[db[_0x1c05('0x1f')]['fn'](_0x1c05('0x20'),db[_0x1c05('0x1f')]['fn']('IF',db[_0x1c05('0x1f')]['literal'](_0x1c05('0x21')))),_0x1c05('0x22')]]})[_0x1c05('0x23')](function(_0x5810ca){logger['info']('GetVoiceQueueRtPauses',_0x3a99dc);logger[_0x1c05('0x13')]('GetVoiceQueueRtPauses',_0x3a99dc,JSON['stringify'](_0x5810ca));_0x37e7cb(_0x5810ca);})[_0x1c05('0x24')](function(_0x25a01e){logger[_0x1c05('0x16')]('GetVoiceQueueRtPauses',_0x25a01e['message'],_0x3a99dc);_0x4224f9(_0x5c917e[_0x1c05('0x16')](0x1f4,_0x25a01e[_0x1c05('0x18')]));});});}; \ No newline at end of file +var _0xae3e=['../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','sequelize','outboundQueuePauses','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc'];(function(_0x47f78f,_0x4ea0f3){var _0x5af099=function(_0x3a2722){while(--_0x3a2722){_0x47f78f['push'](_0x47f78f['shift']());}};_0x5af099(++_0x4ea0f3);}(_0xae3e,0x1d9));var _0xeae3=function(_0x20f08b,_0x646ea0){_0x20f08b=_0x20f08b-0x0;var _0x675062=_0xae3e[_0x20f08b];return _0x675062;};'use strict';var _=require(_0xeae3('0x0'));var util=require(_0xeae3('0x1'));var moment=require(_0xeae3('0x2'));var BPromise=require(_0xeae3('0x3'));var rs=require(_0xeae3('0x4'));var fs=require('fs');var Redis=require(_0xeae3('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xeae3('0x6'));var logger=require('../../config/logger')(_0xeae3('0x7'));var config=require(_0xeae3('0x8'));var jayson=require(_0xeae3('0x9'));var client=jayson[_0xeae3('0xa')][_0xeae3('0xb')]({'port':0x232a});config[_0xeae3('0xc')]=_['defaults'](config[_0xeae3('0xc')],{'host':_0xeae3('0xd'),'port':0x18eb});var socket=require(_0xeae3('0xe'))(new Redis(config[_0xeae3('0xc')]));require('./userVoiceQueueRt.socket')[_0xeae3('0xf')](socket);function respondWithRpcPromise(_0x3399c0,_0x54add1,_0x3adc5f){return new BPromise(function(_0x505256,_0x17c1b6){return client[_0xeae3('0x10')](_0x3399c0,_0x3adc5f)[_0xeae3('0x11')](function(_0x4b6623){logger[_0xeae3('0x12')](_0xeae3('0x13'),_0x54add1,'request\x20sent');logger[_0xeae3('0x14')](_0xeae3('0x15'),_0x54add1,_0xeae3('0x16'),JSON[_0xeae3('0x17')](_0x4b6623));if(_0x4b6623[_0xeae3('0x18')]){if(_0x4b6623[_0xeae3('0x18')][_0xeae3('0x19')]===0x1f4){logger[_0xeae3('0x18')](_0xeae3('0x13'),_0x54add1,_0x4b6623['error'][_0xeae3('0x1a')]);return _0x17c1b6(_0x4b6623[_0xeae3('0x18')][_0xeae3('0x1a')]);}logger['error'](_0xeae3('0x13'),_0x54add1,_0x4b6623[_0xeae3('0x18')]['message']);return _0x505256(_0x4b6623['error'][_0xeae3('0x1a')]);}else{logger[_0xeae3('0x12')](_0xeae3('0x13'),_0x54add1,_0xeae3('0x16'));_0x505256(_0x4b6623[_0xeae3('0x1b')]['message']);}})[_0xeae3('0x1c')](function(_0x18283a){logger['error'](_0xeae3('0x13'),_0x54add1,_0x18283a);_0x17c1b6(_0x18283a);});});}exports[_0xeae3('0x1d')]=function(_0x233139){var _0x2ddf9c=this;return new Promise(function(_0x25b7bc,_0x4b91f6){return db[_0xeae3('0x1e')][_0xeae3('0x1f')]({'raw':_0x233139[_0xeae3('0x20')]?_0x233139['options'][_0xeae3('0x21')]===undefined?!![]:![]:!![],'where':_0x233139[_0xeae3('0x20')]?_0x233139[_0xeae3('0x20')][_0xeae3('0x22')]||null:null,'attributes':[[db[_0xeae3('0x23')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal']('`paused`\x20=\x201,\x201,\x20null'))),_0xeae3('0x24')]]})['then'](function(_0x5f22da){logger[_0xeae3('0x12')]('GetVoiceQueueRtPauses',_0x233139);logger['debug'](_0xeae3('0x1d'),_0x233139,JSON[_0xeae3('0x17')](_0x5f22da));_0x25b7bc(_0x5f22da);})['catch'](function(_0x4b45f3){logger[_0xeae3('0x18')](_0xeae3('0x1d'),_0x4b45f3['message'],_0x233139);_0x4b91f6(_0x2ddf9c[_0xeae3('0x18')](0x1f4,_0x4b45f3[_0xeae3('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 4d71fca..b7ba984 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 _0x304b=['remove','update','emit','register','length','userVoiceQueueRt:','save'];(function(_0x13673e,_0x19ffa0){var _0x27f039=function(_0x5a1047){while(--_0x5a1047){_0x13673e['push'](_0x13673e['shift']());}};_0x27f039(++_0x19ffa0);}(_0x304b,0xfb));var _0xb304=function(_0x3a7d7c,_0x4f1d94){_0x3a7d7c=_0x3a7d7c-0x0;var _0x40e5c8=_0x304b[_0x3a7d7c];return _0x40e5c8;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0xb304('0x0'),_0xb304('0x1'),_0xb304('0x2')];function createListener(_0x61902e,_0x2c36b9){return function(_0x1a54ea){_0x2c36b9[_0xb304('0x3')](_0x61902e,_0x1a54ea);};}function removeListener(_0xedd10a,_0x546729){return function(){UserVoiceQueueRtEvents['removeListener'](_0xedd10a,_0x546729);};}exports[_0xb304('0x4')]=function(_0x301a2e){for(var _0x1eef78=0x0,_0x3eb6e0=events[_0xb304('0x5')];_0x1eef78<_0x3eb6e0;_0x1eef78++){var _0xded429=events[_0x1eef78];var _0x1ce82e=createListener(_0xb304('0x6')+_0xded429,_0x301a2e);UserVoiceQueueRtEvents['on'](_0xded429,_0x1ce82e);}}; \ No newline at end of file +var _0xd67b=['userVoiceQueueRt:','save','update','emit','register','length'];(function(_0x4a3a1f,_0xcbeee1){var _0x2f85b6=function(_0x3837a7){while(--_0x3837a7){_0x4a3a1f['push'](_0x4a3a1f['shift']());}};_0x2f85b6(++_0xcbeee1);}(_0xd67b,0x133));var _0xbd67=function(_0x3f6c31,_0x4ffb0e){_0x3f6c31=_0x3f6c31-0x0;var _0x2d0112=_0xd67b[_0x3f6c31];return _0x2d0112;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0xbd67('0x0'),'remove',_0xbd67('0x1')];function createListener(_0x280954,_0x317e33){return function(_0x5e967b){_0x317e33[_0xbd67('0x2')](_0x280954,_0x5e967b);};}function removeListener(_0x50da5a,_0x1bf96){return function(){UserVoiceQueueRtEvents['removeListener'](_0x50da5a,_0x1bf96);};}exports[_0xbd67('0x3')]=function(_0xa5c384){for(var _0x2ad142=0x0,_0x27b016=events[_0xbd67('0x4')];_0x2ad142<_0x27b016;_0x2ad142++){var _0x72f9ac=events[_0x2ad142];var _0x2d4af6=createListener(_0xbd67('0x5')+_0x72f9ac,_0xa5c384);UserVoiceQueueRtEvents['on'](_0x72f9ac,_0x2d4af6);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index d62f051..a66afc6 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x1cdf5b,_0x178f8f){var _0x37e4cc=function(_0x580450){while(--_0x580450){_0x1cdf5b['push'](_0x1cdf5b['shift']());}};_0x37e4cc(++_0x178f8f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x4a56d1,_0xfb2dc1){var _0x8d8656=function(_0x4b8c01){while(--_0x4b8c01){_0x4a56d1['push'](_0x4a56d1['shift']());}};_0x8d8656(++_0xfb2dc1);}(_0x70e0,0x17b));var _0x070e=function(_0x3d69c9,_0x129a38){_0x3d69c9=_0x3d69c9-0x0;var _0x53ffb3=_0x70e0[_0x3d69c9];return _0x53ffb3;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 496aba6..e294c04 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 _0x7076=['INTEGER','sequelize'];(function(_0x3e7804,_0x121853){var _0x56efda=function(_0x1996f3){while(--_0x1996f3){_0x3e7804['push'](_0x3e7804['shift']());}};_0x56efda(++_0x121853);}(_0x7076,0x1b9));var _0x6707=function(_0x5134bc,_0x5eb834){_0x5134bc=_0x5134bc-0x0;var _0x3fb0ab=_0x7076[_0x5134bc];return _0x3fb0ab;};'use strict';var Sequelize=require(_0x6707('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x6707('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9c5e=['INTEGER','exports'];(function(_0x3393a9,_0x451ff4){var _0x454585=function(_0x314e38){while(--_0x314e38){_0x3393a9['push'](_0x3393a9['shift']());}};_0x454585(++_0x451ff4);}(_0x9c5e,0x113));var _0xe9c5=function(_0x1ab170,_0x5197ff){_0x1ab170=_0x1ab170-0x0;var _0x431698=_0x9c5e[_0x1ab170];return _0x431698;};'use strict';var Sequelize=require('sequelize');module[_0xe9c5('0x0')]={'penalty':{'type':Sequelize[_0xe9c5('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 75d85a6..9fed758 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 _0xf31d=['lodash','util','../../config/logger','moment','bluebird','../../config/environment','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','user_has_whatsapp_queues'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf31d,0x9a));var _0xdf31=function(_0x8560d3,_0x26a504){_0x8560d3=_0x8560d3-0x0;var _0x33b1b5=_0xf31d[_0x8560d3];return _0x33b1b5;};'use strict';var _=require(_0xdf31('0x0'));var util=require(_0xdf31('0x1'));var logger=require(_0xdf31('0x2'))('api');var moment=require(_0xdf31('0x3'));var BPromise=require(_0xdf31('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xdf31('0x5'));var attributes=require(_0xdf31('0x6'));module[_0xdf31('0x7')]=function(_0x18dcc7,_0x122474){return _0x18dcc7[_0xdf31('0x8')](_0xdf31('0x9'),attributes,{'tableName':_0xdf31('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdf0d=['path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','UserWhatsappQueue','user_has_whatsapp_queues','util','api','moment','bluebird','request-promise'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0xdf0d,0x1b7));var _0xddf0=function(_0x3054f8,_0x1e6528){_0x3054f8=_0x3054f8-0x0;var _0x45d366=_0xdf0d[_0x3054f8];return _0x45d366;};'use strict';var _=require('lodash');var util=require(_0xddf0('0x0'));var logger=require('../../config/logger')(_0xddf0('0x1'));var moment=require(_0xddf0('0x2'));var BPromise=require(_0xddf0('0x3'));var rp=require(_0xddf0('0x4'));var fs=require('fs');var path=require(_0xddf0('0x5'));var rimraf=require(_0xddf0('0x6'));var config=require(_0xddf0('0x7'));var attributes=require(_0xddf0('0x8'));module[_0xddf0('0x9')]=function(_0x59e321,_0x236449){return _0x59e321['define'](_0xddf0('0xa'),attributes,{'tableName':_0xddf0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index ffaccd3..8779012 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 _0x5854=['jayson/promise','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x1e10c7,_0x2521d7){var _0x4ddd08=function(_0x5e76d3){while(--_0x5e76d3){_0x1e10c7['push'](_0x1e10c7['shift']());}};_0x4ddd08(++_0x2521d7);}(_0x5854,0x1c2));var _0x4585=function(_0x58df25,_0xb28c5f){_0x58df25=_0x58df25-0x0;var _0x2778ee=_0x5854[_0x58df25];return _0x2778ee;};'use strict';var _=require(_0x4585('0x0'));var util=require(_0x4585('0x1'));var moment=require(_0x4585('0x2'));var BPromise=require(_0x4585('0x3'));var rs=require(_0x4585('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4585('0x5'))['db'];var utils=require(_0x4585('0x6'));var logger=require(_0x4585('0x7'))(_0x4585('0x8'));var config=require(_0x4585('0x9'));var jayson=require(_0x4585('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x48b267,_0x263481,_0x3509a8){return new BPromise(function(_0x3d57f3,_0x26a666){return client[_0x4585('0xb')](_0x48b267,_0x3509a8)[_0x4585('0xc')](function(_0x145557){logger[_0x4585('0xd')](_0x4585('0xe'),_0x263481,_0x4585('0xf'));logger[_0x4585('0x10')](_0x4585('0x11'),_0x263481,_0x4585('0xf'),JSON[_0x4585('0x12')](_0x145557));if(_0x145557[_0x4585('0x13')]){if(_0x145557[_0x4585('0x13')]['code']===0x1f4){logger['error'](_0x4585('0xe'),_0x263481,_0x145557[_0x4585('0x13')][_0x4585('0x14')]);return _0x26a666(_0x145557['error'][_0x4585('0x14')]);}logger[_0x4585('0x13')]('UserWhatsappQueue,\x20%s,\x20%s',_0x263481,_0x145557['error']['message']);return _0x3d57f3(_0x145557[_0x4585('0x13')][_0x4585('0x14')]);}else{logger[_0x4585('0xd')](_0x4585('0xe'),_0x263481,'request\x20sent');_0x3d57f3(_0x145557[_0x4585('0x15')][_0x4585('0x14')]);}})[_0x4585('0x16')](function(_0x6bc12e){logger[_0x4585('0x13')](_0x4585('0xe'),_0x263481,_0x6bc12e);_0x26a666(_0x6bc12e);});});} \ No newline at end of file +var _0xab29=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird'];(function(_0x23c05f,_0x149b3a){var _0x232821=function(_0x4a1d48){while(--_0x4a1d48){_0x23c05f['push'](_0x23c05f['shift']());}};_0x232821(++_0x149b3a);}(_0xab29,0x11a));var _0x9ab2=function(_0x147dd1,_0x4f67d3){_0x147dd1=_0x147dd1-0x0;var _0x593952=_0xab29[_0x147dd1];return _0x593952;};'use strict';var _=require(_0x9ab2('0x0'));var util=require(_0x9ab2('0x1'));var moment=require(_0x9ab2('0x2'));var BPromise=require(_0x9ab2('0x3'));var rs=require(_0x9ab2('0x4'));var fs=require('fs');var Redis=require(_0x9ab2('0x5'));var db=require(_0x9ab2('0x6'))['db'];var utils=require(_0x9ab2('0x7'));var logger=require(_0x9ab2('0x8'))(_0x9ab2('0x9'));var config=require(_0x9ab2('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x9ab2('0xb')][_0x9ab2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x160312,_0x2278ed,_0x2daa80){return new BPromise(function(_0x1d2a4d,_0x34d794){return client[_0x9ab2('0xd')](_0x160312,_0x2daa80)[_0x9ab2('0xe')](function(_0x820ffe){logger['info'](_0x9ab2('0xf'),_0x2278ed,_0x9ab2('0x10'));logger[_0x9ab2('0x11')](_0x9ab2('0x12'),_0x2278ed,_0x9ab2('0x10'),JSON[_0x9ab2('0x13')](_0x820ffe));if(_0x820ffe[_0x9ab2('0x14')]){if(_0x820ffe['error'][_0x9ab2('0x15')]===0x1f4){logger['error']('UserWhatsappQueue,\x20%s,\x20%s',_0x2278ed,_0x820ffe['error']['message']);return _0x34d794(_0x820ffe[_0x9ab2('0x14')][_0x9ab2('0x16')]);}logger['error'](_0x9ab2('0xf'),_0x2278ed,_0x820ffe[_0x9ab2('0x14')][_0x9ab2('0x16')]);return _0x1d2a4d(_0x820ffe[_0x9ab2('0x14')][_0x9ab2('0x16')]);}else{logger[_0x9ab2('0x17')](_0x9ab2('0xf'),_0x2278ed,'request\x20sent');_0x1d2a4d(_0x820ffe[_0x9ab2('0x18')][_0x9ab2('0x16')]);}})[_0x9ab2('0x19')](function(_0x4f367e){logger[_0x9ab2('0x14')](_0x9ab2('0xf'),_0x2278ed,_0x4f367e);_0x34d794(_0x4f367e);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index d525260..2a7d4db 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 _0xb079=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','index','isAuthenticated','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x486283,_0x3d4f06){var _0x8c94cb=function(_0x174861){while(--_0x174861){_0x486283['push'](_0x486283['shift']());}};_0x8c94cb(++_0x3d4f06);}(_0xb079,0x1c9));var _0x9b07=function(_0xe68e3f,_0x5edcf8){_0xe68e3f=_0xe68e3f-0x0;var _0xb6b653=_0xb079[_0xe68e3f];return _0xb6b653;};'use strict';var multer=require('multer');var util=require(_0x9b07('0x0'));var path=require(_0x9b07('0x1'));var timeout=require(_0x9b07('0x2'));var express=require(_0x9b07('0x3'));var router=express[_0x9b07('0x4')]();var fs_extra=require(_0x9b07('0x5'));var auth=require(_0x9b07('0x6'));var interaction=require(_0x9b07('0x7'));var config=require(_0x9b07('0x8'));var controller=require(_0x9b07('0x9'));router[_0x9b07('0xa')]('/',auth['isAuthenticated'](),controller[_0x9b07('0xb')]);router[_0x9b07('0xa')]('/:id',auth[_0x9b07('0xc')](),controller['show']);router['post']('/',auth[_0x9b07('0xc')](),controller[_0x9b07('0xd')]);router[_0x9b07('0xe')](_0x9b07('0xf'),auth['isAuthenticated'](),controller[_0x9b07('0x10')]);router[_0x9b07('0x11')](_0x9b07('0xf'),auth[_0x9b07('0xc')](),controller[_0x9b07('0x12')]);module[_0x9b07('0x13')]=router; \ No newline at end of file +var _0x616c=['/:id','post','put','destroy','util','path','express','Router','fs-extra','../../components/auth/service','./variable.controller','get','isAuthenticated','index'];(function(_0x5520f8,_0x3a53cb){var _0x4478ad=function(_0x13128a){while(--_0x13128a){_0x5520f8['push'](_0x5520f8['shift']());}};_0x4478ad(++_0x3a53cb);}(_0x616c,0x1b6));var _0xc616=function(_0x54f677,_0x3076eb){_0x54f677=_0x54f677-0x0;var _0x510d78=_0x616c[_0x54f677];return _0x510d78;};'use strict';var multer=require('multer');var util=require(_0xc616('0x0'));var path=require(_0xc616('0x1'));var timeout=require('connect-timeout');var express=require(_0xc616('0x2'));var router=express[_0xc616('0x3')]();var fs_extra=require(_0xc616('0x4'));var auth=require(_0xc616('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc616('0x6'));router[_0xc616('0x7')]('/',auth[_0xc616('0x8')](),controller[_0xc616('0x9')]);router[_0xc616('0x7')](_0xc616('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xc616('0xb')]('/',auth[_0xc616('0x8')](),controller['create']);router[_0xc616('0xc')]('/:id',auth[_0xc616('0x8')](),controller['update']);router['delete'](_0xc616('0xa'),auth[_0xc616('0x8')](),controller[_0xc616('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 64f01bb..16aa6ed 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 _0xb66c=['STRING','sequelize'];(function(_0x2af621,_0x243c1a){var _0x1b3f01=function(_0x41be05){while(--_0x41be05){_0x2af621['push'](_0x2af621['shift']());}};_0x1b3f01(++_0x243c1a);}(_0xb66c,0x175));var _0xcb66=function(_0x28cf6f,_0xdade93){_0x28cf6f=_0x28cf6f-0x0;var _0x2bb1dc=_0xb66c[_0x28cf6f];return _0x2bb1dc;};'use strict';var Sequelize=require(_0xcb66('0x0'));module['exports']={'name':{'type':Sequelize[_0xcb66('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xcb66('0x1')]}}; \ No newline at end of file +var _0xd50d=['name','sequelize','exports','STRING'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xd50d,0xc9));var _0xdd50=function(_0x2b5b14,_0x461015){_0x2b5b14=_0x2b5b14-0x0;var _0x1c6742=_0xd50d[_0x2b5b14];return _0x1c6742;};'use strict';var Sequelize=require(_0xdd50('0x0'));module[_0xdd50('0x1')]={'name':{'type':Sequelize[_0xdd50('0x2')],'unique':_0xdd50('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xdd50('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index b05e383..139a632 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 _0xba90=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','Variables','UserProfileResource','error','index','map','Variable','rawAttributes','fieldName','type','key','model','name','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','catch','show','params','includeAll','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0xba90,0x151));var _0x0ba9=function(_0x54669a,_0x46c23e){_0x54669a=_0x54669a-0x0;var _0x5a49fc=_0xba90[_0x54669a];return _0x5a49fc;};'use strict';var emlformat=require(_0x0ba9('0x0'));var rimraf=require(_0x0ba9('0x1'));var zipdir=require(_0x0ba9('0x2'));var jsonpatch=require(_0x0ba9('0x3'));var rp=require('request-promise');var moment=require(_0x0ba9('0x4'));var BPromise=require(_0x0ba9('0x5'));var Mustache=require(_0x0ba9('0x6'));var util=require('util');var path=require(_0x0ba9('0x7'));var sox=require(_0x0ba9('0x8'));var csv=require(_0x0ba9('0x9'));var ejs=require(_0x0ba9('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0ba9('0xb'));var squel=require(_0x0ba9('0xc'));var crypto=require(_0x0ba9('0xd'));var jsforce=require(_0x0ba9('0xe'));var deskjs=require(_0x0ba9('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0ba9('0x10'));var Papa=require(_0x0ba9('0x11'));var Redis=require(_0x0ba9('0x12'));var authService=require(_0x0ba9('0x13'));var qs=require(_0x0ba9('0x14'));var as=require(_0x0ba9('0x15'));var hardwareService=require(_0x0ba9('0x16'));var logger=require(_0x0ba9('0x17'))(_0x0ba9('0x18'));var utils=require(_0x0ba9('0x19'));var config=require(_0x0ba9('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x0ba9('0x1b'))['db'];function respondWithStatusCode(_0x5351c2,_0x3706b7){_0x3706b7=_0x3706b7||0xcc;return function(_0x83fdb1){if(_0x83fdb1){return _0x5351c2[_0x0ba9('0x1c')](_0x3706b7);}return _0x5351c2[_0x0ba9('0x1d')](_0x3706b7)[_0x0ba9('0x1e')]();};}function respondWithResult(_0x4c330e,_0x5e2d29){_0x5e2d29=_0x5e2d29||0xc8;return function(_0xc20403){if(_0xc20403){return _0x4c330e[_0x0ba9('0x1d')](_0x5e2d29)[_0x0ba9('0x1f')](_0xc20403);}};}function respondWithFilteredResult(_0x537747,_0x43036e){return function(_0x254535){if(_0x254535){var _0x3a0536=typeof _0x43036e[_0x0ba9('0x20')]===_0x0ba9('0x21')&&typeof _0x43036e['limit']==='undefined';var _0x14eed6=_0x254535['count'];var _0x37ae3d=_0x3a0536?0x0:_0x43036e['offset'];var _0x226c38=_0x3a0536?_0x254535[_0x0ba9('0x22')]:_0x43036e[_0x0ba9('0x20')]+_0x43036e['limit'];var _0x32a433;if(_0x226c38>=_0x14eed6){_0x226c38=_0x14eed6;_0x32a433=0xc8;}else{_0x32a433=0xce;}_0x537747[_0x0ba9('0x1d')](_0x32a433);return _0x537747[_0x0ba9('0x23')](_0x0ba9('0x24'),_0x37ae3d+'-'+_0x226c38+'/'+_0x14eed6)['json'](_0x254535);}return null;};}function patchUpdates(_0x6af6b4){return function(_0x2ce168){try{jsonpatch[_0x0ba9('0x25')](_0x2ce168,_0x6af6b4,!![]);}catch(_0x52854b){return BPromise['reject'](_0x52854b);}return _0x2ce168[_0x0ba9('0x26')]();};}function saveUpdates(_0x38777e,_0x2f904f){return function(_0x39814e){if(_0x39814e){return _0x39814e[_0x0ba9('0x27')](_0x38777e)[_0x0ba9('0x28')](function(_0x920fa4){return _0x920fa4;});}return null;};}function removeEntity(_0x22da96,_0x5e8c62){return function(_0x39d1a4){if(_0x39d1a4){return _0x39d1a4[_0x0ba9('0x29')]()[_0x0ba9('0x28')](function(){var _0x37804e=_0x39d1a4['get']({'plain':!![]});var _0x2214de=_0x0ba9('0x2a');return db[_0x0ba9('0x2b')][_0x0ba9('0x29')]({'where':{'type':_0x2214de,'resourceId':_0x37804e['id']}})[_0x0ba9('0x28')](function(){return _0x39d1a4;});})[_0x0ba9('0x28')](function(){_0x22da96['status'](0xcc)[_0x0ba9('0x1e')]();});}};}function handleEntityNotFound(_0x2ae8fb,_0x179f59){return function(_0x56c0bc){if(!_0x56c0bc){_0x2ae8fb[_0x0ba9('0x1c')](0x194);}return _0x56c0bc;};}function handleError(_0x317a7d,_0x323622){_0x323622=_0x323622||0x1f4;return function(_0xc640ed){logger[_0x0ba9('0x2c')](_0xc640ed['stack']);if(_0xc640ed['name']){delete _0xc640ed['name'];}_0x317a7d['status'](_0x323622)['send'](_0xc640ed);};}exports[_0x0ba9('0x2d')]=function(_0x1b223c,_0x3395e1){var _0x33d08e={},_0x2643c6={},_0xfde7ad={'count':0x0,'rows':[]};var _0x2cdf6f=_[_0x0ba9('0x2e')](db[_0x0ba9('0x2f')][_0x0ba9('0x30')],function(_0xe67b26){return{'name':_0xe67b26[_0x0ba9('0x31')],'type':_0xe67b26[_0x0ba9('0x32')][_0x0ba9('0x33')]};});_0x2643c6[_0x0ba9('0x34')]=_['map'](_0x2cdf6f,_0x0ba9('0x35'));_0x2643c6['query']=_[_0x0ba9('0x36')](_0x1b223c[_0x0ba9('0x37')]);_0x2643c6[_0x0ba9('0x38')]=_[_0x0ba9('0x39')](_0x2643c6[_0x0ba9('0x34')],_0x2643c6['query']);_0x33d08e[_0x0ba9('0x3a')]=_[_0x0ba9('0x39')](_0x2643c6[_0x0ba9('0x34')],qs[_0x0ba9('0x3b')](_0x1b223c[_0x0ba9('0x37')][_0x0ba9('0x3b')]));_0x33d08e[_0x0ba9('0x3a')]=_0x33d08e['attributes'][_0x0ba9('0x3c')]?_0x33d08e[_0x0ba9('0x3a')]:_0x2643c6[_0x0ba9('0x34')];if(!_0x1b223c[_0x0ba9('0x37')][_0x0ba9('0x3d')](_0x0ba9('0x3e'))){_0x33d08e[_0x0ba9('0x3f')]=qs[_0x0ba9('0x3f')](_0x1b223c[_0x0ba9('0x37')][_0x0ba9('0x3f')]);_0x33d08e[_0x0ba9('0x20')]=qs[_0x0ba9('0x20')](_0x1b223c[_0x0ba9('0x37')][_0x0ba9('0x20')]);}_0x33d08e[_0x0ba9('0x40')]=qs[_0x0ba9('0x41')](_0x1b223c[_0x0ba9('0x37')][_0x0ba9('0x41')]);_0x33d08e[_0x0ba9('0x42')]=qs[_0x0ba9('0x38')](_[_0x0ba9('0x43')](_0x1b223c[_0x0ba9('0x37')],_0x2643c6[_0x0ba9('0x38')]),_0x2cdf6f);if(_0x1b223c[_0x0ba9('0x37')][_0x0ba9('0x44')]){_0x33d08e[_0x0ba9('0x42')]=_[_0x0ba9('0x45')](_0x33d08e[_0x0ba9('0x42')],{'$or':_[_0x0ba9('0x2e')](_0x2cdf6f,function(_0x5d5747){if(_0x5d5747[_0x0ba9('0x32')]!==_0x0ba9('0x46')){var _0x1a3b30={};_0x1a3b30[_0x5d5747[_0x0ba9('0x35')]]={'$like':'%'+_0x1b223c[_0x0ba9('0x37')][_0x0ba9('0x44')]+'%'};return _0x1a3b30;}})});}_0x33d08e=_['merge']({},_0x33d08e,_0x1b223c[_0x0ba9('0x47')]);var _0x426860={'where':_0x33d08e[_0x0ba9('0x42')]};return db['Variable'][_0x0ba9('0x22')](_0x426860)[_0x0ba9('0x28')](function(_0x2dca16){_0xfde7ad['count']=_0x2dca16;if(_0x1b223c[_0x0ba9('0x37')]['includeAll']){_0x33d08e[_0x0ba9('0x48')]=[{'all':!![]}];}return db['Variable']['findAll'](_0x33d08e);})['then'](function(_0x583ec1){_0xfde7ad[_0x0ba9('0x49')]=_0x583ec1;return _0xfde7ad;})['then'](respondWithFilteredResult(_0x3395e1,_0x33d08e))[_0x0ba9('0x4a')](handleError(_0x3395e1,null));};exports[_0x0ba9('0x4b')]=function(_0x359433,_0x291013){var _0x17ad76={'raw':!![],'where':{'id':_0x359433[_0x0ba9('0x4c')]['id']}},_0x51efe4={};_0x51efe4[_0x0ba9('0x34')]=_[_0x0ba9('0x36')](db[_0x0ba9('0x2f')][_0x0ba9('0x30')]);_0x51efe4[_0x0ba9('0x37')]=_[_0x0ba9('0x36')](_0x359433[_0x0ba9('0x37')]);_0x51efe4[_0x0ba9('0x38')]=_[_0x0ba9('0x39')](_0x51efe4[_0x0ba9('0x34')],_0x51efe4[_0x0ba9('0x37')]);_0x17ad76[_0x0ba9('0x3a')]=_[_0x0ba9('0x39')](_0x51efe4[_0x0ba9('0x34')],qs[_0x0ba9('0x3b')](_0x359433[_0x0ba9('0x37')][_0x0ba9('0x3b')]));_0x17ad76[_0x0ba9('0x3a')]=_0x17ad76[_0x0ba9('0x3a')]['length']?_0x17ad76[_0x0ba9('0x3a')]:_0x51efe4[_0x0ba9('0x34')];if(_0x359433[_0x0ba9('0x37')][_0x0ba9('0x4d')]){_0x17ad76[_0x0ba9('0x48')]=[{'all':!![]}];}_0x17ad76=_['merge']({},_0x17ad76,_0x359433[_0x0ba9('0x47')]);return db[_0x0ba9('0x2f')][_0x0ba9('0x4e')](_0x17ad76)[_0x0ba9('0x28')](handleEntityNotFound(_0x291013,null))[_0x0ba9('0x28')](respondWithResult(_0x291013,null))['catch'](handleError(_0x291013,null));};exports[_0x0ba9('0x4f')]=function(_0x2e28b8,_0xbe7fc2){return db[_0x0ba9('0x2f')][_0x0ba9('0x4f')](_0x2e28b8['body'],{})[_0x0ba9('0x28')](function(_0x2510cc){var _0x4f3ffd=_0x2e28b8['user'][_0x0ba9('0x50')]({'plain':!![]});if(!_0x4f3ffd)throw new Error(_0x0ba9('0x51'));if(_0x4f3ffd[_0x0ba9('0x52')]===_0x0ba9('0x53')){var _0x454443=_0x2510cc[_0x0ba9('0x50')]({'plain':!![]});var _0x41e700=_0x0ba9('0x2a');return db[_0x0ba9('0x54')][_0x0ba9('0x4e')]({'where':{'name':_0x41e700,'userProfileId':_0x4f3ffd[_0x0ba9('0x55')]},'raw':!![]})[_0x0ba9('0x28')](function(_0x23d239){if(_0x23d239&&_0x23d239[_0x0ba9('0x56')]===0x0){return db[_0x0ba9('0x2b')]['create']({'name':_0x454443[_0x0ba9('0x35')],'resourceId':_0x454443['id'],'type':_0x23d239[_0x0ba9('0x35')],'sectionId':_0x23d239['id']},{})[_0x0ba9('0x28')](function(){return _0x2510cc;});}else{return _0x2510cc;}})[_0x0ba9('0x4a')](function(_0x36698c){logger[_0x0ba9('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x36698c);throw _0x36698c;});}return _0x2510cc;})[_0x0ba9('0x28')](respondWithResult(_0xbe7fc2,0xc9))[_0x0ba9('0x4a')](handleError(_0xbe7fc2,null));};exports['update']=function(_0x4a8d13,_0x500132){if(_0x4a8d13[_0x0ba9('0x57')]['id']){delete _0x4a8d13[_0x0ba9('0x57')]['id'];}return db['Variable']['find']({'where':{'id':_0x4a8d13[_0x0ba9('0x4c')]['id']}})['then'](handleEntityNotFound(_0x500132,null))[_0x0ba9('0x28')](saveUpdates(_0x4a8d13[_0x0ba9('0x57')],null))[_0x0ba9('0x28')](respondWithResult(_0x500132,null))[_0x0ba9('0x4a')](handleError(_0x500132,null));};exports[_0x0ba9('0x29')]=function(_0x5bbb94,_0x46b2d7){return db[_0x0ba9('0x2f')][_0x0ba9('0x4e')]({'where':{'id':_0x5bbb94[_0x0ba9('0x4c')]['id']}})[_0x0ba9('0x28')](handleEntityNotFound(_0x46b2d7,null))['then'](removeEntity(_0x46b2d7,null))[_0x0ba9('0x4a')](handleError(_0x46b2d7,null));}; \ No newline at end of file +var _0xb507=['findAll','rows','catch','show','params','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Variables','UserProfileSection','find','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','Variable','rawAttributes','type','keys','filters','intersection','query','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include'];(function(_0x20350f,_0x3ff27a){var _0x5e5c9c=function(_0xc06fbd){while(--_0xc06fbd){_0x20350f['push'](_0x20350f['shift']());}};_0x5e5c9c(++_0x3ff27a);}(_0xb507,0x103));var _0x7b50=function(_0x448774,_0x45ddc7){_0x448774=_0x448774-0x0;var _0x46b2f6=_0xb507[_0x448774];return _0x46b2f6;};'use strict';var emlformat=require(_0x7b50('0x0'));var rimraf=require(_0x7b50('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7b50('0x2'));var rp=require(_0x7b50('0x3'));var moment=require('moment');var BPromise=require(_0x7b50('0x4'));var Mustache=require(_0x7b50('0x5'));var util=require('util');var path=require(_0x7b50('0x6'));var sox=require(_0x7b50('0x7'));var csv=require(_0x7b50('0x8'));var ejs=require(_0x7b50('0x9'));var fs=require('fs');var fs_extra=require(_0x7b50('0xa'));var _=require(_0x7b50('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7b50('0xc'));var toCsv=require('to-csv');var querystring=require(_0x7b50('0xd'));var Papa=require(_0x7b50('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7b50('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7b50('0x10'));var logger=require(_0x7b50('0x11'))('api');var utils=require(_0x7b50('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4e9151,_0x1acc6d){_0x1acc6d=_0x1acc6d||0xcc;return function(_0x1d93d9){if(_0x1d93d9){return _0x4e9151[_0x7b50('0x13')](_0x1acc6d);}return _0x4e9151[_0x7b50('0x14')](_0x1acc6d)[_0x7b50('0x15')]();};}function respondWithResult(_0x2525d4,_0x51556e){_0x51556e=_0x51556e||0xc8;return function(_0x14ea4c){if(_0x14ea4c){return _0x2525d4[_0x7b50('0x14')](_0x51556e)[_0x7b50('0x16')](_0x14ea4c);}};}function respondWithFilteredResult(_0x285a84,_0xc05353){return function(_0x1d7dc5){if(_0x1d7dc5){var _0x10e03b=typeof _0xc05353[_0x7b50('0x17')]===_0x7b50('0x18')&&typeof _0xc05353['limit']===_0x7b50('0x18');var _0x536ab3=_0x1d7dc5[_0x7b50('0x19')];var _0x2a26df=_0x10e03b?0x0:_0xc05353[_0x7b50('0x17')];var _0x31e8bc=_0x10e03b?_0x1d7dc5[_0x7b50('0x19')]:_0xc05353[_0x7b50('0x17')]+_0xc05353[_0x7b50('0x1a')];var _0x1818fe;if(_0x31e8bc>=_0x536ab3){_0x31e8bc=_0x536ab3;_0x1818fe=0xc8;}else{_0x1818fe=0xce;}_0x285a84[_0x7b50('0x14')](_0x1818fe);return _0x285a84[_0x7b50('0x1b')](_0x7b50('0x1c'),_0x2a26df+'-'+_0x31e8bc+'/'+_0x536ab3)[_0x7b50('0x16')](_0x1d7dc5);}return null;};}function patchUpdates(_0x26c076){return function(_0x5d0579){try{jsonpatch[_0x7b50('0x1d')](_0x5d0579,_0x26c076,!![]);}catch(_0x132b6a){return BPromise[_0x7b50('0x1e')](_0x132b6a);}return _0x5d0579[_0x7b50('0x1f')]();};}function saveUpdates(_0x23404c,_0xccd49c){return function(_0x3ea50e){if(_0x3ea50e){return _0x3ea50e['update'](_0x23404c)[_0x7b50('0x20')](function(_0x4ddc60){return _0x4ddc60;});}return null;};}function removeEntity(_0x4346f3,_0x42b1f6){return function(_0x5ea0c3){if(_0x5ea0c3){return _0x5ea0c3[_0x7b50('0x21')]()[_0x7b50('0x20')](function(){var _0x4bb96a=_0x5ea0c3[_0x7b50('0x22')]({'plain':!![]});var _0x1462fe='Variables';return db[_0x7b50('0x23')]['destroy']({'where':{'type':_0x1462fe,'resourceId':_0x4bb96a['id']}})[_0x7b50('0x20')](function(){return _0x5ea0c3;});})['then'](function(){_0x4346f3[_0x7b50('0x14')](0xcc)[_0x7b50('0x15')]();});}};}function handleEntityNotFound(_0x6c3510,_0x142fe9){return function(_0x2579ec){if(!_0x2579ec){_0x6c3510[_0x7b50('0x13')](0x194);}return _0x2579ec;};}function handleError(_0x3bec01,_0x590321){_0x590321=_0x590321||0x1f4;return function(_0x56813a){logger[_0x7b50('0x24')](_0x56813a[_0x7b50('0x25')]);if(_0x56813a[_0x7b50('0x26')]){delete _0x56813a[_0x7b50('0x26')];}_0x3bec01['status'](_0x590321)[_0x7b50('0x27')](_0x56813a);};}exports[_0x7b50('0x28')]=function(_0x1d3a57,_0x2bd89a){var _0x4919ea={},_0x15b819={},_0x1b03c0={'count':0x0,'rows':[]};var _0x1e8316=_[_0x7b50('0x29')](db[_0x7b50('0x2a')][_0x7b50('0x2b')],function(_0x53c5d9){return{'name':_0x53c5d9['fieldName'],'type':_0x53c5d9[_0x7b50('0x2c')]['key']};});_0x15b819['model']=_[_0x7b50('0x29')](_0x1e8316,'name');_0x15b819['query']=_[_0x7b50('0x2d')](_0x1d3a57['query']);_0x15b819[_0x7b50('0x2e')]=_[_0x7b50('0x2f')](_0x15b819['model'],_0x15b819[_0x7b50('0x30')]);_0x4919ea[_0x7b50('0x31')]=_[_0x7b50('0x2f')](_0x15b819[_0x7b50('0x32')],qs[_0x7b50('0x33')](_0x1d3a57[_0x7b50('0x30')][_0x7b50('0x33')]));_0x4919ea[_0x7b50('0x31')]=_0x4919ea['attributes'][_0x7b50('0x34')]?_0x4919ea[_0x7b50('0x31')]:_0x15b819[_0x7b50('0x32')];if(!_0x1d3a57[_0x7b50('0x30')][_0x7b50('0x35')](_0x7b50('0x36'))){_0x4919ea[_0x7b50('0x1a')]=qs[_0x7b50('0x1a')](_0x1d3a57[_0x7b50('0x30')][_0x7b50('0x1a')]);_0x4919ea['offset']=qs[_0x7b50('0x17')](_0x1d3a57[_0x7b50('0x30')]['offset']);}_0x4919ea[_0x7b50('0x37')]=qs[_0x7b50('0x38')](_0x1d3a57[_0x7b50('0x30')][_0x7b50('0x38')]);_0x4919ea['where']=qs['filters'](_[_0x7b50('0x39')](_0x1d3a57[_0x7b50('0x30')],_0x15b819[_0x7b50('0x2e')]),_0x1e8316);if(_0x1d3a57[_0x7b50('0x30')][_0x7b50('0x3a')]){_0x4919ea[_0x7b50('0x3b')]=_[_0x7b50('0x3c')](_0x4919ea[_0x7b50('0x3b')],{'$or':_[_0x7b50('0x29')](_0x1e8316,function(_0x1fae99){if(_0x1fae99[_0x7b50('0x2c')]!==_0x7b50('0x3d')){var _0xe6ba4f={};_0xe6ba4f[_0x1fae99[_0x7b50('0x26')]]={'$like':'%'+_0x1d3a57['query'][_0x7b50('0x3a')]+'%'};return _0xe6ba4f;}})});}_0x4919ea=_[_0x7b50('0x3c')]({},_0x4919ea,_0x1d3a57[_0x7b50('0x3e')]);var _0x20c8cf={'where':_0x4919ea[_0x7b50('0x3b')]};return db[_0x7b50('0x2a')][_0x7b50('0x19')](_0x20c8cf)['then'](function(_0x588e26){_0x1b03c0['count']=_0x588e26;if(_0x1d3a57[_0x7b50('0x30')][_0x7b50('0x3f')]){_0x4919ea[_0x7b50('0x40')]=[{'all':!![]}];}return db[_0x7b50('0x2a')][_0x7b50('0x41')](_0x4919ea);})[_0x7b50('0x20')](function(_0x895961){_0x1b03c0[_0x7b50('0x42')]=_0x895961;return _0x1b03c0;})['then'](respondWithFilteredResult(_0x2bd89a,_0x4919ea))[_0x7b50('0x43')](handleError(_0x2bd89a,null));};exports[_0x7b50('0x44')]=function(_0x42df60,_0xd20e84){var _0x273f7a={'raw':!![],'where':{'id':_0x42df60[_0x7b50('0x45')]['id']}},_0x29b924={};_0x29b924[_0x7b50('0x32')]=_[_0x7b50('0x2d')](db[_0x7b50('0x2a')][_0x7b50('0x2b')]);_0x29b924['query']=_[_0x7b50('0x2d')](_0x42df60[_0x7b50('0x30')]);_0x29b924[_0x7b50('0x2e')]=_[_0x7b50('0x2f')](_0x29b924[_0x7b50('0x32')],_0x29b924[_0x7b50('0x30')]);_0x273f7a[_0x7b50('0x31')]=_['intersection'](_0x29b924['model'],qs[_0x7b50('0x33')](_0x42df60[_0x7b50('0x30')][_0x7b50('0x33')]));_0x273f7a[_0x7b50('0x31')]=_0x273f7a['attributes']['length']?_0x273f7a[_0x7b50('0x31')]:_0x29b924[_0x7b50('0x32')];if(_0x42df60[_0x7b50('0x30')][_0x7b50('0x3f')]){_0x273f7a['include']=[{'all':!![]}];}_0x273f7a=_[_0x7b50('0x3c')]({},_0x273f7a,_0x42df60[_0x7b50('0x3e')]);return db[_0x7b50('0x2a')]['find'](_0x273f7a)['then'](handleEntityNotFound(_0xd20e84,null))[_0x7b50('0x20')](respondWithResult(_0xd20e84,null))['catch'](handleError(_0xd20e84,null));};exports['create']=function(_0x5477bb,_0x4d8591){return db['Variable']['create'](_0x5477bb[_0x7b50('0x46')],{})['then'](function(_0x3de4cc){var _0xf2ec72=_0x5477bb['user']['get']({'plain':!![]});if(!_0xf2ec72)throw new Error(_0x7b50('0x47'));if(_0xf2ec72[_0x7b50('0x48')]===_0x7b50('0x49')){var _0x414d56=_0x3de4cc[_0x7b50('0x22')]({'plain':!![]});var _0x3f6ea2=_0x7b50('0x4a');return db[_0x7b50('0x4b')][_0x7b50('0x4c')]({'where':{'name':_0x3f6ea2,'userProfileId':_0xf2ec72['userProfileId']},'raw':!![]})[_0x7b50('0x20')](function(_0x5029c1){if(_0x5029c1&&_0x5029c1[_0x7b50('0x4d')]===0x0){return db[_0x7b50('0x23')][_0x7b50('0x4e')]({'name':_0x414d56['name'],'resourceId':_0x414d56['id'],'type':_0x5029c1[_0x7b50('0x26')],'sectionId':_0x5029c1['id']},{})[_0x7b50('0x20')](function(){return _0x3de4cc;});}else{return _0x3de4cc;}})['catch'](function(_0x539a97){logger[_0x7b50('0x24')](_0x7b50('0x4f'),_0x539a97);throw _0x539a97;});}return _0x3de4cc;})['then'](respondWithResult(_0x4d8591,0xc9))[_0x7b50('0x43')](handleError(_0x4d8591,null));};exports[_0x7b50('0x50')]=function(_0x28c364,_0x19bd92){if(_0x28c364['body']['id']){delete _0x28c364[_0x7b50('0x46')]['id'];}return db[_0x7b50('0x2a')][_0x7b50('0x4c')]({'where':{'id':_0x28c364[_0x7b50('0x45')]['id']}})[_0x7b50('0x20')](handleEntityNotFound(_0x19bd92,null))['then'](saveUpdates(_0x28c364[_0x7b50('0x46')],null))[_0x7b50('0x20')](respondWithResult(_0x19bd92,null))[_0x7b50('0x43')](handleError(_0x19bd92,null));};exports['destroy']=function(_0x6feb6f,_0x523647){return db[_0x7b50('0x2a')]['find']({'where':{'id':_0x6feb6f[_0x7b50('0x45')]['id']}})[_0x7b50('0x20')](handleEntityNotFound(_0x523647,null))['then'](removeEntity(_0x523647,null))[_0x7b50('0x43')](handleError(_0x523647,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index c680b8f..ad55cd0 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 _0x13a8=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','Variable'];(function(_0x4dec3a,_0x2abfe8){var _0x2e23d1=function(_0x309bea){while(--_0x309bea){_0x4dec3a['push'](_0x4dec3a['shift']());}};_0x2e23d1(++_0x2abfe8);}(_0x13a8,0x197));var _0x813a=function(_0x4419fb,_0xba456){_0x4419fb=_0x4419fb-0x0;var _0x4eda5c=_0x13a8[_0x4419fb];return _0x4eda5c;};'use strict';var _=require(_0x813a('0x0'));var util=require(_0x813a('0x1'));var logger=require(_0x813a('0x2'))(_0x813a('0x3'));var moment=require(_0x813a('0x4'));var BPromise=require(_0x813a('0x5'));var rp=require(_0x813a('0x6'));var fs=require('fs');var path=require(_0x813a('0x7'));var rimraf=require(_0x813a('0x8'));var config=require('../../config/environment');var attributes=require('./variable.attributes');module[_0x813a('0x9')]=function(_0x209850,_0x2b5684){return _0x209850['define'](_0x813a('0xa'),attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4cef=['request-promise','path','../../config/environment','./variable.attributes','exports','Variable','tools_variables','lodash','../../config/logger','api','moment'];(function(_0x430022,_0x1a2433){var _0x1c1095=function(_0x188291){while(--_0x188291){_0x430022['push'](_0x430022['shift']());}};_0x1c1095(++_0x1a2433);}(_0x4cef,0x1e0));var _0xf4ce=function(_0x373daf,_0x18b9a8){_0x373daf=_0x373daf-0x0;var _0x1fa416=_0x4cef[_0x373daf];return _0x1fa416;};'use strict';var _=require(_0xf4ce('0x0'));var util=require('util');var logger=require(_0xf4ce('0x1'))(_0xf4ce('0x2'));var moment=require(_0xf4ce('0x3'));var BPromise=require('bluebird');var rp=require(_0xf4ce('0x4'));var fs=require('fs');var path=require(_0xf4ce('0x5'));var rimraf=require('rimraf');var config=require(_0xf4ce('0x6'));var attributes=require(_0xf4ce('0x7'));module[_0xf4ce('0x8')]=function(_0x376164,_0x43309a){return _0x376164['define'](_0xf4ce('0x9'),attributes,{'tableName':_0xf4ce('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index 07ea2cc..50c783d 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 _0x326f=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','Variable,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','ShowVariable','Variable','raw','options','include','model','attributes','map','then','stringify','lodash'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x326f,0xd1));var _0xf326=function(_0x17d761,_0x43503f){_0x17d761=_0x17d761-0x0;var _0x4ec52e=_0x326f[_0x17d761];return _0x4ec52e;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf326('0x1'));var rs=require(_0xf326('0x2'));var fs=require('fs');var Redis=require(_0xf326('0x3'));var db=require(_0xf326('0x4'))['db'];var utils=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));var config=require(_0xf326('0x8'));var jayson=require(_0xf326('0x9'));var client=jayson[_0xf326('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c254d,_0x3851eb,_0x165f95){return new BPromise(function(_0x1e7b8a,_0x515bfa){return client['request'](_0x3c254d,_0x165f95)['then'](function(_0x3bacf2){logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));logger[_0xf326('0xe')]('Variable,\x20%s,\x20%s,\x20%s',_0x3851eb,_0xf326('0xd'),JSON['stringify'](_0x3bacf2));if(_0x3bacf2[_0xf326('0xf')]){if(_0x3bacf2['error'][_0xf326('0x10')]===0x1f4){logger['error'](_0xf326('0xc'),_0x3851eb,_0x3bacf2[_0xf326('0xf')]['message']);return _0x515bfa(_0x3bacf2[_0xf326('0xf')][_0xf326('0x11')]);}logger[_0xf326('0xf')](_0xf326('0xc'),_0x3851eb,_0x3bacf2['error'][_0xf326('0x11')]);return _0x1e7b8a(_0x3bacf2['error']['message']);}else{logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));_0x1e7b8a(_0x3bacf2[_0xf326('0x12')][_0xf326('0x11')]);}})[_0xf326('0x13')](function(_0x34128e){logger[_0xf326('0xf')]('Variable,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});}exports[_0xf326('0x14')]=function(_0x453100){var _0x18bee3=this;return new Promise(function(_0x31ffb9,_0xcef2b5){return db[_0xf326('0x15')]['find']({'raw':_0x453100['options']?_0x453100['options'][_0xf326('0x16')]===undefined?!![]:![]:!![],'where':_0x453100[_0xf326('0x17')]?_0x453100['options']['where']||null:null,'attributes':_0x453100[_0xf326('0x17')]?_0x453100['options']['attributes']||null:null,'include':_0x453100[_0xf326('0x17')]?_0x453100[_0xf326('0x17')]['include']?_['map'](_0x453100[_0xf326('0x17')][_0xf326('0x18')],function(_0x5f21a2){return{'model':db[_0x5f21a2[_0xf326('0x19')]],'as':_0x5f21a2['as'],'attributes':_0x5f21a2[_0xf326('0x1a')],'include':_0x5f21a2[_0xf326('0x18')]?_[_0xf326('0x1b')](_0x5f21a2[_0xf326('0x18')],function(_0x2049ec){return{'model':db[_0x2049ec['model']],'as':_0x2049ec['as'],'attributes':_0x2049ec['attributes'],'include':_0x2049ec['include']?_[_0xf326('0x1b')](_0x2049ec[_0xf326('0x18')],function(_0x2cd45a){return{'model':db[_0x2cd45a[_0xf326('0x19')]],'as':_0x2cd45a['as'],'attributes':_0x2cd45a[_0xf326('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xf326('0x1c')](function(_0x5217d4){logger[_0xf326('0xb')](_0xf326('0x14'),_0x453100);logger[_0xf326('0xe')]('ShowVariable',_0x453100,JSON[_0xf326('0x1d')](_0x5217d4));_0x31ffb9(_0x5217d4);})['catch'](function(_0x4a9abf){logger[_0xf326('0xf')](_0xf326('0x14'),_0x4a9abf[_0xf326('0x11')],_0x453100);_0xcef2b5(_0x18bee3['error'](0x1f4,_0x4a9abf[_0xf326('0x11')]));});});}; \ 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(_0x3ab4eb,_0x2088af){var _0x32b657=function(_0x319715){while(--_0x319715){_0x3ab4eb['push'](_0x3ab4eb['shift']());}};_0x32b657(++_0x2088af);}(_0x6aa7,0x178));var _0x76aa=function(_0xdba908,_0x3e2dca){_0xdba908=_0xdba908-0x0;var _0x4e6751=_0x6aa7[_0xdba908];return _0x4e6751;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var moment=require(_0x76aa('0x1'));var BPromise=require(_0x76aa('0x2'));var rs=require(_0x76aa('0x3'));var fs=require('fs');var Redis=require(_0x76aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76aa('0x5'));var logger=require(_0x76aa('0x6'))(_0x76aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76aa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32dee5,_0x36d12b,_0xa9b695){return new BPromise(function(_0x56d6bc,_0x3dae33){return client[_0x76aa('0x9')](_0x32dee5,_0xa9b695)[_0x76aa('0xa')](function(_0x557d69){logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,_0x76aa('0xd'));logger[_0x76aa('0xe')](_0x76aa('0xf'),_0x36d12b,_0x76aa('0xd'),JSON[_0x76aa('0x10')](_0x557d69));if(_0x557d69[_0x76aa('0x11')]){if(_0x557d69[_0x76aa('0x11')][_0x76aa('0x12')]===0x1f4){logger['error'](_0x76aa('0xc'),_0x36d12b,_0x557d69['error'][_0x76aa('0x13')]);return _0x3dae33(_0x557d69[_0x76aa('0x11')][_0x76aa('0x13')]);}logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x557d69['error']['message']);return _0x56d6bc(_0x557d69[_0x76aa('0x11')]['message']);}else{logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,'request\x20sent');_0x56d6bc(_0x557d69[_0x76aa('0x14')]['message']);}})[_0x76aa('0x15')](function(_0x5181d2){logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x5181d2);_0x3dae33(_0x5181d2);});});}exports[_0x76aa('0x16')]=function(_0x21c16d){var _0xa1bc7=this;return new Promise(function(_0x3ead3f,_0x496902){return db['Variable'][_0x76aa('0x17')]({'raw':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x19')]===undefined?!![]:![]:!![],'where':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1a')]||null:null,'attributes':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')]['attributes']||null:null,'include':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1b')]?_['map'](_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1b')],function(_0x31252f){return{'model':db[_0x31252f[_0x76aa('0x1c')]],'as':_0x31252f['as'],'attributes':_0x31252f[_0x76aa('0x1d')],'include':_0x31252f[_0x76aa('0x1b')]?_[_0x76aa('0x1e')](_0x31252f[_0x76aa('0x1b')],function(_0x32bf9f){return{'model':db[_0x32bf9f[_0x76aa('0x1c')]],'as':_0x32bf9f['as'],'attributes':_0x32bf9f[_0x76aa('0x1d')],'include':_0x32bf9f[_0x76aa('0x1b')]?_[_0x76aa('0x1e')](_0x32bf9f['include'],function(_0xb5e8a9){return{'model':db[_0xb5e8a9[_0x76aa('0x1c')]],'as':_0xb5e8a9['as'],'attributes':_0xb5e8a9[_0x76aa('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x76aa('0xa')](function(_0xa1e6){logger[_0x76aa('0xb')](_0x76aa('0x16'),_0x21c16d);logger[_0x76aa('0xe')](_0x76aa('0x16'),_0x21c16d,JSON[_0x76aa('0x10')](_0xa1e6));_0x3ead3f(_0xa1e6);})['catch'](function(_0x3fcb7f){logger['error'](_0x76aa('0x16'),_0x3fcb7f[_0x76aa('0x13')],_0x21c16d);_0x496902(_0xa1bc7[_0x76aa('0x11')](0x1f4,_0x3fcb7f[_0x76aa('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 8a0cb2f..f6cc4c1 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 _0x7519=['restart','migrations','express','get','index','isAuthenticated','fetch','/reset','reset','/pull','canUpdate','pull','/restart'];(function(_0x51f475,_0x17a3be){var _0x59f8c3=function(_0x5e2486){while(--_0x5e2486){_0x51f475['push'](_0x51f475['shift']());}};_0x59f8c3(++_0x17a3be);}(_0x7519,0xb8));var _0x9751=function(_0x4103fe,_0xf55e0e){_0x4103fe=_0x4103fe-0x0;var _0xd53a00=_0x7519[_0x4103fe];return _0xd53a00;};'use strict';var express=require(_0x9751('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require('./version.controller');router[_0x9751('0x1')]('/',controller[_0x9751('0x2')]);router[_0x9751('0x1')]('/fetch',auth[_0x9751('0x3')](),auth['canUpdate'](),controller[_0x9751('0x4')]);router[_0x9751('0x1')](_0x9751('0x5'),auth[_0x9751('0x3')](),auth['canUpdate'](),controller[_0x9751('0x6')]);router['get'](_0x9751('0x7'),auth[_0x9751('0x3')](),auth[_0x9751('0x8')](),controller[_0x9751('0x9')]);router[_0x9751('0x1')](_0x9751('0xa'),auth[_0x9751('0x3')](),controller[_0x9751('0xb')]);router['get']('/migrations',controller[_0x9751('0xc')]);module['exports']=router; \ No newline at end of file +var _0x1989=['/restart','restart','/migrations','exports','express','Router','../../components/auth/service','get','index','isAuthenticated','canUpdate','reset','pull'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0x1989,0x149));var _0x9198=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1989[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0x9198('0x0'));var router=express[_0x9198('0x1')]();var auth=require(_0x9198('0x2'));var controller=require('./version.controller');router[_0x9198('0x3')]('/',controller[_0x9198('0x4')]);router[_0x9198('0x3')]('/fetch',auth[_0x9198('0x5')](),auth[_0x9198('0x6')](),controller['fetch']);router[_0x9198('0x3')]('/reset',auth[_0x9198('0x5')](),auth['canUpdate'](),controller[_0x9198('0x7')]);router[_0x9198('0x3')]('/pull',auth[_0x9198('0x5')](),auth[_0x9198('0x6')](),controller[_0x9198('0x8')]);router[_0x9198('0x3')](_0x9198('0x9'),auth['isAuthenticated'](),controller[_0x9198('0xa')]);router[_0x9198('0x3')](_0x9198('0xb'),controller['migrations']);module[_0x9198('0xc')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index ab1dfb8..92c5a37 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 _0x3c57=['\x20to\x20','Database\x20already\x20up-to-date','path','lodash','child_process','exec','../../mysqldb','../../config/environment','update','simple-git','index','exports','version','query','latest','fetch','tags','status','json','origin','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','readdirSync','join','root','server','migrations','length','.js','push','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','Database\x20migrated\x20successfully\x20from\x20version\x20'];(function(_0x2867a6,_0x10d905){var _0x4afc2b=function(_0x457840){while(--_0x457840){_0x2867a6['push'](_0x2867a6['shift']());}};_0x4afc2b(++_0x10d905);}(_0x3c57,0x1c4));var _0x73c5=function(_0x57e2ec,_0x2fb0b2){_0x57e2ec=_0x57e2ec-0x0;var _0x13848b=_0x3c57[_0x57e2ec];return _0x13848b;};'use strict';var Umzug=require('umzug');var path=require(_0x73c5('0x0'));var fs=require('fs');var _=require(_0x73c5('0x1'));var pkginfo=require('pkginfo')(module,'version');var compareVersions=require('compare-versions');var exec=require(_0x73c5('0x2'))[_0x73c5('0x3')];var db=require(_0x73c5('0x4'))['db'];var config=require(_0x73c5('0x5'));var pm2=require('../../config/pm2');var logger=require('../../config/logger')(_0x73c5('0x6'));var git=require(_0x73c5('0x7'))(config['root']);exports[_0x73c5('0x8')]=function(_0x26a400,_0xcfbb32){var _0x5c9dd3={'current':module[_0x73c5('0x9')][_0x73c5('0xa')],'phonebar':0x2};if(_0x26a400[_0x73c5('0xb')]&&_0x26a400[_0x73c5('0xb')][_0x73c5('0xc')]){return git[_0x73c5('0xd')]()[_0x73c5('0xe')](function(_0xa36a3,_0xe2490b){_0x5c9dd3[_0x73c5('0xc')]=(_0xa36a3?module[_0x73c5('0x9')]['version']:_0xe2490b[_0x73c5('0xc')])||'2.0.0';return _0xcfbb32[_0x73c5('0xf')](0xc8)[_0x73c5('0x10')](_0x5c9dd3);});}else{return _0xcfbb32[_0x73c5('0xf')](0xc8)[_0x73c5('0x10')](_0x5c9dd3);}};exports[_0x73c5('0xd')]=function(_0x223a3e,_0x3bc1d3){return git[_0x73c5('0xd')]([_0x73c5('0x11'),'master'],function(_0x562ac8){if(_0x562ac8){logger[_0x73c5('0x12')](_0x562ac8);return _0x3bc1d3[_0x73c5('0xf')](0x1f4)['json'](_0x562ac8);}logger[_0x73c5('0x13')](_0x73c5('0x14'));return _0x3bc1d3['status'](0xc8)[_0x73c5('0x10')]({'output':_0x73c5('0x15')});});};exports[_0x73c5('0x16')]=function(_0xf818c5,_0x3d2e03){return git[_0x73c5('0x16')]([_0x73c5('0x17'),'FETCH_HEAD'],function(_0x28e758){if(_0x28e758){logger[_0x73c5('0x12')](_0x28e758);return _0x3d2e03[_0x73c5('0xf')](0x1f4)[_0x73c5('0x10')](_0x28e758);}logger['info'](_0x73c5('0x18'));return _0x3d2e03[_0x73c5('0xf')](0xc8)[_0x73c5('0x10')]({'output':_0x73c5('0x19')});});};exports[_0x73c5('0x1a')]=function(_0x7e81c2,_0x2e1e5d){exec('npm\x20install\x20--production',function(_0x387ff7,_0x3fc297,_0x547b26){logger['info'](_0x3fc297);logger['info'](_0x547b26);if(_0x387ff7){logger[_0x73c5('0x12')](_0x387ff7);return _0x2e1e5d[_0x73c5('0xf')](0x1f4)[_0x73c5('0x10')](_0x387ff7);}return _0x2e1e5d['status'](0xc8)['json']({'output':_0x3fc297});});};exports[_0x73c5('0x1b')]=function(_0xeb0318,_0x5b2612){return pm2[_0x73c5('0x1b')](_0x73c5('0x1c'))[_0x73c5('0x1d')](function(_0x1d7137){logger['info'](_0x73c5('0x1e'),_0x1d7137);return _0x5b2612[_0x73c5('0xf')](0xc8)['json']({'output':_0x73c5('0x1f')});})[_0x73c5('0x20')](function(_0x358d61){logger[_0x73c5('0x12')](_0x358d61);return _0x5b2612['status'](0x1f4)[_0x73c5('0x10')](_0x358d61);});};exports['migrations']=function(_0x2f0043,_0x25a10d){var _0xe4e2a1=fs[_0x73c5('0x21')](path[_0x73c5('0x22')](config[_0x73c5('0x23')],_0x73c5('0x24'),_0x73c5('0x25')));var _0x24bfa3=[];for(var _0x32de0b=0x0;_0x32de0b<_0xe4e2a1[_0x73c5('0x26')];_0x32de0b++){var _0x2c5e73=_0xe4e2a1[_0x32de0b]['replace'](_0x73c5('0x27'),'');if(compareVersions(module[_0x73c5('0x9')]['version'],_0x2c5e73)===-0x1){_0x24bfa3[_0x73c5('0x28')](_0x2c5e73);}}if(_0x24bfa3['length']){var _0x1e3dfa=_0x24bfa3[_0x73c5('0x29')](compareVersions);var _0x2044e9=new Umzug({'storage':_0x73c5('0x2a'),'storageOptions':{'model':db[_0x73c5('0x2b')],'modelName':_0x73c5('0x2b'),'columnName':'version'},'migrations':{'params':[db['sequelize'][_0x73c5('0x2c')](),db[_0x73c5('0x2a')][_0x73c5('0x2d')],function(){throw new Error(_0x73c5('0x2e'));}],'path':path[_0x73c5('0x22')](config[_0x73c5('0x23')],_0x73c5('0x24'),_0x73c5('0x25')),'pattern':/\.js$/}});_0x2044e9['up']({'migrations':_['map'](_0x1e3dfa,function(_0x46cc5a){return _0x46cc5a+'.js';})})[_0x73c5('0x1d')](function(){return _0x25a10d[_0x73c5('0xf')](0xc8)[_0x73c5('0x10')]({'output':_0x73c5('0x2f')+module['exports']['version']+_0x73c5('0x30')+_['last'](_0x1e3dfa),'migrations':_[_0x73c5('0x22')](_0x1e3dfa)});})[_0x73c5('0x20')](function(_0x57430c){if(_0x57430c instanceof db[_0x73c5('0x2a')]['UniqueConstraintError']){return _0x25a10d[_0x73c5('0xf')](0xc8)[_0x73c5('0x10')]({'output':_0x73c5('0x31')});}else{return _0x25a10d[_0x73c5('0xf')](0x1f4)['json'](_0x57430c);}});}else{return _0x25a10d[_0x73c5('0xf')](0xc8)[_0x73c5('0x10')]({'output':_0x73c5('0x31')});}}; \ No newline at end of file +var _0xc57f=['Database\x20already\x20up-to-date','umzug','path','lodash','version','compare-versions','child_process','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','index','exports','query','latest','tags','status','json','fetch','origin','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','catch','readdirSync','join','server','migrations','sort','sequelize','Migration','getQueryInterface','map','.js','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','UniqueConstraintError'];(function(_0x15b570,_0x480493){var _0x56250e=function(_0x4fe7b8){while(--_0x4fe7b8){_0x15b570['push'](_0x15b570['shift']());}};_0x56250e(++_0x480493);}(_0xc57f,0x9d));var _0xfc57=function(_0x363319,_0x4fa1a1){_0x363319=_0x363319-0x0;var _0x182a62=_0xc57f[_0x363319];return _0x182a62;};'use strict';var Umzug=require(_0xfc57('0x0'));var path=require(_0xfc57('0x1'));var fs=require('fs');var _=require(_0xfc57('0x2'));var pkginfo=require('pkginfo')(module,_0xfc57('0x3'));var compareVersions=require(_0xfc57('0x4'));var exec=require(_0xfc57('0x5'))['exec'];var db=require('../../mysqldb')['db'];var config=require(_0xfc57('0x6'));var pm2=require(_0xfc57('0x7'));var logger=require(_0xfc57('0x8'))(_0xfc57('0x9'));var git=require(_0xfc57('0xa'))(config[_0xfc57('0xb')]);exports[_0xfc57('0xc')]=function(_0x1bde6f,_0x351673){var _0x3596d1={'current':module[_0xfc57('0xd')][_0xfc57('0x3')],'phonebar':0x2};if(_0x1bde6f[_0xfc57('0xe')]&&_0x1bde6f[_0xfc57('0xe')][_0xfc57('0xf')]){return git['fetch']()[_0xfc57('0x10')](function(_0x549e4b,_0x362feb){_0x3596d1[_0xfc57('0xf')]=(_0x549e4b?module[_0xfc57('0xd')][_0xfc57('0x3')]:_0x362feb[_0xfc57('0xf')])||'2.0.0';return _0x351673[_0xfc57('0x11')](0xc8)[_0xfc57('0x12')](_0x3596d1);});}else{return _0x351673[_0xfc57('0x11')](0xc8)['json'](_0x3596d1);}};exports[_0xfc57('0x13')]=function(_0x5f4b2e,_0x3161ff){return git[_0xfc57('0x13')]([_0xfc57('0x14'),_0xfc57('0x15')],function(_0x9f56d1){if(_0x9f56d1){logger[_0xfc57('0x16')](_0x9f56d1);return _0x3161ff[_0xfc57('0x11')](0x1f4)[_0xfc57('0x12')](_0x9f56d1);}logger[_0xfc57('0x17')](_0xfc57('0x18'));return _0x3161ff[_0xfc57('0x11')](0xc8)[_0xfc57('0x12')]({'output':_0xfc57('0x19')});});};exports[_0xfc57('0x1a')]=function(_0x379b7e,_0xc77372){return git['reset']([_0xfc57('0x1b'),_0xfc57('0x1c')],function(_0x55e28a){if(_0x55e28a){logger[_0xfc57('0x16')](_0x55e28a);return _0xc77372['status'](0x1f4)['json'](_0x55e28a);}logger[_0xfc57('0x17')](_0xfc57('0x1d'));return _0xc77372[_0xfc57('0x11')](0xc8)[_0xfc57('0x12')]({'output':_0xfc57('0x1e')});});};exports[_0xfc57('0x1f')]=function(_0x3e3fdf,_0x56fdc3){exec(_0xfc57('0x20'),function(_0x5f5bac,_0x3626cd,_0x163acf){logger[_0xfc57('0x17')](_0x3626cd);logger[_0xfc57('0x17')](_0x163acf);if(_0x5f5bac){logger[_0xfc57('0x16')](_0x5f5bac);return _0x56fdc3[_0xfc57('0x11')](0x1f4)[_0xfc57('0x12')](_0x5f5bac);}return _0x56fdc3[_0xfc57('0x11')](0xc8)[_0xfc57('0x12')]({'output':_0x3626cd});});};exports[_0xfc57('0x21')]=function(_0x45f382,_0x353e91){return pm2['restart'](_0xfc57('0x22'))[_0xfc57('0x23')](function(_0xa6af74){logger['info'](_0xfc57('0x24'),_0xa6af74);return _0x353e91[_0xfc57('0x11')](0xc8)[_0xfc57('0x12')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0xfc57('0x25')](function(_0x491558){logger[_0xfc57('0x16')](_0x491558);return _0x353e91['status'](0x1f4)[_0xfc57('0x12')](_0x491558);});};exports['migrations']=function(_0xfd7e6,_0x5494af){var _0x3953c3=fs[_0xfc57('0x26')](path[_0xfc57('0x27')](config[_0xfc57('0xb')],_0xfc57('0x28'),_0xfc57('0x29')));var _0x297c66=[];for(var _0x44a233=0x0;_0x44a233<_0x3953c3['length'];_0x44a233++){var _0x6275c3=_0x3953c3[_0x44a233]['replace']('.js','');if(compareVersions(module[_0xfc57('0xd')][_0xfc57('0x3')],_0x6275c3)===-0x1){_0x297c66['push'](_0x6275c3);}}if(_0x297c66['length']){var _0x35f193=_0x297c66[_0xfc57('0x2a')](compareVersions);var _0x550b97=new Umzug({'storage':_0xfc57('0x2b'),'storageOptions':{'model':db[_0xfc57('0x2c')],'modelName':_0xfc57('0x2c'),'columnName':_0xfc57('0x3')},'migrations':{'params':[db[_0xfc57('0x2b')][_0xfc57('0x2d')](),db[_0xfc57('0x2b')]['constructor'],function(){throw new Error('Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.');}],'path':path[_0xfc57('0x27')](config[_0xfc57('0xb')],_0xfc57('0x28'),_0xfc57('0x29')),'pattern':/\.js$/}});_0x550b97['up']({'migrations':_[_0xfc57('0x2e')](_0x35f193,function(_0x46efed){return _0x46efed+_0xfc57('0x2f');})})[_0xfc57('0x23')](function(){return _0x5494af['status'](0xc8)['json']({'output':_0xfc57('0x30')+module[_0xfc57('0xd')][_0xfc57('0x3')]+_0xfc57('0x31')+_['last'](_0x35f193),'migrations':_[_0xfc57('0x27')](_0x35f193)});})[_0xfc57('0x25')](function(_0x854dc4){if(_0x854dc4 instanceof db[_0xfc57('0x2b')][_0xfc57('0x32')]){return _0x5494af['status'](0xc8)['json']({'output':_0xfc57('0x33')});}else{return _0x5494af['status'](0x1f4)[_0xfc57('0x12')](_0x854dc4);}});}else{return _0x5494af[_0xfc57('0x11')](0xc8)[_0xfc57('0x12')]({'output':_0xfc57('0x33')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 4db43ba..b83d3b9 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 _0xa5fd=['describe','get','/:id','post','put','update','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index'];(function(_0x2e84ee,_0x283c59){var _0x5c82d0=function(_0x9cf8ca){while(--_0x9cf8ca){_0x2e84ee['push'](_0x2e84ee['shift']());}};_0x5c82d0(++_0x283c59);}(_0xa5fd,0x106));var _0xda5f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa5fd[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xda5f('0x0'));var path=require(_0xda5f('0x1'));var timeout=require(_0xda5f('0x2'));var express=require(_0xda5f('0x3'));var router=express[_0xda5f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xda5f('0x5'));var interaction=require(_0xda5f('0x6'));var config=require(_0xda5f('0x7'));var controller=require('./voiceAgentReport.controller');router['get']('/',auth[_0xda5f('0x8')](),controller[_0xda5f('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xda5f('0xa')]);router[_0xda5f('0xb')](_0xda5f('0xc'),auth[_0xda5f('0x8')](),controller['show']);router[_0xda5f('0xd')]('/',auth[_0xda5f('0x8')](),controller['create']);router[_0xda5f('0xe')](_0xda5f('0xc'),auth[_0xda5f('0x8')](),controller[_0xda5f('0xf')]);router['delete'](_0xda5f('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xda5f('0x10')]=router; \ No newline at end of file +var _0xb6dd=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','delete','destroy'];(function(_0x474b4f,_0x127edf){var _0x4c748c=function(_0x104478){while(--_0x104478){_0x474b4f['push'](_0x474b4f['shift']());}};_0x4c748c(++_0x127edf);}(_0xb6dd,0x94));var _0xdb6d=function(_0x6e1825,_0x1f4857){_0x6e1825=_0x6e1825-0x0;var _0x1a5733=_0xb6dd[_0x6e1825];return _0x1a5733;};'use strict';var multer=require(_0xdb6d('0x0'));var util=require(_0xdb6d('0x1'));var path=require(_0xdb6d('0x2'));var timeout=require(_0xdb6d('0x3'));var express=require(_0xdb6d('0x4'));var router=express['Router']();var fs_extra=require(_0xdb6d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xdb6d('0x6'));var config=require('../../config/environment');var controller=require(_0xdb6d('0x7'));router[_0xdb6d('0x8')]('/',auth[_0xdb6d('0x9')](),controller[_0xdb6d('0xa')]);router[_0xdb6d('0x8')](_0xdb6d('0xb'),auth[_0xdb6d('0x9')](),controller['describe']);router[_0xdb6d('0x8')](_0xdb6d('0xc'),auth[_0xdb6d('0x9')](),controller[_0xdb6d('0xd')]);router[_0xdb6d('0xe')]('/',auth[_0xdb6d('0x9')](),controller[_0xdb6d('0xf')]);router[_0xdb6d('0x10')](_0xdb6d('0xc'),auth[_0xdb6d('0x9')](),controller[_0xdb6d('0x11')]);router[_0xdb6d('0x12')](_0xdb6d('0xc'),auth[_0xdb6d('0x9')](),controller[_0xdb6d('0x13')]);module[_0xdb6d('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 7912fbb..35680c3 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 _0x01d3=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','INTEGER','BOOLEAN'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x01d3,0xa2));var _0x301d=function(_0x495484,_0x4b43e0){_0x495484=_0x495484-0x0;var _0x4d628e=_0x01d3[_0x495484];return _0x4d628e;};'use strict';var Sequelize=require(_0x301d('0x0'));module[_0x301d('0x1')]={'type':{'type':Sequelize[_0x301d('0x2')]},'uniqueid':{'type':Sequelize[_0x301d('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x301d('0x2')]},'queue':{'type':Sequelize[_0x301d('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x301d('0x2')]},'agentcalledAt':{'type':Sequelize[_0x301d('0x3')]},'agentconnectAt':{'type':Sequelize[_0x301d('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x301d('0x3')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0x301d('0x3')]},'holdtime':{'type':Sequelize[_0x301d('0x4')]},'agentcomplete':{'type':Sequelize[_0x301d('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x301d('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x301d('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x301d('0x4')]},'agentacw':{'type':Sequelize[_0x301d('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x301d('0x4')]},'reason':{'type':Sequelize[_0x301d('0x2')]},'lastevent':{'type':Sequelize[_0x301d('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x301d('0x4')]},'channelstatedesc':{'type':Sequelize[_0x301d('0x2')]},'connectedlinenum':{'type':Sequelize[_0x301d('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x301d('0x2')]},'accountcode':{'type':Sequelize[_0x301d('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x301d('0x2')]},'destchannelstate':{'type':Sequelize[_0x301d('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x301d('0x2')]},'destcalleridnum':{'type':Sequelize[_0x301d('0x2')]},'destcalleridname':{'type':Sequelize[_0x301d('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x301d('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x301d('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x301d('0x2')]},'destexten':{'type':Sequelize[_0x301d('0x2')]},'destpriority':{'type':Sequelize[_0x301d('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x301d('0x2')],'comment':_0x301d('0x6')},'transferexten':{'type':Sequelize[_0x301d('0x2')]},'transferuniqueid':{'type':Sequelize[_0x301d('0x2')]},'agententerreason':{'type':Sequelize[_0x301d('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8ed7=['FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING','DATE','INTEGER','BOOLEAN'];(function(_0xac151d,_0x4ea1d2){var _0x111dba=function(_0x13d7f4){while(--_0x13d7f4){_0xac151d['push'](_0xac151d['shift']());}};_0x111dba(++_0x4ea1d2);}(_0x8ed7,0x8b));var _0x78ed=function(_0x38ec43,_0x46e019){_0x38ec43=_0x38ec43-0x0;var _0x26f816=_0x8ed7[_0x38ec43];return _0x26f816;};'use strict';var Sequelize=require('sequelize');module[_0x78ed('0x0')]={'type':{'type':Sequelize[_0x78ed('0x1')]},'uniqueid':{'type':Sequelize[_0x78ed('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x78ed('0x1')]},'interface':{'type':Sequelize[_0x78ed('0x1')]},'membername':{'type':Sequelize[_0x78ed('0x1')]},'agentcalledAt':{'type':Sequelize[_0x78ed('0x2')]},'agentconnectAt':{'type':Sequelize[_0x78ed('0x2')]},'agentcompleteAt':{'type':Sequelize[_0x78ed('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0x78ed('0x2')]},'agentdumpAt':{'type':Sequelize[_0x78ed('0x2')]},'holdtime':{'type':Sequelize[_0x78ed('0x3')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x78ed('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0x78ed('0x3')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x78ed('0x3')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x78ed('0x1')]},'channelstate':{'type':Sequelize[_0x78ed('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x78ed('0x1')]},'connectedlinename':{'type':Sequelize[_0x78ed('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x78ed('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x78ed('0x1')]},'priority':{'type':Sequelize[_0x78ed('0x1')]},'destchannel':{'type':Sequelize[_0x78ed('0x1')]},'destchannelstate':{'type':Sequelize[_0x78ed('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x78ed('0x1')]},'destcalleridnum':{'type':Sequelize[_0x78ed('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x78ed('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x78ed('0x1')]},'destuniqueid':{'type':Sequelize[_0x78ed('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x78ed('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0x78ed('0x1')]},'transfer':{'type':Sequelize[_0x78ed('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x78ed('0x1')],'comment':_0x78ed('0x5')},'transferexten':{'type':Sequelize[_0x78ed('0x1')]},'transferuniqueid':{'type':Sequelize[_0x78ed('0x1')]},'agententerreason':{'type':Sequelize[_0x78ed('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 79c6c42..d25422b 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(_0x220f3f,_0x11c540){var _0x1f170e=function(_0x2c0ec9){while(--_0x2c0ec9){_0x220f3f['push'](_0x220f3f['shift']());}};_0x1f170e(++_0x11c540);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'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(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=_['map'](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x2b1f27){return{'name':_0x2b1f27[_0x0a9e('0x2a')],'type':_0x2b1f27['type'][_0x0a9e('0x2b')]};});_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x14de77,_0x0a9e('0x25'));_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x25fba9[_0x0a9e('0x2e')]);_0x1538a4[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1538a4['model'],_0x1538a4[_0x0a9e('0x2e')]);_0x140511['attributes']=_[_0x0a9e('0x31')](_0x1538a4[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0x140511[_0x0a9e('0x33')]:_0x1538a4[_0x0a9e('0x2c')];if(!_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x35')](_0x0a9e('0x36'))){_0x140511[_0x0a9e('0x1a')]=qs['limit'](_0x25fba9[_0x0a9e('0x2e')]['limit']);_0x140511[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x1b')]);}_0x140511['order']=qs[_0x0a9e('0x37')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x37')]);_0x140511[_0x0a9e('0x38')]=qs['filters'](_['pick'](_0x25fba9[_0x0a9e('0x2e')],_0x1538a4['filters']),_0x14de77);if(_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x39')]){_0x140511[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](_0x140511['where'],{'$or':_[_0x0a9e('0x2d')](_0x14de77,function(_0x3bfce8){if(_0x3bfce8[_0x0a9e('0x3b')]!=='VIRTUAL'){var _0x1dbf74={};_0x1dbf74[_0x3bfce8[_0x0a9e('0x25')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2e')]['filter']+'%'};return _0x1dbf74;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x3c')]);var _0x40d766={'where':_0x140511['where']};return db[_0x0a9e('0x28')][_0x0a9e('0x1c')](_0x40d766)[_0x0a9e('0x22')](function(_0x148f55){_0x11c3b6['count']=_0x148f55;if(_0x25fba9['query'][_0x0a9e('0x3d')]){_0x140511[_0x0a9e('0x3e')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x0a9e('0x3f')](_0x140511);})[_0x0a9e('0x22')](function(_0x1459bb){_0x11c3b6['rows']=_0x1459bb;return _0x11c3b6;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x40')](handleError(_0x14433c,null));};exports[_0x0a9e('0x41')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':![],'where':{'id':_0x43dd5b[_0x0a9e('0x42')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x2c')]=_[_0x0a9e('0x2f')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2881b3[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x43dd5b[_0x0a9e('0x2e')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x2c')],_0x2881b3[_0x0a9e('0x2e')]);_0xeaa5e5[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0xeaa5e5[_0x0a9e('0x33')]=_0xeaa5e5[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0xeaa5e5[_0x0a9e('0x33')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0xeaa5e5[_0x0a9e('0x3e')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x3a')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x3c')]);return db[_0x0a9e('0x28')][_0x0a9e('0x43')](_0xeaa5e5)[_0x0a9e('0x22')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x40')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x28')]['create'](_0x473dc8[_0x0a9e('0x44')],{})[_0x0a9e('0x22')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x40')](handleError(_0x476688,null));};exports[_0x0a9e('0x21')]=function(_0x45c845,_0x37be73){if(_0x45c845[_0x0a9e('0x44')]['id']){delete _0x45c845['body']['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x43')]({'where':{'id':_0x45c845[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x22')](saveUpdates(_0x45c845[_0x0a9e('0x44')],null))[_0x0a9e('0x22')](respondWithResult(_0x37be73,null))[_0x0a9e('0x40')](handleError(_0x37be73,null));};exports[_0x0a9e('0x23')]=function(_0x58a5c2,_0xe401a){return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x58a5c2['params']['id']}})['then'](handleEntityNotFound(_0xe401a,null))[_0x0a9e('0x22')](removeEntity(_0xe401a,null))[_0x0a9e('0x40')](handleError(_0xe401a,null));};exports[_0x0a9e('0x45')]=function(_0x11545a,_0x61bb17){return db[_0x0a9e('0x28')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x61bb17,null))['catch'](handleError(_0x61bb17,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index bc05702..afcfd76 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 _0xd8a7=['VoiceAgentReport','report_agent','destuniqueid','lodash','moment','bluebird','request-promise','rimraf','./voiceAgentReport.attributes','define'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xd8a7,0xdf));var _0x7d8a=function(_0x590e6a,_0x192460){_0x590e6a=_0x590e6a-0x0;var _0x300e4f=_0xd8a7[_0x590e6a];return _0x300e4f;};'use strict';var _=require(_0x7d8a('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x7d8a('0x1'));var BPromise=require(_0x7d8a('0x2'));var rp=require(_0x7d8a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7d8a('0x4'));var config=require('../../config/environment');var attributes=require(_0x7d8a('0x5'));module['exports']=function(_0x27ef8e,_0x530308){return _0x27ef8e[_0x7d8a('0x6')](_0x7d8a('0x7'),attributes,{'tableName':_0x7d8a('0x8'),'paranoid':![],'indexes':[{'fields':['uniqueid',_0x7d8a('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x05bc=['exports','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','util','api','moment','request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes'];(function(_0x25200c,_0x1a1582){var _0x281816=function(_0x33e5c1){while(--_0x33e5c1){_0x25200c['push'](_0x25200c['shift']());}};_0x281816(++_0x1a1582);}(_0x05bc,0xae));var _0xc05b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x05bc[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xc05b('0x0'));var logger=require('../../config/logger')(_0xc05b('0x1'));var moment=require(_0xc05b('0x2'));var BPromise=require('bluebird');var rp=require(_0xc05b('0x3'));var fs=require('fs');var path=require(_0xc05b('0x4'));var rimraf=require(_0xc05b('0x5'));var config=require(_0xc05b('0x6'));var attributes=require(_0xc05b('0x7'));module[_0xc05b('0x8')]=function(_0x2514a1,_0x22c8db){return _0x2514a1[_0xc05b('0x9')](_0xc05b('0xa'),attributes,{'tableName':_0xc05b('0xb'),'paranoid':![],'indexes':[{'fields':[_0xc05b('0xc'),_0xc05b('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 1dc2e18..29a29f7 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 _0x8c4e=['request\x20sent','debug','stringify','error','code','message','info','result','VoiceAgentReport','create','body','options','raw','then','CreateVoiceAgentReport','catch','UpdateVoiceAgentReport','update','where','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','VoiceAgentReport,\x20%s,\x20%s'];(function(_0x5e8906,_0x18f1e7){var _0x3b6622=function(_0x47ca57){while(--_0x47ca57){_0x5e8906['push'](_0x5e8906['shift']());}};_0x3b6622(++_0x18f1e7);}(_0x8c4e,0x1f1));var _0xe8c4=function(_0x5c511d,_0x3c8fca){_0x5c511d=_0x5c511d-0x0;var _0x50aba2=_0x8c4e[_0x5c511d];return _0x50aba2;};'use strict';var _=require(_0xe8c4('0x0'));var util=require(_0xe8c4('0x1'));var moment=require('moment');var BPromise=require(_0xe8c4('0x2'));var rs=require(_0xe8c4('0x3'));var fs=require('fs');var Redis=require(_0xe8c4('0x4'));var db=require(_0xe8c4('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe8c4('0x6'))(_0xe8c4('0x7'));var config=require(_0xe8c4('0x8'));var jayson=require(_0xe8c4('0x9'));var client=jayson['client'][_0xe8c4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5770b8,_0xe01fe,_0x483692){return new BPromise(function(_0x20f323,_0x409c2c){return client[_0xe8c4('0xb')](_0x5770b8,_0x483692)['then'](function(_0x492845){logger['info'](_0xe8c4('0xc'),_0xe01fe,_0xe8c4('0xd'));logger[_0xe8c4('0xe')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0xe01fe,'request\x20sent',JSON[_0xe8c4('0xf')](_0x492845));if(_0x492845[_0xe8c4('0x10')]){if(_0x492845['error'][_0xe8c4('0x11')]===0x1f4){logger['error'](_0xe8c4('0xc'),_0xe01fe,_0x492845[_0xe8c4('0x10')][_0xe8c4('0x12')]);return _0x409c2c(_0x492845[_0xe8c4('0x10')]['message']);}logger[_0xe8c4('0x10')]('VoiceAgentReport,\x20%s,\x20%s',_0xe01fe,_0x492845[_0xe8c4('0x10')][_0xe8c4('0x12')]);return _0x20f323(_0x492845[_0xe8c4('0x10')][_0xe8c4('0x12')]);}else{logger[_0xe8c4('0x13')]('VoiceAgentReport,\x20%s,\x20%s',_0xe01fe,_0xe8c4('0xd'));_0x20f323(_0x492845[_0xe8c4('0x14')]['message']);}})['catch'](function(_0x5f0ec5){logger['error'](_0xe8c4('0xc'),_0xe01fe,_0x5f0ec5);_0x409c2c(_0x5f0ec5);});});}exports['CreateVoiceAgentReport']=function(_0x41a06c){var _0x49c5c4=this;return new Promise(function(_0x20303e,_0x384aa8){return db[_0xe8c4('0x15')][_0xe8c4('0x16')](_0x41a06c[_0xe8c4('0x17')],{'raw':_0x41a06c[_0xe8c4('0x18')]?_0x41a06c[_0xe8c4('0x18')][_0xe8c4('0x19')]===undefined?!![]:![]:!![]})[_0xe8c4('0x1a')](function(_0x57718f){logger[_0xe8c4('0x13')](_0xe8c4('0x1b'),_0x41a06c);logger[_0xe8c4('0xe')](_0xe8c4('0x1b'),_0x41a06c,JSON['stringify'](_0x57718f));_0x20303e(_0x57718f);})[_0xe8c4('0x1c')](function(_0x61dee4){logger[_0xe8c4('0x10')]('CreateVoiceAgentReport',_0x61dee4[_0xe8c4('0x12')],_0x41a06c);_0x384aa8(_0x49c5c4['error'](0x1f4,_0x61dee4[_0xe8c4('0x12')]));});});};exports[_0xe8c4('0x1d')]=function(_0x4ad615){var _0x2e190c=this;return new Promise(function(_0x400671,_0x21c651){return db[_0xe8c4('0x15')][_0xe8c4('0x1e')](_0x4ad615[_0xe8c4('0x17')],{'raw':_0x4ad615['options']?_0x4ad615[_0xe8c4('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ad615[_0xe8c4('0x18')]?_0x4ad615[_0xe8c4('0x18')][_0xe8c4('0x1f')]||null:null,'attributes':_0x4ad615[_0xe8c4('0x18')]?_0x4ad615[_0xe8c4('0x18')][_0xe8c4('0x20')]||null:null,'limit':_0x4ad615[_0xe8c4('0x18')]?_0x4ad615['options'][_0xe8c4('0x21')]||null:null})['then'](function(_0x23cdfe){logger['info'](_0xe8c4('0x1d'),_0x4ad615);logger['debug']('UpdateVoiceAgentReport',_0x4ad615,JSON[_0xe8c4('0xf')](_0x23cdfe));_0x400671(_0x23cdfe);})['catch'](function(_0x1ef062){logger[_0xe8c4('0x10')](_0xe8c4('0x1d'),_0x1ef062[_0xe8c4('0x12')],_0x4ad615);_0x21c651(_0x2e190c[_0xe8c4('0x10')](0x1f4,_0x1ef062[_0xe8c4('0x12')]));});});}; \ No newline at end of file +var _0x5bca=['options','UpdateVoiceAgentReport','update','where','attributes','limit','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body'];(function(_0x1ed21f,_0x51b067){var _0x3316d4=function(_0x23a48c){while(--_0x23a48c){_0x1ed21f['push'](_0x1ed21f['shift']());}};_0x3316d4(++_0x51b067);}(_0x5bca,0xd8));var _0xa5bc=function(_0x253d2b,_0x49a0fb){_0x253d2b=_0x253d2b-0x0;var _0x3ce8bd=_0x5bca[_0x253d2b];return _0x3ce8bd;};'use strict';var _=require(_0xa5bc('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa5bc('0x1'));var rs=require(_0xa5bc('0x2'));var fs=require('fs');var Redis=require(_0xa5bc('0x3'));var db=require(_0xa5bc('0x4'))['db'];var utils=require(_0xa5bc('0x5'));var logger=require(_0xa5bc('0x6'))('rpc');var config=require(_0xa5bc('0x7'));var jayson=require(_0xa5bc('0x8'));var client=jayson['client'][_0xa5bc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xa9a6c4,_0x2ca338,_0x2aff17){return new BPromise(function(_0x429cbf,_0x112e02){return client['request'](_0xa9a6c4,_0x2aff17)[_0xa5bc('0xa')](function(_0x1d1482){logger['info'](_0xa5bc('0xb'),_0x2ca338,_0xa5bc('0xc'));logger[_0xa5bc('0xd')](_0xa5bc('0xe'),_0x2ca338,'request\x20sent',JSON[_0xa5bc('0xf')](_0x1d1482));if(_0x1d1482[_0xa5bc('0x10')]){if(_0x1d1482[_0xa5bc('0x10')]['code']===0x1f4){logger[_0xa5bc('0x10')](_0xa5bc('0xb'),_0x2ca338,_0x1d1482[_0xa5bc('0x10')][_0xa5bc('0x11')]);return _0x112e02(_0x1d1482['error'][_0xa5bc('0x11')]);}logger[_0xa5bc('0x10')](_0xa5bc('0xb'),_0x2ca338,_0x1d1482[_0xa5bc('0x10')][_0xa5bc('0x11')]);return _0x429cbf(_0x1d1482[_0xa5bc('0x10')][_0xa5bc('0x11')]);}else{logger[_0xa5bc('0x12')](_0xa5bc('0xb'),_0x2ca338,_0xa5bc('0xc'));_0x429cbf(_0x1d1482['result'][_0xa5bc('0x11')]);}})[_0xa5bc('0x13')](function(_0x2986dc){logger[_0xa5bc('0x10')](_0xa5bc('0xb'),_0x2ca338,_0x2986dc);_0x112e02(_0x2986dc);});});}exports[_0xa5bc('0x14')]=function(_0x1de44d){var _0x5e990e=this;return new Promise(function(_0x3586ea,_0x1060cd){return db[_0xa5bc('0x15')][_0xa5bc('0x16')](_0x1de44d[_0xa5bc('0x17')],{'raw':_0x1de44d[_0xa5bc('0x18')]?_0x1de44d['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x198ab9){logger[_0xa5bc('0x12')](_0xa5bc('0x14'),_0x1de44d);logger[_0xa5bc('0xd')](_0xa5bc('0x14'),_0x1de44d,JSON[_0xa5bc('0xf')](_0x198ab9));_0x3586ea(_0x198ab9);})['catch'](function(_0x3bf723){logger[_0xa5bc('0x10')]('CreateVoiceAgentReport',_0x3bf723[_0xa5bc('0x11')],_0x1de44d);_0x1060cd(_0x5e990e[_0xa5bc('0x10')](0x1f4,_0x3bf723[_0xa5bc('0x11')]));});});};exports[_0xa5bc('0x19')]=function(_0x4d3bd2){var _0x507e9e=this;return new Promise(function(_0x5f49fb,_0x43e5bb){return db[_0xa5bc('0x15')][_0xa5bc('0x1a')](_0x4d3bd2['body'],{'raw':_0x4d3bd2[_0xa5bc('0x18')]?_0x4d3bd2[_0xa5bc('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4d3bd2[_0xa5bc('0x18')]?_0x4d3bd2[_0xa5bc('0x18')][_0xa5bc('0x1b')]||null:null,'attributes':_0x4d3bd2[_0xa5bc('0x18')]?_0x4d3bd2['options'][_0xa5bc('0x1c')]||null:null,'limit':_0x4d3bd2[_0xa5bc('0x18')]?_0x4d3bd2[_0xa5bc('0x18')][_0xa5bc('0x1d')]||null:null})[_0xa5bc('0xa')](function(_0x1fe49d){logger[_0xa5bc('0x12')](_0xa5bc('0x19'),_0x4d3bd2);logger['debug'](_0xa5bc('0x19'),_0x4d3bd2,JSON['stringify'](_0x1fe49d));_0x5f49fb(_0x1fe49d);})[_0xa5bc('0x13')](function(_0x453206){logger[_0xa5bc('0x10')]('UpdateVoiceAgentReport',_0x453206[_0xa5bc('0x11')],_0x4d3bd2);_0x43e5bb(_0x507e9e[_0xa5bc('0x10')](0x1f4,_0x453206[_0xa5bc('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 730144f..cffae76 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 _0x19ab=['delete','destroy','express','Router','../../components/auth/service','./voiceCallReport.controller','isAuthenticated','/describe','describe','/:id','show','post','update','put','/with-retry/:id','updateWithRetry'];(function(_0x3b7a08,_0x3761fe){var _0x258003=function(_0x1bb5b3){while(--_0x1bb5b3){_0x3b7a08['push'](_0x3b7a08['shift']());}};_0x258003(++_0x3761fe);}(_0x19ab,0x1f2));var _0xb19a=function(_0x4a629d,_0x3eba6d){_0x4a629d=_0x4a629d-0x0;var _0x46b786=_0x19ab[_0x4a629d];return _0x46b786;};'use strict';var express=require(_0xb19a('0x0'));var router=express[_0xb19a('0x1')]();var auth=require(_0xb19a('0x2'));var controller=require(_0xb19a('0x3'));router['get']('/',auth[_0xb19a('0x4')](),controller['index']);router['get'](_0xb19a('0x5'),auth[_0xb19a('0x4')](),controller[_0xb19a('0x6')]);router['get'](_0xb19a('0x7'),auth[_0xb19a('0x4')](),controller[_0xb19a('0x8')]);router[_0xb19a('0x9')]('/',auth[_0xb19a('0x4')](),controller['create']);router['put'](_0xb19a('0x7'),auth['isAuthenticated'](),controller[_0xb19a('0xa')]);router[_0xb19a('0xb')](_0xb19a('0xc'),auth[_0xb19a('0x4')](),controller[_0xb19a('0xd')]);router[_0xb19a('0xe')]('/:id',auth[_0xb19a('0x4')](),controller[_0xb19a('0xf')]);module['exports']=router; \ No newline at end of file +var _0xea41=['Router','get','isAuthenticated','/describe','describe','/:id','show','post','create','update','put','/with-retry/:id','updateWithRetry','delete','destroy','express'];(function(_0x54fb1c,_0x50e6ca){var _0x5478ef=function(_0x3d93cf){while(--_0x3d93cf){_0x54fb1c['push'](_0x54fb1c['shift']());}};_0x5478ef(++_0x50e6ca);}(_0xea41,0xcf));var _0x1ea4=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xea41[_0x2d7f0e];return _0x110b07;};'use strict';var express=require(_0x1ea4('0x0'));var router=express[_0x1ea4('0x1')]();var auth=require('../../components/auth/service');var controller=require('./voiceCallReport.controller');router[_0x1ea4('0x2')]('/',auth[_0x1ea4('0x3')](),controller['index']);router[_0x1ea4('0x2')](_0x1ea4('0x4'),auth['isAuthenticated'](),controller[_0x1ea4('0x5')]);router['get'](_0x1ea4('0x6'),auth['isAuthenticated'](),controller[_0x1ea4('0x7')]);router[_0x1ea4('0x8')]('/',auth['isAuthenticated'](),controller[_0x1ea4('0x9')]);router['put'](_0x1ea4('0x6'),auth[_0x1ea4('0x3')](),controller[_0x1ea4('0xa')]);router[_0x1ea4('0xb')](_0x1ea4('0xc'),auth[_0x1ea4('0x3')](),controller[_0x1ea4('0xd')]);router[_0x1ea4('0xe')](_0x1ea4('0x6'),auth[_0x1ea4('0x3')](),controller[_0x1ea4('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 87662d9..7d385c1 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 _0x88a6=['INTEGER','exports','STRING','inbound','internal','outbound','inbound-fax','DATE'];(function(_0x48ac3c,_0x481f3c){var _0x51958a=function(_0x50985b){while(--_0x50985b){_0x48ac3c['push'](_0x48ac3c['shift']());}};_0x51958a(++_0x481f3c);}(_0x88a6,0x121));var _0x688a=function(_0x648163,_0x241576){_0x648163=_0x648163-0x0;var _0x199d4d=_0x88a6[_0x648163];return _0x199d4d;};'use strict';var Sequelize=require('sequelize');module[_0x688a('0x0')]={'uniqueid':{'type':Sequelize[_0x688a('0x1')]},'type':{'type':Sequelize['ENUM'](_0x688a('0x2'),_0x688a('0x3'),_0x688a('0x4'),_0x688a('0x5'),'outbound-fax','dialer')},'tag':{'type':Sequelize[_0x688a('0x1')]},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0x688a('0x1')]},'destination':{'type':Sequelize[_0x688a('0x1')]},'destinationcontext':{'type':Sequelize[_0x688a('0x1')]},'callerid':{'type':Sequelize[_0x688a('0x1')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0x688a('0x1')]},'lastapplication':{'type':Sequelize[_0x688a('0x1')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x688a('0x6')]},'systemanswertime':{'type':Sequelize[_0x688a('0x6')]},'answertime':{'type':Sequelize[_0x688a('0x6')]},'endtime':{'type':Sequelize[_0x688a('0x6')]},'duration':{'type':Sequelize[_0x688a('0x7')]},'billableseconds':{'type':Sequelize[_0x688a('0x7')]},'mohtime':{'type':Sequelize[_0x688a('0x7')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x688a('0x1')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0x688a('0x1')]},'userSecondDisposition':{'type':Sequelize[_0x688a('0x1')]},'userThirdDisposition':{'type':Sequelize[_0x688a('0x1')]},'note':{'type':Sequelize[_0x688a('0x1')]},'prefix':{'type':Sequelize[_0x688a('0x1')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0x688a('0x1')]}}; \ No newline at end of file +var _0xdc9b=['DATE','INTEGER','sequelize','exports','STRING','inbound','internal','outbound-fax','dialer','TEXT'];(function(_0x4715b7,_0x4dedec){var _0x11d72a=function(_0x393699){while(--_0x393699){_0x4715b7['push'](_0x4715b7['shift']());}};_0x11d72a(++_0x4dedec);}(_0xdc9b,0x70));var _0xbdc9=function(_0x1a9f39,_0x419ff9){_0x1a9f39=_0x1a9f39-0x0;var _0x546996=_0xdc9b[_0x1a9f39];return _0x546996;};'use strict';var Sequelize=require(_0xbdc9('0x0'));module[_0xbdc9('0x1')]={'uniqueid':{'type':Sequelize[_0xbdc9('0x2')]},'type':{'type':Sequelize['ENUM'](_0xbdc9('0x3'),_0xbdc9('0x4'),'outbound','inbound-fax',_0xbdc9('0x5'),_0xbdc9('0x6'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xbdc9('0x2')]},'source':{'type':Sequelize[_0xbdc9('0x2')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0xbdc9('0x2')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xbdc9('0x2')]},'destinationchannel':{'type':Sequelize[_0xbdc9('0x2')]},'lastapplication':{'type':Sequelize[_0xbdc9('0x2')]},'lastdata':{'type':Sequelize[_0xbdc9('0x7')]},'starttime':{'type':Sequelize[_0xbdc9('0x8')]},'systemanswertime':{'type':Sequelize[_0xbdc9('0x8')]},'answertime':{'type':Sequelize[_0xbdc9('0x8')]},'endtime':{'type':Sequelize[_0xbdc9('0x8')]},'duration':{'type':Sequelize[_0xbdc9('0x9')]},'billableseconds':{'type':Sequelize[_0xbdc9('0x9')]},'mohtime':{'type':Sequelize[_0xbdc9('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xbdc9('0x2')]},'amaflags':{'type':Sequelize[_0xbdc9('0x2')]},'userfield':{'type':Sequelize[_0xbdc9('0x2')]},'userDisposition':{'type':Sequelize[_0xbdc9('0x2')]},'userSecondDisposition':{'type':Sequelize[_0xbdc9('0x2')]},'userThirdDisposition':{'type':Sequelize[_0xbdc9('0x2')]},'note':{'type':Sequelize[_0xbdc9('0x2')]},'prefix':{'type':Sequelize[_0xbdc9('0x2')]},'routeid':{'type':Sequelize[_0xbdc9('0x9')]},'sipcallid':{'type':Sequelize[_0xbdc9('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index d2ce5dc..7509d53 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 _0x2ace=['name','send','index','map','VoiceCallReport','rawAttributes','key','query','keys','filters','intersection','model','fields','attributes','nolimit','order','sort','where','pick','type','VIRTUAL','options','includeAll','include','fullname','alias','User','findAll','catch','show','length','merge','find','create','body','params','describe','user','uniqueid','updateWithRetry','../../components/parsers/qs','../../config/logger','api','promise-retry','status','json','offset','undefined','limit','count','set','Content-Range','update','then','end','sendStatus','stack'];(function(_0x54aea3,_0xae7d81){var _0x21ae46=function(_0xe16dbc){while(--_0xe16dbc){_0x54aea3['push'](_0x54aea3['shift']());}};_0x21ae46(++_0xae7d81);}(_0x2ace,0x17e));var _0xe2ac=function(_0x5538d5,_0x190032){_0x5538d5=_0x5538d5-0x0;var _0x323b1a=_0x2ace[_0x5538d5];return _0x323b1a;};'use strict';var _=require('lodash');var qs=require(_0xe2ac('0x0'));var logger=require(_0xe2ac('0x1'))(_0xe2ac('0x2'));var db=require('../../mysqldb')['db'];const promiseRetry=require(_0xe2ac('0x3'));function respondWithResult(_0x22580b,_0x47c3a2){_0x47c3a2=_0x47c3a2||0xc8;return function(_0x171092){if(_0x171092){return _0x22580b[_0xe2ac('0x4')](_0x47c3a2)[_0xe2ac('0x5')](_0x171092);}};}function respondWithFilteredResult(_0x2d2241,_0x386b18){return function(_0x46e9f3){if(_0x46e9f3){var _0x2f1f8c=typeof _0x386b18[_0xe2ac('0x6')]===_0xe2ac('0x7')&&typeof _0x386b18[_0xe2ac('0x8')]===_0xe2ac('0x7');var _0x3ae734=_0x46e9f3[_0xe2ac('0x9')];var _0x4fb111=_0x2f1f8c?0x0:_0x386b18['offset'];var _0x3c2572=_0x2f1f8c?_0x46e9f3['count']:_0x386b18[_0xe2ac('0x6')]+_0x386b18[_0xe2ac('0x8')];var _0x540a1e;if(_0x3c2572>=_0x3ae734){_0x3c2572=_0x3ae734;_0x540a1e=0xc8;}else{_0x540a1e=0xce;}_0x2d2241[_0xe2ac('0x4')](_0x540a1e);return _0x2d2241[_0xe2ac('0xa')](_0xe2ac('0xb'),_0x4fb111+'-'+_0x3c2572+'/'+_0x3ae734)['json'](_0x46e9f3);}return null;};}function saveUpdates(_0x37347b){return function(_0x41e1b0){if(_0x41e1b0){return _0x41e1b0[_0xe2ac('0xc')](_0x37347b)[_0xe2ac('0xd')](function(_0x346dc4){return _0x346dc4;});}return null;};}function removeEntity(_0x5ee9ca){return function(_0x76dab9){if(_0x76dab9){return _0x76dab9['destroy']()[_0xe2ac('0xd')](function(){_0x5ee9ca[_0xe2ac('0x4')](0xcc)[_0xe2ac('0xe')]();});}};}function handleEntityNotFound(_0x290584){return function(_0x3bec11){if(!_0x3bec11){_0x290584[_0xe2ac('0xf')](0x194);}return _0x3bec11;};}function handleError(_0x445bca,_0x2f3caf){_0x2f3caf=_0x2f3caf||0x1f4;return function(_0x170693){logger['error'](_0x170693[_0xe2ac('0x10')]);if(_0x170693[_0xe2ac('0x11')]){delete _0x170693['name'];}_0x445bca[_0xe2ac('0x4')](_0x2f3caf)[_0xe2ac('0x12')](_0x170693);};}exports[_0xe2ac('0x13')]=function(_0x2f5d32,_0x5000ba){var _0x5095dd={},_0x5bafe4={},_0x19784b={'count':0x0,'rows':[]};var _0x190983=_[_0xe2ac('0x14')](db[_0xe2ac('0x15')][_0xe2ac('0x16')],function(_0x279a90){return{'name':_0x279a90['fieldName'],'type':_0x279a90['type'][_0xe2ac('0x17')]};});_0x5bafe4['model']=_[_0xe2ac('0x14')](_0x190983,_0xe2ac('0x11'));_0x5bafe4[_0xe2ac('0x18')]=_[_0xe2ac('0x19')](_0x2f5d32[_0xe2ac('0x18')]);_0x5bafe4[_0xe2ac('0x1a')]=_[_0xe2ac('0x1b')](_0x5bafe4[_0xe2ac('0x1c')],_0x5bafe4[_0xe2ac('0x18')]);_0x5095dd['attributes']=_['intersection'](_0x5bafe4[_0xe2ac('0x1c')],qs['fields'](_0x2f5d32[_0xe2ac('0x18')][_0xe2ac('0x1d')]));_0x5095dd['attributes']=_0x5095dd[_0xe2ac('0x1e')]['length']?_0x5095dd[_0xe2ac('0x1e')]:_0x5bafe4[_0xe2ac('0x1c')];if(!_0x2f5d32[_0xe2ac('0x18')]['hasOwnProperty'](_0xe2ac('0x1f'))){_0x5095dd[_0xe2ac('0x8')]=qs['limit'](_0x2f5d32['query'][_0xe2ac('0x8')]);_0x5095dd[_0xe2ac('0x6')]=qs[_0xe2ac('0x6')](_0x2f5d32[_0xe2ac('0x18')]['offset']);}_0x5095dd[_0xe2ac('0x20')]=qs['sort'](_0x2f5d32[_0xe2ac('0x18')][_0xe2ac('0x21')]);_0x5095dd[_0xe2ac('0x22')]=qs[_0xe2ac('0x1a')](_[_0xe2ac('0x23')](_0x2f5d32[_0xe2ac('0x18')],_0x5bafe4['filters']),_0x190983);if(_0x2f5d32[_0xe2ac('0x18')]['filter']){_0x5095dd['where']=_['merge'](_0x5095dd[_0xe2ac('0x22')],{'$or':_[_0xe2ac('0x14')](_0x190983,function(_0x5d25d3){if(_0x5d25d3[_0xe2ac('0x24')]!==_0xe2ac('0x25')){var _0x4e7286={};_0x4e7286[_0x5d25d3[_0xe2ac('0x11')]]={'$like':'%'+_0x2f5d32[_0xe2ac('0x18')]['filter']+'%'};return _0x4e7286;}})});}_0x5095dd=_['merge']({},_0x5095dd,_0x2f5d32[_0xe2ac('0x26')]);var _0x5d34a2={'where':_0x5095dd[_0xe2ac('0x22')]};return db[_0xe2ac('0x15')][_0xe2ac('0x9')](_0x5d34a2)[_0xe2ac('0xd')](function(_0x1f68a6){_0x19784b[_0xe2ac('0x9')]=_0x1f68a6;if(_0x2f5d32[_0xe2ac('0x18')][_0xe2ac('0x27')]){_0x5095dd[_0xe2ac('0x28')]=[{'attributes':['id','name',_0xe2ac('0x29'),_0xe2ac('0x2a')],'model':db[_0xe2ac('0x2b')],'as':_0xe2ac('0x2b')}];}return db[_0xe2ac('0x15')][_0xe2ac('0x2c')](_0x5095dd);})['then'](function(_0x43732d){_0x19784b['rows']=_0x43732d;return _0x19784b;})[_0xe2ac('0xd')](respondWithFilteredResult(_0x5000ba,_0x5095dd))[_0xe2ac('0x2d')](handleError(_0x5000ba,null));};exports[_0xe2ac('0x2e')]=function(_0x15f6d8,_0x5a2025){var _0x630034={'raw':!![],'where':{'id':_0x15f6d8['params']['id']}},_0x59a4d6={};_0x59a4d6['model']=_['keys'](db[_0xe2ac('0x15')][_0xe2ac('0x16')]);_0x59a4d6['query']=_[_0xe2ac('0x19')](_0x15f6d8[_0xe2ac('0x18')]);_0x59a4d6[_0xe2ac('0x1a')]=_[_0xe2ac('0x1b')](_0x59a4d6[_0xe2ac('0x1c')],_0x59a4d6[_0xe2ac('0x18')]);_0x630034[_0xe2ac('0x1e')]=_['intersection'](_0x59a4d6[_0xe2ac('0x1c')],qs['fields'](_0x15f6d8['query'][_0xe2ac('0x1d')]));_0x630034[_0xe2ac('0x1e')]=_0x630034[_0xe2ac('0x1e')][_0xe2ac('0x2f')]?_0x630034[_0xe2ac('0x1e')]:_0x59a4d6[_0xe2ac('0x1c')];if(_0x15f6d8[_0xe2ac('0x18')][_0xe2ac('0x27')]){_0x630034['include']=[{'all':!![]}];}_0x630034=_[_0xe2ac('0x30')]({},_0x630034,_0x15f6d8[_0xe2ac('0x26')]);return db[_0xe2ac('0x15')][_0xe2ac('0x31')](_0x630034)[_0xe2ac('0xd')](handleEntityNotFound(_0x5a2025,null))['then'](respondWithResult(_0x5a2025,null))[_0xe2ac('0x2d')](handleError(_0x5a2025,null));};exports[_0xe2ac('0x32')]=function(_0x483c4f,_0x510c38){return db[_0xe2ac('0x15')][_0xe2ac('0x32')](_0x483c4f[_0xe2ac('0x33')],{})[_0xe2ac('0xd')](respondWithResult(_0x510c38,0xc9))[_0xe2ac('0x2d')](handleError(_0x510c38,null));};exports['destroy']=function(_0x2e92fc,_0x543f98){return db[_0xe2ac('0x15')][_0xe2ac('0x31')]({'where':{'id':_0x2e92fc[_0xe2ac('0x34')]['id']}})['then'](handleEntityNotFound(_0x543f98,null))[_0xe2ac('0xd')](removeEntity(_0x543f98,null))[_0xe2ac('0x2d')](handleError(_0x543f98,null));};exports[_0xe2ac('0x35')]=function(_0xbb443a,_0xfef752){return db[_0xe2ac('0x15')][_0xe2ac('0x35')]()[_0xe2ac('0xd')](respondWithResult(_0xfef752,null))['catch'](handleError(_0xfef752,null));};function findForUpdate(_0x1aebb0){return db['VoiceCallReport']['find']({'where':{'uniqueid':_0x1aebb0[_0xe2ac('0x34')]['id'],'UserId':{'$or':[null,_0x1aebb0[_0xe2ac('0x36')]['id']]}}});}exports[_0xe2ac('0xc')]=function(_0xb9f59,_0x43b7d7){if(_0xb9f59[_0xe2ac('0x33')][_0xe2ac('0x37')]){delete _0xb9f59[_0xe2ac('0x33')]['uniqueid'];}return findForUpdate(_0xb9f59)[_0xe2ac('0xd')](handleEntityNotFound(_0x43b7d7,null))['then'](saveUpdates(_0xb9f59[_0xe2ac('0x33')],null))[_0xe2ac('0xd')](respondWithResult(_0x43b7d7,null))[_0xe2ac('0x2d')](handleError(_0x43b7d7,null));};exports[_0xe2ac('0x38')]=function(_0x3e3ac9,_0x10b973,_0x56a26e){if(_0x3e3ac9['body']['uniqueid']){delete _0x3e3ac9[_0xe2ac('0x33')][_0xe2ac('0x37')];}promiseRetry(function(_0x32a422){return findForUpdate(_0x3e3ac9)[_0xe2ac('0xd')](function(_0x1ac14b){if(_0x1ac14b!==null){return _0x1ac14b;}else{_0x32a422(new Error('No\x20such\x20report'));}});},{'retries':0x4,'minTimeout':0xfa})['then'](function(_0x75d51e){if(!_0x75d51e){return new Promise(function(_0x49cfbe){_0x49cfbe(handleEntityNotFound(_0x10b973)());});}else{return _0x75d51e['update'](_0x3e3ac9[_0xe2ac('0x33')])[_0xe2ac('0xd')](function(_0x2ad3ff){return respondWithResult(_0x10b973)(_0x2ad3ff);});}},function(){handleEntityNotFound(_0x10b973)();});}; \ No newline at end of file +var _0x0120=['count','set','Content-Range','update','destroy','end','sendStatus','stack','name','send','index','map','VoiceCallReport','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','then','include','fullname','alias','User','catch','show','includeAll','create','find','describe','params','user','body','uniqueid','updateWithRetry','No\x20such\x20report','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','promise-retry','status','json','offset','undefined','limit'];(function(_0x4f15c6,_0x3eb56a){var _0x5cd110=function(_0x8bd15e){while(--_0x8bd15e){_0x4f15c6['push'](_0x4f15c6['shift']());}};_0x5cd110(++_0x3eb56a);}(_0x0120,0x6f));var _0x0012=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x0120[_0x4243a3];return _0x1b2a33;};'use strict';var _=require(_0x0012('0x0'));var qs=require(_0x0012('0x1'));var logger=require(_0x0012('0x2'))(_0x0012('0x3'));var db=require(_0x0012('0x4'))['db'];const promiseRetry=require(_0x0012('0x5'));function respondWithResult(_0x214372,_0xeb175){_0xeb175=_0xeb175||0xc8;return function(_0x357f77){if(_0x357f77){return _0x214372[_0x0012('0x6')](_0xeb175)[_0x0012('0x7')](_0x357f77);}};}function respondWithFilteredResult(_0x3fcfbc,_0x4eaa5b){return function(_0x4b396c){if(_0x4b396c){var _0x59980a=typeof _0x4eaa5b[_0x0012('0x8')]===_0x0012('0x9')&&typeof _0x4eaa5b[_0x0012('0xa')]===_0x0012('0x9');var _0x33c82f=_0x4b396c['count'];var _0x14991f=_0x59980a?0x0:_0x4eaa5b[_0x0012('0x8')];var _0x1dc1b2=_0x59980a?_0x4b396c[_0x0012('0xb')]:_0x4eaa5b['offset']+_0x4eaa5b[_0x0012('0xa')];var _0x4b2068;if(_0x1dc1b2>=_0x33c82f){_0x1dc1b2=_0x33c82f;_0x4b2068=0xc8;}else{_0x4b2068=0xce;}_0x3fcfbc[_0x0012('0x6')](_0x4b2068);return _0x3fcfbc[_0x0012('0xc')](_0x0012('0xd'),_0x14991f+'-'+_0x1dc1b2+'/'+_0x33c82f)[_0x0012('0x7')](_0x4b396c);}return null;};}function saveUpdates(_0x2451b5){return function(_0x4d3e7a){if(_0x4d3e7a){return _0x4d3e7a[_0x0012('0xe')](_0x2451b5)['then'](function(_0x5bbd04){return _0x5bbd04;});}return null;};}function removeEntity(_0x5d845a){return function(_0x5563fc){if(_0x5563fc){return _0x5563fc[_0x0012('0xf')]()['then'](function(){_0x5d845a[_0x0012('0x6')](0xcc)[_0x0012('0x10')]();});}};}function handleEntityNotFound(_0x47a6ef){return function(_0x24f4ed){if(!_0x24f4ed){_0x47a6ef[_0x0012('0x11')](0x194);}return _0x24f4ed;};}function handleError(_0x348810,_0x3b8dfc){_0x3b8dfc=_0x3b8dfc||0x1f4;return function(_0x522e9b){logger['error'](_0x522e9b[_0x0012('0x12')]);if(_0x522e9b[_0x0012('0x13')]){delete _0x522e9b[_0x0012('0x13')];}_0x348810[_0x0012('0x6')](_0x3b8dfc)[_0x0012('0x14')](_0x522e9b);};}exports[_0x0012('0x15')]=function(_0x1e78ee,_0x2eb3fa){var _0x5b236f={},_0x226968={},_0x56b0e1={'count':0x0,'rows':[]};var _0x5797dd=_[_0x0012('0x16')](db[_0x0012('0x17')][_0x0012('0x18')],function(_0x2c837e){return{'name':_0x2c837e['fieldName'],'type':_0x2c837e['type'][_0x0012('0x19')]};});_0x226968[_0x0012('0x1a')]=_[_0x0012('0x16')](_0x5797dd,_0x0012('0x13'));_0x226968[_0x0012('0x1b')]=_[_0x0012('0x1c')](_0x1e78ee[_0x0012('0x1b')]);_0x226968[_0x0012('0x1d')]=_['intersection'](_0x226968[_0x0012('0x1a')],_0x226968[_0x0012('0x1b')]);_0x5b236f['attributes']=_[_0x0012('0x1e')](_0x226968[_0x0012('0x1a')],qs[_0x0012('0x1f')](_0x1e78ee[_0x0012('0x1b')][_0x0012('0x1f')]));_0x5b236f['attributes']=_0x5b236f[_0x0012('0x20')][_0x0012('0x21')]?_0x5b236f[_0x0012('0x20')]:_0x226968[_0x0012('0x1a')];if(!_0x1e78ee[_0x0012('0x1b')][_0x0012('0x22')](_0x0012('0x23'))){_0x5b236f[_0x0012('0xa')]=qs[_0x0012('0xa')](_0x1e78ee[_0x0012('0x1b')][_0x0012('0xa')]);_0x5b236f[_0x0012('0x8')]=qs[_0x0012('0x8')](_0x1e78ee[_0x0012('0x1b')][_0x0012('0x8')]);}_0x5b236f[_0x0012('0x24')]=qs[_0x0012('0x25')](_0x1e78ee[_0x0012('0x1b')][_0x0012('0x25')]);_0x5b236f[_0x0012('0x26')]=qs[_0x0012('0x1d')](_['pick'](_0x1e78ee[_0x0012('0x1b')],_0x226968[_0x0012('0x1d')]),_0x5797dd);if(_0x1e78ee['query'][_0x0012('0x27')]){_0x5b236f[_0x0012('0x26')]=_[_0x0012('0x28')](_0x5b236f[_0x0012('0x26')],{'$or':_[_0x0012('0x16')](_0x5797dd,function(_0x47d73b){if(_0x47d73b[_0x0012('0x29')]!==_0x0012('0x2a')){var _0x2e7487={};_0x2e7487[_0x47d73b['name']]={'$like':'%'+_0x1e78ee[_0x0012('0x1b')][_0x0012('0x27')]+'%'};return _0x2e7487;}})});}_0x5b236f=_[_0x0012('0x28')]({},_0x5b236f,_0x1e78ee[_0x0012('0x2b')]);var _0x46b600={'where':_0x5b236f[_0x0012('0x26')]};return db['VoiceCallReport'][_0x0012('0xb')](_0x46b600)[_0x0012('0x2c')](function(_0x4648ec){_0x56b0e1[_0x0012('0xb')]=_0x4648ec;if(_0x1e78ee['query']['includeAll']){_0x5b236f[_0x0012('0x2d')]=[{'attributes':['id',_0x0012('0x13'),_0x0012('0x2e'),_0x0012('0x2f')],'model':db[_0x0012('0x30')],'as':_0x0012('0x30')}];}return db[_0x0012('0x17')]['findAll'](_0x5b236f);})[_0x0012('0x2c')](function(_0xfdb3be){_0x56b0e1['rows']=_0xfdb3be;return _0x56b0e1;})[_0x0012('0x2c')](respondWithFilteredResult(_0x2eb3fa,_0x5b236f))[_0x0012('0x31')](handleError(_0x2eb3fa,null));};exports[_0x0012('0x32')]=function(_0x4786e8,_0x126381){var _0x1d078a={'raw':!![],'where':{'id':_0x4786e8['params']['id']}},_0x1b3e76={};_0x1b3e76[_0x0012('0x1a')]=_['keys'](db[_0x0012('0x17')]['rawAttributes']);_0x1b3e76['query']=_[_0x0012('0x1c')](_0x4786e8[_0x0012('0x1b')]);_0x1b3e76[_0x0012('0x1d')]=_['intersection'](_0x1b3e76[_0x0012('0x1a')],_0x1b3e76[_0x0012('0x1b')]);_0x1d078a[_0x0012('0x20')]=_[_0x0012('0x1e')](_0x1b3e76[_0x0012('0x1a')],qs[_0x0012('0x1f')](_0x4786e8[_0x0012('0x1b')][_0x0012('0x1f')]));_0x1d078a['attributes']=_0x1d078a[_0x0012('0x20')][_0x0012('0x21')]?_0x1d078a[_0x0012('0x20')]:_0x1b3e76[_0x0012('0x1a')];if(_0x4786e8[_0x0012('0x1b')][_0x0012('0x33')]){_0x1d078a[_0x0012('0x2d')]=[{'all':!![]}];}_0x1d078a=_['merge']({},_0x1d078a,_0x4786e8['options']);return db[_0x0012('0x17')]['find'](_0x1d078a)[_0x0012('0x2c')](handleEntityNotFound(_0x126381,null))[_0x0012('0x2c')](respondWithResult(_0x126381,null))[_0x0012('0x31')](handleError(_0x126381,null));};exports[_0x0012('0x34')]=function(_0x32c1f9,_0x5348a2){return db[_0x0012('0x17')][_0x0012('0x34')](_0x32c1f9['body'],{})[_0x0012('0x2c')](respondWithResult(_0x5348a2,0xc9))[_0x0012('0x31')](handleError(_0x5348a2,null));};exports[_0x0012('0xf')]=function(_0x207b61,_0x5259c2){return db['VoiceCallReport'][_0x0012('0x35')]({'where':{'id':_0x207b61['params']['id']}})[_0x0012('0x2c')](handleEntityNotFound(_0x5259c2,null))['then'](removeEntity(_0x5259c2,null))[_0x0012('0x31')](handleError(_0x5259c2,null));};exports[_0x0012('0x36')]=function(_0x3daefd,_0x364f8e){return db['VoiceCallReport'][_0x0012('0x36')]()['then'](respondWithResult(_0x364f8e,null))[_0x0012('0x31')](handleError(_0x364f8e,null));};function findForUpdate(_0x332f64){return db[_0x0012('0x17')][_0x0012('0x35')]({'where':{'uniqueid':_0x332f64[_0x0012('0x37')]['id'],'UserId':{'$or':[null,_0x332f64[_0x0012('0x38')]['id']]}}});}exports[_0x0012('0xe')]=function(_0x5b6c93,_0xf9318d){if(_0x5b6c93[_0x0012('0x39')][_0x0012('0x3a')]){delete _0x5b6c93[_0x0012('0x39')][_0x0012('0x3a')];}return findForUpdate(_0x5b6c93)[_0x0012('0x2c')](handleEntityNotFound(_0xf9318d,null))['then'](saveUpdates(_0x5b6c93['body'],null))['then'](respondWithResult(_0xf9318d,null))['catch'](handleError(_0xf9318d,null));};exports[_0x0012('0x3b')]=function(_0x4033ca,_0xf0ba10,_0x3b9c1d){if(_0x4033ca[_0x0012('0x39')]['uniqueid']){delete _0x4033ca[_0x0012('0x39')][_0x0012('0x3a')];}promiseRetry(function(_0x7d04c7){return findForUpdate(_0x4033ca)[_0x0012('0x2c')](function(_0x42beb1){if(_0x42beb1!==null){return _0x42beb1;}else{_0x7d04c7(new Error(_0x0012('0x3c')));}});},{'retries':0x4,'minTimeout':0xfa})[_0x0012('0x2c')](function(_0x26fb2b){if(!_0x26fb2b){return new Promise(function(_0x2177a6){_0x2177a6(handleEntityNotFound(_0xf0ba10)());});}else{return _0x26fb2b[_0x0012('0xe')](_0x4033ca[_0x0012('0x39')])['then'](function(_0x2389cd){return respondWithResult(_0xf0ba10)(_0x2389cd);});}},function(){handleEntityNotFound(_0xf0ba10)();});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 4a7dfd3..e34ca80 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 _0xefd9=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VoiceCallReport','lodash','../../config/logger','api'];(function(_0x4af859,_0x73b4ed){var _0x85d557=function(_0xb86211){while(--_0xb86211){_0x4af859['push'](_0x4af859['shift']());}};_0x85d557(++_0x73b4ed);}(_0xefd9,0x1dd));var _0x9efd=function(_0x9e35b6,_0x751f78){_0x9e35b6=_0x9e35b6-0x0;var _0x1b4bc6=_0xefd9[_0x9e35b6];return _0x1b4bc6;};'use strict';var _=require(_0x9efd('0x0'));var util=require('util');var logger=require(_0x9efd('0x1'))(_0x9efd('0x2'));var moment=require(_0x9efd('0x3'));var BPromise=require(_0x9efd('0x4'));var rp=require(_0x9efd('0x5'));var fs=require('fs');var path=require(_0x9efd('0x6'));var rimraf=require(_0x9efd('0x7'));var config=require(_0x9efd('0x8'));var attributes=require('./voiceCallReport.attributes');module[_0x9efd('0x9')]=function(_0x1900a6,_0x2ce4fb){return _0x1900a6[_0x9efd('0xa')](_0x9efd('0xb'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xa7eb=['uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes','VoiceCallReport','report_call'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0xa7eb,0x1d5));var _0xba7e=function(_0x1fe275,_0x5b9103){_0x1fe275=_0x1fe275-0x0;var _0x43d865=_0xa7eb[_0x1fe275];return _0x43d865;};'use strict';var _=require(_0xba7e('0x0'));var util=require('util');var logger=require(_0xba7e('0x1'))(_0xba7e('0x2'));var moment=require(_0xba7e('0x3'));var BPromise=require(_0xba7e('0x4'));var rp=require(_0xba7e('0x5'));var fs=require('fs');var path=require(_0xba7e('0x6'));var rimraf=require(_0xba7e('0x7'));var config=require(_0xba7e('0x8'));var attributes=require(_0xba7e('0x9'));module['exports']=function(_0x3946f2,_0x1c1c6d){return _0x3946f2['define'](_0xba7e('0xa'),attributes,{'tableName':_0xba7e('0xb'),'paranoid':![],'indexes':[{'fields':[_0xba7e('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 83f9085..4f77d8b 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 _0x45e5=['VoiceCallReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','findAll','options','raw','where','attributes','include','map','model','GetVoiceCallReport','stringify','VoiceCallReport','create','body','CreateVoiceCallReport','UpdateVoiceCallReport','update','limit','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','client','http','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5a69ee,_0x2722a7){var _0x2dd358=function(_0x41d819){while(--_0x41d819){_0x5a69ee['push'](_0x5a69ee['shift']());}};_0x2dd358(++_0x2722a7);}(_0x45e5,0x13f));var _0x545e=function(_0x1e243b,_0x272660){_0x1e243b=_0x1e243b-0x0;var _0xffe8af=_0x45e5[_0x1e243b];return _0xffe8af;};'use strict';var _=require(_0x545e('0x0'));var util=require(_0x545e('0x1'));var moment=require('moment');var BPromise=require(_0x545e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x545e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x545e('0x4'));var logger=require(_0x545e('0x5'))(_0x545e('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x545e('0x7')][_0x545e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1f60ce,_0x3ac7d5,_0x56f32e){return new BPromise(function(_0x1220c5,_0x340ce3){return client['request'](_0x1f60ce,_0x56f32e)[_0x545e('0x9')](function(_0x452027){logger[_0x545e('0xa')](_0x545e('0xb'),_0x3ac7d5,_0x545e('0xc'));logger[_0x545e('0xd')](_0x545e('0xe'),_0x3ac7d5,_0x545e('0xc'),JSON['stringify'](_0x452027));if(_0x452027['error']){if(_0x452027[_0x545e('0xf')][_0x545e('0x10')]===0x1f4){logger[_0x545e('0xf')](_0x545e('0xb'),_0x3ac7d5,_0x452027[_0x545e('0xf')][_0x545e('0x11')]);return _0x340ce3(_0x452027[_0x545e('0xf')][_0x545e('0x11')]);}logger[_0x545e('0xf')](_0x545e('0xb'),_0x3ac7d5,_0x452027['error'][_0x545e('0x11')]);return _0x1220c5(_0x452027[_0x545e('0xf')][_0x545e('0x11')]);}else{logger[_0x545e('0xa')](_0x545e('0xb'),_0x3ac7d5,_0x545e('0xc'));_0x1220c5(_0x452027[_0x545e('0x12')][_0x545e('0x11')]);}})[_0x545e('0x13')](function(_0x26bb2d){logger[_0x545e('0xf')](_0x545e('0xb'),_0x3ac7d5,_0x26bb2d);_0x340ce3(_0x26bb2d);});});}exports['GetVoiceCallReport']=function(_0x3f03a3){var _0x26a2f6=this;return new Promise(function(_0x1af93e,_0x37b74a){return db['VoiceCallReport'][_0x545e('0x14')]({'raw':_0x3f03a3[_0x545e('0x15')]?_0x3f03a3[_0x545e('0x15')][_0x545e('0x16')]===undefined?!![]:![]:!![],'where':_0x3f03a3[_0x545e('0x15')]?_0x3f03a3[_0x545e('0x15')][_0x545e('0x17')]||null:null,'attributes':_0x3f03a3[_0x545e('0x15')]?_0x3f03a3[_0x545e('0x15')][_0x545e('0x18')]||null:null,'limit':_0x3f03a3['options']?_0x3f03a3[_0x545e('0x15')]['limit']||null:null,'include':_0x3f03a3[_0x545e('0x15')]?_0x3f03a3[_0x545e('0x15')][_0x545e('0x19')]?_[_0x545e('0x1a')](_0x3f03a3[_0x545e('0x15')][_0x545e('0x19')],function(_0x58f486){return{'model':db[_0x58f486[_0x545e('0x1b')]],'as':_0x58f486['as'],'attributes':_0x58f486[_0x545e('0x18')],'include':_0x58f486[_0x545e('0x19')]?_['map'](_0x58f486['include'],function(_0x15e5bf){return{'model':db[_0x15e5bf[_0x545e('0x1b')]],'as':_0x15e5bf['as'],'attributes':_0x15e5bf[_0x545e('0x18')],'include':_0x15e5bf[_0x545e('0x19')]?_['map'](_0x15e5bf['include'],function(_0x4e5d9d){return{'model':db[_0x4e5d9d[_0x545e('0x1b')]],'as':_0x4e5d9d['as'],'attributes':_0x4e5d9d['attributes']};}):[]};}):[]};}):[]:[]})[_0x545e('0x9')](function(_0x17e482){logger[_0x545e('0xa')](_0x545e('0x1c'),_0x3f03a3);logger[_0x545e('0xd')]('GetVoiceCallReport',_0x3f03a3,JSON[_0x545e('0x1d')](_0x17e482));_0x1af93e(_0x17e482);})[_0x545e('0x13')](function(_0x33dca3){logger[_0x545e('0xf')](_0x545e('0x1c'),_0x33dca3[_0x545e('0x11')],_0x3f03a3);_0x37b74a(_0x26a2f6['error'](0x1f4,_0x33dca3[_0x545e('0x11')]));});});};exports['CreateVoiceCallReport']=function(_0x26b7cf){var _0x4a698a=this;return new Promise(function(_0x56e09c,_0x2576c5){return db[_0x545e('0x1e')][_0x545e('0x1f')](_0x26b7cf[_0x545e('0x20')],{'raw':_0x26b7cf[_0x545e('0x15')]?_0x26b7cf['options'][_0x545e('0x16')]===undefined?!![]:![]:!![]})[_0x545e('0x9')](function(_0xdff3a){logger[_0x545e('0xa')]('CreateVoiceCallReport',_0x26b7cf);logger[_0x545e('0xd')](_0x545e('0x21'),_0x26b7cf,JSON[_0x545e('0x1d')](_0xdff3a));_0x56e09c(_0xdff3a);})[_0x545e('0x13')](function(_0xfdcb43){logger['error'](_0x545e('0x21'),_0xfdcb43[_0x545e('0x11')],_0x26b7cf);_0x2576c5(_0x4a698a[_0x545e('0xf')](0x1f4,_0xfdcb43[_0x545e('0x11')]));});});};exports[_0x545e('0x22')]=function(_0x276f11){var _0x449dd6=this;return new Promise(function(_0x32d5db,_0x582851){return db[_0x545e('0x1e')][_0x545e('0x23')](_0x276f11[_0x545e('0x20')],{'raw':_0x276f11['options']?_0x276f11[_0x545e('0x15')][_0x545e('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x276f11[_0x545e('0x15')]?_0x276f11[_0x545e('0x15')][_0x545e('0x17')]||null:null,'attributes':_0x276f11[_0x545e('0x15')]?_0x276f11[_0x545e('0x15')][_0x545e('0x18')]||null:null,'limit':_0x276f11[_0x545e('0x15')]?_0x276f11[_0x545e('0x15')][_0x545e('0x24')]||null:null})['then'](function(_0x51c0a3){logger['info'](_0x545e('0x22'),_0x276f11);logger[_0x545e('0xd')]('UpdateVoiceCallReport',_0x276f11,JSON['stringify'](_0x51c0a3));_0x32d5db(_0x51c0a3);})[_0x545e('0x13')](function(_0x4a95c8){logger[_0x545e('0xf')]('UpdateVoiceCallReport',_0x4a95c8[_0x545e('0x11')],_0x276f11);_0x582851(_0x449dd6[_0x545e('0xf')](0x1f4,_0x4a95c8[_0x545e('0x11')]));});});}; \ No newline at end of file +var _0x8aa0=['VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceCallReport,\x20%s,\x20%s','message','GetVoiceCallReport','VoiceCallReport','findAll','options','where','attributes','include','map','model','debug','CreateVoiceCallReport','body','catch','UpdateVoiceCallReport','update','raw','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x8aa0,0x1d2));var _0x08aa=function(_0x2e5c60,_0x145aa0){_0x2e5c60=_0x2e5c60-0x0;var _0x50eeb9=_0x8aa0[_0x2e5c60];return _0x50eeb9;};'use strict';var _=require('lodash');var util=require(_0x08aa('0x0'));var moment=require(_0x08aa('0x1'));var BPromise=require(_0x08aa('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x08aa('0x3'));var db=require(_0x08aa('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x08aa('0x5'))(_0x08aa('0x6'));var config=require(_0x08aa('0x7'));var jayson=require(_0x08aa('0x8'));var client=jayson[_0x08aa('0x9')][_0x08aa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x441113,_0x50a4a6,_0x388efc){return new BPromise(function(_0x4b14f1,_0x262b73){return client[_0x08aa('0xb')](_0x441113,_0x388efc)[_0x08aa('0xc')](function(_0x2db55b){logger[_0x08aa('0xd')]('VoiceCallReport,\x20%s,\x20%s',_0x50a4a6,_0x08aa('0xe'));logger['debug'](_0x08aa('0xf'),_0x50a4a6,'request\x20sent',JSON[_0x08aa('0x10')](_0x2db55b));if(_0x2db55b[_0x08aa('0x11')]){if(_0x2db55b[_0x08aa('0x11')][_0x08aa('0x12')]===0x1f4){logger[_0x08aa('0x11')](_0x08aa('0x13'),_0x50a4a6,_0x2db55b[_0x08aa('0x11')][_0x08aa('0x14')]);return _0x262b73(_0x2db55b[_0x08aa('0x11')][_0x08aa('0x14')]);}logger[_0x08aa('0x11')](_0x08aa('0x13'),_0x50a4a6,_0x2db55b[_0x08aa('0x11')][_0x08aa('0x14')]);return _0x4b14f1(_0x2db55b[_0x08aa('0x11')]['message']);}else{logger['info'](_0x08aa('0x13'),_0x50a4a6,_0x08aa('0xe'));_0x4b14f1(_0x2db55b['result'][_0x08aa('0x14')]);}})['catch'](function(_0x373511){logger['error'](_0x08aa('0x13'),_0x50a4a6,_0x373511);_0x262b73(_0x373511);});});}exports[_0x08aa('0x15')]=function(_0x15667b){var _0xba973c=this;return new Promise(function(_0x1d97b9,_0x5efe53){return db[_0x08aa('0x16')][_0x08aa('0x17')]({'raw':_0x15667b[_0x08aa('0x18')]?_0x15667b[_0x08aa('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x15667b[_0x08aa('0x18')]?_0x15667b[_0x08aa('0x18')][_0x08aa('0x19')]||null:null,'attributes':_0x15667b[_0x08aa('0x18')]?_0x15667b[_0x08aa('0x18')][_0x08aa('0x1a')]||null:null,'limit':_0x15667b[_0x08aa('0x18')]?_0x15667b[_0x08aa('0x18')]['limit']||null:null,'include':_0x15667b[_0x08aa('0x18')]?_0x15667b[_0x08aa('0x18')][_0x08aa('0x1b')]?_[_0x08aa('0x1c')](_0x15667b[_0x08aa('0x18')][_0x08aa('0x1b')],function(_0x30d88d){return{'model':db[_0x30d88d[_0x08aa('0x1d')]],'as':_0x30d88d['as'],'attributes':_0x30d88d[_0x08aa('0x1a')],'include':_0x30d88d[_0x08aa('0x1b')]?_[_0x08aa('0x1c')](_0x30d88d[_0x08aa('0x1b')],function(_0x32f1fd){return{'model':db[_0x32f1fd[_0x08aa('0x1d')]],'as':_0x32f1fd['as'],'attributes':_0x32f1fd[_0x08aa('0x1a')],'include':_0x32f1fd[_0x08aa('0x1b')]?_['map'](_0x32f1fd[_0x08aa('0x1b')],function(_0x1f33a8){return{'model':db[_0x1f33a8[_0x08aa('0x1d')]],'as':_0x1f33a8['as'],'attributes':_0x1f33a8['attributes']};}):[]};}):[]};}):[]:[]})[_0x08aa('0xc')](function(_0x5687bf){logger[_0x08aa('0xd')](_0x08aa('0x15'),_0x15667b);logger[_0x08aa('0x1e')](_0x08aa('0x15'),_0x15667b,JSON['stringify'](_0x5687bf));_0x1d97b9(_0x5687bf);})['catch'](function(_0x486e14){logger['error']('GetVoiceCallReport',_0x486e14['message'],_0x15667b);_0x5efe53(_0xba973c[_0x08aa('0x11')](0x1f4,_0x486e14['message']));});});};exports[_0x08aa('0x1f')]=function(_0x201292){var _0x5a2a9e=this;return new Promise(function(_0x2e4c52,_0x5627a2){return db[_0x08aa('0x16')]['create'](_0x201292[_0x08aa('0x20')],{'raw':_0x201292[_0x08aa('0x18')]?_0x201292['options']['raw']===undefined?!![]:![]:!![]})[_0x08aa('0xc')](function(_0x110350){logger[_0x08aa('0xd')](_0x08aa('0x1f'),_0x201292);logger[_0x08aa('0x1e')]('CreateVoiceCallReport',_0x201292,JSON[_0x08aa('0x10')](_0x110350));_0x2e4c52(_0x110350);})[_0x08aa('0x21')](function(_0x156e77){logger[_0x08aa('0x11')](_0x08aa('0x1f'),_0x156e77[_0x08aa('0x14')],_0x201292);_0x5627a2(_0x5a2a9e[_0x08aa('0x11')](0x1f4,_0x156e77[_0x08aa('0x14')]));});});};exports[_0x08aa('0x22')]=function(_0x580bec){var _0x3f0a73=this;return new Promise(function(_0x5e3343,_0x20d30a){return db[_0x08aa('0x16')][_0x08aa('0x23')](_0x580bec[_0x08aa('0x20')],{'raw':_0x580bec['options']?_0x580bec[_0x08aa('0x18')][_0x08aa('0x24')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x580bec[_0x08aa('0x18')]?_0x580bec[_0x08aa('0x18')][_0x08aa('0x19')]||null:null,'attributes':_0x580bec[_0x08aa('0x18')]?_0x580bec[_0x08aa('0x18')][_0x08aa('0x1a')]||null:null,'limit':_0x580bec[_0x08aa('0x18')]?_0x580bec[_0x08aa('0x18')]['limit']||null:null})[_0x08aa('0xc')](function(_0x5c373d){logger[_0x08aa('0xd')](_0x08aa('0x22'),_0x580bec);logger['debug'](_0x08aa('0x22'),_0x580bec,JSON[_0x08aa('0x10')](_0x5c373d));_0x5e3343(_0x5c373d);})['catch'](function(_0x14e3df){logger[_0x08aa('0x11')]('UpdateVoiceCallReport',_0x14e3df[_0x08aa('0x14')],_0x580bec);_0x20d30a(_0x3f0a73[_0x08aa('0x11')](0x1f4,_0x14e3df['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index cfcb11d..58aba9c 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 _0xad5c=['post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0xad5c,0x1ce));var _0xcad5=function(_0x38c4b2,_0x551354){_0x38c4b2=_0x38c4b2-0x0;var _0x5b0759=_0xad5c[_0x38c4b2];return _0x5b0759;};'use strict';var multer=require(_0xcad5('0x0'));var util=require(_0xcad5('0x1'));var path=require(_0xcad5('0x2'));var timeout=require(_0xcad5('0x3'));var express=require('express');var router=express[_0xcad5('0x4')]();var fs_extra=require(_0xcad5('0x5'));var auth=require(_0xcad5('0x6'));var interaction=require(_0xcad5('0x7'));var config=require('../../config/environment');var controller=require('./voiceChanSpy.controller');router[_0xcad5('0x8')]('/',auth[_0xcad5('0x9')](),controller[_0xcad5('0xa')]);router[_0xcad5('0x8')](_0xcad5('0xb'),auth[_0xcad5('0x9')](),controller[_0xcad5('0xc')]);router[_0xcad5('0xd')]('/',auth[_0xcad5('0x9')](),controller[_0xcad5('0xe')]);router[_0xcad5('0xf')](_0xcad5('0xb'),auth[_0xcad5('0x9')](),controller['update']);router[_0xcad5('0x10')](_0xcad5('0xb'),auth[_0xcad5('0x9')](),controller[_0xcad5('0x11')]);module[_0xcad5('0x12')]=router; \ No newline at end of file +var _0xd67c=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','post','put','delete','destroy','exports','multer','util','path'];(function(_0xea7085,_0x8f947e){var _0x5538a7=function(_0x352d64){while(--_0x352d64){_0xea7085['push'](_0xea7085['shift']());}};_0x5538a7(++_0x8f947e);}(_0xd67c,0x177));var _0xcd67=function(_0x450e22,_0x3ba125){_0x450e22=_0x450e22-0x0;var _0x5e3b1d=_0xd67c[_0x450e22];return _0x5e3b1d;};'use strict';var multer=require(_0xcd67('0x0'));var util=require(_0xcd67('0x1'));var path=require(_0xcd67('0x2'));var timeout=require(_0xcd67('0x3'));var express=require(_0xcd67('0x4'));var router=express[_0xcd67('0x5')]();var fs_extra=require(_0xcd67('0x6'));var auth=require(_0xcd67('0x7'));var interaction=require(_0xcd67('0x8'));var config=require(_0xcd67('0x9'));var controller=require(_0xcd67('0xa'));router[_0xcd67('0xb')]('/',auth[_0xcd67('0xc')](),controller[_0xcd67('0xd')]);router['get'](_0xcd67('0xe'),auth[_0xcd67('0xc')](),controller[_0xcd67('0xf')]);router[_0xcd67('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xcd67('0x11')]('/:id',auth[_0xcd67('0xc')](),controller['update']);router[_0xcd67('0x12')]('/:id',auth[_0xcd67('0xc')](),controller[_0xcd67('0x13')]);module[_0xcd67('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 30e2411..a84a9b1 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 _0x8d1a=['split','BOOLEAN','sequelize','exports','STRING','name','options','join','getDataValue'];(function(_0xbcd801,_0xc054){var _0x461981=function(_0x22fa9c){while(--_0x22fa9c){_0xbcd801['push'](_0xbcd801['shift']());}};_0x461981(++_0xc054);}(_0x8d1a,0x1a9));var _0xa8d1=function(_0x4d843f,_0x4a4401){_0x4d843f=_0x4d843f-0x0;var _0x58a99e=_0x8d1a[_0x4d843f];return _0x58a99e;};'use strict';var Sequelize=require(_0xa8d1('0x0'));module[_0xa8d1('0x1')]={'name':{'type':Sequelize[_0xa8d1('0x2')]},'prefix':{'type':Sequelize[_0xa8d1('0x2')],'unique':_0xa8d1('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0xa8d1('0x2')],'set':function(_0x35394f){this['setDataValue'](_0xa8d1('0x4'),_0x35394f?_0x35394f[_0xa8d1('0x5')](''):[]);},'get':function(){return this['getDataValue'](_0xa8d1('0x4'))?this[_0xa8d1('0x6')](_0xa8d1('0x4'))[_0xa8d1('0x7')](''):[];}},'auth':{'type':Sequelize[_0xa8d1('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0xa8d1('0x2')]},'record':{'type':Sequelize[_0xa8d1('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa8d1('0x2')]}}; \ No newline at end of file +var _0x5d6e=['STRING','name','options','getDataValue','split','BOOLEAN','sequelize','exports'];(function(_0x23c6f2,_0x4e033c){var _0x4c270b=function(_0x4913f0){while(--_0x4913f0){_0x23c6f2['push'](_0x23c6f2['shift']());}};_0x4c270b(++_0x4e033c);}(_0x5d6e,0xce));var _0xe5d6=function(_0x3239f5,_0x50e77c){_0x3239f5=_0x3239f5-0x0;var _0x3559c8=_0x5d6e[_0x3239f5];return _0x3559c8;};'use strict';var Sequelize=require(_0xe5d6('0x0'));module[_0xe5d6('0x1')]={'name':{'type':Sequelize[_0xe5d6('0x2')]},'prefix':{'type':Sequelize[_0xe5d6('0x2')],'unique':_0xe5d6('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0xe5d6('0x2')],'set':function(_0x468a3c){this['setDataValue'](_0xe5d6('0x4'),_0x468a3c?_0x468a3c['join'](''):[]);},'get':function(){return this[_0xe5d6('0x5')](_0xe5d6('0x4'))?this[_0xe5d6('0x5')](_0xe5d6('0x4'))[_0xe5d6('0x6')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0xe5d6('0x2')]},'record':{'type':Sequelize[_0xe5d6('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index ab557d2..0d3cd69 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 _0x99e9=['show','params','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','destroy','then','get','UserProfileResource','error','name','send','index','map','VoiceChanSpy','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','type','VIRTUAL','options','include','findAll','rows','catch'];(function(_0x1edab9,_0x466cf1){var _0x15e66b=function(_0x3e3263){while(--_0x3e3263){_0x1edab9['push'](_0x1edab9['shift']());}};_0x15e66b(++_0x466cf1);}(_0x99e9,0xb4));var _0x999e=function(_0xa8369a,_0x3d2319){_0xa8369a=_0xa8369a-0x0;var _0x4b74b7=_0x99e9[_0xa8369a];return _0x4b74b7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x999e('0x0'));var zipdir=require(_0x999e('0x1'));var jsonpatch=require(_0x999e('0x2'));var rp=require(_0x999e('0x3'));var moment=require('moment');var BPromise=require(_0x999e('0x4'));var Mustache=require(_0x999e('0x5'));var util=require(_0x999e('0x6'));var path=require('path');var sox=require(_0x999e('0x7'));var csv=require('to-csv');var ejs=require(_0x999e('0x8'));var fs=require('fs');var fs_extra=require(_0x999e('0x9'));var _=require(_0x999e('0xa'));var squel=require(_0x999e('0xb'));var crypto=require('crypto');var jsforce=require(_0x999e('0xc'));var deskjs=require(_0x999e('0xd'));var toCsv=require(_0x999e('0xe'));var querystring=require(_0x999e('0xf'));var Papa=require(_0x999e('0x10'));var Redis=require(_0x999e('0x11'));var authService=require(_0x999e('0x12'));var qs=require(_0x999e('0x13'));var as=require(_0x999e('0x14'));var hardwareService=require(_0x999e('0x15'));var logger=require(_0x999e('0x16'))(_0x999e('0x17'));var utils=require(_0x999e('0x18'));var config=require(_0x999e('0x19'));var licenseUtil=require(_0x999e('0x1a'));var db=require(_0x999e('0x1b'))['db'];function respondWithStatusCode(_0x26b55a,_0x47a3c1){_0x47a3c1=_0x47a3c1||0xcc;return function(_0x15f771){if(_0x15f771){return _0x26b55a['sendStatus'](_0x47a3c1);}return _0x26b55a[_0x999e('0x1c')](_0x47a3c1)[_0x999e('0x1d')]();};}function respondWithResult(_0x2fbc3e,_0x538a92){_0x538a92=_0x538a92||0xc8;return function(_0x28bdd1){if(_0x28bdd1){return _0x2fbc3e['status'](_0x538a92)[_0x999e('0x1e')](_0x28bdd1);}};}function respondWithFilteredResult(_0x539598,_0x549ad4){return function(_0x1eee64){if(_0x1eee64){var _0x22feac=typeof _0x549ad4[_0x999e('0x1f')]===_0x999e('0x20')&&typeof _0x549ad4[_0x999e('0x21')]===_0x999e('0x20');var _0x4aac66=_0x1eee64['count'];var _0x4fcdfb=_0x22feac?0x0:_0x549ad4[_0x999e('0x1f')];var _0x43b09e=_0x22feac?_0x1eee64[_0x999e('0x22')]:_0x549ad4[_0x999e('0x1f')]+_0x549ad4[_0x999e('0x21')];var _0x3ece5e;if(_0x43b09e>=_0x4aac66){_0x43b09e=_0x4aac66;_0x3ece5e=0xc8;}else{_0x3ece5e=0xce;}_0x539598['status'](_0x3ece5e);return _0x539598['set'](_0x999e('0x23'),_0x4fcdfb+'-'+_0x43b09e+'/'+_0x4aac66)[_0x999e('0x1e')](_0x1eee64);}return null;};}function patchUpdates(_0x3b3642){return function(_0x510fa2){try{jsonpatch[_0x999e('0x24')](_0x510fa2,_0x3b3642,!![]);}catch(_0x42e167){return BPromise[_0x999e('0x25')](_0x42e167);}return _0x510fa2[_0x999e('0x26')]();};}function saveUpdates(_0x373b80,_0x3750a0){return function(_0x427bcf){if(_0x427bcf){return _0x427bcf['update'](_0x373b80)['then'](function(_0x11a6bf){return _0x11a6bf;});}return null;};}function removeEntity(_0x4f0091,_0x4c5491){return function(_0x452acd){if(_0x452acd){return _0x452acd[_0x999e('0x27')]()[_0x999e('0x28')](function(){var _0x13027c=_0x452acd[_0x999e('0x29')]({'plain':!![]});var _0x320634='ChanSpies';return db[_0x999e('0x2a')][_0x999e('0x27')]({'where':{'type':_0x320634,'resourceId':_0x13027c['id']}})[_0x999e('0x28')](function(){return _0x452acd;});})[_0x999e('0x28')](function(){_0x4f0091[_0x999e('0x1c')](0xcc)[_0x999e('0x1d')]();});}};}function handleEntityNotFound(_0x44b790,_0x5798f3){return function(_0x28f803){if(!_0x28f803){_0x44b790['sendStatus'](0x194);}return _0x28f803;};}function handleError(_0x4fed13,_0x3dff6b){_0x3dff6b=_0x3dff6b||0x1f4;return function(_0x1059bd){logger[_0x999e('0x2b')](_0x1059bd['stack']);if(_0x1059bd[_0x999e('0x2c')]){delete _0x1059bd[_0x999e('0x2c')];}_0x4fed13[_0x999e('0x1c')](_0x3dff6b)[_0x999e('0x2d')](_0x1059bd);};}exports[_0x999e('0x2e')]=function(_0x327079,_0x82e067){var _0x2e9b0e={},_0x27102b={},_0x3ddacb={'count':0x0,'rows':[]};var _0x53ece1=_[_0x999e('0x2f')](db[_0x999e('0x30')][_0x999e('0x31')],function(_0x4c2ce8){return{'name':_0x4c2ce8[_0x999e('0x32')],'type':_0x4c2ce8['type']['key']};});_0x27102b[_0x999e('0x33')]=_[_0x999e('0x2f')](_0x53ece1,'name');_0x27102b['query']=_[_0x999e('0x34')](_0x327079[_0x999e('0x35')]);_0x27102b[_0x999e('0x36')]=_[_0x999e('0x37')](_0x27102b['model'],_0x27102b[_0x999e('0x35')]);_0x2e9b0e[_0x999e('0x38')]=_[_0x999e('0x37')](_0x27102b[_0x999e('0x33')],qs['fields'](_0x327079['query'][_0x999e('0x39')]));_0x2e9b0e['attributes']=_0x2e9b0e[_0x999e('0x38')][_0x999e('0x3a')]?_0x2e9b0e[_0x999e('0x38')]:_0x27102b[_0x999e('0x33')];if(!_0x327079['query'][_0x999e('0x3b')](_0x999e('0x3c'))){_0x2e9b0e['limit']=qs['limit'](_0x327079[_0x999e('0x35')]['limit']);_0x2e9b0e[_0x999e('0x1f')]=qs['offset'](_0x327079['query']['offset']);}_0x2e9b0e['order']=qs[_0x999e('0x3d')](_0x327079['query'][_0x999e('0x3d')]);_0x2e9b0e['where']=qs['filters'](_['pick'](_0x327079[_0x999e('0x35')],_0x27102b[_0x999e('0x36')]),_0x53ece1);if(_0x327079[_0x999e('0x35')][_0x999e('0x3e')]){_0x2e9b0e[_0x999e('0x3f')]=_[_0x999e('0x40')](_0x2e9b0e[_0x999e('0x3f')],{'$or':_[_0x999e('0x2f')](_0x53ece1,function(_0x54866a){if(_0x54866a[_0x999e('0x41')]!==_0x999e('0x42')){var _0x1e1229={};_0x1e1229[_0x54866a[_0x999e('0x2c')]]={'$like':'%'+_0x327079['query'][_0x999e('0x3e')]+'%'};return _0x1e1229;}})});}_0x2e9b0e=_['merge']({},_0x2e9b0e,_0x327079[_0x999e('0x43')]);var _0x35b318={'where':_0x2e9b0e[_0x999e('0x3f')]};return db[_0x999e('0x30')]['count'](_0x35b318)[_0x999e('0x28')](function(_0x108c96){_0x3ddacb[_0x999e('0x22')]=_0x108c96;if(_0x327079['query']['includeAll']){_0x2e9b0e[_0x999e('0x44')]=[{'all':!![]}];}return db[_0x999e('0x30')][_0x999e('0x45')](_0x2e9b0e);})[_0x999e('0x28')](function(_0x1009a0){_0x3ddacb[_0x999e('0x46')]=_0x1009a0;return _0x3ddacb;})[_0x999e('0x28')](respondWithFilteredResult(_0x82e067,_0x2e9b0e))[_0x999e('0x47')](handleError(_0x82e067,null));};exports[_0x999e('0x48')]=function(_0xf4fa,_0x55da0b){var _0x4c8b36={'raw':![],'where':{'id':_0xf4fa[_0x999e('0x49')]['id']}},_0xa5742d={};_0xa5742d[_0x999e('0x33')]=_[_0x999e('0x34')](db[_0x999e('0x30')][_0x999e('0x31')]);_0xa5742d['query']=_[_0x999e('0x34')](_0xf4fa['query']);_0xa5742d['filters']=_[_0x999e('0x37')](_0xa5742d['model'],_0xa5742d['query']);_0x4c8b36['attributes']=_['intersection'](_0xa5742d[_0x999e('0x33')],qs[_0x999e('0x39')](_0xf4fa['query'][_0x999e('0x39')]));_0x4c8b36[_0x999e('0x38')]=_0x4c8b36[_0x999e('0x38')]['length']?_0x4c8b36['attributes']:_0xa5742d[_0x999e('0x33')];if(_0xf4fa[_0x999e('0x35')][_0x999e('0x4a')]){_0x4c8b36['include']=[{'all':!![]}];}_0x4c8b36=_['merge']({},_0x4c8b36,_0xf4fa['options']);return db['VoiceChanSpy'][_0x999e('0x4b')](_0x4c8b36)['then'](handleEntityNotFound(_0x55da0b,null))['then'](respondWithResult(_0x55da0b,null))[_0x999e('0x47')](handleError(_0x55da0b,null));};exports[_0x999e('0x4c')]=function(_0x5843f1,_0xa50dc6){return db[_0x999e('0x30')]['create'](_0x5843f1[_0x999e('0x4d')],{})['then'](function(_0x9322ca){var _0x42dfea=_0x5843f1['user'][_0x999e('0x29')]({'plain':!![]});if(!_0x42dfea)throw new Error(_0x999e('0x4e'));if(_0x42dfea['role']==='user'){var _0x254292=_0x9322ca['get']({'plain':!![]});var _0x5ebc95='ChanSpies';return db[_0x999e('0x4f')][_0x999e('0x4b')]({'where':{'name':_0x5ebc95,'userProfileId':_0x42dfea[_0x999e('0x50')]},'raw':!![]})[_0x999e('0x28')](function(_0x37c3ff){if(_0x37c3ff&&_0x37c3ff[_0x999e('0x51')]===0x0){return db['UserProfileResource'][_0x999e('0x4c')]({'name':_0x254292[_0x999e('0x2c')],'resourceId':_0x254292['id'],'type':_0x37c3ff['name'],'sectionId':_0x37c3ff['id']},{})[_0x999e('0x28')](function(){return _0x9322ca;});}else{return _0x9322ca;}})[_0x999e('0x47')](function(_0x4169eb){logger[_0x999e('0x2b')](_0x999e('0x52'),_0x4169eb);throw _0x4169eb;});}return _0x9322ca;})[_0x999e('0x28')](respondWithResult(_0xa50dc6,0xc9))[_0x999e('0x47')](handleError(_0xa50dc6,null));};exports[_0x999e('0x53')]=function(_0x290c7a,_0x53932a){if(_0x290c7a[_0x999e('0x4d')]['id']){delete _0x290c7a[_0x999e('0x4d')]['id'];}return db[_0x999e('0x30')][_0x999e('0x4b')]({'where':{'id':_0x290c7a['params']['id']}})[_0x999e('0x28')](handleEntityNotFound(_0x53932a,null))[_0x999e('0x28')](saveUpdates(_0x290c7a[_0x999e('0x4d')],null))[_0x999e('0x28')](respondWithResult(_0x53932a,null))[_0x999e('0x47')](handleError(_0x53932a,null));};exports[_0x999e('0x27')]=function(_0x3f5790,_0x1a6925){return db['VoiceChanSpy']['find']({'where':{'id':_0x3f5790[_0x999e('0x49')]['id']}})[_0x999e('0x28')](handleEntityNotFound(_0x1a6925,null))[_0x999e('0x28')](removeEntity(_0x1a6925,null))[_0x999e('0x47')](handleError(_0x1a6925,null));}; \ No newline at end of file +var _0xe630=['params','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','undefined','offset','apply','reject','update','then','destroy','ChanSpies','UserProfileResource','end','error','stack','name','send','index','map','VoiceChanSpy','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filter','merge','options','includeAll','include','rows','catch','show','keys','create','body','user','get','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find'];(function(_0x5886a6,_0x2c9288){var _0x563a59=function(_0xbdebc1){while(--_0xbdebc1){_0x5886a6['push'](_0x5886a6['shift']());}};_0x563a59(++_0x2c9288);}(_0xe630,0x149));var _0x0e63=function(_0x4429e0,_0xee6f1f){_0x4429e0=_0x4429e0-0x0;var _0x51a5b3=_0xe630[_0x4429e0];return _0x51a5b3;};'use strict';var emlformat=require(_0x0e63('0x0'));var rimraf=require(_0x0e63('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0e63('0x2'));var rp=require(_0x0e63('0x3'));var moment=require(_0x0e63('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0e63('0x5'));var util=require(_0x0e63('0x6'));var path=require(_0x0e63('0x7'));var sox=require('sox');var csv=require(_0x0e63('0x8'));var ejs=require(_0x0e63('0x9'));var fs=require('fs');var fs_extra=require(_0x0e63('0xa'));var _=require(_0x0e63('0xb'));var squel=require(_0x0e63('0xc'));var crypto=require('crypto');var jsforce=require(_0x0e63('0xd'));var deskjs=require(_0x0e63('0xe'));var toCsv=require(_0x0e63('0x8'));var querystring=require(_0x0e63('0xf'));var Papa=require(_0x0e63('0x10'));var Redis=require(_0x0e63('0x11'));var authService=require(_0x0e63('0x12'));var qs=require(_0x0e63('0x13'));var as=require(_0x0e63('0x14'));var hardwareService=require(_0x0e63('0x15'));var logger=require(_0x0e63('0x16'))('api');var utils=require(_0x0e63('0x17'));var config=require(_0x0e63('0x18'));var licenseUtil=require(_0x0e63('0x19'));var db=require(_0x0e63('0x1a'))['db'];function respondWithStatusCode(_0x34fd3c,_0x1e8200){_0x1e8200=_0x1e8200||0xcc;return function(_0x1282bc){if(_0x1282bc){return _0x34fd3c[_0x0e63('0x1b')](_0x1e8200);}return _0x34fd3c[_0x0e63('0x1c')](_0x1e8200)['end']();};}function respondWithResult(_0x486f8f,_0xf547b8){_0xf547b8=_0xf547b8||0xc8;return function(_0x29ff63){if(_0x29ff63){return _0x486f8f[_0x0e63('0x1c')](_0xf547b8)[_0x0e63('0x1d')](_0x29ff63);}};}function respondWithFilteredResult(_0x61c395,_0x35643c){return function(_0x47f3e2){if(_0x47f3e2){var _0x5d1f1e=typeof _0x35643c['offset']==='undefined'&&typeof _0x35643c[_0x0e63('0x1e')]===_0x0e63('0x1f');var _0x5c22ad=_0x47f3e2['count'];var _0x4dd1db=_0x5d1f1e?0x0:_0x35643c[_0x0e63('0x20')];var _0x5c01e0=_0x5d1f1e?_0x47f3e2['count']:_0x35643c[_0x0e63('0x20')]+_0x35643c['limit'];var _0xb01f46;if(_0x5c01e0>=_0x5c22ad){_0x5c01e0=_0x5c22ad;_0xb01f46=0xc8;}else{_0xb01f46=0xce;}_0x61c395[_0x0e63('0x1c')](_0xb01f46);return _0x61c395['set']('Content-Range',_0x4dd1db+'-'+_0x5c01e0+'/'+_0x5c22ad)[_0x0e63('0x1d')](_0x47f3e2);}return null;};}function patchUpdates(_0x1dfd60){return function(_0x16f166){try{jsonpatch[_0x0e63('0x21')](_0x16f166,_0x1dfd60,!![]);}catch(_0x305506){return BPromise[_0x0e63('0x22')](_0x305506);}return _0x16f166['save']();};}function saveUpdates(_0xb0d024,_0x23ed8c){return function(_0x2a4f55){if(_0x2a4f55){return _0x2a4f55[_0x0e63('0x23')](_0xb0d024)[_0x0e63('0x24')](function(_0x4ab310){return _0x4ab310;});}return null;};}function removeEntity(_0x51bb78,_0x437878){return function(_0x3aaea5){if(_0x3aaea5){return _0x3aaea5[_0x0e63('0x25')]()[_0x0e63('0x24')](function(){var _0x412500=_0x3aaea5['get']({'plain':!![]});var _0x22bdce=_0x0e63('0x26');return db[_0x0e63('0x27')][_0x0e63('0x25')]({'where':{'type':_0x22bdce,'resourceId':_0x412500['id']}})[_0x0e63('0x24')](function(){return _0x3aaea5;});})[_0x0e63('0x24')](function(){_0x51bb78[_0x0e63('0x1c')](0xcc)[_0x0e63('0x28')]();});}};}function handleEntityNotFound(_0x25e88e,_0x3b9fb6){return function(_0x46c864){if(!_0x46c864){_0x25e88e['sendStatus'](0x194);}return _0x46c864;};}function handleError(_0x4b026e,_0x595753){_0x595753=_0x595753||0x1f4;return function(_0x66a314){logger[_0x0e63('0x29')](_0x66a314[_0x0e63('0x2a')]);if(_0x66a314[_0x0e63('0x2b')]){delete _0x66a314[_0x0e63('0x2b')];}_0x4b026e[_0x0e63('0x1c')](_0x595753)[_0x0e63('0x2c')](_0x66a314);};}exports[_0x0e63('0x2d')]=function(_0x2ef997,_0x31fc3e){var _0x1069c7={},_0x319061={},_0x435990={'count':0x0,'rows':[]};var _0x19cde4=_[_0x0e63('0x2e')](db[_0x0e63('0x2f')][_0x0e63('0x30')],function(_0x5e34ae){return{'name':_0x5e34ae[_0x0e63('0x31')],'type':_0x5e34ae[_0x0e63('0x32')]['key']};});_0x319061[_0x0e63('0x33')]=_[_0x0e63('0x2e')](_0x19cde4,_0x0e63('0x2b'));_0x319061[_0x0e63('0x34')]=_['keys'](_0x2ef997[_0x0e63('0x34')]);_0x319061[_0x0e63('0x35')]=_[_0x0e63('0x36')](_0x319061[_0x0e63('0x33')],_0x319061[_0x0e63('0x34')]);_0x1069c7[_0x0e63('0x37')]=_['intersection'](_0x319061[_0x0e63('0x33')],qs[_0x0e63('0x38')](_0x2ef997[_0x0e63('0x34')][_0x0e63('0x38')]));_0x1069c7[_0x0e63('0x37')]=_0x1069c7[_0x0e63('0x37')]['length']?_0x1069c7[_0x0e63('0x37')]:_0x319061[_0x0e63('0x33')];if(!_0x2ef997[_0x0e63('0x34')][_0x0e63('0x39')](_0x0e63('0x3a'))){_0x1069c7[_0x0e63('0x1e')]=qs['limit'](_0x2ef997[_0x0e63('0x34')]['limit']);_0x1069c7[_0x0e63('0x20')]=qs[_0x0e63('0x20')](_0x2ef997[_0x0e63('0x34')][_0x0e63('0x20')]);}_0x1069c7[_0x0e63('0x3b')]=qs['sort'](_0x2ef997['query']['sort']);_0x1069c7[_0x0e63('0x3c')]=qs[_0x0e63('0x35')](_[_0x0e63('0x3d')](_0x2ef997[_0x0e63('0x34')],_0x319061[_0x0e63('0x35')]),_0x19cde4);if(_0x2ef997['query']['filter']){_0x1069c7[_0x0e63('0x3c')]=_['merge'](_0x1069c7[_0x0e63('0x3c')],{'$or':_['map'](_0x19cde4,function(_0xeb2a78){if(_0xeb2a78[_0x0e63('0x32')]!=='VIRTUAL'){var _0x198b04={};_0x198b04[_0xeb2a78[_0x0e63('0x2b')]]={'$like':'%'+_0x2ef997[_0x0e63('0x34')][_0x0e63('0x3e')]+'%'};return _0x198b04;}})});}_0x1069c7=_[_0x0e63('0x3f')]({},_0x1069c7,_0x2ef997[_0x0e63('0x40')]);var _0x2438c9={'where':_0x1069c7[_0x0e63('0x3c')]};return db[_0x0e63('0x2f')]['count'](_0x2438c9)['then'](function(_0x3ae899){_0x435990['count']=_0x3ae899;if(_0x2ef997[_0x0e63('0x34')][_0x0e63('0x41')]){_0x1069c7[_0x0e63('0x42')]=[{'all':!![]}];}return db[_0x0e63('0x2f')]['findAll'](_0x1069c7);})[_0x0e63('0x24')](function(_0x31da43){_0x435990[_0x0e63('0x43')]=_0x31da43;return _0x435990;})[_0x0e63('0x24')](respondWithFilteredResult(_0x31fc3e,_0x1069c7))[_0x0e63('0x44')](handleError(_0x31fc3e,null));};exports[_0x0e63('0x45')]=function(_0x32d6a5,_0x11935b){var _0x419cf8={'raw':![],'where':{'id':_0x32d6a5['params']['id']}},_0x18e754={};_0x18e754[_0x0e63('0x33')]=_[_0x0e63('0x46')](db[_0x0e63('0x2f')][_0x0e63('0x30')]);_0x18e754['query']=_[_0x0e63('0x46')](_0x32d6a5[_0x0e63('0x34')]);_0x18e754[_0x0e63('0x35')]=_['intersection'](_0x18e754[_0x0e63('0x33')],_0x18e754[_0x0e63('0x34')]);_0x419cf8[_0x0e63('0x37')]=_['intersection'](_0x18e754[_0x0e63('0x33')],qs[_0x0e63('0x38')](_0x32d6a5[_0x0e63('0x34')][_0x0e63('0x38')]));_0x419cf8['attributes']=_0x419cf8[_0x0e63('0x37')]['length']?_0x419cf8[_0x0e63('0x37')]:_0x18e754[_0x0e63('0x33')];if(_0x32d6a5[_0x0e63('0x34')][_0x0e63('0x41')]){_0x419cf8[_0x0e63('0x42')]=[{'all':!![]}];}_0x419cf8=_[_0x0e63('0x3f')]({},_0x419cf8,_0x32d6a5[_0x0e63('0x40')]);return db[_0x0e63('0x2f')]['find'](_0x419cf8)['then'](handleEntityNotFound(_0x11935b,null))['then'](respondWithResult(_0x11935b,null))[_0x0e63('0x44')](handleError(_0x11935b,null));};exports[_0x0e63('0x47')]=function(_0xe3f5b7,_0x478e74){return db[_0x0e63('0x2f')][_0x0e63('0x47')](_0xe3f5b7[_0x0e63('0x48')],{})[_0x0e63('0x24')](function(_0x5e2eab){var _0x4ccc73=_0xe3f5b7[_0x0e63('0x49')][_0x0e63('0x4a')]({'plain':!![]});if(!_0x4ccc73)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4ccc73[_0x0e63('0x4b')]===_0x0e63('0x49')){var _0x3f8dca=_0x5e2eab['get']({'plain':!![]});var _0x1c8e33=_0x0e63('0x26');return db[_0x0e63('0x4c')]['find']({'where':{'name':_0x1c8e33,'userProfileId':_0x4ccc73[_0x0e63('0x4d')]},'raw':!![]})[_0x0e63('0x24')](function(_0x452d76){if(_0x452d76&&_0x452d76[_0x0e63('0x4e')]===0x0){return db[_0x0e63('0x27')][_0x0e63('0x47')]({'name':_0x3f8dca[_0x0e63('0x2b')],'resourceId':_0x3f8dca['id'],'type':_0x452d76[_0x0e63('0x2b')],'sectionId':_0x452d76['id']},{})[_0x0e63('0x24')](function(){return _0x5e2eab;});}else{return _0x5e2eab;}})[_0x0e63('0x44')](function(_0x5a513d){logger[_0x0e63('0x29')](_0x0e63('0x4f'),_0x5a513d);throw _0x5a513d;});}return _0x5e2eab;})[_0x0e63('0x24')](respondWithResult(_0x478e74,0xc9))[_0x0e63('0x44')](handleError(_0x478e74,null));};exports[_0x0e63('0x23')]=function(_0x25d5bc,_0x3570f0){if(_0x25d5bc[_0x0e63('0x48')]['id']){delete _0x25d5bc['body']['id'];}return db[_0x0e63('0x2f')][_0x0e63('0x50')]({'where':{'id':_0x25d5bc[_0x0e63('0x51')]['id']}})[_0x0e63('0x24')](handleEntityNotFound(_0x3570f0,null))[_0x0e63('0x24')](saveUpdates(_0x25d5bc[_0x0e63('0x48')],null))[_0x0e63('0x24')](respondWithResult(_0x3570f0,null))[_0x0e63('0x44')](handleError(_0x3570f0,null));};exports[_0x0e63('0x25')]=function(_0x4266a1,_0x4351ff){return db[_0x0e63('0x2f')][_0x0e63('0x50')]({'where':{'id':_0x4266a1['params']['id']}})[_0x0e63('0x24')](handleEntityNotFound(_0x4351ff,null))[_0x0e63('0x24')](removeEntity(_0x4351ff,null))['catch'](handleError(_0x4351ff,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index ce56017..7a44e99 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 _0x0136=['catch','destroy','util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','%s%s','system','push','merge','Set','CDR(type)=%s','chanspy','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','record','StopMixMonitor','length','concat','internal','User','findAll','then','models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate'];(function(_0x5e47ff,_0x11eba6){var _0x622ae0=function(_0x3bc131){while(--_0x3bc131){_0x5e47ff['push'](_0x5e47ff['shift']());}};_0x622ae0(++_0x11eba6);}(_0x0136,0x1ba));var _0x6013=function(_0x448a5c,_0x222a52){_0x448a5c=_0x448a5c-0x0;var _0x1fc0f2=_0x0136[_0x448a5c];return _0x1fc0f2;};'use strict';var _=require('lodash');var util=require(_0x6013('0x0'));var BPromise=require(_0x6013('0x1'));var attributes=require(_0x6013('0x2'));var getUserApplications=function(_0x2bbfb0,_0x1415d6,_0x35ef73){var _0x4ea407=0x1;var _0x5bd009=[];var _0xbeaa15={'context':_0x1415d6[_0x6013('0x3')]||_0x6013('0x4'),'exten':util[_0x6013('0x5')](_0x6013('0x6'),_0x2bbfb0['prefix'],_0x35ef73),'type':_0x6013('0x7'),'isApp':![],'ChanSpyId':_0x2bbfb0['id'],'UserId':_0x1415d6['id']};_0x5bd009[_0x6013('0x8')](_[_0x6013('0x9')]({'app':_0x6013('0xa'),'appdata':util[_0x6013('0x5')](_0x6013('0xb'),_0x6013('0xc')),'priority':_0x4ea407++},_0xbeaa15));if(_0x2bbfb0['record']){_0x5bd009[_0x6013('0x8')](_[_0x6013('0x9')]({'app':_0x6013('0xd'),'appdata':util['format'](_0x6013('0xe'),_0x2bbfb0[_0x6013('0xf')]),'priority':_0x4ea407++},_0xbeaa15));}if(_0x2bbfb0[_0x6013('0x10')]){_0x5bd009['push'](_['merge']({'app':_0x6013('0x11'),'appdata':_0x2bbfb0[_0x6013('0x12')],'priority':_0x4ea407++},_0xbeaa15));}_0x5bd009['push'](_[_0x6013('0x9')]({'app':_0x6013('0x13'),'appdata':util[_0x6013('0x5')](_0x6013('0x14'),_0x1415d6[_0x6013('0x15')],_0x2bbfb0['options']?_0x2bbfb0[_0x6013('0x16')][_0x6013('0x17')](''):''),'priority':_0x4ea407++},_0xbeaa15));if(_0x2bbfb0[_0x6013('0x18')]){_0x5bd009[_0x6013('0x8')](_[_0x6013('0x9')]({'app':_0x6013('0x19'),'priority':_0x4ea407++},_0xbeaa15));}return _0x5bd009;};var getChanSpyApplications=function(_0x38c853,_0xe9f32b){var _0x42e188=[];for(var _0x580e7c=0x0,_0x3d496d=0x1;_0x580e7c<_0xe9f32b[_0x6013('0x1a')];_0x580e7c++,_0x3d496d=0x1){_0x42e188=_0x42e188[_0x6013('0x1b')](getUserApplications(_0x38c853,_0xe9f32b[_0x580e7c],_0xe9f32b[_0x580e7c][_0x6013('0x1c')]));if(_0xe9f32b[_0x580e7c][_0x6013('0x1c')]!=_0xe9f32b[_0x580e7c][_0x6013('0x15')]){_0x42e188=_0x42e188[_0x6013('0x1b')](getUserApplications(_0x38c853,_0xe9f32b[_0x580e7c],_0xe9f32b[_0x580e7c][_0x6013('0x15')]));}}return _0x42e188;};var getChanSpyPromise=function(_0x2284d4,_0x4f39c8){return new BPromise(function(_0x10d535,_0x40ed78){return _0x2284d4[_0x6013('0x1d')][_0x6013('0x1e')]({'attributes':['id',_0x6013('0x15'),_0x6013('0x1c')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0x6013('0x1f')](function(_0x16f1e5){if(_0x16f1e5){return _0x10d535(getChanSpyApplications(_0x4f39c8,_0x16f1e5));}return _0x10d535([]);})['catch'](function(_0x12667f){_0x40ed78(_0x12667f);});});};module['exports']=function(_0x24c8de,_0x2d1ba5){var _0x5e9ccc=_0x24c8de[_0x6013('0x20')];return _0x24c8de[_0x6013('0x21')](_0x6013('0x22'),attributes,{'tableName':_0x6013('0x23'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5cbf06,_0x4a9697,_0x1415be){return getChanSpyPromise(_0x5e9ccc,_0x5cbf06)[_0x6013('0x1f')](function(_0x8bec90){if(_0x8bec90&&_0x8bec90[_0x6013('0x1a')]){return _0x5e9ccc[_0x6013('0x24')][_0x6013('0x25')](_0x8bec90);}})['then'](function(){_0x1415be();})[_0x6013('0x26')](function(_0x3fc038){_0x1415be(_0x3fc038);});},'afterUpdate':function(_0xa0ae8,_0x4d56a7,_0x1f6912){return _0x5e9ccc[_0x6013('0x24')][_0x6013('0x27')]({'where':{'ChanSpyId':_0xa0ae8['id']}})[_0x6013('0x1f')](function(){return getChanSpyPromise(_0x5e9ccc,_0xa0ae8);})['then'](function(_0x537692){if(_0x537692&&_0x537692[_0x6013('0x1a')]){return _0x5e9ccc[_0x6013('0x24')][_0x6013('0x25')](_0x537692);}})[_0x6013('0x1f')](function(){_0x1f6912();})[_0x6013('0x26')](function(_0x5d3600){_0x1f6912(_0x5d3600);});},'afterDestroy':function(_0x3f42f6,_0x2fc4c2,_0x4e9ee3){return _0x5e9ccc[_0x6013('0x24')][_0x6013('0x27')]({'where':{'ChanSpyId':_0x3f42f6['id']}})[_0x6013('0x1f')](function(){_0x4e9ee3();})['catch'](function(_0x14baa2){_0x4e9ee3(_0x14baa2);});}}});}; \ No newline at end of file +var _0x58c2=['exports','models','define','then','VoiceExtension','bulkCreate','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip','prefix','system','push','Set','CDR(type)=%s','chanspy','record','merge','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','ChanSpy','format','SIP/%s,%s','name','options','StopMixMonitor','length','internal','concat','User','catch'];(function(_0x46556d,_0x4fc5e6){var _0x134a9a=function(_0x434f50){while(--_0x434f50){_0x46556d['push'](_0x46556d['shift']());}};_0x134a9a(++_0x4fc5e6);}(_0x58c2,0xc5));var _0x258c=function(_0x4e9e0d,_0xd86384){_0x4e9e0d=_0x4e9e0d-0x0;var _0x514622=_0x58c2[_0x4e9e0d];return _0x514622;};'use strict';var _=require(_0x258c('0x0'));var util=require(_0x258c('0x1'));var BPromise=require(_0x258c('0x2'));var attributes=require(_0x258c('0x3'));var getUserApplications=function(_0xf0fc4a,_0x35c4f1,_0x7100e9){var _0xfcbc4d=0x1;var _0x3b98ed=[];var _0x255f4e={'context':_0x35c4f1[_0x258c('0x4')]||_0x258c('0x5'),'exten':util['format']('%s%s',_0xf0fc4a[_0x258c('0x6')],_0x7100e9),'type':_0x258c('0x7'),'isApp':![],'ChanSpyId':_0xf0fc4a['id'],'UserId':_0x35c4f1['id']};_0x3b98ed[_0x258c('0x8')](_['merge']({'app':_0x258c('0x9'),'appdata':util['format'](_0x258c('0xa'),_0x258c('0xb')),'priority':_0xfcbc4d++},_0x255f4e));if(_0xf0fc4a[_0x258c('0xc')]){_0x3b98ed['push'](_[_0x258c('0xd')]({'app':_0x258c('0xe'),'appdata':util['format'](_0x258c('0xf'),_0xf0fc4a[_0x258c('0x10')]),'priority':_0xfcbc4d++},_0x255f4e));}if(_0xf0fc4a[_0x258c('0x11')]){_0x3b98ed['push'](_[_0x258c('0xd')]({'app':_0x258c('0x12'),'appdata':_0xf0fc4a[_0x258c('0x13')],'priority':_0xfcbc4d++},_0x255f4e));}_0x3b98ed[_0x258c('0x8')](_['merge']({'app':_0x258c('0x14'),'appdata':util[_0x258c('0x15')](_0x258c('0x16'),_0x35c4f1[_0x258c('0x17')],_0xf0fc4a['options']?_0xf0fc4a[_0x258c('0x18')]['join'](''):''),'priority':_0xfcbc4d++},_0x255f4e));if(_0xf0fc4a[_0x258c('0xc')]){_0x3b98ed[_0x258c('0x8')](_[_0x258c('0xd')]({'app':_0x258c('0x19'),'priority':_0xfcbc4d++},_0x255f4e));}return _0x3b98ed;};var getChanSpyApplications=function(_0x6f9c86,_0xb46eb1){var _0x2616ac=[];for(var _0x11c98b=0x0,_0x5d3f88=0x1;_0x11c98b<_0xb46eb1[_0x258c('0x1a')];_0x11c98b++,_0x5d3f88=0x1){_0x2616ac=_0x2616ac['concat'](getUserApplications(_0x6f9c86,_0xb46eb1[_0x11c98b],_0xb46eb1[_0x11c98b][_0x258c('0x1b')]));if(_0xb46eb1[_0x11c98b][_0x258c('0x1b')]!=_0xb46eb1[_0x11c98b][_0x258c('0x17')]){_0x2616ac=_0x2616ac[_0x258c('0x1c')](getUserApplications(_0x6f9c86,_0xb46eb1[_0x11c98b],_0xb46eb1[_0x11c98b][_0x258c('0x17')]));}}return _0x2616ac;};var getChanSpyPromise=function(_0x308ea8,_0x58c4bf){return new BPromise(function(_0x340e65,_0x8ce993){return _0x308ea8[_0x258c('0x1d')]['findAll']({'attributes':['id',_0x258c('0x17'),_0x258c('0x1b')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})['then'](function(_0x50d7f2){if(_0x50d7f2){return _0x340e65(getChanSpyApplications(_0x58c4bf,_0x50d7f2));}return _0x340e65([]);})[_0x258c('0x1e')](function(_0x558f2d){_0x8ce993(_0x558f2d);});});};module[_0x258c('0x1f')]=function(_0x59daf3,_0x5d2472){var _0x46b0c2=_0x59daf3[_0x258c('0x20')];return _0x59daf3[_0x258c('0x21')]('VoiceChanSpy',attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5d3635,_0x39e4ae,_0x4859e5){return getChanSpyPromise(_0x46b0c2,_0x5d3635)[_0x258c('0x22')](function(_0x1d5c78){if(_0x1d5c78&&_0x1d5c78[_0x258c('0x1a')]){return _0x46b0c2[_0x258c('0x23')][_0x258c('0x24')](_0x1d5c78);}})[_0x258c('0x22')](function(){_0x4859e5();})[_0x258c('0x1e')](function(_0x5e7e95){_0x4859e5(_0x5e7e95);});},'afterUpdate':function(_0x54a76b,_0x2b4873,_0x50e12e){return _0x46b0c2[_0x258c('0x23')][_0x258c('0x25')]({'where':{'ChanSpyId':_0x54a76b['id']}})[_0x258c('0x22')](function(){return getChanSpyPromise(_0x46b0c2,_0x54a76b);})[_0x258c('0x22')](function(_0x19bdeb){if(_0x19bdeb&&_0x19bdeb[_0x258c('0x1a')]){return _0x46b0c2[_0x258c('0x23')][_0x258c('0x24')](_0x19bdeb);}})[_0x258c('0x22')](function(){_0x50e12e();})['catch'](function(_0x23f29b){_0x50e12e(_0x23f29b);});},'afterDestroy':function(_0x4d963a,_0x20bf9b,_0x89d4d2){return _0x46b0c2[_0x258c('0x23')][_0x258c('0x25')]({'where':{'ChanSpyId':_0x4d963a['id']}})['then'](function(){_0x89d4d2();})[_0x258c('0x1e')](function(_0x13f5cc){_0x89d4d2(_0x13f5cc);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 2fb8641..58f6731 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 _0x235a=['http','then','VoiceChanSpy,\x20%s,\x20%s','debug','error','code','message','info','request\x20sent','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x1a0799,_0xff43ac){var _0x3c47b5=function(_0x1f4359){while(--_0x1f4359){_0x1a0799['push'](_0x1a0799['shift']());}};_0x3c47b5(++_0xff43ac);}(_0x235a,0x1ef));var _0xa235=function(_0x29ea35,_0x1baf95){_0x29ea35=_0x29ea35-0x0;var _0x5702f4=_0x235a[_0x29ea35];return _0x5702f4;};'use strict';var _=require(_0xa235('0x0'));var util=require(_0xa235('0x1'));var moment=require(_0xa235('0x2'));var BPromise=require('bluebird');var rs=require(_0xa235('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa235('0x4'))['db'];var utils=require(_0xa235('0x5'));var logger=require(_0xa235('0x6'))(_0xa235('0x7'));var config=require(_0xa235('0x8'));var jayson=require(_0xa235('0x9'));var client=jayson[_0xa235('0xa')][_0xa235('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b849b,_0x2e535e,_0x2dc1ba){return new BPromise(function(_0x450e27,_0x2f3403){return client['request'](_0x4b849b,_0x2dc1ba)[_0xa235('0xc')](function(_0x561602){logger['info'](_0xa235('0xd'),_0x2e535e,'request\x20sent');logger[_0xa235('0xe')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x2e535e,'request\x20sent',JSON['stringify'](_0x561602));if(_0x561602[_0xa235('0xf')]){if(_0x561602[_0xa235('0xf')][_0xa235('0x10')]===0x1f4){logger[_0xa235('0xf')]('VoiceChanSpy,\x20%s,\x20%s',_0x2e535e,_0x561602['error']['message']);return _0x2f3403(_0x561602[_0xa235('0xf')][_0xa235('0x11')]);}logger[_0xa235('0xf')](_0xa235('0xd'),_0x2e535e,_0x561602[_0xa235('0xf')][_0xa235('0x11')]);return _0x450e27(_0x561602[_0xa235('0xf')][_0xa235('0x11')]);}else{logger[_0xa235('0x12')]('VoiceChanSpy,\x20%s,\x20%s',_0x2e535e,_0xa235('0x13'));_0x450e27(_0x561602[_0xa235('0x14')][_0xa235('0x11')]);}})[_0xa235('0x15')](function(_0x16dbe9){logger[_0xa235('0xf')]('VoiceChanSpy,\x20%s,\x20%s',_0x2e535e,_0x16dbe9);_0x2f3403(_0x16dbe9);});});} \ No newline at end of file +var _0x263f=['client','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x290694,_0x281935){var _0x5a0f2e=function(_0x58d7d4){while(--_0x58d7d4){_0x290694['push'](_0x290694['shift']());}};_0x5a0f2e(++_0x281935);}(_0x263f,0x182));var _0xf263=function(_0x457c35,_0x284119){_0x457c35=_0x457c35-0x0;var _0x6a4733=_0x263f[_0x457c35];return _0x6a4733;};'use strict';var _=require(_0xf263('0x0'));var util=require(_0xf263('0x1'));var moment=require(_0xf263('0x2'));var BPromise=require(_0xf263('0x3'));var rs=require(_0xf263('0x4'));var fs=require('fs');var Redis=require(_0xf263('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf263('0x6'));var logger=require(_0xf263('0x7'))(_0xf263('0x8'));var config=require('../../config/environment');var jayson=require(_0xf263('0x9'));var client=jayson[_0xf263('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4fded6,_0xa2b1b0,_0x9644ab){return new BPromise(function(_0xa2e77e,_0x16ff53){return client['request'](_0x4fded6,_0x9644ab)[_0xf263('0xb')](function(_0x26504c){logger[_0xf263('0xc')](_0xf263('0xd'),_0xa2b1b0,_0xf263('0xe'));logger[_0xf263('0xf')](_0xf263('0x10'),_0xa2b1b0,'request\x20sent',JSON[_0xf263('0x11')](_0x26504c));if(_0x26504c['error']){if(_0x26504c[_0xf263('0x12')]['code']===0x1f4){logger['error'](_0xf263('0xd'),_0xa2b1b0,_0x26504c[_0xf263('0x12')][_0xf263('0x13')]);return _0x16ff53(_0x26504c[_0xf263('0x12')][_0xf263('0x13')]);}logger[_0xf263('0x12')](_0xf263('0xd'),_0xa2b1b0,_0x26504c['error'][_0xf263('0x13')]);return _0xa2e77e(_0x26504c['error'][_0xf263('0x13')]);}else{logger[_0xf263('0xc')](_0xf263('0xd'),_0xa2b1b0,_0xf263('0xe'));_0xa2e77e(_0x26504c[_0xf263('0x14')][_0xf263('0x13')]);}})[_0xf263('0x15')](function(_0x57c655){logger['error'](_0xf263('0xd'),_0xa2b1b0,_0x57c655);_0x16ff53(_0x57c655);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 7799e0e..b184d22 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 _0xc351=['multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete'];(function(_0x496965,_0x2c5da3){var _0x2ffe82=function(_0x2d4fd5){while(--_0x2d4fd5){_0x496965['push'](_0x496965['shift']());}};_0x2ffe82(++_0x2c5da3);}(_0xc351,0x1cb));var _0x1c35=function(_0x56c4de,_0xf1c874){_0x56c4de=_0x56c4de-0x0;var _0xd799af=_0xc351[_0x56c4de];return _0xd799af;};'use strict';var multer=require(_0x1c35('0x0'));var util=require('util');var path=require(_0x1c35('0x1'));var timeout=require(_0x1c35('0x2'));var express=require('express');var router=express[_0x1c35('0x3')]();var fs_extra=require(_0x1c35('0x4'));var auth=require(_0x1c35('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1c35('0x6'));var controller=require(_0x1c35('0x7'));router[_0x1c35('0x8')]('/',auth[_0x1c35('0x9')](),controller[_0x1c35('0xa')]);router[_0x1c35('0x8')](_0x1c35('0xb'),auth[_0x1c35('0x9')](),controller[_0x1c35('0xc')]);router[_0x1c35('0xd')]('/',auth[_0x1c35('0x9')](),controller[_0x1c35('0xe')]);router[_0x1c35('0xf')]('/:id',auth[_0x1c35('0x9')](),controller['update']);router[_0x1c35('0x10')](_0x1c35('0xb'),auth[_0x1c35('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x407c=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./voiceContext.controller','get','isAuthenticated','index','/:id','show','post','delete','exports'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x407c,0xdd));var _0xc407=function(_0x1379a2,_0x15525e){_0x1379a2=_0x1379a2-0x0;var _0x304ded=_0x407c[_0x1379a2];return _0x304ded;};'use strict';var multer=require(_0xc407('0x0'));var util=require(_0xc407('0x1'));var path=require(_0xc407('0x2'));var timeout=require(_0xc407('0x3'));var express=require(_0xc407('0x4'));var router=express[_0xc407('0x5')]();var fs_extra=require(_0xc407('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xc407('0x7'));var config=require('../../config/environment');var controller=require(_0xc407('0x8'));router[_0xc407('0x9')]('/',auth[_0xc407('0xa')](),controller[_0xc407('0xb')]);router[_0xc407('0x9')](_0xc407('0xc'),auth[_0xc407('0xa')](),controller[_0xc407('0xd')]);router[_0xc407('0xe')]('/',auth[_0xc407('0xa')](),controller['create']);router['put'](_0xc407('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xc407('0xf')](_0xc407('0xc'),auth[_0xc407('0xa')](),controller['destroy']);module[_0xc407('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 596190e..cb01da7 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 _0x4472=['exports','STRING','name','sequelize'];(function(_0x83fd92,_0x5b36f1){var _0x381193=function(_0x5f2147){while(--_0x5f2147){_0x83fd92['push'](_0x83fd92['shift']());}};_0x381193(++_0x5b36f1);}(_0x4472,0x15f));var _0x2447=function(_0x54872a,_0x3a1c1e){_0x54872a=_0x54872a-0x0;var _0x3ef3cd=_0x4472[_0x54872a];return _0x3ef3cd;};'use strict';var Sequelize=require(_0x2447('0x0'));module[_0x2447('0x1')]={'name':{'type':Sequelize[_0x2447('0x2')],'unique':_0x2447('0x3')},'description':{'type':Sequelize[_0x2447('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x322d=['exports','STRING','sequelize'];(function(_0x49bcb6,_0x59536c){var _0x4677bc=function(_0x28d5a9){while(--_0x28d5a9){_0x49bcb6['push'](_0x49bcb6['shift']());}};_0x4677bc(++_0x59536c);}(_0x322d,0xc2));var _0xd322=function(_0x2b8d9e,_0x38f52a){_0x2b8d9e=_0x2b8d9e-0x0;var _0x380e14=_0x322d[_0x2b8d9e];return _0x380e14;};'use strict';var Sequelize=require(_0xd322('0x0'));module[_0xd322('0x1')]={'name':{'type':Sequelize[_0xd322('0x2')],'unique':'name'},'description':{'type':Sequelize[_0xd322('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 594edd6..beac3ae 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 _0xfe9d=['show','params','keys','intersection','find','create','readFileSync','root','server/files/templates/context.ejs','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','body','join','utf8','Reload','chan_sip.so','eml-format','rimraf','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','then','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','update','destroy','get','Contexts','stack','name','map','VoiceContext','rawAttributes','fieldName','type','key','model','filters','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows'];(function(_0x4854d6,_0x2f1264){var _0x3885c0=function(_0x4d564d){while(--_0x4d564d){_0x4854d6['push'](_0x4854d6['shift']());}};_0x3885c0(++_0x2f1264);}(_0xfe9d,0xe3));var _0xdfe9=function(_0x4d42ef,_0x4bb24f){_0x4d42ef=_0x4d42ef-0x0;var _0x87ee38=_0xfe9d[_0x4d42ef];return _0x87ee38;};'use strict';var emlformat=require(_0xdfe9('0x0'));var rimraf=require(_0xdfe9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xdfe9('0x2'));var BPromise=require(_0xdfe9('0x3'));var Mustache=require(_0xdfe9('0x4'));var util=require('util');var path=require(_0xdfe9('0x5'));var sox=require('sox');var csv=require(_0xdfe9('0x6'));var ejs=require(_0xdfe9('0x7'));var fs=require('fs');var fs_extra=require(_0xdfe9('0x8'));var _=require(_0xdfe9('0x9'));var squel=require(_0xdfe9('0xa'));var crypto=require(_0xdfe9('0xb'));var jsforce=require(_0xdfe9('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xdfe9('0x6'));var querystring=require(_0xdfe9('0xd'));var Papa=require(_0xdfe9('0xe'));var Redis=require('ioredis');var authService=require(_0xdfe9('0xf'));var qs=require(_0xdfe9('0x10'));var as=require(_0xdfe9('0x11'));var hardwareService=require(_0xdfe9('0x12'));var logger=require(_0xdfe9('0x13'))(_0xdfe9('0x14'));var utils=require(_0xdfe9('0x15'));var config=require(_0xdfe9('0x16'));var licenseUtil=require(_0xdfe9('0x17'));var db=require(_0xdfe9('0x18'))['db'];var jayson=require(_0xdfe9('0x19'));var client=jayson['client'][_0xdfe9('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x515de1,_0x3d4200,_0x38ceae,_0x264bf4){return new BPromise(function(_0x1a5c01,_0x5a1e4b){var _0x547af2=_0x264bf4||client;return _0x547af2['request'](_0x515de1,_0x38ceae)[_0xdfe9('0x1b')](function(_0xc2c7fc){logger[_0xdfe9('0x1c')]('VoiceContext,\x20%s,\x20%s',_0x3d4200,_0xdfe9('0x1d'));logger[_0xdfe9('0x1e')](_0xdfe9('0x1f'),_0x3d4200,_0xdfe9('0x1d'),JSON[_0xdfe9('0x20')](_0xc2c7fc));if(_0xc2c7fc[_0xdfe9('0x21')]){if(_0xc2c7fc[_0xdfe9('0x21')][_0xdfe9('0x22')]===0x1f4){logger[_0xdfe9('0x21')](_0xdfe9('0x23'),_0x3d4200,_0xc2c7fc[_0xdfe9('0x21')]['message']);return _0x5a1e4b(_0xc2c7fc['error']['message']);}logger[_0xdfe9('0x21')](_0xdfe9('0x23'),_0x3d4200,_0xc2c7fc[_0xdfe9('0x21')]['message']);return _0x1a5c01(_0xc2c7fc[_0xdfe9('0x21')][_0xdfe9('0x24')]);}else{logger[_0xdfe9('0x1c')](_0xdfe9('0x23'),_0x3d4200,_0xdfe9('0x1d'));_0x1a5c01(_0xc2c7fc[_0xdfe9('0x25')][_0xdfe9('0x24')]);}})[_0xdfe9('0x26')](function(_0x5bea9b){logger[_0xdfe9('0x21')](_0xdfe9('0x23'),_0x3d4200,_0x5bea9b);_0x5a1e4b(_0x5bea9b);});});}function respondWithStatusCode(_0x3c361c,_0x37f89c){_0x37f89c=_0x37f89c||0xcc;return function(_0xf1783){if(_0xf1783){return _0x3c361c[_0xdfe9('0x27')](_0x37f89c);}return _0x3c361c[_0xdfe9('0x28')](_0x37f89c)[_0xdfe9('0x29')]();};}function respondWithResult(_0x2d2941,_0x2359ee){_0x2359ee=_0x2359ee||0xc8;return function(_0x33e8e9){if(_0x33e8e9){return _0x2d2941['status'](_0x2359ee)[_0xdfe9('0x2a')](_0x33e8e9);}};}function respondWithFilteredResult(_0x46b600,_0x17fa95){return function(_0x55ae68){if(_0x55ae68){var _0xcd9991=typeof _0x17fa95[_0xdfe9('0x2b')]===_0xdfe9('0x2c')&&typeof _0x17fa95['limit']===_0xdfe9('0x2c');var _0x3fa6c9=_0x55ae68[_0xdfe9('0x2d')];var _0x444d0a=_0xcd9991?0x0:_0x17fa95[_0xdfe9('0x2b')];var _0x23104b=_0xcd9991?_0x55ae68['count']:_0x17fa95[_0xdfe9('0x2b')]+_0x17fa95[_0xdfe9('0x2e')];var _0x56e447;if(_0x23104b>=_0x3fa6c9){_0x23104b=_0x3fa6c9;_0x56e447=0xc8;}else{_0x56e447=0xce;}_0x46b600['status'](_0x56e447);return _0x46b600[_0xdfe9('0x2f')](_0xdfe9('0x30'),_0x444d0a+'-'+_0x23104b+'/'+_0x3fa6c9)['json'](_0x55ae68);}return null;};}function patchUpdates(_0x94b512){return function(_0x52b3fe){try{jsonpatch['apply'](_0x52b3fe,_0x94b512,!![]);}catch(_0x197da7){return BPromise['reject'](_0x197da7);}return _0x52b3fe['save']();};}function saveUpdates(_0x2baa5e,_0xe4ae0d){return function(_0x153b4b){if(_0x153b4b){return _0x153b4b[_0xdfe9('0x31')](_0x2baa5e)['then'](function(_0x150fcc){return _0x150fcc;});}return null;};}function removeEntity(_0x46ba93,_0x2855c2){return function(_0x2feefb){if(_0x2feefb){return _0x2feefb[_0xdfe9('0x32')]()[_0xdfe9('0x1b')](function(){var _0xe0c25a=_0x2feefb[_0xdfe9('0x33')]({'plain':!![]});var _0x1d8803=_0xdfe9('0x34');return db['UserProfileResource'][_0xdfe9('0x32')]({'where':{'type':_0x1d8803,'resourceId':_0xe0c25a['id']}})[_0xdfe9('0x1b')](function(){return _0x2feefb;});})[_0xdfe9('0x1b')](function(){_0x46ba93[_0xdfe9('0x28')](0xcc)[_0xdfe9('0x29')]();});}};}function handleEntityNotFound(_0x1911c3,_0x5331f6){return function(_0x1042a9){if(!_0x1042a9){_0x1911c3[_0xdfe9('0x27')](0x194);}return _0x1042a9;};}function handleError(_0x2fb4e6,_0x50be00){_0x50be00=_0x50be00||0x1f4;return function(_0x2315a1){logger[_0xdfe9('0x21')](_0x2315a1[_0xdfe9('0x35')]);if(_0x2315a1[_0xdfe9('0x36')]){delete _0x2315a1[_0xdfe9('0x36')];}_0x2fb4e6[_0xdfe9('0x28')](_0x50be00)['send'](_0x2315a1);};}exports['index']=function(_0xfa5af9,_0x19f249){var _0x1fad1a={},_0xa54c7a={},_0x1d3bce={'count':0x0,'rows':[]};var _0x1cb62e=_[_0xdfe9('0x37')](db[_0xdfe9('0x38')][_0xdfe9('0x39')],function(_0x27b6f9){return{'name':_0x27b6f9[_0xdfe9('0x3a')],'type':_0x27b6f9[_0xdfe9('0x3b')][_0xdfe9('0x3c')]};});_0xa54c7a[_0xdfe9('0x3d')]=_[_0xdfe9('0x37')](_0x1cb62e,_0xdfe9('0x36'));_0xa54c7a['query']=_['keys'](_0xfa5af9['query']);_0xa54c7a[_0xdfe9('0x3e')]=_['intersection'](_0xa54c7a[_0xdfe9('0x3d')],_0xa54c7a[_0xdfe9('0x3f')]);_0x1fad1a[_0xdfe9('0x40')]=_['intersection'](_0xa54c7a[_0xdfe9('0x3d')],qs[_0xdfe9('0x41')](_0xfa5af9['query'][_0xdfe9('0x41')]));_0x1fad1a['attributes']=_0x1fad1a[_0xdfe9('0x40')][_0xdfe9('0x42')]?_0x1fad1a[_0xdfe9('0x40')]:_0xa54c7a['model'];if(!_0xfa5af9[_0xdfe9('0x3f')][_0xdfe9('0x43')](_0xdfe9('0x44'))){_0x1fad1a[_0xdfe9('0x2e')]=qs[_0xdfe9('0x2e')](_0xfa5af9[_0xdfe9('0x3f')]['limit']);_0x1fad1a[_0xdfe9('0x2b')]=qs[_0xdfe9('0x2b')](_0xfa5af9['query'][_0xdfe9('0x2b')]);}_0x1fad1a['order']=qs[_0xdfe9('0x45')](_0xfa5af9[_0xdfe9('0x3f')]['sort']);_0x1fad1a[_0xdfe9('0x46')]=qs[_0xdfe9('0x3e')](_[_0xdfe9('0x47')](_0xfa5af9[_0xdfe9('0x3f')],_0xa54c7a[_0xdfe9('0x3e')]),_0x1cb62e);if(_0xfa5af9[_0xdfe9('0x3f')][_0xdfe9('0x48')]){_0x1fad1a[_0xdfe9('0x46')]=_['merge'](_0x1fad1a['where'],{'$or':_[_0xdfe9('0x37')](_0x1cb62e,function(_0x281615){if(_0x281615[_0xdfe9('0x3b')]!=='VIRTUAL'){var _0x45df37={};_0x45df37[_0x281615['name']]={'$like':'%'+_0xfa5af9[_0xdfe9('0x3f')]['filter']+'%'};return _0x45df37;}})});}_0x1fad1a=_[_0xdfe9('0x49')]({},_0x1fad1a,_0xfa5af9[_0xdfe9('0x4a')]);var _0x91d93c={'where':_0x1fad1a[_0xdfe9('0x46')]};return db[_0xdfe9('0x38')][_0xdfe9('0x2d')](_0x91d93c)[_0xdfe9('0x1b')](function(_0x5dd6d4){_0x1d3bce[_0xdfe9('0x2d')]=_0x5dd6d4;if(_0xfa5af9[_0xdfe9('0x3f')][_0xdfe9('0x4b')]){_0x1fad1a[_0xdfe9('0x4c')]=[{'all':!![]}];}return db[_0xdfe9('0x38')][_0xdfe9('0x4d')](_0x1fad1a);})[_0xdfe9('0x1b')](function(_0x28c71b){_0x1d3bce[_0xdfe9('0x4e')]=_0x28c71b;return _0x1d3bce;})[_0xdfe9('0x1b')](respondWithFilteredResult(_0x19f249,_0x1fad1a))[_0xdfe9('0x26')](handleError(_0x19f249,null));};exports[_0xdfe9('0x4f')]=function(_0x4259b0,_0x2bcc40){var _0x160879={'raw':![],'where':{'id':_0x4259b0[_0xdfe9('0x50')]['id']}},_0x2aba8a={};_0x2aba8a[_0xdfe9('0x3d')]=_[_0xdfe9('0x51')](db['VoiceContext']['rawAttributes']);_0x2aba8a['query']=_[_0xdfe9('0x51')](_0x4259b0[_0xdfe9('0x3f')]);_0x2aba8a['filters']=_[_0xdfe9('0x52')](_0x2aba8a[_0xdfe9('0x3d')],_0x2aba8a['query']);_0x160879['attributes']=_[_0xdfe9('0x52')](_0x2aba8a['model'],qs[_0xdfe9('0x41')](_0x4259b0[_0xdfe9('0x3f')]['fields']));_0x160879[_0xdfe9('0x40')]=_0x160879[_0xdfe9('0x40')][_0xdfe9('0x42')]?_0x160879[_0xdfe9('0x40')]:_0x2aba8a[_0xdfe9('0x3d')];if(_0x4259b0['query']['includeAll']){_0x160879[_0xdfe9('0x4c')]=[{'all':!![]}];}_0x160879=_[_0xdfe9('0x49')]({},_0x160879,_0x4259b0['options']);return db[_0xdfe9('0x38')][_0xdfe9('0x53')](_0x160879)[_0xdfe9('0x1b')](handleEntityNotFound(_0x2bcc40,null))[_0xdfe9('0x1b')](respondWithResult(_0x2bcc40,null))[_0xdfe9('0x26')](handleError(_0x2bcc40,null));};exports['create']=function(_0xab1d3,_0x5a33b1,_0x2b13d6){var _0x495b63;return db['VoiceContext'][_0xdfe9('0x54')](_0xab1d3['body'],{'raw':!![]})['then'](function(_0x52cd63){_0x495b63=_0x52cd63;return db['VoiceContext'][_0xdfe9('0x4d')]({'raw':!![]});})[_0xdfe9('0x1b')](function(_0x298335){var _0x38d402=fs[_0xdfe9('0x55')](path['join'](config[_0xdfe9('0x56')],_0xdfe9('0x57')),'utf8');var _0x17582e=ejs[_0xdfe9('0x58')](_0x38d402,{'contexts':_0x298335||[]});fs[_0xdfe9('0x59')](_0xdfe9('0x5a'),_0x17582e);})[_0xdfe9('0x1b')](function(){return respondWithRpcPromise('Reload',_0xdfe9('0x54'),{'module':'chan_sip.so'});})[_0xdfe9('0x1b')](function(){var _0x1bd0fe=_0xab1d3[_0xdfe9('0x5b')][_0xdfe9('0x33')]({'plain':!![]});if(!_0x1bd0fe)throw new Error(_0xdfe9('0x5c'));if(_0x1bd0fe['role']===_0xdfe9('0x5b')){var _0x488a8f=_0x495b63[_0xdfe9('0x33')]({'plain':!![]});return db[_0xdfe9('0x5d')][_0xdfe9('0x53')]({'where':{'name':_0xdfe9('0x34'),'userProfileId':_0x1bd0fe[_0xdfe9('0x5e')]},'raw':!![]})[_0xdfe9('0x1b')](function(_0x318f5d){if(_0x318f5d&&_0x318f5d[_0xdfe9('0x5f')]===0x0){return db[_0xdfe9('0x60')]['create']({'name':_0x488a8f[_0xdfe9('0x36')],'resourceId':_0x488a8f['id'],'type':_0x318f5d[_0xdfe9('0x36')],'sectionId':_0x318f5d['id']},{})[_0xdfe9('0x1b')](function(){return _0x495b63;});}else{return _0x495b63;}})['catch'](function(_0x768d72){logger[_0xdfe9('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x768d72);throw _0x768d72;});}return _0x495b63;})[_0xdfe9('0x1b')](respondWithResult(_0x5a33b1,0xc9))[_0xdfe9('0x26')](handleError(_0x5a33b1,null));};exports['update']=function(_0x5d2d63,_0xf6a67,_0x35052b){var _0x177044;return db[_0xdfe9('0x38')][_0xdfe9('0x53')]({'where':{'id':_0x5d2d63[_0xdfe9('0x50')]['id']}})[_0xdfe9('0x1b')](handleEntityNotFound(_0xf6a67,null))[_0xdfe9('0x1b')](saveUpdates(_0x5d2d63[_0xdfe9('0x61')],null))[_0xdfe9('0x1b')](function(_0x13d53f){if(_0x13d53f){_0x177044=_0x13d53f;return db['VoiceContext'][_0xdfe9('0x4d')]({'raw':!![]});}})[_0xdfe9('0x1b')](function(_0x3f282f){var _0x1aa523=fs[_0xdfe9('0x55')](path[_0xdfe9('0x62')](config['root'],_0xdfe9('0x57')),_0xdfe9('0x63'));var _0x4b011b=ejs[_0xdfe9('0x58')](_0x1aa523,{'contexts':_0x3f282f||[]});fs[_0xdfe9('0x59')](_0xdfe9('0x5a'),_0x4b011b);})[_0xdfe9('0x1b')](function(){return respondWithRpcPromise(_0xdfe9('0x64'),_0xdfe9('0x31'),{'module':_0xdfe9('0x65')});})[_0xdfe9('0x1b')](function(){return _0x177044;})[_0xdfe9('0x1b')](respondWithResult(_0xf6a67,null))['catch'](handleError(_0xf6a67,null));};exports[_0xdfe9('0x32')]=function(_0x560bec,_0x32987b,_0x33f35c){var _0x27cc88;return db[_0xdfe9('0x38')][_0xdfe9('0x53')]({'where':{'id':_0x560bec[_0xdfe9('0x50')]['id']}})['then'](handleEntityNotFound(_0x32987b,null))[_0xdfe9('0x1b')](removeEntity(_0x32987b,null))['then'](function(){return db[_0xdfe9('0x38')]['findAll']({'raw':!![]});})['then'](function(_0x383f29){var _0x17e4fc=fs[_0xdfe9('0x55')](path[_0xdfe9('0x62')](config[_0xdfe9('0x56')],_0xdfe9('0x57')),'utf8');var _0x3e4798=ejs[_0xdfe9('0x58')](_0x17e4fc,{'contexts':_0x383f29});fs['writeFileSync'](_0xdfe9('0x5a'),_0x3e4798);return respondWithRpcPromise(_0xdfe9('0x64'),_0xdfe9('0x32'),{'module':'chan_sip.so'});})[_0xdfe9('0x26')](handleError(_0x32987b,null));}; \ No newline at end of file +var _0x2ebe=['reject','update','destroy','UserProfileResource','stack','name','send','map','VoiceContext','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','type','merge','options','includeAll','include','findAll','rows','show','params','length','find','create','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','Reload','chan_sip.so','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Contexts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','/etc/asterisk/extensions_xcally_contexts.conf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','catch','sendStatus','end','status','json','undefined','limit','offset','count','set'];(function(_0x299bf3,_0x5c2955){var _0x13301e=function(_0x3fff22){while(--_0x3fff22){_0x299bf3['push'](_0x299bf3['shift']());}};_0x13301e(++_0x5c2955);}(_0x2ebe,0x174));var _0xe2eb=function(_0x378874,_0x4bfbf5){_0x378874=_0x378874-0x0;var _0xfe9bc4=_0x2ebe[_0x378874];return _0xfe9bc4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe2eb('0x0'));var zipdir=require(_0xe2eb('0x1'));var jsonpatch=require(_0xe2eb('0x2'));var rp=require(_0xe2eb('0x3'));var moment=require(_0xe2eb('0x4'));var BPromise=require(_0xe2eb('0x5'));var Mustache=require(_0xe2eb('0x6'));var util=require(_0xe2eb('0x7'));var path=require('path');var sox=require(_0xe2eb('0x8'));var csv=require(_0xe2eb('0x9'));var ejs=require(_0xe2eb('0xa'));var fs=require('fs');var fs_extra=require(_0xe2eb('0xb'));var _=require(_0xe2eb('0xc'));var squel=require('squel');var crypto=require(_0xe2eb('0xd'));var jsforce=require(_0xe2eb('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe2eb('0x9'));var querystring=require('querystring');var Papa=require(_0xe2eb('0xf'));var Redis=require(_0xe2eb('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xe2eb('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe2eb('0x12'));var logger=require(_0xe2eb('0x13'))(_0xe2eb('0x14'));var utils=require('../../config/utils');var config=require(_0xe2eb('0x15'));var licenseUtil=require(_0xe2eb('0x16'));var db=require(_0xe2eb('0x17'))['db'];var jayson=require(_0xe2eb('0x18'));var client=jayson[_0xe2eb('0x19')][_0xe2eb('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x21054e,_0x5ca59e,_0x480156,_0x3ece71){return new BPromise(function(_0x21f182,_0x74cbc){var _0x6247eb=_0x3ece71||client;return _0x6247eb[_0xe2eb('0x1b')](_0x21054e,_0x480156)[_0xe2eb('0x1c')](function(_0x86af9b){logger[_0xe2eb('0x1d')]('VoiceContext,\x20%s,\x20%s',_0x5ca59e,_0xe2eb('0x1e'));logger[_0xe2eb('0x1f')](_0xe2eb('0x20'),_0x5ca59e,_0xe2eb('0x1e'),JSON[_0xe2eb('0x21')](_0x86af9b));if(_0x86af9b['error']){if(_0x86af9b[_0xe2eb('0x22')][_0xe2eb('0x23')]===0x1f4){logger[_0xe2eb('0x22')](_0xe2eb('0x24'),_0x5ca59e,_0x86af9b[_0xe2eb('0x22')][_0xe2eb('0x25')]);return _0x74cbc(_0x86af9b[_0xe2eb('0x22')]['message']);}logger['error']('VoiceContext,\x20%s,\x20%s',_0x5ca59e,_0x86af9b[_0xe2eb('0x22')]['message']);return _0x21f182(_0x86af9b[_0xe2eb('0x22')][_0xe2eb('0x25')]);}else{logger[_0xe2eb('0x1d')](_0xe2eb('0x24'),_0x5ca59e,_0xe2eb('0x1e'));_0x21f182(_0x86af9b['result'][_0xe2eb('0x25')]);}})[_0xe2eb('0x26')](function(_0x5b9cd5){logger['error'](_0xe2eb('0x24'),_0x5ca59e,_0x5b9cd5);_0x74cbc(_0x5b9cd5);});});}function respondWithStatusCode(_0x4435e2,_0x10560e){_0x10560e=_0x10560e||0xcc;return function(_0x502f96){if(_0x502f96){return _0x4435e2[_0xe2eb('0x27')](_0x10560e);}return _0x4435e2['status'](_0x10560e)[_0xe2eb('0x28')]();};}function respondWithResult(_0x4bbeb1,_0x3cfafd){_0x3cfafd=_0x3cfafd||0xc8;return function(_0x2fb6fb){if(_0x2fb6fb){return _0x4bbeb1[_0xe2eb('0x29')](_0x3cfafd)[_0xe2eb('0x2a')](_0x2fb6fb);}};}function respondWithFilteredResult(_0x37f0d8,_0x4c1827){return function(_0x16c5f7){if(_0x16c5f7){var _0x210453=typeof _0x4c1827['offset']===_0xe2eb('0x2b')&&typeof _0x4c1827[_0xe2eb('0x2c')]==='undefined';var _0x565d5f=_0x16c5f7['count'];var _0x561b91=_0x210453?0x0:_0x4c1827[_0xe2eb('0x2d')];var _0x192493=_0x210453?_0x16c5f7[_0xe2eb('0x2e')]:_0x4c1827[_0xe2eb('0x2d')]+_0x4c1827['limit'];var _0x282f31;if(_0x192493>=_0x565d5f){_0x192493=_0x565d5f;_0x282f31=0xc8;}else{_0x282f31=0xce;}_0x37f0d8[_0xe2eb('0x29')](_0x282f31);return _0x37f0d8[_0xe2eb('0x2f')]('Content-Range',_0x561b91+'-'+_0x192493+'/'+_0x565d5f)[_0xe2eb('0x2a')](_0x16c5f7);}return null;};}function patchUpdates(_0x298945){return function(_0xa0c3a5){try{jsonpatch['apply'](_0xa0c3a5,_0x298945,!![]);}catch(_0x3bba3b){return BPromise[_0xe2eb('0x30')](_0x3bba3b);}return _0xa0c3a5['save']();};}function saveUpdates(_0x219559,_0x279361){return function(_0x322170){if(_0x322170){return _0x322170[_0xe2eb('0x31')](_0x219559)[_0xe2eb('0x1c')](function(_0x46e234){return _0x46e234;});}return null;};}function removeEntity(_0xb1d298,_0x5cbf8d){return function(_0x11ec01){if(_0x11ec01){return _0x11ec01[_0xe2eb('0x32')]()[_0xe2eb('0x1c')](function(){var _0x2b21ab=_0x11ec01['get']({'plain':!![]});var _0x26e89d='Contexts';return db[_0xe2eb('0x33')]['destroy']({'where':{'type':_0x26e89d,'resourceId':_0x2b21ab['id']}})[_0xe2eb('0x1c')](function(){return _0x11ec01;});})[_0xe2eb('0x1c')](function(){_0xb1d298[_0xe2eb('0x29')](0xcc)[_0xe2eb('0x28')]();});}};}function handleEntityNotFound(_0x5759f8,_0x350234){return function(_0x2b0ff8){if(!_0x2b0ff8){_0x5759f8[_0xe2eb('0x27')](0x194);}return _0x2b0ff8;};}function handleError(_0x3fba90,_0x3416c6){_0x3416c6=_0x3416c6||0x1f4;return function(_0x2412ce){logger['error'](_0x2412ce[_0xe2eb('0x34')]);if(_0x2412ce[_0xe2eb('0x35')]){delete _0x2412ce[_0xe2eb('0x35')];}_0x3fba90['status'](_0x3416c6)[_0xe2eb('0x36')](_0x2412ce);};}exports['index']=function(_0x59b51d,_0x417d06){var _0x4b691b={},_0x1b7fcf={},_0x1c4351={'count':0x0,'rows':[]};var _0x414107=_[_0xe2eb('0x37')](db[_0xe2eb('0x38')][_0xe2eb('0x39')],function(_0x1bae11){return{'name':_0x1bae11[_0xe2eb('0x3a')],'type':_0x1bae11['type'][_0xe2eb('0x3b')]};});_0x1b7fcf[_0xe2eb('0x3c')]=_['map'](_0x414107,_0xe2eb('0x35'));_0x1b7fcf[_0xe2eb('0x3d')]=_[_0xe2eb('0x3e')](_0x59b51d[_0xe2eb('0x3d')]);_0x1b7fcf[_0xe2eb('0x3f')]=_[_0xe2eb('0x40')](_0x1b7fcf[_0xe2eb('0x3c')],_0x1b7fcf[_0xe2eb('0x3d')]);_0x4b691b[_0xe2eb('0x41')]=_['intersection'](_0x1b7fcf[_0xe2eb('0x3c')],qs[_0xe2eb('0x42')](_0x59b51d['query']['fields']));_0x4b691b['attributes']=_0x4b691b[_0xe2eb('0x41')]['length']?_0x4b691b['attributes']:_0x1b7fcf[_0xe2eb('0x3c')];if(!_0x59b51d[_0xe2eb('0x3d')][_0xe2eb('0x43')](_0xe2eb('0x44'))){_0x4b691b[_0xe2eb('0x2c')]=qs['limit'](_0x59b51d['query']['limit']);_0x4b691b[_0xe2eb('0x2d')]=qs[_0xe2eb('0x2d')](_0x59b51d['query'][_0xe2eb('0x2d')]);}_0x4b691b[_0xe2eb('0x45')]=qs[_0xe2eb('0x46')](_0x59b51d[_0xe2eb('0x3d')]['sort']);_0x4b691b[_0xe2eb('0x47')]=qs[_0xe2eb('0x3f')](_[_0xe2eb('0x48')](_0x59b51d[_0xe2eb('0x3d')],_0x1b7fcf[_0xe2eb('0x3f')]),_0x414107);if(_0x59b51d['query']['filter']){_0x4b691b[_0xe2eb('0x47')]=_['merge'](_0x4b691b[_0xe2eb('0x47')],{'$or':_['map'](_0x414107,function(_0x3dc890){if(_0x3dc890[_0xe2eb('0x49')]!=='VIRTUAL'){var _0x202a0d={};_0x202a0d[_0x3dc890[_0xe2eb('0x35')]]={'$like':'%'+_0x59b51d[_0xe2eb('0x3d')]['filter']+'%'};return _0x202a0d;}})});}_0x4b691b=_[_0xe2eb('0x4a')]({},_0x4b691b,_0x59b51d[_0xe2eb('0x4b')]);var _0x314927={'where':_0x4b691b[_0xe2eb('0x47')]};return db[_0xe2eb('0x38')]['count'](_0x314927)['then'](function(_0x3b729b){_0x1c4351[_0xe2eb('0x2e')]=_0x3b729b;if(_0x59b51d[_0xe2eb('0x3d')][_0xe2eb('0x4c')]){_0x4b691b[_0xe2eb('0x4d')]=[{'all':!![]}];}return db[_0xe2eb('0x38')][_0xe2eb('0x4e')](_0x4b691b);})[_0xe2eb('0x1c')](function(_0x2615c3){_0x1c4351[_0xe2eb('0x4f')]=_0x2615c3;return _0x1c4351;})[_0xe2eb('0x1c')](respondWithFilteredResult(_0x417d06,_0x4b691b))[_0xe2eb('0x26')](handleError(_0x417d06,null));};exports[_0xe2eb('0x50')]=function(_0x4c651b,_0x4f316b){var _0x1ff98e={'raw':![],'where':{'id':_0x4c651b[_0xe2eb('0x51')]['id']}},_0x25896f={};_0x25896f['model']=_[_0xe2eb('0x3e')](db['VoiceContext'][_0xe2eb('0x39')]);_0x25896f[_0xe2eb('0x3d')]=_[_0xe2eb('0x3e')](_0x4c651b[_0xe2eb('0x3d')]);_0x25896f[_0xe2eb('0x3f')]=_['intersection'](_0x25896f[_0xe2eb('0x3c')],_0x25896f['query']);_0x1ff98e[_0xe2eb('0x41')]=_[_0xe2eb('0x40')](_0x25896f[_0xe2eb('0x3c')],qs['fields'](_0x4c651b[_0xe2eb('0x3d')]['fields']));_0x1ff98e[_0xe2eb('0x41')]=_0x1ff98e[_0xe2eb('0x41')][_0xe2eb('0x52')]?_0x1ff98e['attributes']:_0x25896f[_0xe2eb('0x3c')];if(_0x4c651b[_0xe2eb('0x3d')][_0xe2eb('0x4c')]){_0x1ff98e[_0xe2eb('0x4d')]=[{'all':!![]}];}_0x1ff98e=_[_0xe2eb('0x4a')]({},_0x1ff98e,_0x4c651b[_0xe2eb('0x4b')]);return db[_0xe2eb('0x38')][_0xe2eb('0x53')](_0x1ff98e)[_0xe2eb('0x1c')](handleEntityNotFound(_0x4f316b,null))[_0xe2eb('0x1c')](respondWithResult(_0x4f316b,null))[_0xe2eb('0x26')](handleError(_0x4f316b,null));};exports[_0xe2eb('0x54')]=function(_0x24d1f7,_0x3fbb58,_0x3a373c){var _0x5a4bf0;return db[_0xe2eb('0x38')][_0xe2eb('0x54')](_0x24d1f7['body'],{'raw':!![]})['then'](function(_0x34158c){_0x5a4bf0=_0x34158c;return db[_0xe2eb('0x38')]['findAll']({'raw':!![]});})[_0xe2eb('0x1c')](function(_0x2b4b80){var _0xbde0a5=fs[_0xe2eb('0x55')](path[_0xe2eb('0x56')](config[_0xe2eb('0x57')],_0xe2eb('0x58')),_0xe2eb('0x59'));var _0xe89e5=ejs[_0xe2eb('0x5a')](_0xbde0a5,{'contexts':_0x2b4b80||[]});fs[_0xe2eb('0x5b')]('/etc/asterisk/extensions_xcally_contexts.conf',_0xe89e5);})[_0xe2eb('0x1c')](function(){return respondWithRpcPromise(_0xe2eb('0x5c'),_0xe2eb('0x54'),{'module':_0xe2eb('0x5d')});})[_0xe2eb('0x1c')](function(){var _0x3d746f=_0x24d1f7[_0xe2eb('0x5e')][_0xe2eb('0x5f')]({'plain':!![]});if(!_0x3d746f)throw new Error(_0xe2eb('0x60'));if(_0x3d746f[_0xe2eb('0x61')]===_0xe2eb('0x5e')){var _0xa0bca3=_0x5a4bf0[_0xe2eb('0x5f')]({'plain':!![]});return db[_0xe2eb('0x62')][_0xe2eb('0x53')]({'where':{'name':_0xe2eb('0x63'),'userProfileId':_0x3d746f[_0xe2eb('0x64')]},'raw':!![]})[_0xe2eb('0x1c')](function(_0x2abc8f){if(_0x2abc8f&&_0x2abc8f[_0xe2eb('0x65')]===0x0){return db[_0xe2eb('0x33')][_0xe2eb('0x54')]({'name':_0xa0bca3[_0xe2eb('0x35')],'resourceId':_0xa0bca3['id'],'type':_0x2abc8f[_0xe2eb('0x35')],'sectionId':_0x2abc8f['id']},{})[_0xe2eb('0x1c')](function(){return _0x5a4bf0;});}else{return _0x5a4bf0;}})['catch'](function(_0x594e81){logger['error'](_0xe2eb('0x66'),_0x594e81);throw _0x594e81;});}return _0x5a4bf0;})['then'](respondWithResult(_0x3fbb58,0xc9))[_0xe2eb('0x26')](handleError(_0x3fbb58,null));};exports[_0xe2eb('0x31')]=function(_0x48da52,_0x18073d,_0x857d8e){var _0x1a57fd;return db[_0xe2eb('0x38')][_0xe2eb('0x53')]({'where':{'id':_0x48da52['params']['id']}})[_0xe2eb('0x1c')](handleEntityNotFound(_0x18073d,null))[_0xe2eb('0x1c')](saveUpdates(_0x48da52[_0xe2eb('0x67')],null))[_0xe2eb('0x1c')](function(_0x4f4d23){if(_0x4f4d23){_0x1a57fd=_0x4f4d23;return db[_0xe2eb('0x38')][_0xe2eb('0x4e')]({'raw':!![]});}})[_0xe2eb('0x1c')](function(_0x1b11ac){var _0x24d75d=fs[_0xe2eb('0x55')](path[_0xe2eb('0x56')](config[_0xe2eb('0x57')],_0xe2eb('0x58')),_0xe2eb('0x59'));var _0x22ad67=ejs[_0xe2eb('0x5a')](_0x24d75d,{'contexts':_0x1b11ac||[]});fs['writeFileSync'](_0xe2eb('0x68'),_0x22ad67);})[_0xe2eb('0x1c')](function(){return respondWithRpcPromise(_0xe2eb('0x5c'),_0xe2eb('0x31'),{'module':_0xe2eb('0x5d')});})[_0xe2eb('0x1c')](function(){return _0x1a57fd;})[_0xe2eb('0x1c')](respondWithResult(_0x18073d,null))['catch'](handleError(_0x18073d,null));};exports[_0xe2eb('0x32')]=function(_0x4e3f52,_0x1c864e,_0x513dee){var _0x1890b8;return db[_0xe2eb('0x38')][_0xe2eb('0x53')]({'where':{'id':_0x4e3f52[_0xe2eb('0x51')]['id']}})['then'](handleEntityNotFound(_0x1c864e,null))[_0xe2eb('0x1c')](removeEntity(_0x1c864e,null))['then'](function(){return db[_0xe2eb('0x38')][_0xe2eb('0x4e')]({'raw':!![]});})[_0xe2eb('0x1c')](function(_0x432800){var _0x599967=fs[_0xe2eb('0x55')](path[_0xe2eb('0x56')](config[_0xe2eb('0x57')],'server/files/templates/context.ejs'),'utf8');var _0x2387b0=ejs[_0xe2eb('0x5a')](_0x599967,{'contexts':_0x432800});fs[_0xe2eb('0x5b')](_0xe2eb('0x68'),_0x2387b0);return respondWithRpcPromise('Reload',_0xe2eb('0x32'),{'module':_0xe2eb('0x5d')});})['catch'](handleError(_0x1c864e,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 82f077f..7f6b877 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 _0x6abc=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceContext.attributes','exports','VoiceContext'];(function(_0x29fa3d,_0x45d24f){var _0x5d4bbf=function(_0x5b89ef){while(--_0x5b89ef){_0x29fa3d['push'](_0x29fa3d['shift']());}};_0x5d4bbf(++_0x45d24f);}(_0x6abc,0x9c));var _0xc6ab=function(_0x4966ff,_0x1f2858){_0x4966ff=_0x4966ff-0x0;var _0x35619b=_0x6abc[_0x4966ff];return _0x35619b;};'use strict';var _=require('lodash');var util=require(_0xc6ab('0x0'));var logger=require(_0xc6ab('0x1'))(_0xc6ab('0x2'));var moment=require(_0xc6ab('0x3'));var BPromise=require(_0xc6ab('0x4'));var rp=require(_0xc6ab('0x5'));var fs=require('fs');var path=require(_0xc6ab('0x6'));var rimraf=require(_0xc6ab('0x7'));var config=require(_0xc6ab('0x8'));var attributes=require(_0xc6ab('0x9'));module[_0xc6ab('0xa')]=function(_0x511c66,_0x50a80d){return _0x511c66['define'](_0xc6ab('0xb'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf7b4=['lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./voiceContext.attributes','exports','VoiceContext','voice_contexts'];(function(_0x5efe72,_0x2e9777){var _0x831761=function(_0x6dc433){while(--_0x6dc433){_0x5efe72['push'](_0x5efe72['shift']());}};_0x831761(++_0x2e9777);}(_0xf7b4,0x12c));var _0x4f7b=function(_0x53efa4,_0x1e673b){_0x53efa4=_0x53efa4-0x0;var _0x276274=_0xf7b4[_0x53efa4];return _0x276274;};'use strict';var _=require(_0x4f7b('0x0'));var util=require(_0x4f7b('0x1'));var logger=require(_0x4f7b('0x2'))('api');var moment=require('moment');var BPromise=require(_0x4f7b('0x3'));var rp=require(_0x4f7b('0x4'));var fs=require('fs');var path=require(_0x4f7b('0x5'));var rimraf=require(_0x4f7b('0x6'));var config=require(_0x4f7b('0x7'));var attributes=require(_0x4f7b('0x8'));module[_0x4f7b('0x9')]=function(_0x273691,_0x303f67){return _0x273691['define'](_0x4f7b('0xa'),attributes,{'tableName':_0x4f7b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index 4cb06f6..e34750b 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 _0xe35d=['rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x187d54,_0x30ea6b){var _0x1fcde9=function(_0x4776fc){while(--_0x4776fc){_0x187d54['push'](_0x187d54['shift']());}};_0x1fcde9(++_0x30ea6b);}(_0xe35d,0xd5));var _0xde35=function(_0x32aaa2,_0x3e4922){_0x32aaa2=_0x32aaa2-0x0;var _0x521d68=_0xe35d[_0x32aaa2];return _0x521d68;};'use strict';var _=require(_0xde35('0x0'));var util=require(_0xde35('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xde35('0x2'));var fs=require('fs');var Redis=require(_0xde35('0x3'));var db=require(_0xde35('0x4'))['db'];var utils=require(_0xde35('0x5'));var logger=require(_0xde35('0x6'))(_0xde35('0x7'));var config=require(_0xde35('0x8'));var jayson=require(_0xde35('0x9'));var client=jayson[_0xde35('0xa')][_0xde35('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x57c5a7,_0x1f0541,_0xe542e){return new BPromise(function(_0x3200e1,_0x25c8a1){return client[_0xde35('0xc')](_0x57c5a7,_0xe542e)['then'](function(_0xa3af60){logger[_0xde35('0xd')](_0xde35('0xe'),_0x1f0541,'request\x20sent');logger[_0xde35('0xf')](_0xde35('0x10'),_0x1f0541,'request\x20sent',JSON[_0xde35('0x11')](_0xa3af60));if(_0xa3af60['error']){if(_0xa3af60[_0xde35('0x12')]['code']===0x1f4){logger[_0xde35('0x12')]('VoiceContext,\x20%s,\x20%s',_0x1f0541,_0xa3af60['error']['message']);return _0x25c8a1(_0xa3af60['error']['message']);}logger[_0xde35('0x12')](_0xde35('0xe'),_0x1f0541,_0xa3af60['error']['message']);return _0x3200e1(_0xa3af60[_0xde35('0x12')][_0xde35('0x13')]);}else{logger[_0xde35('0xd')](_0xde35('0xe'),_0x1f0541,_0xde35('0x14'));_0x3200e1(_0xa3af60['result'][_0xde35('0x13')]);}})[_0xde35('0x15')](function(_0x274de6){logger[_0xde35('0x12')](_0xde35('0xe'),_0x1f0541,_0x274de6);_0x25c8a1(_0x274de6);});});} \ No newline at end of file +var _0xc48e=['VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0xc48e,0xd7));var _0xec48=function(_0x4cf219,_0x9f5d35){_0x4cf219=_0x4cf219-0x0;var _0x188dd4=_0xc48e[_0x4cf219];return _0x188dd4;};'use strict';var _=require(_0xec48('0x0'));var util=require('util');var moment=require(_0xec48('0x1'));var BPromise=require('bluebird');var rs=require(_0xec48('0x2'));var fs=require('fs');var Redis=require(_0xec48('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xec48('0x4'))(_0xec48('0x5'));var config=require(_0xec48('0x6'));var jayson=require(_0xec48('0x7'));var client=jayson[_0xec48('0x8')][_0xec48('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5e709e,_0x4f9a3b,_0x7e6ff7){return new BPromise(function(_0xa405a4,_0x391939){return client[_0xec48('0xa')](_0x5e709e,_0x7e6ff7)[_0xec48('0xb')](function(_0x3d869b){logger[_0xec48('0xc')](_0xec48('0xd'),_0x4f9a3b,_0xec48('0xe'));logger[_0xec48('0xf')](_0xec48('0x10'),_0x4f9a3b,'request\x20sent',JSON[_0xec48('0x11')](_0x3d869b));if(_0x3d869b[_0xec48('0x12')]){if(_0x3d869b[_0xec48('0x12')]['code']===0x1f4){logger[_0xec48('0x12')]('VoiceContext,\x20%s,\x20%s',_0x4f9a3b,_0x3d869b['error'][_0xec48('0x13')]);return _0x391939(_0x3d869b[_0xec48('0x12')][_0xec48('0x13')]);}logger[_0xec48('0x12')](_0xec48('0xd'),_0x4f9a3b,_0x3d869b[_0xec48('0x12')]['message']);return _0xa405a4(_0x3d869b[_0xec48('0x12')][_0xec48('0x13')]);}else{logger[_0xec48('0xc')](_0xec48('0xd'),_0x4f9a3b,'request\x20sent');_0xa405a4(_0x3d869b[_0xec48('0x14')]['message']);}})['catch'](function(_0x154876){logger[_0xec48('0x12')](_0xec48('0xd'),_0x4f9a3b,_0x154876);_0x391939(_0x154876);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 7d53e55..cab2277 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 _0xc62c=['get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc62c,0x1c2));var _0xcc62=function(_0x2b1194,_0xa3b63c){_0x2b1194=_0x2b1194-0x0;var _0x419c1c=_0xc62c[_0x2b1194];return _0x419c1c;};'use strict';var multer=require(_0xcc62('0x0'));var util=require(_0xcc62('0x1'));var path=require(_0xcc62('0x2'));var timeout=require(_0xcc62('0x3'));var express=require('express');var router=express[_0xcc62('0x4')]();var fs_extra=require(_0xcc62('0x5'));var auth=require(_0xcc62('0x6'));var interaction=require(_0xcc62('0x7'));var config=require(_0xcc62('0x8'));var controller=require(_0xcc62('0x9'));router[_0xcc62('0xa')]('/',auth[_0xcc62('0xb')](),controller[_0xcc62('0xc')]);router['get'](_0xcc62('0xd'),auth['isAuthenticated'](),controller[_0xcc62('0xe')]);router['get'](_0xcc62('0xf'),auth[_0xcc62('0xb')](),controller[_0xcc62('0x10')]);router[_0xcc62('0x11')]('/',auth[_0xcc62('0xb')](),controller[_0xcc62('0x12')]);router[_0xcc62('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xcc62('0x14')]);router['delete'](_0xcc62('0xf'),auth[_0xcc62('0xb')](),controller[_0xcc62('0x15')]);module[_0xcc62('0x16')]=router; \ No newline at end of file +var _0xd5be=['Router','fs-extra','../../components/auth/service','./voiceDialReport.controller','get','describe','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x1bf8ab,_0x387079){var _0x258385=function(_0x306186){while(--_0x306186){_0x1bf8ab['push'](_0x1bf8ab['shift']());}};_0x258385(++_0x387079);}(_0xd5be,0x1b4));var _0xed5b=function(_0x445c98,_0x132bf7){_0x445c98=_0x445c98-0x0;var _0x2fe913=_0xd5be[_0x445c98];return _0x2fe913;};'use strict';var multer=require(_0xed5b('0x0'));var util=require(_0xed5b('0x1'));var path=require(_0xed5b('0x2'));var timeout=require(_0xed5b('0x3'));var express=require(_0xed5b('0x4'));var router=express[_0xed5b('0x5')]();var fs_extra=require(_0xed5b('0x6'));var auth=require(_0xed5b('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xed5b('0x8'));router[_0xed5b('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xed5b('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xed5b('0xa')]);router[_0xed5b('0x9')]('/:id',auth[_0xed5b('0xb')](),controller[_0xed5b('0xc')]);router[_0xed5b('0xd')]('/',auth['isAuthenticated'](),controller[_0xed5b('0xe')]);router[_0xed5b('0xf')](_0xed5b('0x10'),auth[_0xed5b('0xb')](),controller[_0xed5b('0x11')]);router[_0xed5b('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xed5b('0x13')]);module[_0xed5b('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 5bc1cf4..f62717e 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(_0x3f55a9,_0x4f946c){var _0x14b097=function(_0x232927){while(--_0x232927){_0x3f55a9['push'](_0x3f55a9['shift']());}};_0x14b097(++_0x4f946c);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x506d5d,_0x2c94aa){_0x506d5d=_0x506d5d-0x0;var _0x2ceee5=_0x8d0e[_0x506d5d];return _0x2ceee5;};'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 _0x55ca=['exports','STRING','INTEGER','DATE','sequelize'];(function(_0x384d71,_0x2a5fa9){var _0x110420=function(_0x135c32){while(--_0x135c32){_0x384d71['push'](_0x384d71['shift']());}};_0x110420(++_0x2a5fa9);}(_0x55ca,0x126));var _0xa55c=function(_0x2183ca,_0x3778a9){_0x2183ca=_0x2183ca-0x0;var _0x21d00e=_0x55ca[_0x2183ca];return _0x21d00e;};'use strict';var Sequelize=require(_0xa55c('0x0'));module[_0xa55c('0x1')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xa55c('0x2')]},'calleridnum':{'type':Sequelize[_0xa55c('0x2')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xa55c('0x2')]},'connectedlinename':{'type':Sequelize[_0xa55c('0x2')]},'language':{'type':Sequelize[_0xa55c('0x2')]},'accountcode':{'type':Sequelize[_0xa55c('0x2')]},'context':{'type':Sequelize[_0xa55c('0x2')]},'exten':{'type':Sequelize[_0xa55c('0x2')]},'priority':{'type':Sequelize[_0xa55c('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xa55c('0x2')]},'destchannel':{'type':Sequelize[_0xa55c('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xa55c('0x2')]},'destcalleridnum':{'type':Sequelize[_0xa55c('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xa55c('0x2')]},'destlanguage':{'type':Sequelize[_0xa55c('0x2')]},'destaccountcode':{'type':Sequelize[_0xa55c('0x2')]},'destcontext':{'type':Sequelize[_0xa55c('0x2')]},'destexten':{'type':Sequelize[_0xa55c('0x2')]},'destpriority':{'type':Sequelize[_0xa55c('0x3')]},'destuniqueid':{'type':Sequelize[_0xa55c('0x2')]},'destlinkedid':{'type':Sequelize[_0xa55c('0x2')]},'dialstring':{'type':Sequelize[_0xa55c('0x2')]},'dialstatus':{'type':Sequelize[_0xa55c('0x2')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xa55c('0x4')]},'lastevent':{'type':Sequelize['STRING'],'comment':'called,connect,complete'},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize[_0xa55c('0x3')]},'holdtime':{'type':Sequelize[_0xa55c('0x3')]},'billableseconds':{'type':Sequelize[_0xa55c('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index f0af815..dd5392f 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 _0xca5a=['stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','VoiceDialReport','rows','catch','show','create','body','find','params','eml-format','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/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','end','error'];(function(_0xb0ef57,_0x22011d){var _0x3ddf63=function(_0x3aa64f){while(--_0x3aa64f){_0xb0ef57['push'](_0xb0ef57['shift']());}};_0x3ddf63(++_0x22011d);}(_0xca5a,0x1a5));var _0xaca5=function(_0x1c4006,_0x2524d4){_0x1c4006=_0x1c4006-0x0;var _0x19586e=_0xca5a[_0x1c4006];return _0x19586e;};'use strict';var emlformat=require(_0xaca5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xaca5('0x1'));var jsonpatch=require(_0xaca5('0x2'));var rp=require('request-promise');var moment=require(_0xaca5('0x3'));var BPromise=require(_0xaca5('0x4'));var Mustache=require(_0xaca5('0x5'));var util=require(_0xaca5('0x6'));var path=require(_0xaca5('0x7'));var sox=require(_0xaca5('0x8'));var csv=require(_0xaca5('0x9'));var ejs=require(_0xaca5('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaca5('0xb'));var squel=require(_0xaca5('0xc'));var crypto=require('crypto');var jsforce=require(_0xaca5('0xd'));var deskjs=require(_0xaca5('0xe'));var toCsv=require(_0xaca5('0x9'));var querystring=require(_0xaca5('0xf'));var Papa=require(_0xaca5('0x10'));var Redis=require(_0xaca5('0x11'));var authService=require(_0xaca5('0x12'));var qs=require(_0xaca5('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaca5('0x14'));var logger=require(_0xaca5('0x15'))('api');var utils=require(_0xaca5('0x16'));var config=require(_0xaca5('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xaca5('0x18'))['db'];function respondWithStatusCode(_0x1ba04a,_0x539225){_0x539225=_0x539225||0xcc;return function(_0x20097d){if(_0x20097d){return _0x1ba04a[_0xaca5('0x19')](_0x539225);}return _0x1ba04a['status'](_0x539225)['end']();};}function respondWithResult(_0x5d96ad,_0xd52cd1){_0xd52cd1=_0xd52cd1||0xc8;return function(_0x9297d2){if(_0x9297d2){return _0x5d96ad[_0xaca5('0x1a')](_0xd52cd1)[_0xaca5('0x1b')](_0x9297d2);}};}function respondWithFilteredResult(_0x2ea080,_0x17135d){return function(_0x2e4512){if(_0x2e4512){var _0x33085d=typeof _0x17135d['offset']===_0xaca5('0x1c')&&typeof _0x17135d[_0xaca5('0x1d')]===_0xaca5('0x1c');var _0x193ff7=_0x2e4512[_0xaca5('0x1e')];var _0x5d2da0=_0x33085d?0x0:_0x17135d['offset'];var _0xe50ccc=_0x33085d?_0x2e4512[_0xaca5('0x1e')]:_0x17135d[_0xaca5('0x1f')]+_0x17135d[_0xaca5('0x1d')];var _0x19cca3;if(_0xe50ccc>=_0x193ff7){_0xe50ccc=_0x193ff7;_0x19cca3=0xc8;}else{_0x19cca3=0xce;}_0x2ea080[_0xaca5('0x1a')](_0x19cca3);return _0x2ea080[_0xaca5('0x20')](_0xaca5('0x21'),_0x5d2da0+'-'+_0xe50ccc+'/'+_0x193ff7)[_0xaca5('0x1b')](_0x2e4512);}return null;};}function patchUpdates(_0x1efcd7){return function(_0x5f0eba){try{jsonpatch['apply'](_0x5f0eba,_0x1efcd7,!![]);}catch(_0xe711e2){return BPromise[_0xaca5('0x22')](_0xe711e2);}return _0x5f0eba[_0xaca5('0x23')]();};}function saveUpdates(_0x57490a,_0x2e6c3c){return function(_0x2cdeac){if(_0x2cdeac){return _0x2cdeac[_0xaca5('0x24')](_0x57490a)[_0xaca5('0x25')](function(_0x5946b6){return _0x5946b6;});}return null;};}function removeEntity(_0x5bcea4,_0x179023){return function(_0x2947d0){if(_0x2947d0){return _0x2947d0[_0xaca5('0x26')]()[_0xaca5('0x25')](function(){_0x5bcea4[_0xaca5('0x1a')](0xcc)[_0xaca5('0x27')]();});}};}function handleEntityNotFound(_0xdc072,_0x253adc){return function(_0x2eab40){if(!_0x2eab40){_0xdc072[_0xaca5('0x19')](0x194);}return _0x2eab40;};}function handleError(_0x45aa04,_0x437490){_0x437490=_0x437490||0x1f4;return function(_0x3e2d1){logger[_0xaca5('0x28')](_0x3e2d1[_0xaca5('0x29')]);if(_0x3e2d1[_0xaca5('0x2a')]){delete _0x3e2d1['name'];}_0x45aa04[_0xaca5('0x1a')](_0x437490)[_0xaca5('0x2b')](_0x3e2d1);};}exports[_0xaca5('0x2c')]=function(_0x245523,_0x361a37){var _0x3f4d7e={},_0x1708fe={},_0x23d87f={'count':0x0,'rows':[]};var _0x22c441=_['map'](db['VoiceDialReport'][_0xaca5('0x2d')],function(_0xb062ed){return{'name':_0xb062ed[_0xaca5('0x2e')],'type':_0xb062ed[_0xaca5('0x2f')][_0xaca5('0x30')]};});_0x1708fe[_0xaca5('0x31')]=_[_0xaca5('0x32')](_0x22c441,'name');_0x1708fe[_0xaca5('0x33')]=_[_0xaca5('0x34')](_0x245523['query']);_0x1708fe[_0xaca5('0x35')]=_['intersection'](_0x1708fe[_0xaca5('0x31')],_0x1708fe['query']);_0x3f4d7e[_0xaca5('0x36')]=_[_0xaca5('0x37')](_0x1708fe[_0xaca5('0x31')],qs[_0xaca5('0x38')](_0x245523[_0xaca5('0x33')]['fields']));_0x3f4d7e[_0xaca5('0x36')]=_0x3f4d7e[_0xaca5('0x36')][_0xaca5('0x39')]?_0x3f4d7e[_0xaca5('0x36')]:_0x1708fe[_0xaca5('0x31')];if(!_0x245523['query'][_0xaca5('0x3a')]('nolimit')){_0x3f4d7e[_0xaca5('0x1d')]=qs[_0xaca5('0x1d')](_0x245523[_0xaca5('0x33')][_0xaca5('0x1d')]);_0x3f4d7e[_0xaca5('0x1f')]=qs[_0xaca5('0x1f')](_0x245523['query'][_0xaca5('0x1f')]);}_0x3f4d7e[_0xaca5('0x3b')]=qs['sort'](_0x245523[_0xaca5('0x33')][_0xaca5('0x3c')]);_0x3f4d7e[_0xaca5('0x3d')]=qs[_0xaca5('0x35')](_[_0xaca5('0x3e')](_0x245523[_0xaca5('0x33')],_0x1708fe[_0xaca5('0x35')]),_0x22c441);if(_0x245523[_0xaca5('0x33')][_0xaca5('0x3f')]){_0x3f4d7e[_0xaca5('0x3d')]=_[_0xaca5('0x40')](_0x3f4d7e[_0xaca5('0x3d')],{'$or':_[_0xaca5('0x32')](_0x22c441,function(_0x51d557){if(_0x51d557[_0xaca5('0x2f')]!==_0xaca5('0x41')){var _0x504341={};_0x504341[_0x51d557[_0xaca5('0x2a')]]={'$like':'%'+_0x245523[_0xaca5('0x33')][_0xaca5('0x3f')]+'%'};return _0x504341;}})});}_0x3f4d7e=_[_0xaca5('0x40')]({},_0x3f4d7e,_0x245523[_0xaca5('0x42')]);var _0x2a4986={'where':_0x3f4d7e[_0xaca5('0x3d')]};return db['VoiceDialReport']['count'](_0x2a4986)[_0xaca5('0x25')](function(_0x597262){_0x23d87f[_0xaca5('0x1e')]=_0x597262;if(_0x245523['query'][_0xaca5('0x43')]){_0x3f4d7e[_0xaca5('0x44')]=[{'all':!![]}];}return db[_0xaca5('0x45')]['findAll'](_0x3f4d7e);})[_0xaca5('0x25')](function(_0x2ec764){_0x23d87f[_0xaca5('0x46')]=_0x2ec764;return _0x23d87f;})[_0xaca5('0x25')](respondWithFilteredResult(_0x361a37,_0x3f4d7e))[_0xaca5('0x47')](handleError(_0x361a37,null));};exports[_0xaca5('0x48')]=function(_0x2e470e,_0x391c9e){var _0x2157b4={'raw':!![],'where':{'id':_0x2e470e['params']['id']}},_0x17f491={};_0x17f491['model']=_[_0xaca5('0x34')](db[_0xaca5('0x45')][_0xaca5('0x2d')]);_0x17f491['query']=_['keys'](_0x2e470e[_0xaca5('0x33')]);_0x17f491[_0xaca5('0x35')]=_[_0xaca5('0x37')](_0x17f491[_0xaca5('0x31')],_0x17f491[_0xaca5('0x33')]);_0x2157b4[_0xaca5('0x36')]=_[_0xaca5('0x37')](_0x17f491[_0xaca5('0x31')],qs[_0xaca5('0x38')](_0x2e470e[_0xaca5('0x33')][_0xaca5('0x38')]));_0x2157b4['attributes']=_0x2157b4[_0xaca5('0x36')]['length']?_0x2157b4[_0xaca5('0x36')]:_0x17f491[_0xaca5('0x31')];if(_0x2e470e[_0xaca5('0x33')]['includeAll']){_0x2157b4[_0xaca5('0x44')]=[{'all':!![]}];}_0x2157b4=_[_0xaca5('0x40')]({},_0x2157b4,_0x2e470e[_0xaca5('0x42')]);return db[_0xaca5('0x45')]['find'](_0x2157b4)[_0xaca5('0x25')](handleEntityNotFound(_0x391c9e,null))[_0xaca5('0x25')](respondWithResult(_0x391c9e,null))[_0xaca5('0x47')](handleError(_0x391c9e,null));};exports[_0xaca5('0x49')]=function(_0x4f70cf,_0x22f24d){return db[_0xaca5('0x45')][_0xaca5('0x49')](_0x4f70cf[_0xaca5('0x4a')],{})[_0xaca5('0x25')](respondWithResult(_0x22f24d,0xc9))[_0xaca5('0x47')](handleError(_0x22f24d,null));};exports[_0xaca5('0x24')]=function(_0x6e70ba,_0x4f6fcf){if(_0x6e70ba[_0xaca5('0x4a')]['id']){delete _0x6e70ba[_0xaca5('0x4a')]['id'];}return db[_0xaca5('0x45')][_0xaca5('0x4b')]({'where':{'id':_0x6e70ba[_0xaca5('0x4c')]['id']}})[_0xaca5('0x25')](handleEntityNotFound(_0x4f6fcf,null))[_0xaca5('0x25')](saveUpdates(_0x6e70ba['body'],null))[_0xaca5('0x25')](respondWithResult(_0x4f6fcf,null))[_0xaca5('0x47')](handleError(_0x4f6fcf,null));};exports[_0xaca5('0x26')]=function(_0x5c2a78,_0x15b3dc){return db[_0xaca5('0x45')][_0xaca5('0x4b')]({'where':{'id':_0x5c2a78[_0xaca5('0x4c')]['id']}})['then'](handleEntityNotFound(_0x15b3dc,null))[_0xaca5('0x25')](removeEntity(_0x15b3dc,null))[_0xaca5('0x47')](handleError(_0x15b3dc,null));};exports['describe']=function(_0x42cbd4,_0x3b022d){return db[_0xaca5('0x45')]['describe']()['then'](respondWithResult(_0x3b022d,null))['catch'](handleError(_0x3b022d,null));}; \ No newline at end of file +var _0x6af5=['show','params','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','count','limit','status','set','apply','save','update','then','end','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','order','sort','where','pick','filter','merge','options','VoiceDialReport','includeAll','rows'];(function(_0x188330,_0x3e7b90){var _0x4a5598=function(_0x2c43f6){while(--_0x2c43f6){_0x188330['push'](_0x188330['shift']());}};_0x4a5598(++_0x3e7b90);}(_0x6af5,0x1b1));var _0x56af=function(_0x42bc91,_0x41f40a){_0x42bc91=_0x42bc91-0x0;var _0x3f5507=_0x6af5[_0x42bc91];return _0x3f5507;};'use strict';var emlformat=require(_0x56af('0x0'));var rimraf=require(_0x56af('0x1'));var zipdir=require(_0x56af('0x2'));var jsonpatch=require(_0x56af('0x3'));var rp=require(_0x56af('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x56af('0x5'));var util=require('util');var path=require(_0x56af('0x6'));var sox=require(_0x56af('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x56af('0x8'));var _=require(_0x56af('0x9'));var squel=require(_0x56af('0xa'));var crypto=require('crypto');var jsforce=require(_0x56af('0xb'));var deskjs=require(_0x56af('0xc'));var toCsv=require(_0x56af('0xd'));var querystring=require(_0x56af('0xe'));var Papa=require(_0x56af('0xf'));var Redis=require('ioredis');var authService=require(_0x56af('0x10'));var qs=require(_0x56af('0x11'));var as=require(_0x56af('0x12'));var hardwareService=require(_0x56af('0x13'));var logger=require('../../config/logger')(_0x56af('0x14'));var utils=require(_0x56af('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x56af('0x16'));var db=require(_0x56af('0x17'))['db'];function respondWithStatusCode(_0x581f3d,_0xdac63d){_0xdac63d=_0xdac63d||0xcc;return function(_0xb1b0b3){if(_0xb1b0b3){return _0x581f3d[_0x56af('0x18')](_0xdac63d);}return _0x581f3d['status'](_0xdac63d)['end']();};}function respondWithResult(_0x27e95c,_0x4b0acc){_0x4b0acc=_0x4b0acc||0xc8;return function(_0x5abce8){if(_0x5abce8){return _0x27e95c['status'](_0x4b0acc)[_0x56af('0x19')](_0x5abce8);}};}function respondWithFilteredResult(_0x1f2dbe,_0x43fce8){return function(_0x2230b5){if(_0x2230b5){var _0x576ec9=typeof _0x43fce8[_0x56af('0x1a')]===_0x56af('0x1b')&&typeof _0x43fce8['limit']===_0x56af('0x1b');var _0x4fab67=_0x2230b5['count'];var _0x852b69=_0x576ec9?0x0:_0x43fce8[_0x56af('0x1a')];var _0x3a30fb=_0x576ec9?_0x2230b5[_0x56af('0x1c')]:_0x43fce8['offset']+_0x43fce8[_0x56af('0x1d')];var _0x2018b8;if(_0x3a30fb>=_0x4fab67){_0x3a30fb=_0x4fab67;_0x2018b8=0xc8;}else{_0x2018b8=0xce;}_0x1f2dbe[_0x56af('0x1e')](_0x2018b8);return _0x1f2dbe[_0x56af('0x1f')]('Content-Range',_0x852b69+'-'+_0x3a30fb+'/'+_0x4fab67)[_0x56af('0x19')](_0x2230b5);}return null;};}function patchUpdates(_0x31bd70){return function(_0x4e4bfe){try{jsonpatch[_0x56af('0x20')](_0x4e4bfe,_0x31bd70,!![]);}catch(_0x5727e7){return BPromise['reject'](_0x5727e7);}return _0x4e4bfe[_0x56af('0x21')]();};}function saveUpdates(_0x3d7a3c,_0x58df18){return function(_0x379d4a){if(_0x379d4a){return _0x379d4a[_0x56af('0x22')](_0x3d7a3c)[_0x56af('0x23')](function(_0x4aa5ff){return _0x4aa5ff;});}return null;};}function removeEntity(_0x4fd604,_0x2551c4){return function(_0x48e4ae){if(_0x48e4ae){return _0x48e4ae['destroy']()[_0x56af('0x23')](function(){_0x4fd604[_0x56af('0x1e')](0xcc)[_0x56af('0x24')]();});}};}function handleEntityNotFound(_0x2ce305,_0xab91cb){return function(_0x5a9285){if(!_0x5a9285){_0x2ce305[_0x56af('0x18')](0x194);}return _0x5a9285;};}function handleError(_0x2d2e55,_0x1d8742){_0x1d8742=_0x1d8742||0x1f4;return function(_0x2e2e65){logger[_0x56af('0x25')](_0x2e2e65[_0x56af('0x26')]);if(_0x2e2e65[_0x56af('0x27')]){delete _0x2e2e65['name'];}_0x2d2e55[_0x56af('0x1e')](_0x1d8742)['send'](_0x2e2e65);};}exports[_0x56af('0x28')]=function(_0x428d41,_0x4f3ca2){var _0x1a89f2={},_0xae7da0={},_0x4f39c6={'count':0x0,'rows':[]};var _0x48db9f=_[_0x56af('0x29')](db['VoiceDialReport'][_0x56af('0x2a')],function(_0x4c2892){return{'name':_0x4c2892[_0x56af('0x2b')],'type':_0x4c2892[_0x56af('0x2c')][_0x56af('0x2d')]};});_0xae7da0[_0x56af('0x2e')]=_[_0x56af('0x29')](_0x48db9f,_0x56af('0x27'));_0xae7da0[_0x56af('0x2f')]=_[_0x56af('0x30')](_0x428d41['query']);_0xae7da0[_0x56af('0x31')]=_[_0x56af('0x32')](_0xae7da0['model'],_0xae7da0[_0x56af('0x2f')]);_0x1a89f2['attributes']=_[_0x56af('0x32')](_0xae7da0[_0x56af('0x2e')],qs[_0x56af('0x33')](_0x428d41[_0x56af('0x2f')][_0x56af('0x33')]));_0x1a89f2[_0x56af('0x34')]=_0x1a89f2['attributes'][_0x56af('0x35')]?_0x1a89f2['attributes']:_0xae7da0[_0x56af('0x2e')];if(!_0x428d41['query']['hasOwnProperty']('nolimit')){_0x1a89f2[_0x56af('0x1d')]=qs[_0x56af('0x1d')](_0x428d41[_0x56af('0x2f')]['limit']);_0x1a89f2['offset']=qs['offset'](_0x428d41[_0x56af('0x2f')][_0x56af('0x1a')]);}_0x1a89f2[_0x56af('0x36')]=qs[_0x56af('0x37')](_0x428d41[_0x56af('0x2f')][_0x56af('0x37')]);_0x1a89f2[_0x56af('0x38')]=qs[_0x56af('0x31')](_[_0x56af('0x39')](_0x428d41[_0x56af('0x2f')],_0xae7da0['filters']),_0x48db9f);if(_0x428d41[_0x56af('0x2f')][_0x56af('0x3a')]){_0x1a89f2['where']=_[_0x56af('0x3b')](_0x1a89f2[_0x56af('0x38')],{'$or':_[_0x56af('0x29')](_0x48db9f,function(_0x606dc){if(_0x606dc[_0x56af('0x2c')]!=='VIRTUAL'){var _0xb0679a={};_0xb0679a[_0x606dc[_0x56af('0x27')]]={'$like':'%'+_0x428d41[_0x56af('0x2f')][_0x56af('0x3a')]+'%'};return _0xb0679a;}})});}_0x1a89f2=_[_0x56af('0x3b')]({},_0x1a89f2,_0x428d41[_0x56af('0x3c')]);var _0x55a529={'where':_0x1a89f2[_0x56af('0x38')]};return db[_0x56af('0x3d')][_0x56af('0x1c')](_0x55a529)[_0x56af('0x23')](function(_0x2d191d){_0x4f39c6[_0x56af('0x1c')]=_0x2d191d;if(_0x428d41[_0x56af('0x2f')][_0x56af('0x3e')]){_0x1a89f2['include']=[{'all':!![]}];}return db[_0x56af('0x3d')]['findAll'](_0x1a89f2);})[_0x56af('0x23')](function(_0xc2206){_0x4f39c6[_0x56af('0x3f')]=_0xc2206;return _0x4f39c6;})['then'](respondWithFilteredResult(_0x4f3ca2,_0x1a89f2))['catch'](handleError(_0x4f3ca2,null));};exports[_0x56af('0x40')]=function(_0x54ff28,_0x528da8){var _0x44a518={'raw':!![],'where':{'id':_0x54ff28[_0x56af('0x41')]['id']}},_0x222adc={};_0x222adc['model']=_['keys'](db[_0x56af('0x3d')][_0x56af('0x2a')]);_0x222adc[_0x56af('0x2f')]=_['keys'](_0x54ff28[_0x56af('0x2f')]);_0x222adc['filters']=_['intersection'](_0x222adc[_0x56af('0x2e')],_0x222adc['query']);_0x44a518['attributes']=_[_0x56af('0x32')](_0x222adc[_0x56af('0x2e')],qs['fields'](_0x54ff28['query']['fields']));_0x44a518[_0x56af('0x34')]=_0x44a518[_0x56af('0x34')][_0x56af('0x35')]?_0x44a518[_0x56af('0x34')]:_0x222adc[_0x56af('0x2e')];if(_0x54ff28[_0x56af('0x2f')][_0x56af('0x3e')]){_0x44a518['include']=[{'all':!![]}];}_0x44a518=_[_0x56af('0x3b')]({},_0x44a518,_0x54ff28[_0x56af('0x3c')]);return db[_0x56af('0x3d')][_0x56af('0x42')](_0x44a518)['then'](handleEntityNotFound(_0x528da8,null))[_0x56af('0x23')](respondWithResult(_0x528da8,null))[_0x56af('0x43')](handleError(_0x528da8,null));};exports['create']=function(_0x5da613,_0x756fc3){return db[_0x56af('0x3d')][_0x56af('0x44')](_0x5da613[_0x56af('0x45')],{})[_0x56af('0x23')](respondWithResult(_0x756fc3,0xc9))['catch'](handleError(_0x756fc3,null));};exports[_0x56af('0x22')]=function(_0x35f21e,_0x5332b5){if(_0x35f21e[_0x56af('0x45')]['id']){delete _0x35f21e['body']['id'];}return db[_0x56af('0x3d')][_0x56af('0x42')]({'where':{'id':_0x35f21e[_0x56af('0x41')]['id']}})[_0x56af('0x23')](handleEntityNotFound(_0x5332b5,null))[_0x56af('0x23')](saveUpdates(_0x35f21e[_0x56af('0x45')],null))[_0x56af('0x23')](respondWithResult(_0x5332b5,null))[_0x56af('0x43')](handleError(_0x5332b5,null));};exports['destroy']=function(_0x5bc573,_0x307234){return db[_0x56af('0x3d')][_0x56af('0x42')]({'where':{'id':_0x5bc573[_0x56af('0x41')]['id']}})[_0x56af('0x23')](handleEntityNotFound(_0x307234,null))['then'](removeEntity(_0x307234,null))['catch'](handleError(_0x307234,null));};exports[_0x56af('0x46')]=function(_0x583cda,_0x2de889){return db['VoiceDialReport']['describe']()['then'](respondWithResult(_0x2de889,null))[_0x56af('0x43')](handleError(_0x2de889,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 7ff55a1..8dd2492 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 _0x750c=['./voiceDialReport.attributes','exports','define','VoiceDialReport','util','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0x651909,_0x15c6b4){var _0x572299=function(_0x5e8a48){while(--_0x5e8a48){_0x651909['push'](_0x651909['shift']());}};_0x572299(++_0x15c6b4);}(_0x750c,0x1d2));var _0xc750=function(_0x45c712,_0x2e68b2){_0x45c712=_0x45c712-0x0;var _0xb612e0=_0x750c[_0x45c712];return _0xb612e0;};'use strict';var _=require('lodash');var util=require(_0xc750('0x0'));var logger=require(_0xc750('0x1'))(_0xc750('0x2'));var moment=require(_0xc750('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc750('0x4'));var rimraf=require(_0xc750('0x5'));var config=require(_0xc750('0x6'));var attributes=require(_0xc750('0x7'));module[_0xc750('0x8')]=function(_0x59c655,_0x53111a){return _0x59c655[_0xc750('0x9')](_0xc750('0xa'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe5f6=['report_dial','uniqueid','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe5f6,0xc2));var _0x6e5f=function(_0x2c6b3e,_0xbee7e7){_0x2c6b3e=_0x2c6b3e-0x0;var _0x5bf359=_0xe5f6[_0x2c6b3e];return _0x5bf359;};'use strict';var _=require(_0x6e5f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6e5f('0x1'));var moment=require(_0x6e5f('0x2'));var BPromise=require(_0x6e5f('0x3'));var rp=require(_0x6e5f('0x4'));var fs=require('fs');var path=require(_0x6e5f('0x5'));var rimraf=require(_0x6e5f('0x6'));var config=require(_0x6e5f('0x7'));var attributes=require(_0x6e5f('0x8'));module['exports']=function(_0x5a38aa,_0x2b43a8){return _0x5a38aa[_0x6e5f('0x9')]('VoiceDialReport',attributes,{'tableName':_0x6e5f('0xa'),'paranoid':![],'indexes':[{'fields':[_0x6e5f('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 6cc3f53..89f37ba 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 _0x076f=['result','catch','VoiceDialReport','create','body','options','raw','then','CreateVoiceDialReport','UpdateVoiceDialReport','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x42858b,_0x4eba05){var _0x731031=function(_0x57538d){while(--_0x57538d){_0x42858b['push'](_0x42858b['shift']());}};_0x731031(++_0x4eba05);}(_0x076f,0x9b));var _0xf076=function(_0xba0c2,_0x54cc50){_0xba0c2=_0xba0c2-0x0;var _0x5a9fa0=_0x076f[_0xba0c2];return _0x5a9fa0;};'use strict';var _=require(_0xf076('0x0'));var util=require('util');var moment=require(_0xf076('0x1'));var BPromise=require(_0xf076('0x2'));var rs=require(_0xf076('0x3'));var fs=require('fs');var Redis=require(_0xf076('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf076('0x5'));var logger=require(_0xf076('0x6'))(_0xf076('0x7'));var config=require(_0xf076('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf076('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xb66978,_0x439efc,_0x224cf5){return new BPromise(function(_0x3e61ab,_0x1910bb){return client['request'](_0xb66978,_0x224cf5)['then'](function(_0x40d946){logger[_0xf076('0xa')](_0xf076('0xb'),_0x439efc,_0xf076('0xc'));logger[_0xf076('0xd')](_0xf076('0xe'),_0x439efc,'request\x20sent',JSON[_0xf076('0xf')](_0x40d946));if(_0x40d946[_0xf076('0x10')]){if(_0x40d946['error'][_0xf076('0x11')]===0x1f4){logger[_0xf076('0x10')](_0xf076('0xb'),_0x439efc,_0x40d946[_0xf076('0x10')]['message']);return _0x1910bb(_0x40d946[_0xf076('0x10')][_0xf076('0x12')]);}logger[_0xf076('0x10')](_0xf076('0xb'),_0x439efc,_0x40d946['error'][_0xf076('0x12')]);return _0x3e61ab(_0x40d946['error'][_0xf076('0x12')]);}else{logger['info']('VoiceDialReport,\x20%s,\x20%s',_0x439efc,'request\x20sent');_0x3e61ab(_0x40d946[_0xf076('0x13')][_0xf076('0x12')]);}})[_0xf076('0x14')](function(_0x525cdc){logger['error'](_0xf076('0xb'),_0x439efc,_0x525cdc);_0x1910bb(_0x525cdc);});});}exports['CreateVoiceDialReport']=function(_0x58d655){var _0x1bd4f2=this;return new Promise(function(_0x78cf99,_0x186b4d){return db[_0xf076('0x15')][_0xf076('0x16')](_0x58d655[_0xf076('0x17')],{'raw':_0x58d655[_0xf076('0x18')]?_0x58d655[_0xf076('0x18')][_0xf076('0x19')]===undefined?!![]:![]:!![]})[_0xf076('0x1a')](function(_0xabe8f9){logger[_0xf076('0xa')](_0xf076('0x1b'),_0x58d655);logger[_0xf076('0xd')]('CreateVoiceDialReport',_0x58d655,JSON[_0xf076('0xf')](_0xabe8f9));_0x78cf99(_0xabe8f9);})[_0xf076('0x14')](function(_0x534bc4){logger[_0xf076('0x10')]('CreateVoiceDialReport',_0x534bc4[_0xf076('0x12')],_0x58d655);_0x186b4d(_0x1bd4f2[_0xf076('0x10')](0x1f4,_0x534bc4[_0xf076('0x12')]));});});};exports[_0xf076('0x1c')]=function(_0x1623c9){var _0x265fa0=this;return new Promise(function(_0x171ff2,_0x1b93f8){return db[_0xf076('0x15')]['update'](_0x1623c9[_0xf076('0x17')],{'raw':_0x1623c9['options']?_0x1623c9[_0xf076('0x18')][_0xf076('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1623c9[_0xf076('0x18')]?_0x1623c9['options']['where']||null:null,'attributes':_0x1623c9[_0xf076('0x18')]?_0x1623c9['options']['attributes']||null:null,'limit':_0x1623c9['options']?_0x1623c9[_0xf076('0x18')]['limit']||null:null})[_0xf076('0x1a')](function(_0x18092a){logger[_0xf076('0xa')]('UpdateVoiceDialReport',_0x1623c9);logger[_0xf076('0xd')](_0xf076('0x1c'),_0x1623c9,JSON[_0xf076('0xf')](_0x18092a));_0x171ff2(_0x18092a);})[_0xf076('0x14')](function(_0x190b4e){logger[_0xf076('0x10')](_0xf076('0x1c'),_0x190b4e[_0xf076('0x12')],_0x1623c9);_0x1b93f8(_0x265fa0[_0xf076('0x10')](0x1f4,_0x190b4e['message']));});});}; \ No newline at end of file +var _0xa391=['options','raw','update','where','attributes','limit','UpdateVoiceDialReport','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','VoiceDialReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','CreateVoiceDialReport','create','body'];(function(_0x1690dc,_0x1b0dd8){var _0x18fd2a=function(_0x349c7e){while(--_0x349c7e){_0x1690dc['push'](_0x1690dc['shift']());}};_0x18fd2a(++_0x1b0dd8);}(_0xa391,0x64));var _0x1a39=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xa391[_0x5f09c5];return _0x426ad9;};'use strict';var _=require('lodash');var util=require(_0x1a39('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1a39('0x1'));var fs=require('fs');var Redis=require(_0x1a39('0x2'));var db=require(_0x1a39('0x3'))['db'];var utils=require(_0x1a39('0x4'));var logger=require(_0x1a39('0x5'))(_0x1a39('0x6'));var config=require(_0x1a39('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1a39('0x8')][_0x1a39('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5dce6a,_0x2fbdcf,_0x3b0ace){return new BPromise(function(_0x5cdf74,_0x5b154d){return client['request'](_0x5dce6a,_0x3b0ace)[_0x1a39('0xa')](function(_0xfb1a6e){logger[_0x1a39('0xb')](_0x1a39('0xc'),_0x2fbdcf,'request\x20sent');logger[_0x1a39('0xd')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x2fbdcf,_0x1a39('0xe'),JSON[_0x1a39('0xf')](_0xfb1a6e));if(_0xfb1a6e[_0x1a39('0x10')]){if(_0xfb1a6e[_0x1a39('0x10')][_0x1a39('0x11')]===0x1f4){logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x2fbdcf,_0xfb1a6e[_0x1a39('0x10')][_0x1a39('0x12')]);return _0x5b154d(_0xfb1a6e['error'][_0x1a39('0x12')]);}logger['error'](_0x1a39('0xc'),_0x2fbdcf,_0xfb1a6e[_0x1a39('0x10')][_0x1a39('0x12')]);return _0x5cdf74(_0xfb1a6e[_0x1a39('0x10')][_0x1a39('0x12')]);}else{logger[_0x1a39('0xb')]('VoiceDialReport,\x20%s,\x20%s',_0x2fbdcf,_0x1a39('0xe'));_0x5cdf74(_0xfb1a6e[_0x1a39('0x13')][_0x1a39('0x12')]);}})[_0x1a39('0x14')](function(_0x4fa2a4){logger['error'](_0x1a39('0xc'),_0x2fbdcf,_0x4fa2a4);_0x5b154d(_0x4fa2a4);});});}exports[_0x1a39('0x15')]=function(_0xc8ce05){var _0x502a0a=this;return new Promise(function(_0x5dccb7,_0x13ae84){return db['VoiceDialReport'][_0x1a39('0x16')](_0xc8ce05[_0x1a39('0x17')],{'raw':_0xc8ce05[_0x1a39('0x18')]?_0xc8ce05[_0x1a39('0x18')][_0x1a39('0x19')]===undefined?!![]:![]:!![]})[_0x1a39('0xa')](function(_0x43c09d){logger[_0x1a39('0xb')](_0x1a39('0x15'),_0xc8ce05);logger[_0x1a39('0xd')]('CreateVoiceDialReport',_0xc8ce05,JSON[_0x1a39('0xf')](_0x43c09d));_0x5dccb7(_0x43c09d);})[_0x1a39('0x14')](function(_0x4dfd22){logger['error'](_0x1a39('0x15'),_0x4dfd22[_0x1a39('0x12')],_0xc8ce05);_0x13ae84(_0x502a0a[_0x1a39('0x10')](0x1f4,_0x4dfd22[_0x1a39('0x12')]));});});};exports['UpdateVoiceDialReport']=function(_0x547d42){var _0x508219=this;return new Promise(function(_0x41a3ff,_0x3eefef){return db['VoiceDialReport'][_0x1a39('0x1a')](_0x547d42['body'],{'raw':_0x547d42[_0x1a39('0x18')]?_0x547d42[_0x1a39('0x18')][_0x1a39('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x547d42[_0x1a39('0x18')]?_0x547d42[_0x1a39('0x18')][_0x1a39('0x1b')]||null:null,'attributes':_0x547d42[_0x1a39('0x18')]?_0x547d42[_0x1a39('0x18')][_0x1a39('0x1c')]||null:null,'limit':_0x547d42[_0x1a39('0x18')]?_0x547d42[_0x1a39('0x18')][_0x1a39('0x1d')]||null:null})['then'](function(_0x24f060){logger[_0x1a39('0xb')](_0x1a39('0x1e'),_0x547d42);logger[_0x1a39('0xd')](_0x1a39('0x1e'),_0x547d42,JSON[_0x1a39('0xf')](_0x24f060));_0x41a3ff(_0x24f060);})[_0x1a39('0x14')](function(_0xfc9196){logger[_0x1a39('0x10')](_0x1a39('0x1e'),_0xfc9196[_0x1a39('0x12')],_0x547d42);_0x3eefef(_0x508219['error'](0x1f4,_0xfc9196['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 6429acd..a9cb015 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 _0xb197=['../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','/:id','show','create','post','addApplications','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x46fcb2,_0x2d0872){var _0x403d25=function(_0x294b40){while(--_0x294b40){_0x46fcb2['push'](_0x46fcb2['shift']());}};_0x403d25(++_0x2d0872);}(_0xb197,0xa9));var _0x7b19=function(_0x44946b,_0xf874ec){_0x44946b=_0x44946b-0x0;var _0x249bc4=_0xb197[_0x44946b];return _0x249bc4;};'use strict';var multer=require(_0x7b19('0x0'));var util=require(_0x7b19('0x1'));var path=require(_0x7b19('0x2'));var timeout=require(_0x7b19('0x3'));var express=require(_0x7b19('0x4'));var router=express[_0x7b19('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x7b19('0x6'));var interaction=require(_0x7b19('0x7'));var config=require(_0x7b19('0x8'));var controller=require(_0x7b19('0x9'));router[_0x7b19('0xa')]('/',auth[_0x7b19('0xb')](),controller[_0x7b19('0xc')]);router[_0x7b19('0xa')](_0x7b19('0xd'),auth['isAuthenticated'](),controller[_0x7b19('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x7b19('0xf')]);router[_0x7b19('0x10')]('/:id/applications',auth[_0x7b19('0xb')](),controller[_0x7b19('0x11')]);router[_0x7b19('0x12')](_0x7b19('0xd'),auth[_0x7b19('0xb')](),controller[_0x7b19('0x13')]);router['delete']('/:id',auth[_0x7b19('0xb')](),controller[_0x7b19('0x14')]);module[_0x7b19('0x15')]=router; \ No newline at end of file +var _0x344e=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','show','create','post','/:id/applications','addApplications','put','/:id','update','delete','destroy'];(function(_0x373c4a,_0x9a82e7){var _0xbf1632=function(_0x2a685c){while(--_0x2a685c){_0x373c4a['push'](_0x373c4a['shift']());}};_0xbf1632(++_0x9a82e7);}(_0x344e,0xd9));var _0xe344=function(_0x16e650,_0x3fca3a){_0x16e650=_0x16e650-0x0;var _0x9baf5=_0x344e[_0x16e650];return _0x9baf5;};'use strict';var multer=require(_0xe344('0x0'));var util=require(_0xe344('0x1'));var path=require(_0xe344('0x2'));var timeout=require(_0xe344('0x3'));var express=require(_0xe344('0x4'));var router=express[_0xe344('0x5')]();var fs_extra=require(_0xe344('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xe344('0x7'));var config=require(_0xe344('0x8'));var controller=require(_0xe344('0x9'));router[_0xe344('0xa')]('/',auth[_0xe344('0xb')](),controller[_0xe344('0xc')]);router[_0xe344('0xa')]('/:id',auth[_0xe344('0xb')](),controller[_0xe344('0xd')]);router['post']('/',auth[_0xe344('0xb')](),controller[_0xe344('0xe')]);router[_0xe344('0xf')](_0xe344('0x10'),auth[_0xe344('0xb')](),controller[_0xe344('0x11')]);router[_0xe344('0x12')](_0xe344('0x13'),auth[_0xe344('0xb')](),controller[_0xe344('0x14')]);router[_0xe344('0x15')](_0xe344('0x13'),auth[_0xe344('0xb')](),controller[_0xe344('0x16')]);module[_0xe344('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index ee74821..ad3ab86 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 _0xe706=['VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','inbound','outbound','internal','inbound-fax','outbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN','wav'];(function(_0xb00e90,_0x1c74bb){var _0x2a7db2=function(_0x131ff0){while(--_0x131ff0){_0xb00e90['push'](_0xb00e90['shift']());}};_0x2a7db2(++_0x1c74bb);}(_0xe706,0xa3));var _0x6e70=function(_0x3ab687,_0x2f3a18){_0x3ab687=_0x3ab687-0x0;var _0x512596=_0xe706[_0x3ab687];return _0x512596;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'context':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'unique':_0x6e70('0x3')},'priority':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'defaultValue':'1','unique':_0x6e70('0x3')},'tag':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'defaultValue':_0x6e70('0x4')},'appdata':{'type':Sequelize[_0x6e70('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x6e70('0x5')](_0x6e70('0x6'),_0x6e70('0x7'),_0x6e70('0x8'),_0x6e70('0x9'),_0x6e70('0xa'),_0x6e70('0xb'),_0x6e70('0xc')),'allowNull':![]},'description':{'type':Sequelize[_0x6e70('0x2')]},'interval':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'defaultValue':_0x6e70('0xd')},'IntervalId':{'type':Sequelize[_0x6e70('0xe')]},'isApp':{'type':Sequelize[_0x6e70('0xf')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x6e70('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0x6e70('0xf')],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0x6e70('0x10')},'answer':{'type':Sequelize[_0x6e70('0xf')],'defaultValue':!![]},'name':{'type':Sequelize[_0x6e70('0x11')],'get':function(){return this[_0x6e70('0x12')](_0x6e70('0x13'));}}}; \ No newline at end of file +var _0xa9e0=['*,*,*,*','INTEGER','BOOLEAN','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','inbound','outbound','internal','system'];(function(_0x19e206,_0x3e945d){var _0x531b21=function(_0x30ff2e){while(--_0x30ff2e){_0x19e206['push'](_0x19e206['shift']());}};_0x531b21(++_0x3e945d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'context':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0a9e('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x0a9e('0x3')},'tag':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x4')},'appdata':{'type':Sequelize[_0x0a9e('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),'inbound-fax','outbound-fax',_0x0a9e('0x8'),'any'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x9')},'IntervalId':{'type':Sequelize[_0x0a9e('0xa')]},'isApp':{'type':Sequelize[_0x0a9e('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':'wav'},'answer':{'type':Sequelize[_0x0a9e('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x0a9e('0xc')],'get':function(){return this[_0x0a9e('0xd')](_0x0a9e('0xe'));}}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 60fe0e4..b9188c7 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 _0xdeb3=['json','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','offset','undefined','limit','count','destroy','get','InboundRoutes','inbound','OutboundRoutes','outbound','filter','ignore','map','value','includes','type','find','name','UserProfileResource','then','error','stack','index','VoiceExtension','rawAttributes','fieldName','model','keys','query','intersection','attributes','fields','length','nolimit','sort','filters','pick','merge','VIRTUAL','where','includeAll','include','rows','catch','show','params','options','body','exten','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','InternalRoutes','internal','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','description','mandatoryDisposition','alias','context','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','isApp','createRouting','findAndCountAll','cast(priority\x20as\x20unsigned)'];(function(_0x10a718,_0x1de534){var _0x3974b9=function(_0x514d01){while(--_0x514d01){_0x10a718['push'](_0x10a718['shift']());}};_0x3974b9(++_0x1de534);}(_0xdeb3,0x10c));var _0x3deb=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xdeb3[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x3deb('0x0'));var Redis=require(_0x3deb('0x1'));var qs=require(_0x3deb('0x2'));var logger=require(_0x3deb('0x3'))(_0x3deb('0x4'));var config=require(_0x3deb('0x5'));var db=require('../../mysqldb')['db'];config[_0x3deb('0x6')]=_[_0x3deb('0x7')](config[_0x3deb('0x6')],{'host':_0x3deb('0x8'),'port':0x18eb});var socket=require(_0x3deb('0x9'))(new Redis(config[_0x3deb('0x6')]));require(_0x3deb('0xa'))[_0x3deb('0xb')](socket);function respondWithStatusCode(_0x21d9c2,_0x3b26b6){_0x3b26b6=_0x3b26b6||0xcc;return function(_0x508eb9){if(_0x508eb9){return _0x21d9c2[_0x3deb('0xc')](_0x3b26b6);}return _0x21d9c2[_0x3deb('0xd')](_0x3b26b6)[_0x3deb('0xe')]();};}function respondWithResult(_0xd7ad55,_0x53fcf1){_0x53fcf1=_0x53fcf1||0xc8;return function(_0x20ddc6){if(_0x20ddc6){return _0xd7ad55[_0x3deb('0xd')](_0x53fcf1)['json'](_0x20ddc6);}};}function respondWithFilteredResult(_0x3f4684,_0x67a717){return function(_0x4acf8b){if(_0x4acf8b){var _0x33ea4f=typeof _0x67a717[_0x3deb('0xf')]===_0x3deb('0x10')&&typeof _0x67a717[_0x3deb('0x11')]===_0x3deb('0x10');var _0x4b7de3=_0x4acf8b[_0x3deb('0x12')];var _0x1313a0=_0x33ea4f?0x0:_0x67a717['offset'];var _0x2c7445=_0x33ea4f?_0x4acf8b[_0x3deb('0x12')]:_0x67a717['offset']+_0x67a717[_0x3deb('0x11')];var _0xd6280c;if(_0x2c7445>=_0x4b7de3){_0x2c7445=_0x4b7de3;_0xd6280c=0xc8;}else{_0xd6280c=0xce;}_0x3f4684[_0x3deb('0xd')](_0xd6280c);return _0x3f4684['set']('Content-Range',_0x1313a0+'-'+_0x2c7445+'/'+_0x4b7de3)['json'](_0x4acf8b);}return null;};}function removeEntity(_0x339ba2){return function(_0x4f2a3c){if(_0x4f2a3c){return _0x4f2a3c[_0x3deb('0x13')]()['then'](function(){var _0x365f8e=_0x4f2a3c[_0x3deb('0x14')]({'plain':!![]});var _0x3186f4=[{'name':_0x3deb('0x15'),'value':_0x3deb('0x16'),'ignore':![]},{'name':_0x3deb('0x17'),'value':_0x3deb('0x18'),'ignore':![]},{'name':'InternalRoutes','value':'internal','ignore':![]}];var _0x52e02d=_(_0x3186f4)[_0x3deb('0x19')](_0x3deb('0x1a'))[_0x3deb('0x1b')](_0x3deb('0x1c'))[_0x3deb('0x1c')]();if(_[_0x3deb('0x1d')](_0x52e02d,_0x365f8e[_0x3deb('0x1e')])){return;}var _0x503124=_[_0x3deb('0x1f')](_0x3186f4,[_0x3deb('0x1c'),_0x365f8e[_0x3deb('0x1e')]])[_0x3deb('0x20')];return db[_0x3deb('0x21')]['destroy']({'where':{'type':_0x503124,'resourceId':_0x365f8e['id']}})[_0x3deb('0x22')](function(){return _0x4f2a3c;});})[_0x3deb('0x22')](function(){_0x339ba2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x58f4ed){return function(_0x4abaa1){if(!_0x4abaa1){_0x58f4ed['sendStatus'](0x194);}return _0x4abaa1;};}function handleError(_0x413578,_0x29b4ff){_0x29b4ff=_0x29b4ff||0x1f4;return function(_0x4bddb4){logger[_0x3deb('0x23')](_0x4bddb4[_0x3deb('0x24')]);if(_0x4bddb4[_0x3deb('0x20')]){delete _0x4bddb4[_0x3deb('0x20')];}_0x413578[_0x3deb('0xd')](_0x29b4ff)['send'](_0x4bddb4);};}exports[_0x3deb('0x25')]=function(_0x27632d,_0x255dcd){var _0x3e91be={},_0x11f0d8={},_0x3f2e7c={'count':0x0,'rows':[]};var _0x406be5=_[_0x3deb('0x1b')](db[_0x3deb('0x26')][_0x3deb('0x27')],function(_0x3fd06d){return{'name':_0x3fd06d[_0x3deb('0x28')],'type':_0x3fd06d[_0x3deb('0x1e')]['key']};});_0x11f0d8[_0x3deb('0x29')]=_['map'](_0x406be5,_0x3deb('0x20'));_0x11f0d8['query']=_[_0x3deb('0x2a')](_0x27632d[_0x3deb('0x2b')]);_0x11f0d8['filters']=_[_0x3deb('0x2c')](_0x11f0d8[_0x3deb('0x29')],_0x11f0d8[_0x3deb('0x2b')]);_0x3e91be[_0x3deb('0x2d')]=_['intersection'](_0x11f0d8[_0x3deb('0x29')],qs[_0x3deb('0x2e')](_0x27632d[_0x3deb('0x2b')]['fields']));_0x3e91be[_0x3deb('0x2d')]=_0x3e91be['attributes'][_0x3deb('0x2f')]?_0x3e91be[_0x3deb('0x2d')]:_0x11f0d8[_0x3deb('0x29')];if(!_0x27632d[_0x3deb('0x2b')]['hasOwnProperty'](_0x3deb('0x30'))){_0x3e91be[_0x3deb('0x11')]=qs[_0x3deb('0x11')](_0x27632d[_0x3deb('0x2b')][_0x3deb('0x11')]);_0x3e91be[_0x3deb('0xf')]=qs[_0x3deb('0xf')](_0x27632d[_0x3deb('0x2b')][_0x3deb('0xf')]);}_0x3e91be['order']=qs[_0x3deb('0x31')](_0x27632d[_0x3deb('0x2b')][_0x3deb('0x31')]);_0x3e91be['where']=qs[_0x3deb('0x32')](_[_0x3deb('0x33')](_0x27632d[_0x3deb('0x2b')],_0x11f0d8[_0x3deb('0x32')]),_0x406be5);if(_0x27632d[_0x3deb('0x2b')][_0x3deb('0x19')]){_0x3e91be['where']=_[_0x3deb('0x34')](_0x3e91be['where'],{'$or':_[_0x3deb('0x1b')](_0x406be5,function(_0x4b5879){if(_0x4b5879[_0x3deb('0x1e')]!==_0x3deb('0x35')){var _0x428f2e={};_0x428f2e[_0x4b5879[_0x3deb('0x20')]]={'$like':'%'+_0x27632d[_0x3deb('0x2b')]['filter']+'%'};return _0x428f2e;}})});}_0x3e91be=_['merge']({},_0x3e91be,_0x27632d['options']);var _0x26a1ac={'where':_0x3e91be[_0x3deb('0x36')]};return db[_0x3deb('0x26')][_0x3deb('0x12')](_0x26a1ac)[_0x3deb('0x22')](function(_0x5d7d0e){_0x3f2e7c['count']=_0x5d7d0e;if(_0x27632d['query'][_0x3deb('0x37')]){_0x3e91be[_0x3deb('0x38')]=[{'all':!![]}];}return db[_0x3deb('0x26')]['findAll'](_0x3e91be);})['then'](function(_0xcb71b2){_0x3f2e7c[_0x3deb('0x39')]=_0xcb71b2;return _0x3f2e7c;})[_0x3deb('0x22')](respondWithFilteredResult(_0x255dcd,_0x3e91be))[_0x3deb('0x3a')](handleError(_0x255dcd,null));};exports[_0x3deb('0x3b')]=function(_0x4a0321,_0x746483){var _0x487286={'raw':![],'where':{'id':_0x4a0321[_0x3deb('0x3c')]['id']}},_0x3a7b86={};_0x3a7b86[_0x3deb('0x29')]=_['keys'](db['VoiceExtension'][_0x3deb('0x27')]);_0x3a7b86[_0x3deb('0x2b')]=_['keys'](_0x4a0321[_0x3deb('0x2b')]);_0x3a7b86[_0x3deb('0x32')]=_['intersection'](_0x3a7b86[_0x3deb('0x29')],_0x3a7b86['query']);_0x487286[_0x3deb('0x2d')]=_[_0x3deb('0x2c')](_0x3a7b86[_0x3deb('0x29')],qs[_0x3deb('0x2e')](_0x4a0321[_0x3deb('0x2b')]['fields']));_0x487286[_0x3deb('0x2d')]=_0x487286[_0x3deb('0x2d')][_0x3deb('0x2f')]?_0x487286['attributes']:_0x3a7b86[_0x3deb('0x29')];if(_0x4a0321[_0x3deb('0x2b')][_0x3deb('0x37')]){_0x487286[_0x3deb('0x38')]=[{'all':!![]}];}_0x487286=_[_0x3deb('0x34')]({},_0x487286,_0x4a0321[_0x3deb('0x3d')]);return db[_0x3deb('0x26')]['find'](_0x487286)[_0x3deb('0x22')](handleEntityNotFound(_0x746483,null))[_0x3deb('0x22')](respondWithResult(_0x746483,null))[_0x3deb('0x3a')](handleError(_0x746483,null));};exports['destroy']=function(_0x336a9b,_0x4b6a2e){return db['VoiceExtension'][_0x3deb('0x1f')]({'where':{'id':_0x336a9b[_0x3deb('0x3c')]['id']}})['then'](handleEntityNotFound(_0x4b6a2e,null))[_0x3deb('0x22')](removeEntity(_0x4b6a2e,null))[_0x3deb('0x3a')](handleError(_0x4b6a2e,null));};exports['create']=function(_0x4f2d67,_0x4bb246){if(_0x4f2d67[_0x3deb('0x3e')]['type']==='outbound'&&!_['startsWith'](_0x4f2d67['body'][_0x3deb('0x3f')],'_')){_0x4f2d67[_0x3deb('0x3e')][_0x3deb('0x3f')]='_'['concat'](_0x4f2d67[_0x3deb('0x3e')][_0x3deb('0x3f')]);}return db['VoiceExtension'][_0x3deb('0x40')](_0x4f2d67['body'],{'raw':![]})['then'](function(_0x488ce9){var _0x3f07f7=_0x4f2d67[_0x3deb('0x41')][_0x3deb('0x14')]({'plain':!![]});if(!_0x3f07f7)throw new Error(_0x3deb('0x42'));if(_0x3f07f7[_0x3deb('0x43')]==='user'){var _0x990611=_0x488ce9['get']({'plain':!![]});var _0x1e89b7=[{'name':'InboundRoutes','value':'inbound'},{'name':_0x3deb('0x17'),'value':_0x3deb('0x18')},{'name':_0x3deb('0x44'),'value':_0x3deb('0x45')}];var _0x53c257=_[_0x3deb('0x1f')](_0x1e89b7,[_0x3deb('0x1c'),_0x990611[_0x3deb('0x1e')]])['name'];return db['UserProfileSection'][_0x3deb('0x1f')]({'where':{'name':_0x53c257,'userProfileId':_0x3f07f7['userProfileId']},'raw':!![]})[_0x3deb('0x22')](function(_0x2b31a2){if(_0x2b31a2&&_0x2b31a2[_0x3deb('0x46')]===0x0){return db[_0x3deb('0x21')][_0x3deb('0x40')]({'name':_0x990611[_0x3deb('0x20')],'resourceId':_0x990611['id'],'type':_0x2b31a2[_0x3deb('0x20')],'sectionId':_0x2b31a2['id']},{})[_0x3deb('0x22')](function(){return _0x488ce9;});}else{return _0x488ce9;}})[_0x3deb('0x3a')](function(_0x288440){logger[_0x3deb('0x23')](_0x3deb('0x47'),_0x288440);throw _0x288440;});}return _0x488ce9;})[_0x3deb('0x22')](respondWithResult(_0x4bb246,0xc9))['catch'](handleError(_0x4bb246,null));};exports[_0x3deb('0x48')]=function(_0x3271af,_0x24636d){if(_0x3271af[_0x3deb('0x3e')]['id']){delete _0x3271af[_0x3deb('0x3e')]['id'];}return db['VoiceExtension']['find']({'where':{'id':_0x3271af['params']['id']}})[_0x3deb('0x22')](handleEntityNotFound(_0x24636d,null))['then'](function(_0x56a7ac){if(_0x56a7ac){return db['VoiceExtension'][_0x3deb('0x48')](_[_0x3deb('0x33')](_0x3271af[_0x3deb('0x3e')],['exten','context',_0x3deb('0x49'),'recordingFormat','cutdigits',_0x3deb('0x4a'),_0x3deb('0x4b')]),{'where':{'context':_0x56a7ac[_0x3deb('0x4c')],'exten':_0x56a7ac['exten']},'individualHooks':!![]})[_0x3deb('0x22')](function(_0x5cbcad){return _0x5cbcad;});}return null;})[_0x3deb('0x22')](respondWithStatusCode(_0x24636d,null))[_0x3deb('0x3a')](handleError(_0x24636d,null));};exports[_0x3deb('0x4d')]=function(_0x39c0ae,_0x14ea37){var _0x2ecb77=_0x39c0ae[_0x3deb('0x3c')]['id'];var _0x13ec60=_0x39c0ae[_0x3deb('0x3e')];var _0x33a29f=0xc8;var _0x1cc0bd=null;return db[_0x3deb('0x4e')]['transaction']({'isolationLevel':db[_0x3deb('0x4e')][_0x3deb('0x4f')][_0x3deb('0x50')][_0x3deb('0x51')]},function(_0x556d34){return db[_0x3deb('0x26')][_0x3deb('0x52')]({'where':{'id':_0x2ecb77},'transaction':_0x556d34})['then'](function(_0x294ef9){if(_0x294ef9){return db[_0x3deb('0x26')]['destroy']({'where':{'VoiceExtensionId':_0x2ecb77},'transaction':_0x556d34})[_0x3deb('0x22')](function(){var _0x3ce96c=_[_0x3deb('0x1b')](_0x13ec60,function(_0x553a77){_0x553a77[_0x3deb('0x53')]=_0x2ecb77;_0x553a77[_0x3deb('0x54')]=!![];return _0x553a77;});return _0x294ef9[_0x3deb('0x55')](_0x3ce96c);})[_0x3deb('0x22')](function(_0x299e80){return db['VoiceExtension']['bulkCreate'](_0x299e80,{'transaction':_0x556d34});});}else{_0x33a29f=0x194;_0x1cc0bd=[];}});})[_0x3deb('0x22')](function(){if(_0x33a29f!==0x194){return db[_0x3deb('0x26')][_0x3deb('0x56')]({'where':{'isApp':!![],'VoiceExtensionId':_0x2ecb77},'order':_0x3deb('0x57')})[_0x3deb('0x22')](function(_0x200015){_0x1cc0bd=_0x200015;});}})['catch'](function(_0x41b36f){_0x33a29f=0x1f4;logger['error'](_0x41b36f[_0x3deb('0x24')]);if(_0x41b36f['name']){delete _0x41b36f[_0x3deb('0x20')];}_0x1cc0bd=_0x41b36f;})['finally'](function(){if(_0x1cc0bd===null){_0x14ea37['sendStatus'](_0x33a29f);}else{if(_0x33a29f===0x1f4){_0x14ea37['status'](_0x33a29f)['send'](_0x1cc0bd);}else{_0x14ea37[_0x3deb('0xd')](_0x33a29f)[_0x3deb('0x58')](_0x1cc0bd);}}});}; \ No newline at end of file +var _0x56a0=['body','startsWith','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','InboundRoutes','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','pick','recordingFormat','cutdigits','mandatoryDisposition','alias','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','VoiceExtensionId','createRouting','cast(priority\x20as\x20unsigned)','send','lodash','ioredis','../../config/logger','api','redis','defaults','localhost','register','sendStatus','status','json','offset','undefined','count','limit','Content-Range','then','get','inbound','OutboundRoutes','outbound','InternalRoutes','internal','ignore','value','includes','type','find','name','UserProfileResource','destroy','end','error','stack','index','map','VoiceExtension','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','create'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x56a0,0x12b));var _0x056a=function(_0x2b9e3c,_0x385f13){_0x2b9e3c=_0x2b9e3c-0x0;var _0x481485=_0x56a0[_0x2b9e3c];return _0x481485;};'use strict';var _=require(_0x056a('0x0'));var Redis=require(_0x056a('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x056a('0x2'))(_0x056a('0x3'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x056a('0x4')]=_[_0x056a('0x5')](config[_0x056a('0x4')],{'host':_0x056a('0x6'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x056a('0x4')]));require('./voiceExtension.socket')[_0x056a('0x7')](socket);function respondWithStatusCode(_0x2fabc0,_0x60b098){_0x60b098=_0x60b098||0xcc;return function(_0x5f133c){if(_0x5f133c){return _0x2fabc0[_0x056a('0x8')](_0x60b098);}return _0x2fabc0[_0x056a('0x9')](_0x60b098)['end']();};}function respondWithResult(_0x53d19f,_0x5e77f7){_0x5e77f7=_0x5e77f7||0xc8;return function(_0x4fef58){if(_0x4fef58){return _0x53d19f[_0x056a('0x9')](_0x5e77f7)[_0x056a('0xa')](_0x4fef58);}};}function respondWithFilteredResult(_0x13a63b,_0xcd7a77){return function(_0x3f6348){if(_0x3f6348){var _0x4ef406=typeof _0xcd7a77[_0x056a('0xb')]===_0x056a('0xc')&&typeof _0xcd7a77['limit']===_0x056a('0xc');var _0x3a09cc=_0x3f6348[_0x056a('0xd')];var _0x3a32fc=_0x4ef406?0x0:_0xcd7a77[_0x056a('0xb')];var _0x53b76f=_0x4ef406?_0x3f6348[_0x056a('0xd')]:_0xcd7a77[_0x056a('0xb')]+_0xcd7a77[_0x056a('0xe')];var _0x5bc483;if(_0x53b76f>=_0x3a09cc){_0x53b76f=_0x3a09cc;_0x5bc483=0xc8;}else{_0x5bc483=0xce;}_0x13a63b[_0x056a('0x9')](_0x5bc483);return _0x13a63b['set'](_0x056a('0xf'),_0x3a32fc+'-'+_0x53b76f+'/'+_0x3a09cc)['json'](_0x3f6348);}return null;};}function removeEntity(_0x158df3){return function(_0x39866d){if(_0x39866d){return _0x39866d['destroy']()[_0x056a('0x10')](function(){var _0x1b91b7=_0x39866d[_0x056a('0x11')]({'plain':!![]});var _0x37556f=[{'name':'InboundRoutes','value':_0x056a('0x12'),'ignore':![]},{'name':_0x056a('0x13'),'value':_0x056a('0x14'),'ignore':![]},{'name':_0x056a('0x15'),'value':_0x056a('0x16'),'ignore':![]}];var _0x5c7afe=_(_0x37556f)['filter'](_0x056a('0x17'))['map'](_0x056a('0x18'))[_0x056a('0x18')]();if(_[_0x056a('0x19')](_0x5c7afe,_0x1b91b7[_0x056a('0x1a')])){return;}var _0x42032f=_[_0x056a('0x1b')](_0x37556f,[_0x056a('0x18'),_0x1b91b7[_0x056a('0x1a')]])[_0x056a('0x1c')];return db[_0x056a('0x1d')][_0x056a('0x1e')]({'where':{'type':_0x42032f,'resourceId':_0x1b91b7['id']}})[_0x056a('0x10')](function(){return _0x39866d;});})['then'](function(){_0x158df3[_0x056a('0x9')](0xcc)[_0x056a('0x1f')]();});}};}function handleEntityNotFound(_0x1817b3){return function(_0x594366){if(!_0x594366){_0x1817b3[_0x056a('0x8')](0x194);}return _0x594366;};}function handleError(_0x477a49,_0x30681b){_0x30681b=_0x30681b||0x1f4;return function(_0xfafddb){logger[_0x056a('0x20')](_0xfafddb[_0x056a('0x21')]);if(_0xfafddb[_0x056a('0x1c')]){delete _0xfafddb[_0x056a('0x1c')];}_0x477a49[_0x056a('0x9')](_0x30681b)['send'](_0xfafddb);};}exports[_0x056a('0x22')]=function(_0x418e66,_0x503538){var _0x53d392={},_0x343548={},_0x1d1a6b={'count':0x0,'rows':[]};var _0x786df=_[_0x056a('0x23')](db[_0x056a('0x24')][_0x056a('0x25')],function(_0x1a5d7a){return{'name':_0x1a5d7a[_0x056a('0x26')],'type':_0x1a5d7a[_0x056a('0x1a')][_0x056a('0x27')]};});_0x343548['model']=_['map'](_0x786df,_0x056a('0x1c'));_0x343548[_0x056a('0x28')]=_[_0x056a('0x29')](_0x418e66[_0x056a('0x28')]);_0x343548[_0x056a('0x2a')]=_[_0x056a('0x2b')](_0x343548[_0x056a('0x2c')],_0x343548[_0x056a('0x28')]);_0x53d392[_0x056a('0x2d')]=_['intersection'](_0x343548[_0x056a('0x2c')],qs[_0x056a('0x2e')](_0x418e66[_0x056a('0x28')][_0x056a('0x2e')]));_0x53d392[_0x056a('0x2d')]=_0x53d392[_0x056a('0x2d')]['length']?_0x53d392['attributes']:_0x343548[_0x056a('0x2c')];if(!_0x418e66[_0x056a('0x28')][_0x056a('0x2f')](_0x056a('0x30'))){_0x53d392[_0x056a('0xe')]=qs[_0x056a('0xe')](_0x418e66[_0x056a('0x28')][_0x056a('0xe')]);_0x53d392[_0x056a('0xb')]=qs[_0x056a('0xb')](_0x418e66[_0x056a('0x28')][_0x056a('0xb')]);}_0x53d392[_0x056a('0x31')]=qs[_0x056a('0x32')](_0x418e66[_0x056a('0x28')][_0x056a('0x32')]);_0x53d392['where']=qs[_0x056a('0x2a')](_['pick'](_0x418e66[_0x056a('0x28')],_0x343548[_0x056a('0x2a')]),_0x786df);if(_0x418e66[_0x056a('0x28')][_0x056a('0x33')]){_0x53d392[_0x056a('0x34')]=_[_0x056a('0x35')](_0x53d392['where'],{'$or':_[_0x056a('0x23')](_0x786df,function(_0x9df84){if(_0x9df84[_0x056a('0x1a')]!==_0x056a('0x36')){var _0xc04b97={};_0xc04b97[_0x9df84[_0x056a('0x1c')]]={'$like':'%'+_0x418e66[_0x056a('0x28')]['filter']+'%'};return _0xc04b97;}})});}_0x53d392=_[_0x056a('0x35')]({},_0x53d392,_0x418e66[_0x056a('0x37')]);var _0x4b5e6d={'where':_0x53d392[_0x056a('0x34')]};return db[_0x056a('0x24')][_0x056a('0xd')](_0x4b5e6d)[_0x056a('0x10')](function(_0x54d38a){_0x1d1a6b['count']=_0x54d38a;if(_0x418e66[_0x056a('0x28')][_0x056a('0x38')]){_0x53d392[_0x056a('0x39')]=[{'all':!![]}];}return db['VoiceExtension'][_0x056a('0x3a')](_0x53d392);})[_0x056a('0x10')](function(_0x48b54d){_0x1d1a6b[_0x056a('0x3b')]=_0x48b54d;return _0x1d1a6b;})['then'](respondWithFilteredResult(_0x503538,_0x53d392))[_0x056a('0x3c')](handleError(_0x503538,null));};exports[_0x056a('0x3d')]=function(_0x6875f1,_0x1ff76b){var _0xa29d9f={'raw':![],'where':{'id':_0x6875f1[_0x056a('0x3e')]['id']}},_0x549082={};_0x549082[_0x056a('0x2c')]=_[_0x056a('0x29')](db[_0x056a('0x24')][_0x056a('0x25')]);_0x549082[_0x056a('0x28')]=_[_0x056a('0x29')](_0x6875f1[_0x056a('0x28')]);_0x549082[_0x056a('0x2a')]=_[_0x056a('0x2b')](_0x549082[_0x056a('0x2c')],_0x549082['query']);_0xa29d9f[_0x056a('0x2d')]=_[_0x056a('0x2b')](_0x549082[_0x056a('0x2c')],qs[_0x056a('0x2e')](_0x6875f1[_0x056a('0x28')][_0x056a('0x2e')]));_0xa29d9f['attributes']=_0xa29d9f[_0x056a('0x2d')][_0x056a('0x3f')]?_0xa29d9f[_0x056a('0x2d')]:_0x549082['model'];if(_0x6875f1[_0x056a('0x28')][_0x056a('0x38')]){_0xa29d9f[_0x056a('0x39')]=[{'all':!![]}];}_0xa29d9f=_['merge']({},_0xa29d9f,_0x6875f1[_0x056a('0x37')]);return db[_0x056a('0x24')][_0x056a('0x1b')](_0xa29d9f)['then'](handleEntityNotFound(_0x1ff76b,null))[_0x056a('0x10')](respondWithResult(_0x1ff76b,null))[_0x056a('0x3c')](handleError(_0x1ff76b,null));};exports['destroy']=function(_0x1d54a9,_0x262903){return db[_0x056a('0x24')][_0x056a('0x1b')]({'where':{'id':_0x1d54a9[_0x056a('0x3e')]['id']}})[_0x056a('0x10')](handleEntityNotFound(_0x262903,null))[_0x056a('0x10')](removeEntity(_0x262903,null))['catch'](handleError(_0x262903,null));};exports[_0x056a('0x40')]=function(_0x29f7a9,_0x3c1a26){if(_0x29f7a9[_0x056a('0x41')][_0x056a('0x1a')]===_0x056a('0x14')&&!_[_0x056a('0x42')](_0x29f7a9[_0x056a('0x41')][_0x056a('0x43')],'_')){_0x29f7a9['body']['exten']='_'[_0x056a('0x44')](_0x29f7a9[_0x056a('0x41')][_0x056a('0x43')]);}return db[_0x056a('0x24')]['create'](_0x29f7a9[_0x056a('0x41')],{'raw':![]})[_0x056a('0x10')](function(_0x290c24){var _0x371ef1=_0x29f7a9[_0x056a('0x45')][_0x056a('0x11')]({'plain':!![]});if(!_0x371ef1)throw new Error(_0x056a('0x46'));if(_0x371ef1[_0x056a('0x47')]===_0x056a('0x45')){var _0x570554=_0x290c24[_0x056a('0x11')]({'plain':!![]});var _0x3d8eb2=[{'name':_0x056a('0x48'),'value':_0x056a('0x12')},{'name':'OutboundRoutes','value':_0x056a('0x14')},{'name':_0x056a('0x15'),'value':_0x056a('0x16')}];var _0x499f96=_[_0x056a('0x1b')](_0x3d8eb2,[_0x056a('0x18'),_0x570554[_0x056a('0x1a')]])[_0x056a('0x1c')];return db[_0x056a('0x49')][_0x056a('0x1b')]({'where':{'name':_0x499f96,'userProfileId':_0x371ef1['userProfileId']},'raw':!![]})[_0x056a('0x10')](function(_0x255dd8){if(_0x255dd8&&_0x255dd8[_0x056a('0x4a')]===0x0){return db[_0x056a('0x1d')][_0x056a('0x40')]({'name':_0x570554[_0x056a('0x1c')],'resourceId':_0x570554['id'],'type':_0x255dd8[_0x056a('0x1c')],'sectionId':_0x255dd8['id']},{})[_0x056a('0x10')](function(){return _0x290c24;});}else{return _0x290c24;}})['catch'](function(_0x279fc1){logger[_0x056a('0x20')](_0x056a('0x4b'),_0x279fc1);throw _0x279fc1;});}return _0x290c24;})[_0x056a('0x10')](respondWithResult(_0x3c1a26,0xc9))[_0x056a('0x3c')](handleError(_0x3c1a26,null));};exports[_0x056a('0x4c')]=function(_0xdc9be4,_0x4f6b81){if(_0xdc9be4['body']['id']){delete _0xdc9be4[_0x056a('0x41')]['id'];}return db[_0x056a('0x24')][_0x056a('0x1b')]({'where':{'id':_0xdc9be4[_0x056a('0x3e')]['id']}})['then'](handleEntityNotFound(_0x4f6b81,null))[_0x056a('0x10')](function(_0x2c1350){if(_0x2c1350){return db[_0x056a('0x24')][_0x056a('0x4c')](_[_0x056a('0x4d')](_0xdc9be4['body'],['exten','context','description',_0x056a('0x4e'),_0x056a('0x4f'),_0x056a('0x50'),_0x056a('0x51')]),{'where':{'context':_0x2c1350['context'],'exten':_0x2c1350[_0x056a('0x43')]},'individualHooks':!![]})[_0x056a('0x10')](function(_0xe248bb){return _0xe248bb;});}return null;})[_0x056a('0x10')](respondWithStatusCode(_0x4f6b81,null))[_0x056a('0x3c')](handleError(_0x4f6b81,null));};exports[_0x056a('0x52')]=function(_0x3d983e,_0x4f5ba2){var _0x103e97=_0x3d983e[_0x056a('0x3e')]['id'];var _0x146b25=_0x3d983e[_0x056a('0x41')];var _0x1e7b8b=0xc8;var _0x1e8ba3=null;return db[_0x056a('0x53')]['transaction']({'isolationLevel':db[_0x056a('0x53')][_0x056a('0x54')][_0x056a('0x55')][_0x056a('0x56')]},function(_0x58d243){return db[_0x056a('0x24')]['findOne']({'where':{'id':_0x103e97},'transaction':_0x58d243})[_0x056a('0x10')](function(_0x10fbf3){if(_0x10fbf3){return db[_0x056a('0x24')][_0x056a('0x1e')]({'where':{'VoiceExtensionId':_0x103e97},'transaction':_0x58d243})[_0x056a('0x10')](function(){var _0x259f3a=_[_0x056a('0x23')](_0x146b25,function(_0xb8fb62){_0xb8fb62[_0x056a('0x57')]=_0x103e97;_0xb8fb62['isApp']=!![];return _0xb8fb62;});return _0x10fbf3[_0x056a('0x58')](_0x259f3a);})[_0x056a('0x10')](function(_0x56acb7){return db[_0x056a('0x24')]['bulkCreate'](_0x56acb7,{'transaction':_0x58d243});});}else{_0x1e7b8b=0x194;_0x1e8ba3=[];}});})[_0x056a('0x10')](function(){if(_0x1e7b8b!==0x194){return db[_0x056a('0x24')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x103e97},'order':_0x056a('0x59')})[_0x056a('0x10')](function(_0x47f3cb){_0x1e8ba3=_0x47f3cb;});}})[_0x056a('0x3c')](function(_0xd99e98){_0x1e7b8b=0x1f4;logger['error'](_0xd99e98[_0x056a('0x21')]);if(_0xd99e98[_0x056a('0x1c')]){delete _0xd99e98['name'];}_0x1e8ba3=_0xd99e98;})['finally'](function(){if(_0x1e8ba3===null){_0x4f5ba2['sendStatus'](_0x1e7b8b);}else{if(_0x1e7b8b===0x1f4){_0x4f5ba2['status'](_0x1e7b8b)[_0x056a('0x5a')](_0x1e8ba3);}else{_0x4f5ba2[_0x056a('0x9')](_0x1e7b8b)[_0x056a('0xa')](_0x1e8ba3);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 9299362..d41fa0e 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 _0x4ab1=['update','remove','emit','hasOwnProperty','hook','exports','events','VoiceExtension','save'];(function(_0x31797d,_0x4d3a22){var _0x42c8f5=function(_0x4cdc9e){while(--_0x4cdc9e){_0x31797d['push'](_0x31797d['shift']());}};_0x42c8f5(++_0x4d3a22);}(_0x4ab1,0x165));var _0x14ab=function(_0x4c8eed,_0x51f7ce){_0x4c8eed=_0x4c8eed-0x0;var _0x3990ec=_0x4ab1[_0x4c8eed];return _0x3990ec;};'use strict';var EventEmitter=require(_0x14ab('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0x14ab('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x14ab('0x2'),'afterUpdate':_0x14ab('0x3'),'afterDestroy':_0x14ab('0x4')};function emitEvent(_0x49092d){return function(_0x5e25b4,_0x19a9c7,_0x5dc0eb){VoiceExtensionEvents[_0x14ab('0x5')](_0x49092d+':'+_0x5e25b4['id'],_0x5e25b4);VoiceExtensionEvents['emit'](_0x49092d,_0x5e25b4);_0x5dc0eb(null);};}for(var e in events){if(events[_0x14ab('0x6')](e)){var event=events[e];VoiceExtension[_0x14ab('0x7')](e,emitEvent(event));}}module[_0x14ab('0x8')]=VoiceExtensionEvents; \ No newline at end of file +var _0x6fdb=['emit','hook','events','VoiceExtension','setMaxListeners','remove'];(function(_0x11b6b9,_0x26c36e){var _0x856e08=function(_0x5ab1ec){while(--_0x5ab1ec){_0x11b6b9['push'](_0x11b6b9['shift']());}};_0x856e08(++_0x26c36e);}(_0x6fdb,0xce));var _0xb6fd=function(_0x3fbc51,_0x26fdd7){_0x3fbc51=_0x3fbc51-0x0;var _0x5833d3=_0x6fdb[_0x3fbc51];return _0x5833d3;};'use strict';var EventEmitter=require(_0xb6fd('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0xb6fd('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xb6fd('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xb6fd('0x3')};function emitEvent(_0x2f3227){return function(_0x239bf8,_0x118209,_0x1d83b7){VoiceExtensionEvents[_0xb6fd('0x4')](_0x2f3227+':'+_0x239bf8['id'],_0x239bf8);VoiceExtensionEvents[_0xb6fd('0x4')](_0x2f3227,_0x239bf8);_0x1d83b7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0xb6fd('0x5')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index b670388..ffb4949 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 _0xa69f=['$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','outboundDial','appdata','agi','priority','last','concat','catch','define','VoiceExtension','voice_extensions','get','Hangup','lodash','models','type','Set','CDR(type)=','exten','inbound','push','CDR(routeid)=','context','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','CDR(type)=outbound','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','CDR(prefix)=${EXTEN:0:','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','url','length','split','phone','prefix','param','join','indexOf','U(xcally-mixmonitor-context)','isEmpty','findAll','IntervalId','*,*,*,*','intervals','interval','map','filter','hasOwnProperty','tag','toLowerCase','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','NoOp(No\x20number\x20available)','answer','queue','playback','includes','app','appType','custom'];(function(_0xa0c67e,_0x254ed7){var _0x36e853=function(_0x295c43){while(--_0x295c43){_0xa0c67e['push'](_0xa0c67e['shift']());}};_0x36e853(++_0x254ed7);}(_0xa69f,0x1df));var _0xfa69=function(_0x2c7e0f,_0x159224){_0x2c7e0f=_0x2c7e0f-0x0;var _0x1a4015=_0xa69f[_0x2c7e0f];return _0x1a4015;};'use strict';var _=require(_0xfa69('0x0'));var attributes=require('./voiceExtension.attributes');module['exports']=function(_0x30c19b){var _0x55777d=_0x30c19b[_0xfa69('0x1')];function _0x37b730(_0x21578c){var _0x1a7dc9=0x2;var _0x509a92=[{'type':_0x21578c[_0xfa69('0x2')],'app':_0xfa69('0x3'),'appdata':_0xfa69('0x4')+_0x21578c[_0xfa69('0x2')],'context':_0x21578c['context'],'exten':_0x21578c[_0xfa69('0x5')],'priority':_0x1a7dc9++,'VoiceExtensionId':_0x21578c['id']}];if(_0x21578c[_0xfa69('0x2')]===_0xfa69('0x6')){_0x509a92[_0xfa69('0x7')]({'type':_0xfa69('0x6'),'app':_0xfa69('0x3'),'appdata':_0xfa69('0x8')+_0x21578c['id'],'context':_0x21578c[_0xfa69('0x9')],'exten':_0x21578c[_0xfa69('0x5')],'priority':_0x1a7dc9++,'VoiceExtensionId':_0x21578c['id']});}_0x509a92[_0xfa69('0x7')]({'type':_0x21578c['type'],'app':_0xfa69('0x3'),'appdata':_0xfa69('0xa'),'context':_0x21578c[_0xfa69('0x9')],'exten':_0x21578c[_0xfa69('0x5')],'priority':_0x1a7dc9++,'VoiceExtensionId':_0x21578c['id']},{'type':_0x21578c[_0xfa69('0x2')],'app':_0xfa69('0x3'),'appdata':_0xfa69('0xb'),'context':_0x21578c[_0xfa69('0x9')],'exten':_0x21578c['exten'],'priority':_0x1a7dc9++,'VoiceExtensionId':_0x21578c['id']},{'type':_0x21578c[_0xfa69('0x2')],'app':'Set','appdata':_0xfa69('0xc'),'context':_0x21578c[_0xfa69('0x9')],'exten':_0x21578c[_0xfa69('0x5')],'priority':_0x1a7dc9++,'VoiceExtensionId':_0x21578c['id']});return _0x509a92;}function _0x36db9a(_0x231c01){var _0x4c7afb=0x2;var _0x10e3da=[{'type':'outbound','app':_0xfa69('0x3'),'appdata':_0xfa69('0xd'),'context':_0x231c01[_0xfa69('0x9')],'exten':_0x231c01[_0xfa69('0x5')],'priority':_0x4c7afb++,'VoiceExtensionId':_0x231c01['id']},{'type':_0xfa69('0xe'),'app':_0xfa69('0x3'),'appdata':_0xfa69('0xf')+(_0x231c01[_0xfa69('0x10')]?_0xfa69('0x11')+_0x231c01[_0xfa69('0x10')]+'}':_0xfa69('0x12')),'context':_0x231c01[_0xfa69('0x9')],'exten':_0x231c01[_0xfa69('0x5')],'priority':_0x4c7afb++,'VoiceExtensionId':_0x231c01['id']},{'type':'outbound','app':_0xfa69('0x3'),'appdata':_0xfa69('0x8')+_0x231c01['id'],'context':_0x231c01[_0xfa69('0x9')],'exten':_0x231c01[_0xfa69('0x5')],'priority':_0x4c7afb++,'VoiceExtensionId':_0x231c01['id']},{'type':_0xfa69('0xe'),'app':_0xfa69('0x13'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x4c7afb+0x2)+'):Goto('+(_0x4c7afb+0x1)+')','context':_0x231c01[_0xfa69('0x9')],'exten':_0x231c01[_0xfa69('0x5')],'priority':_0x4c7afb++,'VoiceExtensionId':_0x231c01['id']},{'type':_0xfa69('0xe'),'app':_0xfa69('0x3'),'appdata':_0x231c01[_0xfa69('0x10')]?_0xfa69('0x14')+_0x231c01[_0xfa69('0x10')]+'}':'CDR(prefix)=noprefix','context':_0x231c01[_0xfa69('0x9')],'exten':_0x231c01[_0xfa69('0x5')],'priority':_0x4c7afb++,'VoiceExtensionId':_0x231c01['id']},{'type':'outbound','app':_0xfa69('0x3'),'appdata':_0xfa69('0xa'),'context':_0x231c01['context'],'exten':_0x231c01['exten'],'priority':_0x4c7afb++,'VoiceExtensionId':_0x231c01['id']},{'type':_0xfa69('0xe'),'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x231c01[_0xfa69('0x9')],'exten':_0x231c01[_0xfa69('0x5')],'priority':_0x4c7afb++,'VoiceExtensionId':_0x231c01['id']},{'type':_0xfa69('0xe'),'app':_0xfa69('0x3'),'appdata':_0xfa69('0xc'),'context':_0x231c01[_0xfa69('0x9')],'exten':_0x231c01['exten'],'priority':_0x4c7afb++,'VoiceExtensionId':_0x231c01['id']},{'type':_0xfa69('0xe'),'app':_0xfa69('0x3'),'appdata':_0xfa69('0x15')+_0x231c01['id'],'context':_0x231c01[_0xfa69('0x9')],'exten':_0x231c01[_0xfa69('0x5')],'priority':_0x4c7afb++,'VoiceExtensionId':_0x231c01['id']}];if(_0x231c01['hasOwnProperty'](_0xfa69('0x16'))&&_0x231c01[_0xfa69('0x16')]!==_0xfa69('0x17')){_0x10e3da[_0xfa69('0x7')]({'type':_0xfa69('0xe'),'app':_0xfa69('0x3'),'appdata':_0xfa69('0x18'),'context':_0x231c01[_0xfa69('0x9')],'exten':_0x231c01[_0xfa69('0x5')],'priority':_0x4c7afb++,'VoiceExtensionId':_0x231c01['id']},{'type':_0xfa69('0xe'),'app':_0xfa69('0x3'),'appdata':_0xfa69('0x19')+_0x231c01['recordingFormat']||_0xfa69('0x1a'),'context':_0x231c01[_0xfa69('0x9')],'exten':_0x231c01['exten'],'priority':_0x4c7afb++,'VoiceExtensionId':_0x231c01['id']});}return _0x10e3da;}function _0x4dafca(_0x51c585,_0x232ffc){var _0x3ad2b4=[{'name':_0xfa69('0x1b'),'param':0x0},{'name':_0xfa69('0x1c'),'param':0x1},{'name':_0xfa69('0x1d'),'param':0x2},{'name':_0xfa69('0x1e'),'param':0x3}];var _0x590ccc={};var _0x58206e=_0x232ffc['split'](',');var _0x196adf=[];for(var _0x121161=0x0;_0x121161<_0x3ad2b4[_0xfa69('0x1f')];_0x121161++){switch(_0x3ad2b4[_0x121161]['name']){case'trunk':_0x590ccc[_0xfa69('0x1b')]=_0x58206e[_0x3ad2b4[_0x121161]['param']][_0xfa69('0x20')]('/')[0x1];_0x590ccc[_0xfa69('0x21')]=_0x58206e[_0x3ad2b4[_0x121161]['param']]['split']('/')[0x2];_0x590ccc[_0xfa69('0x22')]=_0x590ccc[_0xfa69('0x21')]?_0x590ccc[_0xfa69('0x21')][_0xfa69('0x20')]('$')[0x0]:undefined;_0x590ccc[_0xfa69('0x21')]=_0x51c585[_0xfa69('0x10')]?(_0x590ccc[_0xfa69('0x22')]||'')+_0xfa69('0x11')+_0x51c585[_0xfa69('0x10')]+'}':(_0x590ccc[_0xfa69('0x22')]||'')+_0xfa69('0x12');_0x196adf[_0x3ad2b4[_0x121161][_0xfa69('0x23')]]=['SIP',_0x590ccc[_0xfa69('0x1b')],_0x590ccc[_0xfa69('0x21')]][_0xfa69('0x24')]('/');break;case _0xfa69('0x1d'):_0x590ccc[_0xfa69('0x1d')]=_0x58206e[_0x3ad2b4[_0x121161]['param']];if(_0x51c585[_0xfa69('0x16')]!==_0xfa69('0x17')){if(_0x590ccc[_0xfa69('0x1d')][_0xfa69('0x25')](_0xfa69('0x26'))<0x0){_0x590ccc[_0xfa69('0x1d')]+=_0xfa69('0x26');}}else{_0x590ccc[_0xfa69('0x1d')]=_0x590ccc[_0xfa69('0x1d')]['replace']('U(xcally-mixmonitor-context)','');}_0x196adf[_0x3ad2b4[_0x121161][_0xfa69('0x23')]]=_0x590ccc[_0xfa69('0x1d')];break;default:_0x196adf[_0x3ad2b4[_0x121161][_0xfa69('0x23')]]=_0x58206e[_0x3ad2b4[_0x121161]['param']];}}return _0x196adf[_0xfa69('0x24')](',');}function _0x5e15e9(_0x3f91b1,_0x5c3723,_0x35880c){return new Promise(function(_0x50c1d8,_0x5c1a59){var _0x526a1e=[];if(_[_0xfa69('0x27')](_0x5c3723))return _0x50c1d8(_0x526a1e);_0x55777d['Interval'][_0xfa69('0x28')]({'attributes':['id','interval',_0xfa69('0x29')],'raw':!![]})['then'](function(_0x3c1f46){for(var _0x54ebd5=0x0,_0x876f60=0x0;_0x54ebd5<_0x5c3723[_0xfa69('0x1f')];_0x54ebd5++,_0x876f60=0x0){var _0xf9c1db=_0x5c3723[_0x54ebd5];var _0x5005f4=[];var _0x43abc3=[];delete _0xf9c1db['id'];if(_0xf9c1db['interval']!==_0xfa69('0x2a')){_0xf9c1db[_0xfa69('0x2b')]=[_0xf9c1db[_0xfa69('0x2c')]];}else{_0xf9c1db[_0xfa69('0x2b')]=_0xf9c1db[_0xfa69('0x29')]?_[_0xfa69('0x2d')](_[_0xfa69('0x2e')](_0x3c1f46,{'IntervalId':_0xf9c1db[_0xfa69('0x29')]}),'interval'):[];}_0xf9c1db['context']=_0x3f91b1['context'];_0xf9c1db[_0xfa69('0x5')]=_0x3f91b1[_0xfa69('0x5')];if(_0xf9c1db[_0xfa69('0x2')])_0xf9c1db[_0xfa69('0x2')]=_0xf9c1db[_0xfa69('0x2')]['toLowerCase']();if(_0x3f91b1[_0xfa69('0x2')]===_0xfa69('0xe')){if(_0xf9c1db[_0xfa69('0x2f')](_0xfa69('0x30'))&&_0xf9c1db['tag']&&_0xf9c1db['tag']!=='--'){_0x5005f4['push']({'type':_0xf9c1db['type'][_0xfa69('0x31')](),'app':'Set','appdata':'CDR(tag)='+_0xf9c1db['tag'],'context':_0x3f91b1['context'],'exten':_0x3f91b1[_0xfa69('0x5')],'priority':_0xf9c1db[_0xfa69('0x2b')][_0xfa69('0x1f')]+_0x35880c+_0x876f60++,'VoiceExtensionId':_0x3f91b1['id']});}_0x5005f4[_0xfa69('0x7')]({'type':_0xf9c1db[_0xfa69('0x2')][_0xfa69('0x31')](),'app':_0xfa69('0x13'),'appdata':_0xfa69('0x32')+(_0xf9c1db['callerID']?'Set(CALLERID(all)='+_0xf9c1db[_0xfa69('0x33')]+')':_0xfa69('0x34')),'context':_0x3f91b1['context'],'exten':_0x3f91b1[_0xfa69('0x5')],'priority':_0xf9c1db['intervals']['length']+_0x35880c+_0x876f60++,'VoiceExtensionId':_0x3f91b1['id']});}else{if(_0xf9c1db['hasOwnProperty'](_0xfa69('0x35'))){if([_0xfa69('0x36'),_0xfa69('0x37')][_0xfa69('0x38')](_0xf9c1db[_0xfa69('0x39')]['toLowerCase']())&&_0xf9c1db[_0xfa69('0x3a')]!==_0xfa69('0x3b')){if(_0xf9c1db[_0xfa69('0x35')]){_0x5005f4[_0xfa69('0x7')]({'type':_0xf9c1db[_0xfa69('0x2')][_0xfa69('0x31')](),'app':_0xfa69('0x13'),'appdata':_0xfa69('0x3c'),'context':_0x3f91b1[_0xfa69('0x9')],'exten':_0x3f91b1[_0xfa69('0x5')],'priority':_0xf9c1db[_0xfa69('0x2b')][_0xfa69('0x1f')]+_0x35880c+_0x876f60++,'VoiceExtensionId':_0x3f91b1['id']});_0x5005f4[_0xfa69('0x7')]({'type':_0xf9c1db[_0xfa69('0x2')][_0xfa69('0x31')](),'app':_0xfa69('0x3'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x3f91b1[_0xfa69('0x9')],'exten':_0x3f91b1[_0xfa69('0x5')],'priority':_0xf9c1db['intervals'][_0xfa69('0x1f')]+_0x35880c+_0x876f60++,'VoiceExtensionId':_0x3f91b1['id']});}else{_0x5005f4[_0xfa69('0x7')]({'type':_0xf9c1db[_0xfa69('0x2')][_0xfa69('0x31')](),'app':_0xfa69('0x13'),'appdata':_0xfa69('0x3d'),'context':_0x3f91b1[_0xfa69('0x9')],'exten':_0x3f91b1['exten'],'priority':_0xf9c1db[_0xfa69('0x2b')][_0xfa69('0x1f')]+_0x35880c+_0x876f60++,'VoiceExtensionId':_0x3f91b1['id']});_0x5005f4[_0xfa69('0x7')]({'type':_0xf9c1db['type'][_0xfa69('0x31')](),'app':_0xfa69('0x3'),'appdata':_0xfa69('0x3e'),'context':_0x3f91b1[_0xfa69('0x9')],'exten':_0x3f91b1['exten'],'priority':_0xf9c1db[_0xfa69('0x2b')][_0xfa69('0x1f')]+_0x35880c+_0x876f60++,'VoiceExtensionId':_0x3f91b1['id']});}}}}for(var _0x2b3f43=0x0;_0x2b3f43<_0xf9c1db['intervals']['length'];_0x2b3f43++){var _0x4f8c6b=_0x35880c+_0xf9c1db['intervals']['length'];var _0x32c304=_0x2b3f43===_0xf9c1db['intervals'][_0xfa69('0x1f')]-0x1?_0x35880c+_0x5005f4['length']+_0x43abc3[_0xfa69('0x1f')]+0x2:_0x35880c+_0x2b3f43+0x1;_0x5005f4['splice'](_0x2b3f43,0x0,{'type':_0x3f91b1[_0xfa69('0x2')],'app':_0xfa69('0x3f'),'appdata':_0xf9c1db[_0xfa69('0x2b')][_0x2b3f43]+'?'+_0x3f91b1[_0xfa69('0x9')]+_0xfa69('0x40')+_0x4f8c6b+':'+_0x3f91b1[_0xfa69('0x9')]+_0xfa69('0x40')+_0x32c304,'exten':_0x3f91b1[_0xfa69('0x5')],'context':_0x3f91b1['context'],'priority':_0x35880c+_0x2b3f43,'VoiceExtensionId':_0x3f91b1['id']});}if(_0xf9c1db[_0xfa69('0x3a')]===_0xfa69('0x41')){_0xf9c1db[_0xfa69('0x42')]=_0x4dafca(_0x3f91b1,_0xf9c1db[_0xfa69('0x42')]);}if(_0xf9c1db[_0xfa69('0x3a')]===_0xfa69('0x43')){_0x5005f4[_0xfa69('0x7')]({'type':_0xf9c1db[_0xfa69('0x2')][_0xfa69('0x31')](),'app':_0xfa69('0x3'),'appdata':'XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','context':_0x3f91b1[_0xfa69('0x9')],'exten':_0x3f91b1[_0xfa69('0x5')],'priority':_0xf9c1db[_0xfa69('0x2b')][_0xfa69('0x1f')]+_0x35880c+_0x876f60++,'VoiceExtensionId':_0x3f91b1['id']});}_0xf9c1db[_0xfa69('0x44')]=_0x5005f4[_0xfa69('0x1f')]?_[_0xfa69('0x45')](_0x5005f4)[_0xfa69('0x44')]+0x1:_0x35880c;_0x526a1e=_[_0xfa69('0x46')](_0x526a1e,_0x5005f4,[_0xf9c1db],_0x43abc3);_0x35880c=_[_0xfa69('0x45')](_0x526a1e)[_0xfa69('0x44')]+0x1;}return _0x50c1d8(_0x526a1e);})[_0xfa69('0x47')](function(_0x29f887){_0x5c1a59(_0x29f887);});});}return _0x30c19b[_0xfa69('0x48')](_0xfa69('0x49'),attributes,{'tableName':_0xfa69('0x4a'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x450c7d){var _0x3057db=this[_0xfa69('0x4b')]({'plain':!![]});var _0x4248fa=_0x3057db[_0xfa69('0x2')]===_0xfa69('0xe')?_0x36db9a(_0x3057db):_0x37b730(_0x3057db);return _0x5e15e9(_0x3057db,_0x450c7d,_[_0xfa69('0x45')](_0x4248fa)[_0xfa69('0x44')]+0x1)['then'](function(_0x3b4d64){var _0x4b0794=_[_0xfa69('0x46')](_0x4248fa,_0x3b4d64);_0x4b0794['push']({'type':_0x3057db['type'],'app':_0xfa69('0x4c'),'exten':_0x3057db[_0xfa69('0x5')],'context':_0x3057db['context'],'priority':_[_0xfa69('0x45')](_0x4b0794)['priority']+0x1,'VoiceExtensionId':_0x3057db['id']});return _0x4b0794;});}}});}; \ No newline at end of file +var _0x1f9c=['$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','appType','agi','priority','catch','VoiceExtension','voice_extensions','get','concat','Hangup','last','lodash','./voiceExtension.attributes','exports','models','type','Set','CDR(type)=','context','exten','push','inbound','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','cutdigits','${EXTEN:','${EXTEN}','CDR(routeid)=','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','XCALLY-MOTION-ANSWER=0','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','options','url','split','length','name','param','phone','prefix','SIP','join','indexOf','U(xcally-mixmonitor-context)','Interval','interval','IntervalId','then','*,*,*,*','intervals','map','filter','tag','toLowerCase','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','Set(CALLERID(all)=','callerID','answer','queue','playback','includes','app','ExecIf','XCALLY-MOTION-ANSWER=1'];(function(_0x3ee827,_0x527aa4){var _0x1aa11c=function(_0x3fbc98){while(--_0x3fbc98){_0x3ee827['push'](_0x3ee827['shift']());}};_0x1aa11c(++_0x527aa4);}(_0x1f9c,0xad));var _0xc1f9=function(_0x43b9ea,_0x280d55){_0x43b9ea=_0x43b9ea-0x0;var _0x4a55ca=_0x1f9c[_0x43b9ea];return _0x4a55ca;};'use strict';var _=require(_0xc1f9('0x0'));var attributes=require(_0xc1f9('0x1'));module[_0xc1f9('0x2')]=function(_0x5efa1c){var _0x9f0756=_0x5efa1c[_0xc1f9('0x3')];function _0x5072ae(_0x2f6a2e){var _0x6abe08=0x2;var _0x17027b=[{'type':_0x2f6a2e[_0xc1f9('0x4')],'app':_0xc1f9('0x5'),'appdata':_0xc1f9('0x6')+_0x2f6a2e[_0xc1f9('0x4')],'context':_0x2f6a2e[_0xc1f9('0x7')],'exten':_0x2f6a2e[_0xc1f9('0x8')],'priority':_0x6abe08++,'VoiceExtensionId':_0x2f6a2e['id']}];if(_0x2f6a2e['type']==='inbound'){_0x17027b[_0xc1f9('0x9')]({'type':_0xc1f9('0xa'),'app':_0xc1f9('0x5'),'appdata':'CDR(routeid)='+_0x2f6a2e['id'],'context':_0x2f6a2e[_0xc1f9('0x7')],'exten':_0x2f6a2e[_0xc1f9('0x8')],'priority':_0x6abe08++,'VoiceExtensionId':_0x2f6a2e['id']});}_0x17027b[_0xc1f9('0x9')]({'type':_0x2f6a2e[_0xc1f9('0x4')],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=0','context':_0x2f6a2e[_0xc1f9('0x7')],'exten':_0x2f6a2e[_0xc1f9('0x8')],'priority':_0x6abe08++,'VoiceExtensionId':_0x2f6a2e['id']},{'type':_0x2f6a2e[_0xc1f9('0x4')],'app':_0xc1f9('0x5'),'appdata':_0xc1f9('0xb'),'context':_0x2f6a2e[_0xc1f9('0x7')],'exten':_0x2f6a2e[_0xc1f9('0x8')],'priority':_0x6abe08++,'VoiceExtensionId':_0x2f6a2e['id']},{'type':_0x2f6a2e['type'],'app':_0xc1f9('0x5'),'appdata':_0xc1f9('0xc'),'context':_0x2f6a2e['context'],'exten':_0x2f6a2e[_0xc1f9('0x8')],'priority':_0x6abe08++,'VoiceExtensionId':_0x2f6a2e['id']});return _0x17027b;}function _0x2704b7(_0x305a16){var _0x1d053e=0x2;var _0x484b1b=[{'type':_0xc1f9('0xd'),'app':'Set','appdata':'CDR(type)=outbound','context':_0x305a16['context'],'exten':_0x305a16[_0xc1f9('0x8')],'priority':_0x1d053e++,'VoiceExtensionId':_0x305a16['id']},{'type':_0xc1f9('0xd'),'app':_0xc1f9('0x5'),'appdata':'CDR(destination)='+(_0x305a16[_0xc1f9('0xe')]?_0xc1f9('0xf')+_0x305a16[_0xc1f9('0xe')]+'}':_0xc1f9('0x10')),'context':_0x305a16[_0xc1f9('0x7')],'exten':_0x305a16[_0xc1f9('0x8')],'priority':_0x1d053e++,'VoiceExtensionId':_0x305a16['id']},{'type':_0xc1f9('0xd'),'app':_0xc1f9('0x5'),'appdata':_0xc1f9('0x11')+_0x305a16['id'],'context':_0x305a16[_0xc1f9('0x7')],'exten':_0x305a16['exten'],'priority':_0x1d053e++,'VoiceExtensionId':_0x305a16['id']},{'type':_0xc1f9('0xd'),'app':'ExecIf','appdata':_0xc1f9('0x12')+(_0x1d053e+0x2)+'):Goto('+(_0x1d053e+0x1)+')','context':_0x305a16[_0xc1f9('0x7')],'exten':_0x305a16[_0xc1f9('0x8')],'priority':_0x1d053e++,'VoiceExtensionId':_0x305a16['id']},{'type':_0xc1f9('0xd'),'app':_0xc1f9('0x5'),'appdata':_0x305a16[_0xc1f9('0xe')]?_0xc1f9('0x13')+_0x305a16['cutdigits']+'}':_0xc1f9('0x14'),'context':_0x305a16[_0xc1f9('0x7')],'exten':_0x305a16[_0xc1f9('0x8')],'priority':_0x1d053e++,'VoiceExtensionId':_0x305a16['id']},{'type':_0xc1f9('0xd'),'app':'Set','appdata':_0xc1f9('0x15'),'context':_0x305a16[_0xc1f9('0x7')],'exten':_0x305a16[_0xc1f9('0x8')],'priority':_0x1d053e++,'VoiceExtensionId':_0x305a16['id']},{'type':_0xc1f9('0xd'),'app':_0xc1f9('0x5'),'appdata':_0xc1f9('0xb'),'context':_0x305a16[_0xc1f9('0x7')],'exten':_0x305a16[_0xc1f9('0x8')],'priority':_0x1d053e++,'VoiceExtensionId':_0x305a16['id']},{'type':_0xc1f9('0xd'),'app':_0xc1f9('0x5'),'appdata':'MONITOR_OPTIONS=ab','context':_0x305a16[_0xc1f9('0x7')],'exten':_0x305a16[_0xc1f9('0x8')],'priority':_0x1d053e++,'VoiceExtensionId':_0x305a16['id']},{'type':_0xc1f9('0xd'),'app':'Set','appdata':_0xc1f9('0x16')+_0x305a16['id'],'context':_0x305a16[_0xc1f9('0x7')],'exten':_0x305a16[_0xc1f9('0x8')],'priority':_0x1d053e++,'VoiceExtensionId':_0x305a16['id']}];if(_0x305a16['hasOwnProperty'](_0xc1f9('0x17'))&&_0x305a16[_0xc1f9('0x17')]!==_0xc1f9('0x18')){_0x484b1b[_0xc1f9('0x9')]({'type':_0xc1f9('0xd'),'app':_0xc1f9('0x5'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x305a16[_0xc1f9('0x7')],'exten':_0x305a16[_0xc1f9('0x8')],'priority':_0x1d053e++,'VoiceExtensionId':_0x305a16['id']},{'type':_0xc1f9('0xd'),'app':'Set','appdata':_0xc1f9('0x19')+_0x305a16[_0xc1f9('0x17')]||_0xc1f9('0x1a'),'context':_0x305a16[_0xc1f9('0x7')],'exten':_0x305a16[_0xc1f9('0x8')],'priority':_0x1d053e++,'VoiceExtensionId':_0x305a16['id']});}return _0x484b1b;}function _0x6d4b50(_0x51f3db,_0x484de6){var _0x5b2977=[{'name':_0xc1f9('0x1b'),'param':0x0},{'name':'timeout','param':0x1},{'name':_0xc1f9('0x1c'),'param':0x2},{'name':_0xc1f9('0x1d'),'param':0x3}];var _0x25d461={};var _0x4e5e87=_0x484de6[_0xc1f9('0x1e')](',');var _0x176a5d=[];for(var _0x1c220e=0x0;_0x1c220e<_0x5b2977[_0xc1f9('0x1f')];_0x1c220e++){switch(_0x5b2977[_0x1c220e][_0xc1f9('0x20')]){case'trunk':_0x25d461[_0xc1f9('0x1b')]=_0x4e5e87[_0x5b2977[_0x1c220e][_0xc1f9('0x21')]][_0xc1f9('0x1e')]('/')[0x1];_0x25d461[_0xc1f9('0x22')]=_0x4e5e87[_0x5b2977[_0x1c220e][_0xc1f9('0x21')]][_0xc1f9('0x1e')]('/')[0x2];_0x25d461['prefix']=_0x25d461['phone']?_0x25d461[_0xc1f9('0x22')][_0xc1f9('0x1e')]('$')[0x0]:undefined;_0x25d461[_0xc1f9('0x22')]=_0x51f3db['cutdigits']?(_0x25d461['prefix']||'')+_0xc1f9('0xf')+_0x51f3db[_0xc1f9('0xe')]+'}':(_0x25d461[_0xc1f9('0x23')]||'')+_0xc1f9('0x10');_0x176a5d[_0x5b2977[_0x1c220e][_0xc1f9('0x21')]]=[_0xc1f9('0x24'),_0x25d461[_0xc1f9('0x1b')],_0x25d461[_0xc1f9('0x22')]][_0xc1f9('0x25')]('/');break;case'options':_0x25d461['options']=_0x4e5e87[_0x5b2977[_0x1c220e][_0xc1f9('0x21')]];if(_0x51f3db[_0xc1f9('0x17')]!==_0xc1f9('0x18')){if(_0x25d461[_0xc1f9('0x1c')][_0xc1f9('0x26')](_0xc1f9('0x27'))<0x0){_0x25d461[_0xc1f9('0x1c')]+=_0xc1f9('0x27');}}else{_0x25d461[_0xc1f9('0x1c')]=_0x25d461[_0xc1f9('0x1c')]['replace'](_0xc1f9('0x27'),'');}_0x176a5d[_0x5b2977[_0x1c220e][_0xc1f9('0x21')]]=_0x25d461[_0xc1f9('0x1c')];break;default:_0x176a5d[_0x5b2977[_0x1c220e]['param']]=_0x4e5e87[_0x5b2977[_0x1c220e][_0xc1f9('0x21')]];}}return _0x176a5d[_0xc1f9('0x25')](',');}function _0x143b05(_0x2bdb45,_0x38e572,_0x2a7def){return new Promise(function(_0x514aaf,_0xb32737){var _0x4b5f29=[];if(_['isEmpty'](_0x38e572))return _0x514aaf(_0x4b5f29);_0x9f0756[_0xc1f9('0x28')]['findAll']({'attributes':['id',_0xc1f9('0x29'),_0xc1f9('0x2a')],'raw':!![]})[_0xc1f9('0x2b')](function(_0x1eb2ff){for(var _0xa9bdb6=0x0,_0x2ec3ad=0x0;_0xa9bdb6<_0x38e572[_0xc1f9('0x1f')];_0xa9bdb6++,_0x2ec3ad=0x0){var _0x522392=_0x38e572[_0xa9bdb6];var _0x1d487b=[];var _0x4d1776=[];delete _0x522392['id'];if(_0x522392['interval']!==_0xc1f9('0x2c')){_0x522392[_0xc1f9('0x2d')]=[_0x522392[_0xc1f9('0x29')]];}else{_0x522392[_0xc1f9('0x2d')]=_0x522392[_0xc1f9('0x2a')]?_[_0xc1f9('0x2e')](_[_0xc1f9('0x2f')](_0x1eb2ff,{'IntervalId':_0x522392[_0xc1f9('0x2a')]}),_0xc1f9('0x29')):[];}_0x522392[_0xc1f9('0x7')]=_0x2bdb45['context'];_0x522392[_0xc1f9('0x8')]=_0x2bdb45[_0xc1f9('0x8')];if(_0x522392[_0xc1f9('0x4')])_0x522392[_0xc1f9('0x4')]=_0x522392['type']['toLowerCase']();if(_0x2bdb45[_0xc1f9('0x4')]==='outbound'){if(_0x522392['hasOwnProperty'](_0xc1f9('0x30'))&&_0x522392[_0xc1f9('0x30')]&&_0x522392[_0xc1f9('0x30')]!=='--'){_0x1d487b[_0xc1f9('0x9')]({'type':_0x522392[_0xc1f9('0x4')][_0xc1f9('0x31')](),'app':_0xc1f9('0x5'),'appdata':_0xc1f9('0x32')+_0x522392['tag'],'context':_0x2bdb45[_0xc1f9('0x7')],'exten':_0x2bdb45[_0xc1f9('0x8')],'priority':_0x522392['intervals']['length']+_0x2a7def+_0x2ec3ad++,'VoiceExtensionId':_0x2bdb45['id']});}_0x1d487b[_0xc1f9('0x9')]({'type':_0x522392[_0xc1f9('0x4')][_0xc1f9('0x31')](),'app':'ExecIf','appdata':_0xc1f9('0x33')+(_0x522392['callerID']?_0xc1f9('0x34')+_0x522392[_0xc1f9('0x35')]+')':'NoOp(No\x20number\x20available)'),'context':_0x2bdb45[_0xc1f9('0x7')],'exten':_0x2bdb45['exten'],'priority':_0x522392[_0xc1f9('0x2d')]['length']+_0x2a7def+_0x2ec3ad++,'VoiceExtensionId':_0x2bdb45['id']});}else{if(_0x522392['hasOwnProperty'](_0xc1f9('0x36'))){if([_0xc1f9('0x37'),_0xc1f9('0x38')][_0xc1f9('0x39')](_0x522392[_0xc1f9('0x3a')][_0xc1f9('0x31')]())&&_0x522392['appType']!=='custom'){if(_0x522392[_0xc1f9('0x36')]){_0x1d487b[_0xc1f9('0x9')]({'type':_0x522392[_0xc1f9('0x4')][_0xc1f9('0x31')](),'app':_0xc1f9('0x3b'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x2bdb45['context'],'exten':_0x2bdb45['exten'],'priority':_0x522392[_0xc1f9('0x2d')][_0xc1f9('0x1f')]+_0x2a7def+_0x2ec3ad++,'VoiceExtensionId':_0x2bdb45['id']});_0x1d487b[_0xc1f9('0x9')]({'type':_0x522392[_0xc1f9('0x4')][_0xc1f9('0x31')](),'app':_0xc1f9('0x5'),'appdata':_0xc1f9('0x3c'),'context':_0x2bdb45[_0xc1f9('0x7')],'exten':_0x2bdb45[_0xc1f9('0x8')],'priority':_0x522392[_0xc1f9('0x2d')][_0xc1f9('0x1f')]+_0x2a7def+_0x2ec3ad++,'VoiceExtensionId':_0x2bdb45['id']});}else{_0x1d487b['push']({'type':_0x522392[_0xc1f9('0x4')][_0xc1f9('0x31')](),'app':_0xc1f9('0x3b'),'appdata':_0xc1f9('0x3d'),'context':_0x2bdb45[_0xc1f9('0x7')],'exten':_0x2bdb45[_0xc1f9('0x8')],'priority':_0x522392[_0xc1f9('0x2d')][_0xc1f9('0x1f')]+_0x2a7def+_0x2ec3ad++,'VoiceExtensionId':_0x2bdb45['id']});_0x1d487b[_0xc1f9('0x9')]({'type':_0x522392[_0xc1f9('0x4')][_0xc1f9('0x31')](),'app':_0xc1f9('0x5'),'appdata':_0xc1f9('0x3e'),'context':_0x2bdb45[_0xc1f9('0x7')],'exten':_0x2bdb45[_0xc1f9('0x8')],'priority':_0x522392[_0xc1f9('0x2d')]['length']+_0x2a7def+_0x2ec3ad++,'VoiceExtensionId':_0x2bdb45['id']});}}}}for(var _0x5629f2=0x0;_0x5629f2<_0x522392['intervals'][_0xc1f9('0x1f')];_0x5629f2++){var _0x2aef56=_0x2a7def+_0x522392[_0xc1f9('0x2d')][_0xc1f9('0x1f')];var _0x3646c0=_0x5629f2===_0x522392[_0xc1f9('0x2d')][_0xc1f9('0x1f')]-0x1?_0x2a7def+_0x1d487b['length']+_0x4d1776[_0xc1f9('0x1f')]+0x2:_0x2a7def+_0x5629f2+0x1;_0x1d487b[_0xc1f9('0x3f')](_0x5629f2,0x0,{'type':_0x2bdb45[_0xc1f9('0x4')],'app':_0xc1f9('0x40'),'appdata':_0x522392[_0xc1f9('0x2d')][_0x5629f2]+'?'+_0x2bdb45[_0xc1f9('0x7')]+_0xc1f9('0x41')+_0x2aef56+':'+_0x2bdb45['context']+',${EXTEN},'+_0x3646c0,'exten':_0x2bdb45[_0xc1f9('0x8')],'context':_0x2bdb45[_0xc1f9('0x7')],'priority':_0x2a7def+_0x5629f2,'VoiceExtensionId':_0x2bdb45['id']});}if(_0x522392['appType']===_0xc1f9('0x42')){_0x522392[_0xc1f9('0x43')]=_0x6d4b50(_0x2bdb45,_0x522392[_0xc1f9('0x43')]);}if(_0x522392[_0xc1f9('0x44')]===_0xc1f9('0x45')){_0x1d487b[_0xc1f9('0x9')]({'type':_0x522392[_0xc1f9('0x4')][_0xc1f9('0x31')](),'app':_0xc1f9('0x5'),'appdata':'XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','context':_0x2bdb45[_0xc1f9('0x7')],'exten':_0x2bdb45[_0xc1f9('0x8')],'priority':_0x522392[_0xc1f9('0x2d')][_0xc1f9('0x1f')]+_0x2a7def+_0x2ec3ad++,'VoiceExtensionId':_0x2bdb45['id']});}_0x522392['priority']=_0x1d487b[_0xc1f9('0x1f')]?_['last'](_0x1d487b)['priority']+0x1:_0x2a7def;_0x4b5f29=_['concat'](_0x4b5f29,_0x1d487b,[_0x522392],_0x4d1776);_0x2a7def=_['last'](_0x4b5f29)[_0xc1f9('0x46')]+0x1;}return _0x514aaf(_0x4b5f29);})[_0xc1f9('0x47')](function(_0x1bf40f){_0xb32737(_0x1bf40f);});});}return _0x5efa1c['define'](_0xc1f9('0x48'),attributes,{'tableName':_0xc1f9('0x49'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x3b30b6){var _0x27cff2=this[_0xc1f9('0x4a')]({'plain':!![]});var _0x28d4dc=_0x27cff2[_0xc1f9('0x4')]===_0xc1f9('0xd')?_0x2704b7(_0x27cff2):_0x5072ae(_0x27cff2);return _0x143b05(_0x27cff2,_0x3b30b6,_['last'](_0x28d4dc)[_0xc1f9('0x46')]+0x1)['then'](function(_0x5e89e0){var _0x2e9e48=_[_0xc1f9('0x4b')](_0x28d4dc,_0x5e89e0);_0x2e9e48[_0xc1f9('0x9')]({'type':_0x27cff2[_0xc1f9('0x4')],'app':_0xc1f9('0x4c'),'exten':_0x27cff2[_0xc1f9('0x8')],'context':_0x27cff2[_0xc1f9('0x7')],'priority':_[_0xc1f9('0x4d')](_0x2e9e48)[_0xc1f9('0x46')]+0x1,'VoiceExtensionId':_0x27cff2['id']});return _0x2e9e48;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 878399f..decbe64 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 _0x78d3=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./voiceExtension.socket','register','request','request\x20sent','debug','stringify','error','code','VoiceExtension,\x20%s,\x20%s','message','info','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','limit','include','map','model','attributes','lodash','util','moment','bluebird','randomstring'];(function(_0x432c60,_0x5681ed){var _0x3d6dd7=function(_0x364423){while(--_0x364423){_0x432c60['push'](_0x432c60['shift']());}};_0x3d6dd7(++_0x5681ed);}(_0x78d3,0x73));var _0x378d=function(_0x21e21c,_0x2e30a5){_0x21e21c=_0x21e21c-0x0;var _0x5b9e41=_0x78d3[_0x21e21c];return _0x5b9e41;};'use strict';var _=require(_0x378d('0x0'));var util=require(_0x378d('0x1'));var moment=require(_0x378d('0x2'));var BPromise=require(_0x378d('0x3'));var rs=require(_0x378d('0x4'));var fs=require('fs');var Redis=require(_0x378d('0x5'));var db=require(_0x378d('0x6'))['db'];var utils=require(_0x378d('0x7'));var logger=require(_0x378d('0x8'))(_0x378d('0x9'));var config=require(_0x378d('0xa'));var jayson=require(_0x378d('0xb'));var client=jayson[_0x378d('0xc')][_0x378d('0xd')]({'port':0x232a});config['redis']=_['defaults'](config[_0x378d('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x378d('0xf'))(new Redis(config[_0x378d('0xe')]));require(_0x378d('0x10'))[_0x378d('0x11')](socket);function respondWithRpcPromise(_0x43da5f,_0x12d960,_0x53a4b6){return new BPromise(function(_0x1c4d11,_0x21bf21){return client[_0x378d('0x12')](_0x43da5f,_0x53a4b6)['then'](function(_0x378254){logger['info']('VoiceExtension,\x20%s,\x20%s',_0x12d960,_0x378d('0x13'));logger[_0x378d('0x14')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x12d960,_0x378d('0x13'),JSON[_0x378d('0x15')](_0x378254));if(_0x378254[_0x378d('0x16')]){if(_0x378254['error'][_0x378d('0x17')]===0x1f4){logger['error'](_0x378d('0x18'),_0x12d960,_0x378254[_0x378d('0x16')][_0x378d('0x19')]);return _0x21bf21(_0x378254[_0x378d('0x16')][_0x378d('0x19')]);}logger['error'](_0x378d('0x18'),_0x12d960,_0x378254['error'][_0x378d('0x19')]);return _0x1c4d11(_0x378254[_0x378d('0x16')][_0x378d('0x19')]);}else{logger[_0x378d('0x1a')](_0x378d('0x18'),_0x12d960,'request\x20sent');_0x1c4d11(_0x378254[_0x378d('0x1b')]['message']);}})[_0x378d('0x1c')](function(_0x4067d9){logger[_0x378d('0x16')](_0x378d('0x18'),_0x12d960,_0x4067d9);_0x21bf21(_0x4067d9);});});}exports[_0x378d('0x1d')]=function(_0x11584b){var _0x1c9244=this;return new Promise(function(_0x521d40,_0x5a936c){return db[_0x378d('0x1e')][_0x378d('0x1f')]({'raw':_0x11584b['options']?_0x11584b[_0x378d('0x20')][_0x378d('0x21')]===undefined?!![]:![]:!![],'where':_0x11584b[_0x378d('0x20')]?_0x11584b[_0x378d('0x20')][_0x378d('0x22')]||null:null,'attributes':_0x11584b['options']?_0x11584b[_0x378d('0x20')]['attributes']||null:null,'limit':_0x11584b[_0x378d('0x20')]?_0x11584b[_0x378d('0x20')][_0x378d('0x23')]||null:null,'include':_0x11584b['options']?_0x11584b[_0x378d('0x20')][_0x378d('0x24')]?_[_0x378d('0x25')](_0x11584b['options'][_0x378d('0x24')],function(_0x22fee7){return{'model':db[_0x22fee7[_0x378d('0x26')]],'as':_0x22fee7['as'],'attributes':_0x22fee7[_0x378d('0x27')],'include':_0x22fee7[_0x378d('0x24')]?_[_0x378d('0x25')](_0x22fee7[_0x378d('0x24')],function(_0x34ffa7){return{'model':db[_0x34ffa7['model']],'as':_0x34ffa7['as'],'attributes':_0x34ffa7['attributes'],'include':_0x34ffa7[_0x378d('0x24')]?_['map'](_0x34ffa7[_0x378d('0x24')],function(_0x292b73){return{'model':db[_0x292b73[_0x378d('0x26')]],'as':_0x292b73['as'],'attributes':_0x292b73[_0x378d('0x27')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x59945b){logger[_0x378d('0x1a')]('GetVoiceExtension',_0x11584b);logger['debug']('GetVoiceExtension',_0x11584b,JSON[_0x378d('0x15')](_0x59945b));_0x521d40(_0x59945b);})['catch'](function(_0x4d1de5){logger[_0x378d('0x16')]('GetVoiceExtension',_0x4d1de5[_0x378d('0x19')],_0x11584b);_0x5a936c(_0x1c9244[_0x378d('0x16')](0x1f4,_0x4d1de5[_0x378d('0x19')]));});});}; \ No newline at end of file +var _0x1115=['VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','VoiceExtension','findAll','options','raw','where','limit','include','map','attributes','model','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','defaults','redis','socket.io-emitter','./voiceExtension.socket','register','then','info'];(function(_0x56957d,_0x56af12){var _0x2ca16b=function(_0x47cf8d){while(--_0x47cf8d){_0x56957d['push'](_0x56957d['shift']());}};_0x2ca16b(++_0x56af12);}(_0x1115,0x1b6));var _0x5111=function(_0x281efb,_0x16733d){_0x281efb=_0x281efb-0x0;var _0x5a990a=_0x1115[_0x281efb];return _0x5a990a;};'use strict';var _=require('lodash');var util=require(_0x5111('0x0'));var moment=require(_0x5111('0x1'));var BPromise=require(_0x5111('0x2'));var rs=require(_0x5111('0x3'));var fs=require('fs');var Redis=require(_0x5111('0x4'));var db=require(_0x5111('0x5'))['db'];var utils=require(_0x5111('0x6'));var logger=require(_0x5111('0x7'))(_0x5111('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5111('0x9')][_0x5111('0xa')]({'port':0x232a});config['redis']=_[_0x5111('0xb')](config[_0x5111('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x5111('0xd'))(new Redis(config['redis']));require(_0x5111('0xe'))[_0x5111('0xf')](socket);function respondWithRpcPromise(_0x4ecb50,_0x5e12a7,_0x347d87){return new BPromise(function(_0x5a826a,_0x162624){return client['request'](_0x4ecb50,_0x347d87)[_0x5111('0x10')](function(_0x532984){logger[_0x5111('0x11')](_0x5111('0x12'),_0x5e12a7,_0x5111('0x13'));logger[_0x5111('0x14')](_0x5111('0x15'),_0x5e12a7,_0x5111('0x13'),JSON[_0x5111('0x16')](_0x532984));if(_0x532984[_0x5111('0x17')]){if(_0x532984[_0x5111('0x17')][_0x5111('0x18')]===0x1f4){logger[_0x5111('0x17')](_0x5111('0x12'),_0x5e12a7,_0x532984[_0x5111('0x17')][_0x5111('0x19')]);return _0x162624(_0x532984[_0x5111('0x17')][_0x5111('0x19')]);}logger['error'](_0x5111('0x12'),_0x5e12a7,_0x532984['error']['message']);return _0x5a826a(_0x532984[_0x5111('0x17')][_0x5111('0x19')]);}else{logger[_0x5111('0x11')]('VoiceExtension,\x20%s,\x20%s',_0x5e12a7,_0x5111('0x13'));_0x5a826a(_0x532984[_0x5111('0x1a')]['message']);}})[_0x5111('0x1b')](function(_0x10110b){logger[_0x5111('0x17')](_0x5111('0x12'),_0x5e12a7,_0x10110b);_0x162624(_0x10110b);});});}exports['GetVoiceExtension']=function(_0x52d236){var _0x2a1840=this;return new Promise(function(_0x1b0e5c,_0x1b3136){return db[_0x5111('0x1c')][_0x5111('0x1d')]({'raw':_0x52d236[_0x5111('0x1e')]?_0x52d236[_0x5111('0x1e')][_0x5111('0x1f')]===undefined?!![]:![]:!![],'where':_0x52d236[_0x5111('0x1e')]?_0x52d236['options'][_0x5111('0x20')]||null:null,'attributes':_0x52d236[_0x5111('0x1e')]?_0x52d236[_0x5111('0x1e')]['attributes']||null:null,'limit':_0x52d236[_0x5111('0x1e')]?_0x52d236[_0x5111('0x1e')][_0x5111('0x21')]||null:null,'include':_0x52d236[_0x5111('0x1e')]?_0x52d236[_0x5111('0x1e')][_0x5111('0x22')]?_[_0x5111('0x23')](_0x52d236[_0x5111('0x1e')][_0x5111('0x22')],function(_0x1a5793){return{'model':db[_0x1a5793['model']],'as':_0x1a5793['as'],'attributes':_0x1a5793[_0x5111('0x24')],'include':_0x1a5793[_0x5111('0x22')]?_[_0x5111('0x23')](_0x1a5793[_0x5111('0x22')],function(_0x265149){return{'model':db[_0x265149[_0x5111('0x25')]],'as':_0x265149['as'],'attributes':_0x265149[_0x5111('0x24')],'include':_0x265149['include']?_[_0x5111('0x23')](_0x265149[_0x5111('0x22')],function(_0x25a75a){return{'model':db[_0x25a75a['model']],'as':_0x25a75a['as'],'attributes':_0x25a75a[_0x5111('0x24')]};}):[]};}):[]};}):[]:[]})[_0x5111('0x10')](function(_0x16107a){logger['info']('GetVoiceExtension',_0x52d236);logger[_0x5111('0x14')]('GetVoiceExtension',_0x52d236,JSON[_0x5111('0x16')](_0x16107a));_0x1b0e5c(_0x16107a);})['catch'](function(_0x35ed41){logger['error']('GetVoiceExtension',_0x35ed41['message'],_0x52d236);_0x1b3136(_0x2a1840[_0x5111('0x17')](0x1f4,_0x35ed41[_0x5111('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index c986dfb..7393b70 100644 --- a/server/api/voiceExtension/voiceExtension.socket.js +++ b/server/api/voiceExtension/voiceExtension.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14b=['removeListener','register','length','./voiceExtension.events','save','emit'];(function(_0x4282b1,_0x520de8){var _0x13d98a=function(_0x25fb96){while(--_0x25fb96){_0x4282b1['push'](_0x4282b1['shift']());}};_0x13d98a(++_0x520de8);}(_0xe14b,0x93));var _0xbe14=function(_0x97d5c7,_0x2b340b){_0x97d5c7=_0x97d5c7-0x0;var _0xce6d47=_0xe14b[_0x97d5c7];return _0xce6d47;};'use strict';var VoiceExtensionEvents=require(_0xbe14('0x0'));var events=[_0xbe14('0x1'),'remove','update'];function createListener(_0x11c3a0,_0x36393a){return function(_0x48a116){_0x36393a[_0xbe14('0x2')](_0x11c3a0,_0x48a116);};}function removeListener(_0x5ce8fb,_0x496c04){return function(){VoiceExtensionEvents[_0xbe14('0x3')](_0x5ce8fb,_0x496c04);};}exports[_0xbe14('0x4')]=function(_0x1fe204){for(var _0x1ff100=0x0,_0x1d9ade=events[_0xbe14('0x5')];_0x1ff100<_0x1d9ade;_0x1ff100++){var _0x196fca=events[_0x1ff100];var _0x566ae7=createListener('voiceExtension:'+_0x196fca,_0x1fe204);VoiceExtensionEvents['on'](_0x196fca,_0x566ae7);}}; \ No newline at end of file +var _0x814b=['removeListener','register','length','voiceExtension:','./voiceExtension.events','save','remove','update','emit'];(function(_0x117f4c,_0x36a9b1){var _0x2b24e9=function(_0x31761b){while(--_0x31761b){_0x117f4c['push'](_0x117f4c['shift']());}};_0x2b24e9(++_0x36a9b1);}(_0x814b,0x1a2));var _0xb814=function(_0x199b1f,_0x4ed849){_0x199b1f=_0x199b1f-0x0;var _0x267ac9=_0x814b[_0x199b1f];return _0x267ac9;};'use strict';var VoiceExtensionEvents=require(_0xb814('0x0'));var events=[_0xb814('0x1'),_0xb814('0x2'),_0xb814('0x3')];function createListener(_0xfbb64b,_0x477725){return function(_0x4a98af){_0x477725[_0xb814('0x4')](_0xfbb64b,_0x4a98af);};}function removeListener(_0x3e1e9,_0x258866){return function(){VoiceExtensionEvents[_0xb814('0x5')](_0x3e1e9,_0x258866);};}exports[_0xb814('0x6')]=function(_0x322a70){for(var _0x53e507=0x0,_0x3b0829=events[_0xb814('0x7')];_0x53e507<_0x3b0829;_0x53e507++){var _0x5c8539=events[_0x53e507];var _0x271af9=createListener(_0xb814('0x8')+_0x5c8539,_0x322a70);VoiceExtensionEvents['on'](_0x5c8539,_0x271af9);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 1aeba61..2da7118 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 _0xa46e=['delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','index','isAuthenticated','show','/:id/messages','create','put','update'];(function(_0x50827e,_0x235f53){var _0x249c67=function(_0x397d1e){while(--_0x397d1e){_0x50827e['push'](_0x50827e['shift']());}};_0x249c67(++_0x235f53);}(_0xa46e,0x8a));var _0xea46=function(_0x118139,_0x7ce965){_0x118139=_0x118139-0x0;var _0x2fece9=_0xa46e[_0x118139];return _0x2fece9;};'use strict';var multer=require(_0xea46('0x0'));var util=require(_0xea46('0x1'));var path=require('path');var timeout=require(_0xea46('0x2'));var express=require(_0xea46('0x3'));var router=express[_0xea46('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xea46('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xea46('0x6'));var controller=require('./voiceMail.controller');router[_0xea46('0x7')]('/',auth['isAuthenticated'](),controller[_0xea46('0x8')]);router[_0xea46('0x7')]('/:id',auth[_0xea46('0x9')](),controller[_0xea46('0xa')]);router[_0xea46('0x7')](_0xea46('0xb'),auth[_0xea46('0x9')](),controller['getMessages']);router['post']('/',auth['isAuthenticated'](),controller[_0xea46('0xc')]);router[_0xea46('0xd')]('/:id',auth[_0xea46('0x9')](),controller[_0xea46('0xe')]);router[_0xea46('0xf')]('/:id',auth[_0xea46('0x9')](),controller[_0xea46('0x10')]);module['exports']=router; \ No newline at end of file +var _0x326f=['multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','/:id','show','getMessages','post','create','put','delete','exports'];(function(_0x1dee0c,_0x13b016){var _0x12d97e=function(_0x32e84f){while(--_0x32e84f){_0x1dee0c['push'](_0x1dee0c['shift']());}};_0x12d97e(++_0x13b016);}(_0x326f,0xd1));var _0xf326=function(_0x34de92,_0x1f8c1b){_0x34de92=_0x34de92-0x0;var _0x13d952=_0x326f[_0x34de92];return _0x13d952;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var fs_extra=require(_0xf326('0x4'));var auth=require(_0xf326('0x5'));var interaction=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var controller=require(_0xf326('0x8'));router[_0xf326('0x9')]('/',auth[_0xf326('0xa')](),controller['index']);router[_0xf326('0x9')](_0xf326('0xb'),auth[_0xf326('0xa')](),controller[_0xf326('0xc')]);router['get']('/:id/messages',auth['isAuthenticated'](),controller[_0xf326('0xd')]);router[_0xf326('0xe')]('/',auth[_0xf326('0xa')](),controller[_0xf326('0xf')]);router[_0xf326('0x10')]('/:id',auth[_0xf326('0xa')](),controller['update']);router[_0xf326('0x11')]('/:id',auth[_0xf326('0xa')](),controller['destroy']);module[_0xf326('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 9f0d104..51733be 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 _0xf7b9=['trim','central','ENUM','yes','INTEGER','VIRTUAL','getDataValue','\x20-\x20','mailbox','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','string'];(function(_0x483fea,_0x54b1d0){var _0x1a910e=function(_0x5d266f){while(--_0x5d266f){_0x483fea['push'](_0x483fea['shift']());}};_0x1a910e(++_0x54b1d0);}(_0xf7b9,0x129));var _0x9f7b=function(_0x1716b4,_0x56cee4){_0x1716b4=_0x1716b4-0x0;var _0x54bd16=_0xf7b9[_0x1716b4];return _0x54bd16;};'use strict';var Sequelize=require('sequelize');module[_0x9f7b('0x0')]={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x9f7b('0x1')],'defaultValue':_0x9f7b('0x2'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0x9f7b('0x1')],'defaultValue':'','allowNull':![],'unique':_0x9f7b('0x3')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0x9f7b('0x1')]},'email':{'type':Sequelize[_0x9f7b('0x1')],'validate':{'isEmail':!![]},'set':function(_0x101239){this[_0x9f7b('0x4')](_0x9f7b('0x5'),typeof _0x101239===_0x9f7b('0x6')&&_0x101239[_0x9f7b('0x7')]()?_0x101239['trim']():null);}},'pager':{'type':Sequelize[_0x9f7b('0x1')]},'tz':{'type':Sequelize[_0x9f7b('0x1')],'defaultValue':_0x9f7b('0x8')},'attach':{'type':Sequelize[_0x9f7b('0x9')](_0x9f7b('0xa'),'no'),'defaultValue':_0x9f7b('0xa'),'allowNull':![]},'saycid':{'type':Sequelize[_0x9f7b('0x9')](_0x9f7b('0xa'),'no'),'defaultValue':_0x9f7b('0xa'),'allowNull':![]},'dialout':{'type':Sequelize[_0x9f7b('0x1')]},'callback':{'type':Sequelize[_0x9f7b('0x1')]},'review':{'type':Sequelize[_0x9f7b('0x9')](_0x9f7b('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0x9f7b('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0x9f7b('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x9f7b('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x9f7b('0x9')](_0x9f7b('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x9f7b('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x9f7b('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x9f7b('0x9')](_0x9f7b('0xa'),'no'),'defaultValue':_0x9f7b('0xa'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0x9f7b('0x1')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0x9f7b('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x9f7b('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x9f7b('0xc')],'get':function(){return this[_0x9f7b('0xd')]('fullname')+_0x9f7b('0xe')+this[_0x9f7b('0xd')](_0x9f7b('0xf'));}}}; \ No newline at end of file +var _0x3801=['trim','central','yes','ENUM','TINYINT(4)','INTEGER','fullname','\x20-\x20','getDataValue','mailbox','STRING','contest_mailbox','setDataValue','email','string'];(function(_0x53c4f8,_0x44ccaf){var _0x416458=function(_0x2632aa){while(--_0x2632aa){_0x53c4f8['push'](_0x53c4f8['shift']());}};_0x416458(++_0x44ccaf);}(_0x3801,0xfa));var _0x1380=function(_0x56ce7d,_0x57d050){_0x56ce7d=_0x56ce7d-0x0;var _0x72a880=_0x3801[_0x56ce7d];return _0x72a880;};'use strict';var Sequelize=require('sequelize');module['exports']={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x1380('0x0')],'defaultValue':'from-voicemail','unique':'contest_mailbox'},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0x1380('0x1')},'password':{'type':Sequelize[_0x1380('0x0')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x1380('0x0')],'validate':{'isEmail':!![]},'set':function(_0xc11c82){this[_0x1380('0x2')](_0x1380('0x3'),typeof _0xc11c82===_0x1380('0x4')&&_0xc11c82[_0x1380('0x5')]()?_0xc11c82[_0x1380('0x5')]():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize[_0x1380('0x0')],'defaultValue':_0x1380('0x6')},'attach':{'type':Sequelize['ENUM'](_0x1380('0x7'),'no'),'defaultValue':_0x1380('0x7'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0x1380('0x7'),'no'),'defaultValue':_0x1380('0x7'),'allowNull':![]},'dialout':{'type':Sequelize[_0x1380('0x0')]},'callback':{'type':Sequelize[_0x1380('0x0')]},'review':{'type':Sequelize['ENUM'](_0x1380('0x7'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x1380('0x8')](_0x1380('0x7'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x1380('0x8')](_0x1380('0x7'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x1380('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x1380('0x8')](_0x1380('0x7'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x1380('0x8')](_0x1380('0x7'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x1380('0x8')](_0x1380('0x7'),'no'),'defaultValue':_0x1380('0x7'),'allowNull':![]},'forcename':{'type':Sequelize[_0x1380('0x8')](_0x1380('0x7'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x1380('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x1380('0x8')](_0x1380('0x7'),'no'),'defaultValue':_0x1380('0x7'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0x1380('0x0')]},'emailbody':{'type':Sequelize[_0x1380('0x0')]},'maxsecs':{'type':Sequelize[_0x1380('0xa')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0x1380('0xb'))+_0x1380('0xc')+this[_0x1380('0xd')](_0x1380('0xe'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index ba128f3..95f8a91 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 _0x3c81=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','end','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','merge','filter','options','VoiceMail','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Voicemails','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','VoiceMailMessage','hasOwnProperty','mailbox','findAndCountAll','eml-format','rimraf','fast-json-patch','request-promise','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x1241b1,_0x55a7c8){var _0x3aa14d=function(_0x334b40){while(--_0x334b40){_0x1241b1['push'](_0x1241b1['shift']());}};_0x3aa14d(++_0x55a7c8);}(_0x3c81,0x102));var _0x13c8=function(_0x24ac8a,_0x4ab065){_0x24ac8a=_0x24ac8a-0x0;var _0x38cd87=_0x3c81[_0x24ac8a];return _0x38cd87;};'use strict';var emlformat=require(_0x13c8('0x0'));var rimraf=require(_0x13c8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x13c8('0x2'));var rp=require(_0x13c8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x13c8('0x4'));var sox=require(_0x13c8('0x5'));var csv=require(_0x13c8('0x6'));var ejs=require(_0x13c8('0x7'));var fs=require('fs');var fs_extra=require(_0x13c8('0x8'));var _=require(_0x13c8('0x9'));var squel=require(_0x13c8('0xa'));var crypto=require('crypto');var jsforce=require(_0x13c8('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x13c8('0x6'));var querystring=require(_0x13c8('0xc'));var Papa=require(_0x13c8('0xd'));var Redis=require(_0x13c8('0xe'));var authService=require(_0x13c8('0xf'));var qs=require(_0x13c8('0x10'));var as=require(_0x13c8('0x11'));var hardwareService=require(_0x13c8('0x12'));var logger=require(_0x13c8('0x13'))(_0x13c8('0x14'));var utils=require(_0x13c8('0x15'));var config=require(_0x13c8('0x16'));var licenseUtil=require(_0x13c8('0x17'));var db=require(_0x13c8('0x18'))['db'];function respondWithStatusCode(_0x5ab91d,_0x21442d){_0x21442d=_0x21442d||0xcc;return function(_0x7b6da8){if(_0x7b6da8){return _0x5ab91d[_0x13c8('0x19')](_0x21442d);}return _0x5ab91d[_0x13c8('0x1a')](_0x21442d)['end']();};}function respondWithResult(_0x42955d,_0x515681){_0x515681=_0x515681||0xc8;return function(_0x4d7a88){if(_0x4d7a88){return _0x42955d['status'](_0x515681)[_0x13c8('0x1b')](_0x4d7a88);}};}function respondWithFilteredResult(_0x5e0e06,_0x337397){return function(_0x17a3c1){if(_0x17a3c1){var _0x23f64e=typeof _0x337397[_0x13c8('0x1c')]==='undefined'&&typeof _0x337397[_0x13c8('0x1d')]===_0x13c8('0x1e');var _0x31ae02=_0x17a3c1[_0x13c8('0x1f')];var _0xce1ad2=_0x23f64e?0x0:_0x337397[_0x13c8('0x1c')];var _0x346417=_0x23f64e?_0x17a3c1[_0x13c8('0x1f')]:_0x337397[_0x13c8('0x1c')]+_0x337397[_0x13c8('0x1d')];var _0xe9386a;if(_0x346417>=_0x31ae02){_0x346417=_0x31ae02;_0xe9386a=0xc8;}else{_0xe9386a=0xce;}_0x5e0e06['status'](_0xe9386a);return _0x5e0e06[_0x13c8('0x20')](_0x13c8('0x21'),_0xce1ad2+'-'+_0x346417+'/'+_0x31ae02)[_0x13c8('0x1b')](_0x17a3c1);}return null;};}function patchUpdates(_0x313ea3){return function(_0x513085){try{jsonpatch[_0x13c8('0x22')](_0x513085,_0x313ea3,!![]);}catch(_0x3c4603){return BPromise[_0x13c8('0x23')](_0x3c4603);}return _0x513085[_0x13c8('0x24')]();};}function saveUpdates(_0x436d5d,_0x2fc123){return function(_0x5ab47f){if(_0x5ab47f){return _0x5ab47f[_0x13c8('0x25')](_0x436d5d)[_0x13c8('0x26')](function(_0x315d6c){return _0x315d6c;});}return null;};}function removeEntity(_0xcf41d2,_0x577df6){return function(_0x1770e5){if(_0x1770e5){return _0x1770e5[_0x13c8('0x27')]()['then'](function(){var _0x49b552=_0x1770e5[_0x13c8('0x28')]({'plain':!![]});var _0x4aff35='Voicemails';return db['UserProfileResource'][_0x13c8('0x27')]({'where':{'type':_0x4aff35,'resourceId':_0x49b552['id']}})[_0x13c8('0x26')](function(){return _0x1770e5;});})['then'](function(){_0xcf41d2['status'](0xcc)[_0x13c8('0x29')]();});}};}function handleEntityNotFound(_0x596166,_0x545b47){return function(_0x1c7dc4){if(!_0x1c7dc4){_0x596166[_0x13c8('0x19')](0x194);}return _0x1c7dc4;};}function handleError(_0x34fdbe,_0x560ede){_0x560ede=_0x560ede||0x1f4;return function(_0x5ef2f7){logger[_0x13c8('0x2a')](_0x5ef2f7[_0x13c8('0x2b')]);if(_0x5ef2f7[_0x13c8('0x2c')]){delete _0x5ef2f7[_0x13c8('0x2c')];}_0x34fdbe[_0x13c8('0x1a')](_0x560ede)[_0x13c8('0x2d')](_0x5ef2f7);};}exports[_0x13c8('0x2e')]=function(_0x4a1b9c,_0x109cb8){var _0xcbc9b7={},_0x5a5911={},_0x5c85e4={'count':0x0,'rows':[]};var _0x23a725=_[_0x13c8('0x2f')](db['VoiceMail'][_0x13c8('0x30')],function(_0x355ddc){return{'name':_0x355ddc['fieldName'],'type':_0x355ddc[_0x13c8('0x31')][_0x13c8('0x32')]};});_0x5a5911[_0x13c8('0x33')]=_[_0x13c8('0x2f')](_0x23a725,_0x13c8('0x2c'));_0x5a5911[_0x13c8('0x34')]=_[_0x13c8('0x35')](_0x4a1b9c[_0x13c8('0x34')]);_0x5a5911['filters']=_['intersection'](_0x5a5911[_0x13c8('0x33')],_0x5a5911[_0x13c8('0x34')]);_0xcbc9b7['attributes']=_[_0x13c8('0x36')](_0x5a5911['model'],qs[_0x13c8('0x37')](_0x4a1b9c['query'][_0x13c8('0x37')]));_0xcbc9b7[_0x13c8('0x38')]=_0xcbc9b7[_0x13c8('0x38')][_0x13c8('0x39')]?_0xcbc9b7[_0x13c8('0x38')]:_0x5a5911[_0x13c8('0x33')];if(!_0x4a1b9c[_0x13c8('0x34')]['hasOwnProperty'](_0x13c8('0x3a'))){_0xcbc9b7[_0x13c8('0x1d')]=qs['limit'](_0x4a1b9c[_0x13c8('0x34')][_0x13c8('0x1d')]);_0xcbc9b7[_0x13c8('0x1c')]=qs['offset'](_0x4a1b9c['query']['offset']);}_0xcbc9b7[_0x13c8('0x3b')]=qs[_0x13c8('0x3c')](_0x4a1b9c[_0x13c8('0x34')][_0x13c8('0x3c')]);_0xcbc9b7[_0x13c8('0x3d')]=qs[_0x13c8('0x3e')](_[_0x13c8('0x3f')](_0x4a1b9c[_0x13c8('0x34')],_0x5a5911[_0x13c8('0x3e')]),_0x23a725);if(_0x4a1b9c['query']['filter']){_0xcbc9b7[_0x13c8('0x3d')]=_[_0x13c8('0x40')](_0xcbc9b7[_0x13c8('0x3d')],{'$or':_[_0x13c8('0x2f')](_0x23a725,function(_0x4f1bed){if(_0x4f1bed[_0x13c8('0x31')]!=='VIRTUAL'){var _0x343dba={};_0x343dba[_0x4f1bed[_0x13c8('0x2c')]]={'$like':'%'+_0x4a1b9c[_0x13c8('0x34')][_0x13c8('0x41')]+'%'};return _0x343dba;}})});}_0xcbc9b7=_[_0x13c8('0x40')]({},_0xcbc9b7,_0x4a1b9c[_0x13c8('0x42')]);var _0xb272c0={'where':_0xcbc9b7[_0x13c8('0x3d')]};return db[_0x13c8('0x43')][_0x13c8('0x1f')](_0xb272c0)[_0x13c8('0x26')](function(_0x416169){_0x5c85e4[_0x13c8('0x1f')]=_0x416169;if(_0x4a1b9c[_0x13c8('0x34')][_0x13c8('0x44')]){_0xcbc9b7[_0x13c8('0x45')]=[{'all':!![]}];}return db[_0x13c8('0x43')][_0x13c8('0x46')](_0xcbc9b7);})[_0x13c8('0x26')](function(_0x1cff99){_0x5c85e4[_0x13c8('0x47')]=_0x1cff99;return _0x5c85e4;})[_0x13c8('0x26')](respondWithFilteredResult(_0x109cb8,_0xcbc9b7))[_0x13c8('0x48')](handleError(_0x109cb8,null));};exports[_0x13c8('0x49')]=function(_0x44ee66,_0x57e65f){var _0x3ef04e={'raw':!![],'where':{'id':_0x44ee66[_0x13c8('0x4a')]['id']}},_0x3fcb7f={};_0x3fcb7f[_0x13c8('0x33')]=_[_0x13c8('0x35')](db['VoiceMail']['rawAttributes']);_0x3fcb7f[_0x13c8('0x34')]=_[_0x13c8('0x35')](_0x44ee66[_0x13c8('0x34')]);_0x3fcb7f['filters']=_['intersection'](_0x3fcb7f['model'],_0x3fcb7f[_0x13c8('0x34')]);_0x3ef04e['attributes']=_[_0x13c8('0x36')](_0x3fcb7f['model'],qs[_0x13c8('0x37')](_0x44ee66[_0x13c8('0x34')][_0x13c8('0x37')]));_0x3ef04e[_0x13c8('0x38')]=_0x3ef04e[_0x13c8('0x38')][_0x13c8('0x39')]?_0x3ef04e['attributes']:_0x3fcb7f[_0x13c8('0x33')];if(_0x44ee66[_0x13c8('0x34')]['includeAll']){_0x3ef04e[_0x13c8('0x45')]=[{'all':!![]}];}_0x3ef04e=_[_0x13c8('0x40')]({},_0x3ef04e,_0x44ee66[_0x13c8('0x42')]);return db[_0x13c8('0x43')][_0x13c8('0x4b')](_0x3ef04e)['then'](handleEntityNotFound(_0x57e65f,null))[_0x13c8('0x26')](respondWithResult(_0x57e65f,null))[_0x13c8('0x48')](handleError(_0x57e65f,null));};exports[_0x13c8('0x4c')]=function(_0x38418b,_0x185d18){return db['VoiceMail'][_0x13c8('0x4c')](_0x38418b[_0x13c8('0x4d')],{})[_0x13c8('0x26')](function(_0x6b042b){var _0x2d4f87=_0x38418b[_0x13c8('0x4e')][_0x13c8('0x28')]({'plain':!![]});if(!_0x2d4f87)throw new Error(_0x13c8('0x4f'));if(_0x2d4f87[_0x13c8('0x50')]===_0x13c8('0x4e')){var _0x266f4e=_0x6b042b['get']({'plain':!![]});var _0x10ba7c=_0x13c8('0x51');return db[_0x13c8('0x52')][_0x13c8('0x4b')]({'where':{'name':_0x10ba7c,'userProfileId':_0x2d4f87[_0x13c8('0x53')]},'raw':!![]})[_0x13c8('0x26')](function(_0x48b7f6){if(_0x48b7f6&&_0x48b7f6[_0x13c8('0x54')]===0x0){return db[_0x13c8('0x55')][_0x13c8('0x4c')]({'name':_0x266f4e['name'],'resourceId':_0x266f4e['id'],'type':_0x48b7f6['name'],'sectionId':_0x48b7f6['id']},{})[_0x13c8('0x26')](function(){return _0x6b042b;});}else{return _0x6b042b;}})[_0x13c8('0x48')](function(_0x55d353){logger[_0x13c8('0x2a')](_0x13c8('0x56'),_0x55d353);throw _0x55d353;});}return _0x6b042b;})['then'](respondWithResult(_0x185d18,0xc9))[_0x13c8('0x48')](handleError(_0x185d18,null));};exports['update']=function(_0x242791,_0x1f67bd){if(_0x242791[_0x13c8('0x4d')]['id']){delete _0x242791['body']['id'];}return db[_0x13c8('0x43')][_0x13c8('0x4b')]({'where':{'id':_0x242791['params']['id']}})[_0x13c8('0x26')](handleEntityNotFound(_0x1f67bd,null))['then'](saveUpdates(_0x242791[_0x13c8('0x4d')],null))[_0x13c8('0x26')](respondWithResult(_0x1f67bd,null))[_0x13c8('0x48')](handleError(_0x1f67bd,null));};exports[_0x13c8('0x27')]=function(_0x3760e4,_0x5f4884){return db[_0x13c8('0x43')]['find']({'where':{'id':_0x3760e4['params']['id']}})['then'](handleEntityNotFound(_0x5f4884,null))['then'](removeEntity(_0x5f4884,null))['catch'](handleError(_0x5f4884,null));};exports[_0x13c8('0x57')]=function(_0x46074c,_0x1515a5,_0x1f383f){return db[_0x13c8('0x43')][_0x13c8('0x58')]({'where':{'id':_0x46074c[_0x13c8('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1515a5,null))['then'](function(_0x41f9d7){var _0x30e3e4;var _0x27760b={},_0x11b3ba={};_0x11b3ba[_0x13c8('0x33')]=_[_0x13c8('0x35')](db[_0x13c8('0x59')][_0x13c8('0x30')]);_0x11b3ba['query']=_[_0x13c8('0x35')](_0x46074c[_0x13c8('0x34')]);_0x11b3ba['filters']=_[_0x13c8('0x36')](_0x11b3ba[_0x13c8('0x33')],_0x11b3ba[_0x13c8('0x34')]);_0x27760b[_0x13c8('0x38')]=_[_0x13c8('0x36')](_0x11b3ba[_0x13c8('0x33')],qs[_0x13c8('0x37')](_0x46074c[_0x13c8('0x34')][_0x13c8('0x37')]));_0x27760b[_0x13c8('0x38')]=_0x27760b[_0x13c8('0x38')][_0x13c8('0x39')]?_0x27760b[_0x13c8('0x38')]:_0x11b3ba[_0x13c8('0x33')];if(!_0x46074c[_0x13c8('0x34')][_0x13c8('0x5a')]('nolimit')){_0x27760b[_0x13c8('0x1d')]=qs['limit'](_0x46074c[_0x13c8('0x34')][_0x13c8('0x1d')]);_0x27760b['offset']=qs[_0x13c8('0x1c')](_0x46074c[_0x13c8('0x34')]['offset']);}_0x27760b[_0x13c8('0x3b')]=qs[_0x13c8('0x3c')](_0x46074c[_0x13c8('0x34')][_0x13c8('0x3c')]);_0x27760b[_0x13c8('0x3d')]=qs[_0x13c8('0x3e')](_[_0x13c8('0x3f')](_0x46074c[_0x13c8('0x34')],_0x11b3ba[_0x13c8('0x3e')]));if(_0x46074c[_0x13c8('0x34')][_0x13c8('0x41')]){_0x27760b['where']=_[_0x13c8('0x40')](_0x27760b[_0x13c8('0x3d')],{'$or':_[_0x13c8('0x2f')](_0x27760b[_0x13c8('0x38')],function(_0x372ae4){var _0x23c67e={};_0x23c67e[_0x372ae4]={'$like':'%'+_0x46074c['query'][_0x13c8('0x41')]+'%'};return _0x23c67e;})});}_0x27760b[_0x13c8('0x3d')]=_[_0x13c8('0x40')](_0x27760b['where'],{'mailboxuser':_0x41f9d7[_0x13c8('0x5b')]});_0x27760b=_[_0x13c8('0x40')]({},_0x27760b,_0x46074c[_0x13c8('0x42')]);return db[_0x13c8('0x59')][_0x13c8('0x5c')](_0x27760b)[_0x13c8('0x26')](respondWithFilteredResult(_0x1515a5,_0x27760b));})['catch'](handleError(_0x1515a5,null));}; \ No newline at end of file +var _0x7af2=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','getMessages','findOne','VoiceMailMessage','rawAttributes','mailbox','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','get','Voicemails','UserProfileResource','error','stack','name','send','index','map','VoiceMail','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','length','include','find','create'];(function(_0x5a354a,_0x52b415){var _0x422361=function(_0xb9763e){while(--_0xb9763e){_0x5a354a['push'](_0x5a354a['shift']());}};_0x422361(++_0x52b415);}(_0x7af2,0x119));var _0x27af=function(_0xcc55fc,_0x2ff129){_0xcc55fc=_0xcc55fc-0x0;var _0x3e01c3=_0x7af2[_0xcc55fc];return _0x3e01c3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x27af('0x0'));var zipdir=require(_0x27af('0x1'));var jsonpatch=require(_0x27af('0x2'));var rp=require(_0x27af('0x3'));var moment=require('moment');var BPromise=require(_0x27af('0x4'));var Mustache=require(_0x27af('0x5'));var util=require(_0x27af('0x6'));var path=require(_0x27af('0x7'));var sox=require(_0x27af('0x8'));var csv=require(_0x27af('0x9'));var ejs=require(_0x27af('0xa'));var fs=require('fs');var fs_extra=require(_0x27af('0xb'));var _=require(_0x27af('0xc'));var squel=require('squel');var crypto=require(_0x27af('0xd'));var jsforce=require(_0x27af('0xe'));var deskjs=require(_0x27af('0xf'));var toCsv=require('to-csv');var querystring=require(_0x27af('0x10'));var Papa=require(_0x27af('0x11'));var Redis=require(_0x27af('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x27af('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x27af('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x27af('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x27af('0x16'))['db'];function respondWithStatusCode(_0x49a883,_0x406340){_0x406340=_0x406340||0xcc;return function(_0x203501){if(_0x203501){return _0x49a883[_0x27af('0x17')](_0x406340);}return _0x49a883[_0x27af('0x18')](_0x406340)[_0x27af('0x19')]();};}function respondWithResult(_0x1edb50,_0x234825){_0x234825=_0x234825||0xc8;return function(_0x3da435){if(_0x3da435){return _0x1edb50[_0x27af('0x18')](_0x234825)[_0x27af('0x1a')](_0x3da435);}};}function respondWithFilteredResult(_0x30f675,_0x9c2d4b){return function(_0x2d7800){if(_0x2d7800){var _0x3102c4=typeof _0x9c2d4b[_0x27af('0x1b')]===_0x27af('0x1c')&&typeof _0x9c2d4b[_0x27af('0x1d')]===_0x27af('0x1c');var _0x58583a=_0x2d7800[_0x27af('0x1e')];var _0x31d702=_0x3102c4?0x0:_0x9c2d4b['offset'];var _0x4e6e2f=_0x3102c4?_0x2d7800[_0x27af('0x1e')]:_0x9c2d4b[_0x27af('0x1b')]+_0x9c2d4b[_0x27af('0x1d')];var _0x31573a;if(_0x4e6e2f>=_0x58583a){_0x4e6e2f=_0x58583a;_0x31573a=0xc8;}else{_0x31573a=0xce;}_0x30f675[_0x27af('0x18')](_0x31573a);return _0x30f675['set'](_0x27af('0x1f'),_0x31d702+'-'+_0x4e6e2f+'/'+_0x58583a)[_0x27af('0x1a')](_0x2d7800);}return null;};}function patchUpdates(_0xcb4b90){return function(_0x5e7c19){try{jsonpatch[_0x27af('0x20')](_0x5e7c19,_0xcb4b90,!![]);}catch(_0x2eec5f){return BPromise[_0x27af('0x21')](_0x2eec5f);}return _0x5e7c19['save']();};}function saveUpdates(_0x2dce2b,_0x2460f4){return function(_0x30720b){if(_0x30720b){return _0x30720b[_0x27af('0x22')](_0x2dce2b)[_0x27af('0x23')](function(_0x396156){return _0x396156;});}return null;};}function removeEntity(_0x43dd9e,_0x35b36d){return function(_0x2e1bb0){if(_0x2e1bb0){return _0x2e1bb0['destroy']()['then'](function(){var _0x4b8fe6=_0x2e1bb0[_0x27af('0x24')]({'plain':!![]});var _0x4feaf1=_0x27af('0x25');return db[_0x27af('0x26')]['destroy']({'where':{'type':_0x4feaf1,'resourceId':_0x4b8fe6['id']}})[_0x27af('0x23')](function(){return _0x2e1bb0;});})[_0x27af('0x23')](function(){_0x43dd9e[_0x27af('0x18')](0xcc)[_0x27af('0x19')]();});}};}function handleEntityNotFound(_0x39b8ee,_0x3ca40e){return function(_0x775d4e){if(!_0x775d4e){_0x39b8ee['sendStatus'](0x194);}return _0x775d4e;};}function handleError(_0x14d5fc,_0x250d5b){_0x250d5b=_0x250d5b||0x1f4;return function(_0xadd38e){logger[_0x27af('0x27')](_0xadd38e[_0x27af('0x28')]);if(_0xadd38e[_0x27af('0x29')]){delete _0xadd38e[_0x27af('0x29')];}_0x14d5fc[_0x27af('0x18')](_0x250d5b)[_0x27af('0x2a')](_0xadd38e);};}exports[_0x27af('0x2b')]=function(_0x205e41,_0x4f4955){var _0x15e867={},_0x14b2e7={},_0x3800a1={'count':0x0,'rows':[]};var _0x575887=_[_0x27af('0x2c')](db[_0x27af('0x2d')]['rawAttributes'],function(_0x51bc97){return{'name':_0x51bc97[_0x27af('0x2e')],'type':_0x51bc97[_0x27af('0x2f')]['key']};});_0x14b2e7[_0x27af('0x30')]=_[_0x27af('0x2c')](_0x575887,_0x27af('0x29'));_0x14b2e7[_0x27af('0x31')]=_[_0x27af('0x32')](_0x205e41[_0x27af('0x31')]);_0x14b2e7[_0x27af('0x33')]=_[_0x27af('0x34')](_0x14b2e7[_0x27af('0x30')],_0x14b2e7[_0x27af('0x31')]);_0x15e867[_0x27af('0x35')]=_['intersection'](_0x14b2e7['model'],qs[_0x27af('0x36')](_0x205e41[_0x27af('0x31')]['fields']));_0x15e867[_0x27af('0x35')]=_0x15e867[_0x27af('0x35')]['length']?_0x15e867[_0x27af('0x35')]:_0x14b2e7[_0x27af('0x30')];if(!_0x205e41[_0x27af('0x31')][_0x27af('0x37')](_0x27af('0x38'))){_0x15e867['limit']=qs[_0x27af('0x1d')](_0x205e41[_0x27af('0x31')]['limit']);_0x15e867['offset']=qs[_0x27af('0x1b')](_0x205e41[_0x27af('0x31')][_0x27af('0x1b')]);}_0x15e867[_0x27af('0x39')]=qs[_0x27af('0x3a')](_0x205e41[_0x27af('0x31')]['sort']);_0x15e867[_0x27af('0x3b')]=qs['filters'](_[_0x27af('0x3c')](_0x205e41[_0x27af('0x31')],_0x14b2e7[_0x27af('0x33')]),_0x575887);if(_0x205e41[_0x27af('0x31')][_0x27af('0x3d')]){_0x15e867['where']=_[_0x27af('0x3e')](_0x15e867[_0x27af('0x3b')],{'$or':_[_0x27af('0x2c')](_0x575887,function(_0x3faebd){if(_0x3faebd[_0x27af('0x2f')]!==_0x27af('0x3f')){var _0x415d9f={};_0x415d9f[_0x3faebd[_0x27af('0x29')]]={'$like':'%'+_0x205e41[_0x27af('0x31')][_0x27af('0x3d')]+'%'};return _0x415d9f;}})});}_0x15e867=_[_0x27af('0x3e')]({},_0x15e867,_0x205e41[_0x27af('0x40')]);var _0x24ee9b={'where':_0x15e867[_0x27af('0x3b')]};return db['VoiceMail'][_0x27af('0x1e')](_0x24ee9b)[_0x27af('0x23')](function(_0x44534b){_0x3800a1[_0x27af('0x1e')]=_0x44534b;if(_0x205e41['query'][_0x27af('0x41')]){_0x15e867['include']=[{'all':!![]}];}return db['VoiceMail'][_0x27af('0x42')](_0x15e867);})[_0x27af('0x23')](function(_0x279f99){_0x3800a1[_0x27af('0x43')]=_0x279f99;return _0x3800a1;})[_0x27af('0x23')](respondWithFilteredResult(_0x4f4955,_0x15e867))[_0x27af('0x44')](handleError(_0x4f4955,null));};exports[_0x27af('0x45')]=function(_0x26eb28,_0x2269e8){var _0x100fcb={'raw':!![],'where':{'id':_0x26eb28[_0x27af('0x46')]['id']}},_0x1e3c35={};_0x1e3c35['model']=_[_0x27af('0x32')](db[_0x27af('0x2d')]['rawAttributes']);_0x1e3c35['query']=_[_0x27af('0x32')](_0x26eb28[_0x27af('0x31')]);_0x1e3c35[_0x27af('0x33')]=_[_0x27af('0x34')](_0x1e3c35[_0x27af('0x30')],_0x1e3c35['query']);_0x100fcb[_0x27af('0x35')]=_['intersection'](_0x1e3c35[_0x27af('0x30')],qs[_0x27af('0x36')](_0x26eb28[_0x27af('0x31')][_0x27af('0x36')]));_0x100fcb[_0x27af('0x35')]=_0x100fcb[_0x27af('0x35')][_0x27af('0x47')]?_0x100fcb['attributes']:_0x1e3c35['model'];if(_0x26eb28[_0x27af('0x31')]['includeAll']){_0x100fcb[_0x27af('0x48')]=[{'all':!![]}];}_0x100fcb=_[_0x27af('0x3e')]({},_0x100fcb,_0x26eb28[_0x27af('0x40')]);return db[_0x27af('0x2d')][_0x27af('0x49')](_0x100fcb)[_0x27af('0x23')](handleEntityNotFound(_0x2269e8,null))[_0x27af('0x23')](respondWithResult(_0x2269e8,null))['catch'](handleError(_0x2269e8,null));};exports[_0x27af('0x4a')]=function(_0xc7e2a8,_0x20e180){return db[_0x27af('0x2d')][_0x27af('0x4a')](_0xc7e2a8['body'],{})[_0x27af('0x23')](function(_0x25f960){var _0x28ba64=_0xc7e2a8['user']['get']({'plain':!![]});if(!_0x28ba64)throw new Error(_0x27af('0x4b'));if(_0x28ba64[_0x27af('0x4c')]===_0x27af('0x4d')){var _0x5be44f=_0x25f960['get']({'plain':!![]});var _0x2fad23='Voicemails';return db[_0x27af('0x4e')][_0x27af('0x49')]({'where':{'name':_0x2fad23,'userProfileId':_0x28ba64[_0x27af('0x4f')]},'raw':!![]})[_0x27af('0x23')](function(_0x38aa14){if(_0x38aa14&&_0x38aa14[_0x27af('0x50')]===0x0){return db[_0x27af('0x26')][_0x27af('0x4a')]({'name':_0x5be44f[_0x27af('0x29')],'resourceId':_0x5be44f['id'],'type':_0x38aa14[_0x27af('0x29')],'sectionId':_0x38aa14['id']},{})[_0x27af('0x23')](function(){return _0x25f960;});}else{return _0x25f960;}})['catch'](function(_0x76ed78){logger[_0x27af('0x27')](_0x27af('0x51'),_0x76ed78);throw _0x76ed78;});}return _0x25f960;})[_0x27af('0x23')](respondWithResult(_0x20e180,0xc9))[_0x27af('0x44')](handleError(_0x20e180,null));};exports[_0x27af('0x22')]=function(_0x20c155,_0x31eaa9){if(_0x20c155['body']['id']){delete _0x20c155[_0x27af('0x52')]['id'];}return db['VoiceMail'][_0x27af('0x49')]({'where':{'id':_0x20c155[_0x27af('0x46')]['id']}})[_0x27af('0x23')](handleEntityNotFound(_0x31eaa9,null))['then'](saveUpdates(_0x20c155[_0x27af('0x52')],null))['then'](respondWithResult(_0x31eaa9,null))[_0x27af('0x44')](handleError(_0x31eaa9,null));};exports[_0x27af('0x53')]=function(_0x4769ff,_0x5bf8b0){return db[_0x27af('0x2d')]['find']({'where':{'id':_0x4769ff[_0x27af('0x46')]['id']}})['then'](handleEntityNotFound(_0x5bf8b0,null))[_0x27af('0x23')](removeEntity(_0x5bf8b0,null))[_0x27af('0x44')](handleError(_0x5bf8b0,null));};exports[_0x27af('0x54')]=function(_0x571064,_0x4bc851,_0x5eab7d){return db[_0x27af('0x2d')][_0x27af('0x55')]({'where':{'id':_0x571064[_0x27af('0x46')]['id']}})['then'](handleEntityNotFound(_0x4bc851,null))[_0x27af('0x23')](function(_0x306c56){var _0x6761d4;var _0x34c855={},_0x299f63={};_0x299f63[_0x27af('0x30')]=_['keys'](db[_0x27af('0x56')][_0x27af('0x57')]);_0x299f63[_0x27af('0x31')]=_[_0x27af('0x32')](_0x571064['query']);_0x299f63[_0x27af('0x33')]=_['intersection'](_0x299f63[_0x27af('0x30')],_0x299f63[_0x27af('0x31')]);_0x34c855['attributes']=_[_0x27af('0x34')](_0x299f63[_0x27af('0x30')],qs['fields'](_0x571064['query'][_0x27af('0x36')]));_0x34c855[_0x27af('0x35')]=_0x34c855[_0x27af('0x35')]['length']?_0x34c855[_0x27af('0x35')]:_0x299f63[_0x27af('0x30')];if(!_0x571064['query'][_0x27af('0x37')](_0x27af('0x38'))){_0x34c855['limit']=qs['limit'](_0x571064[_0x27af('0x31')][_0x27af('0x1d')]);_0x34c855['offset']=qs['offset'](_0x571064[_0x27af('0x31')][_0x27af('0x1b')]);}_0x34c855[_0x27af('0x39')]=qs[_0x27af('0x3a')](_0x571064[_0x27af('0x31')][_0x27af('0x3a')]);_0x34c855[_0x27af('0x3b')]=qs['filters'](_['pick'](_0x571064[_0x27af('0x31')],_0x299f63[_0x27af('0x33')]));if(_0x571064[_0x27af('0x31')][_0x27af('0x3d')]){_0x34c855[_0x27af('0x3b')]=_[_0x27af('0x3e')](_0x34c855[_0x27af('0x3b')],{'$or':_[_0x27af('0x2c')](_0x34c855[_0x27af('0x35')],function(_0x13c9ff){var _0x444f21={};_0x444f21[_0x13c9ff]={'$like':'%'+_0x571064[_0x27af('0x31')][_0x27af('0x3d')]+'%'};return _0x444f21;})});}_0x34c855[_0x27af('0x3b')]=_[_0x27af('0x3e')](_0x34c855[_0x27af('0x3b')],{'mailboxuser':_0x306c56[_0x27af('0x58')]});_0x34c855=_['merge']({},_0x34c855,_0x571064[_0x27af('0x40')]);return db[_0x27af('0x56')]['findAndCountAll'](_0x34c855)[_0x27af('0x23')](respondWithFilteredResult(_0x4bc851,_0x34c855));})[_0x27af('0x44')](handleError(_0x4bc851,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index f81f226..be2ccf9 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 _0x5a63=['rimraf','../../config/environment','./voiceMail.attributes','exports','VoiceMail','mailbox_context','context','lodash','util','moment','path'];(function(_0x446879,_0x5220e8){var _0x1f466e=function(_0x2042ca){while(--_0x2042ca){_0x446879['push'](_0x446879['shift']());}};_0x1f466e(++_0x5220e8);}(_0x5a63,0xe3));var _0x35a6=function(_0x396dcb,_0x29c598){_0x396dcb=_0x396dcb-0x0;var _0x373006=_0x5a63[_0x396dcb];return _0x373006;};'use strict';var _=require(_0x35a6('0x0'));var util=require(_0x35a6('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x35a6('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x35a6('0x3'));var rimraf=require(_0x35a6('0x4'));var config=require(_0x35a6('0x5'));var attributes=require(_0x35a6('0x6'));module[_0x35a6('0x7')]=function(_0x489043,_0x25e5a6){return _0x489043['define'](_0x35a6('0x8'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0x35a6('0x9'),'fields':['mailbox',_0x35a6('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbb46=['../../config/environment','exports','define','VoiceMail','voice_voicemail','mailbox','context','util','../../config/logger','api','rimraf'];(function(_0x1e8762,_0x27f92b){var _0x2f0f17=function(_0x1f7ae1){while(--_0x1f7ae1){_0x1e8762['push'](_0x1e8762['shift']());}};_0x2f0f17(++_0x27f92b);}(_0xbb46,0xd8));var _0x6bb4=function(_0x1bd4ca,_0x342721){_0x1bd4ca=_0x1bd4ca-0x0;var _0x5c422b=_0xbb46[_0x1bd4ca];return _0x5c422b;};'use strict';var _=require('lodash');var util=require(_0x6bb4('0x0'));var logger=require(_0x6bb4('0x1'))(_0x6bb4('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6bb4('0x3'));var config=require(_0x6bb4('0x4'));var attributes=require('./voiceMail.attributes');module[_0x6bb4('0x5')]=function(_0xbe076f,_0x540d6c){return _0xbe076f[_0x6bb4('0x6')](_0x6bb4('0x7'),attributes,{'tableName':_0x6bb4('0x8'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0x6bb4('0x9'),_0x6bb4('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 02e3c93..c30560b 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 _0xe249=['info','request\x20sent','debug','stringify','code','error','VoiceMail,\x20%s,\x20%s','message','result','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then'];(function(_0x31bfd6,_0x3ca078){var _0x332588=function(_0x26629c){while(--_0x26629c){_0x31bfd6['push'](_0x31bfd6['shift']());}};_0x332588(++_0x3ca078);}(_0xe249,0xf0));var _0x9e24=function(_0x7df195,_0x8d167b){_0x7df195=_0x7df195-0x0;var _0x187a3c=_0xe249[_0x7df195];return _0x187a3c;};'use strict';var _=require(_0x9e24('0x0'));var util=require(_0x9e24('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9e24('0x2'));var fs=require('fs');var Redis=require(_0x9e24('0x3'));var db=require(_0x9e24('0x4'))['db'];var utils=require(_0x9e24('0x5'));var logger=require(_0x9e24('0x6'))('rpc');var config=require(_0x9e24('0x7'));var jayson=require(_0x9e24('0x8'));var client=jayson[_0x9e24('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f6b55,_0x3c2b0b,_0x1f477e){return new BPromise(function(_0x1add06,_0x547cb5){return client[_0x9e24('0xa')](_0x1f6b55,_0x1f477e)[_0x9e24('0xb')](function(_0x51403e){logger[_0x9e24('0xc')]('VoiceMail,\x20%s,\x20%s',_0x3c2b0b,_0x9e24('0xd'));logger[_0x9e24('0xe')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x3c2b0b,'request\x20sent',JSON[_0x9e24('0xf')](_0x51403e));if(_0x51403e['error']){if(_0x51403e['error'][_0x9e24('0x10')]===0x1f4){logger[_0x9e24('0x11')](_0x9e24('0x12'),_0x3c2b0b,_0x51403e[_0x9e24('0x11')][_0x9e24('0x13')]);return _0x547cb5(_0x51403e[_0x9e24('0x11')][_0x9e24('0x13')]);}logger[_0x9e24('0x11')]('VoiceMail,\x20%s,\x20%s',_0x3c2b0b,_0x51403e[_0x9e24('0x11')]['message']);return _0x1add06(_0x51403e[_0x9e24('0x11')]['message']);}else{logger[_0x9e24('0xc')](_0x9e24('0x12'),_0x3c2b0b,'request\x20sent');_0x1add06(_0x51403e[_0x9e24('0x14')][_0x9e24('0x13')]);}})['catch'](function(_0x1700ab){logger['error'](_0x9e24('0x12'),_0x3c2b0b,_0x1700ab);_0x547cb5(_0x1700ab);});});} \ No newline at end of file +var _0xf360=['message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x269e9f,_0x11953b){var _0xa8d008=function(_0x2721ad){while(--_0x2721ad){_0x269e9f['push'](_0x269e9f['shift']());}};_0xa8d008(++_0x11953b);}(_0xf360,0xb3));var _0x0f36=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xf360[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require('lodash');var util=require(_0x0f36('0x0'));var moment=require('moment');var BPromise=require(_0x0f36('0x1'));var rs=require(_0x0f36('0x2'));var fs=require('fs');var Redis=require(_0x0f36('0x3'));var db=require(_0x0f36('0x4'))['db'];var utils=require(_0x0f36('0x5'));var logger=require('../../config/logger')(_0x0f36('0x6'));var config=require(_0x0f36('0x7'));var jayson=require(_0x0f36('0x8'));var client=jayson['client'][_0x0f36('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x8eac65,_0xac0138,_0x1fdefb){return new BPromise(function(_0x3f3e5a,_0x50a46b){return client[_0x0f36('0xa')](_0x8eac65,_0x1fdefb)[_0x0f36('0xb')](function(_0x5e9449){logger[_0x0f36('0xc')](_0x0f36('0xd'),_0xac0138,_0x0f36('0xe'));logger['debug'](_0x0f36('0xf'),_0xac0138,'request\x20sent',JSON[_0x0f36('0x10')](_0x5e9449));if(_0x5e9449[_0x0f36('0x11')]){if(_0x5e9449[_0x0f36('0x11')][_0x0f36('0x12')]===0x1f4){logger[_0x0f36('0x11')]('VoiceMail,\x20%s,\x20%s',_0xac0138,_0x5e9449[_0x0f36('0x11')]['message']);return _0x50a46b(_0x5e9449[_0x0f36('0x11')][_0x0f36('0x13')]);}logger[_0x0f36('0x11')](_0x0f36('0xd'),_0xac0138,_0x5e9449[_0x0f36('0x11')][_0x0f36('0x13')]);return _0x3f3e5a(_0x5e9449[_0x0f36('0x11')]['message']);}else{logger[_0x0f36('0xc')](_0x0f36('0xd'),_0xac0138,'request\x20sent');_0x3f3e5a(_0x5e9449[_0x0f36('0x14')][_0x0f36('0x13')]);}})[_0x0f36('0x15')](function(_0x4916d5){logger[_0x0f36('0x11')](_0x0f36('0xd'),_0xac0138,_0x4916d5);_0x50a46b(_0x4916d5);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 631faed..2cbe7be 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 _0xdca2=['Router','fs-extra','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','download','post','create','put','update','delete','destroy','exports','multer','connect-timeout'];(function(_0x2ac229,_0x47655){var _0x1d876f=function(_0xa988b){while(--_0xa988b){_0x2ac229['push'](_0x2ac229['shift']());}};_0x1d876f(++_0x47655);}(_0xdca2,0x10c));var _0x2dca=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0xdca2[_0x3d42d8];return _0x27fc41;};'use strict';var multer=require(_0x2dca('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2dca('0x1'));var express=require('express');var router=express[_0x2dca('0x2')]();var fs_extra=require(_0x2dca('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2dca('0x4'));var controller=require(_0x2dca('0x5'));router[_0x2dca('0x6')]('/',auth[_0x2dca('0x7')](),controller[_0x2dca('0x8')]);router[_0x2dca('0x6')](_0x2dca('0x9'),auth[_0x2dca('0x7')](),controller['show']);router[_0x2dca('0x6')]('/:id/download',auth['isAuthenticated'](),controller[_0x2dca('0xa')]);router[_0x2dca('0xb')]('/',auth[_0x2dca('0x7')](),controller[_0x2dca('0xc')]);router[_0x2dca('0xd')](_0x2dca('0x9'),auth['isAuthenticated'](),controller[_0x2dca('0xe')]);router[_0x2dca('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x2dca('0x10')]);module[_0x2dca('0x11')]=router; \ No newline at end of file +var _0x0166=['create','put','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','index','/:id','show','download','post','isAuthenticated'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x0166,0xcb));var _0x6016=function(_0x5b56df,_0x2c20d9){_0x5b56df=_0x5b56df-0x0;var _0x4781ba=_0x0166[_0x5b56df];return _0x4781ba;};'use strict';var multer=require(_0x6016('0x0'));var util=require(_0x6016('0x1'));var path=require(_0x6016('0x2'));var timeout=require('connect-timeout');var express=require(_0x6016('0x3'));var router=express[_0x6016('0x4')]();var fs_extra=require(_0x6016('0x5'));var auth=require(_0x6016('0x6'));var interaction=require(_0x6016('0x7'));var config=require(_0x6016('0x8'));var controller=require(_0x6016('0x9'));router[_0x6016('0xa')]('/',auth['isAuthenticated'](),controller[_0x6016('0xb')]);router[_0x6016('0xa')](_0x6016('0xc'),auth['isAuthenticated'](),controller[_0x6016('0xd')]);router[_0x6016('0xa')]('/:id/download',auth['isAuthenticated'](),controller[_0x6016('0xe')]);router[_0x6016('0xf')]('/',auth[_0x6016('0x10')](),controller[_0x6016('0x11')]);router[_0x6016('0x12')](_0x6016('0xc'),auth[_0x6016('0x10')](),controller['update']);router['delete'](_0x6016('0xc'),auth[_0x6016('0x10')](),controller[_0x6016('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 3aa3621..2a3674e 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 _0x8745=['BLOB','long','TIMESTAMP','literal','sequelize','exports','getDataValue','INTEGER','STRING'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x8745,0x1e1));var _0x5874=function(_0x3c3f04,_0x3b2ad2){_0x3c3f04=_0x3c3f04-0x0;var _0x2c6f83=_0x8745[_0x3c3f04];return _0x2c6f83;};'use strict';var Sequelize=require(_0x5874('0x0'));module[_0x5874('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x2ed84c){return this[_0x5874('0x2')]('id');}},'msgnum':{'type':Sequelize[_0x5874('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x5874('0x4')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x5874('0x4')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0x5874('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0x5874('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x5874('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0x5874('0x5')](_0x5874('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0x5874('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x5874('0x4')],'defaultValue':''},'stamp':{'type':_0x5874('0x7'),'defaultValue':Sequelize[_0x5874('0x8')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file +var _0x320f=['long','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','VIRTUAL','getDataValue','INTEGER','STRING'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x320f,0x123));var _0xf320=function(_0x2cd889,_0x18857e){_0x2cd889=_0x2cd889-0x0;var _0x5c980f=_0x320f[_0x2cd889];return _0x5c980f;};'use strict';var Sequelize=require(_0xf320('0x0'));module[_0xf320('0x1')]={'name':{'type':Sequelize[_0xf320('0x2')],'get':function(_0x3cdca1){return this[_0xf320('0x3')]('id');}},'msgnum':{'type':Sequelize[_0xf320('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xf320('0x5')],'defaultValue':''},'context':{'type':Sequelize[_0xf320('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xf320('0x5')],'defaultValue':''},'callerid':{'type':Sequelize[_0xf320('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0xf320('0x5')],'defaultValue':''},'duration':{'type':Sequelize[_0xf320('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xf320('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0xf320('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0xf320('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xf320('0x5')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize[_0xf320('0x7')](_0xf320('0x8'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index f4242db..f367e69 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 _0xa2a5=['index','map','VoiceMailMessage','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','find','catch','body','download','recording','ValidationError','VoiceMailMessage\x20not\x20found','Content-Disposition','msg_id','send','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','limit','undefined','set','Content-Range','apply','update','then','end','sendStatus','stack','name'];(function(_0x1b4695,_0x3a90e3){var _0x376a90=function(_0x13811c){while(--_0x13811c){_0x1b4695['push'](_0x1b4695['shift']());}};_0x376a90(++_0x3a90e3);}(_0xa2a5,0x177));var _0x5a2a=function(_0x3e169f,_0x33dbfd){_0x3e169f=_0x3e169f-0x0;var _0x435e9d=_0xa2a5[_0x3e169f];return _0x435e9d;};'use strict';var emlformat=require(_0x5a2a('0x0'));var rimraf=require(_0x5a2a('0x1'));var zipdir=require(_0x5a2a('0x2'));var jsonpatch=require(_0x5a2a('0x3'));var rp=require(_0x5a2a('0x4'));var moment=require('moment');var BPromise=require(_0x5a2a('0x5'));var Mustache=require(_0x5a2a('0x6'));var util=require(_0x5a2a('0x7'));var path=require('path');var sox=require(_0x5a2a('0x8'));var csv=require(_0x5a2a('0x9'));var ejs=require(_0x5a2a('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5a2a('0xb'));var squel=require(_0x5a2a('0xc'));var crypto=require(_0x5a2a('0xd'));var jsforce=require(_0x5a2a('0xe'));var deskjs=require(_0x5a2a('0xf'));var toCsv=require(_0x5a2a('0x9'));var querystring=require(_0x5a2a('0x10'));var Papa=require(_0x5a2a('0x11'));var Redis=require(_0x5a2a('0x12'));var authService=require(_0x5a2a('0x13'));var qs=require(_0x5a2a('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5a2a('0x15'))(_0x5a2a('0x16'));var utils=require(_0x5a2a('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x5a2a('0x18'));var db=require(_0x5a2a('0x19'))['db'];function respondWithStatusCode(_0x4f50be,_0x2e37f4){_0x2e37f4=_0x2e37f4||0xcc;return function(_0x4560a6){if(_0x4560a6){return _0x4f50be['sendStatus'](_0x2e37f4);}return _0x4f50be[_0x5a2a('0x1a')](_0x2e37f4)['end']();};}function respondWithResult(_0x4589f3,_0x3ef03f){_0x3ef03f=_0x3ef03f||0xc8;return function(_0x323301){if(_0x323301){return _0x4589f3[_0x5a2a('0x1a')](_0x3ef03f)[_0x5a2a('0x1b')](_0x323301);}};}function respondWithFilteredResult(_0x163f49,_0x27710c){return function(_0x3873ea){if(_0x3873ea){var _0x2afd3b=typeof _0x27710c[_0x5a2a('0x1c')]==='undefined'&&typeof _0x27710c[_0x5a2a('0x1d')]===_0x5a2a('0x1e');var _0x25e843=_0x3873ea['count'];var _0x44755f=_0x2afd3b?0x0:_0x27710c['offset'];var _0x319f60=_0x2afd3b?_0x3873ea['count']:_0x27710c['offset']+_0x27710c[_0x5a2a('0x1d')];var _0xa77913;if(_0x319f60>=_0x25e843){_0x319f60=_0x25e843;_0xa77913=0xc8;}else{_0xa77913=0xce;}_0x163f49[_0x5a2a('0x1a')](_0xa77913);return _0x163f49[_0x5a2a('0x1f')](_0x5a2a('0x20'),_0x44755f+'-'+_0x319f60+'/'+_0x25e843)['json'](_0x3873ea);}return null;};}function patchUpdates(_0x3a9682){return function(_0x588520){try{jsonpatch[_0x5a2a('0x21')](_0x588520,_0x3a9682,!![]);}catch(_0xa3c968){return BPromise['reject'](_0xa3c968);}return _0x588520['save']();};}function saveUpdates(_0x346bc0,_0x50b88b){return function(_0x24937c){if(_0x24937c){return _0x24937c[_0x5a2a('0x22')](_0x346bc0)['then'](function(_0x4ffbe3){return _0x4ffbe3;});}return null;};}function removeEntity(_0x2aadd1,_0x41aaf3){return function(_0x3d39f5){if(_0x3d39f5){return _0x3d39f5['destroy']()[_0x5a2a('0x23')](function(){_0x2aadd1['status'](0xcc)[_0x5a2a('0x24')]();});}};}function handleEntityNotFound(_0x3a97cb,_0x2a24aa){return function(_0x2649f2){if(!_0x2649f2){_0x3a97cb[_0x5a2a('0x25')](0x194);}return _0x2649f2;};}function handleError(_0x4ec277,_0x46564c){_0x46564c=_0x46564c||0x1f4;return function(_0x50ba92){logger['error'](_0x50ba92[_0x5a2a('0x26')]);if(_0x50ba92[_0x5a2a('0x27')]){delete _0x50ba92[_0x5a2a('0x27')];}_0x4ec277[_0x5a2a('0x1a')](_0x46564c)['send'](_0x50ba92);};}exports[_0x5a2a('0x28')]=function(_0xd54fce,_0x33ceeb){var _0x3286a3={},_0x10d12f={},_0x5e99a2={'count':0x0,'rows':[]};var _0x54fed8=_[_0x5a2a('0x29')](db[_0x5a2a('0x2a')][_0x5a2a('0x2b')],function(_0x78156e){return{'name':_0x78156e[_0x5a2a('0x2c')],'type':_0x78156e[_0x5a2a('0x2d')][_0x5a2a('0x2e')]};});_0x10d12f[_0x5a2a('0x2f')]=_[_0x5a2a('0x30')](_[_0x5a2a('0x29')](_0x54fed8,_0x5a2a('0x27')),['name']);_0x10d12f[_0x5a2a('0x31')]=_[_0x5a2a('0x32')](_0xd54fce[_0x5a2a('0x31')]);_0x10d12f[_0x5a2a('0x33')]=_[_0x5a2a('0x34')](_0x10d12f['model'],_0x10d12f['query']);_0x3286a3[_0x5a2a('0x35')]=_['intersection'](_0x10d12f[_0x5a2a('0x2f')],qs[_0x5a2a('0x36')](_0xd54fce[_0x5a2a('0x31')][_0x5a2a('0x36')]));_0x3286a3[_0x5a2a('0x35')]=_0x3286a3[_0x5a2a('0x35')][_0x5a2a('0x37')]?_0x3286a3['attributes']:_0x10d12f['model'];if(!_0xd54fce[_0x5a2a('0x31')][_0x5a2a('0x38')](_0x5a2a('0x39'))){_0x3286a3[_0x5a2a('0x1d')]=qs[_0x5a2a('0x1d')](_0xd54fce[_0x5a2a('0x31')][_0x5a2a('0x1d')]);_0x3286a3[_0x5a2a('0x1c')]=qs['offset'](_0xd54fce[_0x5a2a('0x31')]['offset']);}_0x3286a3[_0x5a2a('0x3a')]=qs[_0x5a2a('0x3b')](_0xd54fce[_0x5a2a('0x31')][_0x5a2a('0x3b')]);_0x3286a3[_0x5a2a('0x3c')]=qs['filters'](_[_0x5a2a('0x3d')](_0xd54fce[_0x5a2a('0x31')],_0x10d12f[_0x5a2a('0x33')]),_0x54fed8);if(_0xd54fce['query'][_0x5a2a('0x3e')]){_0x3286a3[_0x5a2a('0x3c')]=_[_0x5a2a('0x3f')](_0x3286a3[_0x5a2a('0x3c')],{'$or':_['map'](_0x54fed8,function(_0x28d57b){if(_0x28d57b[_0x5a2a('0x2d')]!==_0x5a2a('0x40')){var _0x5497bc={};_0x5497bc[_0x28d57b[_0x5a2a('0x27')]]={'$like':'%'+_0xd54fce[_0x5a2a('0x31')][_0x5a2a('0x3e')]+'%'};return _0x5497bc;}})});}_0x3286a3=_[_0x5a2a('0x3f')]({},_0x3286a3,_0xd54fce[_0x5a2a('0x41')]);var _0x101d1b={'where':_0x3286a3[_0x5a2a('0x3c')]};return db[_0x5a2a('0x2a')][_0x5a2a('0x42')](_0x101d1b)[_0x5a2a('0x23')](function(_0x3c3b77){_0x5e99a2[_0x5a2a('0x42')]=_0x3c3b77;if(_0xd54fce[_0x5a2a('0x31')][_0x5a2a('0x43')]){_0x3286a3[_0x5a2a('0x44')]=[{'all':!![]}];}return db[_0x5a2a('0x2a')][_0x5a2a('0x45')](_0x3286a3);})['then'](function(_0x164245){_0x5e99a2[_0x5a2a('0x46')]=_0x164245;return _0x5e99a2;})[_0x5a2a('0x23')](respondWithFilteredResult(_0x33ceeb,_0x3286a3))['catch'](handleError(_0x33ceeb,null));};exports[_0x5a2a('0x47')]=function(_0x3a2f07,_0x3a4f0d){var _0x97ce54={'raw':!![],'where':{'id':_0x3a2f07[_0x5a2a('0x48')]['id']}},_0x52ad58={};_0x52ad58[_0x5a2a('0x2f')]=_[_0x5a2a('0x32')](db['VoiceMailMessage'][_0x5a2a('0x2b')]);_0x52ad58[_0x5a2a('0x31')]=_[_0x5a2a('0x32')](_0x3a2f07['query']);_0x52ad58[_0x5a2a('0x33')]=_[_0x5a2a('0x34')](_0x52ad58[_0x5a2a('0x2f')],_0x52ad58[_0x5a2a('0x31')]);_0x97ce54[_0x5a2a('0x35')]=_['intersection'](_0x52ad58[_0x5a2a('0x2f')],qs[_0x5a2a('0x36')](_0x3a2f07[_0x5a2a('0x31')][_0x5a2a('0x36')]));_0x97ce54[_0x5a2a('0x35')]=_0x97ce54['attributes'][_0x5a2a('0x37')]?_0x97ce54[_0x5a2a('0x35')]:_0x52ad58[_0x5a2a('0x2f')];if(_0x3a2f07[_0x5a2a('0x31')][_0x5a2a('0x43')]){_0x97ce54['include']=[{'all':!![]}];}_0x97ce54=_[_0x5a2a('0x3f')]({},_0x97ce54,_0x3a2f07[_0x5a2a('0x41')]);return db[_0x5a2a('0x2a')][_0x5a2a('0x49')](_0x97ce54)[_0x5a2a('0x23')](handleEntityNotFound(_0x3a4f0d,null))[_0x5a2a('0x23')](respondWithResult(_0x3a4f0d,null))[_0x5a2a('0x4a')](handleError(_0x3a4f0d,null));};exports['create']=function(_0x51729c,_0x4674f5){return db[_0x5a2a('0x2a')]['create'](_0x51729c['body'],{})[_0x5a2a('0x23')](respondWithResult(_0x4674f5,0xc9))['catch'](handleError(_0x4674f5,null));};exports['update']=function(_0x145b07,_0x16bf6c){if(_0x145b07[_0x5a2a('0x4b')]['id']){delete _0x145b07[_0x5a2a('0x4b')]['id'];}return db['VoiceMailMessage'][_0x5a2a('0x49')]({'where':{'id':_0x145b07[_0x5a2a('0x48')]['id']}})[_0x5a2a('0x23')](handleEntityNotFound(_0x16bf6c,null))[_0x5a2a('0x23')](saveUpdates(_0x145b07[_0x5a2a('0x4b')],null))[_0x5a2a('0x23')](respondWithResult(_0x16bf6c,null))['catch'](handleError(_0x16bf6c,null));};exports['destroy']=function(_0x1d6ff0,_0x10e4e3){return db[_0x5a2a('0x2a')]['find']({'where':{'id':_0x1d6ff0[_0x5a2a('0x48')]['id']}})[_0x5a2a('0x23')](handleEntityNotFound(_0x10e4e3,null))[_0x5a2a('0x23')](removeEntity(_0x10e4e3,null))[_0x5a2a('0x4a')](handleError(_0x10e4e3,null));};exports[_0x5a2a('0x4c')]=function(_0x67db38,_0x509bf0,_0x1148c6){return db['VoiceMailMessage'][_0x5a2a('0x49')]({'where':{'id':_0x67db38[_0x5a2a('0x48')]['id']},'attributes':['id',_0x5a2a('0x4d'),'msg_id']})[_0x5a2a('0x23')](handleEntityNotFound(_0x509bf0,null))[_0x5a2a('0x23')](function(_0x3055f3){if(_0x3055f3){if(!_0x3055f3[_0x5a2a('0x4d')]){throw new db['Sequelize'][(_0x5a2a('0x4e'))](_0x5a2a('0x4f'));}var _0x2185d0={'Content-Type':'audio/wav','Content-Disposition':'attachment'};if(_0x3055f3['msg_id']){_0x2185d0[_0x5a2a('0x50')]='attachment;\x20filename=\x22'+_0x3055f3[_0x5a2a('0x51')]+'.wav\x22';}_0x509bf0[_0x5a2a('0x1f')](_0x2185d0);return _0x509bf0[_0x5a2a('0x52')](new Buffer(_0x3055f3[_0x5a2a('0x4d')]));}})[_0x5a2a('0x4a')](handleError(_0x509bf0,null));}; \ No newline at end of file +var _0xf099=['map','VIRTUAL','options','include','rows','show','params','includeAll','find','catch','create','body','update','download','recording','msg_id','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','then','destroy','error','stack','name','send','index','VoiceMailMessage','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0xf099,0x6e));var _0x9f09=function(_0x1f7839,_0x2a26e6){_0x1f7839=_0x1f7839-0x0;var _0x36b42e=_0xf099[_0x1f7839];return _0x36b42e;};'use strict';var emlformat=require(_0x9f09('0x0'));var rimraf=require(_0x9f09('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9f09('0x2'));var rp=require(_0x9f09('0x3'));var moment=require(_0x9f09('0x4'));var BPromise=require(_0x9f09('0x5'));var Mustache=require(_0x9f09('0x6'));var util=require(_0x9f09('0x7'));var path=require(_0x9f09('0x8'));var sox=require(_0x9f09('0x9'));var csv=require('to-csv');var ejs=require(_0x9f09('0xa'));var fs=require('fs');var fs_extra=require(_0x9f09('0xb'));var _=require(_0x9f09('0xc'));var squel=require(_0x9f09('0xd'));var crypto=require(_0x9f09('0xe'));var jsforce=require(_0x9f09('0xf'));var deskjs=require(_0x9f09('0x10'));var toCsv=require(_0x9f09('0x11'));var querystring=require(_0x9f09('0x12'));var Papa=require(_0x9f09('0x13'));var Redis=require(_0x9f09('0x14'));var authService=require(_0x9f09('0x15'));var qs=require(_0x9f09('0x16'));var as=require(_0x9f09('0x17'));var hardwareService=require(_0x9f09('0x18'));var logger=require(_0x9f09('0x19'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9f09('0x1a'));var db=require(_0x9f09('0x1b'))['db'];function respondWithStatusCode(_0x5cc8b1,_0x496876){_0x496876=_0x496876||0xcc;return function(_0x262419){if(_0x262419){return _0x5cc8b1[_0x9f09('0x1c')](_0x496876);}return _0x5cc8b1[_0x9f09('0x1d')](_0x496876)[_0x9f09('0x1e')]();};}function respondWithResult(_0x2586da,_0x2198b9){_0x2198b9=_0x2198b9||0xc8;return function(_0x299734){if(_0x299734){return _0x2586da[_0x9f09('0x1d')](_0x2198b9)[_0x9f09('0x1f')](_0x299734);}};}function respondWithFilteredResult(_0x184fd5,_0x3ae924){return function(_0x3a738a){if(_0x3a738a){var _0xbd4a0=typeof _0x3ae924[_0x9f09('0x20')]===_0x9f09('0x21')&&typeof _0x3ae924[_0x9f09('0x22')]==='undefined';var _0x4ddd1d=_0x3a738a[_0x9f09('0x23')];var _0x299d59=_0xbd4a0?0x0:_0x3ae924['offset'];var _0x1832cf=_0xbd4a0?_0x3a738a[_0x9f09('0x23')]:_0x3ae924[_0x9f09('0x20')]+_0x3ae924['limit'];var _0x560839;if(_0x1832cf>=_0x4ddd1d){_0x1832cf=_0x4ddd1d;_0x560839=0xc8;}else{_0x560839=0xce;}_0x184fd5[_0x9f09('0x1d')](_0x560839);return _0x184fd5['set'](_0x9f09('0x24'),_0x299d59+'-'+_0x1832cf+'/'+_0x4ddd1d)['json'](_0x3a738a);}return null;};}function patchUpdates(_0x4064b9){return function(_0x47abff){try{jsonpatch[_0x9f09('0x25')](_0x47abff,_0x4064b9,!![]);}catch(_0x3a1353){return BPromise['reject'](_0x3a1353);}return _0x47abff[_0x9f09('0x26')]();};}function saveUpdates(_0x43a7c2,_0x56fc42){return function(_0xe9d8b2){if(_0xe9d8b2){return _0xe9d8b2['update'](_0x43a7c2)[_0x9f09('0x27')](function(_0x1004cb){return _0x1004cb;});}return null;};}function removeEntity(_0x2626f9,_0x34a413){return function(_0x5708a2){if(_0x5708a2){return _0x5708a2[_0x9f09('0x28')]()[_0x9f09('0x27')](function(){_0x2626f9['status'](0xcc)[_0x9f09('0x1e')]();});}};}function handleEntityNotFound(_0x34f6f1,_0x3165e5){return function(_0x1ac497){if(!_0x1ac497){_0x34f6f1['sendStatus'](0x194);}return _0x1ac497;};}function handleError(_0x2ba015,_0x31a9c6){_0x31a9c6=_0x31a9c6||0x1f4;return function(_0x1c9995){logger[_0x9f09('0x29')](_0x1c9995[_0x9f09('0x2a')]);if(_0x1c9995[_0x9f09('0x2b')]){delete _0x1c9995[_0x9f09('0x2b')];}_0x2ba015[_0x9f09('0x1d')](_0x31a9c6)[_0x9f09('0x2c')](_0x1c9995);};}exports[_0x9f09('0x2d')]=function(_0x292a46,_0x3ff4c6){var _0x5bc7ff={},_0x69ae5a={},_0x55a038={'count':0x0,'rows':[]};var _0x3365c6=_['map'](db[_0x9f09('0x2e')][_0x9f09('0x2f')],function(_0x39abcf){return{'name':_0x39abcf[_0x9f09('0x30')],'type':_0x39abcf[_0x9f09('0x31')][_0x9f09('0x32')]};});_0x69ae5a[_0x9f09('0x33')]=_['differenceBy'](_['map'](_0x3365c6,_0x9f09('0x2b')),[_0x9f09('0x2b')]);_0x69ae5a['query']=_[_0x9f09('0x34')](_0x292a46[_0x9f09('0x35')]);_0x69ae5a[_0x9f09('0x36')]=_['intersection'](_0x69ae5a['model'],_0x69ae5a['query']);_0x5bc7ff[_0x9f09('0x37')]=_[_0x9f09('0x38')](_0x69ae5a['model'],qs[_0x9f09('0x39')](_0x292a46['query']['fields']));_0x5bc7ff[_0x9f09('0x37')]=_0x5bc7ff[_0x9f09('0x37')][_0x9f09('0x3a')]?_0x5bc7ff[_0x9f09('0x37')]:_0x69ae5a['model'];if(!_0x292a46[_0x9f09('0x35')][_0x9f09('0x3b')](_0x9f09('0x3c'))){_0x5bc7ff[_0x9f09('0x22')]=qs[_0x9f09('0x22')](_0x292a46[_0x9f09('0x35')][_0x9f09('0x22')]);_0x5bc7ff['offset']=qs[_0x9f09('0x20')](_0x292a46[_0x9f09('0x35')][_0x9f09('0x20')]);}_0x5bc7ff['order']=qs[_0x9f09('0x3d')](_0x292a46[_0x9f09('0x35')][_0x9f09('0x3d')]);_0x5bc7ff['where']=qs['filters'](_[_0x9f09('0x3e')](_0x292a46['query'],_0x69ae5a[_0x9f09('0x36')]),_0x3365c6);if(_0x292a46[_0x9f09('0x35')][_0x9f09('0x3f')]){_0x5bc7ff[_0x9f09('0x40')]=_[_0x9f09('0x41')](_0x5bc7ff[_0x9f09('0x40')],{'$or':_[_0x9f09('0x42')](_0x3365c6,function(_0x48e6d0){if(_0x48e6d0['type']!==_0x9f09('0x43')){var _0x217be2={};_0x217be2[_0x48e6d0[_0x9f09('0x2b')]]={'$like':'%'+_0x292a46[_0x9f09('0x35')]['filter']+'%'};return _0x217be2;}})});}_0x5bc7ff=_['merge']({},_0x5bc7ff,_0x292a46[_0x9f09('0x44')]);var _0xecdf02={'where':_0x5bc7ff[_0x9f09('0x40')]};return db[_0x9f09('0x2e')][_0x9f09('0x23')](_0xecdf02)['then'](function(_0x48f0d2){_0x55a038['count']=_0x48f0d2;if(_0x292a46[_0x9f09('0x35')]['includeAll']){_0x5bc7ff[_0x9f09('0x45')]=[{'all':!![]}];}return db['VoiceMailMessage']['findAll'](_0x5bc7ff);})[_0x9f09('0x27')](function(_0x16b1a0){_0x55a038[_0x9f09('0x46')]=_0x16b1a0;return _0x55a038;})[_0x9f09('0x27')](respondWithFilteredResult(_0x3ff4c6,_0x5bc7ff))['catch'](handleError(_0x3ff4c6,null));};exports[_0x9f09('0x47')]=function(_0x32d2b9,_0x2876bc){var _0x227993={'raw':!![],'where':{'id':_0x32d2b9[_0x9f09('0x48')]['id']}},_0x3ab46c={};_0x3ab46c[_0x9f09('0x33')]=_['keys'](db[_0x9f09('0x2e')][_0x9f09('0x2f')]);_0x3ab46c[_0x9f09('0x35')]=_[_0x9f09('0x34')](_0x32d2b9[_0x9f09('0x35')]);_0x3ab46c[_0x9f09('0x36')]=_[_0x9f09('0x38')](_0x3ab46c['model'],_0x3ab46c['query']);_0x227993['attributes']=_['intersection'](_0x3ab46c[_0x9f09('0x33')],qs[_0x9f09('0x39')](_0x32d2b9['query'][_0x9f09('0x39')]));_0x227993[_0x9f09('0x37')]=_0x227993[_0x9f09('0x37')][_0x9f09('0x3a')]?_0x227993[_0x9f09('0x37')]:_0x3ab46c[_0x9f09('0x33')];if(_0x32d2b9[_0x9f09('0x35')][_0x9f09('0x49')]){_0x227993[_0x9f09('0x45')]=[{'all':!![]}];}_0x227993=_[_0x9f09('0x41')]({},_0x227993,_0x32d2b9[_0x9f09('0x44')]);return db[_0x9f09('0x2e')][_0x9f09('0x4a')](_0x227993)[_0x9f09('0x27')](handleEntityNotFound(_0x2876bc,null))['then'](respondWithResult(_0x2876bc,null))[_0x9f09('0x4b')](handleError(_0x2876bc,null));};exports[_0x9f09('0x4c')]=function(_0x21a165,_0x34f564){return db[_0x9f09('0x2e')][_0x9f09('0x4c')](_0x21a165[_0x9f09('0x4d')],{})[_0x9f09('0x27')](respondWithResult(_0x34f564,0xc9))['catch'](handleError(_0x34f564,null));};exports[_0x9f09('0x4e')]=function(_0x3e8ab8,_0x555f54){if(_0x3e8ab8[_0x9f09('0x4d')]['id']){delete _0x3e8ab8[_0x9f09('0x4d')]['id'];}return db[_0x9f09('0x2e')]['find']({'where':{'id':_0x3e8ab8['params']['id']}})['then'](handleEntityNotFound(_0x555f54,null))[_0x9f09('0x27')](saveUpdates(_0x3e8ab8['body'],null))[_0x9f09('0x27')](respondWithResult(_0x555f54,null))[_0x9f09('0x4b')](handleError(_0x555f54,null));};exports[_0x9f09('0x28')]=function(_0x261361,_0x11e489){return db[_0x9f09('0x2e')]['find']({'where':{'id':_0x261361[_0x9f09('0x48')]['id']}})[_0x9f09('0x27')](handleEntityNotFound(_0x11e489,null))['then'](removeEntity(_0x11e489,null))[_0x9f09('0x4b')](handleError(_0x11e489,null));};exports[_0x9f09('0x4f')]=function(_0x50512f,_0x3a0acb,_0x213d66){return db[_0x9f09('0x2e')]['find']({'where':{'id':_0x50512f[_0x9f09('0x48')]['id']},'attributes':['id',_0x9f09('0x50'),_0x9f09('0x51')]})[_0x9f09('0x27')](handleEntityNotFound(_0x3a0acb,null))[_0x9f09('0x27')](function(_0x5ea174){if(_0x5ea174){if(!_0x5ea174[_0x9f09('0x50')]){throw new db['Sequelize'][(_0x9f09('0x52'))](_0x9f09('0x53'));}var _0x3a2f2c={'Content-Type':_0x9f09('0x54'),'Content-Disposition':_0x9f09('0x55')};if(_0x5ea174[_0x9f09('0x51')]){_0x3a2f2c[_0x9f09('0x56')]=_0x9f09('0x57')+_0x5ea174[_0x9f09('0x51')]+'.wav\x22';}_0x3a0acb['set'](_0x3a2f2c);return _0x3a0acb[_0x9f09('0x2c')](new Buffer(_0x5ea174['recording']));}})[_0x9f09('0x4b')](handleError(_0x3a0acb,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 10ac878..8895957 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 _0x6642=['voice_voicemail_messages','dir','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage'];(function(_0x43ab62,_0x125844){var _0x307e31=function(_0x52ce34){while(--_0x52ce34){_0x43ab62['push'](_0x43ab62['shift']());}};_0x307e31(++_0x125844);}(_0x6642,0x1c2));var _0x2664=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6642[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2664('0x0'));var util=require(_0x2664('0x1'));var logger=require(_0x2664('0x2'))(_0x2664('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2664('0x4'));var fs=require('fs');var path=require(_0x2664('0x5'));var rimraf=require(_0x2664('0x6'));var config=require(_0x2664('0x7'));var attributes=require(_0x2664('0x8'));module[_0x2664('0x9')]=function(_0x304dbf,_0x563b68){return _0x304dbf[_0x2664('0xa')](_0x2664('0xb'),attributes,{'tableName':_0x2664('0xc'),'paranoid':![],'indexes':[{'name':_0x2664('0xd'),'fields':[_0x2664('0xd')]}],'timestamps':![]});}; \ No newline at end of file +var _0x4a86=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','VoiceMailMessage','voice_voicemail_messages','dir','util'];(function(_0x4ea503,_0xde7a49){var _0x2d9b72=function(_0x173201){while(--_0x173201){_0x4ea503['push'](_0x4ea503['shift']());}};_0x2d9b72(++_0xde7a49);}(_0x4a86,0x143));var _0x64a8=function(_0x333073,_0x3c5e61){_0x333073=_0x333073-0x0;var _0x44019d=_0x4a86[_0x333073];return _0x44019d;};'use strict';var _=require('lodash');var util=require(_0x64a8('0x0'));var logger=require('../../config/logger')(_0x64a8('0x1'));var moment=require(_0x64a8('0x2'));var BPromise=require(_0x64a8('0x3'));var rp=require(_0x64a8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x64a8('0x5'));var config=require(_0x64a8('0x6'));var attributes=require(_0x64a8('0x7'));module[_0x64a8('0x8')]=function(_0x579555,_0x1c82fd){return _0x579555['define'](_0x64a8('0x9'),attributes,{'tableName':_0x64a8('0xa'),'paranoid':![],'indexes':[{'name':_0x64a8('0xb'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index dbcbbac..27783db 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 _0x5e14=['then','VoiceMailMessage,\x20%s,\x20%s','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request'];(function(_0x138cc1,_0x54f6c6){var _0x3490d7=function(_0x33e56b){while(--_0x33e56b){_0x138cc1['push'](_0x138cc1['shift']());}};_0x3490d7(++_0x54f6c6);}(_0x5e14,0x199));var _0x45e1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5e14[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x45e1('0x0'));var util=require(_0x45e1('0x1'));var moment=require('moment');var BPromise=require(_0x45e1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x45e1('0x3'));var db=require(_0x45e1('0x4'))['db'];var utils=require(_0x45e1('0x5'));var logger=require('../../config/logger')(_0x45e1('0x6'));var config=require(_0x45e1('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x45e1('0x8')][_0x45e1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x49a17a,_0x5504a1,_0x215229){return new BPromise(function(_0x4a09c8,_0x51c80a){return client[_0x45e1('0xa')](_0x49a17a,_0x215229)[_0x45e1('0xb')](function(_0x44f551){logger['info'](_0x45e1('0xc'),_0x5504a1,'request\x20sent');logger[_0x45e1('0xd')](_0x45e1('0xe'),_0x5504a1,_0x45e1('0xf'),JSON[_0x45e1('0x10')](_0x44f551));if(_0x44f551['error']){if(_0x44f551[_0x45e1('0x11')][_0x45e1('0x12')]===0x1f4){logger[_0x45e1('0x11')](_0x45e1('0xc'),_0x5504a1,_0x44f551['error']['message']);return _0x51c80a(_0x44f551['error'][_0x45e1('0x13')]);}logger[_0x45e1('0x11')](_0x45e1('0xc'),_0x5504a1,_0x44f551[_0x45e1('0x11')]['message']);return _0x4a09c8(_0x44f551[_0x45e1('0x11')][_0x45e1('0x13')]);}else{logger['info']('VoiceMailMessage,\x20%s,\x20%s',_0x5504a1,_0x45e1('0xf'));_0x4a09c8(_0x44f551['result'][_0x45e1('0x13')]);}})[_0x45e1('0x14')](function(_0x5ac0d2){logger[_0x45e1('0x11')](_0x45e1('0xc'),_0x5504a1,_0x5ac0d2);_0x51c80a(_0x5ac0d2);});});} \ No newline at end of file +var _0x0aa4=['stringify','error','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s'];(function(_0x2d44d3,_0xd3391f){var _0x53d4ac=function(_0x5a7289){while(--_0x5a7289){_0x2d44d3['push'](_0x2d44d3['shift']());}};_0x53d4ac(++_0xd3391f);}(_0x0aa4,0x89));var _0x40aa=function(_0x5507b2,_0x407ac5){_0x5507b2=_0x5507b2-0x0;var _0x78698e=_0x0aa4[_0x5507b2];return _0x78698e;};'use strict';var _=require(_0x40aa('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x40aa('0x1'));var rs=require(_0x40aa('0x2'));var fs=require('fs');var Redis=require(_0x40aa('0x3'));var db=require(_0x40aa('0x4'))['db'];var utils=require(_0x40aa('0x5'));var logger=require(_0x40aa('0x6'))(_0x40aa('0x7'));var config=require(_0x40aa('0x8'));var jayson=require(_0x40aa('0x9'));var client=jayson['client'][_0x40aa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x46663c,_0x2799ec,_0x340f14){return new BPromise(function(_0x2baa67,_0x5dbae3){return client[_0x40aa('0xb')](_0x46663c,_0x340f14)[_0x40aa('0xc')](function(_0x5a2dd4){logger['info'](_0x40aa('0xd'),_0x2799ec,_0x40aa('0xe'));logger[_0x40aa('0xf')](_0x40aa('0x10'),_0x2799ec,_0x40aa('0xe'),JSON[_0x40aa('0x11')](_0x5a2dd4));if(_0x5a2dd4[_0x40aa('0x12')]){if(_0x5a2dd4['error']['code']===0x1f4){logger[_0x40aa('0x12')](_0x40aa('0xd'),_0x2799ec,_0x5a2dd4[_0x40aa('0x12')][_0x40aa('0x13')]);return _0x5dbae3(_0x5a2dd4['error'][_0x40aa('0x13')]);}logger[_0x40aa('0x12')](_0x40aa('0xd'),_0x2799ec,_0x5a2dd4[_0x40aa('0x12')][_0x40aa('0x13')]);return _0x2baa67(_0x5a2dd4[_0x40aa('0x12')][_0x40aa('0x13')]);}else{logger['info'](_0x40aa('0xd'),_0x2799ec,_0x40aa('0xe'));_0x2baa67(_0x5a2dd4[_0x40aa('0x14')][_0x40aa('0x13')]);}})[_0x40aa('0x15')](function(_0x3c59d8){logger[_0x40aa('0x12')](_0x40aa('0xd'),_0x2799ec,_0x3c59d8);_0x5dbae3(_0x3c59d8);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 6d32247..05c057c 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 _0x1fac=['create','update','delete','destroy','removeSound','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','show','/:id/sounds','post'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1fac,0x98));var _0xc1fa=function(_0x299cf2,_0xeb446){_0x299cf2=_0x299cf2-0x0;var _0x5116f2=_0x1fac[_0x299cf2];return _0x5116f2;};'use strict';var multer=require(_0xc1fa('0x0'));var util=require(_0xc1fa('0x1'));var path=require(_0xc1fa('0x2'));var timeout=require(_0xc1fa('0x3'));var express=require(_0xc1fa('0x4'));var router=express[_0xc1fa('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc1fa('0x6'));var config=require(_0xc1fa('0x7'));var controller=require(_0xc1fa('0x8'));router[_0xc1fa('0x9')]('/',auth[_0xc1fa('0xa')](),controller[_0xc1fa('0xb')]);router['get'](_0xc1fa('0xc'),auth[_0xc1fa('0xa')](),controller[_0xc1fa('0xd')]);router['get'](_0xc1fa('0xe'),auth[_0xc1fa('0xa')](),controller['getSounds']);router[_0xc1fa('0xf')]('/',auth['isAuthenticated'](),controller[_0xc1fa('0x10')]);router[_0xc1fa('0xf')](_0xc1fa('0xe'),auth[_0xc1fa('0xa')](),controller['addSound']);router['put'](_0xc1fa('0xc'),auth[_0xc1fa('0xa')](),controller[_0xc1fa('0x11')]);router[_0xc1fa('0x12')](_0xc1fa('0xc'),auth[_0xc1fa('0xa')](),controller[_0xc1fa('0x13')]);router['delete']('/:id/sounds/:id2',auth[_0xc1fa('0xa')](),controller[_0xc1fa('0x14')]);module['exports']=router; \ No newline at end of file +var _0xa160=['util','express','Router','fs-extra','../../config/environment','./voiceMusicOnHold.controller','get','/:id','isAuthenticated','show','/:id/sounds','post','create','addSound','put','update','delete','destroy','removeSound','multer'];(function(_0xdb33f8,_0x4a17dc){var _0x545a90=function(_0x4f8334){while(--_0x4f8334){_0xdb33f8['push'](_0xdb33f8['shift']());}};_0x545a90(++_0x4a17dc);}(_0xa160,0x77));var _0x0a16=function(_0x1a8c41,_0xc1691c){_0x1a8c41=_0x1a8c41-0x0;var _0x12749d=_0xa160[_0x1a8c41];return _0x12749d;};'use strict';var multer=require(_0x0a16('0x0'));var util=require(_0x0a16('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0a16('0x2'));var router=express[_0x0a16('0x3')]();var fs_extra=require(_0x0a16('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0a16('0x5'));var controller=require(_0x0a16('0x6'));router[_0x0a16('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x0a16('0x8'),auth[_0x0a16('0x9')](),controller[_0x0a16('0xa')]);router['get'](_0x0a16('0xb'),auth[_0x0a16('0x9')](),controller['getSounds']);router[_0x0a16('0xc')]('/',auth[_0x0a16('0x9')](),controller[_0x0a16('0xd')]);router[_0x0a16('0xc')](_0x0a16('0xb'),auth[_0x0a16('0x9')](),controller[_0x0a16('0xe')]);router[_0x0a16('0xf')](_0x0a16('0x8'),auth[_0x0a16('0x9')](),controller[_0x0a16('0x10')]);router[_0x0a16('0x11')](_0x0a16('0x8'),auth[_0x0a16('0x9')](),controller[_0x0a16('0x12')]);router[_0x0a16('0x11')]('/:id/sounds/:id2',auth[_0x0a16('0x9')](),controller[_0x0a16('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 55493d3..85c3d14 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 _0x8bca=['exports','STRING','name','ENUM','custom','files','mp3nb','quietmp3','alpha','TIMESTAMP','BOOLEAN','sequelize'];(function(_0x31236c,_0x34f702){var _0x12eb2f=function(_0x6bb9a){while(--_0x6bb9a){_0x31236c['push'](_0x31236c['shift']());}};_0x12eb2f(++_0x34f702);}(_0x8bca,0x137));var _0xa8bc=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x8bca[_0x5d4607];return _0x5e4a86;};'use strict';var Sequelize=require(_0xa8bc('0x0'));module[_0xa8bc('0x1')]={'name':{'type':Sequelize[_0xa8bc('0x2')],'allowNull':![],'unique':_0xa8bc('0x3')},'mode':{'type':Sequelize[_0xa8bc('0x4')](_0xa8bc('0x5'),_0xa8bc('0x6'),_0xa8bc('0x7'),'quietmp3nb',_0xa8bc('0x8'),'mp3'),'allowNull':!![],'defaultValue':_0xa8bc('0x6')},'directory':{'type':Sequelize[_0xa8bc('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0xa8bc('0x2')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xa8bc('0x9')},'format':{'type':Sequelize[_0xa8bc('0x2')],'allowNull':!![]},'stamp':{'type':_0xa8bc('0xa')},'defaultEntry':{'type':Sequelize[_0xa8bc('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa95b=['mp3nb','quietmp3nb','quietmp3','alpha','TIMESTAMP','sequelize','exports','STRING','name','ENUM'];(function(_0x2637a3,_0x22212f){var _0x3d644a=function(_0x534a8a){while(--_0x534a8a){_0x2637a3['push'](_0x2637a3['shift']());}};_0x3d644a(++_0x22212f);}(_0xa95b,0x181));var _0xba95=function(_0x3246b9,_0x2eda5b){_0x3246b9=_0x3246b9-0x0;var _0x272f7b=_0xa95b[_0x3246b9];return _0x272f7b;};'use strict';var Sequelize=require(_0xba95('0x0'));module[_0xba95('0x1')]={'name':{'type':Sequelize[_0xba95('0x2')],'allowNull':![],'unique':_0xba95('0x3')},'mode':{'type':Sequelize[_0xba95('0x4')]('custom','files',_0xba95('0x5'),_0xba95('0x6'),_0xba95('0x7'),'mp3'),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0xba95('0x2')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0xba95('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0xba95('0x2')],'allowNull':!![],'defaultValue':_0xba95('0x8')},'format':{'type':Sequelize[_0xba95('0x2')],'allowNull':!![]},'stamp':{'type':_0xba95('0x9')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index 2cf7358..de294e2 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 _0xd0b7=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','options','VoiceMusicOnHold','includeAll','findAll','rows','catch','show','params','include','find','body','transaction','mode','directory','root','server/files/moh','create','files','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','MusicOnHolds','autoAssociation','sequelize','readdirSync','unlinkSync','join','rmdirSync','Sequelize','ValidationError','message','addSound','findOne','save_name','converted_format','createdAt','format','%s.%s','extname','symlinkSync','id2','Sound','getSounds','rawAttributes','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x4fa665,_0x1ae12a){var _0x62ccff=function(_0x4f0bb8){while(--_0x4f0bb8){_0x4fa665['push'](_0x4fa665['shift']());}};_0x62ccff(++_0x1ae12a);}(_0xd0b7,0x1ab));var _0x7d0b=function(_0x246f0d,_0x365b6e){_0x246f0d=_0x246f0d-0x0;var _0x1c1d8e=_0xd0b7[_0x246f0d];return _0x1c1d8e;};'use strict';var emlformat=require(_0x7d0b('0x0'));var rimraf=require(_0x7d0b('0x1'));var zipdir=require(_0x7d0b('0x2'));var jsonpatch=require(_0x7d0b('0x3'));var rp=require(_0x7d0b('0x4'));var moment=require('moment');var BPromise=require(_0x7d0b('0x5'));var Mustache=require(_0x7d0b('0x6'));var util=require(_0x7d0b('0x7'));var path=require(_0x7d0b('0x8'));var sox=require(_0x7d0b('0x9'));var csv=require(_0x7d0b('0xa'));var ejs=require(_0x7d0b('0xb'));var fs=require('fs');var fs_extra=require(_0x7d0b('0xc'));var _=require(_0x7d0b('0xd'));var squel=require(_0x7d0b('0xe'));var crypto=require(_0x7d0b('0xf'));var jsforce=require(_0x7d0b('0x10'));var deskjs=require(_0x7d0b('0x11'));var toCsv=require('to-csv');var querystring=require(_0x7d0b('0x12'));var Papa=require(_0x7d0b('0x13'));var Redis=require(_0x7d0b('0x14'));var authService=require(_0x7d0b('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x7d0b('0x16'));var hardwareService=require(_0x7d0b('0x17'));var logger=require(_0x7d0b('0x18'))('api');var utils=require(_0x7d0b('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x7d0b('0x1a'));var db=require(_0x7d0b('0x1b'))['db'];function respondWithStatusCode(_0x17ee60,_0x254efc){_0x254efc=_0x254efc||0xcc;return function(_0x5bd25f){if(_0x5bd25f){return _0x17ee60[_0x7d0b('0x1c')](_0x254efc);}return _0x17ee60[_0x7d0b('0x1d')](_0x254efc)[_0x7d0b('0x1e')]();};}function respondWithResult(_0x177d2c,_0x3520d4){_0x3520d4=_0x3520d4||0xc8;return function(_0x216289){if(_0x216289){return _0x177d2c[_0x7d0b('0x1d')](_0x3520d4)['json'](_0x216289);}};}function respondWithFilteredResult(_0x2e6479,_0x48f685){return function(_0x1e4fa5){if(_0x1e4fa5){var _0x193c44=typeof _0x48f685[_0x7d0b('0x1f')]===_0x7d0b('0x20')&&typeof _0x48f685[_0x7d0b('0x21')]==='undefined';var _0x41a9dc=_0x1e4fa5[_0x7d0b('0x22')];var _0x1fbc4b=_0x193c44?0x0:_0x48f685[_0x7d0b('0x1f')];var _0x38521e=_0x193c44?_0x1e4fa5['count']:_0x48f685[_0x7d0b('0x1f')]+_0x48f685['limit'];var _0x37dd78;if(_0x38521e>=_0x41a9dc){_0x38521e=_0x41a9dc;_0x37dd78=0xc8;}else{_0x37dd78=0xce;}_0x2e6479[_0x7d0b('0x1d')](_0x37dd78);return _0x2e6479[_0x7d0b('0x23')](_0x7d0b('0x24'),_0x1fbc4b+'-'+_0x38521e+'/'+_0x41a9dc)['json'](_0x1e4fa5);}return null;};}function patchUpdates(_0x3de78c){return function(_0x13b983){try{jsonpatch['apply'](_0x13b983,_0x3de78c,!![]);}catch(_0x22daae){return BPromise[_0x7d0b('0x25')](_0x22daae);}return _0x13b983[_0x7d0b('0x26')]();};}function saveUpdates(_0x5c2aa1,_0x2499ea){return function(_0x421d94){if(_0x421d94){return _0x421d94[_0x7d0b('0x27')](_0x5c2aa1)[_0x7d0b('0x28')](function(_0x49cd4a){return _0x49cd4a;});}return null;};}function removeEntity(_0x45f0a9,_0x521fb7){return function(_0x2c2b8a){if(_0x2c2b8a){return _0x2c2b8a[_0x7d0b('0x29')]()[_0x7d0b('0x28')](function(){var _0x42d69e=_0x2c2b8a[_0x7d0b('0x2a')]({'plain':!![]});var _0x15eb0d='MusicOnHolds';return db[_0x7d0b('0x2b')][_0x7d0b('0x29')]({'where':{'type':_0x15eb0d,'resourceId':_0x42d69e['id']}})[_0x7d0b('0x28')](function(){return _0x2c2b8a;});})[_0x7d0b('0x28')](function(){_0x45f0a9[_0x7d0b('0x1d')](0xcc)[_0x7d0b('0x1e')]();});}};}function handleEntityNotFound(_0x19689f,_0x2699da){return function(_0x452579){if(!_0x452579){_0x19689f['sendStatus'](0x194);}return _0x452579;};}function handleError(_0x19dcb0,_0x4dd27e){_0x4dd27e=_0x4dd27e||0x1f4;return function(_0x25da85){logger[_0x7d0b('0x2c')](_0x25da85[_0x7d0b('0x2d')]);if(_0x25da85['name']){delete _0x25da85[_0x7d0b('0x2e')];}_0x19dcb0[_0x7d0b('0x1d')](_0x4dd27e)[_0x7d0b('0x2f')](_0x25da85);};}exports[_0x7d0b('0x30')]=function(_0x1fb31c,_0x29572b){var _0x4b92ab={},_0x25bbea={},_0x9a0860={'count':0x0,'rows':[]};var _0x2c711c=_['map'](db['VoiceMusicOnHold']['rawAttributes'],function(_0x1f059c){return{'name':_0x1f059c['fieldName'],'type':_0x1f059c['type'][_0x7d0b('0x31')]};});_0x25bbea[_0x7d0b('0x32')]=_[_0x7d0b('0x33')](_0x2c711c,_0x7d0b('0x2e'));_0x25bbea[_0x7d0b('0x34')]=_[_0x7d0b('0x35')](_0x1fb31c['query']);_0x25bbea[_0x7d0b('0x36')]=_[_0x7d0b('0x37')](_0x25bbea[_0x7d0b('0x32')],_0x25bbea['query']);_0x4b92ab[_0x7d0b('0x38')]=_[_0x7d0b('0x37')](_0x25bbea['model'],qs[_0x7d0b('0x39')](_0x1fb31c['query'][_0x7d0b('0x39')]));_0x4b92ab['attributes']=_0x4b92ab[_0x7d0b('0x38')][_0x7d0b('0x3a')]?_0x4b92ab[_0x7d0b('0x38')]:_0x25bbea[_0x7d0b('0x32')];if(!_0x1fb31c['query'][_0x7d0b('0x3b')](_0x7d0b('0x3c'))){_0x4b92ab['limit']=qs[_0x7d0b('0x21')](_0x1fb31c['query'][_0x7d0b('0x21')]);_0x4b92ab[_0x7d0b('0x1f')]=qs[_0x7d0b('0x1f')](_0x1fb31c['query']['offset']);}_0x4b92ab[_0x7d0b('0x3d')]=qs[_0x7d0b('0x3e')](_0x1fb31c[_0x7d0b('0x34')][_0x7d0b('0x3e')]);delete _0x1fb31c['query']['sort'];_0x4b92ab[_0x7d0b('0x3f')]=qs[_0x7d0b('0x36')](_['pick'](_0x1fb31c[_0x7d0b('0x34')],_0x25bbea[_0x7d0b('0x36')]),_0x2c711c);if(_0x1fb31c[_0x7d0b('0x34')][_0x7d0b('0x40')]){_0x4b92ab[_0x7d0b('0x3f')]=_[_0x7d0b('0x41')](_0x4b92ab[_0x7d0b('0x3f')],{'$or':_[_0x7d0b('0x33')](_0x2c711c,function(_0x525214){if(_0x525214[_0x7d0b('0x42')]!=='VIRTUAL'){var _0x508f5c={};_0x508f5c[_0x525214[_0x7d0b('0x2e')]]={'$like':'%'+_0x1fb31c[_0x7d0b('0x34')][_0x7d0b('0x40')]+'%'};return _0x508f5c;}})});}_0x4b92ab=_[_0x7d0b('0x41')]({},_0x4b92ab,_0x1fb31c[_0x7d0b('0x43')]);var _0x5d81ef={'where':_0x4b92ab[_0x7d0b('0x3f')]};return db[_0x7d0b('0x44')][_0x7d0b('0x22')](_0x5d81ef)[_0x7d0b('0x28')](function(_0x3b2d8c){_0x9a0860['count']=_0x3b2d8c;if(_0x1fb31c[_0x7d0b('0x34')][_0x7d0b('0x45')]){_0x4b92ab['include']=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0x7d0b('0x46')](_0x4b92ab);})[_0x7d0b('0x28')](function(_0x3e6fc8){_0x9a0860[_0x7d0b('0x47')]=_0x3e6fc8;return _0x9a0860;})[_0x7d0b('0x28')](respondWithFilteredResult(_0x29572b,_0x4b92ab))[_0x7d0b('0x48')](handleError(_0x29572b,null));};exports[_0x7d0b('0x49')]=function(_0x67b92f,_0x326ee2){var _0x5e296f={'raw':![],'where':{'id':_0x67b92f[_0x7d0b('0x4a')]['id']}},_0x7c3f5c={};_0x7c3f5c[_0x7d0b('0x32')]=_[_0x7d0b('0x35')](db['VoiceMusicOnHold']['rawAttributes']);_0x7c3f5c[_0x7d0b('0x34')]=_['keys'](_0x67b92f[_0x7d0b('0x34')]);_0x7c3f5c[_0x7d0b('0x36')]=_[_0x7d0b('0x37')](_0x7c3f5c[_0x7d0b('0x32')],_0x7c3f5c['query']);_0x5e296f[_0x7d0b('0x38')]=_[_0x7d0b('0x37')](_0x7c3f5c[_0x7d0b('0x32')],qs[_0x7d0b('0x39')](_0x67b92f[_0x7d0b('0x34')][_0x7d0b('0x39')]));_0x5e296f[_0x7d0b('0x38')]=_0x5e296f[_0x7d0b('0x38')][_0x7d0b('0x3a')]?_0x5e296f[_0x7d0b('0x38')]:_0x7c3f5c['model'];if(_0x67b92f[_0x7d0b('0x34')]['includeAll']){_0x5e296f[_0x7d0b('0x4b')]=[{'all':!![]}];}_0x5e296f=_['merge']({},_0x5e296f,_0x67b92f[_0x7d0b('0x43')]);return db[_0x7d0b('0x44')][_0x7d0b('0x4c')](_0x5e296f)[_0x7d0b('0x28')](handleEntityNotFound(_0x326ee2,null))['then'](respondWithResult(_0x326ee2,null))[_0x7d0b('0x48')](handleError(_0x326ee2,null));};exports[_0x7d0b('0x27')]=function(_0x3c3be7,_0x1bc62f){if(_0x3c3be7[_0x7d0b('0x4d')]['id']){delete _0x3c3be7['body']['id'];}return db[_0x7d0b('0x44')]['find']({'where':{'id':_0x3c3be7['params']['id']}})[_0x7d0b('0x28')](handleEntityNotFound(_0x1bc62f,null))[_0x7d0b('0x28')](saveUpdates(_0x3c3be7['body'],null))[_0x7d0b('0x28')](respondWithResult(_0x1bc62f,null))[_0x7d0b('0x48')](handleError(_0x1bc62f,null));};exports['create']=function(_0x1721bf,_0x334b59,_0x2ad983){return db['sequelize'][_0x7d0b('0x4e')](function(_0x15178a){if(_0x1721bf[_0x7d0b('0x4d')][_0x7d0b('0x4f')]==='files'){_0x1721bf[_0x7d0b('0x4d')][_0x7d0b('0x50')]=path['join'](config[_0x7d0b('0x51')],_0x7d0b('0x52'),_0x1721bf[_0x7d0b('0x4d')][_0x7d0b('0x2e')]);}return db[_0x7d0b('0x44')][_0x7d0b('0x53')](_0x1721bf[_0x7d0b('0x4d')],{'transaction':_0x15178a})['then'](function(_0x2cb8a6){if(_0x1721bf[_0x7d0b('0x4d')][_0x7d0b('0x4f')]===_0x7d0b('0x54')){fs['mkdirSync'](_0x2cb8a6[_0x7d0b('0x50')],parseInt('0777',0x8));}var _0x56524a=_0x1721bf[_0x7d0b('0x55')][_0x7d0b('0x2a')]({'plain':!![]});if(!_0x56524a)throw new Error(_0x7d0b('0x56'));if(_0x56524a[_0x7d0b('0x57')]===_0x7d0b('0x55')){var _0x244689=_0x2cb8a6[_0x7d0b('0x2a')]({'plain':!![]});return db[_0x7d0b('0x58')][_0x7d0b('0x4c')]({'where':{'name':_0x7d0b('0x59'),'userProfileId':_0x56524a['userProfileId']},'raw':!![]})['then'](function(_0x31d665){if(_0x31d665&&_0x31d665[_0x7d0b('0x5a')]===0x0){return db[_0x7d0b('0x2b')][_0x7d0b('0x53')]({'name':_0x244689[_0x7d0b('0x2e')],'resourceId':_0x244689['id'],'type':_0x31d665[_0x7d0b('0x2e')],'sectionId':_0x31d665['id']},{})[_0x7d0b('0x28')](function(){return _0x2cb8a6;});}else{return _0x2cb8a6;}})[_0x7d0b('0x48')](function(_0x49a055){logger[_0x7d0b('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x49a055);});}return _0x2cb8a6;});})[_0x7d0b('0x28')](respondWithResult(_0x334b59,0xc9))['catch'](handleError(_0x334b59,null));};exports[_0x7d0b('0x29')]=function(_0x48c422,_0x3f9018,_0x59692c){var _0xdaecf0;return db[_0x7d0b('0x44')][_0x7d0b('0x4c')]({'where':{'id':_0x48c422[_0x7d0b('0x4a')]['id']}})[_0x7d0b('0x28')](function(_0x4acc85){if(_0x4acc85){return db[_0x7d0b('0x5b')][_0x7d0b('0x4e')](function(_0x3bc05f){return _0x4acc85[_0x7d0b('0x29')]({'transaction':_0x3bc05f,'raw':!![]})[_0x7d0b('0x28')](function(_0x2075f0){if(_0x2075f0['directory']){fs[_0x7d0b('0x5c')](_0x2075f0[_0x7d0b('0x50')])['forEach'](function(_0x379e35){fs[_0x7d0b('0x5d')](path[_0x7d0b('0x5e')](_0x2075f0['directory'],_0x379e35));});fs[_0x7d0b('0x5f')](_0x2075f0[_0x7d0b('0x50')]);}return _0x2075f0;});})[_0x7d0b('0x48')](function(_0x13c128){throw new db[(_0x7d0b('0x60'))][(_0x7d0b('0x61'))](_0x13c128[_0x7d0b('0x62')]);});}})[_0x7d0b('0x28')](handleEntityNotFound(_0x3f9018,null))['then'](removeEntity(_0x3f9018,null))['catch'](handleError(_0x3f9018,null));};exports[_0x7d0b('0x63')]=function(_0x1c5d8a,_0x15d356,_0x4fb458){return db[_0x7d0b('0x5b')][_0x7d0b('0x4e')](function(_0x1d0049){var _0x2ef8d2;return db[_0x7d0b('0x44')][_0x7d0b('0x4c')]({'where':{'id':_0x1c5d8a[_0x7d0b('0x4a')]['id']}})[_0x7d0b('0x28')](function(_0x4d226c){if(_0x4d226c){_0x2ef8d2=_0x4d226c;return _0x4d226c[_0x7d0b('0x63')](_0x1c5d8a[_0x7d0b('0x4d')]['id'],{'transaction':_0x1d0049});}})[_0x7d0b('0x28')](function(_0x386c18){if(_0x386c18){return db['Sound'][_0x7d0b('0x64')]({'where':{'id':_0x1c5d8a['body']['id']},'attributes':['id','name',_0x7d0b('0x65'),_0x7d0b('0x66'),_0x7d0b('0x67')],'raw':!![]});}})[_0x7d0b('0x28')](function(_0x297db0){if(_0x297db0){var _0x4579c6=path['join'](config[_0x7d0b('0x51')],'server/files/sounds/converted',util[_0x7d0b('0x68')](_0x7d0b('0x69'),path['basename'](_0x297db0[_0x7d0b('0x65')],path[_0x7d0b('0x6a')](_0x297db0[_0x7d0b('0x65')])),_0x297db0[_0x7d0b('0x66')]));var _0x3be20c=path[_0x7d0b('0x5e')](config[_0x7d0b('0x51')],'server/files/moh',_0x2ef8d2[_0x7d0b('0x2e')],util[_0x7d0b('0x68')](_0x7d0b('0x69'),_0x297db0[_0x7d0b('0x2e')],_0x297db0[_0x7d0b('0x66')]));fs[_0x7d0b('0x6b')](_0x4579c6,_0x3be20c);return _0x297db0;}})['catch'](function(_0xbd8854){throw new db['Sequelize'][(_0x7d0b('0x61'))](_0xbd8854[_0x7d0b('0x62')]);});})['then'](handleEntityNotFound(_0x15d356,null))[_0x7d0b('0x28')](respondWithResult(_0x15d356,0xc9))[_0x7d0b('0x48')](handleError(_0x15d356,null));};exports['removeSound']=function(_0x1446c0,_0x1ee7f1,_0x36195d){return db['sequelize'][_0x7d0b('0x4e')](function(_0x37944a){var _0x469bd0;return db[_0x7d0b('0x44')]['findOne']({'where':{'id':_0x1446c0[_0x7d0b('0x4a')]['id']}})[_0x7d0b('0x28')](handleEntityNotFound(_0x1ee7f1,null))[_0x7d0b('0x28')](function(_0x218882){if(_0x218882){_0x469bd0=_0x218882;return _0x218882['removeSound'](_0x1446c0[_0x7d0b('0x4a')][_0x7d0b('0x6c')]);}})[_0x7d0b('0x28')](function(_0x2a3671){if(_0x2a3671){return db[_0x7d0b('0x6d')][_0x7d0b('0x64')]({'where':{'id':_0x1446c0[_0x7d0b('0x4a')]['id2']},'attributes':['id',_0x7d0b('0x2e'),_0x7d0b('0x65'),_0x7d0b('0x66'),'createdAt'],'raw':!![]});}})[_0x7d0b('0x28')](function(_0x212245){if(_0x212245){fs[_0x7d0b('0x5d')](path[_0x7d0b('0x5e')](_0x469bd0[_0x7d0b('0x50')],util[_0x7d0b('0x68')](_0x7d0b('0x69'),_0x212245[_0x7d0b('0x2e')],_0x212245['converted_format'])));return _0x212245;}})[_0x7d0b('0x48')](function(_0x154eb8){throw new db[(_0x7d0b('0x60'))]['ValidationError'](_0x154eb8['message']);});})[_0x7d0b('0x28')](handleEntityNotFound(_0x1ee7f1,null))[_0x7d0b('0x28')](respondWithStatusCode(_0x1ee7f1,0xcc))['catch'](handleError(_0x1ee7f1,null));};exports[_0x7d0b('0x6e')]=function(_0x238c6a,_0x551855,_0x348ee6){var _0x216a14={};var _0x291216={};var _0xe186e5;var _0x586ee3;return db['VoiceMusicOnHold'][_0x7d0b('0x64')]({'where':{'id':_0x238c6a[_0x7d0b('0x4a')]['id']}})[_0x7d0b('0x28')](handleEntityNotFound(_0x551855,null))[_0x7d0b('0x28')](function(_0x2ec2e2){if(_0x2ec2e2){_0xe186e5=_0x2ec2e2;_0x291216[_0x7d0b('0x32')]=_[_0x7d0b('0x35')](db['Sound'][_0x7d0b('0x6f')]);_0x291216[_0x7d0b('0x34')]=_[_0x7d0b('0x35')](_0x238c6a[_0x7d0b('0x34')]);_0x291216[_0x7d0b('0x36')]=_[_0x7d0b('0x37')](_0x291216['model'],_0x291216[_0x7d0b('0x34')]);_0x216a14[_0x7d0b('0x38')]=_[_0x7d0b('0x37')](_0x291216[_0x7d0b('0x32')],qs['fields'](_0x238c6a['query'][_0x7d0b('0x39')]));_0x216a14['attributes']=_0x216a14[_0x7d0b('0x38')][_0x7d0b('0x3a')]?_0x216a14[_0x7d0b('0x38')]:_0x291216[_0x7d0b('0x32')];_0x216a14[_0x7d0b('0x3d')]=qs[_0x7d0b('0x3e')](_0x238c6a[_0x7d0b('0x34')][_0x7d0b('0x3e')]);_0x216a14[_0x7d0b('0x3f')]=qs[_0x7d0b('0x36')](_['pick'](_0x238c6a[_0x7d0b('0x34')],_0x291216[_0x7d0b('0x36')]));if(_0x238c6a[_0x7d0b('0x34')][_0x7d0b('0x40')]){_0x216a14[_0x7d0b('0x3f')]=_[_0x7d0b('0x41')](_0x216a14[_0x7d0b('0x3f')],{'$or':_['map'](_0x216a14[_0x7d0b('0x38')],function(_0x2670db){var _0x5d8a51={};_0x5d8a51[_0x2670db]={'$like':'%'+_0x238c6a[_0x7d0b('0x34')]['filter']+'%'};return _0x5d8a51;})});}_0x216a14=_['merge']({},_0x216a14,_0x238c6a[_0x7d0b('0x43')]);return _0xe186e5[_0x7d0b('0x6e')](_0x216a14);}})[_0x7d0b('0x28')](function(_0x7e71da){if(_0x7e71da){_0x586ee3=_0x7e71da[_0x7d0b('0x3a')];if(!_0x238c6a[_0x7d0b('0x34')][_0x7d0b('0x3b')](_0x7d0b('0x3c'))){_0x216a14[_0x7d0b('0x21')]=qs[_0x7d0b('0x21')](_0x238c6a[_0x7d0b('0x34')]['limit']);_0x216a14[_0x7d0b('0x1f')]=qs[_0x7d0b('0x1f')](_0x238c6a['query']['offset']);}return _0xe186e5['getSounds'](_0x216a14);}})['then'](function(_0x261610){if(_0x261610){return _0x261610?{'count':_0x586ee3,'rows':_0x261610}:null;}})[_0x7d0b('0x28')](respondWithResult(_0x551855,null))[_0x7d0b('0x48')](handleError(_0x551855,null));}; \ No newline at end of file +var _0x9496=['converted_format','createdAt','join','format','%s.%s','extname','Sequelize','removeSound','id2','getSounds','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','error','name','send','map','VoiceMusicOnHold','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','rawAttributes','includeAll','find','body','params','catch','create','sequelize','transaction','mode','files','directory','root','server/files/moh','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','MusicOnHolds','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','ValidationError','message','addSound','Sound','findOne','save_name'];(function(_0x5ee447,_0x4ee2bf){var _0x656bfe=function(_0x45cad4){while(--_0x45cad4){_0x5ee447['push'](_0x5ee447['shift']());}};_0x656bfe(++_0x4ee2bf);}(_0x9496,0x1c7));var _0x6949=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0x9496[_0x346737];return _0x1ade2e;};'use strict';var emlformat=require(_0x6949('0x0'));var rimraf=require(_0x6949('0x1'));var zipdir=require(_0x6949('0x2'));var jsonpatch=require(_0x6949('0x3'));var rp=require(_0x6949('0x4'));var moment=require(_0x6949('0x5'));var BPromise=require(_0x6949('0x6'));var Mustache=require(_0x6949('0x7'));var util=require('util');var path=require(_0x6949('0x8'));var sox=require(_0x6949('0x9'));var csv=require(_0x6949('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6949('0xb'));var _=require(_0x6949('0xc'));var squel=require('squel');var crypto=require(_0x6949('0xd'));var jsforce=require(_0x6949('0xe'));var deskjs=require(_0x6949('0xf'));var toCsv=require('to-csv');var querystring=require(_0x6949('0x10'));var Papa=require('papaparse');var Redis=require(_0x6949('0x11'));var authService=require(_0x6949('0x12'));var qs=require(_0x6949('0x13'));var as=require(_0x6949('0x14'));var hardwareService=require(_0x6949('0x15'));var logger=require(_0x6949('0x16'))(_0x6949('0x17'));var utils=require('../../config/utils');var config=require(_0x6949('0x18'));var licenseUtil=require(_0x6949('0x19'));var db=require(_0x6949('0x1a'))['db'];function respondWithStatusCode(_0x5de051,_0x366a9b){_0x366a9b=_0x366a9b||0xcc;return function(_0x23f81c){if(_0x23f81c){return _0x5de051[_0x6949('0x1b')](_0x366a9b);}return _0x5de051[_0x6949('0x1c')](_0x366a9b)[_0x6949('0x1d')]();};}function respondWithResult(_0x3981e7,_0x5639d4){_0x5639d4=_0x5639d4||0xc8;return function(_0x532074){if(_0x532074){return _0x3981e7[_0x6949('0x1c')](_0x5639d4)['json'](_0x532074);}};}function respondWithFilteredResult(_0x48aee8,_0x1a08c1){return function(_0x4f38ce){if(_0x4f38ce){var _0x29e32f=typeof _0x1a08c1['offset']===_0x6949('0x1e')&&typeof _0x1a08c1['limit']===_0x6949('0x1e');var _0x36a07c=_0x4f38ce[_0x6949('0x1f')];var _0x2123d8=_0x29e32f?0x0:_0x1a08c1[_0x6949('0x20')];var _0x3510af=_0x29e32f?_0x4f38ce[_0x6949('0x1f')]:_0x1a08c1['offset']+_0x1a08c1['limit'];var _0x3928b6;if(_0x3510af>=_0x36a07c){_0x3510af=_0x36a07c;_0x3928b6=0xc8;}else{_0x3928b6=0xce;}_0x48aee8[_0x6949('0x1c')](_0x3928b6);return _0x48aee8[_0x6949('0x21')](_0x6949('0x22'),_0x2123d8+'-'+_0x3510af+'/'+_0x36a07c)['json'](_0x4f38ce);}return null;};}function patchUpdates(_0x538c89){return function(_0x25552a){try{jsonpatch[_0x6949('0x23')](_0x25552a,_0x538c89,!![]);}catch(_0x2c6cba){return BPromise[_0x6949('0x24')](_0x2c6cba);}return _0x25552a['save']();};}function saveUpdates(_0x954c5e,_0x2ef44c){return function(_0x55b81c){if(_0x55b81c){return _0x55b81c[_0x6949('0x25')](_0x954c5e)[_0x6949('0x26')](function(_0x137e70){return _0x137e70;});}return null;};}function removeEntity(_0x2854f6,_0xd18e35){return function(_0x1594ec){if(_0x1594ec){return _0x1594ec[_0x6949('0x27')]()[_0x6949('0x26')](function(){var _0x97187=_0x1594ec[_0x6949('0x28')]({'plain':!![]});var _0x488e52='MusicOnHolds';return db[_0x6949('0x29')]['destroy']({'where':{'type':_0x488e52,'resourceId':_0x97187['id']}})['then'](function(){return _0x1594ec;});})[_0x6949('0x26')](function(){_0x2854f6[_0x6949('0x1c')](0xcc)[_0x6949('0x1d')]();});}};}function handleEntityNotFound(_0x2ebcf3,_0x29f955){return function(_0x20dac9){if(!_0x20dac9){_0x2ebcf3['sendStatus'](0x194);}return _0x20dac9;};}function handleError(_0x5d9bc3,_0x571c20){_0x571c20=_0x571c20||0x1f4;return function(_0x5c8f26){logger[_0x6949('0x2a')](_0x5c8f26['stack']);if(_0x5c8f26['name']){delete _0x5c8f26[_0x6949('0x2b')];}_0x5d9bc3[_0x6949('0x1c')](_0x571c20)[_0x6949('0x2c')](_0x5c8f26);};}exports['index']=function(_0x35e033,_0x3d9191){var _0x47ced4={},_0x18d516={},_0x15258e={'count':0x0,'rows':[]};var _0x258c84=_[_0x6949('0x2d')](db[_0x6949('0x2e')]['rawAttributes'],function(_0x16b9ee){return{'name':_0x16b9ee[_0x6949('0x2f')],'type':_0x16b9ee[_0x6949('0x30')][_0x6949('0x31')]};});_0x18d516[_0x6949('0x32')]=_[_0x6949('0x2d')](_0x258c84,_0x6949('0x2b'));_0x18d516[_0x6949('0x33')]=_[_0x6949('0x34')](_0x35e033[_0x6949('0x33')]);_0x18d516[_0x6949('0x35')]=_[_0x6949('0x36')](_0x18d516[_0x6949('0x32')],_0x18d516[_0x6949('0x33')]);_0x47ced4[_0x6949('0x37')]=_[_0x6949('0x36')](_0x18d516['model'],qs[_0x6949('0x38')](_0x35e033[_0x6949('0x33')][_0x6949('0x38')]));_0x47ced4[_0x6949('0x37')]=_0x47ced4[_0x6949('0x37')][_0x6949('0x39')]?_0x47ced4['attributes']:_0x18d516['model'];if(!_0x35e033['query'][_0x6949('0x3a')]('nolimit')){_0x47ced4[_0x6949('0x3b')]=qs['limit'](_0x35e033[_0x6949('0x33')][_0x6949('0x3b')]);_0x47ced4['offset']=qs[_0x6949('0x20')](_0x35e033[_0x6949('0x33')]['offset']);}_0x47ced4['order']=qs[_0x6949('0x3c')](_0x35e033[_0x6949('0x33')][_0x6949('0x3c')]);delete _0x35e033[_0x6949('0x33')][_0x6949('0x3c')];_0x47ced4[_0x6949('0x3d')]=qs['filters'](_[_0x6949('0x3e')](_0x35e033[_0x6949('0x33')],_0x18d516[_0x6949('0x35')]),_0x258c84);if(_0x35e033[_0x6949('0x33')][_0x6949('0x3f')]){_0x47ced4[_0x6949('0x3d')]=_[_0x6949('0x40')](_0x47ced4[_0x6949('0x3d')],{'$or':_['map'](_0x258c84,function(_0x335b04){if(_0x335b04[_0x6949('0x30')]!==_0x6949('0x41')){var _0x5bffcd={};_0x5bffcd[_0x335b04[_0x6949('0x2b')]]={'$like':'%'+_0x35e033[_0x6949('0x33')][_0x6949('0x3f')]+'%'};return _0x5bffcd;}})});}_0x47ced4=_['merge']({},_0x47ced4,_0x35e033[_0x6949('0x42')]);var _0x2d8189={'where':_0x47ced4[_0x6949('0x3d')]};return db[_0x6949('0x2e')][_0x6949('0x1f')](_0x2d8189)[_0x6949('0x26')](function(_0xc0c537){_0x15258e[_0x6949('0x1f')]=_0xc0c537;if(_0x35e033[_0x6949('0x33')]['includeAll']){_0x47ced4[_0x6949('0x43')]=[{'all':!![]}];}return db[_0x6949('0x2e')]['findAll'](_0x47ced4);})[_0x6949('0x26')](function(_0x52c00e){_0x15258e[_0x6949('0x44')]=_0x52c00e;return _0x15258e;})[_0x6949('0x26')](respondWithFilteredResult(_0x3d9191,_0x47ced4))['catch'](handleError(_0x3d9191,null));};exports['show']=function(_0x15f701,_0x222f04){var _0x5d4e99={'raw':![],'where':{'id':_0x15f701['params']['id']}},_0x29fab1={};_0x29fab1[_0x6949('0x32')]=_[_0x6949('0x34')](db[_0x6949('0x2e')][_0x6949('0x45')]);_0x29fab1['query']=_['keys'](_0x15f701[_0x6949('0x33')]);_0x29fab1[_0x6949('0x35')]=_['intersection'](_0x29fab1[_0x6949('0x32')],_0x29fab1[_0x6949('0x33')]);_0x5d4e99[_0x6949('0x37')]=_[_0x6949('0x36')](_0x29fab1['model'],qs['fields'](_0x15f701[_0x6949('0x33')][_0x6949('0x38')]));_0x5d4e99['attributes']=_0x5d4e99['attributes'][_0x6949('0x39')]?_0x5d4e99[_0x6949('0x37')]:_0x29fab1[_0x6949('0x32')];if(_0x15f701[_0x6949('0x33')][_0x6949('0x46')]){_0x5d4e99[_0x6949('0x43')]=[{'all':!![]}];}_0x5d4e99=_[_0x6949('0x40')]({},_0x5d4e99,_0x15f701[_0x6949('0x42')]);return db[_0x6949('0x2e')][_0x6949('0x47')](_0x5d4e99)['then'](handleEntityNotFound(_0x222f04,null))[_0x6949('0x26')](respondWithResult(_0x222f04,null))['catch'](handleError(_0x222f04,null));};exports[_0x6949('0x25')]=function(_0x2e0e20,_0x2e63e1){if(_0x2e0e20[_0x6949('0x48')]['id']){delete _0x2e0e20[_0x6949('0x48')]['id'];}return db[_0x6949('0x2e')][_0x6949('0x47')]({'where':{'id':_0x2e0e20[_0x6949('0x49')]['id']}})['then'](handleEntityNotFound(_0x2e63e1,null))[_0x6949('0x26')](saveUpdates(_0x2e0e20[_0x6949('0x48')],null))[_0x6949('0x26')](respondWithResult(_0x2e63e1,null))[_0x6949('0x4a')](handleError(_0x2e63e1,null));};exports[_0x6949('0x4b')]=function(_0xcc8b0a,_0x37719c,_0x33585e){return db[_0x6949('0x4c')][_0x6949('0x4d')](function(_0x3e77ed){if(_0xcc8b0a[_0x6949('0x48')][_0x6949('0x4e')]===_0x6949('0x4f')){_0xcc8b0a[_0x6949('0x48')][_0x6949('0x50')]=path['join'](config[_0x6949('0x51')],_0x6949('0x52'),_0xcc8b0a[_0x6949('0x48')]['name']);}return db[_0x6949('0x2e')][_0x6949('0x4b')](_0xcc8b0a['body'],{'transaction':_0x3e77ed})[_0x6949('0x26')](function(_0x51de74){if(_0xcc8b0a['body'][_0x6949('0x4e')]===_0x6949('0x4f')){fs['mkdirSync'](_0x51de74[_0x6949('0x50')],parseInt(_0x6949('0x53'),0x8));}var _0x2329f2=_0xcc8b0a[_0x6949('0x54')]['get']({'plain':!![]});if(!_0x2329f2)throw new Error(_0x6949('0x55'));if(_0x2329f2['role']===_0x6949('0x54')){var _0x172559=_0x51de74[_0x6949('0x28')]({'plain':!![]});return db['UserProfileSection'][_0x6949('0x47')]({'where':{'name':_0x6949('0x56'),'userProfileId':_0x2329f2[_0x6949('0x57')]},'raw':!![]})[_0x6949('0x26')](function(_0x560b9f){if(_0x560b9f&&_0x560b9f[_0x6949('0x58')]===0x0){return db[_0x6949('0x29')][_0x6949('0x4b')]({'name':_0x172559[_0x6949('0x2b')],'resourceId':_0x172559['id'],'type':_0x560b9f[_0x6949('0x2b')],'sectionId':_0x560b9f['id']},{})[_0x6949('0x26')](function(){return _0x51de74;});}else{return _0x51de74;}})[_0x6949('0x4a')](function(_0x1739fa){logger[_0x6949('0x2a')](_0x6949('0x59'),_0x1739fa);});}return _0x51de74;});})[_0x6949('0x26')](respondWithResult(_0x37719c,0xc9))[_0x6949('0x4a')](handleError(_0x37719c,null));};exports[_0x6949('0x27')]=function(_0x1f4216,_0x5b3744,_0x256b3d){var _0x2f1670;return db['VoiceMusicOnHold'][_0x6949('0x47')]({'where':{'id':_0x1f4216[_0x6949('0x49')]['id']}})[_0x6949('0x26')](function(_0x554da2){if(_0x554da2){return db[_0x6949('0x4c')]['transaction'](function(_0x3c55aa){return _0x554da2[_0x6949('0x27')]({'transaction':_0x3c55aa,'raw':!![]})[_0x6949('0x26')](function(_0x1ce14b){if(_0x1ce14b[_0x6949('0x50')]){fs[_0x6949('0x5a')](_0x1ce14b[_0x6949('0x50')])[_0x6949('0x5b')](function(_0x1fb67f){fs[_0x6949('0x5c')](path['join'](_0x1ce14b[_0x6949('0x50')],_0x1fb67f));});fs[_0x6949('0x5d')](_0x1ce14b['directory']);}return _0x1ce14b;});})[_0x6949('0x4a')](function(_0x48eaee){throw new db['Sequelize'][(_0x6949('0x5e'))](_0x48eaee[_0x6949('0x5f')]);});}})['then'](handleEntityNotFound(_0x5b3744,null))[_0x6949('0x26')](removeEntity(_0x5b3744,null))[_0x6949('0x4a')](handleError(_0x5b3744,null));};exports[_0x6949('0x60')]=function(_0x5e46c2,_0x27e476,_0x3f2d26){return db[_0x6949('0x4c')][_0x6949('0x4d')](function(_0x587c04){var _0x34385d;return db['VoiceMusicOnHold'][_0x6949('0x47')]({'where':{'id':_0x5e46c2[_0x6949('0x49')]['id']}})[_0x6949('0x26')](function(_0x3a4766){if(_0x3a4766){_0x34385d=_0x3a4766;return _0x3a4766['addSound'](_0x5e46c2[_0x6949('0x48')]['id'],{'transaction':_0x587c04});}})[_0x6949('0x26')](function(_0x309260){if(_0x309260){return db[_0x6949('0x61')][_0x6949('0x62')]({'where':{'id':_0x5e46c2[_0x6949('0x48')]['id']},'attributes':['id',_0x6949('0x2b'),_0x6949('0x63'),_0x6949('0x64'),_0x6949('0x65')],'raw':!![]});}})[_0x6949('0x26')](function(_0x3ca038){if(_0x3ca038){var _0x5c5f9a=path[_0x6949('0x66')](config[_0x6949('0x51')],'server/files/sounds/converted',util[_0x6949('0x67')](_0x6949('0x68'),path['basename'](_0x3ca038['save_name'],path[_0x6949('0x69')](_0x3ca038[_0x6949('0x63')])),_0x3ca038[_0x6949('0x64')]));var _0x3f64c1=path['join'](config['root'],'server/files/moh',_0x34385d['name'],util[_0x6949('0x67')](_0x6949('0x68'),_0x3ca038['name'],_0x3ca038['converted_format']));fs['symlinkSync'](_0x5c5f9a,_0x3f64c1);return _0x3ca038;}})[_0x6949('0x4a')](function(_0x34ddd){throw new db[(_0x6949('0x6a'))][(_0x6949('0x5e'))](_0x34ddd[_0x6949('0x5f')]);});})[_0x6949('0x26')](handleEntityNotFound(_0x27e476,null))[_0x6949('0x26')](respondWithResult(_0x27e476,0xc9))['catch'](handleError(_0x27e476,null));};exports['removeSound']=function(_0x37f920,_0x3e9f4d,_0x535f78){return db['sequelize']['transaction'](function(_0x4a45be){var _0x38f3aa;return db['VoiceMusicOnHold'][_0x6949('0x62')]({'where':{'id':_0x37f920[_0x6949('0x49')]['id']}})[_0x6949('0x26')](handleEntityNotFound(_0x3e9f4d,null))[_0x6949('0x26')](function(_0xe568e9){if(_0xe568e9){_0x38f3aa=_0xe568e9;return _0xe568e9[_0x6949('0x6b')](_0x37f920['params'][_0x6949('0x6c')]);}})[_0x6949('0x26')](function(_0x4fb9e8){if(_0x4fb9e8){return db[_0x6949('0x61')][_0x6949('0x62')]({'where':{'id':_0x37f920[_0x6949('0x49')][_0x6949('0x6c')]},'attributes':['id',_0x6949('0x2b'),_0x6949('0x63'),_0x6949('0x64'),'createdAt'],'raw':!![]});}})[_0x6949('0x26')](function(_0x51f9cd){if(_0x51f9cd){fs[_0x6949('0x5c')](path['join'](_0x38f3aa[_0x6949('0x50')],util['format'](_0x6949('0x68'),_0x51f9cd['name'],_0x51f9cd[_0x6949('0x64')])));return _0x51f9cd;}})['catch'](function(_0x3d4496){throw new db['Sequelize'][(_0x6949('0x5e'))](_0x3d4496['message']);});})[_0x6949('0x26')](handleEntityNotFound(_0x3e9f4d,null))[_0x6949('0x26')](respondWithStatusCode(_0x3e9f4d,0xcc))['catch'](handleError(_0x3e9f4d,null));};exports[_0x6949('0x6d')]=function(_0x8511c6,_0x222017,_0x118669){var _0x69a953={};var _0x22b416={};var _0x1a9273;var _0x36ae02;return db[_0x6949('0x2e')]['findOne']({'where':{'id':_0x8511c6[_0x6949('0x49')]['id']}})[_0x6949('0x26')](handleEntityNotFound(_0x222017,null))[_0x6949('0x26')](function(_0x2e9641){if(_0x2e9641){_0x1a9273=_0x2e9641;_0x22b416[_0x6949('0x32')]=_[_0x6949('0x34')](db[_0x6949('0x61')]['rawAttributes']);_0x22b416[_0x6949('0x33')]=_[_0x6949('0x34')](_0x8511c6[_0x6949('0x33')]);_0x22b416[_0x6949('0x35')]=_['intersection'](_0x22b416['model'],_0x22b416[_0x6949('0x33')]);_0x69a953[_0x6949('0x37')]=_[_0x6949('0x36')](_0x22b416['model'],qs[_0x6949('0x38')](_0x8511c6[_0x6949('0x33')][_0x6949('0x38')]));_0x69a953[_0x6949('0x37')]=_0x69a953['attributes'][_0x6949('0x39')]?_0x69a953[_0x6949('0x37')]:_0x22b416[_0x6949('0x32')];_0x69a953['order']=qs['sort'](_0x8511c6[_0x6949('0x33')]['sort']);_0x69a953[_0x6949('0x3d')]=qs[_0x6949('0x35')](_[_0x6949('0x3e')](_0x8511c6[_0x6949('0x33')],_0x22b416[_0x6949('0x35')]));if(_0x8511c6['query']['filter']){_0x69a953['where']=_[_0x6949('0x40')](_0x69a953[_0x6949('0x3d')],{'$or':_['map'](_0x69a953[_0x6949('0x37')],function(_0x8783ea){var _0x50718b={};_0x50718b[_0x8783ea]={'$like':'%'+_0x8511c6[_0x6949('0x33')][_0x6949('0x3f')]+'%'};return _0x50718b;})});}_0x69a953=_[_0x6949('0x40')]({},_0x69a953,_0x8511c6[_0x6949('0x42')]);return _0x1a9273[_0x6949('0x6d')](_0x69a953);}})['then'](function(_0x2fb715){if(_0x2fb715){_0x36ae02=_0x2fb715[_0x6949('0x39')];if(!_0x8511c6[_0x6949('0x33')][_0x6949('0x3a')](_0x6949('0x6e'))){_0x69a953[_0x6949('0x3b')]=qs[_0x6949('0x3b')](_0x8511c6[_0x6949('0x33')][_0x6949('0x3b')]);_0x69a953[_0x6949('0x20')]=qs[_0x6949('0x20')](_0x8511c6[_0x6949('0x33')]['offset']);}return _0x1a9273['getSounds'](_0x69a953);}})[_0x6949('0x26')](function(_0x156930){if(_0x156930){return _0x156930?{'count':_0x36ae02,'rows':_0x156930}:null;}})[_0x6949('0x26')](respondWithResult(_0x222017,null))[_0x6949('0x4a')](handleError(_0x222017,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 451d714..94f9315 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 _0x9084=['rimraf','../../config/environment','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x257f0c,_0x28006d){var _0x330946=function(_0x32b72f){while(--_0x32b72f){_0x257f0c['push'](_0x257f0c['shift']());}};_0x330946(++_0x28006d);}(_0x9084,0x72));var _0x4908=function(_0x40381e,_0x393856){_0x40381e=_0x40381e-0x0;var _0x4e9af6=_0x9084[_0x40381e];return _0x4e9af6;};'use strict';var _=require(_0x4908('0x0'));var util=require(_0x4908('0x1'));var logger=require(_0x4908('0x2'))(_0x4908('0x3'));var moment=require(_0x4908('0x4'));var BPromise=require(_0x4908('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4908('0x6'));var config=require(_0x4908('0x7'));var attributes=require('./voiceMusicOnHold.attributes');module[_0x4908('0x8')]=function(_0xb4fe14,_0x41a00e){return _0xb4fe14[_0x4908('0x9')](_0x4908('0xa'),attributes,{'tableName':_0x4908('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbd16=['voice_musiconhold','lodash','../../config/logger','moment','path','rimraf','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold'];(function(_0x179e11,_0xf65436){var _0x549f04=function(_0x610545){while(--_0x610545){_0x179e11['push'](_0x179e11['shift']());}};_0x549f04(++_0xf65436);}(_0xbd16,0x119));var _0x6bd1=function(_0x579ae4,_0x1cec71){_0x579ae4=_0x579ae4-0x0;var _0x441f23=_0xbd16[_0x579ae4];return _0x441f23;};'use strict';var _=require(_0x6bd1('0x0'));var util=require('util');var logger=require(_0x6bd1('0x1'))('api');var moment=require(_0x6bd1('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6bd1('0x3'));var rimraf=require(_0x6bd1('0x4'));var config=require('../../config/environment');var attributes=require(_0x6bd1('0x5'));module[_0x6bd1('0x6')]=function(_0x5e397a,_0x779473){return _0x5e397a[_0x6bd1('0x7')](_0x6bd1('0x8'),attributes,{'tableName':_0x6bd1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index 8eaa77f..57437ff 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 _0x9c44=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','code','error','message','VoiceMusicOnHold,\x20%s,\x20%s','info','result','catch','moment','bluebird'];(function(_0x595f9e,_0x799115){var _0x450f6a=function(_0x18bf3d){while(--_0x18bf3d){_0x595f9e['push'](_0x595f9e['shift']());}};_0x450f6a(++_0x799115);}(_0x9c44,0x178));var _0x49c4=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x9c44[_0x36c5b0];return _0xf19333;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var BPromise=require(_0x49c4('0x1'));var rs=require(_0x49c4('0x2'));var fs=require('fs');var Redis=require(_0x49c4('0x3'));var db=require(_0x49c4('0x4'))['db'];var utils=require(_0x49c4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x49c4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x49c4('0x7')][_0x49c4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x69bc41,_0x2c4e2e,_0x436234){return new BPromise(function(_0x511d53,_0x11c586){return client[_0x49c4('0x9')](_0x69bc41,_0x436234)[_0x49c4('0xa')](function(_0x4487ca){logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));logger[_0x49c4('0xc')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'),JSON[_0x49c4('0xd')](_0x4487ca));if(_0x4487ca['error']){if(_0x4487ca['error'][_0x49c4('0xe')]===0x1f4){logger[_0x49c4('0xf')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x11c586(_0x4487ca['error'][_0x49c4('0x10')]);}logger[_0x49c4('0xf')](_0x49c4('0x11'),_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x511d53(_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);}else{logger[_0x49c4('0x12')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));_0x511d53(_0x4487ca[_0x49c4('0x13')][_0x49c4('0x10')]);}})[_0x49c4('0x14')](function(_0x2abc78){logger['error'](_0x49c4('0x11'),_0x2c4e2e,_0x2abc78);_0x11c586(_0x2abc78);});});} \ No newline at end of file +var _0xa9e0=['http','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x140c43,_0x4b1bda){var _0x32678c=function(_0x2434e9){while(--_0x2434e9){_0x140c43['push'](_0x140c43['shift']());}};_0x32678c(++_0x4b1bda);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index d5404d5..c57f3dc 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 _0xc305=['destroy','removeAgents','removeTeams','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','isAuthenticated','index','get','/describe','describe','/:id','show','getAgents','/:id/teams','post','create','/:id/users','addAgents','addTeams','put','update','delete'];(function(_0x2d6c1a,_0x2eba95){var _0x530d7f=function(_0x42676d){while(--_0x42676d){_0x2d6c1a['push'](_0x2d6c1a['shift']());}};_0x530d7f(++_0x2eba95);}(_0xc305,0xcf));var _0x5c30=function(_0xf04c6d,_0xe98786){_0xf04c6d=_0xf04c6d-0x0;var _0x4a804e=_0xc305[_0xf04c6d];return _0x4a804e;};'use strict';var multer=require(_0x5c30('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5c30('0x1'));var express=require(_0x5c30('0x2'));var router=express['Router']();var fs_extra=require(_0x5c30('0x3'));var auth=require(_0x5c30('0x4'));var interaction=require(_0x5c30('0x5'));var config=require(_0x5c30('0x6'));var controller=require(_0x5c30('0x7'));router['get']('/',auth[_0x5c30('0x8')](),controller[_0x5c30('0x9')]);router[_0x5c30('0xa')](_0x5c30('0xb'),auth[_0x5c30('0x8')](),controller[_0x5c30('0xc')]);router[_0x5c30('0xa')](_0x5c30('0xd'),auth['isAuthenticated'](),controller[_0x5c30('0xe')]);router[_0x5c30('0xa')]('/:id/users',auth[_0x5c30('0x8')](),controller[_0x5c30('0xf')]);router[_0x5c30('0xa')](_0x5c30('0x10'),auth[_0x5c30('0x8')](),controller['getTeams']);router[_0x5c30('0x11')]('/',auth[_0x5c30('0x8')](),controller[_0x5c30('0x12')]);router['post'](_0x5c30('0x13'),auth[_0x5c30('0x8')](),controller[_0x5c30('0x14')]);router[_0x5c30('0x11')](_0x5c30('0x10'),auth['isAuthenticated'](),controller[_0x5c30('0x15')]);router[_0x5c30('0x16')](_0x5c30('0xd'),auth[_0x5c30('0x8')](),controller[_0x5c30('0x17')]);router[_0x5c30('0x18')](_0x5c30('0xd'),auth['isAuthenticated'](),controller[_0x5c30('0x19')]);router['delete'](_0x5c30('0x13'),auth[_0x5c30('0x8')](),controller[_0x5c30('0x1a')]);router[_0x5c30('0x18')](_0x5c30('0x10'),auth[_0x5c30('0x8')](),controller[_0x5c30('0x1b')]);module[_0x5c30('0x1c')]=router; \ No newline at end of file +var _0xae17=['../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','describe','/:id','show','/:id/users','getAgents','/:id/teams','getTeams','post','create','addAgents','addTeams','put','update','delete','removeTeams','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x5d0e61,_0x2e07bd){var _0x2bd01d=function(_0x3c33b3){while(--_0x3c33b3){_0x5d0e61['push'](_0x5d0e61['shift']());}};_0x2bd01d(++_0x2e07bd);}(_0xae17,0x171));var _0x7ae1=function(_0xabd73f,_0x42cda3){_0xabd73f=_0xabd73f-0x0;var _0x5276bc=_0xae17[_0xabd73f];return _0x5276bc;};'use strict';var multer=require(_0x7ae1('0x0'));var util=require(_0x7ae1('0x1'));var path=require(_0x7ae1('0x2'));var timeout=require(_0x7ae1('0x3'));var express=require(_0x7ae1('0x4'));var router=express['Router']();var fs_extra=require(_0x7ae1('0x5'));var auth=require(_0x7ae1('0x6'));var interaction=require(_0x7ae1('0x7'));var config=require(_0x7ae1('0x8'));var controller=require(_0x7ae1('0x9'));router[_0x7ae1('0xa')]('/',auth[_0x7ae1('0xb')](),controller[_0x7ae1('0xc')]);router[_0x7ae1('0xa')]('/describe',auth[_0x7ae1('0xb')](),controller[_0x7ae1('0xd')]);router[_0x7ae1('0xa')](_0x7ae1('0xe'),auth['isAuthenticated'](),controller[_0x7ae1('0xf')]);router[_0x7ae1('0xa')](_0x7ae1('0x10'),auth[_0x7ae1('0xb')](),controller[_0x7ae1('0x11')]);router[_0x7ae1('0xa')](_0x7ae1('0x12'),auth[_0x7ae1('0xb')](),controller[_0x7ae1('0x13')]);router[_0x7ae1('0x14')]('/',auth['isAuthenticated'](),controller[_0x7ae1('0x15')]);router[_0x7ae1('0x14')](_0x7ae1('0x10'),auth[_0x7ae1('0xb')](),controller[_0x7ae1('0x16')]);router['post']('/:id/teams',auth[_0x7ae1('0xb')](),controller[_0x7ae1('0x17')]);router[_0x7ae1('0x18')](_0x7ae1('0xe'),auth[_0x7ae1('0xb')](),controller[_0x7ae1('0x19')]);router['delete']('/:id',auth[_0x7ae1('0xb')](),controller['destroy']);router[_0x7ae1('0x1a')](_0x7ae1('0x10'),auth[_0x7ae1('0xb')](),controller['removeAgents']);router['delete']('/:id/teams',auth[_0x7ae1('0xb')](),controller[_0x7ae1('0x1b')]);module[_0x7ae1('0x1c')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index e9d51da..6ffabbb 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 _0xf2dc=['name','VIRTUAL','system-','getDataValue','STRING','INTEGER','sequelize'];(function(_0x5b236a,_0x29a67f){var _0x3495e1=function(_0x5662cf){while(--_0x5662cf){_0x5b236a['push'](_0x5b236a['shift']());}};_0x3495e1(++_0x29a67f);}(_0xf2dc,0x1aa));var _0xcf2d=function(_0x3f6b49,_0x349e07){_0x3f6b49=_0x3f6b49-0x0;var _0x5b5fb8=_0xf2dc[_0x3f6b49];return _0x5b5fb8;};'use strict';var Sequelize=require(_0xcf2d('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xcf2d('0x1')},'prefix':{'type':Sequelize[_0xcf2d('0x2')],'get':function(_0x570189){return _0xcf2d('0x3')+this[_0xcf2d('0x4')](_0xcf2d('0x1'))+'-';}},'description':{'type':Sequelize[_0xcf2d('0x5')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0xcf2d('0x6')]}}; \ No newline at end of file +var _0x6dd6=['VIRTUAL','system-','getDataValue','INTEGER','sequelize','exports','STRING','name'];(function(_0x47f4bc,_0x2aa83f){var _0x42a392=function(_0x2df63e){while(--_0x2df63e){_0x47f4bc['push'](_0x47f4bc['shift']());}};_0x42a392(++_0x2aa83f);}(_0x6dd6,0xec));var _0x66dd=function(_0x225a75,_0x43c1de){_0x225a75=_0x225a75-0x0;var _0xee995d=_0x6dd6[_0x225a75];return _0xee995d;};'use strict';var Sequelize=require(_0x66dd('0x0'));module[_0x66dd('0x1')]={'name':{'type':Sequelize[_0x66dd('0x2')],'allowNull':![],'unique':_0x66dd('0x3')},'prefix':{'type':Sequelize[_0x66dd('0x4')],'get':function(_0x112da5){return _0x66dd('0x5')+this[_0x66dd('0x6')](_0x66dd('0x3'))+'-';}},'description':{'type':Sequelize[_0x66dd('0x2')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0x66dd('0x7')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 4937034..c728e7e 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 _0xed3c=['apply','save','then','destroy','get','error','stack','name','send','index','map','VoicePrefix','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','keys','find','params','describe','create','sequelize','transaction','body','VoiceExtensionId','role','user','UserProfileSection','VoicePrefixes','userProfileId','autoAssociation','UserProfileResource','from-sip','app','system','description','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtension','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','${EXTEN:','charAt','update','system-','findById','addAgents','ids','omit','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','findOne','User','getAgents','getTeams','addTeams','findAll','Agents','interface','flatMap','each','upsert','UserVoicePrefix','forEach','Team','select','field','tq.TeamId','from','join','user_has_teams','VoicePrefixId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','every','TeamId','union','compact','value','removeTeams','isEmpty','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range'];(function(_0xd91423,_0x1b1079){var _0x5102a6=function(_0x55462f){while(--_0x55462f){_0xd91423['push'](_0xd91423['shift']());}};_0x5102a6(++_0x1b1079);}(_0xed3c,0x1a6));var _0xced3=function(_0x73a84b,_0x23d3bb){_0x73a84b=_0x73a84b-0x0;var _0x9e2a66=_0xed3c[_0x73a84b];return _0x9e2a66;};'use strict';var emlformat=require(_0xced3('0x0'));var rimraf=require(_0xced3('0x1'));var zipdir=require(_0xced3('0x2'));var jsonpatch=require(_0xced3('0x3'));var rp=require('request-promise');var moment=require(_0xced3('0x4'));var BPromise=require(_0xced3('0x5'));var Mustache=require(_0xced3('0x6'));var util=require('util');var path=require('path');var sox=require(_0xced3('0x7'));var csv=require(_0xced3('0x8'));var ejs=require(_0xced3('0x9'));var fs=require('fs');var fs_extra=require(_0xced3('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xced3('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xced3('0xc'));var Redis=require(_0xced3('0xd'));var authService=require(_0xced3('0xe'));var qs=require(_0xced3('0xf'));var as=require(_0xced3('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xced3('0x11'))(_0xced3('0x12'));var utils=require(_0xced3('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xced3('0x14'));var db=require(_0xced3('0x15'))['db'];config[_0xced3('0x16')]=_[_0xced3('0x17')](config[_0xced3('0x16')],{'host':_0xced3('0x18'),'port':0x18eb});var socket=require(_0xced3('0x19'))(new Redis(config['redis']));require(_0xced3('0x1a'))['register'](socket);function respondWithStatusCode(_0xf2db6f,_0x435616){_0x435616=_0x435616||0xcc;return function(_0x20d099){if(_0x20d099){return _0xf2db6f[_0xced3('0x1b')](_0x435616);}return _0xf2db6f['status'](_0x435616)[_0xced3('0x1c')]();};}function respondWithResult(_0x322c2d,_0x4acae6){_0x4acae6=_0x4acae6||0xc8;return function(_0x3b5962){if(_0x3b5962){return _0x322c2d[_0xced3('0x1d')](_0x4acae6)[_0xced3('0x1e')](_0x3b5962);}};}function respondWithFilteredResult(_0x17f611,_0x55dbd5){return function(_0x4569af){if(_0x4569af){var _0x4a3afe=typeof _0x55dbd5[_0xced3('0x1f')]===_0xced3('0x20')&&typeof _0x55dbd5[_0xced3('0x21')]===_0xced3('0x20');var _0x44143f=_0x4569af[_0xced3('0x22')];var _0xe0cf2e=_0x4a3afe?0x0:_0x55dbd5[_0xced3('0x1f')];var _0x3f688c=_0x4a3afe?_0x4569af[_0xced3('0x22')]:_0x55dbd5[_0xced3('0x1f')]+_0x55dbd5['limit'];var _0x5b8b1f;if(_0x3f688c>=_0x44143f){_0x3f688c=_0x44143f;_0x5b8b1f=0xc8;}else{_0x5b8b1f=0xce;}_0x17f611['status'](_0x5b8b1f);return _0x17f611[_0xced3('0x23')](_0xced3('0x24'),_0xe0cf2e+'-'+_0x3f688c+'/'+_0x44143f)[_0xced3('0x1e')](_0x4569af);}return null;};}function patchUpdates(_0x4bf915){return function(_0x19d15c){try{jsonpatch[_0xced3('0x25')](_0x19d15c,_0x4bf915,!![]);}catch(_0x526854){return BPromise['reject'](_0x526854);}return _0x19d15c[_0xced3('0x26')]();};}function saveUpdates(_0x101708,_0x219fa8){return function(_0x15c6c5){if(_0x15c6c5){return _0x15c6c5['update'](_0x101708)[_0xced3('0x27')](function(_0x23f92b){return _0x23f92b;});}return null;};}function removeEntity(_0x4fc285,_0x3fb4f9){return function(_0x4da7ce){if(_0x4da7ce){return _0x4da7ce[_0xced3('0x28')]()[_0xced3('0x27')](function(){var _0x3b728d=_0x4da7ce[_0xced3('0x29')]({'plain':!![]});var _0x2ec2c4='VoicePrefixes';return db['UserProfileResource'][_0xced3('0x28')]({'where':{'type':_0x2ec2c4,'resourceId':_0x3b728d['id']}})['then'](function(){return _0x4da7ce;});})[_0xced3('0x27')](function(){_0x4fc285[_0xced3('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3db664,_0x4024fa){return function(_0x196956){if(!_0x196956){_0x3db664[_0xced3('0x1b')](0x194);}return _0x196956;};}function handleError(_0x4389f8,_0x38f594){_0x38f594=_0x38f594||0x1f4;return function(_0x895a32){logger[_0xced3('0x2a')](_0x895a32[_0xced3('0x2b')]);if(_0x895a32['name']){delete _0x895a32[_0xced3('0x2c')];}_0x4389f8[_0xced3('0x1d')](_0x38f594)[_0xced3('0x2d')](_0x895a32);};}exports[_0xced3('0x2e')]=function(_0x111769,_0x21e4a2){var _0x41ce44={},_0x4f2439={},_0xc8e557={'count':0x0,'rows':[]};var _0x30cd7f=_[_0xced3('0x2f')](db[_0xced3('0x30')][_0xced3('0x31')],function(_0x407a24){return{'name':_0x407a24[_0xced3('0x32')],'type':_0x407a24[_0xced3('0x33')][_0xced3('0x34')]};});_0x4f2439[_0xced3('0x35')]=_[_0xced3('0x2f')](_0x30cd7f,_0xced3('0x2c'));_0x4f2439[_0xced3('0x36')]=_['keys'](_0x111769[_0xced3('0x36')]);_0x4f2439['filters']=_[_0xced3('0x37')](_0x4f2439[_0xced3('0x35')],_0x4f2439[_0xced3('0x36')]);_0x41ce44[_0xced3('0x38')]=_[_0xced3('0x37')](_0x4f2439[_0xced3('0x35')],qs[_0xced3('0x39')](_0x111769[_0xced3('0x36')][_0xced3('0x39')]));_0x41ce44[_0xced3('0x38')]=_0x41ce44['attributes'][_0xced3('0x3a')]?_0x41ce44[_0xced3('0x38')]:_0x4f2439['model'];if(!_0x111769[_0xced3('0x36')][_0xced3('0x3b')](_0xced3('0x3c'))){_0x41ce44['limit']=qs['limit'](_0x111769[_0xced3('0x36')]['limit']);_0x41ce44[_0xced3('0x1f')]=qs[_0xced3('0x1f')](_0x111769['query'][_0xced3('0x1f')]);}_0x41ce44[_0xced3('0x3d')]=qs[_0xced3('0x3e')](_0x111769['query'][_0xced3('0x3e')]);_0x41ce44['where']=qs['filters'](_[_0xced3('0x3f')](_0x111769[_0xced3('0x36')],_0x4f2439[_0xced3('0x40')]),_0x30cd7f);if(_0x111769['query'][_0xced3('0x41')]){_0x41ce44[_0xced3('0x42')]=_[_0xced3('0x43')](_0x41ce44[_0xced3('0x42')],{'$or':_[_0xced3('0x2f')](_0x30cd7f,function(_0x2a8e0e){if(_0x2a8e0e[_0xced3('0x33')]!==_0xced3('0x44')){var _0x9c8a07={};_0x9c8a07[_0x2a8e0e[_0xced3('0x2c')]]={'$like':'%'+_0x111769[_0xced3('0x36')][_0xced3('0x41')]+'%'};return _0x9c8a07;}})});}_0x41ce44=_[_0xced3('0x43')]({},_0x41ce44,_0x111769[_0xced3('0x45')]);var _0x1ced3a={'where':_0x41ce44['where']};return db[_0xced3('0x30')][_0xced3('0x22')](_0x1ced3a)[_0xced3('0x27')](function(_0x1a6c1f){_0xc8e557[_0xced3('0x22')]=_0x1a6c1f;if(_0x111769[_0xced3('0x36')][_0xced3('0x46')]){_0x41ce44[_0xced3('0x47')]=[{'all':!![]}];}return db[_0xced3('0x30')]['findAll'](_0x41ce44);})[_0xced3('0x27')](function(_0x47ab23){_0xc8e557[_0xced3('0x48')]=_0x47ab23;return _0xc8e557;})[_0xced3('0x27')](respondWithFilteredResult(_0x21e4a2,_0x41ce44))[_0xced3('0x49')](handleError(_0x21e4a2,null));};exports['show']=function(_0x11e733,_0x34f24a){var _0x3569f3={'raw':![],'where':{'id':_0x11e733['params']['id']}},_0x26b8ac={};_0x26b8ac[_0xced3('0x35')]=_[_0xced3('0x4a')](db[_0xced3('0x30')][_0xced3('0x31')]);_0x26b8ac[_0xced3('0x36')]=_['keys'](_0x11e733[_0xced3('0x36')]);_0x26b8ac[_0xced3('0x40')]=_[_0xced3('0x37')](_0x26b8ac[_0xced3('0x35')],_0x26b8ac[_0xced3('0x36')]);_0x3569f3[_0xced3('0x38')]=_[_0xced3('0x37')](_0x26b8ac['model'],qs[_0xced3('0x39')](_0x11e733[_0xced3('0x36')]['fields']));_0x3569f3['attributes']=_0x3569f3[_0xced3('0x38')]['length']?_0x3569f3[_0xced3('0x38')]:_0x26b8ac[_0xced3('0x35')];if(_0x11e733[_0xced3('0x36')][_0xced3('0x46')]){_0x3569f3[_0xced3('0x47')]=[{'all':!![]}];}_0x3569f3=_[_0xced3('0x43')]({},_0x3569f3,_0x11e733[_0xced3('0x45')]);return db[_0xced3('0x30')][_0xced3('0x4b')](_0x3569f3)['then'](handleEntityNotFound(_0x34f24a,null))[_0xced3('0x27')](respondWithResult(_0x34f24a,null))[_0xced3('0x49')](handleError(_0x34f24a,null));};exports[_0xced3('0x28')]=function(_0x469b6,_0x24ee62){return db[_0xced3('0x30')]['find']({'where':{'id':_0x469b6[_0xced3('0x4c')]['id']}})[_0xced3('0x27')](handleEntityNotFound(_0x24ee62,null))[_0xced3('0x27')](removeEntity(_0x24ee62,null))[_0xced3('0x49')](handleError(_0x24ee62,null));};exports[_0xced3('0x4d')]=function(_0x14dbfe,_0x1543b0){return db[_0xced3('0x30')][_0xced3('0x4d')]()[_0xced3('0x27')](respondWithResult(_0x1543b0,null))[_0xced3('0x49')](handleError(_0x1543b0,null));};exports[_0xced3('0x4e')]=function(_0x4a9111,_0x1c69df){var _0x4bd3cb;return db[_0xced3('0x4f')][_0xced3('0x50')](function(_0xc93e05){return db['VoicePrefix']['create'](_0x4a9111[_0xced3('0x51')],{'transaction':_0xc93e05})[_0xced3('0x27')](function(_0x53724a){_0x4bd3cb=_0x53724a[_0xced3('0x29')]({'plain':!![]});return db['VoiceExtension'][_0xced3('0x4b')]({'where':{'id':_0x4bd3cb[_0xced3('0x52')]},'raw':!![]})['then'](function(_0x1627f9){return createVoicePrefixExtensions(_0x4bd3cb,_0x1627f9,_0xc93e05);});});})[_0xced3('0x27')](function(){var _0xf4d7bf=_0x4a9111['user'][_0xced3('0x29')]({'plain':!![]});if(!_0xf4d7bf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xf4d7bf[_0xced3('0x53')]===_0xced3('0x54')){var _0x4694b8=_0x4bd3cb;return db[_0xced3('0x55')][_0xced3('0x4b')]({'where':{'name':_0xced3('0x56'),'userProfileId':_0xf4d7bf[_0xced3('0x57')]},'raw':!![]})[_0xced3('0x27')](function(_0x1b2592){if(_0x1b2592&&_0x1b2592[_0xced3('0x58')]===0x0){return db[_0xced3('0x59')]['create']({'name':_0x4694b8[_0xced3('0x2c')],'resourceId':_0x4694b8['id'],'type':_0x1b2592[_0xced3('0x2c')],'sectionId':_0x1b2592['id']},{})[_0xced3('0x27')](function(){return _0x4bd3cb;});}else{return _0x4bd3cb;}})[_0xced3('0x49')](function(_0x21a22d){logger[_0xced3('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x21a22d);throw _0x21a22d;});}return _0x4bd3cb;})[_0xced3('0x27')](respondWithResult(_0x1c69df,null))[_0xced3('0x49')](handleError(_0x1c69df,null));};function Extension(_0x21ea6a,_0x440a0f,_0x443469,_0x1537ca){this['context']=_0xced3('0x5a');this['exten']=_0x21ea6a;this[_0xced3('0x5b')]=_0x443469;this['type']=_0xced3('0x5c');this[_0xced3('0x5d')]='Voice\x20Prefix\x20Extension';this[_0xced3('0x5e')]=_0x440a0f;this[_0xced3('0x5f')]=_0x1537ca;}function createVoicePrefixExtensions(_0x76d1f6,_0x3bb7d5,_0x1ec94b){return new BPromise(function(_0x21eeec,_0x2318a0){var _0x206dd3=new Extension(formatPrefixName(_0x76d1f6[_0xced3('0x60')]),0x1,_0xced3('0x61'),_0xced3('0x62'));_0x206dd3[_0xced3('0x63')]=_0x76d1f6['id'];return db[_0xced3('0x64')]['create'](_0x206dd3,{'transaction':_0x1ec94b})[_0xced3('0x27')](function(_0xb2b5d7){var _0x2857c8=_0xb2b5d7[_0xced3('0x29')]({'plain':!![]});var _0x4f8a3f=_[_0xced3('0x2f')](addVoicePrefixExtensions(_0x76d1f6,_0x3bb7d5),function(_0x979b24){_0x979b24[_0xced3('0x52')]=_0x2857c8['id'];_0x979b24[_0xced3('0x63')]=_0x76d1f6['id'];return _0x979b24;});return db[_0xced3('0x64')][_0xced3('0x65')](_0x4f8a3f,{'transaction':_0x1ec94b})[_0xced3('0x27')](function(_0x4df923){if(!_0x4df923){return _0x2318a0(_0xced3('0x66'));}else{return _0x21eeec(_0x4df923);}})[_0xced3('0x49')](function(_0x5db4eb){return _0x2318a0(_0x5db4eb);});});;});};function addVoicePrefixExtensions(_0x1630d7,_0xde15b5){var _0x3a9dac=[];var _0x2ac060=formatPrefixName(_0x1630d7['prefix']);_0x3a9dac[_0xced3('0x67')](new Extension(_0x2ac060,0x2,_0xced3('0x68'),_0xced3('0x69')+_0x1630d7[_0xced3('0x2c')]));if(_0x1630d7[_0xced3('0x6a')]){_0x3a9dac[_0xced3('0x67')](new Extension(_0x2ac060,0x3,_0xced3('0x68'),_0xced3('0x6b')+_0x1630d7[_0xced3('0x6a')]));}else{_0x3a9dac[_0xced3('0x67')](new Extension(_0x2ac060,0x3,'NoOp',_0xced3('0x6c')));}_0x3a9dac[_0xced3('0x67')](new Extension(_0x2ac060,0x4,'goto',_0xde15b5['context']+','+_0xced3('0x6d')+(0x8+_0x1630d7['name'][_0xced3('0x3a')])+'}'+','+0x1));return _0x3a9dac;}function formatPrefixName(_0x256216){var _0x5e3d3d='_';for(var _0x2936b5=0x0;_0x2936b5<_0x256216[_0xced3('0x3a')];_0x2936b5++){if(_0x256216['charAt'](_0x2936b5)=='-'){_0x5e3d3d+=_0x256216[_0xced3('0x6e')](_0x2936b5);}else{_0x5e3d3d+='['+_0x256216['charAt'](_0x2936b5)+']';}}_0x5e3d3d+='.';return _0x5e3d3d;}exports[_0xced3('0x6f')]=function(_0x58b66b,_0xf8ccc6,_0x3c9de8){var _0x11f393=_0x58b66b['body'];_0x11f393[_0xced3('0x60')]=_0xced3('0x70')+_0x11f393[_0xced3('0x2c')]+'-';return db['sequelize'][_0xced3('0x50')](function(_0x1abe1a){return db[_0xced3('0x30')][_0xced3('0x6f')](_0x11f393,{'where':{'id':_0x11f393['id']},'transaction':_0x1abe1a})['then'](function(){return db['VoiceExtension'][_0xced3('0x28')]({'where':{'VoicePrefixId':_0x11f393['id']},'transaction':_0x1abe1a})[_0xced3('0x27')](function(){return db[_0xced3('0x64')][_0xced3('0x4b')]({'where':{'id':_0x11f393[_0xced3('0x52')]},'raw':!![]})[_0xced3('0x27')](function(_0x55da18){return createVoicePrefixExtensions(_0x11f393,_0x55da18,_0x1abe1a);});});});})[_0xced3('0x27')](function(){return db['VoicePrefix'][_0xced3('0x71')](_0x11f393['id']);})[_0xced3('0x27')](respondWithResult(_0xf8ccc6,null))[_0xced3('0x49')](handleError(_0xf8ccc6,null));};exports[_0xced3('0x72')]=function(_0x569055,_0x24d0ad,_0x22e74d){return db['VoicePrefix']['find']({'where':{'id':_0x569055[_0xced3('0x4c')]['id']}})[_0xced3('0x27')](handleEntityNotFound(_0x24d0ad,null))[_0xced3('0x27')](function(_0x138e25){if(_0x138e25){return _0x138e25[_0xced3('0x72')](_0x569055['body'][_0xced3('0x73')],_[_0xced3('0x74')](_0x569055[_0xced3('0x51')],[_0xced3('0x73'),'id'])||{})['spread'](function(_0x13020d){for(var _0x1777eb=0x0;_0x1777eb<_0x569055[_0xced3('0x51')][_0xced3('0x73')][_0xced3('0x3a')];_0x1777eb+=0x1){socket[_0xced3('0x75')](_0xced3('0x76'),{'UserId':Number(_0x569055[_0xced3('0x51')][_0xced3('0x73')][_0x1777eb]),'VoicePrefixId':Number(_0x569055[_0xced3('0x4c')]['id'])});}return _0x13020d;});}})['then'](respondWithResult(_0x24d0ad,null))[_0xced3('0x49')](handleError(_0x24d0ad,null));};exports[_0xced3('0x77')]=function(_0x498ea9,_0x284cf2,_0xeef6f4){return db[_0xced3('0x30')][_0xced3('0x4b')]({'where':{'id':_0x498ea9[_0xced3('0x4c')]['id']}})['then'](handleEntityNotFound(_0x284cf2,null))[_0xced3('0x27')](function(_0x3e561e){if(_0x3e561e){return _0x3e561e['removeAgents'](_0x498ea9[_0xced3('0x36')][_0xced3('0x73')])[_0xced3('0x27')](function(){if(_[_0xced3('0x78')](_0x498ea9[_0xced3('0x36')][_0xced3('0x73')])){for(var _0x5c68e1=0x0;_0x5c68e1<_0x498ea9[_0xced3('0x36')][_0xced3('0x73')][_0xced3('0x3a')];_0x5c68e1+=0x1){socket[_0xced3('0x75')](_0xced3('0x79'),{'UserId':Number(_0x498ea9[_0xced3('0x36')]['ids'][_0x5c68e1]),'VoicePrefixId':Number(_0x498ea9['params']['id'])});}}else{socket[_0xced3('0x75')](_0xced3('0x79'),{'UserId':Number(_0x498ea9[_0xced3('0x36')][_0xced3('0x73')]),'VoicePrefixId':Number(_0x498ea9[_0xced3('0x4c')]['id'])});}});}})[_0xced3('0x27')](respondWithStatusCode(_0x284cf2,null))[_0xced3('0x49')](handleError(_0x284cf2,null));};exports['getAgents']=function(_0x3d64ec,_0x290ca3,_0x51979a){var _0x5de22d={};var _0x12de12={};var _0x29f8b5;var _0x3b07ac;return db[_0xced3('0x30')][_0xced3('0x7a')]({'where':{'id':_0x3d64ec['params']['id']}})[_0xced3('0x27')](handleEntityNotFound(_0x290ca3,null))['then'](function(_0x34edbf){if(_0x34edbf){_0x29f8b5=_0x34edbf;_0x12de12[_0xced3('0x35')]=_[_0xced3('0x4a')](db[_0xced3('0x7b')][_0xced3('0x31')]);_0x12de12['query']=_[_0xced3('0x4a')](_0x3d64ec[_0xced3('0x36')]);_0x12de12[_0xced3('0x40')]=_[_0xced3('0x37')](_0x12de12['model'],_0x12de12['query']);_0x5de22d[_0xced3('0x38')]=_[_0xced3('0x37')](_0x12de12[_0xced3('0x35')],qs[_0xced3('0x39')](_0x3d64ec[_0xced3('0x36')][_0xced3('0x39')]));_0x5de22d[_0xced3('0x38')]=_0x5de22d[_0xced3('0x38')]['length']?_0x5de22d['attributes']:_0x12de12[_0xced3('0x35')];_0x5de22d[_0xced3('0x3d')]=qs[_0xced3('0x3e')](_0x3d64ec[_0xced3('0x36')][_0xced3('0x3e')]);_0x5de22d[_0xced3('0x42')]=qs[_0xced3('0x40')](_[_0xced3('0x3f')](_0x3d64ec[_0xced3('0x36')],_0x12de12[_0xced3('0x40')]));if(_0x3d64ec[_0xced3('0x36')]['filter']){_0x5de22d[_0xced3('0x42')]=_['merge'](_0x5de22d[_0xced3('0x42')],{'$or':_[_0xced3('0x2f')](_0x5de22d[_0xced3('0x38')],function(_0x3ad616){var _0x1df2d1={};_0x1df2d1[_0x3ad616]={'$like':'%'+_0x3d64ec[_0xced3('0x36')][_0xced3('0x41')]+'%'};return _0x1df2d1;})});}_0x5de22d=_[_0xced3('0x43')]({},_0x5de22d,_0x3d64ec[_0xced3('0x45')]);return _0x29f8b5[_0xced3('0x7c')](_0x5de22d);}})[_0xced3('0x27')](function(_0x3869f3){if(_0x3869f3){_0x3b07ac=_0x3869f3[_0xced3('0x3a')];if(!_0x3d64ec[_0xced3('0x36')][_0xced3('0x3b')](_0xced3('0x3c'))){_0x5de22d[_0xced3('0x21')]=qs['limit'](_0x3d64ec['query']['limit']);_0x5de22d[_0xced3('0x1f')]=qs[_0xced3('0x1f')](_0x3d64ec[_0xced3('0x36')][_0xced3('0x1f')]);}return _0x29f8b5[_0xced3('0x7c')](_0x5de22d);}})[_0xced3('0x27')](function(_0x587891){if(_0x587891){return _0x587891?{'count':_0x3b07ac,'rows':_0x587891}:null;}})[_0xced3('0x27')](respondWithResult(_0x290ca3,null))[_0xced3('0x49')](handleError(_0x290ca3,null));};exports['getTeams']=function(_0x5e6a80,_0x451c1a,_0x3284da){var _0x34ebbd={};var _0x4412cc={};var _0x3e5f7f;var _0x3b3a5c;return db['VoicePrefix'][_0xced3('0x7a')]({'where':{'id':_0x5e6a80['params']['id']}})[_0xced3('0x27')](handleEntityNotFound(_0x451c1a,null))[_0xced3('0x27')](function(_0x44a80b){if(_0x44a80b){_0x3e5f7f=_0x44a80b;_0x4412cc['model']=_['keys'](db['Team'][_0xced3('0x31')]);_0x4412cc[_0xced3('0x36')]=_['keys'](_0x5e6a80[_0xced3('0x36')]);_0x4412cc[_0xced3('0x40')]=_['intersection'](_0x4412cc[_0xced3('0x35')],_0x4412cc[_0xced3('0x36')]);_0x34ebbd[_0xced3('0x38')]=_[_0xced3('0x37')](_0x4412cc[_0xced3('0x35')],qs[_0xced3('0x39')](_0x5e6a80[_0xced3('0x36')][_0xced3('0x39')]));_0x34ebbd['attributes']=_0x34ebbd[_0xced3('0x38')][_0xced3('0x3a')]?_0x34ebbd[_0xced3('0x38')]:_0x4412cc[_0xced3('0x35')];_0x34ebbd[_0xced3('0x3d')]=qs[_0xced3('0x3e')](_0x5e6a80[_0xced3('0x36')][_0xced3('0x3e')]);_0x34ebbd[_0xced3('0x42')]=qs[_0xced3('0x40')](_[_0xced3('0x3f')](_0x5e6a80[_0xced3('0x36')],_0x4412cc[_0xced3('0x40')]));if(_0x5e6a80[_0xced3('0x36')][_0xced3('0x41')]){_0x34ebbd['where']=_[_0xced3('0x43')](_0x34ebbd[_0xced3('0x42')],{'$or':_[_0xced3('0x2f')](_0x34ebbd[_0xced3('0x38')],function(_0x2c59f5){var _0x5874b5={};_0x5874b5[_0x2c59f5]={'$like':'%'+_0x5e6a80['query'][_0xced3('0x41')]+'%'};return _0x5874b5;})});}_0x34ebbd=_[_0xced3('0x43')]({},_0x34ebbd,_0x5e6a80[_0xced3('0x45')]);return _0x3e5f7f[_0xced3('0x7d')](_0x34ebbd);}})[_0xced3('0x27')](function(_0x26920d){if(_0x26920d){_0x3b3a5c=_0x26920d[_0xced3('0x3a')];if(!_0x5e6a80['query']['hasOwnProperty'](_0xced3('0x3c'))){_0x34ebbd['limit']=qs[_0xced3('0x21')](_0x5e6a80[_0xced3('0x36')][_0xced3('0x21')]);_0x34ebbd[_0xced3('0x1f')]=qs[_0xced3('0x1f')](_0x5e6a80[_0xced3('0x36')][_0xced3('0x1f')]);}return _0x3e5f7f[_0xced3('0x7d')](_0x34ebbd);}})[_0xced3('0x27')](function(_0x2b688c){if(_0x2b688c){return _0x2b688c?{'count':_0x3b3a5c,'rows':_0x2b688c}:null;}})[_0xced3('0x27')](respondWithResult(_0x451c1a,null))[_0xced3('0x49')](handleError(_0x451c1a,null));};exports[_0xced3('0x7e')]=function(_0xbd91ef,_0x561aca,_0x4b2f62){var _0x361c6f=_0xbd91ef['body'][_0xced3('0x73')];var _0x4f0fcb;return db['Team'][_0xced3('0x7f')]({'where':{'id':_0x361c6f},'attributes':['id'],'include':[{'model':db[_0xced3('0x7b')],'as':_0xced3('0x80'),'attributes':['id',_0xced3('0x2c'),'online','voicePause',_0xced3('0x81')],'raw':!![]}]})[_0xced3('0x27')](function(_0x2f2f77){if(_0x2f2f77){_0x4f0fcb=_0x2f2f77;var _0x5448d5=_[_0xced3('0x82')](_0x2f2f77,function(_0x50cc83){var _0x4b6afc=_0x50cc83[_0xced3('0x29')]({'plain':!![]});return _0x4b6afc[_0xced3('0x80')];});return db[_0xced3('0x30')][_0xced3('0x4b')]({'where':{'id':_0xbd91ef[_0xced3('0x4c')]['id']}})[_0xced3('0x27')](function(_0x420c12){return db[_0xced3('0x4f')]['transaction'](function(_0x566191){return _0x420c12[_0xced3('0x7e')](_0x361c6f,{'transaction':_0x566191})['then'](function(){return BPromise[_0xced3('0x83')](_0x4f0fcb,function(_0x239dda){return db['TeamVoicePrefix'][_0xced3('0x84')]({'TeamId':_0x239dda['id'],'VoicePrefixId':_0xbd91ef[_0xced3('0x4c')]['id']},{'transaction':_0x566191});});})[_0xced3('0x27')](function(){return BPromise[_0xced3('0x83')](_0x5448d5,function(_0x7fb3c7){return db[_0xced3('0x85')]['findOrCreate']({'where':{'UserId':_0x7fb3c7['id'],'VoicePrefixId':_0xbd91ef[_0xced3('0x4c')]['id']},'transaction':_0x566191});});})[_0xced3('0x27')](function(){_0x5448d5[_0xced3('0x86')](function(_0x3d88fc){socket[_0xced3('0x75')](_0xced3('0x76'),{'UserId':_0x3d88fc['id'],'VoicePrefixId':_0x420c12['id']});});});});});}})['then'](respondWithStatusCode(_0x561aca,null))['catch'](handleError(_0x561aca,null));};exports['removeTeams']=function(_0x4074b9,_0x2e2303,_0x26af34){return db[_0xced3('0x87')][_0xced3('0x7f')]({'where':{'id':_0x4074b9['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xced3('0x7b')],'as':_0xced3('0x80'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2e2303,null))['then'](function(_0xdec3b0){var _0x38a06b=_[_0xced3('0x2f')](_0xdec3b0,'id');var _0xbeffe6=[];var _0x2211ed=[];var _0x22ab59=squel[_0xced3('0x88')]();_0x22ab59[_0xced3('0x89')](_0xced3('0x8a'))[_0xced3('0x8b')]('team_has_voice_prefixes','tq')[_0xced3('0x8c')](_0xced3('0x8d'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xced3('0x42')](_0xced3('0x8e'),_0x4074b9[_0xced3('0x4c')]['id']);for(var _0x268c72=0x0;_0x268c72<_0xdec3b0[_0xced3('0x3a')];_0x268c72+=0x1){let _0x26daab=_0xdec3b0[_0x268c72];for(var _0x1ab60d=0x0;_0x1ab60d<_0x26daab[_0xced3('0x80')]['length'];_0x1ab60d+=0x1){let _0x5dd10b=_0x26daab[_0xced3('0x80')][_0x1ab60d];var _0x173a37=_0x22ab59['clone']();_0x173a37[_0xced3('0x42')](_0xced3('0x8f'),_0x5dd10b['id']);_0x2211ed[_0xced3('0x67')](db[_0xced3('0x4f')][_0xced3('0x36')](_0x173a37[_0xced3('0x90')](),{'type':db['sequelize'][_0xced3('0x91')]['SELECT']})['then'](function(_0x2ed48f){if(_0x2ed48f[_0xced3('0x3a')]===0x1){return _0x5dd10b['id'];}else{var _0x21f013=_[_0xced3('0x92')](_['map'](_0x2ed48f,_0xced3('0x93')),function(_0x1082c0){return _['includes'](_0x38a06b,_0x1082c0);});if(_0x21f013){return _0x5dd10b['id'];}}}));}}return BPromise['all'](_0x2211ed)['then'](function(_0x3e8ed7){_0xbeffe6=_(_0xbeffe6)[_0xced3('0x94')](_0x3e8ed7)[_0xced3('0x95')]()[_0xced3('0x96')]();return db[_0xced3('0x30')][_0xced3('0x4b')]({'where':{'id':_0x4074b9[_0xced3('0x4c')]['id']}})[_0xced3('0x27')](function(_0x235faa){return db[_0xced3('0x4f')]['transaction'](function(_0x5e9fba){return _0x235faa[_0xced3('0x97')](_0x4074b9[_0xced3('0x36')]['ids'],{'transaction':_0x5e9fba})['then'](function(){if(!_[_0xced3('0x98')](_0xbeffe6)){return _0x235faa[_0xced3('0x77')](_0xbeffe6,{'transaction':_0x5e9fba});}})[_0xced3('0x27')](function(){_0xbeffe6['forEach'](function(_0x473c70){socket['emit'](_0xced3('0x79'),{'UserId':_0x473c70,'VoicePrefixId':_0x235faa['id']});});});});});});})['then'](respondWithStatusCode(_0x2e2303,null))[_0xced3('0x49')](handleError(_0x2e2303,null));}; \ No newline at end of file +var _0xbbbc=['filters','filter','merge','options','VoicePrefix','includeAll','include','findAll','rows','catch','show','params','find','describe','create','sequelize','transaction','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','VoicePrefixes','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','exten','system','priority','NoOp','Voice\x20Prefix','VoicePrefixId','Extensions\x20creation\x20failed','prefix','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','context','${EXTEN:','charAt','system-','update','findById','addAgents','ids','omit','body','emit','userVoicePrefix:save','removeAgents','isArray','findOne','pick','getAgents','Team','getTeams','hasOwnProperty','addTeams','Agents','online','interface','flatMap','each','TeamVoicePrefix','findOrCreate','forEach','removeTeams','field','from','join','user_has_teams','VoicePrefixId\x20=\x20?','clone','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','userVoicePrefix:remove','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','register','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','then','get','UserProfileResource','destroy','status','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','nolimit','order','sort','where'];(function(_0x2cd1dc,_0x1e3567){var _0x87efef=function(_0x4a1f78){while(--_0x4a1f78){_0x2cd1dc['push'](_0x2cd1dc['shift']());}};_0x87efef(++_0x1e3567);}(_0xbbbc,0xf6));var _0xcbbb=function(_0x54727f,_0x81ee6f){_0x54727f=_0x54727f-0x0;var _0x5900df=_0xbbbc[_0x54727f];return _0x5900df;};'use strict';var emlformat=require(_0xcbbb('0x0'));var rimraf=require(_0xcbbb('0x1'));var zipdir=require(_0xcbbb('0x2'));var jsonpatch=require(_0xcbbb('0x3'));var rp=require(_0xcbbb('0x4'));var moment=require(_0xcbbb('0x5'));var BPromise=require(_0xcbbb('0x6'));var Mustache=require('mustache');var util=require(_0xcbbb('0x7'));var path=require(_0xcbbb('0x8'));var sox=require(_0xcbbb('0x9'));var csv=require(_0xcbbb('0xa'));var ejs=require(_0xcbbb('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcbbb('0xc'));var squel=require(_0xcbbb('0xd'));var crypto=require(_0xcbbb('0xe'));var jsforce=require(_0xcbbb('0xf'));var deskjs=require(_0xcbbb('0x10'));var toCsv=require(_0xcbbb('0xa'));var querystring=require(_0xcbbb('0x11'));var Papa=require('papaparse');var Redis=require(_0xcbbb('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xcbbb('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcbbb('0x14'))('api');var utils=require(_0xcbbb('0x15'));var config=require(_0xcbbb('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xcbbb('0x17'))['db'];config['redis']=_[_0xcbbb('0x18')](config['redis'],{'host':_0xcbbb('0x19'),'port':0x18eb});var socket=require(_0xcbbb('0x1a'))(new Redis(config[_0xcbbb('0x1b')]));require('./voicePrefix.socket')[_0xcbbb('0x1c')](socket);function respondWithStatusCode(_0x3ff767,_0x8a325c){_0x8a325c=_0x8a325c||0xcc;return function(_0x273e13){if(_0x273e13){return _0x3ff767['sendStatus'](_0x8a325c);}return _0x3ff767['status'](_0x8a325c)[_0xcbbb('0x1d')]();};}function respondWithResult(_0x30297d,_0xf76038){_0xf76038=_0xf76038||0xc8;return function(_0x188698){if(_0x188698){return _0x30297d['status'](_0xf76038)[_0xcbbb('0x1e')](_0x188698);}};}function respondWithFilteredResult(_0x4ff973,_0x1fbfb1){return function(_0x3436af){if(_0x3436af){var _0x3572bb=typeof _0x1fbfb1['offset']==='undefined'&&typeof _0x1fbfb1['limit']===_0xcbbb('0x1f');var _0x3ae91b=_0x3436af[_0xcbbb('0x20')];var _0x25e92f=_0x3572bb?0x0:_0x1fbfb1[_0xcbbb('0x21')];var _0x1cca90=_0x3572bb?_0x3436af[_0xcbbb('0x20')]:_0x1fbfb1[_0xcbbb('0x21')]+_0x1fbfb1[_0xcbbb('0x22')];var _0x2d4335;if(_0x1cca90>=_0x3ae91b){_0x1cca90=_0x3ae91b;_0x2d4335=0xc8;}else{_0x2d4335=0xce;}_0x4ff973['status'](_0x2d4335);return _0x4ff973[_0xcbbb('0x23')](_0xcbbb('0x24'),_0x25e92f+'-'+_0x1cca90+'/'+_0x3ae91b)[_0xcbbb('0x1e')](_0x3436af);}return null;};}function patchUpdates(_0x42aaf1){return function(_0x258d1f){try{jsonpatch[_0xcbbb('0x25')](_0x258d1f,_0x42aaf1,!![]);}catch(_0x297eae){return BPromise[_0xcbbb('0x26')](_0x297eae);}return _0x258d1f[_0xcbbb('0x27')]();};}function saveUpdates(_0x5e3970,_0xf39ddd){return function(_0x4490c1){if(_0x4490c1){return _0x4490c1['update'](_0x5e3970)[_0xcbbb('0x28')](function(_0x4ffa80){return _0x4ffa80;});}return null;};}function removeEntity(_0x48dfc4,_0x575d56){return function(_0x32e070){if(_0x32e070){return _0x32e070['destroy']()['then'](function(){var _0x5499a1=_0x32e070[_0xcbbb('0x29')]({'plain':!![]});var _0x55e1d8='VoicePrefixes';return db[_0xcbbb('0x2a')][_0xcbbb('0x2b')]({'where':{'type':_0x55e1d8,'resourceId':_0x5499a1['id']}})[_0xcbbb('0x28')](function(){return _0x32e070;});})[_0xcbbb('0x28')](function(){_0x48dfc4[_0xcbbb('0x2c')](0xcc)[_0xcbbb('0x1d')]();});}};}function handleEntityNotFound(_0x3d4c0d,_0x1c986d){return function(_0x2a023f){if(!_0x2a023f){_0x3d4c0d[_0xcbbb('0x2d')](0x194);}return _0x2a023f;};}function handleError(_0x1c2ac9,_0xeb8cd8){_0xeb8cd8=_0xeb8cd8||0x1f4;return function(_0xfa973b){logger[_0xcbbb('0x2e')](_0xfa973b[_0xcbbb('0x2f')]);if(_0xfa973b[_0xcbbb('0x30')]){delete _0xfa973b[_0xcbbb('0x30')];}_0x1c2ac9[_0xcbbb('0x2c')](_0xeb8cd8)['send'](_0xfa973b);};}exports[_0xcbbb('0x31')]=function(_0x203a34,_0x5332f9){var _0xec2761={},_0x539dcf={},_0x2d37d3={'count':0x0,'rows':[]};var _0x1fb05e=_[_0xcbbb('0x32')](db['VoicePrefix'][_0xcbbb('0x33')],function(_0xa4743b){return{'name':_0xa4743b[_0xcbbb('0x34')],'type':_0xa4743b[_0xcbbb('0x35')][_0xcbbb('0x36')]};});_0x539dcf[_0xcbbb('0x37')]=_[_0xcbbb('0x32')](_0x1fb05e,_0xcbbb('0x30'));_0x539dcf[_0xcbbb('0x38')]=_[_0xcbbb('0x39')](_0x203a34['query']);_0x539dcf['filters']=_['intersection'](_0x539dcf['model'],_0x539dcf[_0xcbbb('0x38')]);_0xec2761[_0xcbbb('0x3a')]=_[_0xcbbb('0x3b')](_0x539dcf[_0xcbbb('0x37')],qs[_0xcbbb('0x3c')](_0x203a34[_0xcbbb('0x38')][_0xcbbb('0x3c')]));_0xec2761[_0xcbbb('0x3a')]=_0xec2761[_0xcbbb('0x3a')][_0xcbbb('0x3d')]?_0xec2761[_0xcbbb('0x3a')]:_0x539dcf[_0xcbbb('0x37')];if(!_0x203a34['query']['hasOwnProperty'](_0xcbbb('0x3e'))){_0xec2761['limit']=qs['limit'](_0x203a34['query'][_0xcbbb('0x22')]);_0xec2761[_0xcbbb('0x21')]=qs[_0xcbbb('0x21')](_0x203a34[_0xcbbb('0x38')][_0xcbbb('0x21')]);}_0xec2761[_0xcbbb('0x3f')]=qs[_0xcbbb('0x40')](_0x203a34[_0xcbbb('0x38')][_0xcbbb('0x40')]);_0xec2761[_0xcbbb('0x41')]=qs[_0xcbbb('0x42')](_['pick'](_0x203a34[_0xcbbb('0x38')],_0x539dcf['filters']),_0x1fb05e);if(_0x203a34[_0xcbbb('0x38')][_0xcbbb('0x43')]){_0xec2761[_0xcbbb('0x41')]=_[_0xcbbb('0x44')](_0xec2761[_0xcbbb('0x41')],{'$or':_[_0xcbbb('0x32')](_0x1fb05e,function(_0x5651fd){if(_0x5651fd['type']!=='VIRTUAL'){var _0xda1973={};_0xda1973[_0x5651fd[_0xcbbb('0x30')]]={'$like':'%'+_0x203a34[_0xcbbb('0x38')][_0xcbbb('0x43')]+'%'};return _0xda1973;}})});}_0xec2761=_[_0xcbbb('0x44')]({},_0xec2761,_0x203a34[_0xcbbb('0x45')]);var _0x2b45ee={'where':_0xec2761['where']};return db[_0xcbbb('0x46')][_0xcbbb('0x20')](_0x2b45ee)['then'](function(_0x15b3bc){_0x2d37d3[_0xcbbb('0x20')]=_0x15b3bc;if(_0x203a34[_0xcbbb('0x38')][_0xcbbb('0x47')]){_0xec2761[_0xcbbb('0x48')]=[{'all':!![]}];}return db['VoicePrefix'][_0xcbbb('0x49')](_0xec2761);})['then'](function(_0x520448){_0x2d37d3[_0xcbbb('0x4a')]=_0x520448;return _0x2d37d3;})[_0xcbbb('0x28')](respondWithFilteredResult(_0x5332f9,_0xec2761))[_0xcbbb('0x4b')](handleError(_0x5332f9,null));};exports[_0xcbbb('0x4c')]=function(_0xb5391d,_0x406e1c){var _0x2040bf={'raw':![],'where':{'id':_0xb5391d[_0xcbbb('0x4d')]['id']}},_0x3ba75e={};_0x3ba75e[_0xcbbb('0x37')]=_[_0xcbbb('0x39')](db[_0xcbbb('0x46')][_0xcbbb('0x33')]);_0x3ba75e[_0xcbbb('0x38')]=_['keys'](_0xb5391d[_0xcbbb('0x38')]);_0x3ba75e[_0xcbbb('0x42')]=_[_0xcbbb('0x3b')](_0x3ba75e[_0xcbbb('0x37')],_0x3ba75e['query']);_0x2040bf['attributes']=_['intersection'](_0x3ba75e[_0xcbbb('0x37')],qs[_0xcbbb('0x3c')](_0xb5391d[_0xcbbb('0x38')][_0xcbbb('0x3c')]));_0x2040bf[_0xcbbb('0x3a')]=_0x2040bf[_0xcbbb('0x3a')][_0xcbbb('0x3d')]?_0x2040bf['attributes']:_0x3ba75e[_0xcbbb('0x37')];if(_0xb5391d[_0xcbbb('0x38')][_0xcbbb('0x47')]){_0x2040bf[_0xcbbb('0x48')]=[{'all':!![]}];}_0x2040bf=_['merge']({},_0x2040bf,_0xb5391d[_0xcbbb('0x45')]);return db[_0xcbbb('0x46')][_0xcbbb('0x4e')](_0x2040bf)[_0xcbbb('0x28')](handleEntityNotFound(_0x406e1c,null))['then'](respondWithResult(_0x406e1c,null))['catch'](handleError(_0x406e1c,null));};exports[_0xcbbb('0x2b')]=function(_0x421137,_0x3dc052){return db['VoicePrefix']['find']({'where':{'id':_0x421137['params']['id']}})[_0xcbbb('0x28')](handleEntityNotFound(_0x3dc052,null))[_0xcbbb('0x28')](removeEntity(_0x3dc052,null))['catch'](handleError(_0x3dc052,null));};exports[_0xcbbb('0x4f')]=function(_0x35bb94,_0x2dc313){return db[_0xcbbb('0x46')]['describe']()[_0xcbbb('0x28')](respondWithResult(_0x2dc313,null))[_0xcbbb('0x4b')](handleError(_0x2dc313,null));};exports[_0xcbbb('0x50')]=function(_0x3526f5,_0xb267da){var _0x3679f4;return db[_0xcbbb('0x51')][_0xcbbb('0x52')](function(_0x2d3990){return db[_0xcbbb('0x46')][_0xcbbb('0x50')](_0x3526f5['body'],{'transaction':_0x2d3990})['then'](function(_0x3fb0bd){_0x3679f4=_0x3fb0bd[_0xcbbb('0x29')]({'plain':!![]});return db[_0xcbbb('0x53')]['find']({'where':{'id':_0x3679f4[_0xcbbb('0x54')]},'raw':!![]})['then'](function(_0x2a9958){return createVoicePrefixExtensions(_0x3679f4,_0x2a9958,_0x2d3990);});});})[_0xcbbb('0x28')](function(){var _0x317633=_0x3526f5[_0xcbbb('0x55')][_0xcbbb('0x29')]({'plain':!![]});if(!_0x317633)throw new Error(_0xcbbb('0x56'));if(_0x317633['role']==='user'){var _0x4cc098=_0x3679f4;return db[_0xcbbb('0x57')][_0xcbbb('0x4e')]({'where':{'name':_0xcbbb('0x58'),'userProfileId':_0x317633[_0xcbbb('0x59')]},'raw':!![]})[_0xcbbb('0x28')](function(_0x30bc24){if(_0x30bc24&&_0x30bc24[_0xcbbb('0x5a')]===0x0){return db[_0xcbbb('0x2a')][_0xcbbb('0x50')]({'name':_0x4cc098[_0xcbbb('0x30')],'resourceId':_0x4cc098['id'],'type':_0x30bc24[_0xcbbb('0x30')],'sectionId':_0x30bc24['id']},{})[_0xcbbb('0x28')](function(){return _0x3679f4;});}else{return _0x3679f4;}})[_0xcbbb('0x4b')](function(_0x48d295){logger[_0xcbbb('0x2e')](_0xcbbb('0x5b'),_0x48d295);throw _0x48d295;});}return _0x3679f4;})[_0xcbbb('0x28')](respondWithResult(_0xb267da,null))['catch'](handleError(_0xb267da,null));};function Extension(_0x17d714,_0x1dbf9b,_0x5501d5,_0x26f0e6){this['context']=_0xcbbb('0x5c');this[_0xcbbb('0x5d')]=_0x17d714;this['app']=_0x5501d5;this[_0xcbbb('0x35')]=_0xcbbb('0x5e');this['description']='Voice\x20Prefix\x20Extension';this[_0xcbbb('0x5f')]=_0x1dbf9b;this['appdata']=_0x26f0e6;}function createVoicePrefixExtensions(_0x411bc6,_0x4c56fe,_0xb68922){return new BPromise(function(_0x3849d8,_0x20aaa9){var _0x4b4bb7=new Extension(formatPrefixName(_0x411bc6['prefix']),0x1,_0xcbbb('0x60'),_0xcbbb('0x61'));_0x4b4bb7['VoicePrefixId']=_0x411bc6['id'];return db[_0xcbbb('0x53')][_0xcbbb('0x50')](_0x4b4bb7,{'transaction':_0xb68922})[_0xcbbb('0x28')](function(_0x556e48){var _0xe347c6=_0x556e48[_0xcbbb('0x29')]({'plain':!![]});var _0x12ef00=_[_0xcbbb('0x32')](addVoicePrefixExtensions(_0x411bc6,_0x4c56fe),function(_0xf13e52){_0xf13e52[_0xcbbb('0x54')]=_0xe347c6['id'];_0xf13e52[_0xcbbb('0x62')]=_0x411bc6['id'];return _0xf13e52;});return db['VoiceExtension']['bulkCreate'](_0x12ef00,{'transaction':_0xb68922})[_0xcbbb('0x28')](function(_0x2469e5){if(!_0x2469e5){return _0x20aaa9(_0xcbbb('0x63'));}else{return _0x3849d8(_0x2469e5);}})[_0xcbbb('0x4b')](function(_0x4bc7cc){return _0x20aaa9(_0x4bc7cc);});});;});};function addVoicePrefixExtensions(_0x5c6bf7,_0x3781df){var _0x4f6529=[];var _0x5ea915=formatPrefixName(_0x5c6bf7[_0xcbbb('0x64')]);_0x4f6529[_0xcbbb('0x65')](new Extension(_0x5ea915,0x2,_0xcbbb('0x66'),_0xcbbb('0x67')+_0x5c6bf7[_0xcbbb('0x30')]));if(_0x5c6bf7[_0xcbbb('0x68')]){_0x4f6529[_0xcbbb('0x65')](new Extension(_0x5ea915,0x3,'Set',_0xcbbb('0x69')+_0x5c6bf7['callerIdAll']));}else{_0x4f6529[_0xcbbb('0x65')](new Extension(_0x5ea915,0x3,'NoOp',_0xcbbb('0x6a')));}_0x4f6529[_0xcbbb('0x65')](new Extension(_0x5ea915,0x4,_0xcbbb('0x6b'),_0x3781df[_0xcbbb('0x6c')]+','+_0xcbbb('0x6d')+(0x8+_0x5c6bf7[_0xcbbb('0x30')][_0xcbbb('0x3d')])+'}'+','+0x1));return _0x4f6529;}function formatPrefixName(_0x619340){var _0x4ff7db='_';for(var _0x57d776=0x0;_0x57d776<_0x619340[_0xcbbb('0x3d')];_0x57d776++){if(_0x619340[_0xcbbb('0x6e')](_0x57d776)=='-'){_0x4ff7db+=_0x619340[_0xcbbb('0x6e')](_0x57d776);}else{_0x4ff7db+='['+_0x619340[_0xcbbb('0x6e')](_0x57d776)+']';}}_0x4ff7db+='.';return _0x4ff7db;}exports['update']=function(_0x583c33,_0x590fc6,_0x6060d){var _0x2f0db8=_0x583c33['body'];_0x2f0db8[_0xcbbb('0x64')]=_0xcbbb('0x6f')+_0x2f0db8['name']+'-';return db[_0xcbbb('0x51')][_0xcbbb('0x52')](function(_0x4e2198){return db[_0xcbbb('0x46')][_0xcbbb('0x70')](_0x2f0db8,{'where':{'id':_0x2f0db8['id']},'transaction':_0x4e2198})[_0xcbbb('0x28')](function(){return db['VoiceExtension']['destroy']({'where':{'VoicePrefixId':_0x2f0db8['id']},'transaction':_0x4e2198})[_0xcbbb('0x28')](function(){return db[_0xcbbb('0x53')][_0xcbbb('0x4e')]({'where':{'id':_0x2f0db8['VoiceExtensionId']},'raw':!![]})['then'](function(_0x128d79){return createVoicePrefixExtensions(_0x2f0db8,_0x128d79,_0x4e2198);});});});})[_0xcbbb('0x28')](function(){return db[_0xcbbb('0x46')][_0xcbbb('0x71')](_0x2f0db8['id']);})[_0xcbbb('0x28')](respondWithResult(_0x590fc6,null))[_0xcbbb('0x4b')](handleError(_0x590fc6,null));};exports[_0xcbbb('0x72')]=function(_0x194b4b,_0x3e401d,_0x305344){return db[_0xcbbb('0x46')]['find']({'where':{'id':_0x194b4b[_0xcbbb('0x4d')]['id']}})[_0xcbbb('0x28')](handleEntityNotFound(_0x3e401d,null))[_0xcbbb('0x28')](function(_0x3ad059){if(_0x3ad059){return _0x3ad059[_0xcbbb('0x72')](_0x194b4b['body'][_0xcbbb('0x73')],_[_0xcbbb('0x74')](_0x194b4b[_0xcbbb('0x75')],[_0xcbbb('0x73'),'id'])||{})['spread'](function(_0x264c34){for(var _0x22de60=0x0;_0x22de60<_0x194b4b[_0xcbbb('0x75')]['ids']['length'];_0x22de60+=0x1){socket[_0xcbbb('0x76')](_0xcbbb('0x77'),{'UserId':Number(_0x194b4b[_0xcbbb('0x75')][_0xcbbb('0x73')][_0x22de60]),'VoicePrefixId':Number(_0x194b4b['params']['id'])});}return _0x264c34;});}})[_0xcbbb('0x28')](respondWithResult(_0x3e401d,null))[_0xcbbb('0x4b')](handleError(_0x3e401d,null));};exports[_0xcbbb('0x78')]=function(_0x349674,_0x42a9d3,_0x5706e6){return db['VoicePrefix'][_0xcbbb('0x4e')]({'where':{'id':_0x349674[_0xcbbb('0x4d')]['id']}})[_0xcbbb('0x28')](handleEntityNotFound(_0x42a9d3,null))[_0xcbbb('0x28')](function(_0x14eaec){if(_0x14eaec){return _0x14eaec[_0xcbbb('0x78')](_0x349674['query'][_0xcbbb('0x73')])[_0xcbbb('0x28')](function(){if(_[_0xcbbb('0x79')](_0x349674[_0xcbbb('0x38')][_0xcbbb('0x73')])){for(var _0x2b1277=0x0;_0x2b1277<_0x349674[_0xcbbb('0x38')]['ids']['length'];_0x2b1277+=0x1){socket[_0xcbbb('0x76')]('userVoicePrefix:remove',{'UserId':Number(_0x349674['query'][_0xcbbb('0x73')][_0x2b1277]),'VoicePrefixId':Number(_0x349674['params']['id'])});}}else{socket['emit']('userVoicePrefix:remove',{'UserId':Number(_0x349674[_0xcbbb('0x38')]['ids']),'VoicePrefixId':Number(_0x349674[_0xcbbb('0x4d')]['id'])});}});}})['then'](respondWithStatusCode(_0x42a9d3,null))['catch'](handleError(_0x42a9d3,null));};exports['getAgents']=function(_0x4de2dd,_0x1c9dd2,_0x14c60b){var _0x56b09b={};var _0x4bb903={};var _0x130f91;var _0x1bffe9;return db['VoicePrefix'][_0xcbbb('0x7a')]({'where':{'id':_0x4de2dd[_0xcbbb('0x4d')]['id']}})[_0xcbbb('0x28')](handleEntityNotFound(_0x1c9dd2,null))[_0xcbbb('0x28')](function(_0x24b949){if(_0x24b949){_0x130f91=_0x24b949;_0x4bb903[_0xcbbb('0x37')]=_[_0xcbbb('0x39')](db['User'][_0xcbbb('0x33')]);_0x4bb903[_0xcbbb('0x38')]=_['keys'](_0x4de2dd[_0xcbbb('0x38')]);_0x4bb903[_0xcbbb('0x42')]=_[_0xcbbb('0x3b')](_0x4bb903[_0xcbbb('0x37')],_0x4bb903[_0xcbbb('0x38')]);_0x56b09b[_0xcbbb('0x3a')]=_['intersection'](_0x4bb903['model'],qs[_0xcbbb('0x3c')](_0x4de2dd[_0xcbbb('0x38')][_0xcbbb('0x3c')]));_0x56b09b[_0xcbbb('0x3a')]=_0x56b09b[_0xcbbb('0x3a')]['length']?_0x56b09b[_0xcbbb('0x3a')]:_0x4bb903[_0xcbbb('0x37')];_0x56b09b[_0xcbbb('0x3f')]=qs[_0xcbbb('0x40')](_0x4de2dd[_0xcbbb('0x38')][_0xcbbb('0x40')]);_0x56b09b[_0xcbbb('0x41')]=qs[_0xcbbb('0x42')](_[_0xcbbb('0x7b')](_0x4de2dd[_0xcbbb('0x38')],_0x4bb903[_0xcbbb('0x42')]));if(_0x4de2dd['query']['filter']){_0x56b09b[_0xcbbb('0x41')]=_[_0xcbbb('0x44')](_0x56b09b[_0xcbbb('0x41')],{'$or':_[_0xcbbb('0x32')](_0x56b09b[_0xcbbb('0x3a')],function(_0x4a964b){var _0x1d7b6b={};_0x1d7b6b[_0x4a964b]={'$like':'%'+_0x4de2dd[_0xcbbb('0x38')]['filter']+'%'};return _0x1d7b6b;})});}_0x56b09b=_['merge']({},_0x56b09b,_0x4de2dd[_0xcbbb('0x45')]);return _0x130f91['getAgents'](_0x56b09b);}})[_0xcbbb('0x28')](function(_0x1a5dd3){if(_0x1a5dd3){_0x1bffe9=_0x1a5dd3[_0xcbbb('0x3d')];if(!_0x4de2dd[_0xcbbb('0x38')]['hasOwnProperty']('nolimit')){_0x56b09b[_0xcbbb('0x22')]=qs[_0xcbbb('0x22')](_0x4de2dd['query'][_0xcbbb('0x22')]);_0x56b09b[_0xcbbb('0x21')]=qs[_0xcbbb('0x21')](_0x4de2dd[_0xcbbb('0x38')][_0xcbbb('0x21')]);}return _0x130f91[_0xcbbb('0x7c')](_0x56b09b);}})[_0xcbbb('0x28')](function(_0x49f482){if(_0x49f482){return _0x49f482?{'count':_0x1bffe9,'rows':_0x49f482}:null;}})[_0xcbbb('0x28')](respondWithResult(_0x1c9dd2,null))[_0xcbbb('0x4b')](handleError(_0x1c9dd2,null));};exports['getTeams']=function(_0x10667e,_0x549d6c,_0x7a604f){var _0x10f932={};var _0x736484={};var _0x369b6f;var _0x4dc485;return db[_0xcbbb('0x46')][_0xcbbb('0x7a')]({'where':{'id':_0x10667e[_0xcbbb('0x4d')]['id']}})[_0xcbbb('0x28')](handleEntityNotFound(_0x549d6c,null))[_0xcbbb('0x28')](function(_0x4a5a59){if(_0x4a5a59){_0x369b6f=_0x4a5a59;_0x736484['model']=_[_0xcbbb('0x39')](db[_0xcbbb('0x7d')][_0xcbbb('0x33')]);_0x736484[_0xcbbb('0x38')]=_[_0xcbbb('0x39')](_0x10667e['query']);_0x736484['filters']=_[_0xcbbb('0x3b')](_0x736484[_0xcbbb('0x37')],_0x736484[_0xcbbb('0x38')]);_0x10f932[_0xcbbb('0x3a')]=_[_0xcbbb('0x3b')](_0x736484['model'],qs[_0xcbbb('0x3c')](_0x10667e[_0xcbbb('0x38')][_0xcbbb('0x3c')]));_0x10f932['attributes']=_0x10f932[_0xcbbb('0x3a')][_0xcbbb('0x3d')]?_0x10f932[_0xcbbb('0x3a')]:_0x736484[_0xcbbb('0x37')];_0x10f932[_0xcbbb('0x3f')]=qs[_0xcbbb('0x40')](_0x10667e[_0xcbbb('0x38')][_0xcbbb('0x40')]);_0x10f932['where']=qs[_0xcbbb('0x42')](_['pick'](_0x10667e['query'],_0x736484['filters']));if(_0x10667e[_0xcbbb('0x38')]['filter']){_0x10f932[_0xcbbb('0x41')]=_[_0xcbbb('0x44')](_0x10f932['where'],{'$or':_[_0xcbbb('0x32')](_0x10f932[_0xcbbb('0x3a')],function(_0x4bf0b3){var _0x4314d3={};_0x4314d3[_0x4bf0b3]={'$like':'%'+_0x10667e[_0xcbbb('0x38')][_0xcbbb('0x43')]+'%'};return _0x4314d3;})});}_0x10f932=_['merge']({},_0x10f932,_0x10667e[_0xcbbb('0x45')]);return _0x369b6f[_0xcbbb('0x7e')](_0x10f932);}})[_0xcbbb('0x28')](function(_0x2da472){if(_0x2da472){_0x4dc485=_0x2da472[_0xcbbb('0x3d')];if(!_0x10667e[_0xcbbb('0x38')][_0xcbbb('0x7f')](_0xcbbb('0x3e'))){_0x10f932[_0xcbbb('0x22')]=qs['limit'](_0x10667e[_0xcbbb('0x38')][_0xcbbb('0x22')]);_0x10f932[_0xcbbb('0x21')]=qs['offset'](_0x10667e['query'][_0xcbbb('0x21')]);}return _0x369b6f['getTeams'](_0x10f932);}})[_0xcbbb('0x28')](function(_0x198899){if(_0x198899){return _0x198899?{'count':_0x4dc485,'rows':_0x198899}:null;}})['then'](respondWithResult(_0x549d6c,null))[_0xcbbb('0x4b')](handleError(_0x549d6c,null));};exports[_0xcbbb('0x80')]=function(_0x59d833,_0x39951f,_0x283bc8){var _0x2754d1=_0x59d833[_0xcbbb('0x75')][_0xcbbb('0x73')];var _0x458b66;return db['Team'][_0xcbbb('0x49')]({'where':{'id':_0x2754d1},'attributes':['id'],'include':[{'model':db['User'],'as':_0xcbbb('0x81'),'attributes':['id',_0xcbbb('0x30'),_0xcbbb('0x82'),'voicePause',_0xcbbb('0x83')],'raw':!![]}]})['then'](function(_0x32993d){if(_0x32993d){_0x458b66=_0x32993d;var _0x962f3f=_[_0xcbbb('0x84')](_0x32993d,function(_0x55ca6b){var _0x287b25=_0x55ca6b['get']({'plain':!![]});return _0x287b25[_0xcbbb('0x81')];});return db[_0xcbbb('0x46')][_0xcbbb('0x4e')]({'where':{'id':_0x59d833[_0xcbbb('0x4d')]['id']}})['then'](function(_0x16991b){return db['sequelize'][_0xcbbb('0x52')](function(_0xd01dff){return _0x16991b[_0xcbbb('0x80')](_0x2754d1,{'transaction':_0xd01dff})[_0xcbbb('0x28')](function(){return BPromise[_0xcbbb('0x85')](_0x458b66,function(_0x3ab011){return db[_0xcbbb('0x86')]['upsert']({'TeamId':_0x3ab011['id'],'VoicePrefixId':_0x59d833[_0xcbbb('0x4d')]['id']},{'transaction':_0xd01dff});});})[_0xcbbb('0x28')](function(){return BPromise[_0xcbbb('0x85')](_0x962f3f,function(_0x354314){return db['UserVoicePrefix'][_0xcbbb('0x87')]({'where':{'UserId':_0x354314['id'],'VoicePrefixId':_0x59d833[_0xcbbb('0x4d')]['id']},'transaction':_0xd01dff});});})[_0xcbbb('0x28')](function(){_0x962f3f[_0xcbbb('0x88')](function(_0x3fc8da){socket[_0xcbbb('0x76')]('userVoicePrefix:save',{'UserId':_0x3fc8da['id'],'VoicePrefixId':_0x16991b['id']});});});});});}})[_0xcbbb('0x28')](respondWithStatusCode(_0x39951f,null))[_0xcbbb('0x4b')](handleError(_0x39951f,null));};exports[_0xcbbb('0x89')]=function(_0x23bda8,_0x233c44,_0x26545e){return db[_0xcbbb('0x7d')][_0xcbbb('0x49')]({'where':{'id':_0x23bda8['query'][_0xcbbb('0x73')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xcbbb('0x81'),'attributes':['id'],'raw':!![]}]})[_0xcbbb('0x28')](handleEntityNotFound(_0x233c44,null))[_0xcbbb('0x28')](function(_0x510bc9){var _0x1ce1c4=_[_0xcbbb('0x32')](_0x510bc9,'id');var _0x7fc4ea=[];var _0xde4f2b=[];var _0xabe61=squel['select']();_0xabe61[_0xcbbb('0x8a')]('tq.TeamId')[_0xcbbb('0x8b')]('team_has_voice_prefixes','tq')[_0xcbbb('0x8c')](_0xcbbb('0x8d'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xcbbb('0x41')](_0xcbbb('0x8e'),_0x23bda8[_0xcbbb('0x4d')]['id']);for(var _0x3a3e73=0x0;_0x3a3e73<_0x510bc9[_0xcbbb('0x3d')];_0x3a3e73+=0x1){let _0x517af0=_0x510bc9[_0x3a3e73];for(var _0x4312c3=0x0;_0x4312c3<_0x517af0[_0xcbbb('0x81')][_0xcbbb('0x3d')];_0x4312c3+=0x1){let _0x1b34ac=_0x517af0[_0xcbbb('0x81')][_0x4312c3];var _0x402d10=_0xabe61[_0xcbbb('0x8f')]();_0x402d10[_0xcbbb('0x41')]('ut.UserId\x20=\x20?',_0x1b34ac['id']);_0xde4f2b['push'](db[_0xcbbb('0x51')]['query'](_0x402d10[_0xcbbb('0x90')](),{'type':db[_0xcbbb('0x51')][_0xcbbb('0x91')][_0xcbbb('0x92')]})[_0xcbbb('0x28')](function(_0x2129d8){if(_0x2129d8[_0xcbbb('0x3d')]===0x1){return _0x1b34ac['id'];}else{var _0x274e33=_[_0xcbbb('0x93')](_[_0xcbbb('0x32')](_0x2129d8,_0xcbbb('0x94')),function(_0x1c8981){return _[_0xcbbb('0x95')](_0x1ce1c4,_0x1c8981);});if(_0x274e33){return _0x1b34ac['id'];}}}));}}return BPromise[_0xcbbb('0x96')](_0xde4f2b)[_0xcbbb('0x28')](function(_0x4bcb5d){_0x7fc4ea=_(_0x7fc4ea)[_0xcbbb('0x97')](_0x4bcb5d)[_0xcbbb('0x98')]()[_0xcbbb('0x99')]();return db[_0xcbbb('0x46')]['find']({'where':{'id':_0x23bda8[_0xcbbb('0x4d')]['id']}})[_0xcbbb('0x28')](function(_0x40fc06){return db[_0xcbbb('0x51')][_0xcbbb('0x52')](function(_0x357810){return _0x40fc06['removeTeams'](_0x23bda8[_0xcbbb('0x38')][_0xcbbb('0x73')],{'transaction':_0x357810})['then'](function(){if(!_[_0xcbbb('0x9a')](_0x7fc4ea)){return _0x40fc06[_0xcbbb('0x78')](_0x7fc4ea,{'transaction':_0x357810});}})[_0xcbbb('0x28')](function(){_0x7fc4ea[_0xcbbb('0x88')](function(_0x49e6e1){socket['emit'](_0xcbbb('0x9b'),{'UserId':_0x49e6e1,'VoicePrefixId':_0x40fc06['id']});});});});});});})[_0xcbbb('0x28')](respondWithStatusCode(_0x233c44,null))[_0xcbbb('0x4b')](handleError(_0x233c44,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index fc8a038..39dd7ec 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 _0xa77c=['VoicePrefix','save','update','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x8c8176,_0x5360a1){var _0x4dc47b=function(_0x1a7f65){while(--_0x1a7f65){_0x8c8176['push'](_0x8c8176['shift']());}};_0x4dc47b(++_0x5360a1);}(_0xa77c,0x19c));var _0xca77=function(_0x27520b,_0x2cffba){_0x27520b=_0x27520b-0x0;var _0x473104=_0xa77c[_0x27520b];return _0x473104;};'use strict';var EventEmitter=require(_0xca77('0x0'));var VoicePrefix=require(_0xca77('0x1'))['db'][_0xca77('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xca77('0x3'),'afterUpdate':_0xca77('0x4'),'afterDestroy':_0xca77('0x5')};function emitEvent(_0x4b25b5){return function(_0x21b595,_0x3f4023,_0x1c3b36){VoicePrefixEvents[_0xca77('0x6')](_0x4b25b5+':'+_0x21b595['id'],_0x21b595);VoicePrefixEvents[_0xca77('0x6')](_0x4b25b5,_0x21b595);_0x1c3b36(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0xca77('0x7')](e,emitEvent(event));}}module[_0xca77('0x8')]=VoicePrefixEvents; \ No newline at end of file +var _0x0f3d=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x4c3473,_0x5b3458){var _0x263098=function(_0x6436aa){while(--_0x6436aa){_0x4c3473['push'](_0x4c3473['shift']());}};_0x263098(++_0x5b3458);}(_0x0f3d,0x11f));var _0xd0f3=function(_0x166e8f,_0x571180){_0x166e8f=_0x166e8f-0x0;var _0x55e8f9=_0x0f3d[_0x166e8f];return _0x55e8f9;};'use strict';var EventEmitter=require(_0xd0f3('0x0'));var VoicePrefix=require(_0xd0f3('0x1'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xd0f3('0x2')](0x0);var events={'afterCreate':_0xd0f3('0x3'),'afterUpdate':_0xd0f3('0x4'),'afterDestroy':_0xd0f3('0x5')};function emitEvent(_0xb8502d){return function(_0x3d2a64,_0x8f820d,_0x8787f9){VoicePrefixEvents[_0xd0f3('0x6')](_0xb8502d+':'+_0x3d2a64['id'],_0x3d2a64);VoicePrefixEvents[_0xd0f3('0x6')](_0xb8502d,_0x3d2a64);_0x8787f9(null);};}for(var e in events){if(events[_0xd0f3('0x7')](e)){var event=events[e];VoicePrefix[_0xd0f3('0x8')](e,emitEvent(event));}}module[_0xd0f3('0x9')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 7588f44..bb42bc4 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 _0xe158=['voice_prefixes','lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./voicePrefix.attributes','exports','VoicePrefix'];(function(_0x2b9236,_0x2d42c7){var _0x17e247=function(_0x2fb533){while(--_0x2fb533){_0x2b9236['push'](_0x2b9236['shift']());}};_0x17e247(++_0x2d42c7);}(_0xe158,0xb1));var _0x8e15=function(_0x4067ac,_0x363603){_0x4067ac=_0x4067ac-0x0;var _0x53d74d=_0xe158[_0x4067ac];return _0x53d74d;};'use strict';var _=require(_0x8e15('0x0'));var util=require('util');var logger=require(_0x8e15('0x1'))(_0x8e15('0x2'));var moment=require('moment');var BPromise=require(_0x8e15('0x3'));var rp=require(_0x8e15('0x4'));var fs=require('fs');var path=require(_0x8e15('0x5'));var rimraf=require('rimraf');var config=require(_0x8e15('0x6'));var attributes=require(_0x8e15('0x7'));module[_0x8e15('0x8')]=function(_0x35204a,_0x163170){return _0x35204a['define'](_0x8e15('0x9'),attributes,{'tableName':_0x8e15('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x78e3=['voice_prefixes','lodash','util','api','moment','bluebird','rimraf','./voicePrefix.attributes','exports','VoicePrefix'];(function(_0x97e28c,_0xa64785){var _0x4c616c=function(_0x40da56){while(--_0x40da56){_0x97e28c['push'](_0x97e28c['shift']());}};_0x4c616c(++_0xa64785);}(_0x78e3,0x97));var _0x378e=function(_0x5d1cbb,_0x250758){_0x5d1cbb=_0x5d1cbb-0x0;var _0x4e5324=_0x78e3[_0x5d1cbb];return _0x4e5324;};'use strict';var _=require(_0x378e('0x0'));var util=require(_0x378e('0x1'));var logger=require('../../config/logger')(_0x378e('0x2'));var moment=require(_0x378e('0x3'));var BPromise=require(_0x378e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x378e('0x5'));var config=require('../../config/environment');var attributes=require(_0x378e('0x6'));module[_0x378e('0x7')]=function(_0x2d14fd,_0x5ad879){return _0x2d14fd['define'](_0x378e('0x8'),attributes,{'tableName':_0x378e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index 64a2764..55bcbfb 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 _0x63d4=['../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','register','request','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x63d4,0x117));var _0x463d=function(_0x51dbdb,_0x23f064){_0x51dbdb=_0x51dbdb-0x0;var _0x4394de=_0x63d4[_0x51dbdb];return _0x4394de;};'use strict';var _=require(_0x463d('0x0'));var util=require(_0x463d('0x1'));var moment=require(_0x463d('0x2'));var BPromise=require('bluebird');var rs=require(_0x463d('0x3'));var fs=require('fs');var Redis=require(_0x463d('0x4'));var db=require(_0x463d('0x5'))['db'];var utils=require(_0x463d('0x6'));var logger=require(_0x463d('0x7'))('rpc');var config=require(_0x463d('0x8'));var jayson=require(_0x463d('0x9'));var client=jayson['client'][_0x463d('0xa')]({'port':0x232a});config[_0x463d('0xb')]=_[_0x463d('0xc')](config[_0x463d('0xb')],{'host':_0x463d('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x463d('0xb')]));require('./voicePrefix.socket')[_0x463d('0xe')](socket);function respondWithRpcPromise(_0x2d714b,_0x1f5d4a,_0xecad46){return new BPromise(function(_0x4c7bcc,_0x4c7afd){return client[_0x463d('0xf')](_0x2d714b,_0xecad46)['then'](function(_0x39d97c){logger[_0x463d('0x10')](_0x463d('0x11'),_0x1f5d4a,_0x463d('0x12'));logger[_0x463d('0x13')](_0x463d('0x14'),_0x1f5d4a,_0x463d('0x12'),JSON['stringify'](_0x39d97c));if(_0x39d97c[_0x463d('0x15')]){if(_0x39d97c[_0x463d('0x15')][_0x463d('0x16')]===0x1f4){logger['error'](_0x463d('0x11'),_0x1f5d4a,_0x39d97c[_0x463d('0x15')][_0x463d('0x17')]);return _0x4c7afd(_0x39d97c[_0x463d('0x15')][_0x463d('0x17')]);}logger[_0x463d('0x15')]('VoicePrefix,\x20%s,\x20%s',_0x1f5d4a,_0x39d97c[_0x463d('0x15')]['message']);return _0x4c7bcc(_0x39d97c[_0x463d('0x15')][_0x463d('0x17')]);}else{logger[_0x463d('0x10')](_0x463d('0x11'),_0x1f5d4a,_0x463d('0x12'));_0x4c7bcc(_0x39d97c[_0x463d('0x18')]['message']);}})[_0x463d('0x19')](function(_0x1091ac){logger[_0x463d('0x15')](_0x463d('0x11'),_0x1f5d4a,_0x1091ac);_0x4c7afd(_0x1091ac);});});} \ No newline at end of file +var _0x29b7=['info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./voicePrefix.socket','register','request','then','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x2c4d68,_0x2e0862){var _0x10e25e=function(_0x33d539){while(--_0x33d539){_0x2c4d68['push'](_0x2c4d68['shift']());}};_0x10e25e(++_0x2e0862);}(_0x29b7,0x17d));var _0x729b=function(_0xae3d10,_0x46bb25){_0xae3d10=_0xae3d10-0x0;var _0x2e0727=_0x29b7[_0xae3d10];return _0x2e0727;};'use strict';var _=require('lodash');var util=require(_0x729b('0x0'));var moment=require(_0x729b('0x1'));var BPromise=require(_0x729b('0x2'));var rs=require(_0x729b('0x3'));var fs=require('fs');var Redis=require(_0x729b('0x4'));var db=require(_0x729b('0x5'))['db'];var utils=require(_0x729b('0x6'));var logger=require(_0x729b('0x7'))('rpc');var config=require(_0x729b('0x8'));var jayson=require(_0x729b('0x9'));var client=jayson['client'][_0x729b('0xa')]({'port':0x232a});config[_0x729b('0xb')]=_[_0x729b('0xc')](config[_0x729b('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x729b('0xd'))(new Redis(config[_0x729b('0xb')]));require(_0x729b('0xe'))[_0x729b('0xf')](socket);function respondWithRpcPromise(_0x91648d,_0x416342,_0x491541){return new BPromise(function(_0x16da45,_0x4bfdae){return client[_0x729b('0x10')](_0x91648d,_0x491541)[_0x729b('0x11')](function(_0xcc899d){logger['info'](_0x729b('0x12'),_0x416342,_0x729b('0x13'));logger[_0x729b('0x14')](_0x729b('0x15'),_0x416342,_0x729b('0x13'),JSON['stringify'](_0xcc899d));if(_0xcc899d[_0x729b('0x16')]){if(_0xcc899d[_0x729b('0x16')]['code']===0x1f4){logger[_0x729b('0x16')](_0x729b('0x12'),_0x416342,_0xcc899d[_0x729b('0x16')][_0x729b('0x17')]);return _0x4bfdae(_0xcc899d[_0x729b('0x16')]['message']);}logger['error'](_0x729b('0x12'),_0x416342,_0xcc899d[_0x729b('0x16')][_0x729b('0x17')]);return _0x16da45(_0xcc899d[_0x729b('0x16')]['message']);}else{logger[_0x729b('0x18')](_0x729b('0x12'),_0x416342,'request\x20sent');_0x16da45(_0xcc899d[_0x729b('0x19')][_0x729b('0x17')]);}})[_0x729b('0x1a')](function(_0x2b3a82){logger[_0x729b('0x16')]('VoicePrefix,\x20%s,\x20%s',_0x416342,_0x2b3a82);_0x4bfdae(_0x2b3a82);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index af6e991..7f27858 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 _0xd71d=['update','emit','removeListener','register','length','./voicePrefix.events','save','remove'];(function(_0x320b8e,_0x1da3fe){var _0x55a10a=function(_0x148a56){while(--_0x148a56){_0x320b8e['push'](_0x320b8e['shift']());}};_0x55a10a(++_0x1da3fe);}(_0xd71d,0x1a5));var _0xdd71=function(_0x1e500e,_0x2c9d74){_0x1e500e=_0x1e500e-0x0;var _0x10dc5e=_0xd71d[_0x1e500e];return _0x10dc5e;};'use strict';var VoicePrefixEvents=require(_0xdd71('0x0'));var events=[_0xdd71('0x1'),_0xdd71('0x2'),_0xdd71('0x3')];function createListener(_0x375b72,_0x5916bc){return function(_0x419635){_0x5916bc[_0xdd71('0x4')](_0x375b72,_0x419635);};}function removeListener(_0x19415e,_0x598d89){return function(){VoicePrefixEvents[_0xdd71('0x5')](_0x19415e,_0x598d89);};}exports[_0xdd71('0x6')]=function(_0x3a06df){for(var _0x48fa17=0x0,_0x12d8a7=events[_0xdd71('0x7')];_0x48fa17<_0x12d8a7;_0x48fa17++){var _0x2b3698=events[_0x48fa17];var _0x147f9e=createListener('voicePrefix:'+_0x2b3698,_0x3a06df);VoicePrefixEvents['on'](_0x2b3698,_0x147f9e);}}; \ No newline at end of file +var _0xa7b5=['length','voicePrefix:','./voicePrefix.events','save','remove','update','emit','register'];(function(_0x1d2222,_0x1fb1e8){var _0xf9d7da=function(_0x550844){while(--_0x550844){_0x1d2222['push'](_0x1d2222['shift']());}};_0xf9d7da(++_0x1fb1e8);}(_0xa7b5,0x162));var _0x5a7b=function(_0x1a482d,_0x177348){_0x1a482d=_0x1a482d-0x0;var _0x1630ba=_0xa7b5[_0x1a482d];return _0x1630ba;};'use strict';var VoicePrefixEvents=require(_0x5a7b('0x0'));var events=[_0x5a7b('0x1'),_0x5a7b('0x2'),_0x5a7b('0x3')];function createListener(_0x2ca65f,_0x5026f5){return function(_0x1a25e1){_0x5026f5[_0x5a7b('0x4')](_0x2ca65f,_0x1a25e1);};}function removeListener(_0x13085a,_0x56b82d){return function(){VoicePrefixEvents['removeListener'](_0x13085a,_0x56b82d);};}exports[_0x5a7b('0x5')]=function(_0x204212){for(var _0x4899da=0x0,_0x38dac6=events[_0x5a7b('0x6')];_0x4899da<_0x38dac6;_0x4899da++){var _0x390a68=events[_0x4899da];var _0x265597=createListener(_0x5a7b('0x7')+_0x390a68,_0x204212);VoicePrefixEvents['on'](_0x390a68,_0x265597);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 12b9d3b..96a1760 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(_0x2566a0,_0x10a41d){var _0x1ba3fc=function(_0x1f2498){while(--_0x1f2498){_0x2566a0['push'](_0x2566a0['shift']());}};_0x1ba3fc(++_0x10a41d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file +var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x10e0ab,_0x29c3f9){var _0xce472b=function(_0x4d0005){while(--_0x4d0005){_0x10e0ab['push'](_0x10e0ab['shift']());}};_0xce472b(++_0x29c3f9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 65d2433..c9dbf33 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 _0x5d3c=['STRING','yes','once','TEXT','periodic_announce','split','joinempty','join','leavewhenempty','BOOLEAN','acw','wrapuptime','preview','progressive','power','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Originate\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)','07:00-22:00,*,*,*','never','onlyIfOpen','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#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)','mandatoryDispositionPauseId','sequelize','exports','name','ENUM','inbound','outbound','default','ringall','leastrecent','fewestcalls','random','rrmemory','linear','wrandom','rrordered','setDataValue','strategy','getDataValue','type','dialMethod','booked','roundrobin','includes','INTEGER'];(function(_0x51c9d2,_0x2364a8){var _0x2af9db=function(_0x442da3){while(--_0x442da3){_0x51c9d2['push'](_0x51c9d2['shift']());}};_0x2af9db(++_0x2364a8);}(_0x5d3c,0x1c8));var _0xc5d3=function(_0x56fe68,_0x868a48){_0x56fe68=_0x56fe68-0x0;var _0x368d2d=_0x5d3c[_0x56fe68];return _0x368d2d;};'use strict';var Sequelize=require(_0xc5d3('0x0'));module[_0xc5d3('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc5d3('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xc5d3('0x3')](_0xc5d3('0x4'),_0xc5d3('0x5')),'allowNull':![],'defaultValue':_0xc5d3('0x4')},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':_0xc5d3('0x6')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0xc5d3('0x3')]('rr',_0xc5d3('0x7'),_0xc5d3('0x8'),_0xc5d3('0x9'),_0xc5d3('0xa'),_0xc5d3('0xb'),_0xc5d3('0xc'),_0xc5d3('0xd'),_0xc5d3('0xe')),'allowNull':![],'defaultValue':_0xc5d3('0x7'),'set':function(_0x818211){this[_0xc5d3('0xf')](_0xc5d3('0x10'),_0x818211?_0x818211:_0xc5d3('0xb'));},'get':function(){var _0x95708=this[_0xc5d3('0x11')](_0xc5d3('0x12'));var _0x3895a6=this[_0xc5d3('0x11')](_0xc5d3('0x13'));var _0x4715bc=this[_0xc5d3('0x11')](_0xc5d3('0x10'));if(_0x95708===_0xc5d3('0x5')){if(_0x3895a6==='preview'){return null;}if(_0x3895a6===_0xc5d3('0x14')&&!['rrmemory',_0xc5d3('0x15')][_0xc5d3('0x16')](_0x4715bc)){this[_0xc5d3('0xf')](_0xc5d3('0x10'),_0xc5d3('0xb'));}}return _0x4715bc;}},'servicelevel':{'type':Sequelize[_0xc5d3('0x17')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xc5d3('0x18')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xc5d3('0x17')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xc5d3('0x17')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xc5d3('0x18')]},'weight':{'type':Sequelize[_0xc5d3('0x17')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xc5d3('0x17')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM'](_0xc5d3('0x19'),'no'),'defaultValue':_0xc5d3('0x19')},'autopause':{'type':Sequelize[_0xc5d3('0x3')](_0xc5d3('0x19'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xc5d3('0x17')](0xb)},'autopausebusy':{'type':Sequelize[_0xc5d3('0x3')](_0xc5d3('0x19'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xc5d3('0x17')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xc5d3('0x3')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xc5d3('0x3')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0xc5d3('0x19'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xc5d3('0x3')](_0xc5d3('0x19'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xc5d3('0x18')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xc5d3('0x18')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xc5d3('0x17')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xc5d3('0x3')](_0xc5d3('0x19'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0xc5d3('0x19'),'no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize[_0xc5d3('0x3')](_0xc5d3('0x19'),'no',_0xc5d3('0x1a')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xc5d3('0x18')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0xc5d3('0x19'),'no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0xc5d3('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize[_0xc5d3('0x18')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xc5d3('0x18')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xc5d3('0x18')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xc5d3('0x18')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xc5d3('0x18')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xc5d3('0x18')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xc5d3('0x18')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize[_0xc5d3('0x18')]},'periodic_announce':{'type':Sequelize[_0xc5d3('0x1b')],'set':function(_0x144ecb){this[_0xc5d3('0xf')](_0xc5d3('0x1c'),_0x144ecb?_0x144ecb['join'](','):[]);},'get':function(){return this[_0xc5d3('0x11')](_0xc5d3('0x1c'))?this[_0xc5d3('0x11')]('periodic_announce')[_0xc5d3('0x1d')](','):[];}},'joinempty':{'type':Sequelize[_0xc5d3('0x18')],'defaultValue':_0xc5d3('0x19'),'set':function(_0x4b77f3){this['setDataValue'](_0xc5d3('0x1e'),_0x4b77f3?_0x4b77f3[_0xc5d3('0x1f')](','):undefined);},'get':function(){return this[_0xc5d3('0x11')](_0xc5d3('0x1e'))?this['getDataValue'](_0xc5d3('0x1e'))[_0xc5d3('0x1d')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xc5d3('0x18')],'defaultValue':'no','set':function(_0x5afe4b){this[_0xc5d3('0xf')](_0xc5d3('0x20'),_0x5afe4b?_0x5afe4b[_0xc5d3('0x1f')](','):undefined);},'get':function(){return this[_0xc5d3('0x11')](_0xc5d3('0x20'))?this[_0xc5d3('0x11')]('leavewhenempty')[_0xc5d3('0x1d')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xc5d3('0x3')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xc5d3('0x3')](_0xc5d3('0x19'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xc5d3('0x17')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM'](_0xc5d3('0x19'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xc5d3('0x18')]},'description':{'type':Sequelize[_0xc5d3('0x18')]},'acw':{'type':Sequelize[_0xc5d3('0x21')],'defaultValue':0x0,'set':function(_0x3e2179){this[_0xc5d3('0xf')](_0xc5d3('0x22'),_0x3e2179);if(_0x3e2179){if(this['getDataValue'](_0xc5d3('0x23'))<0x2){this[_0xc5d3('0xf')](_0xc5d3('0x23'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xc5d3('0x17')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xc5d3('0x21')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize[_0xc5d3('0x3')](_0xc5d3('0x24'),_0xc5d3('0x25'),_0xc5d3('0x26'),'predictive',_0xc5d3('0x14')),'defaultValue':'progressive','comment':_0xc5d3('0x27')},'dialLimitChannel':{'type':Sequelize[_0xc5d3('0x17')](0x4)[_0xc5d3('0x28')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize[_0xc5d3('0x17')](0x4)[_0xc5d3('0x28')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xc5d3('0x29')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0xc5d3('0x28')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xc5d3('0x2a')},'dialPredictiveOptimization':{'type':Sequelize[_0xc5d3('0x3')](_0xc5d3('0x2b'),'dropRate'),'defaultValue':'dropRate','comment':_0xc5d3('0x2c')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0xc5d3('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xc5d3('0x2d')},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)[_0xc5d3('0x28')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0xc5d3('0x18')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xc5d3('0x28')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc5d3('0x2e')},'dialQueueOptions':{'type':Sequelize[_0xc5d3('0x18')],'defaultValue':'tTxX','comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0xc5d3('0x17')](0x3)[_0xc5d3('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize[_0xc5d3('0x18')],'comment':_0xc5d3('0x2f')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xc5d3('0x17')](0x5)[_0xc5d3('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc5d3('0x30')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xc5d3('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc5d3('0x31')},'dialBusyRetryFrequency':{'type':Sequelize[_0xc5d3('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc5d3('0x32')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xc5d3('0x17')](0x3)[_0xc5d3('0x28')],'defaultValue':0x3,'comment':_0xc5d3('0x33')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xc5d3('0x17')](0x5)[_0xc5d3('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc5d3('0x34')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xc5d3('0x28')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xc5d3('0x35')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xc5d3('0x3')]('always',_0xc5d3('0x36'),_0xc5d3('0x37')),'defaultValue':_0xc5d3('0x38')},'dialAMDActive':{'type':Sequelize[_0xc5d3('0x21')],'defaultValue':0x0,'comment':_0xc5d3('0x39')},'dialAMDInitialSilence':{'type':Sequelize[_0xc5d3('0x17')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xc5d3('0x3a')},'dialAMDGreeting':{'type':Sequelize[_0xc5d3('0x17')](0x9)[_0xc5d3('0x28')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xc5d3('0x3b')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xc5d3('0x17')](0x9)[_0xc5d3('0x28')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xc5d3('0x3c')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0xc5d3('0x28')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xc5d3('0x3d')},'dialAMDMinWordLength':{'type':Sequelize[_0xc5d3('0x17')](0x9)[_0xc5d3('0x28')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xc5d3('0x3e')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xc5d3('0x17')](0x9)[_0xc5d3('0x28')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xc5d3('0x3f')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xc5d3('0x17')](0x9)[_0xc5d3('0x28')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xc5d3('0x40')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xc5d3('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0xc5d3('0x17')](0x9)[_0xc5d3('0x28')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0xc5d3('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xc5d3('0x41')},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xc5d3('0x42')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xc5d3('0x43'),_0xc5d3('0x44')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize[_0xc5d3('0x18')],'comment':_0xc5d3('0x2f')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xc5d3('0x21')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xc5d3('0x21')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xc5d3('0x17')](0x3)[_0xc5d3('0x28')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc5d3('0x45')},'dialCutDigit':{'type':Sequelize[_0xc5d3('0x17')](0x3)[_0xc5d3('0x28')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc5d3('0x46')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xc5d3('0x17')](0x3)[_0xc5d3('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc5d3('0x47')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xc5d3('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc5d3('0x48')},'dialDropMaxRetry':{'type':Sequelize[_0xc5d3('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc5d3('0x49')},'dialDropRetryFrequency':{'type':Sequelize[_0xc5d3('0x17')](0x5)[_0xc5d3('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0xc5d3('0x17')](0x3)[_0xc5d3('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc5d3('0x4a')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xc5d3('0x17')](0x5)[_0xc5d3('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0xc5d3('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc5d3('0x4b')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xc5d3('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc5d3('0x4c')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xc5d3('0x17')](0x3)[_0xc5d3('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc5d3('0x4d')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc5d3('0x4e')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc5d3('0x17')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xc5d3('0x21')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x407954){if(!_0x407954)this[_0xc5d3('0xf')](_0xc5d3('0x4f'),null);this[_0xc5d3('0xf')]('mandatoryDisposition',_0x407954);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xc5d3('0x17')](0x3)[_0xc5d3('0x28')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0xc5d3('0x28')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xc5d3('0x21')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize['INTEGER'](0x3)[_0xc5d3('0x28')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xc5d3('0x21')],'defaultValue':![]}}; \ No newline at end of file +var _0x8773=['BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','progressive','power','predictive','booked','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','never','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','sequelize','exports','ENUM','inbound','default','leastrecent','random','rrmemory','linear','wrandom','rrordered','ringall','setDataValue','strategy','type','getDataValue','preview','roundrobin','INTEGER','STRING','yes','all','join','periodic_announce','split','joinempty','leavewhenempty'];(function(_0x5e08ee,_0x45c038){var _0x3b1dcc=function(_0x533646){while(--_0x533646){_0x5e08ee['push'](_0x5e08ee['shift']());}};_0x3b1dcc(++_0x45c038);}(_0x8773,0x1a7));var _0x3877=function(_0x2c7bff,_0x2e79bb){_0x2c7bff=_0x2c7bff-0x0;var _0x107b8b=_0x8773[_0x2c7bff];return _0x107b8b;};'use strict';var Sequelize=require(_0x3877('0x0'));module[_0x3877('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x3877('0x2')](_0x3877('0x3'),'outbound'),'allowNull':![],'defaultValue':_0x3877('0x3')},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':_0x3877('0x4')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0x3877('0x2')]('rr','ringall',_0x3877('0x5'),'fewestcalls',_0x3877('0x6'),_0x3877('0x7'),_0x3877('0x8'),_0x3877('0x9'),_0x3877('0xa')),'allowNull':![],'defaultValue':_0x3877('0xb'),'set':function(_0x5418e4){this[_0x3877('0xc')](_0x3877('0xd'),_0x5418e4?_0x5418e4:_0x3877('0x7'));},'get':function(){var _0x488019=this['getDataValue'](_0x3877('0xe'));var _0x26d4c2=this[_0x3877('0xf')]('dialMethod');var _0x286752=this[_0x3877('0xf')](_0x3877('0xd'));if(_0x488019==='outbound'){if(_0x26d4c2===_0x3877('0x10')){return null;}if(_0x26d4c2==='booked'&&!['rrmemory',_0x3877('0x11')]['includes'](_0x286752)){this[_0x3877('0xc')](_0x3877('0xd'),_0x3877('0x7'));}}return _0x286752;}},'servicelevel':{'type':Sequelize[_0x3877('0x12')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x3877('0x13')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x3877('0x12')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x3877('0x12')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x3877('0x13')]},'weight':{'type':Sequelize[_0x3877('0x12')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x3877('0x12')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x3877('0x2')](_0x3877('0x14'),'no'),'defaultValue':_0x3877('0x14')},'autopause':{'type':Sequelize[_0x3877('0x2')]('yes','no',_0x3877('0x15')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x3877('0x12')](0xb)},'autopausebusy':{'type':Sequelize[_0x3877('0x2')](_0x3877('0x14'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x3877('0x12')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM'](_0x3877('0x14'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM'](_0x3877('0x14'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x3877('0x2')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x3877('0x2')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x3877('0x12')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x3877('0x12')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x3877('0x2')]('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x3877('0x2')](_0x3877('0x14'),'no'),'defaultValue':_0x3877('0x14')},'announce_holdtime':{'type':Sequelize['ENUM'](_0x3877('0x14'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x3877('0x13')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x3877('0x2')](_0x3877('0x14'),'no')},'announce_position_limit':{'type':Sequelize[_0x3877('0x12')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x3877('0x2')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x3877('0x13')]},'queue_youarenext':{'type':Sequelize[_0x3877('0x13')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x3877('0x13')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x3877('0x13')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x3877('0x13')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x3877('0x13')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x3877('0x13')],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x3877('0x13')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x3877('0x13')]},'queue_quantity1':{'type':Sequelize[_0x3877('0x13')]},'queue_quantity2':{'type':Sequelize[_0x3877('0x13')]},'queue_periodic_announce':{'type':Sequelize[_0x3877('0x13')]},'queue_less_than':{'type':Sequelize[_0x3877('0x13')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x6c7e59){this['setDataValue']('periodic_announce',_0x6c7e59?_0x6c7e59[_0x3877('0x16')](','):[]);},'get':function(){return this['getDataValue'](_0x3877('0x17'))?this['getDataValue'](_0x3877('0x17'))[_0x3877('0x18')](','):[];}},'joinempty':{'type':Sequelize[_0x3877('0x13')],'defaultValue':_0x3877('0x14'),'set':function(_0x181fba){this[_0x3877('0xc')](_0x3877('0x19'),_0x181fba?_0x181fba[_0x3877('0x16')](','):undefined);},'get':function(){return this['getDataValue'](_0x3877('0x19'))?this[_0x3877('0xf')](_0x3877('0x19'))[_0x3877('0x18')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x3877('0x13')],'defaultValue':'no','set':function(_0x56ac33){this[_0x3877('0xc')](_0x3877('0x1a'),_0x56ac33?_0x56ac33[_0x3877('0x16')](','):undefined);},'get':function(){return this[_0x3877('0xf')](_0x3877('0x1a'))?this[_0x3877('0xf')]('leavewhenempty')[_0x3877('0x18')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x3877('0x2')](_0x3877('0x14'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x3877('0x2')](_0x3877('0x14'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x3877('0x12')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x3877('0x2')](_0x3877('0x14'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x3877('0x13')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize[_0x3877('0x1b')],'defaultValue':0x0,'set':function(_0x3a5e8c){this[_0x3877('0xc')](_0x3877('0x1c'),_0x3a5e8c);if(_0x3a5e8c){if(this[_0x3877('0xf')](_0x3877('0x1d'))<0x2){this[_0x3877('0xc')](_0x3877('0x1d'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x3877('0x12')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x3877('0x1b')],'defaultValue':0x0,'comment':_0x3877('0x1e')},'dialMethod':{'type':Sequelize[_0x3877('0x2')](_0x3877('0x10'),_0x3877('0x1f'),_0x3877('0x20'),_0x3877('0x21'),_0x3877('0x22')),'defaultValue':'progressive','comment':_0x3877('0x23')},'dialLimitChannel':{'type':Sequelize[_0x3877('0x12')](0x4)[_0x3877('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x3877('0x25')},'dialLimitQueue':{'type':Sequelize[_0x3877('0x12')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0x3877('0x26')](0x2)[_0x3877('0x24')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x3877('0x27')},'dialPredictiveOptimization':{'type':Sequelize[_0x3877('0x2')](_0x3877('0x28'),'dropRate'),'defaultValue':_0x3877('0x29'),'comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x3877('0x2a')},'dialPredictiveInterval':{'type':Sequelize[_0x3877('0x12')](0x3)[_0x3877('0x24')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x3877('0x2b')},'dialOriginateCallerIdName':{'type':Sequelize[_0x3877('0x13')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x3877('0x13')]},'dialOriginateTimeout':{'type':Sequelize[_0x3877('0x12')](0x3)[_0x3877('0x24')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3877('0x2c')},'dialQueueOptions':{'type':Sequelize[_0x3877('0x13')],'defaultValue':'tTxX','comment':_0x3877('0x2d')},'dialQueueTimeout':{'type':Sequelize[_0x3877('0x12')](0x3)[_0x3877('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3877('0x2e')},'dialQueueProject':{'type':Sequelize[_0x3877('0x13')],'comment':_0x3877('0x2f')},'dialCongestionMaxRetry':{'type':Sequelize[_0x3877('0x12')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3877('0x30')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x3877('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3877('0x31')},'dialBusyRetryFrequency':{'type':Sequelize[_0x3877('0x12')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3877('0x32')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x3877('0x24')],'defaultValue':0x3,'comment':_0x3877('0x33')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x3877('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3877('0x34')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x3877('0x35')},'dialTimezone':{'type':Sequelize[_0x3877('0x13')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x3877('0x13')],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize[_0x3877('0x13')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM']('always',_0x3877('0x36'),'onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x3877('0x1b')],'defaultValue':0x0,'comment':_0x3877('0x37')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x3877('0x24')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x3877('0x12')](0x9)[_0x3877('0x24')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x3877('0x38')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x3877('0x12')](0x9)[_0x3877('0x24')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x3877('0x12')](0x9)[_0x3877('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x3877('0x39')},'dialAMDMinWordLength':{'type':Sequelize[_0x3877('0x12')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x3877('0x3a')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x3877('0x12')](0x9)[_0x3877('0x24')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x3877('0x12')](0x9)[_0x3877('0x24')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x3877('0x3b')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x3877('0x12')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x3877('0x12')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x3877('0x3c')},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)[_0x3877('0x24')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x3877('0x3d')},'dialOrderByScheduledAt':{'type':Sequelize[_0x3877('0x2')](_0x3877('0x3e'),_0x3877('0x3f')),'defaultValue':_0x3877('0x3e')},'dialQueueProject2':{'type':Sequelize[_0x3877('0x13')],'comment':_0x3877('0x2f')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x3877('0x1b')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x3877('0x1b')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x3877('0x12')](0x3)[_0x3877('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x3877('0x40')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x3877('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x3877('0x12')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3877('0x41')},'dialDropMaxRetry':{'type':Sequelize[_0x3877('0x12')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3877('0x42')},'dialDropRetryFrequency':{'type':Sequelize[_0x3877('0x12')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3877('0x43')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x3877('0x12')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3877('0x44')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x3877('0x12')](0x5)[_0x3877('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3877('0x45')},'dialMachineMaxRetry':{'type':Sequelize[_0x3877('0x12')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3877('0x46')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x3877('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3877('0x47')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x3877('0x12')](0x3)[_0x3877('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x3877('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3877('0x48')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3877('0x12')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x3877('0x49'),'set':function(_0x4765da){if(!_0x4765da)this['setDataValue'](_0x3877('0x4a'),null);this[_0x3877('0xc')]('mandatoryDisposition',_0x4765da);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x3877('0x12')](0x3)[_0x3877('0x24')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x3877('0x12')](0x3)[_0x3877('0x24')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x3877('0x1b')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x3877('0x12')](0x3)[_0x3877('0x24')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 71a2e35..4a1f0a2 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 _0x9957=['includes','find','type','name','UserProfileResource','destroy','stack','send','fieldName','key','getOptions','include','query','findAll','catch','show','params','model','rawAttributes','filters','attributes','intersection','fields','includeAll','merge','VoiceQueue','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','inbound','UserProfileSection','userProfileId','autoAssociation','error','clone','length','options','omit','updatedAt','user','role','outbound','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','findOne','keys','order','sort','where','pick','CmHopper','rows','getHopperHistories','CmHopperHistory','hasOwnProperty','VoiceQueueId','getHopperFinals','CmHopperFinal','nolimit','getHopperBlacks','CmHopperBlack','getTeams','addTeams','Team','Agents','voicePause','interface','penalty','transaction','each','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','format','forEach','emit','userVoiceQueue:save','ids','User','field','tq.TeamId','team_has_voice_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','sequelize','QueryTypes','every','all','union','compact','removeTeams','isEmpty','userVoiceQueue:remove','addAgents','online','SIP/%s','removeAgents','isArray','getAgents','getMembers','getLists','addLists','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','createdAt','select','ContactId','CmListId','ListId','from','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','VoiceQueueId\x20=\x20?','onlyIfOpen','cm_contacts','deletedAt\x20IS\x20NULL','COALESCE(phone,\x27\x27)','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','join','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','CmList','addBlackLists','cm_hopper_black','removeBlackLists','moment','bluebird','util','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','then','VoiceQueues','QueueCampaigns','filter','ignore','map','value'];(function(_0x3e3527,_0x4f9564){var _0x1465cb=function(_0x16031d){while(--_0x16031d){_0x3e3527['push'](_0x3e3527['shift']());}};_0x1465cb(++_0x4f9564);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var moment=require(_0x7995('0x0'));var BPromise=require(_0x7995('0x1'));var util=require(_0x7995('0x2'));var _=require(_0x7995('0x3'));var squel=require('squel');var Redis=require(_0x7995('0x4'));var qs=require(_0x7995('0x5'));var logger=require(_0x7995('0x6'))(_0x7995('0x7'));var config=require('../../config/environment');var db=require(_0x7995('0x8'))['db'];config[_0x7995('0x9')]=_[_0x7995('0xa')](config[_0x7995('0x9')],{'host':_0x7995('0xb'),'port':0x18eb});var socket=require(_0x7995('0xc'))(new Redis(config['redis']));require(_0x7995('0xd'))[_0x7995('0xe')](socket);function respondWithStatusCode(_0x4a64f7,_0xa2e5f0){_0xa2e5f0=_0xa2e5f0||0xcc;return function(_0x3116fb){if(_0x3116fb){return _0x4a64f7[_0x7995('0xf')](_0xa2e5f0);}return _0x4a64f7[_0x7995('0x10')](_0xa2e5f0)[_0x7995('0x11')]();};}function respondWithResult(_0x1e400a,_0x341672){_0x341672=_0x341672||0xc8;return function(_0x524f7b){if(_0x524f7b){return _0x1e400a[_0x7995('0x10')](_0x341672)[_0x7995('0x12')](_0x524f7b);}};}function respondWithFilteredResult(_0x581f22,_0xb0c872){return function(_0x2cb37a){if(_0x2cb37a){var _0x19a27e=typeof _0xb0c872[_0x7995('0x13')]===_0x7995('0x14')&&typeof _0xb0c872[_0x7995('0x15')]===_0x7995('0x14');var _0x4cc004=_0x2cb37a['count'];var _0x2b4e94=_0x19a27e?0x0:_0xb0c872[_0x7995('0x13')];var _0x24b5bb=_0x19a27e?_0x2cb37a[_0x7995('0x16')]:_0xb0c872[_0x7995('0x13')]+_0xb0c872[_0x7995('0x15')];var _0x2202ce;if(_0x24b5bb>=_0x4cc004){_0x24b5bb=_0x4cc004;_0x2202ce=0xc8;}else{_0x2202ce=0xce;}_0x581f22[_0x7995('0x10')](_0x2202ce);return _0x581f22['set'](_0x7995('0x17'),_0x2b4e94+'-'+_0x24b5bb+'/'+_0x4cc004)['json'](_0x2cb37a);}return null;};}function saveUpdates(_0x2f832e){return function(_0x37f297){if(_0x37f297){return _0x37f297[_0x7995('0x18')](_0x2f832e)[_0x7995('0x19')](function(_0x1e1415){return _0x1e1415;});}return null;};}function removeEntity(_0x37a7d4){return function(_0x4faa60){if(_0x4faa60){return _0x4faa60['destroy']()[_0x7995('0x19')](function(){var _0x5e6f90=_0x4faa60['get']({'plain':!![]});var _0x3ec178=[{'name':_0x7995('0x1a'),'value':'inbound','ignore':![]},{'name':_0x7995('0x1b'),'value':'outbound','ignore':![]}];var _0x4b1a8e=_(_0x3ec178)[_0x7995('0x1c')](_0x7995('0x1d'))[_0x7995('0x1e')](_0x7995('0x1f'))[_0x7995('0x1f')]();if(_[_0x7995('0x20')](_0x4b1a8e,_0x5e6f90['type'])){return;}var _0x32a09a=_[_0x7995('0x21')](_0x3ec178,[_0x7995('0x1f'),_0x5e6f90[_0x7995('0x22')]])[_0x7995('0x23')];return db[_0x7995('0x24')][_0x7995('0x25')]({'where':{'type':_0x32a09a,'resourceId':_0x5e6f90['id']}})[_0x7995('0x19')](function(){return _0x4faa60;});})['then'](function(){_0x37a7d4[_0x7995('0x10')](0xcc)[_0x7995('0x11')]();});}};}function handleEntityNotFound(_0x401dc3){return function(_0x268ce7){if(!_0x268ce7){_0x401dc3[_0x7995('0xf')](0x194);}return _0x268ce7;};}function handleError(_0x2a307e,_0x56691a){_0x56691a=_0x56691a||0x1f4;return function(_0x47625f){logger['error'](_0x47625f[_0x7995('0x26')]);if(_0x47625f[_0x7995('0x23')]){delete _0x47625f[_0x7995('0x23')];}_0x2a307e[_0x7995('0x10')](_0x56691a)[_0x7995('0x27')](_0x47625f);};}exports['index']=function(_0x9b2a15,_0x514445){var _0x456a28={};var _0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['VoiceQueue']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x28')],'type':_0x3573be[_0x7995('0x22')][_0x7995('0x29')]};});_0x456a28=qs[_0x7995('0x2a')](_0x4253e5,_0x9b2a15);var _0x1ca460={'where':_0x456a28['where']};return db['VoiceQueue'][_0x7995('0x16')](_0x1ca460)['then'](function(_0x553671){_0x3250e0[_0x7995('0x16')]=_0x553671;_0x456a28[_0x7995('0x2b')]=qs[_0x7995('0x2b')](_0x9b2a15[_0x7995('0x2c')]);return db['VoiceQueue'][_0x7995('0x2d')](_0x456a28);})[_0x7995('0x19')](function(_0x5dd802){_0x3250e0['rows']=_0x5dd802;return _0x3250e0;})['then'](respondWithFilteredResult(_0x514445,_0x456a28))[_0x7995('0x2e')](handleError(_0x514445,null));};exports[_0x7995('0x2f')]=function(_0x4a176f,_0x3e7020){var _0x51b95d={'raw':![],'where':{'id':_0x4a176f[_0x7995('0x30')]['id']}},_0x37917b={};_0x37917b[_0x7995('0x31')]=_['keys'](db['VoiceQueue'][_0x7995('0x32')]);_0x37917b['query']=_['keys'](_0x4a176f[_0x7995('0x2c')]);_0x37917b[_0x7995('0x33')]=_['intersection'](_0x37917b[_0x7995('0x31')],_0x37917b[_0x7995('0x2c')]);_0x51b95d[_0x7995('0x34')]=_[_0x7995('0x35')](_0x37917b[_0x7995('0x31')],qs['fields'](_0x4a176f[_0x7995('0x2c')][_0x7995('0x36')]));_0x51b95d[_0x7995('0x34')]=_0x51b95d[_0x7995('0x34')]['length']?_0x51b95d[_0x7995('0x34')]:_0x37917b[_0x7995('0x31')];if(_0x4a176f[_0x7995('0x2c')][_0x7995('0x37')]){_0x51b95d[_0x7995('0x2b')]=[{'all':!![]}];}_0x51b95d=_[_0x7995('0x38')]({},_0x51b95d,_0x4a176f['options']);return db[_0x7995('0x39')][_0x7995('0x21')](_0x51b95d)[_0x7995('0x19')](handleEntityNotFound(_0x3e7020,null))[_0x7995('0x19')](respondWithResult(_0x3e7020,null))[_0x7995('0x2e')](handleError(_0x3e7020,null));};exports[_0x7995('0x3a')]=function(_0x14d638,_0x270c0e){return db[_0x7995('0x39')][_0x7995('0x3a')](_0x14d638[_0x7995('0x3b')],{})[_0x7995('0x19')](function(_0x7b4e67){var _0x53cda2=_0x14d638['user'][_0x7995('0x3c')]({'plain':!![]});if(!_0x53cda2)throw new Error(_0x7995('0x3d'));if(_0x53cda2['role']==='user'){var _0x3f8522=_0x7b4e67['get']({'plain':!![]});var _0x504a33=[{'name':_0x7995('0x1a'),'value':_0x7995('0x3e')},{'name':_0x7995('0x1b'),'value':'outbound'}];var _0x46ac4f=_['find'](_0x504a33,[_0x7995('0x1f'),_0x3f8522['type']])['name'];return db[_0x7995('0x3f')][_0x7995('0x21')]({'where':{'name':_0x46ac4f,'userProfileId':_0x53cda2[_0x7995('0x40')]},'raw':!![]})[_0x7995('0x19')](function(_0x599ecb){if(_0x599ecb&&_0x599ecb[_0x7995('0x41')]===0x0){return db[_0x7995('0x24')][_0x7995('0x3a')]({'name':_0x3f8522[_0x7995('0x23')],'resourceId':_0x3f8522['id'],'type':_0x599ecb['name'],'sectionId':_0x599ecb['id']},{})['then'](function(){return _0x7b4e67;});}else{return _0x7b4e67;}})[_0x7995('0x2e')](function(_0x55791b){logger[_0x7995('0x42')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x55791b);throw _0x55791b;});}return _0x7b4e67;})[_0x7995('0x19')](respondWithResult(_0x270c0e,0xc9))['catch'](handleError(_0x270c0e,null));};exports[_0x7995('0x43')]=function(_0x1b0373,_0x4d9245){var _0x3e9e62={'where':{'id':_0x1b0373[_0x7995('0x30')]['id']}},_0x336ff2={};_0x336ff2[_0x7995('0x31')]=_['keys'](db[_0x7995('0x39')][_0x7995('0x32')]);_0x3e9e62[_0x7995('0x34')]=_['intersection'](_0x336ff2[_0x7995('0x31')],qs[_0x7995('0x36')](_0x1b0373[_0x7995('0x2c')][_0x7995('0x36')]));_0x3e9e62[_0x7995('0x34')]=_0x3e9e62['attributes'][_0x7995('0x44')]?_0x3e9e62[_0x7995('0x34')]:_0x336ff2['model'];if(_0x1b0373[_0x7995('0x2c')]['includeAll']){_0x3e9e62[_0x7995('0x2b')]=[{'all':!![]}];}_0x3e9e62=_[_0x7995('0x38')]({},_0x3e9e62,_0x1b0373[_0x7995('0x45')]);return db[_0x7995('0x39')][_0x7995('0x21')](_0x3e9e62)[_0x7995('0x19')](handleEntityNotFound(_0x4d9245,null))[_0x7995('0x19')](function(_0x4d46bc){if(_0x4d46bc){var _0x427dcf=_0x4d46bc[_0x7995('0x3c')]({'plain':!![]});_0x427dcf=qs[_0x7995('0x46')](_0x427dcf,['id','createdAt',_0x7995('0x47')]);_0x1b0373[_0x7995('0x3b')]=_[_0x7995('0x46')](_0x1b0373['body'],['id','createdAt','updatedAt']);return db[_0x7995('0x39')][_0x7995('0x3a')](_['merge'](_0x427dcf,_0x1b0373[_0x7995('0x3b')]),{'include':_0x1b0373[_0x7995('0x2c')][_0x7995('0x37')]?[{'all':!![]}]:undefined})[_0x7995('0x19')](function(_0xc04004){var _0x528c8e=_0x1b0373[_0x7995('0x48')]['get']({'plain':!![]});if(!_0x528c8e)throw new Error(_0x7995('0x3d'));if(_0x528c8e[_0x7995('0x49')]===_0x7995('0x48')){var _0x50c7b5=_0xc04004['get']({'plain':!![]});var _0x54e2b1=[{'name':'VoiceQueues','value':_0x7995('0x3e')},{'name':_0x7995('0x1b'),'value':_0x7995('0x4a')}];var _0x150261=_[_0x7995('0x21')](_0x54e2b1,[_0x7995('0x1f'),_0x50c7b5[_0x7995('0x22')]])[_0x7995('0x23')];return db[_0x7995('0x3f')][_0x7995('0x21')]({'where':{'name':_0x150261,'userProfileId':_0x528c8e[_0x7995('0x40')]},'raw':!![]})[_0x7995('0x19')](function(_0x3da72b){if(_0x3da72b&&_0x3da72b[_0x7995('0x41')]===0x0){return db[_0x7995('0x24')][_0x7995('0x3a')]({'name':_0x50c7b5[_0x7995('0x23')],'resourceId':_0x50c7b5['id'],'type':_0x3da72b[_0x7995('0x23')],'sectionId':_0x3da72b['id']},{})[_0x7995('0x19')](function(){return _0xc04004;});}else{return _0xc04004;}})['catch'](function(_0x56a374){logger[_0x7995('0x42')](_0x7995('0x4b'),_0x56a374);throw _0x56a374;});}return _0xc04004;});}})[_0x7995('0x19')](respondWithResult(_0x4d9245,0xc9))['catch'](handleError(_0x4d9245,null));};exports['update']=function(_0x402fa0,_0x197b52){if(_0x402fa0[_0x7995('0x3b')]['id']){delete _0x402fa0[_0x7995('0x3b')]['id'];}return db['VoiceQueue'][_0x7995('0x21')]({'where':{'id':_0x402fa0[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x197b52,null))[_0x7995('0x19')](saveUpdates(_0x402fa0['body'],null))['then'](respondWithResult(_0x197b52,null))[_0x7995('0x2e')](handleError(_0x197b52,null));};exports[_0x7995('0x25')]=function(_0x6c0221,_0x1d69ce){return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0x6c0221[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x1d69ce,null))[_0x7995('0x19')](removeEntity(_0x1d69ce,null))['catch'](handleError(_0x1d69ce,null));};exports[_0x7995('0x4c')]=function(_0x3ec5a8,_0xdf9e38){var _0x1ecfdb={'raw':![],'where':{}};var _0x59c5aa={};var _0x51bf6a={'count':0x0,'rows':[]};return db[_0x7995('0x39')][_0x7995('0x4d')]({'where':{'id':_0x3ec5a8['params']['id']}})[_0x7995('0x19')](handleEntityNotFound(_0xdf9e38,null))[_0x7995('0x19')](function(_0x2e3421){if(_0x2e3421){_0x59c5aa[_0x7995('0x31')]=_[_0x7995('0x4e')](db['CmHopper'][_0x7995('0x32')]);_0x59c5aa['query']=_[_0x7995('0x4e')](_0x3ec5a8[_0x7995('0x2c')]);_0x59c5aa[_0x7995('0x33')]=_[_0x7995('0x35')](_0x59c5aa[_0x7995('0x31')],_0x59c5aa[_0x7995('0x2c')]);_0x1ecfdb[_0x7995('0x34')]=_[_0x7995('0x35')](_0x59c5aa[_0x7995('0x31')],qs[_0x7995('0x36')](_0x3ec5a8[_0x7995('0x2c')][_0x7995('0x36')]));_0x1ecfdb['attributes']=_0x1ecfdb[_0x7995('0x34')][_0x7995('0x44')]?_0x1ecfdb[_0x7995('0x34')]:_0x59c5aa[_0x7995('0x31')];if(!_0x3ec5a8[_0x7995('0x2c')]['hasOwnProperty']('nolimit')){_0x1ecfdb[_0x7995('0x15')]=qs[_0x7995('0x15')](_0x3ec5a8[_0x7995('0x2c')][_0x7995('0x15')]);_0x1ecfdb['offset']=qs[_0x7995('0x13')](_0x3ec5a8['query']['offset']);}_0x1ecfdb[_0x7995('0x4f')]=qs[_0x7995('0x50')](_0x3ec5a8[_0x7995('0x2c')][_0x7995('0x50')]);_0x1ecfdb[_0x7995('0x51')]=qs[_0x7995('0x33')](_[_0x7995('0x52')](_0x3ec5a8[_0x7995('0x2c')],_0x59c5aa[_0x7995('0x33')]));_0x1ecfdb[_0x7995('0x51')]['VoiceQueueId']=_0x2e3421['id'];if(_0x3ec5a8[_0x7995('0x2c')][_0x7995('0x1c')]){_0x1ecfdb[_0x7995('0x51')]=_['merge'](_0x1ecfdb[_0x7995('0x51')],{'$or':_[_0x7995('0x1e')](_0x1ecfdb[_0x7995('0x34')],function(_0x3a7d9d){var _0x3b0d30={};_0x3b0d30[_0x3a7d9d]={'$like':'%'+_0x3ec5a8[_0x7995('0x2c')][_0x7995('0x1c')]+'%'};return _0x3b0d30;})});}_0x1ecfdb=_[_0x7995('0x38')]({},_0x1ecfdb,_0x3ec5a8[_0x7995('0x45')]);return db[_0x7995('0x53')][_0x7995('0x16')]({'where':_0x1ecfdb['where']})['then'](function(_0xd07c1c){_0x51bf6a[_0x7995('0x16')]=_0xd07c1c;if(_0x3ec5a8[_0x7995('0x2c')][_0x7995('0x37')]){_0x1ecfdb['include']=[{'all':!![]}];}return db[_0x7995('0x53')][_0x7995('0x2d')](_0x1ecfdb);})['then'](function(_0x480fdb){_0x51bf6a[_0x7995('0x54')]=_0x480fdb;return _0x51bf6a;});}})[_0x7995('0x19')](respondWithFilteredResult(_0xdf9e38,_0x1ecfdb))['catch'](handleError(_0xdf9e38,null));};exports[_0x7995('0x55')]=function(_0x5b1cba,_0x3758f9){var _0xea9aba={'raw':!![],'where':{}};var _0x4ff9ff={};var _0x5d9d33={'count':0x0,'rows':[]};return db[_0x7995('0x39')]['findOne']({'where':{'id':_0x5b1cba[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x3758f9,null))[_0x7995('0x19')](function(_0x45bd8a){if(_0x45bd8a){_0x4ff9ff[_0x7995('0x31')]=_[_0x7995('0x4e')](db[_0x7995('0x56')][_0x7995('0x32')]);_0x4ff9ff[_0x7995('0x2c')]=_[_0x7995('0x4e')](_0x5b1cba[_0x7995('0x2c')]);_0x4ff9ff[_0x7995('0x33')]=_[_0x7995('0x35')](_0x4ff9ff[_0x7995('0x31')],_0x4ff9ff[_0x7995('0x2c')]);_0xea9aba[_0x7995('0x34')]=_[_0x7995('0x35')](_0x4ff9ff[_0x7995('0x31')],qs[_0x7995('0x36')](_0x5b1cba[_0x7995('0x2c')][_0x7995('0x36')]));_0xea9aba[_0x7995('0x34')]=_0xea9aba[_0x7995('0x34')][_0x7995('0x44')]?_0xea9aba[_0x7995('0x34')]:_0x4ff9ff[_0x7995('0x31')];if(!_0x5b1cba[_0x7995('0x2c')][_0x7995('0x57')]('nolimit')){_0xea9aba[_0x7995('0x15')]=qs[_0x7995('0x15')](_0x5b1cba['query']['limit']);_0xea9aba[_0x7995('0x13')]=qs[_0x7995('0x13')](_0x5b1cba[_0x7995('0x2c')][_0x7995('0x13')]);}_0xea9aba[_0x7995('0x4f')]=qs[_0x7995('0x50')](_0x5b1cba['query'][_0x7995('0x50')]);_0xea9aba[_0x7995('0x51')]=qs[_0x7995('0x33')](_[_0x7995('0x52')](_0x5b1cba[_0x7995('0x2c')],_0x4ff9ff[_0x7995('0x33')]));_0xea9aba[_0x7995('0x51')][_0x7995('0x58')]=_0x45bd8a['id'];if(_0x5b1cba['query'][_0x7995('0x1c')]){_0xea9aba[_0x7995('0x51')]=_['merge'](_0xea9aba['where'],{'$or':_[_0x7995('0x1e')](_0xea9aba[_0x7995('0x34')],function(_0x18e1a2){var _0x3db7a9={};_0x3db7a9[_0x18e1a2]={'$like':'%'+_0x5b1cba[_0x7995('0x2c')]['filter']+'%'};return _0x3db7a9;})});}_0xea9aba=_[_0x7995('0x38')]({},_0xea9aba,_0x5b1cba[_0x7995('0x45')]);return db['CmHopperHistory'][_0x7995('0x16')]({'where':_0xea9aba[_0x7995('0x51')]})['then'](function(_0x1535a3){_0x5d9d33['count']=_0x1535a3;if(_0x5b1cba[_0x7995('0x2c')][_0x7995('0x37')]){_0xea9aba[_0x7995('0x2b')]=[{'all':!![]}];}return db[_0x7995('0x56')][_0x7995('0x2d')](_0xea9aba);})['then'](function(_0x1f0506){_0x5d9d33[_0x7995('0x54')]=_0x1f0506;return _0x5d9d33;});}})[_0x7995('0x19')](respondWithFilteredResult(_0x3758f9,_0xea9aba))['catch'](handleError(_0x3758f9,null));};exports[_0x7995('0x59')]=function(_0x3f3434,_0x350ed3){var _0x308a26={'raw':!![],'where':{}};var _0x5d7018={};var _0x3356fd={'count':0x0,'rows':[]};return db[_0x7995('0x39')][_0x7995('0x4d')]({'where':{'id':_0x3f3434['params']['id']}})['then'](handleEntityNotFound(_0x350ed3,null))[_0x7995('0x19')](function(_0x333379){if(_0x333379){_0x5d7018['model']=_['keys'](db[_0x7995('0x5a')][_0x7995('0x32')]);_0x5d7018[_0x7995('0x2c')]=_[_0x7995('0x4e')](_0x3f3434[_0x7995('0x2c')]);_0x5d7018['filters']=_['intersection'](_0x5d7018[_0x7995('0x31')],_0x5d7018['query']);_0x308a26['attributes']=_[_0x7995('0x35')](_0x5d7018[_0x7995('0x31')],qs[_0x7995('0x36')](_0x3f3434['query'][_0x7995('0x36')]));_0x308a26[_0x7995('0x34')]=_0x308a26[_0x7995('0x34')][_0x7995('0x44')]?_0x308a26[_0x7995('0x34')]:_0x5d7018['model'];if(!_0x3f3434[_0x7995('0x2c')][_0x7995('0x57')](_0x7995('0x5b'))){_0x308a26[_0x7995('0x15')]=qs['limit'](_0x3f3434[_0x7995('0x2c')][_0x7995('0x15')]);_0x308a26['offset']=qs[_0x7995('0x13')](_0x3f3434[_0x7995('0x2c')]['offset']);}_0x308a26[_0x7995('0x4f')]=qs['sort'](_0x3f3434[_0x7995('0x2c')]['sort']);_0x308a26[_0x7995('0x51')]=qs['filters'](_[_0x7995('0x52')](_0x3f3434[_0x7995('0x2c')],_0x5d7018['filters']));_0x308a26[_0x7995('0x51')]['VoiceQueueId']=_0x333379['id'];if(_0x3f3434['query'][_0x7995('0x1c')]){_0x308a26[_0x7995('0x51')]=_[_0x7995('0x38')](_0x308a26[_0x7995('0x51')],{'$or':_['map'](_0x308a26[_0x7995('0x34')],function(_0x35044a){var _0x4bd29f={};_0x4bd29f[_0x35044a]={'$like':'%'+_0x3f3434['query'][_0x7995('0x1c')]+'%'};return _0x4bd29f;})});}_0x308a26=_['merge']({},_0x308a26,_0x3f3434[_0x7995('0x45')]);return db[_0x7995('0x5a')][_0x7995('0x16')]({'where':_0x308a26['where']})['then'](function(_0x2b7852){_0x3356fd['count']=_0x2b7852;if(_0x3f3434[_0x7995('0x2c')][_0x7995('0x37')]){_0x308a26[_0x7995('0x2b')]=[{'all':!![]}];}return db[_0x7995('0x5a')]['findAll'](_0x308a26);})['then'](function(_0x50f880){_0x3356fd[_0x7995('0x54')]=_0x50f880;return _0x3356fd;});}})[_0x7995('0x19')](respondWithFilteredResult(_0x350ed3,_0x308a26))[_0x7995('0x2e')](handleError(_0x350ed3,null));};exports[_0x7995('0x5c')]=function(_0x265f07,_0x168e7f){var _0x59a793={'raw':!![],'where':{}};var _0x53cbec={};var _0x1a2902={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x265f07[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x168e7f,null))['then'](function(_0x35c3f3){if(_0x35c3f3){_0x53cbec[_0x7995('0x31')]=_[_0x7995('0x4e')](db['CmHopperBlack'][_0x7995('0x32')]);_0x53cbec[_0x7995('0x2c')]=_[_0x7995('0x4e')](_0x265f07[_0x7995('0x2c')]);_0x53cbec[_0x7995('0x33')]=_[_0x7995('0x35')](_0x53cbec[_0x7995('0x31')],_0x53cbec[_0x7995('0x2c')]);_0x59a793[_0x7995('0x34')]=_['intersection'](_0x53cbec[_0x7995('0x31')],qs[_0x7995('0x36')](_0x265f07[_0x7995('0x2c')][_0x7995('0x36')]));_0x59a793[_0x7995('0x34')]=_0x59a793['attributes'][_0x7995('0x44')]?_0x59a793[_0x7995('0x34')]:_0x53cbec[_0x7995('0x31')];if(!_0x265f07['query']['hasOwnProperty']('nolimit')){_0x59a793[_0x7995('0x15')]=qs[_0x7995('0x15')](_0x265f07[_0x7995('0x2c')][_0x7995('0x15')]);_0x59a793[_0x7995('0x13')]=qs[_0x7995('0x13')](_0x265f07['query'][_0x7995('0x13')]);}_0x59a793['order']=qs[_0x7995('0x50')](_0x265f07[_0x7995('0x2c')][_0x7995('0x50')]);_0x59a793[_0x7995('0x51')]=qs[_0x7995('0x33')](_[_0x7995('0x52')](_0x265f07[_0x7995('0x2c')],_0x53cbec[_0x7995('0x33')]));_0x59a793[_0x7995('0x51')][_0x7995('0x58')]=_0x35c3f3['id'];if(_0x265f07[_0x7995('0x2c')]['filter']){_0x59a793[_0x7995('0x51')]=_['merge'](_0x59a793[_0x7995('0x51')],{'$or':_[_0x7995('0x1e')](_0x59a793['attributes'],function(_0x493e74){var _0x2a25eb={};_0x2a25eb[_0x493e74]={'$like':'%'+_0x265f07[_0x7995('0x2c')][_0x7995('0x1c')]+'%'};return _0x2a25eb;})});}_0x59a793=_[_0x7995('0x38')]({},_0x59a793,_0x265f07[_0x7995('0x45')]);return db[_0x7995('0x5d')][_0x7995('0x16')]({'where':_0x59a793[_0x7995('0x51')]})[_0x7995('0x19')](function(_0x3c9b3c){_0x1a2902[_0x7995('0x16')]=_0x3c9b3c;if(_0x265f07[_0x7995('0x2c')]['includeAll']){_0x59a793['include']=[{'all':!![]}];}return db[_0x7995('0x5d')][_0x7995('0x2d')](_0x59a793);})[_0x7995('0x19')](function(_0x1531a9){_0x1a2902[_0x7995('0x54')]=_0x1531a9;return _0x1a2902;});}})['then'](respondWithFilteredResult(_0x168e7f,_0x59a793))[_0x7995('0x2e')](handleError(_0x168e7f,null));};exports[_0x7995('0x5e')]=function(_0x5ebf5e,_0x46fc1c){var _0x53d693={};var _0x37416c={};var _0x30cda5;var _0x234a40;return db['VoiceQueue'][_0x7995('0x4d')]({'where':{'id':_0x5ebf5e[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x46fc1c,null))[_0x7995('0x19')](function(_0x11f9fb){if(_0x11f9fb){_0x30cda5=_0x11f9fb;_0x37416c[_0x7995('0x31')]=_[_0x7995('0x4e')](db['Team']['rawAttributes']);_0x37416c['query']=_[_0x7995('0x4e')](_0x5ebf5e[_0x7995('0x2c')]);_0x37416c['filters']=_['intersection'](_0x37416c[_0x7995('0x31')],_0x37416c[_0x7995('0x2c')]);_0x53d693['attributes']=_['intersection'](_0x37416c['model'],qs['fields'](_0x5ebf5e[_0x7995('0x2c')][_0x7995('0x36')]));_0x53d693[_0x7995('0x34')]=_0x53d693[_0x7995('0x34')]['length']?_0x53d693[_0x7995('0x34')]:_0x37416c[_0x7995('0x31')];_0x53d693['order']=qs[_0x7995('0x50')](_0x5ebf5e[_0x7995('0x2c')][_0x7995('0x50')]);_0x53d693['where']=qs[_0x7995('0x33')](_[_0x7995('0x52')](_0x5ebf5e['query'],_0x37416c[_0x7995('0x33')]));if(_0x5ebf5e[_0x7995('0x2c')][_0x7995('0x1c')]){_0x53d693[_0x7995('0x51')]=_[_0x7995('0x38')](_0x53d693[_0x7995('0x51')],{'$or':_[_0x7995('0x1e')](_0x53d693[_0x7995('0x34')],function(_0x4254de){var _0x278004={};_0x278004[_0x4254de]={'$like':'%'+_0x5ebf5e[_0x7995('0x2c')][_0x7995('0x1c')]+'%'};return _0x278004;})});}_0x53d693=_[_0x7995('0x38')]({},_0x53d693,_0x5ebf5e['options']);return _0x30cda5[_0x7995('0x5e')](_0x53d693);}})[_0x7995('0x19')](function(_0x3603e8){if(_0x3603e8){_0x234a40=_0x3603e8[_0x7995('0x44')];if(!_0x5ebf5e['query'][_0x7995('0x57')](_0x7995('0x5b'))){_0x53d693[_0x7995('0x15')]=qs['limit'](_0x5ebf5e[_0x7995('0x2c')][_0x7995('0x15')]);_0x53d693[_0x7995('0x13')]=qs[_0x7995('0x13')](_0x5ebf5e[_0x7995('0x2c')][_0x7995('0x13')]);}return _0x30cda5[_0x7995('0x5e')](_0x53d693);}})['then'](function(_0x35dbd7){if(_0x35dbd7){return _0x35dbd7?{'count':_0x234a40,'rows':_0x35dbd7}:null;}})['then'](respondWithResult(_0x46fc1c,null))[_0x7995('0x2e')](handleError(_0x46fc1c,null));};exports[_0x7995('0x5f')]=function(_0x2190d1,_0x4cae1c){var _0xd012b9=_0x2190d1['body']['teams'];var _0x4ee5ee=_['map'](_0xd012b9,'id');return db[_0x7995('0x60')][_0x7995('0x2d')]({'where':{'id':_0x4ee5ee},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7995('0x61'),'attributes':['id',_0x7995('0x23'),'online',_0x7995('0x62'),_0x7995('0x63')],'raw':!![]}]})[_0x7995('0x19')](function(_0x45a479){if(_0x45a479){var _0x443863=_['flatMap'](_0x45a479,function(_0x38ea3e){var _0x1df81d=_0x38ea3e[_0x7995('0x3c')]({'plain':!![]});_0x1df81d[_0x7995('0x61')]['forEach'](function(_0x428d5a){_0x428d5a[_0x7995('0x64')]=_[_0x7995('0x21')](_0xd012b9,{'id':_0x1df81d['id']})[_0x7995('0x64')];});return _0x1df81d[_0x7995('0x61')];});return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0x2190d1[_0x7995('0x30')]['id']}})[_0x7995('0x19')](function(_0x1fda95){return db['sequelize'][_0x7995('0x65')](function(_0x521712){return _0x1fda95[_0x7995('0x5f')](_0x4ee5ee,{'transaction':_0x521712})[_0x7995('0x19')](function(){return BPromise[_0x7995('0x66')](_0xd012b9,function(_0x50eb5e){return db['TeamVoiceQueue'][_0x7995('0x67')]({'TeamId':_0x50eb5e['id'],'VoiceQueueId':_0x2190d1[_0x7995('0x30')]['id'],'penalty':_0x50eb5e['penalty']},{'transaction':_0x521712});});})[_0x7995('0x19')](function(){return BPromise['each'](_0x443863,function(_0x43de18){return db[_0x7995('0x68')][_0x7995('0x69')]({'where':{'UserId':_0x43de18['id'],'VoiceQueueId':_0x2190d1[_0x7995('0x30')]['id']},'defaults':{'penalty':_0x43de18['penalty']},'transaction':_0x521712});});})['then'](function(){return BPromise[_0x7995('0x66')](_[_0x7995('0x1c')](_0x443863,{'online':!![]}),function(_0x365318){return db[_0x7995('0x6a')]['upsert']({'membername':_0x365318[_0x7995('0x23')],'UserId':_0x365318['id'],'queue_name':_0x1fda95[_0x7995('0x23')],'VoiceQueueId':_0x1fda95['id'],'interface':_[_0x7995('0x6b')](_0x365318[_0x7995('0x63')])?util[_0x7995('0x6c')]('SIP/%s',_0x365318['name']):_0x365318['interface'],'paused':_0x365318[_0x7995('0x62')]||![],'penalty':_0x365318[_0x7995('0x64')]},{'transaction':_0x521712});});})['then'](function(){_0x443863[_0x7995('0x6d')](function(_0x5635d6){socket[_0x7995('0x6e')](_0x7995('0x6f'),{'UserId':_0x5635d6['id'],'VoiceQueueId':_0x1fda95['id']});});});});});}})[_0x7995('0x19')](respondWithStatusCode(_0x4cae1c,null))[_0x7995('0x2e')](handleError(_0x4cae1c,null));};exports['removeTeams']=function(_0x3fbafb,_0x2caacd){return db[_0x7995('0x60')][_0x7995('0x2d')]({'where':{'id':_0x3fbafb[_0x7995('0x2c')][_0x7995('0x70')]},'attributes':['id'],'include':[{'model':db[_0x7995('0x71')],'as':_0x7995('0x61'),'attributes':['id'],'raw':!![]}]})[_0x7995('0x19')](handleEntityNotFound(_0x2caacd,null))[_0x7995('0x19')](function(_0x30893a){var _0x2b8d90=_[_0x7995('0x1e')](_0x30893a,'id');var _0x2122af=[];var _0x4ff0b6=[];var _0x764245=squel['select']();_0x764245[_0x7995('0x72')](_0x7995('0x73'))['from'](_0x7995('0x74'),'tq')['join'](_0x7995('0x75'),'ut',_0x7995('0x76'))['where']('VoiceQueueId\x20=\x20?',_0x3fbafb['params']['id']);for(var _0x8f5ecd=0x0;_0x8f5ecd<_0x30893a[_0x7995('0x44')];_0x8f5ecd+=0x1){let _0x139f76=_0x30893a[_0x8f5ecd];for(var _0x2b7bc2=0x0;_0x2b7bc2<_0x139f76['Agents'][_0x7995('0x44')];_0x2b7bc2+=0x1){let _0x2b2814=_0x139f76[_0x7995('0x61')][_0x2b7bc2];var _0x2de960=_0x764245[_0x7995('0x43')]();_0x2de960[_0x7995('0x51')](_0x7995('0x77'),_0x2b2814['id']);_0x4ff0b6[_0x7995('0x78')](db['sequelize'][_0x7995('0x2c')](_0x2de960[_0x7995('0x79')](),{'type':db[_0x7995('0x7a')][_0x7995('0x7b')]['SELECT']})[_0x7995('0x19')](function(_0x3a2958){if(_0x3a2958[_0x7995('0x44')]===0x1){return _0x2b2814['id'];}else{var _0x339e6b=_[_0x7995('0x7c')](_[_0x7995('0x1e')](_0x3a2958,'TeamId'),function(_0x1bc617){return _[_0x7995('0x20')](_0x2b8d90,_0x1bc617);});if(_0x339e6b){return _0x2b2814['id'];}}}));}}return BPromise[_0x7995('0x7d')](_0x4ff0b6)[_0x7995('0x19')](function(_0x3fcc49){_0x2122af=_(_0x2122af)[_0x7995('0x7e')](_0x3fcc49)[_0x7995('0x7f')]()[_0x7995('0x1f')]();return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0x3fbafb[_0x7995('0x30')]['id']}})[_0x7995('0x19')](function(_0x64a62d){return db[_0x7995('0x7a')][_0x7995('0x65')](function(_0x370984){return _0x64a62d[_0x7995('0x80')](_0x3fbafb[_0x7995('0x2c')][_0x7995('0x70')],{'transaction':_0x370984})[_0x7995('0x19')](function(){if(!_[_0x7995('0x81')](_0x2122af)){return _0x64a62d['removeAgents'](_0x2122af,{'transaction':_0x370984})['then'](function(){return db[_0x7995('0x6a')][_0x7995('0x25')]({'where':{'VoiceQueueId':_0x3fbafb['params']['id'],'UserId':_0x2122af},'transaction':_0x370984});});}})[_0x7995('0x19')](function(){_0x2122af['forEach'](function(_0x2ce103){socket['emit'](_0x7995('0x82'),{'UserId':_0x2ce103,'VoiceQueueId':_0x64a62d['id']});});});});});});})[_0x7995('0x19')](respondWithStatusCode(_0x2caacd,null))[_0x7995('0x2e')](handleError(_0x2caacd,null));};exports[_0x7995('0x83')]=function(_0x3aa676,_0x1df2a2){var _0xd82313,_0x1fa59d;return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0x3aa676['params']['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x1df2a2,null))[_0x7995('0x19')](function(_0x1d0481){if(_0x1d0481){_0x1fa59d=_0x1d0481;return _0x1d0481[_0x7995('0x83')](_0x3aa676['body'][_0x7995('0x70')],_[_0x7995('0x46')](_0x3aa676[_0x7995('0x3b')],[_0x7995('0x70'),'id'])||{})['spread'](function(_0x32c550){for(var _0x37e647=0x0;_0x37e647<_0x3aa676[_0x7995('0x3b')][_0x7995('0x70')][_0x7995('0x44')];_0x37e647+=0x1){socket[_0x7995('0x6e')](_0x7995('0x6f'),{'UserId':Number(_0x3aa676[_0x7995('0x3b')][_0x7995('0x70')][_0x37e647]),'VoiceQueueId':Number(_0x3aa676['params']['id'])});}return _0x32c550;});}})[_0x7995('0x19')](function(_0x5f5496){_0xd82313=_0x5f5496||[];if(_0x1fa59d){return db[_0x7995('0x71')][_0x7995('0x2d')]({'where':{'id':_0x3aa676[_0x7995('0x3b')][_0x7995('0x70')]},'attributes':['id','name',_0x7995('0x84'),_0x7995('0x62'),_0x7995('0x63')],'raw':!![]});}})[_0x7995('0x19')](function(_0x2c715){if(!_[_0x7995('0x81')](_0x2c715)){var _0x3661ab=[];for(var _0x408692=0x0;_0x408692<_0x2c715[_0x7995('0x44')];_0x408692++){if(_0x2c715[_0x408692][_0x7995('0x84')]){_0x3661ab[_0x7995('0x78')](db[_0x7995('0x6a')][_0x7995('0x67')]({'membername':_0x2c715[_0x408692][_0x7995('0x23')],'UserId':_0x2c715[_0x408692]['id'],'queue_name':_0x1fa59d['name'],'VoiceQueueId':_0x1fa59d['id'],'interface':_['isNil'](_0x2c715[_0x408692][_0x7995('0x63')])?util[_0x7995('0x6c')](_0x7995('0x85'),_0x2c715[_0x408692]['name']):_0x2c715[_0x408692][_0x7995('0x63')],'paused':_0x2c715[_0x408692][_0x7995('0x62')]||![],'penalty':_0x3aa676[_0x7995('0x3b')]['penalty']||0x0}));}}return BPromise[_0x7995('0x7d')](_0x3661ab);}})[_0x7995('0x19')](function(){return _0xd82313;})[_0x7995('0x19')](respondWithResult(_0x1df2a2,null))[_0x7995('0x2e')](handleError(_0x1df2a2,null));};exports[_0x7995('0x86')]=function(_0x3d42a3,_0x29fb77){return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0x3d42a3[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x29fb77,null))['then'](function(_0x580571){if(_0x580571){return _0x580571[_0x7995('0x86')](_0x3d42a3['query'][_0x7995('0x70')])[_0x7995('0x19')](function(){if(_[_0x7995('0x87')](_0x3d42a3[_0x7995('0x2c')][_0x7995('0x70')])){for(var _0x4eebf4=0x0;_0x4eebf4<_0x3d42a3['query'][_0x7995('0x70')][_0x7995('0x44')];_0x4eebf4+=0x1){socket[_0x7995('0x6e')](_0x7995('0x82'),{'UserId':Number(_0x3d42a3[_0x7995('0x2c')][_0x7995('0x70')][_0x4eebf4]),'VoiceQueueId':Number(_0x3d42a3[_0x7995('0x30')]['id'])});}}else{socket[_0x7995('0x6e')](_0x7995('0x82'),{'UserId':Number(_0x3d42a3[_0x7995('0x2c')]['ids']),'VoiceQueueId':Number(_0x3d42a3[_0x7995('0x30')]['id'])});}});}})[_0x7995('0x19')](function(_0x38e67a){return db[_0x7995('0x6a')]['destroy']({'where':{'VoiceQueueId':_0x3d42a3['params']['id'],'UserId':_0x3d42a3['query']['ids']}})['then'](function(){return _0x38e67a;});})[_0x7995('0x19')](respondWithStatusCode(_0x29fb77,null))['catch'](handleError(_0x29fb77,null));};exports['getAgents']=function(_0x32f19d,_0x44dbb8){var _0x181ed6={};var _0x48b807={};var _0xba00af;var _0x4f008a;return db[_0x7995('0x39')][_0x7995('0x4d')]({'where':{'id':_0x32f19d[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x44dbb8,null))[_0x7995('0x19')](function(_0x14be06){if(_0x14be06){_0xba00af=_0x14be06;_0x48b807[_0x7995('0x31')]=_['keys'](db[_0x7995('0x71')][_0x7995('0x32')]);_0x48b807[_0x7995('0x2c')]=_[_0x7995('0x4e')](_0x32f19d[_0x7995('0x2c')]);_0x48b807['filters']=_[_0x7995('0x35')](_0x48b807[_0x7995('0x31')],_0x48b807[_0x7995('0x2c')]);_0x181ed6['attributes']=_[_0x7995('0x35')](_0x48b807[_0x7995('0x31')],qs[_0x7995('0x36')](_0x32f19d[_0x7995('0x2c')][_0x7995('0x36')]));_0x181ed6['attributes']=_0x181ed6[_0x7995('0x34')][_0x7995('0x44')]?_0x181ed6[_0x7995('0x34')]:_0x48b807[_0x7995('0x31')];_0x181ed6[_0x7995('0x4f')]=qs[_0x7995('0x50')](_0x32f19d[_0x7995('0x2c')]['sort']);_0x181ed6['where']=qs[_0x7995('0x33')](_[_0x7995('0x52')](_0x32f19d['query'],_0x48b807['filters']));if(_0x32f19d[_0x7995('0x2c')][_0x7995('0x1c')]){_0x181ed6[_0x7995('0x51')]=_[_0x7995('0x38')](_0x181ed6[_0x7995('0x51')],{'$or':_[_0x7995('0x1e')](_0x181ed6[_0x7995('0x34')],function(_0x4dca11){var _0xf90cd8={};_0xf90cd8[_0x4dca11]={'$like':'%'+_0x32f19d[_0x7995('0x2c')][_0x7995('0x1c')]+'%'};return _0xf90cd8;})});}_0x181ed6=_[_0x7995('0x38')]({},_0x181ed6,_0x32f19d[_0x7995('0x45')]);return _0xba00af[_0x7995('0x88')](_0x181ed6);}})['then'](function(_0x1d7c33){if(_0x1d7c33){_0x4f008a=_0x1d7c33[_0x7995('0x44')];if(!_0x32f19d[_0x7995('0x2c')][_0x7995('0x57')](_0x7995('0x5b'))){_0x181ed6[_0x7995('0x15')]=qs[_0x7995('0x15')](_0x32f19d['query'][_0x7995('0x15')]);_0x181ed6[_0x7995('0x13')]=qs[_0x7995('0x13')](_0x32f19d[_0x7995('0x2c')]['offset']);}return _0xba00af[_0x7995('0x88')](_0x181ed6);}})['then'](function(_0x21ba9b){if(_0x21ba9b){return _0x21ba9b?{'count':_0x4f008a,'rows':_0x21ba9b}:null;}})[_0x7995('0x19')](respondWithResult(_0x44dbb8,null))['catch'](handleError(_0x44dbb8,null));};exports['getMembers']=function(_0x478c12,_0x3b22ec){var _0xf503d5={};var _0x7d2ccf={};var _0x18a3dc;var _0x503b32;return db[_0x7995('0x39')][_0x7995('0x4d')]({'where':{'id':_0x478c12[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x3b22ec,null))[_0x7995('0x19')](function(_0x1fa484){if(_0x1fa484){_0x18a3dc=_0x1fa484;_0x7d2ccf[_0x7995('0x31')]=_['keys'](db['UserVoiceQueueRt'][_0x7995('0x32')]);_0x7d2ccf['query']=_['keys'](_0x478c12[_0x7995('0x2c')]);_0x7d2ccf[_0x7995('0x33')]=_[_0x7995('0x35')](_0x7d2ccf[_0x7995('0x31')],_0x7d2ccf[_0x7995('0x2c')]);_0xf503d5[_0x7995('0x34')]=_[_0x7995('0x35')](_0x7d2ccf[_0x7995('0x31')],qs[_0x7995('0x36')](_0x478c12[_0x7995('0x2c')][_0x7995('0x36')]));_0xf503d5[_0x7995('0x34')]=_0xf503d5['attributes'][_0x7995('0x44')]?_0xf503d5[_0x7995('0x34')]:_0x7d2ccf[_0x7995('0x31')];_0xf503d5[_0x7995('0x4f')]=qs[_0x7995('0x50')](_0x478c12[_0x7995('0x2c')][_0x7995('0x50')]);_0xf503d5['where']=qs[_0x7995('0x33')](_[_0x7995('0x52')](_0x478c12[_0x7995('0x2c')],_0x7d2ccf[_0x7995('0x33')]));if(_0x478c12[_0x7995('0x2c')]['filter']){_0xf503d5[_0x7995('0x51')]=_['merge'](_0xf503d5[_0x7995('0x51')],{'$or':_[_0x7995('0x1e')](_0xf503d5[_0x7995('0x34')],function(_0x5150aa){var _0x260e84={};_0x260e84[_0x5150aa]={'$like':'%'+_0x478c12[_0x7995('0x2c')][_0x7995('0x1c')]+'%'};return _0x260e84;})});}_0xf503d5=_[_0x7995('0x38')]({},_0xf503d5,_0x478c12[_0x7995('0x45')]);return _0x18a3dc[_0x7995('0x89')](_0xf503d5);}})[_0x7995('0x19')](function(_0x4fb899){if(_0x4fb899){_0x503b32=_0x4fb899['length'];if(!_0x478c12[_0x7995('0x2c')][_0x7995('0x57')](_0x7995('0x5b'))){_0xf503d5[_0x7995('0x15')]=qs[_0x7995('0x15')](_0x478c12[_0x7995('0x2c')]['limit']);_0xf503d5[_0x7995('0x13')]=qs[_0x7995('0x13')](_0x478c12[_0x7995('0x2c')][_0x7995('0x13')]);}return _0x18a3dc['getMembers'](_0xf503d5);}})['then'](function(_0x5b93e6){return _0x5b93e6?{'count':_0x503b32,'rows':_0x5b93e6}:null;})[_0x7995('0x19')](respondWithResult(_0x3b22ec,null))['catch'](handleError(_0x3b22ec,null));};exports[_0x7995('0x8a')]=function(_0x1b6411,_0x54e348){var _0x390bd3={};var _0x3f0a01={};var _0x45d8a2;var _0x26ab59;return db[_0x7995('0x39')]['findOne']({'where':{'id':_0x1b6411['params']['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x54e348,null))[_0x7995('0x19')](function(_0x2cfa1d){if(_0x2cfa1d){_0x45d8a2=_0x2cfa1d;_0x3f0a01[_0x7995('0x31')]=_[_0x7995('0x4e')](db['CmList'][_0x7995('0x32')]);_0x3f0a01[_0x7995('0x2c')]=_[_0x7995('0x4e')](_0x1b6411[_0x7995('0x2c')]);_0x3f0a01[_0x7995('0x33')]=_['intersection'](_0x3f0a01['model'],_0x3f0a01['query']);_0x390bd3['attributes']=_[_0x7995('0x35')](_0x3f0a01[_0x7995('0x31')],qs['fields'](_0x1b6411[_0x7995('0x2c')][_0x7995('0x36')]));_0x390bd3['attributes']=_0x390bd3['attributes'][_0x7995('0x44')]?_0x390bd3[_0x7995('0x34')]:_0x3f0a01[_0x7995('0x31')];_0x390bd3[_0x7995('0x4f')]=qs[_0x7995('0x50')](_0x1b6411[_0x7995('0x2c')][_0x7995('0x50')]);_0x390bd3['where']=qs['filters'](_[_0x7995('0x52')](_0x1b6411[_0x7995('0x2c')],_0x3f0a01[_0x7995('0x33')]));if(_0x1b6411['query'][_0x7995('0x1c')]){_0x390bd3[_0x7995('0x51')]=_[_0x7995('0x38')](_0x390bd3[_0x7995('0x51')],{'$or':_[_0x7995('0x1e')](_0x390bd3[_0x7995('0x34')],function(_0x28ac7c){var _0x1b4cab={};_0x1b4cab[_0x28ac7c]={'$like':'%'+_0x1b6411[_0x7995('0x2c')]['filter']+'%'};return _0x1b4cab;})});}_0x390bd3=_['merge']({},_0x390bd3,_0x1b6411[_0x7995('0x45')]);return _0x45d8a2['getLists'](_0x390bd3);}})[_0x7995('0x19')](function(_0x5953d1){if(_0x5953d1){_0x26ab59=_0x5953d1[_0x7995('0x44')];if(!_0x1b6411[_0x7995('0x2c')][_0x7995('0x57')]('nolimit')){_0x390bd3['limit']=qs[_0x7995('0x15')](_0x1b6411[_0x7995('0x2c')][_0x7995('0x15')]);_0x390bd3[_0x7995('0x13')]=qs[_0x7995('0x13')](_0x1b6411[_0x7995('0x2c')][_0x7995('0x13')]);}return _0x45d8a2[_0x7995('0x8a')](_0x390bd3);}})[_0x7995('0x19')](function(_0x35403c){if(_0x35403c){return _0x35403c?{'count':_0x26ab59,'rows':_0x35403c}:null;}})[_0x7995('0x19')](respondWithResult(_0x54e348,null))['catch'](handleError(_0x54e348,null));};exports[_0x7995('0x8b')]=function(_0xe43c99,_0x1b7e44){var _0x442c6d=moment()[_0x7995('0x6c')]('YYYY-MM-DD\x20HH:mm:ss');var _0x3b5edf,_0x44068f;return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0xe43c99[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x1b7e44,null))[_0x7995('0x19')](function(_0x2b812f){if(_0x2b812f){_0x44068f=_0x2b812f;return _0x2b812f[_0x7995('0x8b')](_0xe43c99['body']['ids'],_[_0x7995('0x46')](_0xe43c99[_0x7995('0x3b')],[_0x7995('0x70'),'id'])||{});}return null;})[_0x7995('0x8c')](function(_0x17fd98){var _0x498d7c;_0x3b5edf=_0x17fd98||[];var _0x341024=[];if(_0x17fd98){for(var _0x2bcbc6=0x0;_0x2bcbc6<_0x17fd98[_0x7995('0x44')];_0x2bcbc6+=0x1){var _0x2dd6c7=_0x17fd98[_0x2bcbc6][_0x7995('0x3c')]({'plain':!![]});_0x44068f[_0x7995('0x8d')]=_0xe43c99[_0x7995('0x3b')][_0x7995('0x8d')]?_0xe43c99[_0x7995('0x3b')]['dialCheckDuplicateType']:_0x44068f['dialCheckDuplicateType'];switch(_0x44068f[_0x7995('0x8d')]){case _0x7995('0x8e'):_0x498d7c=squel[_0x7995('0x8f')]()[_0x7995('0x90')](_0x7995('0x91'))[_0x7995('0x92')]([_0x7995('0x93'),_0x7995('0x94'),'ContactId','ListId',_0x7995('0x58'),_0x7995('0x95'),_0x7995('0x47')],squel[_0x7995('0x96')]()['field']('phone',_0x7995('0x93'))[_0x7995('0x72')]('\x27'+_0x442c6d+'\x27',_0x7995('0x94'))[_0x7995('0x72')]('id',_0x7995('0x97'))[_0x7995('0x72')](_0x2dd6c7[_0x7995('0x98')][_0x7995('0x79')](),_0x7995('0x99'))[_0x7995('0x72')](_0xe43c99[_0x7995('0x30')]['id'][_0x7995('0x79')](),'VoiceQueueId')['field']('\x27'+_0x442c6d+'\x27',_0x7995('0x95'))[_0x7995('0x72')]('\x27'+_0x442c6d+'\x27',_0x7995('0x47'))[_0x7995('0x9a')]('cm_contacts')[_0x7995('0x51')]('deletedAt\x20IS\x20NULL')[_0x7995('0x51')](_0x7995('0x9b'),_0x2dd6c7[_0x7995('0x98')][_0x7995('0x79')]())[_0x7995('0x51')](_0x7995('0x9c'))['where'](_0x7995('0x9d'),squel[_0x7995('0x96')]()[_0x7995('0x72')](_0x7995('0x9e'))['from']('cm_hopper_final')[_0x7995('0x51')](_0x7995('0x9f'),_0xe43c99[_0x7995('0x30')]['id'][_0x7995('0x79')]()))['where'](_0x7995('0x9d'),squel[_0x7995('0x96')]()[_0x7995('0x72')]('COALESCE(phone,\x27\x27)')[_0x7995('0x9a')](_0x7995('0x91'))[_0x7995('0x51')]('VoiceQueueId\x20=\x20?',_0xe43c99[_0x7995('0x30')]['id'][_0x7995('0x79')]())))[_0x7995('0x79')]();break;case _0x7995('0xa0'):_0x498d7c=squel[_0x7995('0x8f')]()[_0x7995('0x90')](_0x7995('0x91'))[_0x7995('0x92')]([_0x7995('0x93'),'scheduledAt',_0x7995('0x97'),_0x7995('0x99'),_0x7995('0x58'),_0x7995('0x95'),'updatedAt'],squel[_0x7995('0x96')]()[_0x7995('0x72')](_0x7995('0x93'),_0x7995('0x93'))['field']('\x27'+_0x442c6d+'\x27',_0x7995('0x94'))[_0x7995('0x72')]('id',_0x7995('0x97'))[_0x7995('0x72')](_0x2dd6c7[_0x7995('0x98')][_0x7995('0x79')](),_0x7995('0x99'))['field'](_0xe43c99[_0x7995('0x30')]['id'][_0x7995('0x79')](),_0x7995('0x58'))[_0x7995('0x72')]('\x27'+_0x442c6d+'\x27',_0x7995('0x95'))['field']('\x27'+_0x442c6d+'\x27',_0x7995('0x47'))['from'](_0x7995('0xa1'))[_0x7995('0x51')](_0x7995('0xa2'))['where']('ListId\x20=\x20?',_0x2dd6c7['CmListId'][_0x7995('0x79')]())[_0x7995('0x51')](_0x7995('0x9c'))[_0x7995('0x51')](_0x7995('0x9d'),squel[_0x7995('0x96')]()['field'](_0x7995('0xa3'))[_0x7995('0x9a')](_0x7995('0x91'))[_0x7995('0x51')]('VoiceQueueId\x20=\x20?',_0xe43c99[_0x7995('0x30')]['id'][_0x7995('0x79')]())))['toString']();break;default:_0x498d7c=squel[_0x7995('0x8f')]()['into'](_0x7995('0x91'))[_0x7995('0x92')]([_0x7995('0x93'),'scheduledAt','ContactId',_0x7995('0x99'),_0x7995('0x58'),_0x7995('0x95'),_0x7995('0x47')],squel[_0x7995('0x96')]()[_0x7995('0x72')](_0x7995('0x93'),_0x7995('0x93'))[_0x7995('0x72')]('\x27'+_0x442c6d+'\x27',_0x7995('0x94'))[_0x7995('0x72')]('id','ContactId')['field'](_0x2dd6c7[_0x7995('0x98')][_0x7995('0x79')](),_0x7995('0x99'))[_0x7995('0x72')](_0xe43c99['params']['id']['toString'](),_0x7995('0x58'))[_0x7995('0x72')]('\x27'+_0x442c6d+'\x27','createdAt')['field']('\x27'+_0x442c6d+'\x27',_0x7995('0x47'))[_0x7995('0x9a')](_0x7995('0xa1'))[_0x7995('0x51')](_0x7995('0xa2'))['where'](_0x7995('0x9b'),_0x2dd6c7[_0x7995('0x98')]['toString']())[_0x7995('0x51')](_0x7995('0x9c')))[_0x7995('0x79')]();}_0x341024['push'](db[_0x7995('0x7a')][_0x7995('0x2c')](_0x498d7c));}return BPromise[_0x7995('0x7d')](_0x341024);}})[_0x7995('0x19')](function(){var _0x113e03=[];var _0x5348b1=squel['insert']()[_0x7995('0x90')]('cm_hopper_additional_phones')[_0x7995('0x92')](['CmHopperId',_0x7995('0x93'),_0x7995('0xa4'),_0x7995('0x95'),'updatedAt'],squel['select']()['field'](_0x7995('0xa5'))[_0x7995('0x72')](_0x7995('0xa6'))['field'](_0x7995('0xa7'))[_0x7995('0x72')]('\x27'+_0x442c6d+'\x27','createdAt')[_0x7995('0x72')]('\x27'+_0x442c6d+'\x27',_0x7995('0x47'))[_0x7995('0x9a')](_0x7995('0xa8'),'ci')[_0x7995('0xa9')]('cm_hopper','h','h.ContactId=ci.CmContactId')[_0x7995('0x51')](_0x7995('0xaa'),_0x442c6d)[_0x7995('0x51')](_0x7995('0xab'),_0x7995('0xac')))[_0x7995('0x79')]();_0x113e03[_0x7995('0x78')](db[_0x7995('0x7a')][_0x7995('0x2c')](_0x5348b1));return BPromise[_0x7995('0x7d')](_0x113e03);})['then'](function(){return _0x3b5edf;})[_0x7995('0x19')](respondWithResult(_0x1b7e44,null))[_0x7995('0x2e')](handleError(_0x1b7e44,null));};exports[_0x7995('0xad')]=function(_0xff759b,_0x39ee00){return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0xff759b['params']['id']}})['then'](handleEntityNotFound(_0x39ee00,null))[_0x7995('0x19')](function(_0x2aec8d){if(_0x2aec8d){return _0x2aec8d[_0x7995('0xad')](_0xff759b[_0x7995('0x2c')]['ids']);}})['then'](function(_0x4b477a){if(_0x4b477a){return db[_0x7995('0x53')][_0x7995('0x25')]({'where':{'ListId':_0xff759b['query'][_0x7995('0x70')],'VoiceQueueId':_0xff759b[_0x7995('0x30')]['id']}})[_0x7995('0x19')](function(){return _0x4b477a;});}})[_0x7995('0x19')](respondWithStatusCode(_0x39ee00,null))[_0x7995('0x2e')](handleError(_0x39ee00,null));};exports[_0x7995('0xae')]=function(_0x35229d,_0x22d392){var _0x57438e={};var _0x463c25={};var _0x13d525;var _0x37b7e7;return db['VoiceQueue'][_0x7995('0x4d')]({'where':{'id':_0x35229d['params']['id']}})['then'](handleEntityNotFound(_0x22d392,null))['then'](function(_0x507bf3){if(_0x507bf3){_0x13d525=_0x507bf3;_0x463c25[_0x7995('0x31')]=_['keys'](db[_0x7995('0xaf')][_0x7995('0x32')]);_0x463c25['query']=_[_0x7995('0x4e')](_0x35229d[_0x7995('0x2c')]);_0x463c25[_0x7995('0x33')]=_[_0x7995('0x35')](_0x463c25['model'],_0x463c25[_0x7995('0x2c')]);_0x57438e['attributes']=_[_0x7995('0x35')](_0x463c25[_0x7995('0x31')],qs[_0x7995('0x36')](_0x35229d[_0x7995('0x2c')][_0x7995('0x36')]));_0x57438e[_0x7995('0x34')]=_0x57438e[_0x7995('0x34')][_0x7995('0x44')]?_0x57438e[_0x7995('0x34')]:_0x463c25[_0x7995('0x31')];_0x57438e['order']=qs[_0x7995('0x50')](_0x35229d[_0x7995('0x2c')]['sort']);_0x57438e[_0x7995('0x51')]=qs[_0x7995('0x33')](_[_0x7995('0x52')](_0x35229d[_0x7995('0x2c')],_0x463c25[_0x7995('0x33')]));if(_0x35229d[_0x7995('0x2c')]['filter']){_0x57438e[_0x7995('0x51')]=_['merge'](_0x57438e[_0x7995('0x51')],{'$or':_[_0x7995('0x1e')](_0x57438e[_0x7995('0x34')],function(_0xb79b0b){var _0x259bf2={};_0x259bf2[_0xb79b0b]={'$like':'%'+_0x35229d[_0x7995('0x2c')]['filter']+'%'};return _0x259bf2;})});}_0x57438e=_[_0x7995('0x38')]({},_0x57438e,_0x35229d[_0x7995('0x45')]);return _0x13d525[_0x7995('0xae')](_0x57438e);}})['then'](function(_0x1176cd){if(_0x1176cd){_0x37b7e7=_0x1176cd[_0x7995('0x44')];if(!_0x35229d[_0x7995('0x2c')][_0x7995('0x57')](_0x7995('0x5b'))){_0x57438e[_0x7995('0x15')]=qs[_0x7995('0x15')](_0x35229d[_0x7995('0x2c')][_0x7995('0x15')]);_0x57438e[_0x7995('0x13')]=qs[_0x7995('0x13')](_0x35229d['query'][_0x7995('0x13')]);}return _0x13d525[_0x7995('0xae')](_0x57438e);}})['then'](function(_0x3098ef){if(_0x3098ef){return _0x3098ef?{'count':_0x37b7e7,'rows':_0x3098ef}:null;}})[_0x7995('0x19')](respondWithResult(_0x22d392,null))[_0x7995('0x2e')](handleError(_0x22d392,null));};exports[_0x7995('0xb0')]=function(_0x258f87,_0x5a5cc4){var _0x37af6b;return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0x258f87[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x5a5cc4,null))[_0x7995('0x19')](function(_0x120bef){if(_0x120bef){return _0x120bef[_0x7995('0xb0')](_0x258f87[_0x7995('0x3b')][_0x7995('0x70')],_[_0x7995('0x46')](_0x258f87[_0x7995('0x3b')],[_0x7995('0x70'),'id'])||{});}return null;})['spread'](function(_0x247b71){var _0x1ecb6f;_0x37af6b=_0x247b71||[];var _0x225a37=[];if(_0x247b71){for(var _0x1a9f59=0x0;_0x1a9f59<_0x247b71['length'];_0x1a9f59+=0x1){var _0x92a561=_0x247b71[_0x1a9f59][_0x7995('0x3c')]({'plain':!![]});_0x1ecb6f=squel[_0x7995('0x8f')]()[_0x7995('0x90')](_0x7995('0xb1'))[_0x7995('0x92')]([_0x7995('0x93'),'ContactId',_0x7995('0x99'),'VoiceQueueId',_0x7995('0x95'),_0x7995('0x47')],squel[_0x7995('0x96')]()['field']('phone',_0x7995('0x93'))[_0x7995('0x72')]('id',_0x7995('0x97'))['field'](_0x92a561[_0x7995('0x98')]['toString'](),_0x7995('0x99'))[_0x7995('0x72')](_0x258f87[_0x7995('0x30')]['id'][_0x7995('0x79')](),_0x7995('0x58'))[_0x7995('0x72')]('NOW()',_0x7995('0x95'))[_0x7995('0x72')]('NOW()',_0x7995('0x47'))[_0x7995('0x9a')](_0x7995('0xa1'))[_0x7995('0x51')](_0x7995('0xa2'))[_0x7995('0x51')](_0x7995('0x9b'),_0x92a561[_0x7995('0x98')][_0x7995('0x79')]())[_0x7995('0x51')](_0x7995('0x9c')))[_0x7995('0x79')]();_0x225a37[_0x7995('0x78')](db[_0x7995('0x7a')][_0x7995('0x2c')](_0x1ecb6f));}return BPromise[_0x7995('0x7d')](_0x225a37);}})[_0x7995('0x19')](function(){return _0x37af6b;})['then'](respondWithResult(_0x5a5cc4,null))['catch'](handleError(_0x5a5cc4,null));};exports[_0x7995('0xb2')]=function(_0x2f3c17,_0x4fe5eb){return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0x2f3c17['params']['id']}})['then'](handleEntityNotFound(_0x4fe5eb,null))[_0x7995('0x19')](function(_0x31a3d6){if(_0x31a3d6){return _0x31a3d6[_0x7995('0xb2')](_0x2f3c17[_0x7995('0x2c')][_0x7995('0x70')]);}})[_0x7995('0x19')](function(_0x1b3920){if(_0x1b3920){return db[_0x7995('0x5d')][_0x7995('0x25')]({'where':{'ListId':_0x2f3c17[_0x7995('0x2c')]['ids'],'VoiceQueueId':_0x2f3c17[_0x7995('0x30')]['id']}})[_0x7995('0x19')](function(){return _0x1b3920;});}})[_0x7995('0x19')](respondWithStatusCode(_0x4fe5eb,null))[_0x7995('0x2e')](handleError(_0x4fe5eb,null));}; \ No newline at end of file +var _0x4b84=['type','find','UserProfileResource','stack','name','send','index','rawAttributes','fieldName','key','getOptions','where','VoiceQueue','include','findAll','rows','catch','show','params','model','keys','query','filters','intersection','attributes','fields','length','includeAll','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','userProfileId','findOne','hasOwnProperty','nolimit','order','sort','VoiceQueueId','CmHopper','getHopperHistories','pick','CmHopperHistory','CmHopperFinal','CmHopperBlack','getTeams','Team','addTeams','User','Agents','voicePause','interface','forEach','penalty','transaction','TeamVoiceQueue','each','UserVoiceQueue','UserVoiceQueueRt','upsert','format','SIP/%s','emit','ids','field','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','sequelize','SELECT','TeamId','all','removeTeams','isEmpty','removeAgents','addAgents','spread','userVoiceQueue:save','online','isNil','isArray','userVoiceQueue:remove','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','fromQuery','phone','scheduledAt','ContactId','ListId','select','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','insert','into','CmHopperId','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','h.scheduledat=?','ci.ItemClass=?','removeLists','getBlackLists','NOW()','removeBlackLists','moment','bluebird','squel','../../config/logger','api','../../config/environment','redis','socket.io-emitter','./voiceQueue.socket','sendStatus','end','status','json','undefined','count','offset','limit','update','destroy','then','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4b84,0x1cc));var _0x44b8=function(_0x47df54,_0x1aeb61){_0x47df54=_0x47df54-0x0;var _0x261b87=_0x4b84[_0x47df54];return _0x261b87;};'use strict';var moment=require(_0x44b8('0x0'));var BPromise=require(_0x44b8('0x1'));var util=require('util');var _=require('lodash');var squel=require(_0x44b8('0x2'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x44b8('0x3'))(_0x44b8('0x4'));var config=require(_0x44b8('0x5'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x44b8('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0x44b8('0x7'))(new Redis(config['redis']));require(_0x44b8('0x8'))['register'](socket);function respondWithStatusCode(_0x5034b6,_0x41d515){_0x41d515=_0x41d515||0xcc;return function(_0x42319d){if(_0x42319d){return _0x5034b6[_0x44b8('0x9')](_0x41d515);}return _0x5034b6['status'](_0x41d515)[_0x44b8('0xa')]();};}function respondWithResult(_0x2cc74b,_0x4315f6){_0x4315f6=_0x4315f6||0xc8;return function(_0x9b6048){if(_0x9b6048){return _0x2cc74b[_0x44b8('0xb')](_0x4315f6)[_0x44b8('0xc')](_0x9b6048);}};}function respondWithFilteredResult(_0xe9a025,_0x4ae8a1){return function(_0x147529){if(_0x147529){var _0x4301a6=typeof _0x4ae8a1['offset']===_0x44b8('0xd')&&typeof _0x4ae8a1['limit']===_0x44b8('0xd');var _0x18d642=_0x147529['count'];var _0x63e8f6=_0x4301a6?0x0:_0x4ae8a1['offset'];var _0x54fa95=_0x4301a6?_0x147529[_0x44b8('0xe')]:_0x4ae8a1[_0x44b8('0xf')]+_0x4ae8a1[_0x44b8('0x10')];var _0x41ab46;if(_0x54fa95>=_0x18d642){_0x54fa95=_0x18d642;_0x41ab46=0xc8;}else{_0x41ab46=0xce;}_0xe9a025['status'](_0x41ab46);return _0xe9a025['set']('Content-Range',_0x63e8f6+'-'+_0x54fa95+'/'+_0x18d642)[_0x44b8('0xc')](_0x147529);}return null;};}function saveUpdates(_0x5b7803){return function(_0x28ef36){if(_0x28ef36){return _0x28ef36[_0x44b8('0x11')](_0x5b7803)['then'](function(_0x36743e){return _0x36743e;});}return null;};}function removeEntity(_0xe3de8f){return function(_0x5103f5){if(_0x5103f5){return _0x5103f5[_0x44b8('0x12')]()[_0x44b8('0x13')](function(){var _0x4b600f=_0x5103f5[_0x44b8('0x14')]({'plain':!![]});var _0x8b4301=[{'name':_0x44b8('0x15'),'value':_0x44b8('0x16'),'ignore':![]},{'name':_0x44b8('0x17'),'value':_0x44b8('0x18'),'ignore':![]}];var _0x452f2f=_(_0x8b4301)[_0x44b8('0x19')](_0x44b8('0x1a'))[_0x44b8('0x1b')](_0x44b8('0x1c'))[_0x44b8('0x1c')]();if(_['includes'](_0x452f2f,_0x4b600f[_0x44b8('0x1d')])){return;}var _0x3a8aa4=_[_0x44b8('0x1e')](_0x8b4301,[_0x44b8('0x1c'),_0x4b600f[_0x44b8('0x1d')]])['name'];return db[_0x44b8('0x1f')]['destroy']({'where':{'type':_0x3a8aa4,'resourceId':_0x4b600f['id']}})[_0x44b8('0x13')](function(){return _0x5103f5;});})[_0x44b8('0x13')](function(){_0xe3de8f[_0x44b8('0xb')](0xcc)[_0x44b8('0xa')]();});}};}function handleEntityNotFound(_0x230a3d){return function(_0x59acbc){if(!_0x59acbc){_0x230a3d[_0x44b8('0x9')](0x194);}return _0x59acbc;};}function handleError(_0x502acf,_0x41d673){_0x41d673=_0x41d673||0x1f4;return function(_0x350482){logger['error'](_0x350482[_0x44b8('0x20')]);if(_0x350482[_0x44b8('0x21')]){delete _0x350482[_0x44b8('0x21')];}_0x502acf['status'](_0x41d673)[_0x44b8('0x22')](_0x350482);};}exports[_0x44b8('0x23')]=function(_0x53d9c7,_0x2e0174){var _0x4a182d={};var _0xfb0028={'count':0x0,'rows':[]};var _0x5a544c=_['map'](db['VoiceQueue'][_0x44b8('0x24')],function(_0x29b18d){return{'name':_0x29b18d[_0x44b8('0x25')],'type':_0x29b18d[_0x44b8('0x1d')][_0x44b8('0x26')]};});_0x4a182d=qs[_0x44b8('0x27')](_0x5a544c,_0x53d9c7);var _0x2cf205={'where':_0x4a182d[_0x44b8('0x28')]};return db[_0x44b8('0x29')][_0x44b8('0xe')](_0x2cf205)[_0x44b8('0x13')](function(_0x417d81){_0xfb0028[_0x44b8('0xe')]=_0x417d81;_0x4a182d['include']=qs[_0x44b8('0x2a')](_0x53d9c7['query']);return db[_0x44b8('0x29')][_0x44b8('0x2b')](_0x4a182d);})[_0x44b8('0x13')](function(_0xb64609){_0xfb0028[_0x44b8('0x2c')]=_0xb64609;return _0xfb0028;})['then'](respondWithFilteredResult(_0x2e0174,_0x4a182d))[_0x44b8('0x2d')](handleError(_0x2e0174,null));};exports[_0x44b8('0x2e')]=function(_0x26265f,_0x339f0f){var _0x46b008={'raw':![],'where':{'id':_0x26265f[_0x44b8('0x2f')]['id']}},_0x5f541d={};_0x5f541d[_0x44b8('0x30')]=_[_0x44b8('0x31')](db[_0x44b8('0x29')][_0x44b8('0x24')]);_0x5f541d[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x26265f[_0x44b8('0x32')]);_0x5f541d[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x5f541d[_0x44b8('0x30')],_0x5f541d[_0x44b8('0x32')]);_0x46b008[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x5f541d[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x26265f[_0x44b8('0x32')][_0x44b8('0x36')]));_0x46b008[_0x44b8('0x35')]=_0x46b008[_0x44b8('0x35')][_0x44b8('0x37')]?_0x46b008[_0x44b8('0x35')]:_0x5f541d['model'];if(_0x26265f[_0x44b8('0x32')][_0x44b8('0x38')]){_0x46b008['include']=[{'all':!![]}];}_0x46b008=_[_0x44b8('0x39')]({},_0x46b008,_0x26265f[_0x44b8('0x3a')]);return db[_0x44b8('0x29')][_0x44b8('0x1e')](_0x46b008)['then'](handleEntityNotFound(_0x339f0f,null))[_0x44b8('0x13')](respondWithResult(_0x339f0f,null))[_0x44b8('0x2d')](handleError(_0x339f0f,null));};exports[_0x44b8('0x3b')]=function(_0x1ee3cc,_0x9cb2a){return db[_0x44b8('0x29')][_0x44b8('0x3b')](_0x1ee3cc[_0x44b8('0x3c')],{})[_0x44b8('0x13')](function(_0x3d1be1){var _0x1c9983=_0x1ee3cc[_0x44b8('0x3d')][_0x44b8('0x14')]({'plain':!![]});if(!_0x1c9983)throw new Error(_0x44b8('0x3e'));if(_0x1c9983[_0x44b8('0x3f')]===_0x44b8('0x3d')){var _0x57d8c4=_0x3d1be1[_0x44b8('0x14')]({'plain':!![]});var _0x43e43a=[{'name':_0x44b8('0x15'),'value':'inbound'},{'name':_0x44b8('0x17'),'value':_0x44b8('0x18')}];var _0x229cc9=_['find'](_0x43e43a,[_0x44b8('0x1c'),_0x57d8c4[_0x44b8('0x1d')]])[_0x44b8('0x21')];return db[_0x44b8('0x40')][_0x44b8('0x1e')]({'where':{'name':_0x229cc9,'userProfileId':_0x1c9983['userProfileId']},'raw':!![]})['then'](function(_0x215f7b){if(_0x215f7b&&_0x215f7b[_0x44b8('0x41')]===0x0){return db[_0x44b8('0x1f')][_0x44b8('0x3b')]({'name':_0x57d8c4[_0x44b8('0x21')],'resourceId':_0x57d8c4['id'],'type':_0x215f7b[_0x44b8('0x21')],'sectionId':_0x215f7b['id']},{})[_0x44b8('0x13')](function(){return _0x3d1be1;});}else{return _0x3d1be1;}})[_0x44b8('0x2d')](function(_0x455fd6){logger[_0x44b8('0x42')](_0x44b8('0x43'),_0x455fd6);throw _0x455fd6;});}return _0x3d1be1;})[_0x44b8('0x13')](respondWithResult(_0x9cb2a,0xc9))[_0x44b8('0x2d')](handleError(_0x9cb2a,null));};exports[_0x44b8('0x44')]=function(_0x149731,_0x60eeb2){var _0xce06dc={'where':{'id':_0x149731[_0x44b8('0x2f')]['id']}},_0x3b3d5d={};_0x3b3d5d['model']=_['keys'](db[_0x44b8('0x29')][_0x44b8('0x24')]);_0xce06dc[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x3b3d5d[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x149731[_0x44b8('0x32')]['fields']));_0xce06dc[_0x44b8('0x35')]=_0xce06dc['attributes'][_0x44b8('0x37')]?_0xce06dc[_0x44b8('0x35')]:_0x3b3d5d[_0x44b8('0x30')];if(_0x149731[_0x44b8('0x32')][_0x44b8('0x38')]){_0xce06dc[_0x44b8('0x2a')]=[{'all':!![]}];}_0xce06dc=_['merge']({},_0xce06dc,_0x149731[_0x44b8('0x3a')]);return db[_0x44b8('0x29')][_0x44b8('0x1e')](_0xce06dc)[_0x44b8('0x13')](handleEntityNotFound(_0x60eeb2,null))['then'](function(_0x4e4ed1){if(_0x4e4ed1){var _0x2f549d=_0x4e4ed1[_0x44b8('0x14')]({'plain':!![]});_0x2f549d=qs[_0x44b8('0x45')](_0x2f549d,['id',_0x44b8('0x46'),_0x44b8('0x47')]);_0x149731['body']=_[_0x44b8('0x45')](_0x149731[_0x44b8('0x3c')],['id',_0x44b8('0x46'),_0x44b8('0x47')]);return db[_0x44b8('0x29')]['create'](_['merge'](_0x2f549d,_0x149731[_0x44b8('0x3c')]),{'include':_0x149731['query'][_0x44b8('0x38')]?[{'all':!![]}]:undefined})['then'](function(_0x40164d){var _0x434d6a=_0x149731[_0x44b8('0x3d')][_0x44b8('0x14')]({'plain':!![]});if(!_0x434d6a)throw new Error(_0x44b8('0x3e'));if(_0x434d6a[_0x44b8('0x3f')]===_0x44b8('0x3d')){var _0x533967=_0x40164d[_0x44b8('0x14')]({'plain':!![]});var _0x37b2c2=[{'name':_0x44b8('0x15'),'value':'inbound'},{'name':_0x44b8('0x17'),'value':_0x44b8('0x18')}];var _0x45f9a0=_[_0x44b8('0x1e')](_0x37b2c2,['value',_0x533967[_0x44b8('0x1d')]])[_0x44b8('0x21')];return db['UserProfileSection'][_0x44b8('0x1e')]({'where':{'name':_0x45f9a0,'userProfileId':_0x434d6a[_0x44b8('0x48')]},'raw':!![]})[_0x44b8('0x13')](function(_0x3df6aa){if(_0x3df6aa&&_0x3df6aa[_0x44b8('0x41')]===0x0){return db['UserProfileResource']['create']({'name':_0x533967[_0x44b8('0x21')],'resourceId':_0x533967['id'],'type':_0x3df6aa[_0x44b8('0x21')],'sectionId':_0x3df6aa['id']},{})[_0x44b8('0x13')](function(){return _0x40164d;});}else{return _0x40164d;}})[_0x44b8('0x2d')](function(_0x765e45){logger[_0x44b8('0x42')](_0x44b8('0x43'),_0x765e45);throw _0x765e45;});}return _0x40164d;});}})[_0x44b8('0x13')](respondWithResult(_0x60eeb2,0xc9))[_0x44b8('0x2d')](handleError(_0x60eeb2,null));};exports[_0x44b8('0x11')]=function(_0x16c628,_0x3f7576){if(_0x16c628['body']['id']){delete _0x16c628[_0x44b8('0x3c')]['id'];}return db[_0x44b8('0x29')][_0x44b8('0x1e')]({'where':{'id':_0x16c628[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x3f7576,null))[_0x44b8('0x13')](saveUpdates(_0x16c628[_0x44b8('0x3c')],null))[_0x44b8('0x13')](respondWithResult(_0x3f7576,null))[_0x44b8('0x2d')](handleError(_0x3f7576,null));};exports[_0x44b8('0x12')]=function(_0x2ecff9,_0x15bcba){return db[_0x44b8('0x29')][_0x44b8('0x1e')]({'where':{'id':_0x2ecff9[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x15bcba,null))[_0x44b8('0x13')](removeEntity(_0x15bcba,null))[_0x44b8('0x2d')](handleError(_0x15bcba,null));};exports['getHoppers']=function(_0x1ec516,_0x3aac51){var _0x10e519={'raw':![],'where':{}};var _0x2b37e={};var _0x51f763={'count':0x0,'rows':[]};return db[_0x44b8('0x29')][_0x44b8('0x49')]({'where':{'id':_0x1ec516['params']['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x3aac51,null))[_0x44b8('0x13')](function(_0x5df821){if(_0x5df821){_0x2b37e[_0x44b8('0x30')]=_[_0x44b8('0x31')](db['CmHopper'][_0x44b8('0x24')]);_0x2b37e[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x1ec516['query']);_0x2b37e[_0x44b8('0x33')]=_['intersection'](_0x2b37e[_0x44b8('0x30')],_0x2b37e['query']);_0x10e519[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x2b37e[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x1ec516[_0x44b8('0x32')][_0x44b8('0x36')]));_0x10e519['attributes']=_0x10e519[_0x44b8('0x35')]['length']?_0x10e519[_0x44b8('0x35')]:_0x2b37e[_0x44b8('0x30')];if(!_0x1ec516['query'][_0x44b8('0x4a')](_0x44b8('0x4b'))){_0x10e519[_0x44b8('0x10')]=qs[_0x44b8('0x10')](_0x1ec516[_0x44b8('0x32')][_0x44b8('0x10')]);_0x10e519[_0x44b8('0xf')]=qs[_0x44b8('0xf')](_0x1ec516[_0x44b8('0x32')][_0x44b8('0xf')]);}_0x10e519[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x1ec516['query'][_0x44b8('0x4d')]);_0x10e519[_0x44b8('0x28')]=qs[_0x44b8('0x33')](_['pick'](_0x1ec516[_0x44b8('0x32')],_0x2b37e[_0x44b8('0x33')]));_0x10e519['where'][_0x44b8('0x4e')]=_0x5df821['id'];if(_0x1ec516[_0x44b8('0x32')][_0x44b8('0x19')]){_0x10e519[_0x44b8('0x28')]=_[_0x44b8('0x39')](_0x10e519['where'],{'$or':_[_0x44b8('0x1b')](_0x10e519[_0x44b8('0x35')],function(_0x279753){var _0x270224={};_0x270224[_0x279753]={'$like':'%'+_0x1ec516[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x270224;})});}_0x10e519=_[_0x44b8('0x39')]({},_0x10e519,_0x1ec516[_0x44b8('0x3a')]);return db['CmHopper'][_0x44b8('0xe')]({'where':_0x10e519[_0x44b8('0x28')]})[_0x44b8('0x13')](function(_0x3ce76e){_0x51f763['count']=_0x3ce76e;if(_0x1ec516['query']['includeAll']){_0x10e519[_0x44b8('0x2a')]=[{'all':!![]}];}return db[_0x44b8('0x4f')][_0x44b8('0x2b')](_0x10e519);})[_0x44b8('0x13')](function(_0x32e630){_0x51f763['rows']=_0x32e630;return _0x51f763;});}})[_0x44b8('0x13')](respondWithFilteredResult(_0x3aac51,_0x10e519))['catch'](handleError(_0x3aac51,null));};exports[_0x44b8('0x50')]=function(_0x155bcf,_0xea2c3e){var _0x5da034={'raw':!![],'where':{}};var _0x4cac12={};var _0xb4c6dc={'count':0x0,'rows':[]};return db[_0x44b8('0x29')][_0x44b8('0x49')]({'where':{'id':_0x155bcf['params']['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0xea2c3e,null))[_0x44b8('0x13')](function(_0x1258c2){if(_0x1258c2){_0x4cac12[_0x44b8('0x30')]=_[_0x44b8('0x31')](db['CmHopperHistory'][_0x44b8('0x24')]);_0x4cac12[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x155bcf[_0x44b8('0x32')]);_0x4cac12[_0x44b8('0x33')]=_['intersection'](_0x4cac12[_0x44b8('0x30')],_0x4cac12[_0x44b8('0x32')]);_0x5da034[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x4cac12[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x155bcf[_0x44b8('0x32')]['fields']));_0x5da034[_0x44b8('0x35')]=_0x5da034[_0x44b8('0x35')]['length']?_0x5da034[_0x44b8('0x35')]:_0x4cac12[_0x44b8('0x30')];if(!_0x155bcf['query'][_0x44b8('0x4a')]('nolimit')){_0x5da034['limit']=qs[_0x44b8('0x10')](_0x155bcf[_0x44b8('0x32')][_0x44b8('0x10')]);_0x5da034['offset']=qs['offset'](_0x155bcf['query'][_0x44b8('0xf')]);}_0x5da034[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x155bcf[_0x44b8('0x32')][_0x44b8('0x4d')]);_0x5da034[_0x44b8('0x28')]=qs[_0x44b8('0x33')](_[_0x44b8('0x51')](_0x155bcf['query'],_0x4cac12[_0x44b8('0x33')]));_0x5da034['where']['VoiceQueueId']=_0x1258c2['id'];if(_0x155bcf['query'][_0x44b8('0x19')]){_0x5da034['where']=_[_0x44b8('0x39')](_0x5da034[_0x44b8('0x28')],{'$or':_[_0x44b8('0x1b')](_0x5da034[_0x44b8('0x35')],function(_0x3a9780){var _0x245ba3={};_0x245ba3[_0x3a9780]={'$like':'%'+_0x155bcf[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x245ba3;})});}_0x5da034=_['merge']({},_0x5da034,_0x155bcf[_0x44b8('0x3a')]);return db[_0x44b8('0x52')][_0x44b8('0xe')]({'where':_0x5da034[_0x44b8('0x28')]})[_0x44b8('0x13')](function(_0xee44b3){_0xb4c6dc[_0x44b8('0xe')]=_0xee44b3;if(_0x155bcf[_0x44b8('0x32')][_0x44b8('0x38')]){_0x5da034['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x44b8('0x2b')](_0x5da034);})['then'](function(_0x531d65){_0xb4c6dc[_0x44b8('0x2c')]=_0x531d65;return _0xb4c6dc;});}})[_0x44b8('0x13')](respondWithFilteredResult(_0xea2c3e,_0x5da034))['catch'](handleError(_0xea2c3e,null));};exports['getHopperFinals']=function(_0x4b22e7,_0x2e0289){var _0x4860af={'raw':!![],'where':{}};var _0x353ff1={};var _0x2812da={'count':0x0,'rows':[]};return db[_0x44b8('0x29')][_0x44b8('0x49')]({'where':{'id':_0x4b22e7[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x2e0289,null))[_0x44b8('0x13')](function(_0x3a7229){if(_0x3a7229){_0x353ff1[_0x44b8('0x30')]=_[_0x44b8('0x31')](db[_0x44b8('0x53')][_0x44b8('0x24')]);_0x353ff1[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x4b22e7['query']);_0x353ff1[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x353ff1[_0x44b8('0x30')],_0x353ff1[_0x44b8('0x32')]);_0x4860af[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x353ff1[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x4b22e7[_0x44b8('0x32')][_0x44b8('0x36')]));_0x4860af[_0x44b8('0x35')]=_0x4860af[_0x44b8('0x35')][_0x44b8('0x37')]?_0x4860af['attributes']:_0x353ff1[_0x44b8('0x30')];if(!_0x4b22e7[_0x44b8('0x32')][_0x44b8('0x4a')]('nolimit')){_0x4860af['limit']=qs[_0x44b8('0x10')](_0x4b22e7[_0x44b8('0x32')][_0x44b8('0x10')]);_0x4860af['offset']=qs[_0x44b8('0xf')](_0x4b22e7[_0x44b8('0x32')][_0x44b8('0xf')]);}_0x4860af[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x4b22e7[_0x44b8('0x32')][_0x44b8('0x4d')]);_0x4860af[_0x44b8('0x28')]=qs['filters'](_[_0x44b8('0x51')](_0x4b22e7[_0x44b8('0x32')],_0x353ff1[_0x44b8('0x33')]));_0x4860af[_0x44b8('0x28')][_0x44b8('0x4e')]=_0x3a7229['id'];if(_0x4b22e7[_0x44b8('0x32')][_0x44b8('0x19')]){_0x4860af['where']=_['merge'](_0x4860af['where'],{'$or':_[_0x44b8('0x1b')](_0x4860af[_0x44b8('0x35')],function(_0x2d74ee){var _0x312f4c={};_0x312f4c[_0x2d74ee]={'$like':'%'+_0x4b22e7[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x312f4c;})});}_0x4860af=_[_0x44b8('0x39')]({},_0x4860af,_0x4b22e7[_0x44b8('0x3a')]);return db[_0x44b8('0x53')]['count']({'where':_0x4860af[_0x44b8('0x28')]})[_0x44b8('0x13')](function(_0x4b8036){_0x2812da['count']=_0x4b8036;if(_0x4b22e7[_0x44b8('0x32')]['includeAll']){_0x4860af[_0x44b8('0x2a')]=[{'all':!![]}];}return db[_0x44b8('0x53')][_0x44b8('0x2b')](_0x4860af);})['then'](function(_0x3f4a2a){_0x2812da[_0x44b8('0x2c')]=_0x3f4a2a;return _0x2812da;});}})[_0x44b8('0x13')](respondWithFilteredResult(_0x2e0289,_0x4860af))[_0x44b8('0x2d')](handleError(_0x2e0289,null));};exports['getHopperBlacks']=function(_0x216030,_0x584ae3){var _0x38c0c5={'raw':!![],'where':{}};var _0x2f2923={};var _0x2d9d62={'count':0x0,'rows':[]};return db[_0x44b8('0x29')][_0x44b8('0x49')]({'where':{'id':_0x216030[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x584ae3,null))['then'](function(_0x4d3b82){if(_0x4d3b82){_0x2f2923['model']=_[_0x44b8('0x31')](db[_0x44b8('0x54')][_0x44b8('0x24')]);_0x2f2923[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x216030[_0x44b8('0x32')]);_0x2f2923[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x2f2923[_0x44b8('0x30')],_0x2f2923[_0x44b8('0x32')]);_0x38c0c5[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x2f2923[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x216030[_0x44b8('0x32')][_0x44b8('0x36')]));_0x38c0c5[_0x44b8('0x35')]=_0x38c0c5[_0x44b8('0x35')]['length']?_0x38c0c5[_0x44b8('0x35')]:_0x2f2923['model'];if(!_0x216030[_0x44b8('0x32')]['hasOwnProperty']('nolimit')){_0x38c0c5[_0x44b8('0x10')]=qs['limit'](_0x216030['query']['limit']);_0x38c0c5['offset']=qs['offset'](_0x216030[_0x44b8('0x32')][_0x44b8('0xf')]);}_0x38c0c5[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x216030['query'][_0x44b8('0x4d')]);_0x38c0c5[_0x44b8('0x28')]=qs['filters'](_['pick'](_0x216030[_0x44b8('0x32')],_0x2f2923[_0x44b8('0x33')]));_0x38c0c5[_0x44b8('0x28')]['VoiceQueueId']=_0x4d3b82['id'];if(_0x216030[_0x44b8('0x32')][_0x44b8('0x19')]){_0x38c0c5[_0x44b8('0x28')]=_[_0x44b8('0x39')](_0x38c0c5[_0x44b8('0x28')],{'$or':_[_0x44b8('0x1b')](_0x38c0c5[_0x44b8('0x35')],function(_0x16344b){var _0x21057f={};_0x21057f[_0x16344b]={'$like':'%'+_0x216030['query'][_0x44b8('0x19')]+'%'};return _0x21057f;})});}_0x38c0c5=_[_0x44b8('0x39')]({},_0x38c0c5,_0x216030['options']);return db[_0x44b8('0x54')][_0x44b8('0xe')]({'where':_0x38c0c5[_0x44b8('0x28')]})['then'](function(_0x3a09e4){_0x2d9d62['count']=_0x3a09e4;if(_0x216030[_0x44b8('0x32')][_0x44b8('0x38')]){_0x38c0c5['include']=[{'all':!![]}];}return db[_0x44b8('0x54')][_0x44b8('0x2b')](_0x38c0c5);})[_0x44b8('0x13')](function(_0x37871e){_0x2d9d62['rows']=_0x37871e;return _0x2d9d62;});}})[_0x44b8('0x13')](respondWithFilteredResult(_0x584ae3,_0x38c0c5))[_0x44b8('0x2d')](handleError(_0x584ae3,null));};exports[_0x44b8('0x55')]=function(_0x35d46c,_0x2d4a8a){var _0x1d666e={};var _0x10a66a={};var _0x1e608f;var _0x470f90;return db['VoiceQueue']['findOne']({'where':{'id':_0x35d46c[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x2d4a8a,null))[_0x44b8('0x13')](function(_0x3539f9){if(_0x3539f9){_0x1e608f=_0x3539f9;_0x10a66a[_0x44b8('0x30')]=_['keys'](db[_0x44b8('0x56')]['rawAttributes']);_0x10a66a[_0x44b8('0x32')]=_['keys'](_0x35d46c[_0x44b8('0x32')]);_0x10a66a[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x10a66a[_0x44b8('0x30')],_0x10a66a[_0x44b8('0x32')]);_0x1d666e[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x10a66a[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x35d46c['query'][_0x44b8('0x36')]));_0x1d666e[_0x44b8('0x35')]=_0x1d666e[_0x44b8('0x35')][_0x44b8('0x37')]?_0x1d666e['attributes']:_0x10a66a['model'];_0x1d666e['order']=qs[_0x44b8('0x4d')](_0x35d46c['query']['sort']);_0x1d666e[_0x44b8('0x28')]=qs[_0x44b8('0x33')](_[_0x44b8('0x51')](_0x35d46c[_0x44b8('0x32')],_0x10a66a[_0x44b8('0x33')]));if(_0x35d46c[_0x44b8('0x32')][_0x44b8('0x19')]){_0x1d666e[_0x44b8('0x28')]=_['merge'](_0x1d666e[_0x44b8('0x28')],{'$or':_[_0x44b8('0x1b')](_0x1d666e[_0x44b8('0x35')],function(_0x2594bf){var _0x5f0c0c={};_0x5f0c0c[_0x2594bf]={'$like':'%'+_0x35d46c[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x5f0c0c;})});}_0x1d666e=_[_0x44b8('0x39')]({},_0x1d666e,_0x35d46c['options']);return _0x1e608f['getTeams'](_0x1d666e);}})[_0x44b8('0x13')](function(_0xae9b10){if(_0xae9b10){_0x470f90=_0xae9b10[_0x44b8('0x37')];if(!_0x35d46c[_0x44b8('0x32')][_0x44b8('0x4a')]('nolimit')){_0x1d666e[_0x44b8('0x10')]=qs[_0x44b8('0x10')](_0x35d46c['query'][_0x44b8('0x10')]);_0x1d666e[_0x44b8('0xf')]=qs[_0x44b8('0xf')](_0x35d46c[_0x44b8('0x32')]['offset']);}return _0x1e608f[_0x44b8('0x55')](_0x1d666e);}})['then'](function(_0x4464d3){if(_0x4464d3){return _0x4464d3?{'count':_0x470f90,'rows':_0x4464d3}:null;}})[_0x44b8('0x13')](respondWithResult(_0x2d4a8a,null))[_0x44b8('0x2d')](handleError(_0x2d4a8a,null));};exports[_0x44b8('0x57')]=function(_0x45ff62,_0x343c5c){var _0x3cb290=_0x45ff62[_0x44b8('0x3c')]['teams'];var _0x2d27bf=_[_0x44b8('0x1b')](_0x3cb290,'id');return db[_0x44b8('0x56')][_0x44b8('0x2b')]({'where':{'id':_0x2d27bf},'attributes':['id'],'include':[{'model':db[_0x44b8('0x58')],'as':_0x44b8('0x59'),'attributes':['id','name','online',_0x44b8('0x5a'),_0x44b8('0x5b')],'raw':!![]}]})['then'](function(_0x41f732){if(_0x41f732){var _0x16074e=_['flatMap'](_0x41f732,function(_0x1ec23e){var _0x3208b4=_0x1ec23e[_0x44b8('0x14')]({'plain':!![]});_0x3208b4[_0x44b8('0x59')][_0x44b8('0x5c')](function(_0x43f416){_0x43f416[_0x44b8('0x5d')]=_[_0x44b8('0x1e')](_0x3cb290,{'id':_0x3208b4['id']})[_0x44b8('0x5d')];});return _0x3208b4[_0x44b8('0x59')];});return db[_0x44b8('0x29')][_0x44b8('0x1e')]({'where':{'id':_0x45ff62[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](function(_0x15365d){return db['sequelize'][_0x44b8('0x5e')](function(_0x3d92a9){return _0x15365d[_0x44b8('0x57')](_0x2d27bf,{'transaction':_0x3d92a9})[_0x44b8('0x13')](function(){return BPromise['each'](_0x3cb290,function(_0x611876){return db[_0x44b8('0x5f')]['upsert']({'TeamId':_0x611876['id'],'VoiceQueueId':_0x45ff62[_0x44b8('0x2f')]['id'],'penalty':_0x611876['penalty']},{'transaction':_0x3d92a9});});})[_0x44b8('0x13')](function(){return BPromise[_0x44b8('0x60')](_0x16074e,function(_0x5a508f){return db[_0x44b8('0x61')]['findOrCreate']({'where':{'UserId':_0x5a508f['id'],'VoiceQueueId':_0x45ff62['params']['id']},'defaults':{'penalty':_0x5a508f[_0x44b8('0x5d')]},'transaction':_0x3d92a9});});})[_0x44b8('0x13')](function(){return BPromise['each'](_['filter'](_0x16074e,{'online':!![]}),function(_0x52af57){return db[_0x44b8('0x62')][_0x44b8('0x63')]({'membername':_0x52af57[_0x44b8('0x21')],'UserId':_0x52af57['id'],'queue_name':_0x15365d['name'],'VoiceQueueId':_0x15365d['id'],'interface':_['isNil'](_0x52af57[_0x44b8('0x5b')])?util[_0x44b8('0x64')](_0x44b8('0x65'),_0x52af57[_0x44b8('0x21')]):_0x52af57[_0x44b8('0x5b')],'paused':_0x52af57[_0x44b8('0x5a')]||![],'penalty':_0x52af57[_0x44b8('0x5d')]},{'transaction':_0x3d92a9});});})[_0x44b8('0x13')](function(){_0x16074e[_0x44b8('0x5c')](function(_0x4ed62f){socket[_0x44b8('0x66')]('userVoiceQueue:save',{'UserId':_0x4ed62f['id'],'VoiceQueueId':_0x15365d['id']});});});});});}})[_0x44b8('0x13')](respondWithStatusCode(_0x343c5c,null))['catch'](handleError(_0x343c5c,null));};exports['removeTeams']=function(_0x1fb070,_0x224071){return db[_0x44b8('0x56')][_0x44b8('0x2b')]({'where':{'id':_0x1fb070[_0x44b8('0x32')][_0x44b8('0x67')]},'attributes':['id'],'include':[{'model':db[_0x44b8('0x58')],'as':_0x44b8('0x59'),'attributes':['id'],'raw':!![]}]})[_0x44b8('0x13')](handleEntityNotFound(_0x224071,null))['then'](function(_0x1eb0a8){var _0x1e3b5f=_[_0x44b8('0x1b')](_0x1eb0a8,'id');var _0x536d1d=[];var _0x5bc747=[];var _0x3e44ea=squel['select']();_0x3e44ea[_0x44b8('0x68')]('tq.TeamId')[_0x44b8('0x69')]('team_has_voice_queues','tq')['join'](_0x44b8('0x6a'),'ut',_0x44b8('0x6b'))['where'](_0x44b8('0x6c'),_0x1fb070[_0x44b8('0x2f')]['id']);for(var _0x276dfc=0x0;_0x276dfc<_0x1eb0a8[_0x44b8('0x37')];_0x276dfc+=0x1){let _0x291617=_0x1eb0a8[_0x276dfc];for(var _0x57b73f=0x0;_0x57b73f<_0x291617[_0x44b8('0x59')]['length'];_0x57b73f+=0x1){let _0x595af5=_0x291617['Agents'][_0x57b73f];var _0x3015f9=_0x3e44ea[_0x44b8('0x44')]();_0x3015f9['where'](_0x44b8('0x6d'),_0x595af5['id']);_0x5bc747[_0x44b8('0x6e')](db['sequelize']['query'](_0x3015f9[_0x44b8('0x6f')](),{'type':db[_0x44b8('0x70')]['QueryTypes'][_0x44b8('0x71')]})[_0x44b8('0x13')](function(_0x5e2d3b){if(_0x5e2d3b[_0x44b8('0x37')]===0x1){return _0x595af5['id'];}else{var _0x97f4=_['every'](_[_0x44b8('0x1b')](_0x5e2d3b,_0x44b8('0x72')),function(_0xdb42f2){return _['includes'](_0x1e3b5f,_0xdb42f2);});if(_0x97f4){return _0x595af5['id'];}}}));}}return BPromise[_0x44b8('0x73')](_0x5bc747)['then'](function(_0x2ea49d){_0x536d1d=_(_0x536d1d)['union'](_0x2ea49d)['compact']()[_0x44b8('0x1c')]();return db[_0x44b8('0x29')][_0x44b8('0x1e')]({'where':{'id':_0x1fb070[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](function(_0x1db2cf){return db[_0x44b8('0x70')][_0x44b8('0x5e')](function(_0x1b7826){return _0x1db2cf[_0x44b8('0x74')](_0x1fb070[_0x44b8('0x32')]['ids'],{'transaction':_0x1b7826})[_0x44b8('0x13')](function(){if(!_[_0x44b8('0x75')](_0x536d1d)){return _0x1db2cf[_0x44b8('0x76')](_0x536d1d,{'transaction':_0x1b7826})[_0x44b8('0x13')](function(){return db[_0x44b8('0x62')][_0x44b8('0x12')]({'where':{'VoiceQueueId':_0x1fb070[_0x44b8('0x2f')]['id'],'UserId':_0x536d1d},'transaction':_0x1b7826});});}})[_0x44b8('0x13')](function(){_0x536d1d['forEach'](function(_0x4234bc){socket[_0x44b8('0x66')]('userVoiceQueue:remove',{'UserId':_0x4234bc,'VoiceQueueId':_0x1db2cf['id']});});});});});});})[_0x44b8('0x13')](respondWithStatusCode(_0x224071,null))[_0x44b8('0x2d')](handleError(_0x224071,null));};exports[_0x44b8('0x77')]=function(_0x5596c0,_0x4b2b8f){var _0x18cd30,_0x133da8;return db['VoiceQueue']['find']({'where':{'id':_0x5596c0[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x4b2b8f,null))[_0x44b8('0x13')](function(_0x2bccf9){if(_0x2bccf9){_0x133da8=_0x2bccf9;return _0x2bccf9[_0x44b8('0x77')](_0x5596c0['body'][_0x44b8('0x67')],_['omit'](_0x5596c0[_0x44b8('0x3c')],[_0x44b8('0x67'),'id'])||{})[_0x44b8('0x78')](function(_0x156a60){for(var _0x3cbec9=0x0;_0x3cbec9<_0x5596c0[_0x44b8('0x3c')]['ids'][_0x44b8('0x37')];_0x3cbec9+=0x1){socket['emit'](_0x44b8('0x79'),{'UserId':Number(_0x5596c0[_0x44b8('0x3c')]['ids'][_0x3cbec9]),'VoiceQueueId':Number(_0x5596c0[_0x44b8('0x2f')]['id'])});}return _0x156a60;});}})['then'](function(_0x42b0c9){_0x18cd30=_0x42b0c9||[];if(_0x133da8){return db[_0x44b8('0x58')][_0x44b8('0x2b')]({'where':{'id':_0x5596c0['body'][_0x44b8('0x67')]},'attributes':['id',_0x44b8('0x21'),'online',_0x44b8('0x5a'),'interface'],'raw':!![]});}})['then'](function(_0x4220b5){if(!_['isEmpty'](_0x4220b5)){var _0x336436=[];for(var _0x51add5=0x0;_0x51add5<_0x4220b5[_0x44b8('0x37')];_0x51add5++){if(_0x4220b5[_0x51add5][_0x44b8('0x7a')]){_0x336436['push'](db[_0x44b8('0x62')][_0x44b8('0x63')]({'membername':_0x4220b5[_0x51add5]['name'],'UserId':_0x4220b5[_0x51add5]['id'],'queue_name':_0x133da8['name'],'VoiceQueueId':_0x133da8['id'],'interface':_[_0x44b8('0x7b')](_0x4220b5[_0x51add5][_0x44b8('0x5b')])?util[_0x44b8('0x64')](_0x44b8('0x65'),_0x4220b5[_0x51add5]['name']):_0x4220b5[_0x51add5][_0x44b8('0x5b')],'paused':_0x4220b5[_0x51add5][_0x44b8('0x5a')]||![],'penalty':_0x5596c0[_0x44b8('0x3c')][_0x44b8('0x5d')]||0x0}));}}return BPromise['all'](_0x336436);}})['then'](function(){return _0x18cd30;})[_0x44b8('0x13')](respondWithResult(_0x4b2b8f,null))[_0x44b8('0x2d')](handleError(_0x4b2b8f,null));};exports[_0x44b8('0x76')]=function(_0x4cf4a0,_0x1443bd){return db[_0x44b8('0x29')]['find']({'where':{'id':_0x4cf4a0[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x1443bd,null))[_0x44b8('0x13')](function(_0x2cb698){if(_0x2cb698){return _0x2cb698[_0x44b8('0x76')](_0x4cf4a0[_0x44b8('0x32')]['ids'])['then'](function(){if(_[_0x44b8('0x7c')](_0x4cf4a0['query'][_0x44b8('0x67')])){for(var _0x4dc333=0x0;_0x4dc333<_0x4cf4a0[_0x44b8('0x32')][_0x44b8('0x67')][_0x44b8('0x37')];_0x4dc333+=0x1){socket[_0x44b8('0x66')](_0x44b8('0x7d'),{'UserId':Number(_0x4cf4a0[_0x44b8('0x32')][_0x44b8('0x67')][_0x4dc333]),'VoiceQueueId':Number(_0x4cf4a0[_0x44b8('0x2f')]['id'])});}}else{socket[_0x44b8('0x66')](_0x44b8('0x7d'),{'UserId':Number(_0x4cf4a0[_0x44b8('0x32')][_0x44b8('0x67')]),'VoiceQueueId':Number(_0x4cf4a0[_0x44b8('0x2f')]['id'])});}});}})[_0x44b8('0x13')](function(_0x4026d7){return db[_0x44b8('0x62')]['destroy']({'where':{'VoiceQueueId':_0x4cf4a0[_0x44b8('0x2f')]['id'],'UserId':_0x4cf4a0['query'][_0x44b8('0x67')]}})[_0x44b8('0x13')](function(){return _0x4026d7;});})[_0x44b8('0x13')](respondWithStatusCode(_0x1443bd,null))[_0x44b8('0x2d')](handleError(_0x1443bd,null));};exports[_0x44b8('0x7e')]=function(_0x22e5ae,_0x2f3340){var _0x4d98de={};var _0x597139={};var _0x2fffd5;var _0x3c90c2;return db[_0x44b8('0x29')][_0x44b8('0x49')]({'where':{'id':_0x22e5ae[_0x44b8('0x2f')]['id']}})['then'](handleEntityNotFound(_0x2f3340,null))[_0x44b8('0x13')](function(_0x208c53){if(_0x208c53){_0x2fffd5=_0x208c53;_0x597139[_0x44b8('0x30')]=_[_0x44b8('0x31')](db[_0x44b8('0x58')][_0x44b8('0x24')]);_0x597139['query']=_[_0x44b8('0x31')](_0x22e5ae[_0x44b8('0x32')]);_0x597139[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x597139[_0x44b8('0x30')],_0x597139['query']);_0x4d98de['attributes']=_[_0x44b8('0x34')](_0x597139[_0x44b8('0x30')],qs['fields'](_0x22e5ae['query'][_0x44b8('0x36')]));_0x4d98de['attributes']=_0x4d98de[_0x44b8('0x35')][_0x44b8('0x37')]?_0x4d98de[_0x44b8('0x35')]:_0x597139[_0x44b8('0x30')];_0x4d98de[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x22e5ae[_0x44b8('0x32')][_0x44b8('0x4d')]);_0x4d98de['where']=qs[_0x44b8('0x33')](_[_0x44b8('0x51')](_0x22e5ae[_0x44b8('0x32')],_0x597139['filters']));if(_0x22e5ae[_0x44b8('0x32')][_0x44b8('0x19')]){_0x4d98de['where']=_['merge'](_0x4d98de['where'],{'$or':_['map'](_0x4d98de[_0x44b8('0x35')],function(_0x5e423c){var _0x48065d={};_0x48065d[_0x5e423c]={'$like':'%'+_0x22e5ae[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x48065d;})});}_0x4d98de=_[_0x44b8('0x39')]({},_0x4d98de,_0x22e5ae['options']);return _0x2fffd5[_0x44b8('0x7e')](_0x4d98de);}})['then'](function(_0x230407){if(_0x230407){_0x3c90c2=_0x230407[_0x44b8('0x37')];if(!_0x22e5ae[_0x44b8('0x32')][_0x44b8('0x4a')]('nolimit')){_0x4d98de[_0x44b8('0x10')]=qs[_0x44b8('0x10')](_0x22e5ae[_0x44b8('0x32')][_0x44b8('0x10')]);_0x4d98de['offset']=qs['offset'](_0x22e5ae[_0x44b8('0x32')][_0x44b8('0xf')]);}return _0x2fffd5['getAgents'](_0x4d98de);}})[_0x44b8('0x13')](function(_0x188744){if(_0x188744){return _0x188744?{'count':_0x3c90c2,'rows':_0x188744}:null;}})[_0x44b8('0x13')](respondWithResult(_0x2f3340,null))[_0x44b8('0x2d')](handleError(_0x2f3340,null));};exports[_0x44b8('0x7f')]=function(_0x2da727,_0x319520){var _0x2f7550={};var _0x57d24f={};var _0x223e54;var _0x3e5fa8;return db[_0x44b8('0x29')]['findOne']({'where':{'id':_0x2da727[_0x44b8('0x2f')]['id']}})['then'](handleEntityNotFound(_0x319520,null))[_0x44b8('0x13')](function(_0x5370a5){if(_0x5370a5){_0x223e54=_0x5370a5;_0x57d24f[_0x44b8('0x30')]=_[_0x44b8('0x31')](db[_0x44b8('0x62')][_0x44b8('0x24')]);_0x57d24f[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x2da727[_0x44b8('0x32')]);_0x57d24f[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x57d24f[_0x44b8('0x30')],_0x57d24f[_0x44b8('0x32')]);_0x2f7550[_0x44b8('0x35')]=_['intersection'](_0x57d24f[_0x44b8('0x30')],qs['fields'](_0x2da727[_0x44b8('0x32')]['fields']));_0x2f7550[_0x44b8('0x35')]=_0x2f7550[_0x44b8('0x35')][_0x44b8('0x37')]?_0x2f7550[_0x44b8('0x35')]:_0x57d24f[_0x44b8('0x30')];_0x2f7550[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x2da727['query'][_0x44b8('0x4d')]);_0x2f7550[_0x44b8('0x28')]=qs[_0x44b8('0x33')](_[_0x44b8('0x51')](_0x2da727[_0x44b8('0x32')],_0x57d24f[_0x44b8('0x33')]));if(_0x2da727[_0x44b8('0x32')][_0x44b8('0x19')]){_0x2f7550[_0x44b8('0x28')]=_[_0x44b8('0x39')](_0x2f7550[_0x44b8('0x28')],{'$or':_[_0x44b8('0x1b')](_0x2f7550[_0x44b8('0x35')],function(_0x4281a6){var _0x4bb399={};_0x4bb399[_0x4281a6]={'$like':'%'+_0x2da727[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x4bb399;})});}_0x2f7550=_['merge']({},_0x2f7550,_0x2da727[_0x44b8('0x3a')]);return _0x223e54[_0x44b8('0x7f')](_0x2f7550);}})[_0x44b8('0x13')](function(_0x1f389e){if(_0x1f389e){_0x3e5fa8=_0x1f389e[_0x44b8('0x37')];if(!_0x2da727['query'][_0x44b8('0x4a')](_0x44b8('0x4b'))){_0x2f7550[_0x44b8('0x10')]=qs[_0x44b8('0x10')](_0x2da727['query'][_0x44b8('0x10')]);_0x2f7550[_0x44b8('0xf')]=qs['offset'](_0x2da727['query']['offset']);}return _0x223e54['getMembers'](_0x2f7550);}})[_0x44b8('0x13')](function(_0x5824a8){return _0x5824a8?{'count':_0x3e5fa8,'rows':_0x5824a8}:null;})['then'](respondWithResult(_0x319520,null))[_0x44b8('0x2d')](handleError(_0x319520,null));};exports[_0x44b8('0x80')]=function(_0x87a38,_0x54adf9){var _0x44dc3d={};var _0x32dafb={};var _0x3c8e0c;var _0x21ea61;return db['VoiceQueue'][_0x44b8('0x49')]({'where':{'id':_0x87a38['params']['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x54adf9,null))[_0x44b8('0x13')](function(_0x56cfa5){if(_0x56cfa5){_0x3c8e0c=_0x56cfa5;_0x32dafb[_0x44b8('0x30')]=_[_0x44b8('0x31')](db[_0x44b8('0x81')][_0x44b8('0x24')]);_0x32dafb[_0x44b8('0x32')]=_['keys'](_0x87a38['query']);_0x32dafb[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x32dafb[_0x44b8('0x30')],_0x32dafb[_0x44b8('0x32')]);_0x44dc3d[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x32dafb[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x87a38[_0x44b8('0x32')][_0x44b8('0x36')]));_0x44dc3d[_0x44b8('0x35')]=_0x44dc3d[_0x44b8('0x35')]['length']?_0x44dc3d['attributes']:_0x32dafb[_0x44b8('0x30')];_0x44dc3d['order']=qs[_0x44b8('0x4d')](_0x87a38[_0x44b8('0x32')][_0x44b8('0x4d')]);_0x44dc3d['where']=qs[_0x44b8('0x33')](_[_0x44b8('0x51')](_0x87a38[_0x44b8('0x32')],_0x32dafb[_0x44b8('0x33')]));if(_0x87a38[_0x44b8('0x32')][_0x44b8('0x19')]){_0x44dc3d['where']=_[_0x44b8('0x39')](_0x44dc3d[_0x44b8('0x28')],{'$or':_['map'](_0x44dc3d[_0x44b8('0x35')],function(_0x1ffa05){var _0x22edd7={};_0x22edd7[_0x1ffa05]={'$like':'%'+_0x87a38[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x22edd7;})});}_0x44dc3d=_['merge']({},_0x44dc3d,_0x87a38[_0x44b8('0x3a')]);return _0x3c8e0c[_0x44b8('0x80')](_0x44dc3d);}})[_0x44b8('0x13')](function(_0x2fca1a){if(_0x2fca1a){_0x21ea61=_0x2fca1a[_0x44b8('0x37')];if(!_0x87a38[_0x44b8('0x32')][_0x44b8('0x4a')](_0x44b8('0x4b'))){_0x44dc3d[_0x44b8('0x10')]=qs[_0x44b8('0x10')](_0x87a38['query'][_0x44b8('0x10')]);_0x44dc3d[_0x44b8('0xf')]=qs[_0x44b8('0xf')](_0x87a38['query']['offset']);}return _0x3c8e0c[_0x44b8('0x80')](_0x44dc3d);}})['then'](function(_0x9458fb){if(_0x9458fb){return _0x9458fb?{'count':_0x21ea61,'rows':_0x9458fb}:null;}})[_0x44b8('0x13')](respondWithResult(_0x54adf9,null))[_0x44b8('0x2d')](handleError(_0x54adf9,null));};exports[_0x44b8('0x82')]=function(_0x2eb6ce,_0x105ca0){var _0x25f364=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x77c009,_0x161362;return db[_0x44b8('0x29')][_0x44b8('0x1e')]({'where':{'id':_0x2eb6ce[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x105ca0,null))['then'](function(_0x4d88a6){if(_0x4d88a6){_0x161362=_0x4d88a6;return _0x4d88a6[_0x44b8('0x82')](_0x2eb6ce[_0x44b8('0x3c')][_0x44b8('0x67')],_[_0x44b8('0x45')](_0x2eb6ce[_0x44b8('0x3c')],[_0x44b8('0x67'),'id'])||{});}return null;})[_0x44b8('0x78')](function(_0x4b49df){var _0xbf96c1;_0x77c009=_0x4b49df||[];var _0x1f6244=[];if(_0x4b49df){for(var _0x96a3cd=0x0;_0x96a3cd<_0x4b49df['length'];_0x96a3cd+=0x1){var _0x16721d=_0x4b49df[_0x96a3cd][_0x44b8('0x14')]({'plain':!![]});_0x161362[_0x44b8('0x83')]=_0x2eb6ce[_0x44b8('0x3c')]['dialCheckDuplicateType']?_0x2eb6ce[_0x44b8('0x3c')][_0x44b8('0x83')]:_0x161362[_0x44b8('0x83')];switch(_0x161362['dialCheckDuplicateType']){case'always':_0xbf96c1=squel['insert']()['into']('cm_hopper')[_0x44b8('0x84')]([_0x44b8('0x85'),_0x44b8('0x86'),_0x44b8('0x87'),_0x44b8('0x88'),_0x44b8('0x4e'),_0x44b8('0x46'),_0x44b8('0x47')],squel[_0x44b8('0x89')]()[_0x44b8('0x68')](_0x44b8('0x85'),'phone')[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x86'))[_0x44b8('0x68')]('id',_0x44b8('0x87'))[_0x44b8('0x68')](_0x16721d['CmListId'][_0x44b8('0x6f')](),'ListId')[_0x44b8('0x68')](_0x2eb6ce[_0x44b8('0x2f')]['id'][_0x44b8('0x6f')](),'VoiceQueueId')[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x46'))['field']('\x27'+_0x25f364+'\x27',_0x44b8('0x47'))[_0x44b8('0x69')](_0x44b8('0x8a'))['where'](_0x44b8('0x8b'))['where'](_0x44b8('0x8c'),_0x16721d[_0x44b8('0x8d')][_0x44b8('0x6f')]())['where'](_0x44b8('0x8e'))['where'](_0x44b8('0x8f'),squel[_0x44b8('0x89')]()[_0x44b8('0x68')](_0x44b8('0x90'))[_0x44b8('0x69')](_0x44b8('0x91'))['where'](_0x44b8('0x6c'),_0x2eb6ce[_0x44b8('0x2f')]['id'][_0x44b8('0x6f')]()))[_0x44b8('0x28')]('phone\x20NOT\x20IN\x20(?)',squel[_0x44b8('0x89')]()[_0x44b8('0x68')](_0x44b8('0x92'))[_0x44b8('0x69')](_0x44b8('0x93'))[_0x44b8('0x28')](_0x44b8('0x6c'),_0x2eb6ce[_0x44b8('0x2f')]['id'][_0x44b8('0x6f')]())))[_0x44b8('0x6f')]();break;case _0x44b8('0x94'):_0xbf96c1=squel[_0x44b8('0x95')]()['into'](_0x44b8('0x93'))[_0x44b8('0x84')]([_0x44b8('0x85'),_0x44b8('0x86'),'ContactId',_0x44b8('0x88'),'VoiceQueueId',_0x44b8('0x46'),_0x44b8('0x47')],squel[_0x44b8('0x89')]()['field'](_0x44b8('0x85'),_0x44b8('0x85'))[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x86'))[_0x44b8('0x68')]('id','ContactId')[_0x44b8('0x68')](_0x16721d[_0x44b8('0x8d')][_0x44b8('0x6f')](),_0x44b8('0x88'))[_0x44b8('0x68')](_0x2eb6ce['params']['id'][_0x44b8('0x6f')](),_0x44b8('0x4e'))[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x46'))[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x47'))[_0x44b8('0x69')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0x44b8('0x28')](_0x44b8('0x8c'),_0x16721d[_0x44b8('0x8d')]['toString']())['where'](_0x44b8('0x8e'))[_0x44b8('0x28')](_0x44b8('0x8f'),squel[_0x44b8('0x89')]()[_0x44b8('0x68')]('COALESCE(phone,\x27\x27)')['from']('cm_hopper')['where'](_0x44b8('0x6c'),_0x2eb6ce[_0x44b8('0x2f')]['id'][_0x44b8('0x6f')]())))[_0x44b8('0x6f')]();break;default:_0xbf96c1=squel[_0x44b8('0x95')]()[_0x44b8('0x96')]('cm_hopper')[_0x44b8('0x84')](['phone',_0x44b8('0x86'),_0x44b8('0x87'),_0x44b8('0x88'),'VoiceQueueId','createdAt',_0x44b8('0x47')],squel[_0x44b8('0x89')]()['field']('phone',_0x44b8('0x85'))[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x86'))[_0x44b8('0x68')]('id',_0x44b8('0x87'))['field'](_0x16721d[_0x44b8('0x8d')][_0x44b8('0x6f')](),_0x44b8('0x88'))[_0x44b8('0x68')](_0x2eb6ce[_0x44b8('0x2f')]['id'][_0x44b8('0x6f')](),_0x44b8('0x4e'))['field']('\x27'+_0x25f364+'\x27',_0x44b8('0x46'))[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x47'))[_0x44b8('0x69')](_0x44b8('0x8a'))[_0x44b8('0x28')]('deletedAt\x20IS\x20NULL')[_0x44b8('0x28')](_0x44b8('0x8c'),_0x16721d[_0x44b8('0x8d')][_0x44b8('0x6f')]())['where'](_0x44b8('0x8e')))[_0x44b8('0x6f')]();}_0x1f6244[_0x44b8('0x6e')](db[_0x44b8('0x70')]['query'](_0xbf96c1));}return BPromise['all'](_0x1f6244);}})[_0x44b8('0x13')](function(){var _0x2ad4ab=[];var _0x196b4b=squel[_0x44b8('0x95')]()[_0x44b8('0x96')]('cm_hopper_additional_phones')[_0x44b8('0x84')]([_0x44b8('0x97'),_0x44b8('0x85'),_0x44b8('0x98'),_0x44b8('0x46'),_0x44b8('0x47')],squel['select']()[_0x44b8('0x68')](_0x44b8('0x99'))[_0x44b8('0x68')](_0x44b8('0x9a'))[_0x44b8('0x68')](_0x44b8('0x9b'))[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27','createdAt')[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x47'))[_0x44b8('0x69')](_0x44b8('0x9c'),'ci')['join'](_0x44b8('0x93'),'h','h.ContactId=ci.CmContactId')[_0x44b8('0x28')](_0x44b8('0x9d'),_0x25f364)[_0x44b8('0x28')](_0x44b8('0x9e'),'PHONE'))[_0x44b8('0x6f')]();_0x2ad4ab[_0x44b8('0x6e')](db[_0x44b8('0x70')]['query'](_0x196b4b));return BPromise[_0x44b8('0x73')](_0x2ad4ab);})[_0x44b8('0x13')](function(){return _0x77c009;})[_0x44b8('0x13')](respondWithResult(_0x105ca0,null))[_0x44b8('0x2d')](handleError(_0x105ca0,null));};exports[_0x44b8('0x9f')]=function(_0x257702,_0x17560c){return db[_0x44b8('0x29')][_0x44b8('0x1e')]({'where':{'id':_0x257702[_0x44b8('0x2f')]['id']}})['then'](handleEntityNotFound(_0x17560c,null))[_0x44b8('0x13')](function(_0x4d11d5){if(_0x4d11d5){return _0x4d11d5[_0x44b8('0x9f')](_0x257702[_0x44b8('0x32')][_0x44b8('0x67')]);}})[_0x44b8('0x13')](function(_0xafca17){if(_0xafca17){return db['CmHopper']['destroy']({'where':{'ListId':_0x257702['query'][_0x44b8('0x67')],'VoiceQueueId':_0x257702[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](function(){return _0xafca17;});}})[_0x44b8('0x13')](respondWithStatusCode(_0x17560c,null))[_0x44b8('0x2d')](handleError(_0x17560c,null));};exports[_0x44b8('0xa0')]=function(_0x513302,_0xfdb408){var _0x119dda={};var _0x5834fe={};var _0xe5cc1e;var _0x4c55e6;return db[_0x44b8('0x29')][_0x44b8('0x49')]({'where':{'id':_0x513302['params']['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0xfdb408,null))[_0x44b8('0x13')](function(_0x537eab){if(_0x537eab){_0xe5cc1e=_0x537eab;_0x5834fe[_0x44b8('0x30')]=_[_0x44b8('0x31')](db[_0x44b8('0x81')][_0x44b8('0x24')]);_0x5834fe['query']=_[_0x44b8('0x31')](_0x513302[_0x44b8('0x32')]);_0x5834fe[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x5834fe[_0x44b8('0x30')],_0x5834fe[_0x44b8('0x32')]);_0x119dda[_0x44b8('0x35')]=_['intersection'](_0x5834fe[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x513302[_0x44b8('0x32')]['fields']));_0x119dda[_0x44b8('0x35')]=_0x119dda[_0x44b8('0x35')]['length']?_0x119dda[_0x44b8('0x35')]:_0x5834fe[_0x44b8('0x30')];_0x119dda[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x513302['query'][_0x44b8('0x4d')]);_0x119dda[_0x44b8('0x28')]=qs[_0x44b8('0x33')](_[_0x44b8('0x51')](_0x513302[_0x44b8('0x32')],_0x5834fe['filters']));if(_0x513302[_0x44b8('0x32')][_0x44b8('0x19')]){_0x119dda['where']=_[_0x44b8('0x39')](_0x119dda[_0x44b8('0x28')],{'$or':_[_0x44b8('0x1b')](_0x119dda[_0x44b8('0x35')],function(_0x4e9376){var _0x25f31c={};_0x25f31c[_0x4e9376]={'$like':'%'+_0x513302[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x25f31c;})});}_0x119dda=_[_0x44b8('0x39')]({},_0x119dda,_0x513302[_0x44b8('0x3a')]);return _0xe5cc1e[_0x44b8('0xa0')](_0x119dda);}})[_0x44b8('0x13')](function(_0x57e3c9){if(_0x57e3c9){_0x4c55e6=_0x57e3c9[_0x44b8('0x37')];if(!_0x513302[_0x44b8('0x32')][_0x44b8('0x4a')](_0x44b8('0x4b'))){_0x119dda['limit']=qs[_0x44b8('0x10')](_0x513302[_0x44b8('0x32')][_0x44b8('0x10')]);_0x119dda['offset']=qs['offset'](_0x513302[_0x44b8('0x32')][_0x44b8('0xf')]);}return _0xe5cc1e[_0x44b8('0xa0')](_0x119dda);}})[_0x44b8('0x13')](function(_0x4a5916){if(_0x4a5916){return _0x4a5916?{'count':_0x4c55e6,'rows':_0x4a5916}:null;}})[_0x44b8('0x13')](respondWithResult(_0xfdb408,null))[_0x44b8('0x2d')](handleError(_0xfdb408,null));};exports['addBlackLists']=function(_0xd19a35,_0x2439f2){var _0x22a624;return db['VoiceQueue'][_0x44b8('0x1e')]({'where':{'id':_0xd19a35[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x2439f2,null))[_0x44b8('0x13')](function(_0x14c021){if(_0x14c021){return _0x14c021['addBlackLists'](_0xd19a35[_0x44b8('0x3c')][_0x44b8('0x67')],_['omit'](_0xd19a35[_0x44b8('0x3c')],[_0x44b8('0x67'),'id'])||{});}return null;})[_0x44b8('0x78')](function(_0x3b9cd2){var _0xb6cadf;_0x22a624=_0x3b9cd2||[];var _0x2024eb=[];if(_0x3b9cd2){for(var _0x29af58=0x0;_0x29af58<_0x3b9cd2[_0x44b8('0x37')];_0x29af58+=0x1){var _0x3870a9=_0x3b9cd2[_0x29af58]['get']({'plain':!![]});_0xb6cadf=squel['insert']()['into']('cm_hopper_black')[_0x44b8('0x84')]([_0x44b8('0x85'),'ContactId',_0x44b8('0x88'),_0x44b8('0x4e'),_0x44b8('0x46'),_0x44b8('0x47')],squel[_0x44b8('0x89')]()[_0x44b8('0x68')]('phone',_0x44b8('0x85'))['field']('id','ContactId')[_0x44b8('0x68')](_0x3870a9[_0x44b8('0x8d')][_0x44b8('0x6f')](),_0x44b8('0x88'))[_0x44b8('0x68')](_0xd19a35['params']['id'][_0x44b8('0x6f')](),_0x44b8('0x4e'))[_0x44b8('0x68')](_0x44b8('0xa1'),_0x44b8('0x46'))[_0x44b8('0x68')](_0x44b8('0xa1'),'updatedAt')[_0x44b8('0x69')](_0x44b8('0x8a'))[_0x44b8('0x28')]('deletedAt\x20IS\x20NULL')[_0x44b8('0x28')](_0x44b8('0x8c'),_0x3870a9[_0x44b8('0x8d')][_0x44b8('0x6f')]())[_0x44b8('0x28')](_0x44b8('0x8e')))[_0x44b8('0x6f')]();_0x2024eb[_0x44b8('0x6e')](db['sequelize'][_0x44b8('0x32')](_0xb6cadf));}return BPromise[_0x44b8('0x73')](_0x2024eb);}})[_0x44b8('0x13')](function(){return _0x22a624;})[_0x44b8('0x13')](respondWithResult(_0x2439f2,null))[_0x44b8('0x2d')](handleError(_0x2439f2,null));};exports[_0x44b8('0xa2')]=function(_0x4ec799,_0x3fa943){return db[_0x44b8('0x29')]['find']({'where':{'id':_0x4ec799[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x3fa943,null))[_0x44b8('0x13')](function(_0x3b1643){if(_0x3b1643){return _0x3b1643['removeBlackLists'](_0x4ec799[_0x44b8('0x32')]['ids']);}})['then'](function(_0x9a5734){if(_0x9a5734){return db[_0x44b8('0x54')][_0x44b8('0x12')]({'where':{'ListId':_0x4ec799[_0x44b8('0x32')][_0x44b8('0x67')],'VoiceQueueId':_0x4ec799['params']['id']}})['then'](function(){return _0x9a5734;});}})['then'](respondWithStatusCode(_0x3fa943,null))[_0x44b8('0x2d')](handleError(_0x3fa943,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 5b9d285..e362bd6 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 _0x1436=['setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x19d24c,_0x62bc50){var _0x2fae8d=function(_0x419856){while(--_0x419856){_0x19d24c['push'](_0x19d24c['shift']());}};_0x2fae8d(++_0x62bc50);}(_0x1436,0x159));var _0x6143=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x1436[_0x57b54c];return _0x59cc19;};'use strict';var EventEmitter=require('events');var VoiceQueue=require('../../mysqldb')['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x6143('0x0')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6143('0x1'),'afterDestroy':_0x6143('0x2')};function emitEvent(_0x3b94a8){return function(_0x5cd1a6,_0x10e978,_0x2d44c7){VoiceQueueEvents['emit'](_0x3b94a8+':'+_0x5cd1a6['id'],_0x5cd1a6);VoiceQueueEvents[_0x6143('0x3')](_0x3b94a8,_0x5cd1a6);_0x2d44c7(null);};}for(var e in events){if(events[_0x6143('0x4')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file +var _0xb272=['../../mysqldb','VoiceQueue','save','update','emit','hook','exports','events'];(function(_0x1443be,_0x31b17d){var _0x38823d=function(_0x2e57d7){while(--_0x2e57d7){_0x1443be['push'](_0x1443be['shift']());}};_0x38823d(++_0x31b17d);}(_0xb272,0x97));var _0x2b27=function(_0x5eb281,_0x2a46c1){_0x5eb281=_0x5eb281-0x0;var _0xde0b5d=_0xb272[_0x5eb281];return _0xde0b5d;};'use strict';var EventEmitter=require(_0x2b27('0x0'));var VoiceQueue=require(_0x2b27('0x1'))['db'][_0x2b27('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2b27('0x3'),'afterUpdate':_0x2b27('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3f9afa){return function(_0x4a072c,_0x21e81a,_0x1eb5ae){VoiceQueueEvents['emit'](_0x3f9afa+':'+_0x4a072c['id'],_0x4a072c);VoiceQueueEvents[_0x2b27('0x5')](_0x3f9afa,_0x4a072c);_0x1eb5ae(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0x2b27('0x6')](e,emitEvent(event));}}module[_0x2b27('0x7')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 14ee8e2..d3d9880 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 _0x3e74=['exports','VoiceQueue','voice_queues','lodash','../../config/logger','api','moment','path','../../config/environment','./voiceQueue.attributes'];(function(_0x2695ab,_0x3f4b39){var _0x3eaf50=function(_0x2ada55){while(--_0x2ada55){_0x2695ab['push'](_0x2695ab['shift']());}};_0x3eaf50(++_0x3f4b39);}(_0x3e74,0x175));var _0x43e7=function(_0x4b0c29,_0x321019){_0x4b0c29=_0x4b0c29-0x0;var _0x4e4e05=_0x3e74[_0x4b0c29];return _0x4e4e05;};'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 _0x70e0=['voice_queues','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./voiceQueue.attributes'];(function(_0x549a24,_0x35bca6){var _0x2a67c3=function(_0x108a24){while(--_0x108a24){_0x549a24['push'](_0x549a24['shift']());}};_0x2a67c3(++_0x35bca6);}(_0x70e0,0x17b));var _0x070e=function(_0x1391f4,_0x314cf6){_0x1391f4=_0x1391f4-0x0;var _0x31e8c7=_0x70e0[_0x1391f4];return _0x31e8c7;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('VoiceQueue',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index b7f9852..6eb906d 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 _0x8981=['map','model','then','stringify','ShowVoiceQueue','VoiceQueue','find','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','http','defaults','redis','localhost','./voiceQueue.socket','register','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','GetVoiceQueue','findAll','options','raw','where','limit','include','attributes'];(function(_0x3d5ddd,_0x570d2e){var _0x5c908e=function(_0x3a46df){while(--_0x3a46df){_0x3d5ddd['push'](_0x3d5ddd['shift']());}};_0x5c908e(++_0x570d2e);}(_0x8981,0x19e));var _0x1898=function(_0x3c9f69,_0x10a0bc){_0x3c9f69=_0x3c9f69-0x0;var _0x210e68=_0x8981[_0x3c9f69];return _0x210e68;};'use strict';var _=require(_0x1898('0x0'));var util=require(_0x1898('0x1'));var moment=require('moment');var BPromise=require(_0x1898('0x2'));var rs=require(_0x1898('0x3'));var fs=require('fs');var Redis=require(_0x1898('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1898('0x5'));var logger=require(_0x1898('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1898('0x7'));var client=jayson['client'][_0x1898('0x8')]({'port':0x232a});config['redis']=_[_0x1898('0x9')](config[_0x1898('0xa')],{'host':_0x1898('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x1898('0xc'))[_0x1898('0xd')](socket);function respondWithRpcPromise(_0x2debdd,_0x1fb40c,_0x41143d){return new BPromise(function(_0x4971d1,_0x57ecce){return client['request'](_0x2debdd,_0x41143d)['then'](function(_0x5d82fb){logger[_0x1898('0xe')](_0x1898('0xf'),_0x1fb40c,_0x1898('0x10'));logger[_0x1898('0x11')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x1fb40c,_0x1898('0x10'),JSON['stringify'](_0x5d82fb));if(_0x5d82fb[_0x1898('0x12')]){if(_0x5d82fb[_0x1898('0x12')]['code']===0x1f4){logger[_0x1898('0x12')]('VoiceQueue,\x20%s,\x20%s',_0x1fb40c,_0x5d82fb[_0x1898('0x12')][_0x1898('0x13')]);return _0x57ecce(_0x5d82fb[_0x1898('0x12')]['message']);}logger[_0x1898('0x12')]('VoiceQueue,\x20%s,\x20%s',_0x1fb40c,_0x5d82fb[_0x1898('0x12')]['message']);return _0x4971d1(_0x5d82fb[_0x1898('0x12')][_0x1898('0x13')]);}else{logger[_0x1898('0xe')]('VoiceQueue,\x20%s,\x20%s',_0x1fb40c,_0x1898('0x10'));_0x4971d1(_0x5d82fb[_0x1898('0x14')][_0x1898('0x13')]);}})[_0x1898('0x15')](function(_0x5dde0a){logger[_0x1898('0x12')]('VoiceQueue,\x20%s,\x20%s',_0x1fb40c,_0x5dde0a);_0x57ecce(_0x5dde0a);});});}exports[_0x1898('0x16')]=function(_0x44b0fd){var _0x2252bd=this;return new Promise(function(_0x5e98de,_0x5237bc){return db['VoiceQueue'][_0x1898('0x17')]({'raw':_0x44b0fd[_0x1898('0x18')]?_0x44b0fd[_0x1898('0x18')][_0x1898('0x19')]===undefined?!![]:![]:!![],'where':_0x44b0fd[_0x1898('0x18')]?_0x44b0fd[_0x1898('0x18')][_0x1898('0x1a')]||null:null,'attributes':_0x44b0fd['options']?_0x44b0fd[_0x1898('0x18')]['attributes']||null:null,'limit':_0x44b0fd[_0x1898('0x18')]?_0x44b0fd[_0x1898('0x18')][_0x1898('0x1b')]||null:null,'include':_0x44b0fd[_0x1898('0x18')]?_0x44b0fd[_0x1898('0x18')][_0x1898('0x1c')]?_['map'](_0x44b0fd['options']['include'],function(_0x311775){return{'model':db[_0x311775['model']],'as':_0x311775['as'],'attributes':_0x311775[_0x1898('0x1d')],'include':_0x311775['include']?_[_0x1898('0x1e')](_0x311775[_0x1898('0x1c')],function(_0x510378){return{'model':db[_0x510378[_0x1898('0x1f')]],'as':_0x510378['as'],'attributes':_0x510378[_0x1898('0x1d')],'include':_0x510378['include']?_[_0x1898('0x1e')](_0x510378[_0x1898('0x1c')],function(_0x1b7bc7){return{'model':db[_0x1b7bc7[_0x1898('0x1f')]],'as':_0x1b7bc7['as'],'attributes':_0x1b7bc7['attributes']};}):[]};}):[]};}):[]:[]})[_0x1898('0x20')](function(_0x6ccee7){logger[_0x1898('0xe')](_0x1898('0x16'),_0x44b0fd);logger['debug'](_0x1898('0x16'),_0x44b0fd,JSON[_0x1898('0x21')](_0x6ccee7));_0x5e98de(_0x6ccee7);})[_0x1898('0x15')](function(_0x265d78){logger[_0x1898('0x12')]('GetVoiceQueue',_0x265d78[_0x1898('0x13')],_0x44b0fd);_0x5237bc(_0x2252bd[_0x1898('0x12')](0x1f4,_0x265d78[_0x1898('0x13')]));});});};exports[_0x1898('0x22')]=function(_0x4fad16){var _0x2fcb24=this;return new Promise(function(_0x123ebf,_0x35a0fc){return db[_0x1898('0x23')][_0x1898('0x24')]({'raw':_0x4fad16[_0x1898('0x18')]?_0x4fad16['options']['raw']===undefined?!![]:![]:!![],'where':_0x4fad16[_0x1898('0x18')]?_0x4fad16[_0x1898('0x18')][_0x1898('0x1a')]||null:null,'attributes':_0x4fad16[_0x1898('0x18')]?_0x4fad16[_0x1898('0x18')][_0x1898('0x1d')]||null:null,'include':_0x4fad16['options']?_0x4fad16[_0x1898('0x18')]['include']?_[_0x1898('0x1e')](_0x4fad16[_0x1898('0x18')][_0x1898('0x1c')],function(_0x1b9e0e){return{'model':db[_0x1b9e0e['model']],'as':_0x1b9e0e['as'],'attributes':_0x1b9e0e[_0x1898('0x1d')],'include':_0x1b9e0e[_0x1898('0x1c')]?_['map'](_0x1b9e0e[_0x1898('0x1c')],function(_0xa2ac29){return{'model':db[_0xa2ac29[_0x1898('0x1f')]],'as':_0xa2ac29['as'],'attributes':_0xa2ac29[_0x1898('0x1d')],'include':_0xa2ac29[_0x1898('0x1c')]?_[_0x1898('0x1e')](_0xa2ac29[_0x1898('0x1c')],function(_0x333dbe){return{'model':db[_0x333dbe[_0x1898('0x1f')]],'as':_0x333dbe['as'],'attributes':_0x333dbe[_0x1898('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x46316f){logger['info']('ShowVoiceQueue',_0x4fad16);logger[_0x1898('0x11')]('ShowVoiceQueue',_0x4fad16,JSON[_0x1898('0x21')](_0x46316f));_0x123ebf(_0x46316f);})[_0x1898('0x15')](function(_0x23533d){logger[_0x1898('0x12')](_0x1898('0x22'),_0x23533d[_0x1898('0x13')],_0x4fad16);_0x35a0fc(_0x2fcb24[_0x1898('0x12')](0x1f4,_0x23533d[_0x1898('0x13')]));});});}; \ No newline at end of file +var _0x3b3b=['./voiceQueue.socket','register','request','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','VoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','GetVoiceQueue','VoiceQueue','options','raw','where','limit','include','map','model','attributes','then','debug','catch','ShowVoiceQueue','find','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x31d794,_0x160894){var _0x325661=function(_0x456ed2){while(--_0x456ed2){_0x31d794['push'](_0x31d794['shift']());}};_0x325661(++_0x160894);}(_0x3b3b,0x162));var _0xb3b3=function(_0x26306f,_0xce1ef9){_0x26306f=_0x26306f-0x0;var _0x21cae4=_0x3b3b[_0x26306f];return _0x21cae4;};'use strict';var _=require(_0xb3b3('0x0'));var util=require(_0xb3b3('0x1'));var moment=require('moment');var BPromise=require(_0xb3b3('0x2'));var rs=require(_0xb3b3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb3b3('0x4'))['db'];var utils=require(_0xb3b3('0x5'));var logger=require('../../config/logger')(_0xb3b3('0x6'));var config=require(_0xb3b3('0x7'));var jayson=require(_0xb3b3('0x8'));var client=jayson[_0xb3b3('0x9')][_0xb3b3('0xa')]({'port':0x232a});config[_0xb3b3('0xb')]=_[_0xb3b3('0xc')](config['redis'],{'host':_0xb3b3('0xd'),'port':0x18eb});var socket=require(_0xb3b3('0xe'))(new Redis(config['redis']));require(_0xb3b3('0xf'))[_0xb3b3('0x10')](socket);function respondWithRpcPromise(_0x39d4f4,_0x11c94a,_0x467b2e){return new BPromise(function(_0x4fcce4,_0x2d768e){return client[_0xb3b3('0x11')](_0x39d4f4,_0x467b2e)['then'](function(_0x11efb6){logger[_0xb3b3('0x12')](_0xb3b3('0x13'),_0x11c94a,_0xb3b3('0x14'));logger['debug'](_0xb3b3('0x15'),_0x11c94a,'request\x20sent',JSON['stringify'](_0x11efb6));if(_0x11efb6['error']){if(_0x11efb6[_0xb3b3('0x16')][_0xb3b3('0x17')]===0x1f4){logger[_0xb3b3('0x16')]('VoiceQueue,\x20%s,\x20%s',_0x11c94a,_0x11efb6[_0xb3b3('0x16')][_0xb3b3('0x18')]);return _0x2d768e(_0x11efb6[_0xb3b3('0x16')]['message']);}logger['error'](_0xb3b3('0x13'),_0x11c94a,_0x11efb6[_0xb3b3('0x16')][_0xb3b3('0x18')]);return _0x4fcce4(_0x11efb6['error'][_0xb3b3('0x18')]);}else{logger[_0xb3b3('0x12')](_0xb3b3('0x13'),_0x11c94a,_0xb3b3('0x14'));_0x4fcce4(_0x11efb6[_0xb3b3('0x19')][_0xb3b3('0x18')]);}})['catch'](function(_0x406675){logger[_0xb3b3('0x16')](_0xb3b3('0x13'),_0x11c94a,_0x406675);_0x2d768e(_0x406675);});});}exports[_0xb3b3('0x1a')]=function(_0xc5a16e){var _0x5afc9d=this;return new Promise(function(_0x300362,_0x2c83fc){return db[_0xb3b3('0x1b')]['findAll']({'raw':_0xc5a16e[_0xb3b3('0x1c')]?_0xc5a16e[_0xb3b3('0x1c')][_0xb3b3('0x1d')]===undefined?!![]:![]:!![],'where':_0xc5a16e[_0xb3b3('0x1c')]?_0xc5a16e[_0xb3b3('0x1c')][_0xb3b3('0x1e')]||null:null,'attributes':_0xc5a16e[_0xb3b3('0x1c')]?_0xc5a16e[_0xb3b3('0x1c')]['attributes']||null:null,'limit':_0xc5a16e[_0xb3b3('0x1c')]?_0xc5a16e[_0xb3b3('0x1c')][_0xb3b3('0x1f')]||null:null,'include':_0xc5a16e[_0xb3b3('0x1c')]?_0xc5a16e[_0xb3b3('0x1c')][_0xb3b3('0x20')]?_[_0xb3b3('0x21')](_0xc5a16e['options']['include'],function(_0x48729e){return{'model':db[_0x48729e[_0xb3b3('0x22')]],'as':_0x48729e['as'],'attributes':_0x48729e[_0xb3b3('0x23')],'include':_0x48729e[_0xb3b3('0x20')]?_['map'](_0x48729e[_0xb3b3('0x20')],function(_0x1f244a){return{'model':db[_0x1f244a[_0xb3b3('0x22')]],'as':_0x1f244a['as'],'attributes':_0x1f244a['attributes'],'include':_0x1f244a[_0xb3b3('0x20')]?_[_0xb3b3('0x21')](_0x1f244a[_0xb3b3('0x20')],function(_0x5a440a){return{'model':db[_0x5a440a[_0xb3b3('0x22')]],'as':_0x5a440a['as'],'attributes':_0x5a440a[_0xb3b3('0x23')]};}):[]};}):[]};}):[]:[]})[_0xb3b3('0x24')](function(_0x18120d){logger[_0xb3b3('0x12')](_0xb3b3('0x1a'),_0xc5a16e);logger[_0xb3b3('0x25')](_0xb3b3('0x1a'),_0xc5a16e,JSON['stringify'](_0x18120d));_0x300362(_0x18120d);})[_0xb3b3('0x26')](function(_0x5e6676){logger['error'](_0xb3b3('0x1a'),_0x5e6676[_0xb3b3('0x18')],_0xc5a16e);_0x2c83fc(_0x5afc9d[_0xb3b3('0x16')](0x1f4,_0x5e6676[_0xb3b3('0x18')]));});});};exports[_0xb3b3('0x27')]=function(_0x2412f1){var _0x2e9759=this;return new Promise(function(_0x265f0a,_0x112632){return db[_0xb3b3('0x1b')][_0xb3b3('0x28')]({'raw':_0x2412f1['options']?_0x2412f1[_0xb3b3('0x1c')][_0xb3b3('0x1d')]===undefined?!![]:![]:!![],'where':_0x2412f1[_0xb3b3('0x1c')]?_0x2412f1[_0xb3b3('0x1c')][_0xb3b3('0x1e')]||null:null,'attributes':_0x2412f1[_0xb3b3('0x1c')]?_0x2412f1[_0xb3b3('0x1c')]['attributes']||null:null,'include':_0x2412f1[_0xb3b3('0x1c')]?_0x2412f1[_0xb3b3('0x1c')]['include']?_[_0xb3b3('0x21')](_0x2412f1['options'][_0xb3b3('0x20')],function(_0x3740e7){return{'model':db[_0x3740e7[_0xb3b3('0x22')]],'as':_0x3740e7['as'],'attributes':_0x3740e7[_0xb3b3('0x23')],'include':_0x3740e7['include']?_['map'](_0x3740e7[_0xb3b3('0x20')],function(_0x595ca5){return{'model':db[_0x595ca5[_0xb3b3('0x22')]],'as':_0x595ca5['as'],'attributes':_0x595ca5[_0xb3b3('0x23')],'include':_0x595ca5[_0xb3b3('0x20')]?_[_0xb3b3('0x21')](_0x595ca5[_0xb3b3('0x20')],function(_0x3b7cde){return{'model':db[_0x3b7cde[_0xb3b3('0x22')]],'as':_0x3b7cde['as'],'attributes':_0x3b7cde[_0xb3b3('0x23')]};}):[]};}):[]};}):[]:[]})[_0xb3b3('0x24')](function(_0x3cba94){logger[_0xb3b3('0x12')](_0xb3b3('0x27'),_0x2412f1);logger['debug'](_0xb3b3('0x27'),_0x2412f1,JSON['stringify'](_0x3cba94));_0x265f0a(_0x3cba94);})['catch'](function(_0x9eb66a){logger[_0xb3b3('0x16')](_0xb3b3('0x27'),_0x9eb66a[_0xb3b3('0x18')],_0x2412f1);_0x112632(_0x2e9759['error'](0x1f4,_0x9eb66a[_0xb3b3('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index fbac48f..27d9814 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 _0xb6da=['emit','removeListener','register','length','voiceQueue:','save','remove','update'];(function(_0x6f4c31,_0x11cf01){var _0x191a9c=function(_0x85b741){while(--_0x85b741){_0x6f4c31['push'](_0x6f4c31['shift']());}};_0x191a9c(++_0x11cf01);}(_0xb6da,0xed));var _0xab6d=function(_0x55b709,_0x4a8b6c){_0x55b709=_0x55b709-0x0;var _0x2db908=_0xb6da[_0x55b709];return _0x2db908;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0xab6d('0x0'),_0xab6d('0x1'),_0xab6d('0x2')];function createListener(_0x2d206f,_0x5247c1){return function(_0x26bdf8){_0x5247c1[_0xab6d('0x3')](_0x2d206f,_0x26bdf8);};}function removeListener(_0x2a4845,_0xa2093){return function(){VoiceQueueEvents[_0xab6d('0x4')](_0x2a4845,_0xa2093);};}exports[_0xab6d('0x5')]=function(_0x1d9354){for(var _0x17f3e8=0x0,_0x24fdd3=events[_0xab6d('0x6')];_0x17f3e8<_0x24fdd3;_0x17f3e8++){var _0x48bdce=events[_0x17f3e8];var _0x1d6f79=createListener(_0xab6d('0x7')+_0x48bdce,_0x1d9354);VoiceQueueEvents['on'](_0x48bdce,_0x1d6f79);}}; \ No newline at end of file +var _0x7be0=['./voiceQueue.events','save','update','removeListener','length','voiceQueue:'];(function(_0x35c4ca,_0x363dc5){var _0x17c529=function(_0x3a47e5){while(--_0x3a47e5){_0x35c4ca['push'](_0x35c4ca['shift']());}};_0x17c529(++_0x363dc5);}(_0x7be0,0x126));var _0x07be=function(_0x55ec78,_0x146f50){_0x55ec78=_0x55ec78-0x0;var _0x1accc7=_0x7be0[_0x55ec78];return _0x1accc7;};'use strict';var VoiceQueueEvents=require(_0x07be('0x0'));var events=[_0x07be('0x1'),'remove',_0x07be('0x2')];function createListener(_0x13f097,_0x315645){return function(_0x2579e4){_0x315645['emit'](_0x13f097,_0x2579e4);};}function removeListener(_0x1ab336,_0x59f652){return function(){VoiceQueueEvents[_0x07be('0x3')](_0x1ab336,_0x59f652);};}exports['register']=function(_0x1bfb1f){for(var _0x47a20b=0x0,_0x337bf5=events[_0x07be('0x4')];_0x47a20b<_0x337bf5;_0x47a20b++){var _0x188fe0=events[_0x47a20b];var _0x16fbfb=createListener(_0x07be('0x5')+_0x188fe0,_0x1bfb1f);VoiceQueueEvents['on'](_0x188fe0,_0x16fbfb);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 1e94e1c..528a5c2 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 _0x478a=['/index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe'];(function(_0x293473,_0x36661e){var _0x1b2700=function(_0x337666){while(--_0x337666){_0x293473['push'](_0x293473['shift']());}};_0x1b2700(++_0x36661e);}(_0x478a,0x154));var _0xa478=function(_0x40a563,_0x2b5610){_0x40a563=_0x40a563-0x0;var _0x449134=_0x478a[_0x40a563];return _0x449134;};'use strict';var multer=require(_0xa478('0x0'));var util=require(_0xa478('0x1'));var path=require(_0xa478('0x2'));var timeout=require(_0xa478('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xa478('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa478('0x5'));var config=require(_0xa478('0x6'));var controller=require('./voiceQueueReport.controller');router['get']('/',auth[_0xa478('0x7')](),controller[_0xa478('0x8')]);router[_0xa478('0x9')](_0xa478('0xa'),auth[_0xa478('0x7')](),controller[_0xa478('0xb')]);router[_0xa478('0x9')](_0xa478('0xc'),auth[_0xa478('0x7')](),controller['getVoiceQueuesReport']);router['get'](_0xa478('0xd'),auth[_0xa478('0x7')](),controller[_0xa478('0xe')]);router[_0xa478('0xf')]('/',auth[_0xa478('0x7')](),controller[_0xa478('0x10')]);router[_0xa478('0x11')](_0xa478('0xd'),auth[_0xa478('0x7')](),controller[_0xa478('0x12')]);router[_0xa478('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xa478('0x14')]);module[_0xa478('0x15')]=router; \ No newline at end of file +var _0x24f8=['connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','isAuthenticated','index','get','/describe','describe','/index','/:id','show','post','create','put','update','delete','multer','util'];(function(_0x2bc5f9,_0x3a16dd){var _0x496108=function(_0x1c6cc8){while(--_0x1c6cc8){_0x2bc5f9['push'](_0x2bc5f9['shift']());}};_0x496108(++_0x3a16dd);}(_0x24f8,0x7c));var _0x824f=function(_0x301dab,_0x38050a){_0x301dab=_0x301dab-0x0;var _0x2500a2=_0x24f8[_0x301dab];return _0x2500a2;};'use strict';var multer=require(_0x824f('0x0'));var util=require(_0x824f('0x1'));var path=require('path');var timeout=require(_0x824f('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x824f('0x3'));var auth=require(_0x824f('0x4'));var interaction=require(_0x824f('0x5'));var config=require(_0x824f('0x6'));var controller=require(_0x824f('0x7'));router['get']('/',auth[_0x824f('0x8')](),controller[_0x824f('0x9')]);router[_0x824f('0xa')](_0x824f('0xb'),auth[_0x824f('0x8')](),controller[_0x824f('0xc')]);router[_0x824f('0xa')](_0x824f('0xd'),auth[_0x824f('0x8')](),controller['getVoiceQueuesReport']);router['get'](_0x824f('0xe'),auth[_0x824f('0x8')](),controller[_0x824f('0xf')]);router[_0x824f('0x10')]('/',auth[_0x824f('0x8')](),controller[_0x824f('0x11')]);router[_0x824f('0x12')](_0x824f('0xe'),auth[_0x824f('0x8')](),controller[_0x824f('0x13')]);router[_0x824f('0x14')](_0x824f('0xe'),auth[_0x824f('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 739f983..fd2f27c 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 _0x3aaa=['COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','sequelize','exports','STRING','DATE','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','seconds','setDataValue','holdtime','INTEGER','BOOLEAN'];(function(_0x5ded96,_0x35805c){var _0x3cd145=function(_0x324285){while(--_0x324285){_0x5ded96['push'](_0x5ded96['shift']());}};_0x3cd145(++_0x35805c);}(_0x3aaa,0xfd));var _0xa3aa=function(_0x57e68b,_0x582e9a){_0x57e68b=_0x57e68b-0x0;var _0x10ba9c=_0x3aaa[_0x57e68b];return _0x10ba9c;};'use strict';var Sequelize=require(_0xa3aa('0x0'));var moment=require('moment');module[_0xa3aa('0x1')]={'type':{'type':Sequelize[_0xa3aa('0x2')]},'uniqueid':{'type':Sequelize[_0xa3aa('0x2')]},'calleridnum':{'type':Sequelize[_0xa3aa('0x2')]},'calleridname':{'type':Sequelize[_0xa3aa('0x2')]},'queue':{'type':Sequelize[_0xa3aa('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0xa3aa('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0xa3aa('0x3')],'set':function(_0x51387a){var _0x52ee45=moment(_0x51387a);var _0x3dec93=moment(this['getDataValue'](_0xa3aa('0x4')))['format'](_0xa3aa('0x5'));var _0x358981=_0x52ee45['diff'](_0x3dec93,_0xa3aa('0x6'));this[_0xa3aa('0x7')]('queuecallerleaveAt',_0x51387a);this[_0xa3aa('0x7')](_0xa3aa('0x8'),_0x358981||null);}},'position':{'type':Sequelize[_0xa3aa('0x9')]},'count':{'type':Sequelize[_0xa3aa('0x9')]},'queuecallerabandon':{'type':Sequelize[_0xa3aa('0xa')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xa3aa('0x3')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0xa3aa('0xa')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xa3aa('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0xa3aa('0x2')],'comment':_0xa3aa('0xb')},'originalposition':{'type':Sequelize[_0xa3aa('0x9')]},'channel':{'type':Sequelize[_0xa3aa('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xa3aa('0x2')]},'context':{'type':Sequelize[_0xa3aa('0x2')]},'exten':{'type':Sequelize[_0xa3aa('0x2')]},'priority':{'type':Sequelize[_0xa3aa('0x2')]},'holdtime':{'type':Sequelize[_0xa3aa('0x9')]},'mohtime':{'type':Sequelize[_0xa3aa('0x9')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xa3aa('0x2')]},'transfer':{'type':Sequelize[_0xa3aa('0xa')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xa3aa('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0xa3aa('0x2')]},'transferuniqueid':{'type':Sequelize[_0xa3aa('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xa3aa('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0xa3aa('0x9')],'defaultValue':0x0},'note':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3fa7=['getDataValue','format','diff','seconds','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE'];(function(_0x1ff26f,_0x24704d){var _0x2fed9b=function(_0x4ea6e0){while(--_0x4ea6e0){_0x1ff26f['push'](_0x1ff26f['shift']());}};_0x2fed9b(++_0x24704d);}(_0x3fa7,0x1d7));var _0x73fa=function(_0x1e4994,_0x48d00c){_0x1e4994=_0x1e4994-0x0;var _0x33aa9a=_0x3fa7[_0x1e4994];return _0x33aa9a;};'use strict';var Sequelize=require(_0x73fa('0x0'));var moment=require(_0x73fa('0x1'));module[_0x73fa('0x2')]={'type':{'type':Sequelize[_0x73fa('0x3')]},'uniqueid':{'type':Sequelize[_0x73fa('0x3')]},'calleridnum':{'type':Sequelize[_0x73fa('0x3')]},'calleridname':{'type':Sequelize[_0x73fa('0x3')]},'queue':{'type':Sequelize[_0x73fa('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x73fa('0x4')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x30b244){var _0x3ab615=moment(_0x30b244);var _0x2507bf=moment(this[_0x73fa('0x5')]('queuecallerjoinAt'))[_0x73fa('0x6')]('YYYY-MM-DD\x20HH:mm:ss');var _0x349b49=_0x3ab615[_0x73fa('0x7')](_0x2507bf,_0x73fa('0x8'));this['setDataValue']('queuecallerleaveAt',_0x30b244);this['setDataValue'](_0x73fa('0x9'),_0x349b49||null);}},'position':{'type':Sequelize[_0x73fa('0xa')]},'count':{'type':Sequelize[_0x73fa('0xa')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x73fa('0xb')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x73fa('0x4')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x73fa('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x73fa('0x3')],'comment':_0x73fa('0xc')},'originalposition':{'type':Sequelize[_0x73fa('0xa')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x73fa('0x3')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x73fa('0x3')]},'context':{'type':Sequelize[_0x73fa('0x3')]},'exten':{'type':Sequelize[_0x73fa('0x3')]},'priority':{'type':Sequelize[_0x73fa('0x3')]},'holdtime':{'type':Sequelize[_0x73fa('0xa')]},'mohtime':{'type':Sequelize[_0x73fa('0xa')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x73fa('0xb')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x73fa('0x3')]},'transfer':{'type':Sequelize[_0x73fa('0xb')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x73fa('0x3')],'comment':_0x73fa('0xd')},'transferexten':{'type':Sequelize[_0x73fa('0x3')]},'transferuniqueid':{'type':Sequelize[_0x73fa('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x73fa('0x3')]},'thirdDisposition':{'type':Sequelize[_0x73fa('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x73fa('0xa')],'defaultValue':0x0},'note':{'type':Sequelize[_0x73fa('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 8c85ec0..013eb6a 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 _0x1a74=['catch','create','body','update','describe','getVoiceQueuesReport','eml-format','fast-json-patch','request-promise','mustache','path','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','count','limit','set','apply','reject','save','then','destroy','error','stack','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','include','findAll','rows','show','params','includeAll','find'];(function(_0x5074a5,_0x22081e){var _0x5e1dce=function(_0x3b1b4d){while(--_0x3b1b4d){_0x5074a5['push'](_0x5074a5['shift']());}};_0x5e1dce(++_0x22081e);}(_0x1a74,0x182));var _0x41a7=function(_0x3ac152,_0x1de6ec){_0x3ac152=_0x3ac152-0x0;var _0x49361f=_0x1a74[_0x3ac152];return _0x49361f;};'use strict';var emlformat=require(_0x41a7('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x41a7('0x1'));var rp=require(_0x41a7('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x41a7('0x3'));var util=require('util');var path=require(_0x41a7('0x4'));var sox=require('sox');var csv=require(_0x41a7('0x5'));var ejs=require(_0x41a7('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x41a7('0x7'));var crypto=require(_0x41a7('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x41a7('0x9'));var toCsv=require(_0x41a7('0x5'));var querystring=require(_0x41a7('0xa'));var Papa=require(_0x41a7('0xb'));var Redis=require(_0x41a7('0xc'));var authService=require(_0x41a7('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x41a7('0xe'));var utils=require(_0x41a7('0xf'));var config=require(_0x41a7('0x10'));var licenseUtil=require('../../config/license/util');var db=require(_0x41a7('0x11'))['db'];config[_0x41a7('0x12')]=_[_0x41a7('0x13')](config[_0x41a7('0x12')],{'host':_0x41a7('0x14'),'port':0x18eb});var socket=require(_0x41a7('0x15'))(new Redis(config[_0x41a7('0x12')]));require('./voiceQueueReport.socket')[_0x41a7('0x16')](socket);function respondWithStatusCode(_0x28ad14,_0x4f95dc){_0x4f95dc=_0x4f95dc||0xcc;return function(_0x331f5c){if(_0x331f5c){return _0x28ad14[_0x41a7('0x17')](_0x4f95dc);}return _0x28ad14[_0x41a7('0x18')](_0x4f95dc)[_0x41a7('0x19')]();};}function respondWithResult(_0x1070fe,_0x29239a){_0x29239a=_0x29239a||0xc8;return function(_0x49602b){if(_0x49602b){return _0x1070fe['status'](_0x29239a)[_0x41a7('0x1a')](_0x49602b);}};}function respondWithFilteredResult(_0x17a3c9,_0x4d1f94){return function(_0x5e640e){if(_0x5e640e){var _0x342c22=typeof _0x4d1f94[_0x41a7('0x1b')]==='undefined'&&typeof _0x4d1f94['limit']==='undefined';var _0x1ff696=_0x5e640e[_0x41a7('0x1c')];var _0x10babe=_0x342c22?0x0:_0x4d1f94['offset'];var _0x4581b9=_0x342c22?_0x5e640e['count']:_0x4d1f94[_0x41a7('0x1b')]+_0x4d1f94[_0x41a7('0x1d')];var _0x570593;if(_0x4581b9>=_0x1ff696){_0x4581b9=_0x1ff696;_0x570593=0xc8;}else{_0x570593=0xce;}_0x17a3c9[_0x41a7('0x18')](_0x570593);return _0x17a3c9[_0x41a7('0x1e')]('Content-Range',_0x10babe+'-'+_0x4581b9+'/'+_0x1ff696)['json'](_0x5e640e);}return null;};}function patchUpdates(_0x2b0849){return function(_0x525dc9){try{jsonpatch[_0x41a7('0x1f')](_0x525dc9,_0x2b0849,!![]);}catch(_0xb014f8){return BPromise[_0x41a7('0x20')](_0xb014f8);}return _0x525dc9[_0x41a7('0x21')]();};}function saveUpdates(_0x36cdd6,_0x47cd95){return function(_0x185d0d){if(_0x185d0d){return _0x185d0d['update'](_0x36cdd6)[_0x41a7('0x22')](function(_0x259f9c){return _0x259f9c;});}return null;};}function removeEntity(_0x395697,_0x1418aa){return function(_0x347c2){if(_0x347c2){return _0x347c2[_0x41a7('0x23')]()[_0x41a7('0x22')](function(){_0x395697[_0x41a7('0x18')](0xcc)[_0x41a7('0x19')]();});}};}function handleEntityNotFound(_0x400577,_0x4e2e43){return function(_0xb2f524){if(!_0xb2f524){_0x400577[_0x41a7('0x17')](0x194);}return _0xb2f524;};}function handleError(_0x578814,_0x211adc){_0x211adc=_0x211adc||0x1f4;return function(_0x4ecff6){logger[_0x41a7('0x24')](_0x4ecff6[_0x41a7('0x25')]);if(_0x4ecff6['name']){delete _0x4ecff6[_0x41a7('0x26')];}_0x578814[_0x41a7('0x18')](_0x211adc)[_0x41a7('0x27')](_0x4ecff6);};}exports[_0x41a7('0x28')]=function(_0x596f60,_0x55ccfc){var _0x256602={},_0x35219e={},_0x2bf044={'count':0x0,'rows':[]};var _0x754924=_[_0x41a7('0x29')](db[_0x41a7('0x2a')][_0x41a7('0x2b')],function(_0x254b4f){return{'name':_0x254b4f[_0x41a7('0x2c')],'type':_0x254b4f[_0x41a7('0x2d')][_0x41a7('0x2e')]};});_0x35219e[_0x41a7('0x2f')]=_[_0x41a7('0x29')](_0x754924,_0x41a7('0x26'));_0x35219e['query']=_[_0x41a7('0x30')](_0x596f60[_0x41a7('0x31')]);_0x35219e[_0x41a7('0x32')]=_[_0x41a7('0x33')](_0x35219e[_0x41a7('0x2f')],_0x35219e[_0x41a7('0x31')]);_0x256602[_0x41a7('0x34')]=_['intersection'](_0x35219e[_0x41a7('0x2f')],qs[_0x41a7('0x35')](_0x596f60[_0x41a7('0x31')][_0x41a7('0x35')]));_0x256602[_0x41a7('0x34')]=_0x256602['attributes'][_0x41a7('0x36')]?_0x256602[_0x41a7('0x34')]:_0x35219e['model'];if(!_0x596f60['query'][_0x41a7('0x37')](_0x41a7('0x38'))){_0x256602[_0x41a7('0x1d')]=qs[_0x41a7('0x1d')](_0x596f60[_0x41a7('0x31')][_0x41a7('0x1d')]);_0x256602['offset']=qs[_0x41a7('0x1b')](_0x596f60['query'][_0x41a7('0x1b')]);}_0x256602['order']=qs[_0x41a7('0x39')](_0x596f60[_0x41a7('0x31')][_0x41a7('0x39')]);_0x256602[_0x41a7('0x3a')]=qs[_0x41a7('0x32')](_[_0x41a7('0x3b')](_0x596f60[_0x41a7('0x31')],_0x35219e[_0x41a7('0x32')]),_0x754924);if(_0x596f60[_0x41a7('0x31')]['filter']){_0x256602[_0x41a7('0x3a')]=_['merge'](_0x256602[_0x41a7('0x3a')],{'$or':_[_0x41a7('0x29')](_0x754924,function(_0x26c253){if(_0x26c253[_0x41a7('0x2d')]!=='VIRTUAL'){var _0xe9f4e9={};_0xe9f4e9[_0x26c253[_0x41a7('0x26')]]={'$like':'%'+_0x596f60['query'][_0x41a7('0x3c')]+'%'};return _0xe9f4e9;}})});}_0x256602=_[_0x41a7('0x3d')]({},_0x256602,_0x596f60[_0x41a7('0x3e')]);var _0x4099f8={'where':_0x256602[_0x41a7('0x3a')]};return db[_0x41a7('0x2a')][_0x41a7('0x1c')](_0x4099f8)[_0x41a7('0x22')](function(_0xc1fa3){_0x2bf044[_0x41a7('0x1c')]=_0xc1fa3;if(_0x596f60[_0x41a7('0x31')]['includeAll']){_0x256602[_0x41a7('0x3f')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x41a7('0x40')](_0x256602);})[_0x41a7('0x22')](function(_0x2d61b4){_0x2bf044[_0x41a7('0x41')]=_0x2d61b4;return _0x2bf044;})['then'](respondWithFilteredResult(_0x55ccfc,_0x256602))['catch'](handleError(_0x55ccfc,null));};exports[_0x41a7('0x42')]=function(_0x3325fc,_0x21647e){var _0x59fa05={'raw':![],'where':{'id':_0x3325fc[_0x41a7('0x43')]['id']}},_0x4fbde3={};_0x4fbde3['model']=_[_0x41a7('0x30')](db[_0x41a7('0x2a')][_0x41a7('0x2b')]);_0x4fbde3['query']=_[_0x41a7('0x30')](_0x3325fc[_0x41a7('0x31')]);_0x4fbde3[_0x41a7('0x32')]=_[_0x41a7('0x33')](_0x4fbde3[_0x41a7('0x2f')],_0x4fbde3[_0x41a7('0x31')]);_0x59fa05[_0x41a7('0x34')]=_[_0x41a7('0x33')](_0x4fbde3['model'],qs[_0x41a7('0x35')](_0x3325fc[_0x41a7('0x31')][_0x41a7('0x35')]));_0x59fa05['attributes']=_0x59fa05['attributes'][_0x41a7('0x36')]?_0x59fa05[_0x41a7('0x34')]:_0x4fbde3[_0x41a7('0x2f')];if(_0x3325fc['query'][_0x41a7('0x44')]){_0x59fa05[_0x41a7('0x3f')]=[{'all':!![]}];}_0x59fa05=_[_0x41a7('0x3d')]({},_0x59fa05,_0x3325fc[_0x41a7('0x3e')]);return db[_0x41a7('0x2a')][_0x41a7('0x45')](_0x59fa05)['then'](handleEntityNotFound(_0x21647e,null))[_0x41a7('0x22')](respondWithResult(_0x21647e,null))[_0x41a7('0x46')](handleError(_0x21647e,null));};exports[_0x41a7('0x47')]=function(_0x2dae57,_0x19b9ce){return db['VoiceQueueReport']['create'](_0x2dae57[_0x41a7('0x48')],{})['then'](respondWithResult(_0x19b9ce,0xc9))[_0x41a7('0x46')](handleError(_0x19b9ce,null));};exports[_0x41a7('0x49')]=function(_0x210a05,_0x5d4f96){if(_0x210a05['body']['id']){delete _0x210a05[_0x41a7('0x48')]['id'];}return db[_0x41a7('0x2a')]['find']({'where':{'id':_0x210a05[_0x41a7('0x43')]['id']}})[_0x41a7('0x22')](handleEntityNotFound(_0x5d4f96,null))['then'](saveUpdates(_0x210a05[_0x41a7('0x48')],null))[_0x41a7('0x22')](respondWithResult(_0x5d4f96,null))[_0x41a7('0x46')](handleError(_0x5d4f96,null));};exports[_0x41a7('0x23')]=function(_0x26e0c1,_0x119c3a){return db[_0x41a7('0x2a')][_0x41a7('0x45')]({'where':{'id':_0x26e0c1['params']['id']}})[_0x41a7('0x22')](handleEntityNotFound(_0x119c3a,null))[_0x41a7('0x22')](removeEntity(_0x119c3a,null))[_0x41a7('0x46')](handleError(_0x119c3a,null));};exports[_0x41a7('0x4a')]=function(_0x22a251,_0x2b8d0e){return db[_0x41a7('0x2a')][_0x41a7('0x4a')]()[_0x41a7('0x22')](respondWithResult(_0x2b8d0e,null))[_0x41a7('0x46')](handleError(_0x2b8d0e,null));};exports['getVoiceQueuesReport']=function(_0x3556f0,_0x4157e1){var _0x92ca86={},_0x46bb34={},_0x301295={'count':0x0,'rows':[]};_0x46bb34['model']=_[_0x41a7('0x30')](db[_0x41a7('0x2a')]['rawAttributes']);_0x46bb34[_0x41a7('0x31')]=_['keys'](_0x3556f0['query']);_0x46bb34[_0x41a7('0x32')]=_['intersection'](_0x46bb34['model'],_0x46bb34[_0x41a7('0x31')]);_0x92ca86[_0x41a7('0x34')]=_[_0x41a7('0x33')](_0x46bb34[_0x41a7('0x2f')],qs[_0x41a7('0x35')](_0x3556f0[_0x41a7('0x31')][_0x41a7('0x35')]));_0x92ca86[_0x41a7('0x34')]=_0x92ca86[_0x41a7('0x34')][_0x41a7('0x36')]?_0x92ca86[_0x41a7('0x34')]:_0x46bb34[_0x41a7('0x2f')];if(!_0x3556f0['query'][_0x41a7('0x37')](_0x41a7('0x38'))){_0x92ca86[_0x41a7('0x1d')]=qs[_0x41a7('0x1d')](_0x3556f0[_0x41a7('0x31')][_0x41a7('0x1d')]);_0x92ca86[_0x41a7('0x1b')]=qs[_0x41a7('0x1b')](_0x3556f0[_0x41a7('0x31')]['offset']);}_0x92ca86['order']=qs[_0x41a7('0x39')](_0x3556f0[_0x41a7('0x31')]['sort']);_0x92ca86[_0x41a7('0x3a')]=qs['filters'](_[_0x41a7('0x3b')](_0x3556f0[_0x41a7('0x31')],_0x46bb34['filters']));if(_0x3556f0[_0x41a7('0x31')][_0x41a7('0x3c')]){_0x92ca86['where']=_[_0x41a7('0x3d')](_0x92ca86[_0x41a7('0x3a')],{'$or':_[_0x41a7('0x29')](_0x92ca86['attributes'],function(_0x403329){var _0x58eb02={};_0x58eb02[_0x403329]={'$like':'%'+_0x3556f0[_0x41a7('0x31')][_0x41a7('0x3c')]+'%'};return _0x58eb02;})});}_0x92ca86=_[_0x41a7('0x3d')]({},_0x92ca86,_0x3556f0['options']);var _0x364d0d={'where':_0x92ca86[_0x41a7('0x3a')]};return db[_0x41a7('0x2a')][_0x41a7('0x1c')](_0x364d0d)[_0x41a7('0x22')](function(_0x376438){_0x301295['count']=_0x376438;if(_0x3556f0[_0x41a7('0x31')][_0x41a7('0x44')]){_0x92ca86[_0x41a7('0x3f')]=[{'all':!![]}];}return db['VoiceQueueReport']['findAll'](_0x92ca86);})[_0x41a7('0x22')](function(_0x2ef5ed){_0x301295[_0x41a7('0x41')]=_0x2ef5ed;return _0x301295;})[_0x41a7('0x22')](respondWithFilteredResult(_0x4157e1,_0x92ca86,_0x41a7('0x4b')))[_0x41a7('0x46')](handleError(_0x4157e1,null,_0x41a7('0x4b')));}; \ No newline at end of file +var _0xb327=['./voiceQueueReport.socket','register','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','destroy','then','end','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VoiceQueueReport','includeAll','findAll','catch','show','params','include','create','body','describe','getVoiceQueuesReport','hasOwnProperty','pick','rows','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults'];(function(_0x5db129,_0x151303){var _0x5ec143=function(_0x245b33){while(--_0x245b33){_0x5db129['push'](_0x5db129['shift']());}};_0x5ec143(++_0x151303);}(_0xb327,0x1db));var _0x7b32=function(_0x30153b,_0x4b4a33){_0x30153b=_0x30153b-0x0;var _0x2401a2=_0xb327[_0x30153b];return _0x2401a2;};'use strict';var emlformat=require(_0x7b32('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7b32('0x1'));var jsonpatch=require(_0x7b32('0x2'));var rp=require(_0x7b32('0x3'));var moment=require(_0x7b32('0x4'));var BPromise=require(_0x7b32('0x5'));var Mustache=require(_0x7b32('0x6'));var util=require(_0x7b32('0x7'));var path=require('path');var sox=require(_0x7b32('0x8'));var csv=require('to-csv');var ejs=require(_0x7b32('0x9'));var fs=require('fs');var fs_extra=require(_0x7b32('0xa'));var _=require(_0x7b32('0xb'));var squel=require(_0x7b32('0xc'));var crypto=require(_0x7b32('0xd'));var jsforce=require(_0x7b32('0xe'));var deskjs=require(_0x7b32('0xf'));var toCsv=require(_0x7b32('0x10'));var querystring=require(_0x7b32('0x11'));var Papa=require(_0x7b32('0x12'));var Redis=require(_0x7b32('0x13'));var authService=require(_0x7b32('0x14'));var qs=require(_0x7b32('0x15'));var as=require(_0x7b32('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7b32('0x17'))(_0x7b32('0x18'));var utils=require(_0x7b32('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7b32('0x1a'))['db'];config[_0x7b32('0x1b')]=_[_0x7b32('0x1c')](config[_0x7b32('0x1b')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7b32('0x1b')]));require(_0x7b32('0x1d'))[_0x7b32('0x1e')](socket);function respondWithStatusCode(_0x1c38a7,_0x139e35){_0x139e35=_0x139e35||0xcc;return function(_0x1ebf46){if(_0x1ebf46){return _0x1c38a7['sendStatus'](_0x139e35);}return _0x1c38a7[_0x7b32('0x1f')](_0x139e35)['end']();};}function respondWithResult(_0x167830,_0x2e6395){_0x2e6395=_0x2e6395||0xc8;return function(_0x34f55c){if(_0x34f55c){return _0x167830[_0x7b32('0x1f')](_0x2e6395)[_0x7b32('0x20')](_0x34f55c);}};}function respondWithFilteredResult(_0x44d365,_0x58e767){return function(_0xc0659e){if(_0xc0659e){var _0xdfdcd5=typeof _0x58e767[_0x7b32('0x21')]===_0x7b32('0x22')&&typeof _0x58e767['limit']===_0x7b32('0x22');var _0x518747=_0xc0659e[_0x7b32('0x23')];var _0x5538c0=_0xdfdcd5?0x0:_0x58e767['offset'];var _0x52ee32=_0xdfdcd5?_0xc0659e[_0x7b32('0x23')]:_0x58e767[_0x7b32('0x21')]+_0x58e767[_0x7b32('0x24')];var _0x3d7797;if(_0x52ee32>=_0x518747){_0x52ee32=_0x518747;_0x3d7797=0xc8;}else{_0x3d7797=0xce;}_0x44d365[_0x7b32('0x1f')](_0x3d7797);return _0x44d365['set'](_0x7b32('0x25'),_0x5538c0+'-'+_0x52ee32+'/'+_0x518747)['json'](_0xc0659e);}return null;};}function patchUpdates(_0x381eb6){return function(_0x217667){try{jsonpatch[_0x7b32('0x26')](_0x217667,_0x381eb6,!![]);}catch(_0x55a4ea){return BPromise[_0x7b32('0x27')](_0x55a4ea);}return _0x217667[_0x7b32('0x28')]();};}function saveUpdates(_0x4a661a,_0x1157ae){return function(_0x35b3d8){if(_0x35b3d8){return _0x35b3d8[_0x7b32('0x29')](_0x4a661a)['then'](function(_0x269af4){return _0x269af4;});}return null;};}function removeEntity(_0x47ba08,_0x1196b0){return function(_0x5a9d82){if(_0x5a9d82){return _0x5a9d82[_0x7b32('0x2a')]()[_0x7b32('0x2b')](function(){_0x47ba08[_0x7b32('0x1f')](0xcc)[_0x7b32('0x2c')]();});}};}function handleEntityNotFound(_0x4b3c1c,_0x2d572f){return function(_0x566577){if(!_0x566577){_0x4b3c1c[_0x7b32('0x2d')](0x194);}return _0x566577;};}function handleError(_0x1dada9,_0x2c9a72){_0x2c9a72=_0x2c9a72||0x1f4;return function(_0x3169c){logger[_0x7b32('0x2e')](_0x3169c[_0x7b32('0x2f')]);if(_0x3169c[_0x7b32('0x30')]){delete _0x3169c['name'];}_0x1dada9['status'](_0x2c9a72)[_0x7b32('0x31')](_0x3169c);};}exports[_0x7b32('0x32')]=function(_0x846539,_0x474966){var _0xbc240a={},_0x4324fc={},_0x520c2e={'count':0x0,'rows':[]};var _0x5b093d=_[_0x7b32('0x33')](db['VoiceQueueReport'][_0x7b32('0x34')],function(_0x1c422b){return{'name':_0x1c422b[_0x7b32('0x35')],'type':_0x1c422b[_0x7b32('0x36')][_0x7b32('0x37')]};});_0x4324fc[_0x7b32('0x38')]=_[_0x7b32('0x33')](_0x5b093d,_0x7b32('0x30'));_0x4324fc[_0x7b32('0x39')]=_[_0x7b32('0x3a')](_0x846539[_0x7b32('0x39')]);_0x4324fc[_0x7b32('0x3b')]=_[_0x7b32('0x3c')](_0x4324fc[_0x7b32('0x38')],_0x4324fc[_0x7b32('0x39')]);_0xbc240a[_0x7b32('0x3d')]=_[_0x7b32('0x3c')](_0x4324fc[_0x7b32('0x38')],qs[_0x7b32('0x3e')](_0x846539['query'][_0x7b32('0x3e')]));_0xbc240a[_0x7b32('0x3d')]=_0xbc240a[_0x7b32('0x3d')][_0x7b32('0x3f')]?_0xbc240a[_0x7b32('0x3d')]:_0x4324fc['model'];if(!_0x846539[_0x7b32('0x39')]['hasOwnProperty'](_0x7b32('0x40'))){_0xbc240a[_0x7b32('0x24')]=qs[_0x7b32('0x24')](_0x846539[_0x7b32('0x39')][_0x7b32('0x24')]);_0xbc240a[_0x7b32('0x21')]=qs[_0x7b32('0x21')](_0x846539['query'][_0x7b32('0x21')]);}_0xbc240a[_0x7b32('0x41')]=qs[_0x7b32('0x42')](_0x846539['query']['sort']);_0xbc240a[_0x7b32('0x43')]=qs[_0x7b32('0x3b')](_['pick'](_0x846539[_0x7b32('0x39')],_0x4324fc['filters']),_0x5b093d);if(_0x846539[_0x7b32('0x39')][_0x7b32('0x44')]){_0xbc240a[_0x7b32('0x43')]=_[_0x7b32('0x45')](_0xbc240a[_0x7b32('0x43')],{'$or':_['map'](_0x5b093d,function(_0x4b82a3){if(_0x4b82a3['type']!=='VIRTUAL'){var _0xcdc45a={};_0xcdc45a[_0x4b82a3[_0x7b32('0x30')]]={'$like':'%'+_0x846539[_0x7b32('0x39')]['filter']+'%'};return _0xcdc45a;}})});}_0xbc240a=_[_0x7b32('0x45')]({},_0xbc240a,_0x846539['options']);var _0x3a05fa={'where':_0xbc240a[_0x7b32('0x43')]};return db[_0x7b32('0x46')][_0x7b32('0x23')](_0x3a05fa)['then'](function(_0x1ffff1){_0x520c2e['count']=_0x1ffff1;if(_0x846539['query'][_0x7b32('0x47')]){_0xbc240a['include']=[{'all':!![]}];}return db[_0x7b32('0x46')][_0x7b32('0x48')](_0xbc240a);})['then'](function(_0x2e18b2){_0x520c2e['rows']=_0x2e18b2;return _0x520c2e;})[_0x7b32('0x2b')](respondWithFilteredResult(_0x474966,_0xbc240a))[_0x7b32('0x49')](handleError(_0x474966,null));};exports[_0x7b32('0x4a')]=function(_0x5bf1cb,_0x31c4c9){var _0x42e028={'raw':![],'where':{'id':_0x5bf1cb[_0x7b32('0x4b')]['id']}},_0x1556c1={};_0x1556c1[_0x7b32('0x38')]=_[_0x7b32('0x3a')](db[_0x7b32('0x46')]['rawAttributes']);_0x1556c1[_0x7b32('0x39')]=_[_0x7b32('0x3a')](_0x5bf1cb[_0x7b32('0x39')]);_0x1556c1[_0x7b32('0x3b')]=_[_0x7b32('0x3c')](_0x1556c1[_0x7b32('0x38')],_0x1556c1[_0x7b32('0x39')]);_0x42e028['attributes']=_['intersection'](_0x1556c1[_0x7b32('0x38')],qs[_0x7b32('0x3e')](_0x5bf1cb[_0x7b32('0x39')]['fields']));_0x42e028[_0x7b32('0x3d')]=_0x42e028[_0x7b32('0x3d')][_0x7b32('0x3f')]?_0x42e028['attributes']:_0x1556c1['model'];if(_0x5bf1cb[_0x7b32('0x39')][_0x7b32('0x47')]){_0x42e028[_0x7b32('0x4c')]=[{'all':!![]}];}_0x42e028=_[_0x7b32('0x45')]({},_0x42e028,_0x5bf1cb['options']);return db[_0x7b32('0x46')]['find'](_0x42e028)[_0x7b32('0x2b')](handleEntityNotFound(_0x31c4c9,null))['then'](respondWithResult(_0x31c4c9,null))[_0x7b32('0x49')](handleError(_0x31c4c9,null));};exports['create']=function(_0x5150cd,_0x227427){return db[_0x7b32('0x46')][_0x7b32('0x4d')](_0x5150cd[_0x7b32('0x4e')],{})['then'](respondWithResult(_0x227427,0xc9))['catch'](handleError(_0x227427,null));};exports[_0x7b32('0x29')]=function(_0x15c142,_0x3b63fb){if(_0x15c142[_0x7b32('0x4e')]['id']){delete _0x15c142[_0x7b32('0x4e')]['id'];}return db[_0x7b32('0x46')]['find']({'where':{'id':_0x15c142[_0x7b32('0x4b')]['id']}})[_0x7b32('0x2b')](handleEntityNotFound(_0x3b63fb,null))[_0x7b32('0x2b')](saveUpdates(_0x15c142['body'],null))[_0x7b32('0x2b')](respondWithResult(_0x3b63fb,null))[_0x7b32('0x49')](handleError(_0x3b63fb,null));};exports['destroy']=function(_0x38089b,_0x1c465d){return db[_0x7b32('0x46')]['find']({'where':{'id':_0x38089b['params']['id']}})[_0x7b32('0x2b')](handleEntityNotFound(_0x1c465d,null))['then'](removeEntity(_0x1c465d,null))['catch'](handleError(_0x1c465d,null));};exports['describe']=function(_0x4541db,_0xc8f8b3){return db[_0x7b32('0x46')][_0x7b32('0x4f')]()[_0x7b32('0x2b')](respondWithResult(_0xc8f8b3,null))[_0x7b32('0x49')](handleError(_0xc8f8b3,null));};exports[_0x7b32('0x50')]=function(_0x31bc2f,_0x1e4b21){var _0x5e9568={},_0x2453b3={},_0x363504={'count':0x0,'rows':[]};_0x2453b3['model']=_[_0x7b32('0x3a')](db[_0x7b32('0x46')][_0x7b32('0x34')]);_0x2453b3[_0x7b32('0x39')]=_[_0x7b32('0x3a')](_0x31bc2f[_0x7b32('0x39')]);_0x2453b3[_0x7b32('0x3b')]=_['intersection'](_0x2453b3['model'],_0x2453b3[_0x7b32('0x39')]);_0x5e9568['attributes']=_['intersection'](_0x2453b3[_0x7b32('0x38')],qs['fields'](_0x31bc2f['query'][_0x7b32('0x3e')]));_0x5e9568[_0x7b32('0x3d')]=_0x5e9568['attributes'][_0x7b32('0x3f')]?_0x5e9568[_0x7b32('0x3d')]:_0x2453b3[_0x7b32('0x38')];if(!_0x31bc2f[_0x7b32('0x39')][_0x7b32('0x51')]('nolimit')){_0x5e9568[_0x7b32('0x24')]=qs['limit'](_0x31bc2f[_0x7b32('0x39')][_0x7b32('0x24')]);_0x5e9568[_0x7b32('0x21')]=qs[_0x7b32('0x21')](_0x31bc2f[_0x7b32('0x39')][_0x7b32('0x21')]);}_0x5e9568['order']=qs[_0x7b32('0x42')](_0x31bc2f['query']['sort']);_0x5e9568[_0x7b32('0x43')]=qs[_0x7b32('0x3b')](_[_0x7b32('0x52')](_0x31bc2f[_0x7b32('0x39')],_0x2453b3['filters']));if(_0x31bc2f[_0x7b32('0x39')][_0x7b32('0x44')]){_0x5e9568['where']=_[_0x7b32('0x45')](_0x5e9568[_0x7b32('0x43')],{'$or':_['map'](_0x5e9568[_0x7b32('0x3d')],function(_0x175ee8){var _0x4b0de0={};_0x4b0de0[_0x175ee8]={'$like':'%'+_0x31bc2f[_0x7b32('0x39')][_0x7b32('0x44')]+'%'};return _0x4b0de0;})});}_0x5e9568=_[_0x7b32('0x45')]({},_0x5e9568,_0x31bc2f['options']);var _0xf500cf={'where':_0x5e9568[_0x7b32('0x43')]};return db[_0x7b32('0x46')][_0x7b32('0x23')](_0xf500cf)[_0x7b32('0x2b')](function(_0x3a7680){_0x363504['count']=_0x3a7680;if(_0x31bc2f[_0x7b32('0x39')]['includeAll']){_0x5e9568['include']=[{'all':!![]}];}return db[_0x7b32('0x46')][_0x7b32('0x48')](_0x5e9568);})[_0x7b32('0x2b')](function(_0x19ca06){_0x363504[_0x7b32('0x53')]=_0x19ca06;return _0x363504;})[_0x7b32('0x2b')](respondWithFilteredResult(_0x1e4b21,_0x5e9568,'getVoiceQueuesReport'))[_0x7b32('0x49')](handleError(_0x1e4b21,null,_0x7b32('0x50')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index d4123b6..6b7160e 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 _0x9f38=['hasOwnProperty','hook','exports','VoiceQueueReport','setMaxListeners','save','remove','emit'];(function(_0x39d767,_0xdfe6cd){var _0x69feca=function(_0x1e5316){while(--_0x1e5316){_0x39d767['push'](_0x39d767['shift']());}};_0x69feca(++_0xdfe6cd);}(_0x9f38,0x153));var _0x89f3=function(_0x18c2c6,_0x88ecb7){_0x18c2c6=_0x18c2c6-0x0;var _0x497ad4=_0x9f38[_0x18c2c6];return _0x497ad4;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require('../../mysqldb')['db'][_0x89f3('0x0')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x89f3('0x1')](0x0);var events={'afterCreate':_0x89f3('0x2'),'afterUpdate':'update','afterDestroy':_0x89f3('0x3')};function emitEvent(_0x5c662d){return function(_0x54098c,_0x42ecf8,_0x4b20ef){VoiceQueueReportEvents[_0x89f3('0x4')](_0x5c662d+':'+_0x54098c['id'],_0x54098c);VoiceQueueReportEvents[_0x89f3('0x4')](_0x5c662d,_0x54098c);_0x4b20ef(null);};}for(var e in events){if(events[_0x89f3('0x5')](e)){var event=events[e];VoiceQueueReport[_0x89f3('0x6')](e,emitEvent(event));}}module[_0x89f3('0x7')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x2441=['hasOwnProperty','hook','exports','events','VoiceQueueReport','save','update','remove','emit'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x2441,0xae));var _0x1244=function(_0x2d9349,_0x3f6837){_0x2d9349=_0x2d9349-0x0;var _0x5e149b=_0x2441[_0x2d9349];return _0x5e149b;};'use strict';var EventEmitter=require(_0x1244('0x0'));var VoiceQueueReport=require('../../mysqldb')['db'][_0x1244('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1244('0x2'),'afterUpdate':_0x1244('0x3'),'afterDestroy':_0x1244('0x4')};function emitEvent(_0x3fd6c8){return function(_0xf7712d,_0x9921e7,_0x514781){VoiceQueueReportEvents[_0x1244('0x5')](_0x3fd6c8+':'+_0xf7712d['id'],_0xf7712d);VoiceQueueReportEvents[_0x1244('0x5')](_0x3fd6c8,_0xf7712d);_0x514781(null);};}for(var e in events){if(events[_0x1244('0x6')](e)){var event=events[e];VoiceQueueReport[_0x1244('0x7')](e,emitEvent(event));}}module[_0x1244('0x8')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 9259de6..b03a05b 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 _0x06e4=['util','moment','request-promise','path','../../config/environment','./voiceQueueReport.attributes','exports','define','report_queue','uniqueid','calleridnum'];(function(_0x41412f,_0x225259){var _0x4a553a=function(_0x17fee2){while(--_0x17fee2){_0x41412f['push'](_0x41412f['shift']());}};_0x4a553a(++_0x225259);}(_0x06e4,0x1ef));var _0x406e=function(_0x45fe9c,_0x55e0d7){_0x45fe9c=_0x45fe9c-0x0;var _0x233d48=_0x06e4[_0x45fe9c];return _0x233d48;};'use strict';var _=require('lodash');var util=require(_0x406e('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x406e('0x1'));var BPromise=require('bluebird');var rp=require(_0x406e('0x2'));var fs=require('fs');var path=require(_0x406e('0x3'));var rimraf=require('rimraf');var config=require(_0x406e('0x4'));var attributes=require(_0x406e('0x5'));module[_0x406e('0x6')]=function(_0x3b4197,_0x53fc17){return _0x3b4197[_0x406e('0x7')]('VoiceQueueReport',attributes,{'tableName':_0x406e('0x8'),'paranoid':![],'indexes':[{'fields':[_0x406e('0x9')]},{'fields':[_0x406e('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x823d=['moment','bluebird','request-promise','path','rimraf','./voiceQueueReport.attributes','VoiceQueueReport','report_queue','uniqueid','calleridnum','util','../../config/logger'];(function(_0x36f4be,_0x5c4784){var _0x102cb4=function(_0x24f51f){while(--_0x24f51f){_0x36f4be['push'](_0x36f4be['shift']());}};_0x102cb4(++_0x5c4784);}(_0x823d,0x166));var _0xd823=function(_0x55c1f0,_0x4f574f){_0x55c1f0=_0x55c1f0-0x0;var _0x1530fa=_0x823d[_0x55c1f0];return _0x1530fa;};'use strict';var _=require('lodash');var util=require(_0xd823('0x0'));var logger=require(_0xd823('0x1'))('api');var moment=require(_0xd823('0x2'));var BPromise=require(_0xd823('0x3'));var rp=require(_0xd823('0x4'));var fs=require('fs');var path=require(_0xd823('0x5'));var rimraf=require(_0xd823('0x6'));var config=require('../../config/environment');var attributes=require(_0xd823('0x7'));module['exports']=function(_0x5f2875,_0x5d5ad0){return _0x5f2875['define'](_0xd823('0x8'),attributes,{'tableName':_0xd823('0x9'),'paranoid':![],'indexes':[{'fields':[_0xd823('0xa')]},{'fields':[_0xd823('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 913659a..0f51730 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 _0x0c09=['include','model','map','GetVoiceQueueReport','CreateVoiceQueueReport','create','body','stringify','UpdateVoiceQueueReport','update','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','defaults','localhost','socket.io-emitter','redis','./voiceQueueReport.socket','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','catch','VoiceQueueReport','findAll','options','raw','where','attributes','limit'];(function(_0x5e3593,_0x4888a7){var _0x513e9d=function(_0x3e44a2){while(--_0x3e44a2){_0x5e3593['push'](_0x5e3593['shift']());}};_0x513e9d(++_0x4888a7);}(_0x0c09,0x10c));var _0x90c0=function(_0x10edba,_0x478726){_0x10edba=_0x10edba-0x0;var _0xd9c093=_0x0c09[_0x10edba];return _0xd9c093;};'use strict';var _=require('lodash');var util=require(_0x90c0('0x0'));var moment=require('moment');var BPromise=require(_0x90c0('0x1'));var rs=require(_0x90c0('0x2'));var fs=require('fs');var Redis=require(_0x90c0('0x3'));var db=require(_0x90c0('0x4'))['db'];var utils=require(_0x90c0('0x5'));var logger=require('../../config/logger')(_0x90c0('0x6'));var config=require(_0x90c0('0x7'));var jayson=require(_0x90c0('0x8'));var client=jayson['client'][_0x90c0('0x9')]({'port':0x232a});config['redis']=_[_0x90c0('0xa')](config['redis'],{'host':_0x90c0('0xb'),'port':0x18eb});var socket=require(_0x90c0('0xc'))(new Redis(config[_0x90c0('0xd')]));require(_0x90c0('0xe'))[_0x90c0('0xf')](socket);function respondWithRpcPromise(_0x1fa993,_0x25721b,_0x47353e){return new BPromise(function(_0xd842ac,_0x1d66b7){return client[_0x90c0('0x10')](_0x1fa993,_0x47353e)[_0x90c0('0x11')](function(_0x4ae6b7){logger[_0x90c0('0x12')](_0x90c0('0x13'),_0x25721b,'request\x20sent');logger[_0x90c0('0x14')](_0x90c0('0x15'),_0x25721b,_0x90c0('0x16'),JSON['stringify'](_0x4ae6b7));if(_0x4ae6b7[_0x90c0('0x17')]){if(_0x4ae6b7[_0x90c0('0x17')]['code']===0x1f4){logger[_0x90c0('0x17')](_0x90c0('0x13'),_0x25721b,_0x4ae6b7['error']['message']);return _0x1d66b7(_0x4ae6b7[_0x90c0('0x17')][_0x90c0('0x18')]);}logger[_0x90c0('0x17')]('VoiceQueueReport,\x20%s,\x20%s',_0x25721b,_0x4ae6b7[_0x90c0('0x17')][_0x90c0('0x18')]);return _0xd842ac(_0x4ae6b7[_0x90c0('0x17')][_0x90c0('0x18')]);}else{logger[_0x90c0('0x12')]('VoiceQueueReport,\x20%s,\x20%s',_0x25721b,'request\x20sent');_0xd842ac(_0x4ae6b7['result'][_0x90c0('0x18')]);}})[_0x90c0('0x19')](function(_0x1c39a9){logger[_0x90c0('0x17')](_0x90c0('0x13'),_0x25721b,_0x1c39a9);_0x1d66b7(_0x1c39a9);});});}exports['GetVoiceQueueReport']=function(_0x4654d5){var _0x5bb2b4=this;return new Promise(function(_0x1e6130,_0x11a3a0){return db[_0x90c0('0x1a')][_0x90c0('0x1b')]({'raw':_0x4654d5[_0x90c0('0x1c')]?_0x4654d5[_0x90c0('0x1c')][_0x90c0('0x1d')]===undefined?!![]:![]:!![],'where':_0x4654d5['options']?_0x4654d5[_0x90c0('0x1c')][_0x90c0('0x1e')]||null:null,'attributes':_0x4654d5['options']?_0x4654d5[_0x90c0('0x1c')][_0x90c0('0x1f')]||null:null,'limit':_0x4654d5[_0x90c0('0x1c')]?_0x4654d5[_0x90c0('0x1c')][_0x90c0('0x20')]||null:null,'include':_0x4654d5[_0x90c0('0x1c')]?_0x4654d5[_0x90c0('0x1c')][_0x90c0('0x21')]?_['map'](_0x4654d5[_0x90c0('0x1c')]['include'],function(_0x39ee24){return{'model':db[_0x39ee24[_0x90c0('0x22')]],'as':_0x39ee24['as'],'attributes':_0x39ee24[_0x90c0('0x1f')],'include':_0x39ee24[_0x90c0('0x21')]?_['map'](_0x39ee24[_0x90c0('0x21')],function(_0x9e8060){return{'model':db[_0x9e8060[_0x90c0('0x22')]],'as':_0x9e8060['as'],'attributes':_0x9e8060[_0x90c0('0x1f')],'include':_0x9e8060['include']?_[_0x90c0('0x23')](_0x9e8060[_0x90c0('0x21')],function(_0x32939b){return{'model':db[_0x32939b[_0x90c0('0x22')]],'as':_0x32939b['as'],'attributes':_0x32939b[_0x90c0('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x58ff0f){logger[_0x90c0('0x12')]('GetVoiceQueueReport',_0x4654d5);logger['debug'](_0x90c0('0x24'),_0x4654d5,JSON['stringify'](_0x58ff0f));_0x1e6130(_0x58ff0f);})[_0x90c0('0x19')](function(_0x2d543b){logger[_0x90c0('0x17')](_0x90c0('0x24'),_0x2d543b[_0x90c0('0x18')],_0x4654d5);_0x11a3a0(_0x5bb2b4['error'](0x1f4,_0x2d543b[_0x90c0('0x18')]));});});};exports[_0x90c0('0x25')]=function(_0x55cfd6){var _0xf371b8=this;return new Promise(function(_0x3979a9,_0x53502e){return db[_0x90c0('0x1a')][_0x90c0('0x26')](_0x55cfd6[_0x90c0('0x27')],{'raw':_0x55cfd6['options']?_0x55cfd6[_0x90c0('0x1c')][_0x90c0('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x3e97a3){logger['info'](_0x90c0('0x25'),_0x55cfd6);logger[_0x90c0('0x14')](_0x90c0('0x25'),_0x55cfd6,JSON[_0x90c0('0x28')](_0x3e97a3));_0x3979a9(_0x3e97a3);})[_0x90c0('0x19')](function(_0x38e0fa){logger[_0x90c0('0x17')](_0x90c0('0x25'),_0x38e0fa['message'],_0x55cfd6);_0x53502e(_0xf371b8[_0x90c0('0x17')](0x1f4,_0x38e0fa[_0x90c0('0x18')]));});});};exports[_0x90c0('0x29')]=function(_0x3b819b){var _0x29c3d9=this;return new Promise(function(_0x4c0fae,_0x3922e0){return db[_0x90c0('0x1a')][_0x90c0('0x2a')](_0x3b819b[_0x90c0('0x27')],{'raw':_0x3b819b[_0x90c0('0x1c')]?_0x3b819b[_0x90c0('0x1c')][_0x90c0('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b819b[_0x90c0('0x1c')]?_0x3b819b[_0x90c0('0x1c')][_0x90c0('0x1e')]||null:null,'attributes':_0x3b819b[_0x90c0('0x1c')]?_0x3b819b[_0x90c0('0x1c')][_0x90c0('0x1f')]||null:null,'limit':_0x3b819b[_0x90c0('0x1c')]?_0x3b819b[_0x90c0('0x1c')][_0x90c0('0x20')]||null:null})[_0x90c0('0x11')](function(_0x10a0da){logger[_0x90c0('0x12')](_0x90c0('0x29'),_0x3b819b);logger[_0x90c0('0x14')]('UpdateVoiceQueueReport',_0x3b819b,JSON[_0x90c0('0x28')](_0x10a0da));_0x4c0fae(_0x10a0da);})['catch'](function(_0x17fe11){logger[_0x90c0('0x17')](_0x90c0('0x29'),_0x17fe11[_0x90c0('0x18')],_0x3b819b);_0x3922e0(_0x29c3d9[_0x90c0('0x17')](0x1f4,_0x17fe11['message']));});});}; \ No newline at end of file +var _0x5952=['CreateVoiceQueueReport','VoiceQueueReport','create','body','UpdateVoiceQueueReport','update','catch','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','info','VoiceQueueReport,\x20%s,\x20%s','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','findAll','options','raw','where','limit','include','attributes','map','model','then','GetVoiceQueueReport'];(function(_0x25060e,_0x4bfedd){var _0x318f58=function(_0x5ebb3d){while(--_0x5ebb3d){_0x25060e['push'](_0x25060e['shift']());}};_0x318f58(++_0x4bfedd);}(_0x5952,0x8b));var _0x2595=function(_0x34f6b3,_0x253355){_0x34f6b3=_0x34f6b3-0x0;var _0x4f0e52=_0x5952[_0x34f6b3];return _0x4f0e52;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2595('0x0'));var BPromise=require(_0x2595('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2595('0x2'));var db=require(_0x2595('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x2595('0x4'))(_0x2595('0x5'));var config=require('../../config/environment');var jayson=require(_0x2595('0x6'));var client=jayson[_0x2595('0x7')][_0x2595('0x8')]({'port':0x232a});config[_0x2595('0x9')]=_[_0x2595('0xa')](config[_0x2595('0x9')],{'host':_0x2595('0xb'),'port':0x18eb});var socket=require(_0x2595('0xc'))(new Redis(config['redis']));require(_0x2595('0xd'))[_0x2595('0xe')](socket);function respondWithRpcPromise(_0x1dcb1c,_0x743785,_0x424ea9){return new BPromise(function(_0x113759,_0x309e95){return client[_0x2595('0xf')](_0x1dcb1c,_0x424ea9)['then'](function(_0x201a79){logger[_0x2595('0x10')](_0x2595('0x11'),_0x743785,'request\x20sent');logger[_0x2595('0x12')](_0x2595('0x13'),_0x743785,'request\x20sent',JSON[_0x2595('0x14')](_0x201a79));if(_0x201a79[_0x2595('0x15')]){if(_0x201a79[_0x2595('0x15')][_0x2595('0x16')]===0x1f4){logger[_0x2595('0x15')](_0x2595('0x11'),_0x743785,_0x201a79[_0x2595('0x15')][_0x2595('0x17')]);return _0x309e95(_0x201a79[_0x2595('0x15')][_0x2595('0x17')]);}logger[_0x2595('0x15')](_0x2595('0x11'),_0x743785,_0x201a79['error'][_0x2595('0x17')]);return _0x113759(_0x201a79[_0x2595('0x15')][_0x2595('0x17')]);}else{logger[_0x2595('0x10')](_0x2595('0x11'),_0x743785,_0x2595('0x18'));_0x113759(_0x201a79[_0x2595('0x19')][_0x2595('0x17')]);}})['catch'](function(_0x33146c){logger[_0x2595('0x15')](_0x2595('0x11'),_0x743785,_0x33146c);_0x309e95(_0x33146c);});});}exports['GetVoiceQueueReport']=function(_0x16f458){var _0x30aa01=this;return new Promise(function(_0x21d362,_0x324b21){return db['VoiceQueueReport'][_0x2595('0x1a')]({'raw':_0x16f458[_0x2595('0x1b')]?_0x16f458[_0x2595('0x1b')][_0x2595('0x1c')]===undefined?!![]:![]:!![],'where':_0x16f458['options']?_0x16f458[_0x2595('0x1b')][_0x2595('0x1d')]||null:null,'attributes':_0x16f458[_0x2595('0x1b')]?_0x16f458[_0x2595('0x1b')]['attributes']||null:null,'limit':_0x16f458[_0x2595('0x1b')]?_0x16f458[_0x2595('0x1b')][_0x2595('0x1e')]||null:null,'include':_0x16f458[_0x2595('0x1b')]?_0x16f458[_0x2595('0x1b')][_0x2595('0x1f')]?_['map'](_0x16f458[_0x2595('0x1b')][_0x2595('0x1f')],function(_0x2dad27){return{'model':db[_0x2dad27['model']],'as':_0x2dad27['as'],'attributes':_0x2dad27[_0x2595('0x20')],'include':_0x2dad27['include']?_[_0x2595('0x21')](_0x2dad27[_0x2595('0x1f')],function(_0x24b585){return{'model':db[_0x24b585[_0x2595('0x22')]],'as':_0x24b585['as'],'attributes':_0x24b585[_0x2595('0x20')],'include':_0x24b585[_0x2595('0x1f')]?_[_0x2595('0x21')](_0x24b585['include'],function(_0x141f14){return{'model':db[_0x141f14[_0x2595('0x22')]],'as':_0x141f14['as'],'attributes':_0x141f14[_0x2595('0x20')]};}):[]};}):[]};}):[]:[]})[_0x2595('0x23')](function(_0x22869e){logger[_0x2595('0x10')](_0x2595('0x24'),_0x16f458);logger[_0x2595('0x12')](_0x2595('0x24'),_0x16f458,JSON[_0x2595('0x14')](_0x22869e));_0x21d362(_0x22869e);})['catch'](function(_0x106b38){logger[_0x2595('0x15')](_0x2595('0x24'),_0x106b38[_0x2595('0x17')],_0x16f458);_0x324b21(_0x30aa01[_0x2595('0x15')](0x1f4,_0x106b38[_0x2595('0x17')]));});});};exports[_0x2595('0x25')]=function(_0x4be8e8){var _0x1adec1=this;return new Promise(function(_0x2db77e,_0x30b75a){return db[_0x2595('0x26')][_0x2595('0x27')](_0x4be8e8[_0x2595('0x28')],{'raw':_0x4be8e8[_0x2595('0x1b')]?_0x4be8e8[_0x2595('0x1b')][_0x2595('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x26cad3){logger[_0x2595('0x10')](_0x2595('0x25'),_0x4be8e8);logger[_0x2595('0x12')](_0x2595('0x25'),_0x4be8e8,JSON['stringify'](_0x26cad3));_0x2db77e(_0x26cad3);})['catch'](function(_0x2120c8){logger[_0x2595('0x15')](_0x2595('0x25'),_0x2120c8[_0x2595('0x17')],_0x4be8e8);_0x30b75a(_0x1adec1['error'](0x1f4,_0x2120c8['message']));});});};exports[_0x2595('0x29')]=function(_0x5be546){var _0x5a88e2=this;return new Promise(function(_0x5ade42,_0x11c7ed){return db[_0x2595('0x26')][_0x2595('0x2a')](_0x5be546[_0x2595('0x28')],{'raw':_0x5be546[_0x2595('0x1b')]?_0x5be546[_0x2595('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5be546[_0x2595('0x1b')]?_0x5be546[_0x2595('0x1b')]['where']||null:null,'attributes':_0x5be546['options']?_0x5be546['options']['attributes']||null:null,'limit':_0x5be546[_0x2595('0x1b')]?_0x5be546[_0x2595('0x1b')][_0x2595('0x1e')]||null:null})[_0x2595('0x23')](function(_0x1ddd70){logger['info']('UpdateVoiceQueueReport',_0x5be546);logger[_0x2595('0x12')](_0x2595('0x29'),_0x5be546,JSON['stringify'](_0x1ddd70));_0x5ade42(_0x1ddd70);})[_0x2595('0x2b')](function(_0x56a4f0){logger[_0x2595('0x15')](_0x2595('0x29'),_0x56a4f0[_0x2595('0x17')],_0x5be546);_0x11c7ed(_0x5a88e2[_0x2595('0x15')](0x1f4,_0x56a4f0[_0x2595('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 7bd772d..a7a4ac9 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 _0x8bda=['emit','removeListener','length','voiceQueueReport:','./voiceQueueReport.events','save','remove','update'];(function(_0x4c4abb,_0x39bae7){var _0x29ce07=function(_0x215186){while(--_0x215186){_0x4c4abb['push'](_0x4c4abb['shift']());}};_0x29ce07(++_0x39bae7);}(_0x8bda,0x104));var _0xa8bd=function(_0x53abe5,_0x33a9e5){_0x53abe5=_0x53abe5-0x0;var _0xc1c37e=_0x8bda[_0x53abe5];return _0xc1c37e;};'use strict';var VoiceQueueReportEvents=require(_0xa8bd('0x0'));var events=[_0xa8bd('0x1'),_0xa8bd('0x2'),_0xa8bd('0x3')];function createListener(_0x15602b,_0x476e72){return function(_0x4936a2){_0x476e72[_0xa8bd('0x4')](_0x15602b,_0x4936a2);};}function removeListener(_0x825d86,_0x51db69){return function(){VoiceQueueReportEvents[_0xa8bd('0x5')](_0x825d86,_0x51db69);};}exports['register']=function(_0x36bc1b){for(var _0x2e1aba=0x0,_0x554897=events[_0xa8bd('0x6')];_0x2e1aba<_0x554897;_0x2e1aba++){var _0x2613be=events[_0x2e1aba];var _0x1c4540=createListener(_0xa8bd('0x7')+_0x2613be,_0x36bc1b);VoiceQueueReportEvents['on'](_0x2613be,_0x1c4540);}}; \ No newline at end of file +var _0x87cb=['register','voiceQueueReport:','./voiceQueueReport.events','save','remove','update','removeListener'];(function(_0x2db520,_0x5adb82){var _0x45fd3a=function(_0x3317f2){while(--_0x3317f2){_0x2db520['push'](_0x2db520['shift']());}};_0x45fd3a(++_0x5adb82);}(_0x87cb,0xaa));var _0xb87c=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x87cb[_0x2c7618];return _0x5ce3f0;};'use strict';var VoiceQueueReportEvents=require(_0xb87c('0x0'));var events=[_0xb87c('0x1'),_0xb87c('0x2'),_0xb87c('0x3')];function createListener(_0x8a4460,_0x146528){return function(_0x491ca6){_0x146528['emit'](_0x8a4460,_0x491ca6);};}function removeListener(_0x430a68,_0x33bfc1){return function(){VoiceQueueReportEvents[_0xb87c('0x4')](_0x430a68,_0x33bfc1);};}exports[_0xb87c('0x5')]=function(_0x46377b){for(var _0x211d93=0x0,_0x49db0f=events['length'];_0x211d93<_0x49db0f;_0x211d93++){var _0xe3d2f4=events[_0x211d93];var _0x465e3d=createListener(_0xb87c('0x6')+_0xe3d2f4,_0x46377b);VoiceQueueReportEvents['on'](_0xe3d2f4,_0x465e3d);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 82bd14c..d1392b3 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 _0x1cd5=['isAuthenticated','index','/:id','create','update','delete','destroy','exports','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get'];(function(_0x28cca1,_0x3a14c3){var _0x46a835=function(_0xefdb72){while(--_0xefdb72){_0x28cca1['push'](_0x28cca1['shift']());}};_0x46a835(++_0x3a14c3);}(_0x1cd5,0x107));var _0x51cd=function(_0x405f4f,_0x5cee39){_0x405f4f=_0x405f4f-0x0;var _0x531fee=_0x1cd5[_0x405f4f];return _0x531fee;};'use strict';var multer=require('multer');var util=require(_0x51cd('0x0'));var path=require('path');var timeout=require(_0x51cd('0x1'));var express=require(_0x51cd('0x2'));var router=express['Router']();var fs_extra=require(_0x51cd('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x51cd('0x4'));var config=require(_0x51cd('0x5'));var controller=require('./voiceQueuesLog.controller');router[_0x51cd('0x6')]('/',auth[_0x51cd('0x7')](),controller[_0x51cd('0x8')]);router[_0x51cd('0x6')](_0x51cd('0x9'),auth[_0x51cd('0x7')](),controller['show']);router['post']('/',auth[_0x51cd('0x7')](),controller[_0x51cd('0xa')]);router['put'](_0x51cd('0x9'),auth[_0x51cd('0x7')](),controller[_0x51cd('0xb')]);router[_0x51cd('0xc')](_0x51cd('0x9'),auth[_0x51cd('0x7')](),controller[_0x51cd('0xd')]);module[_0x51cd('0xe')]=router; \ No newline at end of file +var _0xa4f2=['delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','create','put'];(function(_0x54927d,_0x24b59f){var _0x1afb67=function(_0x1e3665){while(--_0x1e3665){_0x54927d['push'](_0x54927d['shift']());}};_0x1afb67(++_0x24b59f);}(_0xa4f2,0x1d3));var _0x2a4f=function(_0x511a19,_0x417e36){_0x511a19=_0x511a19-0x0;var _0x499aa6=_0xa4f2[_0x511a19];return _0x499aa6;};'use strict';var multer=require(_0x2a4f('0x0'));var util=require(_0x2a4f('0x1'));var path=require(_0x2a4f('0x2'));var timeout=require('connect-timeout');var express=require(_0x2a4f('0x3'));var router=express[_0x2a4f('0x4')]();var fs_extra=require(_0x2a4f('0x5'));var auth=require(_0x2a4f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2a4f('0x7'));var controller=require(_0x2a4f('0x8'));router[_0x2a4f('0x9')]('/',auth[_0x2a4f('0xa')](),controller['index']);router['get']('/:id',auth[_0x2a4f('0xa')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x2a4f('0xb')]);router[_0x2a4f('0xc')]('/:id',auth[_0x2a4f('0xa')](),controller['update']);router[_0x2a4f('0xd')]('/:id',auth[_0x2a4f('0xa')](),controller[_0x2a4f('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 84053b0..833b9ab 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 _0x6473=['CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','STRING','DATE','literal'];(function(_0x5ec6a5,_0x51d22b){var _0x2ffceb=function(_0x80ec06){while(--_0x80ec06){_0x5ec6a5['push'](_0x5ec6a5['shift']());}};_0x2ffceb(++_0x51d22b);}(_0x6473,0x1ab));var _0x3647=function(_0x1ebfba,_0x5c7da1){_0x1ebfba=_0x1ebfba-0x0;var _0xac7f9c=_0x6473[_0x1ebfba];return _0xac7f9c;};'use strict';var Sequelize=require(_0x3647('0x0'));var moment=require('moment');module[_0x3647('0x1')]={'time':{'type':Sequelize[_0x3647('0x2')]},'callid':{'type':Sequelize[_0x3647('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x3647('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x3647('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x3647('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x3647('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x3647('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x3647('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x3647('0x3')],'allowNull':![],'defaultValue':Sequelize[_0x3647('0x4')](_0x3647('0x5'))}}; \ No newline at end of file +var _0x44b6=['CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','moment','STRING','DATE','literal'];(function(_0x3077e2,_0x2fed5f){var _0x5d597e=function(_0x3530a){while(--_0x3530a){_0x3077e2['push'](_0x3077e2['shift']());}};_0x5d597e(++_0x2fed5f);}(_0x44b6,0xdf));var _0x644b=function(_0x59bcb1,_0x5a4b6c){_0x59bcb1=_0x59bcb1-0x0;var _0x4a737f=_0x44b6[_0x59bcb1];return _0x4a737f;};'use strict';var Sequelize=require(_0x644b('0x0'));var moment=require(_0x644b('0x1'));module['exports']={'time':{'type':Sequelize[_0x644b('0x2')]},'callid':{'type':Sequelize[_0x644b('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x644b('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x644b('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x644b('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x644b('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x644b('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x644b('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x644b('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x644b('0x3')],'allowNull':![],'defaultValue':Sequelize[_0x644b('0x4')](_0x644b('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index b510932..bfb4654 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 _0xc91c=['model','keys','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','VoiceQueuesLog','includeAll','include','catch','show','find','create','body','params','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','crypto','jsforce','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','map','rawAttributes','key'];(function(_0x37b546,_0x8c85de){var _0x24a3b5=function(_0x337bc5){while(--_0x337bc5){_0x37b546['push'](_0x37b546['shift']());}};_0x24a3b5(++_0x8c85de);}(_0xc91c,0xe5));var _0xcc91=function(_0x460fd7,_0x2012db){_0x460fd7=_0x460fd7-0x0;var _0x44d1c2=_0xc91c[_0x460fd7];return _0x44d1c2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcc91('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcc91('0x1'));var rp=require(_0xcc91('0x2'));var moment=require(_0xcc91('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xcc91('0x4'));var util=require(_0xcc91('0x5'));var path=require('path');var sox=require(_0xcc91('0x6'));var csv=require(_0xcc91('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcc91('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xcc91('0x9'));var jsforce=require(_0xcc91('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xcc91('0x7'));var querystring=require('querystring');var Papa=require(_0xcc91('0xb'));var Redis=require('ioredis');var authService=require(_0xcc91('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcc91('0xd'));var logger=require(_0xcc91('0xe'))(_0xcc91('0xf'));var utils=require('../../config/utils');var config=require(_0xcc91('0x10'));var licenseUtil=require(_0xcc91('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x53632b,_0x27406b){_0x27406b=_0x27406b||0xcc;return function(_0x45bd5e){if(_0x45bd5e){return _0x53632b[_0xcc91('0x12')](_0x27406b);}return _0x53632b['status'](_0x27406b)['end']();};}function respondWithResult(_0x6aeb78,_0x50694e){_0x50694e=_0x50694e||0xc8;return function(_0x4305b5){if(_0x4305b5){return _0x6aeb78[_0xcc91('0x13')](_0x50694e)[_0xcc91('0x14')](_0x4305b5);}};}function respondWithFilteredResult(_0x3ad458,_0x19fdd8){return function(_0x506275){if(_0x506275){var _0x2a4d9e=typeof _0x19fdd8[_0xcc91('0x15')]==='undefined'&&typeof _0x19fdd8['limit']===_0xcc91('0x16');var _0x30b824=_0x506275['count'];var _0x54152c=_0x2a4d9e?0x0:_0x19fdd8[_0xcc91('0x15')];var _0x5b9ba7=_0x2a4d9e?_0x506275[_0xcc91('0x17')]:_0x19fdd8[_0xcc91('0x15')]+_0x19fdd8['limit'];var _0x337b31;if(_0x5b9ba7>=_0x30b824){_0x5b9ba7=_0x30b824;_0x337b31=0xc8;}else{_0x337b31=0xce;}_0x3ad458[_0xcc91('0x13')](_0x337b31);return _0x3ad458[_0xcc91('0x18')](_0xcc91('0x19'),_0x54152c+'-'+_0x5b9ba7+'/'+_0x30b824)['json'](_0x506275);}return null;};}function patchUpdates(_0xbb208){return function(_0x16f65b){try{jsonpatch[_0xcc91('0x1a')](_0x16f65b,_0xbb208,!![]);}catch(_0x2e9fea){return BPromise[_0xcc91('0x1b')](_0x2e9fea);}return _0x16f65b[_0xcc91('0x1c')]();};}function saveUpdates(_0x1ead83,_0x29bd49){return function(_0x2d8b5d){if(_0x2d8b5d){return _0x2d8b5d[_0xcc91('0x1d')](_0x1ead83)[_0xcc91('0x1e')](function(_0x4ce6ea){return _0x4ce6ea;});}return null;};}function removeEntity(_0x1fb79a,_0x119012){return function(_0xa5ae14){if(_0xa5ae14){return _0xa5ae14[_0xcc91('0x1f')]()[_0xcc91('0x1e')](function(){_0x1fb79a[_0xcc91('0x13')](0xcc)[_0xcc91('0x20')]();});}};}function handleEntityNotFound(_0xa43f8a,_0x4903f9){return function(_0xc33eba){if(!_0xc33eba){_0xa43f8a['sendStatus'](0x194);}return _0xc33eba;};}function handleError(_0x108d55,_0x5d4ded){_0x5d4ded=_0x5d4ded||0x1f4;return function(_0x144b58){logger[_0xcc91('0x21')](_0x144b58['stack']);if(_0x144b58[_0xcc91('0x22')]){delete _0x144b58['name'];}_0x108d55['status'](_0x5d4ded)[_0xcc91('0x23')](_0x144b58);};}exports['index']=function(_0x2d3276,_0x1c2cfb){var _0x4a58ee={},_0x2e66b7={},_0x1faf78={'count':0x0,'rows':[]};var _0x27a976=_[_0xcc91('0x24')](db['VoiceQueuesLog'][_0xcc91('0x25')],function(_0x3141b1){return{'name':_0x3141b1['fieldName'],'type':_0x3141b1['type'][_0xcc91('0x26')]};});_0x2e66b7[_0xcc91('0x27')]=_[_0xcc91('0x24')](_0x27a976,_0xcc91('0x22'));_0x2e66b7['query']=_[_0xcc91('0x28')](_0x2d3276[_0xcc91('0x29')]);_0x2e66b7[_0xcc91('0x2a')]=_[_0xcc91('0x2b')](_0x2e66b7[_0xcc91('0x27')],_0x2e66b7[_0xcc91('0x29')]);_0x4a58ee[_0xcc91('0x2c')]=_[_0xcc91('0x2b')](_0x2e66b7[_0xcc91('0x27')],qs['fields'](_0x2d3276[_0xcc91('0x29')][_0xcc91('0x2d')]));_0x4a58ee[_0xcc91('0x2c')]=_0x4a58ee[_0xcc91('0x2c')][_0xcc91('0x2e')]?_0x4a58ee[_0xcc91('0x2c')]:_0x2e66b7[_0xcc91('0x27')];if(!_0x2d3276['query']['hasOwnProperty'](_0xcc91('0x2f'))){_0x4a58ee[_0xcc91('0x30')]=qs[_0xcc91('0x30')](_0x2d3276['query'][_0xcc91('0x30')]);_0x4a58ee[_0xcc91('0x15')]=qs['offset'](_0x2d3276['query'][_0xcc91('0x15')]);}_0x4a58ee[_0xcc91('0x31')]=qs[_0xcc91('0x32')](_0x2d3276[_0xcc91('0x29')][_0xcc91('0x32')]);_0x4a58ee[_0xcc91('0x33')]=qs[_0xcc91('0x2a')](_[_0xcc91('0x34')](_0x2d3276[_0xcc91('0x29')],_0x2e66b7['filters']),_0x27a976);if(_0x2d3276['query'][_0xcc91('0x35')]){_0x4a58ee['where']=_[_0xcc91('0x36')](_0x4a58ee['where'],{'$or':_[_0xcc91('0x24')](_0x27a976,function(_0x39a391){if(_0x39a391[_0xcc91('0x37')]!==_0xcc91('0x38')){var _0x367643={};_0x367643[_0x39a391[_0xcc91('0x22')]]={'$like':'%'+_0x2d3276[_0xcc91('0x29')]['filter']+'%'};return _0x367643;}})});}_0x4a58ee=_[_0xcc91('0x36')]({},_0x4a58ee,_0x2d3276[_0xcc91('0x39')]);var _0x5f12b9={'where':_0x4a58ee['where']};return db[_0xcc91('0x3a')][_0xcc91('0x17')](_0x5f12b9)[_0xcc91('0x1e')](function(_0xa0cae3){_0x1faf78[_0xcc91('0x17')]=_0xa0cae3;if(_0x2d3276[_0xcc91('0x29')][_0xcc91('0x3b')]){_0x4a58ee[_0xcc91('0x3c')]=[{'all':!![]}];}return db[_0xcc91('0x3a')]['findAll'](_0x4a58ee);})[_0xcc91('0x1e')](function(_0xdfdfae){_0x1faf78['rows']=_0xdfdfae;return _0x1faf78;})[_0xcc91('0x1e')](respondWithFilteredResult(_0x1c2cfb,_0x4a58ee))[_0xcc91('0x3d')](handleError(_0x1c2cfb,null));};exports[_0xcc91('0x3e')]=function(_0x5a8ffa,_0x41097b){var _0x1ac7a7={'raw':!![],'where':{'id':_0x5a8ffa['params']['id']}},_0xe8a7ce={};_0xe8a7ce[_0xcc91('0x27')]=_[_0xcc91('0x28')](db[_0xcc91('0x3a')][_0xcc91('0x25')]);_0xe8a7ce[_0xcc91('0x29')]=_['keys'](_0x5a8ffa[_0xcc91('0x29')]);_0xe8a7ce[_0xcc91('0x2a')]=_[_0xcc91('0x2b')](_0xe8a7ce[_0xcc91('0x27')],_0xe8a7ce[_0xcc91('0x29')]);_0x1ac7a7[_0xcc91('0x2c')]=_['intersection'](_0xe8a7ce[_0xcc91('0x27')],qs[_0xcc91('0x2d')](_0x5a8ffa[_0xcc91('0x29')][_0xcc91('0x2d')]));_0x1ac7a7[_0xcc91('0x2c')]=_0x1ac7a7[_0xcc91('0x2c')]['length']?_0x1ac7a7['attributes']:_0xe8a7ce['model'];if(_0x5a8ffa[_0xcc91('0x29')][_0xcc91('0x3b')]){_0x1ac7a7[_0xcc91('0x3c')]=[{'all':!![]}];}_0x1ac7a7=_[_0xcc91('0x36')]({},_0x1ac7a7,_0x5a8ffa[_0xcc91('0x39')]);return db[_0xcc91('0x3a')][_0xcc91('0x3f')](_0x1ac7a7)['then'](handleEntityNotFound(_0x41097b,null))[_0xcc91('0x1e')](respondWithResult(_0x41097b,null))['catch'](handleError(_0x41097b,null));};exports['create']=function(_0x5c4c61,_0x8b164c){return db[_0xcc91('0x3a')][_0xcc91('0x40')](_0x5c4c61['body'],{})[_0xcc91('0x1e')](respondWithResult(_0x8b164c,0xc9))[_0xcc91('0x3d')](handleError(_0x8b164c,null));};exports[_0xcc91('0x1d')]=function(_0x50d991,_0x4a08b4){if(_0x50d991['body']['id']){delete _0x50d991[_0xcc91('0x41')]['id'];}return db[_0xcc91('0x3a')]['find']({'where':{'id':_0x50d991[_0xcc91('0x42')]['id']}})[_0xcc91('0x1e')](handleEntityNotFound(_0x4a08b4,null))['then'](saveUpdates(_0x50d991['body'],null))[_0xcc91('0x1e')](respondWithResult(_0x4a08b4,null))[_0xcc91('0x3d')](handleError(_0x4a08b4,null));};exports[_0xcc91('0x1f')]=function(_0x4da4c7,_0xc70b3b){return db[_0xcc91('0x3a')][_0xcc91('0x3f')]({'where':{'id':_0x4da4c7[_0xcc91('0x42')]['id']}})[_0xcc91('0x1e')](handleEntityNotFound(_0xc70b3b,null))[_0xcc91('0x1e')](removeEntity(_0xc70b3b,null))[_0xcc91('0x3d')](handleError(_0xc70b3b,null));}; \ No newline at end of file +var _0x84b6=['fields','query','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','VoiceQueuesLog','includeAll','findAll','rows','show','params','include','find','catch','create','body','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','name','index','rawAttributes','type','key','map','keys','filters','intersection','attributes','model'];(function(_0x3b16c6,_0x34abf5){var _0x48dcb6=function(_0x47b565){while(--_0x47b565){_0x3b16c6['push'](_0x3b16c6['shift']());}};_0x48dcb6(++_0x34abf5);}(_0x84b6,0x12e));var _0x684b=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0x84b6[_0x9aada2];return _0x196dff;};'use strict';var emlformat=require(_0x684b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x684b('0x1'));var jsonpatch=require(_0x684b('0x2'));var rp=require('request-promise');var moment=require(_0x684b('0x3'));var BPromise=require(_0x684b('0x4'));var Mustache=require(_0x684b('0x5'));var util=require('util');var path=require(_0x684b('0x6'));var sox=require(_0x684b('0x7'));var csv=require('to-csv');var ejs=require(_0x684b('0x8'));var fs=require('fs');var fs_extra=require(_0x684b('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x684b('0xa'));var deskjs=require(_0x684b('0xb'));var toCsv=require('to-csv');var querystring=require(_0x684b('0xc'));var Papa=require('papaparse');var Redis=require(_0x684b('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x684b('0xe'));var as=require(_0x684b('0xf'));var hardwareService=require(_0x684b('0x10'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x684b('0x11'));var licenseUtil=require(_0x684b('0x12'));var db=require(_0x684b('0x13'))['db'];function respondWithStatusCode(_0x467ba7,_0x1a08d3){_0x1a08d3=_0x1a08d3||0xcc;return function(_0x34738a){if(_0x34738a){return _0x467ba7[_0x684b('0x14')](_0x1a08d3);}return _0x467ba7[_0x684b('0x15')](_0x1a08d3)[_0x684b('0x16')]();};}function respondWithResult(_0x11007d,_0x4d5a97){_0x4d5a97=_0x4d5a97||0xc8;return function(_0x26a3e9){if(_0x26a3e9){return _0x11007d[_0x684b('0x15')](_0x4d5a97)[_0x684b('0x17')](_0x26a3e9);}};}function respondWithFilteredResult(_0x1a32ce,_0x33edd9){return function(_0x227ee4){if(_0x227ee4){var _0x25549a=typeof _0x33edd9[_0x684b('0x18')]===_0x684b('0x19')&&typeof _0x33edd9[_0x684b('0x1a')]===_0x684b('0x19');var _0x2e0f8c=_0x227ee4[_0x684b('0x1b')];var _0x5f5731=_0x25549a?0x0:_0x33edd9[_0x684b('0x18')];var _0x55d7e3=_0x25549a?_0x227ee4[_0x684b('0x1b')]:_0x33edd9['offset']+_0x33edd9[_0x684b('0x1a')];var _0x34e2e9;if(_0x55d7e3>=_0x2e0f8c){_0x55d7e3=_0x2e0f8c;_0x34e2e9=0xc8;}else{_0x34e2e9=0xce;}_0x1a32ce['status'](_0x34e2e9);return _0x1a32ce[_0x684b('0x1c')](_0x684b('0x1d'),_0x5f5731+'-'+_0x55d7e3+'/'+_0x2e0f8c)[_0x684b('0x17')](_0x227ee4);}return null;};}function patchUpdates(_0x32d27e){return function(_0x20c851){try{jsonpatch[_0x684b('0x1e')](_0x20c851,_0x32d27e,!![]);}catch(_0x59fcb2){return BPromise[_0x684b('0x1f')](_0x59fcb2);}return _0x20c851[_0x684b('0x20')]();};}function saveUpdates(_0x3d9781,_0x36c90b){return function(_0x1de5c5){if(_0x1de5c5){return _0x1de5c5[_0x684b('0x21')](_0x3d9781)['then'](function(_0x57eafc){return _0x57eafc;});}return null;};}function removeEntity(_0x119917,_0x40bd4d){return function(_0x2d09e6){if(_0x2d09e6){return _0x2d09e6[_0x684b('0x22')]()[_0x684b('0x23')](function(){_0x119917[_0x684b('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1cb49c,_0xa23076){return function(_0x3aefcd){if(!_0x3aefcd){_0x1cb49c[_0x684b('0x14')](0x194);}return _0x3aefcd;};}function handleError(_0x41bb8f,_0x285cda){_0x285cda=_0x285cda||0x1f4;return function(_0x1000b3){logger[_0x684b('0x24')](_0x1000b3['stack']);if(_0x1000b3[_0x684b('0x25')]){delete _0x1000b3[_0x684b('0x25')];}_0x41bb8f[_0x684b('0x15')](_0x285cda)['send'](_0x1000b3);};}exports[_0x684b('0x26')]=function(_0x355210,_0x24eb16){var _0x26de49={},_0x132b35={},_0x3e8227={'count':0x0,'rows':[]};var _0x1d1e6a=_['map'](db['VoiceQueuesLog'][_0x684b('0x27')],function(_0x1fb29a){return{'name':_0x1fb29a['fieldName'],'type':_0x1fb29a[_0x684b('0x28')][_0x684b('0x29')]};});_0x132b35['model']=_[_0x684b('0x2a')](_0x1d1e6a,_0x684b('0x25'));_0x132b35['query']=_[_0x684b('0x2b')](_0x355210['query']);_0x132b35[_0x684b('0x2c')]=_[_0x684b('0x2d')](_0x132b35['model'],_0x132b35['query']);_0x26de49[_0x684b('0x2e')]=_[_0x684b('0x2d')](_0x132b35[_0x684b('0x2f')],qs[_0x684b('0x30')](_0x355210[_0x684b('0x31')][_0x684b('0x30')]));_0x26de49[_0x684b('0x2e')]=_0x26de49['attributes'][_0x684b('0x32')]?_0x26de49[_0x684b('0x2e')]:_0x132b35[_0x684b('0x2f')];if(!_0x355210[_0x684b('0x31')][_0x684b('0x33')](_0x684b('0x34'))){_0x26de49['limit']=qs['limit'](_0x355210['query']['limit']);_0x26de49[_0x684b('0x18')]=qs['offset'](_0x355210[_0x684b('0x31')]['offset']);}_0x26de49['order']=qs[_0x684b('0x35')](_0x355210['query'][_0x684b('0x35')]);_0x26de49[_0x684b('0x36')]=qs[_0x684b('0x2c')](_['pick'](_0x355210[_0x684b('0x31')],_0x132b35[_0x684b('0x2c')]),_0x1d1e6a);if(_0x355210['query'][_0x684b('0x37')]){_0x26de49[_0x684b('0x36')]=_[_0x684b('0x38')](_0x26de49[_0x684b('0x36')],{'$or':_['map'](_0x1d1e6a,function(_0x18a9e8){if(_0x18a9e8[_0x684b('0x28')]!==_0x684b('0x39')){var _0x59c844={};_0x59c844[_0x18a9e8['name']]={'$like':'%'+_0x355210[_0x684b('0x31')][_0x684b('0x37')]+'%'};return _0x59c844;}})});}_0x26de49=_['merge']({},_0x26de49,_0x355210[_0x684b('0x3a')]);var _0x163bd1={'where':_0x26de49[_0x684b('0x36')]};return db[_0x684b('0x3b')][_0x684b('0x1b')](_0x163bd1)[_0x684b('0x23')](function(_0x48741c){_0x3e8227[_0x684b('0x1b')]=_0x48741c;if(_0x355210[_0x684b('0x31')][_0x684b('0x3c')]){_0x26de49['include']=[{'all':!![]}];}return db['VoiceQueuesLog'][_0x684b('0x3d')](_0x26de49);})[_0x684b('0x23')](function(_0x315183){_0x3e8227[_0x684b('0x3e')]=_0x315183;return _0x3e8227;})[_0x684b('0x23')](respondWithFilteredResult(_0x24eb16,_0x26de49))['catch'](handleError(_0x24eb16,null));};exports[_0x684b('0x3f')]=function(_0x1ecb22,_0x3d7bc8){var _0x52fed5={'raw':!![],'where':{'id':_0x1ecb22[_0x684b('0x40')]['id']}},_0x22030b={};_0x22030b[_0x684b('0x2f')]=_[_0x684b('0x2b')](db['VoiceQueuesLog'][_0x684b('0x27')]);_0x22030b['query']=_[_0x684b('0x2b')](_0x1ecb22['query']);_0x22030b[_0x684b('0x2c')]=_[_0x684b('0x2d')](_0x22030b[_0x684b('0x2f')],_0x22030b[_0x684b('0x31')]);_0x52fed5['attributes']=_[_0x684b('0x2d')](_0x22030b['model'],qs[_0x684b('0x30')](_0x1ecb22[_0x684b('0x31')]['fields']));_0x52fed5[_0x684b('0x2e')]=_0x52fed5[_0x684b('0x2e')][_0x684b('0x32')]?_0x52fed5[_0x684b('0x2e')]:_0x22030b[_0x684b('0x2f')];if(_0x1ecb22[_0x684b('0x31')][_0x684b('0x3c')]){_0x52fed5[_0x684b('0x41')]=[{'all':!![]}];}_0x52fed5=_[_0x684b('0x38')]({},_0x52fed5,_0x1ecb22[_0x684b('0x3a')]);return db[_0x684b('0x3b')][_0x684b('0x42')](_0x52fed5)['then'](handleEntityNotFound(_0x3d7bc8,null))[_0x684b('0x23')](respondWithResult(_0x3d7bc8,null))[_0x684b('0x43')](handleError(_0x3d7bc8,null));};exports[_0x684b('0x44')]=function(_0x513b1a,_0x571269){return db['VoiceQueuesLog'][_0x684b('0x44')](_0x513b1a[_0x684b('0x45')],{})['then'](respondWithResult(_0x571269,0xc9))[_0x684b('0x43')](handleError(_0x571269,null));};exports[_0x684b('0x21')]=function(_0x16240a,_0x423f17){if(_0x16240a[_0x684b('0x45')]['id']){delete _0x16240a[_0x684b('0x45')]['id'];}return db[_0x684b('0x3b')]['find']({'where':{'id':_0x16240a[_0x684b('0x40')]['id']}})[_0x684b('0x23')](handleEntityNotFound(_0x423f17,null))[_0x684b('0x23')](saveUpdates(_0x16240a['body'],null))[_0x684b('0x23')](respondWithResult(_0x423f17,null))[_0x684b('0x43')](handleError(_0x423f17,null));};exports[_0x684b('0x22')]=function(_0x25b87d,_0x590487){return db[_0x684b('0x3b')][_0x684b('0x42')]({'where':{'id':_0x25b87d['params']['id']}})['then'](handleEntityNotFound(_0x590487,null))[_0x684b('0x23')](removeEntity(_0x590487,null))[_0x684b('0x43')](handleError(_0x590487,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 6cc659e..c944f4c 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 _0x97dd=['dtm','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','define','VoiceQueuesLog','voice_queues_log','event_dtm'];(function(_0xe940fb,_0x210c05){var _0x56b783=function(_0x172997){while(--_0x172997){_0xe940fb['push'](_0xe940fb['shift']());}};_0x56b783(++_0x210c05);}(_0x97dd,0x71));var _0xd97d=function(_0x56f617,_0x69b0cf){_0x56f617=_0x56f617-0x0;var _0x2d881a=_0x97dd[_0x56f617];return _0x2d881a;};'use strict';var _=require(_0xd97d('0x0'));var util=require(_0xd97d('0x1'));var logger=require(_0xd97d('0x2'))(_0xd97d('0x3'));var moment=require('moment');var BPromise=require(_0xd97d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd97d('0x5'));var rimraf=require(_0xd97d('0x6'));var config=require(_0xd97d('0x7'));var attributes=require(_0xd97d('0x8'));module['exports']=function(_0x2e2760,_0x5aaeb9){return _0x2e2760[_0xd97d('0x9')](_0xd97d('0xa'),attributes,{'tableName':_0xd97d('0xb'),'paranoid':![],'indexes':[{'name':_0xd97d('0xc'),'fields':['event',_0xd97d('0xd')]}],'timestamps':![]});}; \ No newline at end of file +var _0xa85d=['define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash','util','../../config/logger','moment','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports'];(function(_0x3afd82,_0x47a234){var _0x414ce0=function(_0x1ad2bf){while(--_0x1ad2bf){_0x3afd82['push'](_0x3afd82['shift']());}};_0x414ce0(++_0x47a234);}(_0xa85d,0x68));var _0xda85=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0xa85d[_0x4fde08];return _0x12e725;};'use strict';var _=require(_0xda85('0x0'));var util=require(_0xda85('0x1'));var logger=require(_0xda85('0x2'))('api');var moment=require(_0xda85('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xda85('0x4'));var config=require(_0xda85('0x5'));var attributes=require(_0xda85('0x6'));module[_0xda85('0x7')]=function(_0x1149d3,_0x26dac6){return _0x1149d3[_0xda85('0x8')](_0xda85('0x9'),attributes,{'tableName':_0xda85('0xa'),'paranoid':![],'indexes':[{'name':_0xda85('0xb'),'fields':[_0xda85('0xc'),_0xda85('0xd')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 0544b9e..8713398 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 _0x8150=['error','code','message','result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1956c9,_0x2ad6b4){var _0x499d4=function(_0x2fa03f){while(--_0x2fa03f){_0x1956c9['push'](_0x1956c9['shift']());}};_0x499d4(++_0x2ad6b4);}(_0x8150,0x1a7));var _0x0815=function(_0x422a09,_0x318d15){_0x422a09=_0x422a09-0x0;var _0x515375=_0x8150[_0x422a09];return _0x515375;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x0815('0x0'));var rs=require(_0x0815('0x1'));var fs=require('fs');var Redis=require(_0x0815('0x2'));var db=require(_0x0815('0x3'))['db'];var utils=require(_0x0815('0x4'));var logger=require('../../config/logger')(_0x0815('0x5'));var config=require('../../config/environment');var jayson=require(_0x0815('0x6'));var client=jayson[_0x0815('0x7')][_0x0815('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x47cf9c,_0x3c2014,_0x37c337){return new BPromise(function(_0xa3e790,_0x2fe044){return client[_0x0815('0x9')](_0x47cf9c,_0x37c337)[_0x0815('0xa')](function(_0x2b53a3){logger[_0x0815('0xb')](_0x0815('0xc'),_0x3c2014,_0x0815('0xd'));logger[_0x0815('0xe')](_0x0815('0xf'),_0x3c2014,'request\x20sent',JSON[_0x0815('0x10')](_0x2b53a3));if(_0x2b53a3[_0x0815('0x11')]){if(_0x2b53a3['error'][_0x0815('0x12')]===0x1f4){logger[_0x0815('0x11')](_0x0815('0xc'),_0x3c2014,_0x2b53a3['error'][_0x0815('0x13')]);return _0x2fe044(_0x2b53a3[_0x0815('0x11')][_0x0815('0x13')]);}logger[_0x0815('0x11')](_0x0815('0xc'),_0x3c2014,_0x2b53a3['error'][_0x0815('0x13')]);return _0xa3e790(_0x2b53a3[_0x0815('0x11')][_0x0815('0x13')]);}else{logger[_0x0815('0xb')](_0x0815('0xc'),_0x3c2014,_0x0815('0xd'));_0xa3e790(_0x2b53a3[_0x0815('0x14')][_0x0815('0x13')]);}})[_0x0815('0x15')](function(_0x1eb43d){logger[_0x0815('0x11')](_0x0815('0xc'),_0x3c2014,_0x1eb43d);_0x2fe044(_0x1eb43d);});});} \ No newline at end of file +var _0xe0b2=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x549cb4,_0x599177){var _0x463765=function(_0x423f01){while(--_0x423f01){_0x549cb4['push'](_0x549cb4['shift']());}};_0x463765(++_0x599177);}(_0xe0b2,0xec));var _0x2e0b=function(_0x13250c,_0x1576bb){_0x13250c=_0x13250c-0x0;var _0x283976=_0xe0b2[_0x13250c];return _0x283976;};'use strict';var _=require('lodash');var util=require(_0x2e0b('0x0'));var moment=require(_0x2e0b('0x1'));var BPromise=require(_0x2e0b('0x2'));var rs=require(_0x2e0b('0x3'));var fs=require('fs');var Redis=require(_0x2e0b('0x4'));var db=require(_0x2e0b('0x5'))['db'];var utils=require(_0x2e0b('0x6'));var logger=require('../../config/logger')(_0x2e0b('0x7'));var config=require(_0x2e0b('0x8'));var jayson=require(_0x2e0b('0x9'));var client=jayson[_0x2e0b('0xa')][_0x2e0b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x264319,_0x4b62b7,_0x2e1e40){return new BPromise(function(_0x504ea6,_0x1afd43){return client[_0x2e0b('0xc')](_0x264319,_0x2e1e40)[_0x2e0b('0xd')](function(_0x3078eb){logger[_0x2e0b('0xe')](_0x2e0b('0xf'),_0x4b62b7,_0x2e0b('0x10'));logger[_0x2e0b('0x11')](_0x2e0b('0x12'),_0x4b62b7,'request\x20sent',JSON[_0x2e0b('0x13')](_0x3078eb));if(_0x3078eb[_0x2e0b('0x14')]){if(_0x3078eb['error']['code']===0x1f4){logger[_0x2e0b('0x14')](_0x2e0b('0xf'),_0x4b62b7,_0x3078eb[_0x2e0b('0x14')][_0x2e0b('0x15')]);return _0x1afd43(_0x3078eb[_0x2e0b('0x14')][_0x2e0b('0x15')]);}logger[_0x2e0b('0x14')](_0x2e0b('0xf'),_0x4b62b7,_0x3078eb[_0x2e0b('0x14')][_0x2e0b('0x15')]);return _0x504ea6(_0x3078eb[_0x2e0b('0x14')][_0x2e0b('0x15')]);}else{logger['info']('VoiceQueuesLog,\x20%s,\x20%s',_0x4b62b7,'request\x20sent');_0x504ea6(_0x3078eb[_0x2e0b('0x16')]['message']);}})[_0x2e0b('0x17')](function(_0x426879){logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x4b62b7,_0x426879);_0x1afd43(_0x426879);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 8b0f5cd..8ecd1af 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 _0xd1bb=['destroy','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','/describe','show','/:id/download','download','downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','put','/:id','delete'];(function(_0x1f935c,_0x26ec37){var _0x14eb3d=function(_0x3d1381){while(--_0x3d1381){_0x1f935c['push'](_0x1f935c['shift']());}};_0x14eb3d(++_0x26ec37);}(_0xd1bb,0x146));var _0xbd1b=function(_0xa351a0,_0x2f250a){_0xa351a0=_0xa351a0-0x0;var _0xae347b=_0xd1bb[_0xa351a0];return _0xae347b;};'use strict';var multer=require('multer');var util=require(_0xbd1b('0x0'));var path=require(_0xbd1b('0x1'));var timeout=require(_0xbd1b('0x2'));var express=require(_0xbd1b('0x3'));var router=express[_0xbd1b('0x4')]();var fs_extra=require(_0xbd1b('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xbd1b('0x6'));var controller=require(_0xbd1b('0x7'));router[_0xbd1b('0x8')]('/',auth[_0xbd1b('0x9')](),controller[_0xbd1b('0xa')]);router[_0xbd1b('0x8')](_0xbd1b('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xbd1b('0x8')]('/:id',auth[_0xbd1b('0x9')](),controller[_0xbd1b('0xc')]);router['get'](_0xbd1b('0xd'),auth[_0xbd1b('0x9')](),controller[_0xbd1b('0xe')]);router[_0xbd1b('0x8')]('/:id/downloads',controller[_0xbd1b('0xf')]);router[_0xbd1b('0x8')](_0xbd1b('0x10'),auth[_0xbd1b('0x9')](),controller[_0xbd1b('0x11')]);router[_0xbd1b('0x12')]('/',auth[_0xbd1b('0x9')](),controller[_0xbd1b('0x13')]);router['post'](_0xbd1b('0x10'),auth[_0xbd1b('0x9')](),controller[_0xbd1b('0x14')]);router[_0xbd1b('0x15')](_0xbd1b('0x16'),auth['isAuthenticated'](),controller['update']);router[_0xbd1b('0x17')]('/:id',auth['isAuthenticated'](),controller[_0xbd1b('0x18')]);module['exports']=router; \ No newline at end of file +var _0x6f32=['Router','fs-extra','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','downloads','post','/:id/transcribe','put','update','delete','destroy','exports','multer','util','path','express'];(function(_0x40f998,_0x3b3149){var _0x305564=function(_0x2ba791){while(--_0x2ba791){_0x40f998['push'](_0x40f998['shift']());}};_0x305564(++_0x3b3149);}(_0x6f32,0xf6));var _0x26f3=function(_0x46d0c9,_0x526bfa){_0x46d0c9=_0x46d0c9-0x0;var _0x174506=_0x6f32[_0x46d0c9];return _0x174506;};'use strict';var multer=require(_0x26f3('0x0'));var util=require(_0x26f3('0x1'));var path=require(_0x26f3('0x2'));var timeout=require('connect-timeout');var express=require(_0x26f3('0x3'));var router=express[_0x26f3('0x4')]();var fs_extra=require(_0x26f3('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x26f3('0x6'));var controller=require(_0x26f3('0x7'));router[_0x26f3('0x8')]('/',auth[_0x26f3('0x9')](),controller[_0x26f3('0xa')]);router[_0x26f3('0x8')](_0x26f3('0xb'),auth['isAuthenticated'](),controller[_0x26f3('0xc')]);router[_0x26f3('0x8')](_0x26f3('0xd'),auth[_0x26f3('0x9')](),controller[_0x26f3('0xe')]);router[_0x26f3('0x8')](_0x26f3('0xf'),auth[_0x26f3('0x9')](),controller[_0x26f3('0x10')]);router[_0x26f3('0x8')]('/:id/downloads',controller[_0x26f3('0x11')]);router[_0x26f3('0x8')]('/:id/transcribe',auth[_0x26f3('0x9')](),controller['downloadTranscribe']);router[_0x26f3('0x12')]('/',auth[_0x26f3('0x9')](),controller['create']);router[_0x26f3('0x12')](_0x26f3('0x13'),auth[_0x26f3('0x9')](),controller['runTranscribe']);router[_0x26f3('0x14')](_0x26f3('0xd'),auth[_0x26f3('0x9')](),controller[_0x26f3('0x15')]);router[_0x26f3('0x16')](_0x26f3('0xd'),auth[_0x26f3('0x9')](),controller[_0x26f3('0x17')]);module[_0x26f3('0x18')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 713f7b8..c28c3d2 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(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'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(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x3')]('value')?path[_0x0a9e('0x4')](this[_0x0a9e('0x3')](_0x0a9e('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x0a9e('0x6')]},'channel':{'type':Sequelize[_0x0a9e('0x6')],'set':function(_0x57b080){if(_0x57b080){this[_0x0a9e('0x7')](_0x0a9e('0x8'),_0x57b080);this[_0x0a9e('0x7')]('membername',_0x57b080['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x0a9e('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0a9e('0x6')]},'connectedlinename':{'type':Sequelize[_0x0a9e('0x6')]},'accountcode':{'type':Sequelize[_0x0a9e('0x6')]},'context':{'type':Sequelize[_0x0a9e('0x6')]},'exten':{'type':Sequelize[_0x0a9e('0x6')]},'value':{'type':Sequelize[_0x0a9e('0x6')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'location':{'type':Sequelize[_0x0a9e('0x9')]},'transcribeName':{'type':Sequelize[_0x0a9e('0x6')]},'transcribeStatus':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':_0x0a9e('0xa')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0x0a9e('0x9')]},'failureReason':{'type':Sequelize[_0x0a9e('0x9')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')]},'sPositive':{'type':Sequelize[_0x0a9e('0xb')]},'sNegative':{'type':Sequelize[_0x0a9e('0xb')]},'sNeutral':{'type':Sequelize[_0x0a9e('0xb')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0a9e('0x3')]('createdAt'))[_0x0a9e('0xd')](_0x0a9e('0xe'))['toString']();}},'updatedAt':{'type':Sequelize[_0x0a9e('0xf')],'get':function(){return moment(this['getDataValue'](_0x0a9e('0x10')))[_0x0a9e('0xd')](_0x0a9e('0xe'))[_0x0a9e('0x11')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index f61c608..e81dbfb 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 _0x7c94=['recording','ValidationError','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','.cypher','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','bucket','location','Location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJobName','transcribeName','TranscriptionJob','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Setting','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','rimraf','request-promise','moment','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','uuid/v4','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','json','apply','save','then','error','stack','name','send','index','map','VoiceRecording','rawAttributes','type','key','model','format','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','intersection','create','body','update','find','describe','uniqueid','value','existsSync','decryptFile','secrets','Sequelize','VoiceRecording\x20not\x20found','filename','download','extname','unlink','message','Not\x20found','downloads','../../components/encryptor','sequelize','token','push','$and','%s.cypher'];(function(_0x4ca7b7,_0x546d63){var _0x39bf8d=function(_0xd5e9d9){while(--_0xd5e9d9){_0x4ca7b7['push'](_0x4ca7b7['shift']());}};_0x39bf8d(++_0x546d63);}(_0x7c94,0x167));var _0x47c9=function(_0x560ace,_0x244b87){_0x560ace=_0x560ace-0x0;var _0x316a3e=_0x7c94[_0x560ace];return _0x316a3e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x47c9('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x47c9('0x1'));var moment=require(_0x47c9('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x47c9('0x3'));var util=require(_0x47c9('0x4'));var path=require('path');var sox=require(_0x47c9('0x5'));var csv=require('to-csv');var ejs=require(_0x47c9('0x6'));var fs=require('fs');var fs_extra=require(_0x47c9('0x7'));var _=require(_0x47c9('0x8'));var squel=require(_0x47c9('0x9'));var crypto=require(_0x47c9('0xa'));var jsforce=require(_0x47c9('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x47c9('0xc'));var Papa=require('papaparse');var AWS=require('aws-sdk');var uuidv4=require(_0x47c9('0xd'));var Redis=require('ioredis');var authService=require(_0x47c9('0xe'));var qs=require(_0x47c9('0xf'));var as=require(_0x47c9('0x10'));var hardwareService=require(_0x47c9('0x11'));var logger=require('../../config/logger')(_0x47c9('0x12'));var utils=require('../../config/utils');var config=require(_0x47c9('0x13'));var licenseUtil=require(_0x47c9('0x14'));var db=require(_0x47c9('0x15'))['db'];function respondWithStatusCode(_0xf33d1b,_0x493e2c){_0x493e2c=_0x493e2c||0xcc;return function(_0xe4a27a){if(_0xe4a27a){return _0xf33d1b[_0x47c9('0x16')](_0x493e2c);}return _0xf33d1b['status'](_0x493e2c)[_0x47c9('0x17')]();};}function respondWithResult(_0x4f08a9,_0x43f072){_0x43f072=_0x43f072||0xc8;return function(_0x57565a){if(_0x57565a){return _0x4f08a9[_0x47c9('0x18')](_0x43f072)['json'](_0x57565a);}};}function respondWithFilteredResult(_0x529b00,_0x25def6){return function(_0x118462){if(_0x118462){var _0x4eb2ec=typeof _0x25def6[_0x47c9('0x19')]===_0x47c9('0x1a')&&typeof _0x25def6['limit']===_0x47c9('0x1a');var _0x2087c7=_0x118462[_0x47c9('0x1b')];var _0x411d77=_0x4eb2ec?0x0:_0x25def6[_0x47c9('0x19')];var _0x2ae488=_0x4eb2ec?_0x118462['count']:_0x25def6[_0x47c9('0x19')]+_0x25def6[_0x47c9('0x1c')];var _0x899e0b;if(_0x2ae488>=_0x2087c7){_0x2ae488=_0x2087c7;_0x899e0b=0xc8;}else{_0x899e0b=0xce;}_0x529b00[_0x47c9('0x18')](_0x899e0b);return _0x529b00[_0x47c9('0x1d')](_0x47c9('0x1e'),_0x411d77+'-'+_0x2ae488+'/'+_0x2087c7)[_0x47c9('0x1f')](_0x118462);}return null;};}function patchUpdates(_0x20381a){return function(_0x551a60){try{jsonpatch[_0x47c9('0x20')](_0x551a60,_0x20381a,!![]);}catch(_0x59f5b7){return BPromise['reject'](_0x59f5b7);}return _0x551a60[_0x47c9('0x21')]();};}function saveUpdates(_0x23ad46,_0x545067){return function(_0x4197d1){if(_0x4197d1){return _0x4197d1['update'](_0x23ad46)['then'](function(_0x3489ad){return _0x3489ad;});}return null;};}function removeEntity(_0x4ec992,_0x3d49fa){return function(_0x1ceb06){if(_0x1ceb06){return _0x1ceb06['destroy']()[_0x47c9('0x22')](function(){_0x4ec992['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x134c76,_0x43d416){return function(_0x24cb53){if(!_0x24cb53){_0x134c76[_0x47c9('0x16')](0x194);}return _0x24cb53;};}function handleError(_0x1db1aa,_0x5c84e3){_0x5c84e3=_0x5c84e3||0x1f4;return function(_0x240796){logger[_0x47c9('0x23')](_0x240796[_0x47c9('0x24')]);if(_0x240796[_0x47c9('0x25')]){delete _0x240796['name'];}_0x1db1aa[_0x47c9('0x18')](_0x5c84e3)[_0x47c9('0x26')](_0x240796);};}exports[_0x47c9('0x27')]=function(_0x188e68,_0x451c40){var _0x55ab02={},_0x436d89={},_0xf271ac={'count':0x0,'rows':[]};var _0x2f3fa3=_[_0x47c9('0x28')](db[_0x47c9('0x29')][_0x47c9('0x2a')],function(_0x543526){return{'name':_0x543526['fieldName'],'type':_0x543526[_0x47c9('0x2b')][_0x47c9('0x2c')]};});_0x436d89[_0x47c9('0x2d')]=_['differenceBy'](_[_0x47c9('0x28')](_0x2f3fa3,_0x47c9('0x25')),[_0x47c9('0x2e')]);_0x436d89[_0x47c9('0x2f')]=_[_0x47c9('0x30')](_0x188e68[_0x47c9('0x2f')]);_0x436d89[_0x47c9('0x31')]=_['intersection'](_0x436d89[_0x47c9('0x2d')],_0x436d89[_0x47c9('0x2f')]);_0x55ab02[_0x47c9('0x32')]=_['intersection'](_0x436d89[_0x47c9('0x2d')],qs[_0x47c9('0x33')](_0x188e68[_0x47c9('0x2f')]['fields']));_0x55ab02[_0x47c9('0x32')]=_0x55ab02[_0x47c9('0x32')][_0x47c9('0x34')]?_0x55ab02[_0x47c9('0x32')]:_0x436d89[_0x47c9('0x2d')];if(!_0x188e68[_0x47c9('0x2f')][_0x47c9('0x35')](_0x47c9('0x36'))){_0x55ab02['limit']=qs['limit'](_0x188e68[_0x47c9('0x2f')][_0x47c9('0x1c')]);_0x55ab02[_0x47c9('0x19')]=qs[_0x47c9('0x19')](_0x188e68[_0x47c9('0x2f')][_0x47c9('0x19')]);}_0x55ab02['order']=qs[_0x47c9('0x37')](_0x188e68[_0x47c9('0x2f')][_0x47c9('0x37')]);_0x55ab02[_0x47c9('0x38')]=qs[_0x47c9('0x31')](_[_0x47c9('0x39')](_0x188e68[_0x47c9('0x2f')],_0x436d89[_0x47c9('0x31')]),_0x2f3fa3);if(_0x188e68[_0x47c9('0x2f')][_0x47c9('0x3a')]){_0x55ab02['where']=_[_0x47c9('0x3b')](_0x55ab02[_0x47c9('0x38')],{'$or':_[_0x47c9('0x28')](_0x2f3fa3,function(_0x4ce652){if(_0x4ce652[_0x47c9('0x2b')]!==_0x47c9('0x3c')){var _0x494981={};_0x494981[_0x4ce652[_0x47c9('0x25')]]={'$like':'%'+_0x188e68[_0x47c9('0x2f')][_0x47c9('0x3a')]+'%'};return _0x494981;}})});}_0x55ab02=_['merge']({},_0x55ab02,_0x188e68[_0x47c9('0x3d')]);var _0x30ca47={'where':_0x55ab02['where']};return db[_0x47c9('0x29')][_0x47c9('0x1b')](_0x30ca47)['then'](function(_0x2176f2){_0xf271ac[_0x47c9('0x1b')]=_0x2176f2;if(_0x188e68[_0x47c9('0x2f')][_0x47c9('0x3e')]){_0x55ab02[_0x47c9('0x3f')]=[{'all':!![]}];}return db['VoiceRecording']['findAll'](_0x55ab02);})['then'](function(_0x2d4af7){_0xf271ac[_0x47c9('0x40')]=_0x2d4af7;return _0xf271ac;})[_0x47c9('0x22')](respondWithFilteredResult(_0x451c40,_0x55ab02))[_0x47c9('0x41')](handleError(_0x451c40,null));};exports[_0x47c9('0x42')]=function(_0x431927,_0x2d5ffd){var _0x4fce7d={'raw':![],'where':{'id':_0x431927[_0x47c9('0x43')]['id']}},_0x2cab={};_0x2cab[_0x47c9('0x2d')]=_[_0x47c9('0x30')](db[_0x47c9('0x29')][_0x47c9('0x2a')]);_0x2cab['query']=_['keys'](_0x431927[_0x47c9('0x2f')]);_0x2cab[_0x47c9('0x31')]=_[_0x47c9('0x44')](_0x2cab['model'],_0x2cab[_0x47c9('0x2f')]);_0x4fce7d[_0x47c9('0x32')]=_[_0x47c9('0x44')](_0x2cab['model'],qs['fields'](_0x431927[_0x47c9('0x2f')][_0x47c9('0x33')]));_0x4fce7d[_0x47c9('0x32')]=_0x4fce7d[_0x47c9('0x32')][_0x47c9('0x34')]?_0x4fce7d[_0x47c9('0x32')]:_0x2cab[_0x47c9('0x2d')];if(_0x431927[_0x47c9('0x2f')]['includeAll']){_0x4fce7d[_0x47c9('0x3f')]=[{'all':!![]}];}_0x4fce7d=_[_0x47c9('0x3b')]({},_0x4fce7d,_0x431927[_0x47c9('0x3d')]);return db[_0x47c9('0x29')]['find'](_0x4fce7d)[_0x47c9('0x22')](handleEntityNotFound(_0x2d5ffd,null))[_0x47c9('0x22')](respondWithResult(_0x2d5ffd,null))[_0x47c9('0x41')](handleError(_0x2d5ffd,null));};exports[_0x47c9('0x45')]=function(_0x2c9494,_0x4a6af5){return db[_0x47c9('0x29')][_0x47c9('0x45')](_0x2c9494[_0x47c9('0x46')],{})[_0x47c9('0x22')](respondWithResult(_0x4a6af5,0xc9))[_0x47c9('0x41')](handleError(_0x4a6af5,null));};exports[_0x47c9('0x47')]=function(_0x355822,_0x135d66){if(_0x355822[_0x47c9('0x46')]['id']){delete _0x355822[_0x47c9('0x46')]['id'];}return db['VoiceRecording'][_0x47c9('0x48')]({'where':{'id':_0x355822[_0x47c9('0x43')]['id']}})[_0x47c9('0x22')](handleEntityNotFound(_0x135d66,null))[_0x47c9('0x22')](saveUpdates(_0x355822[_0x47c9('0x46')],null))['then'](respondWithResult(_0x135d66,null))[_0x47c9('0x41')](handleError(_0x135d66,null));};exports['describe']=function(_0x4c7261,_0x35453a){return db[_0x47c9('0x29')][_0x47c9('0x49')]()[_0x47c9('0x22')](respondWithResult(_0x35453a,null))[_0x47c9('0x41')](handleError(_0x35453a,null));};exports['download']=function(_0x1f2058,_0x558490,_0x928db){var _0x55db78=require('../../components/encryptor');var _0x45f0ca=![];var _0xa94c79={};if(_0x1f2058['query']['type']&&_0x1f2058[_0x47c9('0x2f')][_0x47c9('0x2b')]===_0x47c9('0x4a')){_0xa94c79[_0x47c9('0x4a')]=_0x1f2058['params']['id'];}else{_0xa94c79['id']=_0x1f2058[_0x47c9('0x43')]['id'];}return db[_0x47c9('0x29')]['find']({'where':_0xa94c79,'attributes':['id','value'],'raw':!![]})[_0x47c9('0x22')](handleEntityNotFound(_0x558490,null))[_0x47c9('0x22')](function(_0x5519a1){if(_0x5519a1){var _0x3996af=_0x5519a1[_0x47c9('0x4b')];var _0x1b96a4=util[_0x47c9('0x2e')]('%s.cypher',_0x3996af);if(fs[_0x47c9('0x4c')](_0x1b96a4)){_0x45f0ca=!![];return _0x55db78[_0x47c9('0x4d')](_0x1b96a4,_0x3996af,config[_0x47c9('0x4e')]['recording'])['then'](function(){return _0x5519a1;});}return _0x5519a1;}})[_0x47c9('0x22')](function(_0x5ea557){if(_0x5ea557){var _0x292c1d=_0x5ea557[_0x47c9('0x4b')];if(!fs[_0x47c9('0x4c')](_0x292c1d)){throw new db[(_0x47c9('0x4f'))]['ValidationError'](_0x47c9('0x50'));}if(_0x5ea557[_0x47c9('0x51')]){return _0x558490[_0x47c9('0x52')](_0x292c1d,_0x5ea557[_0x47c9('0x51')]+path[_0x47c9('0x53')](_0x292c1d),function(){if(_0x45f0ca){fs['unlink'](_0x292c1d);}});}else{return _0x558490['download'](_0x292c1d,function(_0x1b10b5){if(_0x45f0ca){fs[_0x47c9('0x54')](_0x292c1d);}});}}})['catch'](function(_0x4ed7fd){if(_0x4ed7fd[_0x47c9('0x55')]===_0x47c9('0x50')){_0x558490[_0x47c9('0x18')](0x194)[_0x47c9('0x26')](_0x47c9('0x56'));}else{return handleError(_0x558490,null);}});};exports[_0x47c9('0x57')]=function(_0x371be0,_0x4ba064,_0xe4c7ff){var _0xd2f054=require(_0x47c9('0x58'));var _0x51ffe2=![];var _0x319e7f={'$and':[db[_0x47c9('0x59')]['where'](db[_0x47c9('0x59')]['fn']('MD5',db[_0x47c9('0x59')]['col'](_0x47c9('0x4a'))),_0x371be0[_0x47c9('0x2f')][_0x47c9('0x5a')])]};if(_0x371be0['query'][_0x47c9('0x2b')]&&_0x371be0[_0x47c9('0x2f')][_0x47c9('0x2b')]===_0x47c9('0x4a')){_0x319e7f['$and'][_0x47c9('0x5b')]({'uniqueid':_0x371be0[_0x47c9('0x43')]['id']});}else{_0x319e7f[_0x47c9('0x5c')][_0x47c9('0x5b')]({'id':_0x371be0[_0x47c9('0x43')]['id']});}return db[_0x47c9('0x29')][_0x47c9('0x48')]({'where':_0x319e7f,'attributes':['id',_0x47c9('0x4b')],'raw':!![]})[_0x47c9('0x22')](handleEntityNotFound(_0x4ba064,null))[_0x47c9('0x22')](function(_0x50ed45){if(_0x50ed45){var _0x3a26b1=util[_0x47c9('0x2e')](_0x47c9('0x5d'),_0x50ed45[_0x47c9('0x4b')]);if(fs['existsSync'](_0x3a26b1)){_0x51ffe2=!![];return _0xd2f054[_0x47c9('0x4d')](_0x3a26b1,_0x50ed45[_0x47c9('0x4b')],config['secrets'][_0x47c9('0x5e')])['then'](function(){return _0x50ed45;});}return _0x50ed45;}})[_0x47c9('0x22')](function(_0x46be59){if(_0x46be59){if(!fs['existsSync'](_0x46be59[_0x47c9('0x4b')])){throw new db[(_0x47c9('0x4f'))][(_0x47c9('0x5f'))](_0x47c9('0x50'));}if(_0x46be59[_0x47c9('0x51')]){return _0x4ba064[_0x47c9('0x52')](_0x46be59['value'],_0x46be59[_0x47c9('0x51')]+path[_0x47c9('0x53')](_0x46be59[_0x47c9('0x4b')]),function(){if(_0x51ffe2){fs['unlink'](_0x46be59[_0x47c9('0x4b')]);}});}else{return _0x4ba064[_0x47c9('0x52')](_0x46be59[_0x47c9('0x4b')],function(_0x5909fe){if(_0x51ffe2){fs[_0x47c9('0x54')](_0x46be59[_0x47c9('0x4b')]);}});}}})['catch'](handleError(_0x4ba064,null));};exports[_0x47c9('0x60')]=function(_0x74683,_0x2aefc5){return db['VoiceRecording'][_0x47c9('0x48')]({'where':{'id':_0x74683[_0x47c9('0x43')]['id']}})[_0x47c9('0x22')](function(_0x44ecf0){if(_[_0x47c9('0x61')](_0x44ecf0)){throw new ReferenceError(_0x47c9('0x62'));}return _0x44ecf0;})[_0x47c9('0x22')](function(_0xa3bf2f){var _0x560f85=_0xa3bf2f['value'];logger[_0x47c9('0x63')](_0x47c9('0x64'),_0x560f85);if(!_[_0x47c9('0x61')](_0xa3bf2f[_0x47c9('0x4b')])&&fs[_0x47c9('0x4c')](_0x560f85)){logger[_0x47c9('0x63')](_0x47c9('0x65')+_0x560f85+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x47c9('0x66')](_0x560f85);}_0x560f85=_0x560f85+_0x47c9('0x67');if(!_[_0x47c9('0x61')](_0xa3bf2f[_0x47c9('0x4b')])&&fs['existsSync'](_0x560f85)){logger['info']('File:\x20\x22'+_0x560f85+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x47c9('0x66')](_0x560f85);}return _0xa3bf2f;})[_0x47c9('0x22')](function(_0x24a471){if(!_0x24a471)throw new InternalError();return _0x24a471['destroy']();})[_0x47c9('0x22')](function(){_0x2aefc5[_0x47c9('0x18')](0xcc)[_0x47c9('0x17')]();})[_0x47c9('0x41')](handleError(_0x2aefc5,null));};function getBucketslist(_0x1aed6a,_0x361592,_0x5ef59f){return new Promise(function(_0x3778e7,_0x25b8bb){var _0x1ffd73=new AWS['S3']({'accessKeyId':_0x361592,'secretAccessKey':_0x1aed6a,'region':_0x5ef59f});_0x1ffd73[_0x47c9('0x68')]({},function(_0x8f08d6,_0x4d53e2){if(_0x8f08d6){return _0x25b8bb(_0x8f08d6);}else{return _0x3778e7(_0x4d53e2);}});});}function createBucket(_0x19f87f,_0x3b7d29,_0x4141c2,_0x3910b2){return new Promise(function(_0x2946fa,_0x35bb1e){var _0x15396f=new AWS['S3']({'accessKeyId':_0x3b7d29,'secretAccessKey':_0x19f87f,'region':_0x4141c2});_0x15396f[_0x47c9('0x69')]({'Bucket':_0x3910b2},function(_0xd8ab0f,_0x3d3de2){if(_0xd8ab0f){return _0x35bb1e(_0xd8ab0f);}else{return _0x2946fa(_0x3d3de2);}});});}function uploadFile(_0x86dd58,_0x392ca5,_0x6d0995,_0x424fb3,_0x43bd94,_0xea22c4){return new Promise(function(_0x3a9e7d,_0x2aa463){var _0x35abb6=new AWS['S3']({'accessKeyId':_0x392ca5,'secretAccessKey':_0x86dd58,'region':_0x6d0995});_0x35abb6[_0x47c9('0x6a')]({'Bucket':_0x424fb3,'Key':_0x43bd94,'Body':_0xea22c4},function(_0x3b1a8a,_0x2bc615){if(_0x3b1a8a){return _0x2aa463(_0x3b1a8a);}else{return _0x3a9e7d(_0x2bc615);}});});}function startTranscribe(_0x12d1fd,_0x2cef8c,_0x31cc63,_0x414e4f,_0x3efc00,_0x381433){return new Promise(function(_0xbacf1e,_0x2a99df){var _0x3078a0=new AWS[(_0x47c9('0x6b'))]({'accessKeyId':_0x2cef8c,'secretAccessKey':_0x12d1fd,'region':_0x31cc63});_0x3078a0[_0x47c9('0x6c')]({'TranscriptionJobName':_0x414e4f,'LanguageCode':_0x3efc00,'Media':{'MediaFileUri':_0x381433}},function(_0x32403f,_0xc22f1e){if(_0x32403f){return _0x2a99df(_0x32403f);}else{return _0xbacf1e(_0xc22f1e);}});});}function transcribe(_0x12d24b,_0x658432,_0x534d55,_0xb88245,_0x1537a8,_0x1c9608,_0x261450){return new Promise(function(_0x540fb9,_0x57f9ee){var _0x24e69c={};logger['info'](util[_0x47c9('0x2e')](_0x47c9('0x6d'),_0x12d24b,_0x1537a8));return uploadFile(_0x658432,_0x534d55,_0xb88245,_0x1537a8,path[_0x47c9('0x6e')](_0x1c9608),fs[_0x47c9('0x6f')](_0x1c9608))[_0x47c9('0x22')](function(_0xfe9286){logger[_0x47c9('0x63')](util[_0x47c9('0x2e')](_0x47c9('0x70'),_0x12d24b,_0x1537a8,_0xfe9286['Location']));_0x24e69c[_0x47c9('0x71')]=_0xfe9286['Bucket'];_0x24e69c[_0x47c9('0x72')]=_0xfe9286[_0x47c9('0x73')];logger[_0x47c9('0x63')](util[_0x47c9('0x2e')](_0x47c9('0x74'),_0x12d24b));return startTranscribe(_0x658432,_0x534d55,_0xb88245,uuidv4(),_0x261450,_0xfe9286[_0x47c9('0x73')]);})[_0x47c9('0x22')](function(_0x468760){logger[_0x47c9('0x63')](util[_0x47c9('0x2e')](_0x47c9('0x75'),_0x12d24b,_0x468760['TranscriptionJob'][_0x47c9('0x76')]));_0x24e69c[_0x47c9('0x77')]=_0x468760[_0x47c9('0x78')][_0x47c9('0x76')];_0x24e69c[_0x47c9('0x79')]=_0x468760['TranscriptionJob'][_0x47c9('0x7a')];return _0x540fb9(_0x24e69c);})[_0x47c9('0x41')](function(_0x155476){return _0x57f9ee(_0x155476);});});}exports[_0x47c9('0x7b')]=function(_0x1e57ca,_0x31b377,_0x5d9986){var _0x579b2c;var _0x293115;var _0x108748;var _0x313c92=require('../../components/encryptor');return db[_0x47c9('0x29')][_0x47c9('0x7c')]({'where':{'id':_0x1e57ca[_0x47c9('0x43')]['id']}})[_0x47c9('0x22')](function(_0x1a1920){if(_0x1a1920){var _0x3634ea=util[_0x47c9('0x2e')]('%s.cypher',_0x1a1920[_0x47c9('0x4b')]);if(fs[_0x47c9('0x4c')](_0x3634ea)){cypher=!![];return _0x313c92[_0x47c9('0x4d')](_0x3634ea,_0x1a1920[_0x47c9('0x4b')],config['secrets'][_0x47c9('0x5e')])['then'](function(){return _0x1a1920;});}return _0x1a1920;}})[_0x47c9('0x22')](function(_0x70db79){if(!_0x70db79){throw new db[(_0x47c9('0x4f'))]['ValidationError']('Voice\x20Recording\x20not\x20found');}_0x293115=_0x70db79;return db[_0x47c9('0x7d')][_0x47c9('0x7c')]({'where':{'id':0x1}});})[_0x47c9('0x22')](handleEntityNotFound(_0x31b377,null))[_0x47c9('0x22')](function(_0x180f90){if(_0x180f90){_0x579b2c=_0x180f90;if(!_0x579b2c[_0x47c9('0x7e')]||!_0x579b2c[_0x47c9('0x7f')]||!_0x579b2c[_0x47c9('0x80')]||!_0x579b2c[_0x47c9('0x81')]||!_0x579b2c[_0x47c9('0x71')]){throw new db[(_0x47c9('0x4f'))][(_0x47c9('0x5f'))](_0x47c9('0x82'));}if(_0x1e57ca[_0x47c9('0x46')][_0x47c9('0x83')]&&(!_0x579b2c[_0x47c9('0x84')]||!_0x579b2c['sentimentAccountId']||!_0x579b2c[_0x47c9('0x85')]||!_0x579b2c['language']||!_0x579b2c[_0x47c9('0x71')])){throw new db[(_0x47c9('0x4f'))][(_0x47c9('0x5f'))](_0x47c9('0x86'));}return db[_0x47c9('0x87')][_0x47c9('0x7c')]({'where':{'id':_0x579b2c['transcribeAccountId']}});}})[_0x47c9('0x22')](function(_0x489cc6){if(!_0x489cc6){throw new db[(_0x47c9('0x4f'))]['ValidationError'](_0x47c9('0x88'));}if(!_0x489cc6[_0x47c9('0x89')]||!_0x489cc6[_0x47c9('0x8a')]){throw new db['Sequelize'][(_0x47c9('0x5f'))]('Cloud\x20Provider\x20not\x20configured');}_0x108748=_0x489cc6;return getBucketslist(_0x108748[_0x47c9('0x89')],_0x108748[_0x47c9('0x8a')],_0x579b2c[_0x47c9('0x80')]);})[_0x47c9('0x22')](function(_0x4e3f12){if(_0x4e3f12&&_0x4e3f12[_0x47c9('0x8b')]){var _0x408789=_[_0x47c9('0x48')](_0x4e3f12[_0x47c9('0x8b')],function(_0x1be79b){return _0x1be79b['Name']===_0x579b2c[_0x47c9('0x71')];});if(!_0x408789){logger['info'](util[_0x47c9('0x2e')](_0x47c9('0x8c'),_0x1e57ca[_0x47c9('0x43')]['id'],_0x579b2c[_0x47c9('0x71')]));return createBucket(_0x108748['data1'],_0x108748[_0x47c9('0x8a')],_0x579b2c[_0x47c9('0x80')],_0x579b2c[_0x47c9('0x71')]);}logger['info'](util['format'](_0x47c9('0x8d'),_0x1e57ca[_0x47c9('0x43')]['id'],_0x579b2c[_0x47c9('0x71')]));return;}})[_0x47c9('0x22')](function(_0x5d19a2){if(_0x293115[_0x47c9('0x79')]===_0x47c9('0x8e')){return transcribe(_0x1e57ca['params']['id'],_0x108748[_0x47c9('0x89')],_0x108748[_0x47c9('0x8a')],_0x579b2c[_0x47c9('0x80')],_0x579b2c['bucket'],_0x293115['value'],_0x579b2c[_0x47c9('0x81')]);}else{logger[_0x47c9('0x63')](util['format'](_0x47c9('0x8f'),_0x1e57ca[_0x47c9('0x43')]['id']));return{'transcribeStatus':_0x47c9('0x90')};}})[_0x47c9('0x22')](function(_0x415902){if(_0x415902){_0x415902[_0x47c9('0x91')]=_0x1e57ca['body']['runSentiment'];return _0x293115['updateAttributes'](_0x415902);}})[_0x47c9('0x22')](respondWithResult(_0x31b377,null))[_0x47c9('0x41')](handleError(_0x31b377,null));};function writeFile(_0x1d0e61,_0x12ee35){return new Promise(function(_0x283b78,_0x1af9a8){fs['writeFile'](_0x12ee35,_0x1d0e61,function(_0x44044d,_0x529002){if(_0x44044d){return _0x1af9a8(_0x44044d);}else{return _0x283b78(_0x529002);}});});}exports['downloadTranscribe']=function(_0x26fac4,_0x197edf,_0x4258e4){return db[_0x47c9('0x29')]['findOne']({'where':{'id':_0x26fac4[_0x47c9('0x43')]['id']}})[_0x47c9('0x22')](handleEntityNotFound(_0x197edf))[_0x47c9('0x22')](function(_0x20563b){if(_0x20563b&&_0x20563b['fileText']){var _0x2d0483=_0x20563b[_0x47c9('0x92')];var _0xa0b5a9=config[_0x47c9('0x93')]+_0x47c9('0x94')+_0x20563b['id']+_0x47c9('0x95');if(fs[_0x47c9('0x4c')](_0xa0b5a9)){return _0xa0b5a9;}return writeFile(_0x2d0483,_0xa0b5a9)[_0x47c9('0x22')](function(){return _0xa0b5a9;});}else{throw new db[(_0x47c9('0x4f'))]['ValidationError'](_0x47c9('0x96'));}})[_0x47c9('0x22')](function(_0x838f21){return _0x197edf[_0x47c9('0x52')](_0x838f21);})[_0x47c9('0x41')](handleError(_0x197edf));}; \ No newline at end of file +var _0x1bb3=['Location','bucket','Bucket','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','TranscriptionJob','TranscriptionJobName','transcribeName','TranscriptionJobStatus','runTranscribe','findOne','secrets','Voice\x20Recording\x20not\x20found','Setting','transcribeAccountId','language','Transcribe\x20not\x20configured','sentiment','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','transcribeRegion','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','transcribeStatus','NEW','IN_PROGRESS','runSentiment','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','count','limit','set','Content-Range','apply','reject','save','destroy','error','name','send','index','VoiceRecording','rawAttributes','fieldName','type','key','model','differenceBy','map','format','query','keys','filters','fields','length','nolimit','order','sort','pick','where','VIRTUAL','filter','options','then','includeAll','include','rows','catch','show','params','intersection','attributes','merge','find','create','body','update','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','decryptFile','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','unlink','message','Not\x20found','sequelize','col','token','$and','push','existsSync','recording','isNil','info','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','listBuckets','createBucket','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)'];(function(_0x5123f3,_0x21763d){var _0x1df5de=function(_0x2f084e){while(--_0x2f084e){_0x5123f3['push'](_0x5123f3['shift']());}};_0x1df5de(++_0x21763d);}(_0x1bb3,0xc2));var _0x31bb=function(_0x4148fd,_0x1d63e5){_0x4148fd=_0x4148fd-0x0;var _0x3ffb7d=_0x1bb3[_0x4148fd];return _0x3ffb7d;};'use strict';var emlformat=require(_0x31bb('0x0'));var rimraf=require(_0x31bb('0x1'));var zipdir=require(_0x31bb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x31bb('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x31bb('0x4'));var util=require(_0x31bb('0x5'));var path=require(_0x31bb('0x6'));var sox=require(_0x31bb('0x7'));var csv=require(_0x31bb('0x8'));var ejs=require(_0x31bb('0x9'));var fs=require('fs');var fs_extra=require(_0x31bb('0xa'));var _=require(_0x31bb('0xb'));var squel=require(_0x31bb('0xc'));var crypto=require(_0x31bb('0xd'));var jsforce=require(_0x31bb('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x31bb('0x8'));var querystring=require(_0x31bb('0xf'));var Papa=require(_0x31bb('0x10'));var AWS=require(_0x31bb('0x11'));var uuidv4=require(_0x31bb('0x12'));var Redis=require(_0x31bb('0x13'));var authService=require(_0x31bb('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x31bb('0x15'));var hardwareService=require(_0x31bb('0x16'));var logger=require(_0x31bb('0x17'))(_0x31bb('0x18'));var utils=require(_0x31bb('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x31bb('0x1a'));var db=require(_0x31bb('0x1b'))['db'];function respondWithStatusCode(_0x413f48,_0x5b1eb9){_0x5b1eb9=_0x5b1eb9||0xcc;return function(_0x1fc017){if(_0x1fc017){return _0x413f48[_0x31bb('0x1c')](_0x5b1eb9);}return _0x413f48[_0x31bb('0x1d')](_0x5b1eb9)[_0x31bb('0x1e')]();};}function respondWithResult(_0x1019de,_0x106917){_0x106917=_0x106917||0xc8;return function(_0x3acf3a){if(_0x3acf3a){return _0x1019de[_0x31bb('0x1d')](_0x106917)[_0x31bb('0x1f')](_0x3acf3a);}};}function respondWithFilteredResult(_0x106414,_0x1f7fb7){return function(_0x7413c6){if(_0x7413c6){var _0xfc997a=typeof _0x1f7fb7[_0x31bb('0x20')]==='undefined'&&typeof _0x1f7fb7['limit']==='undefined';var _0xd067b0=_0x7413c6['count'];var _0x552540=_0xfc997a?0x0:_0x1f7fb7['offset'];var _0x1ec93d=_0xfc997a?_0x7413c6[_0x31bb('0x21')]:_0x1f7fb7[_0x31bb('0x20')]+_0x1f7fb7[_0x31bb('0x22')];var _0x1abd36;if(_0x1ec93d>=_0xd067b0){_0x1ec93d=_0xd067b0;_0x1abd36=0xc8;}else{_0x1abd36=0xce;}_0x106414[_0x31bb('0x1d')](_0x1abd36);return _0x106414[_0x31bb('0x23')](_0x31bb('0x24'),_0x552540+'-'+_0x1ec93d+'/'+_0xd067b0)[_0x31bb('0x1f')](_0x7413c6);}return null;};}function patchUpdates(_0x253955){return function(_0x1a57d4){try{jsonpatch[_0x31bb('0x25')](_0x1a57d4,_0x253955,!![]);}catch(_0xc93ef3){return BPromise[_0x31bb('0x26')](_0xc93ef3);}return _0x1a57d4[_0x31bb('0x27')]();};}function saveUpdates(_0x12b35e,_0x3657c4){return function(_0x5732d9){if(_0x5732d9){return _0x5732d9['update'](_0x12b35e)['then'](function(_0x4dce10){return _0x4dce10;});}return null;};}function removeEntity(_0x911e7d,_0x2f0784){return function(_0x1b860e){if(_0x1b860e){return _0x1b860e[_0x31bb('0x28')]()['then'](function(){_0x911e7d[_0x31bb('0x1d')](0xcc)[_0x31bb('0x1e')]();});}};}function handleEntityNotFound(_0x335162,_0x2f5ea0){return function(_0x2d8cc6){if(!_0x2d8cc6){_0x335162[_0x31bb('0x1c')](0x194);}return _0x2d8cc6;};}function handleError(_0x38b5a5,_0x56bcd9){_0x56bcd9=_0x56bcd9||0x1f4;return function(_0x179cc0){logger[_0x31bb('0x29')](_0x179cc0['stack']);if(_0x179cc0[_0x31bb('0x2a')]){delete _0x179cc0['name'];}_0x38b5a5[_0x31bb('0x1d')](_0x56bcd9)[_0x31bb('0x2b')](_0x179cc0);};}exports[_0x31bb('0x2c')]=function(_0x110e8e,_0x26ee26){var _0x4d271b={},_0x33bb0a={},_0x210af9={'count':0x0,'rows':[]};var _0x1cdbc5=_['map'](db[_0x31bb('0x2d')][_0x31bb('0x2e')],function(_0x3efa04){return{'name':_0x3efa04[_0x31bb('0x2f')],'type':_0x3efa04[_0x31bb('0x30')][_0x31bb('0x31')]};});_0x33bb0a[_0x31bb('0x32')]=_[_0x31bb('0x33')](_[_0x31bb('0x34')](_0x1cdbc5,_0x31bb('0x2a')),[_0x31bb('0x35')]);_0x33bb0a[_0x31bb('0x36')]=_[_0x31bb('0x37')](_0x110e8e['query']);_0x33bb0a[_0x31bb('0x38')]=_['intersection'](_0x33bb0a['model'],_0x33bb0a['query']);_0x4d271b['attributes']=_['intersection'](_0x33bb0a[_0x31bb('0x32')],qs[_0x31bb('0x39')](_0x110e8e[_0x31bb('0x36')][_0x31bb('0x39')]));_0x4d271b['attributes']=_0x4d271b['attributes'][_0x31bb('0x3a')]?_0x4d271b['attributes']:_0x33bb0a[_0x31bb('0x32')];if(!_0x110e8e['query']['hasOwnProperty'](_0x31bb('0x3b'))){_0x4d271b[_0x31bb('0x22')]=qs['limit'](_0x110e8e[_0x31bb('0x36')][_0x31bb('0x22')]);_0x4d271b['offset']=qs[_0x31bb('0x20')](_0x110e8e[_0x31bb('0x36')]['offset']);}_0x4d271b[_0x31bb('0x3c')]=qs[_0x31bb('0x3d')](_0x110e8e[_0x31bb('0x36')][_0x31bb('0x3d')]);_0x4d271b['where']=qs[_0x31bb('0x38')](_[_0x31bb('0x3e')](_0x110e8e[_0x31bb('0x36')],_0x33bb0a[_0x31bb('0x38')]),_0x1cdbc5);if(_0x110e8e['query']['filter']){_0x4d271b[_0x31bb('0x3f')]=_['merge'](_0x4d271b[_0x31bb('0x3f')],{'$or':_['map'](_0x1cdbc5,function(_0x49efe6){if(_0x49efe6[_0x31bb('0x30')]!==_0x31bb('0x40')){var _0x16bb2c={};_0x16bb2c[_0x49efe6[_0x31bb('0x2a')]]={'$like':'%'+_0x110e8e[_0x31bb('0x36')][_0x31bb('0x41')]+'%'};return _0x16bb2c;}})});}_0x4d271b=_['merge']({},_0x4d271b,_0x110e8e[_0x31bb('0x42')]);var _0x5610a9={'where':_0x4d271b[_0x31bb('0x3f')]};return db['VoiceRecording']['count'](_0x5610a9)[_0x31bb('0x43')](function(_0x43691b){_0x210af9[_0x31bb('0x21')]=_0x43691b;if(_0x110e8e['query'][_0x31bb('0x44')]){_0x4d271b[_0x31bb('0x45')]=[{'all':!![]}];}return db['VoiceRecording']['findAll'](_0x4d271b);})[_0x31bb('0x43')](function(_0x25dbff){_0x210af9[_0x31bb('0x46')]=_0x25dbff;return _0x210af9;})['then'](respondWithFilteredResult(_0x26ee26,_0x4d271b))[_0x31bb('0x47')](handleError(_0x26ee26,null));};exports[_0x31bb('0x48')]=function(_0x2610df,_0x14e004){var _0x59473e={'raw':![],'where':{'id':_0x2610df[_0x31bb('0x49')]['id']}},_0x22b8df={};_0x22b8df['model']=_[_0x31bb('0x37')](db[_0x31bb('0x2d')][_0x31bb('0x2e')]);_0x22b8df[_0x31bb('0x36')]=_[_0x31bb('0x37')](_0x2610df['query']);_0x22b8df['filters']=_[_0x31bb('0x4a')](_0x22b8df[_0x31bb('0x32')],_0x22b8df[_0x31bb('0x36')]);_0x59473e[_0x31bb('0x4b')]=_['intersection'](_0x22b8df[_0x31bb('0x32')],qs[_0x31bb('0x39')](_0x2610df['query']['fields']));_0x59473e[_0x31bb('0x4b')]=_0x59473e['attributes'][_0x31bb('0x3a')]?_0x59473e[_0x31bb('0x4b')]:_0x22b8df[_0x31bb('0x32')];if(_0x2610df[_0x31bb('0x36')]['includeAll']){_0x59473e[_0x31bb('0x45')]=[{'all':!![]}];}_0x59473e=_[_0x31bb('0x4c')]({},_0x59473e,_0x2610df[_0x31bb('0x42')]);return db[_0x31bb('0x2d')][_0x31bb('0x4d')](_0x59473e)['then'](handleEntityNotFound(_0x14e004,null))[_0x31bb('0x43')](respondWithResult(_0x14e004,null))[_0x31bb('0x47')](handleError(_0x14e004,null));};exports['create']=function(_0x349978,_0x186255){return db[_0x31bb('0x2d')][_0x31bb('0x4e')](_0x349978[_0x31bb('0x4f')],{})[_0x31bb('0x43')](respondWithResult(_0x186255,0xc9))[_0x31bb('0x47')](handleError(_0x186255,null));};exports[_0x31bb('0x50')]=function(_0x491445,_0x3a473e){if(_0x491445[_0x31bb('0x4f')]['id']){delete _0x491445['body']['id'];}return db[_0x31bb('0x2d')][_0x31bb('0x4d')]({'where':{'id':_0x491445[_0x31bb('0x49')]['id']}})[_0x31bb('0x43')](handleEntityNotFound(_0x3a473e,null))[_0x31bb('0x43')](saveUpdates(_0x491445[_0x31bb('0x4f')],null))[_0x31bb('0x43')](respondWithResult(_0x3a473e,null))[_0x31bb('0x47')](handleError(_0x3a473e,null));};exports['describe']=function(_0xef27bc,_0x2ef455){return db['VoiceRecording'][_0x31bb('0x51')]()[_0x31bb('0x43')](respondWithResult(_0x2ef455,null))[_0x31bb('0x47')](handleError(_0x2ef455,null));};exports[_0x31bb('0x52')]=function(_0x21d455,_0xfdf8eb,_0xef2511){var _0x115a54=require(_0x31bb('0x53'));var _0x42d817=![];var _0x214c79={};if(_0x21d455[_0x31bb('0x36')]['type']&&_0x21d455[_0x31bb('0x36')][_0x31bb('0x30')]===_0x31bb('0x54')){_0x214c79[_0x31bb('0x54')]=_0x21d455[_0x31bb('0x49')]['id'];}else{_0x214c79['id']=_0x21d455[_0x31bb('0x49')]['id'];}return db[_0x31bb('0x2d')][_0x31bb('0x4d')]({'where':_0x214c79,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0xfdf8eb,null))[_0x31bb('0x43')](function(_0x387184){if(_0x387184){var _0x458c3b=_0x387184[_0x31bb('0x55')];var _0x4f1ae1=util[_0x31bb('0x35')](_0x31bb('0x56'),_0x458c3b);if(fs['existsSync'](_0x4f1ae1)){_0x42d817=!![];return _0x115a54[_0x31bb('0x57')](_0x4f1ae1,_0x458c3b,config['secrets']['recording'])['then'](function(){return _0x387184;});}return _0x387184;}})['then'](function(_0x42a52a){if(_0x42a52a){var _0x5646c8=_0x42a52a[_0x31bb('0x55')];if(!fs['existsSync'](_0x5646c8)){throw new db[(_0x31bb('0x58'))][(_0x31bb('0x59'))](_0x31bb('0x5a'));}if(_0x42a52a['filename']){return _0xfdf8eb[_0x31bb('0x52')](_0x5646c8,_0x42a52a[_0x31bb('0x5b')]+path['extname'](_0x5646c8),function(){if(_0x42d817){fs[_0x31bb('0x5c')](_0x5646c8);}});}else{return _0xfdf8eb['download'](_0x5646c8,function(_0x13747b){if(_0x42d817){fs[_0x31bb('0x5c')](_0x5646c8);}});}}})[_0x31bb('0x47')](function(_0x47b97a){if(_0x47b97a[_0x31bb('0x5d')]===_0x31bb('0x5a')){_0xfdf8eb[_0x31bb('0x1d')](0x194)['send'](_0x31bb('0x5e'));}else{return handleError(_0xfdf8eb,null);}});};exports['downloads']=function(_0x96b02b,_0x3d9650,_0x9447b3){var _0x101c6b=require(_0x31bb('0x53'));var _0x2ca46b=![];var _0x5a3359={'$and':[db[_0x31bb('0x5f')]['where'](db[_0x31bb('0x5f')]['fn']('MD5',db['sequelize'][_0x31bb('0x60')]('uniqueid')),_0x96b02b[_0x31bb('0x36')][_0x31bb('0x61')])]};if(_0x96b02b[_0x31bb('0x36')][_0x31bb('0x30')]&&_0x96b02b[_0x31bb('0x36')][_0x31bb('0x30')]==='uniqueid'){_0x5a3359[_0x31bb('0x62')][_0x31bb('0x63')]({'uniqueid':_0x96b02b[_0x31bb('0x49')]['id']});}else{_0x5a3359[_0x31bb('0x62')]['push']({'id':_0x96b02b[_0x31bb('0x49')]['id']});}return db[_0x31bb('0x2d')]['find']({'where':_0x5a3359,'attributes':['id','value'],'raw':!![]})[_0x31bb('0x43')](handleEntityNotFound(_0x3d9650,null))[_0x31bb('0x43')](function(_0x2dc44a){if(_0x2dc44a){var _0x1a8758=util[_0x31bb('0x35')](_0x31bb('0x56'),_0x2dc44a[_0x31bb('0x55')]);if(fs[_0x31bb('0x64')](_0x1a8758)){_0x2ca46b=!![];return _0x101c6b[_0x31bb('0x57')](_0x1a8758,_0x2dc44a[_0x31bb('0x55')],config['secrets'][_0x31bb('0x65')])[_0x31bb('0x43')](function(){return _0x2dc44a;});}return _0x2dc44a;}})[_0x31bb('0x43')](function(_0x5a4772){if(_0x5a4772){if(!fs['existsSync'](_0x5a4772[_0x31bb('0x55')])){throw new db[(_0x31bb('0x58'))][(_0x31bb('0x59'))]('VoiceRecording\x20not\x20found');}if(_0x5a4772['filename']){return _0x3d9650['download'](_0x5a4772['value'],_0x5a4772[_0x31bb('0x5b')]+path['extname'](_0x5a4772[_0x31bb('0x55')]),function(){if(_0x2ca46b){fs[_0x31bb('0x5c')](_0x5a4772['value']);}});}else{return _0x3d9650['download'](_0x5a4772['value'],function(_0x2fa57b){if(_0x2ca46b){fs[_0x31bb('0x5c')](_0x5a4772[_0x31bb('0x55')]);}});}}})[_0x31bb('0x47')](handleError(_0x3d9650,null));};exports[_0x31bb('0x28')]=function(_0x47f605,_0x598436){return db[_0x31bb('0x2d')][_0x31bb('0x4d')]({'where':{'id':_0x47f605[_0x31bb('0x49')]['id']}})[_0x31bb('0x43')](function(_0x1d2c89){if(_[_0x31bb('0x66')](_0x1d2c89)){throw new ReferenceError('Entity\x20not\x20found');}return _0x1d2c89;})[_0x31bb('0x43')](function(_0x2d0826){var _0x23451a=_0x2d0826[_0x31bb('0x55')];logger[_0x31bb('0x67')]('cancellazione\x20fisica\x20documento\x20%s',_0x23451a);if(!_[_0x31bb('0x66')](_0x2d0826['value'])&&fs[_0x31bb('0x64')](_0x23451a)){logger[_0x31bb('0x67')](_0x31bb('0x68')+_0x23451a+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x31bb('0x69')](_0x23451a);}_0x23451a=_0x23451a+_0x31bb('0x6a');if(!_['isNil'](_0x2d0826['value'])&&fs[_0x31bb('0x64')](_0x23451a)){logger[_0x31bb('0x67')]('File:\x20\x22'+_0x23451a+_0x31bb('0x6b'));fs[_0x31bb('0x69')](_0x23451a);}return _0x2d0826;})[_0x31bb('0x43')](function(_0x17153f){if(!_0x17153f)throw new InternalError();return _0x17153f[_0x31bb('0x28')]();})[_0x31bb('0x43')](function(){_0x598436[_0x31bb('0x1d')](0xcc)[_0x31bb('0x1e')]();})[_0x31bb('0x47')](handleError(_0x598436,null));};function getBucketslist(_0x5a1eb9,_0x2c36de,_0x1e9887){return new Promise(function(_0x49d6ca,_0x59122f){var _0x37ee3a=new AWS['S3']({'accessKeyId':_0x2c36de,'secretAccessKey':_0x5a1eb9,'region':_0x1e9887});_0x37ee3a[_0x31bb('0x6c')]({},function(_0x23e2d7,_0x38d7b1){if(_0x23e2d7){return _0x59122f(_0x23e2d7);}else{return _0x49d6ca(_0x38d7b1);}});});}function createBucket(_0x564147,_0x4f82ac,_0x4bbd5f,_0x4575a5){return new Promise(function(_0x4ef6ab,_0x5a10c3){var _0x2c371e=new AWS['S3']({'accessKeyId':_0x4f82ac,'secretAccessKey':_0x564147,'region':_0x4bbd5f});_0x2c371e[_0x31bb('0x6d')]({'Bucket':_0x4575a5},function(_0x7a3ca9,_0x48f9a2){if(_0x7a3ca9){return _0x5a10c3(_0x7a3ca9);}else{return _0x4ef6ab(_0x48f9a2);}});});}function uploadFile(_0x2f534d,_0x22d524,_0x5b2b39,_0x4767f4,_0x1a81b4,_0x299252){return new Promise(function(_0xe7b99e,_0x3f6aa1){var _0x441b6b=new AWS['S3']({'accessKeyId':_0x22d524,'secretAccessKey':_0x2f534d,'region':_0x5b2b39});_0x441b6b['upload']({'Bucket':_0x4767f4,'Key':_0x1a81b4,'Body':_0x299252},function(_0xcda364,_0x427410){if(_0xcda364){return _0x3f6aa1(_0xcda364);}else{return _0xe7b99e(_0x427410);}});});}function startTranscribe(_0x24cbc8,_0x4d9dbd,_0x9df47a,_0x49bb36,_0x373172,_0x3f74ad){return new Promise(function(_0x4d07d6,_0x10c8f2){var _0x5e44dc=new AWS[(_0x31bb('0x6e'))]({'accessKeyId':_0x4d9dbd,'secretAccessKey':_0x24cbc8,'region':_0x9df47a});_0x5e44dc[_0x31bb('0x6f')]({'TranscriptionJobName':_0x49bb36,'LanguageCode':_0x373172,'Media':{'MediaFileUri':_0x3f74ad}},function(_0x1e9251,_0x33289b){if(_0x1e9251){return _0x10c8f2(_0x1e9251);}else{return _0x4d07d6(_0x33289b);}});});}function transcribe(_0x2692e9,_0x12866c,_0x5ad131,_0x1aaaec,_0x141c8e,_0x5bce1f,_0x480887){return new Promise(function(_0xd36f96,_0x4c317c){var _0x441326={};logger[_0x31bb('0x67')](util[_0x31bb('0x35')](_0x31bb('0x70'),_0x2692e9,_0x141c8e));return uploadFile(_0x12866c,_0x5ad131,_0x1aaaec,_0x141c8e,path[_0x31bb('0x71')](_0x5bce1f),fs[_0x31bb('0x72')](_0x5bce1f))[_0x31bb('0x43')](function(_0x4e450b){logger[_0x31bb('0x67')](util[_0x31bb('0x35')](_0x31bb('0x73'),_0x2692e9,_0x141c8e,_0x4e450b[_0x31bb('0x74')]));_0x441326[_0x31bb('0x75')]=_0x4e450b[_0x31bb('0x76')];_0x441326['location']=_0x4e450b['Location'];logger[_0x31bb('0x67')](util[_0x31bb('0x35')](_0x31bb('0x77'),_0x2692e9));return startTranscribe(_0x12866c,_0x5ad131,_0x1aaaec,uuidv4(),_0x480887,_0x4e450b['Location']);})[_0x31bb('0x43')](function(_0x4dd6c9){logger[_0x31bb('0x67')](util['format']('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x2692e9,_0x4dd6c9[_0x31bb('0x78')][_0x31bb('0x79')]));_0x441326[_0x31bb('0x7a')]=_0x4dd6c9['TranscriptionJob'][_0x31bb('0x79')];_0x441326['transcribeStatus']=_0x4dd6c9[_0x31bb('0x78')][_0x31bb('0x7b')];return _0xd36f96(_0x441326);})['catch'](function(_0x309ffb){return _0x4c317c(_0x309ffb);});});}exports[_0x31bb('0x7c')]=function(_0x44887e,_0xbc7a5a,_0x54cf2c){var _0x10e7c2;var _0x521c52;var _0x695b5d;var _0x5e725c=require('../../components/encryptor');return db[_0x31bb('0x2d')][_0x31bb('0x7d')]({'where':{'id':_0x44887e['params']['id']}})[_0x31bb('0x43')](function(_0x371c74){if(_0x371c74){var _0x2cf760=util[_0x31bb('0x35')](_0x31bb('0x56'),_0x371c74[_0x31bb('0x55')]);if(fs[_0x31bb('0x64')](_0x2cf760)){cypher=!![];return _0x5e725c[_0x31bb('0x57')](_0x2cf760,_0x371c74['value'],config[_0x31bb('0x7e')]['recording'])[_0x31bb('0x43')](function(){return _0x371c74;});}return _0x371c74;}})[_0x31bb('0x43')](function(_0x361d4a){if(!_0x361d4a){throw new db[(_0x31bb('0x58'))]['ValidationError'](_0x31bb('0x7f'));}_0x521c52=_0x361d4a;return db[_0x31bb('0x80')][_0x31bb('0x7d')]({'where':{'id':0x1}});})[_0x31bb('0x43')](handleEntityNotFound(_0xbc7a5a,null))['then'](function(_0x1220c2){if(_0x1220c2){_0x10e7c2=_0x1220c2;if(!_0x10e7c2['transcribe']||!_0x10e7c2[_0x31bb('0x81')]||!_0x10e7c2['transcribeRegion']||!_0x10e7c2[_0x31bb('0x82')]||!_0x10e7c2[_0x31bb('0x75')]){throw new db[(_0x31bb('0x58'))][(_0x31bb('0x59'))](_0x31bb('0x83'));}if(_0x44887e[_0x31bb('0x4f')]['runSentiment']&&(!_0x10e7c2[_0x31bb('0x84')]||!_0x10e7c2['sentimentAccountId']||!_0x10e7c2['sentimentRegion']||!_0x10e7c2[_0x31bb('0x82')]||!_0x10e7c2[_0x31bb('0x75')])){throw new db[(_0x31bb('0x58'))]['ValidationError'](_0x31bb('0x85'));}return db[_0x31bb('0x86')][_0x31bb('0x7d')]({'where':{'id':_0x10e7c2['transcribeAccountId']}});}})[_0x31bb('0x43')](function(_0x181539){if(!_0x181539){throw new db[(_0x31bb('0x58'))][(_0x31bb('0x59'))](_0x31bb('0x87'));}if(!_0x181539[_0x31bb('0x88')]||!_0x181539[_0x31bb('0x89')]){throw new db[(_0x31bb('0x58'))][(_0x31bb('0x59'))](_0x31bb('0x8a'));}_0x695b5d=_0x181539;return getBucketslist(_0x695b5d[_0x31bb('0x88')],_0x695b5d['data2'],_0x10e7c2[_0x31bb('0x8b')]);})[_0x31bb('0x43')](function(_0x52957a){if(_0x52957a&&_0x52957a[_0x31bb('0x8c')]){var _0x95c49b=_[_0x31bb('0x4d')](_0x52957a[_0x31bb('0x8c')],function(_0x165853){return _0x165853[_0x31bb('0x8d')]===_0x10e7c2[_0x31bb('0x75')];});if(!_0x95c49b){logger[_0x31bb('0x67')](util['format'](_0x31bb('0x8e'),_0x44887e[_0x31bb('0x49')]['id'],_0x10e7c2['bucket']));return createBucket(_0x695b5d[_0x31bb('0x88')],_0x695b5d['data2'],_0x10e7c2[_0x31bb('0x8b')],_0x10e7c2[_0x31bb('0x75')]);}logger[_0x31bb('0x67')](util['format'](_0x31bb('0x8f'),_0x44887e[_0x31bb('0x49')]['id'],_0x10e7c2[_0x31bb('0x75')]));return;}})[_0x31bb('0x43')](function(_0x26e1d7){if(_0x521c52[_0x31bb('0x90')]===_0x31bb('0x91')){return transcribe(_0x44887e[_0x31bb('0x49')]['id'],_0x695b5d['data1'],_0x695b5d[_0x31bb('0x89')],_0x10e7c2['transcribeRegion'],_0x10e7c2[_0x31bb('0x75')],_0x521c52[_0x31bb('0x55')],_0x10e7c2['language']);}else{logger[_0x31bb('0x67')](util[_0x31bb('0x35')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x44887e[_0x31bb('0x49')]['id']));return{'transcribeStatus':_0x31bb('0x92')};}})[_0x31bb('0x43')](function(_0x338cd7){if(_0x338cd7){_0x338cd7['tempSentiment']=_0x44887e[_0x31bb('0x4f')][_0x31bb('0x93')];return _0x521c52['updateAttributes'](_0x338cd7);}})[_0x31bb('0x43')](respondWithResult(_0xbc7a5a,null))[_0x31bb('0x47')](handleError(_0xbc7a5a,null));};function writeFile(_0x5a32da,_0x8c5bc){return new Promise(function(_0x12a1df,_0x48aa61){fs[_0x31bb('0x94')](_0x8c5bc,_0x5a32da,function(_0x521989,_0x5b053b){if(_0x521989){return _0x48aa61(_0x521989);}else{return _0x12a1df(_0x5b053b);}});});}exports[_0x31bb('0x95')]=function(_0x17f125,_0x35c012,_0x39df64){return db[_0x31bb('0x2d')][_0x31bb('0x7d')]({'where':{'id':_0x17f125[_0x31bb('0x49')]['id']}})[_0x31bb('0x43')](handleEntityNotFound(_0x35c012))['then'](function(_0x246318){if(_0x246318&&_0x246318[_0x31bb('0x96')]){var _0x599dda=_0x246318['fileText'];var _0xa5c2c2=config[_0x31bb('0x97')]+_0x31bb('0x98')+_0x246318['id']+_0x31bb('0x99');if(fs[_0x31bb('0x64')](_0xa5c2c2)){return _0xa5c2c2;}return writeFile(_0x599dda,_0xa5c2c2)[_0x31bb('0x43')](function(){return _0xa5c2c2;});}else{throw new db[(_0x31bb('0x58'))][(_0x31bb('0x59'))](_0x31bb('0x9a'));}})[_0x31bb('0x43')](function(_0x433022){return _0x35c012[_0x31bb('0x52')](_0x433022);})[_0x31bb('0x47')](handleError(_0x35c012));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 6bb83c3..8e67709 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 _0x8d9b=['./voiceRecording.attributes','exports','define','uniqueid','transcribeStatus'];(function(_0x22e529,_0x380432){var _0x1f13f9=function(_0x1b58c7){while(--_0x1b58c7){_0x22e529['push'](_0x22e529['shift']());}};_0x1f13f9(++_0x380432);}(_0x8d9b,0x104));var _0xb8d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8d9b[_0x3dd15e];return _0x231fd0;};'use strict';var attributes=require(_0xb8d9('0x0'));module[_0xb8d9('0x1')]=function(_0x2a3616,_0x8360b6){return _0x2a3616[_0xb8d9('0x2')]('VoiceRecording',attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0xb8d9('0x3'),'fields':['uniqueid']},{'name':_0xb8d9('0x4'),'fields':[_0xb8d9('0x4')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9b9b=['exports','define','VoiceRecording','voice_recordings','uniqueid','transcribeStatus'];(function(_0x1ca5ea,_0x3f0586){var _0xef620e=function(_0x2b3afe){while(--_0x2b3afe){_0x1ca5ea['push'](_0x1ca5ea['shift']());}};_0xef620e(++_0x3f0586);}(_0x9b9b,0x114));var _0xb9b9=function(_0x44b5d9,_0xe28bb1){_0x44b5d9=_0x44b5d9-0x0;var _0x25d599=_0x9b9b[_0x44b5d9];return _0x25d599;};'use strict';var attributes=require('./voiceRecording.attributes');module[_0xb9b9('0x0')]=function(_0x4980d7,_0x5010f5){return _0x4980d7[_0xb9b9('0x1')](_0xb9b9('0x2'),attributes,{'tableName':_0xb9b9('0x3'),'paranoid':![],'indexes':[{'name':_0xb9b9('0x4'),'fields':[_0xb9b9('0x4')]},{'name':_0xb9b9('0x5'),'fields':[_0xb9b9('0x5')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 4dd773c..7c002cb 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 _0x2272=['client','http','request','then','info','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceRecording,\x20%s,\x20%s','message','result','catch','UpdateVoiceRecording','VoiceRecording','update','body','options','raw','where','attributes','limit','CreateVoiceRecording','Setting','findOne','callRecordingEncryption','format','%s.cypher','encryptFile','secrets','recording','unlink','value','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise'];(function(_0x999b85,_0x1edc2b){var _0x1d7124=function(_0x59cd29){while(--_0x59cd29){_0x999b85['push'](_0x999b85['shift']());}};_0x1d7124(++_0x1edc2b);}(_0x2272,0xd8));var _0x2227=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x2272[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x2227('0x0'));var util=require(_0x2227('0x1'));var moment=require(_0x2227('0x2'));var BPromise=require(_0x2227('0x3'));var rs=require(_0x2227('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2227('0x5'))['db'];var utils=require(_0x2227('0x6'));var logger=require(_0x2227('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2227('0x8'));var client=jayson[_0x2227('0x9')][_0x2227('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2591db,_0xaec623,_0x1413d2){return new BPromise(function(_0x41fc3f,_0x34bdd0){return client[_0x2227('0xb')](_0x2591db,_0x1413d2)[_0x2227('0xc')](function(_0x496bbd){logger[_0x2227('0xd')]('VoiceRecording,\x20%s,\x20%s',_0xaec623,_0x2227('0xe'));logger[_0x2227('0xf')](_0x2227('0x10'),_0xaec623,_0x2227('0xe'),JSON[_0x2227('0x11')](_0x496bbd));if(_0x496bbd['error']){if(_0x496bbd[_0x2227('0x12')][_0x2227('0x13')]===0x1f4){logger[_0x2227('0x12')](_0x2227('0x14'),_0xaec623,_0x496bbd[_0x2227('0x12')][_0x2227('0x15')]);return _0x34bdd0(_0x496bbd['error']['message']);}logger['error'](_0x2227('0x14'),_0xaec623,_0x496bbd['error'][_0x2227('0x15')]);return _0x41fc3f(_0x496bbd[_0x2227('0x12')]['message']);}else{logger[_0x2227('0xd')](_0x2227('0x14'),_0xaec623,_0x2227('0xe'));_0x41fc3f(_0x496bbd[_0x2227('0x16')][_0x2227('0x15')]);}})[_0x2227('0x17')](function(_0x508e92){logger[_0x2227('0x12')](_0x2227('0x14'),_0xaec623,_0x508e92);_0x34bdd0(_0x508e92);});});}exports[_0x2227('0x18')]=function(_0x531f75){var _0x11bf80=this;return new Promise(function(_0x620012,_0x65e3b6){return db[_0x2227('0x19')][_0x2227('0x1a')](_0x531f75[_0x2227('0x1b')],{'raw':_0x531f75[_0x2227('0x1c')]?_0x531f75['options'][_0x2227('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x531f75['options']?_0x531f75[_0x2227('0x1c')][_0x2227('0x1e')]||null:null,'attributes':_0x531f75[_0x2227('0x1c')]?_0x531f75[_0x2227('0x1c')][_0x2227('0x1f')]||null:null,'limit':_0x531f75[_0x2227('0x1c')]?_0x531f75[_0x2227('0x1c')][_0x2227('0x20')]||null:null})[_0x2227('0xc')](function(_0x34c090){logger[_0x2227('0xd')]('UpdateVoiceRecording',_0x531f75);logger[_0x2227('0xf')](_0x2227('0x18'),_0x531f75,JSON['stringify'](_0x34c090));_0x620012(_0x34c090);})[_0x2227('0x17')](function(_0xbfdce1){logger['error']('UpdateVoiceRecording',_0xbfdce1[_0x2227('0x15')],_0x531f75);_0x65e3b6(_0x11bf80[_0x2227('0x12')](0x1f4,_0xbfdce1[_0x2227('0x15')]));});});};exports[_0x2227('0x21')]=function(_0x5be889){var _0x191a3e=this;return new Promise(function(_0x301304,_0x2d8ea0){var _0x1957ee=require('../../components/encryptor');var _0x204def;return db[_0x2227('0x22')][_0x2227('0x23')]({'attributes':['id',_0x2227('0x24')],'where':{'id':0x1},'raw':!![]})[_0x2227('0xc')](function(_0x4789eb){_0x204def=_0x4789eb;return db['VoiceRecording']['create'](_0x5be889[_0x2227('0x1b')]);})['then'](function(_0x2ba581){if(_0x204def[_0x2227('0x24')]&&fs['existsSync'](_0x2ba581['value'])){var _0x1f1ba7=util[_0x2227('0x25')](_0x2227('0x26'),_0x2ba581['value']);return _0x1957ee[_0x2227('0x27')](_0x2ba581['value'],_0x1f1ba7,config[_0x2227('0x28')][_0x2227('0x29')])[_0x2227('0xc')](function(){fs[_0x2227('0x2a')](_0x2ba581[_0x2227('0x2b')]);logger[_0x2227('0xd')](_0x2227('0x2c'));return _0x2ba581;});}return _0x2ba581;})[_0x2227('0xc')](function(_0xd38f59){logger[_0x2227('0xd')](_0x2227('0x21'),_0x5be889);logger['debug'](_0x2227('0x21'),_0x5be889,JSON[_0x2227('0x11')](_0xd38f59));_0x301304(_0xd38f59);})[_0x2227('0x17')](function(_0x6cd5d7){logger['error'](_0x2227('0x21'),_0x6cd5d7[_0x2227('0x15')],_0x5be889);_0x2d8ea0(_0x191a3e[_0x2227('0x12')](0x1f4,_0x6cd5d7[_0x2227('0x15')]));});});}; \ No newline at end of file +var _0xcaf2=['CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','existsSync','value','format','encryptFile','secrets','recording','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','error','code','message','result','VoiceRecording','body','options','raw','where','attributes','limit','UpdateVoiceRecording','stringify','catch'];(function(_0x51a10b,_0x48dfd2){var _0x5a4349=function(_0x4038e5){while(--_0x4038e5){_0x51a10b['push'](_0x51a10b['shift']());}};_0x5a4349(++_0x48dfd2);}(_0xcaf2,0x8a));var _0x2caf=function(_0x4b366e,_0x479e1f){_0x4b366e=_0x4b366e-0x0;var _0x464dff=_0xcaf2[_0x4b366e];return _0x464dff;};'use strict';var _=require(_0x2caf('0x0'));var util=require('util');var moment=require(_0x2caf('0x1'));var BPromise=require(_0x2caf('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2caf('0x3'));var db=require(_0x2caf('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2caf('0x5'))('rpc');var config=require(_0x2caf('0x6'));var jayson=require(_0x2caf('0x7'));var client=jayson[_0x2caf('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc44e4e,_0x314486,_0x4667c6){return new BPromise(function(_0x34e792,_0x5611aa){return client[_0x2caf('0x9')](_0xc44e4e,_0x4667c6)[_0x2caf('0xa')](function(_0x45e520){logger[_0x2caf('0xb')](_0x2caf('0xc'),_0x314486,_0x2caf('0xd'));logger[_0x2caf('0xe')](_0x2caf('0xf'),_0x314486,_0x2caf('0xd'),JSON['stringify'](_0x45e520));if(_0x45e520[_0x2caf('0x10')]){if(_0x45e520[_0x2caf('0x10')][_0x2caf('0x11')]===0x1f4){logger[_0x2caf('0x10')](_0x2caf('0xc'),_0x314486,_0x45e520[_0x2caf('0x10')][_0x2caf('0x12')]);return _0x5611aa(_0x45e520[_0x2caf('0x10')]['message']);}logger[_0x2caf('0x10')](_0x2caf('0xc'),_0x314486,_0x45e520['error']['message']);return _0x34e792(_0x45e520['error'][_0x2caf('0x12')]);}else{logger['info'](_0x2caf('0xc'),_0x314486,_0x2caf('0xd'));_0x34e792(_0x45e520[_0x2caf('0x13')][_0x2caf('0x12')]);}})['catch'](function(_0x184355){logger['error'](_0x2caf('0xc'),_0x314486,_0x184355);_0x5611aa(_0x184355);});});}exports['UpdateVoiceRecording']=function(_0x4a33fc){var _0x3e975f=this;return new Promise(function(_0x58047b,_0xe72440){return db[_0x2caf('0x14')]['update'](_0x4a33fc[_0x2caf('0x15')],{'raw':_0x4a33fc[_0x2caf('0x16')]?_0x4a33fc[_0x2caf('0x16')][_0x2caf('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a33fc[_0x2caf('0x16')]?_0x4a33fc['options'][_0x2caf('0x18')]||null:null,'attributes':_0x4a33fc[_0x2caf('0x16')]?_0x4a33fc[_0x2caf('0x16')][_0x2caf('0x19')]||null:null,'limit':_0x4a33fc[_0x2caf('0x16')]?_0x4a33fc[_0x2caf('0x16')][_0x2caf('0x1a')]||null:null})[_0x2caf('0xa')](function(_0x3332b1){logger[_0x2caf('0xb')](_0x2caf('0x1b'),_0x4a33fc);logger['debug'](_0x2caf('0x1b'),_0x4a33fc,JSON[_0x2caf('0x1c')](_0x3332b1));_0x58047b(_0x3332b1);})[_0x2caf('0x1d')](function(_0x401ea2){logger[_0x2caf('0x10')](_0x2caf('0x1b'),_0x401ea2[_0x2caf('0x12')],_0x4a33fc);_0xe72440(_0x3e975f[_0x2caf('0x10')](0x1f4,_0x401ea2[_0x2caf('0x12')]));});});};exports[_0x2caf('0x1e')]=function(_0x5ad211){var _0x6a32ac=this;return new Promise(function(_0x325eda,_0xbefce6){var _0x37b08f=require(_0x2caf('0x1f'));var _0x17d3c6;return db[_0x2caf('0x20')][_0x2caf('0x21')]({'attributes':['id',_0x2caf('0x22')],'where':{'id':0x1},'raw':!![]})[_0x2caf('0xa')](function(_0x30da75){_0x17d3c6=_0x30da75;return db[_0x2caf('0x14')][_0x2caf('0x23')](_0x5ad211['body']);})[_0x2caf('0xa')](function(_0xda0ec5){if(_0x17d3c6[_0x2caf('0x22')]&&fs[_0x2caf('0x24')](_0xda0ec5[_0x2caf('0x25')])){var _0x1f52bf=util[_0x2caf('0x26')]('%s.cypher',_0xda0ec5[_0x2caf('0x25')]);return _0x37b08f[_0x2caf('0x27')](_0xda0ec5['value'],_0x1f52bf,config[_0x2caf('0x28')][_0x2caf('0x29')])[_0x2caf('0xa')](function(){fs['unlink'](_0xda0ec5[_0x2caf('0x25')]);logger['info']('CreateVoiceRecording\x20file\x20encrypted');return _0xda0ec5;});}return _0xda0ec5;})[_0x2caf('0xa')](function(_0x28b715){logger[_0x2caf('0xb')](_0x2caf('0x1e'),_0x5ad211);logger[_0x2caf('0xe')](_0x2caf('0x1e'),_0x5ad211,JSON[_0x2caf('0x1c')](_0x28b715));_0x325eda(_0x28b715);})[_0x2caf('0x1d')](function(_0x20818e){logger['error'](_0x2caf('0x1e'),_0x20818e[_0x2caf('0x12')],_0x5ad211);_0xbefce6(_0x6a32ac[_0x2caf('0x10')](0x1f4,_0x20818e[_0x2caf('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 010f9e2..58eb9f6 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 _0x3898=['connect-timeout','express','Router','fs-extra','./voiceTransferReport.controller','get','describe','/:id','isAuthenticated','show','post','put','update','delete','destroy','exports','multer','util'];(function(_0xd2943,_0x202719){var _0x42abb0=function(_0x2e5e06){while(--_0x2e5e06){_0xd2943['push'](_0xd2943['shift']());}};_0x42abb0(++_0x202719);}(_0x3898,0xb2));var _0x8389=function(_0x593d6c,_0x58b198){_0x593d6c=_0x593d6c-0x0;var _0x2ed34e=_0x3898[_0x593d6c];return _0x2ed34e;};'use strict';var multer=require(_0x8389('0x0'));var util=require(_0x8389('0x1'));var path=require('path');var timeout=require(_0x8389('0x2'));var express=require(_0x8389('0x3'));var router=express[_0x8389('0x4')]();var fs_extra=require(_0x8389('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8389('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x8389('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x8389('0x8')]);router[_0x8389('0x7')](_0x8389('0x9'),auth[_0x8389('0xa')](),controller[_0x8389('0xb')]);router[_0x8389('0xc')]('/',auth[_0x8389('0xa')](),controller['create']);router[_0x8389('0xd')]('/:id',auth[_0x8389('0xa')](),controller[_0x8389('0xe')]);router[_0x8389('0xf')](_0x8389('0x9'),auth[_0x8389('0xa')](),controller[_0x8389('0x10')]);module[_0x8389('0x11')]=router; \ No newline at end of file +var _0x3ee9=['index','/describe','describe','get','/:id','show','post','put','update','delete','destroy','exports','path','express','Router','fs-extra','isAuthenticated'];(function(_0x413aac,_0x5e2430){var _0x569b11=function(_0x52e060){while(--_0x52e060){_0x413aac['push'](_0x413aac['shift']());}};_0x569b11(++_0x5e2430);}(_0x3ee9,0xfa));var _0x93ee=function(_0x48845d,_0x4338c2){_0x48845d=_0x48845d-0x0;var _0x5bad7d=_0x3ee9[_0x48845d];return _0x5bad7d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x93ee('0x0'));var timeout=require('connect-timeout');var express=require(_0x93ee('0x1'));var router=express[_0x93ee('0x2')]();var fs_extra=require(_0x93ee('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceTransferReport.controller');router['get']('/',auth[_0x93ee('0x4')](),controller[_0x93ee('0x5')]);router['get'](_0x93ee('0x6'),auth['isAuthenticated'](),controller[_0x93ee('0x7')]);router[_0x93ee('0x8')](_0x93ee('0x9'),auth[_0x93ee('0x4')](),controller[_0x93ee('0xa')]);router[_0x93ee('0xb')]('/',auth[_0x93ee('0x4')](),controller['create']);router[_0x93ee('0xc')](_0x93ee('0x9'),auth[_0x93ee('0x4')](),controller[_0x93ee('0xd')]);router[_0x93ee('0xe')](_0x93ee('0x9'),auth['isAuthenticated'](),controller[_0x93ee('0xf')]);module[_0x93ee('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index f284b28..b293d8d 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 _0x5c61=['STRING','sequelize','exports','ENUM','blind','attended'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x5c61,0x163));var _0x15c6=function(_0x488520,_0x3f197f){_0x488520=_0x488520-0x0;var _0x4330a9=_0x5c61[_0x488520];return _0x4330a9;};'use strict';var Sequelize=require(_0x15c6('0x0'));var moment=require('moment');module[_0x15c6('0x1')]={'type':{'type':Sequelize[_0x15c6('0x2')](_0x15c6('0x3'),_0x15c6('0x4'))},'result':{'type':Sequelize[_0x15c6('0x5')]},'transfererchannel':{'type':Sequelize[_0x15c6('0x5')]},'transferercalleridnum':{'type':Sequelize[_0x15c6('0x5')]},'transferercalleridname':{'type':Sequelize[_0x15c6('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0x15c6('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0x15c6('0x5')]},'transfereraccountcode':{'type':Sequelize[_0x15c6('0x5')]},'transferercontext':{'type':Sequelize[_0x15c6('0x5')]},'transfererexten':{'type':Sequelize[_0x15c6('0x5')]},'transfererlinkedid':{'type':Sequelize[_0x15c6('0x5')]},'transfereechannel':{'type':Sequelize[_0x15c6('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0x15c6('0x5')]},'transfereecalleridname':{'type':Sequelize[_0x15c6('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x15c6('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0x15c6('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0x15c6('0x5')]},'transfereecontext':{'type':Sequelize[_0x15c6('0x5')]},'transfereeexten':{'type':Sequelize[_0x15c6('0x5')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0x15c6('0x2')]('Yes','No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x15c6('0x5')]}}; \ No newline at end of file +var _0x9bb4=['ENUM','blind','attended','STRING','Yes','sequelize','moment','exports'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x9bb4,0xd5));var _0x49bb=function(_0x51885c,_0x1c9186){_0x51885c=_0x51885c-0x0;var _0x101cab=_0x9bb4[_0x51885c];return _0x101cab;};'use strict';var Sequelize=require(_0x49bb('0x0'));var moment=require(_0x49bb('0x1'));module[_0x49bb('0x2')]={'type':{'type':Sequelize[_0x49bb('0x3')](_0x49bb('0x4'),_0x49bb('0x5'))},'result':{'type':Sequelize[_0x49bb('0x6')]},'transfererchannel':{'type':Sequelize[_0x49bb('0x6')]},'transferercalleridnum':{'type':Sequelize[_0x49bb('0x6')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0x49bb('0x6')]},'transfererconnectedlinename':{'type':Sequelize[_0x49bb('0x6')]},'transfereraccountcode':{'type':Sequelize[_0x49bb('0x6')]},'transferercontext':{'type':Sequelize[_0x49bb('0x6')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0x49bb('0x6')]},'transfereechannel':{'type':Sequelize[_0x49bb('0x6')]},'transfereecalleridnum':{'type':Sequelize[_0x49bb('0x6')]},'transfereecalleridname':{'type':Sequelize[_0x49bb('0x6')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x49bb('0x6')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0x49bb('0x6')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0x49bb('0x6')]},'transfereelinkedid':{'type':Sequelize[_0x49bb('0x6')]},'isexternal':{'type':Sequelize['ENUM'](_0x49bb('0x7'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index b144890..13de152 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 _0x7bf2=['error','stack','name','send','index','map','VoiceTransferReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','params','rawAttributes','find','create','catch','update','body','describe','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','count','offset','limit','apply','reject','save','then','destroy','end'];(function(_0x292c51,_0x1532a2){var _0xf7c1a5=function(_0x493864){while(--_0x493864){_0x292c51['push'](_0x292c51['shift']());}};_0xf7c1a5(++_0x1532a2);}(_0x7bf2,0x103));var _0x27bf=function(_0x3aa529,_0x32e3f3){_0x3aa529=_0x3aa529-0x0;var _0x5069c5=_0x7bf2[_0x3aa529];return _0x5069c5;};'use strict';var emlformat=require(_0x27bf('0x0'));var rimraf=require(_0x27bf('0x1'));var zipdir=require(_0x27bf('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x27bf('0x3'));var Mustache=require(_0x27bf('0x4'));var util=require(_0x27bf('0x5'));var path=require(_0x27bf('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x27bf('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x27bf('0x8'));var squel=require('squel');var crypto=require(_0x27bf('0x9'));var jsforce=require(_0x27bf('0xa'));var deskjs=require(_0x27bf('0xb'));var toCsv=require(_0x27bf('0xc'));var querystring=require(_0x27bf('0xd'));var Papa=require(_0x27bf('0xe'));var Redis=require(_0x27bf('0xf'));var authService=require(_0x27bf('0x10'));var qs=require(_0x27bf('0x11'));var as=require(_0x27bf('0x12'));var hardwareService=require(_0x27bf('0x13'));var logger=require('../../config/logger')(_0x27bf('0x14'));var utils=require(_0x27bf('0x15'));var config=require(_0x27bf('0x16'));var licenseUtil=require(_0x27bf('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ee5e5,_0xe49474){_0xe49474=_0xe49474||0xcc;return function(_0x37fb4a){if(_0x37fb4a){return _0x1ee5e5[_0x27bf('0x18')](_0xe49474);}return _0x1ee5e5[_0x27bf('0x19')](_0xe49474)['end']();};}function respondWithResult(_0x132385,_0x4c2a5d){_0x4c2a5d=_0x4c2a5d||0xc8;return function(_0x16b881){if(_0x16b881){return _0x132385['status'](_0x4c2a5d)[_0x27bf('0x1a')](_0x16b881);}};}function respondWithFilteredResult(_0x341f54,_0x516591){return function(_0xd196dd){if(_0xd196dd){var _0x4a16d1=typeof _0x516591['offset']==='undefined'&&typeof _0x516591['limit']===_0x27bf('0x1b');var _0x35a70d=_0xd196dd[_0x27bf('0x1c')];var _0x8d4d5a=_0x4a16d1?0x0:_0x516591[_0x27bf('0x1d')];var _0x190d6a=_0x4a16d1?_0xd196dd['count']:_0x516591[_0x27bf('0x1d')]+_0x516591[_0x27bf('0x1e')];var _0x2d3ed5;if(_0x190d6a>=_0x35a70d){_0x190d6a=_0x35a70d;_0x2d3ed5=0xc8;}else{_0x2d3ed5=0xce;}_0x341f54[_0x27bf('0x19')](_0x2d3ed5);return _0x341f54['set']('Content-Range',_0x8d4d5a+'-'+_0x190d6a+'/'+_0x35a70d)[_0x27bf('0x1a')](_0xd196dd);}return null;};}function patchUpdates(_0x342a7e){return function(_0x544973){try{jsonpatch[_0x27bf('0x1f')](_0x544973,_0x342a7e,!![]);}catch(_0x24708e){return BPromise[_0x27bf('0x20')](_0x24708e);}return _0x544973[_0x27bf('0x21')]();};}function saveUpdates(_0x3cdc2c,_0xfbfe02){return function(_0x8f7f9){if(_0x8f7f9){return _0x8f7f9['update'](_0x3cdc2c)[_0x27bf('0x22')](function(_0x385461){return _0x385461;});}return null;};}function removeEntity(_0x3a2b9,_0x14c65e){return function(_0x50b595){if(_0x50b595){return _0x50b595[_0x27bf('0x23')]()[_0x27bf('0x22')](function(){_0x3a2b9[_0x27bf('0x19')](0xcc)[_0x27bf('0x24')]();});}};}function handleEntityNotFound(_0x44c0cd,_0x5b5ecf){return function(_0x1b0f9a){if(!_0x1b0f9a){_0x44c0cd[_0x27bf('0x18')](0x194);}return _0x1b0f9a;};}function handleError(_0x2ead67,_0xbeb21c){_0xbeb21c=_0xbeb21c||0x1f4;return function(_0x2d3477){logger[_0x27bf('0x25')](_0x2d3477[_0x27bf('0x26')]);if(_0x2d3477['name']){delete _0x2d3477[_0x27bf('0x27')];}_0x2ead67[_0x27bf('0x19')](_0xbeb21c)[_0x27bf('0x28')](_0x2d3477);};}exports[_0x27bf('0x29')]=function(_0x2c138a,_0x47573c){var _0x4d0ae2={},_0x3e5a2c={},_0xfd251e={'count':0x0,'rows':[]};var _0x23e3de=_[_0x27bf('0x2a')](db[_0x27bf('0x2b')]['rawAttributes'],function(_0x5a93a8){return{'name':_0x5a93a8[_0x27bf('0x2c')],'type':_0x5a93a8[_0x27bf('0x2d')][_0x27bf('0x2e')]};});_0x3e5a2c[_0x27bf('0x2f')]=_[_0x27bf('0x2a')](_0x23e3de,'name');_0x3e5a2c[_0x27bf('0x30')]=_[_0x27bf('0x31')](_0x2c138a[_0x27bf('0x30')]);_0x3e5a2c['filters']=_[_0x27bf('0x32')](_0x3e5a2c[_0x27bf('0x2f')],_0x3e5a2c[_0x27bf('0x30')]);_0x4d0ae2[_0x27bf('0x33')]=_[_0x27bf('0x32')](_0x3e5a2c[_0x27bf('0x2f')],qs[_0x27bf('0x34')](_0x2c138a['query']['fields']));_0x4d0ae2[_0x27bf('0x33')]=_0x4d0ae2[_0x27bf('0x33')][_0x27bf('0x35')]?_0x4d0ae2['attributes']:_0x3e5a2c[_0x27bf('0x2f')];if(!_0x2c138a[_0x27bf('0x30')][_0x27bf('0x36')](_0x27bf('0x37'))){_0x4d0ae2[_0x27bf('0x1e')]=qs[_0x27bf('0x1e')](_0x2c138a[_0x27bf('0x30')][_0x27bf('0x1e')]);_0x4d0ae2[_0x27bf('0x1d')]=qs[_0x27bf('0x1d')](_0x2c138a[_0x27bf('0x30')][_0x27bf('0x1d')]);}_0x4d0ae2['order']=qs[_0x27bf('0x38')](_0x2c138a[_0x27bf('0x30')][_0x27bf('0x38')]);_0x4d0ae2[_0x27bf('0x39')]=qs[_0x27bf('0x3a')](_[_0x27bf('0x3b')](_0x2c138a[_0x27bf('0x30')],_0x3e5a2c[_0x27bf('0x3a')]),_0x23e3de);if(_0x2c138a[_0x27bf('0x30')][_0x27bf('0x3c')]){_0x4d0ae2[_0x27bf('0x39')]=_[_0x27bf('0x3d')](_0x4d0ae2[_0x27bf('0x39')],{'$or':_[_0x27bf('0x2a')](_0x23e3de,function(_0x297073){if(_0x297073['type']!==_0x27bf('0x3e')){var _0x1835cc={};_0x1835cc[_0x297073['name']]={'$like':'%'+_0x2c138a[_0x27bf('0x30')][_0x27bf('0x3c')]+'%'};return _0x1835cc;}})});}_0x4d0ae2=_[_0x27bf('0x3d')]({},_0x4d0ae2,_0x2c138a[_0x27bf('0x3f')]);var _0x1eebe4={'where':_0x4d0ae2[_0x27bf('0x39')]};return db[_0x27bf('0x2b')]['count'](_0x1eebe4)['then'](function(_0x39a819){_0xfd251e[_0x27bf('0x1c')]=_0x39a819;if(_0x2c138a[_0x27bf('0x30')][_0x27bf('0x40')]){_0x4d0ae2['include']=[{'all':!![]}];}return db[_0x27bf('0x2b')][_0x27bf('0x41')](_0x4d0ae2);})[_0x27bf('0x22')](function(_0x4d2ba2){_0xfd251e['rows']=_0x4d2ba2;return _0xfd251e;})[_0x27bf('0x22')](respondWithFilteredResult(_0x47573c,_0x4d0ae2))['catch'](handleError(_0x47573c,null));};exports['show']=function(_0x173e73,_0x53a9f8){var _0x44a50f={'raw':!![],'where':{'id':_0x173e73[_0x27bf('0x42')]['id']}},_0x509e91={};_0x509e91[_0x27bf('0x2f')]=_['keys'](db['VoiceTransferReport'][_0x27bf('0x43')]);_0x509e91['query']=_[_0x27bf('0x31')](_0x173e73[_0x27bf('0x30')]);_0x509e91[_0x27bf('0x3a')]=_['intersection'](_0x509e91[_0x27bf('0x2f')],_0x509e91[_0x27bf('0x30')]);_0x44a50f[_0x27bf('0x33')]=_[_0x27bf('0x32')](_0x509e91['model'],qs[_0x27bf('0x34')](_0x173e73[_0x27bf('0x30')][_0x27bf('0x34')]));_0x44a50f[_0x27bf('0x33')]=_0x44a50f[_0x27bf('0x33')][_0x27bf('0x35')]?_0x44a50f[_0x27bf('0x33')]:_0x509e91[_0x27bf('0x2f')];if(_0x173e73[_0x27bf('0x30')][_0x27bf('0x40')]){_0x44a50f['include']=[{'all':!![]}];}_0x44a50f=_[_0x27bf('0x3d')]({},_0x44a50f,_0x173e73['options']);return db['VoiceTransferReport'][_0x27bf('0x44')](_0x44a50f)[_0x27bf('0x22')](handleEntityNotFound(_0x53a9f8,null))['then'](respondWithResult(_0x53a9f8,null))['catch'](handleError(_0x53a9f8,null));};exports[_0x27bf('0x45')]=function(_0x5989b4,_0x5d718b){return db[_0x27bf('0x2b')][_0x27bf('0x45')](_0x5989b4['body'],{})[_0x27bf('0x22')](respondWithResult(_0x5d718b,0xc9))[_0x27bf('0x46')](handleError(_0x5d718b,null));};exports[_0x27bf('0x47')]=function(_0x463a94,_0x1cf3af){if(_0x463a94[_0x27bf('0x48')]['id']){delete _0x463a94['body']['id'];}return db[_0x27bf('0x2b')][_0x27bf('0x44')]({'where':{'id':_0x463a94['params']['id']}})[_0x27bf('0x22')](handleEntityNotFound(_0x1cf3af,null))[_0x27bf('0x22')](saveUpdates(_0x463a94['body'],null))[_0x27bf('0x22')](respondWithResult(_0x1cf3af,null))[_0x27bf('0x46')](handleError(_0x1cf3af,null));};exports[_0x27bf('0x23')]=function(_0x1aaf6c,_0x4199db){return db['VoiceTransferReport'][_0x27bf('0x44')]({'where':{'id':_0x1aaf6c[_0x27bf('0x42')]['id']}})[_0x27bf('0x22')](handleEntityNotFound(_0x4199db,null))[_0x27bf('0x22')](removeEntity(_0x4199db,null))[_0x27bf('0x46')](handleError(_0x4199db,null));};exports[_0x27bf('0x49')]=function(_0x47d52d,_0x266ab0){return db['VoiceTransferReport'][_0x27bf('0x49')]()['then'](respondWithResult(_0x266ab0,null))['catch'](handleError(_0x266ab0,null));}; \ No newline at end of file +var _0xb8d4=['lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','sendStatus','error','name','send','index','VoiceTransferReport','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x380498,_0x51b6ae){var _0x2e0dfe=function(_0x172e97){while(--_0x172e97){_0x380498['push'](_0x380498['shift']());}};_0x2e0dfe(++_0x51b6ae);}(_0xb8d4,0x1b4));var _0x4b8d=function(_0x342700,_0x569f75){_0x342700=_0x342700-0x0;var _0x53406f=_0xb8d4[_0x342700];return _0x53406f;};'use strict';var emlformat=require(_0x4b8d('0x0'));var rimraf=require(_0x4b8d('0x1'));var zipdir=require(_0x4b8d('0x2'));var jsonpatch=require(_0x4b8d('0x3'));var rp=require(_0x4b8d('0x4'));var moment=require(_0x4b8d('0x5'));var BPromise=require(_0x4b8d('0x6'));var Mustache=require(_0x4b8d('0x7'));var util=require(_0x4b8d('0x8'));var path=require(_0x4b8d('0x9'));var sox=require(_0x4b8d('0xa'));var csv=require(_0x4b8d('0xb'));var ejs=require(_0x4b8d('0xc'));var fs=require('fs');var fs_extra=require(_0x4b8d('0xd'));var _=require(_0x4b8d('0xe'));var squel=require(_0x4b8d('0xf'));var crypto=require(_0x4b8d('0x10'));var jsforce=require(_0x4b8d('0x11'));var deskjs=require(_0x4b8d('0x12'));var toCsv=require(_0x4b8d('0xb'));var querystring=require(_0x4b8d('0x13'));var Papa=require('papaparse');var Redis=require(_0x4b8d('0x14'));var authService=require(_0x4b8d('0x15'));var qs=require(_0x4b8d('0x16'));var as=require(_0x4b8d('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4b8d('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4b8d('0x19'))['db'];function respondWithStatusCode(_0x41cafd,_0x1c19c3){_0x1c19c3=_0x1c19c3||0xcc;return function(_0x38cc09){if(_0x38cc09){return _0x41cafd['sendStatus'](_0x1c19c3);}return _0x41cafd[_0x4b8d('0x1a')](_0x1c19c3)[_0x4b8d('0x1b')]();};}function respondWithResult(_0x2eb2da,_0xd5a8b1){_0xd5a8b1=_0xd5a8b1||0xc8;return function(_0x58b0ee){if(_0x58b0ee){return _0x2eb2da[_0x4b8d('0x1a')](_0xd5a8b1)[_0x4b8d('0x1c')](_0x58b0ee);}};}function respondWithFilteredResult(_0x47f561,_0x13ca52){return function(_0x380298){if(_0x380298){var _0x393b20=typeof _0x13ca52[_0x4b8d('0x1d')]===_0x4b8d('0x1e')&&typeof _0x13ca52[_0x4b8d('0x1f')]===_0x4b8d('0x1e');var _0x2fd14e=_0x380298[_0x4b8d('0x20')];var _0x3becea=_0x393b20?0x0:_0x13ca52[_0x4b8d('0x1d')];var _0x2271c3=_0x393b20?_0x380298[_0x4b8d('0x20')]:_0x13ca52[_0x4b8d('0x1d')]+_0x13ca52[_0x4b8d('0x1f')];var _0x22b593;if(_0x2271c3>=_0x2fd14e){_0x2271c3=_0x2fd14e;_0x22b593=0xc8;}else{_0x22b593=0xce;}_0x47f561[_0x4b8d('0x1a')](_0x22b593);return _0x47f561[_0x4b8d('0x21')]('Content-Range',_0x3becea+'-'+_0x2271c3+'/'+_0x2fd14e)[_0x4b8d('0x1c')](_0x380298);}return null;};}function patchUpdates(_0x791181){return function(_0x18261b){try{jsonpatch[_0x4b8d('0x22')](_0x18261b,_0x791181,!![]);}catch(_0x552060){return BPromise['reject'](_0x552060);}return _0x18261b[_0x4b8d('0x23')]();};}function saveUpdates(_0x3799b9,_0x7911db){return function(_0x3f3676){if(_0x3f3676){return _0x3f3676[_0x4b8d('0x24')](_0x3799b9)[_0x4b8d('0x25')](function(_0x53896a){return _0x53896a;});}return null;};}function removeEntity(_0x2f68fc,_0x5df5c2){return function(_0x2f3a80){if(_0x2f3a80){return _0x2f3a80[_0x4b8d('0x26')]()[_0x4b8d('0x25')](function(){_0x2f68fc[_0x4b8d('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5add57,_0x4094ac){return function(_0x17f8d3){if(!_0x17f8d3){_0x5add57[_0x4b8d('0x27')](0x194);}return _0x17f8d3;};}function handleError(_0x47bc00,_0x2dd675){_0x2dd675=_0x2dd675||0x1f4;return function(_0x49db0d){logger[_0x4b8d('0x28')](_0x49db0d['stack']);if(_0x49db0d[_0x4b8d('0x29')]){delete _0x49db0d[_0x4b8d('0x29')];}_0x47bc00[_0x4b8d('0x1a')](_0x2dd675)[_0x4b8d('0x2a')](_0x49db0d);};}exports[_0x4b8d('0x2b')]=function(_0xc4576e,_0x4fbd54){var _0x59a27d={},_0x300267={},_0x2007b7={'count':0x0,'rows':[]};var _0x1e018e=_['map'](db[_0x4b8d('0x2c')][_0x4b8d('0x2d')],function(_0x2579bc){return{'name':_0x2579bc[_0x4b8d('0x2e')],'type':_0x2579bc[_0x4b8d('0x2f')]['key']};});_0x300267[_0x4b8d('0x30')]=_[_0x4b8d('0x31')](_0x1e018e,_0x4b8d('0x29'));_0x300267[_0x4b8d('0x32')]=_[_0x4b8d('0x33')](_0xc4576e[_0x4b8d('0x32')]);_0x300267[_0x4b8d('0x34')]=_[_0x4b8d('0x35')](_0x300267[_0x4b8d('0x30')],_0x300267[_0x4b8d('0x32')]);_0x59a27d[_0x4b8d('0x36')]=_['intersection'](_0x300267['model'],qs['fields'](_0xc4576e[_0x4b8d('0x32')][_0x4b8d('0x37')]));_0x59a27d[_0x4b8d('0x36')]=_0x59a27d[_0x4b8d('0x36')]['length']?_0x59a27d[_0x4b8d('0x36')]:_0x300267['model'];if(!_0xc4576e['query']['hasOwnProperty'](_0x4b8d('0x38'))){_0x59a27d[_0x4b8d('0x1f')]=qs[_0x4b8d('0x1f')](_0xc4576e['query'][_0x4b8d('0x1f')]);_0x59a27d[_0x4b8d('0x1d')]=qs['offset'](_0xc4576e[_0x4b8d('0x32')]['offset']);}_0x59a27d[_0x4b8d('0x39')]=qs[_0x4b8d('0x3a')](_0xc4576e['query'][_0x4b8d('0x3a')]);_0x59a27d[_0x4b8d('0x3b')]=qs[_0x4b8d('0x34')](_['pick'](_0xc4576e[_0x4b8d('0x32')],_0x300267[_0x4b8d('0x34')]),_0x1e018e);if(_0xc4576e[_0x4b8d('0x32')][_0x4b8d('0x3c')]){_0x59a27d[_0x4b8d('0x3b')]=_[_0x4b8d('0x3d')](_0x59a27d['where'],{'$or':_[_0x4b8d('0x31')](_0x1e018e,function(_0x18e5f0){if(_0x18e5f0[_0x4b8d('0x2f')]!==_0x4b8d('0x3e')){var _0x203e16={};_0x203e16[_0x18e5f0['name']]={'$like':'%'+_0xc4576e[_0x4b8d('0x32')][_0x4b8d('0x3c')]+'%'};return _0x203e16;}})});}_0x59a27d=_[_0x4b8d('0x3d')]({},_0x59a27d,_0xc4576e['options']);var _0x240bea={'where':_0x59a27d[_0x4b8d('0x3b')]};return db[_0x4b8d('0x2c')][_0x4b8d('0x20')](_0x240bea)[_0x4b8d('0x25')](function(_0x6e1ba8){_0x2007b7[_0x4b8d('0x20')]=_0x6e1ba8;if(_0xc4576e['query'][_0x4b8d('0x3f')]){_0x59a27d[_0x4b8d('0x40')]=[{'all':!![]}];}return db['VoiceTransferReport'][_0x4b8d('0x41')](_0x59a27d);})[_0x4b8d('0x25')](function(_0x20781a){_0x2007b7[_0x4b8d('0x42')]=_0x20781a;return _0x2007b7;})[_0x4b8d('0x25')](respondWithFilteredResult(_0x4fbd54,_0x59a27d))[_0x4b8d('0x43')](handleError(_0x4fbd54,null));};exports[_0x4b8d('0x44')]=function(_0x1ee512,_0x21c223){var _0x451280={'raw':!![],'where':{'id':_0x1ee512[_0x4b8d('0x45')]['id']}},_0x57684c={};_0x57684c[_0x4b8d('0x30')]=_['keys'](db['VoiceTransferReport'][_0x4b8d('0x2d')]);_0x57684c[_0x4b8d('0x32')]=_[_0x4b8d('0x33')](_0x1ee512[_0x4b8d('0x32')]);_0x57684c[_0x4b8d('0x34')]=_['intersection'](_0x57684c[_0x4b8d('0x30')],_0x57684c[_0x4b8d('0x32')]);_0x451280['attributes']=_[_0x4b8d('0x35')](_0x57684c[_0x4b8d('0x30')],qs[_0x4b8d('0x37')](_0x1ee512[_0x4b8d('0x32')][_0x4b8d('0x37')]));_0x451280[_0x4b8d('0x36')]=_0x451280['attributes']['length']?_0x451280['attributes']:_0x57684c['model'];if(_0x1ee512['query']['includeAll']){_0x451280[_0x4b8d('0x40')]=[{'all':!![]}];}_0x451280=_[_0x4b8d('0x3d')]({},_0x451280,_0x1ee512[_0x4b8d('0x46')]);return db[_0x4b8d('0x2c')][_0x4b8d('0x47')](_0x451280)[_0x4b8d('0x25')](handleEntityNotFound(_0x21c223,null))[_0x4b8d('0x25')](respondWithResult(_0x21c223,null))[_0x4b8d('0x43')](handleError(_0x21c223,null));};exports[_0x4b8d('0x48')]=function(_0x277357,_0x17c62f){return db[_0x4b8d('0x2c')][_0x4b8d('0x48')](_0x277357['body'],{})[_0x4b8d('0x25')](respondWithResult(_0x17c62f,0xc9))[_0x4b8d('0x43')](handleError(_0x17c62f,null));};exports[_0x4b8d('0x24')]=function(_0x3fc2f8,_0x988bf){if(_0x3fc2f8[_0x4b8d('0x49')]['id']){delete _0x3fc2f8[_0x4b8d('0x49')]['id'];}return db[_0x4b8d('0x2c')][_0x4b8d('0x47')]({'where':{'id':_0x3fc2f8['params']['id']}})[_0x4b8d('0x25')](handleEntityNotFound(_0x988bf,null))[_0x4b8d('0x25')](saveUpdates(_0x3fc2f8[_0x4b8d('0x49')],null))[_0x4b8d('0x25')](respondWithResult(_0x988bf,null))[_0x4b8d('0x43')](handleError(_0x988bf,null));};exports[_0x4b8d('0x26')]=function(_0x55dd8b,_0x24c841){return db[_0x4b8d('0x2c')][_0x4b8d('0x47')]({'where':{'id':_0x55dd8b[_0x4b8d('0x45')]['id']}})['then'](handleEntityNotFound(_0x24c841,null))[_0x4b8d('0x25')](removeEntity(_0x24c841,null))['catch'](handleError(_0x24c841,null));};exports[_0x4b8d('0x4a')]=function(_0x2d7151,_0x5ef716){return db['VoiceTransferReport'][_0x4b8d('0x4a')]()[_0x4b8d('0x25')](respondWithResult(_0x5ef716,null))[_0x4b8d('0x43')](handleError(_0x5ef716,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index f4550fb..5b90b70 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 _0x0de8=['rimraf','../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x5055f0,_0x41e2ce){var _0x21e361=function(_0x3d7292){while(--_0x3d7292){_0x5055f0['push'](_0x5055f0['shift']());}};_0x21e361(++_0x41e2ce);}(_0x0de8,0x93));var _0x80de=function(_0x386812,_0x27c823){_0x386812=_0x386812-0x0;var _0x4704d2=_0x0de8[_0x386812];return _0x4704d2;};'use strict';var _=require(_0x80de('0x0'));var util=require(_0x80de('0x1'));var logger=require(_0x80de('0x2'))(_0x80de('0x3'));var moment=require('moment');var BPromise=require(_0x80de('0x4'));var rp=require(_0x80de('0x5'));var fs=require('fs');var path=require(_0x80de('0x6'));var rimraf=require(_0x80de('0x7'));var config=require(_0x80de('0x8'));var attributes=require(_0x80de('0x9'));module[_0x80de('0xa')]=function(_0x2816c5,_0x123d80){return _0x2816c5[_0x80de('0xb')](_0x80de('0xc'),attributes,{'tableName':_0x80de('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9078=['bluebird','request-promise','path','rimraf','./voiceTransferReport.attributes','define','report_call_transfer','../../config/logger','api','moment'];(function(_0x3da7ab,_0x2e00dc){var _0x4819ed=function(_0x484ce3){while(--_0x484ce3){_0x3da7ab['push'](_0x3da7ab['shift']());}};_0x4819ed(++_0x2e00dc);}(_0x9078,0x1f1));var _0x8907=function(_0x319ecf,_0x22a155){_0x319ecf=_0x319ecf-0x0;var _0x2066c0=_0x9078[_0x319ecf];return _0x2066c0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8907('0x0'))(_0x8907('0x1'));var moment=require(_0x8907('0x2'));var BPromise=require(_0x8907('0x3'));var rp=require(_0x8907('0x4'));var fs=require('fs');var path=require(_0x8907('0x5'));var rimraf=require(_0x8907('0x6'));var config=require('../../config/environment');var attributes=require(_0x8907('0x7'));module['exports']=function(_0x513d3a,_0x54293c){return _0x513d3a[_0x8907('0x8')]('VoiceTransferReport',attributes,{'tableName':_0x8907('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index 9e16462..729a5ea 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 _0x7184=['options','then','stringify','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body'];(function(_0x4d5a38,_0x4bf584){var _0x35ebf2=function(_0x4d6a9d){while(--_0x4d6a9d){_0x4d5a38['push'](_0x4d5a38['shift']());}};_0x35ebf2(++_0x4bf584);}(_0x7184,0x1f1));var _0x4718=function(_0x4cdbc8,_0x4d8e1d){_0x4cdbc8=_0x4cdbc8-0x0;var _0x311448=_0x7184[_0x4cdbc8];return _0x311448;};'use strict';var _=require(_0x4718('0x0'));var util=require(_0x4718('0x1'));var moment=require(_0x4718('0x2'));var BPromise=require(_0x4718('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4718('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4718('0x5'));var logger=require(_0x4718('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4718('0x7'));var client=jayson[_0x4718('0x8')][_0x4718('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x346ee5,_0xbdecef,_0x8b6cce){return new BPromise(function(_0x5ce2e1,_0x37e035){return client['request'](_0x346ee5,_0x8b6cce)['then'](function(_0x4579bd){logger[_0x4718('0xa')](_0x4718('0xb'),_0xbdecef,_0x4718('0xc'));logger[_0x4718('0xd')](_0x4718('0xe'),_0xbdecef,'request\x20sent',JSON['stringify'](_0x4579bd));if(_0x4579bd[_0x4718('0xf')]){if(_0x4579bd[_0x4718('0xf')]['code']===0x1f4){logger['error'](_0x4718('0xb'),_0xbdecef,_0x4579bd['error'][_0x4718('0x10')]);return _0x37e035(_0x4579bd['error'][_0x4718('0x10')]);}logger[_0x4718('0xf')]('VoiceTransferReport,\x20%s,\x20%s',_0xbdecef,_0x4579bd['error'][_0x4718('0x10')]);return _0x5ce2e1(_0x4579bd['error']['message']);}else{logger[_0x4718('0xa')](_0x4718('0xb'),_0xbdecef,_0x4718('0xc'));_0x5ce2e1(_0x4579bd[_0x4718('0x11')]['message']);}})[_0x4718('0x12')](function(_0x3e9412){logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0xbdecef,_0x3e9412);_0x37e035(_0x3e9412);});});}exports[_0x4718('0x13')]=function(_0x9c3bb8){var _0x3ffae5=this;return new Promise(function(_0x2a8ae9,_0x3e1395){return db[_0x4718('0x14')][_0x4718('0x15')](_0x9c3bb8[_0x4718('0x16')],{'raw':_0x9c3bb8[_0x4718('0x17')]?_0x9c3bb8[_0x4718('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x4718('0x18')](function(_0x10ba4d){logger[_0x4718('0xa')](_0x4718('0x13'),_0x9c3bb8);logger[_0x4718('0xd')](_0x4718('0x13'),_0x9c3bb8,JSON[_0x4718('0x19')](_0x10ba4d));_0x2a8ae9(_0x10ba4d);})[_0x4718('0x12')](function(_0x476399){logger[_0x4718('0xf')](_0x4718('0x13'),_0x476399[_0x4718('0x10')],_0x9c3bb8);_0x3e1395(_0x3ffae5['error'](0x1f4,_0x476399['message']));});});}; \ No newline at end of file +var _0x4ce3=['request','then','info','VoiceTransferReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x165096,_0x292628){var _0x4d1d63=function(_0x3b2477){while(--_0x3b2477){_0x165096['push'](_0x165096['shift']());}};_0x4d1d63(++_0x292628);}(_0x4ce3,0xa3));var _0x34ce=function(_0x69fb6a,_0x46ec8d){_0x69fb6a=_0x69fb6a-0x0;var _0x2faee2=_0x4ce3[_0x69fb6a];return _0x2faee2;};'use strict';var _=require('lodash');var util=require(_0x34ce('0x0'));var moment=require(_0x34ce('0x1'));var BPromise=require(_0x34ce('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x34ce('0x3'));var db=require(_0x34ce('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x34ce('0x5'))(_0x34ce('0x6'));var config=require(_0x34ce('0x7'));var jayson=require(_0x34ce('0x8'));var client=jayson[_0x34ce('0x9')][_0x34ce('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x57ee9a,_0x3f38ff,_0x1e7171){return new BPromise(function(_0x6d8de9,_0x47301a){return client[_0x34ce('0xb')](_0x57ee9a,_0x1e7171)[_0x34ce('0xc')](function(_0x54b396){logger[_0x34ce('0xd')](_0x34ce('0xe'),_0x3f38ff,'request\x20sent');logger[_0x34ce('0xf')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x3f38ff,_0x34ce('0x10'),JSON[_0x34ce('0x11')](_0x54b396));if(_0x54b396[_0x34ce('0x12')]){if(_0x54b396[_0x34ce('0x12')][_0x34ce('0x13')]===0x1f4){logger[_0x34ce('0x12')](_0x34ce('0xe'),_0x3f38ff,_0x54b396[_0x34ce('0x12')][_0x34ce('0x14')]);return _0x47301a(_0x54b396[_0x34ce('0x12')][_0x34ce('0x14')]);}logger[_0x34ce('0x12')]('VoiceTransferReport,\x20%s,\x20%s',_0x3f38ff,_0x54b396[_0x34ce('0x12')][_0x34ce('0x14')]);return _0x6d8de9(_0x54b396[_0x34ce('0x12')]['message']);}else{logger[_0x34ce('0xd')]('VoiceTransferReport,\x20%s,\x20%s',_0x3f38ff,_0x34ce('0x10'));_0x6d8de9(_0x54b396[_0x34ce('0x15')][_0x34ce('0x14')]);}})['catch'](function(_0x348bc1){logger[_0x34ce('0x12')]('VoiceTransferReport,\x20%s,\x20%s',_0x3f38ff,_0x348bc1);_0x47301a(_0x348bc1);});});}exports[_0x34ce('0x16')]=function(_0x1d959c){var _0x7307a7=this;return new Promise(function(_0x768d18,_0x445b3c){return db[_0x34ce('0x17')][_0x34ce('0x18')](_0x1d959c[_0x34ce('0x19')],{'raw':_0x1d959c[_0x34ce('0x1a')]?_0x1d959c['options'][_0x34ce('0x1b')]===undefined?!![]:![]:!![]})[_0x34ce('0xc')](function(_0x172fce){logger[_0x34ce('0xd')](_0x34ce('0x16'),_0x1d959c);logger[_0x34ce('0xf')]('CreateVoiceTransferReport',_0x1d959c,JSON[_0x34ce('0x11')](_0x172fce));_0x768d18(_0x172fce);})[_0x34ce('0x1c')](function(_0x2dadd3){logger['error']('CreateVoiceTransferReport',_0x2dadd3[_0x34ce('0x14')],_0x1d959c);_0x445b3c(_0x7307a7['error'](0x1f4,_0x2dadd3['message']));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index c9abf7b..624f9a1 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 _0xdace=['unhold','calls','/transfer','transfer','exports','express','../../components/auth/service','./webbar.controller','post','isAuthenticated','isWebrtcLicence','originate','hangup','/answer','/hold','/unhold'];(function(_0x3e6707,_0x37475e){var _0x12b38d=function(_0x54c152){while(--_0x54c152){_0x3e6707['push'](_0x3e6707['shift']());}};_0x12b38d(++_0x37475e);}(_0xdace,0xc5));var _0xedac=function(_0x14e27a,_0x3b4136){_0x14e27a=_0x14e27a-0x0;var _0x288688=_0xdace[_0x14e27a];return _0x288688;};'use strict';var express=require(_0xedac('0x0'));var router=express['Router']();var auth=require(_0xedac('0x1'));var controller=require(_0xedac('0x2'));router[_0xedac('0x3')]('/originate',auth[_0xedac('0x4')](),auth[_0xedac('0x5')](),controller[_0xedac('0x6')]);router[_0xedac('0x3')]('/hangup',auth[_0xedac('0x4')](),auth[_0xedac('0x5')](),controller[_0xedac('0x7')]);router['post'](_0xedac('0x8'),auth[_0xedac('0x4')](),auth[_0xedac('0x5')](),controller['answer']);router[_0xedac('0x3')](_0xedac('0x9'),auth[_0xedac('0x4')](),auth['isWebrtcLicence'](),controller['hold']);router[_0xedac('0x3')](_0xedac('0xa'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xedac('0xb')]);router[_0xedac('0x3')]('/calls',auth[_0xedac('0x4')](),auth['isWebrtcLicence'](),controller[_0xedac('0xc')]);router[_0xedac('0x3')](_0xedac('0xd'),auth[_0xedac('0x4')](),auth[_0xedac('0x5')](),controller[_0xedac('0xe')]);module[_0xedac('0xf')]=router; \ No newline at end of file +var _0xf4eb=['/hangup','isAuthenticated','isWebrtcLicence','hangup','/hold','hold','/unhold','unhold','/calls','calls','transfer','exports','express','/originate','originate','post'];(function(_0x16a094,_0x2df5e5){var _0x2b1665=function(_0x19ab84){while(--_0x19ab84){_0x16a094['push'](_0x16a094['shift']());}};_0x2b1665(++_0x2df5e5);}(_0xf4eb,0xec));var _0xbf4e=function(_0x37cb00,_0x1d67d8){_0x37cb00=_0x37cb00-0x0;var _0x4ef369=_0xf4eb[_0x37cb00];return _0x4ef369;};'use strict';var express=require(_0xbf4e('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require('./webbar.controller');router['post'](_0xbf4e('0x1'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xbf4e('0x2')]);router[_0xbf4e('0x3')](_0xbf4e('0x4'),auth[_0xbf4e('0x5')](),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x7')]);router[_0xbf4e('0x3')]('/answer',auth[_0xbf4e('0x5')](),auth['isWebrtcLicence'](),controller['answer']);router[_0xbf4e('0x3')](_0xbf4e('0x8'),auth[_0xbf4e('0x5')](),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x9')]);router[_0xbf4e('0x3')](_0xbf4e('0xa'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xbf4e('0xb')]);router['post'](_0xbf4e('0xc'),auth[_0xbf4e('0x5')](),auth['isWebrtcLicence'](),controller[_0xbf4e('0xd')]);router['post']('/transfer',auth[_0xbf4e('0x5')](),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0xe')]);module[_0xbf4e('0xf')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 5941d79..d15f05b 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 _0x53f7=['../../config/logger','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','userId\x20is\x20required','string','callNumber\x20is\x20required','number','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','handleError:','name','send','status','NotFound','then','code','error','message','User','findOne','agent','VoiceChannels','all','filter','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate\x20fired:','body','validate','json','userId','callNumber','callerId','callbackUrl','entityFound:','webbar:originate','originate\x20executed!','hangup\x20fired:','format','user:%s','webbar:hangup','catch','answer','answer\x20fired:','webbar:answer','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','calls','conference','conference\x20fired:','transfer','transfer\x20fired:','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','http'];(function(_0x2c088d,_0x42e53e){var _0x44c8bc=function(_0x210387){while(--_0x210387){_0x2c088d['push'](_0x2c088d['shift']());}};_0x44c8bc(++_0x42e53e);}(_0x53f7,0x12c));var _0x753f=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0x53f7[_0x1589dd];return _0x1bddd1;};'use strict';var path=require(_0x753f('0x0'));var fs=require('fs');var _=require(_0x753f('0x1'));var db=require(_0x753f('0x2'))['db'];var config=require(_0x753f('0x3'));var util=require(_0x753f('0x4'));var BPromise=require(_0x753f('0x5'));var jayson=require(_0x753f('0x6'));var amiClient=jayson['client'][_0x753f('0x7')]({'port':0x232a});var logger=require(_0x753f('0x8'))(_0x753f('0x9'));var Redis=require(_0x753f('0xa'));config[_0x753f('0xb')]=_[_0x753f('0xc')](config[_0x753f('0xb')],{'host':_0x753f('0xd'),'port':0x18eb});var io=require(_0x753f('0xe'))(new Redis(config['redis']));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0x753f('0xf')]},'callNumber':{'type':_0x753f('0x10'),'required':[!![],_0x753f('0x11')]},'callerId':{'type':_0x753f('0x10')},'callbackUrl':{'type':_0x753f('0x10')}});var hangupValidation=new Schema({'userId':{'type':_0x753f('0x12'),'required':[!![],_0x753f('0xf')]},'sessionId':{'type':_0x753f('0x10'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x753f('0x12'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x753f('0x10'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0x753f('0xf')]},'sessionId':{'type':_0x753f('0x10'),'required':[!![],_0x753f('0x13')]},'transferNumber':{'type':_0x753f('0x10'),'required':[!![],_0x753f('0x14')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x753f('0xf')]},'sessionId':{'type':_0x753f('0x10'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x753f('0x12'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x753f('0x10'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x753f('0x12'),'required':[!![],_0x753f('0xf')]}});var conferenceValidation=new Schema({'userId':{'type':_0x753f('0x12'),'required':[!![],_0x753f('0xf')]}});function emit(_0x20dff1,_0x4f2917,_0x53be13){logger[_0x753f('0x15')](_0x20dff1,_0x4f2917,JSON[_0x753f('0x16')](_0x53be13));io['to'](_0x20dff1)[_0x753f('0x17')](_0x4f2917,_0x53be13);}function handleError(_0x3f0c5e){return function(_0x39e35b){console['log'](_0x753f('0x18'),_0x39e35b,_0x39e35b instanceof RangeError);logger['error'](_0x39e35b['stack']);if(_0x39e35b instanceof RangeError){if(_0x39e35b['name']){delete _0x39e35b[_0x753f('0x19')];}_0x3f0c5e['status'](0x194)[_0x753f('0x1a')](_0x39e35b);}else{if(_0x39e35b['name']){delete _0x39e35b['name'];}_0x3f0c5e[_0x753f('0x1b')](0x1f4)[_0x753f('0x1a')](_0x39e35b);}};}function checkError(){return function(_0x593c51){if(!_0x593c51){throw new RangeError(_0x753f('0x1c'));}return _0x593c51;};}function respondWithRpcPromise(_0x4894e9,_0x2427ee){return new BPromise(function(_0x159124,_0x408e2f){var _0x56cf29=amiClient;return _0x56cf29['request'](_0x4894e9,_0x2427ee)[_0x753f('0x1d')](function(_0xff68){if(_0xff68['error']){if(_0xff68['error'][_0x753f('0x1e')]===0x1f4){return _0x408e2f(_0xff68[_0x753f('0x1f')]['message']);}return _0x159124(_0xff68[_0x753f('0x1f')][_0x753f('0x20')]);}else{_0x159124(_0xff68['result']);}})['catch'](function(_0x14067a){_0x408e2f(_0x14067a);});});}function getAgent(_0x555cfb){return db[_0x753f('0x21')][_0x753f('0x22')]({'where':{'id':_0x555cfb,'role':_0x753f('0x23')}})['then'](checkError());}function getAgentCheckSession(_0x56d4a5,_0x304c79){return new BPromise(function(_0x43ab0e,_0x271267){var _0x253bc7=respondWithRpcPromise(_0x753f('0x24'));var _0x101559=getAgent(_0x56d4a5);Promise[_0x753f('0x25')]([_0x253bc7,_0x101559])[_0x753f('0x1d')](function(_0x22947a){var _0x1769c0=_0x22947a[0x0];var _0x474bfb=_0x22947a[0x1];var _0x5b36ca=_[_0x753f('0x26')](_0x1769c0[_0x753f('0x27')],function(_0x424e8a){return _0x424e8a[_0x753f('0x28')]==_0x474bfb['id']&&_0x424e8a[_0x753f('0x29')]==_0x304c79;});if(_0x5b36ca[_0x753f('0x2a')]==0x1){_0x43ab0e(_0x474bfb);}else{_0x271267(new RangeError(_0x753f('0x2b')+_0x304c79+_0x753f('0x2c')));}});});}exports['originate']=function(_0x2fcd6b,_0x307dab){logger[_0x753f('0x15')](_0x753f('0x2d'),_0x2fcd6b[_0x753f('0x2e')]);var _0x2039f6=originateValidation[_0x753f('0x2f')](_0x2fcd6b['body']);if(_0x2039f6[_0x753f('0x2a')]>0x0){return _0x307dab['status'](0x190)[_0x753f('0x30')](_0x2039f6);}var _0xe168af=_0x2fcd6b[_0x753f('0x2e')][_0x753f('0x31')];var _0xeca38b=_0x2fcd6b['body'][_0x753f('0x32')];var _0x502474=_0x2fcd6b[_0x753f('0x2e')][_0x753f('0x33')];var _0x1c4116=_0x2fcd6b['body'][_0x753f('0x34')];return getAgent(_0xe168af)[_0x753f('0x1d')](function(_0x26af0e){logger[_0x753f('0x15')](_0x753f('0x35'),_0x26af0e[_0x753f('0x19')]);emit(util['format']('user:%s',_0x26af0e['name']),_0x753f('0x36'),{'callNumber':_0xeca38b,'callerId':_0x502474,'callbackUrl':_0x1c4116});return _0x307dab[_0x753f('0x1b')](0xc8)[_0x753f('0x30')]({'error':![],'message':_0x753f('0x37')});})['catch'](handleError(_0x307dab));};exports['hangup']=function(_0x1e34a1,_0x36a73e){logger[_0x753f('0x15')](_0x753f('0x38'),_0x1e34a1[_0x753f('0x2e')]);var _0x1d779d=hangupValidation[_0x753f('0x2f')](_0x1e34a1[_0x753f('0x2e')]);if(_0x1d779d[_0x753f('0x2a')]>0x0){return _0x36a73e[_0x753f('0x1b')](0x190)[_0x753f('0x30')](_0x1d779d);}var _0x4e676c=_0x1e34a1['body'][_0x753f('0x31')];var _0x10baec=_0x1e34a1[_0x753f('0x2e')][_0x753f('0x29')];return getAgent(_0x4e676c)[_0x753f('0x1d')](function(_0x92d6d2){logger[_0x753f('0x15')](_0x753f('0x35'),_0x92d6d2[_0x753f('0x19')]);emit(util[_0x753f('0x39')](_0x753f('0x3a'),_0x92d6d2['name']),_0x753f('0x3b'),{'sessionId':_0x10baec});return _0x36a73e[_0x753f('0x1b')](0xc8)[_0x753f('0x30')]({'error':![],'message':'hangup\x20executed!'});})[_0x753f('0x3c')](handleError(_0x36a73e));};exports[_0x753f('0x3d')]=function(_0x300661,_0x64fd36){logger['info'](_0x753f('0x3e'),_0x300661['body']);var _0x540cdb=answerValidation['validate'](_0x300661['body']);if(_0x540cdb[_0x753f('0x2a')]>0x0){return _0x64fd36[_0x753f('0x1b')](0x190)['json'](_0x540cdb);}var _0x229a0c=_0x300661[_0x753f('0x2e')]['userId'];var _0x329e82=_0x300661[_0x753f('0x2e')][_0x753f('0x29')];return getAgent(_0x229a0c)[_0x753f('0x1d')](function(_0x24270b){logger[_0x753f('0x15')](_0x753f('0x35'),_0x24270b[_0x753f('0x19')]);emit(util[_0x753f('0x39')](_0x753f('0x3a'),_0x24270b[_0x753f('0x19')]),_0x753f('0x3f'),{'sessionId':_0x329e82});return _0x64fd36['status'](0xc8)['json']({'error':![],'message':'answer\x20executed!'});})[_0x753f('0x3c')](handleError(_0x64fd36));};exports[_0x753f('0x40')]=function(_0x2a44d9,_0xad679b){logger[_0x753f('0x15')](_0x753f('0x41'),_0x2a44d9[_0x753f('0x2e')]);var _0x1000c0=holdValidation['validate'](_0x2a44d9[_0x753f('0x2e')]);if(_0x1000c0[_0x753f('0x2a')]>0x0){return _0xad679b[_0x753f('0x1b')](0x190)[_0x753f('0x30')](_0x1000c0);}var _0x3943d8=_0x2a44d9['body']['userId'];var _0x136bfb=_0x2a44d9[_0x753f('0x2e')]['sessionId'];return getAgent(_0x3943d8)[_0x753f('0x1d')](function(_0x38243f){logger['info']('entityFound:',_0x38243f[_0x753f('0x19')]);emit(util[_0x753f('0x39')](_0x753f('0x3a'),_0x38243f[_0x753f('0x19')]),_0x753f('0x42'),{'sessionId':_0x136bfb});return _0xad679b[_0x753f('0x1b')](0xc8)[_0x753f('0x30')]({'error':![],'message':_0x753f('0x43')});})[_0x753f('0x3c')](handleError(_0xad679b));};exports[_0x753f('0x44')]=function(_0x527421,_0xd3e6b){logger[_0x753f('0x15')](_0x753f('0x45'),_0x527421[_0x753f('0x2e')]);var _0x163dc8=unholdValidation['validate'](_0x527421[_0x753f('0x2e')]);if(_0x163dc8[_0x753f('0x2a')]>0x0){return _0xd3e6b[_0x753f('0x1b')](0x190)[_0x753f('0x30')](_0x163dc8);}var _0x4402f0=_0x527421['body'][_0x753f('0x31')];var _0xc1caa9=_0x527421['body'][_0x753f('0x29')];return getAgent(_0x4402f0)[_0x753f('0x1d')](function(_0x57cde4){logger[_0x753f('0x15')](_0x753f('0x35'),_0x57cde4['name']);emit(util[_0x753f('0x39')](_0x753f('0x3a'),_0x57cde4[_0x753f('0x19')]),'webbar:unhold',{'sessionId':_0xc1caa9});return _0xd3e6b[_0x753f('0x1b')](0xc8)[_0x753f('0x30')]({'error':![],'message':'unhold\x20executed!'});})[_0x753f('0x3c')](handleError(_0xd3e6b));};exports[_0x753f('0x46')]=function(_0x478131,_0x4a23b8){logger[_0x753f('0x15')]('calls\x20fired:',_0x4a23b8[_0x753f('0x2e')]);var _0x281efd=callsValidation[_0x753f('0x2f')](_0x478131['body']);if(_0x281efd[_0x753f('0x2a')]>0x0){return _0x4a23b8[_0x753f('0x1b')](0x190)['json'](_0x281efd);}var _0x487ac6=_0x478131[_0x753f('0x2e')][_0x753f('0x31')];var _0x4fb02d=respondWithRpcPromise(_0x753f('0x24'));var _0x1779ce=getAgent(_0x487ac6);return Promise['all']([_0x4fb02d,_0x1779ce])[_0x753f('0x1d')](function(_0x59d990){var _0x3d6665=_0x59d990[0x0];var _0x294f6a=_0x59d990[0x1];var _0x19bc8b=_[_0x753f('0x26')](_0x3d6665[_0x753f('0x27')],function(_0x10d653){return _0x10d653[_0x753f('0x28')]==_0x294f6a['id'];});return _0x4a23b8[_0x753f('0x1b')](0xc8)[_0x753f('0x30')]({'count':_0x19bc8b[_0x753f('0x2a')],'rows':_0x19bc8b});})['catch'](handleError(_0x4a23b8));};exports[_0x753f('0x47')]=function(_0x425c39,_0x5c3d74){logger['info'](_0x753f('0x48'),_0x425c39['body']);var _0x4b21e3=conferenceValidation[_0x753f('0x2f')](_0x425c39['body']);if(_0x4b21e3[_0x753f('0x2a')]>0x0){return _0x5c3d74[_0x753f('0x1b')](0x190)['json'](_0x4b21e3);}var _0x4ee3bb=_0x425c39[_0x753f('0x2e')][_0x753f('0x31')];return getAgent(_0x4ee3bb)[_0x753f('0x1d')](function(_0x437880){logger['info']('entityFound:',_0x437880[_0x753f('0x19')]);emit(util[_0x753f('0x39')]('user:%s',_0x437880[_0x753f('0x19')]),'webbar:conference');return _0x5c3d74[_0x753f('0x1b')](0xc8)[_0x753f('0x30')]({'error':![],'message':'conference\x20executed!'});})['catch'](handleError(_0x5c3d74));};exports[_0x753f('0x49')]=function(_0x565bdd,_0x5e9795){logger[_0x753f('0x15')](_0x753f('0x4a'),_0x565bdd[_0x753f('0x2e')]);var _0x44435e=transferValidation[_0x753f('0x2f')](_0x565bdd['body']);if(_0x44435e['length']>0x0){return _0x5e9795[_0x753f('0x1b')](0x190)[_0x753f('0x30')](_0x44435e);}var _0x292515=_0x565bdd[_0x753f('0x2e')][_0x753f('0x31')];var _0x1aaf60=_0x565bdd[_0x753f('0x2e')]['sessionId'];var _0x14156f=_0x565bdd[_0x753f('0x2e')]['transferNumber'];return getAgent(_0x292515)[_0x753f('0x1d')](function(_0x130f21){logger[_0x753f('0x15')](_0x753f('0x35'),_0x130f21['name']);emit(util['format'](_0x753f('0x3a'),_0x130f21[_0x753f('0x19')]),_0x753f('0x4b'),{'sessionId':_0x1aaf60,'transferNumber':_0x14156f});return _0x5e9795[_0x753f('0x1b')](0xc8)[_0x753f('0x30')]({'error':![],'message':_0x753f('0x4c')});})[_0x753f('0x3c')](handleError(_0x5e9795));}; \ No newline at end of file +var _0x132c=['entityFound:','format','user:%s','webbar:originate','json','originate\x20executed!','hangup','hangup\x20fired:','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold\x20fired:','webbar:unhold','calls','rows','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','transfer\x20executed!','path','lodash','../../config/environment','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','redis','defaults','localhost','socket.io-emitter','validate','userId\x20is\x20required','string','callNumber\x20is\x20required','number','transferNumber\x20is\x20required','info','emit','log','stack','name','status','send','NotFound','request','then','error','code','message','result','catch','findOne','agent','VoiceChannels','all','filter','UserId','sessionId','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','length','userId','callNumber','callbackUrl'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x132c,0x159));var _0xc132=function(_0x385acc,_0x24fde3){_0x385acc=_0x385acc-0x0;var _0x128205=_0x132c[_0x385acc];return _0x128205;};'use strict';var path=require(_0xc132('0x0'));var fs=require('fs');var _=require(_0xc132('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0xc132('0x2'));var util=require('util');var BPromise=require(_0xc132('0x3'));var jayson=require(_0xc132('0x4'));var amiClient=jayson[_0xc132('0x5')][_0xc132('0x6')]({'port':0x232a});var logger=require(_0xc132('0x7'))(_0xc132('0x8'));var Redis=require('ioredis');config[_0xc132('0x9')]=_[_0xc132('0xa')](config[_0xc132('0x9')],{'host':_0xc132('0xb'),'port':0x18eb});var io=require(_0xc132('0xc'))(new Redis(config[_0xc132('0x9')]));var Schema=require(_0xc132('0xd'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0xc132('0xe')]},'callNumber':{'type':_0xc132('0xf'),'required':[!![],_0xc132('0x10')]},'callerId':{'type':_0xc132('0xf')},'callbackUrl':{'type':_0xc132('0xf')}});var hangupValidation=new Schema({'userId':{'type':_0xc132('0x11'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':_0xc132('0x11'),'required':[!![],_0xc132('0xe')]},'sessionId':{'type':_0xc132('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xc132('0xf'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0xc132('0xf'),'required':[!![],_0xc132('0x12')]}});var holdValidation=new Schema({'userId':{'type':_0xc132('0x11'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xc132('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xc132('0x11'),'required':[!![],_0xc132('0xe')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0xc132('0x11'),'required':[!![],_0xc132('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':_0xc132('0x11'),'required':[!![],_0xc132('0xe')]}});function emit(_0x177bb8,_0x51e00f,_0x3ac727){logger[_0xc132('0x13')](_0x177bb8,_0x51e00f,JSON['stringify'](_0x3ac727));io['to'](_0x177bb8)[_0xc132('0x14')](_0x51e00f,_0x3ac727);}function handleError(_0x8d2069){return function(_0x2a6230){console[_0xc132('0x15')]('handleError:',_0x2a6230,_0x2a6230 instanceof RangeError);logger['error'](_0x2a6230[_0xc132('0x16')]);if(_0x2a6230 instanceof RangeError){if(_0x2a6230[_0xc132('0x17')]){delete _0x2a6230[_0xc132('0x17')];}_0x8d2069[_0xc132('0x18')](0x194)[_0xc132('0x19')](_0x2a6230);}else{if(_0x2a6230[_0xc132('0x17')]){delete _0x2a6230['name'];}_0x8d2069[_0xc132('0x18')](0x1f4)[_0xc132('0x19')](_0x2a6230);}};}function checkError(){return function(_0x10ffa7){if(!_0x10ffa7){throw new RangeError(_0xc132('0x1a'));}return _0x10ffa7;};}function respondWithRpcPromise(_0x39e974,_0x22d11d){return new BPromise(function(_0x57bce1,_0x958dd){var _0x1421ff=amiClient;return _0x1421ff[_0xc132('0x1b')](_0x39e974,_0x22d11d)[_0xc132('0x1c')](function(_0x4043f8){if(_0x4043f8[_0xc132('0x1d')]){if(_0x4043f8[_0xc132('0x1d')][_0xc132('0x1e')]===0x1f4){return _0x958dd(_0x4043f8['error']['message']);}return _0x57bce1(_0x4043f8[_0xc132('0x1d')][_0xc132('0x1f')]);}else{_0x57bce1(_0x4043f8[_0xc132('0x20')]);}})[_0xc132('0x21')](function(_0x1c026b){_0x958dd(_0x1c026b);});});}function getAgent(_0x3f6ab8){return db['User'][_0xc132('0x22')]({'where':{'id':_0x3f6ab8,'role':_0xc132('0x23')}})[_0xc132('0x1c')](checkError());}function getAgentCheckSession(_0x8f8e46,_0x28b56e){return new BPromise(function(_0x55a9f2,_0x571e6f){var _0x6531ee=respondWithRpcPromise(_0xc132('0x24'));var _0x49eb14=getAgent(_0x8f8e46);Promise[_0xc132('0x25')]([_0x6531ee,_0x49eb14])[_0xc132('0x1c')](function(_0x3c7024){var _0x3e0d34=_0x3c7024[0x0];var _0x2bf5d0=_0x3c7024[0x1];var _0x3bad5a=_[_0xc132('0x26')](_0x3e0d34['rows'],function(_0x45ea5c){return _0x45ea5c[_0xc132('0x27')]==_0x2bf5d0['id']&&_0x45ea5c[_0xc132('0x28')]==_0x28b56e;});if(_0x3bad5a['length']==0x1){_0x55a9f2(_0x2bf5d0);}else{_0x571e6f(new RangeError(_0xc132('0x29')+_0x28b56e+_0xc132('0x2a')));}});});}exports[_0xc132('0x2b')]=function(_0x52d0b4,_0x2fc7c5){logger[_0xc132('0x13')](_0xc132('0x2c'),_0x52d0b4[_0xc132('0x2d')]);var _0x57dc8f=originateValidation[_0xc132('0xd')](_0x52d0b4['body']);if(_0x57dc8f[_0xc132('0x2e')]>0x0){return _0x2fc7c5[_0xc132('0x18')](0x190)['json'](_0x57dc8f);}var _0x41779e=_0x52d0b4['body'][_0xc132('0x2f')];var _0x60d416=_0x52d0b4[_0xc132('0x2d')][_0xc132('0x30')];var _0x5dcb7e=_0x52d0b4[_0xc132('0x2d')]['callerId'];var _0xad5fcc=_0x52d0b4[_0xc132('0x2d')][_0xc132('0x31')];return getAgent(_0x41779e)['then'](function(_0x3f49bf){logger[_0xc132('0x13')](_0xc132('0x32'),_0x3f49bf[_0xc132('0x17')]);emit(util[_0xc132('0x33')](_0xc132('0x34'),_0x3f49bf[_0xc132('0x17')]),_0xc132('0x35'),{'callNumber':_0x60d416,'callerId':_0x5dcb7e,'callbackUrl':_0xad5fcc});return _0x2fc7c5[_0xc132('0x18')](0xc8)[_0xc132('0x36')]({'error':![],'message':_0xc132('0x37')});})[_0xc132('0x21')](handleError(_0x2fc7c5));};exports[_0xc132('0x38')]=function(_0x2799c1,_0x5cac31){logger[_0xc132('0x13')](_0xc132('0x39'),_0x2799c1['body']);var _0x15c939=hangupValidation[_0xc132('0xd')](_0x2799c1['body']);if(_0x15c939[_0xc132('0x2e')]>0x0){return _0x5cac31['status'](0x190)[_0xc132('0x36')](_0x15c939);}var _0x49fde3=_0x2799c1[_0xc132('0x2d')][_0xc132('0x2f')];var _0xb19733=_0x2799c1[_0xc132('0x2d')][_0xc132('0x28')];return getAgent(_0x49fde3)[_0xc132('0x1c')](function(_0x17556a){logger['info'](_0xc132('0x32'),_0x17556a[_0xc132('0x17')]);emit(util[_0xc132('0x33')](_0xc132('0x34'),_0x17556a[_0xc132('0x17')]),_0xc132('0x3a'),{'sessionId':_0xb19733});return _0x5cac31['status'](0xc8)['json']({'error':![],'message':_0xc132('0x3b')});})[_0xc132('0x21')](handleError(_0x5cac31));};exports[_0xc132('0x3c')]=function(_0x164aaa,_0x2ac86b){logger[_0xc132('0x13')](_0xc132('0x3d'),_0x164aaa[_0xc132('0x2d')]);var _0x4ce896=answerValidation['validate'](_0x164aaa[_0xc132('0x2d')]);if(_0x4ce896[_0xc132('0x2e')]>0x0){return _0x2ac86b[_0xc132('0x18')](0x190)[_0xc132('0x36')](_0x4ce896);}var _0x54b034=_0x164aaa[_0xc132('0x2d')][_0xc132('0x2f')];var _0x1b5d21=_0x164aaa[_0xc132('0x2d')][_0xc132('0x28')];return getAgent(_0x54b034)[_0xc132('0x1c')](function(_0x13af00){logger['info']('entityFound:',_0x13af00[_0xc132('0x17')]);emit(util[_0xc132('0x33')](_0xc132('0x34'),_0x13af00[_0xc132('0x17')]),_0xc132('0x3e'),{'sessionId':_0x1b5d21});return _0x2ac86b[_0xc132('0x18')](0xc8)[_0xc132('0x36')]({'error':![],'message':'answer\x20executed!'});})[_0xc132('0x21')](handleError(_0x2ac86b));};exports[_0xc132('0x3f')]=function(_0x11c766,_0x3b2cc9){logger[_0xc132('0x13')](_0xc132('0x40'),_0x11c766[_0xc132('0x2d')]);var _0x298b49=holdValidation[_0xc132('0xd')](_0x11c766[_0xc132('0x2d')]);if(_0x298b49[_0xc132('0x2e')]>0x0){return _0x3b2cc9[_0xc132('0x18')](0x190)['json'](_0x298b49);}var _0x20e1d3=_0x11c766[_0xc132('0x2d')][_0xc132('0x2f')];var _0x23af8e=_0x11c766[_0xc132('0x2d')]['sessionId'];return getAgent(_0x20e1d3)[_0xc132('0x1c')](function(_0x2f6380){logger[_0xc132('0x13')](_0xc132('0x32'),_0x2f6380['name']);emit(util[_0xc132('0x33')](_0xc132('0x34'),_0x2f6380[_0xc132('0x17')]),_0xc132('0x41'),{'sessionId':_0x23af8e});return _0x3b2cc9[_0xc132('0x18')](0xc8)[_0xc132('0x36')]({'error':![],'message':_0xc132('0x42')});})['catch'](handleError(_0x3b2cc9));};exports['unhold']=function(_0x262334,_0x4ad895){logger['info'](_0xc132('0x43'),_0x262334['body']);var _0x2b7527=unholdValidation[_0xc132('0xd')](_0x262334[_0xc132('0x2d')]);if(_0x2b7527[_0xc132('0x2e')]>0x0){return _0x4ad895[_0xc132('0x18')](0x190)[_0xc132('0x36')](_0x2b7527);}var _0x138f42=_0x262334[_0xc132('0x2d')][_0xc132('0x2f')];var _0xac9291=_0x262334[_0xc132('0x2d')]['sessionId'];return getAgent(_0x138f42)['then'](function(_0x31e75e){logger[_0xc132('0x13')](_0xc132('0x32'),_0x31e75e[_0xc132('0x17')]);emit(util[_0xc132('0x33')](_0xc132('0x34'),_0x31e75e[_0xc132('0x17')]),_0xc132('0x44'),{'sessionId':_0xac9291});return _0x4ad895[_0xc132('0x18')](0xc8)['json']({'error':![],'message':'unhold\x20executed!'});})[_0xc132('0x21')](handleError(_0x4ad895));};exports[_0xc132('0x45')]=function(_0x467586,_0x51661f){logger[_0xc132('0x13')]('calls\x20fired:',_0x51661f[_0xc132('0x2d')]);var _0x4ee5eb=callsValidation['validate'](_0x467586[_0xc132('0x2d')]);if(_0x4ee5eb[_0xc132('0x2e')]>0x0){return _0x51661f[_0xc132('0x18')](0x190)[_0xc132('0x36')](_0x4ee5eb);}var _0x10d882=_0x467586[_0xc132('0x2d')][_0xc132('0x2f')];var _0x4fc9b3=respondWithRpcPromise(_0xc132('0x24'));var _0x2838d4=getAgent(_0x10d882);return Promise[_0xc132('0x25')]([_0x4fc9b3,_0x2838d4])[_0xc132('0x1c')](function(_0x401043){var _0x557771=_0x401043[0x0];var _0x290d61=_0x401043[0x1];var _0x5a5b96=_[_0xc132('0x26')](_0x557771[_0xc132('0x46')],function(_0x56f375){return _0x56f375['UserId']==_0x290d61['id'];});return _0x51661f[_0xc132('0x18')](0xc8)[_0xc132('0x36')]({'count':_0x5a5b96['length'],'rows':_0x5a5b96});})[_0xc132('0x21')](handleError(_0x51661f));};exports[_0xc132('0x47')]=function(_0x476d79,_0x2538cb){logger['info'](_0xc132('0x48'),_0x476d79[_0xc132('0x2d')]);var _0x2d22b2=conferenceValidation[_0xc132('0xd')](_0x476d79['body']);if(_0x2d22b2[_0xc132('0x2e')]>0x0){return _0x2538cb[_0xc132('0x18')](0x190)[_0xc132('0x36')](_0x2d22b2);}var _0x43a3a2=_0x476d79[_0xc132('0x2d')][_0xc132('0x2f')];return getAgent(_0x43a3a2)[_0xc132('0x1c')](function(_0x3388bd){logger[_0xc132('0x13')](_0xc132('0x32'),_0x3388bd[_0xc132('0x17')]);emit(util[_0xc132('0x33')](_0xc132('0x34'),_0x3388bd[_0xc132('0x17')]),_0xc132('0x49'));return _0x2538cb['status'](0xc8)[_0xc132('0x36')]({'error':![],'message':_0xc132('0x4a')});})['catch'](handleError(_0x2538cb));};exports[_0xc132('0x4b')]=function(_0x4a60ec,_0x3da01e){logger['info'](_0xc132('0x4c'),_0x4a60ec[_0xc132('0x2d')]);var _0x412a0e=transferValidation[_0xc132('0xd')](_0x4a60ec['body']);if(_0x412a0e[_0xc132('0x2e')]>0x0){return _0x3da01e[_0xc132('0x18')](0x190)[_0xc132('0x36')](_0x412a0e);}var _0xc653e=_0x4a60ec[_0xc132('0x2d')]['userId'];var _0x50be17=_0x4a60ec[_0xc132('0x2d')]['sessionId'];var _0x2aff0b=_0x4a60ec['body'][_0xc132('0x4d')];return getAgent(_0xc653e)[_0xc132('0x1c')](function(_0x192a65){logger[_0xc132('0x13')](_0xc132('0x32'),_0x192a65[_0xc132('0x17')]);emit(util[_0xc132('0x33')]('user:%s',_0x192a65[_0xc132('0x17')]),'webbar:transfer',{'sessionId':_0x50be17,'transferNumber':_0x2aff0b});return _0x3da01e[_0xc132('0x18')](0xc8)[_0xc132('0x36')]({'error':![],'message':_0xc132('0x4e')});})[_0xc132('0x21')](handleError(_0x3da01e));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 9ca97ba..a395e40 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 _0xcf5c=['multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','getDispositions','getAnswers','getAgents','/:id/applications','getApplications','create','addDisposition','/:id/canned_answers','post','/:id/users','addApplications','notify','/:id/send','update','destroy','delete','removeDispositions','removeAgents','exports'];(function(_0x1d638f,_0x370f10){var _0x27f549=function(_0x131909){while(--_0x131909){_0x1d638f['push'](_0x1d638f['shift']());}};_0x27f549(++_0x370f10);}(_0xcf5c,0xcc));var _0xccf5=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xcf5c[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0xccf5('0x0'));var util=require('util');var path=require(_0xccf5('0x1'));var timeout=require(_0xccf5('0x2'));var express=require('express');var router=express[_0xccf5('0x3')]();var fs_extra=require(_0xccf5('0x4'));var auth=require(_0xccf5('0x5'));var interaction=require(_0xccf5('0x6'));var config=require(_0xccf5('0x7'));var controller=require('./whatsappAccount.controller');router[_0xccf5('0x8')]('/',auth[_0xccf5('0x9')](),controller[_0xccf5('0xa')]);router['get'](_0xccf5('0xb'),auth[_0xccf5('0x9')](),controller[_0xccf5('0xc')]);router[_0xccf5('0x8')](_0xccf5('0xd'),auth[_0xccf5('0x9')](),controller['show']);router[_0xccf5('0x8')](_0xccf5('0xe'),auth[_0xccf5('0x9')](),controller[_0xccf5('0xf')]);router[_0xccf5('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xccf5('0x10')]);router[_0xccf5('0x8')]('/:id/users',auth[_0xccf5('0x9')](),controller[_0xccf5('0x11')]);router[_0xccf5('0x8')](_0xccf5('0x12'),auth['isAuthenticated'](),controller[_0xccf5('0x13')]);router['post']('/',auth['isAuthenticated'](),controller[_0xccf5('0x14')]);router['post'](_0xccf5('0xe'),auth[_0xccf5('0x9')](),controller[_0xccf5('0x15')]);router['post'](_0xccf5('0x16'),auth[_0xccf5('0x9')](),controller['addAnswer']);router[_0xccf5('0x17')](_0xccf5('0x18'),auth[_0xccf5('0x9')](),controller['addAgents']);router[_0xccf5('0x17')](_0xccf5('0x12'),auth['isAuthenticated'](),controller[_0xccf5('0x19')]);router[_0xccf5('0x17')]('/:id/notify',controller[_0xccf5('0x1a')]);router[_0xccf5('0x17')](_0xccf5('0x1b'),auth[_0xccf5('0x9')](),controller['send']);router['put'](_0xccf5('0xd'),auth[_0xccf5('0x9')](),controller[_0xccf5('0x1c')]);router['delete'](_0xccf5('0xd'),auth[_0xccf5('0x9')](),controller[_0xccf5('0x1d')]);router[_0xccf5('0x1e')](_0xccf5('0xe'),auth['isAuthenticated'](),controller[_0xccf5('0x1f')]);router['delete'](_0xccf5('0x16'),auth[_0xccf5('0x9')](),controller['removeAnswers']);router[_0xccf5('0x1e')](_0xccf5('0x18'),auth['isAuthenticated'](),controller[_0xccf5('0x20')]);module[_0xccf5('0x21')]=router; \ No newline at end of file +var _0xbeb1=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','isAuthenticated','index','get','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','getApplications','post','create','addDisposition','addAnswer','addAgents','/:id/applications','addApplications','/:id/notify','notify','send','put','update','delete','removeAnswers','removeAgents','exports','multer','util'];(function(_0x29e40e,_0x53d1c0){var _0x13936a=function(_0x28f2fb){while(--_0x28f2fb){_0x29e40e['push'](_0x29e40e['shift']());}};_0x13936a(++_0x53d1c0);}(_0xbeb1,0x154));var _0x1beb=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xbeb1[_0x17d9e3];return _0x14192d;};'use strict';var multer=require(_0x1beb('0x0'));var util=require(_0x1beb('0x1'));var path=require(_0x1beb('0x2'));var timeout=require(_0x1beb('0x3'));var express=require(_0x1beb('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1beb('0x5'));var interaction=require(_0x1beb('0x6'));var config=require(_0x1beb('0x7'));var controller=require(_0x1beb('0x8'));router['get']('/',auth[_0x1beb('0x9')](),controller[_0x1beb('0xa')]);router[_0x1beb('0xb')]('/describe',auth[_0x1beb('0x9')](),controller[_0x1beb('0xc')]);router[_0x1beb('0xb')](_0x1beb('0xd'),auth[_0x1beb('0x9')](),controller[_0x1beb('0xe')]);router[_0x1beb('0xb')](_0x1beb('0xf'),auth[_0x1beb('0x9')](),controller[_0x1beb('0x10')]);router[_0x1beb('0xb')](_0x1beb('0x11'),auth[_0x1beb('0x9')](),controller[_0x1beb('0x12')]);router['get'](_0x1beb('0x13'),auth[_0x1beb('0x9')](),controller[_0x1beb('0x14')]);router[_0x1beb('0xb')]('/:id/applications',auth[_0x1beb('0x9')](),controller[_0x1beb('0x15')]);router[_0x1beb('0x16')]('/',auth[_0x1beb('0x9')](),controller[_0x1beb('0x17')]);router[_0x1beb('0x16')](_0x1beb('0xf'),auth['isAuthenticated'](),controller[_0x1beb('0x18')]);router[_0x1beb('0x16')](_0x1beb('0x11'),auth[_0x1beb('0x9')](),controller[_0x1beb('0x19')]);router[_0x1beb('0x16')](_0x1beb('0x13'),auth[_0x1beb('0x9')](),controller[_0x1beb('0x1a')]);router[_0x1beb('0x16')](_0x1beb('0x1b'),auth['isAuthenticated'](),controller[_0x1beb('0x1c')]);router[_0x1beb('0x16')](_0x1beb('0x1d'),controller[_0x1beb('0x1e')]);router[_0x1beb('0x16')]('/:id/send',auth[_0x1beb('0x9')](),controller[_0x1beb('0x1f')]);router[_0x1beb('0x20')](_0x1beb('0xd'),auth[_0x1beb('0x9')](),controller[_0x1beb('0x21')]);router['delete'](_0x1beb('0xd'),auth[_0x1beb('0x9')](),controller['destroy']);router[_0x1beb('0x22')](_0x1beb('0xf'),auth[_0x1beb('0x9')](),controller['removeDispositions']);router[_0x1beb('0x22')](_0x1beb('0x11'),auth[_0x1beb('0x9')](),controller[_0x1beb('0x23')]);router['delete'](_0x1beb('0x13'),auth[_0x1beb('0x9')](),controller[_0x1beb('0x24')]);module[_0x1beb('0x25')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index ab17273..235cd61 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 _0x39f0=['BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','ENUM','twilio','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x370035,_0x428ff8){var _0x499abd=function(_0x2a2ac1){while(--_0x2a2ac1){_0x370035['push'](_0x370035['shift']());}};_0x499abd(++_0x428ff8);}(_0x39f0,0x1d1));var _0x039f=function(_0x768ec5,_0x2b808e){_0x768ec5=_0x768ec5-0x0;var _0x2f6cf7=_0x39f0[_0x768ec5];return _0x2f6cf7;};'use strict';var Sequelize=require(_0x039f('0x0'));var rs=require(_0x039f('0x1'));module[_0x039f('0x2')]={'name':{'type':Sequelize[_0x039f('0x3')],'unique':_0x039f('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x039f('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x039f('0x3')],'defaultValue':function(){return rs[_0x039f('0x5')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x039f('0x6')](_0x039f('0x7'),_0x039f('0x8'))},'accountSid':{'type':Sequelize[_0x039f('0x3')]},'baseUrl':{'type':Sequelize[_0x039f('0x3')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x039f('0x9')],'defaultValue':function(){return _0x039f('0xa');}},'notificationSound':{'type':Sequelize[_0x039f('0xb')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x039f('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x039f('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x039f('0xb')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x039f('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x039f('0xc')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x039f('0xb')],'defaultValue':![],'comment':_0x039f('0xd'),'set':function(_0x4206ba){if(!_0x4206ba){this[_0x039f('0xe')](_0x039f('0xf'),null);}this[_0x039f('0xe')](_0x039f('0x10'),_0x4206ba);}},'description':{'type':Sequelize[_0x039f('0x3')]}}; \ No newline at end of file +var _0xc4dd=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING','name','generate','ENUM','twilio','sinch','TEXT'];(function(_0x4d1d2c,_0x44f4d8){var _0x2c4cb9=function(_0x4b0c5f){while(--_0x4b0c5f){_0x4d1d2c['push'](_0x4d1d2c['shift']());}};_0x2c4cb9(++_0x44f4d8);}(_0xc4dd,0x198));var _0xdc4d=function(_0x8385db,_0x4b8dba){_0x8385db=_0x8385db-0x0;var _0x5d6df1=_0xc4dd[_0x8385db];return _0x5d6df1;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0xdc4d('0x0')]={'name':{'type':Sequelize[_0xdc4d('0x1')],'unique':_0xdc4d('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0xdc4d('0x1')],'allowNull':![]},'remote':{'type':Sequelize[_0xdc4d('0x1')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xdc4d('0x3')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xdc4d('0x4')](_0xdc4d('0x5'),_0xdc4d('0x6'))},'accountSid':{'type':Sequelize[_0xdc4d('0x1')]},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0xdc4d('0x1')]},'notificationTemplate':{'type':Sequelize[_0xdc4d('0x7')],'defaultValue':function(){return _0xdc4d('0x8');}},'notificationSound':{'type':Sequelize[_0xdc4d('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xdc4d('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xdc4d('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xdc4d('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xdc4d('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xdc4d('0xa')],'comment':_0xdc4d('0xb')},'mandatoryDisposition':{'type':Sequelize[_0xdc4d('0x9')],'defaultValue':![],'comment':_0xdc4d('0xc'),'set':function(_0x1d9334){if(!_0x1d9334){this[_0xdc4d('0xd')](_0xdc4d('0xe'),null);}this['setDataValue'](_0xdc4d('0xf'),_0x1d9334);}},'description':{'type':Sequelize[_0xdc4d('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 3bdc6c0..6c96e3e 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 _0xd527=['list','contact','WhatsappInteraction','interaction','push','*,*,*,*','created','ContactId','AttachmentId','UserId','applications','unshift','agent','queueId','WhatsappQueue','waitForTheAssignedQueue','Start','startRouting','info','entity\x20found','set','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','CmList','List','out','Messages','spread','dataValues','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','defaults','redis','localhost','http','request','then','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','result','message','catch','sendStatus','status','end','json','undefined','limit','offset','count','Content-Range','save','destroy','get','WhatsappAccounts','index','Pause','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','pick','filter','where','merge','name','options','WhatsappAccount','includeAll','findAll','show','params','mandatoryDispositionPause','include','find','create','body','user','role','UserProfileSection','UserProfileResource','update','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','hasOwnProperty','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','rows','removeAnswers','addAgents','omit','userWhatsappAccount:save','removeAgents','emit','userWhatsappAccount:remove','getAgents','findOne','User','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','findAndCountAll','priority','stack','send','getApplications','whatsapp','Applications','account','sinch','statuses','state','read','WhatsappMessage','message_id','asc','CmContact','Sequelize','ValidationError','updatedAt','difference','createdAt','ListId','mobile','twilio','From','replace','Body','messageId','MessageSid','from','notifications','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','Contacts','DESC'];(function(_0x3c2731,_0x1ddfb5){var _0x1a851b=function(_0x1e7bbc){while(--_0x1e7bbc){_0x3c2731['push'](_0x3c2731['shift']());}};_0x1a851b(++_0x1ddfb5);}(_0xd527,0x195));var _0x7d52=function(_0x359377,_0x1a63ef){_0x359377=_0x359377-0x0;var _0x8be18a=_0xd527[_0x359377];return _0x8be18a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7d52('0x0'));var zipdir=require(_0x7d52('0x1'));var jsonpatch=require(_0x7d52('0x2'));var rp=require(_0x7d52('0x3'));var moment=require(_0x7d52('0x4'));var BPromise=require(_0x7d52('0x5'));var Mustache=require(_0x7d52('0x6'));var util=require(_0x7d52('0x7'));var path=require(_0x7d52('0x8'));var sox=require(_0x7d52('0x9'));var csv=require(_0x7d52('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x7d52('0xb'));var jsforce=require(_0x7d52('0xc'));var deskjs=require(_0x7d52('0xd'));var toCsv=require(_0x7d52('0xa'));var querystring=require('querystring');var Papa=require(_0x7d52('0xe'));var Redis=require('ioredis');var authService=require(_0x7d52('0xf'));var qs=require(_0x7d52('0x10'));var as=require(_0x7d52('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7d52('0x12'))(_0x7d52('0x13'));var utils=require(_0x7d52('0x14'));var config=require(_0x7d52('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x7d52('0x16')](config[_0x7d52('0x17')],{'host':_0x7d52('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./whatsappAccount.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x7d52('0x19')]({'port':0x232c});function respondWithRpcPromise(_0x4730ba,_0x36a8fb,_0x242e0a,_0x38762f){return new BPromise(function(_0x4a8cb1,_0x44cf57){var _0x383368=_0x38762f||client;return _0x383368[_0x7d52('0x1a')](_0x4730ba,_0x242e0a)[_0x7d52('0x1b')](function(_0x3a244e){logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x36a8fb,_0x7d52('0x1c'));logger[_0x7d52('0x1d')](_0x7d52('0x1e'),_0x36a8fb,_0x7d52('0x1c'),JSON[_0x7d52('0x1f')](_0x3a244e));if(_0x3a244e[_0x7d52('0x20')]){if(_0x3a244e[_0x7d52('0x20')][_0x7d52('0x21')]===0x1f4){logger[_0x7d52('0x20')](_0x7d52('0x22'),_0x36a8fb,_0x3a244e['error']['message']);return _0x44cf57(_0x3a244e[_0x7d52('0x20')]['message']);}logger[_0x7d52('0x20')](_0x7d52('0x22'),_0x36a8fb,_0x3a244e['error']['message']);return _0x4a8cb1(_0x3a244e[_0x7d52('0x20')]['message']);}else{logger['info'](_0x7d52('0x22'),_0x36a8fb,_0x7d52('0x1c'));_0x4a8cb1(_0x3a244e[_0x7d52('0x23')][_0x7d52('0x24')]);}})[_0x7d52('0x25')](function(_0x17f7c4){logger['error'](_0x7d52('0x22'),_0x36a8fb,_0x17f7c4);_0x44cf57(_0x17f7c4);});});}function respondWithStatusCode(_0x5063fe,_0x45847a){_0x45847a=_0x45847a||0xcc;return function(_0x546267){if(_0x546267){return _0x5063fe[_0x7d52('0x26')](_0x45847a);}return _0x5063fe[_0x7d52('0x27')](_0x45847a)[_0x7d52('0x28')]();};}function respondWithResult(_0x18d3d2,_0x379a55){_0x379a55=_0x379a55||0xc8;return function(_0x54881b){if(_0x54881b){return _0x18d3d2[_0x7d52('0x27')](_0x379a55)[_0x7d52('0x29')](_0x54881b);}};}function respondWithFilteredResult(_0x2de71a,_0x441ca0){return function(_0x3b2dda){if(_0x3b2dda){var _0xa618b0=typeof _0x441ca0['offset']===_0x7d52('0x2a')&&typeof _0x441ca0[_0x7d52('0x2b')]===_0x7d52('0x2a');var _0x4c15f3=_0x3b2dda['count'];var _0x2164ff=_0xa618b0?0x0:_0x441ca0[_0x7d52('0x2c')];var _0x253c4b=_0xa618b0?_0x3b2dda[_0x7d52('0x2d')]:_0x441ca0[_0x7d52('0x2c')]+_0x441ca0['limit'];var _0x6bb51c;if(_0x253c4b>=_0x4c15f3){_0x253c4b=_0x4c15f3;_0x6bb51c=0xc8;}else{_0x6bb51c=0xce;}_0x2de71a[_0x7d52('0x27')](_0x6bb51c);return _0x2de71a['set'](_0x7d52('0x2e'),_0x2164ff+'-'+_0x253c4b+'/'+_0x4c15f3)[_0x7d52('0x29')](_0x3b2dda);}return null;};}function patchUpdates(_0xe5edd2){return function(_0x2d6f13){try{jsonpatch['apply'](_0x2d6f13,_0xe5edd2,!![]);}catch(_0x1a091d){return BPromise['reject'](_0x1a091d);}return _0x2d6f13[_0x7d52('0x2f')]();};}function saveUpdates(_0x1ee5dc,_0x324ea8){return function(_0x31d739){if(_0x31d739){return _0x31d739['update'](_0x1ee5dc)[_0x7d52('0x1b')](function(_0x14d2ad){return _0x14d2ad;});}return null;};}function removeEntity(_0x249d99,_0x528662){return function(_0x1267cb){if(_0x1267cb){return _0x1267cb[_0x7d52('0x30')]()[_0x7d52('0x1b')](function(){var _0x5824ac=_0x1267cb[_0x7d52('0x31')]({'plain':!![]});var _0x1811a2=_0x7d52('0x32');return db['UserProfileResource'][_0x7d52('0x30')]({'where':{'type':_0x1811a2,'resourceId':_0x5824ac['id']}})[_0x7d52('0x1b')](function(){return _0x1267cb;});})['then'](function(){_0x249d99[_0x7d52('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x139c5a,_0xfa81b9){return function(_0x277c8a){if(!_0x277c8a){_0x139c5a['sendStatus'](0x194);}return _0x277c8a;};}function handleError(_0x2910c,_0x5ecd32){_0x5ecd32=_0x5ecd32||0x1f4;return function(_0x27df90){logger['error'](_0x27df90['stack']);if(_0x27df90['name']){delete _0x27df90['name'];}_0x2910c[_0x7d52('0x27')](_0x5ecd32)['send'](_0x27df90);};}exports[_0x7d52('0x33')]=function(_0x495b4e,_0x5b9d54){var _0x2ac657={'include':[{'model':db[_0x7d52('0x34')],'as':'mandatoryDispositionPause'}]},_0x22ddf3={},_0x4e8c71={'count':0x0,'rows':[]};var _0x1a5e42=_[_0x7d52('0x35')](db['WhatsappAccount'][_0x7d52('0x36')],function(_0x7000ea){return{'name':_0x7000ea[_0x7d52('0x37')],'type':_0x7000ea[_0x7d52('0x38')][_0x7d52('0x39')]};});_0x22ddf3['model']=_[_0x7d52('0x35')](_0x1a5e42,'name');_0x22ddf3[_0x7d52('0x3a')]=_[_0x7d52('0x3b')](_0x495b4e['query']);_0x22ddf3[_0x7d52('0x3c')]=_[_0x7d52('0x3d')](_0x22ddf3[_0x7d52('0x3e')],_0x22ddf3[_0x7d52('0x3a')]);_0x2ac657['attributes']=_['intersection'](_0x22ddf3['model'],qs['fields'](_0x495b4e[_0x7d52('0x3a')][_0x7d52('0x3f')]));_0x2ac657[_0x7d52('0x40')]=_0x2ac657[_0x7d52('0x40')][_0x7d52('0x41')]?_0x2ac657[_0x7d52('0x40')]:_0x22ddf3[_0x7d52('0x3e')];if(!_0x495b4e['query']['hasOwnProperty'](_0x7d52('0x42'))){_0x2ac657[_0x7d52('0x2b')]=qs[_0x7d52('0x2b')](_0x495b4e['query']['limit']);_0x2ac657['offset']=qs[_0x7d52('0x2c')](_0x495b4e[_0x7d52('0x3a')][_0x7d52('0x2c')]);}_0x2ac657[_0x7d52('0x43')]=qs[_0x7d52('0x44')](_0x495b4e[_0x7d52('0x3a')][_0x7d52('0x44')]);_0x2ac657['where']=qs[_0x7d52('0x3c')](_[_0x7d52('0x45')](_0x495b4e[_0x7d52('0x3a')],_0x22ddf3['filters']),_0x1a5e42);if(_0x495b4e[_0x7d52('0x3a')][_0x7d52('0x46')]){_0x2ac657[_0x7d52('0x47')]=_[_0x7d52('0x48')](_0x2ac657[_0x7d52('0x47')],{'$or':_[_0x7d52('0x35')](_0x1a5e42,function(_0x1020db){if(_0x1020db[_0x7d52('0x38')]!=='VIRTUAL'){var _0x210466={};_0x210466[_0x1020db[_0x7d52('0x49')]]={'$like':'%'+_0x495b4e['query'][_0x7d52('0x46')]+'%'};return _0x210466;}})});}_0x2ac657=_[_0x7d52('0x48')]({},_0x2ac657,_0x495b4e[_0x7d52('0x4a')]);var _0x35a383={'where':_0x2ac657[_0x7d52('0x47')]};return db[_0x7d52('0x4b')][_0x7d52('0x2d')](_0x35a383)[_0x7d52('0x1b')](function(_0x1442ff){_0x4e8c71[_0x7d52('0x2d')]=_0x1442ff;if(_0x495b4e['query'][_0x7d52('0x4c')]){_0x2ac657['include']=[{'all':!![]}];}return db[_0x7d52('0x4b')][_0x7d52('0x4d')](_0x2ac657);})[_0x7d52('0x1b')](function(_0x5e3b14){_0x4e8c71['rows']=_0x5e3b14;return _0x4e8c71;})[_0x7d52('0x1b')](respondWithFilteredResult(_0x5b9d54,_0x2ac657))[_0x7d52('0x25')](handleError(_0x5b9d54,null));};exports[_0x7d52('0x4e')]=function(_0x468191,_0x15b64c){var _0x4c7c93={'raw':![],'where':{'id':_0x468191[_0x7d52('0x4f')]['id']},'include':[{'model':db[_0x7d52('0x34')],'as':_0x7d52('0x50')}]},_0x1c1f53={};_0x1c1f53[_0x7d52('0x3e')]=_[_0x7d52('0x3b')](db[_0x7d52('0x4b')][_0x7d52('0x36')]);_0x1c1f53[_0x7d52('0x3a')]=_[_0x7d52('0x3b')](_0x468191[_0x7d52('0x3a')]);_0x1c1f53[_0x7d52('0x3c')]=_['intersection'](_0x1c1f53[_0x7d52('0x3e')],_0x1c1f53['query']);_0x4c7c93['attributes']=_[_0x7d52('0x3d')](_0x1c1f53[_0x7d52('0x3e')],qs[_0x7d52('0x3f')](_0x468191[_0x7d52('0x3a')][_0x7d52('0x3f')]));_0x4c7c93['attributes']=_0x4c7c93[_0x7d52('0x40')][_0x7d52('0x41')]?_0x4c7c93[_0x7d52('0x40')]:_0x1c1f53['model'];if(_0x468191['query'][_0x7d52('0x4c')]){_0x4c7c93[_0x7d52('0x51')]=[{'all':!![]}];}_0x4c7c93=_[_0x7d52('0x48')]({},_0x4c7c93,_0x468191[_0x7d52('0x4a')]);return db[_0x7d52('0x4b')][_0x7d52('0x52')](_0x4c7c93)[_0x7d52('0x1b')](handleEntityNotFound(_0x15b64c,null))[_0x7d52('0x1b')](respondWithResult(_0x15b64c,null))[_0x7d52('0x25')](handleError(_0x15b64c,null));};exports[_0x7d52('0x53')]=function(_0x44fb0e,_0x977f69){return db[_0x7d52('0x4b')]['create'](_0x44fb0e[_0x7d52('0x54')],{})['then'](function(_0x306f6b){var _0x4edb22=_0x44fb0e[_0x7d52('0x55')][_0x7d52('0x31')]({'plain':!![]});if(!_0x4edb22)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4edb22[_0x7d52('0x56')]===_0x7d52('0x55')){var _0x1a28ed=_0x306f6b[_0x7d52('0x31')]({'plain':!![]});var _0x3a5e9e='WhatsappAccounts';return db[_0x7d52('0x57')][_0x7d52('0x52')]({'where':{'name':_0x3a5e9e,'userProfileId':_0x4edb22['userProfileId']},'raw':!![]})[_0x7d52('0x1b')](function(_0x149aa6){if(_0x149aa6&&_0x149aa6['autoAssociation']===0x0){return db[_0x7d52('0x58')]['create']({'name':_0x1a28ed[_0x7d52('0x49')],'resourceId':_0x1a28ed['id'],'type':_0x149aa6['name'],'sectionId':_0x149aa6['id']},{})[_0x7d52('0x1b')](function(){return _0x306f6b;});}else{return _0x306f6b;}})[_0x7d52('0x25')](function(_0x13536c){logger[_0x7d52('0x20')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x13536c);throw _0x13536c;});}return _0x306f6b;})[_0x7d52('0x1b')](respondWithResult(_0x977f69,0xc9))[_0x7d52('0x25')](handleError(_0x977f69,null));};exports[_0x7d52('0x59')]=function(_0x1764ab,_0xab62c2){if(_0x1764ab[_0x7d52('0x54')]['id']){delete _0x1764ab[_0x7d52('0x54')]['id'];}return db[_0x7d52('0x4b')][_0x7d52('0x52')]({'where':{'id':_0x1764ab['params']['id']},'include':[{'model':db['Pause'],'as':_0x7d52('0x50')}]})[_0x7d52('0x1b')](handleEntityNotFound(_0xab62c2,null))[_0x7d52('0x1b')](saveUpdates(_0x1764ab[_0x7d52('0x54')],null))[_0x7d52('0x1b')](respondWithResult(_0xab62c2,null))[_0x7d52('0x25')](handleError(_0xab62c2,null));};exports[_0x7d52('0x30')]=function(_0x11e202,_0x1f0004){return db[_0x7d52('0x4b')][_0x7d52('0x52')]({'where':{'id':_0x11e202[_0x7d52('0x4f')]['id']}})[_0x7d52('0x1b')](handleEntityNotFound(_0x1f0004,null))['then'](removeEntity(_0x1f0004,null))[_0x7d52('0x25')](handleError(_0x1f0004,null));};exports[_0x7d52('0x5a')]=function(_0x3abeb2,_0x26ab0b){return db[_0x7d52('0x4b')][_0x7d52('0x5a')]()[_0x7d52('0x1b')](respondWithResult(_0x26ab0b,null))['catch'](handleError(_0x26ab0b,null));};exports[_0x7d52('0x5b')]=function(_0x115f46,_0x3b77d8,_0x3b51f8){if(_0x115f46['body']['id']){delete _0x115f46[_0x7d52('0x54')]['id'];}return db['WhatsappAccount'][_0x7d52('0x52')]({'where':{'id':_0x115f46['params']['id']}})[_0x7d52('0x1b')](handleEntityNotFound(_0x3b77d8,null))[_0x7d52('0x1b')](function(_0x5d04d0){if(_0x5d04d0){_0x115f46[_0x7d52('0x54')][_0x7d52('0x5c')]=_0x5d04d0['id'];return db[_0x7d52('0x5d')][_0x7d52('0x53')](_0x115f46['body']);}})[_0x7d52('0x1b')](respondWithResult(_0x3b77d8,null))[_0x7d52('0x25')](handleError(_0x3b77d8,null));};exports[_0x7d52('0x5e')]=function(_0xde3d4a,_0xaee02c,_0x393198){var _0x3980ea={'raw':![],'where':{}};var _0x514c98={};var _0x584adb={'count':0x0,'rows':[]};return db['WhatsappAccount']['findOne']({'where':{'id':_0xde3d4a[_0x7d52('0x4f')]['id']}})[_0x7d52('0x1b')](handleEntityNotFound(_0xaee02c,null))[_0x7d52('0x1b')](function(_0x4e812a){if(_0x4e812a){_0x514c98[_0x7d52('0x3e')]=_['keys'](db[_0x7d52('0x5d')][_0x7d52('0x36')]);_0x514c98['query']=_[_0x7d52('0x3b')](_0xde3d4a[_0x7d52('0x3a')]);_0x514c98[_0x7d52('0x3c')]=_[_0x7d52('0x3d')](_0x514c98[_0x7d52('0x3e')],_0x514c98['query']);_0x3980ea['attributes']=_['intersection'](_0x514c98[_0x7d52('0x3e')],qs['fields'](_0xde3d4a['query']['fields']));_0x3980ea['attributes']=_0x3980ea[_0x7d52('0x40')][_0x7d52('0x41')]?_0x3980ea[_0x7d52('0x40')]:_0x514c98[_0x7d52('0x3e')];if(!_0xde3d4a[_0x7d52('0x3a')][_0x7d52('0x5f')]('nolimit')){_0x3980ea[_0x7d52('0x2b')]=qs[_0x7d52('0x2b')](_0xde3d4a['query'][_0x7d52('0x2b')]);_0x3980ea['offset']=qs[_0x7d52('0x2c')](_0xde3d4a[_0x7d52('0x3a')]['offset']);}_0x3980ea[_0x7d52('0x43')]=qs[_0x7d52('0x44')](_0xde3d4a['query']['sort']);_0x3980ea[_0x7d52('0x47')]=qs['filters'](_[_0x7d52('0x45')](_0xde3d4a[_0x7d52('0x3a')],_0x514c98['filters']));_0x3980ea[_0x7d52('0x47')][_0x7d52('0x5c')]=_0x4e812a['id'];if(_0xde3d4a['query']['filter']){_0x3980ea[_0x7d52('0x47')]=_[_0x7d52('0x48')](_0x3980ea['where'],{'$or':_[_0x7d52('0x35')](_0x3980ea[_0x7d52('0x40')],function(_0x4ea1ac){var _0x18051a={};_0x18051a[_0x4ea1ac]={'$like':'%'+_0xde3d4a[_0x7d52('0x3a')][_0x7d52('0x46')]+'%'};return _0x18051a;})});}_0x3980ea=_[_0x7d52('0x48')]({},_0x3980ea,_0xde3d4a[_0x7d52('0x4a')]);return db[_0x7d52('0x5d')][_0x7d52('0x2d')]({'where':_0x3980ea['where']})[_0x7d52('0x1b')](function(_0x47f74f){_0x584adb[_0x7d52('0x2d')]=_0x47f74f;if(_0xde3d4a[_0x7d52('0x3a')][_0x7d52('0x4c')]){_0x3980ea[_0x7d52('0x51')]=[{'all':!![]}];}return db[_0x7d52('0x5d')][_0x7d52('0x4d')](_0x3980ea);})[_0x7d52('0x1b')](function(_0x3d8c0c){_0x584adb['rows']=_0x3d8c0c;return _0x584adb;});}})[_0x7d52('0x1b')](respondWithFilteredResult(_0xaee02c,_0x3980ea))[_0x7d52('0x25')](handleError(_0xaee02c,null));};exports[_0x7d52('0x60')]=function(_0x522744,_0x5ee5e3,_0x495c67){return db[_0x7d52('0x4b')][_0x7d52('0x52')]({'where':{'id':_0x522744[_0x7d52('0x4f')]['id']}})[_0x7d52('0x1b')](handleEntityNotFound(_0x5ee5e3,null))['then'](function(_0x2ec1c){if(_0x2ec1c){return _0x2ec1c[_0x7d52('0x60')](_0x522744['query'][_0x7d52('0x61')]);}})['then'](respondWithStatusCode(_0x5ee5e3,null))['catch'](handleError(_0x5ee5e3,null));};exports[_0x7d52('0x62')]=function(_0x18bd06,_0x50bdd1,_0x104b05){if(_0x18bd06[_0x7d52('0x54')]['id']){delete _0x18bd06['body']['id'];}return db[_0x7d52('0x4b')][_0x7d52('0x52')]({'where':{'id':_0x18bd06[_0x7d52('0x4f')]['id']}})[_0x7d52('0x1b')](handleEntityNotFound(_0x50bdd1,null))[_0x7d52('0x1b')](function(_0x4acbdd){if(_0x4acbdd){_0x18bd06[_0x7d52('0x54')][_0x7d52('0x5c')]=_0x4acbdd['id'];return db['CannedAnswer']['create'](_0x18bd06[_0x7d52('0x54')]);}})['then'](respondWithResult(_0x50bdd1,null))['catch'](handleError(_0x50bdd1,null));};exports[_0x7d52('0x63')]=function(_0x15b895,_0x585884,_0x4939fa){var _0x28e510={'raw':![],'where':{}};var _0x843f5d={};var _0x50b990={'count':0x0,'rows':[]};return db[_0x7d52('0x4b')]['findOne']({'where':{'id':_0x15b895['params']['id']}})[_0x7d52('0x1b')](handleEntityNotFound(_0x585884,null))['then'](function(_0x950490){if(_0x950490){_0x843f5d[_0x7d52('0x3e')]=_[_0x7d52('0x3b')](db[_0x7d52('0x64')][_0x7d52('0x36')]);_0x843f5d[_0x7d52('0x3a')]=_[_0x7d52('0x3b')](_0x15b895[_0x7d52('0x3a')]);_0x843f5d['filters']=_[_0x7d52('0x3d')](_0x843f5d[_0x7d52('0x3e')],_0x843f5d[_0x7d52('0x3a')]);_0x28e510['attributes']=_[_0x7d52('0x3d')](_0x843f5d[_0x7d52('0x3e')],qs[_0x7d52('0x3f')](_0x15b895[_0x7d52('0x3a')][_0x7d52('0x3f')]));_0x28e510['attributes']=_0x28e510[_0x7d52('0x40')][_0x7d52('0x41')]?_0x28e510['attributes']:_0x843f5d[_0x7d52('0x3e')];if(!_0x15b895[_0x7d52('0x3a')][_0x7d52('0x5f')](_0x7d52('0x42'))){_0x28e510[_0x7d52('0x2b')]=qs[_0x7d52('0x2b')](_0x15b895[_0x7d52('0x3a')][_0x7d52('0x2b')]);_0x28e510['offset']=qs[_0x7d52('0x2c')](_0x15b895[_0x7d52('0x3a')][_0x7d52('0x2c')]);}_0x28e510[_0x7d52('0x43')]=qs[_0x7d52('0x44')](_0x15b895[_0x7d52('0x3a')]['sort']);_0x28e510[_0x7d52('0x47')]=qs['filters'](_[_0x7d52('0x45')](_0x15b895[_0x7d52('0x3a')],_0x843f5d[_0x7d52('0x3c')]));_0x28e510[_0x7d52('0x47')]['WhatsappAccountId']=_0x950490['id'];if(_0x15b895[_0x7d52('0x3a')][_0x7d52('0x46')]){_0x28e510[_0x7d52('0x47')]=_[_0x7d52('0x48')](_0x28e510[_0x7d52('0x47')],{'$or':_[_0x7d52('0x35')](_0x28e510[_0x7d52('0x40')],function(_0xdc8f3){var _0x3665a8={};_0x3665a8[_0xdc8f3]={'$like':'%'+_0x15b895[_0x7d52('0x3a')]['filter']+'%'};return _0x3665a8;})});}_0x28e510=_[_0x7d52('0x48')]({},_0x28e510,_0x15b895['options']);return db[_0x7d52('0x64')][_0x7d52('0x2d')]({'where':_0x28e510[_0x7d52('0x47')]})[_0x7d52('0x1b')](function(_0x5deb63){_0x50b990[_0x7d52('0x2d')]=_0x5deb63;if(_0x15b895[_0x7d52('0x3a')][_0x7d52('0x4c')]){_0x28e510[_0x7d52('0x51')]=[{'all':!![]}];}return db[_0x7d52('0x64')][_0x7d52('0x4d')](_0x28e510);})[_0x7d52('0x1b')](function(_0x59abcd){_0x50b990[_0x7d52('0x65')]=_0x59abcd;return _0x50b990;});}})[_0x7d52('0x1b')](respondWithFilteredResult(_0x585884,_0x28e510))[_0x7d52('0x25')](handleError(_0x585884,null));};exports[_0x7d52('0x66')]=function(_0xf24b7,_0x4a0bbe,_0x314228){return db[_0x7d52('0x4b')][_0x7d52('0x52')]({'where':{'id':_0xf24b7[_0x7d52('0x4f')]['id']}})[_0x7d52('0x1b')](handleEntityNotFound(_0x4a0bbe,null))['then'](function(_0x287360){if(_0x287360){return _0x287360[_0x7d52('0x66')](_0xf24b7[_0x7d52('0x3a')][_0x7d52('0x61')]);}})['then'](respondWithStatusCode(_0x4a0bbe,null))['catch'](handleError(_0x4a0bbe,null));};exports[_0x7d52('0x67')]=function(_0x3f38be,_0x2abb17,_0x3238f6){return db[_0x7d52('0x4b')]['find']({'where':{'id':_0x3f38be[_0x7d52('0x4f')]['id']}})['then'](handleEntityNotFound(_0x2abb17,null))[_0x7d52('0x1b')](function(_0x43c3fd){if(_0x43c3fd){return _0x43c3fd[_0x7d52('0x67')](_0x3f38be['body'][_0x7d52('0x61')],_[_0x7d52('0x68')](_0x3f38be[_0x7d52('0x54')],[_0x7d52('0x61'),'id'])||{})['spread'](function(_0x2ec51e){for(var _0x360ec5=0x0;_0x360ec5<_0x3f38be[_0x7d52('0x54')][_0x7d52('0x61')]['length'];_0x360ec5+=0x1){socket['emit'](_0x7d52('0x69'),{'UserId':Number(_0x3f38be[_0x7d52('0x54')][_0x7d52('0x61')][_0x360ec5]),'WhatsappAccountId':Number(_0x3f38be[_0x7d52('0x4f')]['id'])});}return _0x2ec51e;});}})[_0x7d52('0x1b')](respondWithResult(_0x2abb17,null))['catch'](handleError(_0x2abb17,null));};exports[_0x7d52('0x6a')]=function(_0x11dbb3,_0x46151c,_0x38b96e){return db['WhatsappAccount']['find']({'where':{'id':_0x11dbb3[_0x7d52('0x4f')]['id']}})['then'](handleEntityNotFound(_0x46151c,null))[_0x7d52('0x1b')](function(_0x3b60e0){if(_0x3b60e0){return _0x3b60e0['removeAgents'](_0x11dbb3['query']['ids'])[_0x7d52('0x1b')](function(){if(_['isArray'](_0x11dbb3[_0x7d52('0x3a')]['ids'])){for(var _0x2a8965=0x0;_0x2a8965<_0x11dbb3[_0x7d52('0x3a')][_0x7d52('0x61')][_0x7d52('0x41')];_0x2a8965+=0x1){socket[_0x7d52('0x6b')](_0x7d52('0x6c'),{'UserId':Number(_0x11dbb3[_0x7d52('0x3a')][_0x7d52('0x61')][_0x2a8965]),'WhatsappAccountId':Number(_0x11dbb3['params']['id'])});}}else{socket[_0x7d52('0x6b')](_0x7d52('0x6c'),{'UserId':Number(_0x11dbb3[_0x7d52('0x3a')]['ids']),'WhatsappAccountId':Number(_0x11dbb3[_0x7d52('0x4f')]['id'])});}});}})[_0x7d52('0x1b')](respondWithStatusCode(_0x46151c,null))[_0x7d52('0x25')](handleError(_0x46151c,null));};exports[_0x7d52('0x6d')]=function(_0x14c764,_0x43ba42,_0x797177){var _0x4d3694={};var _0x3763f4={};var _0x3ebea1;var _0x5a1d76;return db[_0x7d52('0x4b')][_0x7d52('0x6e')]({'where':{'id':_0x14c764['params']['id']}})['then'](handleEntityNotFound(_0x43ba42,null))[_0x7d52('0x1b')](function(_0x5bb787){if(_0x5bb787){_0x3ebea1=_0x5bb787;_0x3763f4[_0x7d52('0x3e')]=_['keys'](db[_0x7d52('0x6f')][_0x7d52('0x36')]);_0x3763f4[_0x7d52('0x3a')]=_['keys'](_0x14c764[_0x7d52('0x3a')]);_0x3763f4[_0x7d52('0x3c')]=_[_0x7d52('0x3d')](_0x3763f4[_0x7d52('0x3e')],_0x3763f4[_0x7d52('0x3a')]);_0x4d3694[_0x7d52('0x40')]=_['intersection'](_0x3763f4[_0x7d52('0x3e')],qs[_0x7d52('0x3f')](_0x14c764['query'][_0x7d52('0x3f')]));_0x4d3694[_0x7d52('0x40')]=_0x4d3694[_0x7d52('0x40')][_0x7d52('0x41')]?_0x4d3694[_0x7d52('0x40')]:_0x3763f4[_0x7d52('0x3e')];_0x4d3694['order']=qs['sort'](_0x14c764[_0x7d52('0x3a')]['sort']);_0x4d3694['where']=qs['filters'](_[_0x7d52('0x45')](_0x14c764['query'],_0x3763f4[_0x7d52('0x3c')]));if(_0x14c764[_0x7d52('0x3a')][_0x7d52('0x46')]){_0x4d3694[_0x7d52('0x47')]=_[_0x7d52('0x48')](_0x4d3694['where'],{'$or':_[_0x7d52('0x35')](_0x4d3694[_0x7d52('0x40')],function(_0x456dba){var _0x20b162={};_0x20b162[_0x456dba]={'$like':'%'+_0x14c764[_0x7d52('0x3a')]['filter']+'%'};return _0x20b162;})});}_0x4d3694=_[_0x7d52('0x48')]({},_0x4d3694,_0x14c764['options']);return _0x3ebea1[_0x7d52('0x6d')](_0x4d3694);}})[_0x7d52('0x1b')](function(_0x1b4ac6){if(_0x1b4ac6){_0x5a1d76=_0x1b4ac6['length'];if(!_0x14c764[_0x7d52('0x3a')][_0x7d52('0x5f')](_0x7d52('0x42'))){_0x4d3694['limit']=qs['limit'](_0x14c764[_0x7d52('0x3a')][_0x7d52('0x2b')]);_0x4d3694[_0x7d52('0x2c')]=qs[_0x7d52('0x2c')](_0x14c764['query'][_0x7d52('0x2c')]);}return _0x3ebea1[_0x7d52('0x6d')](_0x4d3694);}})[_0x7d52('0x1b')](function(_0x5b1af9){if(_0x5b1af9){return _0x5b1af9?{'count':_0x5a1d76,'rows':_0x5b1af9}:null;}})[_0x7d52('0x1b')](respondWithResult(_0x43ba42,null))[_0x7d52('0x25')](handleError(_0x43ba42,null));};exports[_0x7d52('0x70')]=function(_0x53f9dc,_0x3a6faf){var _0x51d997=_0x53f9dc[_0x7d52('0x4f')]['id'];var _0x278fb2=_0x53f9dc[_0x7d52('0x54')];var _0x5eb3a7=0xc8;var _0x57458b=null;return db[_0x7d52('0x71')][_0x7d52('0x72')]({'isolationLevel':db['sequelize']['Transaction'][_0x7d52('0x73')][_0x7d52('0x74')]},function(_0x244a07){return db[_0x7d52('0x4b')][_0x7d52('0x6e')]({'where':{'id':_0x51d997},'transaction':_0x244a07})[_0x7d52('0x1b')](function(_0x3b7d6d){if(_0x3b7d6d){return db[_0x7d52('0x75')][_0x7d52('0x30')]({'where':{'WhatsappAccountId':_0x51d997},'transaction':_0x244a07})[_0x7d52('0x1b')](function(){var _0x41c0e5=_[_0x7d52('0x35')](_0x278fb2,function(_0x1e095b){_0x1e095b[_0x7d52('0x5c')]=_0x51d997;return _0x1e095b;});return db['WhatsappApplication']['bulkCreate'](_0x41c0e5,{'transaction':_0x244a07});});}else{_0x5eb3a7=0x194;_0x57458b=[];}});})['then'](function(){if(_0x5eb3a7!==0x194){return db['WhatsappApplication'][_0x7d52('0x76')]({'where':{'WhatsappAccountId':_0x51d997},'order':_0x7d52('0x77')})['then'](function(_0x164e67){_0x57458b=_0x164e67;});}})[_0x7d52('0x25')](function(_0x1f0357){_0x5eb3a7=0x1f4;logger[_0x7d52('0x20')](_0x1f0357[_0x7d52('0x78')]);if(_0x1f0357[_0x7d52('0x49')]){delete _0x1f0357[_0x7d52('0x49')];}_0x57458b=_0x1f0357;})['finally'](function(){if(_0x57458b===null){_0x3a6faf[_0x7d52('0x26')](_0x5eb3a7);}else{if(_0x5eb3a7===0x1f4){_0x3a6faf[_0x7d52('0x27')](_0x5eb3a7)[_0x7d52('0x79')](_0x57458b);}else{_0x3a6faf[_0x7d52('0x27')](_0x5eb3a7)[_0x7d52('0x29')](_0x57458b);}}});};exports[_0x7d52('0x7a')]=function(_0x24ebbb,_0x51b7ec,_0x11e036){var _0x37198f={};var _0x335f92={};var _0x163cdf;var _0x5770a8;return db[_0x7d52('0x4b')][_0x7d52('0x6e')]({'where':{'id':_0x24ebbb[_0x7d52('0x4f')]['id']}})['then'](handleEntityNotFound(_0x51b7ec,null))[_0x7d52('0x1b')](function(_0xd67697){if(_0xd67697){_0x163cdf=_0xd67697;_0x335f92[_0x7d52('0x3e')]=_[_0x7d52('0x3b')](db['WhatsappApplication'][_0x7d52('0x36')]);_0x335f92['query']=_['keys'](_0x24ebbb['query']);_0x335f92[_0x7d52('0x3c')]=_[_0x7d52('0x3d')](_0x335f92['model'],_0x335f92[_0x7d52('0x3a')]);_0x37198f[_0x7d52('0x40')]=_[_0x7d52('0x3d')](_0x335f92[_0x7d52('0x3e')],qs['fields'](_0x24ebbb[_0x7d52('0x3a')]['fields']));_0x37198f[_0x7d52('0x40')]=_0x37198f[_0x7d52('0x40')][_0x7d52('0x41')]?_0x37198f[_0x7d52('0x40')]:_0x335f92[_0x7d52('0x3e')];_0x37198f[_0x7d52('0x43')]=qs['sort'](_0x24ebbb[_0x7d52('0x3a')][_0x7d52('0x44')]);_0x37198f[_0x7d52('0x47')]=qs[_0x7d52('0x3c')](_[_0x7d52('0x45')](_0x24ebbb[_0x7d52('0x3a')],_0x335f92[_0x7d52('0x3c')]));if(_0x24ebbb['query'][_0x7d52('0x46')]){_0x37198f[_0x7d52('0x47')]=_['merge'](_0x37198f[_0x7d52('0x47')],{'$or':_[_0x7d52('0x35')](_0x37198f[_0x7d52('0x40')],function(_0x54a33f){var _0x11112c={};_0x11112c[_0x54a33f]={'$like':'%'+_0x24ebbb[_0x7d52('0x3a')][_0x7d52('0x46')]+'%'};return _0x11112c;})});}_0x37198f=_[_0x7d52('0x48')]({},_0x37198f,_0x24ebbb[_0x7d52('0x4a')]);return _0x163cdf[_0x7d52('0x7a')](_0x37198f);}})[_0x7d52('0x1b')](function(_0x45d484){if(_0x45d484){_0x5770a8=_0x45d484[_0x7d52('0x41')];if(!_0x24ebbb[_0x7d52('0x3a')][_0x7d52('0x5f')](_0x7d52('0x42'))){_0x37198f[_0x7d52('0x2b')]=qs[_0x7d52('0x2b')](_0x24ebbb[_0x7d52('0x3a')][_0x7d52('0x2b')]);_0x37198f[_0x7d52('0x2c')]=qs[_0x7d52('0x2c')](_0x24ebbb[_0x7d52('0x3a')][_0x7d52('0x2c')]);}return _0x163cdf[_0x7d52('0x7a')](_0x37198f);}})['then'](function(_0x3f8a5e){if(_0x3f8a5e){return _0x3f8a5e?{'count':_0x5770a8,'rows':_0x3f8a5e}:null;}})[_0x7d52('0x1b')](respondWithResult(_0x51b7ec,null))[_0x7d52('0x25')](handleError(_0x51b7ec,null));};exports['notify']=function(_0x273942,_0x288a99,_0x27f8a2){var _0x532805={'channel':_0x7d52('0x7b')};var _0x466bba=[];var _0x2ba25f=[];var _0x1ad827={};return db['WhatsappAccount']['find']({'where':{'id':_0x273942[_0x7d52('0x4f')]['id']},'include':[{'model':db[_0x7d52('0x75')],'as':_0x7d52('0x7c')}]})[_0x7d52('0x1b')](handleEntityNotFound(_0x288a99,null))['then'](function(_0x5c5c4a){_0x532805[_0x7d52('0x7d')]=_0x5c5c4a;if(_0x532805[_0x7d52('0x7d')]&&_0x532805['account'][_0x7d52('0x38')]===_0x7d52('0x7e')&&_0x273942[_0x7d52('0x54')][_0x7d52('0x7f')]){if(_0x273942['body'][_0x7d52('0x7f')]['length']===0x0)return;if(_0x273942[_0x7d52('0x54')][_0x7d52('0x7f')][0x0][_0x7d52('0x80')]!==_0x7d52('0x81'))return;return db[_0x7d52('0x82')][_0x7d52('0x59')]({'read':!![],'readAt':_0x273942[_0x7d52('0x54')][_0x7d52('0x7f')][0x0]['timestamp']},{'where':{'messageId':_0x273942[_0x7d52('0x54')][_0x7d52('0x7f')][0x0][_0x7d52('0x83')]},'individualHooks':!![]})['then'](function(_0x4854b5){return _0x288a99[_0x7d52('0x27')](0xc8)[_0x7d52('0x29')](_0x4854b5);});}_0x532805['applications']=_['orderBy'](_0x5c5c4a[_0x7d52('0x7c')],[_0x7d52('0x77')],[_0x7d52('0x84')]);if(_0x532805[_0x7d52('0x7d')]['Applications']){delete _0x532805[_0x7d52('0x7d')][_0x7d52('0x7c')];}return db[_0x7d52('0x85')][_0x7d52('0x5a')]()['then'](function(_0x476683){if(!_0x476683){throw new db[(_0x7d52('0x86'))][(_0x7d52('0x87'))]('no\x20available\x20attributes');}_0x466bba=_['difference'](_[_0x7d52('0x3b')](_0x476683),['createdAt',_0x7d52('0x88')]);_0x2ba25f=_[_0x7d52('0x89')](_[_0x7d52('0x3b')](_0x476683),[_0x7d52('0x8a'),_0x7d52('0x88'),'CompanyId',_0x7d52('0x8b')]);_0x532805[_0x7d52('0x54')]={'mapKey':_0x7d52('0x8c')};if(_0x532805[_0x7d52('0x7d')]&&_0x532805['account'][_0x7d52('0x38')]===_0x7d52('0x8d')){_0x532805['body']['from']=_0x273942['body'][_0x7d52('0x8e')][_0x7d52('0x8f')]('whatsapp:','');_0x532805['body']['body']=_0x273942[_0x7d52('0x54')][_0x7d52('0x90')];_0x532805[_0x7d52('0x54')][_0x7d52('0x91')]=_0x273942[_0x7d52('0x54')][_0x7d52('0x92')];}if(_0x532805['account']&&_0x532805[_0x7d52('0x7d')][_0x7d52('0x38')]===_0x7d52('0x7e')){_0x532805[_0x7d52('0x54')][_0x7d52('0x93')]=_0x273942[_0x7d52('0x54')][_0x7d52('0x94')][0x0][_0x7d52('0x93')];_0x532805['body'][_0x7d52('0x54')]=_0x273942[_0x7d52('0x54')]['notifications'][0x0][_0x7d52('0x24')][_0x7d52('0x54')];_0x532805[_0x7d52('0x54')][_0x7d52('0x91')]=_0x273942[_0x7d52('0x54')][_0x7d52('0x94')][0x0][_0x7d52('0x83')];}if(_0x532805['body']['id']){delete _0x532805[_0x7d52('0x54')]['id'];}if(_[_0x7d52('0x95')](_0x532805[_0x7d52('0x54')][_0x7d52('0x93')])){throw new db[(_0x7d52('0x86'))][(_0x7d52('0x87'))](_0x7d52('0x96'));}if(_[_0x7d52('0x95')](_0x532805[_0x7d52('0x54')]['body'])||_0x532805['body'][_0x7d52('0x54')]===''){throw new db['Sequelize']['ValidationError'](_0x7d52('0x97'));}if(_[_0x7d52('0x95')](_0x532805[_0x7d52('0x54')][_0x7d52('0x98')])){throw new db[(_0x7d52('0x86'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2ba25f);}if(!_[_0x7d52('0x99')](_0x2ba25f,_0x532805[_0x7d52('0x54')]['mapKey'])){throw new db[(_0x7d52('0x86'))][(_0x7d52('0x87'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2ba25f);}_0x1ad827[_0x532805[_0x7d52('0x54')]['mapKey']]=_0x532805[_0x7d52('0x54')][_0x7d52('0x93')];return db['CmList'][_0x7d52('0x52')]({'where':{'id':_0x532805[_0x7d52('0x7d')][_0x7d52('0x8b')]},'include':[{'model':db[_0x7d52('0x85')],'as':_0x7d52('0x9a'),'where':_0x1ad827,'limit':0x1,'order':[['updatedAt',_0x7d52('0x9b')]]}]});})[_0x7d52('0x1b')](handleEntityNotFound(_0x288a99,null))[_0x7d52('0x1b')](function(_0x23b72d){if(_0x23b72d){_0x532805[_0x7d52('0x9c')]=_[_0x7d52('0x68')](_0x23b72d,[_0x7d52('0x9a')]);if(_0x23b72d[_0x7d52('0x9a')][_0x7d52('0x41')]){return _0x23b72d[_0x7d52('0x9a')][0x0];}var _0x191fe1=_[_0x7d52('0x16')](_0x532805[_0x7d52('0x54')],{'firstName':_0x532805[_0x7d52('0x54')][_0x7d52('0x93')],'ListId':_0x23b72d['id']});_0x191fe1[_0x532805['body']['mapKey']]=_0x532805[_0x7d52('0x54')]['from'];return db['CmContact'][_0x7d52('0x53')](_0x191fe1,{'fields':_0x466bba,'raw':!![]});}})[_0x7d52('0x1b')](handleEntityNotFound(_0x288a99,null))[_0x7d52('0x1b')](function(_0x446a0e){if(_0x446a0e){_0x532805[_0x7d52('0x9d')]=_0x446a0e;var _0x288d9b={'ContactId':_0x446a0e['id'],'phone':_0x532805[_0x7d52('0x54')][_0x7d52('0x93')],'WhatsappAccountId':_0x273942[_0x7d52('0x4f')]['id']};var _0x37eb7a={'ContactId':_0x446a0e['id'],'WhatsappAccountId':_0x273942[_0x7d52('0x4f')]['id'],'closed':![]};return db[_0x7d52('0x9e')][_0x7d52('0x52')]({'where':_0x37eb7a})['then'](function(_0x3619cc){if(_0x3619cc){return[_0x3619cc,![]];}return db[_0x7d52('0x9e')][_0x7d52('0x53')](_0x288d9b)[_0x7d52('0x1b')](function(_0x1af785){return[_0x1af785,!![]];});});}})['spread'](function(_0x132256,_0x262682){_0x532805[_0x7d52('0x9f')]=_0x132256[_0x7d52('0x31')]({'plain':!![]});_0x532805[_0x7d52('0x9f')]['created']=![];if(_0x262682){if(_0x532805[_0x7d52('0x7d')]['autoclose']){_0x532805['applications'][_0x7d52('0xa0')]({'id':0x0,'priority':_0x532805['applications']['length']+0x1,'app':'close','appdata':'unmanaged','interval':_0x7d52('0xa1')});}_0x532805[_0x7d52('0x9f')][_0x7d52('0xa2')]=!![];}return db[_0x7d52('0x82')]['create']({'phone':_0x532805[_0x7d52('0x54')][_0x7d52('0x93')],'messageId':_0x532805[_0x7d52('0x54')]['messageId'],'body':_0x532805[_0x7d52('0x54')]['body'],'WhatsappAccountId':_0x273942['params']['id'],'WhatsappInteractionId':_0x132256['id'],'direction':'in','ContactId':_0x132256[_0x7d52('0xa3')],'AttachmentId':_0x532805['body'][_0x7d52('0xa4')]});})[_0x7d52('0x1b')](function(_0x121641){_0x532805[_0x7d52('0x24')]=_0x121641;if(!_0x532805[_0x7d52('0x9f')][_0x7d52('0xa5')])return;return db['User']['find']({'attributes':['id',_0x7d52('0x49')],'where':{'id':_0x532805[_0x7d52('0x9f')][_0x7d52('0xa5')]}});})[_0x7d52('0x1b')](function(_0x19b57d){if(_0x19b57d){_0x532805[_0x7d52('0xa6')][_0x7d52('0xa7')]({'id':0x0,'priority':0x0,'app':_0x7d52('0xa8'),'appdata':_0x19b57d[_0x7d52('0x49')]+','+(_0x532805[_0x7d52('0x7d')]['waitForTheAssignedAgent']||0xa),'interval':_0x7d52('0xa1')});}if(!_0x532805[_0x7d52('0x9f')][_0x7d52('0xa9')])return;return db[_0x7d52('0xaa')]['find']({'attributes':['id',_0x7d52('0x49')],'where':{'id':_0x532805[_0x7d52('0x9f')][_0x7d52('0xa9')]}});})['then'](function(_0x2ec76a){if(_0x2ec76a){_0x532805[_0x7d52('0xa6')][_0x7d52('0xa7')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x2ec76a[_0x7d52('0x49')]+','+(_0x532805['account'][_0x7d52('0xab')]||0x12c),'interval':_0x7d52('0xa1')});}return respondWithRpcPromise(_0x7d52('0xac'),_0x7d52('0xad'),_0x532805);})['then'](function(_0x20bd07){if(_0x20bd07){var _0x1ea726=0xc8;var _0x4f02c7='receiveMessage';logger[_0x7d52('0xae')](_0x7d52('0x1e'),_0x4f02c7,_0x1ea726,_0x7d52('0xaf'));logger[_0x7d52('0x1d')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x4f02c7,_0x1ea726,_0x7d52('0xaf'),JSON[_0x7d52('0x1f')](_0x20bd07));if(_0x532805['account']['type']===_0x7d52('0x8d')){return _0x288a99['status'](_0x1ea726)[_0x7d52('0xb0')](_0x7d52('0xb1'),_0x7d52('0xb2'))['send'](_0x7d52('0xb3'));}else{return _0x288a99[_0x7d52('0x27')](_0x1ea726)['json'](_0x20bd07);}}});})['catch'](handleError(_0x288a99,null));};exports[_0x7d52('0x79')]=function(_0x705874,_0x2638b2,_0x5b2ff5){var _0x1c4b58,_0x57e1de,_0x3b7da1;if(_[_0x7d52('0x95')](_0x705874['body'][_0x7d52('0x54')])||_0x705874[_0x7d52('0x54')][_0x7d52('0x54')]===''){throw new db[(_0x7d52('0x86'))][(_0x7d52('0x87'))](_0x7d52('0x97'));}if(_[_0x7d52('0x95')](_0x705874[_0x7d52('0x54')]['to'])){throw new db['Sequelize'][(_0x7d52('0x87'))](_0x7d52('0xb4'));}_0x1c4b58=_0x705874[_0x7d52('0x54')]['to'];return db[_0x7d52('0x4b')][_0x7d52('0x52')]({'where':{'id':_0x705874['params']['id']},'include':[{'model':db[_0x7d52('0xb5')],'as':_0x7d52('0xb6'),'include':[{'model':db['CmContact'],'as':_0x7d52('0x9a'),'where':{'mobile':_0x1c4b58},'limit':0x1,'order':[[_0x7d52('0x88'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x2638b2,null))[_0x7d52('0x1b')](function(_0x1be999){if(_0x1be999&&_0x1be999[_0x7d52('0xb6')]){_0x57e1de=_0x1be999[_0x7d52('0x31')]({'plain':!![]});if(_0x57e1de[_0x7d52('0xb6')]&&_0x57e1de['List']['Contacts'][_0x7d52('0x41')]){return _0x57e1de[_0x7d52('0xb6')][_0x7d52('0x9a')][0x0];}return db[_0x7d52('0x85')][_0x7d52('0x53')](_[_0x7d52('0x16')](_0x705874[_0x7d52('0x54')],{'firstName':_0x1c4b58,'mobile':_0x1c4b58,'phone':_0x1c4b58,'ListId':_0x57e1de['ListId']}));}})['then'](handleEntityNotFound(_0x2638b2,null))['then'](function(_0x153b9a){if(_0x153b9a){_0x3b7da1=_0x153b9a;return db[_0x7d52('0x9e')][_0x7d52('0x52')]({'where':{'ContactId':_0x3b7da1['id'],'closed':![],'WhatsappAccountId':_0x57e1de['id']}})[_0x7d52('0x1b')](function(_0x2a1018){if(_0x2a1018){return[_0x2a1018,![]];}return db[_0x7d52('0x9e')][_0x7d52('0x53')]({'UserId':_0x705874[_0x7d52('0x55')]['id'],'ContactId':_0x3b7da1['id'],'WhatsappAccountId':_0x57e1de['id'],'phone':_0x1c4b58,'firstMsgDirection':_0x7d52('0xb7'),'Messages':[_[_0x7d52('0x48')](_0x705874['body'],{'read':![],'body':_0x705874[_0x7d52('0x54')][_0x7d52('0x54')],'phone':_0x1c4b58,'WhatsappAccountId':_0x57e1de['id'],'UserId':_0x705874[_0x7d52('0x55')]['id'],'ContactId':_0x3b7da1['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0x7d52('0xb8')}]})[_0x7d52('0x1b')](function(_0x194999){return[_0x194999,!![]];});});}})[_0x7d52('0xb9')](function(_0x83cb74,_0x539b48){if(_0x539b48){return _0x83cb74;}return db[_0x7d52('0x82')]['create'](_[_0x7d52('0x48')](_0x705874['body'],{'read':![],'body':_0x705874[_0x7d52('0x54')]['body'],'phone':_0x1c4b58,'WhatsappAccountId':_0x57e1de['id'],'WhatsappInteractionId':_0x83cb74['id'],'UserId':_0x705874[_0x7d52('0x55')]['id'],'ContactId':_0x3b7da1['id']}))[_0x7d52('0x1b')](function(_0x90486b){_0x83cb74[_0x7d52('0xba')][_0x7d52('0xb8')]=[];_0x83cb74[_0x7d52('0xba')]['Messages'][_0x7d52('0xa0')](_0x90486b[_0x7d52('0xba')]);return _0x83cb74;});})[_0x7d52('0x1b')](respondWithResult(_0x2638b2,null))['catch'](handleError(_0x2638b2,null));}; \ No newline at end of file +var _0x0c99=['defaults','localhost','socket.io-emitter','./whatsappAccount.socket','jayson/promise','client','http','request','then','info','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','json','undefined','offset','count','limit','set','Content-Range','apply','reject','save','update','destroy','WhatsappAccounts','stack','name','send','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','type','options','include','findAll','rows','show','params','includeAll','merge','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','WhatsappAccountId','getDispositions','findOne','Disposition','order','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','addAgents','omit','spread','emit','removeAgents','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','WhatsappApplication','findAndCountAll','priority','finally','getApplications','notify','whatsapp','Applications','account','statuses','state','read','WhatsappMessage','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','twilio','from','From','replace','whatsapp:','Body','messageId','MessageSid','notifications','message_id','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','list','Contacts','contact','WhatsappInteraction','interaction','created','autoclose','push','applications','close','*,*,*,*','ContactId','AttachmentId','UserId','unshift','agent','WhatsappQueue','queueId','waitForTheAssignedQueue','startRouting','receiveMessage','entity\x20found','stringify','Content-Type','text/xml','to\x20is\x20mandatory','CmList','List','out','dataValues','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis'];(function(_0x81aa14,_0x283f55){var _0x403a23=function(_0x3d983c){while(--_0x3d983c){_0x81aa14['push'](_0x81aa14['shift']());}};_0x403a23(++_0x283f55);}(_0x0c99,0xac));var _0x90c9=function(_0x1ebce2,_0x10e903){_0x1ebce2=_0x1ebce2-0x0;var _0x4a330c=_0x0c99[_0x1ebce2];return _0x4a330c;};'use strict';var emlformat=require(_0x90c9('0x0'));var rimraf=require(_0x90c9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x90c9('0x2'));var rp=require(_0x90c9('0x3'));var moment=require(_0x90c9('0x4'));var BPromise=require(_0x90c9('0x5'));var Mustache=require('mustache');var util=require(_0x90c9('0x6'));var path=require('path');var sox=require(_0x90c9('0x7'));var csv=require(_0x90c9('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x90c9('0x9'));var _=require(_0x90c9('0xa'));var squel=require(_0x90c9('0xb'));var crypto=require(_0x90c9('0xc'));var jsforce=require(_0x90c9('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x90c9('0x8'));var querystring=require(_0x90c9('0xe'));var Papa=require('papaparse');var Redis=require(_0x90c9('0xf'));var authService=require(_0x90c9('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x90c9('0x11'));var hardwareService=require(_0x90c9('0x12'));var logger=require(_0x90c9('0x13'))(_0x90c9('0x14'));var utils=require(_0x90c9('0x15'));var config=require(_0x90c9('0x16'));var licenseUtil=require(_0x90c9('0x17'));var db=require(_0x90c9('0x18'))['db'];config[_0x90c9('0x19')]=_[_0x90c9('0x1a')](config[_0x90c9('0x19')],{'host':_0x90c9('0x1b'),'port':0x18eb});var socket=require(_0x90c9('0x1c'))(new Redis(config[_0x90c9('0x19')]));require(_0x90c9('0x1d'))['register'](socket);var jayson=require(_0x90c9('0x1e'));var client=jayson[_0x90c9('0x1f')][_0x90c9('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x3096f9,_0x578380,_0x4c9e9b,_0x515fdd){return new BPromise(function(_0x46e2be,_0x4f9718){var _0x298e3c=_0x515fdd||client;return _0x298e3c[_0x90c9('0x21')](_0x3096f9,_0x4c9e9b)[_0x90c9('0x22')](function(_0x17d145){logger[_0x90c9('0x23')]('WhatsappAccount,\x20%s,\x20%s',_0x578380,_0x90c9('0x24'));logger[_0x90c9('0x25')](_0x90c9('0x26'),_0x578380,'request\x20sent',JSON['stringify'](_0x17d145));if(_0x17d145[_0x90c9('0x27')]){if(_0x17d145['error'][_0x90c9('0x28')]===0x1f4){logger[_0x90c9('0x27')](_0x90c9('0x29'),_0x578380,_0x17d145[_0x90c9('0x27')][_0x90c9('0x2a')]);return _0x4f9718(_0x17d145[_0x90c9('0x27')]['message']);}logger[_0x90c9('0x27')](_0x90c9('0x29'),_0x578380,_0x17d145[_0x90c9('0x27')][_0x90c9('0x2a')]);return _0x46e2be(_0x17d145[_0x90c9('0x27')][_0x90c9('0x2a')]);}else{logger[_0x90c9('0x23')]('WhatsappAccount,\x20%s,\x20%s',_0x578380,_0x90c9('0x24'));_0x46e2be(_0x17d145[_0x90c9('0x2b')][_0x90c9('0x2a')]);}})[_0x90c9('0x2c')](function(_0x50d575){logger[_0x90c9('0x27')](_0x90c9('0x29'),_0x578380,_0x50d575);_0x4f9718(_0x50d575);});});}function respondWithStatusCode(_0x1703c6,_0x47d4e7){_0x47d4e7=_0x47d4e7||0xcc;return function(_0x5b7266){if(_0x5b7266){return _0x1703c6[_0x90c9('0x2d')](_0x47d4e7);}return _0x1703c6['status'](_0x47d4e7)[_0x90c9('0x2e')]();};}function respondWithResult(_0x1a562a,_0x36d867){_0x36d867=_0x36d867||0xc8;return function(_0x205348){if(_0x205348){return _0x1a562a[_0x90c9('0x2f')](_0x36d867)[_0x90c9('0x30')](_0x205348);}};}function respondWithFilteredResult(_0x1d3131,_0x34f39d){return function(_0x241b72){if(_0x241b72){var _0x41a6ed=typeof _0x34f39d['offset']==='undefined'&&typeof _0x34f39d['limit']===_0x90c9('0x31');var _0x4906c5=_0x241b72['count'];var _0x3146de=_0x41a6ed?0x0:_0x34f39d[_0x90c9('0x32')];var _0x333019=_0x41a6ed?_0x241b72[_0x90c9('0x33')]:_0x34f39d['offset']+_0x34f39d[_0x90c9('0x34')];var _0x13bfa7;if(_0x333019>=_0x4906c5){_0x333019=_0x4906c5;_0x13bfa7=0xc8;}else{_0x13bfa7=0xce;}_0x1d3131[_0x90c9('0x2f')](_0x13bfa7);return _0x1d3131[_0x90c9('0x35')](_0x90c9('0x36'),_0x3146de+'-'+_0x333019+'/'+_0x4906c5)[_0x90c9('0x30')](_0x241b72);}return null;};}function patchUpdates(_0x4ab85a){return function(_0xcc690d){try{jsonpatch[_0x90c9('0x37')](_0xcc690d,_0x4ab85a,!![]);}catch(_0x5a8d09){return BPromise[_0x90c9('0x38')](_0x5a8d09);}return _0xcc690d[_0x90c9('0x39')]();};}function saveUpdates(_0x2935ad,_0x1d6b28){return function(_0xc515fd){if(_0xc515fd){return _0xc515fd[_0x90c9('0x3a')](_0x2935ad)[_0x90c9('0x22')](function(_0x2ba901){return _0x2ba901;});}return null;};}function removeEntity(_0x1013c1,_0x21a975){return function(_0x295dc4){if(_0x295dc4){return _0x295dc4[_0x90c9('0x3b')]()[_0x90c9('0x22')](function(){var _0x38155a=_0x295dc4['get']({'plain':!![]});var _0xb345d9=_0x90c9('0x3c');return db['UserProfileResource'][_0x90c9('0x3b')]({'where':{'type':_0xb345d9,'resourceId':_0x38155a['id']}})[_0x90c9('0x22')](function(){return _0x295dc4;});})['then'](function(){_0x1013c1['status'](0xcc)[_0x90c9('0x2e')]();});}};}function handleEntityNotFound(_0x47b904,_0x3d1811){return function(_0x4fc61c){if(!_0x4fc61c){_0x47b904[_0x90c9('0x2d')](0x194);}return _0x4fc61c;};}function handleError(_0x3ccdc0,_0x780e41){_0x780e41=_0x780e41||0x1f4;return function(_0x2d7075){logger[_0x90c9('0x27')](_0x2d7075[_0x90c9('0x3d')]);if(_0x2d7075[_0x90c9('0x3e')]){delete _0x2d7075[_0x90c9('0x3e')];}_0x3ccdc0[_0x90c9('0x2f')](_0x780e41)[_0x90c9('0x3f')](_0x2d7075);};}exports[_0x90c9('0x40')]=function(_0x41b7bf,_0x41aff3){var _0x34cc31={'include':[{'model':db[_0x90c9('0x41')],'as':_0x90c9('0x42')}]},_0x51787e={},_0x103d16={'count':0x0,'rows':[]};var _0x31c6a7=_[_0x90c9('0x43')](db[_0x90c9('0x44')][_0x90c9('0x45')],function(_0x4d70f3){return{'name':_0x4d70f3[_0x90c9('0x46')],'type':_0x4d70f3['type'][_0x90c9('0x47')]};});_0x51787e[_0x90c9('0x48')]=_[_0x90c9('0x43')](_0x31c6a7,'name');_0x51787e[_0x90c9('0x49')]=_[_0x90c9('0x4a')](_0x41b7bf['query']);_0x51787e['filters']=_[_0x90c9('0x4b')](_0x51787e[_0x90c9('0x48')],_0x51787e[_0x90c9('0x49')]);_0x34cc31[_0x90c9('0x4c')]=_[_0x90c9('0x4b')](_0x51787e[_0x90c9('0x48')],qs['fields'](_0x41b7bf[_0x90c9('0x49')][_0x90c9('0x4d')]));_0x34cc31[_0x90c9('0x4c')]=_0x34cc31[_0x90c9('0x4c')][_0x90c9('0x4e')]?_0x34cc31['attributes']:_0x51787e[_0x90c9('0x48')];if(!_0x41b7bf['query'][_0x90c9('0x4f')](_0x90c9('0x50'))){_0x34cc31[_0x90c9('0x34')]=qs['limit'](_0x41b7bf[_0x90c9('0x49')][_0x90c9('0x34')]);_0x34cc31[_0x90c9('0x32')]=qs[_0x90c9('0x32')](_0x41b7bf[_0x90c9('0x49')][_0x90c9('0x32')]);}_0x34cc31['order']=qs[_0x90c9('0x51')](_0x41b7bf[_0x90c9('0x49')][_0x90c9('0x51')]);_0x34cc31[_0x90c9('0x52')]=qs[_0x90c9('0x53')](_[_0x90c9('0x54')](_0x41b7bf[_0x90c9('0x49')],_0x51787e['filters']),_0x31c6a7);if(_0x41b7bf['query'][_0x90c9('0x55')]){_0x34cc31[_0x90c9('0x52')]=_['merge'](_0x34cc31['where'],{'$or':_[_0x90c9('0x43')](_0x31c6a7,function(_0x50fc6b){if(_0x50fc6b[_0x90c9('0x56')]!=='VIRTUAL'){var _0x3a6eea={};_0x3a6eea[_0x50fc6b[_0x90c9('0x3e')]]={'$like':'%'+_0x41b7bf[_0x90c9('0x49')][_0x90c9('0x55')]+'%'};return _0x3a6eea;}})});}_0x34cc31=_['merge']({},_0x34cc31,_0x41b7bf[_0x90c9('0x57')]);var _0x302591={'where':_0x34cc31['where']};return db['WhatsappAccount'][_0x90c9('0x33')](_0x302591)['then'](function(_0x1e578c){_0x103d16[_0x90c9('0x33')]=_0x1e578c;if(_0x41b7bf[_0x90c9('0x49')]['includeAll']){_0x34cc31[_0x90c9('0x58')]=[{'all':!![]}];}return db[_0x90c9('0x44')][_0x90c9('0x59')](_0x34cc31);})[_0x90c9('0x22')](function(_0x573277){_0x103d16[_0x90c9('0x5a')]=_0x573277;return _0x103d16;})[_0x90c9('0x22')](respondWithFilteredResult(_0x41aff3,_0x34cc31))[_0x90c9('0x2c')](handleError(_0x41aff3,null));};exports[_0x90c9('0x5b')]=function(_0x16a66a,_0x372802){var _0x46d5a4={'raw':![],'where':{'id':_0x16a66a[_0x90c9('0x5c')]['id']},'include':[{'model':db['Pause'],'as':_0x90c9('0x42')}]},_0x5e2af4={};_0x5e2af4[_0x90c9('0x48')]=_[_0x90c9('0x4a')](db[_0x90c9('0x44')][_0x90c9('0x45')]);_0x5e2af4[_0x90c9('0x49')]=_[_0x90c9('0x4a')](_0x16a66a[_0x90c9('0x49')]);_0x5e2af4[_0x90c9('0x53')]=_['intersection'](_0x5e2af4['model'],_0x5e2af4[_0x90c9('0x49')]);_0x46d5a4['attributes']=_[_0x90c9('0x4b')](_0x5e2af4[_0x90c9('0x48')],qs[_0x90c9('0x4d')](_0x16a66a[_0x90c9('0x49')]['fields']));_0x46d5a4[_0x90c9('0x4c')]=_0x46d5a4[_0x90c9('0x4c')][_0x90c9('0x4e')]?_0x46d5a4[_0x90c9('0x4c')]:_0x5e2af4[_0x90c9('0x48')];if(_0x16a66a[_0x90c9('0x49')][_0x90c9('0x5d')]){_0x46d5a4[_0x90c9('0x58')]=[{'all':!![]}];}_0x46d5a4=_[_0x90c9('0x5e')]({},_0x46d5a4,_0x16a66a[_0x90c9('0x57')]);return db[_0x90c9('0x44')][_0x90c9('0x5f')](_0x46d5a4)[_0x90c9('0x22')](handleEntityNotFound(_0x372802,null))[_0x90c9('0x22')](respondWithResult(_0x372802,null))[_0x90c9('0x2c')](handleError(_0x372802,null));};exports[_0x90c9('0x60')]=function(_0x14cf4e,_0x17ce9d){return db[_0x90c9('0x44')][_0x90c9('0x60')](_0x14cf4e['body'],{})[_0x90c9('0x22')](function(_0xa70a3b){var _0x22a60e=_0x14cf4e[_0x90c9('0x61')][_0x90c9('0x62')]({'plain':!![]});if(!_0x22a60e)throw new Error(_0x90c9('0x63'));if(_0x22a60e[_0x90c9('0x64')]===_0x90c9('0x61')){var _0x4d5415=_0xa70a3b[_0x90c9('0x62')]({'plain':!![]});var _0x4a77b3='WhatsappAccounts';return db['UserProfileSection'][_0x90c9('0x5f')]({'where':{'name':_0x4a77b3,'userProfileId':_0x22a60e[_0x90c9('0x65')]},'raw':!![]})[_0x90c9('0x22')](function(_0x287225){if(_0x287225&&_0x287225[_0x90c9('0x66')]===0x0){return db[_0x90c9('0x67')]['create']({'name':_0x4d5415[_0x90c9('0x3e')],'resourceId':_0x4d5415['id'],'type':_0x287225[_0x90c9('0x3e')],'sectionId':_0x287225['id']},{})['then'](function(){return _0xa70a3b;});}else{return _0xa70a3b;}})[_0x90c9('0x2c')](function(_0x33cf61){logger[_0x90c9('0x27')](_0x90c9('0x68'),_0x33cf61);throw _0x33cf61;});}return _0xa70a3b;})[_0x90c9('0x22')](respondWithResult(_0x17ce9d,0xc9))[_0x90c9('0x2c')](handleError(_0x17ce9d,null));};exports['update']=function(_0x25dceb,_0x445e12){if(_0x25dceb[_0x90c9('0x69')]['id']){delete _0x25dceb[_0x90c9('0x69')]['id'];}return db[_0x90c9('0x44')][_0x90c9('0x5f')]({'where':{'id':_0x25dceb[_0x90c9('0x5c')]['id']},'include':[{'model':db[_0x90c9('0x41')],'as':_0x90c9('0x42')}]})['then'](handleEntityNotFound(_0x445e12,null))[_0x90c9('0x22')](saveUpdates(_0x25dceb['body'],null))['then'](respondWithResult(_0x445e12,null))[_0x90c9('0x2c')](handleError(_0x445e12,null));};exports['destroy']=function(_0x4725f6,_0xb11931){return db[_0x90c9('0x44')][_0x90c9('0x5f')]({'where':{'id':_0x4725f6['params']['id']}})[_0x90c9('0x22')](handleEntityNotFound(_0xb11931,null))['then'](removeEntity(_0xb11931,null))[_0x90c9('0x2c')](handleError(_0xb11931,null));};exports['describe']=function(_0x4bd474,_0x23cf18){return db['WhatsappAccount'][_0x90c9('0x6a')]()[_0x90c9('0x22')](respondWithResult(_0x23cf18,null))[_0x90c9('0x2c')](handleError(_0x23cf18,null));};exports[_0x90c9('0x6b')]=function(_0x2bc0b8,_0x2c2cb9,_0x51ac10){if(_0x2bc0b8[_0x90c9('0x69')]['id']){delete _0x2bc0b8[_0x90c9('0x69')]['id'];}return db[_0x90c9('0x44')]['find']({'where':{'id':_0x2bc0b8['params']['id']}})['then'](handleEntityNotFound(_0x2c2cb9,null))[_0x90c9('0x22')](function(_0x14dadf){if(_0x14dadf){_0x2bc0b8[_0x90c9('0x69')][_0x90c9('0x6c')]=_0x14dadf['id'];return db['Disposition'][_0x90c9('0x60')](_0x2bc0b8[_0x90c9('0x69')]);}})[_0x90c9('0x22')](respondWithResult(_0x2c2cb9,null))[_0x90c9('0x2c')](handleError(_0x2c2cb9,null));};exports[_0x90c9('0x6d')]=function(_0x5d0462,_0x1358fb,_0x402ea8){var _0x1afed5={'raw':![],'where':{}};var _0x3ffddb={};var _0x4fd59c={'count':0x0,'rows':[]};return db[_0x90c9('0x44')][_0x90c9('0x6e')]({'where':{'id':_0x5d0462[_0x90c9('0x5c')]['id']}})['then'](handleEntityNotFound(_0x1358fb,null))[_0x90c9('0x22')](function(_0x424281){if(_0x424281){_0x3ffddb['model']=_['keys'](db[_0x90c9('0x6f')][_0x90c9('0x45')]);_0x3ffddb[_0x90c9('0x49')]=_[_0x90c9('0x4a')](_0x5d0462['query']);_0x3ffddb[_0x90c9('0x53')]=_[_0x90c9('0x4b')](_0x3ffddb[_0x90c9('0x48')],_0x3ffddb[_0x90c9('0x49')]);_0x1afed5[_0x90c9('0x4c')]=_[_0x90c9('0x4b')](_0x3ffddb['model'],qs[_0x90c9('0x4d')](_0x5d0462['query'][_0x90c9('0x4d')]));_0x1afed5['attributes']=_0x1afed5[_0x90c9('0x4c')][_0x90c9('0x4e')]?_0x1afed5[_0x90c9('0x4c')]:_0x3ffddb[_0x90c9('0x48')];if(!_0x5d0462[_0x90c9('0x49')][_0x90c9('0x4f')](_0x90c9('0x50'))){_0x1afed5[_0x90c9('0x34')]=qs[_0x90c9('0x34')](_0x5d0462['query'][_0x90c9('0x34')]);_0x1afed5['offset']=qs['offset'](_0x5d0462[_0x90c9('0x49')][_0x90c9('0x32')]);}_0x1afed5[_0x90c9('0x70')]=qs[_0x90c9('0x51')](_0x5d0462['query'][_0x90c9('0x51')]);_0x1afed5[_0x90c9('0x52')]=qs[_0x90c9('0x53')](_[_0x90c9('0x54')](_0x5d0462[_0x90c9('0x49')],_0x3ffddb['filters']));_0x1afed5[_0x90c9('0x52')][_0x90c9('0x6c')]=_0x424281['id'];if(_0x5d0462[_0x90c9('0x49')]['filter']){_0x1afed5[_0x90c9('0x52')]=_[_0x90c9('0x5e')](_0x1afed5[_0x90c9('0x52')],{'$or':_[_0x90c9('0x43')](_0x1afed5[_0x90c9('0x4c')],function(_0x2f2c88){var _0x44231c={};_0x44231c[_0x2f2c88]={'$like':'%'+_0x5d0462['query'][_0x90c9('0x55')]+'%'};return _0x44231c;})});}_0x1afed5=_[_0x90c9('0x5e')]({},_0x1afed5,_0x5d0462['options']);return db[_0x90c9('0x6f')][_0x90c9('0x33')]({'where':_0x1afed5[_0x90c9('0x52')]})['then'](function(_0x24db1e){_0x4fd59c[_0x90c9('0x33')]=_0x24db1e;if(_0x5d0462[_0x90c9('0x49')][_0x90c9('0x5d')]){_0x1afed5[_0x90c9('0x58')]=[{'all':!![]}];}return db[_0x90c9('0x6f')]['findAll'](_0x1afed5);})[_0x90c9('0x22')](function(_0x563885){_0x4fd59c[_0x90c9('0x5a')]=_0x563885;return _0x4fd59c;});}})[_0x90c9('0x22')](respondWithFilteredResult(_0x1358fb,_0x1afed5))['catch'](handleError(_0x1358fb,null));};exports[_0x90c9('0x71')]=function(_0x21c9c9,_0x3e5321,_0x481f16){return db['WhatsappAccount'][_0x90c9('0x5f')]({'where':{'id':_0x21c9c9[_0x90c9('0x5c')]['id']}})[_0x90c9('0x22')](handleEntityNotFound(_0x3e5321,null))[_0x90c9('0x22')](function(_0x3569a1){if(_0x3569a1){return _0x3569a1[_0x90c9('0x71')](_0x21c9c9[_0x90c9('0x49')][_0x90c9('0x72')]);}})[_0x90c9('0x22')](respondWithStatusCode(_0x3e5321,null))[_0x90c9('0x2c')](handleError(_0x3e5321,null));};exports[_0x90c9('0x73')]=function(_0x3cdd4b,_0x4be6cf,_0x40efad){if(_0x3cdd4b['body']['id']){delete _0x3cdd4b[_0x90c9('0x69')]['id'];}return db[_0x90c9('0x44')]['find']({'where':{'id':_0x3cdd4b['params']['id']}})[_0x90c9('0x22')](handleEntityNotFound(_0x4be6cf,null))[_0x90c9('0x22')](function(_0x5f2363){if(_0x5f2363){_0x3cdd4b[_0x90c9('0x69')]['WhatsappAccountId']=_0x5f2363['id'];return db['CannedAnswer']['create'](_0x3cdd4b[_0x90c9('0x69')]);}})[_0x90c9('0x22')](respondWithResult(_0x4be6cf,null))[_0x90c9('0x2c')](handleError(_0x4be6cf,null));};exports[_0x90c9('0x74')]=function(_0x476745,_0x224194,_0x59d551){var _0x20f1ee={'raw':![],'where':{}};var _0x39a26c={};var _0x5acbc2={'count':0x0,'rows':[]};return db[_0x90c9('0x44')][_0x90c9('0x6e')]({'where':{'id':_0x476745['params']['id']}})['then'](handleEntityNotFound(_0x224194,null))[_0x90c9('0x22')](function(_0x3729ce){if(_0x3729ce){_0x39a26c[_0x90c9('0x48')]=_['keys'](db[_0x90c9('0x75')][_0x90c9('0x45')]);_0x39a26c[_0x90c9('0x49')]=_[_0x90c9('0x4a')](_0x476745[_0x90c9('0x49')]);_0x39a26c[_0x90c9('0x53')]=_[_0x90c9('0x4b')](_0x39a26c['model'],_0x39a26c[_0x90c9('0x49')]);_0x20f1ee[_0x90c9('0x4c')]=_[_0x90c9('0x4b')](_0x39a26c[_0x90c9('0x48')],qs['fields'](_0x476745[_0x90c9('0x49')]['fields']));_0x20f1ee[_0x90c9('0x4c')]=_0x20f1ee[_0x90c9('0x4c')][_0x90c9('0x4e')]?_0x20f1ee[_0x90c9('0x4c')]:_0x39a26c[_0x90c9('0x48')];if(!_0x476745[_0x90c9('0x49')]['hasOwnProperty'](_0x90c9('0x50'))){_0x20f1ee['limit']=qs[_0x90c9('0x34')](_0x476745[_0x90c9('0x49')][_0x90c9('0x34')]);_0x20f1ee[_0x90c9('0x32')]=qs['offset'](_0x476745[_0x90c9('0x49')][_0x90c9('0x32')]);}_0x20f1ee[_0x90c9('0x70')]=qs[_0x90c9('0x51')](_0x476745['query'][_0x90c9('0x51')]);_0x20f1ee[_0x90c9('0x52')]=qs[_0x90c9('0x53')](_['pick'](_0x476745[_0x90c9('0x49')],_0x39a26c[_0x90c9('0x53')]));_0x20f1ee[_0x90c9('0x52')][_0x90c9('0x6c')]=_0x3729ce['id'];if(_0x476745[_0x90c9('0x49')]['filter']){_0x20f1ee[_0x90c9('0x52')]=_['merge'](_0x20f1ee[_0x90c9('0x52')],{'$or':_['map'](_0x20f1ee[_0x90c9('0x4c')],function(_0x3fc7c2){var _0x5069e2={};_0x5069e2[_0x3fc7c2]={'$like':'%'+_0x476745['query'][_0x90c9('0x55')]+'%'};return _0x5069e2;})});}_0x20f1ee=_[_0x90c9('0x5e')]({},_0x20f1ee,_0x476745[_0x90c9('0x57')]);return db['CannedAnswer'][_0x90c9('0x33')]({'where':_0x20f1ee[_0x90c9('0x52')]})[_0x90c9('0x22')](function(_0x542512){_0x5acbc2[_0x90c9('0x33')]=_0x542512;if(_0x476745[_0x90c9('0x49')][_0x90c9('0x5d')]){_0x20f1ee[_0x90c9('0x58')]=[{'all':!![]}];}return db[_0x90c9('0x75')][_0x90c9('0x59')](_0x20f1ee);})[_0x90c9('0x22')](function(_0x4b5e56){_0x5acbc2[_0x90c9('0x5a')]=_0x4b5e56;return _0x5acbc2;});}})['then'](respondWithFilteredResult(_0x224194,_0x20f1ee))[_0x90c9('0x2c')](handleError(_0x224194,null));};exports['removeAnswers']=function(_0x3939d6,_0x473257,_0x416708){return db['WhatsappAccount']['find']({'where':{'id':_0x3939d6[_0x90c9('0x5c')]['id']}})[_0x90c9('0x22')](handleEntityNotFound(_0x473257,null))[_0x90c9('0x22')](function(_0xf5aa4b){if(_0xf5aa4b){return _0xf5aa4b['removeAnswers'](_0x3939d6[_0x90c9('0x49')][_0x90c9('0x72')]);}})[_0x90c9('0x22')](respondWithStatusCode(_0x473257,null))[_0x90c9('0x2c')](handleError(_0x473257,null));};exports['addAgents']=function(_0x2ed926,_0x122eb6,_0x150ece){return db['WhatsappAccount'][_0x90c9('0x5f')]({'where':{'id':_0x2ed926[_0x90c9('0x5c')]['id']}})[_0x90c9('0x22')](handleEntityNotFound(_0x122eb6,null))[_0x90c9('0x22')](function(_0x35ab1b){if(_0x35ab1b){return _0x35ab1b[_0x90c9('0x76')](_0x2ed926[_0x90c9('0x69')][_0x90c9('0x72')],_[_0x90c9('0x77')](_0x2ed926[_0x90c9('0x69')],[_0x90c9('0x72'),'id'])||{})[_0x90c9('0x78')](function(_0xa8d4ec){for(var _0xbcc6d2=0x0;_0xbcc6d2<_0x2ed926[_0x90c9('0x69')][_0x90c9('0x72')][_0x90c9('0x4e')];_0xbcc6d2+=0x1){socket[_0x90c9('0x79')]('userWhatsappAccount:save',{'UserId':Number(_0x2ed926[_0x90c9('0x69')][_0x90c9('0x72')][_0xbcc6d2]),'WhatsappAccountId':Number(_0x2ed926[_0x90c9('0x5c')]['id'])});}return _0xa8d4ec;});}})[_0x90c9('0x22')](respondWithResult(_0x122eb6,null))['catch'](handleError(_0x122eb6,null));};exports[_0x90c9('0x7a')]=function(_0x4e0e0c,_0x1b39d5,_0x2c289c){return db['WhatsappAccount'][_0x90c9('0x5f')]({'where':{'id':_0x4e0e0c[_0x90c9('0x5c')]['id']}})[_0x90c9('0x22')](handleEntityNotFound(_0x1b39d5,null))[_0x90c9('0x22')](function(_0x4d8fe2){if(_0x4d8fe2){return _0x4d8fe2[_0x90c9('0x7a')](_0x4e0e0c[_0x90c9('0x49')][_0x90c9('0x72')])[_0x90c9('0x22')](function(){if(_['isArray'](_0x4e0e0c[_0x90c9('0x49')][_0x90c9('0x72')])){for(var _0x47937a=0x0;_0x47937a<_0x4e0e0c[_0x90c9('0x49')][_0x90c9('0x72')][_0x90c9('0x4e')];_0x47937a+=0x1){socket[_0x90c9('0x79')](_0x90c9('0x7b'),{'UserId':Number(_0x4e0e0c[_0x90c9('0x49')][_0x90c9('0x72')][_0x47937a]),'WhatsappAccountId':Number(_0x4e0e0c[_0x90c9('0x5c')]['id'])});}}else{socket['emit']('userWhatsappAccount:remove',{'UserId':Number(_0x4e0e0c[_0x90c9('0x49')][_0x90c9('0x72')]),'WhatsappAccountId':Number(_0x4e0e0c[_0x90c9('0x5c')]['id'])});}});}})[_0x90c9('0x22')](respondWithStatusCode(_0x1b39d5,null))[_0x90c9('0x2c')](handleError(_0x1b39d5,null));};exports[_0x90c9('0x7c')]=function(_0x3be792,_0x3b0d9a,_0x279da3){var _0x42bc3d={};var _0x4d233c={};var _0xfb08d;var _0x585c5a;return db[_0x90c9('0x44')][_0x90c9('0x6e')]({'where':{'id':_0x3be792[_0x90c9('0x5c')]['id']}})[_0x90c9('0x22')](handleEntityNotFound(_0x3b0d9a,null))[_0x90c9('0x22')](function(_0x2bd00a){if(_0x2bd00a){_0xfb08d=_0x2bd00a;_0x4d233c[_0x90c9('0x48')]=_[_0x90c9('0x4a')](db[_0x90c9('0x7d')][_0x90c9('0x45')]);_0x4d233c['query']=_[_0x90c9('0x4a')](_0x3be792[_0x90c9('0x49')]);_0x4d233c['filters']=_[_0x90c9('0x4b')](_0x4d233c[_0x90c9('0x48')],_0x4d233c[_0x90c9('0x49')]);_0x42bc3d[_0x90c9('0x4c')]=_['intersection'](_0x4d233c[_0x90c9('0x48')],qs[_0x90c9('0x4d')](_0x3be792[_0x90c9('0x49')][_0x90c9('0x4d')]));_0x42bc3d[_0x90c9('0x4c')]=_0x42bc3d[_0x90c9('0x4c')][_0x90c9('0x4e')]?_0x42bc3d[_0x90c9('0x4c')]:_0x4d233c[_0x90c9('0x48')];_0x42bc3d[_0x90c9('0x70')]=qs[_0x90c9('0x51')](_0x3be792['query'][_0x90c9('0x51')]);_0x42bc3d[_0x90c9('0x52')]=qs[_0x90c9('0x53')](_[_0x90c9('0x54')](_0x3be792[_0x90c9('0x49')],_0x4d233c[_0x90c9('0x53')]));if(_0x3be792[_0x90c9('0x49')]['filter']){_0x42bc3d[_0x90c9('0x52')]=_[_0x90c9('0x5e')](_0x42bc3d['where'],{'$or':_[_0x90c9('0x43')](_0x42bc3d['attributes'],function(_0x4e1505){var _0x1989ee={};_0x1989ee[_0x4e1505]={'$like':'%'+_0x3be792[_0x90c9('0x49')][_0x90c9('0x55')]+'%'};return _0x1989ee;})});}_0x42bc3d=_[_0x90c9('0x5e')]({},_0x42bc3d,_0x3be792['options']);return _0xfb08d[_0x90c9('0x7c')](_0x42bc3d);}})[_0x90c9('0x22')](function(_0x3654b3){if(_0x3654b3){_0x585c5a=_0x3654b3[_0x90c9('0x4e')];if(!_0x3be792[_0x90c9('0x49')]['hasOwnProperty'](_0x90c9('0x50'))){_0x42bc3d[_0x90c9('0x34')]=qs['limit'](_0x3be792[_0x90c9('0x49')][_0x90c9('0x34')]);_0x42bc3d[_0x90c9('0x32')]=qs[_0x90c9('0x32')](_0x3be792[_0x90c9('0x49')][_0x90c9('0x32')]);}return _0xfb08d[_0x90c9('0x7c')](_0x42bc3d);}})[_0x90c9('0x22')](function(_0x180d78){if(_0x180d78){return _0x180d78?{'count':_0x585c5a,'rows':_0x180d78}:null;}})['then'](respondWithResult(_0x3b0d9a,null))[_0x90c9('0x2c')](handleError(_0x3b0d9a,null));};exports[_0x90c9('0x7e')]=function(_0x1efb87,_0x1c3e1f){var _0xbab46c=_0x1efb87[_0x90c9('0x5c')]['id'];var _0x43e4ba=_0x1efb87[_0x90c9('0x69')];var _0xeb5b0=0xc8;var _0x50dbbf=null;return db[_0x90c9('0x7f')][_0x90c9('0x80')]({'isolationLevel':db['sequelize'][_0x90c9('0x81')]['ISOLATION_LEVELS'][_0x90c9('0x82')]},function(_0x3cfd4a){return db[_0x90c9('0x44')][_0x90c9('0x6e')]({'where':{'id':_0xbab46c},'transaction':_0x3cfd4a})['then'](function(_0x201c23){if(_0x201c23){return db[_0x90c9('0x83')][_0x90c9('0x3b')]({'where':{'WhatsappAccountId':_0xbab46c},'transaction':_0x3cfd4a})[_0x90c9('0x22')](function(){var _0x27cec1=_[_0x90c9('0x43')](_0x43e4ba,function(_0x7f5625){_0x7f5625[_0x90c9('0x6c')]=_0xbab46c;return _0x7f5625;});return db[_0x90c9('0x83')]['bulkCreate'](_0x27cec1,{'transaction':_0x3cfd4a});});}else{_0xeb5b0=0x194;_0x50dbbf=[];}});})[_0x90c9('0x22')](function(){if(_0xeb5b0!==0x194){return db['WhatsappApplication'][_0x90c9('0x84')]({'where':{'WhatsappAccountId':_0xbab46c},'order':_0x90c9('0x85')})[_0x90c9('0x22')](function(_0x2169f4){_0x50dbbf=_0x2169f4;});}})['catch'](function(_0x5b81af){_0xeb5b0=0x1f4;logger[_0x90c9('0x27')](_0x5b81af['stack']);if(_0x5b81af[_0x90c9('0x3e')]){delete _0x5b81af[_0x90c9('0x3e')];}_0x50dbbf=_0x5b81af;})[_0x90c9('0x86')](function(){if(_0x50dbbf===null){_0x1c3e1f[_0x90c9('0x2d')](_0xeb5b0);}else{if(_0xeb5b0===0x1f4){_0x1c3e1f[_0x90c9('0x2f')](_0xeb5b0)[_0x90c9('0x3f')](_0x50dbbf);}else{_0x1c3e1f[_0x90c9('0x2f')](_0xeb5b0)['json'](_0x50dbbf);}}});};exports[_0x90c9('0x87')]=function(_0xaaedf3,_0x2695e2,_0x5d11f8){var _0x16ffd0={};var _0x32617c={};var _0x509035;var _0x1515b3;return db[_0x90c9('0x44')][_0x90c9('0x6e')]({'where':{'id':_0xaaedf3['params']['id']}})[_0x90c9('0x22')](handleEntityNotFound(_0x2695e2,null))[_0x90c9('0x22')](function(_0x56acb1){if(_0x56acb1){_0x509035=_0x56acb1;_0x32617c[_0x90c9('0x48')]=_[_0x90c9('0x4a')](db[_0x90c9('0x83')][_0x90c9('0x45')]);_0x32617c[_0x90c9('0x49')]=_[_0x90c9('0x4a')](_0xaaedf3[_0x90c9('0x49')]);_0x32617c['filters']=_[_0x90c9('0x4b')](_0x32617c['model'],_0x32617c[_0x90c9('0x49')]);_0x16ffd0[_0x90c9('0x4c')]=_['intersection'](_0x32617c[_0x90c9('0x48')],qs[_0x90c9('0x4d')](_0xaaedf3[_0x90c9('0x49')][_0x90c9('0x4d')]));_0x16ffd0[_0x90c9('0x4c')]=_0x16ffd0[_0x90c9('0x4c')][_0x90c9('0x4e')]?_0x16ffd0['attributes']:_0x32617c[_0x90c9('0x48')];_0x16ffd0['order']=qs[_0x90c9('0x51')](_0xaaedf3['query'][_0x90c9('0x51')]);_0x16ffd0[_0x90c9('0x52')]=qs['filters'](_['pick'](_0xaaedf3[_0x90c9('0x49')],_0x32617c['filters']));if(_0xaaedf3[_0x90c9('0x49')]['filter']){_0x16ffd0[_0x90c9('0x52')]=_['merge'](_0x16ffd0[_0x90c9('0x52')],{'$or':_['map'](_0x16ffd0[_0x90c9('0x4c')],function(_0x898e0a){var _0x4bfe83={};_0x4bfe83[_0x898e0a]={'$like':'%'+_0xaaedf3[_0x90c9('0x49')][_0x90c9('0x55')]+'%'};return _0x4bfe83;})});}_0x16ffd0=_['merge']({},_0x16ffd0,_0xaaedf3[_0x90c9('0x57')]);return _0x509035[_0x90c9('0x87')](_0x16ffd0);}})[_0x90c9('0x22')](function(_0xafc62e){if(_0xafc62e){_0x1515b3=_0xafc62e['length'];if(!_0xaaedf3[_0x90c9('0x49')][_0x90c9('0x4f')](_0x90c9('0x50'))){_0x16ffd0[_0x90c9('0x34')]=qs[_0x90c9('0x34')](_0xaaedf3[_0x90c9('0x49')][_0x90c9('0x34')]);_0x16ffd0[_0x90c9('0x32')]=qs[_0x90c9('0x32')](_0xaaedf3[_0x90c9('0x49')][_0x90c9('0x32')]);}return _0x509035[_0x90c9('0x87')](_0x16ffd0);}})[_0x90c9('0x22')](function(_0x56f1dd){if(_0x56f1dd){return _0x56f1dd?{'count':_0x1515b3,'rows':_0x56f1dd}:null;}})['then'](respondWithResult(_0x2695e2,null))[_0x90c9('0x2c')](handleError(_0x2695e2,null));};exports[_0x90c9('0x88')]=function(_0x498be2,_0x513aa8,_0x213e6c){var _0x3986c6={'channel':_0x90c9('0x89')};var _0x345e49=[];var _0x1b55e3=[];var _0x56d46c={};return db[_0x90c9('0x44')][_0x90c9('0x5f')]({'where':{'id':_0x498be2[_0x90c9('0x5c')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0x90c9('0x8a')}]})['then'](handleEntityNotFound(_0x513aa8,null))[_0x90c9('0x22')](function(_0x589ae6){_0x3986c6[_0x90c9('0x8b')]=_0x589ae6;if(_0x3986c6[_0x90c9('0x8b')]&&_0x3986c6[_0x90c9('0x8b')][_0x90c9('0x56')]==='sinch'&&_0x498be2[_0x90c9('0x69')]['statuses']){if(_0x498be2['body'][_0x90c9('0x8c')][_0x90c9('0x4e')]===0x0)return;if(_0x498be2['body'][_0x90c9('0x8c')][0x0][_0x90c9('0x8d')]!==_0x90c9('0x8e'))return;return db[_0x90c9('0x8f')][_0x90c9('0x3a')]({'read':!![],'readAt':_0x498be2[_0x90c9('0x69')][_0x90c9('0x8c')][0x0]['timestamp']},{'where':{'messageId':_0x498be2[_0x90c9('0x69')]['statuses'][0x0]['message_id']},'individualHooks':!![]})[_0x90c9('0x22')](function(_0x19c179){return _0x513aa8[_0x90c9('0x2f')](0xc8)[_0x90c9('0x30')](_0x19c179);});}_0x3986c6['applications']=_['orderBy'](_0x589ae6[_0x90c9('0x8a')],[_0x90c9('0x85')],['asc']);if(_0x3986c6['account'][_0x90c9('0x8a')]){delete _0x3986c6[_0x90c9('0x8b')]['Applications'];}return db[_0x90c9('0x90')][_0x90c9('0x6a')]()[_0x90c9('0x22')](function(_0x18de2a){if(!_0x18de2a){throw new db[(_0x90c9('0x91'))][(_0x90c9('0x92'))](_0x90c9('0x93'));}_0x345e49=_[_0x90c9('0x94')](_[_0x90c9('0x4a')](_0x18de2a),[_0x90c9('0x95'),_0x90c9('0x96')]);_0x1b55e3=_[_0x90c9('0x94')](_['keys'](_0x18de2a),[_0x90c9('0x95'),'updatedAt',_0x90c9('0x97'),_0x90c9('0x98')]);_0x3986c6[_0x90c9('0x69')]={'mapKey':'mobile'};if(_0x3986c6[_0x90c9('0x8b')]&&_0x3986c6['account'][_0x90c9('0x56')]===_0x90c9('0x99')){_0x3986c6[_0x90c9('0x69')][_0x90c9('0x9a')]=_0x498be2[_0x90c9('0x69')][_0x90c9('0x9b')][_0x90c9('0x9c')](_0x90c9('0x9d'),'');_0x3986c6[_0x90c9('0x69')][_0x90c9('0x69')]=_0x498be2['body'][_0x90c9('0x9e')];_0x3986c6[_0x90c9('0x69')][_0x90c9('0x9f')]=_0x498be2[_0x90c9('0x69')][_0x90c9('0xa0')];}if(_0x3986c6[_0x90c9('0x8b')]&&_0x3986c6[_0x90c9('0x8b')][_0x90c9('0x56')]==='sinch'){_0x3986c6[_0x90c9('0x69')][_0x90c9('0x9a')]=_0x498be2[_0x90c9('0x69')][_0x90c9('0xa1')][0x0]['from'];_0x3986c6[_0x90c9('0x69')][_0x90c9('0x69')]=_0x498be2[_0x90c9('0x69')][_0x90c9('0xa1')][0x0]['message']['body'];_0x3986c6[_0x90c9('0x69')]['messageId']=_0x498be2[_0x90c9('0x69')][_0x90c9('0xa1')][0x0][_0x90c9('0xa2')];}if(_0x3986c6[_0x90c9('0x69')]['id']){delete _0x3986c6[_0x90c9('0x69')]['id'];}if(_[_0x90c9('0xa3')](_0x3986c6[_0x90c9('0x69')][_0x90c9('0x9a')])){throw new db['Sequelize']['ValidationError'](_0x90c9('0xa4'));}if(_[_0x90c9('0xa3')](_0x3986c6[_0x90c9('0x69')][_0x90c9('0x69')])||_0x3986c6[_0x90c9('0x69')][_0x90c9('0x69')]===''){throw new db[(_0x90c9('0x91'))][(_0x90c9('0x92'))](_0x90c9('0xa5'));}if(_['isNil'](_0x3986c6['body'][_0x90c9('0xa6')])){throw new db['Sequelize'][(_0x90c9('0x92'))](_0x90c9('0xa7')+_0x1b55e3);}if(!_['includes'](_0x1b55e3,_0x3986c6[_0x90c9('0x69')][_0x90c9('0xa6')])){throw new db[(_0x90c9('0x91'))][(_0x90c9('0x92'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1b55e3);}_0x56d46c[_0x3986c6[_0x90c9('0x69')][_0x90c9('0xa6')]]=_0x3986c6['body'][_0x90c9('0x9a')];return db['CmList']['find']({'where':{'id':_0x3986c6['account']['ListId']},'include':[{'model':db[_0x90c9('0x90')],'as':'Contacts','where':_0x56d46c,'limit':0x1,'order':[['updatedAt','DESC']]}]});})['then'](handleEntityNotFound(_0x513aa8,null))[_0x90c9('0x22')](function(_0x59cd60){if(_0x59cd60){_0x3986c6[_0x90c9('0xa8')]=_['omit'](_0x59cd60,['Contacts']);if(_0x59cd60[_0x90c9('0xa9')]['length']){return _0x59cd60['Contacts'][0x0];}var _0x5f50ec=_['defaults'](_0x3986c6['body'],{'firstName':_0x3986c6['body'][_0x90c9('0x9a')],'ListId':_0x59cd60['id']});_0x5f50ec[_0x3986c6[_0x90c9('0x69')][_0x90c9('0xa6')]]=_0x3986c6[_0x90c9('0x69')][_0x90c9('0x9a')];return db[_0x90c9('0x90')][_0x90c9('0x60')](_0x5f50ec,{'fields':_0x345e49,'raw':!![]});}})[_0x90c9('0x22')](handleEntityNotFound(_0x513aa8,null))['then'](function(_0xaf097c){if(_0xaf097c){_0x3986c6[_0x90c9('0xaa')]=_0xaf097c;var _0x151934={'ContactId':_0xaf097c['id'],'phone':_0x3986c6['body']['from'],'WhatsappAccountId':_0x498be2[_0x90c9('0x5c')]['id']};var _0xb1b327={'ContactId':_0xaf097c['id'],'WhatsappAccountId':_0x498be2['params']['id'],'closed':![]};return db[_0x90c9('0xab')][_0x90c9('0x5f')]({'where':_0xb1b327})[_0x90c9('0x22')](function(_0x420d47){if(_0x420d47){return[_0x420d47,![]];}return db[_0x90c9('0xab')]['create'](_0x151934)[_0x90c9('0x22')](function(_0x48c2f3){return[_0x48c2f3,!![]];});});}})[_0x90c9('0x78')](function(_0xd210ba,_0x243595){_0x3986c6['interaction']=_0xd210ba[_0x90c9('0x62')]({'plain':!![]});_0x3986c6[_0x90c9('0xac')][_0x90c9('0xad')]=![];if(_0x243595){if(_0x3986c6[_0x90c9('0x8b')][_0x90c9('0xae')]){_0x3986c6['applications'][_0x90c9('0xaf')]({'id':0x0,'priority':_0x3986c6[_0x90c9('0xb0')][_0x90c9('0x4e')]+0x1,'app':_0x90c9('0xb1'),'appdata':'unmanaged','interval':_0x90c9('0xb2')});}_0x3986c6[_0x90c9('0xac')]['created']=!![];}return db[_0x90c9('0x8f')][_0x90c9('0x60')]({'phone':_0x3986c6[_0x90c9('0x69')][_0x90c9('0x9a')],'messageId':_0x3986c6[_0x90c9('0x69')][_0x90c9('0x9f')],'body':_0x3986c6[_0x90c9('0x69')][_0x90c9('0x69')],'WhatsappAccountId':_0x498be2[_0x90c9('0x5c')]['id'],'WhatsappInteractionId':_0xd210ba['id'],'direction':'in','ContactId':_0xd210ba[_0x90c9('0xb3')],'AttachmentId':_0x3986c6[_0x90c9('0x69')][_0x90c9('0xb4')]});})[_0x90c9('0x22')](function(_0x40b7d3){_0x3986c6[_0x90c9('0x2a')]=_0x40b7d3;if(!_0x3986c6[_0x90c9('0xac')][_0x90c9('0xb5')])return;return db[_0x90c9('0x7d')][_0x90c9('0x5f')]({'attributes':['id',_0x90c9('0x3e')],'where':{'id':_0x3986c6[_0x90c9('0xac')][_0x90c9('0xb5')]}});})[_0x90c9('0x22')](function(_0x24c8db){if(_0x24c8db){_0x3986c6[_0x90c9('0xb0')][_0x90c9('0xb6')]({'id':0x0,'priority':0x0,'app':_0x90c9('0xb7'),'appdata':_0x24c8db['name']+','+(_0x3986c6['account']['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}if(!_0x3986c6[_0x90c9('0xac')]['queueId'])return;return db[_0x90c9('0xb8')][_0x90c9('0x5f')]({'attributes':['id',_0x90c9('0x3e')],'where':{'id':_0x3986c6[_0x90c9('0xac')][_0x90c9('0xb9')]}});})['then'](function(_0xcaa838){if(_0xcaa838){_0x3986c6[_0x90c9('0xb0')][_0x90c9('0xb6')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0xcaa838[_0x90c9('0x3e')]+','+(_0x3986c6[_0x90c9('0x8b')][_0x90c9('0xba')]||0x12c),'interval':_0x90c9('0xb2')});}return respondWithRpcPromise('Start',_0x90c9('0xbb'),_0x3986c6);})['then'](function(_0x5b347f){if(_0x5b347f){var _0x185e2e=0xc8;var _0x5bae1e=_0x90c9('0xbc');logger[_0x90c9('0x23')](_0x90c9('0x26'),_0x5bae1e,_0x185e2e,_0x90c9('0xbd'));logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x5bae1e,_0x185e2e,_0x90c9('0xbd'),JSON[_0x90c9('0xbe')](_0x5b347f));if(_0x3986c6['account']['type']==='twilio'){return _0x513aa8[_0x90c9('0x2f')](_0x185e2e)[_0x90c9('0x35')](_0x90c9('0xbf'),_0x90c9('0xc0'))[_0x90c9('0x3f')]('\x0a');}else{return _0x513aa8[_0x90c9('0x2f')](_0x185e2e)[_0x90c9('0x30')](_0x5b347f);}}});})[_0x90c9('0x2c')](handleError(_0x513aa8,null));};exports['send']=function(_0x22ddbd,_0x1a2a0b,_0x4b3271){var _0x5f55dc,_0x9da413,_0x2559de;if(_[_0x90c9('0xa3')](_0x22ddbd[_0x90c9('0x69')][_0x90c9('0x69')])||_0x22ddbd[_0x90c9('0x69')]['body']===''){throw new db[(_0x90c9('0x91'))][(_0x90c9('0x92'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x90c9('0xa3')](_0x22ddbd[_0x90c9('0x69')]['to'])){throw new db[(_0x90c9('0x91'))][(_0x90c9('0x92'))](_0x90c9('0xc1'));}_0x5f55dc=_0x22ddbd[_0x90c9('0x69')]['to'];return db['WhatsappAccount']['find']({'where':{'id':_0x22ddbd[_0x90c9('0x5c')]['id']},'include':[{'model':db[_0x90c9('0xc2')],'as':_0x90c9('0xc3'),'include':[{'model':db[_0x90c9('0x90')],'as':'Contacts','where':{'mobile':_0x5f55dc},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0x90c9('0x22')](handleEntityNotFound(_0x1a2a0b,null))['then'](function(_0x2ce83d){if(_0x2ce83d&&_0x2ce83d[_0x90c9('0xc3')]){_0x9da413=_0x2ce83d['get']({'plain':!![]});if(_0x9da413[_0x90c9('0xc3')]&&_0x9da413[_0x90c9('0xc3')][_0x90c9('0xa9')][_0x90c9('0x4e')]){return _0x9da413[_0x90c9('0xc3')][_0x90c9('0xa9')][0x0];}return db['CmContact'][_0x90c9('0x60')](_[_0x90c9('0x1a')](_0x22ddbd[_0x90c9('0x69')],{'firstName':_0x5f55dc,'mobile':_0x5f55dc,'phone':_0x5f55dc,'ListId':_0x9da413[_0x90c9('0x98')]}));}})['then'](handleEntityNotFound(_0x1a2a0b,null))['then'](function(_0x59c190){if(_0x59c190){_0x2559de=_0x59c190;return db[_0x90c9('0xab')][_0x90c9('0x5f')]({'where':{'ContactId':_0x2559de['id'],'closed':![],'WhatsappAccountId':_0x9da413['id']}})['then'](function(_0x2c4f97){if(_0x2c4f97){return[_0x2c4f97,![]];}return db[_0x90c9('0xab')][_0x90c9('0x60')]({'UserId':_0x22ddbd[_0x90c9('0x61')]['id'],'ContactId':_0x2559de['id'],'WhatsappAccountId':_0x9da413['id'],'phone':_0x5f55dc,'firstMsgDirection':_0x90c9('0xc4'),'Messages':[_[_0x90c9('0x5e')](_0x22ddbd[_0x90c9('0x69')],{'read':![],'body':_0x22ddbd['body'][_0x90c9('0x69')],'phone':_0x5f55dc,'WhatsappAccountId':_0x9da413['id'],'UserId':_0x22ddbd[_0x90c9('0x61')]['id'],'ContactId':_0x2559de['id']})]},{'include':[{'model':db[_0x90c9('0x8f')],'as':'Messages'}]})[_0x90c9('0x22')](function(_0x5b47dd){return[_0x5b47dd,!![]];});});}})['spread'](function(_0x4f4beb,_0x386af4){if(_0x386af4){return _0x4f4beb;}return db['WhatsappMessage'][_0x90c9('0x60')](_['merge'](_0x22ddbd[_0x90c9('0x69')],{'read':![],'body':_0x22ddbd[_0x90c9('0x69')]['body'],'phone':_0x5f55dc,'WhatsappAccountId':_0x9da413['id'],'WhatsappInteractionId':_0x4f4beb['id'],'UserId':_0x22ddbd['user']['id'],'ContactId':_0x2559de['id']}))[_0x90c9('0x22')](function(_0x12949a){_0x4f4beb['dataValues']['Messages']=[];_0x4f4beb['dataValues']['Messages'][_0x90c9('0xaf')](_0x12949a[_0x90c9('0xc5')]);return _0x4f4beb;});})[_0x90c9('0x22')](respondWithResult(_0x1a2a0b,null))[_0x90c9('0x2c')](handleError(_0x1a2a0b,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 2aaa749..f62e0a8 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 _0x5181=['WhatsappAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x1c90aa,_0x1343a0){var _0x1a4416=function(_0x491907){while(--_0x491907){_0x1c90aa['push'](_0x1c90aa['shift']());}};_0x1a4416(++_0x1343a0);}(_0x5181,0xd0));var _0x1518=function(_0x298632,_0xfaac03){_0x298632=_0x298632-0x0;var _0xfa7deb=_0x5181[_0x298632];return _0xfa7deb;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require('../../mysqldb')['db'][_0x1518('0x0')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x1518('0x1')](0x0);var events={'afterCreate':_0x1518('0x2'),'afterUpdate':_0x1518('0x3'),'afterDestroy':_0x1518('0x4')};function emitEvent(_0x1cc72d){return function(_0x15d198,_0xf159aa,_0x482ef8){WhatsappAccountEvents[_0x1518('0x5')](_0x1cc72d+':'+_0x15d198['id'],_0x15d198);WhatsappAccountEvents[_0x1518('0x5')](_0x1cc72d,_0x15d198);_0x482ef8(null);};}for(var e in events){if(events[_0x1518('0x6')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0x1518('0x7')]=WhatsappAccountEvents; \ No newline at end of file +var _0x6343=['WhatsappAccount','setMaxListeners','save','update','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x2feea2,_0x45f989){var _0x572a30=function(_0x455672){while(--_0x455672){_0x2feea2['push'](_0x2feea2['shift']());}};_0x572a30(++_0x45f989);}(_0x6343,0x1f2));var _0x3634=function(_0x806ddb,_0xa7a13){_0x806ddb=_0x806ddb-0x0;var _0x59634f=_0x6343[_0x806ddb];return _0x59634f;};'use strict';var EventEmitter=require(_0x3634('0x0'));var WhatsappAccount=require(_0x3634('0x1'))['db'][_0x3634('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x3634('0x3')](0x0);var events={'afterCreate':_0x3634('0x4'),'afterUpdate':_0x3634('0x5'),'afterDestroy':_0x3634('0x6')};function emitEvent(_0x549b5e){return function(_0x3d66d4,_0x1f25a3,_0x4c9241){WhatsappAccountEvents[_0x3634('0x7')](_0x549b5e+':'+_0x3d66d4['id'],_0x3d66d4);WhatsappAccountEvents['emit'](_0x549b5e,_0x3d66d4);_0x4c9241(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0x3634('0x8')](e,emitEvent(event));}}module[_0x3634('0x9')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index a189c9c..a7738b0 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 _0xbc8e=['WhatsappAccount','whatsapp_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappAccount.attributes','exports','define'];(function(_0x4c440b,_0x3ea627){var _0x2d48cf=function(_0x56bac7){while(--_0x56bac7){_0x4c440b['push'](_0x4c440b['shift']());}};_0x2d48cf(++_0x3ea627);}(_0xbc8e,0x1d0));var _0xebc8=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xbc8e[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xebc8('0x0'));var util=require('util');var logger=require(_0xebc8('0x1'))(_0xebc8('0x2'));var moment=require(_0xebc8('0x3'));var BPromise=require(_0xebc8('0x4'));var rp=require(_0xebc8('0x5'));var fs=require('fs');var path=require(_0xebc8('0x6'));var rimraf=require(_0xebc8('0x7'));var config=require(_0xebc8('0x8'));var attributes=require(_0xebc8('0x9'));module[_0xebc8('0xa')]=function(_0x158ebd,_0x55438d){return _0x158ebd[_0xebc8('0xb')](_0xebc8('0xc'),attributes,{'tableName':_0xebc8('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1f27=['path','../../config/environment','exports','define','whatsapp_accounts','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x3a9dfa,_0x1a0dc7){var _0x2f857e=function(_0x5197d3){while(--_0x5197d3){_0x3a9dfa['push'](_0x3a9dfa['shift']());}};_0x2f857e(++_0x1a0dc7);}(_0x1f27,0x163));var _0x71f2=function(_0x62fc16,_0x1c8dca){_0x62fc16=_0x62fc16-0x0;var _0x1c9e27=_0x1f27[_0x62fc16];return _0x1c9e27;};'use strict';var _=require('lodash');var util=require(_0x71f2('0x0'));var logger=require(_0x71f2('0x1'))('api');var moment=require(_0x71f2('0x2'));var BPromise=require(_0x71f2('0x3'));var rp=require(_0x71f2('0x4'));var fs=require('fs');var path=require(_0x71f2('0x5'));var rimraf=require('rimraf');var config=require(_0x71f2('0x6'));var attributes=require('./whatsappAccount.attributes');module[_0x71f2('0x7')]=function(_0x3a298b,_0x14b07b){return _0x3a298b[_0x71f2('0x8')]('WhatsappAccount',attributes,{'tableName':_0x71f2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index a061669..0305bb6 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 _0x1507=['map','include','model','attributes','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','redis','localhost','./whatsappAccount.socket','register','request','then','info','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','ShowWhatsappAccount','find','options'];(function(_0x380e75,_0x486360){var _0x444d96=function(_0x32c8f8){while(--_0x32c8f8){_0x380e75['push'](_0x380e75['shift']());}};_0x444d96(++_0x486360);}(_0x1507,0x1bf));var _0x7150=function(_0x78db5e,_0x3b9804){_0x78db5e=_0x78db5e-0x0;var _0x250b88=_0x1507[_0x78db5e];return _0x250b88;};'use strict';var _=require(_0x7150('0x0'));var util=require(_0x7150('0x1'));var moment=require(_0x7150('0x2'));var BPromise=require(_0x7150('0x3'));var rs=require(_0x7150('0x4'));var fs=require('fs');var Redis=require(_0x7150('0x5'));var db=require(_0x7150('0x6'))['db'];var utils=require(_0x7150('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x7150('0x8'));var jayson=require(_0x7150('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x7150('0xa')]=_['defaults'](config['redis'],{'host':_0x7150('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x7150('0xc'))[_0x7150('0xd')](socket);function respondWithRpcPromise(_0x460b13,_0x29b015,_0x31d2af){return new BPromise(function(_0x505ccc,_0x4dcdce){return client[_0x7150('0xe')](_0x460b13,_0x31d2af)[_0x7150('0xf')](function(_0x5e67ad){logger[_0x7150('0x10')]('WhatsappAccount,\x20%s,\x20%s',_0x29b015,_0x7150('0x11'));logger[_0x7150('0x12')](_0x7150('0x13'),_0x29b015,_0x7150('0x11'),JSON[_0x7150('0x14')](_0x5e67ad));if(_0x5e67ad[_0x7150('0x15')]){if(_0x5e67ad['error'][_0x7150('0x16')]===0x1f4){logger[_0x7150('0x15')](_0x7150('0x17'),_0x29b015,_0x5e67ad['error'][_0x7150('0x18')]);return _0x4dcdce(_0x5e67ad[_0x7150('0x15')][_0x7150('0x18')]);}logger['error'](_0x7150('0x17'),_0x29b015,_0x5e67ad['error'][_0x7150('0x18')]);return _0x505ccc(_0x5e67ad[_0x7150('0x15')][_0x7150('0x18')]);}else{logger[_0x7150('0x10')](_0x7150('0x17'),_0x29b015,_0x7150('0x11'));_0x505ccc(_0x5e67ad[_0x7150('0x19')][_0x7150('0x18')]);}})['catch'](function(_0x316a3a){logger['error'](_0x7150('0x17'),_0x29b015,_0x316a3a);_0x4dcdce(_0x316a3a);});});}exports[_0x7150('0x1a')]=function(_0x51ce96){var _0xe879ae=this;return new Promise(function(_0x5e3a45,_0x1b8284){return db['WhatsappAccount'][_0x7150('0x1b')]({'raw':_0x51ce96[_0x7150('0x1c')]?_0x51ce96[_0x7150('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x51ce96[_0x7150('0x1c')]?_0x51ce96['options']['where']||null:null,'attributes':_0x51ce96[_0x7150('0x1c')]?_0x51ce96['options']['attributes']||null:null,'include':_0x51ce96['options']?_0x51ce96[_0x7150('0x1c')]['include']?_[_0x7150('0x1d')](_0x51ce96[_0x7150('0x1c')][_0x7150('0x1e')],function(_0xd5d455){return{'model':db[_0xd5d455[_0x7150('0x1f')]],'as':_0xd5d455['as'],'attributes':_0xd5d455[_0x7150('0x20')],'include':_0xd5d455[_0x7150('0x1e')]?_['map'](_0xd5d455['include'],function(_0x23f53b){return{'model':db[_0x23f53b[_0x7150('0x1f')]],'as':_0x23f53b['as'],'attributes':_0x23f53b[_0x7150('0x20')],'include':_0x23f53b[_0x7150('0x1e')]?_['map'](_0x23f53b[_0x7150('0x1e')],function(_0x59d032){return{'model':db[_0x59d032[_0x7150('0x1f')]],'as':_0x59d032['as'],'attributes':_0x59d032[_0x7150('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x35292a){logger['info'](_0x7150('0x1a'),_0x51ce96);logger[_0x7150('0x12')](_0x7150('0x1a'),_0x51ce96,JSON[_0x7150('0x14')](_0x35292a));_0x5e3a45(_0x35292a);})[_0x7150('0x21')](function(_0x7302d6){logger['error'](_0x7150('0x1a'),_0x7302d6['message'],_0x51ce96);_0x1b8284(_0xe879ae[_0x7150('0x15')](0x1f4,_0x7302d6[_0x7150('0x18')]));});});}; \ No newline at end of file +var _0xff28=['WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','WhatsappAccount','find','options','raw','where','attributes','include','map','model','ShowWhatsappAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','then'];(function(_0x1da759,_0x1321fb){var _0x481830=function(_0x22c671){while(--_0x22c671){_0x1da759['push'](_0x1da759['shift']());}};_0x481830(++_0x1321fb);}(_0xff28,0x8f));var _0x8ff2=function(_0x3050ca,_0x3e36b0){_0x3050ca=_0x3050ca-0x0;var _0x1eed1d=_0xff28[_0x3050ca];return _0x1eed1d;};'use strict';var _=require(_0x8ff2('0x0'));var util=require(_0x8ff2('0x1'));var moment=require(_0x8ff2('0x2'));var BPromise=require(_0x8ff2('0x3'));var rs=require(_0x8ff2('0x4'));var fs=require('fs');var Redis=require(_0x8ff2('0x5'));var db=require(_0x8ff2('0x6'))['db'];var utils=require(_0x8ff2('0x7'));var logger=require(_0x8ff2('0x8'))(_0x8ff2('0x9'));var config=require(_0x8ff2('0xa'));var jayson=require(_0x8ff2('0xb'));var client=jayson[_0x8ff2('0xc')][_0x8ff2('0xd')]({'port':0x232a});config['redis']=_[_0x8ff2('0xe')](config[_0x8ff2('0xf')],{'host':_0x8ff2('0x10'),'port':0x18eb});var socket=require(_0x8ff2('0x11'))(new Redis(config[_0x8ff2('0xf')]));require(_0x8ff2('0x12'))[_0x8ff2('0x13')](socket);function respondWithRpcPromise(_0x2684f8,_0x4cdc0d,_0x50e13b){return new BPromise(function(_0x27140a,_0x46acfb){return client['request'](_0x2684f8,_0x50e13b)[_0x8ff2('0x14')](function(_0x2bb929){logger['info'](_0x8ff2('0x15'),_0x4cdc0d,_0x8ff2('0x16'));logger[_0x8ff2('0x17')](_0x8ff2('0x18'),_0x4cdc0d,_0x8ff2('0x16'),JSON[_0x8ff2('0x19')](_0x2bb929));if(_0x2bb929['error']){if(_0x2bb929[_0x8ff2('0x1a')][_0x8ff2('0x1b')]===0x1f4){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x4cdc0d,_0x2bb929[_0x8ff2('0x1a')][_0x8ff2('0x1c')]);return _0x46acfb(_0x2bb929[_0x8ff2('0x1a')][_0x8ff2('0x1c')]);}logger[_0x8ff2('0x1a')]('WhatsappAccount,\x20%s,\x20%s',_0x4cdc0d,_0x2bb929[_0x8ff2('0x1a')][_0x8ff2('0x1c')]);return _0x27140a(_0x2bb929['error'][_0x8ff2('0x1c')]);}else{logger[_0x8ff2('0x1d')](_0x8ff2('0x15'),_0x4cdc0d,_0x8ff2('0x16'));_0x27140a(_0x2bb929['result']['message']);}})[_0x8ff2('0x1e')](function(_0x196fb8){logger['error'](_0x8ff2('0x15'),_0x4cdc0d,_0x196fb8);_0x46acfb(_0x196fb8);});});}exports['ShowWhatsappAccount']=function(_0x47d05f){var _0x2f0a4b=this;return new Promise(function(_0x4abe16,_0x22ace5){return db[_0x8ff2('0x1f')][_0x8ff2('0x20')]({'raw':_0x47d05f['options']?_0x47d05f[_0x8ff2('0x21')][_0x8ff2('0x22')]===undefined?!![]:![]:!![],'where':_0x47d05f[_0x8ff2('0x21')]?_0x47d05f[_0x8ff2('0x21')][_0x8ff2('0x23')]||null:null,'attributes':_0x47d05f[_0x8ff2('0x21')]?_0x47d05f['options'][_0x8ff2('0x24')]||null:null,'include':_0x47d05f[_0x8ff2('0x21')]?_0x47d05f[_0x8ff2('0x21')][_0x8ff2('0x25')]?_[_0x8ff2('0x26')](_0x47d05f['options'][_0x8ff2('0x25')],function(_0x3a8f71){return{'model':db[_0x3a8f71[_0x8ff2('0x27')]],'as':_0x3a8f71['as'],'attributes':_0x3a8f71[_0x8ff2('0x24')],'include':_0x3a8f71[_0x8ff2('0x25')]?_['map'](_0x3a8f71[_0x8ff2('0x25')],function(_0x5bafac){return{'model':db[_0x5bafac[_0x8ff2('0x27')]],'as':_0x5bafac['as'],'attributes':_0x5bafac[_0x8ff2('0x24')],'include':_0x5bafac[_0x8ff2('0x25')]?_[_0x8ff2('0x26')](_0x5bafac[_0x8ff2('0x25')],function(_0x4be6a4){return{'model':db[_0x4be6a4['model']],'as':_0x4be6a4['as'],'attributes':_0x4be6a4[_0x8ff2('0x24')]};}):[]};}):[]};}):[]:[]})[_0x8ff2('0x14')](function(_0x2c95f7){logger[_0x8ff2('0x1d')](_0x8ff2('0x28'),_0x47d05f);logger[_0x8ff2('0x17')](_0x8ff2('0x28'),_0x47d05f,JSON['stringify'](_0x2c95f7));_0x4abe16(_0x2c95f7);})['catch'](function(_0x7ef353){logger[_0x8ff2('0x1a')]('ShowWhatsappAccount',_0x7ef353['message'],_0x47d05f);_0x22ace5(_0x2f0a4b[_0x8ff2('0x1a')](0x1f4,_0x7ef353[_0x8ff2('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index f22a048..8cec4e6 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 _0x1260=['removeListener','register','length','whatsappAccount:','./whatsappAccount.events','save','remove','emit'];(function(_0x566bdf,_0x1f4861){var _0x331215=function(_0x524d0d){while(--_0x524d0d){_0x566bdf['push'](_0x566bdf['shift']());}};_0x331215(++_0x1f4861);}(_0x1260,0x1dc));var _0x0126=function(_0x1a2d49,_0x19d780){_0x1a2d49=_0x1a2d49-0x0;var _0x3e34a0=_0x1260[_0x1a2d49];return _0x3e34a0;};'use strict';var WhatsappAccountEvents=require(_0x0126('0x0'));var events=[_0x0126('0x1'),_0x0126('0x2'),'update'];function createListener(_0x104fe9,_0x1bee86){return function(_0x41a9b7){_0x1bee86[_0x0126('0x3')](_0x104fe9,_0x41a9b7);};}function removeListener(_0x3a9fca,_0x267761){return function(){WhatsappAccountEvents[_0x0126('0x4')](_0x3a9fca,_0x267761);};}exports[_0x0126('0x5')]=function(_0x3e87bb){for(var _0x51c5f5=0x0,_0x1f03fd=events[_0x0126('0x6')];_0x51c5f5<_0x1f03fd;_0x51c5f5++){var _0x2a47b4=events[_0x51c5f5];var _0x36831f=createListener(_0x0126('0x7')+_0x2a47b4,_0x3e87bb);WhatsappAccountEvents['on'](_0x2a47b4,_0x36831f);}}; \ No newline at end of file +var _0x1cd5=['length','whatsappAccount:','./whatsappAccount.events','save','remove','update','emit','removeListener'];(function(_0x3fc1c4,_0x1fd30b){var _0x246db3=function(_0x53ee80){while(--_0x53ee80){_0x3fc1c4['push'](_0x3fc1c4['shift']());}};_0x246db3(++_0x1fd30b);}(_0x1cd5,0x132));var _0x51cd=function(_0xf062aa,_0x1d9f72){_0xf062aa=_0xf062aa-0x0;var _0x372b3b=_0x1cd5[_0xf062aa];return _0x372b3b;};'use strict';var WhatsappAccountEvents=require(_0x51cd('0x0'));var events=[_0x51cd('0x1'),_0x51cd('0x2'),_0x51cd('0x3')];function createListener(_0x131437,_0x204243){return function(_0x4f2054){_0x204243[_0x51cd('0x4')](_0x131437,_0x4f2054);};}function removeListener(_0x50cb53,_0x522b20){return function(){WhatsappAccountEvents[_0x51cd('0x5')](_0x50cb53,_0x522b20);};}exports['register']=function(_0x3405f9){for(var _0x2f1491=0x0,_0x554f0a=events[_0x51cd('0x6')];_0x2f1491<_0x554f0a;_0x2f1491++){var _0x22ea64=events[_0x2f1491];var _0x49b26a=createListener(_0x51cd('0x7')+_0x22ea64,_0x3405f9);WhatsappAccountEvents['on'](_0x22ea64,_0x49b26a);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 0990b40..7ee4fd5 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 _0x3359=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','index','/:id','show','post','isAuthenticated','create','put','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x46e0e0,_0x55b8e8){var _0x5efbcc=function(_0x135ac8){while(--_0x135ac8){_0x46e0e0['push'](_0x46e0e0['shift']());}};_0x5efbcc(++_0x55b8e8);}(_0x3359,0xf9));var _0x9335=function(_0x58dc50,_0x2af0b7){_0x58dc50=_0x58dc50-0x0;var _0x1fda34=_0x3359[_0x58dc50];return _0x1fda34;};'use strict';var multer=require('multer');var util=require(_0x9335('0x0'));var path=require(_0x9335('0x1'));var timeout=require(_0x9335('0x2'));var express=require(_0x9335('0x3'));var router=express['Router']();var fs_extra=require(_0x9335('0x4'));var auth=require(_0x9335('0x5'));var interaction=require(_0x9335('0x6'));var config=require(_0x9335('0x7'));var controller=require(_0x9335('0x8'));router[_0x9335('0x9')]('/',auth['isAuthenticated'](),controller[_0x9335('0xa')]);router[_0x9335('0x9')](_0x9335('0xb'),auth['isAuthenticated'](),controller[_0x9335('0xc')]);router[_0x9335('0xd')]('/',auth[_0x9335('0xe')](),controller[_0x9335('0xf')]);router[_0x9335('0x10')](_0x9335('0xb'),auth[_0x9335('0xe')](),controller[_0x9335('0x11')]);router[_0x9335('0x12')](_0x9335('0xb'),auth[_0x9335('0xe')](),controller[_0x9335('0x13')]);module[_0x9335('0x14')]=router; \ No newline at end of file +var _0x008d=['multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','isAuthenticated','get','/:id','create','update','delete','destroy','exports'];(function(_0x2f965f,_0x100aca){var _0x73f2b9=function(_0x25705d){while(--_0x25705d){_0x2f965f['push'](_0x2f965f['shift']());}};_0x73f2b9(++_0x100aca);}(_0x008d,0x154));var _0xd008=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x008d[_0x46e363];return _0x3fb059;};'use strict';var multer=require(_0xd008('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd008('0x1'));var express=require(_0xd008('0x2'));var router=express[_0xd008('0x3')]();var fs_extra=require(_0xd008('0x4'));var auth=require(_0xd008('0x5'));var interaction=require(_0xd008('0x6'));var config=require(_0xd008('0x7'));var controller=require(_0xd008('0x8'));router['get']('/',auth[_0xd008('0x9')](),controller['index']);router[_0xd008('0xa')](_0xd008('0xb'),auth[_0xd008('0x9')](),controller['show']);router['post']('/',auth[_0xd008('0x9')](),controller[_0xd008('0xc')]);router['put']('/:id',auth[_0xd008('0x9')](),controller[_0xd008('0xd')]);router[_0xd008('0xe')](_0xd008('0xb'),auth[_0xd008('0x9')](),controller[_0xd008('0xf')]);module[_0xd008('0x10')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 28df67d..2f35857 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 _0x79ba=['sequelize','exports','INTEGER','STRING','*,*,*,*'];(function(_0x59945a,_0x57fecd){var _0x2864e5=function(_0x179a37){while(--_0x179a37){_0x59945a['push'](_0x59945a['shift']());}};_0x2864e5(++_0x57fecd);}(_0x79ba,0x87));var _0xa79b=function(_0x158f01,_0x12af3e){_0x158f01=_0x158f01-0x0;var _0x5ef74e=_0x79ba[_0x158f01];return _0x5ef74e;};'use strict';var Sequelize=require(_0xa79b('0x0'));module[_0xa79b('0x1')]={'priority':{'type':Sequelize[_0xa79b('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xa79b('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xa79b('0x3')]},'interval':{'type':Sequelize[_0xa79b('0x3')],'defaultValue':_0xa79b('0x4')}}; \ No newline at end of file +var _0x189e=['noop','TEXT','STRING','*,*,*,*','sequelize'];(function(_0x104b35,_0x13f218){var _0x55584d=function(_0x2bbb71){while(--_0x2bbb71){_0x104b35['push'](_0x104b35['shift']());}};_0x55584d(++_0x13f218);}(_0x189e,0x126));var _0xe189=function(_0xf8f29f,_0x487c16){_0xf8f29f=_0xf8f29f-0x0;var _0x5e99a6=_0x189e[_0xf8f29f];return _0x5e99a6;};'use strict';var Sequelize=require(_0xe189('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xe189('0x1')},'appdata':{'type':Sequelize[_0xe189('0x2')]()},'description':{'type':Sequelize[_0xe189('0x3')]},'interval':{'type':Sequelize[_0xe189('0x3')],'defaultValue':_0xe189('0x4')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 269e8e3..7fb572c 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 _0x2faf=['key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','sort','where','filters','filter','merge','options','then','includeAll','include','findAll','rows','catch','params','rawAttributes','create','update','body','destroy','find','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','undefined','count','offset','set','Content-Range','json','reject','error','stack','name','send','map','WhatsappApplication','fieldName','type'];(function(_0x3f28a6,_0x3f045e){var _0x4a999d=function(_0x3d3ed7){while(--_0x3d3ed7){_0x3f28a6['push'](_0x3f28a6['shift']());}};_0x4a999d(++_0x3f045e);}(_0x2faf,0xb0));var _0xf2fa=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2faf[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xf2fa('0x0'));var rimraf=require(_0xf2fa('0x1'));var zipdir=require(_0xf2fa('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf2fa('0x3'));var moment=require(_0xf2fa('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf2fa('0x5'));var util=require(_0xf2fa('0x6'));var path=require(_0xf2fa('0x7'));var sox=require(_0xf2fa('0x8'));var csv=require(_0xf2fa('0x9'));var ejs=require(_0xf2fa('0xa'));var fs=require('fs');var fs_extra=require(_0xf2fa('0xb'));var _=require('lodash');var squel=require(_0xf2fa('0xc'));var crypto=require(_0xf2fa('0xd'));var jsforce=require(_0xf2fa('0xe'));var deskjs=require(_0xf2fa('0xf'));var toCsv=require('to-csv');var querystring=require(_0xf2fa('0x10'));var Papa=require('papaparse');var Redis=require(_0xf2fa('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xf2fa('0x12'));var as=require(_0xf2fa('0x13'));var hardwareService=require(_0xf2fa('0x14'));var logger=require(_0xf2fa('0x15'))(_0xf2fa('0x16'));var utils=require(_0xf2fa('0x17'));var config=require(_0xf2fa('0x18'));var licenseUtil=require(_0xf2fa('0x19'));var db=require(_0xf2fa('0x1a'))['db'];function respondWithStatusCode(_0x15a15f,_0x4fe6e9){_0x4fe6e9=_0x4fe6e9||0xcc;return function(_0x2dabbb){if(_0x2dabbb){return _0x15a15f[_0xf2fa('0x1b')](_0x4fe6e9);}return _0x15a15f[_0xf2fa('0x1c')](_0x4fe6e9)[_0xf2fa('0x1d')]();};}function respondWithResult(_0x13ca94,_0x416ca6){_0x416ca6=_0x416ca6||0xc8;return function(_0x30a8b1){if(_0x30a8b1){return _0x13ca94[_0xf2fa('0x1c')](_0x416ca6)['json'](_0x30a8b1);}};}function respondWithFilteredResult(_0x2d8fc2,_0x4fea4a){return function(_0x2aa797){if(_0x2aa797){var _0x9e3bc8=typeof _0x4fea4a['offset']==='undefined'&&typeof _0x4fea4a[_0xf2fa('0x1e')]===_0xf2fa('0x1f');var _0xd9c050=_0x2aa797[_0xf2fa('0x20')];var _0x2b8f69=_0x9e3bc8?0x0:_0x4fea4a[_0xf2fa('0x21')];var _0x551b3d=_0x9e3bc8?_0x2aa797[_0xf2fa('0x20')]:_0x4fea4a[_0xf2fa('0x21')]+_0x4fea4a[_0xf2fa('0x1e')];var _0x57bca1;if(_0x551b3d>=_0xd9c050){_0x551b3d=_0xd9c050;_0x57bca1=0xc8;}else{_0x57bca1=0xce;}_0x2d8fc2[_0xf2fa('0x1c')](_0x57bca1);return _0x2d8fc2[_0xf2fa('0x22')](_0xf2fa('0x23'),_0x2b8f69+'-'+_0x551b3d+'/'+_0xd9c050)[_0xf2fa('0x24')](_0x2aa797);}return null;};}function patchUpdates(_0x25f5d3){return function(_0x536a2d){try{jsonpatch['apply'](_0x536a2d,_0x25f5d3,!![]);}catch(_0x568448){return BPromise[_0xf2fa('0x25')](_0x568448);}return _0x536a2d['save']();};}function saveUpdates(_0x2ddb2c,_0x4034ab){return function(_0x599c7b){if(_0x599c7b){return _0x599c7b['update'](_0x2ddb2c)['then'](function(_0x453c9d){return _0x453c9d;});}return null;};}function removeEntity(_0x17a54f,_0x2b753e){return function(_0x2e809d){if(_0x2e809d){return _0x2e809d['destroy']()['then'](function(){_0x17a54f[_0xf2fa('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x557631,_0x4ab17d){return function(_0x319b68){if(!_0x319b68){_0x557631['sendStatus'](0x194);}return _0x319b68;};}function handleError(_0x5ba4dd,_0xb18557){_0xb18557=_0xb18557||0x1f4;return function(_0x5553fa){logger[_0xf2fa('0x26')](_0x5553fa[_0xf2fa('0x27')]);if(_0x5553fa[_0xf2fa('0x28')]){delete _0x5553fa['name'];}_0x5ba4dd['status'](_0xb18557)[_0xf2fa('0x29')](_0x5553fa);};}exports['index']=function(_0x1b8532,_0xd4a340){var _0x18fefb={},_0x3e631d={},_0x50ead8={'count':0x0,'rows':[]};var _0x19a4ad=_[_0xf2fa('0x2a')](db[_0xf2fa('0x2b')]['rawAttributes'],function(_0xd01492){return{'name':_0xd01492[_0xf2fa('0x2c')],'type':_0xd01492[_0xf2fa('0x2d')][_0xf2fa('0x2e')]};});_0x3e631d[_0xf2fa('0x2f')]=_[_0xf2fa('0x2a')](_0x19a4ad,_0xf2fa('0x28'));_0x3e631d[_0xf2fa('0x30')]=_[_0xf2fa('0x31')](_0x1b8532[_0xf2fa('0x30')]);_0x3e631d['filters']=_['intersection'](_0x3e631d[_0xf2fa('0x2f')],_0x3e631d[_0xf2fa('0x30')]);_0x18fefb[_0xf2fa('0x32')]=_[_0xf2fa('0x33')](_0x3e631d[_0xf2fa('0x2f')],qs['fields'](_0x1b8532['query'][_0xf2fa('0x34')]));_0x18fefb[_0xf2fa('0x32')]=_0x18fefb[_0xf2fa('0x32')][_0xf2fa('0x35')]?_0x18fefb[_0xf2fa('0x32')]:_0x3e631d[_0xf2fa('0x2f')];if(!_0x1b8532['query'][_0xf2fa('0x36')]('nolimit')){_0x18fefb[_0xf2fa('0x1e')]=qs[_0xf2fa('0x1e')](_0x1b8532[_0xf2fa('0x30')][_0xf2fa('0x1e')]);_0x18fefb[_0xf2fa('0x21')]=qs[_0xf2fa('0x21')](_0x1b8532[_0xf2fa('0x30')][_0xf2fa('0x21')]);}_0x18fefb['order']=qs[_0xf2fa('0x37')](_0x1b8532['query'][_0xf2fa('0x37')]);_0x18fefb[_0xf2fa('0x38')]=qs[_0xf2fa('0x39')](_['pick'](_0x1b8532['query'],_0x3e631d[_0xf2fa('0x39')]),_0x19a4ad);if(_0x1b8532['query'][_0xf2fa('0x3a')]){_0x18fefb[_0xf2fa('0x38')]=_[_0xf2fa('0x3b')](_0x18fefb[_0xf2fa('0x38')],{'$or':_[_0xf2fa('0x2a')](_0x19a4ad,function(_0x8ab728){if(_0x8ab728[_0xf2fa('0x2d')]!=='VIRTUAL'){var _0x5a324e={};_0x5a324e[_0x8ab728['name']]={'$like':'%'+_0x1b8532[_0xf2fa('0x30')][_0xf2fa('0x3a')]+'%'};return _0x5a324e;}})});}_0x18fefb=_[_0xf2fa('0x3b')]({},_0x18fefb,_0x1b8532[_0xf2fa('0x3c')]);var _0x178f84={'where':_0x18fefb[_0xf2fa('0x38')]};return db[_0xf2fa('0x2b')][_0xf2fa('0x20')](_0x178f84)[_0xf2fa('0x3d')](function(_0x166668){_0x50ead8[_0xf2fa('0x20')]=_0x166668;if(_0x1b8532[_0xf2fa('0x30')][_0xf2fa('0x3e')]){_0x18fefb[_0xf2fa('0x3f')]=[{'all':!![]}];}return db[_0xf2fa('0x2b')][_0xf2fa('0x40')](_0x18fefb);})['then'](function(_0x4dc672){_0x50ead8[_0xf2fa('0x41')]=_0x4dc672;return _0x50ead8;})['then'](respondWithFilteredResult(_0xd4a340,_0x18fefb))[_0xf2fa('0x42')](handleError(_0xd4a340,null));};exports['show']=function(_0x38aed5,_0x1005f4){var _0x110902={'raw':!![],'where':{'id':_0x38aed5[_0xf2fa('0x43')]['id']}},_0x44c14d={};_0x44c14d[_0xf2fa('0x2f')]=_['keys'](db['WhatsappApplication'][_0xf2fa('0x44')]);_0x44c14d[_0xf2fa('0x30')]=_[_0xf2fa('0x31')](_0x38aed5[_0xf2fa('0x30')]);_0x44c14d['filters']=_[_0xf2fa('0x33')](_0x44c14d[_0xf2fa('0x2f')],_0x44c14d[_0xf2fa('0x30')]);_0x110902['attributes']=_[_0xf2fa('0x33')](_0x44c14d['model'],qs[_0xf2fa('0x34')](_0x38aed5[_0xf2fa('0x30')][_0xf2fa('0x34')]));_0x110902[_0xf2fa('0x32')]=_0x110902[_0xf2fa('0x32')][_0xf2fa('0x35')]?_0x110902[_0xf2fa('0x32')]:_0x44c14d[_0xf2fa('0x2f')];if(_0x38aed5[_0xf2fa('0x30')][_0xf2fa('0x3e')]){_0x110902[_0xf2fa('0x3f')]=[{'all':!![]}];}_0x110902=_[_0xf2fa('0x3b')]({},_0x110902,_0x38aed5['options']);return db['WhatsappApplication']['find'](_0x110902)[_0xf2fa('0x3d')](handleEntityNotFound(_0x1005f4,null))[_0xf2fa('0x3d')](respondWithResult(_0x1005f4,null))['catch'](handleError(_0x1005f4,null));};exports[_0xf2fa('0x45')]=function(_0x158d43,_0x3769cf){return db[_0xf2fa('0x2b')]['create'](_0x158d43['body'],{})[_0xf2fa('0x3d')](respondWithResult(_0x3769cf,0xc9))['catch'](handleError(_0x3769cf,null));};exports[_0xf2fa('0x46')]=function(_0x534c5f,_0x5b62a3){if(_0x534c5f['body']['id']){delete _0x534c5f[_0xf2fa('0x47')]['id'];}return db[_0xf2fa('0x2b')]['find']({'where':{'id':_0x534c5f['params']['id']}})[_0xf2fa('0x3d')](handleEntityNotFound(_0x5b62a3,null))['then'](saveUpdates(_0x534c5f[_0xf2fa('0x47')],null))[_0xf2fa('0x3d')](respondWithResult(_0x5b62a3,null))[_0xf2fa('0x42')](handleError(_0x5b62a3,null));};exports[_0xf2fa('0x48')]=function(_0x30a57b,_0x3366df){return db[_0xf2fa('0x2b')][_0xf2fa('0x49')]({'where':{'id':_0x30a57b[_0xf2fa('0x43')]['id']}})[_0xf2fa('0x3d')](handleEntityNotFound(_0x3366df,null))[_0xf2fa('0x3d')](removeEntity(_0x3366df,null))[_0xf2fa('0x42')](handleError(_0x3366df,null));}; \ No newline at end of file +var _0x202a=['../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','apply','save','then','destroy','send','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','model','name','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','keys','length','find','catch','create','body','update','rimraf','zip-dir','fast-json-patch','moment','path','sox','fs-extra','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util'];(function(_0x3c75bf,_0xfa1998){var _0x17ef87=function(_0x26be3b){while(--_0x26be3b){_0x3c75bf['push'](_0x3c75bf['shift']());}};_0x17ef87(++_0xfa1998);}(_0x202a,0xc0));var _0xa202=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x202a[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa202('0x0'));var zipdir=require(_0xa202('0x1'));var jsonpatch=require(_0xa202('0x2'));var rp=require('request-promise');var moment=require(_0xa202('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xa202('0x4'));var sox=require(_0xa202('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa202('0x6'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa202('0x7'));var deskjs=require(_0xa202('0x8'));var toCsv=require(_0xa202('0x9'));var querystring=require(_0xa202('0xa'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa202('0xb'));var qs=require(_0xa202('0xc'));var as=require(_0xa202('0xd'));var hardwareService=require(_0xa202('0xe'));var logger=require('../../config/logger')(_0xa202('0xf'));var utils=require('../../config/utils');var config=require(_0xa202('0x10'));var licenseUtil=require(_0xa202('0x11'));var db=require(_0xa202('0x12'))['db'];function respondWithStatusCode(_0x5bef49,_0x16164b){_0x16164b=_0x16164b||0xcc;return function(_0xdd992){if(_0xdd992){return _0x5bef49[_0xa202('0x13')](_0x16164b);}return _0x5bef49[_0xa202('0x14')](_0x16164b)[_0xa202('0x15')]();};}function respondWithResult(_0x29969e,_0x598d8e){_0x598d8e=_0x598d8e||0xc8;return function(_0x13510c){if(_0x13510c){return _0x29969e[_0xa202('0x14')](_0x598d8e)[_0xa202('0x16')](_0x13510c);}};}function respondWithFilteredResult(_0x28953b,_0x2e1790){return function(_0x5dc065){if(_0x5dc065){var _0x331df8=typeof _0x2e1790[_0xa202('0x17')]===_0xa202('0x18')&&typeof _0x2e1790[_0xa202('0x19')]===_0xa202('0x18');var _0x214a08=_0x5dc065['count'];var _0x44a1b6=_0x331df8?0x0:_0x2e1790['offset'];var _0x130df2=_0x331df8?_0x5dc065['count']:_0x2e1790[_0xa202('0x17')]+_0x2e1790[_0xa202('0x19')];var _0x130c45;if(_0x130df2>=_0x214a08){_0x130df2=_0x214a08;_0x130c45=0xc8;}else{_0x130c45=0xce;}_0x28953b[_0xa202('0x14')](_0x130c45);return _0x28953b[_0xa202('0x1a')]('Content-Range',_0x44a1b6+'-'+_0x130df2+'/'+_0x214a08)[_0xa202('0x16')](_0x5dc065);}return null;};}function patchUpdates(_0x6132f1){return function(_0x353440){try{jsonpatch[_0xa202('0x1b')](_0x353440,_0x6132f1,!![]);}catch(_0x188195){return BPromise['reject'](_0x188195);}return _0x353440[_0xa202('0x1c')]();};}function saveUpdates(_0x7b47e5,_0x46cfa4){return function(_0x44801a){if(_0x44801a){return _0x44801a['update'](_0x7b47e5)[_0xa202('0x1d')](function(_0x192d3c){return _0x192d3c;});}return null;};}function removeEntity(_0x5b764d,_0x565685){return function(_0x7991c7){if(_0x7991c7){return _0x7991c7[_0xa202('0x1e')]()['then'](function(){_0x5b764d[_0xa202('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5373b6,_0x72fe3e){return function(_0x268ee9){if(!_0x268ee9){_0x5373b6[_0xa202('0x13')](0x194);}return _0x268ee9;};}function handleError(_0x2f0779,_0xf13878){_0xf13878=_0xf13878||0x1f4;return function(_0x1d6704){logger['error'](_0x1d6704['stack']);if(_0x1d6704['name']){delete _0x1d6704['name'];}_0x2f0779[_0xa202('0x14')](_0xf13878)[_0xa202('0x1f')](_0x1d6704);};}exports[_0xa202('0x20')]=function(_0x57f049,_0x35ae40){var _0x390633={},_0xf73ab4={},_0x2cc2af={'count':0x0,'rows':[]};var _0x3eed2c=_[_0xa202('0x21')](db[_0xa202('0x22')][_0xa202('0x23')],function(_0x22ba67){return{'name':_0x22ba67[_0xa202('0x24')],'type':_0x22ba67[_0xa202('0x25')][_0xa202('0x26')]};});_0xf73ab4[_0xa202('0x27')]=_[_0xa202('0x21')](_0x3eed2c,_0xa202('0x28'));_0xf73ab4[_0xa202('0x29')]=_['keys'](_0x57f049[_0xa202('0x29')]);_0xf73ab4[_0xa202('0x2a')]=_[_0xa202('0x2b')](_0xf73ab4[_0xa202('0x27')],_0xf73ab4[_0xa202('0x29')]);_0x390633[_0xa202('0x2c')]=_['intersection'](_0xf73ab4[_0xa202('0x27')],qs[_0xa202('0x2d')](_0x57f049['query'][_0xa202('0x2d')]));_0x390633[_0xa202('0x2c')]=_0x390633['attributes']['length']?_0x390633['attributes']:_0xf73ab4[_0xa202('0x27')];if(!_0x57f049[_0xa202('0x29')][_0xa202('0x2e')](_0xa202('0x2f'))){_0x390633[_0xa202('0x19')]=qs['limit'](_0x57f049[_0xa202('0x29')]['limit']);_0x390633[_0xa202('0x17')]=qs[_0xa202('0x17')](_0x57f049[_0xa202('0x29')]['offset']);}_0x390633[_0xa202('0x30')]=qs['sort'](_0x57f049['query'][_0xa202('0x31')]);_0x390633[_0xa202('0x32')]=qs['filters'](_[_0xa202('0x33')](_0x57f049['query'],_0xf73ab4['filters']),_0x3eed2c);if(_0x57f049[_0xa202('0x29')][_0xa202('0x34')]){_0x390633['where']=_[_0xa202('0x35')](_0x390633[_0xa202('0x32')],{'$or':_[_0xa202('0x21')](_0x3eed2c,function(_0x527921){if(_0x527921[_0xa202('0x25')]!==_0xa202('0x36')){var _0x34ba33={};_0x34ba33[_0x527921[_0xa202('0x28')]]={'$like':'%'+_0x57f049[_0xa202('0x29')][_0xa202('0x34')]+'%'};return _0x34ba33;}})});}_0x390633=_[_0xa202('0x35')]({},_0x390633,_0x57f049[_0xa202('0x37')]);var _0x226863={'where':_0x390633[_0xa202('0x32')]};return db[_0xa202('0x22')][_0xa202('0x38')](_0x226863)['then'](function(_0x5bd528){_0x2cc2af[_0xa202('0x38')]=_0x5bd528;if(_0x57f049[_0xa202('0x29')][_0xa202('0x39')]){_0x390633[_0xa202('0x3a')]=[{'all':!![]}];}return db[_0xa202('0x22')][_0xa202('0x3b')](_0x390633);})[_0xa202('0x1d')](function(_0x3bca66){_0x2cc2af[_0xa202('0x3c')]=_0x3bca66;return _0x2cc2af;})[_0xa202('0x1d')](respondWithFilteredResult(_0x35ae40,_0x390633))['catch'](handleError(_0x35ae40,null));};exports[_0xa202('0x3d')]=function(_0x9879fe,_0x51c551){var _0x48a546={'raw':!![],'where':{'id':_0x9879fe[_0xa202('0x3e')]['id']}},_0x4f783c={};_0x4f783c[_0xa202('0x27')]=_[_0xa202('0x3f')](db[_0xa202('0x22')]['rawAttributes']);_0x4f783c[_0xa202('0x29')]=_[_0xa202('0x3f')](_0x9879fe[_0xa202('0x29')]);_0x4f783c[_0xa202('0x2a')]=_['intersection'](_0x4f783c[_0xa202('0x27')],_0x4f783c[_0xa202('0x29')]);_0x48a546[_0xa202('0x2c')]=_['intersection'](_0x4f783c[_0xa202('0x27')],qs[_0xa202('0x2d')](_0x9879fe[_0xa202('0x29')][_0xa202('0x2d')]));_0x48a546[_0xa202('0x2c')]=_0x48a546[_0xa202('0x2c')][_0xa202('0x40')]?_0x48a546[_0xa202('0x2c')]:_0x4f783c[_0xa202('0x27')];if(_0x9879fe[_0xa202('0x29')][_0xa202('0x39')]){_0x48a546[_0xa202('0x3a')]=[{'all':!![]}];}_0x48a546=_['merge']({},_0x48a546,_0x9879fe[_0xa202('0x37')]);return db[_0xa202('0x22')][_0xa202('0x41')](_0x48a546)[_0xa202('0x1d')](handleEntityNotFound(_0x51c551,null))[_0xa202('0x1d')](respondWithResult(_0x51c551,null))[_0xa202('0x42')](handleError(_0x51c551,null));};exports[_0xa202('0x43')]=function(_0x77626c,_0x5979cd){return db[_0xa202('0x22')][_0xa202('0x43')](_0x77626c[_0xa202('0x44')],{})['then'](respondWithResult(_0x5979cd,0xc9))[_0xa202('0x42')](handleError(_0x5979cd,null));};exports[_0xa202('0x45')]=function(_0xc72f62,_0x55cfc5){if(_0xc72f62[_0xa202('0x44')]['id']){delete _0xc72f62[_0xa202('0x44')]['id'];}return db[_0xa202('0x22')][_0xa202('0x41')]({'where':{'id':_0xc72f62[_0xa202('0x3e')]['id']}})[_0xa202('0x1d')](handleEntityNotFound(_0x55cfc5,null))[_0xa202('0x1d')](saveUpdates(_0xc72f62[_0xa202('0x44')],null))[_0xa202('0x1d')](respondWithResult(_0x55cfc5,null))[_0xa202('0x42')](handleError(_0x55cfc5,null));};exports[_0xa202('0x1e')]=function(_0x4cb0a5,_0x38e236){return db[_0xa202('0x22')][_0xa202('0x41')]({'where':{'id':_0x4cb0a5['params']['id']}})['then'](handleEntityNotFound(_0x38e236,null))[_0xa202('0x1d')](removeEntity(_0x38e236,null))[_0xa202('0x42')](handleError(_0x38e236,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index b88c17a..8323323 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 _0x79d3=['WhatsappApplication','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./whatsappApplication.attributes','exports'];(function(_0x54d4a8,_0x585a59){var _0x3b321b=function(_0x245c6a){while(--_0x245c6a){_0x54d4a8['push'](_0x54d4a8['shift']());}};_0x3b321b(++_0x585a59);}(_0x79d3,0x15f));var _0x379d=function(_0x152678,_0x11e0ac){_0x152678=_0x152678-0x0;var _0x311a9=_0x79d3[_0x152678];return _0x311a9;};'use strict';var _=require(_0x379d('0x0'));var util=require('util');var logger=require(_0x379d('0x1'))('api');var moment=require(_0x379d('0x2'));var BPromise=require(_0x379d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x379d('0x4'));var rimraf=require(_0x379d('0x5'));var config=require(_0x379d('0x6'));var attributes=require(_0x379d('0x7'));module[_0x379d('0x8')]=function(_0x2078a6,_0x2a1b43){return _0x2078a6['define'](_0x379d('0x9'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x379d('0xa'),'collate':_0x379d('0xb')});}; \ No newline at end of file +var _0xd67b=['../../config/environment','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','util','api','moment','bluebird','path'];(function(_0x33b7a4,_0xa23d49){var _0x54af75=function(_0x21cbb1){while(--_0x21cbb1){_0x33b7a4['push'](_0x33b7a4['shift']());}};_0x54af75(++_0xa23d49);}(_0xd67b,0x133));var _0xbd67=function(_0x25f01c,_0x4092d2){_0x25f01c=_0x25f01c-0x0;var _0x42d647=_0xd67b[_0x25f01c];return _0x42d647;};'use strict';var _=require('lodash');var util=require(_0xbd67('0x0'));var logger=require('../../config/logger')(_0xbd67('0x1'));var moment=require(_0xbd67('0x2'));var BPromise=require(_0xbd67('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbd67('0x4'));var rimraf=require('rimraf');var config=require(_0xbd67('0x5'));var attributes=require('./whatsappApplication.attributes');module[_0xbd67('0x6')]=function(_0xa5c384,_0x2ad142){return _0xa5c384[_0xbd67('0x7')](_0xbd67('0x8'),attributes,{'tableName':_0xbd67('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbd67('0xa'),'collate':_0xbd67('0xb')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index cb451b4..a695ea8 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 _0xe5b3=['request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','WhatsappApplication,\x20%s,\x20%s'];(function(_0x3542dc,_0x1688a7){var _0x565444=function(_0x573905){while(--_0x573905){_0x3542dc['push'](_0x3542dc['shift']());}};_0x565444(++_0x1688a7);}(_0xe5b3,0x133));var _0x3e5b=function(_0x6dc1be,_0x22e567){_0x6dc1be=_0x6dc1be-0x0;var _0x2bcdcf=_0xe5b3[_0x6dc1be];return _0x2bcdcf;};'use strict';var _=require('lodash');var util=require(_0x3e5b('0x0'));var moment=require(_0x3e5b('0x1'));var BPromise=require(_0x3e5b('0x2'));var rs=require(_0x3e5b('0x3'));var fs=require('fs');var Redis=require(_0x3e5b('0x4'));var db=require(_0x3e5b('0x5'))['db'];var utils=require(_0x3e5b('0x6'));var logger=require(_0x3e5b('0x7'))(_0x3e5b('0x8'));var config=require(_0x3e5b('0x9'));var jayson=require(_0x3e5b('0xa'));var client=jayson['client'][_0x3e5b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5dcf55,_0x534e7d,_0x41d46f){return new BPromise(function(_0x3901c2,_0x3c7c2e){return client[_0x3e5b('0xc')](_0x5dcf55,_0x41d46f)['then'](function(_0x4ed6bc){logger[_0x3e5b('0xd')](_0x3e5b('0xe'),_0x534e7d,_0x3e5b('0xf'));logger[_0x3e5b('0x10')](_0x3e5b('0x11'),_0x534e7d,'request\x20sent',JSON[_0x3e5b('0x12')](_0x4ed6bc));if(_0x4ed6bc['error']){if(_0x4ed6bc[_0x3e5b('0x13')][_0x3e5b('0x14')]===0x1f4){logger[_0x3e5b('0x13')](_0x3e5b('0xe'),_0x534e7d,_0x4ed6bc[_0x3e5b('0x13')][_0x3e5b('0x15')]);return _0x3c7c2e(_0x4ed6bc[_0x3e5b('0x13')]['message']);}logger[_0x3e5b('0x13')]('WhatsappApplication,\x20%s,\x20%s',_0x534e7d,_0x4ed6bc['error']['message']);return _0x3901c2(_0x4ed6bc[_0x3e5b('0x13')][_0x3e5b('0x15')]);}else{logger[_0x3e5b('0xd')]('WhatsappApplication,\x20%s,\x20%s',_0x534e7d,_0x3e5b('0xf'));_0x3901c2(_0x4ed6bc['result']['message']);}})[_0x3e5b('0x16')](function(_0x11b41b){logger['error'](_0x3e5b('0xe'),_0x534e7d,_0x11b41b);_0x3c7c2e(_0x11b41b);});});} \ No newline at end of file +var _0x9bde=['code','message','WhatsappApplication,\x20%s,\x20%s','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x80dac1,_0x42bc1a){var _0x453e7a=function(_0x155262){while(--_0x155262){_0x80dac1['push'](_0x80dac1['shift']());}};_0x453e7a(++_0x42bc1a);}(_0x9bde,0xe1));var _0xe9bd=function(_0x21ad7c,_0x1be30c){_0x21ad7c=_0x21ad7c-0x0;var _0x2d0811=_0x9bde[_0x21ad7c];return _0x2d0811;};'use strict';var _=require('lodash');var util=require(_0xe9bd('0x0'));var moment=require('moment');var BPromise=require(_0xe9bd('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe9bd('0x2'));var db=require(_0xe9bd('0x3'))['db'];var utils=require(_0xe9bd('0x4'));var logger=require(_0xe9bd('0x5'))(_0xe9bd('0x6'));var config=require(_0xe9bd('0x7'));var jayson=require(_0xe9bd('0x8'));var client=jayson['client'][_0xe9bd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5f18fe,_0x22a438,_0xa66ae2){return new BPromise(function(_0x2d5c75,_0x3ef9e3){return client[_0xe9bd('0xa')](_0x5f18fe,_0xa66ae2)[_0xe9bd('0xb')](function(_0x439abc){logger[_0xe9bd('0xc')]('WhatsappApplication,\x20%s,\x20%s',_0x22a438,'request\x20sent');logger[_0xe9bd('0xd')](_0xe9bd('0xe'),_0x22a438,_0xe9bd('0xf'),JSON['stringify'](_0x439abc));if(_0x439abc[_0xe9bd('0x10')]){if(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x11')]===0x1f4){logger[_0xe9bd('0x10')]('WhatsappApplication,\x20%s,\x20%s',_0x22a438,_0x439abc[_0xe9bd('0x10')]['message']);return _0x3ef9e3(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}logger[_0xe9bd('0x10')]('WhatsappApplication,\x20%s,\x20%s',_0x22a438,_0x439abc['error'][_0xe9bd('0x12')]);return _0x2d5c75(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}else{logger[_0xe9bd('0xc')](_0xe9bd('0x13'),_0x22a438,_0xe9bd('0xf'));_0x2d5c75(_0x439abc[_0xe9bd('0x14')]['message']);}})[_0xe9bd('0x15')](function(_0x464a1b){logger[_0xe9bd('0x10')]('WhatsappApplication,\x20%s,\x20%s',_0x22a438,_0x464a1b);_0x3ef9e3(_0x464a1b);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 3e655c1..ede680e 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 _0xeda8=['get','isAuthenticated','index','describe','/:id','getMessages','post','create','/:id/messages','addMessage','tracked','whatsapp','addTags','put','whatsappinteraction:update','delete','destroy','/:id/tags','removeTags','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller'];(function(_0x3da95c,_0x33a8cb){var _0x112db0=function(_0x2ac6f8){while(--_0x2ac6f8){_0x3da95c['push'](_0x3da95c['shift']());}};_0x112db0(++_0x33a8cb);}(_0xeda8,0x104));var _0x8eda=function(_0x7d04e6,_0x57731){_0x7d04e6=_0x7d04e6-0x0;var _0x5ac53b=_0xeda8[_0x7d04e6];return _0x5ac53b;};'use strict';var multer=require(_0x8eda('0x0'));var util=require(_0x8eda('0x1'));var path=require('path');var timeout=require(_0x8eda('0x2'));var express=require(_0x8eda('0x3'));var router=express[_0x8eda('0x4')]();var fs_extra=require(_0x8eda('0x5'));var auth=require(_0x8eda('0x6'));var interaction=require(_0x8eda('0x7'));var config=require(_0x8eda('0x8'));var controller=require(_0x8eda('0x9'));router[_0x8eda('0xa')]('/',auth[_0x8eda('0xb')](),controller[_0x8eda('0xc')]);router[_0x8eda('0xa')]('/describe',auth[_0x8eda('0xb')](),controller[_0x8eda('0xd')]);router[_0x8eda('0xa')](_0x8eda('0xe'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/messages',auth[_0x8eda('0xb')](),controller[_0x8eda('0xf')]);router[_0x8eda('0xa')]('/:id/download',auth[_0x8eda('0xb')](),controller['download']);router[_0x8eda('0x10')]('/',auth[_0x8eda('0xb')](),controller[_0x8eda('0x11')]);router[_0x8eda('0x10')](_0x8eda('0x12'),auth[_0x8eda('0xb')](),controller[_0x8eda('0x13')]);router[_0x8eda('0x10')]('/:id/tags',auth['isAuthenticated'](),interaction[_0x8eda('0x14')](_0x8eda('0x15'),'whatsappinteraction:addtags'),controller[_0x8eda('0x16')]);router[_0x8eda('0x17')](_0x8eda('0xe'),auth['isAuthenticated'](),interaction[_0x8eda('0x14')]('whatsapp',_0x8eda('0x18')),controller['update']);router[_0x8eda('0x19')]('/:id',auth[_0x8eda('0xb')](),interaction[_0x8eda('0x14')]('whatsapp','whatsappinteraction:destroy'),controller[_0x8eda('0x1a')]);router[_0x8eda('0x19')](_0x8eda('0x1b'),auth[_0x8eda('0xb')](),controller[_0x8eda('0x1c')]);module[_0x8eda('0x1d')]=router; \ No newline at end of file +var _0x5162=['whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','delete','removeTags','exports','multer','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','post','create','addMessage','/:id/tags','tracked','whatsapp'];(function(_0x31dba6,_0x5109ee){var _0xb903f2=function(_0x4ad34c){while(--_0x4ad34c){_0x31dba6['push'](_0x31dba6['shift']());}};_0xb903f2(++_0x5109ee);}(_0x5162,0x103));var _0x2516=function(_0x56922c,_0x347c88){_0x56922c=_0x56922c-0x0;var _0xf896d7=_0x5162[_0x56922c];return _0xf896d7;};'use strict';var multer=require(_0x2516('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2516('0x1')]();var fs_extra=require(_0x2516('0x2'));var auth=require(_0x2516('0x3'));var interaction=require(_0x2516('0x4'));var config=require(_0x2516('0x5'));var controller=require(_0x2516('0x6'));router[_0x2516('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x2516('0x8'),auth[_0x2516('0x9')](),controller[_0x2516('0xa')]);router[_0x2516('0x7')](_0x2516('0xb'),auth[_0x2516('0x9')](),controller[_0x2516('0xc')]);router['get'](_0x2516('0xd'),auth[_0x2516('0x9')](),controller[_0x2516('0xe')]);router['get']('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0x2516('0xf')]('/',auth[_0x2516('0x9')](),controller[_0x2516('0x10')]);router[_0x2516('0xf')]('/:id/messages',auth[_0x2516('0x9')](),controller[_0x2516('0x11')]);router[_0x2516('0xf')](_0x2516('0x12'),auth[_0x2516('0x9')](),interaction[_0x2516('0x13')](_0x2516('0x14'),_0x2516('0x15')),controller[_0x2516('0x16')]);router[_0x2516('0x17')](_0x2516('0xb'),auth[_0x2516('0x9')](),interaction[_0x2516('0x13')](_0x2516('0x14'),_0x2516('0x18')),controller['update']);router[_0x2516('0x19')](_0x2516('0xb'),auth[_0x2516('0x9')](),interaction['tracked'](_0x2516('0x14'),'whatsappinteraction:destroy'),controller['destroy']);router[_0x2516('0x19')](_0x2516('0x12'),auth[_0x2516('0x9')](),controller[_0x2516('0x1a')]);module[_0x2516('0x1b')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index dd7d900..78011b4 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 _0x110e=['sequelize','moment','BOOLEAN','DATE','STRING','out','ENUM','INTEGER'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x110e,0x68));var _0xe110=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0x110e[_0x25e7cb];return _0x375d92;};'use strict';var Sequelize=require(_0xe110('0x0'));var moment=require(_0xe110('0x1'));module['exports']={'closed':{'type':Sequelize[_0xe110('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe110('0x3')]},'disposition':{'type':Sequelize[_0xe110('0x4')]},'secondDisposition':{'type':Sequelize[_0xe110('0x4')]},'thirdDisposition':{'type':Sequelize[_0xe110('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xe110('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xe110('0x6')]('in',_0xe110('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xe110('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xe110('0x7')]}}; \ No newline at end of file +var _0x79d7=['ENUM','INTEGER','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x164b8a,_0x17a129){var _0x4c2bd9=function(_0x21507b){while(--_0x21507b){_0x164b8a['push'](_0x164b8a['shift']());}};_0x4c2bd9(++_0x17a129);}(_0x79d7,0x9c));var _0x779d=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x79d7[_0x1969a7];return _0x3d665f;};'use strict';var Sequelize=require(_0x779d('0x0'));var moment=require('moment');module[_0x779d('0x1')]={'closed':{'type':Sequelize[_0x779d('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x779d('0x3')]},'disposition':{'type':Sequelize[_0x779d('0x4')]},'secondDisposition':{'type':Sequelize[_0x779d('0x4')]},'thirdDisposition':{'type':Sequelize[_0x779d('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x779d('0x4')]},'read1stAt':{'type':Sequelize[_0x779d('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x779d('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x779d('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x779d('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x779d('0x6')]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index c2f8d30..795401d 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 _0x571e=['rows','setTags','omit','spread','Tag','emit','removeTags','download','unix','toString','root','files','tmp','join','server','attachments','transcript-%d-%s.zip','push','User','fullname','Contact','Attachment','Messages','direction','secret','read','WhatsappAccount','Account','Owner','get','closed','closedAt','format','disposition','basename','existsSync','createReadStream','pipe','createWriteStream','createdAt','out','System','lastName','renderFile','.pdf','Whatsapp','createPdfFromHTML','unlinkSync','rimraf','zip-dir','bluebird','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/environment','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','update','then','error','name','send','index','map','WhatsappInteraction','fieldName','type','key','getOptions','findAll','whatsapp','query','show','params','keys','rawAttributes','model','attributes','intersection','fields','length','includeAll','include','merge','catch','create','body','find','destroy','describe','WhatsappMessage','ids','getMessages','findOne','filters','hasOwnProperty','nolimit','order','sort','where','pick','WhatsappInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','count'];(function(_0x370ea2,_0x18390e){var _0x183043=function(_0x2c492b){while(--_0x2c492b){_0x370ea2['push'](_0x370ea2['shift']());}};_0x183043(++_0x18390e);}(_0x571e,0x1a4));var _0xe571=function(_0x58e181,_0x47c76c){_0x58e181=_0x58e181-0x0;var _0x34248d=_0x571e[_0x58e181];return _0x34248d;};'use strict';var rimraf=require(_0xe571('0x0'));var zipdir=require(_0xe571('0x1'));var moment=require('moment');var BPromise=require(_0xe571('0x2'));var util=require(_0xe571('0x3'));var path=require(_0xe571('0x4'));var ejs=require(_0xe571('0x5'));var fs=require('fs');var _=require(_0xe571('0x6'));var Redis=require(_0xe571('0x7'));var interaction=require(_0xe571('0x8'));var qs=require('../../components/parsers/qs');var pdf=require(_0xe571('0x9'));var logger=require('../../config/logger')('api');var config=require(_0xe571('0xa'));var db=require('../../mysqldb')['db'];config[_0xe571('0xb')]=_[_0xe571('0xc')](config[_0xe571('0xb')],{'host':_0xe571('0xd'),'port':0x18eb});var socket=require(_0xe571('0xe'))(new Redis(config['redis']));require(_0xe571('0xf'))[_0xe571('0x10')](socket);function respondWithStatusCode(_0x1bae9d,_0x361680){_0x361680=_0x361680||0xcc;return function(_0x41b8e6){if(_0x41b8e6){return _0x1bae9d[_0xe571('0x11')](_0x361680);}return _0x1bae9d[_0xe571('0x12')](_0x361680)[_0xe571('0x13')]();};}function respondWithResult(_0x2b2806,_0x516a0b){_0x516a0b=_0x516a0b||0xc8;return function(_0x25f88c){if(_0x25f88c){return _0x2b2806['status'](_0x516a0b)[_0xe571('0x14')](_0x25f88c);}};}function respondWithFilteredResult(_0x4bd322,_0x45b112){return function(_0x34238f){if(_0x34238f){var _0x43e9bd=typeof _0x45b112[_0xe571('0x15')]===_0xe571('0x16')&&typeof _0x45b112[_0xe571('0x17')]===_0xe571('0x16');var _0x1bcdce=_0x34238f['count'];var _0x54d6d0=_0x43e9bd?0x0:_0x45b112[_0xe571('0x15')];var _0x2f9f10=_0x43e9bd?_0x34238f['count']:_0x45b112['offset']+_0x45b112[_0xe571('0x17')];var _0x223070;if(_0x2f9f10>=_0x1bcdce){_0x2f9f10=_0x1bcdce;_0x223070=0xc8;}else{_0x223070=0xce;}_0x4bd322[_0xe571('0x12')](_0x223070);return _0x4bd322[_0xe571('0x18')](_0xe571('0x19'),_0x54d6d0+'-'+_0x2f9f10+'/'+_0x1bcdce)[_0xe571('0x14')](_0x34238f);}return null;};}function saveUpdates(_0x2e3c4b){return function(_0x4bc6b4){if(_0x4bc6b4){return _0x4bc6b4[_0xe571('0x1a')](_0x2e3c4b)[_0xe571('0x1b')](function(_0x30b0fe){return _0x30b0fe;});}return null;};}function removeEntity(_0x2a713a){return function(_0x48e27e){if(_0x48e27e){return _0x48e27e['destroy']()[_0xe571('0x1b')](function(){_0x2a713a['status'](0xcc)[_0xe571('0x13')]();});}};}function handleEntityNotFound(_0x20100b){return function(_0xe78a5f){if(!_0xe78a5f){_0x20100b[_0xe571('0x11')](0x194);}return _0xe78a5f;};}function handleError(_0x319b78,_0x508e8f){_0x508e8f=_0x508e8f||0x1f4;return function(_0x257fdc){logger[_0xe571('0x1c')](_0x257fdc['stack']);if(_0x257fdc[_0xe571('0x1d')]){delete _0x257fdc['name'];}_0x319b78[_0xe571('0x12')](_0x508e8f)[_0xe571('0x1e')](_0x257fdc);};}exports[_0xe571('0x1f')]=function(_0x24efe9,_0x4341bb){var _0xf59292={};var _0x5f0fcb=_[_0xe571('0x20')](db[_0xe571('0x21')]['rawAttributes'],function(_0x9ae173){return{'name':_0x9ae173[_0xe571('0x22')],'type':_0x9ae173[_0xe571('0x23')][_0xe571('0x24')]};});_0xf59292=qs[_0xe571('0x25')](_0x5f0fcb,_0x24efe9);return interaction[_0xe571('0x26')](_0xe571('0x27'),_0x24efe9[_0xe571('0x28')],_0x24efe9['user'],_0xf59292,_0x5f0fcb)[_0xe571('0x1b')](respondWithFilteredResult(_0x4341bb,_0xf59292))['catch'](handleError(_0x4341bb,null));};exports[_0xe571('0x29')]=function(_0x1e676d,_0x25c4e0){var _0x19f763={'raw':![],'where':{'id':_0x1e676d[_0xe571('0x2a')]['id']}},_0x2b6351={};_0x2b6351['model']=_[_0xe571('0x2b')](db[_0xe571('0x21')][_0xe571('0x2c')]);_0x2b6351['query']=_['keys'](_0x1e676d[_0xe571('0x28')]);_0x2b6351['filters']=_['intersection'](_0x2b6351[_0xe571('0x2d')],_0x2b6351[_0xe571('0x28')]);_0x19f763[_0xe571('0x2e')]=_[_0xe571('0x2f')](_0x2b6351['model'],qs['fields'](_0x1e676d['query'][_0xe571('0x30')]));_0x19f763['attributes']=_0x19f763[_0xe571('0x2e')][_0xe571('0x31')]?_0x19f763[_0xe571('0x2e')]:_0x2b6351[_0xe571('0x2d')];if(_0x1e676d[_0xe571('0x28')][_0xe571('0x32')]){_0x19f763[_0xe571('0x33')]=[{'all':!![]}];}_0x19f763=_[_0xe571('0x34')]({},_0x19f763,_0x1e676d['options']);return db['WhatsappInteraction']['find'](_0x19f763)['then'](handleEntityNotFound(_0x25c4e0,null))[_0xe571('0x1b')](respondWithResult(_0x25c4e0,null))[_0xe571('0x35')](handleError(_0x25c4e0,null));};exports[_0xe571('0x36')]=function(_0x2e19d3,_0x4e5126){return db[_0xe571('0x21')][_0xe571('0x36')](_0x2e19d3[_0xe571('0x37')],{})['then'](respondWithResult(_0x4e5126,0xc9))[_0xe571('0x35')](handleError(_0x4e5126,null));};exports[_0xe571('0x1a')]=function(_0x5d7dce,_0x2559ef){if(_0x5d7dce['body']['id']){delete _0x5d7dce[_0xe571('0x37')]['id'];}return db[_0xe571('0x21')][_0xe571('0x38')]({'where':{'id':_0x5d7dce[_0xe571('0x2a')]['id']}})['then'](handleEntityNotFound(_0x2559ef,null))['then'](saveUpdates(_0x5d7dce[_0xe571('0x37')],null))[_0xe571('0x1b')](respondWithResult(_0x2559ef,null))[_0xe571('0x35')](handleError(_0x2559ef,null));};exports[_0xe571('0x39')]=function(_0x11a101,_0x1fc99e){return db['WhatsappInteraction'][_0xe571('0x38')]({'where':{'id':_0x11a101[_0xe571('0x2a')]['id']}})['then'](handleEntityNotFound(_0x1fc99e,null))[_0xe571('0x1b')](removeEntity(_0x1fc99e,null))[_0xe571('0x35')](handleError(_0x1fc99e,null));};exports['describe']=function(_0x897d5c,_0x201e69){return db[_0xe571('0x21')][_0xe571('0x3a')]()[_0xe571('0x1b')](respondWithResult(_0x201e69,null))[_0xe571('0x35')](handleError(_0x201e69,null));};exports['addMessage']=function(_0x485b1e,_0x4bb2a3){return db[_0xe571('0x3b')]['find']({'where':{'id':_0x485b1e[_0xe571('0x2a')]['id']}})[_0xe571('0x1b')](handleEntityNotFound(_0x4bb2a3,null))['then'](function(_0x27779e){if(_0x27779e){return _0x27779e['addMessage'](_0x485b1e[_0xe571('0x37')][_0xe571('0x3c')],_['omit'](_0x485b1e[_0xe571('0x37')],[_0xe571('0x3c'),'id'])||{});}})['then'](respondWithResult(_0x4bb2a3,null))[_0xe571('0x35')](handleError(_0x4bb2a3,null));};exports[_0xe571('0x3d')]=function(_0x2c0817,_0x45d4b8){var _0x331e95={'raw':![],'where':{}};var _0x4e99e9={};var _0x496662={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0xe571('0x3e')]({'where':{'id':_0x2c0817[_0xe571('0x2a')]['id']}})['then'](handleEntityNotFound(_0x45d4b8,null))['then'](function(_0x872a3a){if(_0x872a3a){_0x4e99e9[_0xe571('0x2d')]=_[_0xe571('0x2b')](db['WhatsappMessage'][_0xe571('0x2c')]);_0x4e99e9[_0xe571('0x28')]=_[_0xe571('0x2b')](_0x2c0817[_0xe571('0x28')]);_0x4e99e9[_0xe571('0x3f')]=_[_0xe571('0x2f')](_0x4e99e9[_0xe571('0x2d')],_0x4e99e9[_0xe571('0x28')]);_0x331e95[_0xe571('0x2e')]=_['intersection'](_0x4e99e9[_0xe571('0x2d')],qs[_0xe571('0x30')](_0x2c0817[_0xe571('0x28')][_0xe571('0x30')]));_0x331e95['attributes']=_0x331e95[_0xe571('0x2e')][_0xe571('0x31')]?_0x331e95[_0xe571('0x2e')]:_0x4e99e9[_0xe571('0x2d')];if(!_0x2c0817[_0xe571('0x28')][_0xe571('0x40')](_0xe571('0x41'))){_0x331e95[_0xe571('0x17')]=qs[_0xe571('0x17')](_0x2c0817[_0xe571('0x28')][_0xe571('0x17')]);_0x331e95[_0xe571('0x15')]=qs[_0xe571('0x15')](_0x2c0817[_0xe571('0x28')][_0xe571('0x15')]);}_0x331e95[_0xe571('0x42')]=qs[_0xe571('0x43')](_0x2c0817[_0xe571('0x28')]['sort']);_0x331e95[_0xe571('0x44')]=qs['filters'](_[_0xe571('0x45')](_0x2c0817['query'],_0x4e99e9['filters']));_0x331e95['where'][_0xe571('0x46')]=_0x872a3a['id'];if(_0x2c0817[_0xe571('0x28')][_0xe571('0x47')]){_0x331e95[_0xe571('0x44')]=_[_0xe571('0x34')](_0x331e95[_0xe571('0x44')],{'$or':_[_0xe571('0x20')](_0x331e95[_0xe571('0x2e')],function(_0x5a9f9b){var _0x279f3a={};_0x279f3a[_0x5a9f9b]={'$like':'%'+_0x2c0817[_0xe571('0x28')][_0xe571('0x47')]+'%'};return _0x279f3a;})});}if(_0x2c0817[_0xe571('0x28')][_0xe571('0x48')]){var _0x2c4419=_0x2c0817[_0xe571('0x28')][_0xe571('0x48')][_0xe571('0x49')](',');var _0x4f0791={};_0x4f0791[_0x2c4419[0x0]]={'$gte':moment(_0x2c4419[0x1])['format'](_0xe571('0x4a'))};_0x331e95[_0xe571('0x44')]=_['merge'](_0x331e95[_0xe571('0x44')],_0x4f0791);}_0x331e95=_['merge']({},_0x331e95,_0x2c0817['options']);return db['WhatsappMessage'][_0xe571('0x4b')]({'where':_0x331e95[_0xe571('0x44')]})[_0xe571('0x1b')](function(_0x77f4b4){_0x496662[_0xe571('0x4b')]=_0x77f4b4;if(_0x2c0817['query']['includeAll']){_0x331e95[_0xe571('0x33')]=[{'all':!![]}];}return db[_0xe571('0x3b')]['findAll'](_0x331e95);})[_0xe571('0x1b')](function(_0x25510f){_0x496662[_0xe571('0x4c')]=_0x25510f;return _0x496662;});}})[_0xe571('0x1b')](respondWithFilteredResult(_0x45d4b8,_0x331e95))[_0xe571('0x35')](handleError(_0x45d4b8,null));};exports['addTags']=function(_0xe9bf8c,_0x93bf1e){return db[_0xe571('0x21')][_0xe571('0x38')]({'where':{'id':_0xe9bf8c[_0xe571('0x2a')]['id']}})[_0xe571('0x1b')](handleEntityNotFound(_0x93bf1e,null))['then'](function(_0x4f83d7){if(_0x4f83d7){return _0x4f83d7[_0xe571('0x4d')](_0xe9bf8c[_0xe571('0x37')][_0xe571('0x3c')],_[_0xe571('0x4e')](_0xe9bf8c[_0xe571('0x37')],[_0xe571('0x3c'),'id'])||{})[_0xe571('0x4f')](function(){return db[_0xe571('0x50')][_0xe571('0x26')]({'attributes':['id',_0xe571('0x1d'),'color'],'where':{'id':_0xe9bf8c['body'][_0xe571('0x3c')]}});})['then'](function(_0x507266){socket[_0xe571('0x51')]('whatsappInteractionTags:save',{'id':Number(_0xe9bf8c[_0xe571('0x2a')]['id']),'tags':_0x507266||[]});return{'id':Number(_0xe9bf8c['params']['id']),'tags':_0x507266||[]};});}})[_0xe571('0x1b')](respondWithResult(_0x93bf1e,null))[_0xe571('0x35')](handleError(_0x93bf1e,null));};exports[_0xe571('0x52')]=function(_0x3c3795,_0x43007e){return db[_0xe571('0x21')][_0xe571('0x38')]({'where':{'id':_0x3c3795[_0xe571('0x2a')]['id']}})[_0xe571('0x1b')](handleEntityNotFound(_0x43007e,null))['then'](function(_0x1e5f77){if(_0x1e5f77){return _0x1e5f77[_0xe571('0x52')](_0x3c3795['query'][_0xe571('0x3c')]);}})['then'](respondWithStatusCode(_0x43007e,null))[_0xe571('0x35')](handleError(_0x43007e,null));};exports[_0xe571('0x53')]=function(_0x24597c,_0x375aed){var _0x111ee7=moment()[_0xe571('0x54')]()[_0xe571('0x55')]();var _0x42028d=path['join'](config[_0xe571('0x56')],'server',_0xe571('0x57'),_0xe571('0x58'));var _0x206199=path[_0xe571('0x59')](config[_0xe571('0x56')],_0xe571('0x5a'),_0xe571('0x57'),_0xe571('0x5b'));var _0x49a9a2=path['join'](_0x42028d,_0x111ee7);var _0x249783=util['format'](_0xe571('0x5c'),_0x24597c['params']['id'],_0x111ee7);var _0x2fa9c8=path['join'](_0x42028d,_0x249783);var _0x515a4f=[];_0x515a4f[_0xe571('0x5d')]({'model':db[_0xe571('0x5e')],'as':'User','attributes':['id',_0xe571('0x5f')],'raw':!![]});_0x515a4f[_0xe571('0x5d')]({'model':db['CmContact'],'as':_0xe571('0x60'),'attributes':['id','firstName','lastName'],'raw':!![]});if(_0x24597c[_0xe571('0x28')]['attachments']){_0x515a4f[_0xe571('0x5d')]({'model':db[_0xe571('0x61')],'as':_0xe571('0x61'),'raw':!![]});}var _0x58bf34=[{'model':db[_0xe571('0x3b')],'as':_0xe571('0x62'),'attributes':['id','body','createdAt',_0xe571('0x63'),_0xe571('0x64'),_0xe571('0x65')],'include':_0x515a4f}];_0x58bf34[_0xe571('0x5d')]({'model':db[_0xe571('0x66')],'as':_0xe571('0x67'),'attributes':['id',_0xe571('0x1d')]});_0x58bf34['push']({'model':db['User'],'as':_0xe571('0x68'),'attributes':['id','fullname']});return db[_0xe571('0x21')][_0xe571('0x38')]({'where':{'id':_0x24597c[_0xe571('0x2a')]['id']},'include':_0x58bf34})[_0xe571('0x1b')](handleEntityNotFound(_0x375aed,null))[_0xe571('0x1b')](function(_0x589068){if(_0x589068){var _0x248e08=_0x589068[_0xe571('0x69')]({'plain':!![]});fs['mkdirSync'](_0x49a9a2);var _0x3c374b={'channel':'Whatsapp','account':_0x248e08[_0xe571('0x67')][_0xe571('0x1d')],'agent':_0x248e08[_0xe571('0x68')]?_0x248e08['Owner'][_0xe571('0x5f')]:'N.A.','createdAt':moment(_0x248e08['createdAt'])['format'](_0xe571('0x4a'))[_0xe571('0x55')](),'closedAt':_0x248e08[_0xe571('0x6a')]?moment(_0x248e08[_0xe571('0x6b')])[_0xe571('0x6c')](_0xe571('0x4a'))[_0xe571('0x55')]():'','disposition':_0x248e08[_0xe571('0x6d')],'messages':_(_0x248e08['Messages'])[_0xe571('0x47')]({'secret':![]})['map'](function(_0x542af6){if(_0x542af6[_0xe571('0x61')]){var _0x41c1a4=path['join'](_0x206199,_0x542af6[_0xe571('0x61')][_0xe571('0x6e')]);if(fs[_0xe571('0x6f')](_0x41c1a4)){fs[_0xe571('0x70')](_0x41c1a4)[_0xe571('0x71')](fs[_0xe571('0x72')](path[_0xe571('0x59')](_0x49a9a2,_0x542af6[_0xe571('0x61')][_0xe571('0x6e')])));}}return{'date':moment(_0x542af6[_0xe571('0x73')])[_0xe571('0x6c')]('YYYY-MM-DD\x20HH:mm:ss')[_0xe571('0x55')](),'sender':_0x542af6[_0xe571('0x63')]===_0xe571('0x74')?_0x542af6[_0xe571('0x5e')]?_0x542af6['User'][_0xe571('0x5f')]:_0xe571('0x75'):_0x542af6[_0xe571('0x60')]['firstName']+(_0x542af6['Contact']['lastName']?'\x20'+_0x542af6['Contact'][_0xe571('0x76')]:''),'body':_0x542af6[_0xe571('0x61')]?_0x542af6['Attachment']['basename']:_0x542af6['body'],'direction':_0x542af6['direction']===_0xe571('0x74')?'A':'C','secret':_0x542af6[_0xe571('0x64')],'read':_0x542af6['read'],'attachment':_0x542af6[_0xe571('0x61')]};})['value']()};return ejs[_0xe571('0x77')](path[_0xe571('0x59')](config[_0xe571('0x56')],_0xe571('0x5a'),'views','downloadInteraction.ejs'),{'interaction':_0x3c374b})[_0xe571('0x1b')](function(_0x78d7c2){var _0x309b38=path[_0xe571('0x59')](_0x49a9a2,'transcript-'+_0x248e08['id']+'-'+_0x111ee7+_0xe571('0x78'));var _0x1a9ea6={'path':_0x309b38,'channel':_0xe571('0x79'),'interactionId':_0x248e08['id']};return pdf[_0xe571('0x7a')](_0x78d7c2,_0x1a9ea6);})['then'](function(){return new BPromise(function(_0x20c934,_0x153b05){zipdir(_0x49a9a2,{'saveTo':_0x2fa9c8},function(_0x139914,_0x16a81c){if(_0x139914)return _0x153b05(_0x139914);return _0x20c934(_0x16a81c);});})[_0xe571('0x1b')](function(){return new BPromise(function(_0xa53f3,_0x403d71){rimraf(_0x49a9a2,function(_0x2a43cd){if(_0x2a43cd)_0x403d71(_0x2a43cd);return _0xa53f3();});});})['then'](function(){return _0x375aed[_0xe571('0x53')](_0x2fa9c8,_0x249783,function(_0x9826ac){if(_0x9826ac){console['log']('err',_0x9826ac);}else{fs[_0xe571('0x7b')](_0x2fa9c8);}});});});}else{return _0x375aed['sendStatus'](0xc8);}})[_0xe571('0x35')](handleError(_0x375aed,null));}; \ No newline at end of file +var _0xd897=['map','WhatsappInteraction','rawAttributes','fieldName','key','getOptions','findAll','whatsapp','query','user','model','keys','filters','intersection','attributes','fields','includeAll','include','merge','options','find','catch','create','body','params','describe','addMessage','WhatsappMessage','ids','omit','getMessages','length','hasOwnProperty','order','sort','pick','where','WhatsappInteractionId','filter','$gte','split','format','addTags','spread','Tag','whatsappInteractionTags:save','removeTags','unix','toString','join','root','files','tmp','server','attachments','transcript-%d-%s.zip','push','User','CmContact','firstName','lastName','Attachment','direction','WhatsappAccount','Account','Owner','get','Whatsapp','fullname','N.A.','createdAt','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','Messages','basename','existsSync','createReadStream','out','System','Contact','secret','read','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','zip-dir','moment','path','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','redis','localhost','socket.io-emitter','register','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','update','then','error','name','send','index'];(function(_0x4920e8,_0x58e4fd){var _0x197211=function(_0x2ae3f4){while(--_0x2ae3f4){_0x4920e8['push'](_0x4920e8['shift']());}};_0x197211(++_0x58e4fd);}(_0xd897,0xd5));var _0x7d89=function(_0xa3ca0f,_0x456a23){_0xa3ca0f=_0xa3ca0f-0x0;var _0x529ee7=_0xd897[_0xa3ca0f];return _0x529ee7;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x7d89('0x0'));var moment=require(_0x7d89('0x1'));var BPromise=require('bluebird');var util=require('util');var path=require(_0x7d89('0x2'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var Redis=require(_0x7d89('0x3'));var interaction=require(_0x7d89('0x4'));var qs=require(_0x7d89('0x5'));var pdf=require(_0x7d89('0x6'));var logger=require(_0x7d89('0x7'))(_0x7d89('0x8'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x7d89('0x9')]=_['defaults'](config[_0x7d89('0x9')],{'host':_0x7d89('0xa'),'port':0x18eb});var socket=require(_0x7d89('0xb'))(new Redis(config[_0x7d89('0x9')]));require('./whatsappInteraction.socket')[_0x7d89('0xc')](socket);function respondWithStatusCode(_0x41523a,_0x4d211b){_0x4d211b=_0x4d211b||0xcc;return function(_0x359178){if(_0x359178){return _0x41523a[_0x7d89('0xd')](_0x4d211b);}return _0x41523a['status'](_0x4d211b)[_0x7d89('0xe')]();};}function respondWithResult(_0x37a8d3,_0x2e2f08){_0x2e2f08=_0x2e2f08||0xc8;return function(_0x4f1b58){if(_0x4f1b58){return _0x37a8d3['status'](_0x2e2f08)[_0x7d89('0xf')](_0x4f1b58);}};}function respondWithFilteredResult(_0x588a70,_0x464f77){return function(_0x5cd7d6){if(_0x5cd7d6){var _0x424aab=typeof _0x464f77[_0x7d89('0x10')]===_0x7d89('0x11')&&typeof _0x464f77[_0x7d89('0x12')]===_0x7d89('0x11');var _0x84135a=_0x5cd7d6[_0x7d89('0x13')];var _0x2ae675=_0x424aab?0x0:_0x464f77[_0x7d89('0x10')];var _0xc07aba=_0x424aab?_0x5cd7d6[_0x7d89('0x13')]:_0x464f77[_0x7d89('0x10')]+_0x464f77['limit'];var _0x22594a;if(_0xc07aba>=_0x84135a){_0xc07aba=_0x84135a;_0x22594a=0xc8;}else{_0x22594a=0xce;}_0x588a70[_0x7d89('0x14')](_0x22594a);return _0x588a70[_0x7d89('0x15')](_0x7d89('0x16'),_0x2ae675+'-'+_0xc07aba+'/'+_0x84135a)[_0x7d89('0xf')](_0x5cd7d6);}return null;};}function saveUpdates(_0x4a48bf){return function(_0x4fa7c4){if(_0x4fa7c4){return _0x4fa7c4[_0x7d89('0x17')](_0x4a48bf)[_0x7d89('0x18')](function(_0x1043ec){return _0x1043ec;});}return null;};}function removeEntity(_0x4e3315){return function(_0x93493c){if(_0x93493c){return _0x93493c['destroy']()[_0x7d89('0x18')](function(){_0x4e3315['status'](0xcc)[_0x7d89('0xe')]();});}};}function handleEntityNotFound(_0x5a37c2){return function(_0x1778fb){if(!_0x1778fb){_0x5a37c2[_0x7d89('0xd')](0x194);}return _0x1778fb;};}function handleError(_0x1111d7,_0x21c945){_0x21c945=_0x21c945||0x1f4;return function(_0x2a497b){logger[_0x7d89('0x19')](_0x2a497b['stack']);if(_0x2a497b[_0x7d89('0x1a')]){delete _0x2a497b[_0x7d89('0x1a')];}_0x1111d7[_0x7d89('0x14')](_0x21c945)[_0x7d89('0x1b')](_0x2a497b);};}exports[_0x7d89('0x1c')]=function(_0x358c00,_0x4feda4){var _0x137dfa={};var _0x11e6fd=_[_0x7d89('0x1d')](db[_0x7d89('0x1e')][_0x7d89('0x1f')],function(_0x1cf46f){return{'name':_0x1cf46f[_0x7d89('0x20')],'type':_0x1cf46f['type'][_0x7d89('0x21')]};});_0x137dfa=qs[_0x7d89('0x22')](_0x11e6fd,_0x358c00);return interaction[_0x7d89('0x23')](_0x7d89('0x24'),_0x358c00[_0x7d89('0x25')],_0x358c00[_0x7d89('0x26')],_0x137dfa,_0x11e6fd)[_0x7d89('0x18')](respondWithFilteredResult(_0x4feda4,_0x137dfa))['catch'](handleError(_0x4feda4,null));};exports['show']=function(_0x27c910,_0xe85176){var _0x2f3675={'raw':![],'where':{'id':_0x27c910['params']['id']}},_0x2c504c={};_0x2c504c[_0x7d89('0x27')]=_[_0x7d89('0x28')](db[_0x7d89('0x1e')][_0x7d89('0x1f')]);_0x2c504c[_0x7d89('0x25')]=_[_0x7d89('0x28')](_0x27c910[_0x7d89('0x25')]);_0x2c504c[_0x7d89('0x29')]=_[_0x7d89('0x2a')](_0x2c504c[_0x7d89('0x27')],_0x2c504c[_0x7d89('0x25')]);_0x2f3675[_0x7d89('0x2b')]=_[_0x7d89('0x2a')](_0x2c504c[_0x7d89('0x27')],qs['fields'](_0x27c910[_0x7d89('0x25')][_0x7d89('0x2c')]));_0x2f3675['attributes']=_0x2f3675[_0x7d89('0x2b')]['length']?_0x2f3675[_0x7d89('0x2b')]:_0x2c504c[_0x7d89('0x27')];if(_0x27c910['query'][_0x7d89('0x2d')]){_0x2f3675[_0x7d89('0x2e')]=[{'all':!![]}];}_0x2f3675=_[_0x7d89('0x2f')]({},_0x2f3675,_0x27c910[_0x7d89('0x30')]);return db['WhatsappInteraction'][_0x7d89('0x31')](_0x2f3675)[_0x7d89('0x18')](handleEntityNotFound(_0xe85176,null))['then'](respondWithResult(_0xe85176,null))[_0x7d89('0x32')](handleError(_0xe85176,null));};exports[_0x7d89('0x33')]=function(_0x17d135,_0x1ddd83){return db['WhatsappInteraction'][_0x7d89('0x33')](_0x17d135[_0x7d89('0x34')],{})['then'](respondWithResult(_0x1ddd83,0xc9))[_0x7d89('0x32')](handleError(_0x1ddd83,null));};exports[_0x7d89('0x17')]=function(_0x6c1fbe,_0xa1de7c){if(_0x6c1fbe[_0x7d89('0x34')]['id']){delete _0x6c1fbe['body']['id'];}return db[_0x7d89('0x1e')]['find']({'where':{'id':_0x6c1fbe['params']['id']}})[_0x7d89('0x18')](handleEntityNotFound(_0xa1de7c,null))[_0x7d89('0x18')](saveUpdates(_0x6c1fbe[_0x7d89('0x34')],null))[_0x7d89('0x18')](respondWithResult(_0xa1de7c,null))[_0x7d89('0x32')](handleError(_0xa1de7c,null));};exports['destroy']=function(_0x170fa5,_0x48a43e){return db[_0x7d89('0x1e')][_0x7d89('0x31')]({'where':{'id':_0x170fa5[_0x7d89('0x35')]['id']}})[_0x7d89('0x18')](handleEntityNotFound(_0x48a43e,null))['then'](removeEntity(_0x48a43e,null))[_0x7d89('0x32')](handleError(_0x48a43e,null));};exports[_0x7d89('0x36')]=function(_0x23c342,_0x4f7425){return db[_0x7d89('0x1e')][_0x7d89('0x36')]()[_0x7d89('0x18')](respondWithResult(_0x4f7425,null))[_0x7d89('0x32')](handleError(_0x4f7425,null));};exports[_0x7d89('0x37')]=function(_0x401ea1,_0x17c5de){return db[_0x7d89('0x38')][_0x7d89('0x31')]({'where':{'id':_0x401ea1['params']['id']}})[_0x7d89('0x18')](handleEntityNotFound(_0x17c5de,null))['then'](function(_0x3e0025){if(_0x3e0025){return _0x3e0025[_0x7d89('0x37')](_0x401ea1[_0x7d89('0x34')][_0x7d89('0x39')],_[_0x7d89('0x3a')](_0x401ea1['body'],[_0x7d89('0x39'),'id'])||{});}})[_0x7d89('0x18')](respondWithResult(_0x17c5de,null))['catch'](handleError(_0x17c5de,null));};exports[_0x7d89('0x3b')]=function(_0x55bee4,_0x38f19e){var _0x13752e={'raw':![],'where':{}};var _0x41a01e={};var _0x438ef7={'count':0x0,'rows':[]};return db[_0x7d89('0x1e')]['findOne']({'where':{'id':_0x55bee4['params']['id']}})[_0x7d89('0x18')](handleEntityNotFound(_0x38f19e,null))[_0x7d89('0x18')](function(_0x58ea04){if(_0x58ea04){_0x41a01e[_0x7d89('0x27')]=_[_0x7d89('0x28')](db[_0x7d89('0x38')][_0x7d89('0x1f')]);_0x41a01e[_0x7d89('0x25')]=_[_0x7d89('0x28')](_0x55bee4['query']);_0x41a01e['filters']=_[_0x7d89('0x2a')](_0x41a01e[_0x7d89('0x27')],_0x41a01e[_0x7d89('0x25')]);_0x13752e[_0x7d89('0x2b')]=_[_0x7d89('0x2a')](_0x41a01e['model'],qs[_0x7d89('0x2c')](_0x55bee4[_0x7d89('0x25')][_0x7d89('0x2c')]));_0x13752e[_0x7d89('0x2b')]=_0x13752e[_0x7d89('0x2b')][_0x7d89('0x3c')]?_0x13752e[_0x7d89('0x2b')]:_0x41a01e[_0x7d89('0x27')];if(!_0x55bee4[_0x7d89('0x25')][_0x7d89('0x3d')]('nolimit')){_0x13752e['limit']=qs[_0x7d89('0x12')](_0x55bee4['query'][_0x7d89('0x12')]);_0x13752e[_0x7d89('0x10')]=qs['offset'](_0x55bee4[_0x7d89('0x25')][_0x7d89('0x10')]);}_0x13752e[_0x7d89('0x3e')]=qs[_0x7d89('0x3f')](_0x55bee4[_0x7d89('0x25')][_0x7d89('0x3f')]);_0x13752e['where']=qs['filters'](_[_0x7d89('0x40')](_0x55bee4[_0x7d89('0x25')],_0x41a01e[_0x7d89('0x29')]));_0x13752e[_0x7d89('0x41')][_0x7d89('0x42')]=_0x58ea04['id'];if(_0x55bee4[_0x7d89('0x25')][_0x7d89('0x43')]){_0x13752e[_0x7d89('0x41')]=_['merge'](_0x13752e[_0x7d89('0x41')],{'$or':_[_0x7d89('0x1d')](_0x13752e[_0x7d89('0x2b')],function(_0x453804){var _0x329da3={};_0x329da3[_0x453804]={'$like':'%'+_0x55bee4[_0x7d89('0x25')]['filter']+'%'};return _0x329da3;})});}if(_0x55bee4[_0x7d89('0x25')][_0x7d89('0x44')]){var _0x18f01a=_0x55bee4['query'][_0x7d89('0x44')][_0x7d89('0x45')](',');var _0x625a94={};_0x625a94[_0x18f01a[0x0]]={'$gte':moment(_0x18f01a[0x1])[_0x7d89('0x46')]('YYYY-MM-DD\x20HH:mm:ss')};_0x13752e[_0x7d89('0x41')]=_[_0x7d89('0x2f')](_0x13752e[_0x7d89('0x41')],_0x625a94);}_0x13752e=_[_0x7d89('0x2f')]({},_0x13752e,_0x55bee4[_0x7d89('0x30')]);return db[_0x7d89('0x38')]['count']({'where':_0x13752e[_0x7d89('0x41')]})[_0x7d89('0x18')](function(_0x5e2a64){_0x438ef7[_0x7d89('0x13')]=_0x5e2a64;if(_0x55bee4[_0x7d89('0x25')][_0x7d89('0x2d')]){_0x13752e[_0x7d89('0x2e')]=[{'all':!![]}];}return db[_0x7d89('0x38')][_0x7d89('0x23')](_0x13752e);})[_0x7d89('0x18')](function(_0x48eedd){_0x438ef7['rows']=_0x48eedd;return _0x438ef7;});}})[_0x7d89('0x18')](respondWithFilteredResult(_0x38f19e,_0x13752e))[_0x7d89('0x32')](handleError(_0x38f19e,null));};exports[_0x7d89('0x47')]=function(_0x16f8dc,_0x3179c3){return db[_0x7d89('0x1e')][_0x7d89('0x31')]({'where':{'id':_0x16f8dc[_0x7d89('0x35')]['id']}})['then'](handleEntityNotFound(_0x3179c3,null))[_0x7d89('0x18')](function(_0x425146){if(_0x425146){return _0x425146['setTags'](_0x16f8dc[_0x7d89('0x34')][_0x7d89('0x39')],_[_0x7d89('0x3a')](_0x16f8dc[_0x7d89('0x34')],[_0x7d89('0x39'),'id'])||{})[_0x7d89('0x48')](function(){return db[_0x7d89('0x49')]['findAll']({'attributes':['id',_0x7d89('0x1a'),'color'],'where':{'id':_0x16f8dc[_0x7d89('0x34')][_0x7d89('0x39')]}});})[_0x7d89('0x18')](function(_0x2300d1){socket['emit'](_0x7d89('0x4a'),{'id':Number(_0x16f8dc[_0x7d89('0x35')]['id']),'tags':_0x2300d1||[]});return{'id':Number(_0x16f8dc['params']['id']),'tags':_0x2300d1||[]};});}})[_0x7d89('0x18')](respondWithResult(_0x3179c3,null))[_0x7d89('0x32')](handleError(_0x3179c3,null));};exports[_0x7d89('0x4b')]=function(_0x4780d1,_0x24749a){return db[_0x7d89('0x1e')][_0x7d89('0x31')]({'where':{'id':_0x4780d1[_0x7d89('0x35')]['id']}})[_0x7d89('0x18')](handleEntityNotFound(_0x24749a,null))[_0x7d89('0x18')](function(_0x587278){if(_0x587278){return _0x587278[_0x7d89('0x4b')](_0x4780d1[_0x7d89('0x25')][_0x7d89('0x39')]);}})['then'](respondWithStatusCode(_0x24749a,null))[_0x7d89('0x32')](handleError(_0x24749a,null));};exports['download']=function(_0x1c062e,_0x192c10){var _0x117131=moment()[_0x7d89('0x4c')]()[_0x7d89('0x4d')]();var _0x286037=path[_0x7d89('0x4e')](config[_0x7d89('0x4f')],'server',_0x7d89('0x50'),_0x7d89('0x51'));var _0x4e4714=path[_0x7d89('0x4e')](config[_0x7d89('0x4f')],_0x7d89('0x52'),_0x7d89('0x50'),_0x7d89('0x53'));var _0x3c819e=path[_0x7d89('0x4e')](_0x286037,_0x117131);var _0x3075c1=util[_0x7d89('0x46')](_0x7d89('0x54'),_0x1c062e[_0x7d89('0x35')]['id'],_0x117131);var _0x4604e6=path[_0x7d89('0x4e')](_0x286037,_0x3075c1);var _0x1a8f75=[];_0x1a8f75[_0x7d89('0x55')]({'model':db[_0x7d89('0x56')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x1a8f75[_0x7d89('0x55')]({'model':db[_0x7d89('0x57')],'as':'Contact','attributes':['id',_0x7d89('0x58'),_0x7d89('0x59')],'raw':!![]});if(_0x1c062e[_0x7d89('0x25')]['attachments']){_0x1a8f75[_0x7d89('0x55')]({'model':db[_0x7d89('0x5a')],'as':'Attachment','raw':!![]});}var _0x1a87d1=[{'model':db[_0x7d89('0x38')],'as':'Messages','attributes':['id',_0x7d89('0x34'),'createdAt',_0x7d89('0x5b'),'secret','read'],'include':_0x1a8f75}];_0x1a87d1[_0x7d89('0x55')]({'model':db[_0x7d89('0x5c')],'as':_0x7d89('0x5d'),'attributes':['id',_0x7d89('0x1a')]});_0x1a87d1['push']({'model':db[_0x7d89('0x56')],'as':_0x7d89('0x5e'),'attributes':['id','fullname']});return db['WhatsappInteraction']['find']({'where':{'id':_0x1c062e[_0x7d89('0x35')]['id']},'include':_0x1a87d1})[_0x7d89('0x18')](handleEntityNotFound(_0x192c10,null))[_0x7d89('0x18')](function(_0x37af8d){if(_0x37af8d){var _0x1c8bf4=_0x37af8d[_0x7d89('0x5f')]({'plain':!![]});fs['mkdirSync'](_0x3c819e);var _0x2f4bde={'channel':_0x7d89('0x60'),'account':_0x1c8bf4[_0x7d89('0x5d')][_0x7d89('0x1a')],'agent':_0x1c8bf4['Owner']?_0x1c8bf4[_0x7d89('0x5e')][_0x7d89('0x61')]:_0x7d89('0x62'),'createdAt':moment(_0x1c8bf4[_0x7d89('0x63')])[_0x7d89('0x46')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x1c8bf4[_0x7d89('0x64')]?moment(_0x1c8bf4[_0x7d89('0x65')])[_0x7d89('0x46')](_0x7d89('0x66'))[_0x7d89('0x4d')]():'','disposition':_0x1c8bf4['disposition'],'messages':_(_0x1c8bf4[_0x7d89('0x67')])[_0x7d89('0x43')]({'secret':![]})['map'](function(_0x33f3c2){if(_0x33f3c2['Attachment']){var _0x4f3c1c=path[_0x7d89('0x4e')](_0x4e4714,_0x33f3c2['Attachment'][_0x7d89('0x68')]);if(fs[_0x7d89('0x69')](_0x4f3c1c)){fs[_0x7d89('0x6a')](_0x4f3c1c)['pipe'](fs['createWriteStream'](path[_0x7d89('0x4e')](_0x3c819e,_0x33f3c2['Attachment'][_0x7d89('0x68')])));}}return{'date':moment(_0x33f3c2[_0x7d89('0x63')])[_0x7d89('0x46')](_0x7d89('0x66'))[_0x7d89('0x4d')](),'sender':_0x33f3c2['direction']===_0x7d89('0x6b')?_0x33f3c2[_0x7d89('0x56')]?_0x33f3c2[_0x7d89('0x56')]['fullname']:_0x7d89('0x6c'):_0x33f3c2['Contact'][_0x7d89('0x58')]+(_0x33f3c2[_0x7d89('0x6d')][_0x7d89('0x59')]?'\x20'+_0x33f3c2['Contact'][_0x7d89('0x59')]:''),'body':_0x33f3c2[_0x7d89('0x5a')]?_0x33f3c2['Attachment']['basename']:_0x33f3c2['body'],'direction':_0x33f3c2[_0x7d89('0x5b')]===_0x7d89('0x6b')?'A':'C','secret':_0x33f3c2[_0x7d89('0x6e')],'read':_0x33f3c2[_0x7d89('0x6f')],'attachment':_0x33f3c2[_0x7d89('0x5a')]};})[_0x7d89('0x70')]()};return ejs[_0x7d89('0x71')](path[_0x7d89('0x4e')](config['root'],_0x7d89('0x52'),_0x7d89('0x72'),_0x7d89('0x73')),{'interaction':_0x2f4bde})[_0x7d89('0x18')](function(_0x24dc8d){var _0x20dce5=path[_0x7d89('0x4e')](_0x3c819e,_0x7d89('0x74')+_0x1c8bf4['id']+'-'+_0x117131+_0x7d89('0x75'));var _0x129bb7={'path':_0x20dce5,'channel':_0x7d89('0x60'),'interactionId':_0x1c8bf4['id']};return pdf[_0x7d89('0x76')](_0x24dc8d,_0x129bb7);})['then'](function(){return new BPromise(function(_0x54ab4d,_0x3ec2fc){zipdir(_0x3c819e,{'saveTo':_0x4604e6},function(_0x2ae601,_0x3e95eb){if(_0x2ae601)return _0x3ec2fc(_0x2ae601);return _0x54ab4d(_0x3e95eb);});})[_0x7d89('0x18')](function(){return new BPromise(function(_0x4ac250,_0x55fb1a){rimraf(_0x3c819e,function(_0x548dcc){if(_0x548dcc)_0x55fb1a(_0x548dcc);return _0x4ac250();});});})[_0x7d89('0x18')](function(){return _0x192c10['download'](_0x4604e6,_0x3075c1,function(_0x4faa68){if(_0x4faa68){console['log'](_0x7d89('0x77'),_0x4faa68);}else{fs[_0x7d89('0x78')](_0x4604e6);}});});});}else{return _0x192c10[_0x7d89('0xd')](0xc8);}})[_0x7d89('0x32')](handleError(_0x192c10,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index e0e670e..f698738 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 _0x151b=['../../mysqldb','setMaxListeners','save','update','getUsers','setDataValue','Users','findAll','then','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events'];(function(_0x2d627b,_0x33f5af){var _0x58d33e=function(_0x55f32e){while(--_0x55f32e){_0x2d627b['push'](_0x2d627b['shift']());}};_0x58d33e(++_0x33f5af);}(_0x151b,0x153));var _0xb151=function(_0x14ea4d,_0x351394){_0x14ea4d=_0x14ea4d-0x0;var _0x3da69f=_0x151b[_0x14ea4d];return _0x3da69f;};'use strict';var EventEmitter=require(_0xb151('0x0'));var WhatsappInteraction=require('../../mysqldb')['db']['WhatsappInteraction'];var WhatsappMessage=require(_0xb151('0x1'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xb151('0x2')](0x0);var events={'afterCreate':_0xb151('0x3'),'afterUpdate':_0xb151('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4a9d3f){return function(_0x3adedf,_0x2780a8,_0x56b93e){_0x3adedf[_0xb151('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0xd89657){_0x3adedf[_0xb151('0x6')](_0xb151('0x7'),_0xd89657['map'](function(_0x47baa2){return{'id':_0x47baa2['id']};}));return WhatsappMessage[_0xb151('0x8')]({'where':{'WhatsappInteractionId':_0x3adedf['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb151('0x9')](function(_0x493540){_0x3adedf['setDataValue'](_0xb151('0xa'),_0x493540[_0xb151('0xb')]);WhatsappInteractionEvents[_0xb151('0xc')](_0x4a9d3f+':'+_0x3adedf['id'],_0x3adedf);WhatsappInteractionEvents[_0xb151('0xc')](_0x4a9d3f,_0x3adedf);_0x56b93e(null);})[_0xb151('0xd')](_0x56b93e(null));};}for(var e in events){if(events[_0xb151('0xe')](e)){var event=events[e];WhatsappInteraction[_0xb151('0xf')](e,emitEvent(event));}}module[_0xb151('0x10')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x1a83=['map','findAll','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','save','update','remove','getUsers','then','setDataValue','Users'];(function(_0x8be0ba,_0x55202e){var _0x6c4076=function(_0x2e4659){while(--_0x2e4659){_0x8be0ba['push'](_0x8be0ba['shift']());}};_0x6c4076(++_0x55202e);}(_0x1a83,0x1c0));var _0x31a8=function(_0x460b5f,_0xbd2fb3){_0x460b5f=_0x460b5f-0x0;var _0x11f109=_0x1a83[_0x460b5f];return _0x11f109;};'use strict';var EventEmitter=require(_0x31a8('0x0'));var WhatsappInteraction=require(_0x31a8('0x1'))['db'][_0x31a8('0x2')];var WhatsappMessage=require('../../mysqldb')['db'][_0x31a8('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x31a8('0x4'),'afterUpdate':_0x31a8('0x5'),'afterDestroy':_0x31a8('0x6')};function emitEvent(_0x26aa71){return function(_0x4f18c3,_0x5e07ea,_0xde01e8){_0x4f18c3[_0x31a8('0x7')]({'attributes':['id'],'raw':!![]})[_0x31a8('0x8')](function(_0x2c4b45){_0x4f18c3[_0x31a8('0x9')](_0x31a8('0xa'),_0x2c4b45[_0x31a8('0xb')](function(_0x12e5c8){return{'id':_0x12e5c8['id']};}));return WhatsappMessage[_0x31a8('0xc')]({'where':{'WhatsappInteractionId':_0x4f18c3['id'],'direction':'in','read':![]},'raw':!![]});})[_0x31a8('0x8')](function(_0x4f1881){_0x4f18c3[_0x31a8('0x9')]('unreadMessages',_0x4f1881['length']);WhatsappInteractionEvents[_0x31a8('0xd')](_0x26aa71+':'+_0x4f18c3['id'],_0x4f18c3);WhatsappInteractionEvents[_0x31a8('0xd')](_0x26aa71,_0x4f18c3);_0xde01e8(null);})['catch'](_0xde01e8(null));};}for(var e in events){if(events[_0x31a8('0xe')](e)){var event=events[e];WhatsappInteraction[_0x31a8('0xf')](e,emitEvent(event));}}module[_0x31a8('0x10')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 0d6cbe9..da90a27 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 _0xf454=['lodash','util','../../config/logger','moment','request-promise','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x1fb212,_0x5a6eb2){var _0x55b071=function(_0x372aa8){while(--_0x372aa8){_0x1fb212['push'](_0x1fb212['shift']());}};_0x55b071(++_0x5a6eb2);}(_0xf454,0xe0));var _0x4f45=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xf454[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x4f45('0x0'));var util=require(_0x4f45('0x1'));var logger=require(_0x4f45('0x2'))('api');var moment=require(_0x4f45('0x3'));var BPromise=require('bluebird');var rp=require(_0x4f45('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4f45('0x5'));module[_0x4f45('0x6')]=function(_0x837c19,_0x1cf479){return _0x837c19[_0x4f45('0x7')](_0x4f45('0x8'),attributes,{'tableName':_0x4f45('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4903b1,_0x47fff2,_0x4b4f0a){if(_0x4903b1['changed'](_0x4f45('0xa'))){_0x4903b1[_0x4f45('0xb')]=moment()[_0x4f45('0xc')](_0x4f45('0xd'));}_0x4b4f0a(null,_0x4903b1);}}});}; \ No newline at end of file +var _0xb046=['moment','bluebird','request-promise','path','exports','define','WhatsappInteraction','changed','closed','lodash','util','../../config/logger'];(function(_0x268ad9,_0x12130e){var _0x20c687=function(_0x22827e){while(--_0x22827e){_0x268ad9['push'](_0x268ad9['shift']());}};_0x20c687(++_0x12130e);}(_0xb046,0x1a1));var _0x6b04=function(_0x388b47,_0x5cdac5){_0x388b47=_0x388b47-0x0;var _0x4859df=_0xb046[_0x388b47];return _0x4859df;};'use strict';var _=require(_0x6b04('0x0'));var util=require(_0x6b04('0x1'));var logger=require(_0x6b04('0x2'))('api');var moment=require(_0x6b04('0x3'));var BPromise=require(_0x6b04('0x4'));var rp=require(_0x6b04('0x5'));var fs=require('fs');var path=require(_0x6b04('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./whatsappInteraction.attributes');module[_0x6b04('0x7')]=function(_0x4f97cf,_0x389dc0){return _0x4f97cf[_0x6b04('0x8')](_0x6b04('0x9'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x414a80,_0xef9069,_0x1693aa){if(_0x414a80[_0x6b04('0xa')](_0x6b04('0xb'))){_0x414a80['closedAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x1693aa(null,_0x414a80);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 46ad283..af8160e 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 _0x2706=['where','attributes','then','UpdateWhatsappInteraction','debug','AddTagsToWhatsappInteraction','addTags','body','ids','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','./whatsappInteraction.socket','request','info','request\x20sent','stringify','error','code','WhatsappInteraction,\x20%s,\x20%s','message','result','WhatsappInteraction','update','options'];(function(_0x559ac8,_0xde3c12){var _0x2c8f66=function(_0x72f311){while(--_0x72f311){_0x559ac8['push'](_0x559ac8['shift']());}};_0x2c8f66(++_0xde3c12);}(_0x2706,0x1a1));var _0x6270=function(_0x3df2f8,_0x16ca27){_0x3df2f8=_0x3df2f8-0x0;var _0x3d32ec=_0x2706[_0x3df2f8];return _0x3d32ec;};'use strict';var _=require(_0x6270('0x0'));var util=require(_0x6270('0x1'));var moment=require(_0x6270('0x2'));var BPromise=require(_0x6270('0x3'));var rs=require(_0x6270('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6270('0x5'))['db'];var utils=require(_0x6270('0x6'));var logger=require(_0x6270('0x7'))('rpc');var config=require(_0x6270('0x8'));var jayson=require(_0x6270('0x9'));var client=jayson[_0x6270('0xa')][_0x6270('0xb')]({'port':0x232a});config[_0x6270('0xc')]=_['defaults'](config[_0x6270('0xc')],{'host':_0x6270('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6270('0xc')]));require(_0x6270('0xe'))['register'](socket);function respondWithRpcPromise(_0x1d02ec,_0x51a4cc,_0x577f36){return new BPromise(function(_0x1817d6,_0x577ce8){return client[_0x6270('0xf')](_0x1d02ec,_0x577f36)['then'](function(_0x4eac49){logger[_0x6270('0x10')]('WhatsappInteraction,\x20%s,\x20%s',_0x51a4cc,_0x6270('0x11'));logger['debug']('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x51a4cc,_0x6270('0x11'),JSON[_0x6270('0x12')](_0x4eac49));if(_0x4eac49[_0x6270('0x13')]){if(_0x4eac49[_0x6270('0x13')][_0x6270('0x14')]===0x1f4){logger[_0x6270('0x13')](_0x6270('0x15'),_0x51a4cc,_0x4eac49[_0x6270('0x13')][_0x6270('0x16')]);return _0x577ce8(_0x4eac49[_0x6270('0x13')][_0x6270('0x16')]);}logger[_0x6270('0x13')](_0x6270('0x15'),_0x51a4cc,_0x4eac49[_0x6270('0x13')]['message']);return _0x1817d6(_0x4eac49['error'][_0x6270('0x16')]);}else{logger[_0x6270('0x10')]('WhatsappInteraction,\x20%s,\x20%s',_0x51a4cc,'request\x20sent');_0x1817d6(_0x4eac49[_0x6270('0x17')][_0x6270('0x16')]);}})['catch'](function(_0x43d6dd){logger['error'](_0x6270('0x15'),_0x51a4cc,_0x43d6dd);_0x577ce8(_0x43d6dd);});});}exports['UpdateWhatsappInteraction']=function(_0xa7703e){var _0x33892a=this;return new Promise(function(_0x135a72,_0x250851){return db[_0x6270('0x18')][_0x6270('0x19')](_0xa7703e['body'],{'raw':_0xa7703e[_0x6270('0x1a')]?_0xa7703e[_0x6270('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa7703e[_0x6270('0x1a')]?_0xa7703e[_0x6270('0x1a')][_0x6270('0x1b')]||null:null,'attributes':_0xa7703e[_0x6270('0x1a')]?_0xa7703e['options'][_0x6270('0x1c')]||null:null,'limit':_0xa7703e['options']?_0xa7703e[_0x6270('0x1a')]['limit']||null:null})[_0x6270('0x1d')](function(_0x2e92b7){logger[_0x6270('0x10')](_0x6270('0x1e'),_0xa7703e);logger[_0x6270('0x1f')](_0x6270('0x1e'),_0xa7703e,JSON[_0x6270('0x12')](_0x2e92b7));_0x135a72(_0x2e92b7);})['catch'](function(_0x2118be){logger[_0x6270('0x13')](_0x6270('0x1e'),_0x2118be['message'],_0xa7703e);_0x250851(_0x33892a[_0x6270('0x13')](0x1f4,_0x2118be[_0x6270('0x16')]));});});};exports[_0x6270('0x20')]=function(_0x44a031){return new Promise(function(_0x1ac2f8,_0x3ef18b){return db[_0x6270('0x18')]['find']({'where':_0x44a031[_0x6270('0x1a')]?_0x44a031[_0x6270('0x1a')][_0x6270('0x1b')]||null:null})[_0x6270('0x1d')](function(_0x5d9e97){if(_0x5d9e97){return _0x5d9e97[_0x6270('0x21')](_0x44a031[_0x6270('0x22')][_0x6270('0x23')],_['omit'](_0x44a031[_0x6270('0x22')],[_0x6270('0x23'),'id'])||{});}})['spread'](function(_0x2c320b){logger[_0x6270('0x10')](_0x6270('0x24'),_0x44a031);logger[_0x6270('0x1f')](_0x6270('0x24'),_0x44a031,JSON[_0x6270('0x12')](_0x2c320b));_0x1ac2f8(_0x2c320b);})['catch'](function(_0x44f308){logger[_0x6270('0x13')](_0x6270('0x24'),_0x44f308[_0x6270('0x16')],_0x44a031);_0x3ef18b(_this[_0x6270('0x13')](0x1f4,_0x44f308[_0x6270('0x16')]));});});}; \ No newline at end of file +var _0x00ce=['defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','error','code','message','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','attributes','limit','stringify','AddTagsToWhatsappInteraction','addTags','ids','AddTags','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x30c997,_0x1f4e7a){var _0x5c31fb=function(_0x45f316){while(--_0x45f316){_0x30c997['push'](_0x30c997['shift']());}};_0x5c31fb(++_0x1f4e7a);}(_0x00ce,0x72));var _0xe00c=function(_0x37166f,_0x201e4b){_0x37166f=_0x37166f-0x0;var _0x4167e1=_0x00ce[_0x37166f];return _0x4167e1;};'use strict';var _=require(_0xe00c('0x0'));var util=require(_0xe00c('0x1'));var moment=require('moment');var BPromise=require(_0xe00c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe00c('0x3'))['db'];var utils=require(_0xe00c('0x4'));var logger=require(_0xe00c('0x5'))(_0xe00c('0x6'));var config=require(_0xe00c('0x7'));var jayson=require(_0xe00c('0x8'));var client=jayson[_0xe00c('0x9')][_0xe00c('0xa')]({'port':0x232a});config[_0xe00c('0xb')]=_[_0xe00c('0xc')](config[_0xe00c('0xb')],{'host':_0xe00c('0xd'),'port':0x18eb});var socket=require(_0xe00c('0xe'))(new Redis(config['redis']));require(_0xe00c('0xf'))[_0xe00c('0x10')](socket);function respondWithRpcPromise(_0x310881,_0x15415a,_0x3fe8d3){return new BPromise(function(_0x2e34d5,_0x5742dd){return client[_0xe00c('0x11')](_0x310881,_0x3fe8d3)[_0xe00c('0x12')](function(_0x5ac4a6){logger[_0xe00c('0x13')](_0xe00c('0x14'),_0x15415a,_0xe00c('0x15'));logger[_0xe00c('0x16')](_0xe00c('0x17'),_0x15415a,_0xe00c('0x15'),JSON['stringify'](_0x5ac4a6));if(_0x5ac4a6[_0xe00c('0x18')]){if(_0x5ac4a6[_0xe00c('0x18')][_0xe00c('0x19')]===0x1f4){logger[_0xe00c('0x18')](_0xe00c('0x14'),_0x15415a,_0x5ac4a6[_0xe00c('0x18')][_0xe00c('0x1a')]);return _0x5742dd(_0x5ac4a6[_0xe00c('0x18')][_0xe00c('0x1a')]);}logger['error'](_0xe00c('0x14'),_0x15415a,_0x5ac4a6['error'][_0xe00c('0x1a')]);return _0x2e34d5(_0x5ac4a6['error'][_0xe00c('0x1a')]);}else{logger[_0xe00c('0x13')](_0xe00c('0x14'),_0x15415a,'request\x20sent');_0x2e34d5(_0x5ac4a6['result'][_0xe00c('0x1a')]);}})[_0xe00c('0x1b')](function(_0x52d959){logger[_0xe00c('0x18')](_0xe00c('0x14'),_0x15415a,_0x52d959);_0x5742dd(_0x52d959);});});}exports[_0xe00c('0x1c')]=function(_0x27d9ae){var _0x1bcd6f=this;return new Promise(function(_0x131289,_0x15e5c8){return db[_0xe00c('0x1d')][_0xe00c('0x1e')](_0x27d9ae[_0xe00c('0x1f')],{'raw':_0x27d9ae[_0xe00c('0x20')]?_0x27d9ae[_0xe00c('0x20')][_0xe00c('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x27d9ae[_0xe00c('0x20')]?_0x27d9ae[_0xe00c('0x20')][_0xe00c('0x22')]||null:null,'attributes':_0x27d9ae[_0xe00c('0x20')]?_0x27d9ae[_0xe00c('0x20')][_0xe00c('0x23')]||null:null,'limit':_0x27d9ae[_0xe00c('0x20')]?_0x27d9ae[_0xe00c('0x20')][_0xe00c('0x24')]||null:null})[_0xe00c('0x12')](function(_0x2a65c2){logger[_0xe00c('0x13')](_0xe00c('0x1c'),_0x27d9ae);logger[_0xe00c('0x16')](_0xe00c('0x1c'),_0x27d9ae,JSON[_0xe00c('0x25')](_0x2a65c2));_0x131289(_0x2a65c2);})['catch'](function(_0x4964d4){logger['error'](_0xe00c('0x1c'),_0x4964d4[_0xe00c('0x1a')],_0x27d9ae);_0x15e5c8(_0x1bcd6f[_0xe00c('0x18')](0x1f4,_0x4964d4[_0xe00c('0x1a')]));});});};exports[_0xe00c('0x26')]=function(_0x35df91){return new Promise(function(_0x197b6c,_0x3ac600){return db['WhatsappInteraction']['find']({'where':_0x35df91['options']?_0x35df91[_0xe00c('0x20')]['where']||null:null})['then'](function(_0x1e81fe){if(_0x1e81fe){return _0x1e81fe[_0xe00c('0x27')](_0x35df91[_0xe00c('0x1f')][_0xe00c('0x28')],_['omit'](_0x35df91[_0xe00c('0x1f')],[_0xe00c('0x28'),'id'])||{});}})['spread'](function(_0x8117d3){logger['info'](_0xe00c('0x29'),_0x35df91);logger[_0xe00c('0x16')](_0xe00c('0x29'),_0x35df91,JSON[_0xe00c('0x25')](_0x8117d3));_0x197b6c(_0x8117d3);})['catch'](function(_0x1841dd){logger[_0xe00c('0x18')](_0xe00c('0x29'),_0x1841dd[_0xe00c('0x1a')],_0x35df91);_0x3ac600(_this[_0xe00c('0x18')](0x1f4,_0x1841dd[_0xe00c('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 60b081c..d71f50b 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 _0xb5ec=['emit','removeListener','register','length','./whatsappInteraction.events','remove'];(function(_0x5483e9,_0x5eb493){var _0x285770=function(_0x5a08e4){while(--_0x5a08e4){_0x5483e9['push'](_0x5483e9['shift']());}};_0x285770(++_0x5eb493);}(_0xb5ec,0x112));var _0xcb5e=function(_0x27330f,_0x43f081){_0x27330f=_0x27330f-0x0;var _0x611c4d=_0xb5ec[_0x27330f];return _0x611c4d;};'use strict';var WhatsappInteractionEvents=require(_0xcb5e('0x0'));var events=['save',_0xcb5e('0x1'),'update'];function createListener(_0x5aa313,_0x629893){return function(_0x5171a3){_0x629893[_0xcb5e('0x2')](_0x5aa313,_0x5171a3);};}function removeListener(_0x5cf599,_0x3de9b7){return function(){WhatsappInteractionEvents[_0xcb5e('0x3')](_0x5cf599,_0x3de9b7);};}exports[_0xcb5e('0x4')]=function(_0x14114e){for(var _0x1cd280=0x0,_0xff2ec8=events[_0xcb5e('0x5')];_0x1cd280<_0xff2ec8;_0x1cd280++){var _0x42ff9a=events[_0x1cd280];var _0x180665=createListener('whatsappInteraction:'+_0x42ff9a,_0x14114e);WhatsappInteractionEvents['on'](_0x42ff9a,_0x180665);}}; \ No newline at end of file +var _0xff85=['remove','update','emit','removeListener','register','length','whatsappInteraction:','./whatsappInteraction.events','save'];(function(_0x2aa0e7,_0x4e5145){var _0x1472c0=function(_0x4deaeb){while(--_0x4deaeb){_0x2aa0e7['push'](_0x2aa0e7['shift']());}};_0x1472c0(++_0x4e5145);}(_0xff85,0x1db));var _0x5ff8=function(_0x58eab5,_0x4a82dd){_0x58eab5=_0x58eab5-0x0;var _0x3cae2b=_0xff85[_0x58eab5];return _0x3cae2b;};'use strict';var WhatsappInteractionEvents=require(_0x5ff8('0x0'));var events=[_0x5ff8('0x1'),_0x5ff8('0x2'),_0x5ff8('0x3')];function createListener(_0x1f902c,_0x52f1e4){return function(_0x121124){_0x52f1e4[_0x5ff8('0x4')](_0x1f902c,_0x121124);};}function removeListener(_0x10bbaf,_0x187e6f){return function(){WhatsappInteractionEvents[_0x5ff8('0x5')](_0x10bbaf,_0x187e6f);};}exports[_0x5ff8('0x6')]=function(_0x24b2e7){for(var _0x176d66=0x0,_0x503d5c=events[_0x5ff8('0x7')];_0x176d66<_0x503d5c;_0x176d66++){var _0x4c7942=events[_0x176d66];var _0x46962d=createListener(_0x5ff8('0x8')+_0x4c7942,_0x24b2e7);WhatsappInteractionEvents['on'](_0x4c7942,_0x46962d);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index d42dcff..792b5c3 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 _0x77dd=['get','/describe','describe','/:id','show','post','tracked','whatsappmessage:create','create','/:id/status','put','update','/:id/accept','accept','/:id/reject','delete','destroy','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','isAuthenticated','index'];(function(_0x136aae,_0x21f34e){var _0x592cdc=function(_0x473d5c){while(--_0x473d5c){_0x136aae['push'](_0x136aae['shift']());}};_0x592cdc(++_0x21f34e);}(_0x77dd,0x1a6));var _0xd77d=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0x77dd[_0x54d4fe];return _0x1ab5bb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd77d('0x0'));var timeout=require('connect-timeout');var express=require(_0xd77d('0x1'));var router=express[_0xd77d('0x2')]();var fs_extra=require(_0xd77d('0x3'));var auth=require(_0xd77d('0x4'));var interaction=require(_0xd77d('0x5'));var config=require(_0xd77d('0x6'));var controller=require(_0xd77d('0x7'));router['get']('/',auth[_0xd77d('0x8')](),controller[_0xd77d('0x9')]);router[_0xd77d('0xa')](_0xd77d('0xb'),auth[_0xd77d('0x8')](),controller[_0xd77d('0xc')]);router[_0xd77d('0xa')](_0xd77d('0xd'),auth[_0xd77d('0x8')](),controller[_0xd77d('0xe')]);router[_0xd77d('0xf')]('/',auth['isAuthenticated'](),interaction[_0xd77d('0x10')]('whatsapp',_0xd77d('0x11')),controller[_0xd77d('0x12')]);router['post'](_0xd77d('0x13'),controller['status']);router[_0xd77d('0x14')](_0xd77d('0xd'),auth[_0xd77d('0x8')](),controller[_0xd77d('0x15')]);router[_0xd77d('0x14')](_0xd77d('0x16'),auth[_0xd77d('0x8')](),controller[_0xd77d('0x17')]);router[_0xd77d('0x14')](_0xd77d('0x18'),auth['isAuthenticated'](),controller['reject']);router[_0xd77d('0x19')](_0xd77d('0xd'),auth[_0xd77d('0x8')](),controller[_0xd77d('0x1a')]);module['exports']=router; \ No newline at end of file +var _0xb054=['show','tracked','whatsapp','whatsappmessage:create','create','post','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xb054,0x67));var _0x4b05=function(_0x1877d0,_0x4fc2ec){_0x1877d0=_0x1877d0-0x0;var _0x5d5778=_0xb054[_0x1877d0];return _0x5d5778;};'use strict';var multer=require(_0x4b05('0x0'));var util=require(_0x4b05('0x1'));var path=require(_0x4b05('0x2'));var timeout=require(_0x4b05('0x3'));var express=require(_0x4b05('0x4'));var router=express[_0x4b05('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4b05('0x6'));var config=require(_0x4b05('0x7'));var controller=require('./whatsappMessage.controller');router[_0x4b05('0x8')]('/',auth[_0x4b05('0x9')](),controller[_0x4b05('0xa')]);router[_0x4b05('0x8')]('/describe',auth[_0x4b05('0x9')](),controller[_0x4b05('0xb')]);router[_0x4b05('0x8')](_0x4b05('0xc'),auth[_0x4b05('0x9')](),controller[_0x4b05('0xd')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x4b05('0xe')](_0x4b05('0xf'),_0x4b05('0x10')),controller[_0x4b05('0x11')]);router[_0x4b05('0x12')](_0x4b05('0x13'),controller[_0x4b05('0x14')]);router[_0x4b05('0x15')](_0x4b05('0xc'),auth[_0x4b05('0x9')](),controller[_0x4b05('0x16')]);router[_0x4b05('0x15')](_0x4b05('0x17'),auth[_0x4b05('0x9')](),controller[_0x4b05('0x18')]);router[_0x4b05('0x15')](_0x4b05('0x19'),auth[_0x4b05('0x9')](),controller[_0x4b05('0x1a')]);router[_0x4b05('0x1b')](_0x4b05('0xc'),auth[_0x4b05('0x9')](),controller[_0x4b05('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 06e64de..5b6801f 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 _0x27f6=['ENUM','out','STRING','DATE','exports','TEXT','BOOLEAN'];(function(_0x51b4f6,_0x2470a6){var _0x5ae8ee=function(_0xc5e8ae){while(--_0xc5e8ae){_0x51b4f6['push'](_0x51b4f6['shift']());}};_0x5ae8ee(++_0x2470a6);}(_0x27f6,0x170));var _0x627f=function(_0x2c42cb,_0x403723){_0x2c42cb=_0x2c42cb-0x0;var _0x36a538=_0x27f6[_0x2c42cb];return _0x36a538;};'use strict';var Sequelize=require('sequelize');module[_0x627f('0x0')]={'body':{'type':Sequelize[_0x627f('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x627f('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x627f('0x3')]('in','out'),'defaultValue':_0x627f('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x627f('0x5')](0xbe)},'phone':{'type':Sequelize[_0x627f('0x5')]},'readAt':{'type':Sequelize[_0x627f('0x6')]},'secret':{'type':Sequelize[_0x627f('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x627f('0x5')]},'providerResponse':{'type':Sequelize[_0x627f('0x1')]}}; \ No newline at end of file +var _0x34ab=['out','STRING','DATE','sequelize','exports','TEXT','medium'];(function(_0x111d76,_0x483b46){var _0x531fff=function(_0x46ffe0){while(--_0x46ffe0){_0x111d76['push'](_0x111d76['shift']());}};_0x531fff(++_0x483b46);}(_0x34ab,0xf1));var _0xb34a=function(_0x215dc8,_0x52c245){_0x215dc8=_0x215dc8-0x0;var _0x583ea3=_0x34ab[_0x215dc8];return _0x583ea3;};'use strict';var Sequelize=require(_0xb34a('0x0'));module[_0xb34a('0x1')]={'body':{'type':Sequelize[_0xb34a('0x2')](_0xb34a('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xb34a('0x4')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xb34a('0x5')](0xbe)},'phone':{'type':Sequelize[_0xb34a('0x5')]},'readAt':{'type':Sequelize[_0xb34a('0x6')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0xb34a('0x5')]},'providerResponse':{'type':Sequelize[_0xb34a('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index b217ea3..d74510c 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 _0x32bc=['status','end','sendStatus','stack','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','options','count','includeAll','findAll','rows','show','params','include','create','body','update','destroy','describe','whatsapp','acceptMessage','reject','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','find','fullname','email','internal','interface','format','SIP/%s','channel','motionChannel','event','EventManager','rejectmessage','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','read','WhatsappAccount,\x20%s,\x20%s,\x20%s','util','../../components/interaction/service','../../config/logger','api','../../config/environment','redis','defaults','localhost','./whatsappMessage.socket','http','whatsapp-interactions','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','json','offset','undefined','limit','set','Content-Range'];(function(_0x1a177c,_0x4ec861){var _0x49f901=function(_0x4be7ce){while(--_0x4be7ce){_0x1a177c['push'](_0x1a177c['shift']());}};_0x49f901(++_0x4ec861);}(_0x32bc,0xc2));var _0xc32b=function(_0x2489de,_0x1e1ad2){_0x2489de=_0x2489de-0x0;var _0x36c6a3=_0x32bc[_0x2489de];return _0x36c6a3;};'use strict';var util=require(_0xc32b('0x0'));var _=require('lodash');var Redis=require('ioredis');var interactionService=require(_0xc32b('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0xc32b('0x2'))(_0xc32b('0x3'));var config=require(_0xc32b('0x4'));var db=require('../../mysqldb')['db'];config[_0xc32b('0x5')]=_[_0xc32b('0x6')](config[_0xc32b('0x5')],{'host':_0xc32b('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc32b('0x5')]));require(_0xc32b('0x8'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xc32b('0x9')]({'port':0x232c});var client9002=jayson['client'][_0xc32b('0x9')]({'port':0x232a});var interaction_log=require(_0xc32b('0x2'))(_0xc32b('0xa'));function respondWithRpcPromise(_0xf84585,_0x5b21ad,_0x5a706a,_0x4fa4ef){return new Promise(function(_0x42a2ba,_0x2cef7c){var _0xb3e860=_0x4fa4ef||client;return _0xb3e860[_0xc32b('0xb')](_0xf84585,_0x5a706a)[_0xc32b('0xc')](function(_0x497069){logger[_0xc32b('0xd')](_0xc32b('0xe'),_0x5b21ad,_0xc32b('0xf'));logger[_0xc32b('0x10')](_0xc32b('0x11'),_0x5b21ad,_0xc32b('0xf'),JSON[_0xc32b('0x12')](_0x497069));if(_0x497069[_0xc32b('0x13')]){if(_0x497069[_0xc32b('0x13')][_0xc32b('0x14')]===0x1f4){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x5b21ad,_0x497069[_0xc32b('0x13')][_0xc32b('0x15')]);return _0x2cef7c(_0x497069[_0xc32b('0x13')][_0xc32b('0x15')]);}logger[_0xc32b('0x13')]('WhatsappMessage,\x20%s,\x20%s',_0x5b21ad,_0x497069[_0xc32b('0x13')][_0xc32b('0x15')]);return _0x42a2ba(_0x497069[_0xc32b('0x13')]['message']);}else{logger[_0xc32b('0xd')](_0xc32b('0xe'),_0x5b21ad,_0xc32b('0xf'));_0x42a2ba(_0x497069[_0xc32b('0x16')][_0xc32b('0x15')]);}})[_0xc32b('0x17')](function(_0x411144){logger['error'](_0xc32b('0xe'),_0x5b21ad,_0x411144);_0x2cef7c(_0x411144);});});}function respondWithResult(_0x4bedfb,_0x10c2f0){_0x10c2f0=_0x10c2f0||0xc8;return function(_0x161d22){if(_0x161d22){return _0x4bedfb['status'](_0x10c2f0)[_0xc32b('0x18')](_0x161d22);}};}function respondWithFilteredResult(_0x5b9b3a,_0x229766){return function(_0x8d9b88){if(_0x8d9b88){var _0x3d88ea=typeof _0x229766[_0xc32b('0x19')]===_0xc32b('0x1a')&&typeof _0x229766['limit']===_0xc32b('0x1a');var _0x13ea4e=_0x8d9b88['count'];var _0x55579d=_0x3d88ea?0x0:_0x229766[_0xc32b('0x19')];var _0xa62ebf=_0x3d88ea?_0x8d9b88['count']:_0x229766[_0xc32b('0x19')]+_0x229766[_0xc32b('0x1b')];var _0x4a5dbc;if(_0xa62ebf>=_0x13ea4e){_0xa62ebf=_0x13ea4e;_0x4a5dbc=0xc8;}else{_0x4a5dbc=0xce;}_0x5b9b3a['status'](_0x4a5dbc);return _0x5b9b3a[_0xc32b('0x1c')](_0xc32b('0x1d'),_0x55579d+'-'+_0xa62ebf+'/'+_0x13ea4e)[_0xc32b('0x18')](_0x8d9b88);}return null;};}function saveUpdates(_0x597aab){return function(_0x332717){if(_0x332717){return _0x332717['update'](_0x597aab)[_0xc32b('0xc')](function(_0x7535ac){return _0x7535ac;});}return null;};}function removeEntity(_0x485b51){return function(_0x214654){if(_0x214654){return _0x214654['destroy']()[_0xc32b('0xc')](function(){_0x485b51[_0xc32b('0x1e')](0xcc)[_0xc32b('0x1f')]();});}};}function handleEntityNotFound(_0x56ee73){return function(_0x491923){if(!_0x491923){_0x56ee73[_0xc32b('0x20')](0x194);}return _0x491923;};}function handleError(_0x182f71,_0x2c137c){_0x2c137c=_0x2c137c||0x1f4;return function(_0x300763){logger[_0xc32b('0x13')](_0x300763[_0xc32b('0x21')]);if(_0x300763[_0xc32b('0x22')]){delete _0x300763[_0xc32b('0x22')];}_0x182f71[_0xc32b('0x1e')](_0x2c137c)[_0xc32b('0x23')](_0x300763);};}exports[_0xc32b('0x24')]=function(_0x48276f,_0x75abef){var _0x421c09={},_0x1493c0={},_0x4f6e75={'count':0x0,'rows':[]};var _0x2bf147=_[_0xc32b('0x25')](db[_0xc32b('0x26')][_0xc32b('0x27')],function(_0x318563){return{'name':_0x318563[_0xc32b('0x28')],'type':_0x318563[_0xc32b('0x29')]['key']};});_0x1493c0[_0xc32b('0x2a')]=_[_0xc32b('0x25')](_0x2bf147,_0xc32b('0x22'));_0x1493c0[_0xc32b('0x2b')]=_[_0xc32b('0x2c')](_0x48276f[_0xc32b('0x2b')]);_0x1493c0[_0xc32b('0x2d')]=_[_0xc32b('0x2e')](_0x1493c0[_0xc32b('0x2a')],_0x1493c0[_0xc32b('0x2b')]);_0x421c09[_0xc32b('0x2f')]=_[_0xc32b('0x2e')](_0x1493c0['model'],qs[_0xc32b('0x30')](_0x48276f[_0xc32b('0x2b')]['fields']));_0x421c09['attributes']=_0x421c09[_0xc32b('0x2f')][_0xc32b('0x31')]?_0x421c09[_0xc32b('0x2f')]:_0x1493c0[_0xc32b('0x2a')];if(!_0x48276f[_0xc32b('0x2b')][_0xc32b('0x32')](_0xc32b('0x33'))){_0x421c09[_0xc32b('0x1b')]=qs[_0xc32b('0x1b')](_0x48276f[_0xc32b('0x2b')][_0xc32b('0x1b')]);_0x421c09['offset']=qs['offset'](_0x48276f[_0xc32b('0x2b')][_0xc32b('0x19')]);}_0x421c09[_0xc32b('0x34')]=qs['sort'](_0x48276f['query']['sort']);_0x421c09[_0xc32b('0x35')]=qs[_0xc32b('0x2d')](_[_0xc32b('0x36')](_0x48276f['query'],_0x1493c0[_0xc32b('0x2d')]),_0x2bf147);if(_0x48276f[_0xc32b('0x2b')][_0xc32b('0x37')]){_0x421c09[_0xc32b('0x35')]=_[_0xc32b('0x38')](_0x421c09[_0xc32b('0x35')],{'$or':_['map'](_0x2bf147,function(_0x1df21d){if(_0x1df21d[_0xc32b('0x29')]!=='VIRTUAL'){var _0x383d81={};_0x383d81[_0x1df21d[_0xc32b('0x22')]]={'$like':'%'+_0x48276f[_0xc32b('0x2b')][_0xc32b('0x37')]+'%'};return _0x383d81;}})});}_0x421c09=_[_0xc32b('0x38')]({},_0x421c09,_0x48276f[_0xc32b('0x39')]);var _0x48a815={'where':_0x421c09[_0xc32b('0x35')]};return db['WhatsappMessage'][_0xc32b('0x3a')](_0x48a815)[_0xc32b('0xc')](function(_0x3795c9){_0x4f6e75[_0xc32b('0x3a')]=_0x3795c9;if(_0x48276f[_0xc32b('0x2b')][_0xc32b('0x3b')]){_0x421c09['include']=[{'all':!![]}];}return db['WhatsappMessage'][_0xc32b('0x3c')](_0x421c09);})[_0xc32b('0xc')](function(_0x526b53){_0x4f6e75[_0xc32b('0x3d')]=_0x526b53;return _0x4f6e75;})[_0xc32b('0xc')](respondWithFilteredResult(_0x75abef,_0x421c09))[_0xc32b('0x17')](handleError(_0x75abef,null));};exports[_0xc32b('0x3e')]=function(_0xe9de19,_0x35e6b2){var _0x3bb5f7={'raw':!![],'where':{'id':_0xe9de19[_0xc32b('0x3f')]['id']}},_0x1983b8={};_0x1983b8[_0xc32b('0x2a')]=_[_0xc32b('0x2c')](db[_0xc32b('0x26')][_0xc32b('0x27')]);_0x1983b8[_0xc32b('0x2b')]=_['keys'](_0xe9de19['query']);_0x1983b8['filters']=_[_0xc32b('0x2e')](_0x1983b8[_0xc32b('0x2a')],_0x1983b8[_0xc32b('0x2b')]);_0x3bb5f7[_0xc32b('0x2f')]=_['intersection'](_0x1983b8[_0xc32b('0x2a')],qs[_0xc32b('0x30')](_0xe9de19[_0xc32b('0x2b')]['fields']));_0x3bb5f7[_0xc32b('0x2f')]=_0x3bb5f7['attributes'][_0xc32b('0x31')]?_0x3bb5f7[_0xc32b('0x2f')]:_0x1983b8[_0xc32b('0x2a')];if(_0xe9de19[_0xc32b('0x2b')][_0xc32b('0x3b')]){_0x3bb5f7[_0xc32b('0x40')]=[{'all':!![]}];}_0x3bb5f7=_[_0xc32b('0x38')]({},_0x3bb5f7,_0xe9de19[_0xc32b('0x39')]);return db[_0xc32b('0x26')]['find'](_0x3bb5f7)['then'](handleEntityNotFound(_0x35e6b2,null))[_0xc32b('0xc')](respondWithResult(_0x35e6b2,null))['catch'](handleError(_0x35e6b2,null));};exports[_0xc32b('0x41')]=function(_0x373d8c,_0x2d3f37){return db['WhatsappMessage'][_0xc32b('0x41')](_0x373d8c[_0xc32b('0x42')],{})[_0xc32b('0xc')](respondWithResult(_0x2d3f37,0xc9))[_0xc32b('0x17')](handleError(_0x2d3f37,null));};exports[_0xc32b('0x43')]=function(_0x193d83,_0x216dc1){if(_0x193d83[_0xc32b('0x42')]['id']){delete _0x193d83[_0xc32b('0x42')]['id'];}return db['WhatsappMessage']['find']({'where':{'id':_0x193d83[_0xc32b('0x3f')]['id']}})['then'](handleEntityNotFound(_0x216dc1,null))[_0xc32b('0xc')](saveUpdates(_0x193d83[_0xc32b('0x42')],null))[_0xc32b('0xc')](respondWithResult(_0x216dc1,null))[_0xc32b('0x17')](handleError(_0x216dc1,null));};exports[_0xc32b('0x44')]=function(_0x55efbc,_0x2039f9){return db[_0xc32b('0x26')]['find']({'where':{'id':_0x55efbc['params']['id']}})[_0xc32b('0xc')](handleEntityNotFound(_0x2039f9,null))['then'](removeEntity(_0x2039f9,null))[_0xc32b('0x17')](handleError(_0x2039f9,null));};exports[_0xc32b('0x45')]=function(_0x403a9e,_0x111d04){return db['WhatsappMessage'][_0xc32b('0x45')]()[_0xc32b('0xc')](respondWithResult(_0x111d04,null))[_0xc32b('0x17')](handleError(_0x111d04,null));};exports['accept']=function(_0x53317c,_0x345442){var _0x239d2e=_0xc32b('0x46');return interactionService[_0xc32b('0x47')](_0x53317c,_0x239d2e)[_0xc32b('0xc')](respondWithResult(_0x345442,null))[_0xc32b('0x17')](handleError(_0x345442,null));};exports[_0xc32b('0x48')]=function(_0x37e2ca,_0x1aacdd){var _0x4b3909={'agent':{},'channel':'whatsapp'};if(_0x37e2ca[_0xc32b('0x42')]['id']){delete _0x37e2ca['body']['id'];}_0x37e2ca[_0xc32b('0x42')][_0xc32b('0x49')]=_0x37e2ca['body']['UserId']||_0x37e2ca[_0xc32b('0x4a')]['id'];_0x4b3909[_0xc32b('0x4b')]['id']=_0x37e2ca['body']['UserId'];return db[_0xc32b('0x26')]['find']({'where':{'id':_0x37e2ca['params']['id'],'UserId':null}})[_0xc32b('0xc')](handleEntityNotFound(_0x1aacdd,null))['then'](function(_0x3933a4){if(_0x3933a4){_0x4b3909[_0xc32b('0x15')]=_0x3933a4[_0xc32b('0x4c')]({'plain':!![]});return db[_0xc32b('0x4d')]['find']({'where':{'id':_0x3933a4[_0xc32b('0x4e')]}});}return null;})[_0xc32b('0xc')](handleEntityNotFound(_0x1aacdd,null))[_0xc32b('0xc')](function(_0x419cd7){if(_0x419cd7){_0x4b3909['interaction']=_0x419cd7['get']({'plain':!![]});interaction_log[_0xc32b('0xd')](_0xc32b('0x4f'),_0x37e2ca[_0xc32b('0x4a')]['id'],_0x37e2ca[_0xc32b('0x4a')][_0xc32b('0x22')],_0x37e2ca[_0xc32b('0x4a')][_0xc32b('0x50')],_0x4b3909['interaction']['id'],_0x37e2ca[_0xc32b('0x42')]?JSON[_0xc32b('0x12')](_0x37e2ca['body']):_0xc32b('0x51'));return respondWithRpcPromise(_0xc32b('0x52'),_0xc32b('0x53'),_0x4b3909);}return null;})[_0xc32b('0xc')](function(_0x97936c){var _0x36b301=_0xc32b('0x54')+_0x97936c['message'][_0xc32b('0x55')];return db['sequelize'][_0xc32b('0x2b')](_0x36b301,{'type':db[_0xc32b('0x56')][_0xc32b('0x57')][_0xc32b('0x58')],'raw':!![]})[_0xc32b('0xc')](function(_0x30fbca){return _0x30fbca;});})[_0xc32b('0xc')](function(_0x1ebd54){if(_0x1ebd54){_0x4b3909[_0xc32b('0x15')][_0xc32b('0x59')]=_0x1ebd54[0x0];if(!_0x37e2ca[_0xc32b('0x42')][_0xc32b('0x49')])return;return db['User'][_0xc32b('0x5a')]({'where':{'id':_0x37e2ca['body'][_0xc32b('0x49')],'role':_0xc32b('0x4b')},'attributes':['id',_0xc32b('0x22'),_0xc32b('0x5b'),_0xc32b('0x5c'),_0xc32b('0x5d')],'raw':!![]});}return null;})[_0xc32b('0xc')](function(_0x57e6c7){if(!_0x57e6c7)return null;_0x4b3909['message']['agent']=_0x57e6c7;return _0x4b3909;})['then'](function(_0x5cf7b2){if(_0x5cf7b2){_0x5cf7b2[_0xc32b('0x15')][_0xc32b('0x5e')]=util[_0xc32b('0x5f')](_0xc32b('0x60'),_0x37e2ca[_0xc32b('0x4a')][_0xc32b('0x22')]);_0x5cf7b2[_0xc32b('0x15')][_0xc32b('0x61')]=_0x4b3909['channel'];_0x5cf7b2[_0xc32b('0x15')][_0xc32b('0x62')]=_0x4b3909[_0xc32b('0x61')];_0x5cf7b2[_0xc32b('0x15')][_0xc32b('0x63')]=_0xc32b('0x48');respondWithRpcPromise('EventManager',_0xc32b('0x64'),{'event':_0xc32b('0x65'),'message':_0x5cf7b2['message']},client9002);return _0x4b3909;}return null;})[_0xc32b('0xc')](respondWithResult(_0x1aacdd,null))[_0xc32b('0x17')](handleError(_0x1aacdd,null));};exports[_0xc32b('0x1e')]=function(_0x16cfd5,_0x18080a){if(_0x16cfd5[_0xc32b('0x42')]['id']){delete _0x16cfd5[_0xc32b('0x42')]['id'];}var _0x365621;return db[_0xc32b('0x26')]['find']({'where':{'id':_0x16cfd5[_0xc32b('0x3f')]['id']}})[_0xc32b('0xc')](handleEntityNotFound(_0x18080a,null))[_0xc32b('0xc')](function(_0xf83b75){if(_0xf83b75){_0x365621=_0xf83b75;return db['WhatsappAccount'][_0xc32b('0x5a')]({'where':{'id':_0xf83b75[_0xc32b('0x66')]}});}})[_0xc32b('0xc')](handleEntityNotFound(_0x18080a,null))[_0xc32b('0xc')](function(_0x1a5624){if(_0x1a5624){logger['debug'](_0xc32b('0x67'),_0xc32b('0x1e'),_0xc32b('0x68'),_0x1a5624[_0xc32b('0x29')],util[_0xc32b('0x69')](_0x16cfd5['body'],{'showHidden':![],'depth':null}));switch(_0x1a5624[_0xc32b('0x29')]){case _0xc32b('0x6a'):if(_0x16cfd5['body']['MessageSid']&&_0x16cfd5[_0xc32b('0x42')][_0xc32b('0x6b')]===_0x365621[_0xc32b('0x6c')]&&_0x16cfd5[_0xc32b('0x42')]['MessageStatus']&&_0x16cfd5[_0xc32b('0x42')][_0xc32b('0x6d')]===_0xc32b('0x6e')){return _0x365621[_0xc32b('0x43')]({'read':!![]});}else{logger['error'](_0xc32b('0x6f'),_0xc32b('0x1e'),_0xc32b('0x6a'),util['inspect'](_0x16cfd5[_0xc32b('0x42')],{'showHidden':![],'depth':null}));}break;}return _0x365621;}})[_0xc32b('0xc')](respondWithResult(_0x18080a,null))[_0xc32b('0x17')](handleError(_0x18080a,null));}; \ No newline at end of file +var _0x2bc0=['localhost','socket.io-emitter','redis','./whatsappMessage.socket','register','jayson/promise','http','whatsapp-interactions','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','status','offset','limit','undefined','count','Content-Range','destroy','end','stack','name','send','index','map','WhatsappMessage','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','update','describe','accept','whatsapp','reject','UserId','user','agent','get','WhatsappInteractionId','interaction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','fullname','internal','format','SIP/%s','channel','motionChannel','event','EventManager','rejectmessage','params','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','twilio','inspect','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb'];(function(_0x2fd135,_0x319183){var _0x8ab5da=function(_0x149953){while(--_0x149953){_0x2fd135['push'](_0x2fd135['shift']());}};_0x8ab5da(++_0x319183);}(_0x2bc0,0x6a));var _0x02bc=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x2bc0[_0x502c7d];return _0x30b7ed;};'use strict';var util=require('util');var _=require('lodash');var Redis=require(_0x02bc('0x0'));var interactionService=require('../../components/interaction/service');var qs=require(_0x02bc('0x1'));var logger=require(_0x02bc('0x2'))('api');var config=require(_0x02bc('0x3'));var db=require(_0x02bc('0x4'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x02bc('0x5'),'port':0x18eb});var socket=require(_0x02bc('0x6'))(new Redis(config[_0x02bc('0x7')]));require(_0x02bc('0x8'))[_0x02bc('0x9')](socket);var jayson=require(_0x02bc('0xa'));var client=jayson['client'][_0x02bc('0xb')]({'port':0x232c});var client9002=jayson['client'][_0x02bc('0xb')]({'port':0x232a});var interaction_log=require(_0x02bc('0x2'))(_0x02bc('0xc'));function respondWithRpcPromise(_0x2e39b9,_0x2fdbaa,_0x2027c7,_0x2e2397){return new Promise(function(_0x226eb5,_0x1727c7){var _0x1f2122=_0x2e2397||client;return _0x1f2122[_0x02bc('0xd')](_0x2e39b9,_0x2027c7)[_0x02bc('0xe')](function(_0x1b952c){logger[_0x02bc('0xf')](_0x02bc('0x10'),_0x2fdbaa,_0x02bc('0x11'));logger[_0x02bc('0x12')](_0x02bc('0x13'),_0x2fdbaa,_0x02bc('0x11'),JSON['stringify'](_0x1b952c));if(_0x1b952c[_0x02bc('0x14')]){if(_0x1b952c[_0x02bc('0x14')][_0x02bc('0x15')]===0x1f4){logger[_0x02bc('0x14')](_0x02bc('0x10'),_0x2fdbaa,_0x1b952c['error'][_0x02bc('0x16')]);return _0x1727c7(_0x1b952c[_0x02bc('0x14')][_0x02bc('0x16')]);}logger['error'](_0x02bc('0x10'),_0x2fdbaa,_0x1b952c[_0x02bc('0x14')][_0x02bc('0x16')]);return _0x226eb5(_0x1b952c['error'][_0x02bc('0x16')]);}else{logger[_0x02bc('0xf')](_0x02bc('0x10'),_0x2fdbaa,'request\x20sent');_0x226eb5(_0x1b952c[_0x02bc('0x17')][_0x02bc('0x16')]);}})['catch'](function(_0x5b034c){logger[_0x02bc('0x14')](_0x02bc('0x10'),_0x2fdbaa,_0x5b034c);_0x1727c7(_0x5b034c);});});}function respondWithResult(_0x3c2540,_0xbce8ba){_0xbce8ba=_0xbce8ba||0xc8;return function(_0xde4c74){if(_0xde4c74){return _0x3c2540[_0x02bc('0x18')](_0xbce8ba)['json'](_0xde4c74);}};}function respondWithFilteredResult(_0x1e1807,_0x5786c1){return function(_0x8d62f9){if(_0x8d62f9){var _0x270a69=typeof _0x5786c1[_0x02bc('0x19')]==='undefined'&&typeof _0x5786c1[_0x02bc('0x1a')]===_0x02bc('0x1b');var _0x172303=_0x8d62f9[_0x02bc('0x1c')];var _0x5476e0=_0x270a69?0x0:_0x5786c1[_0x02bc('0x19')];var _0x5dd022=_0x270a69?_0x8d62f9[_0x02bc('0x1c')]:_0x5786c1[_0x02bc('0x19')]+_0x5786c1['limit'];var _0x515243;if(_0x5dd022>=_0x172303){_0x5dd022=_0x172303;_0x515243=0xc8;}else{_0x515243=0xce;}_0x1e1807[_0x02bc('0x18')](_0x515243);return _0x1e1807['set'](_0x02bc('0x1d'),_0x5476e0+'-'+_0x5dd022+'/'+_0x172303)['json'](_0x8d62f9);}return null;};}function saveUpdates(_0x2baacb){return function(_0x51923e){if(_0x51923e){return _0x51923e['update'](_0x2baacb)[_0x02bc('0xe')](function(_0x358911){return _0x358911;});}return null;};}function removeEntity(_0x4e2ced){return function(_0x15a3ae){if(_0x15a3ae){return _0x15a3ae[_0x02bc('0x1e')]()[_0x02bc('0xe')](function(){_0x4e2ced[_0x02bc('0x18')](0xcc)[_0x02bc('0x1f')]();});}};}function handleEntityNotFound(_0x2e197f){return function(_0x8b1e09){if(!_0x8b1e09){_0x2e197f['sendStatus'](0x194);}return _0x8b1e09;};}function handleError(_0x55a76f,_0x233a2c){_0x233a2c=_0x233a2c||0x1f4;return function(_0x493359){logger[_0x02bc('0x14')](_0x493359[_0x02bc('0x20')]);if(_0x493359[_0x02bc('0x21')]){delete _0x493359[_0x02bc('0x21')];}_0x55a76f[_0x02bc('0x18')](_0x233a2c)[_0x02bc('0x22')](_0x493359);};}exports[_0x02bc('0x23')]=function(_0xe5bef4,_0x40b8d6){var _0x3515b2={},_0x558bd7={},_0x23067d={'count':0x0,'rows':[]};var _0x213b92=_[_0x02bc('0x24')](db[_0x02bc('0x25')][_0x02bc('0x26')],function(_0x2dc800){return{'name':_0x2dc800['fieldName'],'type':_0x2dc800[_0x02bc('0x27')][_0x02bc('0x28')]};});_0x558bd7['model']=_[_0x02bc('0x24')](_0x213b92,_0x02bc('0x21'));_0x558bd7[_0x02bc('0x29')]=_[_0x02bc('0x2a')](_0xe5bef4[_0x02bc('0x29')]);_0x558bd7[_0x02bc('0x2b')]=_[_0x02bc('0x2c')](_0x558bd7[_0x02bc('0x2d')],_0x558bd7[_0x02bc('0x29')]);_0x3515b2[_0x02bc('0x2e')]=_[_0x02bc('0x2c')](_0x558bd7[_0x02bc('0x2d')],qs[_0x02bc('0x2f')](_0xe5bef4[_0x02bc('0x29')][_0x02bc('0x2f')]));_0x3515b2[_0x02bc('0x2e')]=_0x3515b2[_0x02bc('0x2e')][_0x02bc('0x30')]?_0x3515b2[_0x02bc('0x2e')]:_0x558bd7[_0x02bc('0x2d')];if(!_0xe5bef4[_0x02bc('0x29')]['hasOwnProperty'](_0x02bc('0x31'))){_0x3515b2[_0x02bc('0x1a')]=qs[_0x02bc('0x1a')](_0xe5bef4[_0x02bc('0x29')][_0x02bc('0x1a')]);_0x3515b2[_0x02bc('0x19')]=qs[_0x02bc('0x19')](_0xe5bef4[_0x02bc('0x29')][_0x02bc('0x19')]);}_0x3515b2[_0x02bc('0x32')]=qs[_0x02bc('0x33')](_0xe5bef4[_0x02bc('0x29')][_0x02bc('0x33')]);_0x3515b2[_0x02bc('0x34')]=qs[_0x02bc('0x2b')](_[_0x02bc('0x35')](_0xe5bef4[_0x02bc('0x29')],_0x558bd7[_0x02bc('0x2b')]),_0x213b92);if(_0xe5bef4['query'][_0x02bc('0x36')]){_0x3515b2['where']=_[_0x02bc('0x37')](_0x3515b2[_0x02bc('0x34')],{'$or':_[_0x02bc('0x24')](_0x213b92,function(_0x45fb26){if(_0x45fb26['type']!==_0x02bc('0x38')){var _0x528273={};_0x528273[_0x45fb26[_0x02bc('0x21')]]={'$like':'%'+_0xe5bef4[_0x02bc('0x29')][_0x02bc('0x36')]+'%'};return _0x528273;}})});}_0x3515b2=_[_0x02bc('0x37')]({},_0x3515b2,_0xe5bef4[_0x02bc('0x39')]);var _0x19328c={'where':_0x3515b2[_0x02bc('0x34')]};return db['WhatsappMessage']['count'](_0x19328c)[_0x02bc('0xe')](function(_0x5e6986){_0x23067d[_0x02bc('0x1c')]=_0x5e6986;if(_0xe5bef4[_0x02bc('0x29')][_0x02bc('0x3a')]){_0x3515b2[_0x02bc('0x3b')]=[{'all':!![]}];}return db[_0x02bc('0x25')][_0x02bc('0x3c')](_0x3515b2);})['then'](function(_0x239e6b){_0x23067d[_0x02bc('0x3d')]=_0x239e6b;return _0x23067d;})[_0x02bc('0xe')](respondWithFilteredResult(_0x40b8d6,_0x3515b2))[_0x02bc('0x3e')](handleError(_0x40b8d6,null));};exports[_0x02bc('0x3f')]=function(_0x42c268,_0x42adab){var _0x112d53={'raw':!![],'where':{'id':_0x42c268['params']['id']}},_0x5115b5={};_0x5115b5[_0x02bc('0x2d')]=_[_0x02bc('0x2a')](db[_0x02bc('0x25')][_0x02bc('0x26')]);_0x5115b5[_0x02bc('0x29')]=_[_0x02bc('0x2a')](_0x42c268[_0x02bc('0x29')]);_0x5115b5[_0x02bc('0x2b')]=_['intersection'](_0x5115b5[_0x02bc('0x2d')],_0x5115b5[_0x02bc('0x29')]);_0x112d53[_0x02bc('0x2e')]=_[_0x02bc('0x2c')](_0x5115b5['model'],qs['fields'](_0x42c268[_0x02bc('0x29')][_0x02bc('0x2f')]));_0x112d53[_0x02bc('0x2e')]=_0x112d53[_0x02bc('0x2e')][_0x02bc('0x30')]?_0x112d53[_0x02bc('0x2e')]:_0x5115b5[_0x02bc('0x2d')];if(_0x42c268[_0x02bc('0x29')][_0x02bc('0x3a')]){_0x112d53[_0x02bc('0x3b')]=[{'all':!![]}];}_0x112d53=_[_0x02bc('0x37')]({},_0x112d53,_0x42c268[_0x02bc('0x39')]);return db[_0x02bc('0x25')][_0x02bc('0x40')](_0x112d53)[_0x02bc('0xe')](handleEntityNotFound(_0x42adab,null))[_0x02bc('0xe')](respondWithResult(_0x42adab,null))[_0x02bc('0x3e')](handleError(_0x42adab,null));};exports['create']=function(_0x5726d3,_0x45b906){return db[_0x02bc('0x25')][_0x02bc('0x41')](_0x5726d3[_0x02bc('0x42')],{})[_0x02bc('0xe')](respondWithResult(_0x45b906,0xc9))[_0x02bc('0x3e')](handleError(_0x45b906,null));};exports[_0x02bc('0x43')]=function(_0x11a419,_0x5889c1){if(_0x11a419[_0x02bc('0x42')]['id']){delete _0x11a419[_0x02bc('0x42')]['id'];}return db[_0x02bc('0x25')][_0x02bc('0x40')]({'where':{'id':_0x11a419['params']['id']}})[_0x02bc('0xe')](handleEntityNotFound(_0x5889c1,null))[_0x02bc('0xe')](saveUpdates(_0x11a419[_0x02bc('0x42')],null))['then'](respondWithResult(_0x5889c1,null))[_0x02bc('0x3e')](handleError(_0x5889c1,null));};exports[_0x02bc('0x1e')]=function(_0x36379a,_0x3769c8){return db[_0x02bc('0x25')][_0x02bc('0x40')]({'where':{'id':_0x36379a['params']['id']}})[_0x02bc('0xe')](handleEntityNotFound(_0x3769c8,null))[_0x02bc('0xe')](removeEntity(_0x3769c8,null))[_0x02bc('0x3e')](handleError(_0x3769c8,null));};exports[_0x02bc('0x44')]=function(_0x104c41,_0x1695f0){return db[_0x02bc('0x25')][_0x02bc('0x44')]()['then'](respondWithResult(_0x1695f0,null))[_0x02bc('0x3e')](handleError(_0x1695f0,null));};exports[_0x02bc('0x45')]=function(_0x48dd74,_0x5291c9){var _0x31226e=_0x02bc('0x46');return interactionService['acceptMessage'](_0x48dd74,_0x31226e)[_0x02bc('0xe')](respondWithResult(_0x5291c9,null))[_0x02bc('0x3e')](handleError(_0x5291c9,null));};exports[_0x02bc('0x47')]=function(_0x718f7b,_0x39daf0){var _0x4eb41b={'agent':{},'channel':_0x02bc('0x46')};if(_0x718f7b[_0x02bc('0x42')]['id']){delete _0x718f7b[_0x02bc('0x42')]['id'];}_0x718f7b[_0x02bc('0x42')][_0x02bc('0x48')]=_0x718f7b['body'][_0x02bc('0x48')]||_0x718f7b[_0x02bc('0x49')]['id'];_0x4eb41b[_0x02bc('0x4a')]['id']=_0x718f7b[_0x02bc('0x42')][_0x02bc('0x48')];return db['WhatsappMessage'][_0x02bc('0x40')]({'where':{'id':_0x718f7b['params']['id'],'UserId':null}})[_0x02bc('0xe')](handleEntityNotFound(_0x39daf0,null))[_0x02bc('0xe')](function(_0x251879){if(_0x251879){_0x4eb41b[_0x02bc('0x16')]=_0x251879[_0x02bc('0x4b')]({'plain':!![]});return db['WhatsappInteraction'][_0x02bc('0x40')]({'where':{'id':_0x251879[_0x02bc('0x4c')]}});}return null;})[_0x02bc('0xe')](handleEntityNotFound(_0x39daf0,null))[_0x02bc('0xe')](function(_0x59f3f3){if(_0x59f3f3){_0x4eb41b[_0x02bc('0x4d')]=_0x59f3f3[_0x02bc('0x4b')]({'plain':!![]});interaction_log[_0x02bc('0xf')](_0x02bc('0x4e'),_0x718f7b[_0x02bc('0x49')]['id'],_0x718f7b[_0x02bc('0x49')][_0x02bc('0x21')],_0x718f7b[_0x02bc('0x49')][_0x02bc('0x4f')],_0x4eb41b['interaction']['id'],_0x718f7b[_0x02bc('0x42')]?JSON[_0x02bc('0x50')](_0x718f7b[_0x02bc('0x42')]):_0x02bc('0x51'));return respondWithRpcPromise(_0x02bc('0x52'),_0x02bc('0x53'),_0x4eb41b);}return null;})[_0x02bc('0xe')](function(_0x2a9388){var _0x178519=_0x02bc('0x54')+_0x2a9388[_0x02bc('0x16')][_0x02bc('0x55')];return db[_0x02bc('0x56')]['query'](_0x178519,{'type':db[_0x02bc('0x57')][_0x02bc('0x58')][_0x02bc('0x59')],'raw':!![]})[_0x02bc('0xe')](function(_0x501fc3){return _0x501fc3;});})['then'](function(_0x4e30da){if(_0x4e30da){_0x4eb41b[_0x02bc('0x16')]['contact']=_0x4e30da[0x0];if(!_0x718f7b[_0x02bc('0x42')][_0x02bc('0x48')])return;return db[_0x02bc('0x5a')]['find']({'where':{'id':_0x718f7b[_0x02bc('0x42')][_0x02bc('0x48')],'role':_0x02bc('0x4a')},'attributes':['id',_0x02bc('0x21'),_0x02bc('0x5b'),'email',_0x02bc('0x5c')],'raw':!![]});}return null;})['then'](function(_0x31cd70){if(!_0x31cd70)return null;_0x4eb41b[_0x02bc('0x16')][_0x02bc('0x4a')]=_0x31cd70;return _0x4eb41b;})['then'](function(_0x35398a){if(_0x35398a){_0x35398a[_0x02bc('0x16')]['interface']=util[_0x02bc('0x5d')](_0x02bc('0x5e'),_0x718f7b['user']['name']);_0x35398a[_0x02bc('0x16')][_0x02bc('0x5f')]=_0x4eb41b[_0x02bc('0x5f')];_0x35398a[_0x02bc('0x16')][_0x02bc('0x60')]=_0x4eb41b[_0x02bc('0x5f')];_0x35398a['message'][_0x02bc('0x61')]=_0x02bc('0x47');respondWithRpcPromise('EventManager',_0x02bc('0x62'),{'event':_0x02bc('0x63'),'message':_0x35398a[_0x02bc('0x16')]},client9002);return _0x4eb41b;}return null;})[_0x02bc('0xe')](respondWithResult(_0x39daf0,null))['catch'](handleError(_0x39daf0,null));};exports[_0x02bc('0x18')]=function(_0x5b97a4,_0x48cd7c){if(_0x5b97a4[_0x02bc('0x42')]['id']){delete _0x5b97a4[_0x02bc('0x42')]['id'];}var _0x57aeab;return db['WhatsappMessage']['find']({'where':{'id':_0x5b97a4[_0x02bc('0x64')]['id']}})[_0x02bc('0xe')](handleEntityNotFound(_0x48cd7c,null))[_0x02bc('0xe')](function(_0x2cf5bf){if(_0x2cf5bf){_0x57aeab=_0x2cf5bf;return db[_0x02bc('0x65')][_0x02bc('0x40')]({'where':{'id':_0x2cf5bf[_0x02bc('0x66')]}});}})[_0x02bc('0xe')](handleEntityNotFound(_0x48cd7c,null))[_0x02bc('0xe')](function(_0x3c030f){if(_0x3c030f){logger[_0x02bc('0x12')](_0x02bc('0x67'),_0x02bc('0x18'),_0x02bc('0x68'),_0x3c030f[_0x02bc('0x27')],util['inspect'](_0x5b97a4[_0x02bc('0x42')],{'showHidden':![],'depth':null}));switch(_0x3c030f[_0x02bc('0x27')]){case'twilio':if(_0x5b97a4['body'][_0x02bc('0x69')]&&_0x5b97a4[_0x02bc('0x42')][_0x02bc('0x69')]===_0x57aeab[_0x02bc('0x6a')]&&_0x5b97a4['body'][_0x02bc('0x6b')]&&_0x5b97a4['body']['MessageStatus']==='read'){return _0x57aeab[_0x02bc('0x43')]({'read':!![]});}else{logger[_0x02bc('0x14')](_0x02bc('0x6c'),_0x02bc('0x18'),_0x02bc('0x6d'),util[_0x02bc('0x6e')](_0x5b97a4[_0x02bc('0x42')],{'showHidden':![],'depth':null}));}break;}return _0x57aeab;}})['then'](respondWithResult(_0x48cd7c,null))[_0x02bc('0x3e')](handleError(_0x48cd7c,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index efcf599..5904d1d 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 _0x8a5c=['hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0xff0da2,_0x48c76d){var _0x5849dc=function(_0x3ebe6d){while(--_0x3ebe6d){_0xff0da2['push'](_0xff0da2['shift']());}};_0x5849dc(++_0x48c76d);}(_0x8a5c,0x136));var _0xc8a5=function(_0x2a0538,_0x4c32c0){_0x2a0538=_0x2a0538-0x0;var _0x3083d5=_0x8a5c[_0x2a0538];return _0x3083d5;};'use strict';var EventEmitter=require(_0xc8a5('0x0'));var WhatsappMessage=require(_0xc8a5('0x1'))['db'][_0xc8a5('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xc8a5('0x3')](0x0);var events={'afterCreate':_0xc8a5('0x4'),'afterUpdate':_0xc8a5('0x5'),'afterDestroy':_0xc8a5('0x6')};function emitEvent(_0x3e2f37){return function(_0x84a3f4,_0x4dd6e0,_0x2b253c){WhatsappMessageEvents[_0xc8a5('0x7')](_0x3e2f37+':'+_0x84a3f4['id'],_0x84a3f4);WhatsappMessageEvents['emit'](_0x3e2f37,_0x84a3f4);_0x2b253c(null);};}for(var e in events){if(events[_0xc8a5('0x8')](e)){var event=events[e];WhatsappMessage[_0xc8a5('0x9')](e,emitEvent(event));}}module[_0xc8a5('0xa')]=WhatsappMessageEvents; \ No newline at end of file +var _0xf4eb=['hook','events','update','emit','hasOwnProperty'];(function(_0x5a5126,_0x2283f6){var _0xe7c5b1=function(_0x1f9a5e){while(--_0x1f9a5e){_0x5a5126['push'](_0x5a5126['shift']());}};_0xe7c5b1(++_0x2283f6);}(_0xf4eb,0xec));var _0xbf4e=function(_0x550683,_0x55d647){_0x550683=_0x550683-0x0;var _0xf43d8b=_0xf4eb[_0x550683];return _0xf43d8b;};'use strict';var EventEmitter=require(_0xbf4e('0x0'));var WhatsappMessage=require('../../mysqldb')['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xbf4e('0x1'),'afterDestroy':'remove'};function emitEvent(_0x4e7fa7){return function(_0x2e3070,_0x1c7606,_0x32d1d7){WhatsappMessageEvents[_0xbf4e('0x2')](_0x4e7fa7+':'+_0x2e3070['id'],_0x2e3070);WhatsappMessageEvents[_0xbf4e('0x2')](_0x4e7fa7,_0x2e3070);_0x32d1d7(null);};}for(var e in events){if(events[_0xbf4e('0x3')](e)){var event=events[e];WhatsappMessage[_0xbf4e('0x4')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index a2b0c5f..93ce194 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 _0xd0b1=['update','createdAt','error','WhatsappAccount','find','type','phone','accountSid','messages','whatsapp:','/api/whatsapp/messages/','/status?token=','sid','catch','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','twilio','inspect','authToken','baseUrl','/whatsapp/v1/','text','POST','Bearer\x20','application/json','statuses','message_id','WhatsappMessage,\x20%s','finally','utf8mb4','lodash','util','api','moment','request-promise','node-fetch','path','rimraf','../../config/environment','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','WhatsappInteraction','WhatsappInteractionId','then'];(function(_0x29acef,_0x3fa99b){var _0x66385d=function(_0x1571ec){while(--_0x1571ec){_0x29acef['push'](_0x29acef['shift']());}};_0x66385d(++_0x3fa99b);}(_0xd0b1,0x16e));var _0x1d0b=function(_0x405ace,_0x39b7f2){_0x405ace=_0x405ace-0x0;var _0x515f36=_0xd0b1[_0x405ace];return _0x515f36;};'use strict';var _=require(_0x1d0b('0x0'));var util=require(_0x1d0b('0x1'));var logger=require('../../config/logger')(_0x1d0b('0x2'));var moment=require(_0x1d0b('0x3'));var BPromise=require('bluebird');var rp=require(_0x1d0b('0x4'));var fetch=require(_0x1d0b('0x5'));var fs=require('fs');var path=require(_0x1d0b('0x6'));var rimraf=require(_0x1d0b('0x7'));var config=require(_0x1d0b('0x8'));var attributes=require('./whatsappMessage.attributes');module[_0x1d0b('0x9')]=function(_0x2c3e5d,_0x15786b){return _0x2c3e5d[_0x1d0b('0xa')](_0x1d0b('0xb'),attributes,{'tableName':_0x1d0b('0xc'),'paranoid':![],'indexes':[{'name':_0x1d0b('0xd'),'fields':['messageId']},{'name':_0x1d0b('0xe'),'fields':[_0x1d0b('0xf')],'type':_0x1d0b('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4b136e,_0x1b520a,_0x5ef099){var _0x196c3b=_0x2c3e5d[_0x1d0b('0x11')];var _0x4791e3=_0x4b136e['get']({'plain':!![]});if(_0x4791e3[_0x1d0b('0x12')]['toLowerCase']()==='in'||_0x4791e3[_0x1d0b('0x12')][_0x1d0b('0x13')]()===_0x1d0b('0x14')&&!_0x4791e3[_0x1d0b('0x15')]&&!_[_0x1d0b('0x16')](_0x4791e3['UserId'])){_0x196c3b[_0x1d0b('0x17')]['findOne']({'where':{'id':_0x4791e3[_0x1d0b('0x18')]}})[_0x1d0b('0x19')](function(_0x3cdd93){if(_0x3cdd93){_0x3cdd93[_0x1d0b('0x1a')]({'lastMsgAt':_0x4791e3[_0x1d0b('0x1b')],'lastMsgDirection':_0x4791e3[_0x1d0b('0x12')][_0x1d0b('0x13')]()});}})['catch'](function(_0x2c9462){console[_0x1d0b('0x1c')](_0x2c9462);});}if(_0x4791e3['direction']===_0x1d0b('0x14')&&!_0x4791e3[_0x1d0b('0x15')]){var _0x51ada7;_0x196c3b[_0x1d0b('0x1d')][_0x1d0b('0x1e')]({'where':{'id':_0x4791e3['WhatsappAccountId']},'raw':!![]})[_0x1d0b('0x19')](function(_0x1f874){_0x51ada7=_0x1f874;if(_0x51ada7&&_0x51ada7[_0x1d0b('0x1f')]){switch(_0x51ada7[_0x1d0b('0x1f')]){case'twilio':var _0x4ce71f=require('twilio');if(_0x51ada7['accountSid']&&_0x51ada7['authToken']&&_0x51ada7[_0x1d0b('0x20')]){var _0x1fe333=new _0x4ce71f(_0x51ada7[_0x1d0b('0x21')],_0x51ada7['authToken']);_0x1fe333[_0x1d0b('0x22')]['create']({'body':_0x4791e3[_0x1d0b('0xf')],'to':'whatsapp:'+_0x4791e3[_0x1d0b('0x20')],'from':_0x1d0b('0x23')+_0x51ada7[_0x1d0b('0x20')],'statusCallback':_0x51ada7['remote']+_0x1d0b('0x24')+_0x4791e3['id']+_0x1d0b('0x25')+_0x51ada7['token']})[_0x1d0b('0x19')](function(_0x583d26){if(_0x583d26[_0x1d0b('0x26')]){return _0x4b136e[_0x1d0b('0x1a')]({'messageId':_0x583d26[_0x1d0b('0x26')]});}})[_0x1d0b('0x27')](function(_0x23c762){logger[_0x1d0b('0x1c')](_0x1d0b('0x28'),_0x1d0b('0x29'),_0x1d0b('0x2a'),util[_0x1d0b('0x2b')](_0x23c762,{'showHidden':![],'depth':null}));});}else{logger[_0x1d0b('0x1c')](_0x1d0b('0x28'),_0x1d0b('0x29'),'twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case'sinch':var _0x4f9cd6=_0x51ada7[_0x1d0b('0x21')];var _0x4bbd37=_0x51ada7[_0x1d0b('0x2c')];var _0x27a3e2=_0x51ada7[_0x1d0b('0x2d')]+_0x1d0b('0x2e')+_0x4f9cd6+'/messages/';var _0x1123ee={'to':[_0x4791e3[_0x1d0b('0x20')]],'message':{'type':_0x1d0b('0x2f'),'text':_0x4791e3[_0x1d0b('0xf')]}};var _0x127ac3={'method':_0x1d0b('0x30'),'uri':_0x27a3e2,'headers':{'Authorization':_0x1d0b('0x31')+_0x4bbd37,'Content-Type':_0x1d0b('0x32')},'body':_0x1123ee,'json':!![]};rp(_0x127ac3)[_0x1d0b('0x19')](function(_0x4a5248){if(_0x4a5248[_0x1d0b('0x33')][0x0][_0x1d0b('0x34')]){return _0x4b136e[_0x1d0b('0x1a')]({'messageId':_0x4a5248[_0x1d0b('0x33')][0x0][_0x1d0b('0x34')]});}})[_0x1d0b('0x27')](function(_0x5d5654){logger['err'](_0x1d0b('0x35'),_0x5d5654);});break;}}})[_0x1d0b('0x36')](function(){_0x5ef099();});}else{_0x5ef099();}}},'charset':_0x1d0b('0x37'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x2068=['out','secret','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','createdAt','catch','error','WhatsappAccount','find','WhatsappAccountId','twilio','authToken','phone','accountSid','messages','whatsapp:','remote','/api/whatsapp/messages/','token','sid','afterCreate','inspect','WhatsappMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','/messages/','POST','Bearer\x20','application/json','statuses','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','direction','toLowerCase'];(function(_0x4ba2d2,_0x9f2ef){var _0x179cc9=function(_0x89e18f){while(--_0x89e18f){_0x4ba2d2['push'](_0x4ba2d2['shift']());}};_0x179cc9(++_0x9f2ef);}(_0x2068,0x6a));var _0x8206=function(_0x5670ad,_0x300b24){_0x5670ad=_0x5670ad-0x0;var _0x583792=_0x2068[_0x5670ad];return _0x583792;};'use strict';var _=require(_0x8206('0x0'));var util=require(_0x8206('0x1'));var logger=require('../../config/logger')(_0x8206('0x2'));var moment=require(_0x8206('0x3'));var BPromise=require(_0x8206('0x4'));var rp=require(_0x8206('0x5'));var fetch=require('node-fetch');var fs=require('fs');var path=require(_0x8206('0x6'));var rimraf=require('rimraf');var config=require(_0x8206('0x7'));var attributes=require(_0x8206('0x8'));module[_0x8206('0x9')]=function(_0x4bb800,_0x2cc0e8){return _0x4bb800[_0x8206('0xa')](_0x8206('0xb'),attributes,{'tableName':_0x8206('0xc'),'paranoid':![],'indexes':[{'name':_0x8206('0xd'),'fields':[_0x8206('0xd')]},{'name':_0x8206('0xe'),'fields':[_0x8206('0xf')],'type':_0x8206('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x6fc7e,_0x55b90f,_0x57c6f4){var _0x4d5912=_0x4bb800[_0x8206('0x11')];var _0x23ef34=_0x6fc7e['get']({'plain':!![]});if(_0x23ef34[_0x8206('0x12')][_0x8206('0x13')]()==='in'||_0x23ef34[_0x8206('0x12')][_0x8206('0x13')]()===_0x8206('0x14')&&!_0x23ef34[_0x8206('0x15')]&&!_[_0x8206('0x16')](_0x23ef34[_0x8206('0x17')])){_0x4d5912[_0x8206('0x18')][_0x8206('0x19')]({'where':{'id':_0x23ef34[_0x8206('0x1a')]}})[_0x8206('0x1b')](function(_0x3aff7f){if(_0x3aff7f){_0x3aff7f[_0x8206('0x1c')]({'lastMsgAt':_0x23ef34[_0x8206('0x1d')],'lastMsgDirection':_0x23ef34['direction'][_0x8206('0x13')]()});}})[_0x8206('0x1e')](function(_0x399add){console[_0x8206('0x1f')](_0x399add);});}if(_0x23ef34[_0x8206('0x12')]===_0x8206('0x14')&&!_0x23ef34[_0x8206('0x15')]){var _0x4caccb;_0x4d5912[_0x8206('0x20')][_0x8206('0x21')]({'where':{'id':_0x23ef34[_0x8206('0x22')]},'raw':!![]})[_0x8206('0x1b')](function(_0x1e2085){_0x4caccb=_0x1e2085;if(_0x4caccb&&_0x4caccb['type']){switch(_0x4caccb['type']){case _0x8206('0x23'):var _0x357de1=require(_0x8206('0x23'));if(_0x4caccb['accountSid']&&_0x4caccb[_0x8206('0x24')]&&_0x4caccb[_0x8206('0x25')]){var _0x2917c8=new _0x357de1(_0x4caccb[_0x8206('0x26')],_0x4caccb[_0x8206('0x24')]);_0x2917c8[_0x8206('0x27')]['create']({'body':_0x23ef34[_0x8206('0xf')],'to':_0x8206('0x28')+_0x23ef34['phone'],'from':'whatsapp:'+_0x4caccb['phone'],'statusCallback':_0x4caccb[_0x8206('0x29')]+_0x8206('0x2a')+_0x23ef34['id']+'/status?token='+_0x4caccb[_0x8206('0x2b')]})[_0x8206('0x1b')](function(_0x2de4f8){if(_0x2de4f8[_0x8206('0x2c')]){return _0x6fc7e[_0x8206('0x1c')]({'messageId':_0x2de4f8[_0x8206('0x2c')]});}})[_0x8206('0x1e')](function(_0x2fa3ed){logger['error']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x8206('0x2d'),_0x8206('0x23'),util[_0x8206('0x2e')](_0x2fa3ed,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x8206('0x2f'),_0x8206('0x2d'),_0x8206('0x23'),_0x8206('0x30'));}break;case _0x8206('0x31'):var _0x3fc591=_0x4caccb['accountSid'];var _0x333545=_0x4caccb[_0x8206('0x24')];var _0x519135=_0x4caccb[_0x8206('0x32')]+_0x8206('0x33')+_0x3fc591+_0x8206('0x34');var _0xeeb2c2={'to':[_0x23ef34[_0x8206('0x25')]],'message':{'type':'text','text':_0x23ef34[_0x8206('0xf')]}};var _0x4abb21={'method':_0x8206('0x35'),'uri':_0x519135,'headers':{'Authorization':_0x8206('0x36')+_0x333545,'Content-Type':_0x8206('0x37')},'body':_0xeeb2c2,'json':!![]};rp(_0x4abb21)[_0x8206('0x1b')](function(_0x250fb5){if(_0x250fb5[_0x8206('0x38')][0x0][_0x8206('0x39')]){return _0x6fc7e[_0x8206('0x1c')]({'messageId':_0x250fb5[_0x8206('0x38')][0x0][_0x8206('0x39')]});}})[_0x8206('0x1e')](function(_0x383165){logger[_0x8206('0x3a')](_0x8206('0x3b'),_0x383165);});break;}}})[_0x8206('0x3c')](function(){_0x57c6f4();});}else{_0x57c6f4();}}},'charset':_0x8206('0x3d'),'collate':_0x8206('0x3e')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index ad06ab1..bf88749 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 _0x67c0=['../../config/utils','rpc','client','http','redis','defaults','localhost','./whatsappMessage.socket','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateWhatsappMessage','WhatsappMessage','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3e7ba2,_0x2fbe83){var _0x3c2606=function(_0x12642c){while(--_0x12642c){_0x3e7ba2['push'](_0x3e7ba2['shift']());}};_0x3c2606(++_0x2fbe83);}(_0x67c0,0x191));var _0x067c=function(_0x38e660,_0x59bb24){_0x38e660=_0x38e660-0x0;var _0xc9a1ea=_0x67c0[_0x38e660];return _0xc9a1ea;};'use strict';var _=require(_0x067c('0x0'));var util=require(_0x067c('0x1'));var moment=require(_0x067c('0x2'));var BPromise=require(_0x067c('0x3'));var rs=require(_0x067c('0x4'));var fs=require('fs');var Redis=require(_0x067c('0x5'));var db=require(_0x067c('0x6'))['db'];var utils=require(_0x067c('0x7'));var logger=require('../../config/logger')(_0x067c('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x067c('0x9')][_0x067c('0xa')]({'port':0x232a});config[_0x067c('0xb')]=_[_0x067c('0xc')](config[_0x067c('0xb')],{'host':_0x067c('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x067c('0xb')]));require(_0x067c('0xe'))[_0x067c('0xf')](socket);function respondWithRpcPromise(_0x5782e7,_0x258ed3,_0x11fe1f){return new BPromise(function(_0x28f9f2,_0x41bfdd){return client[_0x067c('0x10')](_0x5782e7,_0x11fe1f)[_0x067c('0x11')](function(_0x45ffe4){logger[_0x067c('0x12')](_0x067c('0x13'),_0x258ed3,_0x067c('0x14'));logger[_0x067c('0x15')](_0x067c('0x16'),_0x258ed3,_0x067c('0x14'),JSON[_0x067c('0x17')](_0x45ffe4));if(_0x45ffe4[_0x067c('0x18')]){if(_0x45ffe4[_0x067c('0x18')][_0x067c('0x19')]===0x1f4){logger[_0x067c('0x18')](_0x067c('0x13'),_0x258ed3,_0x45ffe4[_0x067c('0x18')][_0x067c('0x1a')]);return _0x41bfdd(_0x45ffe4['error'][_0x067c('0x1a')]);}logger[_0x067c('0x18')](_0x067c('0x13'),_0x258ed3,_0x45ffe4[_0x067c('0x18')]['message']);return _0x28f9f2(_0x45ffe4['error'][_0x067c('0x1a')]);}else{logger[_0x067c('0x12')](_0x067c('0x13'),_0x258ed3,_0x067c('0x14'));_0x28f9f2(_0x45ffe4[_0x067c('0x1b')]['message']);}})[_0x067c('0x1c')](function(_0x31ffb3){logger[_0x067c('0x18')](_0x067c('0x13'),_0x258ed3,_0x31ffb3);_0x41bfdd(_0x31ffb3);});});}exports[_0x067c('0x1d')]=function(_0x8eb57b){var _0x235822=this;return new Promise(function(_0x1b8a25,_0x29d737){return db[_0x067c('0x1e')]['create'](_0x8eb57b[_0x067c('0x1f')],{'raw':_0x8eb57b[_0x067c('0x20')]?_0x8eb57b[_0x067c('0x20')][_0x067c('0x21')]===undefined?!![]:![]:!![]})[_0x067c('0x11')](function(_0x292a10){logger['info'](_0x067c('0x1d'),_0x8eb57b);logger[_0x067c('0x15')](_0x067c('0x1d'),_0x8eb57b,JSON[_0x067c('0x17')](_0x292a10));_0x1b8a25(_0x292a10);})[_0x067c('0x1c')](function(_0x19b083){logger['error'](_0x067c('0x1d'),_0x19b083[_0x067c('0x1a')],_0x8eb57b);_0x29d737(_0x235822[_0x067c('0x18')](0x1f4,_0x19b083[_0x067c('0x1a')]));});});}; \ No newline at end of file +var _0xfcf4=['CreateWhatsappMessage','create','body','options','raw','debug','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','then','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappMessage,\x20%s,\x20%s','message','info','catch'];(function(_0x5959c9,_0x2ed153){var _0x4ffcbc=function(_0x459b7a){while(--_0x459b7a){_0x5959c9['push'](_0x5959c9['shift']());}};_0x4ffcbc(++_0x2ed153);}(_0xfcf4,0x1a6));var _0x4fcf=function(_0x25907f,_0xa59ed7){_0x25907f=_0x25907f-0x0;var _0x3a4911=_0xfcf4[_0x25907f];return _0x3a4911;};'use strict';var _=require('lodash');var util=require(_0x4fcf('0x0'));var moment=require(_0x4fcf('0x1'));var BPromise=require(_0x4fcf('0x2'));var rs=require(_0x4fcf('0x3'));var fs=require('fs');var Redis=require(_0x4fcf('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4fcf('0x5'))(_0x4fcf('0x6'));var config=require('../../config/environment');var jayson=require(_0x4fcf('0x7'));var client=jayson[_0x4fcf('0x8')][_0x4fcf('0x9')]({'port':0x232a});config[_0x4fcf('0xa')]=_[_0x4fcf('0xb')](config[_0x4fcf('0xa')],{'host':_0x4fcf('0xc'),'port':0x18eb});var socket=require(_0x4fcf('0xd'))(new Redis(config['redis']));require(_0x4fcf('0xe'))[_0x4fcf('0xf')](socket);function respondWithRpcPromise(_0x5db7ab,_0x4759ef,_0x37e134){return new BPromise(function(_0x5cf2c2,_0x4fc427){return client[_0x4fcf('0x10')](_0x5db7ab,_0x37e134)[_0x4fcf('0x11')](function(_0x5d36b6){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x4759ef,_0x4fcf('0x12'));logger['debug'](_0x4fcf('0x13'),_0x4759ef,'request\x20sent',JSON[_0x4fcf('0x14')](_0x5d36b6));if(_0x5d36b6[_0x4fcf('0x15')]){if(_0x5d36b6['error']['code']===0x1f4){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x4759ef,_0x5d36b6[_0x4fcf('0x15')]['message']);return _0x4fc427(_0x5d36b6['error']['message']);}logger['error'](_0x4fcf('0x16'),_0x4759ef,_0x5d36b6['error'][_0x4fcf('0x17')]);return _0x5cf2c2(_0x5d36b6[_0x4fcf('0x15')][_0x4fcf('0x17')]);}else{logger[_0x4fcf('0x18')]('WhatsappMessage,\x20%s,\x20%s',_0x4759ef,_0x4fcf('0x12'));_0x5cf2c2(_0x5d36b6['result'][_0x4fcf('0x17')]);}})[_0x4fcf('0x19')](function(_0x251f51){logger[_0x4fcf('0x15')](_0x4fcf('0x16'),_0x4759ef,_0x251f51);_0x4fc427(_0x251f51);});});}exports[_0x4fcf('0x1a')]=function(_0xefc33e){var _0x32de92=this;return new Promise(function(_0x235555,_0x4dcb18){return db['WhatsappMessage'][_0x4fcf('0x1b')](_0xefc33e[_0x4fcf('0x1c')],{'raw':_0xefc33e['options']?_0xefc33e[_0x4fcf('0x1d')][_0x4fcf('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x481de6){logger[_0x4fcf('0x18')]('CreateWhatsappMessage',_0xefc33e);logger[_0x4fcf('0x1f')](_0x4fcf('0x1a'),_0xefc33e,JSON[_0x4fcf('0x14')](_0x481de6));_0x235555(_0x481de6);})['catch'](function(_0x77e932){logger['error'](_0x4fcf('0x1a'),_0x77e932['message'],_0xefc33e);_0x4dcb18(_0x32de92['error'](0x1f4,_0x77e932['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index c1cdf00..1f45d0b 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 _0xda06=['length','whatsappMessage:','remove','update','emit','removeListener'];(function(_0x1a033a,_0x1c37b4){var _0x2564ad=function(_0x1fd553){while(--_0x1fd553){_0x1a033a['push'](_0x1a033a['shift']());}};_0x2564ad(++_0x1c37b4);}(_0xda06,0xbc));var _0x6da0=function(_0x3d593d,_0x1dec8d){_0x3d593d=_0x3d593d-0x0;var _0x501ec5=_0xda06[_0x3d593d];return _0x501ec5;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=['save',_0x6da0('0x0'),_0x6da0('0x1')];function createListener(_0x1d56af,_0x577531){return function(_0x4267c3){_0x577531[_0x6da0('0x2')](_0x1d56af,_0x4267c3);};}function removeListener(_0x20f4b9,_0x5f472b){return function(){WhatsappMessageEvents[_0x6da0('0x3')](_0x20f4b9,_0x5f472b);};}exports['register']=function(_0x400c65){for(var _0x3b1649=0x0,_0x14729=events[_0x6da0('0x4')];_0x3b1649<_0x14729;_0x3b1649++){var _0x373aeb=events[_0x3b1649];var _0x4856db=createListener(_0x6da0('0x5')+_0x373aeb,_0x400c65);WhatsappMessageEvents['on'](_0x373aeb,_0x4856db);}}; \ No newline at end of file +var _0xb19e=['emit','register','length','whatsappMessage:','./whatsappMessage.events','save','remove'];(function(_0x3a2793,_0xa70bb0){var _0xecec9b=function(_0x9927ce){while(--_0x9927ce){_0x3a2793['push'](_0x3a2793['shift']());}};_0xecec9b(++_0xa70bb0);}(_0xb19e,0x100));var _0xeb19=function(_0x239dba,_0x309e95){_0x239dba=_0x239dba-0x0;var _0x1ceb11=_0xb19e[_0x239dba];return _0x1ceb11;};'use strict';var WhatsappMessageEvents=require(_0xeb19('0x0'));var events=[_0xeb19('0x1'),_0xeb19('0x2'),'update'];function createListener(_0x3dfd71,_0x814f43){return function(_0x42b2d3){_0x814f43[_0xeb19('0x3')](_0x3dfd71,_0x42b2d3);};}function removeListener(_0x271e51,_0x59b9b0){return function(){WhatsappMessageEvents['removeListener'](_0x271e51,_0x59b9b0);};}exports[_0xeb19('0x4')]=function(_0x15c62a){for(var _0x2956ec=0x0,_0x5438a0=events[_0xeb19('0x5')];_0x2956ec<_0x5438a0;_0x2956ec++){var _0x419641=events[_0x2956ec];var _0x36e2bf=createListener(_0xeb19('0x6')+_0x419641,_0x15c62a);WhatsappMessageEvents['on'](_0x419641,_0x36e2bf);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index c171728..e230e84 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 _0x1a70=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappQueue.controller','get','index','/describe','isAuthenticated','/:id','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer'];(function(_0x2bb9cb,_0x3e2c0f){var _0x1ab28b=function(_0x1b344a){while(--_0x1b344a){_0x2bb9cb['push'](_0x2bb9cb['shift']());}};_0x1ab28b(++_0x3e2c0f);}(_0x1a70,0x1df));var _0x01a7=function(_0x40d078,_0x210a77){_0x40d078=_0x40d078-0x0;var _0x46fc81=_0x1a70[_0x40d078];return _0x46fc81;};'use strict';var multer=require(_0x01a7('0x0'));var util=require(_0x01a7('0x1'));var path=require(_0x01a7('0x2'));var timeout=require(_0x01a7('0x3'));var express=require(_0x01a7('0x4'));var router=express[_0x01a7('0x5')]();var fs_extra=require(_0x01a7('0x6'));var auth=require(_0x01a7('0x7'));var interaction=require(_0x01a7('0x8'));var config=require('../../config/environment');var controller=require(_0x01a7('0x9'));router[_0x01a7('0xa')]('/',auth['isAuthenticated'](),controller[_0x01a7('0xb')]);router[_0x01a7('0xa')](_0x01a7('0xc'),auth[_0x01a7('0xd')](),controller['describe']);router[_0x01a7('0xa')](_0x01a7('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x01a7('0xa')](_0x01a7('0xf'),auth[_0x01a7('0xd')](),controller['getMembers']);router[_0x01a7('0xa')](_0x01a7('0x10'),auth[_0x01a7('0xd')](),controller[_0x01a7('0x11')]);router['get'](_0x01a7('0x12'),auth[_0x01a7('0xd')](),controller[_0x01a7('0x13')]);router[_0x01a7('0x14')]('/',auth['isAuthenticated'](),controller['create']);router[_0x01a7('0x14')](_0x01a7('0x10'),auth[_0x01a7('0xd')](),controller[_0x01a7('0x15')]);router['post']('/:id/users',auth[_0x01a7('0xd')](),controller[_0x01a7('0x16')]);router[_0x01a7('0x17')]('/:id',auth['isAuthenticated'](),controller[_0x01a7('0x18')]);router[_0x01a7('0x19')](_0x01a7('0xe'),auth['isAuthenticated'](),controller[_0x01a7('0x1a')]);router['delete'](_0x01a7('0x10'),auth[_0x01a7('0xd')](),controller[_0x01a7('0x1b')]);router[_0x01a7('0x19')](_0x01a7('0x12'),auth[_0x01a7('0xd')](),controller[_0x01a7('0x1c')]);module[_0x01a7('0x1d')]=router; \ No newline at end of file +var _0x5e6b=['multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getAgents','post','create','addTeams','/:id/users','addAgents','put','delete','destroy','removeTeams'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x5e6b,0x16c));var _0xb5e6=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0x5e6b[_0x1589dd];return _0x1bddd1;};'use strict';var multer=require(_0xb5e6('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb5e6('0x1'));var router=express[_0xb5e6('0x2')]();var fs_extra=require(_0xb5e6('0x3'));var auth=require(_0xb5e6('0x4'));var interaction=require(_0xb5e6('0x5'));var config=require(_0xb5e6('0x6'));var controller=require(_0xb5e6('0x7'));router['get']('/',auth[_0xb5e6('0x8')](),controller[_0xb5e6('0x9')]);router[_0xb5e6('0xa')](_0xb5e6('0xb'),auth['isAuthenticated'](),controller[_0xb5e6('0xc')]);router[_0xb5e6('0xa')](_0xb5e6('0xd'),auth[_0xb5e6('0x8')](),controller[_0xb5e6('0xe')]);router[_0xb5e6('0xa')](_0xb5e6('0xf'),auth['isAuthenticated'](),controller[_0xb5e6('0x10')]);router[_0xb5e6('0xa')](_0xb5e6('0x11'),auth[_0xb5e6('0x8')](),controller['getTeams']);router['get']('/:id/users',auth[_0xb5e6('0x8')](),controller[_0xb5e6('0x12')]);router[_0xb5e6('0x13')]('/',auth[_0xb5e6('0x8')](),controller[_0xb5e6('0x14')]);router[_0xb5e6('0x13')](_0xb5e6('0x11'),auth[_0xb5e6('0x8')](),controller[_0xb5e6('0x15')]);router[_0xb5e6('0x13')](_0xb5e6('0x16'),auth[_0xb5e6('0x8')](),controller[_0xb5e6('0x17')]);router[_0xb5e6('0x18')](_0xb5e6('0xd'),auth[_0xb5e6('0x8')](),controller['update']);router[_0xb5e6('0x19')](_0xb5e6('0xd'),auth[_0xb5e6('0x8')](),controller[_0xb5e6('0x1a')]);router[_0xb5e6('0x19')](_0xb5e6('0x11'),auth['isAuthenticated'](),controller[_0xb5e6('0x1b')]);router[_0xb5e6('0x19')](_0xb5e6('0x16'),auth['isAuthenticated'](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 31bfc37..d776ccf 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 _0x5d31=['INTEGER','ENUM','beepall','sequelize','exports','STRING'];(function(_0x2ea14f,_0x5c6fec){var _0x15db0d=function(_0x9bee37){while(--_0x9bee37){_0x2ea14f['push'](_0x2ea14f['shift']());}};_0x15db0d(++_0x5c6fec);}(_0x5d31,0xb7));var _0x15d3=function(_0x5967c0,_0x452377){_0x5967c0=_0x5967c0-0x0;var _0x2ad249=_0x5d31[_0x5967c0];return _0x2ad249;};'use strict';var Sequelize=require(_0x15d3('0x0'));module[_0x15d3('0x1')]={'name':{'type':Sequelize[_0x15d3('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x15d3('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x15d3('0x4')]('rrmemory',_0x15d3('0x5'),'roundrobin')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3299=['ENUM','rrmemory','beepall','roundrobin','exports','STRING','name','INTEGER'];(function(_0x588186,_0x4de763){var _0xa0adff=function(_0x2fce62){while(--_0x2fce62){_0x588186['push'](_0x588186['shift']());}};_0xa0adff(++_0x4de763);}(_0x3299,0x1bc));var _0x9329=function(_0x3bbf2c,_0xa9a6bb){_0x3bbf2c=_0x3bbf2c-0x0;var _0x39be41=_0x3299[_0x3bbf2c];return _0x39be41;};'use strict';var Sequelize=require('sequelize');module[_0x9329('0x0')]={'name':{'type':Sequelize[_0x9329('0x1')],'unique':_0x9329('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x9329('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9329('0x4')](_0x9329('0x5'),_0x9329('0x6'),_0x9329('0x7'))},'description':{'type':Sequelize[_0x9329('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index c236456..2d0dc72 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 _0x224f=['omit','spread','removeAgents','isArray','getAgents','sort','util','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','then','destroy','get','WhatsappQueues','UserProfileResource','error','name','send','index','map','WhatsappQueue','type','key','include','show','params','model','rawAttributes','filters','intersection','attributes','fields','query','length','merge','options','find','catch','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','keys','UserWhatsappQueue','hasOwnProperty','nolimit','order','pick','where','filter','findAll','User','findAndCountAll','UserId','agent','whatsappPause','updatedAt','createdAt','format','%s/%s','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','sequelize','each','findOrCreate','emit','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','union','compact','value','transaction','isEmpty','forEach','userWhatsappQueue:remove','addAgents'];(function(_0x26eb18,_0x545bf7){var _0x10e4c5=function(_0x162e2d){while(--_0x162e2d){_0x26eb18['push'](_0x26eb18['shift']());}};_0x10e4c5(++_0x545bf7);}(_0x224f,0x180));var _0xf224=function(_0x5216e0,_0x4f8cb9){_0x5216e0=_0x5216e0-0x0;var _0x5b3f40=_0x224f[_0x5216e0];return _0x5b3f40;};'use strict';var BPromise=require('bluebird');var util=require(_0xf224('0x0'));var _=require(_0xf224('0x1'));var squel=require(_0xf224('0x2'));var Redis=require(_0xf224('0x3'));var qs=require(_0xf224('0x4'));var logger=require('../../config/logger')(_0xf224('0x5'));var config=require(_0xf224('0x6'));var db=require(_0xf224('0x7'))['db'];config['redis']=_[_0xf224('0x8')](config[_0xf224('0x9')],{'host':_0xf224('0xa'),'port':0x18eb});var socket=require(_0xf224('0xb'))(new Redis(config[_0xf224('0x9')]));require(_0xf224('0xc'))[_0xf224('0xd')](socket);function respondWithStatusCode(_0x4bf276,_0x51ee2b){_0x51ee2b=_0x51ee2b||0xcc;return function(_0x2de82a){if(_0x2de82a){return _0x4bf276[_0xf224('0xe')](_0x51ee2b);}return _0x4bf276[_0xf224('0xf')](_0x51ee2b)['end']();};}function respondWithResult(_0xcfab84,_0x237612){_0x237612=_0x237612||0xc8;return function(_0x2761d8){if(_0x2761d8){return _0xcfab84[_0xf224('0xf')](_0x237612)[_0xf224('0x10')](_0x2761d8);}};}function respondWithFilteredResult(_0x356584,_0x2ff069){return function(_0x54ebba){if(_0x54ebba){var _0x646f3a=typeof _0x2ff069['offset']===_0xf224('0x11')&&typeof _0x2ff069['limit']===_0xf224('0x11');var _0x51751f=_0x54ebba[_0xf224('0x12')];var _0xbfd8d3=_0x646f3a?0x0:_0x2ff069[_0xf224('0x13')];var _0x11e8e7=_0x646f3a?_0x54ebba[_0xf224('0x12')]:_0x2ff069[_0xf224('0x13')]+_0x2ff069[_0xf224('0x14')];var _0xe910d7;if(_0x11e8e7>=_0x51751f){_0x11e8e7=_0x51751f;_0xe910d7=0xc8;}else{_0xe910d7=0xce;}_0x356584[_0xf224('0xf')](_0xe910d7);return _0x356584[_0xf224('0x15')](_0xf224('0x16'),_0xbfd8d3+'-'+_0x11e8e7+'/'+_0x51751f)[_0xf224('0x10')](_0x54ebba);}return null;};}function saveUpdates(_0x3dfc1d){return function(_0x5da674){if(_0x5da674){return _0x5da674['update'](_0x3dfc1d)[_0xf224('0x17')](function(_0x588703){return _0x588703;});}return null;};}function removeEntity(_0x365916){return function(_0x4f19be){if(_0x4f19be){return _0x4f19be[_0xf224('0x18')]()[_0xf224('0x17')](function(){var _0x2cb6c5=_0x4f19be[_0xf224('0x19')]({'plain':!![]});var _0x29ccc3=_0xf224('0x1a');return db[_0xf224('0x1b')][_0xf224('0x18')]({'where':{'type':_0x29ccc3,'resourceId':_0x2cb6c5['id']}})['then'](function(){return _0x4f19be;});})[_0xf224('0x17')](function(){_0x365916[_0xf224('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x567327){return function(_0x54afa8){if(!_0x54afa8){_0x567327[_0xf224('0xe')](0x194);}return _0x54afa8;};}function handleError(_0x1303b3,_0x40a3b2){_0x40a3b2=_0x40a3b2||0x1f4;return function(_0x5ea026){logger[_0xf224('0x1c')](_0x5ea026['stack']);if(_0x5ea026[_0xf224('0x1d')]){delete _0x5ea026[_0xf224('0x1d')];}_0x1303b3['status'](_0x40a3b2)[_0xf224('0x1e')](_0x5ea026);};}exports[_0xf224('0x1f')]=function(_0x5b69ea,_0x4c04d6){var _0x48605a={};var _0x186854={'count':0x0,'rows':[]};var _0x427993=_[_0xf224('0x20')](db[_0xf224('0x21')]['rawAttributes'],function(_0x5172b3){return{'name':_0x5172b3['fieldName'],'type':_0x5172b3[_0xf224('0x22')][_0xf224('0x23')]};});_0x48605a=qs['getOptions'](_0x427993,_0x5b69ea);var _0x5ae94a={'where':_0x48605a['where']};return db[_0xf224('0x21')][_0xf224('0x12')](_0x5ae94a)[_0xf224('0x17')](function(_0x3aaca0){_0x186854[_0xf224('0x12')]=_0x3aaca0;_0x48605a[_0xf224('0x24')]=qs['include'](_0x5b69ea['query']);return db['WhatsappQueue']['findAll'](_0x48605a);})[_0xf224('0x17')](function(_0x2ead57){_0x186854['rows']=_0x2ead57;return _0x186854;})[_0xf224('0x17')](respondWithFilteredResult(_0x4c04d6,_0x48605a))['catch'](handleError(_0x4c04d6,null));};exports[_0xf224('0x25')]=function(_0x7f283e,_0x527200){var _0x5078f9={'raw':!![],'where':{'id':_0x7f283e[_0xf224('0x26')]['id']}},_0xbaf0e2={};_0xbaf0e2[_0xf224('0x27')]=_['keys'](db[_0xf224('0x21')][_0xf224('0x28')]);_0xbaf0e2['query']=_['keys'](_0x7f283e['query']);_0xbaf0e2[_0xf224('0x29')]=_[_0xf224('0x2a')](_0xbaf0e2[_0xf224('0x27')],_0xbaf0e2['query']);_0x5078f9[_0xf224('0x2b')]=_[_0xf224('0x2a')](_0xbaf0e2[_0xf224('0x27')],qs[_0xf224('0x2c')](_0x7f283e[_0xf224('0x2d')][_0xf224('0x2c')]));_0x5078f9[_0xf224('0x2b')]=_0x5078f9[_0xf224('0x2b')][_0xf224('0x2e')]?_0x5078f9[_0xf224('0x2b')]:_0xbaf0e2['model'];if(_0x7f283e[_0xf224('0x2d')]['includeAll']){_0x5078f9['include']=[{'all':!![]}];}_0x5078f9=_[_0xf224('0x2f')]({},_0x5078f9,_0x7f283e[_0xf224('0x30')]);return db[_0xf224('0x21')][_0xf224('0x31')](_0x5078f9)[_0xf224('0x17')](handleEntityNotFound(_0x527200,null))['then'](respondWithResult(_0x527200,null))[_0xf224('0x32')](handleError(_0x527200,null));};exports['create']=function(_0x3fdd6d,_0x667e30){return db[_0xf224('0x21')]['create'](_0x3fdd6d[_0xf224('0x33')],{})['then'](function(_0x18d335){var _0x153290=_0x3fdd6d[_0xf224('0x34')][_0xf224('0x19')]({'plain':!![]});if(!_0x153290)throw new Error(_0xf224('0x35'));if(_0x153290[_0xf224('0x36')]==='user'){var _0x3c37d5=_0x18d335[_0xf224('0x19')]({'plain':!![]});var _0x495d99='WhatsappQueues';return db[_0xf224('0x37')]['find']({'where':{'name':_0x495d99,'userProfileId':_0x153290[_0xf224('0x38')]},'raw':!![]})['then'](function(_0xc2ef6e){if(_0xc2ef6e&&_0xc2ef6e['autoAssociation']===0x0){return db['UserProfileResource'][_0xf224('0x39')]({'name':_0x3c37d5[_0xf224('0x1d')],'resourceId':_0x3c37d5['id'],'type':_0xc2ef6e[_0xf224('0x1d')],'sectionId':_0xc2ef6e['id']},{})[_0xf224('0x17')](function(){return _0x18d335;});}else{return _0x18d335;}})[_0xf224('0x32')](function(_0x270f46){logger[_0xf224('0x1c')](_0xf224('0x3a'),_0x270f46);throw _0x270f46;});}return _0x18d335;})['then'](respondWithResult(_0x667e30,0xc9))[_0xf224('0x32')](handleError(_0x667e30,null));};exports[_0xf224('0x3b')]=function(_0x3ba3aa,_0x28bf4e){if(_0x3ba3aa[_0xf224('0x33')]['id']){delete _0x3ba3aa[_0xf224('0x33')]['id'];}return db[_0xf224('0x21')][_0xf224('0x31')]({'where':{'id':_0x3ba3aa[_0xf224('0x26')]['id']}})[_0xf224('0x17')](handleEntityNotFound(_0x28bf4e,null))[_0xf224('0x17')](saveUpdates(_0x3ba3aa[_0xf224('0x33')],null))[_0xf224('0x17')](respondWithResult(_0x28bf4e,null))[_0xf224('0x32')](handleError(_0x28bf4e,null));};exports[_0xf224('0x18')]=function(_0xf24f3,_0x245c19){return db[_0xf224('0x21')][_0xf224('0x31')]({'where':{'id':_0xf24f3['params']['id']}})[_0xf224('0x17')](handleEntityNotFound(_0x245c19,null))[_0xf224('0x17')](removeEntity(_0x245c19,null))[_0xf224('0x32')](handleError(_0x245c19,null));};exports[_0xf224('0x3c')]=function(_0x5203fa,_0x1f0601){return db[_0xf224('0x21')]['describe']()[_0xf224('0x17')](respondWithResult(_0x1f0601,null))[_0xf224('0x32')](handleError(_0x1f0601,null));};exports[_0xf224('0x3d')]=function(_0x275495,_0x3c0f33){var _0x98b4a4={'raw':!![],'where':{}},_0x457fcb={},_0x595e4a;return db[_0xf224('0x21')][_0xf224('0x3e')]({'where':{'id':_0x275495['params']['id']}})[_0xf224('0x17')](handleEntityNotFound(_0x3c0f33,null))['then'](function(_0x239105){if(_0x239105){_0x595e4a=_0x239105[_0xf224('0x19')]({'plain':!![]});_0x457fcb[_0xf224('0x27')]=_[_0xf224('0x3f')](db[_0xf224('0x40')][_0xf224('0x28')]);_0x457fcb[_0xf224('0x2d')]=_[_0xf224('0x3f')](_0x275495['query']);_0x457fcb[_0xf224('0x29')]=_[_0xf224('0x2a')](_0x457fcb[_0xf224('0x27')],_0x457fcb['query']);_0x98b4a4[_0xf224('0x2b')]=_[_0xf224('0x2a')](_0x457fcb[_0xf224('0x27')],qs[_0xf224('0x2c')](_0x275495[_0xf224('0x2d')][_0xf224('0x2c')]));_0x98b4a4[_0xf224('0x2b')]=_0x98b4a4[_0xf224('0x2b')]['length']?_0x98b4a4['attributes']:_0x457fcb[_0xf224('0x27')];if(!_0x275495['query'][_0xf224('0x41')](_0xf224('0x42'))){_0x98b4a4[_0xf224('0x14')]=qs[_0xf224('0x14')](_0x275495[_0xf224('0x2d')][_0xf224('0x14')]);_0x98b4a4['offset']=qs[_0xf224('0x13')](_0x275495['query'][_0xf224('0x13')]);}_0x98b4a4[_0xf224('0x43')]=qs['sort'](_0x275495['query']['sort']);_0x98b4a4['where']=qs[_0xf224('0x29')](_[_0xf224('0x44')](_0x275495['query'],_0x457fcb['filters']));_0x98b4a4[_0xf224('0x45')]['WhatsappQueueId']=_0x239105['id'];if(_0x275495[_0xf224('0x2d')][_0xf224('0x46')]){_0x98b4a4[_0xf224('0x45')]=_[_0xf224('0x2f')](_0x98b4a4[_0xf224('0x45')],{'$or':_[_0xf224('0x20')](_0x98b4a4['attributes'],function(_0x2061e6){var _0xcfcd26={};_0xcfcd26[_0x2061e6]={'$like':'%'+_0x275495[_0xf224('0x2d')][_0xf224('0x46')]+'%'};return _0xcfcd26;})});}_0x98b4a4=_[_0xf224('0x2f')]({},_0x98b4a4,_0x275495['options']);return db[_0xf224('0x40')][_0xf224('0x47')](_0x98b4a4);}})['then'](function(_0x4b863d){if(_0x4b863d){return db[_0xf224('0x48')][_0xf224('0x49')]({'where':{'id':_[_0xf224('0x20')](_0x4b863d,_0xf224('0x4a')),'role':_0xf224('0x4b')},'attributes':['id',_0xf224('0x1d'),_0xf224('0x4c'),_0xf224('0x4d'),_0xf224('0x4e')]});}})['then'](function(_0x7723d1){if(_0x7723d1){return{'count':_0x7723d1[_0xf224('0x12')],'rows':_['map'](_0x7723d1['rows'],function(_0x4b9895){return{'membername':_0x4b9895[_0xf224('0x1d')],'UserId':_0x4b9895['id'],'queue_name':_0x595e4a[_0xf224('0x1d')],'WhatsappQueueId':_0x595e4a['id'],'interface':util[_0xf224('0x4f')](_0xf224('0x50'),'SIP',_0x4b9895[_0xf224('0x1d')]),'penalty':0x0,'paused':_0x4b9895['whatsappPause'],'createdAt':_0x4b9895[_0xf224('0x4e')],'updatedAt':_0x4b9895[_0xf224('0x4d')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x3c0f33,_0x98b4a4))[_0xf224('0x32')](handleError(_0x3c0f33,null));};exports[_0xf224('0x51')]=function(_0x1ef165,_0x5d010b){var _0x420cbc={};var _0x15f122={};var _0x47c4de;var _0x19fd1b;return db['WhatsappQueue']['findOne']({'where':{'id':_0x1ef165[_0xf224('0x26')]['id']}})['then'](handleEntityNotFound(_0x5d010b,null))['then'](function(_0x1c4185){if(_0x1c4185){_0x47c4de=_0x1c4185;_0x15f122[_0xf224('0x27')]=_[_0xf224('0x3f')](db[_0xf224('0x52')][_0xf224('0x28')]);_0x15f122['query']=_[_0xf224('0x3f')](_0x1ef165[_0xf224('0x2d')]);_0x15f122['filters']=_['intersection'](_0x15f122[_0xf224('0x27')],_0x15f122['query']);_0x420cbc[_0xf224('0x2b')]=_['intersection'](_0x15f122[_0xf224('0x27')],qs[_0xf224('0x2c')](_0x1ef165[_0xf224('0x2d')][_0xf224('0x2c')]));_0x420cbc['attributes']=_0x420cbc[_0xf224('0x2b')]['length']?_0x420cbc[_0xf224('0x2b')]:_0x15f122[_0xf224('0x27')];_0x420cbc['order']=qs['sort'](_0x1ef165['query']['sort']);_0x420cbc[_0xf224('0x45')]=qs[_0xf224('0x29')](_[_0xf224('0x44')](_0x1ef165[_0xf224('0x2d')],_0x15f122[_0xf224('0x29')]));if(_0x1ef165['query']['filter']){_0x420cbc['where']=_[_0xf224('0x2f')](_0x420cbc[_0xf224('0x45')],{'$or':_[_0xf224('0x20')](_0x420cbc[_0xf224('0x2b')],function(_0x1b198f){var _0x2b7e43={};_0x2b7e43[_0x1b198f]={'$like':'%'+_0x1ef165[_0xf224('0x2d')][_0xf224('0x46')]+'%'};return _0x2b7e43;})});}_0x420cbc=_[_0xf224('0x2f')]({},_0x420cbc,_0x1ef165[_0xf224('0x30')]);return _0x47c4de[_0xf224('0x51')](_0x420cbc);}})['then'](function(_0x2c85be){if(_0x2c85be){_0x19fd1b=_0x2c85be[_0xf224('0x2e')];if(!_0x1ef165[_0xf224('0x2d')][_0xf224('0x41')](_0xf224('0x42'))){_0x420cbc[_0xf224('0x14')]=qs[_0xf224('0x14')](_0x1ef165['query'][_0xf224('0x14')]);_0x420cbc[_0xf224('0x13')]=qs[_0xf224('0x13')](_0x1ef165[_0xf224('0x2d')][_0xf224('0x13')]);}return _0x47c4de[_0xf224('0x51')](_0x420cbc);}})[_0xf224('0x17')](function(_0x2465a8){if(_0x2465a8){return _0x2465a8?{'count':_0x19fd1b,'rows':_0x2465a8}:null;}})[_0xf224('0x17')](respondWithResult(_0x5d010b,null))[_0xf224('0x32')](handleError(_0x5d010b,null));};exports[_0xf224('0x53')]=function(_0x5853d8,_0xe52090){var _0x5248ee=_0x5853d8[_0xf224('0x33')][_0xf224('0x54')];return db[_0xf224('0x52')][_0xf224('0x47')]({'where':{'id':_0x5248ee},'attributes':['id'],'include':[{'model':db[_0xf224('0x48')],'as':_0xf224('0x55'),'attributes':['id','name',_0xf224('0x56'),_0xf224('0x57'),_0xf224('0x58')],'raw':!![]}]})[_0xf224('0x17')](function(_0x1ddbb4){if(_0x1ddbb4){var _0x25b402=_['flatMap'](_0x1ddbb4,function(_0x2bfe15){var _0x347281=_0x2bfe15['get']({'plain':!![]});return _0x347281['Agents'];});return db[_0xf224('0x21')]['find']({'where':{'id':_0x5853d8[_0xf224('0x26')]['id']}})[_0xf224('0x17')](function(_0x508387){return db[_0xf224('0x59')]['transaction'](function(_0x19e0f5){return _0x508387[_0xf224('0x53')](_0x5248ee,{'transaction':_0x19e0f5})[_0xf224('0x17')](function(){return BPromise[_0xf224('0x5a')](_0x25b402,function(_0x4fece1){return db[_0xf224('0x40')][_0xf224('0x5b')]({'where':{'UserId':_0x4fece1['id'],'WhatsappQueueId':_0x5853d8[_0xf224('0x26')]['id']},'transaction':_0x19e0f5});});})[_0xf224('0x17')](function(){_0x25b402['forEach'](function(_0x4106ce){socket[_0xf224('0x5c')](_0xf224('0x5d'),{'UserId':_0x4106ce['id'],'WhatsappQueueId':_0x508387['id']});});});});});}})[_0xf224('0x17')](respondWithStatusCode(_0xe52090,null))['catch'](handleError(_0xe52090,null));};exports[_0xf224('0x5e')]=function(_0x4b31e7,_0x415f8f){return db[_0xf224('0x52')][_0xf224('0x47')]({'where':{'id':_0x4b31e7[_0xf224('0x2d')][_0xf224('0x54')]},'attributes':['id'],'include':[{'model':db[_0xf224('0x48')],'as':_0xf224('0x55'),'attributes':['id'],'raw':!![]}]})[_0xf224('0x17')](handleEntityNotFound(_0x415f8f,null))[_0xf224('0x17')](function(_0x265317){var _0xc8c41a=_[_0xf224('0x20')](_0x265317,'id');var _0x5b7cab=[];var _0x4bed90=[];var _0x223506=squel[_0xf224('0x5f')]();_0x223506[_0xf224('0x60')](_0xf224('0x61'))[_0xf224('0x62')](_0xf224('0x63'),'tq')[_0xf224('0x64')]('user_has_teams','ut',_0xf224('0x65'))[_0xf224('0x45')](_0xf224('0x66'),_0x4b31e7[_0xf224('0x26')]['id']);for(var _0x167bcd=0x0;_0x167bcd<_0x265317[_0xf224('0x2e')];_0x167bcd+=0x1){let _0x3dfd45=_0x265317[_0x167bcd];for(var _0x2ba4ef=0x0;_0x2ba4ef<_0x3dfd45[_0xf224('0x55')][_0xf224('0x2e')];_0x2ba4ef+=0x1){let _0x5aefa5=_0x3dfd45[_0xf224('0x55')][_0x2ba4ef];var _0x1aab21=_0x223506[_0xf224('0x67')]();_0x1aab21['where'](_0xf224('0x68'),_0x5aefa5['id']);_0x4bed90[_0xf224('0x69')](db['sequelize'][_0xf224('0x2d')](_0x1aab21[_0xf224('0x6a')](),{'type':db[_0xf224('0x59')][_0xf224('0x6b')][_0xf224('0x6c')]})[_0xf224('0x17')](function(_0x44c931){if(_0x44c931[_0xf224('0x2e')]===0x1){return _0x5aefa5['id'];}else{var _0x2394a4=_[_0xf224('0x6d')](_[_0xf224('0x20')](_0x44c931,_0xf224('0x6e')),function(_0x296c45){return _[_0xf224('0x6f')](_0xc8c41a,_0x296c45);});if(_0x2394a4){return _0x5aefa5['id'];}}}));}}return BPromise['all'](_0x4bed90)[_0xf224('0x17')](function(_0x1f07d4){_0x5b7cab=_(_0x5b7cab)[_0xf224('0x70')](_0x1f07d4)[_0xf224('0x71')]()[_0xf224('0x72')]();return db[_0xf224('0x21')][_0xf224('0x31')]({'where':{'id':_0x4b31e7[_0xf224('0x26')]['id']}})[_0xf224('0x17')](function(_0x5382d6){return db[_0xf224('0x59')][_0xf224('0x73')](function(_0x1ff74e){return _0x5382d6[_0xf224('0x5e')](_0x4b31e7[_0xf224('0x2d')][_0xf224('0x54')],{'transaction':_0x1ff74e})['then'](function(){if(!_[_0xf224('0x74')](_0x5b7cab)){return _0x5382d6['removeAgents'](_0x5b7cab,{'transaction':_0x1ff74e});}})[_0xf224('0x17')](function(){_0x5b7cab[_0xf224('0x75')](function(_0x3026e7){socket[_0xf224('0x5c')](_0xf224('0x76'),{'UserId':_0x3026e7,'WhatsappQueueId':_0x5382d6['id']});});});});});});})[_0xf224('0x17')](respondWithStatusCode(_0x415f8f,null))['catch'](handleError(_0x415f8f,null));};exports[_0xf224('0x77')]=function(_0x54a3ad,_0x1b512e){return db['WhatsappQueue']['find']({'where':{'id':_0x54a3ad[_0xf224('0x26')]['id']}})[_0xf224('0x17')](handleEntityNotFound(_0x1b512e,null))[_0xf224('0x17')](function(_0x20f8b4){if(_0x20f8b4){return _0x20f8b4[_0xf224('0x77')](_0x54a3ad[_0xf224('0x33')][_0xf224('0x54')],_[_0xf224('0x78')](_0x54a3ad['body'],['ids','id'])||{})[_0xf224('0x79')](function(_0x28854f){for(var _0x35c1f6=0x0;_0x35c1f6<_0x54a3ad[_0xf224('0x33')]['ids'][_0xf224('0x2e')];_0x35c1f6+=0x1){socket[_0xf224('0x5c')](_0xf224('0x5d'),{'UserId':Number(_0x54a3ad['body'][_0xf224('0x54')][_0x35c1f6]),'WhatsappQueueId':Number(_0x54a3ad[_0xf224('0x26')]['id'])});}return _0x28854f;});}})[_0xf224('0x17')](respondWithResult(_0x1b512e,null))[_0xf224('0x32')](handleError(_0x1b512e,null));};exports[_0xf224('0x7a')]=function(_0xe49d8b,_0x5edab7){return db['WhatsappQueue']['find']({'where':{'id':_0xe49d8b[_0xf224('0x26')]['id']}})[_0xf224('0x17')](handleEntityNotFound(_0x5edab7,null))[_0xf224('0x17')](function(_0x4d9693){if(_0x4d9693){return _0x4d9693[_0xf224('0x7a')](_0xe49d8b[_0xf224('0x2d')][_0xf224('0x54')])['then'](function(){if(_[_0xf224('0x7b')](_0xe49d8b['query'][_0xf224('0x54')])){for(var _0x5db567=0x0;_0x5db567<_0xe49d8b['query'][_0xf224('0x54')][_0xf224('0x2e')];_0x5db567+=0x1){socket['emit'](_0xf224('0x76'),{'UserId':Number(_0xe49d8b[_0xf224('0x2d')][_0xf224('0x54')][_0x5db567]),'WhatsappQueueId':Number(_0xe49d8b['params']['id'])});}}else{socket['emit']('userWhatsappQueue:remove',{'UserId':Number(_0xe49d8b[_0xf224('0x2d')][_0xf224('0x54')]),'WhatsappQueueId':Number(_0xe49d8b[_0xf224('0x26')]['id'])});}});}})[_0xf224('0x17')](respondWithStatusCode(_0x5edab7,null))[_0xf224('0x32')](handleError(_0x5edab7,null));};exports[_0xf224('0x7c')]=function(_0x4974bc,_0x2aaf5a){var _0xca3ab0={};var _0x34417d={};var _0xaab838;var _0x78f720;return db[_0xf224('0x21')]['findOne']({'where':{'id':_0x4974bc['params']['id']}})[_0xf224('0x17')](handleEntityNotFound(_0x2aaf5a,null))['then'](function(_0x33ee51){if(_0x33ee51){_0xaab838=_0x33ee51;_0x34417d[_0xf224('0x27')]=_[_0xf224('0x3f')](db['User']['rawAttributes']);_0x34417d[_0xf224('0x2d')]=_[_0xf224('0x3f')](_0x4974bc[_0xf224('0x2d')]);_0x34417d[_0xf224('0x29')]=_[_0xf224('0x2a')](_0x34417d['model'],_0x34417d['query']);_0xca3ab0['attributes']=_[_0xf224('0x2a')](_0x34417d['model'],qs[_0xf224('0x2c')](_0x4974bc[_0xf224('0x2d')][_0xf224('0x2c')]));_0xca3ab0[_0xf224('0x2b')]=_0xca3ab0[_0xf224('0x2b')]['length']?_0xca3ab0[_0xf224('0x2b')]:_0x34417d[_0xf224('0x27')];_0xca3ab0['order']=qs[_0xf224('0x7d')](_0x4974bc[_0xf224('0x2d')][_0xf224('0x7d')]);_0xca3ab0[_0xf224('0x45')]=qs['filters'](_['pick'](_0x4974bc[_0xf224('0x2d')],_0x34417d['filters']));if(_0x4974bc['query']['filter']){_0xca3ab0[_0xf224('0x45')]=_['merge'](_0xca3ab0[_0xf224('0x45')],{'$or':_[_0xf224('0x20')](_0xca3ab0['attributes'],function(_0x8c8d29){var _0x57dedf={};_0x57dedf[_0x8c8d29]={'$like':'%'+_0x4974bc[_0xf224('0x2d')][_0xf224('0x46')]+'%'};return _0x57dedf;})});}_0xca3ab0=_[_0xf224('0x2f')]({},_0xca3ab0,_0x4974bc[_0xf224('0x30')]);return _0xaab838[_0xf224('0x7c')](_0xca3ab0);}})[_0xf224('0x17')](function(_0x4b0b07){if(_0x4b0b07){_0x78f720=_0x4b0b07['length'];if(!_0x4974bc[_0xf224('0x2d')]['hasOwnProperty'](_0xf224('0x42'))){_0xca3ab0[_0xf224('0x14')]=qs[_0xf224('0x14')](_0x4974bc['query'][_0xf224('0x14')]);_0xca3ab0['offset']=qs[_0xf224('0x13')](_0x4974bc[_0xf224('0x2d')]['offset']);}return _0xaab838[_0xf224('0x7c')](_0xca3ab0);}})[_0xf224('0x17')](function(_0x4d20df){if(_0x4d20df){return _0x4d20df?{'count':_0x78f720,'rows':_0x4d20df}:null;}})[_0xf224('0x17')](respondWithResult(_0x2aaf5a,null))[_0xf224('0x32')](handleError(_0x2aaf5a,null));}; \ No newline at end of file +var _0xad4c=['redis','defaults','socket.io-emitter','register','sendStatus','status','json','offset','limit','set','Content-Range','then','destroy','UserProfileResource','end','error','name','send','index','rawAttributes','fieldName','type','key','getOptions','where','count','include','WhatsappQueue','findAll','show','keys','query','filters','intersection','model','attributes','fields','length','includeAll','merge','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','WhatsappQueues','UserProfileSection','userProfileId','autoAssociation','catch','update','params','describe','getMembers','UserWhatsappQueue','hasOwnProperty','nolimit','order','sort','filter','options','findAndCountAll','map','UserId','agent','updatedAt','createdAt','rows','format','%s/%s','whatsappPause','findOne','Team','pick','getTeams','ids','User','Agents','online','sequelize','transaction','each','findOrCreate','userWhatsappQueue:save','removeTeams','select','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','QueryTypes','SELECT','TeamId','all','union','compact','isEmpty','forEach','emit','userWhatsappQueue:remove','addAgents','omit','removeAgents','isArray','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb'];(function(_0x20494e,_0x274e71){var _0x28f4ae=function(_0x357f33){while(--_0x357f33){_0x20494e['push'](_0x20494e['shift']());}};_0x28f4ae(++_0x274e71);}(_0xad4c,0x15f));var _0xcad4=function(_0x47e8b4,_0x29cb6d){_0x47e8b4=_0x47e8b4-0x0;var _0x87a99f=_0xad4c[_0x47e8b4];return _0x87a99f;};'use strict';var BPromise=require(_0xcad4('0x0'));var util=require(_0xcad4('0x1'));var _=require(_0xcad4('0x2'));var squel=require(_0xcad4('0x3'));var Redis=require(_0xcad4('0x4'));var qs=require(_0xcad4('0x5'));var logger=require(_0xcad4('0x6'))(_0xcad4('0x7'));var config=require('../../config/environment');var db=require(_0xcad4('0x8'))['db'];config[_0xcad4('0x9')]=_[_0xcad4('0xa')](config[_0xcad4('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xcad4('0xb'))(new Redis(config[_0xcad4('0x9')]));require('./whatsappQueue.socket')[_0xcad4('0xc')](socket);function respondWithStatusCode(_0x44c319,_0x2e10bd){_0x2e10bd=_0x2e10bd||0xcc;return function(_0x2ae015){if(_0x2ae015){return _0x44c319[_0xcad4('0xd')](_0x2e10bd);}return _0x44c319[_0xcad4('0xe')](_0x2e10bd)['end']();};}function respondWithResult(_0x479c5f,_0x14220e){_0x14220e=_0x14220e||0xc8;return function(_0x231eb2){if(_0x231eb2){return _0x479c5f['status'](_0x14220e)[_0xcad4('0xf')](_0x231eb2);}};}function respondWithFilteredResult(_0x337956,_0x47941b){return function(_0x713edc){if(_0x713edc){var _0x4df6a8=typeof _0x47941b[_0xcad4('0x10')]==='undefined'&&typeof _0x47941b['limit']==='undefined';var _0x31d91a=_0x713edc['count'];var _0xcfa937=_0x4df6a8?0x0:_0x47941b['offset'];var _0x2f4c50=_0x4df6a8?_0x713edc['count']:_0x47941b[_0xcad4('0x10')]+_0x47941b[_0xcad4('0x11')];var _0x5ec4f4;if(_0x2f4c50>=_0x31d91a){_0x2f4c50=_0x31d91a;_0x5ec4f4=0xc8;}else{_0x5ec4f4=0xce;}_0x337956[_0xcad4('0xe')](_0x5ec4f4);return _0x337956[_0xcad4('0x12')](_0xcad4('0x13'),_0xcfa937+'-'+_0x2f4c50+'/'+_0x31d91a)['json'](_0x713edc);}return null;};}function saveUpdates(_0x2116de){return function(_0x50783b){if(_0x50783b){return _0x50783b['update'](_0x2116de)[_0xcad4('0x14')](function(_0x18609d){return _0x18609d;});}return null;};}function removeEntity(_0x4f4f2e){return function(_0xe294ca){if(_0xe294ca){return _0xe294ca[_0xcad4('0x15')]()[_0xcad4('0x14')](function(){var _0x5246e0=_0xe294ca['get']({'plain':!![]});var _0x112c1f='WhatsappQueues';return db[_0xcad4('0x16')][_0xcad4('0x15')]({'where':{'type':_0x112c1f,'resourceId':_0x5246e0['id']}})['then'](function(){return _0xe294ca;});})['then'](function(){_0x4f4f2e[_0xcad4('0xe')](0xcc)[_0xcad4('0x17')]();});}};}function handleEntityNotFound(_0x1d6cda){return function(_0x39b455){if(!_0x39b455){_0x1d6cda[_0xcad4('0xd')](0x194);}return _0x39b455;};}function handleError(_0x126e74,_0x388c93){_0x388c93=_0x388c93||0x1f4;return function(_0xc9c85e){logger[_0xcad4('0x18')](_0xc9c85e['stack']);if(_0xc9c85e[_0xcad4('0x19')]){delete _0xc9c85e['name'];}_0x126e74[_0xcad4('0xe')](_0x388c93)[_0xcad4('0x1a')](_0xc9c85e);};}exports[_0xcad4('0x1b')]=function(_0x11f9bc,_0x3872eb){var _0x2ad512={};var _0x3ed465={'count':0x0,'rows':[]};var _0x39a3a0=_['map'](db['WhatsappQueue'][_0xcad4('0x1c')],function(_0x50653e){return{'name':_0x50653e[_0xcad4('0x1d')],'type':_0x50653e[_0xcad4('0x1e')][_0xcad4('0x1f')]};});_0x2ad512=qs[_0xcad4('0x20')](_0x39a3a0,_0x11f9bc);var _0x45bc47={'where':_0x2ad512[_0xcad4('0x21')]};return db['WhatsappQueue'][_0xcad4('0x22')](_0x45bc47)[_0xcad4('0x14')](function(_0x5a0eef){_0x3ed465[_0xcad4('0x22')]=_0x5a0eef;_0x2ad512[_0xcad4('0x23')]=qs[_0xcad4('0x23')](_0x11f9bc['query']);return db[_0xcad4('0x24')][_0xcad4('0x25')](_0x2ad512);})[_0xcad4('0x14')](function(_0xf54775){_0x3ed465['rows']=_0xf54775;return _0x3ed465;})[_0xcad4('0x14')](respondWithFilteredResult(_0x3872eb,_0x2ad512))['catch'](handleError(_0x3872eb,null));};exports[_0xcad4('0x26')]=function(_0x16767c,_0x5ac4e0){var _0x13d4a3={'raw':!![],'where':{'id':_0x16767c['params']['id']}},_0x7c0e6e={};_0x7c0e6e['model']=_[_0xcad4('0x27')](db['WhatsappQueue'][_0xcad4('0x1c')]);_0x7c0e6e[_0xcad4('0x28')]=_[_0xcad4('0x27')](_0x16767c[_0xcad4('0x28')]);_0x7c0e6e[_0xcad4('0x29')]=_[_0xcad4('0x2a')](_0x7c0e6e[_0xcad4('0x2b')],_0x7c0e6e[_0xcad4('0x28')]);_0x13d4a3[_0xcad4('0x2c')]=_[_0xcad4('0x2a')](_0x7c0e6e[_0xcad4('0x2b')],qs['fields'](_0x16767c['query'][_0xcad4('0x2d')]));_0x13d4a3[_0xcad4('0x2c')]=_0x13d4a3[_0xcad4('0x2c')][_0xcad4('0x2e')]?_0x13d4a3[_0xcad4('0x2c')]:_0x7c0e6e[_0xcad4('0x2b')];if(_0x16767c[_0xcad4('0x28')][_0xcad4('0x2f')]){_0x13d4a3[_0xcad4('0x23')]=[{'all':!![]}];}_0x13d4a3=_[_0xcad4('0x30')]({},_0x13d4a3,_0x16767c['options']);return db[_0xcad4('0x24')][_0xcad4('0x31')](_0x13d4a3)['then'](handleEntityNotFound(_0x5ac4e0,null))[_0xcad4('0x14')](respondWithResult(_0x5ac4e0,null))['catch'](handleError(_0x5ac4e0,null));};exports[_0xcad4('0x32')]=function(_0x21454c,_0x1b063e){return db['WhatsappQueue'][_0xcad4('0x32')](_0x21454c[_0xcad4('0x33')],{})[_0xcad4('0x14')](function(_0x57eacf){var _0x20514d=_0x21454c[_0xcad4('0x34')][_0xcad4('0x35')]({'plain':!![]});if(!_0x20514d)throw new Error(_0xcad4('0x36'));if(_0x20514d[_0xcad4('0x37')]===_0xcad4('0x34')){var _0x1bdb62=_0x57eacf[_0xcad4('0x35')]({'plain':!![]});var _0x1b4db9=_0xcad4('0x38');return db[_0xcad4('0x39')][_0xcad4('0x31')]({'where':{'name':_0x1b4db9,'userProfileId':_0x20514d[_0xcad4('0x3a')]},'raw':!![]})[_0xcad4('0x14')](function(_0x32fefc){if(_0x32fefc&&_0x32fefc[_0xcad4('0x3b')]===0x0){return db[_0xcad4('0x16')]['create']({'name':_0x1bdb62[_0xcad4('0x19')],'resourceId':_0x1bdb62['id'],'type':_0x32fefc[_0xcad4('0x19')],'sectionId':_0x32fefc['id']},{})[_0xcad4('0x14')](function(){return _0x57eacf;});}else{return _0x57eacf;}})[_0xcad4('0x3c')](function(_0x317c01){logger[_0xcad4('0x18')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x317c01);throw _0x317c01;});}return _0x57eacf;})[_0xcad4('0x14')](respondWithResult(_0x1b063e,0xc9))['catch'](handleError(_0x1b063e,null));};exports[_0xcad4('0x3d')]=function(_0x1e6540,_0x293e31){if(_0x1e6540['body']['id']){delete _0x1e6540[_0xcad4('0x33')]['id'];}return db['WhatsappQueue']['find']({'where':{'id':_0x1e6540[_0xcad4('0x3e')]['id']}})[_0xcad4('0x14')](handleEntityNotFound(_0x293e31,null))[_0xcad4('0x14')](saveUpdates(_0x1e6540[_0xcad4('0x33')],null))[_0xcad4('0x14')](respondWithResult(_0x293e31,null))[_0xcad4('0x3c')](handleError(_0x293e31,null));};exports['destroy']=function(_0x5b2978,_0x2015b8){return db[_0xcad4('0x24')][_0xcad4('0x31')]({'where':{'id':_0x5b2978['params']['id']}})[_0xcad4('0x14')](handleEntityNotFound(_0x2015b8,null))['then'](removeEntity(_0x2015b8,null))[_0xcad4('0x3c')](handleError(_0x2015b8,null));};exports[_0xcad4('0x3f')]=function(_0x329ae2,_0xd7616d){return db['WhatsappQueue'][_0xcad4('0x3f')]()[_0xcad4('0x14')](respondWithResult(_0xd7616d,null))[_0xcad4('0x3c')](handleError(_0xd7616d,null));};exports[_0xcad4('0x40')]=function(_0x4f4a1f,_0x51a98d){var _0x18c2d8={'raw':!![],'where':{}},_0x41efc3={},_0x25d9ff;return db[_0xcad4('0x24')]['findOne']({'where':{'id':_0x4f4a1f[_0xcad4('0x3e')]['id']}})['then'](handleEntityNotFound(_0x51a98d,null))[_0xcad4('0x14')](function(_0x5e8759){if(_0x5e8759){_0x25d9ff=_0x5e8759[_0xcad4('0x35')]({'plain':!![]});_0x41efc3[_0xcad4('0x2b')]=_[_0xcad4('0x27')](db[_0xcad4('0x41')]['rawAttributes']);_0x41efc3[_0xcad4('0x28')]=_['keys'](_0x4f4a1f['query']);_0x41efc3[_0xcad4('0x29')]=_[_0xcad4('0x2a')](_0x41efc3[_0xcad4('0x2b')],_0x41efc3[_0xcad4('0x28')]);_0x18c2d8[_0xcad4('0x2c')]=_[_0xcad4('0x2a')](_0x41efc3[_0xcad4('0x2b')],qs[_0xcad4('0x2d')](_0x4f4a1f[_0xcad4('0x28')]['fields']));_0x18c2d8[_0xcad4('0x2c')]=_0x18c2d8['attributes'][_0xcad4('0x2e')]?_0x18c2d8[_0xcad4('0x2c')]:_0x41efc3['model'];if(!_0x4f4a1f[_0xcad4('0x28')][_0xcad4('0x42')](_0xcad4('0x43'))){_0x18c2d8[_0xcad4('0x11')]=qs['limit'](_0x4f4a1f[_0xcad4('0x28')][_0xcad4('0x11')]);_0x18c2d8[_0xcad4('0x10')]=qs[_0xcad4('0x10')](_0x4f4a1f[_0xcad4('0x28')][_0xcad4('0x10')]);}_0x18c2d8[_0xcad4('0x44')]=qs[_0xcad4('0x45')](_0x4f4a1f[_0xcad4('0x28')][_0xcad4('0x45')]);_0x18c2d8[_0xcad4('0x21')]=qs[_0xcad4('0x29')](_['pick'](_0x4f4a1f[_0xcad4('0x28')],_0x41efc3[_0xcad4('0x29')]));_0x18c2d8[_0xcad4('0x21')]['WhatsappQueueId']=_0x5e8759['id'];if(_0x4f4a1f[_0xcad4('0x28')][_0xcad4('0x46')]){_0x18c2d8['where']=_[_0xcad4('0x30')](_0x18c2d8[_0xcad4('0x21')],{'$or':_['map'](_0x18c2d8[_0xcad4('0x2c')],function(_0x4ee33f){var _0x2e98db={};_0x2e98db[_0x4ee33f]={'$like':'%'+_0x4f4a1f[_0xcad4('0x28')][_0xcad4('0x46')]+'%'};return _0x2e98db;})});}_0x18c2d8=_[_0xcad4('0x30')]({},_0x18c2d8,_0x4f4a1f[_0xcad4('0x47')]);return db[_0xcad4('0x41')][_0xcad4('0x25')](_0x18c2d8);}})[_0xcad4('0x14')](function(_0x4c07cd){if(_0x4c07cd){return db['User'][_0xcad4('0x48')]({'where':{'id':_[_0xcad4('0x49')](_0x4c07cd,_0xcad4('0x4a')),'role':_0xcad4('0x4b')},'attributes':['id','name','whatsappPause',_0xcad4('0x4c'),_0xcad4('0x4d')]});}})[_0xcad4('0x14')](function(_0x1fc244){if(_0x1fc244){return{'count':_0x1fc244['count'],'rows':_[_0xcad4('0x49')](_0x1fc244[_0xcad4('0x4e')],function(_0xb5dd50){return{'membername':_0xb5dd50[_0xcad4('0x19')],'UserId':_0xb5dd50['id'],'queue_name':_0x25d9ff[_0xcad4('0x19')],'WhatsappQueueId':_0x25d9ff['id'],'interface':util[_0xcad4('0x4f')](_0xcad4('0x50'),'SIP',_0xb5dd50['name']),'penalty':0x0,'paused':_0xb5dd50[_0xcad4('0x51')],'createdAt':_0xb5dd50['createdAt'],'updatedAt':_0xb5dd50[_0xcad4('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xcad4('0x14')](respondWithFilteredResult(_0x51a98d,_0x18c2d8))['catch'](handleError(_0x51a98d,null));};exports['getTeams']=function(_0x11c884,_0x371345){var _0x3e7b9d={};var _0x5e79cf={};var _0x2345d9;var _0x2d9e91;return db[_0xcad4('0x24')][_0xcad4('0x52')]({'where':{'id':_0x11c884['params']['id']}})['then'](handleEntityNotFound(_0x371345,null))['then'](function(_0x53a2bd){if(_0x53a2bd){_0x2345d9=_0x53a2bd;_0x5e79cf[_0xcad4('0x2b')]=_[_0xcad4('0x27')](db[_0xcad4('0x53')][_0xcad4('0x1c')]);_0x5e79cf[_0xcad4('0x28')]=_['keys'](_0x11c884[_0xcad4('0x28')]);_0x5e79cf['filters']=_[_0xcad4('0x2a')](_0x5e79cf[_0xcad4('0x2b')],_0x5e79cf['query']);_0x3e7b9d[_0xcad4('0x2c')]=_[_0xcad4('0x2a')](_0x5e79cf[_0xcad4('0x2b')],qs[_0xcad4('0x2d')](_0x11c884['query'][_0xcad4('0x2d')]));_0x3e7b9d['attributes']=_0x3e7b9d[_0xcad4('0x2c')]['length']?_0x3e7b9d[_0xcad4('0x2c')]:_0x5e79cf[_0xcad4('0x2b')];_0x3e7b9d['order']=qs[_0xcad4('0x45')](_0x11c884[_0xcad4('0x28')][_0xcad4('0x45')]);_0x3e7b9d[_0xcad4('0x21')]=qs[_0xcad4('0x29')](_[_0xcad4('0x54')](_0x11c884[_0xcad4('0x28')],_0x5e79cf[_0xcad4('0x29')]));if(_0x11c884[_0xcad4('0x28')][_0xcad4('0x46')]){_0x3e7b9d[_0xcad4('0x21')]=_[_0xcad4('0x30')](_0x3e7b9d[_0xcad4('0x21')],{'$or':_[_0xcad4('0x49')](_0x3e7b9d[_0xcad4('0x2c')],function(_0x567b36){var _0x243183={};_0x243183[_0x567b36]={'$like':'%'+_0x11c884[_0xcad4('0x28')][_0xcad4('0x46')]+'%'};return _0x243183;})});}_0x3e7b9d=_[_0xcad4('0x30')]({},_0x3e7b9d,_0x11c884['options']);return _0x2345d9[_0xcad4('0x55')](_0x3e7b9d);}})[_0xcad4('0x14')](function(_0x56e69d){if(_0x56e69d){_0x2d9e91=_0x56e69d[_0xcad4('0x2e')];if(!_0x11c884[_0xcad4('0x28')][_0xcad4('0x42')]('nolimit')){_0x3e7b9d[_0xcad4('0x11')]=qs['limit'](_0x11c884[_0xcad4('0x28')]['limit']);_0x3e7b9d[_0xcad4('0x10')]=qs[_0xcad4('0x10')](_0x11c884[_0xcad4('0x28')]['offset']);}return _0x2345d9[_0xcad4('0x55')](_0x3e7b9d);}})[_0xcad4('0x14')](function(_0x5912a9){if(_0x5912a9){return _0x5912a9?{'count':_0x2d9e91,'rows':_0x5912a9}:null;}})[_0xcad4('0x14')](respondWithResult(_0x371345,null))[_0xcad4('0x3c')](handleError(_0x371345,null));};exports['addTeams']=function(_0x47828f,_0x11d47f){var _0x344cd6=_0x47828f[_0xcad4('0x33')][_0xcad4('0x56')];return db[_0xcad4('0x53')][_0xcad4('0x25')]({'where':{'id':_0x344cd6},'attributes':['id'],'include':[{'model':db[_0xcad4('0x57')],'as':_0xcad4('0x58'),'attributes':['id',_0xcad4('0x19'),_0xcad4('0x59'),'voicePause','interface'],'raw':!![]}]})[_0xcad4('0x14')](function(_0x376c45){if(_0x376c45){var _0x3938fc=_['flatMap'](_0x376c45,function(_0x5bcb54){var _0x570def=_0x5bcb54[_0xcad4('0x35')]({'plain':!![]});return _0x570def['Agents'];});return db[_0xcad4('0x24')][_0xcad4('0x31')]({'where':{'id':_0x47828f['params']['id']}})[_0xcad4('0x14')](function(_0x97b33d){return db[_0xcad4('0x5a')][_0xcad4('0x5b')](function(_0x4f442b){return _0x97b33d['addTeams'](_0x344cd6,{'transaction':_0x4f442b})[_0xcad4('0x14')](function(){return BPromise[_0xcad4('0x5c')](_0x3938fc,function(_0x1a7ea0){return db['UserWhatsappQueue'][_0xcad4('0x5d')]({'where':{'UserId':_0x1a7ea0['id'],'WhatsappQueueId':_0x47828f[_0xcad4('0x3e')]['id']},'transaction':_0x4f442b});});})['then'](function(){_0x3938fc['forEach'](function(_0xcba9f9){socket['emit'](_0xcad4('0x5e'),{'UserId':_0xcba9f9['id'],'WhatsappQueueId':_0x97b33d['id']});});});});});}})['then'](respondWithStatusCode(_0x11d47f,null))['catch'](handleError(_0x11d47f,null));};exports[_0xcad4('0x5f')]=function(_0x4fce10,_0x68bf2){return db[_0xcad4('0x53')][_0xcad4('0x25')]({'where':{'id':_0x4fce10['query'][_0xcad4('0x56')]},'attributes':['id'],'include':[{'model':db[_0xcad4('0x57')],'as':_0xcad4('0x58'),'attributes':['id'],'raw':!![]}]})[_0xcad4('0x14')](handleEntityNotFound(_0x68bf2,null))[_0xcad4('0x14')](function(_0x10196b){var _0x4e2a0b=_[_0xcad4('0x49')](_0x10196b,'id');var _0x462d61=[];var _0x37936c=[];var _0x398585=squel[_0xcad4('0x60')]();_0x398585['field'](_0xcad4('0x61'))[_0xcad4('0x62')](_0xcad4('0x63'),'tq')[_0xcad4('0x64')](_0xcad4('0x65'),'ut',_0xcad4('0x66'))[_0xcad4('0x21')](_0xcad4('0x67'),_0x4fce10[_0xcad4('0x3e')]['id']);for(var _0x446183=0x0;_0x446183<_0x10196b[_0xcad4('0x2e')];_0x446183+=0x1){let _0x28da9b=_0x10196b[_0x446183];for(var _0x2a2139=0x0;_0x2a2139<_0x28da9b[_0xcad4('0x58')][_0xcad4('0x2e')];_0x2a2139+=0x1){let _0x49d164=_0x28da9b[_0xcad4('0x58')][_0x2a2139];var _0x5b2323=_0x398585[_0xcad4('0x68')]();_0x5b2323['where']('ut.UserId\x20=\x20?',_0x49d164['id']);_0x37936c['push'](db[_0xcad4('0x5a')][_0xcad4('0x28')](_0x5b2323['toString'](),{'type':db['sequelize'][_0xcad4('0x69')][_0xcad4('0x6a')]})['then'](function(_0xd03d7){if(_0xd03d7[_0xcad4('0x2e')]===0x1){return _0x49d164['id'];}else{var _0x133210=_['every'](_[_0xcad4('0x49')](_0xd03d7,_0xcad4('0x6b')),function(_0x2aae66){return _['includes'](_0x4e2a0b,_0x2aae66);});if(_0x133210){return _0x49d164['id'];}}}));}}return BPromise[_0xcad4('0x6c')](_0x37936c)[_0xcad4('0x14')](function(_0x449ce0){_0x462d61=_(_0x462d61)[_0xcad4('0x6d')](_0x449ce0)[_0xcad4('0x6e')]()['value']();return db[_0xcad4('0x24')]['find']({'where':{'id':_0x4fce10[_0xcad4('0x3e')]['id']}})[_0xcad4('0x14')](function(_0x5b9a14){return db[_0xcad4('0x5a')][_0xcad4('0x5b')](function(_0xa4fce7){return _0x5b9a14[_0xcad4('0x5f')](_0x4fce10[_0xcad4('0x28')][_0xcad4('0x56')],{'transaction':_0xa4fce7})[_0xcad4('0x14')](function(){if(!_[_0xcad4('0x6f')](_0x462d61)){return _0x5b9a14['removeAgents'](_0x462d61,{'transaction':_0xa4fce7});}})['then'](function(){_0x462d61[_0xcad4('0x70')](function(_0xaddf7c){socket[_0xcad4('0x71')](_0xcad4('0x72'),{'UserId':_0xaddf7c,'WhatsappQueueId':_0x5b9a14['id']});});});});});});})[_0xcad4('0x14')](respondWithStatusCode(_0x68bf2,null))[_0xcad4('0x3c')](handleError(_0x68bf2,null));};exports[_0xcad4('0x73')]=function(_0xa68e4c,_0x522be8){return db['WhatsappQueue'][_0xcad4('0x31')]({'where':{'id':_0xa68e4c[_0xcad4('0x3e')]['id']}})['then'](handleEntityNotFound(_0x522be8,null))['then'](function(_0x207fd9){if(_0x207fd9){return _0x207fd9[_0xcad4('0x73')](_0xa68e4c['body'][_0xcad4('0x56')],_[_0xcad4('0x74')](_0xa68e4c['body'],['ids','id'])||{})['spread'](function(_0x55798a){for(var _0x2c111f=0x0;_0x2c111f<_0xa68e4c['body'][_0xcad4('0x56')][_0xcad4('0x2e')];_0x2c111f+=0x1){socket[_0xcad4('0x71')](_0xcad4('0x5e'),{'UserId':Number(_0xa68e4c[_0xcad4('0x33')][_0xcad4('0x56')][_0x2c111f]),'WhatsappQueueId':Number(_0xa68e4c[_0xcad4('0x3e')]['id'])});}return _0x55798a;});}})[_0xcad4('0x14')](respondWithResult(_0x522be8,null))[_0xcad4('0x3c')](handleError(_0x522be8,null));};exports[_0xcad4('0x75')]=function(_0x30b853,_0x552859){return db['WhatsappQueue'][_0xcad4('0x31')]({'where':{'id':_0x30b853[_0xcad4('0x3e')]['id']}})['then'](handleEntityNotFound(_0x552859,null))['then'](function(_0x102915){if(_0x102915){return _0x102915['removeAgents'](_0x30b853[_0xcad4('0x28')][_0xcad4('0x56')])[_0xcad4('0x14')](function(){if(_[_0xcad4('0x76')](_0x30b853[_0xcad4('0x28')][_0xcad4('0x56')])){for(var _0x1b251a=0x0;_0x1b251a<_0x30b853[_0xcad4('0x28')]['ids'][_0xcad4('0x2e')];_0x1b251a+=0x1){socket[_0xcad4('0x71')]('userWhatsappQueue:remove',{'UserId':Number(_0x30b853['query']['ids'][_0x1b251a]),'WhatsappQueueId':Number(_0x30b853[_0xcad4('0x3e')]['id'])});}}else{socket[_0xcad4('0x71')]('userWhatsappQueue:remove',{'UserId':Number(_0x30b853['query'][_0xcad4('0x56')]),'WhatsappQueueId':Number(_0x30b853[_0xcad4('0x3e')]['id'])});}});}})[_0xcad4('0x14')](respondWithStatusCode(_0x552859,null))[_0xcad4('0x3c')](handleError(_0x552859,null));};exports[_0xcad4('0x77')]=function(_0x30b342,_0x2daafa){var _0x2f0718={};var _0x110058={};var _0x591dc8;var _0x5d659b;return db['WhatsappQueue']['findOne']({'where':{'id':_0x30b342[_0xcad4('0x3e')]['id']}})[_0xcad4('0x14')](handleEntityNotFound(_0x2daafa,null))['then'](function(_0x3d096e){if(_0x3d096e){_0x591dc8=_0x3d096e;_0x110058['model']=_[_0xcad4('0x27')](db['User'][_0xcad4('0x1c')]);_0x110058[_0xcad4('0x28')]=_[_0xcad4('0x27')](_0x30b342[_0xcad4('0x28')]);_0x110058['filters']=_[_0xcad4('0x2a')](_0x110058[_0xcad4('0x2b')],_0x110058[_0xcad4('0x28')]);_0x2f0718[_0xcad4('0x2c')]=_[_0xcad4('0x2a')](_0x110058[_0xcad4('0x2b')],qs[_0xcad4('0x2d')](_0x30b342[_0xcad4('0x28')]['fields']));_0x2f0718[_0xcad4('0x2c')]=_0x2f0718[_0xcad4('0x2c')]['length']?_0x2f0718[_0xcad4('0x2c')]:_0x110058[_0xcad4('0x2b')];_0x2f0718[_0xcad4('0x44')]=qs['sort'](_0x30b342['query'][_0xcad4('0x45')]);_0x2f0718[_0xcad4('0x21')]=qs[_0xcad4('0x29')](_[_0xcad4('0x54')](_0x30b342[_0xcad4('0x28')],_0x110058['filters']));if(_0x30b342[_0xcad4('0x28')][_0xcad4('0x46')]){_0x2f0718['where']=_[_0xcad4('0x30')](_0x2f0718[_0xcad4('0x21')],{'$or':_[_0xcad4('0x49')](_0x2f0718['attributes'],function(_0xdd9499){var _0x33a471={};_0x33a471[_0xdd9499]={'$like':'%'+_0x30b342[_0xcad4('0x28')][_0xcad4('0x46')]+'%'};return _0x33a471;})});}_0x2f0718=_[_0xcad4('0x30')]({},_0x2f0718,_0x30b342[_0xcad4('0x47')]);return _0x591dc8[_0xcad4('0x77')](_0x2f0718);}})[_0xcad4('0x14')](function(_0x1d4e01){if(_0x1d4e01){_0x5d659b=_0x1d4e01[_0xcad4('0x2e')];if(!_0x30b342['query'][_0xcad4('0x42')]('nolimit')){_0x2f0718[_0xcad4('0x11')]=qs[_0xcad4('0x11')](_0x30b342['query'][_0xcad4('0x11')]);_0x2f0718[_0xcad4('0x10')]=qs[_0xcad4('0x10')](_0x30b342[_0xcad4('0x28')][_0xcad4('0x10')]);}return _0x591dc8[_0xcad4('0x77')](_0x2f0718);}})[_0xcad4('0x14')](function(_0xf6c85e){if(_0xf6c85e){return _0xf6c85e?{'count':_0x5d659b,'rows':_0xf6c85e}:null;}})[_0xcad4('0x14')](respondWithResult(_0x2daafa,null))['catch'](handleError(_0x2daafa,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 7956538..9c75486 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 _0x0796=['remove','emit','hasOwnProperty','hook','exports','events','WhatsappQueue','save','update'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x0796,0x68));var _0x6079=function(_0x61f31a,_0x3a4f21){_0x61f31a=_0x61f31a-0x0;var _0x188828=_0x0796[_0x61f31a];return _0x188828;};'use strict';var EventEmitter=require(_0x6079('0x0'));var WhatsappQueue=require('../../mysqldb')['db'][_0x6079('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6079('0x2'),'afterUpdate':_0x6079('0x3'),'afterDestroy':_0x6079('0x4')};function emitEvent(_0x18453e){return function(_0x4c09b7,_0x4f7407,_0x587c10){WhatsappQueueEvents[_0x6079('0x5')](_0x18453e+':'+_0x4c09b7['id'],_0x4c09b7);WhatsappQueueEvents[_0x6079('0x5')](_0x18453e,_0x4c09b7);_0x587c10(null);};}for(var e in events){if(events[_0x6079('0x6')](e)){var event=events[e];WhatsappQueue[_0x6079('0x7')](e,emitEvent(event));}}module[_0x6079('0x8')]=WhatsappQueueEvents; \ No newline at end of file +var _0x70fe=['events','../../mysqldb','WhatsappQueue','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x70fe,0xfa));var _0xe70f=function(_0x323c4b,_0x281826){_0x323c4b=_0x323c4b-0x0;var _0x5264dd=_0x70fe[_0x323c4b];return _0x5264dd;};'use strict';var EventEmitter=require(_0xe70f('0x0'));var WhatsappQueue=require(_0xe70f('0x1'))['db'][_0xe70f('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xe70f('0x3')](0x0);var events={'afterCreate':_0xe70f('0x4'),'afterUpdate':_0xe70f('0x5'),'afterDestroy':_0xe70f('0x6')};function emitEvent(_0x25c59f){return function(_0x48702f,_0x57ff8b,_0x268f2c){WhatsappQueueEvents[_0xe70f('0x7')](_0x25c59f+':'+_0x48702f['id'],_0x48702f);WhatsappQueueEvents[_0xe70f('0x7')](_0x25c59f,_0x48702f);_0x268f2c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0xe70f('0x8')](e,emitEvent(event));}}module[_0xe70f('0x9')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index cabd25a..02a17cb 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 _0x3cb7=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues'];(function(_0x57fa7e,_0xd0b5ce){var _0x320671=function(_0x3392cc){while(--_0x3392cc){_0x57fa7e['push'](_0x57fa7e['shift']());}};_0x320671(++_0xd0b5ce);}(_0x3cb7,0x1c7));var _0x73cb=function(_0x1aeda2,_0x1217eb){_0x1aeda2=_0x1aeda2-0x0;var _0x32dc6d=_0x3cb7[_0x1aeda2];return _0x32dc6d;};'use strict';var _=require(_0x73cb('0x0'));var util=require(_0x73cb('0x1'));var logger=require(_0x73cb('0x2'))('api');var moment=require(_0x73cb('0x3'));var BPromise=require(_0x73cb('0x4'));var rp=require(_0x73cb('0x5'));var fs=require('fs');var path=require(_0x73cb('0x6'));var rimraf=require(_0x73cb('0x7'));var config=require('../../config/environment');var attributes=require(_0x73cb('0x8'));module[_0x73cb('0x9')]=function(_0x421f78,_0x4cd650){return _0x421f78[_0x73cb('0xa')](_0x73cb('0xb'),attributes,{'tableName':_0x73cb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x81a2=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','WhatsappQueue','whatsapp_queues','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x81a2,0x1ab));var _0x281a=function(_0xf158db,_0x337fab){_0xf158db=_0xf158db-0x0;var _0x396bfe=_0x81a2[_0xf158db];return _0x396bfe;};'use strict';var _=require(_0x281a('0x0'));var util=require(_0x281a('0x1'));var logger=require(_0x281a('0x2'))(_0x281a('0x3'));var moment=require(_0x281a('0x4'));var BPromise=require(_0x281a('0x5'));var rp=require(_0x281a('0x6'));var fs=require('fs');var path=require(_0x281a('0x7'));var rimraf=require(_0x281a('0x8'));var config=require(_0x281a('0x9'));var attributes=require('./whatsappQueue.attributes');module['exports']=function(_0x444807,_0x24ae89){return _0x444807[_0x281a('0xa')](_0x281a('0xb'),attributes,{'tableName':_0x281a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index c8173ba..cf888fe 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 _0xb313=['info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','WhatsappQueue','findAll','options','raw','limit','include','model','attributes','map','GetWhatsappQueue','ShowWhatsappQueue','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','socket.io-emitter','./whatsappQueue.socket','request','then'];(function(_0x5f382f,_0x3f1432){var _0x3bb11b=function(_0x4daf9b){while(--_0x4daf9b){_0x5f382f['push'](_0x5f382f['shift']());}};_0x3bb11b(++_0x3f1432);}(_0xb313,0x6c));var _0x3b31=function(_0x104112,_0x342eb6){_0x104112=_0x104112-0x0;var _0x394ab4=_0xb313[_0x104112];return _0x394ab4;};'use strict';var _=require(_0x3b31('0x0'));var util=require(_0x3b31('0x1'));var moment=require(_0x3b31('0x2'));var BPromise=require(_0x3b31('0x3'));var rs=require(_0x3b31('0x4'));var fs=require('fs');var Redis=require(_0x3b31('0x5'));var db=require(_0x3b31('0x6'))['db'];var utils=require(_0x3b31('0x7'));var logger=require(_0x3b31('0x8'))(_0x3b31('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3b31('0xa')][_0x3b31('0xb')]({'port':0x232a});config[_0x3b31('0xc')]=_[_0x3b31('0xd')](config[_0x3b31('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x3b31('0xe'))(new Redis(config[_0x3b31('0xc')]));require(_0x3b31('0xf'))['register'](socket);function respondWithRpcPromise(_0x1cf0e1,_0x4154cb,_0x206fef){return new BPromise(function(_0x55abb3,_0x2e6632){return client[_0x3b31('0x10')](_0x1cf0e1,_0x206fef)[_0x3b31('0x11')](function(_0x334a3d){logger[_0x3b31('0x12')](_0x3b31('0x13'),_0x4154cb,_0x3b31('0x14'));logger[_0x3b31('0x15')](_0x3b31('0x16'),_0x4154cb,_0x3b31('0x14'),JSON[_0x3b31('0x17')](_0x334a3d));if(_0x334a3d[_0x3b31('0x18')]){if(_0x334a3d[_0x3b31('0x18')][_0x3b31('0x19')]===0x1f4){logger[_0x3b31('0x18')](_0x3b31('0x13'),_0x4154cb,_0x334a3d['error'][_0x3b31('0x1a')]);return _0x2e6632(_0x334a3d[_0x3b31('0x18')][_0x3b31('0x1a')]);}logger[_0x3b31('0x18')](_0x3b31('0x13'),_0x4154cb,_0x334a3d[_0x3b31('0x18')]['message']);return _0x55abb3(_0x334a3d[_0x3b31('0x18')]['message']);}else{logger[_0x3b31('0x12')](_0x3b31('0x13'),_0x4154cb,_0x3b31('0x14'));_0x55abb3(_0x334a3d[_0x3b31('0x1b')][_0x3b31('0x1a')]);}})[_0x3b31('0x1c')](function(_0x56e897){logger[_0x3b31('0x18')](_0x3b31('0x13'),_0x4154cb,_0x56e897);_0x2e6632(_0x56e897);});});}exports['GetWhatsappQueue']=function(_0x555381){var _0x52104a=this;return new Promise(function(_0x12a5d7,_0x38c6ac){return db[_0x3b31('0x1d')][_0x3b31('0x1e')]({'raw':_0x555381['options']?_0x555381[_0x3b31('0x1f')][_0x3b31('0x20')]===undefined?!![]:![]:!![],'where':_0x555381[_0x3b31('0x1f')]?_0x555381['options']['where']||null:null,'attributes':_0x555381[_0x3b31('0x1f')]?_0x555381[_0x3b31('0x1f')]['attributes']||null:null,'limit':_0x555381[_0x3b31('0x1f')]?_0x555381[_0x3b31('0x1f')][_0x3b31('0x21')]||null:null,'include':_0x555381[_0x3b31('0x1f')]?_0x555381[_0x3b31('0x1f')][_0x3b31('0x22')]?_['map'](_0x555381[_0x3b31('0x1f')][_0x3b31('0x22')],function(_0x531792){return{'model':db[_0x531792[_0x3b31('0x23')]],'as':_0x531792['as'],'attributes':_0x531792[_0x3b31('0x24')],'include':_0x531792[_0x3b31('0x22')]?_['map'](_0x531792[_0x3b31('0x22')],function(_0x16f7cf){return{'model':db[_0x16f7cf[_0x3b31('0x23')]],'as':_0x16f7cf['as'],'attributes':_0x16f7cf['attributes'],'include':_0x16f7cf[_0x3b31('0x22')]?_[_0x3b31('0x25')](_0x16f7cf[_0x3b31('0x22')],function(_0x3a1a72){return{'model':db[_0x3a1a72[_0x3b31('0x23')]],'as':_0x3a1a72['as'],'attributes':_0x3a1a72[_0x3b31('0x24')]};}):[]};}):[]};}):[]:[]})[_0x3b31('0x11')](function(_0x4fd3db){logger['info'](_0x3b31('0x26'),_0x555381);logger[_0x3b31('0x15')](_0x3b31('0x26'),_0x555381,JSON[_0x3b31('0x17')](_0x4fd3db));_0x12a5d7(_0x4fd3db);})[_0x3b31('0x1c')](function(_0x5f1a83){logger[_0x3b31('0x18')](_0x3b31('0x26'),_0x5f1a83[_0x3b31('0x1a')],_0x555381);_0x38c6ac(_0x52104a[_0x3b31('0x18')](0x1f4,_0x5f1a83[_0x3b31('0x1a')]));});});};exports[_0x3b31('0x27')]=function(_0x5e1100){var _0x130159=this;return new Promise(function(_0x55139b,_0x134edd){return db[_0x3b31('0x1d')][_0x3b31('0x28')]({'raw':_0x5e1100[_0x3b31('0x1f')]?_0x5e1100[_0x3b31('0x1f')][_0x3b31('0x20')]===undefined?!![]:![]:!![],'where':_0x5e1100[_0x3b31('0x1f')]?_0x5e1100['options'][_0x3b31('0x29')]||null:null,'attributes':_0x5e1100[_0x3b31('0x1f')]?_0x5e1100['options'][_0x3b31('0x24')]||null:null,'include':_0x5e1100[_0x3b31('0x1f')]?_0x5e1100['options']['include']?_['map'](_0x5e1100[_0x3b31('0x1f')]['include'],function(_0x23ee1f){return{'model':db[_0x23ee1f['model']],'as':_0x23ee1f['as'],'attributes':_0x23ee1f[_0x3b31('0x24')],'include':_0x23ee1f[_0x3b31('0x22')]?_[_0x3b31('0x25')](_0x23ee1f['include'],function(_0x35bab8){return{'model':db[_0x35bab8[_0x3b31('0x23')]],'as':_0x35bab8['as'],'attributes':_0x35bab8[_0x3b31('0x24')],'include':_0x35bab8[_0x3b31('0x22')]?_[_0x3b31('0x25')](_0x35bab8[_0x3b31('0x22')],function(_0x5f15f3){return{'model':db[_0x5f15f3[_0x3b31('0x23')]],'as':_0x5f15f3['as'],'attributes':_0x5f15f3[_0x3b31('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x11800b){logger[_0x3b31('0x12')]('ShowWhatsappQueue',_0x5e1100);logger['debug'](_0x3b31('0x27'),_0x5e1100,JSON['stringify'](_0x11800b));_0x55139b(_0x11800b);})['catch'](function(_0x14cd5e){logger[_0x3b31('0x18')](_0x3b31('0x27'),_0x14cd5e['message'],_0x5e1100);_0x134edd(_0x130159[_0x3b31('0x18')](0x1f4,_0x14cd5e[_0x3b31('0x1a')]));});});}; \ No newline at end of file +var _0x9a9c=['map','model','catch','ShowWhatsappQueue','where','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','request','then','WhatsappQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','GetWhatsappQueue','WhatsappQueue','findAll','options','attributes','limit','include'];(function(_0xc6d0b1,_0x1b949f){var _0x3d76f4=function(_0x15b325){while(--_0x15b325){_0xc6d0b1['push'](_0xc6d0b1['shift']());}};_0x3d76f4(++_0x1b949f);}(_0x9a9c,0x177));var _0xc9a9=function(_0x2e7b83,_0x4b81f4){_0x2e7b83=_0x2e7b83-0x0;var _0x330d68=_0x9a9c[_0x2e7b83];return _0x330d68;};'use strict';var _=require(_0xc9a9('0x0'));var util=require(_0xc9a9('0x1'));var moment=require(_0xc9a9('0x2'));var BPromise=require('bluebird');var rs=require(_0xc9a9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc9a9('0x4'))['db'];var utils=require(_0xc9a9('0x5'));var logger=require(_0xc9a9('0x6'))(_0xc9a9('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc9a9('0x8')][_0xc9a9('0x9')]({'port':0x232a});config[_0xc9a9('0xa')]=_[_0xc9a9('0xb')](config[_0xc9a9('0xa')],{'host':_0xc9a9('0xc'),'port':0x18eb});var socket=require(_0xc9a9('0xd'))(new Redis(config[_0xc9a9('0xa')]));require(_0xc9a9('0xe'))['register'](socket);function respondWithRpcPromise(_0x55ce4f,_0x4035d9,_0x517690){return new BPromise(function(_0x50f230,_0x480b28){return client[_0xc9a9('0xf')](_0x55ce4f,_0x517690)[_0xc9a9('0x10')](function(_0x106486){logger['info'](_0xc9a9('0x11'),_0x4035d9,'request\x20sent');logger[_0xc9a9('0x12')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x4035d9,_0xc9a9('0x13'),JSON[_0xc9a9('0x14')](_0x106486));if(_0x106486[_0xc9a9('0x15')]){if(_0x106486[_0xc9a9('0x15')][_0xc9a9('0x16')]===0x1f4){logger[_0xc9a9('0x15')]('WhatsappQueue,\x20%s,\x20%s',_0x4035d9,_0x106486['error'][_0xc9a9('0x17')]);return _0x480b28(_0x106486[_0xc9a9('0x15')]['message']);}logger['error'](_0xc9a9('0x11'),_0x4035d9,_0x106486[_0xc9a9('0x15')]['message']);return _0x50f230(_0x106486[_0xc9a9('0x15')][_0xc9a9('0x17')]);}else{logger[_0xc9a9('0x18')](_0xc9a9('0x11'),_0x4035d9,'request\x20sent');_0x50f230(_0x106486['result'][_0xc9a9('0x17')]);}})['catch'](function(_0x477012){logger[_0xc9a9('0x15')]('WhatsappQueue,\x20%s,\x20%s',_0x4035d9,_0x477012);_0x480b28(_0x477012);});});}exports[_0xc9a9('0x19')]=function(_0xee953c){var _0x1844e6=this;return new Promise(function(_0x4f5efc,_0x1d7fc0){return db[_0xc9a9('0x1a')][_0xc9a9('0x1b')]({'raw':_0xee953c[_0xc9a9('0x1c')]?_0xee953c['options']['raw']===undefined?!![]:![]:!![],'where':_0xee953c[_0xc9a9('0x1c')]?_0xee953c[_0xc9a9('0x1c')]['where']||null:null,'attributes':_0xee953c[_0xc9a9('0x1c')]?_0xee953c[_0xc9a9('0x1c')][_0xc9a9('0x1d')]||null:null,'limit':_0xee953c['options']?_0xee953c[_0xc9a9('0x1c')][_0xc9a9('0x1e')]||null:null,'include':_0xee953c['options']?_0xee953c[_0xc9a9('0x1c')][_0xc9a9('0x1f')]?_[_0xc9a9('0x20')](_0xee953c[_0xc9a9('0x1c')]['include'],function(_0x113ec0){return{'model':db[_0x113ec0['model']],'as':_0x113ec0['as'],'attributes':_0x113ec0['attributes'],'include':_0x113ec0[_0xc9a9('0x1f')]?_[_0xc9a9('0x20')](_0x113ec0[_0xc9a9('0x1f')],function(_0x247b50){return{'model':db[_0x247b50[_0xc9a9('0x21')]],'as':_0x247b50['as'],'attributes':_0x247b50[_0xc9a9('0x1d')],'include':_0x247b50[_0xc9a9('0x1f')]?_['map'](_0x247b50[_0xc9a9('0x1f')],function(_0x2a320d){return{'model':db[_0x2a320d[_0xc9a9('0x21')]],'as':_0x2a320d['as'],'attributes':_0x2a320d[_0xc9a9('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x255599){logger[_0xc9a9('0x18')](_0xc9a9('0x19'),_0xee953c);logger[_0xc9a9('0x12')](_0xc9a9('0x19'),_0xee953c,JSON[_0xc9a9('0x14')](_0x255599));_0x4f5efc(_0x255599);})[_0xc9a9('0x22')](function(_0x26522b){logger[_0xc9a9('0x15')](_0xc9a9('0x19'),_0x26522b[_0xc9a9('0x17')],_0xee953c);_0x1d7fc0(_0x1844e6['error'](0x1f4,_0x26522b['message']));});});};exports[_0xc9a9('0x23')]=function(_0x1ee2c9){var _0x1eb6a9=this;return new Promise(function(_0x34aa13,_0x5d3834){return db[_0xc9a9('0x1a')]['find']({'raw':_0x1ee2c9[_0xc9a9('0x1c')]?_0x1ee2c9[_0xc9a9('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x1ee2c9[_0xc9a9('0x1c')]?_0x1ee2c9[_0xc9a9('0x1c')][_0xc9a9('0x24')]||null:null,'attributes':_0x1ee2c9[_0xc9a9('0x1c')]?_0x1ee2c9[_0xc9a9('0x1c')][_0xc9a9('0x1d')]||null:null,'include':_0x1ee2c9['options']?_0x1ee2c9[_0xc9a9('0x1c')]['include']?_[_0xc9a9('0x20')](_0x1ee2c9['options'][_0xc9a9('0x1f')],function(_0x5d0dd1){return{'model':db[_0x5d0dd1[_0xc9a9('0x21')]],'as':_0x5d0dd1['as'],'attributes':_0x5d0dd1[_0xc9a9('0x1d')],'include':_0x5d0dd1[_0xc9a9('0x1f')]?_[_0xc9a9('0x20')](_0x5d0dd1[_0xc9a9('0x1f')],function(_0x235e6b){return{'model':db[_0x235e6b[_0xc9a9('0x21')]],'as':_0x235e6b['as'],'attributes':_0x235e6b[_0xc9a9('0x1d')],'include':_0x235e6b['include']?_[_0xc9a9('0x20')](_0x235e6b[_0xc9a9('0x1f')],function(_0x2f92c0){return{'model':db[_0x2f92c0[_0xc9a9('0x21')]],'as':_0x2f92c0['as'],'attributes':_0x2f92c0[_0xc9a9('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xc9a9('0x10')](function(_0x25daf4){logger[_0xc9a9('0x18')](_0xc9a9('0x23'),_0x1ee2c9);logger['debug'](_0xc9a9('0x23'),_0x1ee2c9,JSON[_0xc9a9('0x14')](_0x25daf4));_0x34aa13(_0x25daf4);})[_0xc9a9('0x22')](function(_0x21d657){logger[_0xc9a9('0x15')](_0xc9a9('0x23'),_0x21d657[_0xc9a9('0x17')],_0x1ee2c9);_0x5d3834(_0x1eb6a9[_0xc9a9('0x15')](0x1f4,_0x21d657[_0xc9a9('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 0149ec3..3a733d5 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 _0x257e=['emit','removeListener','length','whatsappQueue:','./whatsappQueue.events','save','update'];(function(_0x40f220,_0xa0d87f){var _0x34bb8a=function(_0x92c52f){while(--_0x92c52f){_0x40f220['push'](_0x40f220['shift']());}};_0x34bb8a(++_0xa0d87f);}(_0x257e,0x74));var _0xe257=function(_0x46f1a6,_0xc7a582){_0x46f1a6=_0x46f1a6-0x0;var _0x38429a=_0x257e[_0x46f1a6];return _0x38429a;};'use strict';var WhatsappQueueEvents=require(_0xe257('0x0'));var events=[_0xe257('0x1'),'remove',_0xe257('0x2')];function createListener(_0x41d17a,_0x4825ba){return function(_0x57d64b){_0x4825ba[_0xe257('0x3')](_0x41d17a,_0x57d64b);};}function removeListener(_0x18bc46,_0x4e498c){return function(){WhatsappQueueEvents[_0xe257('0x4')](_0x18bc46,_0x4e498c);};}exports['register']=function(_0x29dc27){for(var _0x408d47=0x0,_0x1b0782=events[_0xe257('0x5')];_0x408d47<_0x1b0782;_0x408d47++){var _0x336d7a=events[_0x408d47];var _0x2a9e44=createListener(_0xe257('0x6')+_0x336d7a,_0x29dc27);WhatsappQueueEvents['on'](_0x336d7a,_0x2a9e44);}}; \ No newline at end of file +var _0xc2e3=['save','update','removeListener','length','whatsappQueue:','./whatsappQueue.events'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0xc2e3,0x6b));var _0x3c2e=function(_0x3b6f2e,_0x591608){_0x3b6f2e=_0x3b6f2e-0x0;var _0x543b1=_0xc2e3[_0x3b6f2e];return _0x543b1;};'use strict';var WhatsappQueueEvents=require(_0x3c2e('0x0'));var events=[_0x3c2e('0x1'),'remove',_0x3c2e('0x2')];function createListener(_0x3329e3,_0x2c0b4a){return function(_0x362fb7){_0x2c0b4a['emit'](_0x3329e3,_0x362fb7);};}function removeListener(_0x8bf792,_0x1a53d8){return function(){WhatsappQueueEvents[_0x3c2e('0x3')](_0x8bf792,_0x1a53d8);};}exports['register']=function(_0x1cecbd){for(var _0x57e5ff=0x0,_0x5aa17d=events[_0x3c2e('0x4')];_0x57e5ff<_0x5aa17d;_0x57e5ff++){var _0x338b6e=events[_0x57e5ff];var _0x5e1f17=createListener(_0x3c2e('0x5')+_0x338b6e,_0x1cecbd);WhatsappQueueEvents['on'](_0x338b6e,_0x5e1f17);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 72e27e8..457723b 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 _0xeb06=['create','put','/:id','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','/describe','describe','show','post'];(function(_0x59b9d2,_0x25abee){var _0x41a78c=function(_0x44ca06){while(--_0x44ca06){_0x59b9d2['push'](_0x59b9d2['shift']());}};_0x41a78c(++_0x25abee);}(_0xeb06,0x148));var _0x6eb0=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xeb06[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0x6eb0('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6eb0('0x1'));var express=require(_0x6eb0('0x2'));var router=express[_0x6eb0('0x3')]();var fs_extra=require(_0x6eb0('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x6eb0('0x5'));var config=require(_0x6eb0('0x6'));var controller=require(_0x6eb0('0x7'));router[_0x6eb0('0x8')]('/',auth[_0x6eb0('0x9')](),controller['index']);router[_0x6eb0('0x8')](_0x6eb0('0xa'),auth[_0x6eb0('0x9')](),controller[_0x6eb0('0xb')]);router[_0x6eb0('0x8')]('/:id',auth[_0x6eb0('0x9')](),controller[_0x6eb0('0xc')]);router[_0x6eb0('0xd')]('/',auth[_0x6eb0('0x9')](),controller[_0x6eb0('0xe')]);router[_0x6eb0('0xf')](_0x6eb0('0x10'),auth[_0x6eb0('0x9')](),controller['update']);router['delete'](_0x6eb0('0x10'),auth[_0x6eb0('0x9')](),controller[_0x6eb0('0x11')]);module[_0x6eb0('0x12')]=router; \ No newline at end of file +var _0x6dbb=['create','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','index','isAuthenticated','describe'];(function(_0xb4793c,_0x16833c){var _0x225101=function(_0x34138f){while(--_0x34138f){_0xb4793c['push'](_0xb4793c['shift']());}};_0x225101(++_0x16833c);}(_0x6dbb,0x12c));var _0xb6db=function(_0xa23e82,_0x2cefa5){_0xa23e82=_0xa23e82-0x0;var _0x135e60=_0x6dbb[_0xa23e82];return _0x135e60;};'use strict';var multer=require(_0xb6db('0x0'));var util=require(_0xb6db('0x1'));var path=require(_0xb6db('0x2'));var timeout=require(_0xb6db('0x3'));var express=require(_0xb6db('0x4'));var router=express[_0xb6db('0x5')]();var fs_extra=require(_0xb6db('0x6'));var auth=require(_0xb6db('0x7'));var interaction=require(_0xb6db('0x8'));var config=require(_0xb6db('0x9'));var controller=require(_0xb6db('0xa'));router[_0xb6db('0xb')]('/',auth['isAuthenticated'](),controller[_0xb6db('0xc')]);router['get']('/describe',auth[_0xb6db('0xd')](),controller[_0xb6db('0xe')]);router[_0xb6db('0xb')]('/:id',auth[_0xb6db('0xd')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xb6db('0xf')]);router['put'](_0xb6db('0x10'),auth[_0xb6db('0xd')](),controller[_0xb6db('0x11')]);router[_0xb6db('0x12')](_0xb6db('0x10'),auth['isAuthenticated'](),controller[_0xb6db('0x13')]);module[_0xb6db('0x14')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index ca2ba15..01efa6e 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(_0x1f859b,_0x1a0be4){var _0x488035=function(_0xba1a3c){while(--_0xba1a3c){_0x1f859b['push'](_0x1f859b['shift']());}};_0x488035(++_0x1a0be4);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'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(_0x3df526,_0x533870){var _0x2875f8=function(_0xe56b2b){while(--_0xe56b2b){_0x3df526['push'](_0x3df526['shift']());}};_0x2875f8(++_0x533870);}(_0x7a54,0x106));var _0x47a5=function(_0x50eadf,_0x1540cb){_0x50eadf=_0x50eadf-0x0;var _0xeb8d0e=_0x7a54[_0x50eadf];return _0xeb8d0e;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index d29db53..557b0a6 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 _0xea28=['end','stack','name','map','WhatsappQueueReport','rawAttributes','fieldName','type','query','intersection','model','attributes','length','hasOwnProperty','nolimit','order','where','filters','pick','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','keys','fields','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','reject','update','then'];(function(_0x25e7ee,_0x4d8966){var _0x1251f2=function(_0x165472){while(--_0x165472){_0x25e7ee['push'](_0x25e7ee['shift']());}};_0x1251f2(++_0x4d8966);}(_0xea28,0x13a));var _0x8ea2=function(_0x1d340a,_0x521ab6){_0x1d340a=_0x1d340a-0x0;var _0x30a4db=_0xea28[_0x1d340a];return _0x30a4db;};'use strict';var emlformat=require(_0x8ea2('0x0'));var rimraf=require(_0x8ea2('0x1'));var zipdir=require(_0x8ea2('0x2'));var jsonpatch=require(_0x8ea2('0x3'));var rp=require(_0x8ea2('0x4'));var moment=require(_0x8ea2('0x5'));var BPromise=require(_0x8ea2('0x6'));var Mustache=require(_0x8ea2('0x7'));var util=require('util');var path=require(_0x8ea2('0x8'));var sox=require(_0x8ea2('0x9'));var csv=require(_0x8ea2('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8ea2('0xb'));var _=require(_0x8ea2('0xc'));var squel=require(_0x8ea2('0xd'));var crypto=require(_0x8ea2('0xe'));var jsforce=require(_0x8ea2('0xf'));var deskjs=require(_0x8ea2('0x10'));var toCsv=require(_0x8ea2('0xa'));var querystring=require(_0x8ea2('0x11'));var Papa=require(_0x8ea2('0x12'));var Redis=require(_0x8ea2('0x13'));var authService=require(_0x8ea2('0x14'));var qs=require(_0x8ea2('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8ea2('0x16'))(_0x8ea2('0x17'));var utils=require(_0x8ea2('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x8ea2('0x19'));var db=require(_0x8ea2('0x1a'))['db'];function respondWithStatusCode(_0x1dfb6e,_0x10aead){_0x10aead=_0x10aead||0xcc;return function(_0xe47c0e){if(_0xe47c0e){return _0x1dfb6e['sendStatus'](_0x10aead);}return _0x1dfb6e[_0x8ea2('0x1b')](_0x10aead)['end']();};}function respondWithResult(_0x4b2192,_0x772bad){_0x772bad=_0x772bad||0xc8;return function(_0x4726a7){if(_0x4726a7){return _0x4b2192[_0x8ea2('0x1b')](_0x772bad)[_0x8ea2('0x1c')](_0x4726a7);}};}function respondWithFilteredResult(_0x393faf,_0xbb9bd1){return function(_0x3cff96){if(_0x3cff96){var _0x11f5e8=typeof _0xbb9bd1[_0x8ea2('0x1d')]===_0x8ea2('0x1e')&&typeof _0xbb9bd1[_0x8ea2('0x1f')]===_0x8ea2('0x1e');var _0x3bc774=_0x3cff96[_0x8ea2('0x20')];var _0x1b64cf=_0x11f5e8?0x0:_0xbb9bd1[_0x8ea2('0x1d')];var _0x467045=_0x11f5e8?_0x3cff96[_0x8ea2('0x20')]:_0xbb9bd1[_0x8ea2('0x1d')]+_0xbb9bd1[_0x8ea2('0x1f')];var _0x134cbe;if(_0x467045>=_0x3bc774){_0x467045=_0x3bc774;_0x134cbe=0xc8;}else{_0x134cbe=0xce;}_0x393faf[_0x8ea2('0x1b')](_0x134cbe);return _0x393faf['set']('Content-Range',_0x1b64cf+'-'+_0x467045+'/'+_0x3bc774)[_0x8ea2('0x1c')](_0x3cff96);}return null;};}function patchUpdates(_0x248c18){return function(_0x29151a){try{jsonpatch['apply'](_0x29151a,_0x248c18,!![]);}catch(_0x46f4fe){return BPromise[_0x8ea2('0x21')](_0x46f4fe);}return _0x29151a['save']();};}function saveUpdates(_0x3d593b,_0x283f00){return function(_0x37229a){if(_0x37229a){return _0x37229a[_0x8ea2('0x22')](_0x3d593b)[_0x8ea2('0x23')](function(_0xe5c943){return _0xe5c943;});}return null;};}function removeEntity(_0x199417,_0x1e4cc9){return function(_0x18ec34){if(_0x18ec34){return _0x18ec34['destroy']()[_0x8ea2('0x23')](function(){_0x199417['status'](0xcc)[_0x8ea2('0x24')]();});}};}function handleEntityNotFound(_0x42bec8,_0x29b38f){return function(_0x4e2106){if(!_0x4e2106){_0x42bec8['sendStatus'](0x194);}return _0x4e2106;};}function handleError(_0x2e4da3,_0x4dc7bf){_0x4dc7bf=_0x4dc7bf||0x1f4;return function(_0x200a49){logger['error'](_0x200a49[_0x8ea2('0x25')]);if(_0x200a49[_0x8ea2('0x26')]){delete _0x200a49[_0x8ea2('0x26')];}_0x2e4da3[_0x8ea2('0x1b')](_0x4dc7bf)['send'](_0x200a49);};}exports['index']=function(_0xacaa6c,_0x4da5b3){var _0x4a9875={},_0x287078={},_0x24f187={'count':0x0,'rows':[]};var _0x41f482=_[_0x8ea2('0x27')](db[_0x8ea2('0x28')][_0x8ea2('0x29')],function(_0x316707){return{'name':_0x316707[_0x8ea2('0x2a')],'type':_0x316707[_0x8ea2('0x2b')]['key']};});_0x287078['model']=_[_0x8ea2('0x27')](_0x41f482,_0x8ea2('0x26'));_0x287078['query']=_['keys'](_0xacaa6c[_0x8ea2('0x2c')]);_0x287078['filters']=_[_0x8ea2('0x2d')](_0x287078[_0x8ea2('0x2e')],_0x287078['query']);_0x4a9875[_0x8ea2('0x2f')]=_[_0x8ea2('0x2d')](_0x287078[_0x8ea2('0x2e')],qs['fields'](_0xacaa6c['query']['fields']));_0x4a9875[_0x8ea2('0x2f')]=_0x4a9875[_0x8ea2('0x2f')][_0x8ea2('0x30')]?_0x4a9875['attributes']:_0x287078[_0x8ea2('0x2e')];if(!_0xacaa6c[_0x8ea2('0x2c')][_0x8ea2('0x31')](_0x8ea2('0x32'))){_0x4a9875[_0x8ea2('0x1f')]=qs[_0x8ea2('0x1f')](_0xacaa6c[_0x8ea2('0x2c')][_0x8ea2('0x1f')]);_0x4a9875['offset']=qs[_0x8ea2('0x1d')](_0xacaa6c[_0x8ea2('0x2c')][_0x8ea2('0x1d')]);}_0x4a9875[_0x8ea2('0x33')]=qs['sort'](_0xacaa6c[_0x8ea2('0x2c')]['sort']);_0x4a9875[_0x8ea2('0x34')]=qs[_0x8ea2('0x35')](_[_0x8ea2('0x36')](_0xacaa6c[_0x8ea2('0x2c')],_0x287078['filters']),_0x41f482);if(_0xacaa6c[_0x8ea2('0x2c')]['filter']){_0x4a9875['where']=_[_0x8ea2('0x37')](_0x4a9875['where'],{'$or':_[_0x8ea2('0x27')](_0x41f482,function(_0x2f0779){if(_0x2f0779[_0x8ea2('0x2b')]!==_0x8ea2('0x38')){var _0x134584={};_0x134584[_0x2f0779['name']]={'$like':'%'+_0xacaa6c[_0x8ea2('0x2c')]['filter']+'%'};return _0x134584;}})});}_0x4a9875=_[_0x8ea2('0x37')]({},_0x4a9875,_0xacaa6c[_0x8ea2('0x39')]);var _0x6d0e0c={'where':_0x4a9875[_0x8ea2('0x34')]};return db['WhatsappQueueReport'][_0x8ea2('0x20')](_0x6d0e0c)['then'](function(_0x3f0c78){_0x24f187['count']=_0x3f0c78;if(_0xacaa6c[_0x8ea2('0x2c')][_0x8ea2('0x3a')]){_0x4a9875[_0x8ea2('0x3b')]=[{'all':!![]}];}return db[_0x8ea2('0x28')][_0x8ea2('0x3c')](_0x4a9875);})[_0x8ea2('0x23')](function(_0x2f4fa8){_0x24f187['rows']=_0x2f4fa8;return _0x24f187;})['then'](respondWithFilteredResult(_0x4da5b3,_0x4a9875))[_0x8ea2('0x3d')](handleError(_0x4da5b3,null));};exports['show']=function(_0x4b03fa,_0x59e2fa){var _0x3cbc09={'raw':!![],'where':{'id':_0x4b03fa[_0x8ea2('0x3e')]['id']}},_0x5d9ba0={};_0x5d9ba0[_0x8ea2('0x2e')]=_[_0x8ea2('0x3f')](db[_0x8ea2('0x28')][_0x8ea2('0x29')]);_0x5d9ba0[_0x8ea2('0x2c')]=_[_0x8ea2('0x3f')](_0x4b03fa[_0x8ea2('0x2c')]);_0x5d9ba0['filters']=_[_0x8ea2('0x2d')](_0x5d9ba0[_0x8ea2('0x2e')],_0x5d9ba0[_0x8ea2('0x2c')]);_0x3cbc09['attributes']=_[_0x8ea2('0x2d')](_0x5d9ba0[_0x8ea2('0x2e')],qs[_0x8ea2('0x40')](_0x4b03fa[_0x8ea2('0x2c')][_0x8ea2('0x40')]));_0x3cbc09['attributes']=_0x3cbc09[_0x8ea2('0x2f')][_0x8ea2('0x30')]?_0x3cbc09[_0x8ea2('0x2f')]:_0x5d9ba0['model'];if(_0x4b03fa[_0x8ea2('0x2c')][_0x8ea2('0x3a')]){_0x3cbc09[_0x8ea2('0x3b')]=[{'all':!![]}];}_0x3cbc09=_[_0x8ea2('0x37')]({},_0x3cbc09,_0x4b03fa[_0x8ea2('0x39')]);return db[_0x8ea2('0x28')][_0x8ea2('0x41')](_0x3cbc09)[_0x8ea2('0x23')](handleEntityNotFound(_0x59e2fa,null))[_0x8ea2('0x23')](respondWithResult(_0x59e2fa,null))[_0x8ea2('0x3d')](handleError(_0x59e2fa,null));};exports[_0x8ea2('0x42')]=function(_0x52d203,_0x220970){return db[_0x8ea2('0x28')]['create'](_0x52d203[_0x8ea2('0x43')],{})[_0x8ea2('0x23')](respondWithResult(_0x220970,0xc9))[_0x8ea2('0x3d')](handleError(_0x220970,null));};exports[_0x8ea2('0x22')]=function(_0x182a46,_0x1daa25){if(_0x182a46[_0x8ea2('0x43')]['id']){delete _0x182a46[_0x8ea2('0x43')]['id'];}return db['WhatsappQueueReport'][_0x8ea2('0x41')]({'where':{'id':_0x182a46[_0x8ea2('0x3e')]['id']}})[_0x8ea2('0x23')](handleEntityNotFound(_0x1daa25,null))['then'](saveUpdates(_0x182a46['body'],null))[_0x8ea2('0x23')](respondWithResult(_0x1daa25,null))[_0x8ea2('0x3d')](handleError(_0x1daa25,null));};exports[_0x8ea2('0x44')]=function(_0x5e5c37,_0x3d86f3){return db[_0x8ea2('0x28')][_0x8ea2('0x41')]({'where':{'id':_0x5e5c37[_0x8ea2('0x3e')]['id']}})[_0x8ea2('0x23')](handleEntityNotFound(_0x3d86f3,null))['then'](removeEntity(_0x3d86f3,null))['catch'](handleError(_0x3d86f3,null));};exports[_0x8ea2('0x45')]=function(_0x4148c1,_0x1b8c4b){return db['WhatsappQueueReport'][_0x8ea2('0x45')]()[_0x8ea2('0x23')](respondWithResult(_0x1b8c4b,null))[_0x8ea2('0x3d')](handleError(_0x1b8c4b,null));}; \ No newline at end of file +var _0x5423=['params','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','then','rows','catch','show','WhatsappQueueReport','find','create','body','update'];(function(_0x6ef26d,_0x4250c7){var _0x15579f=function(_0x14e47c){while(--_0x14e47c){_0x6ef26d['push'](_0x6ef26d['shift']());}};_0x15579f(++_0x4250c7);}(_0x5423,0xe3));var _0x3542=function(_0x576af9,_0x4ac436){_0x576af9=_0x576af9-0x0;var _0x5d0e59=_0x5423[_0x576af9];return _0x5d0e59;};'use strict';var emlformat=require(_0x3542('0x0'));var rimraf=require(_0x3542('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3542('0x2'));var rp=require(_0x3542('0x3'));var moment=require('moment');var BPromise=require(_0x3542('0x4'));var Mustache=require(_0x3542('0x5'));var util=require(_0x3542('0x6'));var path=require(_0x3542('0x7'));var sox=require('sox');var csv=require(_0x3542('0x8'));var ejs=require(_0x3542('0x9'));var fs=require('fs');var fs_extra=require(_0x3542('0xa'));var _=require(_0x3542('0xb'));var squel=require(_0x3542('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3542('0xd'));var toCsv=require(_0x3542('0x8'));var querystring=require('querystring');var Papa=require(_0x3542('0xe'));var Redis=require(_0x3542('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x3542('0x10'));var as=require(_0x3542('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3542('0x12'))(_0x3542('0x13'));var utils=require(_0x3542('0x14'));var config=require(_0x3542('0x15'));var licenseUtil=require(_0x3542('0x16'));var db=require(_0x3542('0x17'))['db'];function respondWithStatusCode(_0x1cf710,_0x43e977){_0x43e977=_0x43e977||0xcc;return function(_0x4ee86){if(_0x4ee86){return _0x1cf710[_0x3542('0x18')](_0x43e977);}return _0x1cf710[_0x3542('0x19')](_0x43e977)[_0x3542('0x1a')]();};}function respondWithResult(_0x15863d,_0x4bac5b){_0x4bac5b=_0x4bac5b||0xc8;return function(_0x14fe57){if(_0x14fe57){return _0x15863d['status'](_0x4bac5b)[_0x3542('0x1b')](_0x14fe57);}};}function respondWithFilteredResult(_0x13fe0b,_0xc33d42){return function(_0x546fbd){if(_0x546fbd){var _0x270312=typeof _0xc33d42[_0x3542('0x1c')]===_0x3542('0x1d')&&typeof _0xc33d42['limit']===_0x3542('0x1d');var _0x23b0de=_0x546fbd[_0x3542('0x1e')];var _0x3d5199=_0x270312?0x0:_0xc33d42['offset'];var _0x32df3f=_0x270312?_0x546fbd['count']:_0xc33d42[_0x3542('0x1c')]+_0xc33d42[_0x3542('0x1f')];var _0x4d93bc;if(_0x32df3f>=_0x23b0de){_0x32df3f=_0x23b0de;_0x4d93bc=0xc8;}else{_0x4d93bc=0xce;}_0x13fe0b[_0x3542('0x19')](_0x4d93bc);return _0x13fe0b[_0x3542('0x20')](_0x3542('0x21'),_0x3d5199+'-'+_0x32df3f+'/'+_0x23b0de)[_0x3542('0x1b')](_0x546fbd);}return null;};}function patchUpdates(_0x212950){return function(_0x4a7695){try{jsonpatch['apply'](_0x4a7695,_0x212950,!![]);}catch(_0x4c58f1){return BPromise[_0x3542('0x22')](_0x4c58f1);}return _0x4a7695['save']();};}function saveUpdates(_0x1d5488,_0x551645){return function(_0x1d5f1e){if(_0x1d5f1e){return _0x1d5f1e['update'](_0x1d5488)['then'](function(_0x3eacd0){return _0x3eacd0;});}return null;};}function removeEntity(_0xe3f983,_0x5ae097){return function(_0x5d05b2){if(_0x5d05b2){return _0x5d05b2[_0x3542('0x23')]()['then'](function(){_0xe3f983[_0x3542('0x19')](0xcc)[_0x3542('0x1a')]();});}};}function handleEntityNotFound(_0x1e0723,_0x2f2e63){return function(_0x298763){if(!_0x298763){_0x1e0723[_0x3542('0x18')](0x194);}return _0x298763;};}function handleError(_0x412184,_0x1e156e){_0x1e156e=_0x1e156e||0x1f4;return function(_0x18dc6c){logger[_0x3542('0x24')](_0x18dc6c[_0x3542('0x25')]);if(_0x18dc6c[_0x3542('0x26')]){delete _0x18dc6c[_0x3542('0x26')];}_0x412184[_0x3542('0x19')](_0x1e156e)[_0x3542('0x27')](_0x18dc6c);};}exports[_0x3542('0x28')]=function(_0x303412,_0x20eda1){var _0x3bd666={},_0x5590a2={},_0x31ad47={'count':0x0,'rows':[]};var _0x35bbc9=_[_0x3542('0x29')](db['WhatsappQueueReport'][_0x3542('0x2a')],function(_0xc6f23b){return{'name':_0xc6f23b[_0x3542('0x2b')],'type':_0xc6f23b[_0x3542('0x2c')]['key']};});_0x5590a2['model']=_[_0x3542('0x29')](_0x35bbc9,_0x3542('0x26'));_0x5590a2[_0x3542('0x2d')]=_[_0x3542('0x2e')](_0x303412[_0x3542('0x2d')]);_0x5590a2[_0x3542('0x2f')]=_[_0x3542('0x30')](_0x5590a2['model'],_0x5590a2['query']);_0x3bd666[_0x3542('0x31')]=_['intersection'](_0x5590a2['model'],qs[_0x3542('0x32')](_0x303412['query']['fields']));_0x3bd666[_0x3542('0x31')]=_0x3bd666[_0x3542('0x31')][_0x3542('0x33')]?_0x3bd666['attributes']:_0x5590a2[_0x3542('0x34')];if(!_0x303412['query'][_0x3542('0x35')](_0x3542('0x36'))){_0x3bd666['limit']=qs[_0x3542('0x1f')](_0x303412['query'][_0x3542('0x1f')]);_0x3bd666[_0x3542('0x1c')]=qs[_0x3542('0x1c')](_0x303412['query'][_0x3542('0x1c')]);}_0x3bd666['order']=qs[_0x3542('0x37')](_0x303412[_0x3542('0x2d')][_0x3542('0x37')]);_0x3bd666[_0x3542('0x38')]=qs[_0x3542('0x2f')](_[_0x3542('0x39')](_0x303412[_0x3542('0x2d')],_0x5590a2[_0x3542('0x2f')]),_0x35bbc9);if(_0x303412[_0x3542('0x2d')][_0x3542('0x3a')]){_0x3bd666[_0x3542('0x38')]=_[_0x3542('0x3b')](_0x3bd666[_0x3542('0x38')],{'$or':_['map'](_0x35bbc9,function(_0x62429){if(_0x62429['type']!=='VIRTUAL'){var _0x2782f2={};_0x2782f2[_0x62429[_0x3542('0x26')]]={'$like':'%'+_0x303412[_0x3542('0x2d')][_0x3542('0x3a')]+'%'};return _0x2782f2;}})});}_0x3bd666=_[_0x3542('0x3b')]({},_0x3bd666,_0x303412[_0x3542('0x3c')]);var _0xc7f13c={'where':_0x3bd666[_0x3542('0x38')]};return db['WhatsappQueueReport'][_0x3542('0x1e')](_0xc7f13c)['then'](function(_0x1c8855){_0x31ad47[_0x3542('0x1e')]=_0x1c8855;if(_0x303412['query'][_0x3542('0x3d')]){_0x3bd666[_0x3542('0x3e')]=[{'all':!![]}];}return db['WhatsappQueueReport'][_0x3542('0x3f')](_0x3bd666);})[_0x3542('0x40')](function(_0x5e1b29){_0x31ad47[_0x3542('0x41')]=_0x5e1b29;return _0x31ad47;})[_0x3542('0x40')](respondWithFilteredResult(_0x20eda1,_0x3bd666))[_0x3542('0x42')](handleError(_0x20eda1,null));};exports[_0x3542('0x43')]=function(_0x290c7c,_0xb12441){var _0x2b54b9={'raw':!![],'where':{'id':_0x290c7c['params']['id']}},_0x4bf45a={};_0x4bf45a[_0x3542('0x34')]=_[_0x3542('0x2e')](db[_0x3542('0x44')][_0x3542('0x2a')]);_0x4bf45a[_0x3542('0x2d')]=_['keys'](_0x290c7c[_0x3542('0x2d')]);_0x4bf45a['filters']=_[_0x3542('0x30')](_0x4bf45a[_0x3542('0x34')],_0x4bf45a[_0x3542('0x2d')]);_0x2b54b9['attributes']=_[_0x3542('0x30')](_0x4bf45a[_0x3542('0x34')],qs['fields'](_0x290c7c[_0x3542('0x2d')][_0x3542('0x32')]));_0x2b54b9[_0x3542('0x31')]=_0x2b54b9[_0x3542('0x31')][_0x3542('0x33')]?_0x2b54b9[_0x3542('0x31')]:_0x4bf45a[_0x3542('0x34')];if(_0x290c7c[_0x3542('0x2d')]['includeAll']){_0x2b54b9['include']=[{'all':!![]}];}_0x2b54b9=_['merge']({},_0x2b54b9,_0x290c7c[_0x3542('0x3c')]);return db[_0x3542('0x44')][_0x3542('0x45')](_0x2b54b9)[_0x3542('0x40')](handleEntityNotFound(_0xb12441,null))[_0x3542('0x40')](respondWithResult(_0xb12441,null))[_0x3542('0x42')](handleError(_0xb12441,null));};exports[_0x3542('0x46')]=function(_0x5adf34,_0x157683){return db[_0x3542('0x44')][_0x3542('0x46')](_0x5adf34[_0x3542('0x47')],{})['then'](respondWithResult(_0x157683,0xc9))[_0x3542('0x42')](handleError(_0x157683,null));};exports[_0x3542('0x48')]=function(_0x55b43a,_0x528f8c){if(_0x55b43a[_0x3542('0x47')]['id']){delete _0x55b43a[_0x3542('0x47')]['id'];}return db[_0x3542('0x44')][_0x3542('0x45')]({'where':{'id':_0x55b43a[_0x3542('0x49')]['id']}})[_0x3542('0x40')](handleEntityNotFound(_0x528f8c,null))[_0x3542('0x40')](saveUpdates(_0x55b43a['body'],null))[_0x3542('0x40')](respondWithResult(_0x528f8c,null))[_0x3542('0x42')](handleError(_0x528f8c,null));};exports[_0x3542('0x23')]=function(_0x392c6e,_0x1ebc82){return db[_0x3542('0x44')][_0x3542('0x45')]({'where':{'id':_0x392c6e[_0x3542('0x49')]['id']}})[_0x3542('0x40')](handleEntityNotFound(_0x1ebc82,null))['then'](removeEntity(_0x1ebc82,null))['catch'](handleError(_0x1ebc82,null));};exports[_0x3542('0x4a')]=function(_0x4b406b,_0x5a798a){return db['WhatsappQueueReport'][_0x3542('0x4a')]()[_0x3542('0x40')](respondWithResult(_0x5a798a,null))[_0x3542('0x42')](handleError(_0x5a798a,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index fe1a072..c252d26 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 _0xc39c=['../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','api','moment','path'];(function(_0x34bcc3,_0x227cfd){var _0x2e8776=function(_0x13eb85){while(--_0x13eb85){_0x34bcc3['push'](_0x34bcc3['shift']());}};_0x2e8776(++_0x227cfd);}(_0xc39c,0x96));var _0xcc39=function(_0xbd02fb,_0x43c283){_0xbd02fb=_0xbd02fb-0x0;var _0x32a5cf=_0xc39c[_0xbd02fb];return _0x32a5cf;};'use strict';var _=require(_0xcc39('0x0'));var util=require(_0xcc39('0x1'));var logger=require(_0xcc39('0x2'))(_0xcc39('0x3'));var moment=require(_0xcc39('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xcc39('0x5'));var rimraf=require('rimraf');var config=require(_0xcc39('0x6'));var attributes=require(_0xcc39('0x7'));module[_0xcc39('0x8')]=function(_0x320352,_0x4f00a7){return _0x320352[_0xcc39('0x9')](_0xcc39('0xa'),attributes,{'tableName':_0xcc39('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xcc39('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0ed3=['exports','define','report_whatsapp_queue','uniqueid','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes'];(function(_0x313b2a,_0x5a490f){var _0x53eb6f=function(_0x4eaead){while(--_0x4eaead){_0x313b2a['push'](_0x313b2a['shift']());}};_0x53eb6f(++_0x5a490f);}(_0x0ed3,0x70));var _0x30ed=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0ed3[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x30ed('0x0'))(_0x30ed('0x1'));var moment=require('moment');var BPromise=require(_0x30ed('0x2'));var rp=require(_0x30ed('0x3'));var fs=require('fs');var path=require(_0x30ed('0x4'));var rimraf=require(_0x30ed('0x5'));var config=require(_0x30ed('0x6'));var attributes=require(_0x30ed('0x7'));module[_0x30ed('0x8')]=function(_0x281e81,_0x59e0b0){return _0x281e81[_0x30ed('0x9')]('WhatsappQueueReport',attributes,{'tableName':_0x30ed('0xa'),'paranoid':![],'indexes':[{'name':_0x30ed('0xb'),'fields':[_0x30ed('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 94a051f..258ab9a 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 _0xfc45=['update','body','options','where','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','info','WhatsappQueueReport,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','raw','stringify','UpdateWhatsappQueueReport'];(function(_0x22bee0,_0x412ecb){var _0x2d295b=function(_0x59d4b5){while(--_0x59d4b5){_0x22bee0['push'](_0x22bee0['shift']());}};_0x2d295b(++_0x412ecb);}(_0xfc45,0xab));var _0x5fc4=function(_0x176ead,_0x5286fd){_0x176ead=_0x176ead-0x0;var _0x51104f=_0xfc45[_0x176ead];return _0x51104f;};'use strict';var _=require(_0x5fc4('0x0'));var util=require(_0x5fc4('0x1'));var moment=require('moment');var BPromise=require(_0x5fc4('0x2'));var rs=require(_0x5fc4('0x3'));var fs=require('fs');var Redis=require(_0x5fc4('0x4'));var db=require(_0x5fc4('0x5'))['db'];var utils=require(_0x5fc4('0x6'));var logger=require(_0x5fc4('0x7'))('rpc');var config=require(_0x5fc4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5fc4('0x9')][_0x5fc4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x387ea8,_0xaa1de9,_0x39ffc0){return new BPromise(function(_0x416534,_0x3b5303){return client['request'](_0x387ea8,_0x39ffc0)[_0x5fc4('0xb')](function(_0x1fe614){logger[_0x5fc4('0xc')](_0x5fc4('0xd'),_0xaa1de9,'request\x20sent');logger[_0x5fc4('0xe')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0xaa1de9,_0x5fc4('0xf'),JSON['stringify'](_0x1fe614));if(_0x1fe614[_0x5fc4('0x10')]){if(_0x1fe614[_0x5fc4('0x10')][_0x5fc4('0x11')]===0x1f4){logger[_0x5fc4('0x10')](_0x5fc4('0xd'),_0xaa1de9,_0x1fe614['error']['message']);return _0x3b5303(_0x1fe614['error']['message']);}logger['error'](_0x5fc4('0xd'),_0xaa1de9,_0x1fe614['error'][_0x5fc4('0x12')]);return _0x416534(_0x1fe614['error'][_0x5fc4('0x12')]);}else{logger[_0x5fc4('0xc')](_0x5fc4('0xd'),_0xaa1de9,_0x5fc4('0xf'));_0x416534(_0x1fe614[_0x5fc4('0x13')][_0x5fc4('0x12')]);}})[_0x5fc4('0x14')](function(_0x2990b2){logger['error'](_0x5fc4('0xd'),_0xaa1de9,_0x2990b2);_0x3b5303(_0x2990b2);});});}exports[_0x5fc4('0x15')]=function(_0x497b05){var _0x2faefb=this;return new Promise(function(_0x1f0156,_0x520e99){return db[_0x5fc4('0x16')][_0x5fc4('0x17')](_0x497b05['body'],{'raw':_0x497b05['options']?_0x497b05['options'][_0x5fc4('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x2d1a2e){logger['info'](_0x5fc4('0x15'),_0x497b05);logger[_0x5fc4('0xe')](_0x5fc4('0x15'),_0x497b05,JSON[_0x5fc4('0x19')](_0x2d1a2e));_0x1f0156(_0x2d1a2e);})[_0x5fc4('0x14')](function(_0x32da45){logger[_0x5fc4('0x10')](_0x5fc4('0x15'),_0x32da45['message'],_0x497b05);_0x520e99(_0x2faefb['error'](0x1f4,_0x32da45[_0x5fc4('0x12')]));});});};exports[_0x5fc4('0x1a')]=function(_0x5e7126){var _0x5d6996=this;return new Promise(function(_0x17c4db,_0x10769e){return db[_0x5fc4('0x16')][_0x5fc4('0x1b')](_0x5e7126[_0x5fc4('0x1c')],{'raw':_0x5e7126[_0x5fc4('0x1d')]?_0x5e7126[_0x5fc4('0x1d')][_0x5fc4('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e7126[_0x5fc4('0x1d')]?_0x5e7126[_0x5fc4('0x1d')][_0x5fc4('0x1e')]||null:null,'attributes':_0x5e7126['options']?_0x5e7126['options'][_0x5fc4('0x1f')]||null:null,'limit':_0x5e7126[_0x5fc4('0x1d')]?_0x5e7126[_0x5fc4('0x1d')][_0x5fc4('0x20')]||null:null})[_0x5fc4('0xb')](function(_0x5f20e4){logger['info'](_0x5fc4('0x1a'),_0x5e7126);logger[_0x5fc4('0xe')](_0x5fc4('0x1a'),_0x5e7126,JSON[_0x5fc4('0x19')](_0x5f20e4));_0x17c4db(_0x5f20e4);})[_0x5fc4('0x14')](function(_0x112c3f){logger['error'](_0x5fc4('0x1a'),_0x112c3f[_0x5fc4('0x12')],_0x5e7126);_0x10769e(_0x5d6996[_0x5fc4('0x10')](0x1f4,_0x112c3f[_0x5fc4('0x12')]));});});}; \ No newline at end of file +var _0x8048=['UpdateWhatsappQueueReport','update','options','where','attributes','limit','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','WhatsappQueueReport','create','body','raw','CreateWhatsappQueueReport','debug'];(function(_0x2e6ab8,_0x4ea85c){var _0x16cba0=function(_0x4b3776){while(--_0x4b3776){_0x2e6ab8['push'](_0x2e6ab8['shift']());}};_0x16cba0(++_0x4ea85c);}(_0x8048,0x166));var _0x8804=function(_0x205ed2,_0x248ed0){_0x205ed2=_0x205ed2-0x0;var _0x540c3b=_0x8048[_0x205ed2];return _0x540c3b;};'use strict';var _=require('lodash');var util=require(_0x8804('0x0'));var moment=require(_0x8804('0x1'));var BPromise=require(_0x8804('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8804('0x3'));var db=require(_0x8804('0x4'))['db'];var utils=require(_0x8804('0x5'));var logger=require(_0x8804('0x6'))('rpc');var config=require(_0x8804('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8804('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5ef2ee,_0x1373e2,_0x2ce8a6){return new BPromise(function(_0x35eb20,_0x37d836){return client[_0x8804('0x9')](_0x5ef2ee,_0x2ce8a6)[_0x8804('0xa')](function(_0x317c4d){logger[_0x8804('0xb')](_0x8804('0xc'),_0x1373e2,_0x8804('0xd'));logger['debug'](_0x8804('0xe'),_0x1373e2,'request\x20sent',JSON[_0x8804('0xf')](_0x317c4d));if(_0x317c4d[_0x8804('0x10')]){if(_0x317c4d[_0x8804('0x10')]['code']===0x1f4){logger[_0x8804('0x10')](_0x8804('0xc'),_0x1373e2,_0x317c4d['error'][_0x8804('0x11')]);return _0x37d836(_0x317c4d[_0x8804('0x10')][_0x8804('0x11')]);}logger[_0x8804('0x10')]('WhatsappQueueReport,\x20%s,\x20%s',_0x1373e2,_0x317c4d[_0x8804('0x10')][_0x8804('0x11')]);return _0x35eb20(_0x317c4d[_0x8804('0x10')][_0x8804('0x11')]);}else{logger[_0x8804('0xb')]('WhatsappQueueReport,\x20%s,\x20%s',_0x1373e2,'request\x20sent');_0x35eb20(_0x317c4d[_0x8804('0x12')][_0x8804('0x11')]);}})[_0x8804('0x13')](function(_0x52caa4){logger[_0x8804('0x10')]('WhatsappQueueReport,\x20%s,\x20%s',_0x1373e2,_0x52caa4);_0x37d836(_0x52caa4);});});}exports['CreateWhatsappQueueReport']=function(_0x41dcc4){var _0x587168=this;return new Promise(function(_0x44e478,_0x51a86d){return db[_0x8804('0x14')][_0x8804('0x15')](_0x41dcc4[_0x8804('0x16')],{'raw':_0x41dcc4['options']?_0x41dcc4['options'][_0x8804('0x17')]===undefined?!![]:![]:!![]})[_0x8804('0xa')](function(_0x1f45dd){logger['info'](_0x8804('0x18'),_0x41dcc4);logger[_0x8804('0x19')]('CreateWhatsappQueueReport',_0x41dcc4,JSON['stringify'](_0x1f45dd));_0x44e478(_0x1f45dd);})['catch'](function(_0x2b259c){logger[_0x8804('0x10')]('CreateWhatsappQueueReport',_0x2b259c[_0x8804('0x11')],_0x41dcc4);_0x51a86d(_0x587168[_0x8804('0x10')](0x1f4,_0x2b259c['message']));});});};exports[_0x8804('0x1a')]=function(_0x35e4c2){var _0x165e16=this;return new Promise(function(_0x24728f,_0x23456c){return db[_0x8804('0x14')][_0x8804('0x1b')](_0x35e4c2[_0x8804('0x16')],{'raw':_0x35e4c2[_0x8804('0x1c')]?_0x35e4c2[_0x8804('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x35e4c2['options']?_0x35e4c2[_0x8804('0x1c')][_0x8804('0x1d')]||null:null,'attributes':_0x35e4c2[_0x8804('0x1c')]?_0x35e4c2[_0x8804('0x1c')][_0x8804('0x1e')]||null:null,'limit':_0x35e4c2[_0x8804('0x1c')]?_0x35e4c2[_0x8804('0x1c')][_0x8804('0x1f')]||null:null})[_0x8804('0xa')](function(_0x32b4a8){logger[_0x8804('0xb')](_0x8804('0x1a'),_0x35e4c2);logger[_0x8804('0x19')](_0x8804('0x1a'),_0x35e4c2,JSON['stringify'](_0x32b4a8));_0x24728f(_0x32b4a8);})[_0x8804('0x13')](function(_0x3fe3e4){logger[_0x8804('0x10')](_0x8804('0x1a'),_0x3fe3e4[_0x8804('0x11')],_0x35e4c2);_0x23456c(_0x165e16['error'](0x1f4,_0x3fe3e4[_0x8804('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 4a291f9..e4f2462 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 _0x0cf4=['index','/describe','describe','/:id','show','post','create','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','./whatsappTransferReport.controller','get','isAuthenticated'];(function(_0x4c9cd5,_0x4432a0){var _0x1118d8=function(_0x5cb7e9){while(--_0x5cb7e9){_0x4c9cd5['push'](_0x4c9cd5['shift']());}};_0x1118d8(++_0x4432a0);}(_0x0cf4,0x1d2));var _0x40cf=function(_0x3330b8,_0x19b32a){_0x3330b8=_0x3330b8-0x0;var _0x191799=_0x0cf4[_0x3330b8];return _0x191799;};'use strict';var multer=require(_0x40cf('0x0'));var util=require(_0x40cf('0x1'));var path=require(_0x40cf('0x2'));var timeout=require(_0x40cf('0x3'));var express=require('express');var router=express[_0x40cf('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x40cf('0x5'));var config=require('../../config/environment');var controller=require(_0x40cf('0x6'));router[_0x40cf('0x7')]('/',auth[_0x40cf('0x8')](),controller[_0x40cf('0x9')]);router[_0x40cf('0x7')](_0x40cf('0xa'),auth['isAuthenticated'](),controller[_0x40cf('0xb')]);router['get'](_0x40cf('0xc'),auth[_0x40cf('0x8')](),controller[_0x40cf('0xd')]);router[_0x40cf('0xe')]('/',auth[_0x40cf('0x8')](),controller[_0x40cf('0xf')]);router['put'](_0x40cf('0xc'),auth['isAuthenticated'](),controller[_0x40cf('0x10')]);router[_0x40cf('0x11')]('/:id',auth[_0x40cf('0x8')](),controller['destroy']);module[_0x40cf('0x12')]=router; \ No newline at end of file +var _0x8f2e=['isAuthenticated','describe','get','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../config/environment'];(function(_0x4c4cfb,_0xd38b7f){var _0x537d4f=function(_0x581428){while(--_0x581428){_0x4c4cfb['push'](_0x4c4cfb['shift']());}};_0x537d4f(++_0xd38b7f);}(_0x8f2e,0x174));var _0xe8f2=function(_0x49f9aa,_0x529ea8){_0x49f9aa=_0x49f9aa-0x0;var _0x59a6fa=_0x8f2e[_0x49f9aa];return _0x59a6fa;};'use strict';var multer=require(_0xe8f2('0x0'));var util=require('util');var path=require(_0xe8f2('0x1'));var timeout=require(_0xe8f2('0x2'));var express=require('express');var router=express[_0xe8f2('0x3')]();var fs_extra=require(_0xe8f2('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe8f2('0x5'));var controller=require('./whatsappTransferReport.controller');router['get']('/',auth[_0xe8f2('0x6')](),controller['index']);router['get']('/describe',auth[_0xe8f2('0x6')](),controller[_0xe8f2('0x7')]);router[_0xe8f2('0x8')](_0xe8f2('0x9'),auth[_0xe8f2('0x6')](),controller[_0xe8f2('0xa')]);router[_0xe8f2('0xb')]('/',auth[_0xe8f2('0x6')](),controller[_0xe8f2('0xc')]);router[_0xe8f2('0xd')](_0xe8f2('0x9'),auth['isAuthenticated'](),controller[_0xe8f2('0xe')]);router[_0xe8f2('0xf')](_0xe8f2('0x9'),auth['isAuthenticated'](),controller[_0xe8f2('0x10')]);module[_0xe8f2('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 8f2d833..61be5a6 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 _0xd05a=['STRING','DATE','exports'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0xd05a,0x143));var _0xad05=function(_0xea8af,_0x19a569){_0xea8af=_0xea8af-0x0;var _0x54bdcc=_0xd05a[_0xea8af];return _0x54bdcc;};'use strict';var Sequelize=require('sequelize');module[_0xad05('0x0')]={'uniqueid':{'type':Sequelize[_0xad05('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('account','agent','queue'),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xad05('0x2')]}}; \ No newline at end of file +var _0xb7e7=['queue','sequelize','STRING','account'];(function(_0x5b5ff3,_0x438f3a){var _0xbd7f3b=function(_0x175a40){while(--_0x175a40){_0x5b5ff3['push'](_0x5b5ff3['shift']());}};_0xbd7f3b(++_0x438f3a);}(_0xb7e7,0x121));var _0x7b7e=function(_0x9fd887,_0x47f76c){_0x9fd887=_0x9fd887-0x0;var _0x1a54ab=_0xb7e7[_0x9fd887];return _0x1a54ab;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x7b7e('0x2'),'agent',_0x7b7e('0x3')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 9885de1..bbbff29 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 _0xd35e=['WhatsappTransferReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','pick','filter','merge','options','where','include','findAll','rows','catch','show','rawAttributes','includeAll','find','create','body','params','eml-format','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/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','apply','reject','save','update','then','destroy','error','stack','name','send','index','map'];(function(_0x419e8f,_0x7ccc7b){var _0x55cceb=function(_0x1bf86b){while(--_0x1bf86b){_0x419e8f['push'](_0x419e8f['shift']());}};_0x55cceb(++_0x7ccc7b);}(_0xd35e,0x14a));var _0xed35=function(_0x4d3a2b,_0x32a224){_0x4d3a2b=_0x4d3a2b-0x0;var _0xdd32c8=_0xd35e[_0x4d3a2b];return _0xdd32c8;};'use strict';var emlformat=require(_0xed35('0x0'));var rimraf=require(_0xed35('0x1'));var zipdir=require(_0xed35('0x2'));var jsonpatch=require(_0xed35('0x3'));var rp=require(_0xed35('0x4'));var moment=require(_0xed35('0x5'));var BPromise=require(_0xed35('0x6'));var Mustache=require(_0xed35('0x7'));var util=require(_0xed35('0x8'));var path=require(_0xed35('0x9'));var sox=require(_0xed35('0xa'));var csv=require(_0xed35('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xed35('0xc'));var _=require(_0xed35('0xd'));var squel=require(_0xed35('0xe'));var crypto=require('crypto');var jsforce=require(_0xed35('0xf'));var deskjs=require(_0xed35('0x10'));var toCsv=require(_0xed35('0xb'));var querystring=require('querystring');var Papa=require(_0xed35('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xed35('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xed35('0x13'))(_0xed35('0x14'));var utils=require(_0xed35('0x15'));var config=require(_0xed35('0x16'));var licenseUtil=require(_0xed35('0x17'));var db=require(_0xed35('0x18'))['db'];function respondWithStatusCode(_0x4c16df,_0x46f1be){_0x46f1be=_0x46f1be||0xcc;return function(_0x1a708e){if(_0x1a708e){return _0x4c16df[_0xed35('0x19')](_0x46f1be);}return _0x4c16df[_0xed35('0x1a')](_0x46f1be)[_0xed35('0x1b')]();};}function respondWithResult(_0x521525,_0x535e76){_0x535e76=_0x535e76||0xc8;return function(_0x17bc91){if(_0x17bc91){return _0x521525['status'](_0x535e76)[_0xed35('0x1c')](_0x17bc91);}};}function respondWithFilteredResult(_0x10e9f0,_0x5f1ac7){return function(_0x35f195){if(_0x35f195){var _0x1cfc00=typeof _0x5f1ac7['offset']===_0xed35('0x1d')&&typeof _0x5f1ac7[_0xed35('0x1e')]===_0xed35('0x1d');var _0x393481=_0x35f195[_0xed35('0x1f')];var _0x489804=_0x1cfc00?0x0:_0x5f1ac7[_0xed35('0x20')];var _0x1f49c3=_0x1cfc00?_0x35f195[_0xed35('0x1f')]:_0x5f1ac7[_0xed35('0x20')]+_0x5f1ac7[_0xed35('0x1e')];var _0x3deedb;if(_0x1f49c3>=_0x393481){_0x1f49c3=_0x393481;_0x3deedb=0xc8;}else{_0x3deedb=0xce;}_0x10e9f0[_0xed35('0x1a')](_0x3deedb);return _0x10e9f0['set']('Content-Range',_0x489804+'-'+_0x1f49c3+'/'+_0x393481)[_0xed35('0x1c')](_0x35f195);}return null;};}function patchUpdates(_0x20ae85){return function(_0x4ff391){try{jsonpatch[_0xed35('0x21')](_0x4ff391,_0x20ae85,!![]);}catch(_0x62d5cb){return BPromise[_0xed35('0x22')](_0x62d5cb);}return _0x4ff391[_0xed35('0x23')]();};}function saveUpdates(_0x145cd2,_0x3b9f6e){return function(_0x2dde67){if(_0x2dde67){return _0x2dde67[_0xed35('0x24')](_0x145cd2)[_0xed35('0x25')](function(_0x2e1305){return _0x2e1305;});}return null;};}function removeEntity(_0xadb1e4,_0x43f53e){return function(_0x31d0eb){if(_0x31d0eb){return _0x31d0eb[_0xed35('0x26')]()['then'](function(){_0xadb1e4[_0xed35('0x1a')](0xcc)[_0xed35('0x1b')]();});}};}function handleEntityNotFound(_0x57f023,_0x58ea52){return function(_0x34efd6){if(!_0x34efd6){_0x57f023['sendStatus'](0x194);}return _0x34efd6;};}function handleError(_0x50370b,_0xdeb774){_0xdeb774=_0xdeb774||0x1f4;return function(_0x2f9a99){logger[_0xed35('0x27')](_0x2f9a99[_0xed35('0x28')]);if(_0x2f9a99[_0xed35('0x29')]){delete _0x2f9a99[_0xed35('0x29')];}_0x50370b['status'](_0xdeb774)[_0xed35('0x2a')](_0x2f9a99);};}exports[_0xed35('0x2b')]=function(_0x332853,_0x5c38e5){var _0x16f005={},_0x23d552={},_0x37825f={'count':0x0,'rows':[]};var _0xbfb3e=_[_0xed35('0x2c')](db[_0xed35('0x2d')]['rawAttributes'],function(_0xaacf48){return{'name':_0xaacf48[_0xed35('0x2e')],'type':_0xaacf48[_0xed35('0x2f')][_0xed35('0x30')]};});_0x23d552[_0xed35('0x31')]=_[_0xed35('0x2c')](_0xbfb3e,_0xed35('0x29'));_0x23d552[_0xed35('0x32')]=_[_0xed35('0x33')](_0x332853[_0xed35('0x32')]);_0x23d552[_0xed35('0x34')]=_[_0xed35('0x35')](_0x23d552[_0xed35('0x31')],_0x23d552[_0xed35('0x32')]);_0x16f005[_0xed35('0x36')]=_['intersection'](_0x23d552[_0xed35('0x31')],qs[_0xed35('0x37')](_0x332853[_0xed35('0x32')]['fields']));_0x16f005['attributes']=_0x16f005[_0xed35('0x36')][_0xed35('0x38')]?_0x16f005[_0xed35('0x36')]:_0x23d552[_0xed35('0x31')];if(!_0x332853[_0xed35('0x32')]['hasOwnProperty'](_0xed35('0x39'))){_0x16f005[_0xed35('0x1e')]=qs['limit'](_0x332853[_0xed35('0x32')][_0xed35('0x1e')]);_0x16f005[_0xed35('0x20')]=qs[_0xed35('0x20')](_0x332853[_0xed35('0x32')]['offset']);}_0x16f005['order']=qs[_0xed35('0x3a')](_0x332853[_0xed35('0x32')][_0xed35('0x3a')]);_0x16f005['where']=qs[_0xed35('0x34')](_[_0xed35('0x3b')](_0x332853[_0xed35('0x32')],_0x23d552['filters']),_0xbfb3e);if(_0x332853['query']['filter']){_0x16f005['where']=_['merge'](_0x16f005['where'],{'$or':_[_0xed35('0x2c')](_0xbfb3e,function(_0x1beb38){if(_0x1beb38['type']!=='VIRTUAL'){var _0x2bcaa9={};_0x2bcaa9[_0x1beb38[_0xed35('0x29')]]={'$like':'%'+_0x332853[_0xed35('0x32')][_0xed35('0x3c')]+'%'};return _0x2bcaa9;}})});}_0x16f005=_[_0xed35('0x3d')]({},_0x16f005,_0x332853[_0xed35('0x3e')]);var _0x3c94d2={'where':_0x16f005[_0xed35('0x3f')]};return db['WhatsappTransferReport'][_0xed35('0x1f')](_0x3c94d2)[_0xed35('0x25')](function(_0x39782d){_0x37825f[_0xed35('0x1f')]=_0x39782d;if(_0x332853[_0xed35('0x32')]['includeAll']){_0x16f005[_0xed35('0x40')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0xed35('0x41')](_0x16f005);})[_0xed35('0x25')](function(_0x26cc3c){_0x37825f[_0xed35('0x42')]=_0x26cc3c;return _0x37825f;})[_0xed35('0x25')](respondWithFilteredResult(_0x5c38e5,_0x16f005))[_0xed35('0x43')](handleError(_0x5c38e5,null));};exports[_0xed35('0x44')]=function(_0x5b7fef,_0x247f7f){var _0x304fdb={'raw':!![],'where':{'id':_0x5b7fef['params']['id']}},_0x59fe4b={};_0x59fe4b[_0xed35('0x31')]=_['keys'](db[_0xed35('0x2d')][_0xed35('0x45')]);_0x59fe4b['query']=_[_0xed35('0x33')](_0x5b7fef[_0xed35('0x32')]);_0x59fe4b['filters']=_[_0xed35('0x35')](_0x59fe4b['model'],_0x59fe4b[_0xed35('0x32')]);_0x304fdb['attributes']=_[_0xed35('0x35')](_0x59fe4b['model'],qs['fields'](_0x5b7fef[_0xed35('0x32')][_0xed35('0x37')]));_0x304fdb[_0xed35('0x36')]=_0x304fdb[_0xed35('0x36')][_0xed35('0x38')]?_0x304fdb[_0xed35('0x36')]:_0x59fe4b[_0xed35('0x31')];if(_0x5b7fef[_0xed35('0x32')][_0xed35('0x46')]){_0x304fdb[_0xed35('0x40')]=[{'all':!![]}];}_0x304fdb=_[_0xed35('0x3d')]({},_0x304fdb,_0x5b7fef[_0xed35('0x3e')]);return db['WhatsappTransferReport'][_0xed35('0x47')](_0x304fdb)[_0xed35('0x25')](handleEntityNotFound(_0x247f7f,null))['then'](respondWithResult(_0x247f7f,null))['catch'](handleError(_0x247f7f,null));};exports[_0xed35('0x48')]=function(_0x30eb83,_0x3d2556){return db[_0xed35('0x2d')][_0xed35('0x48')](_0x30eb83[_0xed35('0x49')],{})[_0xed35('0x25')](respondWithResult(_0x3d2556,0xc9))[_0xed35('0x43')](handleError(_0x3d2556,null));};exports[_0xed35('0x24')]=function(_0x5db168,_0x4a2a58){if(_0x5db168[_0xed35('0x49')]['id']){delete _0x5db168[_0xed35('0x49')]['id'];}return db[_0xed35('0x2d')][_0xed35('0x47')]({'where':{'id':_0x5db168[_0xed35('0x4a')]['id']}})[_0xed35('0x25')](handleEntityNotFound(_0x4a2a58,null))[_0xed35('0x25')](saveUpdates(_0x5db168[_0xed35('0x49')],null))[_0xed35('0x25')](respondWithResult(_0x4a2a58,null))[_0xed35('0x43')](handleError(_0x4a2a58,null));};exports[_0xed35('0x26')]=function(_0xa92d5,_0x575ec2){return db['WhatsappTransferReport']['find']({'where':{'id':_0xa92d5[_0xed35('0x4a')]['id']}})['then'](handleEntityNotFound(_0x575ec2,null))[_0xed35('0x25')](removeEntity(_0x575ec2,null))[_0xed35('0x43')](handleError(_0x575ec2,null));};exports['describe']=function(_0x40fecf,_0x42629e){return db[_0xed35('0x2d')]['describe']()[_0xed35('0x25')](respondWithResult(_0x42629e,null))['catch'](handleError(_0x42629e,null));}; \ No newline at end of file +var _0x06fb=['name','index','map','WhatsappTransferReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','rows','catch','show','create','body','find','params','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack'];(function(_0x1d1963,_0x32cc0e){var _0x3f58bb=function(_0x514823){while(--_0x514823){_0x1d1963['push'](_0x1d1963['shift']());}};_0x3f58bb(++_0x32cc0e);}(_0x06fb,0x190));var _0xb06f=function(_0x33cd42,_0x37725a){_0x33cd42=_0x33cd42-0x0;var _0x234c55=_0x06fb[_0x33cd42];return _0x234c55;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb06f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb06f('0x1'));var rp=require(_0xb06f('0x2'));var moment=require(_0xb06f('0x3'));var BPromise=require(_0xb06f('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xb06f('0x5'));var csv=require(_0xb06f('0x6'));var ejs=require(_0xb06f('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb06f('0x8'));var squel=require(_0xb06f('0x9'));var crypto=require(_0xb06f('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xb06f('0xb'));var toCsv=require(_0xb06f('0x6'));var querystring=require(_0xb06f('0xc'));var Papa=require(_0xb06f('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb06f('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb06f('0xf'))(_0xb06f('0x10'));var utils=require(_0xb06f('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xb06f('0x12'));var db=require(_0xb06f('0x13'))['db'];function respondWithStatusCode(_0x1112a6,_0x276d71){_0x276d71=_0x276d71||0xcc;return function(_0x2718e5){if(_0x2718e5){return _0x1112a6[_0xb06f('0x14')](_0x276d71);}return _0x1112a6[_0xb06f('0x15')](_0x276d71)[_0xb06f('0x16')]();};}function respondWithResult(_0x1df133,_0x6c3e27){_0x6c3e27=_0x6c3e27||0xc8;return function(_0x2a8c5d){if(_0x2a8c5d){return _0x1df133[_0xb06f('0x15')](_0x6c3e27)[_0xb06f('0x17')](_0x2a8c5d);}};}function respondWithFilteredResult(_0x324fa8,_0x4eb34b){return function(_0x5df55e){if(_0x5df55e){var _0x591a9f=typeof _0x4eb34b[_0xb06f('0x18')]===_0xb06f('0x19')&&typeof _0x4eb34b['limit']===_0xb06f('0x19');var _0x3efc2d=_0x5df55e['count'];var _0x2bac5e=_0x591a9f?0x0:_0x4eb34b['offset'];var _0x34214b=_0x591a9f?_0x5df55e[_0xb06f('0x1a')]:_0x4eb34b[_0xb06f('0x18')]+_0x4eb34b[_0xb06f('0x1b')];var _0x5bc3db;if(_0x34214b>=_0x3efc2d){_0x34214b=_0x3efc2d;_0x5bc3db=0xc8;}else{_0x5bc3db=0xce;}_0x324fa8[_0xb06f('0x15')](_0x5bc3db);return _0x324fa8[_0xb06f('0x1c')](_0xb06f('0x1d'),_0x2bac5e+'-'+_0x34214b+'/'+_0x3efc2d)[_0xb06f('0x17')](_0x5df55e);}return null;};}function patchUpdates(_0x3ee12a){return function(_0x3b81b9){try{jsonpatch[_0xb06f('0x1e')](_0x3b81b9,_0x3ee12a,!![]);}catch(_0xdc2c3b){return BPromise[_0xb06f('0x1f')](_0xdc2c3b);}return _0x3b81b9[_0xb06f('0x20')]();};}function saveUpdates(_0x42ae61,_0x20a23e){return function(_0x4ea5c6){if(_0x4ea5c6){return _0x4ea5c6[_0xb06f('0x21')](_0x42ae61)['then'](function(_0x3ad61e){return _0x3ad61e;});}return null;};}function removeEntity(_0x38a8b3,_0x2f35a1){return function(_0xef23f2){if(_0xef23f2){return _0xef23f2[_0xb06f('0x22')]()[_0xb06f('0x23')](function(){_0x38a8b3[_0xb06f('0x15')](0xcc)[_0xb06f('0x16')]();});}};}function handleEntityNotFound(_0x1d9524,_0x50892d){return function(_0x1d4c7a){if(!_0x1d4c7a){_0x1d9524[_0xb06f('0x14')](0x194);}return _0x1d4c7a;};}function handleError(_0x359ed0,_0x1e1bc2){_0x1e1bc2=_0x1e1bc2||0x1f4;return function(_0x441192){logger[_0xb06f('0x24')](_0x441192[_0xb06f('0x25')]);if(_0x441192[_0xb06f('0x26')]){delete _0x441192['name'];}_0x359ed0[_0xb06f('0x15')](_0x1e1bc2)['send'](_0x441192);};}exports[_0xb06f('0x27')]=function(_0x4bee19,_0x50f323){var _0x1785e3={},_0x4c92b4={},_0x3a5979={'count':0x0,'rows':[]};var _0x480f21=_[_0xb06f('0x28')](db[_0xb06f('0x29')][_0xb06f('0x2a')],function(_0x3da2cf){return{'name':_0x3da2cf[_0xb06f('0x2b')],'type':_0x3da2cf['type'][_0xb06f('0x2c')]};});_0x4c92b4[_0xb06f('0x2d')]=_[_0xb06f('0x28')](_0x480f21,_0xb06f('0x26'));_0x4c92b4[_0xb06f('0x2e')]=_[_0xb06f('0x2f')](_0x4bee19[_0xb06f('0x2e')]);_0x4c92b4[_0xb06f('0x30')]=_[_0xb06f('0x31')](_0x4c92b4[_0xb06f('0x2d')],_0x4c92b4['query']);_0x1785e3[_0xb06f('0x32')]=_[_0xb06f('0x31')](_0x4c92b4['model'],qs[_0xb06f('0x33')](_0x4bee19['query'][_0xb06f('0x33')]));_0x1785e3[_0xb06f('0x32')]=_0x1785e3[_0xb06f('0x32')][_0xb06f('0x34')]?_0x1785e3['attributes']:_0x4c92b4[_0xb06f('0x2d')];if(!_0x4bee19[_0xb06f('0x2e')][_0xb06f('0x35')](_0xb06f('0x36'))){_0x1785e3[_0xb06f('0x1b')]=qs[_0xb06f('0x1b')](_0x4bee19['query'][_0xb06f('0x1b')]);_0x1785e3['offset']=qs['offset'](_0x4bee19[_0xb06f('0x2e')][_0xb06f('0x18')]);}_0x1785e3[_0xb06f('0x37')]=qs['sort'](_0x4bee19[_0xb06f('0x2e')][_0xb06f('0x38')]);_0x1785e3[_0xb06f('0x39')]=qs[_0xb06f('0x30')](_[_0xb06f('0x3a')](_0x4bee19['query'],_0x4c92b4['filters']),_0x480f21);if(_0x4bee19[_0xb06f('0x2e')][_0xb06f('0x3b')]){_0x1785e3[_0xb06f('0x39')]=_[_0xb06f('0x3c')](_0x1785e3['where'],{'$or':_[_0xb06f('0x28')](_0x480f21,function(_0x2bfc40){if(_0x2bfc40[_0xb06f('0x3d')]!==_0xb06f('0x3e')){var _0x1d4c71={};_0x1d4c71[_0x2bfc40[_0xb06f('0x26')]]={'$like':'%'+_0x4bee19[_0xb06f('0x2e')][_0xb06f('0x3b')]+'%'};return _0x1d4c71;}})});}_0x1785e3=_[_0xb06f('0x3c')]({},_0x1785e3,_0x4bee19['options']);var _0x5f3dcf={'where':_0x1785e3[_0xb06f('0x39')]};return db[_0xb06f('0x29')][_0xb06f('0x1a')](_0x5f3dcf)[_0xb06f('0x23')](function(_0x1a5151){_0x3a5979[_0xb06f('0x1a')]=_0x1a5151;if(_0x4bee19['query'][_0xb06f('0x3f')]){_0x1785e3[_0xb06f('0x40')]=[{'all':!![]}];}return db[_0xb06f('0x29')]['findAll'](_0x1785e3);})[_0xb06f('0x23')](function(_0xee889){_0x3a5979[_0xb06f('0x41')]=_0xee889;return _0x3a5979;})[_0xb06f('0x23')](respondWithFilteredResult(_0x50f323,_0x1785e3))[_0xb06f('0x42')](handleError(_0x50f323,null));};exports[_0xb06f('0x43')]=function(_0x21a50e,_0xc9c312){var _0x3d9d1b={'raw':!![],'where':{'id':_0x21a50e['params']['id']}},_0x449a0c={};_0x449a0c[_0xb06f('0x2d')]=_[_0xb06f('0x2f')](db['WhatsappTransferReport'][_0xb06f('0x2a')]);_0x449a0c[_0xb06f('0x2e')]=_[_0xb06f('0x2f')](_0x21a50e[_0xb06f('0x2e')]);_0x449a0c[_0xb06f('0x30')]=_[_0xb06f('0x31')](_0x449a0c['model'],_0x449a0c[_0xb06f('0x2e')]);_0x3d9d1b[_0xb06f('0x32')]=_[_0xb06f('0x31')](_0x449a0c[_0xb06f('0x2d')],qs[_0xb06f('0x33')](_0x21a50e[_0xb06f('0x2e')]['fields']));_0x3d9d1b[_0xb06f('0x32')]=_0x3d9d1b[_0xb06f('0x32')][_0xb06f('0x34')]?_0x3d9d1b['attributes']:_0x449a0c['model'];if(_0x21a50e['query']['includeAll']){_0x3d9d1b[_0xb06f('0x40')]=[{'all':!![]}];}_0x3d9d1b=_[_0xb06f('0x3c')]({},_0x3d9d1b,_0x21a50e['options']);return db[_0xb06f('0x29')]['find'](_0x3d9d1b)[_0xb06f('0x23')](handleEntityNotFound(_0xc9c312,null))['then'](respondWithResult(_0xc9c312,null))[_0xb06f('0x42')](handleError(_0xc9c312,null));};exports[_0xb06f('0x44')]=function(_0x317db2,_0x11240b){return db[_0xb06f('0x29')][_0xb06f('0x44')](_0x317db2[_0xb06f('0x45')],{})['then'](respondWithResult(_0x11240b,0xc9))['catch'](handleError(_0x11240b,null));};exports[_0xb06f('0x21')]=function(_0x57d168,_0x31b56b){if(_0x57d168[_0xb06f('0x45')]['id']){delete _0x57d168[_0xb06f('0x45')]['id'];}return db[_0xb06f('0x29')][_0xb06f('0x46')]({'where':{'id':_0x57d168['params']['id']}})[_0xb06f('0x23')](handleEntityNotFound(_0x31b56b,null))['then'](saveUpdates(_0x57d168[_0xb06f('0x45')],null))['then'](respondWithResult(_0x31b56b,null))[_0xb06f('0x42')](handleError(_0x31b56b,null));};exports[_0xb06f('0x22')]=function(_0x1bea2a,_0x4a1e21){return db[_0xb06f('0x29')][_0xb06f('0x46')]({'where':{'id':_0x1bea2a[_0xb06f('0x47')]['id']}})['then'](handleEntityNotFound(_0x4a1e21,null))[_0xb06f('0x23')](removeEntity(_0x4a1e21,null))[_0xb06f('0x42')](handleError(_0x4a1e21,null));};exports[_0xb06f('0x48')]=function(_0x562996,_0x27155a){return db[_0xb06f('0x29')]['describe']()[_0xb06f('0x23')](respondWithResult(_0x27155a,null))[_0xb06f('0x42')](handleError(_0x27155a,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 7480f33..99e2ca4 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 _0x6e32=['../../config/environment','./whatsappTransferReport.attributes','define','WhatsappTransferReport','uniqueid','util','../../config/logger','api','moment','request-promise'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x6e32,0x163));var _0x26e3=function(_0xa56838,_0x4cc85d){_0xa56838=_0xa56838-0x0;var _0x37fbdb=_0x6e32[_0xa56838];return _0x37fbdb;};'use strict';var _=require('lodash');var util=require(_0x26e3('0x0'));var logger=require(_0x26e3('0x1'))(_0x26e3('0x2'));var moment=require(_0x26e3('0x3'));var BPromise=require('bluebird');var rp=require(_0x26e3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x26e3('0x5'));var attributes=require(_0x26e3('0x6'));module['exports']=function(_0x4e1c01,_0x220cf5){return _0x4e1c01[_0x26e3('0x7')](_0x26e3('0x8'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0x26e3('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xc9ef=['util','api','moment','bluebird','request-promise','rimraf','./whatsappTransferReport.attributes','exports','define','report_whatsapp_transfer','uniqueid'];(function(_0x10370c,_0x393069){var _0x5c3a2e=function(_0x3e2601){while(--_0x3e2601){_0x10370c['push'](_0x10370c['shift']());}};_0x5c3a2e(++_0x393069);}(_0xc9ef,0x18c));var _0xfc9e=function(_0x5afa3d,_0x54f4a3){_0x5afa3d=_0x5afa3d-0x0;var _0x539628=_0xc9ef[_0x5afa3d];return _0x539628;};'use strict';var _=require('lodash');var util=require(_0xfc9e('0x0'));var logger=require('../../config/logger')(_0xfc9e('0x1'));var moment=require(_0xfc9e('0x2'));var BPromise=require(_0xfc9e('0x3'));var rp=require(_0xfc9e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfc9e('0x5'));var config=require('../../config/environment');var attributes=require(_0xfc9e('0x6'));module[_0xfc9e('0x7')]=function(_0x2fcbdf,_0x119db9){return _0x2fcbdf[_0xfc9e('0x8')]('WhatsappTransferReport',attributes,{'tableName':_0xfc9e('0x9'),'paranoid':![],'indexes':[{'name':_0xfc9e('0xa'),'fields':[_0xfc9e('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 7179d46..d5d91a4 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 _0xaeed=['error','code','WhatsappTransferReport,\x20%s,\x20%s','message','result','catch','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','request\x20sent','stringify'];(function(_0x393203,_0x28ca31){var _0x3394b6=function(_0x5cc9ca){while(--_0x5cc9ca){_0x393203['push'](_0x393203['shift']());}};_0x3394b6(++_0x28ca31);}(_0xaeed,0x84));var _0xdaee=function(_0x236206,_0xbcc14f){_0x236206=_0x236206-0x0;var _0x9ea003=_0xaeed[_0x236206];return _0x9ea003;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xdaee('0x0'));var rs=require(_0xdaee('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdaee('0x2'));var logger=require(_0xdaee('0x3'))(_0xdaee('0x4'));var config=require(_0xdaee('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xdaee('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0xfd4f50,_0x1c1343,_0x995ef8){return new BPromise(function(_0x5d653e,_0x35e645){return client[_0xdaee('0x7')](_0xfd4f50,_0x995ef8)[_0xdaee('0x8')](function(_0x4fc6c8){logger[_0xdaee('0x9')]('WhatsappTransferReport,\x20%s,\x20%s',_0x1c1343,'request\x20sent');logger['debug']('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x1c1343,_0xdaee('0xa'),JSON[_0xdaee('0xb')](_0x4fc6c8));if(_0x4fc6c8[_0xdaee('0xc')]){if(_0x4fc6c8[_0xdaee('0xc')][_0xdaee('0xd')]===0x1f4){logger[_0xdaee('0xc')](_0xdaee('0xe'),_0x1c1343,_0x4fc6c8[_0xdaee('0xc')][_0xdaee('0xf')]);return _0x35e645(_0x4fc6c8[_0xdaee('0xc')][_0xdaee('0xf')]);}logger['error'](_0xdaee('0xe'),_0x1c1343,_0x4fc6c8['error'][_0xdaee('0xf')]);return _0x5d653e(_0x4fc6c8[_0xdaee('0xc')][_0xdaee('0xf')]);}else{logger['info'](_0xdaee('0xe'),_0x1c1343,_0xdaee('0xa'));_0x5d653e(_0x4fc6c8[_0xdaee('0x10')][_0xdaee('0xf')]);}})[_0xdaee('0x11')](function(_0x114d9f){logger['error'](_0xdaee('0xe'),_0x1c1343,_0x114d9f);_0x35e645(_0x114d9f);});});} \ No newline at end of file +var _0xf4b2=['WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x134516,_0x53f184){var _0x1300e1=function(_0x5d58b3){while(--_0x5d58b3){_0x134516['push'](_0x134516['shift']());}};_0x1300e1(++_0x53f184);}(_0xf4b2,0x12a));var _0x2f4b=function(_0x36f010,_0x3289b5){_0x36f010=_0x36f010-0x0;var _0x46a894=_0xf4b2[_0x36f010];return _0x46a894;};'use strict';var _=require(_0x2f4b('0x0'));var util=require(_0x2f4b('0x1'));var moment=require(_0x2f4b('0x2'));var BPromise=require('bluebird');var rs=require(_0x2f4b('0x3'));var fs=require('fs');var Redis=require(_0x2f4b('0x4'));var db=require(_0x2f4b('0x5'))['db'];var utils=require(_0x2f4b('0x6'));var logger=require(_0x2f4b('0x7'))(_0x2f4b('0x8'));var config=require(_0x2f4b('0x9'));var jayson=require(_0x2f4b('0xa'));var client=jayson[_0x2f4b('0xb')][_0x2f4b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1889c0,_0x3f9e31,_0x3888ea){return new BPromise(function(_0x5da77b,_0x419c0b){return client[_0x2f4b('0xd')](_0x1889c0,_0x3888ea)['then'](function(_0x512001){logger['info'](_0x2f4b('0xe'),_0x3f9e31,_0x2f4b('0xf'));logger[_0x2f4b('0x10')](_0x2f4b('0x11'),_0x3f9e31,_0x2f4b('0xf'),JSON[_0x2f4b('0x12')](_0x512001));if(_0x512001[_0x2f4b('0x13')]){if(_0x512001[_0x2f4b('0x13')][_0x2f4b('0x14')]===0x1f4){logger['error'](_0x2f4b('0xe'),_0x3f9e31,_0x512001[_0x2f4b('0x13')][_0x2f4b('0x15')]);return _0x419c0b(_0x512001['error']['message']);}logger[_0x2f4b('0x13')]('WhatsappTransferReport,\x20%s,\x20%s',_0x3f9e31,_0x512001[_0x2f4b('0x13')][_0x2f4b('0x15')]);return _0x5da77b(_0x512001['error'][_0x2f4b('0x15')]);}else{logger['info'](_0x2f4b('0xe'),_0x3f9e31,_0x2f4b('0xf'));_0x5da77b(_0x512001[_0x2f4b('0x16')][_0x2f4b('0x15')]);}})[_0x2f4b('0x17')](function(_0x151cff){logger['error']('WhatsappTransferReport,\x20%s,\x20%s',_0x3f9e31,_0x151cff);_0x419c0b(_0x151cff);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 2caf8f7..6ef23d4 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1354=['catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment','./config/logger','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/whatsapp','./config/schedule/transcribe','sequelize','sync','then','default','listen','info','start','filter','number','exitCode','\x20processes\x20failed\x20at\x20startup:\x20','map','online','name','join','Offline\x20apps:','status','None','log'];(function(_0x439c3e,_0x403b18){var _0x119053=function(_0x379483){while(--_0x379483){_0x439c3e['push'](_0x439c3e['shift']());}};_0x119053(++_0x403b18);}(_0x1354,0x95));var _0x4135=function(_0x294f3d,_0x1b0f82){_0x294f3d=_0x294f3d-0x0;var _0x2c8f6c=_0x1354[_0x294f3d];return _0x2c8f6c;};'use strict';var _=require(_0x4135('0x0'));var db=require(_0x4135('0x1'))['db'];var seedDb=require(_0x4135('0x2'));var checkLicense=require(_0x4135('0x3'));var rpc=require(_0x4135('0x4'));var config=require(_0x4135('0x5'));var logger=require(_0x4135('0x6'))('app');var pm2=require(_0x4135('0x7'));var pm2Config=require(_0x4135('0x8'));var schedule=require(_0x4135('0x9'));var chat=require('./config/schedule/chat');var whatsapp=require(_0x4135('0xa'));var transcribe=require(_0x4135('0xb'));var provider=require('./config/schedule/cloud-provider');function main(){return db[_0x4135('0xc')][_0x4135('0xd')]()[_0x4135('0xe')](function(){if(config['seedDB']){return seedDb[_0x4135('0xf')]();}})['then'](function(){return checkLicense[_0x4135('0xf')]();})[_0x4135('0xe')](function(){return rpc[_0x4135('0x10')]();})[_0x4135('0xe')](function(_0x5dd78a){logger[_0x4135('0x11')](_0x5dd78a);return chat['start']();})['then'](function(){return whatsapp[_0x4135('0x12')]();})[_0x4135('0xe')](function(){return schedule[_0x4135('0x12')]();})['then'](function(){return transcribe[_0x4135('0x12')]();})[_0x4135('0xe')](function(){return provider[_0x4135('0x12')]();})[_0x4135('0xe')](function(_0x3731e8){logger[_0x4135('0x11')](_0x3731e8);return pm2['start'](pm2Config);})['then'](function(_0x249c86){var _0x3c90cf=_0x249c86[_0x4135('0x13')](function(_0x17179a){return typeof _0x17179a['exitCode']===_0x4135('0x14')&&_0x17179a[_0x4135('0x15')]>=0x0;});if(_0x3c90cf['length']>0x0){throw new Error(_0x3c90cf['length']+_0x4135('0x16')+_['map'](_0x3c90cf,function(_0x2f2600){return'\x22'+_0x2f2600['pm2_env']['name']+'\x22';}));}logger['info']('Online\x20apps:',_[_0x4135('0x17')](_['filter'](_0x249c86,{'status':_0x4135('0x18')}),_0x4135('0x19'))[_0x4135('0x1a')]());logger['info'](_0x4135('0x1b'),_[_0x4135('0x17')](_[_0x4135('0x13')](_0x249c86,function(_0x485395){return _0x485395[_0x4135('0x1c')]!=='online';}),_0x4135('0x19'))[_0x4135('0x1a')]()||_0x4135('0x1d'));console[_0x4135('0x1e')]('App\x20Ready!');})[_0x4135('0x1f')](function(_0x126527){console[_0x4135('0x1e')](_0x4135('0x20'),_0x126527);logger[_0x4135('0x21')](_0x4135('0x22'),_0x126527);process[_0x4135('0x23')](0x1);});}main(); \ No newline at end of file +var _0xd9a8=['lodash','./mysqldb','./config/seedDB','./rpc','./config/environment','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/cloud-provider','sequelize','sync','seedDB','default','then','listen','info','start','filter','exitCode','number','length','map','pm2_env','name','Online\x20apps:','online','join','Offline\x20apps:','status','None','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit'];(function(_0x2fa451,_0x1a8f13){var _0x4e2e51=function(_0x146070){while(--_0x146070){_0x2fa451['push'](_0x2fa451['shift']());}};_0x4e2e51(++_0x1a8f13);}(_0xd9a8,0xc3));var _0x8d9a=function(_0x187132,_0x204ea5){_0x187132=_0x187132-0x0;var _0x5b4f24=_0xd9a8[_0x187132];return _0x5b4f24;};'use strict';var _=require(_0x8d9a('0x0'));var db=require(_0x8d9a('0x1'))['db'];var seedDb=require(_0x8d9a('0x2'));var checkLicense=require('./config/license');var rpc=require(_0x8d9a('0x3'));var config=require(_0x8d9a('0x4'));var logger=require('./config/logger')('app');var pm2=require(_0x8d9a('0x5'));var pm2Config=require(_0x8d9a('0x6'));var schedule=require(_0x8d9a('0x7'));var chat=require(_0x8d9a('0x8'));var whatsapp=require(_0x8d9a('0x9'));var transcribe=require('./config/schedule/transcribe');var provider=require(_0x8d9a('0xa'));function main(){return db[_0x8d9a('0xb')][_0x8d9a('0xc')]()['then'](function(){if(config[_0x8d9a('0xd')]){return seedDb[_0x8d9a('0xe')]();}})[_0x8d9a('0xf')](function(){return checkLicense['default']();})[_0x8d9a('0xf')](function(){return rpc[_0x8d9a('0x10')]();})[_0x8d9a('0xf')](function(_0x5ae57a){logger[_0x8d9a('0x11')](_0x5ae57a);return chat['start']();})[_0x8d9a('0xf')](function(){return whatsapp[_0x8d9a('0x12')]();})['then'](function(){return schedule[_0x8d9a('0x12')]();})[_0x8d9a('0xf')](function(){return transcribe['start']();})[_0x8d9a('0xf')](function(){return provider[_0x8d9a('0x12')]();})[_0x8d9a('0xf')](function(_0x34f89d){logger[_0x8d9a('0x11')](_0x34f89d);return pm2[_0x8d9a('0x12')](pm2Config);})[_0x8d9a('0xf')](function(_0x29ceeb){var _0x5cd106=_0x29ceeb[_0x8d9a('0x13')](function(_0x36fd8c){return typeof _0x36fd8c[_0x8d9a('0x14')]===_0x8d9a('0x15')&&_0x36fd8c[_0x8d9a('0x14')]>=0x0;});if(_0x5cd106[_0x8d9a('0x16')]>0x0){throw new Error(_0x5cd106['length']+'\x20processes\x20failed\x20at\x20startup:\x20'+_[_0x8d9a('0x17')](_0x5cd106,function(_0x49202a){return'\x22'+_0x49202a[_0x8d9a('0x18')][_0x8d9a('0x19')]+'\x22';}));}logger['info'](_0x8d9a('0x1a'),_[_0x8d9a('0x17')](_[_0x8d9a('0x13')](_0x29ceeb,{'status':_0x8d9a('0x1b')}),'name')[_0x8d9a('0x1c')]());logger[_0x8d9a('0x11')](_0x8d9a('0x1d'),_[_0x8d9a('0x17')](_['filter'](_0x29ceeb,function(_0x30c0f7){return _0x30c0f7[_0x8d9a('0x1e')]!==_0x8d9a('0x1b');}),'name')[_0x8d9a('0x1c')]()||_0x8d9a('0x1f'));console[_0x8d9a('0x20')](_0x8d9a('0x21'));})[_0x8d9a('0x22')](function(_0x443af3){console[_0x8d9a('0x20')](_0x8d9a('0x23'),_0x443af3);logger[_0x8d9a('0x24')](_0x8d9a('0x25'),_0x443af3);process[_0x8d9a('0x26')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index d4d8dcb..833982d 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 _0x743a=['isAuthenticated','use','user','findOne','params','disposition','then','closed','query','forceDownload','unmanaged','json','Unmanaged.','Forbidden.','catch','startsWith','headers','authorization','User','find','pass','status','Bearer','Unknown\x20authorization\x20format','apikey','getUuid','Setting','blockDuration','isEqual','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isWebrtcLicence','webrtc','isMiddleware','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','retrieveApiKey','isNil','apiKeyIat','generateApiKey','apiKeyNonce','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','Sequelize','ValidationError','updatePasswordsHistory','length','splice','unshift','join','promisify','sign','secret','payload','verify','toString','hex','now','HS512','../../mysqldb','../../config/environment','../../config/license/util','../encryptor','jsonwebtoken','express-jwt','composable-middleware','basic-auth','bluebird','util','moment','secrets','session','role','fullname','name','internal','userpic','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','phoneBarAutoAnswerDelay','phoneBarEnableRecording','phoneBarEnableSettings','phoneBarPrefixRequired','phoneBarRemoteControl','hotdesk','userProfileId','privacyEnabled','settingsEnabled','downloadVoiceRecordings','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','emailAutoanswer','emailAutoanswerDelay','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','messengerSoundNotification'];(function(_0x5eff1a,_0x2bb961){var _0x13dec1=function(_0x55093b){while(--_0x55093b){_0x5eff1a['push'](_0x5eff1a['shift']());}};_0x13dec1(++_0x2bb961);}(_0x743a,0x1ec));var _0xa743=function(_0x2218ae,_0x5464e3){_0x2218ae=_0x2218ae-0x0;var _0x2068d0=_0x743a[_0x2218ae];return _0x2068d0;};'use strict';var db=require(_0xa743('0x0'))['db'];var config=require(_0xa743('0x1'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0xa743('0x2'));var encryptor=require(_0xa743('0x3'));var _=require('lodash');var jwt=require(_0xa743('0x4'));var expressJwt=require(_0xa743('0x5'));var compose=require(_0xa743('0x6'));var basicAuth=require(_0xa743('0x7'));var crypto=require('crypto');var BPromise=require(_0xa743('0x8'));var util=require(_0xa743('0x9'));var moment=require(_0xa743('0xa'));var validateJwt=expressJwt({'secret':config[_0xa743('0xb')][_0xa743('0xc')]});var userAttributes=['id',_0xa743('0xd'),_0xa743('0xe'),_0xa743('0xf'),_0xa743('0x10'),'email',_0xa743('0x11'),_0xa743('0x12'),_0xa743('0x13'),_0xa743('0x14'),_0xa743('0x15'),_0xa743('0x16'),_0xa743('0x17'),_0xa743('0x18'),_0xa743('0x19'),'pauseType',_0xa743('0x1a'),_0xa743('0x1b'),_0xa743('0x1c'),_0xa743('0x1d'),_0xa743('0x1e'),_0xa743('0x1f'),'alias','phoneBarAutoAnswer',_0xa743('0x20'),'phoneBarDnd',_0xa743('0x21'),'phoneBarEnableDtmfTone',_0xa743('0x22'),'phoneBarExpires',_0xa743('0x23'),_0xa743('0x24'),'phoneBarRemoteControlPort',_0xa743('0x25'),'interface',_0xa743('0x26'),_0xa743('0x27'),_0xa743('0x28'),'wssPort',_0xa743('0x29'),'downloadOmnichannelInteractions',_0xa743('0x2a'),_0xa743('0x2b'),_0xa743('0x2c'),_0xa743('0x2d'),'chatAutoanswerDelay',_0xa743('0x2e'),_0xa743('0x2f'),'smsAutoanswer',_0xa743('0x30'),_0xa743('0x31'),_0xa743('0x32'),_0xa743('0x33'),_0xa743('0x34'),_0xa743('0x35'),_0xa743('0x36'),_0xa743('0x37')];exports['isChatInteractionAuthorized']=function(){return this[_0xa743('0x38')](!![])[_0xa743('0x39')](function(_0x3feba4,_0x3f4223,_0xde984){if(_0x3feba4[_0xa743('0x3a')]){_0xde984();}else{return db['ChatInteraction'][_0xa743('0x3b')]({'where':{'id':_0x3feba4[_0xa743('0x3c')]['id']},'attributes':['id','closed',_0xa743('0x3d')],'raw':!![]})[_0xa743('0x3e')](function(_0x2a33fe){if(_0x2a33fe&&_0x2a33fe[_0xa743('0x3f')]&&!_0x3feba4[_0xa743('0x40')][_0xa743('0x41')]){return _0x3f4223['status'](_0x2a33fe['disposition']===_0xa743('0x42')?0x195:0x193)[_0xa743('0x43')]({'message':_0x2a33fe['disposition']===_0xa743('0x42')?_0xa743('0x44'):_0xa743('0x45')});}else{_0xde984();}})[_0xa743('0x46')](function(_0x1a315c){_0xde984(_0x1a315c);});}});};exports['isAuthenticated']=function isAuthenticated(_0x2aacb4){return compose()[_0xa743('0x39')](function(_0x439659,_0x5370de,_0x16e238){var _0x54b9aa;if(_0x439659['headers']['authorization']){if(_[_0xa743('0x47')](_0x439659[_0xa743('0x48')][_0xa743('0x49')],'Basic')){var _0x36b04a=basicAuth(_0x439659);db[_0xa743('0x4a')][_0xa743('0x4b')]({'where':{'name':_0x36b04a[_0xa743('0xf')]}})[_0xa743('0x3e')](function(_0x12b450){if(!_0x12b450||!_0x12b450['authenticate'](_0x36b04a[_0xa743('0x4c')])){return _0x5370de[_0xa743('0x4d')](0x191)[_0xa743('0x43')]({'message':'Wrong\x20credentials.'});}_0x439659[_0xa743('0x3a')]={'id':_0x12b450['id']};_0x16e238();})[_0xa743('0x46')](function(_0x501266){_0x16e238(_0x501266);});}else if(_[_0xa743('0x47')](_0x439659[_0xa743('0x48')][_0xa743('0x49')],_0xa743('0x4e'))){validateJwt(_0x439659,_0x5370de,_0x16e238);}else{if(_0x2aacb4){_0x16e238();}else{return _0x5370de[_0xa743('0x4d')](0x193)['json']({'message':_0xa743('0x4f')});}}}else if(_0x439659[_0xa743('0x40')][_0xa743('0x50')]){try{var _0x13921d={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xa743('0x51')]()};verifyJwt(_0x439659[_0xa743('0x40')][_0xa743('0x50')],_0x13921d)[_0xa743('0x3e')](function(_0xc797fd){return db[_0xa743('0x4a')][_0xa743('0x4b')]({'where':{'id':_0xc797fd['sub']}})['then'](function(_0xa7621){_0x54b9aa=_0xa7621;return db[_0xa743('0x52')][_0xa743('0x3b')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xa743('0x53')],'raw':!![]});})[_0xa743('0x3e')](function(_0x55b0ae){if(!_0x54b9aa||!_[_0xa743('0x54')](_0x54b9aa['apiKeyNonce'],_0xc797fd['nonce'])){return _0x5370de[_0xa743('0x4d')](0x191)[_0xa743('0x43')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x54b9aa[_0xa743('0x55')]){return _0x5370de[_0xa743('0x4d')](0x191)['json']({'message':_0xa743('0x56')});}if(_0x54b9aa[_0xa743('0x57')]){if(_0x55b0ae['blockDuration']>0x0){if(moment(_0x54b9aa[_0xa743('0x58')])[_0xa743('0x59')](_0x55b0ae['blockDuration'],_0xa743('0x5a'))>moment()){return _0x5370de[_0xa743('0x4d')](0x191)[_0xa743('0x43')]({'message':_0xa743('0x56')});}}else{return _0x5370de[_0xa743('0x4d')](0x191)['json']({'message':_0xa743('0x56')});}}_0x439659[_0xa743('0x3a')]={'id':_0x54b9aa['id']};_0x16e238();});})[_0xa743('0x46')](function(){return _0x5370de[_0xa743('0x4d')](0x191)['json']({'message':_0xa743('0x56')});});}catch(_0x439941){_0x16e238(_0x439941);}}else if(_0x2aacb4){_0x16e238();}else{return _0x5370de[_0xa743('0x4d')](0x193)[_0xa743('0x43')]({'message':_0xa743('0x4f')});}})[_0xa743('0x39')](function(_0x4ba7ee,_0x457f37,_0xf02186){if(_0x4ba7ee[_0xa743('0x3a')]){db[_0xa743('0x4a')]['find']({'where':{'id':_0x4ba7ee[_0xa743('0x3a')]['id']},'attributes':userAttributes})[_0xa743('0x3e')](function(_0x285fa4){if(!_0x285fa4){return _0x457f37[_0xa743('0x4d')](0x194)[_0xa743('0x43')]({'message':_0xa743('0x5b')});}_0x4ba7ee[_0xa743('0x3a')]=_0x285fa4;_0xf02186();})[_0xa743('0x46')](function(_0x27ca6b){_0xf02186(_0x27ca6b);});}else if(_0x2aacb4){_0xf02186();}else{return _0x457f37[_0xa743('0x4d')](0x194)[_0xa743('0x43')]({'message':_0xa743('0x5c')});}});};exports[_0xa743('0x5d')]=function canUpdate(){return compose()[_0xa743('0x39')](function(_0x43fd06,_0x39d6d4,_0x3b79b4){return licenseUtil[_0xa743('0x5e')]()[_0xa743('0x3e')](function(_0x3f9d15){if(_0x3f9d15[_0xa743('0x5f')]){_0x3b79b4();}else{return _0x39d6d4[_0xa743('0x4d')](0x193)[_0xa743('0x43')]({'message':_0xa743('0x60')});}})[_0xa743('0x46')](function(_0x558071){_0x3b79b4(_0x558071);});});};exports[_0xa743('0x61')]=function isWebrtcLicence(){return compose()[_0xa743('0x39')](function(_0x3d3063,_0x463ea5,_0xa2121a){return licenseUtil[_0xa743('0x5e')]()['then'](function(_0x41fcee){if(_0x41fcee[_0xa743('0x62')]){_0xa2121a();}else{return _0x463ea5[_0xa743('0x4d')](0x193)[_0xa743('0x43')]({'message':_0xa743('0x60')});}})['catch'](function(_0x4317e1){_0xa2121a(_0x4317e1);});});};exports[_0xa743('0x63')]=function(_0x44521b,_0x451652,_0x16f740){_0x44521b[_0xa743('0x63')]=!![];return _0x16f740();};exports['signToken']=function signToken(_0x363018){return signJwt(_0x363018);};exports[_0xa743('0x64')]=function(_0xb947f,_0xdd8fd5){if(!_0xb947f[_0xa743('0x3a')]){return _0xdd8fd5[_0xa743('0x4d')](0x194)['json']({'message':_0xa743('0x65')});}var _0x3a8652={'payload':{'id':_0xb947f['user']['id'],'role':_0xb947f['user'][_0xa743('0xd')]},'options':{'expiresIn':0x15180}};return signJwt(_0x3a8652)[_0xa743('0x3e')](function(_0x35db89){_0xdd8fd5[_0xa743('0x66')](_0xa743('0x67'),_0x35db89);_0xdd8fd5[_0xa743('0x68')](_0xa743('0x69'));})['catch'](function(_0x13e87e){return _0xdd8fd5[_0xa743('0x4d')](0x1f4)['send'](_0x13e87e);});};exports[_0xa743('0x6a')]=function(_0x16a323){if(_[_0xa743('0x6b')](_0x16a323['apiKeyNonce'])||_['isNil'](_0x16a323[_0xa743('0x6c')])){return null;}else{return createJwt(_0x16a323);}};exports[_0xa743('0x6d')]=function(_0xd47c62){_0xd47c62[_0xa743('0x6e')]=generateNonce();_0xd47c62[_0xa743('0x6c')]=generateIssuedAt();return createJwt(_0xd47c62);};exports[_0xa743('0x6f')]=function(_0xb80e14,_0x5eabdf){var _0x145042=_0xb80e14[_0xa743('0x40')][_0xa743('0x50')];if(_0x145042){var _0x26f087={'nonce':_0x5eabdf[_0xa743('0x6e')],'iat':_0x5eabdf[_0xa743('0x6c')],'audience':hardwareConf[_0xa743('0x51')](),'issuer':hardwareConf[_0xa743('0x51')]()};return verifyJwt(_0x145042,_0x26f087)[_0xa743('0x3e')](function(){return generateApiKey(_0x5eabdf);});}else{throw{'message':_0xa743('0x70')};}};exports[_0xa743('0x71')]=function(_0x5302ca){var _0x3e2b8e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x3e2b8e[_0xa743('0x72')](_0x5302ca))throw new db['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~!@#$%^&-_=+[{]}.');return;};exports[_0xa743('0x73')]=function(_0x355822,_0x472a9,_0x54f402){var _0x56e06e=encryptor[_0xa743('0x74')](_0x472a9)[_0xa743('0x75')](',');for(var _0xa83eb4=0x0;_0xa83eb4<_0x54f402;_0xa83eb4++){if(!_0x56e06e[_0xa83eb4])break;if(_0x355822[_0xa743('0x76')]()===_0x56e06e[_0xa83eb4][_0xa743('0x76')]()){var _0x11e36f=util[_0xa743('0x77')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x54f402);if(_0x54f402===0x1){_0x11e36f=_0xa743('0x78');}throw new db[(_0xa743('0x79'))][(_0xa743('0x7a'))](_0x11e36f);}}return;};exports[_0xa743('0x7b')]=function(_0x4d4a4b,_0x293ceb){var _0x5a9aee=_0x293ceb?encryptor[_0xa743('0x74')](_0x293ceb)[_0xa743('0x75')](','):[];if(_0x5a9aee[_0xa743('0x7c')]===0x5){_0x5a9aee[_0xa743('0x7d')](-0x1,0x1);}_0x5a9aee[_0xa743('0x7e')](_0x4d4a4b);return encryptor['encryptString'](_0x5a9aee[_0xa743('0x7f')](','));};function signJwt(_0x5369a4){var _0x1a5213=BPromise[_0xa743('0x80')](jwt[_0xa743('0x81')],{'context':jwt});var _0x112dbe=_0x5369a4[_0xa743('0x82')]||config[_0xa743('0xb')][_0xa743('0xc')];return new BPromise(function(_0x1b0174,_0x3dd5c8){_0x1a5213(_0x5369a4[_0xa743('0x83')],_0x112dbe,_0x5369a4['options'])[_0xa743('0x3e')](function(_0x2d3fc8){_0x1b0174(_0x2d3fc8);})[_0xa743('0x46')](function(_0x5daa52){_0x3dd5c8(_0x5daa52);});});}function verifyJwt(_0x4d3400,_0x43a3fd,_0x26d0e5){var _0x4f9c77=BPromise[_0xa743('0x80')](jwt[_0xa743('0x84')],{'context':jwt});var _0x4d8575=_0x26d0e5||config['secrets']['session'];return new BPromise(function(_0x24eca7,_0x1a39ed){_0x4f9c77(_0x4d3400,_0x4d8575,_0x43a3fd)[_0xa743('0x3e')](function(_0x1d72c8){_0x24eca7(_0x1d72c8);})[_0xa743('0x46')](function(_0x2cc20c){_0x1a39ed(_0x2cc20c);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0xa743('0x85')](_0xa743('0x86'));}function generateIssuedAt(){return Math['floor'](Date[_0xa743('0x87')]()/0x3e8)[_0xa743('0x85')]();}function createJwt(_0x9a23f5){var _0x389892={'payload':{'iat':_0x9a23f5['apiKeyIat'],'nonce':_0x9a23f5[_0xa743('0x6e')]},'options':{'algorithm':_0xa743('0x88'),'subject':_0x9a23f5['id'][_0xa743('0x85')](),'issuer':hardwareConf[_0xa743('0x51')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x389892)[_0xa743('0x3e')](function(_0x1adf7a){return{'iat':_0x9a23f5[_0xa743('0x6c')],'nonce':_0x9a23f5[_0xa743('0x6e')],'token':_0x1adf7a};});} \ No newline at end of file +var _0xe615=['../../config/environment','../../config/license/util','../encryptor','jsonwebtoken','composable-middleware','basic-auth','crypto','moment','secrets','session','role','fullname','internal','email','userpic','permissions','md5secret','voicePause','chatPause','mailPause','smsPause','openchannelPause','pauseType','showWebBar','lastPauseAt','allowmessenger','passwordResetAt','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','privacyEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','isAuthenticated','use','ChatInteraction','findOne','params','closed','disposition','then','query','json','unmanaged','Unmanaged.','Forbidden.','headers','authorization','startsWith','User','find','name','authenticate','pass','catch','Bearer','status','Unknown\x20authorization\x20format','apikey','getUuid','sub','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','user','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','Forbidden','isWebrtcLicence','webrtc','isMiddleware','signToken','setTokenCookie','cookie','redirect','send','isNil','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','ValidationError','length','splice','unshift','encryptString','promisify','sign','options','verify','randomBytes','toString','hex','floor','HS512'];(function(_0x1fb1e3,_0x3e0a0d){var _0x23d5d0=function(_0x17ccab){while(--_0x17ccab){_0x1fb1e3['push'](_0x1fb1e3['shift']());}};_0x23d5d0(++_0x3e0a0d);}(_0xe615,0x83));var _0x5e61=function(_0x7c13ed,_0x4d9dd5){_0x7c13ed=_0x7c13ed-0x0;var _0x4cad66=_0xe615[_0x7c13ed];return _0x4cad66;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0x5e61('0x0'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0x5e61('0x1'));var encryptor=require(_0x5e61('0x2'));var _=require('lodash');var jwt=require(_0x5e61('0x3'));var expressJwt=require('express-jwt');var compose=require(_0x5e61('0x4'));var basicAuth=require(_0x5e61('0x5'));var crypto=require(_0x5e61('0x6'));var BPromise=require('bluebird');var util=require('util');var moment=require(_0x5e61('0x7'));var validateJwt=expressJwt({'secret':config[_0x5e61('0x8')][_0x5e61('0x9')]});var userAttributes=['id',_0x5e61('0xa'),_0x5e61('0xb'),'name',_0x5e61('0xc'),_0x5e61('0xd'),_0x5e61('0xe'),_0x5e61('0xf'),_0x5e61('0x10'),_0x5e61('0x11'),_0x5e61('0x12'),_0x5e61('0x13'),'faxPause',_0x5e61('0x14'),_0x5e61('0x15'),_0x5e61('0x16'),_0x5e61('0x17'),'lastLoginAt',_0x5e61('0x18'),'crudPermissions',_0x5e61('0x19'),_0x5e61('0x1a'),'alias',_0x5e61('0x1b'),_0x5e61('0x1c'),_0x5e61('0x1d'),_0x5e61('0x1e'),_0x5e61('0x1f'),_0x5e61('0x20'),_0x5e61('0x21'),_0x5e61('0x22'),'phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId',_0x5e61('0x23'),'settingsEnabled',_0x5e61('0x24'),_0x5e61('0x25'),_0x5e61('0x26'),'downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign',_0x5e61('0x27'),_0x5e61('0x28'),_0x5e61('0x29'),'emailAutoanswerDelay',_0x5e61('0x2a'),_0x5e61('0x2b'),_0x5e61('0x2c'),_0x5e61('0x2d'),_0x5e61('0x2e'),_0x5e61('0x2f'),_0x5e61('0x30'),_0x5e61('0x31'),_0x5e61('0x32')];exports[_0x5e61('0x33')]=function(){return this[_0x5e61('0x34')](!![])[_0x5e61('0x35')](function(_0x51524f,_0x4ac720,_0x1ee2f9){if(_0x51524f['user']){_0x1ee2f9();}else{return db[_0x5e61('0x36')][_0x5e61('0x37')]({'where':{'id':_0x51524f[_0x5e61('0x38')]['id']},'attributes':['id',_0x5e61('0x39'),_0x5e61('0x3a')],'raw':!![]})[_0x5e61('0x3b')](function(_0x34babc){if(_0x34babc&&_0x34babc[_0x5e61('0x39')]&&!_0x51524f[_0x5e61('0x3c')]['forceDownload']){return _0x4ac720['status'](_0x34babc[_0x5e61('0x3a')]==='unmanaged'?0x195:0x193)[_0x5e61('0x3d')]({'message':_0x34babc['disposition']===_0x5e61('0x3e')?_0x5e61('0x3f'):_0x5e61('0x40')});}else{_0x1ee2f9();}})['catch'](function(_0x2cc000){_0x1ee2f9(_0x2cc000);});}});};exports[_0x5e61('0x34')]=function isAuthenticated(_0x3c0cc1){return compose()['use'](function(_0x3a1d10,_0x42b573,_0x3c684b){var _0x4c8667;if(_0x3a1d10[_0x5e61('0x41')][_0x5e61('0x42')]){if(_[_0x5e61('0x43')](_0x3a1d10[_0x5e61('0x41')][_0x5e61('0x42')],'Basic')){var _0x56bb48=basicAuth(_0x3a1d10);db[_0x5e61('0x44')][_0x5e61('0x45')]({'where':{'name':_0x56bb48[_0x5e61('0x46')]}})[_0x5e61('0x3b')](function(_0x3ec3a5){if(!_0x3ec3a5||!_0x3ec3a5[_0x5e61('0x47')](_0x56bb48[_0x5e61('0x48')])){return _0x42b573['status'](0x191)[_0x5e61('0x3d')]({'message':'Wrong\x20credentials.'});}_0x3a1d10['user']={'id':_0x3ec3a5['id']};_0x3c684b();})[_0x5e61('0x49')](function(_0x5777d9){_0x3c684b(_0x5777d9);});}else if(_[_0x5e61('0x43')](_0x3a1d10[_0x5e61('0x41')]['authorization'],_0x5e61('0x4a'))){validateJwt(_0x3a1d10,_0x42b573,_0x3c684b);}else{if(_0x3c0cc1){_0x3c684b();}else{return _0x42b573[_0x5e61('0x4b')](0x193)[_0x5e61('0x3d')]({'message':_0x5e61('0x4c')});}}}else if(_0x3a1d10[_0x5e61('0x3c')][_0x5e61('0x4d')]){try{var _0x504d56={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x5e61('0x4e')]()};verifyJwt(_0x3a1d10[_0x5e61('0x3c')]['apikey'],_0x504d56)[_0x5e61('0x3b')](function(_0x5e3d60){return db['User']['find']({'where':{'id':_0x5e3d60[_0x5e61('0x4f')]}})[_0x5e61('0x3b')](function(_0x43392c){_0x4c8667=_0x43392c;return db['Setting'][_0x5e61('0x37')]({'where':{'id':0x1},'attributes':[_0x5e61('0x50'),_0x5e61('0x51')],'raw':!![]});})[_0x5e61('0x3b')](function(_0x24df3f){if(!_0x4c8667||!_[_0x5e61('0x52')](_0x4c8667[_0x5e61('0x53')],_0x5e3d60[_0x5e61('0x54')])){return _0x42b573[_0x5e61('0x4b')](0x191)[_0x5e61('0x3d')]({'message':_0x5e61('0x55')});}if(_0x4c8667[_0x5e61('0x56')]){return _0x42b573['status'](0x191)[_0x5e61('0x3d')]({'message':_0x5e61('0x57')});}if(_0x4c8667[_0x5e61('0x58')]){if(_0x24df3f[_0x5e61('0x51')]>0x0){if(moment(_0x4c8667[_0x5e61('0x59')])[_0x5e61('0x5a')](_0x24df3f[_0x5e61('0x51')],_0x5e61('0x5b'))>moment()){return _0x42b573['status'](0x191)[_0x5e61('0x3d')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x42b573[_0x5e61('0x4b')](0x191)[_0x5e61('0x3d')]({'message':_0x5e61('0x57')});}}_0x3a1d10[_0x5e61('0x5c')]={'id':_0x4c8667['id']};_0x3c684b();});})[_0x5e61('0x49')](function(){return _0x42b573['status'](0x191)[_0x5e61('0x3d')]({'message':_0x5e61('0x57')});});}catch(_0x16aaf4){_0x3c684b(_0x16aaf4);}}else if(_0x3c0cc1){_0x3c684b();}else{return _0x42b573[_0x5e61('0x4b')](0x193)[_0x5e61('0x3d')]({'message':_0x5e61('0x4c')});}})[_0x5e61('0x35')](function(_0x1660c1,_0x1bd2a8,_0x36a83){if(_0x1660c1[_0x5e61('0x5c')]){db[_0x5e61('0x44')][_0x5e61('0x45')]({'where':{'id':_0x1660c1[_0x5e61('0x5c')]['id']},'attributes':userAttributes})['then'](function(_0x1cfd2c){if(!_0x1cfd2c){return _0x1bd2a8[_0x5e61('0x4b')](0x194)[_0x5e61('0x3d')]({'message':_0x5e61('0x5d')});}_0x1660c1['user']=_0x1cfd2c;_0x36a83();})[_0x5e61('0x49')](function(_0x52058a){_0x36a83(_0x52058a);});}else if(_0x3c0cc1){_0x36a83();}else{return _0x1bd2a8[_0x5e61('0x4b')](0x194)['json']({'message':_0x5e61('0x5e')});}});};exports[_0x5e61('0x5f')]=function canUpdate(){return compose()['use'](function(_0x414caa,_0x5afad1,_0x356589){return licenseUtil[_0x5e61('0x60')]()[_0x5e61('0x3b')](function(_0x1ec85f){if(_0x1ec85f['update']){_0x356589();}else{return _0x5afad1[_0x5e61('0x4b')](0x193)['json']({'message':_0x5e61('0x61')});}})['catch'](function(_0x45befb){_0x356589(_0x45befb);});});};exports[_0x5e61('0x62')]=function isWebrtcLicence(){return compose()['use'](function(_0x3fb1b3,_0x12e7c4,_0x5f1620){return licenseUtil[_0x5e61('0x60')]()[_0x5e61('0x3b')](function(_0x35d7a2){if(_0x35d7a2[_0x5e61('0x63')]){_0x5f1620();}else{return _0x12e7c4[_0x5e61('0x4b')](0x193)[_0x5e61('0x3d')]({'message':_0x5e61('0x61')});}})['catch'](function(_0x286295){_0x5f1620(_0x286295);});});};exports[_0x5e61('0x64')]=function(_0x5e4a55,_0x121054,_0x12d20d){_0x5e4a55[_0x5e61('0x64')]=!![];return _0x12d20d();};exports[_0x5e61('0x65')]=function signToken(_0x450b30){return signJwt(_0x450b30);};exports[_0x5e61('0x66')]=function(_0x496632,_0x4008e1){if(!_0x496632[_0x5e61('0x5c')]){return _0x4008e1[_0x5e61('0x4b')](0x194)['json']({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x341141={'payload':{'id':_0x496632[_0x5e61('0x5c')]['id'],'role':_0x496632[_0x5e61('0x5c')][_0x5e61('0xa')]},'options':{'expiresIn':0x15180}};return signJwt(_0x341141)[_0x5e61('0x3b')](function(_0x2bcd46){_0x4008e1[_0x5e61('0x67')]('motion.token',_0x2bcd46);_0x4008e1[_0x5e61('0x68')]('/dashboards/general');})[_0x5e61('0x49')](function(_0x19b97f){return _0x4008e1['status'](0x1f4)[_0x5e61('0x69')](_0x19b97f);});};exports['retrieveApiKey']=function(_0x3e52e6){if(_[_0x5e61('0x6a')](_0x3e52e6['apiKeyNonce'])||_[_0x5e61('0x6a')](_0x3e52e6[_0x5e61('0x6b')])){return null;}else{return createJwt(_0x3e52e6);}};exports['generateApiKey']=function(_0x4811f4){_0x4811f4[_0x5e61('0x53')]=generateNonce();_0x4811f4['apiKeyIat']=generateIssuedAt();return createJwt(_0x4811f4);};exports[_0x5e61('0x6c')]=function(_0x267c26,_0x46ed84){var _0x286ad9=_0x267c26[_0x5e61('0x3c')][_0x5e61('0x4d')];if(_0x286ad9){var _0x39ee91={'nonce':_0x46ed84[_0x5e61('0x53')],'iat':_0x46ed84[_0x5e61('0x6b')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x5e61('0x4e')]()};return verifyJwt(_0x286ad9,_0x39ee91)[_0x5e61('0x3b')](function(){return generateApiKey(_0x46ed84);});}else{throw{'message':_0x5e61('0x6d')};}};exports[_0x5e61('0x6e')]=function(_0x452e70){var _0x93fbfb=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x93fbfb['test'](_0x452e70))throw new db[(_0x5e61('0x6f'))]['ValidationError'](_0x5e61('0x70'));return;};exports[_0x5e61('0x71')]=function(_0x3d1086,_0x5c4dd4,_0x6d4082){var _0x384b3a=encryptor[_0x5e61('0x72')](_0x5c4dd4)[_0x5e61('0x73')](',');for(var _0x1ffef0=0x0;_0x1ffef0<_0x6d4082;_0x1ffef0++){if(!_0x384b3a[_0x1ffef0])break;if(_0x3d1086['toLowerCase']()===_0x384b3a[_0x1ffef0][_0x5e61('0x74')]()){var _0x266c5d=util['format']('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x6d4082);if(_0x6d4082===0x1){_0x266c5d='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db[(_0x5e61('0x6f'))][(_0x5e61('0x75'))](_0x266c5d);}}return;};exports['updatePasswordsHistory']=function(_0xb60cd3,_0x5debe3){var _0x577c10=_0x5debe3?encryptor[_0x5e61('0x72')](_0x5debe3)[_0x5e61('0x73')](','):[];if(_0x577c10[_0x5e61('0x76')]===0x5){_0x577c10[_0x5e61('0x77')](-0x1,0x1);}_0x577c10[_0x5e61('0x78')](_0xb60cd3);return encryptor[_0x5e61('0x79')](_0x577c10['join'](','));};function signJwt(_0x155cb4){var _0x552294=BPromise[_0x5e61('0x7a')](jwt[_0x5e61('0x7b')],{'context':jwt});var _0x51eaba=_0x155cb4['secret']||config['secrets'][_0x5e61('0x9')];return new BPromise(function(_0x24d8a7,_0x346b82){_0x552294(_0x155cb4['payload'],_0x51eaba,_0x155cb4[_0x5e61('0x7c')])[_0x5e61('0x3b')](function(_0x89d47c){_0x24d8a7(_0x89d47c);})[_0x5e61('0x49')](function(_0x110aa6){_0x346b82(_0x110aa6);});});}function verifyJwt(_0x262610,_0x3ad0e4,_0x39e2c1){var _0x5ce4e0=BPromise[_0x5e61('0x7a')](jwt[_0x5e61('0x7d')],{'context':jwt});var _0x4381a3=_0x39e2c1||config[_0x5e61('0x8')][_0x5e61('0x9')];return new BPromise(function(_0x4b4efc,_0xa5e7ae){_0x5ce4e0(_0x262610,_0x4381a3,_0x3ad0e4)[_0x5e61('0x3b')](function(_0xa6cd17){_0x4b4efc(_0xa6cd17);})[_0x5e61('0x49')](function(_0x526b77){_0xa5e7ae(_0x526b77);});});}function generateNonce(){return crypto[_0x5e61('0x7e')](0x10)[_0x5e61('0x7f')](_0x5e61('0x80'));}function generateIssuedAt(){return Math[_0x5e61('0x81')](Date['now']()/0x3e8)['toString']();}function createJwt(_0x4259c2){var _0x4ddbf6={'payload':{'iat':_0x4259c2['apiKeyIat'],'nonce':_0x4259c2[_0x5e61('0x53')]},'options':{'algorithm':_0x5e61('0x82'),'subject':_0x4259c2['id'][_0x5e61('0x7f')](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x4ddbf6)[_0x5e61('0x3b')](function(_0x417173){return{'iat':_0x4259c2[_0x5e61('0x6b')],'nonce':_0x4259c2[_0x5e61('0x53')],'token':_0x417173};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index c684411..c7ca1c6 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 _0xbe50=['default','fields','filter','user','clause','tags','ids','tag','countFilteredContacts','User','rows','describe','CmContact','keys','startsWith','cf_','map','CmCustomField','findOne','slice','all','fieldType','type','catch','lodash','./sql-utils','skipContactsQuery','resolve','getContactsSubquery','then','search','parseAdvancedSearchFilter','parseQueryParameters','where'];(function(_0x2c4511,_0x1ba92d){var _0x2868c6=function(_0x56e45c){while(--_0x56e45c){_0x2c4511['push'](_0x2c4511['shift']());}};_0x2868c6(++_0x1ba92d);}(_0xbe50,0x106));var _0x0be5=function(_0x11daf2,_0x294aba){_0x11daf2=_0x11daf2-0x0;var _0xf9068d=_0xbe50[_0x11daf2];return _0xf9068d;};'use strict';var _=require(_0x0be5('0x0'));var sqlUtils=require(_0x0be5('0x1'));var db=require('../../mysqldb')['db'];exports['findAll']=function(_0x5ae268,_0x5f3fb2,_0x4ee017,_0x4b3b16){var _0x47ec94={'count':0x0,'rows':[]};var _0xa128ac=sqlUtils[_0x0be5('0x2')](_0x5f3fb2,_0x5ae268);if(_0xa128ac){return Promise[_0x0be5('0x3')](_0x47ec94);}var _0x7e3a1d=sqlUtils[_0x0be5('0x4')]();var _0x307191={};var _0x13016b=![];var _0x25d1b7=![];return Promise[_0x0be5('0x3')]()[_0x0be5('0x5')](function(){if(_0x5ae268[_0x0be5('0x6')]){return sqlUtils[_0x0be5('0x7')](_0x5ae268['search'],_0x4b3b16);}else{return sqlUtils[_0x0be5('0x8')](_0x5ae268,_0x4b3b16);}})[_0x0be5('0x5')](function(_0x2e4cc7){_0x7e3a1d[_0x0be5('0x9')](_0x2e4cc7[_0x0be5('0xa')]);_0x7e3a1d[_0x0be5('0x9')](_0x2e4cc7[_0x0be5('0xb')]);_0x7e3a1d['where'](_0x2e4cc7[_0x0be5('0xc')]);_0x7e3a1d[_0x0be5('0x9')](_0x2e4cc7[_0x0be5('0xd')][_0x0be5('0xe')]);_0x307191=_0x2e4cc7[_0x0be5('0xf')];_0x25d1b7=_0x2e4cc7['user']['skip'];return sqlUtils['checkListsRestrictions'](_0x5f3fb2,_0x5ae268,_0x25d1b7);})[_0x0be5('0x5')](function(_0x455d02){_0x7e3a1d['where'](_0x455d02);var _0xb7a157=_0x5ae268[_0x0be5('0x6')]?_0x307191[_0x0be5('0x10')]:_0x5ae268[_0x0be5('0x11')];_0x13016b=_0xb7a157?!![]:![];return sqlUtils[_0x0be5('0x12')](_0x7e3a1d,_0xb7a157);})[_0x0be5('0x5')](function(_0x2757f8){_0x47ec94['count']=_0x2757f8;if(_0x47ec94['count']===0x0){return;}if(_0x5ae268[_0x0be5('0x13')]){_0x25d1b7=!![];}return sqlUtils['buildContactsQuery'](_0x7e3a1d,_0x5ae268[_0x0be5('0xb')],_0x4ee017,_0x13016b,_0x307191[_0x0be5('0xe')],_0x25d1b7);})[_0x0be5('0x5')](function(_0x62d5f1){if(!_0x62d5f1){return[];}return sqlUtils['getFilteredContacts'](_0x62d5f1,_0x5ae268,_0x4ee017);})[_0x0be5('0x5')](function(_0x360f6b){_0x47ec94[_0x0be5('0x14')]=_0x360f6b;return _0x47ec94;})['catch'](function(_0x3dc5ca){throw _0x3dc5ca;});};exports[_0x0be5('0x15')]=function(){var _0x4dd1ae={};var _0x193c8d=[];return db[_0x0be5('0x16')][_0x0be5('0x15')]()['then'](function(_0x540980){_0x4dd1ae=_0x540980;var _0x446aa5=Object[_0x0be5('0x17')](_0x4dd1ae)[_0x0be5('0xc')](function(_0x2fee5b){return _[_0x0be5('0x18')](_0x2fee5b,_0x0be5('0x19'))?_0x2fee5b:undefined;});var _0xc1ccdb=_0x446aa5[_0x0be5('0x1a')](function(_0x39d1d6){return db[_0x0be5('0x1b')][_0x0be5('0x1c')]({'where':{'id':_0x39d1d6[_0x0be5('0x1d')](0x3)},'raw':!![]});});return Promise[_0x0be5('0x1e')](_0xc1ccdb);})['then'](function(_0x3c7ca6){for(var _0x2e020e=0x0;_0x2e020e<_0x3c7ca6['length'];_0x2e020e++){if(_0x3c7ca6[_0x2e020e]){var _0x32b203=_0x0be5('0x19')+_0x3c7ca6[_0x2e020e]['id'];_0x4dd1ae[_0x32b203][_0x0be5('0x1f')]=_0x3c7ca6[_0x2e020e][_0x0be5('0x20')];}}_0x193c8d=_[_0x0be5('0x1a')](Object[_0x0be5('0x17')](_0x4dd1ae),function(_0x5169d8){return{'name':_0x5169d8,'type':_0x4dd1ae[_0x5169d8][_0x0be5('0x20')]};});return _0x193c8d;})[_0x0be5('0x21')](function(_0x3fdd6a){throw _0x3fdd6a;});}; \ No newline at end of file +var _0xca27=['parseQueryParameters','where','default','fields','filter','user','clause','tags','checkListsRestrictions','search','ids','tag','countFilteredContacts','count','getFilteredContacts','describe','CmContact','keys','startsWith','cf_','CmCustomField','findOne','slice','type','map','catch','../../mysqldb','findAll','skipContactsQuery','getContactsSubquery','resolve','then','parseAdvancedSearchFilter'];(function(_0x2a5203,_0x102f93){var _0xf5c646=function(_0x170a09){while(--_0x170a09){_0x2a5203['push'](_0x2a5203['shift']());}};_0xf5c646(++_0x102f93);}(_0xca27,0x164));var _0x7ca2=function(_0x42b584,_0x90bbc2){_0x42b584=_0x42b584-0x0;var _0x46498f=_0xca27[_0x42b584];return _0x46498f;};'use strict';var _=require('lodash');var sqlUtils=require('./sql-utils');var db=require(_0x7ca2('0x0'))['db'];exports[_0x7ca2('0x1')]=function(_0x817840,_0x1c874e,_0x51b263,_0x5e512a){var _0x19dba9={'count':0x0,'rows':[]};var _0x4657f7=sqlUtils[_0x7ca2('0x2')](_0x1c874e,_0x817840);if(_0x4657f7){return Promise['resolve'](_0x19dba9);}var _0x428023=sqlUtils[_0x7ca2('0x3')]();var _0x113b49={};var _0x52f162=![];var _0x231fe0=![];return Promise[_0x7ca2('0x4')]()[_0x7ca2('0x5')](function(){if(_0x817840['search']){return sqlUtils[_0x7ca2('0x6')](_0x817840['search'],_0x5e512a);}else{return sqlUtils[_0x7ca2('0x7')](_0x817840,_0x5e512a);}})[_0x7ca2('0x5')](function(_0x100e21){_0x428023[_0x7ca2('0x8')](_0x100e21[_0x7ca2('0x9')]);_0x428023[_0x7ca2('0x8')](_0x100e21[_0x7ca2('0xa')]);_0x428023[_0x7ca2('0x8')](_0x100e21[_0x7ca2('0xb')]);_0x428023[_0x7ca2('0x8')](_0x100e21[_0x7ca2('0xc')][_0x7ca2('0xd')]);_0x113b49=_0x100e21[_0x7ca2('0xe')];_0x231fe0=_0x100e21['user']['skip'];return sqlUtils[_0x7ca2('0xf')](_0x1c874e,_0x817840,_0x231fe0);})[_0x7ca2('0x5')](function(_0x3777fd){_0x428023[_0x7ca2('0x8')](_0x3777fd);var _0x34a0bd=_0x817840[_0x7ca2('0x10')]?_0x113b49[_0x7ca2('0x11')]:_0x817840[_0x7ca2('0x12')];_0x52f162=_0x34a0bd?!![]:![];return sqlUtils[_0x7ca2('0x13')](_0x428023,_0x34a0bd);})['then'](function(_0x19bdd1){_0x19dba9[_0x7ca2('0x14')]=_0x19bdd1;if(_0x19dba9[_0x7ca2('0x14')]===0x0){return;}if(_0x817840['User']){_0x231fe0=!![];}return sqlUtils['buildContactsQuery'](_0x428023,_0x817840[_0x7ca2('0xa')],_0x51b263,_0x52f162,_0x113b49[_0x7ca2('0xd')],_0x231fe0);})[_0x7ca2('0x5')](function(_0x1b942b){if(!_0x1b942b){return[];}return sqlUtils[_0x7ca2('0x15')](_0x1b942b,_0x817840,_0x51b263);})[_0x7ca2('0x5')](function(_0x2a60b1){_0x19dba9['rows']=_0x2a60b1;return _0x19dba9;})['catch'](function(_0x4093b7){throw _0x4093b7;});};exports[_0x7ca2('0x16')]=function(){var _0x526bea={};var _0x298e7e=[];return db[_0x7ca2('0x17')][_0x7ca2('0x16')]()[_0x7ca2('0x5')](function(_0x10ca37){_0x526bea=_0x10ca37;var _0xc93e89=Object[_0x7ca2('0x18')](_0x526bea)[_0x7ca2('0xb')](function(_0x2389d4){return _[_0x7ca2('0x19')](_0x2389d4,_0x7ca2('0x1a'))?_0x2389d4:undefined;});var _0x501bff=_0xc93e89['map'](function(_0x3caf7e){return db[_0x7ca2('0x1b')][_0x7ca2('0x1c')]({'where':{'id':_0x3caf7e[_0x7ca2('0x1d')](0x3)},'raw':!![]});});return Promise['all'](_0x501bff);})['then'](function(_0x5cd614){for(var _0x44e2ac=0x0;_0x44e2ac<_0x5cd614['length'];_0x44e2ac++){if(_0x5cd614[_0x44e2ac]){var _0x1d4106=_0x7ca2('0x1a')+_0x5cd614[_0x44e2ac]['id'];_0x526bea[_0x1d4106]['fieldType']=_0x5cd614[_0x44e2ac][_0x7ca2('0x1e')];}}_0x298e7e=_[_0x7ca2('0x1f')](Object[_0x7ca2('0x18')](_0x526bea),function(_0x114140){return{'name':_0x114140,'type':_0x526bea[_0x114140][_0x7ca2('0x1e')]};});return _0x298e7e;})[_0x7ca2('0x20')](function(_0x14f850){throw _0x14f850;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index 63b04df..110e68b 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 _0xe461=['map','clause','and','ids','User','uc.UserId\x20=\x20?','user','skip','keys','compact','Contact','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','then','fields','tag','tags','filter','search','getLists','c.ListId\x20IS\x20NULL','attributes','group','c.id','limit','offset','subqry.id','having','order','DESC','findAll','color','SELECT','sequelize','query','toString','Tags','clone','COUNT(*)','isEmpty','t.id\x20IN\x20?','QueryTypes','exports','squel','../parsers/advancedSearch','../interaction/utils','../../mysqldb','role','agent','ListId','autocomplete','true','select','from','c.deletedAt\x20IS\x20NULL','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','cm_contact_has_tags','ct.CmContactId\x20=\x20','t.id\x20=\x20ct.TagId','subqry','lastName','phone','mobile','fax','email','CompanyId','updatedAt','deletedAt','TagIds','includes','push','GROUP_CONCAT(DISTINCT\x20t.id)','field','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','escapeLIKESpecialChars','split','c.id\x20LIKE\x20?','c.mobile\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','parseSearch','sqlOperator','conditions','length','find','name','fieldType','datetime','castTo','DATE','default','text','start','value','end','Tag'];(function(_0x3d253b,_0x54a4d4){var _0x1be55c=function(_0x3ebc9f){while(--_0x3ebc9f){_0x3d253b['push'](_0x3d253b['shift']());}};_0x1be55c(++_0x54a4d4);}(_0xe461,0x101));var _0x1e46=function(_0x288cf6,_0x5adc93){_0x288cf6=_0x288cf6-0x0;var _0x5d5d5c=_0xe461[_0x288cf6];return _0x5d5d5c;};'use strict';var _=require('lodash');var squel=require(_0x1e46('0x0'));var as=require(_0x1e46('0x1'));var qs=require('../parsers/qs');var utils=require(_0x1e46('0x2'));var db=require(_0x1e46('0x3'))['db'];function skipContactsQuery(_0x8d783,_0x93e4ae){var _0x54ce76=![];if(_0x8d783[_0x1e46('0x4')]===_0x1e46('0x5')&&!_0x93e4ae['search']&&!_0x93e4ae[_0x1e46('0x6')]&&_0x93e4ae[_0x1e46('0x7')]!==_0x1e46('0x8')){_0x54ce76=!![];}return _0x54ce76;}function getContactsSubquery(){return squel[_0x1e46('0x9')]()[_0x1e46('0xa')]('cm_contacts','c')['where'](_0x1e46('0xb'));}function applyJoinClauses(_0x1ed9c0,_0x27b54a){var _0x14086a=_0x27b54a?'c':'subqry';_0x1ed9c0[_0x1e46('0xc')](_0x1e46('0xd'),'uc',_0x1e46('0xe')+_0x14086a+_0x1e46('0xf'))['left_join'](_0x1e46('0x10'),'ct',_0x1e46('0x11')+_0x14086a+'.id')[_0x1e46('0xc')]('tools_tags','t',_0x1e46('0x12'));return _0x1ed9c0;}function addFieldsToQuery(_0x2f8d52,_0x32726d,_0x329641,_0x396704,_0x58c49d){var _0x4ff15d=_0x58c49d?'c':_0x1e46('0x13');if(!_0x32726d){_0x32726d=['id','firstName',_0x1e46('0x14'),_0x1e46('0x15'),_0x1e46('0x16'),_0x1e46('0x17'),_0x1e46('0x18'),_0x1e46('0x6'),_0x1e46('0x19'),'createdAt',_0x1e46('0x1a'),_0x1e46('0x1b'),_0x1e46('0x1c')];}else if(!_0x32726d[_0x1e46('0x1d')]('id')){_0x32726d[_0x1e46('0x1e')]('id');}var _0x4f7395=_0x329641&&_0x58c49d||!_0x329641&&!_0x58c49d;if(_0x396704){_0x4f7395=_0x396704&&_0x58c49d||!_0x396704&&!_0x58c49d;}_0x32726d['forEach'](function(_0x4b636a){if(_0x4b636a==='TagIds'){if(_0x4f7395){_0x2f8d52['field'](_0x1e46('0x1f'),_0x4b636a);}else if(_0x329641||_0x396704){_0x2f8d52[_0x1e46('0x20')](_0x4ff15d+'.'+_0x4b636a);}}else{_0x2f8d52['field'](_0x4ff15d+'.'+_0x4b636a);}});return _0x2f8d52;}function getSqlClauses(){var _0x34bfb6={'default':squel['expr'](),'fields':squel['expr'](),'filter':squel[_0x1e46('0x21')](),'tags':{'clause':squel[_0x1e46('0x21')](),'ids':null},'user':{'clause':squel[_0x1e46('0x21')](),'skip':![]}};return _0x34bfb6;}function parseTagParameter(_0x5c0588){var _0x482858=squel[_0x1e46('0x21')]();if(_0x5c0588){var _0x42664d=utils[_0x1e46('0x22')](_0x5c0588);_0x42664d[_0x1e46('0x23')](function(_0x164441){_0x482858['or'](_0x1e46('0x24'),'%,'+_0x164441+',%');});}return _0x482858;}function parseSearchFilter(_0x265a7f){var _0x29ef3f=squel[_0x1e46('0x21')]();if(_0x265a7f){var _0x1eef6d=_0x265a7f[_0x1e46('0x25')]('\x5c','\x5c\x5c')[_0x1e46('0x25')](/'/g,'\x27\x27');var _0x132f90=qs[_0x1e46('0x26')](_0x1eef6d);if(_0x1eef6d[_0x1e46('0x27')]('\x20')['length']>0x1){_0x29ef3f['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x1eef6d,!![]),null);}else{if(qs['isNumeric'](_0x1eef6d)){_0x29ef3f['or'](_0x1e46('0x28'),_0x132f90+'%');_0x29ef3f['or']('c.phone\x20LIKE\x20?',_0x132f90+'%');_0x29ef3f['or'](_0x1e46('0x29'),_0x132f90+'%');_0x29ef3f['or']('c.fax\x20LIKE\x20?',_0x132f90+'%');}else if(qs[_0x1e46('0x2a')](_0x1eef6d)){_0x29ef3f['or'](_0x1e46('0x2b'),_0x132f90+'%');}else{_0x29ef3f['or'](_0x1e46('0x2c'),'%'+_0x132f90+'%');_0x29ef3f['or']('c.lastName\x20LIKE\x20?','%'+_0x132f90+'%');_0x29ef3f['or']('c.email\x20LIKE\x20?','%'+_0x132f90+'%');}}}return _0x29ef3f;}function parseAdvancedSearchFilter(_0x3beb01,_0x54156a){var _0x35bef0=getSqlClauses();var _0x4e8840=as[_0x1e46('0x2d')](_0x3beb01);var _0x5483ac=_0x4e8840[_0x1e46('0x2e')];for(var _0x2e1eb9=0x0;_0x2e1eb9<_0x4e8840[_0x1e46('0x2f')][_0x1e46('0x30')];_0x2e1eb9++){var _0xe7142c=_0x4e8840[_0x1e46('0x2f')][_0x2e1eb9];var _0xc9d0e0='c';var _0x16b2fa=_[_0x1e46('0x31')](_0x54156a,[_0x1e46('0x32'),_0xe7142c[_0x1e46('0x20')]]);if(_0x16b2fa){if(_0xe7142c[_0x1e46('0x20')]==='dateOfBirth'||_0x16b2fa[_0x1e46('0x33')]===_0x1e46('0x34')){_0xe7142c[_0x1e46('0x35')]=_0x1e46('0x36');}var _0x35d11b=as['buildExpression'](_0xc9d0e0,_0x16b2fa['type'],_0xe7142c);_0x35bef0[_0x1e46('0x37')][_0x5483ac](_0x35d11b[_0x1e46('0x38')],_0x35d11b['value'][_0x1e46('0x39')],_0x35d11b[_0x1e46('0x3a')][_0x1e46('0x3b')]);}else{if(_0xe7142c[_0x1e46('0x20')]===_0x1e46('0x3c')){var _0x1d77f8=_0xe7142c[_0x1e46('0x3a')][_0x1e46('0x27')](',')[_0x1e46('0x3d')](function(_0x56f66f){return Number(_0x56f66f);});var _0x30739e=parseTagParameter(_0x1d77f8);_0x35bef0['tags'][_0x1e46('0x3e')][_0x1e46('0x3f')](_0x30739e);_0x35bef0['tags'][_0x1e46('0x40')]=_0x1d77f8;}else if(_0xe7142c['field']===_0x1e46('0x41')){_0x35bef0['user']['clause'][_0x1e46('0x3f')](_0x1e46('0x42'),_0xe7142c[_0x1e46('0x3a')]);_0x35bef0[_0x1e46('0x43')][_0x1e46('0x44')]=!![];}}}return _0x35bef0;}function parseModelFields(_0x6945f7,_0x30f049){var _0xadc8e8=squel['expr']();var _0x2c9981=_(_0x6945f7)[_0x1e46('0x45')]()['map'](function(_0x4c77a5){return _['some'](_0x30f049,[_0x1e46('0x32'),_0x4c77a5])?_0x4c77a5:undefined;})[_0x1e46('0x46')]()[_0x1e46('0x3a')]();if(_0x6945f7[_0x1e46('0x47')]){_0x2c9981[_0x1e46('0x1e')](_0x1e46('0x47'));}if(_0x6945f7['User']){_0x2c9981[_0x1e46('0x1e')](_0x1e46('0x41'));}if(_0x2c9981[_0x1e46('0x30')]>0x0){_0x2c9981[_0x1e46('0x23')](function(_0x218c7b){if(_0x218c7b===_0x1e46('0x6')){_0xadc8e8[_0x1e46('0x3f')](_0x1e46('0x48'),[][_0x1e46('0x49')](_0x6945f7[_0x218c7b]));}else if(_0x218c7b==='Contact'){var _0x239e98='%'+_0x6945f7[_0x218c7b]+'%';_0xadc8e8['and'](_0x1e46('0x4a'),_0x239e98);}else if(_0x218c7b===_0x1e46('0x41')){_0xadc8e8[_0x1e46('0x3f')](_0x1e46('0x42'),_0x6945f7[_0x218c7b]);}else{_0xadc8e8[_0x1e46('0x3f')]('c.'+_0x218c7b+_0x1e46('0x4b'),_0x6945f7[_0x218c7b]);}});}return _0xadc8e8;}function parseQueryParameters(_0x42bc60,_0x167917){var _0x4bbe64=getSqlClauses();return Promise['resolve']()[_0x1e46('0x4c')](function(){return parseModelFields(_0x42bc60,_0x167917);})[_0x1e46('0x4c')](function(_0x3fd07d){_0x4bbe64[_0x1e46('0x4d')][_0x1e46('0x3f')](_0x3fd07d);return parseTagParameter(_0x42bc60[_0x1e46('0x4e')]);})[_0x1e46('0x4c')](function(_0x224f6c){_0x4bbe64[_0x1e46('0x4f')][_0x1e46('0x3e')][_0x1e46('0x3f')](_0x224f6c);return parseSearchFilter(_0x42bc60[_0x1e46('0x50')]);})[_0x1e46('0x4c')](function(_0x3e773e){_0x4bbe64[_0x1e46('0x50')]=_0x3e773e;return _0x4bbe64;});}function checkListsRestrictions(_0x2ba50a,_0xd431c8,_0x493df5){var _0x220cb9=squel[_0x1e46('0x21')]();return Promise['resolve']()[_0x1e46('0x4c')](function(){if(_0xd431c8[_0x1e46('0x51')]&&_0x2ba50a[_0x1e46('0x4')]===_0x1e46('0x5')&&!_0x493df5){return _0x2ba50a[_0x1e46('0x52')]({'attributes':['id'],'raw':!![]});}})[_0x1e46('0x4c')](function(_0x4f44db){if(_0x4f44db){if(_0x4f44db[_0x1e46('0x30')]===0x0){_0x220cb9[_0x1e46('0x3f')](_0x1e46('0x53'));}else{_0x220cb9[_0x1e46('0x3f')](_0x1e46('0x48'),_[_0x1e46('0x3d')](_0x4f44db,'id'));}}})[_0x1e46('0x4c')](function(){return _0x220cb9;});}function buildContactsQuery(_0x35f349,_0x276b17,_0x1bfcca,_0x416b3c,_0xe9718c,_0x3c8a3a){if(_0x276b17){_0x276b17=_0x1bfcca[_0x1e46('0x54')];}_0x35f349=addFieldsToQuery(_0x35f349,_0x276b17,_0x416b3c,_0x3c8a3a,!![]);var _0x5e2603=squel[_0x1e46('0x9')]();_0x5e2603=addFieldsToQuery(_0x5e2603,_0x276b17,_0x416b3c,_0x3c8a3a,![]);if(_0x416b3c||_0x3c8a3a){_0x35f349=applyJoinClauses(_0x35f349,!![]);_0x35f349[_0x1e46('0x55')](_0x1e46('0x56'));if(_0x1bfcca[_0x1e46('0x57')]){_0x5e2603[_0x1e46('0x57')](_0x1bfcca[_0x1e46('0x57')]);}if(_0x1bfcca[_0x1e46('0x58')]){_0x5e2603['offset'](_0x1bfcca[_0x1e46('0x58')]);}}else{_0x5e2603=applyJoinClauses(_0x5e2603,![]);_0x5e2603[_0x1e46('0x55')](_0x1e46('0x59'));if(_0x1bfcca['limit']){_0x35f349['limit'](_0x1bfcca[_0x1e46('0x57')]);}if(_0x1bfcca[_0x1e46('0x58')]){_0x35f349[_0x1e46('0x58')](_0x1bfcca['offset']);}}_0x5e2603[_0x1e46('0x5a')](_0xe9718c);if(_0x1bfcca[_0x1e46('0x5b')]){_0x1bfcca['order'][_0x1e46('0x23')](function(_0x27c4c3){_0x35f349['order']('c.'+_0x27c4c3[0x0],_0x27c4c3[0x1]===_0x1e46('0x5c')?![]:!![]);_0x5e2603[_0x1e46('0x5b')]('subqry.'+_0x27c4c3[0x0],_0x27c4c3[0x1]==='DESC'?![]:!![]);});}_0x5e2603[_0x1e46('0xa')](_0x35f349,'subqry');return _0x5e2603;}function getFilteredContacts(_0x108281){var _0x2af1f2=[];return db[_0x1e46('0x3c')][_0x1e46('0x5d')]({'attributes':['id',_0x1e46('0x32'),_0x1e46('0x5e')],'raw':!![]})[_0x1e46('0x4c')](function(_0x1f7214){_0x2af1f2=_['keyBy'](_0x1f7214,'id');var _0x280e19={'type':db['Sequelize']['QueryTypes'][_0x1e46('0x5f')],'model':db['CmContact'],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x1e46('0x60')][_0x1e46('0x61')](_0x108281[_0x1e46('0x62')](),_0x280e19);})['then'](function(_0x45e022){_0x45e022[_0x1e46('0x23')](function(_0x1f9c35){if(_0x1f9c35['TagIds']){_0x1f9c35[_0x1e46('0x63')]=[];_0x1f9c35[_0x1e46('0x1c')][_0x1e46('0x27')](',')[_0x1e46('0x23')](function(_0x5c3099){_0x1f9c35['Tags']['push'](_0x2af1f2[_0x5c3099]);});}delete _0x1f9c35[_0x1e46('0x1c')];});return _0x45e022;});}function countFilteredContacts(_0x20ccdd,_0x1bc9cf){var _0x56c316=_0x20ccdd[_0x1e46('0x64')]();_0x56c316[_0x1e46('0x20')](_0x1e46('0x65'));_0x56c316=applyJoinClauses(_0x56c316,!![]);_0x20ccdd[_0x1e46('0x55')](_0x1e46('0x56'));var _0x39a256=utils[_0x1e46('0x22')](_0x1bc9cf);if(!_[_0x1e46('0x66')](_0x39a256)){_0x56c316['where'](_0x1e46('0x67'),_0x39a256);}var _0xb22153={'type':db['Sequelize'][_0x1e46('0x68')][_0x1e46('0x5f')],'raw':!![]};return db[_0x1e46('0x60')][_0x1e46('0x61')](_0x56c316[_0x1e46('0x62')](),_0xb22153)['then'](function(_0x52f011){return _0x52f011[0x0]['COUNT(*)'];});}module[_0x1e46('0x69')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0x483a=['SELECT','query','Tags','clone','t.id\x20IN\x20?','sequelize','toString','COUNT(*)','exports','lodash','squel','../parsers/qs','../../mysqldb','role','search','ListId','autocomplete','true','select','from','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','left_join','uc.CmContactId\x20=\x20','.id','cm_contact_has_tags','ct.CmContactId\x20=\x20','firstName','lastName','phone','fax','email','CompanyId','createdAt','deletedAt','includes','push','forEach','TagIds','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','escapeLIKESpecialChars','length','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','sqlOperator','conditions','name','dateOfBirth','fieldType','datetime','castTo','DATE','buildExpression','type','text','start','value','end','split','map','and','User','user','clause','uc.UserId\x20=\x20?','skip','keys','some','compact','Contact','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','tag','then','tags','filter','resolve','attributes','group','c.id','limit','offset','subqry.id','having','order','DESC','subqry.','Tag','findAll','color','keyBy','Sequelize','QueryTypes'];(function(_0x1c27d2,_0xdd70df){var _0x50f8df=function(_0x5ac89f){while(--_0x5ac89f){_0x1c27d2['push'](_0x1c27d2['shift']());}};_0x50f8df(++_0xdd70df);}(_0x483a,0x156));var _0xa483=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x483a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa483('0x0'));var squel=require(_0xa483('0x1'));var as=require('../parsers/advancedSearch');var qs=require(_0xa483('0x2'));var utils=require('../interaction/utils');var db=require(_0xa483('0x3'))['db'];function skipContactsQuery(_0x28a053,_0x3676ff){var _0x7641f2=![];if(_0x28a053[_0xa483('0x4')]==='agent'&&!_0x3676ff[_0xa483('0x5')]&&!_0x3676ff[_0xa483('0x6')]&&_0x3676ff[_0xa483('0x7')]!==_0xa483('0x8')){_0x7641f2=!![];}return _0x7641f2;}function getContactsSubquery(){return squel[_0xa483('0x9')]()[_0xa483('0xa')](_0xa483('0xb'),'c')[_0xa483('0xc')](_0xa483('0xd'));}function applyJoinClauses(_0xc010d1,_0x280436){var _0x59e691=_0x280436?'c':_0xa483('0xe');_0xc010d1[_0xa483('0xf')]('cm_user_has_contacts','uc',_0xa483('0x10')+_0x59e691+_0xa483('0x11'))[_0xa483('0xf')](_0xa483('0x12'),'ct',_0xa483('0x13')+_0x59e691+_0xa483('0x11'))[_0xa483('0xf')]('tools_tags','t','t.id\x20=\x20ct.TagId');return _0xc010d1;}function addFieldsToQuery(_0x11a864,_0x32b7cb,_0xb422f5,_0x4077b5,_0x3da9e0){var _0x296d79=_0x3da9e0?'c':_0xa483('0xe');if(!_0x32b7cb){_0x32b7cb=['id',_0xa483('0x14'),_0xa483('0x15'),_0xa483('0x16'),'mobile',_0xa483('0x17'),_0xa483('0x18'),_0xa483('0x6'),_0xa483('0x19'),_0xa483('0x1a'),'updatedAt',_0xa483('0x1b'),'TagIds'];}else if(!_0x32b7cb[_0xa483('0x1c')]('id')){_0x32b7cb[_0xa483('0x1d')]('id');}var _0x306b71=_0xb422f5&&_0x3da9e0||!_0xb422f5&&!_0x3da9e0;if(_0x4077b5){_0x306b71=_0x4077b5&&_0x3da9e0||!_0x4077b5&&!_0x3da9e0;}_0x32b7cb[_0xa483('0x1e')](function(_0x18ac58){if(_0x18ac58===_0xa483('0x1f')){if(_0x306b71){_0x11a864[_0xa483('0x20')](_0xa483('0x21'),_0x18ac58);}else if(_0xb422f5||_0x4077b5){_0x11a864[_0xa483('0x20')](_0x296d79+'.'+_0x18ac58);}}else{_0x11a864[_0xa483('0x20')](_0x296d79+'.'+_0x18ac58);}});return _0x11a864;}function getSqlClauses(){var _0x31da12={'default':squel[_0xa483('0x22')](),'fields':squel['expr'](),'filter':squel[_0xa483('0x22')](),'tags':{'clause':squel[_0xa483('0x22')](),'ids':null},'user':{'clause':squel[_0xa483('0x22')](),'skip':![]}};return _0x31da12;}function parseTagParameter(_0x3ec5e2){var _0x18949a=squel[_0xa483('0x22')]();if(_0x3ec5e2){var _0x455ea0=utils[_0xa483('0x23')](_0x3ec5e2);_0x455ea0[_0xa483('0x1e')](function(_0x125ec2){_0x18949a['or'](_0xa483('0x24'),'%,'+_0x125ec2+',%');});}return _0x18949a;}function parseSearchFilter(_0x44800f){var _0x299465=squel['expr']();if(_0x44800f){var _0x39ffbf=_0x44800f['replace']('\x5c','\x5c\x5c')[_0xa483('0x25')](/'/g,'\x27\x27');var _0x18e0cd=qs[_0xa483('0x26')](_0x39ffbf);if(_0x39ffbf['split']('\x20')[_0xa483('0x27')]>0x1){_0x299465['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xa483('0x28')](_0x39ffbf,!![]),null);}else{if(qs[_0xa483('0x29')](_0x39ffbf)){_0x299465['or'](_0xa483('0x2a'),_0x18e0cd+'%');_0x299465['or'](_0xa483('0x2b'),_0x18e0cd+'%');_0x299465['or'](_0xa483('0x2c'),_0x18e0cd+'%');_0x299465['or'](_0xa483('0x2d'),_0x18e0cd+'%');}else if(qs[_0xa483('0x2e')](_0x39ffbf)){_0x299465['or'](_0xa483('0x2f'),_0x18e0cd+'%');}else{_0x299465['or'](_0xa483('0x30'),'%'+_0x18e0cd+'%');_0x299465['or'](_0xa483('0x31'),'%'+_0x18e0cd+'%');_0x299465['or']('c.email\x20LIKE\x20?','%'+_0x18e0cd+'%');}}}return _0x299465;}function parseAdvancedSearchFilter(_0xdf25,_0x80116d){var _0x38ec56=getSqlClauses();var _0x330ebf=as[_0xa483('0x32')](_0xdf25);var _0x3a5220=_0x330ebf[_0xa483('0x33')];for(var _0x1d9e22=0x0;_0x1d9e22<_0x330ebf[_0xa483('0x34')][_0xa483('0x27')];_0x1d9e22++){var _0x79356=_0x330ebf[_0xa483('0x34')][_0x1d9e22];var _0x4ee436='c';var _0x421147=_['find'](_0x80116d,[_0xa483('0x35'),_0x79356[_0xa483('0x20')]]);if(_0x421147){if(_0x79356[_0xa483('0x20')]===_0xa483('0x36')||_0x421147[_0xa483('0x37')]===_0xa483('0x38')){_0x79356[_0xa483('0x39')]=_0xa483('0x3a');}var _0x2ecc28=as[_0xa483('0x3b')](_0x4ee436,_0x421147[_0xa483('0x3c')],_0x79356);_0x38ec56['default'][_0x3a5220](_0x2ecc28[_0xa483('0x3d')],_0x2ecc28['value'][_0xa483('0x3e')],_0x2ecc28[_0xa483('0x3f')][_0xa483('0x40')]);}else{if(_0x79356[_0xa483('0x20')]==='Tag'){var _0x3c93f2=_0x79356[_0xa483('0x3f')][_0xa483('0x41')](',')[_0xa483('0x42')](function(_0x478ea7){return Number(_0x478ea7);});var _0x81d4db=parseTagParameter(_0x3c93f2);_0x38ec56['tags']['clause'][_0xa483('0x43')](_0x81d4db);_0x38ec56['tags']['ids']=_0x3c93f2;}else if(_0x79356[_0xa483('0x20')]===_0xa483('0x44')){_0x38ec56[_0xa483('0x45')][_0xa483('0x46')][_0xa483('0x43')](_0xa483('0x47'),_0x79356[_0xa483('0x3f')]);_0x38ec56['user'][_0xa483('0x48')]=!![];}}}return _0x38ec56;}function parseModelFields(_0x32b2d8,_0x1b6fb7){var _0x34106f=squel[_0xa483('0x22')]();var _0x357e1a=_(_0x32b2d8)[_0xa483('0x49')]()[_0xa483('0x42')](function(_0x599881){return _[_0xa483('0x4a')](_0x1b6fb7,[_0xa483('0x35'),_0x599881])?_0x599881:undefined;})[_0xa483('0x4b')]()[_0xa483('0x3f')]();if(_0x32b2d8[_0xa483('0x4c')]){_0x357e1a[_0xa483('0x1d')](_0xa483('0x4c'));}if(_0x32b2d8[_0xa483('0x44')]){_0x357e1a['push'](_0xa483('0x44'));}if(_0x357e1a[_0xa483('0x27')]>0x0){_0x357e1a[_0xa483('0x1e')](function(_0x53203f){if(_0x53203f===_0xa483('0x6')){_0x34106f['and'](_0xa483('0x4d'),[][_0xa483('0x4e')](_0x32b2d8[_0x53203f]));}else if(_0x53203f==='Contact'){var _0x503ae8='%'+_0x32b2d8[_0x53203f]+'%';_0x34106f[_0xa483('0x43')](_0xa483('0x4f'),_0x503ae8);}else if(_0x53203f===_0xa483('0x44')){_0x34106f[_0xa483('0x43')](_0xa483('0x47'),_0x32b2d8[_0x53203f]);}else{_0x34106f[_0xa483('0x43')]('c.'+_0x53203f+_0xa483('0x50'),_0x32b2d8[_0x53203f]);}});}return _0x34106f;}function parseQueryParameters(_0x47a9a4,_0xcf3439){var _0x1a746f=getSqlClauses();return Promise['resolve']()['then'](function(){return parseModelFields(_0x47a9a4,_0xcf3439);})['then'](function(_0x411a89){_0x1a746f['fields'][_0xa483('0x43')](_0x411a89);return parseTagParameter(_0x47a9a4[_0xa483('0x51')]);})[_0xa483('0x52')](function(_0x2353a3){_0x1a746f[_0xa483('0x53')][_0xa483('0x46')][_0xa483('0x43')](_0x2353a3);return parseSearchFilter(_0x47a9a4[_0xa483('0x54')]);})[_0xa483('0x52')](function(_0x1c1de2){_0x1a746f[_0xa483('0x54')]=_0x1c1de2;return _0x1a746f;});}function checkListsRestrictions(_0x910b77,_0x564ee3,_0x1a048a){var _0x2aa359=squel[_0xa483('0x22')]();return Promise[_0xa483('0x55')]()[_0xa483('0x52')](function(){if(_0x564ee3[_0xa483('0x5')]&&_0x910b77[_0xa483('0x4')]==='agent'&&!_0x1a048a){return _0x910b77['getLists']({'attributes':['id'],'raw':!![]});}})[_0xa483('0x52')](function(_0x57ec1d){if(_0x57ec1d){if(_0x57ec1d[_0xa483('0x27')]===0x0){_0x2aa359[_0xa483('0x43')]('c.ListId\x20IS\x20NULL');}else{_0x2aa359['and']('c.ListId\x20IN\x20?',_['map'](_0x57ec1d,'id'));}}})[_0xa483('0x52')](function(){return _0x2aa359;});}function buildContactsQuery(_0x52b7b5,_0x23d914,_0x14d527,_0x1a9b94,_0x3a4e24,_0x23b7b7){if(_0x23d914){_0x23d914=_0x14d527[_0xa483('0x56')];}_0x52b7b5=addFieldsToQuery(_0x52b7b5,_0x23d914,_0x1a9b94,_0x23b7b7,!![]);var _0x27130a=squel[_0xa483('0x9')]();_0x27130a=addFieldsToQuery(_0x27130a,_0x23d914,_0x1a9b94,_0x23b7b7,![]);if(_0x1a9b94||_0x23b7b7){_0x52b7b5=applyJoinClauses(_0x52b7b5,!![]);_0x52b7b5[_0xa483('0x57')](_0xa483('0x58'));if(_0x14d527[_0xa483('0x59')]){_0x27130a[_0xa483('0x59')](_0x14d527[_0xa483('0x59')]);}if(_0x14d527[_0xa483('0x5a')]){_0x27130a[_0xa483('0x5a')](_0x14d527[_0xa483('0x5a')]);}}else{_0x27130a=applyJoinClauses(_0x27130a,![]);_0x27130a[_0xa483('0x57')](_0xa483('0x5b'));if(_0x14d527['limit']){_0x52b7b5['limit'](_0x14d527[_0xa483('0x59')]);}if(_0x14d527[_0xa483('0x5a')]){_0x52b7b5[_0xa483('0x5a')](_0x14d527[_0xa483('0x5a')]);}}_0x27130a[_0xa483('0x5c')](_0x3a4e24);if(_0x14d527['order']){_0x14d527[_0xa483('0x5d')][_0xa483('0x1e')](function(_0xd26a75){_0x52b7b5[_0xa483('0x5d')]('c.'+_0xd26a75[0x0],_0xd26a75[0x1]===_0xa483('0x5e')?![]:!![]);_0x27130a[_0xa483('0x5d')](_0xa483('0x5f')+_0xd26a75[0x0],_0xd26a75[0x1]==='DESC'?![]:!![]);});}_0x27130a['from'](_0x52b7b5,_0xa483('0xe'));return _0x27130a;}function getFilteredContacts(_0x510396){var _0x4403b0=[];return db[_0xa483('0x60')][_0xa483('0x61')]({'attributes':['id',_0xa483('0x35'),_0xa483('0x62')],'raw':!![]})[_0xa483('0x52')](function(_0x5cfad9){_0x4403b0=_[_0xa483('0x63')](_0x5cfad9,'id');var _0x2865a9={'type':db[_0xa483('0x64')][_0xa483('0x65')][_0xa483('0x66')],'model':db['CmContact'],'mapToModel':!![],'nest':!![],'raw':!![]};return db['sequelize'][_0xa483('0x67')](_0x510396['toString'](),_0x2865a9);})[_0xa483('0x52')](function(_0x1b42ee){_0x1b42ee[_0xa483('0x1e')](function(_0x1cc02b){if(_0x1cc02b[_0xa483('0x1f')]){_0x1cc02b['Tags']=[];_0x1cc02b[_0xa483('0x1f')][_0xa483('0x41')](',')[_0xa483('0x1e')](function(_0x773567){_0x1cc02b[_0xa483('0x68')]['push'](_0x4403b0[_0x773567]);});}delete _0x1cc02b[_0xa483('0x1f')];});return _0x1b42ee;});}function countFilteredContacts(_0x247db7,_0x2d90cc){var _0x214af1=_0x247db7[_0xa483('0x69')]();_0x214af1[_0xa483('0x20')]('COUNT(*)');_0x214af1=applyJoinClauses(_0x214af1,!![]);_0x247db7[_0xa483('0x57')]('c.id');var _0x305770=utils[_0xa483('0x23')](_0x2d90cc);if(!_['isEmpty'](_0x305770)){_0x214af1['where'](_0xa483('0x6a'),_0x305770);}var _0x32bf60={'type':db[_0xa483('0x64')][_0xa483('0x65')][_0xa483('0x66')],'raw':!![]};return db[_0xa483('0x6b')][_0xa483('0x67')](_0x214af1[_0xa483('0x6c')](),_0x32bf60)[_0xa483('0x52')](function(_0x5ebf65){return _0x5ebf65[0x0][_0xa483('0x6d')];});}module[_0xa483('0x6e')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index d1854c5..ea9059c 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 _0xb6b4=['app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','error','test','getCiphers','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','data','binary','write','end','final','close','decryptFile','createDecipher','update','unlink','secret','utf8','base64','lodash','../../config/environment','../../config/logger'];(function(_0x3d6591,_0x3f0085){var _0x57e3ea=function(_0x1d96ed){while(--_0x1d96ed){_0x3d6591['push'](_0x3d6591['shift']());}};_0x57e3ea(++_0x3f0085);}(_0xb6b4,0xc3));var _0x4b6b=function(_0x240a9a,_0x2489e5){_0x240a9a=_0x240a9a-0x0;var _0x27818a=_0xb6b4[_0x240a9a];return _0x27818a;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require('bluebird');var _=require(_0x4b6b('0x0'));var config=require(_0x4b6b('0x1'));var logger=require(_0x4b6b('0x2'))(_0x4b6b('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x4b6b('0x4')][_0x4b6b('0x5')],'algorithm':_0x4b6b('0x6')};const fileOptions={'algorithm':_0x4b6b('0x7')};if(config[_0x4b6b('0x8')]&&config[_0x4b6b('0x8')][_0x4b6b('0x9')]){var isSupported=isAlgorithmSupported(config['encrypt']['algorithm']);if(isSupported){fileOptions['algorithm']=config[_0x4b6b('0x8')][_0x4b6b('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x4b6b('0xa')](',\x20');logger[_0x4b6b('0xb')](config[_0x4b6b('0x8')][_0x4b6b('0x9')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x4458f2){return AES_SUPPORTED_RX[_0x4b6b('0xc')](_0x4458f2);}function getSupportedCiphers(){return crypto[_0x4b6b('0xd')]()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0x477697){return getSupportedCiphers()[_0x4b6b('0xe')](_0x477697)>-0x1;}function combineOptions(_0x310fed){var _0x40a48b={};for(var _0x373499 in fileOptions){if(fileOptions[_0x4b6b('0xf')](_0x373499)){_0x40a48b[_0x373499]=fileOptions[_0x373499];}}if(_0x310fed){for(var _0xaca0ef in _0x310fed){if(_0x310fed[_0x4b6b('0xf')](_0xaca0ef)){_0x40a48b[_0xaca0ef]=_0x310fed[_0xaca0ef];}}}return _0x40a48b;}exports[_0x4b6b('0x10')]=function(_0x328f26,_0x4f4762,_0xdf62ed,_0x5ea312){return new BPromise(function(_0x44ae3d,_0x36ba89){_0x5ea312=combineOptions(_0x5ea312);var _0x39d8a7=new Buffer(_0xdf62ed);var _0x58cf15=fs[_0x4b6b('0x11')](_0x328f26);var _0x553f5e=fs[_0x4b6b('0x12')](_0x4f4762);var _0x1f2dd4=crypto[_0x4b6b('0x13')](_0x5ea312['algorithm'],_0x39d8a7);_0x58cf15['on'](_0x4b6b('0x14'),function(_0x13398c){var _0x5017cb=new Buffer(_0x1f2dd4['update'](_0x13398c),_0x4b6b('0x15'));_0x553f5e[_0x4b6b('0x16')](_0x5017cb);});_0x58cf15['on'](_0x4b6b('0x17'),function(){try{var _0x51c9ea=new Buffer(_0x1f2dd4[_0x4b6b('0x18')]('binary'),_0x4b6b('0x15'));_0x553f5e[_0x4b6b('0x16')](_0x51c9ea);_0x553f5e[_0x4b6b('0x17')]();_0x553f5e['on'](_0x4b6b('0x19'),function(){return _0x44ae3d(_0x4f4762);});}catch(_0x295181){fs['unlink'](_0x4f4762);return _0x36ba89(_0x295181);}});});};exports[_0x4b6b('0x1a')]=function(_0x19a57c,_0x550ce1,_0xf32020,_0x2536a7){return new BPromise(function(_0x10b8df,_0x1e888f){_0x2536a7=combineOptions(_0x2536a7);var _0x4db5f3=new Buffer(_0xf32020);var _0x40e40e=fs['createReadStream'](_0x19a57c);var _0x2b8a3a=fs[_0x4b6b('0x12')](_0x550ce1);var _0x2c6339=crypto[_0x4b6b('0x1b')](_0x2536a7[_0x4b6b('0x9')],_0x4db5f3);_0x40e40e['on']('data',function(_0x1f2ae2){var _0x382675=new Buffer(_0x2c6339[_0x4b6b('0x1c')](_0x1f2ae2),_0x4b6b('0x15'));_0x2b8a3a[_0x4b6b('0x16')](_0x382675);});_0x40e40e['on'](_0x4b6b('0x17'),function(){try{var _0x384213=new Buffer(_0x2c6339[_0x4b6b('0x18')](_0x4b6b('0x15')),_0x4b6b('0x15'));_0x2b8a3a[_0x4b6b('0x16')](_0x384213);_0x2b8a3a[_0x4b6b('0x17')]();_0x2b8a3a['on'](_0x4b6b('0x19'),function(){return _0x10b8df(_0x550ce1);});}catch(_0x24d970){fs[_0x4b6b('0x1d')](_0x550ce1);return _0x1e888f(_0x24d970);}});});};exports['encryptString']=function(_0x427661,_0xc581d9,_0x595b38){var _0x4001d8=_0x595b38||stringOptions[_0x4b6b('0x9')];var _0x281393=_0xc581d9||stringOptions[_0x4b6b('0x1e')];var _0x59cce8=crypto[_0x4b6b('0x13')](_0x4001d8,_0x281393);var _0x5a0b76=_0x59cce8['update'](_0x427661,_0x4b6b('0x1f'),_0x4b6b('0x20'));_0x5a0b76+=_0x59cce8['final'](_0x4b6b('0x20'));return _0x5a0b76;};exports['decryptString']=function(_0x1ffca9,_0x3719bb,_0x59adb7){var _0x4835d4=_0x59adb7||stringOptions['algorithm'];var _0x1d1bd4=_0x3719bb||stringOptions[_0x4b6b('0x1e')];var _0x476036=crypto[_0x4b6b('0x1b')](_0x4835d4,_0x1d1bd4);var _0x42b4ae=_0x476036['update'](_0x1ffca9,_0x4b6b('0x20'),_0x4b6b('0x1f'));_0x42b4ae+=_0x476036['final'](_0x4b6b('0x1f'));return _0x42b4ae;}; \ No newline at end of file +var _0x77c9=['filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','update','write','end','final','binary','close','unlink','decryptFile','createDecipher','data','encryptString','secret','utf8','base64','decryptString','crypto','bluebird','lodash','../../config/logger','app','secrets','session','aes-256-ctr','encrypt','algorithm','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','getCiphers'];(function(_0x26e727,_0x3e65be){var _0x563800=function(_0xbcf999){while(--_0xbcf999){_0x26e727['push'](_0x26e727['shift']());}};_0x563800(++_0x3e65be);}(_0x77c9,0xdb));var _0x977c=function(_0x11d85a,_0x4a908e){_0x11d85a=_0x11d85a-0x0;var _0x5b5638=_0x77c9[_0x11d85a];return _0x5b5638;};'use strict';var crypto=require(_0x977c('0x0'));var fs=require('fs');var BPromise=require(_0x977c('0x1'));var _=require(_0x977c('0x2'));var config=require('../../config/environment');var logger=require(_0x977c('0x3'))(_0x977c('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x977c('0x5')][_0x977c('0x6')],'algorithm':_0x977c('0x7')};const fileOptions={'algorithm':'aes192'};if(config[_0x977c('0x8')]&&config[_0x977c('0x8')][_0x977c('0x9')]){var isSupported=isAlgorithmSupported(config[_0x977c('0x8')][_0x977c('0x9')]);if(isSupported){fileOptions['algorithm']=config['encrypt'][_0x977c('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger['error'](config[_0x977c('0x8')][_0x977c('0x9')],_0x977c('0xa'),supportedAlgorithms);}}function isASupportedCipher(_0x313459){return AES_SUPPORTED_RX['test'](_0x313459);}function getSupportedCiphers(){return crypto[_0x977c('0xb')]()[_0x977c('0xc')](isASupportedCipher);}function isAlgorithmSupported(_0x139e5d){return getSupportedCiphers()[_0x977c('0xd')](_0x139e5d)>-0x1;}function combineOptions(_0x3ff20d){var _0x1fa966={};for(var _0x198005 in fileOptions){if(fileOptions[_0x977c('0xe')](_0x198005)){_0x1fa966[_0x198005]=fileOptions[_0x198005];}}if(_0x3ff20d){for(var _0x36a196 in _0x3ff20d){if(_0x3ff20d['hasOwnProperty'](_0x36a196)){_0x1fa966[_0x36a196]=_0x3ff20d[_0x36a196];}}}return _0x1fa966;}exports[_0x977c('0xf')]=function(_0x32f082,_0x1d862a,_0x210f2d,_0x4cfb3b){return new BPromise(function(_0x1290a7,_0x29f673){_0x4cfb3b=combineOptions(_0x4cfb3b);var _0x4e56bb=new Buffer(_0x210f2d);var _0x58de65=fs[_0x977c('0x10')](_0x32f082);var _0x1374bc=fs[_0x977c('0x11')](_0x1d862a);var _0x16147d=crypto['createCipher'](_0x4cfb3b[_0x977c('0x9')],_0x4e56bb);_0x58de65['on']('data',function(_0x22c2bd){var _0x1bb0f8=new Buffer(_0x16147d[_0x977c('0x12')](_0x22c2bd),'binary');_0x1374bc[_0x977c('0x13')](_0x1bb0f8);});_0x58de65['on'](_0x977c('0x14'),function(){try{var _0x3d59c1=new Buffer(_0x16147d[_0x977c('0x15')](_0x977c('0x16')),_0x977c('0x16'));_0x1374bc[_0x977c('0x13')](_0x3d59c1);_0x1374bc['end']();_0x1374bc['on'](_0x977c('0x17'),function(){return _0x1290a7(_0x1d862a);});}catch(_0x3afe74){fs[_0x977c('0x18')](_0x1d862a);return _0x29f673(_0x3afe74);}});});};exports[_0x977c('0x19')]=function(_0x23d74b,_0x58db0f,_0x48c35e,_0x436be9){return new BPromise(function(_0x5b22ac,_0x47936e){_0x436be9=combineOptions(_0x436be9);var _0xc5fde7=new Buffer(_0x48c35e);var _0x346dd9=fs[_0x977c('0x10')](_0x23d74b);var _0xc5d21d=fs[_0x977c('0x11')](_0x58db0f);var _0x45b7b5=crypto[_0x977c('0x1a')](_0x436be9[_0x977c('0x9')],_0xc5fde7);_0x346dd9['on'](_0x977c('0x1b'),function(_0x22ae65){var _0xba7e20=new Buffer(_0x45b7b5[_0x977c('0x12')](_0x22ae65),'binary');_0xc5d21d[_0x977c('0x13')](_0xba7e20);});_0x346dd9['on']('end',function(){try{var _0x5059ef=new Buffer(_0x45b7b5[_0x977c('0x15')](_0x977c('0x16')),'binary');_0xc5d21d[_0x977c('0x13')](_0x5059ef);_0xc5d21d['end']();_0xc5d21d['on'](_0x977c('0x17'),function(){return _0x5b22ac(_0x58db0f);});}catch(_0x18f26c){fs[_0x977c('0x18')](_0x58db0f);return _0x47936e(_0x18f26c);}});});};exports[_0x977c('0x1c')]=function(_0x505a02,_0x449dac,_0x180d3e){var _0x32a88e=_0x180d3e||stringOptions[_0x977c('0x9')];var _0x324957=_0x449dac||stringOptions[_0x977c('0x1d')];var _0x57e362=crypto['createCipher'](_0x32a88e,_0x324957);var _0x186600=_0x57e362[_0x977c('0x12')](_0x505a02,_0x977c('0x1e'),_0x977c('0x1f'));_0x186600+=_0x57e362['final'](_0x977c('0x1f'));return _0x186600;};exports[_0x977c('0x20')]=function(_0x468b1d,_0x24d146,_0x53234f){var _0x914af7=_0x53234f||stringOptions[_0x977c('0x9')];var _0x120030=_0x24d146||stringOptions[_0x977c('0x1d')];var _0x5119b9=crypto['createDecipher'](_0x914af7,_0x120030);var _0xbd8ab4=_0x5119b9[_0x977c('0x12')](_0x468b1d,'base64',_0x977c('0x1e'));_0xbd8ab4+=_0x5119b9[_0x977c('0x15')](_0x977c('0x1e'));return _0xbd8ab4;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index b2bc0d2..13dfa79 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 _0x6a7d=['update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','Empty','num','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','existsSync','join','mkdirSync','each','length','csv','%s.%s','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','zip','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','path','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','AnalyticExtractedReport'];(function(_0x6532c8,_0x47506b){var _0x102f57=function(_0x223cd7){while(--_0x223cd7){_0x6532c8['push'](_0x6532c8['shift']());}};_0x102f57(++_0x47506b);}(_0x6a7d,0xf3));var _0xd6a7=function(_0x3490c2,_0x548c5e){_0x3490c2=_0x3490c2-0x0;var _0x891d41=_0x6a7d[_0x3490c2];return _0x891d41;};'use strict';var util=require('util');var path=require(_0xd6a7('0x0'));var _=require(_0xd6a7('0x1'));var csv=require(_0xd6a7('0x2'));var fs=require('fs');var BPromise=require(_0xd6a7('0x3'));var zipdir=require(_0xd6a7('0x4'));var rimraf=require(_0xd6a7('0x5'));var db=require(_0xd6a7('0x6'))['db'];var dbH=require(_0xd6a7('0x6'))[_0xd6a7('0x7')];var logger=require(_0xd6a7('0x8'))(_0xd6a7('0x9'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xd6a7('0xa')][0x3];var PATH=process[_0xd6a7('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x32f115,_0x2869c3){var _0x3baa8e={'status':_0x32f115};var _0x412ff9={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2869c3){_0x3baa8e['savename']=_0x2869c3;}return db[_0xd6a7('0xb')][_0xd6a7('0xc')](_0x3baa8e,_0x412ff9);}function main(){var _0x364514=0x1388;var _0x42bbff;logger[_0xd6a7('0xd')](util[_0xd6a7('0xe')](_0xd6a7('0xf'),EXTRACTED_REPORT_ID,'CSV'));return db[_0xd6a7('0x10')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xd6a7('0x11'),'splitSizeCsv']})['then'](function(_0x511405){if(_0x511405){_0x42bbff=_0x511405;_0x364514=_0x42bbff[_0xd6a7('0x12')]||0x1388;}})[_0xd6a7('0x13')](function(){return dbH[_0xd6a7('0x14')][_0xd6a7('0x15')](util[_0xd6a7('0xe')](_0xd6a7('0x16'),QUERY),{'type':dbH[_0xd6a7('0x14')][_0xd6a7('0x17')][_0xd6a7('0x18')]});})[_0xd6a7('0x13')](function(_0x3f46ef){if(!_0x3f46ef[0x0]['num']){return analyticExtractedReport(_0xd6a7('0x19'));}var _0x21672b=[];var _0x11ea74=0x0;if(_0x42bbff['split']){if(_0x3f46ef&&_0x3f46ef['length']){var _0x2af4c1=_['range'](_0x3f46ef[0x0][_0xd6a7('0x1a')]/_0x364514);var _0x1ae18d=Number[_0xd6a7('0x1b')](_0x3f46ef[0x0][_0xd6a7('0x1a')]/_0x364514)?_0x3f46ef[0x0]['num']%_0x364514:0x0;_0x2af4c1[_0xd6a7('0x1c')](function(_0x98369b){if(_0x98369b>0x0){_0x11ea74+=_0x364514;}_0x21672b[_0xd6a7('0x1d')](dbH[_0xd6a7('0x14')][_0xd6a7('0x15')](util[_0xd6a7('0xe')](_0xd6a7('0x1e'),QUERY,_0x364514,_0x11ea74),{'type':dbH['sequelize'][_0xd6a7('0x17')][_0xd6a7('0x18')]}));});if(_0x1ae18d>0x0){_0x11ea74+=_0x364514;_0x21672b[_0xd6a7('0x1d')](dbH[_0xd6a7('0x14')][_0xd6a7('0x15')](util[_0xd6a7('0xe')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x1ae18d,_0x11ea74),{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}}}else{_0x21672b[_0xd6a7('0x1d')](dbH['sequelize'][_0xd6a7('0x15')](QUERY,{'type':dbH[_0xd6a7('0x14')]['QueryTypes'][_0xd6a7('0x18')]}));}var _0x1b56a4=path[_0xd6a7('0x1f')](PATH);var _0x468839=path[_0xd6a7('0x20')](PATH,_0xd6a7('0x21'));var _0x310de5=_0x42bbff[_0xd6a7('0x11')]&&_0x21672b['length']>0x1;var _0x19768b=[];if(!fs[_0xd6a7('0x22')](path[_0xd6a7('0x23')](_0x1b56a4,_0x468839))&&_0x310de5){fs[_0xd6a7('0x24')](path[_0xd6a7('0x23')](_0x1b56a4,_0x468839));}return BPromise[_0xd6a7('0x25')](_0x21672b,function(_0x51da4a){_0x19768b[_0xd6a7('0x1d')](_0x51da4a);})[_0xd6a7('0x13')](function(){for(var _0x2faba6=0x0;_0x2faba6<_0x19768b[_0xd6a7('0x26')];_0x2faba6+=0x1){var _0x40a6b6;var _0x42edeb=_0x19768b[_0x2faba6];if(_0x310de5){_0x40a6b6=path[_0xd6a7('0x23')](_0x1b56a4,_0x468839,util[_0xd6a7('0xe')]('%s%d.%s',_0x468839,_0x2faba6,_0xd6a7('0x27')));}else{_0x40a6b6=path[_0xd6a7('0x23')](_0x1b56a4,util[_0xd6a7('0xe')]('%s.%s',_0x468839,_0xd6a7('0x27')));}fs['writeFileSync'](_0x40a6b6,csv(_0x42edeb));}})[_0xd6a7('0x13')](function(){if(_0x310de5){return new Promise(function(_0x3ac40c){zipdir(path[_0xd6a7('0x23')](_0x1b56a4,_0x468839),{'saveTo':path[_0xd6a7('0x23')](_0x1b56a4,util[_0xd6a7('0xe')](_0xd6a7('0x28'),_0x468839,'zip'))},function(_0x2a3663,_0xea7cf8){rimraf(path[_0xd6a7('0x23')](_0x1b56a4,_0x468839),function(){});_0x3ac40c(_0xd6a7('0x29'));});});}})[_0xd6a7('0x13')](function(){logger[_0xd6a7('0xd')](util[_0xd6a7('0xe')](_0xd6a7('0x2a'),EXTRACTED_REPORT_ID,_0xd6a7('0x2b')));return analyticExtractedReport(_0xd6a7('0x2c'),_0x310de5?util[_0xd6a7('0xe')](_0xd6a7('0x28'),_0x468839,_0x310de5?_0xd6a7('0x2d'):_0xd6a7('0x27')):null);});})['catch'](function(_0x46916e){logger[_0xd6a7('0xd')](util[_0xd6a7('0xe')](_0xd6a7('0x2e'),EXTRACTED_REPORT_ID,'CSV'),util[_0xd6a7('0x2f')](_0x46916e,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xd6a7('0x30'));})[_0xd6a7('0x31')](function(){process[_0xd6a7('0x32')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x64e5=['join','mkdirSync','each','%s%d.%s','%s.%s','csv','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','catch','finally','exit','util','path','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','split','then','splitSizeCsv','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','num','Empty','length','range','isInteger','push','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','basename','.csv','existsSync'];(function(_0x62c958,_0x2bfdbc){var _0x57ec61=function(_0x5c0094){while(--_0x5c0094){_0x62c958['push'](_0x62c958['shift']());}};_0x57ec61(++_0x2bfdbc);}(_0x64e5,0x172));var _0x564e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x64e5[_0x2b10c6];return _0x3789d2;};'use strict';var util=require(_0x564e('0x0'));var path=require(_0x564e('0x1'));var _=require(_0x564e('0x2'));var csv=require(_0x564e('0x3'));var fs=require('fs');var BPromise=require(_0x564e('0x4'));var zipdir=require(_0x564e('0x5'));var rimraf=require(_0x564e('0x6'));var db=require(_0x564e('0x7'))['db'];var dbH=require('../../mysqldb')[_0x564e('0x8')];var logger=require(_0x564e('0x9'))(_0x564e('0xa'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x564e('0xb')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x44e835,_0x3dce6a){var _0x806c37={'status':_0x44e835};var _0x53fd05={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3dce6a){_0x806c37[_0x564e('0xc')]=_0x3dce6a;}return db[_0x564e('0xd')][_0x564e('0xe')](_0x806c37,_0x53fd05);}function main(){var _0x153088=0x1388;var _0xdeec64;logger[_0x564e('0xf')](util[_0x564e('0x10')](_0x564e('0x11'),EXTRACTED_REPORT_ID,_0x564e('0x12')));return db[_0x564e('0x13')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x564e('0x14'),'splitSizeCsv']})[_0x564e('0x15')](function(_0x56d394){if(_0x56d394){_0xdeec64=_0x56d394;_0x153088=_0xdeec64[_0x564e('0x16')]||0x1388;}})['then'](function(){return dbH[_0x564e('0x17')][_0x564e('0x18')](util[_0x564e('0x10')](_0x564e('0x19'),QUERY),{'type':dbH[_0x564e('0x17')][_0x564e('0x1a')]['SELECT']});})[_0x564e('0x15')](function(_0x17ae41){if(!_0x17ae41[0x0][_0x564e('0x1b')]){return analyticExtractedReport(_0x564e('0x1c'));}var _0x12b339=[];var _0x444ea7=0x0;if(_0xdeec64[_0x564e('0x14')]){if(_0x17ae41&&_0x17ae41[_0x564e('0x1d')]){var _0xa6cae1=_[_0x564e('0x1e')](_0x17ae41[0x0]['num']/_0x153088);var _0x3da6ff=Number[_0x564e('0x1f')](_0x17ae41[0x0][_0x564e('0x1b')]/_0x153088)?_0x17ae41[0x0]['num']%_0x153088:0x0;_0xa6cae1['forEach'](function(_0x3ff95f){if(_0x3ff95f>0x0){_0x444ea7+=_0x153088;}_0x12b339[_0x564e('0x20')](dbH[_0x564e('0x17')][_0x564e('0x18')](util['format'](_0x564e('0x21'),QUERY,_0x153088,_0x444ea7),{'type':dbH[_0x564e('0x17')]['QueryTypes'][_0x564e('0x22')]}));});if(_0x3da6ff>0x0){_0x444ea7+=_0x153088;_0x12b339['push'](dbH[_0x564e('0x17')][_0x564e('0x18')](util[_0x564e('0x10')](_0x564e('0x21'),QUERY,_0x3da6ff,_0x444ea7),{'type':dbH[_0x564e('0x17')][_0x564e('0x1a')][_0x564e('0x22')]}));}}}else{_0x12b339[_0x564e('0x20')](dbH[_0x564e('0x17')]['query'](QUERY,{'type':dbH['sequelize'][_0x564e('0x1a')][_0x564e('0x22')]}));}var _0x1c8435=path['dirname'](PATH);var _0x508b20=path[_0x564e('0x23')](PATH,_0x564e('0x24'));var _0x59f132=_0xdeec64[_0x564e('0x14')]&&_0x12b339[_0x564e('0x1d')]>0x1;var _0x278270=[];if(!fs[_0x564e('0x25')](path[_0x564e('0x26')](_0x1c8435,_0x508b20))&&_0x59f132){fs[_0x564e('0x27')](path[_0x564e('0x26')](_0x1c8435,_0x508b20));}return BPromise[_0x564e('0x28')](_0x12b339,function(_0x387d9b){_0x278270['push'](_0x387d9b);})[_0x564e('0x15')](function(){for(var _0x4df4d2=0x0;_0x4df4d2<_0x278270[_0x564e('0x1d')];_0x4df4d2+=0x1){var _0xeb1a0f;var _0xa720=_0x278270[_0x4df4d2];if(_0x59f132){_0xeb1a0f=path['join'](_0x1c8435,_0x508b20,util['format'](_0x564e('0x29'),_0x508b20,_0x4df4d2,'csv'));}else{_0xeb1a0f=path['join'](_0x1c8435,util[_0x564e('0x10')](_0x564e('0x2a'),_0x508b20,_0x564e('0x2b')));}fs[_0x564e('0x2c')](_0xeb1a0f,csv(_0xa720));}})[_0x564e('0x15')](function(){if(_0x59f132){return new Promise(function(_0x11eda9){zipdir(path[_0x564e('0x26')](_0x1c8435,_0x508b20),{'saveTo':path[_0x564e('0x26')](_0x1c8435,util[_0x564e('0x10')]('%s.%s',_0x508b20,_0x564e('0x2d')))},function(_0x4bb0eb,_0x52366e){rimraf(path['join'](_0x1c8435,_0x508b20),function(){});_0x11eda9(_0x564e('0x2e'));});});}})['then'](function(){logger[_0x564e('0xf')](util['format'](_0x564e('0x2f'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport('Completed',_0x59f132?util['format']('%s.%s',_0x508b20,_0x59f132?_0x564e('0x2d'):_0x564e('0x2b')):null);});})[_0x564e('0x30')](function(_0x2c3519){logger['info'](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'CSV'),util['inspect'](_0x2c3519,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x564e('0x31')](function(){process[_0x564e('0x32')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index d91121e..4073cf2 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 _0xb89f=['SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','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','footer','createWriteStream','finish','error','end','createPdfFromHTML','catch','util','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','JSDOM','window','bluebird','../../mysqldb','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','tableHeader','map','toString','value','fill','length','auto','body','concat','chunk','keys','forEach','push','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','endDate','header','margin','landscape','\x20/\x20','Arial','black','right','num','find','split','then','splitSizePdf','isInteger','query','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','QueryTypes','SELECT','dirname','basename','existsSync','join','mkdirSync','flatten','createPdfKitDocument','pdf','%s.%s','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne'];(function(_0x1d4b33,_0x206bca){var _0x5e6625=function(_0xd27ff0){while(--_0xd27ff0){_0x1d4b33['push'](_0x1d4b33['shift']());}};_0x5e6625(++_0x206bca);}(_0xb89f,0x6b));var _0xfb89=function(_0x394236,_0x5dfb42){_0x394236=_0x394236-0x0;var _0x2c6989=_0xb89f[_0x394236];return _0x2c6989;};'use strict';var _=require('lodash');var fs=require('fs');var util=require(_0xfb89('0x0'));var path=require('path');var moment=require(_0xfb89('0x1'));var htmlToPdfmake=require(_0xfb89('0x2'));var PdfPrinter=require(_0xfb89('0x3'));var zipdir=require(_0xfb89('0x4'));var rimraf=require('rimraf');var JSDOM=require('jsdom')[_0xfb89('0x5')];var window=new JSDOM('')[_0xfb89('0x6')];var BPromise=require(_0xfb89('0x7'));var db=require(_0xfb89('0x8'))['db'];var dbH=require(_0xfb89('0x8'))['dbH'];var logger=require('../../config/logger')(_0xfb89('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0xfb89('0xa')][0x2]);var QUERY=process[_0xfb89('0xa')][0x3];var PATH=process[_0xfb89('0xa')][0x4];var NAME=process[_0xfb89('0xa')][0x5];var FORMAT=_0xfb89('0xb');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x3e4e3c,_0x5174ee){var _0x8a0d0c={'status':_0x3e4e3c};var _0x3dd492={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5174ee){_0x8a0d0c[_0xfb89('0xc')]=_0x5174ee;}return db[_0xfb89('0xd')][_0xfb89('0xe')](_0x8a0d0c,_0x3dd492);}function getHeaders(_0x592153){return _['map'](_0x592153,function(_0x189021){return{'text':_0x189021,'style':_0xfb89('0xf')};});}function getRows(_0x5bb9e7,_0x2e52e4){return _[_0xfb89('0x10')](_0x2e52e4,function(_0xf7f11){return _(_0xf7f11)['pick'](_0x5bb9e7)[_0xfb89('0x10')](function(_0x32506b){return _0x32506b?_[_0xfb89('0x11')](_0x32506b):'';})[_0xfb89('0x12')]();});}function createTable(_0x3268f9,_0xa7927e){var _0xcb32e8={'widths':_[_0xfb89('0x13')](Array(_0x3268f9[_0xfb89('0x14')]),0x91),'heights':function(_0x235de7){return _0x235de7===0x0?_0xfb89('0x15'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x397adc=getHeaders(_0x3268f9);_0xcb32e8['body']['push'](_0x397adc);var _0x1ac7b7=getRows(_0x3268f9,_0xa7927e);_0xcb32e8['body']=_0xcb32e8[_0xfb89('0x16')][_0xfb89('0x17')](_0x1ac7b7);return _0xcb32e8;}function createTables(_0x25a303){var _0x5cf2cf=[];var _0x3edf20=_[_0xfb89('0x18')](Object[_0xfb89('0x19')](_0x25a303[0x0]),0x5);_0x3edf20[_0xfb89('0x1a')](function(_0x57e21c){_0x5cf2cf[_0xfb89('0x1b')](createTable(_0x57e21c,_0x25a303));});return _0x5cf2cf;}function getPDFDocDefinition(_0x40fedc){var _0x3e9a90=util[_0xfb89('0x1c')](_0xfb89('0x1d'),NAME,EXTRACTED_REPORT[_0xfb89('0x1e')],moment(EXTRACTED_REPORT['startDate'])['format'](FORMAT),moment(EXTRACTED_REPORT[_0xfb89('0x1f')])[_0xfb89('0x1c')](FORMAT));var _0x2f554c=[];for(var _0x3836fa=0x0;_0x3836fa<_0x40fedc[_0xfb89('0x14')];_0x3836fa++){var _0x103d83=[];if(_0x3836fa===0x0){_0x103d83[_0xfb89('0x1b')]({'text':_0x3e9a90,'style':_0xfb89('0x20')});}var _0x27e566={'table':_0x40fedc[_0x3836fa]};if(_0x3836fa>0x0){_0x27e566['pageBreak']='before';_0x27e566[_0xfb89('0x21')]=[0x0,0x46,0x0,0x0];}_0x103d83[_0xfb89('0x1b')](_0x27e566);_0x2f554c[_0xfb89('0x1b')](_0x103d83);}return{'pageSize':'A4','pageOrientation':_0xfb89('0x22'),'content':_0x2f554c,'footer':function(_0x177a32,_0x107b60){return{'text':_0x177a32[_0xfb89('0x11')]()+_0xfb89('0x23')+_0x107b60,'style':'footer'};},'defaultStyle':{'font':_0xfb89('0x24')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xfb89('0x25')},'footer':{'alignment':_0xfb89('0x26'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x51e2c5){var _0x44370f=0x1388;var _0x3606ab;if(!_0x51e2c5[0x0][_0xfb89('0x27')]){return analyticExtractedReport('Empty');}return db['Setting'][_0xfb89('0x28')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xfb89('0x29'),'splitSizePdf']})[_0xfb89('0x2a')](function(_0x31e693){if(_0x31e693){_0x3606ab=_0x31e693;_0x44370f=_0x3606ab[_0xfb89('0x2b')]||0x3e8;}})[_0xfb89('0x2a')](function(){var _0x17f1a3=[];var _0x40a0fd=0x0;if(_0x3606ab[_0xfb89('0x29')]){if(_0x51e2c5&&_0x51e2c5[_0xfb89('0x14')]){var _0x3ad74b=_['range'](_0x51e2c5[0x0][_0xfb89('0x27')]/_0x44370f);var _0x4e2bcb=Number[_0xfb89('0x2c')](_0x51e2c5[0x0][_0xfb89('0x27')]/_0x44370f)?_0x51e2c5[0x0][_0xfb89('0x27')]%_0x44370f:0x0;_0x3ad74b[_0xfb89('0x1a')](function(_0x420c7e){if(_0x420c7e>0x0){_0x40a0fd+=_0x44370f;}_0x17f1a3[_0xfb89('0x1b')](dbH['sequelize'][_0xfb89('0x2d')](util[_0xfb89('0x1c')](_0xfb89('0x2e'),QUERY,_0x44370f,_0x40a0fd),{'type':dbH[_0xfb89('0x2f')][_0xfb89('0x30')]['SELECT']}));});if(_0x4e2bcb>0x0){_0x40a0fd+=_0x44370f;_0x17f1a3['push'](dbH[_0xfb89('0x2f')][_0xfb89('0x2d')](util[_0xfb89('0x1c')](_0xfb89('0x2e'),QUERY,_0x4e2bcb,_0x40a0fd),{'type':dbH[_0xfb89('0x2f')]['QueryTypes'][_0xfb89('0x31')]}));}}}else{_0x17f1a3[_0xfb89('0x1b')](dbH[_0xfb89('0x2f')][_0xfb89('0x2d')](QUERY,{'type':dbH[_0xfb89('0x2f')][_0xfb89('0x30')][_0xfb89('0x31')]}));}var _0x4d0f21=path[_0xfb89('0x32')](PATH);var _0x4128e9=path[_0xfb89('0x33')](PATH,'.pdf');var _0x4a0fed=_0x3606ab[_0xfb89('0x29')]&&_0x17f1a3[_0xfb89('0x14')]>0x1;var _0xd5e0fc=[];if(!fs[_0xfb89('0x34')](path[_0xfb89('0x35')](_0x4d0f21,_0x4128e9))&&_0x4a0fed){fs[_0xfb89('0x36')](path[_0xfb89('0x35')](_0x4d0f21,_0x4128e9));}return BPromise['each'](_0x17f1a3,function(_0x553372){_0xd5e0fc[_0xfb89('0x1b')](_0x553372);})[_0xfb89('0x2a')](function(){var _0x8c9eec=[];for(var _0x5eed45=0x0;_0x5eed45<_0xd5e0fc[_0xfb89('0x14')];_0x5eed45+=0x1){var _0x3fa943=_0xd5e0fc[_0x5eed45];var _0x3810bb=createTables(_[_0xfb89('0x37')](_0x3fa943));var _0x1a4bc8;var _0x35c40e=getPDFDocDefinition(_0x3810bb);var _0x4c6a03=getPDFPrinter();var _0x122c54=_0x4c6a03[_0xfb89('0x38')](_0x35c40e);if(_0x4a0fed){_0x1a4bc8=path[_0xfb89('0x35')](_0x4d0f21,_0x4128e9,util['format']('%s%d.%s',_0x4128e9,_0x5eed45,_0xfb89('0x39')));}else{_0x1a4bc8=path[_0xfb89('0x35')](_0x4d0f21,util[_0xfb89('0x1c')](_0xfb89('0x3a'),_0x4128e9,'pdf'));}_0x8c9eec[_0xfb89('0x1b')](writePDFDocument(_0x122c54,_0x1a4bc8));}return Promise['all'](_0x8c9eec);})[_0xfb89('0x2a')](function(){if(_0x4a0fed){return new Promise(function(_0x3730ef){zipdir(path['join'](_0x4d0f21,_0x4128e9),{'saveTo':path['join'](_0x4d0f21,util['format'](_0xfb89('0x3a'),_0x4128e9,_0xfb89('0x3b')))},function(){rimraf(path[_0xfb89('0x35')](_0x4d0f21,_0x4128e9),function(){});_0x3730ef(_0xfb89('0x3c'));});});}})[_0xfb89('0x2a')](function(){if(!_0x4a0fed)return;rimraf(path[_0xfb89('0x35')](_0x4d0f21,_0x4128e9),function(){});})[_0xfb89('0x2a')](function(){logger['info'](util[_0xfb89('0x1c')](_0xfb89('0x3d'),EXTRACTED_REPORT_ID,_0xfb89('0x3e')));return analyticExtractedReport(_0xfb89('0x3f'),_0x4a0fed?util['format'](_0xfb89('0x3a'),_0x4128e9,_0x4a0fed?'zip':_0xfb89('0x39')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xfb89('0x40')](util[_0xfb89('0x1c')](_0xfb89('0x41'),EXTRACTED_REPORT_ID,_0xfb89('0x3e')));return db[_0xfb89('0xd')][_0xfb89('0x42')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xfb89('0x2a')](function(_0x27e3c4){EXTRACTED_REPORT=_0x27e3c4;return dbH[_0xfb89('0x2f')][_0xfb89('0x2d')](util[_0xfb89('0x1c')](_0xfb89('0x43'),QUERY),{'type':dbH[_0xfb89('0x2f')]['QueryTypes'][_0xfb89('0x31')]});})['then'](extractReport)['catch'](function(_0x300329){logger[_0xfb89('0x40')](util[_0xfb89('0x1c')](_0xfb89('0x44'),EXTRACTED_REPORT_ID,'PDF'),util['inspect'](_0x300329,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xfb89('0x45')](function(){process[_0xfb89('0x46')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x5250a0=new PdfPrinter({'Arial':{'normal':__dirname+_0xfb89('0x47'),'bold':__dirname+_0xfb89('0x48'),'italics':__dirname+_0xfb89('0x49'),'bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x5250a0;}function getPDFDocDefinitionFromHTML(_0x42177e,_0x43e7b3){var _0x3c228f=util[_0xfb89('0x1c')](_0xfb89('0x4a'),_0x43e7b3[_0xfb89('0x4b')],_0x43e7b3[_0xfb89('0x4c')]);var _0x3a1923=moment()[_0xfb89('0x1c')](_0xfb89('0x4d'))[_0xfb89('0x11')]();var _0x268e6a=htmlToPdfmake(_0x42177e,{'window':window,'tableAutoSize':!![]});return{'content':[_0x268e6a],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xfb89('0x4e'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xfb89('0x4e'),'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':_0xfb89('0x20')}];},'footer':function(_0x3adc1c,_0x56d619){return[{'text':util['format'](_0xfb89('0x4f'),_0x3c228f,_0x3adc1c,_0x56d619,_0x3a1923),'style':_0xfb89('0x50')}];}};}function writePDFDocument(_0x1f6a10,_0x326bf5){return new Promise(function(_0x3564ef,_0x1434fe){var _0x579ca8=_0x1f6a10['pipe'](fs[_0xfb89('0x51')](_0x326bf5));_0x579ca8['on'](_0xfb89('0x52'),function(){_0x3564ef(_0xfb89('0x52'));});_0x579ca8['on'](_0xfb89('0x53'),function(_0x270a96){_0x1434fe(_0x270a96);});_0x1f6a10[_0xfb89('0x54')]();});}exports[_0xfb89('0x55')]=function(_0x5daa19,_0x2ecec0){var _0x3940a5=getPDFPrinter();var _0x19e5ca=getPDFDocDefinitionFromHTML(_0x5daa19,_0x2ecec0);var _0x5d3151=_0x3940a5[_0xfb89('0x38')](_0x19e5ca);return writePDFDocument(_0x5d3151,_0x2ecec0['path'])[_0xfb89('0x56')](function(_0x6d579c){throw _0x6d579c;});}; \ No newline at end of file +var _0x49d6=['bluebird','../../mysqldb','dbH','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','map','tableHeader','pick','toString','value','body','concat','chunk','keys','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','header','pageBreak','margin','push','landscape','\x20/\x20','footer','Arial','num','Empty','Setting','split','then','length','forEach','sequelize','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','query','dirname','basename','existsSync','mkdirSync','flatten','createPdfKitDocument','join','%s%d.%s','pdf','%s.%s','all','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','AnalyticExtractedReport','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','inspect','Failed','exit','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','YYYY-MM-DD','center','Interaction\x20Transcript','pipe','finish','error','end','lodash','util','path','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','window'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x49d6,0x14e));var _0x649d=function(_0x1744e2,_0x31ab5c){_0x1744e2=_0x1744e2-0x0;var _0x1c68c0=_0x49d6[_0x1744e2];return _0x1c68c0;};'use strict';var _=require(_0x649d('0x0'));var fs=require('fs');var util=require(_0x649d('0x1'));var path=require(_0x649d('0x2'));var moment=require('moment');var htmlToPdfmake=require(_0x649d('0x3'));var PdfPrinter=require(_0x649d('0x4'));var zipdir=require(_0x649d('0x5'));var rimraf=require(_0x649d('0x6'));var JSDOM=require(_0x649d('0x7'))[_0x649d('0x8')];var window=new JSDOM('')[_0x649d('0x9')];var BPromise=require(_0x649d('0xa'));var db=require('../../mysqldb')['db'];var dbH=require(_0x649d('0xb'))[_0x649d('0xc')];var logger=require('../../config/logger')(_0x649d('0xd'));var EXTRACTED_REPORT_ID=Number(process[_0x649d('0xe')][0x2]);var QUERY=process[_0x649d('0xe')][0x3];var PATH=process[_0x649d('0xe')][0x4];var NAME=process[_0x649d('0xe')][0x5];var FORMAT=_0x649d('0xf');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x4e3122,_0x2c2a7d){var _0x188c85={'status':_0x4e3122};var _0x3ef83e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2c2a7d){_0x188c85[_0x649d('0x10')]=_0x2c2a7d;}return db['AnalyticExtractedReport']['update'](_0x188c85,_0x3ef83e);}function getHeaders(_0x161aed){return _[_0x649d('0x11')](_0x161aed,function(_0x5e25a9){return{'text':_0x5e25a9,'style':_0x649d('0x12')};});}function getRows(_0x12e225,_0x40c6f5){return _['map'](_0x40c6f5,function(_0x2059eb){return _(_0x2059eb)[_0x649d('0x13')](_0x12e225)[_0x649d('0x11')](function(_0x170fc6){return _0x170fc6?_[_0x649d('0x14')](_0x170fc6):'';})[_0x649d('0x15')]();});}function createTable(_0x5cae43,_0x4fcecf){var _0x18ae46={'widths':_['fill'](Array(_0x5cae43['length']),0x91),'heights':function(_0x509191){return _0x509191===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x385692=getHeaders(_0x5cae43);_0x18ae46[_0x649d('0x16')]['push'](_0x385692);var _0x3f0d25=getRows(_0x5cae43,_0x4fcecf);_0x18ae46['body']=_0x18ae46['body'][_0x649d('0x17')](_0x3f0d25);return _0x18ae46;}function createTables(_0x1e6180){var _0x169ff0=[];var _0x57bb35=_[_0x649d('0x18')](Object[_0x649d('0x19')](_0x1e6180[0x0]),0x5);_0x57bb35['forEach'](function(_0x3765d2){_0x169ff0['push'](createTable(_0x3765d2,_0x1e6180));});return _0x169ff0;}function getPDFDocDefinition(_0x5889bd){var _0x27a13e=util[_0x649d('0x1a')](_0x649d('0x1b'),NAME,EXTRACTED_REPORT[_0x649d('0x1c')],moment(EXTRACTED_REPORT[_0x649d('0x1d')])[_0x649d('0x1a')](FORMAT),moment(EXTRACTED_REPORT[_0x649d('0x1e')])[_0x649d('0x1a')](FORMAT));var _0x516e6f=[];for(var _0x505abf=0x0;_0x505abf<_0x5889bd['length'];_0x505abf++){var _0x310c61=[];if(_0x505abf===0x0){_0x310c61['push']({'text':_0x27a13e,'style':_0x649d('0x1f')});}var _0x1a861e={'table':_0x5889bd[_0x505abf]};if(_0x505abf>0x0){_0x1a861e[_0x649d('0x20')]='before';_0x1a861e[_0x649d('0x21')]=[0x0,0x46,0x0,0x0];}_0x310c61[_0x649d('0x22')](_0x1a861e);_0x516e6f[_0x649d('0x22')](_0x310c61);}return{'pageSize':'A4','pageOrientation':_0x649d('0x23'),'content':_0x516e6f,'footer':function(_0x1f983d,_0x4248e2){return{'text':_0x1f983d[_0x649d('0x14')]()+_0x649d('0x24')+_0x4248e2,'style':_0x649d('0x25')};},'defaultStyle':{'font':_0x649d('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x53f862){var _0x444000=0x1388;var _0x24dcb5;if(!_0x53f862[0x0][_0x649d('0x27')]){return analyticExtractedReport(_0x649d('0x28'));}return db[_0x649d('0x29')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x649d('0x2a'),'splitSizePdf']})['then'](function(_0x1a459b){if(_0x1a459b){_0x24dcb5=_0x1a459b;_0x444000=_0x24dcb5['splitSizePdf']||0x3e8;}})[_0x649d('0x2b')](function(){var _0xacdc32=[];var _0x4e3675=0x0;if(_0x24dcb5[_0x649d('0x2a')]){if(_0x53f862&&_0x53f862[_0x649d('0x2c')]){var _0x11d06b=_['range'](_0x53f862[0x0][_0x649d('0x27')]/_0x444000);var _0x48e223=Number['isInteger'](_0x53f862[0x0]['num']/_0x444000)?_0x53f862[0x0][_0x649d('0x27')]%_0x444000:0x0;_0x11d06b[_0x649d('0x2d')](function(_0x25b5c4){if(_0x25b5c4>0x0){_0x4e3675+=_0x444000;}_0xacdc32[_0x649d('0x22')](dbH[_0x649d('0x2e')]['query'](util[_0x649d('0x1a')](_0x649d('0x2f'),QUERY,_0x444000,_0x4e3675),{'type':dbH[_0x649d('0x2e')][_0x649d('0x30')][_0x649d('0x31')]}));});if(_0x48e223>0x0){_0x4e3675+=_0x444000;_0xacdc32['push'](dbH[_0x649d('0x2e')][_0x649d('0x32')](util[_0x649d('0x1a')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x48e223,_0x4e3675),{'type':dbH[_0x649d('0x2e')][_0x649d('0x30')][_0x649d('0x31')]}));}}}else{_0xacdc32[_0x649d('0x22')](dbH[_0x649d('0x2e')][_0x649d('0x32')](QUERY,{'type':dbH[_0x649d('0x2e')][_0x649d('0x30')][_0x649d('0x31')]}));}var _0x27e687=path[_0x649d('0x33')](PATH);var _0x193aaa=path[_0x649d('0x34')](PATH,'.pdf');var _0x5b56c9=_0x24dcb5[_0x649d('0x2a')]&&_0xacdc32[_0x649d('0x2c')]>0x1;var _0x1e5f7e=[];if(!fs[_0x649d('0x35')](path['join'](_0x27e687,_0x193aaa))&&_0x5b56c9){fs[_0x649d('0x36')](path['join'](_0x27e687,_0x193aaa));}return BPromise['each'](_0xacdc32,function(_0x3e555f){_0x1e5f7e['push'](_0x3e555f);})['then'](function(){var _0x3ba966=[];for(var _0x40c2b7=0x0;_0x40c2b7<_0x1e5f7e[_0x649d('0x2c')];_0x40c2b7+=0x1){var _0x9515d1=_0x1e5f7e[_0x40c2b7];var _0x31d282=createTables(_[_0x649d('0x37')](_0x9515d1));var _0x4161c2;var _0x4007e8=getPDFDocDefinition(_0x31d282);var _0x5142e4=getPDFPrinter();var _0x437f4d=_0x5142e4[_0x649d('0x38')](_0x4007e8);if(_0x5b56c9){_0x4161c2=path[_0x649d('0x39')](_0x27e687,_0x193aaa,util[_0x649d('0x1a')](_0x649d('0x3a'),_0x193aaa,_0x40c2b7,_0x649d('0x3b')));}else{_0x4161c2=path[_0x649d('0x39')](_0x27e687,util[_0x649d('0x1a')](_0x649d('0x3c'),_0x193aaa,_0x649d('0x3b')));}_0x3ba966[_0x649d('0x22')](writePDFDocument(_0x437f4d,_0x4161c2));}return Promise[_0x649d('0x3d')](_0x3ba966);})[_0x649d('0x2b')](function(){if(_0x5b56c9){return new Promise(function(_0x591d8f){zipdir(path[_0x649d('0x39')](_0x27e687,_0x193aaa),{'saveTo':path[_0x649d('0x39')](_0x27e687,util[_0x649d('0x1a')](_0x649d('0x3c'),_0x193aaa,_0x649d('0x3e')))},function(){rimraf(path[_0x649d('0x39')](_0x27e687,_0x193aaa),function(){});_0x591d8f(_0x649d('0x3f'));});});}})['then'](function(){if(!_0x5b56c9)return;rimraf(path[_0x649d('0x39')](_0x27e687,_0x193aaa),function(){});})[_0x649d('0x2b')](function(){logger[_0x649d('0x40')](util[_0x649d('0x1a')](_0x649d('0x41'),EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport(_0x649d('0x42'),_0x5b56c9?util[_0x649d('0x1a')](_0x649d('0x3c'),_0x193aaa,_0x5b56c9?_0x649d('0x3e'):_0x649d('0x3b')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x649d('0x40')](util[_0x649d('0x1a')](_0x649d('0x43'),EXTRACTED_REPORT_ID,_0x649d('0x44')));return db[_0x649d('0x45')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x11789e){EXTRACTED_REPORT=_0x11789e;return dbH[_0x649d('0x2e')]['query'](util[_0x649d('0x1a')](_0x649d('0x46'),QUERY),{'type':dbH[_0x649d('0x2e')][_0x649d('0x30')][_0x649d('0x31')]});})[_0x649d('0x2b')](extractReport)[_0x649d('0x47')](function(_0xed21de){logger[_0x649d('0x40')](util[_0x649d('0x1a')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x649d('0x44')),util[_0x649d('0x48')](_0xed21de,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x649d('0x49'));})['finally'](function(){process[_0x649d('0x4a')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x139616=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0x649d('0x4b'),'italics':__dirname+_0x649d('0x4c'),'bolditalics':__dirname+_0x649d('0x4d')}});return _0x139616;}function getPDFDocDefinitionFromHTML(_0xb608d8,_0x171a0b){var _0x20abcb=util[_0x649d('0x1a')](_0x649d('0x4e'),_0x171a0b['channel'],_0x171a0b['interactionId']);var _0x13cae9=moment()[_0x649d('0x1a')](_0x649d('0x4f'))[_0x649d('0x14')]();var _0x1e68f2=htmlToPdfmake(_0xb608d8,{'window':window,'tableAutoSize':!![]});return{'content':[_0x1e68f2],'defaultStyle':{'font':_0x649d('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x649d('0x50'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x649d('0x50'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':_0x649d('0x51'),'style':_0x649d('0x1f')}];},'footer':function(_0x2f57c7,_0x1efc3e){return[{'text':util[_0x649d('0x1a')]('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x20abcb,_0x2f57c7,_0x1efc3e,_0x13cae9),'style':_0x649d('0x25')}];}};}function writePDFDocument(_0x219f07,_0x3fc3aa){return new Promise(function(_0x406095,_0xfe6034){var _0x12c2b5=_0x219f07[_0x649d('0x52')](fs['createWriteStream'](_0x3fc3aa));_0x12c2b5['on']('finish',function(){_0x406095(_0x649d('0x53'));});_0x12c2b5['on'](_0x649d('0x54'),function(_0x1401a6){_0xfe6034(_0x1401a6);});_0x219f07[_0x649d('0x55')]();});}exports['createPdfFromHTML']=function(_0x5b6841,_0x3ce185){var _0x738501=getPDFPrinter();var _0x41ad7a=getPDFDocDefinitionFromHTML(_0x5b6841,_0x3ce185);var _0x3cb558=_0x738501[_0x649d('0x38')](_0x41ad7a);return writePDFDocument(_0x3cb558,_0x3ce185[_0x649d('0x2')])[_0x649d('0x47')](function(_0x46f00c){throw _0x46f00c;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 292c5fe..69f01c0 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 _0x953d=['zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX','Completed','%s.%s','inspect','Failed','finally','exit','path','lodash','json2xls','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','split','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','range','isInteger','forEach','push','basename','.xlsx','length','existsSync','join','mkdirSync','xlsx'];(function(_0x215b36,_0x1c1dba){var _0xefc45e=function(_0x3c4faf){while(--_0x3c4faf){_0x215b36['push'](_0x215b36['shift']());}};_0xefc45e(++_0x1c1dba);}(_0x953d,0x93));var _0xd953=function(_0x9c0817,_0x50058d){_0x9c0817=_0x9c0817-0x0;var _0x396086=_0x953d[_0x9c0817];return _0x396086;};'use strict';var util=require('util');var path=require(_0xd953('0x0'));var _=require(_0xd953('0x1'));var fs=require('fs');var json2xls=require(_0xd953('0x2'));var BPromise=require('bluebird');var zipdir=require(_0xd953('0x3'));var rimraf=require(_0xd953('0x4'));var db=require(_0xd953('0x5'))['db'];var dbH=require(_0xd953('0x5'))[_0xd953('0x6')];var logger=require(_0xd953('0x7'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xd953('0x8')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xd953('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x5d3207,_0x4fe408){var _0x4a77b6={'status':_0x5d3207};var _0x4a4116={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4fe408){_0x4a77b6[_0xd953('0x9')]=_0x4fe408;}return db['AnalyticExtractedReport'][_0xd953('0xa')](_0x4a77b6,_0x4a4116);}function main(){var _0x353826=0x1388;var _0x4747c2;logger[_0xd953('0xb')](util[_0xd953('0xc')](_0xd953('0xd'),EXTRACTED_REPORT_ID,'XLSX'));return db[_0xd953('0xe')][_0xd953('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xd953('0x10'),_0xd953('0x11')]})[_0xd953('0x12')](function(_0xec346d){if(_0xec346d){_0x4747c2=_0xec346d;_0x353826=_0x4747c2[_0xd953('0x11')]||0x1388;}})[_0xd953('0x12')](function(){return dbH[_0xd953('0x13')][_0xd953('0x14')](util['format'](_0xd953('0x15'),QUERY),{'type':dbH['sequelize'][_0xd953('0x16')][_0xd953('0x17')]});})['then'](function(_0x350386){if(!_0x350386[0x0][_0xd953('0x18')]){return analyticExtractedReport(_0xd953('0x19'));}var _0x2e268f=[];var _0x8dcf90=0x0;if(_0x4747c2['split']){if(_0x350386&&_0x350386['length']){var _0x131ccd=_[_0xd953('0x1a')](_0x350386[0x0][_0xd953('0x18')]/_0x353826);var _0x2e6e21=Number[_0xd953('0x1b')](_0x350386[0x0]['num']/_0x353826)?_0x350386[0x0]['num']%_0x353826:0x0;_0x131ccd[_0xd953('0x1c')](function(_0x3beeea){if(_0x3beeea>0x0){_0x8dcf90+=_0x353826;}_0x2e268f['push'](dbH[_0xd953('0x13')][_0xd953('0x14')](util[_0xd953('0xc')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x353826,_0x8dcf90),{'type':dbH[_0xd953('0x13')]['QueryTypes'][_0xd953('0x17')]}));});if(_0x2e6e21>0x0){_0x8dcf90+=_0x353826;_0x2e268f[_0xd953('0x1d')](dbH[_0xd953('0x13')]['query'](util[_0xd953('0xc')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x2e6e21,_0x8dcf90),{'type':dbH[_0xd953('0x13')]['QueryTypes'][_0xd953('0x17')]}));}}}else{_0x2e268f[_0xd953('0x1d')](dbH['sequelize'][_0xd953('0x14')](QUERY,{'type':dbH[_0xd953('0x13')]['QueryTypes'][_0xd953('0x17')]}));}var _0x5a9411=path['dirname'](PATH);var _0x982bde=path[_0xd953('0x1e')](PATH,_0xd953('0x1f'));var _0x335233=_0x4747c2[_0xd953('0x10')]&&_0x2e268f[_0xd953('0x20')]>0x1;var _0x3218c0=[];if(!fs[_0xd953('0x21')](path[_0xd953('0x22')](_0x5a9411,_0x982bde))&&_0x335233){fs[_0xd953('0x23')](path[_0xd953('0x22')](_0x5a9411,_0x982bde));}return BPromise['each'](_0x2e268f,function(_0x25a18b){_0x3218c0[_0xd953('0x1d')](_0x25a18b);})[_0xd953('0x12')](function(){for(var _0x37c8aa=0x0;_0x37c8aa<_0x3218c0[_0xd953('0x20')];_0x37c8aa+=0x1){var _0x237941;var _0x248643=_0x3218c0[_0x37c8aa];if(_0x335233){_0x237941=path[_0xd953('0x22')](_0x5a9411,_0x982bde,util[_0xd953('0xc')]('%s%d.%s',_0x982bde,_0x37c8aa,_0xd953('0x24')));}else{_0x237941=path['join'](_0x5a9411,util[_0xd953('0xc')]('%s.%s',_0x982bde,_0xd953('0x24')));}fs['writeFileSync'](_0x237941,json2xls(_0x248643),'binary');}})[_0xd953('0x12')](function(){if(_0x335233){return new Promise(function(_0x5eeed3){zipdir(path[_0xd953('0x22')](_0x5a9411,_0x982bde),{'saveTo':path[_0xd953('0x22')](_0x5a9411,util[_0xd953('0xc')]('%s.%s',_0x982bde,_0xd953('0x25')))},function(_0x44aae4,_0x25537f){rimraf(path[_0xd953('0x22')](_0x5a9411,_0x982bde),function(){});_0x5eeed3('zip\x20finished');});});}})[_0xd953('0x12')](function(){logger[_0xd953('0xb')](util[_0xd953('0xc')](_0xd953('0x26'),EXTRACTED_REPORT_ID,_0xd953('0x27')));return analyticExtractedReport(_0xd953('0x28'),_0x335233?util[_0xd953('0xc')](_0xd953('0x29'),_0x982bde,_0x335233?_0xd953('0x25'):'xlsx'):null);});})['catch'](function(_0x4d6115){logger[_0xd953('0xb')](util[_0xd953('0xc')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'XLSX'),util[_0xd953('0x2a')](_0x4d6115,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xd953('0x2b'));})[_0xd953('0x2c')](function(){process[_0xd953('0x2d')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xdb90=['json2xls','bluebird','zip-dir','../../mysqldb','../../config/logger','analytics','argv','savename','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','range','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','existsSync','mkdirSync','each','then','join','%s.%s','xlsx','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','inspect','Failed','finally','util','path'];(function(_0x433b0,_0x29a601){var _0x4bbc96=function(_0x19615e){while(--_0x19615e){_0x433b0['push'](_0x433b0['shift']());}};_0x4bbc96(++_0x29a601);}(_0xdb90,0xf8));var _0x0db9=function(_0x3c8c80,_0x4d47cc){_0x3c8c80=_0x3c8c80-0x0;var _0x479a99=_0xdb90[_0x3c8c80];return _0x479a99;};'use strict';var util=require(_0x0db9('0x0'));var path=require(_0x0db9('0x1'));var _=require('lodash');var fs=require('fs');var json2xls=require(_0x0db9('0x2'));var BPromise=require(_0x0db9('0x3'));var zipdir=require(_0x0db9('0x4'));var rimraf=require('rimraf');var db=require('../../mysqldb')['db'];var dbH=require(_0x0db9('0x5'))['dbH'];var logger=require(_0x0db9('0x6'))(_0x0db9('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x0db9('0x8')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x0db9('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x3ed6f3,_0x429d6b){var _0x1386ed={'status':_0x3ed6f3};var _0x4f973d={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x429d6b){_0x1386ed[_0x0db9('0x9')]=_0x429d6b;}return db['AnalyticExtractedReport'][_0x0db9('0xa')](_0x1386ed,_0x4f973d);}function main(){var _0x5a1901=0x1388;var _0x3a7e35;logger[_0x0db9('0xb')](util[_0x0db9('0xc')](_0x0db9('0xd'),EXTRACTED_REPORT_ID,_0x0db9('0xe')));return db[_0x0db9('0xf')][_0x0db9('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x0db9('0x11'),'splitSizeXlsx']})['then'](function(_0x1ae3a3){if(_0x1ae3a3){_0x3a7e35=_0x1ae3a3;_0x5a1901=_0x3a7e35[_0x0db9('0x12')]||0x1388;}})['then'](function(){return dbH[_0x0db9('0x13')][_0x0db9('0x14')](util[_0x0db9('0xc')](_0x0db9('0x15'),QUERY),{'type':dbH[_0x0db9('0x13')][_0x0db9('0x16')][_0x0db9('0x17')]});})['then'](function(_0x3ca00f){if(!_0x3ca00f[0x0][_0x0db9('0x18')]){return analyticExtractedReport(_0x0db9('0x19'));}var _0x193b09=[];var _0x5beddc=0x0;if(_0x3a7e35['split']){if(_0x3ca00f&&_0x3ca00f[_0x0db9('0x1a')]){var _0x2f946d=_[_0x0db9('0x1b')](_0x3ca00f[0x0][_0x0db9('0x18')]/_0x5a1901);var _0x3b2e75=Number['isInteger'](_0x3ca00f[0x0]['num']/_0x5a1901)?_0x3ca00f[0x0]['num']%_0x5a1901:0x0;_0x2f946d[_0x0db9('0x1c')](function(_0x47eb85){if(_0x47eb85>0x0){_0x5beddc+=_0x5a1901;}_0x193b09[_0x0db9('0x1d')](dbH[_0x0db9('0x13')][_0x0db9('0x14')](util[_0x0db9('0xc')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x5a1901,_0x5beddc),{'type':dbH[_0x0db9('0x13')][_0x0db9('0x16')][_0x0db9('0x17')]}));});if(_0x3b2e75>0x0){_0x5beddc+=_0x5a1901;_0x193b09[_0x0db9('0x1d')](dbH[_0x0db9('0x13')][_0x0db9('0x14')](util[_0x0db9('0xc')](_0x0db9('0x1e'),QUERY,_0x3b2e75,_0x5beddc),{'type':dbH[_0x0db9('0x13')][_0x0db9('0x16')][_0x0db9('0x17')]}));}}}else{_0x193b09[_0x0db9('0x1d')](dbH[_0x0db9('0x13')]['query'](QUERY,{'type':dbH[_0x0db9('0x13')][_0x0db9('0x16')][_0x0db9('0x17')]}));}var _0x63680e=path[_0x0db9('0x1f')](PATH);var _0x2ad3e8=path[_0x0db9('0x20')](PATH,_0x0db9('0x21'));var _0x33c220=_0x3a7e35[_0x0db9('0x11')]&&_0x193b09['length']>0x1;var _0x216dd1=[];if(!fs[_0x0db9('0x22')](path['join'](_0x63680e,_0x2ad3e8))&&_0x33c220){fs[_0x0db9('0x23')](path['join'](_0x63680e,_0x2ad3e8));}return BPromise[_0x0db9('0x24')](_0x193b09,function(_0x2e3062){_0x216dd1[_0x0db9('0x1d')](_0x2e3062);})[_0x0db9('0x25')](function(){for(var _0x47b783=0x0;_0x47b783<_0x216dd1[_0x0db9('0x1a')];_0x47b783+=0x1){var _0xea5d3f;var _0x44b2dc=_0x216dd1[_0x47b783];if(_0x33c220){_0xea5d3f=path[_0x0db9('0x26')](_0x63680e,_0x2ad3e8,util[_0x0db9('0xc')]('%s%d.%s',_0x2ad3e8,_0x47b783,'xlsx'));}else{_0xea5d3f=path[_0x0db9('0x26')](_0x63680e,util[_0x0db9('0xc')](_0x0db9('0x27'),_0x2ad3e8,_0x0db9('0x28')));}fs[_0x0db9('0x29')](_0xea5d3f,json2xls(_0x44b2dc),'binary');}})[_0x0db9('0x25')](function(){if(_0x33c220){return new Promise(function(_0x15f78c){zipdir(path['join'](_0x63680e,_0x2ad3e8),{'saveTo':path[_0x0db9('0x26')](_0x63680e,util['format'](_0x0db9('0x27'),_0x2ad3e8,_0x0db9('0x2a')))},function(_0x5a7187,_0x1eef63){rimraf(path[_0x0db9('0x26')](_0x63680e,_0x2ad3e8),function(){});_0x15f78c(_0x0db9('0x2b'));});});}})['then'](function(){logger[_0x0db9('0xb')](util[_0x0db9('0xc')](_0x0db9('0x2c'),EXTRACTED_REPORT_ID,_0x0db9('0xe')));return analyticExtractedReport(_0x0db9('0x2d'),_0x33c220?util[_0x0db9('0xc')](_0x0db9('0x27'),_0x2ad3e8,_0x33c220?_0x0db9('0x2a'):_0x0db9('0x28')):null);});})[_0x0db9('0x2e')](function(_0x58eefe){logger['info'](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x0db9('0xe')),util[_0x0db9('0x2f')](_0x58eefe,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x0db9('0x30'));})[_0x0db9('0x31')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index d44ca0d..7fa5f2b 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 _0xafe9=['exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','hasOwnProperty','extensions','extension','find','type','Set','context','priority','VoiceExtensionId','inbound','push','CDR(routeid)=','outbound','CDR(destination)=','cutdigits','${EXTEN:','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','destroy','bulkCreate','sortBy','catch','rewrite','lodash','util','models','Interval','findAll','then','intervals','VoiceExtension','IntervalId','uniq'];(function(_0x2ccddc,_0x40c85c){var _0x3d508c=function(_0x34cf02){while(--_0x34cf02){_0x2ccddc['push'](_0x2ccddc['shift']());}};_0x3d508c(++_0x40c85c);}(_0xafe9,0x112));var _0x9afe=function(_0xbbadb8,_0x6301aa){_0xbbadb8=_0xbbadb8-0x0;var _0x47f4a2=_0xafe9[_0xbbadb8];return _0x47f4a2;};'use strict';var _=require(_0x9afe('0x0'));var util=require(_0x9afe('0x1'));function rewrite(_0x5f5ba2,_0x72d327){var _0x482d5a=this;return _0x5f5ba2[_0x9afe('0x2')][_0x9afe('0x3')][_0x9afe('0x4')]({'raw':!![]})[_0x9afe('0x5')](function(_0x547cb1){_0x482d5a[_0x9afe('0x6')]=_0x547cb1;return _0x5f5ba2[_0x9afe('0x2')][_0x9afe('0x7')][_0x9afe('0x4')]({'where':{'IntervalId':_0x72d327[_0x9afe('0x8')]},'raw':!![]});})['then'](function(_0x35e99f){return _0x5f5ba2['models'][_0x9afe('0x7')][_0x9afe('0x4')]({'where':{'exten':{'$in':_[_0x9afe('0x9')](_['map'](_0x35e99f,_0x9afe('0xa')))}},'order':[{'raw':_0x9afe('0xb')}],'raw':!![]});})[_0x9afe('0x5')](function(_0x314dba){var _0x3dc928=_[_0x9afe('0xc')](_0x314dba,{'priority':'1'});var _0x2404ac=_[_0x9afe('0xc')](_0x314dba,{'isApp':0x1});var _0x3c9832=_[_0x9afe('0xd')](_0x2404ac,_0x9afe('0xa'));var _0x1ac8ac=['queue','playback'];var _0x4792a8=[];var _0x4ff3ac=[];for(var _0x33567f in _0x3c9832){if(_0x3c9832[_0x9afe('0xe')](_0x33567f)){_0x482d5a['priority']=0x2;_0x482d5a[_0x9afe('0xf')]=[];_0x482d5a[_0x9afe('0x10')]=_[_0x9afe('0x11')](_0x3dc928,{'exten':_0x3c9832[_0x33567f][0x0][_0x9afe('0xa')]});_0x482d5a[_0x9afe('0xf')]['push']({'type':_0x3c9832[_0x33567f][0x0][_0x9afe('0x12')],'app':_0x9afe('0x13'),'appdata':util['format']('CDR(type)=%s',_0x3c9832[_0x33567f][0x0][_0x9afe('0x12')]),'context':_0x3c9832[_0x33567f][0x0][_0x9afe('0x14')],'exten':_0x3c9832[_0x33567f][0x0][_0x9afe('0xa')],'priority':_0x482d5a[_0x9afe('0x15')]++,'VoiceExtensionId':_0x3c9832[_0x33567f][0x0][_0x9afe('0x16')]});if(_0x3c9832[_0x33567f][0x0]['type']===_0x9afe('0x17')){_0x482d5a['extensions'][_0x9afe('0x18')]({'type':_0x3c9832[_0x33567f][0x0][_0x9afe('0x12')],'app':_0x9afe('0x13'),'appdata':_0x9afe('0x19')+_0x3c9832[_0x33567f][0x0][_0x9afe('0x16')],'context':_0x3c9832[_0x33567f][0x0][_0x9afe('0x14')],'exten':_0x3c9832[_0x33567f][0x0][_0x9afe('0xa')],'priority':_0x482d5a['priority']++,'VoiceExtensionId':_0x3c9832[_0x33567f][0x0][_0x9afe('0x16')]});}else if(_0x3c9832[_0x33567f][0x0][_0x9afe('0x12')]===_0x9afe('0x1a')){if(_0x482d5a['extension']){_0x482d5a[_0x9afe('0xf')][_0x9afe('0x18')]({'type':_0x3c9832[_0x33567f][0x0][_0x9afe('0x12')],'app':_0x9afe('0x13'),'appdata':_0x9afe('0x1b')+(_0x482d5a[_0x9afe('0x10')][_0x9afe('0x1c')]?_0x9afe('0x1d')+_0x482d5a[_0x9afe('0x10')][_0x9afe('0x1c')]+'}':'${EXTEN}'),'context':_0x3c9832[_0x33567f][0x0][_0x9afe('0x14')],'exten':_0x3c9832[_0x33567f][0x0][_0x9afe('0xa')],'priority':_0x482d5a[_0x9afe('0x15')]++,'VoiceExtensionId':_0x3c9832[_0x33567f][0x0]['VoiceExtensionId']});}_0x482d5a[_0x9afe('0xf')]['push']({'type':_0x3c9832[_0x33567f][0x0]['type'],'app':_0x9afe('0x13'),'appdata':_0x9afe('0x19')+_0x3c9832[_0x33567f][0x0]['VoiceExtensionId'],'context':_0x3c9832[_0x33567f][0x0][_0x9afe('0x14')],'exten':_0x3c9832[_0x33567f][0x0]['exten'],'priority':_0x482d5a[_0x9afe('0x15')]++,'VoiceExtensionId':_0x3c9832[_0x33567f][0x0]['VoiceExtensionId']});var _0x18d7c8=_0x482d5a[_0x9afe('0x15')]++;_0x482d5a[_0x9afe('0xf')][_0x9afe('0x18')]({'type':_0x3c9832[_0x33567f][0x0][_0x9afe('0x12')],'app':'ExecIf','appdata':_0x9afe('0x1e')+(_0x18d7c8+0x2)+_0x9afe('0x1f')+(_0x18d7c8+0x1)+')','context':_0x3c9832[_0x33567f][0x0][_0x9afe('0x14')],'exten':_0x3c9832[_0x33567f][0x0]['exten'],'priority':_0x18d7c8,'VoiceExtensionId':_0x3c9832[_0x33567f][0x0][_0x9afe('0x16')]});if(_0x482d5a[_0x9afe('0x10')]){_0x482d5a['extensions'][_0x9afe('0x18')]({'type':_0x3c9832[_0x33567f][0x0][_0x9afe('0x12')],'app':_0x9afe('0x13'),'appdata':_0x482d5a[_0x9afe('0x10')][_0x9afe('0x1c')]?_0x9afe('0x20')+_0x482d5a[_0x9afe('0x10')][_0x9afe('0x1c')]+'}':_0x9afe('0x21'),'context':_0x3c9832[_0x33567f][0x0][_0x9afe('0x14')],'exten':_0x3c9832[_0x33567f][0x0]['exten'],'priority':_0x482d5a[_0x9afe('0x15')]++,'VoiceExtensionId':_0x3c9832[_0x33567f][0x0][_0x9afe('0x16')]});}_0x482d5a['extensions']['push']({'type':_0x3c9832[_0x33567f][0x0][_0x9afe('0x12')],'app':_0x9afe('0x13'),'appdata':_0x9afe('0x22')+_0x3c9832[_0x33567f][0x0]['VoiceExtensionId'],'context':_0x3c9832[_0x33567f][0x0]['context'],'exten':_0x3c9832[_0x33567f][0x0][_0x9afe('0xa')],'priority':_0x482d5a[_0x9afe('0x15')]++,'VoiceExtensionId':_0x3c9832[_0x33567f][0x0][_0x9afe('0x16')]});if(_0x482d5a[_0x9afe('0x10')]&&_0x482d5a[_0x9afe('0x10')]['hasOwnProperty']('recordingFormat')&&_0x482d5a[_0x9afe('0x10')]['recordingFormat']!=='none'){_0x482d5a[_0x9afe('0xf')]['push']({'type':_0x3c9832[_0x33567f][0x0][_0x9afe('0x12')],'app':_0x9afe('0x13'),'appdata':_0x9afe('0x23'),'context':_0x3c9832[_0x33567f][0x0][_0x9afe('0x14')],'exten':_0x3c9832[_0x33567f][0x0]['exten'],'priority':_0x482d5a[_0x9afe('0x15')]++,'VoiceExtensionId':_0x3c9832[_0x33567f][0x0][_0x9afe('0x16')]});_0x482d5a[_0x9afe('0xf')][_0x9afe('0x18')]({'type':_0x3c9832[_0x33567f][0x0]['type'],'app':_0x9afe('0x13'),'appdata':_0x9afe('0x24')+_0x482d5a[_0x9afe('0x10')]['recordingFormat']||_0x9afe('0x25'),'context':_0x3c9832[_0x33567f][0x0][_0x9afe('0x14')],'exten':_0x3c9832[_0x33567f][0x0][_0x9afe('0xa')],'priority':_0x482d5a[_0x9afe('0x15')]++,'VoiceExtensionId':_0x3c9832[_0x33567f][0x0]['VoiceExtensionId']});}}_0x482d5a['extensions'][_0x9afe('0x18')]({'type':_0x3c9832[_0x33567f][0x0]['type'],'app':_0x9afe('0x13'),'appdata':_0x9afe('0x26'),'context':_0x3c9832[_0x33567f][0x0][_0x9afe('0x14')],'exten':_0x3c9832[_0x33567f][0x0][_0x9afe('0xa')],'priority':_0x482d5a[_0x9afe('0x15')]++,'VoiceExtensionId':_0x3c9832[_0x33567f][0x0][_0x9afe('0x16')]});_0x482d5a['extensions'][_0x9afe('0x18')]({'type':_0x3c9832[_0x33567f][0x0]['type'],'app':_0x9afe('0x13'),'appdata':_0x9afe('0x27'),'context':_0x3c9832[_0x33567f][0x0][_0x9afe('0x14')],'exten':_0x3c9832[_0x33567f][0x0][_0x9afe('0xa')],'priority':_0x482d5a[_0x9afe('0x15')]++,'VoiceExtensionId':_0x3c9832[_0x33567f][0x0][_0x9afe('0x16')]});_0x482d5a[_0x9afe('0xf')][_0x9afe('0x18')]({'type':_0x3c9832[_0x33567f][0x0][_0x9afe('0x12')],'app':'Set','appdata':_0x9afe('0x28'),'context':_0x3c9832[_0x33567f][0x0][_0x9afe('0x14')],'exten':_0x3c9832[_0x33567f][0x0][_0x9afe('0xa')],'priority':_0x482d5a[_0x9afe('0x15')]++,'VoiceExtensionId':_0x3c9832[_0x33567f][0x0]['VoiceExtensionId']});for(var _0x279861=0x0,_0x121a5=0x0;_0x279861<_0x3c9832[_0x33567f][_0x9afe('0x29')];_0x279861+=0x1,_0x121a5=0x0){var _0x50f4b6=_0x3c9832[_0x33567f][_0x279861];if(_0x50f4b6['type']){_0x50f4b6['type']=_0x50f4b6[_0x9afe('0x12')][_0x9afe('0x2a')]();}var _0x39c640=[];var _0x100504=[];delete _0x50f4b6['id'];delete _0x50f4b6[_0x9afe('0x2b')];delete _0x50f4b6[_0x9afe('0x2c')];var _0x2f2918=_0x50f4b6[_0x9afe('0x2d')]!==_0x9afe('0x2e')?[_0x50f4b6[_0x9afe('0x2d')]]:_0x50f4b6[_0x9afe('0x8')]?_['map'](_[_0x9afe('0xc')](_0x482d5a[_0x9afe('0x6')],{'IntervalId':_0x50f4b6[_0x9afe('0x8')]}),_0x9afe('0x2d')):[];if(_0x50f4b6[_0x9afe('0xe')](_0x9afe('0x2f'))){if(_0x50f4b6[_0x9afe('0x2f')]&&_0x50f4b6[_0x9afe('0x2f')]!=='--'){_0x39c640['push']({'type':_0x50f4b6['type'],'app':_0x9afe('0x13'),'appdata':_0x9afe('0x30')+_0x50f4b6[_0x9afe('0x2f')],'context':_0x50f4b6['context'],'exten':_0x50f4b6[_0x9afe('0xa')],'priority':_0x2f2918[_0x9afe('0x29')]+_0x482d5a[_0x9afe('0x15')]+_0x121a5++,'VoiceExtensionId':_0x50f4b6['VoiceExtensionId']});}}if(_0x50f4b6[_0x9afe('0x12')]===_0x9afe('0x1a')&&_0x50f4b6[_0x9afe('0xe')](_0x9afe('0x31'))){if(_0x50f4b6[_0x9afe('0x31')]){_0x39c640[_0x9afe('0x18')]({'type':_0x50f4b6[_0x9afe('0x12')],'app':'ExecIf','appdata':_0x9afe('0x32')+_0x50f4b6['callerID']+')','context':_0x50f4b6[_0x9afe('0x14')],'exten':_0x50f4b6[_0x9afe('0xa')],'priority':_0x2f2918[_0x9afe('0x29')]+_0x482d5a[_0x9afe('0x15')]+_0x121a5++,'VoiceExtensionId':_0x50f4b6['VoiceExtensionId']});}else{_0x39c640['push']({'type':_0x50f4b6[_0x9afe('0x12')],'app':_0x9afe('0x33'),'appdata':_0x9afe('0x34'),'context':_0x50f4b6[_0x9afe('0x14')],'exten':_0x50f4b6[_0x9afe('0xa')],'priority':_0x2f2918[_0x9afe('0x29')]+_0x482d5a['priority']+_0x121a5++,'VoiceExtensionId':_0x50f4b6['VoiceExtensionId']});}}if(_0x50f4b6[_0x9afe('0xe')](_0x9afe('0x35'))){if(_0x1ac8ac[_0x9afe('0x36')](_0x50f4b6[_0x9afe('0x37')][_0x9afe('0x2a')]())>=0x0&&_0x50f4b6[_0x9afe('0x38')]!==_0x9afe('0x39')){if(_0x50f4b6['answer']){_0x39c640[_0x9afe('0x18')]({'type':_0x50f4b6['type'],'app':_0x9afe('0x33'),'appdata':_0x9afe('0x3a'),'context':_0x50f4b6[_0x9afe('0x14')],'exten':_0x50f4b6[_0x9afe('0xa')],'priority':_0x2f2918[_0x9afe('0x29')]+_0x482d5a[_0x9afe('0x15')]+_0x121a5++,'VoiceExtensionId':_0x50f4b6['VoiceExtensionId']});_0x39c640[_0x9afe('0x18')]({'type':_0x50f4b6['type'],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=1','context':_0x50f4b6[_0x9afe('0x14')],'exten':_0x50f4b6[_0x9afe('0xa')],'priority':_0x2f2918[_0x9afe('0x29')]+_0x482d5a[_0x9afe('0x15')]+_0x121a5++,'VoiceExtensionId':_0x50f4b6['VoiceExtensionId']});}else{_0x39c640[_0x9afe('0x18')]({'type':_0x50f4b6['type'],'app':_0x9afe('0x33'),'appdata':_0x9afe('0x3b'),'context':_0x50f4b6['context'],'exten':_0x50f4b6['exten'],'priority':_0x2f2918[_0x9afe('0x29')]+_0x482d5a[_0x9afe('0x15')]+_0x121a5++,'VoiceExtensionId':_0x50f4b6[_0x9afe('0x16')]});_0x39c640[_0x9afe('0x18')]({'type':_0x50f4b6[_0x9afe('0x12')],'app':_0x9afe('0x13'),'appdata':_0x9afe('0x3c'),'context':_0x50f4b6[_0x9afe('0x14')],'exten':_0x50f4b6['exten'],'priority':_0x2f2918['length']+_0x482d5a[_0x9afe('0x15')]+_0x121a5++,'VoiceExtensionId':_0x50f4b6['VoiceExtensionId']});}}}for(var _0x540b41=0x0;_0x540b41<_0x2f2918[_0x9afe('0x29')];_0x540b41+=0x1){var _0x1a81d8=_0x482d5a[_0x9afe('0x15')]+_0x2f2918['length'];var _0x6168c=_0x540b41===_0x2f2918[_0x9afe('0x29')]-0x1?_0x482d5a[_0x9afe('0x15')]+_0x39c640[_0x9afe('0x29')]+_0x100504['length']+0x2:_0x482d5a[_0x9afe('0x15')]+_0x540b41+0x1;_0x39c640[_0x9afe('0x3d')](_0x540b41,0x0,{'type':_0x50f4b6[_0x9afe('0x12')],'app':_0x9afe('0x3e'),'appdata':_0x2f2918[_0x540b41]+'?'+_0x50f4b6['context']+_0x9afe('0x3f')+_0x1a81d8+':'+_0x50f4b6[_0x9afe('0x14')]+_0x9afe('0x3f')+_0x6168c,'exten':_0x50f4b6[_0x9afe('0xa')],'context':_0x50f4b6[_0x9afe('0x14')],'priority':_0x482d5a[_0x9afe('0x15')]+_0x540b41,'VoiceExtensionId':_0x3c9832[_0x33567f][0x0][_0x9afe('0x16')]});}_0x50f4b6['priority']=_0x39c640[_0x9afe('0x29')]?_[_0x9afe('0x40')](_0x39c640)['priority']+0x1:_0x482d5a[_0x9afe('0x15')];_0x482d5a[_0x9afe('0x15')]=(_0x100504[_0x9afe('0x29')]?_['last'](_0x100504)['priority']:_0x50f4b6[_0x9afe('0x15')])+0x1;_0x482d5a['extensions']=_['concat'](_0x482d5a[_0x9afe('0xf')],_0x39c640,[_0x50f4b6],_0x100504);}_0x482d5a[_0x9afe('0xf')][_0x9afe('0x18')]({'type':_0x3c9832[_0x33567f][0x0][_0x9afe('0x12')],'app':'Hangup','exten':_0x3c9832[_0x33567f][0x0][_0x9afe('0xa')],'context':_0x3c9832[_0x33567f][0x0][_0x9afe('0x14')],'priority':_0x482d5a[_0x9afe('0x15')],'VoiceExtensionId':_0x3c9832[_0x33567f][0x0][_0x9afe('0x16')]});_0x4792a8[_0x9afe('0x18')](_0x3c9832[_0x33567f][0x0][_0x9afe('0x16')]);_0x4ff3ac=_[_0x9afe('0x41')](_0x4ff3ac,_0x482d5a['extensions']);}}return _0x5f5ba2['transaction'](function(_0x4e0c04){return _0x5f5ba2[_0x9afe('0x2')]['VoiceExtension'][_0x9afe('0x42')]({'where':{'VoiceExtensionId':{'$in':_0x4792a8}},'transaction':_0x4e0c04})[_0x9afe('0x5')](function(_0x54eeed){return _0x5f5ba2['models'][_0x9afe('0x7')][_0x9afe('0x43')](_[_0x9afe('0x44')](_0x4ff3ac,'priority'),{'transaction':_0x4e0c04});});});})[_0x9afe('0x45')](function(_0x29c33f){console['error'](_0x29c33f);});}exports[_0x9afe('0x46')]=rewrite; \ No newline at end of file +var _0x022d=['):Goto(','cutdigits','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','toLowerCase','createdAt','updatedAt','interval','intervals','hasOwnProperty','tag','CDR(tag)=','length','callerID','indexOf','app','appType','custom','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','transaction','destroy','sortBy','catch','error','rewrite','lodash','util','Interval','findAll','models','VoiceExtension','IntervalId','then','uniq','map','CAST(priority\x20AS\x20UNSIGNED)','filter','exten','queue','extensions','extension','find','push','type','Set','format','priority','VoiceExtensionId','inbound','CDR(routeid)=','context','outbound','CDR(destination)=','${EXTEN:','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x022d,0x191));var _0xd022=function(_0x59e199,_0xced8dc){_0x59e199=_0x59e199-0x0;var _0x53361c=_0x022d[_0x59e199];return _0x53361c;};'use strict';var _=require(_0xd022('0x0'));var util=require(_0xd022('0x1'));function rewrite(_0x4e1dd2,_0x20c0dc){var _0x504fe3=this;return _0x4e1dd2['models'][_0xd022('0x2')][_0xd022('0x3')]({'raw':!![]})['then'](function(_0x3dfec1){_0x504fe3['intervals']=_0x3dfec1;return _0x4e1dd2[_0xd022('0x4')][_0xd022('0x5')][_0xd022('0x3')]({'where':{'IntervalId':_0x20c0dc[_0xd022('0x6')]},'raw':!![]});})[_0xd022('0x7')](function(_0x3ab0ae){return _0x4e1dd2[_0xd022('0x4')][_0xd022('0x5')][_0xd022('0x3')]({'where':{'exten':{'$in':_[_0xd022('0x8')](_[_0xd022('0x9')](_0x3ab0ae,'exten'))}},'order':[{'raw':_0xd022('0xa')}],'raw':!![]});})[_0xd022('0x7')](function(_0x17241e){var _0x17de55=_[_0xd022('0xb')](_0x17241e,{'priority':'1'});var _0x153c19=_[_0xd022('0xb')](_0x17241e,{'isApp':0x1});var _0xee84e8=_['groupBy'](_0x153c19,_0xd022('0xc'));var _0x3f4051=[_0xd022('0xd'),'playback'];var _0x501ef4=[];var _0x1afaf1=[];for(var _0x52d4fe in _0xee84e8){if(_0xee84e8['hasOwnProperty'](_0x52d4fe)){_0x504fe3['priority']=0x2;_0x504fe3[_0xd022('0xe')]=[];_0x504fe3[_0xd022('0xf')]=_[_0xd022('0x10')](_0x17de55,{'exten':_0xee84e8[_0x52d4fe][0x0][_0xd022('0xc')]});_0x504fe3[_0xd022('0xe')][_0xd022('0x11')]({'type':_0xee84e8[_0x52d4fe][0x0][_0xd022('0x12')],'app':_0xd022('0x13'),'appdata':util[_0xd022('0x14')]('CDR(type)=%s',_0xee84e8[_0x52d4fe][0x0]['type']),'context':_0xee84e8[_0x52d4fe][0x0]['context'],'exten':_0xee84e8[_0x52d4fe][0x0][_0xd022('0xc')],'priority':_0x504fe3[_0xd022('0x15')]++,'VoiceExtensionId':_0xee84e8[_0x52d4fe][0x0][_0xd022('0x16')]});if(_0xee84e8[_0x52d4fe][0x0][_0xd022('0x12')]===_0xd022('0x17')){_0x504fe3[_0xd022('0xe')][_0xd022('0x11')]({'type':_0xee84e8[_0x52d4fe][0x0]['type'],'app':_0xd022('0x13'),'appdata':_0xd022('0x18')+_0xee84e8[_0x52d4fe][0x0][_0xd022('0x16')],'context':_0xee84e8[_0x52d4fe][0x0][_0xd022('0x19')],'exten':_0xee84e8[_0x52d4fe][0x0]['exten'],'priority':_0x504fe3[_0xd022('0x15')]++,'VoiceExtensionId':_0xee84e8[_0x52d4fe][0x0][_0xd022('0x16')]});}else if(_0xee84e8[_0x52d4fe][0x0][_0xd022('0x12')]===_0xd022('0x1a')){if(_0x504fe3['extension']){_0x504fe3[_0xd022('0xe')][_0xd022('0x11')]({'type':_0xee84e8[_0x52d4fe][0x0][_0xd022('0x12')],'app':_0xd022('0x13'),'appdata':_0xd022('0x1b')+(_0x504fe3[_0xd022('0xf')]['cutdigits']?_0xd022('0x1c')+_0x504fe3[_0xd022('0xf')]['cutdigits']+'}':'${EXTEN}'),'context':_0xee84e8[_0x52d4fe][0x0][_0xd022('0x19')],'exten':_0xee84e8[_0x52d4fe][0x0][_0xd022('0xc')],'priority':_0x504fe3[_0xd022('0x15')]++,'VoiceExtensionId':_0xee84e8[_0x52d4fe][0x0][_0xd022('0x16')]});}_0x504fe3['extensions']['push']({'type':_0xee84e8[_0x52d4fe][0x0][_0xd022('0x12')],'app':'Set','appdata':_0xd022('0x18')+_0xee84e8[_0x52d4fe][0x0][_0xd022('0x16')],'context':_0xee84e8[_0x52d4fe][0x0][_0xd022('0x19')],'exten':_0xee84e8[_0x52d4fe][0x0]['exten'],'priority':_0x504fe3[_0xd022('0x15')]++,'VoiceExtensionId':_0xee84e8[_0x52d4fe][0x0][_0xd022('0x16')]});var _0x5ad0d3=_0x504fe3[_0xd022('0x15')]++;_0x504fe3[_0xd022('0xe')][_0xd022('0x11')]({'type':_0xee84e8[_0x52d4fe][0x0][_0xd022('0x12')],'app':_0xd022('0x1d'),'appdata':_0xd022('0x1e')+(_0x5ad0d3+0x2)+_0xd022('0x1f')+(_0x5ad0d3+0x1)+')','context':_0xee84e8[_0x52d4fe][0x0][_0xd022('0x19')],'exten':_0xee84e8[_0x52d4fe][0x0][_0xd022('0xc')],'priority':_0x5ad0d3,'VoiceExtensionId':_0xee84e8[_0x52d4fe][0x0][_0xd022('0x16')]});if(_0x504fe3[_0xd022('0xf')]){_0x504fe3['extensions'][_0xd022('0x11')]({'type':_0xee84e8[_0x52d4fe][0x0][_0xd022('0x12')],'app':'Set','appdata':_0x504fe3['extension'][_0xd022('0x20')]?_0xd022('0x21')+_0x504fe3[_0xd022('0xf')]['cutdigits']+'}':_0xd022('0x22'),'context':_0xee84e8[_0x52d4fe][0x0][_0xd022('0x19')],'exten':_0xee84e8[_0x52d4fe][0x0][_0xd022('0xc')],'priority':_0x504fe3['priority']++,'VoiceExtensionId':_0xee84e8[_0x52d4fe][0x0][_0xd022('0x16')]});}_0x504fe3[_0xd022('0xe')][_0xd022('0x11')]({'type':_0xee84e8[_0x52d4fe][0x0][_0xd022('0x12')],'app':_0xd022('0x13'),'appdata':'outboundrouteid='+_0xee84e8[_0x52d4fe][0x0][_0xd022('0x16')],'context':_0xee84e8[_0x52d4fe][0x0][_0xd022('0x19')],'exten':_0xee84e8[_0x52d4fe][0x0][_0xd022('0xc')],'priority':_0x504fe3['priority']++,'VoiceExtensionId':_0xee84e8[_0x52d4fe][0x0][_0xd022('0x16')]});if(_0x504fe3[_0xd022('0xf')]&&_0x504fe3['extension']['hasOwnProperty'](_0xd022('0x23'))&&_0x504fe3[_0xd022('0xf')]['recordingFormat']!==_0xd022('0x24')){_0x504fe3[_0xd022('0xe')][_0xd022('0x11')]({'type':_0xee84e8[_0x52d4fe][0x0][_0xd022('0x12')],'app':'Set','appdata':_0xd022('0x25'),'context':_0xee84e8[_0x52d4fe][0x0]['context'],'exten':_0xee84e8[_0x52d4fe][0x0][_0xd022('0xc')],'priority':_0x504fe3[_0xd022('0x15')]++,'VoiceExtensionId':_0xee84e8[_0x52d4fe][0x0][_0xd022('0x16')]});_0x504fe3[_0xd022('0xe')]['push']({'type':_0xee84e8[_0x52d4fe][0x0]['type'],'app':'Set','appdata':_0xd022('0x26')+_0x504fe3[_0xd022('0xf')][_0xd022('0x23')]||_0xd022('0x27'),'context':_0xee84e8[_0x52d4fe][0x0][_0xd022('0x19')],'exten':_0xee84e8[_0x52d4fe][0x0]['exten'],'priority':_0x504fe3['priority']++,'VoiceExtensionId':_0xee84e8[_0x52d4fe][0x0]['VoiceExtensionId']});}}_0x504fe3[_0xd022('0xe')][_0xd022('0x11')]({'type':_0xee84e8[_0x52d4fe][0x0][_0xd022('0x12')],'app':_0xd022('0x13'),'appdata':_0xd022('0x28'),'context':_0xee84e8[_0x52d4fe][0x0][_0xd022('0x19')],'exten':_0xee84e8[_0x52d4fe][0x0]['exten'],'priority':_0x504fe3[_0xd022('0x15')]++,'VoiceExtensionId':_0xee84e8[_0x52d4fe][0x0][_0xd022('0x16')]});_0x504fe3[_0xd022('0xe')][_0xd022('0x11')]({'type':_0xee84e8[_0x52d4fe][0x0][_0xd022('0x12')],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0xee84e8[_0x52d4fe][0x0]['context'],'exten':_0xee84e8[_0x52d4fe][0x0][_0xd022('0xc')],'priority':_0x504fe3['priority']++,'VoiceExtensionId':_0xee84e8[_0x52d4fe][0x0]['VoiceExtensionId']});_0x504fe3[_0xd022('0xe')][_0xd022('0x11')]({'type':_0xee84e8[_0x52d4fe][0x0][_0xd022('0x12')],'app':_0xd022('0x13'),'appdata':_0xd022('0x29'),'context':_0xee84e8[_0x52d4fe][0x0][_0xd022('0x19')],'exten':_0xee84e8[_0x52d4fe][0x0][_0xd022('0xc')],'priority':_0x504fe3[_0xd022('0x15')]++,'VoiceExtensionId':_0xee84e8[_0x52d4fe][0x0]['VoiceExtensionId']});for(var _0x3d4106=0x0,_0x595852=0x0;_0x3d4106<_0xee84e8[_0x52d4fe]['length'];_0x3d4106+=0x1,_0x595852=0x0){var _0x8c0698=_0xee84e8[_0x52d4fe][_0x3d4106];if(_0x8c0698['type']){_0x8c0698[_0xd022('0x12')]=_0x8c0698[_0xd022('0x12')][_0xd022('0x2a')]();}var _0x31849c=[];var _0x382c13=[];delete _0x8c0698['id'];delete _0x8c0698[_0xd022('0x2b')];delete _0x8c0698[_0xd022('0x2c')];var _0x4d0bcf=_0x8c0698['interval']!=='*,*,*,*'?[_0x8c0698[_0xd022('0x2d')]]:_0x8c0698[_0xd022('0x6')]?_['map'](_[_0xd022('0xb')](_0x504fe3[_0xd022('0x2e')],{'IntervalId':_0x8c0698[_0xd022('0x6')]}),_0xd022('0x2d')):[];if(_0x8c0698[_0xd022('0x2f')](_0xd022('0x30'))){if(_0x8c0698[_0xd022('0x30')]&&_0x8c0698[_0xd022('0x30')]!=='--'){_0x31849c['push']({'type':_0x8c0698[_0xd022('0x12')],'app':_0xd022('0x13'),'appdata':_0xd022('0x31')+_0x8c0698['tag'],'context':_0x8c0698[_0xd022('0x19')],'exten':_0x8c0698[_0xd022('0xc')],'priority':_0x4d0bcf[_0xd022('0x32')]+_0x504fe3['priority']+_0x595852++,'VoiceExtensionId':_0x8c0698[_0xd022('0x16')]});}}if(_0x8c0698[_0xd022('0x12')]===_0xd022('0x1a')&&_0x8c0698['hasOwnProperty']('callerID')){if(_0x8c0698[_0xd022('0x33')]){_0x31849c[_0xd022('0x11')]({'type':_0x8c0698[_0xd022('0x12')],'app':_0xd022('0x1d'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x8c0698[_0xd022('0x33')]+')','context':_0x8c0698[_0xd022('0x19')],'exten':_0x8c0698[_0xd022('0xc')],'priority':_0x4d0bcf[_0xd022('0x32')]+_0x504fe3[_0xd022('0x15')]+_0x595852++,'VoiceExtensionId':_0x8c0698[_0xd022('0x16')]});}else{_0x31849c[_0xd022('0x11')]({'type':_0x8c0698['type'],'app':_0xd022('0x1d'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x8c0698[_0xd022('0x19')],'exten':_0x8c0698[_0xd022('0xc')],'priority':_0x4d0bcf[_0xd022('0x32')]+_0x504fe3['priority']+_0x595852++,'VoiceExtensionId':_0x8c0698[_0xd022('0x16')]});}}if(_0x8c0698[_0xd022('0x2f')]('answer')){if(_0x3f4051[_0xd022('0x34')](_0x8c0698[_0xd022('0x35')][_0xd022('0x2a')]())>=0x0&&_0x8c0698[_0xd022('0x36')]!==_0xd022('0x37')){if(_0x8c0698[_0xd022('0x38')]){_0x31849c[_0xd022('0x11')]({'type':_0x8c0698[_0xd022('0x12')],'app':_0xd022('0x1d'),'appdata':_0xd022('0x39'),'context':_0x8c0698[_0xd022('0x19')],'exten':_0x8c0698['exten'],'priority':_0x4d0bcf[_0xd022('0x32')]+_0x504fe3[_0xd022('0x15')]+_0x595852++,'VoiceExtensionId':_0x8c0698[_0xd022('0x16')]});_0x31849c['push']({'type':_0x8c0698[_0xd022('0x12')],'app':'Set','appdata':_0xd022('0x3a'),'context':_0x8c0698['context'],'exten':_0x8c0698[_0xd022('0xc')],'priority':_0x4d0bcf[_0xd022('0x32')]+_0x504fe3[_0xd022('0x15')]+_0x595852++,'VoiceExtensionId':_0x8c0698[_0xd022('0x16')]});}else{_0x31849c[_0xd022('0x11')]({'type':_0x8c0698['type'],'app':'ExecIf','appdata':_0xd022('0x3b'),'context':_0x8c0698[_0xd022('0x19')],'exten':_0x8c0698[_0xd022('0xc')],'priority':_0x4d0bcf['length']+_0x504fe3[_0xd022('0x15')]+_0x595852++,'VoiceExtensionId':_0x8c0698[_0xd022('0x16')]});_0x31849c[_0xd022('0x11')]({'type':_0x8c0698[_0xd022('0x12')],'app':_0xd022('0x13'),'appdata':_0xd022('0x3c'),'context':_0x8c0698[_0xd022('0x19')],'exten':_0x8c0698[_0xd022('0xc')],'priority':_0x4d0bcf[_0xd022('0x32')]+_0x504fe3[_0xd022('0x15')]+_0x595852++,'VoiceExtensionId':_0x8c0698[_0xd022('0x16')]});}}}for(var _0x3817a9=0x0;_0x3817a9<_0x4d0bcf[_0xd022('0x32')];_0x3817a9+=0x1){var _0x23b6ab=_0x504fe3[_0xd022('0x15')]+_0x4d0bcf[_0xd022('0x32')];var _0x5ed973=_0x3817a9===_0x4d0bcf[_0xd022('0x32')]-0x1?_0x504fe3['priority']+_0x31849c[_0xd022('0x32')]+_0x382c13[_0xd022('0x32')]+0x2:_0x504fe3['priority']+_0x3817a9+0x1;_0x31849c[_0xd022('0x3d')](_0x3817a9,0x0,{'type':_0x8c0698['type'],'app':_0xd022('0x3e'),'appdata':_0x4d0bcf[_0x3817a9]+'?'+_0x8c0698[_0xd022('0x19')]+_0xd022('0x3f')+_0x23b6ab+':'+_0x8c0698['context']+',${EXTEN},'+_0x5ed973,'exten':_0x8c0698[_0xd022('0xc')],'context':_0x8c0698['context'],'priority':_0x504fe3[_0xd022('0x15')]+_0x3817a9,'VoiceExtensionId':_0xee84e8[_0x52d4fe][0x0][_0xd022('0x16')]});}_0x8c0698[_0xd022('0x15')]=_0x31849c[_0xd022('0x32')]?_[_0xd022('0x40')](_0x31849c)[_0xd022('0x15')]+0x1:_0x504fe3[_0xd022('0x15')];_0x504fe3['priority']=(_0x382c13[_0xd022('0x32')]?_[_0xd022('0x40')](_0x382c13)[_0xd022('0x15')]:_0x8c0698[_0xd022('0x15')])+0x1;_0x504fe3[_0xd022('0xe')]=_[_0xd022('0x41')](_0x504fe3[_0xd022('0xe')],_0x31849c,[_0x8c0698],_0x382c13);}_0x504fe3['extensions'][_0xd022('0x11')]({'type':_0xee84e8[_0x52d4fe][0x0][_0xd022('0x12')],'app':'Hangup','exten':_0xee84e8[_0x52d4fe][0x0][_0xd022('0xc')],'context':_0xee84e8[_0x52d4fe][0x0][_0xd022('0x19')],'priority':_0x504fe3['priority'],'VoiceExtensionId':_0xee84e8[_0x52d4fe][0x0][_0xd022('0x16')]});_0x501ef4['push'](_0xee84e8[_0x52d4fe][0x0][_0xd022('0x16')]);_0x1afaf1=_[_0xd022('0x41')](_0x1afaf1,_0x504fe3[_0xd022('0xe')]);}}return _0x4e1dd2[_0xd022('0x42')](function(_0xcc6094){return _0x4e1dd2[_0xd022('0x4')][_0xd022('0x5')][_0xd022('0x43')]({'where':{'VoiceExtensionId':{'$in':_0x501ef4}},'transaction':_0xcc6094})[_0xd022('0x7')](function(_0x2c7a45){return _0x4e1dd2[_0xd022('0x4')][_0xd022('0x5')]['bulkCreate'](_[_0xd022('0x44')](_0x1afaf1,'priority'),{'transaction':_0xcc6094});});});})[_0xd022('0x45')](function(_0x35238a){console[_0xd022('0x46')](_0x35238a);});}exports[_0xd022('0x47')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index b134bbb..13751be 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 _0xdead=['from','cm_contacts','where','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','fromQuery','id\x20IN\x20?','str','select','calleridnum','cm_hopper_final','insert','deletedAt\x20IS\x20NULL','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','Lists','get','sequelize','VoiceQueueId','onlyIfOpen','query','catch','all','CmList','BlackLists','Campaign','always','CampaignId','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','resolve','exit','SIGINT','info','createReadStream','pause','Error\x20executing\x20contact\x20csv\x20import:','bluebird','lodash','squel','papaparse','../../../mysqldb','../../../config/logger','api','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','argv','null','Missing\x20filepath\x20parameter!','undefined','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','isNil','errors','length','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','YYYY-MM-DD','isValid','email','email\x20format\x20is\x20not\x20valid!','ListId','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','push','stringify','cmContact','checkHopper','into','cm_hopper','scheduledAt','ContactId','createdAt','updatedAt','field','NOW()','toString'];(function(_0x39e101,_0x1d328c){var _0x11919b=function(_0x5a7c2f){while(--_0x5a7c2f){_0x39e101['push'](_0x39e101['shift']());}};_0x11919b(++_0x1d328c);}(_0xdead,0x93));var _0xddea=function(_0x2ef49b,_0x9661a7){_0x2ef49b=_0x2ef49b-0x0;var _0x663f4b=_0xdead[_0x2ef49b];return _0x663f4b;};'use strict';var BPromise=require(_0xddea('0x0'));var util=require('util');var _=require(_0xddea('0x1'));var fs=require('fs');var squel=require(_0xddea('0x2'));var Papa=require(_0xddea('0x3'));var Redis=require('ioredis');var db=require(_0xddea('0x4'))['db'];var config=require('../../../config/environment');var logger=require(_0xddea('0x5'))(_0xddea('0x6'));config['redis']=_['defaults'](config[_0xddea('0x7')],{'host':_0xddea('0x8'),'port':0x18eb});var socket=require(_0xddea('0x9'))(new Redis(config[_0xddea('0x7')]));require(_0xddea('0xa'))['register'](socket);try{if(!process[_0xddea('0xb')][0x2]||process[_0xddea('0xb')][0x2]==='undefined'||process[_0xddea('0xb')][0x2]===_0xddea('0xc')){throw new Error(_0xddea('0xd'));}var FILEPATH=process[_0xddea('0xb')][0x2];if(!process[_0xddea('0xb')][0x3]||process['argv'][0x3]===_0xddea('0xe')||process[_0xddea('0xb')][0x3]===_0xddea('0xc')||!process[_0xddea('0xb')][0x4]||process[_0xddea('0xb')][0x4]===_0xddea('0xe')||process['argv'][0x4]===_0xddea('0xc')){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_[_0xddea('0xf')](process[_0xddea('0xb')][0x3][_0xddea('0x10')](','),process[_0xddea('0xb')][0x4][_0xddea('0x10')](','));if(!process['argv'][0x5]||process[_0xddea('0xb')][0x5]==='undefined'||process['argv'][0x5]===_0xddea('0xc')){throw new Error(_0xddea('0x11'));}var LISTID=process[_0xddea('0xb')][0x5];var COMPANYID=process[_0xddea('0xb')][0x6]&&process['argv'][0x6]!==_0xddea('0xe')&&process[_0xddea('0xb')][0x6]!==_0xddea('0xc')?process[_0xddea('0xb')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0xddea('0xb')][0x7]!=='undefined'&&process[_0xddea('0xb')][0x7]!==_0xddea('0xc')?process[_0xddea('0xb')][0x7]:null;if(!process[_0xddea('0xb')][0x8]||process['argv'][0x8]==='undefined'||process['argv'][0x8]===_0xddea('0xc')){throw new Error(_0xddea('0x12'));}var SOCKET_TIMESTAMP=process[_0xddea('0xb')][0x8];}catch(_0x153e7b){logger[_0xddea('0x13')](_0x153e7b);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(_0x1f3fbb,_0x1f905a,_0x3933fc,_0x32aeac){var _0x462945={'message':_0x1f905a};_0x462945[_0x1f3fbb]=!![];if(_0x3933fc){_0x462945[_0xddea('0x14')]=_0x3933fc;}if(_0x32aeac){_0x462945['index']=_0x32aeac;}return _0x462945;}function isEmail(_0xf95343){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'](_0xf95343);}function checkRow(_0x157c1a,_0x123eb8,_0x215b90){return new BPromise(function(_0x4d4e51,_0x5a6dc8){if(_[_0xddea('0x15')](_0x157c1a)){return _0x5a6dc8(handleCheckRowError('error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x215b90));}if(_0x157c1a[_0xddea('0x16')]&&_0x157c1a['errors'][_0xddea('0x17')]){var _0x50c569=_['map'](_0x157c1a[_0xddea('0x16')],_0xddea('0x18'))[_0xddea('0x19')](';');return _0x5a6dc8(handleCheckRowError(_0xddea('0x13'),_0x50c569,null,_0x215b90));}var _0x3e4dde={};for(var _0x39d142 in FIELDS){if(FIELDS[_0xddea('0x1a')](_0x39d142)&&FIELDS[_0x39d142]){_0x3e4dde[_0x39d142]=_0x157c1a['data'][0x0][FIELDS[_0x39d142]]||_0x157c1a[_0xddea('0x1b')][0x0]['\ufeff'+FIELDS[_0x39d142]];}}if(!_0x3e4dde[_0xddea('0x1c')]){return _0x5a6dc8(handleCheckRowError(_0xddea('0x13'),_0xddea('0x1d'),null,_0x215b90));}if(!_0x3e4dde[_0xddea('0x1e')]){return _0x5a6dc8(handleCheckRowError(_0xddea('0x13'),_0xddea('0x1f'),null,_0x215b90));}if(_0x3e4dde['birthDate']){var _0xade1e6=moment(_0x3e4dde['birthDate'],_0xddea('0x20'));if(!_0xade1e6[_0xddea('0x21')]()){return _0x5a6dc8(handleCheckRowError('error','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x215b90));}}if(_0x3e4dde[_0xddea('0x22')]){if(!isEmail(_0x3e4dde[_0xddea('0x22')])){return _0x5a6dc8(handleCheckRowError('error',_0xddea('0x23'),null,_0x215b90));}}_0x3e4dde[_0xddea('0x24')]=LISTID;_0x3e4dde['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xddea('0x17')]&&_0x123eb8){var _0x378c13={};for(var _0x479f50=0x0,_0x4de244=DUPLICATES['length'];_0x479f50<_0x4de244;_0x479f50+=0x1){_0x378c13[DUPLICATES[_0x479f50]]=_0x3e4dde[DUPLICATES[_0x479f50]];}var _0x4cdfad=_[_0xddea('0x25')](_0x123eb8,_0x378c13);if(_0x4cdfad){return _0x5a6dc8(handleCheckRowError(_0xddea('0x26'),_0xddea('0x27'),_0x4cdfad,_0x215b90));}}return db[_0xddea('0x28')][_0xddea('0x29')](_0x3e4dde,{'raw':!![],'hooks':![],'fields':_[_0xddea('0x2a')](_0x3e4dde)})[_0xddea('0x2b')](function(_0x4906f8){if(DUPLICATES&&DUPLICATES['length']&&_0x123eb8){_0x123eb8[_0xddea('0x2c')](_['pick'](_0x3e4dde,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x4906f8['id'];return _0x4d4e51();})['catch'](function(_0x2eefa9){return _0x5a6dc8(handleCheckRowError(_0xddea('0x13'),'Error\x20while\x20creating\x20contact:\x20'+(_0x2eefa9[_0xddea('0x18')]||JSON[_0xddea('0x2d')](_0x2eefa9)),null,_0x215b90));});});}function checkHopper(){function _0x11cc09(){return function(_0x4d6093){logger[_0xddea('0x13')](_0xddea('0x2e'),_0xddea('0x2f'),util['inspect'](_0x4d6093,{'showHidden':![],'depth':null}));};}var _0x3c3f8c=function(_0x18d4f7,_0x15b5d3){var _0x41af33=squel['insert']()[_0xddea('0x30')](_0xddea('0x31'))['fromQuery'](['phone',_0xddea('0x32'),_0xddea('0x33'),_0xddea('0x24'),_0x15b5d3,_0xddea('0x34'),_0xddea('0x35')],squel['select']()[_0xddea('0x36')](_0xddea('0x1e'),_0xddea('0x1e'))[_0xddea('0x36')](_0xddea('0x37'),_0xddea('0x32'))['field']('id',_0xddea('0x33'))[_0xddea('0x36')](LISTID['toString'](),_0xddea('0x24'))[_0xddea('0x36')](_0x18d4f7['id'][_0xddea('0x38')](),_0x15b5d3)['field']('NOW()',_0xddea('0x34'))[_0xddea('0x36')]('NOW()',_0xddea('0x35'))[_0xddea('0x39')](_0xddea('0x3a'))[_0xddea('0x3b')]('deletedAt\x20IS\x20NULL')['where'](_0xddea('0x3c'),LISTID[_0xddea('0x38')]())[_0xddea('0x3b')](_0xddea('0x3d'))[_0xddea('0x3b')](_0xddea('0x3e'),squel['select']()[_0xddea('0x36')](_0xddea('0x1e'))[_0xddea('0x39')](_0xddea('0x31'))[_0xddea('0x3b')](_0x15b5d3+_0xddea('0x3f'),_0x18d4f7['id'][_0xddea('0x38')]())))[_0xddea('0x38')]();return _0x41af33;};var _0x3311b0=function(_0x200f11,_0x44ef61){var _0x43d496=squel['insert']()[_0xddea('0x30')](_0xddea('0x31'))[_0xddea('0x40')]([_0xddea('0x1e'),_0xddea('0x32'),_0xddea('0x33'),_0xddea('0x24'),_0x44ef61,_0xddea('0x34'),_0xddea('0x35')],squel['select']()[_0xddea('0x36')](_0xddea('0x1e'),_0xddea('0x1e'))[_0xddea('0x36')](_0xddea('0x37'),_0xddea('0x32'))[_0xddea('0x36')]('id',_0xddea('0x33'))[_0xddea('0x36')](LISTID['toString'](),_0xddea('0x24'))[_0xddea('0x36')](_0x200f11['id'][_0xddea('0x38')](),_0x44ef61)['field']('NOW()','createdAt')[_0xddea('0x36')]('NOW()',_0xddea('0x35'))['from'](_0xddea('0x3a'))[_0xddea('0x3b')]('deletedAt\x20IS\x20NULL')[_0xddea('0x3b')](_0xddea('0x3c'),LISTID[_0xddea('0x38')]())[_0xddea('0x3b')](_0xddea('0x41'),squel[_0xddea('0x42')](hopperContacts))['where'](_0xddea('0x3d'))[_0xddea('0x3b')](_0xddea('0x3e'),squel[_0xddea('0x43')]()[_0xddea('0x36')](_0xddea('0x44'))[_0xddea('0x39')](_0xddea('0x45'))['where'](_0x44ef61+_0xddea('0x3f'),_0x200f11['id'][_0xddea('0x38')]()))[_0xddea('0x3b')](_0xddea('0x3e'),squel[_0xddea('0x43')]()[_0xddea('0x36')]('phone')['from'](_0xddea('0x31'))[_0xddea('0x3b')](_0x44ef61+'\x20=\x20?',_0x200f11['id'][_0xddea('0x38')]())))[_0xddea('0x38')]();return _0x43d496;};function _0x810f6d(_0x24f5a8,_0x5c8525){var _0x16ccd3=squel[_0xddea('0x46')]()['into'](_0xddea('0x31'))[_0xddea('0x40')](['phone',_0xddea('0x32'),_0xddea('0x33'),_0xddea('0x24'),_0x5c8525,'createdAt',_0xddea('0x35')],squel['select']()[_0xddea('0x36')]('phone',_0xddea('0x1e'))[_0xddea('0x36')](_0xddea('0x37'),_0xddea('0x32'))[_0xddea('0x36')]('id','ContactId')[_0xddea('0x36')](LISTID['toString'](),'ListId')['field'](_0x24f5a8['id']['toString'](),_0x5c8525)[_0xddea('0x36')](_0xddea('0x37'),_0xddea('0x34'))[_0xddea('0x36')](_0xddea('0x37'),_0xddea('0x35'))[_0xddea('0x39')](_0xddea('0x3a'))['where'](_0xddea('0x47'))['where']('ListId\x20=\x20?',LISTID['toString']())[_0xddea('0x3b')](_0xddea('0x41'),squel[_0xddea('0x42')](hopperContacts))['where'](_0xddea('0x3d')))[_0xddea('0x38')]();return _0x16ccd3;}function _0x1b3996(_0x38f427,_0x2aec72){var _0xbe753f=squel[_0xddea('0x46')]()[_0xddea('0x30')](_0xddea('0x48'))[_0xddea('0x40')]([_0xddea('0x1e'),'ContactId',_0xddea('0x24'),_0x2aec72,'createdAt',_0xddea('0x35')],squel[_0xddea('0x43')]()[_0xddea('0x36')](_0xddea('0x1e'),_0xddea('0x1e'))[_0xddea('0x36')]('id',_0xddea('0x33'))['field'](LISTID['toString'](),_0xddea('0x24'))[_0xddea('0x36')](_0x38f427['id'][_0xddea('0x38')](),_0x2aec72)['field'](_0xddea('0x37'),'createdAt')[_0xddea('0x36')](_0xddea('0x37'),_0xddea('0x35'))['from'](_0xddea('0x3a'))['where'](_0xddea('0x47'))['where']('ListId\x20=\x20?',LISTID[_0xddea('0x38')]())['where']('id\x20IN\x20?',squel[_0xddea('0x42')](hopperContacts))[_0xddea('0x3b')](_0xddea('0x3d')))[_0xddea('0x38')]();return _0xbe753f;}return db[_0xddea('0x49')][_0xddea('0x4a')]({'where':{'type':_0xddea('0x4b')},'attributes':['id',_0xddea('0x4c')],'include':[{'model':db['CmList'],'as':_0xddea('0x4d'),'where':{'id':LISTID}}]})[_0xddea('0x2b')](function(_0x4938be){var _0x3d322c=[];if(_0x4938be){var _0x17d0c7;for(var _0x4db1aa=0x0,_0x8ab9a8;_0x4db1aa<_0x4938be[_0xddea('0x17')];_0x4db1aa+=0x1){_0x8ab9a8=_0x4938be[_0x4db1aa][_0xddea('0x4e')]({'plain':!![]});switch(_0x8ab9a8[_0xddea('0x4c')]){case'always':_0x3d322c['push'](db[_0xddea('0x4f')]['query'](_0x3311b0(_0x8ab9a8,_0xddea('0x50')))[_0xddea('0x2b')](function(){})['catch'](_0x11cc09()));break;case _0xddea('0x51'):_0x3d322c[_0xddea('0x2c')](db[_0xddea('0x4f')][_0xddea('0x52')](_0x3c3f8c(_0x8ab9a8,_0xddea('0x50')))['then'](function(){})['catch'](_0x11cc09()));break;default:_0x3d322c[_0xddea('0x2c')](db[_0xddea('0x4f')][_0xddea('0x52')](_0x810f6d(_0x8ab9a8,'VoiceQueueId'))[_0xddea('0x2b')](function(){})[_0xddea('0x53')](_0x11cc09()));}}}return _0x3d322c;})[_0xddea('0x54')]()['then'](function(){return db[_0xddea('0x49')][_0xddea('0x4a')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0xddea('0x55')],'as':_0xddea('0x56'),'where':{'id':LISTID}}]})[_0xddea('0x2b')](function(_0x556662){var _0x1f8b64=[];if(_0x556662){var _0x3195ba;for(var _0x6c300d=0x0,_0x514ab1;_0x6c300d<_0x556662[_0xddea('0x17')];_0x6c300d+=0x1){_0x514ab1=_0x556662[_0x6c300d][_0xddea('0x4e')]({'plain':!![]});_0x1f8b64[_0xddea('0x2c')](db[_0xddea('0x4f')][_0xddea('0x52')](_0x1b3996(_0x514ab1,_0xddea('0x50')))['then'](function(){})[_0xddea('0x53')](_0x11cc09()));}}return _0x1f8b64;})['all']();})[_0xddea('0x2b')](function(){return db[_0xddea('0x57')][_0xddea('0x4a')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db['CmList'],'as':'Lists','where':{'id':LISTID}}]})[_0xddea('0x2b')](function(_0x22629b){var _0x1f8e8c=[];if(_0x22629b){for(var _0x460b75=0x0,_0x2d2da2;_0x460b75<_0x22629b[_0xddea('0x17')];_0x460b75+=0x1){_0x2d2da2=_0x22629b[_0x460b75][_0xddea('0x4e')]({'plain':!![]});switch(_0x2d2da2[_0xddea('0x4c')]){case _0xddea('0x58'):_0x1f8e8c[_0xddea('0x2c')](db[_0xddea('0x4f')][_0xddea('0x52')](_0x3311b0(_0x2d2da2,_0xddea('0x59')))[_0xddea('0x2b')](function(){})[_0xddea('0x53')](_0x11cc09()));break;case _0xddea('0x51'):_0x1f8e8c[_0xddea('0x2c')](db[_0xddea('0x4f')][_0xddea('0x52')](_0x3c3f8c(_0x2d2da2,'CampaignId'))['then'](function(){})[_0xddea('0x53')](_0x11cc09()));break;default:_0x1f8e8c[_0xddea('0x2c')](db[_0xddea('0x4f')]['query'](_0x810f6d(_0x2d2da2,_0xddea('0x59')))['then'](function(){})[_0xddea('0x53')](_0x11cc09()));}}}return _0x1f8e8c;})[_0xddea('0x54')]();})[_0xddea('0x2b')](function(){return db[_0xddea('0x57')]['findAll']({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0xddea('0x56'),'where':{'id':LISTID}}]})[_0xddea('0x2b')](function(_0x1bde43){var _0x3f5027=[];if(_0x1bde43){for(var _0x5a4654=0x0,_0x464b1a;_0x5a4654<_0x1bde43[_0xddea('0x17')];_0x5a4654+=0x1){_0x464b1a=_0x1bde43[_0x5a4654][_0xddea('0x4e')]({'plain':!![]});_0x3f5027['push'](db[_0xddea('0x4f')][_0xddea('0x52')](_0x1b3996(_0x464b1a,_0xddea('0x59')))[_0xddea('0x2b')](function(){})[_0xddea('0x53')](_0x11cc09()));}}return _0x3f5027;})[_0xddea('0x54')]();})['catch'](function(_0x193f62){logger[_0xddea('0x13')]('cmContact,\x20%s,\x20%s','generalCheckHopper',_0x193f62[_0xddea('0x18')]);});}var processPromises=function(_0x1aef20){return BPromise[_0xddea('0x54')](promises)[_0xddea('0x2b')](function(_0x2089f9){})['catch'](function(_0x116a4a){logger[_0xddea('0x13')](_0xddea('0x5a'),JSON[_0xddea('0x2d')](_0x116a4a));})[_0xddea('0x5b')](function(){socket[_0xddea('0x5c')](_0xddea('0x5d')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x1aef20){return _0x1aef20[_0xddea('0x5e')]();}});};var endCsv=function(){return BPromise[_0xddea('0x5f')]()['then'](function(){if(hopperContacts){return checkHopper();}})[_0xddea('0x2b')](function(){socket[_0xddea('0x5c')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x137269){logger[_0xddea('0x13')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0xddea('0x2d')](_0x137269));}finally{process[_0xddea('0x60')](0x0);}});};process['on'](_0xddea('0x61'),function(){logger[_0xddea('0x62')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0xddea('0x5f')]()[_0xddea('0x2b')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db['CmContact'][_0xddea('0x4a')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xddea('0x2b')](function(_0x5a3a9f){var _0x4a3251=fs[_0xddea('0x63')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x4a3251,{'header':!![],'skipEmptyLines':!![],'step':function(_0x4df4a0,_0x39e37b){total+=0x1;var _0x3fca93=total;promises[_0xddea('0x2c')](checkRow(_0x4df4a0,_0x5a3a9f,_0x3fca93)[_0xddea('0x2b')](function(){success+=0x1;})[_0xddea('0x53')](function(_0x3a70a9){if(_0x3a70a9[_0xddea('0x13')]){errors+=0x1;delete _0x3a70a9[_0xddea('0x13')];}else if(_0x3a70a9[_0xddea('0x26')]){duplicates+=0x1;delete _0x3a70a9[_0xddea('0x26')];}rows[_0xddea('0x2c')](_0x3a70a9);}));if(total%0xc8===0x0){_0x39e37b[_0xddea('0x64')]();return processPromises(_0x39e37b);}},'complete':function(){return processPromises()[_0xddea('0x2b')](function(){logger['info']('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x26c1fe,_0x498976){logger['info']('CSV\x20parse\x20error',JSON[_0xddea('0x2d')](_0x26c1fe));endCsv();}});})[_0xddea('0x53')](function(_0x582c4a){logger[_0xddea('0x13')](_0xddea('0x65'),JSON[_0xddea('0x2d')](_0x582c4a));});}main(); \ No newline at end of file +var _0xc65c=['Error\x20while\x20creating\x20contact:\x20','checkHopper','inspect','insert','cm_hopper','scheduledAt','createdAt','updatedAt','select','field','NOW()','ContactId','toString','cm_contacts','where','deletedAt\x20IS\x20NULL','from','\x20=\x20?','into','ListId\x20=\x20?','str','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','id\x20IN\x20?','cm_hopper_black','fromQuery','VoiceQueue','findAll','outbound','Lists','get','dialCheckDuplicateType','push','sequelize','VoiceQueueId','query','CmList','BlackLists','all','always','CampaignId','cmContact,\x20%s,\x20%s','finally','contact:csv_','resolve','emit','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','createReadStream','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','stringify','bluebird','util','lodash','papaparse','ioredis','../../../config/environment','../../../config/logger','api','redis','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','index','test','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','hasOwnProperty','data','firstName','phone','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','ListId','CompanyId','find','duplicate','CmContact','create','keys','then','pick','catch'];(function(_0x477243,_0x11bcb7){var _0xd13863=function(_0x19c56f){while(--_0x19c56f){_0x477243['push'](_0x477243['shift']());}};_0xd13863(++_0x11bcb7);}(_0xc65c,0x17c));var _0xcc65=function(_0x51bf25,_0x515b49){_0x51bf25=_0x51bf25-0x0;var _0x20ecca=_0xc65c[_0x51bf25];return _0x20ecca;};'use strict';var BPromise=require(_0xcc65('0x0'));var util=require(_0xcc65('0x1'));var _=require(_0xcc65('0x2'));var fs=require('fs');var squel=require('squel');var Papa=require(_0xcc65('0x3'));var Redis=require(_0xcc65('0x4'));var db=require('../../../mysqldb')['db'];var config=require(_0xcc65('0x5'));var logger=require(_0xcc65('0x6'))(_0xcc65('0x7'));config[_0xcc65('0x8')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xcc65('0x9'))(new Redis(config['redis']));require(_0xcc65('0xa'))[_0xcc65('0xb')](socket);try{if(!process[_0xcc65('0xc')][0x2]||process[_0xcc65('0xc')][0x2]===_0xcc65('0xd')||process[_0xcc65('0xc')][0x2]===_0xcc65('0xe')){throw new Error(_0xcc65('0xf'));}var FILEPATH=process['argv'][0x2];if(!process[_0xcc65('0xc')][0x3]||process[_0xcc65('0xc')][0x3]===_0xcc65('0xd')||process[_0xcc65('0xc')][0x3]===_0xcc65('0xe')||!process[_0xcc65('0xc')][0x4]||process[_0xcc65('0xc')][0x4]===_0xcc65('0xd')||process['argv'][0x4]===_0xcc65('0xe')){throw new Error(_0xcc65('0x10'));}var FIELDS=_[_0xcc65('0x11')](process[_0xcc65('0xc')][0x3][_0xcc65('0x12')](','),process[_0xcc65('0xc')][0x4][_0xcc65('0x12')](','));if(!process['argv'][0x5]||process[_0xcc65('0xc')][0x5]===_0xcc65('0xd')||process['argv'][0x5]==='null'){throw new Error(_0xcc65('0x13'));}var LISTID=process[_0xcc65('0xc')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0xcc65('0xc')][0x6]!=='undefined'&&process['argv'][0x6]!==_0xcc65('0xe')?process[_0xcc65('0xc')][0x6]:null;var DUPLICATES=process[_0xcc65('0xc')][0x7]&&process[_0xcc65('0xc')][0x7]!=='undefined'&&process['argv'][0x7]!==_0xcc65('0xe')?process[_0xcc65('0xc')][0x7]:null;if(!process['argv'][0x8]||process[_0xcc65('0xc')][0x8]===_0xcc65('0xd')||process[_0xcc65('0xc')][0x8]==='null'){throw new Error(_0xcc65('0x14'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x94ff7e){logger[_0xcc65('0x15')](_0x94ff7e);endCsv();}var total=0x0;var pTotal=0x0;var success=0x0;var errors=0x0;var duplicates=0x0;var rows=[];var hopperContacts='';var promises=[];var index=0x0;var alreadyInvalid=![];function handleCheckRowError(_0x3d9159,_0x504fb3,_0x23d088,_0x8c8479){var _0x137487={'message':_0x504fb3};_0x137487[_0x3d9159]=!![];if(_0x23d088){_0x137487['contact']=_0x23d088;}if(_0x8c8479){_0x137487[_0xcc65('0x16')]=_0x8c8479;}return _0x137487;}function isEmail(_0x59b116){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0xcc65('0x17')](_0x59b116);}function checkRow(_0x10e404,_0x2fb73f,_0x4f8ac6){return new BPromise(function(_0x285e5d,_0x299c19){if(_['isNil'](_0x10e404)){return _0x299c19(handleCheckRowError('error',_0xcc65('0x18'),null,_0x4f8ac6));}if(_0x10e404[_0xcc65('0x19')]&&_0x10e404[_0xcc65('0x19')][_0xcc65('0x1a')]){var _0x3dfc86=_[_0xcc65('0x1b')](_0x10e404[_0xcc65('0x19')],_0xcc65('0x1c'))['join'](';');return _0x299c19(handleCheckRowError('error',_0x3dfc86,null,_0x4f8ac6));}var _0x3f10ff={};for(var _0x5c9ac5 in FIELDS){if(FIELDS[_0xcc65('0x1d')](_0x5c9ac5)&&FIELDS[_0x5c9ac5]){_0x3f10ff[_0x5c9ac5]=_0x10e404[_0xcc65('0x1e')][0x0][FIELDS[_0x5c9ac5]]||_0x10e404[_0xcc65('0x1e')][0x0]['\ufeff'+FIELDS[_0x5c9ac5]];}}if(!_0x3f10ff[_0xcc65('0x1f')]){return _0x299c19(handleCheckRowError(_0xcc65('0x15'),'firstName\x20not\x20specified!',null,_0x4f8ac6));}if(!_0x3f10ff[_0xcc65('0x20')]){return _0x299c19(handleCheckRowError(_0xcc65('0x15'),'phone\x20not\x20specified!',null,_0x4f8ac6));}if(_0x3f10ff[_0xcc65('0x21')]){var _0x8547ea=moment(_0x3f10ff[_0xcc65('0x21')],_0xcc65('0x22'));if(!_0x8547ea[_0xcc65('0x23')]()){return _0x299c19(handleCheckRowError(_0xcc65('0x15'),_0xcc65('0x24'),null,_0x4f8ac6));}}if(_0x3f10ff['email']){if(!isEmail(_0x3f10ff[_0xcc65('0x25')])){return _0x299c19(handleCheckRowError(_0xcc65('0x15'),'email\x20format\x20is\x20not\x20valid!',null,_0x4f8ac6));}}_0x3f10ff[_0xcc65('0x26')]=LISTID;_0x3f10ff[_0xcc65('0x27')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xcc65('0x1a')]&&_0x2fb73f){var _0x24e90b={};for(var _0x51eeec=0x0,_0x2f2a41=DUPLICATES[_0xcc65('0x1a')];_0x51eeec<_0x2f2a41;_0x51eeec+=0x1){_0x24e90b[DUPLICATES[_0x51eeec]]=_0x3f10ff[DUPLICATES[_0x51eeec]];}var _0x23aa00=_[_0xcc65('0x28')](_0x2fb73f,_0x24e90b);if(_0x23aa00){return _0x299c19(handleCheckRowError(_0xcc65('0x29'),'Duplicate\x20Contact',_0x23aa00,_0x4f8ac6));}}return db[_0xcc65('0x2a')][_0xcc65('0x2b')](_0x3f10ff,{'raw':!![],'hooks':![],'fields':_[_0xcc65('0x2c')](_0x3f10ff)})[_0xcc65('0x2d')](function(_0x42aba5){if(DUPLICATES&&DUPLICATES[_0xcc65('0x1a')]&&_0x2fb73f){_0x2fb73f['push'](_[_0xcc65('0x2e')](_0x3f10ff,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x42aba5['id'];return _0x285e5d();})[_0xcc65('0x2f')](function(_0x2d3904){return _0x299c19(handleCheckRowError('error',_0xcc65('0x30')+(_0x2d3904[_0xcc65('0x1c')]||JSON['stringify'](_0x2d3904)),null,_0x4f8ac6));});});}function checkHopper(){function _0x459f58(){return function(_0xfd15e){logger[_0xcc65('0x15')]('cmContact',_0xcc65('0x31'),util[_0xcc65('0x32')](_0xfd15e,{'showHidden':![],'depth':null}));};}var _0xbedf8b=function(_0xf08aa,_0x5cbbd6){var _0x3182cf=squel[_0xcc65('0x33')]()['into'](_0xcc65('0x34'))['fromQuery']([_0xcc65('0x20'),_0xcc65('0x35'),'ContactId',_0xcc65('0x26'),_0x5cbbd6,_0xcc65('0x36'),_0xcc65('0x37')],squel[_0xcc65('0x38')]()[_0xcc65('0x39')](_0xcc65('0x20'),_0xcc65('0x20'))[_0xcc65('0x39')](_0xcc65('0x3a'),_0xcc65('0x35'))['field']('id',_0xcc65('0x3b'))[_0xcc65('0x39')](LISTID[_0xcc65('0x3c')](),_0xcc65('0x26'))[_0xcc65('0x39')](_0xf08aa['id']['toString'](),_0x5cbbd6)[_0xcc65('0x39')](_0xcc65('0x3a'),'createdAt')[_0xcc65('0x39')]('NOW()',_0xcc65('0x37'))['from'](_0xcc65('0x3d'))[_0xcc65('0x3e')](_0xcc65('0x3f'))[_0xcc65('0x3e')]('ListId\x20=\x20?',LISTID[_0xcc65('0x3c')]())[_0xcc65('0x3e')]('phone\x20IS\x20NOT\x20NULL')[_0xcc65('0x3e')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xcc65('0x39')](_0xcc65('0x20'))[_0xcc65('0x40')](_0xcc65('0x34'))[_0xcc65('0x3e')](_0x5cbbd6+_0xcc65('0x41'),_0xf08aa['id'][_0xcc65('0x3c')]())))['toString']();return _0x3182cf;};var _0x3b21a9=function(_0x4626cb,_0x41976d){var _0x300302=squel['insert']()[_0xcc65('0x42')](_0xcc65('0x34'))['fromQuery']([_0xcc65('0x20'),_0xcc65('0x35'),_0xcc65('0x3b'),_0xcc65('0x26'),_0x41976d,_0xcc65('0x36'),_0xcc65('0x37')],squel['select']()[_0xcc65('0x39')](_0xcc65('0x20'),_0xcc65('0x20'))[_0xcc65('0x39')](_0xcc65('0x3a'),_0xcc65('0x35'))[_0xcc65('0x39')]('id',_0xcc65('0x3b'))[_0xcc65('0x39')](LISTID[_0xcc65('0x3c')](),_0xcc65('0x26'))[_0xcc65('0x39')](_0x4626cb['id'][_0xcc65('0x3c')](),_0x41976d)[_0xcc65('0x39')]('NOW()',_0xcc65('0x36'))[_0xcc65('0x39')](_0xcc65('0x3a'),_0xcc65('0x37'))[_0xcc65('0x40')]('cm_contacts')['where'](_0xcc65('0x3f'))['where'](_0xcc65('0x43'),LISTID['toString']())[_0xcc65('0x3e')]('id\x20IN\x20?',squel[_0xcc65('0x44')](hopperContacts))['where'](_0xcc65('0x45'))[_0xcc65('0x3e')](_0xcc65('0x46'),squel[_0xcc65('0x38')]()[_0xcc65('0x39')](_0xcc65('0x47'))['from'](_0xcc65('0x48'))[_0xcc65('0x3e')](_0x41976d+'\x20=\x20?',_0x4626cb['id'][_0xcc65('0x3c')]()))[_0xcc65('0x3e')](_0xcc65('0x46'),squel[_0xcc65('0x38')]()[_0xcc65('0x39')](_0xcc65('0x20'))[_0xcc65('0x40')](_0xcc65('0x34'))[_0xcc65('0x3e')](_0x41976d+_0xcc65('0x41'),_0x4626cb['id']['toString']())))[_0xcc65('0x3c')]();return _0x300302;};function _0x40a0a2(_0x241f49,_0x2aaa7f){var _0x422b91=squel[_0xcc65('0x33')]()['into']('cm_hopper')['fromQuery'](['phone',_0xcc65('0x35'),_0xcc65('0x3b'),_0xcc65('0x26'),_0x2aaa7f,'createdAt',_0xcc65('0x37')],squel['select']()[_0xcc65('0x39')](_0xcc65('0x20'),'phone')[_0xcc65('0x39')](_0xcc65('0x3a'),_0xcc65('0x35'))[_0xcc65('0x39')]('id',_0xcc65('0x3b'))[_0xcc65('0x39')](LISTID[_0xcc65('0x3c')](),_0xcc65('0x26'))[_0xcc65('0x39')](_0x241f49['id']['toString'](),_0x2aaa7f)[_0xcc65('0x39')](_0xcc65('0x3a'),_0xcc65('0x36'))['field'](_0xcc65('0x3a'),_0xcc65('0x37'))[_0xcc65('0x40')](_0xcc65('0x3d'))[_0xcc65('0x3e')](_0xcc65('0x3f'))[_0xcc65('0x3e')](_0xcc65('0x43'),LISTID[_0xcc65('0x3c')]())[_0xcc65('0x3e')](_0xcc65('0x49'),squel[_0xcc65('0x44')](hopperContacts))[_0xcc65('0x3e')](_0xcc65('0x45')))[_0xcc65('0x3c')]();return _0x422b91;}function _0x21ece3(_0x8a4b74,_0x1884a6){var _0x3d8102=squel[_0xcc65('0x33')]()[_0xcc65('0x42')](_0xcc65('0x4a'))[_0xcc65('0x4b')](['phone','ContactId',_0xcc65('0x26'),_0x1884a6,'createdAt',_0xcc65('0x37')],squel[_0xcc65('0x38')]()[_0xcc65('0x39')]('phone',_0xcc65('0x20'))[_0xcc65('0x39')]('id',_0xcc65('0x3b'))[_0xcc65('0x39')](LISTID[_0xcc65('0x3c')](),_0xcc65('0x26'))[_0xcc65('0x39')](_0x8a4b74['id'][_0xcc65('0x3c')](),_0x1884a6)[_0xcc65('0x39')](_0xcc65('0x3a'),_0xcc65('0x36'))['field'](_0xcc65('0x3a'),_0xcc65('0x37'))[_0xcc65('0x40')](_0xcc65('0x3d'))[_0xcc65('0x3e')]('deletedAt\x20IS\x20NULL')['where'](_0xcc65('0x43'),LISTID[_0xcc65('0x3c')]())[_0xcc65('0x3e')](_0xcc65('0x49'),squel['str'](hopperContacts))['where'](_0xcc65('0x45')))[_0xcc65('0x3c')]();return _0x3d8102;}return db[_0xcc65('0x4c')][_0xcc65('0x4d')]({'where':{'type':_0xcc65('0x4e')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db['CmList'],'as':_0xcc65('0x4f'),'where':{'id':LISTID}}]})[_0xcc65('0x2d')](function(_0x342651){var _0x1c5429=[];if(_0x342651){var _0x5ebe2e;for(var _0x1ee652=0x0,_0x97b92;_0x1ee652<_0x342651[_0xcc65('0x1a')];_0x1ee652+=0x1){_0x97b92=_0x342651[_0x1ee652][_0xcc65('0x50')]({'plain':!![]});switch(_0x97b92[_0xcc65('0x51')]){case'always':_0x1c5429[_0xcc65('0x52')](db[_0xcc65('0x53')]['query'](_0x3b21a9(_0x97b92,_0xcc65('0x54')))[_0xcc65('0x2d')](function(){})[_0xcc65('0x2f')](_0x459f58()));break;case'onlyIfOpen':_0x1c5429[_0xcc65('0x52')](db[_0xcc65('0x53')][_0xcc65('0x55')](_0xbedf8b(_0x97b92,_0xcc65('0x54')))[_0xcc65('0x2d')](function(){})[_0xcc65('0x2f')](_0x459f58()));break;default:_0x1c5429[_0xcc65('0x52')](db[_0xcc65('0x53')][_0xcc65('0x55')](_0x40a0a2(_0x97b92,'VoiceQueueId'))[_0xcc65('0x2d')](function(){})['catch'](_0x459f58()));}}}return _0x1c5429;})['all']()[_0xcc65('0x2d')](function(){return db[_0xcc65('0x4c')][_0xcc65('0x4d')]({'where':{'type':_0xcc65('0x4e')},'attributes':['id'],'include':[{'model':db[_0xcc65('0x56')],'as':_0xcc65('0x57'),'where':{'id':LISTID}}]})[_0xcc65('0x2d')](function(_0x121902){var _0x2544d5=[];if(_0x121902){var _0xf510a6;for(var _0x1b762=0x0,_0x29d055;_0x1b762<_0x121902[_0xcc65('0x1a')];_0x1b762+=0x1){_0x29d055=_0x121902[_0x1b762][_0xcc65('0x50')]({'plain':!![]});_0x2544d5['push'](db[_0xcc65('0x53')]['query'](_0x21ece3(_0x29d055,_0xcc65('0x54')))[_0xcc65('0x2d')](function(){})[_0xcc65('0x2f')](_0x459f58()));}}return _0x2544d5;})[_0xcc65('0x58')]();})['then'](function(){return db['Campaign'][_0xcc65('0x4d')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0xcc65('0x56')],'as':_0xcc65('0x4f'),'where':{'id':LISTID}}]})[_0xcc65('0x2d')](function(_0x4a6507){var _0x479fa6=[];if(_0x4a6507){for(var _0x4f77fe=0x0,_0x2c2c2e;_0x4f77fe<_0x4a6507[_0xcc65('0x1a')];_0x4f77fe+=0x1){_0x2c2c2e=_0x4a6507[_0x4f77fe][_0xcc65('0x50')]({'plain':!![]});switch(_0x2c2c2e['dialCheckDuplicateType']){case _0xcc65('0x59'):_0x479fa6[_0xcc65('0x52')](db['sequelize']['query'](_0x3b21a9(_0x2c2c2e,'CampaignId'))['then'](function(){})[_0xcc65('0x2f')](_0x459f58()));break;case'onlyIfOpen':_0x479fa6[_0xcc65('0x52')](db[_0xcc65('0x53')]['query'](_0xbedf8b(_0x2c2c2e,_0xcc65('0x5a')))[_0xcc65('0x2d')](function(){})['catch'](_0x459f58()));break;default:_0x479fa6[_0xcc65('0x52')](db[_0xcc65('0x53')][_0xcc65('0x55')](_0x40a0a2(_0x2c2c2e,_0xcc65('0x5a')))['then'](function(){})[_0xcc65('0x2f')](_0x459f58()));}}}return _0x479fa6;})['all']();})['then'](function(){return db['Campaign'][_0xcc65('0x4d')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0xcc65('0x57'),'where':{'id':LISTID}}]})['then'](function(_0x2102c4){var _0x279e31=[];if(_0x2102c4){for(var _0x554555=0x0,_0x27e415;_0x554555<_0x2102c4['length'];_0x554555+=0x1){_0x27e415=_0x2102c4[_0x554555][_0xcc65('0x50')]({'plain':!![]});_0x279e31[_0xcc65('0x52')](db[_0xcc65('0x53')]['query'](_0x21ece3(_0x27e415,_0xcc65('0x5a')))[_0xcc65('0x2d')](function(){})[_0xcc65('0x2f')](_0x459f58()));}}return _0x279e31;})[_0xcc65('0x58')]();})['catch'](function(_0x3c8298){logger[_0xcc65('0x15')](_0xcc65('0x5b'),'generalCheckHopper',_0x3c8298['message']);});}var processPromises=function(_0x376ec){return BPromise[_0xcc65('0x58')](promises)['then'](function(_0xc95fee){})[_0xcc65('0x2f')](function(_0x131478){logger[_0xcc65('0x15')]('Error\x20processing\x20rows\x20block:',JSON['stringify'](_0x131478));})[_0xcc65('0x5c')](function(){socket['emit'](_0xcc65('0x5d')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x376ec){return _0x376ec['resume']();}});};var endCsv=function(){return BPromise[_0xcc65('0x5e')]()[_0xcc65('0x2d')](function(){if(hopperContacts){return checkHopper();}})[_0xcc65('0x2d')](function(){socket[_0xcc65('0x5f')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x2371fc){logger[_0xcc65('0x15')](_0xcc65('0x60'),JSON['stringify'](_0x2371fc));}finally{process[_0xcc65('0x61')](0x0);}});};process['on'](_0xcc65('0x62'),function(){logger[_0xcc65('0x63')](_0xcc65('0x64'));endCsv();});function main(){return BPromise[_0xcc65('0x5e')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xcc65('0x12')](',');return db[_0xcc65('0x2a')][_0xcc65('0x4d')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xcc65('0x2d')](function(_0xa71c24){var _0xb2d90b=fs[_0xcc65('0x65')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0xb2d90b,{'header':!![],'skipEmptyLines':!![],'step':function(_0x2337b4,_0x4f4045){total+=0x1;var _0x36d50f=total;promises[_0xcc65('0x52')](checkRow(_0x2337b4,_0xa71c24,_0x36d50f)[_0xcc65('0x2d')](function(){success+=0x1;})[_0xcc65('0x2f')](function(_0x45877d){if(_0x45877d[_0xcc65('0x15')]){errors+=0x1;delete _0x45877d[_0xcc65('0x15')];}else if(_0x45877d[_0xcc65('0x29')]){duplicates+=0x1;delete _0x45877d['duplicate'];}rows[_0xcc65('0x52')](_0x45877d);}));if(total%0xc8===0x0){_0x4f4045[_0xcc65('0x66')]();return processPromises(_0x4f4045);}},'complete':function(){return processPromises()['then'](function(){logger[_0xcc65('0x63')](_0xcc65('0x67'));endCsv();});},'error':function(_0x22bc9d,_0x3ddf8a){logger[_0xcc65('0x63')](_0xcc65('0x68'),JSON['stringify'](_0x22bc9d));endCsv();}});})['catch'](function(_0x192c3d){logger[_0xcc65('0x15')](_0xcc65('0x69'),JSON[_0xcc65('0x6a')](_0x192c3d));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 5391f3a..54fb9eb 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 _0xa7bf=['cm_contacts.priority','into','cm_hopper','fromQuery','scheduledat','ListId','createdAt','updatedAt','priority','UserId','recallme','fields','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','toString','insert','cm_hopper_black','ContactId','cm_contacts','\x20=\x20','cm_contacts.phone','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','keys','CompanyId','scheduledAt','ListId\x20=\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','min_id','group','info','Received\x20SIGINT','error','exit','errors','code','sequelize','query','message','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','spread','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','isNil','set','offset','catch','main','stringify','send','start','binding','socket_timestamp','root','server/files/tmp','.csv','includes','header','ContactItemType','name','_description','writeFileSync','parse','data','rows','find','trim','agent\x20not\x20exists','email\x20wrong\x20format','dateOfBirth','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','hasOwnProperty','replace','itemTypeId','description','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','duplicates','CREATE\x20TABLE\x20','campaigns_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','dialTimezone,utcOffset','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','DROP\x20TABLE\x20','contactId','contactTypeId','orderBy','voice_queues_has_cm_lists','VoiceQueueId','campaigns_has_cm_blacklists','CampaignId','voice_queues_has_cm_blacklists','finish','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','SIGINT','path','lodash','papaparse','util','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','redis','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','AdditionalPhones','then','length','push','all','split','filter','CmContactHasItem','findOne','update','PHONE','inserted','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt'];(function(_0x336efa,_0xd807a7){var _0x3cfafa=function(_0x3b12f9){while(--_0x3b12f9){_0x336efa['push'](_0x336efa['shift']());}};_0x3cfafa(++_0xd807a7);}(_0xa7bf,0x140));var _0xfa7b=function(_0x9bb6ad,_0x3bc83a){_0x9bb6ad=_0x9bb6ad-0x0;var _0x49c448=_0xa7bf[_0x9bb6ad];return _0x49c448;};'use strict';var fs=require('fs');var path=require(_0xfa7b('0x0'));var _=require(_0xfa7b('0x1'));var Papa=require(_0xfa7b('0x2'));var util=require(_0xfa7b('0x3'));var BPromise=require('bluebird');var moment=require(_0xfa7b('0x4'));var squel=require(_0xfa7b('0x5'));var Redis=require(_0xfa7b('0x6'));var db=require(_0xfa7b('0x7'))['db'];var config=require(_0xfa7b('0x8'));var shared=require(_0xfa7b('0x9'));var logger=require(_0xfa7b('0xa'))(_0xfa7b('0xb'));config[_0xfa7b('0xc')]=_['defaults'](config[_0xfa7b('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfa7b('0xc')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0xfa7b('0xd')](_0xfa7b('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0xfa7b('0xd')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x48e055){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))*$/[_0xfa7b('0xf')](_0x48e055);}function selectNotIn(_0x4fcc86,_0x2e94f4,_0x906929,_0x144c34,_0x169f5f){return squel[_0xfa7b('0x10')]()[_0xfa7b('0x11')](_0xfa7b('0x12'))[_0xfa7b('0x13')](_0x144c34)[_0xfa7b('0x14')](_0x2e94f4,null,_0x2e94f4+_0xfa7b('0x15')+_0x144c34+'.'+_0x906929)[_0xfa7b('0x16')](_0x144c34+'.'+_0x906929+'\x20=\x20'+_0x4fcc86+'.'+_0x906929)[_0xfa7b('0x16')](_0x2e94f4+_0xfa7b('0x17')+_0x169f5f['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x2c26de,_0x32f065){promisesAdditionalPhones=[];return db[_0xfa7b('0x18')][_0xfa7b('0x19')]({'raw':!![],'attributes':['id',_0xfa7b('0x1a')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0xfa7b('0x1b')](function(_0x1e1308){if(_0x1e1308!==null){var _0xe49f01=[];for(var _0x379839=0x0;_0x379839<_0x1e1308[_0xfa7b('0x1c')];_0x379839++){var _0x25085d=_0x1e1308[_0x379839];_0xe49f01[_0xfa7b('0x1d')](insertAdditionalPhones(_0x25085d));}}Promise[_0xfa7b('0x1e')](_0xe49f01)[_0xfa7b('0x1b')](function(){_0x2c26de({'val':0x1});});});});}function insertAdditionalPhones(_0x4e37bc){return new Promise(function(_0x153839,_0xf8d0ef){var _0x5eaba0=_0x4e37bc[_0xfa7b('0x1a')];var _0x2dae7e=_0x5eaba0[_0xfa7b('0x1f')](';');var _0x2b40f0=[];orderBy=0x0;for(var _0xe715a1=0x0;_0xe715a1<_0x2dae7e[_0xfa7b('0x1c')];_0xe715a1++){_0x2b40f0[_0xfa7b('0x1d')](splitAdditionalPhone(_0x4e37bc['id'],_0x2dae7e[_0xe715a1]));}Promise[_0xfa7b('0x1e')](_0x2b40f0)[_0xfa7b('0x1b')](function(){_0x153839({'val':_0x2dae7e[_0xfa7b('0x1c')]});});});}function splitAdditionalPhone(_0x1f5c7,_0x2d5401){return new Promise(function(_0x37eb33,_0x180e43){var _0x34cbb2=_0x2d5401[_0xfa7b('0x1f')](':');var _0x10e7bf=_0x34cbb2[0x0];var _0x1a2632=_0x34cbb2[0x1];if(!_['isNil'](_0x1a2632)){var _0x13892a=_0x1a2632[_0xfa7b('0x1f')]('|');var _0x1cc9dc=[];for(var _0x440037=0x0;_0x440037<_0x13892a[_0xfa7b('0x1c')];_0x440037++){if(_0x13892a[_0x440037]!==''){var _0xe25be4=_[_0xfa7b('0x20')](promisesAdditionalPhones,{'contactId':_0x1f5c7,'phone':_0x13892a[_0x440037]});if(_0xe25be4[_0xfa7b('0x1c')]==0x0){orderBy++;promisesAdditionalPhones[_0xfa7b('0x1d')]({'contactId':_0x1f5c7,'contactTypeId':_0x10e7bf,'phone':_0x13892a[_0x440037],'orderBy':orderBy});}}}_0x37eb33({'ok':0x1});}else _0x37eb33({'res':0x0});});}function createAdditionalPhone(_0x1a3047,_0x8b8342,_0x3e2518,_0x555204){var _0x43cc29='';var _0x1b95da='';var _0x15d530=_0x3e2518[_0xfa7b('0x1f')]('§');_0x43cc29=_0x15d530[0x0];if(_0x15d530[_0xfa7b('0x1c')]==0x2)_0x1b95da=_0x15d530[0x1];return new Promise(function(_0x129994,_0x3a22ce){return db[_0xfa7b('0x21')][_0xfa7b('0x22')]({'where':{'CmContactId':_0x1a3047,'item':_0x43cc29}})['then'](function(_0x3f8ebe){if(_0x3f8ebe){return db[_0xfa7b('0x21')][_0xfa7b('0x23')]({'ItemTypeId':_0x8b8342,'description':_0x1b95da,'OrderBy':_0x555204},{'where':{'CmContactId':_0x1a3047,'item':_0x43cc29}})['then'](function(_0x57b381){_0x129994({'res':'updated'});});}else{return db[_0xfa7b('0x21')]['create']({'CmContactId':_0x1a3047,'item':_0x43cc29,'description':_0x1b95da,'ItemTypeId':_0x8b8342,'OrderBy':_0x555204,'ItemClass':_0xfa7b('0x24')})['then'](function(_0x29a353){_0x129994({'res':_0xfa7b('0x25')});});}});});}function insertCmHopper(_0x158c90,_0x3022f6,_0x4707d1,_0x3f1d16,_0x120e83){var _0x443eb7=['cm_contacts.phone','cm_contacts.scheduledat',_0xfa7b('0x26'),_0xfa7b('0x27'),_0x3022f6+'.'+_0x3f1d16,_0xfa7b('0x28'),_0xfa7b('0x29'),_0xfa7b('0x2a'),'cm_contacts.UserId','\x22'+_0x120e83+'\x22'];return squel['insert']()[_0xfa7b('0x2b')](_0xfa7b('0x2c'))[_0xfa7b('0x2d')]([_0xfa7b('0x12'),_0xfa7b('0x2e'),'ContactId',_0xfa7b('0x2f'),_0x3f1d16,_0xfa7b('0x30'),_0xfa7b('0x31'),_0xfa7b('0x32'),_0xfa7b('0x33'),_0xfa7b('0x34')],squel[_0xfa7b('0x10')]()[_0xfa7b('0x35')](_0x443eb7)['from'](_0x3022f6)[_0xfa7b('0x14')]('cm_contacts',null,_0xfa7b('0x36')+_0x3022f6+_0xfa7b('0x37'))[_0xfa7b('0x14')](_0x4707d1,null,_0x4707d1+'.id\x20=\x20'+_0x3022f6+'.'+_0x3f1d16)[_0xfa7b('0x16')](_0x3022f6+_0xfa7b('0x38'),_0x158c90)[_0xfa7b('0x16')](_0xfa7b('0x39'),NOW)[_0xfa7b('0x16')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x3022f6,_0x4707d1,_0x3f1d16,_0xfa7b('0x2c'),[_0xfa7b('0x3a'),_0xfa7b('0x3b')]))[_0xfa7b('0x16')](_0xfa7b('0x3c'),selectNotIn(_0x3022f6,_0x4707d1,_0x3f1d16,'cm_hopper',[_0xfa7b('0x3a')])))[_0xfa7b('0x3d')]();}function insertCmHopperBlack(_0x3dcdce,_0x1c1b5d,_0x53d44b,_0x480a5c){var _0x2d97ba=['cm_contacts.phone',_0xfa7b('0x26'),'cm_contacts.ListId',_0x1c1b5d+'.'+_0x480a5c,'cm_contacts.createdAt',_0xfa7b('0x29')];return squel[_0xfa7b('0x3e')]()[_0xfa7b('0x2b')](_0xfa7b('0x3f'))['fromQuery']([_0xfa7b('0x12'),_0xfa7b('0x40'),_0xfa7b('0x2f'),_0x480a5c,_0xfa7b('0x30'),'updatedAt'],squel[_0xfa7b('0x10')]()[_0xfa7b('0x35')](_0x2d97ba)['from'](_0x1c1b5d)[_0xfa7b('0x14')](_0xfa7b('0x41'),null,'cm_contacts.ListId\x20=\x20'+_0x1c1b5d+'.CmListId')[_0xfa7b('0x14')](_0x53d44b,null,_0x53d44b+'.id\x20=\x20'+_0x1c1b5d+'.'+_0x480a5c)[_0xfa7b('0x16')](_0x1c1b5d+_0xfa7b('0x38'),_0x3dcdce)[_0xfa7b('0x16')](_0xfa7b('0x39'),NOW)[_0xfa7b('0x16')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0xfa7b('0x10')]()[_0xfa7b('0x11')]('phone')[_0xfa7b('0x13')](_0xfa7b('0x3f'))[_0xfa7b('0x16')]('ListId\x20=\x20?',_0x3dcdce)[_0xfa7b('0x16')](_0x480a5c+_0xfa7b('0x42')+_0x1c1b5d+'.'+_0x480a5c)))[_0xfa7b('0x3d')]();}function insertTzCmHopper(_0x7bffbf,_0x219ea0,_0x39140c,_0x2b6007,_0x468315,_0x113a78){var _0x26be99=[_0xfa7b('0x43'),_0xfa7b('0x44')+_0x113a78+_0xfa7b('0x45'),_0xfa7b('0x26'),_0xfa7b('0x27'),_0x219ea0+'.'+_0x2b6007,_0xfa7b('0x28'),_0xfa7b('0x29'),'cm_contacts.priority','cm_contacts.UserId','\x22'+_0x468315+'\x22'];var _0x16ba38=squel['insert']()[_0xfa7b('0x2b')](_0xfa7b('0x2c'))[_0xfa7b('0x2d')]([_0xfa7b('0x12'),_0xfa7b('0x2e'),_0xfa7b('0x40'),_0xfa7b('0x2f'),_0x2b6007,_0xfa7b('0x30'),_0xfa7b('0x31'),'priority',_0xfa7b('0x33'),'recallme'],squel['select']()['fields'](_0x26be99)[_0xfa7b('0x13')](_0x219ea0)['join'](_0xfa7b('0x41'),null,'cm_contacts.ListId\x20=\x20'+_0x219ea0+_0xfa7b('0x37'))[_0xfa7b('0x14')](_0x39140c,null,_0x39140c+_0xfa7b('0x15')+_0x219ea0+'.'+_0x2b6007)[_0xfa7b('0x14')](_0x113a78,null,_0x113a78+_0xfa7b('0x15')+_0x219ea0+'.'+_0x2b6007)['where'](_0x219ea0+_0xfa7b('0x38'),_0x7bffbf)[_0xfa7b('0x16')](_0xfa7b('0x39'),NOW)[_0xfa7b('0x16')](_0xfa7b('0x3c'),selectNotIn(_0x219ea0,_0x39140c,_0x2b6007,'cm_hopper',[_0xfa7b('0x3a'),_0xfa7b('0x3b')]))[_0xfa7b('0x16')](_0xfa7b('0x3c'),selectNotIn(_0x219ea0,_0x39140c,_0x2b6007,_0xfa7b('0x2c'),[_0xfa7b('0x3a')])))[_0xfa7b('0x3d')]();return _0x16ba38;}function insertTzCmHopperBlack(_0x28e96b,_0x46cf46,_0x5e3a7f,_0x1df92b){var _0x494f8e=['cm_contacts.phone',_0xfa7b('0x26'),_0xfa7b('0x27'),_0x46cf46+'.'+_0x1df92b,_0xfa7b('0x28'),_0xfa7b('0x29')];return squel[_0xfa7b('0x3e')]()[_0xfa7b('0x2b')](_0xfa7b('0x3f'))[_0xfa7b('0x2d')]([_0xfa7b('0x12'),_0xfa7b('0x40'),_0xfa7b('0x2f'),_0x1df92b,'createdAt',_0xfa7b('0x31')],squel[_0xfa7b('0x10')]()[_0xfa7b('0x35')](_0x494f8e)[_0xfa7b('0x13')](_0x46cf46)[_0xfa7b('0x14')](_0xfa7b('0x41'),null,_0xfa7b('0x36')+_0x46cf46+_0xfa7b('0x37'))[_0xfa7b('0x14')](_0x5e3a7f,null,_0x5e3a7f+'.id\x20=\x20'+_0x46cf46+'.'+_0x1df92b)[_0xfa7b('0x16')](_0x46cf46+_0xfa7b('0x38'),_0x28e96b)[_0xfa7b('0x16')](_0xfa7b('0x39'),NOW)['where'](_0xfa7b('0x3c'),squel['select']()[_0xfa7b('0x11')]('phone')[_0xfa7b('0x13')]('cm_hopper_black')['where']('ListId\x20=\x20?',_0x28e96b)['where'](_0x1df92b+_0xfa7b('0x42')+_0x46cf46+'.'+_0x1df92b)))[_0xfa7b('0x3d')]();}function insertCmHopperAdditionalPhones(_0x53f9c6){var _0x2fafbc=[_0xfa7b('0x46'),_0xfa7b('0x47'),_0xfa7b('0x48'),_0xfa7b('0x49'),_0xfa7b('0x4a')];return squel[_0xfa7b('0x3e')]()[_0xfa7b('0x2b')](_0xfa7b('0x4b'))[_0xfa7b('0x2d')]([_0xfa7b('0x4c'),_0xfa7b('0x12'),_0xfa7b('0x4d'),_0xfa7b('0x30'),_0xfa7b('0x31')],squel['select']()[_0xfa7b('0x35')](_0x2fafbc)[_0xfa7b('0x13')](_0xfa7b('0x2c'))[_0xfa7b('0x14')]('cm_contacts',null,_0xfa7b('0x4e'))[_0xfa7b('0x14')](_0xfa7b('0x4f'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0xfa7b('0x16')]('cm_hopper.ListId\x20=\x20?',_0x53f9c6)['where'](_0xfa7b('0x39'),NOW))[_0xfa7b('0x3d')]();}function insertCmContact(_0xed51b4,_0x21cf13,_0x40c7e8,_0x55bfc4){var _0x30a85c=_['concat'](_[_0xfa7b('0x50')](_0x55bfc4),[_0xfa7b('0x2f'),_0xfa7b('0x51'),_0xfa7b('0x30'),_0xfa7b('0x31'),_0xfa7b('0x52')]);return squel[_0xfa7b('0x3e')]()[_0xfa7b('0x2b')]('cm_contacts')['fromQuery'](_0x30a85c,squel[_0xfa7b('0x10')]()['fields'](_0x30a85c)[_0xfa7b('0x13')](_0x21cf13)[_0xfa7b('0x16')]('('+_0x40c7e8[_0xfa7b('0x14')](',')+')\x20NOT\x20IN\x20?',squel[_0xfa7b('0x10')]()[_0xfa7b('0x35')](_0x40c7e8)[_0xfa7b('0x13')](_0xfa7b('0x41'))[_0xfa7b('0x16')](_0xfa7b('0x53'),_0xed51b4)[_0xfa7b('0x16')](_0xfa7b('0x54')))[_0xfa7b('0x16')](_0xfa7b('0x55'),squel['select']()[_0xfa7b('0x11')]('MIN(id)',_0xfa7b('0x56'))['from'](_0x21cf13)[_0xfa7b('0x57')](_0x40c7e8['join'](','))))[_0xfa7b('0x3d')]();}function handleStop(){logger[_0xfa7b('0x58')](_0xfa7b('0x59'));stopped=!![];}function handleUncaughtException(_0x4dcb46){logger[_0xfa7b('0x5a')](_0x4dcb46['message']);process[_0xfa7b('0x5b')](0x1);}function handleError(_0x5d6c37,_0x3bfac8){stats[_0xfa7b('0x5c')]['push']({'name':_0x3bfac8[_0xfa7b('0x5d')],'message':_0x3bfac8['message'],'row':_0x5d6c37});}function handleQuery(_0x556878){logger['info'](_0x556878);return db[_0xfa7b('0x5e')][_0xfa7b('0x5f')](_0x556878)['spread'](function(_0x1f4e90){results[_0xfa7b('0x1d')](_0x1f4e90);})['catch'](function(_0xd3cc10){logger[_0xfa7b('0x5a')](_0xd3cc10[_0xfa7b('0x60')]);});}function updateTzCampaigns(_0x45ed21){return new Promise(function(_0x3b5da1,_0x9f1563){var _0x4899f6=squel[_0xfa7b('0x10')]()['fields']([_0xfa7b('0x61'),_0xfa7b('0x62')])[_0xfa7b('0x13')](_0xfa7b('0x63'))[_0xfa7b('0x14')](_0xfa7b('0x64'),null,_0xfa7b('0x65'))[_0xfa7b('0x16')](_0xfa7b('0x66')+_0x45ed21);db['sequelize'][_0xfa7b('0x5f')](_0x4899f6[_0xfa7b('0x3d')]())[_0xfa7b('0x67')](function(_0x4ede5b){var _0x46afdf=[];for(var _0x1d0382=0x0;_0x1d0382<_0x4ede5b['length'];_0x1d0382++){_0x46afdf[_0xfa7b('0x1d')](getTimezoneData(_0x4ede5b[_0x1d0382],tmp_campaigns));}BPromise[_0xfa7b('0x1e')](_0x46afdf)[_0xfa7b('0x1b')](function(){_0x3b5da1({'val':0x1});});})['catch'](function(_0x310351){logger[_0xfa7b('0x5a')](_0x310351[_0xfa7b('0x60')]);_0x3b5da1({'val':0x0});});});}function updateTzVoiceQueues(_0x1a4402){return new Promise(function(_0x58ee2f,_0x4de69e){var _0x3090d0=squel[_0xfa7b('0x10')]()['fields']([_0xfa7b('0x68'),_0xfa7b('0x69')])['from'](_0xfa7b('0x6a'))[_0xfa7b('0x14')]('voice_queues_has_cm_lists',null,_0xfa7b('0x6b'))[_0xfa7b('0x16')](_0xfa7b('0x6c')+_0x1a4402);db[_0xfa7b('0x5e')][_0xfa7b('0x5f')](_0x3090d0[_0xfa7b('0x3d')]())[_0xfa7b('0x67')](function(_0x19699e){var _0x62cd8b=[];for(var _0x24af66=0x0;_0x24af66<_0x19699e['length'];_0x24af66++){_0x62cd8b[_0xfa7b('0x1d')](getTimezoneData(_0x19699e[_0x24af66],tmp_voice_queues));}BPromise['all'](_0x62cd8b)[_0xfa7b('0x1b')](function(){_0x58ee2f({'val':0x1});});})['catch'](function(_0xe4c8ad){logger['error'](_0xe4c8ad['message']);_0x58ee2f({'val':0x0});});});}function getTimezoneData(_0x353b77,_0x7b8ff8){return new Promise(function(_0x1b6fdc,_0x380cc4){var _0xb657c1=shared[_0xfa7b('0x6d')];var _0x5155b6=_0xb657c1[_0x353b77[_0xfa7b('0x6e')]];if(_[_0xfa7b('0x6f')](_0x5155b6)){_0x1b6fdc({'ret':0x1});}else{var _0x5dc07a=_0x5155b6['utcOffset'];var _0x892f0e=squel[_0xfa7b('0x3e')]()[_0xfa7b('0x2b')](_0x7b8ff8)[_0xfa7b('0x70')]('id',_0x353b77['id'])[_0xfa7b('0x70')](_0xfa7b('0x71'),_0x5dc07a)[_0xfa7b('0x70')](_0xfa7b('0x6e'),_0x353b77[_0xfa7b('0x6e')])['toString']();return db[_0xfa7b('0x5e')][_0xfa7b('0x5f')](_0x892f0e)[_0xfa7b('0x67')](function(_0x1977fa){_0x1b6fdc({'ret':0x1});})[_0xfa7b('0x72')](function(_0x1a14ba){logger[_0xfa7b('0x5a')](_0x1a14ba[_0xfa7b('0x60')]);_0x380cc4({'ret':0x1});});}});}function handleTZQuery(_0x5893ea){logger['info'](_0x5893ea);return db[_0xfa7b('0x5e')][_0xfa7b('0x5f')](_0x5893ea)['spread'](function(_0x6d597b){})[_0xfa7b('0x72')](function(_0x5d12c6){logger[_0xfa7b('0x5a')](_0x5d12c6[_0xfa7b('0x60')]);});}function main(_0x2fc50a,_0x187050,_0x3cd3b1,_0x3bf12a){logger[_0xfa7b('0x58')](_0xfa7b('0x73'),_0x2fc50a,JSON[_0xfa7b('0x74')](_0x187050));process[_0xfa7b('0x75')](_0xfa7b('0x76'));var _0x250a5c=_0x187050[_0xfa7b('0x77')];var _0x128f0f=_['clone'](_0x250a5c);var _0x10401f=_0x187050[_0xfa7b('0x78')];var _0xaef88f=path['join'](config[_0xfa7b('0x79')],_0xfa7b('0x7a'),_0x10401f+_0xfa7b('0x7b'));hasTZ=_[_0xfa7b('0x50')](_0x250a5c)[_0xfa7b('0x7c')](_0xfa7b('0x6e'));var _0x484841=_[_0xfa7b('0x50')](_0x250a5c)[_0xfa7b('0x14')]();logger[_0xfa7b('0x58')](_0xfa7b('0x7d'),_0x484841);db[_0xfa7b('0x7e')][_0xfa7b('0x19')]({'raw':!![],'attributes':['id',_0xfa7b('0x7f')]})[_0xfa7b('0x1b')](function(_0x1e5080){for(var _0x1da0eb=0x0;_0x1da0eb<_0x1e5080[_0xfa7b('0x1c')];_0x1da0eb++){if(_0x1e5080[_0x1da0eb][_0xfa7b('0x7f')]in _0x250a5c){contactItemTypes[_0xfa7b('0x1d')](_0x1e5080[_0x1da0eb]);delete _0x128f0f[_0x1e5080[_0x1da0eb]['name']];hasAdditionalPhones=!![];}for(var _0x438e17 in _0x250a5c){if(_0x1e5080[_0x1da0eb]['name']+_0xfa7b('0x80')===_0x438e17){phoneDescriptions[_0xfa7b('0x1d')]({'itemTypeId':_0x1e5080[_0x1da0eb]['id'],'description':_0x438e17});delete _0x128f0f[_0x438e17];}}}if(hasAdditionalPhones)_0x128f0f[_0xfa7b('0x1a')]='';var _0x206388=_[_0xfa7b('0x50')](_0x128f0f)[_0xfa7b('0x14')]();logger[_0xfa7b('0x58')]('header',_0x206388);fs[_0xfa7b('0x81')](_0xaef88f,_0x206388+'\x0a');Papa[_0xfa7b('0x82')](fs['createReadStream'](_0x2fc50a),{'header':!![],'skipEmptyLines':!![],'step':function(_0x14283e,_0x38aaa1){try{for(var _0x3cfbfa=0x0,_0x2fff0f=[];_0x3cfbfa<_0x14283e[_0xfa7b('0x83')][_0xfa7b('0x1c')];_0x3cfbfa++){stats[_0xfa7b('0x84')]+=0x1;if(_0x14283e[_0xfa7b('0x5c')][_0x3cfbfa]){handleError(_0x14283e[_0xfa7b('0x83')][_0x3cfbfa],_0x14283e[_0xfa7b('0x5c')][_0x3cfbfa]);}else{var _0x341582=[];var _0x1e6a7e=[];var _0x5d9aed={};for(var _0x437d2e in _0x250a5c){let _0x1bd8c4=contactItemTypes[_0xfa7b('0x85')](_0x2f23ab=>_0x2f23ab['name']===_0x437d2e);let _0x261bed=contactItemTypes[_0xfa7b('0x85')](_0x3eb48e=>_0x3eb48e['name']+_0xfa7b('0x80')===_0x437d2e);if(_[_0xfa7b('0x6f')](_0x1bd8c4)&&_[_0xfa7b('0x6f')](_0x261bed)){if(_0x250a5c['hasOwnProperty'](_0x437d2e)){if(_0x14283e[_0xfa7b('0x83')][_0x3cfbfa][_0x250a5c[_0x437d2e]]){var _0x3598d6=_[_0xfa7b('0x86')](_0x14283e[_0xfa7b('0x83')][_0x3cfbfa][_0x250a5c[_0x437d2e]]['replace'](/"/g,'\x27'));switch(_0x437d2e){case _0xfa7b('0x2e'):var _0x1eead0=moment(_0x3598d6,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x1eead0['isValid']()){_0x2fff0f[_0xfa7b('0x1d')]('\x22'+_0x3598d6+'\x22');}else{_0x341582['push']('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0xfa7b('0x32'):var _0x5a7aa7=parseInt(_0x3598d6);_0x3598d6=_['isNaN'](_0x5a7aa7)||_0x5a7aa7<0x0||_0x5a7aa7>0x4?_0x3bf12a?0x3:0x2:_0x5a7aa7;_0x2fff0f[_0xfa7b('0x1d')]('\x22'+_0x3598d6+'\x22');break;case _0xfa7b('0x33'):var _0x3b5cc6=parseInt(_0x3598d6);if(_['isNumber'](_0x3b5cc6)&&_[_0xfa7b('0x7c')](_0x3cd3b1,_0x3b5cc6)){_0x2fff0f[_0xfa7b('0x1d')]('\x22'+_0x3b5cc6+'\x22');}else{_0x341582['push'](_0xfa7b('0x87'));}break;case'email':if(isEmail(_0x3598d6)){_0x2fff0f[_0xfa7b('0x1d')]('\x22'+_0x3598d6+'\x22');}else{_0x341582['push'](_0xfa7b('0x88'));}break;case _0xfa7b('0x89'):var _0x3554aa=moment(_0x3598d6,'YYYY-MM-DD',!![]);if(_0x3554aa[_0xfa7b('0x8a')]()){_0x2fff0f[_0xfa7b('0x1d')]('\x22'+_0x3598d6+'\x22');}else{_0x341582[_0xfa7b('0x1d')](_0xfa7b('0x8b'));}break;case _0xfa7b('0x6e'):var _0x36f271=shared[_0xfa7b('0x6d')];var _0x2f578f=_0x36f271[_0x3598d6];if(!_[_0xfa7b('0x6f')](_0x2f578f)){var _0x182f15=_0x2f578f['utcOffset'];_0x2fff0f['push']('\x22'+_0x3598d6+'\x22');_0x2fff0f[_0xfa7b('0x1d')]('\x22'+_0x182f15+'\x22');}break;default:_0x2fff0f[_0xfa7b('0x1d')]('\x22'+_0x3598d6+'\x22');}}else{switch(_0x437d2e){case _0xfa7b('0x8c'):case _0xfa7b('0x12'):_0x341582[_0xfa7b('0x1d')](_0x437d2e+'\x20not\x20specified');break;default:_0x2fff0f[_0xfa7b('0x1d')]('\x22\x22');}}}}else{var _0x366638='';if(!_[_0xfa7b('0x6f')](_0x1bd8c4)){if(!_0x5d9aed[_0xfa7b('0x8d')](_0x1bd8c4['id'])){if(!_[_0xfa7b('0x6f')](_0x14283e[_0xfa7b('0x83')][_0x3cfbfa][_0x250a5c[_0x437d2e]])){var _0x3598d6=_['trim'](_0x14283e[_0xfa7b('0x83')][_0x3cfbfa][_0x250a5c[_0x437d2e]][_0xfa7b('0x8e')](/"/g,'\x27'));var _0x219ff0=phoneDescriptions[_0xfa7b('0x85')](_0x2a0848=>_0x2a0848[_0xfa7b('0x8f')]===_0x1bd8c4['id']);if(!_['isNil'](_0x219ff0)){var _0x249f44=_['trim'](_0x14283e[_0xfa7b('0x83')][_0x3cfbfa][_0x250a5c[_0x219ff0[_0xfa7b('0x90')]]][_0xfa7b('0x8e')](/"/g,'\x27'));if(!_['isNil'](_0x249f44))_0x3598d6=_0x3598d6+'§'+_0x249f44;}if(_0x366638=='')_0x366638=_0x3598d6;else _0x366638+='|'+_0x3598d6;}_0x1e6a7e[_0xfa7b('0x1d')](_0x1bd8c4['id']+':'+_0x366638);_0x5d9aed[_0x1bd8c4['id']]=0x1;}}}}if(hasAdditionalPhones){_0x2fff0f['push']('\x22'+_0x1e6a7e[_0xfa7b('0x14')](';')+'\x22');}if(_0x341582['length']){handleError(_0x14283e[_0xfa7b('0x83')][_0x3cfbfa],{'code':'SystemRow','message':_0x341582[_0xfa7b('0x14')]()});}else{fs[_0xfa7b('0x91')](_0xaef88f,_0x2fff0f[_0xfa7b('0x14')]()+'\x0a');}_0x2fff0f=[];}if(!(stats[_0xfa7b('0x84')]%0xc8)){socket[_0xfa7b('0x92')](_0xfa7b('0x93')+_0x10401f,stats);stats[_0xfa7b('0x5c')]=[];}}if(stopped){logger[_0xfa7b('0x58')](_0xfa7b('0x94'));_0x38aaa1[_0xfa7b('0x95')]();}}catch(_0x444efa){handleError(_0x14283e[_0xfa7b('0x83')][_0x3cfbfa],{'code':_0xfa7b('0x96'),'message':_0x444efa[_0xfa7b('0x60')]});logger[_0xfa7b('0x5a')]('step',_0x444efa[_0xfa7b('0x60')]);}},'complete':function(){try{var _0x1197e5=[];var _0x2cb218=[];var _0x7a0aa='cm_contacts';if(_0x187050[_0xfa7b('0x97')]&&_0x187050[_0xfa7b('0x97')][_0xfa7b('0x1c')]){_0x7a0aa='cm_contacts_'+_0x10401f;_0x1197e5[_0xfa7b('0x1d')](_0xfa7b('0x98')+_0x7a0aa+'\x20LIKE\x20cm_contacts;');}tmp_campaigns=_0xfa7b('0x99')+_0x10401f;tmp_voice_queues='voice_queues_'+_0x10401f;_0x2cb218[_0xfa7b('0x1d')](_0xfa7b('0x98')+tmp_campaigns+_0xfa7b('0x9a'));_0x2cb218['push'](_0xfa7b('0x98')+tmp_voice_queues+_0xfa7b('0x9a'));BPromise[_0xfa7b('0x9b')](_0x2cb218,handleTZQuery)[_0xfa7b('0x1b')](function(_0x61d294){updateTzCampaigns(_0x187050[_0xfa7b('0x2f')])[_0xfa7b('0x1b')](function(_0x4dcce1){updateTzVoiceQueues(_0x187050[_0xfa7b('0x2f')])[_0xfa7b('0x1b')](function(_0x19cfe6){if(hasTZ)_0x206388=_0x206388[_0xfa7b('0x8e')](_0xfa7b('0x6e'),_0xfa7b('0x9c'));var _0x3300ef=util[_0xfa7b('0xd')](_0xfa7b('0x9d'),_0xaef88f,_0x7a0aa,_0x206388,_0x187050[_0xfa7b('0x2f')],_0x187050['CompanyId']||null,NOW,NOW);if(_['isNil'](_0x250a5c['scheduledat'])){_0x3300ef+=',\x20scheduledAt\x20=\x20NOW()';}_0x1197e5['push'](_0x3300ef);if(_0x187050[_0xfa7b('0x97')]&&_0x187050[_0xfa7b('0x97')][_0xfa7b('0x1c')]){_0x1197e5[_0xfa7b('0x1d')](insertCmContact(_0x187050['ListId'],_0x7a0aa,_0x187050[_0xfa7b('0x97')],_0x250a5c));_0x1197e5[_0xfa7b('0x1d')](_0xfa7b('0x9e')+_0x7a0aa+';');}BPromise['each'](_0x1197e5,handleQuery)[_0xfa7b('0x1b')](function(_0x216692){BPromise['all']([handleAdditionalPhones()])[_0xfa7b('0x1b')](function(){_0x1197e5=[];for(var _0x24b5db=0x0;_0x24b5db_0x366d77[_0x7676('0x75')]===_0x5ded6f);let _0x12ab03=contactItemTypes[_0x7676('0x7a')](_0x411dc0=>_0x411dc0[_0x7676('0x75')]+'_description'===_0x5ded6f);if(_['isNil'](_0x240305)&&_[_0x7676('0x1d')](_0x12ab03)){if(_0x2b7aab[_0x7676('0x7b')](_0x5ded6f)){if(_0x21b530['data'][_0x2dd8d6][_0x2b7aab[_0x5ded6f]]){var _0x4066f8=_[_0x7676('0x7c')](_0x21b530['data'][_0x2dd8d6][_0x2b7aab[_0x5ded6f]][_0x7676('0x7d')](/"/g,'\x27'));switch(_0x5ded6f){case'scheduledat':var _0x3323ae=moment(_0x4066f8,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x3323ae[_0x7676('0x7e')]()){_0x2bf1ae[_0x7676('0x1a')]('\x22'+_0x4066f8+'\x22');}else{_0x578442[_0x7676('0x1a')](_0x7676('0x7f'));}break;case'priority':var _0x348031=parseInt(_0x4066f8);_0x4066f8=_['isNaN'](_0x348031)||_0x348031<0x0||_0x348031>0x4?_0x18ae9a?0x3:0x2:_0x348031;_0x2bf1ae[_0x7676('0x1a')]('\x22'+_0x4066f8+'\x22');break;case _0x7676('0x31'):var _0x481129=parseInt(_0x4066f8);if(_[_0x7676('0x80')](_0x481129)&&_['includes'](_0x2c19d5,_0x481129)){_0x2bf1ae[_0x7676('0x1a')]('\x22'+_0x481129+'\x22');}else{_0x578442['push'](_0x7676('0x81'));}break;case _0x7676('0x82'):if(isEmail(_0x4066f8)){_0x2bf1ae['push']('\x22'+_0x4066f8+'\x22');}else{_0x578442[_0x7676('0x1a')]('email\x20wrong\x20format');}break;case'dateOfBirth':var _0x2331f7=moment(_0x4066f8,_0x7676('0x83'),!![]);if(_0x2331f7[_0x7676('0x7e')]()){_0x2bf1ae[_0x7676('0x1a')]('\x22'+_0x4066f8+'\x22');}else{_0x578442['push']('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;case _0x7676('0x6a'):var _0x9e143c=shared[_0x7676('0x69')];var _0x1e1308=_0x9e143c[_0x4066f8];if(!_[_0x7676('0x1d')](_0x1e1308)){var _0x3768a6=_0x1e1308[_0x7676('0x84')];_0x2bf1ae[_0x7676('0x1a')]('\x22'+_0x4066f8+'\x22');_0x2bf1ae['push']('\x22'+_0x3768a6+'\x22');}break;default:_0x2bf1ae[_0x7676('0x1a')]('\x22'+_0x4066f8+'\x22');}}else{switch(_0x5ded6f){case _0x7676('0x85'):case _0x7676('0x11'):_0x578442['push'](_0x5ded6f+_0x7676('0x86'));break;default:_0x2bf1ae[_0x7676('0x1a')]('\x22\x22');}}}}else{var _0x54bb1d='';if(!_[_0x7676('0x1d')](_0x240305)){if(!_0x5704a0[_0x7676('0x7b')](_0x240305['id'])){if(!_['isNil'](_0x21b530[_0x7676('0x87')][_0x2dd8d6][_0x2b7aab[_0x5ded6f]])){var _0x4066f8=_[_0x7676('0x7c')](_0x21b530['data'][_0x2dd8d6][_0x2b7aab[_0x5ded6f]][_0x7676('0x7d')](/"/g,'\x27'));var _0x5f2484=phoneDescriptions[_0x7676('0x7a')](_0x45c4af=>_0x45c4af[_0x7676('0x88')]===_0x240305['id']);if(!_[_0x7676('0x1d')](_0x5f2484)){var _0xb440ba=_[_0x7676('0x7c')](_0x21b530['data'][_0x2dd8d6][_0x2b7aab[_0x5f2484[_0x7676('0x89')]]][_0x7676('0x7d')](/"/g,'\x27'));if(!_[_0x7676('0x1d')](_0xb440ba))_0x4066f8=_0x4066f8+'§'+_0xb440ba;}if(_0x54bb1d=='')_0x54bb1d=_0x4066f8;else _0x54bb1d+='|'+_0x4066f8;}_0x55d274[_0x7676('0x1a')](_0x240305['id']+':'+_0x54bb1d);_0x5704a0[_0x240305['id']]=0x1;}}}}if(hasAdditionalPhones){_0x2bf1ae[_0x7676('0x1a')]('\x22'+_0x55d274['join'](';')+'\x22');}if(_0x578442[_0x7676('0x19')]){handleError(_0x21b530[_0x7676('0x87')][_0x2dd8d6],{'code':_0x7676('0x8a'),'message':_0x578442[_0x7676('0x38')]()});}else{fs[_0x7676('0x8b')](_0x2ee6f8,_0x2bf1ae['join']()+'\x0a');}_0x2bf1ae=[];}if(!(stats[_0x7676('0x8c')]%0xc8)){socket[_0x7676('0x8d')](_0x7676('0x8e')+_0x452574,stats);stats[_0x7676('0x5d')]=[];}}if(stopped){logger[_0x7676('0x59')](_0x7676('0x8f'));_0x4ca16e['abort']();}}catch(_0x4d364f){handleError(_0x21b530[_0x7676('0x87')][_0x2dd8d6],{'code':_0x7676('0x90'),'message':_0x4d364f['message']});logger[_0x7676('0x5a')](_0x7676('0x91'),_0x4d364f['message']);}},'complete':function(){try{var _0x58b7dd=[];var _0x441b14=[];var _0x4ec377='cm_contacts';if(_0x1b8f25['duplicates']&&_0x1b8f25[_0x7676('0x92')]['length']){_0x4ec377=_0x7676('0x93')+_0x452574;_0x58b7dd['push'](_0x7676('0x94')+_0x4ec377+'\x20LIKE\x20cm_contacts;');}tmp_campaigns=_0x7676('0x95')+_0x452574;tmp_voice_queues=_0x7676('0x96')+_0x452574;_0x441b14[_0x7676('0x1a')](_0x7676('0x94')+tmp_campaigns+_0x7676('0x97'));_0x441b14['push'](_0x7676('0x94')+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise['each'](_0x441b14,handleTZQuery)[_0x7676('0x18')](function(_0x3147c2){updateTzCampaigns(_0x1b8f25['ListId'])[_0x7676('0x18')](function(_0x7c413e){updateTzVoiceQueues(_0x1b8f25['ListId'])[_0x7676('0x18')](function(_0x3e8420){if(hasTZ)_0x5409ed=_0x5409ed['replace'](_0x7676('0x6a'),_0x7676('0x98'));var _0x178b97=util[_0x7676('0xc')](_0x7676('0x99'),_0x2ee6f8,_0x4ec377,_0x5409ed,_0x1b8f25[_0x7676('0x2e')],_0x1b8f25[_0x7676('0x9a')]||null,NOW,NOW);if(_[_0x7676('0x1d')](_0x2b7aab[_0x7676('0x47')])){_0x178b97+=_0x7676('0x9b');}_0x58b7dd['push'](_0x178b97);if(_0x1b8f25[_0x7676('0x92')]&&_0x1b8f25[_0x7676('0x92')]['length']){_0x58b7dd[_0x7676('0x1a')](insertCmContact(_0x1b8f25['ListId'],_0x4ec377,_0x1b8f25[_0x7676('0x92')],_0x2b7aab));_0x58b7dd[_0x7676('0x1a')](_0x7676('0x9c')+_0x4ec377+';');}BPromise[_0x7676('0x9d')](_0x58b7dd,handleQuery)['then'](function(_0x115fdf){BPromise['all']([handleAdditionalPhones()])[_0x7676('0x18')](function(){_0x58b7dd=[];for(var _0x335b47=0x0;_0x335b47\x20\x20');}var _0x5c25b6=path['join'](config[_0x7676('0x72')],_0x7676('0xa9'),process[_0x7676('0xa8')][0x2]);if(!fs['existsSync'](_0x5c25b6)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x555e53={};try{_0x555e53=JSON[_0x7676('0x78')](process[_0x7676('0xa8')][0x3]);if(!_0x555e53['binding']){throw new Error('binding\x20doesn\x27t\x20exists');}if(!_0x555e53[_0x7676('0x70')][_0x7676('0x11')]){throw new Error('phone\x20is\x20mandatory');}if(!_0x555e53[_0x7676('0x70')][_0x7676('0x85')]){throw new Error('firstName\x20is\x20mandatory');}var _0x1860fa=0x0;if(_0x555e53[_0x7676('0x70')]['UserId']){_0x1860fa=0x1;}if(!_0x555e53[_0x7676('0x2e')]){throw new Error('ListId\x20is\x20mandatory');}}catch(_0x1ae9f1){throw new Error(_0x7676('0xaa'));}var _0x3c8ada=[];try{_0x3c8ada=_['map'](JSON['parse'](process[_0x7676('0xa8')][0x4]),'id');}catch(_0x2712a8){logger[_0x7676('0x59')](_0x7676('0xab'));}main(_0x5c25b6,_0x555e53,_0x3c8ada,_0x1860fa);}validate();process['on']('SIGINT',handleStop);process['on'](_0x7676('0xac'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/import/cm/csvUpdates.js b/server/components/import/cm/csvUpdates.js index 5857add..cda9559 100644 --- a/server/components/import/cm/csvUpdates.js +++ b/server/components/import/cm/csvUpdates.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_hopper.ListId\x20=\x20?','concat','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','field','MIN(id)','min_id','group','info','Received\x20SIGINT','message','exit','code','sequelize','catch','main','stringify','send','binding','clone','server/files/tmp','.csv','body','findAll','name','_description','keys','writeFileSync','parse','createReadStream','data','rows','errors','find','hasOwnProperty','trim','replace','scheduledat','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','priority','isNaN','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','description','SystemRow','contact:import:','Abort\x20parser','abort','SystemError','step','CIS\x20len','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',',\x20scheduledAt\x20=\x20NOW()','contact','contactTypeId','DROP\x20TABLE\x20','each','finish','affectedRows','emit','unlink','argv','arguments\x20\x20\x20','root','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','papaparse','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','defaults','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','select','phone','from','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','query','spread','isNil','AdditionalPhones','then','error','push','all','length','split','filter','findOne','update','updated','CmContactHasItem','PHONE','inserted','CmContact','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_hopper','fromQuery','ContactId','ListId','createdAt','updatedAt','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','toString','insert','into','cm_hopper_black','ListId\x20=\x20?','\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.createdAt'];(function(_0x52c9cc,_0xd7d1e8){var _0x160e6b=function(_0x59b5e0){while(--_0x59b5e0){_0x52c9cc['push'](_0x52c9cc['shift']());}};_0x160e6b(++_0xd7d1e8);}(_0x0b0e,0x187));var _0xe0b0=function(_0x5c3ae9,_0x450f9a){_0x5c3ae9=_0x5c3ae9-0x0;var _0x3f5950=_0x0b0e[_0x5c3ae9];return _0x3f5950;};'use strict';var fs=require('fs');var path=require(_0xe0b0('0x0'));var _=require('lodash');var Papa=require(_0xe0b0('0x1'));var util=require('util');var BPromise=require(_0xe0b0('0x2'));var moment=require(_0xe0b0('0x3'));var squel=require(_0xe0b0('0x4'));var Redis=require(_0xe0b0('0x5'));var db=require(_0xe0b0('0x6'))['db'];var config=require(_0xe0b0('0x7'));var logger=require(_0xe0b0('0x8'))(_0xe0b0('0x9'));config[_0xe0b0('0xa')]=_[_0xe0b0('0xb')](config[_0xe0b0('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe0b0('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0xe0b0('0xc')](_0xe0b0('0xd'));var tempTableName=_0xe0b0('0xe')+moment()['format'](_0xe0b0('0xf'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x1dd3b8){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'](_0x1dd3b8);}function selectNotIn(_0x1fef28,_0x2f32b6,_0x574d96,_0x399320,_0x2cdad2){return squel[_0xe0b0('0x10')]()['field'](_0xe0b0('0x11'))[_0xe0b0('0x12')](_0x399320)[_0xe0b0('0x13')](_0x2f32b6,null,_0x2f32b6+_0xe0b0('0x14')+_0x399320+'.'+_0x574d96)[_0xe0b0('0x15')](_0x399320+'.'+_0x574d96+'\x20=\x20'+_0x1fef28+'.'+_0x574d96)[_0xe0b0('0x15')](_0x2f32b6+_0xe0b0('0x16')+_0x2cdad2[_0xe0b0('0x13')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x24babd,_0x177c24){promisesAdditionalPhones=[];promisesContact=[];return db['sequelize'][_0xe0b0('0x17')]('select\x20*\x20from\x20'+tempTableName)[_0xe0b0('0x18')](function(_0xadee6e){if(_0xadee6e!==null){var _0x519ae8=[];for(var _0x11fdca=0x0;_0x11fdca<_0xadee6e['length'];_0x11fdca++){var _0x2d6fb6=_0xadee6e[_0x11fdca];if(!_[_0xe0b0('0x19')](_0x2d6fb6['phone'])){if(!_['isNil'](_0x2d6fb6[_0xe0b0('0x1a')]))_0x519ae8['push'](insertAdditionalPhones(_0x2d6fb6));promisesContact['push']({'contact':_0x2d6fb6});}}}Promise['all'](_0x519ae8)[_0xe0b0('0x1b')](function(){_0x24babd({'val':0x1});});})['catch'](function(_0x52598b){logger[_0xe0b0('0x1c')](_0x52598b['message']);});});}function insertAdditionalPhones(_0x472286){return new Promise(function(_0x5dba2f,_0x2c84cc){var _0x1cd7c4=_0x472286[_0xe0b0('0x1a')];if(_[_0xe0b0('0x19')](_0x1cd7c4))_0x2c84cc({'val':0x0});else{var _0x2cf6a1=_0x1cd7c4['split'](';');var _0x4cae54=[];orderBy=0x0;for(var _0x2fa820=0x0;_0x2fa820<_0x2cf6a1['length'];_0x2fa820++){_0x4cae54[_0xe0b0('0x1d')](splitAdditionalPhone(_0x472286['id'],_0x2cf6a1[_0x2fa820]));}Promise[_0xe0b0('0x1e')](_0x4cae54)['then'](function(){_0x5dba2f({'val':_0x2cf6a1[_0xe0b0('0x1f')]});});}});}function splitAdditionalPhone(_0x503883,_0x2208d0){return new Promise(function(_0x49a727,_0x28586d){var _0x576352=_0x2208d0[_0xe0b0('0x20')](':');var _0x4de537=_0x576352[0x0];var _0x4700cc=_0x576352[0x1];if(_0x4700cc!==''){var _0x4aafbe=_0x4700cc[_0xe0b0('0x20')]('|');var _0x5c5317=[];for(var _0x362aba=0x0;_0x362aba<_0x4aafbe[_0xe0b0('0x1f')];_0x362aba++){if(_0x4aafbe[_0x362aba]!==''){var _0x1f1ebd=_[_0xe0b0('0x21')](promisesAdditionalPhones,{'contactId':_0x503883,'phone':_0x4aafbe[_0x362aba]});if(_0x1f1ebd[_0xe0b0('0x1f')]==0x0){orderBy++;promisesAdditionalPhones[_0xe0b0('0x1d')]({'contactId':_0x503883,'contactTypeId':_0x4de537,'phone':_0x4aafbe[_0x362aba],'orderBy':orderBy});}}}_0x49a727({'ok':0x1});}else _0x49a727({'res':0x0});});}function createAdditionalPhone(_0x5200a6,_0x1444b9,_0x1b8aa8,_0x5b7a64){var _0x15e13b='';var _0x419b1f='';var _0x36d137=_0x1b8aa8[_0xe0b0('0x20')]('§');_0x15e13b=_0x36d137[0x0];if(_0x36d137[_0xe0b0('0x1f')]==0x2)_0x419b1f=_0x36d137[0x1];return new Promise(function(_0x254cad,_0x136bd4){return db['CmContactHasItem'][_0xe0b0('0x22')]({'where':{'CmContactId':_0x5200a6,'item':_0x15e13b}})[_0xe0b0('0x1b')](function(_0x48a9b5){if(_0x48a9b5){return db['CmContactHasItem'][_0xe0b0('0x23')]({'ItemTypeId':_0x1444b9,'description':_0x419b1f,'OrderBy':_0x5b7a64},{'where':{'CmContactId':_0x5200a6,'item':_0x15e13b}})[_0xe0b0('0x1b')](function(_0x422575){_0x254cad({'res':_0xe0b0('0x24')});});}else{return db[_0xe0b0('0x25')]['create']({'CmContactId':_0x5200a6,'item':_0x15e13b,'ItemTypeId':_0x1444b9,'description':_0x419b1f,'OrderBy':_0x5b7a64,'ItemClass':_0xe0b0('0x26')})[_0xe0b0('0x1b')](function(_0x7867c4){_0x254cad({'res':_0xe0b0('0x27')});});}});});}function updateContact(_0x27158f){return new Promise(function(_0x4fe835,_0x3ebf2a){var _0x208945=_0x27158f['id'];delete _0x27158f['id'];return db[_0xe0b0('0x28')][_0xe0b0('0x23')](_0x27158f,{'where':{'id':_0x208945}})[_0xe0b0('0x1b')](function(_0x12eeb8){updatedRows+=0x1;return db[_0xe0b0('0x29')][_0xe0b0('0x23')]({'phone':_0x27158f[_0xe0b0('0x11')]},{'where':{'ContactId':_0x208945}})[_0xe0b0('0x1b')](function(_0xd56467){_0x4fe835({'ret':'OK'});});});});}function insertCmHopper(_0x1a0c90,_0x1d35bc,_0x2a1c44,_0xca25d,_0x4cf80c){var _0x121608=[_0xe0b0('0x2a'),_0xe0b0('0x2b'),_0xe0b0('0x2c'),_0xe0b0('0x2d'),_0x1d35bc+'.'+_0xca25d,_0xe0b0('0x2e'),_0xe0b0('0x2f'),'cm_contacts.priority','cm_contacts.UserId','\x22'+_0x4cf80c+'\x22'];return squel['insert']()['into'](_0xe0b0('0x30'))[_0xe0b0('0x31')]([_0xe0b0('0x11'),'scheduledat',_0xe0b0('0x32'),_0xe0b0('0x33'),_0xca25d,_0xe0b0('0x34'),_0xe0b0('0x35'),'priority',_0xe0b0('0x36'),_0xe0b0('0x37')],squel[_0xe0b0('0x10')]()[_0xe0b0('0x38')](_0x121608)[_0xe0b0('0x12')](_0x1d35bc)[_0xe0b0('0x13')](_0xe0b0('0x39'),null,_0xe0b0('0x3a')+_0x1d35bc+_0xe0b0('0x3b'))['join'](_0x2a1c44,null,_0x2a1c44+_0xe0b0('0x14')+_0x1d35bc+'.'+_0xca25d)['where'](_0x1d35bc+_0xe0b0('0x3c'),_0x1a0c90)[_0xe0b0('0x15')](_0xe0b0('0x3d'),NOW)[_0xe0b0('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x1d35bc,_0x2a1c44,_0xca25d,_0xe0b0('0x30'),[_0xe0b0('0x3e'),_0xe0b0('0x3f')]))[_0xe0b0('0x15')](_0xe0b0('0x40'),selectNotIn(_0x1d35bc,_0x2a1c44,_0xca25d,_0xe0b0('0x30'),[_0xe0b0('0x3e')])))[_0xe0b0('0x41')]();}function insertCmHopperBlack(_0x52ffe4,_0x2aad80,_0x309bbf,_0x528818){var _0x515bd2=[_0xe0b0('0x2a'),_0xe0b0('0x2c'),'cm_contacts.ListId',_0x2aad80+'.'+_0x528818,_0xe0b0('0x2e'),_0xe0b0('0x2f')];return squel[_0xe0b0('0x42')]()[_0xe0b0('0x43')](_0xe0b0('0x44'))['fromQuery'](['phone','ContactId',_0xe0b0('0x33'),_0x528818,_0xe0b0('0x34'),'updatedAt'],squel[_0xe0b0('0x10')]()[_0xe0b0('0x38')](_0x515bd2)[_0xe0b0('0x12')](_0x2aad80)[_0xe0b0('0x13')](_0xe0b0('0x39'),null,'cm_contacts.ListId\x20=\x20'+_0x2aad80+'.CmListId')[_0xe0b0('0x13')](_0x309bbf,null,_0x309bbf+_0xe0b0('0x14')+_0x2aad80+'.'+_0x528818)[_0xe0b0('0x15')](_0x2aad80+_0xe0b0('0x3c'),_0x52ffe4)[_0xe0b0('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xe0b0('0x15')](_0xe0b0('0x40'),squel['select']()['field']('phone')[_0xe0b0('0x12')](_0xe0b0('0x44'))[_0xe0b0('0x15')](_0xe0b0('0x45'),_0x52ffe4)['where'](_0x528818+_0xe0b0('0x46'),_0x2aad80+'.'+_0x528818)))[_0xe0b0('0x41')]();}function insertCmHopperAdditionalPhones(_0x483f12){var _0x58b69c=[_0xe0b0('0x47'),_0xe0b0('0x48'),'cm_contact_has_items.OrderBy',_0xe0b0('0x49'),_0xe0b0('0x4a')];return squel['insert']()['into'](_0xe0b0('0x4b'))['fromQuery']([_0xe0b0('0x4c'),_0xe0b0('0x11'),_0xe0b0('0x4d'),_0xe0b0('0x34'),_0xe0b0('0x35')],squel[_0xe0b0('0x10')]()['fields'](_0x58b69c)['from'](_0xe0b0('0x30'))['join']('cm_contacts',null,_0xe0b0('0x4e'))[_0xe0b0('0x13')]('cm_contact_has_items',null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0xe0b0('0x15')](_0xe0b0('0x4f'),_0x483f12)[_0xe0b0('0x15')](_0xe0b0('0x3d'),NOW))[_0xe0b0('0x41')]();}function insertCmContact(_0x24115f,_0x84fabb,_0x4ebb0f,_0x22c7bc){var _0x5ec880=_[_0xe0b0('0x50')](_['keys'](_0x22c7bc),['ListId',_0xe0b0('0x51'),_0xe0b0('0x34'),_0xe0b0('0x35')]);return squel[_0xe0b0('0x42')]()[_0xe0b0('0x43')](_0xe0b0('0x39'))[_0xe0b0('0x31')](_0x5ec880,squel[_0xe0b0('0x10')]()[_0xe0b0('0x38')](_0x5ec880)['from'](_0x84fabb)[_0xe0b0('0x15')]('('+_0x4ebb0f['join'](',')+_0xe0b0('0x52'),squel[_0xe0b0('0x10')]()[_0xe0b0('0x38')](_0x4ebb0f)[_0xe0b0('0x12')](_0xe0b0('0x39'))[_0xe0b0('0x15')]('ListId\x20=\x20?',_0x24115f))[_0xe0b0('0x15')](_0xe0b0('0x53'),squel[_0xe0b0('0x10')]()[_0xe0b0('0x54')](_0xe0b0('0x55'),_0xe0b0('0x56'))[_0xe0b0('0x12')](_0x84fabb)[_0xe0b0('0x57')](_0x4ebb0f[_0xe0b0('0x13')](','))))[_0xe0b0('0x41')]();}function handleStop(){logger[_0xe0b0('0x58')](_0xe0b0('0x59'));stopped=!![];}function handleUncaughtException(_0xc719d2){logger[_0xe0b0('0x1c')](_0xc719d2[_0xe0b0('0x5a')]);process[_0xe0b0('0x5b')](0x1);}function handleError(_0x4c7661,_0x155738){stats['errors'][_0xe0b0('0x1d')]({'name':_0x155738[_0xe0b0('0x5c')],'message':_0x155738[_0xe0b0('0x5a')],'row':_0x4c7661});}function handleQuery(_0x2f24e6){logger[_0xe0b0('0x58')](_0x2f24e6);return db[_0xe0b0('0x5d')][_0xe0b0('0x17')](_0x2f24e6)['spread'](function(_0x47dcc4){results[_0xe0b0('0x1d')](_0x47dcc4);})[_0xe0b0('0x5e')](function(_0x157556){logger['error'](_0x157556[_0xe0b0('0x5a')]);});}function main(_0x13fb4b,_0x309efb,_0x3d820c,_0x3537e7){logger['info'](_0xe0b0('0x5f'),_0x13fb4b,JSON[_0xe0b0('0x60')](_0x309efb));process[_0xe0b0('0x61')]('start');var _0x3604e6=_0x309efb[_0xe0b0('0x62')];var _0x5aa850=_[_0xe0b0('0x63')](_0x3604e6);var _0x4c5478=_0x309efb['socket_timestamp'];var _0x4474ac=path['join'](config['root'],_0xe0b0('0x64'),_0x4c5478+_0xe0b0('0x65'));logger[_0xe0b0('0x58')](_0xe0b0('0x66'),_0x309efb);db['ContactItemType'][_0xe0b0('0x67')]({'raw':!![],'attributes':['id',_0xe0b0('0x68')]})[_0xe0b0('0x1b')](function(_0x41ec8e){for(var _0x1b29c=0x0;_0x1b29c<_0x41ec8e[_0xe0b0('0x1f')];_0x1b29c++){if(_0x41ec8e[_0x1b29c][_0xe0b0('0x68')]in _0x3604e6){contactItemTypes[_0xe0b0('0x1d')](_0x41ec8e[_0x1b29c]);delete _0x5aa850[_0x41ec8e[_0x1b29c]['name']];hasAdditionalPhones=!![];}for(var _0x51940f in _0x3604e6){if(_0x41ec8e[_0x1b29c][_0xe0b0('0x68')]+_0xe0b0('0x69')===_0x51940f){phoneDescriptions[_0xe0b0('0x1d')]({'itemTypeId':_0x41ec8e[_0x1b29c]['id'],'description':_0x51940f});delete _0x5aa850[_0x51940f];}}}if(hasAdditionalPhones)_0x5aa850['AdditionalPhones']='';var _0x49b754=_[_0xe0b0('0x6a')](_0x5aa850)[_0xe0b0('0x13')]();logger['info']('header',_0x49b754);fs[_0xe0b0('0x6b')](_0x4474ac,_0x49b754+'\x0a');Papa[_0xe0b0('0x6c')](fs[_0xe0b0('0x6d')](_0x13fb4b),{'header':!![],'skipEmptyLines':!![],'step':function(_0x29175a,_0x3b263f){try{for(var _0x15f0f8=0x0,_0x1bc7a6=[];_0x15f0f8<_0x29175a[_0xe0b0('0x6e')]['length'];_0x15f0f8++){stats[_0xe0b0('0x6f')]+=0x1;if(_0x29175a[_0xe0b0('0x70')][_0x15f0f8]){handleError(_0x29175a[_0xe0b0('0x6e')][_0x15f0f8],_0x29175a['errors'][_0x15f0f8]);}else{var _0x4fbf44=[];var _0x4f4b45=[];var _0x56ee83={};for(var _0x5d5c93 in _0x3604e6){let _0x567c06=contactItemTypes[_0xe0b0('0x71')](_0x51b492=>_0x51b492['name']===_0x5d5c93);let _0x369d03=contactItemTypes[_0xe0b0('0x71')](_0x3bae8c=>_0x3bae8c[_0xe0b0('0x68')]+_0xe0b0('0x69')===_0x5d5c93);if(_[_0xe0b0('0x19')](_0x567c06)&&_[_0xe0b0('0x19')](_0x369d03)){if(_0x3604e6[_0xe0b0('0x72')](_0x5d5c93)){if(_0x29175a['data'][_0x15f0f8][_0x3604e6[_0x5d5c93]]){var _0x948708=_[_0xe0b0('0x73')](_0x29175a[_0xe0b0('0x6e')][_0x15f0f8][_0x3604e6[_0x5d5c93]][_0xe0b0('0x74')](/"/g,'\x27'));switch(_0x5d5c93){case _0xe0b0('0x75'):var _0x1f70fb=moment(_0x948708,_0xe0b0('0xd'),!![]);if(_0x1f70fb['isValid']()){_0x1bc7a6[_0xe0b0('0x1d')]('\x22'+_0x948708+'\x22');}else{_0x4fbf44['push'](_0xe0b0('0x76'));}break;case _0xe0b0('0x77'):var _0x255200=parseInt(_0x948708);_0x948708=_[_0xe0b0('0x78')](_0x255200)||_0x255200<0x0||_0x255200>0x4?_0x3537e7?0x3:0x2:_0x255200;_0x1bc7a6['push']('\x22'+_0x948708+'\x22');break;case _0xe0b0('0x36'):var _0x429ac3=parseInt(_0x948708);if(_['isNumber'](_0x429ac3)&&_['includes'](_0x3d820c,_0x429ac3)){_0x1bc7a6[_0xe0b0('0x1d')]('\x22'+_0x429ac3+'\x22');}else{_0x4fbf44[_0xe0b0('0x1d')](_0xe0b0('0x79'));}break;case _0xe0b0('0x7a'):if(isEmail(_0x948708)){_0x1bc7a6[_0xe0b0('0x1d')]('\x22'+_0x948708+'\x22');}else{_0x4fbf44[_0xe0b0('0x1d')](_0xe0b0('0x7b'));}break;case _0xe0b0('0x7c'):var _0x1eed55=moment(_0x948708,_0xe0b0('0x7d'),!![]);if(_0x1eed55['isValid']()){_0x1bc7a6['push']('\x22'+_0x948708+'\x22');}else{_0x4fbf44[_0xe0b0('0x1d')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x1bc7a6['push']('\x22'+_0x948708+'\x22');}}else{switch(_0x5d5c93){case'firstName':case'phone':_0x4fbf44[_0xe0b0('0x1d')](_0x5d5c93+'\x20not\x20specified');break;default:_0x1bc7a6[_0xe0b0('0x1d')]('\x22\x22');}}}}else{var _0x3e7859='';if(!_[_0xe0b0('0x19')](_0x567c06)){if(!_0x56ee83[_0xe0b0('0x72')](_0x567c06['id'])){for(var _0x5b1b6b=0x0;_0x5b1b6b<_0x3604e6[_0x5d5c93][_0xe0b0('0x1f')];_0x5b1b6b++){var _0x948708=_['trim'](_0x29175a[_0xe0b0('0x6e')][_0x15f0f8][_0x3604e6[_0x5d5c93][_0x5b1b6b]][_0xe0b0('0x74')](/"/g,'\x27'));var _0x1ac31f=phoneDescriptions[_0xe0b0('0x71')](_0x27af09=>_0x27af09['itemTypeId']===_0x567c06['id']);if(!_['isNil'](_0x1ac31f)){var _0x55aef7=_['trim'](_0x29175a['data'][_0x15f0f8][_0x3604e6[_0x1ac31f[_0xe0b0('0x7e')]][0x0]]['replace'](/"/g,'\x27'));if(!_[_0xe0b0('0x19')](_0x55aef7))_0x948708=_0x948708+'§'+_0x55aef7;}if(_0x3e7859=='')_0x3e7859=_0x948708;else _0x3e7859+='|'+_0x948708;}_0x4f4b45['push'](_0x567c06['id']+':'+_0x3e7859);_0x56ee83[_0x567c06['id']]=0x1;}}}}if(hasAdditionalPhones){_0x1bc7a6[_0xe0b0('0x1d')]('\x22'+_0x4f4b45[_0xe0b0('0x13')](';')+'\x22');}if(_0x4fbf44[_0xe0b0('0x1f')]){handleError(_0x29175a[_0xe0b0('0x6e')][_0x15f0f8],{'code':_0xe0b0('0x7f'),'message':_0x4fbf44[_0xe0b0('0x13')]()});}else{fs['appendFileSync'](_0x4474ac,_0x1bc7a6['join']()+'\x0a');}_0x1bc7a6=[];}if(!(stats['rows']%0xc8)){socket['emit'](_0xe0b0('0x80')+_0x4c5478,stats);stats[_0xe0b0('0x70')]=[];}}if(stopped){logger[_0xe0b0('0x58')](_0xe0b0('0x81'));_0x3b263f[_0xe0b0('0x82')]();}}catch(_0x534881){handleError(_0x29175a[_0xe0b0('0x6e')][_0x15f0f8],{'code':_0xe0b0('0x83'),'message':_0x534881[_0xe0b0('0x5a')]});logger[_0xe0b0('0x1c')](_0xe0b0('0x84'),_0x534881[_0xe0b0('0x5a')]);}},'complete':function(){try{var _0x3ef24a=[];var _0x7beacf=tempTableName;_0x3ef24a[_0xe0b0('0x1d')]('CREATE\x20TABLE\x20'+_0x7beacf+'\x20LIKE\x20cm_contacts;');logger[_0xe0b0('0x58')](_0xe0b0('0x85'),contactItemTypes['length']);var _0x7feff4=util[_0xe0b0('0xc')](_0xe0b0('0x86'),_0x4474ac,_0x7beacf,_0x49b754,_0x309efb[_0xe0b0('0x33')],_0x309efb[_0xe0b0('0x51')]||null,NOW,NOW);if(_[_0xe0b0('0x19')](_0x3604e6[_0xe0b0('0x75')])){_0x7feff4+=_0xe0b0('0x87');}_0x3ef24a['push'](_0x7feff4);BPromise['each'](_0x3ef24a,handleQuery)['then'](function(_0xc19743){BPromise[_0xe0b0('0x1e')]([handleAdditionalPhones()])['then'](function(){_0x3ef24a=[];for(var _0x36b67c=0x0;_0x36b67c\x20\x20','file\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','bluebird','moment','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','localhost','socket.io-emitter','format','cm_contacts_temp_','YYYYMMDDHHmmss','test','select','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','sequelize','query','select\x20*\x20from\x20','length','isNil','push','then','catch','message','AdditionalPhones','split','filter','CmContactHasItem','update','create','PHONE','inserted','CmContact','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','createdAt','updatedAt','priority','UserId','recallme','fields'];(function(_0x2abe1e,_0x4d6eae){var _0x4fc59e=function(_0x578610){while(--_0x578610){_0x2abe1e['push'](_0x2abe1e['shift']());}};_0x4fc59e(++_0x4d6eae);}(_0x9c00,0x1a0));var _0x09c0=function(_0x4382bc,_0x231a2d){_0x4382bc=_0x4382bc-0x0;var _0x13c82a=_0x9c00[_0x4382bc];return _0x13c82a;};'use strict';var fs=require('fs');var path=require(_0x09c0('0x0'));var _=require(_0x09c0('0x1'));var Papa=require('papaparse');var util=require('util');var BPromise=require(_0x09c0('0x2'));var moment=require(_0x09c0('0x3'));var squel=require('squel');var Redis=require(_0x09c0('0x4'));var db=require(_0x09c0('0x5'))['db'];var config=require(_0x09c0('0x6'));var logger=require(_0x09c0('0x7'))(_0x09c0('0x8'));config['redis']=_['defaults'](config[_0x09c0('0x9')],{'host':_0x09c0('0xa'),'port':0x18eb});var socket=require(_0x09c0('0xb'))(new Redis(config[_0x09c0('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0x09c0('0xc')]('YYYY-MM-DD\x20HH:mm:ss');var tempTableName=_0x09c0('0xd')+moment()[_0x09c0('0xc')](_0x09c0('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x1feb1d){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x09c0('0xf')](_0x1feb1d);}function selectNotIn(_0x1e16f4,_0x1fec4f,_0x36f26d,_0x278f8b,_0x4523ea){return squel[_0x09c0('0x10')]()[_0x09c0('0x11')](_0x09c0('0x12'))[_0x09c0('0x13')](_0x278f8b)[_0x09c0('0x14')](_0x1fec4f,null,_0x1fec4f+_0x09c0('0x15')+_0x278f8b+'.'+_0x36f26d)[_0x09c0('0x16')](_0x278f8b+'.'+_0x36f26d+_0x09c0('0x17')+_0x1e16f4+'.'+_0x36f26d)[_0x09c0('0x16')](_0x1fec4f+_0x09c0('0x18')+_0x4523ea[_0x09c0('0x14')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x254598,_0x152140){promisesAdditionalPhones=[];promisesContact=[];return db[_0x09c0('0x19')][_0x09c0('0x1a')](_0x09c0('0x1b')+tempTableName)['spread'](function(_0x590129){if(_0x590129!==null){var _0x558b4f=[];for(var _0x42030d=0x0;_0x42030d<_0x590129[_0x09c0('0x1c')];_0x42030d++){var _0x3991c6=_0x590129[_0x42030d];if(!_[_0x09c0('0x1d')](_0x3991c6['phone'])){if(!_[_0x09c0('0x1d')](_0x3991c6['AdditionalPhones']))_0x558b4f['push'](insertAdditionalPhones(_0x3991c6));promisesContact[_0x09c0('0x1e')]({'contact':_0x3991c6});}}}Promise['all'](_0x558b4f)[_0x09c0('0x1f')](function(){_0x254598({'val':0x1});});})[_0x09c0('0x20')](function(_0x2da257){logger['error'](_0x2da257[_0x09c0('0x21')]);});});}function insertAdditionalPhones(_0x44f714){return new Promise(function(_0x8ad645,_0x3447c5){var _0x12bba7=_0x44f714[_0x09c0('0x22')];if(_[_0x09c0('0x1d')](_0x12bba7))_0x3447c5({'val':0x0});else{var _0x5d5391=_0x12bba7[_0x09c0('0x23')](';');var _0x46f171=[];orderBy=0x0;for(var _0x473fbd=0x0;_0x473fbd<_0x5d5391[_0x09c0('0x1c')];_0x473fbd++){_0x46f171['push'](splitAdditionalPhone(_0x44f714['id'],_0x5d5391[_0x473fbd]));}Promise['all'](_0x46f171)[_0x09c0('0x1f')](function(){_0x8ad645({'val':_0x5d5391[_0x09c0('0x1c')]});});}});}function splitAdditionalPhone(_0x1e8a1c,_0x3a5370){return new Promise(function(_0x491e6f,_0x42ebfc){var _0x120418=_0x3a5370['split'](':');var _0x2c7202=_0x120418[0x0];var _0x163a59=_0x120418[0x1];if(_0x163a59!==''){var _0x2e3d4d=_0x163a59[_0x09c0('0x23')]('|');var _0x1f8131=[];for(var _0x1d2d9d=0x0;_0x1d2d9d<_0x2e3d4d[_0x09c0('0x1c')];_0x1d2d9d++){if(_0x2e3d4d[_0x1d2d9d]!==''){var _0x35b61c=_[_0x09c0('0x24')](promisesAdditionalPhones,{'contactId':_0x1e8a1c,'phone':_0x2e3d4d[_0x1d2d9d]});if(_0x35b61c[_0x09c0('0x1c')]==0x0){orderBy++;promisesAdditionalPhones[_0x09c0('0x1e')]({'contactId':_0x1e8a1c,'contactTypeId':_0x2c7202,'phone':_0x2e3d4d[_0x1d2d9d],'orderBy':orderBy});}}}_0x491e6f({'ok':0x1});}else _0x491e6f({'res':0x0});});}function createAdditionalPhone(_0x5e53ac,_0x15a667,_0x1bdde9,_0x53a7b8){var _0x1d09e0='';var _0x5aa0b9='';var _0x3f5b10=_0x1bdde9['split']('§');_0x1d09e0=_0x3f5b10[0x0];if(_0x3f5b10[_0x09c0('0x1c')]==0x2)_0x5aa0b9=_0x3f5b10[0x1];return new Promise(function(_0x24e371,_0x108409){return db[_0x09c0('0x25')]['findOne']({'where':{'CmContactId':_0x5e53ac,'item':_0x1d09e0}})['then'](function(_0x17c374){if(_0x17c374){return db[_0x09c0('0x25')][_0x09c0('0x26')]({'ItemTypeId':_0x15a667,'description':_0x5aa0b9,'OrderBy':_0x53a7b8},{'where':{'CmContactId':_0x5e53ac,'item':_0x1d09e0}})['then'](function(_0x321ee6){_0x24e371({'res':'updated'});});}else{return db[_0x09c0('0x25')][_0x09c0('0x27')]({'CmContactId':_0x5e53ac,'item':_0x1d09e0,'ItemTypeId':_0x15a667,'description':_0x5aa0b9,'OrderBy':_0x53a7b8,'ItemClass':_0x09c0('0x28')})['then'](function(_0x1b170d){_0x24e371({'res':_0x09c0('0x29')});});}});});}function updateContact(_0xbb7685){return new Promise(function(_0x184c0b,_0x234f07){var _0xaabbb6=_0xbb7685['id'];delete _0xbb7685['id'];return db[_0x09c0('0x2a')]['update'](_0xbb7685,{'where':{'id':_0xaabbb6}})[_0x09c0('0x1f')](function(_0x2c19be){updatedRows+=0x1;return db[_0x09c0('0x2b')][_0x09c0('0x26')]({'phone':_0xbb7685[_0x09c0('0x12')]},{'where':{'ContactId':_0xaabbb6}})['then'](function(_0x920e2c){_0x184c0b({'ret':'OK'});});});});}function insertCmHopper(_0x20349e,_0xca8ae9,_0x12358f,_0x353454,_0x541d0a){var _0x149684=[_0x09c0('0x2c'),_0x09c0('0x2d'),_0x09c0('0x2e'),_0x09c0('0x2f'),_0xca8ae9+'.'+_0x353454,_0x09c0('0x30'),_0x09c0('0x31'),'cm_contacts.priority',_0x09c0('0x32'),'\x22'+_0x541d0a+'\x22'];return squel[_0x09c0('0x33')]()[_0x09c0('0x34')](_0x09c0('0x35'))[_0x09c0('0x36')](['phone','scheduledat','ContactId','ListId',_0x353454,_0x09c0('0x37'),_0x09c0('0x38'),_0x09c0('0x39'),_0x09c0('0x3a'),_0x09c0('0x3b')],squel['select']()[_0x09c0('0x3c')](_0x149684)[_0x09c0('0x13')](_0xca8ae9)['join'](_0x09c0('0x3d'),null,'cm_contacts.ListId\x20=\x20'+_0xca8ae9+_0x09c0('0x3e'))['join'](_0x12358f,null,_0x12358f+_0x09c0('0x15')+_0xca8ae9+'.'+_0x353454)[_0x09c0('0x16')](_0xca8ae9+'.CmListId\x20=\x20?',_0x20349e)[_0x09c0('0x16')](_0x09c0('0x3f'),NOW)['where'](_0x09c0('0x40'),selectNotIn(_0xca8ae9,_0x12358f,_0x353454,_0x09c0('0x35'),[_0x09c0('0x41'),_0x09c0('0x42')]))[_0x09c0('0x16')](_0x09c0('0x40'),selectNotIn(_0xca8ae9,_0x12358f,_0x353454,'cm_hopper',[_0x09c0('0x41')])))[_0x09c0('0x43')]();}function insertCmHopperBlack(_0x2d6344,_0x57835c,_0x193ed2,_0x30c0c5){var _0x447224=['cm_contacts.phone',_0x09c0('0x2e'),_0x09c0('0x2f'),_0x57835c+'.'+_0x30c0c5,'cm_contacts.createdAt','cm_contacts.updatedAt'];return squel[_0x09c0('0x33')]()[_0x09c0('0x34')]('cm_hopper_black')[_0x09c0('0x36')]([_0x09c0('0x12'),'ContactId',_0x09c0('0x44'),_0x30c0c5,_0x09c0('0x37'),_0x09c0('0x38')],squel[_0x09c0('0x10')]()[_0x09c0('0x3c')](_0x447224)['from'](_0x57835c)[_0x09c0('0x14')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x57835c+_0x09c0('0x3e'))[_0x09c0('0x14')](_0x193ed2,null,_0x193ed2+_0x09c0('0x15')+_0x57835c+'.'+_0x30c0c5)[_0x09c0('0x16')](_0x57835c+_0x09c0('0x45'),_0x2d6344)[_0x09c0('0x16')]('cm_contacts.createdAt\x20=\x20?',NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x09c0('0x10')]()[_0x09c0('0x11')](_0x09c0('0x12'))['from'](_0x09c0('0x46'))[_0x09c0('0x16')](_0x09c0('0x47'),_0x2d6344)[_0x09c0('0x16')](_0x30c0c5+_0x09c0('0x48'),_0x57835c+'.'+_0x30c0c5)))[_0x09c0('0x43')]();}function insertCmHopperAdditionalPhones(_0x298ab4){var _0x2b3c56=[_0x09c0('0x49'),_0x09c0('0x4a'),_0x09c0('0x4b'),_0x09c0('0x4c'),_0x09c0('0x4d')];return squel[_0x09c0('0x33')]()[_0x09c0('0x34')](_0x09c0('0x4e'))[_0x09c0('0x36')]([_0x09c0('0x4f'),_0x09c0('0x12'),_0x09c0('0x50'),'createdAt',_0x09c0('0x38')],squel[_0x09c0('0x10')]()[_0x09c0('0x3c')](_0x2b3c56)[_0x09c0('0x13')](_0x09c0('0x35'))['join'](_0x09c0('0x3d'),null,_0x09c0('0x51'))[_0x09c0('0x14')]('cm_contact_has_items',null,_0x09c0('0x52'))[_0x09c0('0x16')](_0x09c0('0x53'),_0x298ab4)[_0x09c0('0x16')](_0x09c0('0x3f'),NOW))[_0x09c0('0x43')]();}function insertCmContact(_0x45ecd0,_0x499905,_0x1285f8,_0x42a16c){var _0x12f881=_[_0x09c0('0x54')](_[_0x09c0('0x55')](_0x42a16c),[_0x09c0('0x44'),_0x09c0('0x56'),'createdAt','updatedAt']);return squel[_0x09c0('0x33')]()[_0x09c0('0x34')](_0x09c0('0x3d'))['fromQuery'](_0x12f881,squel[_0x09c0('0x10')]()['fields'](_0x12f881)[_0x09c0('0x13')](_0x499905)[_0x09c0('0x16')]('('+_0x1285f8[_0x09c0('0x14')](',')+_0x09c0('0x57'),squel[_0x09c0('0x10')]()[_0x09c0('0x3c')](_0x1285f8)[_0x09c0('0x13')]('cm_contacts')[_0x09c0('0x16')](_0x09c0('0x47'),_0x45ecd0))[_0x09c0('0x16')](_0x09c0('0x58'),squel[_0x09c0('0x10')]()[_0x09c0('0x11')](_0x09c0('0x59'),_0x09c0('0x5a'))[_0x09c0('0x13')](_0x499905)[_0x09c0('0x5b')](_0x1285f8[_0x09c0('0x14')](','))))['toString']();}function handleStop(){logger[_0x09c0('0x5c')](_0x09c0('0x5d'));stopped=!![];}function handleUncaughtException(_0x26dc22){logger[_0x09c0('0x5e')](_0x26dc22['message']);process[_0x09c0('0x5f')](0x1);}function handleError(_0x48dae0,_0x29205f){stats[_0x09c0('0x60')][_0x09c0('0x1e')]({'name':_0x29205f['code'],'message':_0x29205f['message'],'row':_0x48dae0});}function handleQuery(_0x3fe5fd){logger[_0x09c0('0x5c')](_0x3fe5fd);return db[_0x09c0('0x19')][_0x09c0('0x1a')](_0x3fe5fd)['spread'](function(_0x247c3d){results[_0x09c0('0x1e')](_0x247c3d);})['catch'](function(_0x372320){logger[_0x09c0('0x5e')](_0x372320[_0x09c0('0x21')]);});}function main(_0x296d16,_0x51b598,_0x8d27a5,_0x24f23b){logger[_0x09c0('0x5c')](_0x09c0('0x61'),_0x296d16,JSON[_0x09c0('0x62')](_0x51b598));process[_0x09c0('0x63')](_0x09c0('0x64'));var _0x63dda8=_0x51b598[_0x09c0('0x65')];var _0x2722fb=_[_0x09c0('0x66')](_0x63dda8);var _0x2906cb=_0x51b598[_0x09c0('0x67')];var _0x484df5=path[_0x09c0('0x14')](config[_0x09c0('0x68')],_0x09c0('0x69'),_0x2906cb+_0x09c0('0x6a'));logger[_0x09c0('0x5c')]('body',_0x51b598);db[_0x09c0('0x6b')][_0x09c0('0x6c')]({'raw':!![],'attributes':['id',_0x09c0('0x6d')]})[_0x09c0('0x1f')](function(_0x5c88f1){for(var _0x1d395e=0x0;_0x1d395e<_0x5c88f1[_0x09c0('0x1c')];_0x1d395e++){if(_0x5c88f1[_0x1d395e]['name']in _0x63dda8){contactItemTypes[_0x09c0('0x1e')](_0x5c88f1[_0x1d395e]);delete _0x2722fb[_0x5c88f1[_0x1d395e][_0x09c0('0x6d')]];hasAdditionalPhones=!![];}for(var _0x20dd29 in _0x63dda8){if(_0x5c88f1[_0x1d395e][_0x09c0('0x6d')]+_0x09c0('0x6e')===_0x20dd29){phoneDescriptions['push']({'itemTypeId':_0x5c88f1[_0x1d395e]['id'],'description':_0x20dd29});delete _0x2722fb[_0x20dd29];}}}if(hasAdditionalPhones)_0x2722fb[_0x09c0('0x22')]='';var _0x302c81=_[_0x09c0('0x55')](_0x2722fb)[_0x09c0('0x14')]();logger[_0x09c0('0x5c')]('header',_0x302c81);fs[_0x09c0('0x6f')](_0x484df5,_0x302c81+'\x0a');Papa[_0x09c0('0x70')](fs[_0x09c0('0x71')](_0x296d16),{'header':!![],'skipEmptyLines':!![],'step':function(_0x34c250,_0x63cd5c){try{for(var _0x31d14e=0x0,_0x59c57a=[];_0x31d14e<_0x34c250['data']['length'];_0x31d14e++){stats['rows']+=0x1;if(_0x34c250[_0x09c0('0x60')][_0x31d14e]){handleError(_0x34c250[_0x09c0('0x72')][_0x31d14e],_0x34c250[_0x09c0('0x60')][_0x31d14e]);}else{var _0x5095d6=[];var _0x3306b9=[];var _0x595b73={};for(var _0x368108 in _0x63dda8){let _0x14872e=contactItemTypes['find'](_0x3998ec=>_0x3998ec['name']===_0x368108);let _0x4a42c4=contactItemTypes[_0x09c0('0x73')](_0x111647=>_0x111647[_0x09c0('0x6d')]+_0x09c0('0x6e')===_0x368108);if(_[_0x09c0('0x1d')](_0x14872e)&&_[_0x09c0('0x1d')](_0x4a42c4)){if(_0x63dda8[_0x09c0('0x74')](_0x368108)){if(_0x34c250[_0x09c0('0x72')][_0x31d14e][_0x63dda8[_0x368108]]){var _0x97cc44=_[_0x09c0('0x75')](_0x34c250['data'][_0x31d14e][_0x63dda8[_0x368108]][_0x09c0('0x76')](/"/g,'\x27'));switch(_0x368108){case _0x09c0('0x77'):var _0x580498=moment(_0x97cc44,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x580498[_0x09c0('0x78')]()){_0x59c57a[_0x09c0('0x1e')]('\x22'+_0x97cc44+'\x22');}else{_0x5095d6[_0x09c0('0x1e')](_0x09c0('0x79'));}break;case _0x09c0('0x39'):var _0x3083ad=parseInt(_0x97cc44);_0x97cc44=_[_0x09c0('0x7a')](_0x3083ad)||_0x3083ad<0x0||_0x3083ad>0x4?_0x24f23b?0x3:0x2:_0x3083ad;_0x59c57a['push']('\x22'+_0x97cc44+'\x22');break;case _0x09c0('0x3a'):var _0x56b94b=parseInt(_0x97cc44);if(_[_0x09c0('0x7b')](_0x56b94b)&&_[_0x09c0('0x7c')](_0x8d27a5,_0x56b94b)){_0x59c57a[_0x09c0('0x1e')]('\x22'+_0x56b94b+'\x22');}else{_0x5095d6[_0x09c0('0x1e')](_0x09c0('0x7d'));}break;case'email':if(isEmail(_0x97cc44)){_0x59c57a[_0x09c0('0x1e')]('\x22'+_0x97cc44+'\x22');}else{_0x5095d6['push'](_0x09c0('0x7e'));}break;case'dateOfBirth':var _0x35c446=moment(_0x97cc44,_0x09c0('0x7f'),!![]);if(_0x35c446[_0x09c0('0x78')]()){_0x59c57a[_0x09c0('0x1e')]('\x22'+_0x97cc44+'\x22');}else{_0x5095d6[_0x09c0('0x1e')](_0x09c0('0x80'));}break;default:_0x59c57a[_0x09c0('0x1e')]('\x22'+_0x97cc44+'\x22');}}else{switch(_0x368108){case'firstName':case'phone':_0x5095d6[_0x09c0('0x1e')](_0x368108+_0x09c0('0x81'));break;default:_0x59c57a[_0x09c0('0x1e')]('\x22\x22');}}}}else{var _0x309d0a='';if(!_[_0x09c0('0x1d')](_0x14872e)){if(!_0x595b73[_0x09c0('0x74')](_0x14872e['id'])){for(var _0x4060bb=0x0;_0x4060bb<_0x63dda8[_0x368108][_0x09c0('0x1c')];_0x4060bb++){var _0x97cc44=_[_0x09c0('0x75')](_0x34c250['data'][_0x31d14e][_0x63dda8[_0x368108][_0x4060bb]]['replace'](/"/g,'\x27'));var _0x4e6ca0=phoneDescriptions[_0x09c0('0x73')](_0x6d2ac2=>_0x6d2ac2[_0x09c0('0x82')]===_0x14872e['id']);if(!_['isNil'](_0x4e6ca0)){var _0x5f1857=_[_0x09c0('0x75')](_0x34c250['data'][_0x31d14e][_0x63dda8[_0x4e6ca0[_0x09c0('0x83')]][0x0]][_0x09c0('0x76')](/"/g,'\x27'));if(!_['isNil'](_0x5f1857))_0x97cc44=_0x97cc44+'§'+_0x5f1857;}if(_0x309d0a=='')_0x309d0a=_0x97cc44;else _0x309d0a+='|'+_0x97cc44;}_0x3306b9[_0x09c0('0x1e')](_0x14872e['id']+':'+_0x309d0a);_0x595b73[_0x14872e['id']]=0x1;}}}}if(hasAdditionalPhones){_0x59c57a['push']('\x22'+_0x3306b9[_0x09c0('0x14')](';')+'\x22');}if(_0x5095d6[_0x09c0('0x1c')]){handleError(_0x34c250[_0x09c0('0x72')][_0x31d14e],{'code':'SystemRow','message':_0x5095d6[_0x09c0('0x14')]()});}else{fs[_0x09c0('0x84')](_0x484df5,_0x59c57a[_0x09c0('0x14')]()+'\x0a');}_0x59c57a=[];}if(!(stats[_0x09c0('0x85')]%0xc8)){socket[_0x09c0('0x86')](_0x09c0('0x87')+_0x2906cb,stats);stats[_0x09c0('0x60')]=[];}}if(stopped){logger[_0x09c0('0x5c')](_0x09c0('0x88'));_0x63cd5c[_0x09c0('0x89')]();}}catch(_0x22efe8){handleError(_0x34c250[_0x09c0('0x72')][_0x31d14e],{'code':'SystemError','message':_0x22efe8[_0x09c0('0x21')]});logger[_0x09c0('0x5e')](_0x09c0('0x8a'),_0x22efe8[_0x09c0('0x21')]);}},'complete':function(){try{var _0x45233b=[];var _0x51729a=tempTableName;_0x45233b[_0x09c0('0x1e')]('CREATE\x20TABLE\x20'+_0x51729a+'\x20LIKE\x20cm_contacts;');logger[_0x09c0('0x5c')](_0x09c0('0x8b'),contactItemTypes[_0x09c0('0x1c')]);var _0x49c16e=util[_0x09c0('0xc')](_0x09c0('0x8c'),_0x484df5,_0x51729a,_0x302c81,_0x51b598[_0x09c0('0x44')],_0x51b598[_0x09c0('0x56')]||null,NOW,NOW);if(_[_0x09c0('0x1d')](_0x63dda8[_0x09c0('0x77')])){_0x49c16e+=',\x20scheduledAt\x20=\x20NOW()';}_0x45233b[_0x09c0('0x1e')](_0x49c16e);BPromise[_0x09c0('0x8d')](_0x45233b,handleQuery)['then'](function(_0x7d7b3a){BPromise[_0x09c0('0x8e')]([handleAdditionalPhones()])['then'](function(){_0x45233b=[];for(var _0x474053=0x0;_0x474053\x20\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','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','limit','offset','findOne','enableEmailPreview','all','getSelectedTags','isEmpty','t.id\x20IN\x20?','QueryTypes','lodash','../parsers/qs','./update-interaction','updateInteraction','./utils','../../mysqldb','getAccountFK','role','agent','search','select','field','name','color','from','tools_tags','getInteractionFK','user_has_','_interactions','u.id','u.fullname','ui.','left_join','length','where','map','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','messages','me.','interactionsTags','\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','forEach','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','escapeLIKESpecialChars','isNumeric','i.id\x20LIKE\x20?','whatsapp','includes','i.phone\x20LIKE\x20?','fax','i.fax\x20LIKE\x20?','openchannel','i.from\x20LIKE\x20?','mail','isEmail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','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)','getFullTextValue','sqlOperator','find','buildExpression','default','text','start','end','read','and','Contact','operator','$substring','split','value','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','type','tags','clause','user','body','plainBody','keys','some','concat','createdAt','$gte','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','resolve','then','fields','tag','filter','capitalize','chat','Websites','Accounts','\x20IN\x20?','\x20IS\x20NOT\x20NULL','i.thirdDisposition','unshift','closed','shift','CONCAT_WS(\x27\x27,\x20','join','Interaction','SELECT','sequelize','query','toString','keyBy','merge','attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','a.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'];(function(_0x488a28,_0x267632){var _0x3dece1=function(_0x34c885){while(--_0x34c885){_0x488a28['push'](_0x488a28['shift']());}};_0x3dece1(++_0x267632);}(_0x7cbb,0xbf));var _0xb7cb=function(_0x24bbe9,_0x5c1f85){_0x24bbe9=_0x24bbe9-0x0;var _0x12d9cb=_0x7cbb[_0x24bbe9];return _0x12d9cb;};'use strict';var _=require(_0xb7cb('0x0'));var squel=require('squel');var as=require('../parsers/advancedSearch');var qs=require(_0xb7cb('0x1'));var updateInteraction=require(_0xb7cb('0x2'))[_0xb7cb('0x3')];var utils=require(_0xb7cb('0x4'));var db=require(_0xb7cb('0x5'))['db'];function skipInteractionsQuery(_0x52fb2d,_0x210b41,_0x24e8ef){var _0x3c8535=![];var _0x108d32=utils[_0xb7cb('0x6')](_0x52fb2d);if(_0x210b41[_0xb7cb('0x7')]===_0xb7cb('0x8')&&!_0x24e8ef[_0xb7cb('0x9')]&&!_0x24e8ef[_0x108d32]){_0x3c8535=!![];}return _0x3c8535;}function getTagsQuery(){return squel[_0xb7cb('0xa')]()[_0xb7cb('0xb')]('id')['field'](_0xb7cb('0xc'))[_0xb7cb('0xb')](_0xb7cb('0xd'))[_0xb7cb('0xe')](_0xb7cb('0xf'));}function getUsersQuery(_0x1848a7,_0x45af59){var _0x2ca9af=utils[_0xb7cb('0x10')](_0x1848a7);var _0x244109=_0xb7cb('0x11')+_0x1848a7+_0xb7cb('0x12');var _0x363129=squel[_0xb7cb('0xa')]()[_0xb7cb('0xb')](_0xb7cb('0x13'))[_0xb7cb('0xb')](_0xb7cb('0x14'))[_0xb7cb('0xb')](_0xb7cb('0x15')+_0x2ca9af)[_0xb7cb('0xe')](_0x244109,'ui')[_0xb7cb('0x16')]('users','u','u.id\x20=\x20ui.UserId');if(_0x45af59[_0xb7cb('0x17')]>0x0){_0x363129[_0xb7cb('0x18')](_0xb7cb('0x15')+_0x2ca9af+'\x20IN\x20?',_[_0xb7cb('0x19')](_0x45af59,'id'));}return _0x363129;}function getInteractionsQuery(_0x3e438b){var _0x850d92=utils['getInteractionsTables'](_0x3e438b);var _0x4648c6=utils['getAccountFK'](_0x3e438b);var _0xda147a=utils[_0xb7cb('0x10')](_0x3e438b);return squel['select']()[_0xb7cb('0xe')](_0x850d92['interactions'],'i')[_0xb7cb('0x16')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join']('users','o',_0xb7cb('0x1a'))[_0xb7cb('0x16')](_0x850d92[_0xb7cb('0x1b')],'a',_0xb7cb('0x1c')+_0x4648c6)[_0xb7cb('0x16')](_0x850d92[_0xb7cb('0x1d')],'me',_0xb7cb('0x1e')+_0xda147a+'\x20=\x20i.id')[_0xb7cb('0x16')](_0x850d92[_0xb7cb('0x1f')],'it','it.'+_0xda147a+_0xb7cb('0x20'))[_0xb7cb('0x16')](_0xb7cb('0xf'),'t',_0xb7cb('0x21'));}function getSqlClauses(){var _0x48ce31={'body':squel[_0xb7cb('0x22')](),'contact':squel[_0xb7cb('0x22')](),'default':squel[_0xb7cb('0x22')](),'fields':squel[_0xb7cb('0x22')](),'filter':squel[_0xb7cb('0x22')](),'read':squel[_0xb7cb('0x22')](),'tags':{'clause':squel['expr'](),'ids':null},'user':squel[_0xb7cb('0x22')]()};return _0x48ce31;}function parseTagParameter(_0x21e1ef){var _0xc05b87=squel[_0xb7cb('0x22')]();if(_0x21e1ef){var _0x16e547=utils['getSelectedTags'](_0x21e1ef);_0x16e547[_0xb7cb('0x23')](function(_0x3a7304){_0xc05b87['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3a7304+',%');});}return _0xc05b87;}function parseReadParameter(_0x126b26){var _0x36abae='';if(_0x126b26){_0x36abae=_0xb7cb('0x24');if(_0x126b26==='1'){_0x36abae=_0x36abae[_0xb7cb('0x25')]('{OPERATOR}','=');}else{_0x36abae=_0x36abae['replace'](_0xb7cb('0x26'),'>');}}return _0x36abae;}function parseSearchFilter(_0x2086ad,_0x3d3a80){var _0x13054b=squel[_0xb7cb('0x22')]();if(_0x3d3a80){var _0x2e2e74=_0x3d3a80[_0xb7cb('0x25')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');var _0x22c3d2=qs[_0xb7cb('0x27')](_0x2e2e74);if(qs[_0xb7cb('0x28')](_0x2e2e74)){_0x13054b['or'](_0xb7cb('0x29'),_0x22c3d2+'%');if(['sms',_0xb7cb('0x2a')][_0xb7cb('0x2b')](_0x2086ad)){_0x13054b['or'](_0xb7cb('0x2c'),_0x22c3d2+'%');}else if(_0x2086ad===_0xb7cb('0x2d')){_0x13054b['or'](_0xb7cb('0x2e'),_0x22c3d2+'%');}else if(_0x2086ad===_0xb7cb('0x2f')){_0x13054b['or'](_0xb7cb('0x30'),_0x22c3d2+'%');}}else if(_0x2086ad===_0xb7cb('0x31')&&qs[_0xb7cb('0x32')](_0x2e2e74)){_0x13054b['or']('c.email\x20LIKE\x20?',_0x22c3d2+'%');}else{if(_0x2086ad==='mail'){_0x13054b['or'](_0xb7cb('0x33'),qs['getFullTextValue'](_0x2e2e74,!![]))['or'](_0xb7cb('0x34'),qs['getFullTextValue'](_0x2e2e74));}else if(_0x2086ad!==_0xb7cb('0x2d')){_0x13054b['or'](_0xb7cb('0x35'),qs['getFullTextValue'](_0x2e2e74));}_0x13054b['or'](_0xb7cb('0x36'),qs[_0xb7cb('0x37')](_0x2e2e74,!![]),null);}}return _0x13054b;}function parseAdvancedSearchFilter(_0x470d88,_0x5973ab){var _0x5ab540=getSqlClauses();var _0x2a1ba4=as['parseSearch'](_0x470d88);var _0x2d2f29=_0x2a1ba4[_0xb7cb('0x38')];for(var _0x5a9022=0x0;_0x5a9022<_0x2a1ba4['conditions'][_0xb7cb('0x17')];_0x5a9022++){var _0xbb9ee1=_0x2a1ba4['conditions'][_0x5a9022];var _0x540295='i';var _0x20156b=_[_0xb7cb('0x39')](_0x5973ab,[_0xb7cb('0xc'),_0xbb9ee1[_0xb7cb('0xb')]]);if(_0x20156b){var _0x4b37ba=as[_0xb7cb('0x3a')](_0x540295,_0x20156b['type'],_0xbb9ee1);_0x5ab540[_0xb7cb('0x3b')][_0x2d2f29](_0x4b37ba[_0xb7cb('0x3c')],_0x4b37ba['value'][_0xb7cb('0x3d')],_0x4b37ba['value'][_0xb7cb('0x3e')]);}else{switch(_0xbb9ee1['field']){case'unreadMessages':var _0x3c4dca=parseReadParameter(_0xbb9ee1['value']);_0x5ab540[_0xb7cb('0x3f')][_0xb7cb('0x40')](_0x3c4dca);break;case _0xb7cb('0x41'):if(_0xbb9ee1[_0xb7cb('0x42')]===_0xb7cb('0x43')){if(_0xbb9ee1['value'][_0xb7cb('0x44')]('\x20')['length']>0x1){_0x5ab540['contact'][_0x2d2f29](_0xb7cb('0x36'),qs[_0xb7cb('0x37')](_0xbb9ee1[_0xb7cb('0x45')],!![]),null);}else{var _0x10954a='%'+_0xbb9ee1[_0xb7cb('0x45')]+'%';_0x5ab540[_0xb7cb('0x46')][_0x2d2f29](_0xb7cb('0x47'),_0x10954a,_0x10954a,_0x10954a);}}else{_0x20156b=_[_0xb7cb('0x39')](_0x5973ab,[_0xb7cb('0xc'),'ContactId']);_0xbb9ee1['field']='ContactId';_0x4b37ba=as['buildExpression'](_0x540295,_0x20156b[_0xb7cb('0x48')],_0xbb9ee1);_0x5ab540['contact'][_0x2d2f29](_0x4b37ba[_0xb7cb('0x3c')],_0x4b37ba[_0xb7cb('0x45')][_0xb7cb('0x3d')],_0x4b37ba[_0xb7cb('0x45')]['end']);}break;case'Tag':var _0x5f1fcb=_0xbb9ee1[_0xb7cb('0x45')][_0xb7cb('0x44')](',')[_0xb7cb('0x19')](function(_0x231e89){return Number(_0x231e89);});var _0xb0b0dc=parseTagParameter(_0x5f1fcb);_0x5ab540[_0xb7cb('0x49')][_0xb7cb('0x4a')][_0xb7cb('0x40')](_0xb0b0dc);_0x5ab540[_0xb7cb('0x49')]['ids']=_0x5f1fcb;break;case'User':if(_0xbb9ee1[_0xb7cb('0x42')]===_0xb7cb('0x43')){_0x5ab540['user'][_0x2d2f29]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname,\x20o.internal)\x20LIKE\x20?','%'+_0xbb9ee1[_0xb7cb('0x45')]+'%',null);}else{_0x20156b=_[_0xb7cb('0x39')](_0x5973ab,[_0xb7cb('0xc'),'UserId']);_0xbb9ee1[_0xb7cb('0xb')]='UserId';_0x4b37ba=as[_0xb7cb('0x3a')](_0x540295,_0x20156b[_0xb7cb('0x48')],_0xbb9ee1);_0x5ab540[_0xb7cb('0x4b')][_0x2d2f29](_0x4b37ba[_0xb7cb('0x3c')],_0x4b37ba[_0xb7cb('0x45')][_0xb7cb('0x3d')],_0x4b37ba[_0xb7cb('0x45')][_0xb7cb('0x3e')]);}break;case _0xb7cb('0x4c'):case _0xb7cb('0x4d'):_0x4b37ba=as[_0xb7cb('0x3a')]('me',null,_0xbb9ee1);_0x5ab540[_0xb7cb('0x4c')][_0x2d2f29](_0x4b37ba[_0xb7cb('0x3c')],_0x4b37ba['value']['start'],_0x4b37ba[_0xb7cb('0x45')][_0xb7cb('0x3e')]);break;}}}return _0x5ab540;}function parseModelFields(_0x53f25b,_0x3e9e0a,_0x2fcdca){var _0x2c19c7=utils[_0xb7cb('0x6')](_0x53f25b);var _0x267569=squel[_0xb7cb('0x22')]();var _0x5167bf=_(_0x3e9e0a)[_0xb7cb('0x4e')]()[_0xb7cb('0x19')](function(_0x3d46db){return _[_0xb7cb('0x4f')](_0x2fcdca,[_0xb7cb('0xc'),_0x3d46db])?_0x3d46db:undefined;})['compact']()['value']();if(_0x5167bf[_0xb7cb('0x17')]>0x0){_0x5167bf['forEach'](function(_0x9cd6c1){if(_0x9cd6c1===_0x2c19c7){_0x267569['and']('i.'+_0x2c19c7+'\x20IN\x20?',[][_0xb7cb('0x50')](_0x3e9e0a[_0x9cd6c1]));}else if(_0x9cd6c1===_0xb7cb('0x51')){var _0x3045dd=JSON['parse'](_0x3e9e0a[_0x9cd6c1])[_0xb7cb('0x52')];var _0x19d5b0=JSON[_0xb7cb('0x53')](_0x3e9e0a[_0x9cd6c1])['$lte'];_0x267569[_0xb7cb('0x40')](_0xb7cb('0x54'),_0x3045dd,_0x19d5b0);}else{if(_0x3e9e0a[_0x9cd6c1]===_0xb7cb('0x55')){_0x267569[_0xb7cb('0x40')]('i.'+_0x9cd6c1+_0xb7cb('0x56'));}else{_0x267569[_0xb7cb('0x40')]('i.'+_0x9cd6c1+'\x20=\x20?',_0x3e9e0a[_0x9cd6c1]);}}});}return _0x267569;}function parseQueryParameters(_0x2781ac,_0x3e9dbb,_0x29a3a8){var _0x48e51a=getSqlClauses();return Promise[_0xb7cb('0x57')]()['then'](function(){return parseModelFields(_0x2781ac,_0x3e9dbb,_0x29a3a8);})[_0xb7cb('0x58')](function(_0x3ffb4a){_0x48e51a[_0xb7cb('0x59')][_0xb7cb('0x40')](_0x3ffb4a);return parseReadParameter(_0x3e9dbb[_0xb7cb('0x3f')]);})['then'](function(_0x35c756){_0x48e51a[_0xb7cb('0x3f')][_0xb7cb('0x40')](_0x35c756);return parseTagParameter(_0x3e9dbb[_0xb7cb('0x5a')]);})[_0xb7cb('0x58')](function(_0x315eef){_0x48e51a[_0xb7cb('0x49')][_0xb7cb('0x4a')]['and'](_0x315eef);return parseSearchFilter(_0x2781ac,_0x3e9dbb['filter']);})['then'](function(_0x4ca41c){_0x48e51a[_0xb7cb('0x5b')]=_0x4ca41c;return _0x48e51a;});}function checkAccountsRestrictions(_0x529126,_0x5987e8,_0x8ba9b){var _0x1e65e8=utils[_0xb7cb('0x6')](_0x529126);var _0x22f604='get'+_[_0xb7cb('0x5c')](_0x529126)+(_0x529126===_0xb7cb('0x5d')?_0xb7cb('0x5e'):_0xb7cb('0x5f'));var _0x1cfeef=squel[_0xb7cb('0x22')]();return Promise[_0xb7cb('0x57')]()[_0xb7cb('0x58')](function(){if(_0x8ba9b['search']&&_0x5987e8['role']===_0xb7cb('0x8')){return _0x5987e8[_0x22f604]({'attributes':['id'],'raw':!![]});}})[_0xb7cb('0x58')](function(_0x1a5666){if(_0x1a5666){if(_0x1a5666[_0xb7cb('0x17')]===0x0){_0x1cfeef[_0xb7cb('0x40')]('i.'+_0x1e65e8+'\x20IS\x20NULL');}else{_0x1cfeef[_0xb7cb('0x40')]('i.'+_0x1e65e8+_0xb7cb('0x60'),_[_0xb7cb('0x19')](_0x1a5666,'id'));}}else if(!_0x8ba9b[_0x1e65e8]){_0x1cfeef['and']('i.'+_0x1e65e8+_0xb7cb('0x61'));}})['then'](function(){return _0x1cfeef;});}function getClosedOrderClause(_0x264ba9,_0x576bf1){var _0x31251a='';var _0x24dbc1=[_0xb7cb('0x62'),'i.secondDisposition','i.disposition'];if(_0x264ba9===_0xb7cb('0x31')){_0x24dbc1[_0xb7cb('0x63')]('i.substatus');}if(_0x576bf1[_0xb7cb('0x64')]==='0'&&_0x264ba9===_0xb7cb('0x31')){_0x31251a='i.substatus';}else{if(_0x576bf1[_0xb7cb('0x64')]==='1'){_0x24dbc1[_0xb7cb('0x65')]();}_0x31251a=_0xb7cb('0x66')+_0x24dbc1[_0xb7cb('0x67')](',\x20')+')';}return _0x31251a;}function getFilteredInteractions(_0x206e53,_0x4fe1ce,_0x414ad2,_0x532434){var _0x7573f0=utils[_0xb7cb('0x10')](_0x206e53);var _0x234148=_[_0xb7cb('0x5c')](_0x206e53)+_0xb7cb('0x68');var _0x20ce8e=[];var _0x396597=getTagsQuery();var _0x589307={'type':db['Sequelize']['QueryTypes'][_0xb7cb('0x69')],'raw':!![]};var _0x32fd4a=[];var _0x220f49=[];return db[_0xb7cb('0x6a')][_0xb7cb('0x6b')](_0x396597[_0xb7cb('0x6c')](),_0x589307)[_0xb7cb('0x58')](function(_0x36109e){_0x20ce8e=_[_0xb7cb('0x6d')](_0x36109e,'id');_0x589307=_[_0xb7cb('0x6e')](_0x589307,{'model':db[_0x234148],'mapToModel':!![],'nest':!![]});if(_0x414ad2['fields']){_0x532434[_0xb7cb('0x6f')][_0xb7cb('0x23')](function(_0x103fbd){_0x4fe1ce['field']('i.'+_0x103fbd);});}else{_0x4fe1ce['field'](_0xb7cb('0x70'),_0xb7cb('0x71'));_0x4fe1ce[_0xb7cb('0xb')](_0xb7cb('0x72'),_0xb7cb('0x73'));_0x4fe1ce[_0xb7cb('0xb')](_0xb7cb('0x74'),_0xb7cb('0x75'));if(_0x206e53===_0xb7cb('0x31')){_0x4fe1ce[_0xb7cb('0xb')](_0xb7cb('0x76'),'Account.email');_0x4fe1ce[_0xb7cb('0xb')](_0xb7cb('0x77'),_0xb7cb('0x78'));_0x4fe1ce['field'](_0xb7cb('0x79'));_0x4fe1ce[_0xb7cb('0xb')](_0xb7cb('0x7a'));_0x4fe1ce[_0xb7cb('0xb')](_0xb7cb('0x7b'));_0x4fe1ce['field'](_0xb7cb('0x7c'));_0x4fe1ce[_0xb7cb('0xb')](_0xb7cb('0x7d'));_0x4fe1ce[_0xb7cb('0xb')](_0xb7cb('0x7e'));_0x4fe1ce[_0xb7cb('0xb')](_0xb7cb('0x7f'));_0x4fe1ce[_0xb7cb('0xb')](_0xb7cb('0x80'));_0x4fe1ce[_0xb7cb('0xb')](_0xb7cb('0x81'));_0x4fe1ce['field']('i.disposition');_0x4fe1ce[_0xb7cb('0xb')](_0xb7cb('0x82'));_0x4fe1ce['field']('i.thirdDisposition');_0x4fe1ce[_0xb7cb('0xb')]('i.substatus');_0x4fe1ce[_0xb7cb('0xb')](_0xb7cb('0x83'));_0x4fe1ce[_0xb7cb('0xb')]('i.ContactId');_0x4fe1ce['field'](_0xb7cb('0x84'));_0x4fe1ce[_0xb7cb('0xb')]('i.UserId');}else if(_0x206e53==='openchannel'){_0x4fe1ce[_0xb7cb('0xb')](_0xb7cb('0x85'),_0xb7cb('0x78'));}else{_0x4fe1ce[_0xb7cb('0xb')]('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',_0xb7cb('0x78'));}if(_0x206e53!==_0xb7cb('0x31')){_0x4fe1ce[_0xb7cb('0xb')](_0xb7cb('0x86'));}_0x4fe1ce[_0xb7cb('0xb')](_0xb7cb('0x87'),_0xb7cb('0x88'));_0x4fe1ce[_0xb7cb('0xb')]('c.lastName',_0xb7cb('0x89'));_0x4fe1ce['field'](_0xb7cb('0x8a'),_0xb7cb('0x8b'));_0x4fe1ce[_0xb7cb('0xb')](_0xb7cb('0x8c'),_0xb7cb('0x8d'));_0x4fe1ce[_0xb7cb('0xb')](_0xb7cb('0x8e'),'Contact.mobile');_0x4fe1ce[_0xb7cb('0xb')]('c.fax','Contact.fax');_0x4fe1ce[_0xb7cb('0xb')](_0xb7cb('0x8f'),'Owner.fullname');_0x4fe1ce['field'](_0xb7cb('0x90'),_0xb7cb('0x91'));_0x4fe1ce['field'](_0xb7cb('0x92'),'TagIds');}if(_0x532434[_0xb7cb('0x93')]){_0x4fe1ce[_0xb7cb('0x93')](_0x532434[_0xb7cb('0x93')]);}if(_0x532434[_0xb7cb('0x94')]){_0x4fe1ce['offset'](_0x532434[_0xb7cb('0x94')]);}return db['sequelize']['query'](_0x4fe1ce[_0xb7cb('0x6c')](),_0x589307);})[_0xb7cb('0x58')](function(_0x2ac47a){_0x32fd4a=_0x2ac47a;var _0x4caf1f=getUsersQuery(_0x206e53,_0x32fd4a);return db[_0xb7cb('0x6a')]['query'](_0x4caf1f[_0xb7cb('0x6c')](),_0x589307);})[_0xb7cb('0x58')](function(_0x3a64c1){_0x220f49=_['groupBy'](_0x3a64c1,_0x7573f0);if(_0x206e53===_0xb7cb('0x31')){return db['Setting'][_0xb7cb('0x95')]({'attributes':[_0xb7cb('0x96')],'raw':!![]});}})[_0xb7cb('0x58')](function(_0x188e09){var _0x3b7371=_0x188e09?_0x188e09[_0xb7cb('0x96')]:undefined;var _0x14b6bc=_0x32fd4a[_0xb7cb('0x19')](function(_0x2e99a4){return updateInteraction(_0x2e99a4,_0x20ce8e,_0x220f49,_0x3b7371);});return Promise[_0xb7cb('0x97')](_0x14b6bc);});}function countFilteredInteractions(_0x190802,_0x4b27cd){var _0x10db6d=_0x190802['clone']();_0x10db6d[_0xb7cb('0xb')]('COUNT(*)');_0x10db6d[_0xb7cb('0xb')](_0xb7cb('0x70'),_0xb7cb('0x71'));var _0x3f1ee9=utils[_0xb7cb('0x98')](_0x4b27cd);if(!_[_0xb7cb('0x99')](_0x3f1ee9)){_0x10db6d['where'](_0xb7cb('0x9a'),_0x3f1ee9);}var _0x5d9af2={'type':db['Sequelize'][_0xb7cb('0x9b')]['SELECT'],'raw':!![]};return db[_0xb7cb('0x6a')][_0xb7cb('0x6b')](_0x10db6d[_0xb7cb('0x6c')](),_0x5d9af2);}module['exports']={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0x2c14=['QueryTypes','sequelize','query','toString','fields','attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','a.email','Account.email','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.disposition','i.secondDisposition','i.to','i.ContactId','i.MailAccountId','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','contactName','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','Setting','findOne','enableEmailPreview','clone','COUNT(*)','isEmpty','SELECT','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','./update-interaction','updateInteraction','./utils','../../mysqldb','getAccountFK','role','search','select','name','field','color','tools_tags','getInteractionFK','_interactions','u.fullname','from','left_join','u.id\x20=\x20ui.UserId','where','ui.','\x20IN\x20?','map','getInteractionsTables','interactions','users','o.id\x20=\x20i.UserId','messages','me.','\x20=\x20i.id','interactionsTags','it.','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','replace','escapeLIKESpecialChars','isNumeric','i.id\x20LIKE\x20?','sms','whatsapp','includes','i.phone\x20LIKE\x20?','fax','i.from\x20LIKE\x20?','mail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','sqlOperator','conditions','find','default','text','value','end','read','and','Contact','$substring','split','contact','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','Tag','tags','User','operator','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname,\x20o.internal)\x20LIKE\x20?','UserId','start','body','plainBody','keys','some','compact','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','then','tag','clause','filter','get','capitalize','chat','Websites','Accounts','resolve','agent','length','\x20IS\x20NULL','\x20IS\x20NOT\x20NULL','i.thirdDisposition','closed','i.substatus','shift','join','Interaction','Sequelize'];(function(_0x22589f,_0x3f33b7){var _0x4b1e54=function(_0x301401){while(--_0x301401){_0x22589f['push'](_0x22589f['shift']());}};_0x4b1e54(++_0x3f33b7);}(_0x2c14,0xe7));var _0x42c1=function(_0x71bea5,_0x5818b2){_0x71bea5=_0x71bea5-0x0;var _0x281d31=_0x2c14[_0x71bea5];return _0x281d31;};'use strict';var _=require(_0x42c1('0x0'));var squel=require(_0x42c1('0x1'));var as=require(_0x42c1('0x2'));var qs=require(_0x42c1('0x3'));var updateInteraction=require(_0x42c1('0x4'))[_0x42c1('0x5')];var utils=require(_0x42c1('0x6'));var db=require(_0x42c1('0x7'))['db'];function skipInteractionsQuery(_0x4055ed,_0x2ce8b6,_0x13f2c7){var _0x59fe01=![];var _0x4d2d93=utils[_0x42c1('0x8')](_0x4055ed);if(_0x2ce8b6[_0x42c1('0x9')]==='agent'&&!_0x13f2c7[_0x42c1('0xa')]&&!_0x13f2c7[_0x4d2d93]){_0x59fe01=!![];}return _0x59fe01;}function getTagsQuery(){return squel[_0x42c1('0xb')]()['field']('id')['field'](_0x42c1('0xc'))[_0x42c1('0xd')](_0x42c1('0xe'))['from'](_0x42c1('0xf'));}function getUsersQuery(_0x1576dd,_0x31b4f7){var _0xe253d2=utils[_0x42c1('0x10')](_0x1576dd);var _0x130473='user_has_'+_0x1576dd+_0x42c1('0x11');var _0x149ce3=squel[_0x42c1('0xb')]()['field']('u.id')['field'](_0x42c1('0x12'))['field']('ui.'+_0xe253d2)[_0x42c1('0x13')](_0x130473,'ui')[_0x42c1('0x14')]('users','u',_0x42c1('0x15'));if(_0x31b4f7['length']>0x0){_0x149ce3[_0x42c1('0x16')](_0x42c1('0x17')+_0xe253d2+_0x42c1('0x18'),_[_0x42c1('0x19')](_0x31b4f7,'id'));}return _0x149ce3;}function getInteractionsQuery(_0x200887){var _0x3d7519=utils[_0x42c1('0x1a')](_0x200887);var _0x35c5f0=utils['getAccountFK'](_0x200887);var _0x31a106=utils[_0x42c1('0x10')](_0x200887);return squel['select']()[_0x42c1('0x13')](_0x3d7519[_0x42c1('0x1b')],'i')[_0x42c1('0x14')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x42c1('0x14')](_0x42c1('0x1c'),'o',_0x42c1('0x1d'))['left_join'](_0x3d7519['accounts'],'a','a.id\x20=\x20i.'+_0x35c5f0)[_0x42c1('0x14')](_0x3d7519[_0x42c1('0x1e')],'me',_0x42c1('0x1f')+_0x31a106+_0x42c1('0x20'))[_0x42c1('0x14')](_0x3d7519[_0x42c1('0x21')],'it',_0x42c1('0x22')+_0x31a106+_0x42c1('0x20'))[_0x42c1('0x14')]('tools_tags','t',_0x42c1('0x23'));}function getSqlClauses(){var _0xbe9f91={'body':squel[_0x42c1('0x24')](),'contact':squel[_0x42c1('0x24')](),'default':squel[_0x42c1('0x24')](),'fields':squel[_0x42c1('0x24')](),'filter':squel[_0x42c1('0x24')](),'read':squel['expr'](),'tags':{'clause':squel[_0x42c1('0x24')](),'ids':null},'user':squel[_0x42c1('0x24')]()};return _0xbe9f91;}function parseTagParameter(_0xfb5e87){var _0x51bcda=squel['expr']();if(_0xfb5e87){var _0x14ab50=utils[_0x42c1('0x25')](_0xfb5e87);_0x14ab50[_0x42c1('0x26')](function(_0x47cc19){_0x51bcda['or'](_0x42c1('0x27'),'%,'+_0x47cc19+',%');});}return _0x51bcda;}function parseReadParameter(_0x481b31){var _0x2e5f1f='';if(_0x481b31){_0x2e5f1f=_0x42c1('0x28');if(_0x481b31==='1'){_0x2e5f1f=_0x2e5f1f[_0x42c1('0x29')]('{OPERATOR}','=');}else{_0x2e5f1f=_0x2e5f1f[_0x42c1('0x29')]('{OPERATOR}','>');}}return _0x2e5f1f;}function parseSearchFilter(_0x20648d,_0x8e6a49){var _0x5ea74c=squel[_0x42c1('0x24')]();if(_0x8e6a49){var _0x4c2fba=_0x8e6a49[_0x42c1('0x29')]('\x5c','\x5c\x5c')[_0x42c1('0x29')](/'/g,'\x27\x27');var _0x42f559=qs[_0x42c1('0x2a')](_0x4c2fba);if(qs[_0x42c1('0x2b')](_0x4c2fba)){_0x5ea74c['or'](_0x42c1('0x2c'),_0x42f559+'%');if([_0x42c1('0x2d'),_0x42c1('0x2e')][_0x42c1('0x2f')](_0x20648d)){_0x5ea74c['or'](_0x42c1('0x30'),_0x42f559+'%');}else if(_0x20648d===_0x42c1('0x31')){_0x5ea74c['or']('i.fax\x20LIKE\x20?',_0x42f559+'%');}else if(_0x20648d==='openchannel'){_0x5ea74c['or'](_0x42c1('0x32'),_0x42f559+'%');}}else if(_0x20648d===_0x42c1('0x33')&&qs['isEmail'](_0x4c2fba)){_0x5ea74c['or'](_0x42c1('0x34'),_0x42f559+'%');}else{if(_0x20648d===_0x42c1('0x33')){_0x5ea74c['or'](_0x42c1('0x35'),qs[_0x42c1('0x36')](_0x4c2fba,!![]))['or'](_0x42c1('0x37'),qs[_0x42c1('0x36')](_0x4c2fba));}else if(_0x20648d!==_0x42c1('0x31')){_0x5ea74c['or'](_0x42c1('0x38'),qs[_0x42c1('0x36')](_0x4c2fba));}_0x5ea74c['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x42c1('0x36')](_0x4c2fba,!![]),null);}}return _0x5ea74c;}function parseAdvancedSearchFilter(_0x114686,_0x394aab){var _0x4a9faa=getSqlClauses();var _0x3c449d=as[_0x42c1('0x39')](_0x114686);var _0x4fca70=_0x3c449d[_0x42c1('0x3a')];for(var _0xcb6463=0x0;_0xcb6463<_0x3c449d[_0x42c1('0x3b')]['length'];_0xcb6463++){var _0x36c8fb=_0x3c449d[_0x42c1('0x3b')][_0xcb6463];var _0x632fc1='i';var _0x5aa401=_[_0x42c1('0x3c')](_0x394aab,[_0x42c1('0xc'),_0x36c8fb[_0x42c1('0xd')]]);if(_0x5aa401){var _0x32140f=as['buildExpression'](_0x632fc1,_0x5aa401['type'],_0x36c8fb);_0x4a9faa[_0x42c1('0x3d')][_0x4fca70](_0x32140f[_0x42c1('0x3e')],_0x32140f[_0x42c1('0x3f')]['start'],_0x32140f[_0x42c1('0x3f')][_0x42c1('0x40')]);}else{switch(_0x36c8fb[_0x42c1('0xd')]){case'unreadMessages':var _0x29741d=parseReadParameter(_0x36c8fb[_0x42c1('0x3f')]);_0x4a9faa[_0x42c1('0x41')][_0x42c1('0x42')](_0x29741d);break;case _0x42c1('0x43'):if(_0x36c8fb['operator']===_0x42c1('0x44')){if(_0x36c8fb['value'][_0x42c1('0x45')]('\x20')['length']>0x1){_0x4a9faa[_0x42c1('0x46')][_0x4fca70](_0x42c1('0x47'),qs[_0x42c1('0x36')](_0x36c8fb[_0x42c1('0x3f')],!![]),null);}else{var _0x2d7c8f='%'+_0x36c8fb[_0x42c1('0x3f')]+'%';_0x4a9faa[_0x42c1('0x46')][_0x4fca70](_0x42c1('0x48'),_0x2d7c8f,_0x2d7c8f,_0x2d7c8f);}}else{_0x5aa401=_[_0x42c1('0x3c')](_0x394aab,['name','ContactId']);_0x36c8fb[_0x42c1('0xd')]=_0x42c1('0x49');_0x32140f=as[_0x42c1('0x4a')](_0x632fc1,_0x5aa401[_0x42c1('0x4b')],_0x36c8fb);_0x4a9faa['contact'][_0x4fca70](_0x32140f[_0x42c1('0x3e')],_0x32140f[_0x42c1('0x3f')]['start'],_0x32140f[_0x42c1('0x3f')][_0x42c1('0x40')]);}break;case _0x42c1('0x4c'):var _0x16df6e=_0x36c8fb[_0x42c1('0x3f')][_0x42c1('0x45')](',')[_0x42c1('0x19')](function(_0x3dd5db){return Number(_0x3dd5db);});var _0x42d5e4=parseTagParameter(_0x16df6e);_0x4a9faa[_0x42c1('0x4d')]['clause'][_0x42c1('0x42')](_0x42d5e4);_0x4a9faa['tags']['ids']=_0x16df6e;break;case _0x42c1('0x4e'):if(_0x36c8fb[_0x42c1('0x4f')]===_0x42c1('0x44')){_0x4a9faa[_0x42c1('0x50')][_0x4fca70](_0x42c1('0x51'),'%'+_0x36c8fb[_0x42c1('0x3f')]+'%',null);}else{_0x5aa401=_['find'](_0x394aab,[_0x42c1('0xc'),'UserId']);_0x36c8fb['field']=_0x42c1('0x52');_0x32140f=as[_0x42c1('0x4a')](_0x632fc1,_0x5aa401[_0x42c1('0x4b')],_0x36c8fb);_0x4a9faa['user'][_0x4fca70](_0x32140f['text'],_0x32140f[_0x42c1('0x3f')][_0x42c1('0x53')],_0x32140f[_0x42c1('0x3f')]['end']);}break;case _0x42c1('0x54'):case _0x42c1('0x55'):_0x32140f=as[_0x42c1('0x4a')]('me',null,_0x36c8fb);_0x4a9faa[_0x42c1('0x54')][_0x4fca70](_0x32140f[_0x42c1('0x3e')],_0x32140f['value'][_0x42c1('0x53')],_0x32140f[_0x42c1('0x3f')]['end']);break;}}}return _0x4a9faa;}function parseModelFields(_0x72a710,_0x334115,_0x3b62b3){var _0x40bda1=utils['getAccountFK'](_0x72a710);var _0x2e387d=squel[_0x42c1('0x24')]();var _0x2e7fb5=_(_0x334115)[_0x42c1('0x56')]()[_0x42c1('0x19')](function(_0xe2037d){return _[_0x42c1('0x57')](_0x3b62b3,[_0x42c1('0xc'),_0xe2037d])?_0xe2037d:undefined;})[_0x42c1('0x58')]()[_0x42c1('0x3f')]();if(_0x2e7fb5['length']>0x0){_0x2e7fb5[_0x42c1('0x26')](function(_0x272000){if(_0x272000===_0x40bda1){_0x2e387d[_0x42c1('0x42')]('i.'+_0x40bda1+_0x42c1('0x18'),[]['concat'](_0x334115[_0x272000]));}else if(_0x272000==='createdAt'){var _0xe99b02=JSON[_0x42c1('0x59')](_0x334115[_0x272000])['$gte'];var _0x43d775=JSON[_0x42c1('0x59')](_0x334115[_0x272000])[_0x42c1('0x5a')];_0x2e387d[_0x42c1('0x42')](_0x42c1('0x5b'),_0xe99b02,_0x43d775);}else{if(_0x334115[_0x272000]===_0x42c1('0x5c')){_0x2e387d[_0x42c1('0x42')]('i.'+_0x272000+'\x20IS\x20NULL');}else{_0x2e387d['and']('i.'+_0x272000+_0x42c1('0x5d'),_0x334115[_0x272000]);}}});}return _0x2e387d;}function parseQueryParameters(_0x1c719f,_0x902bc7,_0x2362e3){var _0x1e20a4=getSqlClauses();return Promise['resolve']()[_0x42c1('0x5e')](function(){return parseModelFields(_0x1c719f,_0x902bc7,_0x2362e3);})[_0x42c1('0x5e')](function(_0x5f569f){_0x1e20a4['fields'][_0x42c1('0x42')](_0x5f569f);return parseReadParameter(_0x902bc7['read']);})[_0x42c1('0x5e')](function(_0x5396a9){_0x1e20a4[_0x42c1('0x41')][_0x42c1('0x42')](_0x5396a9);return parseTagParameter(_0x902bc7[_0x42c1('0x5f')]);})[_0x42c1('0x5e')](function(_0xb16fff){_0x1e20a4[_0x42c1('0x4d')][_0x42c1('0x60')][_0x42c1('0x42')](_0xb16fff);return parseSearchFilter(_0x1c719f,_0x902bc7[_0x42c1('0x61')]);})[_0x42c1('0x5e')](function(_0x40504f){_0x1e20a4[_0x42c1('0x61')]=_0x40504f;return _0x1e20a4;});}function checkAccountsRestrictions(_0x5c31e6,_0x2317b8,_0x377b59){var _0x370189=utils[_0x42c1('0x8')](_0x5c31e6);var _0x55c6df=_0x42c1('0x62')+_[_0x42c1('0x63')](_0x5c31e6)+(_0x5c31e6===_0x42c1('0x64')?_0x42c1('0x65'):_0x42c1('0x66'));var _0x12a283=squel[_0x42c1('0x24')]();return Promise[_0x42c1('0x67')]()['then'](function(){if(_0x377b59['search']&&_0x2317b8[_0x42c1('0x9')]===_0x42c1('0x68')){return _0x2317b8[_0x55c6df]({'attributes':['id'],'raw':!![]});}})[_0x42c1('0x5e')](function(_0xcb658c){if(_0xcb658c){if(_0xcb658c[_0x42c1('0x69')]===0x0){_0x12a283[_0x42c1('0x42')]('i.'+_0x370189+_0x42c1('0x6a'));}else{_0x12a283[_0x42c1('0x42')]('i.'+_0x370189+_0x42c1('0x18'),_[_0x42c1('0x19')](_0xcb658c,'id'));}}else if(!_0x377b59[_0x370189]){_0x12a283[_0x42c1('0x42')]('i.'+_0x370189+_0x42c1('0x6b'));}})[_0x42c1('0x5e')](function(){return _0x12a283;});}function getClosedOrderClause(_0x438ea8,_0x2a5ed7){var _0xbbdf83='';var _0x545df2=[_0x42c1('0x6c'),'i.secondDisposition','i.disposition'];if(_0x438ea8===_0x42c1('0x33')){_0x545df2['unshift']('i.substatus');}if(_0x2a5ed7[_0x42c1('0x6d')]==='0'&&_0x438ea8==='mail'){_0xbbdf83=_0x42c1('0x6e');}else{if(_0x2a5ed7[_0x42c1('0x6d')]==='1'){_0x545df2[_0x42c1('0x6f')]();}_0xbbdf83='CONCAT_WS(\x27\x27,\x20'+_0x545df2[_0x42c1('0x70')](',\x20')+')';}return _0xbbdf83;}function getFilteredInteractions(_0x2461fd,_0x2d4454,_0x27ba7d,_0x5cc02b){var _0x34c448=utils['getInteractionFK'](_0x2461fd);var _0x11ec95=_[_0x42c1('0x63')](_0x2461fd)+_0x42c1('0x71');var _0x21f308=[];var _0x22ff56=getTagsQuery();var _0x57417f={'type':db[_0x42c1('0x72')][_0x42c1('0x73')]['SELECT'],'raw':!![]};var _0x2619ad=[];var _0x1b0851=[];return db[_0x42c1('0x74')][_0x42c1('0x75')](_0x22ff56[_0x42c1('0x76')](),_0x57417f)[_0x42c1('0x5e')](function(_0x46a4f1){_0x21f308=_['keyBy'](_0x46a4f1,'id');_0x57417f=_['merge'](_0x57417f,{'model':db[_0x11ec95],'mapToModel':!![],'nest':!![]});if(_0x27ba7d[_0x42c1('0x77')]){_0x5cc02b[_0x42c1('0x78')][_0x42c1('0x26')](function(_0xe90d5){_0x2d4454['field']('i.'+_0xe90d5);});}else{_0x2d4454[_0x42c1('0xd')](_0x42c1('0x79'),_0x42c1('0x7a'));_0x2d4454[_0x42c1('0xd')](_0x42c1('0x7b'),_0x42c1('0x7c'));_0x2d4454[_0x42c1('0xd')](_0x42c1('0x7d'),_0x42c1('0x7e'));if(_0x2461fd===_0x42c1('0x33')){_0x2d4454[_0x42c1('0xd')](_0x42c1('0x7f'),_0x42c1('0x80'));_0x2d4454['field']('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0x2d4454[_0x42c1('0xd')]('i.id');_0x2d4454[_0x42c1('0xd')]('i.createdAt');_0x2d4454['field'](_0x42c1('0x81'));_0x2d4454[_0x42c1('0xd')](_0x42c1('0x82'));_0x2d4454[_0x42c1('0xd')](_0x42c1('0x83'));_0x2d4454[_0x42c1('0xd')](_0x42c1('0x84'));_0x2d4454[_0x42c1('0xd')](_0x42c1('0x85'));_0x2d4454[_0x42c1('0xd')](_0x42c1('0x86'));_0x2d4454[_0x42c1('0xd')](_0x42c1('0x87'));_0x2d4454[_0x42c1('0xd')](_0x42c1('0x88'));_0x2d4454['field'](_0x42c1('0x89'));_0x2d4454[_0x42c1('0xd')](_0x42c1('0x6c'));_0x2d4454[_0x42c1('0xd')](_0x42c1('0x6e'));_0x2d4454[_0x42c1('0xd')](_0x42c1('0x8a'));_0x2d4454['field'](_0x42c1('0x8b'));_0x2d4454[_0x42c1('0xd')](_0x42c1('0x8c'));_0x2d4454['field'](_0x42c1('0x8d'));}else if(_0x2461fd===_0x42c1('0x8e')){_0x2d4454['field'](_0x42c1('0x8f'),_0x42c1('0x90'));}else{_0x2d4454[_0x42c1('0xd')](_0x42c1('0x91'),_0x42c1('0x90'));}if(_0x2461fd!==_0x42c1('0x33')){_0x2d4454[_0x42c1('0xd')](_0x42c1('0x92'));}_0x2d4454['field'](_0x42c1('0x93'),_0x42c1('0x94'));_0x2d4454[_0x42c1('0xd')](_0x42c1('0x95'),_0x42c1('0x96'));_0x2d4454[_0x42c1('0xd')](_0x42c1('0x97'),_0x42c1('0x98'));_0x2d4454[_0x42c1('0xd')](_0x42c1('0x99'),_0x42c1('0x9a'));_0x2d4454[_0x42c1('0xd')](_0x42c1('0x9b'),_0x42c1('0x9c'));_0x2d4454['field'](_0x42c1('0x9d'),_0x42c1('0x9e'));_0x2d4454[_0x42c1('0xd')](_0x42c1('0x9f'),_0x42c1('0xa0'));_0x2d4454[_0x42c1('0xd')]('o.internal','Owner.internal');_0x2d4454[_0x42c1('0xd')](_0x42c1('0xa1'),_0x42c1('0xa2'));}if(_0x5cc02b[_0x42c1('0xa3')]){_0x2d4454['limit'](_0x5cc02b[_0x42c1('0xa3')]);}if(_0x5cc02b[_0x42c1('0xa4')]){_0x2d4454['offset'](_0x5cc02b[_0x42c1('0xa4')]);}return db['sequelize']['query'](_0x2d4454['toString'](),_0x57417f);})[_0x42c1('0x5e')](function(_0x594582){_0x2619ad=_0x594582;var _0x30dcd7=getUsersQuery(_0x2461fd,_0x2619ad);return db[_0x42c1('0x74')][_0x42c1('0x75')](_0x30dcd7[_0x42c1('0x76')](),_0x57417f);})[_0x42c1('0x5e')](function(_0x17231f){_0x1b0851=_['groupBy'](_0x17231f,_0x34c448);if(_0x2461fd==='mail'){return db[_0x42c1('0xa5')][_0x42c1('0xa6')]({'attributes':[_0x42c1('0xa7')],'raw':!![]});}})[_0x42c1('0x5e')](function(_0x3074fd){var _0x2996f2=_0x3074fd?_0x3074fd[_0x42c1('0xa7')]:undefined;var _0x4f0f91=_0x2619ad[_0x42c1('0x19')](function(_0x546850){return updateInteraction(_0x546850,_0x21f308,_0x1b0851,_0x2996f2);});return Promise['all'](_0x4f0f91);});}function countFilteredInteractions(_0x2f1e00,_0x33af8f){var _0x3a71ee=_0x2f1e00[_0x42c1('0xa8')]();_0x3a71ee[_0x42c1('0xd')](_0x42c1('0xa9'));_0x3a71ee[_0x42c1('0xd')](_0x42c1('0x79'),_0x42c1('0x7a'));var _0xd3afca=utils['getSelectedTags'](_0x33af8f);if(!_[_0x42c1('0xaa')](_0xd3afca)){_0x3a71ee['where']('t.id\x20IN\x20?',_0xd3afca);}var _0x373ab3={'type':db[_0x42c1('0x72')][_0x42c1('0x73')][_0x42c1('0xab')],'raw':!![]};return db[_0x42c1('0x74')][_0x42c1('0x75')](_0x3a71ee[_0x42c1('0x76')](),_0x373ab3);}module[_0x42c1('0xac')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file diff --git a/server/components/interaction/update-interaction.js b/server/components/interaction/update-interaction.js index 64ad1f2..749b141 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 _0xfb29=['out','plainBody','then','lastMsgText','trimStart','catch','updateInteraction','Users','Tags','TagIds','lodash','../../mysqldb','map','fullname','forEach','push','waiting','answered','unmanaged','abandoned','total','closed','disposition','UserId','MailMessage'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xfb29,0x104));var _0x9fb2=function(_0x591ce6,_0x1c93e4){_0x591ce6=_0x591ce6-0x0;var _0x10ee0e=_0xfb29[_0x591ce6];return _0x10ee0e;};'use strict';var _=require(_0x9fb2('0x0'));var db=require(_0x9fb2('0x1'))['db'];function getInteractionUsers(_0x34d82a,_0x1b960b){return new Promise(function(_0x542d9d,_0x58be75){try{var _0x2f2d57=[];if(_0x1b960b[_0x34d82a]){_0x2f2d57=_0x1b960b[_0x34d82a][_0x9fb2('0x2')](function(_0x340f33){return{'id':_0x340f33['id'],'fullname':_0x340f33[_0x9fb2('0x3')]};});}return _0x542d9d(_0x2f2d57);}catch(_0x5a80d4){_0x58be75(_0x5a80d4);}});}function getInteractionTags(_0x341e2e,_0x3f1023){var _0x16c91b=[];if(_0x341e2e){_0x341e2e['split'](',')[_0x9fb2('0x4')](function(_0x24b351){_0x16c91b[_0x9fb2('0x5')](_0x3f1023[_0x24b351]);});}return _0x16c91b;}function updateWaitingCounter(_0x31ad05){if(_0x31ad05[_0x9fb2('0x6')]){_0x31ad05[_0x9fb2('0x6')]-=0x1;}}function updateInteractionCounters(_0x15871a){_0x15871a[_0x9fb2('0x6')]=0x0;_0x15871a['talking']=0x0;_0x15871a[_0x9fb2('0x7')]=0x0;_0x15871a[_0x9fb2('0x8')]=0x0;_0x15871a[_0x9fb2('0x9')]=0x0;_0x15871a[_0x9fb2('0xa')]=0x0;if(_0x15871a[_0x9fb2('0xb')]){if(_0x15871a[_0x9fb2('0xc')]==='abandoned'){_0x15871a[_0x9fb2('0x9')]+=0x1;updateWaitingCounter(_0x15871a);}if(_0x15871a['UserId']){_0x15871a[_0x9fb2('0x7')]+=0x1;if(_0x15871a['talking']){_0x15871a['talking']-=0x1;}}else{if(_0x15871a[_0x9fb2('0xc')]){_0x15871a[_0x9fb2('0x8')]+=0x1;updateWaitingCounter(_0x15871a);}}}else{if(!_0x15871a[_0x9fb2('0xd')]){_0x15871a[_0x9fb2('0x6')]+=0x1;}if(_0x15871a[_0x9fb2('0xd')]){_0x15871a['talking']+=0x1;updateWaitingCounter(_0x15871a);}}_0x15871a[_0x9fb2('0xa')]+=0x1;return _0x15871a;}function getLastMessageText(_0x5d1d50){return db[_0x9fb2('0xe')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x5d1d50['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x9fb2('0xf')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x9fb2('0x10')],'order':'-id','raw':!![]})[_0x9fb2('0x11')](function(_0x5c8b27){if(_0x5c8b27&&_0x5c8b27[_0x9fb2('0x10')]){_0x5d1d50[_0x9fb2('0x12')]=_[_0x9fb2('0x13')](_0x5c8b27[_0x9fb2('0x10')]);}return _0x5d1d50;})[_0x9fb2('0x14')](function(_0x8e9962){throw _0x8e9962;});}exports[_0x9fb2('0x15')]=function(_0x239d61,_0x1f5f19,_0x3447fb,_0x14e057){return new Promise(function(_0x205a0e,_0x561b14){return getInteractionUsers(_0x239d61['id'],_0x3447fb)[_0x9fb2('0x11')](function(_0x113428){_0x239d61[_0x9fb2('0x16')]=_0x113428;return getInteractionTags(_0x239d61['TagIds'],_0x1f5f19);})['then'](function(_0x3d8093){_0x239d61[_0x9fb2('0x17')]=_0x3d8093;delete _0x239d61[_0x9fb2('0x18')];return updateInteractionCounters(_0x239d61);})[_0x9fb2('0x11')](function(_0x4e5be2){if(_0x14e057){return getLastMessageText(_0x4e5be2);}else{return _0x4e5be2;}})['then'](function(_0x5965b9){_0x205a0e(_0x5965b9);})[_0x9fb2('0x14')](function(_0x3dadb1){_0x561b14(_0x3dadb1);});});}; \ No newline at end of file +var _0xc3ba=['lodash','../../mysqldb','fullname','split','forEach','waiting','talking','answered','unmanaged','abandoned','total','disposition','UserId','MailMessage','findOne','out','-id','then','plainBody','trimStart','updateInteraction','Tags','TagIds','catch'];(function(_0x135ce4,_0x2b2438){var _0x3c1a2b=function(_0x5ede44){while(--_0x5ede44){_0x135ce4['push'](_0x135ce4['shift']());}};_0x3c1a2b(++_0x2b2438);}(_0xc3ba,0x1e0));var _0xac3b=function(_0x4eaca5,_0x1697dc){_0x4eaca5=_0x4eaca5-0x0;var _0x14eba7=_0xc3ba[_0x4eaca5];return _0x14eba7;};'use strict';var _=require(_0xac3b('0x0'));var db=require(_0xac3b('0x1'))['db'];function getInteractionUsers(_0x3c2e4e,_0x2c38ee){return new Promise(function(_0x4cb2c9,_0xa72a90){try{var _0x1e91b9=[];if(_0x2c38ee[_0x3c2e4e]){_0x1e91b9=_0x2c38ee[_0x3c2e4e]['map'](function(_0x5604c3){return{'id':_0x5604c3['id'],'fullname':_0x5604c3[_0xac3b('0x2')]};});}return _0x4cb2c9(_0x1e91b9);}catch(_0x5027ff){_0xa72a90(_0x5027ff);}});}function getInteractionTags(_0x2c5b12,_0x2f616d){var _0x1d2d6d=[];if(_0x2c5b12){_0x2c5b12[_0xac3b('0x3')](',')[_0xac3b('0x4')](function(_0x458e44){_0x1d2d6d['push'](_0x2f616d[_0x458e44]);});}return _0x1d2d6d;}function updateWaitingCounter(_0x198053){if(_0x198053['waiting']){_0x198053[_0xac3b('0x5')]-=0x1;}}function updateInteractionCounters(_0xf7f4fb){_0xf7f4fb['waiting']=0x0;_0xf7f4fb[_0xac3b('0x6')]=0x0;_0xf7f4fb[_0xac3b('0x7')]=0x0;_0xf7f4fb[_0xac3b('0x8')]=0x0;_0xf7f4fb[_0xac3b('0x9')]=0x0;_0xf7f4fb[_0xac3b('0xa')]=0x0;if(_0xf7f4fb['closed']){if(_0xf7f4fb[_0xac3b('0xb')]===_0xac3b('0x9')){_0xf7f4fb[_0xac3b('0x9')]+=0x1;updateWaitingCounter(_0xf7f4fb);}if(_0xf7f4fb[_0xac3b('0xc')]){_0xf7f4fb[_0xac3b('0x7')]+=0x1;if(_0xf7f4fb[_0xac3b('0x6')]){_0xf7f4fb['talking']-=0x1;}}else{if(_0xf7f4fb[_0xac3b('0xb')]){_0xf7f4fb[_0xac3b('0x8')]+=0x1;updateWaitingCounter(_0xf7f4fb);}}}else{if(!_0xf7f4fb['UserId']){_0xf7f4fb[_0xac3b('0x5')]+=0x1;}if(_0xf7f4fb[_0xac3b('0xc')]){_0xf7f4fb['talking']+=0x1;updateWaitingCounter(_0xf7f4fb);}}_0xf7f4fb['total']+=0x1;return _0xf7f4fb;}function getLastMessageText(_0x6171ea){return db[_0xac3b('0xd')][_0xac3b('0xe')]({'where':{'$and':[{'MailInteractionId':_0x6171ea['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xac3b('0xf')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0xac3b('0x10'),'raw':!![]})[_0xac3b('0x11')](function(_0x1c17c6){if(_0x1c17c6&&_0x1c17c6[_0xac3b('0x12')]){_0x6171ea['lastMsgText']=_[_0xac3b('0x13')](_0x1c17c6['plainBody']);}return _0x6171ea;})['catch'](function(_0x54ac85){throw _0x54ac85;});}exports[_0xac3b('0x14')]=function(_0x5baca1,_0x3a8fbd,_0x4a6cd6,_0x37b7df){return new Promise(function(_0x1a34cf,_0x2a9232){return getInteractionUsers(_0x5baca1['id'],_0x4a6cd6)['then'](function(_0x44c46a){_0x5baca1['Users']=_0x44c46a;return getInteractionTags(_0x5baca1['TagIds'],_0x3a8fbd);})[_0xac3b('0x11')](function(_0x1194c5){_0x5baca1[_0xac3b('0x15')]=_0x1194c5;delete _0x5baca1[_0xac3b('0x16')];return updateInteractionCounters(_0x5baca1);})['then'](function(_0x1158e6){if(_0x37b7df){return getLastMessageText(_0x1158e6);}else{return _0x1158e6;}})[_0xac3b('0x11')](function(_0x4aaaf2){_0x1a34cf(_0x4aaaf2);})[_0xac3b('0x17')](function(_0x282911){_0x2a9232(_0x282911);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index 8f46631..09725e9 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 _0x364d=['toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null','Interaction','findOne','then','update','info','MESSAGE:ACCEPT]\x20id=','\x20name=','\x20body=','exports','lodash','../../mysqldb','../../config/logger','mail-interactions','sms-interactions','chat-interactions','capitalize','chat','Website','InteractionId','upperFirst','unknown','accounts','_interactions','_interaction_has_tags','user_has_','isArray'];(function(_0x4f517f,_0x15e66f){var _0x48bc81=function(_0x275f58){while(--_0x275f58){_0x4f517f['push'](_0x4f517f['shift']());}};_0x48bc81(++_0x15e66f);}(_0x364d,0xb5));var _0xd364=function(_0x871ccd,_0x225e43){_0x871ccd=_0x871ccd-0x0;var _0x5d2acd=_0x364d[_0x871ccd];return _0x5d2acd;};'use strict';var _=require(_0xd364('0x0'));var db=require(_0xd364('0x1'))['db'];var loggers={'openchannel':require(_0xd364('0x2'))('openchannel-interactions'),'mail':require(_0xd364('0x2'))(_0xd364('0x3')),'fax':require(_0xd364('0x2'))('fax-interactions'),'sms':require('../../config/logger')(_0xd364('0x4')),'chat':require('../../config/logger')(_0xd364('0x5')),'whatsapp':require(_0xd364('0x2'))('whatsapp-interactions')};function getAccountFK(_0x1f915b){return _[_0xd364('0x6')](_0x1f915b)+(_0x1f915b===_0xd364('0x7')?_0xd364('0x8'):'Account')+'Id';}function getInteractionFK(_0x490bc9){return _[_0xd364('0x6')](_0x490bc9)+_0xd364('0x9');}function getInteractionId(_0x19184b,_0x407cfd,_0x5b747b){if(_0x19184b&&_0x19184b[_['upperFirst'](_0x5b747b)+_0xd364('0x9')]){return _0x19184b[_[_0xd364('0xa')](_0x5b747b)+'InteractionId'];}else if(_0x19184b&&_0x19184b['id']){return _0x19184b['id'];}else if(_0x407cfd&&_0x407cfd['id']){return _0x407cfd['id'];}else{return _0xd364('0xb');}}function getInteractionsTables(_0x13c102){return{'accounts':_0x13c102+'_'+(_0x13c102===_0xd364('0x7')?'websites':_0xd364('0xc')),'interactions':_0x13c102+_0xd364('0xd'),'interactionsTags':_0x13c102+_0xd364('0xe'),'messages':_0x13c102+'_messages','userInteractions':_0xd364('0xf')+_0x13c102+_0xd364('0xd')};}function getSelectedTags(_0x383259){var _0x1f010b=[];if(_0x383259){_0x1f010b=Array[_0xd364('0x10')](_0x383259)?_0x383259:[_0x383259];}return _0x1f010b;}function log(_0xe6c66c,_0x57a30b,_0x43d90b,_0x3f1be1,_0x532971,_0x3572a7){loggers[_0x532971[_0xd364('0x11')]()][_0xe6c66c](_0xd364('0x12'),_0x3572a7[_0xd364('0x13')](),_0x57a30b?_0x57a30b['id']:null,_0x57a30b?_0x57a30b[_0xd364('0x14')]:null,_0x57a30b?_0x57a30b[_0xd364('0x15')]:null,getInteractionId(_0x43d90b,_0x3f1be1,_0x532971),_0x43d90b?JSON[_0xd364('0x16')](_0x43d90b):_0xd364('0x17'));}function updateUser(_0x1e1082,_0x366918,_0x5e316b,_0x1fa9f3,_0x55d7ea){db[_[_0xd364('0xa')](_0x1fa9f3)+_0xd364('0x18')][_0xd364('0x19')]({'where':{'id':getInteractionId(_0x366918,_0x5e316b,_0x1fa9f3)}})[_0xd364('0x1a')](function(_0x1e7cbf){if(_0x1e7cbf){return _0x1e7cbf[_0xd364('0x1b')]({'UserId':_0x1e1082?_0x1e1082['id']:null});}})[_0xd364('0x1a')](function(_0x53643f){if(_0x53643f){log(_0xd364('0x1c'),_0x1e1082,_0x366918,_0x5e316b,_0x1fa9f3,_0x55d7ea);}})['catch'](function(){log('error',_0x1e1082,_0x366918,_0x5e316b,_0x1fa9f3,_0x55d7ea);});}function logAcceptMessage(_0x377bc3,_0x3f68ca,_0x32571e,_0x3dc817){var _0x26d635=loggers[_0x377bc3[_0xd364('0x11')]()];var _0x332bd1=_0x3f68ca['id'];var _0x107b50=_0x3f68ca[_0xd364('0x14')];var _0x4f63fa=_0x3f68ca[_0xd364('0x15')];var _0x14fa92=JSON['stringify'](_0x3dc817||null);_0x26d635[_0xd364('0x1c')]('['+_0x377bc3[_0xd364('0x13')]()+_0xd364('0x1d')+_0x332bd1+_0xd364('0x1e')+_0x107b50+'\x20role='+_0x4f63fa+'\x20interaction='+_0x32571e+_0xd364('0x1f')+_0x14fa92);}module[_0xd364('0x20')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'logAcceptMessage':logAcceptMessage,'updateUser':updateUser}; \ No newline at end of file +var _0xddfc=['Account','InteractionId','upperFirst','unknown','websites','accounts','_interactions','_interaction_has_tags','_messages','user_has_','isArray','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null','Interaction','then','update','info','catch','error','toLowerCase','MESSAGE:ACCEPT]\x20id=','\x20name=','\x20role=','\x20interaction=','\x20body=','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','capitalize','chat','Website'];(function(_0x280598,_0x4675ef){var _0x4d7c9f=function(_0x1ffb24){while(--_0x1ffb24){_0x280598['push'](_0x280598['shift']());}};_0x4d7c9f(++_0x4675ef);}(_0xddfc,0x6f));var _0xcddf=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0xddfc[_0x263a74];return _0x2aa86c;};'use strict';var _=require(_0xcddf('0x0'));var db=require(_0xcddf('0x1'))['db'];var loggers={'openchannel':require(_0xcddf('0x2'))(_0xcddf('0x3')),'mail':require(_0xcddf('0x2'))(_0xcddf('0x4')),'fax':require(_0xcddf('0x2'))(_0xcddf('0x5')),'sms':require(_0xcddf('0x2'))(_0xcddf('0x6')),'chat':require(_0xcddf('0x2'))(_0xcddf('0x7')),'whatsapp':require(_0xcddf('0x2'))(_0xcddf('0x8'))};function getAccountFK(_0x366fe9){return _[_0xcddf('0x9')](_0x366fe9)+(_0x366fe9===_0xcddf('0xa')?_0xcddf('0xb'):_0xcddf('0xc'))+'Id';}function getInteractionFK(_0x21b75f){return _[_0xcddf('0x9')](_0x21b75f)+_0xcddf('0xd');}function getInteractionId(_0x3c5dcc,_0x3376f8,_0x10a0fd){if(_0x3c5dcc&&_0x3c5dcc[_[_0xcddf('0xe')](_0x10a0fd)+_0xcddf('0xd')]){return _0x3c5dcc[_[_0xcddf('0xe')](_0x10a0fd)+_0xcddf('0xd')];}else if(_0x3c5dcc&&_0x3c5dcc['id']){return _0x3c5dcc['id'];}else if(_0x3376f8&&_0x3376f8['id']){return _0x3376f8['id'];}else{return _0xcddf('0xf');}}function getInteractionsTables(_0x3a8eab){return{'accounts':_0x3a8eab+'_'+(_0x3a8eab===_0xcddf('0xa')?_0xcddf('0x10'):_0xcddf('0x11')),'interactions':_0x3a8eab+_0xcddf('0x12'),'interactionsTags':_0x3a8eab+_0xcddf('0x13'),'messages':_0x3a8eab+_0xcddf('0x14'),'userInteractions':_0xcddf('0x15')+_0x3a8eab+'_interactions'};}function getSelectedTags(_0x20fd8e){var _0x1d7001=[];if(_0x20fd8e){_0x1d7001=Array[_0xcddf('0x16')](_0x20fd8e)?_0x20fd8e:[_0x20fd8e];}return _0x1d7001;}function log(_0x1c179a,_0x5e4809,_0x51da0f,_0x34f24f,_0x23fee9,_0x3309ad){loggers[_0x23fee9['toLowerCase']()][_0x1c179a](_0xcddf('0x17'),_0x3309ad[_0xcddf('0x18')](),_0x5e4809?_0x5e4809['id']:null,_0x5e4809?_0x5e4809[_0xcddf('0x19')]:null,_0x5e4809?_0x5e4809[_0xcddf('0x1a')]:null,getInteractionId(_0x51da0f,_0x34f24f,_0x23fee9),_0x51da0f?JSON[_0xcddf('0x1b')](_0x51da0f):_0xcddf('0x1c'));}function updateUser(_0x4aa714,_0x5658a6,_0x5e6036,_0x595f7c,_0x5469eb){db[_['upperFirst'](_0x595f7c)+_0xcddf('0x1d')]['findOne']({'where':{'id':getInteractionId(_0x5658a6,_0x5e6036,_0x595f7c)}})[_0xcddf('0x1e')](function(_0x4754cf){if(_0x4754cf){return _0x4754cf[_0xcddf('0x1f')]({'UserId':_0x4aa714?_0x4aa714['id']:null});}})[_0xcddf('0x1e')](function(_0xa0b804){if(_0xa0b804){log(_0xcddf('0x20'),_0x4aa714,_0x5658a6,_0x5e6036,_0x595f7c,_0x5469eb);}})[_0xcddf('0x21')](function(){log(_0xcddf('0x22'),_0x4aa714,_0x5658a6,_0x5e6036,_0x595f7c,_0x5469eb);});}function logAcceptMessage(_0x42e1b2,_0x1e4554,_0x133f59,_0x4cfd91){var _0x1a9c9e=loggers[_0x42e1b2[_0xcddf('0x23')]()];var _0x722da4=_0x1e4554['id'];var _0x4cb385=_0x1e4554[_0xcddf('0x19')];var _0xe4e3d4=_0x1e4554[_0xcddf('0x1a')];var _0x24e9b1=JSON['stringify'](_0x4cfd91||null);_0x1a9c9e['info']('['+_0x42e1b2[_0xcddf('0x18')]()+_0xcddf('0x24')+_0x722da4+_0xcddf('0x25')+_0x4cb385+_0xcddf('0x26')+_0xe4e3d4+_0xcddf('0x27')+_0x133f59+_0xcddf('0x28')+_0x24e9b1);}module['exports']={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'logAcceptMessage':logAcceptMessage,'updateUser':updateUser}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index c0470f2..386584b 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 _0x91d2=['crypto','util','composable-middleware','../../config/environment','data1','split','createDecipher','aes-256-ctr','%s:%s:%s','update','base64','utf8','final','parse','License','findOne','then','count','status','json','format','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','user','isUserLimit'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x91d2,0x188));var _0x291d=function(_0x231567,_0x3617fc){_0x231567=_0x231567-0x0;var _0x37e4ee=_0x91d2[_0x231567];return _0x37e4ee;};'use strict';var crypto=require(_0x291d('0x0'));var util=require(_0x291d('0x1'));var compose=require(_0x291d('0x2'));var db=require('../../mysqldb')['db'];var config=require(_0x291d('0x3'));function getValueFromLicense(_0x1595e6,_0x4af37a){if(_0x1595e6&&_0x4af37a){if(_0x4af37a[_0x291d('0x4')]&&_0x4af37a['license']){var _0xc2febe=_0x4af37a[_0x291d('0x4')];var _0x18ae71=_0x4af37a['license'];var _0x10031f=_0xc2febe[_0x291d('0x5')]('-')[0x4];var _0x3b934c=_0xc2febe[_0x291d('0x5')]('-')[0x0];var _0x3a76df=crypto[_0x291d('0x6')](_0x291d('0x7'),util['format'](_0x291d('0x8'),_0x10031f,_0xc2febe,_0x3b934c));var _0x411c93=_0x3a76df[_0x291d('0x9')](_0x18ae71,_0x291d('0xa'),_0x291d('0xb'));_0x411c93+=_0x3a76df[_0x291d('0xc')](_0x291d('0xb'));var _0x44141d=JSON[_0x291d('0xd')](_0x411c93);return _0x44141d['hasOwnProperty'](_0x1595e6)?_0x44141d[_0x1595e6]:null;}}return null;}function isLimit(_0xafd357,_0x376435,_0x484550,_0x30f2da){var _0x245673=_0x376435;return compose()['use'](function(_0xd61ee2,_0x4ff7e6,_0x35fd59){return db[_0x291d('0xe')][_0x291d('0xf')]({'where':{'id':0x1},'raw':!![]})[_0x291d('0x10')](function(_0x134611){var _0x367368=getValueFromLicense(_0xafd357,_0x134611);return _0x367368?_0x367368:_0x245673;})['then'](function(_0x2be9ef){_0x245673=_0x2be9ef;return _0x484550[_0x291d('0x11')](_0x30f2da);})[_0x291d('0x10')](function(_0x12d16d){if(_0x12d16d>=_0x245673){return _0x4ff7e6[_0x291d('0x12')](0x193)[_0x291d('0x13')]({'message':util[_0x291d('0x14')](_0x291d('0x15'),_0xafd357)});}_0x35fd59();})[_0x291d('0x16')](function(_0x572146){_0x35fd59(_0x572146);});});}function isUserLimit(){return isLimit(_0x291d('0x17'),0x1,db[_0x291d('0x18')],{'where':{'$or':[{'role':_0x291d('0x19')},{'role':_0x291d('0x1a')}]}});}exports[_0x291d('0x1b')]=isUserLimit; \ No newline at end of file +var _0x8cc7=['aes-256-ctr','format','update','base64','utf8','final','parse','hasOwnProperty','use','License','findOne','then','count','json','admin','user','isUserLimit','crypto','util','../../config/environment','data1','license','split','createDecipher'];(function(_0xa398c3,_0x115f87){var _0x53d3e0=function(_0xf0d186){while(--_0xf0d186){_0xa398c3['push'](_0xa398c3['shift']());}};_0x53d3e0(++_0x115f87);}(_0x8cc7,0x1f1));var _0x78cc=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x8cc7[_0xa1e3e3];return _0xc980e9;};'use strict';var crypto=require(_0x78cc('0x0'));var util=require(_0x78cc('0x1'));var compose=require('composable-middleware');var db=require('../../mysqldb')['db'];var config=require(_0x78cc('0x2'));function getValueFromLicense(_0x1d0e02,_0x3db261){if(_0x1d0e02&&_0x3db261){if(_0x3db261[_0x78cc('0x3')]&&_0x3db261[_0x78cc('0x4')]){var _0x1b6eda=_0x3db261[_0x78cc('0x3')];var _0x33b654=_0x3db261['license'];var _0xf994f9=_0x1b6eda[_0x78cc('0x5')]('-')[0x4];var _0x8b4e76=_0x1b6eda[_0x78cc('0x5')]('-')[0x0];var _0x557e03=crypto[_0x78cc('0x6')](_0x78cc('0x7'),util[_0x78cc('0x8')]('%s:%s:%s',_0xf994f9,_0x1b6eda,_0x8b4e76));var _0x553194=_0x557e03[_0x78cc('0x9')](_0x33b654,_0x78cc('0xa'),_0x78cc('0xb'));_0x553194+=_0x557e03[_0x78cc('0xc')](_0x78cc('0xb'));var _0x3ce926=JSON[_0x78cc('0xd')](_0x553194);return _0x3ce926[_0x78cc('0xe')](_0x1d0e02)?_0x3ce926[_0x1d0e02]:null;}}return null;}function isLimit(_0x31bfdb,_0x1d874a,_0x3dae4,_0x462dd5){var _0x531547=_0x1d874a;return compose()[_0x78cc('0xf')](function(_0x4b81a3,_0xbf9cb2,_0xb0485){return db[_0x78cc('0x10')][_0x78cc('0x11')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x5e420d){var _0x4b027c=getValueFromLicense(_0x31bfdb,_0x5e420d);return _0x4b027c?_0x4b027c:_0x531547;})[_0x78cc('0x12')](function(_0x430c92){_0x531547=_0x430c92;return _0x3dae4[_0x78cc('0x13')](_0x462dd5);})[_0x78cc('0x12')](function(_0x2dc668){if(_0x2dc668>=_0x531547){return _0xbf9cb2['status'](0x193)[_0x78cc('0x14')]({'message':util['format']('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x31bfdb)});}_0xb0485();})['catch'](function(_0x26ee10){_0xb0485(_0x26ee10);});});}function isUserLimit(){return isLimit('users',0x1,db['User'],{'where':{'$or':[{'role':_0x78cc('0x15')},{'role':_0x78cc('0x16')}]}});}exports[_0x78cc('0x17')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index e6a2e3a..822d1dd 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 _0xaf17=['push','DATE','operator','$eq','$between','value','includes','$gt','add','text','CAST(','field','\x20AS\x20','castTo','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','$endsWith','$lt','<\x20?','>\x20?','$lte','>=\x20?','start','pop','format','hours','minutes','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','and','replace','[$and]','[$or]','split','forEach','shift','match','filter','map','conditions'];(function(_0x2e7a43,_0x3b3df4){var _0x52e9e1=function(_0x2c08cf){while(--_0x2c08cf){_0x2e7a43['push'](_0x2e7a43['shift']());}};_0x52e9e1(++_0x3b3df4);}(_0xaf17,0x8f));var _0x7af1=function(_0x77650a,_0x467483){_0x77650a=_0x77650a-0x0;var _0x53f0d3=_0xaf17[_0x77650a];return _0x53f0d3;};'use strict';var _=require(_0x7af1('0x0'));var moment=require(_0x7af1('0x1'));exports[_0x7af1('0x2')]=function(_0x36ed75){var _0x1d760c={'conditions':[]};_0x1d760c[_0x7af1('0x3')]=_[_0x7af1('0x4')](_0x36ed75,'[$or]')?'or':_0x7af1('0x5');var _0x1934c9=_0x36ed75[_0x7af1('0x6')](_0x7af1('0x7'),'')[_0x7af1('0x6')](_0x7af1('0x8'),'')[_0x7af1('0x9')]('||');for(var _0x108884=0x0;_0x108884<_0x1934c9['length'];_0x108884++){var _0x4ba1f1=_0x1934c9[_0x108884]['split'](':=');var _0x7a2992=_0x4ba1f1[0x0];var _0x39c138=_0x4ba1f1['slice'](0x1);_0x39c138[_0x7af1('0xa')](function(_0x48260c){var _0x3773d0=_0x48260c[_0x7af1('0x9')]('[')[_0x7af1('0xb')]();var _0x395189=_0x48260c[_0x7af1('0xc')](/\[(.*?)\]/g);_0x395189['forEach'](function(_0x30f774){var _0x30819d=_0x30f774[_0x7af1('0x9')]('[')[_0x7af1('0xd')](function(_0x26169e){return _0x26169e['indexOf'](']')>-0x1;})[_0x7af1('0xe')](function(_0x9ea70d){return _0x9ea70d[_0x7af1('0x9')](']')[0x0];})[0x0];_0x1d760c[_0x7af1('0xf')][_0x7af1('0x10')]({'field':_0x7a2992,'operator':_0x3773d0,'value':_0x30819d});});});}return _0x1d760c;};exports['buildExpression']=function(_0x438eaf,_0x58f0d9,_0x418037){var _0x46ac99={};if(_0x58f0d9===_0x7af1('0x11')){if(_0x418037[_0x7af1('0x12')]===_0x7af1('0x13')){_0x418037['operator']=_0x7af1('0x14');_0x418037['value']+=','+_0x418037[_0x7af1('0x15')];}else if(_[_0x7af1('0x16')]([_0x7af1('0x17'),'$lte'],_0x418037['operator'])){_0x418037['value']=moment(_0x418037[_0x7af1('0x15')])[_0x7af1('0x18')](0x1,'days')['format']('YYYY-MM-DD');}}if(_0x418037['castTo']){_0x58f0d9=_0x418037['castTo'];_0x46ac99[_0x7af1('0x19')]=_0x7af1('0x1a')+_0x438eaf+'.'+_0x418037[_0x7af1('0x1b')]+_0x7af1('0x1c')+_0x418037[_0x7af1('0x1d')]+')\x20'+parseOperator(_0x418037[_0x7af1('0x12')]);}else{_0x46ac99[_0x7af1('0x19')]=_0x438eaf+'.'+_0x418037[_0x7af1('0x1b')]+'\x20'+parseOperator(_0x418037['operator']);}if(_[_0x7af1('0x16')]([_0x7af1('0x1e'),_0x7af1('0x1f')],_0x418037[_0x7af1('0x12')]))_0x46ac99['text']='('+_0x46ac99[_0x7af1('0x19')]+_0x7af1('0x20')+_0x438eaf+'.'+_0x418037[_0x7af1('0x1b')]+_0x7af1('0x21');_0x46ac99[_0x7af1('0x15')]=parseValue(_0x58f0d9,_0x418037[_0x7af1('0x12')],_0x418037[_0x7af1('0x15')]);return _0x46ac99;};function parseOperator(_0x10af68){var _0xf276d3;switch(_0x10af68){case _0x7af1('0x22'):_0xf276d3=_0x7af1('0x23');break;case _0x7af1('0x1f'):_0xf276d3=_0x7af1('0x24');break;case _0x7af1('0x13'):_0xf276d3=_0x7af1('0x25');break;case'$ne':_0xf276d3=_0x7af1('0x26');break;case _0x7af1('0x27'):case _0x7af1('0x28'):case _0x7af1('0x29'):_0xf276d3='LIKE\x20?';break;case _0x7af1('0x2a'):_0xf276d3=_0x7af1('0x2b');break;case _0x7af1('0x17'):_0xf276d3=_0x7af1('0x2c');break;case _0x7af1('0x2d'):_0xf276d3='<=\x20?';break;case'$gte':_0xf276d3=_0x7af1('0x2e');break;case _0x7af1('0x14'):_0xf276d3='BETWEEN\x20?\x20AND\x20?';break;}return _0xf276d3;}function parseValue(_0x3cc84e,_0x53be27,_0xf05e11){var _0x596d82={'start':undefined,'end':undefined};switch(_0x53be27){case _0x7af1('0x22'):case _0x7af1('0x1f'):_0x596d82['start']=_0xf05e11[_0x7af1('0x9')](',');break;case _0x7af1('0x27'):_0x596d82[_0x7af1('0x2f')]='%'+_0xf05e11+'%';break;case'$startsWith':_0x596d82[_0x7af1('0x2f')]=_0xf05e11+'%';break;case _0x7af1('0x29'):_0x596d82[_0x7af1('0x2f')]='%'+_0xf05e11;break;case _0x7af1('0x14'):var _0xfef031=_0xf05e11[_0x7af1('0x9')](',');var _0xf05e11=_0xfef031[_0x7af1('0xb')]();var _0x5e967a=_0xfef031[_0x7af1('0x30')]();if(_0x3cc84e===_0x7af1('0x11')){_0xf05e11=moment(_0xf05e11)['utcOffset'](0x0,!![])[_0x7af1('0x31')]();_0x5e967a=moment(_0x5e967a)['utcOffset'](0x0,!![])[_0x7af1('0x18')](0x17,_0x7af1('0x32'))[_0x7af1('0x18')](0x3b,_0x7af1('0x33'))[_0x7af1('0x18')](0x3b,_0x7af1('0x34'))['format']();}_0x596d82={'start':_0xf05e11,'end':_0x5e967a};break;default:_0x596d82[_0x7af1('0x2f')]=_0xf05e11;break;}return _0x596d82;} \ No newline at end of file +var _0x1a32=['push','buildExpression','DATE','operator','$eq','$between','value','includes','$gt','$lte','add','days','YYYY-MM-DD','castTo','text','CAST(','field','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','<>\x20?','$startsWith','$endsWith','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','$substring','format','utcOffset','hours','minutes','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','and','[$and]','replace','split','length','slice','forEach','shift','match','filter','indexOf','map'];(function(_0x1213ce,_0x3a7c6a){var _0x432b07=function(_0x1a20e0){while(--_0x1a20e0){_0x1213ce['push'](_0x1213ce['shift']());}};_0x432b07(++_0x3a7c6a);}(_0x1a32,0xda));var _0x21a3=function(_0x261931,_0x5b654a){_0x261931=_0x261931-0x0;var _0x11083a=_0x1a32[_0x261931];return _0x11083a;};'use strict';var _=require(_0x21a3('0x0'));var moment=require(_0x21a3('0x1'));exports[_0x21a3('0x2')]=function(_0x3c051e){var _0x12c71e={'conditions':[]};_0x12c71e[_0x21a3('0x3')]=_[_0x21a3('0x4')](_0x3c051e,_0x21a3('0x5'))?'or':_0x21a3('0x6');var _0x1a8cad=_0x3c051e['replace'](_0x21a3('0x7'),'')[_0x21a3('0x8')](_0x21a3('0x5'),'')[_0x21a3('0x9')]('||');for(var _0x1519c9=0x0;_0x1519c9<_0x1a8cad[_0x21a3('0xa')];_0x1519c9++){var _0x2291f0=_0x1a8cad[_0x1519c9][_0x21a3('0x9')](':=');var _0x1029df=_0x2291f0[0x0];var _0x49111c=_0x2291f0[_0x21a3('0xb')](0x1);_0x49111c[_0x21a3('0xc')](function(_0x39ac40){var _0x5a6b7d=_0x39ac40[_0x21a3('0x9')]('[')[_0x21a3('0xd')]();var _0x46a7d9=_0x39ac40[_0x21a3('0xe')](/\[(.*?)\]/g);_0x46a7d9['forEach'](function(_0x57824f){var _0x3bd6d4=_0x57824f[_0x21a3('0x9')]('[')[_0x21a3('0xf')](function(_0x8e49d9){return _0x8e49d9[_0x21a3('0x10')](']')>-0x1;})[_0x21a3('0x11')](function(_0x154211){return _0x154211[_0x21a3('0x9')](']')[0x0];})[0x0];_0x12c71e['conditions'][_0x21a3('0x12')]({'field':_0x1029df,'operator':_0x5a6b7d,'value':_0x3bd6d4});});});}return _0x12c71e;};exports[_0x21a3('0x13')]=function(_0x22df3c,_0x7927aa,_0x571506){var _0x1d6b7e={};if(_0x7927aa===_0x21a3('0x14')){if(_0x571506[_0x21a3('0x15')]===_0x21a3('0x16')){_0x571506[_0x21a3('0x15')]=_0x21a3('0x17');_0x571506[_0x21a3('0x18')]+=','+_0x571506[_0x21a3('0x18')];}else if(_[_0x21a3('0x19')]([_0x21a3('0x1a'),_0x21a3('0x1b')],_0x571506[_0x21a3('0x15')])){_0x571506['value']=moment(_0x571506['value'])[_0x21a3('0x1c')](0x1,_0x21a3('0x1d'))['format'](_0x21a3('0x1e'));}}if(_0x571506[_0x21a3('0x1f')]){_0x7927aa=_0x571506[_0x21a3('0x1f')];_0x1d6b7e[_0x21a3('0x20')]=_0x21a3('0x21')+_0x22df3c+'.'+_0x571506[_0x21a3('0x22')]+'\x20AS\x20'+_0x571506['castTo']+')\x20'+parseOperator(_0x571506[_0x21a3('0x15')]);}else{_0x1d6b7e[_0x21a3('0x20')]=_0x22df3c+'.'+_0x571506[_0x21a3('0x22')]+'\x20'+parseOperator(_0x571506[_0x21a3('0x15')]);}if(_[_0x21a3('0x19')]([_0x21a3('0x23'),_0x21a3('0x24')],_0x571506[_0x21a3('0x15')]))_0x1d6b7e['text']='('+_0x1d6b7e[_0x21a3('0x20')]+_0x21a3('0x25')+_0x22df3c+'.'+_0x571506[_0x21a3('0x22')]+_0x21a3('0x26');_0x1d6b7e[_0x21a3('0x18')]=parseValue(_0x7927aa,_0x571506[_0x21a3('0x15')],_0x571506[_0x21a3('0x18')]);return _0x1d6b7e;};function parseOperator(_0x581563){var _0x42eef0;switch(_0x581563){case _0x21a3('0x27'):_0x42eef0=_0x21a3('0x28');break;case _0x21a3('0x24'):_0x42eef0=_0x21a3('0x29');break;case'$eq':_0x42eef0=_0x21a3('0x2a');break;case'$ne':_0x42eef0=_0x21a3('0x2b');break;case'$substring':case _0x21a3('0x2c'):case _0x21a3('0x2d'):_0x42eef0='LIKE\x20?';break;case'$lt':_0x42eef0=_0x21a3('0x2e');break;case _0x21a3('0x1a'):_0x42eef0=_0x21a3('0x2f');break;case _0x21a3('0x1b'):_0x42eef0=_0x21a3('0x30');break;case _0x21a3('0x31'):_0x42eef0=_0x21a3('0x32');break;case _0x21a3('0x17'):_0x42eef0=_0x21a3('0x33');break;}return _0x42eef0;}function parseValue(_0x25134f,_0xa510b3,_0x177e91){var _0x43867f={'start':undefined,'end':undefined};switch(_0xa510b3){case _0x21a3('0x27'):case _0x21a3('0x24'):_0x43867f[_0x21a3('0x34')]=_0x177e91[_0x21a3('0x9')](',');break;case _0x21a3('0x35'):_0x43867f['start']='%'+_0x177e91+'%';break;case _0x21a3('0x2c'):_0x43867f[_0x21a3('0x34')]=_0x177e91+'%';break;case'$endsWith':_0x43867f['start']='%'+_0x177e91;break;case'$between':var _0x3c7a89=_0x177e91[_0x21a3('0x9')](',');var _0x177e91=_0x3c7a89[_0x21a3('0xd')]();var _0x24d3b3=_0x3c7a89['pop']();if(_0x25134f==='DATE'){_0x177e91=moment(_0x177e91)['utcOffset'](0x0,!![])[_0x21a3('0x36')]();_0x24d3b3=moment(_0x24d3b3)[_0x21a3('0x37')](0x0,!![])[_0x21a3('0x1c')](0x17,_0x21a3('0x38'))[_0x21a3('0x1c')](0x3b,_0x21a3('0x39'))[_0x21a3('0x1c')](0x3b,_0x21a3('0x3a'))['format']();}_0x43867f={'start':_0x177e91,'end':_0x24d3b3};break;default:_0x43867f['start']=_0x177e91;break;}return _0x43867f;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index ada1451..99256bf 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 _0xbc09=['alias','fields','raw','split','filters','isEmpty','forOwn','type','DATE','isPlainObject','format','YYYY-MM-DD','utc','$lte','subtract','name','uniqueid','isArray','limit','offset','sort','priority','cast','col','DESC','unsigned','ASC','omit','length','isObject','unset','hasOwnProperty','match','^[+]?[0-9]*$','getFullTextValue','{EXPR}','replace','trim','forEach','push','join','getOptions','$id','query','map','intersection','attributes','nolimit','where','pick','filter','object','columns','merge','VIRTUAL','lower','options','include','includeAll','lodash','sequelize','moment','../../mysqldb','parse','keys','model'];(function(_0x19a2e7,_0x5c8201){var _0x489671=function(_0x3223ec){while(--_0x3223ec){_0x19a2e7['push'](_0x19a2e7['shift']());}};_0x489671(++_0x5c8201);}(_0xbc09,0x1c7));var _0x9bc0=function(_0x25eaef,_0x4da8d1){_0x25eaef=_0x25eaef-0x0;var _0x48a079=_0xbc09[_0x25eaef];return _0x48a079;};'use strict';var _=require(_0x9bc0('0x0'));var sequelize=require(_0x9bc0('0x1'));var moment=require(_0x9bc0('0x2'));var db=require(_0x9bc0('0x3'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x5dd39d){var _0x1ace67=['ne'];try{var _0x5db5fa=JSON[_0x9bc0('0x4')](_0x5dd39d);var _0x12178e=Object[_0x9bc0('0x5')](_0x5db5fa)[0x0];return _0x1ace67['includes'](_0x12178e);}catch(_0x2c3dad){return![];}}function getOperatorValue(_0x3716bf){var _0x4825ca=JSON[_0x9bc0('0x4')](_0x3716bf);var _0x5c2af2=Object[_0x9bc0('0x5')](_0x4825ca)[0x0];var _0x1dfc97=_0x4825ca[_0x5c2af2];return{['$'+_0x5c2af2]:_0x1dfc97};}function parseIncludeModel(_0x4e4599){var _0x4cc5f1=JSON[_0x9bc0('0x4')](_0x4e4599);return{'model':db[_0x4cc5f1[_0x9bc0('0x6')]],'as':_0x4cc5f1[_0x9bc0('0x7')],'attributes':_0x4cc5f1[_0x9bc0('0x8')],'raw':_0x4cc5f1[_0x9bc0('0x9')]};}exports[_0x9bc0('0x8')]=function(_0x2be53e){var _0x14524a=null;if(_0x2be53e){_0x14524a=_0x2be53e[_0x9bc0('0xa')](',');}return _0x14524a;};exports[_0x9bc0('0xb')]=function(_0x5e70c5,_0x28d0fa){var _0x46f7d6={};if(!_[_0x9bc0('0xc')](_0x5e70c5)){_[_0x9bc0('0xd')](_0x5e70c5,function(_0x22996a,_0x11a739){try{if(_0x28d0fa){var _0x22c08f=_['find'](_0x28d0fa,{'name':_0x11a739})||{};if(hasSequelizeOperator(_0x22996a)){_0x46f7d6[_0x11a739]=getOperatorValue(_0x22996a);}else if(_0x22c08f[_0x9bc0('0xe')]===_0x9bc0('0xf')&&_[_0x9bc0('0x10')](_0x22996a)){var _0x54e856=JSON[_0x9bc0('0x4')](_0x22996a);var _0x25dfdc={'$gte':moment(moment(_0x54e856['$gte'])[_0x9bc0('0x11')](_0x9bc0('0x12')))[_0x9bc0('0x13')]()['format'](),'$lte':moment(moment(_0x54e856[_0x9bc0('0x14')])['format'](_0x9bc0('0x12')))[_0x9bc0('0x13')]()[_0x9bc0('0x15')](0x1,'s')[_0x9bc0('0x11')]()};_0x46f7d6[_0x11a739]=_0x25dfdc;}else if(_0x22c08f[_0x9bc0('0x16')]===_0x9bc0('0x17')){_0x46f7d6[_0x11a739]=_0x22996a;}else{_0x46f7d6[_0x11a739]=_['isArray'](_0x22996a)?_0x22996a:JSON[_0x9bc0('0x4')](_0x22996a);}}else{_0x46f7d6[_0x11a739]=_[_0x9bc0('0x18')](_0x22996a)?_0x22996a:JSON[_0x9bc0('0x4')](_0x22996a);}}catch(_0x598308){_0x46f7d6[_0x11a739]=_0x22996a[_0x9bc0('0xa')](',');}});}return _0x46f7d6;};exports[_0x9bc0('0x19')]=function(_0x3972a5){_0x3972a5=parseInt(_0x3972a5,0xa);if(!_0x3972a5||_0x3972a5<0x0){_0x3972a5=LIMIT_VALUE;}return _0x3972a5;};exports[_0x9bc0('0x1a')]=function(_0x1ebbf3){_0x1ebbf3=parseInt(_0x1ebbf3,0xa);if(!_0x1ebbf3||_0x1ebbf3<0x0){_0x1ebbf3=0x0;}return _0x1ebbf3;};exports[_0x9bc0('0x1b')]=function(_0x4bc65a){var _0x14cd57,_0x451a03=null;if(_0x4bc65a){_0x14cd57=_0x4bc65a['split'](',');_0x451a03=_['map'](_0x14cd57,function(_0x54ade6){if(_0x54ade6['indexOf']('-')===0x0){return[_0x54ade6===_0x9bc0('0x1c')?sequelize[_0x9bc0('0x1d')](sequelize[_0x9bc0('0x1e')](_0x9bc0('0x1c')),'unsigned'):_0x54ade6['substr'](0x1),_0x9bc0('0x1f')];}else{return[_0x54ade6===_0x9bc0('0x1c')?sequelize['cast'](sequelize[_0x9bc0('0x1e')]('priority'),_0x9bc0('0x20')):_0x54ade6,_0x9bc0('0x21')];}});}return _0x451a03;};exports[_0x9bc0('0x22')]=function(_0x307d4a,_0x463206){if(_[_0x9bc0('0xc')](_0x307d4a)){return _0x307d4a;}if(_['isArray'](_0x307d4a)){for(var _0x237f80=0x0;_0x237f80<_0x307d4a[_0x9bc0('0x23')];_0x237f80+=0x1){_0x307d4a[_0x237f80]=this[_0x9bc0('0x22')](_0x307d4a[_0x237f80],_0x463206);}return _0x307d4a;}if(!_[_0x9bc0('0x24')](_0x307d4a)){return _0x307d4a;}if(_['isString'](_0x463206)){_0x463206=[_0x463206];}if(!_[_0x9bc0('0x18')](_0x463206)){return _0x307d4a;}for(var _0x289e97=0x0;_0x289e97<_0x463206[_0x9bc0('0x23')];_0x289e97+=0x1){_[_0x9bc0('0x25')](_0x307d4a,_0x463206[_0x289e97]);}for(var _0x2df456 in _0x307d4a){if(_0x307d4a[_0x9bc0('0x26')](_0x2df456)){_0x307d4a[_0x2df456]=this[_0x9bc0('0x22')](_0x307d4a[_0x2df456],_0x463206);}}return _0x307d4a;};exports['isNumeric']=function(_0x4bfe0c){return _0x4bfe0c[_0x9bc0('0x27')](RegExp(_0x9bc0('0x28')))?!![]:![];};exports['isEmail']=function(_0x116ff2){return _0x116ff2['match'](/^\S+@\S+$/)?!![]:![];};exports[_0x9bc0('0x29')]=function(_0x5120c9,_0x5c2d28){var _0x2327f2=[];var _0x52c906=/([^:]")"+/g;var _0x3ed29a=/[*<>~@-]/g;var _0x2bae61=/[ `!@#$%^&*()_\-?~<>]/;var _0x5c69c4=/[ ,]+/;var _0xa86b4=_0x5c2d28?'\x22{EXPR}\x22':_0x9bc0('0x2a');if(_0x5c2d28){_0x5120c9=_0x5120c9[_0x9bc0('0x2b')](_0x3ed29a,'\x20')[_0x9bc0('0x2c')]();}_0x5120c9[_0x9bc0('0xa')](_0x5c69c4)[_0x9bc0('0x2d')](function(_0x4d0a4b){_0x4d0a4b=_0x4d0a4b['replace'](_0x52c906,'$1');_0x4d0a4b='+'+_0x4d0a4b+'*';var _0x103090=_0x4d0a4b['match'](_0x2bae61);if(_0x103090){_0x4d0a4b='\x22'+_0x4d0a4b+'\x22';}_0x2327f2[_0x9bc0('0x2e')](_0x4d0a4b);});_0xa86b4=_0xa86b4[_0x9bc0('0x2b')](_0x9bc0('0x2a'),_0x2327f2[_0x9bc0('0x2f')]('\x20'));return _0xa86b4;};exports[_0x9bc0('0x30')]=function(_0x1bad90,_0x3257b0,_0x54d2a3){var _0x3cb8b9={},_0x167add={};if(_0x3257b0['query'][_0x9bc0('0x31')]){_0x3257b0[_0x9bc0('0x32')]['id']=_0x3257b0[_0x9bc0('0x32')][_0x9bc0('0x31')];delete _0x3257b0['query'][_0x9bc0('0x31')];}_0x3cb8b9[_0x9bc0('0x6')]=_[_0x9bc0('0x33')](_0x1bad90,_0x9bc0('0x16'));_0x3cb8b9[_0x9bc0('0x32')]=_[_0x9bc0('0x5')](_0x3257b0[_0x9bc0('0x32')]);_0x3cb8b9['filters']=_[_0x9bc0('0x34')](_0x3cb8b9['model'],_0x3cb8b9[_0x9bc0('0x32')]);_0x167add[_0x9bc0('0x35')]=_['intersection'](_0x3cb8b9[_0x9bc0('0x6')],this[_0x9bc0('0x8')](_0x3257b0[_0x9bc0('0x32')]['fields']));_0x167add['attributes']=_0x167add[_0x9bc0('0x35')][_0x9bc0('0x23')]?_0x167add['attributes']:_0x3cb8b9[_0x9bc0('0x6')];if(!_0x3257b0[_0x9bc0('0x32')][_0x9bc0('0x26')](_0x9bc0('0x36'))){_0x167add[_0x9bc0('0x19')]=this['limit'](_0x3257b0['query'][_0x9bc0('0x19')]);_0x167add['offset']=this[_0x9bc0('0x1a')](_0x3257b0['query'][_0x9bc0('0x1a')]);}_0x167add['order']=this[_0x9bc0('0x1b')](_0x3257b0[_0x9bc0('0x32')][_0x9bc0('0x1b')]);_0x167add[_0x9bc0('0x37')]=this['filters'](_[_0x9bc0('0x38')](_0x3257b0[_0x9bc0('0x32')],_0x3cb8b9[_0x9bc0('0xb')]),_0x1bad90);if(_0x3257b0['query'][_0x9bc0('0x39')]){var _0x1063a1=_0x1bad90;var _0x4d0981=_0x3257b0[_0x9bc0('0x32')][_0x9bc0('0x39')];if(typeof _0x4d0981===_0x9bc0('0x3a')){_0x1063a1=_[_0x9bc0('0x39')](_0x1bad90,function(_0x19f539){return _['includes'](_0x4d0981[_0x9bc0('0x3b')],_0x19f539[_0x9bc0('0x16')]);});_0x4d0981=_0x4d0981['value'];}_0x167add[_0x9bc0('0x37')]=_[_0x9bc0('0x3c')](_0x167add['where'],{'$or':_[_0x9bc0('0x33')](_0x1063a1,function(_0x233796){if(_0x233796[_0x9bc0('0xe')]!==_0x9bc0('0x3d')){if(_0x54d2a3){return sequelize[_0x9bc0('0x37')](sequelize['fn'](_0x9bc0('0x3e'),sequelize[_0x9bc0('0x1e')](_0x233796[_0x9bc0('0x16')])),{'$like':sequelize['fn'](_0x9bc0('0x3e'),'%'+_0x3257b0[_0x9bc0('0x32')][_0x9bc0('0x39')]+'%')});}else{var _0x6fe148={};_0x6fe148[_0x233796['name']]={'$like':'%'+_0x3257b0[_0x9bc0('0x32')][_0x9bc0('0x39')]+'%'};return _0x6fe148;}}})});}_0x167add=_[_0x9bc0('0x3c')]({},_0x167add,_0x3257b0[_0x9bc0('0x3f')]);return _0x167add;};exports[_0x9bc0('0x40')]=function(_0x5c9e85){var _0x53a952=[];if(_0x5c9e85[_0x9bc0('0x41')]){_0x53a952[_0x9bc0('0x2e')]({'all':!![]});}else if(_0x5c9e85[_0x9bc0('0x40')]){if(Array[_0x9bc0('0x18')](_0x5c9e85[_0x9bc0('0x40')])){_0x53a952=Object[_0x9bc0('0x5')](_0x5c9e85[_0x9bc0('0x40')])[_0x9bc0('0x33')](function(_0x33ed13){return parseIncludeModel(_0x5c9e85[_0x9bc0('0x40')][_0x33ed13]);});}else{var _0x7ff024=parseIncludeModel(_0x5c9e85[_0x9bc0('0x40')]);_0x53a952[_0x9bc0('0x2e')](_0x7ff024);}}return _0x53a952;};exports['escapeLIKESpecialChars']=function(_0x1cd737){return _0x1cd737[_0x9bc0('0x2b')](/[%_^-]/g,function(_0x2ccd68){return'\x5c'+_0x2ccd68;});}; \ No newline at end of file +var _0x4415=['format','utc','$lte','YYYY-MM-DD','name','uniqueid','isArray','limit','offset','sort','map','indexOf','priority','cast','col','substr','DESC','unsigned','ASC','omit','isEmpty','length','isObject','isString','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','\x22{EXPR}\x22','{EXPR}','replace','trim','forEach','push','join','getOptions','query','$id','filters','intersection','attributes','nolimit','order','pick','filter','object','columns','where','lower','merge','options','include','lodash','parse','keys','includes','model','fields','raw','split','forOwn','type','isPlainObject','$gte'];(function(_0x3dc8ed,_0x1e88e6){var _0x36c02a=function(_0x14b964){while(--_0x14b964){_0x3dc8ed['push'](_0x3dc8ed['shift']());}};_0x36c02a(++_0x1e88e6);}(_0x4415,0x13e));var _0x5441=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0x4415[_0x4b7895];return _0x264180;};'use strict';var _=require(_0x5441('0x0'));var sequelize=require('sequelize');var moment=require('moment');var db=require('../../mysqldb')['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x1bb600){var _0x13c64c=['ne'];try{var _0xd88819=JSON[_0x5441('0x1')](_0x1bb600);var _0x2d2065=Object[_0x5441('0x2')](_0xd88819)[0x0];return _0x13c64c[_0x5441('0x3')](_0x2d2065);}catch(_0xec1fe9){return![];}}function getOperatorValue(_0x192f31){var _0x8bc4c6=JSON[_0x5441('0x1')](_0x192f31);var _0x2622bd=Object[_0x5441('0x2')](_0x8bc4c6)[0x0];var _0x4ae388=_0x8bc4c6[_0x2622bd];return{['$'+_0x2622bd]:_0x4ae388};}function parseIncludeModel(_0x3d26f0){var _0x4d9343=JSON['parse'](_0x3d26f0);return{'model':db[_0x4d9343[_0x5441('0x4')]],'as':_0x4d9343['alias'],'attributes':_0x4d9343[_0x5441('0x5')],'raw':_0x4d9343[_0x5441('0x6')]};}exports['fields']=function(_0x141dcc){var _0x4c2e90=null;if(_0x141dcc){_0x4c2e90=_0x141dcc[_0x5441('0x7')](',');}return _0x4c2e90;};exports['filters']=function(_0xeba2de,_0x409e62){var _0x405d71={};if(!_['isEmpty'](_0xeba2de)){_[_0x5441('0x8')](_0xeba2de,function(_0x38e9ae,_0x41cb1b){try{if(_0x409e62){var _0x216511=_['find'](_0x409e62,{'name':_0x41cb1b})||{};if(hasSequelizeOperator(_0x38e9ae)){_0x405d71[_0x41cb1b]=getOperatorValue(_0x38e9ae);}else if(_0x216511[_0x5441('0x9')]==='DATE'&&_[_0x5441('0xa')](_0x38e9ae)){var _0x447422=JSON[_0x5441('0x1')](_0x38e9ae);var _0x136d52={'$gte':moment(moment(_0x447422[_0x5441('0xb')])[_0x5441('0xc')]('YYYY-MM-DD'))[_0x5441('0xd')]()[_0x5441('0xc')](),'$lte':moment(moment(_0x447422[_0x5441('0xe')])[_0x5441('0xc')](_0x5441('0xf')))[_0x5441('0xd')]()['subtract'](0x1,'s')[_0x5441('0xc')]()};_0x405d71[_0x41cb1b]=_0x136d52;}else if(_0x216511[_0x5441('0x10')]===_0x5441('0x11')){_0x405d71[_0x41cb1b]=_0x38e9ae;}else{_0x405d71[_0x41cb1b]=_['isArray'](_0x38e9ae)?_0x38e9ae:JSON[_0x5441('0x1')](_0x38e9ae);}}else{_0x405d71[_0x41cb1b]=_[_0x5441('0x12')](_0x38e9ae)?_0x38e9ae:JSON['parse'](_0x38e9ae);}}catch(_0x4eabe7){_0x405d71[_0x41cb1b]=_0x38e9ae[_0x5441('0x7')](',');}});}return _0x405d71;};exports[_0x5441('0x13')]=function(_0x3ec8c6){_0x3ec8c6=parseInt(_0x3ec8c6,0xa);if(!_0x3ec8c6||_0x3ec8c6<0x0){_0x3ec8c6=LIMIT_VALUE;}return _0x3ec8c6;};exports[_0x5441('0x14')]=function(_0xf51629){_0xf51629=parseInt(_0xf51629,0xa);if(!_0xf51629||_0xf51629<0x0){_0xf51629=0x0;}return _0xf51629;};exports[_0x5441('0x15')]=function(_0x2d20e4){var _0x5dcb1e,_0x52aa3f=null;if(_0x2d20e4){_0x5dcb1e=_0x2d20e4['split'](',');_0x52aa3f=_[_0x5441('0x16')](_0x5dcb1e,function(_0x578e5d){if(_0x578e5d[_0x5441('0x17')]('-')===0x0){return[_0x578e5d===_0x5441('0x18')?sequelize[_0x5441('0x19')](sequelize[_0x5441('0x1a')](_0x5441('0x18')),'unsigned'):_0x578e5d[_0x5441('0x1b')](0x1),_0x5441('0x1c')];}else{return[_0x578e5d==='priority'?sequelize[_0x5441('0x19')](sequelize[_0x5441('0x1a')]('priority'),_0x5441('0x1d')):_0x578e5d,_0x5441('0x1e')];}});}return _0x52aa3f;};exports[_0x5441('0x1f')]=function(_0x3c542e,_0x23e7db){if(_[_0x5441('0x20')](_0x3c542e)){return _0x3c542e;}if(_[_0x5441('0x12')](_0x3c542e)){for(var _0x19393c=0x0;_0x19393c<_0x3c542e[_0x5441('0x21')];_0x19393c+=0x1){_0x3c542e[_0x19393c]=this[_0x5441('0x1f')](_0x3c542e[_0x19393c],_0x23e7db);}return _0x3c542e;}if(!_[_0x5441('0x22')](_0x3c542e)){return _0x3c542e;}if(_[_0x5441('0x23')](_0x23e7db)){_0x23e7db=[_0x23e7db];}if(!_['isArray'](_0x23e7db)){return _0x3c542e;}for(var _0x40d285=0x0;_0x40d285<_0x23e7db[_0x5441('0x21')];_0x40d285+=0x1){_['unset'](_0x3c542e,_0x23e7db[_0x40d285]);}for(var _0x17a24a in _0x3c542e){if(_0x3c542e[_0x5441('0x24')](_0x17a24a)){_0x3c542e[_0x17a24a]=this[_0x5441('0x1f')](_0x3c542e[_0x17a24a],_0x23e7db);}}return _0x3c542e;};exports[_0x5441('0x25')]=function(_0x3aab3a){return _0x3aab3a[_0x5441('0x26')](RegExp(_0x5441('0x27')))?!![]:![];};exports[_0x5441('0x28')]=function(_0xdda69c){return _0xdda69c[_0x5441('0x26')](/^\S+@\S+$/)?!![]:![];};exports[_0x5441('0x29')]=function(_0x3fa852,_0x360af1){var _0xf0d636=[];var _0x11771d=/([^:]")"+/g;var _0x2874ea=/[*<>~@-]/g;var _0x13bdb4=/[ `!@#$%^&*()_\-?~<>]/;var _0x6eefde=/[ ,]+/;var _0x130548=_0x360af1?_0x5441('0x2a'):_0x5441('0x2b');if(_0x360af1){_0x3fa852=_0x3fa852[_0x5441('0x2c')](_0x2874ea,'\x20')[_0x5441('0x2d')]();}_0x3fa852[_0x5441('0x7')](_0x6eefde)[_0x5441('0x2e')](function(_0x4f2674){_0x4f2674=_0x4f2674[_0x5441('0x2c')](_0x11771d,'$1');_0x4f2674='+'+_0x4f2674+'*';var _0x4e13c3=_0x4f2674[_0x5441('0x26')](_0x13bdb4);if(_0x4e13c3){_0x4f2674='\x22'+_0x4f2674+'\x22';}_0xf0d636[_0x5441('0x2f')](_0x4f2674);});_0x130548=_0x130548[_0x5441('0x2c')](_0x5441('0x2b'),_0xf0d636[_0x5441('0x30')]('\x20'));return _0x130548;};exports[_0x5441('0x31')]=function(_0x27876c,_0x148d44,_0x183e72){var _0x470b1c={},_0x97c359={};if(_0x148d44[_0x5441('0x32')][_0x5441('0x33')]){_0x148d44[_0x5441('0x32')]['id']=_0x148d44['query']['$id'];delete _0x148d44[_0x5441('0x32')]['$id'];}_0x470b1c['model']=_['map'](_0x27876c,_0x5441('0x10'));_0x470b1c['query']=_[_0x5441('0x2')](_0x148d44[_0x5441('0x32')]);_0x470b1c[_0x5441('0x34')]=_[_0x5441('0x35')](_0x470b1c[_0x5441('0x4')],_0x470b1c[_0x5441('0x32')]);_0x97c359[_0x5441('0x36')]=_[_0x5441('0x35')](_0x470b1c[_0x5441('0x4')],this[_0x5441('0x5')](_0x148d44[_0x5441('0x32')][_0x5441('0x5')]));_0x97c359['attributes']=_0x97c359[_0x5441('0x36')][_0x5441('0x21')]?_0x97c359[_0x5441('0x36')]:_0x470b1c[_0x5441('0x4')];if(!_0x148d44[_0x5441('0x32')][_0x5441('0x24')](_0x5441('0x37'))){_0x97c359[_0x5441('0x13')]=this[_0x5441('0x13')](_0x148d44[_0x5441('0x32')]['limit']);_0x97c359['offset']=this[_0x5441('0x14')](_0x148d44['query'][_0x5441('0x14')]);}_0x97c359[_0x5441('0x38')]=this[_0x5441('0x15')](_0x148d44[_0x5441('0x32')][_0x5441('0x15')]);_0x97c359['where']=this[_0x5441('0x34')](_[_0x5441('0x39')](_0x148d44[_0x5441('0x32')],_0x470b1c['filters']),_0x27876c);if(_0x148d44[_0x5441('0x32')][_0x5441('0x3a')]){var _0x1379f2=_0x27876c;var _0x37b550=_0x148d44[_0x5441('0x32')]['filter'];if(typeof _0x37b550===_0x5441('0x3b')){_0x1379f2=_[_0x5441('0x3a')](_0x27876c,function(_0x51ff70){return _[_0x5441('0x3')](_0x37b550[_0x5441('0x3c')],_0x51ff70[_0x5441('0x10')]);});_0x37b550=_0x37b550['value'];}_0x97c359[_0x5441('0x3d')]=_['merge'](_0x97c359['where'],{'$or':_[_0x5441('0x16')](_0x1379f2,function(_0x43ba5d){if(_0x43ba5d[_0x5441('0x9')]!=='VIRTUAL'){if(_0x183e72){return sequelize[_0x5441('0x3d')](sequelize['fn'](_0x5441('0x3e'),sequelize[_0x5441('0x1a')](_0x43ba5d['name'])),{'$like':sequelize['fn'](_0x5441('0x3e'),'%'+_0x148d44[_0x5441('0x32')][_0x5441('0x3a')]+'%')});}else{var _0x3aa27e={};_0x3aa27e[_0x43ba5d['name']]={'$like':'%'+_0x148d44[_0x5441('0x32')][_0x5441('0x3a')]+'%'};return _0x3aa27e;}}})});}_0x97c359=_[_0x5441('0x3f')]({},_0x97c359,_0x148d44[_0x5441('0x40')]);return _0x97c359;};exports[_0x5441('0x41')]=function(_0x4927d8){var _0x59998e=[];if(_0x4927d8['includeAll']){_0x59998e['push']({'all':!![]});}else if(_0x4927d8[_0x5441('0x41')]){if(Array['isArray'](_0x4927d8[_0x5441('0x41')])){_0x59998e=Object[_0x5441('0x2')](_0x4927d8[_0x5441('0x41')])[_0x5441('0x16')](function(_0x258df3){return parseIncludeModel(_0x4927d8[_0x5441('0x41')][_0x258df3]);});}else{var _0x23be51=parseIncludeModel(_0x4927d8['include']);_0x59998e[_0x5441('0x2f')](_0x23be51);}}return _0x59998e;};exports['escapeLIKESpecialChars']=function(_0x36d870){return _0x36d870[_0x5441('0x2c')](/[%_^-]/g,function(_0x51b5d4){return'\x5c'+_0x51b5d4;});}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 6735e53..6623b4a 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 _0x315f=['Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','request','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','getRealtimeAgents','busy','getAgentStatus','isArray','map','findOne','getAgents','all','flatten','uniq','value','getAgentIdsByQueues','filter','includes','getAgentIdsByStatus','resolve','User','findAll','name','fullname','faxPause','pauseType','globalStatus','getSortedAgentsIdsByStatus','fields','order','startsWith','DESC','getUpdatedSortOptions','internal','validateSortParameter','sort','toLowerCase','sortAgentsByStatus','lastLoginAt','lastPauseAt','address','chatCapacity','mailCapacity','smsCapacity','faxCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','mailStatus','voiceStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','faxStatusTime','voiceStatusTime','queue','destconnectedlinenum','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','online','omit','pick','filterAgentAttributes','role','whatsappStatusTime','openchannelCapacity','whatsappCapacity','chatCurrentCapacity','onhold','screenrecording','getRealtimeAgentsQueryFields','lodash','../../mysqldb','client','chatPause','mailPause','openchannelPause','smsPause','voicePause','whatsappPause','every','length','idle','unknown','unavailable','pause','chatStatus','faxStatus','openchannelStatus','smsStatus','whatsappStatus'];(function(_0xb85af0,_0x2d529d){var _0x3e3cd6=function(_0x1d23f1){while(--_0x1d23f1){_0xb85af0['push'](_0xb85af0['shift']());}};_0x3e3cd6(++_0x2d529d);}(_0x315f,0x174));var _0xf315=function(_0x4147ff,_0x154530){_0x4147ff=_0x4147ff-0x0;var _0x1e71e6=_0x315f[_0x4147ff];return _0x1e71e6;};'use strict';var _=require(_0xf315('0x0'));var jayson=require('jayson/promise');var db=require(_0xf315('0x1'))['db'];var amiClient=jayson['client']['http']({'port':0x232a});var routingClient=jayson[_0xf315('0x2')]['http']({'port':0x232c});function isAgentPaused(_0x4f81c4,_0x513bcd){var _0x571ae5=[_0x4f81c4[_0xf315('0x3')],_0x4f81c4['faxPause'],_0x4f81c4[_0xf315('0x4')],_0x4f81c4[_0xf315('0x5')],_0x4f81c4[_0xf315('0x6')],_0x4f81c4[_0xf315('0x7')],_0x4f81c4[_0xf315('0x8')]];if(!_0x513bcd)return _[_0xf315('0x9')](_0x571ae5);var _0x48679b=_['filter'](_0x571ae5);return _0x48679b[_0xf315('0xa')]>0x0&&_0x48679b['length']<_0x571ae5[_0xf315('0xa')]?!![]:![];}function isIdle(_0x150ba0){return _0x150ba0===_0xf315('0xb')||_0x150ba0===_0xf315('0xc')||_0x150ba0===_0xf315('0xd')||_0x150ba0==='ringing'||_['isNil'](_0x150ba0);}function isAgentIdle(_0x42d26a){if(_0x42d26a['voiceStatus']!=='idle'&&_0x42d26a[_0xf315('0x7')]){_0x42d26a['voiceStatus']=_0xf315('0xe');return![];}return _[_0xf315('0x9')]([_0x42d26a[_0xf315('0xf')],_0x42d26a[_0xf315('0x10')],_0x42d26a['mailStatus'],_0x42d26a[_0xf315('0x11')],_0x42d26a[_0xf315('0x12')],_0x42d26a['voiceStatus'],_0x42d26a[_0xf315('0x13')]],isIdle);}function getRealtimeAgents(){return amiClient['request'](_0xf315('0x14'),{})[_0xf315('0x15')](function(_0x20a72c){if(_0x20a72c[_0xf315('0x16')]){throw new Error(_0xf315('0x17'));}var _0x3c2e05=_0x20a72c[_0xf315('0x18')];return routingClient[_0xf315('0x19')](_0xf315('0x14'),{})[_0xf315('0x15')](function(_0x3cc17b){if(_0x3cc17b[_0xf315('0x16')]){throw new Error(_0xf315('0x1a'));}var _0xb5fcb6=_0x3cc17b['result'];return _[_0xf315('0x1b')]({},_0x3c2e05,_0xb5fcb6);});})[_0xf315('0x1c')](function(_0x28d528){throw _0x28d528;});}exports[_0xf315('0x1d')]=getRealtimeAgents;function getAgentStatus(_0xb91236){var _0xf695e4=_0xf315('0xc');if(isAgentPaused(_0xb91236))_0xf695e4=_0xf315('0xe');else if(isAgentPaused(_0xb91236,!![]))_0xf695e4='*pause';else if(isAgentIdle(_0xb91236))_0xf695e4=_0xf315('0xb');else _0xf695e4=_0xf315('0x1e');return _0xf695e4;}exports[_0xf315('0x1f')]=getAgentStatus;function getAgentIdsByQueues(_0x1c9be5,_0x21dfad){var _0x56f6e3=_[_0xf315('0x20')](_0x1c9be5)?_0x1c9be5:[_0x1c9be5];var _0x5d1ac5=_['startCase'](_0x21dfad)+'Queue';var _0x25d707=_[_0xf315('0x21')](_0x56f6e3,function(_0x14021d){return db[_0x5d1ac5][_0xf315('0x22')]({'where':{'id':_0x14021d}})['then'](function(_0x5b6a9b){if(!_0x5b6a9b)return[];return _0x5b6a9b[_0xf315('0x23')]({'attributes':['id'],'raw':!![]});});});return Promise[_0xf315('0x24')](_0x25d707)['then'](function(_0x325a29){var _0x5bc57e=_(_0x325a29)[_0xf315('0x25')]()['map']('id')[_0xf315('0x26')]()[_0xf315('0x27')]();return _0x5bc57e;});}exports[_0xf315('0x28')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x22f7b8,_0x42d78d,_0x478cca){try{if(_0x42d78d['length']>0x0){_0x22f7b8=_0x22f7b8[_0xf315('0x29')](function(_0x2072db){return _0x42d78d[_0xf315('0x2a')](_0x2072db['id']);});}var _0x46ceb3=_0x22f7b8[_0xf315('0x29')](function(_0x1b3d72){var _0x2915c3=_0xf315('0x1e');if(isAgentIdle(_0x1b3d72)){_0x2915c3=_0xf315('0xb');}return _0x2915c3===_0x478cca;});return _['map'](_0x46ceb3,'id');}catch(_0x373c9e){throw _0x373c9e;}}exports[_0xf315('0x2b')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x41bfdc,_0x2c21cd,_0x3b3ef4){return Promise[_0xf315('0x2c')]()[_0xf315('0x15')](function(){if(_0x2c21cd[_0xf315('0xa')]>0x0){_0x41bfdc=_0x41bfdc['filter'](function(_0x2f0a1b){return _0x2c21cd['includes'](_0x2f0a1b['id']);});}return _0x41bfdc;})[_0xf315('0x15')](function(){return db[_0xf315('0x2d')][_0xf315('0x2e')]({'attributes':['id',_0xf315('0x2f'),_0xf315('0x30'),_0xf315('0x3'),_0xf315('0x31'),'mailPause',_0xf315('0x5'),_0xf315('0x6'),_0xf315('0x7'),'whatsappPause',_0xf315('0x32')],'where':{'id':{'$in':_[_0xf315('0x21')](_0x41bfdc,'id')}},'raw':!![]});})[_0xf315('0x15')](function(_0x357915){return _0x357915[_0xf315('0x21')](function(_0x34d592){var _0x4d1e17=_['find'](_0x41bfdc,['id',_0x34d592['id']]);var _0x202d97=filterAgentAttributes(_0x4d1e17);_['merge'](_0x34d592,_0x202d97);_0x34d592[_0xf315('0x33')]=getAgentStatus(_0x34d592);return _0x34d592;});})['then'](function(_0x5a49dd){var _0x199631=sortAgentsByStatus(_0x5a49dd,_0x3b3ef4);return _['map'](_0x199631,'id');})[_0xf315('0x1c')](function(_0x1a23c3){throw _0x1a23c3;});}exports[_0xf315('0x34')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x1c5e86){var _0x3b3ead={'fields':[],'order':null};var _0x192b76=_0x1c5e86['split'](',');_0x3b3ead[_0xf315('0x35')]=_[_0xf315('0x29')](_0x192b76,function(_0x423d92){if(!_0x423d92[_0xf315('0x2a')](_0xf315('0x33'))){return!![];}_0x3b3ead[_0xf315('0x36')]=_[_0xf315('0x37')](_0x423d92,'-')?_0xf315('0x38'):'ASC';return![];});return _0x3b3ead;}exports[_0xf315('0x39')]=getUpdatedSortOptions;function validateSortParameter(_0x176b99){if(!_0x176b99){_0x176b99='fullname,internal';}if(_0x176b99[_0xf315('0x2a')](_0xf315('0x30'))&&!_0x176b99[_0xf315('0x2a')](_0xf315('0x3a'))){var _0x383e00=_0x176b99['substring'](0x0,_0x176b99['indexOf'](_0xf315('0x30')));_0x176b99+=','+_0x383e00+_0xf315('0x3a');}return _0x176b99;}exports[_0xf315('0x3b')]=validateSortParameter;function sortAgentsByStatus(_0x36cdca,_0x246bc6){var _0x580632=_0x36cdca[_0xf315('0x3c')](function(_0x1f8008,_0x105b97){if(_0x1f8008['globalStatus']===_0x105b97[_0xf315('0x33')]){if(_0x1f8008[_0xf315('0x33')]===_0xf315('0xe')){if(_0x246bc6===_0xf315('0x38')){return(_0x1f8008[_0xf315('0x32')]||'')<(_0x105b97['pauseType']||'')||_0x1f8008[_0xf315('0x30')][_0xf315('0x3d')]()>_0x105b97['fullname']['toLowerCase']()?0x1:-0x1;}else{return(_0x1f8008[_0xf315('0x32')]||'')<(_0x105b97[_0xf315('0x32')]||'')||_0x1f8008['fullname'][_0xf315('0x3d')]()>_0x105b97[_0xf315('0x30')][_0xf315('0x3d')]()?-0x1:0x1;}}else{if(_0x246bc6==='DESC'){return _0x1f8008[_0xf315('0x30')][_0xf315('0x3d')]()<_0x105b97[_0xf315('0x30')][_0xf315('0x3d')]()?0x1:-0x1;}else{return _0x1f8008['fullname'][_0xf315('0x3d')]()<_0x105b97[_0xf315('0x30')]['toLowerCase']()?-0x1:0x1;}}}else{if(_0x246bc6==='DESC'){return _0x1f8008[_0xf315('0x33')]<_0x105b97[_0xf315('0x33')]?0x1:-0x1;}else{return _0x1f8008['globalStatus']<_0x105b97[_0xf315('0x33')]?-0x1:0x1;}}});return _0x580632;}exports[_0xf315('0x3e')]=sortAgentsByStatus;function filterAgentAttributes(_0x5f3414){var _0x184a1d=['userpic','online',_0xf315('0x3f'),'lastPauseAt',_0xf315('0x32'),_0xf315('0x40'),_0xf315('0x3a'),_0xf315('0x41'),'chatPause',_0xf315('0x5'),_0xf315('0x4'),_0xf315('0x6'),_0xf315('0x8'),_0xf315('0x31'),'voicePause',_0xf315('0x42'),'openchannelCapacity',_0xf315('0x43'),_0xf315('0x44'),'whatsappCapacity',_0xf315('0x45'),'chatCurrentCapacity',_0xf315('0x46'),_0xf315('0x47'),_0xf315('0x48'),_0xf315('0x49'),_0xf315('0x4a'),_0xf315('0xf'),_0xf315('0x11'),_0xf315('0x4b'),_0xf315('0x12'),_0xf315('0x13'),_0xf315('0x10'),_0xf315('0x4c'),_0xf315('0x4d'),_0xf315('0x4e'),_0xf315('0x4f'),'smsStatusTime','whatsappStatusTime',_0xf315('0x50'),_0xf315('0x51'),_0xf315('0x52'),_0xf315('0x53'),'screenrecording',_0xf315('0x54'),_0xf315('0x55')];var _0x165c71=[_0xf315('0x3'),'openchannelPause',_0xf315('0x4'),_0xf315('0x6'),_0xf315('0x8'),_0xf315('0x31'),'voicePause',_0xf315('0x56')];var _0x3cf6b2=_(_0x5f3414)[_0xf315('0x57')](_0x165c71)[_0xf315('0x58')](_0x184a1d)[_0xf315('0x27')]();return _0x3cf6b2;}exports[_0xf315('0x59')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0xf315('0x2f'),_0xf315('0x30'),_0xf315('0x5a'),_0xf315('0x3a'),_0xf315('0x56'),_0xf315('0x33'),'userpic',_0xf315('0x3f'),_0xf315('0x32'),_0xf315('0x40'),_0xf315('0x31'),_0xf315('0x3'),_0xf315('0x4'),_0xf315('0x5'),_0xf315('0x6'),_0xf315('0x7'),_0xf315('0x8'),_0xf315('0xf'),_0xf315('0x10'),'mailStatus','openchannelStatus',_0xf315('0x12'),_0xf315('0x4c'),_0xf315('0x13'),_0xf315('0x4d'),'faxStatusTime',_0xf315('0x4f'),_0xf315('0x4e'),'smsStatusTime',_0xf315('0x51'),_0xf315('0x5b'),'chatCapacity',_0xf315('0x45'),_0xf315('0x43'),_0xf315('0x5c'),_0xf315('0x44'),_0xf315('0x5d'),_0xf315('0x5e'),_0xf315('0x4a'),_0xf315('0x47'),'openchannelCurrentCapacity',_0xf315('0x48'),_0xf315('0x49'),_0xf315('0x54'),_0xf315('0x55'),'destconnectedlinenum',_0xf315('0x5f'),_0xf315('0x52'),_0xf315('0x60')];}exports[_0xf315('0x61')]=getRealtimeAgentsQueryFields; \ No newline at end of file +var _0xa880=['catch','*pause','busy','getAgentStatus','isArray','Queue','findOne','getAgents','getAgentIdsByQueues','length','map','getAgentIdsByStatus','includes','User','findAll','name','fullname','faxPause','whatsappPause','pauseType','find','globalStatus','split','fields','order','DESC','ASC','getUpdatedSortOptions','fullname,internal','internal','indexOf','sort','toLowerCase','sortAgentsByStatus','userpic','online','lastPauseAt','address','chatCapacity','openchannelCapacity','mailCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','smsCurrentCapacity','mailStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','queue','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','pick','filterAgentAttributes','role','lastLoginAt','whatsappStatus','faxCurrentCapacity','whatsappCurrentCapacity','destconnectedlinenum','onhold','screenrecording','getRealtimeAgentsQueryFields','lodash','jayson/promise','../../mysqldb','client','http','chatPause','mailPause','openchannelPause','smsPause','voicePause','every','filter','idle','unknown','unavailable','ringing','isNil','voiceStatus','pause','chatStatus','faxStatus','openchannelStatus','smsStatus','request','Agents','then','error','result','merge'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0xa880,0x106));var _0x0a88=function(_0x2b12b0,_0x4480ce){_0x2b12b0=_0x2b12b0-0x0;var _0x221d21=_0xa880[_0x2b12b0];return _0x221d21;};'use strict';var _=require(_0x0a88('0x0'));var jayson=require(_0x0a88('0x1'));var db=require(_0x0a88('0x2'))['db'];var amiClient=jayson[_0x0a88('0x3')][_0x0a88('0x4')]({'port':0x232a});var routingClient=jayson[_0x0a88('0x3')][_0x0a88('0x4')]({'port':0x232c});function isAgentPaused(_0x321ae4,_0x552e9d){var _0x4091c4=[_0x321ae4[_0x0a88('0x5')],_0x321ae4['faxPause'],_0x321ae4[_0x0a88('0x6')],_0x321ae4[_0x0a88('0x7')],_0x321ae4[_0x0a88('0x8')],_0x321ae4[_0x0a88('0x9')],_0x321ae4['whatsappPause']];if(!_0x552e9d)return _[_0x0a88('0xa')](_0x4091c4);var _0x62b055=_[_0x0a88('0xb')](_0x4091c4);return _0x62b055['length']>0x0&&_0x62b055['length']<_0x4091c4['length']?!![]:![];}function isIdle(_0x317042){return _0x317042===_0x0a88('0xc')||_0x317042===_0x0a88('0xd')||_0x317042===_0x0a88('0xe')||_0x317042===_0x0a88('0xf')||_[_0x0a88('0x10')](_0x317042);}function isAgentIdle(_0x3a53be){if(_0x3a53be[_0x0a88('0x11')]!==_0x0a88('0xc')&&_0x3a53be[_0x0a88('0x9')]){_0x3a53be['voiceStatus']=_0x0a88('0x12');return![];}return _[_0x0a88('0xa')]([_0x3a53be[_0x0a88('0x13')],_0x3a53be[_0x0a88('0x14')],_0x3a53be['mailStatus'],_0x3a53be[_0x0a88('0x15')],_0x3a53be[_0x0a88('0x16')],_0x3a53be[_0x0a88('0x11')],_0x3a53be['whatsappStatus']],isIdle);}function getRealtimeAgents(){return amiClient[_0x0a88('0x17')](_0x0a88('0x18'),{})[_0x0a88('0x19')](function(_0x371834){if(_0x371834[_0x0a88('0x1a')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');}var _0x42e3e8=_0x371834[_0x0a88('0x1b')];return routingClient[_0x0a88('0x17')]('Agents',{})[_0x0a88('0x19')](function(_0x3da111){if(_0x3da111[_0x0a88('0x1a')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');}var _0xce5d6e=_0x3da111[_0x0a88('0x1b')];return _[_0x0a88('0x1c')]({},_0x42e3e8,_0xce5d6e);});})[_0x0a88('0x1d')](function(_0x239ec7){throw _0x239ec7;});}exports['getRealtimeAgents']=getRealtimeAgents;function getAgentStatus(_0x32593e){var _0x238af8=_0x0a88('0xd');if(isAgentPaused(_0x32593e))_0x238af8=_0x0a88('0x12');else if(isAgentPaused(_0x32593e,!![]))_0x238af8=_0x0a88('0x1e');else if(isAgentIdle(_0x32593e))_0x238af8=_0x0a88('0xc');else _0x238af8=_0x0a88('0x1f');return _0x238af8;}exports[_0x0a88('0x20')]=getAgentStatus;function getAgentIdsByQueues(_0x412bde,_0x3f7ec0){var _0xf9fe78=_[_0x0a88('0x21')](_0x412bde)?_0x412bde:[_0x412bde];var _0xe59c31=_['startCase'](_0x3f7ec0)+_0x0a88('0x22');var _0x3a296f=_['map'](_0xf9fe78,function(_0x423e28){return db[_0xe59c31][_0x0a88('0x23')]({'where':{'id':_0x423e28}})[_0x0a88('0x19')](function(_0x43c848){if(!_0x43c848)return[];return _0x43c848[_0x0a88('0x24')]({'attributes':['id'],'raw':!![]});});});return Promise['all'](_0x3a296f)['then'](function(_0x177b73){var _0x4f5add=_(_0x177b73)['flatten']()['map']('id')['uniq']()['value']();return _0x4f5add;});}exports[_0x0a88('0x25')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x330ed7,_0x5cee64,_0x21e4d4){try{if(_0x5cee64[_0x0a88('0x26')]>0x0){_0x330ed7=_0x330ed7['filter'](function(_0xf29ba5){return _0x5cee64['includes'](_0xf29ba5['id']);});}var _0x4d8044=_0x330ed7[_0x0a88('0xb')](function(_0x5656b0){var _0x342713='busy';if(isAgentIdle(_0x5656b0)){_0x342713='idle';}return _0x342713===_0x21e4d4;});return _[_0x0a88('0x27')](_0x4d8044,'id');}catch(_0x28a8f3){throw _0x28a8f3;}}exports[_0x0a88('0x28')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x6cdf8,_0x310844,_0x41f517){return Promise['resolve']()['then'](function(){if(_0x310844[_0x0a88('0x26')]>0x0){_0x6cdf8=_0x6cdf8[_0x0a88('0xb')](function(_0x44e449){return _0x310844[_0x0a88('0x29')](_0x44e449['id']);});}return _0x6cdf8;})[_0x0a88('0x19')](function(){return db[_0x0a88('0x2a')][_0x0a88('0x2b')]({'attributes':['id',_0x0a88('0x2c'),_0x0a88('0x2d'),_0x0a88('0x5'),_0x0a88('0x2e'),'mailPause',_0x0a88('0x7'),'smsPause',_0x0a88('0x9'),_0x0a88('0x2f'),_0x0a88('0x30')],'where':{'id':{'$in':_[_0x0a88('0x27')](_0x6cdf8,'id')}},'raw':!![]});})[_0x0a88('0x19')](function(_0x4653ef){return _0x4653ef[_0x0a88('0x27')](function(_0x9b3eb6){var _0x36a94f=_[_0x0a88('0x31')](_0x6cdf8,['id',_0x9b3eb6['id']]);var _0x57233a=filterAgentAttributes(_0x36a94f);_[_0x0a88('0x1c')](_0x9b3eb6,_0x57233a);_0x9b3eb6[_0x0a88('0x32')]=getAgentStatus(_0x9b3eb6);return _0x9b3eb6;});})[_0x0a88('0x19')](function(_0x440cc2){var _0x376514=sortAgentsByStatus(_0x440cc2,_0x41f517);return _['map'](_0x376514,'id');})[_0x0a88('0x1d')](function(_0x3b2ae4){throw _0x3b2ae4;});}exports['getSortedAgentsIdsByStatus']=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x4223ff){var _0x581fb4={'fields':[],'order':null};var _0x1e01bf=_0x4223ff[_0x0a88('0x33')](',');_0x581fb4[_0x0a88('0x34')]=_[_0x0a88('0xb')](_0x1e01bf,function(_0x4454be){if(!_0x4454be[_0x0a88('0x29')](_0x0a88('0x32'))){return!![];}_0x581fb4[_0x0a88('0x35')]=_['startsWith'](_0x4454be,'-')?_0x0a88('0x36'):_0x0a88('0x37');return![];});return _0x581fb4;}exports[_0x0a88('0x38')]=getUpdatedSortOptions;function validateSortParameter(_0x5bdc7b){if(!_0x5bdc7b){_0x5bdc7b=_0x0a88('0x39');}if(_0x5bdc7b[_0x0a88('0x29')](_0x0a88('0x2d'))&&!_0x5bdc7b[_0x0a88('0x29')](_0x0a88('0x3a'))){var _0x228fa7=_0x5bdc7b['substring'](0x0,_0x5bdc7b[_0x0a88('0x3b')]('fullname'));_0x5bdc7b+=','+_0x228fa7+_0x0a88('0x3a');}return _0x5bdc7b;}exports['validateSortParameter']=validateSortParameter;function sortAgentsByStatus(_0x7f49e5,_0x2ae97d){var _0x35f3a1=_0x7f49e5[_0x0a88('0x3c')](function(_0x1c0f7c,_0x1dcba2){if(_0x1c0f7c[_0x0a88('0x32')]===_0x1dcba2[_0x0a88('0x32')]){if(_0x1c0f7c[_0x0a88('0x32')]===_0x0a88('0x12')){if(_0x2ae97d===_0x0a88('0x36')){return(_0x1c0f7c[_0x0a88('0x30')]||'')<(_0x1dcba2[_0x0a88('0x30')]||'')||_0x1c0f7c[_0x0a88('0x2d')][_0x0a88('0x3d')]()>_0x1dcba2['fullname'][_0x0a88('0x3d')]()?0x1:-0x1;}else{return(_0x1c0f7c[_0x0a88('0x30')]||'')<(_0x1dcba2['pauseType']||'')||_0x1c0f7c[_0x0a88('0x2d')][_0x0a88('0x3d')]()>_0x1dcba2['fullname']['toLowerCase']()?-0x1:0x1;}}else{if(_0x2ae97d==='DESC'){return _0x1c0f7c[_0x0a88('0x2d')][_0x0a88('0x3d')]()<_0x1dcba2[_0x0a88('0x2d')]['toLowerCase']()?0x1:-0x1;}else{return _0x1c0f7c[_0x0a88('0x2d')][_0x0a88('0x3d')]()<_0x1dcba2[_0x0a88('0x2d')]['toLowerCase']()?-0x1:0x1;}}}else{if(_0x2ae97d==='DESC'){return _0x1c0f7c[_0x0a88('0x32')]<_0x1dcba2[_0x0a88('0x32')]?0x1:-0x1;}else{return _0x1c0f7c[_0x0a88('0x32')]<_0x1dcba2[_0x0a88('0x32')]?-0x1:0x1;}}});return _0x35f3a1;}exports[_0x0a88('0x3e')]=sortAgentsByStatus;function filterAgentAttributes(_0x3ee008){var _0x1af4af=[_0x0a88('0x3f'),_0x0a88('0x40'),'lastLoginAt',_0x0a88('0x41'),_0x0a88('0x30'),_0x0a88('0x41'),_0x0a88('0x3a'),_0x0a88('0x42'),'chatPause','openchannelPause',_0x0a88('0x6'),_0x0a88('0x8'),_0x0a88('0x2f'),'faxPause',_0x0a88('0x9'),_0x0a88('0x43'),_0x0a88('0x44'),_0x0a88('0x45'),'smsCapacity',_0x0a88('0x46'),_0x0a88('0x47'),_0x0a88('0x48'),_0x0a88('0x49'),'mailCurrentCapacity',_0x0a88('0x4a'),'whatsappCurrentCapacity','faxCurrentCapacity','chatStatus',_0x0a88('0x15'),_0x0a88('0x4b'),_0x0a88('0x16'),'whatsappStatus','faxStatus',_0x0a88('0x11'),_0x0a88('0x4c'),_0x0a88('0x4d'),_0x0a88('0x4e'),_0x0a88('0x4f'),_0x0a88('0x50'),_0x0a88('0x51'),_0x0a88('0x52'),_0x0a88('0x53'),'destconnectedlinenum','screenrecording',_0x0a88('0x54'),_0x0a88('0x55')];var _0x5a3269=[_0x0a88('0x5'),_0x0a88('0x7'),'mailPause',_0x0a88('0x8'),_0x0a88('0x2f'),_0x0a88('0x2e'),_0x0a88('0x9'),_0x0a88('0x40')];var _0x2e90e5=_(_0x3ee008)['omit'](_0x5a3269)[_0x0a88('0x56')](_0x1af4af)['value']();return _0x2e90e5;}exports[_0x0a88('0x57')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0x0a88('0x2c'),'fullname',_0x0a88('0x58'),'internal',_0x0a88('0x40'),_0x0a88('0x32'),_0x0a88('0x3f'),_0x0a88('0x59'),'pauseType','lastPauseAt',_0x0a88('0x2e'),_0x0a88('0x5'),_0x0a88('0x6'),_0x0a88('0x7'),'smsPause','voicePause',_0x0a88('0x2f'),'chatStatus',_0x0a88('0x14'),_0x0a88('0x4b'),_0x0a88('0x15'),'smsStatus',_0x0a88('0x11'),_0x0a88('0x5a'),_0x0a88('0x4c'),_0x0a88('0x51'),_0x0a88('0x4e'),_0x0a88('0x4d'),_0x0a88('0x4f'),_0x0a88('0x52'),_0x0a88('0x50'),_0x0a88('0x43'),_0x0a88('0x47'),_0x0a88('0x45'),'openchannelCapacity','smsCapacity',_0x0a88('0x46'),_0x0a88('0x48'),_0x0a88('0x5b'),'mailCurrentCapacity',_0x0a88('0x49'),_0x0a88('0x4a'),_0x0a88('0x5c'),'phoneBarEnableScreenRecordingByAgent',_0x0a88('0x55'),_0x0a88('0x5d'),_0x0a88('0x5e'),_0x0a88('0x53'),_0x0a88('0x5f')];}exports[_0x0a88('0x60')]=getRealtimeAgentsQueryFields; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index 5107227..0acacad 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 _0x874a=['predictiveIntervalAvgTalktime','voice','request','startCase','then','error','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','getRealtimeQueues','inbound','concat','outbound','map','get','available','waiting','originated','find','merge','initializeQueues','jayson/promise','client','http','loggedIn','paused','busy','inUse','invalid','loggedInDb','notInUse','onHold','ringing','ringInUse','talking','unavailable','pTalking','dialMethod','Trunk','startProgressive','erlangCalls','erlangCallToSecond','erlangBusyFactor','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime'];(function(_0x324035,_0x415e44){var _0x159405=function(_0x1b599c){while(--_0x1b599c){_0x324035['push'](_0x324035['shift']());}};_0x159405(++_0x415e44);}(_0x874a,0xd1));var _0xa874=function(_0x3301bb,_0x20d3f5){_0x3301bb=_0x3301bb-0x0;var _0x53de55=_0x874a[_0x3301bb];return _0x53de55;};'use strict';var _=require('lodash');var jayson=require(_0xa874('0x0'));var util=require('util');var amiClient=jayson[_0xa874('0x1')][_0xa874('0x2')]({'port':0x232a});var routingClient=jayson['client'][_0xa874('0x2')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=['available',_0xa874('0x3'),_0xa874('0x4'),'waiting'];var VOICE_QUEUE_ATTRIBUTES=[_0xa874('0x5'),_0xa874('0x6'),_0xa874('0x7'),_0xa874('0x8'),_0xa874('0x9'),_0xa874('0xa'),_0xa874('0xb'),_0xa874('0xc'),_0xa874('0xd'),_0xa874('0xe'),'unknown'];var OUTBOUND_QUEUE_ATTRIBUTES=[_0xa874('0xf'),'originated','message','statusMessage','dialActive',_0xa874('0x10'),_0xa874('0x11'),'startPredictive',_0xa874('0x12'),_0xa874('0x13'),_0xa874('0x14'),'erlangAbandonmentRate',_0xa874('0x15'),'dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable',_0xa874('0x16'),'predictiveIntervalAnsweredCalls',_0xa874('0x17'),_0xa874('0x18'),_0xa874('0x19'),_0xa874('0x1a')];function getRealtimeQueues(_0x5ba379,_0x243034){var _0x16f8a8=_0x243034===_0xa874('0x1b')?amiClient:routingClient;return _0x16f8a8[_0xa874('0x1c')](_[_0xa874('0x1d')](_0x243034)+'Queues',_0x5ba379)[_0xa874('0x1e')](function(_0x19f9f3){if(_0x19f9f3[_0xa874('0x1f')])throw new Error(util['format'](_0xa874('0x20'),_0x243034));return _0x19f9f3[_0xa874('0x21')];})[_0xa874('0x22')](function(_0x42a36c){throw _0x42a36c;});}exports[_0xa874('0x23')]=getRealtimeQueues;function initializeQueues(_0x29a1ad,_0x59bc81,_0x486294,_0x49ac09){var _0x5a93f6=DEFAULT_QUEUE_ATTRIBUTES;if(_0x486294===_0xa874('0x1b')){if(_0x49ac09===_0xa874('0x24')){_0x5a93f6=_0x5a93f6[_0xa874('0x25')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x49ac09===_0xa874('0x26')){_0x5a93f6=_0x5a93f6[_0xa874('0x25')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x29a1ad[_0xa874('0x27')](function(_0x29ac6b){var _0x5d8c88=_0x29ac6b[_0xa874('0x28')]({'plain':!![]});_0x5d8c88[_0xa874('0x4')]=0x0;_0x5d8c88[_0xa874('0x8')]=0x0;_0x5d8c88['loggedIn']=0x0;_0x5d8c88[_0xa874('0x29')]=0x0;_0x5d8c88[_0xa874('0x2a')]=0x0;if(_0x486294===_0xa874('0x1b')){_0x5d8c88[_0xa874('0xd')]=0x0;_0x5d8c88[_0xa874('0x5')]=0x0;if(_0x49ac09===_0xa874('0x26')){_0x5d8c88[_0xa874('0xf')]=0x0;_0x5d8c88[_0xa874('0x2b')]=0x0;}}var _0x3dba3e=_[_0xa874('0x2c')](_0x59bc81,['id',_0x5d8c88['id']]);if(_0x3dba3e){_[_0xa874('0x2d')](_0x5d8c88,_['pick'](_0x3dba3e,_0x5a93f6));}return _0x5d8c88;});}exports[_0xa874('0x2e')]=initializeQueues; \ No newline at end of file +var _0x116b=['pTalking','message','statusMessage','dialMethod','startPredictive','startProgressive','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','voice','request','startCase','Queues','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','inbound','concat','map','get','available','outbound','originated','find','merge','pick','jayson/promise','util','client','http','loggedIn','paused','waiting','busy','inUse','invalid','loggedInDb','notInUse','onHold','ringing','ringInUse','talking'];(function(_0x474a0d,_0x2a602f){var _0x444448=function(_0x420c29){while(--_0x420c29){_0x474a0d['push'](_0x474a0d['shift']());}};_0x444448(++_0x2a602f);}(_0x116b,0x1ee));var _0xb116=function(_0x50749b,_0x24bf72){_0x50749b=_0x50749b-0x0;var _0x4c1298=_0x116b[_0x50749b];return _0x4c1298;};'use strict';var _=require('lodash');var jayson=require(_0xb116('0x0'));var util=require(_0xb116('0x1'));var amiClient=jayson[_0xb116('0x2')]['http']({'port':0x232a});var routingClient=jayson['client'][_0xb116('0x3')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=['available',_0xb116('0x4'),_0xb116('0x5'),_0xb116('0x6')];var VOICE_QUEUE_ATTRIBUTES=[_0xb116('0x7'),_0xb116('0x8'),_0xb116('0x9'),_0xb116('0xa'),_0xb116('0xb'),_0xb116('0xc'),_0xb116('0xd'),_0xb116('0xe'),_0xb116('0xf'),'unavailable','unknown'];var OUTBOUND_QUEUE_ATTRIBUTES=[_0xb116('0x10'),'originated',_0xb116('0x11'),_0xb116('0x12'),'dialActive',_0xb116('0x13'),'Trunk',_0xb116('0x14'),_0xb116('0x15'),'erlangCalls',_0xb116('0x16'),_0xb116('0x17'),_0xb116('0x18'),_0xb116('0x19'),_0xb116('0x1a'),_0xb116('0x1b'),_0xb116('0x1c'),_0xb116('0x1d'),_0xb116('0x1e'),_0xb116('0x1f'),_0xb116('0x20'),_0xb116('0x21'),'predictiveIntervalAvgTalktime'];function getRealtimeQueues(_0x28319c,_0xe96d31){var _0xa9b902=_0xe96d31===_0xb116('0x22')?amiClient:routingClient;return _0xa9b902[_0xb116('0x23')](_[_0xb116('0x24')](_0xe96d31)+_0xb116('0x25'),_0x28319c)['then'](function(_0x4703df){if(_0x4703df['error'])throw new Error(util['format'](_0xb116('0x26'),_0xe96d31));return _0x4703df[_0xb116('0x27')];})[_0xb116('0x28')](function(_0x45a5a8){throw _0x45a5a8;});}exports['getRealtimeQueues']=getRealtimeQueues;function initializeQueues(_0x45d0e8,_0x2a34ad,_0x16f371,_0x1942ee){var _0x5b4c9a=DEFAULT_QUEUE_ATTRIBUTES;if(_0x16f371===_0xb116('0x22')){if(_0x1942ee===_0xb116('0x29')){_0x5b4c9a=_0x5b4c9a[_0xb116('0x2a')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x1942ee==='outbound'){_0x5b4c9a=_0x5b4c9a[_0xb116('0x2a')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x45d0e8[_0xb116('0x2b')](function(_0x80d097){var _0x4702ac=_0x80d097[_0xb116('0x2c')]({'plain':!![]});_0x4702ac[_0xb116('0x5')]=0x0;_0x4702ac[_0xb116('0xa')]=0x0;_0x4702ac[_0xb116('0x4')]=0x0;_0x4702ac[_0xb116('0x2d')]=0x0;_0x4702ac[_0xb116('0x6')]=0x0;if(_0x16f371===_0xb116('0x22')){_0x4702ac[_0xb116('0xf')]=0x0;_0x4702ac[_0xb116('0x7')]=0x0;if(_0x1942ee===_0xb116('0x2e')){_0x4702ac[_0xb116('0x10')]=0x0;_0x4702ac[_0xb116('0x2f')]=0x0;}}var _0x386ff9=_[_0xb116('0x30')](_0x2a34ad,['id',_0x4702ac['id']]);if(_0x386ff9){_[_0xb116('0x31')](_0x4702ac,_[_0xb116('0x32')](_0x386ff9,_0x5b4c9a));}return _0x4702ac;});}exports['initializeQueues']=initializeQueues; \ No newline at end of file diff --git a/server/config/environment/development.js b/server/config/environment/development.js index 9753583..e98170d 100644 --- a/server/config/environment/development.js +++ b/server/config/environment/development.js @@ -88,5 +88,6 @@ module.exports = { baseDN: process.env.AD_BASEDN || '', url: process.env.AD_URL, domain: process.env.AD_DOMAIN - } + }, + emailMaxHTMLbytesLimit: process.env.XC_EMAIL_MAX_HTML_BYTES_LIMIT || 4000000000, }; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 4db9451..f81ebcc 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(_0x200aa5,_0x197802){var _0x458200=function(_0x594959){while(--_0x594959){_0x200aa5['push'](_0x200aa5['shift']());}};_0x458200(++_0x197802);}(_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 +var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x4f6864,_0xdb09cc){var _0xcd9bd1=function(_0xb3ac37){while(--_0xb3ac37){_0x4f6864['push'](_0x4f6864['shift']());}};_0xcd9bd1(++_0xdb09cc);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 3f9f700..39e1050 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 _0x0d18=['00:00:00:00:00:00','address','getFirstInterface','cpus','model','createHash','md5','update','digest','getUuid','platform','test','utf8','hostname','ipAddress','substring','lodash','crypto','child_process','networkInterfaces','orderBy','keys','length','filter','IPv4','internal','head','mac'];(function(_0x3b7a0c,_0xf1a4c2){var _0x3bb70f=function(_0x248b52){while(--_0x248b52){_0x3b7a0c['push'](_0x3b7a0c['shift']());}};_0x3bb70f(++_0xf1a4c2);}(_0x0d18,0x80));var _0x80d1=function(_0xda0714,_0x43de77){_0xda0714=_0xda0714-0x0;var _0x16b3c3=_0x0d18[_0xda0714];return _0x16b3c3;};'use strict';var _=require(_0x80d1('0x0'));var os=require('os');var crypto=require(_0x80d1('0x1'));var machine=require('bimedia-machine-uuid');var exec=require(_0x80d1('0x2'))['execSync'];var config=require('../environment');function getInterfaces(){var _0x417d66=[];var _0x279620=os[_0x80d1('0x3')]();var _0x2936a8=_[_0x80d1('0x4')](_[_0x80d1('0x5')](_0x279620));for(var _0x5482b0=0x0;_0x5482b0<_0x2936a8[_0x80d1('0x6')];_0x5482b0++){var _0x3634dc=_0x279620[_0x2936a8[_0x5482b0]][_0x80d1('0x7')](function(_0x59434c){return _0x59434c['family']===_0x80d1('0x8')&&_0x59434c[_0x80d1('0x9')]===![];});_0x417d66=_0x417d66['concat'](_0x3634dc);}return _0x417d66;}function getFirstInterface(){var _0x780911=_[_0x80d1('0xa')](getInterfaces());return{'macAddress':_0x780911&&_0x780911[_0x80d1('0xb')]?_0x780911['mac']:_0x80d1('0xc'),'ipAddress':_0x780911&&_0x780911[_0x80d1('0xd')]?_0x780911[_0x80d1('0xd')]:'127.0.0.1'};}exports[_0x80d1('0xe')]=getFirstInterface;function getCPUhash(){var _0x3613b8=_['orderBy'](os[_0x80d1('0xf')]()['map'](function(_0x2e7e0e){return _0x2e7e0e[_0x80d1('0x10')];}))['join'](':');return crypto[_0x80d1('0x11')](_0x80d1('0x12'))[_0x80d1('0x13')](_0x3613b8)[_0x80d1('0x14')]('hex');}exports[_0x80d1('0x15')]=function(){var _0xa4e37d=os[_0x80d1('0x16')]();var _0x41d432=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x41d432[_0x80d1('0x17')](config['licenseToken'])){return config['licenseToken'];}else if(_0xa4e37d==='win32'){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0x80d1('0x18')})['replace']('\x0d\x0a','');}else{var _0x2cc73a=getFirstInterface();var _0x51823a=getCPUhash();var _0x3b6649=_0x51823a+'|'+os[_0x80d1('0x19')]()+'|'+_0x2cc73a['macAddress']+'|'+_0x2cc73a[_0x80d1('0x1a')];var _0x34ebd8=crypto['createHash'](_0x80d1('0x12'))['update'](_0x3b6649)[_0x80d1('0x14')]('hex');return _0x34ebd8['substring'](0x0,0x8)+'-'+_0x34ebd8[_0x80d1('0x1b')](0x8,0xc)+'-'+_0x34ebd8[_0x80d1('0x1b')](0xc,0x10)+'-'+_0x34ebd8[_0x80d1('0x1b')](0x10,0x14)+'-'+_0x34ebd8[_0x80d1('0x1b')](0x14);}}; \ No newline at end of file +var _0x4510=['getUuid','platform','licenseToken','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','hex','substring','lodash','crypto','bimedia-machine-uuid','../environment','networkInterfaces','orderBy','keys','length','filter','family','IPv4','internal','concat','head','00:00:00:00:00:00','127.0.0.1','getFirstInterface','cpus','model','join','createHash','md5','update','digest'];(function(_0x1629eb,_0x305130){var _0x230f76=function(_0x343461){while(--_0x343461){_0x1629eb['push'](_0x1629eb['shift']());}};_0x230f76(++_0x305130);}(_0x4510,0x1bc));var _0x0451=function(_0x3185ad,_0x5e5ca2){_0x3185ad=_0x3185ad-0x0;var _0x4f77fb=_0x4510[_0x3185ad];return _0x4f77fb;};'use strict';var _=require(_0x0451('0x0'));var os=require('os');var crypto=require(_0x0451('0x1'));var machine=require(_0x0451('0x2'));var exec=require('child_process')['execSync'];var config=require(_0x0451('0x3'));function getInterfaces(){var _0x2d8091=[];var _0x39db70=os[_0x0451('0x4')]();var _0x3c3e85=_[_0x0451('0x5')](_[_0x0451('0x6')](_0x39db70));for(var _0x55ce96=0x0;_0x55ce96<_0x3c3e85[_0x0451('0x7')];_0x55ce96++){var _0x37d1c3=_0x39db70[_0x3c3e85[_0x55ce96]][_0x0451('0x8')](function(_0x3f76a2){return _0x3f76a2[_0x0451('0x9')]===_0x0451('0xa')&&_0x3f76a2[_0x0451('0xb')]===![];});_0x2d8091=_0x2d8091[_0x0451('0xc')](_0x37d1c3);}return _0x2d8091;}function getFirstInterface(){var _0x42a042=_[_0x0451('0xd')](getInterfaces());return{'macAddress':_0x42a042&&_0x42a042['mac']?_0x42a042['mac']:_0x0451('0xe'),'ipAddress':_0x42a042&&_0x42a042['address']?_0x42a042['address']:_0x0451('0xf')};}exports[_0x0451('0x10')]=getFirstInterface;function getCPUhash(){var _0x512fbe=_[_0x0451('0x5')](os[_0x0451('0x11')]()['map'](function(_0x9b9f69){return _0x9b9f69[_0x0451('0x12')];}))[_0x0451('0x13')](':');return crypto[_0x0451('0x14')](_0x0451('0x15'))[_0x0451('0x16')](_0x512fbe)[_0x0451('0x17')]('hex');}exports[_0x0451('0x18')]=function(){var _0x580ddf=os[_0x0451('0x19')]();var _0x59185c=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x59185c['test'](config[_0x0451('0x1a')])){return config[_0x0451('0x1a')];}else if(_0x580ddf===_0x0451('0x1b')){return exec(_0x0451('0x1c'),{'encoding':_0x0451('0x1d')})[_0x0451('0x1e')]('\x0d\x0a','');}else{var _0x4c8bb1=getFirstInterface();var _0x1d45e5=getCPUhash();var _0x58fd1d=_0x1d45e5+'|'+os[_0x0451('0x1f')]()+'|'+_0x4c8bb1[_0x0451('0x20')]+'|'+_0x4c8bb1[_0x0451('0x21')];var _0x5c70b5=crypto['createHash']('md5')['update'](_0x58fd1d)['digest'](_0x0451('0x22'));return _0x5c70b5['substring'](0x0,0x8)+'-'+_0x5c70b5[_0x0451('0x23')](0x8,0xc)+'-'+_0x5c70b5[_0x0451('0x23')](0xc,0x10)+'-'+_0x5c70b5['substring'](0x10,0x14)+'-'+_0x5c70b5[_0x0451('0x23')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 7486c4c..adbeed7 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 _0x8780=['moment','request-promise','bluebird','pkginfo','version','../../mysqldb','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','data1','data2','active','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','encryptString','days','DEMO\x20START\x20AT\x20%s','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','error','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','message','default','util'];(function(_0x4a303e,_0x31691c){var _0xf4df35=function(_0x1f0496){while(--_0x1f0496){_0x4a303e['push'](_0x4a303e['shift']());}};_0xf4df35(++_0x31691c);}(_0x8780,0xa7));var _0x0878=function(_0x1ddaa7,_0x532342){_0x1ddaa7=_0x1ddaa7-0x0;var _0x5ae216=_0x8780[_0x1ddaa7];return _0x5ae216;};'use strict';var util=require(_0x0878('0x0'));var moment=require(_0x0878('0x1'));var rp=require(_0x0878('0x2'));var BPromise=require(_0x0878('0x3'));var pkginfo=require(_0x0878('0x4'))(module,_0x0878('0x5'));var db=require(_0x0878('0x6'))['db'];var encryptor=require('../../components/encryptor');var hardware=require('./hardware');var logger=require(_0x0878('0x7'))(_0x0878('0x8'));var HOST=_0x0878('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x5de42b){return new BPromise(function(_0x4fd3f2,_0x26102c){var _0x28cafd=util[_0x0878('0xa')](_0x0878('0xb'),HOST,_0x5de42b,module[_0x0878('0xc')][_0x0878('0x5')]);if(oldToken){_0x28cafd=util['format'](_0x0878('0xd'),HOST,_0x5de42b,module[_0x0878('0xc')][_0x0878('0x5')],oldToken);}var _0x5b306d={'uri':_0x28cafd,'method':_0x0878('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x5b306d)[_0x0878('0xf')](function(_0x9eb78f){_0x4fd3f2(_0x9eb78f);})[_0x0878('0x10')](function(_0x20de57){_0x26102c(_0x20de57);});});}function manageLicense(_0x2a3115,_0x12de91){var _0x548d8e=_0x12de91['get']({'plain':!![]});if(!isOldTokenSent&&_0x548d8e[_0x0878('0x11')]!==_0x2a3115&&!_0x548d8e[_0x0878('0x12')]){oldToken=_0x548d8e[_0x0878('0x11')];}httpRequest(_0x2a3115)[_0x0878('0xf')](function(_0x412352){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x412352[_0x0878('0x13')]){isOldTokenSent=![];if(!_0x548d8e['license']&&_0x548d8e[_0x0878('0x8')]!=_0x412352[_0x0878('0x8')]||_0x548d8e[_0x0878('0x8')]&&_0x548d8e[_0x0878('0x12')]){logger['info'](_0x0878('0x14'));}if(_0x548d8e[_0x0878('0x8')]&&!_0x548d8e[_0x0878('0x12')]&&_0x548d8e[_0x0878('0x8')]!=_0x412352[_0x0878('0x8')]){logger[_0x0878('0x15')](_0x0878('0x16'));}if(_0x548d8e['license']&&!_0x548d8e['data2']&&_0x548d8e[_0x0878('0x8')]==_0x412352[_0x0878('0x8')]){return _0x12de91;}return _0x12de91[_0x0878('0x17')]({'data1':_0x2a3115,'data2':null,'license':_0x412352[_0x0878('0x8')]});}else{if(_0x412352[_0x0878('0x8')]||_0x548d8e['license']){if(!_0x548d8e['data2']){if(_0x548d8e[_0x0878('0x11')]==_0x2a3115){GRAY_PERIOD_REASON=_0x0878('0x18');logger['info'](_0x0878('0x19'));}else{GRAY_PERIOD_REASON=_0x0878('0x1a');logger[_0x0878('0x15')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x548d8e['data1'],_0x2a3115);}logger[_0x0878('0x15')](_0x0878('0x1b'),GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0x0878('0xa')](_0x0878('0x1c')));return _0x12de91['update']({'data2':encryptor[_0x0878('0x1d')](moment()[_0x0878('0xa')](_0x0878('0x1c')))});}else{if(moment()['diff'](encryptor['decryptString'](_0x548d8e[_0x0878('0x12')]),_0x0878('0x1e'))>DAYS){logger[_0x0878('0x15')](_0x0878('0x1f'),moment()['format'](_0x0878('0x1c')));isOldTokenSent=![];return _0x12de91[_0x0878('0x17')]({'data1':_0x2a3115,'data2':null,'license':null});}}}else{if(_0x548d8e['data1']!=_0x2a3115){logger[_0x0878('0x15')](_0x0878('0x20'),_0x548d8e[_0x0878('0x11')],_0x2a3115);return _0x12de91[_0x0878('0x17')]({'data1':_0x2a3115,'data2':null,'license':null});}}}return _0x12de91;})[_0x0878('0xf')](function(_0x3f2b2e){_0x12de91=_0x3f2b2e;})[_0x0878('0x10')](function(_0xdaf653){logger[_0x0878('0x21')](_0xdaf653['message']);})[_0x0878('0x22')](function(){setTimeout(function(){manageLicense(hardware[_0x0878('0x23')](),_0x12de91);},TIME);});}function defaultLicense(){var _0x4ba26c=hardware[_0x0878('0x23')]();if(_0x4ba26c){return db[_0x0878('0x24')][_0x0878('0x25')]({'where':{'id':0x1},'defaults':{'data1':_0x4ba26c}})[_0x0878('0x26')](function(_0x549344,_0x5280d8){logger['info'](_0x0878('0x27'),_0x4ba26c);manageLicense(_0x4ba26c,_0x549344);})['catch'](function(_0x29131d){logger['error'](_0x29131d[_0x0878('0x28')]);});}}exports[_0x0878('0x29')]=defaultLicense; \ No newline at end of file +var _0xedec=['license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','GET','then','catch','data1','data2','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','update','Disabled','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','days','DEMO\x20START\x20AT\x20%s','finally','getUuid','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','error','message','util','moment','request-promise','bluebird','version','./hardware','../logger'];(function(_0xc39411,_0x458ec2){var _0x2f7a69=function(_0x5c0bf5){while(--_0x5c0bf5){_0xc39411['push'](_0xc39411['shift']());}};_0x2f7a69(++_0x458ec2);}(_0xedec,0x16b));var _0xcede=function(_0x3ceb6c,_0x554602){_0x3ceb6c=_0x3ceb6c-0x0;var _0x256814=_0xedec[_0x3ceb6c];return _0x256814;};'use strict';var util=require(_0xcede('0x0'));var moment=require(_0xcede('0x1'));var rp=require(_0xcede('0x2'));var BPromise=require(_0xcede('0x3'));var pkginfo=require('pkginfo')(module,_0xcede('0x4'));var db=require('../../mysqldb')['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0xcede('0x5'));var logger=require(_0xcede('0x6'))(_0xcede('0x7'));var HOST=_0xcede('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x4d30a7){return new BPromise(function(_0x324eb1,_0x527239){var _0x3be894=util[_0xcede('0x9')](_0xcede('0xa'),HOST,_0x4d30a7,module[_0xcede('0xb')]['version']);if(oldToken){_0x3be894=util[_0xcede('0x9')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x4d30a7,module[_0xcede('0xb')][_0xcede('0x4')],oldToken);}var _0x57fa95={'uri':_0x3be894,'method':_0xcede('0xc'),'timeout':0xea60,'json':!![]};return rp(_0x57fa95)[_0xcede('0xd')](function(_0x4a1f1a){_0x324eb1(_0x4a1f1a);})[_0xcede('0xe')](function(_0x51a3af){_0x527239(_0x51a3af);});});}function manageLicense(_0xfe6472,_0xa5b2d){var _0x4ef7b2=_0xa5b2d['get']({'plain':!![]});if(!isOldTokenSent&&_0x4ef7b2[_0xcede('0xf')]!==_0xfe6472&&!_0x4ef7b2[_0xcede('0x10')]){oldToken=_0x4ef7b2[_0xcede('0xf')];}httpRequest(_0xfe6472)['then'](function(_0x1b8dab){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x1b8dab[_0xcede('0x11')]){isOldTokenSent=![];if(!_0x4ef7b2[_0xcede('0x7')]&&_0x4ef7b2['license']!=_0x1b8dab['license']||_0x4ef7b2[_0xcede('0x7')]&&_0x4ef7b2[_0xcede('0x10')]){logger[_0xcede('0x12')](_0xcede('0x13'));}if(_0x4ef7b2[_0xcede('0x7')]&&!_0x4ef7b2[_0xcede('0x10')]&&_0x4ef7b2[_0xcede('0x7')]!=_0x1b8dab[_0xcede('0x7')]){logger[_0xcede('0x12')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x4ef7b2[_0xcede('0x7')]&&!_0x4ef7b2[_0xcede('0x10')]&&_0x4ef7b2[_0xcede('0x7')]==_0x1b8dab[_0xcede('0x7')]){return _0xa5b2d;}return _0xa5b2d[_0xcede('0x14')]({'data1':_0xfe6472,'data2':null,'license':_0x1b8dab[_0xcede('0x7')]});}else{if(_0x1b8dab[_0xcede('0x7')]||_0x4ef7b2[_0xcede('0x7')]){if(!_0x4ef7b2[_0xcede('0x10')]){if(_0x4ef7b2['data1']==_0xfe6472){GRAY_PERIOD_REASON=_0xcede('0x15');logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0xcede('0x16');logger[_0xcede('0x12')](_0xcede('0x17'),_0x4ef7b2[_0xcede('0xf')],_0xfe6472);}logger[_0xcede('0x12')](_0xcede('0x18'),GRAY_PERIOD_REASON[_0xcede('0x19')](),moment()[_0xcede('0x9')](_0xcede('0x1a')));return _0xa5b2d[_0xcede('0x14')]({'data2':encryptor[_0xcede('0x1b')](moment()[_0xcede('0x9')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0xcede('0x1c')](encryptor['decryptString'](_0x4ef7b2[_0xcede('0x10')]),_0xcede('0x1d'))>DAYS){logger['info'](_0xcede('0x1e'),moment()['format']('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0xa5b2d['update']({'data1':_0xfe6472,'data2':null,'license':null});}}}else{if(_0x4ef7b2['data1']!=_0xfe6472){logger[_0xcede('0x12')](_0xcede('0x17'),_0x4ef7b2['data1'],_0xfe6472);return _0xa5b2d[_0xcede('0x14')]({'data1':_0xfe6472,'data2':null,'license':null});}}}return _0xa5b2d;})[_0xcede('0xd')](function(_0x242de6){_0xa5b2d=_0x242de6;})[_0xcede('0xe')](function(_0x905c6){logger['error'](_0x905c6['message']);})[_0xcede('0x1f')](function(){setTimeout(function(){manageLicense(hardware[_0xcede('0x20')](),_0xa5b2d);},TIME);});}function defaultLicense(){var _0x388137=hardware[_0xcede('0x20')]();if(_0x388137){return db['License'][_0xcede('0x21')]({'where':{'id':0x1},'defaults':{'data1':_0x388137}})['spread'](function(_0x3704b6,_0x5f2ac7){logger[_0xcede('0x12')](_0xcede('0x22'),_0x388137);manageLicense(_0x388137,_0x3704b6);})[_0xcede('0xe')](function(_0x5af018){logger[_0xcede('0x23')](_0x5af018[_0xcede('0x24')]);});}}exports['default']=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 3883dc9..370c106 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 _0x3bb2=['format','demo','gray','deadline','days','grayReason','machineUuid','changed','disabled','message','User','findAll','role','sequelize','COUNT','count','admin','user','users','forEach','countBy','telephone','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','getUuid','Breaking\x20license','License','find','defaults','then','catch','uuid','data1','license','isEmpty','data2','split'];(function(_0x55d244,_0x3bf14d){var _0x422d81=function(_0x1bc601){while(--_0x1bc601){_0x55d244['push'](_0x55d244['shift']());}};_0x422d81(++_0x3bf14d);}(_0x3bb2,0xc9));var _0x23bb=function(_0x4ca395,_0x2c9ee1){_0x4ca395=_0x4ca395-0x0;var _0x386779=_0x3bb2[_0x4ca395];return _0x386779;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x23bb('0x0'));var BPromise=require(_0x23bb('0x1'));var hardware=require(_0x23bb('0x2'));var encryptor=require(_0x23bb('0x3'));var db=require(_0x23bb('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x23bb('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware[_0x23bb('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x23bb('0x7'),'machineUuid':hardware[_0x23bb('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x482448){return new BPromise(function(_0x170653,_0x8001ce){return db[_0x23bb('0x8')][_0x23bb('0x9')](_[_0x23bb('0xa')](_0x482448,{'raw':!![],'where':{'id':0x1}}))[_0x23bb('0xb')](function(_0x2464dd){return checkLicense(_0x2464dd,null);})[_0x23bb('0xb')](function(_0x4b6de2){_0x170653(_0x4b6de2);return;})[_0x23bb('0xc')](function(_0x25d2c1){_0x8001ce(_0x25d2c1);});});}function checkLicense(_0xf5ab4e,_0x6cb9a){if(!_0xf5ab4e){demoLicense[_0x23bb('0xd')]=_0xf5ab4e[_0x23bb('0xe')];return demoLicense;}try{var _0xf59b20=_0x6cb9a||_0xf5ab4e[_0x23bb('0xf')];if(_[_0x23bb('0x10')](_0xf59b20)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0xf5512f=_0xf5ab4e[_0x23bb('0xe')];var _0x746495=_0xf5ab4e[_0x23bb('0x11')];var _0x585f8e=_0xf5512f['split']('-')[0x4];var _0x403a5a=_0xf5512f[_0x23bb('0x12')]('-')[0x0];var _0x230a8e=encryptor['decryptString'](_0xf59b20,util[_0x23bb('0x13')]('%s:%s:%s',_0x585f8e,_0xf5512f,_0x403a5a));var _0x5f27bf=JSON['parse'](_0x230a8e);_0x5f27bf[_0x23bb('0x14')]=![];_0x5f27bf[_0x23bb('0xd')]=_0xf5512f;_0x5f27bf['machineUuid']=hardware[_0x23bb('0x6')]();if(_0x746495){var _0x14d819=encryptor['decryptString'](_0x746495);_0x5f27bf[_0x23bb('0x15')]=_0x14d819;_0x5f27bf[_0x23bb('0x16')]=moment(_0x14d819)['add'](0x7,_0x23bb('0x17'))[_0x23bb('0x13')]();_0x5f27bf[_0x23bb('0x18')]=_0x5f27bf[_0x23bb('0xd')]!=_0x5f27bf[_0x23bb('0x19')]?_0x23bb('0x1a'):_0x23bb('0x1b');}return _0x5f27bf;}catch(_0x26dc3e){breakingLicense[_0x23bb('0xd')]=_0xf5ab4e['data1'];breakingLicense[_0x23bb('0x1c')]=_0x26dc3e[_0x23bb('0x1c')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x1f9f8d,_0xdf41d2){getLicense()[_0x23bb('0xb')](function(_0x207ed5){return db[_0x23bb('0x1d')][_0x23bb('0x1e')]({'attributes':[_0x23bb('0x1f'),[db[_0x23bb('0x20')]['fn'](_0x23bb('0x21'),db['sequelize']['col'](_0x23bb('0x1f'))),_0x23bb('0x22')]],'group':_0x23bb('0x1f'),'where':{'role':{'$or':[_0x23bb('0x23'),_0x23bb('0x24'),'telephone']}},'raw':!![]})[_0x23bb('0xb')](function(_0x3d0690){var _0x45598d={'user':_0x207ed5[_0x23bb('0x25')]||0x0,'telephone':_0x207ed5['telephones']||0x0};_0x3d0690[_0x23bb('0x26')](function(_0x2a05f2){var _0x50171f=_0x2a05f2[_0x23bb('0x1f')]===_0x23bb('0x23')?_0x23bb('0x24'):_0x2a05f2[_0x23bb('0x1f')];_0x45598d[_0x50171f]-=_0x2a05f2[_0x23bb('0x22')];if(_0x45598d[_0x50171f]<0x0)_0x45598d[_0x50171f]=0x0;});_0x1f9f8d(_0x45598d);return;});})[_0x23bb('0xc')](function(_0x25d033){_0xdf41d2(_0x25d033);});});}function checkUserLimits(_0x5810f8){return new BPromise(function(_0x285b1f,_0x44041d){getLimits()[_0x23bb('0xb')](function(_0x3d3923){var _0x46e8f9=_['pick'](_[_0x23bb('0x27')](_0x5810f8,_0x23bb('0x1f')),[_0x23bb('0x23'),'user',_0x23bb('0x28')]);var _0x6b542f=(_0x46e8f9[_0x23bb('0x23')]||0x0)+(_0x46e8f9['user']||0x0);var _0x1953fb=_0x46e8f9['telephone']||0x0;if(_0x6b542f>_0x3d3923[_0x23bb('0x24')])return _0x44041d(_0x23bb('0x29'));if(_0x1953fb>_0x3d3923[_0x23bb('0x28')])return _0x44041d(_0x23bb('0x2a'));return _0x285b1f();})[_0x23bb('0xc')](function(_0xe1905){_0x44041d(_0xe1905);});});}module[_0x23bb('0x2b')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x25b5=['lodash','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','getUuid','Breaking\x20license','License','find','defaults','then','uuid','data1','license','isEmpty','data2','split','decryptString','format','parse','demo','gray','deadline','add','days','grayReason','machineUuid','changed','disabled','message','User','findAll','sequelize','col','role','count','users','telephones','forEach','admin','user','catch','countBy','telephone','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','util'];(function(_0x32ee61,_0x3f1b2d){var _0x226c2f=function(_0x46ac3a){while(--_0x46ac3a){_0x32ee61['push'](_0x32ee61['shift']());}};_0x226c2f(++_0x3f1b2d);}(_0x25b5,0xef));var _0x525b=function(_0x62f5fa,_0x554f6e){_0x62f5fa=_0x62f5fa-0x0;var _0x4aaa91=_0x25b5[_0x62f5fa];return _0x4aaa91;};'use strict';var util=require(_0x525b('0x0'));var _=require(_0x525b('0x1'));var moment=require('moment');var BPromise=require(_0x525b('0x2'));var hardware=require(_0x525b('0x3'));var encryptor=require(_0x525b('0x4'));var db=require(_0x525b('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x525b('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware[_0x525b('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x525b('0x8'),'machineUuid':hardware[_0x525b('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x352227){return new BPromise(function(_0x2efc9f,_0x1ce49){return db[_0x525b('0x9')][_0x525b('0xa')](_[_0x525b('0xb')](_0x352227,{'raw':!![],'where':{'id':0x1}}))[_0x525b('0xc')](function(_0x515cdb){return checkLicense(_0x515cdb,null);})[_0x525b('0xc')](function(_0xd857f7){_0x2efc9f(_0xd857f7);return;})['catch'](function(_0x1f40f2){_0x1ce49(_0x1f40f2);});});}function checkLicense(_0x1aae13,_0x32d5a1){if(!_0x1aae13){demoLicense[_0x525b('0xd')]=_0x1aae13[_0x525b('0xe')];return demoLicense;}try{var _0x2ff10f=_0x32d5a1||_0x1aae13[_0x525b('0xf')];if(_[_0x525b('0x10')](_0x2ff10f)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x211a73=_0x1aae13[_0x525b('0xe')];var _0x57b217=_0x1aae13[_0x525b('0x11')];var _0x5588c4=_0x211a73[_0x525b('0x12')]('-')[0x4];var _0x4f01ec=_0x211a73[_0x525b('0x12')]('-')[0x0];var _0x3973bf=encryptor[_0x525b('0x13')](_0x2ff10f,util[_0x525b('0x14')]('%s:%s:%s',_0x5588c4,_0x211a73,_0x4f01ec));var _0x581ff5=JSON[_0x525b('0x15')](_0x3973bf);_0x581ff5[_0x525b('0x16')]=![];_0x581ff5[_0x525b('0xd')]=_0x211a73;_0x581ff5['machineUuid']=hardware[_0x525b('0x7')]();if(_0x57b217){var _0x2b95d5=encryptor[_0x525b('0x13')](_0x57b217);_0x581ff5[_0x525b('0x17')]=_0x2b95d5;_0x581ff5[_0x525b('0x18')]=moment(_0x2b95d5)[_0x525b('0x19')](0x7,_0x525b('0x1a'))[_0x525b('0x14')]();_0x581ff5[_0x525b('0x1b')]=_0x581ff5['uuid']!=_0x581ff5[_0x525b('0x1c')]?_0x525b('0x1d'):_0x525b('0x1e');}return _0x581ff5;}catch(_0x3015b7){breakingLicense[_0x525b('0xd')]=_0x1aae13[_0x525b('0xe')];breakingLicense['message']=_0x3015b7[_0x525b('0x1f')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0xf5f521,_0x594e72){getLicense()[_0x525b('0xc')](function(_0x5d1873){return db[_0x525b('0x20')][_0x525b('0x21')]({'attributes':['role',[db[_0x525b('0x22')]['fn']('COUNT',db[_0x525b('0x22')][_0x525b('0x23')](_0x525b('0x24'))),_0x525b('0x25')]],'group':'role','where':{'role':{'$or':['admin','user','telephone']}},'raw':!![]})[_0x525b('0xc')](function(_0x342c83){var _0x587679={'user':_0x5d1873[_0x525b('0x26')]||0x0,'telephone':_0x5d1873[_0x525b('0x27')]||0x0};_0x342c83[_0x525b('0x28')](function(_0x3718a4){var _0x511fde=_0x3718a4[_0x525b('0x24')]===_0x525b('0x29')?_0x525b('0x2a'):_0x3718a4['role'];_0x587679[_0x511fde]-=_0x3718a4['count'];if(_0x587679[_0x511fde]<0x0)_0x587679[_0x511fde]=0x0;});_0xf5f521(_0x587679);return;});})[_0x525b('0x2b')](function(_0x4cca71){_0x594e72(_0x4cca71);});});}function checkUserLimits(_0x1cb992){return new BPromise(function(_0x5af6e4,_0x3aba3c){getLimits()['then'](function(_0x41f328){var _0x29260f=_['pick'](_[_0x525b('0x2c')](_0x1cb992,'role'),[_0x525b('0x29'),_0x525b('0x2a'),_0x525b('0x2d')]);var _0xbbdc93=(_0x29260f[_0x525b('0x29')]||0x0)+(_0x29260f[_0x525b('0x2a')]||0x0);var _0x37838b=_0x29260f[_0x525b('0x2d')]||0x0;if(_0xbbdc93>_0x41f328['user'])return _0x3aba3c(_0x525b('0x2e'));if(_0x37838b>_0x41f328[_0x525b('0x2d')])return _0x3aba3c(_0x525b('0x2f'));return _0x5af6e4();})[_0x525b('0x2b')](function(_0x34948b){_0x3aba3c(_0x34948b);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index 543d9cd..61c893a 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 _0xdd4f=['exports','secret'];(function(_0xe0aedf,_0xa0b52d){var _0xde7d59=function(_0x4bc03b){while(--_0x4bc03b){_0xe0aedf['push'](_0xe0aedf['shift']());}};_0xde7d59(++_0xa0b52d);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x1d4356,_0x24c13e){_0x1d4356=_0x1d4356-0x0;var _0x8a8576=_0xdd4f[_0x1d4356];return _0x8a8576;};'use strict';module[_0xfdd4('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':'app-id','GOOGLE_SECRET':_0xfdd4('0x1'),'DEBUG':''}; \ No newline at end of file +var _0xb10b=['app-id','secret','exports','myappanuglar-secret'];(function(_0x2d7b9a,_0x4aef37){var _0x461a27=function(_0x1b243d){while(--_0x1b243d){_0x2d7b9a['push'](_0x2d7b9a['shift']());}};_0x461a27(++_0x4aef37);}(_0xb10b,0x12a));var _0xbb10=function(_0x47a41f,_0x48d92b){_0x47a41f=_0x47a41f-0x0;var _0x2411f5=_0xb10b[_0x47a41f];return _0x2411f5;};'use strict';module[_0xbb10('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0xbb10('0x1'),'GOOGLE_ID':_0xbb10('0x2'),'GOOGLE_SECRET':_0xbb10('0x3'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 7d839eb..0260c1b 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x25cb=['../utils/loggers','fileLogger'];(function(_0xbf09ab,_0x251a19){var _0x2a9aef=function(_0x22d793){while(--_0x22d793){_0xbf09ab['push'](_0xbf09ab['shift']());}};_0x2a9aef(++_0x251a19);}(_0x25cb,0x92));var _0xb25c=function(_0x57eb2d,_0x5e4918){_0x57eb2d=_0x57eb2d-0x0;var _0xd8e18=_0x25cb[_0x57eb2d];return _0xd8e18;};'use strict';var fileLogger=require(_0xb25c('0x0'))[_0xb25c('0x1')];module['exports']=fileLogger; \ No newline at end of file +var _0xeaa1=['exports','fileLogger'];(function(_0x53fd59,_0x18e8a4){var _0x288282=function(_0x524776){while(--_0x524776){_0x53fd59['push'](_0x53fd59['shift']());}};_0x288282(++_0x18e8a4);}(_0xeaa1,0xf9));var _0x1eaa=function(_0x5a9e99,_0x296c39){_0x5a9e99=_0x5a9e99-0x0;var _0x257e1a=_0xeaa1[_0x5a9e99];return _0x257e1a;};'use strict';var fileLogger=require('../utils/loggers')[_0x1eaa('0x0')];module[_0x1eaa('0x1')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index acc8483..7715171 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 _0x6935=['../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','../../config/environment','resolve','join','root','legacy-libs','../../services/express/index.js','ami','agi','../../services/agi/index.js','../../services/email/index.js','routing'];(function(_0x2220b2,_0x3620d5){var _0x3fc8b6=function(_0x20c322){while(--_0x20c322){_0x2220b2['push'](_0x2220b2['shift']());}};_0x3fc8b6(++_0x3620d5);}(_0x6935,0x1f3));var _0x5693=function(_0x5048d5,_0x5641cb){_0x5048d5=_0x5048d5-0x0;var _0x4af3bc=_0x6935[_0x5048d5];return _0x4af3bc;};'use strict';var path=require('path');var cfg=require(_0x5693('0x0'));var env={'NODE_PATH':path[_0x5693('0x1')](path[_0x5693('0x2')](cfg[_0x5693('0x3')],_0x5693('0x4')))};var pm2config={'apps':[{'name':'express','script':path[_0x5693('0x2')](__dirname,_0x5693('0x5')),'env':env},{'name':_0x5693('0x6'),'script':path[_0x5693('0x2')](__dirname,'../../services/ami/index.js'),'env':env},{'name':_0x5693('0x7'),'script':path[_0x5693('0x2')](__dirname,_0x5693('0x8')),'env':env},{'name':'email','script':path[_0x5693('0x2')](__dirname,_0x5693('0x9')),'env':env},{'name':_0x5693('0xa'),'script':path[_0x5693('0x2')](__dirname,_0x5693('0xb')),'env':env},{'name':_0x5693('0xc'),'script':path[_0x5693('0x2')](__dirname,_0x5693('0xd')),'env':env}]};module[_0x5693('0xe')]=pm2config; \ No newline at end of file +var _0x39e8=['legacy-libs','express','../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','../../config/environment','join','root'];(function(_0x413b4d,_0xa3459c){var _0x8b810a=function(_0x22d441){while(--_0x22d441){_0x413b4d['push'](_0x413b4d['shift']());}};_0x8b810a(++_0xa3459c);}(_0x39e8,0x1be));var _0x839e=function(_0x188d3b,_0x423af5){_0x188d3b=_0x188d3b-0x0;var _0xdae5b6=_0x39e8[_0x188d3b];return _0xdae5b6;};'use strict';var path=require(_0x839e('0x0'));var cfg=require(_0x839e('0x1'));var env={'NODE_PATH':path['resolve'](path[_0x839e('0x2')](cfg[_0x839e('0x3')],_0x839e('0x4')))};var pm2config={'apps':[{'name':_0x839e('0x5'),'script':path[_0x839e('0x2')](__dirname,_0x839e('0x6')),'env':env},{'name':_0x839e('0x7'),'script':path[_0x839e('0x2')](__dirname,_0x839e('0x8')),'env':env},{'name':_0x839e('0x9'),'script':path[_0x839e('0x2')](__dirname,_0x839e('0xa')),'env':env},{'name':_0x839e('0xb'),'script':path[_0x839e('0x2')](__dirname,_0x839e('0xc')),'env':env},{'name':_0x839e('0xd'),'script':path[_0x839e('0x2')](__dirname,_0x839e('0xe')),'env':env},{'name':_0x839e('0xf'),'script':path[_0x839e('0x2')](__dirname,_0x839e('0x10')),'env':env}]};module[_0x839e('0x11')]=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index f8440bd..6b1cbad 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 _0xa328=['describe','delete','dump','saved','pm2','bluebird','./config','connected','start','then','disconnect','stop','restart','list'];(function(_0x2f62aa,_0x108e95){var _0x1a341f=function(_0x3aedcf){while(--_0x3aedcf){_0x2f62aa['push'](_0x2f62aa['shift']());}};_0x1a341f(++_0x108e95);}(_0xa328,0x90));var _0x8a32=function(_0x2dbed7,_0x2962d5){_0x2dbed7=_0x2dbed7-0x0;var _0x326efc=_0xa328[_0x2dbed7];return _0x326efc;};'use strict';var pm2=require(_0x8a32('0x0'));var BPromise=require(_0x8a32('0x1'));var config=require(_0x8a32('0x2'));function connect(){return new BPromise(function(_0x3d257f,_0x50a3f5){return pm2['connect'](function(_0x54bd7f){if(_0x54bd7f){return _0x50a3f5(_0x54bd7f);}return _0x3d257f(_0x8a32('0x3'));});});};exports[_0x8a32('0x4')]=function(_0x342f41){return connect()[_0x8a32('0x5')](function(){return new BPromise(function(_0x4a1ade,_0x27c13a){return pm2[_0x8a32('0x4')](_0x342f41,function(_0x20e123,_0x2959c9){if(_0x20e123){return _0x27c13a(_0x20e123);}pm2[_0x8a32('0x6')]();return _0x4a1ade(_0x2959c9);});});});};exports[_0x8a32('0x7')]=function(_0x62382a){return connect()[_0x8a32('0x5')](function(){return new BPromise(function(_0x5f553e,_0x53aa87){return pm2[_0x8a32('0x7')](_0x62382a,function(_0x124502,_0x255844){if(_0x124502){return _0x53aa87(_0x124502);}pm2[_0x8a32('0x6')]();return _0x5f553e(_0x255844);});});});};exports['restart']=function(_0x465940){return connect()[_0x8a32('0x5')](function(){return new BPromise(function(_0x5148bd,_0x1ca145){return pm2[_0x8a32('0x8')](_0x465940,function(_0x2c2e4c,_0x2d1cd2){if(_0x2c2e4c){return _0x1ca145(_0x2c2e4c);}pm2['disconnect']();return _0x5148bd(_0x2d1cd2);});});});};exports[_0x8a32('0x9')]=function(){return connect()['then'](function(){return new BPromise(function(_0xf50849,_0x5c3faf){return pm2[_0x8a32('0x9')](function(_0x2c061a,_0x289c00){if(_0x2c061a){return _0x5c3faf(_0x2c061a);}pm2['disconnect']();return _0xf50849(_0x289c00);});});});};exports[_0x8a32('0xa')]=function(_0x13cc12){return connect()[_0x8a32('0x5')](function(){return new BPromise(function(_0x15b70b,_0x3adc8d){return pm2['describe'](_0x13cc12,function(_0x5d46c6,_0x5b1b9f){if(_0x5d46c6){return _0x3adc8d(_0x5d46c6);}pm2[_0x8a32('0x6')]();return _0x15b70b(_0x5b1b9f);});});});};exports[_0x8a32('0xb')]=function(_0x3b8f20){return connect()['then'](function(){return new BPromise(function(_0x10fb54,_0x3507f6){return pm2[_0x8a32('0xb')](_0x3b8f20,function(_0x44a1df,_0x588e9f){if(_0x44a1df){return _0x3507f6(_0x44a1df);}pm2[_0x8a32('0x6')]();return _0x10fb54(_0x588e9f);});});});};exports[_0x8a32('0xc')]=function(){return connect()[_0x8a32('0x5')](function(){return new BPromise(function(_0x24da39,_0x536933){return pm2[_0x8a32('0xc')](function(_0x4a404e){if(_0x4a404e){return _0x536933(_0x4a404e);}return _0x24da39(_0x8a32('0xd'));});});});}; \ No newline at end of file +var _0x0d10=['connected','start','disconnect','then','stop','restart','list','describe','delete','dump','pm2','bluebird','./config','connect'];(function(_0x46d811,_0x2bde59){var _0x144840=function(_0x14ef02){while(--_0x14ef02){_0x46d811['push'](_0x46d811['shift']());}};_0x144840(++_0x2bde59);}(_0x0d10,0xb2));var _0x00d1=function(_0x2bbc07,_0x1e2168){_0x2bbc07=_0x2bbc07-0x0;var _0x6879e4=_0x0d10[_0x2bbc07];return _0x6879e4;};'use strict';var pm2=require(_0x00d1('0x0'));var BPromise=require(_0x00d1('0x1'));var config=require(_0x00d1('0x2'));function connect(){return new BPromise(function(_0xdefcfe,_0x5a43db){return pm2[_0x00d1('0x3')](function(_0x29e678){if(_0x29e678){return _0x5a43db(_0x29e678);}return _0xdefcfe(_0x00d1('0x4'));});});};exports[_0x00d1('0x5')]=function(_0x3081c4){return connect()['then'](function(){return new BPromise(function(_0x29dcb8,_0x556806){return pm2[_0x00d1('0x5')](_0x3081c4,function(_0x13cc5c,_0x5313e1){if(_0x13cc5c){return _0x556806(_0x13cc5c);}pm2[_0x00d1('0x6')]();return _0x29dcb8(_0x5313e1);});});});};exports['stop']=function(_0x29a9ac){return connect()[_0x00d1('0x7')](function(){return new BPromise(function(_0x2e537c,_0x4c0f7f){return pm2[_0x00d1('0x8')](_0x29a9ac,function(_0x73023f,_0x227426){if(_0x73023f){return _0x4c0f7f(_0x73023f);}pm2[_0x00d1('0x6')]();return _0x2e537c(_0x227426);});});});};exports['restart']=function(_0x398301){return connect()[_0x00d1('0x7')](function(){return new BPromise(function(_0x2634de,_0x85497a){return pm2[_0x00d1('0x9')](_0x398301,function(_0x9fcca9,_0x2eb178){if(_0x9fcca9){return _0x85497a(_0x9fcca9);}pm2['disconnect']();return _0x2634de(_0x2eb178);});});});};exports[_0x00d1('0xa')]=function(){return connect()['then'](function(){return new BPromise(function(_0x524b18,_0x4caa6){return pm2[_0x00d1('0xa')](function(_0x3a7cab,_0x3becbe){if(_0x3a7cab){return _0x4caa6(_0x3a7cab);}pm2[_0x00d1('0x6')]();return _0x524b18(_0x3becbe);});});});};exports[_0x00d1('0xb')]=function(_0x3f75cf){return connect()[_0x00d1('0x7')](function(){return new BPromise(function(_0x387683,_0x5eada3){return pm2[_0x00d1('0xb')](_0x3f75cf,function(_0x263b8e,_0x359779){if(_0x263b8e){return _0x5eada3(_0x263b8e);}pm2['disconnect']();return _0x387683(_0x359779);});});});};exports['delete']=function(_0x218af0){return connect()['then'](function(){return new BPromise(function(_0x57f98d,_0x3a8ea3){return pm2[_0x00d1('0xc')](_0x218af0,function(_0x36640b,_0x477fa9){if(_0x36640b){return _0x3a8ea3(_0x36640b);}pm2[_0x00d1('0x6')]();return _0x57f98d(_0x477fa9);});});});};exports[_0x00d1('0xd')]=function(){return connect()[_0x00d1('0x7')](function(){return new BPromise(function(_0xe1d836,_0x2c9ab2){return pm2['dump'](function(_0x5e63e4){if(_0x5e63e4){return _0x2c9ab2(_0x5e63e4);}return _0xe1d836('saved');});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index c771c93..7385422 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 _0x70a2=['chatTimeout','ChatInteraction','findAll','lastMsgAt','subtract','minutes','length','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','localhost','socket.io-emitter','Setting','find','then'];(function(_0x115460,_0x36ac6e){var _0x28448f=function(_0x1e084b){while(--_0x1e084b){_0x115460['push'](_0x115460['shift']());}};_0x28448f(++_0x36ac6e);}(_0x70a2,0x82));var _0x270a=function(_0x429948,_0x1a6851){_0x429948=_0x429948-0x0;var _0x35d5d1=_0x70a2[_0x429948];return _0x35d5d1;};'use strict';var _=require(_0x270a('0x0'));var moment=require(_0x270a('0x1'));var Redis=require(_0x270a('0x2'));var util=require(_0x270a('0x3'));var config=require(_0x270a('0x4'));var db=require(_0x270a('0x5'))['db'];var logger=require(_0x270a('0x6'))(_0x270a('0x7'));config[_0x270a('0x8')]=_['defaults'](config['redis'],{'host':_0x270a('0x9'),'port':0x18eb});var io=require(_0x270a('0xa'))(new Redis(config[_0x270a('0x8')]));function closeInteractions(){var _0x1d385d=0x0;var _0xc987a5=[];return db[_0x270a('0xb')][_0x270a('0xc')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0x270a('0xd')](function(_0x1c2163){_0x1d385d=_0x1c2163[_0x270a('0xe')];if(_0x1d385d){return db[_0x270a('0xf')][_0x270a('0x10')]({'raw':!![],'attributes':['id',_0x270a('0x11')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x270a('0x12')](_0x1c2163['chatTimeout'],_0x270a('0x13'))}}});}else{return[];}})['then'](function(_0x1f7392){if(_0x1f7392&&_0x1f7392[_0x270a('0x14')]){_0xc987a5=_['map'](_0x1f7392||[],'id');logger[_0x270a('0x15')](_0x270a('0x16'),_0xc987a5[_0x270a('0x17')]());return db['ChatInteraction'][_0x270a('0x18')]({'closeReason':_0x270a('0x19'),'disposition':_0x270a('0x1a'),'closed':!![],'closedAt':moment()[_0x270a('0x1b')](_0x270a('0x1c'))},{'where':{'id':_0xc987a5}});}})['then'](function(){if(_0xc987a5&&_0xc987a5[_0x270a('0x14')]){logger['info'](_0x270a('0x1d'),_0xc987a5[_0x270a('0x17')]());for(var _0x57c0ba=0x0;_0x57c0ba<_0xc987a5['length'];_0x57c0ba++){io[_0x270a('0x1e')](_0x270a('0x1f'),{'id':_0xc987a5[_0x57c0ba],'closed':!![]});}}})[_0x270a('0x20')](function(_0x1abea3){logger['error'](_0x270a('0x21'),_0x1abea3?util[_0x270a('0x22')](_0x1abea3,{'showHidden':![],'depth':null}):'');});}exports[_0x270a('0x23')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x8ff4=['../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','Setting','chatTimeout','then','ChatInteraction','lastMsgAt','subtract','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','format','YYYY-MM-DD\x20HH:mm:ss','chatInteraction:update','error','[CHAT]\x20Error\x20closing\x20interactions','lodash','moment','ioredis','util','../../config/environment'];(function(_0x247cb6,_0x136177){var _0x554363=function(_0x5c981f){while(--_0x5c981f){_0x247cb6['push'](_0x247cb6['shift']());}};_0x554363(++_0x136177);}(_0x8ff4,0xeb));var _0x48ff=function(_0x1d8d9e,_0x20b77b){_0x1d8d9e=_0x1d8d9e-0x0;var _0x151b9d=_0x8ff4[_0x1d8d9e];return _0x151b9d;};'use strict';var _=require(_0x48ff('0x0'));var moment=require(_0x48ff('0x1'));var Redis=require(_0x48ff('0x2'));var util=require(_0x48ff('0x3'));var config=require(_0x48ff('0x4'));var db=require(_0x48ff('0x5'))['db'];var logger=require(_0x48ff('0x6'))(_0x48ff('0x7'));config[_0x48ff('0x8')]=_[_0x48ff('0x9')](config[_0x48ff('0x8')],{'host':_0x48ff('0xa'),'port':0x18eb});var io=require(_0x48ff('0xb'))(new Redis(config[_0x48ff('0x8')]));function closeInteractions(){var _0x5485be=0x0;var _0x2b4828=[];return db[_0x48ff('0xc')]['find']({'raw':!![],'attributes':['id',_0x48ff('0xd')],'where':{'id':0x1}})[_0x48ff('0xe')](function(_0x43a33e){_0x5485be=_0x43a33e[_0x48ff('0xd')];if(_0x5485be){return db[_0x48ff('0xf')]['findAll']({'raw':!![],'attributes':['id',_0x48ff('0x10')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x48ff('0x11')](_0x43a33e[_0x48ff('0xd')],'minutes')}}});}else{return[];}})[_0x48ff('0xe')](function(_0x56fde2){if(_0x56fde2&&_0x56fde2[_0x48ff('0x12')]){_0x2b4828=_[_0x48ff('0x13')](_0x56fde2||[],'id');logger[_0x48ff('0x14')](_0x48ff('0x15'),_0x2b4828[_0x48ff('0x16')]());return db[_0x48ff('0xf')][_0x48ff('0x17')]({'closeReason':_0x48ff('0x18'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x48ff('0x19')](_0x48ff('0x1a'))},{'where':{'id':_0x2b4828}});}})[_0x48ff('0xe')](function(){if(_0x2b4828&&_0x2b4828[_0x48ff('0x12')]){logger['info']('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x2b4828[_0x48ff('0x16')]());for(var _0x449334=0x0;_0x449334<_0x2b4828[_0x48ff('0x12')];_0x449334++){io['emit'](_0x48ff('0x1b'),{'id':_0x2b4828[_0x449334],'closed':!![]});}}})['catch'](function(_0x2e8c28){logger[_0x48ff('0x1c')](_0x48ff('0x1d'),_0x2e8c28?util['inspect'](_0x2e8c28,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/cloud-provider.js b/server/config/schedule/cloud-provider.js index f91f78d..c7bf76b 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 _0xb0d1=['exports','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x4b3fe8,_0x185cf7){var _0x2e053f=function(_0x4e9654){while(--_0x4e9654){_0x4b3fe8['push'](_0x4b3fe8['shift']());}};_0x2e053f(++_0x185cf7);}(_0xb0d1,0x6b));var _0x1b0d=function(_0xaf346e,_0x400dcd){_0xaf346e=_0xaf346e-0x0;var _0xbd4467=_0xb0d1[_0xaf346e];return _0xbd4467;};'use strict';function start(){var _0x478bc2=require(_0x1b0d('0x0'));return _0x478bc2['startAllRefreshIntervals']();}module[_0x1b0d('0x1')]={'intervals':{},'start':start}; \ No newline at end of file +var _0xae4b=['exports'];(function(_0x4fed27,_0x1176c8){var _0xd02ec4=function(_0xd7db1c){while(--_0xd7db1c){_0x4fed27['push'](_0x4fed27['shift']());}};_0xd02ec4(++_0x1176c8);}(_0xae4b,0x113));var _0xbae4=function(_0x214752,_0x584ace){_0x214752=_0x214752-0x0;var _0x37d7b9=_0xae4b[_0x214752];return _0x37d7b9;};'use strict';function start(){var _0x131a2a=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0x131a2a['startAllRefreshIntervals']();}module[_0xbae4('0x0')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 959ae1c..5dd2c96 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 _0x175b=['DefaultReportId','exec\x20defaul\x20report\x20id:%s','exec\x20custom\x20report\x20id:%s','CustomReportId','runReport','no\x20report\x20id','Schedule','MailServerOut','CloudProvider','keys','toString','difference','intersection','exists','deleteJob','delete\x20cron','toRun','length','resolve','cron','startAt','add\x20cron','active','update','update\x20cron','run','start','util','path','lodash','moment','cron-job-manager','../logger','schedule','../../mysqldb','retry','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','number','AnalyticExtractedReport','findOne','error','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','format','\x22%s\x22\x20<%s>','name','Smtp','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractUnit','join','../../files/reports','savename','extname','zip','status','message','attachments','text','stringify','Sent','Empty','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','Loading','Report\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Failed','Report\x20extraction\x20procedure\x20has\x20run\x20into\x20an\x20unexpected\x20error.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','request','SendMail','then','error\x20mail','email\x20sent','catch','case\x20loading','currentAttempt','retryOptions','retries','job','data','operation','still\x20loading','case\x20completed','stop','case\x20empty','Unrecognized\x20status:','entity','dataValues','Job\x20ID\x20','report\x20status:','sendMail','isNil','subtractNumber\x20null\x20or\x20undefined','subtract','subtractNumber','YYYY-MM-DD\x20HH:mm:ss','scheduled'];(function(_0x4394f7,_0x43ee7b){var _0x340a66=function(_0xf8aee8){while(--_0xf8aee8){_0x4394f7['push'](_0x4394f7['shift']());}};_0x340a66(++_0x43ee7b);}(_0x175b,0x81));var _0xb175=function(_0x15c5b8,_0x3b670f){_0x15c5b8=_0x15c5b8-0x0;var _0xd45fe6=_0x175b[_0x15c5b8];return _0xd45fe6;};'use strict';var fs=require('fs');var util=require(_0xb175('0x0'));var path=require(_0xb175('0x1'));var _=require(_0xb175('0x2'));var moment=require(_0xb175('0x3'));var CronJobManager=require(_0xb175('0x4'));var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0xb175('0x5'))(_0xb175('0x6'));var db=require(_0xb175('0x7'))['db'];const retry=require(_0xb175('0x8'));var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0xb175('0x9'));var client=jayson[_0xb175('0xa')][_0xb175('0xb')]({'port':0x232b});var manager=new CronJobManager();function getReportData(_0x1aa5d6){const _0x845f45={};if(typeof _0x1aa5d6===_0xb175('0xc')){_0x845f45['id']=_0x1aa5d6;}return db[_0xb175('0xd')][_0xb175('0xe')]({'where':_0x845f45})['then'](function(_0x15fb84){return _0x15fb84;})['catch'](function(_0x343087){logger[_0xb175('0xf')](_0x343087);});}function handleSendEmail(_0x4129d6,_0x173f11){logger[_0xb175('0x10')](_0xb175('0x11'),_0x4129d6[_0xb175('0x12')]);var _0xb8e60c=!![];var _0x1eefec=_0x4129d6[_0xb175('0x13')][_0xb175('0x14')]();var _0x17e86c={'account':_0x1eefec,'message':{'from':util[_0xb175('0x15')](_0xb175('0x16'),_0x4129d6[_0xb175('0x13')][_0xb175('0x17')],_0x4129d6[_0xb175('0x13')][_0xb175('0x12')]||_0x4129d6[_0xb175('0x13')][_0xb175('0x18')]['user']),'to':_0x4129d6[_0xb175('0x12')],'cc':_0x4129d6['cc'],'bcc':_0x4129d6[_0xb175('0x19')],'subject':util[_0xb175('0x15')](_0xb175('0x1a'),_0x173f11[_0xb175('0x17')],_0x4129d6['subtractNumber'],_0x4129d6[_0xb175('0x1b')])}};var _0x518c6e=path[_0xb175('0x1c')](__dirname,_0xb175('0x1d'));var _0x47d67a=_0x173f11['savename'];var _0x509ecb=util[_0xb175('0x15')]('%s.%s',path['basename'](_0x173f11[_0xb175('0x1e')],path[_0xb175('0x1f')](_0x173f11[_0xb175('0x1e')])),_0xb175('0x20'));var _0xeac425=path[_0xb175('0x1c')](_0x518c6e,_0x47d67a);var _0x413518=path[_0xb175('0x1c')](_0x518c6e,_0x509ecb);if(fs['existsSync'](_0xeac425)){_0x173f11[_0xb175('0x21')]='Sent';_0x17e86c[_0xb175('0x22')][_0xb175('0x23')]=[{'filename':_0x47d67a,'path':_0xeac425}];_0x17e86c['message'][_0xb175('0x24')]=util[_0xb175('0x15')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0xb175('0x25')](_0x173f11,null,0x2));}else if(fs['existsSync'](_0x413518)){_0x173f11['status']=_0xb175('0x26');_0x17e86c['message']['attachments']=[{'filename':_0x509ecb,'path':_0x413518}];}else{if(_0x173f11[_0xb175('0x21')]===_0xb175('0x27')){_0x17e86c[_0xb175('0x22')]['text']=_0xb175('0x28');if(!_0x4129d6[_0xb175('0x29')]){_0xb8e60c=![];logger[_0xb175('0x10')]('empty\x20file,\x20email\x20not\x20sent');}}else if(_0x173f11[_0xb175('0x21')]===_0xb175('0x2a')){_0x17e86c['message']['text']=_0xb175('0x2b');}else if(_0x173f11[_0xb175('0x21')]==='Completed'){_0x17e86c[_0xb175('0x22')][_0xb175('0x24')]='Report\x20file\x20creation\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';}else if(_0x173f11[_0xb175('0x21')]===_0xb175('0x2c')){_0x17e86c['message'][_0xb175('0x24')]=_0xb175('0x2d');}else{logger[_0xb175('0xf')]('[handleSendEmail]\x20Unrecognized\x20status:',_0x173f11[_0xb175('0x21')]);}}if(_0xb8e60c){return client[_0xb175('0x2e')](_0xb175('0x2f'),_0x17e86c)[_0xb175('0x30')](function(_0x5d9d41){if(_0x5d9d41[_0xb175('0xf')]){return logger[_0xb175('0xf')](_0xb175('0x31'),JSON['stringify'](_0x5d9d41));}return logger[_0xb175('0x10')](_0xb175('0x32'));})[_0xb175('0x33')](function(_0x4f73d3){return logger[_0xb175('0xf')](_0xb175('0x31'),JSON['stringify'](_0x4f73d3));});}}function handleError(){return function(_0x565998){return logger[_0xb175('0xf')](JSON[_0xb175('0x25')](_0x565998));};}function loading(_0x4e2bde){logger[_0xb175('0x10')](_0xb175('0x34'));if(_0x4e2bde[_0xb175('0x35')]===_0x4e2bde[_0xb175('0x36')][_0xb175('0x37')]){handleSendEmail(_0x4e2bde[_0xb175('0x38')],_0x4e2bde[_0xb175('0x39')]);_0x4e2bde[_0xb175('0x3a')]['stop']();}else{_0x4e2bde[_0xb175('0x3a')][_0xb175('0x8')](_0xb175('0x3b'));}}function completed(_0x50dbb3){logger[_0xb175('0x10')](_0xb175('0x3c'));handleSendEmail(_0x50dbb3['job'],_0x50dbb3[_0xb175('0x39')]);_0x50dbb3[_0xb175('0x3a')][_0xb175('0x3d')]();}function empty(_0x581ac8){logger[_0xb175('0x10')](_0xb175('0x3e'));handleSendEmail(_0x581ac8['job'],_0x581ac8['data']);_0x581ac8[_0xb175('0x3a')][_0xb175('0x3d')]();}function failed(_0x6e9c64){logger[_0xb175('0x10')]('case\x20failed');handleSendEmail(_0x6e9c64[_0xb175('0x38')],_0x6e9c64[_0xb175('0x39')]);_0x6e9c64[_0xb175('0x3a')][_0xb175('0x3d')]();}function urecognized(_0x2678cf){logger[_0xb175('0xf')](_0xb175('0x3f'),_0x2678cf[_0xb175('0x40')][_0xb175('0x41')][_0xb175('0x21')]);_0x2678cf[_0xb175('0x3a')][_0xb175('0x3d')]();}const reportStatusStrategies={'Loading':loading,'Completed':completed,'Empty':empty,'Failed':failed,'Unrecognized':urecognized};function retryer(_0x546076,_0x29a82){const _0x5dd4bd={'retries':0x3,'factor':0x2,'minTimeout':0x5b*0x3e8,'maxTimeout':0xa*0x3c*0x3e8};const _0x3df79f=retry['operation'](_0x5dd4bd);_0x3df79f['attempt'](_0x295858=>{logger[_0xb175('0x10')](_0xb175('0x42')+_0x546076['id']+'\x20Attempt\x20#:'+_0x295858);try{getReportData(_0x29a82['id'])[_0xb175('0x30')](function(_0x58ab21){_0x29a82=_0x58ab21;logger['info'](_0xb175('0x43'),_0x58ab21[_0xb175('0x41')][_0xb175('0x21')]);if(!reportStatusStrategies[_0x58ab21[_0xb175('0x41')][_0xb175('0x21')]]){logger[_0xb175('0xf')]('report\x20status:',_0x58ab21[_0xb175('0x41')][_0xb175('0x21')]);_0x3df79f[_0xb175('0x8')]();}reportStatusStrategies[_0x58ab21[_0xb175('0x41')][_0xb175('0x21')]]({'operation':_0x3df79f,'currentAttempt':_0x295858,'retryOptions':_0x5dd4bd,'job':_0x546076,'data':_0x29a82,'entity':_0x58ab21});});}catch(_0x3da4c1){_0x3df79f[_0xb175('0x8')](_0x3da4c1);}});}function handleResult(_0x3156c8){return function(_0x3caa65){if(_0x3156c8[_0xb175('0x44')]&&_0x3156c8['MailAccount']&&_0x3156c8[_0xb175('0x13')][_0xb175('0x18')]&&!_[_0xb175('0x45')](_0x3156c8[_0xb175('0x12')])){retryer(_0x3156c8,_0x3caa65);}};}function handleJob(_0xf6f01){return function(){try{if(_[_0xb175('0x45')](_0xf6f01['subtractNumber'])){return logger[_0xb175('0x10')](_0xb175('0x46'));}if(_[_0xb175('0x45')](_0xf6f01['subtractUnit'])){return logger[_0xb175('0x10')]('subtractUnit\x20null\x20or\x20undefined');}var _0x3636c1={'startDate':moment()[_0xb175('0x47')](_0xf6f01[_0xb175('0x48')],_0xf6f01[_0xb175('0x1b')])[_0xb175('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0xb175('0x15')](_0xb175('0x49')),'type':_0xb175('0x4a'),'output':_0xf6f01['output'],'name':_0xf6f01[_0xb175('0x17')]};if(!_[_0xb175('0x45')](_0xf6f01[_0xb175('0x4b')])){logger[_0xb175('0x10')](_0xb175('0x4c'),_0xf6f01['DefaultReportId']);return analyticDefaultReportController['runReport']({'id':_0xf6f01[_0xb175('0x4b')]},_0x3636c1)[_0xb175('0x30')](handleResult(_0xf6f01))[_0xb175('0x33')](handleError());}if(!_[_0xb175('0x45')](_0xf6f01['CustomReportId'])){logger[_0xb175('0x10')](_0xb175('0x4d'),_0xf6f01[_0xb175('0x4e')]);return analyticCustomReportController[_0xb175('0x4f')]({'id':_0xf6f01['CustomReportId']},_0x3636c1)[_0xb175('0x30')](handleResult(_0xf6f01))[_0xb175('0x33')](handleError());}}catch(_0xbfb668){logger['error'](JSON[_0xb175('0x25')](_0xbfb668));}return logger['info'](_0xb175('0x50'));};}function getJobs(_0x530680){var _0x95d2b9={};if(_0x530680){_0x95d2b9['id']=_0x530680;}return db[_0xb175('0x51')]['findAll']({'where':_0x95d2b9,'include':[{'model':db[_0xb175('0x13')],'attributes':['id',_0xb175('0x17'),'email'],'include':[{'model':db[_0xb175('0x52')],'as':_0xb175('0x18'),'include':[{'model':db[_0xb175('0x53')],'as':_0xb175('0x53')}]}]}]})['then'](function(_0xa04c8f){var _0x10982c=_[_0xb175('0x54')](manager['jobs']);var _0x433c44=_['map'](_0xa04c8f,function(_0x441a3c){return _0x441a3c['id'][_0xb175('0x55')]();});var _0x6424e5=_['keyBy'](_0xa04c8f,function(_0x472e5b){return _0x472e5b['id'][_0xb175('0x55')]();});var _0x58f98c=_0x530680?_0x433c44:_[_0xb175('0x56')](_0x433c44,_0x10982c);var _0x1ac547=_[_0xb175('0x57')](_0x433c44,_0x10982c);var _0x537930=_[_0xb175('0x56')](_0x10982c,_0x433c44);var _0x59704f;var _0xbaf20b;for(_0x59704f=0x0;_0x59704f<_0x537930['length']&&!_0x530680;_0x59704f+=0x1){_0xbaf20b=_0x537930[_0x59704f][_0xb175('0x55')]();if(manager[_0xb175('0x58')](_0xbaf20b)){manager[_0xb175('0x3d')](_0xbaf20b);manager[_0xb175('0x59')](_0xbaf20b);logger[_0xb175('0x10')](_0xb175('0x5a'),_0xbaf20b);}}logger[_0xb175('0x10')](_0xb175('0x5b'),JSON['stringify'](_0x58f98c));for(_0x59704f=0x0;_0x59704f<_0x58f98c[_0xb175('0x5c')];_0x59704f+=0x1){_0xbaf20b=_0x58f98c[_0x59704f][_0xb175('0x55')]();if(_0x530680){logger[_0xb175('0x10')](JSON[_0xb175('0x25')](_0x6424e5[_0xbaf20b]));BPromise[_0xb175('0x5d')]()[_0xb175('0x30')](handleJob(_0x6424e5[_0xbaf20b]));logger['info']('run\x20job',_0x6424e5[_0xbaf20b]['name'],_0x6424e5[_0xbaf20b][_0xb175('0x5e')]);}else if(_0x6424e5[_0xbaf20b]['cron']&&_0x6424e5[_0xbaf20b]['active']&&moment()['isBetween'](_0x6424e5[_0xbaf20b][_0xb175('0x5f')],_0x6424e5[_0xbaf20b]['endAt'])){manager['add'](_0xbaf20b,_0x6424e5[_0xbaf20b][_0xb175('0x5e')],handleJob(_0x6424e5[_0xbaf20b]));manager['start'](_0xbaf20b);logger[_0xb175('0x10')](_0xb175('0x60'),_0x6424e5[_0xbaf20b]['name'],_0x6424e5[_0xbaf20b]['cron']);}else if(manager[_0xb175('0x58')](_0xbaf20b)){manager['stop'](_0xbaf20b);manager[_0xb175('0x59')](_0xbaf20b);logger['info']('stop\x20cron',_0x6424e5[_0xbaf20b]['name'],_0x6424e5[_0xbaf20b][_0xb175('0x5e')]);}}for(_0x59704f=0x0,_0xbaf20b;_0x59704f<_0x1ac547['length']&&!_0x530680;_0x59704f+=0x1){_0xbaf20b=_0x1ac547[_0x59704f][_0xb175('0x55')]();if(manager['exists'](_0xbaf20b)){if(_0x6424e5[_0xbaf20b][_0xb175('0x5e')]&&_0x6424e5[_0xbaf20b][_0xb175('0x61')]&&moment()['isBetween'](_0x6424e5[_0xbaf20b][_0xb175('0x5f')],_0x6424e5[_0xbaf20b]['endAt'])){manager[_0xb175('0x62')](_0xbaf20b,_0x6424e5[_0xbaf20b][_0xb175('0x5e')],handleJob(_0x6424e5[_0xbaf20b]));logger[_0xb175('0x10')](_0xb175('0x63'),_0x6424e5[_0xbaf20b][_0xb175('0x17')],_0x6424e5[_0xbaf20b][_0xb175('0x5e')]);}else{manager[_0xb175('0x3d')](_0xbaf20b);manager[_0xb175('0x59')](_0xbaf20b);logger['info']('stop\x20cron',_0x6424e5[_0xbaf20b][_0xb175('0x17')],_0x6424e5[_0xbaf20b][_0xb175('0x5e')]);}}}})[_0xb175('0x33')](function(_0x1e8ced){logger[_0xb175('0xf')](JSON[_0xb175('0x25')](_0x1e8ced));});}exports[_0xb175('0x64')]=function(_0x7c1731){return getJobs(_0x7c1731);};exports[_0xb175('0x65')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x74e3=['extname','zip','status','message','attachments','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','existsSync','Sent','text','empty\x20file,\x20email\x20not\x20sent','Report\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Completed','Report\x20file\x20creation\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Failed','Report\x20extraction\x20procedure\x20has\x20run\x20into\x20an\x20unexpected\x20error.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','[handleSendEmail]\x20Unrecognized\x20status:','request','SendMail','email\x20sent','catch','error\x20mail','case\x20loading','currentAttempt','retryOptions','job','data','stop','operation','still\x20loading','case\x20completed','case\x20empty','case\x20failed','dataValues','attempt','Job\x20ID\x20','sendMail','email','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','exec\x20defaul\x20report\x20id:%s','DefaultReportId','runReport','CustomReportId','Schedule','findAll','CloudProvider','keys','jobs','map','toString','keyBy','difference','intersection','length','exists','deleteJob','delete\x20cron','toRun','cron','active','isBetween','startAt','endAt','add','start','add\x20cron','stop\x20cron','run','path','lodash','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','retry','../../api/analyticDefaultReport/analyticDefaultReport.controller','http','number','AnalyticExtractedReport','findOne','then','error','info','Try\x20to\x20send\x20a\x20mail\x20to','MailAccount','getSmtpOptions','format','\x22%s\x22\x20<%s>','name','Smtp','bcc','subtractNumber','subtractUnit','join','../../files/reports','savename','%s.%s','basename'];(function(_0x4dc7b9,_0x319d5a){var _0x3ab114=function(_0x51a9df){while(--_0x51a9df){_0x4dc7b9['push'](_0x4dc7b9['shift']());}};_0x3ab114(++_0x319d5a);}(_0x74e3,0xb4));var _0x374e=function(_0x1f5bdf,_0x3a25ea){_0x1f5bdf=_0x1f5bdf-0x0;var _0x4ca8f1=_0x74e3[_0x1f5bdf];return _0x4ca8f1;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0x374e('0x0'));var _=require(_0x374e('0x1'));var moment=require('moment');var CronJobManager=require(_0x374e('0x2'));var jayson=require(_0x374e('0x3'));var BPromise=require(_0x374e('0x4'));var logger=require(_0x374e('0x5'))(_0x374e('0x6'));var db=require(_0x374e('0x7'))['db'];const retry=require(_0x374e('0x8'));var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0x374e('0x9'));var client=jayson['client'][_0x374e('0xa')]({'port':0x232b});var manager=new CronJobManager();function getReportData(_0x182a67){const _0x2342be={};if(typeof _0x182a67===_0x374e('0xb')){_0x2342be['id']=_0x182a67;}return db[_0x374e('0xc')][_0x374e('0xd')]({'where':_0x2342be})[_0x374e('0xe')](function(_0x465e7e){return _0x465e7e;})['catch'](function(_0x2930b9){logger[_0x374e('0xf')](_0x2930b9);});}function handleSendEmail(_0x28d97e,_0x5f155a){logger[_0x374e('0x10')](_0x374e('0x11'),_0x28d97e['email']);var _0x4d39dd=!![];var _0x3548f6=_0x28d97e[_0x374e('0x12')][_0x374e('0x13')]();var _0x1104cf={'account':_0x3548f6,'message':{'from':util[_0x374e('0x14')](_0x374e('0x15'),_0x28d97e[_0x374e('0x12')][_0x374e('0x16')],_0x28d97e[_0x374e('0x12')]['email']||_0x28d97e[_0x374e('0x12')][_0x374e('0x17')]['user']),'to':_0x28d97e['email'],'cc':_0x28d97e['cc'],'bcc':_0x28d97e[_0x374e('0x18')],'subject':util[_0x374e('0x14')]('Report\x20%s\x20last\x20%s\x20%s',_0x5f155a['name'],_0x28d97e[_0x374e('0x19')],_0x28d97e[_0x374e('0x1a')])}};var _0x521c03=path[_0x374e('0x1b')](__dirname,_0x374e('0x1c'));var _0x5070da=_0x5f155a[_0x374e('0x1d')];var _0x46b920=util[_0x374e('0x14')](_0x374e('0x1e'),path[_0x374e('0x1f')](_0x5f155a[_0x374e('0x1d')],path[_0x374e('0x20')](_0x5f155a[_0x374e('0x1d')])),_0x374e('0x21'));var _0x28e339=path[_0x374e('0x1b')](_0x521c03,_0x5070da);var _0xc469d=path['join'](_0x521c03,_0x46b920);if(fs['existsSync'](_0x28e339)){_0x5f155a[_0x374e('0x22')]='Sent';_0x1104cf[_0x374e('0x23')][_0x374e('0x24')]=[{'filename':_0x5070da,'path':_0x28e339}];_0x1104cf[_0x374e('0x23')]['text']=util['format'](_0x374e('0x25'),JSON[_0x374e('0x26')](_0x5f155a,null,0x2));}else if(fs[_0x374e('0x27')](_0xc469d)){_0x5f155a['status']=_0x374e('0x28');_0x1104cf['message'][_0x374e('0x24')]=[{'filename':_0x46b920,'path':_0xc469d}];}else{if(_0x5f155a[_0x374e('0x22')]==='Empty'){_0x1104cf[_0x374e('0x23')][_0x374e('0x29')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x28d97e['sendIfEmpty']){_0x4d39dd=![];logger[_0x374e('0x10')](_0x374e('0x2a'));}}else if(_0x5f155a[_0x374e('0x22')]==='Loading'){_0x1104cf['message'][_0x374e('0x29')]=_0x374e('0x2b');}else if(_0x5f155a[_0x374e('0x22')]===_0x374e('0x2c')){_0x1104cf[_0x374e('0x23')][_0x374e('0x29')]=_0x374e('0x2d');}else if(_0x5f155a['status']===_0x374e('0x2e')){_0x1104cf[_0x374e('0x23')][_0x374e('0x29')]=_0x374e('0x2f');}else{logger[_0x374e('0xf')](_0x374e('0x30'),_0x5f155a[_0x374e('0x22')]);}}if(_0x4d39dd){return client[_0x374e('0x31')](_0x374e('0x32'),_0x1104cf)['then'](function(_0x2ab176){if(_0x2ab176[_0x374e('0xf')]){return logger['error']('error\x20mail',JSON[_0x374e('0x26')](_0x2ab176));}return logger[_0x374e('0x10')](_0x374e('0x33'));})[_0x374e('0x34')](function(_0x4a0cb2){return logger[_0x374e('0xf')](_0x374e('0x35'),JSON['stringify'](_0x4a0cb2));});}}function handleError(){return function(_0x5052f1){return logger[_0x374e('0xf')](JSON[_0x374e('0x26')](_0x5052f1));};}function loading(_0x479c99){logger[_0x374e('0x10')](_0x374e('0x36'));if(_0x479c99[_0x374e('0x37')]===_0x479c99[_0x374e('0x38')]['retries']){handleSendEmail(_0x479c99[_0x374e('0x39')],_0x479c99[_0x374e('0x3a')]);_0x479c99['operation'][_0x374e('0x3b')]();}else{_0x479c99[_0x374e('0x3c')][_0x374e('0x8')](_0x374e('0x3d'));}}function completed(_0x2f53d2){logger[_0x374e('0x10')](_0x374e('0x3e'));handleSendEmail(_0x2f53d2[_0x374e('0x39')],_0x2f53d2['data']);_0x2f53d2[_0x374e('0x3c')][_0x374e('0x3b')]();}function empty(_0x4348e7){logger[_0x374e('0x10')](_0x374e('0x3f'));handleSendEmail(_0x4348e7[_0x374e('0x39')],_0x4348e7[_0x374e('0x3a')]);_0x4348e7[_0x374e('0x3c')][_0x374e('0x3b')]();}function failed(_0x2e3690){logger['info'](_0x374e('0x40'));handleSendEmail(_0x2e3690[_0x374e('0x39')],_0x2e3690[_0x374e('0x3a')]);_0x2e3690['operation'][_0x374e('0x3b')]();}function urecognized(_0x226fce){logger[_0x374e('0xf')]('Unrecognized\x20status:',_0x226fce['entity'][_0x374e('0x41')][_0x374e('0x22')]);_0x226fce[_0x374e('0x3c')][_0x374e('0x3b')]();}const reportStatusStrategies={'Loading':loading,'Completed':completed,'Empty':empty,'Failed':failed,'Unrecognized':urecognized};function retryer(_0x1f66a1,_0x1da698){const _0x200046={'retries':0x3,'factor':0x2,'minTimeout':0x5b*0x3e8,'maxTimeout':0xa*0x3c*0x3e8};const _0x376de2=retry[_0x374e('0x3c')](_0x200046);_0x376de2[_0x374e('0x42')](_0x442161=>{logger[_0x374e('0x10')](_0x374e('0x43')+_0x1f66a1['id']+'\x20Attempt\x20#:'+_0x442161);try{getReportData(_0x1da698['id'])[_0x374e('0xe')](function(_0x567bef){_0x1da698=_0x567bef;logger[_0x374e('0x10')]('report\x20status:',_0x567bef[_0x374e('0x41')][_0x374e('0x22')]);if(!reportStatusStrategies[_0x567bef[_0x374e('0x41')][_0x374e('0x22')]]){logger['error']('report\x20status:',_0x567bef[_0x374e('0x41')][_0x374e('0x22')]);_0x376de2[_0x374e('0x8')]();}reportStatusStrategies[_0x567bef[_0x374e('0x41')]['status']]({'operation':_0x376de2,'currentAttempt':_0x442161,'retryOptions':_0x200046,'job':_0x1f66a1,'data':_0x1da698,'entity':_0x567bef});});}catch(_0x50a29e){_0x376de2[_0x374e('0x8')](_0x50a29e);}});}function handleResult(_0x3d6fbe){return function(_0x3711c4){if(_0x3d6fbe[_0x374e('0x44')]&&_0x3d6fbe[_0x374e('0x12')]&&_0x3d6fbe[_0x374e('0x12')][_0x374e('0x17')]&&!_['isNil'](_0x3d6fbe[_0x374e('0x45')])){retryer(_0x3d6fbe,_0x3711c4);}};}function handleJob(_0x369c00){return function(){try{if(_[_0x374e('0x46')](_0x369c00['subtractNumber'])){return logger['info'](_0x374e('0x47'));}if(_[_0x374e('0x46')](_0x369c00['subtractUnit'])){return logger[_0x374e('0x10')](_0x374e('0x48'));}var _0x3ce58f={'startDate':moment()[_0x374e('0x49')](_0x369c00[_0x374e('0x19')],_0x369c00['subtractUnit'])[_0x374e('0x14')](_0x374e('0x4a')),'endDate':moment()[_0x374e('0x14')](_0x374e('0x4a')),'type':_0x374e('0x4b'),'output':_0x369c00[_0x374e('0x4c')],'name':_0x369c00[_0x374e('0x16')]};if(!_[_0x374e('0x46')](_0x369c00['DefaultReportId'])){logger[_0x374e('0x10')](_0x374e('0x4d'),_0x369c00[_0x374e('0x4e')]);return analyticDefaultReportController[_0x374e('0x4f')]({'id':_0x369c00['DefaultReportId']},_0x3ce58f)[_0x374e('0xe')](handleResult(_0x369c00))['catch'](handleError());}if(!_[_0x374e('0x46')](_0x369c00[_0x374e('0x50')])){logger[_0x374e('0x10')]('exec\x20custom\x20report\x20id:%s',_0x369c00[_0x374e('0x50')]);return analyticCustomReportController[_0x374e('0x4f')]({'id':_0x369c00[_0x374e('0x50')]},_0x3ce58f)[_0x374e('0xe')](handleResult(_0x369c00))[_0x374e('0x34')](handleError());}}catch(_0x4e541d){logger[_0x374e('0xf')](JSON['stringify'](_0x4e541d));}return logger[_0x374e('0x10')]('no\x20report\x20id');};}function getJobs(_0x4ac67f){var _0x55632e={};if(_0x4ac67f){_0x55632e['id']=_0x4ac67f;}return db[_0x374e('0x51')][_0x374e('0x52')]({'where':_0x55632e,'include':[{'model':db['MailAccount'],'attributes':['id',_0x374e('0x16'),_0x374e('0x45')],'include':[{'model':db['MailServerOut'],'as':_0x374e('0x17'),'include':[{'model':db[_0x374e('0x53')],'as':_0x374e('0x53')}]}]}]})[_0x374e('0xe')](function(_0x22a1b5){var _0xaf466b=_[_0x374e('0x54')](manager[_0x374e('0x55')]);var _0x4fa058=_[_0x374e('0x56')](_0x22a1b5,function(_0x13b67c){return _0x13b67c['id'][_0x374e('0x57')]();});var _0xa72db6=_[_0x374e('0x58')](_0x22a1b5,function(_0x4d7e3d){return _0x4d7e3d['id']['toString']();});var _0x238649=_0x4ac67f?_0x4fa058:_[_0x374e('0x59')](_0x4fa058,_0xaf466b);var _0x2f61f4=_[_0x374e('0x5a')](_0x4fa058,_0xaf466b);var _0x55a265=_[_0x374e('0x59')](_0xaf466b,_0x4fa058);var _0x15c9c4;var _0x45a644;for(_0x15c9c4=0x0;_0x15c9c4<_0x55a265[_0x374e('0x5b')]&&!_0x4ac67f;_0x15c9c4+=0x1){_0x45a644=_0x55a265[_0x15c9c4][_0x374e('0x57')]();if(manager[_0x374e('0x5c')](_0x45a644)){manager['stop'](_0x45a644);manager[_0x374e('0x5d')](_0x45a644);logger[_0x374e('0x10')](_0x374e('0x5e'),_0x45a644);}}logger[_0x374e('0x10')](_0x374e('0x5f'),JSON['stringify'](_0x238649));for(_0x15c9c4=0x0;_0x15c9c4<_0x238649[_0x374e('0x5b')];_0x15c9c4+=0x1){_0x45a644=_0x238649[_0x15c9c4][_0x374e('0x57')]();if(_0x4ac67f){logger[_0x374e('0x10')](JSON[_0x374e('0x26')](_0xa72db6[_0x45a644]));BPromise['resolve']()[_0x374e('0xe')](handleJob(_0xa72db6[_0x45a644]));logger[_0x374e('0x10')]('run\x20job',_0xa72db6[_0x45a644]['name'],_0xa72db6[_0x45a644][_0x374e('0x60')]);}else if(_0xa72db6[_0x45a644]['cron']&&_0xa72db6[_0x45a644][_0x374e('0x61')]&&moment()[_0x374e('0x62')](_0xa72db6[_0x45a644][_0x374e('0x63')],_0xa72db6[_0x45a644][_0x374e('0x64')])){manager[_0x374e('0x65')](_0x45a644,_0xa72db6[_0x45a644][_0x374e('0x60')],handleJob(_0xa72db6[_0x45a644]));manager[_0x374e('0x66')](_0x45a644);logger['info'](_0x374e('0x67'),_0xa72db6[_0x45a644][_0x374e('0x16')],_0xa72db6[_0x45a644][_0x374e('0x60')]);}else if(manager[_0x374e('0x5c')](_0x45a644)){manager['stop'](_0x45a644);manager[_0x374e('0x5d')](_0x45a644);logger[_0x374e('0x10')](_0x374e('0x68'),_0xa72db6[_0x45a644][_0x374e('0x16')],_0xa72db6[_0x45a644][_0x374e('0x60')]);}}for(_0x15c9c4=0x0,_0x45a644;_0x15c9c4<_0x2f61f4['length']&&!_0x4ac67f;_0x15c9c4+=0x1){_0x45a644=_0x2f61f4[_0x15c9c4][_0x374e('0x57')]();if(manager[_0x374e('0x5c')](_0x45a644)){if(_0xa72db6[_0x45a644]['cron']&&_0xa72db6[_0x45a644][_0x374e('0x61')]&&moment()[_0x374e('0x62')](_0xa72db6[_0x45a644][_0x374e('0x63')],_0xa72db6[_0x45a644][_0x374e('0x64')])){manager['update'](_0x45a644,_0xa72db6[_0x45a644][_0x374e('0x60')],handleJob(_0xa72db6[_0x45a644]));logger[_0x374e('0x10')]('update\x20cron',_0xa72db6[_0x45a644]['name'],_0xa72db6[_0x45a644]['cron']);}else{manager[_0x374e('0x3b')](_0x45a644);manager['deleteJob'](_0x45a644);logger[_0x374e('0x10')](_0x374e('0x68'),_0xa72db6[_0x45a644][_0x374e('0x16')],_0xa72db6[_0x45a644]['cron']);}}}})[_0x374e('0x34')](function(_0x5d8af2){logger[_0x374e('0xf')](JSON[_0x374e('0x26')](_0x5d8af2));});}exports[_0x374e('0x69')]=function(_0x2cb072){return getJobs(_0x2cb072);};exports[_0x374e('0x66')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file diff --git a/server/config/schedule/transcribe.js b/server/config/schedule/transcribe.js index 3fb1317..8e5d24e 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 _0x1131=['Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentRegion','language','bucket','Sequelize','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','sentimentAccountId','CloudProvider','findOne','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Negative','Mixed','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','Cloud\x20Provider\x20not\x20available','forEach','push','all','aws-sdk','../../mysqldb','../../config/logger','transcribe','Comprehend','detectSentiment','transcribeName','data1','data2','transcribeRegion','then','info','format','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','ValidationError'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0x1131,0x71));var _0x1113=function(_0x20b1ff,_0x4c9c5b){_0x20b1ff=_0x20b1ff-0x0;var _0x1a09c7=_0x1131[_0x20b1ff];return _0x1a09c7;};var _=require('lodash');var AWS=require(_0x1113('0x0'));var rp=require('request-promise');var util=require('util');var BPromise=require('bluebird');var db=require(_0x1113('0x1'))['db'];var logger=require(_0x1113('0x2'))(_0x1113('0x3'));function getTranscriptionJob(_0x3d255e,_0x2f8f72,_0xb514f9,_0x57dd30){return new Promise(function(_0x3880aa,_0x4e6389){var _0x1f76a7=new AWS['TranscribeService']({'accessKeyId':_0x2f8f72,'secretAccessKey':_0x3d255e,'region':_0xb514f9});_0x1f76a7['getTranscriptionJob']({'TranscriptionJobName':_0x57dd30},function(_0x458f86,_0x53a218){if(_0x458f86){return _0x4e6389(_0x458f86);}else{return _0x3880aa(_0x53a218);}});});}function sentiment(_0x44e3b5,_0x16ddba,_0x3e20dd,_0x36df92,_0x399e4c){return new Promise(function(_0x4deffb,_0x4da83a){var _0x37405f=new AWS[(_0x1113('0x4'))]({'accessKeyId':_0x16ddba,'secretAccessKey':_0x44e3b5,'region':_0x3e20dd});_0x37405f[_0x1113('0x5')]({'Text':_0x36df92,'LanguageCode':_0x399e4c['substring'](0x0,0x2)},function(_0x3658ec,_0xc0b564){if(_0x3658ec){return _0x4da83a(_0x3658ec);}else{return _0x4deffb(_0xc0b564);}});});}function checkTranscribeJob(_0x4e4387,_0x31a919,_0x31b550){var _0x26bf52;return new BPromise(function(_0x3b929e,_0x517a7e){logger['info'](util['format']('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x4e4387['id'],_0x4e4387[_0x1113('0x6')]));return getTranscriptionJob(_0x31b550[_0x1113('0x7')],_0x31b550[_0x1113('0x8')],_0x31a919[_0x1113('0x9')],_0x4e4387['transcribeName'])[_0x1113('0xa')](function(_0x1f7537){logger[_0x1113('0xb')](util[_0x1113('0xc')](_0x1113('0xd'),_0x4e4387['id'],_0x4e4387[_0x1113('0x6')],_0x1f7537[_0x1113('0xe')][_0x1113('0xf')]));if(!_0x4e4387[_0x1113('0x10')]){switch(_0x1f7537[_0x1113('0xe')]['TranscriptionJobStatus']){case _0x1113('0x11'):var _0x4d3cbe={'transcribeStatus':_0x1f7537[_0x1113('0xe')]['TranscriptionJobStatus'],'fileUri':_0x1f7537[_0x1113('0xe')][_0x1113('0x12')]['TranscriptFileUri']};logger['info'](util['format']('[RECORDING:%d]\x20Get\x20transcript',_0x4e4387['id']));return rp({'uri':_0x1f7537[_0x1113('0xe')][_0x1113('0x12')][_0x1113('0x13')],'json':!![]})[_0x1113('0xa')](function(_0x1ab3ef){logger[_0x1113('0xb')](util[_0x1113('0xc')](_0x1113('0x14'),_0x4e4387['id']));if(_0x1ab3ef&&_0x1ab3ef[_0x1113('0x15')]&&_0x1ab3ef['results'][_0x1113('0x16')]&&_0x1ab3ef[_0x1113('0x15')][_0x1113('0x16')]['length']){_0x4d3cbe[_0x1113('0x10')]='';for(var _0x4d49bb=0x0;_0x4d49bb<_0x1ab3ef[_0x1113('0x15')][_0x1113('0x16')][_0x1113('0x17')];_0x4d49bb++){_0x4d3cbe[_0x1113('0x10')]+=_0x1ab3ef['results'][_0x1113('0x16')][_0x4d49bb][_0x1113('0x18')]+'';}}return _0x4e4387[_0x1113('0x19')](_0x4d3cbe);})[_0x1113('0xa')](function(){logger['info'](util[_0x1113('0xc')](_0x1113('0x1a'),_0x4e4387['id']));if(!_0x4e4387[_0x1113('0x1b')]){throw new db['Sequelize'][(_0x1113('0x1c'))](_0x1113('0x1d'));}if(!_0x31a919[_0x1113('0x1e')]||!_0x31a919['sentimentAccountId']||!_0x31a919[_0x1113('0x1f')]||!_0x31a919[_0x1113('0x20')]||!_0x31a919[_0x1113('0x21')]){throw new db[(_0x1113('0x22'))][(_0x1113('0x1c'))](_0x1113('0x23'));}if(!_0x4d3cbe[_0x1113('0x10')]){throw new Error(_0x1113('0x24'));}if(_0x31a919[_0x1113('0x25')]===_0x31b550['id']){return _0x31b550;}else{return db[_0x1113('0x26')][_0x1113('0x27')]({'where':{'id':_settings[_0x1113('0x25')]}});}})['then'](function(_0x47d165){if(!_0x47d165){throw new db[(_0x1113('0x22'))][(_0x1113('0x1c'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x47d165[_0x1113('0x7')]||!_0x47d165[_0x1113('0x8')]){throw new db['Sequelize'][(_0x1113('0x1c'))](_0x1113('0x28'));}_0x26bf52=_0x47d165;logger['info'](util[_0x1113('0xc')](_0x1113('0x29'),_0x4e4387['id']));return sentiment(_0x26bf52[_0x1113('0x7')],_0x26bf52[_0x1113('0x8')],_0x31a919['sentimentRegion'],_0x4d3cbe['fileText'],_0x31a919[_0x1113('0x20')]);})[_0x1113('0xa')](function(_0x494d69){logger[_0x1113('0xb')](util['format'](_0x1113('0x2a'),_0x4e4387['id']));return _0x4e4387[_0x1113('0x19')]({'sentiment':_0x494d69[_0x1113('0x2b')],'sPositive':_0x494d69[_0x1113('0x2c')][_0x1113('0x2d')],'sNegative':_0x494d69[_0x1113('0x2c')]['Negative'],'sMixed':_0x494d69[_0x1113('0x2c')]['Mixed'],'sNeutral':_0x494d69[_0x1113('0x2c')][_0x1113('0x2e')]});})['then'](function(){logger[_0x1113('0xb')](util['format'](_0x1113('0x1a'),_0x4e4387['id']));_0x3b929e();});case _0x1113('0x2f'):return _0x4e4387['update']({'transcribeStatus':_0x1113('0x2f'),'failureReason':_0x1f7537['TranscriptionJob'][_0x1113('0x30')]})[_0x1113('0xa')](function(){logger[_0x1113('0xb')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x4e4387['id']));_0x3b929e();});default:logger[_0x1113('0xb')](util[_0x1113('0xc')](_0x1113('0x31'),_0x4e4387['id']));break;}}else{return BPromise[_0x1113('0x32')]()[_0x1113('0xa')](function(){if(!_0x4e4387[_0x1113('0x1b')]){throw new db[(_0x1113('0x22'))]['ValidationError'](_0x1113('0x1d'));}if(!_0x31a919[_0x1113('0x1e')]||!_0x31a919[_0x1113('0x25')]||!_0x31a919[_0x1113('0x1f')]||!_0x31a919['language']||!_0x31a919[_0x1113('0x21')]){throw new db['Sequelize'][(_0x1113('0x1c'))](_0x1113('0x23'));}if(!_0x4e4387[_0x1113('0x10')]){throw new Error(_0x1113('0x24'));}if(_0x31a919[_0x1113('0x25')]===_0x31b550['id']){return _0x31b550;}else{return db[_0x1113('0x26')][_0x1113('0x27')]({'where':{'id':_settings[_0x1113('0x25')]}});}})[_0x1113('0xa')](function(_0x258a23){if(!_0x258a23){throw new db['Sequelize'][(_0x1113('0x1c'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x258a23['data1']||!_0x258a23['data2']){throw new db[(_0x1113('0x22'))][(_0x1113('0x1c'))](_0x1113('0x28'));}_0x26bf52=_0x258a23;logger[_0x1113('0xb')](util['format'](_0x1113('0x29'),_0x4e4387['id']));return sentiment(_0x26bf52['data1'],_0x26bf52[_0x1113('0x8')],_0x31a919[_0x1113('0x1f')],_0x4e4387[_0x1113('0x10')],_0x31a919[_0x1113('0x20')]);})['then'](function(_0x21a577){logger[_0x1113('0xb')](util['format'](_0x1113('0x2a'),_0x4e4387['id']));return _0x4e4387[_0x1113('0x19')]({'sentiment':_0x21a577['Sentiment'],'sPositive':_0x21a577[_0x1113('0x2c')][_0x1113('0x2d')],'sNegative':_0x21a577[_0x1113('0x2c')][_0x1113('0x33')],'sMixed':_0x21a577[_0x1113('0x2c')][_0x1113('0x34')],'sNeutral':_0x21a577[_0x1113('0x2c')]['Neutral'],'transcribeStatus':'COMPLETED'});})[_0x1113('0xa')](function(){logger[_0x1113('0xb')](util[_0x1113('0xc')](_0x1113('0x1a'),_0x4e4387['id']));_0x3b929e();});}})[_0x1113('0x35')](function(_0x969851){if(_0x969851){if(!_0x969851[_0x1113('0x36')]||_0x969851['name']!==_0x1113('0x37')){logger[_0x1113('0x38')](util[_0x1113('0xc')](_0x1113('0x39'),_0x4e4387['id']),util[_0x1113('0x3a')](_0x969851,{'showHidden':![],'depth':null}));}}_0x3b929e();});});}function checkTranscribe(){var _0x130a90;var _0xb8a1d6;var _0xcfe1c0;return db[_0x1113('0x3b')][_0x1113('0x3c')]({'where':{'transcribeStatus':_0x1113('0x3d')}})[_0x1113('0xa')](function(_0xc078c){if(!_0xc078c||!_0xc078c[_0x1113('0x17')]){throw new db[(_0x1113('0x22'))][(_0x1113('0x1c'))](_0x1113('0x3e'));}_0x130a90=_0xc078c;return db[_0x1113('0x3f')][_0x1113('0x27')]({'where':{'id':0x1}});})[_0x1113('0xa')](function(_0x54f9e1){if(!_0x54f9e1){throw new db[(_0x1113('0x22'))][(_0x1113('0x1c'))](_0x1113('0x40'));}_0xb8a1d6=_0x54f9e1;if(!_0xb8a1d6[_0x1113('0x3')]||!_0xb8a1d6[_0x1113('0x41')]||!_0xb8a1d6[_0x1113('0x9')]||!_0xb8a1d6['language']||!_0xb8a1d6[_0x1113('0x21')]){throw new db[(_0x1113('0x22'))]['ValidationError'](_0x1113('0x42'));}return db['CloudProvider'][_0x1113('0x27')]({'where':{'id':_0xb8a1d6[_0x1113('0x41')]}});})['then'](function(_0x502f86){if(!_0x502f86){throw new db[(_0x1113('0x22'))][(_0x1113('0x1c'))](_0x1113('0x43'));}if(!_0x502f86[_0x1113('0x7')]||!_0x502f86['data2']){throw new db[(_0x1113('0x22'))][(_0x1113('0x1c'))]('Cloud\x20Provider\x20not\x20configured');}_0xcfe1c0=_0x502f86;var _0x57f6de=[];_0x130a90[_0x1113('0x44')](function(_0x33ac27){_0x57f6de[_0x1113('0x45')](checkTranscribeJob(_0x33ac27,_0xb8a1d6,_0xcfe1c0));});return BPromise[_0x1113('0x46')](_0x57f6de);})[_0x1113('0x35')](function(_0x4a2705){if(_0x4a2705){if(!_0x4a2705[_0x1113('0x36')]||_0x4a2705[_0x1113('0x36')]!==_0x1113('0x37')){logger[_0x1113('0x38')](util['inspect'](_0x4a2705,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x9354=['SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','transcribeAccountId','Transcribe\x20not\x20configured','aws-sdk','request-promise','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','[RECORDING:%d]\x20Get\x20transcript','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentRegion','language','bucket','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','FAILED','FailureReason','resolve','tempSentiment','sentimentAccountId','Mixed','Neutral','catch','name'];(function(_0x555b2f,_0x43b622){var _0x81c0a6=function(_0x4629e6){while(--_0x4629e6){_0x555b2f['push'](_0x555b2f['shift']());}};_0x81c0a6(++_0x43b622);}(_0x9354,0x96));var _0x4935=function(_0x466e57,_0x21b819){_0x466e57=_0x466e57-0x0;var _0x34df42=_0x9354[_0x466e57];return _0x34df42;};var _=require('lodash');var AWS=require(_0x4935('0x0'));var rp=require(_0x4935('0x1'));var util=require('util');var BPromise=require(_0x4935('0x2'));var db=require(_0x4935('0x3'))['db'];var logger=require(_0x4935('0x4'))(_0x4935('0x5'));function getTranscriptionJob(_0x5327fc,_0x46c7f9,_0x2d509b,_0x127226){return new Promise(function(_0x2d518a,_0x263864){var _0x2e47bd=new AWS[(_0x4935('0x6'))]({'accessKeyId':_0x46c7f9,'secretAccessKey':_0x5327fc,'region':_0x2d509b});_0x2e47bd[_0x4935('0x7')]({'TranscriptionJobName':_0x127226},function(_0x10793e,_0x4c9902){if(_0x10793e){return _0x263864(_0x10793e);}else{return _0x2d518a(_0x4c9902);}});});}function sentiment(_0x30c8b9,_0x47a44f,_0x2aac9a,_0x38de96,_0xd5b117){return new Promise(function(_0x22a83f,_0x261462){var _0x319b72=new AWS['Comprehend']({'accessKeyId':_0x47a44f,'secretAccessKey':_0x30c8b9,'region':_0x2aac9a});_0x319b72['detectSentiment']({'Text':_0x38de96,'LanguageCode':_0xd5b117[_0x4935('0x8')](0x0,0x2)},function(_0x53fa58,_0x4823d0){if(_0x53fa58){return _0x261462(_0x53fa58);}else{return _0x22a83f(_0x4823d0);}});});}function checkTranscribeJob(_0x3f6eef,_0x32916f,_0x3bb388){var _0x1c6c22;return new BPromise(function(_0x3b246a,_0x2bf1b3){logger[_0x4935('0x9')](util[_0x4935('0xa')](_0x4935('0xb'),_0x3f6eef['id'],_0x3f6eef[_0x4935('0xc')]));return getTranscriptionJob(_0x3bb388[_0x4935('0xd')],_0x3bb388[_0x4935('0xe')],_0x32916f[_0x4935('0xf')],_0x3f6eef[_0x4935('0xc')])[_0x4935('0x10')](function(_0x395a43){logger['info'](util[_0x4935('0xa')](_0x4935('0x11'),_0x3f6eef['id'],_0x3f6eef[_0x4935('0xc')],_0x395a43[_0x4935('0x12')][_0x4935('0x13')]));if(!_0x3f6eef[_0x4935('0x14')]){switch(_0x395a43['TranscriptionJob'][_0x4935('0x13')]){case _0x4935('0x15'):var _0x4fe356={'transcribeStatus':_0x395a43[_0x4935('0x12')][_0x4935('0x13')],'fileUri':_0x395a43[_0x4935('0x12')]['Transcript']['TranscriptFileUri']};logger[_0x4935('0x9')](util[_0x4935('0xa')](_0x4935('0x16'),_0x3f6eef['id']));return rp({'uri':_0x395a43[_0x4935('0x12')][_0x4935('0x17')][_0x4935('0x18')],'json':!![]})[_0x4935('0x10')](function(_0xe482a5){logger['info'](util[_0x4935('0xa')](_0x4935('0x19'),_0x3f6eef['id']));if(_0xe482a5&&_0xe482a5[_0x4935('0x1a')]&&_0xe482a5[_0x4935('0x1a')][_0x4935('0x1b')]&&_0xe482a5['results']['transcripts'][_0x4935('0x1c')]){_0x4fe356[_0x4935('0x14')]='';for(var _0x3786ff=0x0;_0x3786ff<_0xe482a5[_0x4935('0x1a')][_0x4935('0x1b')][_0x4935('0x1c')];_0x3786ff++){_0x4fe356[_0x4935('0x14')]+=_0xe482a5[_0x4935('0x1a')][_0x4935('0x1b')][_0x3786ff][_0x4935('0x1d')]+'';}}return _0x3f6eef[_0x4935('0x1e')](_0x4fe356);})[_0x4935('0x10')](function(){logger[_0x4935('0x9')](util[_0x4935('0xa')](_0x4935('0x1f'),_0x3f6eef['id']));if(!_0x3f6eef['tempSentiment']){throw new db['Sequelize']['ValidationError'](_0x4935('0x20'));}if(!_0x32916f[_0x4935('0x21')]||!_0x32916f['sentimentAccountId']||!_0x32916f[_0x4935('0x22')]||!_0x32916f[_0x4935('0x23')]||!_0x32916f[_0x4935('0x24')]){throw new db[(_0x4935('0x25'))][(_0x4935('0x26'))](_0x4935('0x27'));}if(!_0x4fe356[_0x4935('0x14')]){throw new Error(_0x4935('0x28'));}if(_0x32916f['sentimentAccountId']===_0x3bb388['id']){return _0x3bb388;}else{return db[_0x4935('0x29')][_0x4935('0x2a')]({'where':{'id':_settings['sentimentAccountId']}});}})['then'](function(_0x3a504d){if(!_0x3a504d){throw new db['Sequelize'][(_0x4935('0x26'))](_0x4935('0x2b'));}if(!_0x3a504d[_0x4935('0xd')]||!_0x3a504d['data2']){throw new db['Sequelize'][(_0x4935('0x26'))](_0x4935('0x2c'));}_0x1c6c22=_0x3a504d;logger['info'](util[_0x4935('0xa')](_0x4935('0x2d'),_0x3f6eef['id']));return sentiment(_0x1c6c22[_0x4935('0xd')],_0x1c6c22[_0x4935('0xe')],_0x32916f[_0x4935('0x22')],_0x4fe356['fileText'],_0x32916f['language']);})[_0x4935('0x10')](function(_0x1016cc){logger['info'](util['format'](_0x4935('0x2e'),_0x3f6eef['id']));return _0x3f6eef['update']({'sentiment':_0x1016cc[_0x4935('0x2f')],'sPositive':_0x1016cc[_0x4935('0x30')][_0x4935('0x31')],'sNegative':_0x1016cc[_0x4935('0x30')][_0x4935('0x32')],'sMixed':_0x1016cc[_0x4935('0x30')]['Mixed'],'sNeutral':_0x1016cc[_0x4935('0x30')]['Neutral']});})[_0x4935('0x10')](function(){logger['info'](util[_0x4935('0xa')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x3f6eef['id']));_0x3b246a();});case _0x4935('0x33'):return _0x3f6eef[_0x4935('0x1e')]({'transcribeStatus':_0x4935('0x33'),'failureReason':_0x395a43[_0x4935('0x12')][_0x4935('0x34')]})[_0x4935('0x10')](function(){logger[_0x4935('0x9')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x3f6eef['id']));_0x3b246a();});default:logger[_0x4935('0x9')](util['format']('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x3f6eef['id']));break;}}else{return BPromise[_0x4935('0x35')]()['then'](function(){if(!_0x3f6eef[_0x4935('0x36')]){throw new db[(_0x4935('0x25'))][(_0x4935('0x26'))](_0x4935('0x20'));}if(!_0x32916f[_0x4935('0x21')]||!_0x32916f['sentimentAccountId']||!_0x32916f['sentimentRegion']||!_0x32916f[_0x4935('0x23')]||!_0x32916f[_0x4935('0x24')]){throw new db[(_0x4935('0x25'))][(_0x4935('0x26'))](_0x4935('0x27'));}if(!_0x3f6eef[_0x4935('0x14')]){throw new Error(_0x4935('0x28'));}if(_0x32916f[_0x4935('0x37')]===_0x3bb388['id']){return _0x3bb388;}else{return db['CloudProvider']['findOne']({'where':{'id':_settings[_0x4935('0x37')]}});}})[_0x4935('0x10')](function(_0x493588){if(!_0x493588){throw new db[(_0x4935('0x25'))][(_0x4935('0x26'))](_0x4935('0x2b'));}if(!_0x493588[_0x4935('0xd')]||!_0x493588['data2']){throw new db['Sequelize'][(_0x4935('0x26'))](_0x4935('0x2c'));}_0x1c6c22=_0x493588;logger['info'](util[_0x4935('0xa')](_0x4935('0x2d'),_0x3f6eef['id']));return sentiment(_0x1c6c22[_0x4935('0xd')],_0x1c6c22['data2'],_0x32916f[_0x4935('0x22')],_0x3f6eef[_0x4935('0x14')],_0x32916f[_0x4935('0x23')]);})[_0x4935('0x10')](function(_0x2a4de2){logger[_0x4935('0x9')](util[_0x4935('0xa')](_0x4935('0x2e'),_0x3f6eef['id']));return _0x3f6eef[_0x4935('0x1e')]({'sentiment':_0x2a4de2[_0x4935('0x2f')],'sPositive':_0x2a4de2[_0x4935('0x30')][_0x4935('0x31')],'sNegative':_0x2a4de2[_0x4935('0x30')][_0x4935('0x32')],'sMixed':_0x2a4de2[_0x4935('0x30')][_0x4935('0x38')],'sNeutral':_0x2a4de2[_0x4935('0x30')][_0x4935('0x39')],'transcribeStatus':'COMPLETED'});})[_0x4935('0x10')](function(){logger['info'](util[_0x4935('0xa')](_0x4935('0x1f'),_0x3f6eef['id']));_0x3b246a();});}})[_0x4935('0x3a')](function(_0x33e94a){if(_0x33e94a){if(!_0x33e94a['name']||_0x33e94a[_0x4935('0x3b')]!==_0x4935('0x3c')){logger[_0x4935('0x3d')](util[_0x4935('0xa')](_0x4935('0x3e'),_0x3f6eef['id']),util[_0x4935('0x3f')](_0x33e94a,{'showHidden':![],'depth':null}));}}_0x3b246a();});});}function checkTranscribe(){var _0x1c42bb;var _0x31d137;var _0x29b932;return db[_0x4935('0x40')]['findAll']({'where':{'transcribeStatus':_0x4935('0x41')}})[_0x4935('0x10')](function(_0x5e0942){if(!_0x5e0942||!_0x5e0942[_0x4935('0x1c')]){throw new db[(_0x4935('0x25'))][(_0x4935('0x26'))](_0x4935('0x42'));}_0x1c42bb=_0x5e0942;return db[_0x4935('0x43')][_0x4935('0x2a')]({'where':{'id':0x1}});})[_0x4935('0x10')](function(_0x471fb1){if(!_0x471fb1){throw new db['Sequelize'][(_0x4935('0x26'))]('Settings\x20not\x20available');}_0x31d137=_0x471fb1;if(!_0x31d137['transcribe']||!_0x31d137[_0x4935('0x44')]||!_0x31d137[_0x4935('0xf')]||!_0x31d137[_0x4935('0x23')]||!_0x31d137[_0x4935('0x24')]){throw new db[(_0x4935('0x25'))]['ValidationError'](_0x4935('0x45'));}return db[_0x4935('0x29')][_0x4935('0x2a')]({'where':{'id':_0x31d137[_0x4935('0x44')]}});})[_0x4935('0x10')](function(_0x8196b4){if(!_0x8196b4){throw new db[(_0x4935('0x25'))][(_0x4935('0x26'))](_0x4935('0x2b'));}if(!_0x8196b4[_0x4935('0xd')]||!_0x8196b4['data2']){throw new db[(_0x4935('0x25'))]['ValidationError'](_0x4935('0x2c'));}_0x29b932=_0x8196b4;var _0xe08e62=[];_0x1c42bb['forEach'](function(_0x3daccd){_0xe08e62['push'](checkTranscribeJob(_0x3daccd,_0x31d137,_0x29b932));});return BPromise['all'](_0xe08e62);})['catch'](function(_0x126f53){if(_0x126f53){if(!_0x126f53[_0x4935('0x3b')]||_0x126f53[_0x4935('0x3b')]!==_0x4935('0x3c')){logger[_0x4935('0x3d')](util['inspect'](_0x126f53,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index 5a92d10..3cc505b 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 _0x5050=['timeout','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','join','whatsappInteraction:update','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','lastMsgAt','subtract','then','length','map','[WHATSAPP]\x20Interactions\x20to\x20close:','update','system'];(function(_0x2b78e4,_0x5b8b3c){var _0x1113f4=function(_0x1ae111){while(--_0x1ae111){_0x2b78e4['push'](_0x2b78e4['shift']());}};_0x1113f4(++_0x5b8b3c);}(_0x5050,0x1dd));var _0x0505=function(_0x551826,_0x38298e){_0x551826=_0x551826-0x0;var _0x507e25=_0x5050[_0x551826];return _0x507e25;};'use strict';var _=require(_0x0505('0x0'));var moment=require(_0x0505('0x1'));var Redis=require(_0x0505('0x2'));var util=require('util');var config=require(_0x0505('0x3'));var db=require(_0x0505('0x4'))['db'];var logger=require('../logger')('schedule');config['redis']=_[_0x0505('0x5')](config[_0x0505('0x6')],{'host':_0x0505('0x7'),'port':0x18eb});var io=require(_0x0505('0x8'))(new Redis(config[_0x0505('0x6')]));function closeInteractions(){var _0x3ac3b2=[];return db['WhatsappInteraction']['findAll']({'raw':!![],'attributes':['id',_0x0505('0x9')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x0505('0xa')](0x18,'hours')}}})[_0x0505('0xb')](function(_0x274f0a){if(_0x274f0a&&_0x274f0a[_0x0505('0xc')]){_0x3ac3b2=_[_0x0505('0xd')](_0x274f0a||[],'id');logger['info'](_0x0505('0xe'),_0x3ac3b2['join']());return db['WhatsappInteraction'][_0x0505('0xf')]({'closeReason':_0x0505('0x10'),'disposition':_0x0505('0x11'),'closed':!![],'closedAt':moment()[_0x0505('0x12')](_0x0505('0x13'))},{'where':{'id':_0x3ac3b2}});}})[_0x0505('0xb')](function(){if(_0x3ac3b2&&_0x3ac3b2[_0x0505('0xc')]){logger['info'](_0x0505('0x14'),_0x3ac3b2[_0x0505('0x15')]());for(var _0x42ac40=0x0;_0x42ac40<_0x3ac3b2[_0x0505('0xc')];_0x42ac40++){io['emit'](_0x0505('0x16'),{'id':_0x3ac3b2[_0x42ac40],'closed':!![]});}}})['catch'](function(_0x52738e){logger['error'](_0x0505('0x17'),_0x52738e?util[_0x0505('0x18')](_0x52738e,{'showHidden':![],'depth':null}):'');});}exports[_0x0505('0x19')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x9003=['hours','then','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','system','timeout','YYYY-MM-DD\x20HH:mm:ss','length','emit','whatsappInteraction:update','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','ioredis','util','../../mysqldb','../logger','schedule','redis','localhost','socket.io-emitter','WhatsappInteraction','lastMsgAt'];(function(_0xeda4ba,_0x4215d5){var _0x121c71=function(_0x43b17f){while(--_0x43b17f){_0xeda4ba['push'](_0xeda4ba['shift']());}};_0x121c71(++_0x4215d5);}(_0x9003,0x195));var _0x3900=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x9003[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0x3900('0x0'));var moment=require('moment');var Redis=require(_0x3900('0x1'));var util=require(_0x3900('0x2'));var config=require('../../config/environment');var db=require(_0x3900('0x3'))['db'];var logger=require(_0x3900('0x4'))(_0x3900('0x5'));config[_0x3900('0x6')]=_['defaults'](config[_0x3900('0x6')],{'host':_0x3900('0x7'),'port':0x18eb});var io=require(_0x3900('0x8'))(new Redis(config[_0x3900('0x6')]));function closeInteractions(){var _0x49d3ec=[];return db[_0x3900('0x9')]['findAll']({'raw':!![],'attributes':['id',_0x3900('0xa')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0x3900('0xb'))}}})[_0x3900('0xc')](function(_0x5cd685){if(_0x5cd685&&_0x5cd685['length']){_0x49d3ec=_[_0x3900('0xd')](_0x5cd685||[],'id');logger[_0x3900('0xe')](_0x3900('0xf'),_0x49d3ec[_0x3900('0x10')]());return db['WhatsappInteraction']['update']({'closeReason':_0x3900('0x11'),'disposition':_0x3900('0x12'),'closed':!![],'closedAt':moment()['format'](_0x3900('0x13'))},{'where':{'id':_0x49d3ec}});}})[_0x3900('0xc')](function(){if(_0x49d3ec&&_0x49d3ec['length']){logger[_0x3900('0xe')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x49d3ec[_0x3900('0x10')]());for(var _0x4edded=0x0;_0x4edded<_0x49d3ec[_0x3900('0x14')];_0x4edded++){io[_0x3900('0x15')](_0x3900('0x16'),{'id':_0x49d3ec[_0x4edded],'closed':!![]});}}})['catch'](function(_0x10086c){logger['error'](_0x3900('0x17'),_0x10086c?util[_0x3900('0x18')](_0x10086c,{'showHidden':![],'depth':null}):'');});}exports[_0x3900('0x19')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index 760c9d1..3044de1 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcba4=['innocenzo.biondo','@xcally.com','push','now','destroy','then','CmContact','finished\x20populating','contacts1','CmHopper','bulkCreate','log','hopper1','contacts2','catch','util','../mysqldb','Innocenzo','Biondo'];(function(_0xe957e3,_0x2f333e){var _0x21e397=function(_0x570d5e){while(--_0x570d5e){_0xe957e3['push'](_0xe957e3['shift']());}};_0x21e397(++_0x2f333e);}(_0xcba4,0xba));var _0x4cba=function(_0x4c98c7,_0x301f11){_0x4c98c7=_0x4c98c7-0x0;var _0x2d4d0a=_0xcba4[_0x4c98c7];return _0x2d4d0a;};'use strict';var util=require(_0x4cba('0x0'));var db=require(_0x4cba('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x4cba('0x2')+i,'lastName':_0x4cba('0x3')+i,'phone':0xf879fb460+i,'email':_0x4cba('0x4')+i+_0x4cba('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x4cba('0x6')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x4cba('0x7')](),'updatedAt':Date[_0x4cba('0x7')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x4cba('0x6')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x4cba('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x4cba('0x6')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x4cba('0x7')](),'updatedAt':Date[_0x4cba('0x7')]()});}db['CmContact'][_0x4cba('0x8')]({'where':{}})[_0x4cba('0x9')](function(){return db[_0x4cba('0xa')]['bulkCreate'](contacts);})[_0x4cba('0x9')](function(){console['log'](_0x4cba('0xb'),_0x4cba('0xc'));return db[_0x4cba('0xd')][_0x4cba('0x8')]({'where':{}});})[_0x4cba('0x9')](function(){return db[_0x4cba('0xd')][_0x4cba('0xe')](hopper);})[_0x4cba('0x9')](function(){console[_0x4cba('0xf')](_0x4cba('0xb'),_0x4cba('0x10'));return db[_0x4cba('0xa')][_0x4cba('0xe')](contacts2);})['then'](function(){console['log'](_0x4cba('0xb'),_0x4cba('0x11'));return db['CmHopper'][_0x4cba('0xe')](hopper2);})[_0x4cba('0x9')](function(){console[_0x4cba('0xf')](_0x4cba('0xb'),'hopper2');})[_0x4cba('0x12')](function(_0x4bcf77){console[_0x4cba('0xf')](_0x4bcf77);}); \ No newline at end of file +var _0xdae7=['Biondo','innocenzo.biondo','@xcally.com','now','Innocenzo','CmContact','destroy','then','bulkCreate','log','CmHopper','hopper1','finished\x20populating','hopper2','catch','util','../mysqldb','push'];(function(_0x53d359,_0x1b3b59){var _0x2bb5af=function(_0x4a3297){while(--_0x4a3297){_0x53d359['push'](_0x53d359['shift']());}};_0x2bb5af(++_0x1b3b59);}(_0xdae7,0xf9));var _0x7dae=function(_0xb83ec2,_0x18e73b){_0xb83ec2=_0xb83ec2-0x0;var _0x4d2fbf=_0xdae7[_0xb83ec2];return _0x4d2fbf;};'use strict';var util=require(_0x7dae('0x0'));var db=require(_0x7dae('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x7dae('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x7dae('0x3')+i,'phone':0xf879fb460+i,'email':_0x7dae('0x4')+i+_0x7dae('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x7dae('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x7dae('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x7dae('0x6')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x7dae('0x7')+i,'lastName':_0x7dae('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x7dae('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x7dae('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x7dae('0x6')](),'updatedAt':Date[_0x7dae('0x6')]()});}db[_0x7dae('0x8')][_0x7dae('0x9')]({'where':{}})[_0x7dae('0xa')](function(){return db['CmContact'][_0x7dae('0xb')](contacts);})[_0x7dae('0xa')](function(){console[_0x7dae('0xc')]('finished\x20populating','contacts1');return db[_0x7dae('0xd')][_0x7dae('0x9')]({'where':{}});})[_0x7dae('0xa')](function(){return db['CmHopper'][_0x7dae('0xb')](hopper);})[_0x7dae('0xa')](function(){console[_0x7dae('0xc')]('finished\x20populating',_0x7dae('0xe'));return db[_0x7dae('0x8')][_0x7dae('0xb')](contacts2);})['then'](function(){console[_0x7dae('0xc')](_0x7dae('0xf'),'contacts2');return db[_0x7dae('0xd')][_0x7dae('0xb')](hopper2);})['then'](function(){console[_0x7dae('0xc')](_0x7dae('0xf'),_0x7dae('0x10'));})[_0x7dae('0x11')](function(_0x3d4a81){console[_0x7dae('0xc')](_0x3d4a81);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index b4d14b8..a7259d4 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5a3c=['util','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com','password','friend','udp','all','yes','/etc/pki/tls/certs/motion.crt','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user','catch'];(function(_0x5cabac,_0x5ccb08){var _0x5f47b8=function(_0x1e478b){while(--_0x1e478b){_0x5cabac['push'](_0x5cabac['shift']());}};_0x5f47b8(++_0x5ccb08);}(_0x5a3c,0x1ce));var _0xc5a3=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x5a3c[_0x21a9d9];return _0x46adce;};'use strict';var util=require(_0xc5a3('0x0'));var db=require(_0xc5a3('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xc5a3('0x2')]({'name':util[_0xc5a3('0x3')](_0xc5a3('0x4'),_0xc5a3('0x5'),i),'fullname':util[_0xc5a3('0x3')](_0xc5a3('0x4'),_0xc5a3('0x5'),i),'email':util['format'](_0xc5a3('0x6'),_0xc5a3('0x5'),i),'role':_0xc5a3('0x5'),'password':_0xc5a3('0x7'),'internal':0xfa0+i,'type':_0xc5a3('0x8'),'transport':[_0xc5a3('0x9'),'ws','wss'],'disallow':[_0xc5a3('0xa')],'allow':['ulaw'],'defaultuser':util[_0xc5a3('0x3')](_0xc5a3('0x4'),_0xc5a3('0x5'),i),'encryption':'yes','avpf':_0xc5a3('0xb'),'force_avp':'yes','icesupport':_0xc5a3('0xb'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0xc5a3('0xc'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0xc5a3('0xd'),'callerid':util[_0xc5a3('0x3')](_0xc5a3('0xe'),util['format']('%s%s','agent',i),0xfa0+i)});}db[_0xc5a3('0xf')][_0xc5a3('0x10')](users)[_0xc5a3('0x11')](function(){console[_0xc5a3('0x12')](_0xc5a3('0x13'));})[_0xc5a3('0x14')](function(_0x34d5ba){console[_0xc5a3('0x12')](_0x34d5ba);}); \ No newline at end of file +var _0x83f3=['wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','\x22%s\x22\x20<%s>','bulkCreate','then','log','add\x20user','catch','util','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com','friend','udp'];(function(_0x583315,_0x28e213){var _0x30ce64=function(_0x5ad172){while(--_0x5ad172){_0x583315['push'](_0x583315['shift']());}};_0x30ce64(++_0x28e213);}(_0x83f3,0x1ef));var _0x383f=function(_0x127fec,_0x188a0b){_0x127fec=_0x127fec-0x0;var _0x3b00bd=_0x83f3[_0x127fec];return _0x3b00bd;};'use strict';var util=require(_0x383f('0x0'));var db=require(_0x383f('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x383f('0x2')]({'name':util[_0x383f('0x3')](_0x383f('0x4'),'agent',i),'fullname':util['format'](_0x383f('0x4'),_0x383f('0x5'),i),'email':util['format'](_0x383f('0x6'),_0x383f('0x5'),i),'role':_0x383f('0x5'),'password':'password','internal':0xfa0+i,'type':_0x383f('0x7'),'transport':[_0x383f('0x8'),'ws',_0x383f('0x9')],'disallow':[_0x383f('0xa')],'allow':[_0x383f('0xb')],'defaultuser':util['format'](_0x383f('0x4'),_0x383f('0x5'),i),'encryption':_0x383f('0xc'),'avpf':_0x383f('0xc'),'force_avp':_0x383f('0xc'),'icesupport':_0x383f('0xc'),'dtlsenable':_0x383f('0xc'),'dtlsverify':'no','dtlscertfile':_0x383f('0xd'),'dtlsprivatekey':_0x383f('0xe'),'dtlssetup':'actpass','callerid':util['format'](_0x383f('0xf'),util['format'](_0x383f('0x4'),_0x383f('0x5'),i),0xfa0+i)});}db['User'][_0x383f('0x10')](users)[_0x383f('0x11')](function(){console[_0x383f('0x12')](_0x383f('0x13'));})[_0x383f('0x14')](function(_0x168d91){console[_0x383f('0x12')](_0x168d91);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 36aa092..67c4779 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1c77=['getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','length','chat','fax','mail','openchannel','whatsapp','trunk:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','catch','log','join','default','connection','address','request','remoteAddress','remotePort','connectedAt','nsp','disconnect','DISCONNECTED','CONNECTED','util','bluebird','../mysqldb','./environment','name','User','role','agent','telephone','type','ivr','then','autoAssociation','VoiceQueues','ChatQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','Telephones','findAll','Trunks','IvrCampaigns','resourceId','map','where','Campaign','format','%s:queue:%s','Agents','user:%s','handshake','query','find','userProfileId','ChatInteractions','MailInteraction','MailInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','OpenchannelQueue','WhatsappQueue','Trunk','voice:inbound','FaxQueues','MailQueue','getVoiceQueues'];(function(_0x531439,_0x5eded2){var _0x3134a0=function(_0x285bf7){while(--_0x285bf7){_0x531439['push'](_0x531439['shift']());}};_0x3134a0(++_0x5eded2);}(_0x1c77,0xed));var _0x71c7=function(_0x378720,_0xa711f1){_0x378720=_0x378720-0x0;var _0x47920a=_0x1c77[_0x378720];return _0x47920a;};'use strict';var _=require('lodash');var util=require(_0x71c7('0x0'));var BPromise=require(_0x71c7('0x1'));var db=require(_0x71c7('0x2'))['db'];var config=require(_0x71c7('0x3'));var queryQueues={'attributes':['id',_0x71c7('0x4')],'include':[{'as':'Agents','model':db[_0x71c7('0x5')],'attributes':['id',_0x71c7('0x4'),_0x71c7('0x6')],'raw':!![],'where':{'role':_0x71c7('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x71c7('0x4')],'where':{'role':_0x71c7('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0x71c7('0x4')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0x71c7('0x4'),_0x71c7('0x9')],'where':{'type':_0x71c7('0xa')}};function getAssociatedResources(_0x471bc6,_0x4a2f5e,_0x1f5fc9){return db['UserProfileSection']['findOne']({'where':{'name':_0x471bc6,'userProfileId':_0x4a2f5e},'raw':!![]})[_0x71c7('0xb')](function(_0x302f14){if(_0x302f14){if(_0x302f14[_0x71c7('0xc')]){switch(_0x471bc6){case _0x71c7('0xd'):case _0x71c7('0xe'):case'FaxQueues':case _0x71c7('0xf'):case _0x71c7('0x10'):case _0x71c7('0x11'):case _0x71c7('0x12'):return db[_0x1f5fc9]['findAll'](queryQueues);case _0x71c7('0x13'):return db[_0x1f5fc9][_0x71c7('0x14')](queryTelephones);case _0x71c7('0x15'):return db[_0x1f5fc9][_0x71c7('0x14')](queryTrunks);case _0x71c7('0x16'):return db[_0x1f5fc9][_0x71c7('0x14')](queryCampaigns);}}else{return db['UserProfileResource']['findAll']({'attributes':[_0x71c7('0x17')],'where':{'sectionId':_0x302f14['id']},'raw':!![]})[_0x71c7('0xb')](function(_0xc8b018){if(_0xc8b018){var _0x355b10={'where':{'id':_[_0x71c7('0x18')](_0xc8b018,_0x71c7('0x17'))},'raw':!![]};switch(_0x1f5fc9){case _0x71c7('0x5'):_0x355b10[_0x71c7('0x19')]['role']=_0x71c7('0x8');break;case _0x71c7('0x1a'):_0x355b10[_0x71c7('0x19')][_0x71c7('0x9')]=_0x71c7('0xa');break;}return db[_0x1f5fc9]['findAll'](_0x355b10);}else{return[];}});}}else{return[];}})['then'](function(_0xbe59dc){return _0xbe59dc;});}function joinOrLeaveQueues(_0x1c2fc7,_0x48e8e5,_0x51253b,_0x46aa9f){_0x1c2fc7[_0x48e8e5](util[_0x71c7('0x1b')](_0x71c7('0x1c'),_0x51253b,_0x46aa9f[_0x71c7('0x4')]));if(_0x46aa9f[_0x71c7('0x1d')]){for(var _0x2f5feb=0x0;_0x2f5feb<_0x46aa9f[_0x71c7('0x1d')]['length'];_0x2f5feb+=0x1){_0x1c2fc7[_0x48e8e5](util['format'](_0x71c7('0x1e'),_0x46aa9f[_0x71c7('0x1d')][_0x2f5feb][_0x71c7('0x4')]));}}}function joinOrLeave(_0x4149db,_0x3e3498,_0x8ce599){var _0x2b4712;if(_0x4149db[_0x71c7('0x1f')][_0x71c7('0x20')]['id']){db[_0x71c7('0x5')][_0x71c7('0x21')]({'attributes':['id',_0x71c7('0x4'),_0x71c7('0x6'),_0x71c7('0x22')],'where':{'id':_0x4149db['handshake'][_0x71c7('0x20')]['id']},'include':[{'model':db['ChatInteraction'],'as':_0x71c7('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x71c7('0x24')],'as':_0x71c7('0x25'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x71c7('0x26')],'as':_0x71c7('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x71c7('0x28')],'as':_0x71c7('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0x71c7('0x2a')],'as':_0x71c7('0x2b'),'attributes':['id'],'raw':!![]}]})[_0x71c7('0xb')](function(_0x5912f9){if(_0x5912f9){_0x2b4712=_0x5912f9;_0x4149db[_0x3e3498](util[_0x71c7('0x1b')](_0x71c7('0x1e'),_0x5912f9['name']));var _0x23a0ae=[];switch(_0x5912f9[_0x71c7('0x6')]){case _0x71c7('0x2c'):_0x4149db[_0x3e3498]('voice:inbound');_0x4149db[_0x3e3498](_0x71c7('0x2d'));if(queryQueues[_0x71c7('0x2e')](_0x71c7('0x2f'))){delete queryQueues[_0x71c7('0x2f')];}_0x23a0ae[_0x71c7('0x30')](db[_0x71c7('0x31')]['findAll'](queryQueues));_0x23a0ae[_0x71c7('0x30')](db[_0x71c7('0x32')][_0x71c7('0x14')](queryQueues));_0x23a0ae[_0x71c7('0x30')](db[_0x71c7('0x33')][_0x71c7('0x14')](queryQueues));_0x23a0ae[_0x71c7('0x30')](db[_0x71c7('0x34')]['findAll'](queryQueues));_0x23a0ae[_0x71c7('0x30')](db['MailQueue'][_0x71c7('0x14')](queryQueues));_0x23a0ae[_0x71c7('0x30')](db[_0x71c7('0x35')][_0x71c7('0x14')](queryQueues));_0x23a0ae[_0x71c7('0x30')](db[_0x71c7('0x36')][_0x71c7('0x14')](queryQueues));_0x23a0ae[_0x71c7('0x30')](db[_0x71c7('0x5')][_0x71c7('0x14')](queryTelephones));_0x23a0ae[_0x71c7('0x30')](db[_0x71c7('0x37')]['findAll'](queryTrunks));_0x23a0ae['push'](db['Campaign'][_0x71c7('0x14')](queryCampaigns));_0x23a0ae['push'](db[_0x71c7('0x5')][_0x71c7('0x14')](queryAgents));break;case'user':_0x4149db[_0x3e3498](_0x71c7('0x38'));_0x4149db[_0x3e3498](_0x71c7('0x2d'));_0x23a0ae[_0x71c7('0x30')](getAssociatedResources('VoiceQueues',_0x5912f9[_0x71c7('0x22')],_0x71c7('0x31')));_0x23a0ae[_0x71c7('0x30')](getAssociatedResources(_0x71c7('0xe'),_0x5912f9[_0x71c7('0x22')],_0x71c7('0x32')));_0x23a0ae[_0x71c7('0x30')](getAssociatedResources(_0x71c7('0x39'),_0x5912f9[_0x71c7('0x22')],'FaxQueue'));_0x23a0ae['push'](getAssociatedResources(_0x71c7('0xf'),_0x5912f9[_0x71c7('0x22')],_0x71c7('0x34')));_0x23a0ae['push'](getAssociatedResources(_0x71c7('0x10'),_0x5912f9[_0x71c7('0x22')],_0x71c7('0x3a')));_0x23a0ae[_0x71c7('0x30')](getAssociatedResources(_0x71c7('0x11'),_0x5912f9[_0x71c7('0x22')],'OpenchannelQueue'));_0x23a0ae[_0x71c7('0x30')](getAssociatedResources(_0x71c7('0x12'),_0x5912f9[_0x71c7('0x22')],'WhatsappQueue'));_0x23a0ae[_0x71c7('0x30')](getAssociatedResources('Telephones',_0x5912f9[_0x71c7('0x22')],_0x71c7('0x5')));_0x23a0ae[_0x71c7('0x30')](getAssociatedResources('Trunks',_0x5912f9[_0x71c7('0x22')],'Trunk'));_0x23a0ae[_0x71c7('0x30')](getAssociatedResources('IvrCampaigns',_0x5912f9[_0x71c7('0x22')],_0x71c7('0x1a')));_0x23a0ae[_0x71c7('0x30')](db['User']['findAll'](queryAgents));break;case _0x71c7('0x7'):_0x4149db[_0x3e3498](_0x71c7('0x38'));_0x4149db[_0x3e3498](_0x71c7('0x2d'));_0x23a0ae['push'](_0x5912f9[_0x71c7('0x3b')]({'attributes':['id','name']}));_0x23a0ae[_0x71c7('0x30')](_0x5912f9[_0x71c7('0x3c')]({'attributes':['id','name']}));_0x23a0ae[_0x71c7('0x30')](_0x5912f9[_0x71c7('0x3d')]({'attributes':['id',_0x71c7('0x4')]}));_0x23a0ae[_0x71c7('0x30')](_0x5912f9[_0x71c7('0x3e')]({'attributes':['id','name']}));_0x23a0ae[_0x71c7('0x30')](_0x5912f9[_0x71c7('0x3f')]({'attributes':['id',_0x71c7('0x4')]}));_0x23a0ae['push'](_0x5912f9[_0x71c7('0x40')]({'attributes':['id',_0x71c7('0x4')]}));_0x23a0ae[_0x71c7('0x30')](_0x5912f9['getWhatsappQueues']({'attributes':['id',_0x71c7('0x4')]}));break;}return BPromise['all'](_0x23a0ae);}})[_0x71c7('0xb')](function(_0x3efef2){if(_0x3efef2&&_0x3efef2[_0x71c7('0x41')]){for(var _0x35d652=0x0;_0x35d652<_0x3efef2[_0x71c7('0x41')];_0x35d652+=0x1){for(var _0xa00e70=0x0;_0xa00e70<_0x3efef2[_0x35d652][_0x71c7('0x41')];_0xa00e70+=0x1){switch(_0x35d652){case 0x0:joinOrLeaveQueues(_0x4149db,_0x3e3498,'voice',_0x3efef2[_0x35d652][_0xa00e70]);break;case 0x1:joinOrLeaveQueues(_0x4149db,_0x3e3498,_0x71c7('0x42'),_0x3efef2[_0x35d652][_0xa00e70]);break;case 0x2:joinOrLeaveQueues(_0x4149db,_0x3e3498,_0x71c7('0x43'),_0x3efef2[_0x35d652][_0xa00e70]);break;case 0x3:joinOrLeaveQueues(_0x4149db,_0x3e3498,'sms',_0x3efef2[_0x35d652][_0xa00e70]);break;case 0x4:joinOrLeaveQueues(_0x4149db,_0x3e3498,_0x71c7('0x44'),_0x3efef2[_0x35d652][_0xa00e70]);break;case 0x5:joinOrLeaveQueues(_0x4149db,_0x3e3498,_0x71c7('0x45'),_0x3efef2[_0x35d652][_0xa00e70]);break;case 0x6:joinOrLeaveQueues(_0x4149db,_0x3e3498,_0x71c7('0x46'),_0x3efef2[_0x35d652][_0xa00e70]);break;case 0x7:if(_0x2b4712[_0x71c7('0x6')]!=='agent')_0x4149db[_0x3e3498](util['format']('telephone:%s',_0x3efef2[_0x35d652][_0xa00e70][_0x71c7('0x4')]));break;case 0x8:if(_0x2b4712['role']!==_0x71c7('0x7'))_0x4149db[_0x3e3498](util['format'](_0x71c7('0x47'),_0x3efef2[_0x35d652][_0xa00e70][_0x71c7('0x4')]));break;case 0x9:if(_0x2b4712[_0x71c7('0x6')]!==_0x71c7('0x7'))_0x4149db[_0x3e3498](util['format']('campaign:%s:%s',_0x3efef2[_0x35d652][_0xa00e70][_0x71c7('0x9')],_0x3efef2[_0x35d652][_0xa00e70][_0x71c7('0x4')]));break;case 0xa:_0x4149db[_0x3e3498](util[_0x71c7('0x1b')](_0x71c7('0x1e'),_0x3efef2[_0x35d652][_0xa00e70][_0x71c7('0x4')]));break;}}}}})[_0x71c7('0xb')](function(){if(_0x3e3498===_0x71c7('0x48')){var _0x4fa6c7=_[_0x71c7('0x18')](_0x2b4712[_0x71c7('0x23')],'id');return _0x2b4712[_0x71c7('0x49')](_0x4fa6c7)[_0x71c7('0xb')](function(){for(var _0x4e755d=0x0;_0x4e755d<_0x4fa6c7[_0x71c7('0x41')];_0x4e755d+=0x1){_0x8ce599[_0x71c7('0x4a')](_0x71c7('0x4b'),{'ChatInteractionId':Number(_0x4fa6c7[_0x4e755d]),'UserId':Number(_0x2b4712['id'])});}});}})['then'](function(){if(_0x3e3498===_0x71c7('0x48')){var _0x4ea505=_['map'](_0x2b4712[_0x71c7('0x25')],'id');return _0x2b4712[_0x71c7('0x4c')](_0x4ea505)[_0x71c7('0xb')](function(){for(var _0x12e1cc=0x0;_0x12e1cc<_0x4ea505['length'];_0x12e1cc+=0x1){_0x8ce599[_0x71c7('0x4a')](_0x71c7('0x4d'),{'MailInteractionId':Number(_0x4ea505[_0x12e1cc]),'UserId':Number(_0x2b4712['id'])});}});}})[_0x71c7('0xb')](function(){if(_0x3e3498===_0x71c7('0x48')){var _0x1f5bc1=_[_0x71c7('0x18')](_0x2b4712['FaxInteractions'],'id');return _0x2b4712[_0x71c7('0x4e')](_0x1f5bc1)[_0x71c7('0xb')](function(){for(var _0x8a7d15=0x0;_0x8a7d15<_0x1f5bc1[_0x71c7('0x41')];_0x8a7d15+=0x1){_0x8ce599[_0x71c7('0x4a')](_0x71c7('0x4f'),{'FaxInteractionId':Number(_0x1f5bc1[_0x8a7d15]),'UserId':Number(_0x2b4712['id'])});}});}})['then'](function(){if(_0x3e3498===_0x71c7('0x48')){var _0x386fe9=_[_0x71c7('0x18')](_0x2b4712[_0x71c7('0x27')],'id');return _0x2b4712[_0x71c7('0x50')](_0x386fe9)[_0x71c7('0xb')](function(){for(var _0x45857d=0x0;_0x45857d<_0x386fe9[_0x71c7('0x41')];_0x45857d+=0x1){_0x8ce599[_0x71c7('0x4a')](_0x71c7('0x51'),{'SmsInteractionId':Number(_0x386fe9[_0x45857d]),'UserId':Number(_0x2b4712['id'])});}});}})[_0x71c7('0xb')](function(){if(_0x3e3498===_0x71c7('0x48')){var _0x1dd14b=_[_0x71c7('0x18')](_0x2b4712[_0x71c7('0x29')],'id');return _0x2b4712[_0x71c7('0x52')](_0x1dd14b)['then'](function(){for(var _0x3918ac=0x0;_0x3918ac<_0x1dd14b[_0x71c7('0x41')];_0x3918ac+=0x1){_0x8ce599[_0x71c7('0x4a')](_0x71c7('0x53'),{'OpenchannelInteractionId':Number(_0x1dd14b[_0x3918ac]),'UserId':Number(_0x2b4712['id'])});}});}})['then'](function(){if(_0x3e3498===_0x71c7('0x48')){var _0x29d1af=_[_0x71c7('0x18')](_0x2b4712[_0x71c7('0x2b')],'id');return _0x2b4712[_0x71c7('0x54')](_0x29d1af)[_0x71c7('0xb')](function(){for(var _0x71911=0x0;_0x71911<_0x29d1af['length'];_0x71911+=0x1){_0x8ce599[_0x71c7('0x4a')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x29d1af[_0x71911]),'UserId':Number(_0x2b4712['id'])});}});}})[_0x71c7('0x55')](function(_0x2ce69a){_0x4149db[_0x71c7('0x56')](_0x2ce69a);});}}function onDisconnect(_0x102f90,_0x17a595){joinOrLeave(_0x102f90,_0x71c7('0x48'),_0x17a595);}function onConnect(_0x13fbc9){joinOrLeave(_0x13fbc9,_0x71c7('0x57'));}exports[_0x71c7('0x58')]=function(_0x388a0c){_0x388a0c['on'](_0x71c7('0x59'),function(_0x35295f){_0x35295f['setMaxListeners'](0x0);_0x35295f[_0x71c7('0x5a')]=_0x35295f[_0x71c7('0x5b')]['connection'][_0x71c7('0x5c')]+':'+_0x35295f[_0x71c7('0x5b')]['connection'][_0x71c7('0x5d')];_0x35295f[_0x71c7('0x5e')]=new Date();_0x35295f[_0x71c7('0x56')]=function(_0x4c6fe7){console[_0x71c7('0x56')]('SocketIO\x20'+_0x35295f[_0x71c7('0x5f')]['name']+'['+_0x35295f[_0x71c7('0x5a')]+']',_0x4c6fe7);};_0x35295f['on'](_0x71c7('0x60'),function(){onDisconnect(_0x35295f,_0x388a0c);_0x35295f['log'](_0x71c7('0x61'));});onConnect(_0x35295f);_0x35295f[_0x71c7('0x56')](_0x71c7('0x62'));});}; \ No newline at end of file +var _0x434b=['remoteAddress','connectedAt','log','SocketIO\x20','nsp','disconnect','CONNECTED','bluebird','../mysqldb','name','User','role','agent','telephone','type','ivr','UserProfileSection','findOne','autoAssociation','VoiceQueues','SmsQueues','MailQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','then','map','where','Campaign','format','%s:queue:%s','Agents','length','user:%s','handshake','query','find','userProfileId','ChatInteraction','MailInteractions','FaxInteractions','SmsInteraction','OpenchannelInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','include','push','VoiceQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','ChatQueues','ChatQueue','FaxQueues','OpenchannelQueues','WhatsappQueues','getVoiceQueues','getChatQueues','getSmsQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','sms','openchannel','whatsapp','trunk:%s','leave','removeChatInteractions','emit','removeMailInteractions','user_has_mail_interactions:remove','user_has_fax_interactions:remove','SmsInteractions','user_has_sms_interactions:remove','OpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','catch','join','default','connection','setMaxListeners','address','request'];(function(_0x402012,_0x50336a){var _0x3c656a=function(_0x566ead){while(--_0x566ead){_0x402012['push'](_0x402012['shift']());}};_0x3c656a(++_0x50336a);}(_0x434b,0x17f));var _0xb434=function(_0x29e3ec,_0x138a18){_0x29e3ec=_0x29e3ec-0x0;var _0x25727e=_0x434b[_0x29e3ec];return _0x25727e;};'use strict';var _=require('lodash');var util=require('util');var BPromise=require(_0xb434('0x0'));var db=require(_0xb434('0x1'))['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0xb434('0x2')],'include':[{'as':'Agents','model':db[_0xb434('0x3')],'attributes':['id',_0xb434('0x2'),_0xb434('0x4')],'raw':!![],'where':{'role':_0xb434('0x5')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xb434('0x2')],'where':{'role':_0xb434('0x6')}};var queryTrunks={'raw':!![],'attributes':['id',_0xb434('0x2')]};var queryAgents={'raw':!![],'attributes':['id',_0xb434('0x2')],'where':{'role':_0xb434('0x5')}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0xb434('0x7')],'where':{'type':_0xb434('0x8')}};function getAssociatedResources(_0x443e5c,_0x1cd406,_0x26a2a3){return db[_0xb434('0x9')][_0xb434('0xa')]({'where':{'name':_0x443e5c,'userProfileId':_0x1cd406},'raw':!![]})['then'](function(_0x56262e){if(_0x56262e){if(_0x56262e[_0xb434('0xb')]){switch(_0x443e5c){case _0xb434('0xc'):case'ChatQueues':case'FaxQueues':case _0xb434('0xd'):case _0xb434('0xe'):case'OpenchannelQueues':case'WhatsappQueues':return db[_0x26a2a3][_0xb434('0xf')](queryQueues);case _0xb434('0x10'):return db[_0x26a2a3]['findAll'](queryTelephones);case _0xb434('0x11'):return db[_0x26a2a3][_0xb434('0xf')](queryTrunks);case _0xb434('0x12'):return db[_0x26a2a3][_0xb434('0xf')](queryCampaigns);}}else{return db[_0xb434('0x13')][_0xb434('0xf')]({'attributes':[_0xb434('0x14')],'where':{'sectionId':_0x56262e['id']},'raw':!![]})[_0xb434('0x15')](function(_0x589140){if(_0x589140){var _0x3b13a1={'where':{'id':_[_0xb434('0x16')](_0x589140,_0xb434('0x14'))},'raw':!![]};switch(_0x26a2a3){case _0xb434('0x3'):_0x3b13a1[_0xb434('0x17')][_0xb434('0x4')]=_0xb434('0x6');break;case _0xb434('0x18'):_0x3b13a1['where']['type']='ivr';break;}return db[_0x26a2a3]['findAll'](_0x3b13a1);}else{return[];}});}}else{return[];}})[_0xb434('0x15')](function(_0x1c3ef5){return _0x1c3ef5;});}function joinOrLeaveQueues(_0x5d86d9,_0x4260f5,_0x5e2494,_0x12d22d){_0x5d86d9[_0x4260f5](util[_0xb434('0x19')](_0xb434('0x1a'),_0x5e2494,_0x12d22d[_0xb434('0x2')]));if(_0x12d22d[_0xb434('0x1b')]){for(var _0x321871=0x0;_0x321871<_0x12d22d[_0xb434('0x1b')][_0xb434('0x1c')];_0x321871+=0x1){_0x5d86d9[_0x4260f5](util[_0xb434('0x19')](_0xb434('0x1d'),_0x12d22d[_0xb434('0x1b')][_0x321871]['name']));}}}function joinOrLeave(_0xd030aa,_0x515921,_0x3ea18e){var _0x13a8a6;if(_0xd030aa[_0xb434('0x1e')][_0xb434('0x1f')]['id']){db[_0xb434('0x3')][_0xb434('0x20')]({'attributes':['id',_0xb434('0x2'),_0xb434('0x4'),_0xb434('0x21')],'where':{'id':_0xd030aa['handshake'][_0xb434('0x1f')]['id']},'include':[{'model':db[_0xb434('0x22')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0xb434('0x23'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0xb434('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0xb434('0x25')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xb434('0x26')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0xb434('0x27'),'attributes':['id'],'raw':!![]}]})[_0xb434('0x15')](function(_0x296a66){if(_0x296a66){_0x13a8a6=_0x296a66;_0xd030aa[_0x515921](util['format'](_0xb434('0x1d'),_0x296a66['name']));var _0x3b1bd9=[];switch(_0x296a66[_0xb434('0x4')]){case _0xb434('0x28'):_0xd030aa[_0x515921](_0xb434('0x29'));_0xd030aa[_0x515921](_0xb434('0x2a'));if(queryQueues['hasOwnProperty'](_0xb434('0x2b'))){delete queryQueues[_0xb434('0x2b')];}_0x3b1bd9[_0xb434('0x2c')](db[_0xb434('0x2d')][_0xb434('0xf')](queryQueues));_0x3b1bd9['push'](db['ChatQueue']['findAll'](queryQueues));_0x3b1bd9['push'](db[_0xb434('0x2e')]['findAll'](queryQueues));_0x3b1bd9[_0xb434('0x2c')](db[_0xb434('0x2f')][_0xb434('0xf')](queryQueues));_0x3b1bd9[_0xb434('0x2c')](db[_0xb434('0x30')][_0xb434('0xf')](queryQueues));_0x3b1bd9['push'](db[_0xb434('0x31')]['findAll'](queryQueues));_0x3b1bd9[_0xb434('0x2c')](db[_0xb434('0x32')][_0xb434('0xf')](queryQueues));_0x3b1bd9[_0xb434('0x2c')](db[_0xb434('0x3')][_0xb434('0xf')](queryTelephones));_0x3b1bd9[_0xb434('0x2c')](db['Trunk'][_0xb434('0xf')](queryTrunks));_0x3b1bd9[_0xb434('0x2c')](db[_0xb434('0x18')][_0xb434('0xf')](queryCampaigns));_0x3b1bd9[_0xb434('0x2c')](db[_0xb434('0x3')][_0xb434('0xf')](queryAgents));break;case'user':_0xd030aa[_0x515921](_0xb434('0x29'));_0xd030aa[_0x515921]('voice:outbound');_0x3b1bd9[_0xb434('0x2c')](getAssociatedResources(_0xb434('0xc'),_0x296a66['userProfileId'],_0xb434('0x2d')));_0x3b1bd9[_0xb434('0x2c')](getAssociatedResources(_0xb434('0x33'),_0x296a66[_0xb434('0x21')],_0xb434('0x34')));_0x3b1bd9[_0xb434('0x2c')](getAssociatedResources(_0xb434('0x35'),_0x296a66[_0xb434('0x21')],_0xb434('0x2e')));_0x3b1bd9[_0xb434('0x2c')](getAssociatedResources(_0xb434('0xd'),_0x296a66[_0xb434('0x21')],_0xb434('0x2f')));_0x3b1bd9[_0xb434('0x2c')](getAssociatedResources(_0xb434('0xe'),_0x296a66[_0xb434('0x21')],_0xb434('0x30')));_0x3b1bd9[_0xb434('0x2c')](getAssociatedResources(_0xb434('0x36'),_0x296a66[_0xb434('0x21')],_0xb434('0x31')));_0x3b1bd9[_0xb434('0x2c')](getAssociatedResources(_0xb434('0x37'),_0x296a66[_0xb434('0x21')],'WhatsappQueue'));_0x3b1bd9[_0xb434('0x2c')](getAssociatedResources(_0xb434('0x10'),_0x296a66[_0xb434('0x21')],_0xb434('0x3')));_0x3b1bd9[_0xb434('0x2c')](getAssociatedResources(_0xb434('0x11'),_0x296a66[_0xb434('0x21')],'Trunk'));_0x3b1bd9[_0xb434('0x2c')](getAssociatedResources(_0xb434('0x12'),_0x296a66[_0xb434('0x21')],_0xb434('0x18')));_0x3b1bd9[_0xb434('0x2c')](db[_0xb434('0x3')][_0xb434('0xf')](queryAgents));break;case _0xb434('0x5'):_0xd030aa[_0x515921](_0xb434('0x29'));_0xd030aa[_0x515921](_0xb434('0x2a'));_0x3b1bd9[_0xb434('0x2c')](_0x296a66[_0xb434('0x38')]({'attributes':['id',_0xb434('0x2')]}));_0x3b1bd9['push'](_0x296a66[_0xb434('0x39')]({'attributes':['id','name']}));_0x3b1bd9[_0xb434('0x2c')](_0x296a66['getFaxQueues']({'attributes':['id',_0xb434('0x2')]}));_0x3b1bd9[_0xb434('0x2c')](_0x296a66[_0xb434('0x3a')]({'attributes':['id',_0xb434('0x2')]}));_0x3b1bd9[_0xb434('0x2c')](_0x296a66['getMailQueues']({'attributes':['id',_0xb434('0x2')]}));_0x3b1bd9['push'](_0x296a66[_0xb434('0x3b')]({'attributes':['id',_0xb434('0x2')]}));_0x3b1bd9[_0xb434('0x2c')](_0x296a66[_0xb434('0x3c')]({'attributes':['id',_0xb434('0x2')]}));break;}return BPromise[_0xb434('0x3d')](_0x3b1bd9);}})[_0xb434('0x15')](function(_0x33e279){if(_0x33e279&&_0x33e279[_0xb434('0x1c')]){for(var _0x297d02=0x0;_0x297d02<_0x33e279['length'];_0x297d02+=0x1){for(var _0x172a65=0x0;_0x172a65<_0x33e279[_0x297d02][_0xb434('0x1c')];_0x172a65+=0x1){switch(_0x297d02){case 0x0:joinOrLeaveQueues(_0xd030aa,_0x515921,_0xb434('0x3e'),_0x33e279[_0x297d02][_0x172a65]);break;case 0x1:joinOrLeaveQueues(_0xd030aa,_0x515921,_0xb434('0x3f'),_0x33e279[_0x297d02][_0x172a65]);break;case 0x2:joinOrLeaveQueues(_0xd030aa,_0x515921,'fax',_0x33e279[_0x297d02][_0x172a65]);break;case 0x3:joinOrLeaveQueues(_0xd030aa,_0x515921,_0xb434('0x40'),_0x33e279[_0x297d02][_0x172a65]);break;case 0x4:joinOrLeaveQueues(_0xd030aa,_0x515921,'mail',_0x33e279[_0x297d02][_0x172a65]);break;case 0x5:joinOrLeaveQueues(_0xd030aa,_0x515921,_0xb434('0x41'),_0x33e279[_0x297d02][_0x172a65]);break;case 0x6:joinOrLeaveQueues(_0xd030aa,_0x515921,_0xb434('0x42'),_0x33e279[_0x297d02][_0x172a65]);break;case 0x7:if(_0x13a8a6[_0xb434('0x4')]!=='agent')_0xd030aa[_0x515921](util[_0xb434('0x19')]('telephone:%s',_0x33e279[_0x297d02][_0x172a65][_0xb434('0x2')]));break;case 0x8:if(_0x13a8a6['role']!==_0xb434('0x5'))_0xd030aa[_0x515921](util['format'](_0xb434('0x43'),_0x33e279[_0x297d02][_0x172a65][_0xb434('0x2')]));break;case 0x9:if(_0x13a8a6[_0xb434('0x4')]!==_0xb434('0x5'))_0xd030aa[_0x515921](util['format']('campaign:%s:%s',_0x33e279[_0x297d02][_0x172a65][_0xb434('0x7')],_0x33e279[_0x297d02][_0x172a65][_0xb434('0x2')]));break;case 0xa:_0xd030aa[_0x515921](util['format'](_0xb434('0x1d'),_0x33e279[_0x297d02][_0x172a65]['name']));break;}}}}})[_0xb434('0x15')](function(){if(_0x515921===_0xb434('0x44')){var _0x23b7e7=_['map'](_0x13a8a6['ChatInteractions'],'id');return _0x13a8a6[_0xb434('0x45')](_0x23b7e7)[_0xb434('0x15')](function(){for(var _0x4f5452=0x0;_0x4f5452<_0x23b7e7['length'];_0x4f5452+=0x1){_0x3ea18e[_0xb434('0x46')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x23b7e7[_0x4f5452]),'UserId':Number(_0x13a8a6['id'])});}});}})['then'](function(){if(_0x515921===_0xb434('0x44')){var _0x3c8f17=_[_0xb434('0x16')](_0x13a8a6[_0xb434('0x23')],'id');return _0x13a8a6[_0xb434('0x47')](_0x3c8f17)[_0xb434('0x15')](function(){for(var _0x11ea3d=0x0;_0x11ea3d<_0x3c8f17[_0xb434('0x1c')];_0x11ea3d+=0x1){_0x3ea18e[_0xb434('0x46')](_0xb434('0x48'),{'MailInteractionId':Number(_0x3c8f17[_0x11ea3d]),'UserId':Number(_0x13a8a6['id'])});}});}})[_0xb434('0x15')](function(){if(_0x515921===_0xb434('0x44')){var _0x535a05=_[_0xb434('0x16')](_0x13a8a6[_0xb434('0x24')],'id');return _0x13a8a6['removeFaxInteractions'](_0x535a05)[_0xb434('0x15')](function(){for(var _0x2db9bf=0x0;_0x2db9bf<_0x535a05[_0xb434('0x1c')];_0x2db9bf+=0x1){_0x3ea18e[_0xb434('0x46')](_0xb434('0x49'),{'FaxInteractionId':Number(_0x535a05[_0x2db9bf]),'UserId':Number(_0x13a8a6['id'])});}});}})[_0xb434('0x15')](function(){if(_0x515921==='leave'){var _0x3b55c7=_[_0xb434('0x16')](_0x13a8a6[_0xb434('0x4a')],'id');return _0x13a8a6['removeSmsInteractions'](_0x3b55c7)[_0xb434('0x15')](function(){for(var _0x27f5cb=0x0;_0x27f5cb<_0x3b55c7[_0xb434('0x1c')];_0x27f5cb+=0x1){_0x3ea18e[_0xb434('0x46')](_0xb434('0x4b'),{'SmsInteractionId':Number(_0x3b55c7[_0x27f5cb]),'UserId':Number(_0x13a8a6['id'])});}});}})[_0xb434('0x15')](function(){if(_0x515921===_0xb434('0x44')){var _0x3071d3=_[_0xb434('0x16')](_0x13a8a6[_0xb434('0x4c')],'id');return _0x13a8a6[_0xb434('0x4d')](_0x3071d3)[_0xb434('0x15')](function(){for(var _0x4ad5ba=0x0;_0x4ad5ba<_0x3071d3['length'];_0x4ad5ba+=0x1){_0x3ea18e[_0xb434('0x46')](_0xb434('0x4e'),{'OpenchannelInteractionId':Number(_0x3071d3[_0x4ad5ba]),'UserId':Number(_0x13a8a6['id'])});}});}})['then'](function(){if(_0x515921===_0xb434('0x44')){var _0x34cf2a=_['map'](_0x13a8a6[_0xb434('0x27')],'id');return _0x13a8a6[_0xb434('0x4f')](_0x34cf2a)['then'](function(){for(var _0x4d9171=0x0;_0x4d9171<_0x34cf2a['length'];_0x4d9171+=0x1){_0x3ea18e[_0xb434('0x46')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x34cf2a[_0x4d9171]),'UserId':Number(_0x13a8a6['id'])});}});}})[_0xb434('0x50')](function(_0x5e6d14){_0xd030aa['log'](_0x5e6d14);});}}function onDisconnect(_0x53de42,_0x5e1ece){joinOrLeave(_0x53de42,_0xb434('0x44'),_0x5e1ece);}function onConnect(_0x30c20e){joinOrLeave(_0x30c20e,_0xb434('0x51'));}exports[_0xb434('0x52')]=function(_0xfe35f9){_0xfe35f9['on'](_0xb434('0x53'),function(_0x54eb63){_0x54eb63[_0xb434('0x54')](0x0);_0x54eb63[_0xb434('0x55')]=_0x54eb63[_0xb434('0x56')][_0xb434('0x53')][_0xb434('0x57')]+':'+_0x54eb63[_0xb434('0x56')][_0xb434('0x53')]['remotePort'];_0x54eb63[_0xb434('0x58')]=new Date();_0x54eb63[_0xb434('0x59')]=function(_0x24f31f){console[_0xb434('0x59')](_0xb434('0x5a')+_0x54eb63[_0xb434('0x5b')]['name']+'['+_0x54eb63[_0xb434('0x55')]+']',_0x24f31f);};_0x54eb63['on'](_0xb434('0x5c'),function(){onDisconnect(_0x54eb63,_0xfe35f9);_0x54eb63[_0xb434('0x59')]('DISCONNECTED');});onConnect(_0x54eb63);_0x54eb63[_0xb434('0x59')](_0xb434('0x5d'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index bd00cd1..32032bf 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 _0x7587=['query','Sequelize','QueryTypes','contact','UserId','interface','outgoingmessage','AfterCreateMessage','get','offlineMessage','opened','sequelize','name','changed','closed','substatus','SELECT','format','SIP/%s','agent','AfterUpdate','find','internal','hasOwnProperty','model','hook','callback','toLowerCase','condition','util','../../mysqldb','../logger','triggers','client','http','afterCreate','Chat','ChatInteraction','afterUpdate','closedinteraction','newmessage','ChatOfflineMessage','Sms','newinteraction','SmsInteraction','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','EventManager','info','Trigger,\x20%s','error','code','catch','channel','motionChannel','event','direction','resolve','then','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId'];(function(_0xfe0dcf,_0x467d94){var _0xaebe74=function(_0x3775f0){while(--_0x3775f0){_0xfe0dcf['push'](_0xfe0dcf['shift']());}};_0xaebe74(++_0x467d94);}(_0x7587,0x1cd));var _0x7758=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x7587[_0x376b45];return _0x2341b3;};'use strict';var util=require(_0x7758('0x0'));var db=require(_0x7758('0x1'))['db'];var jayson=require('jayson/promise');var logger=require(_0x7758('0x2'))(_0x7758('0x3'));var client=jayson[_0x7758('0x4')][_0x7758('0x5')]({'port':0x232a});var triggers=[{'channel':'Chat','model':'ChatInteraction','event':_0x7758('0x6'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x7758('0x7'),'model':_0x7758('0x8'),'event':_0x7758('0x9'),'condition':_0x7758('0xa'),'callback':afterUpdate},{'channel':_0x7758('0x7'),'model':'ChatMessage','event':'afterCreate','condition':_0x7758('0xb'),'callback':afterCreateMessage},{'channel':'Chat','model':_0x7758('0xc'),'event':'afterCreate','condition':_0x7758('0xb'),'callback':afterCreateOfflineMessage},{'channel':_0x7758('0xd'),'model':'SmsInteraction','event':_0x7758('0x6'),'condition':_0x7758('0xe'),'callback':afterCreate},{'channel':_0x7758('0xd'),'model':_0x7758('0xf'),'event':_0x7758('0x9'),'condition':_0x7758('0xa'),'callback':afterUpdate},{'channel':'Sms','model':'SmsMessage','event':'afterCreate','condition':_0x7758('0xb'),'callback':afterCreateMessage},{'channel':_0x7758('0x10'),'model':_0x7758('0x11'),'event':_0x7758('0x6'),'condition':_0x7758('0xe'),'callback':afterCreate},{'channel':_0x7758('0x10'),'model':_0x7758('0x11'),'event':_0x7758('0x9'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x7758('0x10'),'model':_0x7758('0x12'),'event':_0x7758('0x6'),'condition':_0x7758('0xb'),'callback':afterCreateMessage},{'channel':_0x7758('0x13'),'model':_0x7758('0x14'),'event':_0x7758('0x6'),'condition':_0x7758('0xe'),'callback':afterCreate},{'channel':'Fax','model':_0x7758('0x14'),'event':'afterUpdate','condition':_0x7758('0xa'),'callback':afterUpdate},{'channel':_0x7758('0x13'),'model':_0x7758('0x15'),'event':'afterCreate','condition':_0x7758('0xb'),'callback':afterCreateMessage},{'channel':_0x7758('0x16'),'model':_0x7758('0x17'),'event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':'Mail','model':_0x7758('0x17'),'event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':_0x7758('0x16'),'model':_0x7758('0x18'),'event':_0x7758('0x6'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x7758('0x19'),'model':'OpenchannelInteraction','event':_0x7758('0x6'),'condition':_0x7758('0xe'),'callback':afterCreate},{'channel':_0x7758('0x19'),'model':_0x7758('0x1a'),'event':_0x7758('0x9'),'condition':_0x7758('0xa'),'callback':afterUpdate},{'channel':'Openchannel','model':_0x7758('0x1b'),'event':_0x7758('0x6'),'condition':_0x7758('0xb'),'callback':afterCreateMessage}];function request(_0x592dfe){return client['request'](_0x7758('0x1c'),_0x592dfe)['then'](function(_0x559d4c){logger[_0x7758('0x1d')](_0x7758('0x1e'),'EventManager',_0x559d4c);if(_0x559d4c[_0x7758('0x1f')]){if(_0x559d4c['error'][_0x7758('0x20')]===0x1f4){logger[_0x7758('0x1f')](_0x7758('0x1e'),_0x7758('0x1c'),_0x559d4c[_0x7758('0x1f')]);}}})[_0x7758('0x21')](function(_0x4b4354){logger[_0x7758('0x1f')](_0x7758('0x1e'),_0x7758('0x1c'),_0x4b4354);});}function afterCreateMessage(_0xd8d3ef){return function(_0x2d0e86){_0x2d0e86=_0x2d0e86['get']({'plain':!![]});_0x2d0e86[_0x7758('0x22')]=_0xd8d3ef;_0x2d0e86[_0x7758('0x23')]=_0xd8d3ef;_0x2d0e86[_0x7758('0x24')]=_0x2d0e86[_0x7758('0x25')];Promise[_0x7758('0x26')]()[_0x7758('0x27')](function(){if(typeof _0x2d0e86['ContactId']===_0x7758('0x28'))return null;var _0x3c297a=_0x7758('0x29')+_0x2d0e86[_0x7758('0x2a')];return db['sequelize'][_0x7758('0x2b')](_0x3c297a,{'type':db[_0x7758('0x2c')][_0x7758('0x2d')]['SELECT'],'raw':!![]});})[_0x7758('0x27')](function(_0x218e26){if(_0x218e26){_0x2d0e86[_0x7758('0x2e')]=_0x218e26[0x0];}if(typeof _0x2d0e86['UserId']===_0x7758('0x28'))return;return getAgent(_0x2d0e86[_0x7758('0x2f')]);})[_0x7758('0x27')](function(_0x1ddafd){if(_0x1ddafd){_0x2d0e86[_0x7758('0x30')]=util['format']('SIP/%s',_0x1ddafd['name']);_0x2d0e86['agent']=_0x1ddafd;_0x2d0e86[_0x7758('0x22')]=_0xd8d3ef;return request({'event':'incomingmessage','message':_0x2d0e86});}else{return request({'event':_0x7758('0x31'),'message':_0x2d0e86});}})[_0x7758('0x21')](function(_0x220954){logger[_0x7758('0x1f')](_0x7758('0x1e'),_0x7758('0x32'),_0x220954);});};}function afterCreateOfflineMessage(_0x5736b0){return function(_0x385527){_0x385527=_0x385527[_0x7758('0x33')]({'plain':!![]});_0x385527[_0x7758('0x22')]=_0x5736b0;_0x385527[_0x7758('0x23')]=_0x5736b0;_0x385527[_0x7758('0x24')]=_0x7758('0x34');return request({'event':_0x385527[_0x7758('0x24')],'message':_0x385527});};}function afterCreate(_0x581c84,_0x551bb0){return function(_0x309eb8){var _0x423f1c=_0x309eb8[_0x7758('0x33')]({'plain':!![]});_0x423f1c['channel']=_0x581c84;_0x423f1c[_0x7758('0x23')]=_0x581c84;_0x423f1c['event']=_0x7758('0x35');Promise['resolve']()['then'](function(){var _0x33c0dd=_0x7758('0x29')+_0x423f1c[_0x7758('0x2a')];return db[_0x7758('0x36')]['query'](_0x33c0dd,{'type':db[_0x7758('0x2c')]['QueryTypes']['SELECT'],'raw':!![]});})[_0x7758('0x27')](function(_0x4d94dd){if(_0x4d94dd){_0x423f1c[_0x7758('0x2e')]=_0x4d94dd[0x0];}if(_0x423f1c[_0x7758('0x2f')]){return getAgent(_0x423f1c[_0x7758('0x2f')]);}return;})[_0x7758('0x27')](function(_0x56e8e9){if(_0x56e8e9){_0x423f1c['interface']=util['format']('SIP/%s',_0x56e8e9[_0x7758('0x37')]);_0x423f1c['agent']=_0x56e8e9;}return request({'event':_0x551bb0,'message':_0x423f1c});})['catch'](function(_0x2e3d58){logger['error'](_0x7758('0x1e'),'AfterCreate',_0x2e3d58);});};}function afterUpdate(_0x3b0470){return function(_0x11a3aa){var _0x488dfa=_0x11a3aa[_0x7758('0x38')]('closed')&&_0x11a3aa[_0x7758('0x39')];var _0x339053=_0x11a3aa[_0x7758('0x38')]('substatus');if(_0x488dfa||_0x339053){var _0x4da17a=_0x488dfa?_0x7758('0xa'):_0x7758('0x3a');var _0x4bb164=_0x11a3aa[_0x7758('0x33')]({'plain':!![]});_0x4bb164[_0x7758('0x22')]=_0x3b0470;_0x4bb164[_0x7758('0x23')]=_0x3b0470;_0x4bb164['event']=_0x488dfa?'closed':_0x7758('0x3a');var _0xb821=_0x7758('0x29')+_0x4bb164[_0x7758('0x2a')];return db['sequelize']['query'](_0xb821,{'type':db['Sequelize'][_0x7758('0x2d')][_0x7758('0x3b')],'raw':!![]})['then'](function(_0x377760){if(_0x377760){_0x4bb164['contact']=_0x377760[0x0];}if(typeof _0x4bb164['UserId']===_0x7758('0x28'))return;return getAgent(_0x4bb164[_0x7758('0x2f')]);})[_0x7758('0x27')](function(_0x54cf86){if(_0x54cf86){_0x4bb164['interface']=util[_0x7758('0x3c')](_0x7758('0x3d'),_0x54cf86[_0x7758('0x37')]);_0x4bb164[_0x7758('0x3e')]=_0x54cf86;}return request({'event':_0x4da17a,'message':_0x4bb164});})[_0x7758('0x21')](function(_0x1dd3ac){logger[_0x7758('0x1f')](_0x7758('0x1e'),_0x7758('0x3f'),_0x1dd3ac);});}};}function getAgent(_0xc01fc1){return db['User'][_0x7758('0x40')]({'where':{'id':_0xc01fc1},'attributes':['id',_0x7758('0x37'),'fullname','email',_0x7758('0x41')],'raw':!![]})[_0x7758('0x27')](function(_0xa63fcc){return _0xa63fcc;});}exports['default']=function(){for(var _0x4664cd=0x0;_0x4664cd=_0x11b918[_0x96ba('0x12')]){throw Error(_0x96ba('0x13'));}_0x5b4130(_0x6a2ae7);})[_0x96ba('0x14')](function(_0x3d400d){_0x3ddd43(_0x3d400d);});});}; \ No newline at end of file +var _0xf4da=['clearBlockUser','isUndefined','blockedAt','updateAttributes','getLicense','role','agent','User','then','lodash','bluebird','./license/util','voice','mail','fax','sms','whatsapp','getChannels','isValidChannel','toLowerCase'];(function(_0x245ff8,_0x2e81f8){var _0x5a4faa=function(_0x26af9e){while(--_0x26af9e){_0x245ff8['push'](_0x245ff8['shift']());}};_0x5a4faa(++_0x2e81f8);}(_0xf4da,0x121));var _0xaf4d=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xf4da[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0xaf4d('0x0'));var BPromise=require(_0xaf4d('0x1'));var db=require('../mysqldb')['db'];var util=require(_0xaf4d('0x2'));var channels=[_0xaf4d('0x3'),_0xaf4d('0x4'),'chat',_0xaf4d('0x5'),_0xaf4d('0x6'),_0xaf4d('0x7'),'openchannel'];exports[_0xaf4d('0x8')]=function(){return channels;};exports[_0xaf4d('0x9')]=function(_0x5d1854){_0x5d1854=_0x5d1854[_0xaf4d('0xa')]();return _['includes'](channels,_0x5d1854);};exports[_0xaf4d('0xb')]=function(_0x750cc2,_0x39e89c,_0x456ad3,_0x24660c){var _0x3ccc9d={'loginAttempts':_0x39e89c,'blocked':_0x456ad3};if(!_[_0xaf4d('0xc')](_0x24660c)){_0x3ccc9d[_0xaf4d('0xd')]=_0x24660c;}return _0x750cc2[_0xaf4d('0xe')](_0x3ccc9d);};exports[_0xaf4d('0xf')]=function(_0x37daca){return new BPromise(function(_0x68da2d,_0x3d277f){var _0xd51e86=0x0;if(_0x37daca[_0xaf4d('0x10')]!==_0xaf4d('0x11')){_0x68da2d(_0x37daca);}db[_0xaf4d('0x12')]['count']({'where':{'role':'agent','online':!![],'id':{'$ne':_0x37daca['id']}}})[_0xaf4d('0x13')](function(_0x4d7644){_0xd51e86=_0x4d7644;return util[_0xaf4d('0xf')]();})[_0xaf4d('0x13')](function(_0x5a104c){if(_0x5a104c&&_0x5a104c['agents']&&_0xd51e86>=_0x5a104c['agents']){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x68da2d(_0x37daca);})['catch'](function(_0xffe4e5){_0x3d277f(_0xffe4e5);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index fedd5d7..53938e9 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x09ef=['Conflict','Out\x20Of\x20Interval','error','stack','statusMessage','status','send','util','../config/logger','api','message','name','Error','Bad\x20Request','inherits','Forbidden','Message\x20sent\x20outside\x20a\x20valid\x20interval','code','OutOfInterval','Resource\x20Conflict'];(function(_0x93bdde,_0x26ca52){var _0x19fb76=function(_0x1f4e72){while(--_0x1f4e72){_0x93bdde['push'](_0x93bdde['shift']());}};_0x19fb76(++_0x26ca52);}(_0x09ef,0x11f));var _0xf09e=function(_0x194e0d,_0x205c17){_0x194e0d=_0x194e0d-0x0;var _0x1b3f8c=_0x09ef[_0x194e0d];return _0x1b3f8c;};'use strict';var util=require(_0xf09e('0x0'));var logger=require(_0xf09e('0x1'))(_0xf09e('0x2'));var APIError=function(_0x29f0ec,_0x3279b0){this[_0xf09e('0x3')]=_0x29f0ec||'Internal\x20Server\x20Error';this[_0xf09e('0x4')]=_0x3279b0||_0xf09e('0x5');util['inherits'](APIError,Error);};var APIBadRequestError=function(_0x431043){this[_0xf09e('0x3')]=_0x431043||_0xf09e('0x6');this[_0xf09e('0x4')]='Bad\x20Request';util[_0xf09e('0x7')](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x30ab3f){this[_0xf09e('0x3')]=_0x30ab3f||_0xf09e('0x8');this[_0xf09e('0x4')]=_0xf09e('0x8');util[_0xf09e('0x7')](APIForbiddenError,APIError);};var APINotFoundError=function(_0x1e7291){this[_0xf09e('0x3')]=_0x1e7291||'Entity\x20not\x20found';this[_0xf09e('0x4')]='Not\x20Found';util['inherits'](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x47b5de){this[_0xf09e('0x3')]=_0x47b5de||_0xf09e('0x9');this[_0xf09e('0x4')]='Out\x20Of\x20Interval';this[_0xf09e('0xa')]=0x193;this['details']={'type':_0xf09e('0xb')};util[_0xf09e('0x7')](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x6874be){this[_0xf09e('0x3')]=_0x6874be||_0xf09e('0xc');this[_0xf09e('0x4')]=_0xf09e('0xd');util[_0xf09e('0x7')](APIBadRequestError,APIError);};function getStatusCode(_0x52b88d){switch(_0x52b88d){case _0xf09e('0x6'):return 0x190;case _0xf09e('0x8'),'Out\x20Of\x20Interval':return 0x193;case'Not\x20Found':return 0x194;case _0xf09e('0xd'):return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x2e4a06){if(_0x2e4a06===_0xf09e('0xe'))return _0x2e4a06;return null;}function handleError(_0x52ad1d){return function(_0x474f9f){logger[_0xf09e('0xf')](_0x474f9f[_0xf09e('0x10')]);var _0x2c755a=getStatusCode(_0x474f9f['name']);var _0xe274b4=getCustomStatusMessage(_0x474f9f[_0xf09e('0x4')]);if(_0x474f9f['name']){delete _0x474f9f[_0xf09e('0x4')];}if(_0xe274b4){_0x52ad1d[_0xf09e('0x11')]=_0xe274b4;}return _0x52ad1d[_0xf09e('0x12')](_0x2c755a)[_0xf09e('0x13')](_0x474f9f);};}module['exports']={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file +var _0x06ff=['error','stack','statusMessage','status','send','exports','../config/logger','api','message','Internal\x20Server\x20Error','name','Error','inherits','Bad\x20Request','Forbidden','Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','details','Conflict'];(function(_0x2a5b3b,_0x4ebe31){var _0xae665a=function(_0x59e86a){while(--_0x59e86a){_0x2a5b3b['push'](_0x2a5b3b['shift']());}};_0xae665a(++_0x4ebe31);}(_0x06ff,0xe2));var _0xf06f=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x06ff[_0x4e676e];return _0x336a3c;};'use strict';var util=require('util');var logger=require(_0xf06f('0x0'))(_0xf06f('0x1'));var APIError=function(_0x1d9f2f,_0x26593e){this[_0xf06f('0x2')]=_0x1d9f2f||_0xf06f('0x3');this[_0xf06f('0x4')]=_0x26593e||_0xf06f('0x5');util[_0xf06f('0x6')](APIError,Error);};var APIBadRequestError=function(_0x30411b){this['message']=_0x30411b||'Bad\x20Request';this[_0xf06f('0x4')]=_0xf06f('0x7');util[_0xf06f('0x6')](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x25c5f6){this[_0xf06f('0x2')]=_0x25c5f6||_0xf06f('0x8');this['name']=_0xf06f('0x8');util[_0xf06f('0x6')](APIForbiddenError,APIError);};var APINotFoundError=function(_0x41b398){this[_0xf06f('0x2')]=_0x41b398||'Entity\x20not\x20found';this['name']=_0xf06f('0x9');util[_0xf06f('0x6')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x1a668f){this[_0xf06f('0x2')]=_0x1a668f||_0xf06f('0xa');this[_0xf06f('0x4')]=_0xf06f('0xb');this['code']=0x193;this[_0xf06f('0xc')]={'type':'OutOfInterval'};util['inherits'](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x1aa011){this[_0xf06f('0x2')]=_0x1aa011||'Resource\x20Conflict';this[_0xf06f('0x4')]=_0xf06f('0xd');util[_0xf06f('0x6')](APIBadRequestError,APIError);};function getStatusCode(_0x552278){switch(_0x552278){case _0xf06f('0x7'):return 0x190;case _0xf06f('0x8'),_0xf06f('0xb'):return 0x193;case'Not\x20Found':return 0x194;case'Conflict':return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x3f00ed){if(_0x3f00ed===_0xf06f('0xb'))return _0x3f00ed;return null;}function handleError(_0x4e6d51){return function(_0x35500a){logger[_0xf06f('0xe')](_0x35500a[_0xf06f('0xf')]);var _0x1acc00=getStatusCode(_0x35500a[_0xf06f('0x4')]);var _0x10661d=getCustomStatusMessage(_0x35500a[_0xf06f('0x4')]);if(_0x35500a[_0xf06f('0x4')]){delete _0x35500a[_0xf06f('0x4')];}if(_0x10661d){_0x4e6d51[_0xf06f('0x10')]=_0x10661d;}return _0x4e6d51[_0xf06f('0x11')](_0x1acc00)[_0xf06f('0x12')](_0x35500a);};}module[_0xf06f('0x13')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 17f60fb..de8c379 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x827a=['404','status','render','json','send','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x827a,0x167));var _0xa827=function(_0x3e6247,_0x1d2bb0){_0x3e6247=_0x3e6247-0x0;var _0x1e8056=_0x827a[_0x3e6247];return _0x1e8056;};'use strict';module[_0xa827('0x0')][0x194]=function pageNotFound(_0x5b350a,_0x538465){var _0x4615de=_0xa827('0x1');var _0x1053d0=0x194;var _0xd5d420={'status':_0x1053d0};_0x538465[_0xa827('0x2')](_0xd5d420['status']);_0x538465[_0xa827('0x3')](_0x4615de,{},function(_0x414421,_0x3c7208){if(_0x414421){return _0x538465['status'](_0xd5d420[_0xa827('0x2')])[_0xa827('0x4')](_0xd5d420);}_0x538465[_0xa827('0x5')](_0x3c7208);});}; \ No newline at end of file +var _0x7915=['404','status','render','json','send','exports'];(function(_0x407b07,_0x525c69){var _0x2c9b12=function(_0x54b368){while(--_0x54b368){_0x407b07['push'](_0x407b07['shift']());}};_0x2c9b12(++_0x525c69);}(_0x7915,0x1a9));var _0x5791=function(_0x5e9628,_0x30b22c){_0x5e9628=_0x5e9628-0x0;var _0x5cfb79=_0x7915[_0x5e9628];return _0x5cfb79;};'use strict';module[_0x5791('0x0')][0x194]=function pageNotFound(_0x314ddd,_0x2921fd){var _0x3e53dc=_0x5791('0x1');var _0x5e7203=0x194;var _0x5cee46={'status':_0x5e7203};_0x2921fd[_0x5791('0x2')](_0x5cee46[_0x5791('0x2')]);_0x2921fd[_0x5791('0x3')](_0x3e53dc,{},function(_0x46d7b4,_0x4f48f4){if(_0x46d7b4){return _0x2921fd[_0x5791('0x2')](_0x5cee46[_0x5791('0x2')])[_0x5791('0x4')](_0x5cee46);}_0x2921fd[_0x5791('0x5')](_0x4f48f4);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 35475de..f46837e 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8a16=['VoiceQueuesRt','Extensions','CmHopperFinal','HopperHistory','OpenchannelInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','SenderId','SET\x20NULL','belongsTo','belongsToMany','chat_group_has_users','CmList','user_has_teams','ChatInteractions','user_has_chat_interactions','user_has_fax_interactions','user_has_openchannel_interactions','VoiceQueues','VoicePrefixes','MailQueues','ChatQueue','FaxQueue','FaxQueues','SmsQueues','UserOpenchannelQueue','WhatsappQueues','cm_user_has_lists','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccount','MailAccounts','user_has_mail_accounts','SmsAccount','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SpiedAgents','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperHistories','HopperBlacks','JscriptySessionReport','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','Interval','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','Lists','voice_queues_has_cm_lists','Agents','Teams','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','uniqueid','ContactId','MailServerIn','MailAccountId','CloudProviderId','Imap','Smtp','Dispositions','Answers','TemplateId','team_has_mail_queues','Account','Contact','Owner','Tags','mail_interaction_has_tags','Users','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessageId','restrict','TagId','MailQueueReport','Items','FaxAccountId','Interactions','Applications','Exntensions','List','Pause','FaxInteractionId','fax_interaction_has_tags','ThroughTags','AttachmentId','ListId','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','user_has_sms_interactions','SmsQueueId','OpenchannelAccountId','OpenchannelQueueId','openchannel_interaction_has_tags','OpenchannelInteractionId','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatInternalMessage','ChatGroupId','CmCompany','Contacts','Phones','HopperFinals','Company','cm_user_has_contacts','cm_contact_has_tags','CmHopperId','Agent','CampaignId','OwnerId','Condition','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','AutomationId','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','VoiceMusicOnHold','Mohs','whatsapp_interaction_has_tags','ItemType','ItemTypeId','CmHopperAdditionalPhone','Hopper','CmContactId','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','Trigger','TriggerId','Fields','AnalyticMetric','MetricId','SalesforceConfiguration','Configurations','AccountId','SubjectId','FieldId','Description','Field','Variable','Subjects','Descriptions','DescriptionId','Subject','VariableId','ZohoConfiguration','ZendeskField','FreshdeskField','int_freshdesk_configuration_has_tags','ServicenowField','Dynamics365Configuration','FreshsalesAccount','FromId','JscriptyQuestionReport','SessionId','JscriptyProject','JscriptyAnswerReport','ChatQueues','team_has_fax_queues','OpenchannelQueues','team_has_whatsapp_queues','SquareProject','SquareProjectId','BlackLists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToAccount','FromChatWebsiteId','FromFaxAccountId','ToFaxAccountId','OpenchannelTransferReport','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','SmsTransferReport','ToSmsAccountId','CmCustomField','CustomFields','Queues','userProfileId','UserProfileSection','UserProfileSections','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','user','../config/environment','lodash','jstz','determine','sequelize','defaultsDeep','motion2','xC@LL1234','127.0.0.1','utf8mb4','utf8','utf8_general_ci','sequelizeHistory','xcall','mysql','name','database','username','options','User','import','../api/user/user.model','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','MemberReport','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','Dashboard','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsApplication','../api/smsApplication/smsApplication.model','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','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','ChatOfflineMessage','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','Action','../api/action/action.model','Automation','CannedAnswer','Disposition','../api/condition/condition.model','../api/interval/interval.model','../api/pause/pause.model','Cdr','VoiceQueuesLog','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','SalesforceAccount','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','Integration','../api/network/network.model','ChatQueueReport','../api/chatInternalMessage/chatInternalMessage.model','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','SmsQueueReport','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareRecording','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','FaxTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','../api/user-setting/user-setting.model','MailInteractionHasTag','hasOne','cascade','UserId','UserSetting','userSetting','VoiceRecording','Recordings','hasMany'];(function(_0x5d0b4e,_0x54c772){var _0x36b6c1=function(_0x33a00c){while(--_0x33a00c){_0x5d0b4e['push'](_0x5d0b4e['shift']());}};_0x36b6c1(++_0x54c772);}(_0x8a16,0xe6));var _0x68a1=function(_0xc84126,_0x3791bf){_0xc84126=_0xc84126-0x0;var _0x1d64ce=_0x8a16[_0xc84126];return _0x1d64ce;};'use strict';var config=require(_0x68a1('0x0'));var Sequelize=require('sequelize');var _=require(_0x68a1('0x1'));var jstz=require(_0x68a1('0x2'));var timezone=jstz[_0x68a1('0x3')]();config[_0x68a1('0x4')]=_[_0x68a1('0x5')](config[_0x68a1('0x4')],{'database':_0x68a1('0x6'),'username':'xcall','password':_0x68a1('0x7'),'options':{'host':_0x68a1('0x8'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x68a1('0x9')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x68a1('0xa'),'collate':_0x68a1('0xb')}}});config[_0x68a1('0xc')]=_['defaultsDeep'](config[_0x68a1('0xc')],{'database':_0x68a1('0x6'),'username':_0x68a1('0xd'),'password':_0x68a1('0x7'),'options':{'host':_0x68a1('0x8'),'port':0xcea,'dialect':_0x68a1('0xe'),'dialectOptions':{'charset':_0x68a1('0x9')},'logging':![],'timezone':timezone[_0x68a1('0xf')](),'define':{'charset':_0x68a1('0xa'),'collate':_0x68a1('0xb')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x68a1('0x4')][_0x68a1('0x10')],config[_0x68a1('0x4')][_0x68a1('0x11')],config[_0x68a1('0x4')]['password'],config[_0x68a1('0x4')][_0x68a1('0x12')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory']['database'],config[_0x68a1('0xc')][_0x68a1('0x11')],config[_0x68a1('0xc')]['password'],config[_0x68a1('0xc')][_0x68a1('0x12')])};db[_0x68a1('0x13')]=db['sequelize'][_0x68a1('0x14')](_0x68a1('0x15'));db['VoiceChanSpy']=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x16'));db[_0x68a1('0x17')]=db['sequelize'][_0x68a1('0x14')](_0x68a1('0x18'));db[_0x68a1('0x19')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x1a'));db['VoiceMusicOnHold']=db['sequelize'][_0x68a1('0x14')](_0x68a1('0x1b'));db[_0x68a1('0x1c')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x1d'));db['VoiceRecording']=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x1e'));db[_0x68a1('0x1f')]=db['sequelize'][_0x68a1('0x14')](_0x68a1('0x20'));db[_0x68a1('0x21')]=db[_0x68a1('0x4')]['import'](_0x68a1('0x22'));db[_0x68a1('0x23')]=db['sequelize'][_0x68a1('0x14')](_0x68a1('0x24'));db[_0x68a1('0x25')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x26'));db['VoiceDialReport']=db[_0x68a1('0x4')]['import'](_0x68a1('0x27'));db[_0x68a1('0x28')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x29'));db[_0x68a1('0x2a')]=db[_0x68a1('0x4')][_0x68a1('0x14')]('../api/voiceQueueReport/voiceQueueReport.model');db[_0x68a1('0x2b')]=db[_0x68a1('0x4')][_0x68a1('0x14')]('../api/memberReport/memberReport.model');db[_0x68a1('0x2c')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x2d'));db['VoiceTransferReport']=db['sequelize'][_0x68a1('0x14')](_0x68a1('0x2e'));db[_0x68a1('0x2f')]=db[_0x68a1('0x4')][_0x68a1('0x14')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0x68a1('0x30')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x31'));db[_0x68a1('0x32')]=db[_0x68a1('0x4')]['import'](_0x68a1('0x33'));db[_0x68a1('0x34')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x35'));db[_0x68a1('0x36')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x37'));db[_0x68a1('0x38')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x39'));db['UserOpenchannelQueue']=db['sequelize'][_0x68a1('0x14')](_0x68a1('0x3a'));db[_0x68a1('0x3b')]=db[_0x68a1('0x4')][_0x68a1('0x14')]('../api/userWhatsappQueue/userWhatsappQueue.model');db['MailServerIn']=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x3c'));db[_0x68a1('0x3d')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x3e'));db['MailAccount']=db['sequelize']['import'](_0x68a1('0x3f'));db[_0x68a1('0x40')]=db['sequelize'][_0x68a1('0x14')](_0x68a1('0x41'));db[_0x68a1('0x42')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x43'));db[_0x68a1('0x44')]=db[_0x68a1('0x4')][_0x68a1('0x14')]('../api/mailInteraction/mailInteraction.model');db[_0x68a1('0x45')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x46'));db[_0x68a1('0x47')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x48'));db['MailQueueReport']=db['sequelize']['import']('../api/mailQueueReport/mailQueueReport.model');db[_0x68a1('0x49')]=db[_0x68a1('0x4')][_0x68a1('0x14')]('../api/dashboard/dashboard.model');db[_0x68a1('0x4a')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x4b'));db[_0x68a1('0x4c')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x4d'));db[_0x68a1('0x4e')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x4f'));db[_0x68a1('0x50')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x51'));db[_0x68a1('0x52')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x53'));db['FaxQueue']=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x54'));db[_0x68a1('0x55')]=db['sequelize'][_0x68a1('0x14')](_0x68a1('0x56'));db['SmsAccount']=db[_0x68a1('0x4')][_0x68a1('0x14')]('../api/smsAccount/smsAccount.model');db[_0x68a1('0x57')]=db[_0x68a1('0x4')]['import'](_0x68a1('0x58'));db[_0x68a1('0x59')]=db['sequelize'][_0x68a1('0x14')](_0x68a1('0x5a'));db[_0x68a1('0x5b')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x5c'));db[_0x68a1('0x5d')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x5e'));db[_0x68a1('0x5f')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x60'));db[_0x68a1('0x61')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x62'));db[_0x68a1('0x63')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x64'));db[_0x68a1('0x65')]=db[_0x68a1('0x4')][_0x68a1('0x14')]('../api/openchannelMessage/openchannelMessage.model');db[_0x68a1('0x66')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x67'));db[_0x68a1('0x68')]=db[_0x68a1('0x4')][_0x68a1('0x14')]('../api/chatWebsite/chatWebsite.model');db[_0x68a1('0x69')]=db['sequelize'][_0x68a1('0x14')](_0x68a1('0x6a'));db[_0x68a1('0x6b')]=db['sequelize']['import'](_0x68a1('0x6c'));db[_0x68a1('0x6d')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x6e'));db[_0x68a1('0x6f')]=db[_0x68a1('0x4')][_0x68a1('0x14')]('../api/chatMessage/chatMessage.model');db[_0x68a1('0x70')]=db[_0x68a1('0x4')][_0x68a1('0x14')]('../api/chatOfflineMessage/chatOfflineMessage.model');db['ChatQueue']=db['sequelize'][_0x68a1('0x14')](_0x68a1('0x71'));db[_0x68a1('0x72')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x73'));db[_0x68a1('0x74')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x75'));db['CmCompany']=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x76'));db[_0x68a1('0x77')]=db[_0x68a1('0x4')]['import'](_0x68a1('0x78'));db[_0x68a1('0x79')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x7a'));db[_0x68a1('0x7b')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x7c'));db['CmHopperFinal']=db['sequelize'][_0x68a1('0x14')](_0x68a1('0x7d'));db[_0x68a1('0x7e')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x7f'));db[_0x68a1('0x80')]=db['sequelize']['import'](_0x68a1('0x81'));db['CmCustomField']=db[_0x68a1('0x4')][_0x68a1('0x14')]('../api/cmCustomField/cmCustomField.model');db[_0x68a1('0x82')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x83'));db[_0x68a1('0x84')]=db[_0x68a1('0x4')][_0x68a1('0x14')]('../api/automation/automation.model');db[_0x68a1('0x85')]=db[_0x68a1('0x4')][_0x68a1('0x14')]('../api/cannedAnswer/cannedAnswer.model');db[_0x68a1('0x86')]=db['sequelize'][_0x68a1('0x14')]('../api/disposition/disposition.model');db['Condition']=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x87'));db['Interval']=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x88'));db['Pause']=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x89'));db[_0x68a1('0x8a')]=db['sequelize'][_0x68a1('0x14')]('../api/cdr/cdr.model');db[_0x68a1('0x8b')]=db[_0x68a1('0x4')][_0x68a1('0x14')]('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0x68a1('0x8c')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x8d'));db[_0x68a1('0x8e')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x8f'));db[_0x68a1('0x90')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x91'));db[_0x68a1('0x92')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x93'));db[_0x68a1('0x94')]=db[_0x68a1('0x4')]['import'](_0x68a1('0x95'));db['CmHopperAdditionalPhone']=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x96'));db[_0x68a1('0x97')]=db[_0x68a1('0x4')][_0x68a1('0x14')]('../api/template/template.model');db['Trigger']=db['sequelize'][_0x68a1('0x14')]('../api/trigger/trigger.model');db['Variable']=db[_0x68a1('0x4')][_0x68a1('0x14')]('../api/variable/variable.model');db['Integration']=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x98'));db[_0x68a1('0x99')]=db[_0x68a1('0x4')]['import'](_0x68a1('0x9a'));db[_0x68a1('0x9b')]=db['sequelize']['import'](_0x68a1('0x9c'));db[_0x68a1('0x9d')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x9e'));db[_0x68a1('0x9f')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0xa0'));db['AnalyticMetric']=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0xa1'));db[_0x68a1('0xa2')]=db[_0x68a1('0x4')]['import'](_0x68a1('0xa3'));db[_0x68a1('0xa4')]=db[_0x68a1('0x4')][_0x68a1('0x14')]('../api/analyticTreeReport/analyticTreeReport.model');db[_0x68a1('0xa5')]=db[_0x68a1('0x4')][_0x68a1('0x14')]('../api/intSalesforceAccount/intSalesforceAccount.model');db['SalesforceConfiguration']=db[_0x68a1('0x4')][_0x68a1('0x14')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db[_0x68a1('0xa6')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0xa7'));db[_0x68a1('0xa8')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0xa9'));db[_0x68a1('0xaa')]=db[_0x68a1('0x4')]['import'](_0x68a1('0xab'));db[_0x68a1('0xac')]=db['sequelize'][_0x68a1('0x14')]('../api/intSugarcrmField/intSugarcrmField.model');db[_0x68a1('0xad')]=db['sequelize']['import'](_0x68a1('0xae'));db[_0x68a1('0xaf')]=db[_0x68a1('0x4')]['import'](_0x68a1('0xb0'));db[_0x68a1('0xb1')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0xb2'));db[_0x68a1('0xb3')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0xb4'));db['ZohoConfiguration']=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0xb5'));db[_0x68a1('0xb6')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0xb7'));db[_0x68a1('0xb8')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0xb9'));db[_0x68a1('0xba')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0xbb'));db['ZendeskField']=db['sequelize'][_0x68a1('0x14')](_0x68a1('0xbc'));db[_0x68a1('0xbd')]=db[_0x68a1('0x4')][_0x68a1('0x14')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0x68a1('0xbe')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0xbf'));db['FreshdeskField']=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0xc0'));db[_0x68a1('0xc1')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0xc2'));db[_0x68a1('0xc3')]=db[_0x68a1('0x4')]['import'](_0x68a1('0xc4'));db[_0x68a1('0xc5')]=db[_0x68a1('0x4')]['import'](_0x68a1('0xc6'));db[_0x68a1('0xc7')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0xc8'));db[_0x68a1('0xc9')]=db[_0x68a1('0x4')]['import'](_0x68a1('0xca'));db['ServicenowField']=db[_0x68a1('0x4')]['import'](_0x68a1('0xcb'));db[_0x68a1('0xcc')]=db['sequelize'][_0x68a1('0x14')]('../api/intDynamics365Account/intDynamics365Account.model');db['Dynamics365Configuration']=db['sequelize'][_0x68a1('0x14')](_0x68a1('0xcd'));db[_0x68a1('0xce')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0xcf'));db['FreshsalesAccount']=db[_0x68a1('0x4')][_0x68a1('0x14')]('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0x68a1('0xd0')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0xd1'));db[_0x68a1('0xd2')]=db[_0x68a1('0x4')][_0x68a1('0x14')]('../api/intFreshsalesField/intFreshsalesField.model');db[_0x68a1('0xd3')]=db['sequelize'][_0x68a1('0x14')]('../api/integration/integration.model');db['Network']=db[_0x68a1('0x4')]['import'](_0x68a1('0xd4'));db[_0x68a1('0xd5')]=db[_0x68a1('0x4')][_0x68a1('0x14')]('../api/chatQueueReport/chatQueueReport.model');db['ChatInternalMessage']=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0xd6'));db['JscriptyAnswerReport']=db[_0x68a1('0x4')]['import'](_0x68a1('0xd7'));db['JscriptyQuestionReport']=db[_0x68a1('0x4')]['import']('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db['JscriptySessionReport']=db[_0x68a1('0x4')][_0x68a1('0x14')]('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0x68a1('0xd8')]=db[_0x68a1('0x4')]['import']('../api/smsQueueReport/smsQueueReport.model');db[_0x68a1('0xd9')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0xda'));db[_0x68a1('0xdb')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0xdc'));db['JscriptyProject']=db[_0x68a1('0x4')]['import']('../api/jscriptyProject/jscriptyProject.model');db[_0x68a1('0xdd')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0xde'));db['SquareOdbc']=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0xdf'));db['SquareProject']=db[_0x68a1('0x4')]['import']('../api/squareProject/squareProject.model');db[_0x68a1('0xe0')]=db[_0x68a1('0x4')][_0x68a1('0x14')]('../api/squareRecording/squareRecording.model');db[_0x68a1('0xe1')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0xe2'));db[_0x68a1('0xe3')]=db['sequelize']['import'](_0x68a1('0xe4'));db[_0x68a1('0xe5')]=db[_0x68a1('0x4')]['import'](_0x68a1('0xe6'));db[_0x68a1('0xe7')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0xe8'));db[_0x68a1('0xe9')]=db[_0x68a1('0x4')]['import'](_0x68a1('0xea'));db[_0x68a1('0xeb')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0xec'));db[_0x68a1('0xed')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0xee'));db[_0x68a1('0xef')]=db['sequelize'][_0x68a1('0x14')](_0x68a1('0xf0'));db[_0x68a1('0xf1')]=db[_0x68a1('0x4')][_0x68a1('0x14')]('../api/chatTransferReport/chatTransferReport.model');db[_0x68a1('0xf2')]=db[_0x68a1('0x4')]['import']('../api/faxTransferReport/faxTransferReport.model');db['OpenchannelTransferReport']=db[_0x68a1('0x4')]['import'](_0x68a1('0xf3'));db['SmsTransferReport']=db[_0x68a1('0x4')][_0x68a1('0x14')]('../api/smsTransferReport/smsTransferReport.model');db['CmList']=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0xf4'));db[_0x68a1('0xf5')]=db[_0x68a1('0x4')]['import'](_0x68a1('0xf6'));db[_0x68a1('0xf7')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0xf8'));db['UserProfileSection']=db['sequelize'][_0x68a1('0x14')](_0x68a1('0xf9'));db[_0x68a1('0xfa')]=db['sequelize'][_0x68a1('0x14')](_0x68a1('0xfb'));db[_0x68a1('0xfc')]=db['sequelize'][_0x68a1('0x14')](_0x68a1('0xfd'));db[_0x68a1('0xfe')]=db['sequelize'][_0x68a1('0x14')](_0x68a1('0xff'));db[_0x68a1('0x100')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x101'));db[_0x68a1('0x102')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x103'));db[_0x68a1('0x104')]=db[_0x68a1('0x4')]['import'](_0x68a1('0x105'));db[_0x68a1('0x106')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x107'));db['WhatsappTransferReport']=db[_0x68a1('0x4')]['import'](_0x68a1('0x108'));db[_0x68a1('0x109')]=db[_0x68a1('0x4')][_0x68a1('0x14')]('../api/whatsappQueue/whatsappQueue.model');db[_0x68a1('0x10a')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x10b'));db[_0x68a1('0x10c')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x10d'));db[_0x68a1('0x10e')]=db[_0x68a1('0x4')][_0x68a1('0x14')]('../api/teamVoicePrefix/teamVoicePrefix.model');db[_0x68a1('0x10f')]=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x110'));db['UserSetting']=db[_0x68a1('0x4')][_0x68a1('0x14')](_0x68a1('0x111'));db[_0x68a1('0x112')]=db[_0x68a1('0x4')][_0x68a1('0x14')]('../api/mailInteractionHasTag/mailInteractionHasTag.model');db['User'][_0x68a1('0x113')](db[_0x68a1('0x21')],{'as':_0x68a1('0x21'),'onDelete':_0x68a1('0x114'),'foreignKey':_0x68a1('0x115')});db[_0x68a1('0x13')][_0x68a1('0x113')](db[_0x68a1('0x116')],{'as':_0x68a1('0x117'),'onDelete':_0x68a1('0x114'),'foreignKey':_0x68a1('0x115')});db[_0x68a1('0x13')]['hasMany'](db[_0x68a1('0x118')],{'as':_0x68a1('0x119'),'foreignKey':_0x68a1('0x115')});db[_0x68a1('0x13')][_0x68a1('0x11a')](db[_0x68a1('0x2f')],{'as':_0x68a1('0x11b'),'foreignKey':_0x68a1('0x115')});db[_0x68a1('0x13')][_0x68a1('0x11a')](db[_0x68a1('0x19')],{'as':_0x68a1('0x11c'),'onDelete':_0x68a1('0x114'),'hooks':!![]});db[_0x68a1('0x13')]['hasMany'](db[_0x68a1('0x11d')],{'as':'HopperFinals','foreignKey':'UserId'});db[_0x68a1('0x13')][_0x68a1('0x11a')](db['CmHopperHistory'],{'as':_0x68a1('0x11e'),'foreignKey':_0x68a1('0x115')});db[_0x68a1('0x13')][_0x68a1('0x11a')](db[_0x68a1('0x80')],{'as':_0x68a1('0x80'),'foreignKey':'UserId'});db[_0x68a1('0x13')][_0x68a1('0x11a')](db[_0x68a1('0x63')],{'as':_0x68a1('0x11f'),'foreignKey':_0x68a1('0x115')});db[_0x68a1('0x13')][_0x68a1('0x11a')](db[_0x68a1('0x6d')],{'as':'ChatInteractions','foreignKey':'UserId'});db['User'][_0x68a1('0x11a')](db[_0x68a1('0x59')],{'as':_0x68a1('0x120'),'foreignKey':_0x68a1('0x115')});db['User'][_0x68a1('0x11a')](db[_0x68a1('0x50')],{'as':_0x68a1('0x121'),'foreignKey':_0x68a1('0x115')});db[_0x68a1('0x13')][_0x68a1('0x11a')](db[_0x68a1('0x44')],{'as':_0x68a1('0x122'),'foreignKey':_0x68a1('0x115')});db[_0x68a1('0x13')][_0x68a1('0x11a')](db[_0x68a1('0x102')],{'as':_0x68a1('0x123'),'foreignKey':'UserId'});db[_0x68a1('0x13')][_0x68a1('0x11a')](db[_0x68a1('0xfc')],{'as':'UserNotifications','foreignKey':_0x68a1('0x124')});db[_0x68a1('0x13')]['hasMany'](db[_0x68a1('0x79')],{'as':'Hoppers','foreignKey':'UserId','onDelete':_0x68a1('0x125')});db['User'][_0x68a1('0x126')](db[_0x68a1('0xf7')],{'as':_0x68a1('0xf7'),'foreignKey':'userProfileId'});db[_0x68a1('0x13')][_0x68a1('0x127')](db['ChatGroup'],{'as':'Groups','through':_0x68a1('0x128')});db[_0x68a1('0x13')][_0x68a1('0x127')](db[_0x68a1('0x77')],{'as':'Contacts','through':'cm_user_has_contacts'});db[_0x68a1('0x13')]['belongsToMany'](db[_0x68a1('0x129')],{'as':'Lists','through':'cm_user_has_lists'});db[_0x68a1('0x13')][_0x68a1('0x127')](db[_0x68a1('0xe3')],{'through':_0x68a1('0x12a')});db[_0x68a1('0x13')][_0x68a1('0x127')](db[_0x68a1('0x44')],{'as':_0x68a1('0x122'),'through':'user_has_mail_interactions'});db[_0x68a1('0x13')][_0x68a1('0x127')](db[_0x68a1('0x6d')],{'as':_0x68a1('0x12b'),'through':_0x68a1('0x12c')});db[_0x68a1('0x13')][_0x68a1('0x127')](db[_0x68a1('0x50')],{'as':_0x68a1('0x121'),'through':_0x68a1('0x12d')});db[_0x68a1('0x13')][_0x68a1('0x127')](db[_0x68a1('0x59')],{'as':'SmsInteractions','through':'user_has_sms_interactions'});db[_0x68a1('0x13')][_0x68a1('0x127')](db[_0x68a1('0x63')],{'as':_0x68a1('0x11f'),'through':_0x68a1('0x12e')});db[_0x68a1('0x13')][_0x68a1('0x127')](db[_0x68a1('0x102')],{'as':_0x68a1('0x123'),'through':'user_has_whatsapp_interactions'});db[_0x68a1('0x13')][_0x68a1('0x127')](db[_0x68a1('0x1c')],{'as':_0x68a1('0x12f'),'through':_0x68a1('0x30'),'required':![]});db[_0x68a1('0x13')][_0x68a1('0x127')](db[_0x68a1('0xf5')],{'as':_0x68a1('0x130'),'through':_0x68a1('0x10f'),'required':![]});db['User']['belongsToMany'](db[_0x68a1('0x40')],{'as':_0x68a1('0x131'),'through':_0x68a1('0x34'),'required':![]});db['User']['belongsToMany'](db[_0x68a1('0x132')],{'as':'ChatQueues','through':_0x68a1('0x32'),'required':![],'hooks':!![]});db[_0x68a1('0x13')][_0x68a1('0x127')](db[_0x68a1('0x133')],{'as':_0x68a1('0x134'),'through':_0x68a1('0x36'),'required':![]});db[_0x68a1('0x13')][_0x68a1('0x127')](db[_0x68a1('0x5d')],{'as':_0x68a1('0x135'),'through':_0x68a1('0x38'),'required':![]});db[_0x68a1('0x13')][_0x68a1('0x127')](db[_0x68a1('0x66')],{'as':'OpenchannelQueues','through':_0x68a1('0x136'),'required':![]});db[_0x68a1('0x13')][_0x68a1('0x127')](db['WhatsappQueue'],{'as':_0x68a1('0x137'),'through':_0x68a1('0x3b'),'required':![]});db[_0x68a1('0x13')]['belongsToMany'](db[_0x68a1('0x129')],{'through':_0x68a1('0x138')});db['User']['belongsToMany'](db['ChatWebsite'],{'as':_0x68a1('0x139'),'through':_0x68a1('0x13a')});db[_0x68a1('0x13')]['belongsToMany'](db[_0x68a1('0x4c')],{'as':_0x68a1('0x13b'),'through':_0x68a1('0x13c')});db[_0x68a1('0x13')]['belongsToMany'](db[_0x68a1('0x13d')],{'as':_0x68a1('0x13e'),'through':_0x68a1('0x13f')});db[_0x68a1('0x13')][_0x68a1('0x127')](db['OpenchannelAccount'],{'as':'OpenchannelAccounts','through':'user_has_openchannel_accounts'});db[_0x68a1('0x13')][_0x68a1('0x127')](db[_0x68a1('0x140')],{'as':_0x68a1('0x141'),'through':_0x68a1('0x142')});db[_0x68a1('0x13')][_0x68a1('0x127')](db['WhatsappAccount'],{'as':_0x68a1('0x143'),'through':_0x68a1('0x144')});db['VoiceChanSpy']['hasMany'](db[_0x68a1('0x19')],{'as':_0x68a1('0x145'),'onDelete':_0x68a1('0x114'),'foreignKey':'ChanSpyId'});db['VoiceContext']['hasMany'](db[_0x68a1('0x19')],{'onDelete':_0x68a1('0x114')});db['VoiceExtension'][_0x68a1('0x11a')](db['VoiceExtension'],{'as':'Applications','onDelete':'cascade'});db['VoiceMusicOnHold'][_0x68a1('0x127')](db[_0x68a1('0x8e')],{'as':'Sounds','through':_0x68a1('0x146')});db[_0x68a1('0x1c')][_0x68a1('0x11a')](db[_0x68a1('0x2f')],{'as':_0x68a1('0x147'),'foreignKey':_0x68a1('0x148')});db[_0x68a1('0x1c')][_0x68a1('0x11a')](db['CmHopper'],{'as':_0x68a1('0x149'),'foreignKey':_0x68a1('0x148')});db[_0x68a1('0x1c')][_0x68a1('0x11a')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0x68a1('0x148')});db[_0x68a1('0x1c')][_0x68a1('0x11a')](db[_0x68a1('0x7e')],{'as':_0x68a1('0x14a'),'foreignKey':_0x68a1('0x148')});db[_0x68a1('0x1c')]['hasMany'](db[_0x68a1('0x80')],{'as':'ReportAgentPreview','foreignKey':_0x68a1('0x148')});db[_0x68a1('0x1c')][_0x68a1('0x11a')](db[_0x68a1('0x7b')],{'as':_0x68a1('0x14b'),'foreignKey':_0x68a1('0x148')});db[_0x68a1('0x1c')]['hasMany'](db[_0x68a1('0x14c')],{'as':_0x68a1('0x14d'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x68a1('0x126')](db['Trunk'],{'as':_0x68a1('0x2c'),'foreignKey':_0x68a1('0x14e')});db[_0x68a1('0x1c')]['belongsTo'](db[_0x68a1('0x2c')],{'as':_0x68a1('0x14f'),'foreignKey':_0x68a1('0x150')});db['VoiceQueue'][_0x68a1('0x126')](db[_0x68a1('0x151')],{'as':'Interval','foreignKey':_0x68a1('0x152')});db['VoiceQueue']['belongsTo'](db['Pause'],{'as':_0x68a1('0x153'),'foreignKey':_0x68a1('0x154')});db[_0x68a1('0x1c')][_0x68a1('0x127')](db[_0x68a1('0x129')],{'as':_0x68a1('0x155'),'through':_0x68a1('0x156')});db['VoiceQueue'][_0x68a1('0x127')](db[_0x68a1('0x13')],{'as':_0x68a1('0x157'),'through':_0x68a1('0x30')});db[_0x68a1('0x1c')][_0x68a1('0x127')](db[_0x68a1('0xe3')],{'as':_0x68a1('0x158'),'through':'TeamVoiceQueue'});db[_0x68a1('0x1c')][_0x68a1('0x127')](db['CmList'],{'as':'BlackLists','through':_0x68a1('0x159')});db[_0x68a1('0x118')][_0x68a1('0x126')](db[_0x68a1('0x13')],{'as':_0x68a1('0x13'),'foreignKey':_0x68a1('0x115')});db[_0x68a1('0x1f')][_0x68a1('0x126')](db[_0x68a1('0x13')],{'as':_0x68a1('0x13'),'foreignKey':_0x68a1('0x115')});db[_0x68a1('0x21')]['hasMany'](db[_0x68a1('0x23')],{'as':_0x68a1('0x15a'),'onDelete':'cascade','foreignKey':_0x68a1('0x15b'),'sourceKey':_0x68a1('0x15c')});db[_0x68a1('0x23')][_0x68a1('0x126')](db['VoiceMail'],{'foreignKey':_0x68a1('0x15b'),'targetKey':_0x68a1('0x15c')});db['VoiceCallReport'][_0x68a1('0x11a')](db[_0x68a1('0x2a')],{'as':'QueueCalls','foreignKey':_0x68a1('0x15d'),'constraints':![]});db[_0x68a1('0x25')][_0x68a1('0x11a')](db['VoiceAgentReport'],{'as':'AgentReports','foreignKey':_0x68a1('0x15d'),'constraints':![]});db[_0x68a1('0x25')][_0x68a1('0x126')](db[_0x68a1('0x13')],{'as':_0x68a1('0x13'),'foreignKey':_0x68a1('0x115')});db[_0x68a1('0x25')][_0x68a1('0x126')](db[_0x68a1('0x77')],{'as':'Contact','foreignKey':_0x68a1('0x15e')});db[_0x68a1('0x15f')][_0x68a1('0x126')](db[_0x68a1('0x13d')],{'as':_0x68a1('0x13d'),'foreignKey':_0x68a1('0x160')});db['MailServerIn']['belongsTo'](db[_0x68a1('0x10a')],{'as':'CloudProvider','foreignKey':_0x68a1('0x161'),'onDelete':'restrict'});db[_0x68a1('0x3d')]['belongsTo'](db['MailAccount'],{'as':_0x68a1('0x13d'),'foreignKey':_0x68a1('0x160')});db[_0x68a1('0x3d')][_0x68a1('0x126')](db[_0x68a1('0x10a')],{'as':_0x68a1('0x10a'),'foreignKey':'CloudProviderId','onDelete':'restrict'});db['MailAccount'][_0x68a1('0x113')](db['MailServerIn'],{'as':_0x68a1('0x162'),'onDelete':'cascade'});db[_0x68a1('0x13d')][_0x68a1('0x113')](db['MailServerOut'],{'as':_0x68a1('0x163'),'onDelete':_0x68a1('0x114')});db[_0x68a1('0x13d')][_0x68a1('0x11a')](db[_0x68a1('0x86')],{'as':_0x68a1('0x164'),'foreignKey':_0x68a1('0x160'),'onDelete':_0x68a1('0x114')});db['MailAccount']['hasMany'](db[_0x68a1('0x85')],{'as':_0x68a1('0x165'),'foreignKey':'MailAccountId'});db[_0x68a1('0x13d')][_0x68a1('0x11a')](db[_0x68a1('0x45')],{'as':_0x68a1('0x15a'),'foreignKey':_0x68a1('0x160')});db['MailAccount'][_0x68a1('0x11a')](db[_0x68a1('0x44')],{'as':'Interactions'});db[_0x68a1('0x13d')]['hasMany'](db[_0x68a1('0x47')],{'as':'Applications','foreignKey':_0x68a1('0x160'),'onDelete':_0x68a1('0x114')});db[_0x68a1('0x13d')]['belongsTo'](db[_0x68a1('0x129')],{'as':'List','foreignKey':'ListId'});db[_0x68a1('0x13d')][_0x68a1('0x126')](db[_0x68a1('0x97')],{'as':_0x68a1('0x97'),'foreignKey':_0x68a1('0x166')});db[_0x68a1('0x13d')][_0x68a1('0x126')](db['Pause'],{'as':_0x68a1('0x153'),'foreignKey':_0x68a1('0x154')});db[_0x68a1('0x13d')][_0x68a1('0x127')](db[_0x68a1('0x13')],{'as':_0x68a1('0x157'),'through':_0x68a1('0x13f')});db[_0x68a1('0x40')][_0x68a1('0x127')](db[_0x68a1('0x13')],{'as':_0x68a1('0x157'),'through':_0x68a1('0x34')});db[_0x68a1('0x40')]['belongsToMany'](db[_0x68a1('0xe3')],{'through':_0x68a1('0x167'),'as':_0x68a1('0x158')});db[_0x68a1('0x44')][_0x68a1('0x11a')](db[_0x68a1('0x45')],{'as':_0x68a1('0x15a'),'onDelete':_0x68a1('0x114'),'foreignKey':'MailInteractionId'});db[_0x68a1('0x44')][_0x68a1('0x126')](db[_0x68a1('0x13d')],{'as':_0x68a1('0x168'),'foreignKey':_0x68a1('0x160')});db[_0x68a1('0x44')][_0x68a1('0x126')](db['CmContact'],{'as':_0x68a1('0x169'),'foreignKey':'ContactId'});db['MailInteraction']['belongsTo'](db['User'],{'as':_0x68a1('0x16a'),'foreignKey':'UserId'});db['MailInteraction']['belongsToMany'](db['Tag'],{'through':'mail_interaction_has_tags','as':_0x68a1('0x16b')});db[_0x68a1('0x44')][_0x68a1('0x127')](db[_0x68a1('0x90')],{'through':_0x68a1('0x16c'),'as':'ThroughTags'});db[_0x68a1('0x44')]['belongsToMany'](db[_0x68a1('0x13')],{'as':_0x68a1('0x16d'),'through':'user_has_mail_interactions','foreignKey':'MailInteractionId'});db[_0x68a1('0x45')][_0x68a1('0x11a')](db['Attachment'],{'as':_0x68a1('0x16e'),'onDelete':_0x68a1('0x114')});db[_0x68a1('0x45')][_0x68a1('0x126')](db[_0x68a1('0x13')],{'as':_0x68a1('0x13')});db[_0x68a1('0x45')]['belongsTo'](db[_0x68a1('0x77')],{'onDelete':_0x68a1('0x114'),'as':'Contact'});db[_0x68a1('0x45')][_0x68a1('0x126')](db['MailInteraction'],{'as':_0x68a1('0x16f'),'foreignKey':'MailInteractionId'});db[_0x68a1('0x45')]['belongsTo'](db['MailAccount'],{'as':_0x68a1('0x168'),'foreignKey':_0x68a1('0x160')});db['MailMessage'][_0x68a1('0x126')](db[_0x68a1('0x68')],{'as':'ChatWebsite','foreignKey':_0x68a1('0x170')});db[_0x68a1('0x45')][_0x68a1('0x126')](db[_0x68a1('0x70')],{'as':_0x68a1('0x70'),'foreignKey':_0x68a1('0x171')});db[_0x68a1('0x47')]['belongsTo'](db[_0x68a1('0x13')],{'onDelete':_0x68a1('0x172')});db[_0x68a1('0x47')][_0x68a1('0x126')](db[_0x68a1('0x40')],{'onDelete':_0x68a1('0x172')});db[_0x68a1('0x47')][_0x68a1('0x126')](db[_0x68a1('0x13d')],{'onDelete':_0x68a1('0x172')});db[_0x68a1('0x47')]['belongsTo'](db[_0x68a1('0x151')],{'onDelete':_0x68a1('0x172'),'foreignKey':_0x68a1('0x152')});db['MailApplication'][_0x68a1('0x126')](db['Tag'],{'onDelete':_0x68a1('0x172'),'foreignKey':_0x68a1('0x173')});db[_0x68a1('0x174')][_0x68a1('0x126')](db['MailAccount'],{});db[_0x68a1('0x174')][_0x68a1('0x126')](db[_0x68a1('0x129')],{'as':'List','foreignKey':'ListId'});db[_0x68a1('0x174')][_0x68a1('0x126')](db[_0x68a1('0x77')],{'as':_0x68a1('0x169'),'foreignKey':_0x68a1('0x15e')});db['MailQueueReport'][_0x68a1('0x126')](db['MailInteraction'],{});db['MailQueueReport'][_0x68a1('0x126')](db[_0x68a1('0x45')],{});db[_0x68a1('0x174')][_0x68a1('0x126')](db[_0x68a1('0x13')],{});db[_0x68a1('0x174')][_0x68a1('0x126')](db[_0x68a1('0x40')],{});db[_0x68a1('0x49')][_0x68a1('0x11a')](db['DashboardItem'],{'as':_0x68a1('0x175'),'onDelete':_0x68a1('0x114')});db[_0x68a1('0x4c')]['hasMany'](db[_0x68a1('0x86')],{'as':_0x68a1('0x164'),'foreignKey':_0x68a1('0x176'),'onDelete':_0x68a1('0x114')});db['FaxAccount'][_0x68a1('0x11a')](db[_0x68a1('0x85')],{'as':_0x68a1('0x165'),'foreignKey':'FaxAccountId'});db[_0x68a1('0x4c')][_0x68a1('0x11a')](db[_0x68a1('0x50')],{'as':_0x68a1('0x177')});db['FaxAccount'][_0x68a1('0x11a')](db[_0x68a1('0x4e')],{'as':_0x68a1('0x178'),'foreignKey':'FaxAccountId','onDelete':'cascade'});db[_0x68a1('0x4c')][_0x68a1('0x11a')](db[_0x68a1('0x19')],{'as':_0x68a1('0x179'),'onDelete':_0x68a1('0x114')});db['FaxAccount'][_0x68a1('0x11a')](db[_0x68a1('0x52')],{'as':_0x68a1('0x15a')});db[_0x68a1('0x4c')][_0x68a1('0x126')](db['Trunk'],{'as':_0x68a1('0x2c')});db[_0x68a1('0x4c')][_0x68a1('0x126')](db[_0x68a1('0x129')],{'as':_0x68a1('0x17a'),'foreignKey':'ListId'});db[_0x68a1('0x4c')][_0x68a1('0x126')](db[_0x68a1('0x17b')],{'as':'mandatoryDispositionPause','foreignKey':_0x68a1('0x154')});db['FaxAccount'][_0x68a1('0x127')](db[_0x68a1('0x13')],{'as':_0x68a1('0x157'),'through':_0x68a1('0x13c')});db[_0x68a1('0x4e')][_0x68a1('0x126')](db[_0x68a1('0x13')],{'onDelete':_0x68a1('0x172')});db[_0x68a1('0x4e')]['belongsTo'](db[_0x68a1('0x133')],{'onDelete':_0x68a1('0x172')});db[_0x68a1('0x4e')]['belongsTo'](db[_0x68a1('0x4c')],{'onDelete':_0x68a1('0x172')});db[_0x68a1('0x4e')][_0x68a1('0x126')](db[_0x68a1('0x90')],{'onDelete':'restrict','foreignKey':_0x68a1('0x173')});db[_0x68a1('0x50')]['hasMany'](db[_0x68a1('0x52')],{'as':_0x68a1('0x15a'),'onDelete':_0x68a1('0x114'),'foreignKey':_0x68a1('0x17c')});db[_0x68a1('0x50')]['belongsTo'](db[_0x68a1('0x4c')],{'as':_0x68a1('0x168'),'foreignKey':'FaxAccountId'});db[_0x68a1('0x50')][_0x68a1('0x126')](db[_0x68a1('0x77')],{'as':_0x68a1('0x169'),'foreignKey':'ContactId'});db[_0x68a1('0x50')]['belongsTo'](db['User'],{'as':_0x68a1('0x16a'),'foreignKey':_0x68a1('0x115')});db[_0x68a1('0x50')][_0x68a1('0x127')](db[_0x68a1('0x90')],{'through':'fax_interaction_has_tags','as':_0x68a1('0x16b')});db[_0x68a1('0x50')][_0x68a1('0x127')](db[_0x68a1('0x90')],{'through':_0x68a1('0x17d'),'as':_0x68a1('0x17e')});db[_0x68a1('0x50')][_0x68a1('0x127')](db[_0x68a1('0x13')],{'as':_0x68a1('0x16d'),'through':_0x68a1('0x12d'),'foreignKey':'FaxInteractionId'});db[_0x68a1('0x52')][_0x68a1('0x126')](db[_0x68a1('0x13')],{'onDelete':_0x68a1('0x114'),'as':_0x68a1('0x13')});db[_0x68a1('0x52')]['belongsTo'](db['FaxInteraction'],{'as':_0x68a1('0x16f'),'foreignKey':'FaxInteractionId'});db[_0x68a1('0x52')][_0x68a1('0x126')](db[_0x68a1('0x77')],{'onDelete':'cascade','as':_0x68a1('0x169')});db['FaxMessage']['belongsTo'](db['Attachment'],{'as':'Attachment','foreignKey':_0x68a1('0x17f')});db[_0x68a1('0x52')]['belongsTo'](db[_0x68a1('0x4c')],{'as':_0x68a1('0x168'),'foreignKey':_0x68a1('0x176')});db[_0x68a1('0x133')][_0x68a1('0x127')](db['User'],{'as':_0x68a1('0x157'),'through':'UserFaxQueue'});db[_0x68a1('0x133')]['belongsToMany'](db[_0x68a1('0xe3')],{'through':'team_has_fax_queues','as':_0x68a1('0x158')});db[_0x68a1('0x55')]['belongsTo'](db[_0x68a1('0x4c')],{});db[_0x68a1('0x55')][_0x68a1('0x126')](db[_0x68a1('0x129')],{'as':_0x68a1('0x17a'),'foreignKey':_0x68a1('0x180')});db['FaxQueueReport'][_0x68a1('0x126')](db[_0x68a1('0x77')],{'as':_0x68a1('0x169'),'foreignKey':'ContactId'});db['FaxQueueReport'][_0x68a1('0x126')](db[_0x68a1('0x50')],{});db['FaxQueueReport'][_0x68a1('0x126')](db['FaxMessage'],{});db['FaxQueueReport'][_0x68a1('0x126')](db[_0x68a1('0x13')],{});db[_0x68a1('0x55')][_0x68a1('0x126')](db['FaxQueue'],{});db['SmsAccount'][_0x68a1('0x11a')](db[_0x68a1('0x86')],{'as':_0x68a1('0x164'),'foreignKey':'SmsAccountId','onDelete':_0x68a1('0x114')});db[_0x68a1('0x140')][_0x68a1('0x11a')](db[_0x68a1('0x85')],{'as':_0x68a1('0x165'),'foreignKey':'SmsAccountId'});db[_0x68a1('0x140')][_0x68a1('0x11a')](db[_0x68a1('0x5b')],{'as':_0x68a1('0x15a'),'foreignKey':_0x68a1('0x181')});db[_0x68a1('0x140')]['hasMany'](db[_0x68a1('0x59')],{'as':_0x68a1('0x177')});db[_0x68a1('0x140')][_0x68a1('0x11a')](db[_0x68a1('0x57')],{'as':_0x68a1('0x178'),'foreignKey':'SmsAccountId','onDelete':_0x68a1('0x114')});db['SmsAccount'][_0x68a1('0x126')](db['CmList'],{'as':_0x68a1('0x17a'),'foreignKey':'ListId'});db[_0x68a1('0x140')][_0x68a1('0x126')](db[_0x68a1('0x17b')],{'as':_0x68a1('0x153'),'foreignKey':_0x68a1('0x154')});db[_0x68a1('0x140')][_0x68a1('0x127')](db[_0x68a1('0x13')],{'as':_0x68a1('0x157'),'through':_0x68a1('0x142')});db[_0x68a1('0x57')][_0x68a1('0x126')](db[_0x68a1('0x13')],{'onDelete':_0x68a1('0x172')});db[_0x68a1('0x57')]['belongsTo'](db[_0x68a1('0x5d')],{'onDelete':_0x68a1('0x172')});db[_0x68a1('0x57')][_0x68a1('0x126')](db[_0x68a1('0x140')],{'onDelete':_0x68a1('0x172')});db['SmsApplication']['belongsTo'](db[_0x68a1('0x151')],{'onDelete':_0x68a1('0x172'),'foreignKey':_0x68a1('0x152')});db[_0x68a1('0x57')][_0x68a1('0x126')](db[_0x68a1('0x90')],{'onDelete':'restrict','foreignKey':_0x68a1('0x173')});db[_0x68a1('0x59')]['hasMany'](db[_0x68a1('0x5b')],{'as':'Messages','onDelete':_0x68a1('0x114'),'foreignKey':_0x68a1('0x182')});db[_0x68a1('0x59')]['belongsTo'](db[_0x68a1('0x140')],{'as':_0x68a1('0x168'),'foreignKey':_0x68a1('0x181')});db[_0x68a1('0x59')][_0x68a1('0x126')](db[_0x68a1('0x77')],{'as':_0x68a1('0x169'),'foreignKey':_0x68a1('0x15e')});db[_0x68a1('0x59')][_0x68a1('0x126')](db[_0x68a1('0x13')],{'as':_0x68a1('0x16a'),'foreignKey':_0x68a1('0x115')});db['SmsInteraction']['belongsToMany'](db[_0x68a1('0x90')],{'through':_0x68a1('0x183'),'as':_0x68a1('0x16b')});db[_0x68a1('0x59')][_0x68a1('0x127')](db['Tag'],{'through':_0x68a1('0x183'),'as':_0x68a1('0x17e')});db[_0x68a1('0x59')][_0x68a1('0x127')](db['User'],{'as':_0x68a1('0x16d'),'through':_0x68a1('0x184'),'foreignKey':_0x68a1('0x182')});db['SmsMessage'][_0x68a1('0x126')](db['User'],{'as':'User'});db[_0x68a1('0x5b')][_0x68a1('0x126')](db[_0x68a1('0x77')],{'onDelete':_0x68a1('0x114'),'as':_0x68a1('0x169')});db['SmsMessage'][_0x68a1('0x126')](db[_0x68a1('0x59')],{'onDelete':_0x68a1('0x114'),'as':_0x68a1('0x16f'),'foreignKey':'SmsInteractionId'});db[_0x68a1('0x5b')][_0x68a1('0x126')](db[_0x68a1('0x140')],{'as':_0x68a1('0x168'),'foreignKey':_0x68a1('0x181')});db[_0x68a1('0x5d')][_0x68a1('0x127')](db[_0x68a1('0x13')],{'as':_0x68a1('0x157'),'through':_0x68a1('0x38'),'foreignKey':_0x68a1('0x185')});db[_0x68a1('0x5d')][_0x68a1('0x127')](db['Team'],{'through':'team_has_sms_queues','as':'Teams'});db[_0x68a1('0x5f')][_0x68a1('0x11a')](db[_0x68a1('0x86')],{'as':_0x68a1('0x164'),'foreignKey':'OpenchannelAccountId','onDelete':_0x68a1('0x114')});db[_0x68a1('0x5f')]['hasMany'](db[_0x68a1('0x85')],{'as':'Answers','foreignKey':_0x68a1('0x186')});db[_0x68a1('0x5f')]['hasMany'](db[_0x68a1('0x63')],{'as':_0x68a1('0x177'),'foreignKey':_0x68a1('0x186')});db[_0x68a1('0x5f')][_0x68a1('0x11a')](db[_0x68a1('0x65')],{'as':'Messages','foreignKey':'OpenchannelAccountId'});db[_0x68a1('0x5f')][_0x68a1('0x11a')](db['OpenchannelApplication'],{'as':_0x68a1('0x178'),'foreignKey':'OpenchannelAccountId','onDelete':_0x68a1('0x114')});db['OpenchannelAccount'][_0x68a1('0x126')](db[_0x68a1('0x129')],{'as':_0x68a1('0x17a'),'foreignKey':_0x68a1('0x180')});db[_0x68a1('0x5f')][_0x68a1('0x126')](db[_0x68a1('0x17b')],{'as':'mandatoryDispositionPause','foreignKey':_0x68a1('0x154')});db[_0x68a1('0x5f')][_0x68a1('0x127')](db[_0x68a1('0x13')],{'as':'Agents','through':'user_has_openchannel_accounts'});db[_0x68a1('0x61')][_0x68a1('0x126')](db[_0x68a1('0x13')],{'onDelete':'restrict'});db[_0x68a1('0x61')][_0x68a1('0x126')](db[_0x68a1('0x66')],{'onDelete':_0x68a1('0x172'),'foreignKey':_0x68a1('0x187')});db[_0x68a1('0x61')][_0x68a1('0x126')](db[_0x68a1('0x5f')],{'onDelete':_0x68a1('0x172'),'foreignKey':_0x68a1('0x186')});db['OpenchannelApplication'][_0x68a1('0x126')](db[_0x68a1('0x151')],{'onDelete':_0x68a1('0x172'),'foreignKey':_0x68a1('0x152')});db[_0x68a1('0x61')][_0x68a1('0x126')](db[_0x68a1('0x90')],{'onDelete':_0x68a1('0x172'),'foreignKey':'TagId'});db[_0x68a1('0x63')][_0x68a1('0x11a')](db[_0x68a1('0x65')],{'as':_0x68a1('0x15a'),'onDelete':_0x68a1('0x114'),'foreignKey':'OpenchannelInteractionId'});db['OpenchannelInteraction'][_0x68a1('0x126')](db['OpenchannelAccount'],{'as':_0x68a1('0x168'),'foreignKey':'OpenchannelAccountId'});db[_0x68a1('0x63')][_0x68a1('0x126')](db[_0x68a1('0x77')],{'as':_0x68a1('0x169'),'foreignKey':_0x68a1('0x15e')});db[_0x68a1('0x63')][_0x68a1('0x126')](db[_0x68a1('0x13')],{'as':_0x68a1('0x16a'),'foreignKey':_0x68a1('0x115')});db[_0x68a1('0x63')][_0x68a1('0x127')](db[_0x68a1('0x90')],{'through':_0x68a1('0x188'),'as':'Tags'});db[_0x68a1('0x63')][_0x68a1('0x127')](db[_0x68a1('0x90')],{'through':_0x68a1('0x188'),'as':'ThroughTags'});db['OpenchannelInteraction'][_0x68a1('0x127')](db[_0x68a1('0x13')],{'as':_0x68a1('0x16d'),'through':_0x68a1('0x12e'),'foreignKey':'OpenchannelInteractionId'});db['OpenchannelMessage'][_0x68a1('0x126')](db[_0x68a1('0x13')],{'onDelete':'cascade','as':'User'});db[_0x68a1('0x65')][_0x68a1('0x126')](db[_0x68a1('0x77')],{'onDelete':_0x68a1('0x114'),'as':_0x68a1('0x169')});db[_0x68a1('0x65')][_0x68a1('0x126')](db[_0x68a1('0x63')],{'onDelete':_0x68a1('0x114'),'as':_0x68a1('0x16f'),'foreignKey':_0x68a1('0x189')});db[_0x68a1('0x65')]['belongsTo'](db[_0x68a1('0xeb')],{'as':'Attachment','foreignKey':_0x68a1('0x17f')});db[_0x68a1('0x65')][_0x68a1('0x126')](db[_0x68a1('0x5f')],{'as':_0x68a1('0x168'),'foreignKey':'OpenchannelAccountId'});db[_0x68a1('0x66')][_0x68a1('0x127')](db[_0x68a1('0x13')],{'as':_0x68a1('0x157'),'through':_0x68a1('0x136'),'foreignKey':_0x68a1('0x187')});db[_0x68a1('0x66')][_0x68a1('0x127')](db[_0x68a1('0xe3')],{'through':'team_has_openchannel_queues','as':_0x68a1('0x158')});db[_0x68a1('0x68')][_0x68a1('0x11a')](db[_0x68a1('0x86')],{'as':_0x68a1('0x164'),'foreignKey':_0x68a1('0x170'),'onDelete':'cascade'});db[_0x68a1('0x68')][_0x68a1('0x11a')](db[_0x68a1('0x85')],{'as':_0x68a1('0x165'),'foreignKey':'ChatWebsiteId'});db[_0x68a1('0x68')]['hasMany'](db[_0x68a1('0x74')],{'as':'ProactiveActions'});db[_0x68a1('0x68')][_0x68a1('0x11a')](db[_0x68a1('0x6d')],{'as':_0x68a1('0x177')});db[_0x68a1('0x68')]['hasMany'](db[_0x68a1('0x6b')],{'as':_0x68a1('0x178'),'foreignKey':_0x68a1('0x170'),'onDelete':_0x68a1('0x114')});db['ChatWebsite'][_0x68a1('0x11a')](db['ChatMessage'],{'as':_0x68a1('0x15a')});db[_0x68a1('0x68')]['belongsTo'](db[_0x68a1('0x129')],{'as':_0x68a1('0x17a'),'foreignKey':_0x68a1('0x180')});db['ChatWebsite'][_0x68a1('0x126')](db[_0x68a1('0x151')],{'as':'Interval','foreignKey':'IntervalId'});db[_0x68a1('0x68')][_0x68a1('0x126')](db['MailAccount'],{'as':_0x68a1('0x13d'),'foreignKey':_0x68a1('0x160')});db['ChatWebsite'][_0x68a1('0x126')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x68a1('0x68')][_0x68a1('0x127')](db[_0x68a1('0x13')],{'as':_0x68a1('0x157'),'through':_0x68a1('0x13a')});db[_0x68a1('0x69')][_0x68a1('0x126')](db[_0x68a1('0x5f')],{});db[_0x68a1('0x69')][_0x68a1('0x126')](db[_0x68a1('0x129')],{'as':_0x68a1('0x17a'),'foreignKey':_0x68a1('0x180')});db['OpenchannelQueueReport']['belongsTo'](db[_0x68a1('0x77')],{'as':'Contact','foreignKey':_0x68a1('0x15e')});db['OpenchannelQueueReport'][_0x68a1('0x126')](db[_0x68a1('0x63')],{});db[_0x68a1('0x69')][_0x68a1('0x126')](db[_0x68a1('0x65')],{});db[_0x68a1('0x69')][_0x68a1('0x126')](db[_0x68a1('0x13')],{});db[_0x68a1('0x69')]['belongsTo'](db[_0x68a1('0x66')],{});db[_0x68a1('0x6b')]['belongsTo'](db[_0x68a1('0x13')],{'as':'Agent','foreignKey':_0x68a1('0x115'),'onDelete':_0x68a1('0x172')});db['ChatApplication'][_0x68a1('0x126')](db['ChatQueue'],{'as':_0x68a1('0x18a'),'foreignKey':_0x68a1('0x18b'),'onDelete':_0x68a1('0x172')});db[_0x68a1('0x6b')][_0x68a1('0x126')](db[_0x68a1('0x68')],{'as':_0x68a1('0x18c'),'foreignKey':_0x68a1('0x170'),'onDelete':_0x68a1('0x172')});db['ChatApplication'][_0x68a1('0x126')](db[_0x68a1('0x90')],{'onDelete':'restrict','foreignKey':_0x68a1('0x173')});db[_0x68a1('0x6d')][_0x68a1('0x11a')](db[_0x68a1('0x6f')],{'as':_0x68a1('0x15a'),'onDelete':_0x68a1('0x114'),'foreignKey':_0x68a1('0x18d')});db[_0x68a1('0x6d')][_0x68a1('0x126')](db[_0x68a1('0x68')],{'as':_0x68a1('0x168'),'foreignKey':_0x68a1('0x170')});db[_0x68a1('0x6d')][_0x68a1('0x126')](db[_0x68a1('0x77')],{'as':_0x68a1('0x169'),'foreignKey':_0x68a1('0x15e')});db[_0x68a1('0x6d')]['belongsTo'](db[_0x68a1('0x13')],{'as':_0x68a1('0x16a'),'foreignKey':_0x68a1('0x115')});db[_0x68a1('0x6d')]['belongsToMany'](db[_0x68a1('0x90')],{'through':'chat_interaction_has_tags','as':_0x68a1('0x16b')});db['ChatInteraction']['belongsToMany'](db[_0x68a1('0x90')],{'through':_0x68a1('0x18e'),'as':'ThroughTags'});db[_0x68a1('0x6d')][_0x68a1('0x127')](db[_0x68a1('0x13')],{'as':'Users','through':_0x68a1('0x12c'),'foreignKey':_0x68a1('0x18d')});db[_0x68a1('0x6f')][_0x68a1('0x126')](db[_0x68a1('0x13')],{'onDelete':_0x68a1('0x114'),'as':'User'});db[_0x68a1('0x6f')]['belongsTo'](db[_0x68a1('0x77')],{'onDelete':_0x68a1('0x114'),'as':'Contact','foreignKey':_0x68a1('0x15e')});db[_0x68a1('0x6f')][_0x68a1('0x126')](db[_0x68a1('0x6d')],{'onDelete':_0x68a1('0x114'),'as':_0x68a1('0x16f'),'foreignKey':_0x68a1('0x18d')});db['ChatMessage'][_0x68a1('0x126')](db[_0x68a1('0xeb')],{'as':_0x68a1('0xeb'),'foreignKey':_0x68a1('0x17f')});db[_0x68a1('0x6f')]['belongsTo'](db[_0x68a1('0x68')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x68a1('0x70')][_0x68a1('0x11a')](db[_0x68a1('0xeb')],{'as':'Attachments','foreignKey':_0x68a1('0x171'),'onDelete':_0x68a1('0x114'),'hooks':!![]});db[_0x68a1('0x70')][_0x68a1('0x126')](db[_0x68a1('0x77')],{'onDelete':_0x68a1('0x114'),'as':_0x68a1('0x169'),'foreignKey':_0x68a1('0x15e')});db[_0x68a1('0x70')][_0x68a1('0x126')](db[_0x68a1('0x68')],{'as':_0x68a1('0x168'),'foreignKey':_0x68a1('0x170')});db[_0x68a1('0x132')][_0x68a1('0x127')](db[_0x68a1('0x13')],{'as':_0x68a1('0x157'),'through':_0x68a1('0x32'),'hooks':!![]});db['ChatQueue'][_0x68a1('0x127')](db[_0x68a1('0xe3')],{'through':_0x68a1('0x18f'),'as':'Teams'});db['ChatGroup']['hasMany'](db[_0x68a1('0x190')],{'as':'Messages','foreignKey':_0x68a1('0x191'),'onDelete':_0x68a1('0x114')});db[_0x68a1('0x72')]['belongsToMany'](db[_0x68a1('0x13')],{'as':'Members','through':_0x68a1('0x128')});db[_0x68a1('0x74')][_0x68a1('0x126')](db[_0x68a1('0x68')],{'as':_0x68a1('0x18c'),'foreignKey':'ChatWebsiteId'});db[_0x68a1('0x192')][_0x68a1('0x11a')](db[_0x68a1('0x77')],{'as':_0x68a1('0x193'),'foreignKey':'CompanyId'});db[_0x68a1('0x77')]['hasMany'](db[_0x68a1('0x94')],{'as':_0x68a1('0x194'),'foreignKey':'CmContactId'});db[_0x68a1('0x77')][_0x68a1('0x11a')](db[_0x68a1('0x79')],{'as':_0x68a1('0x149'),'foreignKey':_0x68a1('0x15e')});db['CmContact']['hasMany'](db[_0x68a1('0x11d')],{'as':_0x68a1('0x195'),'foreignKey':_0x68a1('0x15e')});db[_0x68a1('0x77')][_0x68a1('0x11a')](db['CmHopperHistory'],{'as':_0x68a1('0x14a'),'foreignKey':_0x68a1('0x15e')});db[_0x68a1('0x77')][_0x68a1('0x11a')](db['ReportAgentPreview'],{'as':_0x68a1('0x80'),'foreignKey':_0x68a1('0x15e')});db['CmContact'][_0x68a1('0x11a')](db[_0x68a1('0x14c')],{'as':'JscriptySessions','foreignKey':_0x68a1('0x15e')});db[_0x68a1('0x77')][_0x68a1('0x11a')](db['OpenchannelInteraction'],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':'restrict'});db[_0x68a1('0x77')][_0x68a1('0x11a')](db[_0x68a1('0x6d')],{'as':'ChatInteractions','foreignKey':_0x68a1('0x15e'),'onDelete':_0x68a1('0x172')});db[_0x68a1('0x77')][_0x68a1('0x11a')](db[_0x68a1('0x59')],{'as':_0x68a1('0x120'),'foreignKey':_0x68a1('0x15e'),'onDelete':_0x68a1('0x172')});db[_0x68a1('0x77')][_0x68a1('0x11a')](db[_0x68a1('0x50')],{'as':_0x68a1('0x121'),'foreignKey':_0x68a1('0x15e'),'onDelete':_0x68a1('0x172')});db[_0x68a1('0x77')]['hasMany'](db[_0x68a1('0x44')],{'as':_0x68a1('0x122'),'foreignKey':_0x68a1('0x15e'),'onDelete':_0x68a1('0x172')});db[_0x68a1('0x77')]['belongsTo'](db[_0x68a1('0x192')],{'as':_0x68a1('0x196'),'foreignKey':'CompanyId'});db['CmContact'][_0x68a1('0x126')](db[_0x68a1('0x129')],{'as':_0x68a1('0x17a'),'foreignKey':'ListId','onDelete':_0x68a1('0x114')});db['CmContact'][_0x68a1('0x127')](db[_0x68a1('0x13')],{'as':_0x68a1('0x16d'),'through':_0x68a1('0x197')});db['CmContact'][_0x68a1('0x127')](db[_0x68a1('0x90')],{'as':'Tags','through':_0x68a1('0x198')});db[_0x68a1('0x77')][_0x68a1('0x127')](db[_0x68a1('0x90')],{'through':_0x68a1('0x198'),'as':_0x68a1('0x17e')});db[_0x68a1('0x79')][_0x68a1('0x11a')](db['CmHopperAdditionalPhone'],{'as':'AdditionalPhones','foreignKey':_0x68a1('0x199')});db[_0x68a1('0x79')][_0x68a1('0x126')](db[_0x68a1('0x77')],{'as':_0x68a1('0x169'),'foreignKey':'ContactId','onDelete':_0x68a1('0x114')});db[_0x68a1('0x79')][_0x68a1('0x126')](db[_0x68a1('0x129')],{'as':_0x68a1('0x17a'),'foreignKey':_0x68a1('0x180'),'onDelete':_0x68a1('0x114')});db[_0x68a1('0x79')][_0x68a1('0x126')](db['User'],{'as':_0x68a1('0x19a'),'foreignKey':'UserId'});db[_0x68a1('0x79')][_0x68a1('0x126')](db['VoiceQueue'],{'as':_0x68a1('0x18a'),'foreignKey':_0x68a1('0x148'),'onDelete':_0x68a1('0x114')});db['CmHopper']['belongsTo'](db[_0x68a1('0xe7')],{'as':_0x68a1('0xe7'),'foreignKey':_0x68a1('0x19b'),'onDelete':_0x68a1('0x114')});db[_0x68a1('0x79')]['belongsTo'](db['User'],{'as':_0x68a1('0x16a'),'foreignKey':_0x68a1('0x19c')});db[_0x68a1('0x7b')][_0x68a1('0x126')](db[_0x68a1('0x77')],{'as':'Contact','foreignKey':_0x68a1('0x15e'),'onDelete':_0x68a1('0x114')});db[_0x68a1('0x7b')]['belongsTo'](db[_0x68a1('0x129')],{'as':_0x68a1('0x17a'),'foreignKey':'ListId','onDelete':_0x68a1('0x114')});db[_0x68a1('0x7b')][_0x68a1('0x126')](db[_0x68a1('0x1c')],{'as':_0x68a1('0x18a'),'foreignKey':_0x68a1('0x148'),'onDelete':'cascade'});db[_0x68a1('0x7b')][_0x68a1('0x126')](db['Campaign'],{'as':_0x68a1('0xe7'),'foreignKey':_0x68a1('0x19b'),'onDelete':_0x68a1('0x114')});db[_0x68a1('0x84')]['hasMany'](db[_0x68a1('0x19d')],{'as':{'plural':'All','singular':_0x68a1('0x19e')},'foreignKey':_0x68a1('0x19f'),'onDelete':_0x68a1('0x114'),'hooks':!![]});db[_0x68a1('0x84')][_0x68a1('0x11a')](db['Condition'],{'as':{'plural':_0x68a1('0x1a0'),'singular':_0x68a1('0x1a1')},'foreignKey':_0x68a1('0x1a2'),'onDelete':_0x68a1('0x114'),'hooks':!![]});db[_0x68a1('0x84')][_0x68a1('0x11a')](db[_0x68a1('0x82')],{'as':'Actions','foreignKey':_0x68a1('0x1a3'),'onDelete':_0x68a1('0x114'),'hooks':!![]});db['Disposition'][_0x68a1('0x11a')](db[_0x68a1('0x86')],{'as':_0x68a1('0x164'),'foreignKey':_0x68a1('0x1a4'),'onDelete':_0x68a1('0x114')});db[_0x68a1('0x151')]['hasMany'](db[_0x68a1('0x151')],{'as':_0x68a1('0x1a5'),'foreignKey':'IntervalId','onDelete':'cascade','hooks':!![],'required':![]});db['Interval'][_0x68a1('0x11a')](db['VoiceExtension'],{'as':_0x68a1('0x11c'),'foreignKey':_0x68a1('0x152'),'onDelete':_0x68a1('0x172')});db[_0x68a1('0x151')][_0x68a1('0x11a')](db[_0x68a1('0x47')],{'as':_0x68a1('0x1a6'),'foreignKey':_0x68a1('0x152')});db[_0x68a1('0x151')]['hasMany'](db['ChatApplication'],{'as':_0x68a1('0x1a7'),'foreignKey':_0x68a1('0x152')});db['Interval']['hasMany'](db[_0x68a1('0x4e')],{'as':_0x68a1('0x1a8'),'foreignKey':_0x68a1('0x152')});db[_0x68a1('0x151')][_0x68a1('0x11a')](db['SmsApplication'],{'as':_0x68a1('0x1a9'),'foreignKey':_0x68a1('0x152')});db[_0x68a1('0x8c')][_0x68a1('0x126')](db[_0x68a1('0x13d')],{});db[_0x68a1('0x8c')][_0x68a1('0x126')](db['AnalyticDefaultReport'],{'foreignKey':_0x68a1('0x1aa')});db[_0x68a1('0x8c')]['belongsTo'](db[_0x68a1('0x9b')],{'foreignKey':_0x68a1('0x1ab')});db[_0x68a1('0x8e')][_0x68a1('0x127')](db[_0x68a1('0x1ac')],{'as':_0x68a1('0x1ad'),'through':_0x68a1('0x146'),'onDelete':_0x68a1('0x172')});db[_0x68a1('0x90')][_0x68a1('0x127')](db[_0x68a1('0x77')],{'through':_0x68a1('0x198')});db[_0x68a1('0x90')][_0x68a1('0x127')](db[_0x68a1('0x6d')],{'through':_0x68a1('0x18e')});db['Tag'][_0x68a1('0x127')](db[_0x68a1('0x44')],{'through':_0x68a1('0x16c')});db[_0x68a1('0x90')][_0x68a1('0x127')](db[_0x68a1('0x59')],{'through':_0x68a1('0x183')});db['Tag'][_0x68a1('0x127')](db[_0x68a1('0x50')],{'through':_0x68a1('0x17d')});db['Tag'][_0x68a1('0x127')](db['OpenchannelInteraction'],{'through':'openchannel_interaction_has_tags'});db[_0x68a1('0x90')]['belongsToMany'](db[_0x68a1('0x102')],{'through':_0x68a1('0x1ae')});db['CmContactHasItem'][_0x68a1('0x126')](db[_0x68a1('0x92')],{'as':_0x68a1('0x1af'),'foreignKey':_0x68a1('0x1b0')});db[_0x68a1('0x1b1')]['belongsTo'](db[_0x68a1('0x79')],{'as':_0x68a1('0x1b2'),'foreignKey':_0x68a1('0x199')});db[_0x68a1('0x94')]['belongsTo'](db[_0x68a1('0x77')],{'as':_0x68a1('0x169'),'foreignKey':_0x68a1('0x1b3')});db['Trigger'][_0x68a1('0x11a')](db[_0x68a1('0x19d')],{'as':{'plural':_0x68a1('0x1b4'),'singular':_0x68a1('0x1b5')},'foreignKey':_0x68a1('0x1b6'),'onDelete':_0x68a1('0x114'),'hooks':!![]});db['Trigger']['hasMany'](db[_0x68a1('0x19d')],{'as':{'plural':_0x68a1('0x1b7'),'singular':_0x68a1('0x1b8')},'foreignKey':_0x68a1('0x1b9'),'onDelete':_0x68a1('0x114'),'hooks':!![]});db[_0x68a1('0x1ba')]['hasMany'](db[_0x68a1('0x82')],{'as':'Actions','foreignKey':_0x68a1('0x1bb'),'onDelete':'cascade','hooks':!![]});db[_0x68a1('0x9b')][_0x68a1('0x11a')](db[_0x68a1('0xa2')],{'as':_0x68a1('0x1bc'),'onDelete':_0x68a1('0x114'),'foreignKey':_0x68a1('0x1ab'),'hooks':!![]});db[_0x68a1('0x9d')][_0x68a1('0x11a')](db[_0x68a1('0xa2')],{'as':_0x68a1('0x1bc'),'onDelete':_0x68a1('0x114'),'foreignKey':_0x68a1('0x1aa')});db[_0x68a1('0x1bd')][_0x68a1('0x11a')](db[_0x68a1('0xa2')],{'as':'Fields','onDelete':_0x68a1('0x114'),'foreignKey':_0x68a1('0x1be')});db[_0x68a1('0xa2')][_0x68a1('0x126')](db[_0x68a1('0x1bd')],{'foreignKey':_0x68a1('0x1be')});db['SalesforceAccount'][_0x68a1('0x11a')](db[_0x68a1('0x1bf')],{'as':_0x68a1('0x1c0'),'onDelete':'cascade','foreignKey':_0x68a1('0x1c1')});db[_0x68a1('0x1bf')]['hasMany'](db[_0x68a1('0xa6')],{'as':'Subjects','onDelete':_0x68a1('0x114'),'foreignKey':_0x68a1('0x1c2')});db[_0x68a1('0x1bf')][_0x68a1('0x11a')](db[_0x68a1('0xa6')],{'as':'Descriptions','onDelete':_0x68a1('0x114'),'foreignKey':'DescriptionId'});db[_0x68a1('0x1bf')]['hasMany'](db['SalesforceField'],{'as':_0x68a1('0x1bc'),'onDelete':'cascade','foreignKey':_0x68a1('0x1c3')});db['SalesforceConfiguration']['belongsTo'](db['SalesforceAccount'],{'as':_0x68a1('0x168'),'foreignKey':_0x68a1('0x1c1')});db[_0x68a1('0xa6')][_0x68a1('0x11a')](db[_0x68a1('0xa6')],{'as':'Subject','foreignKey':_0x68a1('0x1c2')});db[_0x68a1('0xa6')][_0x68a1('0x11a')](db[_0x68a1('0xa6')],{'as':_0x68a1('0x1c4'),'foreignKey':'DescriptionId'});db[_0x68a1('0xa6')][_0x68a1('0x11a')](db[_0x68a1('0xa6')],{'as':_0x68a1('0x1c5'),'foreignKey':_0x68a1('0x1c3')});db[_0x68a1('0xa6')][_0x68a1('0x126')](db[_0x68a1('0x1c6')],{'as':_0x68a1('0x1c6'),'foreignKey':'VariableId'});db['SugarcrmAccount'][_0x68a1('0x11a')](db[_0x68a1('0xaa')],{'as':_0x68a1('0x1c0'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x68a1('0xaa')][_0x68a1('0x11a')](db[_0x68a1('0xac')],{'as':_0x68a1('0x1c7'),'onDelete':_0x68a1('0x114'),'foreignKey':_0x68a1('0x1c2')});db['SugarcrmConfiguration'][_0x68a1('0x11a')](db[_0x68a1('0xac')],{'as':_0x68a1('0x1c8'),'onDelete':'cascade','foreignKey':_0x68a1('0x1c9')});db[_0x68a1('0xaa')][_0x68a1('0x11a')](db[_0x68a1('0xac')],{'as':_0x68a1('0x1bc'),'onDelete':'cascade','foreignKey':_0x68a1('0x1c3')});db[_0x68a1('0xaa')][_0x68a1('0x126')](db['SugarcrmAccount'],{'as':_0x68a1('0x168'),'foreignKey':_0x68a1('0x1c1')});db[_0x68a1('0xac')][_0x68a1('0x11a')](db[_0x68a1('0xac')],{'as':_0x68a1('0x1ca'),'foreignKey':_0x68a1('0x1c2')});db[_0x68a1('0xac')][_0x68a1('0x11a')](db[_0x68a1('0xac')],{'as':_0x68a1('0x1c4'),'foreignKey':'DescriptionId'});db[_0x68a1('0xac')]['hasMany'](db['SugarcrmField'],{'as':_0x68a1('0x1c5'),'foreignKey':_0x68a1('0x1c3')});db[_0x68a1('0xac')][_0x68a1('0x126')](db[_0x68a1('0x1c6')],{'as':_0x68a1('0x1c6'),'foreignKey':_0x68a1('0x1cb')});db[_0x68a1('0xad')][_0x68a1('0x11a')](db[_0x68a1('0xaf')],{'as':_0x68a1('0x1c0'),'onDelete':'cascade','foreignKey':_0x68a1('0x1c1')});db[_0x68a1('0xaf')][_0x68a1('0x11a')](db['DeskField'],{'as':'Subjects','onDelete':_0x68a1('0x114'),'foreignKey':_0x68a1('0x1c2')});db[_0x68a1('0xaf')][_0x68a1('0x11a')](db[_0x68a1('0xb1')],{'as':_0x68a1('0x1c8'),'onDelete':_0x68a1('0x114'),'foreignKey':_0x68a1('0x1c9')});db[_0x68a1('0xaf')][_0x68a1('0x11a')](db[_0x68a1('0xb1')],{'as':'Fields','onDelete':_0x68a1('0x114'),'foreignKey':_0x68a1('0x1c3')});db['DeskConfiguration']['belongsTo'](db['DeskAccount'],{'as':_0x68a1('0x168'),'foreignKey':_0x68a1('0x1c1')});db[_0x68a1('0xaf')][_0x68a1('0x127')](db[_0x68a1('0x90')],{'through':'int_desk_configuration_has_tags'});db[_0x68a1('0xb1')][_0x68a1('0x11a')](db['DeskField'],{'as':_0x68a1('0x1ca'),'foreignKey':_0x68a1('0x1c2')});db['DeskField'][_0x68a1('0x11a')](db['DeskField'],{'as':_0x68a1('0x1c4'),'foreignKey':_0x68a1('0x1c9')});db['DeskField'][_0x68a1('0x11a')](db[_0x68a1('0xb1')],{'as':_0x68a1('0x1c5'),'foreignKey':_0x68a1('0x1c3')});db[_0x68a1('0xb1')]['belongsTo'](db[_0x68a1('0x1c6')],{'as':_0x68a1('0x1c6'),'foreignKey':_0x68a1('0x1cb')});db[_0x68a1('0xb3')][_0x68a1('0x11a')](db[_0x68a1('0x1cc')],{'as':_0x68a1('0x1c0'),'onDelete':_0x68a1('0x114'),'foreignKey':_0x68a1('0x1c1')});db[_0x68a1('0x1cc')][_0x68a1('0x11a')](db[_0x68a1('0xb6')],{'as':_0x68a1('0x1c7'),'onDelete':'cascade','foreignKey':_0x68a1('0x1c2')});db[_0x68a1('0x1cc')][_0x68a1('0x11a')](db[_0x68a1('0xb6')],{'as':_0x68a1('0x1c8'),'onDelete':_0x68a1('0x114'),'foreignKey':_0x68a1('0x1c9')});db[_0x68a1('0x1cc')][_0x68a1('0x11a')](db[_0x68a1('0xb6')],{'as':_0x68a1('0x1bc'),'onDelete':_0x68a1('0x114'),'foreignKey':'FieldId'});db[_0x68a1('0x1cc')]['belongsTo'](db[_0x68a1('0xb3')],{'as':_0x68a1('0x168'),'foreignKey':'AccountId'});db[_0x68a1('0xb6')]['hasMany'](db['ZohoField'],{'as':_0x68a1('0x1ca'),'foreignKey':_0x68a1('0x1c2')});db[_0x68a1('0xb6')][_0x68a1('0x11a')](db['ZohoField'],{'as':'Description','foreignKey':_0x68a1('0x1c9')});db[_0x68a1('0xb6')][_0x68a1('0x11a')](db[_0x68a1('0xb6')],{'as':'Field','foreignKey':_0x68a1('0x1c3')});db['ZohoField']['belongsTo'](db[_0x68a1('0x1c6')],{'as':_0x68a1('0x1c6'),'foreignKey':_0x68a1('0x1cb')});db[_0x68a1('0xb8')][_0x68a1('0x11a')](db['ZendeskConfiguration'],{'as':'Configurations','onDelete':_0x68a1('0x114'),'foreignKey':_0x68a1('0x1c1')});db[_0x68a1('0xba')]['hasMany'](db[_0x68a1('0x1cd')],{'as':_0x68a1('0x1c7'),'foreignKey':_0x68a1('0x1c2')});db[_0x68a1('0xba')][_0x68a1('0x11a')](db[_0x68a1('0x1cd')],{'as':_0x68a1('0x1c8'),'foreignKey':_0x68a1('0x1c9')});db[_0x68a1('0xba')]['hasMany'](db[_0x68a1('0x1cd')],{'as':_0x68a1('0x1bc'),'foreignKey':'FieldId'});db['ZendeskConfiguration'][_0x68a1('0x126')](db[_0x68a1('0xb8')],{'as':'Account','foreignKey':_0x68a1('0x1c1')});db['ZendeskConfiguration'][_0x68a1('0x127')](db[_0x68a1('0x90')],{'through':'int_zendesk_configuration_has_tags'});db['ZendeskField'][_0x68a1('0x11a')](db[_0x68a1('0x1cd')],{'as':_0x68a1('0x1ca'),'foreignKey':_0x68a1('0x1c2')});db[_0x68a1('0x1cd')][_0x68a1('0x11a')](db[_0x68a1('0x1cd')],{'as':_0x68a1('0x1c4'),'foreignKey':_0x68a1('0x1c9')});db['ZendeskField']['hasMany'](db[_0x68a1('0x1cd')],{'as':_0x68a1('0x1c5'),'foreignKey':'FieldId'});db[_0x68a1('0x1cd')][_0x68a1('0x126')](db[_0x68a1('0x1c6')],{'as':_0x68a1('0x1c6'),'foreignKey':'VariableId'});db['FreshdeskAccount'][_0x68a1('0x11a')](db['FreshdeskConfiguration'],{'as':_0x68a1('0x1c0'),'onDelete':_0x68a1('0x114'),'foreignKey':_0x68a1('0x1c1')});db[_0x68a1('0xbe')][_0x68a1('0x11a')](db['FreshdeskField'],{'as':_0x68a1('0x1c7'),'onDelete':'cascade','foreignKey':_0x68a1('0x1c2')});db['FreshdeskConfiguration'][_0x68a1('0x11a')](db[_0x68a1('0x1ce')],{'as':_0x68a1('0x1c8'),'onDelete':_0x68a1('0x114'),'foreignKey':_0x68a1('0x1c9')});db[_0x68a1('0xbe')][_0x68a1('0x11a')](db[_0x68a1('0x1ce')],{'as':_0x68a1('0x1bc'),'onDelete':_0x68a1('0x114'),'foreignKey':_0x68a1('0x1c3')});db[_0x68a1('0xbe')][_0x68a1('0x126')](db['FreshdeskAccount'],{'as':'Account','foreignKey':_0x68a1('0x1c1')});db[_0x68a1('0xbe')][_0x68a1('0x127')](db['Tag'],{'through':_0x68a1('0x1cf')});db[_0x68a1('0x1ce')][_0x68a1('0x11a')](db[_0x68a1('0x1ce')],{'as':_0x68a1('0x1ca'),'foreignKey':_0x68a1('0x1c2')});db[_0x68a1('0x1ce')][_0x68a1('0x11a')](db['FreshdeskField'],{'as':_0x68a1('0x1c4'),'foreignKey':_0x68a1('0x1c9')});db['FreshdeskField'][_0x68a1('0x11a')](db[_0x68a1('0x1ce')],{'as':'Field','foreignKey':_0x68a1('0x1c3')});db['FreshdeskField']['belongsTo'](db['Variable'],{'as':_0x68a1('0x1c6'),'foreignKey':_0x68a1('0x1cb')});db[_0x68a1('0xc1')][_0x68a1('0x11a')](db[_0x68a1('0xc3')],{'as':_0x68a1('0x1c0'),'onDelete':'cascade','foreignKey':_0x68a1('0x1c1')});db['VtigerConfiguration'][_0x68a1('0x11a')](db[_0x68a1('0xc5')],{'as':'Subjects','foreignKey':_0x68a1('0x1c2')});db[_0x68a1('0xc3')]['hasMany'](db['VtigerField'],{'as':_0x68a1('0x1c8'),'foreignKey':_0x68a1('0x1c9')});db['VtigerConfiguration'][_0x68a1('0x11a')](db[_0x68a1('0xc5')],{'as':_0x68a1('0x1bc'),'foreignKey':_0x68a1('0x1c3')});db[_0x68a1('0xc3')]['belongsTo'](db['VtigerAccount'],{'as':_0x68a1('0x168'),'foreignKey':_0x68a1('0x1c1')});db['VtigerField'][_0x68a1('0x11a')](db['VtigerField'],{'as':_0x68a1('0x1ca'),'foreignKey':_0x68a1('0x1c2')});db[_0x68a1('0xc5')]['hasMany'](db[_0x68a1('0xc5')],{'as':'Description','foreignKey':_0x68a1('0x1c9')});db[_0x68a1('0xc5')][_0x68a1('0x11a')](db[_0x68a1('0xc5')],{'as':_0x68a1('0x1c5'),'foreignKey':'FieldId'});db['VtigerField']['belongsTo'](db[_0x68a1('0x1c6')],{'as':'Variable','foreignKey':_0x68a1('0x1cb')});db[_0x68a1('0xc7')][_0x68a1('0x11a')](db[_0x68a1('0xc9')],{'as':_0x68a1('0x1c0'),'onDelete':_0x68a1('0x114'),'foreignKey':_0x68a1('0x1c1')});db[_0x68a1('0xc9')][_0x68a1('0x11a')](db[_0x68a1('0x1d0')],{'as':'Subjects','foreignKey':_0x68a1('0x1c2')});db['ServicenowConfiguration'][_0x68a1('0x11a')](db[_0x68a1('0x1d0')],{'as':_0x68a1('0x1c8'),'foreignKey':_0x68a1('0x1c9')});db[_0x68a1('0xc9')][_0x68a1('0x11a')](db[_0x68a1('0x1d0')],{'as':'Fields','foreignKey':_0x68a1('0x1c3')});db[_0x68a1('0xc9')][_0x68a1('0x126')](db[_0x68a1('0xc7')],{'as':_0x68a1('0x168'),'foreignKey':_0x68a1('0x1c1')});db[_0x68a1('0x1d0')][_0x68a1('0x11a')](db[_0x68a1('0x1d0')],{'as':_0x68a1('0x1ca'),'foreignKey':'SubjectId'});db[_0x68a1('0x1d0')][_0x68a1('0x11a')](db[_0x68a1('0x1d0')],{'as':'Description','foreignKey':_0x68a1('0x1c9')});db[_0x68a1('0x1d0')][_0x68a1('0x11a')](db[_0x68a1('0x1d0')],{'as':'Field','foreignKey':_0x68a1('0x1c3')});db[_0x68a1('0x1d0')][_0x68a1('0x126')](db[_0x68a1('0x1c6')],{'as':_0x68a1('0x1c6'),'foreignKey':_0x68a1('0x1cb')});db['Dynamics365Account'][_0x68a1('0x11a')](db['Dynamics365Configuration'],{'as':_0x68a1('0x1c0'),'onDelete':_0x68a1('0x114'),'foreignKey':_0x68a1('0x1c1')});db['Dynamics365Account'][_0x68a1('0x126')](db[_0x68a1('0x10a')],{'as':_0x68a1('0x10a'),'foreignKey':_0x68a1('0x161')});db[_0x68a1('0x1d1')][_0x68a1('0x11a')](db[_0x68a1('0xce')],{'as':'Subjects','onDelete':_0x68a1('0x114'),'foreignKey':'SubjectId'});db['Dynamics365Configuration'][_0x68a1('0x11a')](db['Dynamics365Field'],{'as':_0x68a1('0x1c8'),'onDelete':_0x68a1('0x114'),'foreignKey':_0x68a1('0x1c9')});db[_0x68a1('0x1d1')][_0x68a1('0x11a')](db['Dynamics365Field'],{'as':'Fields','onDelete':_0x68a1('0x114'),'foreignKey':_0x68a1('0x1c3')});db[_0x68a1('0x1d1')][_0x68a1('0x126')](db[_0x68a1('0xcc')],{'as':_0x68a1('0x168'),'foreignKey':_0x68a1('0x1c1')});db[_0x68a1('0xce')][_0x68a1('0x11a')](db['Dynamics365Field'],{'as':_0x68a1('0x1ca'),'foreignKey':'SubjectId'});db['Dynamics365Field'][_0x68a1('0x11a')](db[_0x68a1('0xce')],{'as':_0x68a1('0x1c4'),'foreignKey':'DescriptionId'});db[_0x68a1('0xce')][_0x68a1('0x11a')](db[_0x68a1('0xce')],{'as':_0x68a1('0x1c5'),'foreignKey':'FieldId'});db[_0x68a1('0xce')][_0x68a1('0x126')](db['Variable'],{'as':_0x68a1('0x1c6'),'foreignKey':_0x68a1('0x1cb')});db[_0x68a1('0x1d2')]['hasMany'](db[_0x68a1('0xd0')],{'as':_0x68a1('0x1c0'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x68a1('0xd0')][_0x68a1('0x11a')](db['FreshsalesField'],{'as':_0x68a1('0x1c7'),'foreignKey':_0x68a1('0x1c2')});db[_0x68a1('0xd0')]['hasMany'](db[_0x68a1('0xd2')],{'as':_0x68a1('0x1c8'),'foreignKey':_0x68a1('0x1c9')});db['FreshsalesConfiguration'][_0x68a1('0x11a')](db['FreshsalesField'],{'as':'Fields','foreignKey':_0x68a1('0x1c3')});db[_0x68a1('0xd0')][_0x68a1('0x126')](db['FreshsalesAccount'],{'as':_0x68a1('0x168'),'foreignKey':_0x68a1('0x1c1')});db[_0x68a1('0xd2')][_0x68a1('0x11a')](db[_0x68a1('0xd2')],{'as':_0x68a1('0x1ca'),'foreignKey':'SubjectId'});db[_0x68a1('0xd2')][_0x68a1('0x11a')](db[_0x68a1('0xd2')],{'as':_0x68a1('0x1c4'),'foreignKey':_0x68a1('0x1c9')});db['FreshsalesField']['hasMany'](db[_0x68a1('0xd2')],{'as':_0x68a1('0x1c5'),'foreignKey':'FieldId'});db[_0x68a1('0xd2')][_0x68a1('0x126')](db[_0x68a1('0x1c6')],{'as':_0x68a1('0x1c6'),'foreignKey':_0x68a1('0x1cb')});db[_0x68a1('0xd5')][_0x68a1('0x126')](db[_0x68a1('0x68')],{});db[_0x68a1('0xd5')][_0x68a1('0x126')](db[_0x68a1('0x129')],{'as':_0x68a1('0x17a'),'foreignKey':_0x68a1('0x180')});db[_0x68a1('0xd5')][_0x68a1('0x126')](db[_0x68a1('0x77')],{'as':'Contact','foreignKey':_0x68a1('0x15e')});db['ChatQueueReport'][_0x68a1('0x126')](db[_0x68a1('0x6d')],{});db[_0x68a1('0xd5')][_0x68a1('0x126')](db[_0x68a1('0x6f')],{});db[_0x68a1('0xd5')][_0x68a1('0x126')](db[_0x68a1('0x13')],{});db['ChatQueueReport'][_0x68a1('0x126')](db[_0x68a1('0x132')],{});db[_0x68a1('0x190')]['belongsTo'](db[_0x68a1('0x13')],{'onDelete':_0x68a1('0x114'),'foreignKey':_0x68a1('0x1d3')});db[_0x68a1('0x190')]['belongsTo'](db[_0x68a1('0x13')],{'onDelete':_0x68a1('0x114'),'foreignKey':'ToId'});db[_0x68a1('0x14c')][_0x68a1('0x11a')](db[_0x68a1('0x1d4')],{'foreignKey':_0x68a1('0x1d5'),'onDelete':'cascade'});db['JscriptySessionReport'][_0x68a1('0x11a')](db['JscriptyAnswerReport'],{'foreignKey':_0x68a1('0x1d5'),'onDelete':_0x68a1('0x114')});db[_0x68a1('0xd8')][_0x68a1('0x126')](db['SmsAccount'],{});db[_0x68a1('0xd8')][_0x68a1('0x126')](db['CmList'],{'as':'List','foreignKey':_0x68a1('0x180')});db[_0x68a1('0xd8')]['belongsTo'](db[_0x68a1('0x77')],{'as':'Contact','foreignKey':_0x68a1('0x15e')});db[_0x68a1('0xd8')]['belongsTo'](db['SmsInteraction'],{});db[_0x68a1('0xd8')][_0x68a1('0x126')](db[_0x68a1('0x5b')],{});db['SmsQueueReport'][_0x68a1('0x126')](db[_0x68a1('0x13')],{});db[_0x68a1('0xd8')][_0x68a1('0x126')](db[_0x68a1('0x5d')],{});db['JscriptyProject'][_0x68a1('0x11a')](db[_0x68a1('0x14c')],{'foreignKey':'ProjectId'});db['JscriptyProject'][_0x68a1('0x11a')](db['JscriptyQuestionReport'],{'foreignKey':'ProjectId'});db[_0x68a1('0x1d6')][_0x68a1('0x11a')](db[_0x68a1('0x1d7')],{'foreignKey':'ProjectId'});db[_0x68a1('0xe3')]['belongsToMany'](db['User'],{'as':_0x68a1('0x157'),'through':_0x68a1('0x12a')});db[_0x68a1('0xe3')][_0x68a1('0x127')](db[_0x68a1('0x1c')],{'through':_0x68a1('0x10c'),'as':_0x68a1('0x12f')});db['Team'][_0x68a1('0x127')](db['MailQueue'],{'through':_0x68a1('0x167'),'as':_0x68a1('0x131')});db[_0x68a1('0xe3')][_0x68a1('0x127')](db['ChatQueue'],{'through':'team_has_chat_queues','as':_0x68a1('0x1d8')});db[_0x68a1('0xe3')][_0x68a1('0x127')](db[_0x68a1('0x133')],{'through':_0x68a1('0x1d9'),'as':'FaxQueues'});db['Team'][_0x68a1('0x127')](db[_0x68a1('0x5d')],{'through':'team_has_sms_queues','as':_0x68a1('0x135')});db[_0x68a1('0xe3')]['belongsToMany'](db[_0x68a1('0x66')],{'through':'team_has_openchannel_queues','as':_0x68a1('0x1da')});db[_0x68a1('0xe3')][_0x68a1('0x127')](db[_0x68a1('0x109')],{'through':_0x68a1('0x1db'),'as':_0x68a1('0x137')});db['Team'][_0x68a1('0x127')](db[_0x68a1('0xf5')],{'through':_0x68a1('0x10e'),'as':_0x68a1('0x130')});db['Campaign']['hasMany'](db[_0x68a1('0x79')],{'as':_0x68a1('0x149'),'foreignKey':_0x68a1('0x19b')});db[_0x68a1('0xe7')]['hasMany'](db[_0x68a1('0x11d')],{'as':_0x68a1('0x195'),'foreignKey':'CampaignId'});db['Campaign'][_0x68a1('0x11a')](db[_0x68a1('0x7e')],{'as':_0x68a1('0x14a'),'foreignKey':_0x68a1('0x19b')});db['Campaign'][_0x68a1('0x11a')](db['CmHopperBlack'],{'as':_0x68a1('0x14b'),'foreignKey':'CampaignId'});db[_0x68a1('0xe7')]['belongsTo'](db[_0x68a1('0x2c')],{'as':'Trunk','foreignKey':_0x68a1('0x14e')});db['Campaign'][_0x68a1('0x126')](db['Trunk'],{'as':_0x68a1('0x14f'),'foreignKey':_0x68a1('0x150')});db[_0x68a1('0xe7')][_0x68a1('0x126')](db['Interval'],{'as':'Interval','foreignKey':'IntervalId'});db[_0x68a1('0xe7')][_0x68a1('0x126')](db[_0x68a1('0x1dc')],{'as':_0x68a1('0x1dc'),'foreignKey':_0x68a1('0x1dd')});db[_0x68a1('0xe7')][_0x68a1('0x127')](db[_0x68a1('0x129')],{'as':_0x68a1('0x155'),'through':'campaigns_has_cm_lists'});db[_0x68a1('0xe7')][_0x68a1('0x127')](db[_0x68a1('0x129')],{'as':_0x68a1('0x1de'),'through':_0x68a1('0x1df')});db[_0x68a1('0xeb')][_0x68a1('0x126')](db[_0x68a1('0x70')],{'as':'ChatOfflineMessage','foreignKey':_0x68a1('0x171')});db[_0x68a1('0xef')][_0x68a1('0x126')](db[_0x68a1('0x45')],{});db[_0x68a1('0xef')]['belongsTo'](db[_0x68a1('0x44')],{});db[_0x68a1('0xef')][_0x68a1('0x126')](db[_0x68a1('0x13d')],{'foreignKey':_0x68a1('0x1e0'),'as':_0x68a1('0x1e1')});db['MailTransferReport'][_0x68a1('0x126')](db['User'],{'foreignKey':_0x68a1('0x1e2'),'as':_0x68a1('0x1e3')});db[_0x68a1('0xef')][_0x68a1('0x126')](db[_0x68a1('0x13')],{'foreignKey':_0x68a1('0x1e4'),'as':_0x68a1('0x1e5')});db[_0x68a1('0xef')][_0x68a1('0x126')](db[_0x68a1('0x40')],{'foreignKey':_0x68a1('0x1e6'),'as':_0x68a1('0x1e7')});db['MailTransferReport'][_0x68a1('0x126')](db[_0x68a1('0x13d')],{'foreignKey':'ToMailAccountId','as':_0x68a1('0x1e8')});db[_0x68a1('0xf1')][_0x68a1('0x126')](db[_0x68a1('0x6f')],{});db['ChatTransferReport'][_0x68a1('0x126')](db[_0x68a1('0x6d')],{});db[_0x68a1('0xf1')][_0x68a1('0x126')](db[_0x68a1('0x68')],{'foreignKey':_0x68a1('0x1e9'),'as':_0x68a1('0x1e1')});db[_0x68a1('0xf1')][_0x68a1('0x126')](db[_0x68a1('0x13')],{'foreignKey':'FromUserId','as':_0x68a1('0x1e3')});db[_0x68a1('0xf1')][_0x68a1('0x126')](db[_0x68a1('0x13')],{'foreignKey':_0x68a1('0x1e4'),'as':_0x68a1('0x1e5')});db[_0x68a1('0xf1')]['belongsTo'](db['ChatQueue'],{'foreignKey':'ToChatQueueId','as':_0x68a1('0x1e7')});db[_0x68a1('0xf1')][_0x68a1('0x126')](db[_0x68a1('0x68')],{'foreignKey':'ToChatWebsiteId','as':'ToAccount'});db[_0x68a1('0xf2')][_0x68a1('0x126')](db['FaxMessage'],{});db['FaxTransferReport'][_0x68a1('0x126')](db[_0x68a1('0x50')],{});db[_0x68a1('0xf2')][_0x68a1('0x126')](db[_0x68a1('0x4c')],{'foreignKey':_0x68a1('0x1ea'),'as':_0x68a1('0x1e1')});db[_0x68a1('0xf2')]['belongsTo'](db[_0x68a1('0x13')],{'foreignKey':_0x68a1('0x1e2'),'as':'FromAgent'});db['FaxTransferReport'][_0x68a1('0x126')](db['User'],{'foreignKey':_0x68a1('0x1e4'),'as':_0x68a1('0x1e5')});db[_0x68a1('0xf2')][_0x68a1('0x126')](db[_0x68a1('0x133')],{'foreignKey':'ToFaxQueueId','as':_0x68a1('0x1e7')});db[_0x68a1('0xf2')][_0x68a1('0x126')](db[_0x68a1('0x4c')],{'foreignKey':_0x68a1('0x1eb'),'as':_0x68a1('0x1e8')});db[_0x68a1('0x1ec')][_0x68a1('0x126')](db['OpenchannelMessage'],{});db[_0x68a1('0x1ec')][_0x68a1('0x126')](db['OpenchannelInteraction'],{});db[_0x68a1('0x1ec')]['belongsTo'](db[_0x68a1('0x5f')],{'foreignKey':_0x68a1('0x1ed'),'as':_0x68a1('0x1e1')});db[_0x68a1('0x1ec')][_0x68a1('0x126')](db[_0x68a1('0x13')],{'foreignKey':_0x68a1('0x1e2'),'as':_0x68a1('0x1e3')});db[_0x68a1('0x1ec')][_0x68a1('0x126')](db[_0x68a1('0x13')],{'foreignKey':_0x68a1('0x1e4'),'as':_0x68a1('0x1e5')});db[_0x68a1('0x1ec')][_0x68a1('0x126')](db['OpenchannelQueue'],{'foreignKey':_0x68a1('0x1ee'),'as':_0x68a1('0x1e7')});db[_0x68a1('0x1ec')][_0x68a1('0x126')](db[_0x68a1('0x5f')],{'foreignKey':_0x68a1('0x1ef'),'as':_0x68a1('0x1e8')});db['SmsTransferReport']['belongsTo'](db['SmsMessage'],{});db[_0x68a1('0x1f0')]['belongsTo'](db['SmsInteraction'],{});db[_0x68a1('0x1f0')][_0x68a1('0x126')](db['SmsAccount'],{'foreignKey':'FromSmsAccountId','as':_0x68a1('0x1e1')});db[_0x68a1('0x1f0')][_0x68a1('0x126')](db[_0x68a1('0x13')],{'foreignKey':_0x68a1('0x1e2'),'as':_0x68a1('0x1e3')});db[_0x68a1('0x1f0')][_0x68a1('0x126')](db[_0x68a1('0x13')],{'foreignKey':_0x68a1('0x1e4'),'as':_0x68a1('0x1e5')});db[_0x68a1('0x1f0')][_0x68a1('0x126')](db[_0x68a1('0x5d')],{'foreignKey':'ToSmsQueueId','as':'ToQueue'});db['SmsTransferReport']['belongsTo'](db['SmsAccount'],{'foreignKey':_0x68a1('0x1f1'),'as':'ToAccount'});db['CmList'][_0x68a1('0x11a')](db[_0x68a1('0x86')],{'as':_0x68a1('0x164'),'foreignKey':_0x68a1('0x180'),'onDelete':'cascade'});db['CmList'][_0x68a1('0x11a')](db[_0x68a1('0x1f2')],{'as':_0x68a1('0x1f3'),'foreignKey':_0x68a1('0x180')});db['CmList'][_0x68a1('0x11a')](db[_0x68a1('0x77')],{'as':_0x68a1('0x193'),'onDelete':_0x68a1('0x114'),'foreignKey':_0x68a1('0x180')});db[_0x68a1('0x129')][_0x68a1('0x11a')](db['CmHopperFinal'],{'as':_0x68a1('0x195'),'foreignKey':_0x68a1('0x180')});db[_0x68a1('0x129')][_0x68a1('0x11a')](db['CmHopperHistory'],{'as':_0x68a1('0x11e'),'foreignKey':_0x68a1('0x180')});db[_0x68a1('0x129')]['hasMany'](db[_0x68a1('0x80')],{'as':_0x68a1('0x80'),'foreignKey':_0x68a1('0x180')});db[_0x68a1('0x129')][_0x68a1('0x127')](db[_0x68a1('0x1c')],{'as':_0x68a1('0x1f4'),'through':_0x68a1('0x156')});db[_0x68a1('0x129')][_0x68a1('0x127')](db[_0x68a1('0x13')],{'as':_0x68a1('0x157'),'through':_0x68a1('0x138')});db[_0x68a1('0xf5')][_0x68a1('0x11a')](db[_0x68a1('0x19')],{'as':_0x68a1('0x11c'),'onDelete':_0x68a1('0x114')});db[_0x68a1('0xf5')][_0x68a1('0x127')](db[_0x68a1('0x13')],{'as':_0x68a1('0x157'),'through':_0x68a1('0x10f')});db[_0x68a1('0xf5')][_0x68a1('0x127')](db[_0x68a1('0xe3')],{'through':_0x68a1('0x10e'),'as':_0x68a1('0x158')});db['UserProfile']['hasMany'](db[_0x68a1('0x13')],{'as':_0x68a1('0x16d'),'foreignKey':_0x68a1('0x1f5')});db[_0x68a1('0xf7')][_0x68a1('0x11a')](db[_0x68a1('0x1f6')],{'as':_0x68a1('0x1f7'),'foreignKey':_0x68a1('0x1f5'),'onDelete':_0x68a1('0x114')});db[_0x68a1('0x1f6')][_0x68a1('0x11a')](db[_0x68a1('0xfa')],{'as':'Resources','foreignKey':_0x68a1('0x1f8'),'onDelete':_0x68a1('0x114')});db[_0x68a1('0xfe')][_0x68a1('0x11a')](db[_0x68a1('0x86')],{'as':_0x68a1('0x164'),'foreignKey':_0x68a1('0x1f9'),'onDelete':_0x68a1('0x114')});db['WhatsappAccount'][_0x68a1('0x11a')](db[_0x68a1('0x85')],{'as':_0x68a1('0x165'),'foreignKey':_0x68a1('0x1f9')});db[_0x68a1('0xfe')][_0x68a1('0x11a')](db['WhatsappMessage'],{'as':_0x68a1('0x15a'),'foreignKey':_0x68a1('0x1f9')});db[_0x68a1('0xfe')]['hasMany'](db[_0x68a1('0x102')],{'as':_0x68a1('0x177')});db['WhatsappAccount']['hasMany'](db[_0x68a1('0x100')],{'as':_0x68a1('0x178'),'foreignKey':_0x68a1('0x1f9'),'onDelete':'cascade'});db['WhatsappAccount'][_0x68a1('0x126')](db[_0x68a1('0x129')],{'as':_0x68a1('0x17a'),'foreignKey':_0x68a1('0x180')});db[_0x68a1('0xfe')][_0x68a1('0x126')](db[_0x68a1('0x17b')],{'as':_0x68a1('0x153'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x68a1('0xfe')][_0x68a1('0x127')](db[_0x68a1('0x13')],{'as':'Agents','through':_0x68a1('0x144')});db[_0x68a1('0x100')]['belongsTo'](db[_0x68a1('0x13')],{'onDelete':_0x68a1('0x172')});db['WhatsappApplication']['belongsTo'](db[_0x68a1('0x109')],{'onDelete':_0x68a1('0x172')});db[_0x68a1('0x100')]['belongsTo'](db[_0x68a1('0xfe')],{'onDelete':_0x68a1('0x172')});db[_0x68a1('0x100')][_0x68a1('0x126')](db[_0x68a1('0x151')],{'onDelete':_0x68a1('0x172'),'foreignKey':_0x68a1('0x152')});db[_0x68a1('0x100')][_0x68a1('0x126')](db[_0x68a1('0x90')],{'onDelete':_0x68a1('0x172'),'foreignKey':_0x68a1('0x173')});db[_0x68a1('0x102')][_0x68a1('0x11a')](db['WhatsappMessage'],{'as':'Messages','onDelete':_0x68a1('0x114'),'foreignKey':_0x68a1('0x1fa')});db[_0x68a1('0x102')][_0x68a1('0x126')](db[_0x68a1('0xfe')],{'as':_0x68a1('0x168'),'foreignKey':_0x68a1('0x1f9')});db[_0x68a1('0x102')][_0x68a1('0x126')](db['CmContact'],{'as':_0x68a1('0x169'),'foreignKey':_0x68a1('0x15e')});db[_0x68a1('0x102')][_0x68a1('0x126')](db[_0x68a1('0x13')],{'as':_0x68a1('0x16a'),'foreignKey':_0x68a1('0x115')});db[_0x68a1('0x102')][_0x68a1('0x127')](db['Tag'],{'through':'whatsapp_interaction_has_tags','as':_0x68a1('0x16b')});db[_0x68a1('0x102')][_0x68a1('0x127')](db['Tag'],{'through':'whatsapp_interaction_has_tags','as':_0x68a1('0x17e')});db[_0x68a1('0x102')][_0x68a1('0x127')](db[_0x68a1('0x13')],{'as':_0x68a1('0x16d'),'through':'user_has_whatsapp_interactions','foreignKey':_0x68a1('0x1fa')});db[_0x68a1('0x104')][_0x68a1('0x126')](db['User'],{'as':'User'});db[_0x68a1('0x104')][_0x68a1('0x126')](db[_0x68a1('0x77')],{'onDelete':_0x68a1('0x114'),'as':_0x68a1('0x169')});db['WhatsappMessage'][_0x68a1('0x126')](db[_0x68a1('0x102')],{'onDelete':_0x68a1('0x114'),'as':_0x68a1('0x16f'),'foreignKey':_0x68a1('0x1fa')});db['WhatsappMessage'][_0x68a1('0x126')](db[_0x68a1('0xfe')],{'as':_0x68a1('0x168'),'foreignKey':_0x68a1('0x1f9')});db[_0x68a1('0x106')][_0x68a1('0x126')](db['WhatsappAccount'],{});db[_0x68a1('0x106')][_0x68a1('0x126')](db[_0x68a1('0x129')],{'as':_0x68a1('0x17a'),'foreignKey':_0x68a1('0x180')});db[_0x68a1('0x106')][_0x68a1('0x126')](db['CmContact'],{'as':_0x68a1('0x169'),'foreignKey':_0x68a1('0x15e')});db[_0x68a1('0x106')][_0x68a1('0x126')](db['WhatsappInteraction'],{});db[_0x68a1('0x106')][_0x68a1('0x126')](db['WhatsappQueue'],{});db[_0x68a1('0x106')][_0x68a1('0x126')](db[_0x68a1('0x104')],{});db[_0x68a1('0x106')][_0x68a1('0x126')](db[_0x68a1('0x13')],{});db['WhatsappTransferReport']['belongsTo'](db[_0x68a1('0x104')],{});db[_0x68a1('0x1fb')][_0x68a1('0x126')](db[_0x68a1('0x102')],{});db[_0x68a1('0x1fb')][_0x68a1('0x126')](db[_0x68a1('0xfe')],{'foreignKey':_0x68a1('0x1fc'),'as':_0x68a1('0x1e1')});db[_0x68a1('0x1fb')][_0x68a1('0x126')](db['WhatsappAccount'],{'foreignKey':_0x68a1('0x1fd'),'as':_0x68a1('0x1e8')});db[_0x68a1('0x1fb')]['belongsTo'](db[_0x68a1('0x109')],{'foreignKey':_0x68a1('0x1fe'),'as':'ToQueue'});db[_0x68a1('0x1fb')][_0x68a1('0x126')](db[_0x68a1('0x13')],{'foreignKey':_0x68a1('0x1e2'),'as':_0x68a1('0x1e3')});db['WhatsappTransferReport']['belongsTo'](db[_0x68a1('0x13')],{'foreignKey':_0x68a1('0x1e4'),'as':'ToAgent'});db[_0x68a1('0x109')]['belongsToMany'](db['User'],{'as':_0x68a1('0x157'),'through':'UserWhatsappQueue','foreignKey':_0x68a1('0x1ff')});db['WhatsappQueue'][_0x68a1('0x127')](db[_0x68a1('0xe3')],{'through':_0x68a1('0x1db'),'as':_0x68a1('0x158')});db[_0x68a1('0x116')][_0x68a1('0x126')](db[_0x68a1('0x13')],{'as':_0x68a1('0x200'),'foreignKey':'UserId','onDelete':_0x68a1('0x114'),'hooks':!![]});db[_0x68a1('0x10a')][_0x68a1('0x113')](db['Dynamics365Account'],{'as':'Dynamics365Account','onDelete':_0x68a1('0x172')});db[_0x68a1('0x10a')][_0x68a1('0x113')](db[_0x68a1('0x15f')],{'as':_0x68a1('0x162'),'onDelete':_0x68a1('0x172')});db[_0x68a1('0x10a')]['hasOne'](db['MailServerOut'],{'as':_0x68a1('0x163'),'onDelete':'restrict'});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x91a0=['../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','../api/mailServerIn/mailServerIn.model','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailInteraction/mailInteraction.model','../api/mailMessage/mailMessage.model','MailApplication','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','ChatQueue','../api/chatQueue/chatQueue.model','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','CmContact','CmHopper','CmHopperBlack','CmHopperFinal','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','Schedule','Sound','../api/sound/sound.model','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/template/template.model','Variable','../api/variable/variable.model','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskConfiguration/intDeskConfiguration.model','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','../api/intVtigerField/intVtigerField.model','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Integration','ChatQueueReport','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','SquareProject','../api/squareProject/squareProject.model','SquareRecording','SquareMessage','Team','../api/team/team.model','../api/license/license.model','Campaign','../api/campaign/campaign.model','../api/migration/migration.model','../api/plugin/plugin.model','MailTransferReport','ChatTransferReport','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','MailInteractionHasTag','User','hasOne','cascade','UserId','userSetting','Recordings','hasMany','VoiceQueuesRt','HopperFinals','ReportAgentPreview','ChatInteractions','SmsInteractions','FaxInteractions','MailInteraction','SenderId','SET\x20NULL','belongsTo','userProfileId','belongsToMany','ChatGroup','Groups','chat_group_has_users','cm_user_has_contacts','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','SmsInteraction','user_has_sms_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','MailQueues','SmsQueue','SmsQueues','OpenchannelQueues','FaxAccounts','MailAccounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccount','WhatsappAccounts','user_has_whatsapp_accounts','SpiedAgents','ChanSpyId','Applications','Sounds','moh_has_sounds','VoiceQueueId','Hoppers','HopperHistories','JscriptySessionReport','JscriptySessions','TrunkBackup','TrunkBackupId','IntervalId','Pause','mandatoryDispositionPause','mandatoryDispositionPauseId','Lists','voice_queues_has_cm_lists','Agents','BlackLists','voice_queues_has_cm_blacklists','VoiceMailMessage','Messages','mailboxuser','mailbox','uniqueid','VoiceCallReport','Contact','ContactId','MailServerIn','MailAccountId','restrict','MailServerOut','CloudProviderId','Imap','Smtp','Dispositions','Answers','MailMessage','List','ListId','Template','TemplateId','user_has_mail_accounts','team_has_mail_queues','MailInteractionId','Account','Owner','Tag','mail_interaction_has_tags','Tags','ThroughTags','Users','Attachment','Attachments','Interaction','ChatOfflineMessageId','TagId','Items','FaxAccountId','user_has_fax_accounts','fax_interaction_has_tags','user_has_fax_interactions','FaxInteractionId','AttachmentId','team_has_fax_queues','FaxQueueReport','SmsAccountId','Interactions','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','Teams','OpenchannelAccountId','OpenchannelQueueId','openchannel_interaction_has_tags','OpenchannelInteractionId','team_has_openchannel_queues','ChatWebsiteId','ProactiveActions','Agent','Queue','ChatQueueId','Website','chat_interaction_has_tags','ChatInteractionId','team_has_chat_queues','Contacts','CompanyId','MailInteractions','Company','cm_contact_has_tags','CmHopperId','CampaignId','OwnerId','OneAll','OneAny','AutomationAnyId','Actions','AutomationId','ParentId','Intervals','Extensions','MailApplications','ChatApplications','FaxApplications','DefaultReportId','AnalyticCustomReport','CustomReportId','Mohs','whatsapp_interaction_has_tags','ContactItemType','ItemType','ItemTypeId','CmContactId','AllConditions','AllCondition','Trigger','AnyConditions','AnyCondition','TriggerId','Fields','MetricId','Configurations','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','AccountId','Subject','Description','Field','SugarcrmConfiguration','DeskConfiguration','DeskField','VariableId','int_zendesk_configuration_has_tags','FreshdeskField','VtigerConfiguration','VtigerField','ServicenowAccount','FreshsalesConfiguration','FromId','SessionId','ProjectId','JscriptyQuestionReport','ChatQueues','FaxQueues','team_has_whatsapp_queues','HopperBlacks','TrunkId','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromUserId','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','FromAccount','FromAgent','ToChatQueueId','ToChatWebsiteId','ToFaxQueueId','ToFaxAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','ToSmsAccountId','CustomFields','HopperHistory','Queues','UserProfileSection','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappQueueReport','FromWhatsappAccountId','ToQueueId','WhatsappQueueId','exports','../config/environment','lodash','jstz','determine','sequelize','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','utf8mb4','utf8','utf8_general_ci','sequelizeHistory','database','username','password','options','import','../api/user/user.model','VoiceChanSpy','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','VoiceMusicOnHold','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording'];(function(_0x3a8dc1,_0x2f03b8){var _0x4b3595=function(_0x1c19e7){while(--_0x1c19e7){_0x3a8dc1['push'](_0x3a8dc1['shift']());}};_0x4b3595(++_0x2f03b8);}(_0x91a0,0x1df));var _0x091a=function(_0x1aac60,_0x2e5ce5){_0x1aac60=_0x1aac60-0x0;var _0x186adf=_0x91a0[_0x1aac60];return _0x186adf;};'use strict';var config=require(_0x091a('0x0'));var Sequelize=require('sequelize');var _=require(_0x091a('0x1'));var jstz=require(_0x091a('0x2'));var timezone=jstz[_0x091a('0x3')]();config[_0x091a('0x4')]=_[_0x091a('0x5')](config[_0x091a('0x4')],{'database':_0x091a('0x6'),'username':_0x091a('0x7'),'password':_0x091a('0x8'),'options':{'host':_0x091a('0x9'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x091a('0xa')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x091a('0xb'),'collate':_0x091a('0xc')}}});config[_0x091a('0xd')]=_['defaultsDeep'](config[_0x091a('0xd')],{'database':_0x091a('0x6'),'username':_0x091a('0x7'),'password':_0x091a('0x8'),'options':{'host':_0x091a('0x9'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x091a('0xa')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x091a('0xb'),'collate':_0x091a('0xc')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0x091a('0xe')],config[_0x091a('0x4')][_0x091a('0xf')],config[_0x091a('0x4')][_0x091a('0x10')],config[_0x091a('0x4')][_0x091a('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x091a('0xd')][_0x091a('0xe')],config[_0x091a('0xd')][_0x091a('0xf')],config['sequelizeHistory'][_0x091a('0x10')],config[_0x091a('0xd')][_0x091a('0x11')])};db['User']=db['sequelize'][_0x091a('0x12')](_0x091a('0x13'));db[_0x091a('0x14')]=db[_0x091a('0x4')][_0x091a('0x12')]('../api/voiceChanSpy/voiceChanSpy.model');db[_0x091a('0x15')]=db['sequelize'][_0x091a('0x12')](_0x091a('0x16'));db[_0x091a('0x17')]=db['sequelize']['import']('../api/voiceExtension/voiceExtension.model');db[_0x091a('0x18')]=db[_0x091a('0x4')][_0x091a('0x12')]('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0x091a('0x19')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x1a'));db[_0x091a('0x1b')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x1c'));db[_0x091a('0x1d')]=db['sequelize']['import'](_0x091a('0x1e'));db[_0x091a('0x1f')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x20'));db['VoiceMailMessage']=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x21'));db['VoiceCallReport']=db[_0x091a('0x4')]['import'](_0x091a('0x22'));db[_0x091a('0x23')]=db['sequelize'][_0x091a('0x12')](_0x091a('0x24'));db[_0x091a('0x25')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x26'));db[_0x091a('0x27')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x28'));db[_0x091a('0x29')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x2a'));db[_0x091a('0x2b')]=db[_0x091a('0x4')]['import']('../api/trunk/trunk.model');db[_0x091a('0x2c')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x2d'));db[_0x091a('0x2e')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x2f'));db[_0x091a('0x30')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x31'));db[_0x091a('0x32')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x33'));db[_0x091a('0x34')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x35'));db[_0x091a('0x36')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x37'));db[_0x091a('0x38')]=db[_0x091a('0x4')][_0x091a('0x12')]('../api/userSmsQueue/userSmsQueue.model');db[_0x091a('0x39')]=db[_0x091a('0x4')][_0x091a('0x12')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0x091a('0x3a')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x3b'));db['MailServerIn']=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x3c'));db['MailServerOut']=db[_0x091a('0x4')]['import'](_0x091a('0x3d'));db[_0x091a('0x3e')]=db[_0x091a('0x4')]['import'](_0x091a('0x3f'));db[_0x091a('0x40')]=db['sequelize'][_0x091a('0x12')](_0x091a('0x41'));db[_0x091a('0x42')]=db[_0x091a('0x4')][_0x091a('0x12')]('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x43'));db['MailMessage']=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x44'));db[_0x091a('0x45')]=db[_0x091a('0x4')][_0x091a('0x12')]('../api/mailApplication/mailApplication.model');db[_0x091a('0x46')]=db[_0x091a('0x4')]['import'](_0x091a('0x47'));db[_0x091a('0x48')]=db['sequelize'][_0x091a('0x12')]('../api/dashboard/dashboard.model');db[_0x091a('0x49')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x4a'));db[_0x091a('0x4b')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x4c'));db[_0x091a('0x4d')]=db[_0x091a('0x4')][_0x091a('0x12')]('../api/faxApplication/faxApplication.model');db[_0x091a('0x4e')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x4f'));db[_0x091a('0x50')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x51'));db[_0x091a('0x52')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x53'));db['FaxQueueReport']=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x54'));db[_0x091a('0x55')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x56'));db[_0x091a('0x57')]=db['sequelize'][_0x091a('0x12')](_0x091a('0x58'));db['SmsInteraction']=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x59'));db[_0x091a('0x5a')]=db['sequelize']['import'](_0x091a('0x5b'));db['SmsQueue']=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x5c'));db[_0x091a('0x5d')]=db['sequelize'][_0x091a('0x12')](_0x091a('0x5e'));db[_0x091a('0x5f')]=db['sequelize'][_0x091a('0x12')](_0x091a('0x60'));db[_0x091a('0x61')]=db['sequelize'][_0x091a('0x12')](_0x091a('0x62'));db[_0x091a('0x63')]=db[_0x091a('0x4')]['import'](_0x091a('0x64'));db[_0x091a('0x65')]=db[_0x091a('0x4')][_0x091a('0x12')]('../api/openchannelQueue/openchannelQueue.model');db[_0x091a('0x66')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x67'));db[_0x091a('0x68')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x69'));db[_0x091a('0x6a')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x6b'));db[_0x091a('0x6c')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x6d'));db[_0x091a('0x6e')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x6f'));db[_0x091a('0x70')]=db['sequelize'][_0x091a('0x12')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x091a('0x71')]=db['sequelize'][_0x091a('0x12')](_0x091a('0x72'));db['ChatGroup']=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x73'));db[_0x091a('0x74')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x75'));db[_0x091a('0x76')]=db[_0x091a('0x4')][_0x091a('0x12')]('../api/cmCompany/cmCompany.model');db[_0x091a('0x77')]=db[_0x091a('0x4')]['import']('../api/cmContact/cmContact.model');db[_0x091a('0x78')]=db[_0x091a('0x4')][_0x091a('0x12')]('../api/cmHopper/cmHopper.model');db[_0x091a('0x79')]=db[_0x091a('0x4')][_0x091a('0x12')]('../api/cmHopperBlack/cmHopperBlack.model');db[_0x091a('0x7a')]=db[_0x091a('0x4')]['import']('../api/cmHopperFinal/cmHopperFinal.model');db[_0x091a('0x7b')]=db['sequelize'][_0x091a('0x12')](_0x091a('0x7c'));db['ReportAgentPreview']=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x7d'));db[_0x091a('0x7e')]=db[_0x091a('0x4')][_0x091a('0x12')]('../api/cmCustomField/cmCustomField.model');db[_0x091a('0x7f')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x80'));db[_0x091a('0x81')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x82'));db[_0x091a('0x83')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x84'));db[_0x091a('0x85')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x86'));db[_0x091a('0x87')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x88'));db[_0x091a('0x89')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x8a'));db['Pause']=db[_0x091a('0x4')]['import'](_0x091a('0x8b'));db[_0x091a('0x8c')]=db['sequelize'][_0x091a('0x12')](_0x091a('0x8d'));db[_0x091a('0x8e')]=db['sequelize'][_0x091a('0x12')]('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0x091a('0x8f')]=db[_0x091a('0x4')][_0x091a('0x12')]('../api/schedule/schedule.model');db[_0x091a('0x90')]=db['sequelize'][_0x091a('0x12')](_0x091a('0x91'));db['Tag']=db[_0x091a('0x4')]['import']('../api/tag/tag.model');db['ContactItemType']=db['sequelize'][_0x091a('0x12')](_0x091a('0x92'));db[_0x091a('0x93')]=db[_0x091a('0x4')]['import'](_0x091a('0x94'));db[_0x091a('0x95')]=db[_0x091a('0x4')][_0x091a('0x12')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db['Template']=db[_0x091a('0x4')]['import'](_0x091a('0x96'));db['Trigger']=db['sequelize'][_0x091a('0x12')]('../api/trigger/trigger.model');db[_0x091a('0x97')]=db[_0x091a('0x4')]['import'](_0x091a('0x98'));db['Integration']=db['sequelize'][_0x091a('0x12')](_0x091a('0x99'));db[_0x091a('0x9a')]=db['sequelize'][_0x091a('0x12')](_0x091a('0x9b'));db['AnalyticCustomReport']=db['sequelize'][_0x091a('0x12')](_0x091a('0x9c'));db[_0x091a('0x9d')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x9e'));db['AnalyticExtractedReport']=db[_0x091a('0x4')]['import'](_0x091a('0x9f'));db[_0x091a('0xa0')]=db['sequelize'][_0x091a('0x12')](_0x091a('0xa1'));db[_0x091a('0xa2')]=db[_0x091a('0x4')]['import'](_0x091a('0xa3'));db[_0x091a('0xa4')]=db[_0x091a('0x4')][_0x091a('0x12')]('../api/analyticTreeReport/analyticTreeReport.model');db[_0x091a('0xa5')]=db[_0x091a('0x4')]['import'](_0x091a('0xa6'));db[_0x091a('0xa7')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0xa8'));db[_0x091a('0xa9')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0xaa'));db[_0x091a('0xab')]=db[_0x091a('0x4')][_0x091a('0x12')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db['SugarcrmConfiguration']=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0xac'));db[_0x091a('0xad')]=db['sequelize'][_0x091a('0x12')](_0x091a('0xae'));db[_0x091a('0xaf')]=db[_0x091a('0x4')][_0x091a('0x12')]('../api/intDeskAccount/intDeskAccount.model');db['DeskConfiguration']=db[_0x091a('0x4')]['import'](_0x091a('0xb0'));db['DeskField']=db[_0x091a('0x4')]['import'](_0x091a('0xb1'));db[_0x091a('0xb2')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0xb3'));db[_0x091a('0xb4')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0xb5'));db[_0x091a('0xb6')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0xb7'));db[_0x091a('0xb8')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0xb9'));db[_0x091a('0xba')]=db[_0x091a('0x4')][_0x091a('0x12')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0x091a('0xbb')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0xbc'));db[_0x091a('0xbd')]=db['sequelize'][_0x091a('0x12')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0x091a('0xbe')]=db[_0x091a('0x4')]['import'](_0x091a('0xbf'));db['FreshdeskField']=db[_0x091a('0x4')]['import'](_0x091a('0xc0'));db[_0x091a('0xc1')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0xc2'));db['VtigerConfiguration']=db['sequelize'][_0x091a('0x12')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db['VtigerField']=db['sequelize']['import'](_0x091a('0xc3'));db['ServicenowAccount']=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0xc4'));db[_0x091a('0xc5')]=db[_0x091a('0x4')]['import']('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0x091a('0xc6')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0xc7'));db[_0x091a('0xc8')]=db[_0x091a('0x4')]['import'](_0x091a('0xc9'));db[_0x091a('0xca')]=db['sequelize'][_0x091a('0x12')](_0x091a('0xcb'));db[_0x091a('0xcc')]=db[_0x091a('0x4')]['import'](_0x091a('0xcd'));db[_0x091a('0xce')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0xcf'));db['FreshsalesConfiguration']=db[_0x091a('0x4')][_0x091a('0x12')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db[_0x091a('0xd0')]=db['sequelize'][_0x091a('0x12')](_0x091a('0xd1'));db[_0x091a('0xd2')]=db[_0x091a('0x4')][_0x091a('0x12')]('../api/integration/integration.model');db['Network']=db[_0x091a('0x4')][_0x091a('0x12')]('../api/network/network.model');db[_0x091a('0xd3')]=db[_0x091a('0x4')][_0x091a('0x12')]('../api/chatQueueReport/chatQueueReport.model');db[_0x091a('0xd4')]=db['sequelize'][_0x091a('0x12')](_0x091a('0xd5'));db[_0x091a('0xd6')]=db['sequelize'][_0x091a('0x12')](_0x091a('0xd7'));db['JscriptyQuestionReport']=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0xd8'));db['JscriptySessionReport']=db[_0x091a('0x4')]['import']('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0x091a('0xd9')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0xda'));db[_0x091a('0xdb')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0xdc'));db[_0x091a('0xdd')]=db['sequelize'][_0x091a('0x12')](_0x091a('0xde'));db[_0x091a('0xdf')]=db['sequelize']['import'](_0x091a('0xe0'));db[_0x091a('0xe1')]=db[_0x091a('0x4')][_0x091a('0x12')]('../api/setting/setting.model');db['SquareOdbc']=db[_0x091a('0x4')][_0x091a('0x12')]('../api/squareOdbc/squareOdbc.model');db[_0x091a('0xe2')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0xe3'));db[_0x091a('0xe4')]=db[_0x091a('0x4')][_0x091a('0x12')]('../api/squareRecording/squareRecording.model');db[_0x091a('0xe5')]=db[_0x091a('0x4')][_0x091a('0x12')]('../api/squareMessage/squareMessage.model');db[_0x091a('0xe6')]=db[_0x091a('0x4')]['import'](_0x091a('0xe7'));db['License']=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0xe8'));db[_0x091a('0xe9')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0xea'));db['Migration']=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0xeb'));db['Attachment']=db[_0x091a('0x4')]['import']('../api/attachment/attachment.model');db['Plugin']=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0xec'));db[_0x091a('0xed')]=db[_0x091a('0x4')][_0x091a('0x12')]('../api/mailTransferReport/mailTransferReport.model');db[_0x091a('0xee')]=db[_0x091a('0x4')][_0x091a('0x12')]('../api/chatTransferReport/chatTransferReport.model');db[_0x091a('0xef')]=db['sequelize']['import'](_0x091a('0xf0'));db[_0x091a('0xf1')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0xf2'));db['SmsTransferReport']=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0xf3'));db[_0x091a('0xf4')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0xf5'));db[_0x091a('0xf6')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0xf7'));db[_0x091a('0xf8')]=db[_0x091a('0x4')]['import'](_0x091a('0xf9'));db['UserProfileSection']=db['sequelize'][_0x091a('0x12')]('../api/userProfileSection/userProfileSection.model');db[_0x091a('0xfa')]=db[_0x091a('0x4')]['import'](_0x091a('0xfb'));db[_0x091a('0xfc')]=db[_0x091a('0x4')][_0x091a('0x12')]('../api/userNotification/userNotification.model');db['WhatsappAccount']=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0xfd'));db[_0x091a('0xfe')]=db['sequelize'][_0x091a('0x12')](_0x091a('0xff'));db[_0x091a('0x100')]=db[_0x091a('0x4')][_0x091a('0x12')]('../api/whatsappInteraction/whatsappInteraction.model');db[_0x091a('0x101')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x102'));db['WhatsappQueueReport']=db[_0x091a('0x4')][_0x091a('0x12')]('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0x091a('0x103')]=db['sequelize'][_0x091a('0x12')](_0x091a('0x104'));db[_0x091a('0x105')]=db['sequelize']['import'](_0x091a('0x106'));db[_0x091a('0x107')]=db['sequelize'][_0x091a('0x12')](_0x091a('0x108'));db[_0x091a('0x109')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x10a'));db[_0x091a('0x10b')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x10c'));db[_0x091a('0x10d')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x10e'));db[_0x091a('0x10f')]=db[_0x091a('0x4')][_0x091a('0x12')]('../api/user-setting/user-setting.model');db[_0x091a('0x110')]=db[_0x091a('0x4')]['import']('../api/mailInteractionHasTag/mailInteractionHasTag.model');db[_0x091a('0x111')][_0x091a('0x112')](db[_0x091a('0x1f')],{'as':_0x091a('0x1f'),'onDelete':_0x091a('0x113'),'foreignKey':_0x091a('0x114')});db[_0x091a('0x111')][_0x091a('0x112')](db[_0x091a('0x10f')],{'as':_0x091a('0x115'),'onDelete':_0x091a('0x113'),'foreignKey':_0x091a('0x114')});db[_0x091a('0x111')]['hasMany'](db[_0x091a('0x1b')],{'as':_0x091a('0x116'),'foreignKey':_0x091a('0x114')});db[_0x091a('0x111')][_0x091a('0x117')](db['UserVoiceQueueRt'],{'as':_0x091a('0x118'),'foreignKey':'UserId'});db[_0x091a('0x111')][_0x091a('0x117')](db[_0x091a('0x17')],{'as':'Extensions','onDelete':_0x091a('0x113'),'hooks':!![]});db[_0x091a('0x111')][_0x091a('0x117')](db[_0x091a('0x7a')],{'as':_0x091a('0x119'),'foreignKey':_0x091a('0x114')});db['User'][_0x091a('0x117')](db[_0x091a('0x7b')],{'as':'HopperHistory','foreignKey':_0x091a('0x114')});db[_0x091a('0x111')][_0x091a('0x117')](db[_0x091a('0x11a')],{'as':_0x091a('0x11a'),'foreignKey':_0x091a('0x114')});db[_0x091a('0x111')][_0x091a('0x117')](db['OpenchannelInteraction'],{'as':'OpenchannelInteractions','foreignKey':_0x091a('0x114')});db[_0x091a('0x111')][_0x091a('0x117')](db[_0x091a('0x6c')],{'as':_0x091a('0x11b'),'foreignKey':_0x091a('0x114')});db[_0x091a('0x111')][_0x091a('0x117')](db['SmsInteraction'],{'as':_0x091a('0x11c'),'foreignKey':_0x091a('0x114')});db[_0x091a('0x111')][_0x091a('0x117')](db[_0x091a('0x4e')],{'as':_0x091a('0x11d'),'foreignKey':_0x091a('0x114')});db['User'][_0x091a('0x117')](db[_0x091a('0x11e')],{'as':'MailInteractions','foreignKey':_0x091a('0x114')});db[_0x091a('0x111')][_0x091a('0x117')](db[_0x091a('0x100')],{'as':'WhatsappInteractions','foreignKey':_0x091a('0x114')});db[_0x091a('0x111')]['hasMany'](db[_0x091a('0xfc')],{'as':'UserNotifications','foreignKey':_0x091a('0x11f')});db[_0x091a('0x111')][_0x091a('0x117')](db[_0x091a('0x78')],{'as':'Hoppers','foreignKey':'UserId','onDelete':_0x091a('0x120')});db['User'][_0x091a('0x121')](db[_0x091a('0xf8')],{'as':_0x091a('0xf8'),'foreignKey':_0x091a('0x122')});db[_0x091a('0x111')][_0x091a('0x123')](db[_0x091a('0x124')],{'as':_0x091a('0x125'),'through':_0x091a('0x126')});db[_0x091a('0x111')][_0x091a('0x123')](db['CmContact'],{'as':'Contacts','through':_0x091a('0x127')});db['User'][_0x091a('0x123')](db['CmList'],{'as':'Lists','through':_0x091a('0x128')});db[_0x091a('0x111')][_0x091a('0x123')](db[_0x091a('0xe6')],{'through':_0x091a('0x129')});db[_0x091a('0x111')][_0x091a('0x123')](db['MailInteraction'],{'as':'MailInteractions','through':_0x091a('0x12a')});db[_0x091a('0x111')]['belongsToMany'](db[_0x091a('0x6c')],{'as':_0x091a('0x11b'),'through':_0x091a('0x12b')});db[_0x091a('0x111')][_0x091a('0x123')](db['FaxInteraction'],{'as':'FaxInteractions','through':'user_has_fax_interactions'});db[_0x091a('0x111')][_0x091a('0x123')](db[_0x091a('0x12c')],{'as':_0x091a('0x11c'),'through':_0x091a('0x12d')});db['User'][_0x091a('0x123')](db['OpenchannelInteraction'],{'as':'OpenchannelInteractions','through':'user_has_openchannel_interactions'});db[_0x091a('0x111')][_0x091a('0x123')](db[_0x091a('0x100')],{'as':'WhatsappInteractions','through':_0x091a('0x12e')});db[_0x091a('0x111')][_0x091a('0x123')](db['VoiceQueue'],{'as':_0x091a('0x12f'),'through':_0x091a('0x30'),'required':![]});db[_0x091a('0x111')][_0x091a('0x123')](db[_0x091a('0xf6')],{'as':_0x091a('0x130'),'through':'UserVoicePrefix','required':![]});db[_0x091a('0x111')][_0x091a('0x123')](db[_0x091a('0x40')],{'as':_0x091a('0x131'),'through':_0x091a('0x34'),'required':![]});db[_0x091a('0x111')][_0x091a('0x123')](db[_0x091a('0x71')],{'as':'ChatQueues','through':_0x091a('0x32'),'required':![],'hooks':!![]});db[_0x091a('0x111')][_0x091a('0x123')](db[_0x091a('0x52')],{'as':'FaxQueues','through':'UserFaxQueue','required':![]});db[_0x091a('0x111')][_0x091a('0x123')](db[_0x091a('0x132')],{'as':_0x091a('0x133'),'through':_0x091a('0x38'),'required':![]});db['User']['belongsToMany'](db[_0x091a('0x65')],{'as':_0x091a('0x134'),'through':_0x091a('0x39'),'required':![]});db['User'][_0x091a('0x123')](db[_0x091a('0x105')],{'as':'WhatsappQueues','through':'UserWhatsappQueue','required':![]});db[_0x091a('0x111')][_0x091a('0x123')](db[_0x091a('0xf4')],{'through':_0x091a('0x128')});db['User'][_0x091a('0x123')](db[_0x091a('0x66')],{'as':'ChatWebsites','through':'user_has_chat_websites'});db['User'][_0x091a('0x123')](db[_0x091a('0x4b')],{'as':_0x091a('0x135'),'through':'user_has_fax_accounts'});db[_0x091a('0x111')][_0x091a('0x123')](db[_0x091a('0x3e')],{'as':_0x091a('0x136'),'through':'user_has_mail_accounts'});db[_0x091a('0x111')][_0x091a('0x123')](db[_0x091a('0x5d')],{'as':_0x091a('0x137'),'through':_0x091a('0x138')});db[_0x091a('0x111')][_0x091a('0x123')](db[_0x091a('0x55')],{'as':_0x091a('0x139'),'through':_0x091a('0x13a')});db[_0x091a('0x111')][_0x091a('0x123')](db[_0x091a('0x13b')],{'as':_0x091a('0x13c'),'through':_0x091a('0x13d')});db['VoiceChanSpy']['hasMany'](db[_0x091a('0x17')],{'as':_0x091a('0x13e'),'onDelete':'cascade','foreignKey':_0x091a('0x13f')});db[_0x091a('0x15')][_0x091a('0x117')](db[_0x091a('0x17')],{'onDelete':_0x091a('0x113')});db[_0x091a('0x17')]['hasMany'](db[_0x091a('0x17')],{'as':_0x091a('0x140'),'onDelete':_0x091a('0x113')});db[_0x091a('0x18')][_0x091a('0x123')](db[_0x091a('0x90')],{'as':_0x091a('0x141'),'through':_0x091a('0x142')});db[_0x091a('0x19')][_0x091a('0x117')](db[_0x091a('0x2e')],{'as':'Members','foreignKey':_0x091a('0x143')});db[_0x091a('0x19')][_0x091a('0x117')](db[_0x091a('0x78')],{'as':_0x091a('0x144'),'foreignKey':_0x091a('0x143')});db['VoiceQueue'][_0x091a('0x117')](db[_0x091a('0x7a')],{'as':_0x091a('0x119'),'foreignKey':'VoiceQueueId'});db[_0x091a('0x19')]['hasMany'](db['CmHopperHistory'],{'as':_0x091a('0x145'),'foreignKey':_0x091a('0x143')});db[_0x091a('0x19')][_0x091a('0x117')](db[_0x091a('0x11a')],{'as':'ReportAgentPreview','foreignKey':_0x091a('0x143')});db['VoiceQueue'][_0x091a('0x117')](db[_0x091a('0x79')],{'as':'HopperBlacks','foreignKey':'VoiceQueueId'});db[_0x091a('0x19')][_0x091a('0x117')](db[_0x091a('0x146')],{'as':_0x091a('0x147'),'foreignKey':_0x091a('0x143')});db[_0x091a('0x19')][_0x091a('0x121')](db[_0x091a('0x2b')],{'as':_0x091a('0x2b'),'foreignKey':'TrunkId'});db[_0x091a('0x19')]['belongsTo'](db[_0x091a('0x2b')],{'as':_0x091a('0x148'),'foreignKey':_0x091a('0x149')});db[_0x091a('0x19')][_0x091a('0x121')](db[_0x091a('0x89')],{'as':_0x091a('0x89'),'foreignKey':_0x091a('0x14a')});db['VoiceQueue'][_0x091a('0x121')](db[_0x091a('0x14b')],{'as':_0x091a('0x14c'),'foreignKey':_0x091a('0x14d')});db[_0x091a('0x19')][_0x091a('0x123')](db['CmList'],{'as':_0x091a('0x14e'),'through':_0x091a('0x14f')});db[_0x091a('0x19')][_0x091a('0x123')](db[_0x091a('0x111')],{'as':_0x091a('0x150'),'through':_0x091a('0x30')});db[_0x091a('0x19')][_0x091a('0x123')](db[_0x091a('0xe6')],{'as':'Teams','through':_0x091a('0x109')});db[_0x091a('0x19')]['belongsToMany'](db[_0x091a('0xf4')],{'as':_0x091a('0x151'),'through':_0x091a('0x152')});db[_0x091a('0x1b')][_0x091a('0x121')](db['User'],{'as':_0x091a('0x111'),'foreignKey':'UserId'});db[_0x091a('0x1d')]['belongsTo'](db[_0x091a('0x111')],{'as':_0x091a('0x111'),'foreignKey':_0x091a('0x114')});db[_0x091a('0x1f')]['hasMany'](db[_0x091a('0x153')],{'as':_0x091a('0x154'),'onDelete':'cascade','foreignKey':_0x091a('0x155'),'sourceKey':'mailbox'});db['VoiceMailMessage'][_0x091a('0x121')](db[_0x091a('0x1f')],{'foreignKey':'mailboxuser','targetKey':_0x091a('0x156')});db['VoiceCallReport'][_0x091a('0x117')](db[_0x091a('0x27')],{'as':'QueueCalls','foreignKey':_0x091a('0x157'),'constraints':![]});db['VoiceCallReport'][_0x091a('0x117')](db[_0x091a('0x25')],{'as':'AgentReports','foreignKey':'uniqueid','constraints':![]});db[_0x091a('0x158')][_0x091a('0x121')](db[_0x091a('0x111')],{'as':'User','foreignKey':_0x091a('0x114')});db['VoiceCallReport'][_0x091a('0x121')](db[_0x091a('0x77')],{'as':_0x091a('0x159'),'foreignKey':_0x091a('0x15a')});db[_0x091a('0x15b')][_0x091a('0x121')](db[_0x091a('0x3e')],{'as':_0x091a('0x3e'),'foreignKey':_0x091a('0x15c')});db['MailServerIn'][_0x091a('0x121')](db[_0x091a('0x107')],{'as':'CloudProvider','foreignKey':'CloudProviderId','onDelete':_0x091a('0x15d')});db['MailServerOut']['belongsTo'](db['MailAccount'],{'as':_0x091a('0x3e'),'foreignKey':_0x091a('0x15c')});db[_0x091a('0x15e')]['belongsTo'](db[_0x091a('0x107')],{'as':'CloudProvider','foreignKey':_0x091a('0x15f'),'onDelete':'restrict'});db['MailAccount'][_0x091a('0x112')](db[_0x091a('0x15b')],{'as':_0x091a('0x160'),'onDelete':_0x091a('0x113')});db[_0x091a('0x3e')][_0x091a('0x112')](db[_0x091a('0x15e')],{'as':_0x091a('0x161'),'onDelete':_0x091a('0x113')});db[_0x091a('0x3e')][_0x091a('0x117')](db[_0x091a('0x85')],{'as':_0x091a('0x162'),'foreignKey':_0x091a('0x15c'),'onDelete':_0x091a('0x113')});db[_0x091a('0x3e')][_0x091a('0x117')](db['CannedAnswer'],{'as':_0x091a('0x163'),'foreignKey':_0x091a('0x15c')});db[_0x091a('0x3e')][_0x091a('0x117')](db[_0x091a('0x164')],{'as':'Messages','foreignKey':_0x091a('0x15c')});db['MailAccount'][_0x091a('0x117')](db['MailInteraction'],{'as':'Interactions'});db[_0x091a('0x3e')][_0x091a('0x117')](db[_0x091a('0x45')],{'as':_0x091a('0x140'),'foreignKey':'MailAccountId','onDelete':_0x091a('0x113')});db[_0x091a('0x3e')][_0x091a('0x121')](db['CmList'],{'as':_0x091a('0x165'),'foreignKey':_0x091a('0x166')});db[_0x091a('0x3e')][_0x091a('0x121')](db[_0x091a('0x167')],{'as':_0x091a('0x167'),'foreignKey':_0x091a('0x168')});db[_0x091a('0x3e')][_0x091a('0x121')](db['Pause'],{'as':_0x091a('0x14c'),'foreignKey':_0x091a('0x14d')});db['MailAccount'][_0x091a('0x123')](db[_0x091a('0x111')],{'as':_0x091a('0x150'),'through':_0x091a('0x169')});db[_0x091a('0x40')][_0x091a('0x123')](db[_0x091a('0x111')],{'as':'Agents','through':_0x091a('0x34')});db[_0x091a('0x40')][_0x091a('0x123')](db[_0x091a('0xe6')],{'through':_0x091a('0x16a'),'as':'Teams'});db[_0x091a('0x11e')]['hasMany'](db[_0x091a('0x164')],{'as':_0x091a('0x154'),'onDelete':_0x091a('0x113'),'foreignKey':_0x091a('0x16b')});db[_0x091a('0x11e')]['belongsTo'](db[_0x091a('0x3e')],{'as':_0x091a('0x16c'),'foreignKey':_0x091a('0x15c')});db[_0x091a('0x11e')]['belongsTo'](db[_0x091a('0x77')],{'as':_0x091a('0x159'),'foreignKey':_0x091a('0x15a')});db['MailInteraction']['belongsTo'](db[_0x091a('0x111')],{'as':_0x091a('0x16d'),'foreignKey':_0x091a('0x114')});db[_0x091a('0x11e')][_0x091a('0x123')](db[_0x091a('0x16e')],{'through':_0x091a('0x16f'),'as':_0x091a('0x170')});db[_0x091a('0x11e')][_0x091a('0x123')](db['Tag'],{'through':'mail_interaction_has_tags','as':_0x091a('0x171')});db[_0x091a('0x11e')][_0x091a('0x123')](db[_0x091a('0x111')],{'as':_0x091a('0x172'),'through':'user_has_mail_interactions','foreignKey':'MailInteractionId'});db[_0x091a('0x164')][_0x091a('0x117')](db[_0x091a('0x173')],{'as':_0x091a('0x174'),'onDelete':_0x091a('0x113')});db['MailMessage'][_0x091a('0x121')](db[_0x091a('0x111')],{'as':_0x091a('0x111')});db[_0x091a('0x164')]['belongsTo'](db[_0x091a('0x77')],{'onDelete':_0x091a('0x113'),'as':_0x091a('0x159')});db[_0x091a('0x164')]['belongsTo'](db[_0x091a('0x11e')],{'as':_0x091a('0x175'),'foreignKey':_0x091a('0x16b')});db[_0x091a('0x164')][_0x091a('0x121')](db['MailAccount'],{'as':_0x091a('0x16c'),'foreignKey':_0x091a('0x15c')});db[_0x091a('0x164')][_0x091a('0x121')](db['ChatWebsite'],{'as':_0x091a('0x66'),'foreignKey':'ChatWebsiteId'});db[_0x091a('0x164')][_0x091a('0x121')](db['ChatOfflineMessage'],{'as':_0x091a('0x70'),'foreignKey':_0x091a('0x176')});db[_0x091a('0x45')]['belongsTo'](db[_0x091a('0x111')],{'onDelete':_0x091a('0x15d')});db['MailApplication']['belongsTo'](db[_0x091a('0x40')],{'onDelete':_0x091a('0x15d')});db['MailApplication'][_0x091a('0x121')](db[_0x091a('0x3e')],{'onDelete':_0x091a('0x15d')});db[_0x091a('0x45')][_0x091a('0x121')](db[_0x091a('0x89')],{'onDelete':_0x091a('0x15d'),'foreignKey':'IntervalId'});db[_0x091a('0x45')]['belongsTo'](db[_0x091a('0x16e')],{'onDelete':_0x091a('0x15d'),'foreignKey':_0x091a('0x177')});db[_0x091a('0x46')][_0x091a('0x121')](db[_0x091a('0x3e')],{});db[_0x091a('0x46')]['belongsTo'](db[_0x091a('0xf4')],{'as':'List','foreignKey':_0x091a('0x166')});db[_0x091a('0x46')][_0x091a('0x121')](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db[_0x091a('0x46')][_0x091a('0x121')](db[_0x091a('0x11e')],{});db[_0x091a('0x46')][_0x091a('0x121')](db[_0x091a('0x164')],{});db[_0x091a('0x46')][_0x091a('0x121')](db['User'],{});db['MailQueueReport'][_0x091a('0x121')](db[_0x091a('0x40')],{});db[_0x091a('0x48')][_0x091a('0x117')](db[_0x091a('0x49')],{'as':_0x091a('0x178'),'onDelete':_0x091a('0x113')});db[_0x091a('0x4b')][_0x091a('0x117')](db[_0x091a('0x85')],{'as':_0x091a('0x162'),'foreignKey':_0x091a('0x179'),'onDelete':_0x091a('0x113')});db[_0x091a('0x4b')][_0x091a('0x117')](db[_0x091a('0x83')],{'as':'Answers','foreignKey':_0x091a('0x179')});db[_0x091a('0x4b')][_0x091a('0x117')](db['FaxInteraction'],{'as':'Interactions'});db[_0x091a('0x4b')][_0x091a('0x117')](db[_0x091a('0x4d')],{'as':'Applications','foreignKey':'FaxAccountId','onDelete':_0x091a('0x113')});db[_0x091a('0x4b')][_0x091a('0x117')](db[_0x091a('0x17')],{'as':'Exntensions','onDelete':_0x091a('0x113')});db['FaxAccount']['hasMany'](db[_0x091a('0x50')],{'as':_0x091a('0x154')});db[_0x091a('0x4b')]['belongsTo'](db[_0x091a('0x2b')],{'as':_0x091a('0x2b')});db[_0x091a('0x4b')][_0x091a('0x121')](db['CmList'],{'as':'List','foreignKey':_0x091a('0x166')});db[_0x091a('0x4b')][_0x091a('0x121')](db[_0x091a('0x14b')],{'as':_0x091a('0x14c'),'foreignKey':_0x091a('0x14d')});db[_0x091a('0x4b')][_0x091a('0x123')](db[_0x091a('0x111')],{'as':_0x091a('0x150'),'through':_0x091a('0x17a')});db['FaxApplication'][_0x091a('0x121')](db[_0x091a('0x111')],{'onDelete':_0x091a('0x15d')});db[_0x091a('0x4d')]['belongsTo'](db[_0x091a('0x52')],{'onDelete':'restrict'});db[_0x091a('0x4d')][_0x091a('0x121')](db[_0x091a('0x4b')],{'onDelete':_0x091a('0x15d')});db[_0x091a('0x4d')][_0x091a('0x121')](db[_0x091a('0x16e')],{'onDelete':'restrict','foreignKey':_0x091a('0x177')});db[_0x091a('0x4e')][_0x091a('0x117')](db[_0x091a('0x50')],{'as':'Messages','onDelete':_0x091a('0x113'),'foreignKey':'FaxInteractionId'});db['FaxInteraction'][_0x091a('0x121')](db[_0x091a('0x4b')],{'as':_0x091a('0x16c'),'foreignKey':_0x091a('0x179')});db[_0x091a('0x4e')][_0x091a('0x121')](db[_0x091a('0x77')],{'as':_0x091a('0x159'),'foreignKey':_0x091a('0x15a')});db[_0x091a('0x4e')][_0x091a('0x121')](db[_0x091a('0x111')],{'as':_0x091a('0x16d'),'foreignKey':_0x091a('0x114')});db[_0x091a('0x4e')][_0x091a('0x123')](db[_0x091a('0x16e')],{'through':_0x091a('0x17b'),'as':_0x091a('0x170')});db[_0x091a('0x4e')]['belongsToMany'](db[_0x091a('0x16e')],{'through':'fax_interaction_has_tags','as':_0x091a('0x171')});db['FaxInteraction']['belongsToMany'](db['User'],{'as':_0x091a('0x172'),'through':_0x091a('0x17c'),'foreignKey':_0x091a('0x17d')});db[_0x091a('0x50')][_0x091a('0x121')](db[_0x091a('0x111')],{'onDelete':_0x091a('0x113'),'as':_0x091a('0x111')});db[_0x091a('0x50')]['belongsTo'](db[_0x091a('0x4e')],{'as':_0x091a('0x175'),'foreignKey':_0x091a('0x17d')});db[_0x091a('0x50')][_0x091a('0x121')](db[_0x091a('0x77')],{'onDelete':_0x091a('0x113'),'as':_0x091a('0x159')});db[_0x091a('0x50')][_0x091a('0x121')](db['Attachment'],{'as':_0x091a('0x173'),'foreignKey':_0x091a('0x17e')});db['FaxMessage'][_0x091a('0x121')](db[_0x091a('0x4b')],{'as':'Account','foreignKey':_0x091a('0x179')});db[_0x091a('0x52')][_0x091a('0x123')](db[_0x091a('0x111')],{'as':'Agents','through':_0x091a('0x36')});db[_0x091a('0x52')][_0x091a('0x123')](db['Team'],{'through':_0x091a('0x17f'),'as':'Teams'});db[_0x091a('0x180')][_0x091a('0x121')](db[_0x091a('0x4b')],{});db[_0x091a('0x180')][_0x091a('0x121')](db['CmList'],{'as':'List','foreignKey':_0x091a('0x166')});db[_0x091a('0x180')][_0x091a('0x121')](db[_0x091a('0x77')],{'as':_0x091a('0x159'),'foreignKey':_0x091a('0x15a')});db[_0x091a('0x180')][_0x091a('0x121')](db[_0x091a('0x4e')],{});db[_0x091a('0x180')]['belongsTo'](db['FaxMessage'],{});db[_0x091a('0x180')]['belongsTo'](db['User'],{});db[_0x091a('0x180')][_0x091a('0x121')](db['FaxQueue'],{});db[_0x091a('0x55')][_0x091a('0x117')](db['Disposition'],{'as':_0x091a('0x162'),'foreignKey':_0x091a('0x181'),'onDelete':_0x091a('0x113')});db[_0x091a('0x55')][_0x091a('0x117')](db[_0x091a('0x83')],{'as':_0x091a('0x163'),'foreignKey':_0x091a('0x181')});db[_0x091a('0x55')][_0x091a('0x117')](db[_0x091a('0x5a')],{'as':_0x091a('0x154'),'foreignKey':_0x091a('0x181')});db['SmsAccount']['hasMany'](db[_0x091a('0x12c')],{'as':_0x091a('0x182')});db[_0x091a('0x55')][_0x091a('0x117')](db['SmsApplication'],{'as':_0x091a('0x140'),'foreignKey':_0x091a('0x181'),'onDelete':_0x091a('0x113')});db[_0x091a('0x55')]['belongsTo'](db['CmList'],{'as':_0x091a('0x165'),'foreignKey':_0x091a('0x166')});db[_0x091a('0x55')][_0x091a('0x121')](db[_0x091a('0x14b')],{'as':_0x091a('0x14c'),'foreignKey':_0x091a('0x14d')});db[_0x091a('0x55')][_0x091a('0x123')](db[_0x091a('0x111')],{'as':_0x091a('0x150'),'through':'user_has_sms_accounts'});db[_0x091a('0x57')][_0x091a('0x121')](db[_0x091a('0x111')],{'onDelete':'restrict'});db[_0x091a('0x57')][_0x091a('0x121')](db[_0x091a('0x132')],{'onDelete':'restrict'});db[_0x091a('0x57')][_0x091a('0x121')](db[_0x091a('0x55')],{'onDelete':_0x091a('0x15d')});db[_0x091a('0x57')][_0x091a('0x121')](db[_0x091a('0x89')],{'onDelete':'restrict','foreignKey':_0x091a('0x14a')});db[_0x091a('0x57')][_0x091a('0x121')](db[_0x091a('0x16e')],{'onDelete':_0x091a('0x15d'),'foreignKey':_0x091a('0x177')});db[_0x091a('0x12c')][_0x091a('0x117')](db['SmsMessage'],{'as':_0x091a('0x154'),'onDelete':_0x091a('0x113'),'foreignKey':_0x091a('0x183')});db[_0x091a('0x12c')][_0x091a('0x121')](db[_0x091a('0x55')],{'as':_0x091a('0x16c'),'foreignKey':_0x091a('0x181')});db[_0x091a('0x12c')][_0x091a('0x121')](db[_0x091a('0x77')],{'as':'Contact','foreignKey':'ContactId'});db['SmsInteraction']['belongsTo'](db[_0x091a('0x111')],{'as':_0x091a('0x16d'),'foreignKey':'UserId'});db['SmsInteraction'][_0x091a('0x123')](db[_0x091a('0x16e')],{'through':_0x091a('0x184'),'as':_0x091a('0x170')});db[_0x091a('0x12c')][_0x091a('0x123')](db[_0x091a('0x16e')],{'through':_0x091a('0x184'),'as':_0x091a('0x171')});db[_0x091a('0x12c')][_0x091a('0x123')](db[_0x091a('0x111')],{'as':_0x091a('0x172'),'through':'user_has_sms_interactions','foreignKey':_0x091a('0x183')});db['SmsMessage'][_0x091a('0x121')](db[_0x091a('0x111')],{'as':_0x091a('0x111')});db[_0x091a('0x5a')]['belongsTo'](db[_0x091a('0x77')],{'onDelete':'cascade','as':_0x091a('0x159')});db['SmsMessage'][_0x091a('0x121')](db['SmsInteraction'],{'onDelete':_0x091a('0x113'),'as':_0x091a('0x175'),'foreignKey':_0x091a('0x183')});db['SmsMessage'][_0x091a('0x121')](db[_0x091a('0x55')],{'as':_0x091a('0x16c'),'foreignKey':'SmsAccountId'});db['SmsQueue'][_0x091a('0x123')](db[_0x091a('0x111')],{'as':_0x091a('0x150'),'through':_0x091a('0x38'),'foreignKey':_0x091a('0x185')});db[_0x091a('0x132')][_0x091a('0x123')](db[_0x091a('0xe6')],{'through':_0x091a('0x186'),'as':_0x091a('0x187')});db[_0x091a('0x5d')][_0x091a('0x117')](db[_0x091a('0x85')],{'as':_0x091a('0x162'),'foreignKey':_0x091a('0x188'),'onDelete':'cascade'});db['OpenchannelAccount']['hasMany'](db[_0x091a('0x83')],{'as':_0x091a('0x163'),'foreignKey':_0x091a('0x188')});db['OpenchannelAccount'][_0x091a('0x117')](db[_0x091a('0x61')],{'as':_0x091a('0x182'),'foreignKey':_0x091a('0x188')});db[_0x091a('0x5d')][_0x091a('0x117')](db[_0x091a('0x63')],{'as':_0x091a('0x154'),'foreignKey':_0x091a('0x188')});db[_0x091a('0x5d')][_0x091a('0x117')](db[_0x091a('0x5f')],{'as':_0x091a('0x140'),'foreignKey':_0x091a('0x188'),'onDelete':_0x091a('0x113')});db[_0x091a('0x5d')][_0x091a('0x121')](db[_0x091a('0xf4')],{'as':'List','foreignKey':_0x091a('0x166')});db[_0x091a('0x5d')][_0x091a('0x121')](db[_0x091a('0x14b')],{'as':_0x091a('0x14c'),'foreignKey':'mandatoryDispositionPauseId'});db['OpenchannelAccount'][_0x091a('0x123')](db[_0x091a('0x111')],{'as':_0x091a('0x150'),'through':_0x091a('0x138')});db['OpenchannelApplication'][_0x091a('0x121')](db[_0x091a('0x111')],{'onDelete':_0x091a('0x15d')});db[_0x091a('0x5f')][_0x091a('0x121')](db[_0x091a('0x65')],{'onDelete':'restrict','foreignKey':_0x091a('0x189')});db['OpenchannelApplication']['belongsTo'](db['OpenchannelAccount'],{'onDelete':_0x091a('0x15d'),'foreignKey':_0x091a('0x188')});db['OpenchannelApplication'][_0x091a('0x121')](db[_0x091a('0x89')],{'onDelete':_0x091a('0x15d'),'foreignKey':'IntervalId'});db[_0x091a('0x5f')][_0x091a('0x121')](db['Tag'],{'onDelete':_0x091a('0x15d'),'foreignKey':_0x091a('0x177')});db[_0x091a('0x61')][_0x091a('0x117')](db['OpenchannelMessage'],{'as':_0x091a('0x154'),'onDelete':'cascade','foreignKey':'OpenchannelInteractionId'});db[_0x091a('0x61')]['belongsTo'](db[_0x091a('0x5d')],{'as':_0x091a('0x16c'),'foreignKey':_0x091a('0x188')});db[_0x091a('0x61')]['belongsTo'](db[_0x091a('0x77')],{'as':'Contact','foreignKey':_0x091a('0x15a')});db[_0x091a('0x61')]['belongsTo'](db[_0x091a('0x111')],{'as':'Owner','foreignKey':_0x091a('0x114')});db['OpenchannelInteraction']['belongsToMany'](db[_0x091a('0x16e')],{'through':'openchannel_interaction_has_tags','as':_0x091a('0x170')});db[_0x091a('0x61')][_0x091a('0x123')](db[_0x091a('0x16e')],{'through':_0x091a('0x18a'),'as':'ThroughTags'});db['OpenchannelInteraction'][_0x091a('0x123')](db[_0x091a('0x111')],{'as':_0x091a('0x172'),'through':'user_has_openchannel_interactions','foreignKey':'OpenchannelInteractionId'});db[_0x091a('0x63')][_0x091a('0x121')](db[_0x091a('0x111')],{'onDelete':_0x091a('0x113'),'as':_0x091a('0x111')});db[_0x091a('0x63')][_0x091a('0x121')](db[_0x091a('0x77')],{'onDelete':_0x091a('0x113'),'as':'Contact'});db[_0x091a('0x63')][_0x091a('0x121')](db[_0x091a('0x61')],{'onDelete':_0x091a('0x113'),'as':'Interaction','foreignKey':_0x091a('0x18b')});db[_0x091a('0x63')][_0x091a('0x121')](db[_0x091a('0x173')],{'as':'Attachment','foreignKey':_0x091a('0x17e')});db[_0x091a('0x63')]['belongsTo'](db[_0x091a('0x5d')],{'as':'Account','foreignKey':_0x091a('0x188')});db[_0x091a('0x65')][_0x091a('0x123')](db['User'],{'as':_0x091a('0x150'),'through':'UserOpenchannelQueue','foreignKey':_0x091a('0x189')});db[_0x091a('0x65')][_0x091a('0x123')](db[_0x091a('0xe6')],{'through':_0x091a('0x18c'),'as':_0x091a('0x187')});db[_0x091a('0x66')]['hasMany'](db[_0x091a('0x85')],{'as':_0x091a('0x162'),'foreignKey':_0x091a('0x18d'),'onDelete':_0x091a('0x113')});db['ChatWebsite']['hasMany'](db[_0x091a('0x83')],{'as':_0x091a('0x163'),'foreignKey':_0x091a('0x18d')});db[_0x091a('0x66')][_0x091a('0x117')](db['ChatProactiveAction'],{'as':_0x091a('0x18e')});db[_0x091a('0x66')][_0x091a('0x117')](db[_0x091a('0x6c')],{'as':_0x091a('0x182')});db['ChatWebsite'][_0x091a('0x117')](db[_0x091a('0x6a')],{'as':_0x091a('0x140'),'foreignKey':'ChatWebsiteId','onDelete':_0x091a('0x113')});db[_0x091a('0x66')]['hasMany'](db[_0x091a('0x6e')],{'as':_0x091a('0x154')});db[_0x091a('0x66')][_0x091a('0x121')](db[_0x091a('0xf4')],{'as':_0x091a('0x165'),'foreignKey':_0x091a('0x166')});db['ChatWebsite'][_0x091a('0x121')](db[_0x091a('0x89')],{'as':_0x091a('0x89'),'foreignKey':'IntervalId'});db[_0x091a('0x66')][_0x091a('0x121')](db['MailAccount'],{'as':_0x091a('0x3e'),'foreignKey':'MailAccountId'});db[_0x091a('0x66')][_0x091a('0x121')](db['Pause'],{'as':_0x091a('0x14c'),'foreignKey':'mandatoryDispositionPauseId'});db['ChatWebsite'][_0x091a('0x123')](db[_0x091a('0x111')],{'as':'Agents','through':'user_has_chat_websites'});db[_0x091a('0x68')][_0x091a('0x121')](db[_0x091a('0x5d')],{});db[_0x091a('0x68')]['belongsTo'](db['CmList'],{'as':_0x091a('0x165'),'foreignKey':_0x091a('0x166')});db[_0x091a('0x68')]['belongsTo'](db[_0x091a('0x77')],{'as':_0x091a('0x159'),'foreignKey':_0x091a('0x15a')});db[_0x091a('0x68')][_0x091a('0x121')](db['OpenchannelInteraction'],{});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelMessage'],{});db['OpenchannelQueueReport'][_0x091a('0x121')](db['User'],{});db[_0x091a('0x68')][_0x091a('0x121')](db[_0x091a('0x65')],{});db[_0x091a('0x6a')][_0x091a('0x121')](db[_0x091a('0x111')],{'as':_0x091a('0x18f'),'foreignKey':_0x091a('0x114'),'onDelete':_0x091a('0x15d')});db['ChatApplication'][_0x091a('0x121')](db[_0x091a('0x71')],{'as':_0x091a('0x190'),'foreignKey':_0x091a('0x191'),'onDelete':_0x091a('0x15d')});db[_0x091a('0x6a')][_0x091a('0x121')](db[_0x091a('0x66')],{'as':_0x091a('0x192'),'foreignKey':_0x091a('0x18d'),'onDelete':'restrict'});db[_0x091a('0x6a')][_0x091a('0x121')](db[_0x091a('0x16e')],{'onDelete':_0x091a('0x15d'),'foreignKey':'TagId'});db[_0x091a('0x6c')]['hasMany'](db[_0x091a('0x6e')],{'as':_0x091a('0x154'),'onDelete':_0x091a('0x113'),'foreignKey':'ChatInteractionId'});db[_0x091a('0x6c')][_0x091a('0x121')](db[_0x091a('0x66')],{'as':_0x091a('0x16c'),'foreignKey':'ChatWebsiteId'});db[_0x091a('0x6c')][_0x091a('0x121')](db['CmContact'],{'as':_0x091a('0x159'),'foreignKey':_0x091a('0x15a')});db['ChatInteraction'][_0x091a('0x121')](db[_0x091a('0x111')],{'as':_0x091a('0x16d'),'foreignKey':_0x091a('0x114')});db[_0x091a('0x6c')][_0x091a('0x123')](db[_0x091a('0x16e')],{'through':_0x091a('0x193'),'as':_0x091a('0x170')});db['ChatInteraction'][_0x091a('0x123')](db[_0x091a('0x16e')],{'through':_0x091a('0x193'),'as':_0x091a('0x171')});db[_0x091a('0x6c')][_0x091a('0x123')](db['User'],{'as':'Users','through':_0x091a('0x12b'),'foreignKey':_0x091a('0x194')});db['ChatMessage'][_0x091a('0x121')](db[_0x091a('0x111')],{'onDelete':_0x091a('0x113'),'as':_0x091a('0x111')});db[_0x091a('0x6e')]['belongsTo'](db['CmContact'],{'onDelete':_0x091a('0x113'),'as':_0x091a('0x159'),'foreignKey':_0x091a('0x15a')});db['ChatMessage'][_0x091a('0x121')](db[_0x091a('0x6c')],{'onDelete':'cascade','as':_0x091a('0x175'),'foreignKey':_0x091a('0x194')});db[_0x091a('0x6e')][_0x091a('0x121')](db[_0x091a('0x173')],{'as':_0x091a('0x173'),'foreignKey':_0x091a('0x17e')});db[_0x091a('0x6e')][_0x091a('0x121')](db[_0x091a('0x66')],{'as':_0x091a('0x16c'),'foreignKey':_0x091a('0x18d')});db[_0x091a('0x70')]['hasMany'](db['Attachment'],{'as':'Attachments','foreignKey':'ChatOfflineMessageId','onDelete':'cascade','hooks':!![]});db['ChatOfflineMessage'][_0x091a('0x121')](db['CmContact'],{'onDelete':'cascade','as':_0x091a('0x159'),'foreignKey':_0x091a('0x15a')});db[_0x091a('0x70')][_0x091a('0x121')](db[_0x091a('0x66')],{'as':'Account','foreignKey':_0x091a('0x18d')});db['ChatQueue'][_0x091a('0x123')](db[_0x091a('0x111')],{'as':'Agents','through':'UserChatQueue','hooks':!![]});db[_0x091a('0x71')][_0x091a('0x123')](db[_0x091a('0xe6')],{'through':_0x091a('0x195'),'as':_0x091a('0x187')});db[_0x091a('0x124')][_0x091a('0x117')](db[_0x091a('0xd4')],{'as':_0x091a('0x154'),'foreignKey':'ChatGroupId','onDelete':_0x091a('0x113')});db[_0x091a('0x124')][_0x091a('0x123')](db['User'],{'as':'Members','through':_0x091a('0x126')});db[_0x091a('0x74')][_0x091a('0x121')](db['ChatWebsite'],{'as':_0x091a('0x192'),'foreignKey':_0x091a('0x18d')});db['CmCompany'][_0x091a('0x117')](db[_0x091a('0x77')],{'as':_0x091a('0x196'),'foreignKey':_0x091a('0x197')});db[_0x091a('0x77')][_0x091a('0x117')](db[_0x091a('0x93')],{'as':'Phones','foreignKey':'CmContactId'});db[_0x091a('0x77')][_0x091a('0x117')](db[_0x091a('0x78')],{'as':'Hoppers','foreignKey':_0x091a('0x15a')});db[_0x091a('0x77')]['hasMany'](db[_0x091a('0x7a')],{'as':'HopperFinals','foreignKey':'ContactId'});db[_0x091a('0x77')]['hasMany'](db[_0x091a('0x7b')],{'as':_0x091a('0x145'),'foreignKey':_0x091a('0x15a')});db['CmContact']['hasMany'](db[_0x091a('0x11a')],{'as':_0x091a('0x11a'),'foreignKey':'ContactId'});db['CmContact']['hasMany'](db[_0x091a('0x146')],{'as':_0x091a('0x147'),'foreignKey':_0x091a('0x15a')});db[_0x091a('0x77')][_0x091a('0x117')](db[_0x091a('0x61')],{'as':'OpenchannelInteractions','foreignKey':_0x091a('0x15a'),'onDelete':_0x091a('0x15d')});db[_0x091a('0x77')]['hasMany'](db[_0x091a('0x6c')],{'as':_0x091a('0x11b'),'foreignKey':'ContactId','onDelete':_0x091a('0x15d')});db['CmContact'][_0x091a('0x117')](db[_0x091a('0x12c')],{'as':'SmsInteractions','foreignKey':_0x091a('0x15a'),'onDelete':_0x091a('0x15d')});db[_0x091a('0x77')][_0x091a('0x117')](db[_0x091a('0x4e')],{'as':'FaxInteractions','foreignKey':_0x091a('0x15a'),'onDelete':_0x091a('0x15d')});db[_0x091a('0x77')][_0x091a('0x117')](db[_0x091a('0x11e')],{'as':_0x091a('0x198'),'foreignKey':_0x091a('0x15a'),'onDelete':_0x091a('0x15d')});db[_0x091a('0x77')][_0x091a('0x121')](db[_0x091a('0x76')],{'as':_0x091a('0x199'),'foreignKey':_0x091a('0x197')});db[_0x091a('0x77')][_0x091a('0x121')](db[_0x091a('0xf4')],{'as':_0x091a('0x165'),'foreignKey':_0x091a('0x166'),'onDelete':_0x091a('0x113')});db[_0x091a('0x77')][_0x091a('0x123')](db[_0x091a('0x111')],{'as':_0x091a('0x172'),'through':'cm_user_has_contacts'});db[_0x091a('0x77')]['belongsToMany'](db['Tag'],{'as':_0x091a('0x170'),'through':_0x091a('0x19a')});db['CmContact'][_0x091a('0x123')](db[_0x091a('0x16e')],{'through':_0x091a('0x19a'),'as':_0x091a('0x171')});db['CmHopper']['hasMany'](db['CmHopperAdditionalPhone'],{'as':'AdditionalPhones','foreignKey':_0x091a('0x19b')});db['CmHopper']['belongsTo'](db[_0x091a('0x77')],{'as':_0x091a('0x159'),'foreignKey':_0x091a('0x15a'),'onDelete':_0x091a('0x113')});db['CmHopper'][_0x091a('0x121')](db['CmList'],{'as':'List','foreignKey':_0x091a('0x166'),'onDelete':_0x091a('0x113')});db[_0x091a('0x78')]['belongsTo'](db[_0x091a('0x111')],{'as':'Agent','foreignKey':_0x091a('0x114')});db[_0x091a('0x78')][_0x091a('0x121')](db[_0x091a('0x19')],{'as':'Queue','foreignKey':_0x091a('0x143'),'onDelete':'cascade'});db[_0x091a('0x78')]['belongsTo'](db[_0x091a('0xe9')],{'as':_0x091a('0xe9'),'foreignKey':_0x091a('0x19c'),'onDelete':_0x091a('0x113')});db[_0x091a('0x78')][_0x091a('0x121')](db['User'],{'as':_0x091a('0x16d'),'foreignKey':_0x091a('0x19d')});db[_0x091a('0x79')][_0x091a('0x121')](db[_0x091a('0x77')],{'as':_0x091a('0x159'),'foreignKey':_0x091a('0x15a'),'onDelete':_0x091a('0x113')});db[_0x091a('0x79')][_0x091a('0x121')](db['CmList'],{'as':_0x091a('0x165'),'foreignKey':_0x091a('0x166'),'onDelete':'cascade'});db[_0x091a('0x79')][_0x091a('0x121')](db[_0x091a('0x19')],{'as':_0x091a('0x190'),'foreignKey':'VoiceQueueId','onDelete':_0x091a('0x113')});db[_0x091a('0x79')][_0x091a('0x121')](db[_0x091a('0xe9')],{'as':'Campaign','foreignKey':_0x091a('0x19c'),'onDelete':_0x091a('0x113')});db[_0x091a('0x81')]['hasMany'](db['Condition'],{'as':{'plural':'All','singular':_0x091a('0x19e')},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db['Automation'][_0x091a('0x117')](db[_0x091a('0x87')],{'as':{'plural':'Any','singular':_0x091a('0x19f')},'foreignKey':_0x091a('0x1a0'),'onDelete':_0x091a('0x113'),'hooks':!![]});db[_0x091a('0x81')][_0x091a('0x117')](db[_0x091a('0x7f')],{'as':_0x091a('0x1a1'),'foreignKey':_0x091a('0x1a2'),'onDelete':'cascade','hooks':!![]});db[_0x091a('0x85')][_0x091a('0x117')](db[_0x091a('0x85')],{'as':_0x091a('0x162'),'foreignKey':_0x091a('0x1a3'),'onDelete':_0x091a('0x113')});db[_0x091a('0x89')][_0x091a('0x117')](db[_0x091a('0x89')],{'as':_0x091a('0x1a4'),'foreignKey':'IntervalId','onDelete':_0x091a('0x113'),'hooks':!![],'required':![]});db[_0x091a('0x89')]['hasMany'](db[_0x091a('0x17')],{'as':_0x091a('0x1a5'),'foreignKey':'IntervalId','onDelete':_0x091a('0x15d')});db[_0x091a('0x89')][_0x091a('0x117')](db['MailApplication'],{'as':_0x091a('0x1a6'),'foreignKey':'IntervalId'});db['Interval'][_0x091a('0x117')](db['ChatApplication'],{'as':_0x091a('0x1a7'),'foreignKey':_0x091a('0x14a')});db['Interval']['hasMany'](db[_0x091a('0x4d')],{'as':_0x091a('0x1a8'),'foreignKey':_0x091a('0x14a')});db[_0x091a('0x89')][_0x091a('0x117')](db[_0x091a('0x57')],{'as':'SmsApplications','foreignKey':_0x091a('0x14a')});db[_0x091a('0x8f')][_0x091a('0x121')](db[_0x091a('0x3e')],{});db[_0x091a('0x8f')][_0x091a('0x121')](db[_0x091a('0x9d')],{'foreignKey':_0x091a('0x1a9')});db[_0x091a('0x8f')][_0x091a('0x121')](db[_0x091a('0x1aa')],{'foreignKey':_0x091a('0x1ab')});db[_0x091a('0x90')][_0x091a('0x123')](db[_0x091a('0x18')],{'as':_0x091a('0x1ac'),'through':_0x091a('0x142'),'onDelete':_0x091a('0x15d')});db[_0x091a('0x16e')][_0x091a('0x123')](db['CmContact'],{'through':_0x091a('0x19a')});db[_0x091a('0x16e')][_0x091a('0x123')](db[_0x091a('0x6c')],{'through':'chat_interaction_has_tags'});db[_0x091a('0x16e')][_0x091a('0x123')](db[_0x091a('0x11e')],{'through':_0x091a('0x16f')});db[_0x091a('0x16e')][_0x091a('0x123')](db[_0x091a('0x12c')],{'through':_0x091a('0x184')});db[_0x091a('0x16e')][_0x091a('0x123')](db[_0x091a('0x4e')],{'through':_0x091a('0x17b')});db[_0x091a('0x16e')]['belongsToMany'](db['OpenchannelInteraction'],{'through':'openchannel_interaction_has_tags'});db[_0x091a('0x16e')][_0x091a('0x123')](db[_0x091a('0x100')],{'through':_0x091a('0x1ad')});db[_0x091a('0x93')][_0x091a('0x121')](db[_0x091a('0x1ae')],{'as':_0x091a('0x1af'),'foreignKey':_0x091a('0x1b0')});db[_0x091a('0x95')]['belongsTo'](db[_0x091a('0x78')],{'as':'Hopper','foreignKey':_0x091a('0x19b')});db[_0x091a('0x93')][_0x091a('0x121')](db[_0x091a('0x77')],{'as':_0x091a('0x159'),'foreignKey':_0x091a('0x1b1')});db['Trigger'][_0x091a('0x117')](db['Condition'],{'as':{'plural':_0x091a('0x1b2'),'singular':_0x091a('0x1b3')},'foreignKey':'TriggerAllId','onDelete':'cascade','hooks':!![]});db[_0x091a('0x1b4')][_0x091a('0x117')](db['Condition'],{'as':{'plural':_0x091a('0x1b5'),'singular':_0x091a('0x1b6')},'foreignKey':'TriggerAnyId','onDelete':_0x091a('0x113'),'hooks':!![]});db[_0x091a('0x1b4')]['hasMany'](db[_0x091a('0x7f')],{'as':_0x091a('0x1a1'),'foreignKey':_0x091a('0x1b7'),'onDelete':_0x091a('0x113'),'hooks':!![]});db[_0x091a('0x1aa')][_0x091a('0x117')](db[_0x091a('0xa2')],{'as':'Fields','onDelete':_0x091a('0x113'),'foreignKey':_0x091a('0x1ab'),'hooks':!![]});db[_0x091a('0x9d')][_0x091a('0x117')](db[_0x091a('0xa2')],{'as':_0x091a('0x1b8'),'onDelete':_0x091a('0x113'),'foreignKey':'DefaultReportId'});db[_0x091a('0xa0')]['hasMany'](db[_0x091a('0xa2')],{'as':'Fields','onDelete':_0x091a('0x113'),'foreignKey':'MetricId'});db[_0x091a('0xa2')]['belongsTo'](db['AnalyticMetric'],{'foreignKey':_0x091a('0x1b9')});db[_0x091a('0xa5')][_0x091a('0x117')](db[_0x091a('0xa7')],{'as':_0x091a('0x1ba'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x091a('0xa7')][_0x091a('0x117')](db[_0x091a('0xa9')],{'as':_0x091a('0x1bb'),'onDelete':_0x091a('0x113'),'foreignKey':_0x091a('0x1bc')});db['SalesforceConfiguration'][_0x091a('0x117')](db[_0x091a('0xa9')],{'as':_0x091a('0x1bd'),'onDelete':'cascade','foreignKey':_0x091a('0x1be')});db['SalesforceConfiguration'][_0x091a('0x117')](db[_0x091a('0xa9')],{'as':_0x091a('0x1b8'),'onDelete':_0x091a('0x113'),'foreignKey':_0x091a('0x1bf')});db[_0x091a('0xa7')][_0x091a('0x121')](db['SalesforceAccount'],{'as':_0x091a('0x16c'),'foreignKey':_0x091a('0x1c0')});db[_0x091a('0xa9')][_0x091a('0x117')](db[_0x091a('0xa9')],{'as':_0x091a('0x1c1'),'foreignKey':_0x091a('0x1bc')});db[_0x091a('0xa9')]['hasMany'](db['SalesforceField'],{'as':_0x091a('0x1c2'),'foreignKey':_0x091a('0x1be')});db['SalesforceField'][_0x091a('0x117')](db['SalesforceField'],{'as':_0x091a('0x1c3'),'foreignKey':_0x091a('0x1bf')});db['SalesforceField'][_0x091a('0x121')](db['Variable'],{'as':_0x091a('0x97'),'foreignKey':'VariableId'});db[_0x091a('0xab')][_0x091a('0x117')](db[_0x091a('0x1c4')],{'as':_0x091a('0x1ba'),'onDelete':_0x091a('0x113'),'foreignKey':_0x091a('0x1c0')});db[_0x091a('0x1c4')]['hasMany'](db['SugarcrmField'],{'as':_0x091a('0x1bb'),'onDelete':_0x091a('0x113'),'foreignKey':_0x091a('0x1bc')});db[_0x091a('0x1c4')][_0x091a('0x117')](db['SugarcrmField'],{'as':'Descriptions','onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x091a('0x1c4')][_0x091a('0x117')](db[_0x091a('0xad')],{'as':_0x091a('0x1b8'),'onDelete':_0x091a('0x113'),'foreignKey':_0x091a('0x1bf')});db[_0x091a('0x1c4')][_0x091a('0x121')](db[_0x091a('0xab')],{'as':_0x091a('0x16c'),'foreignKey':_0x091a('0x1c0')});db[_0x091a('0xad')][_0x091a('0x117')](db[_0x091a('0xad')],{'as':_0x091a('0x1c1'),'foreignKey':'SubjectId'});db[_0x091a('0xad')][_0x091a('0x117')](db[_0x091a('0xad')],{'as':_0x091a('0x1c2'),'foreignKey':'DescriptionId'});db[_0x091a('0xad')][_0x091a('0x117')](db[_0x091a('0xad')],{'as':_0x091a('0x1c3'),'foreignKey':_0x091a('0x1bf')});db[_0x091a('0xad')][_0x091a('0x121')](db[_0x091a('0x97')],{'as':_0x091a('0x97'),'foreignKey':'VariableId'});db['DeskAccount'][_0x091a('0x117')](db[_0x091a('0x1c5')],{'as':_0x091a('0x1ba'),'onDelete':_0x091a('0x113'),'foreignKey':_0x091a('0x1c0')});db['DeskConfiguration'][_0x091a('0x117')](db[_0x091a('0x1c6')],{'as':_0x091a('0x1bb'),'onDelete':_0x091a('0x113'),'foreignKey':_0x091a('0x1bc')});db[_0x091a('0x1c5')]['hasMany'](db[_0x091a('0x1c6')],{'as':_0x091a('0x1bd'),'onDelete':'cascade','foreignKey':_0x091a('0x1be')});db['DeskConfiguration'][_0x091a('0x117')](db[_0x091a('0x1c6')],{'as':_0x091a('0x1b8'),'onDelete':_0x091a('0x113'),'foreignKey':'FieldId'});db[_0x091a('0x1c5')]['belongsTo'](db[_0x091a('0xaf')],{'as':_0x091a('0x16c'),'foreignKey':'AccountId'});db[_0x091a('0x1c5')][_0x091a('0x123')](db[_0x091a('0x16e')],{'through':'int_desk_configuration_has_tags'});db[_0x091a('0x1c6')][_0x091a('0x117')](db[_0x091a('0x1c6')],{'as':_0x091a('0x1c1'),'foreignKey':_0x091a('0x1bc')});db['DeskField'][_0x091a('0x117')](db[_0x091a('0x1c6')],{'as':_0x091a('0x1c2'),'foreignKey':_0x091a('0x1be')});db[_0x091a('0x1c6')][_0x091a('0x117')](db[_0x091a('0x1c6')],{'as':_0x091a('0x1c3'),'foreignKey':_0x091a('0x1bf')});db['DeskField'][_0x091a('0x121')](db[_0x091a('0x97')],{'as':'Variable','foreignKey':_0x091a('0x1c7')});db[_0x091a('0xb2')][_0x091a('0x117')](db[_0x091a('0xb4')],{'as':'Configurations','onDelete':'cascade','foreignKey':'AccountId'});db[_0x091a('0xb4')]['hasMany'](db['ZohoField'],{'as':'Subjects','onDelete':_0x091a('0x113'),'foreignKey':'SubjectId'});db[_0x091a('0xb4')][_0x091a('0x117')](db['ZohoField'],{'as':_0x091a('0x1bd'),'onDelete':_0x091a('0x113'),'foreignKey':'DescriptionId'});db[_0x091a('0xb4')][_0x091a('0x117')](db[_0x091a('0xb6')],{'as':_0x091a('0x1b8'),'onDelete':_0x091a('0x113'),'foreignKey':_0x091a('0x1bf')});db[_0x091a('0xb4')][_0x091a('0x121')](db['ZohoAccount'],{'as':'Account','foreignKey':_0x091a('0x1c0')});db[_0x091a('0xb6')][_0x091a('0x117')](db[_0x091a('0xb6')],{'as':_0x091a('0x1c1'),'foreignKey':'SubjectId'});db[_0x091a('0xb6')][_0x091a('0x117')](db['ZohoField'],{'as':_0x091a('0x1c2'),'foreignKey':_0x091a('0x1be')});db[_0x091a('0xb6')]['hasMany'](db[_0x091a('0xb6')],{'as':_0x091a('0x1c3'),'foreignKey':'FieldId'});db[_0x091a('0xb6')][_0x091a('0x121')](db['Variable'],{'as':'Variable','foreignKey':_0x091a('0x1c7')});db['ZendeskAccount'][_0x091a('0x117')](db[_0x091a('0xba')],{'as':_0x091a('0x1ba'),'onDelete':_0x091a('0x113'),'foreignKey':_0x091a('0x1c0')});db[_0x091a('0xba')][_0x091a('0x117')](db[_0x091a('0xbb')],{'as':_0x091a('0x1bb'),'foreignKey':_0x091a('0x1bc')});db[_0x091a('0xba')][_0x091a('0x117')](db['ZendeskField'],{'as':'Descriptions','foreignKey':_0x091a('0x1be')});db['ZendeskConfiguration']['hasMany'](db[_0x091a('0xbb')],{'as':'Fields','foreignKey':_0x091a('0x1bf')});db[_0x091a('0xba')]['belongsTo'](db[_0x091a('0xb8')],{'as':'Account','foreignKey':'AccountId'});db[_0x091a('0xba')][_0x091a('0x123')](db[_0x091a('0x16e')],{'through':_0x091a('0x1c8')});db[_0x091a('0xbb')][_0x091a('0x117')](db[_0x091a('0xbb')],{'as':_0x091a('0x1c1'),'foreignKey':_0x091a('0x1bc')});db[_0x091a('0xbb')][_0x091a('0x117')](db[_0x091a('0xbb')],{'as':_0x091a('0x1c2'),'foreignKey':_0x091a('0x1be')});db['ZendeskField'][_0x091a('0x117')](db['ZendeskField'],{'as':_0x091a('0x1c3'),'foreignKey':_0x091a('0x1bf')});db['ZendeskField'][_0x091a('0x121')](db[_0x091a('0x97')],{'as':_0x091a('0x97'),'foreignKey':'VariableId'});db[_0x091a('0xbd')][_0x091a('0x117')](db['FreshdeskConfiguration'],{'as':'Configurations','onDelete':_0x091a('0x113'),'foreignKey':_0x091a('0x1c0')});db['FreshdeskConfiguration'][_0x091a('0x117')](db[_0x091a('0x1c9')],{'as':_0x091a('0x1bb'),'onDelete':_0x091a('0x113'),'foreignKey':_0x091a('0x1bc')});db['FreshdeskConfiguration'][_0x091a('0x117')](db[_0x091a('0x1c9')],{'as':'Descriptions','onDelete':_0x091a('0x113'),'foreignKey':_0x091a('0x1be')});db[_0x091a('0xbe')][_0x091a('0x117')](db[_0x091a('0x1c9')],{'as':_0x091a('0x1b8'),'onDelete':'cascade','foreignKey':_0x091a('0x1bf')});db['FreshdeskConfiguration'][_0x091a('0x121')](db[_0x091a('0xbd')],{'as':_0x091a('0x16c'),'foreignKey':_0x091a('0x1c0')});db['FreshdeskConfiguration'][_0x091a('0x123')](db[_0x091a('0x16e')],{'through':'int_freshdesk_configuration_has_tags'});db[_0x091a('0x1c9')][_0x091a('0x117')](db['FreshdeskField'],{'as':_0x091a('0x1c1'),'foreignKey':_0x091a('0x1bc')});db[_0x091a('0x1c9')][_0x091a('0x117')](db[_0x091a('0x1c9')],{'as':_0x091a('0x1c2'),'foreignKey':_0x091a('0x1be')});db['FreshdeskField'][_0x091a('0x117')](db['FreshdeskField'],{'as':'Field','foreignKey':'FieldId'});db['FreshdeskField'][_0x091a('0x121')](db[_0x091a('0x97')],{'as':_0x091a('0x97'),'foreignKey':_0x091a('0x1c7')});db['VtigerAccount'][_0x091a('0x117')](db[_0x091a('0x1ca')],{'as':_0x091a('0x1ba'),'onDelete':'cascade','foreignKey':_0x091a('0x1c0')});db['VtigerConfiguration']['hasMany'](db['VtigerField'],{'as':'Subjects','foreignKey':_0x091a('0x1bc')});db[_0x091a('0x1ca')][_0x091a('0x117')](db[_0x091a('0x1cb')],{'as':_0x091a('0x1bd'),'foreignKey':_0x091a('0x1be')});db[_0x091a('0x1ca')]['hasMany'](db[_0x091a('0x1cb')],{'as':_0x091a('0x1b8'),'foreignKey':'FieldId'});db[_0x091a('0x1ca')][_0x091a('0x121')](db[_0x091a('0xc1')],{'as':'Account','foreignKey':_0x091a('0x1c0')});db[_0x091a('0x1cb')]['hasMany'](db[_0x091a('0x1cb')],{'as':_0x091a('0x1c1'),'foreignKey':'SubjectId'});db[_0x091a('0x1cb')]['hasMany'](db[_0x091a('0x1cb')],{'as':_0x091a('0x1c2'),'foreignKey':_0x091a('0x1be')});db[_0x091a('0x1cb')][_0x091a('0x117')](db[_0x091a('0x1cb')],{'as':'Field','foreignKey':'FieldId'});db[_0x091a('0x1cb')][_0x091a('0x121')](db[_0x091a('0x97')],{'as':'Variable','foreignKey':_0x091a('0x1c7')});db[_0x091a('0x1cc')][_0x091a('0x117')](db[_0x091a('0xc5')],{'as':_0x091a('0x1ba'),'onDelete':_0x091a('0x113'),'foreignKey':_0x091a('0x1c0')});db[_0x091a('0xc5')]['hasMany'](db[_0x091a('0xc6')],{'as':_0x091a('0x1bb'),'foreignKey':_0x091a('0x1bc')});db[_0x091a('0xc5')][_0x091a('0x117')](db['ServicenowField'],{'as':_0x091a('0x1bd'),'foreignKey':_0x091a('0x1be')});db[_0x091a('0xc5')][_0x091a('0x117')](db[_0x091a('0xc6')],{'as':_0x091a('0x1b8'),'foreignKey':_0x091a('0x1bf')});db[_0x091a('0xc5')][_0x091a('0x121')](db[_0x091a('0x1cc')],{'as':_0x091a('0x16c'),'foreignKey':_0x091a('0x1c0')});db['ServicenowField'][_0x091a('0x117')](db['ServicenowField'],{'as':_0x091a('0x1c1'),'foreignKey':_0x091a('0x1bc')});db[_0x091a('0xc6')][_0x091a('0x117')](db[_0x091a('0xc6')],{'as':_0x091a('0x1c2'),'foreignKey':_0x091a('0x1be')});db[_0x091a('0xc6')][_0x091a('0x117')](db['ServicenowField'],{'as':_0x091a('0x1c3'),'foreignKey':_0x091a('0x1bf')});db['ServicenowField'][_0x091a('0x121')](db[_0x091a('0x97')],{'as':_0x091a('0x97'),'foreignKey':'VariableId'});db[_0x091a('0xc8')][_0x091a('0x117')](db[_0x091a('0xca')],{'as':_0x091a('0x1ba'),'onDelete':'cascade','foreignKey':_0x091a('0x1c0')});db[_0x091a('0xc8')][_0x091a('0x121')](db[_0x091a('0x107')],{'as':_0x091a('0x107'),'foreignKey':_0x091a('0x15f')});db[_0x091a('0xca')][_0x091a('0x117')](db[_0x091a('0xcc')],{'as':_0x091a('0x1bb'),'onDelete':_0x091a('0x113'),'foreignKey':'SubjectId'});db[_0x091a('0xca')][_0x091a('0x117')](db[_0x091a('0xcc')],{'as':_0x091a('0x1bd'),'onDelete':'cascade','foreignKey':_0x091a('0x1be')});db['Dynamics365Configuration']['hasMany'](db['Dynamics365Field'],{'as':_0x091a('0x1b8'),'onDelete':_0x091a('0x113'),'foreignKey':'FieldId'});db[_0x091a('0xca')][_0x091a('0x121')](db['Dynamics365Account'],{'as':_0x091a('0x16c'),'foreignKey':'AccountId'});db[_0x091a('0xcc')][_0x091a('0x117')](db[_0x091a('0xcc')],{'as':_0x091a('0x1c1'),'foreignKey':_0x091a('0x1bc')});db[_0x091a('0xcc')][_0x091a('0x117')](db[_0x091a('0xcc')],{'as':_0x091a('0x1c2'),'foreignKey':_0x091a('0x1be')});db['Dynamics365Field'][_0x091a('0x117')](db[_0x091a('0xcc')],{'as':_0x091a('0x1c3'),'foreignKey':'FieldId'});db[_0x091a('0xcc')]['belongsTo'](db[_0x091a('0x97')],{'as':_0x091a('0x97'),'foreignKey':_0x091a('0x1c7')});db['FreshsalesAccount'][_0x091a('0x117')](db[_0x091a('0x1cd')],{'as':_0x091a('0x1ba'),'onDelete':_0x091a('0x113'),'foreignKey':_0x091a('0x1c0')});db[_0x091a('0x1cd')][_0x091a('0x117')](db[_0x091a('0xd0')],{'as':_0x091a('0x1bb'),'foreignKey':'SubjectId'});db[_0x091a('0x1cd')]['hasMany'](db['FreshsalesField'],{'as':'Descriptions','foreignKey':_0x091a('0x1be')});db[_0x091a('0x1cd')]['hasMany'](db[_0x091a('0xd0')],{'as':_0x091a('0x1b8'),'foreignKey':_0x091a('0x1bf')});db['FreshsalesConfiguration'][_0x091a('0x121')](db[_0x091a('0xce')],{'as':_0x091a('0x16c'),'foreignKey':_0x091a('0x1c0')});db[_0x091a('0xd0')][_0x091a('0x117')](db[_0x091a('0xd0')],{'as':'Subject','foreignKey':_0x091a('0x1bc')});db[_0x091a('0xd0')][_0x091a('0x117')](db[_0x091a('0xd0')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x091a('0xd0')][_0x091a('0x117')](db[_0x091a('0xd0')],{'as':_0x091a('0x1c3'),'foreignKey':_0x091a('0x1bf')});db[_0x091a('0xd0')][_0x091a('0x121')](db['Variable'],{'as':_0x091a('0x97'),'foreignKey':_0x091a('0x1c7')});db[_0x091a('0xd3')]['belongsTo'](db[_0x091a('0x66')],{});db[_0x091a('0xd3')][_0x091a('0x121')](db[_0x091a('0xf4')],{'as':_0x091a('0x165'),'foreignKey':'ListId'});db['ChatQueueReport'][_0x091a('0x121')](db['CmContact'],{'as':'Contact','foreignKey':_0x091a('0x15a')});db['ChatQueueReport'][_0x091a('0x121')](db[_0x091a('0x6c')],{});db[_0x091a('0xd3')][_0x091a('0x121')](db[_0x091a('0x6e')],{});db['ChatQueueReport']['belongsTo'](db['User'],{});db[_0x091a('0xd3')][_0x091a('0x121')](db[_0x091a('0x71')],{});db[_0x091a('0xd4')][_0x091a('0x121')](db[_0x091a('0x111')],{'onDelete':'cascade','foreignKey':_0x091a('0x1ce')});db[_0x091a('0xd4')]['belongsTo'](db[_0x091a('0x111')],{'onDelete':'cascade','foreignKey':'ToId'});db[_0x091a('0x146')]['hasMany'](db['JscriptyQuestionReport'],{'foreignKey':_0x091a('0x1cf'),'onDelete':_0x091a('0x113')});db[_0x091a('0x146')]['hasMany'](db['JscriptyAnswerReport'],{'foreignKey':_0x091a('0x1cf'),'onDelete':_0x091a('0x113')});db[_0x091a('0xd9')]['belongsTo'](db[_0x091a('0x55')],{});db[_0x091a('0xd9')][_0x091a('0x121')](db[_0x091a('0xf4')],{'as':_0x091a('0x165'),'foreignKey':_0x091a('0x166')});db[_0x091a('0xd9')][_0x091a('0x121')](db[_0x091a('0x77')],{'as':_0x091a('0x159'),'foreignKey':_0x091a('0x15a')});db['SmsQueueReport'][_0x091a('0x121')](db[_0x091a('0x12c')],{});db[_0x091a('0xd9')][_0x091a('0x121')](db[_0x091a('0x5a')],{});db[_0x091a('0xd9')][_0x091a('0x121')](db[_0x091a('0x111')],{});db[_0x091a('0xd9')][_0x091a('0x121')](db[_0x091a('0x132')],{});db[_0x091a('0xdf')][_0x091a('0x117')](db[_0x091a('0x146')],{'foreignKey':_0x091a('0x1d0')});db[_0x091a('0xdf')][_0x091a('0x117')](db[_0x091a('0x1d1')],{'foreignKey':'ProjectId'});db[_0x091a('0xdf')][_0x091a('0x117')](db[_0x091a('0xd6')],{'foreignKey':_0x091a('0x1d0')});db['Team'][_0x091a('0x123')](db[_0x091a('0x111')],{'as':_0x091a('0x150'),'through':_0x091a('0x129')});db[_0x091a('0xe6')][_0x091a('0x123')](db['VoiceQueue'],{'through':_0x091a('0x109'),'as':_0x091a('0x12f')});db['Team'][_0x091a('0x123')](db['MailQueue'],{'through':_0x091a('0x16a'),'as':_0x091a('0x131')});db['Team'][_0x091a('0x123')](db['ChatQueue'],{'through':_0x091a('0x195'),'as':_0x091a('0x1d2')});db[_0x091a('0xe6')][_0x091a('0x123')](db[_0x091a('0x52')],{'through':_0x091a('0x17f'),'as':_0x091a('0x1d3')});db[_0x091a('0xe6')][_0x091a('0x123')](db['SmsQueue'],{'through':_0x091a('0x186'),'as':_0x091a('0x133')});db['Team'][_0x091a('0x123')](db[_0x091a('0x65')],{'through':_0x091a('0x18c'),'as':_0x091a('0x134')});db[_0x091a('0xe6')][_0x091a('0x123')](db[_0x091a('0x105')],{'through':_0x091a('0x1d4'),'as':'WhatsappQueues'});db[_0x091a('0xe6')]['belongsToMany'](db[_0x091a('0xf6')],{'through':_0x091a('0x10b'),'as':_0x091a('0x130')});db[_0x091a('0xe9')][_0x091a('0x117')](db[_0x091a('0x78')],{'as':_0x091a('0x144'),'foreignKey':'CampaignId'});db[_0x091a('0xe9')][_0x091a('0x117')](db[_0x091a('0x7a')],{'as':'HopperFinals','foreignKey':'CampaignId'});db[_0x091a('0xe9')][_0x091a('0x117')](db[_0x091a('0x7b')],{'as':_0x091a('0x145'),'foreignKey':'CampaignId'});db[_0x091a('0xe9')][_0x091a('0x117')](db[_0x091a('0x79')],{'as':_0x091a('0x1d5'),'foreignKey':_0x091a('0x19c')});db[_0x091a('0xe9')][_0x091a('0x121')](db['Trunk'],{'as':_0x091a('0x2b'),'foreignKey':_0x091a('0x1d6')});db['Campaign'][_0x091a('0x121')](db['Trunk'],{'as':_0x091a('0x148'),'foreignKey':_0x091a('0x149')});db[_0x091a('0xe9')][_0x091a('0x121')](db['Interval'],{'as':_0x091a('0x89'),'foreignKey':_0x091a('0x14a')});db[_0x091a('0xe9')][_0x091a('0x121')](db['SquareProject'],{'as':_0x091a('0xe2'),'foreignKey':_0x091a('0x1d7')});db[_0x091a('0xe9')][_0x091a('0x123')](db[_0x091a('0xf4')],{'as':_0x091a('0x14e'),'through':_0x091a('0x1d8')});db[_0x091a('0xe9')]['belongsToMany'](db[_0x091a('0xf4')],{'as':_0x091a('0x151'),'through':_0x091a('0x1d9')});db[_0x091a('0x173')]['belongsTo'](db[_0x091a('0x70')],{'as':_0x091a('0x70'),'foreignKey':_0x091a('0x176')});db[_0x091a('0xed')]['belongsTo'](db[_0x091a('0x164')],{});db[_0x091a('0xed')][_0x091a('0x121')](db[_0x091a('0x11e')],{});db['MailTransferReport']['belongsTo'](db[_0x091a('0x3e')],{'foreignKey':_0x091a('0x1da'),'as':'FromAccount'});db[_0x091a('0xed')][_0x091a('0x121')](db[_0x091a('0x111')],{'foreignKey':_0x091a('0x1db'),'as':'FromAgent'});db[_0x091a('0xed')][_0x091a('0x121')](db[_0x091a('0x111')],{'foreignKey':_0x091a('0x1dc'),'as':_0x091a('0x1dd')});db[_0x091a('0xed')]['belongsTo'](db[_0x091a('0x40')],{'foreignKey':_0x091a('0x1de'),'as':_0x091a('0x1df')});db[_0x091a('0xed')][_0x091a('0x121')](db['MailAccount'],{'foreignKey':_0x091a('0x1e0'),'as':_0x091a('0x1e1')});db[_0x091a('0xee')][_0x091a('0x121')](db['ChatMessage'],{});db[_0x091a('0xee')][_0x091a('0x121')](db[_0x091a('0x6c')],{});db[_0x091a('0xee')][_0x091a('0x121')](db[_0x091a('0x66')],{'foreignKey':_0x091a('0x1e2'),'as':_0x091a('0x1e3')});db[_0x091a('0xee')][_0x091a('0x121')](db['User'],{'foreignKey':'FromUserId','as':_0x091a('0x1e4')});db['ChatTransferReport'][_0x091a('0x121')](db[_0x091a('0x111')],{'foreignKey':_0x091a('0x1dc'),'as':_0x091a('0x1dd')});db['ChatTransferReport']['belongsTo'](db[_0x091a('0x71')],{'foreignKey':_0x091a('0x1e5'),'as':_0x091a('0x1df')});db['ChatTransferReport']['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x091a('0x1e6'),'as':_0x091a('0x1e1')});db[_0x091a('0xef')][_0x091a('0x121')](db[_0x091a('0x50')],{});db[_0x091a('0xef')]['belongsTo'](db[_0x091a('0x4e')],{});db[_0x091a('0xef')][_0x091a('0x121')](db['FaxAccount'],{'foreignKey':'FromFaxAccountId','as':_0x091a('0x1e3')});db[_0x091a('0xef')][_0x091a('0x121')](db[_0x091a('0x111')],{'foreignKey':_0x091a('0x1db'),'as':_0x091a('0x1e4')});db[_0x091a('0xef')][_0x091a('0x121')](db[_0x091a('0x111')],{'foreignKey':_0x091a('0x1dc'),'as':'ToAgent'});db[_0x091a('0xef')][_0x091a('0x121')](db[_0x091a('0x52')],{'foreignKey':_0x091a('0x1e7'),'as':'ToQueue'});db[_0x091a('0xef')][_0x091a('0x121')](db[_0x091a('0x4b')],{'foreignKey':_0x091a('0x1e8'),'as':'ToAccount'});db[_0x091a('0xf1')][_0x091a('0x121')](db[_0x091a('0x63')],{});db[_0x091a('0xf1')][_0x091a('0x121')](db[_0x091a('0x61')],{});db[_0x091a('0xf1')][_0x091a('0x121')](db[_0x091a('0x5d')],{'foreignKey':'FromOpenchannelAccountId','as':_0x091a('0x1e3')});db[_0x091a('0xf1')][_0x091a('0x121')](db['User'],{'foreignKey':_0x091a('0x1db'),'as':'FromAgent'});db['OpenchannelTransferReport'][_0x091a('0x121')](db[_0x091a('0x111')],{'foreignKey':_0x091a('0x1dc'),'as':_0x091a('0x1dd')});db[_0x091a('0xf1')][_0x091a('0x121')](db['OpenchannelQueue'],{'foreignKey':_0x091a('0x1e9'),'as':_0x091a('0x1df')});db[_0x091a('0xf1')][_0x091a('0x121')](db['OpenchannelAccount'],{'foreignKey':_0x091a('0x1ea'),'as':'ToAccount'});db[_0x091a('0x1eb')]['belongsTo'](db[_0x091a('0x5a')],{});db['SmsTransferReport'][_0x091a('0x121')](db[_0x091a('0x12c')],{});db[_0x091a('0x1eb')][_0x091a('0x121')](db[_0x091a('0x55')],{'foreignKey':_0x091a('0x1ec'),'as':'FromAccount'});db[_0x091a('0x1eb')][_0x091a('0x121')](db[_0x091a('0x111')],{'foreignKey':'FromUserId','as':_0x091a('0x1e4')});db[_0x091a('0x1eb')][_0x091a('0x121')](db[_0x091a('0x111')],{'foreignKey':_0x091a('0x1dc'),'as':_0x091a('0x1dd')});db[_0x091a('0x1eb')]['belongsTo'](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':_0x091a('0x1df')});db[_0x091a('0x1eb')][_0x091a('0x121')](db['SmsAccount'],{'foreignKey':_0x091a('0x1ed'),'as':_0x091a('0x1e1')});db[_0x091a('0xf4')][_0x091a('0x117')](db['Disposition'],{'as':_0x091a('0x162'),'foreignKey':_0x091a('0x166'),'onDelete':_0x091a('0x113')});db[_0x091a('0xf4')][_0x091a('0x117')](db['CmCustomField'],{'as':_0x091a('0x1ee'),'foreignKey':_0x091a('0x166')});db[_0x091a('0xf4')][_0x091a('0x117')](db['CmContact'],{'as':_0x091a('0x196'),'onDelete':_0x091a('0x113'),'foreignKey':_0x091a('0x166')});db[_0x091a('0xf4')][_0x091a('0x117')](db[_0x091a('0x7a')],{'as':_0x091a('0x119'),'foreignKey':_0x091a('0x166')});db['CmList']['hasMany'](db[_0x091a('0x7b')],{'as':_0x091a('0x1ef'),'foreignKey':_0x091a('0x166')});db[_0x091a('0xf4')]['hasMany'](db[_0x091a('0x11a')],{'as':_0x091a('0x11a'),'foreignKey':'ListId'});db[_0x091a('0xf4')][_0x091a('0x123')](db[_0x091a('0x19')],{'as':_0x091a('0x1f0'),'through':'voice_queues_has_cm_lists'});db[_0x091a('0xf4')]['belongsToMany'](db['User'],{'as':_0x091a('0x150'),'through':_0x091a('0x128')});db[_0x091a('0xf6')][_0x091a('0x117')](db[_0x091a('0x17')],{'as':_0x091a('0x1a5'),'onDelete':_0x091a('0x113')});db['VoicePrefix'][_0x091a('0x123')](db[_0x091a('0x111')],{'as':_0x091a('0x150'),'through':'UserVoicePrefix'});db[_0x091a('0xf6')][_0x091a('0x123')](db['Team'],{'through':_0x091a('0x10b'),'as':_0x091a('0x187')});db['UserProfile']['hasMany'](db[_0x091a('0x111')],{'as':'Users','foreignKey':_0x091a('0x122')});db[_0x091a('0xf8')]['hasMany'](db[_0x091a('0x1f1')],{'as':'UserProfileSections','foreignKey':_0x091a('0x122'),'onDelete':_0x091a('0x113')});db[_0x091a('0x1f1')][_0x091a('0x117')](db['UserProfileResource'],{'as':_0x091a('0x1f2'),'foreignKey':_0x091a('0x1f3'),'onDelete':_0x091a('0x113')});db['WhatsappAccount'][_0x091a('0x117')](db[_0x091a('0x85')],{'as':_0x091a('0x162'),'foreignKey':_0x091a('0x1f4'),'onDelete':_0x091a('0x113')});db['WhatsappAccount'][_0x091a('0x117')](db[_0x091a('0x83')],{'as':_0x091a('0x163'),'foreignKey':'WhatsappAccountId'});db[_0x091a('0x13b')][_0x091a('0x117')](db[_0x091a('0x101')],{'as':'Messages','foreignKey':_0x091a('0x1f4')});db['WhatsappAccount'][_0x091a('0x117')](db[_0x091a('0x100')],{'as':_0x091a('0x182')});db[_0x091a('0x13b')][_0x091a('0x117')](db['WhatsappApplication'],{'as':_0x091a('0x140'),'foreignKey':_0x091a('0x1f4'),'onDelete':'cascade'});db['WhatsappAccount'][_0x091a('0x121')](db['CmList'],{'as':_0x091a('0x165'),'foreignKey':'ListId'});db[_0x091a('0x13b')][_0x091a('0x121')](db[_0x091a('0x14b')],{'as':_0x091a('0x14c'),'foreignKey':_0x091a('0x14d')});db[_0x091a('0x13b')][_0x091a('0x123')](db['User'],{'as':_0x091a('0x150'),'through':_0x091a('0x13d')});db['WhatsappApplication']['belongsTo'](db[_0x091a('0x111')],{'onDelete':_0x091a('0x15d')});db[_0x091a('0xfe')][_0x091a('0x121')](db[_0x091a('0x105')],{'onDelete':_0x091a('0x15d')});db[_0x091a('0xfe')][_0x091a('0x121')](db[_0x091a('0x13b')],{'onDelete':_0x091a('0x15d')});db[_0x091a('0xfe')]['belongsTo'](db[_0x091a('0x89')],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0x091a('0xfe')][_0x091a('0x121')](db['Tag'],{'onDelete':'restrict','foreignKey':_0x091a('0x177')});db[_0x091a('0x100')][_0x091a('0x117')](db[_0x091a('0x101')],{'as':_0x091a('0x154'),'onDelete':'cascade','foreignKey':_0x091a('0x1f5')});db['WhatsappInteraction'][_0x091a('0x121')](db[_0x091a('0x13b')],{'as':_0x091a('0x16c'),'foreignKey':_0x091a('0x1f4')});db[_0x091a('0x100')]['belongsTo'](db[_0x091a('0x77')],{'as':_0x091a('0x159'),'foreignKey':'ContactId'});db['WhatsappInteraction'][_0x091a('0x121')](db['User'],{'as':_0x091a('0x16d'),'foreignKey':_0x091a('0x114')});db[_0x091a('0x100')][_0x091a('0x123')](db[_0x091a('0x16e')],{'through':_0x091a('0x1ad'),'as':_0x091a('0x170')});db[_0x091a('0x100')][_0x091a('0x123')](db[_0x091a('0x16e')],{'through':'whatsapp_interaction_has_tags','as':_0x091a('0x171')});db[_0x091a('0x100')]['belongsToMany'](db[_0x091a('0x111')],{'as':_0x091a('0x172'),'through':_0x091a('0x12e'),'foreignKey':_0x091a('0x1f5')});db[_0x091a('0x101')][_0x091a('0x121')](db[_0x091a('0x111')],{'as':_0x091a('0x111')});db['WhatsappMessage'][_0x091a('0x121')](db[_0x091a('0x77')],{'onDelete':_0x091a('0x113'),'as':'Contact'});db[_0x091a('0x101')][_0x091a('0x121')](db[_0x091a('0x100')],{'onDelete':'cascade','as':_0x091a('0x175'),'foreignKey':_0x091a('0x1f5')});db[_0x091a('0x101')][_0x091a('0x121')](db[_0x091a('0x13b')],{'as':'Account','foreignKey':_0x091a('0x1f4')});db[_0x091a('0x1f6')][_0x091a('0x121')](db['WhatsappAccount'],{});db[_0x091a('0x1f6')]['belongsTo'](db[_0x091a('0xf4')],{'as':_0x091a('0x165'),'foreignKey':_0x091a('0x166')});db[_0x091a('0x1f6')][_0x091a('0x121')](db['CmContact'],{'as':'Contact','foreignKey':_0x091a('0x15a')});db[_0x091a('0x1f6')][_0x091a('0x121')](db[_0x091a('0x100')],{});db[_0x091a('0x1f6')][_0x091a('0x121')](db[_0x091a('0x105')],{});db[_0x091a('0x1f6')]['belongsTo'](db[_0x091a('0x101')],{});db[_0x091a('0x1f6')]['belongsTo'](db[_0x091a('0x111')],{});db[_0x091a('0x103')][_0x091a('0x121')](db[_0x091a('0x101')],{});db[_0x091a('0x103')][_0x091a('0x121')](db[_0x091a('0x100')],{});db[_0x091a('0x103')][_0x091a('0x121')](db[_0x091a('0x13b')],{'foreignKey':_0x091a('0x1f7'),'as':_0x091a('0x1e3')});db[_0x091a('0x103')][_0x091a('0x121')](db[_0x091a('0x13b')],{'foreignKey':'ToWhatsappAccountId','as':_0x091a('0x1e1')});db[_0x091a('0x103')][_0x091a('0x121')](db[_0x091a('0x105')],{'foreignKey':_0x091a('0x1f8'),'as':_0x091a('0x1df')});db[_0x091a('0x103')][_0x091a('0x121')](db['User'],{'foreignKey':_0x091a('0x1db'),'as':'FromAgent'});db['WhatsappTransferReport'][_0x091a('0x121')](db[_0x091a('0x111')],{'foreignKey':_0x091a('0x1dc'),'as':_0x091a('0x1dd')});db['WhatsappQueue']['belongsToMany'](db[_0x091a('0x111')],{'as':'Agents','through':_0x091a('0x3a'),'foreignKey':_0x091a('0x1f9')});db['WhatsappQueue'][_0x091a('0x123')](db[_0x091a('0xe6')],{'through':_0x091a('0x1d4'),'as':_0x091a('0x187')});db['UserSetting'][_0x091a('0x121')](db[_0x091a('0x111')],{'as':'user','foreignKey':_0x091a('0x114'),'onDelete':'cascade','hooks':!![]});db[_0x091a('0x107')][_0x091a('0x112')](db[_0x091a('0xc8')],{'as':_0x091a('0xc8'),'onDelete':'restrict'});db[_0x091a('0x107')]['hasOne'](db['MailServerIn'],{'as':_0x091a('0x160'),'onDelete':_0x091a('0x15d')});db['CloudProvider'][_0x091a('0x112')](db['MailServerOut'],{'as':_0x091a('0x161'),'onDelete':'restrict'});module[_0x091a('0x1fa')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index aad4817..17081e8 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4745=['./api/voiceCallReport','./api/voiceAgentReport','/api/voice/queues/reports','/api/members/reports','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/mailServerOut','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','/api/mail/applications','./api/mailApplication','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/faxAccount','/api/fax/applications','/api/fax/interactions','/api/fax/queues','./api/faxQueueReport','/api/sms/accounts','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','./api/smsMessage','/api/sms/queues','./api/smsQueue','./api/openchannelAccount','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','/api/cm/hopper_black','/api/cm/hopper_final','/api/cm/hopper_history','./api/cmCustomField','./api/action','/api/automations','/api/canned_answers','./api/cannedAnswer','./api/condition','./api/interval','./api/pause','/api/voiceQueuesLog','/api/schedules','./api/schedule','./api/sound','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','/api/triggers','./api/trigger','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','/api/integrations/sugarcrm/accounts','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/zoho/accounts','/api/integrations/zoho/configurations','./api/intZohoConfiguration','./api/intZohoField','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','./api/intZendeskField','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','/api/integrations/vtiger/configurations','/api/integrations/vtiger/fields','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','/api/integrations/freshsales/configurations','/api/chat/reports/queue','./api/chatQueueReport','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptySessionReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/messages','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','./api/migration','/api/attachments','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','./api/whatsappInteraction','/api/whatsapp/messages','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','./api/realtime','/api/user-settings','./api/user-setting','/api/mail_interaction_has_tags','./api/mailInteractionHasTag','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','./api/rpc','/api/version','/api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','static','root','/www','join','/demo','/snippet','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','path','express','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','then','use','/api/users','/api/voice/chanspy','./api/voiceContext','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','/api/voice/calls/reports'];(function(_0x28e25c,_0x1bcef7){var _0x21eb1c=function(_0x3026b8){while(--_0x3026b8){_0x28e25c['push'](_0x28e25c['shift']());}};_0x21eb1c(++_0x1bcef7);}(_0x4745,0x1e7));var _0x5474=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x4745[_0x19e35c];return _0x3e1fe8;};'use strict';var path=require(_0x5474('0x0'));var express=require(_0x5474('0x1'));var errors=require(_0x5474('0x2'));var config=require(_0x5474('0x3'));var setupLoggers=require(_0x5474('0x4'))[_0x5474('0x5')];var clientSideLogs=require(_0x5474('0x6'));exports[_0x5474('0x7')]=function(_0x28d8aa){return setupLoggers(_0x28d8aa)[_0x5474('0x8')](function(){_0x28d8aa[_0x5474('0x9')](_0x5474('0xa'),require('./api/user'));_0x28d8aa[_0x5474('0x9')](_0x5474('0xb'),require('./api/voiceChanSpy'));_0x28d8aa[_0x5474('0x9')]('/api/voice/contexts',require(_0x5474('0xc')));_0x28d8aa[_0x5474('0x9')]('/api/voice/extensions',require(_0x5474('0xd')));_0x28d8aa[_0x5474('0x9')](_0x5474('0xe'),require(_0x5474('0xf')));_0x28d8aa[_0x5474('0x9')](_0x5474('0x10'),require(_0x5474('0x11')));_0x28d8aa[_0x5474('0x9')]('/api/voice/recordings',require(_0x5474('0x12')));_0x28d8aa[_0x5474('0x9')](_0x5474('0x13'),require(_0x5474('0x14')));_0x28d8aa[_0x5474('0x9')](_0x5474('0x15'),require(_0x5474('0x16')));_0x28d8aa[_0x5474('0x9')](_0x5474('0x17'),require('./api/voiceMailMessage'));_0x28d8aa[_0x5474('0x9')](_0x5474('0x18'),require(_0x5474('0x19')));_0x28d8aa[_0x5474('0x9')]('/api/voice/dials/reports',require('./api/voiceDialReport'));_0x28d8aa['use']('/api/voice/agents/reports',require(_0x5474('0x1a')));_0x28d8aa[_0x5474('0x9')](_0x5474('0x1b'),require('./api/voiceQueueReport'));_0x28d8aa[_0x5474('0x9')](_0x5474('0x1c'),require('./api/memberReport'));_0x28d8aa[_0x5474('0x9')](_0x5474('0x1d'),require(_0x5474('0x1e')));_0x28d8aa[_0x5474('0x9')](_0x5474('0x1f'),require('./api/voiceTransferReport'));_0x28d8aa[_0x5474('0x9')]('/api/mail/out_servers',require(_0x5474('0x20')));_0x28d8aa[_0x5474('0x9')]('/api/mail/accounts',require('./api/mailAccount'));_0x28d8aa['use'](_0x5474('0x21'),require(_0x5474('0x22')));_0x28d8aa[_0x5474('0x9')](_0x5474('0x23'),require(_0x5474('0x24')));_0x28d8aa[_0x5474('0x9')](_0x5474('0x25'),require(_0x5474('0x26')));_0x28d8aa[_0x5474('0x9')](_0x5474('0x27'),require('./api/mailMessage'));_0x28d8aa['use'](_0x5474('0x28'),require(_0x5474('0x29')));_0x28d8aa[_0x5474('0x9')]('/api/mail/reports/queue',require(_0x5474('0x2a')));_0x28d8aa['use'](_0x5474('0x2b'),require(_0x5474('0x2c')));_0x28d8aa['use'](_0x5474('0x2d'),require('./api/dashboardItem'));_0x28d8aa[_0x5474('0x9')]('/api/fax/accounts',require(_0x5474('0x2e')));_0x28d8aa[_0x5474('0x9')](_0x5474('0x2f'),require('./api/faxApplication'));_0x28d8aa[_0x5474('0x9')](_0x5474('0x30'),require('./api/faxInteraction'));_0x28d8aa['use']('/api/fax/messages',require('./api/faxMessage'));_0x28d8aa[_0x5474('0x9')](_0x5474('0x31'),require('./api/faxQueue'));_0x28d8aa[_0x5474('0x9')]('/api/fax/reports/queue',require(_0x5474('0x32')));_0x28d8aa['use'](_0x5474('0x33'),require('./api/smsAccount'));_0x28d8aa[_0x5474('0x9')]('/api/sms/applications',require(_0x5474('0x34')));_0x28d8aa[_0x5474('0x9')](_0x5474('0x35'),require(_0x5474('0x36')));_0x28d8aa['use']('/api/sms/messages',require(_0x5474('0x37')));_0x28d8aa[_0x5474('0x9')](_0x5474('0x38'),require(_0x5474('0x39')));_0x28d8aa['use']('/api/openchannel/accounts',require(_0x5474('0x3a')));_0x28d8aa[_0x5474('0x9')]('/api/openchannel/applications',require(_0x5474('0x3b')));_0x28d8aa[_0x5474('0x9')](_0x5474('0x3c'),require(_0x5474('0x3d')));_0x28d8aa['use'](_0x5474('0x3e'),require(_0x5474('0x3f')));_0x28d8aa[_0x5474('0x9')]('/api/openchannel/queues',require(_0x5474('0x40')));_0x28d8aa[_0x5474('0x9')](_0x5474('0x41'),require(_0x5474('0x42')));_0x28d8aa['use']('/api/openchannel/reports/queue',require(_0x5474('0x43')));_0x28d8aa[_0x5474('0x9')](_0x5474('0x44'),require(_0x5474('0x45')));_0x28d8aa['use'](_0x5474('0x46'),require(_0x5474('0x47')));_0x28d8aa[_0x5474('0x9')](_0x5474('0x48'),require('./api/chatMessage'));_0x28d8aa['use']('/api/chat/offline_messages',require(_0x5474('0x49')));_0x28d8aa['use'](_0x5474('0x4a'),require(_0x5474('0x4b')));_0x28d8aa[_0x5474('0x9')](_0x5474('0x4c'),require(_0x5474('0x4d')));_0x28d8aa[_0x5474('0x9')](_0x5474('0x4e'),require(_0x5474('0x4f')));_0x28d8aa[_0x5474('0x9')]('/api/cm/companies',require(_0x5474('0x50')));_0x28d8aa[_0x5474('0x9')](_0x5474('0x51'),require(_0x5474('0x52')));_0x28d8aa['use'](_0x5474('0x53'),require('./api/cmHopper'));_0x28d8aa[_0x5474('0x9')](_0x5474('0x54'),require('./api/cmHopperBlack'));_0x28d8aa[_0x5474('0x9')](_0x5474('0x55'),require('./api/cmHopperFinal'));_0x28d8aa[_0x5474('0x9')](_0x5474('0x56'),require('./api/cmHopperHistory'));_0x28d8aa[_0x5474('0x9')]('/api/cm/custom_fields',require(_0x5474('0x57')));_0x28d8aa[_0x5474('0x9')]('/api/actions',require(_0x5474('0x58')));_0x28d8aa[_0x5474('0x9')](_0x5474('0x59'),require('./api/automation'));_0x28d8aa[_0x5474('0x9')](_0x5474('0x5a'),require(_0x5474('0x5b')));_0x28d8aa[_0x5474('0x9')]('/api/dispositions',require('./api/disposition'));_0x28d8aa[_0x5474('0x9')]('/api/conditions',require(_0x5474('0x5c')));_0x28d8aa[_0x5474('0x9')]('/api/intervals',require(_0x5474('0x5d')));_0x28d8aa[_0x5474('0x9')]('/api/pauses',require(_0x5474('0x5e')));_0x28d8aa[_0x5474('0x9')]('/api/cdr',require('./api/cdr'));_0x28d8aa[_0x5474('0x9')](_0x5474('0x5f'),require('./api/voiceQueuesLog'));_0x28d8aa[_0x5474('0x9')](_0x5474('0x60'),require(_0x5474('0x61')));_0x28d8aa[_0x5474('0x9')]('/api/sounds',require(_0x5474('0x62')));_0x28d8aa[_0x5474('0x9')]('/api/tags',require(_0x5474('0x63')));_0x28d8aa[_0x5474('0x9')](_0x5474('0x64'),require(_0x5474('0x65')));_0x28d8aa[_0x5474('0x9')](_0x5474('0x66'),require(_0x5474('0x67')));_0x28d8aa[_0x5474('0x9')](_0x5474('0x68'),require(_0x5474('0x69')));_0x28d8aa[_0x5474('0x9')](_0x5474('0x6a'),require('./api/template'));_0x28d8aa[_0x5474('0x9')](_0x5474('0x6b'),require(_0x5474('0x6c')));_0x28d8aa[_0x5474('0x9')]('/api/variables',require(_0x5474('0x6d')));_0x28d8aa[_0x5474('0x9')](_0x5474('0x6e'),require(_0x5474('0x6f')));_0x28d8aa[_0x5474('0x9')](_0x5474('0x70'),require(_0x5474('0x71')));_0x28d8aa[_0x5474('0x9')](_0x5474('0x72'),require(_0x5474('0x73')));_0x28d8aa[_0x5474('0x9')](_0x5474('0x74'),require(_0x5474('0x75')));_0x28d8aa['use']('/api/analytics/extracted_reports',require('./api/analyticExtractedReport'));_0x28d8aa[_0x5474('0x9')](_0x5474('0x76'),require(_0x5474('0x77')));_0x28d8aa[_0x5474('0x9')](_0x5474('0x78'),require(_0x5474('0x79')));_0x28d8aa[_0x5474('0x9')](_0x5474('0x7a'),require(_0x5474('0x7b')));_0x28d8aa[_0x5474('0x9')]('/api/integrations/salesforce/accounts',require(_0x5474('0x7c')));_0x28d8aa[_0x5474('0x9')](_0x5474('0x7d'),require(_0x5474('0x7e')));_0x28d8aa[_0x5474('0x9')](_0x5474('0x7f'),require('./api/intSalesforceField'));_0x28d8aa['use'](_0x5474('0x80'),require('./api/intSugarcrmAccount'));_0x28d8aa[_0x5474('0x9')](_0x5474('0x81'),require(_0x5474('0x82')));_0x28d8aa['use'](_0x5474('0x83'),require('./api/intSugarcrmField'));_0x28d8aa[_0x5474('0x9')](_0x5474('0x84'),require(_0x5474('0x85')));_0x28d8aa[_0x5474('0x9')](_0x5474('0x86'),require(_0x5474('0x87')));_0x28d8aa[_0x5474('0x9')]('/api/integrations/desk/fields',require('./api/intDeskField'));_0x28d8aa[_0x5474('0x9')](_0x5474('0x88'),require('./api/intZohoAccount'));_0x28d8aa[_0x5474('0x9')](_0x5474('0x89'),require(_0x5474('0x8a')));_0x28d8aa['use']('/api/integrations/zoho/fields',require(_0x5474('0x8b')));_0x28d8aa['use'](_0x5474('0x8c'),require('./api/intZendeskAccount'));_0x28d8aa[_0x5474('0x9')](_0x5474('0x8d'),require(_0x5474('0x8e')));_0x28d8aa['use']('/api/integrations/zendesk/fields',require(_0x5474('0x8f')));_0x28d8aa[_0x5474('0x9')]('/api/integrations/freshdesk/accounts',require(_0x5474('0x90')));_0x28d8aa[_0x5474('0x9')](_0x5474('0x91'),require(_0x5474('0x92')));_0x28d8aa[_0x5474('0x9')](_0x5474('0x93'),require('./api/intFreshdeskField'));_0x28d8aa[_0x5474('0x9')](_0x5474('0x94'),require('./api/intVtigerAccount'));_0x28d8aa[_0x5474('0x9')](_0x5474('0x95'),require('./api/intVtigerConfiguration'));_0x28d8aa['use'](_0x5474('0x96'),require('./api/intVtigerField'));_0x28d8aa[_0x5474('0x9')](_0x5474('0x97'),require(_0x5474('0x98')));_0x28d8aa[_0x5474('0x9')](_0x5474('0x99'),require(_0x5474('0x9a')));_0x28d8aa['use']('/api/integrations/servicenow/fields',require(_0x5474('0x9b')));_0x28d8aa[_0x5474('0x9')](_0x5474('0x9c'),require(_0x5474('0x9d')));_0x28d8aa[_0x5474('0x9')](_0x5474('0x9e'),require(_0x5474('0x9f')));_0x28d8aa[_0x5474('0x9')](_0x5474('0xa0'),require(_0x5474('0xa1')));_0x28d8aa['use'](_0x5474('0xa2'),require('./api/intFreshsalesAccount'));_0x28d8aa[_0x5474('0x9')](_0x5474('0xa3'),require('./api/intFreshsalesConfiguration'));_0x28d8aa[_0x5474('0x9')]('/api/integrations/freshsales/fields',require('./api/intFreshsalesField'));_0x28d8aa[_0x5474('0x9')]('/api/networks',require('./api/network'));_0x28d8aa[_0x5474('0x9')](_0x5474('0xa4'),require(_0x5474('0xa5')));_0x28d8aa[_0x5474('0x9')]('/api/chat/internal/messages',require(_0x5474('0xa6')));_0x28d8aa[_0x5474('0x9')](_0x5474('0xa7'),require(_0x5474('0xa8')));_0x28d8aa[_0x5474('0x9')](_0x5474('0xa9'),require('./api/jscriptyQuestionReport'));_0x28d8aa[_0x5474('0x9')]('/api/jscripty/sessions/reports',require(_0x5474('0xaa')));_0x28d8aa[_0x5474('0x9')]('/api/sms/reports/queue',require('./api/smsQueueReport'));_0x28d8aa[_0x5474('0x9')](_0x5474('0xab'),require(_0x5474('0xac')));_0x28d8aa[_0x5474('0x9')](_0x5474('0xad'),require(_0x5474('0xae')));_0x28d8aa[_0x5474('0x9')]('/api/jscripty/projects',require('./api/jscriptyProject'));_0x28d8aa[_0x5474('0x9')](_0x5474('0xaf'),require(_0x5474('0xb0')));_0x28d8aa[_0x5474('0x9')](_0x5474('0xb1'),require(_0x5474('0xb2')));_0x28d8aa[_0x5474('0x9')](_0x5474('0xb3'),require(_0x5474('0xb4')));_0x28d8aa['use']('/api/square/recordings',require('./api/squareRecording'));_0x28d8aa['use'](_0x5474('0xb5'),require('./api/squareMessage'));_0x28d8aa[_0x5474('0x9')](_0x5474('0xb6'),require(_0x5474('0xb7')));_0x28d8aa[_0x5474('0x9')](_0x5474('0xb8'),require(_0x5474('0xb9')));_0x28d8aa['use'](_0x5474('0xba'),require(_0x5474('0xbb')));_0x28d8aa[_0x5474('0x9')]('/api/migrations',require(_0x5474('0xbc')));_0x28d8aa[_0x5474('0x9')](_0x5474('0xbd'),require('./api/attachment'));_0x28d8aa[_0x5474('0x9')](_0x5474('0xbe'),require(_0x5474('0xbf')));_0x28d8aa[_0x5474('0x9')](_0x5474('0xc0'),require(_0x5474('0xc1')));_0x28d8aa[_0x5474('0x9')]('/api/chat/reports/transfer',require(_0x5474('0xc2')));_0x28d8aa[_0x5474('0x9')](_0x5474('0xc3'),require(_0x5474('0xc4')));_0x28d8aa[_0x5474('0x9')]('/api/openchannel/reports/transfer',require(_0x5474('0xc5')));_0x28d8aa[_0x5474('0x9')](_0x5474('0xc6'),require(_0x5474('0xc7')));_0x28d8aa[_0x5474('0x9')]('/api/cm/lists',require(_0x5474('0xc8')));_0x28d8aa[_0x5474('0x9')](_0x5474('0xc9'),require(_0x5474('0xca')));_0x28d8aa[_0x5474('0x9')](_0x5474('0xcb'),require(_0x5474('0xcc')));_0x28d8aa[_0x5474('0x9')](_0x5474('0xcd'),require('./api/userProfileSection'));_0x28d8aa['use'](_0x5474('0xce'),require(_0x5474('0xcf')));_0x28d8aa[_0x5474('0x9')](_0x5474('0xd0'),require(_0x5474('0xd1')));_0x28d8aa[_0x5474('0x9')]('/api/whatsapp/accounts',require(_0x5474('0xd2')));_0x28d8aa['use'](_0x5474('0xd3'),require(_0x5474('0xd4')));_0x28d8aa[_0x5474('0x9')]('/api/whatsapp/interactions',require(_0x5474('0xd5')));_0x28d8aa[_0x5474('0x9')](_0x5474('0xd6'),require('./api/whatsappMessage'));_0x28d8aa[_0x5474('0x9')](_0x5474('0xd7'),require(_0x5474('0xd8')));_0x28d8aa['use']('/api/whatsapp/reports/transfer',require('./api/whatsappTransferReport'));_0x28d8aa[_0x5474('0x9')](_0x5474('0xd9'),require(_0x5474('0xda')));_0x28d8aa[_0x5474('0x9')](_0x5474('0xdb'),require(_0x5474('0xdc')));_0x28d8aa[_0x5474('0x9')]('/api/realtime',require(_0x5474('0xdd')));_0x28d8aa[_0x5474('0x9')](_0x5474('0xde'),require(_0x5474('0xdf')));_0x28d8aa[_0x5474('0x9')](_0x5474('0xe0'),require(_0x5474('0xe1')));_0x28d8aa[_0x5474('0x9')](_0x5474('0xe2'),require(_0x5474('0xe3')));_0x28d8aa[_0x5474('0x9')](_0x5474('0xe4'),require(_0x5474('0xe5')));_0x28d8aa[_0x5474('0x9')](_0x5474('0xe6'),require(_0x5474('0xe7')));_0x28d8aa[_0x5474('0x9')](_0x5474('0xe8'),require(_0x5474('0xe9')));_0x28d8aa[_0x5474('0x9')]('/api/rpc',require(_0x5474('0xea')));_0x28d8aa[_0x5474('0x9')](_0x5474('0xeb'),require('./api/version'));_0x28d8aa['use'](_0x5474('0xec'),require('./api/system'));_0x28d8aa[_0x5474('0x9')](_0x5474('0xed'),require(_0x5474('0xee')));_0x28d8aa[_0x5474('0x9')](_0x5474('0xef'),require(_0x5474('0xf0')));_0x28d8aa[_0x5474('0x9')](_0x5474('0xf1'),clientSideLogs);_0x28d8aa[_0x5474('0x9')](_0x5474('0xf2'),express[_0x5474('0xf3')](path['join'](config[_0x5474('0xf4')],_0x5474('0xf2'))));_0x28d8aa[_0x5474('0x9')](_0x5474('0xf5'),express[_0x5474('0xf3')](path[_0x5474('0xf6')](config['root'],_0x5474('0xf5'))));_0x28d8aa['use'](_0x5474('0xf7'),express['static'](path[_0x5474('0xf6')](config[_0x5474('0xf4')],_0x5474('0xf7'))));_0x28d8aa[_0x5474('0x9')](_0x5474('0xf8'),express[_0x5474('0xf3')](path[_0x5474('0xf6')](config[_0x5474('0xf4')],'snippet','3.13.0')));_0x28d8aa[_0x5474('0x9')]('/plugins',express[_0x5474('0xf3')](path['join'](config['root'],_0x5474('0xf9'))));_0x28d8aa[_0x5474('0xfa')](_0x5474('0xfb'))[_0x5474('0xfc')](errors[0x194]);_0x28d8aa['route']('/*')[_0x5474('0xfc')](function(_0x22e42d,_0x50fa68){_0x50fa68[_0x5474('0xfd')](path[_0x5474('0xfe')](_0x28d8aa[_0x5474('0xfc')](_0x5474('0xff'))+'/index.html'));});return _0x28d8aa;});}; \ No newline at end of file +var _0xb145=['/api/canned_answers','/api/dispositions','./api/disposition','/api/intervals','./api/pause','/api/cdr','./api/cdr','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','/api/triggers','./api/trigger','/api/variables','./api/variable','./api/integration','./api/integrationReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','./api/intVtigerField','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','./api/intServicenowField','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','./api/intDynamics365Field','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','./api/team','/api/license','./api/license','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','./api/mailTransferReport','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','./api/user-setting','/api/mail_interaction_has_tags','./api/mailInteractionHasTag','/api/auth/local','/api/auth/activedirectory','./api/authActiveDirectory','/api/rpc','./api/rpc','/api/system','/api/pm2','/apidoc','join','/www','static','root','/demo','/snippet','snippet','3.13.0','/plugins','/server/files/plugins','route','get','sendFile','resolve','/index.html','express','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','use','/api/users','./api/user','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','./api/voiceExtension','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','./api/faxQueue','./api/smsAccount','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','/api/sms/queues','./api/smsQueue','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','/api/chat/applications','./api/chatApplication','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','/api/cm/contacts','./api/cmHopper','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','./api/cmHopperHistory','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation'];(function(_0x1359c9,_0x5b4e08){var _0x11873e=function(_0x842904){while(--_0x842904){_0x1359c9['push'](_0x1359c9['shift']());}};_0x11873e(++_0x5b4e08);}(_0xb145,0xa3));var _0x5b14=function(_0x129cc2,_0xbf4323){_0x129cc2=_0x129cc2-0x0;var _0x1c3d7e=_0xb145[_0x129cc2];return _0x1c3d7e;};'use strict';var path=require('path');var express=require(_0x5b14('0x0'));var errors=require(_0x5b14('0x1'));var config=require(_0x5b14('0x2'));var setupLoggers=require(_0x5b14('0x3'))[_0x5b14('0x4')];var clientSideLogs=require(_0x5b14('0x5'));exports[_0x5b14('0x6')]=function(_0x34b4cd){return setupLoggers(_0x34b4cd)['then'](function(){_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x8'),require(_0x5b14('0x9')));_0x34b4cd[_0x5b14('0x7')]('/api/voice/chanspy',require(_0x5b14('0xa')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0xb'),require(_0x5b14('0xc')));_0x34b4cd[_0x5b14('0x7')]('/api/voice/extensions',require(_0x5b14('0xd')));_0x34b4cd[_0x5b14('0x7')]('/api/voice/mohs',require(_0x5b14('0xe')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0xf'),require(_0x5b14('0x10')));_0x34b4cd[_0x5b14('0x7')]('/api/voice/recordings',require(_0x5b14('0x11')));_0x34b4cd['use'](_0x5b14('0x12'),require(_0x5b14('0x13')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x14'),require(_0x5b14('0x15')));_0x34b4cd[_0x5b14('0x7')]('/api/voice/mails/messages',require(_0x5b14('0x16')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x17'),require(_0x5b14('0x18')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x19'),require(_0x5b14('0x1a')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x1b'),require(_0x5b14('0x1c')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x1d'),require('./api/voiceQueueReport'));_0x34b4cd[_0x5b14('0x7')]('/api/members/reports',require('./api/memberReport'));_0x34b4cd['use'](_0x5b14('0x1e'),require(_0x5b14('0x1f')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x20'),require(_0x5b14('0x21')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x22'),require('./api/mailServerOut'));_0x34b4cd['use']('/api/mail/accounts',require(_0x5b14('0x23')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x24'),require(_0x5b14('0x25')));_0x34b4cd['use'](_0x5b14('0x26'),require(_0x5b14('0x27')));_0x34b4cd['use'](_0x5b14('0x28'),require(_0x5b14('0x29')));_0x34b4cd['use'](_0x5b14('0x2a'),require('./api/mailMessage'));_0x34b4cd['use']('/api/mail/applications',require('./api/mailApplication'));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x2b'),require(_0x5b14('0x2c')));_0x34b4cd['use'](_0x5b14('0x2d'),require(_0x5b14('0x2e')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x2f'),require(_0x5b14('0x30')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x31'),require(_0x5b14('0x32')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x33'),require(_0x5b14('0x34')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x35'),require(_0x5b14('0x36')));_0x34b4cd['use'](_0x5b14('0x37'),require(_0x5b14('0x38')));_0x34b4cd['use']('/api/fax/queues',require(_0x5b14('0x39')));_0x34b4cd[_0x5b14('0x7')]('/api/fax/reports/queue',require('./api/faxQueueReport'));_0x34b4cd[_0x5b14('0x7')]('/api/sms/accounts',require(_0x5b14('0x3a')));_0x34b4cd[_0x5b14('0x7')]('/api/sms/applications',require('./api/smsApplication'));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x3b'),require(_0x5b14('0x3c')));_0x34b4cd['use'](_0x5b14('0x3d'),require('./api/smsMessage'));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x3e'),require(_0x5b14('0x3f')));_0x34b4cd[_0x5b14('0x7')]('/api/openchannel/accounts',require(_0x5b14('0x40')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x41'),require(_0x5b14('0x42')));_0x34b4cd['use'](_0x5b14('0x43'),require(_0x5b14('0x44')));_0x34b4cd[_0x5b14('0x7')]('/api/openchannel/messages',require(_0x5b14('0x45')));_0x34b4cd['use'](_0x5b14('0x46'),require(_0x5b14('0x47')));_0x34b4cd['use'](_0x5b14('0x48'),require(_0x5b14('0x49')));_0x34b4cd['use'](_0x5b14('0x4a'),require('./api/openchannelQueueReport'));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x4b'),require(_0x5b14('0x4c')));_0x34b4cd[_0x5b14('0x7')]('/api/chat/interactions',require(_0x5b14('0x4d')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x4e'),require(_0x5b14('0x4f')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x50'),require(_0x5b14('0x51')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x52'),require(_0x5b14('0x53')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x54'),require(_0x5b14('0x55')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x56'),require(_0x5b14('0x57')));_0x34b4cd['use'](_0x5b14('0x58'),require('./api/cmCompany'));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x59'),require('./api/cmContact'));_0x34b4cd['use']('/api/cm/hopper',require(_0x5b14('0x5a')));_0x34b4cd[_0x5b14('0x7')]('/api/cm/hopper_black',require(_0x5b14('0x5b')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x5c'),require(_0x5b14('0x5d')));_0x34b4cd[_0x5b14('0x7')]('/api/cm/hopper_history',require(_0x5b14('0x5e')));_0x34b4cd[_0x5b14('0x7')]('/api/cm/custom_fields',require(_0x5b14('0x5f')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x60'),require(_0x5b14('0x61')));_0x34b4cd['use'](_0x5b14('0x62'),require(_0x5b14('0x63')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x64'),require('./api/cannedAnswer'));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x65'),require(_0x5b14('0x66')));_0x34b4cd[_0x5b14('0x7')]('/api/conditions',require('./api/condition'));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x67'),require('./api/interval'));_0x34b4cd[_0x5b14('0x7')]('/api/pauses',require(_0x5b14('0x68')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x69'),require(_0x5b14('0x6a')));_0x34b4cd[_0x5b14('0x7')]('/api/voiceQueuesLog',require(_0x5b14('0x6b')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x6c'),require(_0x5b14('0x6d')));_0x34b4cd[_0x5b14('0x7')]('/api/sounds',require('./api/sound'));_0x34b4cd[_0x5b14('0x7')]('/api/tags',require('./api/tag'));_0x34b4cd['use'](_0x5b14('0x6e'),require(_0x5b14('0x6f')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x70'),require(_0x5b14('0x71')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x72'),require('./api/cmHopperAdditionalPhone'));_0x34b4cd['use']('/api/templates',require('./api/template'));_0x34b4cd['use'](_0x5b14('0x73'),require(_0x5b14('0x74')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x75'),require(_0x5b14('0x76')));_0x34b4cd['use']('/api/integrations',require(_0x5b14('0x77')));_0x34b4cd[_0x5b14('0x7')]('/api/integrations/reports',require(_0x5b14('0x78')));_0x34b4cd[_0x5b14('0x7')]('/api/analytics/custom_reports',require('./api/analyticCustomReport'));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x79'),require(_0x5b14('0x7a')));_0x34b4cd['use'](_0x5b14('0x7b'),require(_0x5b14('0x7c')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x7d'),require(_0x5b14('0x7e')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x7f'),require('./api/analyticFieldReport'));_0x34b4cd[_0x5b14('0x7')]('/api/analytics/tree_reports',require(_0x5b14('0x80')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x81'),require(_0x5b14('0x82')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x83'),require(_0x5b14('0x84')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x85'),require(_0x5b14('0x86')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x87'),require('./api/intSugarcrmAccount'));_0x34b4cd['use']('/api/integrations/sugarcrm/configurations',require(_0x5b14('0x88')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x89'),require(_0x5b14('0x8a')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x8b'),require(_0x5b14('0x8c')));_0x34b4cd['use'](_0x5b14('0x8d'),require(_0x5b14('0x8e')));_0x34b4cd['use']('/api/integrations/desk/fields',require(_0x5b14('0x8f')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x90'),require(_0x5b14('0x91')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x92'),require('./api/intZohoConfiguration'));_0x34b4cd[_0x5b14('0x7')]('/api/integrations/zoho/fields',require(_0x5b14('0x93')));_0x34b4cd['use'](_0x5b14('0x94'),require(_0x5b14('0x95')));_0x34b4cd[_0x5b14('0x7')]('/api/integrations/zendesk/configurations',require(_0x5b14('0x96')));_0x34b4cd['use'](_0x5b14('0x97'),require(_0x5b14('0x98')));_0x34b4cd[_0x5b14('0x7')]('/api/integrations/freshdesk/accounts',require(_0x5b14('0x99')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x9a'),require(_0x5b14('0x9b')));_0x34b4cd['use'](_0x5b14('0x9c'),require('./api/intFreshdeskField'));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x9d'),require('./api/intVtigerAccount'));_0x34b4cd['use'](_0x5b14('0x9e'),require(_0x5b14('0x9f')));_0x34b4cd[_0x5b14('0x7')]('/api/integrations/vtiger/fields',require(_0x5b14('0xa0')));_0x34b4cd[_0x5b14('0x7')]('/api/integrations/servicenow/accounts',require(_0x5b14('0xa1')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0xa2'),require(_0x5b14('0xa3')));_0x34b4cd[_0x5b14('0x7')]('/api/integrations/servicenow/fields',require(_0x5b14('0xa4')));_0x34b4cd[_0x5b14('0x7')]('/api/integrations/dynamics365/accounts',require('./api/intDynamics365Account'));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0xa5'),require('./api/intDynamics365Configuration'));_0x34b4cd['use'](_0x5b14('0xa6'),require(_0x5b14('0xa7')));_0x34b4cd[_0x5b14('0x7')]('/api/integrations/freshsales/accounts',require(_0x5b14('0xa8')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0xa9'),require('./api/intFreshsalesConfiguration'));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0xaa'),require(_0x5b14('0xab')));_0x34b4cd['use'](_0x5b14('0xac'),require(_0x5b14('0xad')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0xae'),require(_0x5b14('0xaf')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0xb0'),require('./api/chatInternalMessage'));_0x34b4cd['use']('/api/jscripty/answers/reports',require('./api/jscriptyAnswerReport'));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0xb1'),require(_0x5b14('0xb2')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0xb3'),require('./api/jscriptySessionReport'));_0x34b4cd['use'](_0x5b14('0xb4'),require(_0x5b14('0xb5')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0xb6'),require(_0x5b14('0xb7')));_0x34b4cd['use']('/api/square/details/reports',require(_0x5b14('0xb8')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0xb9'),require(_0x5b14('0xba')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0xbb'),require(_0x5b14('0xbc')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0xbd'),require('./api/squareOdbc'));_0x34b4cd[_0x5b14('0x7')]('/api/square/projects',require(_0x5b14('0xbe')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0xbf'),require(_0x5b14('0xc0')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0xc1'),require(_0x5b14('0xc2')));_0x34b4cd['use']('/api/teams',require(_0x5b14('0xc3')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0xc4'),require(_0x5b14('0xc5')));_0x34b4cd[_0x5b14('0x7')]('/api/campaigns',require(_0x5b14('0xc6')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0xc7'),require(_0x5b14('0xc8')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0xc9'),require(_0x5b14('0xca')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0xcb'),require(_0x5b14('0xcc')));_0x34b4cd['use']('/api/mail/reports/transfer',require(_0x5b14('0xcd')));_0x34b4cd[_0x5b14('0x7')]('/api/chat/reports/transfer',require(_0x5b14('0xce')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0xcf'),require(_0x5b14('0xd0')));_0x34b4cd['use'](_0x5b14('0xd1'),require(_0x5b14('0xd2')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0xd3'),require(_0x5b14('0xd4')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0xd5'),require('./api/cmList'));_0x34b4cd['use']('/api/voice/prefixes',require(_0x5b14('0xd6')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0xd7'),require(_0x5b14('0xd8')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0xd9'),require(_0x5b14('0xda')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0xdb'),require(_0x5b14('0xdc')));_0x34b4cd[_0x5b14('0x7')]('/api/userNotifications',require(_0x5b14('0xdd')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0xde'),require(_0x5b14('0xdf')));_0x34b4cd['use'](_0x5b14('0xe0'),require(_0x5b14('0xe1')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0xe2'),require(_0x5b14('0xe3')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0xe4'),require(_0x5b14('0xe5')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0xe6'),require(_0x5b14('0xe7')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0xe8'),require(_0x5b14('0xe9')));_0x34b4cd[_0x5b14('0x7')]('/api/whatsapp/queues',require(_0x5b14('0xea')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0xeb'),require(_0x5b14('0xec')));_0x34b4cd[_0x5b14('0x7')]('/api/realtime',require('./api/realtime'));_0x34b4cd[_0x5b14('0x7')]('/api/user-settings',require(_0x5b14('0xed')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0xee'),require(_0x5b14('0xef')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0xf0'),require('./api/authLocal'));_0x34b4cd[_0x5b14('0x7')]('/api/auth/google',require('./api/authGoogle'));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0xf1'),require(_0x5b14('0xf2')));_0x34b4cd['use']('/api/jira',require('./api/jira'));_0x34b4cd['use'](_0x5b14('0xf3'),require(_0x5b14('0xf4')));_0x34b4cd[_0x5b14('0x7')]('/api/version',require('./api/version'));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0xf5'),require('./api/system'));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0xf6'),require('./api/pm2'));_0x34b4cd['use']('/api/webbar',require('./api/webbar'));_0x34b4cd[_0x5b14('0x7')]('/api/logs',clientSideLogs);_0x34b4cd[_0x5b14('0x7')](_0x5b14('0xf7'),express['static'](path[_0x5b14('0xf8')](config['root'],_0x5b14('0xf7'))));_0x34b4cd['use'](_0x5b14('0xf9'),express[_0x5b14('0xfa')](path['join'](config[_0x5b14('0xfb')],_0x5b14('0xf9'))));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0xfc'),express['static'](path[_0x5b14('0xf8')](config[_0x5b14('0xfb')],'/demo')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0xfd'),express[_0x5b14('0xfa')](path['join'](config[_0x5b14('0xfb')],_0x5b14('0xfe'),_0x5b14('0xff'))));_0x34b4cd['use'](_0x5b14('0x100'),express['static'](path[_0x5b14('0xf8')](config['root'],_0x5b14('0x101'))));_0x34b4cd[_0x5b14('0x102')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0x5b14('0x103')](errors[0x194]);_0x34b4cd['route']('/*')[_0x5b14('0x103')](function(_0x891dee,_0x411d37){_0x411d37[_0x5b14('0x104')](path[_0x5b14('0x105')](_0x34b4cd['get']('appPath')+_0x5b14('0x106')));});return _0x34b4cd;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 934e4c7..ee5411e 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf8e0=['../api/faxQueueReport/faxQueueReport.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','http','rpc','port','localhost','error','listen','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','default','lodash','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','merge','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc'];(function(_0x5d72da,_0xb7ce32){var _0x43ebe7=function(_0x503755){while(--_0x503755){_0x5d72da['push'](_0x5d72da['shift']());}};_0x43ebe7(++_0xb7ce32);}(_0xf8e0,0x103));var _0x0f8e=function(_0x3653ab,_0x418bd6){_0x3653ab=_0x3653ab-0x0;var _0x2a79ea=_0xf8e0[_0x3653ab];return _0x2a79ea;};'use strict';var jayson=require('jayson/promise');var _=require(_0x0f8e('0x0'));var config=require('../config/environment');exports['listen']=function(){return new Promise(function(_0x227ddb,_0x321c33){var _0x239ef8={};_0x239ef8=_['merge'](_0x239ef8,require(_0x0f8e('0x1')));_0x239ef8=_['merge'](_0x239ef8,require(_0x0f8e('0x2')));_0x239ef8=_['merge'](_0x239ef8,require(_0x0f8e('0x3')));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require(_0x0f8e('0x5')));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require(_0x0f8e('0x6')));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x239ef8=_['merge'](_0x239ef8,require(_0x0f8e('0x7')));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require(_0x0f8e('0x8')));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require('../api/memberReport/memberReport.rpc'));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require('../api/trunk/trunk.rpc'));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require(_0x0f8e('0x9')));_0x239ef8=_['merge'](_0x239ef8,require(_0x0f8e('0xa')));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require(_0x0f8e('0xb')));_0x239ef8=_['merge'](_0x239ef8,require('../api/mailAccount/mailAccount.rpc'));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require(_0x0f8e('0xc')));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require(_0x0f8e('0xd')));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require(_0x0f8e('0xe')));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require(_0x0f8e('0xf')));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require(_0x0f8e('0x10')));_0x239ef8=_['merge'](_0x239ef8,require('../api/faxAccount/faxAccount.rpc'));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require(_0x0f8e('0x11')));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require(_0x0f8e('0x12')));_0x239ef8=_['merge'](_0x239ef8,require(_0x0f8e('0x13')));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require(_0x0f8e('0x14')));_0x239ef8=_['merge'](_0x239ef8,require(_0x0f8e('0x15')));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require('../api/smsAccount/smsAccount.rpc'));_0x239ef8=_['merge'](_0x239ef8,require('../api/smsInteraction/smsInteraction.rpc'));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require(_0x0f8e('0x16')));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require(_0x0f8e('0x17')));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require(_0x0f8e('0x18')));_0x239ef8=_['merge'](_0x239ef8,require(_0x0f8e('0x19')));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require(_0x0f8e('0x1a')));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require(_0x0f8e('0x1b')));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require('../api/chatMessage/chatMessage.rpc'));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require(_0x0f8e('0x1c')));_0x239ef8=_['merge'](_0x239ef8,require(_0x0f8e('0x1d')));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require(_0x0f8e('0x1e')));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require(_0x0f8e('0x1f')));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require(_0x0f8e('0x20')));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require(_0x0f8e('0x21')));_0x239ef8=_['merge'](_0x239ef8,require(_0x0f8e('0x22')));_0x239ef8=_['merge'](_0x239ef8,require('../api/interval/interval.rpc'));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require(_0x0f8e('0x23')));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require(_0x0f8e('0x24')));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require(_0x0f8e('0x25')));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require(_0x0f8e('0x26')));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require(_0x0f8e('0x27')));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require('../api/variable/variable.rpc'));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x239ef8=_['merge'](_0x239ef8,require(_0x0f8e('0x28')));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require(_0x0f8e('0x29')));_0x239ef8=_['merge'](_0x239ef8,require(_0x0f8e('0x2a')));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require(_0x0f8e('0x2b')));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require(_0x0f8e('0x2c')));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require(_0x0f8e('0x2d')));_0x239ef8=_['merge'](_0x239ef8,require(_0x0f8e('0x2e')));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require(_0x0f8e('0x2f')));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require(_0x0f8e('0x30')));_0x239ef8=_['merge'](_0x239ef8,require(_0x0f8e('0x31')));_0x239ef8=_['merge'](_0x239ef8,require(_0x0f8e('0x32')));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require(_0x0f8e('0x33')));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require('../api/squareRecording/squareRecording.rpc'));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require(_0x0f8e('0x34')));_0x239ef8=_['merge'](_0x239ef8,require(_0x0f8e('0x35')));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require(_0x0f8e('0x36')));_0x239ef8=_['merge'](_0x239ef8,require(_0x0f8e('0x37')));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require(_0x0f8e('0x38')));_0x239ef8=_['merge'](_0x239ef8,require(_0x0f8e('0x39')));_0x239ef8=_['merge'](_0x239ef8,require(_0x0f8e('0x3a')));_0x239ef8=_[_0x0f8e('0x4')](_0x239ef8,require(_0x0f8e('0x3b')));_0x239ef8=_['merge'](_0x239ef8,require(_0x0f8e('0x3c')));var _0x11cda5=jayson['server'](_0x239ef8)[_0x0f8e('0x3d')]();var _0x5586d7=config[_0x0f8e('0x3e')][_0x0f8e('0x3f')]||config[_0x0f8e('0x3f')]+0x1;var _0x51e346=config[_0x0f8e('0x3e')]['ip']||_0x0f8e('0x40');_0x11cda5['on'](_0x0f8e('0x41'),function(_0x586f7b){return _0x321c33(_0x586f7b);});_0x11cda5[_0x0f8e('0x42')](_0x5586d7,_0x51e346,function(){console[_0x0f8e('0x43')](_0x0f8e('0x44'),_0x51e346,_0x5586d7);require('../config/triggers')[_0x0f8e('0x45')]();return _0x227ddb('RPC\x20listening\x20on\x20'+_0x51e346+':'+_0x5586d7);});});}; \ No newline at end of file +var _0x2b18=['../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','http','rpc','localhost','error','listen','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','merge','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc'];(function(_0x31711a,_0x10590e){var _0x3b407f=function(_0x2f552c){while(--_0x2f552c){_0x31711a['push'](_0x31711a['shift']());}};_0x3b407f(++_0x10590e);}(_0x2b18,0x11e));var _0x82b1=function(_0x787615,_0x90378f){_0x787615=_0x787615-0x0;var _0x5d0c88=_0x2b18[_0x787615];return _0x5d0c88;};'use strict';var jayson=require(_0x82b1('0x0'));var _=require(_0x82b1('0x1'));var config=require(_0x82b1('0x2'));exports['listen']=function(){return new Promise(function(_0x588211,_0x2c44c2){var _0x4c16bd={};_0x4c16bd=_['merge'](_0x4c16bd,require('../api/user/user.rpc'));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require('../api/voiceExtension/voiceExtension.rpc'));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require('../api/voiceQueue/voiceQueue.rpc'));_0x4c16bd=_['merge'](_0x4c16bd,require('../api/voiceRecording/voiceRecording.rpc'));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require(_0x82b1('0x4')));_0x4c16bd=_['merge'](_0x4c16bd,require(_0x82b1('0x5')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require(_0x82b1('0x6')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require(_0x82b1('0x7')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require(_0x82b1('0x8')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require(_0x82b1('0x9')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require(_0x82b1('0xa')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require(_0x82b1('0xb')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require(_0x82b1('0xc')));_0x4c16bd=_['merge'](_0x4c16bd,require(_0x82b1('0xd')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require(_0x82b1('0xe')));_0x4c16bd=_['merge'](_0x4c16bd,require('../api/mailInteraction/mailInteraction.rpc'));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require(_0x82b1('0xf')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require(_0x82b1('0x10')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require(_0x82b1('0x11')));_0x4c16bd=_['merge'](_0x4c16bd,require(_0x82b1('0x12')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require(_0x82b1('0x13')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require(_0x82b1('0x14')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require(_0x82b1('0x15')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require('../api/faxQueue/faxQueue.rpc'));_0x4c16bd=_['merge'](_0x4c16bd,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x4c16bd=_['merge'](_0x4c16bd,require(_0x82b1('0x16')));_0x4c16bd=_['merge'](_0x4c16bd,require(_0x82b1('0x17')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require(_0x82b1('0x18')));_0x4c16bd=_['merge'](_0x4c16bd,require(_0x82b1('0x19')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require(_0x82b1('0x1a')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require(_0x82b1('0x1b')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x4c16bd=_['merge'](_0x4c16bd,require(_0x82b1('0x1c')));_0x4c16bd=_['merge'](_0x4c16bd,require(_0x82b1('0x1d')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require(_0x82b1('0x1e')));_0x4c16bd=_['merge'](_0x4c16bd,require(_0x82b1('0x1f')));_0x4c16bd=_['merge'](_0x4c16bd,require(_0x82b1('0x20')));_0x4c16bd=_['merge'](_0x4c16bd,require('../api/cmHopper/cmHopper.rpc'));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require(_0x82b1('0x21')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require(_0x82b1('0x22')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x4c16bd=_['merge'](_0x4c16bd,require(_0x82b1('0x23')));_0x4c16bd=_['merge'](_0x4c16bd,require(_0x82b1('0x24')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require(_0x82b1('0x25')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc'));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require(_0x82b1('0x26')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require(_0x82b1('0x27')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require(_0x82b1('0x28')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x4c16bd=_['merge'](_0x4c16bd,require(_0x82b1('0x29')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require(_0x82b1('0x2a')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require(_0x82b1('0x2b')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require(_0x82b1('0x2c')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require(_0x82b1('0x2d')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require(_0x82b1('0x2e')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require(_0x82b1('0x2f')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require(_0x82b1('0x30')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require(_0x82b1('0x31')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require(_0x82b1('0x32')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require('../api/setting/setting.rpc'));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require('../api/squareOdbc/squareOdbc.rpc'));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require(_0x82b1('0x33')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require(_0x82b1('0x34')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require(_0x82b1('0x35')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require('../api/campaign/campaign.rpc'));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require(_0x82b1('0x36')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require(_0x82b1('0x37')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x4c16bd=_['merge'](_0x4c16bd,require(_0x82b1('0x38')));_0x4c16bd=_['merge'](_0x4c16bd,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require(_0x82b1('0x39')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x1bd85d=jayson['server'](_0x4c16bd)[_0x82b1('0x3a')]();var _0xc4dfa3=config['rpc']['port']||config['port']+0x1;var _0x5101f7=config[_0x82b1('0x3b')]['ip']||_0x82b1('0x3c');_0x1bd85d['on'](_0x82b1('0x3d'),function(_0x4addba){return _0x2c44c2(_0x4addba);});_0x1bd85d[_0x82b1('0x3e')](_0xc4dfa3,_0x5101f7,function(){console['log'](_0x82b1('0x3f'),_0x5101f7,_0xc4dfa3);require(_0x82b1('0x40'))[_0x82b1('0x41')]();return _0x588211(_0x82b1('0x42')+_0x5101f7+':'+_0xc4dfa3);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index cf5d166..4994b6b 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 _0x20a2=['lodash','./reply','./error','setEncoding','utf8','setTimeout','emit','ready','line','toLowerCase','hangup','520-Invalid','search','function','substring','no\x20code','replace','result=','substr','indexOf','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','inherits','prototype','sendRequest','ANSWER','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','extension','setExtension','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','agi','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util'];(function(_0x287602,_0x2a258b){var _0x11154b=function(_0x28d826){while(--_0x28d826){_0x287602['push'](_0x287602['shift']());}};_0x11154b(++_0x2a258b);}(_0x20a2,0xf2));var _0x220a=function(_0x2f1a6e,_0x3082cb){_0x2f1a6e=_0x2f1a6e-0x0;var _0x5865e5=_0x20a2[_0x2f1a6e];return _0x5865e5;};'use strict';var util=require(_0x220a('0x0'));var _=require(_0x220a('0x1'));var EventEmitter=require('events')['EventEmitter'];var AGIReply=require(_0x220a('0x2'));var AGIError=require(_0x220a('0x3'));function AGIChannel(_0x2d5d6c){var _0x328d6d=this,_0x40766a=new AGIReply(),_0xe391a4=![],_0x4e339e={};EventEmitter['call'](_0x328d6d);_0x2d5d6c[_0x220a('0x4')](_0x220a('0x5'));_0x2d5d6c[_0x220a('0x6')](0x8*0x3c*0x3c*0x3e8);_0x40766a[_0x220a('0x4')](_0x220a('0x5'));_0x40766a['on']('headers',function(_0x2970ac){for(var _0x3e5e13 in _0x2970ac){_0x328d6d[_0x3e5e13]=_0x2970ac[_0x3e5e13];}_0x328d6d[_0x220a('0x7')](_0x220a('0x8'));});_0x40766a['on'](_0x220a('0x9'),function(_0x43ed6e){if(_0x43ed6e[_0x220a('0xa')]()==_0x220a('0xb')){_0x328d6d[_0x220a('0x7')](_0x220a('0xb'));return;}if(_0x43ed6e['substring'](0x0,0xb)==_0x220a('0xc')){_0xe391a4=!![];}if(_0xe391a4){_0x4e339e['rx']+=_0x43ed6e+'\x0a';if(_0x43ed6e[_0x220a('0xd')]('520\x20End\x20of\x20proper')!=-0x1){_0xe391a4=![];}}else{_0x4e339e['rx']=_0x43ed6e;}if(_0xe391a4){return;}if(typeof _0x4e339e['cb']==_0x220a('0xe')){var _0x502a87=_0x4e339e['rx'][_0x220a('0xf')](0x0,0x3),_0x21c426=null,_0x19158c=null;_0x502a87=parseInt(_0x502a87);if(isNaN(_0x502a87)){_0x4e339e['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x220a('0x10')});return;}if(_0x502a87!=0xc8){_0x4e339e['cb'](null,{'code':_0x502a87,'result':-0x1,'extra':'KO'});return;}_0x21c426=_0x4e339e['rx']['substring'](0x4)[_0x220a('0x11')](_0x220a('0x12'),'');if(_0x21c426['indexOf']('\x20')!=-0x1){_0x21c426=_0x21c426[_0x220a('0x13')](0x0,_0x21c426[_0x220a('0x14')]('\x20'));}if(_['startsWith'](_0x21c426,'-1')){_0x21c426=parseInt(_0x21c426);}_0x19158c=_0x4e339e['rx'][_0x220a('0x15')]('\x20');if(_0x19158c[_0x220a('0x16')]==0x3){_0x19158c=_0x19158c[0x2][_0x220a('0xf')](0x1,_0x19158c[0x2]['length']-0x1);}else if(_0x19158c[_0x220a('0x16')]>0x3){var _0x5498b1=/\((.+)\)/;var _0x18f5e0=_0x4e339e['rx'][_0x220a('0x17')](_0x5498b1);if(_0x18f5e0){_0x19158c=_0x18f5e0[0x1];}else{_0x19158c=null;}}else{_0x19158c=null;}_0x4e339e['cb'](null,{'code':_0x502a87,'result':_0x21c426,'extra':_0x19158c});}});_0x2d5d6c['on'](_0x220a('0x18'),function(_0xcea72b){_0x328d6d[_0x220a('0x7')](_0x220a('0x18'),new AGIError(_0x220a('0x19'),_0xcea72b[_0x220a('0x1a')]));});_0x2d5d6c['on']('close',function(){_0x328d6d[_0x220a('0x7')](_0x220a('0x1b'),new AGIError(_0x220a('0x1c')));});_0x2d5d6c['on'](_0x220a('0x1d'),function(){_0x328d6d[_0x220a('0x7')](_0x220a('0x1d'),new AGIError(_0x220a('0x1e')));_0x2d5d6c[_0x220a('0x1f')]();});_0x2d5d6c[_0x220a('0x20')](_0x40766a);this[_0x220a('0x21')]=function(_0x5be1fb,_0x5e6979){var _0x5be1fb=_0x5be1fb||'',_0x5e6979=typeof _0x5e6979==_0x220a('0xe')?_0x5e6979:new Function();_0x4e339e={'tx':_0x5be1fb,'rx':'','cb':_0x5e6979};_0x2d5d6c[_0x220a('0x22')](_0x5be1fb+'\x0a');},this[_0x220a('0x1b')]=function(){_0x2d5d6c[_0x220a('0x1f')]();};}util[_0x220a('0x23')](AGIChannel,EventEmitter);AGIChannel[_0x220a('0x24')][_0x220a('0x25')]=function(_0x4f2ca1){return this[_0x220a('0x21')]['sync'](this,_0x4f2ca1);};AGIChannel[_0x220a('0x24')]['answer']=function(){return this[_0x220a('0x25')](_0x220a('0x26'));};AGIChannel[_0x220a('0x24')][_0x220a('0x27')]=function(_0x4378b2,_0x3ca893,_0x5be801){_0x4378b2=_0x4378b2===undefined?_0x220a('0x28'):_0x4378b2;_0x3ca893=_0x3ca893===undefined?'5':_0x3ca893;_0x5be801=_0x5be801===undefined?'1':_0x5be801;return this['sendRequest'](util[_0x220a('0x29')](_0x220a('0x2a'),_0x4378b2,_0x3ca893*0x3e8,_0x5be801));};AGIChannel[_0x220a('0x24')][_0x220a('0x2b')]=function(_0xc0225b){_0xc0225b=_0xc0225b||_0x220a('0x2c');return this[_0x220a('0x25')](util[_0x220a('0x29')](_0x220a('0x2d'),_0xc0225b));};AGIChannel[_0x220a('0x24')][_0x220a('0x2e')]=function(_0x573b2a,_0x324415){if(_[_0x220a('0x2f')](_0x324415)){return this[_0x220a('0x25')](util[_0x220a('0x29')](_0x220a('0x30'),_0x573b2a,_0x324415[_0x220a('0x31')](',')));}return this[_0x220a('0x25')](util[_0x220a('0x29')]('EXEC\x20%s\x20%s',_0x573b2a,_0x324415));};AGIChannel[_0x220a('0x24')][_0x220a('0x32')]=function(_0x4fb37e){return this[_0x220a('0x25')](util[_0x220a('0x29')](_0x220a('0x33'),_0x4fb37e));};AGIChannel['prototype']['setExtension']=function(_0x2f7826){return this[_0x220a('0x25')](util[_0x220a('0x29')](_0x220a('0x34'),_0x2f7826));};AGIChannel[_0x220a('0x24')][_0x220a('0x35')]=function(_0x14ee00){return this[_0x220a('0x25')](util['format'](_0x220a('0x36'),_0x14ee00));};AGIChannel['prototype'][_0x220a('0xb')]=function(){return this[_0x220a('0x25')](_0x220a('0x37'));};AGIChannel[_0x220a('0x24')][_0x220a('0x38')]=function(_0x48cda,_0x1c32dc){var _0x451972=_[_0x220a('0x39')](_0x1c32dc)||_[_0x220a('0x3a')](_0x1c32dc)?_0x1c32dc[_0x220a('0x3b')]():_0x1c32dc;return this[_0x220a('0x25')](util[_0x220a('0x29')](_0x220a('0x3c'),_0x48cda,_0x451972?_0x451972['toString']()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x220a('0x24')][_0x220a('0x3d')]=function(_0x502b49,_0x3f27b2){return this[_0x220a('0x25')](util[_0x220a('0x29')](_0x220a('0x3e'),_0x502b49,_0x3f27b2));};AGIChannel[_0x220a('0x24')][_0x220a('0x3f')]=function(_0x1efec4,_0x3028a1){return this['sendRequest'](util['format'](_0x220a('0x40'),_0x1efec4,_0x3028a1));};AGIChannel[_0x220a('0x24')][_0x220a('0x41')]=function(_0x423ae7,_0x1d1fdd){return this[_0x220a('0x25')](util['format'](_0x220a('0x42'),_0x423ae7,_0x1d1fdd));};AGIChannel[_0x220a('0x24')]['continueAt']=function(_0x6da1dc,_0x2f2d39,_0x331efa){_0x2f2d39=_0x2f2d39||this[_0x220a('0x43')];_0x331efa=_0x331efa||0x1;this[_0x220a('0x32')](_0x6da1dc);this[_0x220a('0x44')](_0x2f2d39);this[_0x220a('0x35')](_0x331efa);return this[_0x220a('0x2b')](util[_0x220a('0x29')]('GOTO\x20%s\x20%s\x20%s',_0x6da1dc,_0x2f2d39,_0x331efa));};AGIChannel['prototype'][_0x220a('0x45')]=function(_0x5e7f71){return this['sendRequest'](util[_0x220a('0x29')](_0x220a('0x46'),_0x5e7f71));};AGIChannel[_0x220a('0x24')][_0x220a('0x47')]=function(_0x3421a5,_0x4d6122,_0x122316,_0x1f53c6,_0x419b0b,_0x17162d){_0x4d6122=_0x4d6122||_0x220a('0x48');_0x122316=_0x122316||'';_0x1f53c6=_0x1f53c6===undefined?-0x1:_0x1f53c6==='-1'?-0x1:_0x1f53c6*0x3e8;_0x419b0b=_0x419b0b===undefined?'':'s='+_0x419b0b;_0x17162d=_0x17162d?'BEEP':'';return this[_0x220a('0x25')](util['format'](_0x220a('0x49'),_0x3421a5,_0x4d6122,_0x122316,_0x1f53c6,_0x17162d,_0x419b0b));};AGIChannel['prototype'][_0x220a('0x4a')]=function(_0x4515ae,_0x26c29b){_0x26c29b=_0x26c29b||'';return this[_0x220a('0x25')](util['format']('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x4515ae,_0x26c29b));};AGIChannel[_0x220a('0x24')][_0x220a('0x4b')]=function(_0x468594){return this[_0x220a('0x2e')]('AGI',_0x468594);};AGIChannel[_0x220a('0x24')][_0x220a('0x4c')]=function(_0x34281b){return this[_0x220a('0x2e')](_0x220a('0x4d'),_0x34281b);};AGIChannel['prototype']['error']=function(_0x5de2b6,_0x481fed){this[_0x220a('0x2b')](util[_0x220a('0x29')](_0x220a('0x4e'),_0x5de2b6['id'],_0x5de2b6[_0x220a('0x4f')],_0x481fed));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x220a('0x50')]=AGIChannel; \ No newline at end of file +var _0x0b91=['isBoolean','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','setContext','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','WAIT','exports','lodash','events','./reply','./error','call','setEncoding','setTimeout','headers','emit','ready','line','toLowerCase','hangup','substring','520-Invalid','search','function','replace','result=','indexOf','substr','startsWith','length','error','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','prototype','sendRequest','sync','answer','ANSWER','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','join','EXEC\x20%s\x20%s','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','HANGUP','setVariable'];(function(_0x1fab0d,_0x328063){var _0x511354=function(_0xa99621){while(--_0xa99621){_0x1fab0d['push'](_0x1fab0d['shift']());}};_0x511354(++_0x328063);}(_0x0b91,0xae));var _0x10b9=function(_0x200c9f,_0x5e3986){_0x200c9f=_0x200c9f-0x0;var _0x4b5088=_0x0b91[_0x200c9f];return _0x4b5088;};'use strict';var util=require('util');var _=require(_0x10b9('0x0'));var EventEmitter=require(_0x10b9('0x1'))['EventEmitter'];var AGIReply=require(_0x10b9('0x2'));var AGIError=require(_0x10b9('0x3'));function AGIChannel(_0x3ecefd){var _0x59acf6=this,_0x48c86c=new AGIReply(),_0x423d83=![],_0xb0e1c2={};EventEmitter[_0x10b9('0x4')](_0x59acf6);_0x3ecefd[_0x10b9('0x5')]('utf8');_0x3ecefd[_0x10b9('0x6')](0x8*0x3c*0x3c*0x3e8);_0x48c86c['setEncoding']('utf8');_0x48c86c['on'](_0x10b9('0x7'),function(_0x528fb0){for(var _0x3d6b74 in _0x528fb0){_0x59acf6[_0x3d6b74]=_0x528fb0[_0x3d6b74];}_0x59acf6[_0x10b9('0x8')](_0x10b9('0x9'));});_0x48c86c['on'](_0x10b9('0xa'),function(_0x4a1989){if(_0x4a1989[_0x10b9('0xb')]()==_0x10b9('0xc')){_0x59acf6[_0x10b9('0x8')](_0x10b9('0xc'));return;}if(_0x4a1989[_0x10b9('0xd')](0x0,0xb)==_0x10b9('0xe')){_0x423d83=!![];}if(_0x423d83){_0xb0e1c2['rx']+=_0x4a1989+'\x0a';if(_0x4a1989[_0x10b9('0xf')]('520\x20End\x20of\x20proper')!=-0x1){_0x423d83=![];}}else{_0xb0e1c2['rx']=_0x4a1989;}if(_0x423d83){return;}if(typeof _0xb0e1c2['cb']==_0x10b9('0x10')){var _0x176db4=_0xb0e1c2['rx'][_0x10b9('0xd')](0x0,0x3),_0x1a2dc7=null,_0x4354c5=null;_0x176db4=parseInt(_0x176db4);if(isNaN(_0x176db4)){_0xb0e1c2['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x176db4!=0xc8){_0xb0e1c2['cb'](null,{'code':_0x176db4,'result':-0x1,'extra':'KO'});return;}_0x1a2dc7=_0xb0e1c2['rx'][_0x10b9('0xd')](0x4)[_0x10b9('0x11')](_0x10b9('0x12'),'');if(_0x1a2dc7[_0x10b9('0x13')]('\x20')!=-0x1){_0x1a2dc7=_0x1a2dc7[_0x10b9('0x14')](0x0,_0x1a2dc7[_0x10b9('0x13')]('\x20'));}if(_[_0x10b9('0x15')](_0x1a2dc7,'-1')){_0x1a2dc7=parseInt(_0x1a2dc7);}_0x4354c5=_0xb0e1c2['rx']['split']('\x20');if(_0x4354c5[_0x10b9('0x16')]==0x3){_0x4354c5=_0x4354c5[0x2]['substring'](0x1,_0x4354c5[0x2][_0x10b9('0x16')]-0x1);}else if(_0x4354c5[_0x10b9('0x16')]>0x3){var _0x189296=/\((.+)\)/;var _0x4c6743=_0xb0e1c2['rx']['match'](_0x189296);if(_0x4c6743){_0x4354c5=_0x4c6743[0x1];}else{_0x4354c5=null;}}else{_0x4354c5=null;}_0xb0e1c2['cb'](null,{'code':_0x176db4,'result':_0x1a2dc7,'extra':_0x4354c5});}});_0x3ecefd['on'](_0x10b9('0x17'),function(_0x5ab380){_0x59acf6[_0x10b9('0x8')](_0x10b9('0x17'),new AGIError('E_AGI_SOCKET_ERROR',_0x5ab380[_0x10b9('0x18')]));});_0x3ecefd['on'](_0x10b9('0x19'),function(){_0x59acf6[_0x10b9('0x8')](_0x10b9('0x19'),new AGIError(_0x10b9('0x1a')));});_0x3ecefd['on'](_0x10b9('0x1b'),function(){_0x59acf6['emit'](_0x10b9('0x1b'),new AGIError(_0x10b9('0x1c')));_0x3ecefd[_0x10b9('0x1d')]();});_0x3ecefd[_0x10b9('0x1e')](_0x48c86c);this[_0x10b9('0x1f')]=function(_0x4bd89c,_0x258e77){var _0x4bd89c=_0x4bd89c||'',_0x258e77=typeof _0x258e77==_0x10b9('0x10')?_0x258e77:new Function();_0xb0e1c2={'tx':_0x4bd89c,'rx':'','cb':_0x258e77};_0x3ecefd[_0x10b9('0x20')](_0x4bd89c+'\x0a');},this[_0x10b9('0x19')]=function(){_0x3ecefd[_0x10b9('0x1d')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0x10b9('0x21')][_0x10b9('0x22')]=function(_0x5efbe1){return this[_0x10b9('0x1f')][_0x10b9('0x23')](this,_0x5efbe1);};AGIChannel['prototype'][_0x10b9('0x24')]=function(){return this[_0x10b9('0x22')](_0x10b9('0x25'));};AGIChannel[_0x10b9('0x21')][_0x10b9('0x26')]=function(_0x3037ae,_0x157805,_0x11d9f0){_0x3037ae=_0x3037ae===undefined?_0x10b9('0x27'):_0x3037ae;_0x157805=_0x157805===undefined?'5':_0x157805;_0x11d9f0=_0x11d9f0===undefined?'1':_0x11d9f0;return this[_0x10b9('0x22')](util[_0x10b9('0x28')](_0x10b9('0x29'),_0x3037ae,_0x157805*0x3e8,_0x11d9f0));};AGIChannel[_0x10b9('0x21')][_0x10b9('0x2a')]=function(_0x25f9fe){_0x25f9fe=_0x25f9fe||_0x10b9('0x2b');return this[_0x10b9('0x22')](util[_0x10b9('0x28')](_0x10b9('0x2c'),_0x25f9fe));};AGIChannel[_0x10b9('0x21')][_0x10b9('0x2d')]=function(_0x3b975c,_0x34dbec){if(_['isArray'](_0x34dbec)){return this[_0x10b9('0x22')](util['format']('EXEC\x20%s\x20%s',_0x3b975c,_0x34dbec[_0x10b9('0x2e')](',')));}return this[_0x10b9('0x22')](util[_0x10b9('0x28')](_0x10b9('0x2f'),_0x3b975c,_0x34dbec));};AGIChannel[_0x10b9('0x21')]['setContext']=function(_0x5f4c10){return this[_0x10b9('0x22')](util[_0x10b9('0x28')](_0x10b9('0x30'),_0x5f4c10));};AGIChannel[_0x10b9('0x21')][_0x10b9('0x31')]=function(_0xa6f761){return this['sendRequest'](util[_0x10b9('0x28')](_0x10b9('0x32'),_0xa6f761));};AGIChannel[_0x10b9('0x21')][_0x10b9('0x33')]=function(_0x55f184){return this[_0x10b9('0x22')](util[_0x10b9('0x28')]('SET\x20PRIORITY\x20%s',_0x55f184));};AGIChannel[_0x10b9('0x21')][_0x10b9('0xc')]=function(){return this[_0x10b9('0x22')](_0x10b9('0x34'));};AGIChannel['prototype'][_0x10b9('0x35')]=function(_0x58ef50,_0x496a61){var _0x3c8961=_[_0x10b9('0x36')](_0x496a61)||_['isNumber'](_0x496a61)?_0x496a61[_0x10b9('0x37')]():_0x496a61;return this['sendRequest'](util[_0x10b9('0x28')](_0x10b9('0x38'),_0x58ef50,_0x3c8961?_0x3c8961['toString']()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x10b9('0x21')][_0x10b9('0x39')]=function(_0x4236e2,_0xd99ecc){return this['sendRequest'](util[_0x10b9('0x28')](_0x10b9('0x3a'),_0x4236e2,_0xd99ecc));};AGIChannel['prototype'][_0x10b9('0x3b')]=function(_0x5a3d12,_0x4da588){return this[_0x10b9('0x22')](util[_0x10b9('0x28')](_0x10b9('0x3c'),_0x5a3d12,_0x4da588));};AGIChannel[_0x10b9('0x21')][_0x10b9('0x3d')]=function(_0x35f59d,_0xecb0c0){return this[_0x10b9('0x22')](util[_0x10b9('0x28')](_0x10b9('0x3e'),_0x35f59d,_0xecb0c0));};AGIChannel[_0x10b9('0x21')][_0x10b9('0x3f')]=function(_0x12aa95,_0x5cca13,_0x5527f5){_0x5cca13=_0x5cca13||this['extension'];_0x5527f5=_0x5527f5||0x1;this[_0x10b9('0x40')](_0x12aa95);this[_0x10b9('0x31')](_0x5cca13);this[_0x10b9('0x33')](_0x5527f5);return this[_0x10b9('0x2a')](util[_0x10b9('0x28')]('GOTO\x20%s\x20%s\x20%s',_0x12aa95,_0x5cca13,_0x5527f5));};AGIChannel[_0x10b9('0x21')][_0x10b9('0x41')]=function(_0x5609e0){return this[_0x10b9('0x22')](util['format'](_0x10b9('0x42'),_0x5609e0));};AGIChannel[_0x10b9('0x21')][_0x10b9('0x43')]=function(_0x2abd93,_0x214950,_0x4eb333,_0x507c4c,_0x34384d,_0x51ff77){_0x214950=_0x214950||_0x10b9('0x44');_0x4eb333=_0x4eb333||'';_0x507c4c=_0x507c4c===undefined?-0x1:_0x507c4c==='-1'?-0x1:_0x507c4c*0x3e8;_0x34384d=_0x34384d===undefined?'':'s='+_0x34384d;_0x51ff77=_0x51ff77?_0x10b9('0x45'):'';return this['sendRequest'](util[_0x10b9('0x28')](_0x10b9('0x46'),_0x2abd93,_0x214950,_0x4eb333,_0x507c4c,_0x51ff77,_0x34384d));};AGIChannel[_0x10b9('0x21')]['streamFile']=function(_0x5ee62e,_0x1529f0){_0x1529f0=_0x1529f0||'';return this[_0x10b9('0x22')](util[_0x10b9('0x28')](_0x10b9('0x47'),_0x5ee62e,_0x1529f0));};AGIChannel[_0x10b9('0x21')][_0x10b9('0x48')]=function(_0x59f7a4){return this[_0x10b9('0x2d')](_0x10b9('0x49'),_0x59f7a4);};AGIChannel[_0x10b9('0x21')]['wait']=function(_0x52a1bf){return this[_0x10b9('0x2d')](_0x10b9('0x4a'),_0x52a1bf);};AGIChannel[_0x10b9('0x21')][_0x10b9('0x17')]=function(_0x5a24af,_0x51e1cc){this['noop'](util[_0x10b9('0x28')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x5a24af['id'],_0x5a24af['label'],_0x51e1cc));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x10b9('0x4b')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 82539de..5f1ecb5 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 _0xfef2=['Empty\x20command.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','message','name','exports','util','Undefined\x20error.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20closed.','Socket\x20timeout.'];(function(_0x3b56c0,_0xe100d8){var _0x377efe=function(_0x181589){while(--_0x181589){_0x3b56c0['push'](_0x3b56c0['shift']());}};_0x377efe(++_0xe100d8);}(_0xfef2,0x199));var _0x2fef=function(_0x538bd3,_0x1e3c75){_0x538bd3=_0x538bd3-0x0;var _0x5e2fd7=_0xfef2[_0x538bd3];return _0x5e2fd7;};'use strict';var util=require(_0x2fef('0x0'));var error={'E_AGI_UNDEFINED':_0x2fef('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0x2fef('0x2'),'E_AGI_SERVER_MAXCONNECTION':_0x2fef('0x3'),'E_AGI_SERVER_VOICE_DISABLED':_0x2fef('0x4'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0x2fef('0x5'),'E_AGI_SOCKET_TIMEOUT':_0x2fef('0x6'),'E_AGI_COMMAND_EMPTY':_0x2fef('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0x2fef('0x8')};function AGIError(_0x320452){var _0x320452=_0x320452||null,_0x1ca0d1=_0x1ca0d1||[],_0x334a4a=0x1,_0xae9a94='';if(!error[_0x320452]){_0x320452=_0x2fef('0x9');}_0x1ca0d1[_0x2fef('0xa')](error[_0x320452]);while(arguments[_0x334a4a]){_0x1ca0d1[_0x2fef('0xa')](arguments[_0x334a4a]);_0x334a4a++;}_0xae9a94=util[_0x2fef('0xb')][_0x2fef('0xc')](util,_0x1ca0d1);this[_0x2fef('0xd')]=_0xae9a94;this[_0x2fef('0xe')]=_0x320452;}module[_0x2fef('0xf')]=AGIError; \ No newline at end of file +var _0x0fd0=['util','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','format','apply','message','name'];(function(_0x4de4ea,_0x1570e3){var _0x2e3c45=function(_0x4521a8){while(--_0x4521a8){_0x4de4ea['push'](_0x4de4ea['shift']());}};_0x2e3c45(++_0x1570e3);}(_0x0fd0,0x90));var _0x00fd=function(_0x1c966e,_0x127a90){_0x1c966e=_0x1c966e-0x0;var _0x35d922=_0x0fd0[_0x1c966e];return _0x35d922;};'use strict';var util=require(_0x00fd('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0x00fd('0x1'),'E_AGI_SERVER_ERROR':_0x00fd('0x2'),'E_AGI_SERVER_CLOSE':_0x00fd('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x00fd('0x4'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0x00fd('0x5'),'E_AGI_SOCKET_CLOSE':_0x00fd('0x6'),'E_AGI_SOCKET_TIMEOUT':_0x00fd('0x7'),'E_AGI_COMMAND_EMPTY':_0x00fd('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x00fd('0x9'),'E_AGI_IVR_ENTRY':_0x00fd('0xa')};function AGIError(_0x3e8b65){var _0x3e8b65=_0x3e8b65||null,_0x52faf6=_0x52faf6||[],_0x4d40d1=0x1,_0x5540b5='';if(!error[_0x3e8b65]){_0x3e8b65=_0x00fd('0xb');}_0x52faf6['push'](error[_0x3e8b65]);while(arguments[_0x4d40d1]){_0x52faf6['push'](arguments[_0x4d40d1]);_0x4d40d1++;}_0x5540b5=util[_0x00fd('0xc')][_0x00fd('0xd')](util,_0x52faf6);this[_0x00fd('0xe')]=_0x5540b5;this[_0x00fd('0xf')]=_0x3e8b65;}module['exports']=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index a2e98f3..c2d3d07 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 _0xba96=['./error','../../config/environment','redis','subscribe','agi','emit','error','parse','exports','events','EventEmitter','ioredis'];(function(_0x44e50a,_0x1cc4a2){var _0x1b5994=function(_0x29a487){while(--_0x29a487){_0x44e50a['push'](_0x44e50a['shift']());}};_0x1b5994(++_0x1cc4a2);}(_0xba96,0x111));var _0x6ba9=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xba96[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var EventEmitter=require(_0x6ba9('0x0'))[_0x6ba9('0x1')];var Redis=require(_0x6ba9('0x2'));var AGIError=require(_0x6ba9('0x3'));var config=require(_0x6ba9('0x4'));config[_0x6ba9('0x5')]=_['defaults'](config[_0x6ba9('0x5')],{'host':'localhost','port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config['redis']);sub[_0x6ba9('0x6')](_0x6ba9('0x7'),function(_0x3f7a58){if(_0x3f7a58)return eventEmitter[_0x6ba9('0x8')](_0x6ba9('0x9'),new AGIError('E_AGI_SERVER_ERROR',_0x3f7a58));});sub['on']('message',function(_0x527124,_0x46afc2){if(_0x527124!==_0x6ba9('0x7'))return;try{var _0x46a724=JSON[_0x6ba9('0xa')](_0x46afc2);eventEmitter[_0x6ba9('0x8')]('projectUpdate',_0x46a724);}catch(_0x266437){eventEmitter[_0x6ba9('0x8')](_0x6ba9('0x9'),new AGIError('E_AGI_SERVER_ERROR',_0x266437));}});module[_0x6ba9('0xb')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0xf6ac=['ioredis','../../config/environment','redis','defaults','localhost','subscribe','agi','emit','error','message','parse','projectUpdate','exports','EventEmitter'];(function(_0x2d1a2c,_0x911703){var _0x122ceb=function(_0x3ee888){while(--_0x3ee888){_0x2d1a2c['push'](_0x2d1a2c['shift']());}};_0x122ceb(++_0x911703);}(_0xf6ac,0xb5));var _0xcf6a=function(_0x8cfd08,_0x656b39){_0x8cfd08=_0x8cfd08-0x0;var _0x1c6452=_0xf6ac[_0x8cfd08];return _0x1c6452;};'use strict';var _=require('lodash');var EventEmitter=require('events')[_0xcf6a('0x0')];var Redis=require(_0xcf6a('0x1'));var AGIError=require('./error');var config=require(_0xcf6a('0x2'));config[_0xcf6a('0x3')]=_[_0xcf6a('0x4')](config['redis'],{'host':_0xcf6a('0x5'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config['redis']);sub[_0xcf6a('0x6')](_0xcf6a('0x7'),function(_0x2592d2){if(_0x2592d2)return eventEmitter[_0xcf6a('0x8')](_0xcf6a('0x9'),new AGIError('E_AGI_SERVER_ERROR',_0x2592d2));});sub['on'](_0xcf6a('0xa'),function(_0x222245,_0x112905){if(_0x222245!==_0xcf6a('0x7'))return;try{var _0x54a8ca=JSON[_0xcf6a('0xb')](_0x112905);eventEmitter['emit'](_0xcf6a('0xc'),_0x54a8ca);}catch(_0x964f7){eventEmitter['emit']('error',new AGIError('E_AGI_SERVER_ERROR',_0x964f7));}});module[_0xcf6a('0xd')]={'EventEmitter':eventEmitter}; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index c391960..7db467a 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 _0x6569=['lodash','../../../config/logger','agi','menu','vertices','edges','numberOfEdges','prototype','addVertex','addEdge','push','size','relations','getVertex','traverseBFS','info','no\x20vertex\x20found','stop\x20traverse','no\x20edge/s\x20available','length','condition','agicommand','vswitch','default','target','invalid','max\x20retry\x20reach','condition\x20not\x20found','exports'];(function(_0x35e11f,_0x2a9e5f){var _0x1a7846=function(_0x5e9a91){while(--_0x5e9a91){_0x35e11f['push'](_0x35e11f['shift']());}};_0x1a7846(++_0x2a9e5f);}(_0x6569,0xcb));var _0x9656=function(_0x3653df,_0x273ea9){_0x3653df=_0x3653df-0x0;var _0x138446=_0x6569[_0x3653df];return _0x138446;};'use strict';var _=require(_0x9656('0x0'));var logger=require(_0x9656('0x1'))(_0x9656('0x2'));var verticesWithRetry=[_0x9656('0x3'),'getdigits','getsecretdigits'];var Graph=function(){this[_0x9656('0x4')]={};this[_0x9656('0x5')]={};this[_0x9656('0x6')]=0x0;};Graph[_0x9656('0x7')][_0x9656('0x8')]=function(_0x9a7c73){this[_0x9656('0x4')][_0x9a7c73['id']]=_0x9a7c73;this[_0x9656('0x5')][_0x9a7c73['id']]=[];};Graph[_0x9656('0x7')][_0x9656('0x9')]=function(_0x5a76ff,_0xd6bd49,_0x50d4fe){this[_0x9656('0x5')][_0x5a76ff][_0x9656('0xa')]({'target':_0xd6bd49,'condition':_0x50d4fe});this['numberOfEdges']+=0x1;};Graph[_0x9656('0x7')][_0x9656('0xb')]=function(){return _[_0x9656('0xb')](this[_0x9656('0x4')]);};Graph[_0x9656('0x7')][_0x9656('0xc')]=function(){return this['numberOfEdges'];};Graph[_0x9656('0x7')][_0x9656('0xd')]=function(_0x42b4cc){return this[_0x9656('0x4')][_0x42b4cc];};Graph[_0x9656('0x7')][_0x9656('0xe')]=function(_0x24c393,_0x25f5b6){if(!this[_0x9656('0x4')][_0x24c393]){return logger[_0x9656('0xf')](_0x9656('0x10'));}var _0x34846f=_0x25f5b6(this['vertices'][_0x24c393]);if(!_0x34846f){return logger['info'](_0x9656('0x11'));}if(this[_0x9656('0x5')][_0x24c393]['length']===0x0){return logger[_0x9656('0xf')](_0x9656('0x12'));}for(var _0xfbf4a5=0x0,_0x4dd9d9=[],_0x4f0f08=![];_0xfbf4a5\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','then','catch','hasOwnProperty','agi_','substring','debug','variables','stringify','close','timeout','hangup','find','handleNotFound','handleUnpublished','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','getAll','[LICENSE]','finally','./server','listening','connection','lodash','syncho','util','../../config/environment','../../config/license/util','./project','EventEmitter','agi','defaults','127.0.0.1','nextTick','error','findIndex','deleted'];(function(_0x22aabe,_0x1667d4){var _0x7ae05=function(_0x3c3440){while(--_0x3c3440){_0x22aabe['push'](_0x22aabe['shift']());}};_0x7ae05(++_0x1667d4);}(_0x11ef,0x196));var _0xf11e=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x11ef[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0xf11e('0x0'));var syncho=require(_0xf11e('0x1'));var util=require(_0xf11e('0x2'));var config=require(_0xf11e('0x3'));var logger=require('../../config/logger')('agi');var utilLicense=require(_0xf11e('0x4'));var rpc=require('./rpc');var Project=require(_0xf11e('0x5'));var AGIEmitter=require('./events')[_0xf11e('0x6')];var projects=[];config[_0xf11e('0x7')]=_[_0xf11e('0x8')](config[_0xf11e('0x7')],{'ip':_0xf11e('0x9'),'port':0x11dd});AGIEmitter['on']('projectUpdate',projectUpdateHandler);function connectionHandler(_0x291529){process[_0xf11e('0xa')](function(){syncho(function(){try{setChannelVariables(_0x291529);agiHandler(_0x291529);}catch(_0x3f13b9){logger[_0xf11e('0xb')](_0x3f13b9['stack']);}});});}function projectUpdateHandler(_0x4efc9b){try{var _0x2d5e4c=_[_0xf11e('0xc')](projects,['id',_0x4efc9b['id']]);if(_0x2d5e4c>-0x1){if(_0x4efc9b[_0xf11e('0xd')]===!![]){projects[_0xf11e('0xe')](_0x2d5e4c,0x1);}else{projects[_0x2d5e4c]=_0x4efc9b;}}else{projects['push'](_0x4efc9b);}}catch(_0x396a0a){logger[_0xf11e('0xb')](_0x396a0a[_0xf11e('0xf')]);}}function listeningHandler(){var _0x90bebd=config[_0xf11e('0x10')]===_0xf11e('0x11')||![];console[_0xf11e('0x12')](_0xf11e('0x13'),config[_0xf11e('0x7')][_0xf11e('0x14')]);logger[_0xf11e('0x15')](util[_0xf11e('0x16')](_0xf11e('0x17'),_0x90bebd?config[_0xf11e('0x7')]['ip']:'host.docker.internal',config[_0xf11e('0x7')][_0xf11e('0x14')]));}function errorHandler(_0x581e51){if(_0x581e51&&_0x581e51[_0xf11e('0x18')]&&_0x581e51[_0xf11e('0x19')]){logger[_0xf11e('0xb')](util[_0xf11e('0x16')]('[%s]\x20%s',_0x581e51[_0xf11e('0x18')],_0x581e51[_0xf11e('0x19')]));}else{logger[_0xf11e('0xb')](util['format'](_0xf11e('0x1a'),_0x581e51[_0xf11e('0xf')]));}}function closeHandler(){logger['info'](util[_0xf11e('0x16')](_0xf11e('0x1b'),this['arg_1'],this['calleridname'],this['callerid'],this[_0xf11e('0x1c')],this[_0xf11e('0x1d')]));try{createSquareReport(this);}catch(_0x55b96b){logger[_0xf11e('0xb')](_0x55b96b[_0xf11e('0xf')]);}}function timeoutHandler(){logger[_0xf11e('0x15')](util[_0xf11e('0x16')](_0xf11e('0x1e'),this[_0xf11e('0x1f')],this[_0xf11e('0x20')],this[_0xf11e('0x21')],this[_0xf11e('0x1c')],this[_0xf11e('0x1d')]));}function hangupHandler(){logger[_0xf11e('0x15')](util['format'](_0xf11e('0x22'),this[_0xf11e('0x1f')],this[_0xf11e('0x20')],this[_0xf11e('0x21')],this[_0xf11e('0x1c')],this['uniqueid']));this[_0xf11e('0x23')]=!![];}function createSquareReport(_0xec02cd,_0x39f79f){rpc[_0xf11e('0x24')](_0xec02cd)[_0xf11e('0x25')](function(_0x2db49e){if(_0x39f79f){_0x39f79f(null,_0x2db49e);}})[_0xf11e('0x26')](function(_0x40d0d9){if(_0x39f79f){_0x39f79f(null,_0x40d0d9);}});}function setChannelVariables(_0x44c314){for(var _0xf049c6 in _0x44c314){if(_0x44c314[_0xf11e('0x27')](_0xf049c6)){if(_0xf049c6['indexOf'](_0xf11e('0x28'))===0x0){_0x44c314[_0xf049c6[_0xf11e('0x29')](0x4)]=_0x44c314[_0xf049c6];delete _0x44c314[_0xf049c6];}}}}function agiHandler(_0x59d5ac){logger[_0xf11e('0x2a')](_0xf11e('0x2b'),JSON[_0xf11e('0x2c')](_0x59d5ac,null,0x2));logger[_0xf11e('0x15')](util[_0xf11e('0x16')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x59d5ac[_0xf11e('0x1f')],_0x59d5ac[_0xf11e('0x20')],_0x59d5ac[_0xf11e('0x21')],_0x59d5ac[_0xf11e('0x1c')],_0x59d5ac[_0xf11e('0x1d')]));_0x59d5ac['on']('error',errorHandler);_0x59d5ac['on'](_0xf11e('0x2d'),closeHandler);_0x59d5ac['on'](_0xf11e('0x2e'),timeoutHandler);_0x59d5ac['evtHangup']=![];_0x59d5ac['on'](_0xf11e('0x2f'),hangupHandler);var _0x559c53=_[_0xf11e('0x30')](projects,[_0xf11e('0x18'),_0x59d5ac[_0xf11e('0x1f')]]);if(!_0x559c53)return Project[_0xf11e('0x31')](_0x59d5ac);if(!_0x559c53[_0xf11e('0x11')])return Project[_0xf11e('0x32')](_0x59d5ac);return Project['initialize'](_0x559c53,_0x59d5ac);}function main(){var _0x2992c1;return utilLicense['getLicense']()[_0xf11e('0x25')](function(_0x4ca9a8){if(!_0x4ca9a8)return;if(_0x4ca9a8['voice']){if(_0x4ca9a8[_0xf11e('0x33')]&&_0x4ca9a8[_0xf11e('0x33')]>0x0){logger[_0xf11e('0x15')](util[_0xf11e('0x16')](_0xf11e('0x34'),_0x4ca9a8[_0xf11e('0x33')]));_0x2992c1=_0x4ca9a8['callysquare'];}else{logger[_0xf11e('0x15')](_0xf11e('0x35'));}}else{logger[_0xf11e('0x15')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x2992c1=-0x1;}})['then'](function(){return Project[_0xf11e('0x36')]();})[_0xf11e('0x25')](function(_0x4db2e4){projects=_0x4db2e4;return;})[_0xf11e('0x26')](function(_0x1bd564){logger[_0xf11e('0xb')](_0xf11e('0x37'),_0x1bd564[_0xf11e('0xf')]);})[_0xf11e('0x38')](function(){var _0x3facc6=require(_0xf11e('0x39'))(config[_0xf11e('0x7')][_0xf11e('0x14')],config[_0xf11e('0x7')]['ip'],_0x2992c1);_0x3facc6['on'](_0xf11e('0xb'),errorHandler);_0x3facc6['on'](_0xf11e('0x3a'),listeningHandler);_0x3facc6['on'](_0xf11e('0x3b'),connectionHandler);_0x3facc6['on'](_0xf11e('0x2d'),closeHandler);});}main(); \ No newline at end of file +var _0x2322=['close','timeout','hangup','find','handleNotFound','production','handleUnpublished','initialize','getLicense','then','voice','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','getAll','[LICENSE]','finally','listening','syncho','../../config/environment','../../config/logger','agi','../../config/license/util','./project','./events','EventEmitter','127.0.0.1','projectUpdate','error','stack','findIndex','splice','push','env','log','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','host.docker.internal','port','name','[%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','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','createSquareReport','catch','hasOwnProperty','indexOf','agi_','substring','debug','variables','stringify'];(function(_0x3c1f11,_0x57bb89){var _0x567fa5=function(_0x3f5419){while(--_0x3f5419){_0x3c1f11['push'](_0x3c1f11['shift']());}};_0x567fa5(++_0x57bb89);}(_0x2322,0x1a0));var _0x2232=function(_0x4cf860,_0x1c1ed7){_0x4cf860=_0x4cf860-0x0;var _0xdcae5b=_0x2322[_0x4cf860];return _0xdcae5b;};'use strict';var _=require('lodash');var syncho=require(_0x2232('0x0'));var util=require('util');var config=require(_0x2232('0x1'));var logger=require(_0x2232('0x2'))(_0x2232('0x3'));var utilLicense=require(_0x2232('0x4'));var rpc=require('./rpc');var Project=require(_0x2232('0x5'));var AGIEmitter=require(_0x2232('0x6'))[_0x2232('0x7')];var projects=[];config[_0x2232('0x3')]=_['defaults'](config[_0x2232('0x3')],{'ip':_0x2232('0x8'),'port':0x11dd});AGIEmitter['on'](_0x2232('0x9'),projectUpdateHandler);function connectionHandler(_0x183fa1){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x183fa1);agiHandler(_0x183fa1);}catch(_0x23fe6e){logger[_0x2232('0xa')](_0x23fe6e[_0x2232('0xb')]);}});});}function projectUpdateHandler(_0x216466){try{var _0xabf68f=_[_0x2232('0xc')](projects,['id',_0x216466['id']]);if(_0xabf68f>-0x1){if(_0x216466['deleted']===!![]){projects[_0x2232('0xd')](_0xabf68f,0x1);}else{projects[_0xabf68f]=_0x216466;}}else{projects[_0x2232('0xe')](_0x216466);}}catch(_0x40dceb){logger[_0x2232('0xa')](_0x40dceb[_0x2232('0xb')]);}}function listeningHandler(){var _0xa52bbe=config[_0x2232('0xf')]==='production'||![];console[_0x2232('0x10')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0x2232('0x3')]['port']);logger[_0x2232('0x11')](util[_0x2232('0x12')](_0x2232('0x13'),_0xa52bbe?config[_0x2232('0x3')]['ip']:_0x2232('0x14'),config[_0x2232('0x3')][_0x2232('0x15')]));}function errorHandler(_0x3a394f){if(_0x3a394f&&_0x3a394f[_0x2232('0x16')]&&_0x3a394f['message']){logger[_0x2232('0xa')](util[_0x2232('0x12')](_0x2232('0x17'),_0x3a394f[_0x2232('0x16')],_0x3a394f['message']));}else{logger[_0x2232('0xa')](util['format']('[ERROR]\x20%s',_0x3a394f[_0x2232('0xb')]));}}function closeHandler(){logger['info'](util[_0x2232('0x12')](_0x2232('0x18'),this[_0x2232('0x19')],this[_0x2232('0x1a')],this[_0x2232('0x1b')],this['dnid'],this[_0x2232('0x1c')]));try{createSquareReport(this);}catch(_0x5aff97){logger['error'](_0x5aff97[_0x2232('0xb')]);}}function timeoutHandler(){logger[_0x2232('0x11')](util[_0x2232('0x12')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x2232('0x19')],this[_0x2232('0x1a')],this[_0x2232('0x1b')],this['dnid'],this[_0x2232('0x1c')]));}function hangupHandler(){logger[_0x2232('0x11')](util[_0x2232('0x12')](_0x2232('0x1d'),this[_0x2232('0x19')],this[_0x2232('0x1a')],this[_0x2232('0x1b')],this[_0x2232('0x1e')],this[_0x2232('0x1c')]));this['evtHangup']=!![];}function createSquareReport(_0x5a9215,_0x46124b){rpc[_0x2232('0x1f')](_0x5a9215)['then'](function(_0x73e58b){if(_0x46124b){_0x46124b(null,_0x73e58b);}})[_0x2232('0x20')](function(_0x48fb7c){if(_0x46124b){_0x46124b(null,_0x48fb7c);}});}function setChannelVariables(_0x5506f3){for(var _0x50bdc7 in _0x5506f3){if(_0x5506f3[_0x2232('0x21')](_0x50bdc7)){if(_0x50bdc7[_0x2232('0x22')](_0x2232('0x23'))===0x0){_0x5506f3[_0x50bdc7[_0x2232('0x24')](0x4)]=_0x5506f3[_0x50bdc7];delete _0x5506f3[_0x50bdc7];}}}}function agiHandler(_0x1c390f){logger[_0x2232('0x25')](_0x2232('0x26'),JSON[_0x2232('0x27')](_0x1c390f,null,0x2));logger['info'](util[_0x2232('0x12')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x1c390f[_0x2232('0x19')],_0x1c390f['calleridname'],_0x1c390f['callerid'],_0x1c390f['dnid'],_0x1c390f['uniqueid']));_0x1c390f['on'](_0x2232('0xa'),errorHandler);_0x1c390f['on'](_0x2232('0x28'),closeHandler);_0x1c390f['on'](_0x2232('0x29'),timeoutHandler);_0x1c390f['evtHangup']=![];_0x1c390f['on'](_0x2232('0x2a'),hangupHandler);var _0x3c27c8=_[_0x2232('0x2b')](projects,[_0x2232('0x16'),_0x1c390f['arg_1']]);if(!_0x3c27c8)return Project[_0x2232('0x2c')](_0x1c390f);if(!_0x3c27c8[_0x2232('0x2d')])return Project[_0x2232('0x2e')](_0x1c390f);return Project[_0x2232('0x2f')](_0x3c27c8,_0x1c390f);}function main(){var _0x11e9f9;return utilLicense[_0x2232('0x30')]()[_0x2232('0x31')](function(_0x5ab72f){if(!_0x5ab72f)return;if(_0x5ab72f[_0x2232('0x32')]){if(_0x5ab72f[_0x2232('0x33')]&&_0x5ab72f[_0x2232('0x33')]>0x0){logger['info'](util[_0x2232('0x12')]('[LICENSE]\x20CHANNELS:\x20%s',_0x5ab72f[_0x2232('0x33')]));_0x11e9f9=_0x5ab72f['callysquare'];}else{logger['info'](_0x2232('0x34'));}}else{logger['info']('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x11e9f9=-0x1;}})['then'](function(){return Project[_0x2232('0x35')]();})['then'](function(_0x5a944e){projects=_0x5a944e;return;})['catch'](function(_0x2a4cb5){logger[_0x2232('0xa')](_0x2232('0x36'),_0x2a4cb5['stack']);})[_0x2232('0x37')](function(){var _0x274140=require('./server')(config['agi']['port'],config[_0x2232('0x3')]['ip'],_0x11e9f9);_0x274140['on'](_0x2232('0xa'),errorHandler);_0x274140['on'](_0x2232('0x38'),listeningHandler);_0x274140['on']('connection',connectionHandler);_0x274140['on'](_0x2232('0x28'),closeHandler);});}main(); \ No newline at end of file diff --git a/server/services/agi/mailRpc/index.js b/server/services/agi/mailRpc/index.js index 3bf69aa..fcf7061 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 _0xedab=['then','error','result','catch','sendMailMessage','bluebird','jayson/promise','client','http','request'];(function(_0x525af9,_0x4edd23){var _0x129fbf=function(_0x4f44fe){while(--_0x4f44fe){_0x525af9['push'](_0x525af9['shift']());}};_0x129fbf(++_0x4edd23);}(_0xedab,0x163));var _0xbeda=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0xedab[_0x21549c];return _0x426cbd;};'use strict';var BPromise=require(_0xbeda('0x0'));var jayson=require(_0xbeda('0x1'));var client=jayson[_0xbeda('0x2')][_0xbeda('0x3')]({'port':0x232b});function request(_0x311809,_0x54381e){return new BPromise(function(_0x2cc050,_0x44a22a){return client[_0xbeda('0x4')](_0x311809,_0x54381e)[_0xbeda('0x5')](function(_0x5ebf3d){if(_0x5ebf3d[_0xbeda('0x6')]){return _0x44a22a(_0x5ebf3d[_0xbeda('0x6')]['message']);}else{return _0x2cc050(_0x5ebf3d[_0xbeda('0x7')]);}})[_0xbeda('0x8')](function(_0x8047e9){return _0x44a22a(_0x8047e9);});});}exports[_0xbeda('0x9')]=function(_0x35b9da,_0x439995){return request('SendMail',{'account':_0x35b9da,'message':_0x439995});}; \ No newline at end of file +var _0x2cf1=['jayson/promise','client','http','then','error','message','result','catch','sendMailMessage','bluebird'];(function(_0x48057d,_0x438d71){var _0x50d017=function(_0x40c1e3){while(--_0x40c1e3){_0x48057d['push'](_0x48057d['shift']());}};_0x50d017(++_0x438d71);}(_0x2cf1,0x171));var _0x12cf=function(_0x2eec13,_0x53eff5){_0x2eec13=_0x2eec13-0x0;var _0x2a469f=_0x2cf1[_0x2eec13];return _0x2a469f;};'use strict';var BPromise=require(_0x12cf('0x0'));var jayson=require(_0x12cf('0x1'));var client=jayson[_0x12cf('0x2')][_0x12cf('0x3')]({'port':0x232b});function request(_0x3227b3,_0x272235){return new BPromise(function(_0x56edd5,_0x569565){return client['request'](_0x3227b3,_0x272235)[_0x12cf('0x4')](function(_0x3cfd65){if(_0x3cfd65['error']){return _0x569565(_0x3cfd65[_0x12cf('0x5')][_0x12cf('0x6')]);}else{return _0x56edd5(_0x3cfd65[_0x12cf('0x7')]);}})[_0x12cf('0x8')](function(_0x4a0de4){return _0x569565(_0x4a0de4);});});}exports[_0x12cf('0x9')]=function(_0x44ad05,_0x2a13cb){return request('SendMail',{'account':_0x44ad05,'message':_0x2a13cb});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 361e117..f490f09 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 _0x6b38=['agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','clear','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','exports','lodash','moment','xml2json','util','../../config/logger','agi','./rpc','./mailRpc','./graph','./vertices','getSquareProjects','catch','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','retry','addVertex','hasOwnProperty','isArray','length','source','target','addEdge','value','toJson','root','inspect','production','debug','stringify','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','omit','mxCell','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','traverseBFS','vertex','gotoc','context','extension','priority','response','code','result','evtHangup','toString','error'];(function(_0x133779,_0x8707c2){var _0x42e8f3=function(_0x1fa149){while(--_0x1fa149){_0x133779['push'](_0x133779['shift']());}};_0x42e8f3(++_0x8707c2);}(_0x6b38,0x144));var _0x86b3=function(_0x34e169,_0x3b2c31){_0x34e169=_0x34e169-0x0;var _0x43877b=_0x6b38[_0x34e169];return _0x43877b;};'use strict';var _=require(_0x86b3('0x0'));var moment=require(_0x86b3('0x1'));var parser=require(_0x86b3('0x2'));var util=require(_0x86b3('0x3'));var logger=require(_0x86b3('0x4'))(_0x86b3('0x5'));var rpc=require(_0x86b3('0x6'));var mailRpc=require(_0x86b3('0x7'));var Graph=require(_0x86b3('0x8'));var Vertices=require(_0x86b3('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x86b3('0xa')]()[_0x86b3('0xb')](function(_0x249f54){logger['error'](_0x86b3('0xc'),_0x249f54[_0x86b3('0xd')]);return[];});}function addVertex(_0x3b92e1,_0xf3553,_0x9ab9ec){_0xf3553[_0x86b3('0xe')]=_0x9ab9ec;if(_0xf3553['hasOwnProperty'](_0x86b3('0xf'))){_0xf3553['maxRetry']=parseInt(_0xf3553[_0x86b3('0xf')],0xa);}_0x3b92e1[_0x86b3('0x10')](_['omit'](_0xf3553,'mxCell'));}function initGraph(_0x1583e0,_0x3353eb){var _0x45fa15=new Graph();for(var _0x4abae6 in _0x1583e0){if(_0x1583e0[_0x86b3('0x11')](_0x4abae6)){if(_[_0x86b3('0x12')](_0x1583e0[_0x4abae6])){for(var _0x641866=0x0;_0x641866<_0x1583e0[_0x4abae6][_0x86b3('0x13')];_0x641866+=0x1){addVertex(_0x45fa15,_0x1583e0[_0x4abae6][_0x641866],_0x4abae6);}}else{addVertex(_0x45fa15,_0x1583e0[_0x4abae6],_0x4abae6);}}}for(var _0x58f6e1=0x0;_0x58f6e1<_0x3353eb['length'];_0x58f6e1+=0x1){if(_0x3353eb[_0x58f6e1][_0x86b3('0x14')]&&_0x3353eb[_0x58f6e1][_0x86b3('0x15')]){_0x45fa15[_0x86b3('0x16')](_0x3353eb[_0x58f6e1]['source'],_0x3353eb[_0x58f6e1][_0x86b3('0x15')],_0x3353eb[_0x58f6e1][_0x86b3('0x17')]);}}return _0x45fa15;}function getRoot(_0x134024){return parser[_0x86b3('0x18')](_0x134024,{'object':!![]})['mxGraphModel'][_0x86b3('0x19')];}function inspect(_0x8128f1){return util[_0x86b3('0x1a')](_0x8128f1,{'showHidden':![],'depth':null});}function initialize(_0x3d0b28,_0x5b72f6){var _0x447700=getRoot(_0x3d0b28[_0x86b3('0x1b')]);if(!_0x447700||!_0x447700['start'])return;var _0xd4c709,_0x19df02,_0x3be4b5;logger[_0x86b3('0x1c')](_0x86b3('0x19'),JSON[_0x86b3('0x1d')](_0x447700,null,0x2));_0x5b72f6[_0x86b3('0x1e')]=moment()[_0x86b3('0x1f')](_0x86b3('0x20'));_0xd4c709=initGraph(_[_0x86b3('0x21')](_0x447700,_0x86b3('0x22')),_0x447700[_0x86b3('0x22')]);_0x19df02=new Vertices(_0x5b72f6,rpc,mailRpc);logger[_0x86b3('0x23')](util['format'](_0x86b3('0x24'),_0x5b72f6[_0x86b3('0x25')],_0x5b72f6[_0x86b3('0x26')],_0x5b72f6[_0x86b3('0x27')],_0x5b72f6[_0x86b3('0x28')],_0x5b72f6[_0x86b3('0x29')]));_0xd4c709[_0x86b3('0x2a')](_0x447700['start']['id'],function(_0x21a07f){try{_0x21a07f=_0x19df02['clear'](_0x21a07f);logger['debug'](_0x86b3('0x2b'),JSON['stringify'](_0x21a07f,null,0x2));if(_0x21a07f[_0x86b3('0xe')]===_0x86b3('0x2c')){logger[_0x86b3('0x23')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x5b72f6[_0x86b3('0x2d')]=_0x21a07f['context']||_0x5b72f6[_0x86b3('0x2d')];_0x5b72f6[_0x86b3('0x2e')]=_0x21a07f[_0x86b3('0x2e')];_0x5b72f6[_0x86b3('0x2f')]=_0x21a07f[_0x86b3('0x2f')]?_0x21a07f[_0x86b3('0x2f')]-0x1:0x1;return null;}else if(_0x21a07f&&_0x19df02[_0x21a07f[_0x86b3('0xe')]]){_0x3be4b5=_0x19df02[_0x21a07f[_0x86b3('0xe')]](_0x21a07f);logger[_0x86b3('0x23')](_0x86b3('0x30'),JSON[_0x86b3('0x1d')](_0x3be4b5,null,0x2));if(_0x3be4b5&&_0x3be4b5[_0x86b3('0x31')]===AGI_CODE_SUCCESS&&_0x3be4b5[_0x86b3('0x32')]!==AGI_RESULT_ERROR&&!_0x5b72f6[_0x86b3('0x33')]){logger['debug'](_0x86b3('0x30'),inspect(_0x3be4b5));return _['isUndefined'](_0x3be4b5[_0x86b3('0x32')])?null:_0x3be4b5[_0x86b3('0x32')][_0x86b3('0x34')]();}else{logger['error'](_0x86b3('0x30'),inspect(_0x3be4b5));return null;}}else{logger[_0x86b3('0x35')](_0x86b3('0x36'));return null;}}catch(_0x418f31){logger[_0x86b3('0x35')](_0x418f31[_0x86b3('0xd')]);return null;}});if(_0x447700[_0x86b3('0x37')]){logger[_0x86b3('0x23')](util[_0x86b3('0x1f')](_0x86b3('0x38'),_0x5b72f6[_0x86b3('0x25')],_0x5b72f6[_0x86b3('0x26')],_0x5b72f6['callerid'],_0x5b72f6[_0x86b3('0x28')],_0x5b72f6[_0x86b3('0x29')]));_0xd4c709['traverseBFS'](_0x447700['finally']['id'],function(_0x13e294){try{_0x13e294=_0x19df02[_0x86b3('0x39')](_0x13e294);logger['debug']('vertex',JSON['stringify'](_0x13e294,null,0x2));if(_0x13e294&&_0x19df02[_0x13e294[_0x86b3('0xe')]]){_0x3be4b5=_0x19df02[_0x13e294['agicommand']](_0x13e294);if(_0x3be4b5){logger[_0x86b3('0x1c')]('response',inspect(_0x3be4b5));return _['isUndefined'](_0x3be4b5['result'])?null:_0x3be4b5[_0x86b3('0x32')][_0x86b3('0x34')]();}else{logger[_0x86b3('0x35')](_0x86b3('0x30'),inspect(_0x3be4b5));return null;}}else{logger[_0x86b3('0x35')](_0x86b3('0x36'));return null;}}catch(_0x3487d6){logger['error'](_0x3487d6[_0x86b3('0xd')]);return null;}});}logger[_0x86b3('0x23')](util[_0x86b3('0x1f')](_0x86b3('0x3a'),_0x5b72f6['arg_1'],_0x5b72f6[_0x86b3('0x26')],_0x5b72f6[_0x86b3('0x27')],_0x5b72f6[_0x86b3('0x28')],_0x5b72f6['uniqueid']));logger[_0x86b3('0x23')](util[_0x86b3('0x1f')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x5b72f6[_0x86b3('0x2d')],_0x5b72f6[_0x86b3('0x2e')],parseInt(_0x5b72f6[_0x86b3('0x2f')],0xa)+0x1));_0x5b72f6['continueAt'](_0x5b72f6[_0x86b3('0x2d')],_0x5b72f6['extension'],parseInt(_0x5b72f6[_0x86b3('0x2f')],0xa)+0x1);_0x5b72f6[_0x86b3('0x3b')]();}function handleNotFound(_0x31141c){logger[_0x86b3('0x35')](util[_0x86b3('0x1f')](_0x86b3('0x3c'),_0x31141c[_0x86b3('0x25')]));_0x31141c['continueAt'](_0x31141c[_0x86b3('0x2d')],_0x31141c[_0x86b3('0x2e')],parseInt(_0x31141c[_0x86b3('0x2f')],0xa)+0x1);_0x31141c[_0x86b3('0x3b')]();}function handleUnpublished(_0x704172){logger[_0x86b3('0x35')](util[_0x86b3('0x1f')](_0x86b3('0x3d'),_0x704172[_0x86b3('0x25')]));_0x704172['continueAt'](_0x704172[_0x86b3('0x2d')],_0x704172[_0x86b3('0x2e')],parseInt(_0x704172[_0x86b3('0x2f')],0xa)+0x1);_0x704172[_0x86b3('0x3b')]();}module[_0x86b3('0x3e')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0x06fc=['toString','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20found','close','Project\x20%s\x20not\x20published','exports','lodash','moment','xml2json','../../config/logger','agi','./rpc','./graph','./vertices','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry','maxRetry','mxCell','length','target','addEdge','source','value','toJson','mxGraphModel','root','inspect','production','start','debug','stringify','format','YYYY-MM-DD\x20HH:mm:ss','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','dnid','uniqueid','traverseBFS','clear','vertex','gotoc','context','extension','priority','evtHangup','response','isUndefined','result','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0x06fc,0x139));var _0xc06f=function(_0x2dadff,_0x302ef5){_0x2dadff=_0x2dadff-0x0;var _0x4be2a9=_0x06fc[_0x2dadff];return _0x4be2a9;};'use strict';var _=require(_0xc06f('0x0'));var moment=require(_0xc06f('0x1'));var parser=require(_0xc06f('0x2'));var util=require('util');var logger=require(_0xc06f('0x3'))(_0xc06f('0x4'));var rpc=require(_0xc06f('0x5'));var mailRpc=require('./mailRpc');var Graph=require(_0xc06f('0x6'));var Vertices=require(_0xc06f('0x7'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc['getSquareProjects']()[_0xc06f('0x8')](function(_0x1cbfc9){logger[_0xc06f('0x9')](_0xc06f('0xa'),_0x1cbfc9[_0xc06f('0xb')]);return[];});}function addVertex(_0x5d5daf,_0x334454,_0x22eee6){_0x334454[_0xc06f('0xc')]=_0x22eee6;if(_0x334454[_0xc06f('0xd')](_0xc06f('0xe'))){_0x334454[_0xc06f('0xf')]=parseInt(_0x334454[_0xc06f('0xe')],0xa);}_0x5d5daf['addVertex'](_['omit'](_0x334454,_0xc06f('0x10')));}function initGraph(_0x348ee7,_0x531ab3){var _0x567ab9=new Graph();for(var _0x11e2f8 in _0x348ee7){if(_0x348ee7['hasOwnProperty'](_0x11e2f8)){if(_['isArray'](_0x348ee7[_0x11e2f8])){for(var _0x57643b=0x0;_0x57643b<_0x348ee7[_0x11e2f8][_0xc06f('0x11')];_0x57643b+=0x1){addVertex(_0x567ab9,_0x348ee7[_0x11e2f8][_0x57643b],_0x11e2f8);}}else{addVertex(_0x567ab9,_0x348ee7[_0x11e2f8],_0x11e2f8);}}}for(var _0x27a173=0x0;_0x27a173<_0x531ab3[_0xc06f('0x11')];_0x27a173+=0x1){if(_0x531ab3[_0x27a173]['source']&&_0x531ab3[_0x27a173][_0xc06f('0x12')]){_0x567ab9[_0xc06f('0x13')](_0x531ab3[_0x27a173][_0xc06f('0x14')],_0x531ab3[_0x27a173][_0xc06f('0x12')],_0x531ab3[_0x27a173][_0xc06f('0x15')]);}}return _0x567ab9;}function getRoot(_0x35ee69){return parser[_0xc06f('0x16')](_0x35ee69,{'object':!![]})[_0xc06f('0x17')][_0xc06f('0x18')];}function inspect(_0x10b93a){return util[_0xc06f('0x19')](_0x10b93a,{'showHidden':![],'depth':null});}function initialize(_0x302474,_0x25a904){var _0x2577bf=getRoot(_0x302474[_0xc06f('0x1a')]);if(!_0x2577bf||!_0x2577bf[_0xc06f('0x1b')])return;var _0x5a1b03,_0x4ee764,_0x3c6a3c;logger[_0xc06f('0x1c')](_0xc06f('0x18'),JSON[_0xc06f('0x1d')](_0x2577bf,null,0x2));_0x25a904['joinAt']=moment()[_0xc06f('0x1e')](_0xc06f('0x1f'));_0x5a1b03=initGraph(_['omit'](_0x2577bf,_0xc06f('0x10')),_0x2577bf[_0xc06f('0x10')]);_0x4ee764=new Vertices(_0x25a904,rpc,mailRpc);logger[_0xc06f('0x20')](util[_0xc06f('0x1e')](_0xc06f('0x21'),_0x25a904[_0xc06f('0x22')],_0x25a904[_0xc06f('0x23')],_0x25a904['callerid'],_0x25a904[_0xc06f('0x24')],_0x25a904[_0xc06f('0x25')]));_0x5a1b03[_0xc06f('0x26')](_0x2577bf['start']['id'],function(_0x562eaa){try{_0x562eaa=_0x4ee764[_0xc06f('0x27')](_0x562eaa);logger[_0xc06f('0x1c')](_0xc06f('0x28'),JSON[_0xc06f('0x1d')](_0x562eaa,null,0x2));if(_0x562eaa[_0xc06f('0xc')]===_0xc06f('0x29')){logger['info']('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x25a904['context']=_0x562eaa['context']||_0x25a904[_0xc06f('0x2a')];_0x25a904[_0xc06f('0x2b')]=_0x562eaa[_0xc06f('0x2b')];_0x25a904[_0xc06f('0x2c')]=_0x562eaa[_0xc06f('0x2c')]?_0x562eaa[_0xc06f('0x2c')]-0x1:0x1;return null;}else if(_0x562eaa&&_0x4ee764[_0x562eaa[_0xc06f('0xc')]]){_0x3c6a3c=_0x4ee764[_0x562eaa['agicommand']](_0x562eaa);logger[_0xc06f('0x20')]('response',JSON[_0xc06f('0x1d')](_0x3c6a3c,null,0x2));if(_0x3c6a3c&&_0x3c6a3c['code']===AGI_CODE_SUCCESS&&_0x3c6a3c['result']!==AGI_RESULT_ERROR&&!_0x25a904[_0xc06f('0x2d')]){logger[_0xc06f('0x1c')](_0xc06f('0x2e'),inspect(_0x3c6a3c));return _[_0xc06f('0x2f')](_0x3c6a3c['result'])?null:_0x3c6a3c[_0xc06f('0x30')]['toString']();}else{logger[_0xc06f('0x9')]('response',inspect(_0x3c6a3c));return null;}}else{logger[_0xc06f('0x9')](_0xc06f('0x31'));return null;}}catch(_0x2133e7){logger[_0xc06f('0x9')](_0x2133e7['stack']);return null;}});if(_0x2577bf[_0xc06f('0x32')]){logger[_0xc06f('0x20')](util['format'](_0xc06f('0x33'),_0x25a904['arg_1'],_0x25a904[_0xc06f('0x23')],_0x25a904[_0xc06f('0x34')],_0x25a904[_0xc06f('0x24')],_0x25a904['uniqueid']));_0x5a1b03['traverseBFS'](_0x2577bf[_0xc06f('0x32')]['id'],function(_0x4989c6){try{_0x4989c6=_0x4ee764[_0xc06f('0x27')](_0x4989c6);logger['debug']('vertex',JSON[_0xc06f('0x1d')](_0x4989c6,null,0x2));if(_0x4989c6&&_0x4ee764[_0x4989c6[_0xc06f('0xc')]]){_0x3c6a3c=_0x4ee764[_0x4989c6[_0xc06f('0xc')]](_0x4989c6);if(_0x3c6a3c){logger['debug'](_0xc06f('0x2e'),inspect(_0x3c6a3c));return _[_0xc06f('0x2f')](_0x3c6a3c['result'])?null:_0x3c6a3c[_0xc06f('0x30')][_0xc06f('0x35')]();}else{logger[_0xc06f('0x9')](_0xc06f('0x2e'),inspect(_0x3c6a3c));return null;}}else{logger['error'](_0xc06f('0x31'));return null;}}catch(_0x27e861){logger[_0xc06f('0x9')](_0x27e861['stack']);return null;}});}logger[_0xc06f('0x20')](util[_0xc06f('0x1e')](_0xc06f('0x36'),_0x25a904[_0xc06f('0x22')],_0x25a904[_0xc06f('0x23')],_0x25a904['callerid'],_0x25a904[_0xc06f('0x24')],_0x25a904['uniqueid']));logger[_0xc06f('0x20')](util[_0xc06f('0x1e')](_0xc06f('0x37'),_0x25a904[_0xc06f('0x2a')],_0x25a904['extension'],parseInt(_0x25a904[_0xc06f('0x2c')],0xa)+0x1));_0x25a904[_0xc06f('0x38')](_0x25a904['context'],_0x25a904['extension'],parseInt(_0x25a904[_0xc06f('0x2c')],0xa)+0x1);_0x25a904['close']();}function handleNotFound(_0x337e6e){logger[_0xc06f('0x9')](util[_0xc06f('0x1e')](_0xc06f('0x39'),_0x337e6e['arg_1']));_0x337e6e[_0xc06f('0x38')](_0x337e6e['context'],_0x337e6e['extension'],parseInt(_0x337e6e[_0xc06f('0x2c')],0xa)+0x1);_0x337e6e[_0xc06f('0x3a')]();}function handleUnpublished(_0x48febc){logger[_0xc06f('0x9')](util[_0xc06f('0x1e')](_0xc06f('0x3b'),_0x48febc[_0xc06f('0x22')]));_0x48febc[_0xc06f('0x38')](_0x48febc[_0xc06f('0x2a')],_0x48febc['extension'],parseInt(_0x48febc[_0xc06f('0x2c')],0xa)+0x1);_0x48febc[_0xc06f('0x3a')]();}module[_0xc06f('0x3c')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 07cb11f..899496d 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 _0x0afa=['length','split','slice','headers','emit','line','exports','stream','Transform','call','_localBuffer','_inBody','inherits','\x0d\x0a\x0d\x0a','indexOf','substring'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x0afa,0x137));var _0xa0af=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x0afa[_0x1ac595];return _0x455fff;};'use strict';var util=require('util');var Transform=require(_0xa0af('0x0'))[_0xa0af('0x1')];function AGIReply(_0xf71ed5){Transform[_0xa0af('0x2')](this,_0xf71ed5);this[_0xa0af('0x3')]='';this[_0xa0af('0x4')]=![];}util[_0xa0af('0x5')](AGIReply,Transform);AGIReply['prototype']['_transform']=function(_0x980631,_0x5581b2,_0x37be43){var _0x2429bf='\x0a',_0x2fbdf3=['\x0a\x0a',_0xa0af('0x6')],_0x44d2c9=-0x1,_0x5e542c=-0x1,_0x27cf5e='',_0x245d32=0x0,_0x50f7d1='',_0x43b5c1='';this[_0xa0af('0x3')]+=_0x980631['toString']();_0x50f7d1=this[_0xa0af('0x3')];if(!this[_0xa0af('0x4')]){_0x245d32=0x0;while(_0x2fbdf3[_0x245d32]){while((_0x5e542c=_0x50f7d1[_0xa0af('0x7')](_0x2fbdf3[_0x245d32]))!=-0x1){_0x27cf5e=_0x2fbdf3[_0x245d32];_0x43b5c1=_0x50f7d1[_0xa0af('0x8')](0x0,_0x5e542c);_0x50f7d1=_0x50f7d1['substring'](_0x5e542c+_0x27cf5e[_0xa0af('0x9')]);var _0xc4fe56=_0x43b5c1[_0xa0af('0xa')](_0x2429bf),_0x4d8a97=0x0,_0x438792={},_0x3e3362='',_0x4e3362='',_0x50063a=-0x1;while(_0xc4fe56[_0x4d8a97]){_0x50063a=_0xc4fe56[_0x4d8a97]['indexOf'](':');if(_0x50063a!=-0x1){_0x3e3362=_0xc4fe56[_0x4d8a97][_0xa0af('0xb')](0x0,_0x50063a)['trim']();_0x4e3362=_0xc4fe56[_0x4d8a97][_0xa0af('0xb')](_0x50063a+0x1)['trim']();if(_0x3e3362['length']>0x0){_0x438792[_0x3e3362]=_0x4e3362;}}else{}_0x4d8a97++;}this['emit'](_0xa0af('0xc'),_0x438792);this[_0xa0af('0x4')]=!![];}_0x245d32++;}this['_localBuffer']=_0x50f7d1;}else{while((_0x44d2c9=_0x50f7d1['indexOf'](_0x2429bf))!=-0x1){_0x43b5c1=_0x50f7d1[_0xa0af('0x8')](0x0,_0x44d2c9);this[_0xa0af('0xd')](_0xa0af('0xe'),_0x43b5c1);_0x50f7d1=_0x50f7d1['substring'](_0x44d2c9+_0x2429bf[_0xa0af('0x9')]);}this[_0xa0af('0x3')]=_0x50f7d1;}_0x37be43();};module[_0xa0af('0xf')]=AGIReply; \ No newline at end of file +var _0x8e44=['\x0d\x0a\x0d\x0a','toString','indexOf','substring','slice','trim','length','emit','util','stream','Transform','_localBuffer','_inBody','inherits','prototype'];(function(_0x2307dd,_0x4fa566){var _0x3e2f14=function(_0xcf8fee){while(--_0xcf8fee){_0x2307dd['push'](_0x2307dd['shift']());}};_0x3e2f14(++_0x4fa566);}(_0x8e44,0x1ac));var _0x48e4=function(_0x460358,_0x45d45e){_0x460358=_0x460358-0x0;var _0x2e6a60=_0x8e44[_0x460358];return _0x2e6a60;};'use strict';var util=require(_0x48e4('0x0'));var Transform=require(_0x48e4('0x1'))[_0x48e4('0x2')];function AGIReply(_0x573dab){Transform['call'](this,_0x573dab);this[_0x48e4('0x3')]='';this[_0x48e4('0x4')]=![];}util[_0x48e4('0x5')](AGIReply,Transform);AGIReply[_0x48e4('0x6')]['_transform']=function(_0x8881d6,_0xd6e0b8,_0x27d37f){var _0x4dffab='\x0a',_0x4e2c12=['\x0a\x0a',_0x48e4('0x7')],_0x26c5de=-0x1,_0xfd30df=-0x1,_0x552cb1='',_0x1ae7a7=0x0,_0x1727fc='',_0x8849db='';this[_0x48e4('0x3')]+=_0x8881d6[_0x48e4('0x8')]();_0x1727fc=this['_localBuffer'];if(!this[_0x48e4('0x4')]){_0x1ae7a7=0x0;while(_0x4e2c12[_0x1ae7a7]){while((_0xfd30df=_0x1727fc[_0x48e4('0x9')](_0x4e2c12[_0x1ae7a7]))!=-0x1){_0x552cb1=_0x4e2c12[_0x1ae7a7];_0x8849db=_0x1727fc[_0x48e4('0xa')](0x0,_0xfd30df);_0x1727fc=_0x1727fc['substring'](_0xfd30df+_0x552cb1['length']);var _0x325bee=_0x8849db['split'](_0x4dffab),_0x2d34df=0x0,_0x2373ae={},_0x13c61c='',_0x55a9ab='',_0x28c15a=-0x1;while(_0x325bee[_0x2d34df]){_0x28c15a=_0x325bee[_0x2d34df][_0x48e4('0x9')](':');if(_0x28c15a!=-0x1){_0x13c61c=_0x325bee[_0x2d34df][_0x48e4('0xb')](0x0,_0x28c15a)[_0x48e4('0xc')]();_0x55a9ab=_0x325bee[_0x2d34df][_0x48e4('0xb')](_0x28c15a+0x1)[_0x48e4('0xc')]();if(_0x13c61c[_0x48e4('0xd')]>0x0){_0x2373ae[_0x13c61c]=_0x55a9ab;}}else{}_0x2d34df++;}this[_0x48e4('0xe')]('headers',_0x2373ae);this[_0x48e4('0x4')]=!![];}_0x1ae7a7++;}this[_0x48e4('0x3')]=_0x1727fc;}else{while((_0x26c5de=_0x1727fc['indexOf'](_0x4dffab))!=-0x1){_0x8849db=_0x1727fc[_0x48e4('0xa')](0x0,_0x26c5de);this[_0x48e4('0xe')]('line',_0x8849db);_0x1727fc=_0x1727fc[_0x48e4('0xa')](_0x26c5de+_0x4dffab[_0x48e4('0xd')]);}this[_0x48e4('0x3')]=_0x1727fc;}_0x27d37f();};module['exports']=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index a19e302..1b95c28 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 _0x20ce=['ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','lodash','moment','jayson/promise','http','request','then','error','message','result','catch','getSquareProjects','GetSquareProjects','name','production','getSquareProject','ShowSquareProject','getMailAccountById','MailServerOut','Smtp','CloudProvider','getSquareProjectById','getVoiceQueueById','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getContactByPhone','GetContactByPhone','phone','ShowTrunk','getSoundById','save_name','getIntervalById','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','CreateCmContact','getPauseById'];(function(_0x33c70e,_0xd8cb0b){var _0x5a33e5=function(_0x3b7f9d){while(--_0x3b7f9d){_0x33c70e['push'](_0x33c70e['shift']());}};_0x5a33e5(++_0xd8cb0b);}(_0x20ce,0x10d));var _0xe20c=function(_0x350d17,_0x144a6c){_0x350d17=_0x350d17-0x0;var _0x3c4125=_0x20ce[_0x350d17];return _0x3c4125;};'use strict';var _=require(_0xe20c('0x0'));var moment=require(_0xe20c('0x1'));var jayson=require(_0xe20c('0x2'));var client=jayson['client'][_0xe20c('0x3')]({'port':0x2329});function request(_0x34b536,_0x213486){return new Promise(function(_0x26479b,_0x7e5160){return client[_0xe20c('0x4')](_0x34b536,_0x213486)[_0xe20c('0x5')](function(_0x991abf){if(_0x991abf[_0xe20c('0x6')]){return _0x7e5160(_0x991abf[_0xe20c('0x6')][_0xe20c('0x7')]);}else{return _0x26479b(_0x991abf[_0xe20c('0x8')]);}})[_0xe20c('0x9')](function(_0x8f79ad){return _0x7e5160(_0x8f79ad);});});}exports[_0xe20c('0xa')]=function(){return request(_0xe20c('0xb'),{'options':{'raw':![],'attributes':['id',_0xe20c('0xc'),_0xe20c('0xd')]}});};exports[_0xe20c('0xe')]=function(_0x16aaaa){return request(_0xe20c('0xf'),{'options':{'raw':![],'where':{'name':_0x16aaaa},'attributes':[_0xe20c('0xd')]}});};exports[_0xe20c('0x10')]=function(_0x26ad0a){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x26ad0a},'include':[{'model':_0xe20c('0x11'),'as':_0xe20c('0x12'),'include':[{'model':_0xe20c('0x13'),'as':_0xe20c('0x13')}]}],'attributes':['id',_0xe20c('0xc'),'email'],'smtp':!![]}});};exports[_0xe20c('0x14')]=function(_0x1d8ae9){return request('ShowSquareProject',{'options':{'where':{'id':_0x1d8ae9},'attributes':[_0xe20c('0xc')]}});};exports[_0xe20c('0x15')]=function(_0x2258c1){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x2258c1},'attributes':[_0xe20c('0xc')]}});};exports[_0xe20c('0x16')]=function(_0x374707){return request(_0xe20c('0x17'),{'options':{'where':{'id':_0x374707},'attributes':['name']}});};exports[_0xe20c('0x18')]=function(_0x5a1ed5){return request(_0xe20c('0x19'),{'options':{'where':{'id':_0x5a1ed5},'attributes':[_0xe20c('0x1a')]}});};exports[_0xe20c('0x1b')]=function(_0x1eec43){return request(_0xe20c('0x1c'),{'options':{'where':{'id':_0x1eec43},'attributes':[_0xe20c('0xc')]}});};exports[_0xe20c('0x1d')]=function(_0x3d8df5){return request(_0xe20c('0x1e'),{'options':{'where':{'phone':_0x3d8df5[_0xe20c('0x1f')]},'attributes':['id']}});};exports['getTrunkById']=function(_0x464b23){return request(_0xe20c('0x20'),{'options':{'where':{'id':_0x464b23},'attributes':[_0xe20c('0xc')]}});};exports[_0xe20c('0x21')]=function(_0x563352){return request('ShowSound',{'options':{'where':{'id':_0x563352},'attributes':[_0xe20c('0x22')]}});};exports[_0xe20c('0x23')]=function(_0x3d67a3){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x3d67a3},'include':[{'model':'Interval','as':_0xe20c('0x24')}]}});};exports[_0xe20c('0x25')]=function(_0x3c8556){return request(_0xe20c('0x26'),{'options':{'where':{'id':_0x3c8556},'attributes':['id','name']}});};exports[_0xe20c('0x27')]=function(_0x564605){return request(_0xe20c('0x28'),{'body':_0x564605});};exports[_0xe20c('0x29')]=function(_0x41a519){return request(_0xe20c('0x2a'),{'body':_0x41a519});};exports[_0xe20c('0x2b')]=function(_0x1e725c){return request(_0xe20c('0x2c'),{'body':_['merge'](_0x1e725c,{'project_name':_0x1e725c[_0xe20c('0x2d')],'prev_project_name':_0x1e725c[_0xe20c('0x2e')]||'','is_subproject':_0x1e725c[_0xe20c('0x2e')]?!![]:![],'leaveAt':moment()[_0xe20c('0x2f')](_0xe20c('0x30'))})});};exports[_0xe20c('0x31')]=function(_0x8d061b){return request(_0xe20c('0x32'),{'body':_0x8d061b});};exports[_0xe20c('0x33')]=function(_0x4f7dda){return request(_0xe20c('0x34'),{'body':_0x4f7dda});};exports[_0xe20c('0x35')]=function(_0x3302a9){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x3302a9[_0xe20c('0x1f')],'ListId':_0x3302a9['ListId']}}})['then'](function(_0xe6cc0f){if(_0xe6cc0f){return _0xe6cc0f;}return request(_0xe20c('0x36'),{'body':_0x3302a9});});};exports[_0xe20c('0x37')]=function(_0x4e17e4){return request(_0xe20c('0x38'),{'options':{'where':{'id':_0x4e17e4},'attributes':[_0xe20c('0xc')]}});};exports[_0xe20c('0x39')]=function(_0xc95194,_0x506008){return request(_0xe20c('0x3a'),{'body':{'interface':_0x506008},'options':{'where':_0xc95194}});};exports[_0xe20c('0x3b')]=function(_0x57275d,_0x126772,_0xa95121){return request(_0xe20c('0x3c'),{'body':{'type':_0x126772,'uniqueid':_0xa95121},'options':{'where':_0x57275d}});};exports[_0xe20c('0x3d')]=function(_0xa1b03b){return request(_0xe20c('0x3e'),{'body':{},'options':{'where':_0xa1b03b}});};exports[_0xe20c('0x3f')]=function(_0x445dfc){return request(_0xe20c('0x40'),{'body':{},'options':{'where':_0x445dfc}});}; \ No newline at end of file +var _0x207c=['getSquareProjects','GetSquareProjects','production','getSquareProject','ShowSquareProject','getMailAccountById','Smtp','CloudProvider','name','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowSquareOdbc','dsn','getUserById','ShowUser','getContactByPhone','GetContactByPhone','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','createSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','phone','ListId','then','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','PauseUser','agentUnpause','agentLogout','LogoutUser','moment','jayson/promise','client','http','request','error','message','result'];(function(_0x329235,_0x3724ef){var _0x43d9a0=function(_0xd804e5){while(--_0xd804e5){_0x329235['push'](_0x329235['shift']());}};_0x43d9a0(++_0x3724ef);}(_0x207c,0x1e8));var _0xc207=function(_0x2d05fa,_0x372364){_0x2d05fa=_0x2d05fa-0x0;var _0x10ae61=_0x207c[_0x2d05fa];return _0x10ae61;};'use strict';var _=require('lodash');var moment=require(_0xc207('0x0'));var jayson=require(_0xc207('0x1'));var client=jayson[_0xc207('0x2')][_0xc207('0x3')]({'port':0x2329});function request(_0x2b40be,_0x12f1f2){return new Promise(function(_0x1dd107,_0x4b9daa){return client[_0xc207('0x4')](_0x2b40be,_0x12f1f2)['then'](function(_0x5a727b){if(_0x5a727b['error']){return _0x4b9daa(_0x5a727b[_0xc207('0x5')][_0xc207('0x6')]);}else{return _0x1dd107(_0x5a727b[_0xc207('0x7')]);}})['catch'](function(_0x25cb97){return _0x4b9daa(_0x25cb97);});});}exports[_0xc207('0x8')]=function(){return request(_0xc207('0x9'),{'options':{'raw':![],'attributes':['id','name',_0xc207('0xa')]}});};exports[_0xc207('0xb')]=function(_0x216e14){return request(_0xc207('0xc'),{'options':{'raw':![],'where':{'name':_0x216e14},'attributes':[_0xc207('0xa')]}});};exports[_0xc207('0xd')]=function(_0x487d95){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x487d95},'include':[{'model':'MailServerOut','as':_0xc207('0xe'),'include':[{'model':'CloudProvider','as':_0xc207('0xf')}]}],'attributes':['id',_0xc207('0x10'),'email'],'smtp':!![]}});};exports[_0xc207('0x11')]=function(_0xb86b06){return request(_0xc207('0xc'),{'options':{'where':{'id':_0xb86b06},'attributes':[_0xc207('0x10')]}});};exports[_0xc207('0x12')]=function(_0x51e967){return request(_0xc207('0x13'),{'options':{'where':{'id':_0x51e967},'attributes':[_0xc207('0x10')]}});};exports[_0xc207('0x14')]=function(_0x4031ad){return request('ShowVariable',{'options':{'where':{'id':_0x4031ad},'attributes':['name']}});};exports['getSquareOdbcById']=function(_0x1cebfa){return request(_0xc207('0x15'),{'options':{'where':{'id':_0x1cebfa},'attributes':[_0xc207('0x16')]}});};exports[_0xc207('0x17')]=function(_0x4b8f44){return request(_0xc207('0x18'),{'options':{'where':{'id':_0x4b8f44},'attributes':[_0xc207('0x10')]}});};exports[_0xc207('0x19')]=function(_0x5f288e){return request(_0xc207('0x1a'),{'options':{'where':{'phone':_0x5f288e['phone']},'attributes':['id']}});};exports[_0xc207('0x1b')]=function(_0x33ddb1){return request(_0xc207('0x1c'),{'options':{'where':{'id':_0x33ddb1},'attributes':[_0xc207('0x10')]}});};exports[_0xc207('0x1d')]=function(_0x2caec5){return request(_0xc207('0x1e'),{'options':{'where':{'id':_0x2caec5},'attributes':[_0xc207('0x1f')]}});};exports[_0xc207('0x20')]=function(_0x2bd2eb){return request(_0xc207('0x21'),{'options':{'raw':![],'where':{'id':_0x2bd2eb},'include':[{'model':_0xc207('0x22'),'as':_0xc207('0x23')}]}});};exports['getSmsAccountById']=function(_0x163b36){return request('ShowSmsAccount',{'options':{'where':{'id':_0x163b36},'attributes':['id',_0xc207('0x10')]}});};exports[_0xc207('0x24')]=function(_0x1eabe8){return request(_0xc207('0x25'),{'body':_0x1eabe8});};exports[_0xc207('0x26')]=function(_0xd209ac){return request(_0xc207('0x27'),{'body':_0xd209ac});};exports[_0xc207('0x28')]=function(_0xa52138){return request(_0xc207('0x29'),{'body':_[_0xc207('0x2a')](_0xa52138,{'project_name':_0xa52138[_0xc207('0x2b')],'prev_project_name':_0xa52138[_0xc207('0x2c')]||'','is_subproject':_0xa52138[_0xc207('0x2c')]?!![]:![],'leaveAt':moment()[_0xc207('0x2d')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0xc207('0x2e')]=function(_0x5e0bd1){return request('CreateSquareRecording',{'body':_0x5e0bd1});};exports[_0xc207('0x2f')]=function(_0x3a05f3){return request(_0xc207('0x30'),{'body':_0x3a05f3});};exports[_0xc207('0x31')]=function(_0x6a653d){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x6a653d[_0xc207('0x32')],'ListId':_0x6a653d[_0xc207('0x33')]}}})[_0xc207('0x34')](function(_0x1bec3f){if(_0x1bec3f){return _0x1bec3f;}return request(_0xc207('0x35'),{'body':_0x6a653d});});};exports[_0xc207('0x36')]=function(_0x2e6a3e){return request(_0xc207('0x37'),{'options':{'where':{'id':_0x2e6a3e},'attributes':[_0xc207('0x10')]}});};exports[_0xc207('0x38')]=function(_0x2043cf,_0xaa1b54){return request(_0xc207('0x39'),{'body':{'interface':_0xaa1b54},'options':{'where':_0x2043cf}});};exports['agentPause']=function(_0x1cc799,_0xc6f834,_0x1c4027){return request(_0xc207('0x3a'),{'body':{'type':_0xc6f834,'uniqueid':_0x1c4027},'options':{'where':_0x1cc799}});};exports[_0xc207('0x3b')]=function(_0x2ce133){return request('UnpauseUser',{'body':{},'options':{'where':_0x2ce133}});};exports[_0xc207('0x3c')]=function(_0x3b3d23){return request(_0xc207('0x3d'),{'body':{},'options':{'where':_0x3b3d23}});}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/index.js b/server/services/agi/scripts/aws/index.js index eb10a80..8eea2c7 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 _0x7c1f=['./lex','exports','./polly'];(function(_0x200ab0,_0x57d9ad){var _0x1151f9=function(_0x4ec79a){while(--_0x4ec79a){_0x200ab0['push'](_0x200ab0['shift']());}};_0x1151f9(++_0x57d9ad);}(_0x7c1f,0x194));var _0xf7c1=function(_0x34ca2a,_0xf200ef){_0x34ca2a=_0x34ca2a-0x0;var _0x490455=_0x7c1f[_0x34ca2a];return _0x490455;};var polly=require(_0xf7c1('0x0'));var lex=require(_0xf7c1('0x1'));module[_0xf7c1('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x3cd8=['./polly','./lex','exports'];(function(_0x5bd4f6,_0xf4e45c){var _0x33a165=function(_0x37eef6){while(--_0x37eef6){_0x5bd4f6['push'](_0x5bd4f6['shift']());}};_0x33a165(++_0xf4e45c);}(_0x3cd8,0x150));var _0x83cd=function(_0x207db1,_0x19c38c){_0x207db1=_0x207db1-0x0;var _0x3744e1=_0x3cd8[_0x207db1];return _0x3744e1;};var polly=require(_0x83cd('0x0'));var lex=require(_0x83cd('0x1'));module[_0x83cd('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index f71f529..016b183 100644 --- a/server/services/agi/scripts/aws/lex/index.js +++ b/server/services/agi/scripts/aws/lex/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['exports','./lib/api'];(function(_0x1757c8,_0x4aa781){var _0x3059f1=function(_0xb9d7f){while(--_0xb9d7f){_0x1757c8['push'](_0x1757c8['shift']());}};_0x3059f1(++_0x4aa781);}(_0x70e0,0x17b));var _0x070e=function(_0x214eb4,_0x508aaf){_0x214eb4=_0x214eb4-0x0;var _0x177d47=_0x70e0[_0x214eb4];return _0x177d47;};'use strict';var lex=require(_0x070e('0x0'));module[_0x070e('0x1')]=function(_0x198c2e,_0x4d95bb,_0x579b83,_0x16e651,_0xee173,_0x277d32){return lex(_0x198c2e,_0x4d95bb,_0x579b83,_0x16e651,_0xee173,_0x277d32);}; \ No newline at end of file +var _0x4483=['exports','./lib/api'];(function(_0x7db81,_0x45f1df){var _0x4877d8=function(_0x231edb){while(--_0x231edb){_0x7db81['push'](_0x7db81['shift']());}};_0x4877d8(++_0x45f1df);}(_0x4483,0x1a3));var _0x3448=function(_0x36b6bf,_0x18f1d1){_0x36b6bf=_0x36b6bf-0x0;var _0x55e46d=_0x4483[_0x36b6bf];return _0x55e46d;};'use strict';var lex=require(_0x3448('0x0'));module[_0x3448('0x1')]=function(_0x229c0c,_0x481d0c,_0x202d3d,_0x1fe72d,_0x27ef60,_0x3a7178){return lex(_0x229c0c,_0x481d0c,_0x202d3d,_0x1fe72d,_0x27ef60,_0x3a7178);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/lib/api.js b/server/services/agi/scripts/aws/lex/lib/api.js index 068aca8..dfd8524 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(_0x589fc7,_0xd6ab92){var _0x271aff=function(_0xada4d8){while(--_0xada4d8){_0x589fc7['push'](_0x589fc7['shift']());}};_0x271aff(++_0xd6ab92);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'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(_0xea2c85,_0x440d69){var _0x401d02=function(_0x4d8b06){while(--_0x4d8b06){_0xea2c85['push'](_0xea2c85['shift']());}};_0x401d02(++_0x440d69);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'use strict';var BPromise=require(_0x0a9e('0x0'));var AWS=require(_0x0a9e('0x1'));function lexResult(_0x29929c,_0x5dd881){return new BPromise(function(_0x550fbc,_0x18d5c9){_0x29929c['postText'](_0x5dd881,function(_0x333808,_0x432180){if(_0x333808){_0x18d5c9(_0x333808);}if(_0x432180[_0x0a9e('0x2')]){for(const _0x991246 in _0x432180[_0x0a9e('0x2')]){if(_0x432180['slots'][_0x0a9e('0x3')](_0x991246)){var _0x441e3a=_0x432180[_0x0a9e('0x2')][_0x991246];_0x432180['slot_'+_0x991246]=_0x441e3a;}}}_0x550fbc(_0x432180);});});}module['exports']=function(_0xe42b77,_0x56465b,_0x52cace,_0x39753a,_0xf81284,_0x307b3e){var _0x3ab53f=new AWS[(_0x0a9e('0x4'))]({'accessKeyId':_0x56465b,'secretAccessKey':_0x52cace,'region':_0x39753a});var _0xbd1168={'botAlias':'$LATEST','botName':_0x307b3e,'inputText':_0xf81284,'userId':_0xe42b77};return lexResult(_0x3ab53f,_0xbd1168);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/polly/index.js b/server/services/agi/scripts/aws/polly/index.js index 99b3347..ed080cf 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 _0xc7b8=['./lib/api','exports'];(function(_0x50b668,_0x113ec1){var _0x1b1775=function(_0x31b9e5){while(--_0x31b9e5){_0x50b668['push'](_0x50b668['shift']());}};_0x1b1775(++_0x113ec1);}(_0xc7b8,0x12e));var _0x8c7b=function(_0x3900cd,_0x2e0f0d){_0x3900cd=_0x3900cd-0x0;var _0x4ba90b=_0xc7b8[_0x3900cd];return _0x4ba90b;};'use strict';var polly=require(_0x8c7b('0x0'));module[_0x8c7b('0x1')]=function(_0x3e0889,_0xa564a,_0x1c1fde,_0x3a48d0,_0x39890e,_0x12ac37,_0x4650f2){return polly(_0x3e0889,_0xa564a,_0x1c1fde,_0x3a48d0,_0x39890e,_0x12ac37,_0x4650f2);}; \ No newline at end of file +var _0xf502=['exports','./lib/api'];(function(_0x54d461,_0x477366){var _0x148f5e=function(_0x5532ef){while(--_0x5532ef){_0x54d461['push'](_0x54d461['shift']());}};_0x148f5e(++_0x477366);}(_0xf502,0xa7));var _0x2f50=function(_0x2e7a43,_0x3b3df4){_0x2e7a43=_0x2e7a43-0x0;var _0x52e9e1=_0xf502[_0x2e7a43];return _0x52e9e1;};'use strict';var polly=require(_0x2f50('0x0'));module[_0x2f50('0x1')]=function(_0x237166,_0x224b77,_0x3ef987,_0x1c0762,_0x20391d,_0x4be45f,_0x48787a){return polly(_0x237166,_0x224b77,_0x3ef987,_0x1c0762,_0x20391d,_0x4be45f,_0x48787a);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/polly/lib/api.js b/server/services/agi/scripts/aws/polly/lib/api.js index 8930dda..91fa8db 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 _0xe72d=['Polly','text','mp3','randomstring','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports'];(function(_0x24cd4e,_0x222e7b){var _0x44f74a=function(_0x57bb13){while(--_0x57bb13){_0x24cd4e['push'](_0x24cd4e['shift']());}};_0x44f74a(++_0x222e7b);}(_0xe72d,0x1ed));var _0xde72=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0xe72d[_0x36ed48];return _0x51c63a;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require('bluebird');var rs=require(_0xde72('0x0'));var AWS=require('aws-sdk');function pollyResult(_0x5e491f,_0x2b478c,_0x530b4d){return new BPromise(function(_0x33b5bc,_0x3cab5a){_0x5e491f[_0xde72('0x1')](_0x2b478c,function(_0x533ef1,_0x345936){if(_0x533ef1){_0x3cab5a(_0x533ef1);}else if(_0x345936){if(_0x345936[_0xde72('0x2')]instanceof Buffer){fs[_0xde72('0x3')](_0x530b4d,_0x345936[_0xde72('0x2')],function(_0x7b7c2c){if(_0x7b7c2c){_0x3cab5a(_0x7b7c2c);}else{_0x33b5bc();}});}else{_0x3cab5a(new Error(_0xde72('0x4')));}}else{_0x3cab5a(new Error(_0xde72('0x5')));}});});}module[_0xde72('0x6')]=function(_0x2a18e5,_0x12f3c8,_0x281ab2,_0x2cfb90,_0x3f744c,_0x598dcb,_0x12c83e){var _0x27bd87=new AWS[(_0xde72('0x7'))]({'accessKeyId':_0x2a18e5,'secretAccessKey':_0x12f3c8,'region':_0x281ab2});var _0x273200={'Text':_0x3f744c,'TextType':_0x598dcb||_0xde72('0x8'),'OutputFormat':_0xde72('0x9'),'VoiceId':_0x2cfb90};return pollyResult(_0x27bd87,_0x273200,_0x12c83e);}; \ No newline at end of file +var _0xc2ad=['writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','mp3','path','bluebird','aws-sdk','synthesizeSpeech','AudioStream'];(function(_0x108c6c,_0x4a7e7d){var _0x4d8c4d=function(_0x5cddeb){while(--_0x5cddeb){_0x108c6c['push'](_0x108c6c['shift']());}};_0x4d8c4d(++_0x4a7e7d);}(_0xc2ad,0x163));var _0xdc2a=function(_0x242602,_0x4d52bc){_0x242602=_0x242602-0x0;var _0xb8602a=_0xc2ad[_0x242602];return _0xb8602a;};'use strict';var fs=require('fs');var path=require(_0xdc2a('0x0'));var BPromise=require(_0xdc2a('0x1'));var rs=require('randomstring');var AWS=require(_0xdc2a('0x2'));function pollyResult(_0xaee372,_0x319e1c,_0x58392f){return new BPromise(function(_0x5a093b,_0x542914){_0xaee372[_0xdc2a('0x3')](_0x319e1c,function(_0x93a471,_0x38ee77){if(_0x93a471){_0x542914(_0x93a471);}else if(_0x38ee77){if(_0x38ee77[_0xdc2a('0x4')]instanceof Buffer){fs[_0xdc2a('0x5')](_0x58392f,_0x38ee77['AudioStream'],function(_0x5b7ef6){if(_0x5b7ef6){_0x542914(_0x5b7ef6);}else{_0x5a093b();}});}else{_0x542914(new Error(_0xdc2a('0x6')));}}else{_0x542914(new Error(_0xdc2a('0x7')));}});});}module['exports']=function(_0xdea80b,_0x34a768,_0x12174f,_0x203822,_0x1323f1,_0x23fb79,_0x5b464f){var _0x55bfef=new AWS[(_0xdc2a('0x8'))]({'accessKeyId':_0xdea80b,'secretAccessKey':_0x34a768,'region':_0x12174f});var _0x2c4575={'Text':_0x1323f1,'TextType':_0x23fb79||'text','OutputFormat':_0xdc2a('0x9'),'VoiceId':_0x203822};return pollyResult(_0x55bfef,_0x2c4575,_0x5b464f);}; \ No newline at end of file diff --git a/server/services/agi/scripts/google/asr/index.js b/server/services/agi/scripts/google/asr/index.js index 04d8c3f..7d5839c 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 _0x9613=['exports','./lib/api'];(function(_0x44b8cc,_0x533379){var _0x252cc6=function(_0xfc94){while(--_0xfc94){_0x44b8cc['push'](_0x44b8cc['shift']());}};_0x252cc6(++_0x533379);}(_0x9613,0x17d));var _0x3961=function(_0x454c66,_0x3831dc){_0x454c66=_0x454c66-0x0;var _0x4e2938=_0x9613[_0x454c66];return _0x4e2938;};'use strict';var asr=require(_0x3961('0x0'));module[_0x3961('0x1')]=function(_0x405e68,_0xf6a888,_0xe8a58,_0xc8ab65){return asr(_0x405e68,_0xf6a888,_0xe8a58);}; \ No newline at end of file +'use strict';var asr=require('./lib/api');module['exports']=function(_0xbb709d,_0x271364,_0x19868c,_0x2c931b){return asr(_0xbb709d,_0x271364,_0x19868c);}; \ No newline at end of file diff --git a/server/services/agi/scripts/google/asr/lib/api.js b/server/services/agi/scripts/google/asr/lib/api.js index e491f52..f76e12c 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 _0x750a=['/v1/speech:recognize?key=','bluebird','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','toString','base64','POST'];(function(_0x2752e5,_0x30f719){var _0x185861=function(_0x39b294){while(--_0x39b294){_0x2752e5['push'](_0x2752e5['shift']());}};_0x185861(++_0x30f719);}(_0x750a,0x140));var _0xa750=function(_0x1f530d,_0x18a19e){_0x1f530d=_0x1f530d-0x0;var _0x22103f=_0x750a[_0x1f530d];return _0x22103f;};'use strict';var url=require('url');var BPromise=require(_0xa750('0x0'));var fs=require('fs');var host='https://speech.googleapis.com';module['exports']=function(_0x139fa5,_0xeb020d,_0x1b459c){return new BPromise(function(_0x19bd5f,_0x457cae){var _0x43d704;if(typeof _0x139fa5!==_0xa750('0x1')||_0x139fa5[_0xa750('0x2')]===0x0){return _0x457cae(_0xa750('0x3'));}if(typeof _0xeb020d!==_0xa750('0x1')||_0xeb020d[_0xa750('0x2')]===0x0){return _0x457cae(_0xa750('0x4'));}if(typeof _0x1b459c!==_0xa750('0x5')&&(typeof _0x1b459c!=='string'||_0x1b459c['length']===0x0)){return _0x457cae(_0xa750('0x6'));}try{_0x43d704=fs['readFileSync'](_0x139fa5)[_0xa750('0x7')](_0xa750('0x8'));}catch(_0x51f594){return _0x457cae(_0x51f594);}return _0x19bd5f({'method':_0xa750('0x9'),'uri':host+_0xa750('0xa')+_0xeb020d,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':'8000','languageCode':_0x1b459c},'audio':{'content':_0x43d704}},'json':!![]});});}; \ No newline at end of file +var _0xd87e=['bluebird','exports','string','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','length','readFileSync','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','url'];(function(_0x87c537,_0x3073b8){var _0x4469f6=function(_0x22e49a){while(--_0x22e49a){_0x87c537['push'](_0x87c537['shift']());}};_0x4469f6(++_0x3073b8);}(_0xd87e,0x1bf));var _0xed87=function(_0xec1043,_0x2a0be1){_0xec1043=_0xec1043-0x0;var _0x2bbb3e=_0xd87e[_0xec1043];return _0x2bbb3e;};'use strict';var url=require(_0xed87('0x0'));var BPromise=require(_0xed87('0x1'));var fs=require('fs');var host='https://speech.googleapis.com';module[_0xed87('0x2')]=function(_0x189fdd,_0x16509b,_0x5901be){return new BPromise(function(_0xbbee79,_0x5e960f){var _0x11a5d9;if(typeof _0x189fdd!==_0xed87('0x3')||_0x189fdd['length']===0x0){return _0x5e960f(_0xed87('0x4'));}if(typeof _0x16509b!=='string'||_0x16509b['length']===0x0){return _0x5e960f(_0xed87('0x5'));}if(typeof _0x5901be!==_0xed87('0x6')&&(typeof _0x5901be!==_0xed87('0x3')||_0x5901be[_0xed87('0x7')]===0x0)){return _0x5e960f('lang\x20should\x20be\x20a\x20string');}try{_0x11a5d9=fs[_0xed87('0x8')](_0x189fdd)[_0xed87('0x9')](_0xed87('0xa'));}catch(_0x3c9a3c){return _0x5e960f(_0x3c9a3c);}return _0xbbee79({'method':_0xed87('0xb'),'uri':host+_0xed87('0xc')+_0x16509b,'body':{'config':{'encoding':_0xed87('0xd'),'sampleRateHertz':'8000','languageCode':_0x5901be},'audio':{'content':_0x11a5d9}},'json':!![]});});}; \ No newline at end of file diff --git a/server/services/agi/scripts/google/index.js b/server/services/agi/scripts/google/index.js index 10cb4be..a5c5a2c 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 asr=require('./asr');module['exports']={'asr':asr}; \ No newline at end of file +var _0xa21e=['./asr'];(function(_0x47223b,_0xb0fecd){var _0x3884c8=function(_0x3dfdca){while(--_0x3dfdca){_0x47223b['push'](_0x47223b['shift']());}};_0x3884c8(++_0xb0fecd);}(_0xa21e,0x115));var _0xea21=function(_0x1a72f3,_0x217011){_0x1a72f3=_0x1a72f3-0x0;var _0x57ef47=_0xa21e[_0x1a72f3];return _0x57ef47;};var asr=require(_0xea21('0x0'));module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 1b3c688..bd74f5b 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 _0x5578=['googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','fulfillmentText','intent','displayName','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','parse','sestekNDA','nda','channelData','CustomAction','CustomActionData','AudioFromTts','Data','dirName','apiai-promise','dialogflow','md5','path','querystring','sox','google-tts-api','url','util','./aws','./sestek','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','close','unlink','download\x20error','end','data','transcode','wav','error\x20convert','info','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','then','chmodSync','split','readFileSync','toString','base64','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','input','voice','POST','.mp3','from','audioContent','777','googleCloudTTS\x20path','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','application/x-www-form-urlencoded','f.req=','stringify','null','generic','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','writeFileSync','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','catch','name','googleDialogflow','textRequest','source','resolvedQuery','action','result','actionIncomplete','fulfillment','speech','score','status','code','metadata'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x5578,0x1be));var _0x8557=function(_0x18f152,_0x41585a){_0x18f152=_0x18f152-0x0;var _0xa10b34=_0x5578[_0x18f152];return _0xa10b34;};'use strict';var apiai=require(_0x8557('0x0'));var BPromise=require('bluebird');var dialogflow=require(_0x8557('0x1'));var fs=require('fs');var http=require('http');var https=require('https');var md5=require(_0x8557('0x2'));var path=require(_0x8557('0x3'));var querystring=require(_0x8557('0x4'));var rp=require('request-promise');var rs=require('randomstring');var sox=require(_0x8557('0x5'));var tts=require(_0x8557('0x6'));var urlParse=require(_0x8557('0x7'))['parse'];var util=require(_0x8557('0x8'));var aws=require(_0x8557('0x9'));var google=require('./google');var sestek=require(_0x8557('0xa'));var tilde=require('./tilde');var logger=require(_0x8557('0xb'))(_0x8557('0xc'));var ISPEECH_API=_0x8557('0xd');function downloadFile(_0x4ceb26,_0x4b2a80){return new BPromise(function(_0x4e726d,_0x4eda81){var _0x597bcd=urlParse(_0x4ceb26);var _0x52d66f=_0x597bcd[_0x8557('0xe')]===_0x8557('0xf')?https:http;var _0x396338={'host':_0x597bcd[_0x8557('0x10')],'path':_0x597bcd[_0x8557('0x3')],'headers':{'user-agent':_0x8557('0x11')}};_0x52d66f[_0x8557('0x12')](_0x396338,function(_0x50847b){if(_0x50847b[_0x8557('0x13')]!==0xc8){logger[_0x8557('0x14')](_0x8557('0x15')+_0x4ceb26+_0x8557('0x16')+_0x50847b[_0x8557('0x13')]+'\x20('+_0x50847b['statusMessage']+')');_0x4eda81(new Error('request\x20to\x20'+_0x4ceb26+'\x20failed,\x20status\x20code\x20=\x20'+_0x50847b[_0x8557('0x13')]+'\x20('+_0x50847b[_0x8557('0x17')]+')'));return;}var _0x4b60bf=fs[_0x8557('0x18')](_0x4b2a80);_0x4b60bf['on']('finish',function(){logger['info']('finish\x20download\x20file');_0x4b60bf[_0x8557('0x19')](_0x4e726d);});_0x4b60bf['on'](_0x8557('0x14'),function(_0x850d7d){fs[_0x8557('0x1a')](_0x4b2a80);logger[_0x8557('0x14')](_0x8557('0x1b'),_0x850d7d);_0x4eda81(_0x850d7d);});_0x50847b['pipe'](_0x4b60bf);})['on']('error',function(_0x17a058){logger[_0x8557('0x14')](_0x17a058);_0x4eda81(_0x17a058);})[_0x8557('0x1c')]();});}function uploadFile(_0x58186e){return new BPromise(function(_0x27ce97,_0x1550aa){var _0x266140=urlParse(_0x58186e);var _0x22b7ca=_0x266140[_0x8557('0xe')]===_0x8557('0xf')?https:http;var _0x2a91ae={'host':_0x266140[_0x8557('0x10')],'path':_0x266140['path'],'headers':{'user-agent':_0x8557('0x11')}};_0x22b7ca[_0x8557('0x12')](_0x2a91ae,function(_0x37b06b){if(_0x37b06b[_0x8557('0x13')]!==0xc8){_0x1550aa(new Error(_0x8557('0x15')+_0x58186e+_0x8557('0x16')+_0x37b06b[_0x8557('0x13')]+'\x20('+_0x37b06b['statusMessage']+')'));return;}var _0x59f24a='';_0x37b06b['on'](_0x8557('0x1d'),function(_0xa54163){_0x59f24a+=_0xa54163;});_0x37b06b['on'](_0x8557('0x1c'),function(){_0x27ce97(_0x59f24a);});})['on'](_0x8557('0x14'),function(_0x1d3989){_0x1550aa(_0x1d3989);})[_0x8557('0x1c')]();});}function convertFile(_0x4b75ff,_0x388732){return new BPromise(function(_0x4d2044,_0x1e8558){var _0x18f2a6=sox[_0x8557('0x1e')](_0x4b75ff,_0x388732,{'sampleRate':0x1f40,'format':_0x8557('0x1f'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x18f2a6['on'](_0x8557('0x14'),function(_0xf37743){logger['error'](_0x8557('0x20'),_0xf37743);_0x1e8558(_0xf37743);});_0x18f2a6['on'](_0x8557('0x1c'),function(){logger[_0x8557('0x21')](_0x8557('0x22'));_0x4d2044();});_0x18f2a6[_0x8557('0x23')]();});}function base64Decode(_0x5e87f1,_0x123afd){var _0x1ad22b=path[_0x8557('0x24')](__dirname,_0x8557('0x25'),rs[_0x8557('0x26')](0x4)+_0x8557('0x27'));fs['writeFileSync'](_0x1ad22b,_0x5e87f1,'base64');return convertFile(_0x1ad22b,_0x123afd)[_0x8557('0x28')](function(){try{fs[_0x8557('0x1a')](_0x1ad22b);fs[_0x8557('0x29')](_0x123afd,'777');}catch(_0x4e4244){logger[_0x8557('0x14')](_0x4e4244);}return _0x123afd[_0x8557('0x2a')]('.')[0x0];});}function base64Encode(_0x199d9f){var _0x1ae031=fs[_0x8557('0x2b')](_0x199d9f);return new Buffer(_0x1ae031)[_0x8557('0x2c')](_0x8557('0x2d'));}exports[_0x8557('0x2e')]=function(_0x48e053,_0x2fe821,_0xac1c11,_0x452dd0,_0xca6d08,_0x32dc7f){var _0x21a868,_0x176119;var _0x1a924d=_0x8557('0x2f');var _0x256185=_0x8557('0x30')+_0x48e053;var _0x2fb6df={};if(_0x2fe821==='ssml'){_0x2fb6df[_0x8557('0x31')]={'ssml':_0xac1c11};}else{_0x2fb6df['input']={'text':_0xac1c11};};_0x2fb6df[_0x8557('0x32')]={'languageCode':_0x452dd0,'ssmlGender':_0xca6d08};_0x2fb6df['audioConfig']={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x48f63e={'url':_0x1a924d+'text:synthesize'+_0x256185,'method':_0x8557('0x33'),'json':!![],'body':_0x2fb6df};return rp(_0x48f63e)['then'](function(_0x16fd00){return new BPromise(function(_0x4f1a44,_0x3d7376){_0x21a868=path[_0x8557('0x24')](__dirname,_0x8557('0x25'),rs[_0x8557('0x26')](0x4)+_0x8557('0x34'));var _0x30117d=Buffer[_0x8557('0x35')](_0x16fd00[_0x8557('0x36')],_0x8557('0x2d'));return fs['writeFile'](_0x21a868,_0x30117d,function(_0x4d8c6e){_0x3d7376(_0x4d8c6e);},function(_0x177f45){fs['chmodSync'](_0x21a868,_0x8557('0x37'));_0x4f1a44(_0x177f45);});});})['then'](function(_0x42e0c2){_0x176119=path['resolve'](__dirname,_0x8557('0x25'),rs[_0x8557('0x26')](0x4)+_0x8557('0x27'));return convertFile(_0x21a868,_0x176119);})[_0x8557('0x28')](function(){try{fs[_0x8557('0x1a')](_0x21a868);fs[_0x8557('0x29')](_0x176119,_0x8557('0x37'));}catch(_0x1e5b8f){logger['error'](_0x1e5b8f);}logger[_0x8557('0x21')](_0x8557('0x38'),_0x176119[_0x8557('0x2a')]('.')[0x0]);return _0x176119[_0x8557('0x2a')]('.')[0x0];});};exports['googleTTS']=function(_0x5a6f31,_0x263898){var _0x50e5f5=_0x8557('0x39');var _0x43f5d3,_0x133838;var _0x4bb718;var _0x4ae85f={'encoding':'utf8','method':'POST','timeout':0x2710,'url':_0x50e5f5,'headers':{'Content-Type':_0x8557('0x3a')},'body':_0x8557('0x3b')+encodeURIComponent(JSON[_0x8557('0x3c')]([[['jQ1olc',JSON[_0x8557('0x3c')]([_0x5a6f31,_0x263898||'en',![],_0x8557('0x3d')]),null,_0x8557('0x3e')]]]))};return rp(_0x4ae85f)['then'](function(_0x23c094){try{_0x4bb718=eval(_0x23c094[_0x8557('0x3f')](0x5))[0x0][0x2];}catch(_0x1215ec){throw new Error(_0x8557('0x40')+_0x23c094['data']);}if(!_0x4bb718){if(_0x5a6f31[_0x8557('0x41')]>0xc8){throw new Error(_0x8557('0x42'));}else{throw new Error(_0x8557('0x43')+_0x263898+'\x22\x20might\x20not\x20exist');}}try{_0x4bb718=eval(_0x4bb718)[0x0];}catch(_0xeb01b4){throw new Error('parse\x20response\x20failed:\x0a'+res['data']);}const _0x1f9263=_0x4bb718;_0x43f5d3=path['resolve'](__dirname,_0x8557('0x25'),rs['generate'](0x4)+_0x8557('0x34'));fs[_0x8557('0x44')](_0x43f5d3,_0x4bb718,{'encoding':_0x8557('0x2d')});_0x133838=path[_0x8557('0x24')](__dirname,'tmp',rs['generate'](0x4)+_0x8557('0x27'));return convertFile(_0x43f5d3,_0x133838);})['then'](function(){try{fs[_0x8557('0x1a')](_0x43f5d3);fs['chmodSync'](_0x133838,_0x8557('0x37'));}catch(_0x40a95b){logger[_0x8557('0x14')](_0x40a95b);}logger[_0x8557('0x21')](_0x8557('0x45'),_0x133838[_0x8557('0x2a')]('.')[0x0]);return _0x133838['split']('.')[0x0];});};exports[_0x8557('0x46')]=function(_0x571610,_0x57a1ef,_0xef9e03){return google[_0x8557('0x47')](_0x571610,_0x57a1ef,_0xef9e03)[_0x8557('0x28')](function(_0x28a200){logger['info'](_0x28a200[_0x8557('0x48')]);return rp(_0x28a200);})[_0x8557('0x28')](function(_0x34d9a4){var _0x45a845='';var _0x2e2042=0x0;try{fs[_0x8557('0x1a')](_0x571610);}catch(_0x1989c6){logger[_0x8557('0x14')](_0x1989c6);}if(_0x34d9a4&&_0x34d9a4[_0x8557('0x49')]){_0x45a845=_0x34d9a4['results'][_0x8557('0x4a')](function(_0x56f527){return _0x56f527&&_0x56f527[_0x8557('0x4b')][0x0]&&_0x56f527[_0x8557('0x4b')][0x0][_0x8557('0x4c')]?_0x56f527[_0x8557('0x4b')][0x0]['transcript']:'';})[_0x8557('0x4d')]('\x0a');_0x2e2042=_0x34d9a4[_0x8557('0x49')]['map'](function(_0xe1b60e){return _0xe1b60e&&_0xe1b60e[_0x8557('0x4b')][0x0]&&_0xe1b60e[_0x8557('0x4b')][0x0][_0x8557('0x4e')]?_0xe1b60e[_0x8557('0x4b')][0x0]['confidence']:0x0;})['join']('\x0a');}logger['info']('googleASR\x20transcription',_0x45a845);logger[_0x8557('0x21')]('googleASR\x20confidence',_0x2e2042);return{'transcript':_0x45a845,'confidence':_0x2e2042};})[_0x8557('0x4f')](function(_0x50bfd1){logger[_0x8557('0x14')]('[%s]\x20%s:%s',_0x50bfd1[_0x8557('0x13')],_0x50bfd1[_0x8557('0x50')],_0x50bfd1['message']);});};exports[_0x8557('0x51')]=function(_0x4220e6,_0xc6b4f1,_0x2eb52f,_0x10dd0f){var _0x1b7406=apiai(_0xc6b4f1,{'language':_0x10dd0f||'en'});return _0x1b7406[_0x8557('0x52')](_0x2eb52f,{'sessionId':md5(_0x4220e6)})[_0x8557('0x28')](function(_0x4233ee){logger[_0x8557('0x21')](JSON[_0x8557('0x3c')](_0x4233ee));return{'source':_0x4233ee['result'][_0x8557('0x53')],'resolvedQuery':_0x4233ee['result'][_0x8557('0x54')],'action':_0x4233ee['result'][_0x8557('0x55')],'actionIncomplete':_0x4233ee[_0x8557('0x56')][_0x8557('0x57')],'speech':_0x4233ee[_0x8557('0x56')][_0x8557('0x58')][_0x8557('0x59')],'score':_0x4233ee[_0x8557('0x56')][_0x8557('0x5a')],'statusCode':_0x4233ee[_0x8557('0x5b')][_0x8557('0x5c')],'endConversation':_0x4233ee['result']['metadata']['endConversation']||![],'isFallbackIntent':_0x4233ee[_0x8557('0x56')][_0x8557('0x5d')]['isFallbackIntent']};});};exports[_0x8557('0x5e')]=function(_0x103b5e,_0x3dfedd,_0x435892,_0x46ad02,_0x5823bf,_0x109dd6){var _0x4c76ac=_0x46ad02[_0x8557('0x5f')](/\\n/g,'\x0a');var _0x8a7f24={'credentials':{'private_key':_0x4c76ac,'client_email':_0x435892}};var _0x288f08=new dialogflow[(_0x8557('0x60'))](_0x8a7f24);var _0x5bcef4=_0x288f08[_0x8557('0x61')](_0x3dfedd,md5(_0x103b5e));var _0xd14bcc={'session':_0x5bcef4,'queryInput':{'text':{'text':_0x5823bf,'languageCode':_0x109dd6}}};return _0x288f08[_0x8557('0x62')](_0xd14bcc)['then'](function(_0x18ee27){if(_0x18ee27&&_0x18ee27[_0x8557('0x41')]){logger[_0x8557('0x21')](_0x8557('0x63'),JSON[_0x8557('0x3c')](_0x18ee27));var _0x159f7b=_0x18ee27[0x0];if(_0x159f7b){var _0x383d4f={'action':_0x159f7b[_0x8557('0x64')]['action'],'allRequiredParamsPresent':_0x159f7b[_0x8557('0x64')][_0x8557('0x65')],'endConversation':_0x159f7b['queryResult'][_0x8557('0x66')]&&_0x159f7b['queryResult']['diagnosticInfo']['fields']?_0x159f7b[_0x8557('0x64')]['diagnosticInfo'][_0x8557('0x67')][_0x8557('0x68')]['boolValue']:![],'fulfillmentText':_0x159f7b[_0x8557('0x64')][_0x8557('0x69')],'intentName':_0x159f7b[_0x8557('0x64')][_0x8557('0x6a')][_0x8557('0x50')],'intentDisplayName':_0x159f7b[_0x8557('0x64')][_0x8557('0x6a')][_0x8557('0x6b')],'isFallbackIntent':_0x159f7b[_0x8557('0x64')]['intent'][_0x8557('0x6c')],'languageCode':_0x159f7b[_0x8557('0x64')][_0x8557('0x6d')],'queryText':_0x159f7b[_0x8557('0x64')][_0x8557('0x6e')],'responseId':_0x159f7b[_0x8557('0x6f')],'score':_0x159f7b[_0x8557('0x64')][_0x8557('0x70')],'speech':_0x159f7b[_0x8557('0x64')]['fulfillmentText'],'providerResponse':JSON[_0x8557('0x3c')](_0x18ee27)};return _0x383d4f;}}});};exports[_0x8557('0x71')]=function(_0x2f4327,_0x4e0bb1,_0x1ff19f,_0x4fcb09){return tilde[_0x8557('0x47')](_0x2f4327,_0x4e0bb1,_0x1ff19f,_0x4fcb09)[_0x8557('0x28')](function(_0x28f22a){try{fs[_0x8557('0x1a')](_0x2f4327);}catch(_0x37d9cd){logger[_0x8557('0x14')](_0x37d9cd);}logger[_0x8557('0x21')](_0x8557('0x72'),_0x28f22a['transcript']);logger[_0x8557('0x21')](_0x8557('0x73'),_0x28f22a[_0x8557('0x4e')]);return _0x28f22a;});};exports[_0x8557('0x74')]=function(_0x45cf2c,_0x39726f,_0x6e9397,_0x424ef2,_0x581a04,_0x3af49f){var _0x53130b=path[_0x8557('0x24')](__dirname,_0x8557('0x25'),rs[_0x8557('0x26')](0x4)+_0x8557('0x34'));var _0x454d92;return aws[_0x8557('0x75')](_0x45cf2c,_0x39726f,_0x6e9397,_0x424ef2,_0x581a04,_0x3af49f,_0x53130b)[_0x8557('0x28')](function(){_0x454d92=path[_0x8557('0x24')](__dirname,_0x8557('0x25'),rs[_0x8557('0x26')](0x4)+_0x8557('0x27'));return convertFile(_0x53130b,_0x454d92);})[_0x8557('0x28')](function(){try{fs[_0x8557('0x1a')](_0x53130b);fs[_0x8557('0x29')](_0x454d92,_0x8557('0x37'));}catch(_0x3dc204){logger['error'](_0x3dc204);}return _0x454d92[_0x8557('0x2a')]('.')[0x0];});};exports[_0x8557('0x76')]=function(_0x35f5c8,_0x458f23,_0x48fb87,_0x114032,_0x16506c,_0x4b189c){return aws[_0x8557('0x77')](_0x35f5c8,_0x458f23,_0x48fb87,_0x114032,_0x16506c,_0x4b189c)[_0x8557('0x28')](function(_0x1cbcb8){logger[_0x8557('0x21')](JSON[_0x8557('0x3c')](_0x1cbcb8));return _0x1cbcb8;});};exports[_0x8557('0x78')]=function(_0x24fb28,_0x4fe4cb,_0x5b2ad8,_0x3869de){var _0x554a0e=util[_0x8557('0x79')](_0x8557('0x7a'),ISPEECH_API,_0x24fb28,encodeURIComponent(_0x4fe4cb),_0x5b2ad8,_0x3869de);var _0xacf0a5=path['resolve'](__dirname,_0x8557('0x25'),rs[_0x8557('0x26')](0x4)+_0x8557('0x34'));var _0x2010a5;return downloadFile(_0x554a0e,_0xacf0a5)['then'](function(){_0x2010a5=path[_0x8557('0x24')](__dirname,'tmp',rs[_0x8557('0x26')](0x4)+'.wav');return convertFile(_0xacf0a5,_0x2010a5);})[_0x8557('0x28')](function(){try{fs[_0x8557('0x1a')](_0xacf0a5);fs[_0x8557('0x29')](_0x2010a5,_0x8557('0x37'));}catch(_0x462aff){logger[_0x8557('0x14')](_0x462aff);}return _0x2010a5[_0x8557('0x2a')]('.')[0x0];});};exports['ispeechASR']=function(_0x59f40f,_0x51bec1,_0x28512a,_0x13b2a8){var _0x3c0244=util[_0x8557('0x79')](_0x8557('0x7b'),ISPEECH_API,_0x51bec1,_0x28512a,base64Encode(_0x59f40f),_0x13b2a8?util[_0x8557('0x79')](_0x8557('0x7c'),encodeURIComponent(_0x13b2a8)):_0x8557('0x7d'));return uploadFile(_0x3c0244)[_0x8557('0x28')](function(_0x268b24){return querystring[_0x8557('0x7e')](_0x268b24);});};exports[_0x8557('0x7f')]=function(_0x25241c,_0x1eb117){return sestek[_0x8557('0x80')](_0x25241c,_0x1eb117)[_0x8557('0x28')](function(_0x3f677a){logger[_0x8557('0x21')](JSON[_0x8557('0x3c')](_0x3f677a));var _0x5ea467={'speech':_0x3f677a['text'],'action':_0x3f677a[_0x8557('0x81')]?_0x3f677a['channelData'][_0x8557('0x82')]:undefined,'actiondata':_0x3f677a['channelData']?_0x3f677a[_0x8557('0x81')][_0x8557('0x83')]:undefined};if(_0x3f677a[_0x8557('0x81')]&&_0x3f677a[_0x8557('0x81')]['AudioFromTts']){return base64Decode(_0x3f677a['channelData'][_0x8557('0x84')][_0x8557('0x85')],path[_0x8557('0x24')](__dirname,_0x8557('0x25'),rs['generate'](0x4)+'.wav'))[_0x8557('0x28')](function(_0x115acc){_0x5ea467['audiofile']=_0x115acc;return _0x5ea467;});}return _0x5ea467;});};exports[_0x8557('0x86')]=function(){return __dirname;}; \ No newline at end of file +var _0x79f7=['resolvedQuery','actionIncomplete','fulfillment','speech','score','status','code','endConversation','metadata','googleDialogflowV2','replace','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','action','diagnosticInfo','end_conversation','boolValue','fulfillmentText','intent','name','displayName','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','awsPolly','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','model=%s','freeform=3','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','audiofile','bluebird','http','https','md5','path','querystring','request-promise','sox','google-tts-api','url','parse','util','./google','./sestek','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','close','unlink','pipe','end','https:','transcode','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','writeFileSync','base64','chmodSync','777','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','input','voice','audioConfig','MP3','text:synthesize','POST','.mp3','from','audioContent','then','info','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','parse\x20response\x20failed:\x0a','data','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','googleASR','asr','uri','results','alternatives','transcript','join','map','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','googleDialogflow','source','result'];(function(_0x3f19b3,_0x3f0849){var _0xd61898=function(_0x3ca685){while(--_0x3ca685){_0x3f19b3['push'](_0x3f19b3['shift']());}};_0xd61898(++_0x3f0849);}(_0x79f7,0xb7));var _0x779f=function(_0x151a0f,_0x37a3e8){_0x151a0f=_0x151a0f-0x0;var _0xd12329=_0x79f7[_0x151a0f];return _0xd12329;};'use strict';var apiai=require('apiai-promise');var BPromise=require(_0x779f('0x0'));var dialogflow=require('dialogflow');var fs=require('fs');var http=require(_0x779f('0x1'));var https=require(_0x779f('0x2'));var md5=require(_0x779f('0x3'));var path=require(_0x779f('0x4'));var querystring=require(_0x779f('0x5'));var rp=require(_0x779f('0x6'));var rs=require('randomstring');var sox=require(_0x779f('0x7'));var tts=require(_0x779f('0x8'));var urlParse=require(_0x779f('0x9'))[_0x779f('0xa')];var util=require(_0x779f('0xb'));var aws=require('./aws');var google=require(_0x779f('0xc'));var sestek=require(_0x779f('0xd'));var tilde=require('./tilde');var logger=require(_0x779f('0xe'))(_0x779f('0xf'));var ISPEECH_API=_0x779f('0x10');function downloadFile(_0x34f157,_0x22cd08){return new BPromise(function(_0x5b5bf7,_0xa3c894){var _0x1c58c7=urlParse(_0x34f157);var _0x452f92=_0x1c58c7[_0x779f('0x11')]==='https:'?https:http;var _0x56834f={'host':_0x1c58c7[_0x779f('0x12')],'path':_0x1c58c7[_0x779f('0x4')],'headers':{'user-agent':_0x779f('0x13')}};_0x452f92[_0x779f('0x14')](_0x56834f,function(_0x4ee433){if(_0x4ee433[_0x779f('0x15')]!==0xc8){logger[_0x779f('0x16')](_0x779f('0x17')+_0x34f157+_0x779f('0x18')+_0x4ee433[_0x779f('0x15')]+'\x20('+_0x4ee433[_0x779f('0x19')]+')');_0xa3c894(new Error(_0x779f('0x17')+_0x34f157+'\x20failed,\x20status\x20code\x20=\x20'+_0x4ee433[_0x779f('0x15')]+'\x20('+_0x4ee433['statusMessage']+')'));return;}var _0x32d157=fs[_0x779f('0x1a')](_0x22cd08);_0x32d157['on'](_0x779f('0x1b'),function(){logger['info']('finish\x20download\x20file');_0x32d157[_0x779f('0x1c')](_0x5b5bf7);});_0x32d157['on'](_0x779f('0x16'),function(_0x2ab43b){fs[_0x779f('0x1d')](_0x22cd08);logger[_0x779f('0x16')]('download\x20error',_0x2ab43b);_0xa3c894(_0x2ab43b);});_0x4ee433[_0x779f('0x1e')](_0x32d157);})['on'](_0x779f('0x16'),function(_0x5b7e99){logger['error'](_0x5b7e99);_0xa3c894(_0x5b7e99);})[_0x779f('0x1f')]();});}function uploadFile(_0x572ee1){return new BPromise(function(_0x33dd44,_0x2bfab0){var _0x53f796=urlParse(_0x572ee1);var _0x299154=_0x53f796[_0x779f('0x11')]===_0x779f('0x20')?https:http;var _0x43457a={'host':_0x53f796[_0x779f('0x12')],'path':_0x53f796['path'],'headers':{'user-agent':_0x779f('0x13')}};_0x299154[_0x779f('0x14')](_0x43457a,function(_0x112219){if(_0x112219[_0x779f('0x15')]!==0xc8){_0x2bfab0(new Error('request\x20to\x20'+_0x572ee1+_0x779f('0x18')+_0x112219[_0x779f('0x15')]+'\x20('+_0x112219[_0x779f('0x19')]+')'));return;}var _0x3b97c3='';_0x112219['on']('data',function(_0x428e66){_0x3b97c3+=_0x428e66;});_0x112219['on'](_0x779f('0x1f'),function(){_0x33dd44(_0x3b97c3);});})['on'](_0x779f('0x16'),function(_0x17fa41){_0x2bfab0(_0x17fa41);})[_0x779f('0x1f')]();});}function convertFile(_0x256147,_0x3b4e33){return new BPromise(function(_0x3bf131,_0x5cf35b){var _0x12e326=sox[_0x779f('0x21')](_0x256147,_0x3b4e33,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x12e326['on'](_0x779f('0x16'),function(_0x327df5){logger[_0x779f('0x16')](_0x779f('0x22'),_0x327df5);_0x5cf35b(_0x327df5);});_0x12e326['on']('end',function(){logger['info'](_0x779f('0x23'));_0x3bf131();});_0x12e326[_0x779f('0x24')]();});}function base64Decode(_0x2b0ff2,_0x5867cf){var _0x14c66f=path[_0x779f('0x25')](__dirname,_0x779f('0x26'),rs[_0x779f('0x27')](0x4)+_0x779f('0x28'));fs[_0x779f('0x29')](_0x14c66f,_0x2b0ff2,_0x779f('0x2a'));return convertFile(_0x14c66f,_0x5867cf)['then'](function(){try{fs['unlink'](_0x14c66f);fs[_0x779f('0x2b')](_0x5867cf,_0x779f('0x2c'));}catch(_0x5e97fd){logger[_0x779f('0x16')](_0x5e97fd);}return _0x5867cf[_0x779f('0x2d')]('.')[0x0];});}function base64Encode(_0x59ac87){var _0x3bb22a=fs[_0x779f('0x2e')](_0x59ac87);return new Buffer(_0x3bb22a)[_0x779f('0x2f')](_0x779f('0x2a'));}exports[_0x779f('0x30')]=function(_0x284d54,_0x24cda1,_0x24b000,_0x230845,_0x55a345,_0x585ac4){var _0x47c959,_0x2eba24;var _0x2c7412=_0x779f('0x31');var _0x420647=_0x779f('0x32')+_0x284d54;var _0x361b9e={};if(_0x24cda1==='ssml'){_0x361b9e[_0x779f('0x33')]={'ssml':_0x24b000};}else{_0x361b9e[_0x779f('0x33')]={'text':_0x24b000};};_0x361b9e[_0x779f('0x34')]={'languageCode':_0x230845,'ssmlGender':_0x55a345};_0x361b9e[_0x779f('0x35')]={'audioEncoding':_0x779f('0x36'),'sampleRateHertz':0x1f40};var _0x2e3752={'url':_0x2c7412+_0x779f('0x37')+_0x420647,'method':_0x779f('0x38'),'json':!![],'body':_0x361b9e};return rp(_0x2e3752)['then'](function(_0x54039b){return new BPromise(function(_0xdee130,_0x1323d4){_0x47c959=path[_0x779f('0x25')](__dirname,_0x779f('0x26'),rs['generate'](0x4)+_0x779f('0x39'));var _0x306052=Buffer[_0x779f('0x3a')](_0x54039b[_0x779f('0x3b')],_0x779f('0x2a'));return fs['writeFile'](_0x47c959,_0x306052,function(_0x1b44b3){_0x1323d4(_0x1b44b3);},function(_0x5dd228){fs[_0x779f('0x2b')](_0x47c959,_0x779f('0x2c'));_0xdee130(_0x5dd228);});});})[_0x779f('0x3c')](function(_0x32dfbc){_0x2eba24=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+_0x779f('0x28'));return convertFile(_0x47c959,_0x2eba24);})[_0x779f('0x3c')](function(){try{fs[_0x779f('0x1d')](_0x47c959);fs[_0x779f('0x2b')](_0x2eba24,_0x779f('0x2c'));}catch(_0x80f674){logger[_0x779f('0x16')](_0x80f674);}logger[_0x779f('0x3d')]('googleCloudTTS\x20path',_0x2eba24[_0x779f('0x2d')]('.')[0x0]);return _0x2eba24[_0x779f('0x2d')]('.')[0x0];});};exports['googleTTS']=function(_0x38a0c7,_0x2c268b){var _0x1bb71b=_0x779f('0x3e');var _0x4610a8,_0x4d818a;var _0x69a00d;var _0xcfd5d9={'encoding':_0x779f('0x3f'),'method':_0x779f('0x38'),'timeout':0x2710,'url':_0x1bb71b,'headers':{'Content-Type':_0x779f('0x40')},'body':_0x779f('0x41')+encodeURIComponent(JSON[_0x779f('0x42')]([[[_0x779f('0x43'),JSON[_0x779f('0x42')]([_0x38a0c7,_0x2c268b||'en',![],_0x779f('0x44')]),null,'generic']]]))};return rp(_0xcfd5d9)['then'](function(_0xc6b889){try{_0x69a00d=eval(_0xc6b889['slice'](0x5))[0x0][0x2];}catch(_0x2eab85){throw new Error(_0x779f('0x45')+_0xc6b889[_0x779f('0x46')]);}if(!_0x69a00d){if(_0x38a0c7[_0x779f('0x47')]>0xc8){throw new Error(_0x779f('0x48'));}else{throw new Error(_0x779f('0x49')+_0x2c268b+_0x779f('0x4a'));}}try{_0x69a00d=eval(_0x69a00d)[0x0];}catch(_0x284dd9){throw new Error(_0x779f('0x45')+res[_0x779f('0x46')]);}const _0x26472e=_0x69a00d;_0x4610a8=path[_0x779f('0x25')](__dirname,_0x779f('0x26'),rs[_0x779f('0x27')](0x4)+'.mp3');fs[_0x779f('0x29')](_0x4610a8,_0x69a00d,{'encoding':_0x779f('0x2a')});_0x4d818a=path['resolve'](__dirname,_0x779f('0x26'),rs[_0x779f('0x27')](0x4)+_0x779f('0x28'));return convertFile(_0x4610a8,_0x4d818a);})['then'](function(){try{fs['unlink'](_0x4610a8);fs[_0x779f('0x2b')](_0x4d818a,'777');}catch(_0xb2ee8a){logger[_0x779f('0x16')](_0xb2ee8a);}logger['info']('goggleTTS\x20path',_0x4d818a['split']('.')[0x0]);return _0x4d818a[_0x779f('0x2d')]('.')[0x0];});};exports[_0x779f('0x4b')]=function(_0x2ff073,_0x448037,_0x560165){return google[_0x779f('0x4c')](_0x2ff073,_0x448037,_0x560165)[_0x779f('0x3c')](function(_0x43bd7d){logger[_0x779f('0x3d')](_0x43bd7d[_0x779f('0x4d')]);return rp(_0x43bd7d);})[_0x779f('0x3c')](function(_0x389c40){var _0xeb87dd='';var _0x339645=0x0;try{fs[_0x779f('0x1d')](_0x2ff073);}catch(_0x487279){logger[_0x779f('0x16')](_0x487279);}if(_0x389c40&&_0x389c40[_0x779f('0x4e')]){_0xeb87dd=_0x389c40['results']['map'](function(_0x117f64){return _0x117f64&&_0x117f64[_0x779f('0x4f')][0x0]&&_0x117f64['alternatives'][0x0][_0x779f('0x50')]?_0x117f64[_0x779f('0x4f')][0x0][_0x779f('0x50')]:'';})[_0x779f('0x51')]('\x0a');_0x339645=_0x389c40[_0x779f('0x4e')][_0x779f('0x52')](function(_0x3e13bc){return _0x3e13bc&&_0x3e13bc[_0x779f('0x4f')][0x0]&&_0x3e13bc[_0x779f('0x4f')][0x0][_0x779f('0x53')]?_0x3e13bc[_0x779f('0x4f')][0x0][_0x779f('0x53')]:0x0;})[_0x779f('0x51')]('\x0a');}logger[_0x779f('0x3d')](_0x779f('0x54'),_0xeb87dd);logger[_0x779f('0x3d')](_0x779f('0x55'),_0x339645);return{'transcript':_0xeb87dd,'confidence':_0x339645};})[_0x779f('0x56')](function(_0xd3ce98){logger['error'](_0x779f('0x57'),_0xd3ce98[_0x779f('0x15')],_0xd3ce98['name'],_0xd3ce98['message']);});};exports[_0x779f('0x58')]=function(_0x773427,_0x3c0772,_0x3641b0,_0x2ab863){var _0x413bab=apiai(_0x3c0772,{'language':_0x2ab863||'en'});return _0x413bab['textRequest'](_0x3641b0,{'sessionId':md5(_0x773427)})[_0x779f('0x3c')](function(_0x5a21b9){logger[_0x779f('0x3d')](JSON[_0x779f('0x42')](_0x5a21b9));return{'source':_0x5a21b9['result'][_0x779f('0x59')],'resolvedQuery':_0x5a21b9[_0x779f('0x5a')][_0x779f('0x5b')],'action':_0x5a21b9[_0x779f('0x5a')]['action'],'actionIncomplete':_0x5a21b9[_0x779f('0x5a')][_0x779f('0x5c')],'speech':_0x5a21b9['result'][_0x779f('0x5d')][_0x779f('0x5e')],'score':_0x5a21b9[_0x779f('0x5a')][_0x779f('0x5f')],'statusCode':_0x5a21b9[_0x779f('0x60')][_0x779f('0x61')],'endConversation':_0x5a21b9['result']['metadata'][_0x779f('0x62')]||![],'isFallbackIntent':_0x5a21b9[_0x779f('0x5a')][_0x779f('0x63')]['isFallbackIntent']};});};exports[_0x779f('0x64')]=function(_0xa0a0d9,_0x4613e3,_0x180751,_0x314478,_0x1ab1dd,_0x38b1dc){var _0x33ed75=_0x314478[_0x779f('0x65')](/\\n/g,'\x0a');var _0x3e5fe2={'credentials':{'private_key':_0x33ed75,'client_email':_0x180751}};var _0x76af71=new dialogflow['SessionsClient'](_0x3e5fe2);var _0x426c44=_0x76af71[_0x779f('0x66')](_0x4613e3,md5(_0xa0a0d9));var _0x4d7256={'session':_0x426c44,'queryInput':{'text':{'text':_0x1ab1dd,'languageCode':_0x38b1dc}}};return _0x76af71[_0x779f('0x67')](_0x4d7256)['then'](function(_0xc096d6){if(_0xc096d6&&_0xc096d6[_0x779f('0x47')]){logger[_0x779f('0x3d')](_0x779f('0x68'),JSON['stringify'](_0xc096d6));var _0x14c088=_0xc096d6[0x0];if(_0x14c088){var _0x13084d={'action':_0x14c088[_0x779f('0x69')][_0x779f('0x6a')],'allRequiredParamsPresent':_0x14c088[_0x779f('0x69')]['allRequiredParamsPresent'],'endConversation':_0x14c088[_0x779f('0x69')][_0x779f('0x6b')]&&_0x14c088[_0x779f('0x69')][_0x779f('0x6b')]['fields']?_0x14c088[_0x779f('0x69')][_0x779f('0x6b')]['fields'][_0x779f('0x6c')][_0x779f('0x6d')]:![],'fulfillmentText':_0x14c088[_0x779f('0x69')][_0x779f('0x6e')],'intentName':_0x14c088[_0x779f('0x69')][_0x779f('0x6f')][_0x779f('0x70')],'intentDisplayName':_0x14c088['queryResult']['intent'][_0x779f('0x71')],'isFallbackIntent':_0x14c088[_0x779f('0x69')][_0x779f('0x6f')][_0x779f('0x72')],'languageCode':_0x14c088['queryResult'][_0x779f('0x73')],'queryText':_0x14c088[_0x779f('0x69')][_0x779f('0x74')],'responseId':_0x14c088[_0x779f('0x75')],'score':_0x14c088['queryResult'][_0x779f('0x76')],'speech':_0x14c088[_0x779f('0x69')][_0x779f('0x6e')],'providerResponse':JSON[_0x779f('0x42')](_0xc096d6)};return _0x13084d;}}});};exports[_0x779f('0x77')]=function(_0x59b7a3,_0x3e62ff,_0x15ed3e,_0xc96bd){return tilde[_0x779f('0x4c')](_0x59b7a3,_0x3e62ff,_0x15ed3e,_0xc96bd)[_0x779f('0x3c')](function(_0x57f077){try{fs[_0x779f('0x1d')](_0x59b7a3);}catch(_0x225cc9){logger['error'](_0x225cc9);}logger['info'](_0x779f('0x78'),_0x57f077[_0x779f('0x50')]);logger[_0x779f('0x3d')]('Tilde\x20ASR\x20confidence',_0x57f077[_0x779f('0x53')]);return _0x57f077;});};exports[_0x779f('0x79')]=function(_0x900e9d,_0x1e4b14,_0x25b259,_0x5c1f95,_0x421ef3,_0x56b54d){var _0x50095e=path[_0x779f('0x25')](__dirname,_0x779f('0x26'),rs[_0x779f('0x27')](0x4)+_0x779f('0x39'));var _0x49b996;return aws[_0x779f('0x7a')](_0x900e9d,_0x1e4b14,_0x25b259,_0x5c1f95,_0x421ef3,_0x56b54d,_0x50095e)['then'](function(){_0x49b996=path['resolve'](__dirname,_0x779f('0x26'),rs[_0x779f('0x27')](0x4)+'.wav');return convertFile(_0x50095e,_0x49b996);})[_0x779f('0x3c')](function(){try{fs[_0x779f('0x1d')](_0x50095e);fs[_0x779f('0x2b')](_0x49b996,_0x779f('0x2c'));}catch(_0x30cf6c){logger[_0x779f('0x16')](_0x30cf6c);}return _0x49b996['split']('.')[0x0];});};exports[_0x779f('0x7b')]=function(_0x5bfd54,_0x36b8dd,_0x313613,_0x15d5d0,_0xe0ded2,_0x28703d){return aws[_0x779f('0x7c')](_0x5bfd54,_0x36b8dd,_0x313613,_0x15d5d0,_0xe0ded2,_0x28703d)['then'](function(_0x3d7985){logger[_0x779f('0x3d')](JSON[_0x779f('0x42')](_0x3d7985));return _0x3d7985;});};exports[_0x779f('0x7d')]=function(_0xf5dbf6,_0x310628,_0xb1be34,_0x10859f){var _0x3b59ac=util[_0x779f('0x7e')](_0x779f('0x7f'),ISPEECH_API,_0xf5dbf6,encodeURIComponent(_0x310628),_0xb1be34,_0x10859f);var _0x23c165=path[_0x779f('0x25')](__dirname,'tmp',rs[_0x779f('0x27')](0x4)+_0x779f('0x39'));var _0x2f2d40;return downloadFile(_0x3b59ac,_0x23c165)[_0x779f('0x3c')](function(){_0x2f2d40=path[_0x779f('0x25')](__dirname,_0x779f('0x26'),rs['generate'](0x4)+_0x779f('0x28'));return convertFile(_0x23c165,_0x2f2d40);})[_0x779f('0x3c')](function(){try{fs[_0x779f('0x1d')](_0x23c165);fs[_0x779f('0x2b')](_0x2f2d40,_0x779f('0x2c'));}catch(_0x534dd9){logger[_0x779f('0x16')](_0x534dd9);}return _0x2f2d40[_0x779f('0x2d')]('.')[0x0];});};exports['ispeechASR']=function(_0x47707b,_0xdf6c20,_0x11fbe5,_0x23ede9){var _0x2b0374=util[_0x779f('0x7e')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0xdf6c20,_0x11fbe5,base64Encode(_0x47707b),_0x23ede9?util[_0x779f('0x7e')](_0x779f('0x80'),encodeURIComponent(_0x23ede9)):_0x779f('0x81'));return uploadFile(_0x2b0374)[_0x779f('0x3c')](function(_0x52e849){return querystring[_0x779f('0xa')](_0x52e849);});};exports['sestekNDA']=function(_0x37a9fc,_0x512510){return sestek[_0x779f('0x82')](_0x37a9fc,_0x512510)[_0x779f('0x3c')](function(_0x142f74){logger['info'](JSON[_0x779f('0x42')](_0x142f74));var _0x47a7ab={'speech':_0x142f74[_0x779f('0x83')],'action':_0x142f74[_0x779f('0x84')]?_0x142f74[_0x779f('0x84')][_0x779f('0x85')]:undefined,'actiondata':_0x142f74['channelData']?_0x142f74[_0x779f('0x84')][_0x779f('0x86')]:undefined};if(_0x142f74[_0x779f('0x84')]&&_0x142f74['channelData'][_0x779f('0x87')]){return base64Decode(_0x142f74[_0x779f('0x84')][_0x779f('0x87')]['Data'],path[_0x779f('0x25')](__dirname,_0x779f('0x26'),rs[_0x779f('0x27')](0x4)+_0x779f('0x28')))[_0x779f('0x3c')](function(_0x524a3c){_0x47a7ab[_0x779f('0x88')]=_0x524a3c;return _0x47a7ab;});}return _0x47a7ab;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/index.js b/server/services/agi/scripts/sestek/index.js index 8eecadc..03c230b 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 _0x52cd=['./nda','exports'];(function(_0x1b2b34,_0x393b05){var _0x3042d2=function(_0x47b7ef){while(--_0x47b7ef){_0x1b2b34['push'](_0x1b2b34['shift']());}};_0x3042d2(++_0x393b05);}(_0x52cd,0x1a6));var _0xd52c=function(_0x1d0ce1,_0x33c1a9){_0x1d0ce1=_0x1d0ce1-0x0;var _0x20d76f=_0x52cd[_0x1d0ce1];return _0x20d76f;};var nda=require(_0xd52c('0x0'));module[_0xd52c('0x1')]={'nda':nda}; \ No newline at end of file +var _0x278f=['./nda'];(function(_0x80c71b,_0x43054e){var _0x4ef3c1=function(_0x7ee341){while(--_0x7ee341){_0x80c71b['push'](_0x80c71b['shift']());}};_0x4ef3c1(++_0x43054e);}(_0x278f,0x134));var _0xf278=function(_0x3a036e,_0x7e6b8c){_0x3a036e=_0x3a036e-0x0;var _0x44e5e5=_0x278f[_0x3a036e];return _0x44e5e5;};var nda=require(_0xf278('0x0'));module['exports']={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 8038f1f..6ea8b1d 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 _0x292b=['audio/wav','custom_action','body','CustomAction','custom_action_data','CustomActionData','info','request-promise','url','../../../../../config/logger','agi','exports','POST','resolve','username','password','then','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','uniqueid','callerid','calleridname','dnid','text','Bearer\x20','access_token','project','channelData','ProjectName','AudioOutputSettings'];(function(_0x4db17d,_0x54d99e){var _0x39a505=function(_0x18b28c){while(--_0x18b28c){_0x4db17d['push'](_0x4db17d['shift']());}};_0x39a505(++_0x54d99e);}(_0x292b,0x64));var _0xb292=function(_0x342700,_0x569f75){_0x342700=_0x342700-0x0;var _0x53406f=_0x292b[_0x342700];return _0x53406f;};'use strict';var rp=require(_0xb292('0x0'));var url=require(_0xb292('0x1'));var logger=require(_0xb292('0x2'))(_0xb292('0x3'));module[_0xb292('0x4')]=function(_0x3b4c2c,_0x40abc6){var _0x9a567d={'method':_0xb292('0x5'),'uri':url[_0xb292('0x6')](_0x40abc6['ndauth_url'],'/token'),'form':{'grant_type':'password','username':_0x40abc6[_0xb292('0x7')],'password':_0x40abc6[_0xb292('0x8')]},'json':!![]};return rp(_0x9a567d)[_0xb292('0x9')](function(_0x47fe8e){var _0x43f8b7={'method':_0xb292('0x5'),'uri':url['resolve'](_0x40abc6['ndassistant_url'],_0xb292('0xa')),'body':{'type':_0x40abc6[_0xb292('0xb')]||_0xb292('0xc'),'channelId':'Nda','conversation':{'id':_0x3b4c2c[_0xb292('0xd')]},'from':{'id':_0x3b4c2c[_0xb292('0xe')],'name':_0x3b4c2c[_0xb292('0xf')]},'recipient':{'id':_0x3b4c2c[_0xb292('0x10')],'name':_0x3b4c2c['extension']},'text':_0x40abc6[_0xb292('0x11')],'channelData':{}},'headers':{'Authorization':_0xb292('0x12')+_0x47fe8e[_0xb292('0x13')]},'json':!![]};if(_0x40abc6[_0xb292('0x14')]){_0x43f8b7['body'][_0xb292('0x15')][_0xb292('0x16')]=_0x40abc6['project'];}if(_0x40abc6['ndagenerate_audio']=='1'){_0x43f8b7['body'][_0xb292('0x15')][_0xb292('0x17')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xb292('0x18')};}if(_0x40abc6[_0xb292('0x19')]){_0x43f8b7[_0xb292('0x1a')][_0xb292('0x15')][_0xb292('0x1b')]=_0x40abc6['custom_action'];if(_0x40abc6[_0xb292('0x1c')]){_0x43f8b7[_0xb292('0x1a')][_0xb292('0x15')][_0xb292('0x1d')]=_0x40abc6[_0xb292('0x1c')];}}logger[_0xb292('0x1e')](JSON['stringify'](_0x43f8b7));return rp(_0x43f8b7);});}; \ No newline at end of file +var _0x67da=['POST','resolve','ndauth_url','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','callerid','calleridname','dnid','extension','Bearer\x20','access_token','channelData','project','AudioOutputSettings','custom_action','body','CustomAction','CustomActionData','info','stringify','url','../../../../../config/logger','agi','exports'];(function(_0x210851,_0x4efa30){var _0x190e2a=function(_0x55cfbb){while(--_0x55cfbb){_0x210851['push'](_0x210851['shift']());}};_0x190e2a(++_0x4efa30);}(_0x67da,0x192));var _0xa67d=function(_0x42fea5,_0x30589){_0x42fea5=_0x42fea5-0x0;var _0xd45d3e=_0x67da[_0x42fea5];return _0xd45d3e;};'use strict';var rp=require('request-promise');var url=require(_0xa67d('0x0'));var logger=require(_0xa67d('0x1'))(_0xa67d('0x2'));module[_0xa67d('0x3')]=function(_0x472755,_0x3633a0){var _0x1f58c8={'method':_0xa67d('0x4'),'uri':url[_0xa67d('0x5')](_0x3633a0[_0xa67d('0x6')],'/token'),'form':{'grant_type':'password','username':_0x3633a0[_0xa67d('0x7')],'password':_0x3633a0['password']},'json':!![]};return rp(_0x1f58c8)[_0xa67d('0x8')](function(_0x2346f4){var _0x10f89a={'method':_0xa67d('0x4'),'uri':url[_0xa67d('0x5')](_0x3633a0[_0xa67d('0x9')],_0xa67d('0xa')),'body':{'type':_0x3633a0[_0xa67d('0xb')]||_0xa67d('0xc'),'channelId':_0xa67d('0xd'),'conversation':{'id':_0x472755['uniqueid']},'from':{'id':_0x472755[_0xa67d('0xe')],'name':_0x472755[_0xa67d('0xf')]},'recipient':{'id':_0x472755[_0xa67d('0x10')],'name':_0x472755[_0xa67d('0x11')]},'text':_0x3633a0['text'],'channelData':{}},'headers':{'Authorization':_0xa67d('0x12')+_0x2346f4[_0xa67d('0x13')]},'json':!![]};if(_0x3633a0['project']){_0x10f89a['body'][_0xa67d('0x14')]['ProjectName']=_0x3633a0[_0xa67d('0x15')];}if(_0x3633a0['ndagenerate_audio']=='1'){_0x10f89a['body'][_0xa67d('0x14')][_0xa67d('0x16')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x3633a0[_0xa67d('0x17')]){_0x10f89a[_0xa67d('0x18')][_0xa67d('0x14')][_0xa67d('0x19')]=_0x3633a0['custom_action'];if(_0x3633a0['custom_action_data']){_0x10f89a['body']['channelData'][_0xa67d('0x1a')]=_0x3633a0['custom_action_data'];}}logger[_0xa67d('0x1b')](JSON[_0xa67d('0x1c')](_0x10f89a));return rp(_0x10f89a);});}; \ No newline at end of file diff --git a/server/services/agi/scripts/tilde/asr/index.js b/server/services/agi/scripts/tilde/asr/index.js index 3bfe888..888179d 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 _0x7d84=['./lib/api','exports'];(function(_0x14f53d,_0xd6db59){var _0x3cea5b=function(_0x55e12d){while(--_0x55e12d){_0x14f53d['push'](_0x14f53d['shift']());}};_0x3cea5b(++_0xd6db59);}(_0x7d84,0xd2));var _0x47d8=function(_0x1f6f84,_0x2bab55){_0x1f6f84=_0x1f6f84-0x0;var _0x177f40=_0x7d84[_0x1f6f84];return _0x177f40;};'use strict';var asr=require(_0x47d8('0x0'));module[_0x47d8('0x1')]=function(_0x4b8c34,_0x1ae3d7,_0x2f4f1a,_0x195de0){return asr(_0x4b8c34,_0x1ae3d7,_0x2f4f1a,_0x195de0);}; \ No newline at end of file +var _0x7840=['./lib/api'];(function(_0x28ba21,_0x1da2c6){var _0x104bfb=function(_0x2b7b44){while(--_0x2b7b44){_0x28ba21['push'](_0x28ba21['shift']());}};_0x104bfb(++_0x1da2c6);}(_0x7840,0x1e3));var _0x0784=function(_0x4fec5d,_0x29c543){_0x4fec5d=_0x4fec5d-0x0;var _0x3d301e=_0x7840[_0x4fec5d];return _0x3d301e;};'use strict';var asr=require(_0x0784('0x0'));module['exports']=function(_0x497bbb,_0x50ff5e,_0x32255a,_0x6cc9c4){return asr(_0x497bbb,_0x50ff5e,_0x32255a,_0x6cc9c4);}; \ No newline at end of file diff --git a/server/services/agi/scripts/tilde/asr/lib/api.js b/server/services/agi/scripts/tilde/asr/lib/api.js index 86a70d2..2a049cf 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 _0xa2d0=['../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','error','Tilde\x20ASR\x20parse\x20error','Error\x20Tilde\x20ASR\x20socket','isNil','close','bluebird','moment','crypto'];(function(_0x273dc5,_0x268a81){var _0x46dae7=function(_0x263d62){while(--_0x263d62){_0x273dc5['push'](_0x273dc5['shift']());}};_0x46dae7(++_0x268a81);}(_0xa2d0,0x115));var _0x0a2d=function(_0x54ec37,_0x4288e0){_0x54ec37=_0x54ec37-0x0;var _0x3ecedd=_0xa2d0[_0x54ec37];return _0x3ecedd;};'use strict';var BPromise=require(_0x0a2d('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x0a2d('0x1'));var crypto=require(_0x0a2d('0x2'));var logger=require(_0x0a2d('0x3'))(_0x0a2d('0x4'));module[_0x0a2d('0x5')]=function(_0x38cfdf,_0x21e5e7,_0x23f13b,_0x2f834a){return new BPromise(function(_0xd97847,_0x176656){logger[_0x0a2d('0x6')](_0x0a2d('0x7'),_0x2f834a||_0x0a2d('0x8'));var _0x19260e=new WebSocket(_0x2f834a||_0x0a2d('0x8'),{'perMessageDeflate':![]});var _0x571c65='';var _0x18b46f='0';var _0x32afad='1';var _0xd5dc17=_0x0a2d('0x9');function _0x1160e1(_0x322ee8){var _0x2eee51=crypto[_0x0a2d('0xa')]('sha1');_0x2eee51[_0x0a2d('0xb')](_0x322ee8);return _0x2eee51[_0x0a2d('0xc')](_0x0a2d('0xd'));}function _0xade7fa(){try{logger[_0x0a2d('0x6')](_0x0a2d('0xe'));var _0x5bef2e=moment()[_0x0a2d('0xf')]();var _0x196cf5=_0x1160e1(_0x5bef2e+_0x21e5e7+_0x23f13b);_0x19260e[_0x0a2d('0x10')](JSON[_0x0a2d('0x11')]({'appID':_0x21e5e7,'timestamp':_0x5bef2e,'appKey':_0x196cf5}));var _0x2b6a52=fs[_0x0a2d('0x12')](_0x38cfdf);_0x2b6a52['on'](_0x0a2d('0x13'),function(_0x4110eb){_0x19260e[_0x0a2d('0x10')](_0x4110eb);});_0x2b6a52['on']('close',function(){_0x19260e[_0x0a2d('0x10')]('EOS');});}catch(_0x5ac5e1){logger['error'](_0x0a2d('0x14'),JSON[_0x0a2d('0x11')](_0x5ac5e1));_0x19260e[_0x0a2d('0x15')]();}}function _0x3cc848(_0x30c838){try{if(_0x30c838){var _0x13e10b=JSON[_0x0a2d('0x16')](_0x30c838);switch(_0x13e10b[_0x0a2d('0x17')]){case 0x0:if(_0x13e10b[_0x0a2d('0x18')]){if(_0x13e10b['result'][_0x0a2d('0x19')]){logger[_0x0a2d('0x6')](_0x0a2d('0x1a'),JSON[_0x0a2d('0x11')](_0x13e10b[_0x0a2d('0x18')]['hypotheses']));_0x571c65=_0x13e10b[_0x0a2d('0x18')][_0x0a2d('0x1b')][0x0][_0x0a2d('0x1c')];_0x18b46f=_0x13e10b[_0x0a2d('0x18')][_0x0a2d('0x1b')][0x0][_0x0a2d('0x1d')];_0x32afad='0';_0xd5dc17=_0x0a2d('0x1e');_0x19260e[_0x0a2d('0x15')]();}}break;case 0x1:logger[_0x0a2d('0x6')](_0x0a2d('0x9'));_0x32afad='1';_0xd5dc17=_0x0a2d('0x9');break;case 0x2:logger[_0x0a2d('0x6')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x32afad='2';_0xd5dc17=_0x0a2d('0x1f');break;case 0x9:logger['info']('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x32afad='9';_0xd5dc17=_0x0a2d('0x20');break;case 0xa:logger[_0x0a2d('0x6')](_0x0a2d('0x21'));_0x32afad='10';_0xd5dc17=_0x0a2d('0x21');break;case 0xb:logger[_0x0a2d('0x6')](_0x0a2d('0x22'));_0x32afad='11';_0xd5dc17='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x29d8a7){logger[_0x0a2d('0x23')](_0x0a2d('0x24'),JSON['stringify'](_0x29d8a7));_0x19260e[_0x0a2d('0x15')]();}}function _0x11ad44(){logger[_0x0a2d('0x6')]('Close\x20Tilde\x20ASR\x20socket');_0xd97847({'transcript':_0x571c65,'confidence':_0x18b46f,'status':_0x32afad,'status_message':_0xd5dc17});}function _0x1882f4(_0x3b68ef){logger['error'](_0x0a2d('0x25'));if(!_[_0x0a2d('0x26')](_0x3b68ef)){logger[_0x0a2d('0x23')](_['isObject'](_0x3b68ef)?JSON[_0x0a2d('0x11')](_0x3b68ef):_0x3b68ef);}}_0x19260e['on']('open',_0xade7fa);_0x19260e['on']('message',_0x3cc848);_0x19260e['on'](_0x0a2d('0x27'),_0x11ad44);_0x19260e['on'](_0x0a2d('0x23'),_0x1882f4);});}; \ No newline at end of file +var _0x5c58=['Close\x20Tilde\x20ASR\x20socket','isNil','isObject','open','close','bluebird','moment','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','sha1','update','digest','Open\x20Tilde\x20ASR\x20socket','send','createReadStream','error','Tilde\x20ASR\x20send\x20error','stringify','terminate','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error'];(function(_0x1d88db,_0x26213f){var _0x1df256=function(_0x1bb1e7){while(--_0x1bb1e7){_0x1d88db['push'](_0x1d88db['shift']());}};_0x1df256(++_0x26213f);}(_0x5c58,0x108));var _0x85c5=function(_0x290f9f,_0x377ba5){_0x290f9f=_0x290f9f-0x0;var _0x35b4ab=_0x5c58[_0x290f9f];return _0x35b4ab;};'use strict';var BPromise=require(_0x85c5('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x85c5('0x1'));var crypto=require(_0x85c5('0x2'));var logger=require(_0x85c5('0x3'))(_0x85c5('0x4'));module[_0x85c5('0x5')]=function(_0x1574cd,_0x5a7cb0,_0x3c2143,_0x5df0af){return new BPromise(function(_0x5baa36,_0x5a66d8){logger[_0x85c5('0x6')](_0x85c5('0x7'),_0x5df0af||_0x85c5('0x8'));var _0x5b13dc=new WebSocket(_0x5df0af||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x371035='';var _0x19355b='0';var _0x59c476='1';var _0x4ae3b5=_0x85c5('0x9');function _0x539a8d(_0x427dfd){var _0xbde111=crypto['createHash'](_0x85c5('0xa'));_0xbde111[_0x85c5('0xb')](_0x427dfd);return _0xbde111[_0x85c5('0xc')]('hex');}function _0x3e1922(){try{logger[_0x85c5('0x6')](_0x85c5('0xd'));var _0x1cd5a3=moment()['unix']();var _0x32f80d=_0x539a8d(_0x1cd5a3+_0x5a7cb0+_0x3c2143);_0x5b13dc[_0x85c5('0xe')](JSON['stringify']({'appID':_0x5a7cb0,'timestamp':_0x1cd5a3,'appKey':_0x32f80d}));var _0x30f51b=fs[_0x85c5('0xf')](_0x1574cd);_0x30f51b['on']('data',function(_0xe5f38a){_0x5b13dc[_0x85c5('0xe')](_0xe5f38a);});_0x30f51b['on']('close',function(){_0x5b13dc[_0x85c5('0xe')]('EOS');});}catch(_0xc42573){logger[_0x85c5('0x10')](_0x85c5('0x11'),JSON[_0x85c5('0x12')](_0xc42573));_0x5b13dc[_0x85c5('0x13')]();}}function _0x1f3f61(_0x3d4968){try{if(_0x3d4968){var _0x20bb4e=JSON['parse'](_0x3d4968);switch(_0x20bb4e[_0x85c5('0x14')]){case 0x0:if(_0x20bb4e['result']){if(_0x20bb4e[_0x85c5('0x15')][_0x85c5('0x16')]){logger['info'](_0x85c5('0x17'),JSON['stringify'](_0x20bb4e[_0x85c5('0x15')][_0x85c5('0x18')]));_0x371035=_0x20bb4e['result'][_0x85c5('0x18')][0x0][_0x85c5('0x19')];_0x19355b=_0x20bb4e[_0x85c5('0x15')][_0x85c5('0x18')][0x0]['likelihood'];_0x59c476='0';_0x4ae3b5=_0x85c5('0x1a');_0x5b13dc[_0x85c5('0x13')]();}}break;case 0x1:logger[_0x85c5('0x6')](_0x85c5('0x9'));_0x59c476='1';_0x4ae3b5=_0x85c5('0x9');break;case 0x2:logger[_0x85c5('0x6')](_0x85c5('0x1b'));_0x59c476='2';_0x4ae3b5=_0x85c5('0x1b');break;case 0x9:logger[_0x85c5('0x6')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x59c476='9';_0x4ae3b5=_0x85c5('0x1c');break;case 0xa:logger[_0x85c5('0x6')](_0x85c5('0x1d'));_0x59c476='10';_0x4ae3b5='Authentication\x20failed.';break;case 0xb:logger['info']('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x59c476='11';_0x4ae3b5=_0x85c5('0x1e');}}}catch(_0x919ab9){logger[_0x85c5('0x10')](_0x85c5('0x1f'),JSON[_0x85c5('0x12')](_0x919ab9));_0x5b13dc['terminate']();}}function _0x2fe585(){logger[_0x85c5('0x6')](_0x85c5('0x20'));_0x5baa36({'transcript':_0x371035,'confidence':_0x19355b,'status':_0x59c476,'status_message':_0x4ae3b5});}function _0x21554a(_0x17dbe2){logger['error']('Error\x20Tilde\x20ASR\x20socket');if(!_[_0x85c5('0x21')](_0x17dbe2)){logger[_0x85c5('0x10')](_[_0x85c5('0x22')](_0x17dbe2)?JSON[_0x85c5('0x12')](_0x17dbe2):_0x17dbe2);}}_0x5b13dc['on'](_0x85c5('0x23'),_0x3e1922);_0x5b13dc['on']('message',_0x1f3f61);_0x5b13dc['on'](_0x85c5('0x24'),_0x2fe585);_0x5b13dc['on'](_0x85c5('0x10'),_0x21554a);});}; \ No newline at end of file diff --git a/server/services/agi/scripts/tilde/index.js b/server/services/agi/scripts/tilde/index.js index 4033421..2f87675 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 _0x5f91=['./asr'];(function(_0x21a9d3,_0x37ba15){var _0x4f54ec=function(_0x41d36c){while(--_0x41d36c){_0x21a9d3['push'](_0x21a9d3['shift']());}};_0x4f54ec(++_0x37ba15);}(_0x5f91,0x1dd));var _0x15f9=function(_0x235c94,_0x37db0c){_0x235c94=_0x235c94-0x0;var _0x11bf54=_0x5f91[_0x235c94];return _0x11bf54;};var asr=require(_0x15f9('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0xc953=['exports','./asr'];(function(_0x91384,_0x545eef){var _0x44daa0=function(_0x5a0cc5){while(--_0x5a0cc5){_0x91384['push'](_0x91384['shift']());}};_0x44daa0(++_0x545eef);}(_0xc953,0x87));var _0x3c95=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xc953[_0x1ddedd];return _0xa3e1ac;};var asr=require(_0x3c95('0x0'));module[_0x3c95('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 2abe719..6bcc542 100644 --- a/server/services/agi/server.js +++ b/server/services/agi/server.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['ready','E_AGI_SERVER_ERROR','close','E_AGI_SERVER_CLOSE','inherits','exports','util','net','events','./channel','call','emit','createServer','listening','connection','getConnections','error','E_AGI_SERVER_VOICE_DISABLED','destroy'];(function(_0x32cd29,_0x29f6bb){var _0x2f7e6e=function(_0x20a924){while(--_0x20a924){_0x32cd29['push'](_0x32cd29['shift']());}};_0x2f7e6e(++_0x29f6bb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'use strict';var util=require(_0x0a9e('0x0'));var net=require(_0x0a9e('0x1'));var EventEmitter=require(_0x0a9e('0x2'))['EventEmitter'];var AGIError=require('./error');var AGIChannel=require(_0x0a9e('0x3'));var AGIServer=function(_0x4ce2f1,_0x333808,_0x432180){var _0x2ab90b=this;var _0x991246=null;var _0x981158=0x0;if(!_0x4ce2f1)_0x4ce2f1=0x11dd;if(!_0x333808)_0x333808='127.0.0.1';EventEmitter[_0x0a9e('0x4')](_0x2ab90b);function _0x441e3a(){if(!_0x4ce2f1){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x991246=net[_0x0a9e('0x6')]();_0x991246['listen'](_0x4ce2f1,_0x333808);_0x991246['on']('listening',function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x7'));});_0x991246['on'](_0x0a9e('0x8'),function(_0x3ab53f){_0x991246[_0x0a9e('0x9')](function(_0xbd1168,_0x4a4c56){if(_0xbd1168){_0x2ab90b['emit']('error',new AGIError('E_AGI_SERVER_ERROR',_0xbd1168));}else if(_0x432180&&_0x432180<0x0){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError(_0x0a9e('0xb')));_0x3ab53f[_0x0a9e('0xc')]();}else if(_0x432180&&_0x432180>0x0&&_0x432180<_0x4a4c56){_0x981158+=0x1;_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x981158));_0x3ab53f[_0x0a9e('0xc')]();}else{var _0x239b12=new AGIChannel(_0x3ab53f);_0x239b12['on'](_0x0a9e('0xd'),function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x8'),_0x239b12);});}});});_0x991246['on'](_0x0a9e('0xa'),function(_0x52a03d){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError(_0x0a9e('0xe'),_0x52a03d['code']));});_0x991246['on'](_0x0a9e('0xf'),function(){_0x2ab90b[_0x0a9e('0x5')]('close',new AGIError(_0x0a9e('0x10')));});}process['nextTick'](function(){_0x441e3a();});};util[_0x0a9e('0x11')](AGIServer,EventEmitter);module[_0x0a9e('0x12')]=function(_0x106033,_0x205fd6,_0x31b1ca){return new AGIServer(_0x106033,_0x205fd6,_0x31b1ca);}; \ No newline at end of file +var _0xe706=['connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','exports','util','net','events','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening'];(function(_0x3ef8f7,_0x35359a){var _0x3b097e=function(_0x189c92){while(--_0x189c92){_0x3ef8f7['push'](_0x3ef8f7['shift']());}};_0x3b097e(++_0x35359a);}(_0xe706,0xa3));var _0x6e70=function(_0x1ff527,_0x54b6d2){_0x1ff527=_0x1ff527-0x0;var _0x51cc75=_0xe706[_0x1ff527];return _0x51cc75;};'use strict';var util=require(_0x6e70('0x0'));var net=require(_0x6e70('0x1'));var EventEmitter=require(_0x6e70('0x2'))['EventEmitter'];var AGIError=require(_0x6e70('0x3'));var AGIChannel=require(_0x6e70('0x4'));var AGIServer=function(_0x2ca810,_0x7dfbc3,_0x142c27){var _0x2164a4=this;var _0x376a8d=null;var _0x506db9=0x0;if(!_0x2ca810)_0x2ca810=0x11dd;if(!_0x7dfbc3)_0x7dfbc3=_0x6e70('0x5');EventEmitter[_0x6e70('0x6')](_0x2164a4);function _0x36357b(){if(!_0x2ca810){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x9')));return![];}_0x376a8d=net[_0x6e70('0xa')]();_0x376a8d[_0x6e70('0xb')](_0x2ca810,_0x7dfbc3);_0x376a8d['on'](_0x6e70('0xc'),function(){_0x2164a4[_0x6e70('0x7')](_0x6e70('0xc'));});_0x376a8d['on'](_0x6e70('0xd'),function(_0x743eb5){_0x376a8d[_0x6e70('0xe')](function(_0x37b3e0,_0x4600f9){if(_0x37b3e0){_0x2164a4['emit']('error',new AGIError(_0x6e70('0xf'),_0x37b3e0));}else if(_0x142c27&&_0x142c27<0x0){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x10')));_0x743eb5[_0x6e70('0x11')]();}else if(_0x142c27&&_0x142c27>0x0&&_0x142c27<_0x4600f9){_0x506db9+=0x1;_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x12'),_0x506db9));_0x743eb5['destroy']();}else{var _0x52737e=new AGIChannel(_0x743eb5);_0x52737e['on']('ready',function(){_0x2164a4[_0x6e70('0x7')]('connection',_0x52737e);});}});});_0x376a8d['on']('error',function(_0x304716){_0x2164a4[_0x6e70('0x7')]('error',new AGIError(_0x6e70('0xf'),_0x304716['code']));});_0x376a8d['on'](_0x6e70('0x13'),function(){_0x2164a4[_0x6e70('0x7')]('close',new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x6e70('0x14')](function(){_0x36357b();});};util['inherits'](AGIServer,EventEmitter);module[_0x6e70('0x15')]=function(_0x173afe,_0x53acdc,_0x497d61){return new AGIServer(_0x173afe,_0x53acdc,_0x497d61);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index cf11aba..9800dc2 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 _0x0ba7=['MP3','googleTTS','restAPI','method','timeout','number','POST','body','parse','headers','computedVariables','sync','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_polly_voice','aws_text_type','awsLex','aws_secret_access_key','aws_bot_name','googleASR','tildeASR','appsecret','uri','clear','clone','hasOwnProperty','isString','includes','replaceAllVariables','recursiveNodeIndex','isArray','saveRestApiResult','%s.%s','length','setVariable','replaceObjectAllVariables','split','replaceAll','extra','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','mrcpsynth','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','MRCP_RECOG_CONFIDENCE','getAndSetVariable','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','list_id','delay','minutes','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','getQueryOdbc','variable_id','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','dial','sip_id','DIAL','SIP/%s','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','toUpperCase','speech','out','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','client_email','private_key','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','SESTEK_NDA_%s','audiofile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','Enter\x20in\x20END\x20(%s)\x20block','end','ext_dial','trunk_id','getTrunk','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','opts','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','no\x20variable\x20selected\x20for\x20the\x20result','response','maxdigit','toString','test','mindigit','hiddendigitsnum','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','Trying\x20aws\x20Polly\x20%s','streamFile','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','no\x20key\x20configured','wav','generate','beep','recordFile','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appid','no\x20appid\x20configured','no\x20appsecret\x20configured','%s/recordings/%s','NOBEEP','intKey','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','priority','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','EVAL\x20CONDITION\x20%s\x20%s','false','no\x20interval\x20configured','interval_id','no\x20intervals\x20found','IFTIME\x20%s\x20%s','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','IspeechASR\x20Result\x20%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','agentLogout','failure','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','getData','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','getPause','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','queue_id','no\x20queue\x20selected','indexOf','XMCS-QUEUE','url','macro','gosub','QUEUE','record','recordingFormat','%s/recordings/%s.%s','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','statusCode','200','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','account_id','no\x20mail\x20account\x20configured','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','Smtp','user','subject','template_id','debug','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','getSmsAccount','no\x20sms\x20account\x20found','sms_text','sms_account_id','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','command','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','join','exports','util','shelljs','odbc','randomstring','moment','request-promise','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','mailRpc','getVariable','rpc','catch','prototype','getVoiceQueue','getVoiceQueueById','then','name','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunkById','getSound','getSoundById','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','IntervalId','map','getSoundPath','format','%s/sounds/converted/%s','open','error','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','context','extension','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','lastName','phone','callback','Callback\x20scheduled\x20at\x20','scheduledAt','callback_priority','getPauseById','agentPause','agentUnpause','agent','internal','%s/%s@from-sip/n','LOCAL','agentLogin','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','text','languageCode','en-US','MALE','audioEncoding'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0ba7,0x16d));var _0x70ba=function(_0x2858b3,_0x100f5d){_0x2858b3=_0x2858b3-0x0;var _0x22dec0=_0x0ba7[_0x2858b3];return _0x22dec0;};'use strict';var fs=require('fs');var util=require(_0x70ba('0x0'));var _=require('lodash');var sh=require(_0x70ba('0x1'));var odbc=require(_0x70ba('0x2'))();var rs=require(_0x70ba('0x3'));var moment=require(_0x70ba('0x4'));var Mustache=require('mustache');var rp=require(_0x70ba('0x5'));var logger=require(_0x70ba('0x6'))(_0x70ba('0x7'));var config=require(_0x70ba('0x8'));var scripts=require(_0x70ba('0x9'));var FILES_PATH=_0x70ba('0xa');var recursiveMapAttributes=[_0x70ba('0xb'),_0x70ba('0xc')];var verticesWithRetry=[_0x70ba('0xd'),_0x70ba('0xe'),_0x70ba('0xf')];var AGIVertices=function(_0x41cd10,_0x1264b0,_0x371629){this[_0x70ba('0x10')]=_0x41cd10;this['rpc']=_0x1264b0;this[_0x70ba('0x11')]=_0x371629;};AGIVertices['prototype'][_0x70ba('0x12')]=function(_0x258604,_0xfc4de3){this[_0x70ba('0x13')]['getVariableById'](_0x258604)['then'](function(_0x12cea8){_0xfc4de3(null,_0x12cea8?_0x12cea8['name']:![]);})[_0x70ba('0x14')](function(_0x5e94c7){_0xfc4de3(_0x5e94c7);});};AGIVertices[_0x70ba('0x15')][_0x70ba('0x16')]=function(_0x4df1e3,_0x1d674b){this['rpc'][_0x70ba('0x17')](_0x4df1e3)[_0x70ba('0x18')](function(_0x211b0e){_0x1d674b(null,_0x211b0e?_0x211b0e[_0x70ba('0x19')]:![]);})[_0x70ba('0x14')](function(_0x29734b){_0x1d674b(_0x29734b);});};AGIVertices[_0x70ba('0x15')][_0x70ba('0x1a')]=function(_0x18334a,_0x3e27e8){this[_0x70ba('0x13')][_0x70ba('0x1b')](_0x18334a)[_0x70ba('0x18')](function(_0xb6d69a){_0x3e27e8(null,_0xb6d69a?_0xb6d69a['name']:![]);})['catch'](function(_0x489cf9){_0x3e27e8(_0x489cf9);});};AGIVertices[_0x70ba('0x15')][_0x70ba('0x1c')]=function(_0x20c2aa,_0xb4dad){this[_0x70ba('0x13')][_0x70ba('0x1d')](_0x20c2aa)[_0x70ba('0x18')](function(_0x2763f3){_0xb4dad(null,_0x2763f3?_0x2763f3[_0x70ba('0x1e')]:![]);})[_0x70ba('0x14')](function(_0x26c039){_0xb4dad(_0x26c039);});};AGIVertices[_0x70ba('0x15')][_0x70ba('0x1f')]=function(_0x4570b0,_0x273ce4){this['rpc'][_0x70ba('0x20')](_0x4570b0)[_0x70ba('0x18')](function(_0x52accf){_0x273ce4(null,_0x52accf?_0x52accf[_0x70ba('0x19')]:![]);})['catch'](function(_0x4868a1){_0x273ce4(_0x4868a1);});};AGIVertices[_0x70ba('0x15')]['getTrunk']=function(_0x45bbf2,_0x304a41){this['rpc'][_0x70ba('0x21')](_0x45bbf2)['then'](function(_0x5ad828){_0x304a41(null,_0x5ad828?_0x5ad828[_0x70ba('0x19')]:![]);})['catch'](function(_0x230d11){_0x304a41(_0x230d11);});};AGIVertices[_0x70ba('0x15')][_0x70ba('0x22')]=function(_0x33e218,_0x2c6d18){var _0x265423=this;this['rpc'][_0x70ba('0x23')](_0x33e218)[_0x70ba('0x18')](function(_0x797467){_0x2c6d18(null,_0x797467?_0x265423['getSoundPath'](_0x797467[_0x70ba('0x24')]):![]);})['catch'](function(_0x5955dc){_0x2c6d18(_0x5955dc);});};AGIVertices['prototype'][_0x70ba('0x25')]=function(_0x345edd,_0x5b6e6e){this['rpc'][_0x70ba('0x26')](_0x345edd)['then'](function(_0x102661){_0x5b6e6e(null,_0x102661?_0x102661:![]);})[_0x70ba('0x14')](function(_0x46b7e3){_0x5b6e6e(_0x46b7e3);});};AGIVertices[_0x70ba('0x15')][_0x70ba('0x27')]=function(_0x269943,_0x1f86cf,_0x9bafd){this[_0x70ba('0x11')][_0x70ba('0x27')](_0x269943,_0x1f86cf)[_0x70ba('0x18')](function(){_0x9bafd(null);})['catch'](function(_0x576ec4){_0x9bafd(_0x576ec4);});};AGIVertices[_0x70ba('0x15')][_0x70ba('0x28')]=function(_0x943e49,_0x563f68){this['rpc']['getIntervalById'](_0x943e49)[_0x70ba('0x18')](function(_0x806866){if(_0x806866){if(_0x806866[_0x70ba('0x29')]){_0x563f68(null,[_0x806866['interval']]);}else{_0x563f68(null,_[_0x70ba('0x2a')](_0x806866['Intervals'],'interval'));}}else{_0x563f68(null,![]);}})[_0x70ba('0x14')](function(_0x591596){_0x563f68(_0x591596);});};AGIVertices[_0x70ba('0x15')][_0x70ba('0x2b')]=function(_0x4f3d6f){return util[_0x70ba('0x2c')](_0x70ba('0x2d'),FILES_PATH,_0x4f3d6f);};AGIVertices[_0x70ba('0x15')]['getQueryOdbc']=function(_0x1402b2,_0x20c3fd,_0xbb0c72){odbc[_0x70ba('0x2e')](_0x1402b2,function(_0x5245f7){if(_0x5245f7){logger[_0x70ba('0x2f')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x5245f7);_0xbb0c72(_0x5245f7);}else{logger[_0x70ba('0x30')](_0x70ba('0x31'));odbc[_0x70ba('0x32')](_0x20c3fd,function(_0x450eb3,_0x16ce39){if(_0x450eb3){logger[_0x70ba('0x30')](_0x70ba('0x33'),_0x20c3fd);_0xbb0c72(_0x450eb3);}else{logger['info'](_0x70ba('0x34'),_0x20c3fd);odbc[_0x70ba('0x35')](function(_0x31e713){if(_0x31e713){logger[_0x70ba('0x2f')](_0x70ba('0x36'),_0x31e713);}_0xbb0c72(null,_0x16ce39);});}});}});};AGIVertices[_0x70ba('0x15')]['getSmsAccount']=function(_0x452208,_0x175152){this[_0x70ba('0x13')]['getSmsAccountById'](_0x452208)['then'](function(_0x5ee9b1){_0x175152(null,_0x5ee9b1?_0x5ee9b1:![]);})[_0x70ba('0x14')](function(_0x59044){_0x175152(_0x59044);});};AGIVertices[_0x70ba('0x15')]['createSmsMessage']=function(_0x24a8c3,_0x27203b){this[_0x70ba('0x13')][_0x70ba('0x37')](_0x24a8c3)[_0x70ba('0x18')](function(_0x54e732){_0x27203b(null,_0x54e732);})['catch'](function(_0x7b0436){_0x27203b(_0x7b0436);});};AGIVertices[_0x70ba('0x15')][_0x70ba('0x38')]=function(_0x5a1edb,_0x595645,_0x2fc262){this['rpc'][_0x70ba('0x38')]({'uniqueid':this[_0x70ba('0x10')][_0x70ba('0x39')],'node':_0x5a1edb[_0x70ba('0x3a')],'application':_0x5a1edb[_0x70ba('0x3b')],'data':_0x595645||null,'project_name':this['channel'][_0x70ba('0x3c')],'callerid':this[_0x70ba('0x10')][_0x70ba('0x3d')]})[_0x70ba('0x18')](function(_0x817e59){if(_0x2fc262){_0x2fc262(null,_0x817e59);}})[_0x70ba('0x14')](function(_0x900910){if(_0x2fc262){_0x2fc262(_0x900910);}});};AGIVertices[_0x70ba('0x15')][_0x70ba('0x3e')]=function(_0x1f804b,_0x389571,_0x349059,_0x3e3ce5){this[_0x70ba('0x13')][_0x70ba('0x3e')]({'uniqueid':this['channel'][_0x70ba('0x39')],'callerid':this[_0x70ba('0x10')]['callerid'],'calleridname':this[_0x70ba('0x10')][_0x70ba('0x3f')],'context':this[_0x70ba('0x10')][_0x70ba('0x40')],'extension':this[_0x70ba('0x10')][_0x70ba('0x41')],'priority':this[_0x70ba('0x10')]['priority'],'accountcode':this[_0x70ba('0x10')][_0x70ba('0x42')],'dnid':this[_0x70ba('0x10')][_0x70ba('0x43')],'projectName':this[_0x70ba('0x10')][_0x70ba('0x3c')],'saveName':_0x389571,'filename':_0x1f804b[_0x70ba('0x44')]||_0x389571,'savePath':_0x349059})[_0x70ba('0x18')](function(_0xc574b){_0x3e3ce5(null,_0xc574b);})[_0x70ba('0x14')](function(_0x3a4247){_0x3e3ce5(_0x3a4247);});};AGIVertices[_0x70ba('0x15')][_0x70ba('0x45')]=function(_0x16af4d,_0x25f68a,_0x2536cd,_0x9f97c5,_0x4a848b){this[_0x70ba('0x13')][_0x70ba('0x45')]({'uniqueid':this[_0x70ba('0x10')][_0x70ba('0x39')],'body':_0x16af4d,'direction':_0x25f68a,'providerName':_0x2536cd,'providerResponse':_0x9f97c5})['then'](function(_0x47c40c){if(_0x4a848b){_0x4a848b(null,_0x47c40c);}})['catch'](function(_0x471d19){if(_0x4a848b){_0x4a848b(_0x471d19);}});};AGIVertices[_0x70ba('0x15')]['createCmContact']=function(_0x572834,_0x6a3dc6){this[_0x70ba('0x13')][_0x70ba('0x46')]({'firstName':_[_0x70ba('0x47')](_0x572834[_0x70ba('0x19')])||_[_0x70ba('0x48')](_0x572834[_0x70ba('0x19')])?'callback_'+Math['random']():_0x572834[_0x70ba('0x19')],'lastName':_[_0x70ba('0x47')](_0x572834[_0x70ba('0x49')])||_[_0x70ba('0x48')](_0x572834['lastName'])?null:_0x572834[_0x70ba('0x49')],'phone':_0x572834[_0x70ba('0x4a')],'ListId':_0x572834['list_id'],'scheduledat':_0x572834['scheduledAt'],'callbackUniqueid':this['channel']['uniqueid'],'tags':_0x70ba('0x4b'),'description':_0x70ba('0x4c')+_0x572834[_0x70ba('0x4d')]['toString'](),'priority':_0x572834[_0x70ba('0x4e')]})[_0x70ba('0x18')](function(_0x29bb0b){_0x6a3dc6(null,_0x29bb0b);})['catch'](function(_0x1bdcd4){_0x6a3dc6(_0x1bdcd4);});};AGIVertices[_0x70ba('0x15')]['getPause']=function(_0x49f89a,_0x2ccfd4){this[_0x70ba('0x13')][_0x70ba('0x4f')](_0x49f89a)[_0x70ba('0x18')](function(_0x10e824){_0x2ccfd4(null,_0x10e824?_0x10e824[_0x70ba('0x19')]:![]);})[_0x70ba('0x14')](function(_0x5e7a92){_0x2ccfd4(_0x5e7a92);});};AGIVertices[_0x70ba('0x15')][_0x70ba('0x50')]=function(_0x4de412,_0x508da6,_0x137b7d){var _0x26c5a7={'role':'agent'};_0x26c5a7[_0x4de412]=this['channel'][_0x70ba('0x3d')];this['rpc']['agentPause'](_0x26c5a7,_0x508da6,this[_0x70ba('0x10')][_0x70ba('0x39')])[_0x70ba('0x18')](function(_0xb03649){_0x137b7d(null,_[_0x70ba('0x48')](_0xb03649)?![]:!![]);})[_0x70ba('0x14')](function(_0xeac8a8){logger['error'](_0xeac8a8);_0x137b7d(null,![]);});};AGIVertices[_0x70ba('0x15')][_0x70ba('0x51')]=function(_0x16e607,_0xaad21){var _0x355df4={'role':_0x70ba('0x52')};_0x355df4[_0x16e607]=this['channel'][_0x70ba('0x3d')];this['rpc'][_0x70ba('0x51')](_0x355df4)['then'](function(_0x3badfd){_0xaad21(null,_[_0x70ba('0x48')](_0x3badfd)?![]:!![]);})[_0x70ba('0x14')](function(_0x305df9){logger[_0x70ba('0x2f')](_0x305df9);_0xaad21(null,![]);});};AGIVertices[_0x70ba('0x15')]['agentLogout']=function(_0x2a46cd,_0x4d7e67){var _0x490948={'role':_0x70ba('0x52')};_0x490948[_0x2a46cd]=this[_0x70ba('0x10')]['callerid'];this[_0x70ba('0x13')]['agentLogout'](_0x490948)[_0x70ba('0x18')](function(_0x2a8aa9){_0x4d7e67(null,_[_0x70ba('0x48')](_0x2a8aa9)?![]:!![]);})['catch'](function(_0x327219){logger['error'](_0x327219);_0x4d7e67(null,![]);});};AGIVertices[_0x70ba('0x15')]['agentLogin']=function(_0x2ee3d0,_0x3e0aeb){var _0x1bd96e={'role':_0x70ba('0x52')};_0x1bd96e[_0x2ee3d0]=this['channel'][_0x70ba('0x3d')];var _0x530324=_0x2ee3d0!=_0x70ba('0x53')?util[_0x70ba('0x2c')](_0x70ba('0x54'),_0x70ba('0x55'),this['channel'][_0x70ba('0x3d')]):undefined;this[_0x70ba('0x13')][_0x70ba('0x56')](_0x1bd96e,_0x530324)[_0x70ba('0x18')](function(_0x14c761){_0x3e0aeb(null,_[_0x70ba('0x48')](_0x14c761)?![]:!![]);})[_0x70ba('0x14')](function(_0x2e0f08){logger['error'](_0x2e0f08);_0x3e0aeb(null,![]);});};AGIVertices[_0x70ba('0x15')][_0x70ba('0x57')]=function(_0x28294e,_0x157404){sh[_0x70ba('0x58')](_[_0x70ba('0x59')](_0x28294e),function(_0xb2276e,_0x4d83ab){var _0x1bc8c6=_0x4d83ab[_0x70ba('0x5a')](/(\r\n|\n|\r)/gm,'');_0x157404(null,_0x1bc8c6);});};AGIVertices[_0x70ba('0x15')][_0x70ba('0x5b')]=function(_0x30fad7,_0x67628f){scripts[_0x70ba('0x5b')](_0x30fad7[_0x70ba('0x5c')],_0x30fad7['google_cloud_tts_text_type']||'text',_0x30fad7[_0x70ba('0x5d')],_0x30fad7[_0x70ba('0x5e')]||_0x70ba('0x5f'),_0x30fad7['ssmlGender']||_0x70ba('0x60'),_0x30fad7[_0x70ba('0x61')]||_0x70ba('0x62'))['then'](function(_0x3e341a){_0x67628f(null,_0x3e341a);})[_0x70ba('0x14')](function(_0xa9009d){_0x67628f(_0xa9009d);});};AGIVertices[_0x70ba('0x15')][_0x70ba('0x63')]=function(_0x3184cc,_0x22e520){scripts['googleTTS'](_0x3184cc[_0x70ba('0x5d')],_0x3184cc['google_tts_language']||'en',0x1)['then'](function(_0x12f420){_0x22e520(null,_0x12f420);})[_0x70ba('0x14')](function(_0x13cb22){_0x22e520(_0x13cb22);});};AGIVertices[_0x70ba('0x15')][_0x70ba('0x64')]=function(_0x408f46,_0x36eb0f){var _0x315ed4={'uri':_0x408f46['url'],'method':_0x408f46[_0x70ba('0x65')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x408f46[_0x70ba('0x66')])===_0x70ba('0x67')&&parseInt(_0x408f46['timeout'])>=0x1?parseInt(_0x408f46['timeout'])*0x3e8:0x5*0x3e8};if(_['includes']([_0x70ba('0x68'),'PUT'],_0x315ed4['method']['toUpperCase']())){try{_0x315ed4[_0x70ba('0x69')]=_0x408f46[_0x70ba('0xc')]?JSON[_0x70ba('0x6a')](_0x408f46[_0x70ba('0xc')]):{};}catch(_0xe214a7){logger['error']('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0xe214a7);}}try{_0x315ed4[_0x70ba('0x6b')]=_0x408f46[_0x70ba('0xb')]?JSON['parse'](_0x408f46[_0x70ba('0xb')]):{};}catch(_0x3ba6c3){logger[_0x70ba('0x2f')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x3ba6c3);}if(_0x408f46[_0x70ba('0x6c')]){try{var _0x534ea9=require(_0x408f46[_0x70ba('0x6c')])[_0x70ba('0x6d')](this,_0x315ed4);_0x315ed4['uri']=Mustache[_0x70ba('0x6e')](_0x408f46['url'],_0x534ea9,{},['$$','$$']);if(_0x315ed4[_0x70ba('0x6b')]){_0x315ed4[_0x70ba('0x6b')]=JSON['parse'](Mustache[_0x70ba('0x6e')](JSON[_0x70ba('0x6f')](_0x315ed4[_0x70ba('0x6b')]),_0x534ea9,{},['$$','$$']));}if(_0x315ed4[_0x70ba('0x69')]){_0x315ed4[_0x70ba('0x69')]=JSON[_0x70ba('0x6a')](Mustache[_0x70ba('0x6e')](JSON[_0x70ba('0x6f')](_0x315ed4[_0x70ba('0x69')]),_0x534ea9,{},['$$','$$']));}}catch(_0xc4c5d3){logger['error'](_0x70ba('0x70'),_0xc4c5d3);}}rp(_0x315ed4)[_0x70ba('0x18')](function(_0x46e1f1){var _0x313a9a={'statusCode':_0x46e1f1['statusCode']||0xc8,'statusMessage':_0x46e1f1[_0x70ba('0x71')]||'OK','headers':_0x46e1f1['headers']||{},'body':_0x46e1f1[_0x70ba('0x69')]||{}};_0x36eb0f(null,_0x313a9a);})['catch'](function(_0x44b3ad){var _0x18d129={'statusCode':_0x44b3ad['statusCode']||0x1f4,'statusMessage':_0x44b3ad[_0x70ba('0x72')]||_0x70ba('0x73'),'headers':_0x44b3ad[_0x70ba('0x74')][_0x70ba('0x6b')]||{},'body':_0x44b3ad[_0x70ba('0x74')][_0x70ba('0x69')]||{}};_0x36eb0f(null,_0x18d129);});};AGIVertices[_0x70ba('0x15')][_0x70ba('0x75')]=function(_0x58e514,_0x3b4036){scripts[_0x70ba('0x75')](this[_0x70ba('0x10')][_0x70ba('0x39')],_0x58e514[_0x70ba('0x76')],_0x58e514[_0x70ba('0x5d')],_0x58e514[_0x70ba('0x77')]||'en')[_0x70ba('0x18')](function(_0x57ec44){_0x3b4036(null,_0x57ec44);})[_0x70ba('0x14')](function(_0x3b4ee6){_0x3b4036(_0x3b4ee6);});};AGIVertices[_0x70ba('0x15')]['googleDialogflowV2']=function(_0x271b69,_0x1a037e){scripts[_0x70ba('0x78')](this['channel']['uniqueid'],_0x271b69[_0x70ba('0x79')],_0x271b69['client_email'],_0x271b69['private_key'],_0x271b69[_0x70ba('0x5d')],_0x271b69[_0x70ba('0x7a')]||'en')[_0x70ba('0x18')](function(_0x10282f){_0x1a037e(null,_0x10282f);})[_0x70ba('0x14')](function(_0x239265){_0x1a037e(_0x239265);});};AGIVertices['prototype']['sestekNDA']=function(_0xa0f12b,_0x312048){scripts[_0x70ba('0x7b')](this[_0x70ba('0x10')],_0xa0f12b)['then'](function(_0x3e4ec7){_0x312048(null,_0x3e4ec7);})[_0x70ba('0x14')](function(_0x459128){_0x312048(_0x459128);});};AGIVertices[_0x70ba('0x15')][_0x70ba('0x7c')]=function(_0x3e3e45,_0x132ff1){scripts[_0x70ba('0x7c')](_0x3e3e45[_0x70ba('0x76')],_0x3e3e45[_0x70ba('0x5d')],_0x3e3e45[_0x70ba('0x7d')]||_0x70ba('0x5f'),_0x3e3e45[_0x70ba('0x7e')])[_0x70ba('0x18')](function(_0x53df7a){_0x132ff1(null,_0x53df7a);})[_0x70ba('0x14')](function(_0x24328e){_0x132ff1(_0x24328e);});};AGIVertices[_0x70ba('0x15')]['ispeechASR']=function(_0x5f2e0a,_0x54849c,_0x1e9f8a){scripts[_0x70ba('0x7f')](_0x54849c,_0x5f2e0a[_0x70ba('0x76')],_0x5f2e0a[_0x70ba('0x80')]||'en-US',this[_0x70ba('0x81')](_0x5f2e0a[_0x70ba('0x82')])?_0x5f2e0a[_0x70ba('0x82')]:undefined)[_0x70ba('0x18')](function(_0x5445e7){_0x1e9f8a(null,_0x5445e7);})['catch'](function(_0x4875e6){_0x1e9f8a(_0x4875e6);});};AGIVertices[_0x70ba('0x15')]['awsPolly']=function(_0x363fa4,_0x5e2822){scripts[_0x70ba('0x83')](_0x363fa4[_0x70ba('0x84')],_0x363fa4['aws_secret_access_key'],_0x363fa4['aws_polly_region'],_0x363fa4[_0x70ba('0x85')]||'Amy',_0x363fa4['text'],_0x363fa4[_0x70ba('0x86')]||_0x70ba('0x5d'))[_0x70ba('0x18')](function(_0x374ed7){_0x5e2822(null,_0x374ed7);})[_0x70ba('0x14')](function(_0x130029){_0x5e2822(_0x130029);});};AGIVertices[_0x70ba('0x15')][_0x70ba('0x87')]=function(_0x152fdb,_0x26c4a7){scripts[_0x70ba('0x87')](this[_0x70ba('0x10')][_0x70ba('0x39')],_0x152fdb[_0x70ba('0x84')],_0x152fdb[_0x70ba('0x88')],_0x152fdb['aws_lex_region'],_0x152fdb[_0x70ba('0x5d')],_0x152fdb[_0x70ba('0x89')])[_0x70ba('0x18')](function(_0x5441f9){_0x26c4a7(null,_0x5441f9);})[_0x70ba('0x14')](function(_0x2fbf2b){_0x26c4a7(_0x2fbf2b);});};AGIVertices['prototype'][_0x70ba('0x8a')]=function(_0x490b96,_0x4cf238,_0xb13413){scripts['googleASR'](_0x4cf238,_0x490b96[_0x70ba('0x76')],_0x490b96['google_asr_language']||_0x70ba('0x5f'))[_0x70ba('0x18')](function(_0x3386fd){_0xb13413(null,_0x3386fd);})[_0x70ba('0x14')](function(_0x365faf){_0xb13413(_0x365faf);});};AGIVertices[_0x70ba('0x15')][_0x70ba('0x8b')]=function(_0x360b23,_0x5a1e70,_0x541fb6){scripts[_0x70ba('0x8b')](_0x5a1e70,_0x360b23['appid'],_0x360b23[_0x70ba('0x8c')],_0x360b23[_0x70ba('0x8d')])[_0x70ba('0x18')](function(_0x1359cc){_0x541fb6(null,_0x1359cc);})[_0x70ba('0x14')](function(_0xa0e34d){_0x541fb6(_0xa0e34d);});};AGIVertices[_0x70ba('0x15')][_0x70ba('0x8e')]=function(_0x1e537b){var _0x5ebb9a=_['includes'](verticesWithRetry,_0x1e537b['agicommand'])?_0x1e537b:_[_0x70ba('0x8f')](_0x1e537b);for(var _0x556c20 in _0x5ebb9a){if(_0x5ebb9a[_0x70ba('0x90')](_0x556c20)){if(_0x5ebb9a[_0x556c20]&&_[_0x70ba('0x91')](_0x5ebb9a[_0x556c20])){if(_[_0x70ba('0x92')](recursiveMapAttributes,_0x556c20)){_0x5ebb9a[_0x556c20]=this['replaceObjectAllVariables'](_0x5ebb9a[_0x556c20]);}else{_0x5ebb9a[_0x556c20]=this[_0x70ba('0x93')](_0x5ebb9a[_0x556c20]);}}}}return _0x5ebb9a;};AGIVertices[_0x70ba('0x15')][_0x70ba('0x94')]=function(_0x363aad){for(var _0x21dff6 in _0x363aad){if(_0x363aad[_0x70ba('0x90')](_0x21dff6)){if(_['isPlainObject'](_0x363aad[_0x21dff6])){this['recursiveNodeIndex'](_0x363aad[_0x21dff6]);}else if(_[_0x70ba('0x95')](_0x363aad[_0x21dff6])){for(var _0x4302e6=0x0;_0x4302e6<_0x363aad[_0x21dff6]['length'];_0x4302e6++){this[_0x70ba('0x94')](_0x363aad[_0x21dff6][_0x4302e6]);}}else if(_['isString'](_0x363aad[_0x21dff6])){_0x363aad[_0x21dff6]=this[_0x70ba('0x93')](_0x363aad[_0x21dff6]);}}}};AGIVertices[_0x70ba('0x15')]['saveRestApiResult']=function(_0x3b3c28,_0x1dc7db){for(var _0x814ec6 in _0x3b3c28){if(_0x3b3c28[_0x70ba('0x90')](_0x814ec6)){if(_['isPlainObject'](_0x3b3c28[_0x814ec6])){if(!_[_0x70ba('0x47')](_0x3b3c28[_0x814ec6])){this[_0x70ba('0x96')](_0x3b3c28[_0x814ec6],util[_0x70ba('0x2c')](_0x70ba('0x97'),_0x1dc7db,_0x814ec6));}}else if(_['isArray'](_0x3b3c28[_0x814ec6])){for(var _0x10acf1=0x0;_0x10acf1<_0x3b3c28[_0x814ec6][_0x70ba('0x98')];_0x10acf1++){this[_0x70ba('0x96')](_0x3b3c28[_0x814ec6][_0x10acf1],util[_0x70ba('0x2c')]('%s.%s',_0x1dc7db,_0x814ec6+'['+_0x10acf1+']'));}}else{if(!_['isNil'](_0x3b3c28[_0x814ec6])){this[_0x70ba('0x10')][_0x70ba('0x99')](util['format'](_0x70ba('0x97'),_0x1dc7db,_0x814ec6),_0x3b3c28[_0x814ec6]);}}}}};AGIVertices[_0x70ba('0x15')][_0x70ba('0x9a')]=function(_0xcdd6c4){try{var _0x2cfbd8=JSON[_0x70ba('0x6a')](_0xcdd6c4);this[_0x70ba('0x94')](_0x2cfbd8);return JSON[_0x70ba('0x6f')](_0x2cfbd8);}catch(_0x1536d6){return this[_0x70ba('0x93')](_0xcdd6c4);}};AGIVertices[_0x70ba('0x15')][_0x70ba('0x93')]=function(_0x1d90be){var _0xa83ff8=_0x1d90be[_0x70ba('0x9b')]('{');for(var _0x203622=0x1;_0x203622<_0xa83ff8[_0x70ba('0x98')];_0x203622+=0x1){var _0x53e87f=_0xa83ff8[_0x203622][_0x70ba('0x9b')]('}');if(_0x53e87f[_0x70ba('0x98')]>0x1){_0x1d90be=_0x1d90be[_0x70ba('0x9c')]('{'+_0x53e87f[0x0]+'}',this[_0x70ba('0x10')][_0x70ba('0x12')](_0x53e87f[0x0])[_0x70ba('0x9d')]||_0x53e87f[0x0]);}}if(_0xa83ff8[_0x70ba('0x98')]===0x1){return _0x1d90be['toString']();}return this['replaceAllVariables'](_0x1d90be);};AGIVertices[_0x70ba('0x15')]['getAndSetVariable']=function(_0x18db80,_0x1a23d9){var _0x12329d=this[_0x70ba('0x10')][_0x70ba('0x12')](_0x18db80);if(_0x12329d[_0x70ba('0x9e')]===-0x1){return _0x12329d;}logger[_0x70ba('0x30')](util['format'](_0x70ba('0x9f'),_0x1a23d9,_0x12329d[_0x70ba('0x9d')]));return this[_0x70ba('0x10')][_0x70ba('0x99')](_0x1a23d9,_0x12329d[_0x70ba('0x9d')]);};AGIVertices[_0x70ba('0x15')]['isConfigured']=function(_0x610164){return _0x610164&&_0x610164!=='0'&&_0x610164!=='-1'&&_0x610164!=='';};AGIVertices[_0x70ba('0x15')][_0x70ba('0xa0')]=function(_0x408378){this[_0x70ba('0x38')][_0x70ba('0x6d')](this,_0x408378,'-');_0x408378[_0x70ba('0xa1')]=_0x408378['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0x70ba('0xa2')]=function(_0x312626){logger['info'](util[_0x70ba('0x2c')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x312626[_0x70ba('0x3a')]));if(!this[_0x70ba('0x81')](_0x312626[_0x70ba('0x5d')])){return this[_0x70ba('0x10')][_0x70ba('0xa3')](_0x70ba('0xa4'));}var _0x375b6d='\x22'+_0x312626[_0x70ba('0x5d')]+'\x22';if(this[_0x70ba('0x81')](_0x312626['options'])){_0x375b6d+=','+_0x312626[_0x70ba('0x74')];}var _0x237d3b=this[_0x70ba('0x10')]['exec'](_0x70ba('0xa5'),_0x375b6d);if(_0x237d3b[_0x70ba('0x9e')]===-0x1){return _0x237d3b;}return this['channel'][_0x70ba('0xa3')](util[_0x70ba('0x2c')](_0x70ba('0xa6'),_0x375b6d));};AGIVertices[_0x70ba('0x15')][_0x70ba('0xa7')]=function(_0x3016dd){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0xa8'),_0x3016dd[_0x70ba('0x3a')]));if(!this[_0x70ba('0x81')](_0x3016dd[_0x70ba('0xa9')])){return this[_0x70ba('0x10')]['noop'](_0x70ba('0xaa'));}var _0x491471=_0x3016dd[_0x70ba('0xa9')];if(this[_0x70ba('0x81')](_0x3016dd['options'])){_0x491471+=','+_0x3016dd['options'];}var _0x5e5e6b=this[_0x70ba('0x10')][_0x70ba('0x58')](_0x70ba('0xab'),_0x491471);if(_0x5e5e6b[_0x70ba('0x9e')]===-0x1){return _0x5e5e6b;}var _0x226f09=this['getAndSetVariable']('RECOG_CONFIDENCE()',_0x70ba('0xac'));if(_0x226f09['result']===-0x1){return _0x226f09;}var _0xb1be95=this[_0x70ba('0xad')](_0x70ba('0xae'),_0x70ba('0xaf'));if(_0xb1be95[_0x70ba('0x9e')]===-0x1){return _0xb1be95;}var _0x6b82ab=this[_0x70ba('0xad')](_0x70ba('0xb0'),_0x70ba('0xb1'));if(_0x6b82ab[_0x70ba('0x9e')]===-0x1){return _0x6b82ab;}return this[_0x70ba('0x10')][_0x70ba('0xa3')](util[_0x70ba('0x2c')](_0x70ba('0xb2'),_0x491471));};AGIVertices[_0x70ba('0x15')][_0x70ba('0x7')]=function(_0x569c8a){logger[_0x70ba('0x30')](util['format'](_0x70ba('0xb3'),_0x569c8a['label']));return this[_0x70ba('0x10')][_0x70ba('0x7')]([_0x569c8a['command'],_0x569c8a[_0x70ba('0xb4')]]);};AGIVertices[_0x70ba('0x15')][_0x70ba('0xb5')]=function(_0x2e6661){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0xb6'),_0x2e6661[_0x70ba('0x3a')]));if(this[_0x70ba('0x81')](_0x2e6661[_0x70ba('0x66')])){logger[_0x70ba('0x30')](util['format'](_0x70ba('0xb7'),_0x2e6661[_0x70ba('0x66')]));var _0x1e1133=this['channel'][_0x70ba('0xb8')](_0x2e6661['timeout']);if(_0x1e1133[_0x70ba('0x9e')]===-0x1){return _0x1e1133;}}return this['channel'][_0x70ba('0xb5')]();};AGIVertices[_0x70ba('0x15')][_0x70ba('0x4b')]=function(_0x264058){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0xb9'),_0x264058[_0x70ba('0x3a')]));if(!this[_0x70ba('0x81')](_0x264058[_0x70ba('0xba')])){return this['channel']['error'](_0x264058,'no\x20list\x20selected');}_0x264058[_0x70ba('0x4d')]=moment();if(this[_0x70ba('0x81')](_0x264058[_0x70ba('0xbb')])){_0x264058[_0x70ba('0x4d')]=moment()['add'](_0x264058[_0x70ba('0xbb')],_0x70ba('0xbc'));}if(!this[_0x70ba('0x81')](_0x264058[_0x70ba('0x4e')])){_0x264058['callback_priority']=0x2;}this[_0x70ba('0x46')][_0x70ba('0x6d')](this,_0x264058);return this['channel'][_0x70ba('0xa3')](util[_0x70ba('0x2c')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x264058[_0x70ba('0x4a')],_0x264058['list_id'],_0x264058[_0x70ba('0x4d')]));};AGIVertices[_0x70ba('0x15')][_0x70ba('0xbd')]=function(_0x43b8d4){logger['info'](util[_0x70ba('0x2c')](_0x70ba('0xbe'),_0x43b8d4[_0x70ba('0x3a')]));var _0x357fc2=this[_0x70ba('0x10')]['exec'](_0x43b8d4[_0x70ba('0xbf')],_0x43b8d4[_0x70ba('0x74')]);if(_0x357fc2['result']===-0x1){return _0x357fc2;}return this[_0x70ba('0x10')][_0x70ba('0xa3')](util[_0x70ba('0x2c')](_0x70ba('0xc0'),_0x43b8d4[_0x70ba('0xbf')],_0x43b8d4['options']));};AGIVertices[_0x70ba('0x15')]['lumenvoxtts']=function(_0x5a22b1){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x5a22b1[_0x70ba('0x3a')]));if(!this[_0x70ba('0x81')](_0x5a22b1['text'])){return this['channel'][_0x70ba('0xa3')]('no\x20text\x20configured');}var _0x5f5831='\x22'+_0x5a22b1[_0x70ba('0x5d')]+'\x22';if(this[_0x70ba('0x81')](_0x5a22b1[_0x70ba('0x74')])){_0x5f5831+=','+_0x5a22b1['options'];}var _0x29e322=this[_0x70ba('0x10')][_0x70ba('0x58')](_0x70ba('0xa5'),_0x5f5831);if(_0x29e322[_0x70ba('0x9e')]===-0x1){return _0x29e322;}return this['channel'][_0x70ba('0xa3')](util['format'](_0x70ba('0xa6'),_0x5f5831));};AGIVertices[_0x70ba('0x15')]['sestektts']=function(_0x4fb1f0){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0xc1'),_0x4fb1f0[_0x70ba('0x3a')]));if(!this['isConfigured'](_0x4fb1f0[_0x70ba('0x5d')])){return this['channel'][_0x70ba('0xa3')](_0x70ba('0xa4'));}var _0x29b478='\x22'+_0x4fb1f0[_0x70ba('0x5d')]+'\x22';if(this[_0x70ba('0x81')](_0x4fb1f0[_0x70ba('0x74')])){_0x29b478+=','+_0x4fb1f0['options'];}var _0xd4eb4e=this[_0x70ba('0x10')][_0x70ba('0x58')](_0x70ba('0xa5'),_0x29b478);if(_0xd4eb4e['result']===-0x1){return _0xd4eb4e;}return this[_0x70ba('0x10')][_0x70ba('0xa3')](util[_0x70ba('0x2c')](_0x70ba('0xa6'),_0x29b478));};AGIVertices[_0x70ba('0x15')]['lumenvoxasr']=function(_0x3cefff){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0xc2'),_0x3cefff[_0x70ba('0x3a')]));if(!this['isConfigured'](_0x3cefff[_0x70ba('0xa9')])){return this[_0x70ba('0x10')][_0x70ba('0xa3')](_0x70ba('0xaa'));}var _0x4f9305=_0x3cefff['grammar'];if(this[_0x70ba('0x81')](_0x3cefff[_0x70ba('0x74')])){_0x4f9305+=','+_0x3cefff['options'];}var _0x55c471=this[_0x70ba('0x10')][_0x70ba('0x58')](_0x70ba('0xab'),_0x4f9305);if(_0x55c471['result']===-0x1){return _0x55c471;}var _0x138ae3=this['getAndSetVariable'](_0x70ba('0xc3'),_0x70ba('0xc4'));if(_0x138ae3[_0x70ba('0x9e')]===-0x1){return _0x138ae3;}var _0x1ea5b8=this[_0x70ba('0xad')](_0x70ba('0xae'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x1ea5b8[_0x70ba('0x9e')]===-0x1){return _0x1ea5b8;}var _0x5be21f=this[_0x70ba('0xad')](_0x70ba('0xb0'),_0x70ba('0xc5'));if(_0x5be21f[_0x70ba('0x9e')]===-0x1){return _0x5be21f;}return this[_0x70ba('0x10')][_0x70ba('0xa3')](util[_0x70ba('0x2c')](_0x70ba('0xb2'),_0x4f9305));};AGIVertices[_0x70ba('0x15')][_0x70ba('0xc6')]=function(_0xd1f4fc){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0xc7'),_0xd1f4fc[_0x70ba('0x3a')]));if(!this['isConfigured'](_0xd1f4fc['grammar'])){return this[_0x70ba('0x10')][_0x70ba('0xa3')](_0x70ba('0xaa'));}var _0x34e82d=_0xd1f4fc[_0x70ba('0xa9')];if(this[_0x70ba('0x81')](_0xd1f4fc[_0x70ba('0x74')])){_0x34e82d+=','+_0xd1f4fc[_0x70ba('0x74')];}var _0x88e63d=this[_0x70ba('0x10')]['exec'](_0x70ba('0xab'),_0x34e82d);if(_0x88e63d[_0x70ba('0x9e')]===-0x1){return _0x88e63d;}var _0x1bdae4=this[_0x70ba('0xad')](_0x70ba('0xc3'),_0x70ba('0xc8'));if(_0x1bdae4[_0x70ba('0x9e')]===-0x1){return _0x1bdae4;}var _0x1d7db7=this[_0x70ba('0xad')](_0x70ba('0xae'),_0x70ba('0xc9'));if(_0x1d7db7[_0x70ba('0x9e')]===-0x1){return _0x1d7db7;}var _0x1f9bfc=this[_0x70ba('0xad')]('RECOG_INSTANCE()',_0x70ba('0xca'));if(_0x1f9bfc[_0x70ba('0x9e')]===-0x1){return _0x1f9bfc;}return this[_0x70ba('0x10')]['noop'](util[_0x70ba('0x2c')](_0x70ba('0xb2'),_0x34e82d));};AGIVertices[_0x70ba('0x15')][_0x70ba('0xcb')]=function(_0x43a456){logger['info'](util['format'](_0x70ba('0xcc'),_0x43a456[_0x70ba('0x3a')]));if(!this['isConfigured'](_0x43a456[_0x70ba('0xcd')])){return this[_0x70ba('0x10')]['error'](_0x43a456,_0x70ba('0xce'));}var _0x3ab9d8=this[_0x70ba('0x1c')]['sync'](this,_0x43a456[_0x70ba('0xcd')]);if(!_0x3ab9d8){return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x43a456,_0x70ba('0xcf'));}if(!this['isConfigured'](_0x43a456[_0x70ba('0x32')])){return this['channel']['error'](_0x43a456,_0x70ba('0xd0'));}var _0x3d10d8=_0x43a456[_0x70ba('0x32')][_0x70ba('0x5a')](/(\r\n|\n|\r)/gm,'\x20');this[_0x70ba('0x10')][_0x70ba('0xa3')](util[_0x70ba('0x2c')](_0x70ba('0xd1'),_0x3d10d8));var _0x5c0407=this[_0x70ba('0xd2')][_0x70ba('0x6d')](this,_0x3ab9d8,_0x3d10d8);this[_0x70ba('0x38')][_0x70ba('0x6d')](this,_0x43a456,_0x3d10d8);if(!this['isConfigured'](_0x43a456[_0x70ba('0xd3')])){return this['channel']['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x4eb230=this[_0x70ba('0x12')][_0x70ba('0x6d')](this,_0x43a456['variable_id']);if(!_0x4eb230){return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x43a456,_0x70ba('0xd4'));}var _0x36f3ed=this;_0x5c0407[_0x70ba('0xd5')](function(_0x217f66,_0x5d0ac3){Object[_0x70ba('0xd6')](_0x217f66)[_0x70ba('0xd5')](function(_0x39ea4d){_0x36f3ed[_0x70ba('0x10')]['setVariable'](util['format'](_0x70ba('0xd7'),_0x4eb230,_0x5d0ac3,_0x39ea4d),_0x217f66[_0x39ea4d]);});});this[_0x70ba('0x10')][_0x70ba('0x99')](util[_0x70ba('0x2c')](_0x70ba('0xd8'),_0x4eb230),_0x5c0407['length']);return this['channel'][_0x70ba('0xa3')](util['format']('variable\x20%s\x20set',_0x4eb230));};AGIVertices[_0x70ba('0x15')][_0x70ba('0xd9')]=function(_0x1e0375){logger['debug'](util['format']('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x1e0375[_0x70ba('0x3a')]));if(!this[_0x70ba('0x81')](_0x1e0375[_0x70ba('0xda')])){return this[_0x70ba('0x10')]['error'](_0x1e0375,'no\x20user\x20selected');}var _0x4eed89=this[_0x70ba('0x1f')]['sync'](this,_0x1e0375['sip_id']);if(!_0x4eed89){return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x1e0375,'no\x20user\x20found');}var _0x4909d3=this[_0x70ba('0x10')][_0x70ba('0x58')](_0x70ba('0xdb'),[util['format'](_0x70ba('0xdc'),_0x4eed89),_0x1e0375[_0x70ba('0x66')],_0x1e0375['opts'],_0x1e0375['url']]);if(_0x4909d3[_0x70ba('0x9e')]===-0x1){return _0x4909d3;}return this['channel'][_0x70ba('0xa3')](util[_0x70ba('0x2c')](_0x70ba('0xdd'),'DIAL'));};AGIVertices[_0x70ba('0x15')][_0x70ba('0xde')]=function(_0xed07e2){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0xdf'),_0xed07e2[_0x70ba('0x3a')]));if(!this[_0x70ba('0x81')](_0xed07e2[_0x70ba('0x76')])){return this['channel'][_0x70ba('0xa3')]('no\x20key\x20configured');}if(!this[_0x70ba('0x81')](_0xed07e2['text'])){return this['channel']['noop'](_0x70ba('0xa4'));}this[_0x70ba('0x10')][_0x70ba('0xe0')]=!![];this[_0x70ba('0x38')](_0xed07e2);this[_0x70ba('0x45')](_0xed07e2[_0x70ba('0x5d')],'in','','');this[_0x70ba('0x10')][_0x70ba('0xa3')](util[_0x70ba('0x2c')](_0x70ba('0xe1'),_0xed07e2[_0x70ba('0x5d')]));var _0x401556=this['googleDialogflow'][_0x70ba('0x6d')](this,_0xed07e2);if(_0x401556){for(var _0x1a63b7 in _0x401556){if(_0x401556[_0x70ba('0x90')](_0x1a63b7)){this[_0x70ba('0x10')]['setVariable'](util[_0x70ba('0x2c')](_0x70ba('0xe2'),_0x1a63b7[_0x70ba('0xe3')]()),_0x401556[_0x1a63b7]);}}this['createSquareMessage'](_0x401556[_0x70ba('0xe4')],_0x70ba('0xe5'),_0x70ba('0xde'),'');return this[_0x70ba('0x10')]['noop'](util[_0x70ba('0x2c')]('Dialogflow\x20Result\x20%s',_0x401556[_0x70ba('0xe4')]));}return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0xed07e2,_0x70ba('0xe6'));};AGIVertices['prototype'][_0x70ba('0xe7')]=function(_0x11efa8){logger[_0x70ba('0x30')](util['format'](_0x70ba('0xe8'),_0x11efa8[_0x70ba('0x3a')]));if(!this[_0x70ba('0x81')](_0x11efa8[_0x70ba('0x79')])){return this[_0x70ba('0x10')][_0x70ba('0xa3')](_0x70ba('0xe9'));}if(!this[_0x70ba('0x81')](_0x11efa8[_0x70ba('0xea')])){return this['channel'][_0x70ba('0xa3')]('no\x20client_email\x20configured');}if(!this[_0x70ba('0x81')](_0x11efa8[_0x70ba('0xeb')])){return this[_0x70ba('0x10')][_0x70ba('0xa3')](_0x70ba('0xec'));}if(!this[_0x70ba('0x81')](_0x11efa8[_0x70ba('0x7a')])){return this['channel']['noop'](_0x70ba('0xed'));}if(!this[_0x70ba('0x81')](_0x11efa8[_0x70ba('0x5d')])){return this[_0x70ba('0x10')][_0x70ba('0xa3')]('no\x20text\x20configured');}this[_0x70ba('0x10')]['bot']=!![];this['createSquareDetailsReport'](_0x11efa8);this[_0x70ba('0x45')](_0x11efa8[_0x70ba('0x5d')],'in','','');this['channel'][_0x70ba('0xa3')](util['format'](_0x70ba('0xee'),_0x11efa8[_0x70ba('0x5d')]));var _0x29fd70=this['googleDialogflowV2'][_0x70ba('0x6d')](this,_0x11efa8);if(_0x29fd70){for(var _0x32b3b9 in _0x29fd70){if(_0x29fd70[_0x70ba('0x90')](_0x32b3b9)){if(_0x32b3b9!==_0x70ba('0xef')){this[_0x70ba('0x10')][_0x70ba('0x99')](util['format']('DIALOGFLOW_%s',_0x32b3b9[_0x70ba('0xe3')]()),_0x29fd70[_0x32b3b9]);}}}this[_0x70ba('0x45')](_0x29fd70[_0x70ba('0xe4')],_0x70ba('0xe5'),_0x70ba('0xe7'),_0x29fd70[_0x70ba('0xef')]);return this[_0x70ba('0x10')][_0x70ba('0xa3')](util[_0x70ba('0x2c')]('DialogflowV2\x20Result\x20%s',_0x29fd70[_0x70ba('0xe4')]));}return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x11efa8,_0x70ba('0xf0'));};AGIVertices[_0x70ba('0x15')][_0x70ba('0xf1')]=function(_0x1c0bfa){logger['info'](util[_0x70ba('0x2c')](_0x70ba('0xf2'),_0x1c0bfa[_0x70ba('0x3a')]));if(!this[_0x70ba('0x81')](_0x1c0bfa[_0x70ba('0xf3')])){return this[_0x70ba('0x10')][_0x70ba('0xa3')](_0x70ba('0xf4'));}if(!this[_0x70ba('0x81')](_0x1c0bfa[_0x70ba('0xf5')])){return this['channel']['noop'](_0x70ba('0xf6'));}if(!this[_0x70ba('0x81')](_0x1c0bfa[_0x70ba('0xf7')])){return this[_0x70ba('0x10')][_0x70ba('0xa3')](_0x70ba('0xf8'));}if(!this[_0x70ba('0x81')](_0x1c0bfa['ndassistant_url'])){return this[_0x70ba('0x10')][_0x70ba('0xa3')](_0x70ba('0xa4'));}this[_0x70ba('0x10')][_0x70ba('0xe0')]=!![];this[_0x70ba('0x38')](_0x1c0bfa);this[_0x70ba('0x45')](_0x1c0bfa[_0x70ba('0x5d')],'in','','');this[_0x70ba('0x10')][_0x70ba('0xa3')](util['format']('Trying\x20SestekNDA:\x20%s',_0x1c0bfa[_0x70ba('0x5d')]));var _0x652fe7=this[_0x70ba('0x7b')][_0x70ba('0x6d')](this,_0x1c0bfa);if(_0x652fe7){for(var _0x2b08c9 in _0x652fe7){if(_0x652fe7[_0x70ba('0x90')](_0x2b08c9)){this[_0x70ba('0x10')][_0x70ba('0x99')](util[_0x70ba('0x2c')](_0x70ba('0xf9'),_0x2b08c9['toUpperCase']()),_0x652fe7[_0x2b08c9]);}}this[_0x70ba('0x45')](_0x652fe7[_0x70ba('0xe4')],_0x70ba('0xe5'),_0x70ba('0xf1'),'');if(_0x652fe7['audiofile']){this['channel'][_0x70ba('0xa3')](util['format']('Sestek\x20NDA\x20%s\x20file\x20created',_0x652fe7[_0x70ba('0xfa')]));var _0x1232b9=this['channel']['streamFile'](_0x652fe7[_0x70ba('0xfa')]);try{fs[_0x70ba('0xfb')](_0x652fe7[_0x70ba('0xfa')]+_0x70ba('0xfc'));}catch(_0x8d2d41){logger[_0x70ba('0x2f')](_0x8d2d41);}return _0x1232b9;}else{return this['channel']['noop'](util[_0x70ba('0x2c')](_0x70ba('0xfd'),_0x652fe7['speech']));}}return this['channel'][_0x70ba('0x2f')](_0x1c0bfa,_0x70ba('0xfe'));};AGIVertices['prototype']['end']=function(_0x3f65c3){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0xff'),_0x3f65c3['label']));return this[_0x70ba('0x10')]['noop'](_0x70ba('0x100'));};AGIVertices['prototype'][_0x70ba('0x101')]=function(_0xe2926f){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0xe2926f[_0x70ba('0x3a')]));var _0x48014f='';if(_0xe2926f[_0x70ba('0x102')]){if(!this[_0x70ba('0x81')](_0xe2926f[_0x70ba('0x102')])){return this['channel']['error'](_0xe2926f,'no\x20trunk\x20selected');}else{var _0x7a9fdf=parseInt(_0xe2926f['trunk_id'],0xa);if(isNaN(_0x7a9fdf)){_0x48014f=_0xe2926f[_0x70ba('0x102')];}else{_0x48014f=this[_0x70ba('0x103')][_0x70ba('0x6d')](this,_0xe2926f[_0x70ba('0x102')]);if(!_0x48014f){return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0xe2926f,_0x70ba('0x104'));}}}}else if(_0xe2926f[_0x70ba('0x105')]){_0x48014f=_0xe2926f[_0x70ba('0x105')];}else{return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0xe2926f,_0x70ba('0x106'));}var _0x24ae91=this[_0x70ba('0x10')]['exec'](_0x70ba('0xdb'),[util[_0x70ba('0x2c')](_0x70ba('0x107'),_0x48014f,_0xe2926f[_0x70ba('0x4a')]),_0xe2926f[_0x70ba('0x66')],_0xe2926f[_0x70ba('0x108')],_0xe2926f['url']]);if(_0x24ae91[_0x70ba('0x9e')]===-0x1){return _0x24ae91;}return this[_0x70ba('0x10')]['noop'](util[_0x70ba('0x2c')](_0x70ba('0xdd'),_0x70ba('0xdb')));};AGIVertices[_0x70ba('0x15')][_0x70ba('0x109')]=function(_0x473f0f){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0x10a'),_0x473f0f[_0x70ba('0x3a')]));return this[_0x70ba('0x10')][_0x70ba('0xa3')](_0x70ba('0x109'));};AGIVertices[_0x70ba('0x15')]['getdigits']=function(_0x19459b){logger['info'](util['format'](_0x70ba('0x10b'),_0x19459b['label']));if(_0x19459b[_0x70ba('0xa1')]===0x0){return this[_0x70ba('0xa0')](_0x19459b);}_0x19459b[_0x70ba('0xa1')]-=0x1;if(!this[_0x70ba('0x81')](_0x19459b[_0x70ba('0x10c')])){return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x19459b,_0x70ba('0x10d'));}var _0x2742fe=this[_0x70ba('0x22')][_0x70ba('0x6d')](this,_0x19459b['file_id']);if(!_0x2742fe){return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x19459b,_0x70ba('0x10e'));}if(!this['isConfigured'](_0x19459b[_0x70ba('0xd3')])){return this['channel']['error'](_0x70ba('0x10f'));}var _0x330f9f=this[_0x70ba('0x10')]['getData'](_0x2742fe,_0x19459b[_0x70ba('0x110')],_0x19459b[_0x70ba('0x111')]);var _0x3c0a25=_0x330f9f[_0x70ba('0x9e')]?_0x330f9f['result'][_0x70ba('0x112')]():'';logger[_0x70ba('0x30')](_0x70ba('0x113'),JSON['stringify'](_0x330f9f));if(_0x330f9f[_0x70ba('0x9e')]===-0x1){this[_0x70ba('0x38')]['sync'](this,_0x19459b,_0x3c0a25);return _0x330f9f;}else if(_0x330f9f[_0x70ba('0x9d')]==='timeout'){_0x330f9f['result']=_0x3c0a25[_0x70ba('0x98')]>=parseInt(_0x19459b['mindigit'])?'x':'i';}else{_0x330f9f[_0x70ba('0x9e')]=_0x3c0a25[_0x70ba('0x98')]>=parseInt(_0x19459b[_0x70ba('0x114')])&&_0x3c0a25[_0x70ba('0x98')]<=parseInt(_0x19459b[_0x70ba('0x111')])?'x':'i';}var _0x46fc83=this['getVariable'][_0x70ba('0x6d')](this,_0x19459b[_0x70ba('0xd3')]);if(!_0x46fc83){return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x19459b,'no\x20variable\x20found');}this[_0x70ba('0x10')][_0x70ba('0x99')](_0x46fc83,_0x3c0a25);if(this['isConfigured'](_0x19459b['hiddendigitsnum'])){var _0x1cecde=parseInt(_0x19459b[_0x70ba('0x115')],0xa);var _0x344d78=rs['generate']({'charset':'*','length':_0x1cecde});var _0x316cdf=_0x3c0a25['length'];if(_0x316cdf>0x0){if(_0x316cdf>_0x1cecde){this[_0x70ba('0x38')][_0x70ba('0x6d')](this,_0x19459b,_0x19459b['hiddendigitspos']===_0x70ba('0x116')?_0x344d78+_0x3c0a25[_0x70ba('0x117')](_0x1cecde):_0x3c0a25['substr'](0x0,_0x316cdf-_0x1cecde)+_0x344d78);}else{this['createSquareDetailsReport']['sync'](this,_0x19459b,rs['generate']({'charset':'*','length':_0x316cdf}));}}else{this[_0x70ba('0x38')][_0x70ba('0x6d')](this,_0x19459b,'');}}else{this[_0x70ba('0x38')]['sync'](this,_0x19459b,_0x3c0a25);}return _0x330f9f;};AGIVertices[_0x70ba('0x15')]['getsecretdigits']=function(_0x34649b){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0x118'),_0x34649b[_0x70ba('0x3a')]));return this['getdigits'](_0x34649b);};AGIVertices[_0x70ba('0x15')]['goal']=function(_0x5567ce){logger['info'](util[_0x70ba('0x2c')](_0x70ba('0x119'),_0x5567ce[_0x70ba('0x3a')]));this['createSquareDetailsReport'][_0x70ba('0x6d')](this,_0x5567ce,_0x5567ce[_0x70ba('0x11a')]);return this[_0x70ba('0x10')][_0x70ba('0xa3')](util[_0x70ba('0x2c')](_0x70ba('0x11b'),_0x5567ce[_0x70ba('0x11a')]));};AGIVertices[_0x70ba('0x15')][_0x70ba('0x11c')]=function(_0x33ef13){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0x11d'),_0x33ef13[_0x70ba('0x3a')]));if(!this[_0x70ba('0x81')](_0x33ef13[_0x70ba('0x84')])||!this['isConfigured'](_0x33ef13[_0x70ba('0x88')])){return this[_0x70ba('0x10')][_0x70ba('0xa3')]('no\x20valid\x20credentials\x20configured');}if(!this[_0x70ba('0x81')](_0x33ef13[_0x70ba('0x5d')])){return this[_0x70ba('0x10')][_0x70ba('0xa3')]('no\x20text\x20configured');}this[_0x70ba('0x10')][_0x70ba('0xa3')](util[_0x70ba('0x2c')](_0x70ba('0x11e'),_0x33ef13[_0x70ba('0x5d')]));var _0x1c47c0=this['awsPolly'][_0x70ba('0x6d')](this,_0x33ef13);if(_0x1c47c0){this[_0x70ba('0x10')]['noop'](util['format']('aws\x20Polly\x20%s\x20file\x20created',_0x1c47c0));var _0xb8eda0=this['channel'][_0x70ba('0x11f')](_0x1c47c0);try{fs['unlink'](_0x1c47c0+'.wav');}catch(_0x2e49be){logger[_0x70ba('0x2f')](_0x2e49be);}return _0xb8eda0;}return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x33ef13,_0x70ba('0x120'));};AGIVertices[_0x70ba('0x15')][_0x70ba('0x121')]=function(_0x3f736a){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0x122'),_0x3f736a[_0x70ba('0x3a')]));if(!this[_0x70ba('0x81')](_0x3f736a[_0x70ba('0x84')])||!this[_0x70ba('0x81')](_0x3f736a[_0x70ba('0x88')])){return this['channel']['noop'](_0x70ba('0x123'));}if(!this['isConfigured'](_0x3f736a[_0x70ba('0x89')])){return this[_0x70ba('0x10')]['noop'](_0x70ba('0x124'));}if(!this[_0x70ba('0x81')](_0x3f736a[_0x70ba('0x5d')])){return this[_0x70ba('0x10')]['noop'](_0x70ba('0xa4'));}this[_0x70ba('0x10')][_0x70ba('0xe0')]=!![];this[_0x70ba('0x38')](_0x3f736a);this['createSquareMessage'](_0x3f736a[_0x70ba('0x5d')],'in','','');this[_0x70ba('0x10')][_0x70ba('0xa3')](util[_0x70ba('0x2c')](_0x70ba('0x125'),_0x3f736a[_0x70ba('0x5d')]));var _0x3637a7=this['awsLex'][_0x70ba('0x6d')](this,_0x3f736a);if(_0x3637a7){for(var _0x4912cb in _0x3637a7){if(_0x3637a7[_0x70ba('0x90')](_0x4912cb)&&_[_0x70ba('0x91')](_0x3637a7[_0x4912cb])){this[_0x70ba('0x10')][_0x70ba('0x99')](util['format']('AWS_LEX_%s',_0x4912cb[_0x70ba('0xe3')]()),_0x3637a7[_0x4912cb]);}}if(_[_0x70ba('0x48')](_0x3637a7[_0x70ba('0x72')])){return this[_0x70ba('0x10')][_0x70ba('0xa3')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0x70ba('0x45')](_0x3637a7[_0x70ba('0x72')],_0x70ba('0xe5'),_0x70ba('0x126'),'');return this[_0x70ba('0x10')]['noop'](util[_0x70ba('0x2c')](_0x70ba('0x127'),_0x3637a7[_0x70ba('0x72')]));}}return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x3f736a,_0x70ba('0x128'));};AGIVertices['prototype'][_0x70ba('0x129')]=function(_0x2be697){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0x12a'),_0x2be697[_0x70ba('0x3a')],_0x2be697[_0x70ba('0x66')]));if(!this[_0x70ba('0x81')](_0x2be697[_0x70ba('0x76')])){return this[_0x70ba('0x10')][_0x70ba('0xa3')](_0x70ba('0x12b'));}var _0x27c559=_0x70ba('0x12c');var _0x5996f8=util[_0x70ba('0x2c')]('%s/recordings/%s',FILES_PATH,rs[_0x70ba('0x12d')](0x4));var _0x1c3dca=util['format']('%s.%s',_0x5996f8,_0x27c559);var _0x5a3c96=!![];if(_0x2be697[_0x70ba('0x12e')]==='NOBEEP'){_0x5a3c96=![];}var _0xea2416=this[_0x70ba('0x10')][_0x70ba('0x12f')](_0x5996f8,_0x27c559,_0x2be697['intKey'],_0x2be697['timeout'],undefined,_0x5a3c96);if(_0xea2416[_0x70ba('0x9e')]!==-0x1){this[_0x70ba('0x10')][_0x70ba('0xa3')](util[_0x70ba('0x2c')](_0x70ba('0x130'),_0x1c3dca));var _0x27a850=this[_0x70ba('0x8a')][_0x70ba('0x6d')](this,_0x2be697,_0x1c3dca);if(_0x27a850){for(var _0x43e2a7 in _0x27a850){if(_0x27a850[_0x70ba('0x90')](_0x43e2a7)){this['channel']['setVariable'](util[_0x70ba('0x2c')](_0x70ba('0x131'),_0x43e2a7[_0x70ba('0xe3')]()),_0x27a850[_0x43e2a7]);}}return this['channel'][_0x70ba('0xa3')](util['format'](_0x70ba('0x132'),JSON[_0x70ba('0x6f')](_0x27a850)));}}return _0xea2416;};AGIVertices['prototype'][_0x70ba('0x133')]=function(_0x255d7e){logger[_0x70ba('0x30')](util['format'](_0x70ba('0x134'),_0x255d7e[_0x70ba('0x3a')]));if(!this[_0x70ba('0x81')](_0x255d7e[_0x70ba('0x135')])){return this[_0x70ba('0x10')]['noop'](_0x70ba('0x136'));}if(!this[_0x70ba('0x81')](_0x255d7e[_0x70ba('0x8c')])){return this['channel'][_0x70ba('0xa3')](_0x70ba('0x137'));}var _0x5a36df='wav';var _0x5b2da3=util[_0x70ba('0x2c')](_0x70ba('0x138'),FILES_PATH,rs[_0x70ba('0x12d')](0x4));var _0x4cbd35=util[_0x70ba('0x2c')]('%s.%s',_0x5b2da3,_0x5a36df);var _0xc333d1=!![];if(_0x255d7e[_0x70ba('0x12e')]===_0x70ba('0x139')){_0xc333d1=![];}var _0x2e2856=this['channel']['recordFile'](_0x5b2da3,_0x5a36df,_0x255d7e[_0x70ba('0x13a')],_0x255d7e[_0x70ba('0x66')],undefined,_0xc333d1);if(_0x2e2856[_0x70ba('0x9e')]!==-0x1){this['channel'][_0x70ba('0xa3')](util[_0x70ba('0x2c')](_0x70ba('0x13b'),_0x4cbd35));var _0x34589c=this['tildeASR'][_0x70ba('0x6d')](this,_0x255d7e,_0x4cbd35);if(_0x34589c){for(var _0x44d4e6 in _0x34589c){if(_0x34589c[_0x70ba('0x90')](_0x44d4e6)){this[_0x70ba('0x10')][_0x70ba('0x99')](util[_0x70ba('0x2c')](_0x70ba('0x13c'),_0x44d4e6[_0x70ba('0xe3')]()),_0x34589c[_0x44d4e6]);}}return this[_0x70ba('0x10')]['noop'](util[_0x70ba('0x2c')](_0x70ba('0x13d'),JSON[_0x70ba('0x6f')](_0x34589c)));}}return _0x2e2856;};AGIVertices[_0x70ba('0x15')][_0x70ba('0x13e')]=function(_0x15461f){logger[_0x70ba('0x30')](util['format'](_0x70ba('0x13f'),_0x15461f[_0x70ba('0x3a')]));return this['channel'][_0x70ba('0x140')](_0x15461f[_0x70ba('0x40')],_0x15461f[_0x70ba('0x41')],_0x15461f[_0x70ba('0x141')]);};AGIVertices[_0x70ba('0x15')]['gotoif']=function(_0x3d39a9){logger['info'](util[_0x70ba('0x2c')](_0x70ba('0x142'),_0x3d39a9[_0x70ba('0x3a')]));if(!this[_0x70ba('0x81')](_0x3d39a9[_0x70ba('0x143')])){return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x3d39a9,_0x70ba('0x144'));}try{var _0x36a943=eval(_0x3d39a9[_0x70ba('0x143')])?_0x70ba('0x145'):'false';this['channel'][_0x70ba('0xa3')](util['format'](_0x70ba('0x146'),_0x3d39a9[_0x70ba('0x143')],_0x36a943));return{'code':0xc8,'result':_0x36a943};}catch(_0x124177){return{'code':0xc8,'result':_0x70ba('0x147')};}};AGIVertices[_0x70ba('0x15')]['gotoiftime']=function(_0x4e46e3){logger['info'](util[_0x70ba('0x2c')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x4e46e3[_0x70ba('0x3a')]));if(!this['isConfigured'](_0x4e46e3['interval_id'])){return this[_0x70ba('0x10')]['error'](_0x4e46e3,_0x70ba('0x148'));}var _0x183749=this[_0x70ba('0x28')][_0x70ba('0x6d')](this,_0x4e46e3[_0x70ba('0x149')]);if(!_0x183749){return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x4e46e3,_0x70ba('0x14a'));}for(var _0x228aa5=0x0;_0x228aa5<_0x183749['length'];_0x228aa5+=0x1){var _0x291d2d=this[_0x70ba('0x10')]['getVariable'](util[_0x70ba('0x2c')]('IFTIME(%s?true:false)',_0x183749[_0x228aa5]));if(_0x291d2d[_0x70ba('0x9e')]===-0x1){return _0x291d2d;}logger['info'](util[_0x70ba('0x2c')]('IFTIME\x20%s\x20%s',_0x183749[_0x228aa5],_0x291d2d['extra']));if(_0x291d2d['extra']===_0x70ba('0x145')){logger['info'](util[_0x70ba('0x2c')](_0x70ba('0x14b'),_0x183749[_0x228aa5],_0x70ba('0x145')));this[_0x70ba('0x10')]['noop'](util[_0x70ba('0x2c')](_0x70ba('0x14b'),_0x183749[_0x228aa5],'true'));return{'code':0xc8,'result':_0x70ba('0x145')};}else{logger['info'](util[_0x70ba('0x2c')](_0x70ba('0x14b'),_0x183749[_0x228aa5],_0x70ba('0x147')));this[_0x70ba('0x10')][_0x70ba('0xa3')](util['format']('IFTIME\x20%s\x20%s',_0x183749[_0x228aa5],_0x70ba('0x147')));}}return{'code':0xc8,'result':_0x70ba('0x147')};};AGIVertices[_0x70ba('0x15')]['hangup']=function(_0x5b86b0){logger['info'](util[_0x70ba('0x2c')](_0x70ba('0x14c'),_0x5b86b0[_0x70ba('0x3a')]));return this['channel']['hangup']();};AGIVertices[_0x70ba('0x15')][_0x70ba('0x14d')]=function(_0xf966b8){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0x14e'),_0xf966b8[_0x70ba('0x3a')]));if(!this[_0x70ba('0x81')](_0xf966b8[_0x70ba('0x76')])){return this['channel'][_0x70ba('0xa3')](_0x70ba('0x12b'));}var _0x14a6ec=_0x70ba('0x12c');var _0x54b253=util[_0x70ba('0x2c')](_0x70ba('0x138'),FILES_PATH,rs['generate'](0x4));var _0x148c21=util['format'](_0x70ba('0x97'),_0x54b253,_0x14a6ec);var _0x3d1cf0=!![];if(_0xf966b8[_0x70ba('0x12e')]===_0x70ba('0x139')){_0x3d1cf0=![];}var _0x2a590a=this['channel'][_0x70ba('0x12f')](_0x54b253,_0x14a6ec,_0xf966b8['intKey'],_0xf966b8['timeout'],undefined,_0x3d1cf0);if(_0x2a590a[_0x70ba('0x9e')]!==-0x1){this[_0x70ba('0x10')][_0x70ba('0xa3')](util['format']('ispeech\x20%s\x20file\x20created',_0x148c21));var _0x3cf5a7=this['ispeechASR'][_0x70ba('0x6d')](this,_0xf966b8,_0x148c21);if(_0x3cf5a7){for(var _0x37b72b in _0x3cf5a7){if(_0x3cf5a7[_0x70ba('0x90')](_0x37b72b)){this[_0x70ba('0x10')][_0x70ba('0x99')](util[_0x70ba('0x2c')]('ISPEECH_ASR_%s',_0x37b72b[_0x70ba('0xe3')]()),_0x3cf5a7[_0x37b72b]);}}return this[_0x70ba('0x10')][_0x70ba('0xa3')](util[_0x70ba('0x2c')](_0x70ba('0x14f'),JSON[_0x70ba('0x6f')](_0x3cf5a7)));}}return _0x2a590a;};AGIVertices['prototype']['ispeechtts']=function(_0x36afbb){logger['info'](util[_0x70ba('0x2c')](_0x70ba('0x150'),_0x36afbb[_0x70ba('0x3a')]));if(!this[_0x70ba('0x81')](_0x36afbb[_0x70ba('0x76')])){return this['channel']['noop'](_0x70ba('0x12b'));}if(!this['isConfigured'](_0x36afbb[_0x70ba('0x5d')])){return this[_0x70ba('0x10')][_0x70ba('0xa3')]('no\x20text\x20configured');}this[_0x70ba('0x10')][_0x70ba('0xa3')](util[_0x70ba('0x2c')](_0x70ba('0x151'),_0x36afbb[_0x70ba('0x5d')]));var _0x49293b=this[_0x70ba('0x7c')][_0x70ba('0x6d')](this,_0x36afbb);if(_0x49293b){this[_0x70ba('0x10')]['noop'](util[_0x70ba('0x2c')]('ispeech\x20%s\x20file\x20created',_0x49293b));var _0x3e6d49=this[_0x70ba('0x10')][_0x70ba('0x11f')](_0x49293b,_0x36afbb['intKey']);try{fs[_0x70ba('0xfb')](_0x49293b+_0x70ba('0xfc'));}catch(_0x43a5ec){logger[_0x70ba('0x2f')](_0x43a5ec);}return _0x3e6d49;}return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x36afbb,_0x70ba('0x152'));};AGIVertices['prototype'][_0x70ba('0x153')]=function(_0xf4c0f){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0xf4c0f[_0x70ba('0x3a')]));if(!this[_0x70ba('0x81')](_0xf4c0f[_0x70ba('0x154')])){return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0xf4c0f,_0x70ba('0x155'));}logger['info'](util['format'](_0x70ba('0x156'),this[_0x70ba('0x10')][_0x70ba('0x3d')],_0xf4c0f[_0x70ba('0x154')]));var _0x34832e=this[_0x70ba('0x56')]['sync'](this,_0xf4c0f[_0x70ba('0x154')]);if(_0x34832e){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x70ba('0x10')][_0x70ba('0x3d')],_0xf4c0f[_0x70ba('0x154')]));this[_0x70ba('0x10')]['noop'](util[_0x70ba('0x2c')](_0x70ba('0x157'),this[_0x70ba('0x10')][_0x70ba('0x3d')],_0xf4c0f[_0x70ba('0x154')]));return{'code':0xc8,'result':_0x70ba('0x158')};}else{logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0x159'),this[_0x70ba('0x10')][_0x70ba('0x3d')],_0xf4c0f[_0x70ba('0x154')]));this[_0x70ba('0x10')]['noop'](util[_0x70ba('0x2c')](_0x70ba('0x159'),this[_0x70ba('0x10')][_0x70ba('0x3d')],_0xf4c0f[_0x70ba('0x154')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x70ba('0x15')][_0x70ba('0x15a')]=function(_0x11d626){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0x15b'),_0x11d626[_0x70ba('0x3a')]));if(!this[_0x70ba('0x81')](_0x11d626[_0x70ba('0x154')])){return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x11d626,_0x70ba('0x155'));}logger[_0x70ba('0x30')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x70ba('0x10')][_0x70ba('0x3d')],_0x11d626[_0x70ba('0x154')]));var _0x481ba6=this[_0x70ba('0x15c')][_0x70ba('0x6d')](this,_0x11d626[_0x70ba('0x154')]);if(_0x481ba6){logger[_0x70ba('0x30')](util['format'](_0x70ba('0x157'),this[_0x70ba('0x10')]['callerid'],_0x11d626[_0x70ba('0x154')]));this[_0x70ba('0x10')][_0x70ba('0xa3')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x70ba('0x10')][_0x70ba('0x3d')],_0x11d626[_0x70ba('0x154')]));return{'code':0xc8,'result':_0x70ba('0x158')};}else{logger['info'](util[_0x70ba('0x2c')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x70ba('0x10')][_0x70ba('0x3d')],_0x11d626[_0x70ba('0x154')]));this['channel'][_0x70ba('0xa3')](util['format'](_0x70ba('0x159'),this[_0x70ba('0x10')][_0x70ba('0x3d')],_0x11d626['findBy']));return{'code':0xc8,'result':_0x70ba('0x15d')};}};AGIVertices[_0x70ba('0x15')][_0x70ba('0x15e')]=function(_0x551a95){logger['info'](util[_0x70ba('0x2c')](_0x70ba('0x15f'),_0x551a95[_0x70ba('0x3a')]));if(!this['isConfigured'](_0x551a95[_0x70ba('0x160')])){return this[_0x70ba('0x10')]['error'](_0x551a95,_0x70ba('0x161'));}this[_0x70ba('0x10')][_0x70ba('0xa3')](util[_0x70ba('0x2c')](_0x70ba('0x162'),_0x551a95[_0x70ba('0x160')]));var _0x40a429=eval(_0x551a95[_0x70ba('0x160')]);if(!this[_0x70ba('0x81')](_0x551a95['variable_id'])){return this[_0x70ba('0x10')][_0x70ba('0xa3')](_0x70ba('0x10f'));}var _0x5a7bb7=this[_0x70ba('0x12')][_0x70ba('0x6d')](this,_0x551a95[_0x70ba('0xd3')]);if(!_0x5a7bb7){return this['channel'][_0x70ba('0x2f')](_0x551a95,'no\x20variable\x20found');}if(_['isArray'](_0x40a429)){var _0x58f5d7=this;_0x40a429[_0x70ba('0xd5')](function(_0x223c10,_0x4bab7f){_0x58f5d7[_0x70ba('0x10')]['setVariable'](util['format'](_0x70ba('0x163'),_0x5a7bb7,_0x4bab7f),_0x223c10);});return this['channel'][_0x70ba('0xa3')](util[_0x70ba('0x2c')](_0x70ba('0x164'),_0x5a7bb7));}else{return this[_0x70ba('0x10')]['setVariable'](_0x5a7bb7,_0x40a429);}};AGIVertices[_0x70ba('0x15')][_0x70ba('0xd')]=function(_0x247767){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x247767[_0x70ba('0x3a')]));if(_0x247767['retry']===0x0){return this[_0x70ba('0xa0')](_0x247767);}_0x247767[_0x70ba('0xa1')]-=0x1;if(!this[_0x70ba('0x81')](_0x247767[_0x70ba('0x10c')])){return this[_0x70ba('0x10')]['error'](_0x247767,_0x70ba('0x10d'));}var _0x19e17f=this[_0x70ba('0x22')][_0x70ba('0x6d')](this,_0x247767[_0x70ba('0x10c')]);if(!_0x19e17f){return this['channel'][_0x70ba('0x2f')](_0x247767,_0x70ba('0x10e'));}var _0x1932a4=this[_0x70ba('0x10')][_0x70ba('0x165')](_0x19e17f,_0x247767['response'],_0x247767['digit']);var _0x2cae5f=_0x1932a4[_0x70ba('0x9e')];if(_0x1932a4['result']===-0x1){this[_0x70ba('0x38')][_0x70ba('0x6d')](this,_0x247767,'-1');return _0x1932a4;}else if(_0x1932a4[_0x70ba('0x9d')]===_0x70ba('0x66')){_0x1932a4[_0x70ba('0x9e')]=_0x1932a4[_0x70ba('0x9e')]['length']>0x0?_0x1932a4[_0x70ba('0x9e')]:'t';}else if(_[_0x70ba('0x47')](_0x1932a4['result'])){_0x1932a4['result']='#';_0x2cae5f='#';}if(!this[_0x70ba('0x81')](_0x247767['variable_id'])){this['channel'][_0x70ba('0xa3')](_0x70ba('0x10f'));}else{var _0x45b259=this[_0x70ba('0x12')][_0x70ba('0x6d')](this,_0x247767[_0x70ba('0xd3')]);if(!_0x45b259){return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x247767,'no\x20variable\x20found');}this[_0x70ba('0x10')][_0x70ba('0x99')](_0x45b259,_0x2cae5f);}this[_0x70ba('0x38')][_0x70ba('0x6d')](this,_0x247767,_0x2cae5f);return _0x1932a4;};AGIVertices[_0x70ba('0x15')]['noop']=function(_0x3600ff){logger[_0x70ba('0x30')](util['format'](_0x70ba('0x166'),_0x3600ff[_0x70ba('0x3a')]));return this[_0x70ba('0x10')][_0x70ba('0xa3')](_0x3600ff[_0x70ba('0x167')]||_0x3600ff[_0x70ba('0x3a')]);};AGIVertices[_0x70ba('0x15')][_0x70ba('0x168')]=function(_0x249a43){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0x169'),_0x249a43['label']));if(!this[_0x70ba('0x81')](_0x249a43['findBy'])){return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x249a43,_0x70ba('0x155'));}logger['info'](util[_0x70ba('0x2c')](_0x70ba('0x156'),this[_0x70ba('0x10')][_0x70ba('0x3d')],_0x249a43[_0x70ba('0x154')]));var _0x5b7268=this[_0x70ba('0x16a')][_0x70ba('0x6d')](this,_0x249a43[_0x70ba('0x16b')]);var _0x204f52=this[_0x70ba('0x50')]['sync'](this,_0x249a43[_0x70ba('0x154')],_0x5b7268);if(_0x204f52){logger['info'](util[_0x70ba('0x2c')](_0x70ba('0x157'),this[_0x70ba('0x10')][_0x70ba('0x3d')],_0x249a43[_0x70ba('0x154')]));this[_0x70ba('0x10')][_0x70ba('0xa3')](util[_0x70ba('0x2c')](_0x70ba('0x157'),this[_0x70ba('0x10')][_0x70ba('0x3d')],_0x249a43[_0x70ba('0x154')]));return{'code':0xc8,'result':'success'};}else{logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0x159'),this[_0x70ba('0x10')]['callerid'],_0x249a43[_0x70ba('0x154')]));this['channel'][_0x70ba('0xa3')](util[_0x70ba('0x2c')](_0x70ba('0x157'),this[_0x70ba('0x10')][_0x70ba('0x3d')],_0x249a43[_0x70ba('0x154')]));return{'code':0xc8,'result':_0x70ba('0x15d')};}};AGIVertices['prototype'][_0x70ba('0x16c')]=function(_0x48135d){logger['info'](util[_0x70ba('0x2c')](_0x70ba('0x16d'),_0x48135d[_0x70ba('0x3a')]));if(!this['isConfigured'](_0x48135d[_0x70ba('0x10c')])){return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x48135d,_0x70ba('0x10d'));}var _0x111c22=this[_0x70ba('0x22')][_0x70ba('0x6d')](this,_0x48135d[_0x70ba('0x10c')]);if(!_0x111c22){return this[_0x70ba('0x10')]['error'](_0x48135d,'no\x20file\x20audio\x20found');}var _0x4101f7=this[_0x70ba('0x10')][_0x70ba('0x58')](_0x70ba('0x16e'),[_0x111c22,_0x48135d[_0x70ba('0x108')]]);if(_0x4101f7[_0x70ba('0x9e')]===-0x1){return _0x4101f7;}return this[_0x70ba('0x10')][_0x70ba('0xa3')](util[_0x70ba('0x2c')]('Executed\x20command\x20%s\x20%s','PLAYBACK',_0x111c22));};AGIVertices[_0x70ba('0x15')][_0x70ba('0x16f')]=function(_0x4ff4d6){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x4ff4d6[_0x70ba('0x3a')]));if(!this['isConfigured'](_0x4ff4d6[_0x70ba('0x170')])){return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x4ff4d6,_0x70ba('0x171'));}var _0xd51ae3='';var _0x1617a4=parseInt(_0x4ff4d6[_0x70ba('0x170')],0xa);if(isNaN(_0x1617a4)){_0xd51ae3=_0x4ff4d6[_0x70ba('0x170')];}else{_0xd51ae3=this[_0x70ba('0x16')]['sync'](this,_0x4ff4d6['queue_id']);if(!_0xd51ae3){return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x4ff4d6,'no\x20queue\x20found');}}var _0x1b9173='';if(this[_0x70ba('0x81')](_0x4ff4d6[_0x70ba('0x10c')])){var _0x4fa5ca=this[_0x70ba('0x22')][_0x70ba('0x6d')](this,_0x4ff4d6[_0x70ba('0x10c')]);if(_0x4fa5ca){_0x1b9173=_0x4fa5ca;}}this[_0x70ba('0x38')][_0x70ba('0x6d')](this,_0x4ff4d6,_0xd51ae3);if(_0x4ff4d6[_0x70ba('0x108')][_0x70ba('0x172')]('x')<0x0){_0x4ff4d6[_0x70ba('0x108')]+='x';}if(_0x4ff4d6[_0x70ba('0x108')][_0x70ba('0x172')]('X')<0x0){_0x4ff4d6[_0x70ba('0x108')]+='X';}this[_0x70ba('0x10')]['setVariable'](_0x70ba('0x173'),_0xd51ae3?_0xd51ae3['toLowerCase']():'');var _0x24101b=this['channel'][_0x70ba('0x58')]('QUEUE',[_0xd51ae3,_0x4ff4d6[_0x70ba('0x108')],_0x4ff4d6[_0x70ba('0x174')],_0x1b9173,_0x4ff4d6[_0x70ba('0x66')],_0x4ff4d6[_0x70ba('0x7')],_0x4ff4d6[_0x70ba('0x175')],_0x4ff4d6[_0x70ba('0x176')],'',_0x4ff4d6['position']]);if(_0x24101b[_0x70ba('0x9e')]===-0x1){return _0x24101b;}return this[_0x70ba('0x10')]['noop'](util[_0x70ba('0x2c')](_0x70ba('0xc0'),_0x70ba('0x177'),_0xd51ae3));};AGIVertices[_0x70ba('0x15')][_0x70ba('0x178')]=function(_0x3e5a68){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x3e5a68[_0x70ba('0x3a')]));var _0x3e4e26=_0x3e5a68[_0x70ba('0x179')]||_0x70ba('0x12c');var _0x3f239d=util['format']('%s_%s',this['channel']['uniqueid'],rs[_0x70ba('0x12d')](0x5));var _0xdc0f1b=util[_0x70ba('0x2c')](_0x70ba('0x17a'),FILES_PATH,_0x3f239d,_0x3e4e26);var _0x5171fd=util[_0x70ba('0x2c')]('%s/recordings/%s',FILES_PATH,_0x3f239d);this[_0x70ba('0x3e')][_0x70ba('0x6d')](this,_0x3e5a68,_0x3f239d,_0xdc0f1b);this[_0x70ba('0x10')][_0x70ba('0x99')]('RECORDING_SAVENAME',_0x3f239d);logger[_0x70ba('0x30')](_0x70ba('0x17b'),_0x5171fd,_0x3e4e26,_0x3e5a68['escape_digits'],_0x3e5a68['timeout']);return this[_0x70ba('0x10')][_0x70ba('0x12f')](_0x5171fd,_0x3e4e26,_0x3e5a68[_0x70ba('0x17c')],_0x3e5a68[_0x70ba('0x66')],undefined,!![]);};AGIVertices[_0x70ba('0x15')]['restapi']=function(_0x5eb281){logger[_0x70ba('0x30')](util['format'](_0x70ba('0x17d'),_0x5eb281[_0x70ba('0x3a')]));if(!this['isConfigured'](_0x5eb281[_0x70ba('0x174')])){return this['channel'][_0x70ba('0xa3')](_0x70ba('0x17e'));}var _0x1f3ce8=this['restAPI'][_0x70ba('0x6d')](this,_0x5eb281);logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0x17f'),util[_0x70ba('0x180')](_0x1f3ce8,{'showHidden':![],'depth':null})));if(!this[_0x70ba('0x81')](_0x5eb281['variable_id'])){return this[_0x70ba('0x10')][_0x70ba('0xa3')](_0x70ba('0x181'));}var _0x4fda0a=this[_0x70ba('0x12')]['sync'](this,_0x5eb281[_0x70ba('0xd3')]);if(!_0x4fda0a){return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x5eb281,_0x70ba('0xd4'));}this[_0x70ba('0x10')][_0x70ba('0x99')](util['format'](_0x70ba('0x182'),_0x4fda0a),_0x1f3ce8[_0x70ba('0x183')]?_0x1f3ce8[_0x70ba('0x183')]:_0x70ba('0x184'));this[_0x70ba('0x10')][_0x70ba('0x99')](util[_0x70ba('0x2c')]('%s_STATUS_MESSAGE',_0x4fda0a),_0x1f3ce8[_0x70ba('0x71')]?_0x1f3ce8[_0x70ba('0x71')]:'OK');if(_0x1f3ce8[_0x70ba('0x69')]){try{this[_0x70ba('0x96')](_0x1f3ce8[_0x70ba('0x69')],_0x4fda0a);}catch(_0x2434fd){logger['error'](util[_0x70ba('0x2c')](_0x70ba('0x185'),_0x4fda0a));}}return this[_0x70ba('0x10')][_0x70ba('0xa3')](util[_0x70ba('0x2c')](_0x70ba('0x186'),_0x4fda0a));};AGIVertices[_0x70ba('0x15')][_0x70ba('0x187')]=function(_0x16b083){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0x188'),_0x16b083['label']));return this[_0x70ba('0x10')][_0x70ba('0x189')](_0x16b083[_0x70ba('0x18a')][_0x70ba('0x5a')](/\s+/g,''),_0x16b083[_0x70ba('0x17c')]);};AGIVertices['prototype'][_0x70ba('0x18b')]=function(_0x14e8f6){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0x18c'),_0x14e8f6['label']));return this['channel'][_0x70ba('0x18d')](_0x14e8f6[_0x70ba('0x67')][_0x70ba('0x5a')](/\s+/g,''),_0x14e8f6['escape_digits']);};AGIVertices['prototype']['sayphonetic']=function(_0x486e9f){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0x18e'),_0x486e9f[_0x70ba('0x3a')]));return this['channel'][_0x70ba('0x18f')](_0x486e9f[_0x70ba('0x5d')],_0x486e9f[_0x70ba('0x17c')]);};AGIVertices[_0x70ba('0x15')][_0x70ba('0x190')]=function(_0x1dc3c0){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x1dc3c0[_0x70ba('0x3a')]));if(!this[_0x70ba('0x81')](_0x1dc3c0[_0x70ba('0x191')])){return this[_0x70ba('0x10')][_0x70ba('0xa3')](_0x70ba('0x192'));}var _0x293b23=this[_0x70ba('0x25')][_0x70ba('0x6d')](this,_0x1dc3c0['account_id']);if(!_0x293b23||!_0x293b23['Smtp']){return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x1dc3c0,_0x70ba('0x193'));}var _0x29fbff={'from':util[_0x70ba('0x2c')](_0x70ba('0x194'),_0x293b23['name'],_0x293b23[_0x70ba('0x195')]||_0x293b23[_0x70ba('0x196')][_0x70ba('0x197')]),'to':_0x1dc3c0['to']||'','cc':_0x1dc3c0['cc']||'','bcc':_0x1dc3c0['bcc']||'','subject':_0x1dc3c0[_0x70ba('0x198')],'html':_0x1dc3c0[_0x70ba('0x5d')],'text':_0x1dc3c0[_0x70ba('0x5d')]};if(this[_0x70ba('0x81')](_0x1dc3c0[_0x70ba('0x199')])){}logger[_0x70ba('0x19a')](_0x70ba('0x19b'),JSON['stringify'](_0x29fbff));this[_0x70ba('0x38')][_0x70ba('0x6d')](this,_0x1dc3c0,_0x1dc3c0['account_id']);this[_0x70ba('0x10')][_0x70ba('0xa3')](util['format'](_0x70ba('0x19c'),_0x293b23[_0x70ba('0x19')]));this[_0x70ba('0x27')][_0x70ba('0x6d')](this,_0x293b23[_0x70ba('0x19d')],_0x29fbff);return this[_0x70ba('0x10')][_0x70ba('0xa3')](_0x70ba('0x19e'));};AGIVertices[_0x70ba('0x15')][_0x70ba('0x19f')]=function(_0x4fe497){logger[_0x70ba('0x30')](util['format'](_0x70ba('0x1a0'),_0x4fe497[_0x70ba('0x3a')]));return this[_0x70ba('0x10')][_0x70ba('0xa3')](_0x70ba('0x1a1'));};AGIVertices['prototype'][_0x70ba('0x1a2')]=function(_0x175bf6){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x175bf6[_0x70ba('0x3a')]));if(!this[_0x70ba('0x81')](_0x175bf6['sms_account_id'])){return this[_0x70ba('0x10')][_0x70ba('0xa3')]('no\x20sms\x20account\x20configured');}var _0xff896a=this[_0x70ba('0x1a3')][_0x70ba('0x6d')](this,_0x175bf6['sms_account_id']);if(!_0xff896a){return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x175bf6,_0x70ba('0x1a4'));}var _0x52fd64={'body':_0x175bf6[_0x70ba('0x1a5')],'phone':_0x175bf6['to']||'','SmsAccountId':_0xff896a['id']};logger[_0x70ba('0x19a')]('sendSMS\x20message',JSON[_0x70ba('0x6f')](_0x52fd64));this[_0x70ba('0x38')][_0x70ba('0x6d')](this,_0x175bf6,_0x175bf6[_0x70ba('0x1a6')]);this[_0x70ba('0x10')][_0x70ba('0xa3')](util['format'](_0x70ba('0x1a7'),_0xff896a[_0x70ba('0x19')]));this[_0x70ba('0x37')][_0x70ba('0x6d')](this,_0x52fd64);return this['channel']['noop'](_0x70ba('0x1a8'));};AGIVertices[_0x70ba('0x15')][_0x70ba('0x1a9')]=function(_0x4c97fc){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0x1aa'),_0x4c97fc[_0x70ba('0x3a')]));if(!this[_0x70ba('0x81')](_0x4c97fc[_0x70ba('0xd3')])){return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x4c97fc,_0x70ba('0x1ab'));}var _0x2f2c95=this['getVariable'][_0x70ba('0x6d')](this,_0x4c97fc[_0x70ba('0xd3')]);if(!_0x2f2c95){return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x4c97fc,_0x70ba('0xd4'));}return this[_0x70ba('0x10')][_0x70ba('0x99')](_0x2f2c95,_0x4c97fc[_0x70ba('0x1ac')]);};AGIVertices[_0x70ba('0x15')]['start']=function(_0xea2390){logger[_0x70ba('0x30')](util['format'](_0x70ba('0x1ad'),_0xea2390[_0x70ba('0x3a')]));this[_0x70ba('0x10')]['noop'](_0x70ba('0x1ae'));var _0x5ae974=this[_0x70ba('0x10')][_0x70ba('0x12')](_0x70ba('0x1af'));if(!_['isEmpty'](_0x5ae974['extra'])){this[_0x70ba('0x10')][_0x70ba('0x39')]=_0x5ae974[_0x70ba('0x9d')];}if(_0xea2390['answer']==='yes'){this[_0x70ba('0x10')]['noop'](_0x70ba('0x1b0'));return this[_0x70ba('0x10')][_0x70ba('0xb5')]();}return this[_0x70ba('0x10')][_0x70ba('0xa3')](_0x70ba('0x1b1'));};AGIVertices[_0x70ba('0x15')][_0x70ba('0x1b2')]=function(_0xbf1224){logger['info'](util[_0x70ba('0x2c')](_0x70ba('0x1b3'),_0xbf1224[_0x70ba('0x3a')]));if(!this[_0x70ba('0x81')](_0xbf1224[_0x70ba('0x1b4')])){return this[_0x70ba('0x10')]['error'](_0xbf1224,_0x70ba('0x1b5'));}var _0x1a6410=this[_0x70ba('0x1a')][_0x70ba('0x6d')](this,_0xbf1224[_0x70ba('0x1b4')]);if(!this[_0x70ba('0x81')](_0x1a6410)){return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0xbf1224,util[_0x70ba('0x2c')](_0x70ba('0x1b6'),_0xbf1224[_0x70ba('0x1b4')]));}if(_0x1a6410===this[_0x70ba('0x10')][_0x70ba('0x3c')]){return this['channel']['error'](_0xbf1224,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this['createSquareDetailsReport'][_0x70ba('0x6d')](this,_0xbf1224,_0x1a6410);var _0x5a41e1=this[_0x70ba('0x10')][_0x70ba('0x58')](_0x70ba('0x1b7'),util[_0x70ba('0x2c')](_0x70ba('0x1b8'),config['agi'][_0x70ba('0x1b9')]||_0x70ba('0x1ba'),_0x1a6410,this[_0x70ba('0x10')]['arg_1']));if(_0x5a41e1['result']===-0x1){return _0x5a41e1;}return this[_0x70ba('0x10')]['noop'](util[_0x70ba('0x2c')](_0x70ba('0xc0'),'AGI',_0x1a6410));};AGIVertices['prototype'][_0x70ba('0x1bb')]=function(_0x53dcf7){logger['info'](util[_0x70ba('0x2c')](_0x70ba('0x1bc'),_0x53dcf7[_0x70ba('0x3a')]));var _0x5c7ca8=this[_0x70ba('0x57')][_0x70ba('0x6d')](this,_0x53dcf7['command']);this[_0x70ba('0x38')][_0x70ba('0x6d')](this,_0x53dcf7,_0x53dcf7[_0x70ba('0x1bd')]);if(this[_0x70ba('0x81')](_0x53dcf7[_0x70ba('0xd3')])){var _0x53647d=this[_0x70ba('0x12')]['sync'](this,_0x53dcf7['variable_id']);if(_0x53647d){this['channel'][_0x70ba('0x99')](_0x53647d,_0x5c7ca8);return this['channel'][_0x70ba('0xa3')](util[_0x70ba('0x2c')](_0x70ba('0x1be'),_0x53dcf7[_0x70ba('0x1bd')],_0x53647d));}}return this[_0x70ba('0x10')][_0x70ba('0xa3')](util[_0x70ba('0x2c')](_0x70ba('0x1bf'),_0x53dcf7[_0x70ba('0x1bd')]));};AGIVertices[_0x70ba('0x15')][_0x70ba('0x1c0')]=function(_0x4936a3){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0x1c1'),_0x4936a3[_0x70ba('0x3a')]));_0x4936a3['text']=_0x4936a3[_0x70ba('0x5d')][_0x70ba('0x5a')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x70ba('0x81')](_0x4936a3[_0x70ba('0x5c')])){return this[_0x70ba('0x10')]['noop'](_0x70ba('0x1c2'));}if(!this['isConfigured'](_0x4936a3[_0x70ba('0x5d')])){return this[_0x70ba('0x10')]['noop'](_0x70ba('0xa4'));}this[_0x70ba('0x10')]['noop'](util[_0x70ba('0x2c')](_0x70ba('0x1c3'),_0x4936a3[_0x70ba('0x5d')]));var _0x8b1cbe=this[_0x70ba('0x5b')][_0x70ba('0x6d')](this,_0x4936a3);if(_0x8b1cbe){this[_0x70ba('0x10')][_0x70ba('0xa3')](util['format']('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x8b1cbe));var _0x38fa5f=this[_0x70ba('0x10')]['streamFile'](_0x8b1cbe);try{fs[_0x70ba('0xfb')](_0x8b1cbe+_0x70ba('0xfc'));}catch(_0x1af05e){logger[_0x70ba('0x2f')](_0x1af05e);}return _0x38fa5f;}return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x4936a3,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0x70ba('0x15')][_0x70ba('0x1c4')]=function(_0x1dbdca){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0x1c5'),_0x1dbdca['label']));_0x1dbdca[_0x70ba('0x5d')]=_0x1dbdca[_0x70ba('0x5d')][_0x70ba('0x5a')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x1dbdca[_0x70ba('0x5d')])){return this[_0x70ba('0x10')][_0x70ba('0xa3')](_0x70ba('0xa4'));}this[_0x70ba('0x10')][_0x70ba('0xa3')](util[_0x70ba('0x2c')](_0x70ba('0x1c6'),_0x1dbdca[_0x70ba('0x5d')]));var _0x4306e0=this[_0x70ba('0x63')][_0x70ba('0x6d')](this,_0x1dbdca);if(_0x4306e0){this['channel'][_0x70ba('0xa3')](util[_0x70ba('0x2c')](_0x70ba('0x1c7'),_0x4306e0));var _0x1d31ce=this['channel']['streamFile'](_0x4306e0);try{fs[_0x70ba('0xfb')](_0x4306e0+'.wav');}catch(_0x4a4436){logger[_0x70ba('0x2f')](_0x4a4436);}return _0x1d31ce;}return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x1dbdca,_0x70ba('0x1c8'));};AGIVertices[_0x70ba('0x15')]['unpause']=function(_0x3cc12a){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x3cc12a[_0x70ba('0x3a')]));if(!this[_0x70ba('0x81')](_0x3cc12a[_0x70ba('0x154')])){return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x3cc12a,_0x70ba('0x155'));}logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0x156'),this[_0x70ba('0x10')]['callerid'],_0x3cc12a[_0x70ba('0x154')]));var _0x57ae81=this[_0x70ba('0x51')][_0x70ba('0x6d')](this,_0x3cc12a[_0x70ba('0x154')]);if(_0x57ae81){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0x157'),this[_0x70ba('0x10')]['callerid'],_0x3cc12a[_0x70ba('0x154')]));this[_0x70ba('0x10')][_0x70ba('0xa3')](util[_0x70ba('0x2c')](_0x70ba('0x157'),this[_0x70ba('0x10')][_0x70ba('0x3d')],_0x3cc12a[_0x70ba('0x154')]));return{'code':0xc8,'result':_0x70ba('0x158')};}else{logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0x159'),this[_0x70ba('0x10')][_0x70ba('0x3d')],_0x3cc12a[_0x70ba('0x154')]));this['channel'][_0x70ba('0xa3')](util[_0x70ba('0x2c')](_0x70ba('0x159'),this[_0x70ba('0x10')][_0x70ba('0x3d')],_0x3cc12a[_0x70ba('0x154')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x70ba('0x15')]['voicemail']=function(_0x11ab41){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0x1c9'),_0x11ab41[_0x70ba('0x3a')]));var _0x131c12=this[_0x70ba('0x10')]['exec'](_0x70ba('0x1ca'),[_0x11ab41[_0x70ba('0x1cb')],_0x11ab41[_0x70ba('0x74')]]);if(_0x131c12['result']===-0x1){return _0x131c12;}return this[_0x70ba('0x10')][_0x70ba('0xa3')](util['format'](_0x70ba('0xc0'),_0x70ba('0x1ca'),_0x11ab41['mailbox']));};AGIVertices[_0x70ba('0x15')][_0x70ba('0x1cc')]=function(_0x14578f){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x14578f[_0x70ba('0x3a')]));if(!this[_0x70ba('0x81')](_0x14578f['variable_id'])){return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x14578f,_0x70ba('0x1ab'));}var _0x4ea88c=this[_0x70ba('0x12')][_0x70ba('0x6d')](this,_0x14578f[_0x70ba('0xd3')]);if(!_0x4ea88c){return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x14578f,_0x70ba('0xd4'));}var _0x550887=this['channel'][_0x70ba('0x12')](_0x4ea88c);return{'code':0xc8,'result':_0x550887[_0x70ba('0x9d')]?_0x550887[_0x70ba('0x9d')]:'-'};};String[_0x70ba('0x15')][_0x70ba('0x9c')]=function(_0x19ab44,_0xbb007c){return this['split'](_0x19ab44)[_0x70ba('0x1cd')](_0xbb007c);};module[_0x70ba('0x1ce')]=AGIVertices; \ No newline at end of file +var _0xb647=['providerResponse','out','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','ndassistant_url','Sestek\x20NDA\x20%s\x20file\x20created','audiofile','unlink','.wav','SestekNDA\x20Result\x20%s','Enter\x20in\x20END\x20(%s)\x20block','end','ext_dial','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','test','mindigit','hiddendigitsnum','substr','generate','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','Trying\x20aws\x20Polly\x20%s','streamFile','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','wav','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','appsecret','no\x20appsecret\x20configured','%s/recordings/%s','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','false','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','IFTIME(%s?true:false)','true','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','no\x20find\x20by\x20configured','math','operation','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','getSound','digit','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','getVoiceQueue','no\x20queue\x20found','indexOf','toLowerCase','QUEUE','macro','gosub','position','record','recordingFormat','%s_%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','replace','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','getMailAccount','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','user','subject','template_id','sendMail\x20message','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','Answer','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','getSquareProject','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','shellCommand','command','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','google_cloud_tts','apiKey','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','util','lodash','shelljs','odbc','randomstring','moment','mustache','request-promise','agi','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','mailRpc','getVariableById','then','name','catch','prototype','getVoiceQueueById','rpc','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUserById','getTrunk','getTrunkById','getSoundById','getSoundPath','save_name','getMailAccountById','sendMailMessage','getIntervals','IntervalId','interval','map','format','%s/sounds/converted/%s','getQueryOdbc','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','uniqueid','label','arg_1','callerid','createSquareRecording','calleridname','context','extension','priority','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','list_id','scheduledAt','Callback\x20scheduled\x20at\x20','callback_priority','getPause','agentPause','agentUnpause','agent','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','trim','googleCloudTTS','google_cloud_tts_text_type','text','ssmlGender','MALE','MP3','googleTTS','google_tts_language','restAPI','url','method','number','timeout','POST','PUT','toUpperCase','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','render','headers','stringify','body','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','en-US','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','uri','clear','clone','isString','includes','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','hasOwnProperty','isArray','length','isPlainObject','saveRestApiResult','%s.%s','setVariable','split','replaceAll','toString','getVariable','result','extra','maxRetry','createSquareDetailsReport','sync','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','exec','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','no\x20grammar\x20configured','grammar','MRCPRecog','getAndSetVariable','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','RECOG_INSTANCE()','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','variable\x20%s\x20set','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','getUser','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','private_key','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s'];(function(_0x1843b3,_0x10995a){var _0x3c7de0=function(_0xe28643){while(--_0xe28643){_0x1843b3['push'](_0x1843b3['shift']());}};_0x3c7de0(++_0x10995a);}(_0xb647,0xdb));var _0x7b64=function(_0x5f1e8d,_0x5873d1){_0x5f1e8d=_0x5f1e8d-0x0;var _0x339ca2=_0xb647[_0x5f1e8d];return _0x339ca2;};'use strict';var fs=require('fs');var util=require(_0x7b64('0x0'));var _=require(_0x7b64('0x1'));var sh=require(_0x7b64('0x2'));var odbc=require(_0x7b64('0x3'))();var rs=require(_0x7b64('0x4'));var moment=require(_0x7b64('0x5'));var Mustache=require(_0x7b64('0x6'));var rp=require(_0x7b64('0x7'));var logger=require('../../config/logger')(_0x7b64('0x8'));var config=require('../../config/environment');var scripts=require(_0x7b64('0x9'));var FILES_PATH=_0x7b64('0xa');var recursiveMapAttributes=[_0x7b64('0xb'),_0x7b64('0xc')];var verticesWithRetry=[_0x7b64('0xd'),_0x7b64('0xe'),_0x7b64('0xf')];var AGIVertices=function(_0x2ff650,_0x432ced,_0x5784fb){this[_0x7b64('0x10')]=_0x2ff650;this['rpc']=_0x432ced;this[_0x7b64('0x11')]=_0x5784fb;};AGIVertices['prototype']['getVariable']=function(_0x35ed61,_0xa72761){this['rpc'][_0x7b64('0x12')](_0x35ed61)[_0x7b64('0x13')](function(_0xd9e5ca){_0xa72761(null,_0xd9e5ca?_0xd9e5ca[_0x7b64('0x14')]:![]);})[_0x7b64('0x15')](function(_0x432626){_0xa72761(_0x432626);});};AGIVertices[_0x7b64('0x16')]['getVoiceQueue']=function(_0x212438,_0x56899c){this['rpc'][_0x7b64('0x17')](_0x212438)[_0x7b64('0x13')](function(_0x1d256d){_0x56899c(null,_0x1d256d?_0x1d256d[_0x7b64('0x14')]:![]);})[_0x7b64('0x15')](function(_0x437ddc){_0x56899c(_0x437ddc);});};AGIVertices[_0x7b64('0x16')]['getSquareProject']=function(_0xca026a,_0x40066b){this[_0x7b64('0x18')][_0x7b64('0x19')](_0xca026a)[_0x7b64('0x13')](function(_0x4aa38d){_0x40066b(null,_0x4aa38d?_0x4aa38d[_0x7b64('0x14')]:![]);})[_0x7b64('0x15')](function(_0x58517e){_0x40066b(_0x58517e);});};AGIVertices[_0x7b64('0x16')][_0x7b64('0x1a')]=function(_0x5ef53f,_0x23845e){this[_0x7b64('0x18')][_0x7b64('0x1b')](_0x5ef53f)[_0x7b64('0x13')](function(_0x47cef5){_0x23845e(null,_0x47cef5?_0x47cef5[_0x7b64('0x1c')]:![]);})[_0x7b64('0x15')](function(_0x4a7549){_0x23845e(_0x4a7549);});};AGIVertices[_0x7b64('0x16')]['getUser']=function(_0x2d2d9a,_0x587da6){this[_0x7b64('0x18')][_0x7b64('0x1d')](_0x2d2d9a)[_0x7b64('0x13')](function(_0x379e90){_0x587da6(null,_0x379e90?_0x379e90[_0x7b64('0x14')]:![]);})[_0x7b64('0x15')](function(_0x215ea9){_0x587da6(_0x215ea9);});};AGIVertices[_0x7b64('0x16')][_0x7b64('0x1e')]=function(_0x78a6d1,_0xec557c){this[_0x7b64('0x18')][_0x7b64('0x1f')](_0x78a6d1)[_0x7b64('0x13')](function(_0x50d06c){_0xec557c(null,_0x50d06c?_0x50d06c[_0x7b64('0x14')]:![]);})['catch'](function(_0x1580d0){_0xec557c(_0x1580d0);});};AGIVertices[_0x7b64('0x16')]['getSound']=function(_0x5acdb3,_0x38738c){var _0x1e1ba7=this;this[_0x7b64('0x18')][_0x7b64('0x20')](_0x5acdb3)[_0x7b64('0x13')](function(_0x3c9fad){_0x38738c(null,_0x3c9fad?_0x1e1ba7[_0x7b64('0x21')](_0x3c9fad[_0x7b64('0x22')]):![]);})['catch'](function(_0x1616c9){_0x38738c(_0x1616c9);});};AGIVertices[_0x7b64('0x16')]['getMailAccount']=function(_0x6b1d0,_0x2bcefa){this[_0x7b64('0x18')][_0x7b64('0x23')](_0x6b1d0)[_0x7b64('0x13')](function(_0x38a059){_0x2bcefa(null,_0x38a059?_0x38a059:![]);})['catch'](function(_0x5bf639){_0x2bcefa(_0x5bf639);});};AGIVertices[_0x7b64('0x16')][_0x7b64('0x24')]=function(_0x49e402,_0x508c6d,_0x345664){this['mailRpc'][_0x7b64('0x24')](_0x49e402,_0x508c6d)['then'](function(){_0x345664(null);})['catch'](function(_0x5a80b2){_0x345664(_0x5a80b2);});};AGIVertices[_0x7b64('0x16')][_0x7b64('0x25')]=function(_0x120a84,_0x58ffdb){this[_0x7b64('0x18')]['getIntervalById'](_0x120a84)[_0x7b64('0x13')](function(_0x7e1083){if(_0x7e1083){if(_0x7e1083[_0x7b64('0x26')]){_0x58ffdb(null,[_0x7e1083[_0x7b64('0x27')]]);}else{_0x58ffdb(null,_[_0x7b64('0x28')](_0x7e1083['Intervals'],_0x7b64('0x27')));}}else{_0x58ffdb(null,![]);}})[_0x7b64('0x15')](function(_0x2d0e9){_0x58ffdb(_0x2d0e9);});};AGIVertices[_0x7b64('0x16')]['getSoundPath']=function(_0x1855c5){return util[_0x7b64('0x29')](_0x7b64('0x2a'),FILES_PATH,_0x1855c5);};AGIVertices[_0x7b64('0x16')][_0x7b64('0x2b')]=function(_0x27e008,_0x1c0be6,_0x526389){odbc['open'](_0x27e008,function(_0xe9eac){if(_0xe9eac){logger[_0x7b64('0x2c')](_0x7b64('0x2d'),_0xe9eac);_0x526389(_0xe9eac);}else{logger[_0x7b64('0x2e')](_0x7b64('0x2f'));odbc[_0x7b64('0x30')](_0x1c0be6,function(_0x36c606,_0x3c3d77){if(_0x36c606){logger[_0x7b64('0x2e')]('Error\x20executing\x20query\x20%s',_0x1c0be6);_0x526389(_0x36c606);}else{logger[_0x7b64('0x2e')](_0x7b64('0x31'),_0x1c0be6);odbc[_0x7b64('0x32')](function(_0x40787f){if(_0x40787f){logger[_0x7b64('0x2c')](_0x7b64('0x33'),_0x40787f);}_0x526389(null,_0x3c3d77);});}});}});};AGIVertices[_0x7b64('0x16')][_0x7b64('0x34')]=function(_0x3c4467,_0x47012c){this[_0x7b64('0x18')][_0x7b64('0x35')](_0x3c4467)[_0x7b64('0x13')](function(_0x36cfce){_0x47012c(null,_0x36cfce?_0x36cfce:![]);})[_0x7b64('0x15')](function(_0x42cc06){_0x47012c(_0x42cc06);});};AGIVertices[_0x7b64('0x16')][_0x7b64('0x36')]=function(_0x8739ec,_0x355e8a){this['rpc'][_0x7b64('0x36')](_0x8739ec)[_0x7b64('0x13')](function(_0x163580){_0x355e8a(null,_0x163580);})['catch'](function(_0x11abbc){_0x355e8a(_0x11abbc);});};AGIVertices[_0x7b64('0x16')]['createSquareDetailsReport']=function(_0x216c58,_0xf0d4a1,_0x54d7d2){this[_0x7b64('0x18')]['createSquareDetailsReport']({'uniqueid':this[_0x7b64('0x10')][_0x7b64('0x37')],'node':_0x216c58[_0x7b64('0x38')],'application':_0x216c58['agicommand'],'data':_0xf0d4a1||null,'project_name':this[_0x7b64('0x10')][_0x7b64('0x39')],'callerid':this[_0x7b64('0x10')][_0x7b64('0x3a')]})[_0x7b64('0x13')](function(_0x284e1a){if(_0x54d7d2){_0x54d7d2(null,_0x284e1a);}})['catch'](function(_0x20accc){if(_0x54d7d2){_0x54d7d2(_0x20accc);}});};AGIVertices[_0x7b64('0x16')][_0x7b64('0x3b')]=function(_0x1dd7a9,_0xdcca4e,_0x54e89a,_0x531354){this['rpc']['createSquareRecording']({'uniqueid':this[_0x7b64('0x10')][_0x7b64('0x37')],'callerid':this[_0x7b64('0x10')][_0x7b64('0x3a')],'calleridname':this[_0x7b64('0x10')][_0x7b64('0x3c')],'context':this[_0x7b64('0x10')][_0x7b64('0x3d')],'extension':this[_0x7b64('0x10')][_0x7b64('0x3e')],'priority':this[_0x7b64('0x10')][_0x7b64('0x3f')],'accountcode':this['channel']['accountcode'],'dnid':this[_0x7b64('0x10')][_0x7b64('0x40')],'projectName':this[_0x7b64('0x10')][_0x7b64('0x39')],'saveName':_0xdcca4e,'filename':_0x1dd7a9[_0x7b64('0x41')]||_0xdcca4e,'savePath':_0x54e89a})['then'](function(_0x3e5321){_0x531354(null,_0x3e5321);})[_0x7b64('0x15')](function(_0x476890){_0x531354(_0x476890);});};AGIVertices['prototype'][_0x7b64('0x42')]=function(_0x214a45,_0x27c9f9,_0x64b24a,_0x18c5b0,_0x572713){this[_0x7b64('0x18')][_0x7b64('0x42')]({'uniqueid':this['channel'][_0x7b64('0x37')],'body':_0x214a45,'direction':_0x27c9f9,'providerName':_0x64b24a,'providerResponse':_0x18c5b0})[_0x7b64('0x13')](function(_0x5ed33c){if(_0x572713){_0x572713(null,_0x5ed33c);}})[_0x7b64('0x15')](function(_0x2c6d00){if(_0x572713){_0x572713(_0x2c6d00);}});};AGIVertices[_0x7b64('0x16')][_0x7b64('0x43')]=function(_0x383190,_0x79cbc9){this[_0x7b64('0x18')][_0x7b64('0x43')]({'firstName':_[_0x7b64('0x44')](_0x383190[_0x7b64('0x14')])||_[_0x7b64('0x45')](_0x383190[_0x7b64('0x14')])?_0x7b64('0x46')+Math[_0x7b64('0x47')]():_0x383190[_0x7b64('0x14')],'lastName':_[_0x7b64('0x44')](_0x383190[_0x7b64('0x48')])||_[_0x7b64('0x45')](_0x383190['lastName'])?null:_0x383190[_0x7b64('0x48')],'phone':_0x383190['phone'],'ListId':_0x383190[_0x7b64('0x49')],'scheduledat':_0x383190[_0x7b64('0x4a')],'callbackUniqueid':this[_0x7b64('0x10')]['uniqueid'],'tags':'callback','description':_0x7b64('0x4b')+_0x383190['scheduledAt']['toString'](),'priority':_0x383190[_0x7b64('0x4c')]})[_0x7b64('0x13')](function(_0x1e1cd3){_0x79cbc9(null,_0x1e1cd3);})['catch'](function(_0x1fd98a){_0x79cbc9(_0x1fd98a);});};AGIVertices[_0x7b64('0x16')][_0x7b64('0x4d')]=function(_0x32ba5d,_0x3724a7){this['rpc']['getPauseById'](_0x32ba5d)[_0x7b64('0x13')](function(_0xe47998){_0x3724a7(null,_0xe47998?_0xe47998[_0x7b64('0x14')]:![]);})[_0x7b64('0x15')](function(_0x59df96){_0x3724a7(_0x59df96);});};AGIVertices[_0x7b64('0x16')][_0x7b64('0x4e')]=function(_0x18ef41,_0x1049da,_0x4999c3){var _0x463433={'role':'agent'};_0x463433[_0x18ef41]=this[_0x7b64('0x10')]['callerid'];this['rpc']['agentPause'](_0x463433,_0x1049da,this['channel'][_0x7b64('0x37')])[_0x7b64('0x13')](function(_0x5c9a7e){_0x4999c3(null,_[_0x7b64('0x45')](_0x5c9a7e)?![]:!![]);})[_0x7b64('0x15')](function(_0x3dd757){logger['error'](_0x3dd757);_0x4999c3(null,![]);});};AGIVertices[_0x7b64('0x16')][_0x7b64('0x4f')]=function(_0x5e6f02,_0x51b944){var _0x1c2bdf={'role':'agent'};_0x1c2bdf[_0x5e6f02]=this['channel'][_0x7b64('0x3a')];this[_0x7b64('0x18')]['agentUnpause'](_0x1c2bdf)['then'](function(_0x28002e){_0x51b944(null,_[_0x7b64('0x45')](_0x28002e)?![]:!![]);})['catch'](function(_0x86ddde){logger['error'](_0x86ddde);_0x51b944(null,![]);});};AGIVertices[_0x7b64('0x16')]['agentLogout']=function(_0x117d52,_0x293e73){var _0x2ad554={'role':_0x7b64('0x50')};_0x2ad554[_0x117d52]=this[_0x7b64('0x10')]['callerid'];this[_0x7b64('0x18')][_0x7b64('0x51')](_0x2ad554)[_0x7b64('0x13')](function(_0x201d1b){_0x293e73(null,_['isNil'](_0x201d1b)?![]:!![]);})[_0x7b64('0x15')](function(_0x323c06){logger[_0x7b64('0x2c')](_0x323c06);_0x293e73(null,![]);});};AGIVertices['prototype'][_0x7b64('0x52')]=function(_0x4e7764,_0x1996f9){var _0x2dc0ea={'role':'agent'};_0x2dc0ea[_0x4e7764]=this['channel'][_0x7b64('0x3a')];var _0x5f1706=_0x4e7764!=_0x7b64('0x53')?util[_0x7b64('0x29')](_0x7b64('0x54'),_0x7b64('0x55'),this[_0x7b64('0x10')][_0x7b64('0x3a')]):undefined;this[_0x7b64('0x18')][_0x7b64('0x52')](_0x2dc0ea,_0x5f1706)['then'](function(_0x37239c){_0x1996f9(null,_[_0x7b64('0x45')](_0x37239c)?![]:!![]);})['catch'](function(_0x5f127c){logger[_0x7b64('0x2c')](_0x5f127c);_0x1996f9(null,![]);});};AGIVertices[_0x7b64('0x16')]['shellCommand']=function(_0x17f511,_0x2a7d8a){sh['exec'](_[_0x7b64('0x56')](_0x17f511),function(_0xb02c35,_0x4962bf){var _0x47c76e=_0x4962bf['replace'](/(\r\n|\n|\r)/gm,'');_0x2a7d8a(null,_0x47c76e);});};AGIVertices[_0x7b64('0x16')]['googleCloudTTS']=function(_0x1c170e,_0x12bf8a){scripts[_0x7b64('0x57')](_0x1c170e['apiKey'],_0x1c170e[_0x7b64('0x58')]||_0x7b64('0x59'),_0x1c170e[_0x7b64('0x59')],_0x1c170e['languageCode']||'en-US',_0x1c170e[_0x7b64('0x5a')]||_0x7b64('0x5b'),_0x1c170e['audioEncoding']||_0x7b64('0x5c'))[_0x7b64('0x13')](function(_0x47b3bc){_0x12bf8a(null,_0x47b3bc);})[_0x7b64('0x15')](function(_0x2e92a5){_0x12bf8a(_0x2e92a5);});};AGIVertices['prototype'][_0x7b64('0x5d')]=function(_0x8941d9,_0x2e7053){scripts[_0x7b64('0x5d')](_0x8941d9[_0x7b64('0x59')],_0x8941d9[_0x7b64('0x5e')]||'en',0x1)['then'](function(_0x4ac9b9){_0x2e7053(null,_0x4ac9b9);})[_0x7b64('0x15')](function(_0x622a7f){_0x2e7053(_0x622a7f);});};AGIVertices['prototype'][_0x7b64('0x5f')]=function(_0x13e09a,_0x26d94d){var _0x511816={'uri':_0x13e09a[_0x7b64('0x60')],'method':_0x13e09a[_0x7b64('0x61')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x13e09a['timeout'])===_0x7b64('0x62')&&parseInt(_0x13e09a['timeout'])>=0x1?parseInt(_0x13e09a[_0x7b64('0x63')])*0x3e8:0x5*0x3e8};if(_['includes']([_0x7b64('0x64'),_0x7b64('0x65')],_0x511816['method'][_0x7b64('0x66')]())){try{_0x511816['body']=_0x13e09a[_0x7b64('0xc')]?JSON[_0x7b64('0x67')](_0x13e09a['rawBody']):{};}catch(_0x433ec0){logger[_0x7b64('0x2c')](_0x7b64('0x68'),_0x433ec0);}}try{_0x511816['headers']=_0x13e09a[_0x7b64('0xb')]?JSON['parse'](_0x13e09a['rawHeaders']):{};}catch(_0x4c9a99){logger[_0x7b64('0x2c')](_0x7b64('0x69'),_0x4c9a99);}if(_0x13e09a[_0x7b64('0x6a')]){try{var _0x648cbc=require(_0x13e09a[_0x7b64('0x6a')])['sync'](this,_0x511816);_0x511816['uri']=Mustache[_0x7b64('0x6b')](_0x13e09a[_0x7b64('0x60')],_0x648cbc,{},['$$','$$']);if(_0x511816[_0x7b64('0x6c')]){_0x511816[_0x7b64('0x6c')]=JSON[_0x7b64('0x67')](Mustache['render'](JSON[_0x7b64('0x6d')](_0x511816['headers']),_0x648cbc,{},['$$','$$']));}if(_0x511816[_0x7b64('0x6e')]){_0x511816[_0x7b64('0x6e')]=JSON[_0x7b64('0x67')](Mustache['render'](JSON[_0x7b64('0x6d')](_0x511816['body']),_0x648cbc,{},['$$','$$']));}}catch(_0x36e460){logger[_0x7b64('0x2c')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x36e460);}}rp(_0x511816)[_0x7b64('0x13')](function(_0x2d0dbd){var _0x360a6b={'statusCode':_0x2d0dbd[_0x7b64('0x6f')]||0xc8,'statusMessage':_0x2d0dbd[_0x7b64('0x70')]||'OK','headers':_0x2d0dbd[_0x7b64('0x6c')]||{},'body':_0x2d0dbd[_0x7b64('0x6e')]||{}};_0x26d94d(null,_0x360a6b);})['catch'](function(_0x41819b){var _0x5d75ae={'statusCode':_0x41819b[_0x7b64('0x6f')]||0x1f4,'statusMessage':_0x41819b[_0x7b64('0x71')]||_0x7b64('0x72'),'headers':_0x41819b[_0x7b64('0x73')][_0x7b64('0x6c')]||{},'body':_0x41819b[_0x7b64('0x73')][_0x7b64('0x6e')]||{}};_0x26d94d(null,_0x5d75ae);});};AGIVertices['prototype']['googleDialogflow']=function(_0x1cadbf,_0x1aeeec){scripts[_0x7b64('0x74')](this[_0x7b64('0x10')][_0x7b64('0x37')],_0x1cadbf[_0x7b64('0x75')],_0x1cadbf[_0x7b64('0x59')],_0x1cadbf[_0x7b64('0x76')]||'en')[_0x7b64('0x13')](function(_0x502b8a){_0x1aeeec(null,_0x502b8a);})[_0x7b64('0x15')](function(_0x1b4cf8){_0x1aeeec(_0x1b4cf8);});};AGIVertices[_0x7b64('0x16')][_0x7b64('0x77')]=function(_0x5c1e4f,_0x212723){scripts[_0x7b64('0x77')](this[_0x7b64('0x10')]['uniqueid'],_0x5c1e4f[_0x7b64('0x78')],_0x5c1e4f[_0x7b64('0x79')],_0x5c1e4f['private_key'],_0x5c1e4f[_0x7b64('0x59')],_0x5c1e4f[_0x7b64('0x7a')]||'en')[_0x7b64('0x13')](function(_0x3cf3e4){_0x212723(null,_0x3cf3e4);})[_0x7b64('0x15')](function(_0x4dbb60){_0x212723(_0x4dbb60);});};AGIVertices[_0x7b64('0x16')][_0x7b64('0x7b')]=function(_0x58fb41,_0x4627e4){scripts[_0x7b64('0x7b')](this[_0x7b64('0x10')],_0x58fb41)[_0x7b64('0x13')](function(_0x5e2e1b){_0x4627e4(null,_0x5e2e1b);})[_0x7b64('0x15')](function(_0x14dfc1){_0x4627e4(_0x14dfc1);});};AGIVertices[_0x7b64('0x16')][_0x7b64('0x7c')]=function(_0x1180b2,_0x217a13){scripts[_0x7b64('0x7c')](_0x1180b2[_0x7b64('0x75')],_0x1180b2['text'],_0x1180b2[_0x7b64('0x7d')]||_0x7b64('0x7e'),_0x1180b2[_0x7b64('0x7f')])[_0x7b64('0x13')](function(_0x533ce1){_0x217a13(null,_0x533ce1);})[_0x7b64('0x15')](function(_0x4efbc2){_0x217a13(_0x4efbc2);});};AGIVertices[_0x7b64('0x16')][_0x7b64('0x80')]=function(_0x35fbce,_0x556031,_0x59d017){scripts[_0x7b64('0x80')](_0x556031,_0x35fbce[_0x7b64('0x75')],_0x35fbce[_0x7b64('0x81')]||_0x7b64('0x7e'),this[_0x7b64('0x82')](_0x35fbce[_0x7b64('0x83')])?_0x35fbce['model']:undefined)[_0x7b64('0x13')](function(_0x503a65){_0x59d017(null,_0x503a65);})[_0x7b64('0x15')](function(_0x5d8cea){_0x59d017(_0x5d8cea);});};AGIVertices[_0x7b64('0x16')][_0x7b64('0x84')]=function(_0xb5cae6,_0xb3d6e9){scripts['awsPolly'](_0xb5cae6[_0x7b64('0x85')],_0xb5cae6[_0x7b64('0x86')],_0xb5cae6[_0x7b64('0x87')],_0xb5cae6[_0x7b64('0x88')]||_0x7b64('0x89'),_0xb5cae6[_0x7b64('0x59')],_0xb5cae6[_0x7b64('0x8a')]||_0x7b64('0x59'))[_0x7b64('0x13')](function(_0x40d118){_0xb3d6e9(null,_0x40d118);})[_0x7b64('0x15')](function(_0x4d089c){_0xb3d6e9(_0x4d089c);});};AGIVertices[_0x7b64('0x16')][_0x7b64('0x8b')]=function(_0x411eb1,_0x41269d){scripts[_0x7b64('0x8b')](this[_0x7b64('0x10')][_0x7b64('0x37')],_0x411eb1['aws_access_key_id'],_0x411eb1[_0x7b64('0x86')],_0x411eb1[_0x7b64('0x8c')],_0x411eb1[_0x7b64('0x59')],_0x411eb1[_0x7b64('0x8d')])[_0x7b64('0x13')](function(_0x3e06da){_0x41269d(null,_0x3e06da);})['catch'](function(_0x453ca8){_0x41269d(_0x453ca8);});};AGIVertices[_0x7b64('0x16')][_0x7b64('0x8e')]=function(_0x268c57,_0x3c96c9,_0x170321){scripts[_0x7b64('0x8e')](_0x3c96c9,_0x268c57['key'],_0x268c57[_0x7b64('0x8f')]||_0x7b64('0x7e'))[_0x7b64('0x13')](function(_0x4e8350){_0x170321(null,_0x4e8350);})[_0x7b64('0x15')](function(_0x1c0861){_0x170321(_0x1c0861);});};AGIVertices[_0x7b64('0x16')][_0x7b64('0x90')]=function(_0x32533b,_0x1363c2,_0x369d6d){scripts['tildeASR'](_0x1363c2,_0x32533b[_0x7b64('0x91')],_0x32533b['appsecret'],_0x32533b[_0x7b64('0x92')])[_0x7b64('0x13')](function(_0x1012d7){_0x369d6d(null,_0x1012d7);})[_0x7b64('0x15')](function(_0xa66a6a){_0x369d6d(_0xa66a6a);});};AGIVertices[_0x7b64('0x16')][_0x7b64('0x93')]=function(_0x54790a){var _0x385691=_['includes'](verticesWithRetry,_0x54790a['agicommand'])?_0x54790a:_[_0x7b64('0x94')](_0x54790a);for(var _0x119cf2 in _0x385691){if(_0x385691['hasOwnProperty'](_0x119cf2)){if(_0x385691[_0x119cf2]&&_[_0x7b64('0x95')](_0x385691[_0x119cf2])){if(_[_0x7b64('0x96')](recursiveMapAttributes,_0x119cf2)){_0x385691[_0x119cf2]=this[_0x7b64('0x97')](_0x385691[_0x119cf2]);}else{_0x385691[_0x119cf2]=this[_0x7b64('0x98')](_0x385691[_0x119cf2]);}}}}return _0x385691;};AGIVertices[_0x7b64('0x16')][_0x7b64('0x99')]=function(_0x46c88c){for(var _0x2b8547 in _0x46c88c){if(_0x46c88c[_0x7b64('0x9a')](_0x2b8547)){if(_['isPlainObject'](_0x46c88c[_0x2b8547])){this[_0x7b64('0x99')](_0x46c88c[_0x2b8547]);}else if(_[_0x7b64('0x9b')](_0x46c88c[_0x2b8547])){for(var _0x563e09=0x0;_0x563e09<_0x46c88c[_0x2b8547][_0x7b64('0x9c')];_0x563e09++){this['recursiveNodeIndex'](_0x46c88c[_0x2b8547][_0x563e09]);}}else if(_[_0x7b64('0x95')](_0x46c88c[_0x2b8547])){_0x46c88c[_0x2b8547]=this['replaceAllVariables'](_0x46c88c[_0x2b8547]);}}}};AGIVertices['prototype']['saveRestApiResult']=function(_0xabb851,_0x1d6d27){for(var _0x370cda in _0xabb851){if(_0xabb851[_0x7b64('0x9a')](_0x370cda)){if(_[_0x7b64('0x9d')](_0xabb851[_0x370cda])){if(!_['isEmpty'](_0xabb851[_0x370cda])){this[_0x7b64('0x9e')](_0xabb851[_0x370cda],util['format'](_0x7b64('0x9f'),_0x1d6d27,_0x370cda));}}else if(_[_0x7b64('0x9b')](_0xabb851[_0x370cda])){for(var _0x1480b0=0x0;_0x1480b0<_0xabb851[_0x370cda]['length'];_0x1480b0++){this[_0x7b64('0x9e')](_0xabb851[_0x370cda][_0x1480b0],util[_0x7b64('0x29')](_0x7b64('0x9f'),_0x1d6d27,_0x370cda+'['+_0x1480b0+']'));}}else{if(!_[_0x7b64('0x45')](_0xabb851[_0x370cda])){this[_0x7b64('0x10')][_0x7b64('0xa0')](util[_0x7b64('0x29')](_0x7b64('0x9f'),_0x1d6d27,_0x370cda),_0xabb851[_0x370cda]);}}}}};AGIVertices[_0x7b64('0x16')]['replaceObjectAllVariables']=function(_0x41e506){try{var _0x1761a9=JSON[_0x7b64('0x67')](_0x41e506);this['recursiveNodeIndex'](_0x1761a9);return JSON['stringify'](_0x1761a9);}catch(_0x40c378){return this[_0x7b64('0x98')](_0x41e506);}};AGIVertices[_0x7b64('0x16')][_0x7b64('0x98')]=function(_0x8bc40f){var _0x5d06ce=_0x8bc40f[_0x7b64('0xa1')]('{');for(var _0x21c02e=0x1;_0x21c02e<_0x5d06ce[_0x7b64('0x9c')];_0x21c02e+=0x1){var _0x5c2b0f=_0x5d06ce[_0x21c02e][_0x7b64('0xa1')]('}');if(_0x5c2b0f[_0x7b64('0x9c')]>0x1){_0x8bc40f=_0x8bc40f[_0x7b64('0xa2')]('{'+_0x5c2b0f[0x0]+'}',this[_0x7b64('0x10')]['getVariable'](_0x5c2b0f[0x0])['extra']||_0x5c2b0f[0x0]);}}if(_0x5d06ce[_0x7b64('0x9c')]===0x1){return _0x8bc40f[_0x7b64('0xa3')]();}return this[_0x7b64('0x98')](_0x8bc40f);};AGIVertices['prototype']['getAndSetVariable']=function(_0x160708,_0x4d1a8b){var _0x5a0575=this[_0x7b64('0x10')][_0x7b64('0xa4')](_0x160708);if(_0x5a0575[_0x7b64('0xa5')]===-0x1){return _0x5a0575;}logger[_0x7b64('0x2e')](util[_0x7b64('0x29')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x4d1a8b,_0x5a0575[_0x7b64('0xa6')]));return this[_0x7b64('0x10')][_0x7b64('0xa0')](_0x4d1a8b,_0x5a0575[_0x7b64('0xa6')]);};AGIVertices[_0x7b64('0x16')]['isConfigured']=function(_0x381c1a){return _0x381c1a&&_0x381c1a!=='0'&&_0x381c1a!=='-1'&&_0x381c1a!=='';};AGIVertices[_0x7b64('0x16')][_0x7b64('0xa7')]=function(_0x71f120){this[_0x7b64('0xa8')][_0x7b64('0xa9')](this,_0x71f120,'-');_0x71f120[_0x7b64('0xaa')]=_0x71f120[_0x7b64('0xa7')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x7b64('0x16')][_0x7b64('0xab')]=function(_0x39bc65){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0xac'),_0x39bc65['label']));if(!this[_0x7b64('0x82')](_0x39bc65[_0x7b64('0x59')])){return this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0xae'));}var _0x108d1a='\x22'+_0x39bc65[_0x7b64('0x59')]+'\x22';if(this[_0x7b64('0x82')](_0x39bc65[_0x7b64('0x73')])){_0x108d1a+=','+_0x39bc65[_0x7b64('0x73')];}var _0x1a4e3b=this[_0x7b64('0x10')][_0x7b64('0xaf')](_0x7b64('0xb0'),_0x108d1a);if(_0x1a4e3b[_0x7b64('0xa5')]===-0x1){return _0x1a4e3b;}return this[_0x7b64('0x10')]['noop'](util[_0x7b64('0x29')](_0x7b64('0xb1'),_0x108d1a));};AGIVertices[_0x7b64('0x16')]['mrcprecog']=function(_0x57153f){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0xb2'),_0x57153f[_0x7b64('0x38')]));if(!this[_0x7b64('0x82')](_0x57153f['grammar'])){return this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0xb3'));}var _0x548847=_0x57153f[_0x7b64('0xb4')];if(this[_0x7b64('0x82')](_0x57153f[_0x7b64('0x73')])){_0x548847+=','+_0x57153f[_0x7b64('0x73')];}var _0x4f4fe8=this[_0x7b64('0x10')][_0x7b64('0xaf')](_0x7b64('0xb5'),_0x548847);if(_0x4f4fe8[_0x7b64('0xa5')]===-0x1){return _0x4f4fe8;}var _0x438ea3=this[_0x7b64('0xb6')](_0x7b64('0xb7'),_0x7b64('0xb8'));if(_0x438ea3[_0x7b64('0xa5')]===-0x1){return _0x438ea3;}var _0x1e1568=this[_0x7b64('0xb6')](_0x7b64('0xb9'),'MRCP_RECOG_TRANSCRIPT');if(_0x1e1568[_0x7b64('0xa5')]===-0x1){return _0x1e1568;}var _0x4c0c6c=this[_0x7b64('0xb6')](_0x7b64('0xba'),'MRCP_RECOG_INSTANCE');if(_0x4c0c6c[_0x7b64('0xa5')]===-0x1){return _0x4c0c6c;}return this[_0x7b64('0x10')][_0x7b64('0xad')](util[_0x7b64('0x29')]('Executed\x20command\x20MRCPRecog\x20%s',_0x548847));};AGIVertices[_0x7b64('0x16')]['agi']=function(_0x49f84e){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x49f84e[_0x7b64('0x38')]));return this[_0x7b64('0x10')]['agi']([_0x49f84e['command'],_0x49f84e['args']]);};AGIVertices[_0x7b64('0x16')][_0x7b64('0xbb')]=function(_0x23b248){logger[_0x7b64('0x2e')](util['format'](_0x7b64('0xbc'),_0x23b248['label']));if(this[_0x7b64('0x82')](_0x23b248['timeout'])){logger['info'](util['format'](_0x7b64('0xbd'),_0x23b248[_0x7b64('0x63')]));var _0x9a093=this[_0x7b64('0x10')][_0x7b64('0xbe')](_0x23b248[_0x7b64('0x63')]);if(_0x9a093[_0x7b64('0xa5')]===-0x1){return _0x9a093;}}return this['channel'][_0x7b64('0xbb')]();};AGIVertices[_0x7b64('0x16')][_0x7b64('0xbf')]=function(_0x4a5159){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0xc0'),_0x4a5159[_0x7b64('0x38')]));if(!this[_0x7b64('0x82')](_0x4a5159[_0x7b64('0x49')])){return this[_0x7b64('0x10')]['error'](_0x4a5159,'no\x20list\x20selected');}_0x4a5159[_0x7b64('0x4a')]=moment();if(this[_0x7b64('0x82')](_0x4a5159[_0x7b64('0xc1')])){_0x4a5159[_0x7b64('0x4a')]=moment()[_0x7b64('0xc2')](_0x4a5159['delay'],_0x7b64('0xc3'));}if(!this[_0x7b64('0x82')](_0x4a5159[_0x7b64('0x4c')])){_0x4a5159['callback_priority']=0x2;}this['createCmContact']['sync'](this,_0x4a5159);return this[_0x7b64('0x10')][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0xc4'),_0x4a5159['phone'],_0x4a5159['list_id'],_0x4a5159[_0x7b64('0x4a')]));};AGIVertices['prototype']['custom_app']=function(_0x33f819){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0xc5'),_0x33f819[_0x7b64('0x38')]));var _0x2bcdb8=this[_0x7b64('0x10')][_0x7b64('0xaf')](_0x33f819[_0x7b64('0xc6')],_0x33f819[_0x7b64('0x73')]);if(_0x2bcdb8['result']===-0x1){return _0x2bcdb8;}return this['channel'][_0x7b64('0xad')](util['format'](_0x7b64('0xc7'),_0x33f819['application'],_0x33f819['options']));};AGIVertices[_0x7b64('0x16')]['lumenvoxtts']=function(_0x14f871){logger['info'](util[_0x7b64('0x29')](_0x7b64('0xc8'),_0x14f871[_0x7b64('0x38')]));if(!this[_0x7b64('0x82')](_0x14f871['text'])){return this[_0x7b64('0x10')]['noop'](_0x7b64('0xae'));}var _0x5e4226='\x22'+_0x14f871['text']+'\x22';if(this[_0x7b64('0x82')](_0x14f871['options'])){_0x5e4226+=','+_0x14f871['options'];}var _0x3b7409=this['channel']['exec'](_0x7b64('0xb0'),_0x5e4226);if(_0x3b7409[_0x7b64('0xa5')]===-0x1){return _0x3b7409;}return this[_0x7b64('0x10')][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0xb1'),_0x5e4226));};AGIVertices[_0x7b64('0x16')][_0x7b64('0xc9')]=function(_0x1e9710){logger['info'](util[_0x7b64('0x29')](_0x7b64('0xca'),_0x1e9710[_0x7b64('0x38')]));if(!this[_0x7b64('0x82')](_0x1e9710['text'])){return this[_0x7b64('0x10')][_0x7b64('0xad')]('no\x20text\x20configured');}var _0xdf5026='\x22'+_0x1e9710['text']+'\x22';if(this[_0x7b64('0x82')](_0x1e9710[_0x7b64('0x73')])){_0xdf5026+=','+_0x1e9710[_0x7b64('0x73')];}var _0x44c450=this[_0x7b64('0x10')][_0x7b64('0xaf')](_0x7b64('0xb0'),_0xdf5026);if(_0x44c450[_0x7b64('0xa5')]===-0x1){return _0x44c450;}return this['channel'][_0x7b64('0xad')](util[_0x7b64('0x29')]('Executed\x20command\x20MRCPSynth\x20%s',_0xdf5026));};AGIVertices[_0x7b64('0x16')][_0x7b64('0xcb')]=function(_0x539aec){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x539aec[_0x7b64('0x38')]));if(!this[_0x7b64('0x82')](_0x539aec[_0x7b64('0xb4')])){return this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0xb3'));}var _0xbc6155=_0x539aec['grammar'];if(this[_0x7b64('0x82')](_0x539aec['options'])){_0xbc6155+=','+_0x539aec['options'];}var _0xb94da1=this[_0x7b64('0x10')][_0x7b64('0xaf')](_0x7b64('0xb5'),_0xbc6155);if(_0xb94da1[_0x7b64('0xa5')]===-0x1){return _0xb94da1;}var _0x7fc3e4=this[_0x7b64('0xb6')](_0x7b64('0xb7'),_0x7b64('0xcc'));if(_0x7fc3e4[_0x7b64('0xa5')]===-0x1){return _0x7fc3e4;}var _0x48efbc=this['getAndSetVariable'](_0x7b64('0xb9'),_0x7b64('0xcd'));if(_0x48efbc[_0x7b64('0xa5')]===-0x1){return _0x48efbc;}var _0x5633bf=this[_0x7b64('0xb6')]('RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE');if(_0x5633bf[_0x7b64('0xa5')]===-0x1){return _0x5633bf;}return this[_0x7b64('0x10')]['noop'](util[_0x7b64('0x29')](_0x7b64('0xce'),_0xbc6155));};AGIVertices['prototype'][_0x7b64('0xcf')]=function(_0x3f8728){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0xd0'),_0x3f8728[_0x7b64('0x38')]));if(!this[_0x7b64('0x82')](_0x3f8728[_0x7b64('0xb4')])){return this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0xb3'));}var _0x5e1aa9=_0x3f8728['grammar'];if(this['isConfigured'](_0x3f8728[_0x7b64('0x73')])){_0x5e1aa9+=','+_0x3f8728[_0x7b64('0x73')];}var _0x1fa92a=this[_0x7b64('0x10')][_0x7b64('0xaf')]('MRCPRecog',_0x5e1aa9);if(_0x1fa92a[_0x7b64('0xa5')]===-0x1){return _0x1fa92a;}var _0x5948fa=this[_0x7b64('0xb6')](_0x7b64('0xb7'),_0x7b64('0xd1'));if(_0x5948fa['result']===-0x1){return _0x5948fa;}var _0x2ab919=this[_0x7b64('0xb6')](_0x7b64('0xb9'),_0x7b64('0xd2'));if(_0x2ab919[_0x7b64('0xa5')]===-0x1){return _0x2ab919;}var _0x41a860=this['getAndSetVariable'](_0x7b64('0xba'),'SESTEK_ASR_INSTANCE');if(_0x41a860[_0x7b64('0xa5')]===-0x1){return _0x41a860;}return this[_0x7b64('0x10')][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0xce'),_0x5e1aa9));};AGIVertices['prototype'][_0x7b64('0xd3')]=function(_0x5648f4){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0xd4'),_0x5648f4[_0x7b64('0x38')]));if(!this['isConfigured'](_0x5648f4[_0x7b64('0xd5')])){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x5648f4,_0x7b64('0xd6'));}var _0x2b4570=this['getSquareOdbc'][_0x7b64('0xa9')](this,_0x5648f4[_0x7b64('0xd5')]);if(!_0x2b4570){return this[_0x7b64('0x10')]['error'](_0x5648f4,'no\x20odbc\x20database\x20found');}if(!this['isConfigured'](_0x5648f4[_0x7b64('0x30')])){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x5648f4,_0x7b64('0xd7'));}var _0x5eddd8=_0x5648f4['query']['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0x7b64('0x10')]['noop'](util['format'](_0x7b64('0xd8'),_0x5eddd8));var _0x3455e2=this[_0x7b64('0x2b')][_0x7b64('0xa9')](this,_0x2b4570,_0x5eddd8);this[_0x7b64('0xa8')][_0x7b64('0xa9')](this,_0x5648f4,_0x5eddd8);if(!this[_0x7b64('0x82')](_0x5648f4[_0x7b64('0xd9')])){return this[_0x7b64('0x10')]['noop'](_0x7b64('0xda'));}var _0x48c575=this['getVariable'][_0x7b64('0xa9')](this,_0x5648f4['variable_id']);if(!_0x48c575){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x5648f4,_0x7b64('0xdb'));}var _0x16b023=this;_0x3455e2[_0x7b64('0xdc')](function(_0x5b7091,_0x5c2235){Object[_0x7b64('0xdd')](_0x5b7091)[_0x7b64('0xdc')](function(_0x53fd8c){_0x16b023[_0x7b64('0x10')][_0x7b64('0xa0')](util[_0x7b64('0x29')](_0x7b64('0xde'),_0x48c575,_0x5c2235,_0x53fd8c),_0x5b7091[_0x53fd8c]);});});this[_0x7b64('0x10')]['setVariable'](util[_0x7b64('0x29')]('%s_ROWS_COUNT',_0x48c575),_0x3455e2[_0x7b64('0x9c')]);return this['channel']['noop'](util[_0x7b64('0x29')](_0x7b64('0xdf'),_0x48c575));};AGIVertices['prototype']['dial']=function(_0xc9fe3f){logger[_0x7b64('0xe0')](util[_0x7b64('0x29')](_0x7b64('0xe1'),_0xc9fe3f[_0x7b64('0x38')]));if(!this['isConfigured'](_0xc9fe3f[_0x7b64('0xe2')])){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0xc9fe3f,_0x7b64('0xe3'));}var _0x32d040=this[_0x7b64('0xe4')][_0x7b64('0xa9')](this,_0xc9fe3f[_0x7b64('0xe2')]);if(!_0x32d040){return this[_0x7b64('0x10')]['error'](_0xc9fe3f,'no\x20user\x20found');}var _0x52c8b8=this[_0x7b64('0x10')]['exec'](_0x7b64('0xe5'),[util[_0x7b64('0x29')](_0x7b64('0xe6'),_0x32d040),_0xc9fe3f[_0x7b64('0x63')],_0xc9fe3f[_0x7b64('0xe7')],_0xc9fe3f['url']]);if(_0x52c8b8[_0x7b64('0xa5')]===-0x1){return _0x52c8b8;}return this[_0x7b64('0x10')][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0xe8'),'DIAL'));};AGIVertices[_0x7b64('0x16')][_0x7b64('0xe9')]=function(_0x8fc78a){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0xea'),_0x8fc78a[_0x7b64('0x38')]));if(!this[_0x7b64('0x82')](_0x8fc78a[_0x7b64('0x75')])){return this[_0x7b64('0x10')]['noop'](_0x7b64('0xeb'));}if(!this[_0x7b64('0x82')](_0x8fc78a[_0x7b64('0x59')])){return this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0xae'));}this[_0x7b64('0x10')][_0x7b64('0xec')]=!![];this['createSquareDetailsReport'](_0x8fc78a);this[_0x7b64('0x42')](_0x8fc78a[_0x7b64('0x59')],'in','','');this[_0x7b64('0x10')][_0x7b64('0xad')](util['format'](_0x7b64('0xed'),_0x8fc78a['text']));var _0x4a7a44=this['googleDialogflow']['sync'](this,_0x8fc78a);if(_0x4a7a44){for(var _0x2e46a3 in _0x4a7a44){if(_0x4a7a44['hasOwnProperty'](_0x2e46a3)){this[_0x7b64('0x10')][_0x7b64('0xa0')](util[_0x7b64('0x29')](_0x7b64('0xee'),_0x2e46a3[_0x7b64('0x66')]()),_0x4a7a44[_0x2e46a3]);}}this[_0x7b64('0x42')](_0x4a7a44[_0x7b64('0xef')],'out',_0x7b64('0xe9'),'');return this[_0x7b64('0x10')][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0xf0'),_0x4a7a44['speech']));}return this['channel']['error'](_0x8fc78a,_0x7b64('0xf1'));};AGIVertices['prototype'][_0x7b64('0xf2')]=function(_0x4f76d7){logger['info'](util[_0x7b64('0x29')](_0x7b64('0xf3'),_0x4f76d7[_0x7b64('0x38')]));if(!this[_0x7b64('0x82')](_0x4f76d7['dialogflowV2_project_id'])){return this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0xf4'));}if(!this[_0x7b64('0x82')](_0x4f76d7[_0x7b64('0x79')])){return this['channel']['noop'](_0x7b64('0xf5'));}if(!this['isConfigured'](_0x4f76d7[_0x7b64('0xf6')])){return this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0xf7'));}if(!this[_0x7b64('0x82')](_0x4f76d7[_0x7b64('0x7a')])){return this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0xf8'));}if(!this[_0x7b64('0x82')](_0x4f76d7['text'])){return this[_0x7b64('0x10')][_0x7b64('0xad')]('no\x20text\x20configured');}this[_0x7b64('0x10')][_0x7b64('0xec')]=!![];this[_0x7b64('0xa8')](_0x4f76d7);this[_0x7b64('0x42')](_0x4f76d7['text'],'in','','');this[_0x7b64('0x10')][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0xf9'),_0x4f76d7[_0x7b64('0x59')]));var _0x165312=this['googleDialogflowV2'][_0x7b64('0xa9')](this,_0x4f76d7);if(_0x165312){for(var _0x148356 in _0x165312){if(_0x165312[_0x7b64('0x9a')](_0x148356)){if(_0x148356!==_0x7b64('0xfa')){this['channel']['setVariable'](util[_0x7b64('0x29')]('DIALOGFLOW_%s',_0x148356['toUpperCase']()),_0x165312[_0x148356]);}}}this[_0x7b64('0x42')](_0x165312['speech'],_0x7b64('0xfb'),'dialogflowV2',_0x165312[_0x7b64('0xfa')]);return this[_0x7b64('0x10')]['noop'](util['format'](_0x7b64('0xfc'),_0x165312[_0x7b64('0xef')]));}return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x4f76d7,_0x7b64('0xfd'));};AGIVertices[_0x7b64('0x16')][_0x7b64('0xfe')]=function(_0x2ae65){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x2ae65['label']));if(!this[_0x7b64('0x82')](_0x2ae65['ndauth_url'])){return this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0xff'));}if(!this[_0x7b64('0x82')](_0x2ae65[_0x7b64('0x100')])){return this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0x101'));}if(!this[_0x7b64('0x82')](_0x2ae65[_0x7b64('0x102')])){return this['channel'][_0x7b64('0xad')]('no\x20password\x20configured');}if(!this[_0x7b64('0x82')](_0x2ae65[_0x7b64('0x103')])){return this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0xae'));}this[_0x7b64('0x10')][_0x7b64('0xec')]=!![];this['createSquareDetailsReport'](_0x2ae65);this[_0x7b64('0x42')](_0x2ae65[_0x7b64('0x59')],'in','','');this[_0x7b64('0x10')][_0x7b64('0xad')](util[_0x7b64('0x29')]('Trying\x20SestekNDA:\x20%s',_0x2ae65[_0x7b64('0x59')]));var _0x4383c7=this['sestekNDA'][_0x7b64('0xa9')](this,_0x2ae65);if(_0x4383c7){for(var _0x308483 in _0x4383c7){if(_0x4383c7[_0x7b64('0x9a')](_0x308483)){this[_0x7b64('0x10')][_0x7b64('0xa0')](util['format']('SESTEK_NDA_%s',_0x308483[_0x7b64('0x66')]()),_0x4383c7[_0x308483]);}}this[_0x7b64('0x42')](_0x4383c7[_0x7b64('0xef')],'out',_0x7b64('0xfe'),'');if(_0x4383c7['audiofile']){this['channel'][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0x104'),_0x4383c7[_0x7b64('0x105')]));var _0x59b911=this[_0x7b64('0x10')]['streamFile'](_0x4383c7[_0x7b64('0x105')]);try{fs[_0x7b64('0x106')](_0x4383c7[_0x7b64('0x105')]+_0x7b64('0x107'));}catch(_0xecfee2){logger[_0x7b64('0x2c')](_0xecfee2);}return _0x59b911;}else{return this[_0x7b64('0x10')][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0x108'),_0x4383c7['speech']));}}return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x2ae65,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0x7b64('0x16')]['end']=function(_0x5089c1){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x109'),_0x5089c1[_0x7b64('0x38')]));return this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0x10a'));};AGIVertices[_0x7b64('0x16')][_0x7b64('0x10b')]=function(_0x4a2250){logger['info'](util[_0x7b64('0x29')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x4a2250['label']));var _0x54d2a2='';if(_0x4a2250['trunk_id']){if(!this['isConfigured'](_0x4a2250[_0x7b64('0x10c')])){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x4a2250,_0x7b64('0x10d'));}else{var _0x166b40=parseInt(_0x4a2250[_0x7b64('0x10c')],0xa);if(isNaN(_0x166b40)){_0x54d2a2=_0x4a2250['trunk_id'];}else{_0x54d2a2=this[_0x7b64('0x1e')]['sync'](this,_0x4a2250[_0x7b64('0x10c')]);if(!_0x54d2a2){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x4a2250,_0x7b64('0x10e'));}}}}else if(_0x4a2250['trunk_name']){_0x54d2a2=_0x4a2250[_0x7b64('0x10f')];}else{return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x4a2250,_0x7b64('0x10d'));}var _0x155146=this[_0x7b64('0x10')][_0x7b64('0xaf')]('DIAL',[util[_0x7b64('0x29')](_0x7b64('0x110'),_0x54d2a2,_0x4a2250['phone']),_0x4a2250[_0x7b64('0x63')],_0x4a2250[_0x7b64('0xe7')],_0x4a2250[_0x7b64('0x60')]]);if(_0x155146[_0x7b64('0xa5')]===-0x1){return _0x155146;}return this[_0x7b64('0x10')]['noop'](util[_0x7b64('0x29')](_0x7b64('0xe8'),_0x7b64('0xe5')));};AGIVertices[_0x7b64('0x16')]['finally']=function(_0x491c5a){logger[_0x7b64('0x2e')](util['format']('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x491c5a[_0x7b64('0x38')]));return this['channel'][_0x7b64('0xad')](_0x7b64('0x111'));};AGIVertices[_0x7b64('0x16')][_0x7b64('0xe')]=function(_0x12274f){logger['info'](util[_0x7b64('0x29')](_0x7b64('0x112'),_0x12274f['label']));if(_0x12274f[_0x7b64('0xaa')]===0x0){return this[_0x7b64('0xa7')](_0x12274f);}_0x12274f[_0x7b64('0xaa')]-=0x1;if(!this[_0x7b64('0x82')](_0x12274f[_0x7b64('0x113')])){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x12274f,_0x7b64('0x114'));}var _0x3a1911=this['getSound']['sync'](this,_0x12274f[_0x7b64('0x113')]);if(!_0x3a1911){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x12274f,_0x7b64('0x115'));}if(!this[_0x7b64('0x82')](_0x12274f[_0x7b64('0xd9')])){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x7b64('0xda'));}var _0x104b5e=this[_0x7b64('0x10')][_0x7b64('0x116')](_0x3a1911,_0x12274f[_0x7b64('0x117')],_0x12274f['maxdigit']);var _0x132d2a=_0x104b5e[_0x7b64('0xa5')]?_0x104b5e[_0x7b64('0xa5')][_0x7b64('0xa3')]():'';logger[_0x7b64('0x2e')](_0x7b64('0x118'),JSON[_0x7b64('0x6d')](_0x104b5e));if(_0x104b5e['result']===-0x1){this[_0x7b64('0xa8')][_0x7b64('0xa9')](this,_0x12274f,_0x132d2a);return _0x104b5e;}else if(_0x104b5e[_0x7b64('0xa6')]===_0x7b64('0x63')){_0x104b5e[_0x7b64('0xa5')]=_0x132d2a['length']>=parseInt(_0x12274f[_0x7b64('0x119')])?'x':'i';}else{_0x104b5e['result']=_0x132d2a[_0x7b64('0x9c')]>=parseInt(_0x12274f[_0x7b64('0x119')])&&_0x132d2a['length']<=parseInt(_0x12274f['maxdigit'])?'x':'i';}var _0x5c92dd=this['getVariable'][_0x7b64('0xa9')](this,_0x12274f[_0x7b64('0xd9')]);if(!_0x5c92dd){return this['channel'][_0x7b64('0x2c')](_0x12274f,_0x7b64('0xdb'));}this[_0x7b64('0x10')][_0x7b64('0xa0')](_0x5c92dd,_0x132d2a);if(this[_0x7b64('0x82')](_0x12274f[_0x7b64('0x11a')])){var _0x14690d=parseInt(_0x12274f[_0x7b64('0x11a')],0xa);var _0xebdeda=rs['generate']({'charset':'*','length':_0x14690d});var _0x29cab3=_0x132d2a[_0x7b64('0x9c')];if(_0x29cab3>0x0){if(_0x29cab3>_0x14690d){this[_0x7b64('0xa8')][_0x7b64('0xa9')](this,_0x12274f,_0x12274f['hiddendigitspos']==='first'?_0xebdeda+_0x132d2a[_0x7b64('0x11b')](_0x14690d):_0x132d2a['substr'](0x0,_0x29cab3-_0x14690d)+_0xebdeda);}else{this['createSquareDetailsReport'][_0x7b64('0xa9')](this,_0x12274f,rs[_0x7b64('0x11c')]({'charset':'*','length':_0x29cab3}));}}else{this[_0x7b64('0xa8')][_0x7b64('0xa9')](this,_0x12274f,'');}}else{this['createSquareDetailsReport'][_0x7b64('0xa9')](this,_0x12274f,_0x132d2a);}return _0x104b5e;};AGIVertices[_0x7b64('0x16')]['getsecretdigits']=function(_0x535aba){logger[_0x7b64('0x2e')](util['format'](_0x7b64('0x11d'),_0x535aba[_0x7b64('0x38')]));return this[_0x7b64('0xe')](_0x535aba);};AGIVertices[_0x7b64('0x16')][_0x7b64('0x11e')]=function(_0x4e5824){logger[_0x7b64('0x2e')](util['format']('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x4e5824[_0x7b64('0x38')]));this[_0x7b64('0xa8')][_0x7b64('0xa9')](this,_0x4e5824,_0x4e5824[_0x7b64('0x11f')]);return this[_0x7b64('0x10')][_0x7b64('0xad')](util['format'](_0x7b64('0x120'),_0x4e5824[_0x7b64('0x11f')]));};AGIVertices[_0x7b64('0x16')][_0x7b64('0x121')]=function(_0x19cb0d){logger[_0x7b64('0x2e')](util['format'](_0x7b64('0x122'),_0x19cb0d['label']));if(!this[_0x7b64('0x82')](_0x19cb0d[_0x7b64('0x85')])||!this['isConfigured'](_0x19cb0d[_0x7b64('0x86')])){return this[_0x7b64('0x10')][_0x7b64('0xad')]('no\x20valid\x20credentials\x20configured');}if(!this[_0x7b64('0x82')](_0x19cb0d[_0x7b64('0x59')])){return this['channel']['noop']('no\x20text\x20configured');}this[_0x7b64('0x10')][_0x7b64('0xad')](util['format'](_0x7b64('0x123'),_0x19cb0d['text']));var _0x5eb4b2=this[_0x7b64('0x84')][_0x7b64('0xa9')](this,_0x19cb0d);if(_0x5eb4b2){this[_0x7b64('0x10')][_0x7b64('0xad')](util[_0x7b64('0x29')]('aws\x20Polly\x20%s\x20file\x20created',_0x5eb4b2));var _0x4a6a20=this[_0x7b64('0x10')][_0x7b64('0x124')](_0x5eb4b2);try{fs[_0x7b64('0x106')](_0x5eb4b2+_0x7b64('0x107'));}catch(_0x479ffb){logger['error'](_0x479ffb);}return _0x4a6a20;}return this['channel'][_0x7b64('0x2c')](_0x19cb0d,_0x7b64('0x125'));};AGIVertices[_0x7b64('0x16')][_0x7b64('0x126')]=function(_0x6bd02f){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x127'),_0x6bd02f[_0x7b64('0x38')]));if(!this[_0x7b64('0x82')](_0x6bd02f['aws_access_key_id'])||!this['isConfigured'](_0x6bd02f[_0x7b64('0x86')])){return this['channel']['noop'](_0x7b64('0x128'));}if(!this['isConfigured'](_0x6bd02f[_0x7b64('0x8d')])){return this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0x129'));}if(!this['isConfigured'](_0x6bd02f[_0x7b64('0x59')])){return this[_0x7b64('0x10')][_0x7b64('0xad')]('no\x20text\x20configured');}this[_0x7b64('0x10')][_0x7b64('0xec')]=!![];this[_0x7b64('0xa8')](_0x6bd02f);this['createSquareMessage'](_0x6bd02f[_0x7b64('0x59')],'in','','');this[_0x7b64('0x10')][_0x7b64('0xad')](util['format'](_0x7b64('0x12a'),_0x6bd02f['text']));var _0x533940=this[_0x7b64('0x8b')][_0x7b64('0xa9')](this,_0x6bd02f);if(_0x533940){for(var _0x40e194 in _0x533940){if(_0x533940['hasOwnProperty'](_0x40e194)&&_[_0x7b64('0x95')](_0x533940[_0x40e194])){this[_0x7b64('0x10')][_0x7b64('0xa0')](util[_0x7b64('0x29')](_0x7b64('0x12b'),_0x40e194['toUpperCase']()),_0x533940[_0x40e194]);}}if(_['isNil'](_0x533940[_0x7b64('0x71')])){return this[_0x7b64('0x10')]['noop']('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0x7b64('0x42')](_0x533940[_0x7b64('0x71')],_0x7b64('0xfb'),'amazonlex','');return this[_0x7b64('0x10')]['noop'](util['format']('Amazon\x20Lex\x20Result\x20%s',_0x533940[_0x7b64('0x71')]));}}return this[_0x7b64('0x10')]['error'](_0x6bd02f,_0x7b64('0x12c'));};AGIVertices[_0x7b64('0x16')][_0x7b64('0x12d')]=function(_0x134981){logger['info'](util[_0x7b64('0x29')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x134981[_0x7b64('0x38')],_0x134981[_0x7b64('0x63')]));if(!this['isConfigured'](_0x134981['key'])){return this[_0x7b64('0x10')][_0x7b64('0xad')]('no\x20key\x20configured');}var _0x4d8d69=_0x7b64('0x12e');var _0x2ce963=util['format']('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x1eed06=util['format'](_0x7b64('0x9f'),_0x2ce963,_0x4d8d69);var _0x32b3b6=!![];if(_0x134981[_0x7b64('0x12f')]===_0x7b64('0x130')){_0x32b3b6=![];}var _0x33dfe3=this['channel'][_0x7b64('0x131')](_0x2ce963,_0x4d8d69,_0x134981[_0x7b64('0x132')],_0x134981[_0x7b64('0x63')],undefined,_0x32b3b6);if(_0x33dfe3[_0x7b64('0xa5')]!==-0x1){this[_0x7b64('0x10')][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0x133'),_0x1eed06));var _0x2e6d30=this[_0x7b64('0x8e')]['sync'](this,_0x134981,_0x1eed06);if(_0x2e6d30){for(var _0x5a3e3b in _0x2e6d30){if(_0x2e6d30[_0x7b64('0x9a')](_0x5a3e3b)){this[_0x7b64('0x10')]['setVariable'](util[_0x7b64('0x29')]('GOOGLE_ASR_%s',_0x5a3e3b[_0x7b64('0x66')]()),_0x2e6d30[_0x5a3e3b]);}}return this[_0x7b64('0x10')][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0x134'),JSON[_0x7b64('0x6d')](_0x2e6d30)));}}return _0x33dfe3;};AGIVertices[_0x7b64('0x16')][_0x7b64('0x135')]=function(_0x1b0a69){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x136'),_0x1b0a69['label']));if(!this[_0x7b64('0x82')](_0x1b0a69[_0x7b64('0x91')])){return this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0x137'));}if(!this[_0x7b64('0x82')](_0x1b0a69[_0x7b64('0x138')])){return this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0x139'));}var _0x342a12=_0x7b64('0x12e');var _0x4916dc=util[_0x7b64('0x29')](_0x7b64('0x13a'),FILES_PATH,rs[_0x7b64('0x11c')](0x4));var _0x36ab58=util[_0x7b64('0x29')](_0x7b64('0x9f'),_0x4916dc,_0x342a12);var _0x4f9da6=!![];if(_0x1b0a69[_0x7b64('0x12f')]===_0x7b64('0x130')){_0x4f9da6=![];}var _0x120a65=this[_0x7b64('0x10')][_0x7b64('0x131')](_0x4916dc,_0x342a12,_0x1b0a69[_0x7b64('0x132')],_0x1b0a69[_0x7b64('0x63')],undefined,_0x4f9da6);if(_0x120a65[_0x7b64('0xa5')]!==-0x1){this[_0x7b64('0x10')][_0x7b64('0xad')](util['format'](_0x7b64('0x13b'),_0x36ab58));var _0x2e8f75=this[_0x7b64('0x90')][_0x7b64('0xa9')](this,_0x1b0a69,_0x36ab58);if(_0x2e8f75){for(var _0x21b575 in _0x2e8f75){if(_0x2e8f75['hasOwnProperty'](_0x21b575)){this['channel'][_0x7b64('0xa0')](util['format'](_0x7b64('0x13c'),_0x21b575[_0x7b64('0x66')]()),_0x2e8f75[_0x21b575]);}}return this['channel']['noop'](util[_0x7b64('0x29')](_0x7b64('0x13d'),JSON[_0x7b64('0x6d')](_0x2e8f75)));}}return _0x120a65;};AGIVertices[_0x7b64('0x16')][_0x7b64('0x13e')]=function(_0x1d65da){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x13f'),_0x1d65da[_0x7b64('0x38')]));return this[_0x7b64('0x10')][_0x7b64('0x140')](_0x1d65da[_0x7b64('0x3d')],_0x1d65da[_0x7b64('0x3e')],_0x1d65da[_0x7b64('0x3f')]);};AGIVertices[_0x7b64('0x16')][_0x7b64('0x141')]=function(_0x4341ed){logger[_0x7b64('0x2e')](util['format'](_0x7b64('0x142'),_0x4341ed[_0x7b64('0x38')]));if(!this[_0x7b64('0x82')](_0x4341ed[_0x7b64('0x143')])){return this[_0x7b64('0x10')]['error'](_0x4341ed,_0x7b64('0x144'));}try{var _0x5181f0=eval(_0x4341ed['condition'])?'true':'false';this[_0x7b64('0x10')][_0x7b64('0xad')](util[_0x7b64('0x29')]('EVAL\x20CONDITION\x20%s\x20%s',_0x4341ed['condition'],_0x5181f0));return{'code':0xc8,'result':_0x5181f0};}catch(_0x5d22fd){return{'code':0xc8,'result':_0x7b64('0x145')};}};AGIVertices[_0x7b64('0x16')]['gotoiftime']=function(_0x4ad1a8){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x146'),_0x4ad1a8[_0x7b64('0x38')]));if(!this[_0x7b64('0x82')](_0x4ad1a8[_0x7b64('0x147')])){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x4ad1a8,_0x7b64('0x148'));}var _0x137900=this[_0x7b64('0x25')][_0x7b64('0xa9')](this,_0x4ad1a8[_0x7b64('0x147')]);if(!_0x137900){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x4ad1a8,'no\x20intervals\x20found');}for(var _0x45516b=0x0;_0x45516b<_0x137900[_0x7b64('0x9c')];_0x45516b+=0x1){var _0x2331a4=this[_0x7b64('0x10')][_0x7b64('0xa4')](util['format'](_0x7b64('0x149'),_0x137900[_0x45516b]));if(_0x2331a4[_0x7b64('0xa5')]===-0x1){return _0x2331a4;}logger['info'](util['format']('IFTIME\x20%s\x20%s',_0x137900[_0x45516b],_0x2331a4[_0x7b64('0xa6')]));if(_0x2331a4[_0x7b64('0xa6')]===_0x7b64('0x14a')){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x14b'),_0x137900[_0x45516b],_0x7b64('0x14a')));this[_0x7b64('0x10')][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0x14b'),_0x137900[_0x45516b],_0x7b64('0x14a')));return{'code':0xc8,'result':_0x7b64('0x14a')};}else{logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x14b'),_0x137900[_0x45516b],'false'));this[_0x7b64('0x10')]['noop'](util[_0x7b64('0x29')](_0x7b64('0x14b'),_0x137900[_0x45516b],_0x7b64('0x145')));}}return{'code':0xc8,'result':_0x7b64('0x145')};};AGIVertices[_0x7b64('0x16')][_0x7b64('0x14c')]=function(_0x58aa62){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x14d'),_0x58aa62['label']));return this['channel']['hangup']();};AGIVertices[_0x7b64('0x16')][_0x7b64('0x14e')]=function(_0x4ee634){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x14f'),_0x4ee634[_0x7b64('0x38')]));if(!this[_0x7b64('0x82')](_0x4ee634[_0x7b64('0x75')])){return this[_0x7b64('0x10')]['noop'](_0x7b64('0xeb'));}var _0x2a13f9=_0x7b64('0x12e');var _0x21752f=util[_0x7b64('0x29')](_0x7b64('0x13a'),FILES_PATH,rs['generate'](0x4));var _0x31dcd2=util[_0x7b64('0x29')](_0x7b64('0x9f'),_0x21752f,_0x2a13f9);var _0x44e0ae=!![];if(_0x4ee634[_0x7b64('0x12f')]===_0x7b64('0x130')){_0x44e0ae=![];}var _0x28ab50=this[_0x7b64('0x10')][_0x7b64('0x131')](_0x21752f,_0x2a13f9,_0x4ee634[_0x7b64('0x132')],_0x4ee634[_0x7b64('0x63')],undefined,_0x44e0ae);if(_0x28ab50[_0x7b64('0xa5')]!==-0x1){this['channel']['noop'](util['format'](_0x7b64('0x150'),_0x31dcd2));var _0x1340e6=this[_0x7b64('0x80')][_0x7b64('0xa9')](this,_0x4ee634,_0x31dcd2);if(_0x1340e6){for(var _0x5134f3 in _0x1340e6){if(_0x1340e6[_0x7b64('0x9a')](_0x5134f3)){this[_0x7b64('0x10')]['setVariable'](util[_0x7b64('0x29')]('ISPEECH_ASR_%s',_0x5134f3[_0x7b64('0x66')]()),_0x1340e6[_0x5134f3]);}}return this[_0x7b64('0x10')][_0x7b64('0xad')](util['format']('IspeechASR\x20Result\x20%s',JSON[_0x7b64('0x6d')](_0x1340e6)));}}return _0x28ab50;};AGIVertices[_0x7b64('0x16')][_0x7b64('0x151')]=function(_0x19c83a){logger['info'](util[_0x7b64('0x29')](_0x7b64('0x152'),_0x19c83a[_0x7b64('0x38')]));if(!this[_0x7b64('0x82')](_0x19c83a[_0x7b64('0x75')])){return this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0xeb'));}if(!this['isConfigured'](_0x19c83a[_0x7b64('0x59')])){return this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0xae'));}this[_0x7b64('0x10')]['noop'](util[_0x7b64('0x29')](_0x7b64('0x153'),_0x19c83a[_0x7b64('0x59')]));var _0x1f7e21=this[_0x7b64('0x7c')][_0x7b64('0xa9')](this,_0x19c83a);if(_0x1f7e21){this['channel'][_0x7b64('0xad')](util[_0x7b64('0x29')]('ispeech\x20%s\x20file\x20created',_0x1f7e21));var _0x36ec06=this['channel'][_0x7b64('0x124')](_0x1f7e21,_0x19c83a['intKey']);try{fs[_0x7b64('0x106')](_0x1f7e21+'.wav');}catch(_0x1fb44b){logger['error'](_0x1fb44b);}return _0x36ec06;}return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x19c83a,_0x7b64('0x154'));};AGIVertices[_0x7b64('0x16')][_0x7b64('0x155')]=function(_0x32cb74){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x156'),_0x32cb74[_0x7b64('0x38')]));if(!this[_0x7b64('0x82')](_0x32cb74['findBy'])){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x32cb74,'no\x20find\x20by\x20configured');}logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x157'),this[_0x7b64('0x10')]['callerid'],_0x32cb74[_0x7b64('0x158')]));var _0xa3c52=this[_0x7b64('0x52')][_0x7b64('0xa9')](this,_0x32cb74['findBy']);if(_0xa3c52){logger['info'](util['format'](_0x7b64('0x159'),this[_0x7b64('0x10')][_0x7b64('0x3a')],_0x32cb74['findBy']));this[_0x7b64('0x10')]['noop'](util[_0x7b64('0x29')](_0x7b64('0x159'),this[_0x7b64('0x10')][_0x7b64('0x3a')],_0x32cb74[_0x7b64('0x158')]));return{'code':0xc8,'result':_0x7b64('0x15a')};}else{logger[_0x7b64('0x2e')](util['format'](_0x7b64('0x15b'),this[_0x7b64('0x10')][_0x7b64('0x3a')],_0x32cb74[_0x7b64('0x158')]));this[_0x7b64('0x10')]['noop'](util['format'](_0x7b64('0x15b'),this[_0x7b64('0x10')][_0x7b64('0x3a')],_0x32cb74[_0x7b64('0x158')]));return{'code':0xc8,'result':_0x7b64('0x15c')};}};AGIVertices[_0x7b64('0x16')][_0x7b64('0x15d')]=function(_0x44146d){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x15e'),_0x44146d[_0x7b64('0x38')]));if(!this['isConfigured'](_0x44146d[_0x7b64('0x158')])){return this[_0x7b64('0x10')]['error'](_0x44146d,_0x7b64('0x15f'));}logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x157'),this[_0x7b64('0x10')][_0x7b64('0x3a')],_0x44146d[_0x7b64('0x158')]));var _0x237891=this[_0x7b64('0x51')][_0x7b64('0xa9')](this,_0x44146d['findBy']);if(_0x237891){logger[_0x7b64('0x2e')](util['format'](_0x7b64('0x159'),this[_0x7b64('0x10')]['callerid'],_0x44146d[_0x7b64('0x158')]));this[_0x7b64('0x10')]['noop'](util['format'](_0x7b64('0x159'),this[_0x7b64('0x10')][_0x7b64('0x3a')],_0x44146d['findBy']));return{'code':0xc8,'result':_0x7b64('0x15a')};}else{logger['info'](util[_0x7b64('0x29')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x7b64('0x10')]['callerid'],_0x44146d['findBy']));this[_0x7b64('0x10')][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0x15b'),this[_0x7b64('0x10')][_0x7b64('0x3a')],_0x44146d['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x7b64('0x16')][_0x7b64('0x160')]=function(_0x560152){logger['info'](util[_0x7b64('0x29')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x560152['label']));if(!this[_0x7b64('0x82')](_0x560152[_0x7b64('0x161')])){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x560152,'no\x20operation\x20configured');}this[_0x7b64('0x10')]['noop'](util[_0x7b64('0x29')](_0x7b64('0x162'),_0x560152[_0x7b64('0x161')]));var _0x517a79=eval(_0x560152[_0x7b64('0x161')]);if(!this[_0x7b64('0x82')](_0x560152[_0x7b64('0xd9')])){return this[_0x7b64('0x10')]['noop'](_0x7b64('0xda'));}var _0xdb98f3=this['getVariable'][_0x7b64('0xa9')](this,_0x560152[_0x7b64('0xd9')]);if(!_0xdb98f3){return this['channel'][_0x7b64('0x2c')](_0x560152,_0x7b64('0xdb'));}if(_[_0x7b64('0x9b')](_0x517a79)){var _0x54ff27=this;_0x517a79[_0x7b64('0xdc')](function(_0x4dfed7,_0x325235){_0x54ff27['channel'][_0x7b64('0xa0')](util[_0x7b64('0x29')](_0x7b64('0x163'),_0xdb98f3,_0x325235),_0x4dfed7);});return this[_0x7b64('0x10')][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0x164'),_0xdb98f3));}else{return this[_0x7b64('0x10')][_0x7b64('0xa0')](_0xdb98f3,_0x517a79);}};AGIVertices[_0x7b64('0x16')][_0x7b64('0xd')]=function(_0x40d0cc){logger[_0x7b64('0x2e')](util['format'](_0x7b64('0x165'),_0x40d0cc[_0x7b64('0x38')]));if(_0x40d0cc[_0x7b64('0xaa')]===0x0){return this[_0x7b64('0xa7')](_0x40d0cc);}_0x40d0cc[_0x7b64('0xaa')]-=0x1;if(!this['isConfigured'](_0x40d0cc[_0x7b64('0x113')])){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x40d0cc,_0x7b64('0x114'));}var _0x35aa14=this[_0x7b64('0x166')][_0x7b64('0xa9')](this,_0x40d0cc[_0x7b64('0x113')]);if(!_0x35aa14){return this['channel'][_0x7b64('0x2c')](_0x40d0cc,'no\x20file\x20audio\x20found');}var _0x82915b=this[_0x7b64('0x10')][_0x7b64('0x116')](_0x35aa14,_0x40d0cc[_0x7b64('0x117')],_0x40d0cc[_0x7b64('0x167')]);var _0xe51ed8=_0x82915b['result'];if(_0x82915b[_0x7b64('0xa5')]===-0x1){this['createSquareDetailsReport'][_0x7b64('0xa9')](this,_0x40d0cc,'-1');return _0x82915b;}else if(_0x82915b['extra']===_0x7b64('0x63')){_0x82915b[_0x7b64('0xa5')]=_0x82915b[_0x7b64('0xa5')][_0x7b64('0x9c')]>0x0?_0x82915b[_0x7b64('0xa5')]:'t';}else if(_[_0x7b64('0x44')](_0x82915b[_0x7b64('0xa5')])){_0x82915b[_0x7b64('0xa5')]='#';_0xe51ed8='#';}if(!this[_0x7b64('0x82')](_0x40d0cc['variable_id'])){this[_0x7b64('0x10')][_0x7b64('0xad')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x43a841=this[_0x7b64('0xa4')][_0x7b64('0xa9')](this,_0x40d0cc[_0x7b64('0xd9')]);if(!_0x43a841){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x40d0cc,_0x7b64('0xdb'));}this[_0x7b64('0x10')][_0x7b64('0xa0')](_0x43a841,_0xe51ed8);}this[_0x7b64('0xa8')][_0x7b64('0xa9')](this,_0x40d0cc,_0xe51ed8);return _0x82915b;};AGIVertices[_0x7b64('0x16')]['noop']=function(_0x360e5e){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x360e5e[_0x7b64('0x38')]));return this[_0x7b64('0x10')]['noop'](_0x360e5e[_0x7b64('0x168')]||_0x360e5e[_0x7b64('0x38')]);};AGIVertices[_0x7b64('0x16')][_0x7b64('0x169')]=function(_0x3b0d67){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x16a'),_0x3b0d67[_0x7b64('0x38')]));if(!this[_0x7b64('0x82')](_0x3b0d67['findBy'])){return this[_0x7b64('0x10')]['error'](_0x3b0d67,_0x7b64('0x15f'));}logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x157'),this[_0x7b64('0x10')]['callerid'],_0x3b0d67['findBy']));var _0x453cc6=this[_0x7b64('0x4d')]['sync'](this,_0x3b0d67[_0x7b64('0x16b')]);var _0x406309=this[_0x7b64('0x4e')][_0x7b64('0xa9')](this,_0x3b0d67[_0x7b64('0x158')],_0x453cc6);if(_0x406309){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x159'),this[_0x7b64('0x10')][_0x7b64('0x3a')],_0x3b0d67[_0x7b64('0x158')]));this[_0x7b64('0x10')][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0x159'),this[_0x7b64('0x10')][_0x7b64('0x3a')],_0x3b0d67[_0x7b64('0x158')]));return{'code':0xc8,'result':_0x7b64('0x15a')};}else{logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x15b'),this[_0x7b64('0x10')][_0x7b64('0x3a')],_0x3b0d67[_0x7b64('0x158')]));this['channel'][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0x159'),this['channel'][_0x7b64('0x3a')],_0x3b0d67['findBy']));return{'code':0xc8,'result':_0x7b64('0x15c')};}};AGIVertices[_0x7b64('0x16')][_0x7b64('0x16c')]=function(_0x3f32ff){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x3f32ff['label']));if(!this[_0x7b64('0x82')](_0x3f32ff[_0x7b64('0x113')])){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x3f32ff,_0x7b64('0x114'));}var _0x2031b7=this[_0x7b64('0x166')][_0x7b64('0xa9')](this,_0x3f32ff[_0x7b64('0x113')]);if(!_0x2031b7){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x3f32ff,_0x7b64('0x115'));}var _0x521030=this[_0x7b64('0x10')][_0x7b64('0xaf')](_0x7b64('0x16d'),[_0x2031b7,_0x3f32ff[_0x7b64('0xe7')]]);if(_0x521030['result']===-0x1){return _0x521030;}return this[_0x7b64('0x10')][_0x7b64('0xad')](util[_0x7b64('0x29')]('Executed\x20command\x20%s\x20%s','PLAYBACK',_0x2031b7));};AGIVertices[_0x7b64('0x16')][_0x7b64('0x16e')]=function(_0x845e8d){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x16f'),_0x845e8d[_0x7b64('0x38')]));if(!this[_0x7b64('0x82')](_0x845e8d[_0x7b64('0x170')])){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x845e8d,_0x7b64('0x171'));}var _0x3f18dd='';var _0x393591=parseInt(_0x845e8d['queue_id'],0xa);if(isNaN(_0x393591)){_0x3f18dd=_0x845e8d[_0x7b64('0x170')];}else{_0x3f18dd=this[_0x7b64('0x172')]['sync'](this,_0x845e8d[_0x7b64('0x170')]);if(!_0x3f18dd){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x845e8d,_0x7b64('0x173'));}}var _0x1437a7='';if(this[_0x7b64('0x82')](_0x845e8d[_0x7b64('0x113')])){var _0x376a55=this[_0x7b64('0x166')]['sync'](this,_0x845e8d[_0x7b64('0x113')]);if(_0x376a55){_0x1437a7=_0x376a55;}}this[_0x7b64('0xa8')][_0x7b64('0xa9')](this,_0x845e8d,_0x3f18dd);if(_0x845e8d[_0x7b64('0xe7')][_0x7b64('0x174')]('x')<0x0){_0x845e8d[_0x7b64('0xe7')]+='x';}if(_0x845e8d[_0x7b64('0xe7')][_0x7b64('0x174')]('X')<0x0){_0x845e8d[_0x7b64('0xe7')]+='X';}this[_0x7b64('0x10')][_0x7b64('0xa0')]('XMCS-QUEUE',_0x3f18dd?_0x3f18dd[_0x7b64('0x175')]():'');var _0x1b7471=this[_0x7b64('0x10')]['exec'](_0x7b64('0x176'),[_0x3f18dd,_0x845e8d[_0x7b64('0xe7')],_0x845e8d[_0x7b64('0x60')],_0x1437a7,_0x845e8d[_0x7b64('0x63')],_0x845e8d[_0x7b64('0x8')],_0x845e8d[_0x7b64('0x177')],_0x845e8d[_0x7b64('0x178')],'',_0x845e8d[_0x7b64('0x179')]]);if(_0x1b7471[_0x7b64('0xa5')]===-0x1){return _0x1b7471;}return this['channel'][_0x7b64('0xad')](util[_0x7b64('0x29')]('Executed\x20command\x20%s\x20%s',_0x7b64('0x176'),_0x3f18dd));};AGIVertices[_0x7b64('0x16')][_0x7b64('0x17a')]=function(_0x4943e1){logger['info'](util[_0x7b64('0x29')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x4943e1['label']));var _0x408f5c=_0x4943e1[_0x7b64('0x17b')]||_0x7b64('0x12e');var _0x5d17e8=util[_0x7b64('0x29')](_0x7b64('0x17c'),this[_0x7b64('0x10')][_0x7b64('0x37')],rs[_0x7b64('0x11c')](0x5));var _0xfab296=util[_0x7b64('0x29')]('%s/recordings/%s.%s',FILES_PATH,_0x5d17e8,_0x408f5c);var _0x698637=util[_0x7b64('0x29')]('%s/recordings/%s',FILES_PATH,_0x5d17e8);this[_0x7b64('0x3b')]['sync'](this,_0x4943e1,_0x5d17e8,_0xfab296);this[_0x7b64('0x10')][_0x7b64('0xa0')](_0x7b64('0x17d'),_0x5d17e8);logger[_0x7b64('0x2e')](_0x7b64('0x17e'),_0x698637,_0x408f5c,_0x4943e1[_0x7b64('0x17f')],_0x4943e1['timeout']);return this[_0x7b64('0x10')][_0x7b64('0x131')](_0x698637,_0x408f5c,_0x4943e1['escape_digits'],_0x4943e1[_0x7b64('0x63')],undefined,!![]);};AGIVertices[_0x7b64('0x16')][_0x7b64('0x180')]=function(_0x1e9b5b){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x181'),_0x1e9b5b[_0x7b64('0x38')]));if(!this[_0x7b64('0x82')](_0x1e9b5b['url'])){return this[_0x7b64('0x10')]['noop'](_0x7b64('0x182'));}var _0x3cd531=this['restAPI'][_0x7b64('0xa9')](this,_0x1e9b5b);logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x183'),util[_0x7b64('0x184')](_0x3cd531,{'showHidden':![],'depth':null})));if(!this[_0x7b64('0x82')](_0x1e9b5b[_0x7b64('0xd9')])){return this['channel'][_0x7b64('0xad')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x5a7fcb=this[_0x7b64('0xa4')][_0x7b64('0xa9')](this,_0x1e9b5b['variable_id']);if(!_0x5a7fcb){return this[_0x7b64('0x10')]['error'](_0x1e9b5b,_0x7b64('0xdb'));}this['channel']['setVariable'](util[_0x7b64('0x29')](_0x7b64('0x185'),_0x5a7fcb),_0x3cd531['statusCode']?_0x3cd531['statusCode']:_0x7b64('0x186'));this[_0x7b64('0x10')][_0x7b64('0xa0')](util['format'](_0x7b64('0x187'),_0x5a7fcb),_0x3cd531[_0x7b64('0x70')]?_0x3cd531[_0x7b64('0x70')]:'OK');if(_0x3cd531[_0x7b64('0x6e')]){try{this[_0x7b64('0x9e')](_0x3cd531[_0x7b64('0x6e')],_0x5a7fcb);}catch(_0x4f0f42){logger[_0x7b64('0x2c')](util[_0x7b64('0x29')](_0x7b64('0x188'),_0x5a7fcb));}}return this['channel'][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0xdf'),_0x5a7fcb));};AGIVertices[_0x7b64('0x16')]['saydigits']=function(_0x48db34){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x189'),_0x48db34[_0x7b64('0x38')]));return this[_0x7b64('0x10')][_0x7b64('0x18a')](_0x48db34[_0x7b64('0x18b')][_0x7b64('0x18c')](/\s+/g,''),_0x48db34['escape_digits']);};AGIVertices[_0x7b64('0x16')]['saynumber']=function(_0x3b8844){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x18d'),_0x3b8844['label']));return this[_0x7b64('0x10')][_0x7b64('0x18e')](_0x3b8844[_0x7b64('0x62')][_0x7b64('0x18c')](/\s+/g,''),_0x3b8844['escape_digits']);};AGIVertices[_0x7b64('0x16')][_0x7b64('0x18f')]=function(_0x1ad60b){logger['info'](util[_0x7b64('0x29')](_0x7b64('0x190'),_0x1ad60b['label']));return this[_0x7b64('0x10')][_0x7b64('0x191')](_0x1ad60b['text'],_0x1ad60b[_0x7b64('0x17f')]);};AGIVertices['prototype']['sendMail']=function(_0x380903){logger['info'](util[_0x7b64('0x29')](_0x7b64('0x192'),_0x380903[_0x7b64('0x38')]));if(!this[_0x7b64('0x82')](_0x380903[_0x7b64('0x193')])){return this[_0x7b64('0x10')]['noop'](_0x7b64('0x194'));}var _0x971ca9=this[_0x7b64('0x195')]['sync'](this,_0x380903[_0x7b64('0x193')]);if(!_0x971ca9||!_0x971ca9[_0x7b64('0x196')]){return this['channel'][_0x7b64('0x2c')](_0x380903,_0x7b64('0x197'));}var _0x22aa57={'from':util[_0x7b64('0x29')](_0x7b64('0x198'),_0x971ca9[_0x7b64('0x14')],_0x971ca9['email']||_0x971ca9[_0x7b64('0x196')][_0x7b64('0x199')]),'to':_0x380903['to']||'','cc':_0x380903['cc']||'','bcc':_0x380903['bcc']||'','subject':_0x380903[_0x7b64('0x19a')],'html':_0x380903[_0x7b64('0x59')],'text':_0x380903[_0x7b64('0x59')]};if(this[_0x7b64('0x82')](_0x380903[_0x7b64('0x19b')])){}logger['debug'](_0x7b64('0x19c'),JSON[_0x7b64('0x6d')](_0x22aa57));this[_0x7b64('0xa8')][_0x7b64('0xa9')](this,_0x380903,_0x380903[_0x7b64('0x193')]);this[_0x7b64('0x10')]['noop'](util['format']('Trying\x20SendMail\x20with\x20account\x20%s',_0x971ca9[_0x7b64('0x14')]));this['sendMailMessage'][_0x7b64('0xa9')](this,_0x971ca9[_0x7b64('0x19d')],_0x22aa57);return this[_0x7b64('0x10')]['noop'](_0x7b64('0x19e'));};AGIVertices[_0x7b64('0x16')][_0x7b64('0x19f')]=function(_0x5b9df1){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x1a0'),_0x5b9df1[_0x7b64('0x38')]));return this[_0x7b64('0x10')][_0x7b64('0xad')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0x7b64('0x16')][_0x7b64('0x1a1')]=function(_0xc953c2){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x1a2'),_0xc953c2['label']));if(!this[_0x7b64('0x82')](_0xc953c2[_0x7b64('0x1a3')])){return this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0x1a4'));}var _0xf3729f=this[_0x7b64('0x34')][_0x7b64('0xa9')](this,_0xc953c2['sms_account_id']);if(!_0xf3729f){return this['channel'][_0x7b64('0x2c')](_0xc953c2,_0x7b64('0x1a5'));}var _0xb68e0b={'body':_0xc953c2[_0x7b64('0x1a6')],'phone':_0xc953c2['to']||'','SmsAccountId':_0xf3729f['id']};logger['debug'](_0x7b64('0x1a7'),JSON[_0x7b64('0x6d')](_0xb68e0b));this['createSquareDetailsReport'][_0x7b64('0xa9')](this,_0xc953c2,_0xc953c2[_0x7b64('0x1a3')]);this['channel'][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0x1a8'),_0xf3729f[_0x7b64('0x14')]));this[_0x7b64('0x36')][_0x7b64('0xa9')](this,_0xb68e0b);return this[_0x7b64('0x10')]['noop']('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices['prototype'][_0x7b64('0x1a9')]=function(_0xb1e261){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x1aa'),_0xb1e261['label']));if(!this['isConfigured'](_0xb1e261[_0x7b64('0xd9')])){return this['channel']['error'](_0xb1e261,_0x7b64('0x1ab'));}var _0x316ecd=this['getVariable'][_0x7b64('0xa9')](this,_0xb1e261[_0x7b64('0xd9')]);if(!_0x316ecd){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0xb1e261,_0x7b64('0xdb'));}return this[_0x7b64('0x10')]['setVariable'](_0x316ecd,_0xb1e261['variable_value']);};AGIVertices[_0x7b64('0x16')]['start']=function(_0x2441d7){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x1ac'),_0x2441d7[_0x7b64('0x38')]));this['channel'][_0x7b64('0xad')](_0x7b64('0x1ad'));var _0x5d4e46=this['channel'][_0x7b64('0xa4')](_0x7b64('0x1ae'));if(!_[_0x7b64('0x44')](_0x5d4e46[_0x7b64('0xa6')])){this['channel'][_0x7b64('0x37')]=_0x5d4e46[_0x7b64('0xa6')];}if(_0x2441d7['answer']==='yes'){this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0x1af'));return this[_0x7b64('0x10')]['answer']();}return this['channel'][_0x7b64('0xad')](_0x7b64('0x1b0'));};AGIVertices[_0x7b64('0x16')]['subproject']=function(_0x7d47c8){logger['info'](util[_0x7b64('0x29')](_0x7b64('0x1b1'),_0x7d47c8[_0x7b64('0x38')]));if(!this[_0x7b64('0x82')](_0x7d47c8[_0x7b64('0x1b2')])){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x7d47c8,_0x7b64('0x1b3'));}var _0x3dce90=this[_0x7b64('0x1b4')][_0x7b64('0xa9')](this,_0x7d47c8['project_id']);if(!this['isConfigured'](_0x3dce90)){return this['channel'][_0x7b64('0x2c')](_0x7d47c8,util[_0x7b64('0x29')](_0x7b64('0x1b5'),_0x7d47c8['project_id']));}if(_0x3dce90===this['channel'][_0x7b64('0x39')]){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x7d47c8,_0x7b64('0x1b6'));}this[_0x7b64('0xa8')][_0x7b64('0xa9')](this,_0x7d47c8,_0x3dce90);var _0x15a1e2=this[_0x7b64('0x10')][_0x7b64('0xaf')](_0x7b64('0x1b7'),util[_0x7b64('0x29')](_0x7b64('0x1b8'),config['agi'][_0x7b64('0x1b9')]||_0x7b64('0x1ba'),_0x3dce90,this[_0x7b64('0x10')]['arg_1']));if(_0x15a1e2[_0x7b64('0xa5')]===-0x1){return _0x15a1e2;}return this[_0x7b64('0x10')]['noop'](util[_0x7b64('0x29')]('Executed\x20command\x20%s\x20%s',_0x7b64('0x1b7'),_0x3dce90));};AGIVertices[_0x7b64('0x16')][_0x7b64('0x1bb')]=function(_0x9ab405){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x1bc'),_0x9ab405['label']));var _0x4d7d11=this[_0x7b64('0x1bd')][_0x7b64('0xa9')](this,_0x9ab405[_0x7b64('0x1be')]);this[_0x7b64('0xa8')][_0x7b64('0xa9')](this,_0x9ab405,_0x9ab405[_0x7b64('0x1be')]);if(this[_0x7b64('0x82')](_0x9ab405[_0x7b64('0xd9')])){var _0x2ce64f=this[_0x7b64('0xa4')][_0x7b64('0xa9')](this,_0x9ab405['variable_id']);if(_0x2ce64f){this['channel'][_0x7b64('0xa0')](_0x2ce64f,_0x4d7d11);return this['channel'][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0x1bf'),_0x9ab405[_0x7b64('0x1be')],_0x2ce64f));}}return this[_0x7b64('0x10')][_0x7b64('0xad')](util['format']('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x9ab405[_0x7b64('0x1be')]));};AGIVertices[_0x7b64('0x16')][_0x7b64('0x1c0')]=function(_0x3d7cd0){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x3d7cd0[_0x7b64('0x38')]));_0x3d7cd0['text']=_0x3d7cd0[_0x7b64('0x59')][_0x7b64('0x18c')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x3d7cd0[_0x7b64('0x1c1')])){return this[_0x7b64('0x10')]['noop'](_0x7b64('0x1c2'));}if(!this['isConfigured'](_0x3d7cd0['text'])){return this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0xae'));}this['channel'][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0x1c3'),_0x3d7cd0[_0x7b64('0x59')]));var _0x490e67=this['googleCloudTTS']['sync'](this,_0x3d7cd0);if(_0x490e67){this['channel'][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0x1c4'),_0x490e67));var _0x308d80=this[_0x7b64('0x10')][_0x7b64('0x124')](_0x490e67);try{fs['unlink'](_0x490e67+'.wav');}catch(_0x31d4f8){logger[_0x7b64('0x2c')](_0x31d4f8);}return _0x308d80;}return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x3d7cd0,_0x7b64('0x1c5'));};AGIVertices[_0x7b64('0x16')][_0x7b64('0x1c6')]=function(_0x5abe72){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x1c7'),_0x5abe72[_0x7b64('0x38')]));_0x5abe72[_0x7b64('0x59')]=_0x5abe72[_0x7b64('0x59')][_0x7b64('0x18c')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x5abe72[_0x7b64('0x59')])){return this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0xae'));}this['channel'][_0x7b64('0xad')](util['format'](_0x7b64('0x1c8'),_0x5abe72['text']));var _0x5e3627=this[_0x7b64('0x5d')][_0x7b64('0xa9')](this,_0x5abe72);if(_0x5e3627){this[_0x7b64('0x10')]['noop'](util[_0x7b64('0x29')](_0x7b64('0x1c9'),_0x5e3627));var _0x31ab17=this[_0x7b64('0x10')][_0x7b64('0x124')](_0x5e3627);try{fs[_0x7b64('0x106')](_0x5e3627+'.wav');}catch(_0x2562df){logger['error'](_0x2562df);}return _0x31ab17;}return this[_0x7b64('0x10')]['error'](_0x5abe72,_0x7b64('0x1ca'));};AGIVertices[_0x7b64('0x16')][_0x7b64('0x1cb')]=function(_0x5c7ca4){logger[_0x7b64('0x2e')](util['format'](_0x7b64('0x1cc'),_0x5c7ca4['label']));if(!this[_0x7b64('0x82')](_0x5c7ca4['findBy'])){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x5c7ca4,_0x7b64('0x15f'));}logger[_0x7b64('0x2e')](util[_0x7b64('0x29')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x7b64('0x10')][_0x7b64('0x3a')],_0x5c7ca4[_0x7b64('0x158')]));var _0x374ad3=this[_0x7b64('0x4f')]['sync'](this,_0x5c7ca4[_0x7b64('0x158')]);if(_0x374ad3){logger[_0x7b64('0x2e')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x7b64('0x10')][_0x7b64('0x3a')],_0x5c7ca4[_0x7b64('0x158')]));this[_0x7b64('0x10')][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0x159'),this[_0x7b64('0x10')][_0x7b64('0x3a')],_0x5c7ca4[_0x7b64('0x158')]));return{'code':0xc8,'result':'success'};}else{logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x15b'),this[_0x7b64('0x10')][_0x7b64('0x3a')],_0x5c7ca4[_0x7b64('0x158')]));this['channel'][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0x15b'),this[_0x7b64('0x10')][_0x7b64('0x3a')],_0x5c7ca4[_0x7b64('0x158')]));return{'code':0xc8,'result':_0x7b64('0x15c')};}};AGIVertices[_0x7b64('0x16')][_0x7b64('0x1cd')]=function(_0x1029a5){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x1ce'),_0x1029a5[_0x7b64('0x38')]));var _0x1cf004=this[_0x7b64('0x10')]['exec'](_0x7b64('0x1cf'),[_0x1029a5[_0x7b64('0x1d0')],_0x1029a5['options']]);if(_0x1cf004['result']===-0x1){return _0x1cf004;}return this[_0x7b64('0x10')][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0xc7'),_0x7b64('0x1cf'),_0x1029a5[_0x7b64('0x1d0')]));};AGIVertices[_0x7b64('0x16')][_0x7b64('0x1d1')]=function(_0x5e6351){logger['info'](util['format'](_0x7b64('0x1d2'),_0x5e6351[_0x7b64('0x38')]));if(!this['isConfigured'](_0x5e6351[_0x7b64('0xd9')])){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x5e6351,'no\x20variable\x20selected');}var _0x4c6b93=this[_0x7b64('0xa4')][_0x7b64('0xa9')](this,_0x5e6351[_0x7b64('0xd9')]);if(!_0x4c6b93){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x5e6351,_0x7b64('0xdb'));}var _0x1e2749=this[_0x7b64('0x10')][_0x7b64('0xa4')](_0x4c6b93);return{'code':0xc8,'result':_0x1e2749[_0x7b64('0xa6')]?_0x1e2749['extra']:'-'};};String[_0x7b64('0x16')][_0x7b64('0xa2')]=function(_0x2f5db3,_0x54d4d2){return this['split'](_0x2f5db3)[_0x7b64('0x1d3')](_0x54d4d2);};module[_0x7b64('0x1d4')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 1a5e2e6..41e532a 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 _0x96b4=['prototype','lastPauseAt','timer','update','uniqueid','then','[%s][UPDATE][ACWTIME:%s]','catch','error','startAcw','interface','queue','ACW','mandatoryDispositionPause','name','Action','QueuePause','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','available','paused','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','format','YYYY-MM-DD\x20HH:mm:ss','updateAcw','finally','[ACW][START]\x20%s','message','pauseType','saveUnpause','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','[ACW][syncAgentConnect]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','deleteChannelAfterTimeout','isNil','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','stringify','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','exports','moment','../ami','../../../config/logger','acw','../rpc/user','voiceQueues','agents','timers','channels','syncAgentConnect','bind','syncHangupRequest','hangup','syncHangup','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','seconds'];(function(_0x20f52d,_0x37de07){var _0x460238=function(_0x54527f){while(--_0x54527f){_0x20f52d['push'](_0x20f52d['shift']());}};_0x460238(++_0x37de07);}(_0x96b4,0xe4));var _0x496b=function(_0x347b87,_0x5380d8){_0x347b87=_0x347b87-0x0;var _0x4764ba=_0x96b4[_0x347b87];return _0x4764ba;};'use strict';var _=require('lodash');var moment=require(_0x496b('0x0'));var ami=require(_0x496b('0x1'));var logger=require(_0x496b('0x2'))(_0x496b('0x3'));var RpcUser=require(_0x496b('0x4'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x383819){this[_0x496b('0x5')]=_0x383819['voiceQueues'];this[_0x496b('0x6')]=_0x383819['agents'];this['timers']=_0x383819[_0x496b('0x7')];this[_0x496b('0x8')]={};ami['on']('agentconnect',this[_0x496b('0x9')][_0x496b('0xa')](this));ami['on']('hanguprequest',this[_0x496b('0xb')][_0x496b('0xa')](this));ami['on'](_0x496b('0xc'),this[_0x496b('0xd')]['bind'](this));ami['on']('agentringnoanswer',this[_0x496b('0xe')][_0x496b('0xa')](this));ami['on'](_0x496b('0xf'),this[_0x496b('0x10')][_0x496b('0xa')](this));ami['on']('blindtransfer',this[_0x496b('0x11')][_0x496b('0xa')](this));ami['on'](_0x496b('0x12'),this['syncAgentConnectPreview'][_0x496b('0xa')](this));}function getDiff(_0x2bb214){var _0x38fc4f=moment()[_0x496b('0x13')](0x0);var _0x320ba5=moment(_0x2bb214)[_0x496b('0x13')](0x0);return _0x38fc4f['diff'](_0x320ba5,_0x496b('0x14'));}Acw[_0x496b('0x15')]['updateAcw']=function(_0x7d9ae4,_0x1aa778){var _0x1509b5=this;var _0x239322=getDiff(_0x1509b5[_0x496b('0x7')][_0x7d9ae4][_0x496b('0x16')]);clearTimeout(_0x1509b5['timers'][_0x7d9ae4][_0x496b('0x17')]);_0x1509b5[_0x496b('0x7')][_0x7d9ae4][_0x496b('0x17')]=![];return RpcVoiceAgentReport[_0x496b('0x18')]({'acwtime':_0x239322},_0x1509b5['timers'][_0x7d9ae4][_0x496b('0x19')],_0x7d9ae4)[_0x496b('0x1a')](function(_0x18f284){logger['info'](_0x496b('0x1b'),_0x1aa778,_0x239322,_0x18f284);})[_0x496b('0x1c')](function(_0x3674d0){logger[_0x496b('0x1d')]('[%s][UPDATE][ERRORS:%s]',_0x1aa778,_0x3674d0);})['finally'](function(){delete _0x1509b5[_0x496b('0x7')][_0x7d9ae4];});};Acw[_0x496b('0x15')][_0x496b('0x1e')]=function(_0x10ea0c){try{var _0x544993=this;var _0x4f740f=this[_0x496b('0x8')][_0x10ea0c][_0x496b('0x1f')];var _0x37ec29=this['channels'][_0x10ea0c][_0x496b('0x20')];var _0x12f469=this[_0x496b('0x5')][_0x37ec29];var _0x4f02d5=![];var _0x122109=_0x496b('0x21');if(_0x12f469['mandatoryDisposition']&&_0x12f469[_0x496b('0x22')]['name']){_0x4f02d5=!![];_0x122109=_0x12f469['mandatoryDispositionPause'][_0x496b('0x23')];}return ami[_0x496b('0x24')]({'action':_0x496b('0x25'),'interface':_0x4f740f,'paused':!![],'reason':_0x122109})[_0x496b('0x1a')](function(){if(_0x544993['agents'][_0x4f740f]){return RpcUser[_0x496b('0x26')](_0x544993['agents'][_0x4f740f]['id'])['then'](function(_0x287759){if(!_0x287759||_0x287759[_0x496b('0x27')]){logger[_0x496b('0x28')]('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x10ea0c,_0x4f740f,_0x37ec29);return;}logger[_0x496b('0x28')](_0x496b('0x29'),_0x10ea0c,_0x4f740f,_0x37ec29);var _0x26a845=_0x544993[_0x496b('0x8')][_0x10ea0c][_0x496b('0x2a')]&&_0x544993['channels'][_0x10ea0c][_0x496b('0x2b')]?_0x544993['channels'][_0x10ea0c][_0x496b('0x2b')]:_0x10ea0c;return RpcUser[_0x496b('0x2c')](_0x544993[_0x496b('0x6')][_0x4f740f],_0x122109,_0x26a845)['then'](function(_0x246814){_0x544993['voiceQueues'][_0x37ec29][_0x496b('0x2d')]-=0x1;_0x544993[_0x496b('0x5')][_0x37ec29][_0x496b('0x2e')]+=0x1;return _0x246814;});})[_0x496b('0x1a')](function(_0x1e454d){if(_0x4f02d5||!_0x1e454d){return;}_0x544993[_0x496b('0x7')][_0x4f740f]={};logger['info'](_0x496b('0x2f'),_0x10ea0c,_0x544993[_0x496b('0x5')][_0x37ec29][_0x496b('0x30')],_0x4f740f,_0x37ec29);_0x544993[_0x496b('0x7')][_0x4f740f][_0x496b('0x17')]=setTimeout(_0x544993[_0x496b('0x31')][_0x496b('0xa')](_0x544993,_0x4f740f),_0x544993[_0x496b('0x5')][_0x37ec29][_0x496b('0x30')]*0x3e8);_0x544993[_0x496b('0x7')][_0x4f740f]['lastPauseAt']=moment()[_0x496b('0x32')](_0x496b('0x33'));_0x544993['timers'][_0x4f740f][_0x496b('0x19')]=_0x10ea0c;_0x544993[_0x496b('0x7')][_0x4f740f]['queue']=_0x37ec29;_0x544993[_0x496b('0x7')][_0x4f740f][_0x496b('0x34')]=_0x544993[_0x496b('0x34')][_0x496b('0xa')](_0x544993,_0x4f740f,_0x10ea0c);});}})[_0x496b('0x1c')](function(){logger['error'](_0x496b('0x2f'),_0x10ea0c,_0x544993['voiceQueues'][_0x37ec29][_0x496b('0x30')],_0x4f740f,_0x37ec29);})[_0x496b('0x35')](function(){delete _0x544993[_0x496b('0x8')][_0x10ea0c];});}catch(_0x372d59){logger[_0x496b('0x1d')](_0x496b('0x36'),_0x372d59[_0x496b('0x37')]);}};Acw[_0x496b('0x15')][_0x496b('0x31')]=function(_0x206d6d){try{var _0x4e628e=this;if(_0x4e628e[_0x496b('0x7')][_0x206d6d]){_0x4e628e[_0x496b('0x7')][_0x206d6d][_0x496b('0x17')]=![];var _0x2b1777=_0x4e628e[_0x496b('0x7')][_0x206d6d][_0x496b('0x19')];var _0x445555=_0x4e628e[_0x496b('0x7')][_0x206d6d][_0x496b('0x20')];var _0x4bcaf7=_0x4e628e[_0x496b('0x5')][_0x445555][_0x496b('0x30')];logger[_0x496b('0x28')]('[%s][TIMER][STOP][AGENT:%s]',_0x2b1777,_0x206d6d);RpcUser[_0x496b('0x26')](this['agents'][_0x206d6d]['id'])[_0x496b('0x1a')](function(_0x2db81f){if(_0x2db81f[_0x496b('0x38')]===_0x496b('0x21')){return RpcUser[_0x496b('0x39')](_0x4e628e[_0x496b('0x6')][_0x206d6d]);}});RpcVoiceAgentReport[_0x496b('0x18')]({'acwtime':_0x4bcaf7,'agentacw':!![]},_0x2b1777,_0x206d6d)['then'](function(_0x9e425e){logger['info'](_0x496b('0x1b'),_0x2b1777,_0x4bcaf7,_0x9e425e);})['catch'](function(_0x4eaa98){logger['error'](_0x496b('0x3a'),_0x2b1777,_0x4eaa98);});}else{logger['error'](_0x496b('0x3b'),_0x206d6d);if(_0x4e628e[_0x496b('0x7')]){logger[_0x496b('0x28')](_0x496b('0x3c'),JSON['stringify'](_0x4e628e['timers']));}}}catch(_0x4a095d){logger[_0x496b('0x1d')]('[ACW][STOP]\x20%s',_0x4a095d[_0x496b('0x37')]);}};Acw[_0x496b('0x15')][_0x496b('0x9')]=function(_0x109304){try{if(this['voiceQueues'][_0x109304[_0x496b('0x20')]]&&(this[_0x496b('0x5')][_0x109304[_0x496b('0x20')]][_0x496b('0x3')]||this[_0x496b('0x5')][_0x109304[_0x496b('0x20')]]['mandatoryDisposition'])){if(this[_0x496b('0x6')][_0x109304['interface']]){this[_0x496b('0x8')][_0x109304['uniqueid']]={'queue':_0x109304['queue'],'interface':_0x109304[_0x496b('0x1f')],'destlinkedid':_0x109304['destlinkedid']};}}}catch(_0x486037){logger[_0x496b('0x1d')](_0x496b('0x3d'),_0x486037[_0x496b('0x37')]);}};Acw[_0x496b('0x15')]['syncAgentConnectPreview']=function(_0x1d3292){try{if(this['voiceQueues'][_0x1d3292[_0x496b('0x20')]]&&(this['voiceQueues'][_0x1d3292[_0x496b('0x20')]]['acw']||this[_0x496b('0x5')][_0x1d3292[_0x496b('0x20')]]['mandatoryDisposition'])){if(this[_0x496b('0x6')][_0x1d3292[_0x496b('0x1f')]]){this[_0x496b('0x8')][_0x1d3292['uniqueid']]={'queue':_0x1d3292[_0x496b('0x20')],'interface':_0x1d3292[_0x496b('0x1f')]};}}}catch(_0x5efcbc){logger[_0x496b('0x1d')]('[ACW][syncAgentConnectPreview]\x20%s',_0x5efcbc[_0x496b('0x37')]);}};Acw[_0x496b('0x15')]['syncHangupRequest']=function(_0x1d49f7){try{if(this[_0x496b('0x8')][_0x1d49f7[_0x496b('0x19')]]&&_[_0x496b('0x3e')](this[_0x496b('0x8')][_0x1d49f7['uniqueid']][_0x496b('0x2a')])){logger[_0x496b('0x28')](_0x496b('0x3f'),_0x1d49f7[_0x496b('0x19')]);this['startAcw'](_0x1d49f7[_0x496b('0x19')]);}else if(this['channels'][_0x1d49f7['linkedid']]&&_[_0x496b('0x3e')](this['channels'][_0x1d49f7[_0x496b('0x40')]][_0x496b('0x2a')])){logger['info'](_0x496b('0x41'),_0x1d49f7[_0x496b('0x40')]);this[_0x496b('0x1e')](_0x1d49f7[_0x496b('0x40')]);}}catch(_0x81609e){logger[_0x496b('0x1d')](_0x496b('0x42'),_0x81609e[_0x496b('0x37')]);}};Acw[_0x496b('0x15')][_0x496b('0xd')]=function(_0x9c9123){try{if(this[_0x496b('0x8')][_0x9c9123[_0x496b('0x19')]]&&this[_0x496b('0x8')][_0x9c9123[_0x496b('0x19')]][_0x496b('0x2a')]){logger['info'](_0x496b('0x43'),_0x9c9123[_0x496b('0x19')]);this['startAcw'](_0x9c9123[_0x496b('0x19')]);}else if(this[_0x496b('0x8')][_0x9c9123[_0x496b('0x40')]]&&this[_0x496b('0x8')][_0x9c9123[_0x496b('0x40')]][_0x496b('0x2a')]){logger[_0x496b('0x28')](_0x496b('0x44'),_0x9c9123['linkedid']);this['startAcw'](_0x9c9123[_0x496b('0x40')]);}}catch(_0x50d35a){logger[_0x496b('0x1d')]('[ACW][syncHangup]\x20%s',_0x50d35a[_0x496b('0x37')]);}};Acw[_0x496b('0x15')][_0x496b('0x10')]=function(_0x1c24d4){try{if(!_['isNil'](this[_0x496b('0x8')][_0x1c24d4['transfereeuniqueid']])){this['startAcw'](_0x1c24d4[_0x496b('0x45')]);if(this[_0x496b('0x8')][_0x1c24d4[_0x496b('0x46')]]){this[_0x496b('0x8')][_0x1c24d4[_0x496b('0x46')]]['attended']=!![];this['channels'][_0x1c24d4[_0x496b('0x47')]]=this[_0x496b('0x8')][_0x1c24d4[_0x496b('0x46')]];this[_0x496b('0x48')](_0x1c24d4[_0x496b('0x46')]);}}else if(!_[_0x496b('0x49')](this[_0x496b('0x8')][_0x1c24d4[_0x496b('0x47')]])){this[_0x496b('0x1e')](_0x1c24d4[_0x496b('0x47')]);if(this[_0x496b('0x8')][_0x1c24d4['origtransfereruniqueid']]){this[_0x496b('0x8')][_0x1c24d4['origtransfereruniqueid']][_0x496b('0x2a')]=!![];this[_0x496b('0x8')][_0x1c24d4[_0x496b('0x45')]]=this[_0x496b('0x8')][_0x1c24d4['origtransfereruniqueid']];this[_0x496b('0x48')](_0x1c24d4['origtransfereruniqueid']);}}}catch(_0x4a513e){logger[_0x496b('0x1d')](_0x496b('0x4a'),_0x4a513e[_0x496b('0x37')]);}};Acw[_0x496b('0x15')]['syncBlindTransfer']=function(_0x3782fc){try{if(this['channels'][_0x3782fc[_0x496b('0x4b')]]){logger['info']('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0x496b('0x4c')](_0x3782fc[_0x496b('0x4b')]));this[_0x496b('0x1e')](_0x3782fc[_0x496b('0x4b')]);}else if(this[_0x496b('0x8')][_0x3782fc[_0x496b('0x4d')]]){logger[_0x496b('0x28')](_0x496b('0x4e'),JSON[_0x496b('0x4c')](_0x3782fc[_0x496b('0x4d')]));this['startAcw'](_0x3782fc[_0x496b('0x4d')]);}}catch(_0xac150d){logger['error']('[ACW][syncBlindTransfer]\x20%s',_0xac150d[_0x496b('0x37')]);}};Acw[_0x496b('0x15')]['syncAgentRingNoAnswer']=function(_0x59b397){try{if(this[_0x496b('0x5')][_0x59b397['queue']]&&this[_0x496b('0x5')][_0x59b397[_0x496b('0x20')]][_0x496b('0x4f')]==='all'){if(this[_0x496b('0x6')][_0x59b397[_0x496b('0x1f')]]){logger[_0x496b('0x28')](_0x496b('0x50'),_0x59b397[_0x496b('0x19')],_0x59b397['interface'],_0x59b397['queue']);return RpcUser[_0x496b('0x2c')](this[_0x496b('0x6')][_0x59b397[_0x496b('0x1f')]],_0x496b('0x51'),_0x59b397[_0x496b('0x19')]);}}}catch(_0x43cdb1){logger['error']('[ACW][syncAgentRingNoAnswer]\x20%s',_0x43cdb1[_0x496b('0x37')]);}};Acw[_0x496b('0x15')][_0x496b('0x48')]=function(_0x45a6e9,_0x4bc971=0x2710){if(this['channels'][_0x45a6e9]){setTimeout(()=>{delete this[_0x496b('0x8')][_0x45a6e9];},_0x4bc971);}};module[_0x496b('0x52')]=Acw; \ No newline at end of file +var _0xda36=['[ACW][syncAgentConnectPreview]\x20%s','linkedid','isUndefined','[%s][HANGUP:LINKEDID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','deleteChannelAfterTimeout','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','[%s][BLINDTRANSFER:UNIQUEID]','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','lodash','../../../config/logger','acw','../rpc/voiceAgentReport','voiceQueues','agents','timers','agentconnect','syncAgentConnect','syncHangupRequest','bind','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','seconds','prototype','lastPauseAt','timer','update','uniqueid','then','info','catch','error','[%s][UPDATE][ERRORS:%s]','startAcw','channels','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','QueuePause','getAgent','voicePause','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','available','paused','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','updateAcw','finally','message','[%s][TIMER][STOP][AGENT:%s]','pauseType','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview'];(function(_0x533de9,_0x55626e){var _0x562c3c=function(_0x337860){while(--_0x337860){_0x533de9['push'](_0x533de9['shift']());}};_0x562c3c(++_0x55626e);}(_0xda36,0xbb));var _0x6da3=function(_0x286058,_0x49e249){_0x286058=_0x286058-0x0;var _0x5c4410=_0xda36[_0x286058];return _0x5c4410;};'use strict';var _=require(_0x6da3('0x0'));var moment=require('moment');var ami=require('../ami');var logger=require(_0x6da3('0x1'))(_0x6da3('0x2'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0x6da3('0x3'));function Acw(_0x30d346){this[_0x6da3('0x4')]=_0x30d346['voiceQueues'];this[_0x6da3('0x5')]=_0x30d346[_0x6da3('0x5')];this[_0x6da3('0x6')]=_0x30d346[_0x6da3('0x6')];this['channels']={};ami['on'](_0x6da3('0x7'),this[_0x6da3('0x8')]['bind'](this));ami['on']('hanguprequest',this[_0x6da3('0x9')][_0x6da3('0xa')](this));ami['on'](_0x6da3('0xb'),this[_0x6da3('0xc')]['bind'](this));ami['on'](_0x6da3('0xd'),this[_0x6da3('0xe')][_0x6da3('0xa')](this));ami['on']('attendedtransfer',this[_0x6da3('0xf')][_0x6da3('0xa')](this));ami['on'](_0x6da3('0x10'),this[_0x6da3('0x11')][_0x6da3('0xa')](this));ami['on'](_0x6da3('0x12'),this['syncAgentConnectPreview']['bind'](this));}function getDiff(_0x18d4f7){var _0x8eed26=moment()[_0x6da3('0x13')](0x0);var _0x43b689=moment(_0x18d4f7)[_0x6da3('0x13')](0x0);return _0x8eed26['diff'](_0x43b689,_0x6da3('0x14'));}Acw[_0x6da3('0x15')]['updateAcw']=function(_0x494dd8,_0x4fb3c2){var _0x18db23=this;var _0x404d4d=getDiff(_0x18db23[_0x6da3('0x6')][_0x494dd8][_0x6da3('0x16')]);clearTimeout(_0x18db23['timers'][_0x494dd8][_0x6da3('0x17')]);_0x18db23['timers'][_0x494dd8][_0x6da3('0x17')]=![];return RpcVoiceAgentReport[_0x6da3('0x18')]({'acwtime':_0x404d4d},_0x18db23[_0x6da3('0x6')][_0x494dd8][_0x6da3('0x19')],_0x494dd8)[_0x6da3('0x1a')](function(_0x362c70){logger[_0x6da3('0x1b')]('[%s][UPDATE][ACWTIME:%s]',_0x4fb3c2,_0x404d4d,_0x362c70);})[_0x6da3('0x1c')](function(_0x1dde25){logger[_0x6da3('0x1d')](_0x6da3('0x1e'),_0x4fb3c2,_0x1dde25);})['finally'](function(){delete _0x18db23['timers'][_0x494dd8];});};Acw['prototype'][_0x6da3('0x1f')]=function(_0x2ea81e){try{var _0x2e1a1e=this;var _0x3a9aef=this[_0x6da3('0x20')][_0x2ea81e][_0x6da3('0x21')];var _0x5910fb=this[_0x6da3('0x20')][_0x2ea81e][_0x6da3('0x22')];var _0x3f8cd2=this[_0x6da3('0x4')][_0x5910fb];var _0x20e2a0=![];var _0xe7cadb=_0x6da3('0x23');if(_0x3f8cd2[_0x6da3('0x24')]&&_0x3f8cd2[_0x6da3('0x25')][_0x6da3('0x26')]){_0x20e2a0=!![];_0xe7cadb=_0x3f8cd2[_0x6da3('0x25')][_0x6da3('0x26')];}return ami['Action']({'action':_0x6da3('0x27'),'interface':_0x3a9aef,'paused':!![],'reason':_0xe7cadb})['then'](function(){if(_0x2e1a1e[_0x6da3('0x5')][_0x3a9aef]){return RpcUser[_0x6da3('0x28')](_0x2e1a1e['agents'][_0x3a9aef]['id'])[_0x6da3('0x1a')](function(_0x546f70){if(!_0x546f70||_0x546f70[_0x6da3('0x29')]){logger[_0x6da3('0x1b')](_0x6da3('0x2a'),_0x2ea81e,_0x3a9aef,_0x5910fb);return;}logger['info'](_0x6da3('0x2b'),_0x2ea81e,_0x3a9aef,_0x5910fb);var _0x24499a=_0x2e1a1e[_0x6da3('0x20')][_0x2ea81e][_0x6da3('0x2c')]&&_0x2e1a1e[_0x6da3('0x20')][_0x2ea81e]['destlinkedid']?_0x2e1a1e[_0x6da3('0x20')][_0x2ea81e][_0x6da3('0x2d')]:_0x2ea81e;return RpcUser[_0x6da3('0x2e')](_0x2e1a1e[_0x6da3('0x5')][_0x3a9aef],_0xe7cadb,_0x24499a)[_0x6da3('0x1a')](function(_0x2526fc){_0x2e1a1e[_0x6da3('0x4')][_0x5910fb][_0x6da3('0x2f')]-=0x1;_0x2e1a1e[_0x6da3('0x4')][_0x5910fb][_0x6da3('0x30')]+=0x1;return _0x2526fc;});})[_0x6da3('0x1a')](function(_0x8779c5){if(_0x20e2a0||!_0x8779c5){return;}_0x2e1a1e['timers'][_0x3a9aef]={};logger[_0x6da3('0x1b')](_0x6da3('0x31'),_0x2ea81e,_0x2e1a1e[_0x6da3('0x4')][_0x5910fb][_0x6da3('0x32')],_0x3a9aef,_0x5910fb);_0x2e1a1e[_0x6da3('0x6')][_0x3a9aef][_0x6da3('0x17')]=setTimeout(_0x2e1a1e[_0x6da3('0x33')][_0x6da3('0xa')](_0x2e1a1e,_0x3a9aef),_0x2e1a1e[_0x6da3('0x4')][_0x5910fb][_0x6da3('0x32')]*0x3e8);_0x2e1a1e[_0x6da3('0x6')][_0x3a9aef][_0x6da3('0x16')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2e1a1e[_0x6da3('0x6')][_0x3a9aef][_0x6da3('0x19')]=_0x2ea81e;_0x2e1a1e['timers'][_0x3a9aef][_0x6da3('0x22')]=_0x5910fb;_0x2e1a1e[_0x6da3('0x6')][_0x3a9aef]['updateAcw']=_0x2e1a1e[_0x6da3('0x34')][_0x6da3('0xa')](_0x2e1a1e,_0x3a9aef,_0x2ea81e);});}})['catch'](function(){logger[_0x6da3('0x1d')](_0x6da3('0x31'),_0x2ea81e,_0x2e1a1e[_0x6da3('0x4')][_0x5910fb]['acwTimeout'],_0x3a9aef,_0x5910fb);})[_0x6da3('0x35')](function(){delete _0x2e1a1e['channels'][_0x2ea81e];});}catch(_0x3efa23){logger['error']('[ACW][START]\x20%s',_0x3efa23[_0x6da3('0x36')]);}};Acw['prototype'][_0x6da3('0x33')]=function(_0x47d191){try{var _0x59d48a=this;if(_0x59d48a[_0x6da3('0x6')][_0x47d191]){_0x59d48a[_0x6da3('0x6')][_0x47d191]['timer']=![];var _0x1edbd9=_0x59d48a['timers'][_0x47d191][_0x6da3('0x19')];var _0x1ce3c7=_0x59d48a[_0x6da3('0x6')][_0x47d191][_0x6da3('0x22')];var _0x362d0f=_0x59d48a[_0x6da3('0x4')][_0x1ce3c7][_0x6da3('0x32')];logger[_0x6da3('0x1b')](_0x6da3('0x37'),_0x1edbd9,_0x47d191);RpcUser['getAgent'](this[_0x6da3('0x5')][_0x47d191]['id'])[_0x6da3('0x1a')](function(_0x36287b){if(_0x36287b[_0x6da3('0x38')]===_0x6da3('0x23')){return RpcUser['saveUnpause'](_0x59d48a[_0x6da3('0x5')][_0x47d191]);}});RpcVoiceAgentReport[_0x6da3('0x18')]({'acwtime':_0x362d0f,'agentacw':!![]},_0x1edbd9,_0x47d191)[_0x6da3('0x1a')](function(_0x2c940a){logger[_0x6da3('0x1b')]('[%s][UPDATE][ACWTIME:%s]',_0x1edbd9,_0x362d0f,_0x2c940a);})[_0x6da3('0x1c')](function(_0x1aa563){logger[_0x6da3('0x1d')](_0x6da3('0x1e'),_0x1edbd9,_0x1aa563);});}else{logger[_0x6da3('0x1d')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x47d191);if(_0x59d48a[_0x6da3('0x6')]){logger[_0x6da3('0x1b')](_0x6da3('0x39'),JSON[_0x6da3('0x3a')](_0x59d48a[_0x6da3('0x6')]));}}}catch(_0x8de069){logger[_0x6da3('0x1d')](_0x6da3('0x3b'),_0x8de069[_0x6da3('0x36')]);}};Acw[_0x6da3('0x15')][_0x6da3('0x8')]=function(_0x11bf0d){try{if(this[_0x6da3('0x4')][_0x11bf0d[_0x6da3('0x22')]]&&(this[_0x6da3('0x4')][_0x11bf0d[_0x6da3('0x22')]][_0x6da3('0x2')]||this['voiceQueues'][_0x11bf0d[_0x6da3('0x22')]][_0x6da3('0x24')])){if(this[_0x6da3('0x5')][_0x11bf0d[_0x6da3('0x21')]]){this[_0x6da3('0x20')][_0x11bf0d[_0x6da3('0x19')]]={'queue':_0x11bf0d[_0x6da3('0x22')],'interface':_0x11bf0d[_0x6da3('0x21')],'destlinkedid':_0x11bf0d['destlinkedid']};}}}catch(_0x192f53){logger[_0x6da3('0x1d')](_0x6da3('0x3c'),_0x192f53[_0x6da3('0x36')]);}};Acw[_0x6da3('0x15')][_0x6da3('0x3d')]=function(_0x34e1cc){try{if(this[_0x6da3('0x4')][_0x34e1cc[_0x6da3('0x22')]]&&(this[_0x6da3('0x4')][_0x34e1cc[_0x6da3('0x22')]][_0x6da3('0x2')]||this[_0x6da3('0x4')][_0x34e1cc[_0x6da3('0x22')]][_0x6da3('0x24')])){if(this[_0x6da3('0x5')][_0x34e1cc[_0x6da3('0x21')]]){this[_0x6da3('0x20')][_0x34e1cc[_0x6da3('0x19')]]={'queue':_0x34e1cc[_0x6da3('0x22')],'interface':_0x34e1cc['interface']};}}}catch(_0x2e7487){logger[_0x6da3('0x1d')](_0x6da3('0x3e'),_0x2e7487['message']);}};Acw['prototype'][_0x6da3('0x9')]=function(_0x4867b3){try{if(this['channels'][_0x4867b3[_0x6da3('0x19')]]&&_['isUndefined'](this[_0x6da3('0x20')][_0x4867b3[_0x6da3('0x19')]][_0x6da3('0x2c')])){logger['info']('[%s][HANGUP:UNIQUEID]',_0x4867b3['uniqueid']);this[_0x6da3('0x1f')](_0x4867b3['uniqueid']);}else if(this['channels'][_0x4867b3[_0x6da3('0x3f')]]&&_[_0x6da3('0x40')](this[_0x6da3('0x20')][_0x4867b3[_0x6da3('0x3f')]][_0x6da3('0x2c')])){logger[_0x6da3('0x1b')](_0x6da3('0x41'),_0x4867b3[_0x6da3('0x3f')]);this[_0x6da3('0x1f')](_0x4867b3[_0x6da3('0x3f')]);}}catch(_0x458567){logger[_0x6da3('0x1d')]('[ACW][syncHangupRequest]\x20%s',_0x458567[_0x6da3('0x36')]);}};Acw['prototype']['syncHangup']=function(_0x5887ee){try{if(this[_0x6da3('0x20')][_0x5887ee[_0x6da3('0x19')]]&&this[_0x6da3('0x20')][_0x5887ee[_0x6da3('0x19')]]['attended']){logger[_0x6da3('0x1b')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x5887ee[_0x6da3('0x19')]);this[_0x6da3('0x1f')](_0x5887ee[_0x6da3('0x19')]);}else if(this['channels'][_0x5887ee[_0x6da3('0x3f')]]&&this[_0x6da3('0x20')][_0x5887ee[_0x6da3('0x3f')]]['attended']){logger['info'](_0x6da3('0x42'),_0x5887ee[_0x6da3('0x3f')]);this[_0x6da3('0x1f')](_0x5887ee[_0x6da3('0x3f')]);}}catch(_0x459776){logger[_0x6da3('0x1d')](_0x6da3('0x43'),_0x459776['message']);}};Acw[_0x6da3('0x15')]['syncAttendedTransfer']=function(_0x374704){try{if(!_[_0x6da3('0x44')](this[_0x6da3('0x20')][_0x374704[_0x6da3('0x45')]])){this[_0x6da3('0x1f')](_0x374704[_0x6da3('0x45')]);if(this[_0x6da3('0x20')][_0x374704[_0x6da3('0x46')]]){this[_0x6da3('0x20')][_0x374704['secondtransfereruniqueid']][_0x6da3('0x2c')]=!![];this[_0x6da3('0x20')][_0x374704['transfertargetuniqueid']]=this[_0x6da3('0x20')][_0x374704[_0x6da3('0x46')]];this[_0x6da3('0x47')](_0x374704[_0x6da3('0x46')]);}}else if(!_['isNil'](this[_0x6da3('0x20')][_0x374704[_0x6da3('0x48')]])){this[_0x6da3('0x1f')](_0x374704[_0x6da3('0x48')]);if(this[_0x6da3('0x20')][_0x374704[_0x6da3('0x49')]]){this['channels'][_0x374704['origtransfereruniqueid']][_0x6da3('0x2c')]=!![];this[_0x6da3('0x20')][_0x374704['transfereeuniqueid']]=this[_0x6da3('0x20')][_0x374704[_0x6da3('0x49')]];this[_0x6da3('0x47')](_0x374704[_0x6da3('0x49')]);}}}catch(_0x4295ce){logger[_0x6da3('0x1d')](_0x6da3('0x4a'),_0x4295ce[_0x6da3('0x36')]);}};Acw['prototype'][_0x6da3('0x11')]=function(_0x2a2af3){try{if(this[_0x6da3('0x20')][_0x2a2af3['transfereruniqueid']]){logger['info'](_0x6da3('0x4b'),JSON[_0x6da3('0x3a')](_0x2a2af3[_0x6da3('0x4c')]));this[_0x6da3('0x1f')](_0x2a2af3[_0x6da3('0x4c')]);}else if(this[_0x6da3('0x20')][_0x2a2af3[_0x6da3('0x4d')]]){logger[_0x6da3('0x1b')](_0x6da3('0x4e'),JSON['stringify'](_0x2a2af3[_0x6da3('0x4d')]));this[_0x6da3('0x1f')](_0x2a2af3['transfererlinkedid']);}}catch(_0x1bcfd4){logger[_0x6da3('0x1d')](_0x6da3('0x4f'),_0x1bcfd4[_0x6da3('0x36')]);}};Acw[_0x6da3('0x15')][_0x6da3('0xe')]=function(_0x22c624){try{if(this[_0x6da3('0x4')][_0x22c624[_0x6da3('0x22')]]&&this[_0x6da3('0x4')][_0x22c624['queue']][_0x6da3('0x50')]==='all'){if(this[_0x6da3('0x5')][_0x22c624[_0x6da3('0x21')]]){logger[_0x6da3('0x1b')](_0x6da3('0x51'),_0x22c624[_0x6da3('0x19')],_0x22c624[_0x6da3('0x21')],_0x22c624[_0x6da3('0x22')]);return RpcUser[_0x6da3('0x2e')](this[_0x6da3('0x5')][_0x22c624[_0x6da3('0x21')]],_0x6da3('0x52'),_0x22c624[_0x6da3('0x19')]);}}}catch(_0x2f42c7){logger[_0x6da3('0x1d')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x2f42c7[_0x6da3('0x36')]);}};Acw[_0x6da3('0x15')][_0x6da3('0x47')]=function(_0x28ace7,_0x13cb31=0x2710){if(this[_0x6da3('0x20')][_0x28ace7]){setTimeout(()=>{delete this[_0x6da3('0x20')][_0x28ace7];},_0x13cb31);}};module['exports']=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index c740115..e2c59f1 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 _0x5b16=['connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionCoreShowChannels','catch','[ami.js][fullybooted]','exports','asterisk-manager','util','ami','../../config/environment','port','asterisk','username','password','keepConnected','Action','promisify','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','coreshowchannels','once','close'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5b16,0x1bb));var _0x65b1=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0x5b16[_0x23e7c1];return _0x1add43;};'use strict';var Manager=require(_0x65b1('0x0'));var BPromise=require('bluebird');var util=require(_0x65b1('0x1'));var logger=require('../../config/logger')(_0x65b1('0x2'));var config=require(_0x65b1('0x3'));var ami=new Manager(config['asterisk'][_0x65b1('0x4')],config[_0x65b1('0x5')]['ip'],config[_0x65b1('0x5')][_0x65b1('0x6')],config[_0x65b1('0x5')][_0x65b1('0x7')],!![]);ami[_0x65b1('0x8')]();ami[_0x65b1('0x9')]=BPromise[_0x65b1('0xa')](ami['action']);function error(_0x5cfd74){logger[_0x65b1('0xb')](util[_0x65b1('0xc')](_0x65b1('0xd'),config[_0x65b1('0x5')][_0x65b1('0x6')],config[_0x65b1('0x5')]['ip'],config[_0x65b1('0x5')][_0x65b1('0x4')],util[_0x65b1('0xe')](_0x5cfd74,![],null)));}function close(){logger[_0x65b1('0xb')](util[_0x65b1('0xc')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0x65b1('0x5')][_0x65b1('0x6')],config[_0x65b1('0x5')]['ip'],config['asterisk'][_0x65b1('0x4')]));}ami[_0x65b1('0xf')]=function(){return function(){return ami[_0x65b1('0x9')]({'action':_0x65b1('0x10')});};};ami[_0x65b1('0x11')]=function(){return function(){return ami[_0x65b1('0x9')]({'action':'devicestatelist'});};};ami[_0x65b1('0x12')]=function(){return function(){return ami[_0x65b1('0x9')]({'action':_0x65b1('0x13')});};};ami[_0x65b1('0x14')]=function(){return function(){return ami[_0x65b1('0x9')]({'action':_0x65b1('0x15')});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0x65b1('0x9')]({'action':_0x65b1('0x16')});};};function connect(){logger['info'](util[_0x65b1('0xc')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0x65b1('0x5')][_0x65b1('0x6')],config['asterisk']['ip'],config[_0x65b1('0x5')]['port']));ami[_0x65b1('0x17')]('error',error);ami['once'](_0x65b1('0x18'),close);}ami['on'](_0x65b1('0x19'),connect);ami['on'](_0x65b1('0x1a'),function(_0x2eacfe){logger['info'](util['format'](_0x65b1('0x1b'),config[_0x65b1('0x5')]['username'],config[_0x65b1('0x5')]['ip'],config['asterisk'][_0x65b1('0x4')],util['inspect'](_0x2eacfe,![],null)));});ami['on'](_0x65b1('0x1c'),function(){logger['info'](util[_0x65b1('0xc')](_0x65b1('0x1d'),config[_0x65b1('0x5')]['username'],config[_0x65b1('0x5')]['ip'],config[_0x65b1('0x5')][_0x65b1('0x4')]));return Promise[_0x65b1('0x1e')]()[_0x65b1('0x1f')](ami[_0x65b1('0xf')]())['then'](ami['actionDeviceStateList']())[_0x65b1('0x1f')](ami['actionSipPeerStatus']())[_0x65b1('0x1f')](ami[_0x65b1('0x14')]())[_0x65b1('0x1f')](ami[_0x65b1('0x20')]())[_0x65b1('0x21')](function(_0x1f3d22){logger[_0x65b1('0xb')](_0x65b1('0x22'),util[_0x65b1('0xe')](_0x1f3d22,{'showHidden':![],'depth':null}));});});ami[_0x65b1('0x17')](_0x65b1('0xb'),error);ami[_0x65b1('0x17')](_0x65b1('0x18'),close);module[_0x65b1('0x23')]=ami; \ No newline at end of file +var _0xa7d3=['error','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','Action','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','coreshowchannels','info','once','close','connect','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','resolve','then','actionSipShowRegistry','[ami.js][fullybooted]','exports','asterisk-manager','bluebird','util','../../config/logger','ami','asterisk','port','password','keepConnected','action','format','username','inspect'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa7d3,0x103));var _0x3a7d=function(_0x464432,_0x57ce42){_0x464432=_0x464432-0x0;var _0x56fddb=_0xa7d3[_0x464432];return _0x56fddb;};'use strict';var Manager=require(_0x3a7d('0x0'));var BPromise=require(_0x3a7d('0x1'));var util=require(_0x3a7d('0x2'));var logger=require(_0x3a7d('0x3'))(_0x3a7d('0x4'));var config=require('../../config/environment');var ami=new Manager(config[_0x3a7d('0x5')][_0x3a7d('0x6')],config[_0x3a7d('0x5')]['ip'],config[_0x3a7d('0x5')]['username'],config['asterisk'][_0x3a7d('0x7')],!![]);ami[_0x3a7d('0x8')]();ami['Action']=BPromise['promisify'](ami[_0x3a7d('0x9')]);function error(_0x188427){logger['error'](util[_0x3a7d('0xa')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0x3a7d('0x5')][_0x3a7d('0xb')],config[_0x3a7d('0x5')]['ip'],config[_0x3a7d('0x5')][_0x3a7d('0x6')],util[_0x3a7d('0xc')](_0x188427,![],null)));}function close(){logger[_0x3a7d('0xd')](util['format'](_0x3a7d('0xe'),config[_0x3a7d('0x5')][_0x3a7d('0xb')],config[_0x3a7d('0x5')]['ip'],config[_0x3a7d('0x5')][_0x3a7d('0x6')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x3a7d('0xf')]({'action':_0x3a7d('0x10')});};};ami[_0x3a7d('0x11')]=function(){return function(){return ami[_0x3a7d('0xf')]({'action':_0x3a7d('0x12')});};};ami[_0x3a7d('0x13')]=function(){return function(){return ami[_0x3a7d('0xf')]({'action':_0x3a7d('0x14')});};};ami[_0x3a7d('0x15')]=function(){return function(){return ami[_0x3a7d('0xf')]({'action':_0x3a7d('0x16')});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0x3a7d('0xf')]({'action':_0x3a7d('0x17')});};};function connect(){logger[_0x3a7d('0x18')](util[_0x3a7d('0xa')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config['asterisk'][_0x3a7d('0xb')],config['asterisk']['ip'],config['asterisk'][_0x3a7d('0x6')]));ami[_0x3a7d('0x19')](_0x3a7d('0xd'),error);ami['once'](_0x3a7d('0x1a'),close);}ami['on'](_0x3a7d('0x1b'),connect);ami['on']('shutdown',function(_0x523e6f){logger[_0x3a7d('0x18')](util[_0x3a7d('0xa')](_0x3a7d('0x1c'),config[_0x3a7d('0x5')][_0x3a7d('0xb')],config['asterisk']['ip'],config[_0x3a7d('0x5')][_0x3a7d('0x6')],util[_0x3a7d('0xc')](_0x523e6f,![],null)));});ami['on']('fullybooted',function(){logger[_0x3a7d('0x18')](util[_0x3a7d('0xa')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config['asterisk'][_0x3a7d('0xb')],config[_0x3a7d('0x5')]['ip'],config[_0x3a7d('0x5')][_0x3a7d('0x6')]));return Promise[_0x3a7d('0x1d')]()[_0x3a7d('0x1e')](ami[_0x3a7d('0x1f')]())[_0x3a7d('0x1e')](ami[_0x3a7d('0x11')]())[_0x3a7d('0x1e')](ami[_0x3a7d('0x13')]())['then'](ami[_0x3a7d('0x15')]())[_0x3a7d('0x1e')](ami['actionCoreShowChannels']())['catch'](function(_0x19047e){logger['error'](_0x3a7d('0x20'),util[_0x3a7d('0xc')](_0x19047e,{'showHidden':![],'depth':null}));});});ami[_0x3a7d('0x19')](_0x3a7d('0xd'),error);ami[_0x3a7d('0x19')]('close',close);module[_0x3a7d('0x21')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 60a731a..c094bb9 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 _0xcb91=['request','debug','memberReport','error','rpc','message','result','catch','exports','../../config/logger','ami','client','http'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2ff762,_0x342c0b){_0x2ff762=_0x2ff762-0x0;var _0x158b02=_0xcb91[_0x2ff762];return _0x158b02;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var client=jayson[_0x1cb9('0x2')][_0x1cb9('0x3')]({'port':0x2329});client['Request']=function(_0x8c392f,_0x2c17b8){return new BPromise(function(_0x545a34,_0x13d5fd){return client[_0x1cb9('0x4')](_0x8c392f,_0x2c17b8)['then'](function(_0x226b69){logger[_0x1cb9('0x5')]('rpc',_0x1cb9('0x6'),_0x8c392f,_0x2c17b8,_0x226b69);if(_0x226b69[_0x1cb9('0x7')]){logger['error'](_0x1cb9('0x8'),'memberReport',_0x8c392f,_0x226b69['error'][_0x1cb9('0x9')],_0x2c17b8);return _0x13d5fd(_0x226b69[_0x1cb9('0x7')][_0x1cb9('0x9')]);}else{return _0x545a34(_0x226b69[_0x1cb9('0xa')]);}})[_0x1cb9('0xb')](function(_0x50ce71){logger[_0x1cb9('0x7')](_0x1cb9('0x8'),_0x1cb9('0x6'),_0x8c392f,_0x50ce71,_0x2c17b8);return _0x13d5fd(_0x50ce71);});});};module[_0x1cb9('0xc')]=client; \ No newline at end of file +var _0xda3f=['then','rpc','memberReport','error','message','result','catch','exports','bluebird','../../config/logger','Request','request'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xda3f,0xec));var _0xfda3=function(_0x5e5420,_0x113913){_0x5e5420=_0x5e5420-0x0;var _0x2836dd=_0xda3f[_0x5e5420];return _0x2836dd;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xfda3('0x0'));var logger=require(_0xfda3('0x1'))('ami');var client=jayson['client']['http']({'port':0x2329});client[_0xfda3('0x2')]=function(_0x581693,_0x36dc71){return new BPromise(function(_0x22187d,_0x516500){return client[_0xfda3('0x3')](_0x581693,_0x36dc71)[_0xfda3('0x4')](function(_0x47e7e2){logger['debug'](_0xfda3('0x5'),_0xfda3('0x6'),_0x581693,_0x36dc71,_0x47e7e2);if(_0x47e7e2[_0xfda3('0x7')]){logger[_0xfda3('0x7')](_0xfda3('0x5'),_0xfda3('0x6'),_0x581693,_0x47e7e2[_0xfda3('0x7')][_0xfda3('0x8')],_0x36dc71);return _0x516500(_0x47e7e2[_0xfda3('0x7')][_0xfda3('0x8')]);}else{return _0x22187d(_0x47e7e2[_0xfda3('0x9')]);}})[_0xfda3('0xa')](function(_0x4d7841){logger[_0xfda3('0x7')](_0xfda3('0x5'),_0xfda3('0x6'),_0x581693,_0x4d7841,_0x36dc71);return _0x516500(_0x4d7841);});});};module[_0xfda3('0xb')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index f20e667..80e96c1 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 _0x75ce=['run','[Catch][Preview][syncQueueStatusComplete]','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','getQueue','response','Success','[syncOriginateResponse]','callProgressDetecting','syncVarSet','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','[syncVarSet]','outboundAnswerAgiCallsDay','HangupInAMD','AMD','custom:amd','buildObj','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','outboundAnswerCallsDay','Machine','membername','countmachineretry','countglobal','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','dialMachineRetryFrequency','[rescheduleContact][Machine]','saveInDb','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','createStateFinal','reason\x2019\x20machine....','[syncHangup]','cause-txt','Normal\x20Clearing','[syncAgentCompleteIvr][createHistory]','[syncAgentCompleteIvr]','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','[syncHangup2]','Unknown','[syncHangup][createHistory]','running','isPreviewCampaign','statusMessage','available','inUse','talking','pTalking','ACTIVE','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','[syncQueueSummary]','filter','dialPreviewRecallmeReminder','online','handlePreviewRecallNotifications','map','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','loopClearZombieChannels','clearZombieChannels','No\x20such\x20channel','[clearZombieChannels]','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','notFound','[emptyContact]','Agent','handleIvr','object','originate','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialQueueTimeout','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDMAXIMUMWORDLENGTH','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','getCallerId','TrunkBackup','dialOriginateCallerIdName','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','dialPrefix','trim','dialCutDigit','substring','SIP/%s/%s%s','from-sip','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','reason','outboundNoSuchCallsDay','custom:agentnosuchnumber','nosuchnumber','dialNoSuchNumberMaxRetry','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','buildNoAnswerEventPayload','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','busy','dialBusyRetryFrequency','reason\x205\x20busy','Congestion','custom:agentcongestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','outboundUnknownCallsDay','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMinThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Drop\x20in\x20this\x20interval','dialPredictiveInterval','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','avgHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','predictiveIntervalPauses','predictiveIntervalHitRate','[CatchErlangB]','erlangCallToSecond','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','UserId','recallme','queueStatusComplete:\x20','Queue:\x20','[checkContactBlack]','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','actionOriginate','scheduledat','dialRecallMeTimeout','voicePause','unlockContact','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','limitCalls','originated','getContactDialerIvr','temp','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','emptyContact','[actionOriginate]\x20','[actionOriginateIvr]','[handleIvr]','[getContactCampaign2]','dialLimitQueue','not_inuse','countReScheduled','[countReScheduled]\x20','[handlePower]','tryOriginatePredictive','[handlePredictive][limitChannel]','dialOrderByScheduledAt','checkContactEmpty','checkContactLowerLimitOriginate','checkIsBlackList','[actionOriginatePredictive]','--------\x20Drop\x20Rate\x20--------','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','m\x20=\x20','[abandonmentRate]','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','util','lodash','moment','./utils','../preview/util/util','../../../config/logger','predictive','syncQueueSummary','redis','defaults','localhost','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/action','./models/history','./models/final','./models/queueCallerAbandon','env','XCALLY_IP_AGI','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','optionPredictive','startPredictive','startProgressive','queuesSummary','agentconnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','newexten','syncNewExten','queuemember','syncQueueMember','syncQueueStatusComplete','loopCampaigns','getSettings','then','isUndefined','emit','type','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','isEmpty','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','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','name','handlePredictive','error','contactsRescheduled','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','message','CAMPAIGN_STATUS','NO_AVAILABLE_CONTACTS','state','statedesc','endtime','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','stringify','\x20INTERVAL_IS_NULL','Interval','Intervals','NULL_INTERVAL','INACTIVE','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','DISACTIVED','is\x20deactivated','[ifTime][Action]','Error','isTrunkReachable','active','SIP/%s','status','reachable','checkIsTrunkReachable','Trunk','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','timezones','ifTime','isArray','length','push','Action','iftime\x20%s,%s','interval','content','catch','command','all','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','Timezone:\x20','syncCampaigns','undefined','isIVRCampaignActive','resolve','dialGlobalInterval','dialTimezone','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','progressive','power','handlePower','dialPowerLevel','booked','Queue','method\x20not\x20recognized','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','\x20Interval\x20is\x20overtime:\x20','silly','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','syncAgentConnect','queue','uniqueId','uniqueid','ivr','answertime','YYYY-MM-DD\x20HH:mm:ss','syncAgentComplete','agent','dialAgiAfterHangupAgent','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','droptime','responsetime','predictiveIntervalDroppedCallsTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','TIMEOUT','agiafterat','countdropretry','dialDropRetryFrequency','callAdditionalPhoneAfterMin','verifyAdditionalPhones','voiceQueue','additional','dialDropMaxRetry','rescheduleContact','add','ContactId','ListId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','calleridname','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','outboundDropCallsDayCallersExit','CALLEREXIT','countabandonedretry','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','queueCallerAbandonCreateState','minutes','[rescheduleContact][Abandoned]','Abandoned','calleridnum','[syncAgentComplete][createHistory][11]','channel','actionid','strategy','rrmemory','roundrobin','isNil','locked','paused','stateinterface','queueBooked','pick','idHopper','decrementOriginate','[syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20'];(function(_0x27314e,_0x5ec6bf){var _0x803d23=function(_0x222072){while(--_0x222072){_0x27314e['push'](_0x27314e['shift']());}};_0x803d23(++_0x5ec6bf);}(_0x75ce,0x125));var _0xe75c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x75ce[_0x321bb2];return _0x9c12ed;};'use strict';var util=require(_0xe75c('0x0'));var _=require(_0xe75c('0x1'));var uuid=require('uuid');var moment=require(_0xe75c('0x2'));var rr=require('rr');var Redis=require('ioredis');var utils=require(_0xe75c('0x3'));var hopperUtils=require('./utils/hopper');var ut=require(_0xe75c('0x4'));var config=require('../../../config/environment/');var logger=require(_0xe75c('0x5'))('dialer');var loggerBooked=require(_0xe75c('0x5'))('booked');var loggerPredictive=require(_0xe75c('0x5'))(_0xe75c('0x6'));var loggerPredictiveCalls=require(_0xe75c('0x5'))('predictiveCalls');var loggerSyncQueueSummary=require(_0xe75c('0x5'))(_0xe75c('0x7'));var ami=require('../ami');config[_0xe75c('0x8')]=_[_0xe75c('0x9')](config[_0xe75c('0x8')],{'host':_0xe75c('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe75c('0x8')]));var cmHopper=require('../rpc/cmHopper');var voiceQueueRt=require(_0xe75c('0xb'));var RpcSetting=require(_0xe75c('0xc'));var Interval=require(_0xe75c('0xd'));var Action=require(_0xe75c('0xe'));var History=require(_0xe75c('0xf'));var Final=require(_0xe75c('0x10'));var AgentComplete=require('./models/agentComplete');var QueueCallerAbandon=require(_0xe75c('0x11'));var Hangup=require('./models/hangup');var ipAgi=process[_0xe75c('0x12')][_0xe75c('0x13')]||'127.0.0.1';var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0xe75c('0x14')][_0xe75c('0x15')]=function(_0x1cb008){this[_0xe75c('0x16')]=this[_0xe75c('0x16')]?this[_0xe75c('0x16')][_0xe75c('0x17')](_0x1cb008):_0x1cb008();};function Dialer(_0x14fe6e,_0x3b881b){this[_0xe75c('0x18')]=new Sequence();this[_0xe75c('0x19')]=_0x3b881b;this[_0xe75c('0x1a')]=_0x14fe6e['voiceQueues'];this[_0xe75c('0x1b')]=_0x14fe6e[_0xe75c('0x1b')];this[_0xe75c('0x1c')]=_0x14fe6e[_0xe75c('0x1c')];this[_0xe75c('0x1d')]=_0x14fe6e['trunks'];this[_0xe75c('0x1e')]=config[_0xe75c('0x1e')]||0x2;this[_0xe75c('0x1f')]={};this[_0xe75c('0x20')]={};this[_0xe75c('0x21')]={};this['uniqueId']={};this[_0xe75c('0x22')]={};this[_0xe75c('0x23')]={};this[_0xe75c('0x24')]={};this['ivrOriginated']={};this['queueBooked']={};this['queueBookedRR']={};this[_0xe75c('0x25')]={};ami['on'](_0xe75c('0x26'),this['syncAgentConnect'][_0xe75c('0x27')](this));ami['on'](_0xe75c('0x28'),this[_0xe75c('0x29')]['bind'](this));ami['on'](_0xe75c('0x2a'),this[_0xe75c('0x2b')]['bind'](this));ami['on']('agentcomplete',this['syncAgentComplete']['bind'](this));ami['on'](_0xe75c('0x2c'),this[_0xe75c('0x7')][_0xe75c('0x27')](this));ami['on'](_0xe75c('0x2d'),this[_0xe75c('0x2e')][_0xe75c('0x27')](this));ami['on'](_0xe75c('0x2f'),this[_0xe75c('0x30')][_0xe75c('0x27')](this));ami['on'](_0xe75c('0x31'),this[_0xe75c('0x32')][_0xe75c('0x27')](this));ami['on']('varset',this['syncVarSet'][_0xe75c('0x27')](this));ami['on'](_0xe75c('0x33'),this[_0xe75c('0x34')][_0xe75c('0x27')](this));ami['on']('queuestatuscomplete',this[_0xe75c('0x35')][_0xe75c('0x27')](this));this[_0xe75c('0x36')]();this['loopClearZombieChannels']();RpcSetting[_0xe75c('0x37')]()[_0xe75c('0x38')](function(_0x5b7be2){previewRecallmeReminderInterval=_0x5b7be2['previewRecallmeReminderInterval'];});}function isNotNull(_0x11dba3){return _0x11dba3!==null&&!_[_0xe75c('0x39')](_0x11dba3);}function msgResponse(_0x2275f3,_0x29e586,_0x34de27){return{'action':_0x2275f3,'response':_0x29e586,'message':_0x34de27,'stack':_0x34de27};}function emit(_0x1bc47d,_0x2da5dd,_0x28edfb){io['to'](_0x1bc47d)[_0xe75c('0x3a')](_0x2da5dd,_0x28edfb);}function emitOutboundVoiceQueueSummary(_0x33d11c){if(_0x33d11c[_0xe75c('0x3b')]===_0xe75c('0x3c')){logger[_0xe75c('0x3d')](_0xe75c('0x3e'),util[_0xe75c('0x3f')](_0x33d11c,{'showHidden':![],'depth':null}));emit(util[_0xe75c('0x40')]('voice:queue:%s',_0x33d11c['name']),'voice_queue:save',_0x33d11c);}}function checkGetDataPredictive(_0x5819e3){if(isNotNull(_0x5819e3)&&!_[_0xe75c('0x41')](_0x5819e3)){loggerPredictive[_0xe75c('0x42')](_0xe75c('0x43'));loggerPredictive['info'](_0xe75c('0x44'),_0x5819e3[_0xe75c('0x45')]);loggerPredictive[_0xe75c('0x42')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5819e3[_0xe75c('0x46')]);loggerPredictive['info']('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5819e3['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0xe75c('0x42')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5819e3[_0xe75c('0x47')]);loggerPredictive['info'](_0xe75c('0x48'),_0x5819e3[_0xe75c('0x49')]);loggerPredictive['info']('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5819e3[_0xe75c('0x4a')]);loggerPredictive[_0xe75c('0x42')]('---------------------------');if(_0x5819e3[_0xe75c('0x45')]>0x0){if(!_[_0xe75c('0x39')](_0x5819e3[_0xe75c('0x4a')])&&_0x5819e3[_0xe75c('0x4a')]>0x0){return!![];}loggerPredictive[_0xe75c('0x42')](_0xe75c('0x4b'));if(!_['isUndefined'](_0x5819e3['predictiveIntervalAvgHoldtime'])&&_0x5819e3[_0xe75c('0x49')]>0x0){return!![];}loggerPredictive[_0xe75c('0x42')](_0xe75c('0x4c'));}else{loggerPredictive['info']('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0xe75c('0x42')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x599186){return function(_0x599293){loggerPredictive['info']('---------\x20ErlangB\x20---------');loggerPredictive[_0xe75c('0x42')](_0xe75c('0x4d'),_0x599293[_0xe75c('0x4e')]);loggerPredictive[_0xe75c('0x42')](_0xe75c('0x4f'),_0x599293['erlangCallToSecond']);loggerPredictive[_0xe75c('0x42')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x599293[_0xe75c('0x50')]);loggerPredictive[_0xe75c('0x42')](_0xe75c('0x51'),_0x599293[_0xe75c('0x52')]);loggerPredictive[_0xe75c('0x42')](_0xe75c('0x53'),_0x599293['erlangAbandonmentRate']);loggerPredictive[_0xe75c('0x42')](_0xe75c('0x54'));_[_0xe75c('0x55')](_0x599186,_0x599293);};}function ifInterval(_0xfe22a9,_0xb08462){if(_['isUndefined'](_0xb08462)){return![];}return utils[_0xe75c('0x56')](undefined,_0xb08462)<_0xfe22a9*0x3c;}function clearPredictiveAttributes(_0x300238){if(_0x300238[_0xe75c('0x24')]){_0x300238[_0xe75c('0x24')]=undefined;loggerPredictive['debug'](_0x300238[_0xe75c('0x57')],'startProgressive\x20value\x20cleared');}if(_0x300238[_0xe75c('0x23')]){_0x300238[_0xe75c('0x23')]=undefined;loggerPredictive['debug'](_0x300238[_0xe75c('0x57')],'startPredictive\x20value\x20cleared');}if(_0x300238[_0xe75c('0x58')]){clearInterval(_0x300238['handlePredictive']);_0x300238[_0xe75c('0x58')]=undefined;loggerPredictive[_0xe75c('0x3d')](_0x300238[_0xe75c('0x57')],'handlePredictive\x20interval\x20cleared');}}function loggerCatchPredictive(_0x22f510,_0x3753e0){return function(_0x3a9d07){loggerPredictive['error'](_0x3753e0[_0xe75c('0x57')],_0x22f510);loggerPredictive[_0xe75c('0x59')](_0x3a9d07['stack']);clearPredictiveAttributes(_0x3753e0);};}function loggerCatch(_0x2f5383){return function(_0x26dedd){logger[_0xe75c('0x59')](_0x2f5383,util['inspect'](_0x26dedd,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x1ee90d){return function(_0x246662){if(isNotNull(_0x246662)&&isNotNull(_0x246662[0x0])){if(_0x246662[0x0][_0xe75c('0x5a')]>0x0){_0x1ee90d['message']=utils['CAMPAIGN_STATUS'][_0xe75c('0x5b')];logger[_0xe75c('0x42')](_0xe75c('0x5c')+_0x1ee90d['name'],_0x246662[0x0]['contactsRescheduled'],_0xe75c('0x5d'));}else{_0x1ee90d[_0xe75c('0x5e')]=utils[_0xe75c('0x5f')][_0xe75c('0x60')];logger[_0xe75c('0x42')]('[getContactDialer2][Empty]'+_0x1ee90d[_0xe75c('0x57')]);}}};}function createObjHistory(_0x4d4800,_0x5e4eaa,_0x2ea2a8,_0x44a4d6,_0x87949c){_0x4d4800[_0xe75c('0x5e')]=_0x2ea2a8;var _0x3ababd=new Action(_0x4d4800,_0x5e4eaa);var _0x176ffc=new History(_0x3ababd);_0x176ffc[_0xe75c('0x61')]=_0x44a4d6;_0x176ffc[_0xe75c('0x62')]=_0x87949c;_0x176ffc[_0xe75c('0x63')]=_0x3ababd[_0xe75c('0x64')];return _0x176ffc;}function unlockQueueStatus(_0x309fe4,_0x5a5ae5){setTimeout(function(){if(_['isUndefined'](_0x309fe4[_0xe75c('0x65')])){loggerBooked[_0xe75c('0x59')](_0xe75c('0x66'),_0x5a5ae5);}_0x309fe4[_0xe75c('0x65')]=!![];loggerBooked[_0xe75c('0x42')]('[booked][unlockQueueStatus]',_0x5a5ae5,JSON[_0xe75c('0x67')](_['pick'](_0x309fe4,[_0xe75c('0x57'),_0xe75c('0x65')])));},0x1f3);}function checkInterval(_0x4802b7){return function(){if(!isNotNull(_0x4802b7['Interval'])){_0x4802b7[_0xe75c('0x5e')]=utils['CAMPAIGN_STATUS']['NULL_INTERVAL'];throw _0x4802b7['name']+_0xe75c('0x68');}if(!isNotNull(_0x4802b7[_0xe75c('0x69')][_0xe75c('0x6a')])){_0x4802b7[_0xe75c('0x5e')]=utils['CAMPAIGN_STATUS'][_0xe75c('0x6b')];throw _0x4802b7[_0xe75c('0x57')]+_0xe75c('0x68');}if(!isNotNull(_['isEmpty'](_0x4802b7['Interval']['Intervals']))){_0x4802b7['message']=utils[_0xe75c('0x5f')][_0xe75c('0x6b')];throw _0x4802b7[_0xe75c('0x57')]+'\x20INTERVAL_IS_NULL';}};}function checkIsIVRCampaignActive(_0x21fcad){return function(){if(!utils['isIVRCampaignActive'](_0x21fcad)){_0x21fcad[_0xe75c('0x5e')]=utils[_0xe75c('0x5f')][_0xe75c('0x6c')];throw _0x21fcad[_0xe75c('0x57')]+_0xe75c('0x6d');}};}function emitCampaignSummary(_0x53599e){if(utils[_0xe75c('0x6e')](_0x53599e)){emit(util['format'](_0xe75c('0x6f'),_0x53599e[_0xe75c('0x57')]),_0xe75c('0x70'),_0x53599e);}}function loggerCatchQueueSummary(_0x33628b,_0x224613){return function(_0x2e1b8a){clearPredictiveAttributes(_0x224613);emitCampaignSummary(_0x224613);loggerSyncQueueSummary[_0xe75c('0x3d')](_0x33628b,util[_0xe75c('0x3f')](_0x2e1b8a,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x53c1bd){if(_0x53c1bd[_0xe75c('0x71')]){if(_0x53c1bd['originated']===0x0){_0x53c1bd['sendMessageOneNotActive']=![];_0x53c1bd[_0xe75c('0x5e')]=utils['CAMPAIGN_STATUS'][_0xe75c('0x6c')];loggerSyncQueueSummary['debug'](_0xe75c('0x72'),_0x53c1bd[_0xe75c('0x57')],'is\x20not\x20active');}else{_0x53c1bd['message']=utils[_0xe75c('0x5f')][_0xe75c('0x73')];loggerSyncQueueSummary['debug'](_0xe75c('0x72'),_0x53c1bd[_0xe75c('0x57')],_0xe75c('0x74'));}emitCampaignSummary(_0x53c1bd);}}function myreject(_0x9e7d98){return function(_0x6e8de1){return _0x9e7d98(msgResponse(_0xe75c('0x75'),_0xe75c('0x76'),JSON[_0xe75c('0x67')](_0x6e8de1)));};}Dialer[_0xe75c('0x14')][_0xe75c('0x77')]=function(_0x1653cb){return!_[_0xe75c('0x39')](_0x1653cb)&&_0x1653cb&&!_[_0xe75c('0x39')](_0x1653cb[_0xe75c('0x57')])&&!_[_0xe75c('0x39')](_0x1653cb['active'])&&_0x1653cb[_0xe75c('0x78')]&&(this[_0xe75c('0x1d')][util['format'](_0xe75c('0x79'),_0x1653cb['name'])][_0xe75c('0x7a')]===_0xe75c('0x7b')||this[_0xe75c('0x1d')][util[_0xe75c('0x40')](_0xe75c('0x79'),_0x1653cb[_0xe75c('0x57')])][_0xe75c('0x7a')]==='unmonitored');};Dialer['prototype'][_0xe75c('0x7c')]=function(_0x5c7182){var _0x3a1d0f=this;return function(){if(!_0x3a1d0f[_0xe75c('0x77')](_0x5c7182[_0xe75c('0x7d')])){if(!_0x3a1d0f[_0xe75c('0x77')](_0x5c7182['TrunkBackup'])){_0x5c7182[_0xe75c('0x5e')]=utils['CAMPAIGN_STATUS'][_0xe75c('0x7e')];throw _0x5c7182[_0xe75c('0x57')]+_0xe75c('0x7f');}}};};Dialer[_0xe75c('0x14')][_0xe75c('0x80')]=function(_0x41e9d0,_0x70939c,_0x137077,_0x477bca){var _0x2bdbad=this;return function(){var _0x3e52d5=!![];return _0x2bdbad[_0xe75c('0x81')](_0x41e9d0,_0x70939c,_0x137077,_0x477bca,_0x3e52d5);};};Dialer[_0xe75c('0x14')][_0xe75c('0x82')]=function(_0x55ed47,_0x4ba75d,_0x12cffc,_0x2fd8fb){var _0x253ef4=this;return function(){var _0x4bf86a=![];return _0x253ef4['ifTimeIvr'](_0x55ed47[_0xe75c('0x6a')],_0x4ba75d,_0x12cffc,_0x2fd8fb,_0x4bf86a);};};Dialer[_0xe75c('0x14')][_0xe75c('0x81')]=function(_0x37c018,_0x23c955,_0x1078be,_0x5db489,_0x2cceec){var _0xe6a953=[];return new Promise(function(_0x218fdc,_0xa9d969){if(!isNotNull(_0x37c018)){_0x5db489[_0xe75c('0x5e')]=utils['CAMPAIGN_STATUS'][_0xe75c('0x6b')];return _0xa9d969(msgResponse('ifTime',_0xe75c('0x83'),_0x1078be+_0xe75c('0x84')));}if(_[_0xe75c('0x41')](_0x37c018)){_0x5db489[_0xe75c('0x5e')]=utils[_0xe75c('0x5f')]['EMPTY_INTERVAL'];return _0xa9d969(msgResponse('ifTime',_0xe75c('0x83'),_0x1078be+'\x20Intervals\x20is\x20empty\x20'));}if(_0x23c955&&_[_0xe75c('0x39')](config[_0xe75c('0x85')][_0x23c955])){_0x5db489[_0xe75c('0x5e')]=utils['CAMPAIGN_STATUS']['UNKNOWN_TIMEZONE'];return _0xa9d969(msgResponse(_0xe75c('0x86'),'Failure',_0x1078be+'\x20Timezone\x20unknow\x20'+_0x23c955));}if(_[_0xe75c('0x87')](_0x37c018)){for(var _0x5f2a36=0x0;_0x5f2a36<_0x37c018[_0xe75c('0x88')];_0x5f2a36+=0x1){_0xe6a953[_0xe75c('0x89')](ami[_0xe75c('0x8a')]({'action':'command','command':util[_0xe75c('0x40')](_0xe75c('0x8b'),_0x37c018[_0x5f2a36][_0xe75c('0x8c')],!_[_0xe75c('0x39')](config[_0xe75c('0x85')][_0x23c955])?_0x23c955:'')})[_0xe75c('0x38')](function(_0x3b32ea){return _0x3b32ea[_0xe75c('0x8d')]['indexOf']('true')>=0x0;})[_0xe75c('0x8e')](myreject(_0xa9d969)));}}else{_0xe6a953[_0xe75c('0x89')](ami[_0xe75c('0x8a')]({'action':_0xe75c('0x8f'),'command':util[_0xe75c('0x40')](_0xe75c('0x8b'),_0x37c018,!_[_0xe75c('0x39')](config[_0xe75c('0x85')][_0x23c955])?_0x23c955:'')})[_0xe75c('0x38')](function(_0x293444){return _0x293444['content']['indexOf']('true')>=0x0;})['catch'](myreject(_0xa9d969)));}Promise[_0xe75c('0x90')](_0xe6a953)[_0xe75c('0x38')](function(_0x8f7a68){var _0x1faafc=_['some'](_0x8f7a68);if(_0x1faafc){return _0x218fdc(_0x1faafc);}else{_0x5db489[_0xe75c('0x5e')]=_0x2cceec?utils['CAMPAIGN_STATUS'][_0xe75c('0x91')]:utils[_0xe75c('0x5f')][_0xe75c('0x92')];return _0xa9d969(msgResponse(_0xe75c('0x93'),'Failure',_0xe75c('0x94')+_0x2cceec+'\x20'+_0x1078be+'\x20Interval\x20is\x20overtime:\x20'+util[_0xe75c('0x3f')](_0x37c018,{'showHidden':![],'depth':null})+_0xe75c('0x95')+_0x23c955));}})['catch'](function(_0x39e698){return _0xa9d969(msgResponse(_0xe75c('0x86'),_0xe75c('0x83'),JSON[_0xe75c('0x67')](_0x39e698)));});});};Dialer[_0xe75c('0x14')][_0xe75c('0x36')]=function(){var _0x56e190=this;return cmHopper['resetActiveCalls']({'active':![]},{'where':{'active':!![]}})[_0xe75c('0x38')](function(){setInterval(function(){_0x56e190[_0xe75c('0x96')]();},0x3e8);});};Dialer['prototype']['syncCampaigns']=function(){var _0x5a9aa3=this;var _0x456e8d;for(var _0x18cde3 in this['campaigns']){if(typeof this['campaigns'][_0x18cde3]!==_0xe75c('0x97')){_0x456e8d=this[_0xe75c('0x1b')][_0x18cde3];if(utils[_0xe75c('0x6e')](_0x456e8d)&&utils[_0xe75c('0x98')](_0x456e8d)){_0x456e8d[_0xe75c('0x71')]=!![];Promise[_0xe75c('0x99')]()['then'](checkIsIVRCampaignActive(_0x456e8d))['then'](checkInterval(_0x456e8d))[_0xe75c('0x38')](_0x5a9aa3['checkIsTrunkReachable'](_0x456e8d))['then'](_0x5a9aa3['checkIfTime'](_0x456e8d[_0xe75c('0x9a')],_0x456e8d[_0xe75c('0x9b')],_0x456e8d[_0xe75c('0x57')],_0x456e8d))['then'](_0x5a9aa3['checkIfTimeIntervals'](_0x456e8d[_0xe75c('0x69')],_0x456e8d[_0xe75c('0x9b')],_0x456e8d[_0xe75c('0x57')],_0x456e8d))[_0xe75c('0x38')](_0x5a9aa3[_0xe75c('0x9c')](_0x456e8d))[_0xe75c('0x8e')](loggerCatchQueueSummary(_0xe75c('0x9d'),_0x456e8d));}else{notSendMessagesCampaign(_0x456e8d);}}}};Dialer[_0xe75c('0x14')][_0xe75c('0x9e')]=function(_0x2ef871){if(_0x2ef871[_0xe75c('0x9f')]!==_0xe75c('0x6')){clearPredictiveAttributes(_0x2ef871);}switch(_0x2ef871[_0xe75c('0x9f')]){case _0xe75c('0xa0'):this['handlePower'](_0x2ef871,0x1);break;case _0xe75c('0xa1'):this[_0xe75c('0xa2')](_0x2ef871,_0x2ef871[_0xe75c('0xa3')]);break;case _0xe75c('0x6'):this[_0xe75c('0x6')](_0x2ef871);break;case _0xe75c('0xa4'):this[_0xe75c('0xa2')](_0x2ef871,0x1);break;default:logger[_0xe75c('0x59')](_0xe75c('0xa5'),_0x2ef871[_0xe75c('0x57')],_0xe75c('0xa6'));}};Dialer[_0xe75c('0x14')][_0xe75c('0x86')]=function(_0x2b4eae,_0x2c7230){var _0x5ccc2b=_0x2b4eae[_0xe75c('0x9b')];var _0x121b95=_0x2c7230?_0x2b4eae[_0xe75c('0x9a')]:_0x2b4eae[_0xe75c('0x69')][_0xe75c('0x6a')];logger['silly'](_0xe75c('0xa7'),_0x121b95,_0x5ccc2b,_0x2b4eae[_0xe75c('0x57')],util[_0xe75c('0x40')](_0xe75c('0xa8'),_0x2b4eae[_0xe75c('0x57')],_0x2b4eae['id']));var _0x552c97=null;return Interval['intervalIftime'](_0x121b95,_0x5ccc2b)['then'](function(_0x2a42a9){if(_0x2a42a9===!![]){return _0x2a42a9;}else{_0x2b4eae[_0xe75c('0x5e')]=_0x2c7230?utils['CAMPAIGN_STATUS'][_0xe75c('0x91')]:utils[_0xe75c('0x5f')][_0xe75c('0x92')];_0x552c97=msgResponse(_0xe75c('0x93'),'Failure',_0xe75c('0x94')+_0x2c7230+'\x20'+_0x2b4eae['name']+_0xe75c('0xa9')+util['inspect'](_0x121b95,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x5ccc2b);}if(_0x552c97!==null){logger[_0xe75c('0xaa')](_0xe75c('0xab'),_0x552c97);_0x552c97[_0xe75c('0xac')]=_0x2c7230;throw _0x552c97;}})['catch'](function(_0x5c55c9){logger[_0xe75c('0x59')](_0xe75c('0xad'),_0x5c55c9);throw msgResponse(_0xe75c('0x75'),'Error',util[_0xe75c('0x3f')](_0x5c55c9,{'showHidden':![],'depth':null}));});};Dialer[_0xe75c('0x14')][_0xe75c('0xae')]=function(_0x22049f){if(this['voiceQueues'][_0x22049f[_0xe75c('0xaf')]]){if(this[_0xe75c('0xb0')][_0x22049f[_0xe75c('0xb1')]]&&this[_0xe75c('0xb0')][_0x22049f[_0xe75c('0xb1')]][_0xe75c('0x3b')]!==_0xe75c('0xb2')){utils['decrementOriginate'](this[_0xe75c('0x1a')][_0x22049f[_0xe75c('0xaf')]],'[syncAgentConnect]');this['uniqueId'][_0x22049f[_0xe75c('0xb1')]][_0xe75c('0xb3')]=moment()['format'](_0xe75c('0xb4'));}}};Dialer[_0xe75c('0x14')][_0xe75c('0xb5')]=function(_0x5a8e8){var _0xa250d3=this[_0xe75c('0xb0')][_0x5a8e8[_0xe75c('0xb1')]];if(this['voiceQueues'][_0x5a8e8[_0xe75c('0xaf')]]){if(_0xa250d3&&_0xa250d3['type']!==_0xe75c('0xb2')){delete this[_0xe75c('0xb0')][_0x5a8e8[_0xe75c('0xb1')]];this['voiceQueues'][_0x5a8e8['queue']]['outboundAnswerCallsDay']+=0x1;var _0x3c9eb7=new AgentComplete(_0xa250d3,_0x5a8e8);if(_0x5a8e8['reason']===_0xe75c('0xb6')){_0x3c9eb7['agiafterat']=this[_0xe75c('0x1a')][_0x5a8e8[_0xe75c('0xaf')]]['dialQueueProject2']&&this[_0xe75c('0x1a')][_0x5a8e8['queue']][_0xe75c('0xb7')]?moment()[_0xe75c('0x40')](_0xe75c('0xb4')):undefined;}hopperUtils[_0xe75c('0xb8')](_0x3c9eb7)[_0xe75c('0x8e')](loggerCatch(_0xe75c('0xb9')));hopperUtils[_0xe75c('0xba')](_0x3c9eb7)[_0xe75c('0x8e')](loggerCatch(_0xe75c('0xbb')));}}};Dialer['prototype'][_0xe75c('0x29')]=function(_0x126e91){var _0x337dc7=this[_0xe75c('0xb0')][_0x126e91[_0xe75c('0xb1')]];var _0x4d6f53=this;var _0x138588=![];var _0x3ae3d0;var _0x273ee4;if(this[_0xe75c('0x1a')][_0x126e91[_0xe75c('0xaf')]]){if(_0x337dc7&&_0x337dc7[_0xe75c('0x3b')]!=='ivr'){delete this['uniqueId'][_0x126e91['uniqueid']];utils['decrementOriginate'](this[_0xe75c('0x1a')][_0x126e91[_0xe75c('0xaf')]],'[syncQueueCallerAbandon]');_0x337dc7['droptime']=moment()[_0xe75c('0x40')](_0xe75c('0xb4'));var _0x5292af=new QueueCallerAbandon(_0x337dc7,_0x126e91);if(utils[_0xe75c('0x56')](_0x337dc7[_0xe75c('0xbc')],_0x337dc7[_0xe75c('0xbd')])>=_0x337dc7['dialQueueTimeout']){this['voiceQueues'][_0x126e91[_0xe75c('0xaf')]][_0xe75c('0xbe')]+=0x1;this[_0xe75c('0x1a')][_0x126e91['queue']][_0xe75c('0xbf')]+=0x1;this[_0xe75c('0x1a')][_0x126e91[_0xe75c('0xaf')]][_0xe75c('0xc0')]+=0x1;_0x5292af['state']=0xa;_0x5292af[_0xe75c('0x62')]=_0xe75c('0xc1');_0x5292af[_0xe75c('0xc2')]=_0xe75c('0xc3');_0x5292af[_0xe75c('0xc4')]=this[_0xe75c('0x1a')][_0x126e91['queue']]['dialQueueProject2']?moment()[_0xe75c('0x40')](_0xe75c('0xb4')):undefined;_0x5292af[_0xe75c('0xc5')]+=0x1;_0x5292af['countglobal']+=0x1;_0x3ae3d0=this[_0xe75c('0x1a')][_0x126e91[_0xe75c('0xaf')]][_0xe75c('0xc6')];_0x273ee4=this[_0xe75c('0x1a')][_0x126e91['queue']][_0xe75c('0xc7')];hopperUtils[_0xe75c('0xc8')](_0x5292af,_0x5292af[_0xe75c('0x61')],_0x337dc7[_0xe75c('0xc9')])[_0xe75c('0x38')](function(_0x239f42){_0x138588=_0x239f42[_0xe75c('0xca')]==0x1;if(_0x5292af['countdropretry']>=_0x4d6f53[_0xe75c('0x1a')][_0x126e91['queue']][_0xe75c('0xcb')]){_0x4d6f53['queueCallerAbandonCreateState'](_0x5292af,_0x239f42[_0xe75c('0xca')]);}else{hopperUtils[_0xe75c('0xcc')]({'active':![],'countdropretry':_0x5292af[_0xe75c('0xc5')],'scheduledat':moment()[_0xe75c('0xcd')](_0x4d6f53[_0xe75c('0x1a')][_0x126e91[_0xe75c('0xaf')]][_0xe75c('0xc6')],'minutes')[_0xe75c('0x40')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x337dc7[_0xe75c('0xce')],'ListId':_0x337dc7[_0xe75c('0xcf')],'VoiceQueueId':_0x337dc7[_0xe75c('0xd0')]||undefined,'CampaignId':_0x337dc7[_0xe75c('0xd1')]||undefined})['catch'](loggerCatch(_0xe75c('0xd2')));var _0x46e2ef=new History(_0x5292af);_0x46e2ef[_0xe75c('0x61')]=0xa;_0x46e2ef[_0xe75c('0x62')]=_0xe75c('0xc1');_0x46e2ef[_0xe75c('0x64')]=moment()['format'](_0xe75c('0xb4'));_0x46e2ef[_0xe75c('0x63')]=_0x46e2ef['starttime'];_0x46e2ef[_0xe75c('0xd3')]=_0x5292af['calleridname'];_0x46e2ef['calleridnum']=_0x5292af['calleridnum'];hopperUtils[_0xe75c('0xb8')](_0x46e2ef)['catch'](loggerCatch(_0xe75c('0xd4')));}})['then'](function(){if(_0x138588)hopperUtils[_0xe75c('0xd5')](_0x5292af,_0x3ae3d0,_0x273ee4)[_0xe75c('0x38')](function(){return 0x1;});});}else{this['voiceQueues'][_0x126e91[_0xe75c('0xaf')]][_0xe75c('0x47')]+=0x1;this['voiceQueues'][_0x126e91[_0xe75c('0xaf')]][_0xe75c('0xd6')]+=0x1;_0x5292af['state']=0xb;_0x5292af[_0xe75c('0x62')]='Abandoned';_0x5292af[_0xe75c('0xc2')]=_0xe75c('0xd7');_0x5292af[_0xe75c('0xd8')]+=0x1;_0x5292af['countglobal']+=0x1;_0x3ae3d0=this['voiceQueues'][_0x126e91[_0xe75c('0xaf')]][_0xe75c('0xd9')];_0x273ee4=this[_0xe75c('0x1a')][_0x126e91[_0xe75c('0xaf')]][_0xe75c('0xc7')];hopperUtils['verifyAdditionalPhones'](_0x5292af,_0x5292af['state'],_0x337dc7[_0xe75c('0xc9')])[_0xe75c('0x38')](function(_0x411129){if(_0x5292af[_0xe75c('0xd8')]>=_0x4d6f53[_0xe75c('0x1a')][_0x126e91[_0xe75c('0xaf')]][_0xe75c('0xda')]){_0x4d6f53[_0xe75c('0xdb')](_0x5292af,_0x411129[_0xe75c('0xca')]);}else{hopperUtils[_0xe75c('0xcc')]({'active':![],'countabandonedretry':_0x5292af['countabandonedretry'],'scheduledat':moment()[_0xe75c('0xcd')](_0x4d6f53['voiceQueues'][_0x126e91[_0xe75c('0xaf')]][_0xe75c('0xd9')],_0xe75c('0xdc'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x337dc7['ContactId'],'ListId':_0x337dc7[_0xe75c('0xcf')],'VoiceQueueId':_0x337dc7[_0xe75c('0xd0')]||undefined,'CampaignId':_0x337dc7[_0xe75c('0xd1')]||undefined})[_0xe75c('0x8e')](loggerCatch(_0xe75c('0xdd')));var _0xe875ee=new History(_0x5292af);_0xe875ee['state']=0xb;_0xe875ee[_0xe75c('0x62')]=_0xe75c('0xde');_0xe875ee[_0xe75c('0x64')]=moment()[_0xe75c('0x40')]('YYYY-MM-DD\x20HH:mm:ss');_0xe875ee[_0xe75c('0x63')]=_0xe875ee[_0xe75c('0x64')];_0xe875ee[_0xe75c('0xd3')]=_0x5292af[_0xe75c('0xd3')];_0xe875ee[_0xe75c('0xdf')]=_0x5292af[_0xe75c('0xdf')];hopperUtils['createHistory'](_0xe875ee)[_0xe75c('0x8e')](loggerCatch(_0xe75c('0xe0')));}})['then'](function(){if(_0x138588)hopperUtils[_0xe75c('0xd5')](_0x5292af,_0x3ae3d0,_0x273ee4)[_0xe75c('0x38')](function(){return 0x1;});});}}}};Dialer[_0xe75c('0x14')][_0xe75c('0x32')]=function(_0x460756){if(this[_0xe75c('0x20')][_0x460756[_0xe75c('0xb1')]]){this[_0xe75c('0x20')][_0x460756[_0xe75c('0xb1')]]['channel']=_0x460756[_0xe75c('0xe1')];}if(this[_0xe75c('0xb0')][_0x460756[_0xe75c('0xb1')]]){this['uniqueId'][_0x460756[_0xe75c('0xb1')]]['channel']=_0x460756[_0xe75c('0xe1')];}};Dialer[_0xe75c('0x14')][_0xe75c('0x34')]=function(_0x75b6f4){if(!this[_0xe75c('0x20')][_0x75b6f4[_0xe75c('0xe2')]]){return;}var _0x30abf6=this[_0xe75c('0x1a')][this[_0xe75c('0x20')][_0x75b6f4[_0xe75c('0xe2')]][_0xe75c('0xaf')]][_0xe75c('0xe3')]||_0xe75c('0xe4');if(_0x30abf6===_0xe75c('0xe5')){if(this[_0xe75c('0x20')][_0x75b6f4[_0xe75c('0xe2')]]&&_[_0xe75c('0xe6')](this[_0xe75c('0x20')][_0x75b6f4[_0xe75c('0xe2')]][_0xe75c('0xe7')])&&_0x75b6f4[_0xe75c('0x7a')]==='1'&&_0x75b6f4[_0xe75c('0xe8')]==='0'){if(this['agents'][_0x75b6f4[_0xe75c('0xe9')]]){if(!this[_0xe75c('0x1c')][_0x75b6f4[_0xe75c('0xe9')]][_0xe75c('0xe7')]){this[_0xe75c('0x1c')][_0x75b6f4['stateinterface']][_0xe75c('0xe7')]=!![];this[_0xe75c('0x20')][_0x75b6f4[_0xe75c('0xe2')]][_0xe75c('0xe7')]=!![];this[_0xe75c('0x20')][_0x75b6f4['actionid']][_0xe75c('0xe9')]=_0x75b6f4['stateinterface'];}}}}else if(_0x30abf6===_0xe75c('0xe4')){if(this[_0xe75c('0x20')][_0x75b6f4[_0xe75c('0xe2')]]){if(this[_0xe75c('0x1c')][_0x75b6f4[_0xe75c('0xe9')]]){this[_0xe75c('0x20')][_0x75b6f4[_0xe75c('0xe2')]][_0xe75c('0xe9')]=_0x75b6f4[_0xe75c('0xe9')];if(_['isNil'](this[_0xe75c('0xea')][this[_0xe75c('0x20')][_0x75b6f4[_0xe75c('0xe2')]][_0xe75c('0xaf')]])){this['queueBooked'][this[_0xe75c('0x20')][_0x75b6f4[_0xe75c('0xe2')]]['queue']]=[];}this[_0xe75c('0xea')][this[_0xe75c('0x20')][_0x75b6f4['actionid']]['queue']][_0xe75c('0x89')](_['merge'](_[_0xe75c('0xeb')](this[_0xe75c('0x20')][_0x75b6f4[_0xe75c('0xe2')]],[_0xe75c('0xec'),_0xe75c('0xe9')]),{'status':_0x75b6f4[_0xe75c('0x7a')],'paused':_0x75b6f4[_0xe75c('0xe8')]}));}}}};Dialer[_0xe75c('0x14')][_0xe75c('0x35')]=function(_0x24150f){if(!this[_0xe75c('0x20')][_0x24150f[_0xe75c('0xe2')]]){return;}var _0xc73cf6=this;var _0x2485bf=this[_0xe75c('0x1a')][this['actions'][_0x24150f[_0xe75c('0xe2')]][_0xe75c('0xaf')]];var _0x4a0b15=_0x2485bf[_0xe75c('0xe3')]||_0xe75c('0xe4');if(_0x4a0b15===_0xe75c('0xe5')){if(this[_0xe75c('0x20')][_0x24150f['actionid']]&&this[_0xe75c('0x20')][_0x24150f[_0xe75c('0xe2')]][_0xe75c('0xe9')]){this[_0xe75c('0x19')]['run'](this[_0xe75c('0x20')][_0x24150f['actionid']][_0xe75c('0xec')],this[_0xe75c('0x20')][_0x24150f[_0xe75c('0xe2')]][_0xe75c('0xe9')])[_0xe75c('0x8e')](function(_0x32a92a){logger[_0xe75c('0x59')]('[Catch][Preview][syncQueueStatusComplete]',util[_0xe75c('0x3f')](_0x32a92a,{'showHidden':![],'depth':null}));})[_0xe75c('0x17')](function(){utils[_0xe75c('0xed')](_0xc73cf6[_0xe75c('0x1a')][_0xc73cf6[_0xe75c('0x20')][_0x24150f['actionid']][_0xe75c('0xaf')]],'[syncQueueStatusComplete]');_0xc73cf6[_0xe75c('0x1c')][_0xc73cf6[_0xe75c('0x20')][_0x24150f[_0xe75c('0xe2')]][_0xe75c('0xe9')]][_0xe75c('0xe7')]=![];delete _0xc73cf6[_0xe75c('0x20')][_0x24150f[_0xe75c('0xe2')]];unlockQueueStatus(_0x2485bf);});}else{utils[_0xe75c('0xed')](this[_0xe75c('0x1a')][this[_0xe75c('0x20')][_0x24150f['actionid']]['queue']],_0xe75c('0xee'));hopperUtils[_0xe75c('0xcc')]({'active':![],'ContactId':this[_0xe75c('0x20')][_0x24150f[_0xe75c('0xe2')]][_0xe75c('0xce')],'ListId':this['actions'][_0x24150f[_0xe75c('0xe2')]][_0xe75c('0xcf')],'VoiceQueueId':this[_0xe75c('0x20')][_0x24150f[_0xe75c('0xe2')]][_0xe75c('0xd0')]||undefined,'CampaignId':this[_0xe75c('0x20')][_0x24150f[_0xe75c('0xe2')]]['CampaignId']||undefined})['catch'](loggerCatch(_0xe75c('0xef')));delete this['actions'][_0x24150f[_0xe75c('0xe2')]];unlockQueueStatus(_0x2485bf);}}else if(_0x4a0b15===_0xe75c('0xe4')){var _0x39f195;if(this[_0xe75c('0x20')][_0x24150f['actionid']]&&!_[_0xe75c('0x41')](this[_0xe75c('0xea')][this[_0xe75c('0x20')][_0x24150f['actionid']][_0xe75c('0xaf')]])){if(this[_0xe75c('0xf0')][_0xc73cf6[_0xe75c('0x20')][_0x24150f[_0xe75c('0xe2')]][_0xe75c('0xaf')]]){this[_0xe75c('0xf0')][_0xc73cf6[_0xe75c('0x20')][_0x24150f[_0xe75c('0xe2')]][_0xe75c('0xaf')]]=this[_0xe75c('0xf0')][this['actions'][_0x24150f[_0xe75c('0xe2')]][_0xe75c('0xaf')]]?this['queueBookedRR'][this[_0xe75c('0x20')][_0x24150f[_0xe75c('0xe2')]]['queue']]:this['queueBooked'][this['actions'][_0x24150f[_0xe75c('0xe2')]][_0xe75c('0xaf')]]?this[_0xe75c('0xea')][this['actions'][_0x24150f['actionid']][_0xe75c('0xaf')]][_0xe75c('0xf1')]||0x0:0x0;}this[_0xe75c('0xea')][this[_0xe75c('0x20')][_0x24150f[_0xe75c('0xe2')]]['queue']][_0xe75c('0xf1')]=this['queueBookedRR'][this[_0xe75c('0x20')][_0x24150f[_0xe75c('0xe2')]][_0xe75c('0xaf')]];for(var _0x3f8ae5=0x0;_0x3f8ae5=_0xbf8e5b[_0xe75c('0x11e')]){_0x1dfad2[_0xe75c('0x11f')](_0xf06859,_0x471b96,_0x8c8db1,_0xe75c('0x120'));}else{if(_0xf06859[_0xe75c('0x116')]>=_0xbf8e5b[_0xe75c('0x121')]){_0x1dfad2['createStateFinal'](_0xf06859,_0x471b96,_0x8c8db1,'reason\x2019\x20machine....');}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0xf06859['countmachineretry'],'scheduledat':moment()[_0xe75c('0xcd')](_0xbf8e5b[_0xe75c('0x122')],_0xe75c('0xdc'))[_0xe75c('0x40')](_0xe75c('0xb4')),'ContactId':_0xf06859[_0xe75c('0xce')],'ListId':_0xf06859[_0xe75c('0xcf')],'VoiceQueueId':_0xf06859['VoiceQueueId']||undefined,'CampaignId':_0xf06859[_0xe75c('0xd1')]||undefined})['catch'](loggerCatch(_0xe75c('0x123')));_0x471b96({'reschedule':0x1});}}});}if(_0x44beac['type']==='ivr'&&this[_0xe75c('0x1b')][_0x44beac[_0xe75c('0xaf')]]['dialAMDActive']&&_0x2e88a1[_0xe75c('0x107')]===_0xe75c('0x108')){delete this[_0xe75c('0xb0')][_0x2e88a1[_0xe75c('0xb1')]];utils[_0xe75c('0xed')](this[_0xe75c('0x1b')][_0x44beac[_0xe75c('0xaf')]],'[syncVarSet]');_0x19b04f=new Hangup(_0x44beac,_0x2e88a1);_0x19b04f[_0xe75c('0x61')]=0x12;_0x19b04f[_0xe75c('0x62')]=_0xe75c('0x10b');_0x19b04f[_0xe75c('0x115')]='AMD';ami[_0xe75c('0x3a')](_0xe75c('0x10d'),ut['buildObj'](_0x19b04f,_0xe75c('0x10f')));this[_0xe75c('0x124')](_0x19b04f,_0xe75c('0x125'),_0xe75c('0x126'));}if(_0x44beac[_0xe75c('0x3b')]===_0xe75c('0xb2')&&this['campaigns'][_0x44beac[_0xe75c('0xaf')]]['dialAMDActive']&&_0x2e88a1[_0xe75c('0x107')]==='MACHINE'){return new Promise(function(_0x25cb8c,_0x81c03f){delete _0x1dfad2[_0xe75c('0xb0')][_0x2e88a1[_0xe75c('0xb1')]];utils[_0xe75c('0xed')](_0x1dfad2[_0xe75c('0x1b')][_0x44beac[_0xe75c('0xaf')]],'[syncVarSet]');_0x1dfad2[_0xe75c('0x1b')][_0x44beac[_0xe75c('0xaf')]]['outboundAnswerCallsDay']+=0x1;_0x1dfad2[_0xe75c('0x1b')][_0x44beac['queue']][_0xe75c('0x10a')]+=0x1;var _0x37b800=_0x1dfad2[_0xe75c('0x1b')][_0x44beac['queue']];var _0x5306f6=new Hangup(_0x44beac,_0x2e88a1);_0x5306f6['state']=0x13;_0x5306f6['statedesc']=_0xe75c('0x114');_0x5306f6[_0xe75c('0x115')]='AMD';_0x5306f6['countmachineretry']+=0x1;_0x5306f6[_0xe75c('0x117')]+=0x1;_0x5306f6[_0xe75c('0x10f')]=!![];ami[_0xe75c('0x3a')](_0xe75c('0x10d'),ut['buildObj'](_0x5306f6,_0xe75c('0x10f')));hopperUtils[_0xe75c('0xb8')](_0x5306f6)[_0xe75c('0x8e')](loggerCatch(_0xe75c('0x118')));if(_0x5306f6[_0xe75c('0x119')]+_0x5306f6[_0xe75c('0x11a')]+_0x5306f6[_0xe75c('0x11b')]+_0x5306f6[_0xe75c('0x11c')]+_0x5306f6['countdropretry']+_0x5306f6[_0xe75c('0xd8')]+_0x5306f6[_0xe75c('0x116')]+_0x5306f6[_0xe75c('0x11d')]>=_0x37b800[_0xe75c('0x11e')]){_0x1dfad2[_0xe75c('0x11f')](_0x5306f6,_0x25cb8c,_0x81c03f,_0xe75c('0x120'));}else{if(_0x5306f6['countmachineretry']>=_0x37b800['dialMachineMaxRetry']){_0x1dfad2[_0xe75c('0x127')](_0x5306f6,_0x25cb8c,_0x81c03f,_0xe75c('0x128'));}else{hopperUtils[_0xe75c('0xcc')]({'active':![],'countmachineretry':_0x5306f6['countmachineretry'],'scheduledat':moment()[_0xe75c('0xcd')](_0x37b800[_0xe75c('0x122')],_0xe75c('0xdc'))[_0xe75c('0x40')](_0xe75c('0xb4')),'ContactId':_0x5306f6['ContactId'],'ListId':_0x5306f6[_0xe75c('0xcf')],'VoiceQueueId':_0x5306f6[_0xe75c('0xd0')]||undefined,'CampaignId':_0x5306f6[_0xe75c('0xd1')]||undefined})[_0xe75c('0x8e')](loggerCatch(_0xe75c('0x123')));_0x25cb8c({'reschedule':0x1});}}});}}};Dialer[_0xe75c('0x14')]['syncHangup']=function(_0x4f97ae){var _0x92feec=this[_0xe75c('0xb0')][_0x4f97ae[_0xe75c('0xb1')]];var _0x35eabc;if(!_0x92feec){return;}if(_0x92feec[_0xe75c('0x3b')]===_0xe75c('0xb2')){delete this[_0xe75c('0xb0')][_0x4f97ae[_0xe75c('0xb1')]];utils[_0xe75c('0xed')](this['campaigns'][_0x92feec[_0xe75c('0xaf')]],_0xe75c('0x129'));this['campaigns'][_0x92feec[_0xe75c('0xaf')]]['ivrAnswerCallsDay']+=0x1;if(_0x4f97ae[_0xe75c('0x12a')]===_0xe75c('0x12b')){const _0x1756dc=new AgentComplete(_0x92feec,_0x4f97ae);_0x1756dc[_0xe75c('0xd1')]=this[_0xe75c('0x1b')][_0x92feec[_0xe75c('0xaf')]]['id'];hopperUtils['createHistory'](_0x1756dc)[_0xe75c('0x8e')](loggerCatch(_0xe75c('0x12c')));hopperUtils[_0xe75c('0xba')](_0x1756dc)[_0xe75c('0x8e')](loggerCatch(_0xe75c('0x12d')));}else{_0x35eabc=new Hangup(_0x92feec,_0x4f97ae);hopperUtils[_0xe75c('0xb8')](_0x35eabc)[_0xe75c('0x8e')](loggerCatch(_0xe75c('0x12e')));hopperUtils[_0xe75c('0xba')](_0x35eabc)['catch'](loggerCatch(_0xe75c('0x12f')));}}else{if(isNotNull(this['voiceQueues'][_0x92feec['queue']][_0xe75c('0x130')])){delete this[_0xe75c('0xb0')][_0x4f97ae[_0xe75c('0xb1')]];utils[_0xe75c('0xed')](this[_0xe75c('0x1a')][_0x92feec['queue']],_0xe75c('0x129'));this[_0xe75c('0x1a')][_0x92feec[_0xe75c('0xaf')]]['outboundAnswerCallsDay']+=0x1;this[_0xe75c('0x1a')][_0x92feec[_0xe75c('0xaf')]][_0xe75c('0x10a')]+=0x1;_0x35eabc=new Hangup(_0x92feec,_0x4f97ae);_0x35eabc[_0xe75c('0x61')]=0x10;_0x35eabc[_0xe75c('0x62')]=_0xe75c('0x131');_0x35eabc[_0xe75c('0x115')]=_0xe75c('0x132');hopperUtils['createHistory'](_0x35eabc)[_0xe75c('0x8e')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0xe75c('0xba')](_0x35eabc)[_0xe75c('0x8e')](loggerCatch('[syncHangupIvr]'));}else{delete this[_0xe75c('0xb0')][_0x4f97ae['uniqueid']];utils[_0xe75c('0xed')](this[_0xe75c('0x1a')][_0x92feec[_0xe75c('0xaf')]],_0xe75c('0x133'));if(_0x4f97ae[_0xe75c('0x12a')]==='Normal\x20Clearing'){this[_0xe75c('0x1a')][_0x92feec[_0xe75c('0xaf')]][_0xe75c('0x113')]+=0x1;const _0x8b10de=new AgentComplete(_0x92feec,_0x4f97ae);_0x8b10de[_0xe75c('0xd0')]=this[_0xe75c('0x1a')][_0x92feec['queue']]['id'];hopperUtils[_0xe75c('0xb8')](_0x8b10de)[_0xe75c('0x8e')](loggerCatch(_0xe75c('0xb9')));hopperUtils[_0xe75c('0xba')](_0x8b10de)[_0xe75c('0x8e')](loggerCatch('[syncAgentComplete]'));}else{this[_0xe75c('0x1a')][_0x92feec[_0xe75c('0xaf')]]['outboundUnknownCallsDay']+=0x1;_0x35eabc=new Hangup(_0x92feec,_0x4f97ae);_0x35eabc['state']=0xc;_0x35eabc[_0xe75c('0x62')]=_0x4f97ae[_0xe75c('0x12a')];_0x35eabc[_0xe75c('0x115')]=_0xe75c('0x134');hopperUtils[_0xe75c('0xb8')](_0x35eabc)[_0xe75c('0x8e')](loggerCatch(_0xe75c('0x135')));hopperUtils[_0xe75c('0xba')](_0x35eabc)['catch'](loggerCatch(_0xe75c('0x129')));}}}};Dialer[_0xe75c('0x14')][_0xe75c('0x7')]=function(_0x5b99b7){var _0x12b907=this;if(!_0x12b907[_0xe75c('0x25')][_0x5b99b7['name']]){_0x12b907[_0xe75c('0x25')][_0x5b99b7[_0xe75c('0x57')]]={'running':![]};}else if(_0x12b907['queuesSummary'][_0x5b99b7[_0xe75c('0x57')]][_0xe75c('0x136')]===!![]){return;}else if(_0x12b907['queuesSummary'][_0x5b99b7[_0xe75c('0x57')]][_0xe75c('0x136')]===![]){_0x12b907[_0xe75c('0x25')][_0x5b99b7[_0xe75c('0x57')]][_0xe75c('0x136')]=!![];}var _0x4a39e1=_0x12b907[_0xe75c('0x1a')][_0x5b99b7[_0xe75c('0x57')]];var _0x3f137b=_0x4a39e1['message']!==utils[_0xe75c('0x5f')]['INACTIVE'];var _0x4b44f1=utils[_0xe75c('0x137')](_0x4a39e1);_0x4a39e1[_0xe75c('0x138')]=utils['getQueueCampaignStatusMessage'](_0x4a39e1,_0x12b907[_0xe75c('0x1d')]);Promise[_0xe75c('0x99')]()[_0xe75c('0x38')](function(){if(_0x4a39e1[_0xe75c('0x138')]===utils[_0xe75c('0x5f')][_0xe75c('0x6c')]){if(_0x3f137b){clearPredictiveAttributes(_0x4a39e1);_0x5b99b7[_0xe75c('0x23')]=undefined;_0x5b99b7[_0xe75c('0x24')]=undefined;}if(_0x4a39e1[_0xe75c('0x138')]===utils[_0xe75c('0x5f')][_0xe75c('0x6c')]){_0x5b99b7[_0xe75c('0x139')]=0x0;_0x5b99b7[_0xe75c('0xe8')]=0x0;_0x5b99b7[_0xe75c('0x13a')]=0x0;_0x5b99b7[_0xe75c('0x13b')]=0x0;_0x5b99b7[_0xe75c('0x13c')]=0x0;}}else if(_0x4a39e1[_0xe75c('0x138')]===utils[_0xe75c('0x5f')][_0xe75c('0x13d')]&&!_0x4b44f1){return _0x12b907[_0xe75c('0x86')](_0x4a39e1,!![])['then'](function(){return _0x12b907['ifTime'](_0x4a39e1,![]);})[_0xe75c('0x38')](function(){return _0x12b907[_0xe75c('0x9e')](_0x4a39e1);})[_0xe75c('0x8e')](function(_0x1ba26f){loggerSyncQueueSummary[_0xe75c('0x3d')]('[syncQueueSummary]',util[_0xe75c('0x3f')](_0x1ba26f,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x4a39e1);});}else{clearPredictiveAttributes(_0x4a39e1);}})['then'](function(){var _0x20444=_0x5b99b7['compareToOutboundQueue'](_0x4a39e1);if(_0x20444||_0x4a39e1[_0xe75c('0x13e')]){_0x4a39e1[_0xe75c('0x13e')]=![];_0x5b99b7[_0xe75c('0x13f')](_0x4a39e1);Object[_0xe75c('0x140')](_0x4a39e1,_0x5b99b7);emitOutboundVoiceQueueSummary(_0x5b99b7);}_0x12b907[_0xe75c('0x25')][_0x4a39e1['name']]['running']=![];})[_0xe75c('0x8e')](function(_0x4f404f){logger[_0xe75c('0x59')](_0xe75c('0x141'),util[_0xe75c('0x3f')](_0x4f404f,{'showHidden':![],'depth':null}));_0x12b907[_0xe75c('0x25')][_0x4a39e1[_0xe75c('0x57')]][_0xe75c('0x136')]=![];});};Dialer[_0xe75c('0x14')][_0xe75c('0x2e')]=_['throttle'](function(){var _0x2fe6bf=_[_0xe75c('0x142')](this[_0xe75c('0x1a')],function(_0x411117){return _0x411117[_0xe75c('0x143')];});var _0x1931b0=_[_0xe75c('0x142')](this['agents'],function(_0x534b1a){return _0x534b1a[_0xe75c('0x144')]&&_0x534b1a[_0xe75c('0x7a')]===_0xe75c('0x7b');});if(_0x2fe6bf[_0xe75c('0x88')]>0x0&&_0x1931b0[_0xe75c('0x88')]>0x0){return Promise[_0xe75c('0x99')]()['then'](cmHopper[_0xe75c('0x145')](_[_0xe75c('0x146')](_0x2fe6bf,'id'),previewRecallmeReminderInterval,_['map'](_0x1931b0,'id')))[_0xe75c('0x38')](function(_0x2bc23b){for(var _0xf7048f=0x0;_0xf7048f<_0x2bc23b['length'];_0xf7048f++){var _0x1b18bd=_0x2bc23b[_0xf7048f]['Agent'][_0xe75c('0x57')];if(_0x1b18bd)io['to'](util[_0xe75c('0x40')](_0xe75c('0x147'),_0x1b18bd))[_0xe75c('0x3a')](_0xe75c('0x148'),{'hopper':_0x2bc23b[_0xf7048f]});}})[_0xe75c('0x8e')](function(_0x7df51e){logger['error'](_0xe75c('0x149'),_0x7df51e);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0xe75c('0x14')][_0xe75c('0x14a')]=function(){var _0x1ccbe4=this;setInterval(function(){_0x1ccbe4[_0xe75c('0x14b')](_0x1ccbe4[_0xe75c('0xb0')],'[uniqueid]');_0x1ccbe4[_0xe75c('0x14b')](_0x1ccbe4[_0xe75c('0x20')],'[actions]');},0x32c8);};Dialer[_0xe75c('0x14')][_0xe75c('0x14b')]=function(_0x50c4a4,_0x1e4994){var _0x20c5b8=this;for(var _0x4d0359 in _0x50c4a4){if(typeof _0x50c4a4[_0x4d0359]!==_0xe75c('0x97')){this[_0xe75c('0x18')][_0xe75c('0x15')](function(){if(!_[_0xe75c('0xe6')](_0x50c4a4[_0x4d0359])){return ami['Action']({'action':'status','channel':_0x50c4a4[_0x4d0359][_0xe75c('0xe1')]})[_0xe75c('0x8e')](function(_0x45d917){if(_0x45d917[_0xe75c('0x5e')]===_0xe75c('0x14c')){setTimeout(function(){if(_0x50c4a4[_0x4d0359]&&_0x50c4a4[_0x4d0359][_0xe75c('0x3b')]!==_0xe75c('0xb2')){utils['decrementOriginate'](_0x20c5b8[_0xe75c('0x1a')][_0x50c4a4[_0x4d0359]['queue']],_0xe75c('0x14d'));logger[_0xe75c('0x59')](_0xe75c('0x14e'),_0x1e4994,_0x4d0359,_0x50c4a4[_0x4d0359][_0xe75c('0xaf')]);delete _0x50c4a4[_0x4d0359];}if(_0x50c4a4[_0x4d0359]&&_0x50c4a4[_0x4d0359]['type']===_0xe75c('0xb2')){utils[_0xe75c('0xed')](_0x20c5b8[_0xe75c('0x1b')][_0x50c4a4[_0x4d0359]['queue']],'[clearZombieChannels]');logger[_0xe75c('0x59')](_0xe75c('0x14f'),_0x1e4994,_0x4d0359,_0x50c4a4[_0x4d0359][_0xe75c('0xaf')]);delete _0x50c4a4[_0x4d0359];}},0x2328);}});}});}}};Dialer[_0xe75c('0x14')][_0xe75c('0x150')]=function(_0xac0f58){return Promise[_0xe75c('0x99')]()[_0xe75c('0x38')](voiceQueueRt['getVoiceQueueRtPauses'](_0xac0f58))['catch'](loggerCatch(_0xe75c('0x151')));};Dialer[_0xe75c('0x14')]['emptyContact']=function(_0x33e791,_0x553ba4,_0x409702){var _0x971a7b={'state':0x19,'statedesc':_0xe75c('0x152')};utils['decrementOriginate'](_0x553ba4,'[emptyContact]'+_0x33e791);this[_0xe75c('0x124')](_[_0xe75c('0x55')](_0x971a7b,_['pick'](_0x409702,[_0xe75c('0xce'),'ListId','UserId',_0xe75c('0xd0'),_0xe75c('0xd1')])),'[emptyContact][createHistory]',_0xe75c('0x153'));logger[_0xe75c('0x59')](_0x33e791);};Dialer[_0xe75c('0x14')][_0xe75c('0x124')]=function(_0x2fcffc,_0x736c30,_0x42a2e6){hopperUtils[_0xe75c('0xb8')](_0x2fcffc)['catch'](loggerCatch(_0x736c30));hopperUtils[_0xe75c('0xba')](_0x2fcffc)['catch'](loggerCatch(_0x42a2e6));};Dialer[_0xe75c('0x14')][_0xe75c('0xdb')]=function(_0x34313f,_0x1abec2){hopperUtils['createHistory'](_0x34313f)['catch'](loggerCatch(_0xe75c('0xb9')));if(_0x1abec2==0x0){hopperUtils['moveContactManagedDialer'](_0x34313f)[_0xe75c('0x8e')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));}};Dialer[_0xe75c('0x14')]['checkPreviewRecallReminder']=function(_0x3b57be){return Promise[_0xe75c('0x99')]()[_0xe75c('0x38')](cmHopper[_0xe75c('0x145')](_0x3b57be['id'],previewRecallmeReminderInterval))[_0xe75c('0x38')](function(_0x4ea9e6){for(var _0x205ff6=0x0;_0x205ff6<_0x4ea9e6[_0xe75c('0x88')];_0x205ff6++){var _0x3f2cd2=_0x4ea9e6[_0x205ff6][_0xe75c('0x154')][_0xe75c('0x57')];if(_0x3f2cd2)io['to'](util[_0xe75c('0x40')](_0xe75c('0x147'),_0x3f2cd2))[_0xe75c('0x3a')](_0xe75c('0x148'),{'hopper':_0x4ea9e6[_0x205ff6]});}})['catch'](function(){});};Dialer[_0xe75c('0x14')][_0xe75c('0x9c')]=function(_0x27e82b){var _0x2124be=this;return function(){_0x2124be[_0xe75c('0x155')](_0x27e82b);};};Dialer['prototype']['actionOriginate']=function(_0x5d582f,_0x189c09){var _0x1f9cd7=this;var _0x2b5153=uuid['v4']();this[_0xe75c('0x20')][_0x2b5153]=new Action(_0x5d582f,_0x189c09,_0x2b5153);return new Promise(function(_0x154139,_0x5be49b){if(_[_0xe75c('0x39')](_0x5d582f)&&typeof _0x5d582f!==_0xe75c('0x156')){return _0x5be49b(msgResponse(_0xe75c('0x157'),'Failure','voiceQueue\x20is\x20undefine'));}if(_['isUndefined'](_0x189c09['phone'])||_0x189c09[_0xe75c('0x158')]===null){return _0x5be49b(msgResponse('originate',_0xe75c('0x83'),_0xe75c('0x159')));}var _0x214657={'XMD-CALLERID':_0x1f9cd7['actions'][_0x2b5153][_0xe75c('0x15a')](),'XMD-AGI':_0x5d582f['dialQueueProject']?util[_0xe75c('0x40')](_0xe75c('0x15b'),ipAgi,_0x5d582f[_0xe75c('0x130')]):_0xe75c('0x15c'),'XMD-AGIAFTER':_0x5d582f[_0xe75c('0x15d')]?util[_0xe75c('0x40')]('\x22agi://%s/square,%s\x22',ipAgi,_0x5d582f[_0xe75c('0x15d')]):_0xe75c('0x15c'),'XMD-QUEUE':utils[_0xe75c('0x15e')](_0x5d582f)?util[_0xe75c('0x40')](_0xe75c('0x15f'),_0x5d582f['name'],_0x5d582f[_0xe75c('0x160')]||'',_0x5d582f[_0xe75c('0xb7')]?'c':'',_0x5d582f[_0xe75c('0x161')]||0x3):_0xe75c('0x15c'),'XMD-CONTACTID':_0x189c09[_0xe75c('0xce')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x1f9cd7[_0xe75c('0x20')][_0x2b5153]['getCaller'](),'XMD-AMD':_0x5d582f[_0xe75c('0x106')]?_0xe75c('0x13d'):_0xe75c('0x15c'),'XMD-DESTINATION':_0xe75c('0x105')};if(_0x5d582f['dialAMDActive']){_0x214657[_0xe75c('0x162')]=_0x5d582f[_0xe75c('0x163')]||0x9c4;_0x214657[_0xe75c('0x164')]=_0x5d582f['dialAMDGreeting']||0x5dc;_0x214657[_0xe75c('0x165')]=_0x5d582f[_0xe75c('0x166')]||0x320;_0x214657[_0xe75c('0x167')]=_0x5d582f['dialAMDTotalAnalysisTime']||0x1388;_0x214657['XMD-AMDMINWORDLENGTH']=_0x5d582f['dialAMDMinWordLength']||0x64;_0x214657['XMD-AMDBETWEENWORDSSILENCE']=_0x5d582f[_0xe75c('0x168')]||0x32;_0x214657[_0xe75c('0x169')]=_0x5d582f[_0xe75c('0x16a')]||0x3;_0x214657['XMD-AMDSILENCETHRESHOLD']=_0x5d582f['dialAMDSilenceThreshold']||0x100;_0x214657[_0xe75c('0x16b')]=_0x5d582f['dialAMDMaximumWordLength']||0x1388;}if(utils['isOutboundQueue'](_0x5d582f)){_0x214657[_0xe75c('0x16c')]=_0x189c09['VoiceQueueId'];}else{_0x214657[_0xe75c('0x16d')]=_0x189c09[_0xe75c('0xd1')];}var _0x19a6d4=utils['setXMDContactVariables'](_0x189c09[_0xe75c('0x16e')]);Object[_0xe75c('0x140')](_0x214657,_0x19a6d4);var _0x2593fa=_0x1f9cd7[_0xe75c('0x77')](_0x5d582f['Trunk'])?utils['getCallerId'](_0x5d582f[_0xe75c('0x7d')][_0xe75c('0x16f')],_0x5d582f['dialOriginateCallerIdName'],_0x5d582f[_0xe75c('0x170')]>0x0?utils[_0xe75c('0x171')](_0x5d582f['dialOriginateCallerIdNumber'],_0x5d582f[_0xe75c('0x170')]):_0x5d582f[_0xe75c('0x172')]):utils[_0xe75c('0x173')](_[_0xe75c('0xe6')](_0x5d582f['TrunkBackup'])?_0x5d582f[_0xe75c('0x7d')][_0xe75c('0x16f')]:_0x5d582f[_0xe75c('0x174')]['callerid'],_0x5d582f[_0xe75c('0x175')],_0x5d582f['dialRandomLastDigitCallerIdNumber']>0x0?utils[_0xe75c('0x171')](_0x5d582f[_0xe75c('0x172')],_0x5d582f[_0xe75c('0x170')]):_0x5d582f[_0xe75c('0x172')]);if(_0x2593fa){_0x214657['XMD-ORIGINATECALLERIDNAME']=_0x1f9cd7['actions'][_0x2b5153][_0xe75c('0x176')]=utils[_0xe75c('0x177')](_0x2593fa);_0x214657[_0xe75c('0x178')]=_0x189c09[_0xe75c('0x158')];}_0x5d582f[_0xe75c('0x179')]=_0x214657;return ami[_0xe75c('0x8a')]({'actionid':_0x2b5153,'action':'originate','channel':_0x1f9cd7['isTrunkReachable'](_0x5d582f[_0xe75c('0x7d')])?util[_0xe75c('0x40')]('SIP/%s/%s%s',_0x5d582f[_0xe75c('0x7d')]['name'],isNotNull(_0x5d582f[_0xe75c('0x17a')])?_0x5d582f[_0xe75c('0x17a')][_0xe75c('0x17b')]()||'':'',_0x5d582f[_0xe75c('0x17c')]>0x0?_0x189c09[_0xe75c('0x158')][_0xe75c('0x17d')](_0x5d582f[_0xe75c('0x17c')]):_0x189c09[_0xe75c('0x158')]):util['format'](_0xe75c('0x17e'),_[_0xe75c('0xe6')](_0x5d582f[_0xe75c('0x174')])?_0x5d582f[_0xe75c('0x7d')][_0xe75c('0x57')]:_0x5d582f['TrunkBackup'][_0xe75c('0x57')],isNotNull(_0x5d582f[_0xe75c('0x17a')])?_0x5d582f[_0xe75c('0x17a')]['trim']()||'':'',_0x5d582f[_0xe75c('0x17c')]>0x0?_0x189c09[_0xe75c('0x158')][_0xe75c('0x17d')](_0x5d582f[_0xe75c('0x17c')]):_0x189c09[_0xe75c('0x158')]),'callerid':_0x2593fa,'Exten':_0xe75c('0x105'),'Context':_0xe75c('0x17f'),'Priority':'1','variable':_0x214657,'timeout':(_0x5d582f['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x2b5153})['then'](function(_0x3af7f9){return _0x154139(_0x3af7f9);})['catch'](function(_0x219dd3){_0x5d582f[_0xe75c('0x180')]+=0x1;var _0x3bef62=new History(_0x1f9cd7[_0xe75c('0x20')][_0x2b5153]);logger[_0xe75c('0x59')](util[_0xe75c('0x40')](_0xe75c('0x181'),JSON['stringify'](_0x219dd3)));_0x3bef62[_0xe75c('0x61')]=0xe;_0x3bef62[_0xe75c('0x62')]=_0xe75c('0x182');_0x3bef62[_0xe75c('0x64')]=moment()[_0xe75c('0x40')](_0xe75c('0xb4'));_0x3bef62[_0xe75c('0x63')]=_0x3bef62[_0xe75c('0x64')];hopperUtils[_0xe75c('0xb8')](_0x3bef62)['catch'](loggerCatch(_0xe75c('0x183')));_0x1f9cd7[_0xe75c('0xba')](_0x3bef62)[_0xe75c('0x8e')](loggerCatch(_0xe75c('0x183')))[_0xe75c('0x17')](function(){delete _0x1f9cd7['actions'][_0x2b5153];return _0x5be49b(msgResponse(_0xe75c('0x157'),_0xe75c('0x76'),'originate\x20action\x20Error'));});});});};Dialer[_0xe75c('0x14')][_0xe75c('0x184')]=function(_0xd6452a,_0x4b8f1c,_0xaad9){var _0x489d1d=new History(_0x4b8f1c);if(_0x489d1d[_0xe75c('0x119')]+_0x489d1d[_0xe75c('0x11a')]+_0x489d1d[_0xe75c('0x11b')]+_0x489d1d[_0xe75c('0x11c')]+_0x489d1d['countdropretry']+_0x489d1d['countabandonedretry']+_0x489d1d[_0xe75c('0x116')]+_0x489d1d['countagentrejectretry']>=_0xaad9[_0xe75c('0x11e')]-0x1){return!![];}switch(_0xd6452a){case 0x3:if(_0x489d1d[_0xe75c('0x11b')]>=_0xaad9[_0xe75c('0x185')]-0x1){return!![];}hopperUtils[_0xe75c('0xcc')]({'active':![],'countnoanswerretry':_0x489d1d[_0xe75c('0x11b')]+=0x1,'scheduledat':moment()['add'](_0xaad9[_0xe75c('0x186')],'minutes')[_0xe75c('0x40')](_0xe75c('0xb4')),'ContactId':_0x489d1d['ContactId'],'ListId':_0x489d1d[_0xe75c('0xcf')],'VoiceQueueId':_0x489d1d[_0xe75c('0xd0')]||undefined,'CampaignId':_0x489d1d['CampaignId']||undefined})[_0xe75c('0x8e')](loggerCatch(_0xe75c('0x187')));break;case 0x5:if(_0x489d1d['countbusyretry']>=_0xaad9[_0xe75c('0x188')]-0x1){return!![];}hopperUtils[_0xe75c('0xcc')]({'active':![],'countbusyretry':_0x489d1d[_0xe75c('0x119')]+=0x1,'scheduledat':moment()['add'](_0xaad9['dialBusyRetryFrequency'],_0xe75c('0xdc'))[_0xe75c('0x40')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x489d1d[_0xe75c('0xce')],'ListId':_0x489d1d[_0xe75c('0xcf')],'VoiceQueueId':_0x489d1d['VoiceQueueId']||undefined,'CampaignId':_0x489d1d[_0xe75c('0xd1')]||undefined})[_0xe75c('0x8e')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x489d1d[_0xe75c('0x11a')]>=_0xaad9[_0xe75c('0x189')]-0x1){return!![];}hopperUtils[_0xe75c('0xcc')]({'active':![],'countcongestionretry':_0x489d1d[_0xe75c('0x11a')]+=0x1,'scheduledat':moment()[_0xe75c('0xcd')](_0xaad9[_0xe75c('0x18a')],_0xe75c('0xdc'))[_0xe75c('0x40')](_0xe75c('0xb4')),'ContactId':_0x489d1d['ContactId'],'ListId':_0x489d1d[_0xe75c('0xcf')],'VoiceQueueId':_0x489d1d[_0xe75c('0xd0')]||undefined,'CampaignId':_0x489d1d['CampaignId']||undefined})[_0xe75c('0x8e')](loggerCatch(_0xe75c('0x18b')));break;case 0x0:if(_0x489d1d['countnosuchnumberretry']>=_0xaad9['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{hopperUtils['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x489d1d['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0xe75c('0xcd')](_0xaad9[_0xe75c('0x18c')],'minutes')[_0xe75c('0x40')](_0xe75c('0xb4')),'ContactId':_0x489d1d[_0xe75c('0xce')],'ListId':_0x489d1d[_0xe75c('0xcf')],'VoiceQueueId':_0x489d1d[_0xe75c('0xd0')]||undefined,'CampaignId':_0x489d1d[_0xe75c('0xd1')]||undefined})[_0xe75c('0x8e')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x489d1d[_0xe75c('0xc5')]>=_0xaad9[_0xe75c('0xcb')]-0x1){return!![];}hopperUtils[_0xe75c('0xcc')]({'active':![],'countdropretry':_0x489d1d['countdropretry']+=0x1,'scheduledat':moment()['add'](_0xaad9['dialDropRetryFrequency'],_0xe75c('0xdc'))[_0xe75c('0x40')](_0xe75c('0xb4')),'ContactId':_0x489d1d[_0xe75c('0xce')],'ListId':_0x489d1d[_0xe75c('0xcf')],'VoiceQueueId':_0x489d1d['VoiceQueueId']||undefined,'CampaignId':_0x489d1d[_0xe75c('0xd1')]||undefined})[_0xe75c('0x8e')](loggerCatch(_0xe75c('0xd2')));break;case 0xb:if(_0x489d1d[_0xe75c('0xd8')]>=_0xaad9[_0xe75c('0xda')]-0x1){return!![];}hopperUtils[_0xe75c('0xcc')]({'active':![],'countabandonedretry':_0x489d1d['countabandonedretry']+=0x1,'scheduledat':moment()[_0xe75c('0xcd')](_0xaad9[_0xe75c('0xd9')],'minutes')[_0xe75c('0x40')](_0xe75c('0xb4')),'ContactId':_0x489d1d[_0xe75c('0xce')],'ListId':_0x489d1d[_0xe75c('0xcf')],'VoiceQueueId':_0x489d1d[_0xe75c('0xd0')]||undefined,'CampaignId':_0x489d1d[_0xe75c('0xd1')]||undefined})[_0xe75c('0x8e')](loggerCatch(_0xe75c('0xdd')));break;case 0x13:if(_0x489d1d[_0xe75c('0x116')]>=_0xaad9[_0xe75c('0x121')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x489d1d[_0xe75c('0x116')]+=0x1,'scheduledat':moment()[_0xe75c('0xcd')](_0xaad9[_0xe75c('0x122')],_0xe75c('0xdc'))[_0xe75c('0x40')](_0xe75c('0xb4')),'ContactId':_0x489d1d['ContactId'],'ListId':_0x489d1d[_0xe75c('0xcf')],'VoiceQueueId':_0x489d1d[_0xe75c('0xd0')]||undefined,'CampaignId':_0x489d1d['CampaignId']||undefined})[_0xe75c('0x8e')](loggerCatch(_0xe75c('0x123')));break;case 0x14:if(_0x489d1d['countagentrejectretry']>=_0xaad9[_0xe75c('0x18d')]-0x1){return!![];}hopperUtils[_0xe75c('0xcc')]({'active':![],'countagentrejectretry':_0x489d1d['countagentrejectretry']+=0x1,'scheduledat':moment()['add'](_0xaad9[_0xe75c('0x18e')],'minutes')[_0xe75c('0x40')](_0xe75c('0xb4')),'ContactId':_0x489d1d[_0xe75c('0xce')],'ListId':_0x489d1d['ListId'],'VoiceQueueId':_0x489d1d[_0xe75c('0xd0')]||undefined,'CampaignId':_0x489d1d[_0xe75c('0xd1')]||undefined})[_0xe75c('0x8e')](loggerCatch(_0xe75c('0x18f')));break;default:return!![];}};Dialer[_0xe75c('0x14')][_0xe75c('0x101')]=function(_0x207987,_0x24cd3d,_0x3facd9){var _0x419103=this;var _0x5c5449=new History(_0x207987);var _0x2e4cff=![];var _0x2da198;var _0x33ed77;return new Promise(function(_0x2c0433,_0x3bedf5){if(_[_0xe75c('0x39')](_0x24cd3d)&&typeof _0x24cd3d!==_0xe75c('0x156')){return _0x3bedf5(msgResponse(_0xe75c('0x190'),_0xe75c('0x83'),_0xe75c('0x191')));}if(_['isUndefined'](_0x3facd9)&&typeof _0x3facd9!==_0xe75c('0x156')){return _0x3bedf5(msgResponse(_0xe75c('0x190'),_0xe75c('0x83'),_0xe75c('0x192')));}hopperUtils[_0xe75c('0xc8')](_0x5c5449,_0x3facd9[_0xe75c('0x193')],_0x24cd3d)['then'](function(_0x2dcf72){if(_0x2dcf72[_0xe75c('0xca')]==0x1)_0x2e4cff=!![];switch(_0x3facd9['reason']){case'0':_0x24cd3d[_0xe75c('0x194')]+=0x1;_0x5c5449[_0xe75c('0x61')]=0x0;_0x5c5449[_0xe75c('0x62')]='NoSuchNumber';_0x5c5449['countnosuchnumberretry']+=0x1;_0x5c5449[_0xe75c('0x117')]+=0x1;ami[_0xe75c('0x3a')](_0xe75c('0x195'),ut['buildObj'](_0x207987,_0xe75c('0x196')));_0x2da198=_0x24cd3d[_0xe75c('0x18c')];_0x33ed77=_0x24cd3d['callAdditionalPhoneAfterMin'];hopperUtils[_0xe75c('0xb8')](_0x5c5449)[_0xe75c('0x8e')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x419103[_0xe75c('0x184')](0x0,_0x207987,_0x24cd3d)&&!_0x2e4cff){if(_0x5c5449[_0xe75c('0x11c')]>=_0x24cd3d[_0xe75c('0x197')]){_0x419103[_0xe75c('0x127')](_0x5c5449,_0x2c0433,_0x3bedf5,_0xe75c('0x198'));}else{_0x419103[_0xe75c('0x11f')](_0x5c5449,_0x2c0433,_0x3bedf5,_0xe75c('0x198'));}}break;case'3':_0x24cd3d[_0xe75c('0x199')]+=0x1;_0x5c5449[_0xe75c('0x61')]=0x3;_0x5c5449[_0xe75c('0x62')]='NoAnswer';_0x5c5449['countnoanswerretry']+=0x1;_0x5c5449[_0xe75c('0x117')]+=0x1;var _0x5df731=ut[_0xe75c('0x19a')](_0x207987,_0x24cd3d);ami[_0xe75c('0x3a')](_0xe75c('0x19b'),_0x5df731);_0x2da198=_0x24cd3d[_0xe75c('0x186')];_0x33ed77=_0x24cd3d[_0xe75c('0xc7')];hopperUtils['createHistory'](_0x5c5449)[_0xe75c('0x8e')](loggerCatch(_0xe75c('0x19c')));if(_0x419103['checkRetriveMax'](0x3,_0x207987,_0x24cd3d)&&!_0x2e4cff){if(_0x5c5449['countnoanswerretry']>=_0x24cd3d['dialNoAnswerMaxRetry']){_0x419103[_0xe75c('0x127')](_0x5c5449,_0x2c0433,_0x3bedf5,_0xe75c('0x19d'));}else{_0x419103[_0xe75c('0x11f')](_0x5c5449,_0x2c0433,_0x3bedf5,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x24cd3d[_0xe75c('0x19e')]+=0x1;_0x5c5449[_0xe75c('0x61')]=0x5;_0x5c5449[_0xe75c('0x62')]=_0xe75c('0x19f');_0x5c5449['countbusyretry']+=0x1;_0x5c5449[_0xe75c('0x117')]+=0x1;ami['emit']('custom:agentbusy',ut['buildObj'](_0x207987,_0xe75c('0x1a0')));_0x2da198=_0x24cd3d[_0xe75c('0x1a1')];_0x33ed77=_0x24cd3d[_0xe75c('0xc7')];hopperUtils['createHistory'](_0x5c5449)[_0xe75c('0x8e')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x419103[_0xe75c('0x184')](0x5,_0x207987,_0x24cd3d)&&!_0x2e4cff){if(_0x5c5449[_0xe75c('0x119')]>=_0x24cd3d[_0xe75c('0x188')]){_0x419103[_0xe75c('0x127')](_0x5c5449,_0x2c0433,_0x3bedf5,_0xe75c('0x1a2'));}else{_0x419103[_0xe75c('0x11f')](_0x5c5449,_0x2c0433,_0x3bedf5,'reason\x205\x20busy');}}break;case'8':_0x24cd3d['outboundCongestionCallsDay']+=0x1;_0x5c5449[_0xe75c('0x61')]=0x8;_0x5c5449[_0xe75c('0x62')]=_0xe75c('0x1a3');_0x5c5449[_0xe75c('0x11a')]+=0x1;_0x5c5449[_0xe75c('0x117')]+=0x1;_0x2da198=_0x24cd3d[_0xe75c('0x18a')];_0x33ed77=_0x24cd3d['callAdditionalPhoneAfterMin'];ami['emit'](_0xe75c('0x1a4'),ut['buildObj'](_0x207987,'congestion'));hopperUtils[_0xe75c('0xb8')](_0x5c5449)['catch'](loggerCatch(_0xe75c('0x1a5')));if(_0x419103['checkRetriveMax'](0x8,_0x207987,_0x24cd3d)&&!_0x2e4cff){if(_0x5c5449['countcongestionretry']>=_0x24cd3d[_0xe75c('0x189')]){_0x419103[_0xe75c('0x127')](_0x5c5449,_0x2c0433,_0x3bedf5,'reason\x208\x20congestion');}else{_0x419103[_0xe75c('0x11f')](_0x5c5449,_0x2c0433,_0x3bedf5,_0xe75c('0x1a6'));}}break;case'11':_0x24cd3d[_0xe75c('0x1a7')]+=0x1;_0x5c5449[_0xe75c('0x61')]=0xb;_0x5c5449['statedesc']='Abandoned';_0x5c5449[_0xe75c('0xd8')]+=0x1;_0x5c5449['countglobal']+=0x1;_0x2da198=_0x24cd3d[_0xe75c('0xd9')];_0x33ed77=_0x24cd3d[_0xe75c('0xc7')];hopperUtils[_0xe75c('0xb8')](_0x5c5449)[_0xe75c('0x8e')](loggerCatch(_0xe75c('0xe0')));if(_0x419103[_0xe75c('0x184')](0xb,_0x207987,_0x24cd3d)&&!_0x2e4cff){if(_0x5c5449[_0xe75c('0xd8')]>=_0x24cd3d[_0xe75c('0xda')]){_0x419103[_0xe75c('0x127')](_0x5c5449,_0x2c0433,_0x3bedf5,_0xe75c('0x1a8'));}else{_0x419103[_0xe75c('0x11f')](_0x5c5449,_0x2c0433,_0x3bedf5,_0xe75c('0x1a8'));}}break;case'20':_0x24cd3d[_0xe75c('0x1a9')]+=0x1;_0x5c5449[_0xe75c('0x61')]=0x14;_0x5c5449[_0xe75c('0x62')]=_0xe75c('0x1aa');_0x5c5449[_0xe75c('0x11d')]+=0x1;_0x5c5449[_0xe75c('0x117')]+=0x1;_0x2da198=_0x24cd3d[_0xe75c('0x18e')];_0x33ed77=_0x24cd3d[_0xe75c('0xc7')];ami[_0xe75c('0x3a')](_0xe75c('0x1ab'),ut[_0xe75c('0x10e')](_0x207987,_0xe75c('0x1ac')));hopperUtils['createHistory'](_0x5c5449)['catch'](loggerCatch(_0xe75c('0x1ad')));if(_0x419103[_0xe75c('0x184')](0x14,_0x207987,_0x24cd3d)&&!_0x2e4cff){if(_0x5c5449[_0xe75c('0x11d')]>=_0x24cd3d[_0xe75c('0x18d')]){_0x419103[_0xe75c('0x127')](_0x5c5449,_0x2c0433,_0x3bedf5,_0xe75c('0x1ae'));}else{_0x419103[_0xe75c('0x11f')](_0x5c5449,_0x2c0433,_0x3bedf5,_0xe75c('0x1ae'));}}break;default:_0x24cd3d[_0xe75c('0x1af')]+=0x1;_0x5c5449[_0xe75c('0x61')]=0xc;_0x5c5449[_0xe75c('0x62')]=_0x3facd9[_0xe75c('0x193')];_0x2da198=_0x24cd3d[_0xe75c('0x18e')];_0x33ed77=_0x24cd3d[_0xe75c('0xc7')];hopperUtils[_0xe75c('0xb8')](_0x5c5449)[_0xe75c('0x8e')](loggerCatch(_0xe75c('0x1b0')));if(_0x419103['checkRetriveMax'](_0x3facd9[_0xe75c('0x193')],_0x207987,_0x24cd3d)&&!_0x2e4cff){if(_0x5c5449[_0xe75c('0x119')]+_0x5c5449[_0xe75c('0x11a')]+_0x5c5449[_0xe75c('0x11b')]+_0x5c5449[_0xe75c('0x11c')]+_0x5c5449[_0xe75c('0xc5')]+_0x5c5449[_0xe75c('0xd8')]+_0x5c5449[_0xe75c('0x116')]+_0x5c5449[_0xe75c('0x11d')]>=_0x24cd3d[_0xe75c('0x11e')]){_0x419103[_0xe75c('0x11f')](_0x5c5449,_0x2c0433,_0x3bedf5,_0x3facd9['reason']);}else{_0x419103[_0xe75c('0x127')](_0x5c5449,_0x2c0433,_0x3bedf5,_0x3facd9[_0xe75c('0x193')]);}}}})[_0xe75c('0x38')](function(){if(_0x2e4cff){hopperUtils[_0xe75c('0xd5')](_0x5c5449,_0x2da198,_0x33ed77)[_0xe75c('0x38')](function(){return _0x2c0433(0x1);});}});});};Dialer[_0xe75c('0x14')]['stateGlobal']=function(_0x5134e9,_0x840f16,_0x3769c3,_0x336347){var _0x556bf9=new Final(_0x5134e9);_0x556bf9[_0xe75c('0x61')]=0xf;_0x556bf9[_0xe75c('0x62')]=_0xe75c('0x1b1');this['createStateFinal'](_0x556bf9,_0x840f16,_0x3769c3,_0x336347);};Dialer['prototype']['createStateFinal']=function(_0x5f07eb,_0xf89d53,_0x5a84a5,_0x2098d7){hopperUtils[_0xe75c('0xba')](_0x5f07eb)[_0xe75c('0x38')](function(){return _0xf89d53(msgResponse(_0xe75c('0x190'),'Success',_0x2098d7));})['catch'](function(){return _0x5a84a5(msgResponse(_0xe75c('0x1b2'),_0xe75c('0x83'),_0xe75c('0x1b3')));});};Dialer[_0xe75c('0x14')]['predictive']=function(_0x2cf9cd){var _0x12b647=_0x2cf9cd[_0xe75c('0x1b4')]/0x64;var _0x1bb0bc=_0x2cf9cd[_0xe75c('0xbf')]/(_0x2cf9cd[_0xe75c('0xbf')]+_0x2cf9cd['outboundAnswerCallsDay']);var _0x4ecfbf=Math[_0xe75c('0x1b5')](_0x2cf9cd['predictiveIntervalAvailable']*(_0x2cf9cd['predictiveIntervalMaxThreshold']/0x64));var _0x39f04b=Math[_0xe75c('0x1b5')](_0x2cf9cd[_0xe75c('0x1b6')]*(_0x2cf9cd[_0xe75c('0x1b7')]/0x64));var _0x2f6ada=_0x2cf9cd['available']+_0x2cf9cd[_0xe75c('0x13b')];var _0x4b18be=Math[_0xe75c('0x1b8')](_0x2cf9cd[_0xe75c('0x4e')]*_0x2cf9cd[_0xe75c('0x50')]*_0x2cf9cd['predictiveIntervalHitRate']*_0x2cf9cd['predictiveIntervalMultiplicativeFactor']);if(_['isUndefined'](_0x2cf9cd[_0xe75c('0x24')])){if(!_[_0xe75c('0x39')](_0x2cf9cd[_0xe75c('0x23')])){_0x2cf9cd[_0xe75c('0x23')]=undefined;loggerPredictive[_0xe75c('0x59')](_0xe75c('0x1b9'),_0xe75c('0x1ba'));}if(!_['isUndefined'](_0x2cf9cd[_0xe75c('0x58')])){loggerPredictive[_0xe75c('0x59')](_0xe75c('0x1b9'),_0xe75c('0x1bb'));clearInterval(_0x2cf9cd[_0xe75c('0x58')]);_0x2cf9cd['handlePredictive']=undefined;}_0x2cf9cd[_0xe75c('0x24')]=moment()[_0xe75c('0x40')](_0xe75c('0xb4'));loggerPredictive[_0xe75c('0x42')](_0x2cf9cd[_0xe75c('0x57')],_0xe75c('0x1bc'),_0x2cf9cd['startProgressive']);this[_0xe75c('0xa2')](_0x2cf9cd,0x1);}else if(ifInterval(_0x2cf9cd['dialPredictiveInterval'],_0x2cf9cd[_0xe75c('0x24')])){this['handlePower'](_0x2cf9cd,0x1);loggerPredictiveCalls[_0xe75c('0x42')]('[startMethodPredictive][StartProgressive][Loop]',_0x2cf9cd[_0xe75c('0x24')],_0x2cf9cd[_0xe75c('0x57')]);_0x2cf9cd[_0xe75c('0x4e')]=0x0;_0x2cf9cd['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x12b647<_0x1bb0bc&&_0x2cf9cd[_0xe75c('0x1bd')]===_0xe75c('0x1be')){clearPredictiveAttributes(_0x2cf9cd);loggerPredictive[_0xe75c('0x42')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day',_0x1bb0bc,_0xe75c('0x24'),_0x2cf9cd[_0xe75c('0x57')]);}else if(_0x4b18be<_0x2cf9cd[_0xe75c('0xc0')]&&_0x2cf9cd['dialPredictiveOptimization']===_0xe75c('0x1be')){clearPredictiveAttributes(_0x2cf9cd);loggerPredictive[_0xe75c('0x42')](_0xe75c('0x1bf'),'Max\x20Drop\x20',_0x4b18be,_0xe75c('0x1c0'),_0x2cf9cd[_0xe75c('0xc0')],_0xe75c('0x24'),_0x2cf9cd['name']);}else if(!ifInterval(_0x2cf9cd['dialPredictiveInterval'],_0x2cf9cd[_0xe75c('0x24')])&&_[_0xe75c('0x39')](_0x2cf9cd[_0xe75c('0x23')])&&!_[_0xe75c('0x39')](_0x2cf9cd['startProgressive'])){_0x2cf9cd[_0xe75c('0x23')]=moment()[_0xe75c('0x40')](_0xe75c('0xb4'));loggerPredictive[_0xe75c('0x42')](_0x2cf9cd[_0xe75c('0x57')],'started\x20in\x20predictive\x20at',_0x2cf9cd[_0xe75c('0x23')]);hopperUtils['avgHandleTime'](_0x2cf9cd[_0xe75c('0x1c1')])[_0xe75c('0x38')](this['getDataPredictive'](_0x2cf9cd))['then'](mergeDataErlangB(_0x2cf9cd))['then'](this['startMethodPredictive'](_0x2cf9cd))['catch'](loggerCatchPredictive(_0xe75c('0x1c2'),_0x2cf9cd));}else if(!ifInterval(_0x2cf9cd[_0xe75c('0x1c1')],_0x2cf9cd[_0xe75c('0x23')])){_0x2cf9cd['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x2cf9cd[_0xe75c('0x23')]=moment()[_0xe75c('0x40')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xe75c('0x42')](_0x2cf9cd[_0xe75c('0x57')],_0xe75c('0x1c3'),_0x2cf9cd[_0xe75c('0x23')]);clearInterval(_0x2cf9cd[_0xe75c('0x58')]);_0x2cf9cd[_0xe75c('0x58')]=undefined;hopperUtils[_0xe75c('0x1c4')](_0x2cf9cd[_0xe75c('0x1c1')])[_0xe75c('0x38')](this[_0xe75c('0x1c5')](_0x2cf9cd))[_0xe75c('0x38')](mergeDataErlangB(_0x2cf9cd))[_0xe75c('0x38')](this[_0xe75c('0x1c6')](_0x2cf9cd))['catch'](loggerCatchPredictive(_0xe75c('0x1c7'),_0x2cf9cd));}else if(_0x2cf9cd[_0xe75c('0x1b6')]&&_0x2f6ada<_0x2cf9cd['predictiveIntervalAvailable']-_0x39f04b){clearPredictiveAttributes(_0x2cf9cd);loggerPredictive[_0xe75c('0x42')](_0x2cf9cd[_0xe75c('0x57')],_0xe75c('0x1c8'),_0x2f6ada,_0xe75c('0x1c9'),_0x2cf9cd[_0xe75c('0x1b6')],'-',_0x39f04b,'=',_0x2cf9cd[_0xe75c('0x1b6')]-_0x39f04b,')');}else if(_0x2cf9cd[_0xe75c('0x1b6')]&&_0x2f6ada>_0x2cf9cd[_0xe75c('0x1b6')]+_0x4ecfbf){clearPredictiveAttributes(_0x2cf9cd);loggerPredictive[_0xe75c('0x42')](_0x2cf9cd['name'],_0xe75c('0x1c8'),_0x2f6ada,')\x20are\x20more\x20than\x20threshold\x20(',_0x2cf9cd[_0xe75c('0x1b6')],'+',_0x4ecfbf,'=',_0x2cf9cd[_0xe75c('0x1b6')]+_0x4ecfbf,')');}};Dialer[_0xe75c('0x14')][_0xe75c('0x1c5')]=function(_0x59ff70){var _0x18f00d=this;return function(_0x2c43b3){return new Promise(function(_0x4d858b,_0x2c1326){_['merge'](_0x59ff70,_0x2c43b3[0x0]);if(checkGetDataPredictive(_0x2c43b3[0x0])){var _0x548ba3=_0x59ff70['predictiveIntervalAvailable']=_0x59ff70[_0xe75c('0x13b')]+_0x59ff70[_0xe75c('0x139')];var _0x5036c7=_0x59ff70[_0xe75c('0x1c1')]*0x3c;var _0x20506a=_0x2c43b3[0x0]['predictiveIntervalAvgTalktime']+_0x2c43b3[0x0][_0xe75c('0x49')];var _0x2f3f3b=(_0x2c43b3[0x0][_0xe75c('0x46')]+_0x2c43b3[0x0][_0xe75c('0xbe')]+_0x2c43b3[0x0][_0xe75c('0x47')])/_0x2c43b3[0x0]['predictiveIntervalTotalCalls'];_0x59ff70['predictiveIntervalHitRate']=_0x2f3f3b>0x0?_0x2f3f3b:0x1;switch(_0x59ff70['dialPredictiveOptimization']){case _0xe75c('0x1be'):var _0x4e27a7=_0x59ff70['dialPredictiveOptimizationPercentage']/0x64;return _0x18f00d[_0xe75c('0x1ca')](_0x548ba3,_0x5036c7,_0x20506a,_0x2f3f3b,_0x4e27a7)[_0xe75c('0x38')](function(_0x1b3071){return _0x4d858b(_0x1b3071);});case _0xe75c('0x1cb'):var _0x58fd2b=_0x59ff70['dialPredictiveOptimizationPercentage']/0x64;return _0x18f00d[_0xe75c('0x1cc')](_0x548ba3,_0x5036c7,_0x20506a,_0x2f3f3b,_0x58fd2b)[_0xe75c('0x38')](function(_0x5c6b4d){return _0x4d858b(_0x5c6b4d);});default:return _0x2c1326(msgResponse(_0xe75c('0x1cd'),'Failure',_0xe75c('0x1ce')));}}else{return _0x2c1326(msgResponse(_0xe75c('0x1cd'),_0xe75c('0x83'),_0xe75c('0x1cf')));}});};};Dialer[_0xe75c('0x14')][_0xe75c('0x1d0')]=function(_0x18cbca){var _0x5b3bb2=this;return function(_0x135b78){return new Promise(function(_0x121717,_0x429d24){_['merge'](_0x18cbca,_0x135b78[0x0]);if(checkGetDataPredictive(_0x135b78[0x0])){loggerPredictive[_0xe75c('0x42')](JSON['stringify'](_0x135b78[0x0]));if(_0x18cbca[_0xe75c('0x1bd')]===_0xe75c('0x1be')){return _0x5b3bb2['getVoiceQueueRtPauses'](_0x18cbca['id'])[_0xe75c('0x38')](function(_0xaf1ae7){var _0x36ced4=_0x18cbca['loggedIn']-_0xaf1ae7[0x0][_0xe75c('0x1d1')];var _0x3d4f0c=_0x18cbca['dialPredictiveInterval']*0x3c;var _0x55bb49=_0x135b78[0x0][_0xe75c('0x4a')]+_0x135b78[0x0][_0xe75c('0x49')];var _0xbf7542=(_0x135b78[0x0][_0xe75c('0x46')]+_0x135b78[0x0][_0xe75c('0xbe')]+_0x135b78[0x0][_0xe75c('0x47')])/_0x135b78[0x0][_0xe75c('0x45')];var _0x19b008=_0x18cbca[_0xe75c('0x1b4')]/0x64;_0x18cbca[_0xe75c('0x1d2')]=_0xaf1ae7[0x0][_0xe75c('0x1d1')]||0x0;_0x18cbca[_0xe75c('0x1d3')]=_0xbf7542>0x0?_0xbf7542:0x1;return _0x5b3bb2['abandonmentRate'](_0x36ced4,_0x3d4f0c,_0x55bb49,_0xbf7542,_0x19b008);})[_0xe75c('0x38')](function(_0x5d7af2){return _0x121717(_0x5d7af2);})[_0xe75c('0x8e')](function(_0x55ad67){return _0x429d24(msgResponse(_0xe75c('0x1d4'),_0xe75c('0x83'),JSON['stringify'](_0x55ad67)));});}if(_0x18cbca[_0xe75c('0x1bd')]==='agentBusyFactor'){return _0x5b3bb2[_0xe75c('0x150')](_0x18cbca['id'])[_0xe75c('0x38')](function(_0x575a22){var _0x1b6eec=_0x18cbca['loggedIn']-_0x575a22[0x0][_0xe75c('0x1d1')];var _0x8fdbf8=_0x18cbca['dialPredictiveInterval']*0x3c;var _0x1d1f7e=_0x135b78[0x0][_0xe75c('0x4a')]+_0x135b78[0x0]['predictiveIntervalAvgHoldtime'];var _0x433603=(_0x135b78[0x0][_0xe75c('0x46')]+_0x135b78[0x0][_0xe75c('0xbe')]+_0x135b78[0x0][_0xe75c('0x47')])/_0x135b78[0x0]['predictiveIntervalTotalCalls'];var _0x4d4f8e=_0x18cbca[_0xe75c('0x1b4')]/0x64;_0x18cbca[_0xe75c('0x1d2')]=_0x575a22[0x0][_0xe75c('0x1d1')]||0x0;_0x18cbca[_0xe75c('0x1d3')]=_0x433603>0x0?_0x433603:0x1;return _0x5b3bb2[_0xe75c('0x1cc')](_0x1b6eec,_0x8fdbf8,_0x1d1f7e,_0x433603,_0x4d4f8e);})[_0xe75c('0x38')](function(_0x46438d){return _0x121717(_0x46438d);})['catch'](function(_0x45e9ed){return _0x429d24(msgResponse('[CatchErlangB]',_0xe75c('0x83'),JSON['stringify'](_0x45e9ed)));});}}else{return _0x429d24(msgResponse('[getDataPredictive]','Failure','check\x20failure'));}});};};Dialer['prototype'][_0xe75c('0x1c6')]=function(_0x28c505){var _0x139963=this;return function(){var _0x371fc8=0x0;var _0x572b18=Math[_0xe75c('0x1b8')](_0x28c505[_0xe75c('0x1d5')]*0x3e8);if(_0x572b18>0x0){_0x572b18=_0x572b18<0x64?0x64:_0x572b18;loggerPredictive['info'](_0x28c505[_0xe75c('0x57')],_0xe75c('0x1d6'),_0x572b18,'milliseconds');_0x28c505[_0xe75c('0x58')]=setInterval(function(){_0x139963[_0xe75c('0x58')](_0x28c505);loggerPredictiveCalls[_0xe75c('0x42')](_0xe75c('0x1d7'),_0x371fc8+=0x1);},_0x572b18);}else{loggerPredictive[_0xe75c('0x42')](_0x28c505[_0xe75c('0x57')],_0xe75c('0x1d8'));}};};Dialer[_0xe75c('0x14')][_0xe75c('0x1d9')]=function(_0x470701,_0x518d9e){var _0x58ee3b=this;return function(_0x2cfe7a){if(_[_0xe75c('0x41')](_0x2cfe7a)){if(_[_0xe75c('0xe6')](_0x518d9e[_0xe75c('0x1da')])||!_0x518d9e[_0xe75c('0x1db')]){if(_0x470701[_0xe75c('0x9f')]===_0xe75c('0xa4')){_0x470701['queueStatusComplete']=_[_0xe75c('0x39')](_0x470701[_0xe75c('0x65')])?!![]:_0x470701[_0xe75c('0x65')];var _0x314d7d=uuid['v4']();_0x58ee3b[_0xe75c('0x20')][_0x314d7d]=new Action(_0x470701,_0x518d9e,_0x314d7d);loggerBooked[_0xe75c('0x42')]('[booked][checkContactBlack]',_0x314d7d,_0xe75c('0x1dc'),JSON['stringify'](_0x470701['queueStatusComplete']),_0xe75c('0x1dd'),_0x470701[_0xe75c('0x57')]);if(_0x470701[_0xe75c('0x65')]){_0x470701['queueStatusComplete']=![];_0x58ee3b['queueBooked'][_0x58ee3b[_0xe75c('0x20')][_0x314d7d]['queue']]=[];ami['Action']({'actionid':_0x314d7d,'action':'queuestatus','queue':_0x470701['name']})[_0xe75c('0x8e')](function(){utils[_0xe75c('0xed')](_0x470701,_0xe75c('0x1de'));hopperUtils[_0xe75c('0xcc')]({'active':![],'ContactId':_0x58ee3b[_0xe75c('0x20')][_0x314d7d][_0xe75c('0xce')],'ListId':_0x58ee3b[_0xe75c('0x20')][_0x314d7d][_0xe75c('0xcf')],'VoiceQueueId':_0x58ee3b[_0xe75c('0x20')][_0x314d7d][_0xe75c('0xd0')]||undefined,'CampaignId':_0x58ee3b[_0xe75c('0x20')][_0x314d7d][_0xe75c('0xd1')]||undefined})['catch'](loggerCatch(_0xe75c('0x1df')));delete _0x58ee3b[_0xe75c('0x20')][_0x314d7d];});}else{loggerBooked[_0xe75c('0x42')](_0xe75c('0x1e0'),JSON['stringify'](_0x470701[_0xe75c('0x65')]),_0xe75c('0x1dd'),_0x470701[_0xe75c('0x57')]);utils[_0xe75c('0xed')](_0x470701,_0xe75c('0x1de'));hopperUtils[_0xe75c('0xcc')]({'active':![],'ContactId':_0x58ee3b[_0xe75c('0x20')][_0x314d7d][_0xe75c('0xce')],'ListId':_0x58ee3b['actions'][_0x314d7d][_0xe75c('0xcf')],'VoiceQueueId':_0x58ee3b['actions'][_0x314d7d][_0xe75c('0xd0')]||undefined,'CampaignId':_0x58ee3b[_0xe75c('0x20')][_0x314d7d][_0xe75c('0xd1')]||undefined})[_0xe75c('0x8e')](loggerCatch(_0xe75c('0x1df')));delete _0x58ee3b[_0xe75c('0x20')][_0x314d7d];}}else{return _0x58ee3b[_0xe75c('0x1e1')](_0x470701,_0x518d9e);}}else{if(utils['getSeconds'](undefined,_0x518d9e[_0xe75c('0x1e2')])<_0x470701[_0xe75c('0x1e3')]*0x3c){if(_0x518d9e[_0xe75c('0x154')]&&!_0x518d9e[_0xe75c('0x154')][_0xe75c('0x1e4')]){_0x58ee3b[_0xe75c('0x19')][_0xe75c('0xf6')](_0x518d9e['id'])[_0xe75c('0x17')](function(){utils[_0xe75c('0xed')](_0x470701,_0xe75c('0x1de'));});}else{hopperUtils[_0xe75c('0x1e5')]({'active':![]},_0x518d9e['id'],0x1)[_0xe75c('0x17')](function(){utils[_0xe75c('0xed')](_0x470701,_0xe75c('0x1de'));});}}else{_0x470701[_0xe75c('0x1e6')]+=0x1;utils[_0xe75c('0xed')](_0x470701,_0xe75c('0x1de'));if(_0x470701[_0xe75c('0x1e7')]){hopperUtils[_0xe75c('0xcc')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x518d9e[_0xe75c('0xce')],'ListId':_0x518d9e[_0xe75c('0xcf')],'VoiceQueueId':_0x518d9e[_0xe75c('0xd0')]||undefined,'CampaignId':_0x518d9e[_0xe75c('0xd1')]||undefined})[_0xe75c('0x8e')](loggerCatch(_0xe75c('0x1e8')));hopperUtils[_0xe75c('0xb8')](createObjHistory(_0x470701,_0x518d9e,utils[_0xe75c('0x5f')][_0xe75c('0x1e9')],0x17,_0xe75c('0x1ea')))[_0xe75c('0x8e')](loggerCatch(_0xe75c('0x1eb')));}else{_0x58ee3b['saveInDb'](createObjHistory(_0x470701,_0x518d9e,utils[_0xe75c('0x5f')][_0xe75c('0x1ec')],0x16,_0xe75c('0x1ed')),_0xe75c('0x1ee'),_0xe75c('0x1ef'));}}}}else{_0x470701[_0xe75c('0x1f0')]+=0x1;_0x58ee3b[_0xe75c('0x124')](createObjHistory(_0x470701,_0x518d9e,utils[_0xe75c('0x5f')]['BLACKLIST'],0xd,_0xe75c('0x1f1')),_0xe75c('0x1f2'),_0xe75c('0x1f3'));throw'inBlackList';}};};Dialer[_0xe75c('0x14')][_0xe75c('0x155')]=function(_0x4fb4f5){var _0x6a5536=this;var _0x41bc47=_0x4fb4f5[_0xe75c('0x1f4')]-_0x4fb4f5[_0xe75c('0x1f5')];emitCampaignSummary(_0x4fb4f5);if(_0x41bc47>0x0&&_0x4fb4f5['temp']==0x0){if(_0x41bc47>this[_0xe75c('0x1e')]){_0x41bc47=this[_0xe75c('0x1e')];}_0x4fb4f5['temp']=0x1;hopperUtils[_0xe75c('0x1f6')](_0x4fb4f5,_0x41bc47)[_0xe75c('0x38')](function(_0x5aa6df){_0x4fb4f5[_0xe75c('0x1f7')]=0x0;if(_0x5aa6df){if(!utils['checkContactEmpty'](_0x5aa6df)){_0x4fb4f5[_0xe75c('0x5e')]=utils[_0xe75c('0x5f')][_0xe75c('0x60')];logger[_0xe75c('0x42')](_0xe75c('0x1f8')+_0x4fb4f5[_0xe75c('0x57')]);}else{_0x4fb4f5['originated']+=_0x5aa6df[_0xe75c('0x88')];_0x4fb4f5[_0xe75c('0x5e')]=utils[_0xe75c('0x5f')][_0xe75c('0x1f9')];for(var _0xa48f7e=0x0;_0xa48f7e<_0x5aa6df[_0xe75c('0x88')];_0xa48f7e+=0x1){_0x4fb4f5[_0xe75c('0x1fa')]+=0x1;if(_[_0xe75c('0xe6')](_0x5aa6df[_0xa48f7e])||_['isNil'](_0x5aa6df[_0xa48f7e][_0xe75c('0x16e')])||_[_0xe75c('0xe6')](_0x5aa6df[_0xa48f7e][_0xe75c('0x158')])){_0x6a5536[_0xe75c('0x1fb')](_0xe75c('0x1fc'),_0x4fb4f5,_0x5aa6df[_0xa48f7e]);}else{hopperUtils['checkIsBlackListIvr'](_['pick'](_0x5aa6df[_0xa48f7e],[_0xe75c('0xd1'),'phone']))[_0xe75c('0x38')](_0x6a5536['checkContactBlack'](_0x4fb4f5,_0x5aa6df[_0xa48f7e]))['catch'](function(_0xeeccb5){logger['error'](_0xe75c('0x1fd'),_0xeeccb5);utils[_0xe75c('0xed')](_0x4fb4f5,_0xe75c('0x1fe'));});}}}}})['catch'](function(_0x33f39f){_0x4fb4f5[_0xe75c('0x1f7')]=0x0;logger[_0xe75c('0x59')](_0xe75c('0x1ff'),_0x33f39f);});}};Dialer['prototype'][_0xe75c('0xa2')]=function(_0x15574e,_0x341a19){var _0x54efec=this;var _0x2a62ae=[];if(_0x341a19<0x1||_0x15574e[_0xe75c('0x9f')]===_0xe75c('0xa4')){_0x341a19=0x1;}var _0x71d1c7=Math[_0xe75c('0x1b8')](_0x15574e['available']*_0x341a19)-_0x15574e[_0xe75c('0x1f5')];if(_0x15574e[_0xe75c('0x200')]>0x0){var _0xeb1eaa=_0x15574e['dialLimitQueue']-_0x15574e['originated']-_0x15574e[_0xe75c('0x13b')]-_0x15574e['pTalking'];if(_0x71d1c7>_0xeb1eaa){_0x71d1c7=_0xeb1eaa;}}if(_0x71d1c7>0x0&&_0x15574e[_0xe75c('0x1f7')]==0x0){if(_0x15574e[_0xe75c('0x9f')]===_0xe75c('0xa4')){_0x71d1c7=0x1;}if(_0x71d1c7>this[_0xe75c('0x1e')]){_0x71d1c7=this[_0xe75c('0x1e')];}for(var _0x3e39bb in this[_0xe75c('0x1c')]){if(typeof this[_0xe75c('0x1c')][_0x3e39bb]!=='undefined'){if(this[_0xe75c('0x1c')][_0x3e39bb]['state']===_0xe75c('0x201')&&this[_0xe75c('0x1c')][_0x3e39bb]['status']===_0xe75c('0x7b')){_0x2a62ae[_0xe75c('0x89')](this[_0xe75c('0x1c')][_0x3e39bb]['id']);}}}_0x15574e[_0xe75c('0x1f7')]=0x1;hopperUtils['getContactDialer'](_0x15574e,_0x2a62ae,_0x71d1c7)[_0xe75c('0x38')](function(_0xd9380){_0x15574e[_0xe75c('0x1f7')]=0x0;if(_0xd9380){if(!utils['checkContactEmpty'](_0xd9380)){hopperUtils[_0xe75c('0x202')](_0x15574e)[_0xe75c('0x38')](sendMessageReschedule(_0x15574e))[_0xe75c('0x8e')](loggerCatch(_0xe75c('0x203')));}else{_0x15574e[_0xe75c('0x1f5')]+=_0xd9380[_0xe75c('0x88')];_0x15574e[_0xe75c('0x5e')]=_0x15574e[_0xe75c('0x9f')]===_0xe75c('0xa4')?utils[_0xe75c('0x5f')]['ACTIVE']:utils[_0xe75c('0x5f')][_0xe75c('0x1f9')];for(var _0x493a42=0x0;_0x493a42<_0xd9380[_0xe75c('0x88')];_0x493a42+=0x1){if(_[_0xe75c('0xe6')](_0xd9380[_0x493a42])||_[_0xe75c('0xe6')](_0xd9380[_0x493a42]['Contact'])||_['isNil'](_0xd9380[_0x493a42][_0xe75c('0x158')])){_0x54efec['emptyContact'](_0xe75c('0x1fc'),_0x15574e,_0xd9380[_0x493a42]);}else{hopperUtils['checkIsBlackList'](_[_0xe75c('0xeb')](_0xd9380[_0x493a42],[_0xe75c('0xd0'),_0xe75c('0x158')]))['then'](_0x54efec['checkContactBlack'](_0x15574e,_0xd9380[_0x493a42]))[_0xe75c('0x8e')](function(_0x3f14e9){logger[_0xe75c('0x59')]('[actionOriginate]',_0x3f14e9);utils[_0xe75c('0xed')](_0x15574e,_0xe75c('0x204'));});}}}}})[_0xe75c('0x8e')](function(_0x44aed8){_0x15574e[_0xe75c('0x1f7')]=0x0;logger[_0xe75c('0x59')](_0xe75c('0x1ff'),_0x44aed8);});}};Dialer[_0xe75c('0x14')][_0xe75c('0x58')]=function(_0xfd8074){if(_0xfd8074[_0xe75c('0x200')]>0x0){var _0x2e6392=_0xfd8074[_0xe75c('0x200')]-_0xfd8074[_0xe75c('0x1f5')]-_0xfd8074[_0xe75c('0x13b')];if(_0x2e6392>0x0&&_0xfd8074['temp']==0x0){this[_0xe75c('0x205')](_0xfd8074);}else{loggerPredictiveCalls[_0xe75c('0x42')](_0xe75c('0x206'));}}else{this[_0xe75c('0x205')](_0xfd8074);}};Dialer[_0xe75c('0x14')][_0xe75c('0x205')]=function(_0x558c9c){var _0x4d7e70=this;var _0x28f42e=[];_0x558c9c[_0xe75c('0x1f5')]+=0x1;for(var _0x265eac in this['agents']){if(typeof this[_0xe75c('0x1c')][_0x265eac]!=='undefined'){if(this[_0xe75c('0x1c')][_0x265eac]['state']===_0xe75c('0x201')&&this[_0xe75c('0x1c')][_0x265eac][_0xe75c('0x7a')]===_0xe75c('0x7b')){_0x28f42e['push'](this['agents'][_0x265eac]['id']);}}}_0x558c9c['temp']=0x1;return this['getContactDialer'](_0x558c9c['id'],_0x28f42e,0x1,_0x558c9c[_0xe75c('0x207')],_0x558c9c)[_0xe75c('0x38')](function(_0x42f25a){_0x558c9c[_0xe75c('0x1f7')]=0x1;if(_0x42f25a){if(!utils[_0xe75c('0x208')](_0x42f25a)){utils[_0xe75c('0x209')](_0x558c9c,0x1,0x0);return hopperUtils[_0xe75c('0x202')](_0x558c9c)[_0xe75c('0x38')](sendMessageReschedule(_0x558c9c))[_0xe75c('0x8e')](loggerCatch(_0xe75c('0x203')));}else{_0x558c9c[_0xe75c('0x5e')]=utils[_0xe75c('0x5f')]['RUNNING'];if(_['isNil'](_0x42f25a[0x0])||_[_0xe75c('0xe6')](_0x42f25a[0x0][_0xe75c('0x16e')])||_[_0xe75c('0xe6')](_0x42f25a[0x0]['phone'])){_0x4d7e70['emptyContact'](_0xe75c('0x1fc'),_0x558c9c,_0x42f25a[0x0]);}else{return hopperUtils[_0xe75c('0x20a')](_[_0xe75c('0xeb')](_0x42f25a[0x0],[_0xe75c('0xd0'),'phone']))['then'](_0x4d7e70[_0xe75c('0x1d9')](_0x558c9c,_0x42f25a[0x0]))[_0xe75c('0x8e')](function(_0x2a43b6){logger[_0xe75c('0x59')](_0xe75c('0x20b'),_0x2a43b6);utils[_0xe75c('0xed')](_0x558c9c,'[actionOriginatePredictive]');});}}}})[_0xe75c('0x8e')](function(_0x6ec4c3){_0x558c9c[_0xe75c('0x1f7')]=0x0;logger[_0xe75c('0x59')]('[getContactCampaign2]',_0x6ec4c3);});};Dialer[_0xe75c('0x14')][_0xe75c('0x1ca')]=function(_0x148a85,_0x124474,_0x319fad,_0x42483e,_0x3c0884,_0x222d69){loggerPredictive[_0xe75c('0x42')](_0xe75c('0x20c'));loggerPredictive['info']('M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x148a85);loggerPredictive['info'](_0xe75c('0x20d'),_0x124474);loggerPredictive['info']('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',_0x319fad);loggerPredictive[_0xe75c('0x42')](_0xe75c('0x20e'),_0x42483e);loggerPredictive[_0xe75c('0x42')](_0xe75c('0x20f'),_0x3c0884);loggerPredictive['info'](_0xe75c('0x54'));return new Promise(function(_0x453869,_0x474c08){if(_0x148a85<=0x0||isNaN(_0x148a85)){return _0x474c08(msgResponse('[abandonmentRate]',_0xe75c('0x76'),_0xe75c('0x210')+_0x148a85));}if(_0x319fad<=0x0||isNaN(_0x319fad)){return _0x474c08(msgResponse(_0xe75c('0x211'),_0xe75c('0x76'),'Ts\x20=\x20'+_0x319fad));}if(_0x42483e<=0x0||isNaN(_0x42483e)){return _0x474c08(msgResponse(_0xe75c('0x211'),_0xe75c('0x76'),_0xe75c('0x212')+_0x42483e));}if(_0x124474<=0x0||isNaN(_0x124474)){return _0x474c08(msgResponse('[abandonmentRate]','Error',_0xe75c('0x213')+_0x124474));}if(_0x3c0884<=0x0||isNaN(_0x3c0884)){return _0x474c08(msgResponse(_0xe75c('0x211'),_0xe75c('0x76'),_0xe75c('0x214')+_0x3c0884));}_0x222d69=_0x222d69||0x0;var _0x33d27f=0x1/_0x319fad;var _0x43fa28=0x0;var _0x5e126f=0x0;var _0x53837f=0x0;var _0x5cfe0c=0x0;for(var _0x25ddb5=0x0;_0x53837f<_0x3c0884;_0x25ddb5+=0x1){_0x5e126f=_0x25ddb5/_0x124474;_0x43fa28=(_0x42483e*_0x5e126f+_0x222d69)/_0x33d27f;_0x53837f=utils[_0xe75c('0x215')](_0x43fa28,_0x148a85);_0x5cfe0c=_0x43fa28/_0x148a85*(0x1-utils['erlangb'](_0x43fa28,_0x148a85));}return _0x453869({'erlangCalls':_0x25ddb5,'erlangCallToSecond':_0x124474/_0x25ddb5,'erlangAbandonmentRate':_0x53837f,'erlangBusyFactor':_0x5cfe0c});});};Dialer[_0xe75c('0x14')][_0xe75c('0x1cc')]=function(_0x6616c9,_0x25e7d8,_0x1dc707,_0x3e1a61,_0x5a7a0b,_0x2fbec8){loggerPredictive[_0xe75c('0x42')](_0xe75c('0x216'));loggerPredictive[_0xe75c('0x42')](_0xe75c('0x217'),_0x6616c9);loggerPredictive[_0xe75c('0x42')](_0xe75c('0x20d'),_0x25e7d8);loggerPredictive[_0xe75c('0x42')](_0xe75c('0x218'),_0x1dc707);loggerPredictive[_0xe75c('0x42')](_0xe75c('0x20e'),_0x3e1a61);loggerPredictive['info'](_0xe75c('0x219'),_0x5a7a0b);loggerPredictive[_0xe75c('0x42')](_0xe75c('0x54'));return new Promise(function(_0x4779fa,_0x1ac48a){if(_0x6616c9<=0x0||isNaN(_0x6616c9)){return _0x1ac48a(msgResponse(_0xe75c('0x21a'),'Error',_0xe75c('0x210')+_0x6616c9));}if(_0x1dc707<=0x0||isNaN(_0x1dc707)){return _0x1ac48a(msgResponse(_0xe75c('0x21a'),_0xe75c('0x76'),'Ts\x20=\x20'+_0x1dc707));}if(_0x3e1a61<=0x0||isNaN(_0x3e1a61)){return _0x1ac48a(msgResponse(_0xe75c('0x21a'),_0xe75c('0x76'),_0xe75c('0x212')+_0x3e1a61));}if(_0x25e7d8<=0x0||isNaN(_0x25e7d8)){return _0x1ac48a(msgResponse(_0xe75c('0x21a'),_0xe75c('0x76'),_0xe75c('0x213')+_0x25e7d8));}if(_0x5a7a0b<=0x0||isNaN(_0x5a7a0b)){return _0x1ac48a(msgResponse(_0xe75c('0x21a'),_0xe75c('0x76'),'Umin\x20=\x20'+_0x5a7a0b));}_0x2fbec8=_0x2fbec8||0x0;var _0x1b49ee=0x1/_0x1dc707;var _0x4c1cf1=0x0;var _0x43861e=0x0;var _0x3508ba=0x0;var _0x423a54=0x0;for(var _0x502167=0x0;_0x423a54<_0x5a7a0b;_0x502167+=0x1){_0x43861e=_0x502167/_0x25e7d8;_0x4c1cf1=(_0x3e1a61*_0x43861e+_0x2fbec8)/_0x1b49ee;_0x3508ba=utils[_0xe75c('0x215')](_0x4c1cf1,_0x6616c9);_0x423a54=_0x4c1cf1/_0x6616c9*(0x1-utils[_0xe75c('0x215')](_0x4c1cf1,_0x6616c9));}return _0x4779fa({'erlangCalls':_0x502167,'erlangCallToSecond':_0x25e7d8/_0x502167,'erlangAbandonmentRate':_0x3508ba,'erlangBusyFactor':_0x423a54});});};module['exports']=Dialer; \ No newline at end of file +var _0x5782=['Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','startProgressive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','stack','error','inspect','contactsRescheduled','CONTACTS_RESCHEDULED','contacts','message','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','state','statedesc','queueStatusComplete','[booked][unlockQueueStatus]','stringify','pick','Interval','CAMPAIGN_STATUS','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','isIVRCampaignActive','isIVRCampaign','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','originated','INACTIVE','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','DISACTIVED','is\x20deactivated','Error','isTrunkReachable','active','status','reachable','unmonitored','Trunk','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','checkIfTimeIntervals','ifTimeIvr','ifTime','Failure','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','length','push','Action','command','interval','timezones','content','indexOf','true','catch','all','some','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','undefined','resolve','checkIsTrunkReachable','dialTimezone','[syncCampaigns]','checkDialMethod','dialMethod','progressive','handlePower','power','dialPowerLevel','Queue','dialGlobalInterval','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','silly','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','[ifTime][Action]','ivr','decrementOriginate','[syncAgentConnect]','uniqueid','YYYY-MM-DD\x20HH:mm:ss','queue','outboundAnswerCallsDay','reason','dialQueueProject2','dialAgiAfterHangupAgent','createHistory','[syncAgentComplete]','type','[syncQueueCallerAbandon]','droptime','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','countdropretry','countglobal','dialDropRetryFrequency','callAdditionalPhoneAfterMin','verifyAdditionalPhones','additional','queueCallerAbandonCreateState','rescheduleContact','add','ListId','CampaignId','[rescheduleContact][Drop]','starttime','endtime','calleridname','calleridnum','swapAdditionalPhones','predictiveIntervalDroppedCallsCallersExit','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','countabandonedretry','dialAbandonedRetryFrequency','voiceQueue','dialAbandonedMaxRetry','minutes','VoiceQueueId','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','channel','syncQueueMember','actionid','strategy','rrmemory','roundrobin','isNil','locked','paused','stateinterface','merge','idHopper','[syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','run','[Catch][Preview][syncQueueStatusComplete]','[booked][RR][finaly]','contactAgent-idHopper:\x20','[booked][unlock]','ContactId','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[booked][unlock3]','syncOriginateResponse','getQueue','response','Success','[syncOriginateResponse]','[callProgressDetecting]\x20','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','[syncVarSet]','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','custom:amd','buildObj','amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','[syncAgentComplete][createHistory][0]','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','[rescheduleContact][Machine]','[syncHangupInAMDIvr]','countbusyretry','ivrAnswerCallsDay','cause-txt','Normal\x20Clearing','[syncAgentCompleteIvr][createHistory]','moveContactManagedDialer','[syncHangupIvr]','dialQueueProject','[syncHangup]','AnswerAGI','AGI','[syncHangupIvr][createHistory]','[syncHangup2]','outboundUnknownCallsDay','[syncHangup][createHistory]','syncQueueSummary','queuesSummary','running','isPreviewCampaign','getQueueCampaignStatusMessage','statusMessage','available','inUse','talking','pTalking','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','filter','dialPreviewRecallmeReminder','online','handlePreviewRecallNotifications','map','Agent','user:%s','clearZombieChannels','[uniqueid]','[actions]','enqueue','No\x20such\x20channel','[clearZombieChannels]','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','emptyContact','notFound','[emptyContact]','UserId','[emptyContact][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','checkPreviewRecallReminder','user:dialPreviewRecallReminder','launchHandleIvr','handleIvr','actionOriginate','object','originate','phone','contact\x20is\x20undefine','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','getCaller','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','setXMDContactVariables','Contact','dialOriginateCallerIdName','getCallerIdRandom','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','getCallerId','TrunkBackup','callerid','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','[originate][error]','originate\x20action\x20Error','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','callProgressDetecting','[callProgressDetecting]','outboundNoSuchCallsDay','NoSuchNumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','dialCongestionMaxRetry','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','round','predictiveIntervalMaxThreshold','predictiveIntervalAvailable','predictiveIntervalMinThreshold','floor','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','avgHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dialPredictiveOptimizationPercentage','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','getDataPredictiveOld','loggedIn','predictiveIntervalPauses','outboundQueuePauses','[CatchErlangB]','erlangCallToSecond','one\x20call\x20every:','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','recallme','queueStatusComplete:\x20','Queue:\x20','queuestatus','[checkContactBlack]','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','getSeconds','dialRecallMeTimeout','voicePause','unlockContact','outboundReCallsDay','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','temp','getContactDialerIvr','checkContactEmpty','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','checkIsBlackListIvr','[actionOriginateIvr]','[handleIvr]','dialLimitQueue','not_inuse','getContactDialer','countReScheduled','checkIsBlackList','[actionOriginate]','[handlePredictive][limitChannel]','tryOriginatePredictive','checkContactLowerLimitOriginate','[countReScheduled]\x20','checkContactBlack','[actionOriginatePredictive]','[getContactCampaign2]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','m\x20=\x20','[abandonmentRate]','Ts\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','p\x20=\x20','Umin\x20=\x20','util','lodash','uuid','moment','./utils/hopper','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','redis','defaults','localhost','socket.io-emitter','../rpc/voiceQueueRt','../rpc/setting','./models/history','./models/final','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','env','XCALLY_IP_AGI','prototype','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','actions','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','bind','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','custom:queuesummary','syncQueueSummaryComplete','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','then','previewRecallmeReminderInterval','isUndefined','emit','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','format','voice:queue:%s','name','voice_queue:save','isEmpty','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5782,0x1d5));var _0x2578=function(_0x4791c6,_0x293adf){_0x4791c6=_0x4791c6-0x0;var _0x52b5d3=_0x5782[_0x4791c6];return _0x52b5d3;};'use strict';var util=require(_0x2578('0x0'));var _=require(_0x2578('0x1'));var uuid=require(_0x2578('0x2'));var moment=require(_0x2578('0x3'));var rr=require('rr');var Redis=require('ioredis');var utils=require('./utils');var hopperUtils=require(_0x2578('0x4'));var ut=require(_0x2578('0x5'));var config=require(_0x2578('0x6'));var logger=require(_0x2578('0x7'))(_0x2578('0x8'));var loggerBooked=require(_0x2578('0x7'))(_0x2578('0x9'));var loggerPredictive=require(_0x2578('0x7'))(_0x2578('0xa'));var loggerPredictiveCalls=require(_0x2578('0x7'))('predictiveCalls');var loggerSyncQueueSummary=require('../../../config/logger')('syncQueueSummary');var ami=require('../ami');config[_0x2578('0xb')]=_[_0x2578('0xc')](config['redis'],{'host':_0x2578('0xd'),'port':0x18eb});var io=require(_0x2578('0xe'))(new Redis(config[_0x2578('0xb')]));var cmHopper=require('../rpc/cmHopper');var voiceQueueRt=require(_0x2578('0xf'));var RpcSetting=require(_0x2578('0x10'));var Interval=require('../rpc/interval');var Action=require('./models/action');var History=require(_0x2578('0x11'));var Final=require(_0x2578('0x12'));var AgentComplete=require(_0x2578('0x13'));var QueueCallerAbandon=require(_0x2578('0x14'));var Hangup=require(_0x2578('0x15'));var ipAgi=process[_0x2578('0x16')][_0x2578('0x17')]||'127.0.0.1';var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x2578('0x18')]['enqueue']=function(_0x901649){this[_0x2578('0x19')]=this['tail']?this[_0x2578('0x19')][_0x2578('0x1a')](_0x901649):_0x901649();};function Dialer(_0x27e78a,_0x23bc4b){this[_0x2578('0x1b')]=new Sequence();this[_0x2578('0x1c')]=_0x23bc4b;this['voiceQueues']=_0x27e78a[_0x2578('0x1d')];this[_0x2578('0x1e')]=_0x27e78a[_0x2578('0x1e')];this[_0x2578('0x1f')]=_0x27e78a[_0x2578('0x1f')];this[_0x2578('0x20')]=_0x27e78a['trunks'];this[_0x2578('0x21')]=config[_0x2578('0x21')]||0x2;this['channels']={};this[_0x2578('0x22')]={};this[_0x2578('0x23')]={};this[_0x2578('0x24')]={};this[_0x2578('0x25')]={};this[_0x2578('0x26')]={};this[_0x2578('0x27')]={};this[_0x2578('0x28')]={};this[_0x2578('0x29')]={};this[_0x2578('0x2a')]={};this['queuesSummary']={};ami['on']('agentconnect',this['syncAgentConnect'][_0x2578('0x2b')](this));ami['on'](_0x2578('0x2c'),this[_0x2578('0x2d')][_0x2578('0x2b')](this));ami['on']('originateresponse',this['syncOriginateResponse'][_0x2578('0x2b')](this));ami['on'](_0x2578('0x2e'),this[_0x2578('0x2f')][_0x2578('0x2b')](this));ami['on'](_0x2578('0x30'),this['syncQueueSummary'][_0x2578('0x2b')](this));ami['on']('custom:queuesummarycomplete',this[_0x2578('0x31')][_0x2578('0x2b')](this));ami['on'](_0x2578('0x32'),this[_0x2578('0x33')]['bind'](this));ami['on'](_0x2578('0x34'),this[_0x2578('0x35')][_0x2578('0x2b')](this));ami['on'](_0x2578('0x36'),this[_0x2578('0x37')]['bind'](this));ami['on']('queuemember',this['syncQueueMember'][_0x2578('0x2b')](this));ami['on']('queuestatuscomplete',this[_0x2578('0x38')][_0x2578('0x2b')](this));this[_0x2578('0x39')]();this[_0x2578('0x3a')]();RpcSetting['getSettings']()[_0x2578('0x3b')](function(_0x502b79){previewRecallmeReminderInterval=_0x502b79[_0x2578('0x3c')];});}function isNotNull(_0x4e7f7e){return _0x4e7f7e!==null&&!_[_0x2578('0x3d')](_0x4e7f7e);}function msgResponse(_0x104d64,_0x38c1ea,_0x4631b3){return{'action':_0x104d64,'response':_0x38c1ea,'message':_0x4631b3,'stack':_0x4631b3};}function emit(_0x40aa99,_0x422c9d,_0x48957e){io['to'](_0x40aa99)[_0x2578('0x3e')](_0x422c9d,_0x48957e);}function emitOutboundVoiceQueueSummary(_0x432cd2){if(_0x432cd2['type']===_0x2578('0x3f')){logger[_0x2578('0x40')](_0x2578('0x41'),util['inspect'](_0x432cd2,{'showHidden':![],'depth':null}));emit(util[_0x2578('0x42')](_0x2578('0x43'),_0x432cd2[_0x2578('0x44')]),_0x2578('0x45'),_0x432cd2);}}function checkGetDataPredictive(_0x2e5198){if(isNotNull(_0x2e5198)&&!_[_0x2578('0x46')](_0x2e5198)){loggerPredictive[_0x2578('0x47')](_0x2578('0x48'));loggerPredictive['info'](_0x2578('0x49'),_0x2e5198[_0x2578('0x4a')]);loggerPredictive[_0x2578('0x47')](_0x2578('0x4b'),_0x2e5198[_0x2578('0x4c')]);loggerPredictive['info'](_0x2578('0x4d'),_0x2e5198[_0x2578('0x4e')]);loggerPredictive[_0x2578('0x47')](_0x2578('0x4f'),_0x2e5198['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive['info'](_0x2578('0x50'),_0x2e5198[_0x2578('0x51')]);loggerPredictive[_0x2578('0x47')](_0x2578('0x52'),_0x2e5198[_0x2578('0x53')]);loggerPredictive['info'](_0x2578('0x54'));if(_0x2e5198['predictiveIntervalTotalCalls']>0x0){if(!_[_0x2578('0x3d')](_0x2e5198[_0x2578('0x53')])&&_0x2e5198[_0x2578('0x53')]>0x0){return!![];}loggerPredictive[_0x2578('0x47')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_['isUndefined'](_0x2e5198['predictiveIntervalAvgHoldtime'])&&_0x2e5198['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0x2578('0x47')](_0x2578('0x55'));}else{loggerPredictive['info'](_0x2578('0x56'));}}else{loggerPredictive[_0x2578('0x47')](_0x2578('0x57'));}return![];}function mergeDataErlangB(_0x2e0994){return function(_0x3e2f9f){loggerPredictive[_0x2578('0x47')]('---------\x20ErlangB\x20---------');loggerPredictive[_0x2578('0x47')](_0x2578('0x58'),_0x3e2f9f[_0x2578('0x59')]);loggerPredictive['info'](_0x2578('0x5a'),_0x3e2f9f['erlangCallToSecond']);loggerPredictive[_0x2578('0x47')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3e2f9f[_0x2578('0x5b')]);loggerPredictive[_0x2578('0x47')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3e2f9f['erlangBusyFactor']);loggerPredictive[_0x2578('0x47')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3e2f9f[_0x2578('0x5b')]);loggerPredictive['info']('---------------------------');_['merge'](_0x2e0994,_0x3e2f9f);};}function ifInterval(_0x5902ac,_0xb0793b){if(_['isUndefined'](_0xb0793b)){return![];}return utils['getSeconds'](undefined,_0xb0793b)<_0x5902ac*0x3c;}function clearPredictiveAttributes(_0x1cd7fb){if(_0x1cd7fb[_0x2578('0x27')]){_0x1cd7fb[_0x2578('0x27')]=undefined;loggerPredictive[_0x2578('0x40')](_0x1cd7fb['name'],_0x2578('0x5c'));}if(_0x1cd7fb[_0x2578('0x26')]){_0x1cd7fb[_0x2578('0x26')]=undefined;loggerPredictive[_0x2578('0x40')](_0x1cd7fb[_0x2578('0x44')],'startPredictive\x20value\x20cleared');}if(_0x1cd7fb[_0x2578('0x5d')]){clearInterval(_0x1cd7fb[_0x2578('0x5d')]);_0x1cd7fb[_0x2578('0x5d')]=undefined;loggerPredictive[_0x2578('0x40')](_0x1cd7fb[_0x2578('0x44')],_0x2578('0x5e'));}}function loggerCatchPredictive(_0x4ce5c6,_0x33df6a){return function(_0x17b2ba){loggerPredictive['error'](_0x33df6a['name'],_0x4ce5c6);loggerPredictive['error'](_0x17b2ba[_0x2578('0x5f')]);clearPredictiveAttributes(_0x33df6a);};}function loggerCatch(_0x117682){return function(_0x555ad2){logger[_0x2578('0x60')](_0x117682,util[_0x2578('0x61')](_0x555ad2,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x3bd98e){return function(_0x3de3e7){if(isNotNull(_0x3de3e7)&&isNotNull(_0x3de3e7[0x0])){if(_0x3de3e7[0x0][_0x2578('0x62')]>0x0){_0x3bd98e['message']=utils['CAMPAIGN_STATUS'][_0x2578('0x63')];logger[_0x2578('0x47')]('[getContactDialer2][ReScheduled]'+_0x3bd98e['name'],_0x3de3e7[0x0][_0x2578('0x62')],_0x2578('0x64'));}else{_0x3bd98e[_0x2578('0x65')]=utils['CAMPAIGN_STATUS'][_0x2578('0x66')];logger[_0x2578('0x47')](_0x2578('0x67')+_0x3bd98e[_0x2578('0x44')]);}}};}function createObjHistory(_0x2e3f7b,_0x4d4da8,_0x1075a6,_0x371219,_0xda73aa){_0x2e3f7b[_0x2578('0x65')]=_0x1075a6;var _0x46e63b=new Action(_0x2e3f7b,_0x4d4da8);var _0x218488=new History(_0x46e63b);_0x218488[_0x2578('0x68')]=_0x371219;_0x218488[_0x2578('0x69')]=_0xda73aa;_0x218488['endtime']=_0x46e63b['starttime'];return _0x218488;}function unlockQueueStatus(_0x14f4d1,_0x42e490){setTimeout(function(){if(_['isUndefined'](_0x14f4d1[_0x2578('0x6a')])){loggerBooked['error']('[unlockQueueStatus][undefined]',_0x42e490);}_0x14f4d1[_0x2578('0x6a')]=!![];loggerBooked[_0x2578('0x47')](_0x2578('0x6b'),_0x42e490,JSON[_0x2578('0x6c')](_[_0x2578('0x6d')](_0x14f4d1,[_0x2578('0x44'),_0x2578('0x6a')])));},0x1f3);}function checkInterval(_0x5de32b){return function(){if(!isNotNull(_0x5de32b[_0x2578('0x6e')])){_0x5de32b[_0x2578('0x65')]=utils[_0x2578('0x6f')][_0x2578('0x70')];throw _0x5de32b[_0x2578('0x44')]+_0x2578('0x71');}if(!isNotNull(_0x5de32b[_0x2578('0x6e')]['Intervals'])){_0x5de32b[_0x2578('0x65')]=utils['CAMPAIGN_STATUS'][_0x2578('0x70')];throw _0x5de32b[_0x2578('0x44')]+_0x2578('0x71');}if(!isNotNull(_['isEmpty'](_0x5de32b['Interval'][_0x2578('0x72')]))){_0x5de32b[_0x2578('0x65')]=utils[_0x2578('0x6f')][_0x2578('0x70')];throw _0x5de32b[_0x2578('0x44')]+_0x2578('0x71');}};}function checkIsIVRCampaignActive(_0x138f92){return function(){if(!utils[_0x2578('0x73')](_0x138f92)){_0x138f92[_0x2578('0x65')]=utils[_0x2578('0x6f')]['INACTIVE'];throw _0x138f92[_0x2578('0x44')]+'\x20NOT\x20Active';}};}function emitCampaignSummary(_0x3aec5d){if(utils[_0x2578('0x74')](_0x3aec5d)){emit(util[_0x2578('0x42')](_0x2578('0x75'),_0x3aec5d['name']),_0x2578('0x76'),_0x3aec5d);}}function loggerCatchQueueSummary(_0x43ed20,_0x249d52){return function(_0x1b36b3){clearPredictiveAttributes(_0x249d52);emitCampaignSummary(_0x249d52);loggerSyncQueueSummary[_0x2578('0x40')](_0x43ed20,util['inspect'](_0x1b36b3,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x15727c){if(_0x15727c[_0x2578('0x77')]){if(_0x15727c[_0x2578('0x78')]===0x0){_0x15727c['sendMessageOneNotActive']=![];_0x15727c[_0x2578('0x65')]=utils['CAMPAIGN_STATUS'][_0x2578('0x79')];loggerSyncQueueSummary[_0x2578('0x40')](_0x2578('0x7a'),_0x15727c[_0x2578('0x44')],'is\x20not\x20active');}else{_0x15727c[_0x2578('0x65')]=utils[_0x2578('0x6f')][_0x2578('0x7b')];loggerSyncQueueSummary[_0x2578('0x40')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x15727c[_0x2578('0x44')],_0x2578('0x7c'));}emitCampaignSummary(_0x15727c);}}function myreject(_0x385e2e){return function(_0x571992){return _0x385e2e(msgResponse('[ifTime][Action]',_0x2578('0x7d'),JSON[_0x2578('0x6c')](_0x571992)));};}Dialer[_0x2578('0x18')][_0x2578('0x7e')]=function(_0x2e97a7){return!_['isUndefined'](_0x2e97a7)&&_0x2e97a7&&!_[_0x2578('0x3d')](_0x2e97a7['name'])&&!_[_0x2578('0x3d')](_0x2e97a7[_0x2578('0x7f')])&&_0x2e97a7[_0x2578('0x7f')]&&(this[_0x2578('0x20')][util[_0x2578('0x42')]('SIP/%s',_0x2e97a7[_0x2578('0x44')])][_0x2578('0x80')]===_0x2578('0x81')||this['trunks'][util['format']('SIP/%s',_0x2e97a7[_0x2578('0x44')])][_0x2578('0x80')]===_0x2578('0x82'));};Dialer['prototype']['checkIsTrunkReachable']=function(_0x4692cf){var _0x5e9211=this;return function(){if(!_0x5e9211[_0x2578('0x7e')](_0x4692cf[_0x2578('0x83')])){if(!_0x5e9211['isTrunkReachable'](_0x4692cf['TrunkBackup'])){_0x4692cf['message']=utils[_0x2578('0x6f')][_0x2578('0x84')];throw _0x4692cf[_0x2578('0x44')]+_0x2578('0x85');}}};};Dialer[_0x2578('0x18')][_0x2578('0x86')]=function(_0x411619,_0x5b03eb,_0x2ae6ae,_0x24cbab){var _0x4793a0=this;return function(){var _0x52ecfd=!![];return _0x4793a0['ifTimeIvr'](_0x411619,_0x5b03eb,_0x2ae6ae,_0x24cbab,_0x52ecfd);};};Dialer['prototype'][_0x2578('0x87')]=function(_0x18351a,_0xb281db,_0x59f790,_0x5150a9){var _0x32fd02=this;return function(){var _0x5f25c0=![];return _0x32fd02[_0x2578('0x88')](_0x18351a[_0x2578('0x72')],_0xb281db,_0x59f790,_0x5150a9,_0x5f25c0);};};Dialer['prototype'][_0x2578('0x88')]=function(_0x31a11d,_0x3663dc,_0x344239,_0x590e0b,_0x4642e6){var _0x3a9e91=[];return new Promise(function(_0x5be480,_0x1f688b){if(!isNotNull(_0x31a11d)){_0x590e0b[_0x2578('0x65')]=utils[_0x2578('0x6f')][_0x2578('0x70')];return _0x1f688b(msgResponse(_0x2578('0x89'),'Failure',_0x344239+'\x20Intervals\x20is\x20null\x20'));}if(_[_0x2578('0x46')](_0x31a11d)){_0x590e0b[_0x2578('0x65')]=utils['CAMPAIGN_STATUS']['EMPTY_INTERVAL'];return _0x1f688b(msgResponse(_0x2578('0x89'),_0x2578('0x8a'),_0x344239+'\x20Intervals\x20is\x20empty\x20'));}if(_0x3663dc&&_['isUndefined'](config['timezones'][_0x3663dc])){_0x590e0b[_0x2578('0x65')]=utils['CAMPAIGN_STATUS'][_0x2578('0x8b')];return _0x1f688b(msgResponse(_0x2578('0x89'),_0x2578('0x8a'),_0x344239+_0x2578('0x8c')+_0x3663dc));}if(_[_0x2578('0x8d')](_0x31a11d)){for(var _0x218b52=0x0;_0x218b52<_0x31a11d[_0x2578('0x8e')];_0x218b52+=0x1){_0x3a9e91[_0x2578('0x8f')](ami[_0x2578('0x90')]({'action':_0x2578('0x91'),'command':util[_0x2578('0x42')]('iftime\x20%s,%s',_0x31a11d[_0x218b52][_0x2578('0x92')],!_[_0x2578('0x3d')](config[_0x2578('0x93')][_0x3663dc])?_0x3663dc:'')})[_0x2578('0x3b')](function(_0x23c852){return _0x23c852[_0x2578('0x94')][_0x2578('0x95')](_0x2578('0x96'))>=0x0;})[_0x2578('0x97')](myreject(_0x1f688b)));}}else{_0x3a9e91[_0x2578('0x8f')](ami[_0x2578('0x90')]({'action':_0x2578('0x91'),'command':util[_0x2578('0x42')]('iftime\x20%s,%s',_0x31a11d,!_[_0x2578('0x3d')](config[_0x2578('0x93')][_0x3663dc])?_0x3663dc:'')})[_0x2578('0x3b')](function(_0x147dd6){return _0x147dd6[_0x2578('0x94')][_0x2578('0x95')]('true')>=0x0;})['catch'](myreject(_0x1f688b)));}Promise[_0x2578('0x98')](_0x3a9e91)[_0x2578('0x3b')](function(_0x4997c8){var _0x17362d=_[_0x2578('0x99')](_0x4997c8);if(_0x17362d){return _0x5be480(_0x17362d);}else{_0x590e0b[_0x2578('0x65')]=_0x4642e6?utils[_0x2578('0x6f')][_0x2578('0x9a')]:utils[_0x2578('0x6f')][_0x2578('0x9b')];return _0x1f688b(msgResponse(_0x2578('0x9c'),_0x2578('0x8a'),_0x2578('0x9d')+_0x4642e6+'\x20'+_0x344239+_0x2578('0x9e')+util[_0x2578('0x61')](_0x31a11d,{'showHidden':![],'depth':null})+_0x2578('0x9f')+_0x3663dc));}})[_0x2578('0x97')](function(_0xdb9649){return _0x1f688b(msgResponse(_0x2578('0x89'),_0x2578('0x8a'),JSON['stringify'](_0xdb9649)));});});};Dialer[_0x2578('0x18')][_0x2578('0x39')]=function(){var _0x5f0da8=this;return cmHopper[_0x2578('0xa0')]({'active':![]},{'where':{'active':!![]}})['then'](function(){setInterval(function(){_0x5f0da8[_0x2578('0xa1')]();},0x3e8);});};Dialer['prototype'][_0x2578('0xa1')]=function(){var _0x1d7b79=this;var _0x2452c0;for(var _0xbd7625 in this[_0x2578('0x1e')]){if(typeof this[_0x2578('0x1e')][_0xbd7625]!==_0x2578('0xa2')){_0x2452c0=this['campaigns'][_0xbd7625];if(utils[_0x2578('0x74')](_0x2452c0)&&utils[_0x2578('0x73')](_0x2452c0)){_0x2452c0[_0x2578('0x77')]=!![];Promise[_0x2578('0xa3')]()[_0x2578('0x3b')](checkIsIVRCampaignActive(_0x2452c0))[_0x2578('0x3b')](checkInterval(_0x2452c0))[_0x2578('0x3b')](_0x1d7b79[_0x2578('0xa4')](_0x2452c0))[_0x2578('0x3b')](_0x1d7b79[_0x2578('0x86')](_0x2452c0['dialGlobalInterval'],_0x2452c0[_0x2578('0xa5')],_0x2452c0['name'],_0x2452c0))[_0x2578('0x3b')](_0x1d7b79[_0x2578('0x87')](_0x2452c0[_0x2578('0x6e')],_0x2452c0['dialTimezone'],_0x2452c0[_0x2578('0x44')],_0x2452c0))['then'](_0x1d7b79['launchHandleIvr'](_0x2452c0))[_0x2578('0x97')](loggerCatchQueueSummary(_0x2578('0xa6'),_0x2452c0));}else{notSendMessagesCampaign(_0x2452c0);}}}};Dialer[_0x2578('0x18')][_0x2578('0xa7')]=function(_0x16e752){if(_0x16e752[_0x2578('0xa8')]!=='predictive'){clearPredictiveAttributes(_0x16e752);}switch(_0x16e752['dialMethod']){case _0x2578('0xa9'):this[_0x2578('0xaa')](_0x16e752,0x1);break;case _0x2578('0xab'):this[_0x2578('0xaa')](_0x16e752,_0x16e752[_0x2578('0xac')]);break;case'predictive':this[_0x2578('0xa')](_0x16e752);break;case _0x2578('0x9'):this['handlePower'](_0x16e752,0x1);break;default:logger[_0x2578('0x60')](_0x2578('0xad'),_0x16e752[_0x2578('0x44')],'method\x20not\x20recognized');}};Dialer[_0x2578('0x18')][_0x2578('0x89')]=function(_0x25732e,_0x41a614){var _0x26d09d=_0x25732e['dialTimezone'];var _0x291ba9=_0x41a614?_0x25732e[_0x2578('0xae')]:_0x25732e[_0x2578('0x6e')]['Intervals'];logger['silly'](_0x2578('0xaf'),_0x291ba9,_0x26d09d,_0x25732e[_0x2578('0x44')],util['format'](_0x2578('0xb0'),_0x25732e['name'],_0x25732e['id']));var _0x2c3542=null;return Interval['intervalIftime'](_0x291ba9,_0x26d09d)[_0x2578('0x3b')](function(_0x55775e){if(_0x55775e===!![]){return _0x55775e;}else{_0x25732e[_0x2578('0x65')]=_0x41a614?utils[_0x2578('0x6f')][_0x2578('0x9a')]:utils[_0x2578('0x6f')][_0x2578('0x9b')];_0x2c3542=msgResponse(_0x2578('0x9c'),'Failure',_0x2578('0x9d')+_0x41a614+'\x20'+_0x25732e[_0x2578('0x44')]+'\x20Interval\x20is\x20overtime:\x20'+util[_0x2578('0x61')](_0x291ba9,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x26d09d);}if(_0x2c3542!==null){logger[_0x2578('0xb1')](_0x2578('0xb2'),_0x2c3542);_0x2c3542[_0x2578('0xb3')]=_0x41a614;throw _0x2c3542;}})[_0x2578('0x97')](function(_0x174ee0){logger[_0x2578('0x60')](_0x2578('0xb4'),_0x174ee0);throw msgResponse(_0x2578('0xb5'),_0x2578('0x7d'),util[_0x2578('0x61')](_0x174ee0,{'showHidden':![],'depth':null}));});};Dialer[_0x2578('0x18')]['syncAgentConnect']=function(_0x472564){if(this['voiceQueues'][_0x472564['queue']]){if(this['uniqueId'][_0x472564['uniqueid']]&&this[_0x2578('0x24')][_0x472564['uniqueid']]['type']!==_0x2578('0xb6')){utils[_0x2578('0xb7')](this[_0x2578('0x1d')][_0x472564['queue']],_0x2578('0xb8'));this[_0x2578('0x24')][_0x472564[_0x2578('0xb9')]]['answertime']=moment()[_0x2578('0x42')](_0x2578('0xba'));}}};Dialer['prototype'][_0x2578('0x2f')]=function(_0x572991){var _0x5100cd=this[_0x2578('0x24')][_0x572991[_0x2578('0xb9')]];if(this[_0x2578('0x1d')][_0x572991[_0x2578('0xbb')]]){if(_0x5100cd&&_0x5100cd['type']!=='ivr'){delete this['uniqueId'][_0x572991[_0x2578('0xb9')]];this[_0x2578('0x1d')][_0x572991[_0x2578('0xbb')]][_0x2578('0xbc')]+=0x1;var _0x2b86f5=new AgentComplete(_0x5100cd,_0x572991);if(_0x572991[_0x2578('0xbd')]==='agent'){_0x2b86f5['agiafterat']=this[_0x2578('0x1d')][_0x572991[_0x2578('0xbb')]][_0x2578('0xbe')]&&this[_0x2578('0x1d')][_0x572991[_0x2578('0xbb')]][_0x2578('0xbf')]?moment()[_0x2578('0x42')](_0x2578('0xba')):undefined;}hopperUtils[_0x2578('0xc0')](_0x2b86f5)[_0x2578('0x97')](loggerCatch('[syncAgentComplete][createHistory]'));hopperUtils['moveContactManagedDialer'](_0x2b86f5)['catch'](loggerCatch(_0x2578('0xc1')));}}};Dialer[_0x2578('0x18')]['syncQueueCallerAbandon']=function(_0x22f169){var _0x40c9e3=this['uniqueId'][_0x22f169[_0x2578('0xb9')]];var _0xdc811d=this;var _0x5ba940=![];var _0x25b6f7;var _0xd4fa16;if(this['voiceQueues'][_0x22f169[_0x2578('0xbb')]]){if(_0x40c9e3&&_0x40c9e3[_0x2578('0xc2')]!==_0x2578('0xb6')){delete this['uniqueId'][_0x22f169[_0x2578('0xb9')]];utils[_0x2578('0xb7')](this['voiceQueues'][_0x22f169[_0x2578('0xbb')]],_0x2578('0xc3'));_0x40c9e3[_0x2578('0xc4')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x563ef1=new QueueCallerAbandon(_0x40c9e3,_0x22f169);if(utils['getSeconds'](_0x40c9e3[_0x2578('0xc4')],_0x40c9e3[_0x2578('0xc5')])>=_0x40c9e3[_0x2578('0xc6')]){this['voiceQueues'][_0x22f169['queue']][_0x2578('0x4e')]+=0x1;this[_0x2578('0x1d')][_0x22f169[_0x2578('0xbb')]][_0x2578('0xc7')]+=0x1;this[_0x2578('0x1d')][_0x22f169[_0x2578('0xbb')]][_0x2578('0xc8')]+=0x1;_0x563ef1[_0x2578('0x68')]=0xa;_0x563ef1['statedesc']=_0x2578('0xc9');_0x563ef1[_0x2578('0xca')]='TIMEOUT';_0x563ef1['agiafterat']=this['voiceQueues'][_0x22f169[_0x2578('0xbb')]][_0x2578('0xbe')]?moment()[_0x2578('0x42')](_0x2578('0xba')):undefined;_0x563ef1[_0x2578('0xcb')]+=0x1;_0x563ef1[_0x2578('0xcc')]+=0x1;_0x25b6f7=this[_0x2578('0x1d')][_0x22f169[_0x2578('0xbb')]][_0x2578('0xcd')];_0xd4fa16=this[_0x2578('0x1d')][_0x22f169[_0x2578('0xbb')]][_0x2578('0xce')];hopperUtils[_0x2578('0xcf')](_0x563ef1,_0x563ef1['state'],_0x40c9e3['voiceQueue'])['then'](function(_0x500c68){_0x5ba940=_0x500c68[_0x2578('0xd0')]==0x1;if(_0x563ef1[_0x2578('0xcb')]>=_0xdc811d[_0x2578('0x1d')][_0x22f169[_0x2578('0xbb')]]['dialDropMaxRetry']){_0xdc811d[_0x2578('0xd1')](_0x563ef1,_0x500c68[_0x2578('0xd0')]);}else{hopperUtils[_0x2578('0xd2')]({'active':![],'countdropretry':_0x563ef1[_0x2578('0xcb')],'scheduledat':moment()[_0x2578('0xd3')](_0xdc811d[_0x2578('0x1d')][_0x22f169[_0x2578('0xbb')]]['dialDropRetryFrequency'],'minutes')[_0x2578('0x42')](_0x2578('0xba')),'ContactId':_0x40c9e3['ContactId'],'ListId':_0x40c9e3[_0x2578('0xd4')],'VoiceQueueId':_0x40c9e3['VoiceQueueId']||undefined,'CampaignId':_0x40c9e3[_0x2578('0xd5')]||undefined})['catch'](loggerCatch(_0x2578('0xd6')));var _0x14c4e6=new History(_0x563ef1);_0x14c4e6['state']=0xa;_0x14c4e6['statedesc']=_0x2578('0xc9');_0x14c4e6[_0x2578('0xd7')]=moment()[_0x2578('0x42')](_0x2578('0xba'));_0x14c4e6[_0x2578('0xd8')]=_0x14c4e6[_0x2578('0xd7')];_0x14c4e6[_0x2578('0xd9')]=_0x563ef1[_0x2578('0xd9')];_0x14c4e6[_0x2578('0xda')]=_0x563ef1[_0x2578('0xda')];hopperUtils[_0x2578('0xc0')](_0x14c4e6)[_0x2578('0x97')](loggerCatch('[syncAgentComplete][createHistory][10]'));}})[_0x2578('0x3b')](function(){if(_0x5ba940)hopperUtils[_0x2578('0xdb')](_0x563ef1,_0x25b6f7,_0xd4fa16)[_0x2578('0x3b')](function(){return 0x1;});});}else{this[_0x2578('0x1d')][_0x22f169[_0x2578('0xbb')]][_0x2578('0xdc')]+=0x1;this[_0x2578('0x1d')][_0x22f169['queue']][_0x2578('0xdd')]+=0x1;_0x563ef1[_0x2578('0x68')]=0xb;_0x563ef1[_0x2578('0x69')]=_0x2578('0xde');_0x563ef1[_0x2578('0xca')]=_0x2578('0xdf');_0x563ef1[_0x2578('0xe0')]+=0x1;_0x563ef1['countglobal']+=0x1;_0x25b6f7=this[_0x2578('0x1d')][_0x22f169[_0x2578('0xbb')]][_0x2578('0xe1')];_0xd4fa16=this[_0x2578('0x1d')][_0x22f169['queue']][_0x2578('0xce')];hopperUtils[_0x2578('0xcf')](_0x563ef1,_0x563ef1[_0x2578('0x68')],_0x40c9e3[_0x2578('0xe2')])['then'](function(_0x1de9ca){if(_0x563ef1[_0x2578('0xe0')]>=_0xdc811d[_0x2578('0x1d')][_0x22f169[_0x2578('0xbb')]][_0x2578('0xe3')]){_0xdc811d[_0x2578('0xd1')](_0x563ef1,_0x1de9ca['additional']);}else{hopperUtils[_0x2578('0xd2')]({'active':![],'countabandonedretry':_0x563ef1[_0x2578('0xe0')],'scheduledat':moment()['add'](_0xdc811d[_0x2578('0x1d')][_0x22f169['queue']][_0x2578('0xe1')],_0x2578('0xe4'))[_0x2578('0x42')](_0x2578('0xba')),'ContactId':_0x40c9e3['ContactId'],'ListId':_0x40c9e3[_0x2578('0xd4')],'VoiceQueueId':_0x40c9e3[_0x2578('0xe5')]||undefined,'CampaignId':_0x40c9e3['CampaignId']||undefined})[_0x2578('0x97')](loggerCatch(_0x2578('0xe6')));var _0x38f673=new History(_0x563ef1);_0x38f673['state']=0xb;_0x38f673[_0x2578('0x69')]=_0x2578('0xde');_0x38f673['starttime']=moment()['format'](_0x2578('0xba'));_0x38f673[_0x2578('0xd8')]=_0x38f673[_0x2578('0xd7')];_0x38f673['calleridname']=_0x563ef1[_0x2578('0xd9')];_0x38f673[_0x2578('0xda')]=_0x563ef1['calleridnum'];hopperUtils[_0x2578('0xc0')](_0x38f673)[_0x2578('0x97')](loggerCatch(_0x2578('0xe7')));}})['then'](function(){if(_0x5ba940)hopperUtils[_0x2578('0xdb')](_0x563ef1,_0x25b6f7,_0xd4fa16)[_0x2578('0x3b')](function(){return 0x1;});});}}}};Dialer[_0x2578('0x18')][_0x2578('0x35')]=function(_0x597511){if(this[_0x2578('0x22')][_0x597511[_0x2578('0xb9')]]){this[_0x2578('0x22')][_0x597511[_0x2578('0xb9')]][_0x2578('0xe8')]=_0x597511[_0x2578('0xe8')];}if(this[_0x2578('0x24')][_0x597511[_0x2578('0xb9')]]){this[_0x2578('0x24')][_0x597511['uniqueid']][_0x2578('0xe8')]=_0x597511[_0x2578('0xe8')];}};Dialer['prototype'][_0x2578('0xe9')]=function(_0x140a6f){if(!this['actions'][_0x140a6f[_0x2578('0xea')]]){return;}var _0x4d8b6b=this[_0x2578('0x1d')][this[_0x2578('0x22')][_0x140a6f['actionid']][_0x2578('0xbb')]][_0x2578('0xeb')]||_0x2578('0xec');if(_0x4d8b6b===_0x2578('0xed')){if(this['actions'][_0x140a6f[_0x2578('0xea')]]&&_[_0x2578('0xee')](this[_0x2578('0x22')][_0x140a6f[_0x2578('0xea')]][_0x2578('0xef')])&&_0x140a6f[_0x2578('0x80')]==='1'&&_0x140a6f[_0x2578('0xf0')]==='0'){if(this[_0x2578('0x1f')][_0x140a6f[_0x2578('0xf1')]]){if(!this[_0x2578('0x1f')][_0x140a6f[_0x2578('0xf1')]][_0x2578('0xef')]){this['agents'][_0x140a6f[_0x2578('0xf1')]][_0x2578('0xef')]=!![];this['actions'][_0x140a6f['actionid']][_0x2578('0xef')]=!![];this['actions'][_0x140a6f[_0x2578('0xea')]][_0x2578('0xf1')]=_0x140a6f['stateinterface'];}}}}else if(_0x4d8b6b===_0x2578('0xec')){if(this[_0x2578('0x22')][_0x140a6f['actionid']]){if(this[_0x2578('0x1f')][_0x140a6f[_0x2578('0xf1')]]){this[_0x2578('0x22')][_0x140a6f[_0x2578('0xea')]]['stateinterface']=_0x140a6f[_0x2578('0xf1')];if(_[_0x2578('0xee')](this[_0x2578('0x29')][this['actions'][_0x140a6f[_0x2578('0xea')]][_0x2578('0xbb')]])){this[_0x2578('0x29')][this[_0x2578('0x22')][_0x140a6f['actionid']]['queue']]=[];}this[_0x2578('0x29')][this['actions'][_0x140a6f[_0x2578('0xea')]][_0x2578('0xbb')]]['push'](_[_0x2578('0xf2')](_['pick'](this['actions'][_0x140a6f[_0x2578('0xea')]],[_0x2578('0xf3'),_0x2578('0xf1')]),{'status':_0x140a6f[_0x2578('0x80')],'paused':_0x140a6f[_0x2578('0xf0')]}));}}}};Dialer[_0x2578('0x18')][_0x2578('0x38')]=function(_0x2bcb99){if(!this[_0x2578('0x22')][_0x2bcb99['actionid']]){return;}var _0x36cff2=this;var _0x393fe6=this[_0x2578('0x1d')][this[_0x2578('0x22')][_0x2bcb99[_0x2578('0xea')]][_0x2578('0xbb')]];var _0x50199d=_0x393fe6[_0x2578('0xeb')]||'rrmemory';if(_0x50199d==='roundrobin'){if(this[_0x2578('0x22')][_0x2bcb99[_0x2578('0xea')]]&&this[_0x2578('0x22')][_0x2bcb99['actionid']][_0x2578('0xf1')]){this[_0x2578('0x1c')]['run'](this[_0x2578('0x22')][_0x2bcb99[_0x2578('0xea')]][_0x2578('0xf3')],this[_0x2578('0x22')][_0x2bcb99[_0x2578('0xea')]][_0x2578('0xf1')])[_0x2578('0x97')](function(_0xf74a4c){logger['error']('[Catch][Preview][syncQueueStatusComplete]',util[_0x2578('0x61')](_0xf74a4c,{'showHidden':![],'depth':null}));})[_0x2578('0x1a')](function(){utils[_0x2578('0xb7')](_0x36cff2['voiceQueues'][_0x36cff2[_0x2578('0x22')][_0x2bcb99['actionid']]['queue']],'[syncQueueStatusComplete]');_0x36cff2[_0x2578('0x1f')][_0x36cff2[_0x2578('0x22')][_0x2bcb99[_0x2578('0xea')]][_0x2578('0xf1')]][_0x2578('0xef')]=![];delete _0x36cff2[_0x2578('0x22')][_0x2bcb99['actionid']];unlockQueueStatus(_0x393fe6);});}else{utils[_0x2578('0xb7')](this[_0x2578('0x1d')][this[_0x2578('0x22')][_0x2bcb99[_0x2578('0xea')]][_0x2578('0xbb')]],_0x2578('0xf4'));hopperUtils[_0x2578('0xd2')]({'active':![],'ContactId':this[_0x2578('0x22')][_0x2bcb99['actionid']]['ContactId'],'ListId':this[_0x2578('0x22')][_0x2bcb99[_0x2578('0xea')]][_0x2578('0xd4')],'VoiceQueueId':this['actions'][_0x2bcb99[_0x2578('0xea')]][_0x2578('0xe5')]||undefined,'CampaignId':this[_0x2578('0x22')][_0x2bcb99[_0x2578('0xea')]]['CampaignId']||undefined})[_0x2578('0x97')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0x2578('0x22')][_0x2bcb99[_0x2578('0xea')]];unlockQueueStatus(_0x393fe6);}}else if(_0x50199d==='rrmemory'){var _0x20eb2f;if(this[_0x2578('0x22')][_0x2bcb99[_0x2578('0xea')]]&&!_['isEmpty'](this[_0x2578('0x29')][this[_0x2578('0x22')][_0x2bcb99[_0x2578('0xea')]]['queue']])){if(this[_0x2578('0x2a')][_0x36cff2[_0x2578('0x22')][_0x2bcb99['actionid']]['queue']]){this[_0x2578('0x2a')][_0x36cff2[_0x2578('0x22')][_0x2bcb99[_0x2578('0xea')]]['queue']]=this['queueBookedRR'][this[_0x2578('0x22')][_0x2bcb99[_0x2578('0xea')]][_0x2578('0xbb')]]?this['queueBookedRR'][this[_0x2578('0x22')][_0x2bcb99[_0x2578('0xea')]][_0x2578('0xbb')]]:this[_0x2578('0x29')][this[_0x2578('0x22')][_0x2bcb99[_0x2578('0xea')]]['queue']]?this[_0x2578('0x29')][this[_0x2578('0x22')][_0x2bcb99[_0x2578('0xea')]][_0x2578('0xbb')]]['_rr']||0x0:0x0;}this[_0x2578('0x29')][this[_0x2578('0x22')][_0x2bcb99[_0x2578('0xea')]][_0x2578('0xbb')]][_0x2578('0xf5')]=this['queueBookedRR'][this[_0x2578('0x22')][_0x2bcb99['actionid']]['queue']];for(var _0x54e1fc=0x0;_0x54e1fc=_0x358239[_0x2578('0x122')]){_0x388c3f[_0x2578('0x123')](_0x296212,_0x35fa32,_0x26a914,_0x2578('0x124'));}else{if(_0x296212[_0x2578('0x120')]>=_0x358239[_0x2578('0x125')]){_0x388c3f[_0x2578('0x126')](_0x296212,_0x35fa32,_0x26a914,_0x2578('0x127'));}else{hopperUtils[_0x2578('0xd2')]({'active':![],'countmachineretry':_0x296212['countmachineretry'],'scheduledat':moment()[_0x2578('0xd3')](_0x358239[_0x2578('0x128')],'minutes')['format'](_0x2578('0xba')),'ContactId':_0x296212['ContactId'],'ListId':_0x296212['ListId'],'VoiceQueueId':_0x296212[_0x2578('0xe5')]||undefined,'CampaignId':_0x296212[_0x2578('0xd5')]||undefined})[_0x2578('0x97')](loggerCatch(_0x2578('0x129')));_0x35fa32({'reschedule':0x1});}}});}if(_0x3604b9['type']===_0x2578('0xb6')&&this[_0x2578('0x1e')][_0x3604b9[_0x2578('0xbb')]]['dialAMDActive']&&_0x47fe30[_0x2578('0x10d')]===_0x2578('0x10e')){delete this[_0x2578('0x24')][_0x47fe30[_0x2578('0xb9')]];utils[_0x2578('0xb7')](this[_0x2578('0x1e')][_0x3604b9[_0x2578('0xbb')]],_0x2578('0x10f'));_0x4e76d0=new Hangup(_0x3604b9,_0x47fe30);_0x4e76d0[_0x2578('0x68')]=0x12;_0x4e76d0['statedesc']=_0x2578('0x111');_0x4e76d0[_0x2578('0x112')]=_0x2578('0x113');ami['emit'](_0x2578('0x114'),ut[_0x2578('0x115')](_0x4e76d0,_0x2578('0x116')));this[_0x2578('0x117')](_0x4e76d0,'[syncHangupInAMDIvr][createHistory]',_0x2578('0x12a'));}if(_0x3604b9[_0x2578('0xc2')]===_0x2578('0xb6')&&this['campaigns'][_0x3604b9[_0x2578('0xbb')]][_0x2578('0x10c')]&&_0x47fe30[_0x2578('0x10d')]===_0x2578('0x11a')){return new Promise(function(_0x4f3280,_0x196b0f){delete _0x388c3f[_0x2578('0x24')][_0x47fe30[_0x2578('0xb9')]];utils['decrementOriginate'](_0x388c3f[_0x2578('0x1e')][_0x3604b9[_0x2578('0xbb')]],_0x2578('0x10f'));_0x388c3f[_0x2578('0x1e')][_0x3604b9[_0x2578('0xbb')]][_0x2578('0xbc')]+=0x1;_0x388c3f[_0x2578('0x1e')][_0x3604b9['queue']]['outboundAnswerAgiCallsDay']+=0x1;var _0x169978=_0x388c3f['campaigns'][_0x3604b9[_0x2578('0xbb')]];var _0x5992d0=new Hangup(_0x3604b9,_0x47fe30);_0x5992d0[_0x2578('0x68')]=0x13;_0x5992d0[_0x2578('0x69')]=_0x2578('0x11b');_0x5992d0[_0x2578('0x112')]=_0x2578('0x113');_0x5992d0[_0x2578('0x120')]+=0x1;_0x5992d0[_0x2578('0xcc')]+=0x1;_0x5992d0[_0x2578('0x116')]=!![];ami[_0x2578('0x3e')](_0x2578('0x114'),ut[_0x2578('0x115')](_0x5992d0,_0x2578('0x116')));hopperUtils[_0x2578('0xc0')](_0x5992d0)['catch'](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x5992d0[_0x2578('0x12b')]+_0x5992d0[_0x2578('0x11d')]+_0x5992d0[_0x2578('0x11e')]+_0x5992d0[_0x2578('0x11f')]+_0x5992d0[_0x2578('0xcb')]+_0x5992d0[_0x2578('0xe0')]+_0x5992d0[_0x2578('0x120')]+_0x5992d0[_0x2578('0x121')]>=_0x169978[_0x2578('0x122')]){_0x388c3f[_0x2578('0x123')](_0x5992d0,_0x4f3280,_0x196b0f,_0x2578('0x124'));}else{if(_0x5992d0['countmachineretry']>=_0x169978[_0x2578('0x125')]){_0x388c3f[_0x2578('0x126')](_0x5992d0,_0x4f3280,_0x196b0f,_0x2578('0x127'));}else{hopperUtils[_0x2578('0xd2')]({'active':![],'countmachineretry':_0x5992d0[_0x2578('0x120')],'scheduledat':moment()[_0x2578('0xd3')](_0x169978[_0x2578('0x128')],'minutes')[_0x2578('0x42')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5992d0[_0x2578('0xfe')],'ListId':_0x5992d0[_0x2578('0xd4')],'VoiceQueueId':_0x5992d0[_0x2578('0xe5')]||undefined,'CampaignId':_0x5992d0['CampaignId']||undefined})[_0x2578('0x97')](loggerCatch(_0x2578('0x129')));_0x4f3280({'reschedule':0x1});}}});}}};Dialer['prototype'][_0x2578('0x33')]=function(_0x205411){var _0x35f507=this['uniqueId'][_0x205411['uniqueid']];var _0x3f24dc;if(!_0x35f507){return;}if(_0x35f507[_0x2578('0xc2')]===_0x2578('0xb6')){delete this[_0x2578('0x24')][_0x205411['uniqueid']];utils[_0x2578('0xb7')](this[_0x2578('0x1e')][_0x35f507[_0x2578('0xbb')]],'[syncHangup]');this[_0x2578('0x1e')][_0x35f507[_0x2578('0xbb')]][_0x2578('0x12c')]+=0x1;if(_0x205411[_0x2578('0x12d')]===_0x2578('0x12e')){const _0x110fb7=new AgentComplete(_0x35f507,_0x205411);_0x110fb7[_0x2578('0xd5')]=this['campaigns'][_0x35f507[_0x2578('0xbb')]]['id'];hopperUtils[_0x2578('0xc0')](_0x110fb7)['catch'](loggerCatch(_0x2578('0x12f')));hopperUtils['moveContactManagedDialer'](_0x110fb7)[_0x2578('0x97')](loggerCatch('[syncAgentCompleteIvr]'));}else{_0x3f24dc=new Hangup(_0x35f507,_0x205411);hopperUtils[_0x2578('0xc0')](_0x3f24dc)[_0x2578('0x97')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0x2578('0x130')](_0x3f24dc)[_0x2578('0x97')](loggerCatch(_0x2578('0x131')));}}else{if(isNotNull(this[_0x2578('0x1d')][_0x35f507[_0x2578('0xbb')]][_0x2578('0x132')])){delete this[_0x2578('0x24')][_0x205411[_0x2578('0xb9')]];utils[_0x2578('0xb7')](this[_0x2578('0x1d')][_0x35f507[_0x2578('0xbb')]],_0x2578('0x133'));this[_0x2578('0x1d')][_0x35f507['queue']][_0x2578('0xbc')]+=0x1;this[_0x2578('0x1d')][_0x35f507[_0x2578('0xbb')]][_0x2578('0x110')]+=0x1;_0x3f24dc=new Hangup(_0x35f507,_0x205411);_0x3f24dc[_0x2578('0x68')]=0x10;_0x3f24dc[_0x2578('0x69')]=_0x2578('0x134');_0x3f24dc[_0x2578('0x112')]=_0x2578('0x135');hopperUtils[_0x2578('0xc0')](_0x3f24dc)[_0x2578('0x97')](loggerCatch(_0x2578('0x136')));hopperUtils[_0x2578('0x130')](_0x3f24dc)[_0x2578('0x97')](loggerCatch(_0x2578('0x131')));}else{delete this['uniqueId'][_0x205411[_0x2578('0xb9')]];utils[_0x2578('0xb7')](this[_0x2578('0x1d')][_0x35f507[_0x2578('0xbb')]],_0x2578('0x137'));if(_0x205411[_0x2578('0x12d')]===_0x2578('0x12e')){this[_0x2578('0x1d')][_0x35f507[_0x2578('0xbb')]]['outboundAnswerCallsDay']+=0x1;const _0x18e349=new AgentComplete(_0x35f507,_0x205411);_0x18e349[_0x2578('0xe5')]=this[_0x2578('0x1d')][_0x35f507['queue']]['id'];hopperUtils[_0x2578('0xc0')](_0x18e349)[_0x2578('0x97')](loggerCatch('[syncAgentComplete][createHistory]'));hopperUtils[_0x2578('0x130')](_0x18e349)[_0x2578('0x97')](loggerCatch(_0x2578('0xc1')));}else{this[_0x2578('0x1d')][_0x35f507[_0x2578('0xbb')]][_0x2578('0x138')]+=0x1;_0x3f24dc=new Hangup(_0x35f507,_0x205411);_0x3f24dc[_0x2578('0x68')]=0xc;_0x3f24dc[_0x2578('0x69')]=_0x205411['cause-txt'];_0x3f24dc[_0x2578('0x112')]='Unknown';hopperUtils[_0x2578('0xc0')](_0x3f24dc)[_0x2578('0x97')](loggerCatch(_0x2578('0x139')));hopperUtils[_0x2578('0x130')](_0x3f24dc)['catch'](loggerCatch(_0x2578('0x133')));}}}};Dialer[_0x2578('0x18')][_0x2578('0x13a')]=function(_0x3e34ad){var _0x7b40a7=this;if(!_0x7b40a7['queuesSummary'][_0x3e34ad[_0x2578('0x44')]]){_0x7b40a7[_0x2578('0x13b')][_0x3e34ad[_0x2578('0x44')]]={'running':![]};}else if(_0x7b40a7[_0x2578('0x13b')][_0x3e34ad['name']][_0x2578('0x13c')]===!![]){return;}else if(_0x7b40a7[_0x2578('0x13b')][_0x3e34ad[_0x2578('0x44')]]['running']===![]){_0x7b40a7[_0x2578('0x13b')][_0x3e34ad['name']][_0x2578('0x13c')]=!![];}var _0x14b426=_0x7b40a7[_0x2578('0x1d')][_0x3e34ad[_0x2578('0x44')]];var _0x8d8a94=_0x14b426[_0x2578('0x65')]!==utils['CAMPAIGN_STATUS'][_0x2578('0x79')];var _0x232a04=utils[_0x2578('0x13d')](_0x14b426);_0x14b426['statusMessage']=utils[_0x2578('0x13e')](_0x14b426,_0x7b40a7['trunks']);Promise[_0x2578('0xa3')]()[_0x2578('0x3b')](function(){if(_0x14b426[_0x2578('0x13f')]===utils[_0x2578('0x6f')][_0x2578('0x79')]){if(_0x8d8a94){clearPredictiveAttributes(_0x14b426);_0x3e34ad[_0x2578('0x26')]=undefined;_0x3e34ad[_0x2578('0x27')]=undefined;}if(_0x14b426['statusMessage']===utils[_0x2578('0x6f')][_0x2578('0x79')]){_0x3e34ad[_0x2578('0x140')]=0x0;_0x3e34ad[_0x2578('0xf0')]=0x0;_0x3e34ad[_0x2578('0x141')]=0x0;_0x3e34ad[_0x2578('0x142')]=0x0;_0x3e34ad[_0x2578('0x143')]=0x0;}}else if(_0x14b426[_0x2578('0x13f')]===utils[_0x2578('0x6f')]['ACTIVE']&&!_0x232a04){return _0x7b40a7[_0x2578('0x89')](_0x14b426,!![])[_0x2578('0x3b')](function(){return _0x7b40a7[_0x2578('0x89')](_0x14b426,![]);})['then'](function(){return _0x7b40a7['checkDialMethod'](_0x14b426);})[_0x2578('0x97')](function(_0x428949){loggerSyncQueueSummary['debug'](_0x2578('0x144'),util[_0x2578('0x61')](_0x428949,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x14b426);});}else{clearPredictiveAttributes(_0x14b426);}})[_0x2578('0x3b')](function(){var _0x56a689=_0x3e34ad[_0x2578('0x145')](_0x14b426);if(_0x56a689||_0x14b426['queueSummaryCountersUpdated']){_0x14b426[_0x2578('0x146')]=![];_0x3e34ad[_0x2578('0x147')](_0x14b426);Object[_0x2578('0x148')](_0x14b426,_0x3e34ad);emitOutboundVoiceQueueSummary(_0x3e34ad);}_0x7b40a7[_0x2578('0x13b')][_0x14b426['name']][_0x2578('0x13c')]=![];})[_0x2578('0x97')](function(_0x54db80){logger[_0x2578('0x60')](_0x2578('0x144'),util[_0x2578('0x61')](_0x54db80,{'showHidden':![],'depth':null}));_0x7b40a7[_0x2578('0x13b')][_0x14b426[_0x2578('0x44')]][_0x2578('0x13c')]=![];});};Dialer[_0x2578('0x18')]['syncQueueSummaryComplete']=_['throttle'](function(){var _0x5e3b4f=_[_0x2578('0x149')](this[_0x2578('0x1d')],function(_0x487f11){return _0x487f11[_0x2578('0x14a')];});var _0x240bfa=_[_0x2578('0x149')](this[_0x2578('0x1f')],function(_0x2d8ba7){return _0x2d8ba7[_0x2578('0x14b')]&&_0x2d8ba7[_0x2578('0x80')]===_0x2578('0x81');});if(_0x5e3b4f[_0x2578('0x8e')]>0x0&&_0x240bfa['length']>0x0){return Promise[_0x2578('0xa3')]()[_0x2578('0x3b')](cmHopper[_0x2578('0x14c')](_['map'](_0x5e3b4f,'id'),previewRecallmeReminderInterval,_[_0x2578('0x14d')](_0x240bfa,'id')))['then'](function(_0x2db713){for(var _0x3807f4=0x0;_0x3807f4<_0x2db713['length'];_0x3807f4++){var _0x5b239c=_0x2db713[_0x3807f4][_0x2578('0x14e')]['name'];if(_0x5b239c)io['to'](util[_0x2578('0x42')](_0x2578('0x14f'),_0x5b239c))[_0x2578('0x3e')]('user:dialPreviewRecallReminder',{'hopper':_0x2db713[_0x3807f4]});}})['catch'](function(_0x514a62){logger['error']('checkPreviewRecallReminder',_0x514a62);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x2578('0x18')][_0x2578('0x3a')]=function(){var _0x3f63f4=this;setInterval(function(){_0x3f63f4[_0x2578('0x150')](_0x3f63f4[_0x2578('0x24')],_0x2578('0x151'));_0x3f63f4[_0x2578('0x150')](_0x3f63f4[_0x2578('0x22')],_0x2578('0x152'));},0x32c8);};Dialer[_0x2578('0x18')][_0x2578('0x150')]=function(_0x588b22,_0x4f37f3){var _0x14165d=this;for(var _0x198606 in _0x588b22){if(typeof _0x588b22[_0x198606]!==_0x2578('0xa2')){this[_0x2578('0x1b')][_0x2578('0x153')](function(){if(!_[_0x2578('0xee')](_0x588b22[_0x198606])){return ami[_0x2578('0x90')]({'action':_0x2578('0x80'),'channel':_0x588b22[_0x198606][_0x2578('0xe8')]})[_0x2578('0x97')](function(_0x58a3d4){if(_0x58a3d4['message']===_0x2578('0x154')){setTimeout(function(){if(_0x588b22[_0x198606]&&_0x588b22[_0x198606][_0x2578('0xc2')]!==_0x2578('0xb6')){utils[_0x2578('0xb7')](_0x14165d[_0x2578('0x1d')][_0x588b22[_0x198606]['queue']],_0x2578('0x155'));logger[_0x2578('0x60')](_0x2578('0x156'),_0x4f37f3,_0x198606,_0x588b22[_0x198606][_0x2578('0xbb')]);delete _0x588b22[_0x198606];}if(_0x588b22[_0x198606]&&_0x588b22[_0x198606][_0x2578('0xc2')]===_0x2578('0xb6')){utils[_0x2578('0xb7')](_0x14165d[_0x2578('0x1e')][_0x588b22[_0x198606][_0x2578('0xbb')]],_0x2578('0x155'));logger[_0x2578('0x60')](_0x2578('0x157'),_0x4f37f3,_0x198606,_0x588b22[_0x198606][_0x2578('0xbb')]);delete _0x588b22[_0x198606];}},0x2328);}});}});}}};Dialer[_0x2578('0x18')]['getVoiceQueueRtPauses']=function(_0x2545fd){return Promise[_0x2578('0xa3')]()['then'](voiceQueueRt[_0x2578('0x158')](_0x2545fd))[_0x2578('0x97')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x2578('0x18')][_0x2578('0x159')]=function(_0xe84b13,_0x3fb5c1,_0x4b0dd9){var _0x561370={'state':0x19,'statedesc':_0x2578('0x15a')};utils['decrementOriginate'](_0x3fb5c1,_0x2578('0x15b')+_0xe84b13);this[_0x2578('0x117')](_[_0x2578('0xf2')](_0x561370,_[_0x2578('0x6d')](_0x4b0dd9,[_0x2578('0xfe'),'ListId',_0x2578('0x15c'),_0x2578('0xe5'),_0x2578('0xd5')])),_0x2578('0x15d'),'[emptyContact]');logger['error'](_0xe84b13);};Dialer['prototype'][_0x2578('0x117')]=function(_0x547bf4,_0x55792f,_0x5c31b3){hopperUtils[_0x2578('0xc0')](_0x547bf4)[_0x2578('0x97')](loggerCatch(_0x55792f));hopperUtils['moveContactManagedDialer'](_0x547bf4)['catch'](loggerCatch(_0x5c31b3));};Dialer[_0x2578('0x18')][_0x2578('0xd1')]=function(_0x50f3de,_0x702025){hopperUtils[_0x2578('0xc0')](_0x50f3de)[_0x2578('0x97')](loggerCatch('[syncAgentComplete][createHistory]'));if(_0x702025==0x0){hopperUtils[_0x2578('0x130')](_0x50f3de)[_0x2578('0x97')](loggerCatch(_0x2578('0x15e')));}};Dialer['prototype'][_0x2578('0x15f')]=function(_0x29c427){return Promise[_0x2578('0xa3')]()[_0x2578('0x3b')](cmHopper[_0x2578('0x14c')](_0x29c427['id'],previewRecallmeReminderInterval))[_0x2578('0x3b')](function(_0x225dd3){for(var _0x57f18f=0x0;_0x57f18f<_0x225dd3[_0x2578('0x8e')];_0x57f18f++){var _0x59e9d7=_0x225dd3[_0x57f18f][_0x2578('0x14e')][_0x2578('0x44')];if(_0x59e9d7)io['to'](util[_0x2578('0x42')](_0x2578('0x14f'),_0x59e9d7))[_0x2578('0x3e')](_0x2578('0x160'),{'hopper':_0x225dd3[_0x57f18f]});}})[_0x2578('0x97')](function(){});};Dialer['prototype'][_0x2578('0x161')]=function(_0x2d4255){var _0x4f9ad4=this;return function(){_0x4f9ad4[_0x2578('0x162')](_0x2d4255);};};Dialer[_0x2578('0x18')][_0x2578('0x163')]=function(_0x22bc06,_0x1b8ab7){var _0x4a37cc=this;var _0xdbc1c7=uuid['v4']();this[_0x2578('0x22')][_0xdbc1c7]=new Action(_0x22bc06,_0x1b8ab7,_0xdbc1c7);return new Promise(function(_0x37c890,_0x409fc9){if(_[_0x2578('0x3d')](_0x22bc06)&&typeof _0x22bc06!==_0x2578('0x164')){return _0x409fc9(msgResponse(_0x2578('0x165'),_0x2578('0x8a'),'voiceQueue\x20is\x20undefine'));}if(_[_0x2578('0x3d')](_0x1b8ab7[_0x2578('0x166')])||_0x1b8ab7[_0x2578('0x166')]===null){return _0x409fc9(msgResponse(_0x2578('0x165'),_0x2578('0x8a'),_0x2578('0x167')));}var _0x15ff1f={'XMD-CALLERID':_0x4a37cc[_0x2578('0x22')][_0xdbc1c7]['getCaller'](),'XMD-AGI':_0x22bc06[_0x2578('0x132')]?util[_0x2578('0x42')]('\x22agi://%s/square,%s\x22',ipAgi,_0x22bc06[_0x2578('0x132')]):_0x2578('0x168'),'XMD-AGIAFTER':_0x22bc06[_0x2578('0xbe')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x22bc06['dialQueueProject2']):'NONE','XMD-QUEUE':utils[_0x2578('0x169')](_0x22bc06)?util[_0x2578('0x42')](_0x2578('0x16a'),_0x22bc06[_0x2578('0x44')],_0x22bc06[_0x2578('0x16b')]||'',_0x22bc06['dialAgiAfterHangupAgent']?'c':'',_0x22bc06[_0x2578('0xc6')]||0x3):_0x2578('0x168'),'XMD-CONTACTID':_0x1b8ab7[_0x2578('0xfe')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x4a37cc[_0x2578('0x22')][_0xdbc1c7][_0x2578('0x16c')](),'XMD-AMD':_0x22bc06[_0x2578('0x10c')]?_0x2578('0x16d'):_0x2578('0x168'),'XMD-DESTINATION':_0x2578('0x10b')};if(_0x22bc06[_0x2578('0x10c')]){_0x15ff1f[_0x2578('0x16e')]=_0x22bc06[_0x2578('0x16f')]||0x9c4;_0x15ff1f[_0x2578('0x170')]=_0x22bc06[_0x2578('0x171')]||0x5dc;_0x15ff1f[_0x2578('0x172')]=_0x22bc06['dialAMDAfterGreetingSilence']||0x320;_0x15ff1f['XMD-AMDTOTALANALYSISTIME']=_0x22bc06['dialAMDTotalAnalysisTime']||0x1388;_0x15ff1f['XMD-AMDMINWORDLENGTH']=_0x22bc06['dialAMDMinWordLength']||0x64;_0x15ff1f[_0x2578('0x173')]=_0x22bc06[_0x2578('0x174')]||0x32;_0x15ff1f['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x22bc06[_0x2578('0x175')]||0x3;_0x15ff1f[_0x2578('0x176')]=_0x22bc06['dialAMDSilenceThreshold']||0x100;_0x15ff1f[_0x2578('0x177')]=_0x22bc06[_0x2578('0x178')]||0x1388;}if(utils[_0x2578('0x169')](_0x22bc06)){_0x15ff1f[_0x2578('0x179')]=_0x1b8ab7[_0x2578('0xe5')];}else{_0x15ff1f[_0x2578('0x17a')]=_0x1b8ab7[_0x2578('0xd5')];}var _0x1012b0=utils[_0x2578('0x17b')](_0x1b8ab7[_0x2578('0x17c')]);Object[_0x2578('0x148')](_0x15ff1f,_0x1012b0);var _0xcd31bd=_0x4a37cc['isTrunkReachable'](_0x22bc06[_0x2578('0x83')])?utils['getCallerId'](_0x22bc06[_0x2578('0x83')]['callerid'],_0x22bc06[_0x2578('0x17d')],_0x22bc06['dialRandomLastDigitCallerIdNumber']>0x0?utils[_0x2578('0x17e')](_0x22bc06[_0x2578('0x17f')],_0x22bc06[_0x2578('0x180')]):_0x22bc06[_0x2578('0x17f')]):utils[_0x2578('0x181')](_[_0x2578('0xee')](_0x22bc06[_0x2578('0x182')])?_0x22bc06[_0x2578('0x83')][_0x2578('0x183')]:_0x22bc06[_0x2578('0x182')][_0x2578('0x183')],_0x22bc06[_0x2578('0x17d')],_0x22bc06[_0x2578('0x180')]>0x0?utils[_0x2578('0x17e')](_0x22bc06[_0x2578('0x17f')],_0x22bc06[_0x2578('0x180')]):_0x22bc06[_0x2578('0x17f')]);if(_0xcd31bd){_0x15ff1f[_0x2578('0x184')]=_0x4a37cc[_0x2578('0x22')][_0xdbc1c7][_0x2578('0x185')]=utils['extractCalleridName'](_0xcd31bd);_0x15ff1f[_0x2578('0x186')]=_0x1b8ab7[_0x2578('0x166')];}_0x22bc06['variables']=_0x15ff1f;return ami['Action']({'actionid':_0xdbc1c7,'action':'originate','channel':_0x4a37cc[_0x2578('0x7e')](_0x22bc06[_0x2578('0x83')])?util['format'](_0x2578('0x187'),_0x22bc06[_0x2578('0x83')][_0x2578('0x44')],isNotNull(_0x22bc06[_0x2578('0x188')])?_0x22bc06[_0x2578('0x188')][_0x2578('0x189')]()||'':'',_0x22bc06[_0x2578('0x18a')]>0x0?_0x1b8ab7[_0x2578('0x166')][_0x2578('0x18b')](_0x22bc06[_0x2578('0x18a')]):_0x1b8ab7[_0x2578('0x166')]):util[_0x2578('0x42')]('SIP/%s/%s%s',_[_0x2578('0xee')](_0x22bc06[_0x2578('0x182')])?_0x22bc06[_0x2578('0x83')][_0x2578('0x44')]:_0x22bc06['TrunkBackup'][_0x2578('0x44')],isNotNull(_0x22bc06[_0x2578('0x188')])?_0x22bc06[_0x2578('0x188')][_0x2578('0x189')]()||'':'',_0x22bc06[_0x2578('0x18a')]>0x0?_0x1b8ab7['phone']['substring'](_0x22bc06[_0x2578('0x18a')]):_0x1b8ab7[_0x2578('0x166')]),'callerid':_0xcd31bd,'Exten':_0x2578('0x10b'),'Context':_0x2578('0x18c'),'Priority':'1','variable':_0x15ff1f,'timeout':(_0x22bc06[_0x2578('0x18d')]||0x1e)*0x3e8,'async':!![],'channelid':_0xdbc1c7})[_0x2578('0x3b')](function(_0x51dde8){return _0x37c890(_0x51dde8);})[_0x2578('0x97')](function(_0x43453e){_0x22bc06[_0x2578('0x18e')]+=0x1;var _0x28efd9=new History(_0x4a37cc['actions'][_0xdbc1c7]);logger[_0x2578('0x60')](util[_0x2578('0x42')](_0x2578('0x18f'),JSON['stringify'](_0x43453e)));_0x28efd9['state']=0xe;_0x28efd9[_0x2578('0x69')]='OriginateError';_0x28efd9['starttime']=moment()[_0x2578('0x42')](_0x2578('0xba'));_0x28efd9[_0x2578('0xd8')]=_0x28efd9[_0x2578('0xd7')];hopperUtils[_0x2578('0xc0')](_0x28efd9)[_0x2578('0x97')](loggerCatch(_0x2578('0x190')));_0x4a37cc['moveContactManagedDialer'](_0x28efd9)[_0x2578('0x97')](loggerCatch('[originate][error]'))[_0x2578('0x1a')](function(){delete _0x4a37cc[_0x2578('0x22')][_0xdbc1c7];return _0x409fc9(msgResponse('originate','Error',_0x2578('0x191')));});});});};Dialer[_0x2578('0x18')][_0x2578('0x192')]=function(_0x12b436,_0x3a8484,_0x19d264){var _0x44c0bc=new History(_0x3a8484);if(_0x44c0bc[_0x2578('0x12b')]+_0x44c0bc['countcongestionretry']+_0x44c0bc[_0x2578('0x11e')]+_0x44c0bc[_0x2578('0x11f')]+_0x44c0bc[_0x2578('0xcb')]+_0x44c0bc[_0x2578('0xe0')]+_0x44c0bc[_0x2578('0x120')]+_0x44c0bc['countagentrejectretry']>=_0x19d264[_0x2578('0x122')]-0x1){return!![];}switch(_0x12b436){case 0x3:if(_0x44c0bc[_0x2578('0x11e')]>=_0x19d264[_0x2578('0x193')]-0x1){return!![];}hopperUtils[_0x2578('0xd2')]({'active':![],'countnoanswerretry':_0x44c0bc['countnoanswerretry']+=0x1,'scheduledat':moment()[_0x2578('0xd3')](_0x19d264[_0x2578('0x194')],_0x2578('0xe4'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x44c0bc[_0x2578('0xfe')],'ListId':_0x44c0bc[_0x2578('0xd4')],'VoiceQueueId':_0x44c0bc[_0x2578('0xe5')]||undefined,'CampaignId':_0x44c0bc[_0x2578('0xd5')]||undefined})['catch'](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x44c0bc[_0x2578('0x12b')]>=_0x19d264[_0x2578('0x195')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countbusyretry':_0x44c0bc['countbusyretry']+=0x1,'scheduledat':moment()[_0x2578('0xd3')](_0x19d264[_0x2578('0x196')],_0x2578('0xe4'))[_0x2578('0x42')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x44c0bc[_0x2578('0xfe')],'ListId':_0x44c0bc['ListId'],'VoiceQueueId':_0x44c0bc[_0x2578('0xe5')]||undefined,'CampaignId':_0x44c0bc[_0x2578('0xd5')]||undefined})[_0x2578('0x97')](loggerCatch(_0x2578('0x197')));break;case 0x8:if(_0x44c0bc[_0x2578('0x11d')]>=_0x19d264['dialCongestionMaxRetry']-0x1){return!![];}hopperUtils[_0x2578('0xd2')]({'active':![],'countcongestionretry':_0x44c0bc[_0x2578('0x11d')]+=0x1,'scheduledat':moment()[_0x2578('0xd3')](_0x19d264['dialCongestionRetryFrequency'],'minutes')[_0x2578('0x42')](_0x2578('0xba')),'ContactId':_0x44c0bc[_0x2578('0xfe')],'ListId':_0x44c0bc['ListId'],'VoiceQueueId':_0x44c0bc[_0x2578('0xe5')]||undefined,'CampaignId':_0x44c0bc[_0x2578('0xd5')]||undefined})[_0x2578('0x97')](loggerCatch(_0x2578('0x198')));break;case 0x0:if(_0x44c0bc['countnosuchnumberretry']>=_0x19d264[_0x2578('0x199')]-0x1){return!![];}else{hopperUtils['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x44c0bc[_0x2578('0x11f')]+=0x1,'scheduledat':moment()[_0x2578('0xd3')](_0x19d264[_0x2578('0x19a')],_0x2578('0xe4'))[_0x2578('0x42')](_0x2578('0xba')),'ContactId':_0x44c0bc[_0x2578('0xfe')],'ListId':_0x44c0bc[_0x2578('0xd4')],'VoiceQueueId':_0x44c0bc[_0x2578('0xe5')]||undefined,'CampaignId':_0x44c0bc[_0x2578('0xd5')]||undefined})[_0x2578('0x97')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x44c0bc[_0x2578('0xcb')]>=_0x19d264[_0x2578('0x19b')]-0x1){return!![];}hopperUtils[_0x2578('0xd2')]({'active':![],'countdropretry':_0x44c0bc[_0x2578('0xcb')]+=0x1,'scheduledat':moment()[_0x2578('0xd3')](_0x19d264[_0x2578('0xcd')],_0x2578('0xe4'))[_0x2578('0x42')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x44c0bc[_0x2578('0xfe')],'ListId':_0x44c0bc[_0x2578('0xd4')],'VoiceQueueId':_0x44c0bc[_0x2578('0xe5')]||undefined,'CampaignId':_0x44c0bc[_0x2578('0xd5')]||undefined})['catch'](loggerCatch(_0x2578('0xd6')));break;case 0xb:if(_0x44c0bc[_0x2578('0xe0')]>=_0x19d264[_0x2578('0xe3')]-0x1){return!![];}hopperUtils[_0x2578('0xd2')]({'active':![],'countabandonedretry':_0x44c0bc[_0x2578('0xe0')]+=0x1,'scheduledat':moment()['add'](_0x19d264[_0x2578('0xe1')],_0x2578('0xe4'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x44c0bc[_0x2578('0xfe')],'ListId':_0x44c0bc[_0x2578('0xd4')],'VoiceQueueId':_0x44c0bc['VoiceQueueId']||undefined,'CampaignId':_0x44c0bc[_0x2578('0xd5')]||undefined})[_0x2578('0x97')](loggerCatch(_0x2578('0xe6')));break;case 0x13:if(_0x44c0bc[_0x2578('0x120')]>=_0x19d264[_0x2578('0x125')]-0x1){return!![];}hopperUtils[_0x2578('0xd2')]({'active':![],'countmachineretry':_0x44c0bc[_0x2578('0x120')]+=0x1,'scheduledat':moment()[_0x2578('0xd3')](_0x19d264['dialMachineRetryFrequency'],_0x2578('0xe4'))['format'](_0x2578('0xba')),'ContactId':_0x44c0bc['ContactId'],'ListId':_0x44c0bc[_0x2578('0xd4')],'VoiceQueueId':_0x44c0bc[_0x2578('0xe5')]||undefined,'CampaignId':_0x44c0bc[_0x2578('0xd5')]||undefined})[_0x2578('0x97')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x44c0bc[_0x2578('0x121')]>=_0x19d264['dialAgentRejectMaxRetry']-0x1){return!![];}hopperUtils[_0x2578('0xd2')]({'active':![],'countagentrejectretry':_0x44c0bc[_0x2578('0x121')]+=0x1,'scheduledat':moment()['add'](_0x19d264['dialAgentRejectRetryFrequency'],'minutes')[_0x2578('0x42')](_0x2578('0xba')),'ContactId':_0x44c0bc[_0x2578('0xfe')],'ListId':_0x44c0bc[_0x2578('0xd4')],'VoiceQueueId':_0x44c0bc['VoiceQueueId']||undefined,'CampaignId':_0x44c0bc['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0x2578('0x18')][_0x2578('0x19c')]=function(_0x3aff76,_0x481b7a,_0x30c25a){var _0x529c93=this;var _0x3500db=new History(_0x3aff76);var _0x302ccb=![];var _0x28d85;var _0x12d160;return new Promise(function(_0x260f3d,_0x41b397){if(_[_0x2578('0x3d')](_0x481b7a)&&typeof _0x481b7a!==_0x2578('0x164')){return _0x41b397(msgResponse(_0x2578('0x19d'),_0x2578('0x8a'),'entity\x20is\x20undefine'));}if(_[_0x2578('0x3d')](_0x30c25a)&&typeof _0x30c25a!=='object'){return _0x41b397(msgResponse('[callProgressDetecting]','Failure','evt\x20is\x20undefine'));}hopperUtils[_0x2578('0xcf')](_0x3500db,_0x30c25a['reason'],_0x481b7a)[_0x2578('0x3b')](function(_0x6e3eff){if(_0x6e3eff['additional']==0x1)_0x302ccb=!![];switch(_0x30c25a[_0x2578('0xbd')]){case'0':_0x481b7a[_0x2578('0x19e')]+=0x1;_0x3500db['state']=0x0;_0x3500db[_0x2578('0x69')]=_0x2578('0x19f');_0x3500db[_0x2578('0x11f')]+=0x1;_0x3500db[_0x2578('0xcc')]+=0x1;ami[_0x2578('0x3e')]('custom:agentnosuchnumber',ut[_0x2578('0x115')](_0x3aff76,_0x2578('0x1a0')));_0x28d85=_0x481b7a[_0x2578('0x19a')];_0x12d160=_0x481b7a[_0x2578('0xce')];hopperUtils['createHistory'](_0x3500db)[_0x2578('0x97')](loggerCatch(_0x2578('0x11c')));if(_0x529c93[_0x2578('0x192')](0x0,_0x3aff76,_0x481b7a)&&!_0x302ccb){if(_0x3500db[_0x2578('0x11f')]>=_0x481b7a[_0x2578('0x199')]){_0x529c93['createStateFinal'](_0x3500db,_0x260f3d,_0x41b397,_0x2578('0x1a1'));}else{_0x529c93[_0x2578('0x123')](_0x3500db,_0x260f3d,_0x41b397,_0x2578('0x1a1'));}}break;case'3':_0x481b7a[_0x2578('0x1a2')]+=0x1;_0x3500db[_0x2578('0x68')]=0x3;_0x3500db[_0x2578('0x69')]=_0x2578('0x1a3');_0x3500db[_0x2578('0x11e')]+=0x1;_0x3500db[_0x2578('0xcc')]+=0x1;var _0x5f2191=ut['buildNoAnswerEventPayload'](_0x3aff76,_0x481b7a);ami[_0x2578('0x3e')](_0x2578('0x1a4'),_0x5f2191);_0x28d85=_0x481b7a[_0x2578('0x194')];_0x12d160=_0x481b7a[_0x2578('0xce')];hopperUtils[_0x2578('0xc0')](_0x3500db)['catch'](loggerCatch(_0x2578('0x1a5')));if(_0x529c93[_0x2578('0x192')](0x3,_0x3aff76,_0x481b7a)&&!_0x302ccb){if(_0x3500db[_0x2578('0x11e')]>=_0x481b7a['dialNoAnswerMaxRetry']){_0x529c93['createStateFinal'](_0x3500db,_0x260f3d,_0x41b397,_0x2578('0x1a6'));}else{_0x529c93[_0x2578('0x123')](_0x3500db,_0x260f3d,_0x41b397,_0x2578('0x1a6'));}}break;case'5':_0x481b7a['outboundBusyCallsDay']+=0x1;_0x3500db[_0x2578('0x68')]=0x5;_0x3500db[_0x2578('0x69')]=_0x2578('0x1a7');_0x3500db[_0x2578('0x12b')]+=0x1;_0x3500db['countglobal']+=0x1;ami[_0x2578('0x3e')](_0x2578('0x1a8'),ut[_0x2578('0x115')](_0x3aff76,_0x2578('0x1a9')));_0x28d85=_0x481b7a['dialBusyRetryFrequency'];_0x12d160=_0x481b7a['callAdditionalPhoneAfterMin'];hopperUtils[_0x2578('0xc0')](_0x3500db)[_0x2578('0x97')](loggerCatch(_0x2578('0x1aa')));if(_0x529c93[_0x2578('0x192')](0x5,_0x3aff76,_0x481b7a)&&!_0x302ccb){if(_0x3500db['countbusyretry']>=_0x481b7a[_0x2578('0x195')]){_0x529c93[_0x2578('0x126')](_0x3500db,_0x260f3d,_0x41b397,_0x2578('0x1ab'));}else{_0x529c93[_0x2578('0x123')](_0x3500db,_0x260f3d,_0x41b397,_0x2578('0x1ab'));}}break;case'8':_0x481b7a[_0x2578('0x1ac')]+=0x1;_0x3500db[_0x2578('0x68')]=0x8;_0x3500db[_0x2578('0x69')]=_0x2578('0x1ad');_0x3500db[_0x2578('0x11d')]+=0x1;_0x3500db[_0x2578('0xcc')]+=0x1;_0x28d85=_0x481b7a[_0x2578('0x1ae')];_0x12d160=_0x481b7a[_0x2578('0xce')];ami['emit'](_0x2578('0x1af'),ut['buildObj'](_0x3aff76,_0x2578('0x1b0')));hopperUtils[_0x2578('0xc0')](_0x3500db)[_0x2578('0x97')](loggerCatch(_0x2578('0x1b1')));if(_0x529c93[_0x2578('0x192')](0x8,_0x3aff76,_0x481b7a)&&!_0x302ccb){if(_0x3500db[_0x2578('0x11d')]>=_0x481b7a[_0x2578('0x1b2')]){_0x529c93[_0x2578('0x126')](_0x3500db,_0x260f3d,_0x41b397,_0x2578('0x1b3'));}else{_0x529c93[_0x2578('0x123')](_0x3500db,_0x260f3d,_0x41b397,_0x2578('0x1b3'));}}break;case'11':_0x481b7a[_0x2578('0x1b4')]+=0x1;_0x3500db[_0x2578('0x68')]=0xb;_0x3500db['statedesc']=_0x2578('0xde');_0x3500db['countabandonedretry']+=0x1;_0x3500db[_0x2578('0xcc')]+=0x1;_0x28d85=_0x481b7a[_0x2578('0xe1')];_0x12d160=_0x481b7a[_0x2578('0xce')];hopperUtils[_0x2578('0xc0')](_0x3500db)['catch'](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x529c93[_0x2578('0x192')](0xb,_0x3aff76,_0x481b7a)&&!_0x302ccb){if(_0x3500db[_0x2578('0xe0')]>=_0x481b7a[_0x2578('0xe3')]){_0x529c93[_0x2578('0x126')](_0x3500db,_0x260f3d,_0x41b397,'reason\x2011\x20abandoned');}else{_0x529c93[_0x2578('0x123')](_0x3500db,_0x260f3d,_0x41b397,_0x2578('0x1b5'));}}break;case'20':_0x481b7a[_0x2578('0x1b6')]+=0x1;_0x3500db[_0x2578('0x68')]=0x14;_0x3500db[_0x2578('0x69')]=_0x2578('0x1b7');_0x3500db[_0x2578('0x121')]+=0x1;_0x3500db[_0x2578('0xcc')]+=0x1;_0x28d85=_0x481b7a[_0x2578('0x1b8')];_0x12d160=_0x481b7a[_0x2578('0xce')];ami['emit'](_0x2578('0x1b9'),ut['buildObj'](_0x3aff76,_0x2578('0x1ba')));hopperUtils['createHistory'](_0x3500db)[_0x2578('0x97')](loggerCatch(_0x2578('0x1bb')));if(_0x529c93['checkRetriveMax'](0x14,_0x3aff76,_0x481b7a)&&!_0x302ccb){if(_0x3500db[_0x2578('0x121')]>=_0x481b7a[_0x2578('0x1bc')]){_0x529c93[_0x2578('0x126')](_0x3500db,_0x260f3d,_0x41b397,_0x2578('0x1bd'));}else{_0x529c93['stateGlobal'](_0x3500db,_0x260f3d,_0x41b397,_0x2578('0x1bd'));}}break;default:_0x481b7a[_0x2578('0x138')]+=0x1;_0x3500db[_0x2578('0x68')]=0xc;_0x3500db[_0x2578('0x69')]=_0x30c25a[_0x2578('0xbd')];_0x28d85=_0x481b7a[_0x2578('0x1b8')];_0x12d160=_0x481b7a[_0x2578('0xce')];hopperUtils[_0x2578('0xc0')](_0x3500db)[_0x2578('0x97')](loggerCatch(_0x2578('0x1be')));if(_0x529c93[_0x2578('0x192')](_0x30c25a[_0x2578('0xbd')],_0x3aff76,_0x481b7a)&&!_0x302ccb){if(_0x3500db[_0x2578('0x12b')]+_0x3500db['countcongestionretry']+_0x3500db['countnoanswerretry']+_0x3500db['countnosuchnumberretry']+_0x3500db[_0x2578('0xcb')]+_0x3500db[_0x2578('0xe0')]+_0x3500db[_0x2578('0x120')]+_0x3500db['countagentrejectretry']>=_0x481b7a[_0x2578('0x122')]){_0x529c93[_0x2578('0x123')](_0x3500db,_0x260f3d,_0x41b397,_0x30c25a['reason']);}else{_0x529c93[_0x2578('0x126')](_0x3500db,_0x260f3d,_0x41b397,_0x30c25a['reason']);}}}})[_0x2578('0x3b')](function(){if(_0x302ccb){hopperUtils[_0x2578('0xdb')](_0x3500db,_0x28d85,_0x12d160)['then'](function(){return _0x260f3d(0x1);});}});});};Dialer[_0x2578('0x18')][_0x2578('0x123')]=function(_0x2e3d9c,_0x39696a,_0x1bd0c3,_0xe43d4){var _0x309622=new Final(_0x2e3d9c);_0x309622[_0x2578('0x68')]=0xf;_0x309622[_0x2578('0x69')]=_0x2578('0x1bf');this[_0x2578('0x126')](_0x309622,_0x39696a,_0x1bd0c3,_0xe43d4);};Dialer[_0x2578('0x18')][_0x2578('0x126')]=function(_0x223a90,_0x1c83a2,_0x2dd2ca,_0x152475){hopperUtils[_0x2578('0x130')](_0x223a90)[_0x2578('0x3b')](function(){return _0x1c83a2(msgResponse(_0x2578('0x19d'),'Success',_0x152475));})['catch'](function(){return _0x2dd2ca(msgResponse(_0x2578('0x1c0'),_0x2578('0x8a'),_0x2578('0x1c1')));});};Dialer['prototype']['predictive']=function(_0x41df46){var _0x201df9=_0x41df46['dialPredictiveOptimizationPercentage']/0x64;var _0x47f2bd=_0x41df46[_0x2578('0xc7')]/(_0x41df46[_0x2578('0xc7')]+_0x41df46[_0x2578('0xbc')]);var _0x4d79ff=Math[_0x2578('0x1c2')](_0x41df46['predictiveIntervalAvailable']*(_0x41df46[_0x2578('0x1c3')]/0x64));var _0x29aa7d=Math[_0x2578('0x1c2')](_0x41df46[_0x2578('0x1c4')]*(_0x41df46[_0x2578('0x1c5')]/0x64));var _0x42dea7=_0x41df46[_0x2578('0x140')]+_0x41df46[_0x2578('0x142')];var _0x4427a4=Math[_0x2578('0x1c6')](_0x41df46[_0x2578('0x59')]*_0x41df46['erlangAbandonmentRate']*_0x41df46[_0x2578('0x1c7')]*_0x41df46[_0x2578('0x1c8')]);if(_['isUndefined'](_0x41df46[_0x2578('0x27')])){if(!_[_0x2578('0x3d')](_0x41df46[_0x2578('0x26')])){_0x41df46[_0x2578('0x26')]=undefined;loggerPredictive[_0x2578('0x60')](_0x2578('0x1c9'),_0x2578('0x1ca'));}if(!_[_0x2578('0x3d')](_0x41df46['handlePredictive'])){loggerPredictive[_0x2578('0x60')](_0x2578('0x1c9'),_0x2578('0x1cb'));clearInterval(_0x41df46[_0x2578('0x5d')]);_0x41df46['handlePredictive']=undefined;}_0x41df46['startProgressive']=moment()[_0x2578('0x42')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x2578('0x47')](_0x41df46['name'],_0x2578('0x1cc'),_0x41df46['startProgressive']);this[_0x2578('0xaa')](_0x41df46,0x1);}else if(ifInterval(_0x41df46[_0x2578('0x1cd')],_0x41df46[_0x2578('0x27')])){this[_0x2578('0xaa')](_0x41df46,0x1);loggerPredictiveCalls[_0x2578('0x47')]('[startMethodPredictive][StartProgressive][Loop]',_0x41df46[_0x2578('0x27')],_0x41df46[_0x2578('0x44')]);_0x41df46[_0x2578('0x59')]=0x0;_0x41df46[_0x2578('0xc8')]=0x0;}else if(_0x201df9<_0x47f2bd&&_0x41df46[_0x2578('0x1ce')]===_0x2578('0x1cf')){clearPredictiveAttributes(_0x41df46);loggerPredictive[_0x2578('0x47')](_0x2578('0x1d0'),_0x2578('0x1d1'),_0x47f2bd,_0x2578('0x27'),_0x41df46[_0x2578('0x44')]);}else if(_0x4427a4<_0x41df46[_0x2578('0xc8')]&&_0x41df46[_0x2578('0x1ce')]===_0x2578('0x1cf')){clearPredictiveAttributes(_0x41df46);loggerPredictive[_0x2578('0x47')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20',_0x4427a4,_0x2578('0x1d2'),_0x41df46[_0x2578('0xc8')],_0x2578('0x27'),_0x41df46[_0x2578('0x44')]);}else if(!ifInterval(_0x41df46[_0x2578('0x1cd')],_0x41df46[_0x2578('0x27')])&&_[_0x2578('0x3d')](_0x41df46['startPredictive'])&&!_[_0x2578('0x3d')](_0x41df46[_0x2578('0x27')])){_0x41df46[_0x2578('0x26')]=moment()[_0x2578('0x42')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x2578('0x47')](_0x41df46[_0x2578('0x44')],_0x2578('0x1d3'),_0x41df46[_0x2578('0x26')]);hopperUtils[_0x2578('0x1d4')](_0x41df46[_0x2578('0x1cd')])['then'](this[_0x2578('0x1d5')](_0x41df46))['then'](mergeDataErlangB(_0x41df46))[_0x2578('0x3b')](this[_0x2578('0x1d6')](_0x41df46))[_0x2578('0x97')](loggerCatchPredictive(_0x2578('0x1d7'),_0x41df46));}else if(!ifInterval(_0x41df46[_0x2578('0x1cd')],_0x41df46['startPredictive'])){_0x41df46['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x41df46[_0x2578('0x26')]=moment()[_0x2578('0x42')](_0x2578('0xba'));loggerPredictive['info'](_0x41df46[_0x2578('0x44')],_0x2578('0x1d8'),_0x41df46[_0x2578('0x26')]);clearInterval(_0x41df46[_0x2578('0x5d')]);_0x41df46[_0x2578('0x5d')]=undefined;hopperUtils[_0x2578('0x1d4')](_0x41df46['dialPredictiveInterval'])['then'](this[_0x2578('0x1d5')](_0x41df46))[_0x2578('0x3b')](mergeDataErlangB(_0x41df46))[_0x2578('0x3b')](this[_0x2578('0x1d6')](_0x41df46))[_0x2578('0x97')](loggerCatchPredictive(_0x2578('0x1d9'),_0x41df46));}else if(_0x41df46[_0x2578('0x1c4')]&&_0x42dea7<_0x41df46[_0x2578('0x1c4')]-_0x29aa7d){clearPredictiveAttributes(_0x41df46);loggerPredictive[_0x2578('0x47')](_0x41df46[_0x2578('0x44')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x42dea7,')\x20are\x20less\x20than\x20threshold\x20(',_0x41df46[_0x2578('0x1c4')],'-',_0x29aa7d,'=',_0x41df46[_0x2578('0x1c4')]-_0x29aa7d,')');}else if(_0x41df46[_0x2578('0x1c4')]&&_0x42dea7>_0x41df46['predictiveIntervalAvailable']+_0x4d79ff){clearPredictiveAttributes(_0x41df46);loggerPredictive[_0x2578('0x47')](_0x41df46[_0x2578('0x44')],_0x2578('0x1da'),_0x42dea7,_0x2578('0x1db'),_0x41df46[_0x2578('0x1c4')],'+',_0x4d79ff,'=',_0x41df46[_0x2578('0x1c4')]+_0x4d79ff,')');}};Dialer[_0x2578('0x18')][_0x2578('0x1d5')]=function(_0x4adf34){var _0x57b360=this;return function(_0x204b2d){return new Promise(function(_0x326319,_0x2ab559){_[_0x2578('0xf2')](_0x4adf34,_0x204b2d[0x0]);if(checkGetDataPredictive(_0x204b2d[0x0])){var _0x71c55d=_0x4adf34[_0x2578('0x1c4')]=_0x4adf34[_0x2578('0x142')]+_0x4adf34['available'];var _0x37b374=_0x4adf34[_0x2578('0x1cd')]*0x3c;var _0x4ae240=_0x204b2d[0x0][_0x2578('0x53')]+_0x204b2d[0x0][_0x2578('0x51')];var _0x5b1ebe=(_0x204b2d[0x0][_0x2578('0x4c')]+_0x204b2d[0x0][_0x2578('0x4e')]+_0x204b2d[0x0][_0x2578('0xdc')])/_0x204b2d[0x0][_0x2578('0x4a')];_0x4adf34[_0x2578('0x1c7')]=_0x5b1ebe>0x0?_0x5b1ebe:0x1;switch(_0x4adf34['dialPredictiveOptimization']){case _0x2578('0x1cf'):var _0x2f23ca=_0x4adf34[_0x2578('0x1dc')]/0x64;return _0x57b360[_0x2578('0x1dd')](_0x71c55d,_0x37b374,_0x4ae240,_0x5b1ebe,_0x2f23ca)[_0x2578('0x3b')](function(_0x158b47){return _0x326319(_0x158b47);});case _0x2578('0x1de'):var _0x36a460=_0x4adf34[_0x2578('0x1dc')]/0x64;return _0x57b360[_0x2578('0x1df')](_0x71c55d,_0x37b374,_0x4ae240,_0x5b1ebe,_0x36a460)[_0x2578('0x3b')](function(_0x37898d){return _0x326319(_0x37898d);});default:return _0x2ab559(msgResponse(_0x2578('0x1e0'),_0x2578('0x8a'),'Unknown\x20Predictive'));}}else{return _0x2ab559(msgResponse(_0x2578('0x1e0'),_0x2578('0x8a'),'check\x20failure'));}});};};Dialer[_0x2578('0x18')][_0x2578('0x1e1')]=function(_0x4dba75){var _0x1c411a=this;return function(_0x18d5fa){return new Promise(function(_0x47b12b,_0x5672d7){_[_0x2578('0xf2')](_0x4dba75,_0x18d5fa[0x0]);if(checkGetDataPredictive(_0x18d5fa[0x0])){loggerPredictive[_0x2578('0x47')](JSON['stringify'](_0x18d5fa[0x0]));if(_0x4dba75[_0x2578('0x1ce')]==='dropRate'){return _0x1c411a['getVoiceQueueRtPauses'](_0x4dba75['id'])[_0x2578('0x3b')](function(_0x344218){var _0x272972=_0x4dba75[_0x2578('0x1e2')]-_0x344218[0x0]['outboundQueuePauses'];var _0x570ed7=_0x4dba75[_0x2578('0x1cd')]*0x3c;var _0xbb0686=_0x18d5fa[0x0][_0x2578('0x53')]+_0x18d5fa[0x0]['predictiveIntervalAvgHoldtime'];var _0x35e511=(_0x18d5fa[0x0]['predictiveIntervalAnsweredCalls']+_0x18d5fa[0x0][_0x2578('0x4e')]+_0x18d5fa[0x0][_0x2578('0xdc')])/_0x18d5fa[0x0]['predictiveIntervalTotalCalls'];var _0xcc11f4=_0x4dba75[_0x2578('0x1dc')]/0x64;_0x4dba75[_0x2578('0x1e3')]=_0x344218[0x0][_0x2578('0x1e4')]||0x0;_0x4dba75[_0x2578('0x1c7')]=_0x35e511>0x0?_0x35e511:0x1;return _0x1c411a['abandonmentRate'](_0x272972,_0x570ed7,_0xbb0686,_0x35e511,_0xcc11f4);})[_0x2578('0x3b')](function(_0x413438){return _0x47b12b(_0x413438);})[_0x2578('0x97')](function(_0x7c3d7a){return _0x5672d7(msgResponse(_0x2578('0x1e5'),_0x2578('0x8a'),JSON[_0x2578('0x6c')](_0x7c3d7a)));});}if(_0x4dba75[_0x2578('0x1ce')]===_0x2578('0x1de')){return _0x1c411a['getVoiceQueueRtPauses'](_0x4dba75['id'])[_0x2578('0x3b')](function(_0x1ebbd5){var _0x1793bf=_0x4dba75[_0x2578('0x1e2')]-_0x1ebbd5[0x0][_0x2578('0x1e4')];var _0x61e255=_0x4dba75[_0x2578('0x1cd')]*0x3c;var _0x43ad90=_0x18d5fa[0x0]['predictiveIntervalAvgTalktime']+_0x18d5fa[0x0]['predictiveIntervalAvgHoldtime'];var _0x185cfb=(_0x18d5fa[0x0]['predictiveIntervalAnsweredCalls']+_0x18d5fa[0x0][_0x2578('0x4e')]+_0x18d5fa[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x18d5fa[0x0]['predictiveIntervalTotalCalls'];var _0xc39888=_0x4dba75[_0x2578('0x1dc')]/0x64;_0x4dba75['predictiveIntervalPauses']=_0x1ebbd5[0x0][_0x2578('0x1e4')]||0x0;_0x4dba75[_0x2578('0x1c7')]=_0x185cfb>0x0?_0x185cfb:0x1;return _0x1c411a['busyFactor'](_0x1793bf,_0x61e255,_0x43ad90,_0x185cfb,_0xc39888);})['then'](function(_0x15c5bd){return _0x47b12b(_0x15c5bd);})[_0x2578('0x97')](function(_0x32965b){return _0x5672d7(msgResponse(_0x2578('0x1e5'),'Failure',JSON[_0x2578('0x6c')](_0x32965b)));});}}else{return _0x5672d7(msgResponse(_0x2578('0x1e0'),_0x2578('0x8a'),'check\x20failure'));}});};};Dialer[_0x2578('0x18')]['startMethodPredictive']=function(_0x3fdc41){var _0x284236=this;return function(){var _0x3c23d8=0x0;var _0x2ae199=Math[_0x2578('0x1c6')](_0x3fdc41[_0x2578('0x1e6')]*0x3e8);if(_0x2ae199>0x0){_0x2ae199=_0x2ae199<0x64?0x64:_0x2ae199;loggerPredictive[_0x2578('0x47')](_0x3fdc41['name'],_0x2578('0x1e7'),_0x2ae199,_0x2578('0x1e8'));_0x3fdc41[_0x2578('0x5d')]=setInterval(function(){_0x284236[_0x2578('0x5d')](_0x3fdc41);loggerPredictiveCalls[_0x2578('0x47')](_0x2578('0x1e9'),_0x3c23d8+=0x1);},_0x2ae199);}else{loggerPredictive[_0x2578('0x47')](_0x3fdc41['name'],_0x2578('0x1ea'));}};};Dialer['prototype']['checkContactBlack']=function(_0x237139,_0x1bd7ba){var _0x538009=this;return function(_0x5d9287){if(_[_0x2578('0x46')](_0x5d9287)){if(_[_0x2578('0xee')](_0x1bd7ba['UserId'])||!_0x1bd7ba[_0x2578('0x1eb')]){if(_0x237139['dialMethod']===_0x2578('0x9')){_0x237139[_0x2578('0x6a')]=_[_0x2578('0x3d')](_0x237139[_0x2578('0x6a')])?!![]:_0x237139[_0x2578('0x6a')];var _0x212b86=uuid['v4']();_0x538009[_0x2578('0x22')][_0x212b86]=new Action(_0x237139,_0x1bd7ba,_0x212b86);loggerBooked[_0x2578('0x47')]('[booked][checkContactBlack]',_0x212b86,_0x2578('0x1ec'),JSON[_0x2578('0x6c')](_0x237139[_0x2578('0x6a')]),_0x2578('0x1ed'),_0x237139[_0x2578('0x44')]);if(_0x237139['queueStatusComplete']){_0x237139[_0x2578('0x6a')]=![];_0x538009[_0x2578('0x29')][_0x538009[_0x2578('0x22')][_0x212b86][_0x2578('0xbb')]]=[];ami[_0x2578('0x90')]({'actionid':_0x212b86,'action':_0x2578('0x1ee'),'queue':_0x237139[_0x2578('0x44')]})[_0x2578('0x97')](function(){utils[_0x2578('0xb7')](_0x237139,_0x2578('0x1ef'));hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x538009[_0x2578('0x22')][_0x212b86][_0x2578('0xfe')],'ListId':_0x538009[_0x2578('0x22')][_0x212b86][_0x2578('0xd4')],'VoiceQueueId':_0x538009['actions'][_0x212b86][_0x2578('0xe5')]||undefined,'CampaignId':_0x538009[_0x2578('0x22')][_0x212b86][_0x2578('0xd5')]||undefined})[_0x2578('0x97')](loggerCatch(_0x2578('0x1f0')));delete _0x538009[_0x2578('0x22')][_0x212b86];});}else{loggerBooked[_0x2578('0x47')](_0x2578('0x1f1'),JSON['stringify'](_0x237139[_0x2578('0x6a')]),_0x2578('0x1ed'),_0x237139[_0x2578('0x44')]);utils[_0x2578('0xb7')](_0x237139,'[checkContactBlack]');hopperUtils[_0x2578('0xd2')]({'active':![],'ContactId':_0x538009[_0x2578('0x22')][_0x212b86][_0x2578('0xfe')],'ListId':_0x538009[_0x2578('0x22')][_0x212b86][_0x2578('0xd4')],'VoiceQueueId':_0x538009[_0x2578('0x22')][_0x212b86][_0x2578('0xe5')]||undefined,'CampaignId':_0x538009['actions'][_0x212b86][_0x2578('0xd5')]||undefined})['catch'](loggerCatch(_0x2578('0x1f0')));delete _0x538009[_0x2578('0x22')][_0x212b86];}}else{return _0x538009['actionOriginate'](_0x237139,_0x1bd7ba);}}else{if(utils[_0x2578('0x1f2')](undefined,_0x1bd7ba['scheduledat'])<_0x237139[_0x2578('0x1f3')]*0x3c){if(_0x1bd7ba[_0x2578('0x14e')]&&!_0x1bd7ba[_0x2578('0x14e')][_0x2578('0x1f4')]){_0x538009['preview']['run'](_0x1bd7ba['id'])[_0x2578('0x1a')](function(){utils[_0x2578('0xb7')](_0x237139,_0x2578('0x1ef'));});}else{hopperUtils[_0x2578('0x1f5')]({'active':![]},_0x1bd7ba['id'],0x1)[_0x2578('0x1a')](function(){utils[_0x2578('0xb7')](_0x237139,_0x2578('0x1ef'));});}}else{_0x237139[_0x2578('0x1f6')]+=0x1;utils[_0x2578('0xb7')](_0x237139,'[checkContactBlack]');if(_0x237139['dialRecallInQueue']){hopperUtils[_0x2578('0xd2')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x1bd7ba[_0x2578('0xfe')],'ListId':_0x1bd7ba[_0x2578('0xd4')],'VoiceQueueId':_0x1bd7ba[_0x2578('0xe5')]||undefined,'CampaignId':_0x1bd7ba[_0x2578('0xd5')]||undefined})[_0x2578('0x97')](loggerCatch(_0x2578('0x1f7')));hopperUtils[_0x2578('0xc0')](createObjHistory(_0x237139,_0x1bd7ba,utils[_0x2578('0x6f')][_0x2578('0x1f8')],0x17,_0x2578('0x1f9')))[_0x2578('0x97')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x538009[_0x2578('0x117')](createObjHistory(_0x237139,_0x1bd7ba,utils[_0x2578('0x6f')][_0x2578('0x1fa')],0x16,_0x2578('0x1fb')),_0x2578('0x1fc'),'[Originate][HistoryRecallClose]');}}}}else{_0x237139[_0x2578('0x1fd')]+=0x1;_0x538009['saveInDb'](createObjHistory(_0x237139,_0x1bd7ba,utils[_0x2578('0x6f')][_0x2578('0x1fe')],0xd,_0x2578('0x1ff')),_0x2578('0x200'),_0x2578('0x201'));throw _0x2578('0x202');}};};Dialer['prototype'][_0x2578('0x162')]=function(_0x18391d){var _0x8033d9=this;var _0x167a93=_0x18391d['limitCalls']-_0x18391d[_0x2578('0x78')];emitCampaignSummary(_0x18391d);if(_0x167a93>0x0&&_0x18391d[_0x2578('0x203')]==0x0){if(_0x167a93>this[_0x2578('0x21')]){_0x167a93=this['maxNumberOriginate'];}_0x18391d[_0x2578('0x203')]=0x1;hopperUtils[_0x2578('0x204')](_0x18391d,_0x167a93)['then'](function(_0x40ec46){_0x18391d[_0x2578('0x203')]=0x0;if(_0x40ec46){if(!utils[_0x2578('0x205')](_0x40ec46)){_0x18391d[_0x2578('0x65')]=utils[_0x2578('0x6f')]['NO_AVAILABLE_CONTACTS'];logger[_0x2578('0x47')](_0x2578('0x206')+_0x18391d['name']);}else{_0x18391d['originated']+=_0x40ec46[_0x2578('0x8e')];_0x18391d[_0x2578('0x65')]=utils[_0x2578('0x6f')][_0x2578('0x207')];for(var _0xac2a22=0x0;_0xac2a22<_0x40ec46[_0x2578('0x8e')];_0xac2a22+=0x1){_0x18391d[_0x2578('0x208')]+=0x1;if(_['isNil'](_0x40ec46[_0xac2a22])||_[_0x2578('0xee')](_0x40ec46[_0xac2a22][_0x2578('0x17c')])||_[_0x2578('0xee')](_0x40ec46[_0xac2a22][_0x2578('0x166')])){_0x8033d9[_0x2578('0x159')](_0x2578('0x209'),_0x18391d,_0x40ec46[_0xac2a22]);}else{hopperUtils[_0x2578('0x20a')](_['pick'](_0x40ec46[_0xac2a22],[_0x2578('0xd5'),_0x2578('0x166')]))[_0x2578('0x3b')](_0x8033d9['checkContactBlack'](_0x18391d,_0x40ec46[_0xac2a22]))[_0x2578('0x97')](function(_0x337f54){logger[_0x2578('0x60')](_0x2578('0x20b'),_0x337f54);utils[_0x2578('0xb7')](_0x18391d,_0x2578('0x20c'));});}}}}})['catch'](function(_0x2ba169){_0x18391d[_0x2578('0x203')]=0x0;logger['error']('[getContactCampaign2]',_0x2ba169);});}};Dialer[_0x2578('0x18')][_0x2578('0xaa')]=function(_0x40f1a0,_0x122274){var _0x24e483=this;var _0x130a0f=[];if(_0x122274<0x1||_0x40f1a0['dialMethod']===_0x2578('0x9')){_0x122274=0x1;}var _0x322237=Math['floor'](_0x40f1a0[_0x2578('0x140')]*_0x122274)-_0x40f1a0[_0x2578('0x78')];if(_0x40f1a0['dialLimitQueue']>0x0){var _0x38f6c9=_0x40f1a0[_0x2578('0x20d')]-_0x40f1a0[_0x2578('0x78')]-_0x40f1a0[_0x2578('0x142')]-_0x40f1a0[_0x2578('0x143')];if(_0x322237>_0x38f6c9){_0x322237=_0x38f6c9;}}if(_0x322237>0x0&&_0x40f1a0[_0x2578('0x203')]==0x0){if(_0x40f1a0[_0x2578('0xa8')]===_0x2578('0x9')){_0x322237=0x1;}if(_0x322237>this[_0x2578('0x21')]){_0x322237=this[_0x2578('0x21')];}for(var _0x33a147 in this[_0x2578('0x1f')]){if(typeof this[_0x2578('0x1f')][_0x33a147]!==_0x2578('0xa2')){if(this['agents'][_0x33a147][_0x2578('0x68')]===_0x2578('0x20e')&&this[_0x2578('0x1f')][_0x33a147][_0x2578('0x80')]===_0x2578('0x81')){_0x130a0f[_0x2578('0x8f')](this['agents'][_0x33a147]['id']);}}}_0x40f1a0[_0x2578('0x203')]=0x1;hopperUtils[_0x2578('0x20f')](_0x40f1a0,_0x130a0f,_0x322237)[_0x2578('0x3b')](function(_0xa82ff9){_0x40f1a0[_0x2578('0x203')]=0x0;if(_0xa82ff9){if(!utils[_0x2578('0x205')](_0xa82ff9)){hopperUtils[_0x2578('0x210')](_0x40f1a0)[_0x2578('0x3b')](sendMessageReschedule(_0x40f1a0))[_0x2578('0x97')](loggerCatch('[countReScheduled]\x20'));}else{_0x40f1a0[_0x2578('0x78')]+=_0xa82ff9[_0x2578('0x8e')];_0x40f1a0[_0x2578('0x65')]=_0x40f1a0[_0x2578('0xa8')]===_0x2578('0x9')?utils[_0x2578('0x6f')][_0x2578('0x16d')]:utils['CAMPAIGN_STATUS']['RUNNING'];for(var _0xb2fefc=0x0;_0xb2fefc<_0xa82ff9[_0x2578('0x8e')];_0xb2fefc+=0x1){if(_[_0x2578('0xee')](_0xa82ff9[_0xb2fefc])||_[_0x2578('0xee')](_0xa82ff9[_0xb2fefc][_0x2578('0x17c')])||_[_0x2578('0xee')](_0xa82ff9[_0xb2fefc][_0x2578('0x166')])){_0x24e483[_0x2578('0x159')](_0x2578('0x209'),_0x40f1a0,_0xa82ff9[_0xb2fefc]);}else{hopperUtils[_0x2578('0x211')](_[_0x2578('0x6d')](_0xa82ff9[_0xb2fefc],['VoiceQueueId',_0x2578('0x166')]))['then'](_0x24e483['checkContactBlack'](_0x40f1a0,_0xa82ff9[_0xb2fefc]))[_0x2578('0x97')](function(_0x3aefa2){logger[_0x2578('0x60')](_0x2578('0x212'),_0x3aefa2);utils[_0x2578('0xb7')](_0x40f1a0,'[handlePower]');});}}}}})[_0x2578('0x97')](function(_0x36fce8){_0x40f1a0['temp']=0x0;logger[_0x2578('0x60')]('[getContactCampaign2]',_0x36fce8);});}};Dialer[_0x2578('0x18')][_0x2578('0x5d')]=function(_0x386468){if(_0x386468[_0x2578('0x20d')]>0x0){var _0x405bdd=_0x386468[_0x2578('0x20d')]-_0x386468['originated']-_0x386468[_0x2578('0x142')];if(_0x405bdd>0x0&&_0x386468['temp']==0x0){this['tryOriginatePredictive'](_0x386468);}else{loggerPredictiveCalls[_0x2578('0x47')](_0x2578('0x213'));}}else{this[_0x2578('0x214')](_0x386468);}};Dialer[_0x2578('0x18')][_0x2578('0x214')]=function(_0x272cab){var _0x51aeb6=this;var _0x5d7515=[];_0x272cab[_0x2578('0x78')]+=0x1;for(var _0x322554 in this[_0x2578('0x1f')]){if(typeof this[_0x2578('0x1f')][_0x322554]!==_0x2578('0xa2')){if(this['agents'][_0x322554][_0x2578('0x68')]===_0x2578('0x20e')&&this[_0x2578('0x1f')][_0x322554][_0x2578('0x80')]===_0x2578('0x81')){_0x5d7515['push'](this[_0x2578('0x1f')][_0x322554]['id']);}}}_0x272cab[_0x2578('0x203')]=0x1;return this[_0x2578('0x20f')](_0x272cab['id'],_0x5d7515,0x1,_0x272cab['dialOrderByScheduledAt'],_0x272cab)[_0x2578('0x3b')](function(_0x3fd71c){_0x272cab[_0x2578('0x203')]=0x1;if(_0x3fd71c){if(!utils[_0x2578('0x205')](_0x3fd71c)){utils[_0x2578('0x215')](_0x272cab,0x1,0x0);return hopperUtils[_0x2578('0x210')](_0x272cab)[_0x2578('0x3b')](sendMessageReschedule(_0x272cab))['catch'](loggerCatch(_0x2578('0x216')));}else{_0x272cab[_0x2578('0x65')]=utils[_0x2578('0x6f')][_0x2578('0x207')];if(_[_0x2578('0xee')](_0x3fd71c[0x0])||_[_0x2578('0xee')](_0x3fd71c[0x0][_0x2578('0x17c')])||_['isNil'](_0x3fd71c[0x0][_0x2578('0x166')])){_0x51aeb6[_0x2578('0x159')](_0x2578('0x209'),_0x272cab,_0x3fd71c[0x0]);}else{return hopperUtils[_0x2578('0x211')](_[_0x2578('0x6d')](_0x3fd71c[0x0],[_0x2578('0xe5'),_0x2578('0x166')]))[_0x2578('0x3b')](_0x51aeb6[_0x2578('0x217')](_0x272cab,_0x3fd71c[0x0]))[_0x2578('0x97')](function(_0x428ea0){logger[_0x2578('0x60')]('[actionOriginatePredictive]',_0x428ea0);utils['decrementOriginate'](_0x272cab,_0x2578('0x218'));});}}}})[_0x2578('0x97')](function(_0x1e932d){_0x272cab[_0x2578('0x203')]=0x0;logger[_0x2578('0x60')](_0x2578('0x219'),_0x1e932d);});};Dialer[_0x2578('0x18')][_0x2578('0x1dd')]=function(_0x544b01,_0x155710,_0x145cfa,_0x55a283,_0x36648d,_0x406cb4){loggerPredictive['info'](_0x2578('0x21a'));loggerPredictive['info'](_0x2578('0x21b'),_0x544b01);loggerPredictive[_0x2578('0x47')](_0x2578('0x21c'),_0x155710);loggerPredictive[_0x2578('0x47')](_0x2578('0x21d'),_0x145cfa);loggerPredictive[_0x2578('0x47')](_0x2578('0x21e'),_0x55a283);loggerPredictive[_0x2578('0x47')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x36648d);loggerPredictive[_0x2578('0x47')](_0x2578('0x54'));return new Promise(function(_0x194adb,_0x661f12){if(_0x544b01<=0x0||isNaN(_0x544b01)){return _0x661f12(msgResponse('[abandonmentRate]',_0x2578('0x7d'),_0x2578('0x21f')+_0x544b01));}if(_0x145cfa<=0x0||isNaN(_0x145cfa)){return _0x661f12(msgResponse(_0x2578('0x220'),'Error',_0x2578('0x221')+_0x145cfa));}if(_0x55a283<=0x0||isNaN(_0x55a283)){return _0x661f12(msgResponse(_0x2578('0x220'),'Error','p\x20=\x20'+_0x55a283));}if(_0x155710<=0x0||isNaN(_0x155710)){return _0x661f12(msgResponse('[abandonmentRate]',_0x2578('0x7d'),_0x2578('0x222')+_0x155710));}if(_0x36648d<=0x0||isNaN(_0x36648d)){return _0x661f12(msgResponse('[abandonmentRate]','Error',_0x2578('0x223')+_0x36648d));}_0x406cb4=_0x406cb4||0x0;var _0x45df5d=0x1/_0x145cfa;var _0x30fa62=0x0;var _0x3eed1c=0x0;var _0x387bf0=0x0;var _0x1db6bf=0x0;for(var _0x1af7c1=0x0;_0x387bf0<_0x36648d;_0x1af7c1+=0x1){_0x3eed1c=_0x1af7c1/_0x155710;_0x30fa62=(_0x55a283*_0x3eed1c+_0x406cb4)/_0x45df5d;_0x387bf0=utils['erlangb'](_0x30fa62,_0x544b01);_0x1db6bf=_0x30fa62/_0x544b01*(0x1-utils[_0x2578('0x224')](_0x30fa62,_0x544b01));}return _0x194adb({'erlangCalls':_0x1af7c1,'erlangCallToSecond':_0x155710/_0x1af7c1,'erlangAbandonmentRate':_0x387bf0,'erlangBusyFactor':_0x1db6bf});});};Dialer[_0x2578('0x18')]['busyFactor']=function(_0x3acc6d,_0x126ccd,_0xf1e5ad,_0x2f081e,_0x444354,_0x3845e8){loggerPredictive[_0x2578('0x47')](_0x2578('0x225'));loggerPredictive[_0x2578('0x47')](_0x2578('0x21b'),_0x3acc6d);loggerPredictive[_0x2578('0x47')](_0x2578('0x21c'),_0x126ccd);loggerPredictive[_0x2578('0x47')]('Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xf1e5ad);loggerPredictive[_0x2578('0x47')](_0x2578('0x21e'),_0x2f081e);loggerPredictive['info'](_0x2578('0x226'),_0x444354);loggerPredictive[_0x2578('0x47')]('---------------------------');return new Promise(function(_0x316a5f,_0xa361fe){if(_0x3acc6d<=0x0||isNaN(_0x3acc6d)){return _0xa361fe(msgResponse(_0x2578('0x227'),_0x2578('0x7d'),_0x2578('0x21f')+_0x3acc6d));}if(_0xf1e5ad<=0x0||isNaN(_0xf1e5ad)){return _0xa361fe(msgResponse('[busyFactor]',_0x2578('0x7d'),_0x2578('0x221')+_0xf1e5ad));}if(_0x2f081e<=0x0||isNaN(_0x2f081e)){return _0xa361fe(msgResponse('[busyFactor]','Error',_0x2578('0x228')+_0x2f081e));}if(_0x126ccd<=0x0||isNaN(_0x126ccd)){return _0xa361fe(msgResponse(_0x2578('0x227'),_0x2578('0x7d'),'interval\x20=\x20'+_0x126ccd));}if(_0x444354<=0x0||isNaN(_0x444354)){return _0xa361fe(msgResponse(_0x2578('0x227'),'Error',_0x2578('0x229')+_0x444354));}_0x3845e8=_0x3845e8||0x0;var _0x11b62c=0x1/_0xf1e5ad;var _0x373aa4=0x0;var _0x2d6b1e=0x0;var _0x3c99f9=0x0;var _0x32fa17=0x0;for(var _0x32a47f=0x0;_0x32fa17<_0x444354;_0x32a47f+=0x1){_0x2d6b1e=_0x32a47f/_0x126ccd;_0x373aa4=(_0x2f081e*_0x2d6b1e+_0x3845e8)/_0x11b62c;_0x3c99f9=utils[_0x2578('0x224')](_0x373aa4,_0x3acc6d);_0x32fa17=_0x373aa4/_0x3acc6d*(0x1-utils['erlangb'](_0x373aa4,_0x3acc6d));}return _0x316a5f({'erlangCalls':_0x32a47f,'erlangCallToSecond':_0x126ccd/_0x32a47f,'erlangAbandonmentRate':_0x3c99f9,'erlangBusyFactor':_0x32fa17});});};module['exports']=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/models/action.js b/server/services/ami/dialer/models/action.js index 6e9b617..0a94103 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 _0x4069=['CampaignId','idHopper','ContactFirstName','starttime','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','prototype','getCaller','format','dialCutDigit','substring','getQueue','exports','util','lodash','isNil','string','voiceQueue','name','Contact','phone','firstName','lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x13b7fd,_0x4eaf7f){var _0x32a74a=function(_0x2c5d80){while(--_0x2c5d80){_0x13b7fd['push'](_0x13b7fd['shift']());}};_0x32a74a(++_0x4eaf7f);}(_0x4069,0x6b));var _0x9406=function(_0x5a8303,_0x3da7fe){_0x5a8303=_0x5a8303-0x0;var _0x3d301d=_0x4069[_0x5a8303];return _0x3d301d;};'use strict';var util=require(_0x9406('0x0'));var _=require(_0x9406('0x1'));var moment=require('moment');function checkNameSurname(_0x2ae93d,_0x1d1dc6,_0x1407c2){var _0x20f382='';if(!_[_0x9406('0x2')](_0x1d1dc6)&&_0x9406('0x3')===typeof _0x1d1dc6){_0x20f382+=_0x1d1dc6;}if(!_[_0x9406('0x2')](_0x1407c2)&&_0x9406('0x3')===typeof _0x1407c2){_0x20f382+='\x20'+_0x1407c2;}if(_0x20f382!==''){return _0x20f382;}return _0x2ae93d;}function Action(_0x1d30ce,_0x5c4683,_0x1c12e4){this[_0x9406('0x4')]=_0x1d30ce;this['uniqueid']=_0x1c12e4||undefined;this[_0x9406('0x5')]=checkNameSurname(_0x5c4683[_0x9406('0x6')][_0x9406('0x7')],_0x5c4683[_0x9406('0x6')][_0x9406('0x8')],_0x5c4683['Contact'][_0x9406('0x9')]);this[_0x9406('0xa')]=_0x5c4683[_0x9406('0x7')];this[_0x9406('0xb')]=_0x1d30ce[_0x9406('0x5')];this[_0x9406('0xc')]=_0x5c4683[_0x9406('0xc')]||![];this[_0x9406('0xd')]=_0x1d30ce[_0x9406('0xd')];this[_0x9406('0xe')]=_0x1d30ce[_0x9406('0xe')]||0x3;this[_0x9406('0xf')]=_0x5c4683[_0x9406('0xf')];this[_0x9406('0x10')]=_0x5c4683['countbusyretry'];this[_0x9406('0x11')]=_0x5c4683[_0x9406('0x11')];this[_0x9406('0x12')]=_0x5c4683[_0x9406('0x12')];this[_0x9406('0x13')]=_0x5c4683[_0x9406('0x13')];this[_0x9406('0x14')]=_0x5c4683[_0x9406('0x14')];this['countabandonedretry']=_0x5c4683[_0x9406('0x15')];this[_0x9406('0x16')]=_0x5c4683[_0x9406('0x16')];this[_0x9406('0x17')]=_0x5c4683[_0x9406('0x17')];this[_0x9406('0x18')]=_0x5c4683[_0x9406('0x18')];this['ListId']=_0x5c4683[_0x9406('0x19')];this['UserId']=_0x5c4683[_0x9406('0x1a')];this['VoiceQueueId']=_0x5c4683[_0x9406('0x1b')];this[_0x9406('0x1c')]=_0x5c4683[_0x9406('0x1c')];this[_0x9406('0x1d')]=_0x5c4683['id'];this[_0x9406('0x1e')]=_0x5c4683[_0x9406('0x6')][_0x9406('0x8')]||'';this[_0x9406('0x1f')]=moment()['format'](_0x9406('0x20'));this['callback']=_0x5c4683[_0x9406('0x21')];this['callbackuniqueid']=_0x5c4683[_0x9406('0x22')];this[_0x9406('0x23')]=_0x5c4683[_0x9406('0x23')];this[_0x9406('0x24')]=_0x5c4683['recallme'];this[_0x9406('0x25')]='';this['originatecalleridname']='';}Action[_0x9406('0x26')][_0x9406('0x27')]=function(){return util[_0x9406('0x28')]('\x22%s\x22\x20<%s>',this[_0x9406('0x5')],this['voiceQueue'][_0x9406('0x29')]>0x0?this[_0x9406('0xa')][_0x9406('0x2a')](this[_0x9406('0x4')][_0x9406('0x29')]):this[_0x9406('0xa')]);};Action[_0x9406('0x26')][_0x9406('0x2b')]=function(){return this['queue'];};module[_0x9406('0x2c')]=Action; \ No newline at end of file +var _0xc423=['callbackuniqueid','callbackat','recallme','originatecalleridnum','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','getQueue','exports','util','lodash','moment','isNil','string','voiceQueue','uniqueid','name','Contact','phone','firstName','lastName','number','queue','active','type','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback'];(function(_0x5083cc,_0xcd1903){var _0x27e884=function(_0x14045d){while(--_0x14045d){_0x5083cc['push'](_0x5083cc['shift']());}};_0x27e884(++_0xcd1903);}(_0xc423,0x14d));var _0x3c42=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xc423[_0x27af45];return _0x18df21;};'use strict';var util=require(_0x3c42('0x0'));var _=require(_0x3c42('0x1'));var moment=require(_0x3c42('0x2'));function checkNameSurname(_0x44f194,_0x474838,_0x4eddc2){var _0x4f9eab='';if(!_[_0x3c42('0x3')](_0x474838)&&_0x3c42('0x4')===typeof _0x474838){_0x4f9eab+=_0x474838;}if(!_[_0x3c42('0x3')](_0x4eddc2)&&_0x3c42('0x4')===typeof _0x4eddc2){_0x4f9eab+='\x20'+_0x4eddc2;}if(_0x4f9eab!==''){return _0x4f9eab;}return _0x44f194;}function Action(_0x19da08,_0x531351,_0x33a5a8){this[_0x3c42('0x5')]=_0x19da08;this[_0x3c42('0x6')]=_0x33a5a8||undefined;this[_0x3c42('0x7')]=checkNameSurname(_0x531351[_0x3c42('0x8')][_0x3c42('0x9')],_0x531351[_0x3c42('0x8')][_0x3c42('0xa')],_0x531351[_0x3c42('0x8')][_0x3c42('0xb')]);this[_0x3c42('0xc')]=_0x531351[_0x3c42('0x9')];this[_0x3c42('0xd')]=_0x19da08[_0x3c42('0x7')];this['active']=_0x531351[_0x3c42('0xe')]||![];this[_0x3c42('0xf')]=_0x19da08['type'];this['dialQueueTimeout']=_0x19da08['dialQueueTimeout']||0x3;this['scheduledat']=_0x531351['scheduledat'];this[_0x3c42('0x10')]=_0x531351[_0x3c42('0x10')];this[_0x3c42('0x11')]=_0x531351[_0x3c42('0x11')];this[_0x3c42('0x12')]=_0x531351[_0x3c42('0x12')];this['countnosuchnumberretry']=_0x531351[_0x3c42('0x13')];this['countdropretry']=_0x531351[_0x3c42('0x14')];this[_0x3c42('0x15')]=_0x531351[_0x3c42('0x15')];this[_0x3c42('0x16')]=_0x531351[_0x3c42('0x16')];this[_0x3c42('0x17')]=_0x531351['countagentrejectretry'];this[_0x3c42('0x18')]=_0x531351[_0x3c42('0x18')];this[_0x3c42('0x19')]=_0x531351[_0x3c42('0x19')];this[_0x3c42('0x1a')]=_0x531351[_0x3c42('0x1a')];this[_0x3c42('0x1b')]=_0x531351['VoiceQueueId'];this[_0x3c42('0x1c')]=_0x531351[_0x3c42('0x1c')];this[_0x3c42('0x1d')]=_0x531351['id'];this[_0x3c42('0x1e')]=_0x531351[_0x3c42('0x8')][_0x3c42('0xa')]||'';this[_0x3c42('0x1f')]=moment()[_0x3c42('0x20')](_0x3c42('0x21'));this[_0x3c42('0x22')]=_0x531351['callback'];this['callbackuniqueid']=_0x531351[_0x3c42('0x23')];this[_0x3c42('0x24')]=_0x531351[_0x3c42('0x24')];this['recallme']=_0x531351[_0x3c42('0x25')];this[_0x3c42('0x26')]='';this['originatecalleridname']='';}Action[_0x3c42('0x27')][_0x3c42('0x28')]=function(){return util[_0x3c42('0x20')](_0x3c42('0x29'),this['name'],this[_0x3c42('0x5')][_0x3c42('0x2a')]>0x0?this['number'][_0x3c42('0x2b')](this[_0x3c42('0x5')][_0x3c42('0x2a')]):this[_0x3c42('0xc')]);};Action[_0x3c42('0x27')][_0x3c42('0x2c')]=function(){return this['queue'];};module[_0x3c42('0x2d')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/models/agentComplete.js b/server/services/ami/dialer/models/agentComplete.js index e6e037f..3aa3543 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 _0x327b=['countagentrejectretry','countdropretry','countmachineretry','uniqueid','calleridname','number','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','originatecalleridnum','originatecalleridname','agiafterat','moment','../utils','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countabandonedretry'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x327b,0x18e));var _0xb327=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0x327b[_0x4ff09b];return _0x3f5c2e;};'use strict';var moment=require(_0xb327('0x0'));var utils=require(_0xb327('0x1'));function AgentComplete(_0x150d5b,_0x4f4049){this[_0xb327('0x2')]=0x4;this[_0xb327('0x3')]=_0xb327('0x4');this[_0xb327('0x5')]=_0x150d5b[_0xb327('0x5')];this[_0xb327('0x6')]=_0x150d5b[_0xb327('0x6')];this[_0xb327('0x7')]=_0x150d5b[_0xb327('0x6')]===_0xb327('0x8')?_0xb327('0x9'):_0x150d5b['type'];this['countbusyretry']=_0x150d5b['countbusyretry'];this[_0xb327('0xa')]=_0x150d5b[_0xb327('0xa')];this[_0xb327('0xb')]=_0x150d5b[_0xb327('0xb')];this[_0xb327('0xc')]=_0x150d5b[_0xb327('0xd')]+_0x150d5b['countcongestionretry']+_0x150d5b[_0xb327('0xb')]+_0x150d5b[_0xb327('0xe')]+_0x150d5b['countdropretry']+_0x150d5b[_0xb327('0xf')]+_0x150d5b['countmachineretry']+_0x150d5b[_0xb327('0x10')];this[_0xb327('0xe')]=_0x150d5b['countnosuchnumberretry'];this[_0xb327('0x11')]=_0x150d5b[_0xb327('0x11')];this[_0xb327('0xf')]=_0x150d5b['countabandonedretry'];this[_0xb327('0x12')]=_0x150d5b[_0xb327('0x12')];this['countagentrejectretry']=_0x150d5b[_0xb327('0x10')];this[_0xb327('0x13')]=_0x4f4049[_0xb327('0x13')];this[_0xb327('0x14')]=_0x150d5b['name'];this['calleridnum']=_0x150d5b[_0xb327('0x15')];this[_0xb327('0x16')]=_0x150d5b[_0xb327('0x16')];this[_0xb327('0x17')]=_0x150d5b[_0xb327('0x17')];this[_0xb327('0x18')]=_0x150d5b['answertime'];this[_0xb327('0x19')]=moment()[_0xb327('0x1a')](_0xb327('0x1b'));this[_0xb327('0x1c')]=utils[_0xb327('0x1d')](_0x150d5b['responsetime'],_0x150d5b[_0xb327('0x16')]);this[_0xb327('0x1e')]=utils[_0xb327('0x1d')](_0x150d5b[_0xb327('0x18')],_0x150d5b[_0xb327('0x17')]);this[_0xb327('0x1f')]=utils[_0xb327('0x1d')](this['endtime'],_0x150d5b[_0xb327('0x18')]);this[_0xb327('0x9')]=_0x4f4049[_0xb327('0x9')];this[_0xb327('0x20')]=_0x4f4049[_0xb327('0x20')];this[_0xb327('0x21')]=_0x4f4049[_0xb327('0x21')];this[_0xb327('0x22')]=_0x150d5b[_0xb327('0x22')];this[_0xb327('0x23')]=_0x150d5b[_0xb327('0x23')];this[_0xb327('0x24')]=_0x150d5b[_0xb327('0x24')];this[_0xb327('0x25')]=_0x150d5b[_0xb327('0x25')];this[_0xb327('0x26')]=_0x150d5b[_0xb327('0x26')];this[_0xb327('0x27')]=_0x150d5b[_0xb327('0x27')];this[_0xb327('0x28')]=_0x150d5b[_0xb327('0x28')];this[_0xb327('0x29')]=_0x150d5b[_0xb327('0x29')];this[_0xb327('0x2a')]=_0x150d5b[_0xb327('0x2a')];this['originatecalleridnum']=_0x150d5b[_0xb327('0x2b')]||'';this[_0xb327('0x2c')]=_0x150d5b['originatecalleridname']||'';this[_0xb327('0x2d')]=_0x150d5b[_0xb327('0x2d')];}module['exports']=AgentComplete; \ No newline at end of file +var _0x29d0=['starttime','responsetime','answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','../utils','state','statedesc','scheduledat','type','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countmachineretry','uniqueid','calleridname','name','number'];(function(_0x211632,_0x378e2e){var _0x5a1da1=function(_0x44aff2){while(--_0x44aff2){_0x211632['push'](_0x211632['shift']());}};_0x5a1da1(++_0x378e2e);}(_0x29d0,0x19b));var _0x029d=function(_0x4bf0e5,_0x1262b5){_0x4bf0e5=_0x4bf0e5-0x0;var _0x5af375=_0x29d0[_0x4bf0e5];return _0x5af375;};'use strict';var moment=require('moment');var utils=require(_0x029d('0x0'));function AgentComplete(_0x46cd2c,_0x69818a){this[_0x029d('0x1')]=0x4;this[_0x029d('0x2')]='Answer';this[_0x029d('0x3')]=_0x46cd2c[_0x029d('0x3')];this[_0x029d('0x4')]=_0x46cd2c[_0x029d('0x4')];this['campaigntype']=_0x46cd2c[_0x029d('0x4')]==='outbound'?_0x029d('0x5'):_0x46cd2c[_0x029d('0x4')];this[_0x029d('0x6')]=_0x46cd2c[_0x029d('0x6')];this['countcongestionretry']=_0x46cd2c[_0x029d('0x7')];this[_0x029d('0x8')]=_0x46cd2c[_0x029d('0x8')];this[_0x029d('0x9')]=_0x46cd2c[_0x029d('0x6')]+_0x46cd2c[_0x029d('0x7')]+_0x46cd2c[_0x029d('0x8')]+_0x46cd2c['countnosuchnumberretry']+_0x46cd2c[_0x029d('0xa')]+_0x46cd2c[_0x029d('0xb')]+_0x46cd2c['countmachineretry']+_0x46cd2c[_0x029d('0xc')];this[_0x029d('0xd')]=_0x46cd2c[_0x029d('0xd')];this['countdropretry']=_0x46cd2c[_0x029d('0xa')];this[_0x029d('0xb')]=_0x46cd2c[_0x029d('0xb')];this[_0x029d('0xe')]=_0x46cd2c[_0x029d('0xe')];this[_0x029d('0xc')]=_0x46cd2c[_0x029d('0xc')];this[_0x029d('0xf')]=_0x69818a[_0x029d('0xf')];this[_0x029d('0x10')]=_0x46cd2c[_0x029d('0x11')];this['calleridnum']=_0x46cd2c[_0x029d('0x12')];this['starttime']=_0x46cd2c[_0x029d('0x13')];this[_0x029d('0x14')]=_0x46cd2c[_0x029d('0x14')];this[_0x029d('0x15')]=_0x46cd2c[_0x029d('0x15')];this[_0x029d('0x16')]=moment()['format'](_0x029d('0x17'));this[_0x029d('0x18')]=utils[_0x029d('0x19')](_0x46cd2c['responsetime'],_0x46cd2c[_0x029d('0x13')]);this[_0x029d('0x1a')]=utils['getSeconds'](_0x46cd2c[_0x029d('0x15')],_0x46cd2c['responsetime']);this[_0x029d('0x1b')]=utils[_0x029d('0x19')](this[_0x029d('0x16')],_0x46cd2c[_0x029d('0x15')]);this[_0x029d('0x5')]=_0x69818a[_0x029d('0x5')];this[_0x029d('0x1c')]=_0x69818a[_0x029d('0x1c')];this['reason']=_0x69818a[_0x029d('0x1d')];this[_0x029d('0x1e')]=_0x46cd2c['callback'];this['callbackuniqueid']=_0x46cd2c[_0x029d('0x1f')];this[_0x029d('0x20')]=_0x46cd2c[_0x029d('0x20')];this['recallme']=_0x46cd2c[_0x029d('0x21')];this[_0x029d('0x22')]=_0x46cd2c[_0x029d('0x22')];this['ListId']=_0x46cd2c[_0x029d('0x23')];this[_0x029d('0x24')]=_0x46cd2c[_0x029d('0x24')];this['VoiceQueueId']=_0x46cd2c[_0x029d('0x25')];this['CampaignId']=_0x46cd2c[_0x029d('0x26')];this[_0x029d('0x27')]=_0x46cd2c['originatecalleridnum']||'';this[_0x029d('0x28')]=_0x46cd2c[_0x029d('0x28')]||'';this[_0x029d('0x29')]=_0x46cd2c[_0x029d('0x29')];}module[_0x029d('0x2a')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/models/final.js b/server/services/ami/dialer/models/final.js index fa665f4..1991e38 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 _0x9756=['callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','queue','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countabandonedretry','countdropretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime'];(function(_0xe02fb7,_0x3554ec){var _0x41e00a=function(_0x1feece){while(--_0x1feece){_0xe02fb7['push'](_0xe02fb7['shift']());}};_0x41e00a(++_0x3554ec);}(_0x9756,0x15b));var _0x6975=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0x9756[_0x2112d4];return _0x434972;};'use strict';function Final(_0x5deabc){this[_0x6975('0x0')]=_0x5deabc[_0x6975('0x0')];this['scheduledat']=_0x5deabc[_0x6975('0x1')];this[_0x6975('0x2')]=_0x5deabc[_0x6975('0x2')];this[_0x6975('0x3')]=_0x5deabc['type']===_0x6975('0x4')?_0x6975('0x5'):_0x5deabc[_0x6975('0x2')];this['countbusyretry']=_0x5deabc['countbusyretry'];this[_0x6975('0x6')]=_0x5deabc[_0x6975('0x6')];this[_0x6975('0x7')]=_0x5deabc[_0x6975('0x7')];this[_0x6975('0x8')]=_0x5deabc[_0x6975('0x9')]+_0x5deabc[_0x6975('0x6')]+_0x5deabc[_0x6975('0x7')]+_0x5deabc[_0x6975('0xa')]+_0x5deabc['countdropretry']+_0x5deabc[_0x6975('0xb')]+_0x5deabc['countmachineretry']+_0x5deabc['countagentrejectretry'];this[_0x6975('0xa')]=_0x5deabc['countnosuchnumberretry'];this['countdropretry']=_0x5deabc[_0x6975('0xc')];this[_0x6975('0xb')]=_0x5deabc[_0x6975('0xb')];this[_0x6975('0xd')]=_0x5deabc[_0x6975('0xd')];this[_0x6975('0xe')]=_0x5deabc[_0x6975('0xe')];this[_0x6975('0x5')]=_0x5deabc[_0x6975('0x5')];this['calleridname']=_0x5deabc[_0x6975('0xf')];this[_0x6975('0x10')]=_0x5deabc['calleridnum'];this[_0x6975('0x11')]=_0x5deabc[_0x6975('0x11')];this[_0x6975('0x12')]=_0x5deabc[_0x6975('0x12')];this[_0x6975('0x13')]=_0x5deabc[_0x6975('0x12')];this[_0x6975('0x14')]=_0x5deabc[_0x6975('0x14')]||0x0;this[_0x6975('0x15')]=_0x5deabc[_0x6975('0x15')]||0x0;this['talktime']=_0x5deabc[_0x6975('0x16')]||0x0;this[_0x6975('0x17')]=_0x5deabc[_0x6975('0x17')];this[_0x6975('0x18')]=_0x5deabc[_0x6975('0x18')];this[_0x6975('0x19')]=_0x5deabc[_0x6975('0x19')];this[_0x6975('0x1a')]=_0x5deabc[_0x6975('0x1a')];this[_0x6975('0x1b')]=_0x5deabc[_0x6975('0x1b')];this[_0x6975('0x1c')]=_0x5deabc[_0x6975('0x1c')];this[_0x6975('0x1d')]=_0x5deabc[_0x6975('0x1d')];this[_0x6975('0x1e')]=_0x5deabc['VoiceQueueId'];this[_0x6975('0x1f')]=_0x5deabc[_0x6975('0x1f')];this['originatecalleridnum']=_0x5deabc[_0x6975('0x20')]||'';this[_0x6975('0x21')]=_0x5deabc[_0x6975('0x21')]||'';this['state']=_0x5deabc[_0x6975('0x22')];this[_0x6975('0x23')]=_0x5deabc[_0x6975('0x23')];}module[_0x6975('0x24')]=Final; \ No newline at end of file +var _0x3e65=['ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime'];(function(_0x5f5576,_0x2f54ed){var _0xf250d0=function(_0x125497){while(--_0x125497){_0x5f5576['push'](_0x5f5576['shift']());}};_0xf250d0(++_0x2f54ed);}(_0x3e65,0x183));var _0x53e6=function(_0x47fc43,_0x4e76ae){_0x47fc43=_0x47fc43-0x0;var _0x3ed408=_0x3e65[_0x47fc43];return _0x3ed408;};'use strict';function Final(_0x5c2037){this['uniqueid']=_0x5c2037[_0x53e6('0x0')];this['scheduledat']=_0x5c2037[_0x53e6('0x1')];this[_0x53e6('0x2')]=_0x5c2037[_0x53e6('0x2')];this[_0x53e6('0x3')]=_0x5c2037[_0x53e6('0x2')]===_0x53e6('0x4')?_0x53e6('0x5'):_0x5c2037['type'];this['countbusyretry']=_0x5c2037[_0x53e6('0x6')];this[_0x53e6('0x7')]=_0x5c2037[_0x53e6('0x7')];this[_0x53e6('0x8')]=_0x5c2037[_0x53e6('0x8')];this[_0x53e6('0x9')]=_0x5c2037[_0x53e6('0x6')]+_0x5c2037['countcongestionretry']+_0x5c2037[_0x53e6('0x8')]+_0x5c2037[_0x53e6('0xa')]+_0x5c2037[_0x53e6('0xb')]+_0x5c2037[_0x53e6('0xc')]+_0x5c2037[_0x53e6('0xd')]+_0x5c2037[_0x53e6('0xe')];this[_0x53e6('0xa')]=_0x5c2037[_0x53e6('0xa')];this[_0x53e6('0xb')]=_0x5c2037[_0x53e6('0xb')];this[_0x53e6('0xc')]=_0x5c2037['countabandonedretry'];this['countmachineretry']=_0x5c2037[_0x53e6('0xd')];this[_0x53e6('0xe')]=_0x5c2037[_0x53e6('0xe')];this[_0x53e6('0x5')]=_0x5c2037[_0x53e6('0x5')];this[_0x53e6('0xf')]=_0x5c2037['calleridname'];this[_0x53e6('0x10')]=_0x5c2037[_0x53e6('0x10')];this[_0x53e6('0x11')]=_0x5c2037['starttime'];this[_0x53e6('0x12')]=_0x5c2037[_0x53e6('0x12')];this[_0x53e6('0x13')]=_0x5c2037[_0x53e6('0x12')];this['ringtime']=_0x5c2037[_0x53e6('0x14')]||0x0;this[_0x53e6('0x15')]=_0x5c2037[_0x53e6('0x15')]||0x0;this[_0x53e6('0x16')]=_0x5c2037[_0x53e6('0x16')]||0x0;this[_0x53e6('0x17')]=_0x5c2037[_0x53e6('0x17')];this[_0x53e6('0x18')]=_0x5c2037[_0x53e6('0x18')];this[_0x53e6('0x19')]=_0x5c2037['callbackat'];this[_0x53e6('0x1a')]=_0x5c2037[_0x53e6('0x1a')];this[_0x53e6('0x1b')]=_0x5c2037[_0x53e6('0x1b')];this[_0x53e6('0x1c')]=_0x5c2037[_0x53e6('0x1c')];this[_0x53e6('0x1d')]=_0x5c2037[_0x53e6('0x1d')];this[_0x53e6('0x1e')]=_0x5c2037[_0x53e6('0x1e')];this[_0x53e6('0x1f')]=_0x5c2037[_0x53e6('0x1f')];this[_0x53e6('0x20')]=_0x5c2037[_0x53e6('0x20')]||'';this[_0x53e6('0x21')]=_0x5c2037[_0x53e6('0x21')]||'';this['state']=_0x5c2037[_0x53e6('0x22')];this[_0x53e6('0x23')]=_0x5c2037[_0x53e6('0x23')];}module[_0x53e6('0x24')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/models/hangup.js b/server/services/ami/dialer/models/hangup.js index 4625536..1a7f110 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 _0xc1b6=['countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','uniqueid','name','starttime','format','ringtime','getSeconds','holdtime','talktime','endtime','responsetime','membername','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','moment','../utils','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','amd'];(function(_0x5519a9,_0x1c5147){var _0x32f2cc=function(_0x52ed58){while(--_0x52ed58){_0x5519a9['push'](_0x5519a9['shift']());}};_0x32f2cc(++_0x1c5147);}(_0xc1b6,0x1ce));var _0x6c1b=function(_0x454ea9,_0x4f9868){_0x454ea9=_0x454ea9-0x0;var _0x5dbe48=_0xc1b6[_0x454ea9];return _0x5dbe48;};'use strict';var moment=require(_0x6c1b('0x0'));var utils=require(_0x6c1b('0x1'));function Hangup(_0xf01beb,_0x51e7df){this[_0x6c1b('0x2')]=0x4;this[_0x6c1b('0x3')]=_0x6c1b('0x4');this[_0x6c1b('0x5')]=_0xf01beb[_0x6c1b('0x5')];this[_0x6c1b('0x6')]=_0xf01beb[_0x6c1b('0x6')];this[_0x6c1b('0x7')]=_0xf01beb[_0x6c1b('0x6')]===_0x6c1b('0x8')?_0x6c1b('0x9'):_0xf01beb['type'];this[_0x6c1b('0xa')]=_0xf01beb[_0x6c1b('0xa')]||![];this['countbusyretry']=_0xf01beb[_0x6c1b('0xb')];this[_0x6c1b('0xc')]=_0xf01beb[_0x6c1b('0xc')];this['countnoanswerretry']=_0xf01beb[_0x6c1b('0xd')];this[_0x6c1b('0xe')]=_0xf01beb[_0x6c1b('0xb')]+_0xf01beb[_0x6c1b('0xc')]+_0xf01beb[_0x6c1b('0xd')]+_0xf01beb['countnosuchnumberretry']+_0xf01beb['countdropretry']+_0xf01beb[_0x6c1b('0xf')]+_0xf01beb[_0x6c1b('0x10')]+_0xf01beb[_0x6c1b('0x11')];this['countnosuchnumberretry']=_0xf01beb[_0x6c1b('0x12')];this['countdropretry']=_0xf01beb[_0x6c1b('0x13')];this[_0x6c1b('0xf')]=_0xf01beb[_0x6c1b('0xf')];this[_0x6c1b('0x10')]=_0xf01beb['countmachineretry'];this['countagentrejectretry']=_0xf01beb[_0x6c1b('0x11')];this[_0x6c1b('0x14')]=_0x51e7df[_0x6c1b('0x14')];this['calleridname']=_0xf01beb[_0x6c1b('0x15')];this['calleridnum']=_0xf01beb['number'];this[_0x6c1b('0x16')]=_0xf01beb[_0x6c1b('0x16')];this['responsetime']=_0xf01beb['responsetime'];this['endtime']=moment()[_0x6c1b('0x17')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x6c1b('0x18')]=utils[_0x6c1b('0x19')](_0xf01beb['responsetime'],_0xf01beb['starttime']);this[_0x6c1b('0x1a')]=0x0;this[_0x6c1b('0x1b')]=utils[_0x6c1b('0x19')](this[_0x6c1b('0x1c')],_0xf01beb[_0x6c1b('0x1d')]);this[_0x6c1b('0x9')]=_0xf01beb['queue'];this[_0x6c1b('0x1e')]='IVR';this[_0x6c1b('0x1f')]=_0x51e7df[_0x6c1b('0x20')];this['callback']=_0xf01beb[_0x6c1b('0x21')];this[_0x6c1b('0x22')]=_0xf01beb['callbackuniqueid'];this['callbackat']=_0xf01beb[_0x6c1b('0x23')];this['recallme']=_0xf01beb[_0x6c1b('0x24')];this[_0x6c1b('0x25')]=_0xf01beb[_0x6c1b('0x25')];this[_0x6c1b('0x26')]=_0xf01beb[_0x6c1b('0x26')];this[_0x6c1b('0x27')]=_0xf01beb[_0x6c1b('0x27')];this[_0x6c1b('0x28')]=_0xf01beb['VoiceQueueId'];this[_0x6c1b('0x29')]=_0xf01beb[_0x6c1b('0x29')];}module[_0x6c1b('0x2a')]=Hangup; \ No newline at end of file +var _0xe243=['callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','../utils','state','Answer','scheduledat','type','campaigntype','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','countmachineretry','uniqueid','name','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','talktime','membername','cause-txt','callback'];(function(_0x3d8c8b,_0x3acaae){var _0x5923ff=function(_0x292b51){while(--_0x292b51){_0x3d8c8b['push'](_0x3d8c8b['shift']());}};_0x5923ff(++_0x3acaae);}(_0xe243,0x1e7));var _0x3e24=function(_0x7d8e66,_0x599dbd){_0x7d8e66=_0x7d8e66-0x0;var _0x190e52=_0xe243[_0x7d8e66];return _0x190e52;};'use strict';var moment=require('moment');var utils=require(_0x3e24('0x0'));function Hangup(_0x44724d,_0x4e9c9f){this[_0x3e24('0x1')]=0x4;this['statedesc']=_0x3e24('0x2');this[_0x3e24('0x3')]=_0x44724d[_0x3e24('0x3')];this[_0x3e24('0x4')]=_0x44724d['type'];this[_0x3e24('0x5')]=_0x44724d['type']===_0x3e24('0x6')?_0x3e24('0x7'):_0x44724d[_0x3e24('0x4')];this['amd']=_0x44724d[_0x3e24('0x8')]||![];this['countbusyretry']=_0x44724d[_0x3e24('0x9')];this[_0x3e24('0xa')]=_0x44724d[_0x3e24('0xa')];this[_0x3e24('0xb')]=_0x44724d[_0x3e24('0xb')];this[_0x3e24('0xc')]=_0x44724d[_0x3e24('0x9')]+_0x44724d[_0x3e24('0xa')]+_0x44724d[_0x3e24('0xb')]+_0x44724d[_0x3e24('0xd')]+_0x44724d[_0x3e24('0xe')]+_0x44724d['countabandonedretry']+_0x44724d['countmachineretry']+_0x44724d[_0x3e24('0xf')];this[_0x3e24('0xd')]=_0x44724d[_0x3e24('0xd')];this[_0x3e24('0xe')]=_0x44724d[_0x3e24('0xe')];this[_0x3e24('0x10')]=_0x44724d[_0x3e24('0x10')];this[_0x3e24('0x11')]=_0x44724d[_0x3e24('0x11')];this[_0x3e24('0xf')]=_0x44724d['countagentrejectretry'];this['uniqueid']=_0x4e9c9f[_0x3e24('0x12')];this['calleridname']=_0x44724d[_0x3e24('0x13')];this[_0x3e24('0x14')]=_0x44724d[_0x3e24('0x15')];this[_0x3e24('0x16')]=_0x44724d['starttime'];this[_0x3e24('0x17')]=_0x44724d[_0x3e24('0x17')];this[_0x3e24('0x18')]=moment()[_0x3e24('0x19')](_0x3e24('0x1a'));this[_0x3e24('0x1b')]=utils[_0x3e24('0x1c')](_0x44724d[_0x3e24('0x17')],_0x44724d[_0x3e24('0x16')]);this['holdtime']=0x0;this[_0x3e24('0x1d')]=utils[_0x3e24('0x1c')](this[_0x3e24('0x18')],_0x44724d[_0x3e24('0x17')]);this[_0x3e24('0x7')]=_0x44724d[_0x3e24('0x7')];this[_0x3e24('0x1e')]='IVR';this['reason']=_0x4e9c9f[_0x3e24('0x1f')];this[_0x3e24('0x20')]=_0x44724d[_0x3e24('0x20')];this[_0x3e24('0x21')]=_0x44724d[_0x3e24('0x21')];this[_0x3e24('0x22')]=_0x44724d[_0x3e24('0x22')];this['recallme']=_0x44724d[_0x3e24('0x23')];this['ContactId']=_0x44724d[_0x3e24('0x24')];this['ListId']=_0x44724d['ListId'];this['UserId']=_0x44724d[_0x3e24('0x25')];this[_0x3e24('0x26')]=_0x44724d[_0x3e24('0x26')];this['CampaignId']=_0x44724d[_0x3e24('0x27')];}module['exports']=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/models/history.js b/server/services/ami/dialer/models/history.js index d76ed5a..bd1b1f6 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 _0x38ca=['callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','../utils','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countagentrejectretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','name','calleridnum','starttime','responsetime','endtime','ringtime','getSeconds','holdtime','talktime','callback','callbackuniqueid'];(function(_0x303d17,_0x320ca8){var _0x29fb11=function(_0x1d41b1){while(--_0x1d41b1){_0x303d17['push'](_0x303d17['shift']());}};_0x29fb11(++_0x320ca8);}(_0x38ca,0x187));var _0xa38c=function(_0x2f32ec,_0x5711b6){_0x2f32ec=_0x2f32ec-0x0;var _0x6b7008=_0x38ca[_0x2f32ec];return _0x6b7008;};'use strict';var utils=require(_0xa38c('0x0'));function History(_0x26aa24){this[_0xa38c('0x1')]=_0x26aa24[_0xa38c('0x1')];this[_0xa38c('0x2')]=_0x26aa24[_0xa38c('0x2')]||undefined;this[_0xa38c('0x3')]=_0x26aa24['type'];this[_0xa38c('0x4')]=_0x26aa24['type']===_0xa38c('0x5')?_0xa38c('0x6'):_0x26aa24[_0xa38c('0x3')];this['countbusyretry']=_0x26aa24[_0xa38c('0x7')];this[_0xa38c('0x8')]=_0x26aa24[_0xa38c('0x8')];this[_0xa38c('0x9')]=_0x26aa24['countnoanswerretry'];this[_0xa38c('0xa')]=_0x26aa24[_0xa38c('0x7')]+_0x26aa24['countcongestionretry']+_0x26aa24[_0xa38c('0x9')]+_0x26aa24['countnosuchnumberretry']+_0x26aa24['countdropretry']+_0x26aa24['countabandonedretry']+_0x26aa24['countmachineretry']+_0x26aa24[_0xa38c('0xb')];this['countnosuchnumberretry']=_0x26aa24[_0xa38c('0xc')];this[_0xa38c('0xd')]=_0x26aa24[_0xa38c('0xd')];this['countabandonedretry']=_0x26aa24[_0xa38c('0xe')];this[_0xa38c('0xf')]=_0x26aa24[_0xa38c('0xf')];this[_0xa38c('0xb')]=_0x26aa24['countagentrejectretry'];this[_0xa38c('0x6')]=_0x26aa24[_0xa38c('0x6')];this['calleridname']=_0x26aa24[_0xa38c('0x10')];this[_0xa38c('0x11')]=_0x26aa24['number'];this[_0xa38c('0x12')]=_0x26aa24['starttime'];this[_0xa38c('0x13')]=_0x26aa24[_0xa38c('0x13')];this[_0xa38c('0x14')]=_0x26aa24[_0xa38c('0x13')];this[_0xa38c('0x15')]=utils[_0xa38c('0x16')](_0x26aa24['responsetime'],_0x26aa24[_0xa38c('0x12')]);this[_0xa38c('0x17')]=0x0;this[_0xa38c('0x18')]=0x0;this['callback']=_0x26aa24[_0xa38c('0x19')];this[_0xa38c('0x1a')]=_0x26aa24['callbackuniqueid'];this['callbackat']=_0x26aa24[_0xa38c('0x1b')];this[_0xa38c('0x1c')]=_0x26aa24['recallme'];this[_0xa38c('0x1d')]=_0x26aa24[_0xa38c('0x1d')];this[_0xa38c('0x1e')]=_0x26aa24[_0xa38c('0x1e')];this[_0xa38c('0x1f')]=_0x26aa24[_0xa38c('0x1f')];this[_0xa38c('0x20')]=_0x26aa24['VoiceQueueId'];this[_0xa38c('0x21')]=_0x26aa24[_0xa38c('0x21')];this[_0xa38c('0x22')]=_0x26aa24['originatecalleridnum']||'';this[_0xa38c('0x23')]=_0x26aa24['originatecalleridname']||'';this[_0xa38c('0x24')]=_0x26aa24[_0xa38c('0x24')];this['statedesc']=_0x26aa24[_0xa38c('0x25')];}module['exports']=History; \ No newline at end of file +var _0x8ac2=['responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','statedesc','../utils','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','calleridnum','number','starttime'];(function(_0x37f83a,_0x327124){var _0x711177=function(_0x293295){while(--_0x293295){_0x37f83a['push'](_0x37f83a['shift']());}};_0x711177(++_0x327124);}(_0x8ac2,0x12f));var _0x28ac=function(_0x5bce18,_0x5b5c5f){_0x5bce18=_0x5bce18-0x0;var _0x1e5d5a=_0x8ac2[_0x5bce18];return _0x1e5d5a;};'use strict';var utils=require(_0x28ac('0x0'));function History(_0x224d2a){this[_0x28ac('0x1')]=_0x224d2a['uniqueid'];this[_0x28ac('0x2')]=_0x224d2a[_0x28ac('0x2')]||undefined;this['type']=_0x224d2a[_0x28ac('0x3')];this[_0x28ac('0x4')]=_0x224d2a['type']===_0x28ac('0x5')?_0x28ac('0x6'):_0x224d2a[_0x28ac('0x3')];this['countbusyretry']=_0x224d2a[_0x28ac('0x7')];this[_0x28ac('0x8')]=_0x224d2a[_0x28ac('0x8')];this[_0x28ac('0x9')]=_0x224d2a[_0x28ac('0x9')];this['countglobal']=_0x224d2a[_0x28ac('0x7')]+_0x224d2a[_0x28ac('0x8')]+_0x224d2a['countnoanswerretry']+_0x224d2a[_0x28ac('0xa')]+_0x224d2a[_0x28ac('0xb')]+_0x224d2a[_0x28ac('0xc')]+_0x224d2a[_0x28ac('0xd')]+_0x224d2a['countagentrejectretry'];this['countnosuchnumberretry']=_0x224d2a[_0x28ac('0xa')];this[_0x28ac('0xb')]=_0x224d2a['countdropretry'];this[_0x28ac('0xc')]=_0x224d2a['countabandonedretry'];this[_0x28ac('0xd')]=_0x224d2a[_0x28ac('0xd')];this['countagentrejectretry']=_0x224d2a['countagentrejectretry'];this[_0x28ac('0x6')]=_0x224d2a['queue'];this['calleridname']=_0x224d2a['name'];this[_0x28ac('0xe')]=_0x224d2a[_0x28ac('0xf')];this[_0x28ac('0x10')]=_0x224d2a[_0x28ac('0x10')];this[_0x28ac('0x11')]=_0x224d2a['responsetime'];this['endtime']=_0x224d2a[_0x28ac('0x11')];this[_0x28ac('0x12')]=utils['getSeconds'](_0x224d2a['responsetime'],_0x224d2a['starttime']);this[_0x28ac('0x13')]=0x0;this[_0x28ac('0x14')]=0x0;this[_0x28ac('0x15')]=_0x224d2a['callback'];this['callbackuniqueid']=_0x224d2a[_0x28ac('0x16')];this['callbackat']=_0x224d2a['callbackat'];this[_0x28ac('0x17')]=_0x224d2a[_0x28ac('0x17')];this[_0x28ac('0x18')]=_0x224d2a[_0x28ac('0x18')];this[_0x28ac('0x19')]=_0x224d2a[_0x28ac('0x19')];this['UserId']=_0x224d2a[_0x28ac('0x1a')];this[_0x28ac('0x1b')]=_0x224d2a[_0x28ac('0x1b')];this[_0x28ac('0x1c')]=_0x224d2a[_0x28ac('0x1c')];this[_0x28ac('0x1d')]=_0x224d2a[_0x28ac('0x1d')]||'';this['originatecalleridname']=_0x224d2a[_0x28ac('0x1e')]||'';this['state']=_0x224d2a['state'];this['statedesc']=_0x224d2a[_0x28ac('0x1f')];}module['exports']=History; \ No newline at end of file diff --git a/server/services/ami/dialer/models/queueCallerAbandon.js b/server/services/ami/dialer/models/queueCallerAbandon.js index dbc4ee1..e6cddee 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 _0xe87b=['statedesc','type','campaigntype','queue','countbusyretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','dropreason','endtime','ringtime','holdtime','getSeconds','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','agiafterat','state'];(function(_0x56b138,_0x2396d6){var _0x3df878=function(_0x4b3ccc){while(--_0x4b3ccc){_0x56b138['push'](_0x56b138['shift']());}};_0x3df878(++_0x2396d6);}(_0xe87b,0xc9));var _0xbe87=function(_0x53730b,_0x1d7cb6){_0x53730b=_0x53730b-0x0;var _0x1bb992=_0xe87b[_0x53730b];return _0x1bb992;};'use strict';var utils=require('../utils');function QueueCallerAbandon(_0x5c64f7,_0x1ed1c5){this['scheduledat']=_0x5c64f7['scheduledat'];this[_0xbe87('0x0')]=_0x5c64f7[_0xbe87('0x0')];this[_0xbe87('0x1')]=_0x5c64f7[_0xbe87('0x0')]==='outbound'?_0xbe87('0x2'):_0x5c64f7[_0xbe87('0x0')];this[_0xbe87('0x3')]=_0x5c64f7['countbusyretry'];this['countcongestionretry']=_0x5c64f7['countcongestionretry'];this[_0xbe87('0x4')]=_0x5c64f7[_0xbe87('0x4')];this[_0xbe87('0x5')]=_0x5c64f7[_0xbe87('0x3')]+_0x5c64f7['countcongestionretry']+_0x5c64f7[_0xbe87('0x4')]+_0x5c64f7[_0xbe87('0x6')]+_0x5c64f7[_0xbe87('0x7')]+_0x5c64f7[_0xbe87('0x8')]+_0x5c64f7[_0xbe87('0x9')]+_0x5c64f7[_0xbe87('0xa')];this[_0xbe87('0x6')]=_0x5c64f7['countnosuchnumberretry'];this[_0xbe87('0x7')]=_0x5c64f7[_0xbe87('0x7')];this['countabandonedretry']=_0x5c64f7[_0xbe87('0x8')];this['countmachineretry']=_0x5c64f7[_0xbe87('0x9')];this[_0xbe87('0xa')]=_0x5c64f7[_0xbe87('0xa')];this[_0xbe87('0xb')]=_0x1ed1c5[_0xbe87('0xb')];this[_0xbe87('0xc')]=_0x5c64f7[_0xbe87('0xd')];this[_0xbe87('0xe')]=_0x5c64f7[_0xbe87('0xf')];this[_0xbe87('0x10')]=_0x5c64f7[_0xbe87('0x10')];this[_0xbe87('0x11')]=_0x5c64f7[_0xbe87('0x11')];this[_0xbe87('0x12')]=_0x5c64f7['droptime'];this[_0xbe87('0x13')]=_0x5c64f7['dropreason'];this[_0xbe87('0x14')]=this[_0xbe87('0x12')];this[_0xbe87('0x15')]=utils['getSeconds'](_0x5c64f7[_0xbe87('0x11')],_0x5c64f7['starttime']);this[_0xbe87('0x16')]=utils[_0xbe87('0x17')](this['droptime'],_0x5c64f7[_0xbe87('0x11')]);this[_0xbe87('0x18')]=0x0;this['queue']=_0x1ed1c5[_0xbe87('0x2')];this[_0xbe87('0x19')]=_0x1ed1c5[_0xbe87('0x1a')];this[_0xbe87('0x1b')]=_0x1ed1c5[_0xbe87('0x1b')];this['callback']=_0x5c64f7[_0xbe87('0x1c')];this['callbackuniqueid']=_0x5c64f7[_0xbe87('0x1d')];this[_0xbe87('0x1e')]=_0x5c64f7[_0xbe87('0x1e')];this[_0xbe87('0x1f')]=_0x5c64f7[_0xbe87('0x1f')];this['ContactId']=_0x5c64f7['ContactId'];this[_0xbe87('0x20')]=_0x5c64f7[_0xbe87('0x20')];this[_0xbe87('0x21')]=_0x5c64f7[_0xbe87('0x21')];this['VoiceQueueId']=_0x5c64f7[_0xbe87('0x22')];this[_0xbe87('0x23')]=_0x5c64f7['CampaignId'];this[_0xbe87('0x24')]=_0x5c64f7[_0xbe87('0x24')]||'';this['originatecalleridname']=_0x5c64f7['originatecalleridname']||'';this[_0xbe87('0x25')]=_0x5c64f7[_0xbe87('0x25')];this['state']=_0x5c64f7[_0xbe87('0x26')];this[_0xbe87('0x27')]=_0x5c64f7[_0xbe87('0x27')];}module['exports']=QueueCallerAbandon; \ No newline at end of file +var _0xb6f3=['holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','../utils','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','dropreason','endtime','ringtime','getSeconds'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb6f3,0xff));var _0x3b6f=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xb6f3[_0x21a9d9];return _0x46adce;};'use strict';var utils=require(_0x3b6f('0x0'));function QueueCallerAbandon(_0x377cc9,_0x32be4f){this['scheduledat']=_0x377cc9[_0x3b6f('0x1')];this['type']=_0x377cc9[_0x3b6f('0x2')];this[_0x3b6f('0x3')]=_0x377cc9[_0x3b6f('0x2')]===_0x3b6f('0x4')?_0x3b6f('0x5'):_0x377cc9[_0x3b6f('0x2')];this[_0x3b6f('0x6')]=_0x377cc9[_0x3b6f('0x6')];this[_0x3b6f('0x7')]=_0x377cc9[_0x3b6f('0x7')];this[_0x3b6f('0x8')]=_0x377cc9['countnoanswerretry'];this[_0x3b6f('0x9')]=_0x377cc9[_0x3b6f('0x6')]+_0x377cc9[_0x3b6f('0x7')]+_0x377cc9['countnoanswerretry']+_0x377cc9[_0x3b6f('0xa')]+_0x377cc9[_0x3b6f('0xb')]+_0x377cc9[_0x3b6f('0xc')]+_0x377cc9[_0x3b6f('0xd')]+_0x377cc9[_0x3b6f('0xe')];this['countnosuchnumberretry']=_0x377cc9['countnosuchnumberretry'];this['countdropretry']=_0x377cc9['countdropretry'];this['countabandonedretry']=_0x377cc9[_0x3b6f('0xc')];this[_0x3b6f('0xd')]=_0x377cc9[_0x3b6f('0xd')];this[_0x3b6f('0xe')]=_0x377cc9[_0x3b6f('0xe')];this[_0x3b6f('0xf')]=_0x32be4f[_0x3b6f('0xf')];this[_0x3b6f('0x10')]=_0x377cc9[_0x3b6f('0x11')];this[_0x3b6f('0x12')]=_0x377cc9[_0x3b6f('0x13')];this['starttime']=_0x377cc9[_0x3b6f('0x14')];this[_0x3b6f('0x15')]=_0x377cc9['responsetime'];this['droptime']=_0x377cc9[_0x3b6f('0x16')];this[_0x3b6f('0x17')]=_0x377cc9[_0x3b6f('0x17')];this[_0x3b6f('0x18')]=this[_0x3b6f('0x16')];this[_0x3b6f('0x19')]=utils[_0x3b6f('0x1a')](_0x377cc9['responsetime'],_0x377cc9[_0x3b6f('0x14')]);this[_0x3b6f('0x1b')]=utils[_0x3b6f('0x1a')](this['droptime'],_0x377cc9[_0x3b6f('0x15')]);this[_0x3b6f('0x1c')]=0x0;this[_0x3b6f('0x5')]=_0x32be4f['queue'];this[_0x3b6f('0x1d')]=_0x32be4f[_0x3b6f('0x1e')];this[_0x3b6f('0x1f')]=_0x32be4f[_0x3b6f('0x1f')];this['callback']=_0x377cc9[_0x3b6f('0x20')];this[_0x3b6f('0x21')]=_0x377cc9[_0x3b6f('0x21')];this[_0x3b6f('0x22')]=_0x377cc9['callbackat'];this[_0x3b6f('0x23')]=_0x377cc9[_0x3b6f('0x23')];this[_0x3b6f('0x24')]=_0x377cc9[_0x3b6f('0x24')];this[_0x3b6f('0x25')]=_0x377cc9[_0x3b6f('0x25')];this[_0x3b6f('0x26')]=_0x377cc9[_0x3b6f('0x26')];this[_0x3b6f('0x27')]=_0x377cc9['VoiceQueueId'];this[_0x3b6f('0x28')]=_0x377cc9[_0x3b6f('0x28')];this[_0x3b6f('0x29')]=_0x377cc9['originatecalleridnum']||'';this[_0x3b6f('0x2a')]=_0x377cc9[_0x3b6f('0x2a')]||'';this[_0x3b6f('0x2b')]=_0x377cc9[_0x3b6f('0x2b')];this['state']=_0x377cc9[_0x3b6f('0x2c')];this['statedesc']=_0x377cc9[_0x3b6f('0x2d')];}module[_0x3b6f('0x2e')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/hopper.js b/server/services/ami/dialer/utils/hopper.js index db6ba1a..0a7299e 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 _0xdf55=['createHistory','util','../../../../config/logger','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperHistory','inspect','getContactDialer','dialOrderByScheduledAt','catch','temp','error','countReScheduled','[countReScheduled]','rescheduleContact','unlockContact','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','[verifyAdditionalPhone]','swapAdditionalPhones','[swapAdditionalPhone]','[avgHandleTime]'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0xdf55,0x83));var _0x5df5=function(_0x547587,_0x48cbd9){_0x547587=_0x547587-0x0;var _0x3d7777=_0xdf55[_0x547587];return _0x3d7777;};'use strict';var util=require(_0x5df5('0x0'));var logger=require(_0x5df5('0x1'))('dialer');var cmHopper=require(_0x5df5('0x2'));var cmHopperAdditionalPhone=require(_0x5df5('0x3'));var cmHopperBlack=require('../../rpc/cmHopperBlack');var cmHopperHistory=require(_0x5df5('0x4'));function inspectError(_0x773e15){return util[_0x5df5('0x5')](_0x773e15,{'showHidden':![],'depth':null});}function getContactDialer(_0x521007,_0x289af4,_0x417341){return cmHopper[_0x5df5('0x6')](_0x521007['id'],_0x289af4,_0x417341,_0x521007[_0x5df5('0x7')])[_0x5df5('0x8')](function(_0x2b7ed9){_0x521007[_0x5df5('0x9')]=0x0;logger[_0x5df5('0xa')]('[getContactDialer]',inspectError(_0x2b7ed9));});}exports[_0x5df5('0x6')]=getContactDialer;function getContactDialerIvr(_0x403d8b,_0x41941e){return cmHopper['getContactDialerIvr'](_0x403d8b['id'],_0x41941e,_0x403d8b['dialOrderByScheduledAt'])[_0x5df5('0x8')](function(_0x4e80bd){_0x403d8b[_0x5df5('0x9')]=0x0;logger[_0x5df5('0xa')]('[getContactDialerIvr]',inspectError(_0x4e80bd));});}exports['getContactDialerIvr']=getContactDialerIvr;function countReScheduled(_0x40322d){return cmHopper[_0x5df5('0xb')](_0x40322d)[_0x5df5('0x8')](function(_0x4c3d6f){logger[_0x5df5('0xa')](_0x5df5('0xc'),inspectError(_0x4c3d6f));});}exports[_0x5df5('0xb')]=countReScheduled;function rescheduleContact(_0x463990){return cmHopper[_0x5df5('0xd')](_0x463990)[_0x5df5('0x8')](function(_0x555d3f){logger[_0x5df5('0xa')]('[rescheduleContact]',inspectError(_0x555d3f));});}exports[_0x5df5('0xd')]=rescheduleContact;function unlockContact(_0x33f818,_0x5b0ad9,_0x3657c8){return cmHopper[_0x5df5('0xe')](_0x33f818,_0x5b0ad9,_0x3657c8)['catch'](function(_0x27b3fb){logger[_0x5df5('0xa')]('[unlockContact]',inspectError(_0x27b3fb));});}exports[_0x5df5('0xe')]=unlockContact;function moveContactManagedDialer(_0x45813f){return cmHopper[_0x5df5('0xf')](_0x45813f)[_0x5df5('0x8')](function(_0x215d59){logger['error']('[moveContactManagedDialer]',inspectError(_0x215d59));});}exports[_0x5df5('0xf')]=moveContactManagedDialer;function checkIsBlackList(_0x5d8dfd){return cmHopperBlack[_0x5df5('0x10')](_0x5d8dfd)[_0x5df5('0x8')](function(_0xa939e4){logger[_0x5df5('0xa')](_0x5df5('0x11'),inspectError(_0xa939e4));});}exports['checkIsBlackList']=checkIsBlackList;function checkIsBlackListIvr(_0x1d6474){return cmHopperBlack[_0x5df5('0x12')](_0x1d6474)[_0x5df5('0x8')](function(_0x34af1d){logger[_0x5df5('0xa')](_0x5df5('0x13'),inspectError(_0x34af1d));});}exports['checkIsBlackListIvr']=checkIsBlackListIvr;function verifyAdditionalPhones(_0x2e99a1,_0x2e862d,_0x8742a7){return cmHopperAdditionalPhone[_0x5df5('0x14')](_0x2e99a1,_0x2e862d,_0x8742a7)['catch'](function(_0x4358ba){logger[_0x5df5('0xa')](_0x5df5('0x15'),inspectError(_0x4358ba));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0x52206d,_0x532923,_0x357fb0){return cmHopperAdditionalPhone[_0x5df5('0x16')](_0x52206d,_0x532923,_0x357fb0)[_0x5df5('0x8')](function(_0xa7f4b3){logger[_0x5df5('0xa')](_0x5df5('0x17'),inspectError(_0xa7f4b3));});}exports[_0x5df5('0x16')]=swapAdditionalPhones;function avgHandleTime(_0x28723e){return cmHopperHistory['avgHandleTime'](_0x28723e)[_0x5df5('0x8')](function(_0x4fc1a1){logger[_0x5df5('0xa')](_0x5df5('0x18'),inspectError(_0x4fc1a1));});}exports['avgHandleTime']=avgHandleTime;function createHistory(_0x3854d0){return cmHopperHistory['createHistory'](_0x3854d0)[_0x5df5('0x8')](function(_0x4cccf1){logger[_0x5df5('0xa')]('[createHistory]',inspectError(_0x4cccf1));});}exports[_0x5df5('0x19')]=createHistory; \ No newline at end of file +var _0xf072=['dialer','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperHistory','inspect','getContactDialer','dialOrderByScheduledAt','catch','temp','error','[getContactDialer]','getContactDialerIvr','[getContactDialerIvr]','[countReScheduled]','countReScheduled','[rescheduleContact]','rescheduleContact','[unlockContact]','unlockContact','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','verifyAdditionalPhones','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','createHistory','[createHistory]','util','../../../../config/logger'];(function(_0x3df41c,_0x2c4f5c){var _0x56cc7b=function(_0xcba7af){while(--_0xcba7af){_0x3df41c['push'](_0x3df41c['shift']());}};_0x56cc7b(++_0x2c4f5c);}(_0xf072,0x1cf));var _0x2f07=function(_0x20e97a,_0x58ce8c){_0x20e97a=_0x20e97a-0x0;var _0x34ae8b=_0xf072[_0x20e97a];return _0x34ae8b;};'use strict';var util=require(_0x2f07('0x0'));var logger=require(_0x2f07('0x1'))(_0x2f07('0x2'));var cmHopper=require('../../rpc/cmHopper');var cmHopperAdditionalPhone=require(_0x2f07('0x3'));var cmHopperBlack=require('../../rpc/cmHopperBlack');var cmHopperHistory=require(_0x2f07('0x4'));function inspectError(_0x432696){return util[_0x2f07('0x5')](_0x432696,{'showHidden':![],'depth':null});}function getContactDialer(_0x48d7b6,_0x1d5a33,_0x14d6e6){return cmHopper[_0x2f07('0x6')](_0x48d7b6['id'],_0x1d5a33,_0x14d6e6,_0x48d7b6[_0x2f07('0x7')])[_0x2f07('0x8')](function(_0xf73d1a){_0x48d7b6[_0x2f07('0x9')]=0x0;logger[_0x2f07('0xa')](_0x2f07('0xb'),inspectError(_0xf73d1a));});}exports[_0x2f07('0x6')]=getContactDialer;function getContactDialerIvr(_0x30c638,_0x2e372c){return cmHopper[_0x2f07('0xc')](_0x30c638['id'],_0x2e372c,_0x30c638[_0x2f07('0x7')])[_0x2f07('0x8')](function(_0x564260){_0x30c638[_0x2f07('0x9')]=0x0;logger[_0x2f07('0xa')](_0x2f07('0xd'),inspectError(_0x564260));});}exports[_0x2f07('0xc')]=getContactDialerIvr;function countReScheduled(_0x496d87){return cmHopper['countReScheduled'](_0x496d87)[_0x2f07('0x8')](function(_0x1e291d){logger['error'](_0x2f07('0xe'),inspectError(_0x1e291d));});}exports[_0x2f07('0xf')]=countReScheduled;function rescheduleContact(_0x26edfa){return cmHopper['rescheduleContact'](_0x26edfa)[_0x2f07('0x8')](function(_0x443fdc){logger[_0x2f07('0xa')](_0x2f07('0x10'),inspectError(_0x443fdc));});}exports[_0x2f07('0x11')]=rescheduleContact;function unlockContact(_0x309908,_0x5d32d6,_0x8475cf){return cmHopper['unlockContact'](_0x309908,_0x5d32d6,_0x8475cf)[_0x2f07('0x8')](function(_0xe8cf4d){logger[_0x2f07('0xa')](_0x2f07('0x12'),inspectError(_0xe8cf4d));});}exports[_0x2f07('0x13')]=unlockContact;function moveContactManagedDialer(_0x46c9b4){return cmHopper[_0x2f07('0x14')](_0x46c9b4)[_0x2f07('0x8')](function(_0x55bd60){logger[_0x2f07('0xa')]('[moveContactManagedDialer]',inspectError(_0x55bd60));});}exports[_0x2f07('0x14')]=moveContactManagedDialer;function checkIsBlackList(_0x2df6ed){return cmHopperBlack[_0x2f07('0x15')](_0x2df6ed)[_0x2f07('0x8')](function(_0x2ef47d){logger['error'](_0x2f07('0x16'),inspectError(_0x2ef47d));});}exports['checkIsBlackList']=checkIsBlackList;function checkIsBlackListIvr(_0x5db56b){return cmHopperBlack['checkIsBlackListIvr'](_0x5db56b)[_0x2f07('0x8')](function(_0x51c285){logger[_0x2f07('0xa')]('[checkIsBlackListIvr]',inspectError(_0x51c285));});}exports[_0x2f07('0x17')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x2c495f,_0x12a2a5,_0x307888){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x2c495f,_0x12a2a5,_0x307888)[_0x2f07('0x8')](function(_0x428d8c){logger[_0x2f07('0xa')]('[verifyAdditionalPhone]',inspectError(_0x428d8c));});}exports[_0x2f07('0x18')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x113916,_0x522006,_0x1dcedc){return cmHopperAdditionalPhone[_0x2f07('0x19')](_0x113916,_0x522006,_0x1dcedc)['catch'](function(_0x427e13){logger['error'](_0x2f07('0x1a'),inspectError(_0x427e13));});}exports[_0x2f07('0x19')]=swapAdditionalPhones;function avgHandleTime(_0x27bd72){return cmHopperHistory[_0x2f07('0x1b')](_0x27bd72)[_0x2f07('0x8')](function(_0x139ea8){logger[_0x2f07('0xa')](_0x2f07('0x1c'),inspectError(_0x139ea8));});}exports[_0x2f07('0x1b')]=avgHandleTime;function createHistory(_0x468cd8){return cmHopperHistory[_0x2f07('0x1d')](_0x468cd8)[_0x2f07('0x8')](function(_0x4c607a){logger[_0x2f07('0xa')](_0x2f07('0x1e'),inspectError(_0x4c607a));});}exports[_0x2f07('0x1d')]=createHistory; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/index.js b/server/services/ami/dialer/utils/index.js index 2f1d047..e99b29a 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 _0xd916=['hasQueueCampaignDataChanged','dialTimezone','dialGlobalInterval','Interval','isNil','isEmpty','Intervals','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','reachable','status','TrunkBackup','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','getQueueCampaignActiveStatusMessage','isUndefined','string','\x22%s\x22\x20<%s>','getCallerId','\x5cw{0,','pow','format','replace','random','getCallerIdRandom','[decrementOriginate]\x20queue\x20originate\x20value','decrementOriginate','length','checkContactEmpty','erlangb','[checkContactLowerLimitOriginate]\x20','createdAt','tags','updatedAt','undefined','includes','XMD-','toUpperCase','toString','setXMDContactVariables','util','../../../../config/logger','timezones','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','RUNNING','TIMEZONE_UNKNOW','preview','isPreviewCampaign','type','ivr','isIVRCampaign','outbound','isOutboundQueue','dialActive','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','diff','getSeconds','dialMethod','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name'];(function(_0xfc1e88,_0x447588){var _0x13be8b=function(_0x876b0f){while(--_0x876b0f){_0xfc1e88['push'](_0xfc1e88['shift']());}};_0x13be8b(++_0x447588);}(_0xd916,0x187));var _0x6d91=function(_0xcb389d,_0x2bb392){_0xcb389d=_0xcb389d-0x0;var _0x12c7ef=_0xd916[_0xcb389d];return _0x12c7ef;};'use strict';var _=require('lodash');var moment=require('moment');var util=require(_0x6d91('0x0'));var logger=require(_0x6d91('0x1'))('dialer');var timezones=require('../../../../config/environment/shared')[_0x6d91('0x2')];var CAMPAIGN_STATUS={'ACTIVE':_0x6d91('0x3'),'BLACKLIST':_0x6d91('0x4'),'CONTACTS_RESCHEDULED':_0x6d91('0x5'),'DEACTIVATED':_0x6d91('0x6'),'DISACTIVED':_0x6d91('0x7'),'EMPTY_INTERVAL':_0x6d91('0x8'),'INACTIVE':_0x6d91('0x9'),'NO_AGENTS_LOGGED':_0x6d91('0xa'),'NO_AVAILABLE_CONTACTS':'AVAILABLE_CONTACTS_FINISHED','NULL_INTERVAL':_0x6d91('0xb'),'OVERTIME_INTERVAL':_0x6d91('0xc'),'OVERTIME_GLOBAL_INTERVAL':'GLOBAL_INTERVAL_IS_OVERTIME','QUEUE_RECALL':_0x6d91('0xd'),'RECALL_TIMEOUT':_0x6d91('0xe'),'RUNNING':_0x6d91('0xf'),'UNKNOWN_TIMEZONE':_0x6d91('0x10'),'UNREACHABLE_TRUNK':'TRUNK_IS_NOT_REACHABLE'};exports['CAMPAIGN_STATUS']=CAMPAIGN_STATUS;function isPreviewCampaign(_0x997a6){return _0x997a6['dialMethod']===_0x6d91('0x11');}exports[_0x6d91('0x12')]=isPreviewCampaign;function isIVRCampaign(_0x47aaec){return _0x47aaec[_0x6d91('0x13')]===_0x6d91('0x14');}exports[_0x6d91('0x15')]=isIVRCampaign;function isOutboundQueue(_0x3fc27d){return _0x3fc27d[_0x6d91('0x13')]===_0x6d91('0x16');}exports[_0x6d91('0x17')]=isOutboundQueue;function isQueueCampaignActive(_0x245333){return _0x245333[_0x6d91('0x18')];}exports[_0x6d91('0x19')]=isQueueCampaignActive;function isIVRCampaignActive(_0x54a2cf){return _0x54a2cf[_0x6d91('0x1a')];}exports[_0x6d91('0x1b')]=isIVRCampaignActive;function getSeconds(_0x56c47f,_0x5c3e7d){var _0x4e7a80=moment(_0x56c47f)[_0x6d91('0x1c')](0x0);var _0xe01d9=moment(_0x5c3e7d)['milliseconds'](0x0);return _0x4e7a80[_0x6d91('0x1d')](_0xe01d9,'seconds');}exports[_0x6d91('0x1e')]=getSeconds;function hasQueueCampaignDataChanged(_0x423b8d,_0x158c91){var _0x21949f=![];var _0x146aec=_0x423b8d['dialMethod']!==_0x158c91[_0x6d91('0x1f')]||_0x423b8d[_0x6d91('0x18')]!==_0x158c91['dialActive']||_0x423b8d[_0x6d91('0x20')]!==_0x158c91['message'];var _0x37183f=_0x423b8d['available']!==_0x158c91[_0x6d91('0x21')]||_0x423b8d['loggedIn']!==_0x158c91[_0x6d91('0x22')]||_0x423b8d[_0x6d91('0x23')]!==_0x158c91[_0x6d91('0x23')]||_0x423b8d['paused']!==_0x158c91[_0x6d91('0x24')]||_0x423b8d[_0x6d91('0x25')]!==_0x158c91['talking']||_0x423b8d[_0x6d91('0x26')]!==_0x158c91[_0x6d91('0x26')]||_0x423b8d[_0x6d91('0x27')]!==_0x158c91['waiting']||_0x423b8d[_0x6d91('0x28')]!==_0x158c91['inUse']||_0x423b8d[_0x6d91('0x29')]!==_0x158c91[_0x6d91('0x29')];if(_0x423b8d['Trunk']&&_0x158c91['Trunk']){_0x21949f=_0x423b8d[_0x6d91('0x2a')]['name']!==_0x158c91['Trunk'][_0x6d91('0x2b')]||_0x423b8d[_0x6d91('0x2a')][_0x6d91('0x1a')]!==_0x158c91[_0x6d91('0x2a')][_0x6d91('0x1a')];}return _0x146aec||_0x37183f||_0x21949f;}exports[_0x6d91('0x2c')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x132f8b){var _0x3fe115=null;var _0x3cdfa5=_0x132f8b[_0x6d91('0x2d')];if(_['isNil'](_0x132f8b[_0x6d91('0x2e')])||_['isNil'](_0x132f8b[_0x6d91('0x2f')])||_[_0x6d91('0x30')](_0x132f8b[_0x6d91('0x2f')]['Intervals'])){_0x3fe115=CAMPAIGN_STATUS['NULL_INTERVAL'];}else if(_[_0x6d91('0x31')](_0x132f8b[_0x6d91('0x2e')])||_[_0x6d91('0x31')](_0x132f8b['Interval'][_0x6d91('0x32')])){_0x3fe115=CAMPAIGN_STATUS[_0x6d91('0x33')];}else if(_0x3cdfa5&&!timezones[_0x3cdfa5]){_0x3fe115=CAMPAIGN_STATUS[_0x6d91('0x34')];}return _0x3fe115;}function checkAnyValidTrunk(_0x34f33b,_0xbd4f71){var _0x538331=null;var _0x40989a='SIP/';var _0x59248d=[_0x6d91('0x35'),'unmonitored'];var _0x588d40=!![];if(_0x34f33b[_0x6d91('0x2a')]&&_0x34f33b[_0x6d91('0x2a')][_0x6d91('0x1a')]){_0x40989a+=_0x34f33b['Trunk']['name'];_0x538331=_0xbd4f71[_0x40989a];_0x588d40=_0x59248d['includes'](_0x538331[_0x6d91('0x36')]);}else if(_0x34f33b[_0x6d91('0x37')]&&_0x34f33b['TrunkBackup']['active']){_0x40989a+=_0x34f33b[_0x6d91('0x37')]['name'];_0x538331=_0xbd4f71[_0x40989a];_0x588d40=_0x59248d['includes'](_0x538331[_0x6d91('0x36')]);}return _0x588d40;}function getQueueCampaignStatusMessage(_0x491160,_0x200599){var _0x255c1a=CAMPAIGN_STATUS[_0x6d91('0x3')];var _0x3814b3=isPreviewCampaign(_0x491160);if(!isQueueCampaignActive(_0x491160)){if(_0x3814b3){_0x255c1a=CAMPAIGN_STATUS[_0x6d91('0x38')];}else{if(_0x491160[_0x6d91('0x29')]===0x0&&_0x491160[_0x6d91('0x25')]===0x0&&_0x491160[_0x6d91('0x27')]===0x0&&(_0x491160[_0x6d91('0x26')]||0x0)===0x0){_0x255c1a=CAMPAIGN_STATUS[_0x6d91('0x38')];}else{_0x255c1a=CAMPAIGN_STATUS[_0x6d91('0x39')];}}}else if(_0x491160['loggedIn']===0x0){_0x255c1a=CAMPAIGN_STATUS[_0x6d91('0x3a')];}else if(!checkAnyValidTrunk(_0x491160,_0x200599)){_0x255c1a=CAMPAIGN_STATUS[_0x6d91('0x3b')];}else if(!isPreviewCampaign(_0x491160)){var _0x4ef847=checkAnyValidQueueCampaignInterval(_0x491160);if(_0x4ef847){_0x255c1a=_0x4ef847;}}return _0x255c1a;}exports[_0x6d91('0x3c')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x2100cb){var _0x35ebab=CAMPAIGN_STATUS[_0x6d91('0x39')];if(_0x2100cb[_0x6d91('0x29')]===0x0&&_0x2100cb[_0x6d91('0x25')]===0x0&&_0x2100cb[_0x6d91('0x27')]===0x0&&(_0x2100cb[_0x6d91('0x26')]||0x0)===0x0){_0x35ebab=CAMPAIGN_STATUS['INACTIVE'];}return _0x35ebab;}exports[_0x6d91('0x3d')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x47dd5){var _0x428c3f=_0x47dd5['match'](/"(.*?)"/);return _0x428c3f?_0x428c3f[0x1]:_0x47dd5;}exports['extractCalleridName']=extractCalleridName;function getCallerId(_0x3ac842,_0x3932ae,_0x2dfe23){if(!_[_0x6d91('0x3e')](_0x2dfe23)&&typeof _0x2dfe23===_0x6d91('0x3f')&&!_[_0x6d91('0x31')](_0x2dfe23)){if(!_[_0x6d91('0x3e')](_0x3932ae)&&typeof _0x3932ae===_0x6d91('0x3f')&&!_[_0x6d91('0x31')](_0x3932ae)){return util['format'](_0x6d91('0x40'),_0x3932ae,_0x2dfe23);}return util['format'](_0x6d91('0x40'),_0x2dfe23,_0x2dfe23);}if(!_[_0x6d91('0x3e')](_0x3ac842)&&typeof _0x3ac842===_0x6d91('0x3f')&&!_['isEmpty'](_0x3ac842)){return _0x3ac842;}return'\x22\x22\x20<>';}exports[_0x6d91('0x41')]=getCallerId;function getCallerIdRandom(_0x1bee14,_0x437a15){var _0x56479a;var _0x2c2954;var _0x1723f4;if(_0x437a15<=0x0){_0x437a15=0x1;}_0x56479a=new RegExp(_0x6d91('0x42')+_0x437a15+'}$');_0x2c2954=Math[_0x6d91('0x43')](0xa,_0x437a15-0x1);_0x1723f4=Math[_0x6d91('0x43')](0xa,_0x437a15)-0x1;return util[_0x6d91('0x44')]('%s',_[_0x6d91('0x45')](_0x1bee14,_0x56479a,_[_0x6d91('0x46')](_0x2c2954,_0x1723f4)['toString']()));}exports[_0x6d91('0x47')]=getCallerIdRandom;function decrementOriginate(_0xcaa206,_0x3755ee){if(_0xcaa206[_0x6d91('0x29')]&&_0xcaa206[_0x6d91('0x29')]>0x0){_0xcaa206[_0x6d91('0x29')]-=0x1;}else{logger['error'](_0x6d91('0x48'),_0x3755ee);}}exports[_0x6d91('0x49')]=decrementOriginate;function checkContactEmpty(_0x4c8630){return _0x4c8630&&_0x4c8630[_0x6d91('0x4a')]>0x0;}exports[_0x6d91('0x4b')]=checkContactEmpty;function erlangb(_0x564c46,_0x30203c){if(_0x30203c===0x0){return 0x0;}var _0x5d95cc=0x1;for(var _0x5deac5=0x1;_0x5deac5<=_0x30203c;_0x5deac5+=0x1){_0x5d95cc=0x1+_0x5d95cc*_0x5deac5/_0x564c46;}return 0x1/_0x5d95cc;}exports[_0x6d91('0x4c')]=erlangb;function checkContactLowerLimitOriginate(_0x12b104,_0x28ddcb,_0x5130e7){if(_0x28ddcb>_0x5130e7){for(var _0x514391=0x0;_0x514391<_0x28ddcb-_0x5130e7;_0x514391+=0x1){decrementOriginate(_0x12b104,_0x6d91('0x4d'));}}}exports['checkContactLowerLimitOriginate']=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x45221a){var _0x2b5451={};var _0xb699f1=['id',_0x6d91('0x4e'),_0x6d91('0x4f'),_0x6d91('0x50')];const _0x25dbc4=0xfa;if(_0x45221a){for(var _0x424cfe in _0x45221a){if(typeof _0x45221a[_0x424cfe]!==_0x6d91('0x51')){if(!_[_0x6d91('0x30')](_0x45221a[_0x424cfe])&&!_0xb699f1[_0x6d91('0x52')](_0x424cfe)){if(_0x424cfe==='description'&&_0x45221a[_0x424cfe]['length']>_0x25dbc4){_0x2b5451[_0x6d91('0x53')+_0x424cfe[_0x6d91('0x54')]()]=_0x45221a[_0x424cfe][_0x6d91('0x55')]()['substring'](0x0,_0x25dbc4);}else{_0x2b5451[_0x6d91('0x53')+_0x424cfe['toUpperCase']()]=_0x45221a[_0x424cfe];}}}}}return _0x2b5451;}exports[_0x6d91('0x56')]=setXMDContactVariables; \ No newline at end of file +var _0x9582=['createdAt','tags','updatedAt','undefined','XMD-','toString','substring','toUpperCase','lodash','moment','util','../../../../config/logger','../../../../config/environment/shared','timezones','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','INTERVAL_IS_EMPTY','AGENTS_NOT_LOGGED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RUNNING','preview','isPreviewCampaign','type','ivr','isIVRCampaign','outbound','isOutboundQueue','dialActive','active','isIVRCampaignActive','milliseconds','diff','seconds','getSeconds','dialMethod','message','available','loggedIn','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','dialTimezone','isNil','Intervals','NULL_INTERVAL','isEmpty','Interval','UNKNOWN_TIMEZONE','SIP/','unmonitored','includes','TrunkBackup','status','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignActiveStatusMessage','extractCalleridName','isUndefined','string','\x22%s\x22\x20<%s>','format','getCallerId','\x5cw{0,','pow','replace','random','getCallerIdRandom','error','decrementOriginate','checkContactEmpty','erlangb','checkContactLowerLimitOriginate'];(function(_0x2b4f28,_0x5bb87e){var _0x417534=function(_0x576345){while(--_0x576345){_0x2b4f28['push'](_0x2b4f28['shift']());}};_0x417534(++_0x5bb87e);}(_0x9582,0x1ac));var _0x2958=function(_0x45b069,_0x5e02fb){_0x45b069=_0x45b069-0x0;var _0x2d2f3d=_0x9582[_0x45b069];return _0x2d2f3d;};'use strict';var _=require(_0x2958('0x0'));var moment=require(_0x2958('0x1'));var util=require(_0x2958('0x2'));var logger=require(_0x2958('0x3'))('dialer');var timezones=require(_0x2958('0x4'))[_0x2958('0x5')];var CAMPAIGN_STATUS={'ACTIVE':_0x2958('0x6'),'BLACKLIST':_0x2958('0x7'),'CONTACTS_RESCHEDULED':_0x2958('0x8'),'DEACTIVATED':_0x2958('0x9'),'DISACTIVED':'IS_DISACTIVED','EMPTY_INTERVAL':_0x2958('0xa'),'INACTIVE':'NOT_ACTIVE','NO_AGENTS_LOGGED':_0x2958('0xb'),'NO_AVAILABLE_CONTACTS':'AVAILABLE_CONTACTS_FINISHED','NULL_INTERVAL':_0x2958('0xc'),'OVERTIME_INTERVAL':_0x2958('0xd'),'OVERTIME_GLOBAL_INTERVAL':_0x2958('0xe'),'QUEUE_RECALL':_0x2958('0xf'),'RECALL_TIMEOUT':'RECALLFAILEDTIMEOUT','RUNNING':_0x2958('0x10'),'UNKNOWN_TIMEZONE':'TIMEZONE_UNKNOW','UNREACHABLE_TRUNK':'TRUNK_IS_NOT_REACHABLE'};exports['CAMPAIGN_STATUS']=CAMPAIGN_STATUS;function isPreviewCampaign(_0x2eb179){return _0x2eb179['dialMethod']===_0x2958('0x11');}exports[_0x2958('0x12')]=isPreviewCampaign;function isIVRCampaign(_0x38180a){return _0x38180a[_0x2958('0x13')]===_0x2958('0x14');}exports[_0x2958('0x15')]=isIVRCampaign;function isOutboundQueue(_0x4129a0){return _0x4129a0[_0x2958('0x13')]===_0x2958('0x16');}exports[_0x2958('0x17')]=isOutboundQueue;function isQueueCampaignActive(_0x3ec998){return _0x3ec998[_0x2958('0x18')];}exports['isQueueCampaignActive']=isQueueCampaignActive;function isIVRCampaignActive(_0x5a5fdb){return _0x5a5fdb[_0x2958('0x19')];}exports[_0x2958('0x1a')]=isIVRCampaignActive;function getSeconds(_0xa497e2,_0x236010){var _0x5daa87=moment(_0xa497e2)['milliseconds'](0x0);var _0x1a4cc0=moment(_0x236010)[_0x2958('0x1b')](0x0);return _0x5daa87[_0x2958('0x1c')](_0x1a4cc0,_0x2958('0x1d'));}exports[_0x2958('0x1e')]=getSeconds;function hasQueueCampaignDataChanged(_0x17724a,_0x164d27){var _0x11a2e1=![];var _0x29b20a=_0x17724a[_0x2958('0x1f')]!==_0x164d27[_0x2958('0x1f')]||_0x17724a[_0x2958('0x18')]!==_0x164d27[_0x2958('0x18')]||_0x17724a[_0x2958('0x20')]!==_0x164d27[_0x2958('0x20')];var _0x5477f9=_0x17724a[_0x2958('0x21')]!==_0x164d27['available']||_0x17724a[_0x2958('0x22')]!==_0x164d27[_0x2958('0x22')]||_0x17724a['loggedInDb']!==_0x164d27['loggedInDb']||_0x17724a['paused']!==_0x164d27[_0x2958('0x23')]||_0x17724a[_0x2958('0x24')]!==_0x164d27['talking']||_0x17724a[_0x2958('0x25')]!==_0x164d27['pTalking']||_0x17724a['waiting']!==_0x164d27[_0x2958('0x26')]||_0x17724a[_0x2958('0x27')]!==_0x164d27[_0x2958('0x27')]||_0x17724a[_0x2958('0x28')]!==_0x164d27[_0x2958('0x28')];if(_0x17724a[_0x2958('0x29')]&&_0x164d27['Trunk']){_0x11a2e1=_0x17724a[_0x2958('0x29')][_0x2958('0x2a')]!==_0x164d27[_0x2958('0x29')]['name']||_0x17724a[_0x2958('0x29')][_0x2958('0x19')]!==_0x164d27[_0x2958('0x29')][_0x2958('0x19')];}return _0x29b20a||_0x5477f9||_0x11a2e1;}exports['hasQueueCampaignDataChanged']=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x17640c){var _0x321ab5=null;var _0x4c83cf=_0x17640c[_0x2958('0x2b')];if(_[_0x2958('0x2c')](_0x17640c['dialGlobalInterval'])||_[_0x2958('0x2c')](_0x17640c['Interval'])||_[_0x2958('0x2c')](_0x17640c['Interval'][_0x2958('0x2d')])){_0x321ab5=CAMPAIGN_STATUS[_0x2958('0x2e')];}else if(_[_0x2958('0x2f')](_0x17640c['dialGlobalInterval'])||_['isEmpty'](_0x17640c[_0x2958('0x30')][_0x2958('0x2d')])){_0x321ab5=CAMPAIGN_STATUS['EMPTY_INTERVAL'];}else if(_0x4c83cf&&!timezones[_0x4c83cf]){_0x321ab5=CAMPAIGN_STATUS[_0x2958('0x31')];}return _0x321ab5;}function checkAnyValidTrunk(_0x424a75,_0x176f49){var _0x3a3d0c=null;var _0x2dda1f=_0x2958('0x32');var _0x3c433f=['reachable',_0x2958('0x33')];var _0x32c32d=!![];if(_0x424a75[_0x2958('0x29')]&&_0x424a75[_0x2958('0x29')][_0x2958('0x19')]){_0x2dda1f+=_0x424a75['Trunk'][_0x2958('0x2a')];_0x3a3d0c=_0x176f49[_0x2dda1f];_0x32c32d=_0x3c433f[_0x2958('0x34')](_0x3a3d0c['status']);}else if(_0x424a75[_0x2958('0x35')]&&_0x424a75[_0x2958('0x35')][_0x2958('0x19')]){_0x2dda1f+=_0x424a75[_0x2958('0x35')]['name'];_0x3a3d0c=_0x176f49[_0x2dda1f];_0x32c32d=_0x3c433f['includes'](_0x3a3d0c[_0x2958('0x36')]);}return _0x32c32d;}function getQueueCampaignStatusMessage(_0x3b9873,_0x138d78){var _0x571fb7=CAMPAIGN_STATUS[_0x2958('0x6')];var _0x5a2ff7=isPreviewCampaign(_0x3b9873);if(!isQueueCampaignActive(_0x3b9873)){if(_0x5a2ff7){_0x571fb7=CAMPAIGN_STATUS['INACTIVE'];}else{if(_0x3b9873[_0x2958('0x28')]===0x0&&_0x3b9873[_0x2958('0x24')]===0x0&&_0x3b9873[_0x2958('0x26')]===0x0&&(_0x3b9873[_0x2958('0x25')]||0x0)===0x0){_0x571fb7=CAMPAIGN_STATUS[_0x2958('0x37')];}else{_0x571fb7=CAMPAIGN_STATUS[_0x2958('0x38')];}}}else if(_0x3b9873[_0x2958('0x22')]===0x0){_0x571fb7=CAMPAIGN_STATUS[_0x2958('0x39')];}else if(!checkAnyValidTrunk(_0x3b9873,_0x138d78)){_0x571fb7=CAMPAIGN_STATUS[_0x2958('0x3a')];}else if(!isPreviewCampaign(_0x3b9873)){var _0x140ece=checkAnyValidQueueCampaignInterval(_0x3b9873);if(_0x140ece){_0x571fb7=_0x140ece;}}return _0x571fb7;}exports['getQueueCampaignStatusMessage']=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x27e0b0){var _0x44c331=CAMPAIGN_STATUS[_0x2958('0x38')];if(_0x27e0b0['originated']===0x0&&_0x27e0b0['talking']===0x0&&_0x27e0b0[_0x2958('0x26')]===0x0&&(_0x27e0b0['pTalking']||0x0)===0x0){_0x44c331=CAMPAIGN_STATUS[_0x2958('0x37')];}return _0x44c331;}exports[_0x2958('0x3b')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x5d35e5){var _0xfff81a=_0x5d35e5['match'](/"(.*?)"/);return _0xfff81a?_0xfff81a[0x1]:_0x5d35e5;}exports[_0x2958('0x3c')]=extractCalleridName;function getCallerId(_0x488e55,_0x22e631,_0x3375bf){if(!_[_0x2958('0x3d')](_0x3375bf)&&typeof _0x3375bf===_0x2958('0x3e')&&!_[_0x2958('0x2f')](_0x3375bf)){if(!_[_0x2958('0x3d')](_0x22e631)&&typeof _0x22e631===_0x2958('0x3e')&&!_[_0x2958('0x2f')](_0x22e631)){return util['format'](_0x2958('0x3f'),_0x22e631,_0x3375bf);}return util[_0x2958('0x40')](_0x2958('0x3f'),_0x3375bf,_0x3375bf);}if(!_['isUndefined'](_0x488e55)&&typeof _0x488e55==='string'&&!_[_0x2958('0x2f')](_0x488e55)){return _0x488e55;}return'\x22\x22\x20<>';}exports[_0x2958('0x41')]=getCallerId;function getCallerIdRandom(_0x52684e,_0x1190b0){var _0x44d8ab;var _0xbd91e6;var _0x45b477;if(_0x1190b0<=0x0){_0x1190b0=0x1;}_0x44d8ab=new RegExp(_0x2958('0x42')+_0x1190b0+'}$');_0xbd91e6=Math[_0x2958('0x43')](0xa,_0x1190b0-0x1);_0x45b477=Math[_0x2958('0x43')](0xa,_0x1190b0)-0x1;return util[_0x2958('0x40')]('%s',_[_0x2958('0x44')](_0x52684e,_0x44d8ab,_[_0x2958('0x45')](_0xbd91e6,_0x45b477)['toString']()));}exports[_0x2958('0x46')]=getCallerIdRandom;function decrementOriginate(_0x53a165,_0x2775bb){if(_0x53a165[_0x2958('0x28')]&&_0x53a165[_0x2958('0x28')]>0x0){_0x53a165[_0x2958('0x28')]-=0x1;}else{logger[_0x2958('0x47')]('[decrementOriginate]\x20queue\x20originate\x20value',_0x2775bb);}}exports[_0x2958('0x48')]=decrementOriginate;function checkContactEmpty(_0x4dad7b){return _0x4dad7b&&_0x4dad7b['length']>0x0;}exports[_0x2958('0x49')]=checkContactEmpty;function erlangb(_0x26c1a8,_0x9a7bd3){if(_0x9a7bd3===0x0){return 0x0;}var _0x130efa=0x1;for(var _0x17feeb=0x1;_0x17feeb<=_0x9a7bd3;_0x17feeb+=0x1){_0x130efa=0x1+_0x130efa*_0x17feeb/_0x26c1a8;}return 0x1/_0x130efa;}exports[_0x2958('0x4a')]=erlangb;function checkContactLowerLimitOriginate(_0x5d31e9,_0x51abac,_0xcce0f2){if(_0x51abac>_0xcce0f2){for(var _0x536db5=0x0;_0x536db5<_0x51abac-_0xcce0f2;_0x536db5+=0x1){decrementOriginate(_0x5d31e9,'[checkContactLowerLimitOriginate]\x20');}}}exports[_0x2958('0x4b')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x16d8d3){var _0xdb3f8a={};var _0x1880bd=['id',_0x2958('0x4c'),_0x2958('0x4d'),_0x2958('0x4e')];const _0x8a8731=0xfa;if(_0x16d8d3){for(var _0x961cb5 in _0x16d8d3){if(typeof _0x16d8d3[_0x961cb5]!==_0x2958('0x4f')){if(!_['isNil'](_0x16d8d3[_0x961cb5])&&!_0x1880bd[_0x2958('0x34')](_0x961cb5)){if(_0x961cb5==='description'&&_0x16d8d3[_0x961cb5]['length']>_0x8a8731){_0xdb3f8a[_0x2958('0x50')+_0x961cb5['toUpperCase']()]=_0x16d8d3[_0x961cb5][_0x2958('0x51')]()[_0x2958('0x52')](0x0,_0x8a8731);}else{_0xdb3f8a[_0x2958('0x50')+_0x961cb5[_0x2958('0x53')]()]=_0x16d8d3[_0x961cb5];}}}}}return _0xdb3f8a;}exports['setXMDContactVariables']=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index a2e2816..5ec74b9 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(_0x3d38ba,_0x282e4d){var _0x127d4c=function(_0x71d221){while(--_0x71d221){_0x3d38ba['push'](_0x3d38ba['shift']());}};_0x127d4c(++_0x282e4d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'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(_0x35bf9d,_0x266607){var _0x32c380=function(_0x1e3db5){while(--_0x1e3db5){_0x35bf9d['push'](_0x35bf9d['shift']());}};_0x32c380(++_0x266607);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));function Action(_0x5dd881,_0x550fbc,_0x18d5c9){this['uniqueid']=_0x5dd881||undefined;this[_0x0a9e('0x3')]=util[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x550fbc[_0x0a9e('0x6')],_0x550fbc[_0x0a9e('0x7')]['name'],_0x18d5c9[_0x0a9e('0x8')]);this[_0x0a9e('0x9')]=_0x550fbc[_0x0a9e('0x9')];this['headerinfo']=_0x550fbc['headerinfo'];this[_0x0a9e('0xa')]=_0x18d5c9['path'];this['AttachmentId']=_0x18d5c9[_0x0a9e('0xb')];}module[_0x0a9e('0xc')]=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index 8ed46db..05becda 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 _0x24b4=['\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','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','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','unmonitored','checkTrunk','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Is\x20Valid','exports','util','lodash','bluebird','uuid','path','tiff2pdf','../../../config/logger','../ami','./rpcDb','./channel','./util/util','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','varset','syncVarSet','bind','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','originateresponse','prototype','hasOwnProperty','exten','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','localstationid','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','message','create','parse','application/pdf','notify','fax','.pdf','error','\x20notify\x20','stringify','catch','\x20receiveFax\x20','syncOriginateResponse','merge','pick','response','reason','update','AttachmentId','then','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','logger','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][NoUpdate1]','finally','deleteChannelAfterTimeout','syncHangup','\x20hangup\x20sendFile\x20'];(function(_0x458f39,_0x319ba6){var _0x455e63=function(_0x99eee0){while(--_0x99eee0){_0x458f39['push'](_0x458f39['shift']());}};_0x455e63(++_0x319ba6);}(_0x24b4,0x199));var _0x424b=function(_0x51fcb,_0x2dd85f){_0x51fcb=_0x51fcb-0x0;var _0x22c1a9=_0x24b4[_0x51fcb];return _0x22c1a9;};'use strict';var util=require(_0x424b('0x0'));var _=require(_0x424b('0x1'));var BPromise=require(_0x424b('0x2'));var uuid=require(_0x424b('0x3'));var moment=require('moment');var path=require(_0x424b('0x4'));var tiff2pdf=require(_0x424b('0x5'));var gs=require('./util/gs');var logger=require(_0x424b('0x6'))('fax');var ami=require(_0x424b('0x7'));var rpcDb=require(_0x424b('0x8'));var Channel=require(_0x424b('0x9'));var ut=require(_0x424b('0xa'));var Action=require('./action');var faxAccount=require('../rpc/faxAccount');var attachment=require(_0x424b('0xb'));var faxMessage=require(_0x424b('0xc'));function Fax(_0x8df8ff){this[_0x424b('0xd')]={};this['faxAccounts']=_0x8df8ff[_0x424b('0xe')];this[_0x424b('0xf')]=_0x8df8ff[_0x424b('0xf')];this[_0x424b('0x10')]={};ami['on'](_0x424b('0x11'),this[_0x424b('0x12')]['bind'](this));ami['on'](_0x424b('0x13'),this[_0x424b('0x14')][_0x424b('0x15')](this));ami['on'](_0x424b('0x16'),this[_0x424b('0x17')][_0x424b('0x15')](this));ami['on'](_0x424b('0x18'),this[_0x424b('0x19')][_0x424b('0x15')](this));ami['on'](_0x424b('0x1a'),this[_0x424b('0x1b')]['bind'](this));ami['on'](_0x424b('0x1c'),this[_0x424b('0x1d')][_0x424b('0x15')](this));ami['on'](_0x424b('0x1e'),this['syncHangup'][_0x424b('0x15')](this));ami['on'](_0x424b('0x1f'),this['syncOriginateResponse'][_0x424b('0x15')](this));}Fax[_0x424b('0x20')]['syncNewchannel']=function(_0x4bd5c1){if(_0x4bd5c1['context']==='from-voip-provider'){for(var _0x5f06a9 in this[_0x424b('0xe')]){if(this[_0x424b('0xe')][_0x424b('0x21')](_0x5f06a9)){if(_0x4bd5c1[_0x424b('0x22')]===this['faxAccounts'][_0x5f06a9]['localstationid']){this[_0x424b('0xd')][_0x4bd5c1[_0x424b('0x23')]]={};this[_0x424b('0xd')][_0x4bd5c1[_0x424b('0x23')]][_0x424b('0x24')]=_0x4bd5c1[_0x424b('0x24')];this['channels'][_0x4bd5c1[_0x424b('0x23')]]['id']=this[_0x424b('0xe')][_0x5f06a9]['id'];this[_0x424b('0xd')][_0x4bd5c1['uniqueid']][_0x424b('0x25')]=this[_0x424b('0xe')][_0x5f06a9][_0x424b('0x25')];logger[_0x424b('0x26')](_0x4bd5c1[_0x424b('0x23')],_0x424b('0x27'));}}}}if(this[_0x424b('0x10')][_0x4bd5c1[_0x424b('0x23')]]){this['channels'][_0x4bd5c1[_0x424b('0x23')]]={};this[_0x424b('0xd')][_0x4bd5c1[_0x424b('0x23')]]['channel']=_0x4bd5c1[_0x424b('0x24')];logger[_0x424b('0x26')](_0x4bd5c1[_0x424b('0x23')],'\x20syncNewchannel\x20');}};Fax[_0x424b('0x20')][_0x424b('0x14')]=function(_0x1f8713){if(this[_0x424b('0xd')][_0x1f8713[_0x424b('0x23')]]){for(var _0x29beac in _0x1f8713[_0x424b('0x28')]){if(_0x1f8713[_0x424b('0x28')][_0x424b('0x21')](_0x29beac)){this['channels'][_0x1f8713[_0x424b('0x23')]][_0x29beac]=_0x1f8713[_0x424b('0x29')];}}}};Fax[_0x424b('0x20')][_0x424b('0x17')]=function(_0xc6dfc){if(this[_0x424b('0xd')][_0xc6dfc[_0x424b('0x23')]]){this[_0x424b('0xd')][_0xc6dfc[_0x424b('0x23')]]['channelstate']=_0xc6dfc['channelstate'];this['channels'][_0xc6dfc[_0x424b('0x23')]][_0x424b('0x2a')]=_0xc6dfc['channelstatedesc'];}};Fax[_0x424b('0x20')]['syncNewExten']=function(_0x2cf691){if(this['channels'][_0x2cf691[_0x424b('0x23')]]){for(var _0x486e29 in _0x2cf691['variable']){if(_0x2cf691[_0x424b('0x28')][_0x424b('0x21')](_0x486e29)){this['channels'][_0x2cf691[_0x424b('0x23')]][_0x486e29]=_0x2cf691[_0x424b('0x29')];}}}};Fax[_0x424b('0x20')][_0x424b('0x1b')]=function(_0x207867){if(this[_0x424b('0xd')][_0x207867[_0x424b('0x23')]]){this['channels'][_0x207867[_0x424b('0x23')]][_0x424b('0x2b')]=_0x207867[_0x424b('0x2b')];this[_0x424b('0xd')][_0x207867[_0x424b('0x23')]][_0x424b('0x2c')]=_0x207867[_0x424b('0x2c')];this['channels'][_0x207867[_0x424b('0x23')]]['localstationid']=_0x207867['localstationid'];this[_0x424b('0xd')][_0x207867[_0x424b('0x23')]]['filename']=_0x207867[_0x424b('0x2d')];logger[_0x424b('0x26')](_0x207867[_0x424b('0x23')],_0x424b('0x2e'));}};Fax[_0x424b('0x20')][_0x424b('0x1d')]=function(_0x599408){var _0x7e8e9c=this;if(this[_0x424b('0xd')][_0x599408[_0x424b('0x23')]]){var _0x5458fc=this['channels'][_0x599408[_0x424b('0x23')]]['id'];this[_0x424b('0xd')][_0x599408[_0x424b('0x23')]][_0x424b('0x2f')]=_0x599408[_0x424b('0x2f')];this[_0x424b('0xd')][_0x599408['uniqueid']][_0x424b('0x30')]=_0x599408[_0x424b('0x30')];this[_0x424b('0xd')][_0x599408[_0x424b('0x23')]][_0x424b('0x31')]=_0x599408[_0x424b('0x31')];this[_0x424b('0xd')][_0x599408[_0x424b('0x23')]]['resolution']=_0x599408['resolution'];this[_0x424b('0xd')][_0x599408[_0x424b('0x23')]]['transferrate']=_0x599408[_0x424b('0x32')];this[_0x424b('0xd')][_0x599408[_0x424b('0x23')]]['filename']=_0x599408[_0x424b('0x2d')];this['channels'][_0x599408[_0x424b('0x23')]][_0x424b('0x33')]=_0x599408['calleridnum'];if(this['channels'][_0x599408[_0x424b('0x23')]][_0x424b('0x30')]>0x0){tiff2pdf(_0x599408[_0x424b('0x2d')],_0x424b('0x34'),function(_0x54863b){logger[_0x424b('0x26')](_0x599408[_0x424b('0x23')],'\x20result\x20conversion\x20file\x20',_0x54863b[_0x424b('0x35')]);attachment[_0x424b('0x36')]({'name':path[_0x424b('0x37')](_0x599408[_0x424b('0x2d')])[_0x424b('0x25')],'basename':path[_0x424b('0x37')](_0x599408[_0x424b('0x2d')])[_0x424b('0x25')]+'.pdf','type':_0x424b('0x38')})['then'](function(_0x10d322){faxAccount[_0x424b('0x39')](_0x5458fc,{'from':_0x599408[_0x424b('0x33')],'mapKey':_0x424b('0x3a'),'body':path[_0x424b('0x37')](_0x599408[_0x424b('0x2d')])[_0x424b('0x25')]+_0x424b('0x3b'),'AttachmentId':_0x10d322['id']})['catch'](function(_0xd94f0d){logger[_0x424b('0x3c')](_0x599408[_0x424b('0x23')],_0x424b('0x3d'),JSON[_0x424b('0x3e')](_0xd94f0d));});})[_0x424b('0x3f')](function(_0x1d6f68){logger[_0x424b('0x3c')](_0x599408[_0x424b('0x23')],_0x424b('0x40'),JSON['stringify'](_0x1d6f68));});});}logger['info'](_0x599408[_0x424b('0x23')],'\x20receiveFax\x20');}};Fax[_0x424b('0x20')][_0x424b('0x41')]=function(_0x4fcec3){if(this[_0x424b('0x10')][_0x4fcec3[_0x424b('0x23')]]){_[_0x424b('0x42')](this['channels'][_0x4fcec3[_0x424b('0x23')]],_[_0x424b('0x43')](_0x4fcec3,[_0x424b('0x44'),_0x424b('0x45')]));}};function updateStatus(_0x9e9eb5){if(_0x9e9eb5['AttachmentId']){faxMessage[_0x424b('0x46')](_0x9e9eb5[_0x424b('0x47')],{'failMessage':'SENDING\x20FAILED\x20'})[_0x424b('0x48')](function(_0xcde92d){ut['logger'](_0x424b('0x49'),_0xcde92d);})[_0x424b('0x3f')](function(_0x4d0a88){ut['logger'](_0x424b('0x4a'),_0x4d0a88);});}else{ut[_0x424b('0x4b')](_0x424b('0x4c'));}}Fax['prototype'][_0x424b('0x4d')]=function(_0x50a87e,_0x5b751a,_0x5b8907){var _0x3831cd=this;var _0x4ed924={};if(_0x5b751a){_0x4ed924={'read':_0x5b751a};}else{_0x4ed924={'failMessage':_0x5b8907};}if(this[_0x424b('0x10')][_0x50a87e][_0x424b('0x47')]){faxMessage[_0x424b('0x46')](this[_0x424b('0x10')][_0x50a87e][_0x424b('0x47')],_0x4ed924)[_0x424b('0x48')](function(_0x158659){ut['logger']('[Fax][Message][Updated]',_0x158659);})[_0x424b('0x3f')](function(_0x38a372){ut[_0x424b('0x4b')](_0x424b('0x4e'),_0x38a372);})[_0x424b('0x4f')](function(){delete _0x3831cd[_0x424b('0xd')][_0x50a87e];delete _0x3831cd[_0x424b('0x10')][_0x50a87e];});}else{ut[_0x424b('0x4b')]('[Fax][Message][NoUpdate2]');this[_0x424b('0x50')](_0x50a87e);delete this[_0x424b('0x10')][_0x50a87e];}};Fax[_0x424b('0x20')][_0x424b('0x51')]=function(_0x599ea2){var _0x73e369=this;if(this['channels'][_0x599ea2[_0x424b('0x23')]]){if(this[_0x424b('0x10')][_0x599ea2[_0x424b('0x23')]]){this['channels'][_0x599ea2[_0x424b('0x23')]]['id']=this['actions'][_0x599ea2[_0x424b('0x23')]]['id'];this[_0x424b('0xd')][_0x599ea2[_0x424b('0x23')]][_0x424b('0x25')]=this[_0x424b('0x10')][_0x599ea2['uniqueid']][_0x424b('0x25')];}logger['info'](_0x599ea2[_0x424b('0x23')],this['actions'][_0x599ea2[_0x424b('0x23')]]?_0x424b('0x52'):_0x424b('0x53'),JSON[_0x424b('0x3e')](this[_0x424b('0xd')][_0x599ea2[_0x424b('0x23')]]));if(this[_0x424b('0x10')][_0x599ea2[_0x424b('0x23')]]){if(this[_0x424b('0xd')][_0x599ea2[_0x424b('0x23')]][_0x424b('0x54')]>0x0&&this[_0x424b('0xd')][_0x599ea2[_0x424b('0x23')]][_0x424b('0x1a')]===_0x424b('0x55')){this['updateStatus'](_0x599ea2[_0x424b('0x23')],!![]);}else{this[_0x424b('0x4d')](_0x599ea2[_0x424b('0x23')],![],this['channels'][_0x599ea2['uniqueid']]['faxstatusstring']?'SENDING\x20FAILED:\x20'+this[_0x424b('0xd')][_0x599ea2[_0x424b('0x23')]][_0x424b('0x56')]:_0x424b('0x57'));}}}};Fax[_0x424b('0x20')][_0x424b('0x58')]=function(_0x5563b7){var _0x2bae42=this;return new BPromise(function(_0xa62330,_0x36d97f){_0x2bae42[_0x424b('0x59')](_0x5563b7,_0x2bae42[_0x424b('0xe')][_0x5563b7[_0x424b('0x5a')]])[_0x424b('0x48')](function(_0x1f44b2){ut['logger'](_0x424b('0x5b'),_0x1f44b2);_0xa62330(ut['message'](_0x424b('0x5c')));})['catch'](function(_0x1b9fbb){ut[_0x424b('0x4b')](_0x424b('0x5d'),_0x1b9fbb);updateStatus(_0x5563b7);_0x36d97f(ut['message'](_0x424b('0x5e')));});});};Fax[_0x424b('0x20')][_0x424b('0x5f')]=function(_0x4d130d){var _0x14033d=this;return new BPromise(function(_0x3f9437,_0x2d1f07){var _0x2212f7=_0x14033d['checkTrunk'](_0x14033d['faxAccounts'][_0x4d130d[_0x424b('0x5a')]][_0x424b('0x60')],_0x4d130d);if(_0x2212f7[_0x424b('0x61')]){_0x3f9437(ut[_0x424b('0x35')](_0x424b('0x62')));}else{_0x2d1f07(ut[_0x424b('0x35')](_0x2212f7['message']));}});};function originate(_0x1c6066,_0x5a9324,_0x4bbfb1){return new BPromise(function(_0x57b0c8,_0xb9c4d2){if(_0x4bbfb1){var _0x5d1ca7=util[_0x424b('0x63')](_0x424b('0x64'),path[_0x424b('0x37')](_0x1c6066[_0x424b('0x4')])[_0x424b('0x25')],_0x1c6066['path']);gs[_0x424b('0x65')](_0x5d1ca7)[_0x424b('0x48')](function(){_0x1c6066[_0x424b('0x4')]=util[_0x424b('0x63')](_0x424b('0x66'),path[_0x424b('0x37')](_0x1c6066[_0x424b('0x4')])[_0x424b('0x67')],path['parse'](_0x1c6066['path'])[_0x424b('0x25')]);_0x5a9324['XMF-PATH']=_0x1c6066['path'];ut[_0x424b('0x4b')](_0x424b('0x68'),'');ami[_0x424b('0x69')](ut['variablesAction'](_0x1c6066,_0x5a9324))[_0x424b('0x48')](function(_0x35631a){_0x57b0c8(_0x35631a);})['catch'](function(_0x5743f8){_0xb9c4d2(_0x5743f8);});})[_0x424b('0x3f')](function(_0x35caf4){_0xb9c4d2(_0x35caf4);});}else{ami[_0x424b('0x69')](ut[_0x424b('0x6a')](_0x1c6066,_0x5a9324))[_0x424b('0x48')](function(_0x3e2d94){_0x57b0c8(_0x3e2d94);})[_0x424b('0x3f')](function(_0x522c9f){_0xb9c4d2(_0x522c9f);});}});}Fax['prototype'][_0x424b('0x59')]=function(_0x36c35d,_0x537a51){var _0x36ea90=this;return new BPromise(function(_0x3ba9ab,_0x45202a){var _0x102789=uuid['v4']();var _0x487483=ut[_0x424b('0x6b')](_0x36c35d,_0x537a51);_0x36ea90[_0x424b('0x10')][_0x102789]=new Action(_0x102789,_0x537a51,_0x36c35d);var _0x420e9a=_0x36ea90[_0x424b('0x10')][_0x102789];if(path[_0x424b('0x37')](_0x36c35d[_0x424b('0x4')])[_0x424b('0x6c')]===_0x424b('0x3b')){originate(_0x420e9a,_0x487483,!![])[_0x424b('0x48')](function(_0x62a6bf){_0x3ba9ab(_0x62a6bf);})[_0x424b('0x3f')](function(_0x1f2add){_0x45202a(_0x1f2add);});}else{originate(_0x420e9a,_0x487483,![])[_0x424b('0x48')](function(_0x4f857b){_0x3ba9ab(_0x4f857b);})[_0x424b('0x3f')](function(_0x531291){_0x45202a(_0x531291);});}});};Fax[_0x424b('0x20')][_0x424b('0x6d')]=function(_0x3cd863){return!_[_0x424b('0x6e')](_0x3cd863)&&!_['isNil'](_0x3cd863['name'])&&!_[_0x424b('0x6e')](_0x3cd863[_0x424b('0x6f')])&&_0x3cd863['active']&&!_[_0x424b('0x6e')](this['trunks'][util[_0x424b('0x63')](_0x424b('0x70'),_0x3cd863[_0x424b('0x25')])])&&!_[_0x424b('0x6e')](this['trunks'][util[_0x424b('0x63')]('SIP/%s',_0x3cd863['name'])][_0x424b('0x2c')])&&(this[_0x424b('0xf')][util['format'](_0x424b('0x70'),_0x3cd863['name'])][_0x424b('0x2c')]==='reachable'||this[_0x424b('0xf')][util[_0x424b('0x63')]('SIP/%s',_0x3cd863[_0x424b('0x25')])][_0x424b('0x2c')]===_0x424b('0x71'));};Fax[_0x424b('0x20')][_0x424b('0x72')]=function(_0x4096f4,_0x3a1d0e){if(!this['isTrunkReachable'](_0x4096f4)){ut[_0x424b('0x4b')](_0x424b('0x73'),_[_0x424b('0x6e')](_0x4096f4)?'':_0x4096f4[_0x424b('0x25')]+_0x424b('0x74'));return{'isValid':![],'message':_0x424b('0x75')};}if(_['isNil'](_0x3a1d0e[_0x424b('0x3a')])){ut[_0x424b('0x4b')](_0x424b('0x76'),JSON[_0x424b('0x3e')](_0x3a1d0e));return{'isValid':![],'message':_0x424b('0x77')};}if(_[_0x424b('0x6e')](_0x3a1d0e['path'])){ut[_0x424b('0x4b')](_0x424b('0x78'),JSON['stringify'](_0x3a1d0e));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0x424b('0x79')};};Fax[_0x424b('0x20')][_0x424b('0x50')]=function(_0x50e546,_0x249795=0x2710){if(this['channels'][_0x50e546]){setTimeout(()=>{delete this[_0x424b('0xd')][_0x50e546];},_0x249795);}};module[_0x424b('0x7a')]=Fax; \ No newline at end of file +var _0xadaf=['Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','syncNewchannel','bind','newstate','syncNewState','newexten','syncNewExten','syncFaxStatus','receivefax','syncReceiveFax','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','\x20syncNewchannel\x20','actions','info','syncVarSet','variable','channelstate','channelstatedesc','value','operation','status','filename','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','create','parse','.pdf','then','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','update','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','faxstatus','SUCCESS','updateStatus','SENDING\x20FAILED:\x20','faxstatusstring','SENDING\x20FAILED','send','FaxAccountId','[Fax][execOriginate][success]','message','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','Trunk','Trunk\x20Reachable','execute','format','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','execOriginate','addVariables','ext','isNil','active','SIP/%s','reachable','unmonitored','checkTrunk','isTrunkReachable','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]'];(function(_0x5beac4,_0x1f71d2){var _0x488a46=function(_0x3e72fa){while(--_0x3e72fa){_0x5beac4['push'](_0x5beac4['shift']());}};_0x488a46(++_0x1f71d2);}(_0xadaf,0x1e5));var _0xfada=function(_0x8f3e58,_0x304560){_0x8f3e58=_0x8f3e58-0x0;var _0x142ba0=_0xadaf[_0x8f3e58];return _0x142ba0;};'use strict';var util=require(_0xfada('0x0'));var _=require(_0xfada('0x1'));var BPromise=require(_0xfada('0x2'));var uuid=require(_0xfada('0x3'));var moment=require(_0xfada('0x4'));var path=require(_0xfada('0x5'));var tiff2pdf=require(_0xfada('0x6'));var gs=require(_0xfada('0x7'));var logger=require(_0xfada('0x8'))(_0xfada('0x9'));var ami=require(_0xfada('0xa'));var rpcDb=require(_0xfada('0xb'));var Channel=require('./channel');var ut=require(_0xfada('0xc'));var Action=require(_0xfada('0xd'));var faxAccount=require(_0xfada('0xe'));var attachment=require(_0xfada('0xf'));var faxMessage=require(_0xfada('0x10'));function Fax(_0x3895f3){this[_0xfada('0x11')]={};this[_0xfada('0x12')]=_0x3895f3[_0xfada('0x12')];this[_0xfada('0x13')]=_0x3895f3[_0xfada('0x13')];this['actions']={};ami['on']('newchannel',this[_0xfada('0x14')][_0xfada('0x15')](this));ami['on']('varset',this['syncVarSet'][_0xfada('0x15')](this));ami['on'](_0xfada('0x16'),this[_0xfada('0x17')][_0xfada('0x15')](this));ami['on'](_0xfada('0x18'),this[_0xfada('0x19')][_0xfada('0x15')](this));ami['on']('faxstatus',this[_0xfada('0x1a')][_0xfada('0x15')](this));ami['on'](_0xfada('0x1b'),this[_0xfada('0x1c')][_0xfada('0x15')](this));ami['on']('hangup',this[_0xfada('0x1d')][_0xfada('0x15')](this));ami['on'](_0xfada('0x1e'),this[_0xfada('0x1f')][_0xfada('0x15')](this));}Fax[_0xfada('0x20')][_0xfada('0x14')]=function(_0x4e1b6d){if(_0x4e1b6d[_0xfada('0x21')]===_0xfada('0x22')){for(var _0x15314b in this[_0xfada('0x12')]){if(this[_0xfada('0x12')][_0xfada('0x23')](_0x15314b)){if(_0x4e1b6d[_0xfada('0x24')]===this[_0xfada('0x12')][_0x15314b][_0xfada('0x25')]){this[_0xfada('0x11')][_0x4e1b6d[_0xfada('0x26')]]={};this[_0xfada('0x11')][_0x4e1b6d['uniqueid']][_0xfada('0x27')]=_0x4e1b6d[_0xfada('0x27')];this['channels'][_0x4e1b6d[_0xfada('0x26')]]['id']=this['faxAccounts'][_0x15314b]['id'];this['channels'][_0x4e1b6d[_0xfada('0x26')]][_0xfada('0x28')]=this[_0xfada('0x12')][_0x15314b][_0xfada('0x28')];logger['info'](_0x4e1b6d[_0xfada('0x26')],_0xfada('0x29'));}}}}if(this[_0xfada('0x2a')][_0x4e1b6d[_0xfada('0x26')]]){this[_0xfada('0x11')][_0x4e1b6d[_0xfada('0x26')]]={};this[_0xfada('0x11')][_0x4e1b6d['uniqueid']][_0xfada('0x27')]=_0x4e1b6d[_0xfada('0x27')];logger[_0xfada('0x2b')](_0x4e1b6d[_0xfada('0x26')],_0xfada('0x29'));}};Fax[_0xfada('0x20')][_0xfada('0x2c')]=function(_0x3b606f){if(this['channels'][_0x3b606f['uniqueid']]){for(var _0x2aecef in _0x3b606f['variable']){if(_0x3b606f[_0xfada('0x2d')][_0xfada('0x23')](_0x2aecef)){this[_0xfada('0x11')][_0x3b606f[_0xfada('0x26')]][_0x2aecef]=_0x3b606f['value'];}}}};Fax[_0xfada('0x20')][_0xfada('0x17')]=function(_0x4b598){if(this['channels'][_0x4b598[_0xfada('0x26')]]){this[_0xfada('0x11')][_0x4b598[_0xfada('0x26')]][_0xfada('0x2e')]=_0x4b598[_0xfada('0x2e')];this[_0xfada('0x11')][_0x4b598['uniqueid']][_0xfada('0x2f')]=_0x4b598[_0xfada('0x2f')];}};Fax[_0xfada('0x20')][_0xfada('0x19')]=function(_0x14edf5){if(this['channels'][_0x14edf5[_0xfada('0x26')]]){for(var _0x15d87e in _0x14edf5[_0xfada('0x2d')]){if(_0x14edf5['variable'][_0xfada('0x23')](_0x15d87e)){this[_0xfada('0x11')][_0x14edf5[_0xfada('0x26')]][_0x15d87e]=_0x14edf5[_0xfada('0x30')];}}}};Fax[_0xfada('0x20')]['syncFaxStatus']=function(_0x280b6d){if(this['channels'][_0x280b6d[_0xfada('0x26')]]){this[_0xfada('0x11')][_0x280b6d[_0xfada('0x26')]][_0xfada('0x31')]=_0x280b6d['operation'];this['channels'][_0x280b6d[_0xfada('0x26')]][_0xfada('0x32')]=_0x280b6d[_0xfada('0x32')];this['channels'][_0x280b6d['uniqueid']][_0xfada('0x25')]=_0x280b6d['localstationid'];this[_0xfada('0x11')][_0x280b6d[_0xfada('0x26')]][_0xfada('0x33')]=_0x280b6d['filename'];logger[_0xfada('0x2b')](_0x280b6d['uniqueid'],'\x20syncFaxStatus\x20');}};Fax['prototype'][_0xfada('0x1c')]=function(_0x890e0b){var _0x2e1a60=this;if(this[_0xfada('0x11')][_0x890e0b['uniqueid']]){var _0xffa01b=this[_0xfada('0x11')][_0x890e0b['uniqueid']]['id'];this['channels'][_0x890e0b['uniqueid']]['remotestationid']=_0x890e0b[_0xfada('0x34')];this['channels'][_0x890e0b[_0xfada('0x26')]]['pagestransferred']=_0x890e0b[_0xfada('0x35')];this[_0xfada('0x11')][_0x890e0b[_0xfada('0x26')]][_0xfada('0x25')]=_0x890e0b[_0xfada('0x25')];this[_0xfada('0x11')][_0x890e0b[_0xfada('0x26')]][_0xfada('0x36')]=_0x890e0b[_0xfada('0x36')];this[_0xfada('0x11')][_0x890e0b[_0xfada('0x26')]][_0xfada('0x37')]=_0x890e0b[_0xfada('0x37')];this['channels'][_0x890e0b[_0xfada('0x26')]][_0xfada('0x33')]=_0x890e0b[_0xfada('0x33')];this['channels'][_0x890e0b[_0xfada('0x26')]][_0xfada('0x38')]=_0x890e0b['calleridnum'];if(this['channels'][_0x890e0b[_0xfada('0x26')]]['pagestransferred']>0x0){tiff2pdf(_0x890e0b[_0xfada('0x33')],'/var/opt/motion2/server/files/attachments/',function(_0x154dc9){logger[_0xfada('0x2b')](_0x890e0b['uniqueid'],_0xfada('0x39'),_0x154dc9['message']);attachment[_0xfada('0x3a')]({'name':path[_0xfada('0x3b')](_0x890e0b[_0xfada('0x33')])[_0xfada('0x28')],'basename':path[_0xfada('0x3b')](_0x890e0b[_0xfada('0x33')])[_0xfada('0x28')]+_0xfada('0x3c'),'type':'application/pdf'})[_0xfada('0x3d')](function(_0x361a59){faxAccount[_0xfada('0x3e')](_0xffa01b,{'from':_0x890e0b['calleridnum'],'mapKey':_0xfada('0x9'),'body':path['parse'](_0x890e0b['filename'])[_0xfada('0x28')]+'.pdf','AttachmentId':_0x361a59['id']})[_0xfada('0x3f')](function(_0x28751b){logger[_0xfada('0x40')](_0x890e0b[_0xfada('0x26')],_0xfada('0x41'),JSON[_0xfada('0x42')](_0x28751b));});})[_0xfada('0x3f')](function(_0x5bcb39){logger[_0xfada('0x40')](_0x890e0b['uniqueid'],'\x20receiveFax\x20',JSON[_0xfada('0x42')](_0x5bcb39));});});}logger['info'](_0x890e0b[_0xfada('0x26')],_0xfada('0x43'));}};Fax[_0xfada('0x20')][_0xfada('0x1f')]=function(_0x2352b6){if(this[_0xfada('0x2a')][_0x2352b6[_0xfada('0x26')]]){_[_0xfada('0x44')](this[_0xfada('0x11')][_0x2352b6[_0xfada('0x26')]],_[_0xfada('0x45')](_0x2352b6,['response','reason']));}};function updateStatus(_0x28a680){if(_0x28a680['AttachmentId']){faxMessage[_0xfada('0x46')](_0x28a680[_0xfada('0x47')],{'failMessage':_0xfada('0x48')})[_0xfada('0x3d')](function(_0x2312eb){ut[_0xfada('0x49')]('[Fax][Message][Error][Updated]',_0x2312eb);})[_0xfada('0x3f')](function(_0xf3af24){ut[_0xfada('0x49')](_0xfada('0x4a'),_0xf3af24);});}else{ut[_0xfada('0x49')]('[Fax][Message][Error][NoUpdate2]');}}Fax[_0xfada('0x20')]['updateStatus']=function(_0x599129,_0x1ce541,_0x28b981){var _0x121f20=this;var _0x3bc793={};if(_0x1ce541){_0x3bc793={'read':_0x1ce541};}else{_0x3bc793={'failMessage':_0x28b981};}if(this[_0xfada('0x2a')][_0x599129]['AttachmentId']){faxMessage[_0xfada('0x46')](this['actions'][_0x599129][_0xfada('0x47')],_0x3bc793)[_0xfada('0x3d')](function(_0x7d476e){ut[_0xfada('0x49')](_0xfada('0x4b'),_0x7d476e);})['catch'](function(_0x152ab5){ut['logger'](_0xfada('0x4c'),_0x152ab5);})['finally'](function(){delete _0x121f20[_0xfada('0x11')][_0x599129];delete _0x121f20[_0xfada('0x2a')][_0x599129];});}else{ut['logger']('[Fax][Message][NoUpdate2]');this['deleteChannelAfterTimeout'](_0x599129);delete this[_0xfada('0x2a')][_0x599129];}};Fax[_0xfada('0x20')][_0xfada('0x1d')]=function(_0xaec4b0){var _0x4923d=this;if(this[_0xfada('0x11')][_0xaec4b0[_0xfada('0x26')]]){if(this[_0xfada('0x2a')][_0xaec4b0[_0xfada('0x26')]]){this[_0xfada('0x11')][_0xaec4b0['uniqueid']]['id']=this[_0xfada('0x2a')][_0xaec4b0[_0xfada('0x26')]]['id'];this[_0xfada('0x11')][_0xaec4b0[_0xfada('0x26')]][_0xfada('0x28')]=this[_0xfada('0x2a')][_0xaec4b0['uniqueid']][_0xfada('0x28')];}logger[_0xfada('0x2b')](_0xaec4b0[_0xfada('0x26')],this['actions'][_0xaec4b0[_0xfada('0x26')]]?_0xfada('0x4d'):_0xfada('0x4e'),JSON[_0xfada('0x42')](this[_0xfada('0x11')][_0xaec4b0['uniqueid']]));if(this['actions'][_0xaec4b0[_0xfada('0x26')]]){if(this[_0xfada('0x11')][_0xaec4b0[_0xfada('0x26')]][_0xfada('0x4f')]>0x0&&this[_0xfada('0x11')][_0xaec4b0['uniqueid']][_0xfada('0x50')]===_0xfada('0x51')){this[_0xfada('0x52')](_0xaec4b0[_0xfada('0x26')],!![]);}else{this[_0xfada('0x52')](_0xaec4b0[_0xfada('0x26')],![],this[_0xfada('0x11')][_0xaec4b0[_0xfada('0x26')]]['faxstatusstring']?_0xfada('0x53')+this['channels'][_0xaec4b0[_0xfada('0x26')]][_0xfada('0x54')]:_0xfada('0x55'));}}}};Fax['prototype'][_0xfada('0x56')]=function(_0x912cb0){var _0x38c2fa=this;return new BPromise(function(_0x160fde,_0x228fbb){_0x38c2fa['execOriginate'](_0x912cb0,_0x38c2fa[_0xfada('0x12')][_0x912cb0[_0xfada('0x57')]])[_0xfada('0x3d')](function(_0x40b0ba){ut['logger'](_0xfada('0x58'),_0x40b0ba);_0x160fde(ut[_0xfada('0x59')](_0xfada('0x5a')));})[_0xfada('0x3f')](function(_0x32bfc1){ut[_0xfada('0x49')](_0xfada('0x5b'),_0x32bfc1);updateStatus(_0x912cb0);_0x228fbb(ut['message'](_0xfada('0x5c')));});});};Fax[_0xfada('0x20')][_0xfada('0x5d')]=function(_0x3ec73a){var _0x392b22=this;return new BPromise(function(_0x33763a,_0x13075c){var _0x211748=_0x392b22['checkTrunk'](_0x392b22[_0xfada('0x12')][_0x3ec73a['FaxAccountId']][_0xfada('0x5e')],_0x3ec73a);if(_0x211748['isValid']){_0x33763a(ut[_0xfada('0x59')](_0xfada('0x5f')));}else{_0x13075c(ut[_0xfada('0x59')](_0x211748[_0xfada('0x59')]));}});};function originate(_0x246d20,_0x3cd2bb,_0xf8b83b){return new BPromise(function(_0x407f07,_0x2a5f6d){if(_0xf8b83b){var _0x6e3085=util['format']('gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit',path[_0xfada('0x3b')](_0x246d20[_0xfada('0x5')])[_0xfada('0x28')],_0x246d20[_0xfada('0x5')]);gs[_0xfada('0x60')](_0x6e3085)[_0xfada('0x3d')](function(){_0x246d20['path']=util[_0xfada('0x61')]('%s/%s.tif',path[_0xfada('0x3b')](_0x246d20[_0xfada('0x5')])['dir'],path[_0xfada('0x3b')](_0x246d20[_0xfada('0x5')])['name']);_0x3cd2bb[_0xfada('0x62')]=_0x246d20[_0xfada('0x5')];ut['logger'](_0xfada('0x63'),'');ami[_0xfada('0x64')](ut[_0xfada('0x65')](_0x246d20,_0x3cd2bb))[_0xfada('0x3d')](function(_0x4bd4af){_0x407f07(_0x4bd4af);})[_0xfada('0x3f')](function(_0x3b2608){_0x2a5f6d(_0x3b2608);});})[_0xfada('0x3f')](function(_0x35d2c8){_0x2a5f6d(_0x35d2c8);});}else{ami[_0xfada('0x64')](ut[_0xfada('0x65')](_0x246d20,_0x3cd2bb))[_0xfada('0x3d')](function(_0x2ab338){_0x407f07(_0x2ab338);})[_0xfada('0x3f')](function(_0x22dd3f){_0x2a5f6d(_0x22dd3f);});}});}Fax[_0xfada('0x20')][_0xfada('0x66')]=function(_0x3bb90f,_0x327850){var _0x4319e8=this;return new BPromise(function(_0x2d1954,_0x309a66){var _0x2b369b=uuid['v4']();var _0x4bcaf9=ut[_0xfada('0x67')](_0x3bb90f,_0x327850);_0x4319e8[_0xfada('0x2a')][_0x2b369b]=new Action(_0x2b369b,_0x327850,_0x3bb90f);var _0x1f8f51=_0x4319e8['actions'][_0x2b369b];if(path['parse'](_0x3bb90f['path'])[_0xfada('0x68')]===_0xfada('0x3c')){originate(_0x1f8f51,_0x4bcaf9,!![])['then'](function(_0x33d69e){_0x2d1954(_0x33d69e);})[_0xfada('0x3f')](function(_0x3c8e61){_0x309a66(_0x3c8e61);});}else{originate(_0x1f8f51,_0x4bcaf9,![])[_0xfada('0x3d')](function(_0x2c4f16){_0x2d1954(_0x2c4f16);})[_0xfada('0x3f')](function(_0x35465c){_0x309a66(_0x35465c);});}});};Fax[_0xfada('0x20')]['isTrunkReachable']=function(_0x5845ff){return!_[_0xfada('0x69')](_0x5845ff)&&!_[_0xfada('0x69')](_0x5845ff['name'])&&!_[_0xfada('0x69')](_0x5845ff[_0xfada('0x6a')])&&_0x5845ff['active']&&!_[_0xfada('0x69')](this['trunks'][util[_0xfada('0x61')](_0xfada('0x6b'),_0x5845ff['name'])])&&!_[_0xfada('0x69')](this[_0xfada('0x13')][util[_0xfada('0x61')](_0xfada('0x6b'),_0x5845ff[_0xfada('0x28')])][_0xfada('0x32')])&&(this['trunks'][util[_0xfada('0x61')](_0xfada('0x6b'),_0x5845ff[_0xfada('0x28')])]['status']===_0xfada('0x6c')||this[_0xfada('0x13')][util['format'](_0xfada('0x6b'),_0x5845ff[_0xfada('0x28')])][_0xfada('0x32')]===_0xfada('0x6d'));};Fax[_0xfada('0x20')][_0xfada('0x6e')]=function(_0x54033d,_0x45867c){if(!this[_0xfada('0x6f')](_0x54033d)){ut[_0xfada('0x49')]('[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]',_[_0xfada('0x69')](_0x54033d)?'':_0x54033d[_0xfada('0x28')]+_0xfada('0x70'));return{'isValid':![],'message':_0xfada('0x71')};}if(_[_0xfada('0x69')](_0x45867c[_0xfada('0x9')])){ut[_0xfada('0x49')](_0xfada('0x72'),JSON[_0xfada('0x42')](_0x45867c));return{'isValid':![],'message':_0xfada('0x73')};}if(_[_0xfada('0x69')](_0x45867c[_0xfada('0x5')])){ut[_0xfada('0x49')](_0xfada('0x74'),JSON['stringify'](_0x45867c));return{'isValid':![],'message':_0xfada('0x75')};}return{'isValid':!![],'message':_0xfada('0x76')};};Fax[_0xfada('0x20')]['deleteChannelAfterTimeout']=function(_0x3938c7,_0x1f301a=0x2710){if(this[_0xfada('0x11')][_0x3938c7]){setTimeout(()=>{delete this[_0xfada('0x11')][_0x3938c7];},_0x1f301a);}};module[_0xfada('0x77')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index ad1cb2b..0c71108 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 _0x3aa8=['[Notify]\x20','util','bluebird','../../../config/logger','preview','lodash','resolve','then','catch'];(function(_0x461e0c,_0x1ee235){var _0x76010a=function(_0x260604){while(--_0x260604){_0x461e0c['push'](_0x461e0c['shift']());}};_0x76010a(++_0x1ee235);}(_0x3aa8,0x6d));var _0x83aa=function(_0x5b19d9,_0x738c35){_0x5b19d9=_0x5b19d9-0x0;var _0x392218=_0x3aa8[_0x5b19d9];return _0x392218;};'use strict';var util=require(_0x83aa('0x0'));var BPromise=require(_0x83aa('0x1'));var logger=require(_0x83aa('0x2'))(_0x83aa('0x3'));var _=require(_0x83aa('0x4'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x553cdd){return function(_0x19ffbb){logger['error'](_0x553cdd,util['inspect'](_0x19ffbb,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x4186a7,_0x176a5b){return BPromise[_0x83aa('0x5')]()[_0x83aa('0x6')](faxAccount['notify'](_0x4186a7,_0x176a5b))[_0x83aa('0x7')](loggerCatch(_0x83aa('0x8')));}; \ No newline at end of file +var _0x2c83=['util','bluebird','../../../config/logger','preview','../rpc/faxAccount','inspect','notify','then','catch'];(function(_0x547fea,_0x1012b5){var _0x15dfe3=function(_0x377c8f){while(--_0x377c8f){_0x547fea['push'](_0x547fea['shift']());}};_0x15dfe3(++_0x1012b5);}(_0x2c83,0x1dd));var _0x32c8=function(_0x2c9b5f,_0x35de67){_0x2c9b5f=_0x2c9b5f-0x0;var _0x321a60=_0x2c83[_0x2c9b5f];return _0x321a60;};'use strict';var util=require(_0x32c8('0x0'));var BPromise=require(_0x32c8('0x1'));var logger=require(_0x32c8('0x2'))(_0x32c8('0x3'));var _=require('lodash');var faxAccount=require(_0x32c8('0x4'));function loggerCatch(_0x381109){return function(_0xb40d10){logger['error'](_0x381109,util[_0x32c8('0x5')](_0xb40d10,{'showHidden':![],'depth':null}));};}exports[_0x32c8('0x6')]=function(_0x17a028,_0x5112a8){return BPromise['resolve']()[_0x32c8('0x7')](faxAccount['notify'](_0x17a028,_0x5112a8))[_0x32c8('0x8')](loggerCatch('[Notify]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index 1f840b3..f6f9060 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 _0x7319=['util','fax','child_process','exec','Exec\x20gs','info','inspect'];(function(_0xf0bc07,_0x510ebf){var _0x1c50c2=function(_0x2e2bdf){while(--_0x2e2bdf){_0xf0bc07['push'](_0xf0bc07['shift']());}};_0x1c50c2(++_0x510ebf);}(_0x7319,0x1c7));var _0x9731=function(_0x298621,_0x1d2180){_0x298621=_0x298621-0x0;var _0x564b62=_0x7319[_0x298621];return _0x564b62;};'use strict';var util=require(_0x9731('0x0'));var logger=require('../../../../config/logger')(_0x9731('0x1'));var BPromise=require('bluebird');var exec=require(_0x9731('0x2'))[_0x9731('0x3')];exports['execute']=function(_0x4048ec){return new BPromise(function(_0x20403f,_0x35b615){exec(_0x4048ec,function(_0x2c0e48,_0x32c0fa,_0x11db81){logger['info'](_0x9731('0x4'),_0x32c0fa);if(_0x2c0e48){logger[_0x9731('0x5')]('Exec\x20gs','\x20Error\x20:',util[_0x9731('0x6')](_0x2c0e48,{'showHidden':![],'depth':null}),_0x32c0fa,_0x11db81);_0x35b615(_0x2c0e48);}_0x20403f(_0x32c0fa);});});}; \ No newline at end of file +var _0x7d60=['inspect','util','../../../../config/logger','exec','info','Exec\x20gs'];(function(_0x4d69af,_0x479ebe){var _0x3f3b94=function(_0x27f104){while(--_0x27f104){_0x4d69af['push'](_0x4d69af['shift']());}};_0x3f3b94(++_0x479ebe);}(_0x7d60,0x199));var _0x07d6=function(_0x2cf1db,_0x322a8b){_0x2cf1db=_0x2cf1db-0x0;var _0x2aea4a=_0x7d60[_0x2cf1db];return _0x2aea4a;};'use strict';var util=require(_0x07d6('0x0'));var logger=require(_0x07d6('0x1'))('fax');var BPromise=require('bluebird');var exec=require('child_process')[_0x07d6('0x2')];exports['execute']=function(_0x1f4d14){return new BPromise(function(_0x59ac61,_0x2218a9){exec(_0x1f4d14,function(_0x462227,_0x48d2d5,_0x3b4383){logger[_0x07d6('0x3')](_0x07d6('0x4'),_0x48d2d5);if(_0x462227){logger[_0x07d6('0x3')](_0x07d6('0x4'),'\x20Error\x20:',util[_0x07d6('0x5')](_0x462227,{'showHidden':![],'depth':null}),_0x48d2d5,_0x3b4383);_0x2218a9(_0x462227);}_0x59ac61(_0x48d2d5);});});}; \ No newline at end of file diff --git a/server/services/ami/fax/util/util.js b/server/services/ami/fax/util/util.js index 1bb3c98..84f1cac 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 _0xc233=['path','variablesAction','uniqueid','originate','channel','from-sip','util','lodash','moment','../../../../config/logger','message','logger','addVariables','ecm','headerinfo','format','\x22%s\x22','modem','gateway','faxdetect','t38timeout','localstationid'];(function(_0x2ee285,_0x611be5){var _0x32e656=function(_0x1a63fb){while(--_0x1a63fb){_0x2ee285['push'](_0x2ee285['shift']());}};_0x32e656(++_0x611be5);}(_0xc233,0x150));var _0x3c23=function(_0x4b4b0e,_0x6c674){_0x4b4b0e=_0x4b4b0e-0x0;var _0x4c2d91=_0xc233[_0x4b4b0e];return _0x4c2d91;};'use strict';var util=require(_0x3c23('0x0'));var _=require(_0x3c23('0x1'));var moment=require(_0x3c23('0x2'));var logger=require(_0x3c23('0x3'))('fax');exports[_0x3c23('0x4')]=function(_0x32d930){return{'message':_0x32d930};};exports[_0x3c23('0x5')]=function(_0x701268,_0x292d11){logger['info'](_0x701268,util['inspect'](_0x292d11,{'showHidden':![],'depth':null}));};exports[_0x3c23('0x6')]=function(_0x4e41fc,_0x3da577){var _0x1c362c={'XMF-ECM':_0x3da577[_0x3c23('0x7')],'XMF-HEADERINFO':_0x3da577[_0x3c23('0x8')],'XMF-MINRATE':_0x3da577['minrate'],'XMF-MAXRATE':_0x3da577['maxrate'],'XMF-MODEM':util[_0x3c23('0x9')](_0x3c23('0xa'),_0x3da577[_0x3c23('0xb')]),'XMF-GATEWAY':_0x3da577[_0x3c23('0xc')],'XMF-FAXDETECT':_0x3da577[_0x3c23('0xd')],'XMF-T38TIMEOUT':_0x3da577[_0x3c23('0xe')],'XMF-LOCALSTATIONID':_0x3da577[_0x3c23('0xf')],'XMF-PATH':_0x4e41fc[_0x3c23('0x10')]};return _0x1c362c;};exports[_0x3c23('0x11')]=function(_0x19de56,_0x4318d2){return{'actionid':_0x19de56[_0x3c23('0x12')],'action':_0x3c23('0x13'),'channel':_0x19de56[_0x3c23('0x14')],'Exten':'xcally-motion-fax','Context':_0x3c23('0x15'),'Priority':'1','callerid':util['format']('\x22%s\x22\x20<%s>',_0x19de56[_0x3c23('0x8')]?_0x19de56[_0x3c23('0x8')]:'',_0x19de56[_0x3c23('0xf')]),'variable':_0x4318d2,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x19de56['uniqueid']};}; \ No newline at end of file +var _0xc3a9=['maxrate','\x22%s\x22','modem','gateway','faxdetect','localstationid','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip','format','\x22%s\x22\x20<%s>','lodash','../../../../config/logger','fax','logger','info','inspect','addVariables','headerinfo','minrate'];(function(_0x96ad7d,_0x1017ba){var _0x32d63a=function(_0xb47ad9){while(--_0xb47ad9){_0x96ad7d['push'](_0x96ad7d['shift']());}};_0x32d63a(++_0x1017ba);}(_0xc3a9,0x6f));var _0x9c3a=function(_0x62c235,_0x53f660){_0x62c235=_0x62c235-0x0;var _0x279029=_0xc3a9[_0x62c235];return _0x279029;};'use strict';var util=require('util');var _=require(_0x9c3a('0x0'));var moment=require('moment');var logger=require(_0x9c3a('0x1'))(_0x9c3a('0x2'));exports['message']=function(_0x461870){return{'message':_0x461870};};exports[_0x9c3a('0x3')]=function(_0x2b1d39,_0x571dde){logger[_0x9c3a('0x4')](_0x2b1d39,util[_0x9c3a('0x5')](_0x571dde,{'showHidden':![],'depth':null}));};exports[_0x9c3a('0x6')]=function(_0x198e04,_0x53c1b){var _0x3909c8={'XMF-ECM':_0x53c1b['ecm'],'XMF-HEADERINFO':_0x53c1b[_0x9c3a('0x7')],'XMF-MINRATE':_0x53c1b[_0x9c3a('0x8')],'XMF-MAXRATE':_0x53c1b[_0x9c3a('0x9')],'XMF-MODEM':util['format'](_0x9c3a('0xa'),_0x53c1b[_0x9c3a('0xb')]),'XMF-GATEWAY':_0x53c1b[_0x9c3a('0xc')],'XMF-FAXDETECT':_0x53c1b[_0x9c3a('0xd')],'XMF-T38TIMEOUT':_0x53c1b['t38timeout'],'XMF-LOCALSTATIONID':_0x53c1b[_0x9c3a('0xe')],'XMF-PATH':_0x198e04[_0x9c3a('0xf')]};return _0x3909c8;};exports[_0x9c3a('0x10')]=function(_0x2fc9ce,_0x3b1d84){return{'actionid':_0x2fc9ce[_0x9c3a('0x11')],'action':_0x9c3a('0x12'),'channel':_0x2fc9ce[_0x9c3a('0x13')],'Exten':_0x9c3a('0x14'),'Context':_0x9c3a('0x15'),'Priority':'1','callerid':util[_0x9c3a('0x16')](_0x9c3a('0x17'),_0x2fc9ce[_0x9c3a('0x7')]?_0x2fc9ce[_0x9c3a('0x7')]:'',_0x2fc9ce[_0x9c3a('0xe')]),'variable':_0x3b1d84,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x2fc9ce[_0x9c3a('0x11')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 43dc839..7920b6a 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 _0xfe42=['getFreshsalesAccounts','initFreshsalesAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','getVoiceExtensions','initVoiceExtensions','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','[index.js][initParams]','listen','[index.js][main]','util','./server','./realtime','./report','./trigger','./dialer','./preview','./rpc/user','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/trunk','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','resolve','getAgents','then','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts'];(function(_0x3e32b1,_0x487a75){var _0x419327=function(_0x6ad6a3){while(--_0x6ad6a3){_0x3e32b1['push'](_0x3e32b1['shift']());}};_0x419327(++_0x487a75);}(_0xfe42,0x13a));var _0x2fe4=function(_0x1ca333,_0x15d833){_0x1ca333=_0x1ca333-0x0;var _0x2d34bc=_0xfe42[_0x1ca333];return _0x2d34bc;};'use strict';var util=require(_0x2fe4('0x0'));var moment=require('moment');var server=require(_0x2fe4('0x1'));var Realtime=require(_0x2fe4('0x2'));var Report=require(_0x2fe4('0x3'));var Acw=require('./acw');var Trigger=require(_0x2fe4('0x4'));var Dialer=require(_0x2fe4('0x5'));var Preview=require(_0x2fe4('0x6'));var Fax=require('./fax');var user=require(_0x2fe4('0x7'));var voiceQueue=require(_0x2fe4('0x8'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0x2fe4('0x9'));var trunk=require(_0x2fe4('0xa'));var trigger=require('./rpc/trigger');var template=require('./rpc/template');var cmHopperHistory=require(_0x2fe4('0xb'));var campaign=require(_0x2fe4('0xc'));var voiceExtension=require(_0x2fe4('0xd'));var faxAccount=require(_0x2fe4('0xe'));var zendesk=require(_0x2fe4('0xf'));var salesforce=require(_0x2fe4('0x10'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0x2fe4('0x11'));var desk=require(_0x2fe4('0x12'));var zoho=require(_0x2fe4('0x13'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0x2fe4('0x14'));var servicenow=require(_0x2fe4('0x15'));var dynamics365=require(_0x2fe4('0x16'));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')('ami');var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x2fe4('0x17')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x2fe4('0x17')](_0x2fe4('0x18'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x2fe4('0x19')]()['then'](user[_0x2fe4('0x1a')]())[_0x2fe4('0x1b')](realtime['initAgents']())[_0x2fe4('0x1b')](user[_0x2fe4('0x1c')]())[_0x2fe4('0x1b')](realtime[_0x2fe4('0x1d')]())[_0x2fe4('0x1b')](trunk[_0x2fe4('0x1e')]())[_0x2fe4('0x1b')](realtime[_0x2fe4('0x1f')]())[_0x2fe4('0x1b')](voiceQueue[_0x2fe4('0x20')]())[_0x2fe4('0x1b')](realtime['initVoiceQueues']())[_0x2fe4('0x1b')](trigger[_0x2fe4('0x21')]())[_0x2fe4('0x1b')](realtime[_0x2fe4('0x22')]())[_0x2fe4('0x1b')](template[_0x2fe4('0x23')]())[_0x2fe4('0x1b')](realtime[_0x2fe4('0x24')]())[_0x2fe4('0x1b')](zendesk[_0x2fe4('0x25')]())['then'](realtime[_0x2fe4('0x26')]())['then'](salesforce[_0x2fe4('0x27')]())[_0x2fe4('0x1b')](realtime[_0x2fe4('0x28')]())[_0x2fe4('0x1b')](sugarcrm[_0x2fe4('0x29')]())['then'](realtime[_0x2fe4('0x2a')]())[_0x2fe4('0x1b')](freshdesk[_0x2fe4('0x2b')]())[_0x2fe4('0x1b')](realtime[_0x2fe4('0x2c')]())[_0x2fe4('0x1b')](desk[_0x2fe4('0x2d')]())[_0x2fe4('0x1b')](realtime[_0x2fe4('0x2e')]())[_0x2fe4('0x1b')](zoho[_0x2fe4('0x2f')]())[_0x2fe4('0x1b')](realtime[_0x2fe4('0x30')]())[_0x2fe4('0x1b')](vtiger[_0x2fe4('0x31')]())[_0x2fe4('0x1b')](realtime[_0x2fe4('0x32')]())['then'](freshsales[_0x2fe4('0x33')]())[_0x2fe4('0x1b')](realtime[_0x2fe4('0x34')]())[_0x2fe4('0x1b')](servicenow['getServicenowAccounts']())[_0x2fe4('0x1b')](realtime[_0x2fe4('0x35')]())[_0x2fe4('0x1b')](dynamics365[_0x2fe4('0x36')]())['then'](realtime[_0x2fe4('0x37')]())[_0x2fe4('0x1b')](campaign[_0x2fe4('0x38')]())['then'](realtime['initCampaigns']())[_0x2fe4('0x1b')](voiceExtension[_0x2fe4('0x39')]())[_0x2fe4('0x1b')](realtime[_0x2fe4('0x3a')]())[_0x2fe4('0x1b')](faxAccount['getFaxAccounts']())[_0x2fe4('0x1b')](realtime[_0x2fe4('0x3b')]())['then'](function(){return realtime;});}function initParams(){return Promise[_0x2fe4('0x19')]()[_0x2fe4('0x1b')](voiceQueueReport[_0x2fe4('0x3c')]())[_0x2fe4('0x1b')](realtime[_0x2fe4('0x3d')]())[_0x2fe4('0x1b')](cmHopperHistory[_0x2fe4('0x3e')]())[_0x2fe4('0x1b')](realtime[_0x2fe4('0x3f')]())[_0x2fe4('0x1b')](cmHopperHistory[_0x2fe4('0x40')]())[_0x2fe4('0x1b')](realtime[_0x2fe4('0x41')]())['then'](voiceCallReport[_0x2fe4('0x42')]())[_0x2fe4('0x1b')](realtime[_0x2fe4('0x43')]())[_0x2fe4('0x44')](function(_0x318480){logger[_0x2fe4('0x45')](_0x2fe4('0x46'),util['inspect'](_0x318480,{'showHidden':![],'depth':null}));});}function main(){return server[_0x2fe4('0x47')](realtime,preview,fax)[_0x2fe4('0x1b')](function(){return initRealtime();})['then'](function(){return initParams();})[_0x2fe4('0x1b')](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0x2fe4('0x44')](function(_0xb1d490){logger[_0x2fe4('0x45')](_0x2fe4('0x48'),util['inspect'](_0xb1d490,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x81e2=['initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','error','[index.js][initParams]','inspect','listen','[index.js][main]','util','moment','./server','./realtime','./acw','./trigger','./dialer','./preview','./fax','./rpc/voiceQueueReport','./rpc/trunk','./rpc/trigger','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/servicenow','../../config/logger','get','hour','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initZohoAccounts','getVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','initVoiceExtensions','getFaxAccounts','initFaxAccounts','resolve','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','getCampaignHopperHistory'];(function(_0x24cc3e,_0x3b2f20){var _0x299210=function(_0x19e3f5){while(--_0x19e3f5){_0x24cc3e['push'](_0x24cc3e['shift']());}};_0x299210(++_0x3b2f20);}(_0x81e2,0x120));var _0x281e=function(_0x4b295a,_0x4cf6f0){_0x4b295a=_0x4b295a-0x0;var _0x4881f7=_0x81e2[_0x4b295a];return _0x4881f7;};'use strict';var util=require(_0x281e('0x0'));var moment=require(_0x281e('0x1'));var server=require(_0x281e('0x2'));var Realtime=require(_0x281e('0x3'));var Report=require('./report');var Acw=require(_0x281e('0x4'));var Trigger=require(_0x281e('0x5'));var Dialer=require(_0x281e('0x6'));var Preview=require(_0x281e('0x7'));var Fax=require(_0x281e('0x8'));var user=require('./rpc/user');var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0x281e('0x9'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0x281e('0xa'));var trigger=require(_0x281e('0xb'));var template=require('./rpc/template');var cmHopperHistory=require(_0x281e('0xc'));var campaign=require(_0x281e('0xd'));var voiceExtension=require(_0x281e('0xe'));var faxAccount=require(_0x281e('0xf'));var zendesk=require(_0x281e('0x10'));var salesforce=require(_0x281e('0x11'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0x281e('0x12'));var desk=require(_0x281e('0x13'));var zoho=require(_0x281e('0x14'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0x281e('0x15'));var dynamics365=require('./rpc/integrations/dynamics365');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x281e('0x16'))('ami');var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x281e('0x17')](_0x281e('0x18'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x281e('0x17')](_0x281e('0x18'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise['resolve']()[_0x281e('0x19')](user[_0x281e('0x1a')]())[_0x281e('0x19')](realtime[_0x281e('0x1b')]())['then'](user[_0x281e('0x1c')]())[_0x281e('0x19')](realtime[_0x281e('0x1d')]())[_0x281e('0x19')](trunk[_0x281e('0x1e')]())['then'](realtime[_0x281e('0x1f')]())['then'](voiceQueue[_0x281e('0x20')]())[_0x281e('0x19')](realtime['initVoiceQueues']())[_0x281e('0x19')](trigger[_0x281e('0x21')]())[_0x281e('0x19')](realtime[_0x281e('0x22')]())[_0x281e('0x19')](template[_0x281e('0x23')]())[_0x281e('0x19')](realtime[_0x281e('0x24')]())[_0x281e('0x19')](zendesk[_0x281e('0x25')]())[_0x281e('0x19')](realtime[_0x281e('0x26')]())[_0x281e('0x19')](salesforce[_0x281e('0x27')]())[_0x281e('0x19')](realtime[_0x281e('0x28')]())['then'](sugarcrm[_0x281e('0x29')]())[_0x281e('0x19')](realtime[_0x281e('0x2a')]())[_0x281e('0x19')](freshdesk[_0x281e('0x2b')]())['then'](realtime['initFreshdeskAccounts']())[_0x281e('0x19')](desk['getDeskAccounts']())[_0x281e('0x19')](realtime['initDeskAccounts']())['then'](zoho['getZohoAccounts']())[_0x281e('0x19')](realtime[_0x281e('0x2c')]())[_0x281e('0x19')](vtiger[_0x281e('0x2d')]())[_0x281e('0x19')](realtime['initVtigerAccounts']())['then'](freshsales[_0x281e('0x2e')]())[_0x281e('0x19')](realtime[_0x281e('0x2f')]())[_0x281e('0x19')](servicenow[_0x281e('0x30')]())[_0x281e('0x19')](realtime[_0x281e('0x31')]())[_0x281e('0x19')](dynamics365[_0x281e('0x32')]())[_0x281e('0x19')](realtime[_0x281e('0x33')]())['then'](campaign[_0x281e('0x34')]())['then'](realtime[_0x281e('0x35')]())[_0x281e('0x19')](voiceExtension['getVoiceExtensions']())[_0x281e('0x19')](realtime[_0x281e('0x36')]())[_0x281e('0x19')](faxAccount[_0x281e('0x37')]())[_0x281e('0x19')](realtime[_0x281e('0x38')]())['then'](function(){return realtime;});}function initParams(){return Promise[_0x281e('0x39')]()['then'](voiceQueueReport[_0x281e('0x3a')]())[_0x281e('0x19')](realtime[_0x281e('0x3b')]())[_0x281e('0x19')](cmHopperHistory[_0x281e('0x3c')]())[_0x281e('0x19')](realtime['initVoiceQueueHopperHistory']())[_0x281e('0x19')](cmHopperHistory[_0x281e('0x3d')]())['then'](realtime[_0x281e('0x3e')]())[_0x281e('0x19')](voiceCallReport[_0x281e('0x3f')]())[_0x281e('0x19')](realtime[_0x281e('0x40')]())['catch'](function(_0x3acbfa){logger[_0x281e('0x41')](_0x281e('0x42'),util[_0x281e('0x43')](_0x3acbfa,{'showHidden':![],'depth':null}));});}function main(){return server[_0x281e('0x44')](realtime,preview,fax)['then'](function(){return initRealtime();})[_0x281e('0x19')](function(){return initParams();})[_0x281e('0x19')](function(){report['sync']();setInterval(initRealtime,0x1388);})['catch'](function(_0x1a4f0d){logger[_0x281e('0x41')](_0x281e('0x45'),util['inspect'](_0x1a4f0d,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 728c6f1..1ec64f5 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 _0xa37a=['onhold','local','prototype','updateStatusRealtime','state','toLowerCase','not_inuse','idle','inuse','talking','statePause','toNumber','status','voiceStatusCallerIdNumber','stringify','format','emit','omit','user:presence','util','moment','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','unknown','address','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusQueue'];(function(_0x119629,_0x246787){var _0x49a771=function(_0x23624c){while(--_0x23624c){_0x119629['push'](_0x119629['shift']());}};_0x49a771(++_0x246787);}(_0xa37a,0x103));var _0xaa37=function(_0xcd1e07,_0x597ff3){_0xcd1e07=_0xcd1e07-0x0;var _0x13aa26=_0xa37a[_0xcd1e07];return _0x13aa26;};'use strict';var _=require('lodash');var util=require(_0xaa37('0x0'));var moment=require(_0xaa37('0x1'));var md5=require(_0xaa37('0x2'));var Redis=require(_0xaa37('0x3'));var config=require(_0xaa37('0x4'));config[_0xaa37('0x5')]=_[_0xaa37('0x6')](config['redis'],{'host':_0xaa37('0x7'),'port':0x18eb});var io=require(_0xaa37('0x8'))(new Redis(config[_0xaa37('0x5')]));function Agent(_0x3ef290){this['id']=_0x3ef290['id']||0x0;this[_0xaa37('0x9')]=_0x3ef290[_0xaa37('0x9')]||'';this[_0xaa37('0xa')]=_0x3ef290[_0xaa37('0xa')]||'';this['accountcode']=_0x3ef290[_0xaa37('0xb')]||'';this[_0xaa37('0xc')]=_0x3ef290['fullname']||'';this['state']='unknown';this['stateTime']=0x0;this['status']=_0xaa37('0xd');this[_0xaa37('0xe')]='';this['phone']='';this[_0xaa37('0xf')]='';this[_0xaa37('0x10')]='';this['online']=_0x3ef290[_0xaa37('0x11')]||![];this[_0xaa37('0x12')]='unknown';this[_0xaa37('0x13')]=0x0;this['voiceStatusCallerIdNumber']='';this[_0xaa37('0x14')]='';this[_0xaa37('0x15')]=![];this[_0xaa37('0x16')]=![];this[_0xaa37('0x2')]='';}Agent[_0xaa37('0x17')][_0xaa37('0x18')]=function(_0x472514){var _0x5384f1;if(_0x472514&&_0x472514[_0xaa37('0x19')]){_0x5384f1=_0x472514[_0xaa37('0x19')][_0xaa37('0x1a')]();switch(_0x5384f1){case _0xaa37('0x1b'):_0x5384f1=_0xaa37('0x1c');break;case _0xaa37('0x1d'):_0x5384f1=_0xaa37('0x1e');break;}}if(_0x5384f1&&this[_0xaa37('0x12')]!==_0x5384f1||_0x472514[_0xaa37('0x1f')]){this[_0xaa37('0x13')]=_[_0xaa37('0x20')](moment()['format']('x'));}if(_0x5384f1){this['voiceStatus']=_0x5384f1;}var _0x2f1501={'id':this['id'],'name':this['name'],'email':this[_0xaa37('0xa')],'accountcode':this['accountcode'],'fullname':this[_0xaa37('0xc')],'state':this[_0xaa37('0x19')],'stateTime':this['stateTime'],'status':this[_0xaa37('0x21')],'address':this[_0xaa37('0xe')],'online':this[_0xaa37('0x11')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this[_0xaa37('0x22')],'voiceStatusQueue':this[_0xaa37('0x14')],'interface':this[_0xaa37('0x10')],'onhold':this[_0xaa37('0x15')]};var _0x4652e6=md5(JSON[_0xaa37('0x23')](_0x2f1501));if(this[_0xaa37('0x2')]!==_0x4652e6){this[_0xaa37('0x2')]=_0x4652e6;io['to'](util[_0xaa37('0x24')]('user:%s',_0x2f1501[_0xaa37('0x9')]))[_0xaa37('0x25')]('user:ami:update',_[_0xaa37('0x26')](_0x2f1501,[_0xaa37('0x11')]));io[_0xaa37('0x25')](_0xaa37('0x27'),_0x2f1501);}};module['exports']=Agent; \ No newline at end of file +var _0xa258=['unknown','stateTime','status','address','phone','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','local','updateStatusRealtime','toLowerCase','talking','statePause','format','interface','user:%s','emit','user:ami:update','omit','user:presence','exports','lodash','moment','md5','../../../config/environment','defaults','redis','socket.io-emitter','name','email','accountcode','fullname','state'];(function(_0xdc2360,_0x4d5eaf){var _0x3e1264=function(_0x42c729){while(--_0x42c729){_0xdc2360['push'](_0xdc2360['shift']());}};_0x3e1264(++_0x4d5eaf);}(_0xa258,0xa3));var _0x8a25=function(_0x36039d,_0x2a8cd1){_0x36039d=_0x36039d-0x0;var _0x37b073=_0xa258[_0x36039d];return _0x37b073;};'use strict';var _=require(_0x8a25('0x0'));var util=require('util');var moment=require(_0x8a25('0x1'));var md5=require(_0x8a25('0x2'));var Redis=require('ioredis');var config=require(_0x8a25('0x3'));config['redis']=_[_0x8a25('0x4')](config[_0x8a25('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x8a25('0x6'))(new Redis(config['redis']));function Agent(_0x5c67b8){this['id']=_0x5c67b8['id']||0x0;this[_0x8a25('0x7')]=_0x5c67b8['name']||'';this[_0x8a25('0x8')]=_0x5c67b8[_0x8a25('0x8')]||'';this[_0x8a25('0x9')]=_0x5c67b8['accountcode']||'';this[_0x8a25('0xa')]=_0x5c67b8['fullname']||'';this[_0x8a25('0xb')]=_0x8a25('0xc');this[_0x8a25('0xd')]=0x0;this[_0x8a25('0xe')]=_0x8a25('0xc');this[_0x8a25('0xf')]='';this[_0x8a25('0x10')]='';this['mobile']='';this['interface']='';this[_0x8a25('0x11')]=_0x5c67b8[_0x8a25('0x11')]||![];this[_0x8a25('0x12')]=_0x8a25('0xc');this[_0x8a25('0x13')]=0x0;this[_0x8a25('0x14')]='';this[_0x8a25('0x15')]='';this['onhold']=![];this[_0x8a25('0x16')]=![];this['md5']='';}Agent['prototype'][_0x8a25('0x17')]=function(_0x30db50){var _0x3ecc4a;if(_0x30db50&&_0x30db50[_0x8a25('0xb')]){_0x3ecc4a=_0x30db50['state'][_0x8a25('0x18')]();switch(_0x3ecc4a){case'not_inuse':_0x3ecc4a='idle';break;case'inuse':_0x3ecc4a=_0x8a25('0x19');break;}}if(_0x3ecc4a&&this[_0x8a25('0x12')]!==_0x3ecc4a||_0x30db50[_0x8a25('0x1a')]){this['voiceStatusTime']=_['toNumber'](moment()[_0x8a25('0x1b')]('x'));}if(_0x3ecc4a){this['voiceStatus']=_0x3ecc4a;}var _0x2f8de0={'id':this['id'],'name':this[_0x8a25('0x7')],'email':this[_0x8a25('0x8')],'accountcode':this[_0x8a25('0x9')],'fullname':this[_0x8a25('0xa')],'state':this[_0x8a25('0xb')],'stateTime':this['stateTime'],'status':this[_0x8a25('0xe')],'address':this['address'],'online':this['online'],'voiceStatus':this[_0x8a25('0x12')],'voiceStatusTime':this[_0x8a25('0x13')],'voiceStatusCallerIdNumber':this[_0x8a25('0x14')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0x8a25('0x1c')],'onhold':this['onhold']};var _0x3dc64f=md5(JSON['stringify'](_0x2f8de0));if(this['md5']!==_0x3dc64f){this[_0x8a25('0x2')]=_0x3dc64f;io['to'](util['format'](_0x8a25('0x1d'),_0x2f8de0[_0x8a25('0x7')]))[_0x8a25('0x1e')](_0x8a25('0x1f'),_[_0x8a25('0x20')](_0x2f8de0,[_0x8a25('0x11')]));io[_0x8a25('0x1e')](_0x8a25('0x21'),_0x2f8de0);}};module[_0x8a25('0x22')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index bbd4e5f..1846c1e 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 _0x5d62=['limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','ivrTotalCallsDays','message','sendMessageOneNotActive','active'];(function(_0x50653b,_0x565ab3){var _0x446b45=function(_0x280f9f){while(--_0x280f9f){_0x50653b['push'](_0x50653b['shift']());}};_0x446b45(++_0x565ab3);}(_0x5d62,0x1d8));var _0x25d6=function(_0x240f9d,_0x1a9975){_0x240f9d=_0x240f9d-0x0;var _0x430385=_0x5d62[_0x240f9d];return _0x430385;};'use strict';function Campaign(_0xa4b9f){this['id']=_0xa4b9f['id']||0x0;this[_0x25d6('0x0')]=_0xa4b9f[_0x25d6('0x0')]||'';this[_0x25d6('0x1')]=_0xa4b9f['type']||_0x25d6('0x2');this[_0x25d6('0x3')]=0x0;this['temp']=0x0;this['ivrAnswerCallsDay']=0x0;this[_0x25d6('0x4')]=0x0;this[_0x25d6('0x5')]='';this[_0x25d6('0x6')]=!![];this[_0x25d6('0x7')]=_0xa4b9f[_0x25d6('0x7')];this[_0x25d6('0x8')]=_0xa4b9f[_0x25d6('0x8')];this[_0x25d6('0x9')]=_0xa4b9f['dialTimezone']||null;this[_0x25d6('0xa')]=_0xa4b9f[_0x25d6('0xa')]?_0xa4b9f[_0x25d6('0xa')]:null;this[_0x25d6('0xb')]=_0xa4b9f[_0x25d6('0xb')];this[_0x25d6('0xc')]=_0xa4b9f[_0x25d6('0xc')];this[_0x25d6('0xd')]=_0xa4b9f[_0x25d6('0xd')]||0x1e;this[_0x25d6('0xe')]=_0xa4b9f['dialCongestionMaxRetry'];this[_0x25d6('0xf')]=_0xa4b9f[_0x25d6('0xf')];this['dialBusyMaxRetry']=_0xa4b9f[_0x25d6('0x10')];this[_0x25d6('0x11')]=_0xa4b9f[_0x25d6('0x11')];this[_0x25d6('0x12')]=_0xa4b9f[_0x25d6('0x12')];this[_0x25d6('0x13')]=_0xa4b9f[_0x25d6('0x13')];this[_0x25d6('0x14')]=_0xa4b9f[_0x25d6('0x14')];this[_0x25d6('0x15')]=_0xa4b9f['dialNoSuchNumberMaxRetry']||0x3;this[_0x25d6('0x16')]=_0xa4b9f[_0x25d6('0x16')]||0x96;this[_0x25d6('0x17')]=_0xa4b9f['dialDropMaxRetry']||0x3;this['dialDropRetryFrequency']=_0xa4b9f[_0x25d6('0x18')]||0x96;this[_0x25d6('0x19')]=_0xa4b9f['dialAbandonedMaxRetry']||0x3;this[_0x25d6('0x1a')]=_0xa4b9f[_0x25d6('0x1a')]||0x96;this['dialMachineMaxRetry']=_0xa4b9f['dialMachineMaxRetry']||0x3;this[_0x25d6('0x1b')]=_0xa4b9f['dialMachineRetryFrequency']||0x96;this[_0x25d6('0x1c')]=_0xa4b9f[_0x25d6('0x1c')]||0x3;this['dialAgentRejectRetryFrequency']=_0xa4b9f[_0x25d6('0x1d')]||0x96;this['dialOrderByScheduledAt']=_0xa4b9f['dialOrderByScheduledAt']||'DESC';this[_0x25d6('0x1e')]=_0xa4b9f[_0x25d6('0x1e')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0xa4b9f[_0x25d6('0x1f')]||undefined;this[_0x25d6('0x20')]=_0xa4b9f[_0x25d6('0x20')]||undefined;this['TrunkBackup']=_0xa4b9f['TrunkBackup']?_0xa4b9f[_0x25d6('0x21')]:undefined;this[_0x25d6('0x22')]=_0xa4b9f['Trunk']?_0xa4b9f[_0x25d6('0x22')]:undefined;this[_0x25d6('0x23')]=_0xa4b9f[_0x25d6('0x23')]?_0xa4b9f[_0x25d6('0x23')]:undefined;this['SquareProject']=_0xa4b9f[_0x25d6('0x24')]?_0xa4b9f[_0x25d6('0x24')]:undefined;this[_0x25d6('0x25')]=_0xa4b9f['SquareProject']?_0xa4b9f[_0x25d6('0x24')][_0x25d6('0x0')]:undefined;this[_0x25d6('0x26')]=_0xa4b9f[_0x25d6('0x26')]||![];this['dialAMDInitialSilence']=_0xa4b9f['dialAMDInitialSilence'];this[_0x25d6('0x27')]=_0xa4b9f[_0x25d6('0x27')];this[_0x25d6('0x28')]=_0xa4b9f[_0x25d6('0x28')];this[_0x25d6('0x29')]=_0xa4b9f['dialAMDTotalAnalysisTime'];this[_0x25d6('0x2a')]=_0xa4b9f[_0x25d6('0x2a')];this['dialAMDBetweenWordsSilence']=_0xa4b9f[_0x25d6('0x2b')];this[_0x25d6('0x2c')]=_0xa4b9f[_0x25d6('0x2c')];this[_0x25d6('0x2d')]=_0xa4b9f['dialAMDSilenceThreshold'];this[_0x25d6('0x2e')]=_0xa4b9f[_0x25d6('0x2e')];}module[_0x25d6('0x2f')]=Campaign; \ No newline at end of file +var _0x29a8=['active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive'];(function(_0x7bd342,_0x132b66){var _0x16ab5c=function(_0x1fba30){while(--_0x1fba30){_0x7bd342['push'](_0x7bd342['shift']());}};_0x16ab5c(++_0x132b66);}(_0x29a8,0x97));var _0x829a=function(_0x3b2f28,_0xef1370){_0x3b2f28=_0x3b2f28-0x0;var _0x192dd4=_0x29a8[_0x3b2f28];return _0x192dd4;};'use strict';function Campaign(_0x416ddf){this['id']=_0x416ddf['id']||0x0;this[_0x829a('0x0')]=_0x416ddf[_0x829a('0x0')]||'';this[_0x829a('0x1')]=_0x416ddf[_0x829a('0x1')]||_0x829a('0x2');this[_0x829a('0x3')]=0x0;this['temp']=0x0;this[_0x829a('0x4')]=0x0;this[_0x829a('0x5')]=0x0;this[_0x829a('0x6')]='';this[_0x829a('0x7')]=!![];this[_0x829a('0x8')]=_0x416ddf[_0x829a('0x8')];this[_0x829a('0x9')]=_0x416ddf['limitCalls'];this[_0x829a('0xa')]=_0x416ddf[_0x829a('0xa')]||null;this[_0x829a('0xb')]=_0x416ddf[_0x829a('0xb')]?_0x416ddf[_0x829a('0xb')]:null;this['dialOriginateCallerIdName']=_0x416ddf[_0x829a('0xc')];this[_0x829a('0xd')]=_0x416ddf[_0x829a('0xd')];this[_0x829a('0xe')]=_0x416ddf[_0x829a('0xe')]||0x1e;this[_0x829a('0xf')]=_0x416ddf[_0x829a('0xf')];this[_0x829a('0x10')]=_0x416ddf[_0x829a('0x10')];this[_0x829a('0x11')]=_0x416ddf[_0x829a('0x11')];this[_0x829a('0x12')]=_0x416ddf[_0x829a('0x12')];this['dialNoAnswerMaxRetry']=_0x416ddf[_0x829a('0x13')];this[_0x829a('0x14')]=_0x416ddf[_0x829a('0x14')];this[_0x829a('0x15')]=_0x416ddf['dialGlobalMaxRetry'];this[_0x829a('0x16')]=_0x416ddf['dialNoSuchNumberMaxRetry']||0x3;this[_0x829a('0x17')]=_0x416ddf[_0x829a('0x17')]||0x96;this[_0x829a('0x18')]=_0x416ddf[_0x829a('0x18')]||0x3;this[_0x829a('0x19')]=_0x416ddf[_0x829a('0x19')]||0x96;this[_0x829a('0x1a')]=_0x416ddf[_0x829a('0x1a')]||0x3;this[_0x829a('0x1b')]=_0x416ddf[_0x829a('0x1b')]||0x96;this[_0x829a('0x1c')]=_0x416ddf[_0x829a('0x1c')]||0x3;this[_0x829a('0x1d')]=_0x416ddf['dialMachineRetryFrequency']||0x96;this[_0x829a('0x1e')]=_0x416ddf[_0x829a('0x1e')]||0x3;this[_0x829a('0x1f')]=_0x416ddf[_0x829a('0x1f')]||0x96;this[_0x829a('0x20')]=_0x416ddf['dialOrderByScheduledAt']||_0x829a('0x21');this[_0x829a('0x22')]=_0x416ddf[_0x829a('0x22')]||undefined;this[_0x829a('0x23')]=_0x416ddf['dialRandomLastDigitCallerIdNumber']||undefined;this['dialCutDigit']=_0x416ddf[_0x829a('0x24')]||undefined;this['TrunkBackup']=_0x416ddf[_0x829a('0x25')]?_0x416ddf['TrunkBackup']:undefined;this[_0x829a('0x26')]=_0x416ddf['Trunk']?_0x416ddf[_0x829a('0x26')]:undefined;this['Interval']=_0x416ddf[_0x829a('0x27')]?_0x416ddf[_0x829a('0x27')]:undefined;this[_0x829a('0x28')]=_0x416ddf[_0x829a('0x28')]?_0x416ddf['SquareProject']:undefined;this[_0x829a('0x29')]=_0x416ddf['SquareProject']?_0x416ddf[_0x829a('0x28')][_0x829a('0x0')]:undefined;this[_0x829a('0x2a')]=_0x416ddf['dialAMDActive']||![];this[_0x829a('0x2b')]=_0x416ddf[_0x829a('0x2b')];this['dialAMDGreeting']=_0x416ddf[_0x829a('0x2c')];this[_0x829a('0x2d')]=_0x416ddf[_0x829a('0x2d')];this['dialAMDTotalAnalysisTime']=_0x416ddf[_0x829a('0x2e')];this['dialAMDMinWordLength']=_0x416ddf[_0x829a('0x2f')];this[_0x829a('0x30')]=_0x416ddf[_0x829a('0x30')];this[_0x829a('0x31')]=_0x416ddf[_0x829a('0x31')];this[_0x829a('0x32')]=_0x416ddf[_0x829a('0x32')];this[_0x829a('0x33')]=_0x416ddf['dialAMDMaximumWordLength'];}module[_0x829a('0x34')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 683624e..0f27a66 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 _0x5eef=['uniqueid','linkedid','endtime','unmanaged','lastapplication','lastdata','duration','billableseconds','holdtime','type','tag','disposition','monitor','monitorFilename','monitors','transferconnectedlinenum','mohtime','exports','destinationchannel','calleridname','connectedlinename','accountcode','context'];(function(_0xd7f799,_0x749051){var _0x587c44=function(_0x466581){while(--_0x466581){_0xd7f799['push'](_0xd7f799['shift']());}};_0x587c44(++_0x749051);}(_0x5eef,0x9c));var _0xf5ee=function(_0x42b967,_0x4e0487){_0x42b967=_0x42b967-0x0;var _0x46b836=_0x5eef[_0x42b967];return _0x46b836;};'use strict';function Channel(){this['starttime']=null;this['channel']='';this[_0xf5ee('0x0')]='';this['calleridnum']=0x0;this[_0xf5ee('0x1')]='';this['connectedlinenum']=undefined;this[_0xf5ee('0x2')]=undefined;this[_0xf5ee('0x3')]=0x0;this[_0xf5ee('0x4')]='';this[_0xf5ee('0x5')]=0x0;this[_0xf5ee('0x6')]=0x0;this['exten']=0x0;this['answered']=![];this['answertime']=null;this[_0xf5ee('0x7')]=null;this[_0xf5ee('0x8')]=![];this['abandoned']=![];this[_0xf5ee('0x9')]='';this[_0xf5ee('0xa')]='';this[_0xf5ee('0xb')]=0x0;this[_0xf5ee('0xc')]=0x0;this[_0xf5ee('0xd')]=0x0;this[_0xf5ee('0xe')]=null;this[_0xf5ee('0xf')]=null;this[_0xf5ee('0x10')]=null;this[_0xf5ee('0x11')]=![];this[_0xf5ee('0x12')]=null;this['queue']=null;this[_0xf5ee('0x13')]=[];this['transfercalleridnum']=undefined;this[_0xf5ee('0x14')]=undefined;this['transferType']=undefined;this[_0xf5ee('0x15')]=0x0;}module[_0xf5ee('0x16')]=Channel; \ No newline at end of file +var _0x13ea=['abandoned','lastapplication','lastdata','billableseconds','holdtime','type','tag','disposition','monitorFilename','queue','monitors','transfercalleridnum','transferType','mohtime','exports','destinationchannel','calleridnum','calleridname','connectedlinename','context','linkedid','exten'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x13ea,0xa9));var _0xa13e=function(_0x58f245,_0x3e4f31){_0x58f245=_0x58f245-0x0;var _0x1f0cfb=_0x13ea[_0x58f245];return _0x1f0cfb;};'use strict';function Channel(){this['starttime']=null;this['channel']='';this[_0xa13e('0x0')]='';this[_0xa13e('0x1')]=0x0;this[_0xa13e('0x2')]='';this['connectedlinenum']=undefined;this[_0xa13e('0x3')]=undefined;this['accountcode']=0x0;this[_0xa13e('0x4')]='';this['uniqueid']=0x0;this[_0xa13e('0x5')]=0x0;this[_0xa13e('0x6')]=0x0;this['answered']=![];this['answertime']=null;this['endtime']=null;this['unmanaged']=![];this[_0xa13e('0x7')]=![];this[_0xa13e('0x8')]='';this[_0xa13e('0x9')]='';this['duration']=0x0;this[_0xa13e('0xa')]=0x0;this[_0xa13e('0xb')]=0x0;this[_0xa13e('0xc')]=null;this[_0xa13e('0xd')]=null;this[_0xa13e('0xe')]=null;this['monitor']=![];this[_0xa13e('0xf')]=null;this[_0xa13e('0x10')]=null;this[_0xa13e('0x11')]=[];this[_0xa13e('0x12')]=undefined;this['transferconnectedlinenum']=undefined;this[_0xa13e('0x13')]=undefined;this[_0xa13e('0x14')]=0x0;}module[_0xa13e('0x15')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 3a08673..df086b2 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 _0x76bd=['name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports'];(function(_0x2302e4,_0xf288a8){var _0x542187=function(_0x39da64){while(--_0x39da64){_0x2302e4['push'](_0x2302e4['shift']());}};_0x542187(++_0xf288a8);}(_0x76bd,0x1a0));var _0xd76b=function(_0xc421c1,_0x5528a3){_0xc421c1=_0xc421c1-0x0;var _0x1ee4f1=_0x76bd[_0xc421c1];return _0x1ee4f1;};'use strict';function DeskAccount(_0x2a0cbb){this['id']=_0x2a0cbb['id']||0x0;this[_0xd76b('0x0')]=_0x2a0cbb[_0xd76b('0x0')]||'';this[_0xd76b('0x1')]=_0x2a0cbb[_0xd76b('0x1')]||'';this[_0xd76b('0x2')]=_0x2a0cbb[_0xd76b('0x2')]||'';this[_0xd76b('0x3')]=_0x2a0cbb[_0xd76b('0x3')]||'';this[_0xd76b('0x4')]=_0x2a0cbb[_0xd76b('0x4')]||'';this[_0xd76b('0x5')]=_0x2a0cbb['consumerKey']||'';this[_0xd76b('0x6')]=_0x2a0cbb[_0xd76b('0x6')]||'';this[_0xd76b('0x7')]=_0x2a0cbb['token']||'';this['tokenSecret']=_0x2a0cbb[_0xd76b('0x8')]||'';this[_0xd76b('0x9')]=_0x2a0cbb[_0xd76b('0x9')]||'';this['serverUrl']=_0x2a0cbb[_0xd76b('0xa')]||'';this[_0xd76b('0xb')]=_0x2a0cbb[_0xd76b('0xb')]||{};}module[_0xd76b('0xc')]=DeskAccount; \ No newline at end of file +var _0xad69=['token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','password','consumerKey','consumerSecret'];(function(_0x5045e0,_0x1c3bbc){var _0x9f78f6=function(_0x2d3ebf){while(--_0x2d3ebf){_0x5045e0['push'](_0x5045e0['shift']());}};_0x9f78f6(++_0x1c3bbc);}(_0xad69,0x192));var _0x9ad6=function(_0x9cf6ed,_0x170ee8){_0x9cf6ed=_0x9cf6ed-0x0;var _0x978427=_0xad69[_0x9cf6ed];return _0x978427;};'use strict';function DeskAccount(_0x21c368){this['id']=_0x21c368['id']||0x0;this[_0x9ad6('0x0')]=_0x21c368[_0x9ad6('0x0')]||'';this[_0x9ad6('0x1')]=_0x21c368['username']||'';this['remoteUri']=_0x21c368[_0x9ad6('0x2')]||'';this['authType']=_0x21c368['authType']||'';this[_0x9ad6('0x3')]=_0x21c368[_0x9ad6('0x3')]||'';this['consumerKey']=_0x21c368[_0x9ad6('0x4')]||'';this[_0x9ad6('0x5')]=_0x21c368[_0x9ad6('0x5')]||'';this[_0x9ad6('0x6')]=_0x21c368[_0x9ad6('0x6')]||'';this[_0x9ad6('0x7')]=_0x21c368[_0x9ad6('0x7')]||'';this[_0x9ad6('0x8')]=_0x21c368[_0x9ad6('0x8')]||'';this['serverUrl']=_0x21c368[_0x9ad6('0x9')]||'';this[_0x9ad6('0xa')]=_0x21c368[_0x9ad6('0xa')]||{};}module[_0x9ad6('0xb')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 03b1ab6..5b48ae5 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 _0xd2f2=['name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports'];(function(_0x48922e,_0x11dc07){var _0x5c56d6=function(_0x29512b){while(--_0x29512b){_0x48922e['push'](_0x48922e['shift']());}};_0x5c56d6(++_0x11dc07);}(_0xd2f2,0x108));var _0x2d2f=function(_0x2f3a6b,_0x4a9016){_0x2f3a6b=_0x2f3a6b-0x0;var _0x225b14=_0xd2f2[_0x2f3a6b];return _0x225b14;};'use strict';function Dynamics365Account(_0xebda86){this['id']=_0xebda86['id']||0x0;this['name']=_0xebda86[_0x2d2f('0x0')]||'';this[_0x2d2f('0x1')]=_0xebda86[_0x2d2f('0x1')]||'';this[_0x2d2f('0x2')]=_0xebda86['password']||'';this[_0x2d2f('0x3')]=_0xebda86[_0x2d2f('0x3')]||'';this[_0x2d2f('0x4')]=_0xebda86['tenantId']||'';this['clientId']=_0xebda86[_0x2d2f('0x5')]||'';this['clientSecret']=_0xebda86[_0x2d2f('0x6')]||{};this[_0x2d2f('0x7')]=_0xebda86[_0x2d2f('0x7')]||'';this[_0x2d2f('0x8')]=_0xebda86[_0x2d2f('0x8')]||![];this[_0x2d2f('0x9')]=_0xebda86['Configurations']||{};this[_0x2d2f('0xa')]=_0xebda86['CloudProvider']||{};}module[_0x2d2f('0xb')]=Dynamics365Account; \ No newline at end of file +var _0x8cd6=['exports','name','username','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider'];(function(_0x461e81,_0x48d992){var _0x4e8ceb=function(_0x2f728e){while(--_0x2f728e){_0x461e81['push'](_0x461e81['shift']());}};_0x4e8ceb(++_0x48d992);}(_0x8cd6,0x1a3));var _0x68cd=function(_0x18f6ee,_0x241f93){_0x18f6ee=_0x18f6ee-0x0;var _0x42ac3f=_0x8cd6[_0x18f6ee];return _0x42ac3f;};'use strict';function Dynamics365Account(_0x1d991d){this['id']=_0x1d991d['id']||0x0;this[_0x68cd('0x0')]=_0x1d991d[_0x68cd('0x0')]||'';this[_0x68cd('0x1')]=_0x1d991d['username']||'';this['password']=_0x1d991d['password']||'';this[_0x68cd('0x2')]=_0x1d991d[_0x68cd('0x2')]||'';this[_0x68cd('0x3')]=_0x1d991d[_0x68cd('0x3')]||'';this[_0x68cd('0x4')]=_0x1d991d[_0x68cd('0x4')]||'';this[_0x68cd('0x5')]=_0x1d991d[_0x68cd('0x5')]||{};this['serverUrl']=_0x1d991d[_0x68cd('0x6')]||'';this[_0x68cd('0x7')]=_0x1d991d[_0x68cd('0x7')]||![];this[_0x68cd('0x8')]=_0x1d991d[_0x68cd('0x8')]||{};this[_0x68cd('0x9')]=_0x1d991d[_0x68cd('0x9')]||{};}module[_0x68cd('0xa')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index ff5c3c0..8fee773 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 _0x8b6c=['SIP','Trunk','ListId','key','exports','name','description','ecm','localstationid','maxrate','modem','gateway','t38timeout','tech'];(function(_0x2ee9a9,_0xf80aec){var _0x49bf16=function(_0x56fbe3){while(--_0x56fbe3){_0x2ee9a9['push'](_0x2ee9a9['shift']());}};_0x49bf16(++_0xf80aec);}(_0x8b6c,0x1b7));var _0xc8b6=function(_0x18ff05,_0xf2b320){_0x18ff05=_0x18ff05-0x0;var _0x51382f=_0x8b6c[_0x18ff05];return _0x51382f;};'use strict';function FaxAccount(_0x1db8db){this['id']=_0x1db8db['id']||0x0;this[_0xc8b6('0x0')]=_0x1db8db['name']||'';this[_0xc8b6('0x1')]=_0x1db8db[_0xc8b6('0x1')];this[_0xc8b6('0x2')]=_0x1db8db[_0xc8b6('0x2')];this['headerinfo']=_0x1db8db['headerinfo'];this['localstationid']=_0x1db8db[_0xc8b6('0x3')];this['minrate']=_0x1db8db['minrate']||0x960;this['maxrate']=_0x1db8db[_0xc8b6('0x4')]||0x3840;this[_0xc8b6('0x5')]=_0x1db8db[_0xc8b6('0x5')]||'v17,v27,v29';this['gateway']=_0x1db8db[_0xc8b6('0x6')]||'no';this['faxdetect']=_0x1db8db['faxdetect']||'no';this[_0xc8b6('0x7')]=_0x1db8db[_0xc8b6('0x7')]||0x1388;this[_0xc8b6('0x8')]=_0x1db8db['tech']||_0xc8b6('0x9');this[_0xc8b6('0xa')]=_0x1db8db[_0xc8b6('0xa')]?_0x1db8db[_0xc8b6('0xa')]:undefined;this[_0xc8b6('0xb')]=_0x1db8db[_0xc8b6('0xb')];this[_0xc8b6('0xc')]=_0x1db8db[_0xc8b6('0xc')];}module[_0xc8b6('0xd')]=FaxAccount; \ No newline at end of file +var _0x3d45=['t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','maxrate','modem','v17,v27,v29','gateway','faxdetect'];(function(_0x58175c,_0x2d9373){var _0x55b88f=function(_0x13ed84){while(--_0x13ed84){_0x58175c['push'](_0x58175c['shift']());}};_0x55b88f(++_0x2d9373);}(_0x3d45,0x1d2));var _0x53d4=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x3d45[_0x297fd3];return _0x2af381;};'use strict';function FaxAccount(_0x2001c1){this['id']=_0x2001c1['id']||0x0;this[_0x53d4('0x0')]=_0x2001c1[_0x53d4('0x0')]||'';this[_0x53d4('0x1')]=_0x2001c1[_0x53d4('0x1')];this['ecm']=_0x2001c1[_0x53d4('0x2')];this[_0x53d4('0x3')]=_0x2001c1['headerinfo'];this[_0x53d4('0x4')]=_0x2001c1['localstationid'];this['minrate']=_0x2001c1['minrate']||0x960;this['maxrate']=_0x2001c1[_0x53d4('0x5')]||0x3840;this[_0x53d4('0x6')]=_0x2001c1[_0x53d4('0x6')]||_0x53d4('0x7');this[_0x53d4('0x8')]=_0x2001c1['gateway']||'no';this[_0x53d4('0x9')]=_0x2001c1[_0x53d4('0x9')]||'no';this[_0x53d4('0xa')]=_0x2001c1['t38timeout']||0x1388;this[_0x53d4('0xb')]=_0x2001c1['tech']||_0x53d4('0xc');this[_0x53d4('0xd')]=_0x2001c1[_0x53d4('0xd')]?_0x2001c1[_0x53d4('0xd')]:undefined;this[_0x53d4('0xe')]=_0x2001c1['ListId'];this[_0x53d4('0xf')]=_0x2001c1[_0x53d4('0xf')];}module[_0x53d4('0x10')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 8291d5e..4dfccc5 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 _0xc5f8=['remoteUri','serverUrl','Configurations','exports','name','username','token'];(function(_0x19457c,_0x2f778b){var _0x1bb094=function(_0x3371b8){while(--_0x3371b8){_0x19457c['push'](_0x19457c['shift']());}};_0x1bb094(++_0x2f778b);}(_0xc5f8,0xcf));var _0x8c5f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc5f8[_0x3dd15e];return _0x231fd0;};'use strict';function FreshdeskAccount(_0x33ddf8){this['id']=_0x33ddf8['id']||0x0;this[_0x8c5f('0x0')]=_0x33ddf8[_0x8c5f('0x0')]||'';this[_0x8c5f('0x1')]=_0x33ddf8[_0x8c5f('0x1')]||'';this['apiKey']=_0x33ddf8[_0x8c5f('0x2')]||'';this[_0x8c5f('0x3')]=_0x33ddf8[_0x8c5f('0x3')]||'';this[_0x8c5f('0x4')]=_0x33ddf8[_0x8c5f('0x4')]||'';this[_0x8c5f('0x5')]=_0x33ddf8[_0x8c5f('0x5')]||{};}module[_0x8c5f('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0x6441=['serverUrl','Configurations','exports','username','apiKey','token','remoteUri'];(function(_0x29f80e,_0x9027ff){var _0x5c7eaa=function(_0x48ec7c){while(--_0x48ec7c){_0x29f80e['push'](_0x29f80e['shift']());}};_0x5c7eaa(++_0x9027ff);}(_0x6441,0x153));var _0x1644=function(_0x9f826b,_0x5358de){_0x9f826b=_0x9f826b-0x0;var _0x548441=_0x6441[_0x9f826b];return _0x548441;};'use strict';function FreshdeskAccount(_0x2e4061){this['id']=_0x2e4061['id']||0x0;this['name']=_0x2e4061['name']||'';this[_0x1644('0x0')]=_0x2e4061[_0x1644('0x0')]||'';this[_0x1644('0x1')]=_0x2e4061[_0x1644('0x2')]||'';this[_0x1644('0x3')]=_0x2e4061['remoteUri']||'';this[_0x1644('0x4')]=_0x2e4061[_0x1644('0x4')]||'';this[_0x1644('0x5')]=_0x2e4061[_0x1644('0x5')]||{};}module[_0x1644('0x6')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 5438ffb..a0c39ea 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 _0x9c5a=['serverUrl','Configurations','exports','name','username','apiKey','token','remoteUri'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x11d8b1,_0x35ff22){_0x11d8b1=_0x11d8b1-0x0;var _0x3a16e4=_0x9c5a[_0x11d8b1];return _0x3a16e4;};'use strict';function FreshsalesAccount(_0x4db732){this['id']=_0x4db732['id']||0x0;this[_0xa9c5('0x0')]=_0x4db732['name']||'';this[_0xa9c5('0x1')]=_0x4db732[_0xa9c5('0x1')]||'';this[_0xa9c5('0x2')]=_0x4db732[_0xa9c5('0x3')]||'';this['remoteUri']=_0x4db732[_0xa9c5('0x4')]||'';this[_0xa9c5('0x5')]=_0x4db732['serverUrl']||'';this[_0xa9c5('0x6')]=_0x4db732['Configurations']||{};}module[_0xa9c5('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0x5a5a=['serverUrl','Configurations','exports','name','username','apiKey','remoteUri'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5a5a,0x1d1));var _0xa5a5=function(_0x1e05c1,_0x3cffa3){_0x1e05c1=_0x1e05c1-0x0;var _0x15f1ca=_0x5a5a[_0x1e05c1];return _0x15f1ca;};'use strict';function FreshsalesAccount(_0x300328){this['id']=_0x300328['id']||0x0;this[_0xa5a5('0x0')]=_0x300328[_0xa5a5('0x0')]||'';this[_0xa5a5('0x1')]=_0x300328[_0xa5a5('0x1')]||'';this[_0xa5a5('0x2')]=_0x300328['token']||'';this[_0xa5a5('0x3')]=_0x300328[_0xa5a5('0x3')]||'';this[_0xa5a5('0x4')]=_0x300328['serverUrl']||'';this['Configurations']=_0x300328[_0xa5a5('0x5')]||{};}module[_0xa5a5('0x6')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 1f43030..906d3dc 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 _0x76df=['motionChannel','mohtime','variables','exports','uniqueid','calleridnum','calleridname','queue','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','accountcode','context','exten','holdtime','assigned','lastAssignedTo'];(function(_0x1e9992,_0x24a7db){var _0x4204e2=function(_0x43b540){while(--_0x43b540){_0x1e9992['push'](_0x1e9992['shift']());}};_0x4204e2(++_0x24a7db);}(_0x76df,0x16c));var _0xf76d=function(_0xe52657,_0x374354){_0xe52657=_0xe52657-0x0;var _0x4f14ea=_0x76df[_0xe52657];return _0x4f14ea;};'use strict';function QueueReport(){this['type']='inbound';this[_0xf76d('0x0')]='';this[_0xf76d('0x1')]='';this[_0xf76d('0x2')]='';this[_0xf76d('0x3')]='';this['queuecallerjoinAt']=null;this['queuecallerleaveAt']=null;this[_0xf76d('0x4')]=0x1;this[_0xf76d('0x5')]=0x1;this[_0xf76d('0x6')]=![];this[_0xf76d('0x7')]=null;this[_0xf76d('0x8')]=![];this['queuecallercompleteAt']=null;this[_0xf76d('0x9')]=![];this[_0xf76d('0xa')]=null;this[_0xf76d('0xb')]=0x1;this[_0xf76d('0xc')]='';this[_0xf76d('0xd')]='';this['connectedlinename']='';this[_0xf76d('0xe')]='';this[_0xf76d('0xf')]='';this[_0xf76d('0x10')]='';this['priority']='';this[_0xf76d('0x11')]=0x0;this[_0xf76d('0x12')]=![];this[_0xf76d('0x13')]='';this[_0xf76d('0x14')]='voice';this[_0xf76d('0x15')]=0x0;this[_0xf76d('0x16')]={};}module[_0xf76d('0x17')]=QueueReport; \ No newline at end of file +var _0x9783=['accountcode','context','exten','priority','holdtime','lastAssignedTo','motionChannel','voice','mohtime','variables','exports','inbound','calleridnum','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename'];(function(_0xc8052d,_0xf4a4a6){var _0x2b6f49=function(_0x3f6c52){while(--_0x3f6c52){_0xc8052d['push'](_0xc8052d['shift']());}};_0x2b6f49(++_0xf4a4a6);}(_0x9783,0x8d));var _0x3978=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9783[_0x3dd15e];return _0x231fd0;};'use strict';function QueueReport(){this['type']=_0x3978('0x0');this['uniqueid']='';this[_0x3978('0x1')]='';this['calleridname']='';this[_0x3978('0x2')]='';this[_0x3978('0x3')]=null;this[_0x3978('0x4')]=null;this[_0x3978('0x5')]=0x1;this[_0x3978('0x6')]=0x1;this[_0x3978('0x7')]=![];this['queuecallerabandonAt']=null;this[_0x3978('0x8')]=![];this[_0x3978('0x9')]=null;this['queuecallerexit']=![];this[_0x3978('0xa')]=null;this[_0x3978('0xb')]=0x1;this[_0x3978('0xc')]='';this[_0x3978('0xd')]='';this[_0x3978('0xe')]='';this[_0x3978('0xf')]='';this[_0x3978('0x10')]='';this[_0x3978('0x11')]='';this[_0x3978('0x12')]='';this[_0x3978('0x13')]=0x0;this['assigned']=![];this[_0x3978('0x14')]='';this[_0x3978('0x15')]=_0x3978('0x16');this[_0x3978('0x17')]=0x0;this[_0x3978('0x18')]={};}module[_0x3978('0x19')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 927218a..de31f75 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 _0xf536=['remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','name','username'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xf536,0x106));var _0x6f53=function(_0x367995,_0x129ae2){_0x367995=_0x367995-0x0;var _0x22daa8=_0xf536[_0x367995];return _0x22daa8;};'use strict';function SalesforceAccount(_0x24d96e){this['id']=_0x24d96e['id']||0x0;this[_0x6f53('0x0')]=_0x24d96e['name']||'';this[_0x6f53('0x1')]=_0x24d96e['username']||'';this[_0x6f53('0x2')]=_0x24d96e[_0x6f53('0x2')]||'';this[_0x6f53('0x3')]=_0x24d96e['password']||'';this[_0x6f53('0x4')]=_0x24d96e[_0x6f53('0x4')]||'';this[_0x6f53('0x5')]=_0x24d96e['clientSecret']||'';this[_0x6f53('0x6')]=_0x24d96e['securityToken']||'';this[_0x6f53('0x7')]=_0x24d96e[_0x6f53('0x7')]||_0x6f53('0x8');this[_0x6f53('0x9')]=_0x24d96e[_0x6f53('0x9')]||'';this[_0x6f53('0xa')]=_0x24d96e['Configurations']||{};}module['exports']=SalesforceAccount; \ No newline at end of file +var _0xe84a=['username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name'];(function(_0x303d9d,_0x363884){var _0x4ccd15=function(_0x1b497b){while(--_0x1b497b){_0x303d9d['push'](_0x303d9d['shift']());}};_0x4ccd15(++_0x363884);}(_0xe84a,0x113));var _0xae84=function(_0x363a7c,_0xc7228b){_0x363a7c=_0x363a7c-0x0;var _0x50e8e6=_0xe84a[_0x363a7c];return _0x50e8e6;};'use strict';function SalesforceAccount(_0x58b2bf){this['id']=_0x58b2bf['id']||0x0;this[_0xae84('0x0')]=_0x58b2bf[_0xae84('0x0')]||'';this[_0xae84('0x1')]=_0x58b2bf[_0xae84('0x1')]||'';this[_0xae84('0x2')]=_0x58b2bf[_0xae84('0x2')]||'';this[_0xae84('0x3')]=_0x58b2bf[_0xae84('0x3')]||'';this[_0xae84('0x4')]=_0x58b2bf['clientId']||'';this[_0xae84('0x5')]=_0x58b2bf['clientSecret']||'';this[_0xae84('0x6')]=_0x58b2bf[_0xae84('0x6')]||'';this['type']=_0x58b2bf[_0xae84('0x7')]||_0xae84('0x8');this[_0xae84('0x9')]=_0x58b2bf['serverUrl']||'';this[_0xae84('0xa')]=_0x58b2bf['Configurations']||{};}module[_0xae84('0xb')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index a539747..8590db3 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 _0x340b=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x81fe53,_0x5b8f05){var _0x56f7a7=function(_0x1e7846){while(--_0x1e7846){_0x81fe53['push'](_0x81fe53['shift']());}};_0x56f7a7(++_0x5b8f05);}(_0x340b,0x71));var _0xb340=function(_0x436782,_0x5a7e34){_0x436782=_0x436782-0x0;var _0x3c5ba6=_0x340b[_0x436782];return _0x3c5ba6;};'use strict';function ServicenowAccount(_0x5edbf6){this['id']=_0x5edbf6['id']||0x0;this['name']=_0x5edbf6[_0xb340('0x0')]||'';this[_0xb340('0x1')]=_0x5edbf6[_0xb340('0x1')]||'';this[_0xb340('0x2')]=_0x5edbf6[_0xb340('0x2')]||'';this[_0xb340('0x3')]=_0x5edbf6['remoteUri']||'';this[_0xb340('0x4')]=_0x5edbf6[_0xb340('0x4')]||'';this['Configurations']=_0x5edbf6[_0xb340('0x5')]||{};}module[_0xb340('0x6')]=ServicenowAccount; \ No newline at end of file +var _0x2bd0=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x3be0c4,_0x5b7eff){var _0x11af9f=function(_0x3f5113){while(--_0x3f5113){_0x3be0c4['push'](_0x3be0c4['shift']());}};_0x11af9f(++_0x5b7eff);}(_0x2bd0,0x98));var _0x02bd=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0x2bd0[_0x4dbaad];return _0x226c72;};'use strict';function ServicenowAccount(_0xfe200a){this['id']=_0xfe200a['id']||0x0;this['name']=_0xfe200a[_0x02bd('0x0')]||'';this[_0x02bd('0x1')]=_0xfe200a[_0x02bd('0x1')]||'';this[_0x02bd('0x2')]=_0xfe200a[_0x02bd('0x2')]||'';this[_0x02bd('0x3')]=_0xfe200a[_0x02bd('0x3')]||'';this[_0x02bd('0x4')]=_0xfe200a[_0x02bd('0x4')]||'';this[_0x02bd('0x5')]=_0xfe200a[_0x02bd('0x5')]||{};}module[_0x02bd('0x6')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 6411807..d2c7310 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 _0x1d9c=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0x4de7ab,_0x44a6c3){var _0x1f3f06=function(_0x55c66b){while(--_0x55c66b){_0x4de7ab['push'](_0x4de7ab['shift']());}};_0x1f3f06(++_0x44a6c3);}(_0x1d9c,0x64));var _0xc1d9=function(_0x457549,_0x3e0f46){_0x457549=_0x457549-0x0;var _0x3c1d6f=_0x1d9c[_0x457549];return _0x3c1d6f;};'use strict';function SugarcrmAccount(_0x383536){this['id']=_0x383536['id']||0x0;this[_0xc1d9('0x0')]=_0x383536[_0xc1d9('0x0')]||'';this[_0xc1d9('0x1')]=_0x383536[_0xc1d9('0x1')]||'';this[_0xc1d9('0x2')]=_0x383536[_0xc1d9('0x2')]||'';this['remoteUri']=_0x383536[_0xc1d9('0x3')]||'';this[_0xc1d9('0x4')]=_0x383536['serverUrl']||'';this['Configurations']=_0x383536[_0xc1d9('0x5')]||{};}module[_0xc1d9('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x77cc=['name','username','password','serverUrl'];(function(_0x31a0a3,_0x2fecfe){var _0x3f0960=function(_0x494633){while(--_0x494633){_0x31a0a3['push'](_0x31a0a3['shift']());}};_0x3f0960(++_0x2fecfe);}(_0x77cc,0xf0));var _0xc77c=function(_0x27a45d,_0x14499a){_0x27a45d=_0x27a45d-0x0;var _0x5aee32=_0x77cc[_0x27a45d];return _0x5aee32;};'use strict';function SugarcrmAccount(_0x1b9ed3){this['id']=_0x1b9ed3['id']||0x0;this[_0xc77c('0x0')]=_0x1b9ed3[_0xc77c('0x0')]||'';this[_0xc77c('0x1')]=_0x1b9ed3['username']||'';this[_0xc77c('0x2')]=_0x1b9ed3[_0xc77c('0x2')]||'';this['remoteUri']=_0x1b9ed3['remoteUri']||'';this['serverUrl']=_0x1b9ed3[_0xc77c('0x3')]||'';this['Configurations']=_0x1b9ed3['Configurations']||{};}module['exports']=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 3660bd1..712f0a8 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 _0xb4e0=['unknown','status','exports','name','accountcode','state'];(function(_0x6c0123,_0x4c8d3b){var _0x5a87d2=function(_0x1ff614){while(--_0x1ff614){_0x6c0123['push'](_0x6c0123['shift']());}};_0x5a87d2(++_0x4c8d3b);}(_0xb4e0,0x10b));var _0x0b4e=function(_0x3d493e,_0x4a6c2d){_0x3d493e=_0x3d493e-0x0;var _0x567672=_0xb4e0[_0x3d493e];return _0x567672;};'use strict';function Telephone(_0x3ec18c){this['id']=_0x3ec18c['id']||0x0;this[_0x0b4e('0x0')]=_0x3ec18c[_0x0b4e('0x0')]||'';this[_0x0b4e('0x1')]=_0x3ec18c[_0x0b4e('0x1')]||'';this[_0x0b4e('0x2')]=_0x0b4e('0x3');this['stateTime']=0x0;this[_0x0b4e('0x4')]='unknown';this['address']='';}module[_0x0b4e('0x5')]=Telephone; \ No newline at end of file +var _0x88c8=['address','exports','name','accountcode','stateTime','status'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x88c8,0x7a));var _0x888c=function(_0x3eb8eb,_0x3adc31){_0x3eb8eb=_0x3eb8eb-0x0;var _0x368b12=_0x88c8[_0x3eb8eb];return _0x368b12;};'use strict';function Telephone(_0x269c8a){this['id']=_0x269c8a['id']||0x0;this[_0x888c('0x0')]=_0x269c8a['name']||'';this['accountcode']=_0x269c8a[_0x888c('0x1')]||'';this['state']='unknown';this[_0x888c('0x2')]=0x0;this[_0x888c('0x3')]='unknown';this[_0x888c('0x4')]='';}module[_0x888c('0x5')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index d593e10..83d24b0 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(_0x2e2685,_0x36ca03){var _0x2f1a2b=function(_0x22e8be){while(--_0x22e8be){_0x2e2685['push'](_0x2e2685['shift']());}};_0x2f1a2b(++_0x36ca03);}(_0xb10b,0x12a));var _0xbb10=function(_0x42f3a6,_0x45285c){_0x42f3a6=_0x42f3a6-0x0;var _0xdf3c33=_0xb10b[_0x42f3a6];return _0xdf3c33;};'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(_0x41ca37,_0x4d1998){var _0x461c74=function(_0x24cb64){while(--_0x24cb64){_0x41ca37['push'](_0x41ca37['shift']());}};_0x461c74(++_0x4d1998);}(_0xb10b,0x12a));var _0xbb10=function(_0x2ddd52,_0x4e3b17){_0x2ddd52=_0x2ddd52-0x0;var _0x4bb4ec=_0xb10b[_0x2ddd52];return _0x4bb4ec;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index da24cc3..8ccf44e 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 _0xbaf0=['Actions','exports','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0x386c3e,_0x44a375){var _0x4b8e13=function(_0x583c8f){while(--_0x583c8f){_0x386c3e['push'](_0x386c3e['shift']());}};_0x4b8e13(++_0x44a375);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'use strict';function Trigger(_0x61caa9){this['id']=_0x61caa9['id']||0x0;this[_0x0baf('0x0')]=_0x61caa9[_0x0baf('0x0')]||'';this[_0x0baf('0x1')]=_0x61caa9[_0x0baf('0x1')]||_0x0baf('0x2');this[_0x0baf('0x3')]=_0x61caa9['status']||![];this[_0x0baf('0x4')]=_0x61caa9[_0x0baf('0x4')]||[];this[_0x0baf('0x5')]=_0x61caa9[_0x0baf('0x5')]||[];this[_0x0baf('0x6')]=_0x61caa9[_0x0baf('0x6')]||[];}module[_0x0baf('0x7')]=Trigger; \ No newline at end of file +var _0x0b0e=['channel','voice','status','AllConditions','AnyConditions','Actions','exports','name'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0b0e,0x187));var _0xe0b0=function(_0x397f37,_0x3cf86d){_0x397f37=_0x397f37-0x0;var _0x31cae6=_0x0b0e[_0x397f37];return _0x31cae6;};'use strict';function Trigger(_0x29cd1e){this['id']=_0x29cd1e['id']||0x0;this['name']=_0x29cd1e[_0xe0b0('0x0')]||'';this['channel']=_0x29cd1e[_0xe0b0('0x1')]||_0xe0b0('0x2');this[_0xe0b0('0x3')]=_0x29cd1e[_0xe0b0('0x3')]||![];this[_0xe0b0('0x4')]=_0x29cd1e[_0xe0b0('0x4')]||[];this[_0xe0b0('0x5')]=_0x29cd1e[_0xe0b0('0x5')]||[];this[_0xe0b0('0x6')]=_0x29cd1e[_0xe0b0('0x6')]||[];}module[_0xe0b0('0x7')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index a1e627c..d46f0f9 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 _0xbee8=['unknown','stateTime','status','registry','indexOf','split','host','port','refresh','registrationtime','address','defaultuser','exports','active','name'];(function(_0x5b567e,_0x146470){var _0x4ba29f=function(_0x503f66){while(--_0x503f66){_0x5b567e['push'](_0x5b567e['shift']());}};_0x4ba29f(++_0x146470);}(_0xbee8,0x1b1));var _0x8bee=function(_0x2085f3,_0x50105b){_0x2085f3=_0x2085f3-0x0;var _0x384e3c=_0xbee8[_0x2085f3];return _0x384e3c;};'use strict';function Trunk(_0x97978d){this['id']=_0x97978d['id']||0x0;this['active']=_0x97978d[_0x8bee('0x0')]||![];this[_0x8bee('0x1')]=_0x97978d['name']||'';this['state']=_0x8bee('0x2');this[_0x8bee('0x3')]=0x0;this[_0x8bee('0x4')]=_0x8bee('0x2');this[_0x8bee('0x5')]=_0x97978d[_0x8bee('0x5')]&&_0x97978d[_0x8bee('0x5')][_0x8bee('0x6')](':')?_0x97978d[_0x8bee('0x5')][_0x8bee('0x7')](':')[0x0]:'';this[_0x8bee('0x8')]='';this[_0x8bee('0x9')]='';this['domain']='';this['domainport']='';this[_0x8bee('0xa')]='';this['stateRegistry']='unknown';this[_0x8bee('0xb')]='';this[_0x8bee('0xc')]='';this[_0x8bee('0xd')]=_0x97978d[_0x8bee('0xd')]||'';}module[_0x8bee('0xe')]=Trunk; \ No newline at end of file +var _0x2769=['name','state','stateTime','status','unknown','registry','split','host','defaultuser','exports','active'];(function(_0x1121f7,_0x389548){var _0xc8498a=function(_0x13847f){while(--_0x13847f){_0x1121f7['push'](_0x1121f7['shift']());}};_0xc8498a(++_0x389548);}(_0x2769,0x1cd));var _0x9276=function(_0x51739e,_0x1a2d90){_0x51739e=_0x51739e-0x0;var _0x364fc7=_0x2769[_0x51739e];return _0x364fc7;};'use strict';function Trunk(_0x51b939){this['id']=_0x51b939['id']||0x0;this[_0x9276('0x0')]=_0x51b939['active']||![];this[_0x9276('0x1')]=_0x51b939[_0x9276('0x1')]||'';this[_0x9276('0x2')]='unknown';this[_0x9276('0x3')]=0x0;this[_0x9276('0x4')]=_0x9276('0x5');this[_0x9276('0x6')]=_0x51b939[_0x9276('0x6')]&&_0x51b939[_0x9276('0x6')]['indexOf'](':')?_0x51b939[_0x9276('0x6')][_0x9276('0x7')](':')[0x0]:'';this[_0x9276('0x8')]='';this['port']='';this['domain']='';this['domainport']='';this['refresh']='';this['stateRegistry']=_0x9276('0x5');this['registrationtime']='';this['address']='';this[_0x9276('0x9')]=_0x51b939[_0x9276('0x9')]||'';}module[_0x9276('0xa')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 7dd832b..e074871 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 _0x0e56=['mandatoryDisposition','exten','recordingFormat'];(function(_0x18cac4,_0x57a4d5){var _0x2227c6=function(_0x72934d){while(--_0x72934d){_0x18cac4['push'](_0x18cac4['shift']());}};_0x2227c6(++_0x57a4d5);}(_0x0e56,0x112));var _0x60e5=function(_0x249565,_0x2a026a){_0x249565=_0x249565-0x0;var _0x43dee8=_0x0e56[_0x249565];return _0x43dee8;};'use strict';function voiceExtension(_0xc647a1){this['id']=_0xc647a1['id']||0x0;this[_0x60e5('0x0')]=_0xc647a1['exten']||'';this[_0x60e5('0x1')]=_0xc647a1[_0x60e5('0x1')]||'none';this[_0x60e5('0x2')]=_0xc647a1['mandatoryDisposition']||![];}module['exports']=voiceExtension; \ No newline at end of file +var _0x7058=['none','exports','exten','recordingFormat'];(function(_0x377bda,_0x12d47e){var _0x2960b6=function(_0x1572fa){while(--_0x1572fa){_0x377bda['push'](_0x377bda['shift']());}};_0x2960b6(++_0x12d47e);}(_0x7058,0x142));var _0x8705=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x7058[_0x5d4607];return _0x5e4a86;};'use strict';function voiceExtension(_0xd56677){this['id']=_0xd56677['id']||0x0;this[_0x8705('0x0')]=_0xd56677['exten']||'';this[_0x8705('0x1')]=_0xd56677['recordingFormat']||_0x8705('0x2');this['mandatoryDisposition']=_0xd56677['mandatoryDisposition']||![];}module[_0x8705('0x3')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 6c71a65..6360181 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 _0x44e8=['dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','startProgressive','startPredictive','handlePredictive','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','wav','fewestcalls','leastrecent','linear','random','roundrobin','rrmemory','rrordered','wrandom','name','monitor_format','type','inbound','waiting','total','answered','sumDuration','sumBillable','unmanaged','abandoned','available','busy','inUse','invalid','notInUse','onHold','ringing','ringInUse','unavailable','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','message','statusMessage','originated','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dropRate','dialPredictiveOptimizationPercentage'];(function(_0x22ff86,_0x4644e8){var _0x1e9b56=function(_0x57b1b9){while(--_0x57b1b9){_0x22ff86['push'](_0x22ff86['shift']());}};_0x1e9b56(++_0x4644e8);}(_0x44e8,0xd7));var _0x844e=function(_0x661446,_0x559ab3){_0x661446=_0x661446-0x0;var _0x109719=_0x44e8[_0x661446];return _0x109719;};'use strict';var monitorFormat={'wav':_0x844e('0x0'),'wav49':'wav49','gsm':'gsm'};var strategy={'fewestcalls':_0x844e('0x1'),'leastrecent':_0x844e('0x2'),'linear':_0x844e('0x3'),'random':_0x844e('0x4'),'ringall':'ringall','rr':_0x844e('0x5'),'rrmemory':_0x844e('0x6'),'rrordered':_0x844e('0x7'),'wrandom':_0x844e('0x8')};function VoiceQueue(_0x5c8f67){this['id']=_0x5c8f67['id']||0x0;this[_0x844e('0x9')]=_0x5c8f67[_0x844e('0x9')]||'';this[_0x844e('0xa')]=_0x5c8f67[_0x844e('0xa')]||'';this['type']=_0x5c8f67[_0x844e('0xb')]||_0x844e('0xc');this[_0x844e('0xd')]=0x0;this[_0x844e('0xe')]=0x0;this[_0x844e('0xf')]=0x0;this[_0x844e('0x10')]=0x0;this['sumHoldTime']=0x0;this[_0x844e('0x11')]=0x0;this[_0x844e('0x12')]=0x0;this[_0x844e('0x13')]=0x0;this[_0x844e('0x14')]=0x0;this[_0x844e('0x15')]=0x0;this[_0x844e('0x16')]=0x0;this[_0x844e('0x17')]=0x0;this['loggedIn']=0x0;this[_0x844e('0x18')]=0x0;this[_0x844e('0x19')]=0x0;this['paused']=0x0;this[_0x844e('0x1a')]=0x0;this[_0x844e('0x1b')]=0x0;this['talking']=0x0;this[_0x844e('0x1c')]=0x0;this[_0x844e('0x1d')]=0x0;this[_0x844e('0x1e')]=_0x5c8f67['acw']||![];this[_0x844e('0x1f')]=_0x5c8f67[_0x844e('0x1f')]||0xa;this[_0x844e('0x20')]=_0x5c8f67[_0x844e('0x20')]||'no';this[_0x844e('0x21')]=!![];this[_0x844e('0x22')]='';this[_0x844e('0x23')]='';this[_0x844e('0x24')]=0x0;this['temp']=0x0;this[_0x844e('0x25')]=_0x5c8f67['dialTimezone']||null;this[_0x844e('0x26')]=_0x5c8f67['dialGlobalInterval']?_0x5c8f67[_0x844e('0x26')]:null;this['dialActive']=_0x5c8f67[_0x844e('0x27')];this[_0x844e('0x28')]=_0x5c8f67[_0x844e('0x28')]||_0x844e('0x29');this[_0x844e('0x2a')]=_0x5c8f67[_0x844e('0x2a')]||0x0;this[_0x844e('0x2b')]=_0x5c8f67[_0x844e('0x2b')]||0x0;this['dialPowerLevel']=_0x5c8f67[_0x844e('0x2c')]||0x1;this['dialPredictiveOptimization']=_0x5c8f67['dialPredictiveOptimization']||_0x844e('0x2d');this[_0x844e('0x2e')]=_0x5c8f67[_0x844e('0x2e')]||0.03;this[_0x844e('0x2f')]=_0x5c8f67['dialPredictiveInterval']||0x258;this[_0x844e('0x30')]=_0x5c8f67[_0x844e('0x30')]||'anonymous';this[_0x844e('0x31')]=_0x5c8f67[_0x844e('0x31')]||_0x844e('0x32');this[_0x844e('0x33')]=_0x5c8f67[_0x844e('0x33')]||0x1e;this[_0x844e('0x34')]=_0x5c8f67['dialQueueOptions']||_0x844e('0x35');this[_0x844e('0x36')]=_0x5c8f67[_0x844e('0x36')]||0x3;this[_0x844e('0x37')]=_0x5c8f67[_0x844e('0x37')]||undefined;this['dialCongestionMaxRetry']=_0x5c8f67[_0x844e('0x38')]||0x3;this['dialCongestionRetryFrequency']=_0x5c8f67['dialCongestionRetryFrequency']||0x96;this[_0x844e('0x39')]=_0x5c8f67[_0x844e('0x39')]||0x3;this[_0x844e('0x3a')]=_0x5c8f67['dialBusyRetryFrequency']||0x96;this[_0x844e('0x3b')]=_0x5c8f67[_0x844e('0x3b')]||0x3;this[_0x844e('0x3c')]=_0x5c8f67['dialNoAnswerRetryFrequency']||0x96;this[_0x844e('0x3d')]=_0x5c8f67[_0x844e('0x3d')]||0x3;this[_0x844e('0x3e')]=_0x5c8f67[_0x844e('0x3e')]||0x96;this[_0x844e('0x3f')]=_0x5c8f67[_0x844e('0x3f')]||0x3;this[_0x844e('0x40')]=_0x5c8f67[_0x844e('0x40')]||0x96;this[_0x844e('0x41')]=_0x5c8f67[_0x844e('0x41')]||0x3;this['dialAbandonedRetryFrequency']=_0x5c8f67[_0x844e('0x42')]||0x96;this[_0x844e('0x43')]=_0x5c8f67[_0x844e('0x43')]||0x3;this[_0x844e('0x44')]=_0x5c8f67[_0x844e('0x44')]||0x96;this[_0x844e('0x45')]=_0x5c8f67[_0x844e('0x45')]||0x3;this['dialAgentRejectRetryFrequency']=_0x5c8f67[_0x844e('0x46')]||0x96;this[_0x844e('0x47')]=_0x5c8f67[_0x844e('0x47')]||0x3;this['dialGlobalMaxRetry']=_0x5c8f67[_0x844e('0x48')]||0x4;this[_0x844e('0x49')]=_0x5c8f67['Trunk']?_0x5c8f67[_0x844e('0x49')]:undefined;this[_0x844e('0x4a')]=_0x5c8f67['TrunkBackup']?_0x5c8f67[_0x844e('0x4a')]:undefined;this[_0x844e('0x4b')]=_0x5c8f67[_0x844e('0x4b')]||undefined;this[_0x844e('0x4c')]=_0x5c8f67[_0x844e('0x4c')]?_0x5c8f67[_0x844e('0x4c')]:undefined;this[_0x844e('0x4d')]=_0x5c8f67['dialOrderByScheduledAt']||_0x844e('0x4e');this[_0x844e('0x4f')]=_0x5c8f67[_0x844e('0x4f')]||undefined;this[_0x844e('0x50')]=_0x5c8f67[_0x844e('0x50')]||undefined;this[_0x844e('0x51')]=strategy[_0x5c8f67[_0x844e('0x51')]];this[_0x844e('0x52')]=!![];this[_0x844e('0x53')]=_0x5c8f67[_0x844e('0x53')]||![];this[_0x844e('0x54')]=_0x5c8f67['dialAMDInitialSilence'];this['dialAMDGreeting']=_0x5c8f67[_0x844e('0x55')];this[_0x844e('0x56')]=_0x5c8f67[_0x844e('0x56')];this[_0x844e('0x57')]=_0x5c8f67[_0x844e('0x57')];this[_0x844e('0x58')]=_0x5c8f67[_0x844e('0x58')];this[_0x844e('0x59')]=_0x5c8f67[_0x844e('0x59')];this['dialAMDMaximumNumberOfWords']=_0x5c8f67[_0x844e('0x5a')];this['dialAMDSilenceThreshold']=_0x5c8f67[_0x844e('0x5b')];this['dialAMDMaximumWordLength']=_0x5c8f67[_0x844e('0x5c')];this['outboundRejectCallsDay']=0x0;this[_0x844e('0x5d')]=0x0;this[_0x844e('0x5e')]=_0x5c8f67[_0x844e('0x5e')];this[_0x844e('0x5f')]=0x0;this[_0x844e('0x60')]=0x0;this[_0x844e('0x61')]=0x0;this[_0x844e('0x62')]=0x0;this[_0x844e('0x63')]=0x0;this[_0x844e('0x64')]=0x0;this[_0x844e('0x65')]=0x0;this[_0x844e('0x66')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0x844e('0x67')]=0x0;this[_0x844e('0x68')]=0x0;this[_0x844e('0x69')]=0x0;this['outboundReCallsDay']=0x0;this['outboundAbandonedDay']=0x0;this[_0x844e('0x6a')]=undefined;this[_0x844e('0x6b')]=undefined;this[_0x844e('0x6c')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this['predictiveIntervalTotalCalls']=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0x844e('0x6d')]=0x0;this[_0x844e('0x6e')]=0x0;this[_0x844e('0x6f')]=0x0;this[_0x844e('0x70')]=0x0;this[_0x844e('0x71')]=0x0;this['predictiveIntervalMaxThreshold']=_0x5c8f67[_0x844e('0x72')]||0x14;this['predictiveIntervalMinThreshold']=_0x5c8f67['dialPredictiveIntervalMaxThreshold']||0xa;this[_0x844e('0x73')]=0x0;this[_0x844e('0x74')]=0x0;this[_0x844e('0x75')]=0x1;this[_0x844e('0x76')]=0x0;this['erlangCallToSecond']=0x0;this[_0x844e('0x77')]=0x0;this[_0x844e('0x78')]=0x0;this[_0x844e('0x79')]=_0x5c8f67['dialRecallMeTimeout']||0x1e;this[_0x844e('0x7a')]=_0x5c8f67[_0x844e('0x7a')]||![];this['dialPreviewAutoRecallMe']=!!_0x5c8f67[_0x844e('0x7b')]||![];this[_0x844e('0x7c')]=!!_0x5c8f67[_0x844e('0x7c')]||![];this[_0x844e('0x7d')]=_0x5c8f67[_0x844e('0x7d')]||undefined;this[_0x844e('0x7e')]=_0x5c8f67['dialAgiAfterHangupClient']||![];this[_0x844e('0x7f')]=_0x5c8f67[_0x844e('0x7f')]||![];this[_0x844e('0xa')]=monitorFormat[_0x5c8f67[_0x844e('0xa')]]?monitorFormat[_0x5c8f67[_0x844e('0xa')]]:undefined;this[_0x844e('0x80')]=_0x5c8f67[_0x844e('0x80')]||![];this[_0x844e('0x81')]=_0x5c8f67[_0x844e('0x81')]?_0x5c8f67[_0x844e('0x81')]:undefined;this['queueSummaryCountersUpdated']=![];}module[_0x844e('0x82')]=VoiceQueue; \ No newline at end of file +var _0x1a61=['queueSummaryCountersUpdated','exports','wav','gsm','leastrecent','linear','random','ringall','rrordered','wrandom','name','monitor_format','type','inbound','waiting','total','sumBillable','unmanaged','available','busy','inUse','invalid','loggedIn','notInUse','ringing','ringInUse','unavailable','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','outboundRejectCallsDay','timeout','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','startProgressive','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause'];(function(_0x1b9107,_0x58c14f){var _0xdeffbe=function(_0x50c011){while(--_0x50c011){_0x1b9107['push'](_0x1b9107['shift']());}};_0xdeffbe(++_0x58c14f);}(_0x1a61,0x1e6));var _0x11a6=function(_0x2dde59,_0x5a93d7){_0x2dde59=_0x2dde59-0x0;var _0x45964f=_0x1a61[_0x2dde59];return _0x45964f;};'use strict';var monitorFormat={'wav':_0x11a6('0x0'),'wav49':'wav49','gsm':_0x11a6('0x1')};var strategy={'fewestcalls':'fewestcalls','leastrecent':_0x11a6('0x2'),'linear':_0x11a6('0x3'),'random':_0x11a6('0x4'),'ringall':_0x11a6('0x5'),'rr':'roundrobin','rrmemory':'rrmemory','rrordered':_0x11a6('0x6'),'wrandom':_0x11a6('0x7')};function VoiceQueue(_0x5b72a1){this['id']=_0x5b72a1['id']||0x0;this[_0x11a6('0x8')]=_0x5b72a1[_0x11a6('0x8')]||'';this[_0x11a6('0x9')]=_0x5b72a1[_0x11a6('0x9')]||'';this[_0x11a6('0xa')]=_0x5b72a1[_0x11a6('0xa')]||_0x11a6('0xb');this[_0x11a6('0xc')]=0x0;this[_0x11a6('0xd')]=0x0;this['answered']=0x0;this['sumDuration']=0x0;this['sumHoldTime']=0x0;this[_0x11a6('0xe')]=0x0;this[_0x11a6('0xf')]=0x0;this['abandoned']=0x0;this[_0x11a6('0x10')]=0x0;this[_0x11a6('0x11')]=0x0;this[_0x11a6('0x12')]=0x0;this[_0x11a6('0x13')]=0x0;this[_0x11a6('0x14')]=0x0;this[_0x11a6('0x15')]=0x0;this['onHold']=0x0;this['paused']=0x0;this[_0x11a6('0x16')]=0x0;this[_0x11a6('0x17')]=0x0;this['talking']=0x0;this[_0x11a6('0x18')]=0x0;this[_0x11a6('0x19')]=0x0;this['acw']=_0x5b72a1[_0x11a6('0x1a')]||![];this[_0x11a6('0x1b')]=_0x5b72a1['acwTimeout']||0xa;this[_0x11a6('0x1c')]=_0x5b72a1[_0x11a6('0x1c')]||'no';this[_0x11a6('0x1d')]=!![];this[_0x11a6('0x1e')]='';this['statusMessage']='';this[_0x11a6('0x1f')]=0x0;this[_0x11a6('0x20')]=0x0;this[_0x11a6('0x21')]=_0x5b72a1[_0x11a6('0x21')]||null;this[_0x11a6('0x22')]=_0x5b72a1[_0x11a6('0x22')]?_0x5b72a1[_0x11a6('0x22')]:null;this[_0x11a6('0x23')]=_0x5b72a1[_0x11a6('0x23')];this[_0x11a6('0x24')]=_0x5b72a1[_0x11a6('0x24')]||_0x11a6('0x25');this[_0x11a6('0x26')]=_0x5b72a1[_0x11a6('0x26')]||0x0;this['dialLimitQueue']=_0x5b72a1[_0x11a6('0x27')]||0x0;this[_0x11a6('0x28')]=_0x5b72a1[_0x11a6('0x28')]||0x1;this[_0x11a6('0x29')]=_0x5b72a1['dialPredictiveOptimization']||'dropRate';this[_0x11a6('0x2a')]=_0x5b72a1['dialPredictiveOptimizationPercentage']||0.03;this[_0x11a6('0x2b')]=_0x5b72a1['dialPredictiveInterval']||0x258;this['dialOriginateCallerIdName']=_0x5b72a1['dialOriginateCallerIdName']||'anonymous';this[_0x11a6('0x2c')]=_0x5b72a1['dialOriginateCallerIdNumber']||_0x11a6('0x2d');this[_0x11a6('0x2e')]=_0x5b72a1['dialOriginateTimeout']||0x1e;this['dialQueueOptions']=_0x5b72a1[_0x11a6('0x2f')]||_0x11a6('0x30');this[_0x11a6('0x31')]=_0x5b72a1[_0x11a6('0x31')]||0x3;this[_0x11a6('0x32')]=_0x5b72a1[_0x11a6('0x32')]||undefined;this[_0x11a6('0x33')]=_0x5b72a1[_0x11a6('0x33')]||0x3;this[_0x11a6('0x34')]=_0x5b72a1[_0x11a6('0x34')]||0x96;this[_0x11a6('0x35')]=_0x5b72a1[_0x11a6('0x35')]||0x3;this[_0x11a6('0x36')]=_0x5b72a1[_0x11a6('0x36')]||0x96;this[_0x11a6('0x37')]=_0x5b72a1[_0x11a6('0x37')]||0x3;this[_0x11a6('0x38')]=_0x5b72a1[_0x11a6('0x38')]||0x96;this[_0x11a6('0x39')]=_0x5b72a1[_0x11a6('0x39')]||0x3;this[_0x11a6('0x3a')]=_0x5b72a1[_0x11a6('0x3a')]||0x96;this[_0x11a6('0x3b')]=_0x5b72a1[_0x11a6('0x3b')]||0x3;this[_0x11a6('0x3c')]=_0x5b72a1['dialDropRetryFrequency']||0x96;this[_0x11a6('0x3d')]=_0x5b72a1['dialAbandonedMaxRetry']||0x3;this[_0x11a6('0x3e')]=_0x5b72a1[_0x11a6('0x3e')]||0x96;this[_0x11a6('0x3f')]=_0x5b72a1[_0x11a6('0x3f')]||0x3;this[_0x11a6('0x40')]=_0x5b72a1['dialMachineRetryFrequency']||0x96;this[_0x11a6('0x41')]=_0x5b72a1[_0x11a6('0x41')]||0x3;this['dialAgentRejectRetryFrequency']=_0x5b72a1['dialAgentRejectRetryFrequency']||0x96;this['callAdditionalPhoneAfterMin']=_0x5b72a1[_0x11a6('0x42')]||0x3;this[_0x11a6('0x43')]=_0x5b72a1['dialGlobalMaxRetry']||0x4;this[_0x11a6('0x44')]=_0x5b72a1[_0x11a6('0x44')]?_0x5b72a1[_0x11a6('0x44')]:undefined;this[_0x11a6('0x45')]=_0x5b72a1[_0x11a6('0x45')]?_0x5b72a1['TrunkBackup']:undefined;this[_0x11a6('0x46')]=_0x5b72a1[_0x11a6('0x46')]||undefined;this[_0x11a6('0x47')]=_0x5b72a1[_0x11a6('0x47')]?_0x5b72a1[_0x11a6('0x47')]:undefined;this[_0x11a6('0x48')]=_0x5b72a1[_0x11a6('0x48')]||_0x11a6('0x49');this[_0x11a6('0x4a')]=_0x5b72a1[_0x11a6('0x4a')]||undefined;this[_0x11a6('0x4b')]=_0x5b72a1[_0x11a6('0x4b')]||undefined;this[_0x11a6('0x4c')]=strategy[_0x5b72a1['strategy']];this[_0x11a6('0x4d')]=!![];this[_0x11a6('0x4e')]=_0x5b72a1[_0x11a6('0x4e')]||![];this[_0x11a6('0x4f')]=_0x5b72a1[_0x11a6('0x4f')];this[_0x11a6('0x50')]=_0x5b72a1[_0x11a6('0x50')];this[_0x11a6('0x51')]=_0x5b72a1[_0x11a6('0x51')];this['dialAMDTotalAnalysisTime']=_0x5b72a1[_0x11a6('0x52')];this[_0x11a6('0x53')]=_0x5b72a1['dialAMDMinWordLength'];this[_0x11a6('0x54')]=_0x5b72a1[_0x11a6('0x54')];this[_0x11a6('0x55')]=_0x5b72a1['dialAMDMaximumNumberOfWords'];this[_0x11a6('0x56')]=_0x5b72a1[_0x11a6('0x56')];this['dialAMDMaximumWordLength']=_0x5b72a1['dialAMDMaximumWordLength'];this[_0x11a6('0x57')]=0x0;this['pTalking']=0x0;this[_0x11a6('0x58')]=_0x5b72a1[_0x11a6('0x58')];this['outboundAnswerCallsDay']=0x0;this[_0x11a6('0x59')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0x11a6('0x5a')]=0x0;this[_0x11a6('0x5b')]=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0x11a6('0x5c')]=0x0;this[_0x11a6('0x5d')]=0x0;this[_0x11a6('0x5e')]=0x0;this[_0x11a6('0x5f')]=0x0;this[_0x11a6('0x60')]=0x0;this[_0x11a6('0x61')]=0x0;this[_0x11a6('0x62')]=0x0;this['outboundAbandonedDay']=0x0;this[_0x11a6('0x63')]=undefined;this[_0x11a6('0x64')]=undefined;this['handlePredictive']=undefined;this[_0x11a6('0x65')]=1.05;this[_0x11a6('0x66')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0x11a6('0x67')]=0x0;this[_0x11a6('0x68')]=0x0;this[_0x11a6('0x69')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this['predictiveIntervalPauses']=0x0;this['predictiveIntervalAvailable']=0x0;this['predictiveIntervalMaxThreshold']=_0x5b72a1[_0x11a6('0x6a')]||0x14;this['predictiveIntervalMinThreshold']=_0x5b72a1[_0x11a6('0x6a')]||0xa;this[_0x11a6('0x6b')]=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this['predictiveIntervalHitRate']=0x1;this['erlangCalls']=0x0;this[_0x11a6('0x6c')]=0x0;this[_0x11a6('0x6d')]=0x0;this['erlangBusyFactor']=0x0;this[_0x11a6('0x6e')]=_0x5b72a1['dialRecallMeTimeout']||0x1e;this[_0x11a6('0x6f')]=_0x5b72a1['dialRecallInQueue']||![];this[_0x11a6('0x70')]=!!_0x5b72a1[_0x11a6('0x70')]||![];this['dialPreviewRecallmeReminder']=!!_0x5b72a1[_0x11a6('0x71')]||![];this['dialQueueProject2']=_0x5b72a1[_0x11a6('0x72')]||undefined;this[_0x11a6('0x73')]=_0x5b72a1[_0x11a6('0x73')]||![];this[_0x11a6('0x74')]=_0x5b72a1['dialAgiAfterHangupAgent']||![];this[_0x11a6('0x9')]=monitorFormat[_0x5b72a1[_0x11a6('0x9')]]?monitorFormat[_0x5b72a1[_0x11a6('0x9')]]:undefined;this[_0x11a6('0x75')]=_0x5b72a1[_0x11a6('0x75')]||![];this[_0x11a6('0x76')]=_0x5b72a1['mandatoryDispositionPause']?_0x5b72a1[_0x11a6('0x76')]:undefined;this[_0x11a6('0x77')]=![];}module[_0x11a6('0x78')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index b067a31..25cfe1c 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 _0x7dfd=['booked','keys','queue','exten','xcally-motion-preview','compareToInboundQueue','some','active','updateReportFromOutboundQueue','preview','available','loggedIn','loggedInDb','paused','ringing','talking','waiting','answered','inUse','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','sumDuration','total','name','strategy','abandoned','busy','invalid','onHold','notInUse','ringInUse','sumBillable','sumHoldTime','type','unavailable','unknown','unmanaged','outbound','pTalking','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','callerid','prototype','loggedin','callers','length','SIP/','online','includes','status'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var INBOUND_COUNTERS=[_0xd7df('0x0'),_0xd7df('0x1'),_0xd7df('0x2'),_0xd7df('0x3'),_0xd7df('0x4'),_0xd7df('0x5'),_0xd7df('0x6')];var OUTBOUND_COUNTERS=[_0xd7df('0x0'),_0xd7df('0x7'),_0xd7df('0x8'),_0xd7df('0x1'),_0xd7df('0x2'),_0xd7df('0x9'),_0xd7df('0xa'),_0xd7df('0xb'),_0xd7df('0xc'),_0xd7df('0xd'),'outboundCongestionCallsDay',_0xd7df('0xe'),_0xd7df('0xf'),_0xd7df('0x10'),_0xd7df('0x11'),'outboundUnknownCallsDay',_0xd7df('0x3'),'pTalking',_0xd7df('0x5'),'sumBillable',_0xd7df('0x12'),_0xd7df('0x13'),_0xd7df('0x6')];function VoiceQueueSummary(_0x18d8f8){this['id']=_0x18d8f8['id'];this[_0xd7df('0x14')]=_0x18d8f8[_0xd7df('0x14')];this[_0xd7df('0x15')]=_0x18d8f8[_0xd7df('0x15')];this[_0xd7df('0x16')]=_0x18d8f8[_0xd7df('0x16')]||0x0;this[_0xd7df('0x7')]=_0x18d8f8[_0xd7df('0x7')]||0x0;this[_0xd7df('0x0')]=_0x18d8f8[_0xd7df('0x0')]||0x0;this[_0xd7df('0x17')]=_0x18d8f8[_0xd7df('0x17')]||0x0;this[_0xd7df('0x8')]=_0x18d8f8['inUse']||0x0;this[_0xd7df('0x18')]=_0x18d8f8[_0xd7df('0x18')]||0x0;this['loggedIn']=_0x18d8f8[_0xd7df('0x1')]||0x0;this[_0xd7df('0x2')]=_0x18d8f8['loggedInDb']||0x0;this[_0xd7df('0x19')]=_0x18d8f8[_0xd7df('0x19')]||0x0;this[_0xd7df('0x1a')]=_0x18d8f8['notInUse']||0x0;this[_0xd7df('0x3')]=_0x18d8f8[_0xd7df('0x3')]||0x0;this[_0xd7df('0x4')]=_0x18d8f8['ringing']||0x0;this[_0xd7df('0x1b')]=_0x18d8f8[_0xd7df('0x1b')];this[_0xd7df('0x1c')]=_0x18d8f8['sumBillable'];this[_0xd7df('0x12')]=_0x18d8f8['sumDuration'];this[_0xd7df('0x1d')]=_0x18d8f8['sumHoldTime']||0x0;this[_0xd7df('0x5')]=_0x18d8f8[_0xd7df('0x5')]||0x0;this[_0xd7df('0x13')]=_0x18d8f8['total']||0x0;this[_0xd7df('0x1e')]=_0x18d8f8['type'];this[_0xd7df('0x1f')]=_0x18d8f8[_0xd7df('0x1f')]||0x0;this[_0xd7df('0x20')]=_0x18d8f8[_0xd7df('0x20')]||0x0;this[_0xd7df('0x21')]=_0x18d8f8[_0xd7df('0x21')]||0x0;this[_0xd7df('0x6')]=_0x18d8f8['waiting']||0x0;if(_0x18d8f8['type']===_0xd7df('0x22')){this[_0xd7df('0x23')]=_0x18d8f8[_0xd7df('0x23')]||0x0;this[_0xd7df('0x24')]=_0x18d8f8[_0xd7df('0x24')];this[_0xd7df('0x25')]=_0x18d8f8[_0xd7df('0x25')];this[_0xd7df('0x26')]=_0x18d8f8[_0xd7df('0x26')];this['dialOriginateCallerIdNumber']=_0x18d8f8[_0xd7df('0x27')];this[_0xd7df('0x28')]=_0x18d8f8[_0xd7df('0x28')];this[_0xd7df('0x29')]=_0x18d8f8[_0xd7df('0x29')];this[_0xd7df('0x2a')]=_0x18d8f8[_0xd7df('0x2a')];this[_0xd7df('0x2b')]=_0x18d8f8['outboundAnswerAgiCallsDay'];this['outboundAnswerCallsDay']=_0x18d8f8['outboundAnswerCallsDay'];this['outboundBlacklistCallsDay']=_0x18d8f8['outboundBlacklistCallsDay'];this[_0xd7df('0xd')]=_0x18d8f8['outboundBusyCallsDay'];this[_0xd7df('0x2c')]=_0x18d8f8[_0xd7df('0x2c')];this['outboundDropCallsDayACS']=_0x18d8f8[_0xd7df('0x2d')];this[_0xd7df('0x2e')]=_0x18d8f8['outboundDropCallsDayCallersExit'];this[_0xd7df('0x2f')]=_0x18d8f8[_0xd7df('0x2f')];this[_0xd7df('0xe')]=_0x18d8f8[_0xd7df('0xe')];this[_0xd7df('0xf')]=_0x18d8f8[_0xd7df('0xf')];this['outboundOriginateFailureCallsDay']=_0x18d8f8[_0xd7df('0x30')];this[_0xd7df('0x10')]=_0x18d8f8[_0xd7df('0x10')];this[_0xd7df('0x11')]=_0x18d8f8[_0xd7df('0x11')];this[_0xd7df('0x31')]=_0x18d8f8[_0xd7df('0x31')];this[_0xd7df('0x32')]=_0x18d8f8[_0xd7df('0x32')];this[_0xd7df('0x33')]=_0x18d8f8[_0xd7df('0x33')];this['predictiveIntervalAvgTalktime']=_0x18d8f8['predictiveIntervalAvgTalktime'];this[_0xd7df('0x34')]=_0x18d8f8['predictiveIntervalDroppedCallsCallersExit'];this[_0xd7df('0x35')]=_0x18d8f8[_0xd7df('0x35')];this[_0xd7df('0x36')]=_0x18d8f8[_0xd7df('0x36')];this['predictiveIntervalErlangCallsDroppedCalls']=_0x18d8f8['predictiveIntervalErlangCallsDroppedCalls'];this['predictiveIntervalHitRate']=_0x18d8f8[_0xd7df('0x37')];this[_0xd7df('0x38')]=_0x18d8f8['predictiveIntervalMultiplicativeFactor'];this[_0xd7df('0x39')]=_0x18d8f8[_0xd7df('0x39')];this[_0xd7df('0x3a')]=_0x18d8f8[_0xd7df('0x3a')];this['predictiveIntervalTotalCalls']=_0x18d8f8[_0xd7df('0x3b')];this[_0xd7df('0x9')]=_0x18d8f8['originated'];this[_0xd7df('0x3c')]=_0x18d8f8['erlangCalls'];this[_0xd7df('0x3d')]=_0x18d8f8[_0xd7df('0x3d')];this[_0xd7df('0x3e')]=_0x18d8f8['erlangAbandonmentRate'];this[_0xd7df('0x3f')]=_0x18d8f8[_0xd7df('0x3f')];this[_0xd7df('0x40')]=_0x18d8f8[_0xd7df('0x40')];this['startProgressive']=_0x18d8f8[_0xd7df('0x41')];this[_0xd7df('0x42')]=_0x18d8f8[_0xd7df('0x42')];this['statusMessage']=_0x18d8f8[_0xd7df('0x43')];}if(_0x18d8f8[_0xd7df('0x44')]){this[_0xd7df('0x44')]={'id':_0x18d8f8['Trunk']['id'],'name':_0x18d8f8[_0xd7df('0x44')][_0xd7df('0x14')],'active':_0x18d8f8['Trunk']['active'],'callerid':_0x18d8f8[_0xd7df('0x44')][_0xd7df('0x45')]};}}VoiceQueueSummary[_0xd7df('0x46')]['createReport']=function(_0x5e8cd0,_0x2c149e,_0x4ebdbe,_0xe606f4){this['loggedInDb']=0x0;this['talking']=0x0;this[_0xd7df('0x3')]=0x0;this['unknown']=0x0;this[_0xd7df('0x1a')]=0x0;this[_0xd7df('0x8')]=0x0;this[_0xd7df('0x17')]=0x0;this[_0xd7df('0x18')]=0x0;this[_0xd7df('0x1f')]=0x0;this[_0xd7df('0x4')]=0x0;this[_0xd7df('0x1b')]=0x0;this[_0xd7df('0x19')]=0x0;if(_0x4ebdbe){if(_0x4ebdbe[_0xd7df('0x0')]){this['available']=Number(_0x4ebdbe[_0xd7df('0x0')]);}if(_0x4ebdbe['loggedin']){this[_0xd7df('0x1')]=Number(_0x4ebdbe[_0xd7df('0x47')]);}if(_0x4ebdbe[_0xd7df('0x48')]){this[_0xd7df('0x6')]=Number(_0x4ebdbe[_0xd7df('0x48')]);}}for(var _0x145223=0x0;_0x145223<_0x5e8cd0[_0xd7df('0x49')];_0x145223++){var _0x38056b=_0x2c149e[_0xd7df('0x4a')+_0x5e8cd0[_0x145223]['name']];if(_0x38056b&&_0x38056b[_0xd7df('0x4b')]){this[_0xd7df('0x2')]+=0x1;}if(_0x5e8cd0[_0x145223]['incall']==='1'){this['talking']+=0x1;}if(_0x5e8cd0[_0x145223][_0xd7df('0x3')]==='1'&&!['2','7','8'][_0xd7df('0x4c')](_0x5e8cd0[_0x145223][_0xd7df('0x4d')])){this['paused']+=0x1;}switch(_0x5e8cd0[_0x145223]['status']){case'0':this[_0xd7df('0x20')]+=0x1;break;case'1':this['notInUse']+=0x1;break;case'2':this[_0xd7df('0x8')]+=0x1;break;case'3':this[_0xd7df('0x17')]+=0x1;break;case'4':this[_0xd7df('0x18')]+=0x1;break;case'5':this[_0xd7df('0x1f')]+=0x1;break;case'6':this[_0xd7df('0x4')]+=0x1;break;case'7':this[_0xd7df('0x1b')]+=0x1;break;case'8':this[_0xd7df('0x19')]+=0x1;break;}}if(this[_0xd7df('0x25')]===_0xd7df('0x4e')){var _0x319204=Object[_0xd7df('0x4f')](_0xe606f4);for(var _0x3a7c84=0x0;_0x3a7c84<_0x319204['length'];_0x3a7c84++){var _0x1f2f99=_0x319204[_0x3a7c84];var _0x43de77=_0xe606f4[_0x1f2f99];if(_0x43de77[_0xd7df('0x50')]===this[_0xd7df('0x14')]&&_0x43de77[_0xd7df('0x1e')]==='dialer'&&_0x43de77[_0xd7df('0x51')]===_0xd7df('0x52')){this[_0xd7df('0x5')]+=0x1;}}if(this['talking']>this[_0xd7df('0x8')]){this['talking']=this[_0xd7df('0x8')];}this[_0xd7df('0x23')]=0x0;}return this;};VoiceQueueSummary[_0xd7df('0x46')][_0xd7df('0x53')]=function(_0xc4a51b){var _0x4c5820=![];if(_0xc4a51b){_0x4c5820=INBOUND_COUNTERS['some'](function(_0x53ec02){return this[_0x53ec02]!==_0xc4a51b[_0x53ec02];},this);}return _0x4c5820;};VoiceQueueSummary[_0xd7df('0x46')]['compareToOutboundQueue']=function(_0x12c2b8){var _0x1ed688=![];var _0x32cdfa=![];var _0xdf3046=![];if(_0x12c2b8){_0x1ed688=this[_0xd7df('0x25')]!==_0x12c2b8[_0xd7df('0x25')]||this[_0xd7df('0x24')]!==_0x12c2b8[_0xd7df('0x24')]||this[_0xd7df('0x42')]!==_0x12c2b8[_0xd7df('0x42')]||this[_0xd7df('0x43')]!==_0x12c2b8[_0xd7df('0x43')];_0x32cdfa=OUTBOUND_COUNTERS[_0xd7df('0x54')](function(_0x109707){return this[_0x109707]!==_0x12c2b8[_0x109707];},this);if(this[_0xd7df('0x44')]&&_0x12c2b8[_0xd7df('0x44')]){_0xdf3046=this['Trunk'][_0xd7df('0x14')]!==_0x12c2b8[_0xd7df('0x44')]['name']||this['Trunk'][_0xd7df('0x55')]!==_0x12c2b8['Trunk'][_0xd7df('0x55')];}}return _0x1ed688||_0x32cdfa||_0xdf3046;};VoiceQueueSummary['prototype'][_0xd7df('0x56')]=function(_0x28151a){this[_0xd7df('0x7')]=_0x28151a['answered'];this['message']=_0x28151a['message'];this[_0xd7df('0x43')]=_0x28151a[_0xd7df('0x43')];this[_0xd7df('0x9')]=_0x28151a[_0xd7df('0x9')];this[_0xd7df('0xa')]=_0x28151a[_0xd7df('0xa')];this['outboundAnswerCallsDay']=_0x28151a[_0xd7df('0xb')];this[_0xd7df('0xc')]=_0x28151a[_0xd7df('0xc')];this[_0xd7df('0xd')]=_0x28151a[_0xd7df('0xd')];this[_0xd7df('0x2c')]=_0x28151a[_0xd7df('0x2c')];this[_0xd7df('0xe')]=_0x28151a[_0xd7df('0xe')];this[_0xd7df('0xf')]=_0x28151a[_0xd7df('0xf')];this[_0xd7df('0x10')]=_0x28151a[_0xd7df('0x10')];this[_0xd7df('0x11')]=_0x28151a[_0xd7df('0x11')];this[_0xd7df('0x31')]=_0x28151a[_0xd7df('0x31')];this[_0xd7df('0x1c')]=_0x28151a[_0xd7df('0x1c')];this[_0xd7df('0x12')]=_0x28151a[_0xd7df('0x12')];this[_0xd7df('0x13')]=_0x28151a[_0xd7df('0x13')];if(this[_0xd7df('0x25')]===_0xd7df('0x57')){this[_0xd7df('0x23')]=_0x28151a['pTalking'];}};module['exports']=VoiceQueueSummary; \ No newline at end of file +var _0x9865=['xcally-motion-preview','compareToInboundQueue','some','active','updateReportFromOutboundQueue','preview','exports','available','loggedIn','loggedInDb','paused','ringing','talking','waiting','answered','inUse','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','sumBillable','sumDuration','name','strategy','busy','invalid','onHold','notInUse','ringInUse','sumHoldTime','total','type','unavailable','unknown','unmanaged','outbound','pTalking','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','callerid','prototype','loggedin','callers','length','online','incall','includes','status','booked','keys','queue','dialer'];(function(_0x6dc660,_0x5e63fb){var _0x4fa02a=function(_0x3351f3){while(--_0x3351f3){_0x6dc660['push'](_0x6dc660['shift']());}};_0x4fa02a(++_0x5e63fb);}(_0x9865,0x1ba));var _0x5986=function(_0x4f08b0,_0x337546){_0x4f08b0=_0x4f08b0-0x0;var _0x10659b=_0x9865[_0x4f08b0];return _0x10659b;};'use strict';var INBOUND_COUNTERS=[_0x5986('0x0'),_0x5986('0x1'),_0x5986('0x2'),_0x5986('0x3'),_0x5986('0x4'),_0x5986('0x5'),_0x5986('0x6')];var OUTBOUND_COUNTERS=[_0x5986('0x0'),_0x5986('0x7'),_0x5986('0x8'),'loggedIn',_0x5986('0x2'),_0x5986('0x9'),_0x5986('0xa'),_0x5986('0xb'),'outboundBlacklistCallsDay','outboundBusyCallsDay',_0x5986('0xc'),'outboundNoAnswerCallsDay',_0x5986('0xd'),_0x5986('0xe'),_0x5986('0xf'),_0x5986('0x10'),_0x5986('0x3'),'pTalking',_0x5986('0x5'),_0x5986('0x11'),_0x5986('0x12'),'total','waiting'];function VoiceQueueSummary(_0x410117){this['id']=_0x410117['id'];this[_0x5986('0x13')]=_0x410117[_0x5986('0x13')];this[_0x5986('0x14')]=_0x410117[_0x5986('0x14')];this['abandoned']=_0x410117['abandoned']||0x0;this[_0x5986('0x7')]=_0x410117['answered']||0x0;this[_0x5986('0x0')]=_0x410117[_0x5986('0x0')]||0x0;this[_0x5986('0x15')]=_0x410117[_0x5986('0x15')]||0x0;this[_0x5986('0x8')]=_0x410117['inUse']||0x0;this['invalid']=_0x410117[_0x5986('0x16')]||0x0;this['loggedIn']=_0x410117[_0x5986('0x1')]||0x0;this[_0x5986('0x2')]=_0x410117[_0x5986('0x2')]||0x0;this[_0x5986('0x17')]=_0x410117[_0x5986('0x17')]||0x0;this[_0x5986('0x18')]=_0x410117[_0x5986('0x18')]||0x0;this[_0x5986('0x3')]=_0x410117[_0x5986('0x3')]||0x0;this[_0x5986('0x4')]=_0x410117['ringing']||0x0;this['ringInUse']=_0x410117[_0x5986('0x19')];this[_0x5986('0x11')]=_0x410117['sumBillable'];this[_0x5986('0x12')]=_0x410117[_0x5986('0x12')];this[_0x5986('0x1a')]=_0x410117[_0x5986('0x1a')]||0x0;this[_0x5986('0x5')]=_0x410117[_0x5986('0x5')]||0x0;this[_0x5986('0x1b')]=_0x410117[_0x5986('0x1b')]||0x0;this[_0x5986('0x1c')]=_0x410117[_0x5986('0x1c')];this[_0x5986('0x1d')]=_0x410117['unavailable']||0x0;this[_0x5986('0x1e')]=_0x410117['unknown']||0x0;this[_0x5986('0x1f')]=_0x410117['unmanaged']||0x0;this['waiting']=_0x410117[_0x5986('0x6')]||0x0;if(_0x410117['type']===_0x5986('0x20')){this[_0x5986('0x21')]=_0x410117['pTalking']||0x0;this[_0x5986('0x22')]=_0x410117[_0x5986('0x22')];this[_0x5986('0x23')]=_0x410117[_0x5986('0x23')];this[_0x5986('0x24')]=_0x410117[_0x5986('0x24')];this[_0x5986('0x25')]=_0x410117['dialOriginateCallerIdNumber'];this[_0x5986('0x26')]=_0x410117[_0x5986('0x26')];this[_0x5986('0x27')]=_0x410117[_0x5986('0x27')];this['temp']=_0x410117[_0x5986('0x28')];this['outboundAnswerAgiCallsDay']=_0x410117['outboundAnswerAgiCallsDay'];this[_0x5986('0xb')]=_0x410117[_0x5986('0xb')];this['outboundBlacklistCallsDay']=_0x410117[_0x5986('0x29')];this['outboundBusyCallsDay']=_0x410117[_0x5986('0x2a')];this['outboundCongestionCallsDay']=_0x410117['outboundCongestionCallsDay'];this[_0x5986('0x2b')]=_0x410117[_0x5986('0x2b')];this['outboundDropCallsDayCallersExit']=_0x410117[_0x5986('0x2c')];this[_0x5986('0x2d')]=_0x410117[_0x5986('0x2d')];this[_0x5986('0x2e')]=_0x410117['outboundNoAnswerCallsDay'];this[_0x5986('0xd')]=_0x410117['outboundNoSuchCallsDay'];this[_0x5986('0x2f')]=_0x410117['outboundOriginateFailureCallsDay'];this['outboundReCallsDay']=_0x410117[_0x5986('0xe')];this[_0x5986('0xf')]=_0x410117[_0x5986('0xf')];this['outboundUnknownCallsDay']=_0x410117[_0x5986('0x10')];this[_0x5986('0x30')]=_0x410117[_0x5986('0x30')];this[_0x5986('0x31')]=_0x410117[_0x5986('0x31')];this['predictiveIntervalAvgTalktime']=_0x410117[_0x5986('0x32')];this['predictiveIntervalDroppedCallsCallersExit']=_0x410117[_0x5986('0x33')];this['predictiveIntervalDroppedCallsTimeout']=_0x410117[_0x5986('0x34')];this[_0x5986('0x35')]=_0x410117['predictiveIntervalErlangCalls'];this[_0x5986('0x36')]=_0x410117[_0x5986('0x36')];this[_0x5986('0x37')]=_0x410117[_0x5986('0x37')];this[_0x5986('0x38')]=_0x410117['predictiveIntervalMultiplicativeFactor'];this['predictiveIntervalPauses']=_0x410117['predictiveIntervalPauses'];this[_0x5986('0x39')]=_0x410117['predictiveIntervalAvailable'];this[_0x5986('0x3a')]=_0x410117[_0x5986('0x3a')];this['originated']=_0x410117[_0x5986('0x9')];this['erlangCalls']=_0x410117['erlangCalls'];this[_0x5986('0x3b')]=_0x410117['erlangCallToSecond'];this[_0x5986('0x3c')]=_0x410117[_0x5986('0x3c')];this['erlangBusyFactor']=_0x410117[_0x5986('0x3d')];this[_0x5986('0x3e')]=_0x410117[_0x5986('0x3e')];this[_0x5986('0x3f')]=_0x410117[_0x5986('0x3f')];this['message']=_0x410117[_0x5986('0x40')];this['statusMessage']=_0x410117[_0x5986('0x41')];}if(_0x410117[_0x5986('0x42')]){this[_0x5986('0x42')]={'id':_0x410117[_0x5986('0x42')]['id'],'name':_0x410117['Trunk']['name'],'active':_0x410117[_0x5986('0x42')]['active'],'callerid':_0x410117[_0x5986('0x42')][_0x5986('0x43')]};}}VoiceQueueSummary[_0x5986('0x44')]['createReport']=function(_0x1bfe45,_0x313b1b,_0x33e0a5,_0x445642){this['loggedInDb']=0x0;this[_0x5986('0x5')]=0x0;this[_0x5986('0x3')]=0x0;this['unknown']=0x0;this['notInUse']=0x0;this[_0x5986('0x8')]=0x0;this[_0x5986('0x15')]=0x0;this[_0x5986('0x16')]=0x0;this['unavailable']=0x0;this[_0x5986('0x4')]=0x0;this['ringInUse']=0x0;this[_0x5986('0x17')]=0x0;if(_0x33e0a5){if(_0x33e0a5[_0x5986('0x0')]){this[_0x5986('0x0')]=Number(_0x33e0a5['available']);}if(_0x33e0a5[_0x5986('0x45')]){this[_0x5986('0x1')]=Number(_0x33e0a5[_0x5986('0x45')]);}if(_0x33e0a5[_0x5986('0x46')]){this[_0x5986('0x6')]=Number(_0x33e0a5['callers']);}}for(var _0x38eac7=0x0;_0x38eac7<_0x1bfe45[_0x5986('0x47')];_0x38eac7++){var _0x5853ef=_0x313b1b['SIP/'+_0x1bfe45[_0x38eac7][_0x5986('0x13')]];if(_0x5853ef&&_0x5853ef[_0x5986('0x48')]){this[_0x5986('0x2')]+=0x1;}if(_0x1bfe45[_0x38eac7][_0x5986('0x49')]==='1'){this[_0x5986('0x5')]+=0x1;}if(_0x1bfe45[_0x38eac7][_0x5986('0x3')]==='1'&&!['2','7','8'][_0x5986('0x4a')](_0x1bfe45[_0x38eac7][_0x5986('0x4b')])){this['paused']+=0x1;}switch(_0x1bfe45[_0x38eac7][_0x5986('0x4b')]){case'0':this[_0x5986('0x1e')]+=0x1;break;case'1':this[_0x5986('0x18')]+=0x1;break;case'2':this[_0x5986('0x8')]+=0x1;break;case'3':this[_0x5986('0x15')]+=0x1;break;case'4':this[_0x5986('0x16')]+=0x1;break;case'5':this['unavailable']+=0x1;break;case'6':this[_0x5986('0x4')]+=0x1;break;case'7':this[_0x5986('0x19')]+=0x1;break;case'8':this[_0x5986('0x17')]+=0x1;break;}}if(this[_0x5986('0x23')]===_0x5986('0x4c')){var _0x474cee=Object[_0x5986('0x4d')](_0x445642);for(var _0x583b27=0x0;_0x583b27<_0x474cee[_0x5986('0x47')];_0x583b27++){var _0x515ad7=_0x474cee[_0x583b27];var _0x4ec154=_0x445642[_0x515ad7];if(_0x4ec154[_0x5986('0x4e')]===this[_0x5986('0x13')]&&_0x4ec154[_0x5986('0x1c')]===_0x5986('0x4f')&&_0x4ec154['exten']===_0x5986('0x50')){this['talking']+=0x1;}}if(this[_0x5986('0x5')]>this['inUse']){this['talking']=this['inUse'];}this[_0x5986('0x21')]=0x0;}return this;};VoiceQueueSummary[_0x5986('0x44')][_0x5986('0x51')]=function(_0x45419c){var _0x2de902=![];if(_0x45419c){_0x2de902=INBOUND_COUNTERS[_0x5986('0x52')](function(_0x8fc975){return this[_0x8fc975]!==_0x45419c[_0x8fc975];},this);}return _0x2de902;};VoiceQueueSummary[_0x5986('0x44')]['compareToOutboundQueue']=function(_0x5db167){var _0x1f16e2=![];var _0xbd9813=![];var _0xae00df=![];if(_0x5db167){_0x1f16e2=this[_0x5986('0x23')]!==_0x5db167[_0x5986('0x23')]||this['dialActive']!==_0x5db167['dialActive']||this['message']!==_0x5db167[_0x5986('0x40')]||this[_0x5986('0x41')]!==_0x5db167[_0x5986('0x41')];_0xbd9813=OUTBOUND_COUNTERS[_0x5986('0x52')](function(_0x378606){return this[_0x378606]!==_0x5db167[_0x378606];},this);if(this[_0x5986('0x42')]&&_0x5db167[_0x5986('0x42')]){_0xae00df=this[_0x5986('0x42')][_0x5986('0x13')]!==_0x5db167[_0x5986('0x42')][_0x5986('0x13')]||this[_0x5986('0x42')][_0x5986('0x53')]!==_0x5db167[_0x5986('0x42')][_0x5986('0x53')];}}return _0x1f16e2||_0xbd9813||_0xae00df;};VoiceQueueSummary[_0x5986('0x44')][_0x5986('0x54')]=function(_0x1c89a0){this[_0x5986('0x7')]=_0x1c89a0[_0x5986('0x7')];this[_0x5986('0x40')]=_0x1c89a0[_0x5986('0x40')];this['statusMessage']=_0x1c89a0[_0x5986('0x41')];this[_0x5986('0x9')]=_0x1c89a0[_0x5986('0x9')];this[_0x5986('0xa')]=_0x1c89a0[_0x5986('0xa')];this['outboundAnswerCallsDay']=_0x1c89a0['outboundAnswerCallsDay'];this[_0x5986('0x29')]=_0x1c89a0[_0x5986('0x29')];this[_0x5986('0x2a')]=_0x1c89a0[_0x5986('0x2a')];this[_0x5986('0xc')]=_0x1c89a0[_0x5986('0xc')];this[_0x5986('0x2e')]=_0x1c89a0[_0x5986('0x2e')];this[_0x5986('0xd')]=_0x1c89a0[_0x5986('0xd')];this['outboundReCallsDay']=_0x1c89a0[_0x5986('0xe')];this[_0x5986('0xf')]=_0x1c89a0[_0x5986('0xf')];this['outboundUnknownCallsDay']=_0x1c89a0[_0x5986('0x10')];this[_0x5986('0x11')]=_0x1c89a0[_0x5986('0x11')];this[_0x5986('0x12')]=_0x1c89a0[_0x5986('0x12')];this[_0x5986('0x1b')]=_0x1c89a0[_0x5986('0x1b')];if(this['dialMethod']===_0x5986('0x55')){this[_0x5986('0x21')]=_0x1c89a0[_0x5986('0x21')];}};module[_0x5986('0x56')]=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index f242bf0..e359b4c 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 _0x5e11=['serverUrl','Configurations','exports','name','username','accessKey','remoteUri'];(function(_0x45ee03,_0x2f5319){var _0x13d535=function(_0x391904){while(--_0x391904){_0x45ee03['push'](_0x45ee03['shift']());}};_0x13d535(++_0x2f5319);}(_0x5e11,0x1c3));var _0x15e1=function(_0x1aa3fe,_0x27c5fa){_0x1aa3fe=_0x1aa3fe-0x0;var _0x163cee=_0x5e11[_0x1aa3fe];return _0x163cee;};'use strict';function VtigerAccount(_0x5e5647){this['id']=_0x5e5647['id']||0x0;this['name']=_0x5e5647[_0x15e1('0x0')]||'';this[_0x15e1('0x1')]=_0x5e5647[_0x15e1('0x1')]||'';this[_0x15e1('0x2')]=_0x5e5647[_0x15e1('0x2')]||'';this[_0x15e1('0x3')]=_0x5e5647['remoteUri']||'';this[_0x15e1('0x4')]=_0x5e5647['serverUrl']||'';this[_0x15e1('0x5')]=_0x5e5647[_0x15e1('0x5')]||{};}module[_0x15e1('0x6')]=VtigerAccount; \ No newline at end of file +var _0x83dd=['Configurations','exports','name','username','accessKey','remoteUri','serverUrl'];(function(_0x297dcf,_0x448cf5){var _0xe1699b=function(_0x8b1e0f){while(--_0x8b1e0f){_0x297dcf['push'](_0x297dcf['shift']());}};_0xe1699b(++_0x448cf5);}(_0x83dd,0x12f));var _0xd83d=function(_0x191953,_0x19d9e3){_0x191953=_0x191953-0x0;var _0x2621a7=_0x83dd[_0x191953];return _0x2621a7;};'use strict';function VtigerAccount(_0x540116){this['id']=_0x540116['id']||0x0;this['name']=_0x540116[_0xd83d('0x0')]||'';this['username']=_0x540116[_0xd83d('0x1')]||'';this[_0xd83d('0x2')]=_0x540116[_0xd83d('0x2')]||'';this[_0xd83d('0x3')]=_0x540116[_0xd83d('0x3')]||'';this[_0xd83d('0x4')]=_0x540116[_0xd83d('0x4')]||'';this[_0xd83d('0x5')]=_0x540116[_0xd83d('0x5')]||{};}module[_0xd83d('0x6')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 6aa0b9b..2a5d1fa 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 _0x4929=['name','username','password','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations'];(function(_0x3682ac,_0x4c1c05){var _0x1d93e2=function(_0x25f7bd){while(--_0x25f7bd){_0x3682ac['push'](_0x3682ac['shift']());}};_0x1d93e2(++_0x4c1c05);}(_0x4929,0xdc));var _0x9492=function(_0x5c6e78,_0xf8e716){_0x5c6e78=_0x5c6e78-0x0;var _0x3f076b=_0x4929[_0x5c6e78];return _0x3f076b;};'use strict';function ZendeskAccount(_0xa15666){this['id']=_0xa15666['id']||0x0;this[_0x9492('0x0')]=_0xa15666[_0x9492('0x0')]||'';this[_0x9492('0x1')]=_0xa15666[_0x9492('0x1')]||'';this[_0x9492('0x2')]=_0xa15666[_0x9492('0x2')]||'';this[_0x9492('0x3')]=_0xa15666['token']||'';this[_0x9492('0x4')]=_0xa15666[_0x9492('0x4')]||'';this[_0x9492('0x5')]=_0xa15666[_0x9492('0x5')]||'';this[_0x9492('0x6')]=_0xa15666[_0x9492('0x6')]||_0x9492('0x7');this[_0x9492('0x8')]=_0xa15666[_0x9492('0x8')]||'';this[_0x9492('0x9')]=_0xa15666[_0x9492('0x9')]||{};}module['exports']=ZendeskAccount; \ No newline at end of file +var _0x9d6f=['serverUrl','Configurations','exports','name','username','password','token','remoteUri','authType','type','integrationTab'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0x9d6f,0x142));var _0xf9d6=function(_0x2b42f8,_0x530453){_0x2b42f8=_0x2b42f8-0x0;var _0x1f21f6=_0x9d6f[_0x2b42f8];return _0x1f21f6;};'use strict';function ZendeskAccount(_0x3947e5){this['id']=_0x3947e5['id']||0x0;this[_0xf9d6('0x0')]=_0x3947e5['name']||'';this[_0xf9d6('0x1')]=_0x3947e5['username']||'';this[_0xf9d6('0x2')]=_0x3947e5[_0xf9d6('0x2')]||'';this['token']=_0x3947e5[_0xf9d6('0x3')]||'';this[_0xf9d6('0x4')]=_0x3947e5['remoteUri']||'';this[_0xf9d6('0x5')]=_0x3947e5['authType']||'';this[_0xf9d6('0x6')]=_0x3947e5[_0xf9d6('0x6')]||_0xf9d6('0x7');this[_0xf9d6('0x8')]=_0x3947e5[_0xf9d6('0x8')]||'';this[_0xf9d6('0x9')]=_0x3947e5[_0xf9d6('0x9')]||{};}module[_0xf9d6('0xa')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 32b77bc..1331e2c 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 _0xa23a=['Configurations','exports','name','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken'];(function(_0x27a5b8,_0x10b486){var _0x31d17e=function(_0x4e852){while(--_0x4e852){_0x27a5b8['push'](_0x27a5b8['shift']());}};_0x31d17e(++_0x10b486);}(_0xa23a,0xb2));var _0xaa23=function(_0x581182,_0x4d140b){_0x581182=_0x581182-0x0;var _0x27eed2=_0xa23a[_0x581182];return _0x27eed2;};'use strict';function ZohoAccount(_0x5f021a){this['id']=_0x5f021a['id']||0x0;this['name']=_0x5f021a[_0xaa23('0x0')]||'';this[_0xaa23('0x1')]=_0x5f021a['description']||'';this[_0xaa23('0x2')]=_0x5f021a[_0xaa23('0x2')]||'';this[_0xaa23('0x3')]=_0x5f021a[_0xaa23('0x3')]||'';this[_0xaa23('0x4')]=_0x5f021a[_0xaa23('0x4')]||'';this['clientSecret']=_0x5f021a[_0xaa23('0x5')]||'';this[_0xaa23('0x6')]=_0x5f021a[_0xaa23('0x6')]||'';this['code']=_0x5f021a[_0xaa23('0x7')]||'';this[_0xaa23('0x8')]=_0x5f021a[_0xaa23('0x8')]||'';this[_0xaa23('0x9')]=_0x5f021a[_0xaa23('0x9')]||{};}module[_0xaa23('0xa')]=ZohoAccount; \ No newline at end of file +var _0x47cb=['refreshToken','Configurations','host','zone','clientId','serverUrl','code'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x47cb,0x1e5));var _0xb47c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x47cb[_0x14add3];return _0x4a174f;};'use strict';function ZohoAccount(_0x4ed94b){this['id']=_0x4ed94b['id']||0x0;this['name']=_0x4ed94b['name']||'';this['description']=_0x4ed94b['description']||'';this[_0xb47c('0x0')]=_0x4ed94b[_0xb47c('0x0')]||'';this[_0xb47c('0x1')]=_0x4ed94b[_0xb47c('0x1')]||'';this['clientId']=_0x4ed94b[_0xb47c('0x2')]||'';this['clientSecret']=_0x4ed94b['clientSecret']||'';this[_0xb47c('0x3')]=_0x4ed94b[_0xb47c('0x3')]||'';this[_0xb47c('0x4')]=_0x4ed94b[_0xb47c('0x4')]||'';this[_0xb47c('0x5')]=_0x4ed94b[_0xb47c('0x5')]||'';this['Configurations']=_0x4ed94b[_0xb47c('0x6')]||{};}module['exports']=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 75604f5..0a61882 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 _0x4e2e=['countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','number','lodash','moment','string','isNil','uniqueid','idContact','queue','name','type','campaigntype','dialAnswer','Agent','channelAgent','format','SIP/%s','membername','calleridname','phone','Contact','firstName','lastName','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry'];(function(_0x45b034,_0x3a57dd){var _0x509cb0=function(_0x3a89d5){while(--_0x3a89d5){_0x45b034['push'](_0x45b034['shift']());}};_0x509cb0(++_0x3a57dd);}(_0x4e2e,0x1f2));var _0xe4e2=function(_0x46a60a,_0x50fb7e){_0x46a60a=_0x46a60a-0x0;var _0x13040c=_0x4e2e[_0x46a60a];return _0x13040c;};'use strict';var util=require('util');var _=require(_0xe4e2('0x0'));var moment=require(_0xe4e2('0x1'));function checkNameSurname(_0x2ae450,_0x1b178f,_0x2041b9){var _0x4284bf='';if(!_['isNil'](_0x1b178f)&&_0xe4e2('0x2')===typeof _0x1b178f){_0x4284bf+=_0x1b178f;}if(!_[_0xe4e2('0x3')](_0x2041b9)&&_0xe4e2('0x2')===typeof _0x2041b9){_0x4284bf+='\x20'+_0x2041b9;}if(_0x4284bf!==''){return _0x4284bf;}return _0x2ae450;}function Action(_0x38c84c,_0x48e83d,_0x322295,_0x36b1c6,_0x1c4e64){this[_0xe4e2('0x4')]=_0x322295||undefined;this[_0xe4e2('0x5')]=_0x38c84c['id'];this[_0xe4e2('0x6')]=_0x48e83d[_0xe4e2('0x7')];this[_0xe4e2('0x8')]=_0x48e83d['type'];this[_0xe4e2('0x9')]=_0xe4e2('0x6');this[_0xe4e2('0xa')]=![];this['membername']=_[_0xe4e2('0x3')](_0x38c84c[_0xe4e2('0xb')])?undefined:_0x38c84c[_0xe4e2('0xb')][_0xe4e2('0x7')];this[_0xe4e2('0xc')]=this['membername']?util[_0xe4e2('0xd')](_0xe4e2('0xe'),this[_0xe4e2('0xf')]):_0x36b1c6||undefined;this[_0xe4e2('0x10')]=checkNameSurname(_0x38c84c['Contact'][_0xe4e2('0x11')],_0x38c84c[_0xe4e2('0x12')][_0xe4e2('0x13')],_0x38c84c[_0xe4e2('0x12')][_0xe4e2('0x14')]);this['active']=_0x38c84c['active']||![];this[_0xe4e2('0x15')]=_0x38c84c[_0xe4e2('0x11')];this[_0xe4e2('0x16')]=_0x38c84c[_0xe4e2('0x16')];this[_0xe4e2('0x17')]=_0x38c84c['countbusyretry']||0x0;this[_0xe4e2('0x18')]=_0x38c84c[_0xe4e2('0x18')]||0x0;this[_0xe4e2('0x19')]=_0x38c84c['countnoanswerretry']||0x0;this[_0xe4e2('0x1a')]=(_0x38c84c['countbusyretry']||0x0)+(_0x38c84c[_0xe4e2('0x18')]||0x0)+(_0x38c84c[_0xe4e2('0x19')]||0x0)+(_0x38c84c[_0xe4e2('0x1b')]||0x0)+(_0x38c84c[_0xe4e2('0x1c')]||0x0)+(_0x38c84c[_0xe4e2('0x1d')]||0x0)+(_0x38c84c[_0xe4e2('0x1e')]||0x0)+(_0x38c84c[_0xe4e2('0x1f')]||0x0);this[_0xe4e2('0x1b')]=_0x38c84c[_0xe4e2('0x1b')]||0x0;this[_0xe4e2('0x1c')]=_0x38c84c['countdropretry']||0x0;this[_0xe4e2('0x1d')]=_0x38c84c[_0xe4e2('0x1d')]||0x0;this[_0xe4e2('0x1e')]=_0x38c84c[_0xe4e2('0x1e')]||0x0;this[_0xe4e2('0x1f')]=_0x38c84c[_0xe4e2('0x1f')]||0x0;this[_0xe4e2('0x20')]=_0x38c84c['callback'];this[_0xe4e2('0x21')]=_0x38c84c[_0xe4e2('0x21')];this[_0xe4e2('0x22')]=_0x38c84c['callbackat'];this[_0xe4e2('0x23')]=_0x38c84c[_0xe4e2('0x23')];this['ContactId']=_0x38c84c[_0xe4e2('0x24')];this[_0xe4e2('0x25')]=_0x38c84c[_0xe4e2('0x25')];this[_0xe4e2('0x26')]=_[_0xe4e2('0x3')](_0x38c84c['Agent'])?_0x38c84c[_0xe4e2('0x26')]:_0x38c84c[_0xe4e2('0xb')]['id'];this[_0xe4e2('0x27')]=_0x38c84c['VoiceQueueId'];this[_0xe4e2('0x28')]='';this[_0xe4e2('0x29')]='';}Action[_0xe4e2('0x2a')]['getCaller']=function(){return util[_0xe4e2('0xd')]('\x22%s\x22\x20<%s>',this[_0xe4e2('0x10')],this[_0xe4e2('0x2b')]);};module['exports']=Action; \ No newline at end of file +var _0x627e=['SIP/%s','Contact','phone','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countagentrejectretry','countnosuchnumberretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','exports','util','lodash','moment','isNil','string','uniqueid','idContact','name','campaigntype','queue','Agent','channelAgent','membername','format'];(function(_0x103498,_0x3df764){var _0x192b3e=function(_0x4d3e25){while(--_0x4d3e25){_0x103498['push'](_0x103498['shift']());}};_0x192b3e(++_0x3df764);}(_0x627e,0x14a));var _0xe627=function(_0x127b92,_0x2bc850){_0x127b92=_0x127b92-0x0;var _0x5889ee=_0x627e[_0x127b92];return _0x5889ee;};'use strict';var util=require(_0xe627('0x0'));var _=require(_0xe627('0x1'));var moment=require(_0xe627('0x2'));function checkNameSurname(_0x18dba3,_0x3afa80,_0x48b97a){var _0x2b7158='';if(!_[_0xe627('0x3')](_0x3afa80)&&_0xe627('0x4')===typeof _0x3afa80){_0x2b7158+=_0x3afa80;}if(!_['isNil'](_0x48b97a)&&'string'===typeof _0x48b97a){_0x2b7158+='\x20'+_0x48b97a;}if(_0x2b7158!==''){return _0x2b7158;}return _0x18dba3;}function Action(_0x4efcad,_0x1a1a3d,_0x3f2791,_0x45e49a,_0x2d4f63){this[_0xe627('0x5')]=_0x3f2791||undefined;this[_0xe627('0x6')]=_0x4efcad['id'];this['queue']=_0x1a1a3d[_0xe627('0x7')];this['type']=_0x1a1a3d['type'];this[_0xe627('0x8')]=_0xe627('0x9');this['dialAnswer']=![];this['membername']=_[_0xe627('0x3')](_0x4efcad[_0xe627('0xa')])?undefined:_0x4efcad[_0xe627('0xa')][_0xe627('0x7')];this[_0xe627('0xb')]=this[_0xe627('0xc')]?util[_0xe627('0xd')](_0xe627('0xe'),this[_0xe627('0xc')]):_0x45e49a||undefined;this['calleridname']=checkNameSurname(_0x4efcad[_0xe627('0xf')][_0xe627('0x10')],_0x4efcad[_0xe627('0xf')]['firstName'],_0x4efcad[_0xe627('0xf')][_0xe627('0x11')]);this[_0xe627('0x12')]=_0x4efcad[_0xe627('0x12')]||![];this[_0xe627('0x13')]=_0x4efcad[_0xe627('0x10')];this[_0xe627('0x14')]=_0x4efcad['scheduledat'];this[_0xe627('0x15')]=_0x4efcad[_0xe627('0x15')]||0x0;this[_0xe627('0x16')]=_0x4efcad[_0xe627('0x16')]||0x0;this[_0xe627('0x17')]=_0x4efcad[_0xe627('0x17')]||0x0;this[_0xe627('0x18')]=(_0x4efcad[_0xe627('0x15')]||0x0)+(_0x4efcad['countcongestionretry']||0x0)+(_0x4efcad[_0xe627('0x17')]||0x0)+(_0x4efcad['countnosuchnumberretry']||0x0)+(_0x4efcad[_0xe627('0x19')]||0x0)+(_0x4efcad['countabandonedretry']||0x0)+(_0x4efcad['countmachineretry']||0x0)+(_0x4efcad[_0xe627('0x1a')]||0x0);this['countnosuchnumberretry']=_0x4efcad[_0xe627('0x1b')]||0x0;this[_0xe627('0x19')]=_0x4efcad['countdropretry']||0x0;this['countabandonedretry']=_0x4efcad['countabandonedretry']||0x0;this[_0xe627('0x1c')]=_0x4efcad[_0xe627('0x1c')]||0x0;this['countagentrejectretry']=_0x4efcad[_0xe627('0x1a')]||0x0;this[_0xe627('0x1d')]=_0x4efcad['callback'];this[_0xe627('0x1e')]=_0x4efcad[_0xe627('0x1e')];this['callbackat']=_0x4efcad[_0xe627('0x1f')];this[_0xe627('0x20')]=_0x4efcad[_0xe627('0x20')];this['ContactId']=_0x4efcad[_0xe627('0x21')];this[_0xe627('0x22')]=_0x4efcad[_0xe627('0x22')];this[_0xe627('0x23')]=_['isNil'](_0x4efcad[_0xe627('0xa')])?_0x4efcad[_0xe627('0x23')]:_0x4efcad[_0xe627('0xa')]['id'];this[_0xe627('0x24')]=_0x4efcad[_0xe627('0x24')];this[_0xe627('0x25')]='';this[_0xe627('0x26')]='';}Action[_0xe627('0x27')][_0xe627('0x28')]=function(){return util['format'](_0xe627('0x29'),this['calleridname'],this['number']);};module[_0xe627('0x2a')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 4f515a2..0c08cbe 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 _0x5ffd=['NO_AGENTS_LOGGED','isActive','isTrunkReachable','Trunk','TrunkBackup','UNREACHABLE_TRUNK','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','scheduledAt','unlockAgent','activeContact','linkedid','actioncountonusuch','incrementPreviewCounters','idContact','swapAdditionalPhones','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','pTalking','custom:agentconnect','buildObj','acw','mandatoryDisposition','custom:agentConnectPreview','channelAgent','custom:agentcomplete','complete','outboundAnswerCallsDay','total','answered','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','sumDuration','sumBillable','talktime','[syncHangup][talking][decrement]','\x20Queue','countbusyretry','Busy','dialBusyRetryFrequency','custom:agentbusy','[callProgressDetectingCustomer][logBusy]','rescheduleContact','outboundNoAnswerCallsDay','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','[callProgressDetectingCustomer][logNoAnswer]','cloneAction','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedRetryFrequency','outboundUnknownCallsDay','countmachineretry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalking][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','queueSummaryCountersUpdated','callProgressDetectingAgent','isUndefined','object','reason','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','logAgent','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','phone','Contact\x20is\x20undefined','Queue','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','reachable','unmonitored','execRun','unlock','unlockContact','pick','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','checkInBlack','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','isEmpty','[Preview][validateContact][Empty\x20Campaign]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','execCall','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','getCallerIdRandom','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','Contact','assign','merge','toLowerVariables','variables','variablesAction','Action','[originated][increment]','OriginateError','syncOriginateResponse','actionid','lookAgent','logLookAgent','isFailure','response','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','syncHangup','[syncHangup][talking]','[syncHangup][talking][cause]','cause','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','destuniqueid','syncVarSet','filterKey','variable','addVariable','keys','value','[syncVarSet][Preview]','inspect','transfertargetlinkedid','syncBlindTransfer','transfererlinkedid','exports','util','lodash','uuid','moment','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','../rpc/cmHopperAdditionalPhone','./action','./util/util','redis','defaults','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','bind','hangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','attendedtransfer','syncAttendedTransfer','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','voice:queue:%s','voice_queue_channel:remove','emit','voice_queue_presence:remove','originated','sendMessageOneNotActive','available','paused','message','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','name','\x20is\x20not\x20active','CAMPAIGN_STATUS','DEACTIVATED','loopCampaigns','syncCampaigns','dialMethod','booked','outbound','clearZombieChannels','type','dialActive','setMessage','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','queue','originated:\x20','pTalking:\x20','dialAnswer','contactId','VoiceQueueId','ListId','status','channel','catch','No\x20such\x20channel','decrementOriginate','[clearZombieChannel]','decrementTalking','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','hasOwnProperty','getContactRecallMe','agentReadyId','then','scheduledat','dialRecallMeTimeout','Agent','run','logger2','[RecallMe]','disableContact','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','loggedIn'];(function(_0x10bca2,_0xdceda8){var _0x166dee=function(_0x5e6a69){while(--_0x5e6a69){_0x10bca2['push'](_0x10bca2['shift']());}};_0x166dee(++_0xdceda8);}(_0x5ffd,0xdf));var _0xd5ff=function(_0x109798,_0x4e7400){_0x109798=_0x109798-0x0;var _0x466568=_0x5ffd[_0x109798];return _0x466568;};'use strict';var util=require(_0xd5ff('0x0'));var _=require(_0xd5ff('0x1'));var uuid=require(_0xd5ff('0x2'));var moment=require(_0xd5ff('0x3'));var Redis=require(_0xd5ff('0x4'));var config=require(_0xd5ff('0x5'));var logger=require(_0xd5ff('0x6'))(_0xd5ff('0x7'));var loggerAction=require(_0xd5ff('0x6'))(_0xd5ff('0x8'));var ami=require(_0xd5ff('0x9'));var rpcDb=require('./rpcDb');var cmHopperAdditionalPhone=require(_0xd5ff('0xa'));var Action=require(_0xd5ff('0xb'));var ut=require(_0xd5ff('0xc'));var utils=require('../dialer/utils');config[_0xd5ff('0xd')]=_[_0xd5ff('0xe')](config[_0xd5ff('0xd')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Sequence=function(){};Sequence[_0xd5ff('0xf')][_0xd5ff('0x10')]=function(_0x1bf617){this['tail']=this[_0xd5ff('0x11')]?this['tail'][_0xd5ff('0x12')](_0x1bf617):_0x1bf617();};function Preview(_0x556d4a){this[_0xd5ff('0x13')]=new Sequence();this[_0xd5ff('0x14')]=_0x556d4a[_0xd5ff('0x15')];this[_0xd5ff('0x16')]=_0x556d4a[_0xd5ff('0x16')];this[_0xd5ff('0x17')]={};this[_0xd5ff('0x18')]=_0x556d4a[_0xd5ff('0x18')];this[_0xd5ff('0x19')]=0x0;ami['on'](_0xd5ff('0x1a'),this['syncOriginateResponse'][_0xd5ff('0x1b')](this));ami['on'](_0xd5ff('0x1c'),this['syncHangup'][_0xd5ff('0x1b')](this));ami['on'](_0xd5ff('0x1d'),this[_0xd5ff('0x1e')]['bind'](this));ami['on'](_0xd5ff('0x1f'),this[_0xd5ff('0x20')]['bind'](this));ami['on'](_0xd5ff('0x21'),this[_0xd5ff('0x22')][_0xd5ff('0x1b')](this));ami['on']('varset',this['syncVarSet'][_0xd5ff('0x1b')](this));ami['on'](_0xd5ff('0x23'),this[_0xd5ff('0x24')][_0xd5ff('0x1b')](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0xd5ff('0x1b')](this));this['loopCampaigns'](this[_0xd5ff('0x14')]);}function emit(_0x513a20,_0x357736,_0x4eae55){io['to'](_0x513a20)['emit'](_0x357736,_0x4eae55);}function emitVoiceQueueChannelRemove(_0x536758){logger[_0xd5ff('0x25')](_0xd5ff('0x26'),JSON[_0xd5ff('0x27')](_0x536758));emit(util[_0xd5ff('0x28')](_0xd5ff('0x29'),_0x536758['name']),_0xd5ff('0x2a'),_0x536758);io[_0xd5ff('0x2b')](_0xd5ff('0x2c'),_0x536758);}function notSendMessagesQueue(_0x3e462b){if(_0x3e462b['sendMessageOneNotActive']){if(_0x3e462b[_0xd5ff('0x2d')]===0x0&&_0x3e462b['pTalking']===0x0){_0x3e462b[_0xd5ff('0x2e')]=![];_0x3e462b[_0xd5ff('0x2f')]=0x0;_0x3e462b[_0xd5ff('0x30')]=0x0;_0x3e462b[_0xd5ff('0x31')]=utils['CAMPAIGN_STATUS'][_0xd5ff('0x32')];ut[_0xd5ff('0x33')](_0xd5ff('0x34'),_0x3e462b[_0xd5ff('0x35')]+_0xd5ff('0x36'));}else{_0x3e462b[_0xd5ff('0x31')]=utils[_0xd5ff('0x37')][_0xd5ff('0x38')];ut[_0xd5ff('0x33')](_0xd5ff('0x34'),_0x3e462b[_0xd5ff('0x35')]+'\x20is\x20deactivated');}}}Preview['prototype'][_0xd5ff('0x39')]=function(){var _0x4cb91d=this;setInterval(function(){_0x4cb91d[_0xd5ff('0x3a')]();},0x7cf);};Preview[_0xd5ff('0xf')][_0xd5ff('0x3a')]=function(){var _0x58e7f6=this['campaignsPreview'];this[_0xd5ff('0x19')]+=0x1;for(var _0x31cffb in _0x58e7f6){if(_0x58e7f6['hasOwnProperty'](_0x31cffb)&&(_0x58e7f6[_0x31cffb][_0xd5ff('0x3b')]==='preview'||_0x58e7f6[_0x31cffb][_0xd5ff('0x3b')]===_0xd5ff('0x3c'))&&_0x58e7f6[_0x31cffb]['type']===_0xd5ff('0x3d')){if(this['clockClearZombieChannels']>0x7){this[_0xd5ff('0x19')]=0x0;this[_0xd5ff('0x3e')]();}}if(_0x58e7f6['hasOwnProperty'](_0x31cffb)&&_0x58e7f6[_0x31cffb][_0xd5ff('0x3b')]==='preview'&&_0x58e7f6[_0x31cffb][_0xd5ff('0x3f')]==='outbound'){if(_0x58e7f6[_0x31cffb][_0xd5ff('0x40')]){this[_0xd5ff('0x41')](_0x58e7f6[_0x31cffb]);if(_0x58e7f6[_0x31cffb]['dialPreviewAutoRecallMe'])this[_0xd5ff('0x42')](_0x58e7f6[_0x31cffb]);}else{notSendMessagesQueue(_0x58e7f6[_0x31cffb]);}}}};Preview[_0xd5ff('0xf')][_0xd5ff('0x43')]=function(_0x5f94c){var _0x130e57=this;this[_0xd5ff('0x13')][_0xd5ff('0x10')](function(){if(!_[_0xd5ff('0x44')](_0x130e57[_0xd5ff('0x17')][_0x5f94c])){loggerAction[_0xd5ff('0x25')](_0xd5ff('0x45'),_0x5f94c,'Queue',_0x130e57[_0xd5ff('0x17')][_0x5f94c][_0xd5ff('0x46')],_0xd5ff('0x47'),JSON['stringify'](_0x130e57[_0xd5ff('0x14')][_0x130e57[_0xd5ff('0x17')][_0x5f94c][_0xd5ff('0x46')]][_0xd5ff('0x2d')]),_0xd5ff('0x48'),JSON['stringify'](_0x130e57[_0xd5ff('0x14')][_0x130e57['actions'][_0x5f94c][_0xd5ff('0x46')]]['pTalking']),JSON[_0xd5ff('0x27')](_0x130e57['actions'][_0x5f94c][_0xd5ff('0x49')]),JSON[_0xd5ff('0x27')](_['pick'](_0x130e57['actions'][_0x5f94c],[_0xd5ff('0x4a'),'UserId',_0xd5ff('0x4b'),_0xd5ff('0x4c')])));return ami['Action']({'action':_0xd5ff('0x4d'),'channel':_0x130e57[_0xd5ff('0x17')][_0x5f94c][_0xd5ff('0x4e')]})[_0xd5ff('0x4f')](function(_0x6ca0f0){if(_0x6ca0f0['message']===_0xd5ff('0x50')){setTimeout(function(){if(_0x130e57[_0xd5ff('0x17')][_0x5f94c]){utils[_0xd5ff('0x51')](_0x130e57[_0xd5ff('0x14')][_0x130e57[_0xd5ff('0x17')][_0x5f94c][_0xd5ff('0x46')]],_0xd5ff('0x52'));if(_0x130e57[_0xd5ff('0x17')][_0x5f94c]['dialAnswer']===!![]){ut[_0xd5ff('0x53')](_0x130e57[_0xd5ff('0x14')][_0x130e57[_0xd5ff('0x17')][_0x5f94c]['queue']],_0xd5ff('0x52'));ut[_0xd5ff('0x54')](_0xd5ff('0x55')+_0x5f94c,_0x130e57[_0xd5ff('0x17')][_0x5f94c][_0xd5ff('0x46')]);}ut['loggerError'](_0xd5ff('0x56')+_0x5f94c,_0x130e57[_0xd5ff('0x17')][_0x5f94c][_0xd5ff('0x46')]);delete _0x130e57[_0xd5ff('0x17')][_0x5f94c];}},0x2328);}});}});};Preview[_0xd5ff('0xf')][_0xd5ff('0x3e')]=function(){var _0x16c820=this;loggerAction['info']('[action]',_['size'](this['actions']));for(var _0x3ecad4 in this[_0xd5ff('0x17')]){if(_0x16c820[_0xd5ff('0x17')][_0xd5ff('0x57')](_0x3ecad4)){_0x16c820['clearZombieChannel'](_0x3ecad4);}}};Preview['prototype'][_0xd5ff('0x42')]=function(_0x572f68){var _0x8c72d=this;rpcDb[_0xd5ff('0x58')](_0x572f68['id'],ut[_0xd5ff('0x59')](this[_0xd5ff('0x18')]))[_0xd5ff('0x5a')](function(_0x5862d9){if(!_[_0xd5ff('0x44')](_0x5862d9)){for(var _0x291ffd=0x0;_0x291ffd<_0x5862d9['length'];_0x291ffd+=0x1){if(ut['getDiff'](_0x5862d9[_0x291ffd][_0xd5ff('0x5b')])<_0x572f68[_0xd5ff('0x5c')]*0x3c){if(_0x5862d9[_0x291ffd]['Agent']&&!_0x5862d9[_0x291ffd][_0xd5ff('0x5d')]['voicePause']){_0x8c72d[_0xd5ff('0x5e')](_0x5862d9[_0x291ffd]['id'])[_0xd5ff('0x5a')](ut[_0xd5ff('0x5f')]('[RecallMe]'))[_0xd5ff('0x4f')](ut['logger2'](_0xd5ff('0x60')));}else{rpcDb[_0xd5ff('0x61')](_0x5862d9[_0x291ffd]['id']);}}else{var _0x9358c8=new Action(_0x5862d9[_0x291ffd],_0x572f68);_0x9358c8['starttime']=moment()[_0xd5ff('0x28')](_0xd5ff('0x62'));_0x572f68['outboundReCallsDay']+=0x1;ut[_0xd5ff('0x63')](_0x9358c8,0x17,_0xd5ff('0x64'));if(_0x572f68[_0xd5ff('0x65')]){rpcDb[_0xd5ff('0x66')](ut[_0xd5ff('0x67')](_0x5862d9[_0x291ffd]));rpcDb[_0xd5ff('0x68')](_0x9358c8,_0xd5ff('0x69'));}else{ut[_0xd5ff('0x63')](_0x9358c8,0x16,_0xd5ff('0x6a'));rpcDb[_0xd5ff('0x68')](_0x9358c8,_0xd5ff('0x6b'));rpcDb[_0xd5ff('0x6c')](_0x9358c8,'[HistoryRecallClose]');}}}}})[_0xd5ff('0x4f')](ut[_0xd5ff('0x5f')](_0xd5ff('0x6d')));};Preview['prototype'][_0xd5ff('0x41')]=function(_0x3aea60){_0x3aea60[_0xd5ff('0x2e')]=!![];if(ut['IsNotLoggedIn'](_0x3aea60[_0xd5ff('0x6e')])){_0x3aea60[_0xd5ff('0x31')]=utils['CAMPAIGN_STATUS'][_0xd5ff('0x6f')];}else if(!ut[_0xd5ff('0x70')](_0x3aea60[_0xd5ff('0x40')])){_0x3aea60['message']=utils['CAMPAIGN_STATUS'][_0xd5ff('0x32')];}else if(!this[_0xd5ff('0x71')](_0x3aea60[_0xd5ff('0x72')])){if(!this[_0xd5ff('0x71')](_0x3aea60[_0xd5ff('0x73')])){_0x3aea60[_0xd5ff('0x31')]=utils[_0xd5ff('0x37')][_0xd5ff('0x74')];}else{_0x3aea60[_0xd5ff('0x31')]=utils[_0xd5ff('0x37')][_0xd5ff('0x75')];}}else{_0x3aea60['message']=utils[_0xd5ff('0x37')][_0xd5ff('0x75')];}};Preview[_0xd5ff('0xf')][_0xd5ff('0x76')]=function(_0x1578e9,_0x316184,_0x2c5b63){var _0xec628f=this;var _0x5a6765=this[_0xd5ff('0x17')][_0x316184];var _0x3b5388=this[_0xd5ff('0x14')][_0x5a6765['queue']];var _0x418525;var _0x1ff21b=![];var _0x24c60a=0x2;var _0x4f7e4b=0x3;if(_0x3b5388){switch(_0x2c5b63){case'1':_0x3b5388['outboundNoSuchCallsDay']+=0x1;_0x5a6765[_0xd5ff('0x77')]+=0x1;_0x5a6765[_0xd5ff('0x78')]=ut[_0xd5ff('0x79')](_0x5a6765);ut[_0xd5ff('0x63')](_0x5a6765,0x0,_0xd5ff('0x7a'));ami[_0xd5ff('0x2b')](_0xd5ff('0x7b'),ut['buildObj'](_0x5a6765,_0xd5ff('0x7c')));rpcDb[_0xd5ff('0x68')](_0x5a6765,_0xd5ff('0x7d'));_0xec628f[_0xd5ff('0x7e')](_0x5a6765,'0',_0x3b5388)[_0xd5ff('0x5a')](function(_0x348c9){_0x1ff21b=_0x348c9[_0xd5ff('0x7f')]==0x1;_0x24c60a=_0x3b5388[_0xd5ff('0x80')];_0x4f7e4b=_0x3b5388[_0xd5ff('0x81')];if(!_0x1ff21b){if(ut['totalGlobal'](_0x5a6765)>=_0x3b5388[_0xd5ff('0x82')]){_0x418525=ut['cloneAction'](_0x5a6765,0xf,_0xd5ff('0x83'));rpcDb['createCustomerFinal'](_0x418525,_0xd5ff('0x84'));}else{if(_0x5a6765['countnosuchnumberretry']>=_0x3b5388[_0xd5ff('0x85')]){rpcDb[_0xd5ff('0x6c')](_0x5a6765,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb['rescheduleContact'](ut[_0xd5ff('0x86')](_0x5a6765,_0xd5ff('0x77'),_0x3b5388[_0xd5ff('0x80')]),_0x5a6765[_0xd5ff('0x87')],_0x5a6765[_0xd5ff('0x88')]);}}delete this[_0xd5ff('0x17')][_0x1578e9[_0xd5ff('0x89')]];}else{_0x5a6765[_0xd5ff('0x77')]++;logger[_0xd5ff('0x25')](_0xd5ff('0x8a'),_0x5a6765[_0xd5ff('0x77')]);logger[_0xd5ff('0x25')]('id',_0x5a6765['idContact']);_0xec628f[_0xd5ff('0x8b')]({'id':_0x5a6765[_0xd5ff('0x8c')],'field':{'countnosuchnumberretry':_0x5a6765['countnosuchnumberretry']}})[_0xd5ff('0x5a')](function(){_0xec628f[_0xd5ff('0x8d')](_0x5a6765,_0x24c60a,_0x4f7e4b)['then'](function(){});});}});break;case _0xd5ff('0x8e'):var _0x4ef298=moment()[_0xd5ff('0x28')](_0xd5ff('0x62'));_0x5a6765[_0xd5ff('0x8f')]=_0x4ef298;_0x5a6765[_0xd5ff('0x90')]=_0x4ef298;_0x5a6765[_0xd5ff('0x49')]=!![];_0x3b5388['pTalking']+=0x1;logger[_0xd5ff('0x25')](_0xd5ff('0x91'),_0x5a6765[_0xd5ff('0x92')],'\x20Queue',_0x3b5388[_0xd5ff('0x35')],'pTalking:\x20',_0x3b5388[_0xd5ff('0x93')]);ami[_0xd5ff('0x2b')](_0xd5ff('0x94'),ut[_0xd5ff('0x95')](_0x5a6765,'connect',this[_0xd5ff('0x14')][_0x5a6765[_0xd5ff('0x46')]]));if(_0x3b5388[_0xd5ff('0x96')]||_0x3b5388[_0xd5ff('0x97')]){ami[_0xd5ff('0x2b')](_0xd5ff('0x98'),{'queue':_0x5a6765[_0xd5ff('0x46')],'interface':_0x5a6765[_0xd5ff('0x99')],'uniqueid':_0x5a6765[_0xd5ff('0x92')]});}break;case'16':ami[_0xd5ff('0x2b')](_0xd5ff('0x9a'),ut[_0xd5ff('0x95')](_0x5a6765,_0xd5ff('0x9b'),this[_0xd5ff('0x14')][_0x5a6765[_0xd5ff('0x46')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x5a6765,_0xd5ff('0x9b')));_0x3b5388[_0xd5ff('0x9c')]+=0x1;_0x3b5388[_0xd5ff('0x9d')]+=0x1;_0x3b5388[_0xd5ff('0x9e')]+=0x1;ut['decrementTalking'](_0x3b5388,_0xd5ff('0x9f'));_0x5a6765[_0xd5ff('0x78')]=ut[_0xd5ff('0x79')](_0x5a6765);ut[_0xd5ff('0x63')](_0x5a6765,0x4,_0xd5ff('0xa0'));rpcDb[_0xd5ff('0x68')](_0x5a6765,_0xd5ff('0xa1'));rpcDb[_0xd5ff('0x6c')](_0x5a6765,_0xd5ff('0xa2'));rpcDb['crateCustomerReportQueue'](_0x5a6765);_0x3b5388[_0xd5ff('0xa3')]+=_0x5a6765['talktime'];_0x3b5388[_0xd5ff('0xa4')]+=_0x5a6765[_0xd5ff('0xa5')];logger[_0xd5ff('0x25')](_0xd5ff('0xa6'),_0x5a6765[_0xd5ff('0x92')],_0xd5ff('0xa7'),_0x3b5388[_0xd5ff('0x35')],_0xd5ff('0x48'),_0x3b5388[_0xd5ff('0x93')]);delete this[_0xd5ff('0x17')][_0x1578e9[_0xd5ff('0x89')]];break;case'BUSY':_0x3b5388['outboundBusyCallsDay']+=0x1;_0x5a6765[_0xd5ff('0xa8')]+=0x1;_0x5a6765[_0xd5ff('0x78')]=ut[_0xd5ff('0x79')](_0x5a6765);ut[_0xd5ff('0x63')](_0x5a6765,0x5,_0xd5ff('0xa9'));_0x24c60a=_0x3b5388[_0xd5ff('0xaa')];_0x4f7e4b=_0x3b5388[_0xd5ff('0x81')];ami[_0xd5ff('0x2b')](_0xd5ff('0xab'),ut['buildObj'](_0x5a6765,'busy'));rpcDb[_0xd5ff('0x68')](_0x5a6765,_0xd5ff('0xac'));_0xec628f[_0xd5ff('0x7e')](_0x5a6765,'5',_0x3b5388)[_0xd5ff('0x5a')](function(_0x3b264c){_0x1ff21b=_0x3b264c[_0xd5ff('0x7f')]==0x1;if(!_0x1ff21b){if(ut[_0xd5ff('0x79')](_0x5a6765)>=_0x3b5388['dialGlobalMaxRetry']){_0x418525=ut['cloneAction'](_0x5a6765,0xf,_0xd5ff('0x83'));rpcDb[_0xd5ff('0x6c')](_0x418525,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x5a6765[_0xd5ff('0xa8')]>=_0x3b5388['dialBusyMaxRetry']){rpcDb['createCustomerFinal'](_0x5a6765,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0xd5ff('0xad')](ut['scheduledAt'](_0x5a6765,_0xd5ff('0xa8'),_0x3b5388['dialBusyRetryFrequency']),_0x5a6765[_0xd5ff('0x87')],_0x5a6765['activeContact']);}}}else{_0x5a6765['countbusyretry']++;_0xec628f[_0xd5ff('0x8b')]({'id':_0x5a6765[_0xd5ff('0x8c')],'field':{'countbusyretry':_0x5a6765[_0xd5ff('0xa8')]}})[_0xd5ff('0x5a')](function(){_0xec628f[_0xd5ff('0x8d')](_0x5a6765,_0x24c60a,_0x4f7e4b)[_0xd5ff('0x5a')](function(){});});}});break;case'NOANSWER':_0x3b5388[_0xd5ff('0xae')]+=0x1;_0x5a6765[_0xd5ff('0xaf')]+=0x1;_0x5a6765[_0xd5ff('0x78')]=ut[_0xd5ff('0x79')](_0x5a6765);ut[_0xd5ff('0x63')](_0x5a6765,0x3,_0xd5ff('0xb0'));_0x24c60a=_0x3b5388[_0xd5ff('0xb1')];_0x4f7e4b=_0x3b5388[_0xd5ff('0x81')];var _0x1b46d0=ut[_0xd5ff('0xb2')](_0x5a6765,_0x3b5388);ami[_0xd5ff('0x2b')]('custom:agentnoanswer',_0x1b46d0);rpcDb['createCustomerHistory'](_0x5a6765,_0xd5ff('0xb3'));_0xec628f[_0xd5ff('0x7e')](_0x5a6765,'3',_0x3b5388)[_0xd5ff('0x5a')](function(_0x93b75e){_0x1ff21b=_0x93b75e[_0xd5ff('0x7f')]==0x1;if(!_0x1ff21b){if(ut[_0xd5ff('0x79')](_0x5a6765)>=_0x3b5388[_0xd5ff('0x82')]){_0x418525=ut[_0xd5ff('0xb4')](_0x5a6765,0xf,'Global');rpcDb[_0xd5ff('0x6c')](_0x418525,_0xd5ff('0xb5'));}else{if(_0x5a6765[_0xd5ff('0xaf')]>=_0x3b5388[_0xd5ff('0xb6')]){rpcDb[_0xd5ff('0x6c')](_0x5a6765,_0xd5ff('0xb3'));}else{rpcDb[_0xd5ff('0xad')](ut[_0xd5ff('0x86')](_0x5a6765,_0xd5ff('0xaf'),_0x3b5388['dialNoAnswerRetryFrequency']),_0x5a6765['unlockAgent'],_0x5a6765[_0xd5ff('0x88')]);}}}else{_0x5a6765[_0xd5ff('0xaf')]++;_0xec628f[_0xd5ff('0x8b')]({'id':_0x5a6765['idContact'],'field':{'countnoanswerretry':_0x5a6765[_0xd5ff('0xaf')]}})[_0xd5ff('0x5a')](function(){_0xec628f[_0xd5ff('0x8d')](_0x5a6765,_0x24c60a,_0x4f7e4b)[_0xd5ff('0x5a')](function(){});});}});break;case _0xd5ff('0xb7'):_0x3b5388[_0xd5ff('0xb8')]+=0x1;_0x5a6765[_0xd5ff('0xb9')]+=0x1;_0x5a6765['countglobal']=ut[_0xd5ff('0x79')](_0x5a6765);ut[_0xd5ff('0x63')](_0x5a6765,0x8,_0xd5ff('0xba'));_0x24c60a=_0x3b5388[_0xd5ff('0xbb')];_0x4f7e4b=_0x3b5388['callAdditionalPhoneAfterMin'];ami[_0xd5ff('0x2b')](_0xd5ff('0xbc'),ut[_0xd5ff('0x95')](_0x5a6765,'congestion'));rpcDb[_0xd5ff('0x68')](_0x5a6765,_0xd5ff('0xbd'));_0xec628f[_0xd5ff('0x7e')](_0x5a6765,'8',_0x3b5388)[_0xd5ff('0x5a')](function(_0x56bffa){_0x1ff21b=_0x56bffa['additional']==0x1;if(!_0x1ff21b){if(ut['totalGlobal'](_0x5a6765)>=_0x3b5388[_0xd5ff('0x82')]){_0x418525=ut['cloneAction'](_0x5a6765,0xf,_0xd5ff('0x83'));rpcDb[_0xd5ff('0x6c')](_0x418525,_0xd5ff('0xbe'));}else{if(_0x5a6765['countcongestionretry']>=_0x3b5388[_0xd5ff('0xbf')]){rpcDb['createCustomerFinal'](_0x5a6765,_0xd5ff('0xbd'));}else{rpcDb[_0xd5ff('0xad')](ut[_0xd5ff('0x86')](_0x5a6765,_0xd5ff('0xb9'),_0x3b5388['dialBusyRetryFrequency']),_0x5a6765[_0xd5ff('0x87')],_0x5a6765['activeContact']);}}}else{_0x5a6765[_0xd5ff('0xb9')]++;_0xec628f[_0xd5ff('0x8b')]({'id':_0x5a6765[_0xd5ff('0x8c')],'field':{'countcongestionretry':_0x5a6765[_0xd5ff('0xb9')]}})['then'](function(){_0xec628f[_0xd5ff('0x8d')](_0x5a6765,_0x24c60a,_0x4f7e4b)['then'](function(){});});}});break;case'CANCEL':_0x3b5388['outboundRejectCallsDay']+=0x1;_0x5a6765[_0xd5ff('0xc0')]+=0x1;_0x5a6765['countglobal']=ut[_0xd5ff('0x79')](_0x5a6765);ut[_0xd5ff('0x63')](_0x5a6765,0x14,_0xd5ff('0xc1'));_0x24c60a=_0x3b5388[_0xd5ff('0xc2')];_0x4f7e4b=_0x3b5388[_0xd5ff('0x81')];ami[_0xd5ff('0x2b')](_0xd5ff('0xc3'),ut[_0xd5ff('0x95')](_0x5a6765,_0xd5ff('0xc4')));rpcDb[_0xd5ff('0x68')](_0x5a6765,_0xd5ff('0xc5'));_0xec628f[_0xd5ff('0x7e')](_0x5a6765,'20',_0x3b5388)['then'](function(_0x2493bf){_0x1ff21b=_0x2493bf[_0xd5ff('0x7f')]==0x1;if(!_0x1ff21b){if(ut[_0xd5ff('0x79')](_0x5a6765)>=_0x3b5388['dialGlobalMaxRetry']){_0x418525=ut[_0xd5ff('0xb4')](_0x5a6765,0x14,_0xd5ff('0xc1'));rpcDb[_0xd5ff('0x6c')](_0x418525,_0xd5ff('0xc6'));}else{if(_0x5a6765[_0xd5ff('0xc0')]>=_0x3b5388[_0xd5ff('0xc7')]){rpcDb['createCustomerFinal'](_0x5a6765,_0xd5ff('0xc6'));}else{rpcDb['rescheduleContact'](ut[_0xd5ff('0x86')](_0x5a6765,_0xd5ff('0xc0'),_0x3b5388[_0xd5ff('0xc2')]),_0x5a6765['unlockAgent'],_0x5a6765[_0xd5ff('0x88')]);}}}else{_0x5a6765[_0xd5ff('0xaf')]++;_0xec628f['incrementPreviewCounters']({'id':_0x5a6765[_0xd5ff('0x8c')],'field':{'countnoanswerretry':_0x5a6765[_0xd5ff('0xaf')]}})[_0xd5ff('0x5a')](function(){_0xec628f[_0xd5ff('0x8d')](_0x5a6765,_0x24c60a,_0x4f7e4b)['then'](function(){});});}});break;case _0xd5ff('0xc8'):_0x3b5388[_0xd5ff('0xc9')]+=0x1;_0x5a6765[_0xd5ff('0xca')]+=0x1;_0x5a6765[_0xd5ff('0x78')]=ut['totalGlobal'](_0x5a6765);ut['logCustomer'](_0x5a6765,0xb,_0xd5ff('0xcb'));rpcDb[_0xd5ff('0x68')](_0x5a6765,_0xd5ff('0xcc'));_0xec628f[_0xd5ff('0x7e')](_0x5a6765,'11',_0x3b5388)[_0xd5ff('0x5a')](function(_0xd887b2){_0x1ff21b=_0xd887b2[_0xd5ff('0x7f')]==0x1;if(!_0x1ff21b){if(ut[_0xd5ff('0x79')](_0x5a6765)>=_0x3b5388['dialGlobalMaxRetry']){_0x418525=ut[_0xd5ff('0xb4')](_0x5a6765,0xf,'Global');rpcDb[_0xd5ff('0x6c')](_0x418525,_0xd5ff('0xcc'));}else{if(_0x5a6765[_0xd5ff('0xcd')]>=_0x3b5388['dialAbandonedMaxRety']){rpcDb[_0xd5ff('0x6c')](_0x5a6765,_0xd5ff('0xcc'));}else{rpcDb[_0xd5ff('0xad')](ut[_0xd5ff('0x86')](_0x5a6765,'countabandonedretry',_0x3b5388[_0xd5ff('0xce')]),_0x5a6765[_0xd5ff('0x87')],_0x5a6765[_0xd5ff('0x88')]);}}}else{_0x5a6765[_0xd5ff('0xaf')]++;_0xec628f[_0xd5ff('0x8b')]({'id':_0x5a6765['idContact'],'field':{'countnoanswerretry':_0x5a6765[_0xd5ff('0xaf')]}})['then'](function(){_0xec628f['swapAdditionalPhones'](_0x5a6765,_0x24c60a,_0x4f7e4b)[_0xd5ff('0x5a')](function(){});});}});break;case'18':_0x3b5388[_0xd5ff('0xcf')]+=0x1;_0x5a6765[_0xd5ff('0xd0')]+=0x1;_0x5a6765['countglobal']=ut[_0xd5ff('0x79')](_0x5a6765);ut['logCustomer'](_0x5a6765,0x12,_0x1578e9[_0xd5ff('0xd1')]||_0x1578e9[_0xd5ff('0xd2')]);ami['emit'](_0xd5ff('0xd3'),ut[_0xd5ff('0x95')](_0x5a6765,_0xd5ff('0xd4')));rpcDb['createCustomerHistory'](_0x5a6765,_0xd5ff('0xd5'));_0xec628f[_0xd5ff('0x7e')](_0x5a6765,'18',_0x3b5388)['then'](function(_0xf5b969){_0x1ff21b=_0xf5b969[_0xd5ff('0x7f')]==0x1;if(!_0x1ff21b){if(ut[_0xd5ff('0x79')](_0x5a6765)>=_0x3b5388[_0xd5ff('0x82')]){_0x418525=ut['cloneAction'](_0x5a6765,0x12,_0xd5ff('0x83'));rpcDb['createCustomerFinal'](_0x418525,_0xd5ff('0xd5'));}else{rpcDb[_0xd5ff('0x6c')](_0x5a6765,'[callProgressDetectingCustomer][hangupInAMD]');}}else{_0x5a6765['countnoanswerretry']++;_0xec628f['incrementPreviewCounters']({'id':_0x5a6765[_0xd5ff('0x8c')],'field':{'countnoanswerretry':_0x5a6765[_0xd5ff('0xaf')]}})[_0xd5ff('0x5a')](function(){_0xec628f[_0xd5ff('0x8d')](_0x5a6765,_0x24c60a,_0x4f7e4b)[_0xd5ff('0x5a')](function(){});});}});delete this[_0xd5ff('0x17')][_0x1578e9[_0xd5ff('0x89')]];break;case'19':_0x3b5388[_0xd5ff('0xcf')]+=0x1;_0x5a6765[_0xd5ff('0x78')]=ut[_0xd5ff('0x79')](_0x5a6765);ut['logCustomer'](_0x5a6765,0x13,_0x1578e9[_0xd5ff('0xd1')]||_0x1578e9['dialstatus']);ami[_0xd5ff('0x2b')](_0xd5ff('0xd3'),ut[_0xd5ff('0x95')](_0x5a6765,_0xd5ff('0xd4')));rpcDb[_0xd5ff('0x68')](_0x5a6765,_0xd5ff('0xd6'));_0xec628f[_0xd5ff('0x7e')](_0x5a6765,'18',_0x3b5388)[_0xd5ff('0x5a')](function(_0x1b1003){_0x1ff21b=_0x1b1003['additional']==0x1;if(!_0x1ff21b){if(ut[_0xd5ff('0x79')](_0x5a6765)>=_0x3b5388['dialGlobalMaxRetry']){_0x418525=ut[_0xd5ff('0xb4')](_0x5a6765,0xf,_0xd5ff('0x83'));rpcDb[_0xd5ff('0x6c')](_0x418525,_0xd5ff('0xd6'));}else{rpcDb[_0xd5ff('0x6c')](_0x5a6765,_0xd5ff('0xd6'));}}else{_0x5a6765['countnoanswerretry']++;_0xec628f[_0xd5ff('0x8b')]({'id':_0x5a6765[_0xd5ff('0x8c')],'field':{'countnoanswerretry':_0x5a6765[_0xd5ff('0xaf')]}})[_0xd5ff('0x5a')](function(){_0xec628f[_0xd5ff('0x8d')](_0x5a6765,_0x24c60a,_0x4f7e4b)[_0xd5ff('0x5a')](function(){});});}});delete this[_0xd5ff('0x17')][_0x1578e9[_0xd5ff('0x89')]];break;default:if(_0x5a6765[_0xd5ff('0x49')]){ut[_0xd5ff('0x53')](_0x3b5388,_0xd5ff('0xd7'));ut[_0xd5ff('0x54')](_0xd5ff('0xd8')+_0x3b5388['name'],_0x1578e9);}_0x3b5388['outboundUnknownCallsDay']+=0x1;_0x5a6765[_0xd5ff('0x78')]=ut[_0xd5ff('0x79')](_0x5a6765);ut[_0xd5ff('0x63')](_0x5a6765,0xc,_0x1578e9[_0xd5ff('0xd1')]||_0x1578e9[_0xd5ff('0xd2')]);_0x24c60a=_0x3b5388[_0xd5ff('0xc2')];_0x4f7e4b=_0x3b5388[_0xd5ff('0x81')];rpcDb['createCustomerHistory'](_0x5a6765,_0xd5ff('0xd9'));_0xec628f[_0xd5ff('0x7e')](_0x5a6765,'20',_0x3b5388)[_0xd5ff('0x5a')](function(_0x1de2a3){_0x1ff21b=_0x1de2a3['additional']==0x1;if(!_0x1ff21b){if(ut['totalGlobal'](_0x5a6765)>=_0x3b5388[_0xd5ff('0x82')]){_0x418525=ut[_0xd5ff('0xb4')](_0x5a6765,0xf,_0xd5ff('0x83'));rpcDb[_0xd5ff('0x6c')](_0x418525,_0xd5ff('0xda'));}else{rpcDb['createCustomerFinal'](_0x5a6765,_0xd5ff('0xda'));}delete this[_0xd5ff('0x17')][_0x1578e9[_0xd5ff('0x89')]];}else{_0xec628f['swapAdditionalPhones'](_0x5a6765,_0x24c60a,_0x4f7e4b)['then'](function(){});}});}if(!(_0x5a6765['dialAnswer']&&_0x2c5b63==='16')){utils[_0xd5ff('0x51')](_0x3b5388,_0xd5ff('0xdb'));logger[_0xd5ff('0x25')](_0xd5ff('0xdc'),_0x5a6765[_0xd5ff('0x92')],_0xd5ff('0xa7'),_0x3b5388[_0xd5ff('0x35')],_0xd5ff('0x47'),_0x3b5388['originated']);}if(_0x2c5b63!==_0xd5ff('0x8e')){delete this[_0xd5ff('0x17')][_0x1578e9[_0xd5ff('0x89')]];delete this[_0xd5ff('0x17')][_0x1578e9[_0xd5ff('0xdd')]];}_0x3b5388[_0xd5ff('0xde')]=!![];}};Preview['prototype'][_0xd5ff('0xdf')]=function(_0x5c2068,_0x3a1a58,_0x393f53){if(_[_0xd5ff('0xe0')](_0x3a1a58)&&_0xd5ff('0xe1')!==typeof _0x3a1a58){return;}if(_['isUndefined'](_0x393f53)&&_0xd5ff('0xe1')!==typeof _0x393f53){return;}switch(_0x393f53[_0xd5ff('0xe2')]){case'0':ut['logAgent'](_0x5c2068,0x0,_0xd5ff('0x7a'));rpcDb[_0xd5ff('0xe3')](_0x5c2068,_0xd5ff('0xe4'));break;case'3':ut[_0xd5ff('0xe5')](_0x5c2068,0x3,_0xd5ff('0xb0'));rpcDb['createAgentHistory'](_0x5c2068,_0xd5ff('0xe6'));break;case'5':ut[_0xd5ff('0xe5')](_0x5c2068,0x5,_0xd5ff('0xa9'));rpcDb[_0xd5ff('0xe3')](_0x5c2068,'[callProgressDetectingAgent][logBusy]');break;case'8':ut['logAgent'](_0x5c2068,0x8,'Congestion');rpcDb[_0xd5ff('0xe3')](_0x5c2068,_0xd5ff('0xe7'));break;case'22':ut[_0xd5ff('0xe5')](_0x5c2068,0x16,_0xd5ff('0xe8'));rpcDb[_0xd5ff('0xe3')](_0x5c2068,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0xd5ff('0xe5')](_0x5c2068,0xc,_0x393f53[_0xd5ff('0xe2')]);rpcDb['createAgentHistory'](_0x5c2068,_0xd5ff('0xe7'));}utils[_0xd5ff('0x51')](_0x3a1a58,_0xd5ff('0xe9'));logger['info'](_0xd5ff('0xea'),_0x5c2068[_0xd5ff('0x92')],_0xd5ff('0xa7'),_0x3a1a58[_0xd5ff('0x35')],_0xd5ff('0x47'),_0x3a1a58['originated']);delete this[_0xd5ff('0x17')][_0x5c2068[_0xd5ff('0x92')]];};Preview['prototype'][_0xd5ff('0x7e')]=function(_0x124453,_0x2f8651,_0x429c87){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x124453,_0x2f8651,_0x429c87)[_0xd5ff('0x4f')](logger['info'](_0xd5ff('0xeb')));};Preview[_0xd5ff('0xf')][_0xd5ff('0x8d')]=function(_0xf1e9dd,_0x9f14a2,_0x27eab9){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0xf1e9dd,_0x9f14a2,_0x27eab9)['catch'](logger[_0xd5ff('0x25')]('[swapAdditionalPhone]\x20'));};Preview[_0xd5ff('0xf')][_0xd5ff('0x8b')]=function(_0x330c46){return Promise[_0xd5ff('0xec')]()[_0xd5ff('0x5a')](cmHopperAdditionalPhone['incrementPreviewCounters'](_0x330c46))[_0xd5ff('0x4f')](logger[_0xd5ff('0x25')](_0xd5ff('0xed')));};Preview[_0xd5ff('0xf')]['checkInBlack']=function(_0x4e0fe9,_0xe15796,_0x3ccaf4,_0x272845,_0x3faf5c){var _0x4e6687=this;return new Promise(function(_0x52d2dd,_0x4d360d){if(_[_0xd5ff('0x44')](_0xe15796)||_[_0xd5ff('0x44')](_0xe15796['Contact'])||_[_0xd5ff('0x44')](_0xe15796[_0xd5ff('0xee')])||_['isNil'](_0xe15796[_0xd5ff('0x4b')])){_0x4d360d(ut[_0xd5ff('0x31')](_0xd5ff('0xef'),_0x272845,_0x3faf5c));return;}var _0x5a9358=uuid['v4']();var _0x3d7f5e=_0x4e6687[_0xd5ff('0x14')][_0xe15796[_0xd5ff('0xf0')][_0xd5ff('0x35')]];var _0x54c471=_0x3ccaf4?_0x4e6687[_0xd5ff('0x18')][_0x3ccaf4]['id']:undefined;_0x4e6687[_0xd5ff('0x17')][_0x5a9358]=new Action(_0xe15796,_0x3d7f5e,_0x5a9358,_0x3ccaf4,_0x54c471);var _0x1fd81a=_0x4e6687['actions'][_0x5a9358];_0x1fd81a[_0xd5ff('0x87')]=_0x272845;_0x1fd81a[_0xd5ff('0x88')]=_0x3faf5c;_0x1fd81a['lookAgent']=_0x3ccaf4;if(_['isEmpty'](_0x4e0fe9)){_0x4e6687['execCall'](_0x1fd81a,_0x3d7f5e,_0xe15796,_0x3ccaf4)[_0xd5ff('0x5a')](function(_0x1d2919){logger['info']('[Preview][execCall][success]',_0xd5ff('0xf1')+_0x1fd81a[_0xd5ff('0x46')]+_0xd5ff('0xf2')+_0x1fd81a['idContact'],JSON[_0xd5ff('0x27')](_0x1d2919));ami[_0xd5ff('0x2b')](_0xd5ff('0xf3'),ut[_0xd5ff('0x95')](_0x1fd81a,_0xd5ff('0xf4'),_0x4e6687[_0xd5ff('0x14')][_0x1fd81a[_0xd5ff('0x46')]]));_0x52d2dd(ut[_0xd5ff('0x31')](_0xd5ff('0xf5')));})[_0xd5ff('0x4f')](function(_0xe9a0fe){ut[_0xd5ff('0x33')](_0xd5ff('0xf6'),_0xe9a0fe);_0x4d360d(ut[_0xd5ff('0x31')](_0xd5ff('0xf7'),_0x272845,_0x3faf5c));});}else{_0x3d7f5e[_0xd5ff('0xf8')]+=0x1;ut['logBlacklist'](_0x1fd81a);rpcDb[_0xd5ff('0xf9')](_0x1fd81a,_0xd5ff('0xfa'));delete _0x4e6687[_0xd5ff('0x17')][_0x5a9358];_0x4d360d(ut['message'](_0xd5ff('0xfb'),_0x272845,_0x3faf5c));}});};Preview[_0xd5ff('0xf')][_0xd5ff('0x71')]=function(_0x43fd75){return!_[_0xd5ff('0x44')](_0x43fd75)&&!_[_0xd5ff('0x44')](_0x43fd75[_0xd5ff('0x35')])&&!_[_0xd5ff('0x44')](_0x43fd75[_0xd5ff('0xfc')])&&_0x43fd75[_0xd5ff('0xfc')]&&!_[_0xd5ff('0x44')](this[_0xd5ff('0x16')][util[_0xd5ff('0x28')](_0xd5ff('0xfd'),_0x43fd75[_0xd5ff('0x35')])])&&!_[_0xd5ff('0x44')](this[_0xd5ff('0x16')][util[_0xd5ff('0x28')](_0xd5ff('0xfd'),_0x43fd75[_0xd5ff('0x35')])][_0xd5ff('0x4d')])&&(this['trunks'][util[_0xd5ff('0x28')](_0xd5ff('0xfd'),_0x43fd75[_0xd5ff('0x35')])]['status']===_0xd5ff('0xfe')||this['trunks'][util['format'](_0xd5ff('0xfd'),_0x43fd75[_0xd5ff('0x35')])][_0xd5ff('0x4d')]===_0xd5ff('0xff'));};Preview[_0xd5ff('0xf')]['run']=function(_0x528818,_0x1df2fe){return this[_0xd5ff('0x100')](_0x528818,_0x1df2fe)[_0xd5ff('0x5a')](function(_0x4302da){return _['pick'](_0x4302da,[_0xd5ff('0x31')]);})[_0xd5ff('0x4f')](function(_0x3e2818){if(_0x3e2818[_0xd5ff('0x101')]){rpcDb[_0xd5ff('0x102')](_0x528818);}if(_0x3e2818[_0xd5ff('0xfc')]){rpcDb[_0xd5ff('0x61')](_0x528818);}throw _[_0xd5ff('0x103')](_0x3e2818,[_0xd5ff('0x31')]);});};Preview['prototype'][_0xd5ff('0x100')]=function(_0x48a8d3,_0x294d3c){var _0x3d9b48=this;var _0x538f92,_0x4e3c47;return rpcDb[_0xd5ff('0x104')](_0x48a8d3)[_0xd5ff('0x5a')](function(_0x5c3186){if(!_[_0xd5ff('0x44')](_0x5c3186[0x0])){_0x4e3c47=_0x5c3186[0x0][_0xd5ff('0x105')]?![]:!![];_0x538f92=_0x5c3186[0x0][_0xd5ff('0x105')]?!![]:![];_0x538f92=_0x294d3c?!![]:_0x538f92;}var _0x2d5c7b=_0x3d9b48[_0xd5ff('0x106')](_0x5c3186);if(_0x2d5c7b[_0xd5ff('0x107')]){rpcDb[_0xd5ff('0x108')](_[_0xd5ff('0x103')](_0x5c3186[0x0],[_0xd5ff('0x4b'),_0xd5ff('0xee')]))[_0xd5ff('0x5a')](function(_0x59e340){_0x3d9b48[_0xd5ff('0x109')](_0x59e340,_0x5c3186[0x0],_0x294d3c,_0x4e3c47,_0x538f92)[_0xd5ff('0x5a')](function(_0x138195){return _0x138195;})[_0xd5ff('0x4f')](function(_0x6f69b1){throw _0x6f69b1;});})['catch'](function(_0x4fe4cd){ut[_0xd5ff('0x33')](_0xd5ff('0x10a'),_0x4fe4cd);throw ut['message']('Call\x20unsuccessful',_0x4e3c47,_0x538f92);});}else{throw ut[_0xd5ff('0x31')](_0x2d5c7b[_0xd5ff('0x31')],_0x4e3c47,_0x538f92);}})[_0xd5ff('0x4f')](function(_0x2ce231){ut[_0xd5ff('0x33')](_0xd5ff('0x10b'),_0x2ce231);throw ut['message'](_0xd5ff('0x10c'),![],!![]);});};Preview[_0xd5ff('0xf')][_0xd5ff('0x106')]=function(_0xec9cfb){if(_[_0xd5ff('0x44')](_0xec9cfb)||_[_0xd5ff('0x10d')](_0xec9cfb)||!_[_0xd5ff('0x44')](_0xec9cfb[0x0][_0xd5ff('0x5d')])&&_[_0xd5ff('0x44')](_0xec9cfb[0x0][_0xd5ff('0x5d')]['name'])){ut['logger']('[Preview][validateContact][Empty\x20Contact]',_0xec9cfb);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x21634c=this['campaignsPreview'][_0xec9cfb[0x0]['Queue']['name']];_0x21634c[_0xd5ff('0x31')]=utils[_0xd5ff('0x37')][_0xd5ff('0x75')];if(_[_0xd5ff('0x44')](_0x21634c)){ut[_0xd5ff('0x33')](_0xd5ff('0x10e'),_0x21634c);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this['isTrunkReachable'](_0x21634c['Trunk'])){ut[_0xd5ff('0x33')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0xd5ff('0x10f')+_0x21634c[_0xd5ff('0x35')]+_0xd5ff('0x110'));if(!this[_0xd5ff('0x71')](_0x21634c[_0xd5ff('0x73')])){ut['logger'](_0xd5ff('0x111'),_0x21634c[_0xd5ff('0x35')]+_0xd5ff('0x112'));return{'isValid':![],'message':_0xd5ff('0x113')};}}if(!ut[_0xd5ff('0x70')](_0x21634c[_0xd5ff('0x40')])){ut[_0xd5ff('0x33')](_0xd5ff('0x114'),_0x21634c[_0xd5ff('0x35')]+_0xd5ff('0x115'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x21634c[_0xd5ff('0x35')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0xd5ff('0x116')};};Preview[_0xd5ff('0xf')][_0xd5ff('0x117')]=function(_0x46da1d,_0x12c42d,_0x42d07d,_0x566a45){var _0x40eb14=this;return new Promise(function(_0xf77f33,_0x469b01){var _0x374482=_0x46da1d[_0xd5ff('0x92')];var _0x3efae7=_0x40eb14['isTrunkReachable'](_0x12c42d[_0xd5ff('0x72')])?util['format'](_0xd5ff('0x118'),_0x12c42d[_0xd5ff('0x72')][_0xd5ff('0x35')],_[_0xd5ff('0x44')](_0x12c42d[_0xd5ff('0x119')])?'':_0x12c42d['dialPrefix'][_0xd5ff('0x11a')]()||'',_0x12c42d[_0xd5ff('0x11b')]>0x0?_0x42d07d[_0xd5ff('0xee')]['substring'](_0x12c42d[_0xd5ff('0x11b')]):_0x42d07d['phone']):util[_0xd5ff('0x28')](_0xd5ff('0x118'),_['isNil'](_0x12c42d[_0xd5ff('0x73')])?_0x12c42d[_0xd5ff('0x72')][_0xd5ff('0x35')]:_0x12c42d[_0xd5ff('0x73')]['name'],_[_0xd5ff('0x44')](_0x12c42d['dialPrefix'])?'':_0x12c42d['dialPrefix']['trim']()||'',_0x12c42d[_0xd5ff('0x11b')]>0x0?_0x42d07d[_0xd5ff('0xee')][_0xd5ff('0x11c')](_0x12c42d[_0xd5ff('0x11b')]):_0x42d07d['phone']);var _0x1b6fd8=_0x40eb14[_0xd5ff('0x71')](_0x12c42d['Trunk'])?ut[_0xd5ff('0x11d')](_0x12c42d['Trunk'][_0xd5ff('0x11e')],_0x12c42d[_0xd5ff('0x11f')],_0x12c42d[_0xd5ff('0x120')]>0x0?ut['getCallerIdRandom'](_0x12c42d[_0xd5ff('0x121')],_0x12c42d['dialRandomLastDigitCallerIdNumber']):_0x12c42d['dialOriginateCallerIdNumber']):ut[_0xd5ff('0x11d')](_[_0xd5ff('0x44')](_0x12c42d[_0xd5ff('0x73')])?_0x12c42d[_0xd5ff('0x72')][_0xd5ff('0x11e')]:_0x12c42d['TrunkBackup'][_0xd5ff('0x11e')],_0x12c42d[_0xd5ff('0x11f')],_0x12c42d[_0xd5ff('0x120')]>0x0?ut[_0xd5ff('0x122')](_0x12c42d[_0xd5ff('0x121')],_0x12c42d[_0xd5ff('0x120')]):_0x12c42d[_0xd5ff('0x121')]);if(_0x1b6fd8){_0x46da1d['originatecalleridname']=ut[_0xd5ff('0x123')](_0x1b6fd8);_0x46da1d[_0xd5ff('0x124')]=ut[_0xd5ff('0x125')](_0x1b6fd8);}var _0x1ed76d=ut[_0xd5ff('0x126')](_0x12c42d,_0x42d07d,_0x3efae7,_0x1b6fd8,_0x374482,_0x46da1d);var _0x145c57=utils['setXMDContactVariables'](_0x42d07d[_0xd5ff('0x127')]);Object[_0xd5ff('0x128')](_0x1ed76d,_0x145c57);_[_0xd5ff('0x129')](_0x46da1d,ut[_0xd5ff('0x12a')](_0x1ed76d));_0x46da1d['starttime']=moment()[_0xd5ff('0x28')](_0xd5ff('0x62'));_0x12c42d[_0xd5ff('0x12b')]=_0x1ed76d;var _0x4762d6=ut[_0xd5ff('0x12c')](_0x46da1d,_0x12c42d,_0x1ed76d,_0x46da1d[_0xd5ff('0x88')],_0x566a45);return ami[_0xd5ff('0x12d')](_0x4762d6)['then'](function(_0x5a2602){_0x12c42d[_0xd5ff('0x2d')]+=0x1;logger[_0xd5ff('0x25')](_0xd5ff('0x12e'),_0x374482,'\x20Queue',_0x12c42d['name'],'originated:\x20',_0x12c42d['originated']);_0xf77f33(_0x5a2602);})[_0xd5ff('0x4f')](function(_0x29dcc4){ut[_0xd5ff('0xe5')](_0x46da1d,0xe,_0xd5ff('0x12f'));rpcDb[_0xd5ff('0xe3')](_0x46da1d,'[originateFailure][logOriginateFailure]');_0x469b01(_0x29dcc4);});});};Preview['prototype'][_0xd5ff('0x22')]=function(_0x1ac7ee){if(this[_0xd5ff('0x17')][_0x1ac7ee[_0xd5ff('0x89')]]){this[_0xd5ff('0x17')][_0x1ac7ee[_0xd5ff('0x89')]][_0xd5ff('0x4e')]=_0x1ac7ee[_0xd5ff('0x4e')];}};Preview[_0xd5ff('0xf')][_0xd5ff('0x130')]=function(_0x45eb2d){var _0x159b31=this;var _0x4a033f=this[_0xd5ff('0x17')][_0x45eb2d[_0xd5ff('0x131')]];if(_0x4a033f){if(_0x4a033f['lookAgent']&&this[_0xd5ff('0x18')][_0x4a033f[_0xd5ff('0x132')]]){ut[_0xd5ff('0x133')](_0x4a033f,this[_0xd5ff('0x18')][_0x4a033f['lookAgent']][_0xd5ff('0x35')],this[_0xd5ff('0x18')][_0x4a033f['lookAgent']]['id']);}var _0x18cec7=_['clone'](_0x4a033f);_0x18cec7['responsetime']=moment()[_0xd5ff('0x28')](_0xd5ff('0x62'));var _0x5d511f=_0x159b31[_0xd5ff('0x14')][_0x4a033f[_0xd5ff('0x46')]];if(ut[_0xd5ff('0x134')](_0x45eb2d[_0xd5ff('0x135')])){if(_0x4a033f[_0xd5ff('0x87')]){rpcDb[_0xd5ff('0x102')](_0x4a033f[_0xd5ff('0x8c')]);}if(_0x4a033f['activeContact']){rpcDb['disableContact'](_0x4a033f[_0xd5ff('0x8c')]);}ami[_0xd5ff('0x2b')](_0xd5ff('0x136'),ut[_0xd5ff('0x95')](_0x4a033f,_0xd5ff('0x137'),this[_0xd5ff('0x14')][_0x4a033f[_0xd5ff('0x46')]]));this[_0xd5ff('0xdf')](_0x18cec7,_0x5d511f,_0x45eb2d);}else{_0x4a033f['starttime']=moment()['format'](_0xd5ff('0x62'));ut['logAgent'](_0x18cec7,0x4,_0xd5ff('0xa0'));rpcDb['createAgentHistory'](_0x18cec7,_0xd5ff('0x138'));}}};Preview['prototype'][_0xd5ff('0x139')]=function(_0x1495f5){var _0x9bd8b2=this['actions'][_0x1495f5[_0xd5ff('0x89')]];var _0x355c1b;if(_0x9bd8b2){_0x355c1b=this[_0xd5ff('0x14')][_0x9bd8b2['queue']];logger['info'](_0xd5ff('0x13a'),_0x1495f5[_0xd5ff('0x89')],_0xd5ff('0xa7'),_0x355c1b['name'],'pTalking:\x20',_0x355c1b[_0xd5ff('0x93')]);}if(this[_0xd5ff('0x17')][_0x1495f5[_0xd5ff('0x89')]]&&_0x1495f5[_0xd5ff('0x89')]!==_0x1495f5['uniqueid']){if(_0x1495f5['cause']==='16'&&this[_0xd5ff('0x17')][_0x1495f5['linkedid']]['dialAnswer']){this[_0xd5ff('0x76')](_0x1495f5,_0x1495f5[_0xd5ff('0x89')],_0x1495f5['cause']);}else if(this['actions'][_0x1495f5[_0xd5ff('0x89')]][_0xd5ff('0x49')]){logger[_0xd5ff('0x25')](_0xd5ff('0x13b'),_0x1495f5[_0xd5ff('0x89')],_0x1495f5[_0xd5ff('0x13c')],_0xd5ff('0xa7'),_0x355c1b[_0xd5ff('0x35')],_0xd5ff('0x48'),_0x355c1b['pTalking']);this[_0xd5ff('0x76')](_0x1495f5,_0x1495f5['linkedid'],_0x1495f5[_0xd5ff('0x13c')]);}}else if(_0x9bd8b2&&_[_0xd5ff('0x44')](_0x9bd8b2['statedesc'])&&_0x355c1b[_0xd5ff('0x13d')]&&_0x1495f5[_0xd5ff('0x89')]===_0x1495f5[_0xd5ff('0x92')]&&_[_0xd5ff('0x44')](_0x1495f5[_0xd5ff('0xe2')])&&_0x1495f5[_0xd5ff('0x13c')]==='16'&&_0x1495f5[_0xd5ff('0x13e')]==='6'&&_[_0xd5ff('0xe0')](_0x9bd8b2['transfer'])){if(_0x9bd8b2[_0xd5ff('0x87')]){rpcDb['unlockContact'](_0x9bd8b2[_0xd5ff('0x8c')]);}if(_0x9bd8b2[_0xd5ff('0x88')]){rpcDb[_0xd5ff('0x61')](_0x9bd8b2[_0xd5ff('0x8c')]);}_0x1495f5['reason']='22';this[_0xd5ff('0xdf')](_0x9bd8b2,_0x355c1b,_0x1495f5);}else if(_0x9bd8b2&&_0x9bd8b2[_0xd5ff('0x13f')]){if(_0x1495f5[_0xd5ff('0x13c')]==='16'&&this[_0xd5ff('0x17')][_0x1495f5[_0xd5ff('0x89')]][_0xd5ff('0x49')]){logger[_0xd5ff('0x25')](_0xd5ff('0x140'),_0x1495f5[_0xd5ff('0x89')],_0x1495f5[_0xd5ff('0x13c')],_0xd5ff('0xa7'),_0x355c1b[_0xd5ff('0x35')],_0xd5ff('0x48'),_0x355c1b[_0xd5ff('0x93')]);this['callProgressDetectingCustomer'](_0x1495f5,_0x1495f5[_0xd5ff('0x89')],_0x1495f5[_0xd5ff('0x13c')]);}else if(this[_0xd5ff('0x17')][_0x1495f5[_0xd5ff('0x89')]][_0xd5ff('0x49')]){logger['info']('[syncHangup][talking][cause]',_0x1495f5['linkedid'],_0x1495f5['cause'],_0xd5ff('0xa7'),_0x355c1b[_0xd5ff('0x35')],_0xd5ff('0x48'),_0x355c1b[_0xd5ff('0x93')]);this['callProgressDetectingCustomer'](_0x1495f5,_0x1495f5[_0xd5ff('0x89')],_0x1495f5[_0xd5ff('0x13c')]);}}};Preview[_0xd5ff('0xf')][_0xd5ff('0x20')]=function(_0x42302e){if(this[_0xd5ff('0x17')][_0x42302e[_0xd5ff('0xdd')]]&&_0x42302e[_0xd5ff('0xdd')]!==_0x42302e[_0xd5ff('0x141')]){this[_0xd5ff('0x76')](_0x42302e,_0x42302e['destlinkedid'],_0x42302e[_0xd5ff('0xd2')]);}};Preview[_0xd5ff('0xf')][_0xd5ff('0x1e')]=function(_0x5d38c1){if(this[_0xd5ff('0x17')][_0x5d38c1[_0xd5ff('0x89')]]&&_0x5d38c1[_0xd5ff('0x89')]!==_0x5d38c1[_0xd5ff('0x92')]&&!this['actions'][_0x5d38c1[_0xd5ff('0x89')]][_0xd5ff('0x49')]){if(_0x5d38c1['cause']==='1'){this[_0xd5ff('0x76')](_0x5d38c1,_0x5d38c1[_0xd5ff('0x89')],_0x5d38c1[_0xd5ff('0x13c')]);}}};Preview['prototype']['addVariable']=function(_0x4e72d,_0x157203,_0xbdfda1){if(this[_0xd5ff('0x17')][_0x4e72d]){if(_['isNil'](this['actions'][_0x4e72d][_0xd5ff('0x12b')])){this[_0xd5ff('0x17')][_0x4e72d][_0xd5ff('0x12b')]={};}this[_0xd5ff('0x17')][_0x4e72d][_0xd5ff('0x12b')][_0x157203]=_0xbdfda1;}};Preview[_0xd5ff('0xf')][_0xd5ff('0x142')]=function(_0x8eac97){try{if(!_['isNil'](_0x8eac97)){if(ut[_0xd5ff('0x143')](_['keys'](_0x8eac97[_0xd5ff('0x144')])[0x0])){this[_0xd5ff('0x145')](_0x8eac97[_0xd5ff('0x92')],_[_0xd5ff('0x146')](_0x8eac97[_0xd5ff('0x144')])[0x0],_0x8eac97[_0xd5ff('0x147')]);}}}catch(_0x4fefe8){logger['error'](_0xd5ff('0x148'),util[_0xd5ff('0x149')](_0x4fefe8,{'showHidden':![],'depth':null}));}};Preview[_0xd5ff('0xf')][_0xd5ff('0x24')]=function(_0x4d3f0d){if(_0x4d3f0d){if(this[_0xd5ff('0x17')][_0x4d3f0d[_0xd5ff('0x14a')]]){this[_0xd5ff('0x17')][_0x4d3f0d[_0xd5ff('0x14a')]]['transfer']=!![];}}};Preview['prototype'][_0xd5ff('0x14b')]=function(_0x1faf34){if(_0x1faf34){if(this[_0xd5ff('0x17')][_0x1faf34['transfererlinkedid']]){this[_0xd5ff('0x17')][_0x1faf34[_0xd5ff('0x14c')]]['transfer']=!![];}}};module[_0xd5ff('0x14d')]=Preview; \ No newline at end of file +var _0xd4fe=['[originated][decrement][callProgressDetectingCustomer]','destlinkedid','queueSummaryCountersUpdated','callProgressDetectingAgent','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','checkInBlack','phone','Contact\x20is\x20undefined','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','reachable','unmonitored','execRun','unlock','unlockContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','Trunk\x20not\x20working\x20correctly','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','Trunk','SIP/%s/%s%s','dialCutDigit','substring','dialPrefix','trim','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','extractCalleridNumber','addVariables','setXMDContactVariables','Contact','assign','merge','toLowerVariables','starttime','variables','variablesAction','[originated][increment]','[originateFailure][logOriginateFailure]','syncNewExten','channel','actionid','lookAgent','clone','isFailure','response','custom:agentringnoanswer','rejected','Answer','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncHangupRequest','addVariable','filterKey','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','moment','ioredis','../../../config/environment','../../../config/logger','preview','../ami','../rpc/cmHopperAdditionalPhone','./action','./util/util','redis','defaults','localhost','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','syncHangup','hanguprequest','dialend','syncDialEnd','newexten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','pTalking','available','paused','message','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','DEACTIVATED','syncCampaigns','hasOwnProperty','dialMethod','booked','outbound','clearZombieChannels','type','dialActive','setMessage','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','Queue','queue','originated:\x20','originated','pTalking:\x20','dialAnswer','pick','UserId','VoiceQueueId','Action','status','catch','No\x20such\x20channel','decrementOriginate','[clearZombieChannel]','decrementTalking','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','then','getDiff','dialRecallMeTimeout','Agent','voicePause','logger2','[RecallMe]','disableContact','format','outboundReCallsDay','logCustomer','RecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','loggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','UNREACHABLE_TRUNK','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','dialGlobalMaxRetry','cloneAction','Global','dialNoSuchNumberMaxRetry','[callProgressDetectingCustomer][logNoSuchGlobal]','scheduledAt','countnosuchnumberretry','unlockAgent','activeContact','linkedid','actioncountonusuch','incrementPreviewCounters','idContact','ANSWER','YYYY-MM-DD\x20HH:mm:ss','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','connect','acw','mandatoryDisposition','custom:agentConnectPreview','channelAgent','complete','total','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','[syncHangup][talking][decrement]','BUSY','outboundBusyCallsDay','countbusyretry','Busy','callAdditionalPhoneAfterMin','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','rescheduleContact','dialBusyRetryFrequency','NOANSWER','outboundNoAnswerCallsDay','NoAnswer','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerMaxRetry','swapAdditionalPhones','CONGESTION','outboundCongestionCallsDay','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','dialCongestionMaxRetry','countcongestionretry','CANCEL','dialAgentRejectRetryFrequency','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','countagentrejectretry','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','dialAbandonedRetryFrequency','outboundUnknownCallsDay','countmachineretry','cause-txt','dialstatus','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','amd','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalking][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]'];(function(_0x40527d,_0x311e0c){var _0x3f9a90=function(_0x202713){while(--_0x202713){_0x40527d['push'](_0x40527d['shift']());}};_0x3f9a90(++_0x311e0c);}(_0xd4fe,0x1c5));var _0xed4f=function(_0x14d112,_0x26a038){_0x14d112=_0x14d112-0x0;var _0x40bc7e=_0xd4fe[_0x14d112];return _0x40bc7e;};'use strict';var util=require(_0xed4f('0x0'));var _=require(_0xed4f('0x1'));var uuid=require('uuid');var moment=require(_0xed4f('0x2'));var Redis=require(_0xed4f('0x3'));var config=require(_0xed4f('0x4'));var logger=require(_0xed4f('0x5'))(_0xed4f('0x6'));var loggerAction=require(_0xed4f('0x5'))('actionPreview');var ami=require(_0xed4f('0x7'));var rpcDb=require('./rpcDb');var cmHopperAdditionalPhone=require(_0xed4f('0x8'));var Action=require(_0xed4f('0x9'));var ut=require(_0xed4f('0xa'));var utils=require('../dialer/utils');config[_0xed4f('0xb')]=_[_0xed4f('0xc')](config[_0xed4f('0xb')],{'host':_0xed4f('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xed4f('0xb')]));var Sequence=function(){};Sequence[_0xed4f('0xe')][_0xed4f('0xf')]=function(_0x52ebb5){this[_0xed4f('0x10')]=this[_0xed4f('0x10')]?this[_0xed4f('0x10')][_0xed4f('0x11')](_0x52ebb5):_0x52ebb5();};function Preview(_0x32e5ed){this[_0xed4f('0x12')]=new Sequence();this[_0xed4f('0x13')]=_0x32e5ed[_0xed4f('0x14')];this[_0xed4f('0x15')]=_0x32e5ed[_0xed4f('0x15')];this[_0xed4f('0x16')]={};this[_0xed4f('0x17')]=_0x32e5ed[_0xed4f('0x17')];this[_0xed4f('0x18')]=0x0;ami['on'](_0xed4f('0x19'),this[_0xed4f('0x1a')][_0xed4f('0x1b')](this));ami['on']('hangup',this[_0xed4f('0x1c')][_0xed4f('0x1b')](this));ami['on'](_0xed4f('0x1d'),this['syncHangupRequest'][_0xed4f('0x1b')](this));ami['on'](_0xed4f('0x1e'),this[_0xed4f('0x1f')][_0xed4f('0x1b')](this));ami['on'](_0xed4f('0x20'),this['syncNewExten'][_0xed4f('0x1b')](this));ami['on'](_0xed4f('0x21'),this[_0xed4f('0x22')][_0xed4f('0x1b')](this));ami['on'](_0xed4f('0x23'),this[_0xed4f('0x24')][_0xed4f('0x1b')](this));ami['on'](_0xed4f('0x25'),this[_0xed4f('0x26')][_0xed4f('0x1b')](this));this[_0xed4f('0x27')](this[_0xed4f('0x13')]);}function emit(_0x289137,_0x534240,_0x11b7a9){io['to'](_0x289137)[_0xed4f('0x28')](_0x534240,_0x11b7a9);}function emitVoiceQueueChannelRemove(_0x201c80){logger[_0xed4f('0x29')](_0xed4f('0x2a'),JSON[_0xed4f('0x2b')](_0x201c80));emit(util['format'](_0xed4f('0x2c'),_0x201c80[_0xed4f('0x2d')]),_0xed4f('0x2e'),_0x201c80);io[_0xed4f('0x28')](_0xed4f('0x2f'),_0x201c80);}function notSendMessagesQueue(_0x3d054d){if(_0x3d054d[_0xed4f('0x30')]){if(_0x3d054d['originated']===0x0&&_0x3d054d[_0xed4f('0x31')]===0x0){_0x3d054d[_0xed4f('0x30')]=![];_0x3d054d[_0xed4f('0x32')]=0x0;_0x3d054d[_0xed4f('0x33')]=0x0;_0x3d054d[_0xed4f('0x34')]=utils[_0xed4f('0x35')][_0xed4f('0x36')];ut[_0xed4f('0x37')](_0xed4f('0x38'),_0x3d054d[_0xed4f('0x2d')]+'\x20is\x20not\x20active');}else{_0x3d054d['message']=utils[_0xed4f('0x35')][_0xed4f('0x39')];ut[_0xed4f('0x37')](_0xed4f('0x38'),_0x3d054d['name']+'\x20is\x20deactivated');}}}Preview[_0xed4f('0xe')][_0xed4f('0x27')]=function(){var _0x46252b=this;setInterval(function(){_0x46252b[_0xed4f('0x3a')]();},0x7cf);};Preview[_0xed4f('0xe')]['syncCampaigns']=function(){var _0x29b987=this['campaignsPreview'];this[_0xed4f('0x18')]+=0x1;for(var _0x4e72a4 in _0x29b987){if(_0x29b987[_0xed4f('0x3b')](_0x4e72a4)&&(_0x29b987[_0x4e72a4][_0xed4f('0x3c')]===_0xed4f('0x6')||_0x29b987[_0x4e72a4][_0xed4f('0x3c')]===_0xed4f('0x3d'))&&_0x29b987[_0x4e72a4]['type']===_0xed4f('0x3e')){if(this[_0xed4f('0x18')]>0x7){this[_0xed4f('0x18')]=0x0;this[_0xed4f('0x3f')]();}}if(_0x29b987[_0xed4f('0x3b')](_0x4e72a4)&&_0x29b987[_0x4e72a4][_0xed4f('0x3c')]===_0xed4f('0x6')&&_0x29b987[_0x4e72a4][_0xed4f('0x40')]===_0xed4f('0x3e')){if(_0x29b987[_0x4e72a4][_0xed4f('0x41')]){this[_0xed4f('0x42')](_0x29b987[_0x4e72a4]);if(_0x29b987[_0x4e72a4]['dialPreviewAutoRecallMe'])this[_0xed4f('0x43')](_0x29b987[_0x4e72a4]);}else{notSendMessagesQueue(_0x29b987[_0x4e72a4]);}}}};Preview['prototype'][_0xed4f('0x44')]=function(_0x4eff68){var _0x224782=this;this[_0xed4f('0x12')][_0xed4f('0xf')](function(){if(!_[_0xed4f('0x45')](_0x224782['actions'][_0x4eff68])){loggerAction[_0xed4f('0x29')](_0xed4f('0x46'),_0x4eff68,_0xed4f('0x47'),_0x224782[_0xed4f('0x16')][_0x4eff68][_0xed4f('0x48')],_0xed4f('0x49'),JSON['stringify'](_0x224782[_0xed4f('0x13')][_0x224782[_0xed4f('0x16')][_0x4eff68]['queue']][_0xed4f('0x4a')]),_0xed4f('0x4b'),JSON[_0xed4f('0x2b')](_0x224782['campaignsPreview'][_0x224782[_0xed4f('0x16')][_0x4eff68][_0xed4f('0x48')]][_0xed4f('0x31')]),JSON['stringify'](_0x224782['actions'][_0x4eff68][_0xed4f('0x4c')]),JSON[_0xed4f('0x2b')](_[_0xed4f('0x4d')](_0x224782[_0xed4f('0x16')][_0x4eff68],['contactId',_0xed4f('0x4e'),_0xed4f('0x4f'),'ListId'])));return ami[_0xed4f('0x50')]({'action':_0xed4f('0x51'),'channel':_0x224782[_0xed4f('0x16')][_0x4eff68]['channel']})[_0xed4f('0x52')](function(_0x19e7cf){if(_0x19e7cf['message']===_0xed4f('0x53')){setTimeout(function(){if(_0x224782[_0xed4f('0x16')][_0x4eff68]){utils[_0xed4f('0x54')](_0x224782[_0xed4f('0x13')][_0x224782[_0xed4f('0x16')][_0x4eff68]['queue']],_0xed4f('0x55'));if(_0x224782['actions'][_0x4eff68][_0xed4f('0x4c')]===!![]){ut[_0xed4f('0x56')](_0x224782[_0xed4f('0x13')][_0x224782[_0xed4f('0x16')][_0x4eff68][_0xed4f('0x48')]],_0xed4f('0x55'));ut[_0xed4f('0x57')](_0xed4f('0x58')+_0x4eff68,_0x224782[_0xed4f('0x16')][_0x4eff68][_0xed4f('0x48')]);}ut['loggerError'](_0xed4f('0x59')+_0x4eff68,_0x224782['actions'][_0x4eff68][_0xed4f('0x48')]);delete _0x224782[_0xed4f('0x16')][_0x4eff68];}},0x2328);}});}});};Preview[_0xed4f('0xe')][_0xed4f('0x3f')]=function(){var _0x12748a=this;loggerAction[_0xed4f('0x29')](_0xed4f('0x5a'),_[_0xed4f('0x5b')](this['actions']));for(var _0x5ef104 in this[_0xed4f('0x16')]){if(_0x12748a[_0xed4f('0x16')][_0xed4f('0x3b')](_0x5ef104)){_0x12748a[_0xed4f('0x44')](_0x5ef104);}}};Preview['prototype']['recallMe']=function(_0x1544cb){var _0x2b5874=this;rpcDb[_0xed4f('0x5c')](_0x1544cb['id'],ut['agentReadyId'](this['agents']))[_0xed4f('0x5d')](function(_0x3a1c58){if(!_[_0xed4f('0x45')](_0x3a1c58)){for(var _0x9cc2d7=0x0;_0x9cc2d7<_0x3a1c58['length'];_0x9cc2d7+=0x1){if(ut[_0xed4f('0x5e')](_0x3a1c58[_0x9cc2d7]['scheduledat'])<_0x1544cb[_0xed4f('0x5f')]*0x3c){if(_0x3a1c58[_0x9cc2d7][_0xed4f('0x60')]&&!_0x3a1c58[_0x9cc2d7][_0xed4f('0x60')][_0xed4f('0x61')]){_0x2b5874['run'](_0x3a1c58[_0x9cc2d7]['id'])[_0xed4f('0x5d')](ut[_0xed4f('0x62')]('[RecallMe]'))[_0xed4f('0x52')](ut[_0xed4f('0x62')](_0xed4f('0x63')));}else{rpcDb[_0xed4f('0x64')](_0x3a1c58[_0x9cc2d7]['id']);}}else{var _0x54296a=new Action(_0x3a1c58[_0x9cc2d7],_0x1544cb);_0x54296a['starttime']=moment()[_0xed4f('0x65')]('YYYY-MM-DD\x20HH:mm:ss');_0x1544cb[_0xed4f('0x66')]+=0x1;ut[_0xed4f('0x67')](_0x54296a,0x17,_0xed4f('0x68'));if(_0x1544cb['dialRecallInQueue']){rpcDb[_0xed4f('0x69')](ut[_0xed4f('0x6a')](_0x3a1c58[_0x9cc2d7]));rpcDb[_0xed4f('0x6b')](_0x54296a,_0xed4f('0x6c'));}else{ut[_0xed4f('0x67')](_0x54296a,0x16,_0xed4f('0x6d'));rpcDb[_0xed4f('0x6b')](_0x54296a,_0xed4f('0x6e'));rpcDb[_0xed4f('0x6f')](_0x54296a,_0xed4f('0x6e'));}}}}})['catch'](ut[_0xed4f('0x62')](_0xed4f('0x70')));};Preview[_0xed4f('0xe')][_0xed4f('0x42')]=function(_0x58ec5a){_0x58ec5a[_0xed4f('0x30')]=!![];if(ut[_0xed4f('0x71')](_0x58ec5a[_0xed4f('0x72')])){_0x58ec5a['message']=utils[_0xed4f('0x35')][_0xed4f('0x73')];}else if(!ut[_0xed4f('0x74')](_0x58ec5a[_0xed4f('0x41')])){_0x58ec5a[_0xed4f('0x34')]=utils[_0xed4f('0x35')][_0xed4f('0x36')];}else if(!this[_0xed4f('0x75')](_0x58ec5a['Trunk'])){if(!this['isTrunkReachable'](_0x58ec5a['TrunkBackup'])){_0x58ec5a[_0xed4f('0x34')]=utils[_0xed4f('0x35')][_0xed4f('0x76')];}else{_0x58ec5a[_0xed4f('0x34')]=utils[_0xed4f('0x35')]['ACTIVE'];}}else{_0x58ec5a['message']=utils['CAMPAIGN_STATUS'][_0xed4f('0x77')];}};Preview['prototype'][_0xed4f('0x78')]=function(_0x4ebf12,_0x5a5bb0,_0x4c91eb){var _0x419c70=this;var _0xb82f2d=this[_0xed4f('0x16')][_0x5a5bb0];var _0x154f98=this['campaignsPreview'][_0xb82f2d[_0xed4f('0x48')]];var _0x457065;var _0x114d9a=![];var _0x2ba3a3=0x2;var _0x89f628=0x3;if(_0x154f98){switch(_0x4c91eb){case'1':_0x154f98[_0xed4f('0x79')]+=0x1;_0xb82f2d['countnosuchnumberretry']+=0x1;_0xb82f2d[_0xed4f('0x7a')]=ut[_0xed4f('0x7b')](_0xb82f2d);ut[_0xed4f('0x67')](_0xb82f2d,0x0,_0xed4f('0x7c'));ami[_0xed4f('0x28')]('custom:agentnosuchnumber',ut[_0xed4f('0x7d')](_0xb82f2d,_0xed4f('0x7e')));rpcDb['createCustomerHistory'](_0xb82f2d,_0xed4f('0x7f'));_0x419c70[_0xed4f('0x80')](_0xb82f2d,'0',_0x154f98)[_0xed4f('0x5d')](function(_0x1c7c47){_0x114d9a=_0x1c7c47[_0xed4f('0x81')]==0x1;_0x2ba3a3=_0x154f98[_0xed4f('0x82')];_0x89f628=_0x154f98['callAdditionalPhoneAfterMin'];if(!_0x114d9a){if(ut[_0xed4f('0x7b')](_0xb82f2d)>=_0x154f98[_0xed4f('0x83')]){_0x457065=ut[_0xed4f('0x84')](_0xb82f2d,0xf,_0xed4f('0x85'));rpcDb[_0xed4f('0x6f')](_0x457065,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0xb82f2d['countnosuchnumberretry']>=_0x154f98[_0xed4f('0x86')]){rpcDb[_0xed4f('0x6f')](_0xb82f2d,_0xed4f('0x87'));}else{rpcDb['rescheduleContact'](ut[_0xed4f('0x88')](_0xb82f2d,_0xed4f('0x89'),_0x154f98[_0xed4f('0x82')]),_0xb82f2d[_0xed4f('0x8a')],_0xb82f2d[_0xed4f('0x8b')]);}}delete this['actions'][_0x4ebf12[_0xed4f('0x8c')]];}else{_0xb82f2d[_0xed4f('0x89')]++;logger['info'](_0xed4f('0x8d'),_0xb82f2d[_0xed4f('0x89')]);logger['info']('id',_0xb82f2d['idContact']);_0x419c70[_0xed4f('0x8e')]({'id':_0xb82f2d[_0xed4f('0x8f')],'field':{'countnosuchnumberretry':_0xb82f2d[_0xed4f('0x89')]}})[_0xed4f('0x5d')](function(){_0x419c70['swapAdditionalPhones'](_0xb82f2d,_0x2ba3a3,_0x89f628)[_0xed4f('0x5d')](function(){});});}});break;case _0xed4f('0x90'):var _0x817bf3=moment()[_0xed4f('0x65')](_0xed4f('0x91'));_0xb82f2d[_0xed4f('0x92')]=_0x817bf3;_0xb82f2d[_0xed4f('0x93')]=_0x817bf3;_0xb82f2d[_0xed4f('0x4c')]=!![];_0x154f98[_0xed4f('0x31')]+=0x1;logger[_0xed4f('0x29')](_0xed4f('0x94'),_0xb82f2d[_0xed4f('0x95')],_0xed4f('0x96'),_0x154f98[_0xed4f('0x2d')],_0xed4f('0x4b'),_0x154f98[_0xed4f('0x31')]);ami['emit'](_0xed4f('0x97'),ut[_0xed4f('0x7d')](_0xb82f2d,_0xed4f('0x98'),this[_0xed4f('0x13')][_0xb82f2d[_0xed4f('0x48')]]));if(_0x154f98[_0xed4f('0x99')]||_0x154f98[_0xed4f('0x9a')]){ami[_0xed4f('0x28')](_0xed4f('0x9b'),{'queue':_0xb82f2d[_0xed4f('0x48')],'interface':_0xb82f2d[_0xed4f('0x9c')],'uniqueid':_0xb82f2d['uniqueid']});}break;case'16':ami['emit']('custom:agentcomplete',ut['buildObj'](_0xb82f2d,_0xed4f('0x9d'),this[_0xed4f('0x13')][_0xb82f2d[_0xed4f('0x48')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0xb82f2d,_0xed4f('0x9d')));_0x154f98['outboundAnswerCallsDay']+=0x1;_0x154f98[_0xed4f('0x9e')]+=0x1;_0x154f98['answered']+=0x1;ut['decrementTalking'](_0x154f98,'[16]');_0xb82f2d[_0xed4f('0x7a')]=ut['totalGlobal'](_0xb82f2d);ut[_0xed4f('0x67')](_0xb82f2d,0x4,'Answer');rpcDb['createCustomerHistory'](_0xb82f2d,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0xed4f('0x6f')](_0xb82f2d,_0xed4f('0x9f'));rpcDb[_0xed4f('0xa0')](_0xb82f2d);_0x154f98[_0xed4f('0xa1')]+=_0xb82f2d[_0xed4f('0xa2')];_0x154f98['sumBillable']+=_0xb82f2d['talktime'];logger[_0xed4f('0x29')](_0xed4f('0xa3'),_0xb82f2d['uniqueid'],_0xed4f('0x96'),_0x154f98[_0xed4f('0x2d')],'pTalking:\x20',_0x154f98['pTalking']);delete this[_0xed4f('0x16')][_0x4ebf12[_0xed4f('0x8c')]];break;case _0xed4f('0xa4'):_0x154f98[_0xed4f('0xa5')]+=0x1;_0xb82f2d[_0xed4f('0xa6')]+=0x1;_0xb82f2d[_0xed4f('0x7a')]=ut[_0xed4f('0x7b')](_0xb82f2d);ut[_0xed4f('0x67')](_0xb82f2d,0x5,_0xed4f('0xa7'));_0x2ba3a3=_0x154f98['dialBusyRetryFrequency'];_0x89f628=_0x154f98[_0xed4f('0xa8')];ami[_0xed4f('0x28')](_0xed4f('0xa9'),ut['buildObj'](_0xb82f2d,_0xed4f('0xaa')));rpcDb[_0xed4f('0x6b')](_0xb82f2d,_0xed4f('0xab'));_0x419c70['verifyAdditionalPhones'](_0xb82f2d,'5',_0x154f98)['then'](function(_0x9b009a){_0x114d9a=_0x9b009a[_0xed4f('0x81')]==0x1;if(!_0x114d9a){if(ut[_0xed4f('0x7b')](_0xb82f2d)>=_0x154f98[_0xed4f('0x83')]){_0x457065=ut[_0xed4f('0x84')](_0xb82f2d,0xf,'Global');rpcDb[_0xed4f('0x6f')](_0x457065,_0xed4f('0xac'));}else{if(_0xb82f2d[_0xed4f('0xa6')]>=_0x154f98[_0xed4f('0xad')]){rpcDb[_0xed4f('0x6f')](_0xb82f2d,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0xed4f('0xae')](ut[_0xed4f('0x88')](_0xb82f2d,_0xed4f('0xa6'),_0x154f98[_0xed4f('0xaf')]),_0xb82f2d[_0xed4f('0x8a')],_0xb82f2d[_0xed4f('0x8b')]);}}}else{_0xb82f2d[_0xed4f('0xa6')]++;_0x419c70[_0xed4f('0x8e')]({'id':_0xb82f2d[_0xed4f('0x8f')],'field':{'countbusyretry':_0xb82f2d[_0xed4f('0xa6')]}})[_0xed4f('0x5d')](function(){_0x419c70['swapAdditionalPhones'](_0xb82f2d,_0x2ba3a3,_0x89f628)[_0xed4f('0x5d')](function(){});});}});break;case _0xed4f('0xb0'):_0x154f98[_0xed4f('0xb1')]+=0x1;_0xb82f2d['countnoanswerretry']+=0x1;_0xb82f2d[_0xed4f('0x7a')]=ut[_0xed4f('0x7b')](_0xb82f2d);ut[_0xed4f('0x67')](_0xb82f2d,0x3,_0xed4f('0xb2'));_0x2ba3a3=_0x154f98[_0xed4f('0xb3')];_0x89f628=_0x154f98[_0xed4f('0xa8')];var _0x1843d9=ut[_0xed4f('0xb4')](_0xb82f2d,_0x154f98);ami[_0xed4f('0x28')](_0xed4f('0xb5'),_0x1843d9);rpcDb[_0xed4f('0x6b')](_0xb82f2d,_0xed4f('0xb6'));_0x419c70[_0xed4f('0x80')](_0xb82f2d,'3',_0x154f98)[_0xed4f('0x5d')](function(_0x329501){_0x114d9a=_0x329501['additional']==0x1;if(!_0x114d9a){if(ut['totalGlobal'](_0xb82f2d)>=_0x154f98[_0xed4f('0x83')]){_0x457065=ut[_0xed4f('0x84')](_0xb82f2d,0xf,'Global');rpcDb[_0xed4f('0x6f')](_0x457065,_0xed4f('0xb7'));}else{if(_0xb82f2d[_0xed4f('0xb8')]>=_0x154f98[_0xed4f('0xb9')]){rpcDb['createCustomerFinal'](_0xb82f2d,_0xed4f('0xb6'));}else{rpcDb['rescheduleContact'](ut[_0xed4f('0x88')](_0xb82f2d,_0xed4f('0xb8'),_0x154f98[_0xed4f('0xb3')]),_0xb82f2d['unlockAgent'],_0xb82f2d[_0xed4f('0x8b')]);}}}else{_0xb82f2d[_0xed4f('0xb8')]++;_0x419c70['incrementPreviewCounters']({'id':_0xb82f2d[_0xed4f('0x8f')],'field':{'countnoanswerretry':_0xb82f2d[_0xed4f('0xb8')]}})[_0xed4f('0x5d')](function(){_0x419c70[_0xed4f('0xba')](_0xb82f2d,_0x2ba3a3,_0x89f628)[_0xed4f('0x5d')](function(){});});}});break;case _0xed4f('0xbb'):_0x154f98[_0xed4f('0xbc')]+=0x1;_0xb82f2d['countcongestionretry']+=0x1;_0xb82f2d[_0xed4f('0x7a')]=ut[_0xed4f('0x7b')](_0xb82f2d);ut[_0xed4f('0x67')](_0xb82f2d,0x8,_0xed4f('0xbd'));_0x2ba3a3=_0x154f98[_0xed4f('0xbe')];_0x89f628=_0x154f98[_0xed4f('0xa8')];ami[_0xed4f('0x28')](_0xed4f('0xbf'),ut[_0xed4f('0x7d')](_0xb82f2d,_0xed4f('0xc0')));rpcDb[_0xed4f('0x6b')](_0xb82f2d,_0xed4f('0xc1'));_0x419c70[_0xed4f('0x80')](_0xb82f2d,'8',_0x154f98)[_0xed4f('0x5d')](function(_0x54367a){_0x114d9a=_0x54367a['additional']==0x1;if(!_0x114d9a){if(ut[_0xed4f('0x7b')](_0xb82f2d)>=_0x154f98[_0xed4f('0x83')]){_0x457065=ut[_0xed4f('0x84')](_0xb82f2d,0xf,_0xed4f('0x85'));rpcDb[_0xed4f('0x6f')](_0x457065,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0xb82f2d['countcongestionretry']>=_0x154f98[_0xed4f('0xc2')]){rpcDb[_0xed4f('0x6f')](_0xb82f2d,_0xed4f('0xc1'));}else{rpcDb[_0xed4f('0xae')](ut[_0xed4f('0x88')](_0xb82f2d,_0xed4f('0xc3'),_0x154f98[_0xed4f('0xaf')]),_0xb82f2d['unlockAgent'],_0xb82f2d[_0xed4f('0x8b')]);}}}else{_0xb82f2d[_0xed4f('0xc3')]++;_0x419c70[_0xed4f('0x8e')]({'id':_0xb82f2d['idContact'],'field':{'countcongestionretry':_0xb82f2d[_0xed4f('0xc3')]}})[_0xed4f('0x5d')](function(){_0x419c70[_0xed4f('0xba')](_0xb82f2d,_0x2ba3a3,_0x89f628)[_0xed4f('0x5d')](function(){});});}});break;case _0xed4f('0xc4'):_0x154f98['outboundRejectCallsDay']+=0x1;_0xb82f2d['countagentrejectretry']+=0x1;_0xb82f2d['countglobal']=ut[_0xed4f('0x7b')](_0xb82f2d);ut['logCustomer'](_0xb82f2d,0x14,'AgentReject');_0x2ba3a3=_0x154f98[_0xed4f('0xc5')];_0x89f628=_0x154f98[_0xed4f('0xa8')];ami[_0xed4f('0x28')]('custom:agentreject',ut[_0xed4f('0x7d')](_0xb82f2d,_0xed4f('0xc6')));rpcDb[_0xed4f('0x6b')](_0xb82f2d,_0xed4f('0xc7'));_0x419c70[_0xed4f('0x80')](_0xb82f2d,'20',_0x154f98)[_0xed4f('0x5d')](function(_0x5012c9){_0x114d9a=_0x5012c9['additional']==0x1;if(!_0x114d9a){if(ut['totalGlobal'](_0xb82f2d)>=_0x154f98[_0xed4f('0x83')]){_0x457065=ut[_0xed4f('0x84')](_0xb82f2d,0x14,'AgentReject');rpcDb['createCustomerFinal'](_0x457065,_0xed4f('0xc8'));}else{if(_0xb82f2d['countagentrejectretry']>=_0x154f98[_0xed4f('0xc9')]){rpcDb[_0xed4f('0x6f')](_0xb82f2d,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0xed4f('0xae')](ut[_0xed4f('0x88')](_0xb82f2d,_0xed4f('0xca'),_0x154f98[_0xed4f('0xc5')]),_0xb82f2d['unlockAgent'],_0xb82f2d[_0xed4f('0x8b')]);}}}else{_0xb82f2d[_0xed4f('0xb8')]++;_0x419c70[_0xed4f('0x8e')]({'id':_0xb82f2d[_0xed4f('0x8f')],'field':{'countnoanswerretry':_0xb82f2d[_0xed4f('0xb8')]}})[_0xed4f('0x5d')](function(){_0x419c70['swapAdditionalPhones'](_0xb82f2d,_0x2ba3a3,_0x89f628)[_0xed4f('0x5d')](function(){});});}});break;case'ABANDONED':_0x154f98[_0xed4f('0xcb')]+=0x1;_0xb82f2d[_0xed4f('0xcc')]+=0x1;_0xb82f2d[_0xed4f('0x7a')]=ut[_0xed4f('0x7b')](_0xb82f2d);ut[_0xed4f('0x67')](_0xb82f2d,0xb,_0xed4f('0xcd'));rpcDb['createCustomerHistory'](_0xb82f2d,_0xed4f('0xce'));_0x419c70[_0xed4f('0x80')](_0xb82f2d,'11',_0x154f98)[_0xed4f('0x5d')](function(_0x120da4){_0x114d9a=_0x120da4[_0xed4f('0x81')]==0x1;if(!_0x114d9a){if(ut['totalGlobal'](_0xb82f2d)>=_0x154f98['dialGlobalMaxRetry']){_0x457065=ut[_0xed4f('0x84')](_0xb82f2d,0xf,'Global');rpcDb[_0xed4f('0x6f')](_0x457065,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0xb82f2d['countabandonedetry']>=_0x154f98[_0xed4f('0xcf')]){rpcDb[_0xed4f('0x6f')](_0xb82f2d,_0xed4f('0xce'));}else{rpcDb['rescheduleContact'](ut[_0xed4f('0x88')](_0xb82f2d,_0xed4f('0xcc'),_0x154f98[_0xed4f('0xd0')]),_0xb82f2d[_0xed4f('0x8a')],_0xb82f2d['activeContact']);}}}else{_0xb82f2d[_0xed4f('0xb8')]++;_0x419c70[_0xed4f('0x8e')]({'id':_0xb82f2d['idContact'],'field':{'countnoanswerretry':_0xb82f2d[_0xed4f('0xb8')]}})[_0xed4f('0x5d')](function(){_0x419c70['swapAdditionalPhones'](_0xb82f2d,_0x2ba3a3,_0x89f628)[_0xed4f('0x5d')](function(){});});}});break;case'18':_0x154f98[_0xed4f('0xd1')]+=0x1;_0xb82f2d[_0xed4f('0xd2')]+=0x1;_0xb82f2d['countglobal']=ut[_0xed4f('0x7b')](_0xb82f2d);ut[_0xed4f('0x67')](_0xb82f2d,0x12,_0x4ebf12[_0xed4f('0xd3')]||_0x4ebf12[_0xed4f('0xd4')]);ami[_0xed4f('0x28')](_0xed4f('0xd5'),ut[_0xed4f('0x7d')](_0xb82f2d,'amd'));rpcDb['createCustomerHistory'](_0xb82f2d,_0xed4f('0xd6'));_0x419c70[_0xed4f('0x80')](_0xb82f2d,'18',_0x154f98)[_0xed4f('0x5d')](function(_0x373527){_0x114d9a=_0x373527[_0xed4f('0x81')]==0x1;if(!_0x114d9a){if(ut[_0xed4f('0x7b')](_0xb82f2d)>=_0x154f98[_0xed4f('0x83')]){_0x457065=ut[_0xed4f('0x84')](_0xb82f2d,0x12,_0xed4f('0x85'));rpcDb[_0xed4f('0x6f')](_0x457065,_0xed4f('0xd6'));}else{rpcDb[_0xed4f('0x6f')](_0xb82f2d,_0xed4f('0xd6'));}}else{_0xb82f2d[_0xed4f('0xb8')]++;_0x419c70[_0xed4f('0x8e')]({'id':_0xb82f2d['idContact'],'field':{'countnoanswerretry':_0xb82f2d[_0xed4f('0xb8')]}})['then'](function(){_0x419c70['swapAdditionalPhones'](_0xb82f2d,_0x2ba3a3,_0x89f628)[_0xed4f('0x5d')](function(){});});}});delete this[_0xed4f('0x16')][_0x4ebf12[_0xed4f('0x8c')]];break;case'19':_0x154f98[_0xed4f('0xd1')]+=0x1;_0xb82f2d['countglobal']=ut[_0xed4f('0x7b')](_0xb82f2d);ut[_0xed4f('0x67')](_0xb82f2d,0x13,_0x4ebf12[_0xed4f('0xd3')]||_0x4ebf12[_0xed4f('0xd4')]);ami['emit'](_0xed4f('0xd5'),ut[_0xed4f('0x7d')](_0xb82f2d,_0xed4f('0xd7')));rpcDb[_0xed4f('0x6b')](_0xb82f2d,_0xed4f('0xd8'));_0x419c70[_0xed4f('0x80')](_0xb82f2d,'18',_0x154f98)['then'](function(_0x5a8ba0){_0x114d9a=_0x5a8ba0[_0xed4f('0x81')]==0x1;if(!_0x114d9a){if(ut[_0xed4f('0x7b')](_0xb82f2d)>=_0x154f98[_0xed4f('0x83')]){_0x457065=ut[_0xed4f('0x84')](_0xb82f2d,0xf,'Global');rpcDb['createCustomerFinal'](_0x457065,_0xed4f('0xd8'));}else{rpcDb[_0xed4f('0x6f')](_0xb82f2d,_0xed4f('0xd8'));}}else{_0xb82f2d[_0xed4f('0xb8')]++;_0x419c70[_0xed4f('0x8e')]({'id':_0xb82f2d[_0xed4f('0x8f')],'field':{'countnoanswerretry':_0xb82f2d['countnoanswerretry']}})[_0xed4f('0x5d')](function(){_0x419c70[_0xed4f('0xba')](_0xb82f2d,_0x2ba3a3,_0x89f628)['then'](function(){});});}});delete this[_0xed4f('0x16')][_0x4ebf12[_0xed4f('0x8c')]];break;default:if(_0xb82f2d[_0xed4f('0x4c')]){ut[_0xed4f('0x56')](_0x154f98,_0xed4f('0xd9'));ut[_0xed4f('0x57')](_0xed4f('0xda')+_0x154f98[_0xed4f('0x2d')],_0x4ebf12);}_0x154f98[_0xed4f('0xd1')]+=0x1;_0xb82f2d[_0xed4f('0x7a')]=ut[_0xed4f('0x7b')](_0xb82f2d);ut[_0xed4f('0x67')](_0xb82f2d,0xc,_0x4ebf12[_0xed4f('0xd3')]||_0x4ebf12[_0xed4f('0xd4')]);_0x2ba3a3=_0x154f98[_0xed4f('0xc5')];_0x89f628=_0x154f98[_0xed4f('0xa8')];rpcDb[_0xed4f('0x6b')](_0xb82f2d,'[callProgressDetectingCustomer][logUnknown]');_0x419c70[_0xed4f('0x80')](_0xb82f2d,'20',_0x154f98)[_0xed4f('0x5d')](function(_0x2b52b4){_0x114d9a=_0x2b52b4[_0xed4f('0x81')]==0x1;if(!_0x114d9a){if(ut['totalGlobal'](_0xb82f2d)>=_0x154f98[_0xed4f('0x83')]){_0x457065=ut[_0xed4f('0x84')](_0xb82f2d,0xf,_0xed4f('0x85'));rpcDb[_0xed4f('0x6f')](_0x457065,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0xed4f('0x6f')](_0xb82f2d,_0xed4f('0xdb'));}delete this['actions'][_0x4ebf12['linkedid']];}else{_0x419c70[_0xed4f('0xba')](_0xb82f2d,_0x2ba3a3,_0x89f628)[_0xed4f('0x5d')](function(){});}});}if(!(_0xb82f2d['dialAnswer']&&_0x4c91eb==='16')){utils[_0xed4f('0x54')](_0x154f98,_0xed4f('0xdc'));logger['info'](_0xed4f('0xdd'),_0xb82f2d[_0xed4f('0x95')],_0xed4f('0x96'),_0x154f98[_0xed4f('0x2d')],_0xed4f('0x49'),_0x154f98[_0xed4f('0x4a')]);}if(_0x4c91eb!==_0xed4f('0x90')){delete this[_0xed4f('0x16')][_0x4ebf12[_0xed4f('0x8c')]];delete this[_0xed4f('0x16')][_0x4ebf12[_0xed4f('0xde')]];}_0x154f98[_0xed4f('0xdf')]=!![];}};Preview[_0xed4f('0xe')][_0xed4f('0xe0')]=function(_0x408b8f,_0x164018,_0x4bc7d7){if(_[_0xed4f('0xe1')](_0x164018)&&_0xed4f('0xe2')!==typeof _0x164018){return;}if(_[_0xed4f('0xe1')](_0x4bc7d7)&&_0xed4f('0xe2')!==typeof _0x4bc7d7){return;}switch(_0x4bc7d7[_0xed4f('0xe3')]){case'0':ut[_0xed4f('0xe4')](_0x408b8f,0x0,_0xed4f('0x7c'));rpcDb[_0xed4f('0xe5')](_0x408b8f,_0xed4f('0xe6'));break;case'3':ut['logAgent'](_0x408b8f,0x3,_0xed4f('0xb2'));rpcDb['createAgentHistory'](_0x408b8f,_0xed4f('0xe7'));break;case'5':ut[_0xed4f('0xe4')](_0x408b8f,0x5,_0xed4f('0xa7'));rpcDb[_0xed4f('0xe5')](_0x408b8f,_0xed4f('0xe8'));break;case'8':ut[_0xed4f('0xe4')](_0x408b8f,0x8,_0xed4f('0xbd'));rpcDb[_0xed4f('0xe5')](_0x408b8f,_0xed4f('0xe9'));break;case'22':ut[_0xed4f('0xe4')](_0x408b8f,0x16,_0xed4f('0xea'));rpcDb[_0xed4f('0xe5')](_0x408b8f,_0xed4f('0xeb'));break;default:ut[_0xed4f('0xe4')](_0x408b8f,0xc,_0x4bc7d7[_0xed4f('0xe3')]);rpcDb[_0xed4f('0xe5')](_0x408b8f,_0xed4f('0xe9'));}utils[_0xed4f('0x54')](_0x164018,_0xed4f('0xec'));logger[_0xed4f('0x29')](_0xed4f('0xed'),_0x408b8f[_0xed4f('0x95')],_0xed4f('0x96'),_0x164018['name'],_0xed4f('0x49'),_0x164018[_0xed4f('0x4a')]);delete this[_0xed4f('0x16')][_0x408b8f[_0xed4f('0x95')]];};Preview[_0xed4f('0xe')][_0xed4f('0x80')]=function(_0x37fd68,_0x24f784,_0x426e70){return cmHopperAdditionalPhone[_0xed4f('0x80')](_0x37fd68,_0x24f784,_0x426e70)[_0xed4f('0x52')](logger['info'](_0xed4f('0xee')));};Preview[_0xed4f('0xe')]['swapAdditionalPhones']=function(_0x2b021f,_0x2c764c,_0x232dd3){return cmHopperAdditionalPhone[_0xed4f('0xba')](_0x2b021f,_0x2c764c,_0x232dd3)[_0xed4f('0x52')](logger[_0xed4f('0x29')](_0xed4f('0xef')));};Preview[_0xed4f('0xe')]['incrementPreviewCounters']=function(_0x232a9d){return Promise[_0xed4f('0xf0')]()[_0xed4f('0x5d')](cmHopperAdditionalPhone['incrementPreviewCounters'](_0x232a9d))[_0xed4f('0x52')](logger[_0xed4f('0x29')](_0xed4f('0xf1')));};Preview[_0xed4f('0xe')][_0xed4f('0xf2')]=function(_0x49510e,_0x2efdd0,_0x52f915,_0x351447,_0x2f886b){var _0xa63256=this;return new Promise(function(_0x34ae0f,_0x3f0b6b){if(_[_0xed4f('0x45')](_0x2efdd0)||_['isNil'](_0x2efdd0['Contact'])||_[_0xed4f('0x45')](_0x2efdd0[_0xed4f('0xf3')])||_[_0xed4f('0x45')](_0x2efdd0[_0xed4f('0x4f')])){_0x3f0b6b(ut[_0xed4f('0x34')](_0xed4f('0xf4'),_0x351447,_0x2f886b));return;}var _0x3872a5=uuid['v4']();var _0x355b17=_0xa63256[_0xed4f('0x13')][_0x2efdd0[_0xed4f('0x47')][_0xed4f('0x2d')]];var _0x2c7ece=_0x52f915?_0xa63256['agents'][_0x52f915]['id']:undefined;_0xa63256[_0xed4f('0x16')][_0x3872a5]=new Action(_0x2efdd0,_0x355b17,_0x3872a5,_0x52f915,_0x2c7ece);var _0x70be57=_0xa63256[_0xed4f('0x16')][_0x3872a5];_0x70be57['unlockAgent']=_0x351447;_0x70be57[_0xed4f('0x8b')]=_0x2f886b;_0x70be57['lookAgent']=_0x52f915;if(_[_0xed4f('0xf5')](_0x49510e)){_0xa63256[_0xed4f('0xf6')](_0x70be57,_0x355b17,_0x2efdd0,_0x52f915)['then'](function(_0x180c28){logger[_0xed4f('0x29')](_0xed4f('0xf7'),_0xed4f('0xf8')+_0x70be57['queue']+_0xed4f('0xf9')+_0x70be57[_0xed4f('0x8f')],JSON[_0xed4f('0x2b')](_0x180c28));ami['emit'](_0xed4f('0xfa'),ut['buildObj'](_0x70be57,_0xed4f('0xfb'),_0xa63256['campaignsPreview'][_0x70be57['queue']]));_0x34ae0f(ut[_0xed4f('0x34')](_0xed4f('0xfc')));})['catch'](function(_0xd24a5f){ut[_0xed4f('0x37')](_0xed4f('0xfd'),_0xd24a5f);_0x3f0b6b(ut[_0xed4f('0x34')](_0xed4f('0xfe'),_0x351447,_0x2f886b));});}else{_0x355b17['outboundBlacklistCallsDay']+=0x1;ut['logBlacklist'](_0x70be57);rpcDb[_0xed4f('0xff')](_0x70be57,_0xed4f('0x100'));delete _0xa63256[_0xed4f('0x16')][_0x3872a5];_0x3f0b6b(ut[_0xed4f('0x34')](_0xed4f('0x101'),_0x351447,_0x2f886b));}});};Preview['prototype'][_0xed4f('0x75')]=function(_0x573c7b){return!_[_0xed4f('0x45')](_0x573c7b)&&!_['isNil'](_0x573c7b[_0xed4f('0x2d')])&&!_['isNil'](_0x573c7b[_0xed4f('0x102')])&&_0x573c7b['active']&&!_[_0xed4f('0x45')](this[_0xed4f('0x15')][util[_0xed4f('0x65')](_0xed4f('0x103'),_0x573c7b[_0xed4f('0x2d')])])&&!_[_0xed4f('0x45')](this['trunks'][util[_0xed4f('0x65')]('SIP/%s',_0x573c7b[_0xed4f('0x2d')])][_0xed4f('0x51')])&&(this[_0xed4f('0x15')][util[_0xed4f('0x65')]('SIP/%s',_0x573c7b['name'])][_0xed4f('0x51')]===_0xed4f('0x104')||this[_0xed4f('0x15')][util[_0xed4f('0x65')](_0xed4f('0x103'),_0x573c7b[_0xed4f('0x2d')])][_0xed4f('0x51')]===_0xed4f('0x105'));};Preview[_0xed4f('0xe')]['run']=function(_0x32d5a1,_0x38bc28){return this[_0xed4f('0x106')](_0x32d5a1,_0x38bc28)[_0xed4f('0x5d')](function(_0x4b89e2){return _[_0xed4f('0x4d')](_0x4b89e2,['message']);})['catch'](function(_0x218b8e){if(_0x218b8e[_0xed4f('0x107')]){rpcDb[_0xed4f('0x108')](_0x32d5a1);}if(_0x218b8e[_0xed4f('0x102')]){rpcDb['disableContact'](_0x32d5a1);}throw _[_0xed4f('0x4d')](_0x218b8e,[_0xed4f('0x34')]);});};Preview[_0xed4f('0xe')][_0xed4f('0x106')]=function(_0x302a27,_0x12a48c){var _0x1653b4=this;var _0x35d34d,_0x280172;return rpcDb[_0xed4f('0x109')](_0x302a27)[_0xed4f('0x5d')](function(_0x58d169){if(!_['isNil'](_0x58d169[0x0])){_0x280172=_0x58d169[0x0]['recallme']?![]:!![];_0x35d34d=_0x58d169[0x0][_0xed4f('0x10a')]?!![]:![];_0x35d34d=_0x12a48c?!![]:_0x35d34d;}var _0x79e2d=_0x1653b4[_0xed4f('0x10b')](_0x58d169);if(_0x79e2d[_0xed4f('0x10c')]){rpcDb[_0xed4f('0x10d')](_[_0xed4f('0x4d')](_0x58d169[0x0],['VoiceQueueId',_0xed4f('0xf3')]))[_0xed4f('0x5d')](function(_0x1f8fc7){_0x1653b4[_0xed4f('0xf2')](_0x1f8fc7,_0x58d169[0x0],_0x12a48c,_0x280172,_0x35d34d)['then'](function(_0x3f077e){return _0x3f077e;})['catch'](function(_0x51047f){throw _0x51047f;});})[_0xed4f('0x52')](function(_0x895bf5){ut[_0xed4f('0x37')]('[Preview][checkIsBlackList]',_0x895bf5);throw ut[_0xed4f('0x34')](_0xed4f('0x10e'),_0x280172,_0x35d34d);});}else{throw ut['message'](_0x79e2d['message'],_0x280172,_0x35d34d);}})[_0xed4f('0x52')](function(_0x4d0210){ut[_0xed4f('0x37')]('[Preview][getContactPreview]',_0x4d0210);throw ut[_0xed4f('0x34')]('Call\x20unsuccessful',![],!![]);});};Preview[_0xed4f('0xe')][_0xed4f('0x10b')]=function(_0x2dd4fd){if(_[_0xed4f('0x45')](_0x2dd4fd)||_['isEmpty'](_0x2dd4fd)||!_[_0xed4f('0x45')](_0x2dd4fd[0x0][_0xed4f('0x60')])&&_[_0xed4f('0x45')](_0x2dd4fd[0x0][_0xed4f('0x60')][_0xed4f('0x2d')])){ut['logger'](_0xed4f('0x10f'),_0x2dd4fd);return{'isValid':![],'message':_0xed4f('0x110')};}var _0x47ed73=this[_0xed4f('0x13')][_0x2dd4fd[0x0][_0xed4f('0x47')][_0xed4f('0x2d')]];_0x47ed73[_0xed4f('0x34')]=utils[_0xed4f('0x35')][_0xed4f('0x77')];if(_['isNil'](_0x47ed73)){ut[_0xed4f('0x37')](_0xed4f('0x111'),_0x47ed73);return{'isValid':![],'message':_0xed4f('0x112')};}if(!this['isTrunkReachable'](_0x47ed73['Trunk'])){ut['logger'](_0xed4f('0x113'),_0xed4f('0x114')+_0x47ed73['name']+_0xed4f('0x115'));if(!this[_0xed4f('0x75')](_0x47ed73[_0xed4f('0x116')])){ut[_0xed4f('0x37')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x47ed73[_0xed4f('0x2d')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0xed4f('0x117')};}}if(!ut[_0xed4f('0x74')](_0x47ed73[_0xed4f('0x41')])){ut[_0xed4f('0x37')](_0xed4f('0x118'),_0x47ed73[_0xed4f('0x2d')]+_0xed4f('0x119'));return{'isValid':![],'message':_0xed4f('0x114')+_0x47ed73[_0xed4f('0x2d')]+_0xed4f('0x119')};}return{'isValid':!![],'message':_0xed4f('0x11a')};};Preview[_0xed4f('0xe')]['execCall']=function(_0x320aee,_0x543cb8,_0x574955,_0x34aab0){var _0x5920f5=this;return new Promise(function(_0x9a5009,_0x42e682){var _0x15e576=_0x320aee[_0xed4f('0x95')];var _0x36b460=_0x5920f5['isTrunkReachable'](_0x543cb8[_0xed4f('0x11b')])?util['format'](_0xed4f('0x11c'),_0x543cb8[_0xed4f('0x11b')][_0xed4f('0x2d')],_[_0xed4f('0x45')](_0x543cb8['dialPrefix'])?'':_0x543cb8['dialPrefix']['trim']()||'',_0x543cb8[_0xed4f('0x11d')]>0x0?_0x574955[_0xed4f('0xf3')][_0xed4f('0x11e')](_0x543cb8[_0xed4f('0x11d')]):_0x574955[_0xed4f('0xf3')]):util[_0xed4f('0x65')](_0xed4f('0x11c'),_[_0xed4f('0x45')](_0x543cb8[_0xed4f('0x116')])?_0x543cb8[_0xed4f('0x11b')][_0xed4f('0x2d')]:_0x543cb8[_0xed4f('0x116')]['name'],_[_0xed4f('0x45')](_0x543cb8[_0xed4f('0x11f')])?'':_0x543cb8['dialPrefix'][_0xed4f('0x120')]()||'',_0x543cb8[_0xed4f('0x11d')]>0x0?_0x574955[_0xed4f('0xf3')][_0xed4f('0x11e')](_0x543cb8[_0xed4f('0x11d')]):_0x574955[_0xed4f('0xf3')]);var _0x1e3097=_0x5920f5['isTrunkReachable'](_0x543cb8[_0xed4f('0x11b')])?ut['getCallerId'](_0x543cb8[_0xed4f('0x11b')][_0xed4f('0x121')],_0x543cb8[_0xed4f('0x122')],_0x543cb8[_0xed4f('0x123')]>0x0?ut[_0xed4f('0x124')](_0x543cb8[_0xed4f('0x125')],_0x543cb8['dialRandomLastDigitCallerIdNumber']):_0x543cb8[_0xed4f('0x125')]):ut['getCallerId'](_[_0xed4f('0x45')](_0x543cb8[_0xed4f('0x116')])?_0x543cb8[_0xed4f('0x11b')][_0xed4f('0x121')]:_0x543cb8[_0xed4f('0x116')][_0xed4f('0x121')],_0x543cb8['dialOriginateCallerIdName'],_0x543cb8['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0xed4f('0x124')](_0x543cb8['dialOriginateCallerIdNumber'],_0x543cb8['dialRandomLastDigitCallerIdNumber']):_0x543cb8[_0xed4f('0x125')]);if(_0x1e3097){_0x320aee[_0xed4f('0x126')]=ut[_0xed4f('0x127')](_0x1e3097);_0x320aee['originatecalleridnum']=ut[_0xed4f('0x128')](_0x1e3097);}var _0xdf55d8=ut[_0xed4f('0x129')](_0x543cb8,_0x574955,_0x36b460,_0x1e3097,_0x15e576,_0x320aee);var _0x4334d0=utils[_0xed4f('0x12a')](_0x574955[_0xed4f('0x12b')]);Object[_0xed4f('0x12c')](_0xdf55d8,_0x4334d0);_[_0xed4f('0x12d')](_0x320aee,ut[_0xed4f('0x12e')](_0xdf55d8));_0x320aee[_0xed4f('0x12f')]=moment()[_0xed4f('0x65')](_0xed4f('0x91'));_0x543cb8[_0xed4f('0x130')]=_0xdf55d8;var _0x129879=ut[_0xed4f('0x131')](_0x320aee,_0x543cb8,_0xdf55d8,_0x320aee[_0xed4f('0x8b')],_0x34aab0);return ami[_0xed4f('0x50')](_0x129879)[_0xed4f('0x5d')](function(_0x1213d6){_0x543cb8[_0xed4f('0x4a')]+=0x1;logger[_0xed4f('0x29')](_0xed4f('0x132'),_0x15e576,_0xed4f('0x96'),_0x543cb8[_0xed4f('0x2d')],_0xed4f('0x49'),_0x543cb8['originated']);_0x9a5009(_0x1213d6);})['catch'](function(_0xf3adce){ut['logAgent'](_0x320aee,0xe,'OriginateError');rpcDb['createAgentHistory'](_0x320aee,_0xed4f('0x133'));_0x42e682(_0xf3adce);});});};Preview[_0xed4f('0xe')][_0xed4f('0x134')]=function(_0x3f2f8c){if(this['actions'][_0x3f2f8c[_0xed4f('0x8c')]]){this[_0xed4f('0x16')][_0x3f2f8c[_0xed4f('0x8c')]][_0xed4f('0x135')]=_0x3f2f8c[_0xed4f('0x135')];}};Preview[_0xed4f('0xe')]['syncOriginateResponse']=function(_0x41c181){var _0x248886=this;var _0xfe5ab6=this[_0xed4f('0x16')][_0x41c181[_0xed4f('0x136')]];if(_0xfe5ab6){if(_0xfe5ab6[_0xed4f('0x137')]&&this[_0xed4f('0x17')][_0xfe5ab6[_0xed4f('0x137')]]){ut['logLookAgent'](_0xfe5ab6,this[_0xed4f('0x17')][_0xfe5ab6['lookAgent']][_0xed4f('0x2d')],this[_0xed4f('0x17')][_0xfe5ab6[_0xed4f('0x137')]]['id']);}var _0x1f666e=_[_0xed4f('0x138')](_0xfe5ab6);_0x1f666e[_0xed4f('0x92')]=moment()[_0xed4f('0x65')](_0xed4f('0x91'));var _0x59f4a6=_0x248886[_0xed4f('0x13')][_0xfe5ab6[_0xed4f('0x48')]];if(ut[_0xed4f('0x139')](_0x41c181[_0xed4f('0x13a')])){if(_0xfe5ab6[_0xed4f('0x8a')]){rpcDb[_0xed4f('0x108')](_0xfe5ab6[_0xed4f('0x8f')]);}if(_0xfe5ab6[_0xed4f('0x8b')]){rpcDb[_0xed4f('0x64')](_0xfe5ab6[_0xed4f('0x8f')]);}ami[_0xed4f('0x28')](_0xed4f('0x13b'),ut[_0xed4f('0x7d')](_0xfe5ab6,_0xed4f('0x13c'),this[_0xed4f('0x13')][_0xfe5ab6[_0xed4f('0x48')]]));this[_0xed4f('0xe0')](_0x1f666e,_0x59f4a6,_0x41c181);}else{_0xfe5ab6[_0xed4f('0x12f')]=moment()[_0xed4f('0x65')](_0xed4f('0x91'));ut['logAgent'](_0x1f666e,0x4,_0xed4f('0x13d'));rpcDb[_0xed4f('0xe5')](_0x1f666e,'[callProgressDetectingAgent][logAnswer]');}}};Preview['prototype']['syncHangup']=function(_0x54e8da){var _0x321205=this[_0xed4f('0x16')][_0x54e8da[_0xed4f('0x8c')]];var _0x6f600b;if(_0x321205){_0x6f600b=this[_0xed4f('0x13')][_0x321205[_0xed4f('0x48')]];logger[_0xed4f('0x29')](_0xed4f('0x13e'),_0x54e8da['linkedid'],'\x20Queue',_0x6f600b[_0xed4f('0x2d')],_0xed4f('0x4b'),_0x6f600b[_0xed4f('0x31')]);}if(this[_0xed4f('0x16')][_0x54e8da[_0xed4f('0x8c')]]&&_0x54e8da[_0xed4f('0x8c')]!==_0x54e8da[_0xed4f('0x95')]){if(_0x54e8da['cause']==='16'&&this[_0xed4f('0x16')][_0x54e8da[_0xed4f('0x8c')]][_0xed4f('0x4c')]){this[_0xed4f('0x78')](_0x54e8da,_0x54e8da[_0xed4f('0x8c')],_0x54e8da[_0xed4f('0x13f')]);}else if(this[_0xed4f('0x16')][_0x54e8da[_0xed4f('0x8c')]][_0xed4f('0x4c')]){logger[_0xed4f('0x29')](_0xed4f('0x140'),_0x54e8da[_0xed4f('0x8c')],_0x54e8da[_0xed4f('0x13f')],_0xed4f('0x96'),_0x6f600b[_0xed4f('0x2d')],'pTalking:\x20',_0x6f600b[_0xed4f('0x31')]);this[_0xed4f('0x78')](_0x54e8da,_0x54e8da['linkedid'],_0x54e8da[_0xed4f('0x13f')]);}}else if(_0x321205&&_[_0xed4f('0x45')](_0x321205[_0xed4f('0x141')])&&_0x6f600b[_0xed4f('0x142')]&&_0x54e8da[_0xed4f('0x8c')]===_0x54e8da['uniqueid']&&_[_0xed4f('0x45')](_0x54e8da[_0xed4f('0xe3')])&&_0x54e8da[_0xed4f('0x13f')]==='16'&&_0x54e8da[_0xed4f('0x143')]==='6'&&_[_0xed4f('0xe1')](_0x321205[_0xed4f('0x144')])){if(_0x321205[_0xed4f('0x8a')]){rpcDb[_0xed4f('0x108')](_0x321205[_0xed4f('0x8f')]);}if(_0x321205[_0xed4f('0x8b')]){rpcDb[_0xed4f('0x64')](_0x321205[_0xed4f('0x8f')]);}_0x54e8da['reason']='22';this[_0xed4f('0xe0')](_0x321205,_0x6f600b,_0x54e8da);}else if(_0x321205&&_0x321205['transfer']){if(_0x54e8da[_0xed4f('0x13f')]==='16'&&this[_0xed4f('0x16')][_0x54e8da[_0xed4f('0x8c')]][_0xed4f('0x4c')]){logger[_0xed4f('0x29')](_0xed4f('0x145'),_0x54e8da['linkedid'],_0x54e8da['cause'],_0xed4f('0x96'),_0x6f600b[_0xed4f('0x2d')],_0xed4f('0x4b'),_0x6f600b['pTalking']);this[_0xed4f('0x78')](_0x54e8da,_0x54e8da[_0xed4f('0x8c')],_0x54e8da[_0xed4f('0x13f')]);}else if(this['actions'][_0x54e8da[_0xed4f('0x8c')]][_0xed4f('0x4c')]){logger[_0xed4f('0x29')](_0xed4f('0x140'),_0x54e8da[_0xed4f('0x8c')],_0x54e8da[_0xed4f('0x13f')],_0xed4f('0x96'),_0x6f600b[_0xed4f('0x2d')],_0xed4f('0x4b'),_0x6f600b[_0xed4f('0x31')]);this[_0xed4f('0x78')](_0x54e8da,_0x54e8da['linkedid'],_0x54e8da[_0xed4f('0x13f')]);}}};Preview[_0xed4f('0xe')]['syncDialEnd']=function(_0x5c97c1){if(this[_0xed4f('0x16')][_0x5c97c1[_0xed4f('0xde')]]&&_0x5c97c1[_0xed4f('0xde')]!==_0x5c97c1['destuniqueid']){this['callProgressDetectingCustomer'](_0x5c97c1,_0x5c97c1[_0xed4f('0xde')],_0x5c97c1[_0xed4f('0xd4')]);}};Preview[_0xed4f('0xe')][_0xed4f('0x146')]=function(_0x4d75a8){if(this[_0xed4f('0x16')][_0x4d75a8['linkedid']]&&_0x4d75a8['linkedid']!==_0x4d75a8['uniqueid']&&!this['actions'][_0x4d75a8[_0xed4f('0x8c')]][_0xed4f('0x4c')]){if(_0x4d75a8[_0xed4f('0x13f')]==='1'){this[_0xed4f('0x78')](_0x4d75a8,_0x4d75a8[_0xed4f('0x8c')],_0x4d75a8[_0xed4f('0x13f')]);}}};Preview[_0xed4f('0xe')][_0xed4f('0x147')]=function(_0x452719,_0x10e245,_0x4b9965){if(this[_0xed4f('0x16')][_0x452719]){if(_['isNil'](this[_0xed4f('0x16')][_0x452719]['variables'])){this[_0xed4f('0x16')][_0x452719][_0xed4f('0x130')]={};}this[_0xed4f('0x16')][_0x452719][_0xed4f('0x130')][_0x10e245]=_0x4b9965;}};Preview['prototype'][_0xed4f('0x22')]=function(_0x41b4a0){try{if(!_[_0xed4f('0x45')](_0x41b4a0)){if(ut[_0xed4f('0x148')](_['keys'](_0x41b4a0[_0xed4f('0x149')])[0x0])){this[_0xed4f('0x147')](_0x41b4a0[_0xed4f('0x95')],_['keys'](_0x41b4a0['variable'])[0x0],_0x41b4a0[_0xed4f('0x14a')]);}}}catch(_0x543be7){logger[_0xed4f('0x14b')](_0xed4f('0x14c'),util[_0xed4f('0x14d')](_0x543be7,{'showHidden':![],'depth':null}));}};Preview['prototype'][_0xed4f('0x24')]=function(_0x2e3a1b){if(_0x2e3a1b){if(this[_0xed4f('0x16')][_0x2e3a1b[_0xed4f('0x14e')]]){this[_0xed4f('0x16')][_0x2e3a1b[_0xed4f('0x14e')]][_0xed4f('0x144')]=!![];}}};Preview[_0xed4f('0xe')]['syncBlindTransfer']=function(_0x11b283){if(_0x11b283){if(this[_0xed4f('0x16')][_0x11b283[_0xed4f('0x14f')]]){this[_0xed4f('0x16')][_0x11b283[_0xed4f('0x14f')]][_0xed4f('0x144')]=!![];}}};module[_0xed4f('0x150')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 48622bb..f4c8117 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 _0x0b76=['../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','inspect','createHistory','catch','[createHistory]\x20','then','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','resolve','[getContactPreview]\x20','createCustomerHistory','rescheduleContact','UserId','active','[rescheduleContact]\x20','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerleaveAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','membername','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','../../../config/logger','preview','../rpc/cmHopper'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x0b76,0xfb));var _0x60b7=function(_0x4ea5cd,_0x58333f){_0x4ea5cd=_0x4ea5cd-0x0;var _0x2a7aaa=_0x0b76[_0x4ea5cd];return _0x2a7aaa;};'use strict';var util=require(_0x60b7('0x0'));var BPromise=require('bluebird');var logger=require(_0x60b7('0x1'))(_0x60b7('0x2'));var cmHopper=require(_0x60b7('0x3'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x60b7('0x4'));var agentReportPreview=require(_0x60b7('0x5'));var voiceQueueReport=require(_0x60b7('0x6'));function loggerCatch(_0x39db2e){return function(_0x2b94ec){logger['error'](_0x39db2e,util[_0x60b7('0x7')](_0x2b94ec,{'showHidden':![],'depth':null}));};}function create(_0x3eb99c){return cmHopperHistory[_0x60b7('0x8')](_0x3eb99c)[_0x60b7('0x9')](loggerCatch(_0x60b7('0xa')));}function createAgent(_0x11a04e){return BPromise['resolve']()[_0x60b7('0xb')](agentReportPreview[_0x60b7('0x8')](_0x11a04e))[_0x60b7('0x9')](loggerCatch(_0x60b7('0xa')));}function moveContact(_0x57571a){return cmHopper['moveContactManagedDialer'](_0x57571a,!![])[_0x60b7('0x9')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0x60b7('0xc')]=function(_0xf7bcec){return cmHopperBlack[_0x60b7('0xc')](_0xf7bcec)[_0x60b7('0x9')](loggerCatch(_0x60b7('0xd')));};exports[_0x60b7('0xe')]=function(_0x40c5f4){return BPromise[_0x60b7('0xf')]()[_0x60b7('0xb')](cmHopper['getContactPreview'](_0x40c5f4))[_0x60b7('0x9')](loggerCatch(_0x60b7('0x10')));};exports[_0x60b7('0x8')]=function(_0x96dc4e,_0x163ef9){create(_0x96dc4e)[_0x60b7('0x9')](loggerCatch(_0x163ef9));moveContact(_0x96dc4e)['catch'](loggerCatch(_0x163ef9));};exports['createAgentHistory']=function(_0x300b0f,_0x3aa533){createAgent(_0x300b0f)[_0x60b7('0x9')](loggerCatch(_0x3aa533));};exports[_0x60b7('0x11')]=function(_0x8aba41,_0x5eeee1){create(_0x8aba41)[_0x60b7('0x9')](loggerCatch(_0x5eeee1));};exports['createCustomerFinal']=function(_0x3d649a,_0x212092){moveContact(_0x3d649a)[_0x60b7('0x9')](loggerCatch(_0x212092));};exports[_0x60b7('0x12')]=function(_0xeed493,_0x21bb91,_0x30cefc){if(_0x21bb91){_0xeed493[_0x60b7('0x13')]=null;}if(_0x30cefc){_0xeed493[_0x60b7('0x14')]=![];}return cmHopper[_0x60b7('0x12')](_0xeed493)['catch'](loggerCatch(_0x60b7('0x15')));};exports['countReScheduled']=function(_0x2343b2){return cmHopper['countReScheduled'](_0x2343b2)[_0x60b7('0x9')](loggerCatch(_0x60b7('0x16')));};exports[_0x60b7('0x17')]=function(_0x54224a){return cmHopper[_0x60b7('0x17')]({'UserId':null},_0x54224a,0x1)[_0x60b7('0x9')](loggerCatch(_0x60b7('0x18')));};exports[_0x60b7('0x19')]=function(_0x5cf8ea){return cmHopper[_0x60b7('0x17')]({'active':![]},_0x5cf8ea,0x1)[_0x60b7('0x9')](loggerCatch(_0x60b7('0x1a')));};exports[_0x60b7('0x1b')]=function(_0x1e1bb1){var _0x142e4c={};_0x142e4c['type']=_0x1e1bb1[_0x60b7('0x1c')];_0x142e4c['uniqueid']=_0x1e1bb1[_0x60b7('0x1d')];_0x142e4c[_0x60b7('0x1e')]=_0x1e1bb1[_0x60b7('0x1e')];_0x142e4c[_0x60b7('0x1f')]=_0x1e1bb1[_0x60b7('0x1f')];_0x142e4c[_0x60b7('0x20')]=_0x1e1bb1[_0x60b7('0x20')];_0x142e4c['queuecallerjoinAt']=_0x1e1bb1['answertime'];_0x142e4c[_0x60b7('0x21')]=_0x1e1bb1[_0x60b7('0x22')];_0x142e4c[_0x60b7('0x23')]=0x1;_0x142e4c[_0x60b7('0x24')]=_0x1e1bb1[_0x60b7('0x25')];_0x142e4c['connectedlinename']=_0x1e1bb1[_0x60b7('0x26')];_0x142e4c['context']='from-sip';_0x142e4c[_0x60b7('0x27')]=_0x60b7('0x28');_0x142e4c[_0x60b7('0x29')]=0x0;_0x142e4c[_0x60b7('0x2a')]=0x1;_0x142e4c[_0x60b7('0x2b')]=_0x1e1bb1[_0x60b7('0x26')];_0x142e4c[_0x60b7('0x2c')]=_0x60b7('0x2d');return BPromise[_0x60b7('0xf')]()[_0x60b7('0xb')](voiceQueueReport[_0x60b7('0x2e')](_0x142e4c))['catch'](loggerCatch(_0x60b7('0x2f')));};exports['getContactRecallMe']=function(_0x240f6f,_0x46cc34){return BPromise[_0x60b7('0xf')]()[_0x60b7('0xb')](cmHopper['getContactRecallMe'](_0x240f6f,_0x46cc34))[_0x60b7('0x9')](loggerCatch(_0x60b7('0x30')));};exports[_0x60b7('0x31')]=function(_0x4bd228){return cmHopper[_0x60b7('0x12')](_0x4bd228,!![],!![])['catch'](loggerCatch(_0x60b7('0x32')));}; \ No newline at end of file +var _0xb1c7=['[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','connectedlinename','membername','context','from-sip','exten','holdtime','assigned','lastAssignedTo','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','rescheduleContactInQueue','util','../../../config/logger','preview','../rpc/cmHopper','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','createHistory','[createHistory]\x20','resolve','then','catch','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerFinal','rescheduleContact','UserId','active','countReScheduled','[countReScheduled]\x20','unlockContact'];(function(_0x463231,_0x3ec1da){var _0x5369a2=function(_0x5ec21c){while(--_0x5ec21c){_0x463231['push'](_0x463231['shift']());}};_0x5369a2(++_0x3ec1da);}(_0xb1c7,0x119));var _0x7b1c=function(_0x4051be,_0x4e30dc){_0x4051be=_0x4051be-0x0;var _0x10d8e5=_0xb1c7[_0x4051be];return _0x10d8e5;};'use strict';var util=require(_0x7b1c('0x0'));var BPromise=require('bluebird');var logger=require(_0x7b1c('0x1'))(_0x7b1c('0x2'));var cmHopper=require(_0x7b1c('0x3'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require('../rpc/cmHopperBlack');var agentReportPreview=require(_0x7b1c('0x4'));var voiceQueueReport=require(_0x7b1c('0x5'));function loggerCatch(_0x5d69be){return function(_0x15a91a){logger[_0x7b1c('0x6')](_0x5d69be,util[_0x7b1c('0x7')](_0x15a91a,{'showHidden':![],'depth':null}));};}function create(_0xa4e24){return cmHopperHistory[_0x7b1c('0x8')](_0xa4e24)['catch'](loggerCatch(_0x7b1c('0x9')));}function createAgent(_0x32b083){return BPromise[_0x7b1c('0xa')]()[_0x7b1c('0xb')](agentReportPreview['createHistory'](_0x32b083))[_0x7b1c('0xc')](loggerCatch(_0x7b1c('0x9')));}function moveContact(_0x2cafdf){return cmHopper['moveContactManagedDialer'](_0x2cafdf,!![])[_0x7b1c('0xc')](loggerCatch(_0x7b1c('0xd')));}exports[_0x7b1c('0xe')]=function(_0x2fab53){return cmHopperBlack['checkIsBlackList'](_0x2fab53)[_0x7b1c('0xc')](loggerCatch('[checkIsBlackList]\x20'));};exports['getContactPreview']=function(_0xf21a98){return BPromise[_0x7b1c('0xa')]()[_0x7b1c('0xb')](cmHopper[_0x7b1c('0xf')](_0xf21a98))[_0x7b1c('0xc')](loggerCatch(_0x7b1c('0x10')));};exports[_0x7b1c('0x8')]=function(_0x121d9d,_0x4c3e37){create(_0x121d9d)[_0x7b1c('0xc')](loggerCatch(_0x4c3e37));moveContact(_0x121d9d)[_0x7b1c('0xc')](loggerCatch(_0x4c3e37));};exports[_0x7b1c('0x11')]=function(_0x55c929,_0x320eab){createAgent(_0x55c929)[_0x7b1c('0xc')](loggerCatch(_0x320eab));};exports['createCustomerHistory']=function(_0x11f63a,_0x2cbffc){create(_0x11f63a)[_0x7b1c('0xc')](loggerCatch(_0x2cbffc));};exports[_0x7b1c('0x12')]=function(_0x25f229,_0x258282){moveContact(_0x25f229)[_0x7b1c('0xc')](loggerCatch(_0x258282));};exports[_0x7b1c('0x13')]=function(_0x50d32a,_0x4f3023,_0x507e99){if(_0x4f3023){_0x50d32a[_0x7b1c('0x14')]=null;}if(_0x507e99){_0x50d32a[_0x7b1c('0x15')]=![];}return cmHopper[_0x7b1c('0x13')](_0x50d32a)[_0x7b1c('0xc')](loggerCatch('[rescheduleContact]\x20'));};exports[_0x7b1c('0x16')]=function(_0x3f7133){return cmHopper[_0x7b1c('0x16')](_0x3f7133)['catch'](loggerCatch(_0x7b1c('0x17')));};exports[_0x7b1c('0x18')]=function(_0x5a4475){return cmHopper['unlockContact']({'UserId':null},_0x5a4475,0x1)[_0x7b1c('0xc')](loggerCatch(_0x7b1c('0x19')));};exports[_0x7b1c('0x1a')]=function(_0xfbb767){return cmHopper[_0x7b1c('0x18')]({'active':![]},_0xfbb767,0x1)['catch'](loggerCatch(_0x7b1c('0x1b')));};exports[_0x7b1c('0x1c')]=function(_0xf3df56){var _0x59fbd4={};_0x59fbd4[_0x7b1c('0x1d')]=_0xf3df56[_0x7b1c('0x1d')];_0x59fbd4['uniqueid']=_0xf3df56[_0x7b1c('0x1e')];_0x59fbd4[_0x7b1c('0x1f')]=_0xf3df56[_0x7b1c('0x1f')];_0x59fbd4[_0x7b1c('0x20')]=_0xf3df56['calleridname'];_0x59fbd4['queue']=_0xf3df56[_0x7b1c('0x21')];_0x59fbd4['queuecallerjoinAt']=_0xf3df56[_0x7b1c('0x22')];_0x59fbd4[_0x7b1c('0x23')]=_0xf3df56['answertime'];_0x59fbd4[_0x7b1c('0x24')]=0x1;_0x59fbd4[_0x7b1c('0x25')]=_0xf3df56['endtime'];_0x59fbd4[_0x7b1c('0x26')]=_0xf3df56[_0x7b1c('0x27')];_0x59fbd4[_0x7b1c('0x28')]=_0x7b1c('0x29');_0x59fbd4[_0x7b1c('0x2a')]='xcally-motion-preview';_0x59fbd4[_0x7b1c('0x2b')]=0x0;_0x59fbd4[_0x7b1c('0x2c')]=0x1;_0x59fbd4[_0x7b1c('0x2d')]=_0xf3df56[_0x7b1c('0x27')];_0x59fbd4['queuecallerexitreason']=_0x7b1c('0x2e');return BPromise[_0x7b1c('0xa')]()[_0x7b1c('0xb')](voiceQueueReport[_0x7b1c('0x2f')](_0x59fbd4))[_0x7b1c('0xc')](loggerCatch(_0x7b1c('0x30')));};exports[_0x7b1c('0x31')]=function(_0x5e9f12,_0x35579c){return BPromise[_0x7b1c('0xa')]()[_0x7b1c('0xb')](cmHopper['getContactRecallMe'](_0x5e9f12,_0x35579c))[_0x7b1c('0xc')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0x7b1c('0x32')]=function(_0x41b170){return cmHopper[_0x7b1c('0x13')](_0x41b170,!![],!![])[_0x7b1c('0xc')](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index 9bc3159..a15cec3 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 _0xada8=['channelAgent','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','cloneAction','clone','Global','scheduledat','add','minutes','VoiceQueueId','decrementTalking','isNil','pTalking','[decrementTalking]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','interface','motionChannel','voice','mandatoryDisposition','buildObj','agentReadyId','not_inuse','status','reachable','getDiff','milliseconds','diff','seconds','createBody','ListId','filterKey','idContact','queue','type','dialAnswer','active','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-queue','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrttbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','bridgepeer','bridgepvtcallid','replace','random','extractCalleridName','match','extractCalleridNumber','noanswer','variables','forEach','toLowerCase','lodash','moment','preview','127.0.0.1','loggerCatch','logger','info','error','inspect','message','getCallerId','string','isEmpty','isUndefined','format','\x22%s\x22\x20<%s>','isActive','Queue','name','calleridname','calleridnum','ContactId','dialer','dialOriginateTimeout','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','hasOwnProperty','toLower','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','starttime','endtime','logAgent','ringtime','getSeconds','responsetime','logLookAgent','membername','UserId','logCustomer','answertime','isFailure','Failure','variablesAction','RECALL','uniqueid'];(function(_0x57e7f8,_0x328bcd){var _0x39f93b=function(_0x478568){while(--_0x478568){_0x57e7f8['push'](_0x57e7f8['shift']());}};_0x39f93b(++_0x328bcd);}(_0xada8,0xcf));var _0x8ada=function(_0xb886fa,_0x434717){_0xb886fa=_0xb886fa-0x0;var _0x1ee927=_0xada8[_0xb886fa];return _0x1ee927;};'use strict';var util=require('util');var _=require(_0x8ada('0x0'));var moment=require(_0x8ada('0x1'));var logger=require('../../../../config/logger')(_0x8ada('0x2'));var ipAgi=process['env']['XCALLY_IP_AGI']||_0x8ada('0x3');var utils=require('../../dialer/utils');exports[_0x8ada('0x4')]=function(_0x5cdffc){return function(_0x4f5948){logger['error'](_0x5cdffc,util['inspect'](_0x4f5948,{'showHidden':![],'depth':null}));};};exports[_0x8ada('0x5')]=function(_0x5d93b5,_0x20c300){logger[_0x8ada('0x6')](_0x5d93b5,util['inspect'](_0x20c300,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0xd3e649,_0x4ac26e){logger[_0x8ada('0x7')](_0xd3e649,util[_0x8ada('0x8')](_0x4ac26e,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x17e37b){return function(_0x1e5714){logger[_0x8ada('0x6')](_0x17e37b,util['inspect'](_0x1e5714,{'showHidden':![],'depth':null}));};};exports[_0x8ada('0x9')]=function(_0x376c25,_0x318aa8,_0xcf8bd4){return{'message':_0x376c25,'unlock':_0x318aa8,'active':_0xcf8bd4};};exports[_0x8ada('0xa')]=function(_0x1e945d,_0x52dd63,_0x24d8ea){if(!_['isUndefined'](_0x24d8ea)&&_0x8ada('0xb')===typeof _0x24d8ea&&!_[_0x8ada('0xc')](_0x24d8ea)){if(!_[_0x8ada('0xd')](_0x52dd63)&&_0x8ada('0xb')===typeof _0x52dd63&&!_['isEmpty'](_0x52dd63)){return util[_0x8ada('0xe')](_0x8ada('0xf'),_0x52dd63,_0x24d8ea);}return util[_0x8ada('0xe')](_0x8ada('0xf'),_0x24d8ea,_0x24d8ea);}if(!_[_0x8ada('0xd')](_0x1e945d)&&_0x8ada('0xb')===typeof _0x1e945d&&!_[_0x8ada('0xc')](_0x1e945d)){return _0x1e945d;}return'\x22\x22\x20<>';};exports[_0x8ada('0x10')]=function(_0x5665f4){if(_['isNil'](_0x5665f4)){return![];}return _0x5665f4;};exports['addVariables']=function(_0x2d77ba,_0x2ff2e4,_0x287b5e,_0x3a9ed5,_0x42360e,_0x5408f6){var _0x1fe89e={'XMD-QUEUE':_0x2ff2e4['Queue']?_0x2ff2e4[_0x8ada('0x11')][_0x8ada('0x12')]:'','XMD-CALLERID':_0x3a9ed5,'XMD-CALLERID-PREVIEW':_0x5408f6?util[_0x8ada('0xe')]('\x22%s\x22\x20<%s>',_0x5408f6[_0x8ada('0x13')],_0x5408f6[_0x8ada('0x14')]):_0x3a9ed5,'XMD-DIALID':_0x42360e,'XMD-CONTACTID':_0x2ff2e4[_0x8ada('0x15')],'XMD-CDRTYPE':_0x8ada('0x16'),'CALLERID(all)':_0x3a9ed5,'XMD-VOICEQUEUEID':_0x2ff2e4['VoiceQueueId'],'XMD-DIALCHANNEL':_0x287b5e,'XMD-DIALTIMEOUT':_0x2d77ba[_0x8ada('0x17')]||0x1e,'XMD-DIALOPTIONS':util[_0x8ada('0xe')]('\x22rtTxX%s%s\x22',_0x2d77ba[_0x8ada('0x18')]?'g':'',_[_0x8ada('0xc')](_0x2d77ba[_0x8ada('0x19')])?'':_0x8ada('0x1a')),'XMD-DIALURL':_0x2d77ba[_0x8ada('0x1b')]||'','XMD-AGI':_0x2d77ba[_0x8ada('0x1c')]?util[_0x8ada('0xe')](_0x8ada('0x1d'),ipAgi,_0x2d77ba[_0x8ada('0x1c')]):'NONE','XMD-AGIAFTER':_0x2d77ba[_0x8ada('0x18')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x2d77ba[_0x8ada('0x18')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x5408f6?_0x5408f6['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x5408f6?_0x5408f6['originatecalleridname']:'','XMD-DESTINATION':_0x8ada('0x1e'),'SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_[_0x8ada('0xc')](_0x2d77ba[_0x8ada('0x19')])){_0x1fe89e[util[_0x8ada('0xe')]('%s',_0x8ada('0x1f'))]=_0x2d77ba[_0x8ada('0x19')];_0x1fe89e[util['format']('%s',_0x8ada('0x20'))]=_0x42360e;}return _0x1fe89e;};exports[_0x8ada('0x21')]=function(_0x1809e1){var _0x54cc27={};for(var _0x32bedf in _0x1809e1){if(_0x1809e1[_0x8ada('0x22')](_0x32bedf)){_0x54cc27[util['format']('%s',_[_0x8ada('0x23')](_0x32bedf))]=_0x1809e1[_0x32bedf];}}return{'variables':_0x54cc27};};exports['logBlacklist']=function(_0x3be3e9){var _0x1ac539=moment()[_0x8ada('0xe')](_0x8ada('0x24'));_0x3be3e9[_0x8ada('0x25')]=0xd;_0x3be3e9[_0x8ada('0x26')]='Blacklist';_0x3be3e9[_0x8ada('0x27')]=_0x1ac539;_0x3be3e9['responsetime']=_0x1ac539;_0x3be3e9[_0x8ada('0x28')]=_0x1ac539;};exports[_0x8ada('0x29')]=function(_0x4aef23,_0x5817b6,_0x842512){var _0x1147dd=moment()['format'](_0x8ada('0x24'));_0x4aef23[_0x8ada('0x25')]=_0x5817b6;_0x4aef23['statedesc']=_0x842512;_0x4aef23['responsetime']=_0x1147dd;_0x4aef23[_0x8ada('0x2a')]=utils[_0x8ada('0x2b')](_0x4aef23[_0x8ada('0x2c')],_0x4aef23[_0x8ada('0x27')]);};exports[_0x8ada('0x2d')]=function(_0xae3487,_0x13300b,_0x53b943){_0xae3487[_0x8ada('0x2e')]=_0x13300b;_0xae3487[_0x8ada('0x2f')]=_0x53b943;};exports[_0x8ada('0x30')]=function(_0x2ea2f4,_0x1eed08,_0x53a8a2){var _0x3a6f3c=moment()[_0x8ada('0xe')](_0x8ada('0x24'));_0x2ea2f4[_0x8ada('0x25')]=_0x1eed08;_0x2ea2f4[_0x8ada('0x26')]=_0x53a8a2;_0x2ea2f4[_0x8ada('0x2c')]=_0x2ea2f4[_0x8ada('0x2c')]?_0x2ea2f4[_0x8ada('0x2c')]:_0x3a6f3c;_0x2ea2f4['endtime']=_0x2ea2f4[_0x8ada('0x28')]?_0x2ea2f4['endtime']:_0x3a6f3c;_0x2ea2f4[_0x8ada('0x2a')]=utils['getSeconds'](_0x2ea2f4['responsetime']||0x0,_0x2ea2f4[_0x8ada('0x27')]||0x0);_0x2ea2f4['talktime']=_0x2ea2f4[_0x8ada('0x31')]?utils[_0x8ada('0x2b')](_0x2ea2f4['endtime'],_0x2ea2f4[_0x8ada('0x31')]):0x0;};exports[_0x8ada('0x32')]=function(_0x5f14ac){return _0x5f14ac===_0x8ada('0x33');};exports[_0x8ada('0x34')]=function(_0x22f52d,_0x3bf024,_0x11ac83,_0x2ea7d9,_0x5d6552){var _0x21f8e9=_0x2ea7d9?_0x8ada('0x35'):_0x22f52d[_0x8ada('0x13')];_0x21f8e9=_0x5d6552?'BOOKED':_0x21f8e9;return{'actionid':_0x22f52d[_0x8ada('0x36')],'action':'originate','channel':_0x22f52d[_0x8ada('0x37')],'callerid':util[_0x8ada('0xe')](_0x8ada('0xf'),_0x21f8e9,_0x22f52d[_0x8ada('0x14')]),'Exten':_0x8ada('0x1e'),'Context':_0x8ada('0x38'),'Priority':'1','variable':_0x11ac83,'timeout':(_0x3bf024[_0x8ada('0x39')]||0x1e)*0x3e8,'async':!![],'channelid':_0x22f52d[_0x8ada('0x36')]};};exports[_0x8ada('0x3a')]=function(_0x46771f){return _0x46771f[_0x8ada('0x3b')]+_0x46771f[_0x8ada('0x3c')]+_0x46771f[_0x8ada('0x3d')]+_0x46771f['countagentrejectretry']+_0x46771f['countnosuchnumberretry'];};exports[_0x8ada('0x3e')]=function(_0x4ba557){var _0x3807ee=_[_0x8ada('0x3f')](_0x4ba557);_0x3807ee[_0x8ada('0x25')]=0xf;_0x3807ee[_0x8ada('0x26')]=_0x8ada('0x40');return _0x3807ee;};exports['scheduledAt']=function(_0x57ae45,_0x1475b5,_0x1656bc){var _0x39e545={};_0x39e545[_0x1475b5]=_0x57ae45[_0x1475b5];_0x39e545['active']=![];_0x39e545[_0x8ada('0x41')]=moment()[_0x8ada('0x42')](_0x1656bc,_0x8ada('0x43'))[_0x8ada('0xe')](_0x8ada('0x24'));_0x39e545['ContactId']=_0x57ae45[_0x8ada('0x15')];_0x39e545['ListId']=_0x57ae45['ListId'];_0x39e545[_0x8ada('0x44')]=_0x57ae45[_0x8ada('0x44')]||undefined;return _0x39e545;};exports[_0x8ada('0x45')]=function(_0x283e82,_0x304183){if(!_[_0x8ada('0x46')](_0x283e82)){if(_0x283e82[_0x8ada('0x47')]>0x0){_0x283e82[_0x8ada('0x47')]-=0x1;}else{logger[_0x8ada('0x6')](_0x304183,'[decrementTalking]\x20object\x20talking\x20is\x20negative');}}else{logger['error'](_0x304183,_0x8ada('0x48'));}};exports[_0x8ada('0x49')]=function(_0xc8c668){if(_0xc8c668<=0x0){return!![];}return![];};function buildObj(_0x2c7dc0,_0x112b6e,_0x2877f9){_0x2c7dc0['lastevent']=_0x112b6e;_0x2c7dc0[_0x8ada('0x12')]=_0x2c7dc0['queue'];_0x2c7dc0[_0x8ada('0x4a')]=_0x2c7dc0[_0x8ada('0x37')];_0x2c7dc0[_0x8ada('0x4b')]=_0x8ada('0x4c');if(_0x2877f9){_0x2c7dc0[_0x8ada('0x4d')]=_0x2877f9[_0x8ada('0x4d')];}return _0x2c7dc0;}exports[_0x8ada('0x4e')]=buildObj;exports[_0x8ada('0x4f')]=function(_0x1886a9){var _0xa62780=[];for(var _0x2cdd76 in _0x1886a9){if(_0x1886a9[_0x8ada('0x22')](_0x2cdd76)){if(!_[_0x8ada('0x46')](_0x1886a9[_0x2cdd76])&&_0x1886a9[_0x2cdd76][_0x8ada('0x25')]===_0x8ada('0x50')&&_0x1886a9[_0x2cdd76][_0x8ada('0x51')]===_0x8ada('0x52')){_0xa62780['push'](_0x1886a9[_0x2cdd76]['id']);}}}return _0xa62780;};exports[_0x8ada('0x53')]=function(_0x491f53){var _0x3ff651=moment()[_0x8ada('0x54')](0x0);var _0x7e0c78=moment(_0x491f53)[_0x8ada('0x54')](0x0);return _0x3ff651[_0x8ada('0x55')](_0x7e0c78,_0x8ada('0x56'));};exports[_0x8ada('0x57')]=function(_0x4db8fb){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x4db8fb[_0x8ada('0x15')],'ListId':_0x4db8fb[_0x8ada('0x58')],'VoiceQueueId':_0x4db8fb[_0x8ada('0x44')]||undefined,'CampaignId':_0x4db8fb['CampaignId']||undefined};};exports[_0x8ada('0x59')]=function(_0x1e058f){if(_0x1e058f==='uniqueid'||_0x1e058f===_0x8ada('0x5a')||_0x1e058f===_0x8ada('0x5b')||_0x1e058f===_0x8ada('0x5c')||_0x1e058f==='campaigntype'||_0x1e058f===_0x8ada('0x5d')||_0x1e058f==='membername'||_0x1e058f===_0x8ada('0x37')||_0x1e058f===_0x8ada('0x13')||_0x1e058f===_0x8ada('0x5e')||_0x1e058f===_0x8ada('0x14')||_0x1e058f===_0x8ada('0x41')||_0x1e058f===_0x8ada('0x3b')||_0x1e058f===_0x8ada('0x3c')||_0x1e058f===_0x8ada('0x3d')||_0x1e058f===_0x8ada('0x5f')||_0x1e058f===_0x8ada('0x60')||_0x1e058f===_0x8ada('0x61')||_0x1e058f===_0x8ada('0x62')||_0x1e058f===_0x8ada('0x63')||_0x1e058f===_0x8ada('0x15')||_0x1e058f===_0x8ada('0x58')||_0x1e058f==='UserId'||_0x1e058f===_0x8ada('0x44')||_0x1e058f===_0x8ada('0x64')||_0x1e058f==='xmd-voicequeueid'||_0x1e058f===_0x8ada('0x65')||_0x1e058f==='xmd-phone'||_0x1e058f===_0x8ada('0x66')||_0x1e058f===_0x8ada('0x67')||_0x1e058f===_0x8ada('0x68')||_0x1e058f===_0x8ada('0x69')||_0x1e058f===_0x8ada('0x6a')||_0x1e058f===_0x8ada('0x6b')||_0x1e058f===_0x8ada('0x6c')||_0x1e058f===_0x8ada('0x6d')||_0x1e058f===_0x8ada('0x6e')||_0x1e058f==='xmd-agiafter'||_0x1e058f===_0x8ada('0x6f')||_0x1e058f===_0x8ada('0x70')||_0x1e058f===_0x8ada('0x71')||_0x1e058f===_0x8ada('0x72')||_0x1e058f===_0x8ada('0x73')||_0x1e058f===_0x8ada('0x74')||_0x1e058f==='rtpaudioqoslossbridged'||_0x1e058f==='rtpaudioqosrtt'||_0x1e058f===_0x8ada('0x75')||_0x1e058f==='rtpaudioqos'||_0x1e058f===_0x8ada('0x71')||_0x1e058f==='rtpaudioqosjitter'||_0x1e058f===_0x8ada('0x73')||_0x1e058f===_0x8ada('0x74')||_0x1e058f===_0x8ada('0x76')||_0x1e058f===_0x8ada('0x77')||_0x1e058f==='rtpaudioqosrttbridged'||_0x1e058f===_0x8ada('0x78')||_0x1e058f===_0x8ada('0x79')||_0x1e058f===_0x8ada('0x25')||_0x1e058f==='statedesc'){return![];}return!![];};exports['getCallerIdRandom']=function(_0x19afd0,_0x310765){var _0x3b390f,_0x3e6e5c,_0x147316;if(_0x310765<=0x0){_0x310765=0x1;}_0x3b390f=new RegExp('\x5cw{0,'+_0x310765+'}$');_0x3e6e5c=Math['pow'](0xa,_0x310765-0x1);_0x147316=Math['pow'](0xa,_0x310765)-0x1;return util[_0x8ada('0xe')]('%s',_[_0x8ada('0x7a')](_0x19afd0,_0x3b390f,_[_0x8ada('0x7b')](_0x3e6e5c,_0x147316)));};exports[_0x8ada('0x7c')]=function(_0x31b7d9){var _0x353067=_0x31b7d9[_0x8ada('0x7d')](/"(.*?)"/);return _0x353067?_0x353067[0x1]:_0x31b7d9;};exports[_0x8ada('0x7e')]=function(_0x291c5f){var _0x173466=_0x291c5f[_0x8ada('0x7d')](/<(.*?)>/);return _0x173466?_0x173466[0x1]:_0x291c5f;};function buildNoAnswerEventPayload(_0x15ab5c,_0x53cc58){var _0x4533e2=buildObj(_0x15ab5c,_0x8ada('0x7f'));if(!_[_0x8ada('0xc')](_0x53cc58[_0x8ada('0x80')])){Object['keys'](_0x53cc58[_0x8ada('0x80')])[_0x8ada('0x81')](function(_0x1ecece){_0x4533e2[_0x1ecece[_0x8ada('0x82')]()]=_0x53cc58['variables'][_0x1ecece];});}return _0x4533e2;}exports['buildNoAnswerEventPayload']=buildNoAnswerEventPayload; \ No newline at end of file +var _0x7969=['\x22\x22\x20<>','isActive','isNil','addVariables','Queue','calleridname','ContactId','dialer','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','dialPreviewUrl','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','originatecalleridnum','originatecalleridname','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','toLowerVariables','hasOwnProperty','toLower','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','ringtime','getSeconds','logLookAgent','membername','UserId','logCustomer','talktime','answertime','isFailure','Failure','variablesAction','RECALL','uniqueid','originate','xcally-motion-preview','from-sip','timeout','totalGlobal','countbusyretry','countnoanswerretry','countagentrejectretry','cloneAction','clone','scheduledAt','active','add','ListId','VoiceQueueId','decrementTalking','pTalking','[decrementTalking]\x20object\x20talking\x20is\x20negative','[decrementTalking]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','name','queue','interface','channelAgent','motionChannel','mandatoryDisposition','not_inuse','status','reachable','push','milliseconds','diff','seconds','createBody','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','calleridnum','countcongestionretry','countglobal','callback','callbackuniqueid','callbackat','sipcallid','xmd-voicequeueid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqoslossbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','extractCalleridName','match','noanswer','variables','keys','forEach','toLowerCase','buildNoAnswerEventPayload','util','lodash','moment','preview','env','XCALLY_IP_AGI','../../dialer/utils','loggerCatch','error','info','inspect','loggerError','message','getCallerId','isUndefined','string','isEmpty','\x22%s\x22\x20<%s>','format'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x7969,0x7c));var _0x9796=function(_0x4491c0,_0x276edc){_0x4491c0=_0x4491c0-0x0;var _0x3f164b=_0x7969[_0x4491c0];return _0x3f164b;};'use strict';var util=require(_0x9796('0x0'));var _=require(_0x9796('0x1'));var moment=require(_0x9796('0x2'));var logger=require('../../../../config/logger')(_0x9796('0x3'));var ipAgi=process[_0x9796('0x4')][_0x9796('0x5')]||'127.0.0.1';var utils=require(_0x9796('0x6'));exports[_0x9796('0x7')]=function(_0x3a2068){return function(_0x3c17bd){logger[_0x9796('0x8')](_0x3a2068,util['inspect'](_0x3c17bd,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x2099db,_0x46b053){logger[_0x9796('0x9')](_0x2099db,util[_0x9796('0xa')](_0x46b053,{'showHidden':![],'depth':null}));};exports[_0x9796('0xb')]=function(_0x361fc6,_0x113334){logger['error'](_0x361fc6,util[_0x9796('0xa')](_0x113334,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x78c5e3){return function(_0x5062b4){logger['info'](_0x78c5e3,util[_0x9796('0xa')](_0x5062b4,{'showHidden':![],'depth':null}));};};exports[_0x9796('0xc')]=function(_0x5e114a,_0x28f10c,_0x157279){return{'message':_0x5e114a,'unlock':_0x28f10c,'active':_0x157279};};exports[_0x9796('0xd')]=function(_0x33433f,_0x7f6db6,_0x4f13a7){if(!_[_0x9796('0xe')](_0x4f13a7)&&_0x9796('0xf')===typeof _0x4f13a7&&!_[_0x9796('0x10')](_0x4f13a7)){if(!_[_0x9796('0xe')](_0x7f6db6)&&_0x9796('0xf')===typeof _0x7f6db6&&!_[_0x9796('0x10')](_0x7f6db6)){return util['format'](_0x9796('0x11'),_0x7f6db6,_0x4f13a7);}return util[_0x9796('0x12')](_0x9796('0x11'),_0x4f13a7,_0x4f13a7);}if(!_[_0x9796('0xe')](_0x33433f)&&_0x9796('0xf')===typeof _0x33433f&&!_['isEmpty'](_0x33433f)){return _0x33433f;}return _0x9796('0x13');};exports[_0x9796('0x14')]=function(_0x22159a){if(_[_0x9796('0x15')](_0x22159a)){return![];}return _0x22159a;};exports[_0x9796('0x16')]=function(_0xf41a65,_0xa4fdea,_0x59e73b,_0x59d8a1,_0x39dd2b,_0x28d58f){var _0x537e83={'XMD-QUEUE':_0xa4fdea[_0x9796('0x17')]?_0xa4fdea['Queue']['name']:'','XMD-CALLERID':_0x59d8a1,'XMD-CALLERID-PREVIEW':_0x28d58f?util[_0x9796('0x12')](_0x9796('0x11'),_0x28d58f[_0x9796('0x18')],_0x28d58f['calleridnum']):_0x59d8a1,'XMD-DIALID':_0x39dd2b,'XMD-CONTACTID':_0xa4fdea[_0x9796('0x19')],'XMD-CDRTYPE':_0x9796('0x1a'),'CALLERID(all)':_0x59d8a1,'XMD-VOICEQUEUEID':_0xa4fdea['VoiceQueueId'],'XMD-DIALCHANNEL':_0x59e73b,'XMD-DIALTIMEOUT':_0xf41a65[_0x9796('0x1b')]||0x1e,'XMD-DIALOPTIONS':util['format'](_0x9796('0x1c'),_0xf41a65[_0x9796('0x1d')]?'g':'',_[_0x9796('0x10')](_0xf41a65[_0x9796('0x1e')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0xf41a65[_0x9796('0x1f')]||'','XMD-AGI':_0xf41a65['dialQueueProject']?util[_0x9796('0x12')](_0x9796('0x20'),ipAgi,_0xf41a65[_0x9796('0x21')]):_0x9796('0x22'),'XMD-AGIAFTER':_0xf41a65[_0x9796('0x1d')]?util[_0x9796('0x12')](_0x9796('0x20'),ipAgi,_0xf41a65[_0x9796('0x1d')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x28d58f?_0x28d58f[_0x9796('0x23')]:'','XMD-ORIGINATECALLERIDNAME':_0x28d58f?_0x28d58f[_0x9796('0x24')]:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':_0x9796('0x25')};if(!_['isEmpty'](_0xf41a65['monitor_format'])){_0x537e83[util[_0x9796('0x12')]('%s',_0x9796('0x26'))]=_0xf41a65[_0x9796('0x1e')];_0x537e83[util['format']('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x39dd2b;}return _0x537e83;};exports[_0x9796('0x27')]=function(_0x5c2506){var _0x1560b5={};for(var _0x15730f in _0x5c2506){if(_0x5c2506[_0x9796('0x28')](_0x15730f)){_0x1560b5[util['format']('%s',_[_0x9796('0x29')](_0x15730f))]=_0x5c2506[_0x15730f];}}return{'variables':_0x1560b5};};exports[_0x9796('0x2a')]=function(_0x103a0e){var _0x4b4c05=moment()[_0x9796('0x12')](_0x9796('0x2b'));_0x103a0e[_0x9796('0x2c')]=0xd;_0x103a0e[_0x9796('0x2d')]=_0x9796('0x2e');_0x103a0e[_0x9796('0x2f')]=_0x4b4c05;_0x103a0e[_0x9796('0x30')]=_0x4b4c05;_0x103a0e[_0x9796('0x31')]=_0x4b4c05;};exports[_0x9796('0x32')]=function(_0x639c26,_0x187cda,_0x182444){var _0x205516=moment()[_0x9796('0x12')](_0x9796('0x2b'));_0x639c26[_0x9796('0x2c')]=_0x187cda;_0x639c26[_0x9796('0x2d')]=_0x182444;_0x639c26['responsetime']=_0x205516;_0x639c26[_0x9796('0x33')]=utils[_0x9796('0x34')](_0x639c26[_0x9796('0x30')],_0x639c26[_0x9796('0x2f')]);};exports[_0x9796('0x35')]=function(_0x4c599a,_0x11755a,_0x15addb){_0x4c599a[_0x9796('0x36')]=_0x11755a;_0x4c599a[_0x9796('0x37')]=_0x15addb;};exports[_0x9796('0x38')]=function(_0x3d7e7f,_0x471fd4,_0x42b23){var _0x332dd3=moment()[_0x9796('0x12')](_0x9796('0x2b'));_0x3d7e7f[_0x9796('0x2c')]=_0x471fd4;_0x3d7e7f[_0x9796('0x2d')]=_0x42b23;_0x3d7e7f[_0x9796('0x30')]=_0x3d7e7f[_0x9796('0x30')]?_0x3d7e7f[_0x9796('0x30')]:_0x332dd3;_0x3d7e7f[_0x9796('0x31')]=_0x3d7e7f['endtime']?_0x3d7e7f['endtime']:_0x332dd3;_0x3d7e7f['ringtime']=utils[_0x9796('0x34')](_0x3d7e7f[_0x9796('0x30')]||0x0,_0x3d7e7f[_0x9796('0x2f')]||0x0);_0x3d7e7f[_0x9796('0x39')]=_0x3d7e7f[_0x9796('0x3a')]?utils[_0x9796('0x34')](_0x3d7e7f[_0x9796('0x31')],_0x3d7e7f['answertime']):0x0;};exports[_0x9796('0x3b')]=function(_0x3fa112){return _0x3fa112===_0x9796('0x3c');};exports[_0x9796('0x3d')]=function(_0x1bf6bc,_0x59690f,_0x3f6977,_0x31c8be,_0x1e7140){var _0x33fc8e=_0x31c8be?_0x9796('0x3e'):_0x1bf6bc['calleridname'];_0x33fc8e=_0x1e7140?'BOOKED':_0x33fc8e;return{'actionid':_0x1bf6bc[_0x9796('0x3f')],'action':_0x9796('0x40'),'channel':_0x1bf6bc['channelAgent'],'callerid':util[_0x9796('0x12')](_0x9796('0x11'),_0x33fc8e,_0x1bf6bc['calleridnum']),'Exten':_0x9796('0x41'),'Context':_0x9796('0x42'),'Priority':'1','variable':_0x3f6977,'timeout':(_0x59690f[_0x9796('0x43')]||0x1e)*0x3e8,'async':!![],'channelid':_0x1bf6bc['uniqueid']};};exports[_0x9796('0x44')]=function(_0x5f2726){return _0x5f2726[_0x9796('0x45')]+_0x5f2726['countcongestionretry']+_0x5f2726[_0x9796('0x46')]+_0x5f2726[_0x9796('0x47')]+_0x5f2726['countnosuchnumberretry'];};exports[_0x9796('0x48')]=function(_0x51bac6){var _0x5efa39=_[_0x9796('0x49')](_0x51bac6);_0x5efa39[_0x9796('0x2c')]=0xf;_0x5efa39[_0x9796('0x2d')]='Global';return _0x5efa39;};exports[_0x9796('0x4a')]=function(_0x9d379b,_0xdcdc98,_0x923657){var _0x385db8={};_0x385db8[_0xdcdc98]=_0x9d379b[_0xdcdc98];_0x385db8[_0x9796('0x4b')]=![];_0x385db8['scheduledat']=moment()[_0x9796('0x4c')](_0x923657,'minutes')[_0x9796('0x12')](_0x9796('0x2b'));_0x385db8['ContactId']=_0x9d379b[_0x9796('0x19')];_0x385db8[_0x9796('0x4d')]=_0x9d379b[_0x9796('0x4d')];_0x385db8[_0x9796('0x4e')]=_0x9d379b['VoiceQueueId']||undefined;return _0x385db8;};exports[_0x9796('0x4f')]=function(_0x137ce7,_0x206591){if(!_[_0x9796('0x15')](_0x137ce7)){if(_0x137ce7[_0x9796('0x50')]>0x0){_0x137ce7[_0x9796('0x50')]-=0x1;}else{logger[_0x9796('0x9')](_0x206591,_0x9796('0x51'));}}else{logger[_0x9796('0x8')](_0x206591,_0x9796('0x52'));}};exports[_0x9796('0x53')]=function(_0x37379d){if(_0x37379d<=0x0){return!![];}return![];};function buildObj(_0x2e2855,_0x146875,_0x4063b1){_0x2e2855[_0x9796('0x54')]=_0x146875;_0x2e2855[_0x9796('0x55')]=_0x2e2855[_0x9796('0x56')];_0x2e2855[_0x9796('0x57')]=_0x2e2855[_0x9796('0x58')];_0x2e2855[_0x9796('0x59')]='voice';if(_0x4063b1){_0x2e2855[_0x9796('0x5a')]=_0x4063b1[_0x9796('0x5a')];}return _0x2e2855;}exports['buildObj']=buildObj;exports['agentReadyId']=function(_0x17a074){var _0x4f089f=[];for(var _0x20112d in _0x17a074){if(_0x17a074[_0x9796('0x28')](_0x20112d)){if(!_[_0x9796('0x15')](_0x17a074[_0x20112d])&&_0x17a074[_0x20112d][_0x9796('0x2c')]===_0x9796('0x5b')&&_0x17a074[_0x20112d][_0x9796('0x5c')]===_0x9796('0x5d')){_0x4f089f[_0x9796('0x5e')](_0x17a074[_0x20112d]['id']);}}}return _0x4f089f;};exports['getDiff']=function(_0x259f48){var _0x4f94cf=moment()[_0x9796('0x5f')](0x0);var _0x59e5d4=moment(_0x259f48)[_0x9796('0x5f')](0x0);return _0x4f94cf[_0x9796('0x60')](_0x59e5d4,_0x9796('0x61'));};exports[_0x9796('0x62')]=function(_0x3ae7f3){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x3ae7f3[_0x9796('0x19')],'ListId':_0x3ae7f3[_0x9796('0x4d')],'VoiceQueueId':_0x3ae7f3[_0x9796('0x4e')]||undefined,'CampaignId':_0x3ae7f3[_0x9796('0x63')]||undefined};};exports[_0x9796('0x64')]=function(_0x40fe01){if(_0x40fe01==='uniqueid'||_0x40fe01===_0x9796('0x65')||_0x40fe01===_0x9796('0x56')||_0x40fe01===_0x9796('0x66')||_0x40fe01===_0x9796('0x67')||_0x40fe01===_0x9796('0x68')||_0x40fe01==='membername'||_0x40fe01===_0x9796('0x58')||_0x40fe01===_0x9796('0x18')||_0x40fe01==='active'||_0x40fe01===_0x9796('0x69')||_0x40fe01==='scheduledat'||_0x40fe01==='countbusyretry'||_0x40fe01===_0x9796('0x6a')||_0x40fe01===_0x9796('0x46')||_0x40fe01===_0x9796('0x6b')||_0x40fe01===_0x9796('0x6c')||_0x40fe01===_0x9796('0x6d')||_0x40fe01===_0x9796('0x6e')||_0x40fe01==='recallme'||_0x40fe01===_0x9796('0x19')||_0x40fe01===_0x9796('0x4d')||_0x40fe01===_0x9796('0x37')||_0x40fe01===_0x9796('0x4e')||_0x40fe01===_0x9796('0x6f')||_0x40fe01===_0x9796('0x70')||_0x40fe01==='xmd-queue'||_0x40fe01==='xmd-phone'||_0x40fe01==='xmd-listid'||_0x40fe01===_0x9796('0x71')||_0x40fe01===_0x9796('0x72')||_0x40fe01===_0x9796('0x73')||_0x40fe01==='xmd-dialid'||_0x40fe01===_0x9796('0x74')||_0x40fe01===_0x9796('0x75')||_0x40fe01===_0x9796('0x76')||_0x40fe01===_0x9796('0x77')||_0x40fe01===_0x9796('0x78')||_0x40fe01===_0x9796('0x79')||_0x40fe01===_0x9796('0x7a')||_0x40fe01===_0x9796('0x7b')||_0x40fe01==='rtpaudioqosjitter'||_0x40fe01===_0x9796('0x7c')||_0x40fe01===_0x9796('0x7d')||_0x40fe01==='rtpaudioqoslossbridged'||_0x40fe01===_0x9796('0x7e')||_0x40fe01===_0x9796('0x7f')||_0x40fe01===_0x9796('0x7a')||_0x40fe01===_0x9796('0x7b')||_0x40fe01==='rtpaudioqosjitter'||_0x40fe01===_0x9796('0x7c')||_0x40fe01===_0x9796('0x7d')||_0x40fe01===_0x9796('0x80')||_0x40fe01==='rtpaudioqosrtt'||_0x40fe01===_0x9796('0x7f')||_0x40fe01===_0x9796('0x81')||_0x40fe01===_0x9796('0x82')||_0x40fe01===_0x9796('0x2c')||_0x40fe01===_0x9796('0x2d')){return![];}return!![];};exports[_0x9796('0x83')]=function(_0x414e03,_0x3575f1){var _0x34193b,_0x245b15,_0x25a2d6;if(_0x3575f1<=0x0){_0x3575f1=0x1;}_0x34193b=new RegExp(_0x9796('0x84')+_0x3575f1+'}$');_0x245b15=Math[_0x9796('0x85')](0xa,_0x3575f1-0x1);_0x25a2d6=Math[_0x9796('0x85')](0xa,_0x3575f1)-0x1;return util['format']('%s',_[_0x9796('0x86')](_0x414e03,_0x34193b,_['random'](_0x245b15,_0x25a2d6)));};exports[_0x9796('0x87')]=function(_0x3ce94c){var _0x1cad0a=_0x3ce94c[_0x9796('0x88')](/"(.*?)"/);return _0x1cad0a?_0x1cad0a[0x1]:_0x3ce94c;};exports['extractCalleridNumber']=function(_0x3833d1){var _0x516d77=_0x3833d1[_0x9796('0x88')](/<(.*?)>/);return _0x516d77?_0x516d77[0x1]:_0x3833d1;};function buildNoAnswerEventPayload(_0x3f8051,_0x400c3f){var _0x5e5018=buildObj(_0x3f8051,_0x9796('0x89'));if(!_[_0x9796('0x10')](_0x400c3f[_0x9796('0x8a')])){Object[_0x9796('0x8b')](_0x400c3f[_0x9796('0x8a')])[_0x9796('0x8c')](function(_0x5a4319){_0x5e5018[_0x5a4319[_0x9796('0x8d')]()]=_0x400c3f[_0x9796('0x8a')][_0x5a4319];});}return _0x5e5018;}exports[_0x9796('0x8e')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 8e81457..816f22e 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 _0x6298=['queuepause','voicequeuechannelredirect','queueadd','string','boolean','queueremove'];(function(_0x3cceb0,_0x132e6e){var _0x32dae3=function(_0x11925f){while(--_0x11925f){_0x3cceb0['push'](_0x3cceb0['shift']());}};_0x32dae3(++_0x132e6e);}(_0x6298,0xb0));var _0x8629=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6298[_0x3dd15e];return _0x231fd0;};'use strict';exports[_0x8629('0x0')]={'queue':{'type':_0x8629('0x1'),'required':!![]},'interface':{'type':_0x8629('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':_0x8629('0x2'),'required':![]}};exports[_0x8629('0x3')]={'queue':{'type':_0x8629('0x1'),'required':!![]},'interface':{'type':_0x8629('0x1'),'required':!![]}};exports[_0x8629('0x4')]={'interface':{'type':_0x8629('0x1'),'required':!![]},'paused':{'type':'boolean'},'reason':{'type':_0x8629('0x1'),'required':![]}};exports['reload']={'module':{'type':'string','required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':'string','required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0x8629('0x1'),'required':!![]},'filename':{'type':_0x8629('0x1')},'format':{'type':_0x8629('0x1')},'mixmonitorid':{'type':_0x8629('0x1')}};exports['voicequeuechannelhangup']={'uniqueid':{'type':_0x8629('0x1'),'required':!![]}};exports[_0x8629('0x5')]={'uniqueid':{'type':_0x8629('0x1'),'required':!![]},'exten':{'type':_0x8629('0x1'),'required':!![]},'context':{'type':_0x8629('0x1')}}; \ No newline at end of file +var _0x0a11=['string','boolean','queueremove','queuepause','reload','voicequeuechannel','voicechannel','queueadd'];(function(_0x1417ba,_0x52e154){var _0x4f2213=function(_0x3a0aa5){while(--_0x3a0aa5){_0x1417ba['push'](_0x1417ba['shift']());}};_0x4f2213(++_0x52e154);}(_0x0a11,0x10f));var _0x10a1=function(_0x8550ba,_0x57c10d){_0x8550ba=_0x8550ba-0x0;var _0x432399=_0x0a11[_0x8550ba];return _0x432399;};'use strict';exports[_0x10a1('0x0')]={'queue':{'type':_0x10a1('0x1'),'required':!![]},'interface':{'type':_0x10a1('0x1'),'required':!![]},'membername':{'type':_0x10a1('0x1'),'required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':_0x10a1('0x2'),'required':![]}};exports[_0x10a1('0x3')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x10a1('0x1'),'required':!![]}};exports[_0x10a1('0x4')]={'interface':{'type':_0x10a1('0x1'),'required':!![]},'paused':{'type':'boolean'},'reason':{'type':_0x10a1('0x1'),'required':![]}};exports[_0x10a1('0x5')]={'module':{'type':_0x10a1('0x1'),'required':![]}};exports[_0x10a1('0x6')]={'uniqueid':{'type':_0x10a1('0x1'),'required':!![]}};exports[_0x10a1('0x7')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0x10a1('0x1')},'format':{'type':_0x10a1('0x1')},'mixmonitorid':{'type':'string'}};exports['voicequeuechannelhangup']={'uniqueid':{'type':'string','required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0x10a1('0x1'),'required':!![]},'exten':{'type':_0x10a1('0x1'),'required':!![]},'context':{'type':'string'}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 56fae9f..4670acb 100644 --- a/server/services/ami/realtime/index.js +++ b/server/services/ami/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['initCampaignHopperHistory','merge','initFaxAccounts','initVoiceQueues','exports','lodash','moment','util','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/faxAccount','agents','telephones','voiceQueues','templates','outbound','channels','queueChannels','outboundChannels','timers','settings','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','name','isNil','interface','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','total','answered','unmanaged','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundRejectCallsDay','queueStatusComplete','prototype','mergeFromDatabase','length','isUndefined','initTelephones','SIP/%s','trunks','initTriggers','triggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','abandoned','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions'];(function(_0x4c5fe3,_0x2dcebe){var _0x588076=function(_0x6f51d2){while(--_0x6f51d2){_0x4c5fe3['push'](_0x4c5fe3['shift']());}};_0x588076(++_0x2dcebe);}(_0x5f2f,0x73));var _0xf5f2=function(_0x48bf52,_0x8c4a24){_0x48bf52=_0x48bf52-0x0;var _0x78d6a6=_0x5f2f[_0x48bf52];return _0x78d6a6;};'use strict';var _=require(_0xf5f2('0x0'));var moment=require(_0xf5f2('0x1'));var util=require(_0xf5f2('0x2'));var Agent=require(_0xf5f2('0x3'));var Telephone=require(_0xf5f2('0x4'));var Trunk=require(_0xf5f2('0x5'));var VoiceQueue=require(_0xf5f2('0x6'));var Trigger=require(_0xf5f2('0x7'));var Template=require('../model/template');var Campaign=require('../model/campaign');var VoiceExtension=require(_0xf5f2('0x8'));var ZendeskAccount=require(_0xf5f2('0x9'));var SalesforceAccount=require(_0xf5f2('0xa'));var FreshdeskAccount=require(_0xf5f2('0xb'));var SugarcrmAccount=require(_0xf5f2('0xc'));var ZohoAccount=require(_0xf5f2('0xd'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0xf5f2('0xe'));var ServicenowAccount=require(_0xf5f2('0xf'));var Dynamics365Account=require(_0xf5f2('0x10'));var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0xf5f2('0x11'));function Realtime(){this[_0xf5f2('0x12')]={};this[_0xf5f2('0x13')]={};this['trunks']={};this[_0xf5f2('0x14')]={};this['triggers']={};this['campaigns']={};this[_0xf5f2('0x15')]={};this[_0xf5f2('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0xf5f2('0x17')]={};this[_0xf5f2('0x18')]={};this[_0xf5f2('0x19')]={};this[_0xf5f2('0x1a')]={};this[_0xf5f2('0x1b')]={};this[_0xf5f2('0x1c')]={};this['salesforceAccounts']={};this[_0xf5f2('0x1d')]={};this[_0xf5f2('0x1e')]={};this[_0xf5f2('0x1f')]={};this[_0xf5f2('0x20')]={};this[_0xf5f2('0x21')]={};this['servicenowAccounts']={};this[_0xf5f2('0x22')]={};this[_0xf5f2('0x23')]={};this[_0xf5f2('0x24')]={};}function freeIsNotKey(_0x1b6dd2,_0x23e23a,_0x3a9dbb){var _0xdb61b3=_[_0xf5f2('0x25')](_0x1b6dd2,function(_0x11f702){return _0x11f702[_0x3a9dbb];});for(var _0x228ace in _0x23e23a){if(_0x23e23a[_0xf5f2('0x26')](_0x228ace)){if(!_0xdb61b3[_0x228ace]){delete _0x23e23a[_0x228ace];}}}}function freeIsNotKeySip(_0x28e097,_0x4ff59b){var _0x3ee69=_[_0xf5f2('0x25')](_0x28e097,function(_0x626999){return util[_0xf5f2('0x27')]('SIP/%s',_0x626999[_0xf5f2('0x28')]);});for(var _0x47101e in _0x4ff59b){if(_0x4ff59b['hasOwnProperty'](_0x47101e)){if(!_0x3ee69[_0x47101e]){delete _0x4ff59b[_0x47101e];}}}}function freeIsNotKeyAgent(_0x47acfc,_0x2d2805){var _0x388e6c=_['mapKeys'](_0x47acfc,function(_0x45b74f){var _0x170042=_[_0xf5f2('0x29')](_0x45b74f[_0xf5f2('0x2a')])?util[_0xf5f2('0x27')]('SIP/%s',_0x45b74f[_0xf5f2('0x28')]):_0x45b74f[_0xf5f2('0x2a')];return _0x170042;});for(var _0x4e8bda in _0x2d2805){if(_0x2d2805[_0xf5f2('0x26')](_0x4e8bda)){if(!_0x388e6c[_0x4e8bda]){delete _0x2d2805[_0x4e8bda];}}}}function clearVoiceCallReports(_0x287ad5){_0x287ad5['total']=0x0;_0x287ad5['answered']=0x0;_0x287ad5[_0xf5f2('0x2b')]=0x0;_0x287ad5[_0xf5f2('0x2c')]=0x0;_0x287ad5[_0xf5f2('0x2d')]=0x0;}function clearCampaigns(_0x1a5bb3){if(!_[_0xf5f2('0x2e')](_0x1a5bb3)){for(var _0x788a8d in _0x1a5bb3){if(_0x1a5bb3[_0xf5f2('0x26')](_0x788a8d)){_0x1a5bb3[_0x788a8d][_0xf5f2('0x2f')]=0x0;_0x1a5bb3[_0x788a8d][_0xf5f2('0x30')]=0x0;}}}}function clearVoiceQueues(_0x4ab014){if(!_[_0xf5f2('0x2e')](_0x4ab014)){for(var _0x102449 in _0x4ab014){if(_0x4ab014[_0xf5f2('0x26')](_0x102449)){_0x4ab014[_0x102449][_0xf5f2('0x31')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x32')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x33')]=0x0;_0x4ab014[_0x102449]['abandoned']=0x0;_0x4ab014[_0x102449]['sumHoldTime']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x2c')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x2d')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x34')]=0x0;_0x4ab014[_0x102449]['outboundNoAnswerCallsDay']=0x0;_0x4ab014[_0x102449]['outboundBusyCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x35')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x36')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x37')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x38')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x39')]=0x0;_0x4ab014[_0x102449]['outboundBlacklistCallsDay']=0x0;_0x4ab014[_0x102449]['outboundOriginateFailureCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x3a')]=0x0;_0x4ab014[_0x102449]['outboundReCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x34')]=0x0;_0x4ab014[_0x102449]['outboundAnswerCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x3b')]=!![];}}}}Realtime[_0xf5f2('0x3c')][_0xf5f2('0x3d')]=function(_0x428770,_0x256bd9){for(var _0x277eee in _0x256bd9){if(_0x428770[_0xf5f2('0x26')](_0x277eee)){_0x428770[_0x277eee]=_0x256bd9[_0x277eee];}}};Realtime[_0xf5f2('0x3c')]['initAgents']=function(){var _0x4149e6=this;return function(_0x43e4ff){if(_0x43e4ff){freeIsNotKeyAgent(_0x43e4ff,_0x4149e6[_0xf5f2('0x12')]);for(var _0x43c77d=0x0,_0x1408b9={};_0x43c77d<_0x43e4ff[_0xf5f2('0x3e')];_0x43c77d+=0x1){_0x1408b9=_0x43e4ff[_0x43c77d];var _0x297c0c=_['isNil'](_0x1408b9[_0xf5f2('0x2a')])?util[_0xf5f2('0x27')]('SIP/%s',_0x1408b9[_0xf5f2('0x28')]):_0x1408b9['interface'];if(_[_0xf5f2('0x3f')](_0x4149e6[_0xf5f2('0x12')][_0x297c0c])){_0x4149e6[_0xf5f2('0x12')][_0x297c0c]=new Agent(_0x1408b9);}else{_0x4149e6[_0xf5f2('0x3d')](_0x4149e6['agents'][_0x297c0c],_0x1408b9);}}}return _0x4149e6['agents'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x40')]=function(){var _0x20eb74=this;return function(_0x4ec8fb){if(_0x4ec8fb){freeIsNotKeySip(_0x4ec8fb,_0x20eb74[_0xf5f2('0x13')]);for(var _0x4f7f80=0x0,_0x9da533={};_0x4f7f80<_0x4ec8fb['length'];_0x4f7f80+=0x1){_0x9da533=_0x4ec8fb[_0x4f7f80];if(_[_0xf5f2('0x3f')](_0x20eb74[_0xf5f2('0x13')][util['format'](_0xf5f2('0x41'),_0x9da533[_0xf5f2('0x28')])])){_0x20eb74[_0xf5f2('0x13')][util[_0xf5f2('0x27')]('SIP/%s',_0x9da533['name'])]=new Telephone(_0x9da533);}else{_0x20eb74[_0xf5f2('0x3d')](_0x20eb74[_0xf5f2('0x13')][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x9da533[_0xf5f2('0x28')])],_0x9da533);}}}return _0x20eb74[_0xf5f2('0x13')];};};Realtime[_0xf5f2('0x3c')]['initTrunks']=function(){var _0x110fe5=this;return function(_0x3b4ea6){if(_0x3b4ea6){freeIsNotKeySip(_0x3b4ea6,_0x110fe5['trunks']);for(var _0xc6a1ae=0x0,_0x3f3895={};_0xc6a1ae<_0x3b4ea6[_0xf5f2('0x3e')];_0xc6a1ae+=0x1){_0x3f3895=_0x3b4ea6[_0xc6a1ae];if(_[_0xf5f2('0x3f')](_0x110fe5[_0xf5f2('0x42')][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])])){_0x110fe5['trunks'][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])]=new Trunk(_0x3f3895);}else{_0x110fe5['mergeFromDatabase'](_0x110fe5['trunks'][util['format'](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])],_0x3f3895);}}}return _0x110fe5['trunks'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x43')]=function(){var _0x28e33f=this;return function(_0x31f86c){if(_0x31f86c){freeIsNotKey(_0x31f86c,_0x28e33f[_0xf5f2('0x44')],'id');for(var _0x2b3b1c=0x0,_0x1a6ec1={};_0x2b3b1c<_0x31f86c[_0xf5f2('0x3e')];_0x2b3b1c+=0x1){_0x1a6ec1=_0x31f86c[_0x2b3b1c];if(_[_0xf5f2('0x3f')](_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']])){_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']]=new Trigger(_0x1a6ec1);}else{_0x28e33f[_0xf5f2('0x3d')](_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']],_0x1a6ec1);}}}return _0x28e33f[_0xf5f2('0x44')];};};Realtime['prototype'][_0xf5f2('0x45')]=function(){var _0x578c93=this;return function(_0x3d62c1){if(_0x3d62c1){freeIsNotKey(_0x3d62c1,_0x578c93[_0xf5f2('0x15')],'id');for(var _0x218def=0x0,_0x36a4b0={};_0x218def<_0x3d62c1[_0xf5f2('0x3e')];_0x218def+=0x1){_0x36a4b0=_0x3d62c1[_0x218def];if(_[_0xf5f2('0x3f')](_0x578c93['templates'][_0x36a4b0['id']])){_0x578c93[_0xf5f2('0x15')][_0x36a4b0['id']]=new Template(_0x36a4b0);}else{_0x578c93[_0xf5f2('0x3d')](_0x578c93[_0xf5f2('0x15')][_0x36a4b0['id']],_0x36a4b0);}}}return _0x578c93[_0xf5f2('0x15')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x46')]=function(){var _0xf638ff=this;return function(_0x297f07){if(_0x297f07){freeIsNotKey(_0x297f07,_0xf638ff['zendeskAccounts'],'id');for(var _0x35dece=0x0,_0x33ec29={};_0x35dece<_0x297f07[_0xf5f2('0x3e')];_0x35dece+=0x1){_0x33ec29=_0x297f07[_0x35dece];if(_['isUndefined'](_0xf638ff[_0xf5f2('0x1c')][_0x33ec29['id']])){_0xf638ff[_0xf5f2('0x1c')][_0x33ec29['id']]=new ZendeskAccount(_0x33ec29);}else{_0xf638ff[_0xf5f2('0x3d')](_0xf638ff['zendeskAccounts'][_0x33ec29['id']],_0x33ec29);}}}return _0xf638ff['zendeskAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x47')]=function(){var _0x5db519=this;return function(_0x14aa81){if(_0x14aa81){freeIsNotKey(_0x14aa81,_0x5db519['salesforceAccounts'],'id');for(var _0x740321=0x0,_0x497eb8={};_0x740321<_0x14aa81[_0xf5f2('0x3e')];_0x740321+=0x1){_0x497eb8=_0x14aa81[_0x740321];if(_['isUndefined'](_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']])){_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']]=new SalesforceAccount(_0x497eb8);}else{_0x5db519[_0xf5f2('0x3d')](_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']],_0x497eb8);}}}return _0x5db519['salesforceAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x49')]=function(){var _0x4f6b01=this;return function(_0x58213b){if(_0x58213b){freeIsNotKey(_0x58213b,_0x4f6b01[_0xf5f2('0x1e')],'id');for(var _0x3dc0c4=0x0,_0x57782c={};_0x3dc0c4<_0x58213b[_0xf5f2('0x3e')];_0x3dc0c4+=0x1){_0x57782c=_0x58213b[_0x3dc0c4];if(_[_0xf5f2('0x3f')](_0x4f6b01[_0xf5f2('0x1e')][_0x57782c['id']])){_0x4f6b01[_0xf5f2('0x1e')][_0x57782c['id']]=new FreshdeskAccount(_0x57782c);}else{_0x4f6b01['mergeFromDatabase'](_0x4f6b01['freshdeskAccounts'][_0x57782c['id']],_0x57782c);}}}return _0x4f6b01[_0xf5f2('0x1e')];};};Realtime[_0xf5f2('0x3c')]['initZohoAccounts']=function(){var _0x40eef=this;return function(_0x43fc49){if(_0x43fc49){freeIsNotKey(_0x43fc49,_0x40eef[_0xf5f2('0x1f')],'id');for(var _0x14029e=0x0,_0x2b038e={};_0x14029e<_0x43fc49[_0xf5f2('0x3e')];_0x14029e+=0x1){_0x2b038e=_0x43fc49[_0x14029e];if(_[_0xf5f2('0x3f')](_0x40eef['zohoAccounts'][_0x2b038e['id']])){_0x40eef['zohoAccounts'][_0x2b038e['id']]=new ZohoAccount(_0x2b038e);}else{_0x40eef[_0xf5f2('0x3d')](_0x40eef[_0xf5f2('0x1f')][_0x2b038e['id']],_0x2b038e);}}}return _0x40eef[_0xf5f2('0x1f')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x4a')]=function(){var _0x5a861d=this;return function(_0xdb1106){if(_0xdb1106){freeIsNotKey(_0xdb1106,_0x5a861d[_0xf5f2('0x20')],'id');for(var _0x18b124=0x0,_0x519c24={};_0x18b124<_0xdb1106[_0xf5f2('0x3e')];_0x18b124+=0x1){_0x519c24=_0xdb1106[_0x18b124];if(_['isUndefined'](_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']])){_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']]=new DeskAccount(_0x519c24);}else{_0x5a861d[_0xf5f2('0x3d')](_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']],_0x519c24);}}}return _0x5a861d['deskAccounts'];};};Realtime['prototype'][_0xf5f2('0x4b')]=function(){var _0x4de303=this;return function(_0xa39c65){if(_0xa39c65){freeIsNotKey(_0xa39c65,_0x4de303[_0xf5f2('0x1d')],'id');for(var _0x572ec1=0x0,_0x3f0579={};_0x572ec1<_0xa39c65[_0xf5f2('0x3e')];_0x572ec1+=0x1){_0x3f0579=_0xa39c65[_0x572ec1];if(_[_0xf5f2('0x3f')](_0x4de303['sugarcrmAccounts'][_0x3f0579['id']])){_0x4de303[_0xf5f2('0x1d')][_0x3f0579['id']]=new SugarcrmAccount(_0x3f0579);}else{_0x4de303[_0xf5f2('0x3d')](_0x4de303[_0xf5f2('0x1d')][_0x3f0579['id']],_0x3f0579);}}}return _0x4de303[_0xf5f2('0x1d')];};};Realtime['prototype'][_0xf5f2('0x4c')]=function(){var _0x506fe5=this;return function(_0x2cbe1e){if(_0x2cbe1e){freeIsNotKey(_0x2cbe1e,_0x506fe5[_0xf5f2('0x21')],'id');for(var _0x2e6f5d=0x0,_0x380c08={};_0x2e6f5d<_0x2cbe1e[_0xf5f2('0x3e')];_0x2e6f5d+=0x1){_0x380c08=_0x2cbe1e[_0x2e6f5d];if(_['isUndefined'](_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']])){_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']]=new VtigerAccount(_0x380c08);}else{_0x506fe5[_0xf5f2('0x3d')](_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']],_0x380c08);}}}return _0x506fe5[_0xf5f2('0x21')];};};Realtime['prototype'][_0xf5f2('0x4d')]=function(){var _0x5ee6bc=this;return function(_0x4c96ee){if(_0x4c96ee){freeIsNotKey(_0x4c96ee,_0x5ee6bc[_0xf5f2('0x4e')],'id');for(var _0x4802c5=0x0,_0x10f2b8={};_0x4802c5<_0x4c96ee[_0xf5f2('0x3e')];_0x4802c5+=0x1){_0x10f2b8=_0x4c96ee[_0x4802c5];if(_[_0xf5f2('0x3f')](_0x5ee6bc[_0xf5f2('0x4e')][_0x10f2b8['id']])){_0x5ee6bc['servicenowAccounts'][_0x10f2b8['id']]=new ServicenowAccount(_0x10f2b8);}else{_0x5ee6bc[_0xf5f2('0x3d')](_0x5ee6bc[_0xf5f2('0x4e')][_0x10f2b8['id']],_0x10f2b8);}}}return _0x5ee6bc[_0xf5f2('0x4e')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x4f')]=function(){var _0x35d868=this;return function(_0x158768){if(_0x158768){freeIsNotKey(_0x158768,_0x35d868['dynamics365Accounts'],'id');for(var _0x1f55af=0x0,_0x2d171d={};_0x1f55af<_0x158768[_0xf5f2('0x3e')];_0x1f55af+=0x1){_0x2d171d=_0x158768[_0x1f55af];if(_[_0xf5f2('0x3f')](_0x35d868['dynamics365Accounts'][_0x2d171d['id']])){_0x35d868[_0xf5f2('0x22')][_0x2d171d['id']]=new Dynamics365Account(_0x2d171d);}else{_0x35d868['mergeFromDatabase'](_0x35d868[_0xf5f2('0x22')][_0x2d171d['id']],_0x2d171d);}}}return _0x35d868[_0xf5f2('0x22')];};};Realtime['prototype'][_0xf5f2('0x50')]=function(){var _0x975bd8=this;return function(_0xa0c139){if(_0xa0c139){freeIsNotKey(_0xa0c139,_0x975bd8[_0xf5f2('0x23')],'id');for(var _0x146462=0x0,_0x4bd113={};_0x146462<_0xa0c139[_0xf5f2('0x3e')];_0x146462+=0x1){_0x4bd113=_0xa0c139[_0x146462];if(_[_0xf5f2('0x3f')](_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']])){_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']]=new FreshsalesAccount(_0x4bd113);}else{_0x975bd8[_0xf5f2('0x3d')](_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']],_0x4bd113);}}}return _0x975bd8['freshsalesAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x51')]=function(){var _0x4800fe=this;return function(_0x3f677e){for(var _0x36503c=0x0;_0x36503c<_0x3f677e[_0xf5f2('0x3e')];_0x36503c+=0x1){_['merge'](_0x4800fe['voiceQueues'][_0x3f677e[_0x36503c]['name']],_0x3f677e[_0x36503c]);}return _0x4800fe[_0xf5f2('0x14')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x52')]=function(){var _0x450691=this;return function(_0x55da4d){clearVoiceQueues(_0x450691['voiceQueues']);if(_0x55da4d){_0x55da4d=_[_0xf5f2('0x53')](_0x55da4d,_0xf5f2('0x54'));for(var _0xc10cf3 in _0x55da4d){if(_0x55da4d[_0xf5f2('0x26')](_0xc10cf3)){for(var _0x794e0c=0x0;_0x794e0c<_0x55da4d[_0xc10cf3][_0xf5f2('0x3e')];_0x794e0c+=0x1){var _0x11c302=_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x55')];if(_0x450691[_0xf5f2('0x14')][_0x11c302]){if(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x56')]){_0x450691[_0xf5f2('0x14')][_0x11c302]['unmanaged']+=0x1;}if(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerabandon']){_0x450691['voiceQueues'][_0x11c302][_0xf5f2('0x57')]+=0x1;}_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2b')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x58')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerjoinAt']),_0xf5f2('0x5a'))||0x0;if(_0x794e0c===_0x55da4d[_0xc10cf3][_0xf5f2('0x3e')]-0x1){_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2c')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5b')]||_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerabandonAt']||_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5c')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerjoinAt']),_0xf5f2('0x5a'))||0x0;_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x31')]+=0x1;if(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5d')]){_0x450691['voiceQueues'][_0x11c302][_0xf5f2('0x32')]+=0x1;_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2d')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5b')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerleaveAt']),'seconds')||0x0;}}else{_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2c')]+=_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2b')]||0x0;}}}}}}return _0x450691['voiceQueues'];};};Realtime['prototype'][_0xf5f2('0x5e')]=function(){var _0x4f2fcc=this;return function(_0x4c4420){clearVoiceCallReports(_0x4f2fcc['outbound']);if(_0x4c4420){for(var _0x57cb18=0x0;_0x57cb18<_0x4c4420[_0xf5f2('0x3e')];_0x57cb18+=0x1){_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x31')]+=0x1;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2c')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x5f')];if(_0x4c4420[_0x57cb18][_0xf5f2('0x60')]===_0xf5f2('0x61')){_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x32')]+=0x1;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2b')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x5f')]-_0x4c4420[_0x57cb18][_0xf5f2('0x62')]||0x0;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2d')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x62')];}}}return _0x4f2fcc[_0xf5f2('0x16')];};};Realtime['prototype'][_0xf5f2('0x63')]=function(){var _0x35299d=this;return function(_0x21043b){if(_0x21043b){freeIsNotKey(_0x21043b,_0x35299d[_0xf5f2('0x64')],_0xf5f2('0x28'));for(var _0x308220=0x0,_0x16491c={};_0x308220<_0x21043b[_0xf5f2('0x3e')];_0x308220+=0x1){_0x16491c=_0x21043b[_0x308220];if(_['isUndefined'](_0x35299d[_0xf5f2('0x64')][_0x16491c['name']])){_0x35299d['campaigns'][_0x16491c['name']]=new Campaign(_0x16491c);}else{_0x35299d['mergeFromDatabase'](_0x35299d['campaigns'][_0x16491c['name']],_0x16491c);_0x35299d[_0xf5f2('0x64')][_0x16491c[_0xf5f2('0x28')]][_0xf5f2('0x65')]=_0x16491c[_0xf5f2('0x66')]?_0x16491c[_0xf5f2('0x66')][_0xf5f2('0x28')]:undefined;}}}return _0x35299d['campaigns'];};};Realtime['prototype'][_0xf5f2('0x67')]=function(){var _0x578a22=this;return function(_0x418ece){if(_0x418ece){freeIsNotKey(_0x418ece,_0x578a22[_0xf5f2('0x68')],'id');for(var _0x59161c=0x0,_0x4f3ad4={};_0x59161c<_0x418ece[_0xf5f2('0x3e')];_0x59161c+=0x1){_0x4f3ad4=_0x418ece[_0x59161c];if(_[_0xf5f2('0x3f')](_0x578a22['voiceExtensions'][_0x4f3ad4['id']])){_0x578a22[_0xf5f2('0x68')][_0x4f3ad4['id']]=new VoiceExtension(_0x4f3ad4);}else{_0x578a22[_0xf5f2('0x3d')](_0x578a22['voiceExtensions'][_0x4f3ad4['id']],_0x4f3ad4);}}}return _0x578a22[_0xf5f2('0x68')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x69')]=function(){var _0x4c1678=this;return function(_0x33e9ad){clearCampaigns(_0x4c1678[_0xf5f2('0x64')]);for(var _0x14db86=0x0;_0x14db86<_0x33e9ad[_0xf5f2('0x3e')];_0x14db86+=0x1){_[_0xf5f2('0x6a')](_0x4c1678[_0xf5f2('0x64')][_0x33e9ad[_0x14db86][_0xf5f2('0x28')]],_0x33e9ad[_0x14db86]);}return _0x4c1678[_0xf5f2('0x64')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x6b')]=function(){var _0x191af3=this;return function(_0x2601aa){if(_0x2601aa){freeIsNotKey(_0x2601aa,_0x191af3[_0xf5f2('0x24')],'id');for(var _0x407dd8=0x0,_0xe900ea={};_0x407dd8<_0x2601aa[_0xf5f2('0x3e')];_0x407dd8+=0x1){_0xe900ea=_0x2601aa[_0x407dd8];if(_[_0xf5f2('0x3f')](_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']])){_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']]=new FaxAccount(_0xe900ea);}else{_0x191af3[_0xf5f2('0x3d')](_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']],_0xe900ea);}}}return _0x191af3['faxAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x6c')]=function(){var _0x5d6c6e=this;return function(_0x2e49ce){if(_0x2e49ce){freeIsNotKey(_0x2e49ce,_0x5d6c6e[_0xf5f2('0x14')],'name');for(var _0xb56304=0x0,_0x2f54eb={};_0xb56304<_0x2e49ce[_0xf5f2('0x3e')];_0xb56304+=0x1){_0x2f54eb=_0x2e49ce[_0xb56304];if(_['isUndefined'](_0x5d6c6e['voiceQueues'][_0x2f54eb[_0xf5f2('0x28')]])){_0x5d6c6e[_0xf5f2('0x14')][_0x2f54eb[_0xf5f2('0x28')]]=new VoiceQueue(_0x2f54eb);}else{_0x5d6c6e['mergeFromDatabase'](_0x5d6c6e['voiceQueues'][_0x2f54eb[_0xf5f2('0x28')]],_0x2f54eb);}}}return _0x5d6c6e[_0xf5f2('0x14')];};};module[_0xf5f2('0x6d')]=Realtime; \ No newline at end of file +var _0x5f2f=['initCampaignHopperHistory','merge','initFaxAccounts','initVoiceQueues','exports','lodash','moment','util','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/faxAccount','agents','telephones','voiceQueues','templates','outbound','channels','queueChannels','outboundChannels','timers','settings','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','name','isNil','interface','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','total','answered','unmanaged','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundRejectCallsDay','queueStatusComplete','prototype','mergeFromDatabase','length','isUndefined','initTelephones','SIP/%s','trunks','initTriggers','triggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','abandoned','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions'];(function(_0x2da1ef,_0x4c0fbd){var _0x5900a4=function(_0x51212c){while(--_0x51212c){_0x2da1ef['push'](_0x2da1ef['shift']());}};_0x5900a4(++_0x4c0fbd);}(_0x5f2f,0x73));var _0xf5f2=function(_0x37ec3f,_0x843273){_0x37ec3f=_0x37ec3f-0x0;var _0x2051ab=_0x5f2f[_0x37ec3f];return _0x2051ab;};'use strict';var _=require(_0xf5f2('0x0'));var moment=require(_0xf5f2('0x1'));var util=require(_0xf5f2('0x2'));var Agent=require(_0xf5f2('0x3'));var Telephone=require(_0xf5f2('0x4'));var Trunk=require(_0xf5f2('0x5'));var VoiceQueue=require(_0xf5f2('0x6'));var Trigger=require(_0xf5f2('0x7'));var Template=require('../model/template');var Campaign=require('../model/campaign');var VoiceExtension=require(_0xf5f2('0x8'));var ZendeskAccount=require(_0xf5f2('0x9'));var SalesforceAccount=require(_0xf5f2('0xa'));var FreshdeskAccount=require(_0xf5f2('0xb'));var SugarcrmAccount=require(_0xf5f2('0xc'));var ZohoAccount=require(_0xf5f2('0xd'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0xf5f2('0xe'));var ServicenowAccount=require(_0xf5f2('0xf'));var Dynamics365Account=require(_0xf5f2('0x10'));var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0xf5f2('0x11'));function Realtime(){this[_0xf5f2('0x12')]={};this[_0xf5f2('0x13')]={};this['trunks']={};this[_0xf5f2('0x14')]={};this['triggers']={};this['campaigns']={};this[_0xf5f2('0x15')]={};this[_0xf5f2('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0xf5f2('0x17')]={};this[_0xf5f2('0x18')]={};this[_0xf5f2('0x19')]={};this[_0xf5f2('0x1a')]={};this[_0xf5f2('0x1b')]={};this[_0xf5f2('0x1c')]={};this['salesforceAccounts']={};this[_0xf5f2('0x1d')]={};this[_0xf5f2('0x1e')]={};this[_0xf5f2('0x1f')]={};this[_0xf5f2('0x20')]={};this[_0xf5f2('0x21')]={};this['servicenowAccounts']={};this[_0xf5f2('0x22')]={};this[_0xf5f2('0x23')]={};this[_0xf5f2('0x24')]={};}function freeIsNotKey(_0x1b6dd2,_0x23e23a,_0x3a9dbb){var _0xdb61b3=_[_0xf5f2('0x25')](_0x1b6dd2,function(_0x11f702){return _0x11f702[_0x3a9dbb];});for(var _0x228ace in _0x23e23a){if(_0x23e23a[_0xf5f2('0x26')](_0x228ace)){if(!_0xdb61b3[_0x228ace]){delete _0x23e23a[_0x228ace];}}}}function freeIsNotKeySip(_0x28e097,_0x4ff59b){var _0x3ee69=_[_0xf5f2('0x25')](_0x28e097,function(_0x626999){return util[_0xf5f2('0x27')]('SIP/%s',_0x626999[_0xf5f2('0x28')]);});for(var _0x47101e in _0x4ff59b){if(_0x4ff59b['hasOwnProperty'](_0x47101e)){if(!_0x3ee69[_0x47101e]){delete _0x4ff59b[_0x47101e];}}}}function freeIsNotKeyAgent(_0x47acfc,_0x2d2805){var _0x388e6c=_['mapKeys'](_0x47acfc,function(_0x45b74f){var _0x170042=_[_0xf5f2('0x29')](_0x45b74f[_0xf5f2('0x2a')])?util[_0xf5f2('0x27')]('SIP/%s',_0x45b74f[_0xf5f2('0x28')]):_0x45b74f[_0xf5f2('0x2a')];return _0x170042;});for(var _0x4e8bda in _0x2d2805){if(_0x2d2805[_0xf5f2('0x26')](_0x4e8bda)){if(!_0x388e6c[_0x4e8bda]){delete _0x2d2805[_0x4e8bda];}}}}function clearVoiceCallReports(_0x287ad5){_0x287ad5['total']=0x0;_0x287ad5['answered']=0x0;_0x287ad5[_0xf5f2('0x2b')]=0x0;_0x287ad5[_0xf5f2('0x2c')]=0x0;_0x287ad5[_0xf5f2('0x2d')]=0x0;}function clearCampaigns(_0x1a5bb3){if(!_[_0xf5f2('0x2e')](_0x1a5bb3)){for(var _0x788a8d in _0x1a5bb3){if(_0x1a5bb3[_0xf5f2('0x26')](_0x788a8d)){_0x1a5bb3[_0x788a8d][_0xf5f2('0x2f')]=0x0;_0x1a5bb3[_0x788a8d][_0xf5f2('0x30')]=0x0;}}}}function clearVoiceQueues(_0x4ab014){if(!_[_0xf5f2('0x2e')](_0x4ab014)){for(var _0x102449 in _0x4ab014){if(_0x4ab014[_0xf5f2('0x26')](_0x102449)){_0x4ab014[_0x102449][_0xf5f2('0x31')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x32')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x33')]=0x0;_0x4ab014[_0x102449]['abandoned']=0x0;_0x4ab014[_0x102449]['sumHoldTime']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x2c')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x2d')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x34')]=0x0;_0x4ab014[_0x102449]['outboundNoAnswerCallsDay']=0x0;_0x4ab014[_0x102449]['outboundBusyCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x35')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x36')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x37')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x38')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x39')]=0x0;_0x4ab014[_0x102449]['outboundBlacklistCallsDay']=0x0;_0x4ab014[_0x102449]['outboundOriginateFailureCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x3a')]=0x0;_0x4ab014[_0x102449]['outboundReCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x34')]=0x0;_0x4ab014[_0x102449]['outboundAnswerCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x3b')]=!![];}}}}Realtime[_0xf5f2('0x3c')][_0xf5f2('0x3d')]=function(_0x428770,_0x256bd9){for(var _0x277eee in _0x256bd9){if(_0x428770[_0xf5f2('0x26')](_0x277eee)){_0x428770[_0x277eee]=_0x256bd9[_0x277eee];}}};Realtime[_0xf5f2('0x3c')]['initAgents']=function(){var _0x4149e6=this;return function(_0x43e4ff){if(_0x43e4ff){freeIsNotKeyAgent(_0x43e4ff,_0x4149e6[_0xf5f2('0x12')]);for(var _0x43c77d=0x0,_0x1408b9={};_0x43c77d<_0x43e4ff[_0xf5f2('0x3e')];_0x43c77d+=0x1){_0x1408b9=_0x43e4ff[_0x43c77d];var _0x297c0c=_['isNil'](_0x1408b9[_0xf5f2('0x2a')])?util[_0xf5f2('0x27')]('SIP/%s',_0x1408b9[_0xf5f2('0x28')]):_0x1408b9['interface'];if(_[_0xf5f2('0x3f')](_0x4149e6[_0xf5f2('0x12')][_0x297c0c])){_0x4149e6[_0xf5f2('0x12')][_0x297c0c]=new Agent(_0x1408b9);}else{_0x4149e6[_0xf5f2('0x3d')](_0x4149e6['agents'][_0x297c0c],_0x1408b9);}}}return _0x4149e6['agents'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x40')]=function(){var _0x20eb74=this;return function(_0x4ec8fb){if(_0x4ec8fb){freeIsNotKeySip(_0x4ec8fb,_0x20eb74[_0xf5f2('0x13')]);for(var _0x4f7f80=0x0,_0x9da533={};_0x4f7f80<_0x4ec8fb['length'];_0x4f7f80+=0x1){_0x9da533=_0x4ec8fb[_0x4f7f80];if(_[_0xf5f2('0x3f')](_0x20eb74[_0xf5f2('0x13')][util['format'](_0xf5f2('0x41'),_0x9da533[_0xf5f2('0x28')])])){_0x20eb74[_0xf5f2('0x13')][util[_0xf5f2('0x27')]('SIP/%s',_0x9da533['name'])]=new Telephone(_0x9da533);}else{_0x20eb74[_0xf5f2('0x3d')](_0x20eb74[_0xf5f2('0x13')][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x9da533[_0xf5f2('0x28')])],_0x9da533);}}}return _0x20eb74[_0xf5f2('0x13')];};};Realtime[_0xf5f2('0x3c')]['initTrunks']=function(){var _0x110fe5=this;return function(_0x3b4ea6){if(_0x3b4ea6){freeIsNotKeySip(_0x3b4ea6,_0x110fe5['trunks']);for(var _0xc6a1ae=0x0,_0x3f3895={};_0xc6a1ae<_0x3b4ea6[_0xf5f2('0x3e')];_0xc6a1ae+=0x1){_0x3f3895=_0x3b4ea6[_0xc6a1ae];if(_[_0xf5f2('0x3f')](_0x110fe5[_0xf5f2('0x42')][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])])){_0x110fe5['trunks'][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])]=new Trunk(_0x3f3895);}else{_0x110fe5['mergeFromDatabase'](_0x110fe5['trunks'][util['format'](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])],_0x3f3895);}}}return _0x110fe5['trunks'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x43')]=function(){var _0x28e33f=this;return function(_0x31f86c){if(_0x31f86c){freeIsNotKey(_0x31f86c,_0x28e33f[_0xf5f2('0x44')],'id');for(var _0x2b3b1c=0x0,_0x1a6ec1={};_0x2b3b1c<_0x31f86c[_0xf5f2('0x3e')];_0x2b3b1c+=0x1){_0x1a6ec1=_0x31f86c[_0x2b3b1c];if(_[_0xf5f2('0x3f')](_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']])){_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']]=new Trigger(_0x1a6ec1);}else{_0x28e33f[_0xf5f2('0x3d')](_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']],_0x1a6ec1);}}}return _0x28e33f[_0xf5f2('0x44')];};};Realtime['prototype'][_0xf5f2('0x45')]=function(){var _0x578c93=this;return function(_0x3d62c1){if(_0x3d62c1){freeIsNotKey(_0x3d62c1,_0x578c93[_0xf5f2('0x15')],'id');for(var _0x218def=0x0,_0x36a4b0={};_0x218def<_0x3d62c1[_0xf5f2('0x3e')];_0x218def+=0x1){_0x36a4b0=_0x3d62c1[_0x218def];if(_[_0xf5f2('0x3f')](_0x578c93['templates'][_0x36a4b0['id']])){_0x578c93[_0xf5f2('0x15')][_0x36a4b0['id']]=new Template(_0x36a4b0);}else{_0x578c93[_0xf5f2('0x3d')](_0x578c93[_0xf5f2('0x15')][_0x36a4b0['id']],_0x36a4b0);}}}return _0x578c93[_0xf5f2('0x15')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x46')]=function(){var _0xf638ff=this;return function(_0x297f07){if(_0x297f07){freeIsNotKey(_0x297f07,_0xf638ff['zendeskAccounts'],'id');for(var _0x35dece=0x0,_0x33ec29={};_0x35dece<_0x297f07[_0xf5f2('0x3e')];_0x35dece+=0x1){_0x33ec29=_0x297f07[_0x35dece];if(_['isUndefined'](_0xf638ff[_0xf5f2('0x1c')][_0x33ec29['id']])){_0xf638ff[_0xf5f2('0x1c')][_0x33ec29['id']]=new ZendeskAccount(_0x33ec29);}else{_0xf638ff[_0xf5f2('0x3d')](_0xf638ff['zendeskAccounts'][_0x33ec29['id']],_0x33ec29);}}}return _0xf638ff['zendeskAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x47')]=function(){var _0x5db519=this;return function(_0x14aa81){if(_0x14aa81){freeIsNotKey(_0x14aa81,_0x5db519['salesforceAccounts'],'id');for(var _0x740321=0x0,_0x497eb8={};_0x740321<_0x14aa81[_0xf5f2('0x3e')];_0x740321+=0x1){_0x497eb8=_0x14aa81[_0x740321];if(_['isUndefined'](_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']])){_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']]=new SalesforceAccount(_0x497eb8);}else{_0x5db519[_0xf5f2('0x3d')](_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']],_0x497eb8);}}}return _0x5db519['salesforceAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x49')]=function(){var _0x4f6b01=this;return function(_0x58213b){if(_0x58213b){freeIsNotKey(_0x58213b,_0x4f6b01[_0xf5f2('0x1e')],'id');for(var _0x3dc0c4=0x0,_0x57782c={};_0x3dc0c4<_0x58213b[_0xf5f2('0x3e')];_0x3dc0c4+=0x1){_0x57782c=_0x58213b[_0x3dc0c4];if(_[_0xf5f2('0x3f')](_0x4f6b01[_0xf5f2('0x1e')][_0x57782c['id']])){_0x4f6b01[_0xf5f2('0x1e')][_0x57782c['id']]=new FreshdeskAccount(_0x57782c);}else{_0x4f6b01['mergeFromDatabase'](_0x4f6b01['freshdeskAccounts'][_0x57782c['id']],_0x57782c);}}}return _0x4f6b01[_0xf5f2('0x1e')];};};Realtime[_0xf5f2('0x3c')]['initZohoAccounts']=function(){var _0x40eef=this;return function(_0x43fc49){if(_0x43fc49){freeIsNotKey(_0x43fc49,_0x40eef[_0xf5f2('0x1f')],'id');for(var _0x14029e=0x0,_0x2b038e={};_0x14029e<_0x43fc49[_0xf5f2('0x3e')];_0x14029e+=0x1){_0x2b038e=_0x43fc49[_0x14029e];if(_[_0xf5f2('0x3f')](_0x40eef['zohoAccounts'][_0x2b038e['id']])){_0x40eef['zohoAccounts'][_0x2b038e['id']]=new ZohoAccount(_0x2b038e);}else{_0x40eef[_0xf5f2('0x3d')](_0x40eef[_0xf5f2('0x1f')][_0x2b038e['id']],_0x2b038e);}}}return _0x40eef[_0xf5f2('0x1f')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x4a')]=function(){var _0x5a861d=this;return function(_0xdb1106){if(_0xdb1106){freeIsNotKey(_0xdb1106,_0x5a861d[_0xf5f2('0x20')],'id');for(var _0x18b124=0x0,_0x519c24={};_0x18b124<_0xdb1106[_0xf5f2('0x3e')];_0x18b124+=0x1){_0x519c24=_0xdb1106[_0x18b124];if(_['isUndefined'](_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']])){_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']]=new DeskAccount(_0x519c24);}else{_0x5a861d[_0xf5f2('0x3d')](_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']],_0x519c24);}}}return _0x5a861d['deskAccounts'];};};Realtime['prototype'][_0xf5f2('0x4b')]=function(){var _0x4de303=this;return function(_0xa39c65){if(_0xa39c65){freeIsNotKey(_0xa39c65,_0x4de303[_0xf5f2('0x1d')],'id');for(var _0x572ec1=0x0,_0x3f0579={};_0x572ec1<_0xa39c65[_0xf5f2('0x3e')];_0x572ec1+=0x1){_0x3f0579=_0xa39c65[_0x572ec1];if(_[_0xf5f2('0x3f')](_0x4de303['sugarcrmAccounts'][_0x3f0579['id']])){_0x4de303[_0xf5f2('0x1d')][_0x3f0579['id']]=new SugarcrmAccount(_0x3f0579);}else{_0x4de303[_0xf5f2('0x3d')](_0x4de303[_0xf5f2('0x1d')][_0x3f0579['id']],_0x3f0579);}}}return _0x4de303[_0xf5f2('0x1d')];};};Realtime['prototype'][_0xf5f2('0x4c')]=function(){var _0x506fe5=this;return function(_0x2cbe1e){if(_0x2cbe1e){freeIsNotKey(_0x2cbe1e,_0x506fe5[_0xf5f2('0x21')],'id');for(var _0x2e6f5d=0x0,_0x380c08={};_0x2e6f5d<_0x2cbe1e[_0xf5f2('0x3e')];_0x2e6f5d+=0x1){_0x380c08=_0x2cbe1e[_0x2e6f5d];if(_['isUndefined'](_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']])){_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']]=new VtigerAccount(_0x380c08);}else{_0x506fe5[_0xf5f2('0x3d')](_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']],_0x380c08);}}}return _0x506fe5[_0xf5f2('0x21')];};};Realtime['prototype'][_0xf5f2('0x4d')]=function(){var _0x5ee6bc=this;return function(_0x4c96ee){if(_0x4c96ee){freeIsNotKey(_0x4c96ee,_0x5ee6bc[_0xf5f2('0x4e')],'id');for(var _0x4802c5=0x0,_0x10f2b8={};_0x4802c5<_0x4c96ee[_0xf5f2('0x3e')];_0x4802c5+=0x1){_0x10f2b8=_0x4c96ee[_0x4802c5];if(_[_0xf5f2('0x3f')](_0x5ee6bc[_0xf5f2('0x4e')][_0x10f2b8['id']])){_0x5ee6bc['servicenowAccounts'][_0x10f2b8['id']]=new ServicenowAccount(_0x10f2b8);}else{_0x5ee6bc[_0xf5f2('0x3d')](_0x5ee6bc[_0xf5f2('0x4e')][_0x10f2b8['id']],_0x10f2b8);}}}return _0x5ee6bc[_0xf5f2('0x4e')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x4f')]=function(){var _0x35d868=this;return function(_0x158768){if(_0x158768){freeIsNotKey(_0x158768,_0x35d868['dynamics365Accounts'],'id');for(var _0x1f55af=0x0,_0x2d171d={};_0x1f55af<_0x158768[_0xf5f2('0x3e')];_0x1f55af+=0x1){_0x2d171d=_0x158768[_0x1f55af];if(_[_0xf5f2('0x3f')](_0x35d868['dynamics365Accounts'][_0x2d171d['id']])){_0x35d868[_0xf5f2('0x22')][_0x2d171d['id']]=new Dynamics365Account(_0x2d171d);}else{_0x35d868['mergeFromDatabase'](_0x35d868[_0xf5f2('0x22')][_0x2d171d['id']],_0x2d171d);}}}return _0x35d868[_0xf5f2('0x22')];};};Realtime['prototype'][_0xf5f2('0x50')]=function(){var _0x975bd8=this;return function(_0xa0c139){if(_0xa0c139){freeIsNotKey(_0xa0c139,_0x975bd8[_0xf5f2('0x23')],'id');for(var _0x146462=0x0,_0x4bd113={};_0x146462<_0xa0c139[_0xf5f2('0x3e')];_0x146462+=0x1){_0x4bd113=_0xa0c139[_0x146462];if(_[_0xf5f2('0x3f')](_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']])){_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']]=new FreshsalesAccount(_0x4bd113);}else{_0x975bd8[_0xf5f2('0x3d')](_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']],_0x4bd113);}}}return _0x975bd8['freshsalesAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x51')]=function(){var _0x4800fe=this;return function(_0x3f677e){for(var _0x36503c=0x0;_0x36503c<_0x3f677e[_0xf5f2('0x3e')];_0x36503c+=0x1){_['merge'](_0x4800fe['voiceQueues'][_0x3f677e[_0x36503c]['name']],_0x3f677e[_0x36503c]);}return _0x4800fe[_0xf5f2('0x14')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x52')]=function(){var _0x450691=this;return function(_0x55da4d){clearVoiceQueues(_0x450691['voiceQueues']);if(_0x55da4d){_0x55da4d=_[_0xf5f2('0x53')](_0x55da4d,_0xf5f2('0x54'));for(var _0xc10cf3 in _0x55da4d){if(_0x55da4d[_0xf5f2('0x26')](_0xc10cf3)){for(var _0x794e0c=0x0;_0x794e0c<_0x55da4d[_0xc10cf3][_0xf5f2('0x3e')];_0x794e0c+=0x1){var _0x11c302=_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x55')];if(_0x450691[_0xf5f2('0x14')][_0x11c302]){if(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x56')]){_0x450691[_0xf5f2('0x14')][_0x11c302]['unmanaged']+=0x1;}if(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerabandon']){_0x450691['voiceQueues'][_0x11c302][_0xf5f2('0x57')]+=0x1;}_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2b')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x58')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerjoinAt']),_0xf5f2('0x5a'))||0x0;if(_0x794e0c===_0x55da4d[_0xc10cf3][_0xf5f2('0x3e')]-0x1){_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2c')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5b')]||_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerabandonAt']||_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5c')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerjoinAt']),_0xf5f2('0x5a'))||0x0;_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x31')]+=0x1;if(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5d')]){_0x450691['voiceQueues'][_0x11c302][_0xf5f2('0x32')]+=0x1;_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2d')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5b')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerleaveAt']),'seconds')||0x0;}}else{_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2c')]+=_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2b')]||0x0;}}}}}}return _0x450691['voiceQueues'];};};Realtime['prototype'][_0xf5f2('0x5e')]=function(){var _0x4f2fcc=this;return function(_0x4c4420){clearVoiceCallReports(_0x4f2fcc['outbound']);if(_0x4c4420){for(var _0x57cb18=0x0;_0x57cb18<_0x4c4420[_0xf5f2('0x3e')];_0x57cb18+=0x1){_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x31')]+=0x1;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2c')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x5f')];if(_0x4c4420[_0x57cb18][_0xf5f2('0x60')]===_0xf5f2('0x61')){_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x32')]+=0x1;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2b')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x5f')]-_0x4c4420[_0x57cb18][_0xf5f2('0x62')]||0x0;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2d')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x62')];}}}return _0x4f2fcc[_0xf5f2('0x16')];};};Realtime['prototype'][_0xf5f2('0x63')]=function(){var _0x35299d=this;return function(_0x21043b){if(_0x21043b){freeIsNotKey(_0x21043b,_0x35299d[_0xf5f2('0x64')],_0xf5f2('0x28'));for(var _0x308220=0x0,_0x16491c={};_0x308220<_0x21043b[_0xf5f2('0x3e')];_0x308220+=0x1){_0x16491c=_0x21043b[_0x308220];if(_['isUndefined'](_0x35299d[_0xf5f2('0x64')][_0x16491c['name']])){_0x35299d['campaigns'][_0x16491c['name']]=new Campaign(_0x16491c);}else{_0x35299d['mergeFromDatabase'](_0x35299d['campaigns'][_0x16491c['name']],_0x16491c);_0x35299d[_0xf5f2('0x64')][_0x16491c[_0xf5f2('0x28')]][_0xf5f2('0x65')]=_0x16491c[_0xf5f2('0x66')]?_0x16491c[_0xf5f2('0x66')][_0xf5f2('0x28')]:undefined;}}}return _0x35299d['campaigns'];};};Realtime['prototype'][_0xf5f2('0x67')]=function(){var _0x578a22=this;return function(_0x418ece){if(_0x418ece){freeIsNotKey(_0x418ece,_0x578a22[_0xf5f2('0x68')],'id');for(var _0x59161c=0x0,_0x4f3ad4={};_0x59161c<_0x418ece[_0xf5f2('0x3e')];_0x59161c+=0x1){_0x4f3ad4=_0x418ece[_0x59161c];if(_[_0xf5f2('0x3f')](_0x578a22['voiceExtensions'][_0x4f3ad4['id']])){_0x578a22[_0xf5f2('0x68')][_0x4f3ad4['id']]=new VoiceExtension(_0x4f3ad4);}else{_0x578a22[_0xf5f2('0x3d')](_0x578a22['voiceExtensions'][_0x4f3ad4['id']],_0x4f3ad4);}}}return _0x578a22[_0xf5f2('0x68')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x69')]=function(){var _0x4c1678=this;return function(_0x33e9ad){clearCampaigns(_0x4c1678[_0xf5f2('0x64')]);for(var _0x14db86=0x0;_0x14db86<_0x33e9ad[_0xf5f2('0x3e')];_0x14db86+=0x1){_[_0xf5f2('0x6a')](_0x4c1678[_0xf5f2('0x64')][_0x33e9ad[_0x14db86][_0xf5f2('0x28')]],_0x33e9ad[_0x14db86]);}return _0x4c1678[_0xf5f2('0x64')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x6b')]=function(){var _0x191af3=this;return function(_0x2601aa){if(_0x2601aa){freeIsNotKey(_0x2601aa,_0x191af3[_0xf5f2('0x24')],'id');for(var _0x407dd8=0x0,_0xe900ea={};_0x407dd8<_0x2601aa[_0xf5f2('0x3e')];_0x407dd8+=0x1){_0xe900ea=_0x2601aa[_0x407dd8];if(_[_0xf5f2('0x3f')](_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']])){_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']]=new FaxAccount(_0xe900ea);}else{_0x191af3[_0xf5f2('0x3d')](_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']],_0xe900ea);}}}return _0x191af3['faxAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x6c')]=function(){var _0x5d6c6e=this;return function(_0x2e49ce){if(_0x2e49ce){freeIsNotKey(_0x2e49ce,_0x5d6c6e[_0xf5f2('0x14')],'name');for(var _0xb56304=0x0,_0x2f54eb={};_0xb56304<_0x2e49ce[_0xf5f2('0x3e')];_0xb56304+=0x1){_0x2f54eb=_0x2e49ce[_0xb56304];if(_['isUndefined'](_0x5d6c6e['voiceQueues'][_0x2f54eb[_0xf5f2('0x28')]])){_0x5d6c6e[_0xf5f2('0x14')][_0x2f54eb[_0xf5f2('0x28')]]=new VoiceQueue(_0x2f54eb);}else{_0x5d6c6e['mergeFromDatabase'](_0x5d6c6e['voiceQueues'][_0x2f54eb[_0xf5f2('0x28')]],_0x2f54eb);}}}return _0x5d6c6e[_0xf5f2('0x14')];};};module[_0xf5f2('0x6d')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index adf6466..7e48451 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 _0x9e38=['hasOwnProperty','mergeDBDataToRealtime'];(function(_0x25bad6,_0x13e776){var _0x4ab3c2=function(_0x3e508e){while(--_0x3e508e){_0x25bad6['push'](_0x25bad6['shift']());}};_0x4ab3c2(++_0x13e776);}(_0x9e38,0xc8));var _0x89e3=function(_0x1b51ea,_0x394fd9){_0x1b51ea=_0x1b51ea-0x0;var _0x18bbdc=_0x9e38[_0x1b51ea];return _0x18bbdc;};'use strict';function mergeDBDataToRealtime(_0x3656c6,_0x1b55ee){var _0x391dc5=Object['assign']({},_0x3656c6);for(var _0x4b6e6f in _0x1b55ee){if(_0x391dc5[_0x89e3('0x0')](_0x4b6e6f)){_0x391dc5[_0x4b6e6f]=_0x1b55ee[_0x4b6e6f];}}return _0x391dc5;}exports[_0x89e3('0x1')]=mergeDBDataToRealtime; \ No newline at end of file +var _0x0802=['assign','mergeDBDataToRealtime'];(function(_0x4c2bdc,_0x5915d7){var _0x5a3222=function(_0x2262dd){while(--_0x2262dd){_0x4c2bdc['push'](_0x4c2bdc['shift']());}};_0x5a3222(++_0x5915d7);}(_0x0802,0xe0));var _0x2080=function(_0x2ff769,_0x34155a){_0x2ff769=_0x2ff769-0x0;var _0x1dfaa7=_0x0802[_0x2ff769];return _0x1dfaa7;};'use strict';function mergeDBDataToRealtime(_0x2a0693,_0xb38db1){var _0x4b6b19=Object[_0x2080('0x0')]({},_0x2a0693);for(var _0x2f1e7a in _0xb38db1){if(_0x4b6b19['hasOwnProperty'](_0x2f1e7a)){_0x4b6b19[_0x2f1e7a]=_0xb38db1[_0x2f1e7a];}}return _0x4b6b19;}exports[_0x2080('0x1')]=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 84a63f9..8994e62 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 _0x20e9=['from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridpreview','originatecalleridnum','destinationchannel','disposition','ANSWERED','transfers','linkedid','transfereelinkedid','uniqueid','getCallType','UserId','membername','monitors','monitorFilename','filename','createdAt','exten','calleridname','connectedlinename','xcally-motion-dialer','forEach','voiceDialReport','startsWith','Local','indexOf','mobile','lastIndexOf','transfererlinkedid','exports','lodash','util','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','agents','telephones','prototype','realtime','xdr','disabled','custom:voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','voiceAgentReport','custom:voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','isNil','interface','name','voiceQueueReport','length','connectedlinenum','lastAssignedTo','format','SIP/%s','queuecallercomplete','queuecallercompleteAt','queuecallerexitAt','create','getAgentByInternal','keys','channel','split','calleridnum','outbound','internal','destination','type','dialer','lastapplication','queue','lastdata','context'];(function(_0x1344d6,_0x2181e6){var _0xf45b24=function(_0x2d90c1){while(--_0x2d90c1){_0x1344d6['push'](_0x1344d6['shift']());}};_0xf45b24(++_0x2181e6);}(_0x20e9,0xdd));var _0x920e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0x20e9[_0x934425];return _0x31d596;};'use strict';var _=require(_0x920e('0x0'));var moment=require('moment');var util=require(_0x920e('0x1'));var config=require('../../../config/environment');var ami=require(_0x920e('0x2'));var RpcVoiceAgentReport=require(_0x920e('0x3'));var RpcVoiceCallReport=require(_0x920e('0x4'));var RpcVoiceDialReport=require(_0x920e('0x5'));var RpcMemberReport=require(_0x920e('0x6'));var RpcVoiceQueueReport=require(_0x920e('0x7'));var RpcVoiceRecording=require(_0x920e('0x8'));var RpcVoiceTransferReport=require(_0x920e('0x9'));var VoiceQueueReport=require(_0x920e('0xa'));var VoiceCallReport=require(_0x920e('0xb'));var VoiceAgentReport=require(_0x920e('0xc'));var VoiceDialReport=require(_0x920e('0xd'));var UserReport=require(_0x920e('0xe'));function Report(_0x1eaa0b){this['realtime']=_0x1eaa0b;this[_0x920e('0xf')]=_0x1eaa0b[_0x920e('0xf')];this[_0x920e('0x10')]=_0x1eaa0b[_0x920e('0x10')];}Report[_0x920e('0x11')]['sync']=function(_0x2a5770){var _0x5685d3=new VoiceQueueReport(this['realtime']);var _0xaa4d89=new VoiceAgentReport(this[_0x920e('0x12')]);var _0x4e999d=new VoiceDialReport(this['realtime']);var _0x3a7e4d=new VoiceCallReport(this[_0x920e('0x12')]);var _0x23c2e5=new UserReport(this[_0x920e('0x12')]);if(config[_0x920e('0x13')]&&config[_0x920e('0x13')][_0x920e('0x14')]){ami['on'](_0x920e('0x15'),this['voiceQueueReport'][_0x920e('0x16')](this));ami['on'](_0x920e('0x17'),this[_0x920e('0x18')][_0x920e('0x16')](this));ami['on']('custom:voiceAgentReport',this[_0x920e('0x19')][_0x920e('0x16')](this));ami['on'](_0x920e('0x1a'),this['voiceDialReport'][_0x920e('0x16')](this));ami['on'](_0x920e('0x1b'),this[_0x920e('0x1c')][_0x920e('0x16')](this));ami['on'](_0x920e('0x1d'),this[_0x920e('0x1e')][_0x920e('0x16')](this));}};Report['prototype'][_0x920e('0x1f')]=function(_0x29efae){var _0x509396;_0x509396=_[_0x920e('0x20')](this[_0x920e('0xf')],function(_0x1b0e3f){return _0x1b0e3f[_0x920e('0x21')]==_0x29efae||_0x1b0e3f['name']==_0x29efae;});if(_[_0x920e('0x22')](_0x509396)){var _0x104d93=_[_0x920e('0x20')](this[_0x920e('0x10')],function(_0x56d8fd){return _0x56d8fd[_0x920e('0x21')]==_0x29efae||_0x56d8fd['name']==_0x29efae;});if(_0x104d93){_0x509396=_[_0x920e('0x20')](this[_0x920e('0xf')],function(_0x158c05){return _0x158c05[_0x920e('0x23')]==util['format']('SIP/%s',_0x104d93[_0x920e('0x24')]);});}}return _0x509396;};Report[_0x920e('0x11')][_0x920e('0x25')]=function(_0x2cf9cb){for(var _0x52767e=0x0;_0x52767e<_0x2cf9cb[_0x920e('0x26')];_0x52767e+=0x1){var _0xe3fc28=this[_0x920e('0x1f')](_0x2cf9cb[_0x52767e][_0x920e('0x27')]);if(_0xe3fc28){_0x2cf9cb[_0x52767e][_0x920e('0x21')]=_0xe3fc28[_0x920e('0x21')];_0x2cf9cb[_0x52767e]['assigned']=!![];_0x2cf9cb[_0x52767e][_0x920e('0x28')]=_0xe3fc28[_0x920e('0x24')];_0x2cf9cb[_0x52767e][_0x920e('0x23')]=_['isNil'](_0xe3fc28[_0x920e('0x23')])?util[_0x920e('0x29')](_0x920e('0x2a'),_0xe3fc28[_0x920e('0x24')]):_0xe3fc28[_0x920e('0x23')];if(_0x2cf9cb[_0x52767e][_0x920e('0x2b')]){_0x2cf9cb[_0x52767e][_0x920e('0x2c')]=moment()[_0x920e('0x29')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x2cf9cb[_0x52767e]['queuecallerexit']){_0x2cf9cb[_0x52767e][_0x920e('0x2d')]=moment()[_0x920e('0x29')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0x920e('0x25')](_0x2cf9cb[_0x52767e]);}RpcVoiceQueueReport[_0x920e('0x2e')](_0x2cf9cb[_0x52767e]);}};function extractCalleridNumber(_0x1cd77e){var _0x3601a9=_0x1cd77e['match'](/<(.*?)>/);return _0x3601a9?_0x3601a9[0x1]:_0x1cd77e;}Report['prototype'][_0x920e('0x2f')]=function(_0x4f7c29){for(var _0x1be040=0x0;_0x1be040',_0x336d80['calleridname'],_0x336d80[_0x920e('0x33')]);}if(RpcVoiceTransferReport[_0x920e('0x46')][_0x336d80[_0x920e('0x47')]]){var _0x42bdfa=RpcVoiceTransferReport[_0x920e('0x46')][_0x336d80[_0x920e('0x47')]];_0x42bdfa[_0x920e('0x48')]=_0x336d80[_0x920e('0x49')];RpcVoiceTransferReport[_0x920e('0x1c')](_0x42bdfa);delete RpcVoiceTransferReport[_0x920e('0x46')][_0x336d80[_0x920e('0x47')]];}if(_[_0x920e('0x22')](_0x336d80['type'])){_0x336d80[_0x920e('0x37')]=this[_0x920e('0x4a')](_0x336d80);}if(_[_0x920e('0x22')](_0x336d80['UserId'])){var _0x316e3c=_0x336d80[_0x920e('0x31')][_0x920e('0x32')]('-')[0x0];var _0x43d0e7=this[_0x920e('0xf')][_0x316e3c];if(!_0x43d0e7)_0x43d0e7=this[_0x920e('0x2f')](_0x336d80[_0x920e('0x21')]);if(_0x43d0e7){_0x336d80[_0x920e('0x4b')]=_0x43d0e7['id'];_0x336d80[_0x920e('0x4c')]=_0x43d0e7[_0x920e('0x24')];}}RpcVoiceCallReport['create'](_0x336d80);if(_0x336d80['monitor']){for(var _0x21ce1e=0x0;_0x21ce1e<_0x336d80[_0x920e('0x4d')][_0x920e('0x26')];_0x21ce1e+=0x1){_0x336d80[_0x920e('0x4e')]=_0x336d80[_0x920e('0x4d')][_0x21ce1e][_0x920e('0x4f')];_0x336d80[_0x920e('0x50')]=_0x336d80['monitors'][_0x21ce1e][_0x920e('0x50')];if(_0x336d80[_0x920e('0x51')]==_0x920e('0x40')){_0x336d80[_0x920e('0x33')]=_0x336d80[_0x920e('0x27')];_0x336d80[_0x920e('0x52')]=_0x336d80['connectedlinename'];_0x336d80['connectedlinenum']=_0x336d80[_0x920e('0x21')];_0x336d80[_0x920e('0x53')]=_0x336d80[_0x920e('0x4c')];_0x336d80[_0x920e('0x51')]=_0x336d80[_0x920e('0x42')];}else if(_0x336d80[_0x920e('0x51')]==_0x920e('0x54')){_0x336d80[_0x920e('0x33')]=_0x336d80[_0x920e('0x36')];_0x336d80['exten']=_0x336d80[_0x920e('0x42')];}RpcVoiceRecording[_0x920e('0x2e')](_0x336d80);}}};Report['prototype'][_0x920e('0x19')]=function(_0x5757ad){if(_['isArray'](_0x5757ad)){_0x5757ad[_0x920e('0x55')](function(_0x408b8f){RpcVoiceAgentReport[_0x920e('0x2e')](_0x408b8f);});}else{RpcVoiceAgentReport[_0x920e('0x2e')](_0x5757ad);}};Report['prototype'][_0x920e('0x56')]=function(_0xa86fdd){RpcVoiceDialReport[_0x920e('0x2e')](_0xa86fdd);var _0x132704;var _0x5ac5a3;var _0xe91634=_0xa86fdd['channel'];if(_[_0x920e('0x57')](_0xe91634,_0x920e('0x58'))){_0x5ac5a3=_0xe91634['substring'](_0xe91634[_0x920e('0x59')]('/')+0x1,_0xe91634[_0x920e('0x59')]('@'));_0x132704=_[_0x920e('0x20')](this['agents'],function(_0x24433a){return _0x24433a[_0x920e('0x5a')]==_0x5ac5a3||_0x24433a['phone']==_0x5ac5a3||_0x24433a[_0x920e('0x21')]==_0x5ac5a3;});}else{_0x5ac5a3=_0xe91634['substring'](_0xe91634['indexOf']('/')+0x1,_0xe91634[_0x920e('0x5b')]('-'));_0x132704=this[_0x920e('0x1f')](_0x5ac5a3);}if(_0x132704){_0xa86fdd[_0x920e('0x23')]=_[_0x920e('0x22')](_0x132704[_0x920e('0x23')])?util['format'](_0x920e('0x2a'),_0x132704[_0x920e('0x24')]):_0x132704[_0x920e('0x23')];_0xa86fdd['membername']=_0x132704[_0x920e('0x24')];_0xa86fdd[_0x920e('0x21')]=_0x132704[_0x920e('0x21')];RpcMemberReport[_0x920e('0x56')](_0xa86fdd);}};Report[_0x920e('0x11')][_0x920e('0x1c')]=function(_0x1d444b){RpcVoiceTransferReport[_0x920e('0x46')][_0x1d444b[_0x920e('0x5c')]]=_0x1d444b;};Report[_0x920e('0x11')][_0x920e('0x1e')]=function(_0x1521f5){RpcVoiceTransferReport[_0x920e('0x1e')](_0x1521f5);};module[_0x920e('0x5d')]=Report; \ No newline at end of file +var _0x014b=['UserId','membername','monitors','monitorFilename','filename','calleridname','voiceAgentReport','forEach','startsWith','Local','substring','indexOf','blindTransfer','transfers','transfererlinkedid','exports','lodash','moment','../../../config/environment','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./userReport','agents','telephones','prototype','sync','realtime','xdr','custom:voiceQueueReport','voiceQueueReport','bind','voiceCallReport','custom:voiceDialReport','voiceDialReport','blindtransfer','attendedtransfer','attendedTransfer','find','name','isNil','accountcode','interface','SIP/%s','length','findAgent','connectedlinenum','assigned','lastAssignedTo','format','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitAt','create','match','getAgentByInternal','keys','getCallType','channel','split','outbound','destination','exten','lastapplication','queue','context','from-voip-provider','callerid','xcally-motion-preview','calleridpreview','originatecalleridnum','destinationchannel','calleridnum','disposition','ANSWERED','linkedid','transfereelinkedid','uniqueid','type'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x014b,0x65));var _0xb014=function(_0x339f54,_0x3ff67e){_0x339f54=_0x339f54-0x0;var _0x23bb0a=_0x014b[_0x339f54];return _0x23bb0a;};'use strict';var _=require(_0xb014('0x0'));var moment=require(_0xb014('0x1'));var util=require('util');var config=require(_0xb014('0x2'));var ami=require('../ami');var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0xb014('0x3'));var RpcVoiceDialReport=require(_0xb014('0x4'));var RpcMemberReport=require(_0xb014('0x5'));var RpcVoiceQueueReport=require(_0xb014('0x6'));var RpcVoiceRecording=require(_0xb014('0x7'));var RpcVoiceTransferReport=require(_0xb014('0x8'));var VoiceQueueReport=require(_0xb014('0x9'));var VoiceCallReport=require(_0xb014('0xa'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0xb014('0xb'));function Report(_0x4555f3){this['realtime']=_0x4555f3;this[_0xb014('0xc')]=_0x4555f3[_0xb014('0xc')];this[_0xb014('0xd')]=_0x4555f3[_0xb014('0xd')];}Report[_0xb014('0xe')][_0xb014('0xf')]=function(_0x122b5a){var _0x33e882=new VoiceQueueReport(this[_0xb014('0x10')]);var _0x3bd00e=new VoiceAgentReport(this['realtime']);var _0x42d63a=new VoiceDialReport(this[_0xb014('0x10')]);var _0x25966f=new VoiceCallReport(this[_0xb014('0x10')]);var _0x29140=new UserReport(this[_0xb014('0x10')]);if(config[_0xb014('0x11')]&&config[_0xb014('0x11')]['disabled']){ami['on'](_0xb014('0x12'),this[_0xb014('0x13')][_0xb014('0x14')](this));ami['on']('custom:voiceCallReport',this[_0xb014('0x15')][_0xb014('0x14')](this));ami['on']('custom:voiceAgentReport',this['voiceAgentReport']['bind'](this));ami['on'](_0xb014('0x16'),this[_0xb014('0x17')][_0xb014('0x14')](this));ami['on'](_0xb014('0x18'),this['blindTransfer']['bind'](this));ami['on'](_0xb014('0x19'),this[_0xb014('0x1a')][_0xb014('0x14')](this));}};Report[_0xb014('0xe')]['findAgent']=function(_0x377a38){var _0x4e9e7d;_0x4e9e7d=_[_0xb014('0x1b')](this[_0xb014('0xc')],function(_0x442361){return _0x442361['accountcode']==_0x377a38||_0x442361[_0xb014('0x1c')]==_0x377a38;});if(_[_0xb014('0x1d')](_0x4e9e7d)){var _0x2c0596=_[_0xb014('0x1b')](this['telephones'],function(_0x115d20){return _0x115d20[_0xb014('0x1e')]==_0x377a38||_0x115d20[_0xb014('0x1c')]==_0x377a38;});if(_0x2c0596){_0x4e9e7d=_[_0xb014('0x1b')](this['agents'],function(_0x931361){return _0x931361[_0xb014('0x1f')]==util['format'](_0xb014('0x20'),_0x2c0596[_0xb014('0x1c')]);});}}return _0x4e9e7d;};Report[_0xb014('0xe')]['voiceQueueReport']=function(_0x36c63d){for(var _0x444c70=0x0;_0x444c70<_0x36c63d[_0xb014('0x21')];_0x444c70+=0x1){var _0x4c6cb2=this[_0xb014('0x22')](_0x36c63d[_0x444c70][_0xb014('0x23')]);if(_0x4c6cb2){_0x36c63d[_0x444c70][_0xb014('0x1e')]=_0x4c6cb2[_0xb014('0x1e')];_0x36c63d[_0x444c70][_0xb014('0x24')]=!![];_0x36c63d[_0x444c70][_0xb014('0x25')]=_0x4c6cb2[_0xb014('0x1c')];_0x36c63d[_0x444c70][_0xb014('0x1f')]=_[_0xb014('0x1d')](_0x4c6cb2[_0xb014('0x1f')])?util[_0xb014('0x26')](_0xb014('0x20'),_0x4c6cb2[_0xb014('0x1c')]):_0x4c6cb2[_0xb014('0x1f')];if(_0x36c63d[_0x444c70][_0xb014('0x27')]){_0x36c63d[_0x444c70][_0xb014('0x28')]=moment()[_0xb014('0x26')](_0xb014('0x29'));}if(_0x36c63d[_0x444c70]['queuecallerexit']){_0x36c63d[_0x444c70][_0xb014('0x2a')]=moment()[_0xb014('0x26')](_0xb014('0x29'));}RpcMemberReport[_0xb014('0x13')](_0x36c63d[_0x444c70]);}RpcVoiceQueueReport[_0xb014('0x2b')](_0x36c63d[_0x444c70]);}};function extractCalleridNumber(_0x56cd18){var _0xabe623=_0x56cd18[_0xb014('0x2c')](/<(.*?)>/);return _0xabe623?_0xabe623[0x1]:_0x56cd18;}Report[_0xb014('0xe')][_0xb014('0x2d')]=function(_0x2cafe1){for(var _0x2d4ee9=0x0;_0x2d4ee9',_0x39a99b['calleridname'],_0x39a99b[_0xb014('0x3e')]);}if(RpcVoiceTransferReport['transfers'][_0x39a99b['linkedid']]){var _0x2b7ec4=RpcVoiceTransferReport['transfers'][_0x39a99b[_0xb014('0x41')]];_0x2b7ec4[_0xb014('0x42')]=_0x39a99b[_0xb014('0x43')];RpcVoiceTransferReport['blindTransfer'](_0x2b7ec4);delete RpcVoiceTransferReport['transfers'][_0x39a99b['linkedid']];}if(_['isNil'](_0x39a99b['type'])){_0x39a99b[_0xb014('0x44')]=this[_0xb014('0x2f')](_0x39a99b);}if(_[_0xb014('0x1d')](_0x39a99b[_0xb014('0x45')])){var _0x27b9c1=_0x39a99b[_0xb014('0x30')][_0xb014('0x31')]('-')[0x0];var _0x4943e7=this[_0xb014('0xc')][_0x27b9c1];if(!_0x4943e7)_0x4943e7=this[_0xb014('0x2d')](_0x39a99b[_0xb014('0x1e')]);if(_0x4943e7){_0x39a99b['UserId']=_0x4943e7['id'];_0x39a99b[_0xb014('0x46')]=_0x4943e7['name'];}}RpcVoiceCallReport['create'](_0x39a99b);if(_0x39a99b['monitor']){for(var _0xc47d6a=0x0;_0xc47d6a<_0x39a99b[_0xb014('0x47')]['length'];_0xc47d6a+=0x1){_0x39a99b[_0xb014('0x48')]=_0x39a99b[_0xb014('0x47')][_0xc47d6a][_0xb014('0x49')];_0x39a99b['createdAt']=_0x39a99b['monitors'][_0xc47d6a]['createdAt'];if(_0x39a99b[_0xb014('0x34')]==_0xb014('0x3a')){_0x39a99b[_0xb014('0x3e')]=_0x39a99b['connectedlinenum'];_0x39a99b[_0xb014('0x4a')]=_0x39a99b['connectedlinename'];_0x39a99b[_0xb014('0x23')]=_0x39a99b['accountcode'];_0x39a99b['connectedlinename']=_0x39a99b[_0xb014('0x46')];_0x39a99b['exten']=_0x39a99b[_0xb014('0x3c')];}else if(_0x39a99b[_0xb014('0x34')]=='xcally-motion-dialer'){_0x39a99b[_0xb014('0x3e')]=_0x39a99b[_0xb014('0x33')];_0x39a99b[_0xb014('0x34')]=_0x39a99b[_0xb014('0x3c')];}RpcVoiceRecording[_0xb014('0x2b')](_0x39a99b);}}};Report['prototype'][_0xb014('0x4b')]=function(_0x4cc6dd){if(_['isArray'](_0x4cc6dd)){_0x4cc6dd[_0xb014('0x4c')](function(_0x16886c){RpcVoiceAgentReport[_0xb014('0x2b')](_0x16886c);});}else{RpcVoiceAgentReport[_0xb014('0x2b')](_0x4cc6dd);}};Report['prototype'][_0xb014('0x17')]=function(_0x101f2e){RpcVoiceDialReport[_0xb014('0x2b')](_0x101f2e);var _0x3a06e2;var _0x4f3302;var _0x53a49f=_0x101f2e['channel'];if(_[_0xb014('0x4d')](_0x53a49f,_0xb014('0x4e'))){_0x4f3302=_0x53a49f[_0xb014('0x4f')](_0x53a49f[_0xb014('0x50')]('/')+0x1,_0x53a49f['indexOf']('@'));_0x3a06e2=_[_0xb014('0x1b')](this['agents'],function(_0x267033){return _0x267033['mobile']==_0x4f3302||_0x267033['phone']==_0x4f3302||_0x267033[_0xb014('0x1e')]==_0x4f3302;});}else{_0x4f3302=_0x53a49f[_0xb014('0x4f')](_0x53a49f[_0xb014('0x50')]('/')+0x1,_0x53a49f['lastIndexOf']('-'));_0x3a06e2=this[_0xb014('0x22')](_0x4f3302);}if(_0x3a06e2){_0x101f2e[_0xb014('0x1f')]=_[_0xb014('0x1d')](_0x3a06e2[_0xb014('0x1f')])?util[_0xb014('0x26')](_0xb014('0x20'),_0x3a06e2[_0xb014('0x1c')]):_0x3a06e2[_0xb014('0x1f')];_0x101f2e[_0xb014('0x46')]=_0x3a06e2[_0xb014('0x1c')];_0x101f2e[_0xb014('0x1e')]=_0x3a06e2[_0xb014('0x1e')];RpcMemberReport[_0xb014('0x17')](_0x101f2e);}};Report[_0xb014('0xe')][_0xb014('0x51')]=function(_0x1880da){RpcVoiceTransferReport[_0xb014('0x52')][_0x1880da[_0xb014('0x53')]]=_0x1880da;};Report['prototype'][_0xb014('0x1a')]=function(_0x3e5a27){RpcVoiceTransferReport[_0xb014('0x1a')](_0x3e5a27);};module[_0xb014('0x54')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index e766ede..8e59413 100644 --- a/server/services/ami/report/userReport.js +++ b/server/services/ami/report/userReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa1a3=['name','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','local','toLowerCase','inuse','stateTime','toNumber','format','telephone:%s','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','trunk:save','startsWith','Local','indexOf','mobile','phone','accountcode','updateStatusRealtime','[userReport][devicestatechange]','peerstatus','peer','registered','address','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','[userReport][peerstatus]','exports','lodash','util','ioredis','bluebird','../../../config/environment','ami','redis','defaults','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','devicestatechange','syncDeviceState','syncPeerStatus','resolve','then','actionSipShowRegistry','catch','error','[userReport][sipshowregistry]','actionDeviceStateList','[userReport][devicestatelist]','inspect','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','syncRealtimeShow','isNotNull','isUndefined','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','username','[userReport][registry]','find','event','actionid','state','debug','[userReport][registry]\x20sending\x20trunk:save\x20event:','trunk:%s'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa1a3,0x1df));var _0x3a1a=function(_0x91e0ea,_0x3ede28){_0x91e0ea=_0x91e0ea-0x0;var _0x1fcadc=_0xa1a3[_0x91e0ea];return _0x1fcadc;};'use strict';var _=require(_0x3a1a('0x0'));var moment=require('moment');var util=require(_0x3a1a('0x1'));var Redis=require(_0x3a1a('0x2'));var BPromise=require(_0x3a1a('0x3'));var config=require(_0x3a1a('0x4'));var logger=require('../../../config/logger')(_0x3a1a('0x5'));var ami=require('../ami');config[_0x3a1a('0x6')]=_[_0x3a1a('0x7')](config[_0x3a1a('0x6')],{'host':_0x3a1a('0x8'),'port':0x18eb});var io=require(_0x3a1a('0x9'))(new Redis(config['redis']));function UserReport(_0x13d8c4){this[_0x3a1a('0xa')]=_0x13d8c4[_0x3a1a('0xa')];this[_0x3a1a('0xb')]=_0x13d8c4[_0x3a1a('0xb')];this['telephones']=_0x13d8c4[_0x3a1a('0xc')];ami['on'](_0x3a1a('0xd'),this[_0x3a1a('0xe')][_0x3a1a('0xf')](this));ami['on']('registry',this[_0x3a1a('0xe')]['bind'](this));ami['on'](_0x3a1a('0x10'),this[_0x3a1a('0x11')]['bind'](this));ami['on']('peerstatus',this[_0x3a1a('0x12')][_0x3a1a('0xf')](this));return this['syncRealtimeShow']();}function showSipRegistrations(){Promise[_0x3a1a('0x13')]()[_0x3a1a('0x14')](ami[_0x3a1a('0x15')]())[_0x3a1a('0x16')](function(_0x1e1cd9){logger[_0x3a1a('0x17')](_0x3a1a('0x18'),util['inspect'](_0x1e1cd9,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x3a1a('0x13')]()['then'](ami[_0x3a1a('0x19')]())[_0x3a1a('0x16')](function(_0x594e01){logger[_0x3a1a('0x17')](_0x3a1a('0x1a'),util[_0x3a1a('0x1b')](_0x594e01,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x3a1a('0x13')]()[_0x3a1a('0x14')](ami[_0x3a1a('0x1c')]())[_0x3a1a('0x16')](function(_0x1d0223){logger['error'](_0x3a1a('0x1d'),util[_0x3a1a('0x1b')](_0x1d0223,{'showHidden':![],'depth':null}));});}UserReport[_0x3a1a('0x1e')][_0x3a1a('0x1f')]=function(){setInterval(function(){BPromise[_0x3a1a('0x13')]()[_0x3a1a('0x14')](showSipRegistrations())[_0x3a1a('0x14')](listDeviceStates())[_0x3a1a('0x14')](showPeersStatus());},0x32c8);};UserReport[_0x3a1a('0x1e')][_0x3a1a('0x20')]=function(_0x416748){return _0x416748!==null&&!_[_0x3a1a('0x21')](_0x416748);};UserReport[_0x3a1a('0x1e')][_0x3a1a('0x22')]=function(_0x34dc87,_0x1594e0,_0x17d7bd){io['to'](_0x34dc87)[_0x3a1a('0x22')](_0x1594e0,_0x17d7bd);};UserReport[_0x3a1a('0x1e')][_0x3a1a('0xe')]=function(_0x2a8c0b){try{if(this[_0x3a1a('0x20')](_0x2a8c0b)){logger[_0x3a1a('0x23')](_0x3a1a('0x24'),_0x2a8c0b[_0x3a1a('0x25')],_0x2a8c0b['state']);logger['debug'](_0x3a1a('0x26'),util[_0x3a1a('0x1b')](_0x2a8c0b,{'showHidden':![],'depth':null}));var _0x390923=_[_0x3a1a('0x27')](this['trunks'],{'defaultuser':_0x2a8c0b['username']});if(_0x390923){_0x2a8c0b['stateRegistry']=_0x2a8c0b['state'];_['merge'](_0x390923,_['omit'](_0x2a8c0b,[_0x3a1a('0x28'),_0x3a1a('0x29'),_0x3a1a('0x25'),_0x3a1a('0x2a')]));logger[_0x3a1a('0x2b')](_0x3a1a('0x2c'),util[_0x3a1a('0x1b')](_0x390923,{'showHidden':![],'depth':null}));this[_0x3a1a('0x22')](util['format'](_0x3a1a('0x2d'),_0x390923[_0x3a1a('0x2e')]),'trunk:save',_0x390923);}}}catch(_0x16c8f8){logger['error'](_0x3a1a('0x26'),util[_0x3a1a('0x1b')](_0x16c8f8,{'showHidden':![],'depth':null}));}};UserReport[_0x3a1a('0x1e')]['syncDeviceState']=function(_0x9eefaf){try{if(this[_0x3a1a('0x20')](_0x9eefaf)){logger[_0x3a1a('0x23')](_0x3a1a('0x2f'),_0x9eefaf[_0x3a1a('0x30')],_0x9eefaf[_0x3a1a('0x2a')]);logger[_0x3a1a('0x2b')]('[userReport][devicestatechange]',util[_0x3a1a('0x1b')](_0x9eefaf,{'showHidden':![],'depth':null}));if(this[_0x3a1a('0xb')][_0x9eefaf['device']]){if(!this[_0x3a1a('0xb')][_0x9eefaf[_0x3a1a('0x30')]][_0x3a1a('0x31')]||_0x9eefaf[_0x3a1a('0x2a')][_0x3a1a('0x32')]()==_0x3a1a('0x33')){this['agents'][_0x9eefaf['device']][_0x3a1a('0x31')]=![];if(this[_0x3a1a('0xb')][_0x9eefaf[_0x3a1a('0x30')]][_0x3a1a('0x2a')]!==_0x9eefaf[_0x3a1a('0x2a')][_0x3a1a('0x32')]()){this[_0x3a1a('0xb')][_0x9eefaf['device']][_0x3a1a('0x34')]=_[_0x3a1a('0x35')](moment()[_0x3a1a('0x36')]('x'));}this[_0x3a1a('0xb')][_0x9eefaf['device']][_0x3a1a('0x2a')]=_0x9eefaf[_0x3a1a('0x2a')][_0x3a1a('0x32')]();this[_0x3a1a('0xb')][_0x9eefaf[_0x3a1a('0x30')]]['updateStatusRealtime'](_0x9eefaf);}}else if(this[_0x3a1a('0xc')][_0x9eefaf[_0x3a1a('0x30')]]){if(this[_0x3a1a('0xc')][_0x9eefaf[_0x3a1a('0x30')]][_0x3a1a('0x2a')]!==_0x9eefaf['state'][_0x3a1a('0x32')]()){this[_0x3a1a('0xc')][_0x9eefaf[_0x3a1a('0x30')]][_0x3a1a('0x34')]=_[_0x3a1a('0x35')](moment()['format']('x'));}this[_0x3a1a('0xc')][_0x9eefaf[_0x3a1a('0x30')]][_0x3a1a('0x2a')]=_0x9eefaf[_0x3a1a('0x2a')][_0x3a1a('0x32')]();logger[_0x3a1a('0x2b')]('[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:',util[_0x3a1a('0x1b')](this[_0x3a1a('0xc')][_0x9eefaf[_0x3a1a('0x30')]],{'showHidden':![],'depth':null}));this[_0x3a1a('0x22')](util[_0x3a1a('0x36')](_0x3a1a('0x37'),this[_0x3a1a('0xc')][_0x9eefaf[_0x3a1a('0x30')]][_0x3a1a('0x2e')]),_0x3a1a('0x38'),this[_0x3a1a('0xc')][_0x9eefaf[_0x3a1a('0x30')]]);}else if(this[_0x3a1a('0xa')][_0x9eefaf[_0x3a1a('0x30')]]){if(this['trunks'][_0x9eefaf[_0x3a1a('0x30')]][_0x3a1a('0x2a')]!==_0x9eefaf['state'][_0x3a1a('0x32')]()){this[_0x3a1a('0xa')][_0x9eefaf[_0x3a1a('0x30')]]['stateTime']=_['toNumber'](moment()[_0x3a1a('0x36')]('x'));}this[_0x3a1a('0xa')][_0x9eefaf[_0x3a1a('0x30')]][_0x3a1a('0x2a')]=_0x9eefaf[_0x3a1a('0x2a')][_0x3a1a('0x32')]();logger[_0x3a1a('0x2b')](_0x3a1a('0x39'),util[_0x3a1a('0x1b')](this['trunks'][_0x9eefaf[_0x3a1a('0x30')]],{'showHidden':![],'depth':null}));this[_0x3a1a('0x22')](util['format'](_0x3a1a('0x2d'),this[_0x3a1a('0xa')][_0x9eefaf['device']][_0x3a1a('0x2e')]),_0x3a1a('0x3a'),this[_0x3a1a('0xa')][_0x9eefaf['device']]);}else if(_[_0x3a1a('0x3b')](_0x9eefaf[_0x3a1a('0x30')],_0x3a1a('0x3c'))){var _0x1038b3=_0x9eefaf[_0x3a1a('0x30')];var _0x4f7a3f=_0x1038b3['substring'](_0x1038b3[_0x3a1a('0x3d')]('/')+0x1,_0x1038b3[_0x3a1a('0x3d')]('@'));var _0xcc13c7=_[_0x3a1a('0x27')](this[_0x3a1a('0xb')],function(_0x4cb85e){return _0x4cb85e[_0x3a1a('0x3e')]==_0x4f7a3f||_0x4cb85e[_0x3a1a('0x3f')]==_0x4f7a3f||_0x4cb85e[_0x3a1a('0x40')]==_0x4f7a3f;});if(_0xcc13c7){if(_0xcc13c7['state']!==_0x9eefaf['state'][_0x3a1a('0x32')]()){_0xcc13c7['stateTime']=_['toNumber'](moment()['format']('x'));}_0xcc13c7[_0x3a1a('0x2a')]=_0x9eefaf[_0x3a1a('0x2a')][_0x3a1a('0x32')]();_0xcc13c7[_0x3a1a('0x31')]=!![];_0xcc13c7[_0x3a1a('0x41')](_0x9eefaf);}}}}catch(_0x4add3e){logger[_0x3a1a('0x17')](_0x3a1a('0x42'),util[_0x3a1a('0x1b')](_0x4add3e,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0x3a1a('0x12')]=function(_0x1694bd){try{if(this[_0x3a1a('0x20')](_0x1694bd)&&this[_0x3a1a('0x20')](_0x1694bd[_0x3a1a('0x43')])){logger[_0x3a1a('0x23')]('[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s',_0x1694bd[_0x3a1a('0x44')],_0x1694bd['address'],_0x1694bd[_0x3a1a('0x43')]);logger[_0x3a1a('0x2b')]('[userReport][peerstatus]',util['inspect'](_0x1694bd,{'showHidden':![],'depth':null}));if(this[_0x3a1a('0xb')][_0x1694bd[_0x3a1a('0x44')]]){if(!this[_0x3a1a('0xb')][_0x1694bd[_0x3a1a('0x44')]][_0x3a1a('0x31')]||_0x1694bd['peerstatus'][_0x3a1a('0x32')]()==_0x3a1a('0x45')){this[_0x3a1a('0xb')][_0x1694bd[_0x3a1a('0x44')]]['local']=![];this[_0x3a1a('0xb')][_0x1694bd[_0x3a1a('0x44')]]['status']=_0x1694bd[_0x3a1a('0x43')][_0x3a1a('0x32')]();this[_0x3a1a('0xb')][_0x1694bd[_0x3a1a('0x44')]][_0x3a1a('0x46')]=_0x1694bd['address'];this['agents'][_0x1694bd['peer']][_0x3a1a('0x41')](_0x1694bd);}}else if(this[_0x3a1a('0xc')][_0x1694bd[_0x3a1a('0x44')]]){this[_0x3a1a('0xc')][_0x1694bd[_0x3a1a('0x44')]][_0x3a1a('0x47')]=_0x1694bd[_0x3a1a('0x43')][_0x3a1a('0x32')]();this[_0x3a1a('0xc')][_0x1694bd['peer']][_0x3a1a('0x46')]=_0x1694bd[_0x3a1a('0x46')];logger[_0x3a1a('0x2b')](_0x3a1a('0x48'),util[_0x3a1a('0x1b')](this[_0x3a1a('0xc')][_0x1694bd[_0x3a1a('0x44')]],{'showHidden':![],'depth':null}));this[_0x3a1a('0x22')](util['format'](_0x3a1a('0x37'),this[_0x3a1a('0xc')][_0x1694bd[_0x3a1a('0x44')]][_0x3a1a('0x2e')]),_0x3a1a('0x38'),this[_0x3a1a('0xc')][_0x1694bd[_0x3a1a('0x44')]]);}else if(this['trunks'][_0x1694bd[_0x3a1a('0x44')]]){this['trunks'][_0x1694bd[_0x3a1a('0x44')]][_0x3a1a('0x47')]=_0x1694bd[_0x3a1a('0x43')][_0x3a1a('0x32')]();this[_0x3a1a('0xa')][_0x1694bd[_0x3a1a('0x44')]][_0x3a1a('0x46')]=_0x1694bd[_0x3a1a('0x46')];logger[_0x3a1a('0x2b')]('[userReport][peerstatus]\x20sending\x20trunk:save\x20event:',util[_0x3a1a('0x1b')](this[_0x3a1a('0xa')][_0x1694bd[_0x3a1a('0x44')]],{'showHidden':![],'depth':null}));this[_0x3a1a('0x22')](util[_0x3a1a('0x36')](_0x3a1a('0x2d'),this['trunks'][_0x1694bd[_0x3a1a('0x44')]]['name']),'trunk:save',this['trunks'][_0x1694bd[_0x3a1a('0x44')]]);}}}catch(_0x2d682b){logger[_0x3a1a('0x17')](_0x3a1a('0x49'),util[_0x3a1a('0x1b')](_0x2d682b,{'showHidden':![],'depth':null}));}};module[_0x3a1a('0x4a')]=UserReport; \ No newline at end of file +var _0xb42c=['agents','telephones','registryentry','syncRegistry','bind','registry','devicestatechange','syncDeviceState','peerstatus','resolve','then','actionSipShowRegistry','catch','error','[userReport][sipshowregistry]','inspect','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','isUndefined','isNotNull','info','username','debug','[userReport][registry]','find','state','merge','omit','event','actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:','emit','format','trunk:%s','trunk:save','device','local','inuse','toLowerCase','stateTime','toNumber','updateStatusRealtime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','startsWith','Local','indexOf','mobile','phone','accountcode','[userReport][devicestatechange]','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','address','[userReport][peerstatus]','peer','registered','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','name','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','lodash','moment','util','ioredis','bluebird','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','trunks'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb42c,0xdc));var _0xcb42=function(_0x1506f7,_0x5ad53d){_0x1506f7=_0x1506f7-0x0;var _0x3b32db=_0xb42c[_0x1506f7];return _0x3b32db;};'use strict';var _=require(_0xcb42('0x0'));var moment=require(_0xcb42('0x1'));var util=require(_0xcb42('0x2'));var Redis=require(_0xcb42('0x3'));var BPromise=require(_0xcb42('0x4'));var config=require(_0xcb42('0x5'));var logger=require(_0xcb42('0x6'))(_0xcb42('0x7'));var ami=require(_0xcb42('0x8'));config[_0xcb42('0x9')]=_[_0xcb42('0xa')](config[_0xcb42('0x9')],{'host':_0xcb42('0xb'),'port':0x18eb});var io=require(_0xcb42('0xc'))(new Redis(config[_0xcb42('0x9')]));function UserReport(_0x470cbe){this[_0xcb42('0xd')]=_0x470cbe['trunks'];this[_0xcb42('0xe')]=_0x470cbe[_0xcb42('0xe')];this[_0xcb42('0xf')]=_0x470cbe[_0xcb42('0xf')];ami['on'](_0xcb42('0x10'),this[_0xcb42('0x11')][_0xcb42('0x12')](this));ami['on'](_0xcb42('0x13'),this['syncRegistry'][_0xcb42('0x12')](this));ami['on'](_0xcb42('0x14'),this[_0xcb42('0x15')]['bind'](this));ami['on'](_0xcb42('0x16'),this['syncPeerStatus'][_0xcb42('0x12')](this));return this['syncRealtimeShow']();}function showSipRegistrations(){Promise[_0xcb42('0x17')]()[_0xcb42('0x18')](ami[_0xcb42('0x19')]())[_0xcb42('0x1a')](function(_0x47d0f5){logger[_0xcb42('0x1b')](_0xcb42('0x1c'),util[_0xcb42('0x1d')](_0x47d0f5,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise['resolve']()[_0xcb42('0x18')](ami['actionDeviceStateList']())[_0xcb42('0x1a')](function(_0x80664){logger[_0xcb42('0x1b')]('[userReport][devicestatelist]',util[_0xcb42('0x1d')](_0x80664,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0xcb42('0x17')]()[_0xcb42('0x18')](ami[_0xcb42('0x1e')]())[_0xcb42('0x1a')](function(_0x4d66fd){logger[_0xcb42('0x1b')](_0xcb42('0x1f'),util[_0xcb42('0x1d')](_0x4d66fd,{'showHidden':![],'depth':null}));});}UserReport[_0xcb42('0x20')]['syncRealtimeShow']=function(){setInterval(function(){BPromise[_0xcb42('0x17')]()[_0xcb42('0x18')](showSipRegistrations())['then'](listDeviceStates())[_0xcb42('0x18')](showPeersStatus());},0x32c8);};UserReport[_0xcb42('0x20')]['isNotNull']=function(_0x420de3){return _0x420de3!==null&&!_[_0xcb42('0x21')](_0x420de3);};UserReport[_0xcb42('0x20')]['emit']=function(_0x38f363,_0x24f0ff,_0x957662){io['to'](_0x38f363)['emit'](_0x24f0ff,_0x957662);};UserReport[_0xcb42('0x20')]['syncRegistry']=function(_0x3167a1){try{if(this[_0xcb42('0x22')](_0x3167a1)){logger[_0xcb42('0x23')]('[userReport][registry]\x20registry:%s\x20state:%s',_0x3167a1[_0xcb42('0x24')],_0x3167a1['state']);logger[_0xcb42('0x25')](_0xcb42('0x26'),util[_0xcb42('0x1d')](_0x3167a1,{'showHidden':![],'depth':null}));var _0x228a7b=_[_0xcb42('0x27')](this[_0xcb42('0xd')],{'defaultuser':_0x3167a1[_0xcb42('0x24')]});if(_0x228a7b){_0x3167a1['stateRegistry']=_0x3167a1[_0xcb42('0x28')];_[_0xcb42('0x29')](_0x228a7b,_[_0xcb42('0x2a')](_0x3167a1,[_0xcb42('0x2b'),_0xcb42('0x2c'),_0xcb42('0x24'),_0xcb42('0x28')]));logger[_0xcb42('0x25')](_0xcb42('0x2d'),util[_0xcb42('0x1d')](_0x228a7b,{'showHidden':![],'depth':null}));this[_0xcb42('0x2e')](util[_0xcb42('0x2f')](_0xcb42('0x30'),_0x228a7b['name']),_0xcb42('0x31'),_0x228a7b);}}}catch(_0x30472e){logger[_0xcb42('0x1b')]('[userReport][registry]',util[_0xcb42('0x1d')](_0x30472e,{'showHidden':![],'depth':null}));}};UserReport[_0xcb42('0x20')]['syncDeviceState']=function(_0x5ea94d){try{if(this[_0xcb42('0x22')](_0x5ea94d)){logger[_0xcb42('0x23')]('[userReport][devicestatechange]\x20device:%s\x20state:%s',_0x5ea94d[_0xcb42('0x32')],_0x5ea94d[_0xcb42('0x28')]);logger[_0xcb42('0x25')]('[userReport][devicestatechange]',util['inspect'](_0x5ea94d,{'showHidden':![],'depth':null}));if(this[_0xcb42('0xe')][_0x5ea94d[_0xcb42('0x32')]]){if(!this['agents'][_0x5ea94d[_0xcb42('0x32')]][_0xcb42('0x33')]||_0x5ea94d[_0xcb42('0x28')]['toLowerCase']()==_0xcb42('0x34')){this['agents'][_0x5ea94d[_0xcb42('0x32')]][_0xcb42('0x33')]=![];if(this['agents'][_0x5ea94d[_0xcb42('0x32')]]['state']!==_0x5ea94d[_0xcb42('0x28')][_0xcb42('0x35')]()){this[_0xcb42('0xe')][_0x5ea94d[_0xcb42('0x32')]][_0xcb42('0x36')]=_[_0xcb42('0x37')](moment()['format']('x'));}this['agents'][_0x5ea94d[_0xcb42('0x32')]][_0xcb42('0x28')]=_0x5ea94d['state'][_0xcb42('0x35')]();this['agents'][_0x5ea94d[_0xcb42('0x32')]][_0xcb42('0x38')](_0x5ea94d);}}else if(this['telephones'][_0x5ea94d[_0xcb42('0x32')]]){if(this[_0xcb42('0xf')][_0x5ea94d['device']][_0xcb42('0x28')]!==_0x5ea94d[_0xcb42('0x28')][_0xcb42('0x35')]()){this[_0xcb42('0xf')][_0x5ea94d[_0xcb42('0x32')]][_0xcb42('0x36')]=_['toNumber'](moment()[_0xcb42('0x2f')]('x'));}this[_0xcb42('0xf')][_0x5ea94d[_0xcb42('0x32')]][_0xcb42('0x28')]=_0x5ea94d['state'][_0xcb42('0x35')]();logger[_0xcb42('0x25')](_0xcb42('0x39'),util[_0xcb42('0x1d')](this[_0xcb42('0xf')][_0x5ea94d['device']],{'showHidden':![],'depth':null}));this[_0xcb42('0x2e')](util[_0xcb42('0x2f')](_0xcb42('0x3a'),this[_0xcb42('0xf')][_0x5ea94d[_0xcb42('0x32')]]['name']),_0xcb42('0x3b'),this[_0xcb42('0xf')][_0x5ea94d['device']]);}else if(this[_0xcb42('0xd')][_0x5ea94d[_0xcb42('0x32')]]){if(this[_0xcb42('0xd')][_0x5ea94d['device']][_0xcb42('0x28')]!==_0x5ea94d[_0xcb42('0x28')][_0xcb42('0x35')]()){this['trunks'][_0x5ea94d[_0xcb42('0x32')]][_0xcb42('0x36')]=_[_0xcb42('0x37')](moment()[_0xcb42('0x2f')]('x'));}this[_0xcb42('0xd')][_0x5ea94d[_0xcb42('0x32')]][_0xcb42('0x28')]=_0x5ea94d[_0xcb42('0x28')][_0xcb42('0x35')]();logger[_0xcb42('0x25')](_0xcb42('0x3c'),util[_0xcb42('0x1d')](this['trunks'][_0x5ea94d[_0xcb42('0x32')]],{'showHidden':![],'depth':null}));this['emit'](util[_0xcb42('0x2f')](_0xcb42('0x30'),this[_0xcb42('0xd')][_0x5ea94d[_0xcb42('0x32')]]['name']),_0xcb42('0x31'),this['trunks'][_0x5ea94d[_0xcb42('0x32')]]);}else if(_[_0xcb42('0x3d')](_0x5ea94d[_0xcb42('0x32')],_0xcb42('0x3e'))){var _0x148539=_0x5ea94d[_0xcb42('0x32')];var _0x4843bd=_0x148539['substring'](_0x148539['indexOf']('/')+0x1,_0x148539[_0xcb42('0x3f')]('@'));var _0x216cb7=_[_0xcb42('0x27')](this[_0xcb42('0xe')],function(_0x4c6722){return _0x4c6722[_0xcb42('0x40')]==_0x4843bd||_0x4c6722[_0xcb42('0x41')]==_0x4843bd||_0x4c6722[_0xcb42('0x42')]==_0x4843bd;});if(_0x216cb7){if(_0x216cb7[_0xcb42('0x28')]!==_0x5ea94d['state']['toLowerCase']()){_0x216cb7['stateTime']=_['toNumber'](moment()[_0xcb42('0x2f')]('x'));}_0x216cb7[_0xcb42('0x28')]=_0x5ea94d[_0xcb42('0x28')][_0xcb42('0x35')]();_0x216cb7[_0xcb42('0x33')]=!![];_0x216cb7[_0xcb42('0x38')](_0x5ea94d);}}}}catch(_0x1f404d){logger[_0xcb42('0x1b')](_0xcb42('0x43'),util[_0xcb42('0x1d')](_0x1f404d,{'showHidden':![],'depth':null}));}};UserReport['prototype']['syncPeerStatus']=function(_0x2c5421){try{if(this[_0xcb42('0x22')](_0x2c5421)&&this[_0xcb42('0x22')](_0x2c5421[_0xcb42('0x16')])){logger['info'](_0xcb42('0x44'),_0x2c5421['peer'],_0x2c5421[_0xcb42('0x45')],_0x2c5421[_0xcb42('0x16')]);logger[_0xcb42('0x25')](_0xcb42('0x46'),util[_0xcb42('0x1d')](_0x2c5421,{'showHidden':![],'depth':null}));if(this[_0xcb42('0xe')][_0x2c5421['peer']]){if(!this['agents'][_0x2c5421[_0xcb42('0x47')]][_0xcb42('0x33')]||_0x2c5421[_0xcb42('0x16')][_0xcb42('0x35')]()==_0xcb42('0x48')){this['agents'][_0x2c5421[_0xcb42('0x47')]][_0xcb42('0x33')]=![];this[_0xcb42('0xe')][_0x2c5421[_0xcb42('0x47')]][_0xcb42('0x49')]=_0x2c5421[_0xcb42('0x16')]['toLowerCase']();this[_0xcb42('0xe')][_0x2c5421[_0xcb42('0x47')]][_0xcb42('0x45')]=_0x2c5421['address'];this[_0xcb42('0xe')][_0x2c5421[_0xcb42('0x47')]][_0xcb42('0x38')](_0x2c5421);}}else if(this[_0xcb42('0xf')][_0x2c5421['peer']]){this[_0xcb42('0xf')][_0x2c5421['peer']][_0xcb42('0x49')]=_0x2c5421[_0xcb42('0x16')][_0xcb42('0x35')]();this['telephones'][_0x2c5421[_0xcb42('0x47')]][_0xcb42('0x45')]=_0x2c5421['address'];logger['debug'](_0xcb42('0x4a'),util[_0xcb42('0x1d')](this['telephones'][_0x2c5421['peer']],{'showHidden':![],'depth':null}));this['emit'](util[_0xcb42('0x2f')](_0xcb42('0x3a'),this['telephones'][_0x2c5421[_0xcb42('0x47')]][_0xcb42('0x4b')]),_0xcb42('0x3b'),this[_0xcb42('0xf')][_0x2c5421[_0xcb42('0x47')]]);}else if(this[_0xcb42('0xd')][_0x2c5421[_0xcb42('0x47')]]){this[_0xcb42('0xd')][_0x2c5421['peer']][_0xcb42('0x49')]=_0x2c5421[_0xcb42('0x16')][_0xcb42('0x35')]();this['trunks'][_0x2c5421[_0xcb42('0x47')]][_0xcb42('0x45')]=_0x2c5421[_0xcb42('0x45')];logger[_0xcb42('0x25')](_0xcb42('0x4c'),util[_0xcb42('0x1d')](this[_0xcb42('0xd')][_0x2c5421[_0xcb42('0x47')]],{'showHidden':![],'depth':null}));this[_0xcb42('0x2e')](util[_0xcb42('0x2f')]('trunk:%s',this[_0xcb42('0xd')][_0x2c5421[_0xcb42('0x47')]][_0xcb42('0x4b')]),'trunk:save',this[_0xcb42('0xd')][_0x2c5421['peer']]);}}}catch(_0x1cdf64){logger[_0xcb42('0x1b')](_0xcb42('0x46'),util['inspect'](_0x1cdf64,{'showHidden':![],'depth':null}));}};module[_0xcb42('0x4d')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 2b592c3..306f2fe 100644 --- a/server/services/ami/report/voiceAgentReport.js +++ b/server/services/ami/report/voiceAgentReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x72d9=['info','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','pick','name','exten','custom:agentconnect','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','answeredelsewheremembername','answered_elsewhere','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]\x20Else\x20path\x20should\x20never\x20be\x20taken','[%s][voiceAgentReport][agentconnect]','syncAgentRingNoAnswer','[%s][voiceAgentReport][agentringnoanswer]\x20event:','agentringnoanswerAt','reason','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','user:agentringnoanswer','custom:agentringnoanswer','error','[%s][voiceAgentReport][queuecallerabandon]\x20event:','hasOwnProperty','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','agent','talktime','acw','acwtime','acwTimeout','agentacw','interface','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','destaccountcode','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','keys','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','variable','[%s][voiceAgentReport][varset]','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','isNil','includes','transfer','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','values','custom:voiceAgentReport','deleteChannelAfterTimeout','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstop]','lodash','moment','util','../../../config/logger','ami','redis','localhost','channels','voiceChannels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','agentconnect','bind','agentringnoanswer','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncAttendedTransfer','syncBlindTransfer','emit','prototype','isNotNull','isUndefined','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','destuniqueid','queue','YYYY-MM-DD\x20HH:mm:ss','mandatoryDisposition','type','inbound','voice','assign','omit','event','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','calleridnum','debug','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','format','user:%s','user:called','[%s][voiceAgentReport][agentcalled]','syncAgentConnect'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x72d9,0x19c));var _0x972d=function(_0x9fd887,_0x47f76c){_0x9fd887=_0x9fd887-0x0;var _0x1a54ab=_0x72d9[_0x9fd887];return _0x1a54ab;};'use strict';var _=require(_0x972d('0x0'));var moment=require(_0x972d('0x1'));var util=require(_0x972d('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x972d('0x3'))(_0x972d('0x4'));var ami=require('../ami');config[_0x972d('0x5')]=_['defaults'](config[_0x972d('0x5')],{'host':_0x972d('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x972d('0x5')]));function VoiceAgentReport(_0x4ad382){this[_0x972d('0x7')]={};this[_0x972d('0x8')]=_0x4ad382['channels'];this[_0x972d('0x9')]=_0x4ad382['voiceQueues'];this['agents']=_0x4ad382[_0x972d('0xa')];this[_0x972d('0xb')]={};ami['on'](_0x972d('0xc'),this[_0x972d('0xd')]['bind'](this));ami['on'](_0x972d('0xe'),this['syncAgentConnect'][_0x972d('0xf')](this));ami['on'](_0x972d('0x10'),this['syncAgentRingNoAnswer']['bind'](this));ami['on']('queuecallerabandon',this[_0x972d('0x11')][_0x972d('0xf')](this));ami['on'](_0x972d('0x12'),this[_0x972d('0x13')]['bind'](this));ami['on'](_0x972d('0x14'),this['syncVarSet'][_0x972d('0xf')](this));ami['on'](_0x972d('0x15'),this[_0x972d('0x16')][_0x972d('0xf')](this));ami['on'](_0x972d('0x17'),this[_0x972d('0x18')][_0x972d('0xf')](this));ami['on'](_0x972d('0x19'),this['syncMusicOnHoldStop'][_0x972d('0xf')](this));ami['on']('attendedtransfer',this[_0x972d('0x1a')][_0x972d('0xf')](this));ami['on']('blindtransfer',this[_0x972d('0x1b')][_0x972d('0xf')](this));}VoiceAgentReport['prototype'][_0x972d('0x1c')]=function(_0x3cb12e,_0x535591,_0x1c086e){io['to'](_0x3cb12e)[_0x972d('0x1c')](_0x535591,_0x1c086e);};VoiceAgentReport[_0x972d('0x1d')][_0x972d('0x1e')]=function(_0xe3c60a){return _0xe3c60a!==null&&!_[_0x972d('0x1f')](_0xe3c60a);};VoiceAgentReport[_0x972d('0x1d')][_0x972d('0xd')]=function(_0x580fed){try{if(this['isNotNull'](_0x580fed)){logger['info'](_0x972d('0x20'),_0x580fed[_0x972d('0x21')],_0x580fed[_0x972d('0x22')],_0x580fed['destuniqueid']);logger['debug'](_0x972d('0x23'),_0x580fed[_0x972d('0x21')],util[_0x972d('0x24')](_0x580fed,{'showHidden':![],'depth':null}));if(_[_0x972d('0x1f')](this[_0x972d('0x7')][_0x580fed[_0x972d('0x21')]])){this[_0x972d('0x7')][_0x580fed[_0x972d('0x21')]]={};}var _0x4cd43d=this[_0x972d('0xa')][_0x580fed['interface']];var _0x11465b=this[_0x972d('0x7')][_0x580fed[_0x972d('0x21')]][_0x580fed[_0x972d('0x25')]];var _0x2a5f18=this[_0x972d('0x9')][_0x580fed[_0x972d('0x26')]];var _0x281f50=this[_0x972d('0xb')][_0x580fed[_0x972d('0x21')]];if(_[_0x972d('0x1f')](_0x11465b)){_0x11465b={'agentcalledAt':moment()['format'](_0x972d('0x27')),'lastevent':'called','mandatoryDisposition':_0x2a5f18&&_0x2a5f18[_0x972d('0x28')]?_0x2a5f18[_0x972d('0x28')]:![],'type':_0x2a5f18&&_0x2a5f18[_0x972d('0x29')]?_0x2a5f18['type']:_0x972d('0x2a'),'variables':_0x281f50,'motionChannel':_0x972d('0x2b')};}Object[_0x972d('0x2c')](_0x11465b,_[_0x972d('0x2d')](_0x580fed,[_0x972d('0x2e'),'privilege']));this['channels'][_0x580fed[_0x972d('0x21')]][_0x580fed['destuniqueid']]=_0x11465b;logger['debug'](_0x972d('0x2f'),_0x580fed[_0x972d('0x21')],util[_0x972d('0x24')](_0x11465b,{'showHidden':![],'depth':null}));ami[_0x972d('0x1c')]('custom:agentcalled',_0x11465b);var _0x51fe7c={'id':_0x4cd43d['id'],'calleridnum':_0x11465b[_0x972d('0x30')],'queue':_0x11465b[_0x972d('0x26')],'variables':_0x11465b[_0x972d('0xb')],'uniqueid':_0x580fed[_0x972d('0x21')]};logger[_0x972d('0x31')](_0x972d('0x32'),_0x580fed[_0x972d('0x21')],util['inspect'](_0x51fe7c,{'showHidden':![],'depth':null}));this['emit'](util[_0x972d('0x33')](_0x972d('0x34'),_0x580fed[_0x972d('0x22')]),_0x972d('0x35'),_0x51fe7c);}}catch(_0x5dbc68){logger['error'](_0x972d('0x36'),_0x580fed[_0x972d('0x21')],util['inspect'](_0x5dbc68,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x972d('0x1d')][_0x972d('0x37')]=function(_0x4cb310){try{if(this['isNotNull'](_0x4cb310)){if(this[_0x972d('0x7')][_0x4cb310[_0x972d('0x21')]]){for(var _0x21d012 in this['channels'][_0x4cb310[_0x972d('0x21')]]){if(this['channels'][_0x4cb310[_0x972d('0x21')]]['hasOwnProperty'](_0x21d012)){if(_0x4cb310[_0x972d('0x25')]===_0x21d012){logger[_0x972d('0x38')](_0x972d('0x39'),_0x4cb310[_0x972d('0x21')],_0x4cb310[_0x972d('0x22')],_0x4cb310[_0x972d('0x25')]);this[_0x972d('0x7')][_0x4cb310[_0x972d('0x21')]][_0x21d012][_0x972d('0x3a')]=moment()[_0x972d('0x33')](_0x972d('0x27'));this['channels'][_0x4cb310[_0x972d('0x21')]][_0x21d012][_0x972d('0x3b')]=_0x4cb310[_0x972d('0x3b')];this[_0x972d('0x7')][_0x4cb310[_0x972d('0x21')]][_0x21d012][_0x972d('0x3c')]=_0x4cb310[_0x972d('0x3c')];this[_0x972d('0x7')][_0x4cb310[_0x972d('0x21')]][_0x21d012][_0x972d('0x3d')]=_0x4cb310['destchannelstate'];this['channels'][_0x4cb310[_0x972d('0x21')]][_0x21d012][_0x972d('0x3e')]=_0x4cb310['destchannelstatedesc'];this[_0x972d('0x7')][_0x4cb310['uniqueid']][_0x21d012]['holdtime']=_0x4cb310[_0x972d('0x3f')];this['channels'][_0x4cb310[_0x972d('0x21')]][_0x21d012][_0x972d('0x40')]='connect';_['merge'](this[_0x972d('0xa')][_0x4cb310['interface']],_[_0x972d('0x41')](_0x4cb310,[_0x972d('0x26'),'destconnectedlinenum']));var _0xc06aa9=this[_0x972d('0xa')][_0x4cb310['interface']];var _0x33f138={'id':_0xc06aa9['id'],'name':_0xc06aa9[_0x972d('0x42')],'agentconnected':!![],'destaccountcode':_0xc06aa9['accountcode'],'destconnectedlinenum':this[_0x972d('0x7')][_0x4cb310[_0x972d('0x21')]][_0x4cb310['destuniqueid']][_0x972d('0x43')],'queue':this[_0x972d('0x7')][_0x4cb310[_0x972d('0x21')]][_0x4cb310[_0x972d('0x25')]][_0x972d('0x26')],'uniqueid':this[_0x972d('0x7')][_0x4cb310[_0x972d('0x21')]][_0x4cb310[_0x972d('0x25')]]['uniqueid']};ami[_0x972d('0x1c')](_0x972d('0x44'),this[_0x972d('0x7')][_0x4cb310['uniqueid']][_0x4cb310[_0x972d('0x25')]]);this[_0x972d('0x1c')](util[_0x972d('0x33')]('user:%s',_0x4cb310[_0x972d('0x22')]),_0x972d('0x45'),_0x33f138);}else if(!this[_0x972d('0x7')][_0x4cb310[_0x972d('0x21')]][_0x21d012]['agentringnoanswer']&&!this[_0x972d('0x7')][_0x4cb310[_0x972d('0x21')]][_0x21d012][_0x972d('0x12')]){logger['info'](_0x972d('0x46'),_0x4cb310[_0x972d('0x21')],this[_0x972d('0x7')][_0x4cb310[_0x972d('0x21')]][_0x21d012][_0x972d('0x22')],_0x21d012);this[_0x972d('0x7')][_0x4cb310[_0x972d('0x21')]][_0x21d012][_0x972d('0x10')]=!![];this[_0x972d('0x7')][_0x4cb310[_0x972d('0x21')]][_0x21d012]['agentringnoanswerAt']=moment()[_0x972d('0x33')](_0x972d('0x27'));this['channels'][_0x4cb310[_0x972d('0x21')]][_0x21d012]['answeredelsewheredestinationuniqueid']=_0x4cb310['destuniqueid'];this['channels'][_0x4cb310[_0x972d('0x21')]][_0x21d012][_0x972d('0x47')]=_0x4cb310['membername'];this[_0x972d('0x7')][_0x4cb310[_0x972d('0x21')]][_0x21d012]['lastevent']='answered_elsewhere';this[_0x972d('0x7')][_0x4cb310[_0x972d('0x21')]][_0x21d012]['reason']=_0x972d('0x48');logger[_0x972d('0x31')](_0x972d('0x49'),_0x4cb310[_0x972d('0x21')],util[_0x972d('0x24')](this['channels'][_0x4cb310['uniqueid']][_0x21d012],{'showHidden':![],'depth':null}));ami[_0x972d('0x1c')](_0x972d('0x4a'),this['channels'][_0x4cb310['uniqueid']][_0x21d012]);}else{logger[_0x972d('0x31')](_0x972d('0x4b'),_0x4cb310['uniqueid']);}}}}}}catch(_0x2862b6){logger['error'](_0x972d('0x4c'),_0x4cb310[_0x972d('0x21')],util[_0x972d('0x24')](_0x2862b6,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x972d('0x4d')]=function(_0x1c2e5f){try{if(this[_0x972d('0x1e')](_0x1c2e5f)){logger[_0x972d('0x31')](_0x972d('0x4e'),_0x1c2e5f[_0x972d('0x21')],util['inspect'](_0x1c2e5f,{'showHidden':![],'depth':null}));if(this['channels'][_0x1c2e5f[_0x972d('0x21')]]&&this[_0x972d('0x7')][_0x1c2e5f[_0x972d('0x21')]][_0x1c2e5f[_0x972d('0x25')]]){logger[_0x972d('0x38')]('[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected',_0x1c2e5f[_0x972d('0x21')],_0x1c2e5f['membername'],_0x1c2e5f[_0x972d('0x25')]);var _0xf76df5=this['agents'][_0x1c2e5f['interface']];var _0x3979b3=this[_0x972d('0x7')][_0x1c2e5f[_0x972d('0x21')]][_0x1c2e5f[_0x972d('0x25')]];_0x3979b3['agentringnoanswer']=!![];_0x3979b3[_0x972d('0x4f')]=moment()['format'](_0x972d('0x27'));_0x3979b3[_0x972d('0x40')]='rejected';_0x3979b3[_0x972d('0x50')]=_0x972d('0x51');var _0x350c51={'id':_0xf76df5['id'],'name':_0xf76df5[_0x972d('0x42')],'queue':_0x3979b3[_0x972d('0x26')],'uniqueid':_0x3979b3[_0x972d('0x21')]};logger[_0x972d('0x31')](_0x972d('0x52'),_0x1c2e5f[_0x972d('0x21')],util['inspect'](_0x350c51,{'showHidden':![],'depth':null}));this[_0x972d('0x1c')](util[_0x972d('0x33')](_0x972d('0x34'),_0xf76df5[_0x972d('0x42')]),_0x972d('0x53'),_0x350c51);ami[_0x972d('0x1c')](_0x972d('0x54'),_0x3979b3);this['channels'][_0x1c2e5f[_0x972d('0x21')]][_0x1c2e5f['destuniqueid']]=Object[_0x972d('0x2c')]({},_0x3979b3);}}}catch(_0x5ed324){logger[_0x972d('0x55')]('[%s][voiceAgentReport][agentringnoanswer]',_0x1c2e5f['uniqueid'],util['inspect'](_0x5ed324,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x972d('0x1d')][_0x972d('0x11')]=function(_0x2c9847){try{if(this['isNotNull'](_0x2c9847)){logger[_0x972d('0x31')](_0x972d('0x56'),_0x2c9847[_0x972d('0x21')],util['inspect'](_0x2c9847,{'showHidden':![],'depth':null}));if(this[_0x972d('0x7')][_0x2c9847[_0x972d('0x21')]]){for(var _0x363b2d in this[_0x972d('0x7')][_0x2c9847['uniqueid']]){if(this[_0x972d('0x7')][_0x2c9847[_0x972d('0x21')]][_0x972d('0x57')](_0x363b2d)&&!this[_0x972d('0x7')][_0x2c9847[_0x972d('0x21')]][_0x363b2d]['agentringnoanswer']&&!this['channels'][_0x2c9847['uniqueid']][_0x363b2d][_0x972d('0x12')]){logger[_0x972d('0x38')](_0x972d('0x58'),_0x2c9847[_0x972d('0x21')],this[_0x972d('0x7')][_0x2c9847[_0x972d('0x21')]][_0x363b2d][_0x972d('0x22')],_0x363b2d);this[_0x972d('0x7')][_0x2c9847[_0x972d('0x21')]][_0x363b2d]['agentringnoanswer']=!![];this[_0x972d('0x7')][_0x2c9847[_0x972d('0x21')]][_0x363b2d][_0x972d('0x4f')]=moment()['format'](_0x972d('0x27'));this[_0x972d('0x7')][_0x2c9847[_0x972d('0x21')]][_0x363b2d][_0x972d('0x40')]='abandoned';this[_0x972d('0x7')][_0x2c9847[_0x972d('0x21')]][_0x363b2d][_0x972d('0x50')]='abandoned';logger[_0x972d('0x31')](_0x972d('0x59'),_0x2c9847[_0x972d('0x21')],util[_0x972d('0x24')](this[_0x972d('0x7')][_0x2c9847[_0x972d('0x21')]][_0x363b2d],{'showHidden':![],'depth':null}));ami['emit']('custom:agentqueuecallerabandon',this[_0x972d('0x7')][_0x2c9847[_0x972d('0x21')]][_0x363b2d]);}}}}}catch(_0x3e40c9){logger[_0x972d('0x55')](_0x972d('0x5a'),_0x2c9847[_0x972d('0x21')],util[_0x972d('0x24')](_0x3e40c9,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x972d('0x1d')][_0x972d('0x13')]=function(_0x4263f6){try{if(this[_0x972d('0x1e')](_0x4263f6)){logger[_0x972d('0x31')](_0x972d('0x5b'),_0x4263f6[_0x972d('0x21')],util[_0x972d('0x24')](_0x4263f6,{'showHidden':![],'depth':null}));if(this[_0x972d('0x7')][_0x4263f6[_0x972d('0x21')]]){for(var _0x1702ff in this[_0x972d('0x7')][_0x4263f6[_0x972d('0x21')]]){if(this[_0x972d('0x7')][_0x4263f6[_0x972d('0x21')]][_0x972d('0x57')](_0x1702ff)){if(this['channels'][_0x4263f6[_0x972d('0x21')]][_0x1702ff][_0x972d('0x3a')]&&!this[_0x972d('0x7')][_0x4263f6[_0x972d('0x21')]][_0x1702ff][_0x972d('0x12')]){logger['info'](_0x972d('0x5c'),_0x4263f6[_0x972d('0x21')],this[_0x972d('0x7')][_0x4263f6[_0x972d('0x21')]][_0x1702ff][_0x972d('0x22')],_0x1702ff);this[_0x972d('0x7')][_0x4263f6['uniqueid']][_0x1702ff]['agentcomplete']=!![];this[_0x972d('0x7')][_0x4263f6[_0x972d('0x21')]][_0x1702ff][_0x972d('0x5d')]=moment()['format'](_0x972d('0x27'));this['channels'][_0x4263f6['uniqueid']][_0x1702ff][_0x972d('0x40')]=_0x972d('0x5e');this['channels'][_0x4263f6[_0x972d('0x21')]][_0x1702ff][_0x972d('0x50')]=_0x4263f6[_0x972d('0x50')]=='transfer'?_0x972d('0x5f'):_0x4263f6[_0x972d('0x50')];this[_0x972d('0x7')][_0x4263f6[_0x972d('0x21')]][_0x1702ff][_0x972d('0x60')]=_0x4263f6['talktime'];if(this[_0x972d('0x9')][_0x4263f6[_0x972d('0x26')]]&&this['voiceQueues'][_0x4263f6['queue']][_0x972d('0x61')]){this[_0x972d('0x7')][_0x4263f6['uniqueid']][_0x1702ff][_0x972d('0x62')]=this[_0x972d('0x9')][_0x4263f6[_0x972d('0x26')]][_0x972d('0x63')];this[_0x972d('0x7')][_0x4263f6[_0x972d('0x21')]][_0x1702ff][_0x972d('0x64')]=!![];}this[_0x972d('0xa')][_0x4263f6[_0x972d('0x65')]]=_[_0x972d('0x2d')](this[_0x972d('0xa')][_0x4263f6[_0x972d('0x65')]],['queue','destconnectedlinenum']);logger[_0x972d('0x31')](_0x972d('0x66'),_0x4263f6['uniqueid'],util['inspect'](this[_0x972d('0x7')][_0x4263f6[_0x972d('0x21')]][_0x1702ff],{'showHidden':![],'depth':null}));ami[_0x972d('0x1c')]('custom:agentcomplete',this[_0x972d('0x7')][_0x4263f6[_0x972d('0x21')]][_0x1702ff]);logger[_0x972d('0x31')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:',_0x4263f6[_0x972d('0x21')],util[_0x972d('0x24')]({'id':this[_0x972d('0xa')][_0x4263f6[_0x972d('0x65')]]['id'],'destaccountcode':_0x4263f6[_0x972d('0x67')]},{'showHidden':![],'depth':null}));this[_0x972d('0x1c')](util[_0x972d('0x33')]('user:%s',_0x4263f6['membername']),_0x972d('0x68'),{'id':this[_0x972d('0xa')][_0x4263f6[_0x972d('0x65')]]['id'],'destaccountcode':Number(_0x4263f6['destaccountcode'])});}}}}}}catch(_0x617118){logger['error'](_0x972d('0x69'),_0x4263f6[_0x972d('0x21')],util[_0x972d('0x24')](_0x617118,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x972d('0x1d')]['syncVarSet']=function(_0x2fe964){try{if(this['isNotNull'](_0x2fe964)){logger[_0x972d('0x31')](_0x972d('0x6a'),_0x2fe964['uniqueid'],util['inspect'](_0x2fe964,{'showHidden':![],'depth':null}));this['addVariable'](_0x2fe964[_0x972d('0x21')],_[_0x972d('0x6b')](_0x2fe964['variable'])[0x0],_0x2fe964[_0x972d('0x6c')]);if(this[_0x972d('0x7')][_0x2fe964[_0x972d('0x21')]]){for(var _0x5eb26b in this['channels'][_0x2fe964[_0x972d('0x21')]]){if(this[_0x972d('0x7')][_0x2fe964['uniqueid']][_0x972d('0x57')](_0x5eb26b)){logger[_0x972d('0x38')](_0x972d('0x6d'),_0x2fe964[_0x972d('0x21')],_0x5eb26b,_['keys'](_0x2fe964[_0x972d('0x6e')])[0x0],_0x2fe964['value']);if(_[_0x972d('0x1f')](this['channels'][_0x2fe964[_0x972d('0x21')]][_0x5eb26b][_0x972d('0xb')])){this[_0x972d('0x7')][_0x2fe964[_0x972d('0x21')]][_0x5eb26b][_0x972d('0xb')]={};}this[_0x972d('0x7')][_0x2fe964[_0x972d('0x21')]][_0x5eb26b][_0x972d('0xb')]=this[_0x972d('0xb')][_0x2fe964[_0x972d('0x21')]];}}}}}catch(_0x3ff9ab){logger['error'](_0x972d('0x6f'),_0x2fe964[_0x972d('0x21')],util[_0x972d('0x24')](_0x3ff9ab,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x972d('0x1d')][_0x972d('0x70')]=function(_0x54eeac,_0x30b08c,_0x282094){var _0x3fde5d=[_0x972d('0x71'),_0x972d('0x72'),_0x972d('0x73'),'rtpaudioqosjitterbridged',_0x972d('0x74'),_0x972d('0x75'),_0x972d('0x76'),_0x972d('0x77'),_0x972d('0x78'),_0x972d('0x79'),_0x972d('0x7a'),_0x972d('0x7b'),_0x972d('0x7c'),_0x972d('0x7d'),_0x972d('0x7e'),_0x972d('0x7f'),_0x972d('0x22'),_0x972d('0x80'),'memberrealtime'];if(!_[_0x972d('0x81')](_0x30b08c)&&!_[_0x972d('0x82')](_0x3fde5d,_0x30b08c)){if(_[_0x972d('0x1f')](this['variables'][_0x54eeac])){this['variables'][_0x54eeac]={};}this[_0x972d('0xb')][_0x54eeac][_0x30b08c]=_0x282094;}};VoiceAgentReport[_0x972d('0x1d')][_0x972d('0x16')]=function(_0x3398c7){try{if(this['isNotNull'](_0x3398c7)){logger['debug']('[%s][voiceAgentReport][hangup]\x20event:',_0x3398c7[_0x972d('0x21')],util[_0x972d('0x24')](_0x3398c7,{'showHidden':![],'depth':null}));if(this['channels'][_0x3398c7[_0x972d('0x21')]]){for(var _0xd70e32 in this[_0x972d('0x7')][_0x3398c7[_0x972d('0x21')]]){if(this[_0x972d('0x7')][_0x3398c7[_0x972d('0x21')]]['hasOwnProperty'](_0xd70e32)){if(this['channels'][_0x3398c7[_0x972d('0x21')]][_0xd70e32]['reason']==_0x972d('0x83')&&this[_0x972d('0x7')][_0x3398c7[_0x972d('0x21')]][_0xd70e32][_0x972d('0x12')]){logger['info'](_0x972d('0x84'),_0x3398c7[_0x972d('0x21')],_0xd70e32);this[_0x972d('0x7')][_0x3398c7['uniqueid']][_0xd70e32]['agentcompleteAt']=moment()[_0x972d('0x33')]('YYYY-MM-DD\x20HH:mm:ss');}}}logger[_0x972d('0x31')]('[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:',_0x3398c7['uniqueid'],util[_0x972d('0x24')](_[_0x972d('0x85')](this['channels'][_0x3398c7[_0x972d('0x21')]]),{'showHidden':![],'depth':null}));ami[_0x972d('0x1c')](_0x972d('0x86'),_['values'](this[_0x972d('0x7')][_0x3398c7[_0x972d('0x21')]]));this[_0x972d('0x87')](_0x3398c7['uniqueid']);}if(this[_0x972d('0xb')][_0x3398c7[_0x972d('0x21')]]){delete this['variables'][_0x3398c7[_0x972d('0x21')]];}}}catch(_0x2a14ee){logger['error'](_0x972d('0x88'),_0x3398c7[_0x972d('0x21')],util[_0x972d('0x24')](_0x2a14ee,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x972d('0x1d')][_0x972d('0x1a')]=function(_0x192645){try{if(this['isNotNull'](_0x192645)){logger['debug'](_0x972d('0x89'),_0x192645[_0x972d('0x21')],util['inspect'](_0x192645,{'showHidden':![],'depth':null}));if(this[_0x972d('0x7')][_0x192645['transfereeuniqueid']]){for(var _0x5e65a5 in this['channels'][_0x192645[_0x972d('0x8a')]]){if(this['channels'][_0x192645['transfereeuniqueid']][_0x972d('0x57')](_0x5e65a5)){if(_0x192645[_0x972d('0x8b')]===_0x5e65a5){logger[_0x972d('0x38')]('[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x192645[_0x972d('0x21')],this[_0x972d('0x7')][_0x192645[_0x972d('0x8a')]][_0x5e65a5]['membername'],_0x5e65a5);var _0xfc66f2=moment();this[_0x972d('0x7')][_0x192645[_0x972d('0x8a')]][_0x5e65a5]['agentcomplete']=!![];this[_0x972d('0x7')][_0x192645['transfereeuniqueid']][_0x5e65a5][_0x972d('0x5d')]=moment()[_0x972d('0x33')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x192645['transfereeuniqueid']][_0x5e65a5][_0x972d('0x40')]=_0x972d('0x5e');this['channels'][_0x192645[_0x972d('0x8a')]][_0x5e65a5][_0x972d('0x50')]=_0x972d('0x83');this[_0x972d('0x7')][_0x192645[_0x972d('0x8a')]][_0x5e65a5][_0x972d('0x60')]=_0xfc66f2[_0x972d('0x8c')](this[_0x972d('0x7')][_0x192645[_0x972d('0x8a')]][_0x5e65a5][_0x972d('0x3a')],_0x972d('0x8d'));}}}}if(this[_0x972d('0x7')][_0x192645[_0x972d('0x8e')]]){var _0x4a7968=this[_0x972d('0x7')][_0x192645[_0x972d('0x8e')]];this[_0x972d('0x7')][_0x192645[_0x972d('0x8e')]]=this[_0x972d('0x7')][_0x192645[_0x972d('0x8a')]];this[_0x972d('0x7')][_0x192645['transfereeuniqueid']]=_0x4a7968;}}}catch(_0x366d02){logger['error'](_0x972d('0x8f'),_0x192645['uniqueid'],util['inspect'](_0x366d02,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x972d('0x1b')]=function(_0x327f55){try{if(this['isNotNull'](_0x327f55)){logger[_0x972d('0x31')](_0x972d('0x90'),_0x327f55[_0x972d('0x21')],util[_0x972d('0x24')](_0x327f55,{'showHidden':![],'depth':null}));if(this[_0x972d('0x7')][_0x327f55[_0x972d('0x8a')]]){for(var _0x371846 in this[_0x972d('0x7')][_0x327f55[_0x972d('0x8a')]]){if(this[_0x972d('0x7')][_0x327f55[_0x972d('0x8a')]][_0x972d('0x57')](_0x371846)){if(_0x327f55[_0x972d('0x91')]===_0x371846){logger[_0x972d('0x38')]('[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x327f55[_0x972d('0x21')],this[_0x972d('0x7')][_0x327f55[_0x972d('0x8a')]][_0x371846][_0x972d('0x22')],_0x371846);var _0x20b3dc=moment();this[_0x972d('0x7')][_0x327f55['transfereeuniqueid']][_0x371846][_0x972d('0x12')]=!![];this['channels'][_0x327f55[_0x972d('0x8a')]][_0x371846][_0x972d('0x5d')]=_0x20b3dc;this[_0x972d('0x7')][_0x327f55['transfereeuniqueid']][_0x371846][_0x972d('0x40')]=_0x972d('0x5e');this[_0x972d('0x7')][_0x327f55['transfereeuniqueid']][_0x371846][_0x972d('0x50')]=_0x972d('0x83');this[_0x972d('0x7')][_0x327f55[_0x972d('0x8a')]][_0x371846][_0x972d('0x60')]=_0x20b3dc[_0x972d('0x8c')](this[_0x972d('0x7')][_0x327f55[_0x972d('0x8a')]][_0x371846][_0x972d('0x3a')],_0x972d('0x8d'));}}}}}}catch(_0x69dcd5){logger[_0x972d('0x55')](_0x972d('0x92'),_0x327f55[_0x972d('0x21')],util[_0x972d('0x24')](_0x69dcd5,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x972d('0x1d')][_0x972d('0x18')]=function(_0x2ce0e7){var _0x1f152d='';try{if(this[_0x972d('0x1e')](_0x2ce0e7)){logger['debug']('[%s][voiceAgentReport][musiconholdstart]\x20event:',_0x2ce0e7[_0x972d('0x21')],util['inspect'](_0x2ce0e7,{'showHidden':![],'depth':null}));if(_0x2ce0e7['channel']){_0x1f152d=_0x2ce0e7[_0x972d('0x93')][_0x972d('0x94')](0x0,_0x2ce0e7['channel'][_0x972d('0x95')]('-'));if(this[_0x972d('0xa')][_0x1f152d]){logger[_0x972d('0x38')](_0x972d('0x96'),_0x2ce0e7['uniqueid'],_0x1f152d);this['agents'][_0x1f152d]['onhold']=!![];}}}}catch(_0x4f9d77){logger['error'](_0x972d('0x97'),_0x2ce0e7[_0x972d('0x21')],util[_0x972d('0x24')](_0x4f9d77,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x972d('0x1d')]['syncMusicOnHoldStop']=function(_0x5ce81e){var _0xa31876='';try{if(this[_0x972d('0x1e')](_0x5ce81e)){logger['debug'](_0x972d('0x98'),_0x5ce81e[_0x972d('0x21')],util['inspect'](_0x5ce81e,{'showHidden':![],'depth':null}));if(_0x5ce81e[_0x972d('0x93')]){_0xa31876=_0x5ce81e[_0x972d('0x93')][_0x972d('0x94')](0x0,_0x5ce81e[_0x972d('0x93')][_0x972d('0x95')]('-'));if(this['agents'][_0xa31876]){logger[_0x972d('0x38')](_0x972d('0x99'),_0x5ce81e[_0x972d('0x21')],_0xa31876);this['agents'][_0xa31876][_0x972d('0x9a')]=![];}}}}catch(_0x4c0f61){logger[_0x972d('0x55')](_0x972d('0x9b'),_0x5ce81e[_0x972d('0x21')],util[_0x972d('0x24')](_0x4c0f61,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x972d('0x1d')][_0x972d('0x87')]=function(_0x3818d5,_0x50378b=0x2710){if(this[_0x972d('0x7')][_0x3818d5]){setTimeout(()=>{delete this[_0x972d('0x7')][_0x3818d5];},_0x50378b);}};module['exports']=VoiceAgentReport; \ No newline at end of file +var _0xd67c=['agents','variables','agentcalled','syncAgentCalled','bind','agentringnoanswer','syncAgentRingNoAnswer','agentcomplete','syncAgentComplete','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','info','uniqueid','membername','destuniqueid','debug','inspect','interface','queue','YYYY-MM-DD\x20HH:mm:ss','called','type','inbound','voice','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','format','user:called','error','[%s][voiceAgentReport][agentcalled]','syncAgentConnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','connect','merge','pick','destconnectedlinenum','name','accountcode','exten','custom:agentconnect','user:%s','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','assign','[%s][voiceAgentReport][agentringnoanswer]','syncQueueCallerAbandon','[%s][voiceAgentReport][queuecallerabandon]\x20event:','hasOwnProperty','abandoned','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','agent','talktime','acwtime','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','destaccountcode','user:agentcomplete','[%s][voiceAgentReport][varset]\x20event:','addVariable','variable','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','keys','value','[%s][voiceAgentReport][varset]','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberlastcall','memberpenalty','memberrealtime','includes','[%s][voiceAgentReport][hangup]\x20event:','custom:voiceAgentReport','values','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','transfer','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','lastIndexOf','onhold','[%s][voiceAgentReport][musiconholdstart]','syncMusicOnHoldStop','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','deleteChannelAfterTimeout','lodash','moment','util','ioredis','../../../config/environment','ami','../ami','redis','defaults','localhost','socket.io-emitter','channels','voiceChannels','voiceQueues'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xd67c,0x130));var _0xcd67=function(_0x168765,_0x534f44){_0x168765=_0x168765-0x0;var _0x3ee3a0=_0xd67c[_0x168765];return _0x3ee3a0;};'use strict';var _=require(_0xcd67('0x0'));var moment=require(_0xcd67('0x1'));var util=require(_0xcd67('0x2'));var Redis=require(_0xcd67('0x3'));var config=require(_0xcd67('0x4'));var logger=require('../../../config/logger')(_0xcd67('0x5'));var ami=require(_0xcd67('0x6'));config[_0xcd67('0x7')]=_[_0xcd67('0x8')](config[_0xcd67('0x7')],{'host':_0xcd67('0x9'),'port':0x18eb});var io=require(_0xcd67('0xa'))(new Redis(config[_0xcd67('0x7')]));function VoiceAgentReport(_0x38588f){this[_0xcd67('0xb')]={};this[_0xcd67('0xc')]=_0x38588f[_0xcd67('0xb')];this[_0xcd67('0xd')]=_0x38588f[_0xcd67('0xd')];this[_0xcd67('0xe')]=_0x38588f[_0xcd67('0xe')];this[_0xcd67('0xf')]={};ami['on'](_0xcd67('0x10'),this[_0xcd67('0x11')][_0xcd67('0x12')](this));ami['on']('agentconnect',this['syncAgentConnect']['bind'](this));ami['on'](_0xcd67('0x13'),this[_0xcd67('0x14')][_0xcd67('0x12')](this));ami['on']('queuecallerabandon',this['syncQueueCallerAbandon'][_0xcd67('0x12')](this));ami['on'](_0xcd67('0x15'),this[_0xcd67('0x16')][_0xcd67('0x12')](this));ami['on']('varset',this['syncVarSet'][_0xcd67('0x12')](this));ami['on'](_0xcd67('0x17'),this[_0xcd67('0x18')][_0xcd67('0x12')](this));ami['on'](_0xcd67('0x19'),this[_0xcd67('0x1a')][_0xcd67('0x12')](this));ami['on'](_0xcd67('0x1b'),this['syncMusicOnHoldStop'][_0xcd67('0x12')](this));ami['on'](_0xcd67('0x1c'),this[_0xcd67('0x1d')][_0xcd67('0x12')](this));ami['on'](_0xcd67('0x1e'),this[_0xcd67('0x1f')][_0xcd67('0x12')](this));}VoiceAgentReport[_0xcd67('0x20')]['emit']=function(_0x841814,_0x4fe664,_0x5e74e0){io['to'](_0x841814)[_0xcd67('0x21')](_0x4fe664,_0x5e74e0);};VoiceAgentReport[_0xcd67('0x20')][_0xcd67('0x22')]=function(_0x17d2fb){return _0x17d2fb!==null&&!_[_0xcd67('0x23')](_0x17d2fb);};VoiceAgentReport[_0xcd67('0x20')][_0xcd67('0x11')]=function(_0x5078f7){try{if(this[_0xcd67('0x22')](_0x5078f7)){logger[_0xcd67('0x24')]('[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x5078f7[_0xcd67('0x25')],_0x5078f7[_0xcd67('0x26')],_0x5078f7[_0xcd67('0x27')]);logger[_0xcd67('0x28')]('[%s][voiceAgentReport][agentcalled]\x20event:',_0x5078f7[_0xcd67('0x25')],util[_0xcd67('0x29')](_0x5078f7,{'showHidden':![],'depth':null}));if(_[_0xcd67('0x23')](this['channels'][_0x5078f7[_0xcd67('0x25')]])){this[_0xcd67('0xb')][_0x5078f7[_0xcd67('0x25')]]={};}var _0xfaf10e=this['agents'][_0x5078f7[_0xcd67('0x2a')]];var _0xec3c48=this[_0xcd67('0xb')][_0x5078f7[_0xcd67('0x25')]][_0x5078f7[_0xcd67('0x27')]];var _0x385e60=this[_0xcd67('0xd')][_0x5078f7[_0xcd67('0x2b')]];var _0x5e41cf=this[_0xcd67('0xf')][_0x5078f7[_0xcd67('0x25')]];if(_[_0xcd67('0x23')](_0xec3c48)){_0xec3c48={'agentcalledAt':moment()['format'](_0xcd67('0x2c')),'lastevent':_0xcd67('0x2d'),'mandatoryDisposition':_0x385e60&&_0x385e60['mandatoryDisposition']?_0x385e60['mandatoryDisposition']:![],'type':_0x385e60&&_0x385e60['type']?_0x385e60[_0xcd67('0x2e')]:_0xcd67('0x2f'),'variables':_0x5e41cf,'motionChannel':_0xcd67('0x30')};}Object['assign'](_0xec3c48,_[_0xcd67('0x31')](_0x5078f7,[_0xcd67('0x32'),_0xcd67('0x33')]));this[_0xcd67('0xb')][_0x5078f7['uniqueid']][_0x5078f7['destuniqueid']]=_0xec3c48;logger['debug'](_0xcd67('0x34'),_0x5078f7[_0xcd67('0x25')],util[_0xcd67('0x29')](_0xec3c48,{'showHidden':![],'depth':null}));ami[_0xcd67('0x21')](_0xcd67('0x35'),_0xec3c48);var _0x4048a7={'id':_0xfaf10e['id'],'calleridnum':_0xec3c48['calleridnum'],'queue':_0xec3c48[_0xcd67('0x2b')],'variables':_0xec3c48[_0xcd67('0xf')],'uniqueid':_0x5078f7[_0xcd67('0x25')]};logger[_0xcd67('0x28')](_0xcd67('0x36'),_0x5078f7[_0xcd67('0x25')],util[_0xcd67('0x29')](_0x4048a7,{'showHidden':![],'depth':null}));this[_0xcd67('0x21')](util[_0xcd67('0x37')]('user:%s',_0x5078f7['membername']),_0xcd67('0x38'),_0x4048a7);}}catch(_0x426648){logger[_0xcd67('0x39')](_0xcd67('0x3a'),_0x5078f7['uniqueid'],util[_0xcd67('0x29')](_0x426648,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xcd67('0x20')][_0xcd67('0x3b')]=function(_0x462614){try{if(this[_0xcd67('0x22')](_0x462614)){if(this[_0xcd67('0xb')][_0x462614[_0xcd67('0x25')]]){for(var _0x2e1fd2 in this[_0xcd67('0xb')][_0x462614['uniqueid']]){if(this[_0xcd67('0xb')][_0x462614[_0xcd67('0x25')]]['hasOwnProperty'](_0x2e1fd2)){if(_0x462614[_0xcd67('0x27')]===_0x2e1fd2){logger[_0xcd67('0x24')](_0xcd67('0x3c'),_0x462614[_0xcd67('0x25')],_0x462614['membername'],_0x462614[_0xcd67('0x27')]);this['channels'][_0x462614[_0xcd67('0x25')]][_0x2e1fd2][_0xcd67('0x3d')]=moment()[_0xcd67('0x37')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x462614[_0xcd67('0x25')]][_0x2e1fd2][_0xcd67('0x3e')]=_0x462614['connectedlinename'];this[_0xcd67('0xb')][_0x462614[_0xcd67('0x25')]][_0x2e1fd2][_0xcd67('0x3f')]=_0x462614[_0xcd67('0x3f')];this[_0xcd67('0xb')][_0x462614[_0xcd67('0x25')]][_0x2e1fd2][_0xcd67('0x40')]=_0x462614['destchannelstate'];this[_0xcd67('0xb')][_0x462614['uniqueid']][_0x2e1fd2][_0xcd67('0x41')]=_0x462614[_0xcd67('0x41')];this['channels'][_0x462614[_0xcd67('0x25')]][_0x2e1fd2][_0xcd67('0x42')]=_0x462614[_0xcd67('0x42')];this[_0xcd67('0xb')][_0x462614[_0xcd67('0x25')]][_0x2e1fd2][_0xcd67('0x43')]=_0xcd67('0x44');_[_0xcd67('0x45')](this['agents'][_0x462614[_0xcd67('0x2a')]],_[_0xcd67('0x46')](_0x462614,[_0xcd67('0x2b'),_0xcd67('0x47')]));var _0xcc713b=this[_0xcd67('0xe')][_0x462614[_0xcd67('0x2a')]];var _0x32713f={'id':_0xcc713b['id'],'name':_0xcc713b[_0xcd67('0x48')],'agentconnected':!![],'destaccountcode':_0xcc713b[_0xcd67('0x49')],'destconnectedlinenum':this['channels'][_0x462614[_0xcd67('0x25')]][_0x462614[_0xcd67('0x27')]][_0xcd67('0x4a')],'queue':this[_0xcd67('0xb')][_0x462614[_0xcd67('0x25')]][_0x462614[_0xcd67('0x27')]][_0xcd67('0x2b')],'uniqueid':this[_0xcd67('0xb')][_0x462614[_0xcd67('0x25')]][_0x462614[_0xcd67('0x27')]][_0xcd67('0x25')]};ami[_0xcd67('0x21')](_0xcd67('0x4b'),this[_0xcd67('0xb')][_0x462614[_0xcd67('0x25')]][_0x462614[_0xcd67('0x27')]]);this[_0xcd67('0x21')](util[_0xcd67('0x37')](_0xcd67('0x4c'),_0x462614[_0xcd67('0x26')]),_0xcd67('0x4d'),_0x32713f);}else if(!this['channels'][_0x462614[_0xcd67('0x25')]][_0x2e1fd2][_0xcd67('0x13')]&&!this['channels'][_0x462614[_0xcd67('0x25')]][_0x2e1fd2][_0xcd67('0x15')]){logger[_0xcd67('0x24')](_0xcd67('0x4e'),_0x462614[_0xcd67('0x25')],this['channels'][_0x462614[_0xcd67('0x25')]][_0x2e1fd2]['membername'],_0x2e1fd2);this[_0xcd67('0xb')][_0x462614[_0xcd67('0x25')]][_0x2e1fd2][_0xcd67('0x13')]=!![];this[_0xcd67('0xb')][_0x462614['uniqueid']][_0x2e1fd2][_0xcd67('0x4f')]=moment()[_0xcd67('0x37')](_0xcd67('0x2c'));this[_0xcd67('0xb')][_0x462614['uniqueid']][_0x2e1fd2][_0xcd67('0x50')]=_0x462614['destuniqueid'];this[_0xcd67('0xb')][_0x462614[_0xcd67('0x25')]][_0x2e1fd2]['answeredelsewheremembername']=_0x462614[_0xcd67('0x26')];this[_0xcd67('0xb')][_0x462614[_0xcd67('0x25')]][_0x2e1fd2][_0xcd67('0x43')]=_0xcd67('0x51');this[_0xcd67('0xb')][_0x462614['uniqueid']][_0x2e1fd2][_0xcd67('0x52')]='answered_elsewhere';logger['debug'](_0xcd67('0x53'),_0x462614[_0xcd67('0x25')],util[_0xcd67('0x29')](this['channels'][_0x462614['uniqueid']][_0x2e1fd2],{'showHidden':![],'depth':null}));ami['emit'](_0xcd67('0x54'),this[_0xcd67('0xb')][_0x462614[_0xcd67('0x25')]][_0x2e1fd2]);}else{logger[_0xcd67('0x28')]('[%s][voiceAgentReport][agentconnect]\x20Else\x20path\x20should\x20never\x20be\x20taken',_0x462614[_0xcd67('0x25')]);}}}}}}catch(_0x2d5fe2){logger[_0xcd67('0x39')]('[%s][voiceAgentReport][agentconnect]',_0x462614[_0xcd67('0x25')],util['inspect'](_0x2d5fe2,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xcd67('0x20')][_0xcd67('0x14')]=function(_0x4b47ba){try{if(this[_0xcd67('0x22')](_0x4b47ba)){logger[_0xcd67('0x28')](_0xcd67('0x55'),_0x4b47ba[_0xcd67('0x25')],util['inspect'](_0x4b47ba,{'showHidden':![],'depth':null}));if(this[_0xcd67('0xb')][_0x4b47ba[_0xcd67('0x25')]]&&this[_0xcd67('0xb')][_0x4b47ba['uniqueid']][_0x4b47ba[_0xcd67('0x27')]]){logger[_0xcd67('0x24')](_0xcd67('0x56'),_0x4b47ba[_0xcd67('0x25')],_0x4b47ba[_0xcd67('0x26')],_0x4b47ba[_0xcd67('0x27')]);var _0x193815=this[_0xcd67('0xe')][_0x4b47ba[_0xcd67('0x2a')]];var _0x2ffa78=this[_0xcd67('0xb')][_0x4b47ba[_0xcd67('0x25')]][_0x4b47ba[_0xcd67('0x27')]];_0x2ffa78[_0xcd67('0x13')]=!![];_0x2ffa78['agentringnoanswerAt']=moment()['format'](_0xcd67('0x2c'));_0x2ffa78[_0xcd67('0x43')]=_0xcd67('0x57');_0x2ffa78[_0xcd67('0x52')]=_0xcd67('0x57');var _0x2640ad={'id':_0x193815['id'],'name':_0x193815[_0xcd67('0x48')],'queue':_0x2ffa78[_0xcd67('0x2b')],'uniqueid':_0x2ffa78[_0xcd67('0x25')]};logger['debug'](_0xcd67('0x58'),_0x4b47ba['uniqueid'],util[_0xcd67('0x29')](_0x2640ad,{'showHidden':![],'depth':null}));this[_0xcd67('0x21')](util[_0xcd67('0x37')](_0xcd67('0x4c'),_0x193815[_0xcd67('0x48')]),'user:agentringnoanswer',_0x2640ad);ami[_0xcd67('0x21')]('custom:agentringnoanswer',_0x2ffa78);this['channels'][_0x4b47ba[_0xcd67('0x25')]][_0x4b47ba[_0xcd67('0x27')]]=Object[_0xcd67('0x59')]({},_0x2ffa78);}}}catch(_0x52aa31){logger['error'](_0xcd67('0x5a'),_0x4b47ba['uniqueid'],util[_0xcd67('0x29')](_0x52aa31,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xcd67('0x20')][_0xcd67('0x5b')]=function(_0x3c6d15){try{if(this[_0xcd67('0x22')](_0x3c6d15)){logger[_0xcd67('0x28')](_0xcd67('0x5c'),_0x3c6d15[_0xcd67('0x25')],util[_0xcd67('0x29')](_0x3c6d15,{'showHidden':![],'depth':null}));if(this[_0xcd67('0xb')][_0x3c6d15['uniqueid']]){for(var _0xa8648c in this[_0xcd67('0xb')][_0x3c6d15[_0xcd67('0x25')]]){if(this[_0xcd67('0xb')][_0x3c6d15['uniqueid']][_0xcd67('0x5d')](_0xa8648c)&&!this['channels'][_0x3c6d15[_0xcd67('0x25')]][_0xa8648c][_0xcd67('0x13')]&&!this[_0xcd67('0xb')][_0x3c6d15[_0xcd67('0x25')]][_0xa8648c][_0xcd67('0x15')]){logger[_0xcd67('0x24')]('[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x3c6d15[_0xcd67('0x25')],this['channels'][_0x3c6d15[_0xcd67('0x25')]][_0xa8648c][_0xcd67('0x26')],_0xa8648c);this['channels'][_0x3c6d15[_0xcd67('0x25')]][_0xa8648c][_0xcd67('0x13')]=!![];this[_0xcd67('0xb')][_0x3c6d15[_0xcd67('0x25')]][_0xa8648c][_0xcd67('0x4f')]=moment()[_0xcd67('0x37')](_0xcd67('0x2c'));this[_0xcd67('0xb')][_0x3c6d15[_0xcd67('0x25')]][_0xa8648c][_0xcd67('0x43')]=_0xcd67('0x5e');this[_0xcd67('0xb')][_0x3c6d15[_0xcd67('0x25')]][_0xa8648c][_0xcd67('0x52')]='abandoned';logger[_0xcd67('0x28')]('[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:',_0x3c6d15[_0xcd67('0x25')],util[_0xcd67('0x29')](this['channels'][_0x3c6d15[_0xcd67('0x25')]][_0xa8648c],{'showHidden':![],'depth':null}));ami[_0xcd67('0x21')](_0xcd67('0x5f'),this['channels'][_0x3c6d15[_0xcd67('0x25')]][_0xa8648c]);}}}}}catch(_0x25883c){logger[_0xcd67('0x39')](_0xcd67('0x60'),_0x3c6d15[_0xcd67('0x25')],util[_0xcd67('0x29')](_0x25883c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xcd67('0x20')]['syncAgentComplete']=function(_0x3fcb07){try{if(this['isNotNull'](_0x3fcb07)){logger['debug'](_0xcd67('0x61'),_0x3fcb07[_0xcd67('0x25')],util[_0xcd67('0x29')](_0x3fcb07,{'showHidden':![],'depth':null}));if(this['channels'][_0x3fcb07[_0xcd67('0x25')]]){for(var _0x1244f7 in this[_0xcd67('0xb')][_0x3fcb07[_0xcd67('0x25')]]){if(this[_0xcd67('0xb')][_0x3fcb07['uniqueid']][_0xcd67('0x5d')](_0x1244f7)){if(this['channels'][_0x3fcb07[_0xcd67('0x25')]][_0x1244f7][_0xcd67('0x3d')]&&!this[_0xcd67('0xb')][_0x3fcb07[_0xcd67('0x25')]][_0x1244f7][_0xcd67('0x15')]){logger[_0xcd67('0x24')](_0xcd67('0x62'),_0x3fcb07['uniqueid'],this[_0xcd67('0xb')][_0x3fcb07['uniqueid']][_0x1244f7][_0xcd67('0x26')],_0x1244f7);this[_0xcd67('0xb')][_0x3fcb07[_0xcd67('0x25')]][_0x1244f7][_0xcd67('0x15')]=!![];this[_0xcd67('0xb')][_0x3fcb07[_0xcd67('0x25')]][_0x1244f7][_0xcd67('0x63')]=moment()[_0xcd67('0x37')](_0xcd67('0x2c'));this[_0xcd67('0xb')][_0x3fcb07[_0xcd67('0x25')]][_0x1244f7][_0xcd67('0x43')]=_0xcd67('0x64');this['channels'][_0x3fcb07['uniqueid']][_0x1244f7][_0xcd67('0x52')]=_0x3fcb07[_0xcd67('0x52')]=='transfer'?_0xcd67('0x65'):_0x3fcb07[_0xcd67('0x52')];this[_0xcd67('0xb')][_0x3fcb07[_0xcd67('0x25')]][_0x1244f7][_0xcd67('0x66')]=_0x3fcb07[_0xcd67('0x66')];if(this[_0xcd67('0xd')][_0x3fcb07['queue']]&&this[_0xcd67('0xd')][_0x3fcb07[_0xcd67('0x2b')]]['acw']){this['channels'][_0x3fcb07[_0xcd67('0x25')]][_0x1244f7][_0xcd67('0x67')]=this['voiceQueues'][_0x3fcb07[_0xcd67('0x2b')]]['acwTimeout'];this[_0xcd67('0xb')][_0x3fcb07[_0xcd67('0x25')]][_0x1244f7][_0xcd67('0x68')]=!![];}this[_0xcd67('0xe')][_0x3fcb07[_0xcd67('0x2a')]]=_[_0xcd67('0x31')](this[_0xcd67('0xe')][_0x3fcb07[_0xcd67('0x2a')]],[_0xcd67('0x2b'),'destconnectedlinenum']);logger['debug'](_0xcd67('0x69'),_0x3fcb07[_0xcd67('0x25')],util[_0xcd67('0x29')](this[_0xcd67('0xb')][_0x3fcb07['uniqueid']][_0x1244f7],{'showHidden':![],'depth':null}));ami[_0xcd67('0x21')](_0xcd67('0x6a'),this[_0xcd67('0xb')][_0x3fcb07[_0xcd67('0x25')]][_0x1244f7]);logger[_0xcd67('0x28')](_0xcd67('0x6b'),_0x3fcb07[_0xcd67('0x25')],util[_0xcd67('0x29')]({'id':this[_0xcd67('0xe')][_0x3fcb07[_0xcd67('0x2a')]]['id'],'destaccountcode':_0x3fcb07[_0xcd67('0x6c')]},{'showHidden':![],'depth':null}));this[_0xcd67('0x21')](util['format'](_0xcd67('0x4c'),_0x3fcb07['membername']),_0xcd67('0x6d'),{'id':this['agents'][_0x3fcb07[_0xcd67('0x2a')]]['id'],'destaccountcode':Number(_0x3fcb07[_0xcd67('0x6c')])});}}}}}}catch(_0x579fb0){logger['error']('[%s][voiceAgentReport][agentcomplete]',_0x3fcb07[_0xcd67('0x25')],util[_0xcd67('0x29')](_0x579fb0,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncVarSet']=function(_0x4f258f){try{if(this['isNotNull'](_0x4f258f)){logger[_0xcd67('0x28')](_0xcd67('0x6e'),_0x4f258f[_0xcd67('0x25')],util[_0xcd67('0x29')](_0x4f258f,{'showHidden':![],'depth':null}));this[_0xcd67('0x6f')](_0x4f258f[_0xcd67('0x25')],_['keys'](_0x4f258f[_0xcd67('0x70')])[0x0],_0x4f258f['value']);if(this[_0xcd67('0xb')][_0x4f258f[_0xcd67('0x25')]]){for(var _0x1c3c9c in this[_0xcd67('0xb')][_0x4f258f[_0xcd67('0x25')]]){if(this[_0xcd67('0xb')][_0x4f258f[_0xcd67('0x25')]][_0xcd67('0x5d')](_0x1c3c9c)){logger[_0xcd67('0x24')](_0xcd67('0x71'),_0x4f258f['uniqueid'],_0x1c3c9c,_[_0xcd67('0x72')](_0x4f258f[_0xcd67('0x70')])[0x0],_0x4f258f[_0xcd67('0x73')]);if(_['isUndefined'](this[_0xcd67('0xb')][_0x4f258f[_0xcd67('0x25')]][_0x1c3c9c][_0xcd67('0xf')])){this[_0xcd67('0xb')][_0x4f258f[_0xcd67('0x25')]][_0x1c3c9c][_0xcd67('0xf')]={};}this[_0xcd67('0xb')][_0x4f258f[_0xcd67('0x25')]][_0x1c3c9c][_0xcd67('0xf')]=this['variables'][_0x4f258f[_0xcd67('0x25')]];}}}}}catch(_0x1a811b){logger[_0xcd67('0x39')](_0xcd67('0x74'),_0x4f258f[_0xcd67('0x25')],util[_0xcd67('0x29')](_0x1a811b,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xcd67('0x6f')]=function(_0x52ce12,_0x237b65,_0x53007a){var _0x1333f8=['rtpaudioqos',_0xcd67('0x75'),_0xcd67('0x76'),_0xcd67('0x77'),_0xcd67('0x78'),_0xcd67('0x79'),'rtpaudioqosrtt','rtpaudioqosrttbridged',_0xcd67('0x7a'),_0xcd67('0x7b'),_0xcd67('0x7c'),_0xcd67('0x7d'),_0xcd67('0x7e'),_0xcd67('0x7f'),'memberinterface',_0xcd67('0x80'),_0xcd67('0x26'),_0xcd67('0x81'),_0xcd67('0x82')];if(!_['isNil'](_0x237b65)&&!_[_0xcd67('0x83')](_0x1333f8,_0x237b65)){if(_[_0xcd67('0x23')](this[_0xcd67('0xf')][_0x52ce12])){this['variables'][_0x52ce12]={};}this[_0xcd67('0xf')][_0x52ce12][_0x237b65]=_0x53007a;}};VoiceAgentReport[_0xcd67('0x20')][_0xcd67('0x18')]=function(_0x23c0d1){try{if(this[_0xcd67('0x22')](_0x23c0d1)){logger[_0xcd67('0x28')](_0xcd67('0x84'),_0x23c0d1[_0xcd67('0x25')],util[_0xcd67('0x29')](_0x23c0d1,{'showHidden':![],'depth':null}));if(this['channels'][_0x23c0d1[_0xcd67('0x25')]]){for(var _0x445797 in this[_0xcd67('0xb')][_0x23c0d1[_0xcd67('0x25')]]){if(this['channels'][_0x23c0d1[_0xcd67('0x25')]][_0xcd67('0x5d')](_0x445797)){if(this[_0xcd67('0xb')][_0x23c0d1[_0xcd67('0x25')]][_0x445797]['reason']=='transfer'&&this[_0xcd67('0xb')][_0x23c0d1[_0xcd67('0x25')]][_0x445797][_0xcd67('0x15')]){logger[_0xcd67('0x24')]('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x23c0d1[_0xcd67('0x25')],_0x445797);this['channels'][_0x23c0d1['uniqueid']][_0x445797][_0xcd67('0x63')]=moment()[_0xcd67('0x37')](_0xcd67('0x2c'));}}}logger[_0xcd67('0x28')]('[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:',_0x23c0d1[_0xcd67('0x25')],util[_0xcd67('0x29')](_['values'](this[_0xcd67('0xb')][_0x23c0d1['uniqueid']]),{'showHidden':![],'depth':null}));ami[_0xcd67('0x21')](_0xcd67('0x85'),_[_0xcd67('0x86')](this[_0xcd67('0xb')][_0x23c0d1[_0xcd67('0x25')]]));this['deleteChannelAfterTimeout'](_0x23c0d1['uniqueid']);}if(this[_0xcd67('0xf')][_0x23c0d1[_0xcd67('0x25')]]){delete this[_0xcd67('0xf')][_0x23c0d1[_0xcd67('0x25')]];}}}catch(_0x405aed){logger[_0xcd67('0x39')](_0xcd67('0x87'),_0x23c0d1[_0xcd67('0x25')],util['inspect'](_0x405aed,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xcd67('0x1d')]=function(_0x4ece86){try{if(this['isNotNull'](_0x4ece86)){logger[_0xcd67('0x28')](_0xcd67('0x88'),_0x4ece86[_0xcd67('0x25')],util['inspect'](_0x4ece86,{'showHidden':![],'depth':null}));if(this[_0xcd67('0xb')][_0x4ece86[_0xcd67('0x89')]]){for(var _0x4abba7 in this[_0xcd67('0xb')][_0x4ece86[_0xcd67('0x89')]]){if(this[_0xcd67('0xb')][_0x4ece86[_0xcd67('0x89')]][_0xcd67('0x5d')](_0x4abba7)){if(_0x4ece86[_0xcd67('0x8a')]===_0x4abba7){logger[_0xcd67('0x24')](_0xcd67('0x8b'),_0x4ece86[_0xcd67('0x25')],this[_0xcd67('0xb')][_0x4ece86[_0xcd67('0x89')]][_0x4abba7][_0xcd67('0x26')],_0x4abba7);var _0x68ba5d=moment();this['channels'][_0x4ece86[_0xcd67('0x89')]][_0x4abba7][_0xcd67('0x15')]=!![];this[_0xcd67('0xb')][_0x4ece86[_0xcd67('0x89')]][_0x4abba7][_0xcd67('0x63')]=moment()[_0xcd67('0x37')](_0xcd67('0x2c'));this[_0xcd67('0xb')][_0x4ece86['transfereeuniqueid']][_0x4abba7][_0xcd67('0x43')]=_0xcd67('0x64');this[_0xcd67('0xb')][_0x4ece86[_0xcd67('0x89')]][_0x4abba7][_0xcd67('0x52')]=_0xcd67('0x8c');this[_0xcd67('0xb')][_0x4ece86[_0xcd67('0x89')]][_0x4abba7][_0xcd67('0x66')]=_0x68ba5d[_0xcd67('0x8d')](this[_0xcd67('0xb')][_0x4ece86['transfereeuniqueid']][_0x4abba7][_0xcd67('0x3d')],_0xcd67('0x8e'));}}}}if(this['channels'][_0x4ece86[_0xcd67('0x8f')]]){var _0x3de75f=this['channels'][_0x4ece86['secondtransfereruniqueid']];this['channels'][_0x4ece86[_0xcd67('0x8f')]]=this['channels'][_0x4ece86[_0xcd67('0x89')]];this[_0xcd67('0xb')][_0x4ece86[_0xcd67('0x89')]]=_0x3de75f;}}}catch(_0x1fe8d2){logger[_0xcd67('0x39')](_0xcd67('0x90'),_0x4ece86['uniqueid'],util[_0xcd67('0x29')](_0x1fe8d2,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xcd67('0x20')][_0xcd67('0x1f')]=function(_0x298d5e){try{if(this['isNotNull'](_0x298d5e)){logger['debug'](_0xcd67('0x91'),_0x298d5e['uniqueid'],util[_0xcd67('0x29')](_0x298d5e,{'showHidden':![],'depth':null}));if(this[_0xcd67('0xb')][_0x298d5e[_0xcd67('0x89')]]){for(var _0x2a9a74 in this[_0xcd67('0xb')][_0x298d5e[_0xcd67('0x89')]]){if(this[_0xcd67('0xb')][_0x298d5e[_0xcd67('0x89')]][_0xcd67('0x5d')](_0x2a9a74)){if(_0x298d5e[_0xcd67('0x92')]===_0x2a9a74){logger[_0xcd67('0x24')](_0xcd67('0x93'),_0x298d5e['uniqueid'],this['channels'][_0x298d5e['transfereeuniqueid']][_0x2a9a74]['membername'],_0x2a9a74);var _0x3c361d=moment();this[_0xcd67('0xb')][_0x298d5e['transfereeuniqueid']][_0x2a9a74][_0xcd67('0x15')]=!![];this[_0xcd67('0xb')][_0x298d5e[_0xcd67('0x89')]][_0x2a9a74][_0xcd67('0x63')]=_0x3c361d;this[_0xcd67('0xb')][_0x298d5e[_0xcd67('0x89')]][_0x2a9a74][_0xcd67('0x43')]=_0xcd67('0x64');this[_0xcd67('0xb')][_0x298d5e['transfereeuniqueid']][_0x2a9a74][_0xcd67('0x52')]='transfer';this[_0xcd67('0xb')][_0x298d5e[_0xcd67('0x89')]][_0x2a9a74][_0xcd67('0x66')]=_0x3c361d[_0xcd67('0x8d')](this[_0xcd67('0xb')][_0x298d5e[_0xcd67('0x89')]][_0x2a9a74][_0xcd67('0x3d')],_0xcd67('0x8e'));}}}}}}catch(_0x765f32){logger[_0xcd67('0x39')]('[%s][voiceAgentReport][blindtransfer]',_0x298d5e['uniqueid'],util[_0xcd67('0x29')](_0x765f32,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xcd67('0x20')]['syncMusicOnHoldStart']=function(_0x45a0ad){var _0x535c38='';try{if(this[_0xcd67('0x22')](_0x45a0ad)){logger[_0xcd67('0x28')](_0xcd67('0x94'),_0x45a0ad[_0xcd67('0x25')],util[_0xcd67('0x29')](_0x45a0ad,{'showHidden':![],'depth':null}));if(_0x45a0ad[_0xcd67('0x95')]){_0x535c38=_0x45a0ad['channel'][_0xcd67('0x96')](0x0,_0x45a0ad['channel'][_0xcd67('0x97')]('-'));if(this[_0xcd67('0xe')][_0x535c38]){logger[_0xcd67('0x24')]('[%s][voiceAgentReport][musiconholdstart]\x20interface:%s',_0x45a0ad['uniqueid'],_0x535c38);this[_0xcd67('0xe')][_0x535c38][_0xcd67('0x98')]=!![];}}}}catch(_0x17df23){logger[_0xcd67('0x39')](_0xcd67('0x99'),_0x45a0ad['uniqueid'],util['inspect'](_0x17df23,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xcd67('0x20')][_0xcd67('0x9a')]=function(_0x551c3d){var _0x39ecc8='';try{if(this[_0xcd67('0x22')](_0x551c3d)){logger[_0xcd67('0x28')](_0xcd67('0x9b'),_0x551c3d['uniqueid'],util[_0xcd67('0x29')](_0x551c3d,{'showHidden':![],'depth':null}));if(_0x551c3d[_0xcd67('0x95')]){_0x39ecc8=_0x551c3d[_0xcd67('0x95')][_0xcd67('0x96')](0x0,_0x551c3d['channel'][_0xcd67('0x97')]('-'));if(this[_0xcd67('0xe')][_0x39ecc8]){logger['info'](_0xcd67('0x9c'),_0x551c3d[_0xcd67('0x25')],_0x39ecc8);this[_0xcd67('0xe')][_0x39ecc8]['onhold']=![];}}}}catch(_0x1cced3){logger[_0xcd67('0x39')](_0xcd67('0x9d'),_0x551c3d[_0xcd67('0x25')],util[_0xcd67('0x29')](_0x1cced3,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xcd67('0x20')][_0xcd67('0x9e')]=function(_0x48893c,_0x285464=0x2710){if(this[_0xcd67('0xb')][_0x48893c]){setTimeout(()=>{delete this[_0xcd67('0xb')][_0x48893c];},_0x285464);}};module['exports']=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 937f63a..23abb84 100644 --- a/server/services/ami/report/voiceCallReport.js +++ b/server/services/ami/report/voiceCallReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x932d=['transfertargetuniqueid','origtransfereruniqueid','ATTENDED','origtransfererlinkedid','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','BLIND','transfereruniqueid','syncMusicOnHoldStart','[%s][voiceCallReport][musiconholdstart]\x20event:','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','mohstarttime','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','moment','path','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../rpc/setting','queue','dial','playback','NO\x20ANSWER','FAILED','ANSWERED','BUSY','redis','defaults','socket.io-emitter','channels','agents','blindTransfers','coreshowchannel','syncNewExten','newexten','newchannel','syncNewChannel','syncNewState','bind','varset','hangup','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','musiconholdstop','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','inspect','isNotNull','isUndefined','prototype','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','calleridname','debug','[%s][voiceCallReport][newcallerid]\x20event:','uniqueid','linkedid','keys','context','from-sip','split','exten','xcally-motion-preview','destconnectedlinenum','connectedlinenum','format','name','user:agentconnect','accountcode','error','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','channel','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','YYYY-MM-DD\x20HH:mm:ss','toNumber','channelstate','merge','pick','undefined','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','user:%s','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','appdata','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','starttime','duration','seconds','lastapplication','set','startsWith','cdr(','match','type','isNil','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','calleridnum','[%s][voiceCallReport][newstate]\x20event:','answered','holdtime','diff','connectedlinename','destinationchannel','disposition','membername','answertime','UserId','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','.wav49','replace','find','monitors','push','rec','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','syncMixMonitorFilename','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','calleridpreview','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','parse','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','[%s][voiceCallReport][hangup]\x20event:','deleteChannelAfterTimeout','cause-txt','endtime','billableseconds','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','length','user:agentcomplete','transferType','then','transferToInternal','getSettings','stopRecordingOnTransfer','resolve','Action','StopMixMonitor','catch','finally','webbar:stopmonitors','event','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','[%s][voiceCallReport][hangup]','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','secondtransfereruniqueid'];(function(_0x122ab9,_0x1d3fad){var _0x2620b0=function(_0x125c9d){while(--_0x125c9d){_0x122ab9['push'](_0x122ab9['shift']());}};_0x2620b0(++_0x1d3fad);}(_0x932d,0x195));var _0xd932=function(_0xcb8581,_0x446bd7){_0xcb8581=_0xcb8581-0x0;var _0x4eab07=_0x932d[_0xcb8581];return _0x4eab07;};'use strict';var _=require('lodash');var moment=require(_0xd932('0x0'));var util=require('util');var path=require(_0xd932('0x1'));var Redis=require(_0xd932('0x2'));var config=require(_0xd932('0x3'));var logger=require(_0xd932('0x4'))(_0xd932('0x5'));var ami=require(_0xd932('0x6'));var Channel=require('../model/channel');var RpcSetting=require(_0xd932('0x7'));var applications=['set',_0xd932('0x8'),'agi',_0xd932('0x9'),_0xd932('0xa'),'voicemail'];var dispositions=[_0xd932('0xb'),_0xd932('0xc'),_0xd932('0xc'),'NO\x20ANSWER',_0xd932('0xb'),_0xd932('0xb'),_0xd932('0xd'),_0xd932('0xe'),_0xd932('0xc'),_0xd932('0xc'),_0xd932('0xc')];config[_0xd932('0xf')]=_[_0xd932('0x10')](config[_0xd932('0xf')],{'host':'localhost','port':0x18eb});var io=require(_0xd932('0x11'))(new Redis(config[_0xd932('0xf')]));function VoiceCallReport(_0x5165a9){this[_0xd932('0x12')]=_0x5165a9[_0xd932('0x12')];this[_0xd932('0x13')]=_0x5165a9['agents'];this[_0xd932('0x14')]={};ami['on'](_0xd932('0x15'),this[_0xd932('0x16')]['bind'](this));ami['on'](_0xd932('0x17'),this['syncNewExten']['bind'](this));ami['on'](_0xd932('0x18'),this[_0xd932('0x19')]['bind'](this));ami['on']('newstate',this[_0xd932('0x1a')][_0xd932('0x1b')](this));ami['on'](_0xd932('0x1c'),this['syncVarSet'][_0xd932('0x1b')](this));ami['on'](_0xd932('0x1d'),this[_0xd932('0x1e')][_0xd932('0x1b')](this));ami['on'](_0xd932('0x1f'),this[_0xd932('0x20')]['bind'](this));ami['on'](_0xd932('0x21'),this[_0xd932('0x22')][_0xd932('0x1b')](this));ami['on'](_0xd932('0x23'),this['syncBlindTransfer'][_0xd932('0x1b')](this));ami['on']('musiconholdstart',this['syncMusicOnHoldStart'][_0xd932('0x1b')](this));ami['on'](_0xd932('0x24'),this[_0xd932('0x25')][_0xd932('0x1b')](this));try{logger[_0xd932('0x26')](_0xd932('0x27'));ami[_0xd932('0x28')]();}catch(_0x279c10){logger['error']('[voiceCallReport][coreshowchannels]',util[_0xd932('0x29')](_0x279c10,{'showHidden':![],'depth':null}));}}VoiceCallReport['prototype'][_0xd932('0x2a')]=function(_0x235374){return _0x235374!==null&&!_[_0xd932('0x2b')](_0x235374);};VoiceCallReport[_0xd932('0x2c')][_0xd932('0x2d')]=function(_0x20826d,_0x50fd55,_0x561619){io['to'](_0x20826d)[_0xd932('0x2d')](_0x50fd55,_0x561619);};VoiceCallReport['prototype'][_0xd932('0x20')]=function(_0x5df516){try{if(this[_0xd932('0x2a')](_0x5df516)){logger[_0xd932('0x26')](_0xd932('0x2e'),_0x5df516['uniqueid'],_0x5df516[_0xd932('0x2f')],_0x5df516['calleridnum']);logger[_0xd932('0x30')](_0xd932('0x31'),_0x5df516[_0xd932('0x32')],util[_0xd932('0x29')](_0x5df516,{'showHidden':![],'depth':null}));if(_0x5df516['uniqueid']===_0x5df516[_0xd932('0x33')]){if(!_[_0xd932('0x2b')](this[_0xd932('0x12')][_0x5df516['uniqueid']])){_['merge'](this[_0xd932('0x12')][_0x5df516['uniqueid']],_['pick'](_0x5df516,_[_0xd932('0x34')](this[_0xd932('0x12')][_0x5df516[_0xd932('0x32')]])));}}if(_0x5df516[_0xd932('0x35')]===_0xd932('0x36')){var _0x3997b4=this[_0xd932('0x13')][_0x5df516['channel'][_0xd932('0x37')]('-')[0x0]];if(_0x3997b4){if(_0x5df516[_0xd932('0x38')]==_0xd932('0x39')){_0x3997b4[_0xd932('0x3a')]=_0x5df516[_0xd932('0x3b')];this[_0xd932('0x2d')](util[_0xd932('0x3c')]('user:%s',_0x3997b4[_0xd932('0x3d')]),_0xd932('0x3e'),{'id':_0x3997b4['id'],'destaccountcode':_0x3997b4[_0xd932('0x3f')],'destconnectedlinenum':_0x5df516[_0xd932('0x3b')]});}}}}}catch(_0x4a53a5){logger[_0xd932('0x40')](_0xd932('0x41'),_0x5df516[_0xd932('0x32')],util[_0xd932('0x29')](_0x4a53a5,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xd932('0x2c')][_0xd932('0x19')]=function(_0x5b7348){try{if(this[_0xd932('0x2a')](_0x5b7348)){logger[_0xd932('0x30')](_0xd932('0x42'),_0x5b7348[_0xd932('0x32')],util[_0xd932('0x29')](_0x5b7348,{'showHidden':![],'depth':null}));if(this[_0xd932('0x12')][_0x5b7348['uniqueid']]){return;}if(_0x5b7348[_0xd932('0x43')]===_0xd932('0x44')){return;}if(_0x5b7348[_0xd932('0x32')]!==_0x5b7348[_0xd932('0x33')]&&!this[_0xd932('0x14')][_0x5b7348[_0xd932('0x33')]]){return;}logger[_0xd932('0x26')](_0xd932('0x45'),_0x5b7348[_0xd932('0x32')],_0x5b7348[_0xd932('0x35')],_0x5b7348[_0xd932('0x38')]);this[_0xd932('0x12')][_0x5b7348['uniqueid']]=new Channel();this['channels'][_0x5b7348[_0xd932('0x32')]]['starttime']=moment()[_0xd932('0x3c')](_0xd932('0x46'));this[_0xd932('0x12')][_0x5b7348['uniqueid']]['disposition']=dispositions[_[_0xd932('0x47')](_0x5b7348[_0xd932('0x48')])];_[_0xd932('0x49')](this[_0xd932('0x12')][_0x5b7348[_0xd932('0x32')]],_[_0xd932('0x4a')](_0x5b7348,_['keys'](this[_0xd932('0x12')][_0x5b7348[_0xd932('0x32')]])));if(_0x5b7348[_0xd932('0x35')]===_0xd932('0x36')){var _0x18181e=this[_0xd932('0x13')][_0x5b7348[_0xd932('0x43')]['split']('-')[0x0]];if(_0x18181e&&typeof _0x18181e[_0xd932('0x3a')]===_0xd932('0x4b')){_0x18181e['destconnectedlinenum']=_0x5b7348[_0xd932('0x38')];logger['debug'](_0xd932('0x4c'),_0x5b7348[_0xd932('0x32')],util['inspect']({'id':_0x18181e['id'],'destaccountcode':_0x18181e[_0xd932('0x3f')],'destconnectedlinenum':_0x5b7348['exten']},{'showHidden':![],'depth':null}));this[_0xd932('0x2d')](util['format'](_0xd932('0x4d'),_0x18181e[_0xd932('0x3d')]),_0xd932('0x3e'),{'id':_0x18181e['id'],'destaccountcode':_0x18181e[_0xd932('0x3f')],'destconnectedlinenum':_0x5b7348[_0xd932('0x38')]});}}}}catch(_0x223a50){logger['error']('[%s][voiceCallReport][newchannel]',_0x5b7348[_0xd932('0x32')],util[_0xd932('0x29')](_0x223a50,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xd932('0x16')]=function(_0xcde257){try{if(this['isNotNull'](_0xcde257)){logger[_0xd932('0x30')](_0xd932('0x4e'),_0xcde257[_0xd932('0x32')],util['inspect'](_0xcde257,{'showHidden':![],'depth':null}));if(_0xcde257['channel']==='OutgoingSpoolFailed'||_0xcde257[_0xd932('0x38')]==='h')return;if(_0xcde257[_0xd932('0x32')]===_0xcde257[_0xd932('0x33')]||this[_0xd932('0x14')][_0xcde257[_0xd932('0x33')]]){_0xcde257[_0xd932('0x4f')]=_0xcde257['application']?_0xcde257['application'][_0xd932('0x50')]():undefined;_0xcde257[_0xd932('0x51')]=_0xcde257[_0xd932('0x52')]||_0xcde257[_0xd932('0x51')];if(_0xcde257['appdata']&&_0xcde257[_0xd932('0x4f')]!==_0xd932('0x8')){_0xcde257['applicationdata']=_0xcde257[_0xd932('0x51')]['toLowerCase']();}logger['info'](_0xd932('0x53'),_0xcde257['uniqueid'],_0xcde257[_0xd932('0x4f')],_0xcde257[_0xd932('0x51')]);if(_[_0xd932('0x2b')](this[_0xd932('0x12')][_0xcde257[_0xd932('0x32')]])){this['channels'][_0xcde257['uniqueid']]=new Channel();this[_0xd932('0x12')][_0xcde257[_0xd932('0x32')]][_0xd932('0x54')]=_0xcde257[_0xd932('0x55')]?moment()['subtract'](moment['duration'](_0xcde257[_0xd932('0x55')])[_0xd932('0x56')](),'seconds')[_0xd932('0x3c')](_0xd932('0x46')):moment()[_0xd932('0x3c')](_0xd932('0x46'));this[_0xd932('0x12')][_0xcde257['uniqueid']]['disposition']=_0xd932('0xb');}_[_0xd932('0x49')](this[_0xd932('0x12')][_0xcde257['uniqueid']],_[_0xd932('0x4a')](_0xcde257,_[_0xd932('0x34')](this[_0xd932('0x12')][_0xcde257[_0xd932('0x32')]])));if(_['includes'](applications,_0xcde257[_0xd932('0x4f')])){this[_0xd932('0x12')][_0xcde257['uniqueid']][_0xd932('0x57')]=_0xcde257['application'];this[_0xd932('0x12')][_0xcde257[_0xd932('0x32')]]['lastdata']=_0xcde257[_0xd932('0x51')];if(_0xcde257[_0xd932('0x4f')]===_0xd932('0x58')&&_[_0xd932('0x59')](_0xcde257[_0xd932('0x51')]['toLowerCase'](),_0xd932('0x5a'))){var _0x35d008=_0xcde257[_0xd932('0x51')][_0xd932('0x37')]('=');var _0x265881=_0x35d008[0x0][_0xd932('0x50')]()[_0xd932('0x5b')](/cdr\((.*)\)/);if(_0x265881){if(_0x265881[0x1]===_0xd932('0x5c')&&!_[_0xd932('0x5d')](this['channels'][_0xcde257['uniqueid']][_0x265881[0x1]]))return;this['channels'][_0xcde257['uniqueid']][_0x265881[0x1]]=_0x35d008[0x1];}}else if(_0xcde257[_0xd932('0x4f')]===_0xd932('0x8')){this[_0xd932('0x12')][_0xcde257[_0xd932('0x32')]]['queue']=_0xcde257[_0xd932('0x51')]['split'](',')[0x0];}}}}}catch(_0x3506c0){logger[_0xd932('0x40')](_0xd932('0x5e'),_0xcde257[_0xd932('0x32')],util['inspect'](_0x3506c0,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xd932('0x2c')]['syncNewState']=function(_0x57fe58){try{if(this[_0xd932('0x2a')](_0x57fe58)){logger[_0xd932('0x26')](_0xd932('0x5f'),_0x57fe58['uniqueid'],_0x57fe58['linkedid'],_0x57fe58[_0xd932('0x2f')],_0x57fe58[_0xd932('0x60')]);logger[_0xd932('0x30')](_0xd932('0x61'),_0x57fe58[_0xd932('0x32')],util[_0xd932('0x29')](_0x57fe58,{'showHidden':![],'depth':null}));if(_0x57fe58['channelstate']!=='6')return;var _0xdb2b2a=this[_0xd932('0x13')][_0x57fe58[_0xd932('0x43')][_0xd932('0x37')]('-')[0x0]];if(_0x57fe58[_0xd932('0x32')]!==_0x57fe58[_0xd932('0x33')]){var _0x18dbea=moment();if(this['channels'][_0x57fe58[_0xd932('0x33')]]){if(!this[_0xd932('0x12')][_0x57fe58[_0xd932('0x33')]][_0xd932('0x62')]){this[_0xd932('0x12')][_0x57fe58[_0xd932('0x33')]][_0xd932('0x62')]=!![];this[_0xd932('0x12')][_0x57fe58[_0xd932('0x33')]]['answertime']=_0x18dbea[_0xd932('0x3c')](_0xd932('0x46'));if(this[_0xd932('0x12')][_0x57fe58[_0xd932('0x33')]][_0xd932('0x54')]){this[_0xd932('0x12')][_0x57fe58[_0xd932('0x33')]][_0xd932('0x63')]=_0x18dbea[_0xd932('0x64')](this[_0xd932('0x12')][_0x57fe58[_0xd932('0x33')]][_0xd932('0x54')],_0xd932('0x56'));}}this[_0xd932('0x12')][_0x57fe58['linkedid']][_0xd932('0x33')]=_0x57fe58['uniqueid'];if(_0x57fe58['calleridnum']!==_0xd932('0x39')){this[_0xd932('0x12')][_0x57fe58[_0xd932('0x33')]][_0xd932('0x3b')]=_0x57fe58[_0xd932('0x60')];}this[_0xd932('0x12')][_0x57fe58[_0xd932('0x33')]][_0xd932('0x65')]=_0x57fe58[_0xd932('0x2f')];this[_0xd932('0x12')][_0x57fe58['linkedid']][_0xd932('0x66')]=_0x57fe58['channel'];this[_0xd932('0x12')][_0x57fe58['linkedid']][_0xd932('0x67')]=dispositions[_[_0xd932('0x47')](_0x57fe58['channelstate'])];if(_0xdb2b2a){this[_0xd932('0x12')][_0x57fe58[_0xd932('0x33')]]['UserId']=_0xdb2b2a['id'];this['channels'][_0x57fe58[_0xd932('0x33')]][_0xd932('0x68')]=_0xdb2b2a[_0xd932('0x3d')];}}if(this['channels'][_0x57fe58['uniqueid']]){if(!this[_0xd932('0x12')][_0x57fe58['uniqueid']][_0xd932('0x62')]){this[_0xd932('0x12')][_0x57fe58[_0xd932('0x32')]][_0xd932('0x62')]=!![];this[_0xd932('0x12')][_0x57fe58[_0xd932('0x32')]][_0xd932('0x69')]=_0x18dbea[_0xd932('0x3c')](_0xd932('0x46'));if(this['channels'][_0x57fe58['uniqueid']]['starttime']){this[_0xd932('0x12')][_0x57fe58[_0xd932('0x32')]][_0xd932('0x63')]=_0x18dbea[_0xd932('0x64')](this[_0xd932('0x12')][_0x57fe58['uniqueid']][_0xd932('0x54')],_0xd932('0x56'));}}if(_0x57fe58[_0xd932('0x60')]!=='xcally-motion-preview'){this['channels'][_0x57fe58[_0xd932('0x32')]][_0xd932('0x3b')]=_0x57fe58['calleridnum'];}this[_0xd932('0x12')][_0x57fe58['uniqueid']][_0xd932('0x65')]=_0x57fe58[_0xd932('0x2f')];this[_0xd932('0x12')][_0x57fe58[_0xd932('0x32')]][_0xd932('0x66')]=_0x57fe58[_0xd932('0x43')];this[_0xd932('0x12')][_0x57fe58[_0xd932('0x32')]][_0xd932('0x67')]=dispositions[_['toNumber'](_0x57fe58['channelstate'])];}}else{if(this[_0xd932('0x12')][_0x57fe58[_0xd932('0x32')]]){if(_0xdb2b2a){this[_0xd932('0x12')][_0x57fe58[_0xd932('0x32')]][_0xd932('0x6a')]=_0xdb2b2a['id'];this[_0xd932('0x12')][_0x57fe58['uniqueid']]['membername']=_0xdb2b2a[_0xd932('0x3d')];}}}if(_0x57fe58[_0xd932('0x35')]===_0xd932('0x36')){if(_0xdb2b2a){_0xdb2b2a[_0xd932('0x3a')]=_0x57fe58[_0xd932('0x38')];var _0x42f7af;if(this['channels'][_0x57fe58[_0xd932('0x32')]]){_0x42f7af=this[_0xd932('0x12')][_0x57fe58[_0xd932('0x32')]][_0xd932('0x8')];}else if(this[_0xd932('0x12')][_0x57fe58['linkedid']]){_0x42f7af=this[_0xd932('0x12')][_0x57fe58[_0xd932('0x33')]][_0xd932('0x8')];}_0xdb2b2a[_0xd932('0x8')]=_0x42f7af;var _0x2bebb0={'id':_0xdb2b2a['id'],'name':_0xdb2b2a[_0xd932('0x3d')],'agentconnected':!![],'destaccountcode':_0xdb2b2a['accountcode'],'destconnectedlinenum':_0x57fe58[_0xd932('0x38')],'queue':_0x42f7af||undefined,'uniqueid':_0x57fe58['linkedid']};logger['debug']('[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:',_0x57fe58['uniqueid'],util['inspect'](_0x2bebb0,{'showHidden':![],'depth':null}));this[_0xd932('0x2d')](util['format'](_0xd932('0x4d'),_0xdb2b2a[_0xd932('0x3d')]),_0xd932('0x3e'),_0x2bebb0);}}}}catch(_0x165bc3){logger[_0xd932('0x40')]('[%s][voiceCallReport][newstate]',_0x57fe58['uniqueid'],util[_0xd932('0x29')](_0x165bc3,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xd932('0x2c')]['syncMixMonitorFilename']=function(_0x695fbc,_0x360675){try{if(this[_0xd932('0x12')][_0x695fbc]){logger['info'](_0xd932('0x6b'),_0x695fbc,_0x360675);this[_0xd932('0x12')][_0x695fbc][_0xd932('0x6c')]=!![];if(_[_0xd932('0x6d')](_0x360675,_0xd932('0x6e'))){_0x360675=_0x360675[_0xd932('0x6f')]('.wav49','.WAV');}this[_0xd932('0x12')][_0x695fbc]['monitorFilename']=_0x360675;var _0x215704=_[_0xd932('0x70')](this[_0xd932('0x12')][_0x695fbc][_0xd932('0x71')],{'filename':_0x360675});if(_[_0xd932('0x5d')](_0x215704)){this[_0xd932('0x12')][_0x695fbc]['monitors'][_0xd932('0x72')]({'filename':_0x360675,'createdAt':moment()[_0xd932('0x3c')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':_0xd932('0x73')});}}}catch(_0x353666){logger[_0xd932('0x40')]('[%s][voiceCallReport][mixMonitorFilename]',_0x695fbc,util[_0xd932('0x29')](_0x353666,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncVarSet']=function(_0x1c214d){try{if(this[_0xd932('0x2a')](_0x1c214d)){logger[_0xd932('0x30')](_0xd932('0x74'),_0x1c214d['uniqueid'],util[_0xd932('0x29')](_0x1c214d,{'showHidden':![],'depth':null}));if(this[_0xd932('0x12')][_0x1c214d[_0xd932('0x32')]]&&_0x1c214d[_0xd932('0x43')]!=_0xd932('0x44')){if(this[_0xd932('0x2a')](_0x1c214d[_0xd932('0x75')])){if(this['isNotNull'](_0x1c214d['variable'][_0xd932('0x76')])){logger[_0xd932('0x26')](_0xd932('0x77'),_0x1c214d[_0xd932('0x32')],_0x1c214d[_0xd932('0x78')]);this[_0xd932('0x79')](_0x1c214d[_0xd932('0x32')],_0x1c214d[_0xd932('0x78')]);}else if(this[_0xd932('0x2a')](_0x1c214d[_0xd932('0x75')][_0xd932('0x7a')])){logger['info'](_0xd932('0x7b'),_0x1c214d['uniqueid'],_0x1c214d[_0xd932('0x78')]);this[_0xd932('0x12')][_0x1c214d[_0xd932('0x32')]][_0xd932('0x60')]=_0x1c214d[_0xd932('0x78')];}else if(this['isNotNull'](_0x1c214d[_0xd932('0x75')][_0xd932('0x7c')])){logger[_0xd932('0x26')](_0xd932('0x7d'),_0x1c214d[_0xd932('0x32')],_0x1c214d[_0xd932('0x78')]);this[_0xd932('0x12')][_0x1c214d['uniqueid']][_0xd932('0x7e')]=_0x1c214d[_0xd932('0x78')];}else if(this['isNotNull'](_0x1c214d[_0xd932('0x75')][_0xd932('0x7f')])){logger[_0xd932('0x26')]('[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x1c214d[_0xd932('0x32')],_0x1c214d['value']);this[_0xd932('0x12')][_0x1c214d[_0xd932('0x32')]][_0xd932('0x5c')]=_0x1c214d[_0xd932('0x78')];}else if(this[_0xd932('0x2a')](_0x1c214d[_0xd932('0x75')]['xmd-queue'])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s',_0x1c214d[_0xd932('0x32')],_0x1c214d[_0xd932('0x78')]['split'](',')[0x0]);this['channels'][_0x1c214d[_0xd932('0x32')]][_0xd932('0x8')]=_0x1c214d['value'][_0xd932('0x37')](',')[0x0];}else if(this[_0xd932('0x2a')](_0x1c214d['variable'][_0xd932('0x80')])){logger[_0xd932('0x26')](_0xd932('0x81'),_0x1c214d[_0xd932('0x32')],_0x1c214d[_0xd932('0x78')]);this[_0xd932('0x12')][_0x1c214d[_0xd932('0x32')]][_0xd932('0x82')]=_0x1c214d[_0xd932('0x78')];}else if(this[_0xd932('0x2a')](_0x1c214d[_0xd932('0x75')][_0xd932('0x83')])){logger[_0xd932('0x26')](_0xd932('0x84'),_0x1c214d[_0xd932('0x32')],_0x1c214d[_0xd932('0x78')]);this['channels'][_0x1c214d['uniqueid']][_0xd932('0x85')]=_0x1c214d[_0xd932('0x78')];}else if(this[_0xd932('0x2a')](_0x1c214d[_0xd932('0x75')][_0xd932('0x86')])){logger[_0xd932('0x26')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s',_0x1c214d[_0xd932('0x32')],_0x1c214d[_0xd932('0x78')]);this[_0xd932('0x12')][_0x1c214d[_0xd932('0x32')]][_0xd932('0x87')]=_0x1c214d[_0xd932('0x78')];}else if(this[_0xd932('0x2a')](_0x1c214d['variable']['xmcs-queue'])){logger[_0xd932('0x26')](_0xd932('0x88'),_0x1c214d[_0xd932('0x32')],_0x1c214d['value']);this[_0xd932('0x12')][_0x1c214d[_0xd932('0x32')]][_0xd932('0x8')]=_0x1c214d['value'];}else if(this[_0xd932('0x2a')](_0x1c214d['variable'][_0xd932('0x89')])){logger[_0xd932('0x26')]('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x1c214d[_0xd932('0x32')],_0x1c214d[_0xd932('0x78')]);this[_0xd932('0x12')][_0x1c214d[_0xd932('0x32')]]['sipcalluniqueid']=_0x1c214d['value'];}}}else if(this[_0xd932('0x2a')](_0x1c214d[_0xd932('0x75')][_0xd932('0x76')])){if(_0x1c214d[_0xd932('0x78')]){var _0x31973b=path[_0xd932('0x8a')](_0x1c214d['value'])[_0xd932('0x3d')];logger[_0xd932('0x26')](_0xd932('0x77'),_0x31973b,_0x1c214d['value']);this['syncMixMonitorFilename'](_0x31973b,_0x1c214d[_0xd932('0x78')]);}}else if(this[_0xd932('0x12')][_0x1c214d[_0xd932('0x33')]]){if(this[_0xd932('0x2a')](_0x1c214d[_0xd932('0x75')])){if(this[_0xd932('0x2a')](_0x1c214d[_0xd932('0x75')][_0xd932('0x89')])){logger[_0xd932('0x26')](_0xd932('0x8b'),_0x1c214d[_0xd932('0x33')],_0x1c214d['value']);this[_0xd932('0x12')][_0x1c214d[_0xd932('0x33')]]['sipcalllinkedid']=_0x1c214d[_0xd932('0x78')];}}}}}catch(_0x57a26c){logger[_0xd932('0x40')]('[%s][voiceCallReport][varset]',_0x1c214d[_0xd932('0x32')],util[_0xd932('0x29')](_0x57a26c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xd932('0x2c')][_0xd932('0x1e')]=function(_0x5a1a10){try{if(this['isNotNull'](_0x5a1a10)){logger['debug'](_0xd932('0x8c'),_0x5a1a10[_0xd932('0x32')],util[_0xd932('0x29')](_0x5a1a10,{'showHidden':![],'depth':null}));if(this[_0xd932('0x14')][_0x5a1a10[_0xd932('0x33')]]){if(this[_0xd932('0x12')][this[_0xd932('0x14')][_0x5a1a10['linkedid']][_0xd932('0x33')]]){this[_0xd932('0x12')][this[_0xd932('0x14')][_0x5a1a10[_0xd932('0x33')]][_0xd932('0x33')]][_0xd932('0x32')]=_0x5a1a10['uniqueid'];this[_0xd932('0x12')][this['blindTransfers'][_0x5a1a10[_0xd932('0x33')]][_0xd932('0x33')]][_0xd932('0x62')]=this[_0xd932('0x12')][_0x5a1a10[_0xd932('0x32')]]['answered'];this[_0xd932('0x12')][this[_0xd932('0x14')][_0x5a1a10[_0xd932('0x33')]][_0xd932('0x33')]][_0xd932('0x69')]=this[_0xd932('0x12')][_0x5a1a10[_0xd932('0x32')]]['answertime'];this[_0xd932('0x12')][this['blindTransfers'][_0x5a1a10[_0xd932('0x33')]][_0xd932('0x33')]][_0xd932('0x66')]=this[_0xd932('0x12')][this[_0xd932('0x14')][_0x5a1a10['linkedid']][_0xd932('0x33')]][_0xd932('0x43')];this[_0xd932('0x12')][this[_0xd932('0x14')][_0x5a1a10[_0xd932('0x33')]][_0xd932('0x33')]][_0xd932('0x67')]=this['channels'][_0x5a1a10['uniqueid']][_0xd932('0x67')];this[_0xd932('0x12')][_0x5a1a10['uniqueid']]=this[_0xd932('0x12')][this['blindTransfers'][_0x5a1a10['linkedid']][_0xd932('0x33')]];this[_0xd932('0x8d')](this[_0xd932('0x14')][_0x5a1a10[_0xd932('0x33')]]['linkedid']);}else if(this[_0xd932('0x12')][this['blindTransfers'][_0x5a1a10[_0xd932('0x33')]]['uniqueid']]){this[_0xd932('0x12')][this[_0xd932('0x14')][_0x5a1a10[_0xd932('0x33')]][_0xd932('0x32')]][_0xd932('0x32')]=[this[_0xd932('0x12')][this[_0xd932('0x14')][_0x5a1a10[_0xd932('0x33')]][_0xd932('0x32')]]['linkedid'],this[_0xd932('0x12')][this[_0xd932('0x14')][_0x5a1a10[_0xd932('0x33')]][_0xd932('0x32')]][_0xd932('0x33')]=this[_0xd932('0x12')][this[_0xd932('0x14')][_0x5a1a10['linkedid']][_0xd932('0x32')]][_0xd932('0x32')]][0x0];this['channels'][this[_0xd932('0x14')][_0x5a1a10[_0xd932('0x33')]][_0xd932('0x32')]]['answered']=this['channels'][_0x5a1a10[_0xd932('0x32')]][_0xd932('0x62')];this[_0xd932('0x12')][this['blindTransfers'][_0x5a1a10[_0xd932('0x33')]][_0xd932('0x32')]][_0xd932('0x69')]=this['channels'][_0x5a1a10[_0xd932('0x32')]][_0xd932('0x69')];this['channels'][this['blindTransfers'][_0x5a1a10[_0xd932('0x33')]][_0xd932('0x32')]][_0xd932('0x66')]=this[_0xd932('0x12')][this[_0xd932('0x14')][_0x5a1a10['linkedid']][_0xd932('0x32')]]['channel'];this[_0xd932('0x12')][this['blindTransfers'][_0x5a1a10['linkedid']]['uniqueid']][_0xd932('0x67')]=this[_0xd932('0x12')][_0x5a1a10[_0xd932('0x32')]]['disposition'];this[_0xd932('0x12')][_0x5a1a10[_0xd932('0x32')]]=this[_0xd932('0x12')][this[_0xd932('0x14')][_0x5a1a10[_0xd932('0x33')]]['uniqueid']];this[_0xd932('0x8d')](this[_0xd932('0x14')][_0x5a1a10[_0xd932('0x33')]][_0xd932('0x32')]);}}if(this[_0xd932('0x12')][_0x5a1a10[_0xd932('0x32')]]){logger[_0xd932('0x26')]('[%s][voiceCallReport][hangup]\x20reason:%s',_0x5a1a10[_0xd932('0x32')],_0x5a1a10[_0xd932('0x8e')]);var _0x3f986f=moment();this[_0xd932('0x12')][_0x5a1a10[_0xd932('0x32')]][_0xd932('0x8f')]=_0x3f986f[_0xd932('0x3c')](_0xd932('0x46'));this[_0xd932('0x12')][_0x5a1a10[_0xd932('0x32')]]['duration']=_0x3f986f[_0xd932('0x64')](this[_0xd932('0x12')][_0x5a1a10['uniqueid']]['starttime'],'seconds');if(this[_0xd932('0x12')][_0x5a1a10[_0xd932('0x32')]][_0xd932('0x62')]){this[_0xd932('0x12')][_0x5a1a10[_0xd932('0x32')]][_0xd932('0x90')]=_0x3f986f['diff'](this[_0xd932('0x12')][_0x5a1a10['uniqueid']]['answertime'],_0xd932('0x56'));this['channels'][_0x5a1a10['uniqueid']][_0xd932('0x63')]=this[_0xd932('0x12')][_0x5a1a10[_0xd932('0x32')]][_0xd932('0x55')]-this['channels'][_0x5a1a10['uniqueid']]['billableseconds'];}if(_0x5a1a10['context']===_0xd932('0x36')){if(this[_0xd932('0x13')][_0x5a1a10['channel'][_0xd932('0x37')]('-')[0x0]]){this['agents'][_0x5a1a10['channel'][_0xd932('0x37')]('-')[0x0]]=_['omit'](this[_0xd932('0x13')][_0x5a1a10[_0xd932('0x43')]['split']('-')[0x0]],[_0xd932('0x3a')]);logger[_0xd932('0x30')](_0xd932('0x91'),_0x5a1a10[_0xd932('0x32')],util['inspect']({'id':this[_0xd932('0x13')][_0x5a1a10[_0xd932('0x43')][_0xd932('0x37')]('-')[0x0]]['id'],'destaccountcode':this[_0xd932('0x13')][_0x5a1a10[_0xd932('0x43')][_0xd932('0x37')]('-')[0x0]][_0xd932('0x3f')]},{'showHidden':![],'depth':null}));this[_0xd932('0x2d')](util[_0xd932('0x3c')]('user:%s',this[_0xd932('0x13')][_0x5a1a10['channel']['split']('-')[0x0]][_0xd932('0x3d')]),'user:agentcomplete',{'id':this[_0xd932('0x13')][_0x5a1a10[_0xd932('0x43')]['split']('-')[0x0]]['id'],'destaccountcode':this[_0xd932('0x13')][_0x5a1a10[_0xd932('0x43')][_0xd932('0x37')]('-')[0x0]][_0xd932('0x3f')]});for(var _0xbf6969=0x0;_0xbf6969{delete this[_0xd932('0x12')][_0x14a3df];},_0x4a2947);}};module[_0xd932('0xbf')]=VoiceCallReport; \ No newline at end of file +var _0x81e2=['event','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','origtransfereruniqueid','some','origtransfererlinkedid','routeid','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','[%s][voiceCallReport][blindtransfer]\x20event:','extension','BLIND','BlindTransfer','transfereruniqueid','transfererchannel','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','mohtime','[%s][voiceCallReport][musiconholdstop]','exports','lodash','ioredis','../../../config/environment','../../../config/logger','ami','../ami','set','queue','agi','dial','playback','voicemail','NO\x20ANSWER','FAILED','redis','defaults','socket.io-emitter','channels','agents','blindTransfers','coreshowchannel','syncNewExten','bind','newexten','newstate','syncNewState','varset','syncVarSet','hangup','syncNewCallerId','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','inspect','isUndefined','prototype','emit','isNotNull','info','uniqueid','calleridname','calleridnum','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','merge','pick','keys','from-sip','channel','exten','xcally-motion-preview','destconnectedlinenum','connectedlinenum','format','user:%s','user:agentconnect','accountcode','[%s][voiceCallReport][newcallerid]','debug','[%s][voiceCallReport][newchannel]\x20event:','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','context','YYYY-MM-DD\x20HH:mm:ss','channelstate','undefined','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','name','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','OutgoingSpoolFailed','application','toLowerCase','applicationdata','appdata','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','starttime','duration','subtract','seconds','includes','lastapplication','lastdata','cdr(','split','match','type','isNil','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','holdtime','diff','connectedlinename','toNumber','UserId','membername','destinationchannel','disposition','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','.WAV','monitorFilename','find','monitors','push','rec','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','callerid','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','parse','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','sipcallid','[%s][voiceCallReport][varset]','syncHangup','[%s][voiceCallReport][hangup]\x20event:','deleteChannelAfterTimeout','endtime','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','transferType','then','transferToInternal','isEmpty','getSettings','stopRecordingOnTransfer','Action','StopMixMonitor','catch','finally','webbar:stopmonitors'];(function(_0x408e22,_0x11f001){var _0x23d2bd=function(_0x3a2014){while(--_0x3a2014){_0x408e22['push'](_0x408e22['shift']());}};_0x23d2bd(++_0x11f001);}(_0x81e2,0x1b1));var _0x281e=function(_0x679374,_0x39f72a){_0x679374=_0x679374-0x0;var _0x31f720=_0x81e2[_0x679374];return _0x31f720;};'use strict';var _=require(_0x281e('0x0'));var moment=require('moment');var util=require('util');var path=require('path');var Redis=require(_0x281e('0x1'));var config=require(_0x281e('0x2'));var logger=require(_0x281e('0x3'))(_0x281e('0x4'));var ami=require(_0x281e('0x5'));var Channel=require('../model/channel');var RpcSetting=require('../rpc/setting');var applications=[_0x281e('0x6'),_0x281e('0x7'),_0x281e('0x8'),_0x281e('0x9'),_0x281e('0xa'),_0x281e('0xb')];var dispositions=[_0x281e('0xc'),_0x281e('0xd'),_0x281e('0xd'),_0x281e('0xc'),_0x281e('0xc'),_0x281e('0xc'),'ANSWERED','BUSY',_0x281e('0xd'),_0x281e('0xd'),_0x281e('0xd')];config[_0x281e('0xe')]=_[_0x281e('0xf')](config[_0x281e('0xe')],{'host':'localhost','port':0x18eb});var io=require(_0x281e('0x10'))(new Redis(config[_0x281e('0xe')]));function VoiceCallReport(_0x131750){this[_0x281e('0x11')]=_0x131750[_0x281e('0x11')];this[_0x281e('0x12')]=_0x131750[_0x281e('0x12')];this[_0x281e('0x13')]={};ami['on'](_0x281e('0x14'),this[_0x281e('0x15')][_0x281e('0x16')](this));ami['on'](_0x281e('0x17'),this['syncNewExten'][_0x281e('0x16')](this));ami['on']('newchannel',this['syncNewChannel']['bind'](this));ami['on'](_0x281e('0x18'),this[_0x281e('0x19')]['bind'](this));ami['on'](_0x281e('0x1a'),this[_0x281e('0x1b')][_0x281e('0x16')](this));ami['on'](_0x281e('0x1c'),this['syncHangup']['bind'](this));ami['on']('newcallerid',this[_0x281e('0x1d')][_0x281e('0x16')](this));ami['on']('attendedtransfer',this[_0x281e('0x1e')][_0x281e('0x16')](this));ami['on'](_0x281e('0x1f'),this[_0x281e('0x20')][_0x281e('0x16')](this));ami['on'](_0x281e('0x21'),this[_0x281e('0x22')][_0x281e('0x16')](this));ami['on'](_0x281e('0x23'),this[_0x281e('0x24')][_0x281e('0x16')](this));try{logger['info'](_0x281e('0x25'));ami[_0x281e('0x26')]();}catch(_0x51507a){logger[_0x281e('0x27')](_0x281e('0x28'),util[_0x281e('0x29')](_0x51507a,{'showHidden':![],'depth':null}));}}VoiceCallReport['prototype']['isNotNull']=function(_0x36147a){return _0x36147a!==null&&!_[_0x281e('0x2a')](_0x36147a);};VoiceCallReport[_0x281e('0x2b')][_0x281e('0x2c')]=function(_0x122b8a,_0x12ab82,_0x201da0){io['to'](_0x122b8a)[_0x281e('0x2c')](_0x12ab82,_0x201da0);};VoiceCallReport['prototype'][_0x281e('0x1d')]=function(_0x5a0a88){try{if(this[_0x281e('0x2d')](_0x5a0a88)){logger[_0x281e('0x2e')]('[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s',_0x5a0a88[_0x281e('0x2f')],_0x5a0a88[_0x281e('0x30')],_0x5a0a88[_0x281e('0x31')]);logger['debug'](_0x281e('0x32'),_0x5a0a88['uniqueid'],util[_0x281e('0x29')](_0x5a0a88,{'showHidden':![],'depth':null}));if(_0x5a0a88[_0x281e('0x2f')]===_0x5a0a88[_0x281e('0x33')]){if(!_['isUndefined'](this[_0x281e('0x11')][_0x5a0a88['uniqueid']])){_[_0x281e('0x34')](this[_0x281e('0x11')][_0x5a0a88[_0x281e('0x2f')]],_[_0x281e('0x35')](_0x5a0a88,_[_0x281e('0x36')](this[_0x281e('0x11')][_0x5a0a88['uniqueid']])));}}if(_0x5a0a88['context']===_0x281e('0x37')){var _0x2e9727=this['agents'][_0x5a0a88[_0x281e('0x38')]['split']('-')[0x0]];if(_0x2e9727){if(_0x5a0a88[_0x281e('0x39')]==_0x281e('0x3a')){_0x2e9727[_0x281e('0x3b')]=_0x5a0a88[_0x281e('0x3c')];this[_0x281e('0x2c')](util[_0x281e('0x3d')](_0x281e('0x3e'),_0x2e9727['name']),_0x281e('0x3f'),{'id':_0x2e9727['id'],'destaccountcode':_0x2e9727[_0x281e('0x40')],'destconnectedlinenum':_0x5a0a88[_0x281e('0x3c')]});}}}}}catch(_0x5251e6){logger[_0x281e('0x27')](_0x281e('0x41'),_0x5a0a88[_0x281e('0x2f')],util[_0x281e('0x29')](_0x5251e6,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncNewChannel']=function(_0x3a9db0){try{if(this[_0x281e('0x2d')](_0x3a9db0)){logger[_0x281e('0x42')](_0x281e('0x43'),_0x3a9db0[_0x281e('0x2f')],util['inspect'](_0x3a9db0,{'showHidden':![],'depth':null}));if(this[_0x281e('0x11')][_0x3a9db0[_0x281e('0x2f')]]){return;}if(_0x3a9db0[_0x281e('0x38')]==='OutgoingSpoolFailed'){return;}if(_0x3a9db0[_0x281e('0x2f')]!==_0x3a9db0[_0x281e('0x33')]&&!this[_0x281e('0x13')][_0x3a9db0['linkedid']]){return;}logger[_0x281e('0x2e')](_0x281e('0x44'),_0x3a9db0[_0x281e('0x2f')],_0x3a9db0[_0x281e('0x45')],_0x3a9db0['exten']);this[_0x281e('0x11')][_0x3a9db0[_0x281e('0x2f')]]=new Channel();this[_0x281e('0x11')][_0x3a9db0[_0x281e('0x2f')]]['starttime']=moment()[_0x281e('0x3d')](_0x281e('0x46'));this[_0x281e('0x11')][_0x3a9db0[_0x281e('0x2f')]]['disposition']=dispositions[_['toNumber'](_0x3a9db0[_0x281e('0x47')])];_['merge'](this['channels'][_0x3a9db0[_0x281e('0x2f')]],_['pick'](_0x3a9db0,_['keys'](this['channels'][_0x3a9db0[_0x281e('0x2f')]])));if(_0x3a9db0['context']===_0x281e('0x37')){var _0x5f3d22=this['agents'][_0x3a9db0[_0x281e('0x38')]['split']('-')[0x0]];if(_0x5f3d22&&typeof _0x5f3d22[_0x281e('0x3b')]===_0x281e('0x48')){_0x5f3d22[_0x281e('0x3b')]=_0x3a9db0[_0x281e('0x39')];logger[_0x281e('0x42')](_0x281e('0x49'),_0x3a9db0[_0x281e('0x2f')],util[_0x281e('0x29')]({'id':_0x5f3d22['id'],'destaccountcode':_0x5f3d22[_0x281e('0x40')],'destconnectedlinenum':_0x3a9db0[_0x281e('0x39')]},{'showHidden':![],'depth':null}));this['emit'](util[_0x281e('0x3d')]('user:%s',_0x5f3d22[_0x281e('0x4a')]),_0x281e('0x3f'),{'id':_0x5f3d22['id'],'destaccountcode':_0x5f3d22[_0x281e('0x40')],'destconnectedlinenum':_0x3a9db0[_0x281e('0x39')]});}}}}catch(_0xe6fe54){logger['error'](_0x281e('0x4b'),_0x3a9db0['uniqueid'],util['inspect'](_0xe6fe54,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x281e('0x2b')]['syncNewExten']=function(_0x931305){try{if(this[_0x281e('0x2d')](_0x931305)){logger[_0x281e('0x42')](_0x281e('0x4c'),_0x931305[_0x281e('0x2f')],util[_0x281e('0x29')](_0x931305,{'showHidden':![],'depth':null}));if(_0x931305[_0x281e('0x38')]===_0x281e('0x4d')||_0x931305['exten']==='h')return;if(_0x931305[_0x281e('0x2f')]===_0x931305[_0x281e('0x33')]||this[_0x281e('0x13')][_0x931305['linkedid']]){_0x931305[_0x281e('0x4e')]=_0x931305[_0x281e('0x4e')]?_0x931305[_0x281e('0x4e')][_0x281e('0x4f')]():undefined;_0x931305[_0x281e('0x50')]=_0x931305['appdata']||_0x931305['applicationdata'];if(_0x931305[_0x281e('0x51')]&&_0x931305[_0x281e('0x4e')]!=='queue'){_0x931305[_0x281e('0x50')]=_0x931305[_0x281e('0x50')][_0x281e('0x4f')]();}logger[_0x281e('0x2e')](_0x281e('0x52'),_0x931305[_0x281e('0x2f')],_0x931305['application'],_0x931305[_0x281e('0x50')]);if(_[_0x281e('0x2a')](this[_0x281e('0x11')][_0x931305[_0x281e('0x2f')]])){this[_0x281e('0x11')][_0x931305[_0x281e('0x2f')]]=new Channel();this['channels'][_0x931305[_0x281e('0x2f')]][_0x281e('0x53')]=_0x931305[_0x281e('0x54')]?moment()[_0x281e('0x55')](moment[_0x281e('0x54')](_0x931305['duration'])[_0x281e('0x56')](),'seconds')[_0x281e('0x3d')](_0x281e('0x46')):moment()['format'](_0x281e('0x46'));this[_0x281e('0x11')][_0x931305[_0x281e('0x2f')]]['disposition']=_0x281e('0xc');}_[_0x281e('0x34')](this[_0x281e('0x11')][_0x931305[_0x281e('0x2f')]],_['pick'](_0x931305,_[_0x281e('0x36')](this[_0x281e('0x11')][_0x931305[_0x281e('0x2f')]])));if(_[_0x281e('0x57')](applications,_0x931305['application'])){this[_0x281e('0x11')][_0x931305['uniqueid']][_0x281e('0x58')]=_0x931305[_0x281e('0x4e')];this[_0x281e('0x11')][_0x931305[_0x281e('0x2f')]][_0x281e('0x59')]=_0x931305[_0x281e('0x50')];if(_0x931305[_0x281e('0x4e')]===_0x281e('0x6')&&_['startsWith'](_0x931305['applicationdata'][_0x281e('0x4f')](),_0x281e('0x5a'))){var _0x46b3f4=_0x931305['applicationdata'][_0x281e('0x5b')]('=');var _0x27e799=_0x46b3f4[0x0][_0x281e('0x4f')]()[_0x281e('0x5c')](/cdr\((.*)\)/);if(_0x27e799){if(_0x27e799[0x1]===_0x281e('0x5d')&&!_[_0x281e('0x5e')](this[_0x281e('0x11')][_0x931305[_0x281e('0x2f')]][_0x27e799[0x1]]))return;this[_0x281e('0x11')][_0x931305[_0x281e('0x2f')]][_0x27e799[0x1]]=_0x46b3f4[0x1];}}else if(_0x931305[_0x281e('0x4e')]===_0x281e('0x7')){this['channels'][_0x931305[_0x281e('0x2f')]][_0x281e('0x7')]=_0x931305[_0x281e('0x50')][_0x281e('0x5b')](',')[0x0];}}}}}catch(_0x31ab51){logger[_0x281e('0x27')](_0x281e('0x5f'),_0x931305[_0x281e('0x2f')],util[_0x281e('0x29')](_0x31ab51,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x281e('0x2b')][_0x281e('0x19')]=function(_0x5b7ee0){try{if(this[_0x281e('0x2d')](_0x5b7ee0)){logger['info'](_0x281e('0x60'),_0x5b7ee0['uniqueid'],_0x5b7ee0['linkedid'],_0x5b7ee0[_0x281e('0x30')],_0x5b7ee0[_0x281e('0x31')]);logger['debug'](_0x281e('0x61'),_0x5b7ee0['uniqueid'],util[_0x281e('0x29')](_0x5b7ee0,{'showHidden':![],'depth':null}));if(_0x5b7ee0['channelstate']!=='6')return;var _0x2a375d=this['agents'][_0x5b7ee0[_0x281e('0x38')][_0x281e('0x5b')]('-')[0x0]];if(_0x5b7ee0['uniqueid']!==_0x5b7ee0[_0x281e('0x33')]){var _0x4cd61c=moment();if(this[_0x281e('0x11')][_0x5b7ee0[_0x281e('0x33')]]){if(!this['channels'][_0x5b7ee0[_0x281e('0x33')]][_0x281e('0x62')]){this[_0x281e('0x11')][_0x5b7ee0['linkedid']][_0x281e('0x62')]=!![];this[_0x281e('0x11')][_0x5b7ee0[_0x281e('0x33')]][_0x281e('0x63')]=_0x4cd61c['format'](_0x281e('0x46'));if(this[_0x281e('0x11')][_0x5b7ee0[_0x281e('0x33')]][_0x281e('0x53')]){this[_0x281e('0x11')][_0x5b7ee0[_0x281e('0x33')]][_0x281e('0x64')]=_0x4cd61c[_0x281e('0x65')](this[_0x281e('0x11')][_0x5b7ee0[_0x281e('0x33')]][_0x281e('0x53')],'seconds');}}this['channels'][_0x5b7ee0[_0x281e('0x33')]][_0x281e('0x33')]=_0x5b7ee0[_0x281e('0x2f')];if(_0x5b7ee0['calleridnum']!==_0x281e('0x3a')){this[_0x281e('0x11')][_0x5b7ee0[_0x281e('0x33')]][_0x281e('0x3c')]=_0x5b7ee0[_0x281e('0x31')];}this[_0x281e('0x11')][_0x5b7ee0[_0x281e('0x33')]][_0x281e('0x66')]=_0x5b7ee0[_0x281e('0x30')];this[_0x281e('0x11')][_0x5b7ee0[_0x281e('0x33')]]['destinationchannel']=_0x5b7ee0[_0x281e('0x38')];this['channels'][_0x5b7ee0[_0x281e('0x33')]]['disposition']=dispositions[_[_0x281e('0x67')](_0x5b7ee0[_0x281e('0x47')])];if(_0x2a375d){this[_0x281e('0x11')][_0x5b7ee0[_0x281e('0x33')]][_0x281e('0x68')]=_0x2a375d['id'];this[_0x281e('0x11')][_0x5b7ee0['linkedid']][_0x281e('0x69')]=_0x2a375d[_0x281e('0x4a')];}}if(this['channels'][_0x5b7ee0[_0x281e('0x2f')]]){if(!this[_0x281e('0x11')][_0x5b7ee0[_0x281e('0x2f')]][_0x281e('0x62')]){this['channels'][_0x5b7ee0['uniqueid']][_0x281e('0x62')]=!![];this['channels'][_0x5b7ee0['uniqueid']][_0x281e('0x63')]=_0x4cd61c[_0x281e('0x3d')](_0x281e('0x46'));if(this['channels'][_0x5b7ee0[_0x281e('0x2f')]][_0x281e('0x53')]){this[_0x281e('0x11')][_0x5b7ee0[_0x281e('0x2f')]]['holdtime']=_0x4cd61c[_0x281e('0x65')](this[_0x281e('0x11')][_0x5b7ee0[_0x281e('0x2f')]]['starttime'],_0x281e('0x56'));}}if(_0x5b7ee0[_0x281e('0x31')]!==_0x281e('0x3a')){this[_0x281e('0x11')][_0x5b7ee0[_0x281e('0x2f')]][_0x281e('0x3c')]=_0x5b7ee0[_0x281e('0x31')];}this[_0x281e('0x11')][_0x5b7ee0[_0x281e('0x2f')]][_0x281e('0x66')]=_0x5b7ee0[_0x281e('0x30')];this[_0x281e('0x11')][_0x5b7ee0[_0x281e('0x2f')]][_0x281e('0x6a')]=_0x5b7ee0[_0x281e('0x38')];this[_0x281e('0x11')][_0x5b7ee0[_0x281e('0x2f')]][_0x281e('0x6b')]=dispositions[_[_0x281e('0x67')](_0x5b7ee0[_0x281e('0x47')])];}}else{if(this[_0x281e('0x11')][_0x5b7ee0[_0x281e('0x2f')]]){if(_0x2a375d){this[_0x281e('0x11')][_0x5b7ee0[_0x281e('0x2f')]][_0x281e('0x68')]=_0x2a375d['id'];this[_0x281e('0x11')][_0x5b7ee0[_0x281e('0x2f')]][_0x281e('0x69')]=_0x2a375d[_0x281e('0x4a')];}}}if(_0x5b7ee0['context']===_0x281e('0x37')){if(_0x2a375d){_0x2a375d['destconnectedlinenum']=_0x5b7ee0['exten'];var _0xc17290;if(this[_0x281e('0x11')][_0x5b7ee0['uniqueid']]){_0xc17290=this[_0x281e('0x11')][_0x5b7ee0['uniqueid']][_0x281e('0x7')];}else if(this[_0x281e('0x11')][_0x5b7ee0[_0x281e('0x33')]]){_0xc17290=this[_0x281e('0x11')][_0x5b7ee0['linkedid']]['queue'];}_0x2a375d['queue']=_0xc17290;var _0x4b5c9a={'id':_0x2a375d['id'],'name':_0x2a375d[_0x281e('0x4a')],'agentconnected':!![],'destaccountcode':_0x2a375d[_0x281e('0x40')],'destconnectedlinenum':_0x5b7ee0['exten'],'queue':_0xc17290||undefined,'uniqueid':_0x5b7ee0[_0x281e('0x33')]};logger['debug'](_0x281e('0x6c'),_0x5b7ee0[_0x281e('0x2f')],util['inspect'](_0x4b5c9a,{'showHidden':![],'depth':null}));this[_0x281e('0x2c')](util[_0x281e('0x3d')]('user:%s',_0x2a375d[_0x281e('0x4a')]),'user:agentconnect',_0x4b5c9a);}}}}catch(_0x1654a8){logger[_0x281e('0x27')](_0x281e('0x6d'),_0x5b7ee0[_0x281e('0x2f')],util[_0x281e('0x29')](_0x1654a8,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x281e('0x6e')]=function(_0x3e8936,_0x280d3b){try{if(this[_0x281e('0x11')][_0x3e8936]){logger[_0x281e('0x2e')](_0x281e('0x6f'),_0x3e8936,_0x280d3b);this[_0x281e('0x11')][_0x3e8936][_0x281e('0x70')]=!![];if(_[_0x281e('0x71')](_0x280d3b,'.wav49')){_0x280d3b=_0x280d3b['replace']('.wav49',_0x281e('0x72'));}this['channels'][_0x3e8936][_0x281e('0x73')]=_0x280d3b;var _0x43d206=_[_0x281e('0x74')](this['channels'][_0x3e8936]['monitors'],{'filename':_0x280d3b});if(_[_0x281e('0x5e')](_0x43d206)){this[_0x281e('0x11')][_0x3e8936][_0x281e('0x75')][_0x281e('0x76')]({'filename':_0x280d3b,'createdAt':moment()[_0x281e('0x3d')](_0x281e('0x46')),'mixmonitorid':'','status':_0x281e('0x77')});}}}catch(_0x73f1cc){logger[_0x281e('0x27')](_0x281e('0x78'),_0x3e8936,util[_0x281e('0x29')](_0x73f1cc,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x281e('0x2b')]['syncVarSet']=function(_0x3dc237){try{if(this['isNotNull'](_0x3dc237)){logger['debug'](_0x281e('0x79'),_0x3dc237[_0x281e('0x2f')],util[_0x281e('0x29')](_0x3dc237,{'showHidden':![],'depth':null}));if(this[_0x281e('0x11')][_0x3dc237[_0x281e('0x2f')]]&&_0x3dc237[_0x281e('0x38')]!=_0x281e('0x4d')){if(this[_0x281e('0x2d')](_0x3dc237[_0x281e('0x7a')])){if(this[_0x281e('0x2d')](_0x3dc237[_0x281e('0x7a')][_0x281e('0x7b')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x3dc237[_0x281e('0x2f')],_0x3dc237['value']);this[_0x281e('0x6e')](_0x3dc237[_0x281e('0x2f')],_0x3dc237[_0x281e('0x7c')]);}else if(this[_0x281e('0x2d')](_0x3dc237[_0x281e('0x7a')][_0x281e('0x7d')])){logger[_0x281e('0x2e')](_0x281e('0x7e'),_0x3dc237['uniqueid'],_0x3dc237['value']);this[_0x281e('0x11')][_0x3dc237[_0x281e('0x2f')]]['calleridnum']=_0x3dc237[_0x281e('0x7c')];}else if(this[_0x281e('0x2d')](_0x3dc237[_0x281e('0x7a')][_0x281e('0x7f')])){logger[_0x281e('0x2e')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s',_0x3dc237[_0x281e('0x2f')],_0x3dc237[_0x281e('0x7c')]);this[_0x281e('0x11')][_0x3dc237[_0x281e('0x2f')]][_0x281e('0x80')]=_0x3dc237[_0x281e('0x7c')];}else if(this[_0x281e('0x2d')](_0x3dc237[_0x281e('0x7a')]['xmd-cdrtype'])){logger[_0x281e('0x2e')](_0x281e('0x81'),_0x3dc237[_0x281e('0x2f')],_0x3dc237['value']);this['channels'][_0x3dc237['uniqueid']][_0x281e('0x5d')]=_0x3dc237[_0x281e('0x7c')];}else if(this[_0x281e('0x2d')](_0x3dc237[_0x281e('0x7a')]['xmd-queue'])){logger[_0x281e('0x2e')]('[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s',_0x3dc237[_0x281e('0x2f')],_0x3dc237[_0x281e('0x7c')]['split'](',')[0x0]);this[_0x281e('0x11')][_0x3dc237[_0x281e('0x2f')]]['queue']=_0x3dc237[_0x281e('0x7c')]['split'](',')[0x0];}else if(this[_0x281e('0x2d')](_0x3dc237['variable'][_0x281e('0x82')])){logger[_0x281e('0x2e')](_0x281e('0x83'),_0x3dc237[_0x281e('0x2f')],_0x3dc237[_0x281e('0x7c')]);this['channels'][_0x3dc237[_0x281e('0x2f')]][_0x281e('0x84')]=_0x3dc237[_0x281e('0x7c')];}else if(this[_0x281e('0x2d')](_0x3dc237[_0x281e('0x7a')][_0x281e('0x85')])){logger['info'](_0x281e('0x86'),_0x3dc237[_0x281e('0x2f')],_0x3dc237['value']);this[_0x281e('0x11')][_0x3dc237[_0x281e('0x2f')]]['destination']=_0x3dc237['value'];}else if(this[_0x281e('0x2d')](_0x3dc237[_0x281e('0x7a')]['xmd-callerid-preview'])){logger[_0x281e('0x2e')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s',_0x3dc237[_0x281e('0x2f')],_0x3dc237[_0x281e('0x7c')]);this['channels'][_0x3dc237[_0x281e('0x2f')]][_0x281e('0x87')]=_0x3dc237['value'];}else if(this[_0x281e('0x2d')](_0x3dc237['variable'][_0x281e('0x88')])){logger['info'](_0x281e('0x89'),_0x3dc237[_0x281e('0x2f')],_0x3dc237[_0x281e('0x7c')]);this[_0x281e('0x11')][_0x3dc237[_0x281e('0x2f')]][_0x281e('0x7')]=_0x3dc237['value'];}else if(this[_0x281e('0x2d')](_0x3dc237[_0x281e('0x7a')]['sipcallid'])){logger[_0x281e('0x2e')](_0x281e('0x8a'),_0x3dc237[_0x281e('0x2f')],_0x3dc237['value']);this['channels'][_0x3dc237['uniqueid']]['sipcalluniqueid']=_0x3dc237[_0x281e('0x7c')];}}}else if(this[_0x281e('0x2d')](_0x3dc237[_0x281e('0x7a')][_0x281e('0x7b')])){if(_0x3dc237[_0x281e('0x7c')]){var _0x3413ed=path[_0x281e('0x8b')](_0x3dc237[_0x281e('0x7c')])[_0x281e('0x4a')];logger['info'](_0x281e('0x8c'),_0x3413ed,_0x3dc237[_0x281e('0x7c')]);this[_0x281e('0x6e')](_0x3413ed,_0x3dc237[_0x281e('0x7c')]);}}else if(this[_0x281e('0x11')][_0x3dc237[_0x281e('0x33')]]){if(this[_0x281e('0x2d')](_0x3dc237[_0x281e('0x7a')])){if(this[_0x281e('0x2d')](_0x3dc237[_0x281e('0x7a')][_0x281e('0x8d')])){logger[_0x281e('0x2e')](_0x281e('0x8a'),_0x3dc237['linkedid'],_0x3dc237[_0x281e('0x7c')]);this[_0x281e('0x11')][_0x3dc237[_0x281e('0x33')]]['sipcalllinkedid']=_0x3dc237[_0x281e('0x7c')];}}}}}catch(_0x5e8893){logger[_0x281e('0x27')](_0x281e('0x8e'),_0x3dc237['uniqueid'],util['inspect'](_0x5e8893,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x281e('0x2b')][_0x281e('0x8f')]=function(_0x2e67db){try{if(this[_0x281e('0x2d')](_0x2e67db)){logger['debug'](_0x281e('0x90'),_0x2e67db[_0x281e('0x2f')],util[_0x281e('0x29')](_0x2e67db,{'showHidden':![],'depth':null}));if(this[_0x281e('0x13')][_0x2e67db[_0x281e('0x33')]]){if(this['channels'][this[_0x281e('0x13')][_0x2e67db[_0x281e('0x33')]][_0x281e('0x33')]]){this[_0x281e('0x11')][this[_0x281e('0x13')][_0x2e67db['linkedid']][_0x281e('0x33')]][_0x281e('0x2f')]=_0x2e67db[_0x281e('0x2f')];this['channels'][this[_0x281e('0x13')][_0x2e67db['linkedid']][_0x281e('0x33')]]['answered']=this[_0x281e('0x11')][_0x2e67db[_0x281e('0x2f')]][_0x281e('0x62')];this[_0x281e('0x11')][this[_0x281e('0x13')][_0x2e67db['linkedid']][_0x281e('0x33')]][_0x281e('0x63')]=this['channels'][_0x2e67db[_0x281e('0x2f')]]['answertime'];this[_0x281e('0x11')][this[_0x281e('0x13')][_0x2e67db['linkedid']][_0x281e('0x33')]][_0x281e('0x6a')]=this[_0x281e('0x11')][this[_0x281e('0x13')][_0x2e67db[_0x281e('0x33')]][_0x281e('0x33')]]['channel'];this[_0x281e('0x11')][this[_0x281e('0x13')][_0x2e67db[_0x281e('0x33')]][_0x281e('0x33')]][_0x281e('0x6b')]=this[_0x281e('0x11')][_0x2e67db[_0x281e('0x2f')]]['disposition'];this[_0x281e('0x11')][_0x2e67db['uniqueid']]=this[_0x281e('0x11')][this[_0x281e('0x13')][_0x2e67db[_0x281e('0x33')]]['linkedid']];this[_0x281e('0x91')](this['blindTransfers'][_0x2e67db['linkedid']]['linkedid']);}else if(this[_0x281e('0x11')][this[_0x281e('0x13')][_0x2e67db[_0x281e('0x33')]][_0x281e('0x2f')]]){this['channels'][this[_0x281e('0x13')][_0x2e67db[_0x281e('0x33')]][_0x281e('0x2f')]][_0x281e('0x2f')]=[this[_0x281e('0x11')][this['blindTransfers'][_0x2e67db[_0x281e('0x33')]]['uniqueid']][_0x281e('0x33')],this[_0x281e('0x11')][this[_0x281e('0x13')][_0x2e67db[_0x281e('0x33')]][_0x281e('0x2f')]][_0x281e('0x33')]=this[_0x281e('0x11')][this[_0x281e('0x13')][_0x2e67db[_0x281e('0x33')]][_0x281e('0x2f')]][_0x281e('0x2f')]][0x0];this[_0x281e('0x11')][this[_0x281e('0x13')][_0x2e67db[_0x281e('0x33')]]['uniqueid']][_0x281e('0x62')]=this[_0x281e('0x11')][_0x2e67db['uniqueid']]['answered'];this[_0x281e('0x11')][this[_0x281e('0x13')][_0x2e67db[_0x281e('0x33')]][_0x281e('0x2f')]][_0x281e('0x63')]=this[_0x281e('0x11')][_0x2e67db[_0x281e('0x2f')]]['answertime'];this['channels'][this[_0x281e('0x13')][_0x2e67db['linkedid']][_0x281e('0x2f')]][_0x281e('0x6a')]=this[_0x281e('0x11')][this[_0x281e('0x13')][_0x2e67db[_0x281e('0x33')]][_0x281e('0x2f')]][_0x281e('0x38')];this[_0x281e('0x11')][this['blindTransfers'][_0x2e67db['linkedid']][_0x281e('0x2f')]][_0x281e('0x6b')]=this['channels'][_0x2e67db[_0x281e('0x2f')]][_0x281e('0x6b')];this[_0x281e('0x11')][_0x2e67db['uniqueid']]=this[_0x281e('0x11')][this[_0x281e('0x13')][_0x2e67db[_0x281e('0x33')]][_0x281e('0x2f')]];this[_0x281e('0x91')](this['blindTransfers'][_0x2e67db[_0x281e('0x33')]][_0x281e('0x2f')]);}}if(this[_0x281e('0x11')][_0x2e67db[_0x281e('0x2f')]]){logger[_0x281e('0x2e')]('[%s][voiceCallReport][hangup]\x20reason:%s',_0x2e67db['uniqueid'],_0x2e67db['cause-txt']);var _0x4aa7ba=moment();this[_0x281e('0x11')][_0x2e67db[_0x281e('0x2f')]][_0x281e('0x92')]=_0x4aa7ba['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x281e('0x11')][_0x2e67db['uniqueid']][_0x281e('0x54')]=_0x4aa7ba[_0x281e('0x65')](this[_0x281e('0x11')][_0x2e67db['uniqueid']][_0x281e('0x53')],_0x281e('0x56'));if(this[_0x281e('0x11')][_0x2e67db['uniqueid']][_0x281e('0x62')]){this[_0x281e('0x11')][_0x2e67db['uniqueid']]['billableseconds']=_0x4aa7ba[_0x281e('0x65')](this[_0x281e('0x11')][_0x2e67db[_0x281e('0x2f')]][_0x281e('0x63')],_0x281e('0x56'));this[_0x281e('0x11')][_0x2e67db[_0x281e('0x2f')]][_0x281e('0x64')]=this[_0x281e('0x11')][_0x2e67db['uniqueid']][_0x281e('0x54')]-this[_0x281e('0x11')][_0x2e67db['uniqueid']]['billableseconds'];}if(_0x2e67db['context']===_0x281e('0x37')){if(this[_0x281e('0x12')][_0x2e67db[_0x281e('0x38')][_0x281e('0x5b')]('-')[0x0]]){this[_0x281e('0x12')][_0x2e67db[_0x281e('0x38')][_0x281e('0x5b')]('-')[0x0]]=_[_0x281e('0x93')](this['agents'][_0x2e67db[_0x281e('0x38')][_0x281e('0x5b')]('-')[0x0]],['destconnectedlinenum']);logger[_0x281e('0x42')](_0x281e('0x94'),_0x2e67db[_0x281e('0x2f')],util['inspect']({'id':this[_0x281e('0x12')][_0x2e67db[_0x281e('0x38')][_0x281e('0x5b')]('-')[0x0]]['id'],'destaccountcode':this[_0x281e('0x12')][_0x2e67db[_0x281e('0x38')][_0x281e('0x5b')]('-')[0x0]][_0x281e('0x40')]},{'showHidden':![],'depth':null}));this[_0x281e('0x2c')](util[_0x281e('0x3d')](_0x281e('0x3e'),this[_0x281e('0x12')][_0x2e67db[_0x281e('0x38')][_0x281e('0x5b')]('-')[0x0]][_0x281e('0x4a')]),_0x281e('0x95'),{'id':this[_0x281e('0x12')][_0x2e67db[_0x281e('0x38')][_0x281e('0x5b')]('-')[0x0]]['id'],'destaccountcode':this[_0x281e('0x12')][_0x2e67db[_0x281e('0x38')]['split']('-')[0x0]][_0x281e('0x40')]});for(var _0x23c264=0x0;_0x23c264{delete this[_0x281e('0x11')][_0x4516ac];},_0x957b8f);}};module[_0x281e('0xc5')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index d5ada6b..d60b16b 100644 --- a/server/services/ami/report/voiceDialReport.js +++ b/server/services/ami/report/voiceDialReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc95e=['prototype','isNotNull','emit','syncDialBegin','[%s][voiceDialReport][dialbegin]\x20event:','inspect','uniqueid','merge','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','lastIndexOf','omit','event','privilege','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','interface','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','debug','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','lastevent','connect','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','voice_outbound_channel:save','addVariable','keys','variable','value','outboundrouteid','isUndefined','voice','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','variables','[%s][voiceDialReport][hangup]\x20event:','info','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','diff','starttime','complete','total','answered','seconds','billableseconds','sumHoldTime','holdtime','sumBillable','sumDuration','duration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','voice_outbound_channel:remove','deleteChannelAfterTimeout','linkedid','[%s][voiceDialReport][hangup]','syncNewExten','application','applicationdata','toLowerCase','startsWith','cdr(','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','split','match','[%s][voiceDialReport][newexten]','lodash','moment','ioredis','../../../config/environment','redis','socket.io-emitter','channels','outbound','applications','dialbegin','bind','dialend','syncDialEnd','syncVarSet','syncHangup'];(function(_0x10de99,_0xdd42d){var _0x8550e5=function(_0x3c1aae){while(--_0x3c1aae){_0x10de99['push'](_0x10de99['shift']());}};_0x8550e5(++_0xdd42d);}(_0xc95e,0x14d));var _0xec95=function(_0x57d815,_0x125da6){_0x57d815=_0x57d815-0x0;var _0x36f969=_0xc95e[_0x57d815];return _0x36f969;};'use strict';var _=require(_0xec95('0x0'));var moment=require(_0xec95('0x1'));var util=require('util');var Redis=require(_0xec95('0x2'));var config=require(_0xec95('0x3'));var logger=require('../../../config/logger')('ami');var ami=require('../ami');config[_0xec95('0x4')]=_['defaults'](config[_0xec95('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xec95('0x5'))(new Redis(config[_0xec95('0x4')]));function VoiceDialReport(_0x164243){this[_0xec95('0x6')]=_0x164243['outboundChannels'];this[_0xec95('0x7')]=_0x164243[_0xec95('0x7')];this[_0xec95('0x8')]={};this['variables']={};ami['on'](_0xec95('0x9'),this['syncDialBegin'][_0xec95('0xa')](this));ami['on'](_0xec95('0xb'),this[_0xec95('0xc')][_0xec95('0xa')](this));ami['on']('varset',this[_0xec95('0xd')][_0xec95('0xa')](this));ami['on']('hangup',this[_0xec95('0xe')][_0xec95('0xa')](this));}VoiceDialReport[_0xec95('0xf')][_0xec95('0x10')]=function(_0x121c5b){return _0x121c5b!==null&&!_['isUndefined'](_0x121c5b);};VoiceDialReport[_0xec95('0xf')][_0xec95('0x11')]=function(_0x2b80fe,_0x1d5b6c,_0x3df470){io['to'](_0x2b80fe)[_0xec95('0x11')](_0x1d5b6c,_0x3df470);};VoiceDialReport['prototype'][_0xec95('0x12')]=function(_0x26b4fa){try{if(this['isNotNull'](_0x26b4fa)){logger['debug'](_0xec95('0x13'),_0x26b4fa['uniqueid'],util[_0xec95('0x14')](_0x26b4fa,{'showHidden':![],'depth':null}));if(this[_0xec95('0x6')][_0x26b4fa[_0xec95('0x15')]]){_[_0xec95('0x16')](this[_0xec95('0x6')][_0x26b4fa['uniqueid']],{'starttime':moment()['format'](_0xec95('0x17')),'lastevent':_0xec95('0x18'),'interface':_0x26b4fa[_0xec95('0x19')][_0xec95('0x1a')](0x0,_0x26b4fa['channel']['lastIndexOf']('-')),'membername':_0x26b4fa[_0xec95('0x19')][_0xec95('0x1a')](_0x26b4fa['channel']['lastIndexOf']('/')+0x1,_0x26b4fa[_0xec95('0x19')][_0xec95('0x1b')]('-'))},_[_0xec95('0x1c')](_0x26b4fa,[_0xec95('0x1d'),_0xec95('0x1e')]));logger['info'](_0xec95('0x1f'),_0x26b4fa[_0xec95('0x15')],this[_0xec95('0x6')][_0x26b4fa['uniqueid']][_0xec95('0x20')],this[_0xec95('0x6')][_0x26b4fa[_0xec95('0x15')]][_0xec95('0x21')]);logger['debug'](_0xec95('0x22'),_0x26b4fa['uniqueid'],util[_0xec95('0x14')](this[_0xec95('0x6')][_0x26b4fa[_0xec95('0x15')]],{'showHidden':![],'depth':null}));if(this[_0xec95('0x8')][_0x26b4fa[_0xec95('0x15')]])_[_0xec95('0x16')](this[_0xec95('0x6')][_0x26b4fa[_0xec95('0x15')]],this[_0xec95('0x8')][_0x26b4fa[_0xec95('0x15')]]);this[_0xec95('0x11')]('voice:outbound','voice_outbound_channel:save',this[_0xec95('0x6')][_0x26b4fa[_0xec95('0x15')]]);logger[_0xec95('0x23')](_0xec95('0x24'),_0x26b4fa[_0xec95('0x15')],util['inspect'](this[_0xec95('0x6')][_0x26b4fa[_0xec95('0x15')]],{'showHidden':![],'depth':null}));ami[_0xec95('0x11')](_0xec95('0x25'),this[_0xec95('0x6')][_0x26b4fa[_0xec95('0x15')]]);}}}catch(_0x57670d){logger[_0xec95('0x26')]('[%s][voiceDialReport][dialbegin]',_0x26b4fa[_0xec95('0x15')],util['inspect'](_0x57670d,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xec95('0xf')]['syncDialEnd']=function(_0x3fdaca){try{if(this['isNotNull'](_0x3fdaca)){logger[_0xec95('0x23')]('[%s][voiceDialReport][dialend]\x20event:',_0x3fdaca[_0xec95('0x15')],util[_0xec95('0x14')](_0x3fdaca,{'showHidden':![],'depth':null}));if(this['channels'][_0x3fdaca[_0xec95('0x15')]]){this[_0xec95('0x6')][_0x3fdaca[_0xec95('0x15')]][_0xec95('0x27')]=_0x3fdaca[_0xec95('0x27')];if(_0x3fdaca[_0xec95('0x27')]===_0xec95('0x28')){this[_0xec95('0x6')][_0x3fdaca['uniqueid']][_0xec95('0x29')]=_0x3fdaca[_0xec95('0x29')];this['channels'][_0x3fdaca[_0xec95('0x15')]][_0xec95('0x2a')]=_0x3fdaca['connectedlinename'];this[_0xec95('0x6')][_0x3fdaca[_0xec95('0x15')]][_0xec95('0x2b')]=moment()['format'](_0xec95('0x17'));this[_0xec95('0x6')][_0x3fdaca[_0xec95('0x15')]][_0xec95('0x2c')]=_0xec95('0x2d');logger['info']('[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect',_0x3fdaca[_0xec95('0x15')],_0x3fdaca[_0xec95('0x19')][_0xec95('0x1a')](_0x3fdaca[_0xec95('0x19')][_0xec95('0x1b')]('/')+0x1,_0x3fdaca[_0xec95('0x19')][_0xec95('0x1b')]('-')));logger[_0xec95('0x23')]('[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:',_0x3fdaca[_0xec95('0x15')],util[_0xec95('0x14')](this[_0xec95('0x6')][_0x3fdaca[_0xec95('0x15')]],{'showHidden':![],'depth':null}));ami[_0xec95('0x11')](_0xec95('0x2e'),this[_0xec95('0x6')][_0x3fdaca['uniqueid']]);}logger[_0xec95('0x23')](_0xec95('0x2f'),_0x3fdaca[_0xec95('0x15')],util[_0xec95('0x14')](this[_0xec95('0x6')][_0x3fdaca[_0xec95('0x15')]],{'showHidden':![],'depth':null}));this['emit'](_0xec95('0x30'),_0xec95('0x31'),this[_0xec95('0x6')][_0x3fdaca['uniqueid']]);}}}catch(_0x581ea3){logger[_0xec95('0x26')]('[%s][voiceDialReport][dialend]',_0x3fdaca[_0xec95('0x15')],util[_0xec95('0x14')](_0x581ea3,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype']['syncVarSet']=function(_0x459351){try{if(this[_0xec95('0x10')](_0x459351)){logger[_0xec95('0x23')]('[%s][voiceDialReport][varset]\x20event:',_0x459351[_0xec95('0x15')],util['inspect'](_0x459351,{'showHidden':![],'depth':null}));this[_0xec95('0x32')](_0x459351[_0xec95('0x15')],_[_0xec95('0x33')](_0x459351[_0xec95('0x34')])[0x0],_0x459351[_0xec95('0x35')]);if(this[_0xec95('0x10')](_0x459351[_0xec95('0x34')])&&this['isNotNull'](_0x459351[_0xec95('0x34')][_0xec95('0x36')])){if(_[_0xec95('0x37')](this[_0xec95('0x6')][_0x459351[_0xec95('0x15')]])){this[_0xec95('0x6')][_0x459351['uniqueid']]={'routeId':_0x459351[_0xec95('0x35')],'variables':this['variables'][_0x459351['uniqueid']],'motionChannel':_0xec95('0x38')};logger['info'](_0xec95('0x39'),_0x459351[_0xec95('0x15')],_0x459351['variable'][_0xec95('0x36')],_['keys'](_0x459351[_0xec95('0x34')])[0x0],_0x459351[_0xec95('0x35')]);logger[_0xec95('0x23')](_0xec95('0x3a'),_0x459351['uniqueid'],util[_0xec95('0x14')](this['channels'][_0x459351['uniqueid']],{'showHidden':![],'depth':null}));this[_0xec95('0x11')](_0xec95('0x30'),_0xec95('0x31'),this['channels'][_0x459351['uniqueid']]);}}}}catch(_0x123fa7){logger['error'](_0xec95('0x3b'),_0x459351['uniqueid'],util[_0xec95('0x14')](_0x123fa7,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xec95('0xf')][_0xec95('0x32')]=function(_0x1c5704,_0x470aa6,_0x1c328a){var _0x12c658=['rtpaudioqos',_0xec95('0x3c'),_0xec95('0x3d'),_0xec95('0x3e'),_0xec95('0x3f'),_0xec95('0x40'),_0xec95('0x41'),_0xec95('0x42'),_0xec95('0x43'),_0xec95('0x44'),_0xec95('0x45'),_0xec95('0x46'),_0xec95('0x47'),'memberdynamic',_0xec95('0x48'),_0xec95('0x49'),_0xec95('0x20'),_0xec95('0x4a'),_0xec95('0x4b')];if(!_[_0xec95('0x4c')](_0x470aa6)&&!_['includes'](_0x12c658,_0x470aa6)){if(_[_0xec95('0x37')](this['variables'][_0x1c5704])){this[_0xec95('0x4d')][_0x1c5704]={};}this[_0xec95('0x4d')][_0x1c5704][_0x470aa6]=_0x1c328a;}};VoiceDialReport['prototype'][_0xec95('0xe')]=function(_0x13ce07){try{if(this[_0xec95('0x10')](_0x13ce07)){logger[_0xec95('0x23')](_0xec95('0x4e'),_0x13ce07['uniqueid'],util[_0xec95('0x14')](_0x13ce07,{'showHidden':![],'depth':null}));if(this[_0xec95('0x6')][_0x13ce07[_0xec95('0x15')]]){logger[_0xec95('0x4f')](_0xec95('0x50'),_0x13ce07[_0xec95('0x15')],_0x13ce07[_0xec95('0x51')]);this[_0xec95('0x6')][_0x13ce07[_0xec95('0x15')]][_0xec95('0x52')]=moment()['format'](_0xec95('0x17'));this[_0xec95('0x6')][_0x13ce07['uniqueid']]['duration']=moment(this[_0xec95('0x6')][_0x13ce07['uniqueid']]['endtime'])[_0xec95('0x53')](this[_0xec95('0x6')][_0x13ce07[_0xec95('0x15')]][_0xec95('0x54')],'seconds');this['channels'][_0x13ce07[_0xec95('0x15')]][_0xec95('0x2c')]=_0xec95('0x55');this[_0xec95('0x7')][_0xec95('0x56')]+=0x1;if(this[_0xec95('0x6')][_0x13ce07[_0xec95('0x15')]][_0xec95('0x2b')]){this[_0xec95('0x7')][_0xec95('0x57')]+=0x1;this[_0xec95('0x6')][_0x13ce07['uniqueid']]['holdtime']=moment(this[_0xec95('0x6')][_0x13ce07[_0xec95('0x15')]]['answertime'])['diff'](this['channels'][_0x13ce07[_0xec95('0x15')]][_0xec95('0x54')],_0xec95('0x58'));this['channels'][_0x13ce07['uniqueid']][_0xec95('0x59')]=moment(this[_0xec95('0x6')][_0x13ce07[_0xec95('0x15')]][_0xec95('0x52')])[_0xec95('0x53')](this[_0xec95('0x6')][_0x13ce07[_0xec95('0x15')]][_0xec95('0x2b')],_0xec95('0x58'));this[_0xec95('0x7')][_0xec95('0x5a')]+=this[_0xec95('0x6')][_0x13ce07[_0xec95('0x15')]][_0xec95('0x5b')]||0x0;this[_0xec95('0x7')][_0xec95('0x5c')]+=this[_0xec95('0x6')][_0x13ce07[_0xec95('0x15')]][_0xec95('0x59')];}this[_0xec95('0x7')][_0xec95('0x5d')]+=this['channels'][_0x13ce07[_0xec95('0x15')]][_0xec95('0x5e')];logger['debug'](_0xec95('0x5f'),_0x13ce07[_0xec95('0x15')],util[_0xec95('0x14')](this[_0xec95('0x6')][_0x13ce07[_0xec95('0x15')]],{'showHidden':![],'depth':null}));ami[_0xec95('0x11')](_0xec95('0x60'),this['channels'][_0x13ce07[_0xec95('0x15')]]);logger[_0xec95('0x23')]('[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:',_0x13ce07['uniqueid'],util['inspect'](this['channels'][_0x13ce07[_0xec95('0x15')]],{'showHidden':![],'depth':null}));ami[_0xec95('0x11')](_0xec95('0x61'),this['channels'][_0x13ce07['uniqueid']]);logger[_0xec95('0x23')](_0xec95('0x62'),_0x13ce07[_0xec95('0x15')],util[_0xec95('0x14')](this[_0xec95('0x6')][_0x13ce07[_0xec95('0x15')]],{'showHidden':![],'depth':null}));this[_0xec95('0x11')]('voice:outbound',_0xec95('0x63'),this[_0xec95('0x7')]);logger['info'](_0xec95('0x64'),JSON[_0xec95('0x65')](this[_0xec95('0x6')][_0x13ce07[_0xec95('0x15')]]));logger[_0xec95('0x23')]('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:',_0x13ce07[_0xec95('0x15')],util['inspect'](this[_0xec95('0x6')][_0x13ce07[_0xec95('0x15')]],{'showHidden':![],'depth':null}));this[_0xec95('0x11')](_0xec95('0x30'),_0xec95('0x66'),this[_0xec95('0x6')][_0x13ce07[_0xec95('0x15')]]);this[_0xec95('0x67')](_0x13ce07['uniqueid']);}else if(this['channels'][_0x13ce07['linkedid']]){this['channels'][_0x13ce07[_0xec95('0x68')]][_0xec95('0x15')]=this[_0xec95('0x6')][_0x13ce07[_0xec95('0x68')]]['destuniqueid'];}if(this[_0xec95('0x4d')][_0x13ce07[_0xec95('0x15')]]){delete this['variables'][_0x13ce07[_0xec95('0x15')]];}}}catch(_0x5d74fc){logger[_0xec95('0x26')](_0xec95('0x69'),_0x13ce07[_0xec95('0x15')],util[_0xec95('0x14')](_0x5d74fc,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xec95('0xf')][_0xec95('0x6a')]=function(_0x249aed){try{if(this['isNotNull'](_0x249aed)){logger['debug']('[%s][voiceDialReport][newexten]\x20event:',_0x249aed[_0xec95('0x15')],util[_0xec95('0x14')](_0x249aed,{'showHidden':![],'depth':null}));if(_0x249aed[_0xec95('0x6b')]['toLowerCase']()==='set'){_0x249aed[_0xec95('0x6c')]=(_0x249aed['appdata']||_0x249aed['applicationdata'])[_0xec95('0x6d')]();if(_[_0xec95('0x6e')](_0x249aed['applicationdata'],_0xec95('0x6f'))){if(_[_0xec95('0x37')](this[_0xec95('0x8')][_0x249aed[_0xec95('0x15')]]))this[_0xec95('0x8')][_0x249aed[_0xec95('0x15')]]={};logger['info'](_0xec95('0x70'),_0x249aed[_0xec95('0x15')],_0x249aed['application'],_0x249aed['applicationdata']);var _0x3d63ef=_0x249aed['applicationdata'][_0xec95('0x71')]('=');var _0x1f5e6b=_0x3d63ef[0x0][_0xec95('0x72')](/cdr\((.*)\)/);if(_0x1f5e6b)this[_0xec95('0x8')][_0x249aed[_0xec95('0x15')]][_0x1f5e6b[0x1]]=_0x3d63ef[0x1];}}}}catch(_0x31f212){logger[_0xec95('0x26')](_0xec95('0x73'),_0x249aed[_0xec95('0x15')],util['inspect'](_0x31f212,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xec95('0xf')][_0xec95('0x67')]=function(_0x3e1902,_0x19d18f=0x2710){if(this['channels'][_0x3e1902]){setTimeout(()=>{delete this[_0xec95('0x6')][_0x3e1902];},_0x19d18f);}};module['exports']=VoiceDialReport; \ No newline at end of file +var _0xe715=['voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error','[%s][voiceDialReport][dialbegin]','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','answertime','lastevent','connect','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','isNotNull','[%s][voiceDialReport][varset]\x20event:','addVariable','keys','variable','value','outboundrouteid','isUndefined','variables','info','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','membername','memberpenalty','memberrealtime','isNil','includes','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','endtime','duration','starttime','seconds','complete','total','answered','holdtime','diff','sumHoldTime','sumBillable','billableseconds','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','deleteChannelAfterTimeout','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','[%s][voiceDialReport][newexten]\x20event:','application','toLowerCase','set','applicationdata','appdata','startsWith','cdr(','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','split','exports','lodash','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','channels','outboundChannels','outbound','applications','dialbegin','bind','dialend','syncDialEnd','varset','syncVarSet','syncHangup','prototype','emit','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','format','YYYY-MM-DD\x20HH:mm:ss','channel','substring','lastIndexOf','omit','event','privilege','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','interface','debug','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','inspect','merge'];(function(_0x197344,_0x2a19a5){var _0x45088d=function(_0x559f71){while(--_0x559f71){_0x197344['push'](_0x197344['shift']());}};_0x45088d(++_0x2a19a5);}(_0xe715,0x153));var _0x5e71=function(_0x40fdec,_0x3ca33b){_0x40fdec=_0x40fdec-0x0;var _0x2a047c=_0xe715[_0x40fdec];return _0x2a047c;};'use strict';var _=require(_0x5e71('0x0'));var moment=require('moment');var util=require(_0x5e71('0x1'));var Redis=require(_0x5e71('0x2'));var config=require(_0x5e71('0x3'));var logger=require(_0x5e71('0x4'))(_0x5e71('0x5'));var ami=require(_0x5e71('0x6'));config[_0x5e71('0x7')]=_[_0x5e71('0x8')](config[_0x5e71('0x7')],{'host':_0x5e71('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function VoiceDialReport(_0x2f7eeb){this[_0x5e71('0xa')]=_0x2f7eeb[_0x5e71('0xb')];this['outbound']=_0x2f7eeb[_0x5e71('0xc')];this[_0x5e71('0xd')]={};this['variables']={};ami['on'](_0x5e71('0xe'),this['syncDialBegin'][_0x5e71('0xf')](this));ami['on'](_0x5e71('0x10'),this[_0x5e71('0x11')][_0x5e71('0xf')](this));ami['on'](_0x5e71('0x12'),this[_0x5e71('0x13')][_0x5e71('0xf')](this));ami['on']('hangup',this[_0x5e71('0x14')][_0x5e71('0xf')](this));}VoiceDialReport[_0x5e71('0x15')]['isNotNull']=function(_0x2195f1){return _0x2195f1!==null&&!_['isUndefined'](_0x2195f1);};VoiceDialReport[_0x5e71('0x15')]['emit']=function(_0x4f9a5f,_0x4edda2,_0x6ab9be){io['to'](_0x4f9a5f)[_0x5e71('0x16')](_0x4edda2,_0x6ab9be);};VoiceDialReport['prototype']['syncDialBegin']=function(_0x2c6466){try{if(this['isNotNull'](_0x2c6466)){logger['debug'](_0x5e71('0x17'),_0x2c6466[_0x5e71('0x18')],util['inspect'](_0x2c6466,{'showHidden':![],'depth':null}));if(this['channels'][_0x2c6466[_0x5e71('0x18')]]){_['merge'](this[_0x5e71('0xa')][_0x2c6466['uniqueid']],{'starttime':moment()[_0x5e71('0x19')](_0x5e71('0x1a')),'lastevent':'called','interface':_0x2c6466[_0x5e71('0x1b')]['substring'](0x0,_0x2c6466[_0x5e71('0x1b')]['lastIndexOf']('-')),'membername':_0x2c6466[_0x5e71('0x1b')][_0x5e71('0x1c')](_0x2c6466[_0x5e71('0x1b')][_0x5e71('0x1d')]('/')+0x1,_0x2c6466[_0x5e71('0x1b')][_0x5e71('0x1d')]('-'))},_[_0x5e71('0x1e')](_0x2c6466,[_0x5e71('0x1f'),_0x5e71('0x20')]));logger['info'](_0x5e71('0x21'),_0x2c6466[_0x5e71('0x18')],this['channels'][_0x2c6466['uniqueid']]['membername'],this[_0x5e71('0xa')][_0x2c6466['uniqueid']][_0x5e71('0x22')]);logger[_0x5e71('0x23')](_0x5e71('0x24'),_0x2c6466[_0x5e71('0x18')],util[_0x5e71('0x25')](this[_0x5e71('0xa')][_0x2c6466['uniqueid']],{'showHidden':![],'depth':null}));if(this[_0x5e71('0xd')][_0x2c6466[_0x5e71('0x18')]])_[_0x5e71('0x26')](this['channels'][_0x2c6466['uniqueid']],this['applications'][_0x2c6466[_0x5e71('0x18')]]);this[_0x5e71('0x16')]('voice:outbound',_0x5e71('0x27'),this[_0x5e71('0xa')][_0x2c6466[_0x5e71('0x18')]]);logger[_0x5e71('0x23')](_0x5e71('0x28'),_0x2c6466['uniqueid'],util[_0x5e71('0x25')](this[_0x5e71('0xa')][_0x2c6466[_0x5e71('0x18')]],{'showHidden':![],'depth':null}));ami[_0x5e71('0x16')](_0x5e71('0x29'),this[_0x5e71('0xa')][_0x2c6466[_0x5e71('0x18')]]);}}}catch(_0x2dd4df){logger[_0x5e71('0x2a')](_0x5e71('0x2b'),_0x2c6466['uniqueid'],util[_0x5e71('0x25')](_0x2dd4df,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x5e71('0x15')][_0x5e71('0x11')]=function(_0x1b787c){try{if(this['isNotNull'](_0x1b787c)){logger[_0x5e71('0x23')](_0x5e71('0x2c'),_0x1b787c['uniqueid'],util['inspect'](_0x1b787c,{'showHidden':![],'depth':null}));if(this[_0x5e71('0xa')][_0x1b787c[_0x5e71('0x18')]]){this[_0x5e71('0xa')][_0x1b787c['uniqueid']]['dialstatus']=_0x1b787c[_0x5e71('0x2d')];if(_0x1b787c[_0x5e71('0x2d')]===_0x5e71('0x2e')){this[_0x5e71('0xa')][_0x1b787c[_0x5e71('0x18')]]['connectedlinenum']=_0x1b787c[_0x5e71('0x2f')];this['channels'][_0x1b787c['uniqueid']]['connectedlinename']=_0x1b787c['connectedlinename'];this['channels'][_0x1b787c[_0x5e71('0x18')]][_0x5e71('0x30')]=moment()['format'](_0x5e71('0x1a'));this[_0x5e71('0xa')][_0x1b787c[_0x5e71('0x18')]][_0x5e71('0x31')]=_0x5e71('0x32');logger['info'](_0x5e71('0x33'),_0x1b787c[_0x5e71('0x18')],_0x1b787c[_0x5e71('0x1b')][_0x5e71('0x1c')](_0x1b787c[_0x5e71('0x1b')][_0x5e71('0x1d')]('/')+0x1,_0x1b787c[_0x5e71('0x1b')][_0x5e71('0x1d')]('-')));logger[_0x5e71('0x23')](_0x5e71('0x34'),_0x1b787c[_0x5e71('0x18')],util[_0x5e71('0x25')](this['channels'][_0x1b787c[_0x5e71('0x18')]],{'showHidden':![],'depth':null}));ami[_0x5e71('0x16')](_0x5e71('0x35'),this[_0x5e71('0xa')][_0x1b787c[_0x5e71('0x18')]]);}logger[_0x5e71('0x23')](_0x5e71('0x36'),_0x1b787c[_0x5e71('0x18')],util['inspect'](this['channels'][_0x1b787c[_0x5e71('0x18')]],{'showHidden':![],'depth':null}));this['emit']('voice:outbound',_0x5e71('0x27'),this[_0x5e71('0xa')][_0x1b787c[_0x5e71('0x18')]]);}}}catch(_0x262fbe){logger['error']('[%s][voiceDialReport][dialend]',_0x1b787c[_0x5e71('0x18')],util[_0x5e71('0x25')](_0x262fbe,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x5e71('0x15')][_0x5e71('0x13')]=function(_0x21a859){try{if(this[_0x5e71('0x37')](_0x21a859)){logger[_0x5e71('0x23')](_0x5e71('0x38'),_0x21a859[_0x5e71('0x18')],util[_0x5e71('0x25')](_0x21a859,{'showHidden':![],'depth':null}));this[_0x5e71('0x39')](_0x21a859[_0x5e71('0x18')],_[_0x5e71('0x3a')](_0x21a859[_0x5e71('0x3b')])[0x0],_0x21a859[_0x5e71('0x3c')]);if(this['isNotNull'](_0x21a859[_0x5e71('0x3b')])&&this[_0x5e71('0x37')](_0x21a859[_0x5e71('0x3b')][_0x5e71('0x3d')])){if(_[_0x5e71('0x3e')](this[_0x5e71('0xa')][_0x21a859[_0x5e71('0x18')]])){this[_0x5e71('0xa')][_0x21a859[_0x5e71('0x18')]]={'routeId':_0x21a859[_0x5e71('0x3c')],'variables':this[_0x5e71('0x3f')][_0x21a859['uniqueid']],'motionChannel':'voice'};logger[_0x5e71('0x40')](_0x5e71('0x41'),_0x21a859[_0x5e71('0x18')],_0x21a859[_0x5e71('0x3b')][_0x5e71('0x3d')],_['keys'](_0x21a859['variable'])[0x0],_0x21a859[_0x5e71('0x3c')]);logger[_0x5e71('0x23')](_0x5e71('0x42'),_0x21a859[_0x5e71('0x18')],util[_0x5e71('0x25')](this[_0x5e71('0xa')][_0x21a859[_0x5e71('0x18')]],{'showHidden':![],'depth':null}));this[_0x5e71('0x16')](_0x5e71('0x43'),'voice_outbound_channel:save',this[_0x5e71('0xa')][_0x21a859[_0x5e71('0x18')]]);}}}}catch(_0x5b6400){logger[_0x5e71('0x2a')](_0x5e71('0x44'),_0x21a859['uniqueid'],util['inspect'](_0x5b6400,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x5e71('0x15')]['addVariable']=function(_0x20cf06,_0xa9595f,_0x807aeb){var _0x5e4a61=[_0x5e71('0x45'),_0x5e71('0x46'),_0x5e71('0x47'),_0x5e71('0x48'),_0x5e71('0x49'),_0x5e71('0x4a'),_0x5e71('0x4b'),_0x5e71('0x4c'),_0x5e71('0x4d'),_0x5e71('0x4e'),_0x5e71('0x4f'),_0x5e71('0x50'),_0x5e71('0x51'),_0x5e71('0x52'),_0x5e71('0x53'),_0x5e71('0x54'),_0x5e71('0x55'),_0x5e71('0x56'),_0x5e71('0x57')];if(!_[_0x5e71('0x58')](_0xa9595f)&&!_[_0x5e71('0x59')](_0x5e4a61,_0xa9595f)){if(_[_0x5e71('0x3e')](this['variables'][_0x20cf06])){this['variables'][_0x20cf06]={};}this[_0x5e71('0x3f')][_0x20cf06][_0xa9595f]=_0x807aeb;}};VoiceDialReport[_0x5e71('0x15')]['syncHangup']=function(_0xfe9fdc){try{if(this[_0x5e71('0x37')](_0xfe9fdc)){logger[_0x5e71('0x23')]('[%s][voiceDialReport][hangup]\x20event:',_0xfe9fdc['uniqueid'],util[_0x5e71('0x25')](_0xfe9fdc,{'showHidden':![],'depth':null}));if(this[_0x5e71('0xa')][_0xfe9fdc[_0x5e71('0x18')]]){logger[_0x5e71('0x40')](_0x5e71('0x5a'),_0xfe9fdc[_0x5e71('0x18')],_0xfe9fdc['cause-txt']);this[_0x5e71('0xa')][_0xfe9fdc[_0x5e71('0x18')]][_0x5e71('0x5b')]=moment()['format'](_0x5e71('0x1a'));this[_0x5e71('0xa')][_0xfe9fdc[_0x5e71('0x18')]][_0x5e71('0x5c')]=moment(this[_0x5e71('0xa')][_0xfe9fdc['uniqueid']][_0x5e71('0x5b')])['diff'](this[_0x5e71('0xa')][_0xfe9fdc[_0x5e71('0x18')]][_0x5e71('0x5d')],_0x5e71('0x5e'));this[_0x5e71('0xa')][_0xfe9fdc[_0x5e71('0x18')]][_0x5e71('0x31')]=_0x5e71('0x5f');this[_0x5e71('0xc')][_0x5e71('0x60')]+=0x1;if(this[_0x5e71('0xa')][_0xfe9fdc['uniqueid']][_0x5e71('0x30')]){this['outbound'][_0x5e71('0x61')]+=0x1;this['channels'][_0xfe9fdc['uniqueid']][_0x5e71('0x62')]=moment(this[_0x5e71('0xa')][_0xfe9fdc[_0x5e71('0x18')]][_0x5e71('0x30')])[_0x5e71('0x63')](this['channels'][_0xfe9fdc[_0x5e71('0x18')]][_0x5e71('0x5d')],_0x5e71('0x5e'));this[_0x5e71('0xa')][_0xfe9fdc[_0x5e71('0x18')]]['billableseconds']=moment(this[_0x5e71('0xa')][_0xfe9fdc[_0x5e71('0x18')]][_0x5e71('0x5b')])['diff'](this[_0x5e71('0xa')][_0xfe9fdc[_0x5e71('0x18')]][_0x5e71('0x30')],_0x5e71('0x5e'));this[_0x5e71('0xc')][_0x5e71('0x64')]+=this[_0x5e71('0xa')][_0xfe9fdc[_0x5e71('0x18')]][_0x5e71('0x62')]||0x0;this[_0x5e71('0xc')][_0x5e71('0x65')]+=this[_0x5e71('0xa')][_0xfe9fdc[_0x5e71('0x18')]][_0x5e71('0x66')];}this[_0x5e71('0xc')][_0x5e71('0x67')]+=this[_0x5e71('0xa')][_0xfe9fdc[_0x5e71('0x18')]]['duration'];logger[_0x5e71('0x23')]('[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:',_0xfe9fdc[_0x5e71('0x18')],util[_0x5e71('0x25')](this[_0x5e71('0xa')][_0xfe9fdc[_0x5e71('0x18')]],{'showHidden':![],'depth':null}));ami[_0x5e71('0x16')]('custom:voiceDialReport',this[_0x5e71('0xa')][_0xfe9fdc[_0x5e71('0x18')]]);logger['debug'](_0x5e71('0x68'),_0xfe9fdc[_0x5e71('0x18')],util[_0x5e71('0x25')](this['channels'][_0xfe9fdc[_0x5e71('0x18')]],{'showHidden':![],'depth':null}));ami['emit']('custom:dialend',this[_0x5e71('0xa')][_0xfe9fdc[_0x5e71('0x18')]]);logger['debug'](_0x5e71('0x69'),_0xfe9fdc['uniqueid'],util['inspect'](this[_0x5e71('0xa')][_0xfe9fdc[_0x5e71('0x18')]],{'showHidden':![],'depth':null}));this[_0x5e71('0x16')](_0x5e71('0x43'),_0x5e71('0x6a'),this[_0x5e71('0xc')]);logger[_0x5e71('0x40')](_0x5e71('0x6b'),JSON[_0x5e71('0x6c')](this[_0x5e71('0xa')][_0xfe9fdc[_0x5e71('0x18')]]));logger[_0x5e71('0x23')](_0x5e71('0x6d'),_0xfe9fdc[_0x5e71('0x18')],util[_0x5e71('0x25')](this['channels'][_0xfe9fdc[_0x5e71('0x18')]],{'showHidden':![],'depth':null}));this[_0x5e71('0x16')]('voice:outbound',_0x5e71('0x6e'),this[_0x5e71('0xa')][_0xfe9fdc['uniqueid']]);this[_0x5e71('0x6f')](_0xfe9fdc[_0x5e71('0x18')]);}else if(this[_0x5e71('0xa')][_0xfe9fdc[_0x5e71('0x70')]]){this[_0x5e71('0xa')][_0xfe9fdc[_0x5e71('0x70')]][_0x5e71('0x18')]=this['channels'][_0xfe9fdc[_0x5e71('0x70')]][_0x5e71('0x71')];}if(this[_0x5e71('0x3f')][_0xfe9fdc[_0x5e71('0x18')]]){delete this['variables'][_0xfe9fdc[_0x5e71('0x18')]];}}}catch(_0x412e78){logger[_0x5e71('0x2a')](_0x5e71('0x72'),_0xfe9fdc['uniqueid'],util[_0x5e71('0x25')](_0x412e78,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype']['syncNewExten']=function(_0x55c7e8){try{if(this[_0x5e71('0x37')](_0x55c7e8)){logger[_0x5e71('0x23')](_0x5e71('0x73'),_0x55c7e8['uniqueid'],util[_0x5e71('0x25')](_0x55c7e8,{'showHidden':![],'depth':null}));if(_0x55c7e8[_0x5e71('0x74')][_0x5e71('0x75')]()===_0x5e71('0x76')){_0x55c7e8[_0x5e71('0x77')]=(_0x55c7e8[_0x5e71('0x78')]||_0x55c7e8[_0x5e71('0x77')])['toLowerCase']();if(_[_0x5e71('0x79')](_0x55c7e8['applicationdata'],_0x5e71('0x7a'))){if(_['isUndefined'](this[_0x5e71('0xd')][_0x55c7e8['uniqueid']]))this[_0x5e71('0xd')][_0x55c7e8[_0x5e71('0x18')]]={};logger[_0x5e71('0x40')](_0x5e71('0x7b'),_0x55c7e8[_0x5e71('0x18')],_0x55c7e8[_0x5e71('0x74')],_0x55c7e8[_0x5e71('0x77')]);var _0x32bfea=_0x55c7e8[_0x5e71('0x77')][_0x5e71('0x7c')]('=');var _0x437f41=_0x32bfea[0x0]['match'](/cdr\((.*)\)/);if(_0x437f41)this['applications'][_0x55c7e8[_0x5e71('0x18')]][_0x437f41[0x1]]=_0x32bfea[0x1];}}}}catch(_0x264a4c){logger[_0x5e71('0x2a')]('[%s][voiceDialReport][newexten]',_0x55c7e8[_0x5e71('0x18')],util[_0x5e71('0x25')](_0x264a4c,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x5e71('0x15')][_0x5e71('0x6f')]=function(_0x592bb5,_0x17c093=0x2710){if(this[_0x5e71('0xa')][_0x592bb5]){setTimeout(()=>{delete this[_0x5e71('0xa')][_0x592bb5];},_0x17c093);}};module[_0x5e71('0x7d')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index b9f75ea..8b53d01 100644 --- a/server/services/ami/report/voiceQueueReport.js +++ b/server/services/ami/report/voiceQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9891=['connectedlinenum','connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','[%s][voiceQueueReport][agentconnect]','last','queuecallerexitreason','COMPLETEDBYAGENT','[%s][voiceQueueReport][agentcomplete]','assigned','membername','transfer','reason','COMPLETED','channel','toLowerCase','local/','queuecallerexit','queuecallerexitAt','add','seconds','transfertype','FORWARD','transferexten','destexten','transferuniqueid','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','linkedid','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','syncVarSet','[%s][voiceQueueReport][varset]','addVariable','variable','value','TIMEOUT','lastevent','timeout','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','custom:timeout','EXITWITHKEY','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','membercalls','memberinterface','memberlastcall','memberpenalty','memberrealtime','includes','handleHangup','length','sumHoldTime','sumDuration','total','answered','sumBillable','unmanaged','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','custom:queuecallerunmanaged','abandoned','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','deleteChannelAfterTimeout','[%s][voiceQueueReport][hangup]','cause-txt','syncAttendedTransfer','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','secondtransfererexten','secondtransfereruniqueid','switch','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfererexten','ATTENDED','origtransfereruniqueid','transferid','[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','BLIND','extension','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','BlindTransfer','context','[%s][voiceQueueReport][musiconholdstart]','isNil','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','mohstarttime','[%s][voiceQueueReport][musiconholdstop]','mohtime','milliseconds','diff','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','syncNewExten','[%s][voiceQueueReport][newexten]\x20event:','application','set','applicationdata','appdata','cdr(','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','match','[%s][voiceQueueReport][newexten]','exports','lodash','moment','util','../../../config/environment','../ami','../model/queueReport','../model/voiceQueueSummary','redis','defaults','prototype','enqueue','tail','finally','sequence','queueReports','realtime','agents','channels','queueChannels','voiceQueues','campaigns','variables','queuesummary','syncQueueSummary','queuesummarycomplete','syncQueueSummaryComplete','bind','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerAbandon','queuecallerleave','syncQueueCallerLeave','agentcomplete','syncAgentComplete','agentconnect','syncAgentConnect','varset','syncHangup','syncFullyBooted','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','blindtransfer','syncBlindTransfer','loopQueueShow','isEmpty','hasOwnProperty','talking','waiting','queueStatusComplete','clearZombieChannels','status','catch','message','No\x20such\x20channel','error','[%s][voiceQueueReport][checkChannel]','[%s][voiceQueueReport][checkQueueReport]','inspect','[%s][voiceQueueReport][checkVariables]','[FullyBooted]\x20clear\x20realtime','clearQueueReport','summary','emitVoiceQueueChannelRemove','clearqueuereport','emitVoiceQueueChannelSave','debug','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','uniqueid','emit','format','voice:queue:%s','voice_queue_channel:save','voice_queue_presence:save',']\x20sending\x20voice_queue_channel:remove\x20event:','ATTENDEDTRANSFER','queue','voice_queue_channel:remove','voice_queue_presence:remove','emitInboundVoiceQueueSummary','name','voice_queue:save','isNotNull','isUndefined','Action','[voiceQueueReport][queues]','loopQueueSummary','then','actionid','isRunning','[voiceQueueReport][queuesummary]','queues','summaryEvent','handleInboundQueueSummaryReport','createQueueSummaryReport','queuestatus','type','statusRequests','completeEvent','push','[voiceQueueReport][queuesummary]\x20event:','[voiceQueueReport][queuesummary]\x20name:%s','custom:queuesummarycomplete','[%s][voiceQueueReport][queuecallerjoin]','inbound','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','count','info','assign','pick','keys','[%s][voiceQueueReport][queuecallerabandon]','queuecallercomplete','queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','lastAssignedTo','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','[%s][voiceQueueReport][queuecallerleave]','queuecallerleaveAt'];(function(_0x533990,_0x21fe8d){var _0x5a5e2a=function(_0x2539c3){while(--_0x2539c3){_0x533990['push'](_0x533990['shift']());}};_0x5a5e2a(++_0x21fe8d);}(_0x9891,0x163));var _0x1989=function(_0x131a70,_0x5f53b2){_0x131a70=_0x131a70-0x0;var _0x212967=_0x9891[_0x131a70];return _0x212967;};'use strict';var _=require(_0x1989('0x0'));var moment=require(_0x1989('0x1'));var util=require(_0x1989('0x2'));var Redis=require('ioredis');var config=require(_0x1989('0x3'));var logger=require('../../../config/logger')('ami');var ami=require(_0x1989('0x4'));var QueueReport=require(_0x1989('0x5'));var VoiceQueueSummary=require(_0x1989('0x6'));config[_0x1989('0x7')]=_[_0x1989('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Sequence=function(){};Sequence[_0x1989('0x9')][_0x1989('0xa')]=function(_0x57c1c7){this[_0x1989('0xb')]=this[_0x1989('0xb')]?this['tail'][_0x1989('0xc')](_0x57c1c7):_0x57c1c7();};function VoiceQueueReport(_0x155a0d){this[_0x1989('0xd')]=new Sequence();this[_0x1989('0xe')]={};this[_0x1989('0xf')]=_0x155a0d;this[_0x1989('0x10')]=_0x155a0d[_0x1989('0x10')];this[_0x1989('0x11')]=_0x155a0d[_0x1989('0x12')];this[_0x1989('0x13')]=_0x155a0d[_0x1989('0x13')];this[_0x1989('0x14')]=_0x155a0d[_0x1989('0x14')];this['summary']=initializeSummary();this[_0x1989('0x15')]={};ami['on'](_0x1989('0x16'),this[_0x1989('0x17')]['bind'](this));ami['on'](_0x1989('0x18'),this[_0x1989('0x19')][_0x1989('0x1a')](this));ami['on'](_0x1989('0x1b'),this[_0x1989('0x1c')][_0x1989('0x1a')](this));ami['on'](_0x1989('0x1d'),this[_0x1989('0x1e')][_0x1989('0x1a')](this));ami['on'](_0x1989('0x1f'),this[_0x1989('0x20')][_0x1989('0x1a')](this));ami['on'](_0x1989('0x21'),this[_0x1989('0x22')][_0x1989('0x1a')](this));ami['on'](_0x1989('0x23'),this[_0x1989('0x24')]['bind'](this));ami['on'](_0x1989('0x25'),this[_0x1989('0x26')][_0x1989('0x1a')](this));ami['on'](_0x1989('0x27'),this[_0x1989('0x28')][_0x1989('0x1a')](this));ami['on'](_0x1989('0x29'),this['syncVarSet'][_0x1989('0x1a')](this));ami['on']('hangup',this[_0x1989('0x2a')]['bind'](this));ami['on']('fullybooted',this[_0x1989('0x2b')]['bind'](this));ami['on']('musiconholdstart',this['syncMusicOnHoldStart'][_0x1989('0x1a')](this));ami['on'](_0x1989('0x2c'),this[_0x1989('0x2d')][_0x1989('0x1a')](this));ami['on'](_0x1989('0x2e'),this['syncAttendedTransfer'][_0x1989('0x1a')](this));ami['on'](_0x1989('0x2f'),this[_0x1989('0x30')][_0x1989('0x1a')](this));this['loopQueueSummary']();this[_0x1989('0x31')]();}function clearChannels(_0x2dcf97){if(!_[_0x1989('0x32')](_0x2dcf97)){for(var _0x40f365 in _0x2dcf97){if(_0x2dcf97[_0x1989('0x33')](_0x40f365)){delete _0x2dcf97[_0x40f365];}}}}function clearCampaigns(_0xee6712){if(!_[_0x1989('0x32')](_0xee6712)){for(var _0x3425d7 in _0xee6712){if(_0xee6712[_0x1989('0x33')](_0x3425d7)){_0xee6712[_0x3425d7]['originated']=0x0;}}}}function clearVoiceQueues(_0x3ea025){if(!_['isEmpty'](_0x3ea025)){for(var _0x52b454 in _0x3ea025){if(_0x3ea025[_0x1989('0x33')](_0x52b454)){_0x3ea025[_0x52b454]['originated']=0x0;_0x3ea025[_0x52b454][_0x1989('0x34')]=0x0;_0x3ea025[_0x52b454]['pTalking']=0x0;_0x3ea025[_0x52b454][_0x1989('0x35')]=0x0;_0x3ea025[_0x52b454][_0x1989('0x36')]=!![];}}}}function clearAgentBooked(_0x268f55){if(!_[_0x1989('0x32')](_0x268f55)){for(var _0x5cc171 in _0x268f55){if(_0x268f55[_0x1989('0x33')](_0x5cc171)){_0x268f55[_0x5cc171]['unlockRR']=!![];}}}}function initializeSummary(){return{'id':null,'completeEvent':null,'isRunning':![],'queues':{},'queuestatus':{},'statusRequests':0x0};}function hasCallerLeftTheQueue(_0x288faf){return _0x288faf['queuecallerexit']||_0x288faf[_0x1989('0x21')]||_0x288faf['queuecallercomplete'];}VoiceQueueReport[_0x1989('0x9')][_0x1989('0x37')]=function(){var _0x383d30=this;for(var _0x1bcb3a in this[_0x1989('0x11')]){if(this[_0x1989('0x11')]['hasOwnProperty'](_0x1bcb3a)&&!this['channels'][_0x1bcb3a]['switch']){this[_0x1989('0xd')]['enqueue'](function(){if(!_['isNil'](_0x383d30['channels'][_0x1bcb3a])){return ami['Action']({'action':_0x1989('0x38'),'channel':_0x383d30[_0x1989('0x11')][_0x1bcb3a]['channel']})[_0x1989('0x39')](function(_0x2cd860){if(_0x2cd860[_0x1989('0x3a')]===_0x1989('0x3b')){setTimeout(function(){if(_0x383d30['channels'][_0x1bcb3a]){delete _0x383d30[_0x1989('0x11')][_0x1bcb3a];logger[_0x1989('0x3c')](_0x1989('0x3d'),_0x1bcb3a,util['inspect'](_0x2cd860,{'showHidden':![],'depth':null}));}if(_0x383d30['queueReports'][_0x1bcb3a]){delete _0x383d30[_0x1989('0xe')][_0x1bcb3a];logger['error'](_0x1989('0x3e'),_0x1bcb3a,util[_0x1989('0x3f')](_0x2cd860,{'showHidden':![],'depth':null}));}if(_0x383d30[_0x1989('0x15')][_0x1bcb3a]){delete _0x383d30[_0x1989('0x15')][_0x1bcb3a];logger['error'](_0x1989('0x40'),_0x1bcb3a,util[_0x1989('0x3f')](_0x2cd860,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0x1989('0x9')][_0x1989('0x2b')]=function(){logger[_0x1989('0x3c')](_0x1989('0x41'));clearChannels(this['channels']);this[_0x1989('0x42')](this['queueReports']);clearAgentBooked(this[_0x1989('0x10')]);clearVoiceQueues(this[_0x1989('0x13')]);clearCampaigns(this[_0x1989('0x14')]);this[_0x1989('0x43')]=initializeSummary();};VoiceQueueReport[_0x1989('0x9')][_0x1989('0x42')]=function(_0x5e993d){var _0x1f6723=this;if(!_['isEmpty'](_0x5e993d)){for(var _0xf7b0db in _0x5e993d){if(_0x5e993d['hasOwnProperty'](_0xf7b0db)){_0x1f6723[_0x1989('0x44')](_0x5e993d[_0xf7b0db],_0x1989('0x45'));delete _0x5e993d[_0xf7b0db];}}}};VoiceQueueReport[_0x1989('0x9')]['emit']=function(_0x28d308,_0x4c8254,_0x233b50){io['to'](_0x28d308)['emit'](_0x4c8254,_0x233b50);};VoiceQueueReport['prototype'][_0x1989('0x46')]=function(_0x22bdab,_0x1293f8){logger[_0x1989('0x47')](_0x1989('0x48')+_0x1293f8+_0x1989('0x49'),_0x22bdab[_0x1989('0x4a')],util[_0x1989('0x3f')](_0x22bdab,{'showHidden':![],'depth':null}));this[_0x1989('0x4b')](util[_0x1989('0x4c')](_0x1989('0x4d'),_0x22bdab['queue']),_0x1989('0x4e'),_0x22bdab);io['emit'](_0x1989('0x4f'),_0x22bdab);};VoiceQueueReport['prototype']['emitVoiceQueueChannelRemove']=function(_0x418006,_0x58d1da){logger[_0x1989('0x47')](_0x1989('0x48')+_0x58d1da+_0x1989('0x50'),_0x418006[_0x1989('0x4a')],util['inspect'](_0x418006,{'showHidden':![],'depth':null}));if(_0x418006['queuecallerexitreason']===_0x1989('0x51')){return;}this['emit'](util[_0x1989('0x4c')]('voice:queue:%s',_0x418006[_0x1989('0x52')]),_0x1989('0x53'),_0x418006);io['emit'](_0x1989('0x54'),_0x418006);};VoiceQueueReport[_0x1989('0x9')][_0x1989('0x55')]=function(_0x262043){if(_0x262043['type']==='inbound'){logger['debug']('[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:',util[_0x1989('0x3f')](_0x262043,{'showHidden':![],'depth':null}));this[_0x1989('0x4b')](util['format'](_0x1989('0x4d'),_0x262043[_0x1989('0x56')]),_0x1989('0x57'),_0x262043);}};VoiceQueueReport['prototype'][_0x1989('0x58')]=function(_0x37d45b){return _0x37d45b!==null&&!_[_0x1989('0x59')](_0x37d45b);};VoiceQueueReport[_0x1989('0x9')][_0x1989('0x31')]=function(){var _0x46766f=this;setInterval(function(){_0x46766f['clearZombieChannels']();ami[_0x1989('0x5a')]({'action':'queues'})[_0x1989('0x39')](function(_0x1a5994){logger[_0x1989('0x3c')](_0x1989('0x5b'),util[_0x1989('0x3f')](_0x1a5994,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0x1989('0x9')][_0x1989('0x5c')]=function(){var _0x2c4987=this;setInterval(function(){if(!_0x2c4987[_0x1989('0x43')]['isRunning']){return ami[_0x1989('0x5a')]({'action':_0x1989('0x16')})[_0x1989('0x5d')](function(_0x47c5d6){_0x2c4987['summary']['id']=_0x47c5d6[_0x1989('0x5e')];_0x2c4987[_0x1989('0x43')][_0x1989('0x5f')]=!![];_0x2c4987['summary']['queuestatus'][_0x47c5d6[_0x1989('0x5e')]]={};})[_0x1989('0x39')](function(_0x1ad549){logger[_0x1989('0x3c')](_0x1989('0x60'),util[_0x1989('0x3f')](_0x1ad549,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport['prototype']['createQueueSummaryReport']=function(_0x439562,_0x3d6b5d){var _0xcf9d35;if(this['summary']&&this[_0x1989('0x43')][_0x1989('0x61')]&&this[_0x1989('0x43')][_0x1989('0x61')][_0x439562[_0x1989('0x56')]]){_0xcf9d35=this[_0x1989('0x43')][_0x1989('0x61')][_0x439562[_0x1989('0x56')]][_0x1989('0x62')];}var _0x48fd66=new VoiceQueueSummary(_0x439562);return _0x48fd66['createReport'](_0x3d6b5d[_0x1989('0x10')],this[_0x1989('0x10')],_0xcf9d35,this['realtime'][_0x1989('0x11')]);};VoiceQueueReport[_0x1989('0x9')][_0x1989('0x63')]=function(_0x5de260,_0x55978c){var _0x17c642=this[_0x1989('0x64')](_0x5de260,_0x55978c);var _0x1fa342=![];_0x1fa342=_0x17c642['compareToInboundQueue'](_0x5de260);if(_0x1fa342){Object['assign'](_0x5de260,_0x17c642);this[_0x1989('0xf')][_0x1989('0x13')][_0x5de260[_0x1989('0x56')]]=_0x5de260;this[_0x1989('0x55')](_0x17c642);}};VoiceQueueReport['prototype'][_0x1989('0x1e')]=function(_0x228ce2){var _0x491fee=null;var _0x4443d8=this[_0x1989('0x43')]['id'];if(this[_0x1989('0x43')]['queuestatus'][_0x4443d8]){_0x491fee=this[_0x1989('0x43')][_0x1989('0x65')][_0x4443d8][_0x228ce2['actionid']];}if(!_0x491fee){this[_0x1989('0x43')]=initializeSummary();return;}var _0x127bb2=this[_0x1989('0x13')][_0x491fee[_0x1989('0x52')]];if(_0x127bb2[_0x1989('0x66')]==='inbound'){this['handleInboundQueueSummaryReport'](_0x127bb2,_0x491fee);}else if(_0x127bb2[_0x1989('0x66')]==='outbound'){var _0x9c260b=this[_0x1989('0x64')](_0x127bb2,_0x491fee);ami[_0x1989('0x4b')]('custom:queuesummary',_0x9c260b);}this[_0x1989('0x43')]['statusRequests']-=0x1;var _0xfcaf0e=this[_0x1989('0x43')][_0x1989('0x67')]>0x0?!![]:![];if(!_0xfcaf0e){return this[_0x1989('0x19')](this[_0x1989('0x43')][_0x1989('0x68')]);}};VoiceQueueReport[_0x1989('0x9')]['syncQueueMember']=function(_0x551544){var _0x56f820=this['summary']['id'];if(this[_0x1989('0x43')][_0x1989('0x65')][_0x56f820]&&this[_0x1989('0x43')][_0x1989('0x65')][_0x56f820][_0x551544[_0x1989('0x5e')]]){this[_0x1989('0x43')][_0x1989('0x65')][_0x56f820][_0x551544[_0x1989('0x5e')]][_0x1989('0x10')][_0x1989('0x69')](_0x551544);}};VoiceQueueReport[_0x1989('0x9')]['syncQueueSummary']=function(_0xd6b911){var _0x2dbce4=this;try{if(this[_0x1989('0x58')](_0xd6b911)&&this['isNotNull'](_0xd6b911[_0x1989('0x52')])){logger[_0x1989('0x47')](_0x1989('0x6a'),util[_0x1989('0x3f')](_0xd6b911,{'showHidden':![],'depth':null}));var _0x3255d9=this[_0x1989('0x13')][_0xd6b911[_0x1989('0x52')]];if(_0x3255d9){logger[_0x1989('0x47')](_0x1989('0x6b'),_0x3255d9['name']);this[_0x1989('0x43')][_0x1989('0x61')][_0x3255d9[_0x1989('0x56')]]={'summaryEvent':_0xd6b911};this[_0x1989('0x43')][_0x1989('0x67')]+=0x1;return ami[_0x1989('0x5a')]({'action':'queuestatus','queue':_0x3255d9[_0x1989('0x56')]})[_0x1989('0x5d')](function(_0x1e2a15){if(!_0x2dbce4[_0x1989('0x43')][_0x1989('0x65')][_0xd6b911[_0x1989('0x5e')]]){_0x2dbce4['summary']['queuestatus'][_0xd6b911[_0x1989('0x5e')]]={};}_0x2dbce4['summary'][_0x1989('0x65')][_0xd6b911[_0x1989('0x5e')]][_0x1e2a15[_0x1989('0x5e')]]={'queue':_0x3255d9['name'],'agents':[]};})['catch'](function(_0x23113f){throw _0x23113f;});}}}catch(_0x3db214){logger[_0x1989('0x3c')](_0x1989('0x60'),util[_0x1989('0x3f')](_0x3db214,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1989('0x9')]['syncQueueSummaryComplete']=function(_0x56dc93){if(this[_0x1989('0x43')][_0x1989('0x67')]>0x0){this[_0x1989('0x43')][_0x1989('0x68')]=_0x56dc93;return;}logger['debug']('[voiceQueueReport][queuesummarycomplete]\x20event:',util[_0x1989('0x3f')](_0x56dc93,{'showHidden':![],'depth':null}));this['summary']=initializeSummary();ami[_0x1989('0x4b')](_0x1989('0x6c'),{});};VoiceQueueReport[_0x1989('0x9')][_0x1989('0x20')]=function(_0x2bf70d){try{if(this[_0x1989('0x58')](_0x2bf70d)){logger[_0x1989('0x47')](_0x1989('0x6d'),_0x2bf70d['uniqueid'],util[_0x1989('0x3f')](_0x2bf70d,{'showHidden':![],'depth':null}));if(_[_0x1989('0x59')](this[_0x1989('0xe')][_0x2bf70d[_0x1989('0x4a')]])){this[_0x1989('0xe')][_0x2bf70d['uniqueid']]=[];}if(_[_0x1989('0x59')](this['channels'][_0x2bf70d[_0x1989('0x4a')]])){this[_0x1989('0x11')][_0x2bf70d['uniqueid']]={};}var _0x2ba61e=new QueueReport();_0x2ba61e[_0x1989('0x52')]=_0x2bf70d['queue'];_0x2ba61e[_0x1989('0x66')]=this[_0x1989('0x13')][_0x2ba61e[_0x1989('0x52')]]&&this[_0x1989('0x13')][_0x2ba61e['queue']][_0x1989('0x66')]?this[_0x1989('0x13')][_0x2ba61e['queue']]['type']||_0x1989('0x6e'):_0x1989('0x6e');_0x2ba61e[_0x1989('0x6f')]=moment()[_0x1989('0x4c')](_0x1989('0x70'));_0x2ba61e[_0x1989('0x71')]=_0x2bf70d[_0x1989('0x71')];_0x2ba61e[_0x1989('0x72')]=_0x2bf70d[_0x1989('0x72')];_0x2ba61e['uniqueid']=_0x2bf70d[_0x1989('0x4a')];logger[_0x1989('0x73')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x2ba61e[_0x1989('0x52')],_0x2ba61e[_0x1989('0x66')]);Object[_0x1989('0x74')](_0x2ba61e,_[_0x1989('0x75')](_0x2bf70d,_[_0x1989('0x76')](_0x2ba61e)));this[_0x1989('0xe')][_0x2bf70d[_0x1989('0x4a')]]['push'](_0x2ba61e);this[_0x1989('0x11')][_0x2bf70d[_0x1989('0x4a')]]=_0x2ba61e;this[_0x1989('0x46')](_0x2ba61e,_0x1989('0x1f'));}}catch(_0x1d2ab3){logger['error'](_0x1989('0x6d'),_0x2bf70d[_0x1989('0x4a')],util[_0x1989('0x3f')](_0x1d2ab3,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1989('0x9')][_0x1989('0x22')]=function(_0x323815){try{if(this[_0x1989('0x58')](_0x323815)){logger[_0x1989('0x47')](_0x1989('0x77'),_0x323815[_0x1989('0x4a')],util['inspect'](_0x323815,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x323815['uniqueid']]){var _0x46ac54=_['last'](this['queueReports'][_0x323815['uniqueid']]);_0x46ac54[_0x1989('0x78')]=![];_0x46ac54[_0x1989('0x79')]=null;_0x46ac54[_0x1989('0x7a')]=_0x323815[_0x1989('0x7a')];_0x46ac54[_0x1989('0x7b')]=_0x323815[_0x1989('0x7b')];_0x46ac54[_0x1989('0x21')]=!![];_0x46ac54[_0x1989('0x7c')]=moment()[_0x1989('0x4c')](_0x1989('0x70'));_0x46ac54['queuecallerexitreason']='ABANDONED';_0x46ac54[_0x1989('0x7d')]=null;logger[_0x1989('0x73')](_0x1989('0x7e'),_0x46ac54[_0x1989('0x52')],_0x46ac54[_0x1989('0x66')]);this['channels'][_0x323815[_0x1989('0x4a')]]=_0x46ac54;this['emitVoiceQueueChannelRemove'](_0x46ac54,_0x1989('0x21'));}}}catch(_0xad025e){logger[_0x1989('0x3c')]('[%s][voiceQueueReport][queuecallerabandon]',_0x323815['uniqueid'],util[_0x1989('0x3f')](_0xad025e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1989('0x9')]['syncQueueCallerLeave']=function(_0x84687){try{if(this[_0x1989('0x58')](_0x84687)){logger[_0x1989('0x47')](_0x1989('0x7f'),_0x84687[_0x1989('0x4a')],util[_0x1989('0x3f')](_0x84687,{'showHidden':![],'depth':null}));if(this[_0x1989('0xe')][_0x84687[_0x1989('0x4a')]]){var _0x45738c=_['last'](this[_0x1989('0xe')][_0x84687[_0x1989('0x4a')]]);_0x45738c[_0x1989('0x80')]=moment()[_0x1989('0x4c')](_0x1989('0x70'));_0x45738c['connectedlinenum']=_0x84687[_0x1989('0x81')];_0x45738c['connectedlinename']=_0x84687[_0x1989('0x82')];logger['info'](_0x1989('0x83'),_0x45738c[_0x1989('0x52')],_0x45738c['type'],_0x84687[_0x1989('0x81')],_0x84687['connectedlinename']);this[_0x1989('0x11')][_0x84687[_0x1989('0x4a')]]=_0x45738c;this['emitVoiceQueueChannelSave'](_0x45738c,_0x1989('0x23'));}}}catch(_0x4f1044){logger['error'](_0x1989('0x7f'),_0x84687[_0x1989('0x4a')],util[_0x1989('0x3f')](_0x4f1044,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1989('0x9')][_0x1989('0x28')]=function(_0x531044){try{if(this[_0x1989('0x58')](_0x531044)){logger[_0x1989('0x47')](_0x1989('0x84'),_0x531044[_0x1989('0x4a')],util[_0x1989('0x3f')](_0x531044,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x531044[_0x1989('0x4a')]]){var _0x21f4a5=_[_0x1989('0x85')](this[_0x1989('0xe')][_0x531044['uniqueid']]);_0x21f4a5[_0x1989('0x78')]=!![];_0x21f4a5[_0x1989('0x86')]=_0x1989('0x87');logger[_0x1989('0x73')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x21f4a5[_0x1989('0x52')],_0x21f4a5[_0x1989('0x66')]);}}}catch(_0x5dd115){logger['error'](_0x1989('0x84'),_0x531044[_0x1989('0x4a')],util['inspect'](_0x5dd115,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1989('0x9')][_0x1989('0x26')]=function(_0x4caf05){try{if(this[_0x1989('0x58')](_0x4caf05)){logger['debug'](_0x1989('0x88'),_0x4caf05['uniqueid'],util[_0x1989('0x3f')](_0x4caf05,{'showHidden':![],'depth':null}));if(this[_0x1989('0xe')][_0x4caf05[_0x1989('0x4a')]]){var _0x4b5c38=_[_0x1989('0x85')](this['queueReports'][_0x4caf05[_0x1989('0x4a')]]);_0x4b5c38[_0x1989('0x21')]=![];_0x4b5c38[_0x1989('0x7c')]=null;_0x4b5c38[_0x1989('0x89')]=!![];_0x4b5c38[_0x1989('0x7d')]=_0x4caf05[_0x1989('0x8a')];_0x4b5c38[_0x1989('0x7a')]=_0x4caf05['holdtime'];_0x4b5c38[_0x1989('0x78')]=!![];_0x4b5c38['queuecallerexit']=![];_0x4b5c38['queuecallerexitAt']=null;if(!_0x4b5c38[_0x1989('0x8b')]){if(_0x4caf05[_0x1989('0x8c')]==_0x1989('0x8b')){_0x4b5c38[_0x1989('0x86')]=_0x1989('0x8d');logger[_0x1989('0x73')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x4b5c38[_0x1989('0x52')],_0x4b5c38[_0x1989('0x66')]);}else{if(_['startsWith'](_0x4caf05[_0x1989('0x8e')][_0x1989('0x8f')](),_0x1989('0x90'))){if(this[_0x1989('0xe')][_0x4caf05['linkedid']]){var _0x45f7ee=_[_0x1989('0x85')](this[_0x1989('0xe')][_0x4caf05['linkedid']]);_0x45f7ee[_0x1989('0x78')]=![];_0x45f7ee[_0x1989('0x91')]=!![];_0x45f7ee[_0x1989('0x92')]=moment(_0x4b5c38['queuecallerjoinAt'])[_0x1989('0x93')](_0x4caf05[_0x1989('0x7a')],_0x1989('0x94'))[_0x1989('0x4c')]('YYYY-MM-DD\x20HH:mm:ss');_0x45f7ee[_0x1989('0x86')]='FORWARDTRANSFER';_0x45f7ee['transfer']=!![];_0x45f7ee[_0x1989('0x95')]=_0x1989('0x96');_0x45f7ee[_0x1989('0x97')]=_0x4caf05[_0x1989('0x98')];_0x45f7ee[_0x1989('0x99')]=_0x4caf05['uniqueid'];logger[_0x1989('0x73')](_0x1989('0x9a'),_0x45f7ee[_0x1989('0x52')],_0x45f7ee[_0x1989('0x66')]);var _0x15c9e3=this[_0x1989('0xe')][_0x4caf05[_0x1989('0x9b')]];this[_0x1989('0xe')][_0x4caf05[_0x1989('0x9b')]]=this[_0x1989('0xe')][_0x4caf05['uniqueid']];this[_0x1989('0xe')][_0x4caf05['uniqueid']]=_0x15c9e3;}}else{_0x4b5c38[_0x1989('0x86')]='COMPLETEDBY'+_0x4caf05['reason'][_0x1989('0x9c')]();logger[_0x1989('0x73')](_0x1989('0x9d'),_0x4b5c38[_0x1989('0x52')],_0x4b5c38[_0x1989('0x66')],_0x4b5c38[_0x1989('0x86')]);}}}this[_0x1989('0x11')][_0x4caf05[_0x1989('0x4a')]]=_0x4b5c38;}}}catch(_0x2ff374){logger['error']('[%s][voiceQueueReport][agentcomplete]',_0x4caf05[_0x1989('0x4a')],util['inspect'](_0x2ff374,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1989('0x9')][_0x1989('0x9e')]=function(_0x56f4ea){try{if(this[_0x1989('0x58')](_0x56f4ea)){logger[_0x1989('0x47')](_0x1989('0x9f'),_0x56f4ea[_0x1989('0x4a')],util['inspect'](_0x56f4ea,{'showHidden':![],'depth':null}));this[_0x1989('0xa0')](_0x56f4ea[_0x1989('0x4a')],_[_0x1989('0x76')](_0x56f4ea[_0x1989('0xa1')])[0x0],_0x56f4ea[_0x1989('0xa2')]);if(this[_0x1989('0xe')][_0x56f4ea[_0x1989('0x4a')]]){var _0x3011f3=_[_0x1989('0x85')](this['queueReports'][_0x56f4ea[_0x1989('0x4a')]]);if(_0x3011f3){if(this[_0x1989('0x58')](_0x56f4ea[_0x1989('0xa1')])&&this['isNotNull'](_0x56f4ea[_0x1989('0xa1')][_0x1989('0x65')])){switch(_0x56f4ea[_0x1989('0xa2')]){case'CONTINUE':_0x3011f3[_0x1989('0x91')]=![];_0x3011f3[_0x1989('0x92')]=null;break;case _0x1989('0xa3'):_0x3011f3[_0x1989('0xa4')]=_0x1989('0xa5');_0x3011f3['queuecallerexit']=!![];_0x3011f3[_0x1989('0x92')]=moment()['format'](_0x1989('0x70'));_0x3011f3[_0x1989('0x80')]=moment()[_0x1989('0x4c')](_0x1989('0x70'));logger[_0x1989('0x47')](_0x1989('0xa6'),_0x56f4ea[_0x1989('0x4a')],util[_0x1989('0x3f')](_0x3011f3,{'showHidden':![],'depth':null}));ami[_0x1989('0x4b')](_0x1989('0xa7'),_0x3011f3);break;default:_0x3011f3['queuecallerexit']=!![];_0x3011f3['queuecallerexitAt']=moment()[_0x1989('0x4c')](_0x1989('0x70'));_0x3011f3[_0x1989('0x80')]=moment()['format'](_0x1989('0x70'));}_0x3011f3[_0x1989('0x21')]=![];_0x3011f3[_0x1989('0x7c')]=null;_0x3011f3[_0x1989('0x86')]=_0x56f4ea[_0x1989('0xa2')];this[_0x1989('0x11')][_0x56f4ea[_0x1989('0x4a')]]=_0x3011f3;this['emitVoiceQueueChannelRemove'](_0x3011f3,_0x1989('0x29'));}else if(this[_0x1989('0x58')](_0x56f4ea[_0x1989('0xa1')])&&this[_0x1989('0x58')](_0x56f4ea[_0x1989('0xa1')]['queueposition'])){if(!_0x3011f3[_0x1989('0x21')]){_0x3011f3[_0x1989('0x91')]=!![];_0x3011f3[_0x1989('0x92')]=moment()[_0x1989('0x4c')](_0x1989('0x70'));_0x3011f3['queuecallerexitreason']=_0x1989('0xa8');_0x3011f3[_0x1989('0x80')]=moment()['format'](_0x1989('0x70'));this[_0x1989('0x11')][_0x56f4ea[_0x1989('0x4a')]]=_0x3011f3;}}logger[_0x1989('0x73')]('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x56f4ea[_0x1989('0x4a')],_0x3011f3['queue'],_0x3011f3['type'],_[_0x1989('0x76')](_0x56f4ea[_0x1989('0xa1')])[0x0],_0x56f4ea[_0x1989('0xa2')]);_0x3011f3[_0x1989('0x15')]=this[_0x1989('0x15')][_0x56f4ea['uniqueid']];}}}}catch(_0x242034){logger[_0x1989('0x3c')](_0x1989('0x9f'),_0x56f4ea[_0x1989('0x4a')],util[_0x1989('0x3f')](_0x242034,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1989('0x9')][_0x1989('0xa0')]=function(_0xd0446b,_0x1b8a35,_0xca9c0){var _0x54557a=[_0x1989('0xa9'),_0x1989('0xaa'),_0x1989('0xab'),_0x1989('0xac'),_0x1989('0xad'),_0x1989('0xae'),_0x1989('0xaf'),_0x1989('0xb0'),_0x1989('0xb1'),_0x1989('0xb2'),_0x1989('0xb3'),'bridgepvtcallid',_0x1989('0xb4'),'memberdynamic',_0x1989('0xb5'),_0x1989('0xb6'),_0x1989('0x8a'),_0x1989('0xb7'),_0x1989('0xb8')];if(!_['isNil'](_0x1b8a35)&&!_[_0x1989('0xb9')](_0x54557a,_0x1b8a35)){if(_[_0x1989('0x59')](this[_0x1989('0x15')][_0xd0446b])){this[_0x1989('0x15')][_0xd0446b]={};}this[_0x1989('0x15')][_0xd0446b][_0x1b8a35]=_0xca9c0;}};VoiceQueueReport[_0x1989('0x9')][_0x1989('0xba')]=function(_0xee0627,_0x198bbf,_0x20312b){try{var _0x11d501={};if(this['queueReports'][_0xee0627]){for(var _0x2f63ed=0x0;_0x2f63ed{delete this[_0x1989('0x11')][_0x449f90];},_0x38e410);}};module[_0x1989('0xf1')]=VoiceQueueReport; \ No newline at end of file +var _0x9b66=['queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','queuecallerleave','syncQueueCallerLeave','agentcomplete','agentconnect','varset','syncVarSet','hangup','syncHangup','fullybooted','syncFullyBooted','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','loopQueueShow','isEmpty','hasOwnProperty','originated','talking','waiting','queueStatusComplete','queuecallerexit','queuecallercomplete','switch','enqueue','isNil','Action','status','channel','message','[%s][voiceQueueReport][checkChannel]','inspect','queueReports','error','[%s][voiceQueueReport][checkQueueReport]','[FullyBooted]\x20clear\x20realtime','clearQueueReport','agents','summary','emit','emitVoiceQueueChannelSave','debug','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','format','voice:queue:%s','queue','voice_queue_channel:save','voice_queue_presence:save','emitVoiceQueueChannelRemove','queuecallerexitreason','ATTENDEDTRANSFER','voice_queue_channel:remove','voice_queue_presence:remove','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','name','voice_queue:save','isNotNull','isUndefined','clearZombieChannels','queues','catch','[voiceQueueReport][queues]','loopQueueSummary','isRunning','then','actionid','[voiceQueueReport][queuesummary]','createQueueSummaryReport','summaryEvent','handleInboundQueueSummaryReport','assign','queuestatus','inbound','type','outbound','custom:queuesummary','statusRequests','completeEvent','push','[voiceQueueReport][queuesummary]\x20event:','[voiceQueueReport][queuesummarycomplete]\x20event:','custom:queuesummarycomplete','[%s][voiceQueueReport][queuecallerjoin]','uniqueid','queuecallerjoinAt','position','count','info','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','pick','keys','syncQueueCallerAbandon','[%s][voiceQueueReport][queuecallerabandon]','last','queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','YYYY-MM-DD\x20HH:mm:ss','ABANDONED','lastAssignedTo','[%s][voiceQueueReport][queuecallerleave]','queuecallerleaveAt','connectedlinenum','connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','syncAgentConnect','[%s][voiceQueueReport][agentconnect]','COMPLETEDBYAGENT','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','[%s][voiceQueueReport][agentcomplete]','assigned','queuecallerexitAt','transfer','reason','COMPLETED','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','startsWith','toLowerCase','linkedid','FORWARD','destexten','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','COMPLETEDBY','toUpperCase','addVariable','variable','value','CONTINUE','TIMEOUT','timeout','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','custom:timeout','queueposition','EXITWITHKEY','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberlastcall','membername','memberpenalty','memberrealtime','includes','handleHangup','length','diff','sumDuration','milliseconds','total','answered','sumBillable','unmanaged','lastevent','custom:queuecallerunmanaged','abandoned','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','sumHoldTime','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','custom:voiceQueueReport','deleteChannelAfterTimeout','[%s][voiceQueueReport][hangup]','cause-txt','transferid','[%s][voiceQueueReport][syncHangup]\x20No\x20available\x20data\x20in\x20queueReports\x20structure:\x20clear\x20action\x20in\x20variablea\x20and\x20channels\x20structures\x20needed','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','transferexten','secondtransfererexten','transferuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertype','ATTENDED','[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','BLIND','extension','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','BlindTransfer','context','transfererchannel','mohstarttime','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','mohtime','seconds','[%s][voiceQueueReport][musiconholdstop]','[%s][voiceQueueReport][newexten]\x20event:','application','set','appdata','applicationdata','cdr(','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','split','match','[%s][voiceQueueReport][newexten]','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/queueReport','../model/voiceQueueSummary','redis','defaults','localhost','socket.io-emitter','prototype','tail','sequence','realtime','channels','queueChannels','voiceQueues','campaigns','variables','queuesummary','syncQueueSummary','bind','queuesummarycomplete','syncQueueSummaryComplete','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9b66,0xd7));var _0x69b6=function(_0x47e4e9,_0x2f772a){_0x47e4e9=_0x47e4e9-0x0;var _0x492ed4=_0x9b66[_0x47e4e9];return _0x492ed4;};'use strict';var _=require(_0x69b6('0x0'));var moment=require(_0x69b6('0x1'));var util=require(_0x69b6('0x2'));var Redis=require(_0x69b6('0x3'));var config=require(_0x69b6('0x4'));var logger=require(_0x69b6('0x5'))(_0x69b6('0x6'));var ami=require(_0x69b6('0x7'));var QueueReport=require(_0x69b6('0x8'));var VoiceQueueSummary=require(_0x69b6('0x9'));config[_0x69b6('0xa')]=_[_0x69b6('0xb')](config[_0x69b6('0xa')],{'host':_0x69b6('0xc'),'port':0x18eb});var io=require(_0x69b6('0xd'))(new Redis(config[_0x69b6('0xa')]));var Sequence=function(){};Sequence[_0x69b6('0xe')]['enqueue']=function(_0x54294c){this[_0x69b6('0xf')]=this[_0x69b6('0xf')]?this[_0x69b6('0xf')]['finally'](_0x54294c):_0x54294c();};function VoiceQueueReport(_0x5110ad){this[_0x69b6('0x10')]=new Sequence();this['queueReports']={};this[_0x69b6('0x11')]=_0x5110ad;this['agents']=_0x5110ad['agents'];this[_0x69b6('0x12')]=_0x5110ad[_0x69b6('0x13')];this[_0x69b6('0x14')]=_0x5110ad[_0x69b6('0x14')];this[_0x69b6('0x15')]=_0x5110ad[_0x69b6('0x15')];this['summary']=initializeSummary();this[_0x69b6('0x16')]={};ami['on'](_0x69b6('0x17'),this[_0x69b6('0x18')][_0x69b6('0x19')](this));ami['on'](_0x69b6('0x1a'),this[_0x69b6('0x1b')][_0x69b6('0x19')](this));ami['on'](_0x69b6('0x1c'),this[_0x69b6('0x1d')][_0x69b6('0x19')](this));ami['on'](_0x69b6('0x1e'),this[_0x69b6('0x1f')]['bind'](this));ami['on'](_0x69b6('0x20'),this[_0x69b6('0x21')][_0x69b6('0x19')](this));ami['on'](_0x69b6('0x22'),this['syncQueueCallerAbandon'][_0x69b6('0x19')](this));ami['on'](_0x69b6('0x23'),this[_0x69b6('0x24')]['bind'](this));ami['on'](_0x69b6('0x25'),this['syncAgentComplete'][_0x69b6('0x19')](this));ami['on'](_0x69b6('0x26'),this['syncAgentConnect'][_0x69b6('0x19')](this));ami['on'](_0x69b6('0x27'),this[_0x69b6('0x28')][_0x69b6('0x19')](this));ami['on'](_0x69b6('0x29'),this[_0x69b6('0x2a')][_0x69b6('0x19')](this));ami['on'](_0x69b6('0x2b'),this[_0x69b6('0x2c')][_0x69b6('0x19')](this));ami['on']('musiconholdstart',this[_0x69b6('0x2d')][_0x69b6('0x19')](this));ami['on'](_0x69b6('0x2e'),this[_0x69b6('0x2f')][_0x69b6('0x19')](this));ami['on'](_0x69b6('0x30'),this[_0x69b6('0x31')][_0x69b6('0x19')](this));ami['on']('blindtransfer',this[_0x69b6('0x32')][_0x69b6('0x19')](this));this['loopQueueSummary']();this[_0x69b6('0x33')]();}function clearChannels(_0x2696d1){if(!_[_0x69b6('0x34')](_0x2696d1)){for(var _0xf54fea in _0x2696d1){if(_0x2696d1[_0x69b6('0x35')](_0xf54fea)){delete _0x2696d1[_0xf54fea];}}}}function clearCampaigns(_0x652796){if(!_['isEmpty'](_0x652796)){for(var _0x312ed0 in _0x652796){if(_0x652796[_0x69b6('0x35')](_0x312ed0)){_0x652796[_0x312ed0]['originated']=0x0;}}}}function clearVoiceQueues(_0x2a5f4c){if(!_[_0x69b6('0x34')](_0x2a5f4c)){for(var _0x206c1e in _0x2a5f4c){if(_0x2a5f4c[_0x69b6('0x35')](_0x206c1e)){_0x2a5f4c[_0x206c1e][_0x69b6('0x36')]=0x0;_0x2a5f4c[_0x206c1e][_0x69b6('0x37')]=0x0;_0x2a5f4c[_0x206c1e]['pTalking']=0x0;_0x2a5f4c[_0x206c1e][_0x69b6('0x38')]=0x0;_0x2a5f4c[_0x206c1e][_0x69b6('0x39')]=!![];}}}}function clearAgentBooked(_0x44ee5d){if(!_[_0x69b6('0x34')](_0x44ee5d)){for(var _0x134c9e in _0x44ee5d){if(_0x44ee5d[_0x69b6('0x35')](_0x134c9e)){_0x44ee5d[_0x134c9e]['unlockRR']=!![];}}}}function initializeSummary(){return{'id':null,'completeEvent':null,'isRunning':![],'queues':{},'queuestatus':{},'statusRequests':0x0};}function hasCallerLeftTheQueue(_0x5d31bd){return _0x5d31bd[_0x69b6('0x3a')]||_0x5d31bd[_0x69b6('0x22')]||_0x5d31bd[_0x69b6('0x3b')];}VoiceQueueReport['prototype']['clearZombieChannels']=function(){var _0x4e2588=this;for(var _0x55edd2 in this[_0x69b6('0x12')]){if(this[_0x69b6('0x12')][_0x69b6('0x35')](_0x55edd2)&&!this[_0x69b6('0x12')][_0x55edd2][_0x69b6('0x3c')]){this[_0x69b6('0x10')][_0x69b6('0x3d')](function(){if(!_[_0x69b6('0x3e')](_0x4e2588[_0x69b6('0x12')][_0x55edd2])){return ami[_0x69b6('0x3f')]({'action':_0x69b6('0x40'),'channel':_0x4e2588[_0x69b6('0x12')][_0x55edd2][_0x69b6('0x41')]})['catch'](function(_0x52b9e5){if(_0x52b9e5[_0x69b6('0x42')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x4e2588[_0x69b6('0x12')][_0x55edd2]){delete _0x4e2588[_0x69b6('0x12')][_0x55edd2];logger['error'](_0x69b6('0x43'),_0x55edd2,util[_0x69b6('0x44')](_0x52b9e5,{'showHidden':![],'depth':null}));}if(_0x4e2588['queueReports'][_0x55edd2]){delete _0x4e2588[_0x69b6('0x45')][_0x55edd2];logger[_0x69b6('0x46')](_0x69b6('0x47'),_0x55edd2,util[_0x69b6('0x44')](_0x52b9e5,{'showHidden':![],'depth':null}));}if(_0x4e2588[_0x69b6('0x16')][_0x55edd2]){delete _0x4e2588['variables'][_0x55edd2];logger[_0x69b6('0x46')]('[%s][voiceQueueReport][checkVariables]',_0x55edd2,util[_0x69b6('0x44')](_0x52b9e5,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0x69b6('0xe')]['syncFullyBooted']=function(){logger[_0x69b6('0x46')](_0x69b6('0x48'));clearChannels(this[_0x69b6('0x12')]);this[_0x69b6('0x49')](this[_0x69b6('0x45')]);clearAgentBooked(this[_0x69b6('0x4a')]);clearVoiceQueues(this[_0x69b6('0x14')]);clearCampaigns(this[_0x69b6('0x15')]);this[_0x69b6('0x4b')]=initializeSummary();};VoiceQueueReport['prototype'][_0x69b6('0x49')]=function(_0x16ef0d){var _0x10f6ea=this;if(!_[_0x69b6('0x34')](_0x16ef0d)){for(var _0xf57b04 in _0x16ef0d){if(_0x16ef0d['hasOwnProperty'](_0xf57b04)){_0x10f6ea['emitVoiceQueueChannelRemove'](_0x16ef0d[_0xf57b04],'clearqueuereport');delete _0x16ef0d[_0xf57b04];}}}};VoiceQueueReport[_0x69b6('0xe')][_0x69b6('0x4c')]=function(_0x4346d0,_0x1f1298,_0x49caaa){io['to'](_0x4346d0)[_0x69b6('0x4c')](_0x1f1298,_0x49caaa);};VoiceQueueReport['prototype'][_0x69b6('0x4d')]=function(_0x51f593,_0x1b32c6){logger[_0x69b6('0x4e')](_0x69b6('0x4f')+_0x1b32c6+_0x69b6('0x50'),_0x51f593['uniqueid'],util[_0x69b6('0x44')](_0x51f593,{'showHidden':![],'depth':null}));this[_0x69b6('0x4c')](util[_0x69b6('0x51')](_0x69b6('0x52'),_0x51f593[_0x69b6('0x53')]),_0x69b6('0x54'),_0x51f593);io[_0x69b6('0x4c')](_0x69b6('0x55'),_0x51f593);};VoiceQueueReport[_0x69b6('0xe')][_0x69b6('0x56')]=function(_0x11deda,_0x4205f4){logger['debug']('[%s][voiceQueueReport]['+_0x4205f4+']\x20sending\x20voice_queue_channel:remove\x20event:',_0x11deda['uniqueid'],util['inspect'](_0x11deda,{'showHidden':![],'depth':null}));if(_0x11deda[_0x69b6('0x57')]===_0x69b6('0x58')){return;}this[_0x69b6('0x4c')](util[_0x69b6('0x51')](_0x69b6('0x52'),_0x11deda[_0x69b6('0x53')]),_0x69b6('0x59'),_0x11deda);io[_0x69b6('0x4c')](_0x69b6('0x5a'),_0x11deda);};VoiceQueueReport[_0x69b6('0xe')]['emitInboundVoiceQueueSummary']=function(_0x35e3cc){if(_0x35e3cc['type']==='inbound'){logger[_0x69b6('0x4e')](_0x69b6('0x5b'),util[_0x69b6('0x44')](_0x35e3cc,{'showHidden':![],'depth':null}));this['emit'](util[_0x69b6('0x51')](_0x69b6('0x52'),_0x35e3cc[_0x69b6('0x5c')]),_0x69b6('0x5d'),_0x35e3cc);}};VoiceQueueReport['prototype'][_0x69b6('0x5e')]=function(_0xfeb5ea){return _0xfeb5ea!==null&&!_[_0x69b6('0x5f')](_0xfeb5ea);};VoiceQueueReport['prototype']['loopQueueShow']=function(){var _0x2ffd6a=this;setInterval(function(){_0x2ffd6a[_0x69b6('0x60')]();ami[_0x69b6('0x3f')]({'action':_0x69b6('0x61')})[_0x69b6('0x62')](function(_0x5aa32b){logger[_0x69b6('0x46')](_0x69b6('0x63'),util['inspect'](_0x5aa32b,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport['prototype'][_0x69b6('0x64')]=function(){var _0x1b5b93=this;setInterval(function(){if(!_0x1b5b93[_0x69b6('0x4b')][_0x69b6('0x65')]){return ami[_0x69b6('0x3f')]({'action':_0x69b6('0x17')})[_0x69b6('0x66')](function(_0x39446d){_0x1b5b93[_0x69b6('0x4b')]['id']=_0x39446d[_0x69b6('0x67')];_0x1b5b93[_0x69b6('0x4b')]['isRunning']=!![];_0x1b5b93[_0x69b6('0x4b')]['queuestatus'][_0x39446d[_0x69b6('0x67')]]={};})[_0x69b6('0x62')](function(_0x3ea2af){logger['error'](_0x69b6('0x68'),util[_0x69b6('0x44')](_0x3ea2af,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0x69b6('0xe')][_0x69b6('0x69')]=function(_0x51c84d,_0x3a6024){var _0x48bf49;if(this[_0x69b6('0x4b')]&&this[_0x69b6('0x4b')][_0x69b6('0x61')]&&this[_0x69b6('0x4b')][_0x69b6('0x61')][_0x51c84d['name']]){_0x48bf49=this[_0x69b6('0x4b')][_0x69b6('0x61')][_0x51c84d[_0x69b6('0x5c')]][_0x69b6('0x6a')];}var _0x303a48=new VoiceQueueSummary(_0x51c84d);return _0x303a48['createReport'](_0x3a6024[_0x69b6('0x4a')],this[_0x69b6('0x4a')],_0x48bf49,this[_0x69b6('0x11')]['channels']);};VoiceQueueReport['prototype'][_0x69b6('0x6b')]=function(_0x308f3d,_0x5dbd81){var _0x1c00f4=this['createQueueSummaryReport'](_0x308f3d,_0x5dbd81);var _0x267082=![];_0x267082=_0x1c00f4['compareToInboundQueue'](_0x308f3d);if(_0x267082){Object[_0x69b6('0x6c')](_0x308f3d,_0x1c00f4);this[_0x69b6('0x11')]['voiceQueues'][_0x308f3d['name']]=_0x308f3d;this['emitInboundVoiceQueueSummary'](_0x1c00f4);}};VoiceQueueReport['prototype'][_0x69b6('0x1f')]=function(_0x228c35){var _0x51cbc6=null;var _0x3fcf99=this['summary']['id'];if(this['summary'][_0x69b6('0x6d')][_0x3fcf99]){_0x51cbc6=this[_0x69b6('0x4b')][_0x69b6('0x6d')][_0x3fcf99][_0x228c35[_0x69b6('0x67')]];}if(!_0x51cbc6){this[_0x69b6('0x4b')]=initializeSummary();return;}var _0x287932=this['voiceQueues'][_0x51cbc6[_0x69b6('0x53')]];if(_0x287932['type']===_0x69b6('0x6e')){this[_0x69b6('0x6b')](_0x287932,_0x51cbc6);}else if(_0x287932[_0x69b6('0x6f')]===_0x69b6('0x70')){var _0x329f10=this[_0x69b6('0x69')](_0x287932,_0x51cbc6);ami[_0x69b6('0x4c')](_0x69b6('0x71'),_0x329f10);}this[_0x69b6('0x4b')][_0x69b6('0x72')]-=0x1;var _0x11ca6d=this[_0x69b6('0x4b')][_0x69b6('0x72')]>0x0?!![]:![];if(!_0x11ca6d){return this[_0x69b6('0x1b')](this[_0x69b6('0x4b')][_0x69b6('0x73')]);}};VoiceQueueReport[_0x69b6('0xe')]['syncQueueMember']=function(_0x133a7e){var _0x47253e=this[_0x69b6('0x4b')]['id'];if(this[_0x69b6('0x4b')][_0x69b6('0x6d')][_0x47253e]&&this[_0x69b6('0x4b')][_0x69b6('0x6d')][_0x47253e][_0x133a7e[_0x69b6('0x67')]]){this[_0x69b6('0x4b')][_0x69b6('0x6d')][_0x47253e][_0x133a7e[_0x69b6('0x67')]][_0x69b6('0x4a')][_0x69b6('0x74')](_0x133a7e);}};VoiceQueueReport[_0x69b6('0xe')]['syncQueueSummary']=function(_0x255198){var _0x41afa8=this;try{if(this[_0x69b6('0x5e')](_0x255198)&&this[_0x69b6('0x5e')](_0x255198[_0x69b6('0x53')])){logger[_0x69b6('0x4e')](_0x69b6('0x75'),util[_0x69b6('0x44')](_0x255198,{'showHidden':![],'depth':null}));var _0x869827=this[_0x69b6('0x14')][_0x255198['queue']];if(_0x869827){logger[_0x69b6('0x4e')]('[voiceQueueReport][queuesummary]\x20name:%s',_0x869827[_0x69b6('0x5c')]);this[_0x69b6('0x4b')]['queues'][_0x869827[_0x69b6('0x5c')]]={'summaryEvent':_0x255198};this[_0x69b6('0x4b')][_0x69b6('0x72')]+=0x1;return ami[_0x69b6('0x3f')]({'action':_0x69b6('0x6d'),'queue':_0x869827[_0x69b6('0x5c')]})[_0x69b6('0x66')](function(_0x288aba){if(!_0x41afa8[_0x69b6('0x4b')]['queuestatus'][_0x255198[_0x69b6('0x67')]]){_0x41afa8[_0x69b6('0x4b')][_0x69b6('0x6d')][_0x255198[_0x69b6('0x67')]]={};}_0x41afa8[_0x69b6('0x4b')][_0x69b6('0x6d')][_0x255198['actionid']][_0x288aba[_0x69b6('0x67')]]={'queue':_0x869827[_0x69b6('0x5c')],'agents':[]};})[_0x69b6('0x62')](function(_0x13bbcf){throw _0x13bbcf;});}}}catch(_0x2c62a5){logger[_0x69b6('0x46')](_0x69b6('0x68'),util[_0x69b6('0x44')](_0x2c62a5,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueSummaryComplete']=function(_0x257034){if(this[_0x69b6('0x4b')][_0x69b6('0x72')]>0x0){this['summary'][_0x69b6('0x73')]=_0x257034;return;}logger[_0x69b6('0x4e')](_0x69b6('0x76'),util[_0x69b6('0x44')](_0x257034,{'showHidden':![],'depth':null}));this[_0x69b6('0x4b')]=initializeSummary();ami['emit'](_0x69b6('0x77'),{});};VoiceQueueReport[_0x69b6('0xe')][_0x69b6('0x21')]=function(_0x40f373){try{if(this[_0x69b6('0x5e')](_0x40f373)){logger[_0x69b6('0x4e')](_0x69b6('0x78'),_0x40f373[_0x69b6('0x79')],util[_0x69b6('0x44')](_0x40f373,{'showHidden':![],'depth':null}));if(_[_0x69b6('0x5f')](this[_0x69b6('0x45')][_0x40f373[_0x69b6('0x79')]])){this[_0x69b6('0x45')][_0x40f373[_0x69b6('0x79')]]=[];}if(_[_0x69b6('0x5f')](this[_0x69b6('0x12')][_0x40f373[_0x69b6('0x79')]])){this['channels'][_0x40f373[_0x69b6('0x79')]]={};}var _0x48e08a=new QueueReport();_0x48e08a['queue']=_0x40f373[_0x69b6('0x53')];_0x48e08a[_0x69b6('0x6f')]=this[_0x69b6('0x14')][_0x48e08a[_0x69b6('0x53')]]&&this[_0x69b6('0x14')][_0x48e08a[_0x69b6('0x53')]][_0x69b6('0x6f')]?this[_0x69b6('0x14')][_0x48e08a[_0x69b6('0x53')]][_0x69b6('0x6f')]||_0x69b6('0x6e'):'inbound';_0x48e08a[_0x69b6('0x7a')]=moment()[_0x69b6('0x51')]('YYYY-MM-DD\x20HH:mm:ss');_0x48e08a['position']=_0x40f373[_0x69b6('0x7b')];_0x48e08a[_0x69b6('0x7c')]=_0x40f373[_0x69b6('0x7c')];_0x48e08a[_0x69b6('0x79')]=_0x40f373[_0x69b6('0x79')];logger[_0x69b6('0x7d')](_0x69b6('0x7e'),_0x48e08a[_0x69b6('0x53')],_0x48e08a[_0x69b6('0x6f')]);Object['assign'](_0x48e08a,_[_0x69b6('0x7f')](_0x40f373,_[_0x69b6('0x80')](_0x48e08a)));this[_0x69b6('0x45')][_0x40f373['uniqueid']][_0x69b6('0x74')](_0x48e08a);this[_0x69b6('0x12')][_0x40f373[_0x69b6('0x79')]]=_0x48e08a;this[_0x69b6('0x4d')](_0x48e08a,_0x69b6('0x20'));}}catch(_0x1dab13){logger[_0x69b6('0x46')](_0x69b6('0x78'),_0x40f373[_0x69b6('0x79')],util[_0x69b6('0x44')](_0x1dab13,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x69b6('0xe')][_0x69b6('0x81')]=function(_0x5e5a7a){try{if(this[_0x69b6('0x5e')](_0x5e5a7a)){logger['debug'](_0x69b6('0x82'),_0x5e5a7a[_0x69b6('0x79')],util[_0x69b6('0x44')](_0x5e5a7a,{'showHidden':![],'depth':null}));if(this[_0x69b6('0x45')][_0x5e5a7a[_0x69b6('0x79')]]){var _0x59be67=_[_0x69b6('0x83')](this[_0x69b6('0x45')][_0x5e5a7a['uniqueid']]);_0x59be67['queuecallercomplete']=![];_0x59be67[_0x69b6('0x84')]=null;_0x59be67[_0x69b6('0x85')]=_0x5e5a7a[_0x69b6('0x85')];_0x59be67['originalposition']=_0x5e5a7a[_0x69b6('0x86')];_0x59be67['queuecallerabandon']=!![];_0x59be67[_0x69b6('0x87')]=moment()[_0x69b6('0x51')](_0x69b6('0x88'));_0x59be67['queuecallerexitreason']=_0x69b6('0x89');_0x59be67[_0x69b6('0x8a')]=null;logger[_0x69b6('0x7d')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x59be67['queue'],_0x59be67[_0x69b6('0x6f')]);this[_0x69b6('0x12')][_0x5e5a7a[_0x69b6('0x79')]]=_0x59be67;this[_0x69b6('0x56')](_0x59be67,'queuecallerabandon');}}}catch(_0x17f6df){logger[_0x69b6('0x46')](_0x69b6('0x82'),_0x5e5a7a['uniqueid'],util[_0x69b6('0x44')](_0x17f6df,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x69b6('0xe')][_0x69b6('0x24')]=function(_0x5ce700){try{if(this[_0x69b6('0x5e')](_0x5ce700)){logger[_0x69b6('0x4e')](_0x69b6('0x8b'),_0x5ce700[_0x69b6('0x79')],util[_0x69b6('0x44')](_0x5ce700,{'showHidden':![],'depth':null}));if(this[_0x69b6('0x45')][_0x5ce700['uniqueid']]){var _0x50470c=_[_0x69b6('0x83')](this[_0x69b6('0x45')][_0x5ce700[_0x69b6('0x79')]]);_0x50470c[_0x69b6('0x8c')]=moment()[_0x69b6('0x51')](_0x69b6('0x88'));_0x50470c[_0x69b6('0x8d')]=_0x5ce700[_0x69b6('0x8d')];_0x50470c[_0x69b6('0x8e')]=_0x5ce700[_0x69b6('0x8e')];logger[_0x69b6('0x7d')](_0x69b6('0x8f'),_0x50470c[_0x69b6('0x53')],_0x50470c[_0x69b6('0x6f')],_0x5ce700[_0x69b6('0x8d')],_0x5ce700['connectedlinename']);this['channels'][_0x5ce700[_0x69b6('0x79')]]=_0x50470c;this[_0x69b6('0x4d')](_0x50470c,_0x69b6('0x23'));}}}catch(_0x114f8f){logger[_0x69b6('0x46')](_0x69b6('0x8b'),_0x5ce700['uniqueid'],util[_0x69b6('0x44')](_0x114f8f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x69b6('0xe')][_0x69b6('0x90')]=function(_0x1891e6){try{if(this['isNotNull'](_0x1891e6)){logger[_0x69b6('0x4e')](_0x69b6('0x91'),_0x1891e6['uniqueid'],util['inspect'](_0x1891e6,{'showHidden':![],'depth':null}));if(this[_0x69b6('0x45')][_0x1891e6[_0x69b6('0x79')]]){var _0x44828b=_[_0x69b6('0x83')](this[_0x69b6('0x45')][_0x1891e6[_0x69b6('0x79')]]);_0x44828b[_0x69b6('0x3b')]=!![];_0x44828b[_0x69b6('0x57')]=_0x69b6('0x92');logger[_0x69b6('0x7d')](_0x69b6('0x93'),_0x44828b[_0x69b6('0x53')],_0x44828b[_0x69b6('0x6f')]);}}}catch(_0x321780){logger['error'](_0x69b6('0x91'),_0x1891e6[_0x69b6('0x79')],util[_0x69b6('0x44')](_0x321780,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x69b6('0xe')]['syncAgentComplete']=function(_0x3c0c7b){try{if(this['isNotNull'](_0x3c0c7b)){logger[_0x69b6('0x4e')](_0x69b6('0x94'),_0x3c0c7b[_0x69b6('0x79')],util[_0x69b6('0x44')](_0x3c0c7b,{'showHidden':![],'depth':null}));if(this[_0x69b6('0x45')][_0x3c0c7b[_0x69b6('0x79')]]){var _0x5835a5=_[_0x69b6('0x83')](this[_0x69b6('0x45')][_0x3c0c7b[_0x69b6('0x79')]]);_0x5835a5['queuecallerabandon']=![];_0x5835a5['queuecallerabandonAt']=null;_0x5835a5[_0x69b6('0x95')]=!![];_0x5835a5[_0x69b6('0x8a')]=_0x3c0c7b['membername'];_0x5835a5[_0x69b6('0x85')]=_0x3c0c7b['holdtime'];_0x5835a5[_0x69b6('0x3b')]=!![];_0x5835a5[_0x69b6('0x3a')]=![];_0x5835a5[_0x69b6('0x96')]=null;if(!_0x5835a5[_0x69b6('0x97')]){if(_0x3c0c7b[_0x69b6('0x98')]==_0x69b6('0x97')){_0x5835a5[_0x69b6('0x57')]=_0x69b6('0x99');logger[_0x69b6('0x7d')](_0x69b6('0x9a'),_0x5835a5[_0x69b6('0x53')],_0x5835a5[_0x69b6('0x6f')]);}else{if(_[_0x69b6('0x9b')](_0x3c0c7b[_0x69b6('0x41')][_0x69b6('0x9c')](),'local/')){if(this[_0x69b6('0x45')][_0x3c0c7b['linkedid']]){var _0x7e10ca=_[_0x69b6('0x83')](this[_0x69b6('0x45')][_0x3c0c7b[_0x69b6('0x9d')]]);_0x7e10ca[_0x69b6('0x3b')]=![];_0x7e10ca[_0x69b6('0x3a')]=!![];_0x7e10ca[_0x69b6('0x96')]=moment(_0x5835a5['queuecallerjoinAt'])['add'](_0x3c0c7b[_0x69b6('0x85')],'seconds')['format'](_0x69b6('0x88'));_0x7e10ca[_0x69b6('0x57')]='FORWARDTRANSFER';_0x7e10ca[_0x69b6('0x97')]=!![];_0x7e10ca['transfertype']=_0x69b6('0x9e');_0x7e10ca['transferexten']=_0x3c0c7b[_0x69b6('0x9f')];_0x7e10ca['transferuniqueid']=_0x3c0c7b[_0x69b6('0x79')];logger[_0x69b6('0x7d')](_0x69b6('0xa0'),_0x7e10ca[_0x69b6('0x53')],_0x7e10ca['type']);var _0x4e25e8=this[_0x69b6('0x45')][_0x3c0c7b['linkedid']];this[_0x69b6('0x45')][_0x3c0c7b[_0x69b6('0x9d')]]=this[_0x69b6('0x45')][_0x3c0c7b[_0x69b6('0x79')]];this[_0x69b6('0x45')][_0x3c0c7b[_0x69b6('0x79')]]=_0x4e25e8;}}else{_0x5835a5[_0x69b6('0x57')]=_0x69b6('0xa1')+_0x3c0c7b['reason'][_0x69b6('0xa2')]();logger[_0x69b6('0x7d')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x5835a5[_0x69b6('0x53')],_0x5835a5[_0x69b6('0x6f')],_0x5835a5['queuecallerexitreason']);}}}this[_0x69b6('0x12')][_0x3c0c7b['uniqueid']]=_0x5835a5;}}}catch(_0x7dad88){logger[_0x69b6('0x46')](_0x69b6('0x94'),_0x3c0c7b[_0x69b6('0x79')],util[_0x69b6('0x44')](_0x7dad88,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x69b6('0x28')]=function(_0x39e683){try{if(this[_0x69b6('0x5e')](_0x39e683)){logger[_0x69b6('0x4e')]('[%s][voiceQueueReport][varset]',_0x39e683[_0x69b6('0x79')],util[_0x69b6('0x44')](_0x39e683,{'showHidden':![],'depth':null}));this[_0x69b6('0xa3')](_0x39e683[_0x69b6('0x79')],_[_0x69b6('0x80')](_0x39e683['variable'])[0x0],_0x39e683['value']);if(this[_0x69b6('0x45')][_0x39e683['uniqueid']]){var _0x53d4fe=_[_0x69b6('0x83')](this[_0x69b6('0x45')][_0x39e683[_0x69b6('0x79')]]);if(_0x53d4fe){if(this[_0x69b6('0x5e')](_0x39e683[_0x69b6('0xa4')])&&this['isNotNull'](_0x39e683[_0x69b6('0xa4')][_0x69b6('0x6d')])){switch(_0x39e683[_0x69b6('0xa5')]){case _0x69b6('0xa6'):_0x53d4fe[_0x69b6('0x3a')]=![];_0x53d4fe['queuecallerexitAt']=null;break;case _0x69b6('0xa7'):_0x53d4fe['lastevent']=_0x69b6('0xa8');_0x53d4fe[_0x69b6('0x3a')]=!![];_0x53d4fe[_0x69b6('0x96')]=moment()[_0x69b6('0x51')]('YYYY-MM-DD\x20HH:mm:ss');_0x53d4fe[_0x69b6('0x8c')]=moment()[_0x69b6('0x51')](_0x69b6('0x88'));logger['debug'](_0x69b6('0xa9'),_0x39e683[_0x69b6('0x79')],util[_0x69b6('0x44')](_0x53d4fe,{'showHidden':![],'depth':null}));ami[_0x69b6('0x4c')](_0x69b6('0xaa'),_0x53d4fe);break;default:_0x53d4fe[_0x69b6('0x3a')]=!![];_0x53d4fe[_0x69b6('0x96')]=moment()[_0x69b6('0x51')](_0x69b6('0x88'));_0x53d4fe[_0x69b6('0x8c')]=moment()[_0x69b6('0x51')](_0x69b6('0x88'));}_0x53d4fe[_0x69b6('0x22')]=![];_0x53d4fe[_0x69b6('0x87')]=null;_0x53d4fe[_0x69b6('0x57')]=_0x39e683['value'];this[_0x69b6('0x12')][_0x39e683[_0x69b6('0x79')]]=_0x53d4fe;this['emitVoiceQueueChannelRemove'](_0x53d4fe,_0x69b6('0x27'));}else if(this['isNotNull'](_0x39e683[_0x69b6('0xa4')])&&this['isNotNull'](_0x39e683[_0x69b6('0xa4')][_0x69b6('0xab')])){if(!_0x53d4fe[_0x69b6('0x22')]){_0x53d4fe[_0x69b6('0x3a')]=!![];_0x53d4fe[_0x69b6('0x96')]=moment()['format'](_0x69b6('0x88'));_0x53d4fe[_0x69b6('0x57')]=_0x69b6('0xac');_0x53d4fe[_0x69b6('0x8c')]=moment()[_0x69b6('0x51')](_0x69b6('0x88'));this['channels'][_0x39e683[_0x69b6('0x79')]]=_0x53d4fe;}}logger['info'](_0x69b6('0xad'),_0x39e683[_0x69b6('0x79')],_0x53d4fe[_0x69b6('0x53')],_0x53d4fe['type'],_[_0x69b6('0x80')](_0x39e683['variable'])[0x0],_0x39e683[_0x69b6('0xa5')]);_0x53d4fe[_0x69b6('0x16')]=this[_0x69b6('0x16')][_0x39e683[_0x69b6('0x79')]];}}}}catch(_0x2f4dd7){logger['error']('[%s][voiceQueueReport][varset]',_0x39e683[_0x69b6('0x79')],util[_0x69b6('0x44')](_0x2f4dd7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x69b6('0xe')][_0x69b6('0xa3')]=function(_0x3a2299,_0x2eca09,_0xd140b1){var _0x1d8c92=[_0x69b6('0xae'),'rtpaudioqosbridged',_0x69b6('0xaf'),'rtpaudioqosjitterbridged',_0x69b6('0xb0'),'rtpaudioqoslossbridged','rtpaudioqosrtt',_0x69b6('0xb1'),_0x69b6('0xb2'),_0x69b6('0xb3'),_0x69b6('0xb4'),_0x69b6('0xb5'),_0x69b6('0xb6'),_0x69b6('0xb7'),'memberinterface',_0x69b6('0xb8'),_0x69b6('0xb9'),_0x69b6('0xba'),_0x69b6('0xbb')];if(!_[_0x69b6('0x3e')](_0x2eca09)&&!_[_0x69b6('0xbc')](_0x1d8c92,_0x2eca09)){if(_[_0x69b6('0x5f')](this[_0x69b6('0x16')][_0x3a2299])){this[_0x69b6('0x16')][_0x3a2299]={};}this['variables'][_0x3a2299][_0x2eca09]=_0xd140b1;}};VoiceQueueReport[_0x69b6('0xe')][_0x69b6('0xbd')]=function(_0x1a75c5,_0x30736c,_0x4fbd6d){try{var _0x3f2040={};if(this[_0x69b6('0x45')][_0x1a75c5]){for(var _0x3ffa8c=0x0;_0x3ffa8c{delete this[_0x69b6('0x12')][_0xf1611a];},_0x10f059);}};module['exports']=VoiceQueueReport; \ No newline at end of file diff --git a/server/services/ami/rpc/agentReportPreview.js b/server/services/ami/rpc/agentReportPreview.js index 85a2e14..1cc2553 100644 --- a/server/services/ami/rpc/agentReportPreview.js +++ b/server/services/ami/rpc/agentReportPreview.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe7fc=['Request','CreateReportAgentPreview','createHistory'];(function(_0x29a015,_0x2094d2){var _0xa4be7b=function(_0x1c1a21){while(--_0x1c1a21){_0x29a015['push'](_0x29a015['shift']());}};_0xa4be7b(++_0x2094d2);}(_0xe7fc,0x1bb));var _0xce7f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe7fc[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0xce7f('0x0')]=function(_0x260b4a){return function(){_0x260b4a['campaign']=_0x260b4a['queue'];return client[_0xce7f('0x1')](_0xce7f('0x2'),{'body':_0x260b4a,'log':_0xce7f('0x2')});};}; \ No newline at end of file +var _0x3f25=['campaign','queue','Request','CreateReportAgentPreview','../client'];(function(_0x3bc1c5,_0x11adcf){var _0x39e334=function(_0x39975e){while(--_0x39975e){_0x3bc1c5['push'](_0x3bc1c5['shift']());}};_0x39e334(++_0x11adcf);}(_0x3f25,0xb8));var _0x53f2=function(_0x4e6185,_0x2b6343){_0x4e6185=_0x4e6185-0x0;var _0x50f0af=_0x3f25[_0x4e6185];return _0x50f0af;};'use strict';var client=require(_0x53f2('0x0'));exports['createHistory']=function(_0x594a76){return function(){_0x594a76[_0x53f2('0x1')]=_0x594a76[_0x53f2('0x2')];return client[_0x53f2('0x3')](_0x53f2('0x4'),{'body':_0x594a76,'log':_0x53f2('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/attachment.js b/server/services/ami/rpc/attachment.js index 18f867e..3a0c6dc 100644 --- a/server/services/ami/rpc/attachment.js +++ b/server/services/ami/rpc/attachment.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6bdd=['Request','CreateAttachment','create'];(function(_0x70a3b0,_0x492553){var _0x3693e0=function(_0x596dc9){while(--_0x596dc9){_0x70a3b0['push'](_0x70a3b0['shift']());}};_0x3693e0(++_0x492553);}(_0x6bdd,0xe9));var _0xd6bd=function(_0x35c4b6,_0x3f462e){_0x35c4b6=_0x35c4b6-0x0;var _0x444f74=_0x6bdd[_0x35c4b6];return _0x444f74;};'use strict';var client=require('../client');exports[_0xd6bd('0x0')]=function(_0x1966c){return client[_0xd6bd('0x1')](_0xd6bd('0x2'),{'body':_0x1966c,'log':_0xd6bd('0x2')});}; \ No newline at end of file +var _0xa2a1=['Request','CreateAttachment','create'];(function(_0x29f653,_0x15f527){var _0x5cc560=function(_0x3ea5a7){while(--_0x3ea5a7){_0x29f653['push'](_0x29f653['shift']());}};_0x5cc560(++_0x15f527);}(_0xa2a1,0x1b5));var _0x1a2a=function(_0x1d29bc,_0x3a79ab){_0x1d29bc=_0x1d29bc-0x0;var _0x63322d=_0xa2a1[_0x1d29bc];return _0x63322d;};'use strict';var client=require('../client');exports[_0x1a2a('0x0')]=function(_0x47f4e3){return client[_0x1a2a('0x1')](_0x1a2a('0x2'),{'body':_0x47f4e3,'log':_0x1a2a('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/campaign.js b/server/services/ami/rpc/campaign.js index 2b8a1c5..a5708ea 100644 --- a/server/services/ami/rpc/campaign.js +++ b/server/services/ami/rpc/campaign.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','Trunk','name','callerid','Interval','interval','SquareProject','getCampaign','../client','getCampaigns','Request','GetCampaign','type','active','limitCalls','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialTimezone','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialOrderByScheduledAt'];(function(_0x345db7,_0x19fd44){var _0x5905e7=function(_0x4197e8){while(--_0x4197e8){_0x345db7['push'](_0x345db7['shift']());}};_0x5905e7(++_0x19fd44);}(_0xdb28,0x106));var _0x8db2=function(_0x198fec,_0x526196){_0x198fec=_0x198fec-0x0;var _0x5baa01=_0xdb28[_0x198fec];return _0x5baa01;};'use strict';var client=require(_0x8db2('0x0'));exports[_0x8db2('0x1')]=function(){return function(){return client[_0x8db2('0x2')](_0x8db2('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x8db2('0x4'),_0x8db2('0x5'),_0x8db2('0x6'),_0x8db2('0x7'),_0x8db2('0x8'),'dialOriginateTimeout',_0x8db2('0x9'),_0x8db2('0xa'),'dialBusyMaxRetry','dialBusyRetryFrequency',_0x8db2('0xb'),_0x8db2('0xc'),_0x8db2('0xd'),_0x8db2('0xe'),_0x8db2('0xf'),_0x8db2('0x10'),_0x8db2('0x11'),'dialAbandonedMaxRetry',_0x8db2('0x12'),_0x8db2('0x13'),_0x8db2('0x14'),'dialAgentRejectMaxRetry',_0x8db2('0x15'),_0x8db2('0x16'),'dialGlobalInterval',_0x8db2('0x17'),_0x8db2('0x18'),_0x8db2('0x19'),_0x8db2('0x1a'),_0x8db2('0x1b'),'dialAMDMinWordLength','dialAMDBetweenWordsSilence',_0x8db2('0x1c'),_0x8db2('0x1d'),_0x8db2('0x1e'),_0x8db2('0x1f'),_0x8db2('0x20'),_0x8db2('0x21'),_0x8db2('0x22')],'include':[{'model':_0x8db2('0x23'),'as':_0x8db2('0x23'),'attributes':['id',_0x8db2('0x24'),'callerid',_0x8db2('0x5')]},{'model':_0x8db2('0x23'),'as':'TrunkBackup','attributes':['id',_0x8db2('0x24'),_0x8db2('0x25'),_0x8db2('0x5')]},{'model':_0x8db2('0x26'),'as':_0x8db2('0x26'),'attributes':['id',_0x8db2('0x24')],'include':[{'model':'Interval','as':'Intervals','attributes':['id',_0x8db2('0x24'),_0x8db2('0x27')]}]},{'model':_0x8db2('0x28'),'as':_0x8db2('0x28'),'attributes':['id','name']}]},'log':_0x8db2('0x29')});};}; \ No newline at end of file +var _0x326f=['dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialGlobalInterval','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialPrefix','Trunk','callerid','TrunkBackup','Interval','Intervals','SquareProject','../client','GetCampaign','name','type','active','limitCalls','dialOriginateCallerIdName'];(function(_0xcaa0df,_0x106a18){var _0x5d8372=function(_0x4949da){while(--_0x4949da){_0xcaa0df['push'](_0xcaa0df['shift']());}};_0x5d8372(++_0x106a18);}(_0x326f,0xd1));var _0xf326=function(_0x4abe1c,_0x2c76bf){_0x4abe1c=_0x4abe1c-0x0;var _0x1f16d1=_0x326f[_0x4abe1c];return _0x1f16d1;};'use strict';var client=require(_0xf326('0x0'));exports['getCampaigns']=function(){return function(){return client['Request'](_0xf326('0x1'),{'options':{'raw':![],'attributes':['id',_0xf326('0x2'),_0xf326('0x3'),_0xf326('0x4'),_0xf326('0x5'),_0xf326('0x6'),_0xf326('0x7'),_0xf326('0x8'),_0xf326('0x9'),_0xf326('0xa'),'dialBusyMaxRetry',_0xf326('0xb'),_0xf326('0xc'),_0xf326('0xd'),_0xf326('0xe'),'dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry',_0xf326('0xf'),_0xf326('0x10'),_0xf326('0x11'),_0xf326('0x12'),_0xf326('0x13'),'dialAgentRejectMaxRetry',_0xf326('0x14'),'dialTimezone',_0xf326('0x15'),'dialAMDActive',_0xf326('0x16'),'dialAMDGreeting',_0xf326('0x17'),_0xf326('0x18'),'dialAMDMinWordLength',_0xf326('0x19'),_0xf326('0x1a'),_0xf326('0x1b'),_0xf326('0x1c'),'dialOrderByScheduledAt',_0xf326('0x1d'),'dialRandomLastDigitCallerIdNumber','dialCutDigit'],'include':[{'model':_0xf326('0x1e'),'as':_0xf326('0x1e'),'attributes':['id',_0xf326('0x2'),_0xf326('0x1f'),_0xf326('0x4')]},{'model':_0xf326('0x1e'),'as':_0xf326('0x20'),'attributes':['id',_0xf326('0x2'),'callerid',_0xf326('0x4')]},{'model':_0xf326('0x21'),'as':_0xf326('0x21'),'attributes':['id',_0xf326('0x2')],'include':[{'model':_0xf326('0x21'),'as':_0xf326('0x22'),'attributes':['id','name','interval']}]},{'model':'SquareProject','as':_0xf326('0x23'),'attributes':['id',_0xf326('0x2')]}]},'log':'getCampaign'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmContact.js b/server/services/ami/rpc/cmContact.js index 185430b..9e89f50 100644 --- a/server/services/ami/rpc/cmContact.js +++ b/server/services/ami/rpc/cmContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb196=['createContact','Request','CreateCmContact','getContacts','GetCmContact','../client'];(function(_0x160ff7,_0x183a06){var _0x5bd99a=function(_0x4abeda){while(--_0x4abeda){_0x160ff7['push'](_0x160ff7['shift']());}};_0x5bd99a(++_0x183a06);}(_0xb196,0xb3));var _0x6b19=function(_0x38ec03,_0x1d957f){_0x38ec03=_0x38ec03-0x0;var _0x21cc41=_0xb196[_0x38ec03];return _0x21cc41;};'use strict';var client=require(_0x6b19('0x0'));exports[_0x6b19('0x1')]=function(_0x143503){return function(){return client[_0x6b19('0x2')](_0x6b19('0x3'),{'body':_0x143503,'log':_0x6b19('0x3')});};};exports[_0x6b19('0x4')]=function(_0x1233d8){return function(){return client['Request'](_0x6b19('0x5'),{'options':_0x1233d8,'log':'GetCmContact'});};}; \ No newline at end of file +var _0x4f78=['getContacts','Request','GetCmContact','CreateCmContact'];(function(_0x58d273,_0x3acead){var _0x39bc68=function(_0x36df36){while(--_0x36df36){_0x58d273['push'](_0x58d273['shift']());}};_0x39bc68(++_0x3acead);}(_0x4f78,0x1d3));var _0x84f7=function(_0x26d386,_0x1660c0){_0x26d386=_0x26d386-0x0;var _0x4ef9a8=_0x4f78[_0x26d386];return _0x4ef9a8;};'use strict';var client=require('../client');exports['createContact']=function(_0xcae259){return function(){return client['Request'](_0x84f7('0x0'),{'body':_0xcae259,'log':_0x84f7('0x0')});};};exports[_0x84f7('0x1')]=function(_0x3c5e34){return function(){return client[_0x84f7('0x2')](_0x84f7('0x3'),{'options':_0x3c5e34,'log':_0x84f7('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopper.js b/server/services/ami/rpc/cmHopper.js index 936750b..a525703 100644 --- a/server/services/ami/rpc/cmHopper.js +++ b/server/services/ami/rpc/cmHopper.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeecc=['unlockContact','getContactRecallMe','GetContactRecallMe','voicePause','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','handlePreviewRecallNotifications','../client','moment','getContacts','Request','getCmHopper','updateContacts','format','YYYY-MM-DD\x20HH:mm:ss','UpdateCmHopper','rescheduleContact','ListId','VoiceQueueId','CampaignId','destroyContact','DestroyCmHopper','DESC','scheduledat','ASC','GetContactDialer','getContactDialerIvr','CmContact','Contact','priority','GetContactDialerIvr','moveContactManagedDialer','queue','MoveContactManagedDialer','ContactId','countReScheduled','CountReScheduled','getContactPreview','User','Agent','name','VoiceQueue'];(function(_0x593d51,_0x183f01){var _0x3799ec=function(_0x3bd3be){while(--_0x3bd3be){_0x593d51['push'](_0x593d51['shift']());}};_0x3799ec(++_0x183f01);}(_0xeecc,0x12d));var _0xceec=function(_0x3e9182,_0x46e628){_0x3e9182=_0x3e9182-0x0;var _0x911bd2=_0xeecc[_0x3e9182];return _0x911bd2;};'use strict';var client=require(_0xceec('0x0'));var moment=require(_0xceec('0x1'));exports[_0xceec('0x2')]=function(_0x34d9cc,_0x4974bf){return function(){return client[_0xceec('0x3')]('GetCmHopper',{'options':{'where':{'VoiceQueueId':_0x34d9cc},'include':[{'model':'CmContact','as':'Contact'}],'limit':_0x4974bf,'raw':![]},'log':_0xceec('0x4')});};};exports[_0xceec('0x5')]=function(_0x3a2c0a,_0x2ae233,_0x5889fb){return function(){return client[_0xceec('0x3')]('UpdateCmHopper',{'body':_0x3a2c0a,'options':{'where':{'VoiceQueueId':_0x2ae233,'scheduledat':{'$lte':moment()[_0xceec('0x6')](_0xceec('0x7'))}},'limit':_0x5889fb},'log':_0xceec('0x8')});};};exports[_0xceec('0x9')]=function(_0x36c362){return client[_0xceec('0x3')](_0xceec('0x8'),{'body':_0x36c362,'options':{'where':{'ContactId':_0x36c362['ContactId'],'ListId':_0x36c362[_0xceec('0xa')],'VoiceQueueId':_0x36c362[_0xceec('0xb')],'CampaignId':_0x36c362[_0xceec('0xc')]}},'log':_0xceec('0x9')});};exports[_0xceec('0xd')]=function(_0x503795,_0x1fe218,_0x299583){return function(){return client[_0xceec('0x3')](_0xceec('0xe'),{'options':{'where':{'VoiceQueueId':_0x503795,'ListId':_0x1fe218,'ContactId':_0x299583}},'log':_0xceec('0xe')});};};exports['getContactDialer']=function(_0x2fa641,_0x5b8216,_0x1df290,_0x11b183){return client[_0xceec('0x3')]('GetContactDialer',{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x2fa641,'active':![],'scheduledat':{'$lte':moment()['format'](_0xceec('0x7'))},'$or':[{'UserId':null},{'UserId':{'$in':_0x5b8216}}]},'order':[['priority',_0xceec('0xf')],[_0xceec('0x10'),_0x11b183],['id',_0xceec('0x11')]],'raw':!![],'limit':_0x1df290},'log':_0xceec('0x12')});};exports[_0xceec('0x13')]=function(_0x3fea07,_0x4470a8,_0x1c8429){return client[_0xceec('0x3')](_0xceec('0x12'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x3fea07,'active':![],'scheduledat':{'$lte':moment()[_0xceec('0x6')]('YYYY-MM-DD\x20HH:mm:ss')}},'include':[{'model':_0xceec('0x14'),'as':_0xceec('0x15')}],'order':[[_0xceec('0x16'),_0xceec('0xf')],[_0xceec('0x10'),_0x1c8429],['id',_0xceec('0x11')]],'raw':!![],'limit':_0x4470a8},'log':_0xceec('0x17')});};exports[_0xceec('0x18')]=function(_0x32778b,_0x134002){_0x32778b['campaign']=_0x32778b[_0xceec('0x19')];return client['Request'](_0xceec('0x1a'),{'body':_0x32778b,'options':{'where':{'ContactId':_0x32778b[_0xceec('0x1b')],'ListId':_0x32778b['ListId'],'VoiceQueueId':_0x32778b[_0xceec('0xb')],'CampaignId':_0x32778b['CampaignId'],'active':_0x134002?undefined:!![]}},'log':_0xceec('0x1a')});};exports[_0xceec('0x1c')]=function(_0x3600cb){return client[_0xceec('0x3')](_0xceec('0x1d'),{'options':{'where':{'VoiceQueueId':_0x3600cb['id']?_0x3600cb['id']||null:null}},'log':_0xceec('0x1c')});};exports[_0xceec('0x1e')]=function(_0x505b99){return function(){return client[_0xceec('0x3')]('GetCmHopperPreview',{'options':{'where':{'id':_0x505b99},'include':[{'model':_0xceec('0x14'),'as':_0xceec('0x15')},{'model':_0xceec('0x1f'),'as':_0xceec('0x20'),'attributes':['id',_0xceec('0x21')]},{'model':_0xceec('0x22'),'as':'Queue','attributes':['id',_0xceec('0x21')]}],'raw':!![]},'log':'getCmHopper'});};};exports[_0xceec('0x23')]=function(_0x3b3923,_0x3cb421,_0x1c991c){return client[_0xceec('0x3')](_0xceec('0x8'),{'body':_0x3b3923,'options':{'where':{'id':_0x3cb421},'limit':_0x1c991c},'log':_0xceec('0x8')});};exports[_0xceec('0x24')]=function(_0x475910,_0x500050){return function(){return client[_0xceec('0x3')](_0xceec('0x25'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x475910,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()[_0xceec('0x6')](_0xceec('0x7'))},'UserId':{'$in':_0x500050}},'order':[[_0xceec('0x16'),_0xceec('0xf')],[_0xceec('0x10'),_0xceec('0xf')],['id','ASC']],'include':[{'model':_0xceec('0x14'),'as':_0xceec('0x15')},{'model':_0xceec('0x1f'),'as':'Agent','attributes':['id','name',_0xceec('0x26')]}],'group':'db.CmHopper.UserId','raw':!![]},'log':_0xceec('0x12')});};};exports['resetActiveCalls']=function(_0x30949c,_0x2c93ce){return client[_0xceec('0x3')](_0xceec('0x27'),{'body':_0x30949c,'options':_0x2c93ce||{},'log':'ResetActiveCalls'});};exports['handlePreviewRecallNotifications']=function(_0x45f412,_0x452caf,_0x561893){return function(){return client['Request'](_0xceec('0x28'),{'body':{'where':{'voiceQueueIds':_0x45f412,'interval':_0x452caf,'availableAgentsIds':_0x561893}},'log':_0xceec('0x29')});};}; \ No newline at end of file +var _0xd6d2=['VoiceQueueId','CampaignId','destroyContact','DestroyCmHopper','GetContactDialer','DESC','scheduledat','ASC','getContactDialerIvr','CmContact','priority','GetContactDialerIvr','moveContactManagedDialer','campaign','queue','MoveContactManagedDialer','ContactId','GetCmHopperPreview','Agent','name','VoiceQueue','Queue','unlockContact','getContactRecallMe','GetContactRecallMe','User','voicePause','db.CmHopper.UserId','resetActiveCalls','ResetActiveCalls','handlePreviewRecallNotifications','../client','moment','GetCmHopper','Contact','getCmHopper','updateContacts','Request','UpdateCmHopper','format','YYYY-MM-DD\x20HH:mm:ss','rescheduleContact','ListId'];(function(_0x41a62a,_0x1112f9){var _0x4d9425=function(_0x3b1e41){while(--_0x3b1e41){_0x41a62a['push'](_0x41a62a['shift']());}};_0x4d9425(++_0x1112f9);}(_0xd6d2,0xcb));var _0x2d6d=function(_0x12b427,_0x29f4c7){_0x12b427=_0x12b427-0x0;var _0x41a4be=_0xd6d2[_0x12b427];return _0x41a4be;};'use strict';var client=require(_0x2d6d('0x0'));var moment=require(_0x2d6d('0x1'));exports['getContacts']=function(_0x19be1a,_0x224caa){return function(){return client['Request'](_0x2d6d('0x2'),{'options':{'where':{'VoiceQueueId':_0x19be1a},'include':[{'model':'CmContact','as':_0x2d6d('0x3')}],'limit':_0x224caa,'raw':![]},'log':_0x2d6d('0x4')});};};exports[_0x2d6d('0x5')]=function(_0x4a4c5e,_0xfcdb1d,_0x132361){return function(){return client[_0x2d6d('0x6')](_0x2d6d('0x7'),{'body':_0x4a4c5e,'options':{'where':{'VoiceQueueId':_0xfcdb1d,'scheduledat':{'$lte':moment()[_0x2d6d('0x8')](_0x2d6d('0x9'))}},'limit':_0x132361},'log':_0x2d6d('0x7')});};};exports[_0x2d6d('0xa')]=function(_0x8e4be8){return client[_0x2d6d('0x6')](_0x2d6d('0x7'),{'body':_0x8e4be8,'options':{'where':{'ContactId':_0x8e4be8['ContactId'],'ListId':_0x8e4be8[_0x2d6d('0xb')],'VoiceQueueId':_0x8e4be8[_0x2d6d('0xc')],'CampaignId':_0x8e4be8[_0x2d6d('0xd')]}},'log':_0x2d6d('0xa')});};exports[_0x2d6d('0xe')]=function(_0x4f1a98,_0x131751,_0x171940){return function(){return client[_0x2d6d('0x6')](_0x2d6d('0xf'),{'options':{'where':{'VoiceQueueId':_0x4f1a98,'ListId':_0x131751,'ContactId':_0x171940}},'log':_0x2d6d('0xf')});};};exports['getContactDialer']=function(_0x1a2275,_0x156188,_0x46c909,_0x3528de){return client['Request'](_0x2d6d('0x10'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x1a2275,'active':![],'scheduledat':{'$lte':moment()[_0x2d6d('0x8')]('YYYY-MM-DD\x20HH:mm:ss')},'$or':[{'UserId':null},{'UserId':{'$in':_0x156188}}]},'order':[['priority',_0x2d6d('0x11')],[_0x2d6d('0x12'),_0x3528de],['id',_0x2d6d('0x13')]],'raw':!![],'limit':_0x46c909},'log':'GetContactDialer'});};exports[_0x2d6d('0x14')]=function(_0x5b8d81,_0x55c1fc,_0x4c3092){return client[_0x2d6d('0x6')](_0x2d6d('0x10'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x5b8d81,'active':![],'scheduledat':{'$lte':moment()[_0x2d6d('0x8')](_0x2d6d('0x9'))}},'include':[{'model':_0x2d6d('0x15'),'as':_0x2d6d('0x3')}],'order':[[_0x2d6d('0x16'),_0x2d6d('0x11')],[_0x2d6d('0x12'),_0x4c3092],['id','ASC']],'raw':!![],'limit':_0x55c1fc},'log':_0x2d6d('0x17')});};exports[_0x2d6d('0x18')]=function(_0x5b0c61,_0x227e44){_0x5b0c61[_0x2d6d('0x19')]=_0x5b0c61[_0x2d6d('0x1a')];return client[_0x2d6d('0x6')](_0x2d6d('0x1b'),{'body':_0x5b0c61,'options':{'where':{'ContactId':_0x5b0c61[_0x2d6d('0x1c')],'ListId':_0x5b0c61['ListId'],'VoiceQueueId':_0x5b0c61[_0x2d6d('0xc')],'CampaignId':_0x5b0c61[_0x2d6d('0xd')],'active':_0x227e44?undefined:!![]}},'log':_0x2d6d('0x1b')});};exports['countReScheduled']=function(_0x47eb0e){return client[_0x2d6d('0x6')]('CountReScheduled',{'options':{'where':{'VoiceQueueId':_0x47eb0e['id']?_0x47eb0e['id']||null:null}},'log':'countReScheduled'});};exports['getContactPreview']=function(_0x14f291){return function(){return client[_0x2d6d('0x6')](_0x2d6d('0x1d'),{'options':{'where':{'id':_0x14f291},'include':[{'model':_0x2d6d('0x15'),'as':_0x2d6d('0x3')},{'model':'User','as':_0x2d6d('0x1e'),'attributes':['id',_0x2d6d('0x1f')]},{'model':_0x2d6d('0x20'),'as':_0x2d6d('0x21'),'attributes':['id',_0x2d6d('0x1f')]}],'raw':!![]},'log':_0x2d6d('0x4')});};};exports[_0x2d6d('0x22')]=function(_0x28e182,_0x27b7d2,_0x4a1c30){return client[_0x2d6d('0x6')](_0x2d6d('0x7'),{'body':_0x28e182,'options':{'where':{'id':_0x27b7d2},'limit':_0x4a1c30},'log':_0x2d6d('0x7')});};exports[_0x2d6d('0x23')]=function(_0x486963,_0x317bde){return function(){return client['Request'](_0x2d6d('0x24'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x486963,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'UserId':{'$in':_0x317bde}},'order':[[_0x2d6d('0x16'),'DESC'],[_0x2d6d('0x12'),_0x2d6d('0x11')],['id','ASC']],'include':[{'model':_0x2d6d('0x15'),'as':'Contact'},{'model':_0x2d6d('0x25'),'as':_0x2d6d('0x1e'),'attributes':['id',_0x2d6d('0x1f'),_0x2d6d('0x26')]}],'group':_0x2d6d('0x27'),'raw':!![]},'log':_0x2d6d('0x10')});};};exports[_0x2d6d('0x28')]=function(_0x3450fc,_0x598d8b){return client[_0x2d6d('0x6')](_0x2d6d('0x29'),{'body':_0x3450fc,'options':_0x598d8b||{},'log':'ResetActiveCalls'});};exports[_0x2d6d('0x2a')]=function(_0xf2b497,_0x1d363a,_0x3aed80){return function(){return client[_0x2d6d('0x6')]('CmHopperHandlePreviewRecallNotifications',{'body':{'where':{'voiceQueueIds':_0xf2b497,'interval':_0x1d363a,'availableAgentsIds':_0x3aed80}},'log':'handlePreviewRecallNotifications'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperAdditionalPhone.js b/server/services/ami/rpc/cmHopperAdditionalPhone.js index 2d1cdef..53c215d 100644 --- a/server/services/ami/rpc/cmHopperAdditionalPhone.js +++ b/server/services/ami/rpc/cmHopperAdditionalPhone.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7929=['VerifyAdditionalPhones','swapAdditionalPhones','SwapAdditionalPhones','incrementPreviewCounters','IncrementPreviewCounters','../client','verifyAdditionalPhones','Request'];(function(_0x44e150,_0x186030){var _0x49b251=function(_0x8faa5){while(--_0x8faa5){_0x44e150['push'](_0x44e150['shift']());}};_0x49b251(++_0x186030);}(_0x7929,0x12d));var _0x9792=function(_0x533e4e,_0x4eba54){_0x533e4e=_0x533e4e-0x0;var _0x1f14bb=_0x7929[_0x533e4e];return _0x1f14bb;};'use strict';var client=require(_0x9792('0x0'));exports[_0x9792('0x1')]=function(_0x78a313,_0x1bcd48,_0x30f2c2){return client[_0x9792('0x2')](_0x9792('0x3'),{'body':_0x78a313,'reason':_0x1bcd48,'entity':_0x30f2c2,'log':_0x9792('0x3')});};exports[_0x9792('0x4')]=function(_0x1958b1,_0x24439a,_0x50048d){return client[_0x9792('0x2')](_0x9792('0x5'),{'body':_0x1958b1,'duration':_0x24439a,'waitTime':_0x50048d,'log':_0x9792('0x5')});};exports[_0x9792('0x6')]=function(_0x3b6106){return function(){return client[_0x9792('0x2')](_0x9792('0x7'),{'body':_0x3b6106,'log':_0x9792('0x7')});};}; \ No newline at end of file +var _0xedb6=['VerifyAdditionalPhones','swapAdditionalPhones','SwapAdditionalPhones','incrementPreviewCounters','IncrementPreviewCounters','../client','verifyAdditionalPhones','Request'];(function(_0x2114ac,_0x5ac291){var _0x267b0b=function(_0x30ee68){while(--_0x30ee68){_0x2114ac['push'](_0x2114ac['shift']());}};_0x267b0b(++_0x5ac291);}(_0xedb6,0x155));var _0x6edb=function(_0x4c0622,_0x5dacaf){_0x4c0622=_0x4c0622-0x0;var _0x1799d8=_0xedb6[_0x4c0622];return _0x1799d8;};'use strict';var client=require(_0x6edb('0x0'));exports[_0x6edb('0x1')]=function(_0x232f9b,_0x21556a,_0x32da95){return client[_0x6edb('0x2')](_0x6edb('0x3'),{'body':_0x232f9b,'reason':_0x21556a,'entity':_0x32da95,'log':_0x6edb('0x3')});};exports[_0x6edb('0x4')]=function(_0x45d562,_0x145867,_0x18bb96){return client[_0x6edb('0x2')](_0x6edb('0x5'),{'body':_0x45d562,'duration':_0x145867,'waitTime':_0x18bb96,'log':_0x6edb('0x5')});};exports[_0x6edb('0x6')]=function(_0x160191){return function(){return client[_0x6edb('0x2')](_0x6edb('0x7'),{'body':_0x160191,'log':_0x6edb('0x7')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperBlack.js b/server/services/ami/rpc/cmHopperBlack.js index 89cb7ad..8275161 100644 --- a/server/services/ami/rpc/cmHopperBlack.js +++ b/server/services/ami/rpc/cmHopperBlack.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaaa6=['../client','checkIsBlackList','Request','VoiceQueueId','phone','GetCmHopperBlack','checkIsBlackListIvr','CampaignId','GetCmHopperBlackIvr'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaaa6,0xc6));var _0x6aaa=function(_0x5c989c,_0x325ddb){_0x5c989c=_0x5c989c-0x0;var _0x4ad1e9=_0xaaa6[_0x5c989c];return _0x4ad1e9;};'use strict';var client=require(_0x6aaa('0x0'));exports[_0x6aaa('0x1')]=function(_0x3755b3){return client[_0x6aaa('0x2')]('GetCmHopperBlack',{'options':{'where':{'VoiceQueueId':_0x3755b3[_0x6aaa('0x3')],'phone':_0x3755b3[_0x6aaa('0x4')]},'raw':![]},'log':_0x6aaa('0x5')});};exports[_0x6aaa('0x6')]=function(_0x477bd6){return client[_0x6aaa('0x2')](_0x6aaa('0x5'),{'options':{'where':{'CampaignId':_0x477bd6[_0x6aaa('0x7')],'phone':_0x477bd6[_0x6aaa('0x4')]},'raw':![]},'log':_0x6aaa('0x8')});}; \ No newline at end of file +var _0xa8b5=['checkIsBlackList','Request','VoiceQueueId','phone','GetCmHopperBlack','checkIsBlackListIvr','CampaignId','../client'];(function(_0x590efc,_0x5e23b0){var _0x52524e=function(_0x50a1ae){while(--_0x50a1ae){_0x590efc['push'](_0x590efc['shift']());}};_0x52524e(++_0x5e23b0);}(_0xa8b5,0xdf));var _0x5a8b=function(_0x30586c,_0x71b06d){_0x30586c=_0x30586c-0x0;var _0x386dce=_0xa8b5[_0x30586c];return _0x386dce;};'use strict';var client=require(_0x5a8b('0x0'));exports[_0x5a8b('0x1')]=function(_0x3281fe){return client[_0x5a8b('0x2')]('GetCmHopperBlack',{'options':{'where':{'VoiceQueueId':_0x3281fe[_0x5a8b('0x3')],'phone':_0x3281fe[_0x5a8b('0x4')]},'raw':![]},'log':_0x5a8b('0x5')});};exports[_0x5a8b('0x6')]=function(_0x583158){return client[_0x5a8b('0x2')](_0x5a8b('0x5'),{'options':{'where':{'CampaignId':_0x583158[_0x5a8b('0x7')],'phone':_0x583158['phone']},'raw':![]},'log':'GetCmHopperBlackIvr'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperFinal.js b/server/services/ami/rpc/cmHopperFinal.js index f528cb0..2444c0e 100644 --- a/server/services/ami/rpc/cmHopperFinal.js +++ b/server/services/ami/rpc/cmHopperFinal.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x38c1=['createContact','campaign','CreateCmHopperFinal','../client'];(function(_0x4a0bed,_0x3b3632){var _0x31b319=function(_0x1d0d33){while(--_0x1d0d33){_0x4a0bed['push'](_0x4a0bed['shift']());}};_0x31b319(++_0x3b3632);}(_0x38c1,0x16b));var _0x138c=function(_0x584308,_0x1379b3){_0x584308=_0x584308-0x0;var _0x45865b=_0x38c1[_0x584308];return _0x45865b;};'use strict';var client=require(_0x138c('0x0'));exports[_0x138c('0x1')]=function(_0x4d1a6b){return function(){_0x4d1a6b[_0x138c('0x2')]=_0x4d1a6b['queue'];return client['Request']('CreateCmHopperFinal',{'body':_0x4d1a6b,'log':_0x138c('0x3')});};}; \ No newline at end of file +var _0x57e7=['queue','Request','CreateCmHopperFinal','../client','campaign'];(function(_0x35fcb7,_0x70fe1b){var _0x112a86=function(_0x340ec4){while(--_0x340ec4){_0x35fcb7['push'](_0x35fcb7['shift']());}};_0x112a86(++_0x70fe1b);}(_0x57e7,0x152));var _0x757e=function(_0x3ac1fc,_0x1e9f4e){_0x3ac1fc=_0x3ac1fc-0x0;var _0x58d08f=_0x57e7[_0x3ac1fc];return _0x58d08f;};'use strict';var client=require(_0x757e('0x0'));exports['createContact']=function(_0x370389){return function(){_0x370389[_0x757e('0x1')]=_0x370389[_0x757e('0x2')];return client[_0x757e('0x3')](_0x757e('0x4'),{'body':_0x370389,'log':_0x757e('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperHistory.js b/server/services/ami/rpc/cmHopperHistory.js index c77bfb3..5ee2861 100644 --- a/server/services/ami/rpc/cmHopperHistory.js +++ b/server/services/ami/rpc/cmHopperHistory.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbf48=['startOf','day','endOf','ivr','../client','campaign','queue','Request','AvgHandleTime','subtract','minutes','format','YYYY-MM-DD\x20HH:mm:ss','getVoiceQueueHopperHistory','GetVoiceQueueHopperHistory'];(function(_0x27f0e9,_0x246ce6){var _0x5a9dac=function(_0x12d69a){while(--_0x12d69a){_0x27f0e9['push'](_0x27f0e9['shift']());}};_0x5a9dac(++_0x246ce6);}(_0xbf48,0x1c6));var _0x8bf4=function(_0x1050cd,_0x53a416){_0x1050cd=_0x1050cd-0x0;var _0x3f7e11=_0xbf48[_0x1050cd];return _0x3f7e11;};'use strict';var client=require(_0x8bf4('0x0'));var moment=require('moment');exports['createHistory']=function(_0x249276){_0x249276[_0x8bf4('0x1')]=_0x249276[_0x8bf4('0x2')];return client[_0x8bf4('0x3')]('CreateCmHopperHistory',{'body':_0x249276,'log':'CreateCmHopperHistory'});};exports['avgHandleTime']=function(_0x4dc9e9){return client[_0x8bf4('0x3')](_0x8bf4('0x4'),{'options':{'where':{'endtime':{'$between':[moment()[_0x8bf4('0x5')](_0x4dc9e9,_0x8bf4('0x6'))[_0x8bf4('0x7')]('YYYY-MM-DD\x20HH:mm:ss'),moment()['format'](_0x8bf4('0x8'))]}},'raw':![]},'log':'GetCmHopperHistory'});};exports[_0x8bf4('0x9')]=function(){return function(){return client[_0x8bf4('0x3')](_0x8bf4('0xa'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x8bf4('0xb')](_0x8bf4('0xc'))[_0x8bf4('0x7')](_0x8bf4('0x8')),moment()[_0x8bf4('0xd')](_0x8bf4('0xc'))[_0x8bf4('0x7')](_0x8bf4('0x8'))]},'campaigntype':_0x8bf4('0x2')},'raw':![]},'log':_0x8bf4('0xa')});};};exports['getCampaignHopperHistory']=function(){return function(){return client['Request']('GetCampaignHopperHistory',{'options':{'where':{'createdAt':{'$between':[moment()[_0x8bf4('0xb')](_0x8bf4('0xc'))[_0x8bf4('0x7')](_0x8bf4('0x8')),moment()['endOf'](_0x8bf4('0xc'))[_0x8bf4('0x7')](_0x8bf4('0x8'))]},'campaigntype':_0x8bf4('0xe')},'raw':![]},'log':'GetCampaignHopperHistory'});};}; \ No newline at end of file +var _0x34f3=['Request','CreateCmHopperHistory','avgHandleTime','AvgHandleTime','minutes','format','YYYY-MM-DD\x20HH:mm:ss','GetCmHopperHistory','getVoiceQueueHopperHistory','GetVoiceQueueHopperHistory','day','getCampaignHopperHistory','startOf','endOf','ivr','GetCampaignHopperHistory','../client','campaign','queue'];(function(_0x1b7811,_0x2adcc3){var _0x409f6a=function(_0x50af29){while(--_0x50af29){_0x1b7811['push'](_0x1b7811['shift']());}};_0x409f6a(++_0x2adcc3);}(_0x34f3,0xbb));var _0x334f=function(_0x268d10,_0x290dd6){_0x268d10=_0x268d10-0x0;var _0x12cfe6=_0x34f3[_0x268d10];return _0x12cfe6;};'use strict';var client=require(_0x334f('0x0'));var moment=require('moment');exports['createHistory']=function(_0x5197eb){_0x5197eb[_0x334f('0x1')]=_0x5197eb[_0x334f('0x2')];return client[_0x334f('0x3')](_0x334f('0x4'),{'body':_0x5197eb,'log':_0x334f('0x4')});};exports[_0x334f('0x5')]=function(_0x1cfd62){return client['Request'](_0x334f('0x6'),{'options':{'where':{'endtime':{'$between':[moment()['subtract'](_0x1cfd62,_0x334f('0x7'))[_0x334f('0x8')](_0x334f('0x9')),moment()['format'](_0x334f('0x9'))]}},'raw':![]},'log':_0x334f('0xa')});};exports[_0x334f('0xb')]=function(){return function(){return client[_0x334f('0x3')](_0x334f('0xc'),{'options':{'where':{'createdAt':{'$between':[moment()['startOf'](_0x334f('0xd'))['format'](_0x334f('0x9')),moment()['endOf'](_0x334f('0xd'))['format'](_0x334f('0x9'))]},'campaigntype':_0x334f('0x2')},'raw':![]},'log':_0x334f('0xc')});};};exports[_0x334f('0xe')]=function(){return function(){return client[_0x334f('0x3')]('GetCampaignHopperHistory',{'options':{'where':{'createdAt':{'$between':[moment()[_0x334f('0xf')](_0x334f('0xd'))[_0x334f('0x8')](_0x334f('0x9')),moment()[_0x334f('0x10')](_0x334f('0xd'))[_0x334f('0x8')](_0x334f('0x9'))]},'campaigntype':_0x334f('0x11')},'raw':![]},'log':_0x334f('0x12')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/faxAccount.js b/server/services/ami/rpc/faxAccount.js index 715b985..a00cff9 100644 --- a/server/services/ami/rpc/faxAccount.js +++ b/server/services/ami/rpc/faxAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8768=['headerinfo','localstationid','minrate','maxrate','modem','gateway','t38timeout','tech','TrunkId','ListId','key','callerid','notify','NotifyFaxAccount','../client','getFaxAccounts','Request','GetFaxAccount','name','description','ecm'];(function(_0x336c8f,_0x181804){var _0x5b3abd=function(_0xa24276){while(--_0xa24276){_0x336c8f['push'](_0x336c8f['shift']());}};_0x5b3abd(++_0x181804);}(_0x8768,0xa1));var _0x8876=function(_0x59a1ce,_0x24ff0d){_0x59a1ce=_0x59a1ce-0x0;var _0xdb29dd=_0x8768[_0x59a1ce];return _0xdb29dd;};'use strict';var client=require(_0x8876('0x0'));exports[_0x8876('0x1')]=function(){return function(){return client[_0x8876('0x2')](_0x8876('0x3'),{'options':{'raw':![],'attributes':['id',_0x8876('0x4'),_0x8876('0x5'),_0x8876('0x6'),_0x8876('0x7'),_0x8876('0x8'),_0x8876('0x9'),_0x8876('0xa'),_0x8876('0xb'),_0x8876('0xc'),'faxdetect',_0x8876('0xd'),_0x8876('0xe'),_0x8876('0xf'),_0x8876('0x10'),_0x8876('0x11')],'include':[{'model':'Trunk','as':'Trunk','attributes':['id',_0x8876('0x4'),_0x8876('0x12'),'active']}]},'log':'getFaxAccount'});};};exports[_0x8876('0x13')]=function(_0x20fe1e,_0x477cf9){return client[_0x8876('0x2')](_0x8876('0x14'),{'account':{'id':_0x20fe1e},'body':_0x477cf9,'log':_0x8876('0x14')});}; \ No newline at end of file +var _0xbb8d=['notify','NotifyFaxAccount','../client','Request','ecm','headerinfo','localstationid','minrate','maxrate','gateway','faxdetect','t38timeout','tech','ListId','Trunk','callerid','active','getFaxAccount'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0xbb8d,0x146));var _0xdbb8=function(_0x1182a4,_0x5cfa2f){_0x1182a4=_0x1182a4-0x0;var _0x444039=_0xbb8d[_0x1182a4];return _0x444039;};'use strict';var client=require(_0xdbb8('0x0'));exports['getFaxAccounts']=function(){return function(){return client[_0xdbb8('0x1')]('GetFaxAccount',{'options':{'raw':![],'attributes':['id','name','description',_0xdbb8('0x2'),_0xdbb8('0x3'),_0xdbb8('0x4'),_0xdbb8('0x5'),_0xdbb8('0x6'),'modem',_0xdbb8('0x7'),_0xdbb8('0x8'),_0xdbb8('0x9'),_0xdbb8('0xa'),'TrunkId',_0xdbb8('0xb'),'key'],'include':[{'model':_0xdbb8('0xc'),'as':_0xdbb8('0xc'),'attributes':['id','name',_0xdbb8('0xd'),_0xdbb8('0xe')]}]},'log':_0xdbb8('0xf')});};};exports[_0xdbb8('0x10')]=function(_0x2eb417,_0xee681f){return client[_0xdbb8('0x1')](_0xdbb8('0x11'),{'account':{'id':_0x2eb417},'body':_0xee681f,'log':_0xdbb8('0x11')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/faxMessage.js b/server/services/ami/rpc/faxMessage.js index d70ebb1..ffceb53 100644 --- a/server/services/ami/rpc/faxMessage.js +++ b/server/services/ami/rpc/faxMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf88f=['../client','update','Request','UpdateFaxMessage'];(function(_0x332ce2,_0x57c600){var _0x11bf58=function(_0x3d5c72){while(--_0x3d5c72){_0x332ce2['push'](_0x332ce2['shift']());}};_0x11bf58(++_0x57c600);}(_0xf88f,0xc0));var _0xff88=function(_0x5d8cec,_0x5c555e){_0x5d8cec=_0x5d8cec-0x0;var _0x37e0d6=_0xf88f[_0x5d8cec];return _0x37e0d6;};'use strict';var client=require(_0xff88('0x0'));exports[_0xff88('0x1')]=function(_0x43728f,_0x331911){return client[_0xff88('0x2')]('UpdateFaxMessage',{'body':_0x331911,'options':{'where':{'AttachmentId':_0x43728f}},'log':_0xff88('0x3')});}; \ No newline at end of file +var _0xb0f9=['UpdateFaxMessage','../client','Request'];(function(_0xaceaf3,_0x58d051){var _0x365b83=function(_0x910c40){while(--_0x910c40){_0xaceaf3['push'](_0xaceaf3['shift']());}};_0x365b83(++_0x58d051);}(_0xb0f9,0x1d2));var _0x9b0f=function(_0x581b73,_0x4fa43c){_0x581b73=_0x581b73-0x0;var _0x3ea0ec=_0xb0f9[_0x581b73];return _0x3ea0ec;};'use strict';var client=require(_0x9b0f('0x0'));exports['update']=function(_0x3205f5,_0x3df779){return client[_0x9b0f('0x1')](_0x9b0f('0x2'),{'body':_0x3df779,'options':{'where':{'AttachmentId':_0x3205f5}},'log':_0x9b0f('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/desk.js b/server/services/ami/rpc/integrations/desk.js index 7ab830a..ad8bc10 100644 --- a/server/services/ami/rpc/integrations/desk.js +++ b/server/services/ami/rpc/integrations/desk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x267f=['Descriptions','key','keyContent','Fields','nameField','customField','../../client','getDeskAccounts','Request','GetDeskAccount','name','description','username','password','remoteUri','authType','type','DeskConfiguration','Configurations','Subjects','content','variableName','Variable','DeskField'];(function(_0x26deb2,_0x217bdd){var _0xa85d20=function(_0x369c4f){while(--_0x369c4f){_0x26deb2['push'](_0x26deb2['shift']());}};_0xa85d20(++_0x217bdd);}(_0x267f,0xf6));var _0xf267=function(_0x592f8a,_0x14aac4){_0x592f8a=_0x592f8a-0x0;var _0xbf30dd=_0x267f[_0x592f8a];return _0xbf30dd;};'use strict';var client=require(_0xf267('0x0'));exports[_0xf267('0x1')]=function(){return function(_0x41fbe9){return client[_0xf267('0x2')](_0xf267('0x3'),{'options':{'raw':![],'attributes':['id',_0xf267('0x4'),_0xf267('0x5'),_0xf267('0x6'),_0xf267('0x7'),_0xf267('0x8'),_0xf267('0x9'),_0xf267('0xa'),'serverUrl'],'include':[{'model':_0xf267('0xb'),'as':_0xf267('0xc'),'attributes':['id','name'],'include':[{'model':'DeskField','as':_0xf267('0xd'),'attributes':['id',_0xf267('0xa'),_0xf267('0xe'),_0xf267('0xf')],'include':[{'model':_0xf267('0x10'),'as':_0xf267('0x10'),'attributes':['id',_0xf267('0x4')]}]},{'model':_0xf267('0x11'),'as':_0xf267('0x12'),'attributes':['id',_0xf267('0xa'),_0xf267('0xe'),_0xf267('0x13'),'keyType',_0xf267('0x14'),'variableName'],'include':[{'model':_0xf267('0x10'),'as':_0xf267('0x10'),'attributes':['id',_0xf267('0x4')]}]},{'model':_0xf267('0x11'),'as':_0xf267('0x15'),'attributes':['id',_0xf267('0xa'),_0xf267('0xe'),'idField',_0xf267('0x16'),_0xf267('0x17'),'variableName'],'include':[{'model':'Variable','as':_0xf267('0x10'),'attributes':['id','name']}]},{'model':'Tag','as':'Tags','attributes':['id',_0xf267('0x4')]}]}]},'log':_0xf267('0x3')});};}; \ No newline at end of file +var _0x2322=['Subjects','content','variableName','Variable','Descriptions','key','keyType','Fields','idField','nameField','customField','Tag','Tags','../../client','Request','GetDeskAccount','username','password','remoteUri','authType','type','Configurations','name','DeskField'];(function(_0x13404a,_0xd9ad06){var _0x161d49=function(_0x5b23fd){while(--_0x5b23fd){_0x13404a['push'](_0x13404a['shift']());}};_0x161d49(++_0xd9ad06);}(_0x2322,0x85));var _0x2232=function(_0x220c4a,_0x8e56d3){_0x220c4a=_0x220c4a-0x0;var _0x1d8554=_0x2322[_0x220c4a];return _0x1d8554;};'use strict';var client=require(_0x2232('0x0'));exports['getDeskAccounts']=function(){return function(_0x18eb59){return client[_0x2232('0x1')](_0x2232('0x2'),{'options':{'raw':![],'attributes':['id','name','description',_0x2232('0x3'),_0x2232('0x4'),_0x2232('0x5'),_0x2232('0x6'),_0x2232('0x7'),'serverUrl'],'include':[{'model':'DeskConfiguration','as':_0x2232('0x8'),'attributes':['id',_0x2232('0x9')],'include':[{'model':_0x2232('0xa'),'as':_0x2232('0xb'),'attributes':['id',_0x2232('0x7'),_0x2232('0xc'),_0x2232('0xd')],'include':[{'model':_0x2232('0xe'),'as':_0x2232('0xe'),'attributes':['id',_0x2232('0x9')]}]},{'model':_0x2232('0xa'),'as':_0x2232('0xf'),'attributes':['id','type',_0x2232('0xc'),_0x2232('0x10'),_0x2232('0x11'),'keyContent',_0x2232('0xd')],'include':[{'model':_0x2232('0xe'),'as':_0x2232('0xe'),'attributes':['id','name']}]},{'model':'DeskField','as':_0x2232('0x12'),'attributes':['id',_0x2232('0x7'),_0x2232('0xc'),_0x2232('0x13'),_0x2232('0x14'),_0x2232('0x15'),_0x2232('0xd')],'include':[{'model':'Variable','as':'Variable','attributes':['id','name']}]},{'model':_0x2232('0x16'),'as':_0x2232('0x17'),'attributes':['id',_0x2232('0x9')]}]}]},'log':'GetDeskAccount'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/dynamics365.js b/server/services/ami/rpc/integrations/dynamics365.js index 24fd22c..3d8c440 100644 --- a/server/services/ami/rpc/integrations/dynamics365.js +++ b/server/services/ami/rpc/integrations/dynamics365.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0598=['ticketType','openNewTab','Dynamics365Field','Subjects','type','content','Variable','key','keyType','keyContent','variableName','idField','CloudProvider','data5','data7','GetDynamics365Account','../../client','getDynamics365Accounts','Request','username','password','clientSecret','serverUrl','Dynamics365Configuration','Configurations','name'];(function(_0x26dcb6,_0x2a5ff1){var _0x2b14e5=function(_0x381cc2){while(--_0x381cc2){_0x26dcb6['push'](_0x26dcb6['shift']());}};_0x2b14e5(++_0x2a5ff1);}(_0x0598,0x92));var _0x8059=function(_0x50429c,_0x38e475){_0x50429c=_0x50429c-0x0;var _0x22efc7=_0x0598[_0x50429c];return _0x22efc7;};'use strict';var client=require(_0x8059('0x0'));exports[_0x8059('0x1')]=function(){return function(_0x5c8253){return client[_0x8059('0x2')]('GetDynamics365Account',{'options':{'raw':![],'attributes':['id','name',_0x8059('0x3'),_0x8059('0x4'),'remoteUri','tenantId','clientId',_0x8059('0x5'),_0x8059('0x6'),'description','modernAuthentication'],'include':[{'model':_0x8059('0x7'),'as':_0x8059('0x8'),'attributes':['id',_0x8059('0x9'),_0x8059('0xa'),'moduleCreate','additionalSearchContact',_0x8059('0xb')],'include':[{'model':_0x8059('0xc'),'as':_0x8059('0xd'),'attributes':['id',_0x8059('0xe'),_0x8059('0xf'),'variableName'],'include':[{'model':'Variable','as':_0x8059('0x10'),'attributes':['id',_0x8059('0x9')]}]},{'model':'Dynamics365Field','as':'Descriptions','attributes':['id','type',_0x8059('0xf'),_0x8059('0x11'),_0x8059('0x12'),_0x8059('0x13'),_0x8059('0x14')],'include':[{'model':'Variable','as':_0x8059('0x10'),'attributes':['id','name']}]},{'model':_0x8059('0xc'),'as':'Fields','attributes':['id',_0x8059('0xe'),_0x8059('0xf'),_0x8059('0x15'),'nameField','customField','variableName'],'include':[{'model':_0x8059('0x10'),'as':_0x8059('0x10'),'attributes':['id',_0x8059('0x9')]}]}]},{'model':_0x8059('0x16'),'as':_0x8059('0x16'),'attributes':['id','data2',_0x8059('0x17'),_0x8059('0x18')]}]},'log':_0x8059('0x19')});};}; \ No newline at end of file +var _0x1bc6=['tenantId','clientId','clientSecret','serverUrl','description','modernAuthentication','Dynamics365Configuration','Configurations','ticketType','additionalSearchContact','Dynamics365Field','type','content','variableName','key','keyType','Variable','Fields','idField','nameField','customField','CloudProvider','data2','data5','../../client','getDynamics365Accounts','Request','GetDynamics365Account','name','username','remoteUri'];(function(_0x2fce80,_0x257022){var _0x200ea3=function(_0x1b1490){while(--_0x1b1490){_0x2fce80['push'](_0x2fce80['shift']());}};_0x200ea3(++_0x257022);}(_0x1bc6,0x94));var _0x61bc=function(_0x413f2a,_0x1006e4){_0x413f2a=_0x413f2a-0x0;var _0x1932ec=_0x1bc6[_0x413f2a];return _0x1932ec;};'use strict';var client=require(_0x61bc('0x0'));exports[_0x61bc('0x1')]=function(){return function(_0x396bc0){return client[_0x61bc('0x2')](_0x61bc('0x3'),{'options':{'raw':![],'attributes':['id',_0x61bc('0x4'),_0x61bc('0x5'),'password',_0x61bc('0x6'),_0x61bc('0x7'),_0x61bc('0x8'),_0x61bc('0x9'),_0x61bc('0xa'),_0x61bc('0xb'),_0x61bc('0xc')],'include':[{'model':_0x61bc('0xd'),'as':_0x61bc('0xe'),'attributes':['id','name',_0x61bc('0xf'),'moduleCreate',_0x61bc('0x10'),'openNewTab'],'include':[{'model':_0x61bc('0x11'),'as':'Subjects','attributes':['id',_0x61bc('0x12'),_0x61bc('0x13'),_0x61bc('0x14')],'include':[{'model':'Variable','as':'Variable','attributes':['id','name']}]},{'model':'Dynamics365Field','as':'Descriptions','attributes':['id',_0x61bc('0x12'),'content',_0x61bc('0x15'),_0x61bc('0x16'),'keyContent','variableName'],'include':[{'model':'Variable','as':_0x61bc('0x17'),'attributes':['id',_0x61bc('0x4')]}]},{'model':'Dynamics365Field','as':_0x61bc('0x18'),'attributes':['id',_0x61bc('0x12'),_0x61bc('0x13'),_0x61bc('0x19'),_0x61bc('0x1a'),_0x61bc('0x1b'),'variableName'],'include':[{'model':_0x61bc('0x17'),'as':_0x61bc('0x17'),'attributes':['id','name']}]}]},{'model':'CloudProvider','as':_0x61bc('0x1c'),'attributes':['id',_0x61bc('0x1d'),_0x61bc('0x1e'),'data7']}]},'log':_0x61bc('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/freshdesk.js b/server/services/ami/rpc/integrations/freshdesk.js index ca06d77..78c71de 100644 --- a/server/services/ami/rpc/integrations/freshdesk.js +++ b/server/services/ami/rpc/integrations/freshdesk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6c9f=['content','variableName','Variable','Descriptions','key','keyType','keyContent','idField','nameField','customField','../../client','GetFreshdeskAccount','name','username','apiKey','remoteUri','serverUrl','Configurations','Tag','FreshdeskField','Subjects','type'];(function(_0xf1a208,_0x4c9c5f){var _0x4b4d76=function(_0x1ad51d){while(--_0x1ad51d){_0xf1a208['push'](_0xf1a208['shift']());}};_0x4b4d76(++_0x4c9c5f);}(_0x6c9f,0x16a));var _0xf6c9=function(_0x2597c3,_0x32be09){_0x2597c3=_0x2597c3-0x0;var _0x1792b7=_0x6c9f[_0x2597c3];return _0x1792b7;};'use strict';var client=require(_0xf6c9('0x0'));exports['getFreshdeskAccounts']=function(){return function(_0x434274){return client['Request'](_0xf6c9('0x1'),{'options':{'raw':![],'attributes':['id',_0xf6c9('0x2'),_0xf6c9('0x3'),_0xf6c9('0x4'),_0xf6c9('0x5'),_0xf6c9('0x6')],'include':[{'model':'FreshdeskConfiguration','as':_0xf6c9('0x7'),'attributes':['id',_0xf6c9('0x2')],'include':[{'model':_0xf6c9('0x8'),'attributes':['id',_0xf6c9('0x2')]},{'model':_0xf6c9('0x9'),'as':_0xf6c9('0xa'),'attributes':['id',_0xf6c9('0xb'),_0xf6c9('0xc'),_0xf6c9('0xd')],'include':[{'model':'Variable','as':_0xf6c9('0xe'),'attributes':['id',_0xf6c9('0x2')]}]},{'model':_0xf6c9('0x9'),'as':_0xf6c9('0xf'),'attributes':['id',_0xf6c9('0xb'),_0xf6c9('0xc'),_0xf6c9('0x10'),_0xf6c9('0x11'),_0xf6c9('0x12'),'variableName'],'include':[{'model':_0xf6c9('0xe'),'as':_0xf6c9('0xe'),'attributes':['id',_0xf6c9('0x2')]}]},{'model':_0xf6c9('0x9'),'as':'Fields','attributes':['id','type',_0xf6c9('0xc'),_0xf6c9('0x13'),_0xf6c9('0x14'),_0xf6c9('0x15'),_0xf6c9('0xd')],'include':[{'model':_0xf6c9('0xe'),'as':'Variable','attributes':['id','name']}]}]}]},'log':_0xf6c9('0x1')});};}; \ No newline at end of file +var _0xe486=['name','username','serverUrl','FreshdeskConfiguration','Configurations','FreshdeskField','Subjects','type','content','Variable','Descriptions','key','keyContent','Fields','idField','nameField','customField','variableName','../../client','getFreshdeskAccounts','Request','GetFreshdeskAccount'];(function(_0x3cc3da,_0x1f0ea6){var _0x51ddb1=function(_0x45b75d){while(--_0x45b75d){_0x3cc3da['push'](_0x3cc3da['shift']());}};_0x51ddb1(++_0x1f0ea6);}(_0xe486,0x6a));var _0x6e48=function(_0x5c8d6f,_0x3eb58){_0x5c8d6f=_0x5c8d6f-0x0;var _0x336076=_0xe486[_0x5c8d6f];return _0x336076;};'use strict';var client=require(_0x6e48('0x0'));exports[_0x6e48('0x1')]=function(){return function(_0x413074){return client[_0x6e48('0x2')](_0x6e48('0x3'),{'options':{'raw':![],'attributes':['id',_0x6e48('0x4'),_0x6e48('0x5'),'apiKey','remoteUri',_0x6e48('0x6')],'include':[{'model':_0x6e48('0x7'),'as':_0x6e48('0x8'),'attributes':['id',_0x6e48('0x4')],'include':[{'model':'Tag','attributes':['id',_0x6e48('0x4')]},{'model':_0x6e48('0x9'),'as':_0x6e48('0xa'),'attributes':['id',_0x6e48('0xb'),_0x6e48('0xc'),'variableName'],'include':[{'model':_0x6e48('0xd'),'as':'Variable','attributes':['id',_0x6e48('0x4')]}]},{'model':'FreshdeskField','as':_0x6e48('0xe'),'attributes':['id',_0x6e48('0xb'),_0x6e48('0xc'),_0x6e48('0xf'),'keyType',_0x6e48('0x10'),'variableName'],'include':[{'model':'Variable','as':_0x6e48('0xd'),'attributes':['id',_0x6e48('0x4')]}]},{'model':_0x6e48('0x9'),'as':_0x6e48('0x11'),'attributes':['id','type',_0x6e48('0xc'),_0x6e48('0x12'),_0x6e48('0x13'),_0x6e48('0x14'),_0x6e48('0x15')],'include':[{'model':_0x6e48('0xd'),'as':_0x6e48('0xd'),'attributes':['id',_0x6e48('0x4')]}]}]}]},'log':_0x6e48('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/freshsales.js b/server/services/ami/rpc/integrations/freshsales.js index df89ac5..047fa55 100644 --- a/server/services/ami/rpc/integrations/freshsales.js +++ b/server/services/ami/rpc/integrations/freshsales.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8b8e=['FreshsalesField','Subjects','type','content','Variable','keyContent','variableName','GetFreshsalesccount','../../client','GetFreshsalesAccount','apiKey','remoteUri','serverUrl','FreshsalesConfiguration','Configurations','name'];(function(_0x53bec2,_0x2c8db1){var _0x418497=function(_0x208c89){while(--_0x208c89){_0x53bec2['push'](_0x53bec2['shift']());}};_0x418497(++_0x2c8db1);}(_0x8b8e,0x108));var _0xe8b8=function(_0x5eb88f,_0x5b0442){_0x5eb88f=_0x5eb88f-0x0;var _0x2f086b=_0x8b8e[_0x5eb88f];return _0x2f086b;};'use strict';var client=require(_0xe8b8('0x0'));exports['getFreshsalesAccounts']=function(){return function(_0x33fd9a){return client['Request'](_0xe8b8('0x1'),{'options':{'raw':![],'attributes':['id','name','username',_0xe8b8('0x2'),_0xe8b8('0x3'),_0xe8b8('0x4')],'include':[{'model':_0xe8b8('0x5'),'as':_0xe8b8('0x6'),'attributes':['id',_0xe8b8('0x7')],'include':[{'model':_0xe8b8('0x8'),'as':_0xe8b8('0x9'),'attributes':['id',_0xe8b8('0xa'),_0xe8b8('0xb'),'variableName'],'include':[{'model':_0xe8b8('0xc'),'as':'Variable','attributes':['id',_0xe8b8('0x7')]}]},{'model':'FreshsalesField','as':'Descriptions','attributes':['id',_0xe8b8('0xa'),_0xe8b8('0xb'),'key','keyType',_0xe8b8('0xd'),_0xe8b8('0xe')],'include':[{'model':_0xe8b8('0xc'),'as':_0xe8b8('0xc'),'attributes':['id',_0xe8b8('0x7')]}]}]}]},'log':_0xe8b8('0xf')});};}; \ No newline at end of file +var _0x9206=['name','remoteUri','serverUrl','Subjects','type','content','variableName','FreshsalesField','Descriptions','key','keyType','keyContent','Variable','GetFreshsalesccount','../../client','getFreshsalesAccounts','Request','GetFreshsalesAccount'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9206,0x176));var _0x6920=function(_0x1e72c4,_0x39a448){_0x1e72c4=_0x1e72c4-0x0;var _0x376636=_0x9206[_0x1e72c4];return _0x376636;};'use strict';var client=require(_0x6920('0x0'));exports[_0x6920('0x1')]=function(){return function(_0x3896bc){return client[_0x6920('0x2')](_0x6920('0x3'),{'options':{'raw':![],'attributes':['id',_0x6920('0x4'),'username','apiKey',_0x6920('0x5'),_0x6920('0x6')],'include':[{'model':'FreshsalesConfiguration','as':'Configurations','attributes':['id',_0x6920('0x4')],'include':[{'model':'FreshsalesField','as':_0x6920('0x7'),'attributes':['id',_0x6920('0x8'),_0x6920('0x9'),_0x6920('0xa')],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0x6920('0x4')]}]},{'model':_0x6920('0xb'),'as':_0x6920('0xc'),'attributes':['id',_0x6920('0x8'),_0x6920('0x9'),_0x6920('0xd'),_0x6920('0xe'),_0x6920('0xf'),_0x6920('0xa')],'include':[{'model':_0x6920('0x10'),'as':_0x6920('0x10'),'attributes':['id',_0x6920('0x4')]}]}]}]},'log':_0x6920('0x11')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/salesforce.js b/server/services/ami/rpc/integrations/salesforce.js index 99d9fda..517f971 100644 --- a/server/services/ami/rpc/integrations/salesforce.js +++ b/server/services/ami/rpc/integrations/salesforce.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdeb3=['SalesforceField','Variable','GetSalesforceAccount','getSalesforceAccounts','Request','username','password','remoteUri','clientId','clientSecret','serverUrl','SalesforceConfiguration','name','moduleSearch','moduleCreate','ticketType','leadId','additionalSearchAccount','additionalSearchContact','additionalSearchLead'];(function(_0x2cf062,_0x3c15c6){var _0x376203=function(_0x23ca8e){while(--_0x23ca8e){_0x2cf062['push'](_0x2cf062['shift']());}};_0x376203(++_0x3c15c6);}(_0xdeb3,0xb7));var _0x3deb=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xdeb3[_0x42cae2];return _0x5f256f;};'use strict';var client=require('../../client');exports[_0x3deb('0x0')]=function(){return function(_0x2585e2){return client[_0x3deb('0x1')]('GetSalesforceAccount',{'options':{'raw':![],'attributes':['id','name',_0x3deb('0x2'),_0x3deb('0x3'),_0x3deb('0x4'),_0x3deb('0x5'),_0x3deb('0x6'),'securityToken',_0x3deb('0x7'),'type'],'include':[{'model':_0x3deb('0x8'),'as':'Configurations','attributes':['id',_0x3deb('0x9'),_0x3deb('0xa'),_0x3deb('0xb'),_0x3deb('0xc'),_0x3deb('0xd'),_0x3deb('0xe'),_0x3deb('0xf'),_0x3deb('0x10')],'include':[{'model':_0x3deb('0x11'),'as':'Subjects','include':[{'model':'Variable','as':_0x3deb('0x12'),'attributes':['id',_0x3deb('0x9')]}]},{'model':_0x3deb('0x11'),'as':'Descriptions','include':[{'model':_0x3deb('0x12'),'as':_0x3deb('0x12'),'attributes':['id',_0x3deb('0x9')]}]},{'model':_0x3deb('0x11'),'as':'Fields','include':[{'model':'Variable','as':'Variable','attributes':['id',_0x3deb('0x9')]}]}]}]},'log':_0x3deb('0x13')});};}; \ No newline at end of file +var _0x753c=['getSalesforceAccounts','Request','GetSalesforceAccount','name','username','password','remoteUri','clientId','clientSecret','securityToken','serverUrl','type','SalesforceConfiguration','Configurations','moduleSearch','moduleCreate','ticketType','leadId','additionalSearchAccount','additionalSearchContact','additionalSearchLead','SalesforceField','Subjects','Variable','Fields'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0x753c,0x96));var _0xc753=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x753c[_0x2b4411];return _0x8e41ef;};'use strict';var client=require('../../client');exports[_0xc753('0x0')]=function(){return function(_0x506c39){return client[_0xc753('0x1')](_0xc753('0x2'),{'options':{'raw':![],'attributes':['id',_0xc753('0x3'),_0xc753('0x4'),_0xc753('0x5'),_0xc753('0x6'),_0xc753('0x7'),_0xc753('0x8'),_0xc753('0x9'),_0xc753('0xa'),_0xc753('0xb')],'include':[{'model':_0xc753('0xc'),'as':_0xc753('0xd'),'attributes':['id',_0xc753('0x3'),_0xc753('0xe'),_0xc753('0xf'),_0xc753('0x10'),_0xc753('0x11'),_0xc753('0x12'),_0xc753('0x13'),_0xc753('0x14')],'include':[{'model':_0xc753('0x15'),'as':_0xc753('0x16'),'include':[{'model':_0xc753('0x17'),'as':'Variable','attributes':['id',_0xc753('0x3')]}]},{'model':_0xc753('0x15'),'as':'Descriptions','include':[{'model':_0xc753('0x17'),'as':'Variable','attributes':['id',_0xc753('0x3')]}]},{'model':_0xc753('0x15'),'as':_0xc753('0x18'),'include':[{'model':'Variable','as':_0xc753('0x17'),'attributes':['id','name']}]}]}]},'log':_0xc753('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/servicenow.js b/server/services/ami/rpc/integrations/servicenow.js index 77e4792..4109f8d 100644 --- a/server/services/ami/rpc/integrations/servicenow.js +++ b/server/services/ami/rpc/integrations/servicenow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x524e=['name','description','username','password','email','remoteUri','serverUrl','Configurations','ServicenowField','type','content','variableName','Variable','Descriptions','key','keyType','keyContent','Fields','idField','nameField','Request','GetServicenowAccount'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x524e,0x15e));var _0xe524=function(_0x2895c3,_0x44ffdd){_0x2895c3=_0x2895c3-0x0;var _0x39105a=_0x524e[_0x2895c3];return _0x39105a;};'use strict';var client=require('../../client');exports['getServicenowAccounts']=function(){return function(_0x353d8a){return client[_0xe524('0x0')](_0xe524('0x1'),{'options':{'raw':![],'attributes':['id',_0xe524('0x2'),_0xe524('0x3'),_0xe524('0x4'),_0xe524('0x5'),_0xe524('0x6'),_0xe524('0x7'),_0xe524('0x8')],'include':[{'model':'ServicenowConfiguration','as':_0xe524('0x9'),'attributes':['id',_0xe524('0x2')],'include':[{'model':_0xe524('0xa'),'as':'Subjects','attributes':['id',_0xe524('0xb'),_0xe524('0xc'),_0xe524('0xd')],'include':[{'model':_0xe524('0xe'),'as':_0xe524('0xe'),'attributes':['id',_0xe524('0x2')]}]},{'model':_0xe524('0xa'),'as':_0xe524('0xf'),'attributes':['id',_0xe524('0xb'),_0xe524('0xc'),_0xe524('0x10'),_0xe524('0x11'),_0xe524('0x12'),_0xe524('0xd')],'include':[{'model':_0xe524('0xe'),'as':_0xe524('0xe'),'attributes':['id','name']}]},{'model':'ServicenowField','as':_0xe524('0x13'),'attributes':['id',_0xe524('0xb'),_0xe524('0xc'),_0xe524('0x14'),_0xe524('0x15'),'customField',_0xe524('0xd')],'include':[{'model':'Variable','as':_0xe524('0xe'),'attributes':['id',_0xe524('0x2')]}]}]}]},'log':'GetServicenowkAccount'});};}; \ No newline at end of file +var _0xf494=['idField','nameField','customField','GetServicenowkAccount','../../client','getServicenowAccounts','GetServicenowAccount','name','description','username','password','email','remoteUri','serverUrl','ServicenowConfiguration','Configurations','type','content','variableName','Variable','ServicenowField','Descriptions','key','keyContent','Fields'];(function(_0xce26e0,_0x1f96ca){var _0x3fd222=function(_0x30e954){while(--_0x30e954){_0xce26e0['push'](_0xce26e0['shift']());}};_0x3fd222(++_0x1f96ca);}(_0xf494,0x1c6));var _0x4f49=function(_0x2e98d5,_0x1665f4){_0x2e98d5=_0x2e98d5-0x0;var _0x3f8ee4=_0xf494[_0x2e98d5];return _0x3f8ee4;};'use strict';var client=require(_0x4f49('0x0'));exports[_0x4f49('0x1')]=function(){return function(_0x3063f3){return client['Request'](_0x4f49('0x2'),{'options':{'raw':![],'attributes':['id',_0x4f49('0x3'),_0x4f49('0x4'),_0x4f49('0x5'),_0x4f49('0x6'),_0x4f49('0x7'),_0x4f49('0x8'),_0x4f49('0x9')],'include':[{'model':_0x4f49('0xa'),'as':_0x4f49('0xb'),'attributes':['id',_0x4f49('0x3')],'include':[{'model':'ServicenowField','as':'Subjects','attributes':['id',_0x4f49('0xc'),_0x4f49('0xd'),_0x4f49('0xe')],'include':[{'model':_0x4f49('0xf'),'as':_0x4f49('0xf'),'attributes':['id',_0x4f49('0x3')]}]},{'model':_0x4f49('0x10'),'as':_0x4f49('0x11'),'attributes':['id','type',_0x4f49('0xd'),_0x4f49('0x12'),'keyType',_0x4f49('0x13'),'variableName'],'include':[{'model':'Variable','as':_0x4f49('0xf'),'attributes':['id',_0x4f49('0x3')]}]},{'model':'ServicenowField','as':_0x4f49('0x14'),'attributes':['id',_0x4f49('0xc'),_0x4f49('0xd'),_0x4f49('0x15'),_0x4f49('0x16'),_0x4f49('0x17'),_0x4f49('0xe')],'include':[{'model':'Variable','as':_0x4f49('0xf'),'attributes':['id',_0x4f49('0x3')]}]}]}]},'log':_0x4f49('0x18')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/sugarcrm.js b/server/services/ami/rpc/integrations/sugarcrm.js index 5e64fee..748434f 100644 --- a/server/services/ami/rpc/integrations/sugarcrm.js +++ b/server/services/ami/rpc/integrations/sugarcrm.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1a85=['serverUrl','Configurations','SugarcrmField','type','content','Variable','Descriptions','key','keyType','keyContent','variableName','name','Fields','idField','nameField','Request','GetSugarcrmAccount','password','remoteUri'];(function(_0x1c61ec,_0x1bf9b8){var _0x4a3c18=function(_0x1e53be){while(--_0x1e53be){_0x1c61ec['push'](_0x1c61ec['shift']());}};_0x4a3c18(++_0x1bf9b8);}(_0x1a85,0x178));var _0x51a8=function(_0x2a50f7,_0x4c5ed1){_0x2a50f7=_0x2a50f7-0x0;var _0x5123ec=_0x1a85[_0x2a50f7];return _0x5123ec;};'use strict';var client=require('../../client');exports['getSugarcrmAccounts']=function(){return function(_0x305f18){return client[_0x51a8('0x0')](_0x51a8('0x1'),{'options':{'raw':![],'attributes':['id','name','username',_0x51a8('0x2'),_0x51a8('0x3'),_0x51a8('0x4')],'include':[{'model':'SugarcrmConfiguration','as':_0x51a8('0x5'),'attributes':['id','name'],'include':[{'model':_0x51a8('0x6'),'as':'Subjects','attributes':['id',_0x51a8('0x7'),_0x51a8('0x8'),'variableName'],'include':[{'model':_0x51a8('0x9'),'as':'Variable','attributes':['id','name']}]},{'model':_0x51a8('0x6'),'as':_0x51a8('0xa'),'attributes':['id',_0x51a8('0x7'),_0x51a8('0x8'),_0x51a8('0xb'),_0x51a8('0xc'),_0x51a8('0xd'),_0x51a8('0xe')],'include':[{'model':_0x51a8('0x9'),'as':_0x51a8('0x9'),'attributes':['id',_0x51a8('0xf')]}]},{'model':_0x51a8('0x6'),'as':_0x51a8('0x10'),'attributes':['id',_0x51a8('0x7'),_0x51a8('0x8'),_0x51a8('0x11'),_0x51a8('0x12'),'customField',_0x51a8('0xe')],'include':[{'model':_0x51a8('0x9'),'as':_0x51a8('0x9'),'attributes':['id','name']}]}]}]},'log':_0x51a8('0x1')});};}; \ No newline at end of file +var _0x2032=['GetSugarcrmAccount','getSugarcrmAccounts','Request','name','username','remoteUri','serverUrl','SugarcrmConfiguration','Configurations','SugarcrmField','Subjects','type','content','variableName','Variable','key','keyContent','customField'];(function(_0x561afe,_0x59829f){var _0x14913e=function(_0x2a967f){while(--_0x2a967f){_0x561afe['push'](_0x561afe['shift']());}};_0x14913e(++_0x59829f);}(_0x2032,0xd9));var _0x2203=function(_0x326971,_0x34c529){_0x326971=_0x326971-0x0;var _0x5d0d93=_0x2032[_0x326971];return _0x5d0d93;};'use strict';var client=require('../../client');exports[_0x2203('0x0')]=function(){return function(_0x1e103d){return client[_0x2203('0x1')]('GetSugarcrmAccount',{'options':{'raw':![],'attributes':['id',_0x2203('0x2'),_0x2203('0x3'),'password',_0x2203('0x4'),_0x2203('0x5')],'include':[{'model':_0x2203('0x6'),'as':_0x2203('0x7'),'attributes':['id',_0x2203('0x2')],'include':[{'model':_0x2203('0x8'),'as':_0x2203('0x9'),'attributes':['id',_0x2203('0xa'),_0x2203('0xb'),_0x2203('0xc')],'include':[{'model':_0x2203('0xd'),'as':'Variable','attributes':['id','name']}]},{'model':_0x2203('0x8'),'as':'Descriptions','attributes':['id',_0x2203('0xa'),_0x2203('0xb'),_0x2203('0xe'),'keyType',_0x2203('0xf'),'variableName'],'include':[{'model':_0x2203('0xd'),'as':'Variable','attributes':['id',_0x2203('0x2')]}]},{'model':_0x2203('0x8'),'as':'Fields','attributes':['id','type','content','idField','nameField',_0x2203('0x10'),'variableName'],'include':[{'model':'Variable','as':_0x2203('0xd'),'attributes':['id',_0x2203('0x2')]}]}]}]},'log':_0x2203('0x11')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/vtiger.js b/server/services/ami/rpc/integrations/vtiger.js index 4bce14a..040241a 100644 --- a/server/services/ami/rpc/integrations/vtiger.js +++ b/server/services/ami/rpc/integrations/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xed6b=['../../client','Request','username','accessKey','remoteUri','serverUrl','VtigerConfiguration','Configurations','VtigerField','Subjects','type','content','variableName','Variable','name','Descriptions','key','keyType','keyContent','Fields','idField','nameField','customField','GetVtigerAccount'];(function(_0x421d92,_0x1b8c8f){var _0x9c0b2b=function(_0x4b5ff1){while(--_0x4b5ff1){_0x421d92['push'](_0x421d92['shift']());}};_0x9c0b2b(++_0x1b8c8f);}(_0xed6b,0x90));var _0xbed6=function(_0x4028a3,_0x21b709){_0x4028a3=_0x4028a3-0x0;var _0x742f02=_0xed6b[_0x4028a3];return _0x742f02;};'use strict';var client=require(_0xbed6('0x0'));exports['getVtigerAccounts']=function(){return function(_0x2e5a49){return client[_0xbed6('0x1')]('GetVtigerAccount',{'options':{'raw':![],'attributes':['id','name','description',_0xbed6('0x2'),_0xbed6('0x3'),_0xbed6('0x4'),_0xbed6('0x5')],'include':[{'model':_0xbed6('0x6'),'as':_0xbed6('0x7'),'attributes':['id','name'],'include':[{'model':_0xbed6('0x8'),'as':_0xbed6('0x9'),'attributes':['id',_0xbed6('0xa'),_0xbed6('0xb'),_0xbed6('0xc')],'include':[{'model':_0xbed6('0xd'),'as':_0xbed6('0xd'),'attributes':['id',_0xbed6('0xe')]}]},{'model':_0xbed6('0x8'),'as':_0xbed6('0xf'),'attributes':['id',_0xbed6('0xa'),_0xbed6('0xb'),_0xbed6('0x10'),_0xbed6('0x11'),_0xbed6('0x12'),_0xbed6('0xc')],'include':[{'model':_0xbed6('0xd'),'as':_0xbed6('0xd'),'attributes':['id',_0xbed6('0xe')]}]},{'model':_0xbed6('0x8'),'as':_0xbed6('0x13'),'attributes':['id',_0xbed6('0xa'),_0xbed6('0xb'),_0xbed6('0x14'),_0xbed6('0x15'),_0xbed6('0x16'),_0xbed6('0xc')],'include':[{'model':_0xbed6('0xd'),'as':'Variable','attributes':['id','name']}]}]}]},'log':_0xbed6('0x17')});};}; \ No newline at end of file +var _0xa86a=['remoteUri','serverUrl','VtigerConfiguration','Configurations','VtigerField','Subjects','type','Variable','Descriptions','content','key','keyContent','variableName','Fields','idField','nameField','customField','../../client','getVtigerAccounts','Request','GetVtigerAccount','name','description','username','accessKey'];(function(_0x20bf34,_0x56dc16){var _0x508033=function(_0x5ca569){while(--_0x5ca569){_0x20bf34['push'](_0x20bf34['shift']());}};_0x508033(++_0x56dc16);}(_0xa86a,0xa7));var _0xaa86=function(_0x54656a,_0x10f6d2){_0x54656a=_0x54656a-0x0;var _0x7137db=_0xa86a[_0x54656a];return _0x7137db;};'use strict';var client=require(_0xaa86('0x0'));exports[_0xaa86('0x1')]=function(){return function(_0x3cee2b){return client[_0xaa86('0x2')](_0xaa86('0x3'),{'options':{'raw':![],'attributes':['id',_0xaa86('0x4'),_0xaa86('0x5'),_0xaa86('0x6'),_0xaa86('0x7'),_0xaa86('0x8'),_0xaa86('0x9')],'include':[{'model':_0xaa86('0xa'),'as':_0xaa86('0xb'),'attributes':['id',_0xaa86('0x4')],'include':[{'model':_0xaa86('0xc'),'as':_0xaa86('0xd'),'attributes':['id',_0xaa86('0xe'),'content','variableName'],'include':[{'model':_0xaa86('0xf'),'as':'Variable','attributes':['id',_0xaa86('0x4')]}]},{'model':_0xaa86('0xc'),'as':_0xaa86('0x10'),'attributes':['id',_0xaa86('0xe'),_0xaa86('0x11'),_0xaa86('0x12'),'keyType',_0xaa86('0x13'),_0xaa86('0x14')],'include':[{'model':'Variable','as':'Variable','attributes':['id','name']}]},{'model':_0xaa86('0xc'),'as':_0xaa86('0x15'),'attributes':['id',_0xaa86('0xe'),_0xaa86('0x11'),_0xaa86('0x16'),_0xaa86('0x17'),_0xaa86('0x18'),'variableName'],'include':[{'model':_0xaa86('0xf'),'as':_0xaa86('0xf'),'attributes':['id',_0xaa86('0x4')]}]}]}]},'log':'GetVtigerAccount'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/zendesk.js b/server/services/ami/rpc/integrations/zendesk.js index b2e9204..b7aaa8c 100644 --- a/server/services/ami/rpc/integrations/zendesk.js +++ b/server/services/ami/rpc/integrations/zendesk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb57f=['name','username','password','token','remoteUri','authType','serverUrl','type','ZendeskConfiguration','Configurations','Tag','ZendeskField','Subjects','content','variableName','Variable','key','keyType','Fields','idField','nameField','customField','getZendeskAccounts','Request','GetZendeskAccount'];(function(_0x435fa1,_0x58550a){var _0x845f9f=function(_0x89867e){while(--_0x89867e){_0x435fa1['push'](_0x435fa1['shift']());}};_0x845f9f(++_0x58550a);}(_0xb57f,0x15b));var _0xfb57=function(_0x599abb,_0x5868af){_0x599abb=_0x599abb-0x0;var _0x4b98ae=_0xb57f[_0x599abb];return _0x4b98ae;};'use strict';var client=require('../../client');exports[_0xfb57('0x0')]=function(){return function(_0x304cb9){return client[_0xfb57('0x1')](_0xfb57('0x2'),{'options':{'raw':![],'attributes':['id',_0xfb57('0x3'),_0xfb57('0x4'),_0xfb57('0x5'),_0xfb57('0x6'),_0xfb57('0x7'),_0xfb57('0x8'),_0xfb57('0x9'),_0xfb57('0xa')],'include':[{'model':_0xfb57('0xb'),'as':_0xfb57('0xc'),'attributes':['id','name'],'include':[{'model':_0xfb57('0xd'),'attributes':['id',_0xfb57('0x3')]},{'model':_0xfb57('0xe'),'as':_0xfb57('0xf'),'attributes':['id',_0xfb57('0xa'),_0xfb57('0x10'),_0xfb57('0x11')],'include':[{'model':_0xfb57('0x12'),'as':_0xfb57('0x12'),'attributes':['id',_0xfb57('0x3')]}]},{'model':_0xfb57('0xe'),'as':'Descriptions','attributes':['id',_0xfb57('0xa'),_0xfb57('0x10'),_0xfb57('0x13'),_0xfb57('0x14'),'keyContent',_0xfb57('0x11')],'include':[{'model':_0xfb57('0x12'),'as':'Variable','attributes':['id','name']}]},{'model':_0xfb57('0xe'),'as':_0xfb57('0x15'),'attributes':['id','type',_0xfb57('0x10'),_0xfb57('0x16'),_0xfb57('0x17'),_0xfb57('0x18'),_0xfb57('0x11')],'include':[{'model':_0xfb57('0x12'),'as':_0xfb57('0x12'),'attributes':['id','name']}]}]}]},'log':_0xfb57('0x2')});};}; \ No newline at end of file +var _0xa038=['username','password','token','authType','serverUrl','type','ZendeskConfiguration','Configurations','name','Tag','Subjects','content','variableName','Variable','ZendeskField','Descriptions','keyType','keyContent','Fields','idField','nameField','customField','getZendeskAccounts','Request','GetZendeskAccount'];(function(_0x577519,_0x346daf){var _0x5b12f7=function(_0x4aecb6){while(--_0x4aecb6){_0x577519['push'](_0x577519['shift']());}};_0x5b12f7(++_0x346daf);}(_0xa038,0x1bf));var _0x8a03=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0xa038[_0x5f3f88];return _0xd08119;};'use strict';var client=require('../../client');exports[_0x8a03('0x0')]=function(){return function(_0x45bb7a){return client[_0x8a03('0x1')](_0x8a03('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x8a03('0x3'),_0x8a03('0x4'),_0x8a03('0x5'),'remoteUri',_0x8a03('0x6'),_0x8a03('0x7'),_0x8a03('0x8')],'include':[{'model':_0x8a03('0x9'),'as':_0x8a03('0xa'),'attributes':['id',_0x8a03('0xb')],'include':[{'model':_0x8a03('0xc'),'attributes':['id',_0x8a03('0xb')]},{'model':'ZendeskField','as':_0x8a03('0xd'),'attributes':['id',_0x8a03('0x8'),_0x8a03('0xe'),_0x8a03('0xf')],'include':[{'model':_0x8a03('0x10'),'as':'Variable','attributes':['id','name']}]},{'model':_0x8a03('0x11'),'as':_0x8a03('0x12'),'attributes':['id',_0x8a03('0x8'),_0x8a03('0xe'),'key',_0x8a03('0x13'),_0x8a03('0x14'),_0x8a03('0xf')],'include':[{'model':'Variable','as':_0x8a03('0x10'),'attributes':['id','name']}]},{'model':'ZendeskField','as':_0x8a03('0x15'),'attributes':['id',_0x8a03('0x8'),'content',_0x8a03('0x16'),_0x8a03('0x17'),_0x8a03('0x18'),'variableName'],'include':[{'model':'Variable','as':_0x8a03('0x10'),'attributes':['id',_0x8a03('0xb')]}]}]}]},'log':'GetZendeskAccount'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/zoho.js b/server/services/ami/rpc/integrations/zoho.js index e8226d6..4af714e 100644 --- a/server/services/ami/rpc/integrations/zoho.js +++ b/server/services/ami/rpc/integrations/zoho.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x75ed=['Subjects','content','variableName','Variable','Descriptions','type','keyType','keyContent','Fields','idField','nameField','customField','../../client','getZohoAccounts','name','description','serverUrl','code','refreshToken','moduleCreate','moduleSearch','ZohoField'];(function(_0x1c4829,_0x136922){var _0x539d49=function(_0x2a8430){while(--_0x2a8430){_0x1c4829['push'](_0x1c4829['shift']());}};_0x539d49(++_0x136922);}(_0x75ed,0x12a));var _0xd75e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x75ed[_0x1facfa];return _0x9ec701;};'use strict';var client=require(_0xd75e('0x0'));exports[_0xd75e('0x1')]=function(){return function(_0x39b47c){return client['Request']('GetZohoAccount',{'options':{'raw':![],'attributes':['id',_0xd75e('0x2'),_0xd75e('0x3'),'host','zone','clientId','clientSecret',_0xd75e('0x4'),_0xd75e('0x5'),_0xd75e('0x6')],'include':[{'model':'ZohoConfiguration','as':'Configurations','attributes':['id','name',_0xd75e('0x7'),_0xd75e('0x8'),_0xd75e('0x3')],'include':[{'model':_0xd75e('0x9'),'as':_0xd75e('0xa'),'attributes':['id','type',_0xd75e('0xb'),_0xd75e('0xc')],'include':[{'model':_0xd75e('0xd'),'as':_0xd75e('0xd'),'attributes':['id',_0xd75e('0x2')]}]},{'model':_0xd75e('0x9'),'as':_0xd75e('0xe'),'attributes':['id',_0xd75e('0xf'),_0xd75e('0xb'),'key',_0xd75e('0x10'),_0xd75e('0x11'),'variableName'],'include':[{'model':_0xd75e('0xd'),'as':'Variable','attributes':['id',_0xd75e('0x2')]}]},{'model':_0xd75e('0x9'),'as':_0xd75e('0x12'),'attributes':['id','type',_0xd75e('0xb'),_0xd75e('0x13'),_0xd75e('0x14'),_0xd75e('0x15'),_0xd75e('0xc')],'include':[{'model':_0xd75e('0xd'),'as':'Variable','attributes':['id','name']}]}]}]},'log':'GetZohoAccount'});};}; \ No newline at end of file +var _0xf111=['refreshToken','ZohoConfiguration','moduleCreate','description','ZohoField','Subjects','type','content','variableName','Variable','Descriptions','key','keyType','Fields','idField','nameField','customField','GetZohoAccount','../../client','getZohoAccounts','Request','name','host','zone','clientId','clientSecret','serverUrl'];(function(_0x4727ce,_0x4ac2f5){var _0xf11217=function(_0x3ab1ef){while(--_0x3ab1ef){_0x4727ce['push'](_0x4727ce['shift']());}};_0xf11217(++_0x4ac2f5);}(_0xf111,0x120));var _0x1f11=function(_0x35f7f5,_0x4e2ee1){_0x35f7f5=_0x35f7f5-0x0;var _0x5567a4=_0xf111[_0x35f7f5];return _0x5567a4;};'use strict';var client=require(_0x1f11('0x0'));exports[_0x1f11('0x1')]=function(){return function(_0x2fb360){return client[_0x1f11('0x2')]('GetZohoAccount',{'options':{'raw':![],'attributes':['id',_0x1f11('0x3'),'description',_0x1f11('0x4'),_0x1f11('0x5'),_0x1f11('0x6'),_0x1f11('0x7'),_0x1f11('0x8'),'code',_0x1f11('0x9')],'include':[{'model':_0x1f11('0xa'),'as':'Configurations','attributes':['id',_0x1f11('0x3'),_0x1f11('0xb'),'moduleSearch',_0x1f11('0xc')],'include':[{'model':_0x1f11('0xd'),'as':_0x1f11('0xe'),'attributes':['id',_0x1f11('0xf'),_0x1f11('0x10'),_0x1f11('0x11')],'include':[{'model':_0x1f11('0x12'),'as':_0x1f11('0x12'),'attributes':['id',_0x1f11('0x3')]}]},{'model':_0x1f11('0xd'),'as':_0x1f11('0x13'),'attributes':['id',_0x1f11('0xf'),_0x1f11('0x10'),_0x1f11('0x14'),_0x1f11('0x15'),'keyContent',_0x1f11('0x11')],'include':[{'model':_0x1f11('0x12'),'as':'Variable','attributes':['id','name']}]},{'model':_0x1f11('0xd'),'as':_0x1f11('0x16'),'attributes':['id',_0x1f11('0xf'),_0x1f11('0x10'),_0x1f11('0x17'),_0x1f11('0x18'),_0x1f11('0x19'),_0x1f11('0x11')],'include':[{'model':_0x1f11('0x12'),'as':'Variable','attributes':['id',_0x1f11('0x3')]}]}]}]},'log':_0x1f11('0x1a')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/interval.js b/server/services/ami/rpc/interval.js index 36c7a89..25880f1 100644 --- a/server/services/ami/rpc/interval.js +++ b/server/services/ami/rpc/interval.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x52e5=['IntervalIftime','intervalIftime','../../../config/logger','dialer','../client','stack','replace','trim','silly','intervalIftime\x20called\x20with','isArray','resolve','every','number','map','length','interval','concat','Request'];(function(_0x1e03c3,_0x5901b9){var _0x1c4343=function(_0x2b4edc){while(--_0x2b4edc){_0x1e03c3['push'](_0x1e03c3['shift']());}};_0x1c4343(++_0x5901b9);}(_0x52e5,0x132));var _0x552e=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x52e5[_0x17d9e3];return _0x14192d;};var logger=require(_0x552e('0x0'))(_0x552e('0x1'));var client=require(_0x552e('0x2'));function intervalIftime(_0x5b0e42,_0x381633){const _0x28dc95=new Error()[_0x552e('0x3')][_0x552e('0x4')](/^Error/,'')[_0x552e('0x5')]();logger[_0x552e('0x6')](_0x552e('0x7'),_0x5b0e42,_0x381633,_0x28dc95);const _0x50220c=Array[_0x552e('0x8')](_0x5b0e42);if(!_0x5b0e42||_0x50220c&&_0x5b0e42['length']===0x0){return Promise[_0x552e('0x9')](![]);}else{var _0x180f7d=[];var _0x1b4d24=[];var _0x52f9d3=_0x50220c?_0x5b0e42:[_0x5b0e42];var _0x519903=_0x52f9d3[_0x552e('0xa')](function(_0x178a0c){return typeof _0x178a0c===_0x552e('0xb');});var _0x3a72e1=_0x52f9d3[_0x552e('0xa')](function(_0x23a726){return typeof _0x23a726==='string';});if(!_0x519903&&!_0x3a72e1){_0x180f7d=_0x52f9d3[_0x552e('0xc')](function(_0x456d04){return _0x456d04['id'];});if(_0x180f7d[_0x552e('0xd')]===0x0){_0x1b4d24=_0x52f9d3[_0x552e('0xc')](function(_0xfdbe07){return _0xfdbe07[_0x552e('0xe')];});}}else{if(_0x519903){_0x180f7d=_0x180f7d[_0x552e('0xf')](_0x52f9d3);}if(_0x3a72e1){_0x1b4d24=_0x1b4d24['concat'](_0x52f9d3);}}return client[_0x552e('0x10')]('IntervalIftime',{'intervalIds':_0x180f7d,'intervals':_0x1b4d24,'timezone':_0x381633,'log':_0x552e('0x11')});}}exports[_0x552e('0x12')]=intervalIftime; \ No newline at end of file +var _0x8042=['replace','trim','intervalIftime\x20called\x20with','length','resolve','string','map','interval','concat','Request','IntervalIftime','intervalIftime','../../../config/logger','dialer','../client','stack'];(function(_0x23d91f,_0x4d0607){var _0x486f4e=function(_0x765f24){while(--_0x765f24){_0x23d91f['push'](_0x23d91f['shift']());}};_0x486f4e(++_0x4d0607);}(_0x8042,0xac));var _0x2804=function(_0x3585fb,_0x5df075){_0x3585fb=_0x3585fb-0x0;var _0x48fb79=_0x8042[_0x3585fb];return _0x48fb79;};var logger=require(_0x2804('0x0'))(_0x2804('0x1'));var client=require(_0x2804('0x2'));function intervalIftime(_0x29837b,_0x46a8a4){const _0x170ded=new Error()[_0x2804('0x3')][_0x2804('0x4')](/^Error/,'')[_0x2804('0x5')]();logger['silly'](_0x2804('0x6'),_0x29837b,_0x46a8a4,_0x170ded);const _0x3d712e=Array['isArray'](_0x29837b);if(!_0x29837b||_0x3d712e&&_0x29837b[_0x2804('0x7')]===0x0){return Promise[_0x2804('0x8')](![]);}else{var _0xd7b217=[];var _0x1d64c3=[];var _0x3fa0a4=_0x3d712e?_0x29837b:[_0x29837b];var _0x599150=_0x3fa0a4['every'](function(_0x4f282c){return typeof _0x4f282c==='number';});var _0x557272=_0x3fa0a4['every'](function(_0x176b47){return typeof _0x176b47===_0x2804('0x9');});if(!_0x599150&&!_0x557272){_0xd7b217=_0x3fa0a4[_0x2804('0xa')](function(_0x336161){return _0x336161['id'];});if(_0xd7b217[_0x2804('0x7')]===0x0){_0x1d64c3=_0x3fa0a4[_0x2804('0xa')](function(_0x1dba50){return _0x1dba50[_0x2804('0xb')];});}}else{if(_0x599150){_0xd7b217=_0xd7b217[_0x2804('0xc')](_0x3fa0a4);}if(_0x557272){_0x1d64c3=_0x1d64c3[_0x2804('0xc')](_0x3fa0a4);}}return client[_0x2804('0xd')](_0x2804('0xe'),{'intervalIds':_0xd7b217,'intervals':_0x1d64c3,'timezone':_0x46a8a4,'log':_0x2804('0xe')});}}exports[_0x2804('0xf')]=intervalIftime; \ No newline at end of file diff --git a/server/services/ami/rpc/memberReport.js b/server/services/ami/rpc/memberReport.js index 51141b9..b2baa52 100644 --- a/server/services/ami/rpc/memberReport.js +++ b/server/services/ami/rpc/memberReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x13eb=['calleridnum','exten','queue','accountcode','uniqueid','CreateMemberReport','voiceDialReport','membername','TALKING','starttime','diff','seconds','outbound','dialstring','agent','toNumber','moment','lodash','util','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','voice','lastAssignedTo','isNil','format','SIP/%s','queuecallerleaveAt'];(function(_0x394f16,_0x4d528d){var _0x5b066c=function(_0x12c604){while(--_0x12c604){_0x394f16['push'](_0x394f16['shift']());}};_0x5b066c(++_0x4d528d);}(_0x13eb,0x132));var _0xb13e=function(_0xc65ae2,_0x53119a){_0xc65ae2=_0xc65ae2-0x0;var _0x2432ea=_0x13eb[_0xc65ae2];return _0x2432ea;};'use strict';var moment=require(_0xb13e('0x0'));var _=require(_0xb13e('0x1'));var util=require(_0xb13e('0x2'));var client=require('../client');exports[_0xb13e('0x3')]=function(_0x574470){var _0x1a79db=_0x574470[_0xb13e('0x4')]||_0x574470[_0xb13e('0x5')];return client[_0xb13e('0x6')]('CreateMemberReport',{'body':{'channel':_0xb13e('0x7'),'membername':_0x574470[_0xb13e('0x8')],'interface':_[_0xb13e('0x9')](_0x574470['interface'])?util[_0xb13e('0xa')](_0xb13e('0xb'),_0x574470[_0xb13e('0x8')]):_0x574470['interface'],'type':'TALKING','enterAt':_0x574470[_0xb13e('0xc')],'exitAt':_0x1a79db,'duration':moment(_0x1a79db)['diff'](_0x574470[_0xb13e('0xc')],'seconds'),'data1':'inbound','data2':_0x574470[_0xb13e('0xd')],'data3':_0x574470[_0xb13e('0xe')],'data4':null,'data5':_0x574470[_0xb13e('0xf')],'role':'agent','internal':_0x574470['accountcode']?_['toNumber'](_0x574470[_0xb13e('0x10')]):undefined,'uniqueid':_0x574470[_0xb13e('0x11')]},'log':_0xb13e('0x12')});};exports[_0xb13e('0x13')]=function(_0x380937){return client[_0xb13e('0x6')](_0xb13e('0x12'),{'body':{'channel':_0xb13e('0x7'),'membername':_0x380937[_0xb13e('0x14')],'interface':_0x380937['interface'],'type':_0xb13e('0x15'),'enterAt':_0x380937[_0xb13e('0x16')],'exitAt':_0x380937['endtime'],'duration':moment(_0x380937['endtime'])[_0xb13e('0x17')](_0x380937[_0xb13e('0x16')],_0xb13e('0x18'))>=0x0?moment(_0x380937['endtime'])[_0xb13e('0x17')](_0x380937[_0xb13e('0x16')],'seconds'):null,'data1':_0xb13e('0x19'),'data2':_0x380937[_0xb13e('0x10')],'data3':_0x380937[_0xb13e('0xe')],'data4':_0x380937[_0xb13e('0x1a')]||null,'role':_0xb13e('0x1b'),'internal':_0x380937[_0xb13e('0x10')]?_[_0xb13e('0x1c')](_0x380937[_0xb13e('0x10')]):undefined,'uniqueid':_0x380937['uniqueid']},'log':'CreateMemberReport'});}; \ No newline at end of file +var _0xf253=['agent','accountcode','toNumber','CreateMemberReport','TALKING','endtime','starttime','dialstring','moment','lodash','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','voice','lastAssignedTo','isNil','interface','format','SIP/%s','queuecallerleaveAt','seconds','inbound','exten','queue'];(function(_0x5d7701,_0x494f71){var _0x269483=function(_0x39ae7c){while(--_0x39ae7c){_0x5d7701['push'](_0x5d7701['shift']());}};_0x269483(++_0x494f71);}(_0xf253,0x1b1));var _0x3f25=function(_0x5a361d,_0x259dfc){_0x5a361d=_0x5a361d-0x0;var _0x24a315=_0xf253[_0x5a361d];return _0x24a315;};'use strict';var moment=require(_0x3f25('0x0'));var _=require(_0x3f25('0x1'));var util=require('util');var client=require('../client');exports[_0x3f25('0x2')]=function(_0x3fa183){var _0x3f4fdc=_0x3fa183[_0x3f25('0x3')]||_0x3fa183[_0x3f25('0x4')];return client[_0x3f25('0x5')]('CreateMemberReport',{'body':{'channel':_0x3f25('0x6'),'membername':_0x3fa183[_0x3f25('0x7')],'interface':_[_0x3f25('0x8')](_0x3fa183[_0x3f25('0x9')])?util[_0x3f25('0xa')](_0x3f25('0xb'),_0x3fa183[_0x3f25('0x7')]):_0x3fa183[_0x3f25('0x9')],'type':'TALKING','enterAt':_0x3fa183[_0x3f25('0xc')],'exitAt':_0x3f4fdc,'duration':moment(_0x3f4fdc)['diff'](_0x3fa183[_0x3f25('0xc')],_0x3f25('0xd')),'data1':_0x3f25('0xe'),'data2':_0x3fa183['calleridnum'],'data3':_0x3fa183[_0x3f25('0xf')],'data4':null,'data5':_0x3fa183[_0x3f25('0x10')],'role':_0x3f25('0x11'),'internal':_0x3fa183[_0x3f25('0x12')]?_[_0x3f25('0x13')](_0x3fa183[_0x3f25('0x12')]):undefined,'uniqueid':_0x3fa183['uniqueid']},'log':'CreateMemberReport'});};exports['voiceDialReport']=function(_0x23d890){return client[_0x3f25('0x5')](_0x3f25('0x14'),{'body':{'channel':_0x3f25('0x6'),'membername':_0x23d890['membername'],'interface':_0x23d890['interface'],'type':_0x3f25('0x15'),'enterAt':_0x23d890['starttime'],'exitAt':_0x23d890[_0x3f25('0x16')],'duration':moment(_0x23d890[_0x3f25('0x16')])['diff'](_0x23d890['starttime'],_0x3f25('0xd'))>=0x0?moment(_0x23d890[_0x3f25('0x16')])['diff'](_0x23d890[_0x3f25('0x17')],'seconds'):null,'data1':'outbound','data2':_0x23d890[_0x3f25('0x12')],'data3':_0x23d890['exten'],'data4':_0x23d890[_0x3f25('0x18')]||null,'role':_0x3f25('0x11'),'internal':_0x23d890[_0x3f25('0x12')]?_[_0x3f25('0x13')](_0x23d890[_0x3f25('0x12')]):undefined,'uniqueid':_0x23d890['uniqueid']},'log':_0x3f25('0x14')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index a3bcaaa..92a2d19 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 _0x04d5=['../client','getSettings','ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval'];(function(_0x2d3754,_0x4d6841){var _0x490081=function(_0x2ac4cd){while(--_0x2ac4cd){_0x2d3754['push'](_0x2d3754['shift']());}};_0x490081(++_0x4d6841);}(_0x04d5,0xe1));var _0x504d=function(_0x1d37ad,_0x3a8d51){_0x1d37ad=_0x1d37ad-0x0;var _0x4be89c=_0x04d5[_0x1d37ad];return _0x4be89c;};'use strict';var client=require(_0x504d('0x0'));exports[_0x504d('0x1')]=function(){return client['Request'](_0x504d('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x504d('0x3'),_0x504d('0x4')]},'log':'GetSettings'});}; \ No newline at end of file +var _0x9652=['GetSettings','../client','getSettings','ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval'];(function(_0x44acce,_0x2ee76d){var _0x3c6072=function(_0x52c10e){while(--_0x52c10e){_0x44acce['push'](_0x44acce['shift']());}};_0x3c6072(++_0x2ee76d);}(_0x9652,0xaf));var _0x2965=function(_0x38de33,_0x4361bb){_0x38de33=_0x38de33-0x0;var _0x40f16d=_0x9652[_0x38de33];return _0x40f16d;};'use strict';var client=require(_0x2965('0x0'));exports[_0x2965('0x1')]=function(){return client['Request'](_0x2965('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x2965('0x3'),_0x2965('0x4')]},'log':_0x2965('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 6783f61..62607db 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 _0x7ef0=['../client','getTemplates','GetTemplate','name','html'];(function(_0x5e211d,_0x26e878){var _0x42e65b=function(_0x487e44){while(--_0x487e44){_0x5e211d['push'](_0x5e211d['shift']());}};_0x42e65b(++_0x26e878);}(_0x7ef0,0x122));var _0x07ef=function(_0x4d244e,_0x2a94fd){_0x4d244e=_0x4d244e-0x0;var _0x5205c7=_0x7ef0[_0x4d244e];return _0x5205c7;};'use strict';var client=require(_0x07ef('0x0'));exports[_0x07ef('0x1')]=function(_0x2daaec){return function(_0x14703b){return client['Request'](_0x07ef('0x2'),{'options':{'raw':!![],'attributes':['id',_0x07ef('0x3'),_0x07ef('0x4')]},'log':_0x07ef('0x2')});};}; \ No newline at end of file +var _0xfd6f=['getTemplates','Request','name','html','GetTemplate','../client'];(function(_0x436167,_0x30772e){var _0x1ecf11=function(_0x4325ca){while(--_0x4325ca){_0x436167['push'](_0x436167['shift']());}};_0x1ecf11(++_0x30772e);}(_0xfd6f,0x19d));var _0xffd6=function(_0xcb007,_0x1a9fb5){_0xcb007=_0xcb007-0x0;var _0x10fb56=_0xfd6f[_0xcb007];return _0x10fb56;};'use strict';var client=require(_0xffd6('0x0'));exports[_0xffd6('0x1')]=function(_0x29b163){return function(_0x45ddb9){return client[_0xffd6('0x2')]('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0xffd6('0x3'),_0xffd6('0x4')]},'log':_0xffd6('0x5')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 2d89b1d..d99684a 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 _0x1c34=['data3','data4','data5','data7','../client','getTriggers','Request','GetTrigger','name','channel','status','Condition','AllConditions','field','operator','AnyConditions','value','Action','Actions','action','data1'];(function(_0x98aad4,_0x2573b3){var _0x5527e1=function(_0x1fbc41){while(--_0x1fbc41){_0x98aad4['push'](_0x98aad4['shift']());}};_0x5527e1(++_0x2573b3);}(_0x1c34,0x1e7));var _0x41c3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1c34[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x41c3('0x0'));exports[_0x41c3('0x1')]=function(_0x272c5d){return function(_0x273e68){return client[_0x41c3('0x2')](_0x41c3('0x3'),{'options':{'raw':![],'attributes':['id',_0x41c3('0x4'),_0x41c3('0x5'),_0x41c3('0x6')],'include':[{'model':_0x41c3('0x7'),'as':_0x41c3('0x8'),'attributes':['id',_0x41c3('0x9'),_0x41c3('0xa'),'value']},{'model':_0x41c3('0x7'),'as':_0x41c3('0xb'),'attributes':['id',_0x41c3('0x9'),'operator',_0x41c3('0xc')]},{'model':_0x41c3('0xd'),'as':_0x41c3('0xe'),'attributes':['id',_0x41c3('0xf'),_0x41c3('0x10'),'data2',_0x41c3('0x11'),_0x41c3('0x12'),_0x41c3('0x13'),'data6',_0x41c3('0x14')]}]},'log':_0x41c3('0x3')});};}; \ No newline at end of file +var _0x90bd=['data5','data6','getTriggers','Request','name','channel','status','Condition','AllConditions','value','AnyConditions','Action','Actions','action','data1','data2','data3','data4'];(function(_0x93b411,_0x4263ca){var _0x14ce11=function(_0x3f71c4){while(--_0x3f71c4){_0x93b411['push'](_0x93b411['shift']());}};_0x14ce11(++_0x4263ca);}(_0x90bd,0x17c));var _0xd90b=function(_0x35fb56,_0x5dadff){_0x35fb56=_0x35fb56-0x0;var _0x2fd52c=_0x90bd[_0x35fb56];return _0x2fd52c;};'use strict';var client=require('../client');exports[_0xd90b('0x0')]=function(_0x99d9f){return function(_0x27129a){return client[_0xd90b('0x1')]('GetTrigger',{'options':{'raw':![],'attributes':['id',_0xd90b('0x2'),_0xd90b('0x3'),_0xd90b('0x4')],'include':[{'model':_0xd90b('0x5'),'as':_0xd90b('0x6'),'attributes':['id','field','operator',_0xd90b('0x7')]},{'model':_0xd90b('0x5'),'as':_0xd90b('0x8'),'attributes':['id','field','operator',_0xd90b('0x7')]},{'model':_0xd90b('0x9'),'as':_0xd90b('0xa'),'attributes':['id',_0xd90b('0xb'),_0xd90b('0xc'),_0xd90b('0xd'),_0xd90b('0xe'),_0xd90b('0xf'),_0xd90b('0x10'),_0xd90b('0x11'),'data7']}]},'log':'GetTrigger'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index a4a6b24..23d3976 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 _0x6505=['../client','getTrunks','Request','GetTrunk','name','registry','defaultuser'];(function(_0x22e204,_0x35e723){var _0x2b577f=function(_0x1f40c6){while(--_0x1f40c6){_0x22e204['push'](_0x22e204['shift']());}};_0x2b577f(++_0x35e723);}(_0x6505,0x8c));var _0x5650=function(_0x1dcc32,_0x1ffc02){_0x1dcc32=_0x1dcc32-0x0;var _0x56b893=_0x6505[_0x1dcc32];return _0x56b893;};'use strict';var client=require(_0x5650('0x0'));exports[_0x5650('0x1')]=function(_0x2ee4dd){return function(_0x254e0f){return client[_0x5650('0x2')](_0x5650('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x5650('0x4'),_0x5650('0x5'),_0x5650('0x6')]},'log':_0x5650('0x3')});};}; \ No newline at end of file +var _0xe198=['getTrunks','Request','GetTrunk','name','registry','defaultuser','../client'];(function(_0x27a1eb,_0x40e51a){var _0x3e443b=function(_0xd1ab39){while(--_0xd1ab39){_0x27a1eb['push'](_0x27a1eb['shift']());}};_0x3e443b(++_0x40e51a);}(_0xe198,0x6f));var _0x8e19=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xe198[_0x465a0c];return _0x1e202e;};'use strict';var client=require(_0x8e19('0x0'));exports[_0x8e19('0x1')]=function(_0x5330b8){return function(_0x488972){return client[_0x8e19('0x2')](_0x8e19('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x8e19('0x4'),_0x8e19('0x5'),_0x8e19('0x6')]},'log':'GetTrunk'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 5eee11e..4daea58 100644 --- a/server/services/ami/rpc/user.js +++ b/server/services/ami/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['getAgent','Request','GetUser','agent','name','email','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getAgents','getTelephones','accountcode','internal','savePause','PauseUser'];(function(_0x27def2,_0x5d1ba2){var _0x21ad50=function(_0x6dfcd1){while(--_0x6dfcd1){_0x27def2['push'](_0x27def2['shift']());}};_0x21ad50(++_0x5d1ba2);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':![],'where':{'role':_0x3071('0x2')},'attributes':['id',_0x3071('0x3'),_0x3071('0x4'),'accountcode',_0x3071('0x5'),_0x3071('0x6'),_0x3071('0x7'),_0x3071('0x8'),_0x3071('0x9'),_0x3071('0xa'),_0x3071('0xb'),_0x3071('0xc'),_0x3071('0xd')]},'log':_0x3071('0xe')});};};exports[_0x3071('0xf')]=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x3071('0x3'),_0x3071('0x10'),_0x3071('0x11')]},'log':_0x3071('0xf')});};};exports[_0x3071('0x12')]=function(_0x4a470a,_0x2ace21,_0x11a7ee){return client[_0x3071('0x0')](_0x3071('0x13'),{'body':{'type':_0x2ace21,'uniqueid':_0x11a7ee},'options':{'where':{'id':_0x4a470a['id']}},'log':_0x3071('0x12')});};exports['saveUnpause']=function(_0x5330a8){return client[_0x3071('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5330a8['id']}},'log':_0x3071('0x12')});};exports[_0x3071('0x14')]=function(_0x5d4883){return client[_0x3071('0x0')]('ShowUser',{'options':{'raw':![],'where':{'role':_0x3071('0x2'),'id':_0x5d4883},'attributes':['id',_0x3071('0x3'),_0x3071('0x4'),_0x3071('0x10'),_0x3071('0x5'),_0x3071('0x6'),_0x3071('0x7'),_0x3071('0x8'),_0x3071('0x9'),_0x3071('0xa'),'interface']},'log':_0x3071('0x14')});}; \ No newline at end of file +var _0xe706=['internal','savePause','PauseUser','saveUnpause','UnpauseUser','ShowUser','getAgent','../client','getAgents','Request','agent','name','email','accountcode','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','GetUser','telephone'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xe706,0xa3));var _0x6e70=function(_0x24e0c9,_0x284109){_0x24e0c9=_0x24e0c9-0x0;var _0x4448f0=_0xe706[_0x24e0c9];return _0x4448f0;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':_0x6e70('0x3')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6'),_0x6e70('0x7'),_0x6e70('0x8'),_0x6e70('0x9'),_0x6e70('0xa'),_0x6e70('0xb'),_0x6e70('0xc'),_0x6e70('0xd'),_0x6e70('0xe'),_0x6e70('0xf')]},'log':_0x6e70('0x1')});};};exports[_0x6e70('0x10')]=function(){return function(){return client[_0x6e70('0x2')](_0x6e70('0x11'),{'options':{'raw':!![],'where':{'role':_0x6e70('0x12')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x6'),_0x6e70('0x13')]},'log':_0x6e70('0x10')});};};exports[_0x6e70('0x14')]=function(_0x4600f9,_0x5b3d07,_0x47f6b2){return client[_0x6e70('0x2')](_0x6e70('0x15'),{'body':{'type':_0x5b3d07,'uniqueid':_0x47f6b2},'options':{'where':{'id':_0x4600f9['id']}},'log':_0x6e70('0x14')});};exports[_0x6e70('0x16')]=function(_0x3b38f3){return client[_0x6e70('0x2')](_0x6e70('0x17'),{'body':{},'options':{'where':{'id':_0x3b38f3['id']}},'log':_0x6e70('0x14')});};exports['getAgent']=function(_0x52737e){return client['Request'](_0x6e70('0x18'),{'options':{'raw':![],'where':{'role':'agent','id':_0x52737e},'attributes':['id','name',_0x6e70('0x5'),_0x6e70('0x6'),'fullname',_0x6e70('0x8'),'lastLoginAt',_0x6e70('0xa'),_0x6e70('0xb'),'voicePause','interface']},'log':_0x6e70('0x19')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 2b0be40..43abdc5 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 _0xad8f=['update','UpdateVoiceAgentReport','../client','create','Request','CreateVoiceAgentReport'];(function(_0xa45dbe,_0x35f905){var _0x341ebc=function(_0x46587d){while(--_0x46587d){_0xa45dbe['push'](_0xa45dbe['shift']());}};_0x341ebc(++_0x35f905);}(_0xad8f,0x92));var _0xfad8=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xad8f[_0x3947c9];return _0x2e7871;};'use strict';var client=require(_0xfad8('0x0'));exports[_0xfad8('0x1')]=function(_0x2e8671){return client[_0xfad8('0x2')](_0xfad8('0x3'),{'body':_0x2e8671,'log':_0xfad8('0x3')});};exports[_0xfad8('0x4')]=function(_0x27d941,_0x3a0879,_0xfbe782){return client[_0xfad8('0x2')](_0xfad8('0x5'),{'body':_0x27d941,'options':{'where':{'uniqueid':_0x3a0879,'interface':_0xfbe782,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file +var _0x5b81=['CreateVoiceAgentReport','update','Request','UpdateVoiceAgentReport','create'];(function(_0x31ced5,_0x5d5415){var _0x10d9e5=function(_0x2e51a5){while(--_0x2e51a5){_0x31ced5['push'](_0x31ced5['shift']());}};_0x10d9e5(++_0x5d5415);}(_0x5b81,0x18f));var _0x15b8=function(_0x12a7c2,_0x36cebc){_0x12a7c2=_0x12a7c2-0x0;var _0x18b2ca=_0x5b81[_0x12a7c2];return _0x18b2ca;};'use strict';var client=require('../client');exports[_0x15b8('0x0')]=function(_0x44d206){return client['Request'](_0x15b8('0x1'),{'body':_0x44d206,'log':_0x15b8('0x1')});};exports[_0x15b8('0x2')]=function(_0x1dcb85,_0x2da364,_0x5f263c){return client[_0x15b8('0x3')](_0x15b8('0x4'),{'body':_0x1dcb85,'options':{'where':{'uniqueid':_0x2da364,'interface':_0x5f263c,'agentcomplete':!![]}},'log':_0x15b8('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 7d98525..3c1e895 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 _0x92d9=['CreateVoiceCallReport','merge','calleridnum','context','callerid','DOCUMENTATION','Request','GetVoiceCallReport','outbound','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','disposition','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','../client','create'];(function(_0x149965,_0x1ff46a){var _0x56fafa=function(_0x2bd6f5){while(--_0x2bd6f5){_0x149965['push'](_0x149965['shift']());}};_0x56fafa(++_0x1ff46a);}(_0x92d9,0x15b));var _0x992d=function(_0x4da6a3,_0x15f71c){_0x4da6a3=_0x4da6a3-0x0;var _0xd252a6=_0x92d9[_0x4da6a3];return _0xd252a6;};'use strict';var moment=require(_0x992d('0x0'));var util=require(_0x992d('0x1'));var _=require(_0x992d('0x2'));var client=require(_0x992d('0x3'));exports[_0x992d('0x4')]=function(_0xf8887b){return client['Request'](_0x992d('0x5'),{'body':_[_0x992d('0x6')](_0xf8887b,{'source':_0xf8887b[_0x992d('0x7')],'destinationcontext':_0xf8887b[_0x992d('0x8')],'callerid':_0xf8887b[_0x992d('0x9')],'amaflags':_0x992d('0xa')}),'log':_0x992d('0x5')});};exports['getVoiceCallReports']=function(){return function(){return client[_0x992d('0xb')](_0x992d('0xc'),{'options':{'where':{'type':[_0x992d('0xd')],'createdAt':{'$between':[moment()['startOf'](_0x992d('0xe'))[_0x992d('0xf')](_0x992d('0x10')),moment()[_0x992d('0x11')](_0x992d('0xe'))[_0x992d('0xf')](_0x992d('0x10'))]}},'attributes':['type',_0x992d('0x12'),_0x992d('0x13'),_0x992d('0x14')]},'log':_0x992d('0x15')});};}; \ No newline at end of file +var _0x0924=['getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration','GetVoiceCallReports','util','lodash','../client','create','Request','CreateVoiceCallReport','merge','context','DOCUMENTATION'];(function(_0x1b11a2,_0x1b37d0){var _0x1f2afa=function(_0xc068e1){while(--_0xc068e1){_0x1b11a2['push'](_0x1b11a2['shift']());}};_0x1f2afa(++_0x1b37d0);}(_0x0924,0x83));var _0x4092=function(_0x98197,_0xea7356){_0x98197=_0x98197-0x0;var _0x5d9199=_0x0924[_0x98197];return _0x5d9199;};'use strict';var moment=require('moment');var util=require(_0x4092('0x0'));var _=require(_0x4092('0x1'));var client=require(_0x4092('0x2'));exports[_0x4092('0x3')]=function(_0x584a29){return client[_0x4092('0x4')](_0x4092('0x5'),{'body':_[_0x4092('0x6')](_0x584a29,{'source':_0x584a29['calleridnum'],'destinationcontext':_0x584a29[_0x4092('0x7')],'callerid':_0x584a29['callerid'],'amaflags':_0x4092('0x8')}),'log':_0x4092('0x5')});};exports[_0x4092('0x9')]=function(){return function(){return client[_0x4092('0x4')](_0x4092('0xa'),{'options':{'where':{'type':[_0x4092('0xb')],'createdAt':{'$between':[moment()[_0x4092('0xc')](_0x4092('0xd'))[_0x4092('0xe')](_0x4092('0xf')),moment()['endOf']('day')[_0x4092('0xe')](_0x4092('0xf'))]}},'attributes':[_0x4092('0x10'),_0x4092('0x11'),_0x4092('0x12'),'billableseconds']},'log':_0x4092('0x13')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index fc4a218..546abdb 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 _0x472d=['create','Request','CreateVoiceDialReport','../client'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x472d,0xf7));var _0xd472=function(_0x566ebb,_0xe369cf){_0x566ebb=_0x566ebb-0x0;var _0x4ca0ed=_0x472d[_0x566ebb];return _0x4ca0ed;};'use strict';var client=require(_0xd472('0x0'));exports[_0xd472('0x1')]=function(_0x4d9e39){return client[_0xd472('0x2')](_0xd472('0x3'),{'body':_0x4d9e39,'log':'CreateVoiceDialReport'});}; \ No newline at end of file +var _0x2340=['Request','CreateVoiceDialReport','../client','create'];(function(_0x17392e,_0x425148){var _0x16514a=function(_0x1a049c){while(--_0x1a049c){_0x17392e['push'](_0x17392e['shift']());}};_0x16514a(++_0x425148);}(_0x2340,0x9e));var _0x0234=function(_0x228e8b,_0x2500de){_0x228e8b=_0x228e8b-0x0;var _0x23cd63=_0x2340[_0x228e8b];return _0x23cd63;};'use strict';var client=require(_0x0234('0x0'));exports[_0x0234('0x1')]=function(_0x4151a2){return client[_0x0234('0x2')]('CreateVoiceDialReport',{'body':_0x4151a2,'log':_0x0234('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index d672c1a..e18ba0e 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 _0x90db=['GetVoiceExtension','getVoiceExtensions','Request'];(function(_0x4b7b62,_0x4920a9){var _0x2280df=function(_0x21e1f8){while(--_0x21e1f8){_0x4b7b62['push'](_0x4b7b62['shift']());}};_0x2280df(++_0x4920a9);}(_0x90db,0x1c0));var _0xb90d=function(_0x68ee8b,_0x3cc6c5){_0x68ee8b=_0x68ee8b-0x0;var _0x5148f7=_0x90db[_0x68ee8b];return _0x5148f7;};'use strict';var client=require('../client');exports[_0xb90d('0x0')]=function(){return function(){return client[_0xb90d('0x1')](_0xb90d('0x2'),{'options':{'raw':!![],'attributes':['id','exten','recordingFormat'],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file +var _0xc874=['../client','Request','GetVoiceExtension','getVoiceExtensions'];(function(_0x37756b,_0x24db76){var _0x46efec=function(_0x319807){while(--_0x319807){_0x37756b['push'](_0x37756b['shift']());}};_0x46efec(++_0x24db76);}(_0xc874,0x154));var _0x4c87=function(_0xa9a245,_0x2a0387){_0xa9a245=_0xa9a245-0x0;var _0x2d0eaa=_0xc874[_0xa9a245];return _0x2d0eaa;};'use strict';var client=require(_0x4c87('0x0'));exports['getVoiceExtensions']=function(){return function(){return client[_0x4c87('0x1')](_0x4c87('0x2'),{'options':{'raw':!![],'attributes':['id','exten','recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0x4c87('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 32d6fc2..51f8c29 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 _0x296f=['Interval','Intervals','interval','../client','getVoiceQueues','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','type','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialQueueOptions','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupAgent','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPreviewRecallmeReminder','Trunk','callerid','active','TrunkBackup'];(function(_0x19fd49,_0x38802e){var _0x149afb=function(_0x37374e){while(--_0x37374e){_0x19fd49['push'](_0x19fd49['shift']());}};_0x149afb(++_0x38802e);}(_0x296f,0x83));var _0xf296=function(_0x304b67,_0x31cb39){_0x304b67=_0x304b67-0x0;var _0x493afb=_0x296f[_0x304b67];return _0x493afb;};'use strict';var client=require(_0xf296('0x0'));exports[_0xf296('0x1')]=function(){return function(){return client['Request'](_0xf296('0x2'),{'options':{'raw':![],'attributes':['id',_0xf296('0x3'),_0xf296('0x4'),_0xf296('0x5'),_0xf296('0x6'),_0xf296('0x7'),_0xf296('0x8'),'dialActive',_0xf296('0x9'),_0xf296('0xa'),_0xf296('0xb'),_0xf296('0xc'),_0xf296('0xd'),_0xf296('0xe'),_0xf296('0xf'),_0xf296('0x10'),_0xf296('0x11'),'dialOriginateTimeout',_0xf296('0x12'),'dialQueueTimeout',_0xf296('0x13'),_0xf296('0x14'),_0xf296('0x15'),_0xf296('0x16'),_0xf296('0x17'),_0xf296('0x18'),_0xf296('0x19'),_0xf296('0x1a'),'dialTimezone',_0xf296('0x1b'),_0xf296('0x1c'),_0xf296('0x1d'),_0xf296('0x1e'),_0xf296('0x1f'),'dialAMDGreeting',_0xf296('0x20'),_0xf296('0x21'),_0xf296('0x22'),_0xf296('0x23'),_0xf296('0x24'),_0xf296('0x25'),_0xf296('0x26'),_0xf296('0x27'),_0xf296('0x28'),_0xf296('0x29'),'dialOrderByScheduledAt',_0xf296('0x2a'),'dialAgiAfterHangupClient','dialQueueProject2','monitor_format','strategy',_0xf296('0x2b'),_0xf296('0x2c'),'dialNoSuchNumberMaxRetry',_0xf296('0x2d'),_0xf296('0x2e'),_0xf296('0x2f'),_0xf296('0x30'),_0xf296('0x31'),_0xf296('0x32'),_0xf296('0x33'),_0xf296('0x34'),_0xf296('0x35'),_0xf296('0x36'),_0xf296('0x37'),'dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe',_0xf296('0x38')],'include':[{'model':_0xf296('0x39'),'as':_0xf296('0x39'),'attributes':['id',_0xf296('0x3'),_0xf296('0x3a'),_0xf296('0x3b')]},{'model':'Pause','as':'mandatoryDispositionPause','attributes':['id',_0xf296('0x3')]},{'model':_0xf296('0x39'),'as':_0xf296('0x3c'),'attributes':['id',_0xf296('0x3'),_0xf296('0x3a'),_0xf296('0x3b')]},{'model':_0xf296('0x3d'),'as':_0xf296('0x3d'),'attributes':['id',_0xf296('0x3')],'include':[{'model':_0xf296('0x3d'),'as':_0xf296('0x3e'),'attributes':['id',_0xf296('0x3'),_0xf296('0x3f')]}]}]},'log':_0xf296('0x1')});};}; \ No newline at end of file +var _0x8bcd=['callerid','active','mandatoryDispositionPause','name','TrunkBackup','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','acw','acwTimeout','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialCheckDuplicateType','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','Trunk'];(function(_0x388a4f,_0x1b56be){var _0x1079b8=function(_0x5dd574){while(--_0x5dd574){_0x388a4f['push'](_0x388a4f['shift']());}};_0x1079b8(++_0x1b56be);}(_0x8bcd,0x18e));var _0xd8bc=function(_0x3e0596,_0x2a8953){_0x3e0596=_0x3e0596-0x0;var _0x2a0668=_0x8bcd[_0x3e0596];return _0x2a0668;};'use strict';var client=require(_0xd8bc('0x0'));exports[_0xd8bc('0x1')]=function(){return function(){return client[_0xd8bc('0x2')](_0xd8bc('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xd8bc('0x4'),_0xd8bc('0x5'),'autopause',_0xd8bc('0x6'),_0xd8bc('0x7'),_0xd8bc('0x8'),_0xd8bc('0x9'),_0xd8bc('0xa'),_0xd8bc('0xb'),_0xd8bc('0xc'),_0xd8bc('0xd'),_0xd8bc('0xe'),'dialPredictiveInterval',_0xd8bc('0xf'),_0xd8bc('0x10'),_0xd8bc('0x11'),_0xd8bc('0x12'),_0xd8bc('0x13'),_0xd8bc('0x14'),'dialCongestionMaxRetry',_0xd8bc('0x15'),_0xd8bc('0x16'),_0xd8bc('0x17'),_0xd8bc('0x18'),_0xd8bc('0x19'),_0xd8bc('0x1a'),_0xd8bc('0x1b'),_0xd8bc('0x1c'),'dialPrefix',_0xd8bc('0x1d'),'dialAMDActive',_0xd8bc('0x1e'),_0xd8bc('0x1f'),_0xd8bc('0x20'),'dialAMDTotalAnalysisTime',_0xd8bc('0x21'),_0xd8bc('0x22'),_0xd8bc('0x23'),_0xd8bc('0x24'),_0xd8bc('0x25'),'timeout',_0xd8bc('0x26'),_0xd8bc('0x27'),_0xd8bc('0x28'),_0xd8bc('0x29'),_0xd8bc('0x2a'),_0xd8bc('0x2b'),_0xd8bc('0x6'),'strategy',_0xd8bc('0x2c'),_0xd8bc('0x2d'),_0xd8bc('0x2e'),_0xd8bc('0x2f'),'dialDropMaxRetry',_0xd8bc('0x30'),'dialAbandonedMaxRetry',_0xd8bc('0x31'),_0xd8bc('0x32'),_0xd8bc('0x33'),_0xd8bc('0x34'),_0xd8bc('0x35'),'mandatoryDisposition','dialPredictiveIntervalMaxThreshold',_0xd8bc('0x36'),_0xd8bc('0x37'),'dialPreviewRecallmeReminder'],'include':[{'model':'Trunk','as':_0xd8bc('0x38'),'attributes':['id','name',_0xd8bc('0x39'),_0xd8bc('0x3a')]},{'model':'Pause','as':_0xd8bc('0x3b'),'attributes':['id',_0xd8bc('0x3c')]},{'model':_0xd8bc('0x38'),'as':_0xd8bc('0x3d'),'attributes':['id',_0xd8bc('0x3c'),'callerid',_0xd8bc('0x3a')]},{'model':_0xd8bc('0x3e'),'as':'Interval','attributes':['id',_0xd8bc('0x3c')],'include':[{'model':'Interval','as':_0xd8bc('0x3f'),'attributes':['id','name',_0xd8bc('0x40')]}]}]},'log':_0xd8bc('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 66024bc..71921fc 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(_0x33b82c,_0x4cb74b){var _0x30ac29=function(_0x6dba15){while(--_0x6dba15){_0x33b82c['push'](_0x33b82c['shift']());}};_0x30ac29(++_0x4cb74b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'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(_0x39621b,_0x525571){var _0x37feba=function(_0x3504eb){while(--_0x3504eb){_0x39621b['push'](_0x39621b['shift']());}};_0x37feba(++_0x525571);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'use strict';var moment=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var client=require(_0x0a9e('0x2'));exports['create']=function(_0x550fbc){return client[_0x0a9e('0x3')]('CreateVoiceQueueReport',{'body':_0x550fbc,'log':_0x0a9e('0x4')});};exports[_0x0a9e('0x5')]=function(){return function(){return client[_0x0a9e('0x3')](_0x0a9e('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x0a9e('0x7')]('day')[_0x0a9e('0x8')](_0x0a9e('0x9')),moment()[_0x0a9e('0xa')]('day')['format'](_0x0a9e('0x9'))]}},'attributes':['uniqueid','queue',_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe'),_0x0a9e('0xf'),_0x0a9e('0x10'),'queuecallerabandon','queuecallerabandonAt']},'log':'GetVoiceQueueReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index a212ddb..cc3a0fe 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 _0x6306=['Request','../client'];(function(_0x22d19d,_0x379051){var _0x103fc2=function(_0x10b414){while(--_0x10b414){_0x22d19d['push'](_0x22d19d['shift']());}};_0x103fc2(++_0x379051);}(_0x6306,0x159));var _0x6630=function(_0x1ea9df,_0x2c718b){_0x1ea9df=_0x1ea9df-0x0;var _0x2b2854=_0x6306[_0x1ea9df];return _0x2b2854;};'use strict';var client=require(_0x6630('0x0'));exports['getVoiceQueueRtPauses']=function(_0x553baf){return function(){return client[_0x6630('0x1')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x553baf,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file +var _0x2cbd=['../client','getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses'];(function(_0x3b5250,_0x7a0b2c){var _0xc844a1=function(_0x2fbc98){while(--_0x2fbc98){_0x3b5250['push'](_0x3b5250['shift']());}};_0xc844a1(++_0x7a0b2c);}(_0x2cbd,0x108));var _0xd2cb=function(_0x47bc5e,_0x6fc500){_0x47bc5e=_0x47bc5e-0x0;var _0x323a59=_0x2cbd[_0x47bc5e];return _0x323a59;};'use strict';var client=require(_0xd2cb('0x0'));exports[_0xd2cb('0x1')]=function(_0x1404aa){return function(){return client[_0xd2cb('0x2')](_0xd2cb('0x3'),{'options':{'where':{'VoiceQueueId':_0x1404aa,'paused':!![]},'raw':!![]},'log':_0xd2cb('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 7872190..322d4af 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(_0x35673d,_0x557329){var _0x57f591=function(_0x36c9f4){while(--_0x36c9f4){_0x35673d['push'](_0x35673d['shift']());}};_0x57f591(++_0x557329);}(_0x7a54,0x106));var _0x47a5=function(_0x566ca6,_0xa21fc5){_0x566ca6=_0x566ca6-0x0;var _0xf301f5=_0x7a54[_0x566ca6];return _0xf301f5;};'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(_0x55a078,_0x548edf){var _0x50920b=function(_0x3c57a8){while(--_0x3c57a8){_0x55a078['push'](_0x55a078['shift']());}};_0x50920b(++_0x548edf);}(_0x7a54,0x106));var _0x47a5=function(_0xd74c5c,_0x438922){_0xd74c5c=_0xd74c5c-0x0;var _0x4ee40f=_0x7a54[_0xd74c5c];return _0x4ee40f;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index c8a074e..ca1b9b8 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 _0xa649=['origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransfererexten','attended','../client','transfers','blindTransfer','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transfererexten','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereecontext','transfereeexten','transfereelinkedid','context','extension','CreateVoiceTransferReport','Request','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum'];(function(_0x39ffd1,_0x299703){var _0x31267e=function(_0x11b420){while(--_0x11b420){_0x39ffd1['push'](_0x39ffd1['shift']());}};_0x31267e(++_0x299703);}(_0xa649,0x1d4));var _0x9a64=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xa649[_0x19950b];return _0x3c6b41;};'use strict';var client=require(_0x9a64('0x0'));exports[_0x9a64('0x1')]={};exports[_0x9a64('0x2')]=function(_0x308a2b){return client['Request']('CreateVoiceTransferReport',{'body':{'result':_0x308a2b[_0x9a64('0x3')],'transfererchannel':_0x308a2b[_0x9a64('0x4')],'transferercalleridnum':_0x308a2b[_0x9a64('0x5')],'transferercalleridname':_0x308a2b[_0x9a64('0x6')],'transfererconnectedlinenum':_0x308a2b[_0x9a64('0x7')],'transfererconnectedlinename':_0x308a2b[_0x9a64('0x8')],'transfereraccountcode':_0x308a2b[_0x9a64('0x9')],'transferercontext':_0x308a2b['transferercontext'],'transfererexten':_0x308a2b[_0x9a64('0xa')],'transfererlinkedid':_0x308a2b['transfererlinkedid'],'transfereechannel':_0x308a2b['transfereechannel'],'transfereecalleridnum':_0x308a2b[_0x9a64('0xb')],'transfereecalleridname':_0x308a2b[_0x9a64('0xc')],'transfereeconnectedlinenum':_0x308a2b[_0x9a64('0xd')],'transfereeconnectedlinename':_0x308a2b[_0x9a64('0xe')],'transfereeaccountcode':_0x308a2b['transfereeaccountcode'],'transfereecontext':_0x308a2b[_0x9a64('0xf')],'transfereeexten':_0x308a2b[_0x9a64('0x10')],'transfereelinkedid':_0x308a2b[_0x9a64('0x11')],'isexternal':_0x308a2b['isexternal'],'context':_0x308a2b[_0x9a64('0x12')],'extension':_0x308a2b[_0x9a64('0x13')],'type':'blind'},'log':_0x9a64('0x14')});};exports['attendedTransfer']=function(_0x332611){return client[_0x9a64('0x15')]('CreateVoiceTransferReport',{'body':{'result':_0x332611[_0x9a64('0x3')],'transfererchannel':_0x332611[_0x9a64('0x16')],'transferercalleridnum':_0x332611[_0x9a64('0x17')],'transferercalleridname':_0x332611[_0x9a64('0x18')],'transfererconnectedlinenum':_0x332611[_0x9a64('0x19')],'transfererconnectedlinename':_0x332611['secondtransfererconnectedlinename'],'transfereraccountcode':_0x332611[_0x9a64('0x1a')],'transferercontext':_0x332611['secondtransferercontext'],'transfererexten':_0x332611[_0x9a64('0x1b')],'transfererlinkedid':_0x332611[_0x9a64('0x1c')],'transfereechannel':_0x332611['transfertargetchannel'],'transfereecalleridnum':_0x332611[_0x9a64('0x1d')],'transfereecalleridname':_0x332611['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x332611[_0x9a64('0x1e')],'transfereeconnectedlinename':_0x332611[_0x9a64('0x1f')],'transfereeaccountcode':_0x332611[_0x9a64('0x20')],'transfereecontext':_0x332611[_0x9a64('0x21')],'transfereeexten':_0x332611[_0x9a64('0x22')],'transfereelinkedid':_0x332611[_0x9a64('0x23')],'isexternal':_0x332611['isexternal'],'context':_0x332611['origtransferercontext'],'extension':_0x332611[_0x9a64('0x24')],'type':_0x9a64('0x25')},'log':_0x9a64('0x14')});}; \ No newline at end of file +var _0x8fae=['transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereelinkedid','isexternal','context','extension','blind','attendedTransfer','Request','result','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetconnectedlinename','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','transfers','blindTransfer','CreateVoiceTransferReport','transfererchannel','transferercalleridname','transfererconnectedlinename','transfereraccountcode','transfererlinkedid','transfereechannel','transfereecalleridnum'];(function(_0x3d6db1,_0x4358f8){var _0x5e1cc3=function(_0x3ad5af){while(--_0x3ad5af){_0x3d6db1['push'](_0x3d6db1['shift']());}};_0x5e1cc3(++_0x4358f8);}(_0x8fae,0xeb));var _0xe8fa=function(_0x20fa63,_0x65c8d3){_0x20fa63=_0x20fa63-0x0;var _0x4c37ae=_0x8fae[_0x20fa63];return _0x4c37ae;};'use strict';var client=require('../client');exports[_0xe8fa('0x0')]={};exports[_0xe8fa('0x1')]=function(_0x33abdb){return client['Request'](_0xe8fa('0x2'),{'body':{'result':_0x33abdb['result'],'transfererchannel':_0x33abdb[_0xe8fa('0x3')],'transferercalleridnum':_0x33abdb['transferercalleridnum'],'transferercalleridname':_0x33abdb[_0xe8fa('0x4')],'transfererconnectedlinenum':_0x33abdb['transfererconnectedlinenum'],'transfererconnectedlinename':_0x33abdb[_0xe8fa('0x5')],'transfereraccountcode':_0x33abdb[_0xe8fa('0x6')],'transferercontext':_0x33abdb['transferercontext'],'transfererexten':_0x33abdb['transfererexten'],'transfererlinkedid':_0x33abdb[_0xe8fa('0x7')],'transfereechannel':_0x33abdb[_0xe8fa('0x8')],'transfereecalleridnum':_0x33abdb[_0xe8fa('0x9')],'transfereecalleridname':_0x33abdb[_0xe8fa('0xa')],'transfereeconnectedlinenum':_0x33abdb[_0xe8fa('0xb')],'transfereeconnectedlinename':_0x33abdb[_0xe8fa('0xc')],'transfereeaccountcode':_0x33abdb[_0xe8fa('0xd')],'transfereecontext':_0x33abdb['transfereecontext'],'transfereeexten':_0x33abdb['transfereeexten'],'transfereelinkedid':_0x33abdb[_0xe8fa('0xe')],'isexternal':_0x33abdb[_0xe8fa('0xf')],'context':_0x33abdb[_0xe8fa('0x10')],'extension':_0x33abdb[_0xe8fa('0x11')],'type':_0xe8fa('0x12')},'log':_0xe8fa('0x2')});};exports[_0xe8fa('0x13')]=function(_0x36560a){return client[_0xe8fa('0x14')](_0xe8fa('0x2'),{'body':{'result':_0x36560a[_0xe8fa('0x15')],'transfererchannel':_0x36560a['origtransfererchannel'],'transferercalleridnum':_0x36560a[_0xe8fa('0x16')],'transferercalleridname':_0x36560a['origtransferercalleridname'],'transfererconnectedlinenum':_0x36560a[_0xe8fa('0x17')],'transfererconnectedlinename':_0x36560a[_0xe8fa('0x18')],'transfereraccountcode':_0x36560a[_0xe8fa('0x19')],'transferercontext':_0x36560a['secondtransferercontext'],'transfererexten':_0x36560a[_0xe8fa('0x1a')],'transfererlinkedid':_0x36560a[_0xe8fa('0x1b')],'transfereechannel':_0x36560a[_0xe8fa('0x1c')],'transfereecalleridnum':_0x36560a['transfertargetcalleridnum'],'transfereecalleridname':_0x36560a['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x36560a['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x36560a[_0xe8fa('0x1d')],'transfereeaccountcode':_0x36560a['transfertargetaccountcode'],'transfereecontext':_0x36560a['transfertargetcontext'],'transfereeexten':_0x36560a[_0xe8fa('0x1e')],'transfereelinkedid':_0x36560a[_0xe8fa('0x1f')],'isexternal':_0x36560a['isexternal'],'context':_0x36560a[_0xe8fa('0x20')],'extension':_0x36560a[_0xe8fa('0x21')],'type':_0xe8fa('0x22')},'log':_0xe8fa('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index c2caaf2..f18e19a 100644 --- a/server/services/ami/server/index.js +++ b/server/services/ami/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['type','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','telephones','trunks','run','event','Event\x20name\x20mandatory','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','moment','../properties','../ami','../model/voiceQueueSummary','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','voiceStatus','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','catch','command','Command','content','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','voicechannel','map','channels','uniqueid','channel','%s.%s','filename','wav','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','monitors','stop','queueChannels','inbound','outbound','includes'];(function(_0x20a2e2,_0xca7418){var _0x28815f=function(_0x5b2ae8){while(--_0x5b2ae8){_0x20a2e2['push'](_0x20a2e2['shift']());}};_0x28815f(++_0xca7418);}(_0xb10b,0x12a));var _0xbb10=function(_0x10a467,_0x4f75be){_0x10a467=_0x10a467-0x0;var _0x39bcbb=_0xb10b[_0x10a467];return _0x39bcbb;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var jayson=require(_0xbb10('0x1'));var schema=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var config=require('../../../config/environment');var properties=require(_0xbb10('0x4'));var ami=require(_0xbb10('0x5'));var VoiceQueueSummary=require(_0xbb10('0x6'));exports[_0xbb10('0x7')]=function(_0x49baf4,_0x312b72,_0x481979){return new Promise(function(_0x328583,_0x3cdd53){var _0x513741={'QueuePause':function(_0x1b9e94){return new Promise(function(_0x3fb675){var _0x21370f=util[_0xbb10('0x8')](_0xbb10('0x9'),_0xbb10('0xa'),_0x1b9e94[_0xbb10('0xb')]);if(_0x49baf4[_0xbb10('0xc')]&&_0x49baf4['timers'][_0x21370f]&&_0x49baf4['timers'][_0x21370f][_0xbb10('0xd')]){_0x49baf4[_0xbb10('0xc')][_0x21370f][_0xbb10('0xe')]();}if(_0x49baf4['agents'][_0x21370f]){_0x49baf4[_0xbb10('0xf')][_0x21370f]['updateStatusRealtime']({'state':_0x49baf4[_0xbb10('0xf')][_0x21370f][_0xbb10('0x10')],'statePause':_0x1b9e94[_0xbb10('0x11')]?!![]:![]});}_0x3fb675({'code':0xc8,'message':_0xbb10('0x12')});});},'Reload':function(_0x442548){var _0x147230=this;return new Promise(function(_0x58a612,_0x26e021){if(ami[_0xbb10('0x13')]()==![]){return _0x26e021(_0x147230[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}_0x442548=_[_0xbb10('0x19')](_0x442548,_[_0xbb10('0x1a')](properties['reload'][_0xbb10('0x1b')]));_0x442548[_0xbb10('0x1c')]=_0xbb10('0x1d');return ami[_0xbb10('0x1e')](_0x442548)[_0xbb10('0x1f')](function(_0x1682a4){_0x58a612({'code':0xc8,'message':_0x1682a4[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xbf2906){_0x26e021(_0x147230[_0xbb10('0x14')](0x1f5,_0xbf2906['message']));});});},'Command':function(_0x5ff0cf){var _0x19f48d=this;return new Promise(function(_0x388fab,_0x109908){if(ami[_0xbb10('0x13')]()==![]){return _0x109908(_0x19f48d[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected']['join']('\x20')));}_0x5ff0cf=_[_0xbb10('0x19')](_0x5ff0cf,_0xbb10('0x22'));_0x5ff0cf[_0xbb10('0x1c')]=_0xbb10('0x23');return ami[_0xbb10('0x1e')](_0x5ff0cf)[_0xbb10('0x1f')](function(_0x407cb4){_0x388fab({'code':0xc8,'message':_0x407cb4[_0xbb10('0x24')]});})[_0xbb10('0x21')](function(_0x395404){_0x109908(_0x19f48d[_0xbb10('0x14')](0x1f5,_0x395404[_0xbb10('0x20')]));});});},'VoiceQueues':function(){return new Promise(function(_0x537898){var _0x4fedac=[];for(var _0x4fb5e0 in _0x49baf4[_0xbb10('0x25')]){if(_0x49baf4[_0xbb10('0x25')][_0xbb10('0x26')](_0x4fb5e0)){var _0x4e25ff=_0x49baf4[_0xbb10('0x25')][_0x4fb5e0];var _0x24d586=new VoiceQueueSummary(_0x4e25ff);_0x4fedac[_0xbb10('0x27')](_0x24d586);}}_0x537898({'count':_0x4fedac[_0xbb10('0x28')],'rows':_0x4fedac});});},'UpdateVoiceQueue':function(_0x1acce9){return new Promise(function(_0x20d946,_0x2a0e8b){var _0x4aabb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x25')],{'id':parseInt(_0x1acce9['id'])});var _0xfc3595=_[_0xbb10('0x2a')](_0x1acce9,['id']);if(_0x4aabb9){for(var _0x1d30aa in _0xfc3595){if(typeof _0xfc3595[_0x1d30aa]!==_0xbb10('0x2b')&&typeof _0x4aabb9[_0x1d30aa]!=='undefined'){_0x4aabb9[_0x1d30aa]=_0xfc3595[_0x1d30aa];}}_0x20d946(_0x4aabb9);}else{_0x2a0e8b();}});},'VoiceChannels':function(){return new Promise(function(_0x221624){var _0x4ee02e=_[_0xbb10('0x2c')](_0x49baf4['channels']);_0x221624({'count':_0x4ee02e[_0xbb10('0x28')],'rows':_0x4ee02e});});},'VoiceChannelMixMonitor':function(_0x1dcc9c){var _0x1b59f9=this;return new Promise(function(_0x491db4,_0x518d47){if(ami[_0xbb10('0x13')]()==![]){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x37a83f=schema(properties[_0xbb10('0x2d')])[_0xbb10('0x2')](_0x1dcc9c);if(_0x37a83f['length']>0x0){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x37a83f,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0xfb2c5e=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x2f')],{'uniqueid':_0x1dcc9c[_0xbb10('0x30')]});if(_0xfb2c5e&&_0xfb2c5e[_0xbb10('0x31')]){var _0x56943c=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1dcc9c[_0xbb10('0x33')]||_0x1dcc9c[_0xbb10('0x30')],_0x1dcc9c['format']||_0xbb10('0x34'));return ami['Action']({'action':'MixMonitor','channel':_0xfb2c5e[_0xbb10('0x31')],'file':_0x56943c,'options':_0xbb10('0x35')})[_0xbb10('0x1f')](function(_0x120d21){var _0x15d895=_[_0xbb10('0x29')](_0xfb2c5e['monitors'],{'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')]()});if(_['isNil'](_0x15d895)){_0xfb2c5e['monitors']['push']({'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')](),'createdAt':moment()[_0xbb10('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x120d21[_0xbb10('0x38')],'status':_0xbb10('0x39')});}else{_0x15d895[_0xbb10('0x38')]=_0x120d21['mixmonitorid'];_0x15d895[_0xbb10('0x3a')]=_0xbb10('0x39');}_0x491db4({'code':0xc8,'message':[_0x1dcc9c[_0xbb10('0x30')],_0xbb10('0x3b'),_0x120d21['mixmonitorid']][_0xbb10('0x18')]('\x20'),'mixmonitorid':_0x120d21[_0xbb10('0x38')]});})['catch'](function(_0xe2040f){_0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f5,[_0x1dcc9c[_0xbb10('0x30')],_0xe2040f[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x518d47(_0x1b59f9['error'](0x1f5,_0xbb10('0x3c')));}});},'VoiceChannelStopMixMonitor':function(_0x1c7fae){var _0x3e7b4c=this;return new Promise(function(_0x3d3c41,_0x4943d9){if(ami[_0xbb10('0x13')]()==![]){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')]['username'],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x54ac18=schema(properties['voicechannel'])[_0xbb10('0x2')](_0x1c7fae);if(_0x54ac18['length']>0x0){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x54ac18,'message')[_0xbb10('0x18')](',\x20')));}var _0x1d82bf=_[_0xbb10('0x29')](_0x49baf4['channels'],{'uniqueid':_0x1c7fae[_0xbb10('0x30')]});if(_0x1d82bf){return Promise[_0xbb10('0x3d')]()[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x3e'),'channel':_0x1d82bf[_0xbb10('0x31')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})[_0xbb10('0x21')](function(){});}})[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x3f')]){return ami[_0xbb10('0x1e')]({'action':'StopMixMonitor','channel':_0x1d82bf[_0xbb10('0x3f')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})['catch'](function(){});}})[_0xbb10('0x1f')](function(){var _0x2f5027=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]});if(_0x2f5027){_0x2f5027[_0xbb10('0x3a')]=_0xbb10('0x41');}})['then'](function(){var _0x4a9793=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1c7fae[_0xbb10('0x33')]||_0x1c7fae['uniqueid'],_0x1c7fae['format']||_0xbb10('0x34'));var _0x34cf4e=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'filename':_0xbb10('0x36')+_0x4a9793[_0xbb10('0x37')]()});if(_0x34cf4e){_0x34cf4e[_0xbb10('0x3a')]=_0xbb10('0x41');}})[_0xbb10('0x1f')](function(){_0x3d3c41({'code':0xc8,'message':[_0x1c7fae[_0xbb10('0x30')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0xbb10('0x21')](function(_0x467dba){_0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,[_0x1c7fae[_0xbb10('0x30')],_0x467dba[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannels':function(_0x1214f7){var _0x19ca3e=this;return new Promise(function(_0x20e18a){var _0x61e689=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x42')]);var _0x547a7a={'count':_0x61e689[_0xbb10('0x28')],'rows':_0x61e689};if(_0x1214f7&&_0x1214f7['type']){if(![_0xbb10('0x43'),_0xbb10('0x44')][_0xbb10('0x45')](_0x1214f7[_0xbb10('0x46')])){return _0x3cdd53(_0x19ca3e[_0xbb10('0x14')](0x190,_0xbb10('0x47')));}var _0x2e3326=_[_0xbb10('0x48')](_0x61e689,function(_0x180400){return _0x180400[_0xbb10('0x46')]===_0x1214f7[_0xbb10('0x46')];});_0x547a7a[_0xbb10('0x49')]=_0x2e3326[_0xbb10('0x28')];_0x547a7a[_0xbb10('0x4a')]=_0x2e3326;}_0x20e18a(_0x547a7a);});},'VoiceQueuesChannel':function(_0x4475e1){var _0x5de0cc=this;return new Promise(function(_0x4571b6,_0x466eb7){var _0x1b83a9=schema(properties[_0xbb10('0x4b')])[_0xbb10('0x2')](_0x4475e1);if(_0x1b83a9[_0xbb10('0x28')]>0x0){return _0x466eb7(_0x5de0cc['error'](0x1f4,_[_0xbb10('0x2e')](_0x1b83a9,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x14fed3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x4475e1[_0xbb10('0x30')]});if(_0x14fed3){_0x4571b6(_0x14fed3);}else{return _0x466eb7(_0x5de0cc[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelHangup':function(_0x40c4fb){var _0x2eb05a=this;return new Promise(function(_0x2a1ce1,_0x16932f){if(ami['isConnected']()==![]){return _0x16932f(_0x2eb05a['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')]['join']('\x20')));}var _0x506498=schema(properties[_0xbb10('0x4c')])[_0xbb10('0x2')](_0x40c4fb);if(_0x506498[_0xbb10('0x28')]>0x0){return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x506498,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x4a5fb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x40c4fb['uniqueid']});if(_0x4a5fb9&&_0x4a5fb9['channel']){return ami['Action']({'action':_0xbb10('0x4d'),'channel':_0x4a5fb9[_0xbb10('0x31')]})[_0xbb10('0x1f')](function(_0x5bd1c0){_0x2a1ce1({'code':0xc8,'message':[_0x40c4fb['uniqueid'],_0x5bd1c0['message'][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0x4e9fbd){_0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,[_0x40c4fb[_0xbb10('0x30')],_0x4e9fbd['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelRedirect':function(_0x237246){var _0x54b7c5=this;return new Promise(function(_0x43eaec,_0xec48ac){if(ami[_0xbb10('0x13')]()==![]){return _0xec48ac(_0x54b7c5['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected'][_0xbb10('0x18')]('\x20')));}var _0x31e85e=schema(properties[_0xbb10('0x4e')])[_0xbb10('0x2')](_0x237246);if(_0x31e85e['length']>0x0){return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x31e85e,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x56b3a3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x237246[_0xbb10('0x30')]});if(_0x56b3a3&&_0x56b3a3[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x4f'),'channel':_0x56b3a3[_0xbb10('0x31')],'exten':_0x237246['exten'],'context':_0x237246['context']||_0x56b3a3['context'],'priority':0x1})[_0xbb10('0x1f')](function(_0x9c672d){_0x43eaec({'code':0xc8,'message':[_0x237246[_0xbb10('0x30')],_0x9c672d['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0xd9e743){_0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,[_0x237246[_0xbb10('0x30')],_0xd9e743[_0xbb10('0x20')]['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'Agents':function(_0x14f16b){return new Promise(function(_0x2aaaa6){var _0x5bfc68=_['values'](_0x49baf4['agents']);if(_0x14f16b&&_0x14f16b['id']){var _0x329da7=_[_0xbb10('0x29')](_0x5bfc68,function(_0x36917f){return _0x36917f['id']===_0x14f16b['id'];});_0x2aaaa6(_0x329da7);}else{_0x2aaaa6({'count':_0x5bfc68[_0xbb10('0x28')],'rows':_0x5bfc68});}});},'Telephones':function(){return new Promise(function(_0x2f7d2a){var _0x1d40b8=_['values'](_0x49baf4[_0xbb10('0x50')]);_0x2f7d2a({'count':_0x1d40b8['length'],'rows':_0x1d40b8});});},'Trunks':function(){return new Promise(function(_0x4fe3b5){var _0x519a54=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x51')]);_0x4fe3b5({'count':_0x519a54[_0xbb10('0x28')],'rows':_0x519a54});});},'OutboundChannels':function(){return new Promise(function(_0x108f99){var _0x5ce94f=_[_0xbb10('0x2c')](_0x49baf4['outboundChannels']);_0x108f99({'count':_0x5ce94f['length'],'rows':_0x5ce94f});});},'Outbound':function(){return new Promise(function(_0x165fe9){_0x165fe9(_0x49baf4[_0xbb10('0x44')]);});},'Campaigns':function(){return new Promise(function(_0x29529c){var _0x2bd2ab=_[_0xbb10('0x2c')](_0x49baf4['campaigns']);_0x29529c({'count':_0x2bd2ab[_0xbb10('0x28')],'rows':_0x2bd2ab});});},'VoiceQueuesPreview':function(_0x19fcec){var _0x2c6429=this;return new Promise(function(_0x3f3d38,_0x43cdb7){_0x312b72[_0xbb10('0x52')](_0x19fcec['id'])[_0xbb10('0x1f')](function(_0x53fa98){_0x3f3d38({'code':0xc8,'message':_0x53fa98[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x30f3ea){_0x43cdb7(_0x2c6429[_0xbb10('0x14')](0x1f4,_0x30f3ea[_0xbb10('0x20')]));});});},'EventManager':function(_0x172be3){var _0xa3b23=this;return new Promise(function(_0x312a08,_0x5a4429){if(!_0x172be3[_0xbb10('0x53')]){return _0x5a4429(_0xa3b23[_0xbb10('0x14')](0x1f4,_0xbb10('0x54')));}ami['emit']('custom:'+_0x172be3['event'],_0x172be3[_0xbb10('0x20')]);_0x312a08({'code':0xc8,'message':_0x172be3});});},'FaxAccounts':function(){return new Promise(function(_0x5a3c44){var _0x4e3d6a=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x55')]);_0x5a3c44({'count':_0x4e3d6a[_0xbb10('0x28')],'rows':_0x4e3d6a});});},'SendFax':function(_0x12ed63){var _0x32ec27=this;return new Promise(function(_0x24dca6,_0x33116){_0x481979[_0xbb10('0x56')](_0x12ed63)[_0xbb10('0x1f')](function(_0x5206e1){_0x24dca6({'code':0xc8,'message':_0x5206e1[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x46b6d2){_0x33116(_0x32ec27[_0xbb10('0x14')](0x1f4,_0x46b6d2['message']));});});},'CheckAfterSend':function(_0x4c0795){var _0x3547a3=this;return new Promise(function(_0x2280bd,_0x30f0a4){_0x481979[_0xbb10('0x57')](_0x4c0795)['then'](function(_0x17d596){_0x2280bd({'code':0xc8,'message':_0x17d596[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xf7b3e1){_0x30f0a4(_0x3547a3[_0xbb10('0x14')](0x1f4,_0xf7b3e1['message']));});});}};var _0x5f0691=jayson[_0xbb10('0x58')](_0x513741)[_0xbb10('0x59')]();_0x5f0691['on'](_0xbb10('0x14'),function(_0x5239da){return _0x3cdd53(_0x5239da);});_0x5f0691[_0xbb10('0x7')](0x232a,_0xbb10('0x5a'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x328583(_0xbb10('0x5b')+0x232a);});});}; \ No newline at end of file +var _0xb10b=['type','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','telephones','trunks','run','event','Event\x20name\x20mandatory','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','moment','../properties','../ami','../model/voiceQueueSummary','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','voiceStatus','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','catch','command','Command','content','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','voicechannel','map','channels','uniqueid','channel','%s.%s','filename','wav','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','monitors','stop','queueChannels','inbound','outbound','includes'];(function(_0x5a937b,_0x21e561){var _0x11718f=function(_0x50c4f4){while(--_0x50c4f4){_0x5a937b['push'](_0x5a937b['shift']());}};_0x11718f(++_0x21e561);}(_0xb10b,0x12a));var _0xbb10=function(_0x23118b,_0x562da3){_0x23118b=_0x23118b-0x0;var _0x3636cf=_0xb10b[_0x23118b];return _0x3636cf;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var jayson=require(_0xbb10('0x1'));var schema=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var config=require('../../../config/environment');var properties=require(_0xbb10('0x4'));var ami=require(_0xbb10('0x5'));var VoiceQueueSummary=require(_0xbb10('0x6'));exports[_0xbb10('0x7')]=function(_0x49baf4,_0x312b72,_0x481979){return new Promise(function(_0x328583,_0x3cdd53){var _0x513741={'QueuePause':function(_0x1b9e94){return new Promise(function(_0x3fb675){var _0x21370f=util[_0xbb10('0x8')](_0xbb10('0x9'),_0xbb10('0xa'),_0x1b9e94[_0xbb10('0xb')]);if(_0x49baf4[_0xbb10('0xc')]&&_0x49baf4['timers'][_0x21370f]&&_0x49baf4['timers'][_0x21370f][_0xbb10('0xd')]){_0x49baf4[_0xbb10('0xc')][_0x21370f][_0xbb10('0xe')]();}if(_0x49baf4['agents'][_0x21370f]){_0x49baf4[_0xbb10('0xf')][_0x21370f]['updateStatusRealtime']({'state':_0x49baf4[_0xbb10('0xf')][_0x21370f][_0xbb10('0x10')],'statePause':_0x1b9e94[_0xbb10('0x11')]?!![]:![]});}_0x3fb675({'code':0xc8,'message':_0xbb10('0x12')});});},'Reload':function(_0x442548){var _0x147230=this;return new Promise(function(_0x58a612,_0x26e021){if(ami[_0xbb10('0x13')]()==![]){return _0x26e021(_0x147230[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}_0x442548=_[_0xbb10('0x19')](_0x442548,_[_0xbb10('0x1a')](properties['reload'][_0xbb10('0x1b')]));_0x442548[_0xbb10('0x1c')]=_0xbb10('0x1d');return ami[_0xbb10('0x1e')](_0x442548)[_0xbb10('0x1f')](function(_0x1682a4){_0x58a612({'code':0xc8,'message':_0x1682a4[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xbf2906){_0x26e021(_0x147230[_0xbb10('0x14')](0x1f5,_0xbf2906['message']));});});},'Command':function(_0x5ff0cf){var _0x19f48d=this;return new Promise(function(_0x388fab,_0x109908){if(ami[_0xbb10('0x13')]()==![]){return _0x109908(_0x19f48d[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected']['join']('\x20')));}_0x5ff0cf=_[_0xbb10('0x19')](_0x5ff0cf,_0xbb10('0x22'));_0x5ff0cf[_0xbb10('0x1c')]=_0xbb10('0x23');return ami[_0xbb10('0x1e')](_0x5ff0cf)[_0xbb10('0x1f')](function(_0x407cb4){_0x388fab({'code':0xc8,'message':_0x407cb4[_0xbb10('0x24')]});})[_0xbb10('0x21')](function(_0x395404){_0x109908(_0x19f48d[_0xbb10('0x14')](0x1f5,_0x395404[_0xbb10('0x20')]));});});},'VoiceQueues':function(){return new Promise(function(_0x537898){var _0x4fedac=[];for(var _0x4fb5e0 in _0x49baf4[_0xbb10('0x25')]){if(_0x49baf4[_0xbb10('0x25')][_0xbb10('0x26')](_0x4fb5e0)){var _0x4e25ff=_0x49baf4[_0xbb10('0x25')][_0x4fb5e0];var _0x24d586=new VoiceQueueSummary(_0x4e25ff);_0x4fedac[_0xbb10('0x27')](_0x24d586);}}_0x537898({'count':_0x4fedac[_0xbb10('0x28')],'rows':_0x4fedac});});},'UpdateVoiceQueue':function(_0x1acce9){return new Promise(function(_0x20d946,_0x2a0e8b){var _0x4aabb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x25')],{'id':parseInt(_0x1acce9['id'])});var _0xfc3595=_[_0xbb10('0x2a')](_0x1acce9,['id']);if(_0x4aabb9){for(var _0x1d30aa in _0xfc3595){if(typeof _0xfc3595[_0x1d30aa]!==_0xbb10('0x2b')&&typeof _0x4aabb9[_0x1d30aa]!=='undefined'){_0x4aabb9[_0x1d30aa]=_0xfc3595[_0x1d30aa];}}_0x20d946(_0x4aabb9);}else{_0x2a0e8b();}});},'VoiceChannels':function(){return new Promise(function(_0x221624){var _0x4ee02e=_[_0xbb10('0x2c')](_0x49baf4['channels']);_0x221624({'count':_0x4ee02e[_0xbb10('0x28')],'rows':_0x4ee02e});});},'VoiceChannelMixMonitor':function(_0x1dcc9c){var _0x1b59f9=this;return new Promise(function(_0x491db4,_0x518d47){if(ami[_0xbb10('0x13')]()==![]){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x37a83f=schema(properties[_0xbb10('0x2d')])[_0xbb10('0x2')](_0x1dcc9c);if(_0x37a83f['length']>0x0){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x37a83f,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0xfb2c5e=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x2f')],{'uniqueid':_0x1dcc9c[_0xbb10('0x30')]});if(_0xfb2c5e&&_0xfb2c5e[_0xbb10('0x31')]){var _0x56943c=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1dcc9c[_0xbb10('0x33')]||_0x1dcc9c[_0xbb10('0x30')],_0x1dcc9c['format']||_0xbb10('0x34'));return ami['Action']({'action':'MixMonitor','channel':_0xfb2c5e[_0xbb10('0x31')],'file':_0x56943c,'options':_0xbb10('0x35')})[_0xbb10('0x1f')](function(_0x120d21){var _0x15d895=_[_0xbb10('0x29')](_0xfb2c5e['monitors'],{'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')]()});if(_['isNil'](_0x15d895)){_0xfb2c5e['monitors']['push']({'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')](),'createdAt':moment()[_0xbb10('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x120d21[_0xbb10('0x38')],'status':_0xbb10('0x39')});}else{_0x15d895[_0xbb10('0x38')]=_0x120d21['mixmonitorid'];_0x15d895[_0xbb10('0x3a')]=_0xbb10('0x39');}_0x491db4({'code':0xc8,'message':[_0x1dcc9c[_0xbb10('0x30')],_0xbb10('0x3b'),_0x120d21['mixmonitorid']][_0xbb10('0x18')]('\x20'),'mixmonitorid':_0x120d21[_0xbb10('0x38')]});})['catch'](function(_0xe2040f){_0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f5,[_0x1dcc9c[_0xbb10('0x30')],_0xe2040f[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x518d47(_0x1b59f9['error'](0x1f5,_0xbb10('0x3c')));}});},'VoiceChannelStopMixMonitor':function(_0x1c7fae){var _0x3e7b4c=this;return new Promise(function(_0x3d3c41,_0x4943d9){if(ami[_0xbb10('0x13')]()==![]){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')]['username'],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x54ac18=schema(properties['voicechannel'])[_0xbb10('0x2')](_0x1c7fae);if(_0x54ac18['length']>0x0){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x54ac18,'message')[_0xbb10('0x18')](',\x20')));}var _0x1d82bf=_[_0xbb10('0x29')](_0x49baf4['channels'],{'uniqueid':_0x1c7fae[_0xbb10('0x30')]});if(_0x1d82bf){return Promise[_0xbb10('0x3d')]()[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x3e'),'channel':_0x1d82bf[_0xbb10('0x31')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})[_0xbb10('0x21')](function(){});}})[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x3f')]){return ami[_0xbb10('0x1e')]({'action':'StopMixMonitor','channel':_0x1d82bf[_0xbb10('0x3f')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})['catch'](function(){});}})[_0xbb10('0x1f')](function(){var _0x2f5027=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]});if(_0x2f5027){_0x2f5027[_0xbb10('0x3a')]=_0xbb10('0x41');}})['then'](function(){var _0x4a9793=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1c7fae[_0xbb10('0x33')]||_0x1c7fae['uniqueid'],_0x1c7fae['format']||_0xbb10('0x34'));var _0x34cf4e=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'filename':_0xbb10('0x36')+_0x4a9793[_0xbb10('0x37')]()});if(_0x34cf4e){_0x34cf4e[_0xbb10('0x3a')]=_0xbb10('0x41');}})[_0xbb10('0x1f')](function(){_0x3d3c41({'code':0xc8,'message':[_0x1c7fae[_0xbb10('0x30')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0xbb10('0x21')](function(_0x467dba){_0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,[_0x1c7fae[_0xbb10('0x30')],_0x467dba[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannels':function(_0x1214f7){var _0x19ca3e=this;return new Promise(function(_0x20e18a){var _0x61e689=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x42')]);var _0x547a7a={'count':_0x61e689[_0xbb10('0x28')],'rows':_0x61e689};if(_0x1214f7&&_0x1214f7['type']){if(![_0xbb10('0x43'),_0xbb10('0x44')][_0xbb10('0x45')](_0x1214f7[_0xbb10('0x46')])){return _0x3cdd53(_0x19ca3e[_0xbb10('0x14')](0x190,_0xbb10('0x47')));}var _0x2e3326=_[_0xbb10('0x48')](_0x61e689,function(_0x180400){return _0x180400[_0xbb10('0x46')]===_0x1214f7[_0xbb10('0x46')];});_0x547a7a[_0xbb10('0x49')]=_0x2e3326[_0xbb10('0x28')];_0x547a7a[_0xbb10('0x4a')]=_0x2e3326;}_0x20e18a(_0x547a7a);});},'VoiceQueuesChannel':function(_0x4475e1){var _0x5de0cc=this;return new Promise(function(_0x4571b6,_0x466eb7){var _0x1b83a9=schema(properties[_0xbb10('0x4b')])[_0xbb10('0x2')](_0x4475e1);if(_0x1b83a9[_0xbb10('0x28')]>0x0){return _0x466eb7(_0x5de0cc['error'](0x1f4,_[_0xbb10('0x2e')](_0x1b83a9,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x14fed3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x4475e1[_0xbb10('0x30')]});if(_0x14fed3){_0x4571b6(_0x14fed3);}else{return _0x466eb7(_0x5de0cc[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelHangup':function(_0x40c4fb){var _0x2eb05a=this;return new Promise(function(_0x2a1ce1,_0x16932f){if(ami['isConnected']()==![]){return _0x16932f(_0x2eb05a['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')]['join']('\x20')));}var _0x506498=schema(properties[_0xbb10('0x4c')])[_0xbb10('0x2')](_0x40c4fb);if(_0x506498[_0xbb10('0x28')]>0x0){return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x506498,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x4a5fb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x40c4fb['uniqueid']});if(_0x4a5fb9&&_0x4a5fb9['channel']){return ami['Action']({'action':_0xbb10('0x4d'),'channel':_0x4a5fb9[_0xbb10('0x31')]})[_0xbb10('0x1f')](function(_0x5bd1c0){_0x2a1ce1({'code':0xc8,'message':[_0x40c4fb['uniqueid'],_0x5bd1c0['message'][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0x4e9fbd){_0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,[_0x40c4fb[_0xbb10('0x30')],_0x4e9fbd['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelRedirect':function(_0x237246){var _0x54b7c5=this;return new Promise(function(_0x43eaec,_0xec48ac){if(ami[_0xbb10('0x13')]()==![]){return _0xec48ac(_0x54b7c5['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected'][_0xbb10('0x18')]('\x20')));}var _0x31e85e=schema(properties[_0xbb10('0x4e')])[_0xbb10('0x2')](_0x237246);if(_0x31e85e['length']>0x0){return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x31e85e,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x56b3a3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x237246[_0xbb10('0x30')]});if(_0x56b3a3&&_0x56b3a3[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x4f'),'channel':_0x56b3a3[_0xbb10('0x31')],'exten':_0x237246['exten'],'context':_0x237246['context']||_0x56b3a3['context'],'priority':0x1})[_0xbb10('0x1f')](function(_0x9c672d){_0x43eaec({'code':0xc8,'message':[_0x237246[_0xbb10('0x30')],_0x9c672d['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0xd9e743){_0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,[_0x237246[_0xbb10('0x30')],_0xd9e743[_0xbb10('0x20')]['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'Agents':function(_0x14f16b){return new Promise(function(_0x2aaaa6){var _0x5bfc68=_['values'](_0x49baf4['agents']);if(_0x14f16b&&_0x14f16b['id']){var _0x329da7=_[_0xbb10('0x29')](_0x5bfc68,function(_0x36917f){return _0x36917f['id']===_0x14f16b['id'];});_0x2aaaa6(_0x329da7);}else{_0x2aaaa6({'count':_0x5bfc68[_0xbb10('0x28')],'rows':_0x5bfc68});}});},'Telephones':function(){return new Promise(function(_0x2f7d2a){var _0x1d40b8=_['values'](_0x49baf4[_0xbb10('0x50')]);_0x2f7d2a({'count':_0x1d40b8['length'],'rows':_0x1d40b8});});},'Trunks':function(){return new Promise(function(_0x4fe3b5){var _0x519a54=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x51')]);_0x4fe3b5({'count':_0x519a54[_0xbb10('0x28')],'rows':_0x519a54});});},'OutboundChannels':function(){return new Promise(function(_0x108f99){var _0x5ce94f=_[_0xbb10('0x2c')](_0x49baf4['outboundChannels']);_0x108f99({'count':_0x5ce94f['length'],'rows':_0x5ce94f});});},'Outbound':function(){return new Promise(function(_0x165fe9){_0x165fe9(_0x49baf4[_0xbb10('0x44')]);});},'Campaigns':function(){return new Promise(function(_0x29529c){var _0x2bd2ab=_[_0xbb10('0x2c')](_0x49baf4['campaigns']);_0x29529c({'count':_0x2bd2ab[_0xbb10('0x28')],'rows':_0x2bd2ab});});},'VoiceQueuesPreview':function(_0x19fcec){var _0x2c6429=this;return new Promise(function(_0x3f3d38,_0x43cdb7){_0x312b72[_0xbb10('0x52')](_0x19fcec['id'])[_0xbb10('0x1f')](function(_0x53fa98){_0x3f3d38({'code':0xc8,'message':_0x53fa98[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x30f3ea){_0x43cdb7(_0x2c6429[_0xbb10('0x14')](0x1f4,_0x30f3ea[_0xbb10('0x20')]));});});},'EventManager':function(_0x172be3){var _0xa3b23=this;return new Promise(function(_0x312a08,_0x5a4429){if(!_0x172be3[_0xbb10('0x53')]){return _0x5a4429(_0xa3b23[_0xbb10('0x14')](0x1f4,_0xbb10('0x54')));}ami['emit']('custom:'+_0x172be3['event'],_0x172be3[_0xbb10('0x20')]);_0x312a08({'code':0xc8,'message':_0x172be3});});},'FaxAccounts':function(){return new Promise(function(_0x5a3c44){var _0x4e3d6a=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x55')]);_0x5a3c44({'count':_0x4e3d6a[_0xbb10('0x28')],'rows':_0x4e3d6a});});},'SendFax':function(_0x12ed63){var _0x32ec27=this;return new Promise(function(_0x24dca6,_0x33116){_0x481979[_0xbb10('0x56')](_0x12ed63)[_0xbb10('0x1f')](function(_0x5206e1){_0x24dca6({'code':0xc8,'message':_0x5206e1[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x46b6d2){_0x33116(_0x32ec27[_0xbb10('0x14')](0x1f4,_0x46b6d2['message']));});});},'CheckAfterSend':function(_0x4c0795){var _0x3547a3=this;return new Promise(function(_0x2280bd,_0x30f0a4){_0x481979[_0xbb10('0x57')](_0x4c0795)['then'](function(_0x17d596){_0x2280bd({'code':0xc8,'message':_0x17d596[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xf7b3e1){_0x30f0a4(_0x3547a3[_0xbb10('0x14')](0x1f4,_0xf7b3e1['message']));});});}};var _0x5f0691=jayson[_0xbb10('0x58')](_0x513741)[_0xbb10('0x59')]();_0x5f0691['on'](_0xbb10('0x14'),function(_0x5239da){return _0x3cdd53(_0x5239da);});_0x5f0691[_0xbb10('0x7')](0x232a,_0xbb10('0x5a'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x328583(_0xbb10('0x5b')+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index c3e3b68..c81cf6d 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 _0x4bab=['[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridnum','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','user:%s','name','format','trigger:%s','action','toLowerCase','merge','length','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','localhost','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','exec','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','phone','routeId','destcalleridnum','firstName','lastName','mobile','fax','createdAt','scheduledAt','updatedAt','union','resolve','then','getContacts','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]'];(function(_0x2bea7a,_0x1fae70){var _0x1006f5=function(_0x5615bc){while(--_0x5615bc){_0x2bea7a['push'](_0x2bea7a['shift']());}};_0x1006f5(++_0x1fae70);}(_0x4bab,0xc8));var _0xb4ba=function(_0x4723d7,_0x191951){_0x4723d7=_0x4723d7-0x0;var _0x83298d=_0x4bab[_0x4723d7];return _0x83298d;};'use strict';var _=require('lodash');var BPromise=require(_0xb4ba('0x0'));var Redis=require(_0xb4ba('0x1'));var util=require(_0xb4ba('0x2'));var config=require(_0xb4ba('0x3'));var logger=require(_0xb4ba('0x4'))(_0xb4ba('0x5'));var cmContactRpc=require(_0xb4ba('0x6'));config[_0xb4ba('0x7')]=_['defaults'](config[_0xb4ba('0x7')],{'host':_0xb4ba('0x8'),'port':0x18eb});var io=require(_0xb4ba('0x9'))(new Redis(config['redis']));function emit(_0xdc04d7,_0x3c25ae,_0x5bba20,_0x4cfc52,_0x5d7245){logger[_0xb4ba('0xa')](_0xb4ba('0xb'),_0xdc04d7,_0x3c25ae['id'],_0x5bba20,_0x4cfc52,JSON[_0xb4ba('0xc')](_0x5d7245));io['to'](_0x5bba20)[_0xb4ba('0xd')](_0x4cfc52,_0x5d7245);}exports[_0xb4ba('0xe')]=function(_0x513b31,_0x910fd3,_0x36fa84,_0xf0f982){var _0x1cf8fa,_0x7310b5;var _0x1e3f82={};var _0x54776a;var _0x3fc089=Number(_0x36fa84[_0xb4ba('0xf')]);var _0x5ccd64=_0x36fa84[_0xb4ba('0x10')]?Boolean(Number(_0x36fa84[_0xb4ba('0x10')])):![];var _0x195359;var _0x1b5206=![];if(!_[_0xb4ba('0x11')](_0x36fa84[_0xb4ba('0x12')])){if(_0x36fa84[_0xb4ba('0x12')]=='1')_0x1b5206=!![];}if(!_0x1b5206){if(_0xf0f982[_0xb4ba('0x13')]){_0x1e3f82['id']=_0xf0f982[_0xb4ba('0x13')];}}if(!_0x1e3f82['id']){_0x1e3f82[_0xb4ba('0x14')]=_0x3fc089;_0x195359=_0x36fa84['data3']&&_0x36fa84[_0xb4ba('0x15')]!=='0'?_0x36fa84['data3'][_0xb4ba('0x16')](','):[_0xb4ba('0x17')];_0x1e3f82['$or']=_['map'](_0x195359,function(_0x52038d){var _0x17b9ae={};_0x17b9ae[_0x52038d]=_0xf0f982[_0xb4ba('0x18')]?_0xf0f982[_0xb4ba('0x19')]:_0xf0f982['calleridnum'];return _0x17b9ae;});_0x54776a=_0xf0f982[_0xb4ba('0x18')]?_0xf0f982[_0xb4ba('0x19')]:_0xf0f982['calleridnum'];}var _0x241bf8=['id',_0xb4ba('0x1a'),_0xb4ba('0x1b'),'phone',_0xb4ba('0x1c'),_0xb4ba('0x1d'),_0xb4ba('0x14'),_0xb4ba('0x1e'),_0xb4ba('0x1f'),_0xb4ba('0x20')];var _0x61c157=_[_0xb4ba('0x21')](_0x241bf8,_0x195359);BPromise[_0xb4ba('0x22')]()[_0xb4ba('0x23')](cmContactRpc[_0xb4ba('0x24')]({'attributes':_0x61c157,'where':_0x1e3f82,'phone':_0x54776a}))[_0xb4ba('0x23')](function(_0x141cb6){_0x7310b5=_0x141cb6;if(!_['isEmpty'](_0x7310b5)){if(_0x7310b5['length']===0x1){_0x1cf8fa=_0x7310b5[0x0];logger['info'](_0xb4ba('0x25'),_0xf0f982[_0xb4ba('0x26')],_0x910fd3['id'],_0x1cf8fa['id']);}else{logger['info'](_0xb4ba('0x27'),_0xf0f982[_0xb4ba('0x26')],_0x910fd3['id'],_['map'](_0x7310b5,'id')['join'](','));}return;}else{logger[_0xb4ba('0xa')](_0xb4ba('0x28'),_0xf0f982['uniqueid'],_0x910fd3['id']);var _0x224ace={'ListId':_0x3fc089};var _0x1ab9bc=_0x36fa84[_0xb4ba('0x29')]&&_0x36fa84[_0xb4ba('0x29')]!=='0'?_0x36fa84['data4']:'phone';if(_0x5ccd64){logger[_0xb4ba('0xa')](_0xb4ba('0x2a'),_0xf0f982[_0xb4ba('0x26')],_0x910fd3['id']);_0x224ace[_0x1ab9bc]=_[_0xb4ba('0x11')](_0xf0f982[_0xb4ba('0x18')])?_0xf0f982[_0xb4ba('0x2b')]:_0xf0f982[_0xb4ba('0x19')];if(_[_0xb4ba('0x11')](_0xf0f982[_0xb4ba('0x18')])){_0x224ace['firstName']=_0xf0f982[_0xb4ba('0x2c')]&&_0xf0f982['calleridname']!==_0xb4ba('0x2d')?_0xf0f982['calleridname']:_0xb4ba('0x2e');}else{_0x224ace[_0xb4ba('0x1a')]=_0xf0f982['destcalleridname']&&_0xf0f982[_0xb4ba('0x2f')]!==''?_0xf0f982[_0xb4ba('0x2f')]:_0xb4ba('0x2e');}return BPromise['resolve']()['then'](cmContactRpc[_0xb4ba('0x30')](_0x224ace))[_0xb4ba('0x23')](function(_0x2414c3){_0x1cf8fa=_0x2414c3;_0x7310b5[_0xb4ba('0x31')](_0x2414c3);if(_0x1cf8fa){logger['info'](_0xb4ba('0x32'),_0xf0f982[_0xb4ba('0x26')],_0x910fd3['id'],_0x1cf8fa['id']);}return;});}else{logger[_0xb4ba('0xa')](_0xb4ba('0x33'),_0xf0f982[_0xb4ba('0x26')],_0x910fd3['id']);_0x224ace[_0x1ab9bc]=_[_0xb4ba('0x11')](_0xf0f982[_0xb4ba('0x18')])?_0xf0f982[_0xb4ba('0x2b')]:_0xf0f982[_0xb4ba('0x19')];if(_[_0xb4ba('0x11')](_0xf0f982[_0xb4ba('0x18')])){_0x224ace[_0xb4ba('0x1a')]=_0xf0f982[_0xb4ba('0x2c')]&&_0xf0f982[_0xb4ba('0x2c')]!==_0xb4ba('0x2d')?_0xf0f982['calleridname']:_0xb4ba('0x2e');}else{_0x224ace[_0xb4ba('0x1a')]=_0xf0f982[_0xb4ba('0x2f')]&&_0xf0f982[_0xb4ba('0x2f')]!==_0xb4ba('0x2d')?_0xf0f982[_0xb4ba('0x2f')]:'Unknown';}_0x1cf8fa=_0x224ace;_0x7310b5['push'](_0x224ace);return;}}})[_0xb4ba('0x23')](function(){if(_0x513b31){emit(_0xf0f982['uniqueid'],_0x910fd3,util['format'](_0xb4ba('0x34'),_0x513b31[_0xb4ba('0x35')]),util[_0xb4ba('0x36')](_0xb4ba('0x37'),_0x36fa84[_0xb4ba('0x38')][_0xb4ba('0x39')]()),{'evt':_[_0xb4ba('0x3a')](_0xf0f982,{'autoCreate':_0x5ccd64}),'contact':_0x1cf8fa===undefined?{}:_0x1cf8fa,'contacts':_0x7310b5[_0xb4ba('0x3b')]===0x0?undefined:_0x7310b5});}});}; \ No newline at end of file +var _0x1507=['localhost','[CM][%s][%s]','stringify','emit','exec','data1','data2','isNil','data5','xmd-contactid','ListId','data3','phone','$or','map','routeId','destcalleridnum','calleridnum','firstName','fax','createdAt','scheduledAt','updatedAt','union','getContacts','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','info','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','','Unknown','destcalleridname','resolve','then','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','name','trigger:%s','action','merge','lodash','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis'];(function(_0x134158,_0x31322c){var _0x23cda6=function(_0x9d0c71){while(--_0x9d0c71){_0x134158['push'](_0x134158['shift']());}};_0x23cda6(++_0x31322c);}(_0x1507,0x1bf));var _0x7150=function(_0x12723c,_0x148a5a){_0x12723c=_0x12723c-0x0;var _0x3fc804=_0x1507[_0x12723c];return _0x3fc804;};'use strict';var _=require(_0x7150('0x0'));var BPromise=require(_0x7150('0x1'));var Redis=require(_0x7150('0x2'));var util=require(_0x7150('0x3'));var config=require(_0x7150('0x4'));var logger=require(_0x7150('0x5'))(_0x7150('0x6'));var cmContactRpc=require(_0x7150('0x7'));config['redis']=_['defaults'](config[_0x7150('0x8')],{'host':_0x7150('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x4781d6,_0x5e0b48,_0x5e1fa2,_0x30422b,_0x4c5b4f){logger['info'](_0x7150('0xa'),_0x4781d6,_0x5e0b48['id'],_0x5e1fa2,_0x30422b,JSON[_0x7150('0xb')](_0x4c5b4f));io['to'](_0x5e1fa2)[_0x7150('0xc')](_0x30422b,_0x4c5b4f);}exports[_0x7150('0xd')]=function(_0x31d2af,_0x505ccc,_0x4dcdce,_0x1db048){var _0x4bcc11,_0x5e67ad;var _0x442f1a={};var _0x5e410c;var _0x33334c=Number(_0x4dcdce[_0x7150('0xe')]);var _0x21870a=_0x4dcdce[_0x7150('0xf')]?Boolean(Number(_0x4dcdce[_0x7150('0xf')])):![];var _0x947a22;var _0x58a4e5=![];if(!_[_0x7150('0x10')](_0x4dcdce[_0x7150('0x11')])){if(_0x4dcdce[_0x7150('0x11')]=='1')_0x58a4e5=!![];}if(!_0x58a4e5){if(_0x1db048['xmd-contactid']){_0x442f1a['id']=_0x1db048[_0x7150('0x12')];}}if(!_0x442f1a['id']){_0x442f1a[_0x7150('0x13')]=_0x33334c;_0x947a22=_0x4dcdce[_0x7150('0x14')]&&_0x4dcdce['data3']!=='0'?_0x4dcdce[_0x7150('0x14')]['split'](','):[_0x7150('0x15')];_0x442f1a[_0x7150('0x16')]=_[_0x7150('0x17')](_0x947a22,function(_0x3a4ac8){var _0x2367e8={};_0x2367e8[_0x3a4ac8]=_0x1db048[_0x7150('0x18')]?_0x1db048[_0x7150('0x19')]:_0x1db048[_0x7150('0x1a')];return _0x2367e8;});_0x5e410c=_0x1db048['routeId']?_0x1db048[_0x7150('0x19')]:_0x1db048['calleridnum'];}var _0x1284b6=['id',_0x7150('0x1b'),'lastName',_0x7150('0x15'),'mobile',_0x7150('0x1c'),'ListId',_0x7150('0x1d'),_0x7150('0x1e'),_0x7150('0x1f')];var _0x4dcf0f=_[_0x7150('0x20')](_0x1284b6,_0x947a22);BPromise['resolve']()['then'](cmContactRpc[_0x7150('0x21')]({'attributes':_0x4dcf0f,'where':_0x442f1a,'phone':_0x5e410c}))['then'](function(_0x485b05){_0x5e67ad=_0x485b05;if(!_['isEmpty'](_0x5e67ad)){if(_0x5e67ad[_0x7150('0x22')]===0x1){_0x4bcc11=_0x5e67ad[0x0];logger['info'](_0x7150('0x23'),_0x1db048[_0x7150('0x24')],_0x505ccc['id'],_0x4bcc11['id']);}else{logger[_0x7150('0x25')](_0x7150('0x26'),_0x1db048[_0x7150('0x24')],_0x505ccc['id'],_[_0x7150('0x17')](_0x5e67ad,'id')[_0x7150('0x27')](','));}return;}else{logger['info']('[CM][%s][%s]\x20Contact\x20not\x20found',_0x1db048[_0x7150('0x24')],_0x505ccc['id']);var _0x423483={'ListId':_0x33334c};var _0x49ed5=_0x4dcdce[_0x7150('0x28')]&&_0x4dcdce['data4']!=='0'?_0x4dcdce[_0x7150('0x28')]:'phone';if(_0x21870a){logger[_0x7150('0x25')](_0x7150('0x29'),_0x1db048['uniqueid'],_0x505ccc['id']);_0x423483[_0x49ed5]=_[_0x7150('0x10')](_0x1db048['routeId'])?_0x1db048[_0x7150('0x1a')]:_0x1db048[_0x7150('0x19')];if(_[_0x7150('0x10')](_0x1db048[_0x7150('0x18')])){_0x423483[_0x7150('0x1b')]=_0x1db048[_0x7150('0x2a')]&&_0x1db048['calleridname']!==_0x7150('0x2b')?_0x1db048['calleridname']:_0x7150('0x2c');}else{_0x423483[_0x7150('0x1b')]=_0x1db048[_0x7150('0x2d')]&&_0x1db048[_0x7150('0x2d')]!==_0x7150('0x2b')?_0x1db048['destcalleridname']:_0x7150('0x2c');}return BPromise[_0x7150('0x2e')]()[_0x7150('0x2f')](cmContactRpc[_0x7150('0x30')](_0x423483))[_0x7150('0x2f')](function(_0x394eff){_0x4bcc11=_0x394eff;_0x5e67ad[_0x7150('0x31')](_0x394eff);if(_0x4bcc11){logger[_0x7150('0x25')](_0x7150('0x32'),_0x1db048[_0x7150('0x24')],_0x505ccc['id'],_0x4bcc11['id']);}return;});}else{logger[_0x7150('0x25')](_0x7150('0x33'),_0x1db048['uniqueid'],_0x505ccc['id']);_0x423483[_0x49ed5]=_[_0x7150('0x10')](_0x1db048[_0x7150('0x18')])?_0x1db048['calleridnum']:_0x1db048['destcalleridnum'];if(_[_0x7150('0x10')](_0x1db048[_0x7150('0x18')])){_0x423483[_0x7150('0x1b')]=_0x1db048['calleridname']&&_0x1db048[_0x7150('0x2a')]!==_0x7150('0x2b')?_0x1db048[_0x7150('0x2a')]:_0x7150('0x2c');}else{_0x423483['firstName']=_0x1db048[_0x7150('0x2d')]&&_0x1db048[_0x7150('0x2d')]!==''?_0x1db048['destcalleridname']:_0x7150('0x2c');}_0x4bcc11=_0x423483;_0x5e67ad['push'](_0x423483);return;}}})[_0x7150('0x2f')](function(){if(_0x31d2af){emit(_0x1db048[_0x7150('0x24')],_0x505ccc,util[_0x7150('0x34')]('user:%s',_0x31d2af[_0x7150('0x35')]),util[_0x7150('0x34')](_0x7150('0x36'),_0x4dcdce[_0x7150('0x37')]['toLowerCase']()),{'evt':_[_0x7150('0x38')](_0x1db048,{'autoCreate':_0x21870a}),'contact':_0x4bcc11===undefined?{}:_0x4bcc11,'contacts':_0x5e67ad[_0x7150('0x22')]===0x0?undefined:_0x5e67ad});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 3804ce0..64f9775 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 _0xa35c=['custom:agentconnect','bind','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentbusy','custom:agentreject','custom:amd','custom:queuecallerabandon','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:substatus','custom:incomingmessage','custom:acceptmessage','custom:rejectmessage','prototype','clone','motionChannel','undefined','voice','inspect','checkTriggers','agents','interface','hasOwnProperty','status','checkTrigger','merge','Actions','action','toLowerCase','motionbar','data1','TemplateId','data2','html','render','template\x20not\x20found','uri','buildUri','isNil','data3','data4','location','uriLocation','windowWidth','data5','windowHeight','data6','winApplication','format','name','trigger:%s:%s','jscripty','user:%s','trigger:%s','emit','contactmanager','exec','integration','queue','routeId','urlforward','script','parse','search','channel','AllConditions','length','every','AnyConditions','some','checkConditions','debug','evt','account','chat','operator','value','AccountId','upperFirst','interaction','message','event','agent','membername','mailSubstatus','null','substatus','created','equals','exports','lodash','url','mustache','ioredis','./urlforward','./cmContact','./script','../../../config/environment','../../../config/logger','trigger','../ami','redis','localhost','socket.io-emitter','popup','winapp','triggers','voiceQueues','templates','voiceExtensions','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','accounts','freshdeskAccounts','dynamics365Accounts','freshsalesAccounts','custom:agentcalled','syncCustomEvent'];(function(_0x37577b,_0x1092b0){var _0x3943ce=function(_0x1d33aa){while(--_0x1d33aa){_0x37577b['push'](_0x37577b['shift']());}};_0x3943ce(++_0x1092b0);}(_0xa35c,0xe1));var _0xca35=function(_0xd3835e,_0x496f4e){_0xd3835e=_0xd3835e-0x0;var _0x467791=_0xa35c[_0xd3835e];return _0x467791;};'use strict';var util=require('util');var _=require(_0xca35('0x0'));var url=require(_0xca35('0x1'));var Mustache=require(_0xca35('0x2'));var Redis=require(_0xca35('0x3'));var urlforward=require(_0xca35('0x4'));var integration=require('./integration');var cmContact=require(_0xca35('0x5'));var script=require(_0xca35('0x6'));var config=require(_0xca35('0x7'));var logger=require(_0xca35('0x8'))(_0xca35('0x9'));var ami=require(_0xca35('0xa'));config[_0xca35('0xb')]=_['defaults'](config[_0xca35('0xb')],{'host':_0xca35('0xc'),'port':0x18eb});var io=require(_0xca35('0xd'))(new Redis(config[_0xca35('0xb')]));var operators={'equals':function(_0x3078f6,_0x21f904){return _0x3078f6==_0x21f904;},'not_equals':function(_0x54d59e,_0x1afcc0){return _0x54d59e!=_0x1afcc0;}};var barAndWebActions=[_0xca35('0xe'),'url',_0xca35('0xf')];function Trigger(_0x3ab051){this[_0xca35('0x10')]=_0x3ab051[_0xca35('0x10')];this['agents']=_0x3ab051['agents'];this['voiceQueues']=_0x3ab051[_0xca35('0x11')];this[_0xca35('0x12')]=_0x3ab051[_0xca35('0x12')];this[_0xca35('0x13')]=_0x3ab051['voiceExtensions'];this[_0xca35('0x14')]=_0x3ab051['zendeskAccounts'];this['freshdeskAccounts']=_0x3ab051['freshdeskAccounts'];this[_0xca35('0x15')]=_0x3ab051['salesforceAccounts'];this[_0xca35('0x16')]=_0x3ab051[_0xca35('0x16')];this[_0xca35('0x17')]=_0x3ab051[_0xca35('0x17')];this['deskAccounts']=_0x3ab051[_0xca35('0x18')];this['vtigerAccounts']=_0x3ab051[_0xca35('0x19')];this[_0xca35('0x1a')]=_0x3ab051['servicenowAccounts'];this['dynamics365Accounts']=_0x3ab051['dynamics365Accounts'];this['freshsalesAccounts']=_0x3ab051['freshsalesAccounts'];this[_0xca35('0x1b')]={'zendesk':this[_0xca35('0x14')],'salesforce':this[_0xca35('0x15')],'freshdesk':this[_0xca35('0x1c')],'sugarcrm':this[_0xca35('0x16')],'zoho':this[_0xca35('0x17')],'desk':this['deskAccounts'],'vtiger':this[_0xca35('0x19')],'dynamics365':this[_0xca35('0x1d')],'freshsales':this[_0xca35('0x1e')],'servicenow':this[_0xca35('0x1a')]};ami['on'](_0xca35('0x1f'),this[_0xca35('0x20')]['bind'](this));ami['on'](_0xca35('0x21'),this['syncCustomEvent'][_0xca35('0x22')](this));ami['on'](_0xca35('0x23'),this[_0xca35('0x20')]['bind'](this));ami['on'](_0xca35('0x24'),this[_0xca35('0x20')][_0xca35('0x22')](this));ami['on'](_0xca35('0x25'),this[_0xca35('0x20')][_0xca35('0x22')](this));ami['on']('custom:agentnoanswer',this[_0xca35('0x20')]['bind'](this));ami['on'](_0xca35('0x26'),this['syncCustomEvent'][_0xca35('0x22')](this));ami['on']('custom:agentcongestion',this[_0xca35('0x20')][_0xca35('0x22')](this));ami['on'](_0xca35('0x27'),this[_0xca35('0x20')][_0xca35('0x22')](this));ami['on'](_0xca35('0x28'),this[_0xca35('0x20')][_0xca35('0x22')](this));ami['on'](_0xca35('0x29'),this['syncCustomEvent'][_0xca35('0x22')](this));ami['on']('custom:timeout',this[_0xca35('0x20')][_0xca35('0x22')](this));ami['on'](_0xca35('0x2a'),this[_0xca35('0x2b')][_0xca35('0x22')](this));ami['on'](_0xca35('0x2c'),this['syncAgentDial'][_0xca35('0x22')](this));ami['on'](_0xca35('0x2d'),this['syncAgentDial']['bind'](this));ami['on'](_0xca35('0x2e'),this[_0xca35('0x20')]['bind'](this));ami['on'](_0xca35('0x2f'),this[_0xca35('0x20')][_0xca35('0x22')](this));ami['on'](_0xca35('0x30'),this[_0xca35('0x20')]['bind'](this));ami['on'](_0xca35('0x31'),this['syncCustomEvent'][_0xca35('0x22')](this));ami['on']('custom:outgoingmessage',this['syncCustomEvent']['bind'](this));ami['on'](_0xca35('0x32'),this[_0xca35('0x20')][_0xca35('0x22')](this));ami['on'](_0xca35('0x33'),this[_0xca35('0x20')]['bind'](this));ami['on']('custom:offlineMessage',this[_0xca35('0x20')][_0xca35('0x22')](this));}Trigger[_0xca35('0x34')]['emit']=function(_0x163cdc,_0x4911bb,_0x3c47fc){logger['info'](_0x163cdc,_0x4911bb,JSON['stringify'](_0x3c47fc));io['to'](_0x163cdc)['emit'](_0x4911bb,_0x3c47fc);};Trigger[_0xca35('0x34')]['syncCustomEvent']=function(_0x57b815){var _0x425e55=_[_0xca35('0x35')](_0x57b815);if(typeof _0x425e55[_0xca35('0x36')]===_0xca35('0x37')){_0x425e55[_0xca35('0x36')]=_0xca35('0x38');}logger['debug']('syncCustomEvent',util[_0xca35('0x39')](_0x425e55,{'showHidden':!![],'depth':null}));this[_0xca35('0x3a')](_0x425e55);};Trigger[_0xca35('0x34')][_0xca35('0x2b')]=function(_0x3895f6){if(this[_0xca35('0x3b')][_0x3895f6[_0xca35('0x3c')]]){this['syncCustomEvent'](_0x3895f6);}};Trigger[_0xca35('0x34')]['checkTriggers']=function(_0x2866d8){var _0x261fc7;for(var _0x36cc97 in this[_0xca35('0x10')]){if(this[_0xca35('0x10')][_0xca35('0x3d')](_0x36cc97)){if(this[_0xca35('0x10')][_0x36cc97][_0xca35('0x3e')]){_0x261fc7=this[_0xca35('0x3f')](this[_0xca35('0x10')][_0x36cc97],_0x2866d8);if(_0x261fc7){_[_0xca35('0x40')](_0x2866d8,_0x2866d8['variables']);for(var _0x2b3b9b=0x0,_0x3821c3,_0x494e62,_0x2bb487;_0x2b3b9b0x0){_0x328a08=_[_0xb814('0x2c')](_0x5a6291,_0x271aa8);}return _0x328a08;}function getCustomFields(_0x37d24d,_0x530744){var _0x499f22=[];var _0x20577b={'custom_fields':{}};if(_0x37d24d[_0xb814('0x2d')]>0x0){_['forEach'](_0x37d24d,function(_0x338a28){if(_['includes']([_0xb814('0x2e'),'picklist'],_0x338a28['type'])&&_0x338a28[_0xb814('0x2f')]&&!_0x338a28['customField']){_0x20577b[_0x338a28[_0xb814('0x2f')][_0xb814('0x30')]()]=_0x338a28[_0xb814('0x31')]['toString']();}else if(_['includes']([_0xb814('0x2e'),_0xb814('0x32')],_0x338a28['type'])&&_0x338a28[_0xb814('0x33')]&&_0x338a28[_0xb814('0x34')]){_0x20577b[_0xb814('0x35')][_0x338a28[_0xb814('0x33')]]=_0x338a28[_0xb814('0x31')][_0xb814('0x23')]();}else if(_0x338a28[_0xb814('0x36')]==='variable'&&_0x338a28[_0xb814('0x37')]&&_0x338a28[_0xb814('0x33')]&&_0x338a28[_0xb814('0x34')]){_0x530744[_0x338a28[_0xb814('0x37')]]&&(_0x20577b[_0xb814('0x35')][_0x338a28['idField']]=_0x530744[_0x338a28[_0xb814('0x37')]]['toString']());}else if(_0x338a28[_0xb814('0x36')]===_0xb814('0x38')&&_0x338a28[_0xb814('0x39')]&&_0x338a28['Variable'][_0xb814('0x3a')]&&_0x338a28[_0xb814('0x33')]&&_0x338a28['customField']){_0x530744[_0x338a28[_0xb814('0x39')][_0xb814('0x3a')][_0xb814('0x30')]()]&&(_0x20577b[_0xb814('0x35')][_0x338a28[_0xb814('0x33')]]=_0x530744[_0x338a28[_0xb814('0x39')]['name'][_0xb814('0x30')]()]['toString']());}});}if(_0x20577b[_0xb814('0x3b')]){_0x20577b['priority']=Number(_0x20577b[_0xb814('0x3b')]);}return _0x20577b;}function getTicket(_0x4b9233,_0x2f8a2e,_0x26675a,_0x54a7fb,_0x4d308a){logger['info']('Creating\x20new\x20ticket...');var _0x17549e=_[_0xb814('0x3c')]({'subject':intUtil[_0xb814('0x3d')](_0x54a7fb[_0xb814('0x3e')],_0x4d308a,'\x20'),'type':'phone','status':'new','labels':[_0xb814('0x3f'),'Motion',_0xb814('0x40')][_0xb814('0x41')](getTags(_0x54a7fb[_0xb814('0x42')],_0xb814('0x3a'))),'description':intUtil[_0xb814('0x3d')](_0x54a7fb[_0xb814('0x43')],_0x4d308a,'\x0a'),'_links':{'assigned_user':{'href':util[_0xb814('0x10')](_0xb814('0x44'),_0x2f8a2e['id']),'class':_0xb814('0x45')}},'message':{'direction':'in','body':intUtil['getString'](_0x54a7fb['Descriptions'],_0x4d308a,'\x0a')}},getCustomFields(_0x54a7fb['Fields'],_0x4d308a));return request({'uri':util[_0xb814('0x10')]('%s/customers/%d/cases',_0x4b9233[_0xb814('0x1a')],_0x26675a['id']),'method':'POST','body':_0x17549e});}exports[_0xb814('0x46')]=function(_0x44ff56,_0x9ef639,_0x2e97cc,_0x4fae23,_0x30fc57,_0x15f01a){var _0x2b23c7,_0x22cf27;_0x15f01a[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x15f01a['remoteUri']);_0x15f01a[_0xb814('0x48')]=intUtil[_0xb814('0x47')](_0x15f01a[_0xb814('0x48')]);if(_0x30fc57&&_0x30fc57[_0xb814('0x49')]){logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x4b'));_0x9ef639['recordingURL']=util['format'](_0xb814('0x4c'),_0x15f01a[_0xb814('0x48')],_0x9ef639[_0xb814('0x4d')],md5(_0x9ef639[_0xb814('0x4d')]));}else{_0x9ef639[_0xb814('0x4e')]='';}headers[_0xb814('0x4f')]=getAuth(_0x15f01a);return getUser(_0x15f01a,_0x4fae23[_0xb814('0x50')])[_0xb814('0x12')](function(_0x2eb9b6){_0x2b23c7=_0x2eb9b6;logger[_0xb814('0xe')](_0xb814('0x51'),_0x2b23c7['id']);return getEndUser(_0x15f01a,_0x9ef639['calleridname'],_0x9ef639[_0xb814('0x52')]);})[_0xb814('0x12')](function(_0x4a76bb){_0x22cf27=_0x4a76bb;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x22cf27['id']);return getTicket(_0x15f01a,_0x2b23c7,_0x22cf27,_0x2e97cc,_0x9ef639);})[_0xb814('0x12')](function(_0x37866f){if(_0x37866f){logger[_0xb814('0xe')](_0xb814('0x53'));logger[_0xb814('0xe')](_0xb814('0x54'),_0x37866f['id']);switch(_0x15f01a[_0xb814('0x36')]){case _0xb814('0x55'):logger[_0xb814('0xe')](_0xb814('0x4a'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0xb814('0x56'),_0x4fae23[_0xb814('0x3a')]),_0xb814('0x57'),{'recordId':_0x37866f['id']});break;case _0xb814('0x58'):logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x59'));emit(util['format'](_0xb814('0x56'),_0x4fae23[_0xb814('0x3a')]),_0xb814('0x5a'),{'uri':util['format'](_0xb814('0x5b'),_0x37866f['id'])});break;default:logger['error'](_0xb814('0x4a'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb814('0x5c')](function(_0x3cf8f8){console['error'](_0x3cf8f8);logger[_0xb814('0x5d')](_0xb814('0x4a'),JSON[_0xb814('0x5e')](_0x3cf8f8));});};exports['outbound']=function(_0x3da050,_0x5f0e58,_0x13bdcf,_0x158893,_0x4aed78,_0x39952d,_0x4a3f84){var _0x539be7,_0x3b9709;_0x39952d[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x39952d['remoteUri']);_0x39952d[_0xb814('0x48')]=intUtil['stripTrailingSlash'](_0x39952d[_0xb814('0x48')]);if(_0x4a3f84&&_0x4a3f84[_0xb814('0x5f')]&&_0x4a3f84['recordingFormat']!==_0xb814('0x60')){logger['info'](_0xb814('0x61'),_0xb814('0x4b'));_0x5f0e58[_0xb814('0x4e')]=util[_0xb814('0x10')](_0xb814('0x4c'),_0x39952d[_0xb814('0x48')],_0x5f0e58[_0xb814('0x4d')],md5(_0x5f0e58[_0xb814('0x4d')]));}headers['Authorization']=getAuth(_0x39952d);return getUser(_0x39952d,_0x158893[_0xb814('0x50')])[_0xb814('0x12')](function(_0x5d71d5){_0x539be7=_0x5d71d5;logger[_0xb814('0xe')](_0xb814('0x51'),_0x539be7['id']);return getEndUser(_0x39952d,_0x5f0e58['destcalleridname'],_0x5f0e58[_0xb814('0x62')]);})['then'](function(_0x48362c){_0x3b9709=_0x48362c;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x3b9709['id']);return getTicket(_0x39952d,_0x539be7,_0x3b9709,_0x13bdcf,_0x5f0e58);})[_0xb814('0x12')](function(_0xd1cd8b){if(_0xd1cd8b){logger[_0xb814('0xe')]('Ticket\x20created!');logger[_0xb814('0xe')]('The\x20Ticket\x20ID\x20is:',_0xd1cd8b['id']);switch(_0x39952d[_0xb814('0x36')]){case _0xb814('0x55'):logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x63'));emit(util[_0xb814('0x10')](_0xb814('0x56'),_0x158893[_0xb814('0x3a')]),_0xb814('0x57'),{'recordId':_0xd1cd8b['id']});break;case'newTab':logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x59'));emit(util[_0xb814('0x10')](_0xb814('0x56'),_0x158893[_0xb814('0x3a')]),'trigger:browser:url',{'uri':util[_0xb814('0x10')]('%s/agent/tickets/%s',_0x39952d[_0xb814('0x1a')],_0xd1cd8b['id'])});break;default:logger[_0xb814('0x5d')](_0xb814('0x61'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb814('0x5c')](function(_0x579351){logger[_0xb814('0x5d')]('[OUTBOUND]',JSON[_0xb814('0x5e')](_0x579351));});};exports[_0xb814('0x64')]=function(_0xa03cd2,_0x1b024f,_0x3377d4,_0x167d82,_0x143518,_0x4d44e3){var _0x44088d,_0x51ca51;_0x4d44e3[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x4d44e3[_0xb814('0x1a')]);_0x4d44e3[_0xb814('0x48')]=intUtil[_0xb814('0x47')](_0x4d44e3[_0xb814('0x48')]);if(_0x143518&&_0x143518['monitor_format']){logger[_0xb814('0xe')]('['+_0x1b024f[_0xb814('0x65')]['toUpperCase']()+']',_0xb814('0x4b'));_0x1b024f[_0xb814('0x4e')]=util[_0xb814('0x10')](_0xb814('0x4c'),_0x4d44e3[_0xb814('0x48')],_0x1b024f['uniqueid'],md5(_0x1b024f[_0xb814('0x4d')]));}else{_0x1b024f['recordingURL']='';}headers[_0xb814('0x4f')]=getAuth(_0x4d44e3);return getUser(_0x4d44e3)[_0xb814('0x12')](function(_0x2645f6){_0x44088d=_0x2645f6;logger[_0xb814('0xe')](_0xb814('0x51'),_0x44088d['id']);return getEndUser(_0x4d44e3,_0x1b024f[_0xb814('0x66')],_0x1b024f['calleridnum']);})['then'](function(_0x5d064b){_0x51ca51=_0x5d064b;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x51ca51['id']);return getTicket(_0x4d44e3,_0x44088d,_0x51ca51,_0x3377d4,_0x1b024f);})[_0xb814('0x12')](function(_0x1d3954){if(_0x1d3954){logger[_0xb814('0xe')]('Ticket\x20created!');logger[_0xb814('0xe')](_0xb814('0x54'),_0x1d3954['id']);}})[_0xb814('0x5c')](function(_0x5aabbe){logger[_0xb814('0x5d')]('['+_0x1b024f[_0xb814('0x65')][_0xb814('0x67')]()+']',JSON[_0xb814('0x5e')](_0x5aabbe));});}; \ No newline at end of file +var _0xe14b=['CTI','concat','Tags','Descriptions','/api/v2/users/%d','user','%s/customers/%d/cases','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','Desk\x20account\x20type\x20not\x20recognized','recordingFormat','none','[OUTBOUND]','Authorization','destcalleridname','destcalleridnum','integrationTab','newTab','catch','unmanaged','lastevent','toUpperCase','calleridname','lodash','request-promise','ioredis','./util','../../../../config/logger','defaults','redis','localhost','socket.io-emitter','application/json','validateEmail','format','%s/users','then','total_entries','find','_embedded','entries','info','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/users/me','debug','[HTTP]','stringify','GET','authType','basic','%s:%s','username','password','token','%s/token:%s','Basic\x20%s','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','%s/customers','remoteUri','POST','length','map','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','toString','idField','variableName','custom_fields','Variable','name','priority','Creating\x20new\x20ticket...','merge','getString','Subjects','phone','new','xCALLY'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe14b,0x93));var _0xbe14=function(_0x4f9afb,_0x14e21b){_0x4f9afb=_0x4f9afb-0x0;var _0x6dcdaf=_0xe14b[_0x4f9afb];return _0x6dcdaf;};'use strict';var _=require(_0xbe14('0x0'));var rp=require(_0xbe14('0x1'));var md5=require('md5');var util=require('util');var Redis=require(_0xbe14('0x2'));var intUtil=require(_0xbe14('0x3'));var config=require('../../../../config/environment');var logger=require(_0xbe14('0x4'))('desk');config['redis']=_[_0xbe14('0x5')](config[_0xbe14('0x6')],{'host':_0xbe14('0x7'),'port':0x18eb});var io=require(_0xbe14('0x8'))(new Redis(config[_0xbe14('0x6')]));function emit(_0x39387e,_0x196fca,_0x566ae7){io['to'](_0x39387e)['emit'](_0x196fca,_0x566ae7);}var headers={'Content-Type':'application/json','Accept':_0xbe14('0x9')};function getUser(_0x6fceff,_0xd68cd7){if(intUtil[_0xbe14('0xa')](_0xd68cd7)===!![]){logger['info']('Getting\x20agent\x20with\x20email',_0xd68cd7);return request({'uri':util[_0xbe14('0xb')](_0xbe14('0xc'),_0x6fceff['remoteUri'])})[_0xbe14('0xd')](function(_0x35aa19){if(_0x35aa19[_0xbe14('0xe')]){return _[_0xbe14('0xf')](_0x35aa19[_0xbe14('0x10')][_0xbe14('0x11')],{'email':_0xd68cd7});}})[_0xbe14('0xd')](function(_0x2850cb){if(_0x2850cb){logger[_0xbe14('0x12')](_0xbe14('0x13'));return _0x2850cb;}else{logger[_0xbe14('0x12')](_0xbe14('0x14'));return request({'uri':util[_0xbe14('0xb')]('%s/users/me',_0x6fceff['remoteUri'])});}});}else{logger[_0xbe14('0x12')](_0xbe14('0x15'));return request({'uri':util[_0xbe14('0xb')](_0xbe14('0x16'),_0x6fceff['remoteUri'])});}}function request(_0x21c789){logger[_0xbe14('0x17')](_0xbe14('0x18'),JSON[_0xbe14('0x19')](_0x21c789));return rp(_[_0xbe14('0x5')](_0x21c789,{'method':_0xbe14('0x1a'),'headers':headers,'json':!![]}));}function getAuth(_0x17ae86){var _0x5ea1f8;if(_0x17ae86[_0xbe14('0x1b')]===_0xbe14('0x1c')){_0x5ea1f8=util[_0xbe14('0xb')](_0xbe14('0x1d'),_0x17ae86[_0xbe14('0x1e')],_0x17ae86[_0xbe14('0x1f')]);}else if(_0x17ae86['authType']===_0xbe14('0x20')){_0x5ea1f8=util[_0xbe14('0xb')](_0xbe14('0x21'),_0x17ae86[_0xbe14('0x1e')],_0x17ae86[_0xbe14('0x20')]);}return util['format'](_0xbe14('0x22'),new Buffer(_0x5ea1f8)['toString'](_0xbe14('0x23')));}function getEndUser(_0x56e80c,_0x32e8eb,_0x4a25fa){logger[_0xbe14('0x12')](_0xbe14('0x24'),_0x4a25fa);return request({'uri':util['format'](_0xbe14('0x25'),_0x56e80c['remoteUri']),'qs':{'phone':_0x4a25fa}})[_0xbe14('0xd')](function(_0x4851f8){if(_0x4851f8[_0xbe14('0xe')]){logger[_0xbe14('0x12')](_0xbe14('0x26'));return _0x4851f8[_0xbe14('0x10')][_0xbe14('0x11')][0x0];}else{logger[_0xbe14('0x12')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xbe14('0xb')](_0xbe14('0x27'),_0x56e80c[_0xbe14('0x28')]),'method':_0xbe14('0x29'),'body':{'first_name':_0x32e8eb,'title':_0x32e8eb,'phone_numbers':[{'type':'work','value':_0x4a25fa}]}});}});}function getTags(_0x16f884,_0x29fc64){var _0x59bf34=[];if(_0x16f884&&_0x16f884[_0xbe14('0x2a')]>0x0){_0x59bf34=_[_0xbe14('0x2b')](_0x16f884,_0x29fc64);}return _0x59bf34;}function getCustomFields(_0x1c7cc7,_0x19252f){var _0x34d648=[];var _0x36d4b2={'custom_fields':{}};if(_0x1c7cc7[_0xbe14('0x2a')]>0x0){_[_0xbe14('0x2c')](_0x1c7cc7,function(_0x4168c8){if(_[_0xbe14('0x2d')]([_0xbe14('0x2e'),_0xbe14('0x2f')],_0x4168c8[_0xbe14('0x30')])&&_0x4168c8[_0xbe14('0x31')]&&!_0x4168c8[_0xbe14('0x32')]){_0x36d4b2[_0x4168c8[_0xbe14('0x31')][_0xbe14('0x33')]()]=_0x4168c8[_0xbe14('0x34')][_0xbe14('0x35')]();}else if(_[_0xbe14('0x2d')](['string',_0xbe14('0x2f')],_0x4168c8['type'])&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x36d4b2['custom_fields'][_0x4168c8[_0xbe14('0x36')]]=_0x4168c8[_0xbe14('0x34')]['toString']();}else if(_0x4168c8['type']==='variable'&&_0x4168c8[_0xbe14('0x37')]&&_0x4168c8[_0xbe14('0x36')]&&_0x4168c8['customField']){_0x19252f[_0x4168c8[_0xbe14('0x37')]]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x37')]][_0xbe14('0x35')]());}else if(_0x4168c8['type']==='customVariable'&&_0x4168c8[_0xbe14('0x39')]&&_0x4168c8['Variable']['name']&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()][_0xbe14('0x35')]());}});}if(_0x36d4b2[_0xbe14('0x3b')]){_0x36d4b2[_0xbe14('0x3b')]=Number(_0x36d4b2['priority']);}return _0x36d4b2;}function getTicket(_0x4f51f8,_0x43cdaa,_0x2951e1,_0x13bfcf,_0x520e09){logger[_0xbe14('0x12')](_0xbe14('0x3c'));var _0xeda70e=_[_0xbe14('0x3d')]({'subject':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x3f')],_0x520e09,'\x20'),'type':_0xbe14('0x40'),'status':_0xbe14('0x41'),'labels':[_0xbe14('0x42'),'Motion',_0xbe14('0x43')][_0xbe14('0x44')](getTags(_0x13bfcf[_0xbe14('0x45')],_0xbe14('0x3a'))),'description':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0xbe14('0x47'),_0x43cdaa['id']),'class':_0xbe14('0x48')}},'message':{'direction':'in','body':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a')}},getCustomFields(_0x13bfcf['Fields'],_0x520e09));return request({'uri':util['format'](_0xbe14('0x49'),_0x4f51f8[_0xbe14('0x28')],_0x2951e1['id']),'method':_0xbe14('0x29'),'body':_0xeda70e});}exports['queue']=function(_0x5d5318,_0x6b6aa8,_0x59ae4d,_0x5657fe,_0x3593f8,_0x1f0355){var _0x8216c3,_0x5051e4;_0x1f0355['remoteUri']=intUtil['stripTrailingSlash'](_0x1f0355[_0xbe14('0x28')]);_0x1f0355[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x1f0355['serverUrl']);if(_0x3593f8&&_0x3593f8[_0xbe14('0x4c')]){logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x4e'));_0x6b6aa8['recordingURL']=util['format'](_0xbe14('0x4f'),_0x1f0355[_0xbe14('0x4a')],_0x6b6aa8[_0xbe14('0x50')],md5(_0x6b6aa8[_0xbe14('0x50')]));}else{_0x6b6aa8[_0xbe14('0x51')]='';}headers['Authorization']=getAuth(_0x1f0355);return getUser(_0x1f0355,_0x5657fe['email'])[_0xbe14('0xd')](function(_0x2a3623){_0x8216c3=_0x2a3623;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x8216c3['id']);return getEndUser(_0x1f0355,_0x6b6aa8['calleridname'],_0x6b6aa8[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x53e8ab){_0x5051e4=_0x53e8ab;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x5051e4['id']);return getTicket(_0x1f0355,_0x8216c3,_0x5051e4,_0x59ae4d,_0x6b6aa8);})[_0xbe14('0xd')](function(_0x36c20c){if(_0x36c20c){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x36c20c['id']);switch(_0x1f0355['type']){case'integrationTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x36c20c['id']});break;case'newTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe['name']),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')](_0xbe14('0x5b'),_0x36c20c['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x4d'),_0xbe14('0x5d'));}}})['catch'](function(_0x5aeea9){console[_0xbe14('0x5c')](_0x5aeea9);logger[_0xbe14('0x5c')](_0xbe14('0x4d'),JSON['stringify'](_0x5aeea9));});};exports['outbound']=function(_0x44fe0d,_0x134878,_0x50d78f,_0x339a86,_0x32496a,_0x50c2a0,_0x28f995){var _0x4a40d2,_0x41ba58;_0x50c2a0[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['remoteUri']);_0x50c2a0[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['serverUrl']);if(_0x28f995&&_0x28f995[_0xbe14('0x5e')]&&_0x28f995[_0xbe14('0x5e')]!==_0xbe14('0x5f')){logger[_0xbe14('0x12')](_0xbe14('0x60'),'Recording\x20is\x20enabled!');_0x134878[_0xbe14('0x51')]=util[_0xbe14('0xb')](_0xbe14('0x4f'),_0x50c2a0[_0xbe14('0x4a')],_0x134878[_0xbe14('0x50')],md5(_0x134878[_0xbe14('0x50')]));}headers[_0xbe14('0x61')]=getAuth(_0x50c2a0);return getUser(_0x50c2a0,_0x339a86['email'])[_0xbe14('0xd')](function(_0x1b47a4){_0x4a40d2=_0x1b47a4;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x4a40d2['id']);return getEndUser(_0x50c2a0,_0x134878[_0xbe14('0x62')],_0x134878[_0xbe14('0x63')]);})[_0xbe14('0xd')](function(_0x32df3c){_0x41ba58=_0x32df3c;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x41ba58['id']);return getTicket(_0x50c2a0,_0x4a40d2,_0x41ba58,_0x50d78f,_0x134878);})[_0xbe14('0xd')](function(_0x4bccfc){if(_0x4bccfc){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x4bccfc['id']);switch(_0x50c2a0[_0xbe14('0x30')]){case _0xbe14('0x64'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x4bccfc['id']});break;case _0xbe14('0x65'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')]('%s/agent/tickets/%s',_0x50c2a0[_0xbe14('0x28')],_0x4bccfc['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x60'),_0xbe14('0x5d'));}}})[_0xbe14('0x66')](function(_0x222944){logger[_0xbe14('0x5c')](_0xbe14('0x60'),JSON[_0xbe14('0x19')](_0x222944));});};exports[_0xbe14('0x67')]=function(_0x5917d5,_0x18be56,_0x442ec4,_0x2d4dd4,_0xfd32a3,_0x3ac6d8){var _0x5a1ea6,_0x42b341;_0x3ac6d8[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x3ac6d8[_0xbe14('0x28')]);_0x3ac6d8[_0xbe14('0x4a')]=intUtil['stripTrailingSlash'](_0x3ac6d8[_0xbe14('0x4a')]);if(_0xfd32a3&&_0xfd32a3[_0xbe14('0x4c')]){logger[_0xbe14('0x12')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',_0xbe14('0x4e'));_0x18be56[_0xbe14('0x51')]=util[_0xbe14('0xb')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3ac6d8[_0xbe14('0x4a')],_0x18be56[_0xbe14('0x50')],md5(_0x18be56[_0xbe14('0x50')]));}else{_0x18be56[_0xbe14('0x51')]='';}headers[_0xbe14('0x61')]=getAuth(_0x3ac6d8);return getUser(_0x3ac6d8)[_0xbe14('0xd')](function(_0x445302){_0x5a1ea6=_0x445302;logger['info']('The\x20User\x20ID\x20is:',_0x5a1ea6['id']);return getEndUser(_0x3ac6d8,_0x18be56[_0xbe14('0x6a')],_0x18be56[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x2510a0){_0x42b341=_0x2510a0;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x42b341['id']);return getTicket(_0x3ac6d8,_0x5a1ea6,_0x42b341,_0x442ec4,_0x18be56);})[_0xbe14('0xd')](function(_0x43511e){if(_0x43511e){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x43511e['id']);}})[_0xbe14('0x66')](function(_0x57729f){logger[_0xbe14('0x5c')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',JSON[_0xbe14('0x19')](_0x57729f));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index b29b02d..54eb138 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 _0xb806=['lodash','request-promise','md5','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','modernAuthentication','remoteUri','data7','data2','CloudProvider','data5','POST','clientId','password','clientSecret','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','isdisabled',']\x20Agent\x20found\x20','systemuserid','userId','info',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','toLowerCase','/systemusers(','body','headers','odata-entityid','substring','lastIndexOf','outbound','destcalleridnum','telephone1','&$filter=','replace','%2b','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing','enduserId','string','picklist','nameField','customField','idField','indexOf','content','ticketType','incidents','assign','Subjects','getString','/contacts(','Fields','queue','callDirection','phonecalls','calleridnum','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration'];(function(_0x48da45,_0x259bea){var _0x5d5687=function(_0x2d0a0f){while(--_0x2d0a0f){_0x48da45['push'](_0x48da45['shift']());}};_0x5d5687(++_0x259bea);}(_0xb806,0x1a8));var _0x6b80=function(_0x119d5a,_0x19b457){_0x119d5a=_0x119d5a-0x0;var _0x15bff4=_0xb806[_0x119d5a];return _0x15bff4;};'use strict';var _=require(_0x6b80('0x0'));var rp=require(_0x6b80('0x1'));var util=require('util');var intUtil=require('./util');var md5=require(_0x6b80('0x2'));var Redis=require('ioredis');var logger=require('../../../../config/logger')(_0x6b80('0x3'));var config=require(_0x6b80('0x4'));config[_0x6b80('0x5')]=_[_0x6b80('0x6')](config['redis'],{'host':_0x6b80('0x7'),'port':0x18eb});var io=require(_0x6b80('0x8'))(new Redis(config['redis']));function getAuthToken(_0x11ba64,_0x285f48,_0xb0b926){if(_0x11ba64[_0x6b80('0x9')]){_0x11ba64[_0x6b80('0xa')]=_0x11ba64['CloudProvider'][_0x6b80('0xb')];_0x11ba64['tenantId']=_0x11ba64['CloudProvider'][_0x6b80('0xc')];return Promise['resolve'](_0x11ba64[_0x6b80('0xd')][_0x6b80('0xe')]);}var _0x3290d0={'method':_0x6b80('0xf'),'uri':_0x285f48,'form':{'client_id':_0x11ba64[_0x6b80('0x10')],'resource':_0x11ba64[_0x6b80('0xa')],'username':_0x11ba64['username'],'password':_0x11ba64[_0x6b80('0x11')],'grant_type':'password','client_secret':_0x11ba64[_0x6b80('0x12')]},'json':!![]};return rp(_0x3290d0)[_0x6b80('0x13')](function(_0x3be51d){return _0x3be51d[_0x6b80('0x14')];})[_0x6b80('0x15')](function(_0x36ea63){logger[_0x6b80('0x16')]('['+[_0xb0b926[_0x6b80('0x17')]()]+_0x6b80('0x18'));return _0x36ea63[_0x6b80('0x19')];});}function getUser(_0x1f3658,_0x48a91c,_0x42e46a,_0x3f3faf,_0x52f7e1,_0x216dce){return new Promise(function(_0x1f58e0,_0x80611f){return getAuthToken(_0x48a91c,_0x3f3faf,_0x216dce)[_0x6b80('0x13')](function(_0x4ce11c){var _0x22f2de={'method':_0x6b80('0x1a'),'uri':_0x52f7e1+_0x6b80('0x1b'),'headers':{'Authorization':_0x6b80('0x1c')+_0x4ce11c,'OData-Version':_0x6b80('0x1d')},'json':!![]};return rp(_0x22f2de);})[_0x6b80('0x13')](function(_0x1db21d){var _0x54ea6b=_0x1db21d[_0x6b80('0x1e')];var _0xd66ec5=![];var _0x213a58=null;if(!_[_0x6b80('0x1f')](_0x42e46a)){if(intUtil[_0x6b80('0x20')](_0x42e46a[_0x6b80('0x21')])){_0x1f3658[_0x6b80('0x22')]=_0x42e46a[_0x6b80('0x21')];for(_0x213a58=0x0;_0x213a58<_0x54ea6b[_0x6b80('0x23')];_0x213a58++){if(_0x54ea6b[_0x213a58][_0x6b80('0x24')]===_0x42e46a[_0x6b80('0x21')]&&!_0x54ea6b[_0x213a58][_0x6b80('0x25')]){_0xd66ec5=!![];logger['info']('['+[_0x216dce[_0x6b80('0x17')]()]+_0x6b80('0x26')+_0x54ea6b[_0x213a58][_0x6b80('0x27')]+'!');_0x1f3658[_0x6b80('0x28')]=_0x54ea6b[_0x213a58][_0x6b80('0x27')];}}}}if(!_0xd66ec5){logger[_0x6b80('0x29')]('['+[_0x216dce[_0x6b80('0x17')]()]+_0x6b80('0x2a'));_0x1f3658[_0x6b80('0x22')]=_0x48a91c['username'];for(_0x213a58=0x0;_0x213a58<_0x54ea6b[_0x6b80('0x23')];_0x213a58++){if(_0x54ea6b[_0x213a58][_0x6b80('0x24')]===_0x48a91c['username']){_0x1f3658[_0x6b80('0x28')]=_0x54ea6b[_0x213a58][_0x6b80('0x27')];}}}_0x1f58e0(_0x1f3658);})[_0x6b80('0x15')](function(_0x167003){_0x80611f(_0x167003[_0x6b80('0x19')]);});});}function createEndUser(_0x32f893,_0x4bbc80,_0x733e4b,_0x399cb5,_0x3a617d,_0x4ae0b8,_0x2212ca){return new Promise(function(_0x3aee33,_0x1de06f){return getAuthToken(_0x4bbc80,_0x733e4b,_0x4ae0b8)['then'](function(_0x49f2dc){var _0x25021d=_0x4ae0b8[_0x6b80('0x2b')]()==='outbound'?_0x3a617d['destcalleridnum']:_0x3a617d['calleridnum'];var _0x30be92={'method':_0x6b80('0xf'),'uri':_0x399cb5+'contacts','body':{'fullname':_0x25021d,'firstname':_0x25021d,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x6b80('0x2c')+_0x32f893[_0x6b80('0x28')]+')'},'headers':{'Authorization':_0x6b80('0x1c')+_0x49f2dc,'OData-Version':_0x6b80('0x1d')},'json':!![],'resolveWithFullResponse':!![]};_0x30be92[_0x6b80('0x2d')][_0x2212ca]=_0x25021d;return rp(_0x30be92);})[_0x6b80('0x13')](function(_0x272057){var _0x1f367f=_0x272057[_0x6b80('0x2e')][_0x6b80('0x2f')];var _0x23055d=_0x1f367f[_0x6b80('0x30')](_0x1f367f[_0x6b80('0x31')]('(')+0x1,_0x1f367f['lastIndexOf'](')'));_0x32f893['enduserId']=_0x23055d;_0x3aee33(_0x32f893);})[_0x6b80('0x15')](function(_0x3f72cb){_0x1de06f(_0x3f72cb[_0x6b80('0x19')]);});});}function getEndUser(_0x4a3732,_0x12b290,_0x2eaa6a,_0x230ba9,_0x4364ba,_0x5c03e6,_0x50cd7a,_0x16f6d1){var _0x4f51d6=_0x5c03e6['toLowerCase']()===_0x6b80('0x32')?_0x4364ba[_0x6b80('0x33')]:_0x4364ba['calleridnum'];return getAuthToken(_0x12b290,_0x2eaa6a,_0x5c03e6)[_0x6b80('0x13')](function(_0xa512de){_0x16f6d1=_0x16f6d1?_0x16f6d1:_0x6b80('0x34');var _0x5065df={'method':_0x6b80('0x1a'),'uri':_0x230ba9+'contacts?$select='+_0x16f6d1+_0x6b80('0x35')+_0x16f6d1+'\x20eq\x20\x27'+_0x4f51d6[_0x6b80('0x36')]('+',_0x6b80('0x37'))+'\x27','headers':{'Authorization':'Bearer\x20'+_0xa512de,'If-None-Match':null,'OData-Version':_0x6b80('0x1d')},'json':!![]};return rp(_0x5065df);})['then'](function(_0x5b67cd){var _0xe68d7c=![];if(!_0x5b67cd)return _0xe68d7c;var _0x4421ec=_0x5b67cd['value'];for(var _0x233f47=0x0;_0x233f47<_0x4421ec[_0x6b80('0x23')];_0x233f47++){if(_0x4421ec[_0x233f47][_0x16f6d1]===_0x4f51d6){_0xe68d7c=!![];_0x4a3732['enduserId']=_0x4421ec[_0x233f47]['contactid'];}}return _0xe68d7c;})['then'](function(_0x16754c){if(_0x16754c)return _0x4a3732;if(_0x50cd7a===_0x6b80('0x38')){logger[_0x6b80('0x29')]('['+[_0x5c03e6[_0x6b80('0x17')]()]+_0x6b80('0x39'));return _0x4a3732;}return createEndUser(_0x4a3732,_0x12b290,_0x2eaa6a,_0x230ba9,_0x4364ba,_0x5c03e6,_0x16f6d1)['then'](function(_0x5bb2fe){logger[_0x6b80('0x29')]('['+[_0x5c03e6['toUpperCase']()]+']\x20Enduser\x20created!',_0x5bb2fe[_0x6b80('0x3a')]);return _0x5bb2fe;});});}function getCustomFields(_0x501d28,_0x1cad00,_0x4c8ac9){var _0x581e29={};if(_0x501d28['length']>0x0){_['forEach'](_0x501d28,function(_0x20fd3e){if(_['includes']([_0x6b80('0x3b'),_0x6b80('0x3c')],_0x20fd3e['type'])&&_0x20fd3e[_0x6b80('0x3d')]&&!_0x20fd3e[_0x6b80('0x3e')]){var _0x1fe28b=_0x20fd3e[_0x6b80('0x3f')][_0x6b80('0x2b')]();var _0x437583=_0x1fe28b[_0x6b80('0x30')](0x0,_0x1fe28b[_0x6b80('0x40')]('_'));var _0xce8721=_0x1fe28b[_0x6b80('0x30')](_0x1fe28b[_0x6b80('0x40')]('_')+0x1);if(_0x437583===_0x4c8ac9){_0x581e29[_0xce8721]=_0x20fd3e[_0x6b80('0x41')];}}});}return _0x581e29;}function getTicket(_0x526cc8,_0x47584e,_0x372c52,_0x20eafc,_0xed8dc,_0x1a6df1,_0x483e7d){return new Promise(function(_0xb8c324,_0x22b276){var _0x5bde97;return getAuthToken(_0x47584e,_0x372c52,_0x483e7d)[_0x6b80('0x13')](function(_0x385ebb){if(_0x1a6df1[_0x6b80('0x42')]==='incident'){_0x5bde97={'method':_0x6b80('0xf'),'uri':_0x20eafc+_0x6b80('0x43'),'body':Object[_0x6b80('0x44')]({},{'title':intUtil['getString'](_0x1a6df1[_0x6b80('0x45')],_0xed8dc,'\x20'),'description':intUtil[_0x6b80('0x46')](_0x1a6df1['Descriptions'],_0xed8dc,'\x0a'),'customerid_contact@odata.bind':_0x526cc8[_0x6b80('0x3a')]?_0x6b80('0x47')+_0x526cc8[_0x6b80('0x3a')]+')':undefined,'ownerid@odata.bind':_0x6b80('0x2c')+_0x526cc8[_0x6b80('0x28')]+')','caseorigincode':'1'},getCustomFields(_0x1a6df1[_0x6b80('0x48')],_0xed8dc,_0x1a6df1[_0x6b80('0x42')])),'headers':{'Authorization':'Bearer\x20'+_0x385ebb,'OData-Version':_0x6b80('0x1d')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x1a6df1[_0x6b80('0x42')]==='phonecall'){var _0xd1fb53=_0x526cc8[_0x6b80('0x3a')]?[{'partyid_systemuser@odata.bind':_0x6b80('0x2c')+_0x526cc8[_0x6b80('0x28')]+')','participationtypemask':_0x526cc8['callDirection']===_0x6b80('0x49')?0x2:0x1},{'partyid_contact@odata.bind':_0x6b80('0x47')+_0x526cc8[_0x6b80('0x3a')]+')','participationtypemask':_0x526cc8[_0x6b80('0x4a')]===_0x6b80('0x49')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0x526cc8[_0x6b80('0x28')]+')','participationtypemask':_0x526cc8[_0x6b80('0x4a')]===_0x6b80('0x49')?0x2:0x1}];_0x5bde97={'method':_0x6b80('0xf'),'uri':_0x20eafc+_0x6b80('0x4b'),'body':Object[_0x6b80('0x44')]({},{'subject':intUtil['getString'](_0x1a6df1[_0x6b80('0x45')],_0xed8dc,'\x20'),'phonenumber':String(_0xed8dc[_0x6b80('0x4c')]),'description':intUtil[_0x6b80('0x46')](_0x1a6df1['Descriptions'],_0xed8dc,'\x0a'),'regardingobjectid_contact@odata.bind':_0x526cc8[_0x6b80('0x3a')]?_0x6b80('0x47')+_0x526cc8['enduserId']+')':undefined,'ownerid@odata.bind':_0x6b80('0x2c')+_0x526cc8[_0x6b80('0x28')]+')','directioncode':_0x526cc8[_0x6b80('0x4a')]===_0x6b80('0x49')?![]:!![],'phonecall_activity_parties':_0xd1fb53},getCustomFields(_0x1a6df1['Fields'],_0xed8dc,_0x1a6df1[_0x6b80('0x42')])),'headers':{'Authorization':_0x6b80('0x1c')+_0x385ebb,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x5bde97);})[_0x6b80('0x13')](function(_0x2b2579){var _0x5c919e=_0x2b2579[_0x6b80('0x2e')]['odata-entityid'];var _0x232d59=_0x5c919e[_0x6b80('0x30')](_0x5c919e['lastIndexOf']('(')+0x1,_0x5c919e[_0x6b80('0x31')](')'));_0x526cc8[_0x6b80('0x4d')]=_0x232d59;_0xb8c324(_0x526cc8);})[_0x6b80('0x15')](function(_0x42648){_0x22b276(_0x42648[_0x6b80('0x19')]);});});}function emit(_0xe7e083,_0x39865e,_0x5df14c,_0x4e5be0){var _0x5f479c={'uri':util[_0x6b80('0x4e')](_0x6b80('0x4f'),_0xe7e083,_0x5df14c,_0x4e5be0)};io['to'](util[_0x6b80('0x4e')](_0x6b80('0x50'),_0x39865e))[_0x6b80('0x51')](_0x6b80('0x52'),_0x5f479c);}exports['cs']=function(_0x23d5e3,_0x19dd99,_0xd24484,_0x1d7abb,_0x2d18be,_0x5e0987,_0x4f4bbf,_0x284b5e){var _0x533509={};_0x5e0987['remoteUri']=_0x5e0987['modernAuthentication']?intUtil[_0x6b80('0x53')](_0x5e0987[_0x6b80('0xd')][_0x6b80('0xb')]):intUtil['stripTrailingSlash'](_0x5e0987[_0x6b80('0xa')]);_0x5e0987[_0x6b80('0x54')]=intUtil[_0x6b80('0x53')](_0x5e0987[_0x6b80('0x54')]);_0x533509['callDirection']=_0x284b5e===_0x6b80('0x49')||_0x284b5e===_0x6b80('0x55')?_0x6b80('0x49'):_0x6b80('0x32');var _0x5d4b52=_0x5e0987['modernAuthentication']?util['format'](_0x6b80('0x56'),_0x5e0987['CloudProvider'][_0x6b80('0xb')]):util[_0x6b80('0x4e')](_0x6b80('0x56'),_0x5e0987[_0x6b80('0xa')]);var _0x251d1a=util[_0x6b80('0x4e')](_0x6b80('0x57'),_0x5e0987[_0x6b80('0x58')]);var _0x5a8711=util[_0x6b80('0x4e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5e0987[_0x6b80('0x54')],_0x19dd99['uniqueid'],md5(_0x19dd99[_0x6b80('0x59')]));if(_0x2d18be&&_0x2d18be['monitor_format']){logger[_0x6b80('0x29')](_0x6b80('0x5a'),_0x6b80('0x5b'));_0x19dd99[_0x6b80('0x5c')]=_0x5a8711;}else if(_0x4f4bbf&&_0x4f4bbf[_0x6b80('0x5d')]&&_0x4f4bbf['recordingFormat']!=='none'){logger[_0x6b80('0x29')](_0x6b80('0x5e'),_0x6b80('0x5b'));_0x19dd99[_0x6b80('0x5c')]=_0x5a8711;}else{_0x19dd99[_0x6b80('0x5c')]='';}return getUser(_0x533509,_0x5e0987,_0x1d7abb,_0x251d1a,_0x5d4b52,_0x284b5e)['then'](function(_0x3cf7c7){logger[_0x6b80('0x29')]('['+_0x284b5e[_0x6b80('0x17')]()+_0x6b80('0x5f'),_0x3cf7c7[_0x6b80('0x28')]);logger[_0x6b80('0x29')]('['+_0x284b5e[_0x6b80('0x17')]()+_0x6b80('0x60'),_0x3cf7c7[_0x6b80('0x22')]);return getEndUser(_0x3cf7c7,_0x5e0987,_0x251d1a,_0x5d4b52,_0x19dd99,_0x284b5e,_0xd24484[_0x6b80('0x61')],_0xd24484[_0x6b80('0x62')]);})[_0x6b80('0x13')](function(_0x34e4c3){logger[_0x6b80('0x29')]('['+_0x284b5e['toUpperCase']()+_0x6b80('0x63'),_0x34e4c3[_0x6b80('0x3a')]);logger['info']('['+_0x284b5e[_0x6b80('0x17')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x19dd99['calleridnum']);return getTicket(_0x34e4c3,_0x5e0987,_0x251d1a,_0x5d4b52,_0x19dd99,_0xd24484,_0x284b5e);})[_0x6b80('0x13')](function(_0x133770){logger[_0x6b80('0x29')](util[_0x6b80('0x4e')]('['+_0x284b5e[_0x6b80('0x17')]()+_0x6b80('0x64'),_0xd24484[_0x6b80('0x42')],_0x133770[_0x6b80('0x4d')]));logger['info'](util[_0x6b80('0x4e')]('['+_0x284b5e[_0x6b80('0x17')]()+_0x6b80('0x65'),_0x284b5e));if(_0x284b5e!=='unmanaged'&&_0xd24484[_0x6b80('0x66')]){logger[_0x6b80('0x29')]('['+_0x284b5e[_0x6b80('0x17')]()+']',_0x6b80('0x67'));emit(_0x5e0987[_0x6b80('0xa')],_0x1d7abb['name'],_0xd24484[_0x6b80('0x42')],_0x133770['ticketId']);}})[_0x6b80('0x15')](function(_0x2d0277){logger[_0x6b80('0x16')]('['+_0x284b5e['toUpperCase']()+_0x6b80('0x68'),_0x2d0277['message']);console[_0x6b80('0x16')](_0x6b80('0x69'),_0x2d0277);});}; \ No newline at end of file +var _0x949e=['ticketType','incident','incidents','getString','Subjects','Fields','phonecall','callDirection','queue','/contacts(','phonecalls','assign','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','trigger:browser:url','stripTrailingSlash','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','ticketId',']\x20Call\x20direction:\x20%s','Error\x20running\x20Dynamics365\x20integration','lodash','util','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','data7','tenantId','resolve','data5','POST','clientId','username','password','clientSecret','then','access_token','error',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','userEmail','email','length','info','toUpperCase',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','/systemusers(','headers','odata-entityid','substring','lastIndexOf','enduserId','catch','contacts?$select=','&$filter=','\x20eq\x20\x27','replace','%2b','contactid','nothing',']\x20Enduser\x20created!','forEach','string','picklist','type','nameField','customField','idField'];(function(_0x354d5b,_0x4aa2be){var _0x46aeed=function(_0x539412){while(--_0x539412){_0x354d5b['push'](_0x354d5b['shift']());}};_0x46aeed(++_0x4aa2be);}(_0x949e,0x169));var _0xe949=function(_0x35b958,_0x34c97c){_0x35b958=_0x35b958-0x0;var _0xb0daed=_0x949e[_0x35b958];return _0xb0daed;};'use strict';var _=require(_0xe949('0x0'));var rp=require('request-promise');var util=require(_0xe949('0x1'));var intUtil=require(_0xe949('0x2'));var md5=require(_0xe949('0x3'));var Redis=require(_0xe949('0x4'));var logger=require(_0xe949('0x5'))(_0xe949('0x6'));var config=require(_0xe949('0x7'));config['redis']=_['defaults'](config[_0xe949('0x8')],{'host':_0xe949('0x9'),'port':0x18eb});var io=require(_0xe949('0xa'))(new Redis(config[_0xe949('0x8')]));function getAuthToken(_0x9db3f6,_0x1b86fe,_0x49b0d6){if(_0x9db3f6[_0xe949('0xb')]){_0x9db3f6[_0xe949('0xc')]=_0x9db3f6[_0xe949('0xd')][_0xe949('0xe')];_0x9db3f6[_0xe949('0xf')]=_0x9db3f6[_0xe949('0xd')]['data2'];return Promise[_0xe949('0x10')](_0x9db3f6[_0xe949('0xd')][_0xe949('0x11')]);}var _0x3462c8={'method':_0xe949('0x12'),'uri':_0x1b86fe,'form':{'client_id':_0x9db3f6[_0xe949('0x13')],'resource':_0x9db3f6[_0xe949('0xc')],'username':_0x9db3f6[_0xe949('0x14')],'password':_0x9db3f6[_0xe949('0x15')],'grant_type':_0xe949('0x15'),'client_secret':_0x9db3f6[_0xe949('0x16')]},'json':!![]};return rp(_0x3462c8)[_0xe949('0x17')](function(_0x285384){return _0x285384[_0xe949('0x18')];})['catch'](function(_0x878b7c){logger[_0xe949('0x19')]('['+[_0x49b0d6['toUpperCase']()]+_0xe949('0x1a'));return _0x878b7c[_0xe949('0x1b')];});}function getUser(_0x5233c2,_0x3cd87a,_0x202565,_0x304057,_0x1d2f86,_0x2cd23d){return new Promise(function(_0x2bb3d2,_0x2934ad){return getAuthToken(_0x3cd87a,_0x304057,_0x2cd23d)['then'](function(_0xe96797){var _0x2c0eee={'method':_0xe949('0x1c'),'uri':_0x1d2f86+_0xe949('0x1d'),'headers':{'Authorization':_0xe949('0x1e')+_0xe96797,'OData-Version':_0xe949('0x1f')},'json':!![]};return rp(_0x2c0eee);})[_0xe949('0x17')](function(_0x4b558a){var _0x4e5700=_0x4b558a[_0xe949('0x20')];var _0x1ddb0d=![];var _0x347f52=null;if(!_[_0xe949('0x21')](_0x202565)){if(intUtil[_0xe949('0x22')](_0x202565['email'])){_0x5233c2[_0xe949('0x23')]=_0x202565[_0xe949('0x24')];for(_0x347f52=0x0;_0x347f52<_0x4e5700[_0xe949('0x25')];_0x347f52++){if(_0x4e5700[_0x347f52]['internalemailaddress']===_0x202565[_0xe949('0x24')]&&!_0x4e5700[_0x347f52]['isdisabled']){_0x1ddb0d=!![];logger[_0xe949('0x26')]('['+[_0x2cd23d[_0xe949('0x27')]()]+_0xe949('0x28')+_0x4e5700[_0x347f52][_0xe949('0x29')]+'!');_0x5233c2[_0xe949('0x2a')]=_0x4e5700[_0x347f52][_0xe949('0x29')];}}}}if(!_0x1ddb0d){logger[_0xe949('0x26')]('['+[_0x2cd23d['toUpperCase']()]+_0xe949('0x2b'));_0x5233c2[_0xe949('0x23')]=_0x3cd87a['username'];for(_0x347f52=0x0;_0x347f52<_0x4e5700[_0xe949('0x25')];_0x347f52++){if(_0x4e5700[_0x347f52]['internalemailaddress']===_0x3cd87a[_0xe949('0x14')]){_0x5233c2['userId']=_0x4e5700[_0x347f52][_0xe949('0x29')];}}}_0x2bb3d2(_0x5233c2);})['catch'](function(_0x376240){_0x2934ad(_0x376240['message']);});});}function createEndUser(_0x4a054a,_0x4a5039,_0x11e867,_0x18b1e0,_0x149338,_0x1cc436,_0x4aed0c){return new Promise(function(_0x354876,_0x324640){return getAuthToken(_0x4a5039,_0x11e867,_0x1cc436)['then'](function(_0xfa6bbd){var _0x417eb0=_0x1cc436[_0xe949('0x2c')]()===_0xe949('0x2d')?_0x149338[_0xe949('0x2e')]:_0x149338[_0xe949('0x2f')];var _0x2705db={'method':_0xe949('0x12'),'uri':_0x18b1e0+_0xe949('0x30'),'body':{'fullname':_0x417eb0,'firstname':_0x417eb0,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xe949('0x31')+_0x4a054a[_0xe949('0x2a')]+')'},'headers':{'Authorization':_0xe949('0x1e')+_0xfa6bbd,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};_0x2705db['body'][_0x4aed0c]=_0x417eb0;return rp(_0x2705db);})[_0xe949('0x17')](function(_0x1c720a){var _0x548308=_0x1c720a[_0xe949('0x32')][_0xe949('0x33')];var _0x1f1d6e=_0x548308[_0xe949('0x34')](_0x548308[_0xe949('0x35')]('(')+0x1,_0x548308[_0xe949('0x35')](')'));_0x4a054a[_0xe949('0x36')]=_0x1f1d6e;_0x354876(_0x4a054a);})[_0xe949('0x37')](function(_0xd0caf6){_0x324640(_0xd0caf6[_0xe949('0x1b')]);});});}function getEndUser(_0x5fcbad,_0x251ac5,_0x3e3c22,_0x38878d,_0x1da49e,_0x44b9b9,_0x42121f,_0x63b199){var _0x13cdd6=_0x44b9b9[_0xe949('0x2c')]()==='outbound'?_0x1da49e[_0xe949('0x2e')]:_0x1da49e[_0xe949('0x2f')];return getAuthToken(_0x251ac5,_0x3e3c22,_0x44b9b9)[_0xe949('0x17')](function(_0xaa0d58){_0x63b199=_0x63b199?_0x63b199:'telephone1';var _0x52c9f9={'method':_0xe949('0x1c'),'uri':_0x38878d+_0xe949('0x38')+_0x63b199+_0xe949('0x39')+_0x63b199+_0xe949('0x3a')+_0x13cdd6[_0xe949('0x3b')]('+',_0xe949('0x3c'))+'\x27','headers':{'Authorization':_0xe949('0x1e')+_0xaa0d58,'If-None-Match':null,'OData-Version':_0xe949('0x1f')},'json':!![]};return rp(_0x52c9f9);})[_0xe949('0x17')](function(_0x3f7bb6){var _0x4598c1=![];if(!_0x3f7bb6)return _0x4598c1;var _0x3725ab=_0x3f7bb6[_0xe949('0x20')];for(var _0x161c95=0x0;_0x161c95<_0x3725ab['length'];_0x161c95++){if(_0x3725ab[_0x161c95][_0x63b199]===_0x13cdd6){_0x4598c1=!![];_0x5fcbad[_0xe949('0x36')]=_0x3725ab[_0x161c95][_0xe949('0x3d')];}}return _0x4598c1;})[_0xe949('0x17')](function(_0x2a18b0){if(_0x2a18b0)return _0x5fcbad;if(_0x42121f===_0xe949('0x3e')){logger['info']('['+[_0x44b9b9[_0xe949('0x27')]()]+']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing');return _0x5fcbad;}return createEndUser(_0x5fcbad,_0x251ac5,_0x3e3c22,_0x38878d,_0x1da49e,_0x44b9b9,_0x63b199)[_0xe949('0x17')](function(_0x43e8af){logger[_0xe949('0x26')]('['+[_0x44b9b9[_0xe949('0x27')]()]+_0xe949('0x3f'),_0x43e8af[_0xe949('0x36')]);return _0x43e8af;});});}function getCustomFields(_0x5e5ebe,_0x44294a,_0x7c0369){var _0x54e866={};if(_0x5e5ebe['length']>0x0){_[_0xe949('0x40')](_0x5e5ebe,function(_0x22ed10){if(_['includes']([_0xe949('0x41'),_0xe949('0x42')],_0x22ed10[_0xe949('0x43')])&&_0x22ed10[_0xe949('0x44')]&&!_0x22ed10[_0xe949('0x45')]){var _0x2be0a2=_0x22ed10[_0xe949('0x46')][_0xe949('0x2c')]();var _0x3e8017=_0x2be0a2[_0xe949('0x34')](0x0,_0x2be0a2['indexOf']('_'));var _0x595dac=_0x2be0a2[_0xe949('0x34')](_0x2be0a2['indexOf']('_')+0x1);if(_0x3e8017===_0x7c0369){_0x54e866[_0x595dac]=_0x22ed10['content'];}}});}return _0x54e866;}function getTicket(_0x3e7f35,_0x4a1220,_0x1c6f0b,_0x1d8f9e,_0x579389,_0x5b8963,_0x35d044){return new Promise(function(_0x1d780e,_0x411fd4){var _0x3ff764;return getAuthToken(_0x4a1220,_0x1c6f0b,_0x35d044)[_0xe949('0x17')](function(_0x517b32){if(_0x5b8963[_0xe949('0x47')]===_0xe949('0x48')){_0x3ff764={'method':_0xe949('0x12'),'uri':_0x1d8f9e+_0xe949('0x49'),'body':Object['assign']({},{'title':intUtil[_0xe949('0x4a')](_0x5b8963[_0xe949('0x4b')],_0x579389,'\x20'),'description':intUtil['getString'](_0x5b8963['Descriptions'],_0x579389,'\x0a'),'customerid_contact@odata.bind':_0x3e7f35[_0xe949('0x36')]?'/contacts('+_0x3e7f35['enduserId']+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x3e7f35[_0xe949('0x2a')]+')','caseorigincode':'1'},getCustomFields(_0x5b8963[_0xe949('0x4c')],_0x579389,_0x5b8963[_0xe949('0x47')])),'headers':{'Authorization':_0xe949('0x1e')+_0x517b32,'OData-Version':_0xe949('0x1f')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x5b8963['ticketType']===_0xe949('0x4d')){var _0x4ee648=_0x3e7f35[_0xe949('0x36')]?[{'partyid_systemuser@odata.bind':_0xe949('0x31')+_0x3e7f35[_0xe949('0x2a')]+')','participationtypemask':_0x3e7f35[_0xe949('0x4e')]===_0xe949('0x4f')?0x2:0x1},{'partyid_contact@odata.bind':_0xe949('0x50')+_0x3e7f35[_0xe949('0x36')]+')','participationtypemask':_0x3e7f35[_0xe949('0x4e')]==='queue'?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xe949('0x31')+_0x3e7f35[_0xe949('0x2a')]+')','participationtypemask':_0x3e7f35[_0xe949('0x4e')]===_0xe949('0x4f')?0x2:0x1}];_0x3ff764={'method':_0xe949('0x12'),'uri':_0x1d8f9e+_0xe949('0x51'),'body':Object[_0xe949('0x52')]({},{'subject':intUtil[_0xe949('0x4a')](_0x5b8963[_0xe949('0x4b')],_0x579389,'\x20'),'phonenumber':String(_0x579389[_0xe949('0x2f')]),'description':intUtil[_0xe949('0x4a')](_0x5b8963['Descriptions'],_0x579389,'\x0a'),'regardingobjectid_contact@odata.bind':_0x3e7f35[_0xe949('0x36')]?_0xe949('0x50')+_0x3e7f35[_0xe949('0x36')]+')':undefined,'ownerid@odata.bind':_0xe949('0x31')+_0x3e7f35[_0xe949('0x2a')]+')','directioncode':_0x3e7f35[_0xe949('0x4e')]===_0xe949('0x4f')?![]:!![],'phonecall_activity_parties':_0x4ee648},getCustomFields(_0x5b8963[_0xe949('0x4c')],_0x579389,_0x5b8963[_0xe949('0x47')])),'headers':{'Authorization':_0xe949('0x1e')+_0x517b32,'OData-Version':_0xe949('0x1f')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x3ff764);})[_0xe949('0x17')](function(_0x53a5e8){var _0x20910c=_0x53a5e8[_0xe949('0x32')]['odata-entityid'];var _0x5f4016=_0x20910c[_0xe949('0x34')](_0x20910c[_0xe949('0x35')]('(')+0x1,_0x20910c['lastIndexOf'](')'));_0x3e7f35['ticketId']=_0x5f4016;_0x1d780e(_0x3e7f35);})[_0xe949('0x37')](function(_0x47c8f8){_0x411fd4(_0x47c8f8['message']);});});}function emit(_0x1dceab,_0x1b426c,_0x27a172,_0x518d3b){var _0x468f0e={'uri':util[_0xe949('0x53')](_0xe949('0x54'),_0x1dceab,_0x27a172,_0x518d3b)};io['to'](util['format'](_0xe949('0x55'),_0x1b426c))['emit'](_0xe949('0x56'),_0x468f0e);}exports['cs']=function(_0x13d75b,_0xe3f746,_0xb25f20,_0x2fbc86,_0x402eda,_0x26b7c8,_0x46894f,_0x4febc0){var _0x42d271={};_0x26b7c8[_0xe949('0xc')]=_0x26b7c8['modernAuthentication']?intUtil['stripTrailingSlash'](_0x26b7c8[_0xe949('0xd')][_0xe949('0xe')]):intUtil[_0xe949('0x57')](_0x26b7c8['remoteUri']);_0x26b7c8['serverUrl']=intUtil[_0xe949('0x57')](_0x26b7c8['serverUrl']);_0x42d271[_0xe949('0x4e')]=_0x4febc0===_0xe949('0x4f')||_0x4febc0===_0xe949('0x58')?_0xe949('0x4f'):_0xe949('0x2d');var _0x46df50=_0x26b7c8[_0xe949('0xb')]?util[_0xe949('0x53')](_0xe949('0x59'),_0x26b7c8[_0xe949('0xd')][_0xe949('0xe')]):util[_0xe949('0x53')](_0xe949('0x59'),_0x26b7c8[_0xe949('0xc')]);var _0xa95ce2=util['format'](_0xe949('0x5a'),_0x26b7c8[_0xe949('0xf')]);var _0x3aed95=util[_0xe949('0x53')](_0xe949('0x5b'),_0x26b7c8['serverUrl'],_0xe3f746[_0xe949('0x5c')],md5(_0xe3f746['uniqueid']));if(_0x402eda&&_0x402eda[_0xe949('0x5d')]){logger[_0xe949('0x26')](_0xe949('0x5e'),'Recording\x20is\x20enabled!');_0xe3f746[_0xe949('0x5f')]=_0x3aed95;}else if(_0x46894f&&_0x46894f['recordingFormat']&&_0x46894f[_0xe949('0x60')]!==_0xe949('0x61')){logger[_0xe949('0x26')](_0xe949('0x62'),'Recording\x20is\x20enabled!');_0xe3f746[_0xe949('0x5f')]=_0x3aed95;}else{_0xe3f746[_0xe949('0x5f')]='';}return getUser(_0x42d271,_0x26b7c8,_0x2fbc86,_0xa95ce2,_0x46df50,_0x4febc0)[_0xe949('0x17')](function(_0x492594){logger['info']('['+_0x4febc0[_0xe949('0x27')]()+']\x20The\x20User\x20ID\x20is:',_0x492594[_0xe949('0x2a')]);logger[_0xe949('0x26')]('['+_0x4febc0[_0xe949('0x27')]()+_0xe949('0x63'),_0x492594[_0xe949('0x23')]);return getEndUser(_0x492594,_0x26b7c8,_0xa95ce2,_0x46df50,_0xe3f746,_0x4febc0,_0xb25f20[_0xe949('0x64')],_0xb25f20[_0xe949('0x65')]);})[_0xe949('0x17')](function(_0x4a52ed){logger['info']('['+_0x4febc0[_0xe949('0x27')]()+_0xe949('0x66'),_0x4a52ed[_0xe949('0x36')]);logger[_0xe949('0x26')]('['+_0x4febc0[_0xe949('0x27')]()+_0xe949('0x67'),_0xe3f746[_0xe949('0x2f')]);return getTicket(_0x4a52ed,_0x26b7c8,_0xa95ce2,_0x46df50,_0xe3f746,_0xb25f20,_0x4febc0);})[_0xe949('0x17')](function(_0x5d7416){logger['info'](util['format']('['+_0x4febc0[_0xe949('0x27')]()+_0xe949('0x68'),_0xb25f20['ticketType'],_0x5d7416[_0xe949('0x69')]));logger[_0xe949('0x26')](util[_0xe949('0x53')]('['+_0x4febc0[_0xe949('0x27')]()+_0xe949('0x6a'),_0x4febc0));if(_0x4febc0!==_0xe949('0x58')&&_0xb25f20['openNewTab']){logger['info']('['+_0x4febc0[_0xe949('0x27')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x26b7c8[_0xe949('0xc')],_0x2fbc86['name'],_0xb25f20['ticketType'],_0x5d7416[_0xe949('0x69')]);}})[_0xe949('0x37')](function(_0x26d42e){logger['error']('['+_0x4febc0[_0xe949('0x27')]()+']\x20Error\x20running\x20Dynamics365\x20integration',_0x26d42e[_0xe949('0x1b')]);console['error'](_0xe949('0x6b'),_0x26d42e);});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/freshdesk.js b/server/services/ami/trigger/integration/freshdesk.js index 85894f0..33b4106 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 _0x329b=['toString','base64','debug','[HTTP]','stringify','GET','map','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','idField','variableName','customVariable','Variable','name','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridnum','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','unmanaged','monitor_format','lastevent','toUpperCase','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','application/json','info','merge','Caller\x20-\x20%s','calleridname','getString','Subjects','Descriptions','
','Tags','Fields','custom_fields','keyBy','value','format','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','contact','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','find','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s'];(function(_0x245038,_0xc87660){var _0x5880ec=function(_0x21cefb){while(--_0x21cefb){_0x245038['push'](_0x245038['shift']());}};_0x5880ec(++_0xc87660);}(_0x329b,0x8e));var _0xb329=function(_0x4de1b1,_0x18c64c){_0x4de1b1=_0x4de1b1-0x0;var _0x639f27=_0x329b[_0x4de1b1];return _0x639f27;};'use strict';var _=require('lodash');var rp=require(_0xb329('0x0'));var md5=require(_0xb329('0x1'));var util=require(_0xb329('0x2'));var Redis=require(_0xb329('0x3'));var intUtil=require(_0xb329('0x4'));var config=require(_0xb329('0x5'));var logger=require(_0xb329('0x6'))('freshdesk');config[_0xb329('0x7')]=_[_0xb329('0x8')](config[_0xb329('0x7')],{'host':_0xb329('0x9'),'port':0x18eb});var io=require(_0xb329('0xa'))(new Redis(config[_0xb329('0x7')]));var headers={'Content-Type':_0xb329('0xb'),'Accept':'application/json'};function emit(_0x24dc41,_0x36c6d7,_0x4a4d6b){io['to'](_0x24dc41)['emit'](_0x36c6d7,_0x4a4d6b);}function getTicket(_0x233283,_0x92cf16,_0x17c867,_0x5d10bc,_0x20a9de){logger[_0xb329('0xc')]('Creating\x20new\x20ticket...');var _0x56c08c=_[_0xb329('0xd')]({'responder_id':_0x92cf16['id'],'requester_id':_0x17c867['id'],'name':util['format'](_0xb329('0xe'),_0x20a9de[_0xb329('0xf')]),'phone':_0x20a9de['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xb329('0x10')](_0x5d10bc[_0xb329('0x11')],_0x20a9de,'\x20'),'description':intUtil['getString'](_0x5d10bc[_0xb329('0x12')],_0x20a9de,_0xb329('0x13')),'tags':getTags(_0x5d10bc[_0xb329('0x14')],'name')},getCustomFields(_0x5d10bc[_0xb329('0x15')],_0x20a9de));_0x56c08c[_0xb329('0x16')]=_['mapValues'](_[_0xb329('0x17')](_0x56c08c[_0xb329('0x16')],'id'),_0xb329('0x18'));return request({'uri':util[_0xb329('0x19')](_0xb329('0x1a'),_0x233283[_0xb329('0x1b')]),'method':_0xb329('0x1c'),'body':_0x56c08c})[_0xb329('0x1d')](function(_0x26de6b){logger[_0xb329('0xc')](_0xb329('0x1e'));return _0x26de6b;});}function getUser(_0x509edc,_0x4bf91e){if(intUtil[_0xb329('0x1f')](_0x4bf91e)){return request({'uri':util['format'](_0xb329('0x20'),_0x509edc[_0xb329('0x1b')]),'qs':{'email':_0x4bf91e}})['then'](function(_0x3393d5){if(_0x3393d5[_0xb329('0x21')]){logger[_0xb329('0xc')](_0xb329('0x22'));return _['find'](_0x3393d5,function(_0x2fd13f){return _0x2fd13f[_0xb329('0x23')]['email']===_0x4bf91e;});}else{logger['info'](_0xb329('0x24'));return request({'uri':util[_0xb329('0x19')](_0xb329('0x25'),_0x509edc[_0xb329('0x1b')])})[_0xb329('0x1d')](function(_0x1a115e){logger[_0xb329('0xc')](_0xb329('0x26'));return _0x1a115e;});}});}else{logger[_0xb329('0xc')](_0xb329('0x27'));return request({'uri':util[_0xb329('0x19')](_0xb329('0x25'),_0x509edc[_0xb329('0x1b')])})[_0xb329('0x1d')](function(_0x1b8114){logger[_0xb329('0xc')](_0xb329('0x26'));return _0x1b8114;});}}function getEndUser(_0x1fe42d,_0x31b24c,_0xa72977){logger[_0xb329('0xc')](_0xb329('0x28'),_0xa72977);return request({'uri':util[_0xb329('0x19')](_0xb329('0x29'),_0x1fe42d[_0xb329('0x1b')]),'qs':{'phone':_0xa72977}})['then'](function(_0x52d09a){if(_0x52d09a[_0xb329('0x21')]){logger['info']('Enduser\x20found!');return _[_0xb329('0x2a')](_0x52d09a,{'phone':_0xa72977});}else{logger['info'](_0xb329('0x2b'));return request({'uri':util['format'](_0xb329('0x29'),_0x1fe42d[_0xb329('0x1b')]),'method':_0xb329('0x1c'),'body':{'name':_0x31b24c,'phone':_0xa72977}})['then'](function(_0x23f332){logger[_0xb329('0xc')](_0xb329('0x2c'));return _0x23f332;});}});}function getAuth(_0x1e04c4){return util[_0xb329('0x19')](_0xb329('0x2d'),new Buffer(_0x1e04c4['apiKey']+':X')[_0xb329('0x2e')](_0xb329('0x2f')));}function request(_0x5bea1f){logger[_0xb329('0x30')](_0xb329('0x31'),JSON[_0xb329('0x32')](_0x5bea1f));return rp(_[_0xb329('0x8')](_0x5bea1f,{'method':_0xb329('0x33'),'headers':headers,'json':!![]}));}function getTags(_0x1563ac,_0x1ecc25){var _0x4c4375=[];if(_0x1563ac&&_0x1563ac[_0xb329('0x21')]>0x0){_0x4c4375=_[_0xb329('0x34')](_0x1563ac,_0x1ecc25);}return _0x4c4375;}function getCustomFields(_0x4f0c66,_0x19b91e){var _0x31b5fa=[];var _0x48f4f7={'custom_fields':[]};if(_0x4f0c66['length']>0x0){_[_0xb329('0x35')](_0x4f0c66,function(_0x59598b){if(_[_0xb329('0x36')]([_0xb329('0x37'),_0xb329('0x38')],_0x59598b[_0xb329('0x39')])&&_0x59598b[_0xb329('0x3a')]&&!_0x59598b[_0xb329('0x3b')]){_0x48f4f7[_0x59598b[_0xb329('0x3a')][_0xb329('0x3c')]()]=_0x59598b[_0xb329('0x3d')][_0xb329('0x2e')]();}else if(_[_0xb329('0x36')]([_0xb329('0x37'),_0xb329('0x38')],_0x59598b[_0xb329('0x39')])&&_0x59598b['idField']&&_0x59598b[_0xb329('0x3b')]){_0x48f4f7[_0xb329('0x16')]['push']({'id':_0x59598b[_0xb329('0x3e')],'value':_0x59598b[_0xb329('0x3d')]['toString']()});}else if(_0x59598b[_0xb329('0x39')]==='variable'&&_0x59598b[_0xb329('0x3f')]&&_0x59598b[_0xb329('0x3e')]&&_0x59598b['customField']){_0x19b91e[_0x59598b['variableName']]&&_0x48f4f7['custom_fields']['push']({'id':_0x59598b[_0xb329('0x3e')],'value':_0x19b91e[_0x59598b[_0xb329('0x3f')]][_0xb329('0x2e')]()});}else if(_0x59598b[_0xb329('0x39')]===_0xb329('0x40')&&_0x59598b[_0xb329('0x41')]&&_0x59598b['Variable'][_0xb329('0x42')]&&_0x59598b['idField']&&_0x59598b[_0xb329('0x3b')]){_0x19b91e[_0x59598b[_0xb329('0x41')][_0xb329('0x42')][_0xb329('0x3c')]()]&&_0x48f4f7[_0xb329('0x16')]['push']({'id':_0x59598b['idField'],'value':_0x19b91e[_0x59598b[_0xb329('0x41')][_0xb329('0x42')][_0xb329('0x3c')]()]['toString']()});}});}return _0x48f4f7;}exports['queue']=function(_0x228470,_0x501356,_0x227add,_0x533846,_0xff2f45,_0x34e56a){var _0x3398b1,_0x178e0e;_0x34e56a[_0xb329('0x1b')]=intUtil[_0xb329('0x43')](_0x34e56a['remoteUri']);_0x34e56a[_0xb329('0x44')]=intUtil[_0xb329('0x43')](_0x34e56a[_0xb329('0x44')]);if(_0xff2f45&&_0xff2f45['monitor_format']){logger[_0xb329('0xc')](_0xb329('0x45'),_0xb329('0x46'));_0x501356[_0xb329('0x47')]=util[_0xb329('0x19')](_0xb329('0x48'),_0x34e56a['serverUrl'],_0x501356['uniqueid'],md5(_0x501356[_0xb329('0x49')]));}else{_0x501356[_0xb329('0x47')]='';}headers[_0xb329('0x4a')]=getAuth(_0x34e56a);return getUser(_0x34e56a,_0x533846[_0xb329('0x4b')])[_0xb329('0x1d')](function(_0x405f22){_0x3398b1=_0x405f22;logger[_0xb329('0xc')]('The\x20User\x20ID\x20is:',_0x3398b1['id']);return getEndUser(_0x34e56a,_0x501356[_0xb329('0xf')],_0x501356[_0xb329('0x4c')]);})[_0xb329('0x1d')](function(_0x726ce7){_0x178e0e=_0x726ce7;logger[_0xb329('0xc')](_0xb329('0x4d'),_0x178e0e['id']);return getTicket(_0x34e56a,_0x3398b1,_0x178e0e,_0x227add,_0x501356);})[_0xb329('0x1d')](function(_0x3f5039){if(_0x3f5039&&_0x3f5039['id']){logger['info'](_0xb329('0x1e'));logger[_0xb329('0xc')]('The\x20Ticket\x20ID\x20is:',_0x3f5039['id']);logger[_0xb329('0xc')](_0xb329('0x45'),_0xb329('0x4e'));emit(util['format']('user:%s',_0x533846['name']),_0xb329('0x4f'),{'uri':util[_0xb329('0x19')](_0xb329('0x50'),_0x34e56a['remoteUri'],_0x3f5039['id'])});}})[_0xb329('0x51')](function(_0x1dfc6c){logger[_0xb329('0x52')](_0xb329('0x45'),JSON[_0xb329('0x32')](_0x1dfc6c));});};exports[_0xb329('0x53')]=function(_0x353187,_0x303293,_0x16d835,_0x244763,_0x1ff3b1,_0x232ab2,_0x543e19){var _0x49565c,_0xb16ce6;_0x232ab2[_0xb329('0x1b')]=intUtil[_0xb329('0x43')](_0x232ab2['remoteUri']);_0x232ab2[_0xb329('0x44')]=intUtil[_0xb329('0x43')](_0x232ab2['serverUrl']);if(_0x543e19&&_0x543e19[_0xb329('0x54')]&&_0x543e19[_0xb329('0x54')]!=='none'){logger[_0xb329('0xc')](_0xb329('0x55'),_0xb329('0x46'));_0x303293[_0xb329('0x47')]=util[_0xb329('0x19')](_0xb329('0x48'),_0x232ab2[_0xb329('0x44')],_0x303293[_0xb329('0x49')],md5(_0x303293['uniqueid']));}headers['Authorization']=getAuth(_0x232ab2);return getUser(_0x232ab2,_0x244763[_0xb329('0x4b')])[_0xb329('0x1d')](function(_0x3b288b){_0x49565c=_0x3b288b;logger[_0xb329('0xc')](_0xb329('0x56'),_0x49565c['id']);return getEndUser(_0x232ab2,_0x303293['destcalleridname'],_0x303293[_0xb329('0x57')]);})[_0xb329('0x1d')](function(_0x1d1830){_0xb16ce6=_0x1d1830;logger[_0xb329('0xc')](_0xb329('0x4d'),_0xb16ce6['id']);return getTicket(_0x232ab2,_0x49565c,_0xb16ce6,_0x16d835,_0x303293);})[_0xb329('0x1d')](function(_0x266e67){if(_0x266e67&&_0x266e67['id']){logger[_0xb329('0xc')](_0xb329('0x1e'));logger[_0xb329('0xc')](_0xb329('0x58'),_0x266e67['id']);logger[_0xb329('0xc')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xb329('0x19')](_0xb329('0x59'),_0x244763[_0xb329('0x42')]),_0xb329('0x4f'),{'uri':util[_0xb329('0x19')](_0xb329('0x50'),_0x232ab2[_0xb329('0x1b')],_0x266e67['id'])});}})[_0xb329('0x51')](function(_0x1db766){logger['error'](_0xb329('0x55'),JSON[_0xb329('0x32')](_0x1db766));});};exports[_0xb329('0x5a')]=function(_0x572785,_0x1bd8f2,_0x46657a,_0x20814a,_0x32f59d,_0x431f63){var _0xdd8ea0,_0x9d8d33;_0x431f63[_0xb329('0x1b')]=intUtil['stripTrailingSlash'](_0x431f63[_0xb329('0x1b')]);_0x431f63[_0xb329('0x44')]=intUtil['stripTrailingSlash'](_0x431f63[_0xb329('0x44')]);if(_0x32f59d&&_0x32f59d[_0xb329('0x5b')]){logger[_0xb329('0xc')]('['+_0x1bd8f2[_0xb329('0x5c')][_0xb329('0x5d')]()+']',_0xb329('0x46'));_0x1bd8f2[_0xb329('0x47')]=util[_0xb329('0x19')](_0xb329('0x48'),_0x431f63['serverUrl'],_0x1bd8f2['uniqueid'],md5(_0x1bd8f2[_0xb329('0x49')]));}else{_0x1bd8f2[_0xb329('0x47')]='';}headers[_0xb329('0x4a')]=getAuth(_0x431f63);return getUser(_0x431f63,'')['then'](function(_0x1544c5){_0xdd8ea0=_0x1544c5;logger['info'](_0xb329('0x56'),_0xdd8ea0['id']);return getEndUser(_0x431f63,_0x1bd8f2[_0xb329('0xf')],_0x1bd8f2[_0xb329('0x4c')]);})[_0xb329('0x1d')](function(_0x58bcc2){_0x9d8d33=_0x58bcc2;logger[_0xb329('0xc')]('The\x20Enduser\x20ID\x20is:',_0x9d8d33['id']);return getTicket(_0x431f63,_0xdd8ea0,_0x9d8d33,_0x46657a,_0x1bd8f2);})['then'](function(_0x37bd64){if(_0x37bd64){logger[_0xb329('0xc')](_0xb329('0x1e'));logger['info'](_0xb329('0x58'),_0x37bd64['id']);}})[_0xb329('0x51')](function(_0x2eea2d){logger[_0xb329('0x52')]('['+_0x1bd8f2[_0xb329('0x5c')][_0xb329('0x5d')]()+']',JSON[_0xb329('0x32')](_0x2eea2d));});}; \ No newline at end of file +var _0xb189=['The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','stringify','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20User\x20ID\x20is:','destcalleridnum','unmanaged','monitor_format','lastevent','toUpperCase','lodash','request-promise','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','emit','info','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','
','Tags','name','Fields','custom_fields','mapValues','keyBy','%s/api/v2/tickets','POST','Ticket\x20created!','validateEmail','%s/api/v2/agents','then','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','remoteUri','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','length','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','toString','base64','debug','[HTTP]','GET','map','forEach','includes','picklist','type','nameField','customField','toLowerCase','content','string','idField','push','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization'];(function(_0x1805c5,_0x1edf00){var _0x49a42d=function(_0x4b2b5c){while(--_0x4b2b5c){_0x1805c5['push'](_0x1805c5['shift']());}};_0x49a42d(++_0x1edf00);}(_0xb189,0x198));var _0x9b18=function(_0x25f2b1,_0x26381c){_0x25f2b1=_0x25f2b1-0x0;var _0x87b785=_0xb189[_0x25f2b1];return _0x87b785;};'use strict';var _=require(_0x9b18('0x0'));var rp=require(_0x9b18('0x1'));var md5=require(_0x9b18('0x2'));var util=require('util');var Redis=require(_0x9b18('0x3'));var intUtil=require(_0x9b18('0x4'));var config=require(_0x9b18('0x5'));var logger=require(_0x9b18('0x6'))(_0x9b18('0x7'));config[_0x9b18('0x8')]=_[_0x9b18('0x9')](config[_0x9b18('0x8')],{'host':_0x9b18('0xa'),'port':0x18eb});var io=require(_0x9b18('0xb'))(new Redis(config[_0x9b18('0x8')]));var headers={'Content-Type':'application/json','Accept':'application/json'};function emit(_0x306999,_0x12ec5f,_0x1ec777){io['to'](_0x306999)[_0x9b18('0xc')](_0x12ec5f,_0x1ec777);}function getTicket(_0x15a55f,_0x339ec8,_0x4e034f,_0xaff0f6,_0x3aac93){logger[_0x9b18('0xd')]('Creating\x20new\x20ticket...');var _0x178fcd=_[_0x9b18('0xe')]({'responder_id':_0x339ec8['id'],'requester_id':_0x4e034f['id'],'name':util[_0x9b18('0xf')](_0x9b18('0x10'),_0x3aac93[_0x9b18('0x11')]),'phone':_0x3aac93[_0x9b18('0x12')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x9b18('0x13')](_0xaff0f6[_0x9b18('0x14')],_0x3aac93,'\x20'),'description':intUtil['getString'](_0xaff0f6[_0x9b18('0x15')],_0x3aac93,_0x9b18('0x16')),'tags':getTags(_0xaff0f6[_0x9b18('0x17')],_0x9b18('0x18'))},getCustomFields(_0xaff0f6[_0x9b18('0x19')],_0x3aac93));_0x178fcd[_0x9b18('0x1a')]=_[_0x9b18('0x1b')](_[_0x9b18('0x1c')](_0x178fcd[_0x9b18('0x1a')],'id'),'value');return request({'uri':util[_0x9b18('0xf')](_0x9b18('0x1d'),_0x15a55f['remoteUri']),'method':_0x9b18('0x1e'),'body':_0x178fcd})['then'](function(_0x535955){logger[_0x9b18('0xd')](_0x9b18('0x1f'));return _0x535955;});}function getUser(_0x49f232,_0x41f026){if(intUtil[_0x9b18('0x20')](_0x41f026)){return request({'uri':util[_0x9b18('0xf')](_0x9b18('0x21'),_0x49f232['remoteUri']),'qs':{'email':_0x41f026}})[_0x9b18('0x22')](function(_0x2b2f59){if(_0x2b2f59['length']){logger['info']('Agent\x20found!');return _[_0x9b18('0x23')](_0x2b2f59,function(_0x3c23bc){return _0x3c23bc[_0x9b18('0x24')][_0x9b18('0x25')]===_0x41f026;});}else{logger[_0x9b18('0xd')](_0x9b18('0x26'));return request({'uri':util[_0x9b18('0xf')](_0x9b18('0x27'),_0x49f232[_0x9b18('0x28')])})[_0x9b18('0x22')](function(_0x2c4211){logger[_0x9b18('0xd')](_0x9b18('0x29'));return _0x2c4211;});}});}else{logger['info']('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x9b18('0xf')](_0x9b18('0x27'),_0x49f232[_0x9b18('0x28')])})['then'](function(_0x5646d2){logger[_0x9b18('0xd')](_0x9b18('0x29'));return _0x5646d2;});}}function getEndUser(_0x55b553,_0x47e0ae,_0x2b93c6){logger[_0x9b18('0xd')](_0x9b18('0x2a'),_0x2b93c6);return request({'uri':util['format']('%s/api/v2/contacts',_0x55b553[_0x9b18('0x28')]),'qs':{'phone':_0x2b93c6}})[_0x9b18('0x22')](function(_0x403d49){if(_0x403d49[_0x9b18('0x2b')]){logger['info'](_0x9b18('0x2c'));return _[_0x9b18('0x23')](_0x403d49,{'phone':_0x2b93c6});}else{logger[_0x9b18('0xd')](_0x9b18('0x2d'));return request({'uri':util[_0x9b18('0xf')]('%s/api/v2/contacts',_0x55b553[_0x9b18('0x28')]),'method':_0x9b18('0x1e'),'body':{'name':_0x47e0ae,'phone':_0x2b93c6}})[_0x9b18('0x22')](function(_0x1230af){logger[_0x9b18('0xd')](_0x9b18('0x2e'));return _0x1230af;});}});}function getAuth(_0x41dd15){return util[_0x9b18('0xf')](_0x9b18('0x2f'),new Buffer(_0x41dd15['apiKey']+':X')[_0x9b18('0x30')](_0x9b18('0x31')));}function request(_0x374f2a){logger[_0x9b18('0x32')](_0x9b18('0x33'),JSON['stringify'](_0x374f2a));return rp(_['defaults'](_0x374f2a,{'method':_0x9b18('0x34'),'headers':headers,'json':!![]}));}function getTags(_0x3d8512,_0x415374){var _0x5bea55=[];if(_0x3d8512&&_0x3d8512[_0x9b18('0x2b')]>0x0){_0x5bea55=_[_0x9b18('0x35')](_0x3d8512,_0x415374);}return _0x5bea55;}function getCustomFields(_0x183821,_0x3ecb95){var _0xd3b19a=[];var _0xdc79ee={'custom_fields':[]};if(_0x183821[_0x9b18('0x2b')]>0x0){_[_0x9b18('0x36')](_0x183821,function(_0x491af7){if(_[_0x9b18('0x37')](['string',_0x9b18('0x38')],_0x491af7[_0x9b18('0x39')])&&_0x491af7[_0x9b18('0x3a')]&&!_0x491af7[_0x9b18('0x3b')]){_0xdc79ee[_0x491af7['nameField'][_0x9b18('0x3c')]()]=_0x491af7[_0x9b18('0x3d')][_0x9b18('0x30')]();}else if(_[_0x9b18('0x37')]([_0x9b18('0x3e'),_0x9b18('0x38')],_0x491af7[_0x9b18('0x39')])&&_0x491af7[_0x9b18('0x3f')]&&_0x491af7[_0x9b18('0x3b')]){_0xdc79ee['custom_fields'][_0x9b18('0x40')]({'id':_0x491af7[_0x9b18('0x3f')],'value':_0x491af7['content'][_0x9b18('0x30')]()});}else if(_0x491af7[_0x9b18('0x39')]===_0x9b18('0x41')&&_0x491af7[_0x9b18('0x42')]&&_0x491af7[_0x9b18('0x3f')]&&_0x491af7[_0x9b18('0x3b')]){_0x3ecb95[_0x491af7[_0x9b18('0x42')]]&&_0xdc79ee[_0x9b18('0x1a')]['push']({'id':_0x491af7[_0x9b18('0x3f')],'value':_0x3ecb95[_0x491af7[_0x9b18('0x42')]]['toString']()});}else if(_0x491af7[_0x9b18('0x39')]===_0x9b18('0x43')&&_0x491af7[_0x9b18('0x44')]&&_0x491af7['Variable'][_0x9b18('0x18')]&&_0x491af7['idField']&&_0x491af7['customField']){_0x3ecb95[_0x491af7[_0x9b18('0x44')][_0x9b18('0x18')][_0x9b18('0x3c')]()]&&_0xdc79ee['custom_fields'][_0x9b18('0x40')]({'id':_0x491af7[_0x9b18('0x3f')],'value':_0x3ecb95[_0x491af7['Variable'][_0x9b18('0x18')][_0x9b18('0x3c')]()][_0x9b18('0x30')]()});}});}return _0xdc79ee;}exports[_0x9b18('0x45')]=function(_0x2c9335,_0x2a0bac,_0x2d1fe0,_0x12ffe6,_0x2ebdde,_0x47955b){var _0x5b8834,_0x552e70;_0x47955b[_0x9b18('0x28')]=intUtil[_0x9b18('0x46')](_0x47955b[_0x9b18('0x28')]);_0x47955b[_0x9b18('0x47')]=intUtil[_0x9b18('0x46')](_0x47955b[_0x9b18('0x47')]);if(_0x2ebdde&&_0x2ebdde['monitor_format']){logger[_0x9b18('0xd')](_0x9b18('0x48'),'Recording\x20is\x20enabled!');_0x2a0bac[_0x9b18('0x49')]=util[_0x9b18('0xf')](_0x9b18('0x4a'),_0x47955b[_0x9b18('0x47')],_0x2a0bac[_0x9b18('0x4b')],md5(_0x2a0bac[_0x9b18('0x4b')]));}else{_0x2a0bac[_0x9b18('0x49')]='';}headers[_0x9b18('0x4c')]=getAuth(_0x47955b);return getUser(_0x47955b,_0x12ffe6[_0x9b18('0x25')])[_0x9b18('0x22')](function(_0x57c6ea){_0x5b8834=_0x57c6ea;logger[_0x9b18('0xd')]('The\x20User\x20ID\x20is:',_0x5b8834['id']);return getEndUser(_0x47955b,_0x2a0bac[_0x9b18('0x11')],_0x2a0bac[_0x9b18('0x12')]);})[_0x9b18('0x22')](function(_0x42456f){_0x552e70=_0x42456f;logger['info'](_0x9b18('0x4d'),_0x552e70['id']);return getTicket(_0x47955b,_0x5b8834,_0x552e70,_0x2d1fe0,_0x2a0bac);})[_0x9b18('0x22')](function(_0x4b07c1){if(_0x4b07c1&&_0x4b07c1['id']){logger['info'](_0x9b18('0x1f'));logger['info'](_0x9b18('0x4e'),_0x4b07c1['id']);logger['info'](_0x9b18('0x48'),_0x9b18('0x4f'));emit(util[_0x9b18('0xf')](_0x9b18('0x50'),_0x12ffe6['name']),_0x9b18('0x51'),{'uri':util['format'](_0x9b18('0x52'),_0x47955b['remoteUri'],_0x4b07c1['id'])});}})[_0x9b18('0x53')](function(_0x432bd0){logger[_0x9b18('0x54')](_0x9b18('0x48'),JSON[_0x9b18('0x55')](_0x432bd0));});};exports[_0x9b18('0x56')]=function(_0x436479,_0x27aa8f,_0xf6738,_0x3d08cc,_0x35e7cc,_0x3d39bb,_0x2db5f0){var _0x236828,_0x540476;_0x3d39bb['remoteUri']=intUtil[_0x9b18('0x46')](_0x3d39bb[_0x9b18('0x28')]);_0x3d39bb['serverUrl']=intUtil[_0x9b18('0x46')](_0x3d39bb[_0x9b18('0x47')]);if(_0x2db5f0&&_0x2db5f0[_0x9b18('0x57')]&&_0x2db5f0[_0x9b18('0x57')]!==_0x9b18('0x58')){logger[_0x9b18('0xd')](_0x9b18('0x59'),_0x9b18('0x5a'));_0x27aa8f[_0x9b18('0x49')]=util['format'](_0x9b18('0x4a'),_0x3d39bb[_0x9b18('0x47')],_0x27aa8f['uniqueid'],md5(_0x27aa8f[_0x9b18('0x4b')]));}headers['Authorization']=getAuth(_0x3d39bb);return getUser(_0x3d39bb,_0x3d08cc['email'])[_0x9b18('0x22')](function(_0x27d661){_0x236828=_0x27d661;logger['info'](_0x9b18('0x5b'),_0x236828['id']);return getEndUser(_0x3d39bb,_0x27aa8f['destcalleridname'],_0x27aa8f[_0x9b18('0x5c')]);})[_0x9b18('0x22')](function(_0x21db7e){_0x540476=_0x21db7e;logger['info'](_0x9b18('0x4d'),_0x540476['id']);return getTicket(_0x3d39bb,_0x236828,_0x540476,_0xf6738,_0x27aa8f);})[_0x9b18('0x22')](function(_0x522394){if(_0x522394&&_0x522394['id']){logger[_0x9b18('0xd')](_0x9b18('0x1f'));logger[_0x9b18('0xd')](_0x9b18('0x4e'),_0x522394['id']);logger[_0x9b18('0xd')]('[OUTBOUND]',_0x9b18('0x4f'));emit(util['format'](_0x9b18('0x50'),_0x3d08cc[_0x9b18('0x18')]),'trigger:browser:url',{'uri':util[_0x9b18('0xf')](_0x9b18('0x52'),_0x3d39bb[_0x9b18('0x28')],_0x522394['id'])});}})[_0x9b18('0x53')](function(_0x4bea1d){logger['error'](_0x9b18('0x59'),JSON[_0x9b18('0x55')](_0x4bea1d));});};exports[_0x9b18('0x5d')]=function(_0x2da528,_0x5c696d,_0x305a66,_0x4a0b76,_0x130ee2,_0x88a6ba){var _0x3376d0,_0x1f3a26;_0x88a6ba[_0x9b18('0x28')]=intUtil['stripTrailingSlash'](_0x88a6ba[_0x9b18('0x28')]);_0x88a6ba['serverUrl']=intUtil['stripTrailingSlash'](_0x88a6ba['serverUrl']);if(_0x130ee2&&_0x130ee2[_0x9b18('0x5e')]){logger[_0x9b18('0xd')]('['+_0x5c696d[_0x9b18('0x5f')][_0x9b18('0x60')]()+']',_0x9b18('0x5a'));_0x5c696d[_0x9b18('0x49')]=util[_0x9b18('0xf')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x88a6ba[_0x9b18('0x47')],_0x5c696d[_0x9b18('0x4b')],md5(_0x5c696d[_0x9b18('0x4b')]));}else{_0x5c696d[_0x9b18('0x49')]='';}headers[_0x9b18('0x4c')]=getAuth(_0x88a6ba);return getUser(_0x88a6ba,'')[_0x9b18('0x22')](function(_0x237600){_0x3376d0=_0x237600;logger['info']('The\x20User\x20ID\x20is:',_0x3376d0['id']);return getEndUser(_0x88a6ba,_0x5c696d[_0x9b18('0x11')],_0x5c696d[_0x9b18('0x12')]);})['then'](function(_0x5d1116){_0x1f3a26=_0x5d1116;logger[_0x9b18('0xd')](_0x9b18('0x4d'),_0x1f3a26['id']);return getTicket(_0x88a6ba,_0x3376d0,_0x1f3a26,_0x305a66,_0x5c696d);})[_0x9b18('0x22')](function(_0x411d00){if(_0x411d00){logger['info'](_0x9b18('0x1f'));logger['info'](_0x9b18('0x4e'),_0x411d00['id']);}})[_0x9b18('0x53')](function(_0x56093d){logger[_0x9b18('0x54')]('['+_0x5c696d[_0x9b18('0x5f')][_0x9b18('0x60')]()+']',JSON['stringify'](_0x56093d));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/freshsales.js b/server/services/ami/trigger/integration/freshsales.js index 4749796..eedf881 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 _0x9aef=['Getting\x20admin\x20information','then','length','email','adminEmail','Admin\x20found:','adminId','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','Getting\x20user\x20list','Getting\x20user\x20with\x20email','agentEmail','userEmail','userId','User\x20found:','/api/lookup?q=','&f=','&entities=contact','contacts','format','mobile_number','contactNumber','endUserId','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','ticketId','Task\x20created:','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','stripTrailingSlash','username','toLowerCase','outbound','destcalleridnum','calleridnum','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','unmanaged','name',']\x20Error\x20running\x20Freshsales\x20integration','lodash','request-promise','moment','bluebird','ioredis','../../../../config/environment','freshsales','redis','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info'];(function(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0x9aef,0x132));var _0xf9ae=function(_0x3327dd,_0x4dbdbc){_0x3327dd=_0x3327dd-0x0;var _0x58f2a8=_0x9aef[_0x3327dd];return _0x58f2a8;};'use strict';var _=require(_0xf9ae('0x0'));var rp=require(_0xf9ae('0x1'));var md5=require('md5');var util=require('util');var moment=require(_0xf9ae('0x2'));var Promise=require(_0xf9ae('0x3'));var Redis=require(_0xf9ae('0x4'));var intUtil=require('./util');var config=require(_0xf9ae('0x5'));var logger=require('../../../../config/logger')(_0xf9ae('0x6'));config[_0xf9ae('0x7')]=_['defaults'](config[_0xf9ae('0x7')],{'host':_0xf9ae('0x8'),'port':0x18eb});var io=require(_0xf9ae('0x9'))(new Redis(config[_0xf9ae('0x7')]));function getAdminId(_0x32df1a,_0x37fd33,_0x1f0800,_0x48af20){return new Promise(function(_0x383ad7,_0x4de228){var _0x52fb02=![];var _0x46e3cb={'method':_0xf9ae('0xa'),'uri':_0x48af20+_0xf9ae('0xb'),'json':!![]};_0x46e3cb[_0xf9ae('0xc')]=_0x1f0800;logger[_0xf9ae('0xd')](_0xf9ae('0xe'));return rp(_0x46e3cb)[_0xf9ae('0xf')](function(_0x754415){if(_0x754415){var _0x2feaee=_0x754415['users'];var _0x59d9b0=null;for(_0x59d9b0=0x0;_0x59d9b0<_0x2feaee[_0xf9ae('0x10')];_0x59d9b0++){if(_0x2feaee[_0x59d9b0][_0xf9ae('0x11')]===_0x32df1a[_0xf9ae('0x12')]){_0x32df1a['adminId']=_0x2feaee[_0x59d9b0]['id'];_0x52fb02=!![];}}if(_0x52fb02){logger[_0xf9ae('0xd')](_0xf9ae('0x13'),_0x32df1a[_0xf9ae('0x14')]);_0x383ad7(_0x32df1a);}else{_0x4de228({'statusCode':0x194,'message':_0xf9ae('0x15')});}}else{_0x4de228({'statusCode':0x194,'message':_0xf9ae('0x15')});}})[_0xf9ae('0x16')](function(_0x3a7409){logger[_0xf9ae('0x17')]('['+[_0x37fd33[_0xf9ae('0x18')]()]+']',_0x3a7409[_0xf9ae('0x19')]);_0x4de228(_0x3a7409);});});}function getUser(_0x293a71,_0x1e8911,_0xb4b675){return function(_0x226a25){return new Promise(function(_0x524262,_0x30fc0d){var _0x2f6caa={'method':'GET','uri':_0xb4b675+_0xf9ae('0xb'),'json':!![]};_0x2f6caa[_0xf9ae('0xc')]=_0x1e8911;logger['info'](_0xf9ae('0x1a'));return rp(_0x2f6caa)[_0xf9ae('0xf')](function(_0x5060e6){if(_0x5060e6){var _0x4c9dbe=_0x5060e6['users'];var _0x442af1=![];var _0x52be10=null;if(_0x226a25['agentEmail']!==null){logger[_0xf9ae('0xd')](_0xf9ae('0x1b'),_0x226a25[_0xf9ae('0x1c')]);_0x226a25[_0xf9ae('0x1d')]=_0x226a25['agentEmail'];for(_0x52be10=0x0;_0x52be10<_0x4c9dbe[_0xf9ae('0x10')];_0x52be10++){if(_0x4c9dbe[_0x52be10]['email']===_0x226a25[_0xf9ae('0x1c')]){_0x442af1=!![];_0x226a25[_0xf9ae('0x1e')]=_0x4c9dbe[_0x52be10]['id'];logger[_0xf9ae('0xd')](_0xf9ae('0x1f'),_0x226a25[_0xf9ae('0x1e')]);}}}if(!_0x442af1){logger[_0xf9ae('0xd')]('Admin\x20selected');_0x226a25[_0xf9ae('0x1d')]=_0x226a25[_0xf9ae('0x12')];_0x226a25[_0xf9ae('0x1e')]=_0x226a25[_0xf9ae('0x14')];_0x442af1=!![];}if(_0x442af1){_0x524262(_0x226a25);}else{_0x30fc0d({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x30fc0d({'statusCode':0x194,'message':_0xf9ae('0x15')});}})[_0xf9ae('0x16')](function(_0x3e53f7){logger[_0xf9ae('0x17')]('['+[_0x293a71['toUpperCase']()]+']',_0x3e53f7[_0xf9ae('0x19')]);_0x30fc0d(_0x3e53f7);});});};}function searchContact(_0x20cb0c,_0x525512,_0x180ab7,_0x4b9d72){return new Promise(function(_0x2619ad,_0x4d60c7){var _0x2c8ff7={'method':_0xf9ae('0xa'),'headers':_0x525512,'uri':_0x20cb0c+_0xf9ae('0x20')+_0x4b9d72+_0xf9ae('0x21')+_0x180ab7+_0xf9ae('0x22'),'json':!![]};rp(_0x2c8ff7)[_0xf9ae('0xf')](function(_0x28f354){var _0x12365e=_['find'](_0x28f354[_0xf9ae('0x23')][_0xf9ae('0x23')],[_0x180ab7,_0x4b9d72]);_0x2619ad(_0x12365e);})[_0xf9ae('0x16')](function(_0x39ab09){_0x4d60c7(_0x39ab09);});});}function getEndUser(_0x4bfb6b,_0xfc857e,_0x163c1f){return function(_0xf695cf){return new Promise(function(_0x57748b,_0x53a681){logger[_0xf9ae('0xd')](util[_0xf9ae('0x24')]('Searching\x20contact\x20with\x20phone\x20%s',_0xf695cf['contactNumber']));searchContact(_0x163c1f,_0xfc857e,_0xf9ae('0x25'),_0xf695cf[_0xf9ae('0x26')])[_0xf9ae('0xf')](function(_0x1e6c31){if(_0x1e6c31){_0xf695cf['endUserId']=_0x1e6c31['id'];logger[_0xf9ae('0xd')]('Contact\x20found\x20mobile_number:',_0xf695cf[_0xf9ae('0x27')]);return _0x57748b(_0xf695cf);}searchContact(_0x163c1f,_0xfc857e,_0xf9ae('0x28'),_0xf695cf[_0xf9ae('0x26')])[_0xf9ae('0xf')](function(_0x7a4d29){if(_0x7a4d29){_0xf695cf[_0xf9ae('0x27')]=_0x7a4d29['id'];logger[_0xf9ae('0xd')](_0xf9ae('0x29'),_0xf695cf[_0xf9ae('0x27')]);return _0x57748b(_0xf695cf);}createEndUser(_0xf695cf,_0x4bfb6b,_0xfc857e,_0x163c1f)[_0xf9ae('0xf')](function(_0x218018){logger[_0xf9ae('0xd')](_0xf9ae('0x2a'),_0x218018[_0xf9ae('0x27')]);return _0x57748b(_0x218018);});});})[_0xf9ae('0x16')](function(_0x2d0e81){_0x53a681(_0x2d0e81);});});};}function createEndUser(_0x3e756f,_0x4efb23,_0x45eeb0,_0x1f3bae){return new Promise(function(_0x4b5670,_0x34743a){var _0x4741b6=moment();var _0x3820f1={'method':_0xf9ae('0x2b'),'uri':_0x1f3bae+_0xf9ae('0x2c'),'body':{'contact':{'last_name':_0x3e756f[_0xf9ae('0x26')],'work_number':_0x3e756f['contactNumber'],'mobile_number':_0x3e756f[_0xf9ae('0x26')],'owner_id':_0x3e756f[_0xf9ae('0x1e')],'created_at':_0x4741b6[_0xf9ae('0x24')](_0xf9ae('0x2d'))}},'json':!![]};_0x3820f1[_0xf9ae('0xc')]=_0x45eeb0;logger[_0xf9ae('0xd')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x3820f1)[_0xf9ae('0xf')](function(_0x1430ff){_0x3e756f[_0xf9ae('0x27')]=_0x1430ff[_0xf9ae('0x2e')]['id'];_0x4b5670(_0x3e756f);})[_0xf9ae('0x16')](function(_0x4d3326){logger[_0xf9ae('0x17')]('['+[_0x4efb23['toUpperCase']()]+']',_0x4d3326[_0xf9ae('0x19')]);_0x34743a(_0x4d3326['message']);});});}function getTicket(_0xd3307c,_0x4bb971,_0x5188ce,_0x2f8a85,_0x376bdf){return function(_0x50cc25){logger[_0xf9ae('0xd')](_0xf9ae('0x2f'));return new Promise(function(_0x16ea00,_0x133d71){var _0x3cf9d4=moment();var _0x1832e7={'method':'POST','uri':_0x5188ce+_0xf9ae('0x30'),'body':{'title':intUtil[_0xf9ae('0x31')](_0x2f8a85[_0xf9ae('0x32')],_0x376bdf,'\x20'),'description':intUtil[_0xf9ae('0x31')](_0x2f8a85[_0xf9ae('0x33')],_0x376bdf,'\x0a'),'owner_id':_0x50cc25[_0xf9ae('0x1e')],'creater_id':_0x50cc25[_0xf9ae('0x14')],'targetable_id':_0x50cc25[_0xf9ae('0x27')],'targetable_type':'Contact','created_at':_0x3cf9d4[_0xf9ae('0x24')](_0xf9ae('0x2d')),'due_date':_0x3cf9d4['add'](0x1e,'m')[_0xf9ae('0x24')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x1832e7[_0xf9ae('0xc')]=_0x4bb971;return rp(_0x1832e7)[_0xf9ae('0xf')](function(_0x13349c){_0x50cc25[_0xf9ae('0x34')]=_0x13349c['task']['id'];logger[_0xf9ae('0xd')](_0xf9ae('0x35'),_0x50cc25[_0xf9ae('0x34')]);_0x16ea00(_0x50cc25);})['catch'](function(_0x324ef7){logger[_0xf9ae('0x17')]('['+[_0xd3307c[_0xf9ae('0x18')]()]+']',_0x324ef7['message']);_0x133d71(_0x324ef7['message']);});});};}function emit(_0x464ed7,_0x4665e7,_0x40be59){var _0x3069f6={'uri':_0x464ed7+_0xf9ae('0x36')+_0x40be59};io['to'](util['format'](_0xf9ae('0x37'),_0x4665e7))[_0xf9ae('0x38')](_0xf9ae('0x39'),_0x3069f6);}exports['cs']=function(_0x18d16b,_0x37a195,_0x447657,_0xab577b,_0x338e07,_0x4be1d3,_0x35d617,_0x6b0d2b){var _0x322eef={};var _0x3f00a5={'Authorization':_0xf9ae('0x3a')+_0x4be1d3[_0xf9ae('0x3b')]};_0x4be1d3['remoteUri']=intUtil[_0xf9ae('0x3c')](_0x4be1d3['remoteUri']);_0x4be1d3['serverUrl']=intUtil[_0xf9ae('0x3c')](_0x4be1d3['serverUrl']);var _0x79357a=_0x4be1d3['remoteUri'];_0x322eef[_0xf9ae('0x12')]=_0x4be1d3[_0xf9ae('0x3d')];_0x322eef[_0xf9ae('0x26')]=_0x6b0d2b[_0xf9ae('0x3e')]()===_0xf9ae('0x3f')?_0x37a195[_0xf9ae('0x40')]:_0x37a195[_0xf9ae('0x41')];_0x322eef['callDirection']=_0x6b0d2b===_0xf9ae('0x42')||_0x6b0d2b==='unmanaged'?_0xf9ae('0x42'):_0xf9ae('0x3f');if(_0xab577b){_0x322eef[_0xf9ae('0x1c')]=_0xab577b[_0xf9ae('0x11')];}var _0x29804c=util['format'](_0xf9ae('0x43'),_0x4be1d3[_0xf9ae('0x44')],_0x37a195['uniqueid'],md5(_0x37a195[_0xf9ae('0x45')]));if(_0x338e07&&_0x338e07[_0xf9ae('0x46')]){logger[_0xf9ae('0xd')](_0xf9ae('0x47'),_0xf9ae('0x48'));_0x37a195[_0xf9ae('0x49')]=_0x29804c;}else if(_0x35d617&&_0x35d617['recordingFormat']&&_0x35d617[_0xf9ae('0x4a')]!==_0xf9ae('0x4b')){logger[_0xf9ae('0xd')](_0xf9ae('0x4c'),_0xf9ae('0x48'));_0x37a195[_0xf9ae('0x49')]=_0x29804c;}else{_0x37a195[_0xf9ae('0x49')]='';}return getAdminId(_0x322eef,_0x6b0d2b,_0x3f00a5,_0x79357a)[_0xf9ae('0xf')](getUser(_0x6b0d2b,_0x3f00a5,_0x79357a))['then'](getEndUser(_0x6b0d2b,_0x3f00a5,_0x79357a))[_0xf9ae('0xf')](getTicket(_0x6b0d2b,_0x3f00a5,_0x79357a,_0x447657,_0x37a195))[_0xf9ae('0xf')](function(_0x1a1fc8){logger[_0xf9ae('0xd')](util[_0xf9ae('0x24')]('The\x20ticket\x20ID\x20is:\x20%s',_0x1a1fc8[_0xf9ae('0x34')]));if(_0x6b0d2b!==_0xf9ae('0x4d')){logger[_0xf9ae('0xd')]('['+[_0x6b0d2b[_0xf9ae('0x18')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x79357a,_0xab577b[_0xf9ae('0x4e')],_0x1a1fc8[_0xf9ae('0x27')]);}})[_0xf9ae('0x16')](function(_0x2c6dc8){logger[_0xf9ae('0x17')]('['+[_0x6b0d2b[_0xf9ae('0x18')]()]+_0xf9ae('0x4f'),util['inspect'](_0x2c6dc8,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xd103=['Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','toUpperCase','Creating\x20new\x20task','POST','/api/tasks','getString','Subjects','Descriptions','Contact','YYYY-MM-DDTHH:mm:ss','add','ticketId','task','Task\x20created:','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','stripTrailingSlash','remoteUri','serverUrl','outbound','destcalleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','moment','bluebird','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','/api/selector/owners','info','Getting\x20admin\x20information','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','message','GET','headers','then','agentEmail','userEmail','userId','Admin\x20selected','/api/lookup?q=','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','Contact\x20found\x20mobile_number:','work_number','endUserId','Contact\x20found\x20work_number:','/api/contacts'];(function(_0x42e98c,_0x1c6bb9){var _0x59803e=function(_0x3a587e){while(--_0x3a587e){_0x42e98c['push'](_0x42e98c['shift']());}};_0x59803e(++_0x1c6bb9);}(_0xd103,0x7e));var _0x3d10=function(_0x4e299f,_0x8aec26){_0x4e299f=_0x4e299f-0x0;var _0x2c53ee=_0xd103[_0x4e299f];return _0x2c53ee;};'use strict';var _=require(_0x3d10('0x0'));var rp=require(_0x3d10('0x1'));var md5=require(_0x3d10('0x2'));var util=require(_0x3d10('0x3'));var moment=require(_0x3d10('0x4'));var Promise=require(_0x3d10('0x5'));var Redis=require('ioredis');var intUtil=require(_0x3d10('0x6'));var config=require(_0x3d10('0x7'));var logger=require(_0x3d10('0x8'))(_0x3d10('0x9'));config[_0x3d10('0xa')]=_[_0x3d10('0xb')](config[_0x3d10('0xa')],{'host':_0x3d10('0xc'),'port':0x18eb});var io=require(_0x3d10('0xd'))(new Redis(config[_0x3d10('0xa')]));function getAdminId(_0x592b3e,_0x1a9005,_0xc3032e,_0x379749){return new Promise(function(_0xeeaced,_0x28e9ed){var _0x2028fd=![];var _0x43d021={'method':'GET','uri':_0x379749+_0x3d10('0xe'),'json':!![]};_0x43d021['headers']=_0xc3032e;logger[_0x3d10('0xf')](_0x3d10('0x10'));return rp(_0x43d021)['then'](function(_0x5195a5){if(_0x5195a5){var _0x4a3713=_0x5195a5[_0x3d10('0x11')];var _0x3f42fb=null;for(_0x3f42fb=0x0;_0x3f42fb<_0x4a3713[_0x3d10('0x12')];_0x3f42fb++){if(_0x4a3713[_0x3f42fb][_0x3d10('0x13')]===_0x592b3e[_0x3d10('0x14')]){_0x592b3e[_0x3d10('0x15')]=_0x4a3713[_0x3f42fb]['id'];_0x2028fd=!![];}}if(_0x2028fd){logger[_0x3d10('0xf')](_0x3d10('0x16'),_0x592b3e[_0x3d10('0x15')]);_0xeeaced(_0x592b3e);}else{_0x28e9ed({'statusCode':0x194,'message':_0x3d10('0x17')});}}else{_0x28e9ed({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x3d10('0x18')](function(_0x4acf84){logger[_0x3d10('0x19')]('['+[_0x1a9005['toUpperCase']()]+']',_0x4acf84[_0x3d10('0x1a')]);_0x28e9ed(_0x4acf84);});});}function getUser(_0x5b167f,_0x1f5988,_0x25eadc){return function(_0x38da83){return new Promise(function(_0x54dc3f,_0x54d63f){var _0xbdf215={'method':_0x3d10('0x1b'),'uri':_0x25eadc+_0x3d10('0xe'),'json':!![]};_0xbdf215[_0x3d10('0x1c')]=_0x1f5988;logger[_0x3d10('0xf')]('Getting\x20user\x20list');return rp(_0xbdf215)[_0x3d10('0x1d')](function(_0x1ddcdb){if(_0x1ddcdb){var _0x1b6fcd=_0x1ddcdb[_0x3d10('0x11')];var _0x169e1c=![];var _0xb4b413=null;if(_0x38da83['agentEmail']!==null){logger[_0x3d10('0xf')]('Getting\x20user\x20with\x20email',_0x38da83[_0x3d10('0x1e')]);_0x38da83[_0x3d10('0x1f')]=_0x38da83[_0x3d10('0x1e')];for(_0xb4b413=0x0;_0xb4b413<_0x1b6fcd[_0x3d10('0x12')];_0xb4b413++){if(_0x1b6fcd[_0xb4b413][_0x3d10('0x13')]===_0x38da83[_0x3d10('0x1e')]){_0x169e1c=!![];_0x38da83[_0x3d10('0x20')]=_0x1b6fcd[_0xb4b413]['id'];logger[_0x3d10('0xf')]('User\x20found:',_0x38da83[_0x3d10('0x20')]);}}}if(!_0x169e1c){logger[_0x3d10('0xf')](_0x3d10('0x21'));_0x38da83[_0x3d10('0x1f')]=_0x38da83[_0x3d10('0x14')];_0x38da83[_0x3d10('0x20')]=_0x38da83['adminId'];_0x169e1c=!![];}if(_0x169e1c){_0x54dc3f(_0x38da83);}else{_0x54d63f({'statusCode':0x194,'message':_0x3d10('0x17')});}}else{_0x54d63f({'statusCode':0x194,'message':_0x3d10('0x17')});}})['catch'](function(_0x21f201){logger[_0x3d10('0x19')]('['+[_0x5b167f['toUpperCase']()]+']',_0x21f201[_0x3d10('0x1a')]);_0x54d63f(_0x21f201);});});};}function searchContact(_0x1023c3,_0x4fac8b,_0x5de0f0,_0xb39657){return new Promise(function(_0x34bad1,_0x3771db){var _0x3adc5c={'method':_0x3d10('0x1b'),'headers':_0x4fac8b,'uri':_0x1023c3+_0x3d10('0x22')+_0xb39657+'&f='+_0x5de0f0+'&entities=contact','json':!![]};rp(_0x3adc5c)[_0x3d10('0x1d')](function(_0x5c1712){var _0x428903=_[_0x3d10('0x23')](_0x5c1712[_0x3d10('0x24')][_0x3d10('0x24')],[_0x5de0f0,_0xb39657]);_0x34bad1(_0x428903);})[_0x3d10('0x18')](function(_0x5479d4){_0x3771db(_0x5479d4);});});}function getEndUser(_0x56bf55,_0x213eda,_0x35c9c8){return function(_0xa5ef5e){return new Promise(function(_0x56f40a,_0x2dc69d){logger[_0x3d10('0xf')](util[_0x3d10('0x25')](_0x3d10('0x26'),_0xa5ef5e[_0x3d10('0x27')]));searchContact(_0x35c9c8,_0x213eda,_0x3d10('0x28'),_0xa5ef5e[_0x3d10('0x27')])[_0x3d10('0x1d')](function(_0x15b3ac){if(_0x15b3ac){_0xa5ef5e['endUserId']=_0x15b3ac['id'];logger[_0x3d10('0xf')](_0x3d10('0x29'),_0xa5ef5e['endUserId']);return _0x56f40a(_0xa5ef5e);}searchContact(_0x35c9c8,_0x213eda,_0x3d10('0x2a'),_0xa5ef5e[_0x3d10('0x27')])['then'](function(_0x11eef1){if(_0x11eef1){_0xa5ef5e[_0x3d10('0x2b')]=_0x11eef1['id'];logger['info'](_0x3d10('0x2c'),_0xa5ef5e[_0x3d10('0x2b')]);return _0x56f40a(_0xa5ef5e);}createEndUser(_0xa5ef5e,_0x56bf55,_0x213eda,_0x35c9c8)['then'](function(_0x455dda){logger['info']('Contact\x20created:',_0x455dda['endUserId']);return _0x56f40a(_0x455dda);});});})[_0x3d10('0x18')](function(_0x437b3c){_0x2dc69d(_0x437b3c);});});};}function createEndUser(_0x3b5212,_0x17991f,_0x3d013a,_0x38ff4b){return new Promise(function(_0x45cad9,_0x404705){var _0x3c3198=moment();var _0x4e99cb={'method':'POST','uri':_0x38ff4b+_0x3d10('0x2d'),'body':{'contact':{'last_name':_0x3b5212[_0x3d10('0x27')],'work_number':_0x3b5212[_0x3d10('0x27')],'mobile_number':_0x3b5212['contactNumber'],'owner_id':_0x3b5212[_0x3d10('0x20')],'created_at':_0x3c3198[_0x3d10('0x25')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x4e99cb[_0x3d10('0x1c')]=_0x3d013a;logger[_0x3d10('0xf')](_0x3d10('0x2e'));return rp(_0x4e99cb)[_0x3d10('0x1d')](function(_0x1ff4bc){_0x3b5212[_0x3d10('0x2b')]=_0x1ff4bc[_0x3d10('0x2f')]['id'];_0x45cad9(_0x3b5212);})['catch'](function(_0x1e196f){logger[_0x3d10('0x19')]('['+[_0x17991f[_0x3d10('0x30')]()]+']',_0x1e196f[_0x3d10('0x1a')]);_0x404705(_0x1e196f['message']);});});}function getTicket(_0x2c0255,_0x27985c,_0x4344c8,_0x3377f1,_0x572f26){return function(_0x38482a){logger[_0x3d10('0xf')](_0x3d10('0x31'));return new Promise(function(_0x2ced57,_0x3d7dc0){var _0x40b132=moment();var _0x1203c8={'method':_0x3d10('0x32'),'uri':_0x4344c8+_0x3d10('0x33'),'body':{'title':intUtil[_0x3d10('0x34')](_0x3377f1[_0x3d10('0x35')],_0x572f26,'\x20'),'description':intUtil[_0x3d10('0x34')](_0x3377f1[_0x3d10('0x36')],_0x572f26,'\x0a'),'owner_id':_0x38482a[_0x3d10('0x20')],'creater_id':_0x38482a[_0x3d10('0x15')],'targetable_id':_0x38482a['endUserId'],'targetable_type':_0x3d10('0x37'),'created_at':_0x40b132[_0x3d10('0x25')](_0x3d10('0x38')),'due_date':_0x40b132[_0x3d10('0x39')](0x1e,'m')[_0x3d10('0x25')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x1203c8[_0x3d10('0x1c')]=_0x27985c;return rp(_0x1203c8)['then'](function(_0x1fd8f8){_0x38482a[_0x3d10('0x3a')]=_0x1fd8f8[_0x3d10('0x3b')]['id'];logger['info'](_0x3d10('0x3c'),_0x38482a[_0x3d10('0x3a')]);_0x2ced57(_0x38482a);})[_0x3d10('0x18')](function(_0x5bd671){logger[_0x3d10('0x19')]('['+[_0x2c0255[_0x3d10('0x30')]()]+']',_0x5bd671['message']);_0x3d7dc0(_0x5bd671[_0x3d10('0x1a')]);});});};}function emit(_0x23c2ef,_0x592660,_0x283ee7){var _0x57c808={'uri':_0x23c2ef+_0x3d10('0x3d')+_0x283ee7};io['to'](util[_0x3d10('0x25')](_0x3d10('0x3e'),_0x592660))[_0x3d10('0x3f')](_0x3d10('0x40'),_0x57c808);}exports['cs']=function(_0x404959,_0x15ee38,_0x8b6d6c,_0x4c6680,_0x564184,_0x2497d5,_0x281c85,_0x3ac578){var _0x296b87={};var _0x5e5be3={'Authorization':_0x3d10('0x41')+_0x2497d5['apiKey']};_0x2497d5['remoteUri']=intUtil[_0x3d10('0x42')](_0x2497d5[_0x3d10('0x43')]);_0x2497d5[_0x3d10('0x44')]=intUtil[_0x3d10('0x42')](_0x2497d5[_0x3d10('0x44')]);var _0x2dedbd=_0x2497d5[_0x3d10('0x43')];_0x296b87[_0x3d10('0x14')]=_0x2497d5['username'];_0x296b87['contactNumber']=_0x3ac578['toLowerCase']()===_0x3d10('0x45')?_0x15ee38[_0x3d10('0x46')]:_0x15ee38['calleridnum'];_0x296b87[_0x3d10('0x47')]=_0x3ac578===_0x3d10('0x48')||_0x3ac578===_0x3d10('0x49')?_0x3d10('0x48'):'outbound';if(_0x4c6680){_0x296b87[_0x3d10('0x1e')]=_0x4c6680[_0x3d10('0x13')];}var _0x33b646=util['format'](_0x3d10('0x4a'),_0x2497d5['serverUrl'],_0x15ee38[_0x3d10('0x4b')],md5(_0x15ee38[_0x3d10('0x4b')]));if(_0x564184&&_0x564184[_0x3d10('0x4c')]){logger[_0x3d10('0xf')]('[QUEUE]',_0x3d10('0x4d'));_0x15ee38[_0x3d10('0x4e')]=_0x33b646;}else if(_0x281c85&&_0x281c85[_0x3d10('0x4f')]&&_0x281c85[_0x3d10('0x4f')]!==_0x3d10('0x50')){logger[_0x3d10('0xf')](_0x3d10('0x51'),_0x3d10('0x4d'));_0x15ee38[_0x3d10('0x4e')]=_0x33b646;}else{_0x15ee38[_0x3d10('0x4e')]='';}return getAdminId(_0x296b87,_0x3ac578,_0x5e5be3,_0x2dedbd)[_0x3d10('0x1d')](getUser(_0x3ac578,_0x5e5be3,_0x2dedbd))[_0x3d10('0x1d')](getEndUser(_0x3ac578,_0x5e5be3,_0x2dedbd))[_0x3d10('0x1d')](getTicket(_0x3ac578,_0x5e5be3,_0x2dedbd,_0x8b6d6c,_0x15ee38))[_0x3d10('0x1d')](function(_0x151a18){logger['info'](util['format'](_0x3d10('0x52'),_0x151a18[_0x3d10('0x3a')]));if(_0x3ac578!==_0x3d10('0x49')){logger['info']('['+[_0x3ac578['toUpperCase']()]+']',_0x3d10('0x53'));emit(_0x2dedbd,_0x4c6680['name'],_0x151a18['endUserId']);}})[_0x3d10('0x18')](function(_0x4dc8fb){logger[_0x3d10('0x19')]('['+[_0x3ac578['toUpperCase']()]+_0x3d10('0x54'),util[_0x3d10('0x55')](_0x4dc8fb,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/index.js b/server/services/ami/trigger/integration/index.js index 5982c09..d5d5307 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 _0x85e9=['exec','includes','toLowerCase','data1','data2','find','Configurations','data3','queue','outbound','log','EVENT\x20UNKNOWN','vtiger','freshsales','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','util','./zendesk','./sugarcrm','./freshdesk','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','zoho','desk','dynamics365','servicenow'];(function(_0x20f69e,_0x17c9b2){var _0x39c630=function(_0x420bbe){while(--_0x420bbe){_0x20f69e['push'](_0x20f69e['shift']());}};_0x39c630(++_0x17c9b2);}(_0x85e9,0xeb));var _0x985e=function(_0xc3b3ea,_0x10026c){_0xc3b3ea=_0xc3b3ea-0x0;var _0x1d8d48=_0x85e9[_0xc3b3ea];return _0x1d8d48;};'use strict';var _=require('lodash');var util=require(_0x985e('0x0'));var zendesk=require(_0x985e('0x1'));var salesforce=require('./salesforce');var sugarcrm=require(_0x985e('0x2'));var freshdesk=require(_0x985e('0x3'));var zoho=require('./zoho');var desk=require(_0x985e('0x4'));var vtiger=require(_0x985e('0x5'));var servicenow=require(_0x985e('0x6'));var dynamics365=require(_0x985e('0x7'));var freshsales=require(_0x985e('0x8'));var integrations=[_0x985e('0x9'),_0x985e('0xa'),_0x985e('0xb'),_0x985e('0xc'),_0x985e('0xd'),_0x985e('0xe'),'vtiger',_0x985e('0xf'),'freshsales',_0x985e('0x10')];exports[_0x985e('0x11')]=function(_0x390d3b,_0x3edaed,_0x6f6477,_0x2996d2,_0x150866,_0x383ba9){if(_0x6f6477){if(_[_0x985e('0x12')](integrations,_0x390d3b['data1'][_0x985e('0x13')]())){try{var _0x369db8=null;var _0x15bd00='';var _0x210c3e=_0x6f6477[_0x390d3b[_0x985e('0x14')][_0x985e('0x13')]()];if(_0x210c3e){var _0x2a5129=_0x210c3e[_0x390d3b[_0x985e('0x15')]];if(_0x2a5129){var _0x389ece=_[_0x985e('0x16')](_0x2a5129[_0x985e('0x17')],{'id':parseInt(_0x390d3b[_0x985e('0x18')],0xa)});if(_0x389ece){if(_0x2996d2){if(_0x150866&&_0x3edaed[_0x985e('0x19')]){_0x15bd00=_0x985e('0x19');}else if(_0x3edaed['routeId']){_0x15bd00=_0x985e('0x1a');}else{console[_0x985e('0x1b')](_0x985e('0x1c'),_0x3edaed);}}else{_0x15bd00='unmanaged';}switch(_0x390d3b[_0x985e('0x14')]['toLowerCase']()){case _0x985e('0x9'):zendesk[_0x15bd00](_0x390d3b,_0x3edaed,_0x389ece,_0x2996d2,_0x150866,_0x2a5129,_0x383ba9);break;case _0x985e('0xa'):salesforce[_0x15bd00](_0x390d3b,_0x3edaed,_0x389ece,_0x2996d2,_0x150866,_0x2a5129,_0x383ba9);break;case'sugarcrm':sugarcrm[_0x15bd00](_0x390d3b,_0x3edaed,_0x389ece,_0x2996d2,_0x150866,_0x2a5129,_0x383ba9);break;case _0x985e('0xc'):freshdesk[_0x15bd00](_0x390d3b,_0x3edaed,_0x389ece,_0x2996d2,_0x150866,_0x2a5129,_0x383ba9);break;case _0x985e('0xd'):zoho[_0x15bd00](_0x390d3b,_0x3edaed,_0x389ece,_0x2996d2,_0x150866,_0x2a5129,_0x383ba9);break;case _0x985e('0xe'):desk[_0x15bd00](_0x390d3b,_0x3edaed,_0x389ece,_0x2996d2,_0x150866,_0x2a5129,_0x383ba9);break;case _0x985e('0x1d'):vtiger[_0x15bd00](_0x390d3b,_0x3edaed,_0x389ece,_0x2996d2,_0x150866,_0x2a5129,_0x383ba9);break;case _0x985e('0x1e'):freshsales['cs'](_0x390d3b,_0x3edaed,_0x389ece,_0x2996d2,_0x150866,_0x2a5129,_0x383ba9,_0x15bd00);break;case _0x985e('0x10'):servicenow['cs'](_0x390d3b,_0x3edaed,_0x389ece,_0x2996d2,_0x150866,_0x2a5129,_0x383ba9,_0x15bd00);break;case _0x985e('0xf'):dynamics365['cs'](_0x390d3b,_0x3edaed,_0x389ece,_0x2996d2,_0x150866,_0x2a5129,_0x383ba9,_0x15bd00);break;default:console['log']('unknown\x20integration');}}else{_0x369db8=require(_0x985e('0x1f'))(_0x390d3b['data1']['toLowerCase']());_0x369db8[_0x985e('0x20')](_0x985e('0x21'),util[_0x985e('0x22')](_0x985e('0x23'),_0x390d3b[_0x985e('0x14')][_0x985e('0x13')](),_0x390d3b[_0x985e('0x18')]));}}else{_0x369db8=require(_0x985e('0x1f'))(_0x390d3b['data1'][_0x985e('0x13')]());_0x369db8[_0x985e('0x20')](_0x985e('0x21'),util[_0x985e('0x22')]('%s\x20account\x20#%s\x20not\x20found',_0x390d3b[_0x985e('0x14')][_0x985e('0x13')](),_0x390d3b[_0x985e('0x15')]));}}else{}}catch(_0x44a110){console[_0x985e('0x20')](_0x44a110);}}}}; \ No newline at end of file +var _0xcd9b=['lodash','util','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./freshsales','zendesk','sugarcrm','freshdesk','zoho','vtiger','exec','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','salesforce','freshsales','servicenow','dynamics365','unknown\x20integration','../../../../config/logger','[EXEC]','error','format','%s\x20account\x20#%s\x20not\x20found'];(function(_0x1f0724,_0x3a58bf){var _0x253ffb=function(_0x3b4c72){while(--_0x3b4c72){_0x1f0724['push'](_0x1f0724['shift']());}};_0x253ffb(++_0x3a58bf);}(_0xcd9b,0x14d));var _0xbcd9=function(_0x2b95f1,_0x3aec6a){_0x2b95f1=_0x2b95f1-0x0;var _0x2aa366=_0xcd9b[_0x2b95f1];return _0x2aa366;};'use strict';var _=require(_0xbcd9('0x0'));var util=require(_0xbcd9('0x1'));var zendesk=require('./zendesk');var salesforce=require('./salesforce');var sugarcrm=require(_0xbcd9('0x2'));var freshdesk=require(_0xbcd9('0x3'));var zoho=require(_0xbcd9('0x4'));var desk=require(_0xbcd9('0x5'));var vtiger=require(_0xbcd9('0x6'));var servicenow=require('./servicenow');var dynamics365=require('./dynamics365');var freshsales=require(_0xbcd9('0x7'));var integrations=[_0xbcd9('0x8'),'salesforce',_0xbcd9('0x9'),_0xbcd9('0xa'),_0xbcd9('0xb'),'desk',_0xbcd9('0xc'),'dynamics365','freshsales','servicenow'];exports[_0xbcd9('0xd')]=function(_0x2e470c,_0x59c48b,_0x4deb0c,_0x3e0d3c,_0x581d77,_0x37048c){if(_0x4deb0c){if(_[_0xbcd9('0xe')](integrations,_0x2e470c[_0xbcd9('0xf')][_0xbcd9('0x10')]())){try{var _0x13a347=null;var _0x557417='';var _0x4869f2=_0x4deb0c[_0x2e470c[_0xbcd9('0xf')][_0xbcd9('0x10')]()];if(_0x4869f2){var _0x258837=_0x4869f2[_0x2e470c[_0xbcd9('0x11')]];if(_0x258837){var _0x4185ce=_[_0xbcd9('0x12')](_0x258837[_0xbcd9('0x13')],{'id':parseInt(_0x2e470c[_0xbcd9('0x14')],0xa)});if(_0x4185ce){if(_0x3e0d3c){if(_0x581d77&&_0x59c48b['queue']){_0x557417=_0xbcd9('0x15');}else if(_0x59c48b[_0xbcd9('0x16')]){_0x557417=_0xbcd9('0x17');}else{console[_0xbcd9('0x18')](_0xbcd9('0x19'),_0x59c48b);}}else{_0x557417=_0xbcd9('0x1a');}switch(_0x2e470c['data1'][_0xbcd9('0x10')]()){case _0xbcd9('0x8'):zendesk[_0x557417](_0x2e470c,_0x59c48b,_0x4185ce,_0x3e0d3c,_0x581d77,_0x258837,_0x37048c);break;case _0xbcd9('0x1b'):salesforce[_0x557417](_0x2e470c,_0x59c48b,_0x4185ce,_0x3e0d3c,_0x581d77,_0x258837,_0x37048c);break;case'sugarcrm':sugarcrm[_0x557417](_0x2e470c,_0x59c48b,_0x4185ce,_0x3e0d3c,_0x581d77,_0x258837,_0x37048c);break;case _0xbcd9('0xa'):freshdesk[_0x557417](_0x2e470c,_0x59c48b,_0x4185ce,_0x3e0d3c,_0x581d77,_0x258837,_0x37048c);break;case _0xbcd9('0xb'):zoho[_0x557417](_0x2e470c,_0x59c48b,_0x4185ce,_0x3e0d3c,_0x581d77,_0x258837,_0x37048c);break;case'desk':desk[_0x557417](_0x2e470c,_0x59c48b,_0x4185ce,_0x3e0d3c,_0x581d77,_0x258837,_0x37048c);break;case'vtiger':vtiger[_0x557417](_0x2e470c,_0x59c48b,_0x4185ce,_0x3e0d3c,_0x581d77,_0x258837,_0x37048c);break;case _0xbcd9('0x1c'):freshsales['cs'](_0x2e470c,_0x59c48b,_0x4185ce,_0x3e0d3c,_0x581d77,_0x258837,_0x37048c,_0x557417);break;case _0xbcd9('0x1d'):servicenow['cs'](_0x2e470c,_0x59c48b,_0x4185ce,_0x3e0d3c,_0x581d77,_0x258837,_0x37048c,_0x557417);break;case _0xbcd9('0x1e'):dynamics365['cs'](_0x2e470c,_0x59c48b,_0x4185ce,_0x3e0d3c,_0x581d77,_0x258837,_0x37048c,_0x557417);break;default:console['log'](_0xbcd9('0x1f'));}}else{_0x13a347=require(_0xbcd9('0x20'))(_0x2e470c[_0xbcd9('0xf')][_0xbcd9('0x10')]());_0x13a347['error'](_0xbcd9('0x21'),util['format']('%s\x20configuration\x20#%s\x20not\x20found',_0x2e470c[_0xbcd9('0xf')][_0xbcd9('0x10')](),_0x2e470c[_0xbcd9('0x14')]));}}else{_0x13a347=require(_0xbcd9('0x20'))(_0x2e470c['data1']['toLowerCase']());_0x13a347[_0xbcd9('0x22')](_0xbcd9('0x21'),util[_0xbcd9('0x23')](_0xbcd9('0x24'),_0x2e470c['data1'][_0xbcd9('0x10')](),_0x2e470c['data2']));}}else{}}catch(_0x9da343){console[_0xbcd9('0x22')](_0x9da343);}}}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/salesforce.js b/server/services/ami/trigger/integration/salesforce.js index e72d2cb..9b8afca 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 _0x7321=['Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','instanceUrl','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','error','outbound','none','[OUTBOUND]','destcalleridnum','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','%s/%s/e','Salesforce\x20account\x20type\x20not\x20recognized','catch','unmanaged','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','moment','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','emit','assign','getString','Subjects','Descriptions','ticketType','Task','ActivityDate','utc','IsRecurrence','contact','endUserType','lead','WhoId','account','WhatId','Case','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','User','find','execute','then','length','Email','Agent\x20%s\x20found.','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','display_name','resolve','user_id','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Contact','Account','first','attributes','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','format','Caller\x20-\x20%s','Company','No\x20Company','','forEach','picklist','type','idField','content','variableName','Variable','name','toString','password','concat','securityToken'];(function(_0x9386ea,_0x19ac6e){var _0x4dd274=function(_0xa86f0a){while(--_0xa86f0a){_0x9386ea['push'](_0x9386ea['shift']());}};_0x4dd274(++_0x19ac6e);}(_0x7321,0xae));var _0x1732=function(_0x436e0a,_0x1fb72c){_0x436e0a=_0x436e0a-0x0;var _0x15759d=_0x7321[_0x436e0a];return _0x15759d;};'use strict';var _=require('lodash');var rp=require('request-promise');var moment=require(_0x1732('0x0'));var BPromise=require(_0x1732('0x1'));var md5=require(_0x1732('0x2'));var jsforce=require(_0x1732('0x3'));var util=require(_0x1732('0x4'));var Redis=require(_0x1732('0x5'));var intUtil=require(_0x1732('0x6'));var config=require(_0x1732('0x7'));var logger=require(_0x1732('0x8'))(_0x1732('0x9'));config[_0x1732('0xa')]=_[_0x1732('0xb')](config[_0x1732('0xa')],{'host':_0x1732('0xc'),'port':0x18eb});var io=require(_0x1732('0xd'))(new Redis(config[_0x1732('0xa')]));function emit(_0x13ae4e,_0xf70cba,_0x39c781){io['to'](_0x13ae4e)[_0x1732('0xe')](_0xf70cba,_0x39c781);}function getTicket(_0x31182f,_0x219c4c,_0x1d188b,_0x4f0f44,_0x1441dd,_0xe3f735,_0x55846f,_0x59ff5d){var _0x390456=Object[_0x1732('0xf')]({},{'OwnerId':_0x219c4c['id'],'Subject':intUtil[_0x1732('0x10')](_0x4f0f44[_0x1732('0x11')],_0x1441dd,'\x20'),'Description':intUtil['getString'](_0x4f0f44[_0x1732('0x12')],_0x1441dd,'\x0a')},getCustomFields(_0xe3f735,_0x1441dd));if(_0x1d188b){if(_0x4f0f44[_0x1732('0x13')]===_0x1732('0x14')){_0x390456[_0x1732('0x15')]=moment[_0x1732('0x16')]();_0x390456['IsReminderSet']=![];_0x390456[_0x1732('0x17')]=![];if(_0x1d188b['endUserType']===_0x1732('0x18')||_0x1d188b[_0x1732('0x19')]===_0x1732('0x1a')){_0x390456[_0x1732('0x1b')]=_0x1d188b['id'];}else if(_0x1d188b['endUserType']===_0x1732('0x1c')){_0x390456[_0x1732('0x1d')]=_0x1d188b['id'];}}else if(_0x4f0f44['ticketType']===_0x1732('0x1e')){if(_0x1d188b[_0x1732('0x19')]===_0x1732('0x18')){_0x390456[_0x1732('0x1f')]=_0x1d188b['id'];}else if(_0x1d188b[_0x1732('0x19')]===_0x1732('0x1c')){_0x390456[_0x1732('0x20')]=_0x1d188b['id'];}else if(_0x1d188b['endUserType']===_0x1732('0x1a')&&_0x4f0f44[_0x1732('0x21')]){_0x390456[_0x4f0f44[_0x1732('0x21')]]=_0x1d188b['id'];}else{logger[_0x1732('0x22')](_0x1732('0x23'));}}}return _0x55846f[_0x1732('0x24')](_0x4f0f44[_0x1732('0x13')])[_0x1732('0x25')](_0x390456);}function getUser(_0x5115f7,_0x744165,_0x4cb144){if(!_[_0x1732('0x26')](_0x744165)&&intUtil['validateEmail'](_0x744165)){var _0x23cd8a={'Email':_0x744165};var _0x20d8bf={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x4cb144[_0x1732('0x24')](_0x1732('0x27'))[_0x1732('0x28')](_0x23cd8a,_0x20d8bf)[_0x1732('0x29')]()[_0x1732('0x2a')](function(_0x11a4a2){if(_0x11a4a2[_0x1732('0x2b')]){var _0x38f032=_[_0x1732('0x28')](_0x11a4a2,function(_0x5013dc){return _0x5013dc[_0x1732('0x2c')]===_0x744165;});if(_0x38f032){logger['info'](_0x1732('0x2d'),_0x744165);return BPromise['resolve']({'id':_0x38f032['Id'],'name':_0x38f032[_0x1732('0x2e')]});}}else{logger['info'](_0x1732('0x2f'),_0x744165);return _0x4cb144[_0x1732('0x30')]()[_0x1732('0x2a')](function(_0x1bb7a2){return BPromise['resolve']({'id':_0x1bb7a2['user_id'],'name':_0x1bb7a2[_0x1732('0x31')]});});}});}else{logger[_0x1732('0x22')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x744165);return _0x4cb144[_0x1732('0x30')]()[_0x1732('0x2a')](function(_0x38bc4f){return BPromise[_0x1732('0x32')]({'id':_0x38bc4f[_0x1732('0x33')],'name':_0x38bc4f[_0x1732('0x31')]});});}}function getEndUser(_0x1baec8,_0x58d435,_0x4a6899,_0x1ae3b8,_0x44a53c){var _0x1518e6={'$or':{'Phone':_0x1ae3b8}};var _0x125f9f={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x1732('0x32')]()[_0x1732('0x2a')](function(){logger[_0x1732('0x22')](_0x1732('0x34'),_0x1ae3b8,_0x58d435[_0x1732('0x35')]);switch(_0x58d435['moduleSearch']){case _0x1732('0x36'):var _0x5bcab4=_[_0x1732('0x37')](_0x1518e6);if(_0x58d435[_0x1732('0x38')]){var _0x425626={};_0x425626[_0x58d435[_0x1732('0x38')]]=_0x1ae3b8;_[_0x1732('0x39')](_0x5bcab4[_0x1732('0x3a')],_0x425626);}return _0x44a53c['sobject']('Contact')[_0x1732('0x28')](_0x5bcab4,_0x125f9f)[_0x1732('0x29')]()['then'](function(_0x36f98d){if(_0x36f98d&&_0x36f98d[_0x1732('0x2b')]){return _0x36f98d;}else{var _0x32bf5e=_['cloneDeep'](_0x1518e6);if(_0x58d435['additionalSearchLead']){var _0x3f62c7={};_0x3f62c7[_0x58d435[_0x1732('0x3b')]]=_0x1ae3b8;_[_0x1732('0x39')](_0x32bf5e[_0x1732('0x3a')],_0x3f62c7);}return _0x44a53c[_0x1732('0x24')](_0x1732('0x3c'))[_0x1732('0x28')](_0x32bf5e,_0x125f9f);}});case _0x1732('0x3d'):var _0x5335c3=_[_0x1732('0x37')](_0x1518e6);if(_0x58d435['additionalSearchAccount']){var _0x425626={};_0x425626[_0x58d435[_0x1732('0x3e')]]=_0x1ae3b8;_[_0x1732('0x39')](_0x5335c3[_0x1732('0x3a')],_0x425626);}return _0x44a53c[_0x1732('0x24')]('Account')[_0x1732('0x28')](_0x5335c3,_0x125f9f)[_0x1732('0x29')]()[_0x1732('0x2a')](function(_0x2a7d93){if(_0x2a7d93&&_0x2a7d93['length']){return _0x2a7d93;}else{var _0x3e64e4=_[_0x1732('0x37')](_0x1518e6);if(_0x58d435[_0x1732('0x38')]){var _0x40444d={};_0x40444d[_0x58d435[_0x1732('0x38')]]=_0x1ae3b8;_[_0x1732('0x39')](_0x3e64e4[_0x1732('0x3a')],_0x40444d);}return _0x44a53c['sobject']('Contact')['find'](_0x3e64e4,_0x125f9f)[_0x1732('0x2a')](function(_0x1dbfdb){if(_0x1dbfdb&&_0x1dbfdb[_0x1732('0x2b')]){return _0x1dbfdb;}else{var _0x53c8e2=_[_0x1732('0x37')](_0x1518e6);if(_0x58d435[_0x1732('0x3b')]){var _0x4db22d={};_0x4db22d[_0x58d435[_0x1732('0x3b')]]=_0x1ae3b8;_['merge'](_0x53c8e2['$or'],_0x4db22d);}return _0x44a53c[_0x1732('0x24')](_0x1732('0x3c'))[_0x1732('0x28')](_0x53c8e2,_0x125f9f);}});}});case'contact':var _0x5bcab4=_['cloneDeep'](_0x1518e6);if(_0x58d435['additionalSearchContact']){var _0x425626={};_0x425626[_0x58d435['additionalSearchContact']]=_0x1ae3b8;_[_0x1732('0x39')](_0x5bcab4[_0x1732('0x3a')],_0x425626);}return _0x44a53c[_0x1732('0x24')](_0x1732('0x3f'))[_0x1732('0x28')](_0x5bcab4,_0x125f9f)[_0x1732('0x29')]();case _0x1732('0x1a'):var _0x143447=_['cloneDeep'](_0x1518e6);if(_0x58d435[_0x1732('0x3b')]){var _0x425626={};_0x425626[_0x58d435[_0x1732('0x3b')]]=_0x1ae3b8;_[_0x1732('0x39')](_0x143447['$or'],_0x425626);}return _0x44a53c['sobject'](_0x1732('0x3c'))[_0x1732('0x28')](_0x143447,_0x125f9f);case _0x1732('0x1c'):var _0x5335c3=_[_0x1732('0x37')](_0x1518e6);if(_0x58d435[_0x1732('0x3e')]){var _0x425626={};_0x425626[_0x58d435['additionalSearchAccount']]=_0x1ae3b8;_['merge'](_0x5335c3[_0x1732('0x3a')],_0x425626);}return _0x44a53c[_0x1732('0x24')](_0x1732('0x40'))[_0x1732('0x28')](_0x5335c3,_0x125f9f);default:return null;}})[_0x1732('0x2a')](function(_0x1e4268){if(_0x1e4268&&_0x1e4268[_0x1732('0x2b')]){var _0x301ba5=_[_0x1732('0x41')](_0x1e4268);if(_0x301ba5){return BPromise[_0x1732('0x32')]({'id':_0x301ba5['Id'],'name':_0x301ba5[_0x1732('0x2e')],'phone':_0x301ba5['Phone'],'endUserType':_0x301ba5[_0x1732('0x42')]['type'][_0x1732('0x43')]()});}}})[_0x1732('0x2a')](function(_0x374d76){if(_0x374d76){logger[_0x1732('0x22')](_0x1732('0x44'),_0x374d76[_0x1732('0x19')],_0x1ae3b8);return BPromise['resolve'](_0x374d76);}else{logger[_0x1732('0x22')](_0x1732('0x45'),_0x1ae3b8);var _0x5502d3={'Phone':_0x1ae3b8};if(_0x58d435[_0x1732('0x46')]){if(_0x58d435[_0x1732('0x46')]===_0x1732('0x18')){logger['info'](_0x1732('0x47'),_0x1ae3b8,_0x58d435[_0x1732('0x46')]);_0x5502d3[_0x1732('0x48')]=_0x4a6899!==''?_0x4a6899:util[_0x1732('0x49')](_0x1732('0x4a'),_0x1ae3b8);}else if(_0x58d435[_0x1732('0x46')]===_0x1732('0x1a')){logger[_0x1732('0x22')](_0x1732('0x47'),_0x1ae3b8,_0x58d435['moduleCreate']);_0x5502d3['LastName']=_0x4a6899!==''?_0x4a6899:util[_0x1732('0x49')](_0x1732('0x4a'),_0x1ae3b8);_0x5502d3[_0x1732('0x4b')]=_0x1732('0x4c');}else if(_0x58d435[_0x1732('0x46')]===_0x1732('0x1c')){logger['info'](_0x1732('0x47'),_0x1ae3b8,_0x58d435[_0x1732('0x46')]);_0x5502d3['Name']=_0x4a6899!==_0x1732('0x4d')?_0x4a6899:util[_0x1732('0x49')](_0x1732('0x4a'),_0x1ae3b8);}else{return null;}}return _0x44a53c[_0x1732('0x24')](_['upperFirst'](_0x58d435[_0x1732('0x46')]))[_0x1732('0x25')](_0x5502d3)['then'](function(_0x15ed26){return BPromise[_0x1732('0x32')]({'id':_0x15ed26['id'],'endUserType':_0x58d435[_0x1732('0x46')]});});}});}function getCustomFields(_0x12bca9,_0xb6d5b5){var _0xbe6748={};if(_0x12bca9[_0x1732('0x2b')]>0x0){_[_0x1732('0x4e')](_0x12bca9,function(_0x3c590c){if(_['includes'](['string',_0x1732('0x4f')],_0x3c590c[_0x1732('0x50')])&&_0x3c590c[_0x1732('0x51')]){_0xbe6748[_0x3c590c[_0x1732('0x51')]]=_0x3c590c[_0x1732('0x52')]['toString']();}else if(_0x3c590c[_0x1732('0x50')]==='variable'&&_0x3c590c[_0x1732('0x53')]&&_0x3c590c[_0x1732('0x51')]){_0xb6d5b5[_0x3c590c['variableName']]&&(_0xbe6748[_0x3c590c[_0x1732('0x51')]]=_0xb6d5b5[_0x3c590c[_0x1732('0x53')]]['toString']());}else if(_0x3c590c[_0x1732('0x50')]==='customVariable'&&_0x3c590c[_0x1732('0x54')]&&_0x3c590c['Variable'][_0x1732('0x55')]&&_0x3c590c[_0x1732('0x51')]){_0xb6d5b5[_0x3c590c[_0x1732('0x54')]['name'][_0x1732('0x43')]()]&&(_0xbe6748[_0x3c590c['idField']]=_0xb6d5b5[_0x3c590c[_0x1732('0x54')][_0x1732('0x55')][_0x1732('0x43')]()][_0x1732('0x56')]());}});}return _0xbe6748;}function getConnection(_0x4f971b){var _0x381b9f=_0x4f971b[_0x1732('0x57')][_0x1732('0x58')](_0x4f971b[_0x1732('0x59')]);var _0x2b7f1b=new jsforce[(_0x1732('0x5a'))]({'oauth2':{'loginUrl':_0x4f971b[_0x1732('0x5b')]||_0x1732('0x5c'),'clientId':_0x4f971b[_0x1732('0x5d')],'clientSecret':_0x4f971b[_0x1732('0x5e')]}});return _0x2b7f1b[_0x1732('0x5f')](_0x4f971b['username'],_0x381b9f)[_0x1732('0x2a')](function(){logger[_0x1732('0x22')](_0x1732('0x60'));return _0x2b7f1b;});}exports[_0x1732('0x61')]=function(_0x4a6da8,_0x5c5755,_0x2b31a5,_0x2394e9,_0x4e031f,_0x393d2d){var _0x5aff47,_0x4d975a,_0x49e13f,_0x509138;_0x393d2d[_0x1732('0x62')]=intUtil[_0x1732('0x63')](_0x393d2d['serverUrl']);_0x393d2d[_0x1732('0x5b')]=intUtil['stripTrailingSlash'](_0x393d2d[_0x1732('0x5b')]);if(_0x4e031f&&_0x4e031f[_0x1732('0x64')]){logger[_0x1732('0x22')](_0x1732('0x65'),_0x1732('0x66'));_0x5c5755[_0x1732('0x67')]=util['format'](_0x1732('0x68'),_0x393d2d['serverUrl'],_0x5c5755['uniqueid'],md5(_0x5c5755[_0x1732('0x69')]));}else{_0x5c5755[_0x1732('0x67')]='';}return getConnection(_0x393d2d)[_0x1732('0x2a')](function(_0x569979){_0x509138=_0x569979;return getUser(_0x393d2d,_0x2394e9[_0x1732('0x6a')],_0x509138);})['then'](function(_0x44b3ed){_0x5aff47=_0x44b3ed;return getEndUser(_0x393d2d,_0x2b31a5,_0x5c5755[_0x1732('0x6b')],_0x5c5755[_0x1732('0x6c')],_0x509138);})[_0x1732('0x2a')](function(_0x26ab61){_0x4d975a=_0x26ab61;return getTicket(_0x393d2d,_0x5aff47,_0x4d975a,_0x2b31a5,_0x5c5755,_0x2b31a5[_0x1732('0x6d')],_0x509138,'queue');})[_0x1732('0x2a')](function(_0x473597){_0x49e13f=_0x473597;logger['info'](_0x1732('0x6e'),_0x49e13f['id']);logger['info'](_0x1732('0x6f'),_0x49e13f['id'],_0x2394e9[_0x1732('0x55')],_0x393d2d[_0x1732('0x50')]);switch(_0x393d2d[_0x1732('0x50')]){case _0x1732('0x70'):emit(util[_0x1732('0x49')](_0x1732('0x71'),_0x2394e9[_0x1732('0x55')]),_0x1732('0x72'),{'recordId':_0x49e13f['id']});break;case _0x1732('0x73'):emit(util[_0x1732('0x49')](_0x1732('0x71'),_0x2394e9[_0x1732('0x55')]),'trigger:browser:url',{'uri':util[_0x1732('0x49')]('%s/%s/e',_0x509138[_0x1732('0x74')],_0x49e13f['id'])});break;default:logger['error'](_0x1732('0x75'));}})['catch'](function(_0x3a5db3){logger[_0x1732('0x76')](_0x1732('0x65'),_0x3a5db3);});};exports[_0x1732('0x77')]=function(_0x5b84d9,_0x1a9cb4,_0x141dd3,_0x470443,_0x2de0e6,_0x347244,_0x50d1a8){var _0x113489,_0x51c966,_0x230541,_0x20b9f5;_0x347244['serverUrl']=intUtil['stripTrailingSlash'](_0x347244[_0x1732('0x62')]);_0x347244[_0x1732('0x5b')]=intUtil[_0x1732('0x63')](_0x347244[_0x1732('0x5b')]);if(_0x50d1a8&&_0x50d1a8['recordingFormat']&&_0x50d1a8['recordingFormat']!==_0x1732('0x78')){logger[_0x1732('0x22')](_0x1732('0x79'),_0x1732('0x66'));_0x1a9cb4[_0x1732('0x67')]=util[_0x1732('0x49')](_0x1732('0x68'),_0x347244[_0x1732('0x62')],_0x1a9cb4[_0x1732('0x69')],md5(_0x1a9cb4[_0x1732('0x69')]));}return getConnection(_0x347244)['then'](function(_0x596e73){_0x20b9f5=_0x596e73;return getUser(_0x347244,_0x470443[_0x1732('0x6a')],_0x20b9f5);})[_0x1732('0x2a')](function(_0x3f4e2b){_0x113489=_0x3f4e2b;return getEndUser(_0x347244,_0x141dd3,_0x1a9cb4['destcalleridname'],_0x1a9cb4[_0x1732('0x7a')],_0x20b9f5);})[_0x1732('0x2a')](function(_0xb584b){_0x51c966=_0xb584b;return getTicket(_0x347244,_0x113489,_0x51c966,_0x141dd3,_0x1a9cb4,_0x141dd3['Fields'],_0x20b9f5,_0x1732('0x77'));})['then'](function(_0x498c29){_0x230541=_0x498c29;logger[_0x1732('0x22')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x230541['id']);logger[_0x1732('0x22')](_0x1732('0x7b'),_0x230541['id'],_0x470443[_0x1732('0x55')],_0x347244[_0x1732('0x50')]);switch(_0x347244['type']){case'integrationTab':emit(util[_0x1732('0x49')](_0x1732('0x71'),_0x470443[_0x1732('0x55')]),'trigger:salesforce:display',{'recordId':_0x230541['id']});break;case _0x1732('0x73'):emit(util[_0x1732('0x49')]('user:%s',_0x470443[_0x1732('0x55')]),'trigger:browser:url',{'uri':util[_0x1732('0x49')](_0x1732('0x7c'),_0x20b9f5['instanceUrl'],_0x230541['id'])});break;default:logger[_0x1732('0x76')](_0x1732('0x79'),_0x1732('0x7d'));}})[_0x1732('0x7e')](function(_0x3720de){logger[_0x1732('0x76')]('[OUTBOUND]',_0x3720de);});};exports[_0x1732('0x7f')]=function(_0x2c49bd,_0xf86134,_0x13bdc5,_0x725ae2,_0x559157,_0x9e292c){var _0xad13a5,_0x5674d9,_0x1bd27b,_0x41f8fd;_0x9e292c[_0x1732('0x62')]=intUtil[_0x1732('0x63')](_0x9e292c[_0x1732('0x62')]);_0x9e292c[_0x1732('0x5b')]=intUtil['stripTrailingSlash'](_0x9e292c[_0x1732('0x5b')]);if(_0x559157&&_0x559157[_0x1732('0x64')]){logger[_0x1732('0x22')]('['+_0xf86134[_0x1732('0x80')][_0x1732('0x81')]()+']','Recording\x20is\x20enabled!');_0xf86134[_0x1732('0x67')]=util[_0x1732('0x49')](_0x1732('0x68'),_0x9e292c[_0x1732('0x62')],_0xf86134[_0x1732('0x69')],md5(_0xf86134[_0x1732('0x69')]));}else{_0xf86134[_0x1732('0x67')]='';}return getConnection(_0x9e292c)[_0x1732('0x2a')](function(_0x19cd22){_0x41f8fd=_0x19cd22;if(!_['isNil'](_0x725ae2)){return getUser(_0x9e292c,_0x725ae2[_0x1732('0x55')],_0x41f8fd);}else{return getUser(_0x9e292c,null,_0x41f8fd);}})[_0x1732('0x2a')](function(_0x4228ef){_0xad13a5=_0x4228ef;return getEndUser(_0x9e292c,_0x13bdc5,_0xf86134[_0x1732('0x6b')],_0xf86134[_0x1732('0x6c')],_0x41f8fd);})['then'](function(_0x4c78d7){_0x5674d9=_0x4c78d7;return getTicket(_0x9e292c,_0xad13a5,_0x5674d9,_0x13bdc5,_0xf86134,_0x13bdc5[_0x1732('0x6d')],_0x41f8fd);})[_0x1732('0x2a')](function(_0x2753dd){_0x1bd27b=_0x2753dd;logger[_0x1732('0x22')]('['+_0xf86134[_0x1732('0x80')][_0x1732('0x81')]()+_0x1732('0x82'),_0x1bd27b['id']);logger['info']('['+_0xf86134[_0x1732('0x80')][_0x1732('0x81')]()+_0x1732('0x83'),_0x9e292c['type']);})[_0x1732('0x7e')](function(_0x236062){logger['error']('['+_0xf86134[_0x1732('0x80')][_0x1732('0x81')]()+']',_0x236062);});}; \ No newline at end of file +var _0xa8c8=['User','find','then','Email','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','resolve','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','$or','Contact','execute','length','additionalSearchLead','Lead','additionalSearchAccount','Account','merge','Name','Phone','type','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','LastName','','Caller\x20-\x20%s','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','format','No\x20Company','upperFirst','forEach','includes','string','picklist','idField','content','variable','variableName','customVariable','Variable','name','toLowerCase','toString','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','calleridname','calleridnum','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','email','destcalleridname','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','monitor_format','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','request-promise','moment','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','localhost','socket.io-emitter','emit','getString','Subjects','Descriptions','ticketType','ActivityDate','utc','IsRecurrence','endUserType','contact','WhoId','WhatId','ContactId','account','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail'];(function(_0x50551e,_0x4ceff3){var _0x5a08c1=function(_0x888236){while(--_0x888236){_0x50551e['push'](_0x50551e['shift']());}};_0x5a08c1(++_0x4ceff3);}(_0xa8c8,0xdf));var _0x8a8c=function(_0x4e2f8d,_0x449bd0){_0x4e2f8d=_0x4e2f8d-0x0;var _0x404bb9=_0xa8c8[_0x4e2f8d];return _0x404bb9;};'use strict';var _=require('lodash');var rp=require(_0x8a8c('0x0'));var moment=require(_0x8a8c('0x1'));var BPromise=require(_0x8a8c('0x2'));var md5=require(_0x8a8c('0x3'));var jsforce=require(_0x8a8c('0x4'));var util=require(_0x8a8c('0x5'));var Redis=require(_0x8a8c('0x6'));var intUtil=require(_0x8a8c('0x7'));var config=require(_0x8a8c('0x8'));var logger=require(_0x8a8c('0x9'))(_0x8a8c('0xa'));config[_0x8a8c('0xb')]=_['defaults'](config[_0x8a8c('0xb')],{'host':_0x8a8c('0xc'),'port':0x18eb});var io=require(_0x8a8c('0xd'))(new Redis(config[_0x8a8c('0xb')]));function emit(_0x4ad4d5,_0x415436,_0x16d653){io['to'](_0x4ad4d5)[_0x8a8c('0xe')](_0x415436,_0x16d653);}function getTicket(_0x26a27f,_0xfc6a49,_0x47a884,_0x476ace,_0x22cc4e,_0x568645,_0x414b76,_0x1bd411){var _0x34798c=Object['assign']({},{'OwnerId':_0xfc6a49['id'],'Subject':intUtil[_0x8a8c('0xf')](_0x476ace[_0x8a8c('0x10')],_0x22cc4e,'\x20'),'Description':intUtil[_0x8a8c('0xf')](_0x476ace[_0x8a8c('0x11')],_0x22cc4e,'\x0a')},getCustomFields(_0x568645,_0x22cc4e));if(_0x47a884){if(_0x476ace[_0x8a8c('0x12')]==='Task'){_0x34798c[_0x8a8c('0x13')]=moment[_0x8a8c('0x14')]();_0x34798c['IsReminderSet']=![];_0x34798c[_0x8a8c('0x15')]=![];if(_0x47a884[_0x8a8c('0x16')]===_0x8a8c('0x17')||_0x47a884['endUserType']==='lead'){_0x34798c[_0x8a8c('0x18')]=_0x47a884['id'];}else if(_0x47a884[_0x8a8c('0x16')]==='account'){_0x34798c[_0x8a8c('0x19')]=_0x47a884['id'];}}else if(_0x476ace['ticketType']==='Case'){if(_0x47a884[_0x8a8c('0x16')]===_0x8a8c('0x17')){_0x34798c[_0x8a8c('0x1a')]=_0x47a884['id'];}else if(_0x47a884['endUserType']===_0x8a8c('0x1b')){_0x34798c['AccountId']=_0x47a884['id'];}else if(_0x47a884[_0x8a8c('0x16')]==='lead'&&_0x476ace[_0x8a8c('0x1c')]){_0x34798c[_0x476ace[_0x8a8c('0x1c')]]=_0x47a884['id'];}else{logger[_0x8a8c('0x1d')](_0x8a8c('0x1e'));}}}return _0x414b76[_0x8a8c('0x1f')](_0x476ace[_0x8a8c('0x12')])[_0x8a8c('0x20')](_0x34798c);}function getUser(_0x5aa42e,_0x7d09d5,_0x31fc57){if(!_[_0x8a8c('0x21')](_0x7d09d5)&&intUtil[_0x8a8c('0x22')](_0x7d09d5)){var _0x33ee75={'Email':_0x7d09d5};var _0x5ac39c={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x31fc57[_0x8a8c('0x1f')](_0x8a8c('0x23'))[_0x8a8c('0x24')](_0x33ee75,_0x5ac39c)['execute']()[_0x8a8c('0x25')](function(_0x1439c2){if(_0x1439c2['length']){var _0x2ce72c=_['find'](_0x1439c2,function(_0x4ed01f){return _0x4ed01f[_0x8a8c('0x26')]===_0x7d09d5;});if(_0x2ce72c){logger['info']('Agent\x20%s\x20found.',_0x7d09d5);return BPromise['resolve']({'id':_0x2ce72c['Id'],'name':_0x2ce72c['Name']});}}else{logger[_0x8a8c('0x1d')](_0x8a8c('0x27'),_0x7d09d5);return _0x31fc57[_0x8a8c('0x28')]()[_0x8a8c('0x25')](function(_0x13e8c8){return BPromise[_0x8a8c('0x29')]({'id':_0x13e8c8[_0x8a8c('0x2a')],'name':_0x13e8c8[_0x8a8c('0x2b')]});});}});}else{logger[_0x8a8c('0x1d')](_0x8a8c('0x27'),_0x7d09d5);return _0x31fc57['identity']()['then'](function(_0x5169ff){return BPromise[_0x8a8c('0x29')]({'id':_0x5169ff[_0x8a8c('0x2a')],'name':_0x5169ff[_0x8a8c('0x2b')]});});}}function getEndUser(_0xaa3f71,_0x238e6c,_0x402ad9,_0x42e807,_0x3ac6f3){var _0x3fea52={'$or':{'Phone':_0x42e807}};var _0x413503={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x8a8c('0x29')]()[_0x8a8c('0x25')](function(){logger[_0x8a8c('0x1d')](_0x8a8c('0x2c'),_0x42e807,_0x238e6c[_0x8a8c('0x2d')]);switch(_0x238e6c[_0x8a8c('0x2d')]){case _0x8a8c('0x2e'):var _0x32e838=_[_0x8a8c('0x2f')](_0x3fea52);if(_0x238e6c[_0x8a8c('0x30')]){var _0x56e6fc={};_0x56e6fc[_0x238e6c['additionalSearchContact']]=_0x42e807;_['merge'](_0x32e838[_0x8a8c('0x31')],_0x56e6fc);}return _0x3ac6f3[_0x8a8c('0x1f')](_0x8a8c('0x32'))['find'](_0x32e838,_0x413503)[_0x8a8c('0x33')]()['then'](function(_0x14d06c){if(_0x14d06c&&_0x14d06c[_0x8a8c('0x34')]){return _0x14d06c;}else{var _0x3caafc=_['cloneDeep'](_0x3fea52);if(_0x238e6c[_0x8a8c('0x35')]){var _0x282ee9={};_0x282ee9[_0x238e6c['additionalSearchLead']]=_0x42e807;_['merge'](_0x3caafc[_0x8a8c('0x31')],_0x282ee9);}return _0x3ac6f3['sobject'](_0x8a8c('0x36'))[_0x8a8c('0x24')](_0x3caafc,_0x413503);}});case'account_contact_lead':var _0x125543=_['cloneDeep'](_0x3fea52);if(_0x238e6c[_0x8a8c('0x37')]){var _0x56e6fc={};_0x56e6fc[_0x238e6c[_0x8a8c('0x37')]]=_0x42e807;_['merge'](_0x125543[_0x8a8c('0x31')],_0x56e6fc);}return _0x3ac6f3[_0x8a8c('0x1f')](_0x8a8c('0x38'))['find'](_0x125543,_0x413503)['execute']()['then'](function(_0x212706){if(_0x212706&&_0x212706[_0x8a8c('0x34')]){return _0x212706;}else{var _0x1ab7bc=_[_0x8a8c('0x2f')](_0x3fea52);if(_0x238e6c[_0x8a8c('0x30')]){var _0x455f7c={};_0x455f7c[_0x238e6c['additionalSearchContact']]=_0x42e807;_[_0x8a8c('0x39')](_0x1ab7bc[_0x8a8c('0x31')],_0x455f7c);}return _0x3ac6f3[_0x8a8c('0x1f')](_0x8a8c('0x32'))[_0x8a8c('0x24')](_0x1ab7bc,_0x413503)[_0x8a8c('0x25')](function(_0x4c47e3){if(_0x4c47e3&&_0x4c47e3[_0x8a8c('0x34')]){return _0x4c47e3;}else{var _0x421bef=_[_0x8a8c('0x2f')](_0x3fea52);if(_0x238e6c[_0x8a8c('0x35')]){var _0x34f22b={};_0x34f22b[_0x238e6c[_0x8a8c('0x35')]]=_0x42e807;_[_0x8a8c('0x39')](_0x421bef[_0x8a8c('0x31')],_0x34f22b);}return _0x3ac6f3[_0x8a8c('0x1f')](_0x8a8c('0x36'))[_0x8a8c('0x24')](_0x421bef,_0x413503);}});}});case'contact':var _0x32e838=_[_0x8a8c('0x2f')](_0x3fea52);if(_0x238e6c[_0x8a8c('0x30')]){var _0x56e6fc={};_0x56e6fc[_0x238e6c[_0x8a8c('0x30')]]=_0x42e807;_['merge'](_0x32e838[_0x8a8c('0x31')],_0x56e6fc);}return _0x3ac6f3['sobject']('Contact')[_0x8a8c('0x24')](_0x32e838,_0x413503)[_0x8a8c('0x33')]();case'lead':var _0x5c2ef2=_[_0x8a8c('0x2f')](_0x3fea52);if(_0x238e6c['additionalSearchLead']){var _0x56e6fc={};_0x56e6fc[_0x238e6c[_0x8a8c('0x35')]]=_0x42e807;_['merge'](_0x5c2ef2['$or'],_0x56e6fc);}return _0x3ac6f3[_0x8a8c('0x1f')]('Lead')['find'](_0x5c2ef2,_0x413503);case _0x8a8c('0x1b'):var _0x125543=_[_0x8a8c('0x2f')](_0x3fea52);if(_0x238e6c['additionalSearchAccount']){var _0x56e6fc={};_0x56e6fc[_0x238e6c[_0x8a8c('0x37')]]=_0x42e807;_[_0x8a8c('0x39')](_0x125543[_0x8a8c('0x31')],_0x56e6fc);}return _0x3ac6f3[_0x8a8c('0x1f')](_0x8a8c('0x38'))['find'](_0x125543,_0x413503);default:return null;}})['then'](function(_0x151c30){if(_0x151c30&&_0x151c30['length']){var _0x5a8ce8=_['first'](_0x151c30);if(_0x5a8ce8){return BPromise[_0x8a8c('0x29')]({'id':_0x5a8ce8['Id'],'name':_0x5a8ce8[_0x8a8c('0x3a')],'phone':_0x5a8ce8[_0x8a8c('0x3b')],'endUserType':_0x5a8ce8['attributes'][_0x8a8c('0x3c')]['toLowerCase']()});}}})[_0x8a8c('0x25')](function(_0x14679b){if(_0x14679b){logger[_0x8a8c('0x1d')](_0x8a8c('0x3d'),_0x14679b[_0x8a8c('0x16')],_0x42e807);return BPromise[_0x8a8c('0x29')](_0x14679b);}else{logger[_0x8a8c('0x1d')](_0x8a8c('0x3e'),_0x42e807);var _0x434f39={'Phone':_0x42e807};if(_0x238e6c[_0x8a8c('0x3f')]){if(_0x238e6c[_0x8a8c('0x3f')]===_0x8a8c('0x17')){logger[_0x8a8c('0x1d')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x42e807,_0x238e6c['moduleCreate']);_0x434f39[_0x8a8c('0x40')]=_0x402ad9!==_0x8a8c('0x41')?_0x402ad9:util['format'](_0x8a8c('0x42'),_0x42e807);}else if(_0x238e6c[_0x8a8c('0x3f')]==='lead'){logger['info'](_0x8a8c('0x43'),_0x42e807,_0x238e6c[_0x8a8c('0x3f')]);_0x434f39[_0x8a8c('0x40')]=_0x402ad9!==''?_0x402ad9:util[_0x8a8c('0x44')](_0x8a8c('0x42'),_0x42e807);_0x434f39['Company']=_0x8a8c('0x45');}else if(_0x238e6c[_0x8a8c('0x3f')]===_0x8a8c('0x1b')){logger[_0x8a8c('0x1d')](_0x8a8c('0x43'),_0x42e807,_0x238e6c[_0x8a8c('0x3f')]);_0x434f39[_0x8a8c('0x3a')]=_0x402ad9!==_0x8a8c('0x41')?_0x402ad9:util[_0x8a8c('0x44')](_0x8a8c('0x42'),_0x42e807);}else{return null;}}return _0x3ac6f3[_0x8a8c('0x1f')](_[_0x8a8c('0x46')](_0x238e6c[_0x8a8c('0x3f')]))[_0x8a8c('0x20')](_0x434f39)['then'](function(_0x497829){return BPromise['resolve']({'id':_0x497829['id'],'endUserType':_0x238e6c['moduleCreate']});});}});}function getCustomFields(_0x3c899b,_0x242157){var _0x14839b={};if(_0x3c899b[_0x8a8c('0x34')]>0x0){_[_0x8a8c('0x47')](_0x3c899b,function(_0x875cf4){if(_[_0x8a8c('0x48')]([_0x8a8c('0x49'),_0x8a8c('0x4a')],_0x875cf4[_0x8a8c('0x3c')])&&_0x875cf4[_0x8a8c('0x4b')]){_0x14839b[_0x875cf4['idField']]=_0x875cf4[_0x8a8c('0x4c')]['toString']();}else if(_0x875cf4['type']===_0x8a8c('0x4d')&&_0x875cf4[_0x8a8c('0x4e')]&&_0x875cf4[_0x8a8c('0x4b')]){_0x242157[_0x875cf4[_0x8a8c('0x4e')]]&&(_0x14839b[_0x875cf4['idField']]=_0x242157[_0x875cf4[_0x8a8c('0x4e')]]['toString']());}else if(_0x875cf4[_0x8a8c('0x3c')]===_0x8a8c('0x4f')&&_0x875cf4['Variable']&&_0x875cf4[_0x8a8c('0x50')]['name']&&_0x875cf4[_0x8a8c('0x4b')]){_0x242157[_0x875cf4[_0x8a8c('0x50')][_0x8a8c('0x51')][_0x8a8c('0x52')]()]&&(_0x14839b[_0x875cf4['idField']]=_0x242157[_0x875cf4[_0x8a8c('0x50')][_0x8a8c('0x51')][_0x8a8c('0x52')]()][_0x8a8c('0x53')]());}});}return _0x14839b;}function getConnection(_0x1ac1b3){var _0x3d6b67=_0x1ac1b3['password'][_0x8a8c('0x54')](_0x1ac1b3[_0x8a8c('0x55')]);var _0x2aa8fa=new jsforce[(_0x8a8c('0x56'))]({'oauth2':{'loginUrl':_0x1ac1b3[_0x8a8c('0x57')]||_0x8a8c('0x58'),'clientId':_0x1ac1b3[_0x8a8c('0x59')],'clientSecret':_0x1ac1b3['clientSecret']}});return _0x2aa8fa[_0x8a8c('0x5a')](_0x1ac1b3[_0x8a8c('0x5b')],_0x3d6b67)[_0x8a8c('0x25')](function(){logger['info'](_0x8a8c('0x5c'));return _0x2aa8fa;});}exports[_0x8a8c('0x5d')]=function(_0x236426,_0x2f6508,_0x59a8ed,_0x56c2ec,_0x33ed34,_0x63b400){var _0x35d11a,_0x33817f,_0x51b68a,_0x137205;_0x63b400[_0x8a8c('0x5e')]=intUtil[_0x8a8c('0x5f')](_0x63b400[_0x8a8c('0x5e')]);_0x63b400['remoteUri']=intUtil[_0x8a8c('0x5f')](_0x63b400[_0x8a8c('0x57')]);if(_0x33ed34&&_0x33ed34['monitor_format']){logger['info'](_0x8a8c('0x60'),_0x8a8c('0x61'));_0x2f6508[_0x8a8c('0x62')]=util[_0x8a8c('0x44')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x63b400[_0x8a8c('0x5e')],_0x2f6508['uniqueid'],md5(_0x2f6508[_0x8a8c('0x63')]));}else{_0x2f6508[_0x8a8c('0x62')]='';}return getConnection(_0x63b400)[_0x8a8c('0x25')](function(_0x3937e8){_0x137205=_0x3937e8;return getUser(_0x63b400,_0x56c2ec['email'],_0x137205);})[_0x8a8c('0x25')](function(_0x3dcd33){_0x35d11a=_0x3dcd33;return getEndUser(_0x63b400,_0x59a8ed,_0x2f6508[_0x8a8c('0x64')],_0x2f6508[_0x8a8c('0x65')],_0x137205);})[_0x8a8c('0x25')](function(_0x3d7786){_0x33817f=_0x3d7786;return getTicket(_0x63b400,_0x35d11a,_0x33817f,_0x59a8ed,_0x2f6508,_0x59a8ed['Fields'],_0x137205,'queue');})[_0x8a8c('0x25')](function(_0x137f7c){_0x51b68a=_0x137f7c;logger[_0x8a8c('0x1d')](_0x8a8c('0x66'),_0x51b68a['id']);logger['info'](_0x8a8c('0x67'),_0x51b68a['id'],_0x56c2ec[_0x8a8c('0x51')],_0x63b400[_0x8a8c('0x3c')]);switch(_0x63b400[_0x8a8c('0x3c')]){case _0x8a8c('0x68'):emit(util[_0x8a8c('0x44')](_0x8a8c('0x69'),_0x56c2ec[_0x8a8c('0x51')]),_0x8a8c('0x6a'),{'recordId':_0x51b68a['id']});break;case _0x8a8c('0x6b'):emit(util['format'](_0x8a8c('0x69'),_0x56c2ec[_0x8a8c('0x51')]),_0x8a8c('0x6c'),{'uri':util['format'](_0x8a8c('0x6d'),_0x137205['instanceUrl'],_0x51b68a['id'])});break;default:logger[_0x8a8c('0x6e')](_0x8a8c('0x6f'));}})[_0x8a8c('0x70')](function(_0x556df5){logger[_0x8a8c('0x6e')](_0x8a8c('0x60'),_0x556df5);});};exports[_0x8a8c('0x71')]=function(_0x1ad39a,_0x12b372,_0x4fe79c,_0x5b9150,_0x53b99b,_0x343cae,_0x300678){var _0x19abc7,_0x1b66d6,_0x3daf8c,_0x2232b8;_0x343cae['serverUrl']=intUtil[_0x8a8c('0x5f')](_0x343cae[_0x8a8c('0x5e')]);_0x343cae[_0x8a8c('0x57')]=intUtil[_0x8a8c('0x5f')](_0x343cae['remoteUri']);if(_0x300678&&_0x300678[_0x8a8c('0x72')]&&_0x300678[_0x8a8c('0x72')]!=='none'){logger[_0x8a8c('0x1d')](_0x8a8c('0x73'),'Recording\x20is\x20enabled!');_0x12b372['recordingURL']=util[_0x8a8c('0x44')](_0x8a8c('0x74'),_0x343cae[_0x8a8c('0x5e')],_0x12b372[_0x8a8c('0x63')],md5(_0x12b372['uniqueid']));}return getConnection(_0x343cae)[_0x8a8c('0x25')](function(_0x1e1d13){_0x2232b8=_0x1e1d13;return getUser(_0x343cae,_0x5b9150[_0x8a8c('0x75')],_0x2232b8);})['then'](function(_0x326e0d){_0x19abc7=_0x326e0d;return getEndUser(_0x343cae,_0x4fe79c,_0x12b372[_0x8a8c('0x76')],_0x12b372['destcalleridnum'],_0x2232b8);})[_0x8a8c('0x25')](function(_0x971f10){_0x1b66d6=_0x971f10;return getTicket(_0x343cae,_0x19abc7,_0x1b66d6,_0x4fe79c,_0x12b372,_0x4fe79c[_0x8a8c('0x77')],_0x2232b8,_0x8a8c('0x71'));})[_0x8a8c('0x25')](function(_0x352dbf){_0x3daf8c=_0x352dbf;logger[_0x8a8c('0x1d')](_0x8a8c('0x78'),_0x3daf8c['id']);logger[_0x8a8c('0x1d')](_0x8a8c('0x79'),_0x3daf8c['id'],_0x5b9150[_0x8a8c('0x51')],_0x343cae[_0x8a8c('0x3c')]);switch(_0x343cae[_0x8a8c('0x3c')]){case _0x8a8c('0x68'):emit(util[_0x8a8c('0x44')]('user:%s',_0x5b9150[_0x8a8c('0x51')]),_0x8a8c('0x6a'),{'recordId':_0x3daf8c['id']});break;case _0x8a8c('0x6b'):emit(util[_0x8a8c('0x44')](_0x8a8c('0x69'),_0x5b9150[_0x8a8c('0x51')]),_0x8a8c('0x6c'),{'uri':util[_0x8a8c('0x44')](_0x8a8c('0x6d'),_0x2232b8['instanceUrl'],_0x3daf8c['id'])});break;default:logger[_0x8a8c('0x6e')](_0x8a8c('0x73'),_0x8a8c('0x7a'));}})[_0x8a8c('0x70')](function(_0x559ffd){logger['error'](_0x8a8c('0x73'),_0x559ffd);});};exports[_0x8a8c('0x7b')]=function(_0xcda186,_0x1e59d0,_0x3eb309,_0x448fa7,_0x597b39,_0x489f79){var _0x225bdf,_0x37ec36,_0x516a2a,_0x56c368;_0x489f79[_0x8a8c('0x5e')]=intUtil[_0x8a8c('0x5f')](_0x489f79[_0x8a8c('0x5e')]);_0x489f79['remoteUri']=intUtil[_0x8a8c('0x5f')](_0x489f79[_0x8a8c('0x57')]);if(_0x597b39&&_0x597b39[_0x8a8c('0x7c')]){logger[_0x8a8c('0x1d')]('['+_0x1e59d0[_0x8a8c('0x7d')]['toUpperCase']()+']',_0x8a8c('0x61'));_0x1e59d0[_0x8a8c('0x62')]=util[_0x8a8c('0x44')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x489f79['serverUrl'],_0x1e59d0[_0x8a8c('0x63')],md5(_0x1e59d0[_0x8a8c('0x63')]));}else{_0x1e59d0[_0x8a8c('0x62')]='';}return getConnection(_0x489f79)[_0x8a8c('0x25')](function(_0x52f111){_0x56c368=_0x52f111;if(!_[_0x8a8c('0x21')](_0x448fa7)){return getUser(_0x489f79,_0x448fa7['name'],_0x56c368);}else{return getUser(_0x489f79,null,_0x56c368);}})[_0x8a8c('0x25')](function(_0x3de446){_0x225bdf=_0x3de446;return getEndUser(_0x489f79,_0x3eb309,_0x1e59d0[_0x8a8c('0x64')],_0x1e59d0['calleridnum'],_0x56c368);})[_0x8a8c('0x25')](function(_0x3ff203){_0x37ec36=_0x3ff203;return getTicket(_0x489f79,_0x225bdf,_0x37ec36,_0x3eb309,_0x1e59d0,_0x3eb309['Fields'],_0x56c368);})[_0x8a8c('0x25')](function(_0x412f9b){_0x516a2a=_0x412f9b;logger[_0x8a8c('0x1d')]('['+_0x1e59d0[_0x8a8c('0x7d')][_0x8a8c('0x7e')]()+_0x8a8c('0x7f'),_0x516a2a['id']);logger[_0x8a8c('0x1d')]('['+_0x1e59d0['lastevent'][_0x8a8c('0x7e')]()+_0x8a8c('0x80'),_0x489f79[_0x8a8c('0x3c')]);})[_0x8a8c('0x70')](function(_0x191f0f){logger[_0x8a8c('0x6e')]('['+_0x1e59d0[_0x8a8c('0x7d')][_0x8a8c('0x7e')]()+']',_0x191f0f);});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/servicenow.js b/server/services/ami/trigger/integration/servicenow.js index d1b566f..b2e59cb 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 _0xc34a=['email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','md5','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','then','result','length','adminId','toUpperCase','],\x20getAdminUser\x20crm','error','message','info','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20entity','active','sys_id','userId','adminEmail','],\x20getUser\x20crm','catch',']\x20using\x20admin\x20profile','POST','sys_user?','endUserNumber','true','System','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','endUserId','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','string','picklist','type','nameField','customField','toLowerCase','content','includes','idField','toString','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','label_entry','Incident','Incident\x20-\x20','forEach','push','all','Tags','%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','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','serverUrl','%s/api/now/table/','isNil'];(function(_0x47b3f3,_0x4685d6){var _0x3212a7=function(_0x1a9d90){while(--_0x1a9d90){_0x47b3f3['push'](_0x47b3f3['shift']());}};_0x3212a7(++_0x4685d6);}(_0xc34a,0x1d7));var _0xac34=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc34a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xac34('0x0'));var Promise=require(_0xac34('0x1'));var rp=require('request-promise');var util=require('util');var md5=require(_0xac34('0x2'));var Redis=require('ioredis');var intUtil=require(_0xac34('0x3'));var config=require(_0xac34('0x4'));var logger=require(_0xac34('0x5'))(_0xac34('0x6'));config[_0xac34('0x7')]=_[_0xac34('0x8')](config['redis'],{'host':_0xac34('0x9'),'port':0x18eb});var io=require(_0xac34('0xa'))(new Redis(config[_0xac34('0x7')]));function getAdminUser(_0x59d24d,_0x53a200,_0x5445fc,_0x57c339,_0x54685f,_0x19510f){return new Promise(function(_0x3c0c1c,_0x577068){var _0x457777={'method':_0xac34('0xb'),'uri':_0x57c339+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x54685f+'&'+_0x19510f,'auth':_0x53a200,'json':!![]};return rp(_0x457777)[_0xac34('0xc')](function(_0x1cdfce){if(_0x1cdfce[_0xac34('0xd')][_0xac34('0xe')]>0x0){_0x5445fc[_0xac34('0xf')]=_0x1cdfce[_0xac34('0xd')][0x0]['sys_id'];}logger['info']('['+[_0x59d24d[_0xac34('0x10')]()]+_0xac34('0x11'),_0x5445fc);_0x3c0c1c(_0x5445fc);})['catch'](function(_0x35ad68){logger[_0xac34('0x12')]('['+[_0x59d24d[_0xac34('0x10')]()]+']',_0x35ad68[_0xac34('0x13')]);_0x577068(_0x35ad68[_0xac34('0x13')]);});});}function getUser(_0x5e6ccb,_0x1f8935,_0x4fa974,_0x3d4a6d,_0x2e8883){return function(_0x13f20d){logger[_0xac34('0x14')]('['+[_0x5e6ccb[_0xac34('0x10')]()]+_0xac34('0x15'),_0x13f20d);return new Promise(function(_0x1fe7af,_0x2a3adb){if(intUtil[_0xac34('0x16')](_0x13f20d[_0xac34('0x17')])){var _0x13d265={'method':_0xac34('0xb'),'uri':_0x4fa974+_0xac34('0x18')+_0x13f20d[_0xac34('0x17')]+'&'+_0x3d4a6d+'&'+_0x2e8883,'auth':_0x1f8935,'json':!![]};logger[_0xac34('0x14')]('['+[_0x5e6ccb[_0xac34('0x10')]()]+'],\x20getUser\x20rp\x20obj',_0x13d265);return rp(_0x13d265)[_0xac34('0xc')](function(_0x3431f0){logger[_0xac34('0x14')]('['+[_0x5e6ccb[_0xac34('0x10')]()]+_0xac34('0x19'),_0x3431f0);if(_0x3431f0['result'][_0xac34('0xe')]>0x0&&String(_0x3431f0[_0xac34('0xd')][0x0][_0xac34('0x1a')])==='true'){_0x13f20d['userId']=_0x3431f0[_0xac34('0xd')][0x0][_0xac34('0x1b')];}else{_0x13f20d[_0xac34('0x1c')]=_0x13f20d[_0xac34('0xf')];_0x13f20d['userEmail']=_0x13f20d[_0xac34('0x1d')];}logger[_0xac34('0x14')]('['+[_0x5e6ccb['toUpperCase']()]+_0xac34('0x1e'),_0x13f20d);_0x1fe7af(_0x13f20d);})[_0xac34('0x1f')](function(_0xd3b499){logger['error']('['+[_0x5e6ccb[_0xac34('0x10')]()]+']',_0xd3b499['message']);_0x2a3adb(_0xd3b499['message']);});}else{logger[_0xac34('0x14')]('['+[_0x5e6ccb[_0xac34('0x10')]()]+_0xac34('0x20'));_0x13f20d['userId']=_0x13f20d[_0xac34('0xf')];_0x13f20d['userEmail']=_0x13f20d['adminEmail'];_0x1fe7af(_0x13f20d);}});};}function createEndUser(_0x278e57,_0x40830a,_0x992ac2,_0x1504b4,_0x3be201){logger['info']('['+[_0x278e57[_0xac34('0x10')]()]+'],\x20createEndUser\x20input\x20crm',_0x992ac2);return new Promise(function(_0x39d940,_0x2cfd66){var _0x90eac2={'method':_0xac34('0x21'),'uri':_0x1504b4+_0xac34('0x22')+_0x3be201,'body':{'user_name':_0x992ac2[_0xac34('0x23')],'roles':'user','first_name':_0x992ac2[_0xac34('0x23')],'active':_0xac34('0x24'),'date_format':_0xac34('0x25'),'phone':_0x992ac2[_0xac34('0x23')]},'auth':_0x40830a,'json':!![]};return rp(_0x90eac2)[_0xac34('0xc')](function(_0x1c1022){logger[_0xac34('0x14')]('['+[_0x278e57['toUpperCase']()]+'],\x20EndUser\x20schema',_0x1c1022[_0xac34('0xd')]);_0x992ac2['endUserId']=_0x1c1022[_0xac34('0xd')]['sys_id'];_0x39d940(_0x992ac2);})[_0xac34('0x1f')](function(_0x241d61){logger['error']('['+[_0x278e57['toUpperCase']()]+']',_0x241d61[_0xac34('0x13')]);_0x2cfd66(_0x241d61[_0xac34('0x13')]);});});}function getEndUser(_0x21b9a7,_0x3c6786,_0x15fa75,_0x102df2,_0x27f48d){return function(_0x3f9799){logger[_0xac34('0x14')]('['+[_0x21b9a7[_0xac34('0x10')]()]+_0xac34('0x26'),_0x3f9799);return new Promise(function(_0x1040c8,_0x5f02db){var _0x2f74a6={'method':_0xac34('0xb'),'uri':_0x15fa75+_0xac34('0x27')+_0x3f9799[_0xac34('0x23')]+'&'+_0x102df2+'&'+_0x27f48d,'auth':_0x3c6786,'json':!![]};return rp(_0x2f74a6)[_0xac34('0xc')](function(_0x340d41){if(_0x340d41[_0xac34('0xd')][_0xac34('0xe')]>0x0){_0x3f9799[_0xac34('0x28')]=_0x340d41[_0xac34('0xd')][0x0][_0xac34('0x1b')];logger[_0xac34('0x14')]('['+[_0x21b9a7[_0xac34('0x10')]()]+_0xac34('0x29'),_0x3f9799);_0x1040c8(_0x3f9799);}else{return createEndUser(_0x21b9a7,_0x3c6786,_0x3f9799,_0x15fa75,_0x102df2)['then'](function(_0x5ec80e){logger[_0xac34('0x14')]('['+[_0x21b9a7['toUpperCase']()]+_0xac34('0x2a'),_0x5ec80e);_0x1040c8(_0x5ec80e);});}})['catch'](function(_0x172f62){logger[_0xac34('0x12')]('['+[_0x21b9a7['toUpperCase']()]+']',_0x172f62[_0xac34('0x13')]);_0x5f02db(_0x172f62[_0xac34('0x13')]);});});};}function getCustomFields(_0x49a04c,_0x5870a2){var _0x77a63c={};if(_0x49a04c[_0xac34('0xe')]>0x0){_['forEach'](_0x49a04c,function(_0x591ce6){if(_['includes']([_0xac34('0x2b'),_0xac34('0x2c')],_0x591ce6[_0xac34('0x2d')])&&_0x591ce6[_0xac34('0x2e')]&&!_0x591ce6[_0xac34('0x2f')]){_0x77a63c[_0x591ce6[_0xac34('0x2e')][_0xac34('0x30')]()]=_0x591ce6[_0xac34('0x31')]['toString']();}else if(_[_0xac34('0x32')]([_0xac34('0x2b'),_0xac34('0x2c')],_0x591ce6['type'])&&_0x591ce6[_0xac34('0x33')]&&_0x591ce6[_0xac34('0x2f')]){_0x77a63c[_0x591ce6[_0xac34('0x33')][_0xac34('0x30')]()]=_0x591ce6[_0xac34('0x31')][_0xac34('0x34')]();}else if(_0x591ce6[_0xac34('0x2d')]==='variable'&&_0x591ce6[_0xac34('0x35')]&&_0x591ce6[_0xac34('0x33')]&&_0x591ce6['customField']){_0x77a63c[_0x591ce6[_0xac34('0x33')][_0xac34('0x30')]()]=_0x5870a2[_0x591ce6['variableName']][_0xac34('0x34')]();}else if(_0x591ce6[_0xac34('0x2d')]===_0xac34('0x36')&&_0x591ce6['Variable']&&_0x591ce6[_0xac34('0x37')][_0xac34('0x38')]&&_0x591ce6[_0xac34('0x33')]&&_0x591ce6[_0xac34('0x2f')]){_0x77a63c[_0x591ce6['idField'][_0xac34('0x30')]()]=_0x5870a2[_0x591ce6[_0xac34('0x37')][_0xac34('0x38')]['toLowerCase']()][_0xac34('0x34')]();}});}return _0x77a63c;}function getTicket(_0x230086,_0x3f3fab,_0x29d963,_0x5d5508,_0x2d502d,_0x2c37ca){return function(_0x556adb){logger['info']('['+[_0x230086[_0xac34('0x10')]()]+_0xac34('0x39'),_0x556adb);return new Promise(function(_0x13bc35,_0x16fa4d){var _0x4e2164=_0x230086[_0xac34('0x30')]()===_0xac34('0x3a')?_0x556adb[_0xac34('0x1c')]:_0x556adb[_0xac34('0x28')];var _0x25c778={'method':'POST','uri':_0x29d963+_0xac34('0x3b')+'?'+_0x2c37ca,'body':Object[_0xac34('0x3c')]({},{'active':_0xac34('0x24'),'caller_id':_0x4e2164,'assigned_to':_0x556adb[_0xac34('0x1c')],'short_description':intUtil[_0xac34('0x3d')](_0x5d5508[_0xac34('0x3e')],_0x2d502d,'\x20'),'description':intUtil['getString'](_0x5d5508[_0xac34('0x3f')],_0x2d502d,'\x0a')},getCustomFields(_0x5d5508[_0xac34('0x40')],_0x2d502d)),'auth':_0x3f3fab,'json':!![]};return rp(_0x25c778)[_0xac34('0xc')](function(_0x396bc7){logger[_0xac34('0x14')]('['+[_0x230086[_0xac34('0x10')]()]+_0xac34('0x41'),_0x396bc7[_0xac34('0xd')]);_0x556adb[_0xac34('0x42')]=_0x396bc7['result'][_0xac34('0x1b')];_0x556adb[_0xac34('0x43')]=_0x396bc7[_0xac34('0xd')][_0xac34('0x44')];logger[_0xac34('0x14')]('['+[_0x230086[_0xac34('0x10')]()]+_0xac34('0x45'),_0x556adb);_0x13bc35(_0x556adb);})['catch'](function(_0x266b79){logger[_0xac34('0x12')]('['+[_0x230086[_0xac34('0x10')]()]+']',_0x266b79['message']);_0x16fa4d(_0x266b79[_0xac34('0x13')]);});});};}function createRemoteTag(_0x1eeabd,_0x45b23d,_0x1c9b16,_0x9c6bf6){return new Promise(function(_0x474778,_0x3253b1){var _0x246e8e={'method':'POST','uri':_0x1c9b16+_0xac34('0x46')+'?'+_0x9c6bf6,'body':{'short_description':_0x1eeabd,'global':!![],'active':!![],'name':_0x1eeabd},'auth':_0x45b23d,'json':!![]};return rp(_0x246e8e)[_0xac34('0xc')](function(_0x47d901){var _0x139790=_0x47d901[_0xac34('0xd')]['sys_id'];_0x474778(_0x139790);});});}function getRemoteTag(_0x2ca0e5,_0x4512dc,_0x374010,_0x1b32c4,_0x8115e1){return new Promise(function(_0x1ba299,_0x5e4947){var _0x28bef1={'method':_0xac34('0xb'),'uri':_0x374010+_0xac34('0x46')+'?sysparm_query=name%3D'+_0x2ca0e5+'&'+_0x1b32c4,'auth':_0x4512dc,'json':!![]};return rp(_0x28bef1)['then'](function(_0x3b2eb1){if(_0x3b2eb1[_0xac34('0xd')][_0xac34('0xe')]>0x0){var _0x55dbcf=_0x3b2eb1[_0xac34('0xd')][0x0]['sys_id'];_0x1ba299(_0x55dbcf);}else{return createRemoteTag(_0x2ca0e5,_0x4512dc,_0x374010,_0x1b32c4)[_0xac34('0xc')](function(_0x2c2c9b){_0x1ba299(_0x2c2c9b);});}});});}function assignTagToIncident(_0x30e5f7,_0x2925fd,_0x8bb7b0,_0x155b91,_0x3bacdc){return new Promise(function(_0x4a1232,_0x183c26){var _0x42534e={'method':'POST','uri':_0x8bb7b0+_0xac34('0x47')+'?'+_0x3bacdc,'body':{'label':_0x30e5f7,'table':_0xac34('0x3b'),'id_type':_0xac34('0x48'),'table_key':_0x155b91[_0xac34('0x42')],'title':_0xac34('0x49')+_0x155b91['ticketNumber'],'id_display':_0x155b91[_0xac34('0x43')]},'auth':_0x2925fd,'json':!![]};return rp(_0x42534e)['then'](function(_0x42298c){_0x4a1232();})[_0xac34('0x1f')](function(){_0x4a1232();});});}function manageTags(_0x444d68,_0x5e0eb3,_0x130438,_0x1ec1e1,_0x2bf9fb,_0x2741f4,_0x459d4e){return new Promise(function(_0x49b6a3,_0x1f35f5){var _0x43eda0=[];_0x5e0eb3[_0xac34('0x4a')](function(_0x2a5462){_0x43eda0[_0xac34('0x4b')](getRemoteTag(_0x2a5462,_0x130438,_0x1ec1e1,_0x2741f4,_0x459d4e));});return Promise[_0xac34('0x4c')](_0x43eda0)['then'](function(_0x47d025){if(_0x47d025[_0xac34('0xe')]){logger[_0xac34('0x14')]('['+[_0x444d68['toUpperCase']()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x47d025);var _0x50cf5e=[];_0x47d025['forEach'](function(_0x39afe4){_0x50cf5e['push'](assignTagToIncident(_0x39afe4,_0x130438,_0x1ec1e1,_0x2bf9fb,_0x2741f4));});return Promise[_0xac34('0x4c')](_0x50cf5e)[_0xac34('0xc')](function(){_0x49b6a3();})['catch'](function(){_0x49b6a3();});}else{_0x49b6a3();}});});}function getTags(_0x3b4a1d,_0x73c177,_0x166dbc,_0x291817,_0x11d2fd,_0x1affd6){return function(_0x55eed7){return new Promise(function(_0x512c70,_0x46a969){var _0x2ad76b=[];var _0x3db48e=_0x291817[_0xac34('0x4d')];if(_0x3db48e&&_0x3db48e[_0xac34('0xe')]>0x0){_0x2ad76b=_['map'](_0x3db48e,_0xac34('0x38'));}if(_0x2ad76b['length']>0x0){return manageTags(_0x3b4a1d,_0x2ad76b,_0x73c177,_0x166dbc,_0x55eed7,_0x11d2fd,_0x1affd6)[_0xac34('0xc')](function(){_0x512c70(_0x55eed7);});}else{_0x512c70(_0x55eed7);}});};}function emit(_0x37fdda,_0x3fa375,_0x3638cd){var _0x2b191f=_0xac34('0x4e')+_0xac34('0x4f')+_0xac34('0x50')+_0xac34('0x51');var _0x1469be={'uri':_0x37fdda+_0xac34('0x52')+_0x3638cd+_0x2b191f};io['to'](util[_0xac34('0x53')](_0xac34('0x54'),_0x3fa375))['emit'](_0xac34('0x55'),_0x1469be);}exports['cs']=function(_0x2fabc7,_0x26efb1,_0x494999,_0x8d2ffd,_0x2a87d8,_0x491f60,_0x38f3e8,_0x468dd2){var _0x540478={};var _0x96a949={'user':_0x491f60[_0xac34('0x56')],'pass':_0x491f60[_0xac34('0x57')]};var _0x50c34a=_0xac34('0x58');var _0x30f2a9=_0xac34('0x59');_0x491f60[_0xac34('0x5a')]=intUtil['stripTrailingSlash'](_0x491f60[_0xac34('0x5a')]);_0x491f60['serverUrl']=intUtil['stripTrailingSlash'](_0x491f60[_0xac34('0x5b')]);var _0x4fdd72=util['format'](_0xac34('0x5c'),_0x491f60[_0xac34('0x5a')]);_0x540478[_0xac34('0x17')]=!_[_0xac34('0x5d')](_0x8d2ffd)?_0x8d2ffd[_0xac34('0x5e')]:null;_0x540478[_0xac34('0x1d')]=_0x491f60[_0xac34('0x5e')];_0x540478[_0xac34('0x23')]=_0x468dd2[_0xac34('0x30')]()===_0xac34('0x3a')?_0x26efb1[_0xac34('0x5f')]:_0x26efb1[_0xac34('0x60')];_0x540478[_0xac34('0x61')]=_0x468dd2===_0xac34('0x62')||_0x468dd2===_0xac34('0x63')?'queue':_0xac34('0x3a');var _0x3f4661=util[_0xac34('0x53')](_0xac34('0x64'),_0x491f60[_0xac34('0x5b')],_0x26efb1['uniqueid'],md5(_0x26efb1[_0xac34('0x65')]));if(_0x2a87d8&&_0x2a87d8[_0xac34('0x66')]){logger[_0xac34('0x14')]('[QUEUE]',_0xac34('0x67'));_0x26efb1[_0xac34('0x68')]=_0x3f4661;}else if(_0x38f3e8&&_0x38f3e8[_0xac34('0x69')]&&_0x38f3e8[_0xac34('0x69')]!==_0xac34('0x6a')){logger['info'](_0xac34('0x6b'),_0xac34('0x67'));_0x26efb1[_0xac34('0x68')]=_0x3f4661;}else{_0x26efb1[_0xac34('0x68')]='';}return getAdminUser(_0x468dd2,_0x96a949,_0x540478,_0x4fdd72,_0x30f2a9,_0x50c34a)['then'](getUser(_0x468dd2,_0x96a949,_0x4fdd72,_0x30f2a9,_0x50c34a))[_0xac34('0xc')](getEndUser(_0x468dd2,_0x96a949,_0x4fdd72,_0x30f2a9,_0x50c34a))[_0xac34('0xc')](getTicket(_0x468dd2,_0x96a949,_0x4fdd72,_0x494999,_0x26efb1,_0x30f2a9))[_0xac34('0xc')](function(_0x41bcde){logger[_0xac34('0x14')](util['format'](_0xac34('0x6c'),_0x41bcde['ticketId']));logger['info'](util[_0xac34('0x53')](_0xac34('0x6d'),_0x468dd2));if(_0x468dd2!==_0xac34('0x63')){logger[_0xac34('0x14')]('['+[_0x468dd2[_0xac34('0x10')]()]+']',_0xac34('0x6e'));emit(_0x491f60['remoteUri'],_0x8d2ffd[_0xac34('0x38')],_0x41bcde['ticketId']);}})[_0xac34('0x1f')](function(_0x55d67b){logger[_0xac34('0x12')]('['+[_0x468dd2[_0xac34('0x10')]()]+_0xac34('0x6f'),util[_0xac34('0x70')](_0x55d67b,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xbef9=['util','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','adminId','],\x20getAdminUser\x20crm','catch','error','toUpperCase','message','info','],\x20getUser\x20input\x20crm','validateEmail','sys_user?sysparm_query=email%3D','userEmail','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','length','true','userId','sys_id','adminEmail','],\x20getUser\x20crm','],\x20createEndUser\x20input\x20crm','POST','endUserNumber','System','],\x20EndUser\x20schema','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','picklist','type','customField','nameField','content','toString','toLowerCase','variable','idField','customVariable','Variable','name','outbound','incident','getString','Subjects','Descriptions',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_list%3Dactive%253Dtrue','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','serverUrl','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','callDirection','queue','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','bluebird'];(function(_0x2080a3,_0x48acfa){var _0x8d7d17=function(_0x2dbc06){while(--_0x2dbc06){_0x2080a3['push'](_0x2080a3['shift']());}};_0x8d7d17(++_0x48acfa);}(_0xbef9,0x6b));var _0x9bef=function(_0x20e375,_0xdc0dde){_0x20e375=_0x20e375-0x0;var _0x55ac5d=_0xbef9[_0x20e375];return _0x55ac5d;};'use strict';var _=require('lodash');var Promise=require(_0x9bef('0x0'));var rp=require('request-promise');var util=require(_0x9bef('0x1'));var md5=require('md5');var Redis=require(_0x9bef('0x2'));var intUtil=require(_0x9bef('0x3'));var config=require(_0x9bef('0x4'));var logger=require(_0x9bef('0x5'))(_0x9bef('0x6'));config[_0x9bef('0x7')]=_[_0x9bef('0x8')](config[_0x9bef('0x7')],{'host':_0x9bef('0x9'),'port':0x18eb});var io=require(_0x9bef('0xa'))(new Redis(config['redis']));function getAdminUser(_0x24bab4,_0x2590a0,_0x4ac1c7,_0x36604e,_0x181de8,_0x10fe02){return new Promise(function(_0x561a7c,_0x532369){var _0x55da40={'method':_0x9bef('0xb'),'uri':_0x36604e+_0x9bef('0xc')+'&'+_0x181de8+'&'+_0x10fe02,'auth':_0x2590a0,'json':!![]};return rp(_0x55da40)[_0x9bef('0xd')](function(_0x8aff68){if(_0x8aff68[_0x9bef('0xe')]['length']>0x0){_0x4ac1c7[_0x9bef('0xf')]=_0x8aff68[_0x9bef('0xe')][0x0]['sys_id'];}logger['info']('['+[_0x24bab4['toUpperCase']()]+_0x9bef('0x10'),_0x4ac1c7);_0x561a7c(_0x4ac1c7);})[_0x9bef('0x11')](function(_0x5801cb){logger[_0x9bef('0x12')]('['+[_0x24bab4[_0x9bef('0x13')]()]+']',_0x5801cb[_0x9bef('0x14')]);_0x532369(_0x5801cb[_0x9bef('0x14')]);});});}function getUser(_0x254e14,_0x8d087f,_0x4360aa,_0x1c4c4a,_0x4d68da){return function(_0x594ab3){logger[_0x9bef('0x15')]('['+[_0x254e14['toUpperCase']()]+_0x9bef('0x16'),_0x594ab3);return new Promise(function(_0x3e8ada,_0x115e3d){if(intUtil[_0x9bef('0x17')](_0x594ab3['userEmail'])){var _0x449e1d={'method':_0x9bef('0xb'),'uri':_0x4360aa+_0x9bef('0x18')+_0x594ab3[_0x9bef('0x19')]+'&'+_0x1c4c4a+'&'+_0x4d68da,'auth':_0x8d087f,'json':!![]};logger[_0x9bef('0x15')]('['+[_0x254e14[_0x9bef('0x13')]()]+_0x9bef('0x1a'),_0x449e1d);return rp(_0x449e1d)[_0x9bef('0xd')](function(_0x26188e){logger[_0x9bef('0x15')]('['+[_0x254e14['toUpperCase']()]+_0x9bef('0x1b'),_0x26188e);if(_0x26188e[_0x9bef('0xe')][_0x9bef('0x1c')]>0x0&&String(_0x26188e[_0x9bef('0xe')][0x0]['active'])===_0x9bef('0x1d')){_0x594ab3[_0x9bef('0x1e')]=_0x26188e[_0x9bef('0xe')][0x0][_0x9bef('0x1f')];}else{_0x594ab3[_0x9bef('0x1e')]=_0x594ab3[_0x9bef('0xf')];_0x594ab3[_0x9bef('0x19')]=_0x594ab3[_0x9bef('0x20')];}logger[_0x9bef('0x15')]('['+[_0x254e14[_0x9bef('0x13')]()]+_0x9bef('0x21'),_0x594ab3);_0x3e8ada(_0x594ab3);})[_0x9bef('0x11')](function(_0xb7f2f3){logger[_0x9bef('0x12')]('['+[_0x254e14[_0x9bef('0x13')]()]+']',_0xb7f2f3[_0x9bef('0x14')]);_0x115e3d(_0xb7f2f3['message']);});}else{logger[_0x9bef('0x15')]('['+[_0x254e14[_0x9bef('0x13')]()]+']\x20using\x20admin\x20profile');_0x594ab3[_0x9bef('0x1e')]=_0x594ab3['adminId'];_0x594ab3[_0x9bef('0x19')]=_0x594ab3[_0x9bef('0x20')];_0x3e8ada(_0x594ab3);}});};}function createEndUser(_0x11430c,_0x2c2d8b,_0x331419,_0x521f36,_0x54cfc1){logger[_0x9bef('0x15')]('['+[_0x11430c[_0x9bef('0x13')]()]+_0x9bef('0x22'),_0x331419);return new Promise(function(_0x37d708,_0x4d188d){var _0x400ab7={'method':_0x9bef('0x23'),'uri':_0x521f36+'sys_user?'+_0x54cfc1,'body':{'user_name':_0x331419[_0x9bef('0x24')],'roles':'user','first_name':_0x331419['endUserNumber'],'active':'true','date_format':_0x9bef('0x25'),'phone':_0x331419['endUserNumber']},'auth':_0x2c2d8b,'json':!![]};return rp(_0x400ab7)[_0x9bef('0xd')](function(_0x4b36b1){logger[_0x9bef('0x15')]('['+[_0x11430c[_0x9bef('0x13')]()]+_0x9bef('0x26'),_0x4b36b1['result']);_0x331419['endUserId']=_0x4b36b1['result'][_0x9bef('0x1f')];_0x37d708(_0x331419);})[_0x9bef('0x11')](function(_0x6e30c2){logger[_0x9bef('0x12')]('['+[_0x11430c[_0x9bef('0x13')]()]+']',_0x6e30c2[_0x9bef('0x14')]);_0x4d188d(_0x6e30c2[_0x9bef('0x14')]);});});}function getEndUser(_0x119c91,_0x2be1b1,_0x2bc869,_0x2e19dd,_0x1796cb){return function(_0x4c0905){logger[_0x9bef('0x15')]('['+[_0x119c91[_0x9bef('0x13')]()]+_0x9bef('0x27'),_0x4c0905);return new Promise(function(_0x253a07,_0x1643b2){var _0x575f1d={'method':_0x9bef('0xb'),'uri':_0x2bc869+_0x9bef('0x28')+_0x4c0905['endUserNumber']+'&'+_0x2e19dd+'&'+_0x1796cb,'auth':_0x2be1b1,'json':!![]};return rp(_0x575f1d)['then'](function(_0x349e5e){if(_0x349e5e[_0x9bef('0xe')][_0x9bef('0x1c')]>0x0){_0x4c0905['endUserId']=_0x349e5e[_0x9bef('0xe')][0x0]['sys_id'];logger[_0x9bef('0x15')]('['+[_0x119c91['toUpperCase']()]+_0x9bef('0x29'),_0x4c0905);_0x253a07(_0x4c0905);}else{return createEndUser(_0x119c91,_0x2be1b1,_0x4c0905,_0x2bc869,_0x2e19dd)[_0x9bef('0xd')](function(_0x1eed40){logger[_0x9bef('0x15')]('['+[_0x119c91['toUpperCase']()]+_0x9bef('0x2a'),_0x1eed40);_0x253a07(_0x1eed40);});}})[_0x9bef('0x11')](function(_0x53f8b6){logger[_0x9bef('0x12')]('['+[_0x119c91[_0x9bef('0x13')]()]+']',_0x53f8b6[_0x9bef('0x14')]);_0x1643b2(_0x53f8b6['message']);});});};}function getCustomFields(_0x2e8b02,_0x534624){var _0x5768d2={};if(_0x2e8b02[_0x9bef('0x1c')]>0x0){_[_0x9bef('0x2b')](_0x2e8b02,function(_0x33c8f2){if(_[_0x9bef('0x2c')]([_0x9bef('0x2d'),_0x9bef('0x2e')],_0x33c8f2[_0x9bef('0x2f')])&&_0x33c8f2['nameField']&&!_0x33c8f2[_0x9bef('0x30')]){_0x5768d2[_0x33c8f2[_0x9bef('0x31')]['toLowerCase']()]=_0x33c8f2[_0x9bef('0x32')][_0x9bef('0x33')]();}else if(_['includes']([_0x9bef('0x2d'),_0x9bef('0x2e')],_0x33c8f2[_0x9bef('0x2f')])&&_0x33c8f2['idField']&&_0x33c8f2['customField']){_0x5768d2[_0x33c8f2['idField'][_0x9bef('0x34')]()]=_0x33c8f2[_0x9bef('0x32')][_0x9bef('0x33')]();}else if(_0x33c8f2[_0x9bef('0x2f')]===_0x9bef('0x35')&&_0x33c8f2['variableName']&&_0x33c8f2[_0x9bef('0x36')]&&_0x33c8f2[_0x9bef('0x30')]){_0x5768d2[_0x33c8f2[_0x9bef('0x36')]['toLowerCase']()]=_0x534624[_0x33c8f2['variableName']][_0x9bef('0x33')]();}else if(_0x33c8f2[_0x9bef('0x2f')]===_0x9bef('0x37')&&_0x33c8f2[_0x9bef('0x38')]&&_0x33c8f2['Variable'][_0x9bef('0x39')]&&_0x33c8f2[_0x9bef('0x36')]&&_0x33c8f2[_0x9bef('0x30')]){_0x5768d2[_0x33c8f2[_0x9bef('0x36')][_0x9bef('0x34')]()]=_0x534624[_0x33c8f2[_0x9bef('0x38')][_0x9bef('0x39')][_0x9bef('0x34')]()][_0x9bef('0x33')]();}});}return _0x5768d2;}function getTicket(_0x483239,_0x4a2945,_0x5b0c5f,_0x5882de,_0x1fc591,_0x5918ed){return function(_0xe874fa){logger['info']('['+[_0x483239['toUpperCase']()]+']\x20getTicket\x20input\x20crm',_0xe874fa);return new Promise(function(_0x2681f0,_0x35dddc){var _0x285a8c=_0x483239[_0x9bef('0x34')]()===_0x9bef('0x3a')?_0xe874fa[_0x9bef('0x1e')]:_0xe874fa['endUserId'];var _0x44ca2b={'method':'POST','uri':_0x5b0c5f+_0x9bef('0x3b')+'?'+_0x5918ed,'body':Object['assign']({},{'active':_0x9bef('0x1d'),'caller_id':_0x285a8c,'assigned_to':_0xe874fa[_0x9bef('0x1e')],'short_description':intUtil[_0x9bef('0x3c')](_0x5882de[_0x9bef('0x3d')],_0x1fc591,'\x20'),'description':intUtil[_0x9bef('0x3c')](_0x5882de[_0x9bef('0x3e')],_0x1fc591,'\x0a')},getCustomFields(_0x5882de['Fields'],_0x1fc591)),'auth':_0x4a2945,'json':!![]};return rp(_0x44ca2b)[_0x9bef('0xd')](function(_0x38f6aa){logger['info']('['+[_0x483239[_0x9bef('0x13')]()]+_0x9bef('0x3f'),_0x38f6aa['result']);_0xe874fa[_0x9bef('0x40')]=_0x38f6aa[_0x9bef('0xe')][_0x9bef('0x1f')];_0xe874fa[_0x9bef('0x41')]=_0x38f6aa[_0x9bef('0xe')]['number'];logger[_0x9bef('0x15')]('['+[_0x483239[_0x9bef('0x13')]()]+_0x9bef('0x42'),_0xe874fa);_0x2681f0(_0xe874fa);})[_0x9bef('0x11')](function(_0x162af9){logger['error']('['+[_0x483239[_0x9bef('0x13')]()]+']',_0x162af9[_0x9bef('0x14')]);_0x35dddc(_0x162af9[_0x9bef('0x14')]);});});};}function createRemoteTag(_0x5dee2b,_0x879933,_0x1870cb,_0x49da8f){return new Promise(function(_0x57ca94,_0x4d9245){var _0x3be1b3={'method':_0x9bef('0x23'),'uri':_0x1870cb+_0x9bef('0x43')+'?'+_0x49da8f,'body':{'short_description':_0x5dee2b,'global':!![],'active':!![],'name':_0x5dee2b},'auth':_0x879933,'json':!![]};return rp(_0x3be1b3)[_0x9bef('0xd')](function(_0x587461){var _0x13f192=_0x587461[_0x9bef('0xe')][_0x9bef('0x1f')];_0x57ca94(_0x13f192);});});}function getRemoteTag(_0x3a4b0b,_0x2af325,_0x328cf7,_0x411ce2,_0x448c05){return new Promise(function(_0x211c77,_0x3587c7){var _0x5bb3c9={'method':_0x9bef('0xb'),'uri':_0x328cf7+_0x9bef('0x43')+_0x9bef('0x44')+_0x3a4b0b+'&'+_0x411ce2,'auth':_0x2af325,'json':!![]};return rp(_0x5bb3c9)[_0x9bef('0xd')](function(_0x587564){if(_0x587564['result'][_0x9bef('0x1c')]>0x0){var _0x230121=_0x587564[_0x9bef('0xe')][0x0][_0x9bef('0x1f')];_0x211c77(_0x230121);}else{return createRemoteTag(_0x3a4b0b,_0x2af325,_0x328cf7,_0x411ce2)[_0x9bef('0xd')](function(_0xaffd7d){_0x211c77(_0xaffd7d);});}});});}function assignTagToIncident(_0x3b5aee,_0x2ff569,_0x18d235,_0x51f1c6,_0x4a2654){return new Promise(function(_0x4012f0,_0xa57cfe){var _0x4ed9ba={'method':_0x9bef('0x23'),'uri':_0x18d235+_0x9bef('0x45')+'?'+_0x4a2654,'body':{'label':_0x3b5aee,'table':_0x9bef('0x3b'),'id_type':_0x9bef('0x46'),'table_key':_0x51f1c6[_0x9bef('0x40')],'title':'Incident\x20-\x20'+_0x51f1c6[_0x9bef('0x41')],'id_display':_0x51f1c6[_0x9bef('0x41')]},'auth':_0x2ff569,'json':!![]};return rp(_0x4ed9ba)['then'](function(_0x5d9960){_0x4012f0();})[_0x9bef('0x11')](function(){_0x4012f0();});});}function manageTags(_0x15cc78,_0x196747,_0x14d82c,_0x5ade99,_0x476d7a,_0xdf8d18,_0x434fc3){return new Promise(function(_0x4bda05,_0x177680){var _0x401c0a=[];_0x196747[_0x9bef('0x2b')](function(_0x3ae47e){_0x401c0a[_0x9bef('0x47')](getRemoteTag(_0x3ae47e,_0x14d82c,_0x5ade99,_0xdf8d18,_0x434fc3));});return Promise[_0x9bef('0x48')](_0x401c0a)[_0x9bef('0xd')](function(_0x232f85){if(_0x232f85[_0x9bef('0x1c')]){logger[_0x9bef('0x15')]('['+[_0x15cc78[_0x9bef('0x13')]()]+_0x9bef('0x49'),_0x232f85);var _0x553842=[];_0x232f85['forEach'](function(_0x5ba72a){_0x553842['push'](assignTagToIncident(_0x5ba72a,_0x14d82c,_0x5ade99,_0x476d7a,_0xdf8d18));});return Promise[_0x9bef('0x48')](_0x553842)['then'](function(){_0x4bda05();})['catch'](function(){_0x4bda05();});}else{_0x4bda05();}});});}function getTags(_0x5d1e83,_0x4f9e3a,_0x21549b,_0x399951,_0xbc20e7,_0x209c91){return function(_0xc382d8){return new Promise(function(_0x2382f4,_0xa074e5){var _0x446c1b=[];var _0x1faef5=_0x399951[_0x9bef('0x4a')];if(_0x1faef5&&_0x1faef5[_0x9bef('0x1c')]>0x0){_0x446c1b=_[_0x9bef('0x4b')](_0x1faef5,_0x9bef('0x39'));}if(_0x446c1b[_0x9bef('0x1c')]>0x0){return manageTags(_0x5d1e83,_0x446c1b,_0x4f9e3a,_0x21549b,_0xc382d8,_0xbc20e7,_0x209c91)[_0x9bef('0xd')](function(){_0x2382f4(_0xc382d8);});}else{_0x2382f4(_0xc382d8);}});};}function emit(_0x16a3fd,_0x55b703,_0x5b51a8){var _0x1a2166=_0x9bef('0x4c')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0x9bef('0x4d')+'%255EORDERBYDESCnumber';var _0x3db5c9={'uri':_0x16a3fd+_0x9bef('0x4e')+_0x5b51a8+_0x1a2166};io['to'](util[_0x9bef('0x4f')](_0x9bef('0x50'),_0x55b703))[_0x9bef('0x51')](_0x9bef('0x52'),_0x3db5c9);}exports['cs']=function(_0x1e2ff4,_0x3a623b,_0x361cf3,_0x332cc3,_0x15ed2e,_0x135826,_0x416b57,_0x363e66){var _0x2de75e={};var _0x42de13={'user':_0x135826[_0x9bef('0x53')],'pass':_0x135826[_0x9bef('0x54')]};var _0x59fcf8=_0x9bef('0x55');var _0x499c66=_0x9bef('0x56');_0x135826[_0x9bef('0x57')]=intUtil['stripTrailingSlash'](_0x135826[_0x9bef('0x57')]);_0x135826['serverUrl']=intUtil['stripTrailingSlash'](_0x135826[_0x9bef('0x58')]);var _0x2ae3bd=util[_0x9bef('0x4f')](_0x9bef('0x59'),_0x135826['remoteUri']);_0x2de75e['userEmail']=!_[_0x9bef('0x5a')](_0x332cc3)?_0x332cc3[_0x9bef('0x5b')]:null;_0x2de75e['adminEmail']=_0x135826['email'];_0x2de75e[_0x9bef('0x24')]=_0x363e66[_0x9bef('0x34')]()===_0x9bef('0x3a')?_0x3a623b[_0x9bef('0x5c')]:_0x3a623b[_0x9bef('0x5d')];_0x2de75e[_0x9bef('0x5e')]=_0x363e66===_0x9bef('0x5f')||_0x363e66==='unmanaged'?_0x9bef('0x5f'):'outbound';var _0xc7338e=util[_0x9bef('0x4f')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x135826['serverUrl'],_0x3a623b[_0x9bef('0x60')],md5(_0x3a623b['uniqueid']));if(_0x15ed2e&&_0x15ed2e['monitor_format']){logger[_0x9bef('0x15')](_0x9bef('0x61'),_0x9bef('0x62'));_0x3a623b[_0x9bef('0x63')]=_0xc7338e;}else if(_0x416b57&&_0x416b57['recordingFormat']&&_0x416b57['recordingFormat']!==_0x9bef('0x64')){logger['info'](_0x9bef('0x65'),_0x9bef('0x62'));_0x3a623b[_0x9bef('0x63')]=_0xc7338e;}else{_0x3a623b['recordingURL']='';}return getAdminUser(_0x363e66,_0x42de13,_0x2de75e,_0x2ae3bd,_0x499c66,_0x59fcf8)['then'](getUser(_0x363e66,_0x42de13,_0x2ae3bd,_0x499c66,_0x59fcf8))[_0x9bef('0xd')](getEndUser(_0x363e66,_0x42de13,_0x2ae3bd,_0x499c66,_0x59fcf8))[_0x9bef('0xd')](getTicket(_0x363e66,_0x42de13,_0x2ae3bd,_0x361cf3,_0x3a623b,_0x499c66))[_0x9bef('0xd')](function(_0x399857){logger[_0x9bef('0x15')](util[_0x9bef('0x4f')](_0x9bef('0x66'),_0x399857[_0x9bef('0x40')]));logger[_0x9bef('0x15')](util[_0x9bef('0x4f')](_0x9bef('0x67'),_0x363e66));if(_0x363e66!==_0x9bef('0x68')){logger[_0x9bef('0x15')]('['+[_0x363e66[_0x9bef('0x13')]()]+']',_0x9bef('0x69'));emit(_0x135826['remoteUri'],_0x332cc3[_0x9bef('0x39')],_0x399857[_0x9bef('0x40')]);}})[_0x9bef('0x11')](function(_0x69a07f){logger[_0x9bef('0x12')]('['+[_0x363e66[_0x9bef('0x13')]()]+_0x9bef('0x6a'),util[_0x9bef('0x6b')](_0x69a07f,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/sugarcrm.js b/server/services/ami/trigger/integration/sugarcrm.js index 0ae0e7a..fce0b73 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 _0x4496=['calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','uri','recordingFormat','none','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','[OUTBOUND]','unmanaged','lastevent','toUpperCase','request-promise','bluebird','md5','util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','emit','Creating\x20new\x20ticket...','name','created_by','description','getString','Descriptions','toISOString','slice','replace','duration_hours','duration_minutes','parent_id','Contacts','direction','length','forEach','variableName','push','idField','set_entry','JSON','stringify','Calls','toString','isNil','info','Getting\x20agent\x20with\x20name','Employees','format','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','name_value_list','value','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','get_entry_list','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Caller\x20-\x20%s','Enduser\x20created.','first_name','debug','[HTTP]','merge','map','type','string','nameField','customField','toLowerCase','content','custom_fields','variable','customVariable','Variable','POST','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','The\x20User\x20ID\x20is:','calleridname'];(function(_0x1b5aea,_0x3f04b7){var _0x15cfc6=function(_0x204e92){while(--_0x204e92){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x15cfc6(++_0x3f04b7);}(_0x4496,0x91));var _0x6449=function(_0x3141aa,_0x14de48){_0x3141aa=_0x3141aa-0x0;var _0x2a55b6=_0x4496[_0x3141aa];return _0x2a55b6;};'use strict';var _=require('lodash');var rp=require(_0x6449('0x0'));var BPromise=require(_0x6449('0x1'));var md5=require(_0x6449('0x2'));var util=require(_0x6449('0x3'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x6449('0x4'));var logger=require(_0x6449('0x5'))('sugarcrm');config[_0x6449('0x6')]=_[_0x6449('0x7')](config[_0x6449('0x6')],{'host':_0x6449('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6449('0x6')]));var def={'method':'POST','json':!![]};function emit(_0x523693,_0x3710b2,_0x1db0d9){io['to'](_0x523693)[_0x6449('0x9')](_0x3710b2,_0x1db0d9);}function getTicket(_0x13bb98,_0x258bcf,_0x5367dc,_0x5df2e6,_0x3f1846,_0x4332e0,_0x454d2d,_0x5d2408){logger['info'](_0x6449('0xa'));var _0x4c1333=new Date();var _0x38dba9=[{'name':_0x6449('0xb'),'value':intUtil['getString'](_0x5df2e6['Subjects'],_0x3f1846,'\x20')},{'name':'assigned_user_id','value':_0x258bcf['id']},{'name':_0x6449('0xc'),'value':_0x258bcf['id']},{'name':_0x6449('0xd'),'value':intUtil[_0x6449('0xe')](_0x5df2e6[_0x6449('0xf')],_0x3f1846,'\x0a')},{'name':'date_start','value':_0x4c1333[_0x6449('0x10')]()[_0x6449('0x11')](0x0,0x13)[_0x6449('0x12')]('T','\x20')},{'name':_0x6449('0x13'),'value':'0'},{'name':_0x6449('0x14'),'value':'15'},{'name':_0x6449('0x15'),'value':_0x5367dc['id']},{'name':'parent_type','value':_0x6449('0x16')},{'name':'parent_name','value':_0x5367dc[_0x6449('0xb')]},{'name':_0x6449('0x17'),'value':_0x5d2408}];if(_0x4332e0[_0x6449('0x18')]){_[_0x6449('0x19')](_0x4332e0,function(_0x215c5c){if(_0x3f1846[_0x215c5c[_0x6449('0x1a')]]){_0x38dba9[_0x6449('0x1b')]({'name':_0x215c5c[_0x6449('0x1c')],'value':_0x3f1846[_0x215c5c[_0x6449('0x1a')]]});}});}return request({'form':{'method':_0x6449('0x1d'),'input_type':_0x6449('0x1e'),'response_type':_0x6449('0x1e'),'rest_data':JSON[_0x6449('0x1f')]({'session':_0x454d2d['id'],'module_name':_0x6449('0x20'),'name_value_list':_0x38dba9})}});}function getAuth(_0x35103e){return util['format']('Basic\x20%s',new Buffer(_0x35103e['apiKey']+':X')[_0x6449('0x21')]('base64'));}function getServerInfo(_0x158d29){return request({'form':{'method':'get_server_info','input_type':_0x6449('0x1e'),'response_type':_0x6449('0x1e'),'rest_data':JSON['stringify']({'session':_0x158d29['id']})}});}function getUser(_0x4d72e8,_0x572dae,_0x12b0de){if(!_[_0x6449('0x22')](_0x572dae)){logger[_0x6449('0x23')](_0x6449('0x24'),_0x572dae);return request({'form':{'method':'get_entry_list','input_type':_0x6449('0x1e'),'response_type':_0x6449('0x1e'),'rest_data':JSON['stringify']({'session':_0x12b0de['id'],'module_name':_0x6449('0x25'),'query':util[_0x6449('0x26')](_0x6449('0x27'),_0x572dae),'order_by':'','offset':'0','select_fields':['id',_0x6449('0xb'),_0x6449('0x28')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x6449('0x29')](function(_0x6262cf){if(_0x6262cf[_0x6449('0x2a')][_0x6449('0x18')]){var _0x2748a5=_[_0x6449('0x2b')](_0x6262cf[_0x6449('0x2a')],function(_0x459614){return _0x459614[_0x6449('0x2c')][_0x6449('0x28')][_0x6449('0x2d')]===_0x572dae;});if(_0x2748a5){logger[_0x6449('0x23')]('Agent\x20found!');return BPromise[_0x6449('0x2e')]({'id':_0x2748a5[_0x6449('0x2c')]['id'][_0x6449('0x2d')],'name':_0x2748a5[_0x6449('0x2c')]['name'][_0x6449('0x2d')]});}}logger[_0x6449('0x23')](_0x6449('0x2f'));return BPromise[_0x6449('0x2e')]({'id':_0x12b0de['name_value_list'][_0x6449('0x30')][_0x6449('0x2d')],'name':_0x12b0de[_0x6449('0x2c')][_0x6449('0x28')][_0x6449('0x2d')]});});}else{logger[_0x6449('0x23')](_0x6449('0x31'));return BPromise[_0x6449('0x2e')]({'id':_0x12b0de['name_value_list'][_0x6449('0x30')][_0x6449('0x2d')],'name':_0x12b0de[_0x6449('0x2c')]['user_name']['value']});}}function getEndUser(_0xc8a70e,_0x5d91d9,_0x5c2cc0,_0x5ea892){logger[_0x6449('0x23')](_0x6449('0x32'),_0x5c2cc0);return request({'form':{'method':_0x6449('0x33'),'input_type':_0x6449('0x1e'),'response_type':'JSON','rest_data':JSON[_0x6449('0x1f')]({'session':_0x5ea892['id'],'module_name':_0x6449('0x16'),'query':util[_0x6449('0x26')](_0x6449('0x34'),_0x5c2cc0),'order_by':'','offset':'0','select_fields':['id',_0x6449('0xb'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x5d7fe4){if(_0x5d7fe4[_0x6449('0x2a')][_0x6449('0x18')]){var _0x5d242c=_['find'](_0x5d7fe4['entry_list'],function(_0x4cda43){return _0x4cda43['name_value_list'][_0x6449('0x35')][_0x6449('0x2d')]===_0x5c2cc0;});if(_0x5d242c){logger[_0x6449('0x23')](_0x6449('0x36'));return BPromise[_0x6449('0x2e')]({'id':_0x5d242c[_0x6449('0x2c')]['id']['value'],'name':_0x5d242c[_0x6449('0x2c')]['name'][_0x6449('0x2d')],'phone':_0x5d242c[_0x6449('0x2c')][_0x6449('0x35')][_0x6449('0x2d')]});}}else{logger[_0x6449('0x23')](_0x6449('0x37'));return request({'form':{'method':'set_entry','input_type':'JSON','response_type':_0x6449('0x1e'),'rest_data':JSON[_0x6449('0x1f')]({'session':_0x5ea892['id'],'module_name':_0x6449('0x16'),'name_value_list':[{'name':'first_name','value':_0x5d91d9!==''?_0x5d91d9:util[_0x6449('0x26')](_0x6449('0x38'),_0x5c2cc0)},{'name':'phone_home','value':_0x5c2cc0}]})}})[_0x6449('0x29')](function(_0x22115f){logger[_0x6449('0x23')](_0x6449('0x39'));return BPromise[_0x6449('0x2e')]({'id':_0x22115f['id'],'name':_0x22115f[_0x6449('0x2a')][_0x6449('0x3a')]['value'],'phone':_0x22115f[_0x6449('0x2a')][_0x6449('0x35')][_0x6449('0x2d')]});});}});}function request(_0x4091c7){logger[_0x6449('0x3b')](_0x6449('0x3c'),JSON[_0x6449('0x1f')](_0x4091c7));return rp(_[_0x6449('0x3d')](def,_0x4091c7));}function getTags(_0x2bd099,_0x2cbc8d){var _0x337492=[];if(_0x2bd099&&_0x2bd099[_0x6449('0x18')]>0x0){_0x337492=_[_0x6449('0x3e')](_0x2bd099,_0x2cbc8d);}return _0x337492;}function getCustomFields(_0x2dc29d,_0x1c8510){var _0x44aa4d=[];var _0x33b932={'custom_fields':[]};if(_0x2dc29d['length']>0x0){_[_0x6449('0x19')](_0x2dc29d,function(_0x4827e9){if(_0x4827e9[_0x6449('0x3f')]===_0x6449('0x40')&&_0x4827e9[_0x6449('0x41')]&&!_0x4827e9[_0x6449('0x42')]){_0x33b932[_0x4827e9[_0x6449('0x41')][_0x6449('0x43')]()]=_0x4827e9[_0x6449('0x44')]['toString']();}else if(_0x4827e9['type']===_0x6449('0x40')&&_0x4827e9[_0x6449('0x1c')]&&_0x4827e9[_0x6449('0x42')]){_0x33b932[_0x6449('0x45')][_0x6449('0x1b')]({'id':_0x4827e9[_0x6449('0x1c')],'value':_0x4827e9['content']['toString']()});}else if(_0x4827e9[_0x6449('0x3f')]===_0x6449('0x46')&&_0x4827e9['variableName']&&_0x4827e9[_0x6449('0x1c')]&&_0x4827e9['customField']){_0x1c8510[_0x4827e9[_0x6449('0x1a')]]&&_0x33b932[_0x6449('0x45')][_0x6449('0x1b')]({'id':_0x4827e9['idField'],'value':_0x1c8510[_0x4827e9[_0x6449('0x1a')]]['toString']()});}else if(_0x4827e9[_0x6449('0x3f')]===_0x6449('0x47')&&_0x4827e9[_0x6449('0x48')]&&_0x4827e9['Variable'][_0x6449('0xb')]&&_0x4827e9[_0x6449('0x1c')]&&_0x4827e9['customField']){_0x1c8510[_0x4827e9[_0x6449('0x48')][_0x6449('0xb')][_0x6449('0x43')]()]&&_0x33b932[_0x6449('0x45')][_0x6449('0x1b')]({'id':_0x4827e9[_0x6449('0x1c')],'value':_0x1c8510[_0x4827e9[_0x6449('0x48')][_0x6449('0xb')][_0x6449('0x43')]()]['toString']()});}});}return _0x33b932;}function getConnection(_0x56f584){return request({'method':_0x6449('0x49'),'form':{'method':_0x6449('0x4a'),'input_type':_0x6449('0x1e'),'response_type':_0x6449('0x1e'),'rest_data':JSON[_0x6449('0x1f')]({'user_auth':{'user_name':_0x56f584[_0x6449('0x4b')],'password':_0x56f584[_0x6449('0x4c')],'encryption':_0x6449('0x4d')},'application':_0x6449('0x4e')})}})[_0x6449('0x29')](function(_0x3be1a6){var _0x5f1a52=_0x3be1a6;if(_0x5f1a52['id']){def[_0x6449('0x4f')]=_0x5f1a52['id'];return BPromise[_0x6449('0x2e')](_0x5f1a52);}else{throw new Error(util['format'](_0x6449('0x50'),_0x56f584['id']));}});}function setRelationship(_0x1c428c,_0x52a37a,_0x47e650,_0x482d89){return request({'form':{'method':_0x6449('0x51'),'input_type':'JSON','response_type':'JSON','rest_data':JSON['stringify']({'session':_0x1c428c['id'],'module_name':'Calls','module_id':_0x47e650['id'],'link_field_name':_0x482d89,'related_ids':[_0x52a37a['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x6449('0x52')]=function(_0x5cad27,_0x563981,_0x47de92,_0x32775f,_0x9c93d8,_0x366520){var _0x4633af,_0x3a063b,_0x300d3b,_0x4a8bef;_0x366520[_0x6449('0x53')]=intUtil[_0x6449('0x54')](_0x366520[_0x6449('0x53')]);_0x366520[_0x6449('0x55')]=intUtil['stripTrailingSlash'](_0x366520[_0x6449('0x55')]);def['uri']=util['format'](_0x6449('0x56'),_0x366520[_0x6449('0x53')]);if(_0x9c93d8&&_0x9c93d8[_0x6449('0x57')]){logger[_0x6449('0x23')](_0x6449('0x58'),_0x6449('0x59'));_0x563981['recordingURL']=util[_0x6449('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x366520[_0x6449('0x55')],_0x563981[_0x6449('0x5a')],md5(_0x563981[_0x6449('0x5a')]));}else{_0x563981['recordingURL']='';}return getConnection(_0x366520)[_0x6449('0x29')](function(_0x4fcaa4){_0x4a8bef=_0x4fcaa4;return getUser(_0x366520,_0x32775f[_0x6449('0xb')],_0x4a8bef);})[_0x6449('0x29')](function(_0x7e537e){_0x4633af=_0x7e537e;logger['info'](_0x6449('0x5b'),_0x4633af['id']);return getEndUser(_0x366520,_0x563981[_0x6449('0x5c')],_0x563981[_0x6449('0x5d')],_0x4a8bef);})[_0x6449('0x29')](function(_0x95ee9b){_0x3a063b=_0x95ee9b;logger[_0x6449('0x23')](_0x6449('0x5e'),_0x3a063b['id']);return getTicket(_0x366520,_0x4633af,_0x3a063b,_0x47de92,_0x563981,_0x47de92[_0x6449('0x5f')],_0x4a8bef,_0x6449('0x60'));})['then'](function(_0x1d2562){_0x300d3b=_0x1d2562;logger[_0x6449('0x23')](_0x6449('0x61'));logger[_0x6449('0x23')](_0x6449('0x62'),_0x300d3b['id']);return setRelationship(_0x4a8bef,_0x4633af,_0x300d3b,_0x6449('0x63'));})[_0x6449('0x29')](function(){return setRelationship(_0x4a8bef,_0x3a063b,_0x300d3b,_0x6449('0x64'));})['then'](function(){return getServerInfo(_0x4a8bef);})[_0x6449('0x29')](function(_0x2d1b9d){var _0x5fabae=parseInt(_0x2d1b9d['version'][_0x6449('0x65')](0x0));var _0x53b395=util[_0x6449('0x26')](_0x6449('0x66'),_0x366520['remoteUri'],_0x300d3b['id']);if(_0x5fabae>0x6){_0x53b395=util[_0x6449('0x26')](_0x6449('0x67'),_0x366520[_0x6449('0x53')],_0x300d3b['id']);}logger['info'](_0x6449('0x58'),_0x6449('0x68'));emit(util[_0x6449('0x26')](_0x6449('0x69'),_0x32775f[_0x6449('0xb')]),_0x6449('0x6a'),{'uri':_0x53b395});})[_0x6449('0x6b')](function(_0x343582){logger[_0x6449('0x6c')](_0x6449('0x58'),JSON[_0x6449('0x1f')](_0x343582));});};exports[_0x6449('0x6d')]=function(_0x292e08,_0x5dca94,_0x16d4c7,_0x501c4d,_0x25e042,_0x3852b6,_0x539cb1){var _0x2a869c,_0x425ff9,_0x33858b,_0x57107b;_0x3852b6[_0x6449('0x53')]=intUtil[_0x6449('0x54')](_0x3852b6[_0x6449('0x53')]);_0x3852b6['serverUrl']=intUtil[_0x6449('0x54')](_0x3852b6['serverUrl']);def[_0x6449('0x6e')]=util[_0x6449('0x26')](_0x6449('0x56'),_0x3852b6[_0x6449('0x53')]);if(_0x539cb1&&_0x539cb1[_0x6449('0x6f')]&&_0x539cb1[_0x6449('0x6f')]!==_0x6449('0x70')){logger[_0x6449('0x23')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x5dca94[_0x6449('0x71')]=util[_0x6449('0x26')](_0x6449('0x72'),_0x3852b6['serverUrl'],_0x5dca94[_0x6449('0x5a')],md5(_0x5dca94['uniqueid']));}return getConnection(_0x3852b6)[_0x6449('0x29')](function(_0x30361f){_0x57107b=_0x30361f;return getUser(_0x3852b6,_0x501c4d[_0x6449('0xb')],_0x57107b);})[_0x6449('0x29')](function(_0x26935c){_0x2a869c=_0x26935c;logger['info'](_0x6449('0x5b'),_0x2a869c['id']);return getEndUser(_0x3852b6,_0x5dca94['destcalleridname'],_0x5dca94['destcalleridnum'],_0x57107b);})[_0x6449('0x29')](function(_0x409d4e){_0x425ff9=_0x409d4e;logger[_0x6449('0x23')]('The\x20Enduser\x20ID\x20is:',_0x425ff9['id']);return getTicket(_0x3852b6,_0x2a869c,_0x425ff9,_0x16d4c7,_0x5dca94,_0x16d4c7[_0x6449('0x5f')],_0x57107b,'Outbound');})[_0x6449('0x29')](function(_0x18aada){_0x33858b=_0x18aada;logger[_0x6449('0x23')]('Ticket\x20created!');logger[_0x6449('0x23')](_0x6449('0x62'),_0x33858b['id']);return setRelationship(_0x57107b,_0x2a869c,_0x33858b,'users');})[_0x6449('0x29')](function(){return setRelationship(_0x57107b,_0x425ff9,_0x33858b,_0x6449('0x64'));})[_0x6449('0x29')](function(){return getServerInfo(_0x57107b);})[_0x6449('0x29')](function(_0x217488){var _0x1c778a=parseInt(_0x217488['version'][_0x6449('0x65')](0x0));var _0x4ec277=util[_0x6449('0x26')](_0x6449('0x66'),_0x3852b6[_0x6449('0x53')],_0x33858b['id']);if(_0x1c778a>0x6){_0x4ec277=util[_0x6449('0x26')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x3852b6[_0x6449('0x53')],_0x33858b['id']);}logger['info'](_0x6449('0x73'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x6449('0x26')](_0x6449('0x69'),_0x501c4d[_0x6449('0xb')]),_0x6449('0x6a'),{'uri':_0x4ec277});})[_0x6449('0x6b')](function(_0x2e5fc6){logger['error'](_0x6449('0x73'),JSON['stringify'](_0x2e5fc6));});};exports[_0x6449('0x74')]=function(_0x107555,_0x4f09ca,_0x3bea58,_0x317f75,_0x5e2441,_0x4da1fd){var _0x11db56,_0x5721ed,_0x1a8430,_0x458450;_0x4da1fd[_0x6449('0x53')]=intUtil[_0x6449('0x54')](_0x4da1fd['remoteUri']);_0x4da1fd[_0x6449('0x55')]=intUtil[_0x6449('0x54')](_0x4da1fd[_0x6449('0x55')]);def['uri']=util[_0x6449('0x26')]('%s/service/v4_1/rest.php',_0x4da1fd[_0x6449('0x53')]);if(_0x5e2441&&_0x5e2441['monitor_format']){logger[_0x6449('0x23')]('['+_0x4f09ca[_0x6449('0x75')]['toUpperCase']()+']',_0x6449('0x59'));_0x4f09ca['recordingURL']=util[_0x6449('0x26')](_0x6449('0x72'),_0x4da1fd['serverUrl'],_0x4f09ca[_0x6449('0x5a')],md5(_0x4f09ca[_0x6449('0x5a')]));}else{_0x4f09ca[_0x6449('0x71')]='';}return getConnection(_0x4da1fd)[_0x6449('0x29')](function(_0x178e66){_0x458450=_0x178e66;if(!_[_0x6449('0x22')](_0x317f75)){return getUser(_0x4da1fd,_0x317f75['name'],_0x458450);}else{return getUser(_0x4da1fd,null,_0x458450);}})[_0x6449('0x29')](function(_0x120484){_0x11db56=_0x120484;logger[_0x6449('0x23')](_0x6449('0x5b'),_0x11db56['id']);return getEndUser(_0x4da1fd,_0x4f09ca[_0x6449('0x5c')],_0x4f09ca[_0x6449('0x5d')],_0x458450);})[_0x6449('0x29')](function(_0x4e5fb0){_0x5721ed=_0x4e5fb0;logger[_0x6449('0x23')]('The\x20Enduser\x20ID\x20is:',_0x5721ed['id']);return getTicket(_0x4da1fd,_0x11db56,_0x5721ed,_0x3bea58,_0x4f09ca,_0x3bea58[_0x6449('0x5f')],_0x458450,_0x6449('0x60'));})[_0x6449('0x29')](function(_0x4bcd47){_0x1a8430=_0x4bcd47;logger['info'](_0x6449('0x61'));logger['info'](_0x6449('0x62'),_0x1a8430['id']);return setRelationship(_0x458450,_0x11db56,_0x1a8430,_0x6449('0x63'));})[_0x6449('0x29')](function(){return setRelationship(_0x458450,_0x5721ed,_0x1a8430,_0x6449('0x64'));})['then'](function(){return getServerInfo(_0x458450);})[_0x6449('0x6b')](function(_0x35ff62){logger[_0x6449('0x6c')]('['+_0x4f09ca[_0x6449('0x75')][_0x6449('0x76')]()+']',JSON['stringify'](_0x35ff62));});}; \ No newline at end of file +var _0x821d=['format','Basic\x20%s','toString','base64','get_server_info','Getting\x20agent\x20with\x20name','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','length','find','name_value_list','value','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','get_entry_list','Contacts','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','map','type','string','nameField','customField','toLowerCase','content','idField','custom_fields','variable','customVariable','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridname','calleridnum','Fields','Inbound','The\x20Ticket\x20ID\x20is:','version','charAt','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','error','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','users','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','trigger:browser:url','monitor_format','lastevent','isNil','contacts','lodash','request-promise','bluebird','util','ioredis','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','info','name','getString','Subjects','assigned_user_id','created_by','description','Descriptions','date_start','toISOString','replace','duration_minutes','parent_id','parent_type','parent_name','direction','forEach','variableName','push','set_entry','JSON','stringify','Calls'];(function(_0x5efa8b,_0x5950cf){var _0x563412=function(_0x256953){while(--_0x256953){_0x5efa8b['push'](_0x5efa8b['shift']());}};_0x563412(++_0x5950cf);}(_0x821d,0x14f));var _0xd821=function(_0x152496,_0x4ecfc9){_0x152496=_0x152496-0x0;var _0x30c567=_0x821d[_0x152496];return _0x30c567;};'use strict';var _=require(_0xd821('0x0'));var rp=require(_0xd821('0x1'));var BPromise=require(_0xd821('0x2'));var md5=require('md5');var util=require(_0xd821('0x3'));var Redis=require(_0xd821('0x4'));var intUtil=require('./util');var config=require(_0xd821('0x5'));var logger=require(_0xd821('0x6'))(_0xd821('0x7'));config[_0xd821('0x8')]=_[_0xd821('0x9')](config[_0xd821('0x8')],{'host':_0xd821('0xa'),'port':0x18eb});var io=require(_0xd821('0xb'))(new Redis(config[_0xd821('0x8')]));var def={'method':_0xd821('0xc'),'json':!![]};function emit(_0x1a096c,_0x15fadb,_0x47fade){io['to'](_0x1a096c)[_0xd821('0xd')](_0x15fadb,_0x47fade);}function getTicket(_0x210bcf,_0x2e7d7e,_0x456b8a,_0x433be3,_0x4cb09c,_0x46b52a,_0x3f765d,_0x2c16c4){logger[_0xd821('0xe')]('Creating\x20new\x20ticket...');var _0x12c303=new Date();var _0x26f663=[{'name':_0xd821('0xf'),'value':intUtil[_0xd821('0x10')](_0x433be3[_0xd821('0x11')],_0x4cb09c,'\x20')},{'name':_0xd821('0x12'),'value':_0x2e7d7e['id']},{'name':_0xd821('0x13'),'value':_0x2e7d7e['id']},{'name':_0xd821('0x14'),'value':intUtil[_0xd821('0x10')](_0x433be3[_0xd821('0x15')],_0x4cb09c,'\x0a')},{'name':_0xd821('0x16'),'value':_0x12c303[_0xd821('0x17')]()['slice'](0x0,0x13)[_0xd821('0x18')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0xd821('0x19'),'value':'15'},{'name':_0xd821('0x1a'),'value':_0x456b8a['id']},{'name':_0xd821('0x1b'),'value':'Contacts'},{'name':_0xd821('0x1c'),'value':_0x456b8a[_0xd821('0xf')]},{'name':_0xd821('0x1d'),'value':_0x2c16c4}];if(_0x46b52a['length']){_[_0xd821('0x1e')](_0x46b52a,function(_0x17c6e5){if(_0x4cb09c[_0x17c6e5[_0xd821('0x1f')]]){_0x26f663[_0xd821('0x20')]({'name':_0x17c6e5['idField'],'value':_0x4cb09c[_0x17c6e5['variableName']]});}});}return request({'form':{'method':_0xd821('0x21'),'input_type':_0xd821('0x22'),'response_type':_0xd821('0x22'),'rest_data':JSON[_0xd821('0x23')]({'session':_0x3f765d['id'],'module_name':_0xd821('0x24'),'name_value_list':_0x26f663})}});}function getAuth(_0x34e163){return util[_0xd821('0x25')](_0xd821('0x26'),new Buffer(_0x34e163['apiKey']+':X')[_0xd821('0x27')](_0xd821('0x28')));}function getServerInfo(_0x598e46){return request({'form':{'method':_0xd821('0x29'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xd821('0x23')]({'session':_0x598e46['id']})}});}function getUser(_0x2838ac,_0x3a88f1,_0x3382ef){if(!_['isNil'](_0x3a88f1)){logger[_0xd821('0xe')](_0xd821('0x2a'),_0x3a88f1);return request({'form':{'method':'get_entry_list','input_type':_0xd821('0x22'),'response_type':'JSON','rest_data':JSON[_0xd821('0x23')]({'session':_0x3382ef['id'],'module_name':_0xd821('0x2b'),'query':util[_0xd821('0x25')](_0xd821('0x2c'),_0x3a88f1),'order_by':'','offset':'0','select_fields':['id',_0xd821('0xf'),_0xd821('0x2d')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xd821('0x2e')](function(_0x45d4aa){if(_0x45d4aa[_0xd821('0x2f')][_0xd821('0x30')]){var _0x2ffcfb=_[_0xd821('0x31')](_0x45d4aa[_0xd821('0x2f')],function(_0x1c3842){return _0x1c3842[_0xd821('0x32')]['user_name'][_0xd821('0x33')]===_0x3a88f1;});if(_0x2ffcfb){logger[_0xd821('0xe')]('Agent\x20found!');return BPromise[_0xd821('0x34')]({'id':_0x2ffcfb[_0xd821('0x32')]['id'][_0xd821('0x33')],'name':_0x2ffcfb[_0xd821('0x32')][_0xd821('0xf')][_0xd821('0x33')]});}}logger[_0xd821('0xe')](_0xd821('0x35'));return BPromise[_0xd821('0x34')]({'id':_0x3382ef[_0xd821('0x32')][_0xd821('0x36')]['value'],'name':_0x3382ef[_0xd821('0x32')][_0xd821('0x2d')][_0xd821('0x33')]});});}else{logger[_0xd821('0xe')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0xd821('0x34')]({'id':_0x3382ef['name_value_list'][_0xd821('0x36')][_0xd821('0x33')],'name':_0x3382ef['name_value_list'][_0xd821('0x2d')][_0xd821('0x33')]});}}function getEndUser(_0x51a732,_0x2ddafa,_0x151f0b,_0x3daf42){logger['info']('Searching\x20enduser\x20with\x20phone',_0x151f0b);return request({'form':{'method':_0xd821('0x37'),'input_type':_0xd821('0x22'),'response_type':'JSON','rest_data':JSON[_0xd821('0x23')]({'session':_0x3daf42['id'],'module_name':_0xd821('0x38'),'query':util[_0xd821('0x25')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x151f0b),'order_by':'','offset':'0','select_fields':['id',_0xd821('0xf'),_0xd821('0x39')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xd821('0x2e')](function(_0x34989f){if(_0x34989f['entry_list'][_0xd821('0x30')]){var _0x153610=_[_0xd821('0x31')](_0x34989f['entry_list'],function(_0x532c19){return _0x532c19[_0xd821('0x32')][_0xd821('0x39')][_0xd821('0x33')]===_0x151f0b;});if(_0x153610){logger[_0xd821('0xe')](_0xd821('0x3a'));return BPromise[_0xd821('0x34')]({'id':_0x153610[_0xd821('0x32')]['id'][_0xd821('0x33')],'name':_0x153610['name_value_list'][_0xd821('0xf')][_0xd821('0x33')],'phone':_0x153610[_0xd821('0x32')][_0xd821('0x39')]['value']});}}else{logger['info'](_0xd821('0x3b'));return request({'form':{'method':_0xd821('0x21'),'input_type':'JSON','response_type':_0xd821('0x22'),'rest_data':JSON[_0xd821('0x23')]({'session':_0x3daf42['id'],'module_name':_0xd821('0x38'),'name_value_list':[{'name':_0xd821('0x3c'),'value':_0x2ddafa!==_0xd821('0x3d')?_0x2ddafa:util['format'](_0xd821('0x3e'),_0x151f0b)},{'name':_0xd821('0x39'),'value':_0x151f0b}]})}})[_0xd821('0x2e')](function(_0x1fc23d){logger[_0xd821('0xe')](_0xd821('0x3f'));return BPromise[_0xd821('0x34')]({'id':_0x1fc23d['id'],'name':_0x1fc23d['entry_list'][_0xd821('0x3c')]['value'],'phone':_0x1fc23d[_0xd821('0x2f')][_0xd821('0x39')][_0xd821('0x33')]});});}});}function request(_0x3ac942){logger[_0xd821('0x40')](_0xd821('0x41'),JSON[_0xd821('0x23')](_0x3ac942));return rp(_[_0xd821('0x42')](def,_0x3ac942));}function getTags(_0x5960d5,_0x4f76ae){var _0x441791=[];if(_0x5960d5&&_0x5960d5[_0xd821('0x30')]>0x0){_0x441791=_[_0xd821('0x43')](_0x5960d5,_0x4f76ae);}return _0x441791;}function getCustomFields(_0x2cc486,_0x416802){var _0x1b1441=[];var _0x58073f={'custom_fields':[]};if(_0x2cc486[_0xd821('0x30')]>0x0){_['forEach'](_0x2cc486,function(_0x23c16d){if(_0x23c16d[_0xd821('0x44')]===_0xd821('0x45')&&_0x23c16d[_0xd821('0x46')]&&!_0x23c16d[_0xd821('0x47')]){_0x58073f[_0x23c16d[_0xd821('0x46')][_0xd821('0x48')]()]=_0x23c16d[_0xd821('0x49')]['toString']();}else if(_0x23c16d[_0xd821('0x44')]===_0xd821('0x45')&&_0x23c16d[_0xd821('0x4a')]&&_0x23c16d[_0xd821('0x47')]){_0x58073f[_0xd821('0x4b')][_0xd821('0x20')]({'id':_0x23c16d[_0xd821('0x4a')],'value':_0x23c16d[_0xd821('0x49')]['toString']()});}else if(_0x23c16d[_0xd821('0x44')]===_0xd821('0x4c')&&_0x23c16d['variableName']&&_0x23c16d[_0xd821('0x4a')]&&_0x23c16d['customField']){_0x416802[_0x23c16d['variableName']]&&_0x58073f[_0xd821('0x4b')][_0xd821('0x20')]({'id':_0x23c16d['idField'],'value':_0x416802[_0x23c16d[_0xd821('0x1f')]][_0xd821('0x27')]()});}else if(_0x23c16d[_0xd821('0x44')]===_0xd821('0x4d')&&_0x23c16d[_0xd821('0x4e')]&&_0x23c16d['Variable']['name']&&_0x23c16d[_0xd821('0x4a')]&&_0x23c16d[_0xd821('0x47')]){_0x416802[_0x23c16d['Variable']['name']['toLowerCase']()]&&_0x58073f[_0xd821('0x4b')][_0xd821('0x20')]({'id':_0x23c16d[_0xd821('0x4a')],'value':_0x416802[_0x23c16d[_0xd821('0x4e')]['name'][_0xd821('0x48')]()][_0xd821('0x27')]()});}});}return _0x58073f;}function getConnection(_0x3e268f){return request({'method':_0xd821('0xc'),'form':{'method':_0xd821('0x4f'),'input_type':_0xd821('0x22'),'response_type':_0xd821('0x22'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x3e268f[_0xd821('0x50')],'password':_0x3e268f[_0xd821('0x51')],'encryption':_0xd821('0x52')},'application':_0xd821('0x53')})}})[_0xd821('0x2e')](function(_0x26e070){var _0x3adc56=_0x26e070;if(_0x3adc56['id']){def[_0xd821('0x54')]=_0x3adc56['id'];return BPromise[_0xd821('0x34')](_0x3adc56);}else{throw new Error(util['format'](_0xd821('0x55'),_0x3e268f['id']));}});}function setRelationship(_0x3da7de,_0x419add,_0x2ce81c,_0x23af7d){return request({'form':{'method':'set_relationship','input_type':_0xd821('0x22'),'response_type':_0xd821('0x22'),'rest_data':JSON['stringify']({'session':_0x3da7de['id'],'module_name':_0xd821('0x24'),'module_id':_0x2ce81c['id'],'link_field_name':_0x23af7d,'related_ids':[_0x419add['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xd821('0x56')]=function(_0xbebf80,_0x2ed202,_0xd9a701,_0x1ee065,_0x5a40d1,_0x47dafa){var _0x3b0272,_0x41b12a,_0x664c9f,_0x7151e0;_0x47dafa[_0xd821('0x57')]=intUtil[_0xd821('0x58')](_0x47dafa[_0xd821('0x57')]);_0x47dafa[_0xd821('0x59')]=intUtil['stripTrailingSlash'](_0x47dafa[_0xd821('0x59')]);def[_0xd821('0x5a')]=util[_0xd821('0x25')](_0xd821('0x5b'),_0x47dafa[_0xd821('0x57')]);if(_0x5a40d1&&_0x5a40d1['monitor_format']){logger[_0xd821('0xe')](_0xd821('0x5c'),_0xd821('0x5d'));_0x2ed202['recordingURL']=util[_0xd821('0x25')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x47dafa[_0xd821('0x59')],_0x2ed202[_0xd821('0x5e')],md5(_0x2ed202['uniqueid']));}else{_0x2ed202[_0xd821('0x5f')]='';}return getConnection(_0x47dafa)[_0xd821('0x2e')](function(_0x77ac5a){_0x7151e0=_0x77ac5a;return getUser(_0x47dafa,_0x1ee065[_0xd821('0xf')],_0x7151e0);})['then'](function(_0x126f49){_0x3b0272=_0x126f49;logger[_0xd821('0xe')](_0xd821('0x60'),_0x3b0272['id']);return getEndUser(_0x47dafa,_0x2ed202[_0xd821('0x61')],_0x2ed202[_0xd821('0x62')],_0x7151e0);})[_0xd821('0x2e')](function(_0x375bf7){_0x41b12a=_0x375bf7;logger['info']('The\x20Enduser\x20ID\x20is:',_0x41b12a['id']);return getTicket(_0x47dafa,_0x3b0272,_0x41b12a,_0xd9a701,_0x2ed202,_0xd9a701[_0xd821('0x63')],_0x7151e0,_0xd821('0x64'));})['then'](function(_0xf76e56){_0x664c9f=_0xf76e56;logger['info']('Ticket\x20created!');logger[_0xd821('0xe')](_0xd821('0x65'),_0x664c9f['id']);return setRelationship(_0x7151e0,_0x3b0272,_0x664c9f,'users');})[_0xd821('0x2e')](function(){return setRelationship(_0x7151e0,_0x41b12a,_0x664c9f,'contacts');})[_0xd821('0x2e')](function(){return getServerInfo(_0x7151e0);})['then'](function(_0x319825){var _0x520032=parseInt(_0x319825[_0xd821('0x66')][_0xd821('0x67')](0x0));var _0x17b89f=util[_0xd821('0x25')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x47dafa['remoteUri'],_0x664c9f['id']);if(_0x520032>0x6){_0x17b89f=util[_0xd821('0x25')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x47dafa[_0xd821('0x57')],_0x664c9f['id']);}logger['info'](_0xd821('0x5c'),_0xd821('0x68'));emit(util[_0xd821('0x25')](_0xd821('0x69'),_0x1ee065[_0xd821('0xf')]),'trigger:browser:url',{'uri':_0x17b89f});})[_0xd821('0x6a')](function(_0x48c9a7){logger[_0xd821('0x6b')](_0xd821('0x5c'),JSON[_0xd821('0x23')](_0x48c9a7));});};exports[_0xd821('0x6c')]=function(_0x2b8dc7,_0x59110f,_0x54e558,_0x74373,_0x299c01,_0x3d6691,_0x5ac535){var _0x5623ee,_0xf2e62d,_0x51df94,_0x2a86e5;_0x3d6691[_0xd821('0x57')]=intUtil[_0xd821('0x58')](_0x3d6691[_0xd821('0x57')]);_0x3d6691[_0xd821('0x59')]=intUtil['stripTrailingSlash'](_0x3d6691['serverUrl']);def[_0xd821('0x5a')]=util['format']('%s/service/v4_1/rest.php',_0x3d6691[_0xd821('0x57')]);if(_0x5ac535&&_0x5ac535[_0xd821('0x6d')]&&_0x5ac535[_0xd821('0x6d')]!==_0xd821('0x6e')){logger[_0xd821('0xe')](_0xd821('0x6f'),_0xd821('0x5d'));_0x59110f['recordingURL']=util[_0xd821('0x25')](_0xd821('0x70'),_0x3d6691[_0xd821('0x59')],_0x59110f[_0xd821('0x5e')],md5(_0x59110f[_0xd821('0x5e')]));}return getConnection(_0x3d6691)[_0xd821('0x2e')](function(_0x550bed){_0x2a86e5=_0x550bed;return getUser(_0x3d6691,_0x74373[_0xd821('0xf')],_0x2a86e5);})[_0xd821('0x2e')](function(_0x55be89){_0x5623ee=_0x55be89;logger[_0xd821('0xe')](_0xd821('0x60'),_0x5623ee['id']);return getEndUser(_0x3d6691,_0x59110f[_0xd821('0x71')],_0x59110f[_0xd821('0x72')],_0x2a86e5);})['then'](function(_0x107fbd){_0xf2e62d=_0x107fbd;logger[_0xd821('0xe')](_0xd821('0x73'),_0xf2e62d['id']);return getTicket(_0x3d6691,_0x5623ee,_0xf2e62d,_0x54e558,_0x59110f,_0x54e558[_0xd821('0x63')],_0x2a86e5,'Outbound');})[_0xd821('0x2e')](function(_0x521dff){_0x51df94=_0x521dff;logger['info'](_0xd821('0x74'));logger[_0xd821('0xe')](_0xd821('0x65'),_0x51df94['id']);return setRelationship(_0x2a86e5,_0x5623ee,_0x51df94,_0xd821('0x75'));})[_0xd821('0x2e')](function(){return setRelationship(_0x2a86e5,_0xf2e62d,_0x51df94,'contacts');})['then'](function(){return getServerInfo(_0x2a86e5);})[_0xd821('0x2e')](function(_0x3b2a45){var _0x2a0f97=parseInt(_0x3b2a45[_0xd821('0x66')]['charAt'](0x0));var _0x3c7a86=util[_0xd821('0x25')](_0xd821('0x76'),_0x3d6691[_0xd821('0x57')],_0x51df94['id']);if(_0x2a0f97>0x6){_0x3c7a86=util[_0xd821('0x25')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x3d6691[_0xd821('0x57')],_0x51df94['id']);}logger['info'](_0xd821('0x6f'),_0xd821('0x68'));emit(util[_0xd821('0x25')](_0xd821('0x69'),_0x74373[_0xd821('0xf')]),_0xd821('0x77'),{'uri':_0x3c7a86});})['catch'](function(_0x12dfcb){logger[_0xd821('0x6b')](_0xd821('0x6f'),JSON[_0xd821('0x23')](_0x12dfcb));});};exports['unmanaged']=function(_0x4123de,_0x1a8d55,_0x53c7ae,_0x41ca28,_0x584039,_0x41a50f){var _0x5c3647,_0x50fcd,_0x3560c0,_0x4a32a1;_0x41a50f['remoteUri']=intUtil[_0xd821('0x58')](_0x41a50f[_0xd821('0x57')]);_0x41a50f[_0xd821('0x59')]=intUtil['stripTrailingSlash'](_0x41a50f['serverUrl']);def['uri']=util[_0xd821('0x25')](_0xd821('0x5b'),_0x41a50f[_0xd821('0x57')]);if(_0x584039&&_0x584039[_0xd821('0x78')]){logger[_0xd821('0xe')]('['+_0x1a8d55[_0xd821('0x79')]['toUpperCase']()+']',_0xd821('0x5d'));_0x1a8d55[_0xd821('0x5f')]=util[_0xd821('0x25')](_0xd821('0x70'),_0x41a50f[_0xd821('0x59')],_0x1a8d55['uniqueid'],md5(_0x1a8d55[_0xd821('0x5e')]));}else{_0x1a8d55[_0xd821('0x5f')]='';}return getConnection(_0x41a50f)['then'](function(_0x1097ac){_0x4a32a1=_0x1097ac;if(!_[_0xd821('0x7a')](_0x41ca28)){return getUser(_0x41a50f,_0x41ca28[_0xd821('0xf')],_0x4a32a1);}else{return getUser(_0x41a50f,null,_0x4a32a1);}})[_0xd821('0x2e')](function(_0x4ca2f3){_0x5c3647=_0x4ca2f3;logger['info'](_0xd821('0x60'),_0x5c3647['id']);return getEndUser(_0x41a50f,_0x1a8d55['calleridname'],_0x1a8d55[_0xd821('0x62')],_0x4a32a1);})[_0xd821('0x2e')](function(_0x3802bf){_0x50fcd=_0x3802bf;logger[_0xd821('0xe')](_0xd821('0x73'),_0x50fcd['id']);return getTicket(_0x41a50f,_0x5c3647,_0x50fcd,_0x53c7ae,_0x1a8d55,_0x53c7ae[_0xd821('0x63')],_0x4a32a1,_0xd821('0x64'));})[_0xd821('0x2e')](function(_0x1841bb){_0x3560c0=_0x1841bb;logger[_0xd821('0xe')](_0xd821('0x74'));logger['info'](_0xd821('0x65'),_0x3560c0['id']);return setRelationship(_0x4a32a1,_0x5c3647,_0x3560c0,_0xd821('0x75'));})[_0xd821('0x2e')](function(){return setRelationship(_0x4a32a1,_0x50fcd,_0x3560c0,_0xd821('0x7b'));})['then'](function(){return getServerInfo(_0x4a32a1);})['catch'](function(_0x36752a){logger[_0xd821('0x6b')]('['+_0x1a8d55['lastevent']['toUpperCase']()+']',JSON[_0xd821('0x23')](_0x36752a));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/util.js b/server/services/ami/trigger/integration/util.js index 7312cb9..1840abd 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 _0x32b3=['toLowerCase','keyValue','keyType','key','format','%s:\x20%s','variable','join','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','isNil','test','lodash','util','getString','length','type','string','push','content','variableName','toString','customVariable','Variable','name'];(function(_0x4d2487,_0x5cffcb){var _0x2763d3=function(_0x8b6eb){while(--_0x8b6eb){_0x4d2487['push'](_0x4d2487['shift']());}};_0x2763d3(++_0x5cffcb);}(_0x32b3,0x1b3));var _0x332b=function(_0x9ff1c0,_0x207afc){_0x9ff1c0=_0x9ff1c0-0x0;var _0x3e6c23=_0x32b3[_0x9ff1c0];return _0x3e6c23;};'use strict';var _=require(_0x332b('0x0'));var util=require(_0x332b('0x1'));exports[_0x332b('0x2')]=function(_0x568b89,_0x478856,_0x18bc53){var _0x1d402c=[];if(_0x568b89[_0x332b('0x3')]>0x0){var _0x28f68b=_['sortBy'](_0x568b89,['id']);for(var _0x3ce8a5=0x0;_0x3ce8a5<_0x28f68b[_0x332b('0x3')];_0x3ce8a5++){var _0x7cf154=_0x28f68b[_0x3ce8a5];if(_0x7cf154[_0x332b('0x4')]===_0x332b('0x5')){_0x1d402c[_0x332b('0x6')](_0x7cf154[_0x332b('0x7')]);}else if(_0x7cf154['type']==='variable'&&_0x7cf154['variableName']){_0x478856[_0x7cf154[_0x332b('0x8')]]&&_0x1d402c[_0x332b('0x6')](_0x478856[_0x7cf154[_0x332b('0x8')]][_0x332b('0x9')]());}else if(_0x7cf154[_0x332b('0x4')]===_0x332b('0xa')&&_0x7cf154['Variable']&&_0x7cf154[_0x332b('0xb')][_0x332b('0xc')]){_0x478856[_0x7cf154[_0x332b('0xb')]['name']['toLowerCase']()]&&_0x1d402c[_0x332b('0x6')](_0x478856[_0x7cf154['Variable']['name'][_0x332b('0xd')]()][_0x332b('0x9')]());}else if(_0x7cf154[_0x332b('0x4')]===_0x332b('0xe')){if(_0x7cf154[_0x332b('0xf')]==='string'&&_0x7cf154[_0x332b('0x10')]){_0x1d402c[_0x332b('0x6')](util[_0x332b('0x11')](_0x332b('0x12'),_0x7cf154[_0x332b('0x10')],_0x7cf154['keyContent']));}else if(_0x7cf154['keyType']===_0x332b('0x13')&&_0x7cf154[_0x332b('0x8')]&&_0x7cf154[_0x332b('0x10')]){_0x478856[_0x7cf154[_0x332b('0x8')]]&&_0x1d402c[_0x332b('0x6')](util[_0x332b('0x11')](_0x332b('0x12'),_0x7cf154['key'],_0x478856[_0x7cf154[_0x332b('0x8')]]));}else if(_0x7cf154[_0x332b('0xf')]==='customVariable'&&_0x7cf154[_0x332b('0xb')]&&_0x7cf154[_0x332b('0xb')][_0x332b('0xc')]&&_0x7cf154[_0x332b('0x10')]){_0x478856[_0x7cf154[_0x332b('0xb')]['name']['toLowerCase']()]&&_0x1d402c[_0x332b('0x6')](util[_0x332b('0x11')](_0x332b('0x12'),_0x7cf154[_0x332b('0x10')],_0x478856[_0x7cf154[_0x332b('0xb')][_0x332b('0xc')]['toLowerCase']()]));}}}}return _0x1d402c[_0x332b('0x14')](_0x18bc53);};exports[_0x332b('0x15')]=function(_0x2a5e60){var _0x54bee9=_0x2a5e60[_0x332b('0x16')](-0x1);if(_0x54bee9==='/'){_0x2a5e60=_0x2a5e60[_0x332b('0x17')](0x0,_0x2a5e60[_0x332b('0x18')](_0x54bee9));}return _0x2a5e60;};exports[_0x332b('0x19')]=function(_0x4042d0){if(!_[_0x332b('0x1a')](_0x4042d0)&&_0x4042d0!==''){var _0x538aa5=/^(([^<>()\[\]\\.,;:\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 _0x538aa5[_0x332b('0x1b')](String(_0x4042d0)[_0x332b('0xd')]());}else{return![];}}; \ No newline at end of file +var _0x0d9d=['format','%s:\x20%s','keyContent','variable','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','isNil','test','lodash','util','length','type','string','push','content','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','key'];(function(_0x10a5bd,_0x194959){var _0x5daeaf=function(_0x11579c){while(--_0x11579c){_0x10a5bd['push'](_0x10a5bd['shift']());}};_0x5daeaf(++_0x194959);}(_0x0d9d,0x16a));var _0xd0d9=function(_0x4133ff,_0x3bc1f3){_0x4133ff=_0x4133ff-0x0;var _0x200c3e=_0x0d9d[_0x4133ff];return _0x200c3e;};'use strict';var _=require(_0xd0d9('0x0'));var util=require(_0xd0d9('0x1'));exports['getString']=function(_0x280499,_0x1e9c7f,_0x1fe76d){var _0x3544c8=[];if(_0x280499[_0xd0d9('0x2')]>0x0){var _0x28229e=_['sortBy'](_0x280499,['id']);for(var _0x541d5f=0x0;_0x541d5f<_0x28229e[_0xd0d9('0x2')];_0x541d5f++){var _0x3f45b5=_0x28229e[_0x541d5f];if(_0x3f45b5[_0xd0d9('0x3')]===_0xd0d9('0x4')){_0x3544c8[_0xd0d9('0x5')](_0x3f45b5[_0xd0d9('0x6')]);}else if(_0x3f45b5[_0xd0d9('0x3')]==='variable'&&_0x3f45b5[_0xd0d9('0x7')]){_0x1e9c7f[_0x3f45b5[_0xd0d9('0x7')]]&&_0x3544c8[_0xd0d9('0x5')](_0x1e9c7f[_0x3f45b5[_0xd0d9('0x7')]][_0xd0d9('0x8')]());}else if(_0x3f45b5[_0xd0d9('0x3')]===_0xd0d9('0x9')&&_0x3f45b5[_0xd0d9('0xa')]&&_0x3f45b5[_0xd0d9('0xa')][_0xd0d9('0xb')]){_0x1e9c7f[_0x3f45b5[_0xd0d9('0xa')][_0xd0d9('0xb')][_0xd0d9('0xc')]()]&&_0x3544c8['push'](_0x1e9c7f[_0x3f45b5[_0xd0d9('0xa')][_0xd0d9('0xb')][_0xd0d9('0xc')]()]['toString']());}else if(_0x3f45b5[_0xd0d9('0x3')]===_0xd0d9('0xd')){if(_0x3f45b5[_0xd0d9('0xe')]==='string'&&_0x3f45b5[_0xd0d9('0xf')]){_0x3544c8[_0xd0d9('0x5')](util[_0xd0d9('0x10')](_0xd0d9('0x11'),_0x3f45b5[_0xd0d9('0xf')],_0x3f45b5[_0xd0d9('0x12')]));}else if(_0x3f45b5[_0xd0d9('0xe')]===_0xd0d9('0x13')&&_0x3f45b5['variableName']&&_0x3f45b5[_0xd0d9('0xf')]){_0x1e9c7f[_0x3f45b5[_0xd0d9('0x7')]]&&_0x3544c8['push'](util[_0xd0d9('0x10')](_0xd0d9('0x11'),_0x3f45b5['key'],_0x1e9c7f[_0x3f45b5[_0xd0d9('0x7')]]));}else if(_0x3f45b5[_0xd0d9('0xe')]===_0xd0d9('0x9')&&_0x3f45b5[_0xd0d9('0xa')]&&_0x3f45b5[_0xd0d9('0xa')][_0xd0d9('0xb')]&&_0x3f45b5['key']){_0x1e9c7f[_0x3f45b5['Variable'][_0xd0d9('0xb')][_0xd0d9('0xc')]()]&&_0x3544c8['push'](util['format'](_0xd0d9('0x11'),_0x3f45b5[_0xd0d9('0xf')],_0x1e9c7f[_0x3f45b5['Variable']['name'][_0xd0d9('0xc')]()]));}}}}return _0x3544c8['join'](_0x1fe76d);};exports[_0xd0d9('0x14')]=function(_0x41968c){var _0xa060c=_0x41968c[_0xd0d9('0x15')](-0x1);if(_0xa060c==='/'){_0x41968c=_0x41968c[_0xd0d9('0x16')](0x0,_0x41968c[_0xd0d9('0x17')](_0xa060c));}return _0x41968c;};exports[_0xd0d9('0x18')]=function(_0x596af2){if(!_[_0xd0d9('0x19')](_0x596af2)&&_0x596af2!==''){var _0x26046e=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;return _0x26046e[_0xd0d9('0x1a')](String(_0x596af2)[_0xd0d9('0xc')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index 6c9cbf6..95ac893 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(_0x3de447,_0x147ccd){var _0x29870a=function(_0x5df20a){while(--_0x5df20a){_0x3de447['push'](_0x3de447['shift']());}};_0x29870a(++_0x147ccd);}(_0xe706,0xa3));var _0x6e70=function(_0x1a50a6,_0x400207){_0x1a50a6=_0x1a50a6-0x0;var _0x9cd101=_0xe706[_0x1a50a6];return _0x9cd101;};'use strict';var _=require(_0x6e70('0x0'));var rp=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var md5=require('md5');var util=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var intUtil=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var io=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));function emit(_0x45a2d4,_0x188ed3,_0x3c4843){io['to'](_0x45a2d4)[_0x6e70('0xd')](_0x188ed3,_0x3c4843);}function getCustomFields(_0x954545,_0x25e61c){var _0x100eb7={};if(_0x954545[_0x6e70('0xe')]>0x0){_[_0x6e70('0xf')](_0x954545,function(_0x3f474a){if(_[_0x6e70('0x10')]([_0x6e70('0x11'),'picklist'],_0x3f474a['type'])&&_0x3f474a[_0x6e70('0x12')]){_0x100eb7[_0x3f474a[_0x6e70('0x12')]]=_0x3f474a[_0x6e70('0x13')][_0x6e70('0x14')]();}else if(_0x3f474a[_0x6e70('0x15')]===_0x6e70('0x16')&&_0x3f474a[_0x6e70('0x17')]&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['variableName']]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['variableName']][_0x6e70('0x14')]();}else if(_0x3f474a['type']==='customVariable'&&_0x3f474a[_0x6e70('0x18')]&&_0x3f474a[_0x6e70('0x18')]['name']&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')][_0x6e70('0x1a')]()]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')]['toLowerCase']()][_0x6e70('0x14')]();}});}return _0x100eb7;}function createTicket(_0x173afe,_0x53acdc,_0x497d61,_0xc238ba,_0x208e21,_0x2368eb,_0x3a9978){logger[_0x6e70('0x1b')](_0x6e70('0x1c'));var _0x1b2453=_[_0x6e70('0x1d')]({'parent_id':'','assigned_user_id':_0x53acdc['id'],'ticketpriorities':_0x6e70('0x1e'),'ticketstatus':_0x6e70('0x1f'),'ticket_title':intUtil['getString'](_0xc238ba[_0x6e70('0x20')],_0x208e21,'\x20'),'description':intUtil[_0x6e70('0x21')](_0xc238ba[_0x6e70('0x22')],_0x208e21,'\x0a'),'contact_id':_0x497d61['id']},getCustomFields(_0x2368eb,_0x208e21));var _0x502b2d={'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x173afe['remoteUri']),'form':{'operation':_0x6e70('0x26'),'username':_0x173afe['username'],'sessionName':_0x3a9978['sessionName'],'elementType':'HelpDesk','element':JSON[_0x6e70('0x27')](_0x1b2453)},'json':!![]};return request(_0x502b2d)[_0x6e70('0x28')](function(_0x51d292){if(_0x51d292[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')]({'id':_0x51d292['result']['id']});}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x2b'),JSON[_0x6e70('0x27')](_0x51d292['error'])));}})['catch'](function(_0x2c4d37){var _0x3af17f=_0x2c4d37[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'createTicket',_0x3af17f,JSON[_0x6e70('0x27')](_0x2c4d37));});}function getUser(_0x406f29,_0xecf336,_0x2864a0){if(intUtil[_0x6e70('0x2f')](_0xecf336)){logger[_0x6e70('0x1b')](_0x6e70('0x30'),_0xecf336);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x406f29['remoteUri']),'qs':{'operation':_0x6e70('0x32'),'username':_0x406f29['username'],'sessionName':_0x2864a0[_0x6e70('0x33')],'query':util['format'](_0x6e70('0x34'),_0xecf336)},'json':!![]})[_0x6e70('0x28')](function(_0x30fa0b){if(_0x30fa0b['success']&&_0x30fa0b[_0x6e70('0x35')][_0x6e70('0xe')]){logger['info'](_0x6e70('0x36'));return BPromise[_0x6e70('0x2a')]({'id':_0x30fa0b['result'][0x0]['id'],'email':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x37')],'name':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x38')]+'\x20'+_0x30fa0b[_0x6e70('0x35')][_0x6e70('0x39')]});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29['username'],'name':_0x6e70('0x3c')});}})['catch'](function(_0x23cd1a){var _0x3222a2=_0x23cd1a[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x3222a2,JSON[_0x6e70('0x27')](_0x23cd1a));});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29[_0x6e70('0x3e')],'name':_0x6e70('0x3c')})['catch'](function(_0x5446a2){var _0x5424eb=_0x5446a2[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x5424eb,JSON[_0x6e70('0x27')](_0x5446a2));});}}function getEndUser(_0x3bdd87,_0x572a71,_0x3b508c,_0x9e7ad2){logger[_0x6e70('0x1b')](_0x6e70('0x3f'),_0x3b508c);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3bdd87[_0x6e70('0x40')]),'qs':{'operation':'query','username':_0x3bdd87[_0x6e70('0x3e')],'sessionName':_0x9e7ad2[_0x6e70('0x33')],'query':util[_0x6e70('0x24')](_0x6e70('0x41'),_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c)},'json':!![]})[_0x6e70('0x28')](function(_0x1de947){if(_0x1de947[_0x6e70('0x29')]&&_0x1de947['result']['length']){logger['info'](_0x6e70('0x42'));return BPromise[_0x6e70('0x2a')]({'id':_0x1de947[_0x6e70('0x35')][0x0]['id'],'name':_0x1de947[_0x6e70('0x35')][0x0][_0x6e70('0x43')]+'\x20'+_0x1de947['result'][0x0][_0x6e70('0x44')],'phone':_0x3b508c});}else{logger[_0x6e70('0x1b')](_0x6e70('0x45'));return request({'method':'POST','uri':util['format']('%s/webservice.php',_0x3bdd87[_0x6e70('0x40')]),'form':{'operation':'create','sessionName':_0x9e7ad2[_0x6e70('0x33')],'elementType':_0x6e70('0x46'),'element':JSON[_0x6e70('0x27')]({'lastname':_0x572a71,'phone':_0x3b508c,'assigned_user_id':'\x20'})},'json':!![]})[_0x6e70('0x28')](function(_0x59c87d){logger[_0x6e70('0x1b')]('Enduser\x20created.');return BPromise[_0x6e70('0x2a')]({'id':_0x59c87d[_0x6e70('0x35')]['id'],'name':_0x59c87d[_0x6e70('0x35')][_0x6e70('0x44')],'phone':_0x59c87d['result'][_0x6e70('0x47')]});})[_0x6e70('0x48')](function(_0x3d39c3){var _0xac87d6=_0x3d39c3[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'getEndUser',_0xac87d6,JSON[_0x6e70('0x27')](_0x3d39c3));});}});}function getConnection(_0x3884a4){var _0x10de2a=_0x3884a4[_0x6e70('0x3e')];var _0x3f86cf=_0x3884a4[_0x6e70('0x49')];return request({'method':_0x6e70('0x31'),'uri':util['format'](_0x6e70('0x25'),_0x3884a4['remoteUri']),'qs':{'operation':_0x6e70('0x4a'),'username':_0x10de2a},'json':!![]})[_0x6e70('0x28')](function(_0x4b351e){if(_0x4b351e['success']){return request({'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3884a4['remoteUri']),'form':{'operation':'login','username':_0x10de2a,'accessKey':md5(_0x4b351e[_0x6e70('0x35')][_0x6e70('0x4b')]+_0x3f86cf)},'json':!![]});}})[_0x6e70('0x28')](function(_0x79653){if(_0x79653[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')](_0x79653['result']);}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x4c'),_0x3884a4['id']));}})[_0x6e70('0x48')](function(_0x6ed023){var _0x2c3a7d=_0x6ed023['statusCode']||0x1f4;logger['error'](_0x6e70('0x2e'),_0x6e70('0x4d'),_0x2c3a7d,JSON[_0x6e70('0x27')](_0x6ed023));});}function request(_0x15f994){logger[_0x6e70('0x1b')]('[HTTP]',JSON[_0x6e70('0x27')](_0x15f994));return rp(_0x15f994);}exports[_0x6e70('0x4e')]=function(_0x1fa320,_0x23ebfb,_0x3aba34,_0x4a111a,_0x1142cd,_0x1dd242){var _0x2c20d3,_0x3fb0d3,_0x8ef4f7,_0x3fd03d;_0x1dd242['remoteUri']=intUtil[_0x6e70('0x4f')](_0x1dd242[_0x6e70('0x40')]);if(_0x1142cd&&_0x1142cd['monitor_format']){logger[_0x6e70('0x1b')](_0x6e70('0x50'),'Recording\x20is\x20enabled!');_0x23ebfb[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x1dd242[_0x6e70('0x53')],_0x23ebfb[_0x6e70('0x54')],md5(_0x23ebfb['uniqueid']));}else{_0x23ebfb[_0x6e70('0x51')]='';}return getConnection(_0x1dd242)[_0x6e70('0x28')](function(_0x10d655){_0x3fd03d=_0x10d655;return getUser(_0x1dd242,_0x4a111a[_0x6e70('0x55')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1fe13a){_0x2c20d3=_0x1fe13a;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x2c20d3['id']);return getEndUser(_0x1dd242,_0x23ebfb[_0x6e70('0x57')],_0x23ebfb[_0x6e70('0x58')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1b12a1){_0x3fb0d3=_0x1b12a1;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x3fb0d3['id']);return createTicket(_0x1dd242,_0x2c20d3,_0x3fb0d3,_0x3aba34,_0x23ebfb,_0x3aba34[_0x6e70('0x5a')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x324fa6){_0x8ef4f7=_0x324fa6;logger[_0x6e70('0x1b')](_0x6e70('0x5b'));logger[_0x6e70('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x8ef4f7['id']);var _0x28898a=util[_0x6e70('0x24')](_0x6e70('0x5c'),_0x1dd242[_0x6e70('0x40')],_[_0x6e70('0x5d')](_0x8ef4f7['id'],'x')[0x1]);logger[_0x6e70('0x1b')]('[QUEUE]',_0x6e70('0x5e'));emit(util[_0x6e70('0x24')]('user:%s',_0x4a111a[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x28898a});})[_0x6e70('0x48')](function(_0x590f7f){logger['error'](_0x6e70('0x50'),JSON[_0x6e70('0x27')](_0x590f7f));});};exports[_0x6e70('0x60')]=function(_0x41a861,_0x10d299,_0x739946,_0x30cd88,_0x57bfe5,_0x4d47e1,_0x2c8dc6){var _0x1e23c5,_0x2bf9ec,_0x2ad395,_0x5b1e6f;_0x4d47e1['remoteUri']=intUtil[_0x6e70('0x4f')](_0x4d47e1[_0x6e70('0x40')]);_0x4d47e1['serverUrl']=intUtil['stripTrailingSlash'](_0x4d47e1[_0x6e70('0x53')]);if(_0x2c8dc6&&_0x2c8dc6['recordingFormat']&&_0x2c8dc6[_0x6e70('0x61')]!==_0x6e70('0x62')){logger[_0x6e70('0x1b')](_0x6e70('0x63'),_0x6e70('0x64'));_0x10d299[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x4d47e1['serverUrl'],_0x10d299[_0x6e70('0x54')],md5(_0x10d299[_0x6e70('0x54')]));}return getConnection(_0x4d47e1)[_0x6e70('0x28')](function(_0x346c79){_0x5b1e6f=_0x346c79;return getUser(_0x4d47e1,_0x30cd88[_0x6e70('0x55')],_0x5b1e6f);})['then'](function(_0x5f5b02){_0x1e23c5=_0x5f5b02;logger['info'](_0x6e70('0x56'),_0x1e23c5['id']);return getEndUser(_0x4d47e1,_0x10d299[_0x6e70('0x65')],_0x10d299[_0x6e70('0x66')],_0x5b1e6f);})['then'](function(_0x58cf1c){_0x2bf9ec=_0x58cf1c;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x2bf9ec['id']);return createTicket(_0x4d47e1,_0x1e23c5,_0x2bf9ec,_0x739946,_0x10d299,_0x739946[_0x6e70('0x5a')],_0x5b1e6f);})[_0x6e70('0x28')](function(_0x2285f1){_0x2ad395=_0x2285f1;logger[_0x6e70('0x1b')]('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x2ad395['id']);var _0x30d11b=util[_0x6e70('0x24')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4d47e1[_0x6e70('0x40')],_['split'](_0x2ad395['id'],'x')[0x1]);logger['info'](_0x6e70('0x63'),_0x6e70('0x5e'));emit(util[_0x6e70('0x24')](_0x6e70('0x68'),_0x30cd88[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x30d11b});})['catch'](function(_0x370eeb){logger[_0x6e70('0x2d')](_0x6e70('0x63'),JSON[_0x6e70('0x27')](_0x370eeb));});};exports[_0x6e70('0x69')]=function(_0x13c092,_0x363722,_0xd9b4a9,_0x2f1362,_0x29621a,_0x575938){var _0x44c877,_0x303c5a,_0x577c3b,_0x5d398a;_0x575938['remoteUri']=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x40')]);_0x575938[_0x6e70('0x53')]=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x53')]);if(_0x29621a&&_0x29621a['monitor_format']){logger['info']('['+_0x363722[_0x6e70('0x6a')][_0x6e70('0x6b')]()+']','Recording\x20is\x20enabled!');_0x363722[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x575938[_0x6e70('0x53')],_0x363722[_0x6e70('0x54')],md5(_0x363722[_0x6e70('0x54')]));}else{_0x363722[_0x6e70('0x51')]='';}return getConnection(_0x575938)[_0x6e70('0x28')](function(_0x3650e9){_0x5d398a=_0x3650e9;return getUser(_0x575938,'',_0x5d398a);})[_0x6e70('0x28')](function(_0x347cc4){_0x44c877=_0x347cc4;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x44c877['id']);return getEndUser(_0x575938,_0x363722[_0x6e70('0x57')],_0x363722['calleridnum'],_0x5d398a);})['then'](function(_0x39ed95){_0x303c5a=_0x39ed95;logger['info'](_0x6e70('0x59'),_0x303c5a['id']);return createTicket(_0x575938,_0x44c877,_0x303c5a,_0xd9b4a9,_0x363722,_0xd9b4a9['Fields'],_0x5d398a);})['then'](function(_0x402f6f){_0x577c3b=_0x402f6f;logger['info']('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x577c3b['id']);})[_0x6e70('0x48')](function(_0x4e9fda){logger['error']('['+_0x363722['lastevent'][_0x6e70('0x6b')]()+']',JSON['stringify'](_0x4e9fda));});}; \ No newline at end of file +var _0xa9e0=['variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','Subjects','POST','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','resolve','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','getUser','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','split','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridname','lastevent','lodash','request-promise','bluebird','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','forEach','includes','idField','content','toString','type'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function emit(_0x5f41ea,_0x503809,_0xe42b77){io['to'](_0x5f41ea)['emit'](_0x503809,_0xe42b77);}function getCustomFields(_0x52cace,_0x39753a){var _0xf81284={};if(_0x52cace[_0x0a9e('0xb')]>0x0){_[_0x0a9e('0xc')](_0x52cace,function(_0xfeb75b){if(_[_0x0a9e('0xd')](['string','picklist'],_0xfeb75b['type'])&&_0xfeb75b['idField']){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0xfeb75b[_0x0a9e('0xf')][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x12')&&_0xfeb75b[_0x0a9e('0x13')]&&_0xfeb75b['idField']&&_0x39753a[_0xfeb75b[_0x0a9e('0x13')]]){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0x39753a[_0xfeb75b[_0x0a9e('0x13')]][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x14')&&_0xfeb75b['Variable']&&_0xfeb75b[_0x0a9e('0x15')]['name']&&_0xfeb75b[_0x0a9e('0xe')]&&_0x39753a[_0xfeb75b['Variable'][_0x0a9e('0x16')][_0x0a9e('0x17')]()]){_0xf81284[_0xfeb75b['idField']]=_0x39753a[_0xfeb75b[_0x0a9e('0x15')]['name'][_0x0a9e('0x17')]()][_0x0a9e('0x10')]();}});}return _0xf81284;}function createTicket(_0x106033,_0x205fd6,_0x31b1ca,_0x2eb11f,_0x530eb7,_0x20559e,_0x1314ae){logger[_0x0a9e('0x18')](_0x0a9e('0x19'));var _0x105080=_['merge']({'parent_id':'','assigned_user_id':_0x205fd6['id'],'ticketpriorities':_0x0a9e('0x1a'),'ticketstatus':_0x0a9e('0x1b'),'ticket_title':intUtil['getString'](_0x2eb11f[_0x0a9e('0x1c')],_0x530eb7,'\x20'),'description':intUtil['getString'](_0x2eb11f['Descriptions'],_0x530eb7,'\x0a'),'contact_id':_0x31b1ca['id']},getCustomFields(_0x20559e,_0x530eb7));var _0x3a02e1={'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033['remoteUri']),'form':{'operation':_0x0a9e('0x20'),'username':_0x106033[_0x0a9e('0x21')],'sessionName':_0x1314ae[_0x0a9e('0x22')],'elementType':_0x0a9e('0x23'),'element':JSON[_0x0a9e('0x24')](_0x105080)},'json':!![]};return request(_0x3a02e1)[_0x0a9e('0x25')](function(_0x16b1ca){if(_0x16b1ca['success']){return BPromise['resolve']({'id':_0x16b1ca[_0x0a9e('0x26')]['id']});}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x27'),JSON[_0x0a9e('0x24')](_0x16b1ca['error'])));}})[_0x0a9e('0x28')](function(_0x479bc4){var _0x45a1e7=_0x479bc4['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x2b'),_0x45a1e7,JSON[_0x0a9e('0x24')](_0x479bc4));});}function getUser(_0x140511,_0x1538a4,_0x11c3b6){if(intUtil[_0x0a9e('0x2c')](_0x1538a4)){logger['info'](_0x0a9e('0x2d'),_0x1538a4);return request({'method':_0x0a9e('0x2e'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x140511['remoteUri']),'qs':{'operation':_0x0a9e('0x2f'),'username':_0x140511[_0x0a9e('0x21')],'sessionName':_0x11c3b6[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x30'),_0x1538a4)},'json':!![]})[_0x0a9e('0x25')](function(_0x296f41){if(_0x296f41[_0x0a9e('0x31')]&&_0x296f41[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')]('Agent\x20found!');return BPromise[_0x0a9e('0x32')]({'id':_0x296f41[_0x0a9e('0x26')][0x0]['id'],'email':_0x296f41[_0x0a9e('0x26')][0x0][_0x0a9e('0x33')],'name':_0x296f41[_0x0a9e('0x26')][0x0]['first_name']+'\x20'+_0x296f41[_0x0a9e('0x26')][_0x0a9e('0x34')]});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511[_0x0a9e('0x21')],'name':_0x0a9e('0x37')});}})['catch'](function(_0x44295a){var _0x5e7238=_0x44295a[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x39'),_0x5e7238,JSON['stringify'](_0x44295a));});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511['username'],'name':'admin'})[_0x0a9e('0x28')](function(_0x5640eb){var _0x24936a=_0x5640eb[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getUser',_0x24936a,JSON[_0x0a9e('0x24')](_0x5640eb));});}}function getEndUser(_0x3bfce8,_0x3cae,_0x533942,_0x1dbf74){logger[_0x0a9e('0x18')](_0x0a9e('0x3a'),_0x533942);return request({'method':'GET','uri':util['format'](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'qs':{'operation':'query','username':_0x3bfce8[_0x0a9e('0x21')],'sessionName':_0x1dbf74[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x3c'),_0x533942,_0x533942,_0x533942,_0x533942,_0x533942)},'json':!![]})['then'](function(_0x5a594b){if(_0x5a594b[_0x0a9e('0x31')]&&_0x5a594b[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')](_0x0a9e('0x3d'));return BPromise[_0x0a9e('0x32')]({'id':_0x5a594b['result'][0x0]['id'],'name':_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3e')]+'\x20'+_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3f')],'phone':_0x533942});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x40'));return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x20'),'sessionName':_0x1dbf74[_0x0a9e('0x22')],'elementType':_0x0a9e('0x41'),'element':JSON[_0x0a9e('0x24')]({'lastname':_0x3cae,'phone':_0x533942,'assigned_user_id':'\x20'})},'json':!![]})[_0x0a9e('0x25')](function(_0x4d04c8){logger['info'](_0x0a9e('0x42'));return BPromise[_0x0a9e('0x32')]({'id':_0x4d04c8[_0x0a9e('0x26')]['id'],'name':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x3f')],'phone':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x43')]});})[_0x0a9e('0x28')](function(_0x432fcc){var _0x25c6e6=_0x432fcc[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x0a9e('0x44'),_0x25c6e6,JSON[_0x0a9e('0x24')](_0x432fcc));});}});}function getConnection(_0xdd268f){var _0xfbd5ad=_0xdd268f[_0x0a9e('0x21')];var _0xbe9d19=_0xdd268f[_0x0a9e('0x45')];return request({'method':_0x0a9e('0x2e'),'uri':util['format'](_0x0a9e('0x1f'),_0xdd268f['remoteUri']),'qs':{'operation':_0x0a9e('0x46'),'username':_0xfbd5ad},'json':!![]})[_0x0a9e('0x25')](function(_0x8d6dd1){if(_0x8d6dd1['success']){return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0xdd268f[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x47'),'username':_0xfbd5ad,'accessKey':md5(_0x8d6dd1[_0x0a9e('0x26')][_0x0a9e('0x48')]+_0xbe9d19)},'json':!![]});}})['then'](function(_0x13f44d){if(_0x13f44d[_0x0a9e('0x31')]){return BPromise[_0x0a9e('0x32')](_0x13f44d[_0x0a9e('0x26')]);}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x49'),_0xdd268f['id']));}})[_0x0a9e('0x28')](function(_0x19383e){var _0x34febd=_0x19383e['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getConnection',_0x34febd,JSON['stringify'](_0x19383e));});}function request(_0x5ddf84){logger[_0x0a9e('0x18')](_0x0a9e('0x4a'),JSON[_0x0a9e('0x24')](_0x5ddf84));return rp(_0x5ddf84);}exports[_0x0a9e('0x4b')]=function(_0x61bb17,_0x30decb,_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f){var _0x53975a,_0x39d77d,_0x204173,_0x14d602;_0x4b1b9f['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x4b1b9f[_0x0a9e('0x3b')]);if(_0x5d38ae&&_0x5d38ae['monitor_format']){logger['info'](_0x0a9e('0x4d'),'Recording\x20is\x20enabled!');_0x30decb[_0x0a9e('0x4e')]=util['format'](_0x0a9e('0x4f'),_0x4b1b9f[_0x0a9e('0x50')],_0x30decb[_0x0a9e('0x51')],md5(_0x30decb['uniqueid']));}else{_0x30decb[_0x0a9e('0x4e')]='';}return getConnection(_0x4b1b9f)[_0x0a9e('0x25')](function(_0x508b47){_0x14d602=_0x508b47;return getUser(_0x4b1b9f,_0x375c18['email'],_0x14d602);})[_0x0a9e('0x25')](function(_0x3aedd0){_0x53975a=_0x3aedd0;logger['info'](_0x0a9e('0x52'),_0x53975a['id']);return getEndUser(_0x4b1b9f,_0x30decb['calleridname'],_0x30decb[_0x0a9e('0x53')],_0x14d602);})['then'](function(_0xe22ccc){_0x39d77d=_0xe22ccc;logger['info']('The\x20Enduser\x20ID\x20is:',_0x39d77d['id']);return createTicket(_0x4b1b9f,_0x53975a,_0x39d77d,_0x2e5165,_0x30decb,_0x2e5165['Fields'],_0x14d602);})[_0x0a9e('0x25')](function(_0x47de4c){_0x204173=_0x47de4c;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x204173['id']);var _0x232830=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x4b1b9f[_0x0a9e('0x3b')],_['split'](_0x204173['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x4d'),_0x0a9e('0x57'));emit(util[_0x0a9e('0x1e')](_0x0a9e('0x58'),_0x375c18[_0x0a9e('0x16')]),'trigger:browser:url',{'uri':_0x232830});})[_0x0a9e('0x28')](function(_0x26bc80){logger['error'](_0x0a9e('0x4d'),JSON['stringify'](_0x26bc80));});};exports[_0x0a9e('0x59')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee,_0x273cb5,_0x49d231,_0x2244d6,_0x1fc70e){var _0x261adb,_0x7be420,_0x1cca9f,_0x26d7db;_0x2244d6['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x2244d6['remoteUri']);_0x2244d6[_0x0a9e('0x50')]=intUtil[_0x0a9e('0x4c')](_0x2244d6[_0x0a9e('0x50')]);if(_0x1fc70e&&_0x1fc70e['recordingFormat']&&_0x1fc70e[_0x0a9e('0x5a')]!==_0x0a9e('0x5b')){logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),'Recording\x20is\x20enabled!');_0x4b3c1a[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2244d6[_0x0a9e('0x50')],_0x4b3c1a[_0x0a9e('0x51')],md5(_0x4b3c1a[_0x0a9e('0x51')]));}return getConnection(_0x2244d6)[_0x0a9e('0x25')](function(_0x401837){_0x26d7db=_0x401837;return getUser(_0x2244d6,_0x273cb5['email'],_0x26d7db);})[_0x0a9e('0x25')](function(_0x2937e0){_0x261adb=_0x2937e0;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x261adb['id']);return getEndUser(_0x2244d6,_0x4b3c1a[_0x0a9e('0x5d')],_0x4b3c1a['destcalleridnum'],_0x26d7db);})['then'](function(_0x242745){_0x7be420=_0x242745;logger[_0x0a9e('0x18')](_0x0a9e('0x5e'),_0x7be420['id']);return createTicket(_0x2244d6,_0x261adb,_0x7be420,_0x5674ee,_0x4b3c1a,_0x5674ee[_0x0a9e('0x5f')],_0x26d7db);})[_0x0a9e('0x25')](function(_0xc8c264){_0x1cca9f=_0xc8c264;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1cca9f['id']);var _0x2e89b7=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x2244d6[_0x0a9e('0x3b')],_[_0x0a9e('0x60')](_0x1cca9f['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),_0x0a9e('0x57'));emit(util['format'](_0x0a9e('0x58'),_0x273cb5[_0x0a9e('0x16')]),_0x0a9e('0x61'),{'uri':_0x2e89b7});})['catch'](function(_0x1148a1){logger[_0x0a9e('0x29')]('[OUTBOUND]',JSON[_0x0a9e('0x24')](_0x1148a1));});};exports[_0x0a9e('0x62')]=function(_0x3ef315,_0x427946,_0x13b5c0,_0x4a43a8,_0x50cdce,_0x4a2438){var _0x40fb85,_0x18bf5d,_0x1104ad,_0x23a7d3;_0x4a2438[_0x0a9e('0x3b')]=intUtil[_0x0a9e('0x4c')](_0x4a2438[_0x0a9e('0x3b')]);_0x4a2438[_0x0a9e('0x50')]=intUtil['stripTrailingSlash'](_0x4a2438[_0x0a9e('0x50')]);if(_0x50cdce&&_0x50cdce[_0x0a9e('0x63')]){logger[_0x0a9e('0x18')]('['+_0x427946['lastevent'][_0x0a9e('0x64')]()+']','Recording\x20is\x20enabled!');_0x427946[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a2438[_0x0a9e('0x50')],_0x427946[_0x0a9e('0x51')],md5(_0x427946[_0x0a9e('0x51')]));}else{_0x427946[_0x0a9e('0x4e')]='';}return getConnection(_0x4a2438)['then'](function(_0x1d442c){_0x23a7d3=_0x1d442c;return getUser(_0x4a2438,'',_0x23a7d3);})[_0x0a9e('0x25')](function(_0x371533){_0x40fb85=_0x371533;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x40fb85['id']);return getEndUser(_0x4a2438,_0x427946[_0x0a9e('0x65')],_0x427946[_0x0a9e('0x53')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0x361b21){_0x18bf5d=_0x361b21;logger['info'](_0x0a9e('0x5e'),_0x18bf5d['id']);return createTicket(_0x4a2438,_0x40fb85,_0x18bf5d,_0x13b5c0,_0x427946,_0x13b5c0[_0x0a9e('0x5f')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0xf410e5){_0x1104ad=_0xf410e5;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1104ad['id']);})[_0x0a9e('0x28')](function(_0x336dc3){logger[_0x0a9e('0x29')]('['+_0x427946[_0x0a9e('0x66')][_0x0a9e('0x64')]()+']',JSON[_0x0a9e('0x24')](_0x336dc3));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 68d86b7..bfcbcd6 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 _0x9992=['/api/v2','error','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','trigger:browser:url','%s/agent/tickets/%s','Zendesk\x20account\x20type\x20not\x20recognized','catch','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','lastevent','toUpperCase','calleridname','\x20Error\x20running\x20Zendesk\x20integration','lodash','md5','ioredis','../../../../config/environment','zendesk','defaults','redis','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','Tags','name','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','count','Agent\x20found!','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','user','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','results','filter','end-user','length','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','POST','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','%s/token:%s','Basic\x20%s','toString','base64','debug','[HTTP]','GET','map','includes','string','picklist','type','nameField','toLowerCase','content','customField','custom_fields','push','idField','variableName','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','replace'];(function(_0xf4d243,_0x51c5cc){var _0x2d9b01=function(_0x1cda1a){while(--_0x1cda1a){_0xf4d243['push'](_0xf4d243['shift']());}};_0x2d9b01(++_0x51c5cc);}(_0x9992,0xee));var _0x2999=function(_0x5ef161,_0x27d16c){_0x5ef161=_0x5ef161-0x0;var _0x1c6e9e=_0x9992[_0x5ef161];return _0x1c6e9e;};'use strict';var _=require(_0x2999('0x0'));var rp=require('request-promise');var md5=require(_0x2999('0x1'));var util=require('util');var Redis=require(_0x2999('0x2'));var intUtil=require('./util');var config=require(_0x2999('0x3'));var logger=require('../../../../config/logger')(_0x2999('0x4'));config['redis']=_[_0x2999('0x5')](config[_0x2999('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x2999('0x7'))(new Redis(config[_0x2999('0x6')]));function emit(_0x3705a0,_0x4fd85b,_0x587f0c){io['to'](_0x3705a0)['emit'](_0x4fd85b,_0x587f0c);}var headers={'Content-Type':_0x2999('0x8'),'Accept':_0x2999('0x8')};function getTicket(_0x20c7eb,_0x3a5e98,_0x3abeca,_0x122eb4,_0x2b1dd2){logger[_0x2999('0x9')](_0x2999('0xa'));return request({'uri':util[_0x2999('0xb')](_0x2999('0xc'),_0x20c7eb[_0x2999('0xd')]),'method':'POST','body':{'ticket':_['merge']({'requester_id':_0x3abeca['id'],'submitter_id':_0x3a5e98?_0x3a5e98['id']:undefined,'assignee_id':_0x3a5e98?_0x3a5e98['id']:undefined,'tags':getTags(_0x122eb4[_0x2999('0xe')],_0x2999('0xf')),'subject':intUtil['getString'](_0x122eb4['Subjects'],_0x2b1dd2,'\x20'),'description':intUtil['getString'](_0x122eb4[_0x2999('0x10')],_0x2b1dd2,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x122eb4[_0x2999('0x10')],_0x2b1dd2,'\x0a')}},getCustomFields(_0x122eb4[_0x2999('0x11')],_0x2b1dd2))}})[_0x2999('0x12')](function(_0x2edb04){logger[_0x2999('0x9')](_0x2999('0x13'));return _0x2edb04[_0x2999('0x14')];});}function getUser(_0x4405e9,_0x195ed2){if(intUtil[_0x2999('0x15')](_0x195ed2)){logger[_0x2999('0x9')](_0x2999('0x16'),_0x195ed2);return request({'uri':util[_0x2999('0xb')](_0x2999('0x17'),_0x4405e9[_0x2999('0xd')]),'qs':{'query':util[_0x2999('0xb')]('type:user\x20role:agent\x20email:%s',_0x195ed2)}})[_0x2999('0x12')](function(_0x23617e){if(_0x23617e[_0x2999('0x18')]){logger[_0x2999('0x9')](_0x2999('0x19'));return _['find'](_0x23617e['results'],{'email':_0x195ed2,'role':_0x2999('0x1a')});}else{logger[_0x2999('0x9')](_0x2999('0x1b'));return request({'uri':util[_0x2999('0xb')](_0x2999('0x1c'),_0x4405e9[_0x2999('0xd')])})['then'](function(_0x19d63f){logger[_0x2999('0x9')]('Admin\x20account\x20selected.');return _0x19d63f[_0x2999('0x1d')];});}});}else{logger[_0x2999('0x9')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x2999('0xb')](_0x2999('0x1c'),_0x4405e9[_0x2999('0xd')])})[_0x2999('0x12')](function(_0xeceaf1){logger[_0x2999('0x9')](_0x2999('0x1e'));return _0xeceaf1['user'];});}}function getEndUser(_0x4ad566,_0x2d921b,_0x377fef){logger[_0x2999('0x9')](_0x2999('0x1f'),_0x377fef);return request({'uri':util[_0x2999('0xb')]('%s/search.json',_0x4ad566[_0x2999('0xd')]),'qs':{'query':util['format'](_0x2999('0x20'),_0x377fef)}})[_0x2999('0x12')](function(_0x31bc5c){var _0x4062fc;if(_0x31bc5c[_0x2999('0x21')]['length']){_0x31bc5c[_0x2999('0x21')]=_[_0x2999('0x22')](_0x31bc5c[_0x2999('0x21')],{'suspended':![],'role':_0x2999('0x23')});if(_0x31bc5c[_0x2999('0x21')][_0x2999('0x24')]){_0x4062fc=_[_0x2999('0x25')](_0x31bc5c['results']);}}if(_0x4062fc){logger[_0x2999('0x9')](_0x2999('0x26'));return _0x4062fc;}else{logger[_0x2999('0x9')](_0x2999('0x27'));return request({'uri':util['format'](_0x2999('0x28'),_0x4ad566[_0x2999('0xd')]),'method':_0x2999('0x29'),'body':{'user':{'role':'end-user','name':util[_0x2999('0xb')](_0x2999('0x2a'),_0x2d921b||_0x377fef),'phone':_0x377fef}}})['then'](function(_0x319c2d){logger[_0x2999('0x9')](_0x2999('0x2b'));return _0x319c2d[_0x2999('0x1d')];});}});}function getAuth(_0x47356d){var _0x502e90;if(_0x47356d[_0x2999('0x2c')]===_0x2999('0x2d')){_0x502e90=util[_0x2999('0xb')](_0x2999('0x2e'),_0x47356d[_0x2999('0x2f')],_0x47356d[_0x2999('0x2d')]);}else if(_0x47356d[_0x2999('0x2c')]==='token'){_0x502e90=util[_0x2999('0xb')](_0x2999('0x30'),_0x47356d[_0x2999('0x2f')],_0x47356d['token']);}return util[_0x2999('0xb')](_0x2999('0x31'),new Buffer(_0x502e90)[_0x2999('0x32')](_0x2999('0x33')));}function request(_0x55e0ca){logger[_0x2999('0x34')](_0x2999('0x35'),JSON['stringify'](_0x55e0ca));return rp(_[_0x2999('0x5')](_0x55e0ca,{'method':_0x2999('0x36'),'headers':headers,'json':!![]}));}function getTags(_0x429393,_0x50275d){var _0x149294=[];if(_0x429393&&_0x429393[_0x2999('0x24')]>0x0){_0x149294=_[_0x2999('0x37')](_0x429393,_0x50275d);}return _0x149294;}function getCustomFields(_0x2cb20e,_0x599110){var _0x233e58=[];var _0x282281={'custom_fields':[]};if(_0x2cb20e[_0x2999('0x24')]>0x0){_['forEach'](_0x2cb20e,function(_0x1b0546){if(_[_0x2999('0x38')]([_0x2999('0x39'),_0x2999('0x3a')],_0x1b0546[_0x2999('0x3b')])&&_0x1b0546['nameField']&&!_0x1b0546['customField']){_0x282281[_0x1b0546[_0x2999('0x3c')][_0x2999('0x3d')]()]=_0x1b0546[_0x2999('0x3e')]['toString']();}else if(_['includes']([_0x2999('0x39'),_0x2999('0x3a')],_0x1b0546[_0x2999('0x3b')])&&_0x1b0546['idField']&&_0x1b0546[_0x2999('0x3f')]){_0x282281[_0x2999('0x40')][_0x2999('0x41')]({'id':_0x1b0546[_0x2999('0x42')],'value':_0x1b0546[_0x2999('0x3e')]['toString']()});}else if(_0x1b0546[_0x2999('0x3b')]==='variable'&&_0x1b0546[_0x2999('0x43')]&&_0x1b0546[_0x2999('0x42')]&&_0x1b0546[_0x2999('0x3f')]){_0x599110[_0x1b0546['variableName']]&&_0x282281['custom_fields']['push']({'id':_0x1b0546['idField'],'value':_0x599110[_0x1b0546[_0x2999('0x43')]][_0x2999('0x32')]()});}else if(_0x1b0546[_0x2999('0x3b')]==='customVariable'&&_0x1b0546[_0x2999('0x44')]&&_0x1b0546[_0x2999('0x44')][_0x2999('0xf')]&&_0x1b0546[_0x2999('0x42')]&&_0x1b0546['customField']){_0x599110[_0x1b0546[_0x2999('0x44')]['name'][_0x2999('0x3d')]()]&&_0x282281['custom_fields'][_0x2999('0x41')]({'id':_0x1b0546['idField'],'value':_0x599110[_0x1b0546[_0x2999('0x44')][_0x2999('0xf')][_0x2999('0x3d')]()][_0x2999('0x32')]()});}});}return _0x282281;}exports[_0x2999('0x45')]=function(_0x4216cd,_0x310f7c,_0x5b8753,_0x1e712d,_0x548d7a,_0x47fcab){var _0x35fb74,_0x5c9134;_0x47fcab[_0x2999('0xd')]=intUtil[_0x2999('0x46')](_0x47fcab[_0x2999('0xd')]);_0x47fcab[_0x2999('0x47')]=intUtil['stripTrailingSlash'](_0x47fcab[_0x2999('0x47')]);if(_0x548d7a&&_0x548d7a[_0x2999('0x48')]){logger[_0x2999('0x9')](_0x2999('0x49'),_0x2999('0x4a'));_0x310f7c[_0x2999('0x4b')]=util[_0x2999('0xb')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x47fcab[_0x2999('0x47')],_0x310f7c[_0x2999('0x4c')],md5(_0x310f7c['uniqueid']));}else{_0x310f7c['recordingURL']='';}headers[_0x2999('0x4d')]=getAuth(_0x47fcab);return getUser(_0x47fcab,_0x1e712d[_0x2999('0x4e')])[_0x2999('0x12')](function(_0x553b1a){_0x35fb74=_0x553b1a;logger['info'](_0x2999('0x4f'),_0x35fb74['id']);return getEndUser(_0x47fcab,_0x310f7c['calleridname'],_0x310f7c[_0x2999('0x50')]);})['then'](function(_0x1da1a9){_0x5c9134=_0x1da1a9;logger['info'](_0x2999('0x51'),_0x5c9134['id']);return getTicket(_0x47fcab,_0x35fb74,_0x5c9134,_0x5b8753,_0x310f7c);})[_0x2999('0x12')](function(_0x30e2b4){if(_0x30e2b4){logger[_0x2999('0x9')](_0x2999('0x52'),_0x30e2b4['id']);switch(_0x47fcab[_0x2999('0x3b')]){case _0x2999('0x53'):logger[_0x2999('0x9')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x2999('0xb')](_0x2999('0x54'),_0x47fcab[_0x2999('0xd')],_0x35fb74['id'],_0x30e2b4['id']),'method':_0x2999('0x29')});case _0x2999('0x55'):logger[_0x2999('0x9')](_0x2999('0x49'),_0x2999('0x56'));emit(util[_0x2999('0xb')](_0x2999('0x57'),_0x1e712d[_0x2999('0xf')]),'trigger:browser:url',{'uri':util[_0x2999('0xb')]('%s/agent/tickets/%s',_0x47fcab[_0x2999('0xd')][_0x2999('0x58')](_0x2999('0x59'),''),_0x30e2b4['id'])});break;default:logger[_0x2999('0x5a')](_0x2999('0x49'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x3892a0){logger[_0x2999('0x5a')](_0x2999('0x5b'),util[_0x2999('0x5c')](_0x3892a0,{'showHidden':!![],'depth':null}));});};exports[_0x2999('0x5d')]=function(_0x472bc8,_0x53eb72,_0x572cb0,_0x527928,_0x5b258d,_0x37cd20,_0x272ef0){var _0x289ec9,_0x1668b8;_0x37cd20[_0x2999('0xd')]=intUtil[_0x2999('0x46')](_0x37cd20[_0x2999('0xd')]);_0x37cd20[_0x2999('0x47')]=intUtil[_0x2999('0x46')](_0x37cd20[_0x2999('0x47')]);if(_0x272ef0&&_0x272ef0[_0x2999('0x5e')]&&_0x272ef0[_0x2999('0x5e')]!==_0x2999('0x5f')){logger[_0x2999('0x9')](_0x2999('0x60'),_0x2999('0x4a'));_0x53eb72[_0x2999('0x4b')]=util[_0x2999('0xb')](_0x2999('0x61'),_0x37cd20[_0x2999('0x47')],_0x53eb72['uniqueid'],md5(_0x53eb72[_0x2999('0x4c')]));}headers[_0x2999('0x4d')]=getAuth(_0x37cd20);return getUser(_0x37cd20,_0x527928[_0x2999('0x4e')])[_0x2999('0x12')](function(_0x25b734){_0x289ec9=_0x25b734;logger['info'](_0x2999('0x4f'),_0x289ec9['id']);return getEndUser(_0x37cd20,_0x53eb72[_0x2999('0x62')],_0x53eb72[_0x2999('0x63')]);})['then'](function(_0x53f9a3){_0x1668b8=_0x53f9a3;logger[_0x2999('0x9')](_0x2999('0x51'),_0x1668b8['id']);return getTicket(_0x37cd20,_0x289ec9,_0x1668b8,_0x572cb0,_0x53eb72);})[_0x2999('0x12')](function(_0x440dd5){if(_0x440dd5){logger['info'](_0x2999('0x52'),_0x440dd5['id']);switch(_0x37cd20[_0x2999('0x3b')]){case _0x2999('0x53'):logger[_0x2999('0x9')](_0x2999('0x60'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format'](_0x2999('0x54'),_0x37cd20[_0x2999('0xd')],_0x289ec9['id'],_0x440dd5['id']),'method':_0x2999('0x29')});case _0x2999('0x55'):logger['info'](_0x2999('0x60'),_0x2999('0x56'));emit(util[_0x2999('0xb')](_0x2999('0x57'),_0x527928[_0x2999('0xf')]),_0x2999('0x64'),{'uri':util[_0x2999('0xb')](_0x2999('0x65'),_0x37cd20[_0x2999('0xd')][_0x2999('0x58')](_0x2999('0x59'),''),_0x440dd5['id'])});break;default:logger[_0x2999('0x5a')](_0x2999('0x60'),_0x2999('0x66'));}}})[_0x2999('0x67')](function(_0x1ba142){logger[_0x2999('0x5a')](_0x2999('0x68'),util[_0x2999('0x5c')](_0x1ba142,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x321b1e,_0x383f32,_0x3ecd2d,_0x1e7f49,_0x4f446c,_0x1b19b7){var _0x1a7b76,_0x24d602;_0x1b19b7[_0x2999('0xd')]=intUtil[_0x2999('0x46')](_0x1b19b7[_0x2999('0xd')]);_0x1b19b7[_0x2999('0x47')]=intUtil[_0x2999('0x46')](_0x1b19b7[_0x2999('0x47')]);if(_0x4f446c&&_0x4f446c['monitor_format']){logger[_0x2999('0x9')]('['+_0x383f32[_0x2999('0x69')][_0x2999('0x6a')]()+']',_0x2999('0x4a'));_0x383f32[_0x2999('0x4b')]=util['format'](_0x2999('0x61'),_0x1b19b7[_0x2999('0x47')],_0x383f32[_0x2999('0x4c')],md5(_0x383f32[_0x2999('0x4c')]));}else{_0x383f32['recordingURL']='';}headers[_0x2999('0x4d')]=getAuth(_0x1b19b7);return getUser(_0x1b19b7)[_0x2999('0x12')](function(_0x3816db){_0x1a7b76=_0x3816db;logger[_0x2999('0x9')]('The\x20User\x20ID\x20is:',_0x1a7b76['id']);return getEndUser(_0x1b19b7,_0x383f32[_0x2999('0x6b')],_0x383f32[_0x2999('0x50')]);})[_0x2999('0x12')](function(_0x4cc8f8){_0x24d602=_0x4cc8f8;logger[_0x2999('0x9')](_0x2999('0x51'),_0x24d602['id']);return getTicket(_0x1b19b7,_0x1a7b76,_0x24d602,_0x3ecd2d,_0x383f32);})[_0x2999('0x12')](function(_0x1a7da3){if(_0x1a7da3){logger['info'](_0x2999('0x52'),_0x1a7da3['id']);}})[_0x2999('0x67')](function(_0x24d5ed){logger[_0x2999('0x5a')]('['+_0x383f32[_0x2999('0x69')][_0x2999('0x6a')]()+']'+_0x2999('0x6c'),util['inspect'](_0x24d5ed,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xcaba=['/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','Authorization','destcalleridnum','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','Recording\x20is\x20enabled!','\x20Error\x20running\x20Zendesk\x20integration','request-promise','md5','util','ioredis','../../../../config/environment','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','remoteUri','POST','Tags','name','Subjects','getString','Descriptions','Fields','then','Ticket\x20created!','ticket','Getting\x20agent\x20with\x20email','format','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','%s/users/me.json','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','filter','end-user','length','Enduser\x20found!','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','%s/token:%s','Basic\x20%s','toString','base64','debug','stringify','GET','map','forEach','includes','string','nameField','customField','picklist','type','idField','push','content','variableName','customVariable','Variable','toLowerCase','custom_fields','queue','stripTrailingSlash','serverUrl','monitor_format','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','trigger:browser:url','%s/agent/tickets/%s','replace'];(function(_0x2613ae,_0x182ecd){var _0x36c1fe=function(_0x3693e2){while(--_0x3693e2){_0x2613ae['push'](_0x2613ae['shift']());}};_0x36c1fe(++_0x182ecd);}(_0xcaba,0x168));var _0xacab=function(_0x34b8c4,_0x5c5b3e){_0x34b8c4=_0x34b8c4-0x0;var _0x25159a=_0xcaba[_0x34b8c4];return _0x25159a;};'use strict';var _=require('lodash');var rp=require(_0xacab('0x0'));var md5=require(_0xacab('0x1'));var util=require(_0xacab('0x2'));var Redis=require(_0xacab('0x3'));var intUtil=require('./util');var config=require(_0xacab('0x4'));var logger=require('../../../../config/logger')(_0xacab('0x5'));config[_0xacab('0x6')]=_[_0xacab('0x7')](config[_0xacab('0x6')],{'host':_0xacab('0x8'),'port':0x18eb});var io=require(_0xacab('0x9'))(new Redis(config[_0xacab('0x6')]));function emit(_0x2e3971,_0x4e0582,_0x1932dd){io['to'](_0x2e3971)[_0xacab('0xa')](_0x4e0582,_0x1932dd);}var headers={'Content-Type':_0xacab('0xb'),'Accept':_0xacab('0xb')};function getTicket(_0x53f8a7,_0x146b79,_0x5b9120,_0x581272,_0x42306d){logger[_0xacab('0xc')](_0xacab('0xd'));return request({'uri':util['format']('%s/tickets.json',_0x53f8a7[_0xacab('0xe')]),'method':_0xacab('0xf'),'body':{'ticket':_['merge']({'requester_id':_0x5b9120['id'],'submitter_id':_0x146b79?_0x146b79['id']:undefined,'assignee_id':_0x146b79?_0x146b79['id']:undefined,'tags':getTags(_0x581272[_0xacab('0x10')],_0xacab('0x11')),'subject':intUtil['getString'](_0x581272[_0xacab('0x12')],_0x42306d,'\x20'),'description':intUtil[_0xacab('0x13')](_0x581272[_0xacab('0x14')],_0x42306d,'\x0a'),'comment':{'public':![],'body':intUtil[_0xacab('0x13')](_0x581272['Descriptions'],_0x42306d,'\x0a')}},getCustomFields(_0x581272[_0xacab('0x15')],_0x42306d))}})[_0xacab('0x16')](function(_0x16df4d){logger[_0xacab('0xc')](_0xacab('0x17'));return _0x16df4d[_0xacab('0x18')];});}function getUser(_0x2e490a,_0x55908e){if(intUtil['validateEmail'](_0x55908e)){logger['info'](_0xacab('0x19'),_0x55908e);return request({'uri':util[_0xacab('0x1a')](_0xacab('0x1b'),_0x2e490a[_0xacab('0xe')]),'qs':{'query':util[_0xacab('0x1a')](_0xacab('0x1c'),_0x55908e)}})['then'](function(_0x562aec){if(_0x562aec[_0xacab('0x1d')]){logger['info'](_0xacab('0x1e'));return _[_0xacab('0x1f')](_0x562aec[_0xacab('0x20')],{'email':_0x55908e,'role':_0xacab('0x21')});}else{logger['info'](_0xacab('0x22'));return request({'uri':util[_0xacab('0x1a')]('%s/users/me.json',_0x2e490a[_0xacab('0xe')])})[_0xacab('0x16')](function(_0x5c2818){logger['info'](_0xacab('0x23'));return _0x5c2818['user'];});}});}else{logger[_0xacab('0xc')](_0xacab('0x22'));return request({'uri':util['format'](_0xacab('0x24'),_0x2e490a[_0xacab('0xe')])})[_0xacab('0x16')](function(_0x5e5213){logger[_0xacab('0xc')](_0xacab('0x23'));return _0x5e5213[_0xacab('0x25')];});}}function getEndUser(_0x4c976f,_0x842dbb,_0x2f4250){logger[_0xacab('0xc')](_0xacab('0x26'),_0x2f4250);return request({'uri':util[_0xacab('0x1a')]('%s/search.json',_0x4c976f[_0xacab('0xe')]),'qs':{'query':util['format'](_0xacab('0x27'),_0x2f4250)}})['then'](function(_0x209b6d){var _0x4ffae0;if(_0x209b6d[_0xacab('0x20')]['length']){_0x209b6d['results']=_[_0xacab('0x28')](_0x209b6d['results'],{'suspended':![],'role':_0xacab('0x29')});if(_0x209b6d[_0xacab('0x20')][_0xacab('0x2a')]){_0x4ffae0=_['first'](_0x209b6d[_0xacab('0x20')]);}}if(_0x4ffae0){logger['info'](_0xacab('0x2b'));return _0x4ffae0;}else{logger[_0xacab('0xc')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xacab('0x1a')]('%s/users.json',_0x4c976f['remoteUri']),'method':_0xacab('0xf'),'body':{'user':{'role':_0xacab('0x29'),'name':util[_0xacab('0x1a')](_0xacab('0x2c'),_0x842dbb||_0x2f4250),'phone':_0x2f4250}}})[_0xacab('0x16')](function(_0x2eae69){logger[_0xacab('0xc')](_0xacab('0x2d'));return _0x2eae69[_0xacab('0x25')];});}});}function getAuth(_0x15a75c){var _0x5b5f87;if(_0x15a75c[_0xacab('0x2e')]===_0xacab('0x2f')){_0x5b5f87=util['format'](_0xacab('0x30'),_0x15a75c[_0xacab('0x31')],_0x15a75c['password']);}else if(_0x15a75c['authType']==='token'){_0x5b5f87=util['format'](_0xacab('0x32'),_0x15a75c[_0xacab('0x31')],_0x15a75c['token']);}return util[_0xacab('0x1a')](_0xacab('0x33'),new Buffer(_0x5b5f87)[_0xacab('0x34')](_0xacab('0x35')));}function request(_0x59bcf6){logger[_0xacab('0x36')]('[HTTP]',JSON[_0xacab('0x37')](_0x59bcf6));return rp(_['defaults'](_0x59bcf6,{'method':_0xacab('0x38'),'headers':headers,'json':!![]}));}function getTags(_0x57a90f,_0x2777e2){var _0x12dcf9=[];if(_0x57a90f&&_0x57a90f[_0xacab('0x2a')]>0x0){_0x12dcf9=_[_0xacab('0x39')](_0x57a90f,_0x2777e2);}return _0x12dcf9;}function getCustomFields(_0x49213f,_0x2b8a97){var _0x5f28f6=[];var _0x555365={'custom_fields':[]};if(_0x49213f[_0xacab('0x2a')]>0x0){_[_0xacab('0x3a')](_0x49213f,function(_0x2a7446){if(_[_0xacab('0x3b')]([_0xacab('0x3c'),'picklist'],_0x2a7446['type'])&&_0x2a7446[_0xacab('0x3d')]&&!_0x2a7446[_0xacab('0x3e')]){_0x555365[_0x2a7446[_0xacab('0x3d')]['toLowerCase']()]=_0x2a7446['content'][_0xacab('0x34')]();}else if(_[_0xacab('0x3b')]([_0xacab('0x3c'),_0xacab('0x3f')],_0x2a7446[_0xacab('0x40')])&&_0x2a7446[_0xacab('0x41')]&&_0x2a7446[_0xacab('0x3e')]){_0x555365['custom_fields'][_0xacab('0x42')]({'id':_0x2a7446[_0xacab('0x41')],'value':_0x2a7446[_0xacab('0x43')][_0xacab('0x34')]()});}else if(_0x2a7446[_0xacab('0x40')]==='variable'&&_0x2a7446['variableName']&&_0x2a7446[_0xacab('0x41')]&&_0x2a7446['customField']){_0x2b8a97[_0x2a7446['variableName']]&&_0x555365['custom_fields']['push']({'id':_0x2a7446[_0xacab('0x41')],'value':_0x2b8a97[_0x2a7446[_0xacab('0x44')]][_0xacab('0x34')]()});}else if(_0x2a7446[_0xacab('0x40')]===_0xacab('0x45')&&_0x2a7446[_0xacab('0x46')]&&_0x2a7446[_0xacab('0x46')][_0xacab('0x11')]&&_0x2a7446['idField']&&_0x2a7446[_0xacab('0x3e')]){_0x2b8a97[_0x2a7446[_0xacab('0x46')][_0xacab('0x11')][_0xacab('0x47')]()]&&_0x555365[_0xacab('0x48')]['push']({'id':_0x2a7446['idField'],'value':_0x2b8a97[_0x2a7446[_0xacab('0x46')][_0xacab('0x11')][_0xacab('0x47')]()][_0xacab('0x34')]()});}});}return _0x555365;}exports[_0xacab('0x49')]=function(_0xe2ddc7,_0x576175,_0x51b541,_0x2ad670,_0x191659,_0x4ca546){var _0x20cd47,_0x2eca18;_0x4ca546[_0xacab('0xe')]=intUtil[_0xacab('0x4a')](_0x4ca546[_0xacab('0xe')]);_0x4ca546[_0xacab('0x4b')]=intUtil[_0xacab('0x4a')](_0x4ca546[_0xacab('0x4b')]);if(_0x191659&&_0x191659[_0xacab('0x4c')]){logger[_0xacab('0xc')]('[QUEUE]','Recording\x20is\x20enabled!');_0x576175[_0xacab('0x4d')]=util[_0xacab('0x1a')](_0xacab('0x4e'),_0x4ca546[_0xacab('0x4b')],_0x576175[_0xacab('0x4f')],md5(_0x576175[_0xacab('0x4f')]));}else{_0x576175[_0xacab('0x4d')]='';}headers['Authorization']=getAuth(_0x4ca546);return getUser(_0x4ca546,_0x2ad670[_0xacab('0x50')])[_0xacab('0x16')](function(_0x2bc196){_0x20cd47=_0x2bc196;logger[_0xacab('0xc')](_0xacab('0x51'),_0x20cd47['id']);return getEndUser(_0x4ca546,_0x576175[_0xacab('0x52')],_0x576175[_0xacab('0x53')]);})[_0xacab('0x16')](function(_0x1c3ca4){_0x2eca18=_0x1c3ca4;logger[_0xacab('0xc')](_0xacab('0x54'),_0x2eca18['id']);return getTicket(_0x4ca546,_0x20cd47,_0x2eca18,_0x51b541,_0x576175);})[_0xacab('0x16')](function(_0x497af2){if(_0x497af2){logger[_0xacab('0xc')]('The\x20Ticket\x20ID\x20is:',_0x497af2['id']);switch(_0x4ca546[_0xacab('0x40')]){case _0xacab('0x55'):logger[_0xacab('0xc')](_0xacab('0x56'),_0xacab('0x57'));return request({'uri':util[_0xacab('0x1a')](_0xacab('0x58'),_0x4ca546[_0xacab('0xe')],_0x20cd47['id'],_0x497af2['id']),'method':_0xacab('0xf')});case'newTab':logger[_0xacab('0xc')](_0xacab('0x56'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xacab('0x1a')]('user:%s',_0x2ad670[_0xacab('0x11')]),_0xacab('0x59'),{'uri':util[_0xacab('0x1a')](_0xacab('0x5a'),_0x4ca546[_0xacab('0xe')][_0xacab('0x5b')](_0xacab('0x5c'),''),_0x497af2['id'])});break;default:logger[_0xacab('0x5d')](_0xacab('0x56'),_0xacab('0x5e'));}}})[_0xacab('0x5f')](function(_0x3c390a){logger[_0xacab('0x5d')](_0xacab('0x60'),util[_0xacab('0x61')](_0x3c390a,{'showHidden':!![],'depth':null}));});};exports[_0xacab('0x62')]=function(_0x47ff5b,_0x247bcc,_0x519e25,_0x37d909,_0x52306e,_0x3a01af,_0x2135a3){var _0x21eb0e,_0x158e3e;_0x3a01af[_0xacab('0xe')]=intUtil['stripTrailingSlash'](_0x3a01af[_0xacab('0xe')]);_0x3a01af['serverUrl']=intUtil['stripTrailingSlash'](_0x3a01af[_0xacab('0x4b')]);if(_0x2135a3&&_0x2135a3[_0xacab('0x63')]&&_0x2135a3[_0xacab('0x63')]!==_0xacab('0x64')){logger[_0xacab('0xc')](_0xacab('0x65'),'Recording\x20is\x20enabled!');_0x247bcc[_0xacab('0x4d')]=util[_0xacab('0x1a')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3a01af['serverUrl'],_0x247bcc['uniqueid'],md5(_0x247bcc['uniqueid']));}headers[_0xacab('0x66')]=getAuth(_0x3a01af);return getUser(_0x3a01af,_0x37d909[_0xacab('0x50')])[_0xacab('0x16')](function(_0x49fdfd){_0x21eb0e=_0x49fdfd;logger['info']('The\x20User\x20ID\x20is:',_0x21eb0e['id']);return getEndUser(_0x3a01af,_0x247bcc['destcalleridname'],_0x247bcc[_0xacab('0x67')]);})[_0xacab('0x16')](function(_0x776248){_0x158e3e=_0x776248;logger[_0xacab('0xc')](_0xacab('0x54'),_0x158e3e['id']);return getTicket(_0x3a01af,_0x21eb0e,_0x158e3e,_0x519e25,_0x247bcc);})[_0xacab('0x16')](function(_0x2788ce){if(_0x2788ce){logger[_0xacab('0xc')](_0xacab('0x68'),_0x2788ce['id']);switch(_0x3a01af[_0xacab('0x40')]){case _0xacab('0x55'):logger[_0xacab('0xc')](_0xacab('0x65'),_0xacab('0x57'));return request({'uri':util[_0xacab('0x1a')](_0xacab('0x58'),_0x3a01af[_0xacab('0xe')],_0x21eb0e['id'],_0x2788ce['id']),'method':'POST'});case'newTab':logger[_0xacab('0xc')](_0xacab('0x65'),_0xacab('0x69'));emit(util[_0xacab('0x1a')](_0xacab('0x6a'),_0x37d909['name']),_0xacab('0x59'),{'uri':util[_0xacab('0x1a')](_0xacab('0x5a'),_0x3a01af['remoteUri']['replace'](_0xacab('0x5c'),''),_0x2788ce['id'])});break;default:logger['error'](_0xacab('0x65'),_0xacab('0x5e'));}}})[_0xacab('0x5f')](function(_0x29e137){logger[_0xacab('0x5d')](_0xacab('0x6b'),util[_0xacab('0x61')](_0x29e137,{'showHidden':!![],'depth':null}));});};exports[_0xacab('0x6c')]=function(_0x1fb521,_0x59c49,_0x4eb884,_0x127985,_0x37b525,_0xe4208e){var _0x28e21b,_0x21c388;_0xe4208e['remoteUri']=intUtil[_0xacab('0x4a')](_0xe4208e[_0xacab('0xe')]);_0xe4208e[_0xacab('0x4b')]=intUtil[_0xacab('0x4a')](_0xe4208e[_0xacab('0x4b')]);if(_0x37b525&&_0x37b525['monitor_format']){logger[_0xacab('0xc')]('['+_0x59c49[_0xacab('0x6d')][_0xacab('0x6e')]()+']',_0xacab('0x6f'));_0x59c49['recordingURL']=util['format'](_0xacab('0x4e'),_0xe4208e[_0xacab('0x4b')],_0x59c49[_0xacab('0x4f')],md5(_0x59c49[_0xacab('0x4f')]));}else{_0x59c49['recordingURL']='';}headers[_0xacab('0x66')]=getAuth(_0xe4208e);return getUser(_0xe4208e)[_0xacab('0x16')](function(_0x222aa4){_0x28e21b=_0x222aa4;logger[_0xacab('0xc')]('The\x20User\x20ID\x20is:',_0x28e21b['id']);return getEndUser(_0xe4208e,_0x59c49['calleridname'],_0x59c49['calleridnum']);})[_0xacab('0x16')](function(_0x5cec05){_0x21c388=_0x5cec05;logger['info'](_0xacab('0x54'),_0x21c388['id']);return getTicket(_0xe4208e,_0x28e21b,_0x21c388,_0x4eb884,_0x59c49);})['then'](function(_0x1f9e5c){if(_0x1f9e5c){logger[_0xacab('0xc')](_0xacab('0x68'),_0x1f9e5c['id']);}})[_0xacab('0x5f')](function(_0x1c470e){logger[_0xacab('0x5d')]('['+_0x59c49[_0xacab('0x6d')][_0xacab('0x6e')]()+']'+_0xacab('0x70'),util[_0xacab('0x61')](_0x1c470e,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zoho.js b/server/services/ami/trigger/integration/zoho.js index 4bb5c2d..14290f9 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 _0x2e68=['administrator','Subject','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','Call_Duration','utc','mm:ss','answertime','endtime','diff','starttime','YYYY-MM-DDTHH:mm:ss','Call_Result','connect','timeout','Timeout','Call_Start_Time','outbound','Call_Type','Inbound','merge','/crm/v2/Calls','SUCCESS','Call\x20created!','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://crm.','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','/crm/EntityInfo.do?module=Calls&id=','unmanaged','lastevent','toUpperCase','calleridnum','lodash','request-promise','md5','util','./util','moment','ioredis','../../../../config/logger','zoho','defaults','redis','localhost','socket.io-emitter','emit','debug','[HTTP]','includes','picklist','idField','content','toString','type','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','isBefore','expires_in','access_token','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientSecret','refresh_token','then','add','seconds','catch','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','Zoho-oauthtoken\x20','users','findIndex','email','Using\x20the\x20admin\x20account!','user','Administrator','error','The\x20failing\x20result\x20is','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','enduserType','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','uri','https://www.zohoapis.','Leads','nothing','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Creating\x20new\x20call...','Owner','profile'];(function(_0x389a12,_0x41a036){var _0x1db8a9=function(_0x273f40){while(--_0x273f40){_0x389a12['push'](_0x389a12['shift']());}};_0x1db8a9(++_0x41a036);}(_0x2e68,0x16e));var _0x82e6=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x2e68[_0x13e741];return _0x3f8bb3;};'use strict';var _=require(_0x82e6('0x0'));var rp=require(_0x82e6('0x1'));var md5=require(_0x82e6('0x2'));var util=require(_0x82e6('0x3'));var intUtil=require(_0x82e6('0x4'));var moment=require(_0x82e6('0x5'));var Redis=require(_0x82e6('0x6'));var BPromise=require('bluebird');var config=require('../../../../config/environment');var logger=require(_0x82e6('0x7'))(_0x82e6('0x8'));config['redis']=_[_0x82e6('0x9')](config[_0x82e6('0xa')],{'host':_0x82e6('0xb'),'port':0x18eb});var io=require(_0x82e6('0xc'))(new Redis(config['redis']));function emit(_0x2125ed,_0x1d40a1,_0x57c77a){io['to'](_0x2125ed)[_0x82e6('0xd')](_0x1d40a1,_0x57c77a);}function request(_0x583781){logger[_0x82e6('0xe')](_0x82e6('0xf'),JSON['stringify'](_0x583781));return rp(_0x583781);}function getCustomFields(_0x1b3f3b,_0x4e5ba8){var _0x440f20={};if(_0x1b3f3b['length']>0x0){_['forEach'](_0x1b3f3b,function(_0x220283){if(_[_0x82e6('0x10')](['string',_0x82e6('0x11')],_0x220283['type'])&&_0x220283[_0x82e6('0x12')]){_0x440f20[_0x220283[_0x82e6('0x12')]]=_0x220283[_0x82e6('0x13')][_0x82e6('0x14')]();}else if(_0x220283[_0x82e6('0x15')]===_0x82e6('0x16')&&_0x220283['variableName']&&_0x220283[_0x82e6('0x12')]&&_0x4e5ba8[_0x220283[_0x82e6('0x17')]]){_0x440f20[_0x220283[_0x82e6('0x12')]]=_0x4e5ba8[_0x220283[_0x82e6('0x17')]][_0x82e6('0x14')]();}else if(_0x220283['type']===_0x82e6('0x18')&&_0x220283[_0x82e6('0x19')]&&_0x220283[_0x82e6('0x19')][_0x82e6('0x1a')]&&_0x220283[_0x82e6('0x12')]&&_0x4e5ba8[_0x220283[_0x82e6('0x19')]['name'][_0x82e6('0x1b')]()]){_0x440f20[_0x220283[_0x82e6('0x12')]]=_0x4e5ba8[_0x220283[_0x82e6('0x19')][_0x82e6('0x1a')][_0x82e6('0x1b')]()][_0x82e6('0x14')]();}});}return _0x440f20;}function getName(_0x23cfef){if(_0x23cfef[_0x82e6('0x1c')]('\x20')>0x0){var _0x4ea67b=_0x23cfef[_0x82e6('0x1d')](/ (.+)/);if(_0x4ea67b[0x1]){return _0x4ea67b;}}return[_0x23cfef,_0x23cfef];}var accountsTokens={};function getAccessToken(_0x348edb){return new Promise(function(_0x27f575,_0x60cefe){if(!_[_0x82e6('0x1e')](accountsTokens[_0x348edb['id']])&&!_[_0x82e6('0x1e')](accountsTokens[_0x348edb['id']]['access_token'])){if(moment()[_0x82e6('0x1f')](accountsTokens[_0x348edb['id']][_0x82e6('0x20')])){_0x27f575(accountsTokens[_0x348edb['id']][_0x82e6('0x21')]);}}var _0x292f6d;switch(_0x348edb['zone']){case'US':_0x292f6d=_0x82e6('0x22');break;case'AU':_0x292f6d=_0x82e6('0x23');break;case'EU':_0x292f6d=_0x82e6('0x24');break;case'IN':_0x292f6d='https://accounts.zoho.in';break;case'CN':_0x292f6d=_0x82e6('0x25');break;default:_0x292f6d=_0x82e6('0x24');break;}var _0x5ba693={'method':_0x82e6('0x26'),'uri':_0x292f6d+_0x82e6('0x27'),'qs':{'refresh_token':_0x348edb[_0x82e6('0x28')],'client_id':_0x348edb['clientId'],'client_secret':_0x348edb[_0x82e6('0x29')],'grant_type':_0x82e6('0x2a')},'json':!![]};return rp(_0x5ba693)[_0x82e6('0x2b')](function(_0x4148c4){accountsTokens[_0x348edb['id']]={'access_token':_0x4148c4['access_token'],'expires_in':moment()[_0x82e6('0x2c')](_0x4148c4['expires_in'],_0x82e6('0x2d'))};_0x27f575(_0x4148c4['access_token']);})[_0x82e6('0x2e')](function(_0x756ef7){logger['error'](_0x82e6('0x2f'),_0x756ef7[_0x82e6('0x30')]);_0x60cefe(_0x756ef7);});});}function getUser(_0x343bc9,_0x36c92c,_0x1c0201,_0x1f8dec){logger[_0x82e6('0x31')](_0x82e6('0x32'));return request({'method':_0x82e6('0x33'),'uri':util[_0x82e6('0x34')](_0x82e6('0x35'),_0x36c92c),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0x82e6('0x36')+_0x343bc9},'json':!![]})[_0x82e6('0x2b')](function(_0x4afff5){if(_0x4afff5[_0x82e6('0x37')]){var _0x5eb5ee=-0x1;if(_['isArrayLikeObject'](_0x4afff5[_0x82e6('0x37')])){if(!_[_0x82e6('0x1e')](_0x1f8dec)){_0x5eb5ee=_[_0x82e6('0x38')](_0x4afff5[_0x82e6('0x37')],function(_0x148e5b){return _0x148e5b[_0x82e6('0x39')]===_0x1f8dec;});}if(_0x5eb5ee>=0x0){logger[_0x82e6('0x31')]('Agent\x20found!');}else{logger['info'](_0x82e6('0x3a'));_0x5eb5ee=_[_0x82e6('0x38')](_0x4afff5['users'],function(_0x3b22ad){return _0x3b22ad['profile'][_0x82e6('0x1a')]==='Administrator';});}return _0x4afff5['users'][_0x5eb5ee];}else{if(_0x4afff5[_0x82e6('0x3b')]['profile'][_0x82e6('0x1a')]===_0x82e6('0x3c')){logger[_0x82e6('0x31')](_0x82e6('0x3a'));user=_0x4afff5[_0x82e6('0x3b')];return user;}else{logger[_0x82e6('0x3d')](_0x82e6('0x3e'),JSON[_0x82e6('0x3f')](_0x4afff5));throw new Error(_0x82e6('0x40')+JSON[_0x82e6('0x3f')](_0x4afff5));}}}else{logger['error'](_0x82e6('0x3e'),JSON['stringify'](_0x4afff5));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x82e6('0x3f')](_0x4afff5));}})[_0x82e6('0x2e')](function(_0x421f37){console[_0x82e6('0x3d')](_0x421f37);});}function getZohoUser(_0xea1e5b,_0x396411){return new BPromise(function(_0x222731,_0x32006f){request(_0xea1e5b)[_0x82e6('0x2b')](function(_0x5bd0d4){var _0x433d8c=null;if(_0x5bd0d4){_0x433d8c=_0x5bd0d4[_0x82e6('0x41')][0x0];_0x433d8c['enduserType']=_0x396411;}_0x222731(_0x433d8c);})[_0x82e6('0x2e')](function(_0x48e46d){_0x32006f(_0x48e46d);});});}function createEndUser(_0x287eaa,_0x41f8a0,_0x139d34,_0x316d41,_0x18d9ad,_0x44c4e9){var _0x139d34=getName(_0x139d34);return request({'method':_0x82e6('0x26'),'uri':'https://www.zohoapis.'+_0x41f8a0+_0x82e6('0x42')+_[_0x82e6('0x43')](_0x44c4e9[_0x82e6('0x44')])+'s','body':{'data':[{'Last_Name':_0x139d34[0x1],'First_Name':_0x139d34[0x0],'Phone':_0x316d41,'Owner':{'name':!_['isNil'](_0x18d9ad[_0x82e6('0x45')]['name'])?_0x18d9ad[_0x82e6('0x45')][_0x82e6('0x1a')]:!_['isNil'](_0x18d9ad['first_name'])?_0x18d9ad[_0x82e6('0x46')]+'\x20'+_0x18d9ad['last_name']:_0x18d9ad[_0x82e6('0x47')],'id':_0x18d9ad['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x287eaa},'json':!![]})['then'](function(_0xe80d75){if(_0xe80d75&&_0xe80d75[_0x82e6('0x41')][0x0][_0x82e6('0x48')]==='SUCCESS'){var _0x593a71=_0xe80d75[_0x82e6('0x41')][0x0]['details'];_0x593a71[_0x82e6('0x49')]=_[_0x82e6('0x43')](_0x44c4e9[_0x82e6('0x44')])+'s';return _0x593a71;}logger[_0x82e6('0x3d')](_0x82e6('0x3e'),JSON[_0x82e6('0x3f')](data));throw new Error(_0x82e6('0x4a')+JSON['stringify'](data));})['catch'](function(_0x2e915e){console[_0x82e6('0x4b')](_0x82e6('0x4c'),_0x2e915e);});}function getEndUser(_0x521386,_0x261c50,_0x221190,_0x54ff54,_0x1f0786,_0x5a8928,_0x5eea88){var _0x27fc2e={'method':_0x82e6('0x33'),'uri':'','headers':{'Authorization':_0x82e6('0x36')+_0x521386},'json':!![]};switch(_0x5eea88[_0x82e6('0x4d')]){case _0x82e6('0x4e'):_0x27fc2e['uri']='https://www.zohoapis.'+_0x261c50+_0x82e6('0x4f')+_0x1f0786+'))';return getZohoUser(_0x27fc2e,_0x82e6('0x50'))['then'](function(_0x457abb){if(_0x457abb)return _0x457abb;_0x27fc2e[_0x82e6('0x51')]=_0x82e6('0x52')+_0x261c50+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x1f0786+'))';return getZohoUser(_0x27fc2e,_0x82e6('0x53'))['then'](function(_0x9b0e79){if(_0x9b0e79)return _0x9b0e79;if(_0x5eea88[_0x82e6('0x44')]!=_0x82e6('0x54')){return createEndUser(_0x521386,_0x261c50,_0x54ff54,_0x1f0786,_0x5a8928,_0x5eea88);}else{return{};}});});break;case'contact':_0x27fc2e[_0x82e6('0x51')]=_0x82e6('0x52')+_0x261c50+_0x82e6('0x4f')+_0x1f0786+'))';return getZohoUser(_0x27fc2e,'Contacts')[_0x82e6('0x2b')](function(_0x138f0c){if(_0x138f0c)return _0x138f0c;if(_0x5eea88[_0x82e6('0x44')]!=_0x82e6('0x54')){return createEndUser(_0x521386,_0x261c50,_0x54ff54,_0x1f0786,_0x5a8928,_0x5eea88);}else{return{};}});break;case _0x82e6('0x55'):_0x27fc2e[_0x82e6('0x51')]=_0x82e6('0x52')+_0x261c50+_0x82e6('0x56')+_0x1f0786+'))';return getZohoUser(_0x27fc2e,_0x82e6('0x53'))[_0x82e6('0x2b')](function(_0x27315b){if(_0x27315b)return _0x27315b;if(_0x5eea88[_0x82e6('0x44')]!=_0x82e6('0x54')){return createEndUser(_0x521386,_0x261c50,_0x54ff54,_0x1f0786,_0x5a8928,_0x5eea88);}else{return{};}});break;}}function getCall(_0x2f5239,_0x16bbe0,_0x46ac6a,_0x5d0c6e,_0x57e52b,_0x318e31,_0x416b78,_0x10bc32){logger[_0x82e6('0x31')](_0x82e6('0x57'));var _0x412ee8={};_0x412ee8[_0x82e6('0x58')]={'name':!_[_0x82e6('0x1e')](_0x5d0c6e[_0x82e6('0x45')][_0x82e6('0x1a')])&&!_[_0x82e6('0x1e')](_0x5d0c6e[_0x82e6('0x59')]['name'])&&_0x5d0c6e[_0x82e6('0x59')]['name']===_0x82e6('0x5a')?_0x5d0c6e[_0x82e6('0x45')][_0x82e6('0x1a')]:!_[_0x82e6('0x1e')](_0x5d0c6e[_0x82e6('0x46')])?_0x5d0c6e['first_name']+'\x20'+_0x5d0c6e[_0x82e6('0x47')]:_0x5d0c6e[_0x82e6('0x47')],'id':_0x5d0c6e['id']};_0x412ee8[_0x82e6('0x5b')]=intUtil[_0x82e6('0x5c')](_0x318e31[_0x82e6('0x5d')],_0x416b78,'\x20');_0x412ee8[_0x82e6('0x5e')]=intUtil[_0x82e6('0x5c')](_0x318e31[_0x82e6('0x5f')],_0x416b78,'\x0a');if(_0x57e52b[_0x82e6('0x49')]===_0x82e6('0x50')){_0x412ee8[_0x82e6('0x60')]={'name':!_[_0x82e6('0x1e')](_0x57e52b['Full_Name'])?_0x57e52b[_0x82e6('0x61')]:!_[_0x82e6('0x1e')](_0x57e52b[_0x82e6('0x62')])?_0x57e52b[_0x82e6('0x62')]+'\x20'+_0x57e52b['Last_Name']:_0x57e52b[_0x82e6('0x63')],'id':_0x57e52b['id']};}if(_0x57e52b[_0x82e6('0x49')]===_0x82e6('0x53')){_0x412ee8[_0x82e6('0x64')]={'name':!_[_0x82e6('0x1e')](_0x57e52b[_0x82e6('0x61')])?_0x57e52b[_0x82e6('0x61')]:!_[_0x82e6('0x1e')](_0x57e52b['First_Name'])?_0x57e52b[_0x82e6('0x62')]+'\x20'+_0x57e52b[_0x82e6('0x63')]:_0x57e52b[_0x82e6('0x63')],'id':_0x57e52b['id']};_0x412ee8['$se_module']=_[_0x82e6('0x43')](_0x57e52b[_0x82e6('0x49')]);}if(_0x416b78['talktime']){_0x412ee8[_0x82e6('0x65')]=moment[_0x82e6('0x66')](parseInt(_0x416b78['talktime'])*0x3e8)['format'](_0x82e6('0x67'));}else if(_0x416b78[_0x82e6('0x68')]&&_0x416b78['endtime']){_0x412ee8[_0x82e6('0x65')]=moment['utc'](moment(_0x416b78[_0x82e6('0x69')],'YYYY-MM-DDTHH:mm:ss')[_0x82e6('0x6a')](moment(_0x416b78[_0x82e6('0x6b')],_0x82e6('0x6c'))))['format']('mm:ss');}switch(_0x416b78['lastevent']){case'called':_0x412ee8[_0x82e6('0x6d')]='Called';break;case'complete':case _0x82e6('0x6e'):_0x412ee8[_0x82e6('0x6d')]='Answered';break;case'rejected':_0x412ee8[_0x82e6('0x6d')]='Rejected';break;case'abandoned':_0x412ee8[_0x82e6('0x6d')]='Abandoned';break;case _0x82e6('0x6f'):_0x412ee8[_0x82e6('0x6d')]=_0x82e6('0x70');default:}_0x412ee8[_0x82e6('0x71')]=(_0x10bc32===_0x82e6('0x72')?moment(_0x416b78[_0x82e6('0x6b')])[_0x82e6('0x34')](_0x82e6('0x6c')):moment(_0x416b78['agentcalledAt'])[_0x82e6('0x34')]('YYYY-MM-DDTHH:mm:ss'))||moment()[_0x82e6('0x34')](_0x82e6('0x6c'));_0x412ee8[_0x82e6('0x73')]=_0x10bc32||_0x82e6('0x74');_0x412ee8=_[_0x82e6('0x75')](_0x412ee8,getCustomFields(_0x318e31['Fields'],_0x416b78));return request({'method':'POST','uri':_0x82e6('0x52')+_0x16bbe0+_0x82e6('0x76'),'headers':{'Authorization':_0x82e6('0x36')+_0x2f5239},'body':{'data':[_0x412ee8]},'json':!![]})[_0x82e6('0x2b')](function(_0x4b1d1f){if(_0x4b1d1f&&_0x4b1d1f['data'][0x0][_0x82e6('0x48')]===_0x82e6('0x77')){logger[_0x82e6('0x31')](_0x82e6('0x78'));return{'id':_0x4b1d1f[_0x82e6('0x41')][0x0]['details']['id']};}})[_0x82e6('0x2e')](function(_0x39f7e4){logger['info'](_0x82e6('0x79'),_0x39f7e4[_0x82e6('0x30')]);console[_0x82e6('0x4b')]('err',_0x39f7e4);});}exports[_0x82e6('0x7a')]=function(_0x2d7ada,_0x42d020,_0x4459db,_0x205667,_0x4576b5,_0x31b23d){var _0x4bbff8,_0x2f22a5,_0x196ae4;_0x31b23d[_0x82e6('0x7b')]=intUtil[_0x82e6('0x7c')](_0x31b23d['host']);_0x31b23d[_0x82e6('0x7d')]=intUtil[_0x82e6('0x7c')](_0x31b23d[_0x82e6('0x7d')]);if(_0x4576b5&&_0x4576b5[_0x82e6('0x7e')]){logger[_0x82e6('0x31')](_0x82e6('0x7f'),_0x82e6('0x80'));_0x42d020[_0x82e6('0x81')]=_0x31b23d[_0x82e6('0x7d')]+_0x82e6('0x82')+_0x42d020[_0x82e6('0x83')]+_0x82e6('0x84')+md5(_0x42d020['uniqueid']);}else{_0x42d020[_0x82e6('0x81')]='';}var _0x28c298=_0x31b23d[_0x82e6('0x7b')]===_0x82e6('0x85')?'eu':_0x82e6('0x86');return getAccessToken(_0x31b23d)[_0x82e6('0x2b')](function(_0x5c58d5){_0x196ae4=_0x5c58d5;return getUser(_0x196ae4,_0x28c298,_0x31b23d,_0x205667[_0x82e6('0x39')]);})[_0x82e6('0x2b')](function(_0x16c217){_0x4bbff8=_0x16c217;logger[_0x82e6('0x31')](_0x82e6('0x87'),_0x4bbff8['id']);return getEndUser(_0x196ae4,_0x28c298,_0x31b23d,_0x42d020[_0x82e6('0x88')],_0x42d020['calleridnum'],_0x4bbff8,_0x4459db);})[_0x82e6('0x2b')](function(_0x488734){_0x2f22a5=_0x488734;return getCall(_0x196ae4,_0x28c298,_0x31b23d,_0x4bbff8,_0x2f22a5,_0x4459db,_0x42d020,_0x82e6('0x74'));})[_0x82e6('0x2b')](function(_0x3e8c07){if(_0x3e8c07){logger['info'](_0x82e6('0x89'),_0x3e8c07['id']);logger[_0x82e6('0x31')](_0x82e6('0x7f'),_0x82e6('0x8a'));emit(util['format']('user:%s',_0x205667[_0x82e6('0x1a')]),_0x82e6('0x8b'),{'uri':_0x82e6('0x8c')+_0x31b23d[_0x82e6('0x7b')]+'/crm/EntityInfo.do?module=Calls&id='+_0x3e8c07['id']});}})[_0x82e6('0x2e')](function(_0x5e42c2){logger[_0x82e6('0x3d')](_0x82e6('0x7f'),JSON[_0x82e6('0x3f')](_0x5e42c2));});};exports[_0x82e6('0x72')]=function(_0x22209d,_0x592f9b,_0x5aaf9d,_0x402f36,_0x1c591d,_0x4805d3,_0x15174f){var _0x28ed18,_0x5941fe,_0x1b2365;_0x4805d3[_0x82e6('0x7b')]=intUtil[_0x82e6('0x7c')](_0x4805d3['host']);_0x4805d3[_0x82e6('0x7d')]=intUtil[_0x82e6('0x7c')](_0x4805d3[_0x82e6('0x7d')]);if(_0x15174f&&_0x15174f[_0x82e6('0x8d')]&&_0x15174f[_0x82e6('0x8d')]!==_0x82e6('0x8e')){logger[_0x82e6('0x31')](_0x82e6('0x8f'),_0x82e6('0x80'));_0x592f9b[_0x82e6('0x81')]=_0x4805d3[_0x82e6('0x7d')]+'/api/voice/recordings/'+_0x592f9b[_0x82e6('0x83')]+'/downloads?type=uniqueid&token='+md5(_0x592f9b['uniqueid']);}var _0x45bcc7=_0x4805d3[_0x82e6('0x7b')]===_0x82e6('0x85')?'eu':_0x82e6('0x86');return getAccessToken(_0x4805d3)[_0x82e6('0x2b')](function(_0x2c2964){_0x1b2365=_0x2c2964;return getUser(_0x1b2365,_0x45bcc7,_0x4805d3,_0x402f36['email']);})['then'](function(_0x5f34b7){_0x28ed18=_0x5f34b7;logger['info'](_0x82e6('0x87'),_0x28ed18['id']);return getEndUser(_0x1b2365,_0x45bcc7,_0x4805d3,_0x592f9b[_0x82e6('0x90')],_0x592f9b[_0x82e6('0x91')],_0x28ed18,_0x5aaf9d);})[_0x82e6('0x2b')](function(_0x384b0c){_0x5941fe=_0x384b0c;return getCall(_0x1b2365,_0x45bcc7,_0x4805d3,_0x28ed18,_0x5941fe,_0x5aaf9d,_0x592f9b,_0x82e6('0x92'));})[_0x82e6('0x2b')](function(_0x174a06){if(_0x174a06){logger[_0x82e6('0x31')](_0x82e6('0x89'),_0x174a06['id']);logger[_0x82e6('0x31')](_0x82e6('0x8f'),_0x82e6('0x8a'));emit(util[_0x82e6('0x34')]('user:%s',_0x402f36[_0x82e6('0x1a')]),_0x82e6('0x8b'),{'uri':'https://crm.'+_0x4805d3['host']+_0x82e6('0x93')+_0x174a06['id']});}})[_0x82e6('0x2e')](function(_0x235a08){logger[_0x82e6('0x3d')]('[OUTBOUND]',JSON['stringify'](_0x235a08));});};exports[_0x82e6('0x94')]=function(_0x4e0611,_0x19edfb,_0x16c4f4,_0x53299c,_0x36802c,_0x4531d3){var _0x3096fd,_0x1129d3,_0x21d8d2;_0x4531d3[_0x82e6('0x7b')]=intUtil[_0x82e6('0x7c')](_0x4531d3[_0x82e6('0x7b')]);_0x4531d3['serverUrl']=intUtil[_0x82e6('0x7c')](_0x4531d3[_0x82e6('0x7d')]);if(_0x36802c&&_0x36802c[_0x82e6('0x7e')]){logger[_0x82e6('0x31')]('['+_0x19edfb[_0x82e6('0x95')][_0x82e6('0x96')]()+']',_0x82e6('0x80'));_0x19edfb[_0x82e6('0x81')]=_0x4531d3['serverUrl']+'/api/voice/recordings/'+_0x19edfb[_0x82e6('0x83')]+_0x82e6('0x84')+md5(_0x19edfb[_0x82e6('0x83')]);}else{_0x19edfb['recordingURL']='';}var _0x10be78=_0x4531d3[_0x82e6('0x7b')]===_0x82e6('0x85')?'eu':_0x82e6('0x86');return getAccessToken(_0x4531d3)[_0x82e6('0x2b')](function(_0x3a4c4f){_0x21d8d2=_0x3a4c4f;return getUser(_0x21d8d2,_0x10be78,_0x4531d3);})[_0x82e6('0x2b')](function(_0x411c28){_0x3096fd=_0x411c28;logger[_0x82e6('0x31')](_0x82e6('0x87'),_0x3096fd['id']);return getEndUser(_0x21d8d2,_0x10be78,_0x4531d3,_0x19edfb[_0x82e6('0x88')],_0x19edfb[_0x82e6('0x97')],_0x3096fd,_0x16c4f4);})['then'](function(_0x4662a1){_0x1129d3=_0x4662a1;return getCall(_0x21d8d2,_0x10be78,_0x4531d3,_0x3096fd,_0x1129d3,_0x16c4f4,_0x19edfb,_0x82e6('0x74'));})['then'](function(_0x409935){if(_0x409935){logger[_0x82e6('0x31')](_0x82e6('0x89'),_0x409935['id']);}})[_0x82e6('0x2e')](function(_0x4b5073){logger[_0x82e6('0x3d')]('['+_0x19edfb[_0x82e6('0x95')]['toUpperCase']()+']',JSON['stringify'](_0x4b5073));});}; \ No newline at end of file +var _0x5d66=['seconds','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','format','ActiveUsers','then','users','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','user','profile','Administrator','stringify','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','catch','data','https://www.zohoapis.','/crm/v2/','moduleCreate','role','first_name','last_name','Zoho-oauthtoken\x20','code','SUCCESS','details','enduserType','startCase','Error:\x20','CREATE\x20ERROR','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','Contacts','lead','Owner','administrator','Subject','getString','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','$se_module','talktime','Call_Duration','mm:ss','answertime','utc','endtime','diff','lastevent','called','Called','complete','connect','Call_Result','Answered','rejected','Rejected','abandoned','Abandoned','Timeout','outbound','YYYY-MM-DDTHH:mm:ss','Inbound','merge','Fields','Call\x20created!','log','err','queue','host','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','calleridname','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','[OUTBOUND]','unmanaged','toUpperCase','lodash','md5','util','./util','moment','ioredis','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','debug','forEach','includes','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','add'];(function(_0xaf2f5,_0x4c46cf){var _0x1bbbfa=function(_0x13fd07){while(--_0x13fd07){_0xaf2f5['push'](_0xaf2f5['shift']());}};_0x1bbbfa(++_0x4c46cf);}(_0x5d66,0x109));var _0x65d6=function(_0x2e946e,_0x3e8f28){_0x2e946e=_0x2e946e-0x0;var _0x4947da=_0x5d66[_0x2e946e];return _0x4947da;};'use strict';var _=require(_0x65d6('0x0'));var rp=require('request-promise');var md5=require(_0x65d6('0x1'));var util=require(_0x65d6('0x2'));var intUtil=require(_0x65d6('0x3'));var moment=require(_0x65d6('0x4'));var Redis=require(_0x65d6('0x5'));var BPromise=require('bluebird');var config=require(_0x65d6('0x6'));var logger=require(_0x65d6('0x7'))(_0x65d6('0x8'));config[_0x65d6('0x9')]=_[_0x65d6('0xa')](config[_0x65d6('0x9')],{'host':_0x65d6('0xb'),'port':0x18eb});var io=require(_0x65d6('0xc'))(new Redis(config[_0x65d6('0x9')]));function emit(_0x227de3,_0x31651b,_0x1d070f){io['to'](_0x227de3)[_0x65d6('0xd')](_0x31651b,_0x1d070f);}function request(_0x34cbfa){logger[_0x65d6('0xe')]('[HTTP]',JSON['stringify'](_0x34cbfa));return rp(_0x34cbfa);}function getCustomFields(_0x3627de,_0x39ad77){var _0x2d833a={};if(_0x3627de['length']>0x0){_[_0x65d6('0xf')](_0x3627de,function(_0x4984ff){if(_[_0x65d6('0x10')](['string',_0x65d6('0x11')],_0x4984ff[_0x65d6('0x12')])&&_0x4984ff[_0x65d6('0x13')]){_0x2d833a[_0x4984ff[_0x65d6('0x13')]]=_0x4984ff[_0x65d6('0x14')][_0x65d6('0x15')]();}else if(_0x4984ff[_0x65d6('0x12')]===_0x65d6('0x16')&&_0x4984ff[_0x65d6('0x17')]&&_0x4984ff[_0x65d6('0x13')]&&_0x39ad77[_0x4984ff[_0x65d6('0x17')]]){_0x2d833a[_0x4984ff[_0x65d6('0x13')]]=_0x39ad77[_0x4984ff[_0x65d6('0x17')]][_0x65d6('0x15')]();}else if(_0x4984ff[_0x65d6('0x12')]===_0x65d6('0x18')&&_0x4984ff[_0x65d6('0x19')]&&_0x4984ff[_0x65d6('0x19')][_0x65d6('0x1a')]&&_0x4984ff[_0x65d6('0x13')]&&_0x39ad77[_0x4984ff[_0x65d6('0x19')][_0x65d6('0x1a')][_0x65d6('0x1b')]()]){_0x2d833a[_0x4984ff[_0x65d6('0x13')]]=_0x39ad77[_0x4984ff[_0x65d6('0x19')][_0x65d6('0x1a')]['toLowerCase']()][_0x65d6('0x15')]();}});}return _0x2d833a;}function getName(_0x15b050){if(_0x15b050[_0x65d6('0x1c')]('\x20')>0x0){var _0x5b7468=_0x15b050[_0x65d6('0x1d')](/ (.+)/);if(_0x5b7468[0x1]){return _0x5b7468;}}return[_0x15b050,_0x15b050];}var accountsTokens={};function getAccessToken(_0x18d71f){return new Promise(function(_0x363a21,_0x59be23){if(!_[_0x65d6('0x1e')](accountsTokens[_0x18d71f['id']])&&!_[_0x65d6('0x1e')](accountsTokens[_0x18d71f['id']][_0x65d6('0x1f')])){if(moment()['isBefore'](accountsTokens[_0x18d71f['id']][_0x65d6('0x20')])){_0x363a21(accountsTokens[_0x18d71f['id']][_0x65d6('0x1f')]);}}var _0x4fa618;switch(_0x18d71f[_0x65d6('0x21')]){case'US':_0x4fa618=_0x65d6('0x22');break;case'AU':_0x4fa618=_0x65d6('0x23');break;case'EU':_0x4fa618=_0x65d6('0x24');break;case'IN':_0x4fa618=_0x65d6('0x25');break;case'CN':_0x4fa618=_0x65d6('0x26');break;default:_0x4fa618=_0x65d6('0x24');break;}var _0x36b53f={'method':_0x65d6('0x27'),'uri':_0x4fa618+_0x65d6('0x28'),'qs':{'refresh_token':_0x18d71f[_0x65d6('0x29')],'client_id':_0x18d71f[_0x65d6('0x2a')],'client_secret':_0x18d71f[_0x65d6('0x2b')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x36b53f)['then'](function(_0x5409cd){accountsTokens[_0x18d71f['id']]={'access_token':_0x5409cd['access_token'],'expires_in':moment()[_0x65d6('0x2c')](_0x5409cd['expires_in'],_0x65d6('0x2d'))};_0x363a21(_0x5409cd[_0x65d6('0x1f')]);})['catch'](function(_0x56f036){logger[_0x65d6('0x2e')](_0x65d6('0x2f'),_0x56f036[_0x65d6('0x30')]);_0x59be23(_0x56f036);});});}function getUser(_0x214633,_0x495b88,_0x5f5833,_0x58fd85){logger[_0x65d6('0x31')](_0x65d6('0x32'));return request({'method':_0x65d6('0x33'),'uri':util[_0x65d6('0x34')]('https://www.zohoapis.%s/crm/v2/users',_0x495b88),'qs':{'type':_0x65d6('0x35')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x214633},'json':!![]})[_0x65d6('0x36')](function(_0x182c6e){if(_0x182c6e[_0x65d6('0x37')]){var _0x4b262f=-0x1;if(_['isArrayLikeObject'](_0x182c6e[_0x65d6('0x37')])){if(!_[_0x65d6('0x1e')](_0x58fd85)){_0x4b262f=_[_0x65d6('0x38')](_0x182c6e[_0x65d6('0x37')],function(_0x25f40d){return _0x25f40d[_0x65d6('0x39')]===_0x58fd85;});}if(_0x4b262f>=0x0){logger[_0x65d6('0x31')](_0x65d6('0x3a'));}else{logger[_0x65d6('0x31')](_0x65d6('0x3b'));_0x4b262f=_['findIndex'](_0x182c6e[_0x65d6('0x37')],function(_0x1a9411){return _0x1a9411['profile'][_0x65d6('0x1a')]==='Administrator';});}return _0x182c6e[_0x65d6('0x37')][_0x4b262f];}else{if(_0x182c6e[_0x65d6('0x3c')][_0x65d6('0x3d')]['name']===_0x65d6('0x3e')){logger[_0x65d6('0x31')](_0x65d6('0x3b'));user=_0x182c6e['user'];return user;}else{logger[_0x65d6('0x2e')]('The\x20failing\x20result\x20is',JSON[_0x65d6('0x3f')](_0x182c6e));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x65d6('0x3f')](_0x182c6e));}}}else{logger[_0x65d6('0x2e')](_0x65d6('0x40'),JSON['stringify'](_0x182c6e));throw new Error(_0x65d6('0x41')+JSON['stringify'](_0x182c6e));}})[_0x65d6('0x42')](function(_0x53d065){console[_0x65d6('0x2e')](_0x53d065);});}function getZohoUser(_0x3a21fb,_0x5d65c4){return new BPromise(function(_0x5daaa4,_0x296b95){request(_0x3a21fb)['then'](function(_0x1b6f93){var _0x1eab8d=null;if(_0x1b6f93){_0x1eab8d=_0x1b6f93[_0x65d6('0x43')][0x0];_0x1eab8d['enduserType']=_0x5d65c4;}_0x5daaa4(_0x1eab8d);})[_0x65d6('0x42')](function(_0x566f70){_0x296b95(_0x566f70);});});}function createEndUser(_0x3cf235,_0x2214bd,_0x380b2a,_0x4b32a4,_0x289de5,_0x45d8e1){var _0x380b2a=getName(_0x380b2a);return request({'method':_0x65d6('0x27'),'uri':_0x65d6('0x44')+_0x2214bd+_0x65d6('0x45')+_['startCase'](_0x45d8e1[_0x65d6('0x46')])+'s','body':{'data':[{'Last_Name':_0x380b2a[0x1],'First_Name':_0x380b2a[0x0],'Phone':_0x4b32a4,'Owner':{'name':!_[_0x65d6('0x1e')](_0x289de5[_0x65d6('0x47')][_0x65d6('0x1a')])?_0x289de5[_0x65d6('0x47')][_0x65d6('0x1a')]:!_[_0x65d6('0x1e')](_0x289de5[_0x65d6('0x48')])?_0x289de5['first_name']+'\x20'+_0x289de5[_0x65d6('0x49')]:_0x289de5[_0x65d6('0x49')],'id':_0x289de5['id']}}]},'headers':{'Authorization':_0x65d6('0x4a')+_0x3cf235},'json':!![]})['then'](function(_0x48d6c8){if(_0x48d6c8&&_0x48d6c8[_0x65d6('0x43')][0x0][_0x65d6('0x4b')]===_0x65d6('0x4c')){var _0xef63aa=_0x48d6c8[_0x65d6('0x43')][0x0][_0x65d6('0x4d')];_0xef63aa[_0x65d6('0x4e')]=_[_0x65d6('0x4f')](_0x45d8e1['moduleCreate'])+'s';return _0xef63aa;}logger[_0x65d6('0x2e')](_0x65d6('0x40'),JSON[_0x65d6('0x3f')](data));throw new Error(_0x65d6('0x50')+JSON[_0x65d6('0x3f')](data));})[_0x65d6('0x42')](function(_0x170b8e){console['log'](_0x65d6('0x51'),_0x170b8e);});}function getEndUser(_0x1ca0b6,_0x8d4a40,_0x181a2a,_0x5084e3,_0x42b2d2,_0x2b9df,_0x31964){var _0x1df2b2={'method':_0x65d6('0x33'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x1ca0b6},'json':!![]};switch(_0x31964[_0x65d6('0x52')]){case _0x65d6('0x53'):_0x1df2b2[_0x65d6('0x54')]=_0x65d6('0x44')+_0x8d4a40+_0x65d6('0x55')+_0x42b2d2+'))';return getZohoUser(_0x1df2b2,'Contacts')['then'](function(_0x1f6071){if(_0x1f6071)return _0x1f6071;_0x1df2b2[_0x65d6('0x54')]=_0x65d6('0x44')+_0x8d4a40+_0x65d6('0x56')+_0x42b2d2+'))';return getZohoUser(_0x1df2b2,_0x65d6('0x57'))['then'](function(_0x4351b){if(_0x4351b)return _0x4351b;if(_0x31964[_0x65d6('0x46')]!=_0x65d6('0x58')){return createEndUser(_0x1ca0b6,_0x8d4a40,_0x5084e3,_0x42b2d2,_0x2b9df,_0x31964);}else{return{};}});});break;case'contact':_0x1df2b2[_0x65d6('0x54')]=_0x65d6('0x44')+_0x8d4a40+_0x65d6('0x55')+_0x42b2d2+'))';return getZohoUser(_0x1df2b2,_0x65d6('0x59'))[_0x65d6('0x36')](function(_0x2f0ebb){if(_0x2f0ebb)return _0x2f0ebb;if(_0x31964['moduleCreate']!=_0x65d6('0x58')){return createEndUser(_0x1ca0b6,_0x8d4a40,_0x5084e3,_0x42b2d2,_0x2b9df,_0x31964);}else{return{};}});break;case _0x65d6('0x5a'):_0x1df2b2[_0x65d6('0x54')]=_0x65d6('0x44')+_0x8d4a40+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x42b2d2+'))';return getZohoUser(_0x1df2b2,_0x65d6('0x57'))[_0x65d6('0x36')](function(_0x4cd5e0){if(_0x4cd5e0)return _0x4cd5e0;if(_0x31964[_0x65d6('0x46')]!=_0x65d6('0x58')){return createEndUser(_0x1ca0b6,_0x8d4a40,_0x5084e3,_0x42b2d2,_0x2b9df,_0x31964);}else{return{};}});break;}}function getCall(_0x2c0597,_0x271e07,_0x28026a,_0x30027b,_0x7f960b,_0x57cf5c,_0x27a729,_0x255c54){logger['info']('Creating\x20new\x20call...');var _0x5a1520={};_0x5a1520[_0x65d6('0x5b')]={'name':!_[_0x65d6('0x1e')](_0x30027b[_0x65d6('0x47')][_0x65d6('0x1a')])&&!_['isNil'](_0x30027b['profile'][_0x65d6('0x1a')])&&_0x30027b[_0x65d6('0x3d')]['name']===_0x65d6('0x5c')?_0x30027b[_0x65d6('0x47')]['name']:!_[_0x65d6('0x1e')](_0x30027b[_0x65d6('0x48')])?_0x30027b[_0x65d6('0x48')]+'\x20'+_0x30027b[_0x65d6('0x49')]:_0x30027b['last_name'],'id':_0x30027b['id']};_0x5a1520[_0x65d6('0x5d')]=intUtil[_0x65d6('0x5e')](_0x57cf5c['Subjects'],_0x27a729,'\x20');_0x5a1520['Description']=intUtil['getString'](_0x57cf5c[_0x65d6('0x5f')],_0x27a729,'\x0a');if(_0x7f960b[_0x65d6('0x4e')]==='Contacts'){_0x5a1520[_0x65d6('0x60')]={'name':!_['isNil'](_0x7f960b[_0x65d6('0x61')])?_0x7f960b[_0x65d6('0x61')]:!_[_0x65d6('0x1e')](_0x7f960b['First_Name'])?_0x7f960b[_0x65d6('0x62')]+'\x20'+_0x7f960b['Last_Name']:_0x7f960b[_0x65d6('0x63')],'id':_0x7f960b['id']};}if(_0x7f960b['enduserType']===_0x65d6('0x57')){_0x5a1520['What_Id']={'name':!_[_0x65d6('0x1e')](_0x7f960b[_0x65d6('0x61')])?_0x7f960b[_0x65d6('0x61')]:!_[_0x65d6('0x1e')](_0x7f960b[_0x65d6('0x62')])?_0x7f960b[_0x65d6('0x62')]+'\x20'+_0x7f960b[_0x65d6('0x63')]:_0x7f960b[_0x65d6('0x63')],'id':_0x7f960b['id']};_0x5a1520[_0x65d6('0x64')]=_[_0x65d6('0x4f')](_0x7f960b[_0x65d6('0x4e')]);}if(_0x27a729[_0x65d6('0x65')]){_0x5a1520[_0x65d6('0x66')]=moment['utc'](parseInt(_0x27a729['talktime'])*0x3e8)[_0x65d6('0x34')](_0x65d6('0x67'));}else if(_0x27a729[_0x65d6('0x68')]&&_0x27a729['endtime']){_0x5a1520[_0x65d6('0x66')]=moment[_0x65d6('0x69')](moment(_0x27a729[_0x65d6('0x6a')],'YYYY-MM-DDTHH:mm:ss')[_0x65d6('0x6b')](moment(_0x27a729['starttime'],'YYYY-MM-DDTHH:mm:ss')))[_0x65d6('0x34')](_0x65d6('0x67'));}switch(_0x27a729[_0x65d6('0x6c')]){case _0x65d6('0x6d'):_0x5a1520['Call_Result']=_0x65d6('0x6e');break;case _0x65d6('0x6f'):case _0x65d6('0x70'):_0x5a1520[_0x65d6('0x71')]=_0x65d6('0x72');break;case _0x65d6('0x73'):_0x5a1520[_0x65d6('0x71')]=_0x65d6('0x74');break;case _0x65d6('0x75'):_0x5a1520[_0x65d6('0x71')]=_0x65d6('0x76');break;case'timeout':_0x5a1520[_0x65d6('0x71')]=_0x65d6('0x77');default:}_0x5a1520['Call_Start_Time']=(_0x255c54===_0x65d6('0x78')?moment(_0x27a729['starttime'])[_0x65d6('0x34')](_0x65d6('0x79')):moment(_0x27a729['agentcalledAt'])[_0x65d6('0x34')](_0x65d6('0x79')))||moment()['format'](_0x65d6('0x79'));_0x5a1520['Call_Type']=_0x255c54||_0x65d6('0x7a');_0x5a1520=_[_0x65d6('0x7b')](_0x5a1520,getCustomFields(_0x57cf5c[_0x65d6('0x7c')],_0x27a729));return request({'method':'POST','uri':_0x65d6('0x44')+_0x271e07+'/crm/v2/Calls','headers':{'Authorization':_0x65d6('0x4a')+_0x2c0597},'body':{'data':[_0x5a1520]},'json':!![]})[_0x65d6('0x36')](function(_0x3c114e){if(_0x3c114e&&_0x3c114e[_0x65d6('0x43')][0x0][_0x65d6('0x4b')]===_0x65d6('0x4c')){logger[_0x65d6('0x31')](_0x65d6('0x7d'));return{'id':_0x3c114e[_0x65d6('0x43')][0x0]['details']['id']};}})[_0x65d6('0x42')](function(_0x30a455){logger[_0x65d6('0x31')]('err',_0x30a455['stack']);console[_0x65d6('0x7e')](_0x65d6('0x7f'),_0x30a455);});}exports[_0x65d6('0x80')]=function(_0x407136,_0x3b7061,_0x3e2035,_0x35700b,_0x15733e,_0x3fb37b){var _0xe0e61b,_0x10ace5,_0x5e4998;_0x3fb37b[_0x65d6('0x81')]=intUtil[_0x65d6('0x82')](_0x3fb37b[_0x65d6('0x81')]);_0x3fb37b[_0x65d6('0x83')]=intUtil[_0x65d6('0x82')](_0x3fb37b[_0x65d6('0x83')]);if(_0x15733e&&_0x15733e['monitor_format']){logger[_0x65d6('0x31')](_0x65d6('0x84'),_0x65d6('0x85'));_0x3b7061[_0x65d6('0x86')]=_0x3fb37b[_0x65d6('0x83')]+_0x65d6('0x87')+_0x3b7061[_0x65d6('0x88')]+_0x65d6('0x89')+md5(_0x3b7061[_0x65d6('0x88')]);}else{_0x3b7061['recordingURL']='';}var _0x14c923=_0x3fb37b[_0x65d6('0x81')]===_0x65d6('0x8a')?'eu':_0x65d6('0x8b');return getAccessToken(_0x3fb37b)[_0x65d6('0x36')](function(_0x44eb9){_0x5e4998=_0x44eb9;return getUser(_0x5e4998,_0x14c923,_0x3fb37b,_0x35700b[_0x65d6('0x39')]);})[_0x65d6('0x36')](function(_0x5030d5){_0xe0e61b=_0x5030d5;logger[_0x65d6('0x31')]('The\x20User\x20ID\x20is:',_0xe0e61b['id']);return getEndUser(_0x5e4998,_0x14c923,_0x3fb37b,_0x3b7061[_0x65d6('0x8c')],_0x3b7061['calleridnum'],_0xe0e61b,_0x3e2035);})['then'](function(_0x3f87be){_0x10ace5=_0x3f87be;return getCall(_0x5e4998,_0x14c923,_0x3fb37b,_0xe0e61b,_0x10ace5,_0x3e2035,_0x3b7061,_0x65d6('0x7a'));})[_0x65d6('0x36')](function(_0x399003){if(_0x399003){logger[_0x65d6('0x31')](_0x65d6('0x8d'),_0x399003['id']);logger[_0x65d6('0x31')](_0x65d6('0x84'),_0x65d6('0x8e'));emit(util[_0x65d6('0x34')](_0x65d6('0x8f'),_0x35700b[_0x65d6('0x1a')]),_0x65d6('0x90'),{'uri':_0x65d6('0x91')+_0x3fb37b['host']+_0x65d6('0x92')+_0x399003['id']});}})['catch'](function(_0x66dc5e){logger['error'](_0x65d6('0x84'),JSON[_0x65d6('0x3f')](_0x66dc5e));});};exports[_0x65d6('0x78')]=function(_0x33924d,_0x47142a,_0x5560d0,_0x20a3dd,_0x12aa36,_0x2ba1ee,_0xf50553){var _0x8a4ceb,_0x3d65db,_0x2272ce;_0x2ba1ee[_0x65d6('0x81')]=intUtil['stripTrailingSlash'](_0x2ba1ee[_0x65d6('0x81')]);_0x2ba1ee['serverUrl']=intUtil[_0x65d6('0x82')](_0x2ba1ee['serverUrl']);if(_0xf50553&&_0xf50553[_0x65d6('0x93')]&&_0xf50553[_0x65d6('0x93')]!==_0x65d6('0x94')){logger['info']('[OUTBOUND]',_0x65d6('0x85'));_0x47142a[_0x65d6('0x86')]=_0x2ba1ee[_0x65d6('0x83')]+_0x65d6('0x87')+_0x47142a[_0x65d6('0x88')]+_0x65d6('0x89')+md5(_0x47142a[_0x65d6('0x88')]);}var _0x3afe34=_0x2ba1ee[_0x65d6('0x81')]===_0x65d6('0x8a')?'eu':_0x65d6('0x8b');return getAccessToken(_0x2ba1ee)[_0x65d6('0x36')](function(_0x492c79){_0x2272ce=_0x492c79;return getUser(_0x2272ce,_0x3afe34,_0x2ba1ee,_0x20a3dd[_0x65d6('0x39')]);})[_0x65d6('0x36')](function(_0x5d1b31){_0x8a4ceb=_0x5d1b31;logger[_0x65d6('0x31')](_0x65d6('0x95'),_0x8a4ceb['id']);return getEndUser(_0x2272ce,_0x3afe34,_0x2ba1ee,_0x47142a[_0x65d6('0x96')],_0x47142a[_0x65d6('0x97')],_0x8a4ceb,_0x5560d0);})[_0x65d6('0x36')](function(_0x44956c){_0x3d65db=_0x44956c;return getCall(_0x2272ce,_0x3afe34,_0x2ba1ee,_0x8a4ceb,_0x3d65db,_0x5560d0,_0x47142a,'Outbound');})[_0x65d6('0x36')](function(_0x452403){if(_0x452403){logger[_0x65d6('0x31')](_0x65d6('0x8d'),_0x452403['id']);logger['info'](_0x65d6('0x98'),_0x65d6('0x8e'));emit(util[_0x65d6('0x34')](_0x65d6('0x8f'),_0x20a3dd[_0x65d6('0x1a')]),_0x65d6('0x90'),{'uri':'https://crm.'+_0x2ba1ee[_0x65d6('0x81')]+'/crm/EntityInfo.do?module=Calls&id='+_0x452403['id']});}})['catch'](function(_0x2ee05a){logger[_0x65d6('0x2e')]('[OUTBOUND]',JSON[_0x65d6('0x3f')](_0x2ee05a));});};exports[_0x65d6('0x99')]=function(_0x2726cf,_0x5e9865,_0x8b54a0,_0xff881b,_0x420ea4,_0x4f85a1){var _0x37218d,_0x4ad136,_0x573cf6;_0x4f85a1[_0x65d6('0x81')]=intUtil['stripTrailingSlash'](_0x4f85a1[_0x65d6('0x81')]);_0x4f85a1[_0x65d6('0x83')]=intUtil[_0x65d6('0x82')](_0x4f85a1[_0x65d6('0x83')]);if(_0x420ea4&&_0x420ea4['monitor_format']){logger[_0x65d6('0x31')]('['+_0x5e9865[_0x65d6('0x6c')][_0x65d6('0x9a')]()+']','Recording\x20is\x20enabled!');_0x5e9865[_0x65d6('0x86')]=_0x4f85a1['serverUrl']+_0x65d6('0x87')+_0x5e9865[_0x65d6('0x88')]+_0x65d6('0x89')+md5(_0x5e9865[_0x65d6('0x88')]);}else{_0x5e9865['recordingURL']='';}var _0x53d24d=_0x4f85a1[_0x65d6('0x81')]===_0x65d6('0x8a')?'eu':_0x65d6('0x8b');return getAccessToken(_0x4f85a1)[_0x65d6('0x36')](function(_0x3b51ad){_0x573cf6=_0x3b51ad;return getUser(_0x573cf6,_0x53d24d,_0x4f85a1);})[_0x65d6('0x36')](function(_0x570b87){_0x37218d=_0x570b87;logger['info'](_0x65d6('0x95'),_0x37218d['id']);return getEndUser(_0x573cf6,_0x53d24d,_0x4f85a1,_0x5e9865[_0x65d6('0x8c')],_0x5e9865['calleridnum'],_0x37218d,_0x8b54a0);})['then'](function(_0x2b8e85){_0x4ad136=_0x2b8e85;return getCall(_0x573cf6,_0x53d24d,_0x4f85a1,_0x37218d,_0x4ad136,_0x8b54a0,_0x5e9865,'Inbound');})[_0x65d6('0x36')](function(_0x86aac9){if(_0x86aac9){logger[_0x65d6('0x31')](_0x65d6('0x8d'),_0x86aac9['id']);}})['catch'](function(_0x494947){logger['error']('['+_0x5e9865[_0x65d6('0x6c')][_0x65d6('0x9a')]()+']',JSON['stringify'](_0x494947));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/script/index.js b/server/services/ami/trigger/script/index.js index 5350aa1..1655ec9 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 _0xfb38=['mustache','../../../../config/logger','trigger','data2','Script','data3','error','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','format','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs'];(function(_0x3bbc79,_0x597d06){var _0x468348=function(_0x19d593){while(--_0x19d593){_0x3bbc79['push'](_0x3bbc79['shift']());}};_0x468348(++_0x597d06);}(_0xfb38,0x102));var _0x8fb3=function(_0x165c96,_0x2269de){_0x165c96=_0x165c96-0x0;var _0x5c2420=_0xfb38[_0x165c96];return _0x5c2420;};'use strict';var util=require(_0x8fb3('0x0'));var sh=require(_0x8fb3('0x1'));var Mustache=require(_0x8fb3('0x2'));var logger=require(_0x8fb3('0x3'))(_0x8fb3('0x4'));exports['exec']=function(_0x1f251c,_0x330a0a){var _0x40f152=_0x1f251c[_0x8fb3('0x5')]?_0x1f251c['data2']:_0x8fb3('0x6');var _0xe57d54=_0x1f251c[_0x8fb3('0x7')]?Mustache['render'](_0x1f251c[_0x8fb3('0x7')],_0x330a0a):_0x330a0a;sh['exec'](_0xe57d54,function(_0xc2a8ca,_0x2145c2,_0x14a5ce){if(_0xc2a8ca!==0x0){logger[_0x8fb3('0x8')](util['format'](_0x8fb3('0x9'),_0x40f152,_0xe57d54,_0xc2a8ca,_0x14a5ce));}else{logger[_0x8fb3('0xa')](util[_0x8fb3('0xb')](_0x8fb3('0xc'),_0x40f152,_0xe57d54,_0x2145c2));}});}; \ No newline at end of file +var _0xad48=['util','shelljs','mustache','../../../../config/logger','data2','render','exec','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info'];(function(_0x211cad,_0x393dde){var _0x351ca4=function(_0x1cd61d){while(--_0x1cd61d){_0x211cad['push'](_0x211cad['shift']());}};_0x351ca4(++_0x393dde);}(_0xad48,0x10e));var _0x8ad4=function(_0x7e6fc5,_0x359bf2){_0x7e6fc5=_0x7e6fc5-0x0;var _0x4e5ca7=_0xad48[_0x7e6fc5];return _0x4e5ca7;};'use strict';var util=require(_0x8ad4('0x0'));var sh=require(_0x8ad4('0x1'));var Mustache=require(_0x8ad4('0x2'));var logger=require(_0x8ad4('0x3'))('trigger');exports['exec']=function(_0x3e91ce,_0x42e77f){var _0x496cbb=_0x3e91ce[_0x8ad4('0x4')]?_0x3e91ce[_0x8ad4('0x4')]:'Script';var _0x54646b=_0x3e91ce['data3']?Mustache[_0x8ad4('0x5')](_0x3e91ce['data3'],_0x42e77f):_0x42e77f;sh[_0x8ad4('0x6')](_0x54646b,function(_0x380ad3,_0x35d330,_0x3203d1){if(_0x380ad3!==0x0){logger['error'](util[_0x8ad4('0x7')](_0x8ad4('0x8'),_0x496cbb,_0x54646b,_0x380ad3,_0x3203d1));}else{logger[_0x8ad4('0x9')](util['format']('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x496cbb,_0x54646b,_0x35d330));}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/urlforward/index.js b/server/services/ami/trigger/urlforward/index.js index fa0ffd3..4091d61 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 _0x0599=['error','stack','GET','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','data2','stringify','then','isNil',',\x20request\x20body:\x20','object','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','message','util','lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data5','number','data6','parse'];(function(_0xac30f8,_0x2cc5fb){var _0x1cc073=function(_0x21c9c3){while(--_0x21c9c3){_0xac30f8['push'](_0xac30f8['shift']());}};_0x1cc073(++_0x2cc5fb);}(_0x0599,0xf3));var _0x9059=function(_0x188498,_0x2a73fa){_0x188498=_0x188498-0x0;var _0x2e5a34=_0x0599[_0x188498];return _0x2e5a34;};'use strict';var rp=require('request-promise');var util=require(_0x9059('0x0'));var _=require(_0x9059('0x1'));var Mustache=require(_0x9059('0x2'));var logger=require(_0x9059('0x3'))(_0x9059('0x4'));exports[_0x9059('0x5')]=function(_0x16c401,_0x26d2bc){var _0x19a36a,_0x19d2f6;var _0xca2ca4={'method':_0x16c401[_0x9059('0x6')][_0x9059('0x7')](),'uri':Mustache[_0x9059('0x8')](_0x16c401['data2'],_0x26d2bc),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x16c401[_0x9059('0x9')])===_0x9059('0xa')&&parseInt(_0x16c401['data5'])>=0x1&&parseInt(_0x16c401[_0x9059('0x9')])<=0xa?parseInt(_0x16c401['data5'])*0x3e8:0x5*0x3e8};try{_0xca2ca4['headers']=_0x16c401[_0x9059('0xb')]?JSON[_0x9059('0xc')](Mustache[_0x9059('0x8')](_0x16c401[_0x9059('0xb')],_0x26d2bc)):{};}catch(_0x2739ef){logger[_0x9059('0xd')](_0x2739ef[_0x9059('0xe')]);}switch(_0x16c401[_0x9059('0x6')][_0x9059('0x7')]()){case _0x9059('0xf'):case'DELETE':_0x19a36a=null;_0xca2ca4['qs']=_0x26d2bc;break;case'POST':case _0x9059('0x10'):if(_0x16c401[_0x9059('0x11')]){try{_0x19a36a=JSON[_0x9059('0xc')](Mustache[_0x9059('0x8')](_0x16c401[_0x9059('0x11')],_0x26d2bc));_0xca2ca4[_0x9059('0x12')]=_0x19a36a;}catch(_0x2e9f47){logger[_0x9059('0xd')](_0x2e9f47[_0x9059('0xe')]);logger['error'](_0x9059('0x13'));}}else{_0x19a36a=_0x26d2bc;_0xca2ca4['body']=_0x19a36a;}break;}logger[_0x9059('0x14')](util[_0x9059('0x15')]('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x16c401[_0x9059('0x6')],_0x16c401[_0x9059('0x16')],JSON[_0x9059('0x17')](_0xca2ca4)));rp(_0xca2ca4)[_0x9059('0x18')](function(_0x1274ab){_0x19a36a=!_[_0x9059('0x19')](_0x19a36a)?_0x9059('0x1a')+_0x19a36a:'';_0x19d2f6=typeof _0x1274ab[_0x9059('0x12')]===_0x9059('0x1b')?JSON[_0x9059('0x17')](_0x1274ab['body']):_0x1274ab['body'];logger[_0x9059('0x14')](util[_0x9059('0x15')]('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x16c401['data1'],_0x16c401[_0x9059('0x16')],_0x1274ab[_0x9059('0x1c')],_0x19d2f6));})[_0x9059('0x1d')](function(_0x44f8be){logger['error'](util[_0x9059('0x15')](_0x9059('0x1e'),_0x16c401[_0x9059('0x6')],_0x16c401[_0x9059('0x16')],_0x44f8be['statusCode'],_0x44f8be['name'],_0x44f8be[_0x9059('0x1f')]));});}; \ No newline at end of file +var _0x2114=['exec','data1','toUpperCase','render','data5','number','headers','parse','data6','error','stack','GET','PUT','data7','body','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','then',',\x20request\x20body:\x20','object','stringify','info','statusCode','catch','message','request-promise','util','lodash','trigger'];(function(_0x5e1e6e,_0x2d0556){var _0x3a9908=function(_0x808d12){while(--_0x808d12){_0x5e1e6e['push'](_0x5e1e6e['shift']());}};_0x3a9908(++_0x2d0556);}(_0x2114,0x1a0));var _0x4211=function(_0x5cbd7b,_0x207439){_0x5cbd7b=_0x5cbd7b-0x0;var _0x3fdfb8=_0x2114[_0x5cbd7b];return _0x3fdfb8;};'use strict';var rp=require(_0x4211('0x0'));var util=require(_0x4211('0x1'));var _=require(_0x4211('0x2'));var Mustache=require('mustache');var logger=require('../../../../config/logger')(_0x4211('0x3'));exports[_0x4211('0x4')]=function(_0x3dd2a1,_0x31cfa3){var _0x142a88,_0x3b2e35;var _0x54d547={'method':_0x3dd2a1[_0x4211('0x5')][_0x4211('0x6')](),'uri':Mustache[_0x4211('0x7')](_0x3dd2a1['data2'],_0x31cfa3),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x3dd2a1[_0x4211('0x8')])===_0x4211('0x9')&&parseInt(_0x3dd2a1['data5'])>=0x1&&parseInt(_0x3dd2a1[_0x4211('0x8')])<=0xa?parseInt(_0x3dd2a1[_0x4211('0x8')])*0x3e8:0x5*0x3e8};try{_0x54d547[_0x4211('0xa')]=_0x3dd2a1['data6']?JSON[_0x4211('0xb')](Mustache['render'](_0x3dd2a1[_0x4211('0xc')],_0x31cfa3)):{};}catch(_0x20a322){logger[_0x4211('0xd')](_0x20a322[_0x4211('0xe')]);}switch(_0x3dd2a1[_0x4211('0x5')][_0x4211('0x6')]()){case _0x4211('0xf'):case'DELETE':_0x142a88=null;_0x54d547['qs']=_0x31cfa3;break;case'POST':case _0x4211('0x10'):if(_0x3dd2a1['data7']){try{_0x142a88=JSON[_0x4211('0xb')](Mustache[_0x4211('0x7')](_0x3dd2a1[_0x4211('0x11')],_0x31cfa3));_0x54d547[_0x4211('0x12')]=_0x142a88;}catch(_0x3f8bfb){logger[_0x4211('0xd')](_0x3f8bfb[_0x4211('0xe')]);logger[_0x4211('0xd')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x142a88=_0x31cfa3;_0x54d547[_0x4211('0x12')]=_0x142a88;}break;}logger['info'](util[_0x4211('0x13')](_0x4211('0x14'),_0x3dd2a1[_0x4211('0x5')],_0x3dd2a1[_0x4211('0x15')],JSON['stringify'](_0x54d547)));rp(_0x54d547)[_0x4211('0x16')](function(_0x18b9b){_0x142a88=!_['isNil'](_0x142a88)?_0x4211('0x17')+_0x142a88:'';_0x3b2e35=typeof _0x18b9b[_0x4211('0x12')]===_0x4211('0x18')?JSON[_0x4211('0x19')](_0x18b9b[_0x4211('0x12')]):_0x18b9b[_0x4211('0x12')];logger[_0x4211('0x1a')](util[_0x4211('0x13')]('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x3dd2a1['data1'],_0x3dd2a1['data2'],_0x18b9b[_0x4211('0x1b')],_0x3b2e35));})[_0x4211('0x1c')](function(_0x2111b2){logger['error'](util[_0x4211('0x13')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x3dd2a1[_0x4211('0x5')],_0x3dd2a1['data2'],_0x2111b2[_0x4211('0x1b')],_0x2111b2['name'],_0x2111b2[_0x4211('0x1d')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 63f046e..be0e2a6 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 _0xd033=['jayson/promise','bluebird','../../config/logger','routing','client','Request','request','debug','error','rpc','message','result','catch','exports'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xd033,0x1c0));var _0x3d03=function(_0x237546,_0xa81b26){_0x237546=_0x237546-0x0;var _0x233e29=_0xd033[_0x237546];return _0x233e29;};'use strict';var jayson=require(_0x3d03('0x0'));var BPromise=require(_0x3d03('0x1'));var logger=require(_0x3d03('0x2'))(_0x3d03('0x3'));var client=jayson[_0x3d03('0x4')]['http']({'port':0x2329});client[_0x3d03('0x5')]=function(_0x26cb51,_0x4026fd){return new BPromise(function(_0x40c115,_0x3ccb05){return client[_0x3d03('0x6')](_0x26cb51,_0x4026fd)['then'](function(_0x3fe0d2){logger[_0x3d03('0x7')]('rpc','routing',_0x26cb51,_0x4026fd,_0x3fe0d2);if(_0x3fe0d2[_0x3d03('0x8')]){logger['error'](_0x3d03('0x9'),'routing',_0x26cb51,_0x3fe0d2[_0x3d03('0x8')][_0x3d03('0xa')],_0x4026fd);return _0x3ccb05(_0x3fe0d2[_0x3d03('0x8')][_0x3d03('0xa')]);}else{return _0x40c115(_0x3fe0d2[_0x3d03('0xb')]);}})[_0x3d03('0xc')](function(_0x2a0adc){logger[_0x3d03('0x8')](_0x3d03('0x9'),_0x3d03('0x3'),_0x26cb51,_0x2a0adc,_0x4026fd);return _0x3ccb05(_0x2a0adc);});});};module[_0x3d03('0xd')]=client; \ No newline at end of file +var _0xe371=['jayson/promise','bluebird','../../config/logger','routing','client','http','Request','request','then','rpc','error','result','catch','exports'];(function(_0x29baaa,_0x18d913){var _0x4da9ff=function(_0xb23cf7){while(--_0xb23cf7){_0x29baaa['push'](_0x29baaa['shift']());}};_0x4da9ff(++_0x18d913);}(_0xe371,0x15e));var _0x1e37=function(_0x5a1cfd,_0x195d93){_0x5a1cfd=_0x5a1cfd-0x0;var _0xc77e80=_0xe371[_0x5a1cfd];return _0xc77e80;};'use strict';var jayson=require(_0x1e37('0x0'));var BPromise=require(_0x1e37('0x1'));var logger=require(_0x1e37('0x2'))(_0x1e37('0x3'));var client=jayson[_0x1e37('0x4')][_0x1e37('0x5')]({'port':0x2329});client[_0x1e37('0x6')]=function(_0x4a75aa,_0xcd4329){return new BPromise(function(_0x3fd72e,_0x5b4597){return client[_0x1e37('0x7')](_0x4a75aa,_0xcd4329)[_0x1e37('0x8')](function(_0x32e5bb){logger['debug'](_0x1e37('0x9'),_0x1e37('0x3'),_0x4a75aa,_0xcd4329,_0x32e5bb);if(_0x32e5bb[_0x1e37('0xa')]){logger[_0x1e37('0xa')](_0x1e37('0x9'),'routing',_0x4a75aa,_0x32e5bb['error']['message'],_0xcd4329);return _0x5b4597(_0x32e5bb[_0x1e37('0xa')]['message']);}else{return _0x3fd72e(_0x32e5bb[_0x1e37('0xb')]);}})[_0x1e37('0xc')](function(_0x2fea5e){logger['error'](_0x1e37('0x9'),_0x1e37('0x3'),_0x4a75aa,_0x2fea5e,_0xcd4329);return _0x5b4597(_0x2fea5e);});});};module[_0x1e37('0xd')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index a88ed35..bd3e18c 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 _0x6040=['./realtime','./rpc/mailAccount','./rpc/setting','email','getMailAccounts','then','initMailAccounts','refresh','mailAccounts','listen','getSettings','loginMailFrequency','error'];(function(_0x43aa79,_0x47b843){var _0x1dbe94=function(_0x3882d1){while(--_0x3882d1){_0x43aa79['push'](_0x43aa79['shift']());}};_0x1dbe94(++_0x47b843);}(_0x6040,0x138));var _0x0604=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x6040[_0x1d1779];return _0x2377e9;};'use strict';var server=require('./server');var Realtime=require(_0x0604('0x0'));var EmailChannel=require('./lib/email');var mailAccount=require(_0x0604('0x1'));var setting=require(_0x0604('0x2'));var logger=require('../../config/logger')(_0x0604('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()['then'](mailAccount[_0x0604('0x4')]())[_0x0604('0x5')](realtime[_0x0604('0x6')]())['then'](function(){email[_0x0604('0x7')](realtime[_0x0604('0x8')]);return realtime;});}function main(){return server[_0x0604('0x9')](realtime,email)[_0x0604('0x5')](function(){return initRealtime();})[_0x0604('0x5')](function(){return setting[_0x0604('0xa')]();})['then'](function(_0x15ff21){return setInterval(initRealtime,_0x15ff21[_0x0604('0xb')]*0x3e8);})['catch'](function(_0x442288){logger[_0x0604('0xc')]('Email\x20service\x20initialization',_0x442288);});}main(); \ No newline at end of file +var _0x1277=['./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','email','resolve','then','getMailAccounts','initMailAccounts','listen','getSettings','catch','error','./realtime'];(function(_0x2bb7d9,_0x369b40){var _0x33568b=function(_0x188493){while(--_0x188493){_0x2bb7d9['push'](_0x2bb7d9['shift']());}};_0x33568b(++_0x369b40);}(_0x1277,0x141));var _0x7127=function(_0x268456,_0x8f7b38){_0x268456=_0x268456-0x0;var _0x4bffb2=_0x1277[_0x268456];return _0x4bffb2;};'use strict';var server=require('./server');var Realtime=require(_0x7127('0x0'));var EmailChannel=require(_0x7127('0x1'));var mailAccount=require(_0x7127('0x2'));var setting=require(_0x7127('0x3'));var logger=require(_0x7127('0x4'))(_0x7127('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x7127('0x6')]()[_0x7127('0x7')](mailAccount[_0x7127('0x8')]())[_0x7127('0x7')](realtime[_0x7127('0x9')]())[_0x7127('0x7')](function(){email['refresh'](realtime['mailAccounts']);return realtime;});}function main(){return server[_0x7127('0xa')](realtime,email)[_0x7127('0x7')](function(){return initRealtime();})[_0x7127('0x7')](function(){return setting[_0x7127('0xb')]();})[_0x7127('0x7')](function(_0x9e2215){return setInterval(initRealtime,_0x9e2215['loginMailFrequency']*0x3e8);})[_0x7127('0xc')](function(_0xc91b29){logger[_0x7127('0xd')]('Email\x20service\x20initialization',_0xc91b29);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 990e26c..481774a 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 _0x81ff=['hasOwnProperty','box','handleImapBox','bind','handleImapEmail','handleImapEnd','error','status','disabled','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify','sendMail','send','verifySmtp','Smtp','lastSync','verify','verified','catch','exports','lodash','md5','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','./imap','./smtp','info','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','Imap','messageStatus','total','isNil','mailAccount:update','refresh','custom','service','provider'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x81ff,0xc4));var _0xf81f=function(_0x5ac06b,_0x52cacb){_0x5ac06b=_0x5ac06b-0x0;var _0xb4efa7=_0x81ff[_0x5ac06b];return _0xb4efa7;};'use strict';var _=require(_0xf81f('0x0'));var moment=require('moment');var BPromise=require('bluebird');var md5=require(_0xf81f('0x1'));var Redis=require('ioredis');var config=require(_0xf81f('0x2'));var logger=require(_0xf81f('0x3'))(_0xf81f('0x4'));config[_0xf81f('0x5')]=_[_0xf81f('0x6')](config[_0xf81f('0x5')],{'host':_0xf81f('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf81f('0x5')]));var EmailImap=require(_0xf81f('0x8'));var EmailSmtp=require(_0xf81f('0x9'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x3f8c11){logger[_0xf81f('0xa')]('start\x20email\x20channel');this[_0xf81f('0xb')]=_0x3f8c11[_0xf81f('0xb')];this[_0xf81f('0xc')]={};this[_0xf81f('0xd')]=new EmailSmtp();}EmailChannel[_0xf81f('0xe')][_0xf81f('0xf')]=function(_0x5bd92c){var _0x39938a=this[_0xf81f('0xb')][_0x5bd92c];var _0x232f5a={'id':_0x39938a['id'],'name':_0x39938a[_0xf81f('0x10')],'key':_0x39938a[_0xf81f('0x11')],'active':_0x39938a[_0xf81f('0x12')],'Imap':{'status':_0x39938a[_0xf81f('0x13')]['status'],'messageStatus':_0x39938a[_0xf81f('0x13')][_0xf81f('0x14')],'total':_0x39938a[_0xf81f('0x13')][_0xf81f('0x15')]}};if(_[_0xf81f('0x16')](md5Accounts[_0x5bd92c])){md5Accounts[_0x5bd92c]={};}var _0x59a5cd=md5(JSON['stringify'](_0x232f5a));if(md5Accounts[_0x5bd92c][_0xf81f('0x1')]!==_0x59a5cd){md5Accounts[_0x5bd92c][_0xf81f('0x1')]=_0x59a5cd;io[_0xf81f('0xf')](_0xf81f('0x17'),_0x232f5a);}};EmailChannel[_0xf81f('0xe')][_0xf81f('0x18')]=function(_0x3f4d0b){for(var _0x5e1738 in _0x3f4d0b){if(_0x3f4d0b['hasOwnProperty'](_0x5e1738)){if(_0x3f4d0b[_0x5e1738]['Imap']&&_0x3f4d0b[_0x5e1738]['active']){var _0x4971ac=_0x3f4d0b[_0x5e1738][_0xf81f('0x13')];if(!_0x4971ac['service']&&_0x3f4d0b[_0x5e1738]['provider']!==_0xf81f('0x19'))_0x4971ac[_0xf81f('0x1a')]=_0x3f4d0b[_0x5e1738][_0xf81f('0x1b')];if(!this['imapAccounts'][_0xf81f('0x1c')](_0x4971ac['id'])){this[_0xf81f('0xc')][_0x4971ac['id']]=new EmailImap(_0x4971ac,_0x3f4d0b[_0x5e1738]['email']);this[_0xf81f('0xc')][_0x4971ac['id']]['on'](_0xf81f('0x1d'),this[_0xf81f('0x1e')][_0xf81f('0x1f')](this,_0x5e1738));this[_0xf81f('0xc')][_0x4971ac['id']]['on'](_0xf81f('0x4'),this[_0xf81f('0x20')][_0xf81f('0x1f')](this,_0x5e1738));this['imapAccounts'][_0x4971ac['id']]['on']('end',this[_0xf81f('0x21')]['bind'](this,_0x5e1738));this[_0xf81f('0xc')][_0x4971ac['id']]['on'](_0xf81f('0x22'),this['handleImapError'][_0xf81f('0x1f')](this,_0x5e1738));}}else{if(_[_0xf81f('0x16')](this[_0xf81f('0xb')][_0x5e1738]['Imap'])){this[_0xf81f('0xb')][_0x5e1738]['Imap']={};}this[_0xf81f('0xb')][_0x5e1738][_0xf81f('0x13')][_0xf81f('0x23')]=_0xf81f('0x24');this[_0xf81f('0xb')][_0x5e1738]['Imap']['messageStatus']='';this[_0xf81f('0xf')](_0x5e1738);}}}};EmailChannel['prototype'][_0xf81f('0x1e')]=function(_0x5761c2,_0x23b97d){if(this[_0xf81f('0xb')][_0x5761c2]){this['mailAccounts'][_0x5761c2][_0xf81f('0x13')]['status']='connected';this['mailAccounts'][_0x5761c2][_0xf81f('0x13')][_0xf81f('0x14')]=_0x23b97d['name'];if(_0x23b97d['messages']){this[_0xf81f('0xb')][_0x5761c2][_0xf81f('0x13')][_0xf81f('0x15')]=_0x23b97d[_0xf81f('0x25')][_0xf81f('0x15')];}return this['emit'](_0x5761c2);}};EmailChannel[_0xf81f('0xe')][_0xf81f('0x20')]=function(_0x1f8889,_0x49d97d){logger[_0xf81f('0xa')](_0xf81f('0x26'),_0x49d97d[_0xf81f('0x27')],_0x49d97d[_0xf81f('0x28')],_0x49d97d[_0xf81f('0x29')],_0x1f8889);if(this['mailAccounts'][_0x1f8889]){return mailAccount[_0xf81f('0x2a')](_0x1f8889,_0x49d97d)[_0xf81f('0x2b')](function(_0x1abe25){if(_0x1abe25){logger[_0xf81f('0xa')](_0xf81f('0x2c'));}})['catch'](function(_0x2cd7ab){logger[_0xf81f('0x22')](_0xf81f('0x2d'),JSON[_0xf81f('0x2e')](_0x2cd7ab));});}};EmailChannel[_0xf81f('0xe')][_0xf81f('0x21')]=function(_0x7e243e){if(this[_0xf81f('0xb')][_0x7e243e]&&this['mailAccounts'][_0x7e243e][_0xf81f('0x13')]){if(this[_0xf81f('0xc')][this[_0xf81f('0xb')][_0x7e243e][_0xf81f('0x13')]['id']]){delete this[_0xf81f('0xc')][this['mailAccounts'][_0x7e243e][_0xf81f('0x13')]['id']];}this[_0xf81f('0xb')][_0x7e243e][_0xf81f('0x13')]['lastSync']=moment();this[_0xf81f('0xf')](_0x7e243e);}};EmailChannel[_0xf81f('0xe')]['handleImapError']=function(_0x2e43e5,_0x15734c){if(this[_0xf81f('0xb')][_0x2e43e5]){this[_0xf81f('0xb')][_0x2e43e5][_0xf81f('0x13')][_0xf81f('0x23')]='error';this[_0xf81f('0xb')][_0x2e43e5][_0xf81f('0x13')][_0xf81f('0x14')]=_0x15734c;return this[_0xf81f('0xf')](_0x2e43e5);}};EmailChannel[_0xf81f('0xe')][_0xf81f('0x2f')]=function(_0x3e5844,_0x4a9fbc){return this[_0xf81f('0xd')][_0xf81f('0x30')](_0x3e5844,_0x4a9fbc);};EmailChannel[_0xf81f('0xe')][_0xf81f('0x31')]=function(_0x42e17f){var _0x1a52de=this;if(this[_0xf81f('0xb')][_0x42e17f['id']]){if(_[_0xf81f('0x16')](this[_0xf81f('0xb')][_0x42e17f['id']][_0xf81f('0x32')])){this[_0xf81f('0xb')][_0x42e17f['id']][_0xf81f('0x32')]={};}this[_0xf81f('0xb')][_0x42e17f['id']][_0xf81f('0x32')][_0xf81f('0x33')]=moment();return new BPromise(function(_0xd4aa49,_0x13601d){return _0x1a52de[_0xf81f('0xd')][_0xf81f('0x34')](_0x42e17f)[_0xf81f('0x2b')](function(_0x5c9917){_0x1a52de[_0xf81f('0xb')][_0x42e17f['id']][_0xf81f('0x32')]['status']=_0xf81f('0x35');_0x1a52de[_0xf81f('0xb')][_0x42e17f['id']][_0xf81f('0x32')][_0xf81f('0x14')]='';_0x1a52de['emit'](_0x42e17f['id']);_0xd4aa49(_0x5c9917);})[_0xf81f('0x36')](function(_0x5b50ed){_0x1a52de[_0xf81f('0xb')][_0x42e17f['id']][_0xf81f('0x32')][_0xf81f('0x23')]=_0xf81f('0x22');_0x1a52de['mailAccounts'][_0x42e17f['id']][_0xf81f('0x32')][_0xf81f('0x14')]=_0x5b50ed;_0x1a52de[_0xf81f('0xf')](_0x42e17f['id']);_0x13601d(_0x5b50ed);});});}return this['smtp'][_0xf81f('0x34')](_0x42e17f);};module[_0xf81f('0x37')]=EmailChannel; \ No newline at end of file +var _0x1802=['Smtp','verify','verified','exports','lodash','moment','bluebird','md5','ioredis','../../../config/environment','email','redis','socket.io-emitter','smtp','prototype','emit','mailAccounts','name','key','active','Imap','messageStatus','total','isNil','stringify','mailAccount:update','hasOwnProperty','service','provider','custom','imapAccounts','box','handleImapBox','handleImapEmail','bind','end','handleImapEnd','handleImapError','status','messages','info','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','lastName','from','notify','Mail\x20accepted\x20from\x20routing','catch','error','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','send','verifySmtp'];(function(_0x4eab87,_0x380d40){var _0x2dc823=function(_0x2fcad7){while(--_0x2fcad7){_0x4eab87['push'](_0x4eab87['shift']());}};_0x2dc823(++_0x380d40);}(_0x1802,0xd8));var _0x2180=function(_0x58f264,_0x2494b9){_0x58f264=_0x58f264-0x0;var _0x561c72=_0x1802[_0x58f264];return _0x561c72;};'use strict';var _=require(_0x2180('0x0'));var moment=require(_0x2180('0x1'));var BPromise=require(_0x2180('0x2'));var md5=require(_0x2180('0x3'));var Redis=require(_0x2180('0x4'));var config=require(_0x2180('0x5'));var logger=require('../../../config/logger')(_0x2180('0x6'));config[_0x2180('0x7')]=_['defaults'](config[_0x2180('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x2180('0x8'))(new Redis(config[_0x2180('0x7')]));var EmailImap=require('./imap');var EmailSmtp=require('./smtp');var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x22b390){logger['info']('start\x20email\x20channel');this['mailAccounts']=_0x22b390['mailAccounts'];this['imapAccounts']={};this[_0x2180('0x9')]=new EmailSmtp();}EmailChannel[_0x2180('0xa')][_0x2180('0xb')]=function(_0x11904d){var _0x5d9efa=this[_0x2180('0xc')][_0x11904d];var _0x2a46d2={'id':_0x5d9efa['id'],'name':_0x5d9efa[_0x2180('0xd')],'key':_0x5d9efa[_0x2180('0xe')],'active':_0x5d9efa[_0x2180('0xf')],'Imap':{'status':_0x5d9efa[_0x2180('0x10')]['status'],'messageStatus':_0x5d9efa['Imap'][_0x2180('0x11')],'total':_0x5d9efa[_0x2180('0x10')][_0x2180('0x12')]}};if(_[_0x2180('0x13')](md5Accounts[_0x11904d])){md5Accounts[_0x11904d]={};}var _0x4c95ac=md5(JSON[_0x2180('0x14')](_0x2a46d2));if(md5Accounts[_0x11904d][_0x2180('0x3')]!==_0x4c95ac){md5Accounts[_0x11904d][_0x2180('0x3')]=_0x4c95ac;io[_0x2180('0xb')](_0x2180('0x15'),_0x2a46d2);}};EmailChannel['prototype']['refresh']=function(_0x15e497){for(var _0x359965 in _0x15e497){if(_0x15e497[_0x2180('0x16')](_0x359965)){if(_0x15e497[_0x359965][_0x2180('0x10')]&&_0x15e497[_0x359965][_0x2180('0xf')]){var _0x82aa4e=_0x15e497[_0x359965][_0x2180('0x10')];if(!_0x82aa4e[_0x2180('0x17')]&&_0x15e497[_0x359965][_0x2180('0x18')]!==_0x2180('0x19'))_0x82aa4e[_0x2180('0x17')]=_0x15e497[_0x359965][_0x2180('0x18')];if(!this['imapAccounts']['hasOwnProperty'](_0x82aa4e['id'])){this[_0x2180('0x1a')][_0x82aa4e['id']]=new EmailImap(_0x82aa4e,_0x15e497[_0x359965][_0x2180('0x6')]);this[_0x2180('0x1a')][_0x82aa4e['id']]['on'](_0x2180('0x1b'),this[_0x2180('0x1c')]['bind'](this,_0x359965));this[_0x2180('0x1a')][_0x82aa4e['id']]['on'](_0x2180('0x6'),this[_0x2180('0x1d')][_0x2180('0x1e')](this,_0x359965));this[_0x2180('0x1a')][_0x82aa4e['id']]['on'](_0x2180('0x1f'),this[_0x2180('0x20')][_0x2180('0x1e')](this,_0x359965));this[_0x2180('0x1a')][_0x82aa4e['id']]['on']('error',this[_0x2180('0x21')][_0x2180('0x1e')](this,_0x359965));}}else{if(_[_0x2180('0x13')](this[_0x2180('0xc')][_0x359965][_0x2180('0x10')])){this[_0x2180('0xc')][_0x359965][_0x2180('0x10')]={};}this[_0x2180('0xc')][_0x359965][_0x2180('0x10')][_0x2180('0x22')]='disabled';this['mailAccounts'][_0x359965][_0x2180('0x10')][_0x2180('0x11')]='';this['emit'](_0x359965);}}}};EmailChannel[_0x2180('0xa')][_0x2180('0x1c')]=function(_0x5a8d1e,_0x78e071){if(this['mailAccounts'][_0x5a8d1e]){this[_0x2180('0xc')][_0x5a8d1e][_0x2180('0x10')][_0x2180('0x22')]='connected';this[_0x2180('0xc')][_0x5a8d1e][_0x2180('0x10')]['messageStatus']=_0x78e071[_0x2180('0xd')];if(_0x78e071[_0x2180('0x23')]){this['mailAccounts'][_0x5a8d1e]['Imap']['total']=_0x78e071[_0x2180('0x23')]['total'];}return this[_0x2180('0xb')](_0x5a8d1e);}};EmailChannel[_0x2180('0xa')]['handleImapEmail']=function(_0x312abb,_0x22d24a){logger[_0x2180('0x24')](_0x2180('0x25'),_0x22d24a['firstName'],_0x22d24a[_0x2180('0x26')],_0x22d24a[_0x2180('0x27')],_0x312abb);if(this[_0x2180('0xc')][_0x312abb]){return mailAccount[_0x2180('0x28')](_0x312abb,_0x22d24a)['then'](function(_0x187d64){if(_0x187d64){logger[_0x2180('0x24')](_0x2180('0x29'));}})[_0x2180('0x2a')](function(_0x381d1b){logger[_0x2180('0x2b')](_0x2180('0x2c'),JSON[_0x2180('0x14')](_0x381d1b));});}};EmailChannel[_0x2180('0xa')][_0x2180('0x20')]=function(_0x38e96b){if(this[_0x2180('0xc')][_0x38e96b]&&this[_0x2180('0xc')][_0x38e96b][_0x2180('0x10')]){if(this['imapAccounts'][this['mailAccounts'][_0x38e96b][_0x2180('0x10')]['id']]){delete this[_0x2180('0x1a')][this[_0x2180('0xc')][_0x38e96b][_0x2180('0x10')]['id']];}this['mailAccounts'][_0x38e96b]['Imap'][_0x2180('0x2d')]=moment();this[_0x2180('0xb')](_0x38e96b);}};EmailChannel['prototype'][_0x2180('0x21')]=function(_0xcccf63,_0x26de34){if(this[_0x2180('0xc')][_0xcccf63]){this[_0x2180('0xc')][_0xcccf63][_0x2180('0x10')][_0x2180('0x22')]=_0x2180('0x2b');this['mailAccounts'][_0xcccf63][_0x2180('0x10')][_0x2180('0x11')]=_0x26de34;return this[_0x2180('0xb')](_0xcccf63);}};EmailChannel[_0x2180('0xa')][_0x2180('0x2e')]=function(_0x79e4bd,_0x5752d5){return this[_0x2180('0x9')][_0x2180('0x2f')](_0x79e4bd,_0x5752d5);};EmailChannel[_0x2180('0xa')][_0x2180('0x30')]=function(_0x14fc35){var _0x349541=this;if(this['mailAccounts'][_0x14fc35['id']]){if(_['isNil'](this[_0x2180('0xc')][_0x14fc35['id']][_0x2180('0x31')])){this['mailAccounts'][_0x14fc35['id']][_0x2180('0x31')]={};}this[_0x2180('0xc')][_0x14fc35['id']][_0x2180('0x31')][_0x2180('0x2d')]=moment();return new BPromise(function(_0x2be563,_0x1255d1){return _0x349541['smtp'][_0x2180('0x32')](_0x14fc35)['then'](function(_0x266090){_0x349541['mailAccounts'][_0x14fc35['id']][_0x2180('0x31')][_0x2180('0x22')]=_0x2180('0x33');_0x349541[_0x2180('0xc')][_0x14fc35['id']]['Smtp']['messageStatus']='';_0x349541[_0x2180('0xb')](_0x14fc35['id']);_0x2be563(_0x266090);})[_0x2180('0x2a')](function(_0x15b311){_0x349541[_0x2180('0xc')][_0x14fc35['id']][_0x2180('0x31')][_0x2180('0x22')]='error';_0x349541['mailAccounts'][_0x14fc35['id']][_0x2180('0x31')][_0x2180('0x11')]=_0x15b311;_0x349541[_0x2180('0xb')](_0x14fc35['id']);_0x1255d1(_0x15b311);});});}return this[_0x2180('0x9')]['verify'](_0x14fc35);};module[_0x2180('0x34')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 477a2e7..30f7aab 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 _0xe3bb=['connect','connTimeout','authTimeout','user','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','authentication','anonymous@xcally.com','host','port','tls','autotls','required','prototype','handleOpenBox','handleError','readUnseen','handleCloseBox','end','search','UNSEEN','handleReadUnseen','fetch','slice','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','handleMessageBody','attributes','handleMessageAttributes','handleSimpleParser','handleMessageEnd','parser','emit','stringify','textCode','hasOwnProperty','exports','lodash','util','mailparser','simpleParser','iconv','events','EventEmitter','email','mailbox','account','getAccount','imap','once','ready','handleReady','bind','handleEnd','error'];(function(_0x16eb11,_0x1a2251){var _0x3ae7ef=function(_0x575a01){while(--_0x575a01){_0x16eb11['push'](_0x16eb11['shift']());}};_0x3ae7ef(++_0x1a2251);}(_0xe3bb,0xa8));var _0xbe3b=function(_0x2f7338,_0xfa2367){_0x2f7338=_0x2f7338-0x0;var _0x2d1ced=_0xe3bb[_0x2f7338];return _0x2d1ced;};'use strict';var _=require(_0xbe3b('0x0'));var util=require(_0xbe3b('0x1'));var Imap=require('imap');var simpleParser=require(_0xbe3b('0x2'))[_0xbe3b('0x3')];var Iconv=require(_0xbe3b('0x4'))['Iconv'];var EventEmitter=require(_0xbe3b('0x5'))[_0xbe3b('0x6')];var utils=require('./utils');var logger=require('../../../config/logger')(_0xbe3b('0x7'));function EmailImap(_0x12556e,_0x32cd33){this[_0xbe3b('0x8')]=_0x12556e[_0xbe3b('0x8')];this[_0xbe3b('0x9')]=this[_0xbe3b('0xa')](_0x12556e,_0x32cd33);this[_0xbe3b('0xb')]=new Imap(this['account']);this[_0xbe3b('0xb')][_0xbe3b('0xc')](_0xbe3b('0xd'),this[_0xbe3b('0xe')][_0xbe3b('0xf')](this));this[_0xbe3b('0xb')][_0xbe3b('0xc')]('end',this[_0xbe3b('0x10')]['bind'](this));this[_0xbe3b('0xb')]['on'](_0xbe3b('0x11'),this['handleError'][_0xbe3b('0xf')](this));this[_0xbe3b('0xb')][_0xbe3b('0x12')]();}util['inherits'](EmailImap,EventEmitter);EmailImap['prototype'][_0xbe3b('0xa')]=function(_0x5c848b,_0x1d56a0){var _0x2194b7={'connTimeout':_0x5c848b[_0xbe3b('0x13')]?_0x5c848b['connTimeout']*0x3e8:0x2710,'authTimeout':_0x5c848b[_0xbe3b('0x14')]?_0x5c848b[_0xbe3b('0x14')]*0x3e8:0x1388};if(_0x5c848b['service']){_0x2194b7['user']=_0x5c848b[_0xbe3b('0x15')];if(_0x5c848b[_0xbe3b('0x16')]){_0x2194b7[_0xbe3b('0x17')]=utils[_0xbe3b('0x18')](_0x5c848b[_0xbe3b('0x19')][_0xbe3b('0x1a')],_0x5c848b[_0xbe3b('0x15')]);}else{_0x2194b7[_0xbe3b('0x1b')]=_0x5c848b[_0xbe3b('0x1b')];}}else{if(_0x5c848b[_0xbe3b('0x1c')]){_0x2194b7[_0xbe3b('0x15')]=_0x5c848b[_0xbe3b('0x15')];_0x2194b7[_0xbe3b('0x1b')]=_0x5c848b['password'];}}_0x2194b7[_0xbe3b('0x7')]=_0x1d56a0||_0x5c848b['user']||_0xbe3b('0x1d');_0x2194b7[_0xbe3b('0x1e')]=_0x5c848b[_0xbe3b('0x1e')];_0x2194b7['port']=_0x5c848b[_0xbe3b('0x1f')]||0x3e1;if(_0x5c848b[_0xbe3b('0x20')]){_0x2194b7[_0xbe3b('0x20')]=!![];}else{_0x2194b7[_0xbe3b('0x20')]=![];_0x2194b7[_0xbe3b('0x21')]=_0xbe3b('0x22');}return _0x2194b7;};EmailImap[_0xbe3b('0x23')][_0xbe3b('0xe')]=function(){this['imap']['openBox'](this[_0xbe3b('0x8')],![],this[_0xbe3b('0x24')]['bind'](this));};EmailImap[_0xbe3b('0x23')][_0xbe3b('0x24')]=function(_0x2bf640,_0x443857){if(_0x2bf640){this[_0xbe3b('0x25')](_0x2bf640,!![]);}else{this['emit']('box',_0x443857);this[_0xbe3b('0x26')]();}};EmailImap[_0xbe3b('0x23')][_0xbe3b('0x27')]=function(_0x1044dc){if(_0x1044dc){this[_0xbe3b('0x25')](_0x1044dc,!![]);}else{this[_0xbe3b('0xb')][_0xbe3b('0x28')]();}};EmailImap['prototype']['readUnseen']=function(){this[_0xbe3b('0xb')][_0xbe3b('0x29')]([_0xbe3b('0x2a')],this['handleReadUnseen'][_0xbe3b('0xf')](this));};EmailImap[_0xbe3b('0x23')][_0xbe3b('0x2b')]=function(_0x31bdce,_0x18d86e){if(_0x31bdce){this[_0xbe3b('0x25')](_0x31bdce,!![]);}else{if(_0x18d86e['length']){try{var _0x3c34bb=this[_0xbe3b('0xb')][_0xbe3b('0x2c')](_0x18d86e[_0xbe3b('0x2d')](0x0,0xa),{'bodies':'','markSeen':!![]});_0x3c34bb['on'](_0xbe3b('0x2e'),this[_0xbe3b('0x2f')][_0xbe3b('0xf')](this));_0x3c34bb[_0xbe3b('0xc')](_0xbe3b('0x11'),this[_0xbe3b('0x30')]['bind'](this));_0x3c34bb['once'](_0xbe3b('0x28'),this[_0xbe3b('0x31')][_0xbe3b('0xf')](this));}catch(_0x3e8d3d){logger[_0xbe3b('0x11')](_0x3e8d3d);}}else{this['imap'][_0xbe3b('0x32')](!![],this[_0xbe3b('0x27')][_0xbe3b('0xf')](this));}}};EmailImap[_0xbe3b('0x23')][_0xbe3b('0x2f')]=function(_0x3be98f){_0x3be98f['on']('body',this[_0xbe3b('0x33')]['bind'](this));_0x3be98f[_0xbe3b('0xc')](_0xbe3b('0x34'),this[_0xbe3b('0x35')][_0xbe3b('0xf')](this));_0x3be98f['once']('end',this['handleMessageEnd'][_0xbe3b('0xf')](this));};EmailImap[_0xbe3b('0x23')][_0xbe3b('0x33')]=function(_0x1245a0){simpleParser(_0x1245a0,{'Iconv':Iconv},this[_0xbe3b('0x36')][_0xbe3b('0xf')](this));};EmailImap['prototype'][_0xbe3b('0x35')]=function(){};EmailImap[_0xbe3b('0x23')][_0xbe3b('0x37')]=function(){};EmailImap[_0xbe3b('0x23')][_0xbe3b('0x36')]=function(_0x506917,_0x56c7ad){if(_0x506917){logger['error'](_0x506917);}else{var _0x340dd0=this;utils[_0xbe3b('0x38')](this[_0xbe3b('0x9')],_0x56c7ad,function(_0x435521){_0x340dd0[_0xbe3b('0x39')](_0xbe3b('0x7'),_0x435521);});}};EmailImap[_0xbe3b('0x23')][_0xbe3b('0x31')]=function(){this['imap'][_0xbe3b('0x32')](!![],this[_0xbe3b('0x27')][_0xbe3b('0xf')](this));};EmailImap[_0xbe3b('0x23')][_0xbe3b('0x30')]=function(_0x2836d8){this['handleError'](_0x2836d8);this[_0xbe3b('0xb')]['closeBox'](!![],this[_0xbe3b('0x27')][_0xbe3b('0xf')](this));};EmailImap[_0xbe3b('0x23')][_0xbe3b('0x10')]=function(){this[_0xbe3b('0x39')](_0xbe3b('0x28'));};EmailImap[_0xbe3b('0x23')][_0xbe3b('0x25')]=function(_0x34d74d,_0x3fa1bc){logger['error'](_0xbe3b('0x25'),this[_0xbe3b('0x9')][_0xbe3b('0x7')],JSON[_0xbe3b('0x3a')](_0x34d74d));var _0x250438='';if(_0x34d74d){if(_0x34d74d[_0xbe3b('0x3b')]){_0x250438=_0x34d74d[_0xbe3b('0x3b')];}else{for(var _0x257941 in _0x34d74d){if(_0x34d74d[_0xbe3b('0x3c')](_0x257941)){_0x250438+=_['upperFirst'](_0x257941)+':\x20'+_0x34d74d[_0x257941]+'\x0a';}}}}if(_0x3fa1bc){this[_0xbe3b('0xb')][_0xbe3b('0x28')]();}else{this[_0xbe3b('0x39')](_0xbe3b('0x11'),_0x250438);this[_0xbe3b('0x39')](_0xbe3b('0x28'));}};module[_0xbe3b('0x3d')]=EmailImap; \ No newline at end of file +var _0x81a0=['emailMaxHTMLbytesLimit','mailbox','account','getAccount','once','bind','error','handleError','connect','inherits','prototype','connTimeout','authTimeout','user','generateXOAuth2Token','CloudProvider','data5','password','anonymous@xcally.com','host','tls','autotls','required','handleReady','openBox','handleOpenBox','emit','box','readUnseen','handleCloseBox','end','search','UNSEEN','handleReadUnseen','message','handleFetchMessage','closeBox','body','handleMessageBody','handleMessageAttributes','handleMessageEnd','length','parser','warn','Email\x20text\x20truncated,\x20max\x20HTML\x20size\x20','\x20bytes,\x20email\x20size:\x20','\x20bytes','text','substring','html','handleFetchEnd','handleFetchError','stringify','textCode','hasOwnProperty','upperFirst','lodash','util','imap','mailparser','simpleParser','iconv','Iconv','EventEmitter','./utils','../../../config/logger','email','../../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x81a0,0x104));var _0x081a=function(_0x52b703,_0x5d7154){_0x52b703=_0x52b703-0x0;var _0x2608fa=_0x81a0[_0x52b703];return _0x2608fa;};'use strict';var _=require(_0x081a('0x0'));var util=require(_0x081a('0x1'));var Imap=require(_0x081a('0x2'));var simpleParser=require(_0x081a('0x3'))[_0x081a('0x4')];var Iconv=require(_0x081a('0x5'))[_0x081a('0x6')];var EventEmitter=require('events')[_0x081a('0x7')];var utils=require(_0x081a('0x8'));var logger=require(_0x081a('0x9'))(_0x081a('0xa'));var config=require(_0x081a('0xb'));const MAX_HTML_BYTES_SIZE=config[_0x081a('0xc')]||0xee6b2800;function EmailImap(_0x264298,_0x333d4a){this[_0x081a('0xd')]=_0x264298[_0x081a('0xd')];this[_0x081a('0xe')]=this[_0x081a('0xf')](_0x264298,_0x333d4a);this[_0x081a('0x2')]=new Imap(this[_0x081a('0xe')]);this[_0x081a('0x2')][_0x081a('0x10')]('ready',this['handleReady'][_0x081a('0x11')](this));this[_0x081a('0x2')][_0x081a('0x10')]('end',this['handleEnd'][_0x081a('0x11')](this));this[_0x081a('0x2')]['on'](_0x081a('0x12'),this[_0x081a('0x13')][_0x081a('0x11')](this));this[_0x081a('0x2')][_0x081a('0x14')]();}util[_0x081a('0x15')](EmailImap,EventEmitter);EmailImap[_0x081a('0x16')]['getAccount']=function(_0x2e967f,_0xd6a294){var _0x490ed2={'connTimeout':_0x2e967f[_0x081a('0x17')]?_0x2e967f['connTimeout']*0x3e8:0x2710,'authTimeout':_0x2e967f[_0x081a('0x18')]?_0x2e967f[_0x081a('0x18')]*0x3e8:0x1388};if(_0x2e967f['service']){_0x490ed2[_0x081a('0x19')]=_0x2e967f[_0x081a('0x19')];if(_0x2e967f['modernAuthentication']){_0x490ed2['xoauth2']=utils[_0x081a('0x1a')](_0x2e967f[_0x081a('0x1b')][_0x081a('0x1c')],_0x2e967f[_0x081a('0x19')]);}else{_0x490ed2[_0x081a('0x1d')]=_0x2e967f[_0x081a('0x1d')];}}else{if(_0x2e967f['authentication']){_0x490ed2['user']=_0x2e967f['user'];_0x490ed2[_0x081a('0x1d')]=_0x2e967f[_0x081a('0x1d')];}}_0x490ed2[_0x081a('0xa')]=_0xd6a294||_0x2e967f[_0x081a('0x19')]||_0x081a('0x1e');_0x490ed2['host']=_0x2e967f[_0x081a('0x1f')];_0x490ed2['port']=_0x2e967f['port']||0x3e1;if(_0x2e967f[_0x081a('0x20')]){_0x490ed2[_0x081a('0x20')]=!![];}else{_0x490ed2[_0x081a('0x20')]=![];_0x490ed2[_0x081a('0x21')]=_0x081a('0x22');}return _0x490ed2;};EmailImap[_0x081a('0x16')][_0x081a('0x23')]=function(){this[_0x081a('0x2')][_0x081a('0x24')](this['mailbox'],![],this[_0x081a('0x25')][_0x081a('0x11')](this));};EmailImap['prototype']['handleOpenBox']=function(_0x4524d4,_0x2bbf7c){if(_0x4524d4){this[_0x081a('0x13')](_0x4524d4,!![]);}else{this[_0x081a('0x26')](_0x081a('0x27'),_0x2bbf7c);this[_0x081a('0x28')]();}};EmailImap[_0x081a('0x16')][_0x081a('0x29')]=function(_0x57c8ec){if(_0x57c8ec){this[_0x081a('0x13')](_0x57c8ec,!![]);}else{this['imap'][_0x081a('0x2a')]();}};EmailImap['prototype']['readUnseen']=function(){this['imap'][_0x081a('0x2b')]([_0x081a('0x2c')],this[_0x081a('0x2d')]['bind'](this));};EmailImap[_0x081a('0x16')][_0x081a('0x2d')]=function(_0x5876af,_0x3cfebf){if(_0x5876af){this[_0x081a('0x13')](_0x5876af,!![]);}else{if(_0x3cfebf['length']){try{var _0x33f1ab=this[_0x081a('0x2')]['fetch'](_0x3cfebf['slice'](0x0,0xa),{'bodies':'','markSeen':!![]});_0x33f1ab['on'](_0x081a('0x2e'),this[_0x081a('0x2f')][_0x081a('0x11')](this));_0x33f1ab[_0x081a('0x10')](_0x081a('0x12'),this['handleFetchError'][_0x081a('0x11')](this));_0x33f1ab[_0x081a('0x10')](_0x081a('0x2a'),this['handleFetchEnd'][_0x081a('0x11')](this));}catch(_0xd6d073){logger[_0x081a('0x12')](_0xd6d073);}}else{this['imap'][_0x081a('0x30')](!![],this['handleCloseBox']['bind'](this));}}};EmailImap[_0x081a('0x16')][_0x081a('0x2f')]=function(_0x18b34f){_0x18b34f['on'](_0x081a('0x31'),this[_0x081a('0x32')][_0x081a('0x11')](this));_0x18b34f['once']('attributes',this[_0x081a('0x33')][_0x081a('0x11')](this));_0x18b34f['once']('end',this[_0x081a('0x34')][_0x081a('0x11')](this));};EmailImap['prototype'][_0x081a('0x32')]=function(_0x1ec116){simpleParser(_0x1ec116,{'Iconv':Iconv},this['handleSimpleParser']['bind'](this));};EmailImap['prototype'][_0x081a('0x33')]=function(){};EmailImap[_0x081a('0x16')]['handleMessageEnd']=function(){};EmailImap[_0x081a('0x16')]['handleSimpleParser']=function(_0x29067b,_0x42d20f){if(_0x29067b){logger[_0x081a('0x12')](_0x29067b);}else{var _0x4c3ec8=this;const _0x5db357=_0x42d20f['html'][_0x081a('0x35')];if(_0x5db357\x20[Attachment:\x20','\x20]','body','textAsHtml','Empty\x20message

','Attachments','generateXOAuth2Token','user=','utf-8','toString','base64','lodash','moment','randomstring','../../../config/logger','email','../../../config/environment','head','value'];(function(_0x31ba34,_0x485bc1){var _0x35799b=function(_0x5c66cd){while(--_0x5c66cd){_0x31ba34['push'](_0x31ba34['shift']());}};_0x35799b(++_0x485bc1);}(_0xbcff,0x160));var _0xfbcf=function(_0x1f19c3,_0x441fc4){_0x1f19c3=_0x1f19c3-0x0;var _0x1465f5=_0xbcff[_0x1f19c3];return _0x1465f5;};'use strict';var _=require(_0xfbcf('0x0'));var moment=require(_0xfbcf('0x1'));var random=require(_0xfbcf('0x2'));var fs=require('fs');var path=require('path');var util=require('util');var tnef=require('node-tnef');var logger=require(_0xfbcf('0x3'))(_0xfbcf('0x4'));var config=require(_0xfbcf('0x5'));function getAddress(_0x290194){var _0x119c0b=_[_0xfbcf('0x6')](_0x290194[_0xfbcf('0x7')]);return _0x119c0b&&_0x119c0b[_0xfbcf('0x8')]?_0x119c0b[_0xfbcf('0x8')]:_0xfbcf('0x9')+random[_0xfbcf('0xa')](0x6)+'@xcally.com';}function getFirstName(_0x44a805){var _0x45f334=_[_0xfbcf('0x6')](_0x44a805[_0xfbcf('0x7')]);if(_0x45f334&&_0x45f334[_0xfbcf('0xb')]){if(_0x45f334['name']==_0x45f334[_0xfbcf('0x8')]){return _0x45f334[_0xfbcf('0xb')][_0xfbcf('0xc')](0x0,_0x45f334[_0xfbcf('0xb')]['indexOf']('@'));}var _0x402660=_0x45f334[_0xfbcf('0xb')][_0xfbcf('0xd')](/\s+/);return _0x402660[_0xfbcf('0xe')]>0x1?_0x402660[_0xfbcf('0xf')](0x0,-0x1)[_0xfbcf('0x10')]('\x20'):_0x45f334['name'];}return _0xfbcf('0x11');}function getLastName(_0x1d7770){var _0x62e67c=_[_0xfbcf('0x6')](_0x1d7770[_0xfbcf('0x7')]);if(_0x62e67c&&_0x62e67c[_0xfbcf('0xb')]){var _0x5e8f90=_0x62e67c[_0xfbcf('0xb')][_0xfbcf('0xd')](/\s+/);return _0x5e8f90['length']>0x1?_0x5e8f90[_0xfbcf('0x12')]():'';}return'';}function getMails(_0x21c196,_0xd5976f){var _0x1c40b8='';for(var _0x2ba993=0x0;_0x2ba993<_0xd5976f[_0xfbcf('0x7')]['length'];_0x2ba993+=0x1){if(_0xd5976f['value'][_0x2ba993][_0xfbcf('0x8')]!==_0x21c196){if(!_[_0xfbcf('0x13')](_0x1c40b8)){_0x1c40b8+=',';}_0x1c40b8+=_0xd5976f[_0xfbcf('0x7')][_0x2ba993][_0xfbcf('0xb')]||_0xd5976f[_0xfbcf('0x7')][_0x2ba993][_0xfbcf('0x8')]||'';_0x1c40b8+='\x20<';_0x1c40b8+=_0xd5976f[_0xfbcf('0x7')][_0x2ba993][_0xfbcf('0x8')]?_0xd5976f[_0xfbcf('0x7')][_0x2ba993][_0xfbcf('0x8')]:_0xfbcf('0x9')+random[_0xfbcf('0xa')](0x6)+_0xfbcf('0x14');_0x1c40b8+='>';}}return _0x1c40b8;}function parseEmail(_0x310372,_0x128a8d,_0x5ba3ed){if(_0x128a8d[_0xfbcf('0x15')]){var _0x2e9c93=/)<[^<]*)*<\/script>/gi;while(_0x2e9c93[_0xfbcf('0x16')](_0x128a8d[_0xfbcf('0x15')])){_0x128a8d[_0xfbcf('0x15')]=_0x128a8d[_0xfbcf('0x15')]['replace'](_0x2e9c93,'');}if(_0x128a8d['html'][_0xfbcf('0x17')](_0xfbcf('0x18'))){var _0x566c22=[];_0x128a8d[_0xfbcf('0x19')][_0xfbcf('0x1a')](_0x34bc77=>{_0x566c22[_0xfbcf('0x1b')](_0x34bc77[_0xfbcf('0x1c')]);});var _0x4c4c20=/]+>/g;var _0x1eb697=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x519150=_0x128a8d['html'][_0xfbcf('0x1d')](_0x1eb697,_0xfbcf('0x1e'));var _0x459d75=_0x519150[_0xfbcf('0x1d')](_0x4c4c20,_0xfbcf('0x1f'));for(let _0x504593=0x0;_0x504593<_0x566c22[_0xfbcf('0xe')];_0x504593++){var _0x2e37e9=_0x459d75[_0xfbcf('0x1d')]('_IMG',_0xfbcf('0x20')+_0x566c22[_0x504593]+_0xfbcf('0x21'));_0x459d75=_0x2e37e9;}_0x128a8d['html']=_0x459d75;}_0x5ba3ed[_0xfbcf('0x22')]=_0x128a8d[_0xfbcf('0x15')];}else{_0x5ba3ed[_0xfbcf('0x22')]=_0x128a8d[_0xfbcf('0x23')];}if(_0x5ba3ed['body']){_0x5ba3ed[_0xfbcf('0x22')]=_0x5ba3ed[_0xfbcf('0x22')][_0xfbcf('0x1d')](/0x0){var _0x50fa2f=[_0xfbcf('0x30'),_0xfbcf('0x31'),_0xfbcf('0x32')];for(var _0x5b9174=0x0;_0x5b9174<_0x128a8d[_0xfbcf('0x2f')][_0xfbcf('0xe')];_0x5b9174++){var _0x2f554b=_[_0xfbcf('0x33')](_0x50fa2f,_0x128a8d[_0xfbcf('0x2f')][_0x5b9174][_0xfbcf('0x34')]);if(_0x2f554b>=0x0){_0x5ba3ed['isAutoreply']=!![];}}}return _0x5ba3ed;}exports['parser']=function(_0x4ffc29,_0x1b2780,_0x2e7108){var _0x438db8={'from':getAddress(_0x1b2780['from']),'firstName':getFirstName(_0x1b2780[_0xfbcf('0x35')]),'lastName':getLastName(_0x1b2780['from']),'mapKey':_0xfbcf('0x4'),'message':{'from':getMails(_0x4ffc29[_0xfbcf('0x4')],_0x1b2780['from']),'to':_0x4ffc29[_0xfbcf('0x4')],'cc':'','subject':_0x1b2780['subject']||'','messageId':_0x1b2780[_0xfbcf('0x36')],'inReplyTo':_0x1b2780[_0xfbcf('0x37')],'sentAt':moment(_0x1b2780[_0xfbcf('0x38')])[_0xfbcf('0x2a')](_0xfbcf('0x39')),'attach':![],'attachments':[]}};if(!_0x1b2780[_0xfbcf('0x15')]&&!_0x1b2780[_0xfbcf('0x23')]){var _0x145d26=_[_0xfbcf('0x3a')](_0x1b2780[_0xfbcf('0x19')],{'contentType':_0xfbcf('0x3b')});if(_0x145d26[_0xfbcf('0xe')]){logger[_0xfbcf('0x3c')](util[_0xfbcf('0x2a')](_0xfbcf('0x3d'),_0x1b2780[_0xfbcf('0x36')]));tnef[_0xfbcf('0x3e')](_['first'](_0x145d26)[_0xfbcf('0x3f')],function(_0x5f0f8a,_0xd2a170){if(_0xd2a170){_0x1b2780['html']=_0xd2a170[_0xfbcf('0x40')]||_0xfbcf('0x41');if(_0xd2a170[_0xfbcf('0x42')]){for(var _0x15bacd=0x0;_0x15bacd<_0xd2a170[_0xfbcf('0x42')][_0xfbcf('0xe')];_0x15bacd++){var _0x396d86=_0xd2a170['Attachments'][_0x15bacd];_0x438db8['message'][_0xfbcf('0x19')][_0xfbcf('0x1b')]({'filename':_0x396d86['Title'],'content':Buffer[_0xfbcf('0x35')](_0x396d86['Data'])});}}}_0x2e7108(parseEmail(_0x4ffc29,_0x1b2780,_0x438db8));});}else{_0x1b2780[_0xfbcf('0x15')]=_0xfbcf('0x41');_0x2e7108(parseEmail(_0x4ffc29,_0x1b2780,_0x438db8));}}else{_0x2e7108(parseEmail(_0x4ffc29,_0x1b2780,_0x438db8));}};exports[_0xfbcf('0x43')]=function(_0x5b4a07,_0x1a606c){var _0x3d9288=[_0xfbcf('0x44')+(_0x1a606c||''),'auth=Bearer\x20'+_0x5b4a07,'',''];return Buffer['from'](_0x3d9288[_0xfbcf('0x10')](''),_0xfbcf('0x45'))[_0xfbcf('0x46')](_0xfbcf('0x47'));}; \ No newline at end of file +var _0x918a=['base64','lodash','moment','randomstring','path','util','node-tnef','email','../../../config/environment','head','address','anonymous','generate','@xcally.com','value','name','split','length','slice','pop','test','html','replace','includes','\x20[Attachment:\x20','body','textAsHtml','Empty\x20message

','Attachments','Title','Data','generateXOAuth2Token','auth=Bearer\x20','utf-8','toString'];(function(_0x16fbd2,_0x2661ec){var _0x2e513b=function(_0x2a898a){while(--_0x2a898a){_0x16fbd2['push'](_0x16fbd2['shift']());}};_0x2e513b(++_0x2661ec);}(_0x918a,0xdc));var _0xa918=function(_0x1ddfe3,_0x5e50e5){_0x1ddfe3=_0x1ddfe3-0x0;var _0x708a39=_0x918a[_0x1ddfe3];return _0x708a39;};'use strict';var _=require(_0xa918('0x0'));var moment=require(_0xa918('0x1'));var random=require(_0xa918('0x2'));var fs=require('fs');var path=require(_0xa918('0x3'));var util=require(_0xa918('0x4'));var tnef=require(_0xa918('0x5'));var logger=require('../../../config/logger')(_0xa918('0x6'));var config=require(_0xa918('0x7'));function getAddress(_0x2c260b){var _0x4908b7=_[_0xa918('0x8')](_0x2c260b['value']);return _0x4908b7&&_0x4908b7[_0xa918('0x9')]?_0x4908b7['address']:_0xa918('0xa')+random[_0xa918('0xb')](0x6)+_0xa918('0xc');}function getFirstName(_0x3d2139){var _0x81c92a=_[_0xa918('0x8')](_0x3d2139[_0xa918('0xd')]);if(_0x81c92a&&_0x81c92a[_0xa918('0xe')]){if(_0x81c92a[_0xa918('0xe')]==_0x81c92a[_0xa918('0x9')]){return _0x81c92a[_0xa918('0xe')]['substring'](0x0,_0x81c92a[_0xa918('0xe')]['indexOf']('@'));}var _0x4740bd=_0x81c92a[_0xa918('0xe')][_0xa918('0xf')](/\s+/);return _0x4740bd[_0xa918('0x10')]>0x1?_0x4740bd[_0xa918('0x11')](0x0,-0x1)['join']('\x20'):_0x81c92a[_0xa918('0xe')];}return'Anonymous';}function getLastName(_0x322d6f){var _0x12f301=_[_0xa918('0x8')](_0x322d6f[_0xa918('0xd')]);if(_0x12f301&&_0x12f301[_0xa918('0xe')]){var _0xb7f3fa=_0x12f301[_0xa918('0xe')][_0xa918('0xf')](/\s+/);return _0xb7f3fa[_0xa918('0x10')]>0x1?_0xb7f3fa[_0xa918('0x12')]():'';}return'';}function getMails(_0x58fbc7,_0x321d71){var _0x463c0a='';for(var _0x36f8e6=0x0;_0x36f8e6<_0x321d71[_0xa918('0xd')][_0xa918('0x10')];_0x36f8e6+=0x1){if(_0x321d71['value'][_0x36f8e6][_0xa918('0x9')]!==_0x58fbc7){if(!_['isEmpty'](_0x463c0a)){_0x463c0a+=',';}_0x463c0a+=_0x321d71[_0xa918('0xd')][_0x36f8e6][_0xa918('0xe')]||_0x321d71['value'][_0x36f8e6][_0xa918('0x9')]||'';_0x463c0a+='\x20<';_0x463c0a+=_0x321d71['value'][_0x36f8e6][_0xa918('0x9')]?_0x321d71[_0xa918('0xd')][_0x36f8e6]['address']:_0xa918('0xa')+random[_0xa918('0xb')](0x6)+_0xa918('0xc');_0x463c0a+='>';}}return _0x463c0a;}function parseEmail(_0x29f9c7,_0x4198a7,_0x1aef17){if(_0x4198a7['html']){var _0x6ad525=/)<[^<]*)*<\/script>/gi;while(_0x6ad525[_0xa918('0x13')](_0x4198a7['html'])){_0x4198a7[_0xa918('0x14')]=_0x4198a7[_0xa918('0x14')][_0xa918('0x15')](_0x6ad525,'');}if(_0x4198a7[_0xa918('0x14')][_0xa918('0x16')](_0xa918('0x17'))){var _0x44452d=[];_0x4198a7['attachments'][_0xa918('0x18')](_0x100dba=>{_0x44452d[_0xa918('0x19')](_0x100dba[_0xa918('0x1a')]);});var _0x353a1a=/]+>/g;var _0x4a9320=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x421698=_0x4198a7[_0xa918('0x14')][_0xa918('0x15')](_0x4a9320,_0xa918('0x1b'));var _0x104423=_0x421698[_0xa918('0x15')](_0x353a1a,_0xa918('0x1c'));for(let _0x3a6a4b=0x0;_0x3a6a4b<_0x44452d[_0xa918('0x10')];_0x3a6a4b++){var _0x7ba086=_0x104423[_0xa918('0x15')](_0xa918('0x1c'),_0xa918('0x1d')+_0x44452d[_0x3a6a4b]+'\x20]');_0x104423=_0x7ba086;}_0x4198a7['html']=_0x104423;}_0x1aef17[_0xa918('0x1e')]=_0x4198a7[_0xa918('0x14')];}else{_0x1aef17[_0xa918('0x1e')]=_0x4198a7[_0xa918('0x1f')];}if(_0x1aef17[_0xa918('0x1e')]){_0x1aef17['body']=_0x1aef17[_0xa918('0x1e')][_0xa918('0x15')](/0x0){var _0x336b77=[_0xa918('0x32'),_0xa918('0x33'),_0xa918('0x34')];for(var _0x2f2434=0x0;_0x2f2434<_0x4198a7[_0xa918('0x31')]['length'];_0x2f2434++){var _0x19e7e9=_[_0xa918('0x35')](_0x336b77,_0x4198a7['headerLines'][_0x2f2434]['line']);if(_0x19e7e9>=0x0){_0x1aef17['isAutoreply']=!![];}}}return _0x1aef17;}exports[_0xa918('0x36')]=function(_0x46303b,_0x390bc8,_0x4b1a3f){var _0x5b4597={'from':getAddress(_0x390bc8['from']),'firstName':getFirstName(_0x390bc8['from']),'lastName':getLastName(_0x390bc8[_0xa918('0x37')]),'mapKey':_0xa918('0x6'),'message':{'from':getMails(_0x46303b[_0xa918('0x6')],_0x390bc8[_0xa918('0x37')]),'to':_0x46303b[_0xa918('0x6')],'cc':'','subject':_0x390bc8[_0xa918('0x38')]||'','messageId':_0x390bc8[_0xa918('0x39')],'inReplyTo':_0x390bc8[_0xa918('0x3a')],'sentAt':moment(_0x390bc8['date'])['format']('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x390bc8['html']&&!_0x390bc8['textAsHtml']){var _0x35cf7d=_[_0xa918('0x3b')](_0x390bc8[_0xa918('0x26')],{'contentType':_0xa918('0x3c')});if(_0x35cf7d['length']){logger[_0xa918('0x3d')](util[_0xa918('0x29')](_0xa918('0x3e'),_0x390bc8[_0xa918('0x39')]));tnef[_0xa918('0x3f')](_['first'](_0x35cf7d)['content'],function(_0x16a156,_0x135f6c){if(_0x135f6c){_0x390bc8[_0xa918('0x14')]=_0x135f6c['BodyHTML']||_0xa918('0x40');if(_0x135f6c[_0xa918('0x41')]){for(var _0xcbad85=0x0;_0xcbad85<_0x135f6c[_0xa918('0x41')][_0xa918('0x10')];_0xcbad85++){var _0x3cb8a3=_0x135f6c[_0xa918('0x41')][_0xcbad85];_0x5b4597[_0xa918('0x21')][_0xa918('0x26')]['push']({'filename':_0x3cb8a3[_0xa918('0x42')],'content':Buffer[_0xa918('0x37')](_0x3cb8a3[_0xa918('0x43')])});}}}_0x4b1a3f(parseEmail(_0x46303b,_0x390bc8,_0x5b4597));});}else{_0x390bc8[_0xa918('0x14')]=_0xa918('0x40');_0x4b1a3f(parseEmail(_0x46303b,_0x390bc8,_0x5b4597));}}else{_0x4b1a3f(parseEmail(_0x46303b,_0x390bc8,_0x5b4597));}};exports[_0xa918('0x44')]=function(_0x570090,_0x255961){var _0x54fa25=['user='+(_0x255961||''),_0xa918('0x45')+_0x570090,'',''];return Buffer[_0xa918('0x37')](_0x54fa25[_0xa918('0x2c')](''),_0xa918('0x46'))[_0xa918('0x47')](_0xa918('0x48'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index af5c204..e98db2e 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 _0xb42e=['Service','key','active','Imap','Smtp','exports','lodash'];(function(_0x52e040,_0x583d2f){var _0x4cd278=function(_0xa844b5){while(--_0xa844b5){_0x52e040['push'](_0x52e040['shift']());}};_0x4cd278(++_0x583d2f);}(_0xb42e,0x110));var _0xeb42=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xb42e[_0x36eaaa];return _0x461349;};'use strict';var _=require(_0xeb42('0x0'));function MailAccount(_0xbf2b65){this['id']=_0xbf2b65['id']||0x0;this['name']=_0xbf2b65['name']||_0xeb42('0x1');this['key']=_0xbf2b65[_0xeb42('0x2')]||'SERV';this[_0xeb42('0x3')]=_0xbf2b65[_0xeb42('0x3')]||![];this[_0xeb42('0x4')]=_0xbf2b65[_0xeb42('0x4')]||[];this[_0xeb42('0x5')]=_0xbf2b65['Smtp']||[];}module[_0xeb42('0x6')]=MailAccount; \ No newline at end of file +var _0xa12f=['exports','lodash','name','Service','key','SERV','active','Imap','Smtp'];(function(_0x5c0232,_0x1c449f){var _0x589366=function(_0x31cd62){while(--_0x31cd62){_0x5c0232['push'](_0x5c0232['shift']());}};_0x589366(++_0x1c449f);}(_0xa12f,0x121));var _0xfa12=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xa12f[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0xfa12('0x0'));function MailAccount(_0x571fd0){this['id']=_0x571fd0['id']||0x0;this[_0xfa12('0x1')]=_0x571fd0[_0xfa12('0x1')]||_0xfa12('0x2');this[_0xfa12('0x3')]=_0x571fd0['key']||_0xfa12('0x4');this[_0xfa12('0x5')]=_0x571fd0['active']||![];this[_0xfa12('0x6')]=_0x571fd0[_0xfa12('0x6')]||[];this[_0xfa12('0x7')]=_0x571fd0[_0xfa12('0x7')]||[];}module[_0xfa12('0x8')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 647842d..3f5b16b 100644 --- a/server/services/email/realtime/index.js +++ b/server/services/email/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb776=['../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','length','isUndefined','merge','lodash'];(function(_0x189305,_0x46c43f){var _0xea3406=function(_0x2aa435){while(--_0x2aa435){_0x189305['push'](_0x189305['shift']());}};_0xea3406(++_0x46c43f);}(_0xb776,0xaf));var _0x6b77=function(_0x4646a3,_0x1aff7f){_0x4646a3=_0x4646a3-0x0;var _0x12208b=_0xb776[_0x4646a3];return _0x12208b;};'use strict';var _=require(_0x6b77('0x0'));var MailAccount=require(_0x6b77('0x1'));var Realtime=function(){this[_0x6b77('0x2')]={};};function freeIsNotKey(_0x59d56d,_0x12d51b,_0x3897a7){var _0x12735b=_[_0x6b77('0x3')](_0x59d56d,function(_0x39df45,_0x41e0f5){return _0x39df45[_0x3897a7];});for(var _0xe9504c in _0x12d51b){if(_0x12d51b[_0x6b77('0x4')](_0xe9504c)){if(!_0x12735b[_0xe9504c]){delete _0x12d51b[_0xe9504c];}}}}Realtime[_0x6b77('0x5')][_0x6b77('0x6')]=function(_0x2b4ce4,_0x1e680a){for(var _0x5bc9f2 in _0x1e680a){if(_0x2b4ce4['hasOwnProperty'](_0x5bc9f2)){_0x2b4ce4[_0x5bc9f2]=_0x1e680a[_0x5bc9f2];}}};Realtime[_0x6b77('0x5')][_0x6b77('0x7')]=function(){var _0x2751a3=this;return function(_0x9f23e2){if(_0x9f23e2){freeIsNotKey(_0x9f23e2,_0x2751a3['mailAccounts'],'id');for(var _0x4e4198=0x0,_0x91a70b={},_0x2a82ea={};_0x4e4198<_0x9f23e2[_0x6b77('0x8')];_0x4e4198+=0x1){_0x91a70b=_0x9f23e2[_0x4e4198];if(_[_0x6b77('0x9')](_0x2751a3[_0x6b77('0x2')][_0x91a70b['id']])){_0x2751a3['mailAccounts'][_0x91a70b['id']]=new MailAccount(_0x91a70b);}else{_[_0x6b77('0xa')](_0x2751a3[_0x6b77('0x2')][_0x91a70b['id']],_0x91a70b);}}}return _0x2751a3[_0x6b77('0x2')];};};module['exports']=Realtime; \ No newline at end of file +var _0x5efd=['../model/mailAccount','mailAccounts','hasOwnProperty','prototype','initMailAccounts','length','merge','lodash'];(function(_0x336b4e,_0x377680){var _0x1716ae=function(_0x46d67c){while(--_0x46d67c){_0x336b4e['push'](_0x336b4e['shift']());}};_0x1716ae(++_0x377680);}(_0x5efd,0xf7));var _0xd5ef=function(_0x493673,_0x414f6c){_0x493673=_0x493673-0x0;var _0x5dde55=_0x5efd[_0x493673];return _0x5dde55;};'use strict';var _=require(_0xd5ef('0x0'));var MailAccount=require(_0xd5ef('0x1'));var Realtime=function(){this[_0xd5ef('0x2')]={};};function freeIsNotKey(_0x597579,_0x48817d,_0x375ae6){var _0x4900bc=_['mapKeys'](_0x597579,function(_0x512948,_0x503592){return _0x512948[_0x375ae6];});for(var _0x3a9ff6 in _0x48817d){if(_0x48817d[_0xd5ef('0x3')](_0x3a9ff6)){if(!_0x4900bc[_0x3a9ff6]){delete _0x48817d[_0x3a9ff6];}}}}Realtime[_0xd5ef('0x4')]['mergeFromDatabase']=function(_0x4c5a1f,_0x4823e6){for(var _0x557152 in _0x4823e6){if(_0x4c5a1f[_0xd5ef('0x3')](_0x557152)){_0x4c5a1f[_0x557152]=_0x4823e6[_0x557152];}}};Realtime[_0xd5ef('0x4')][_0xd5ef('0x5')]=function(){var _0x339e2d=this;return function(_0x2034c1){if(_0x2034c1){freeIsNotKey(_0x2034c1,_0x339e2d[_0xd5ef('0x2')],'id');for(var _0x2b9c91=0x0,_0x14d058={},_0x1237fe={};_0x2b9c91<_0x2034c1[_0xd5ef('0x6')];_0x2b9c91+=0x1){_0x14d058=_0x2034c1[_0x2b9c91];if(_['isUndefined'](_0x339e2d[_0xd5ef('0x2')][_0x14d058['id']])){_0x339e2d[_0xd5ef('0x2')][_0x14d058['id']]=new MailAccount(_0x14d058);}else{_[_0xd5ef('0x7')](_0x339e2d[_0xd5ef('0x2')][_0x14d058['id']],_0x14d058);}}}return _0x339e2d['mailAccounts'];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 7c97bee..d0442ac 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 _0xa93a=['CloudProvider','getMailAccount','notify','NotifyMailAccount','Request','provider','email','key','ListId','TemplateId','MailServerIn','Imap','name','service','data5','MailServerOut','Smtp','type'];(function(_0x1effde,_0xd0676){var _0x297b14=function(_0x11cca0){while(--_0x11cca0){_0x1effde['push'](_0x1effde['shift']());}};_0x297b14(++_0xd0676);}(_0xa93a,0xb8));var _0xaa93=function(_0x2c88b3,_0x39f0bf){_0x2c88b3=_0x2c88b3-0x0;var _0x1b7f49=_0xa93a[_0x2c88b3];return _0x1b7f49;};'use strict';var client=require('../client');exports['getMailAccounts']=function(){return function(){return client[_0xaa93('0x0')]('GetMailAccount',{'options':{'attributes':['id','name',_0xaa93('0x1'),'service',_0xaa93('0x2'),'active',_0xaa93('0x3'),_0xaa93('0x4'),_0xaa93('0x5')],'raw':![],'include':[{'model':_0xaa93('0x6'),'as':_0xaa93('0x7'),'include':[{'model':'CloudProvider','attributes':['id',_0xaa93('0x8'),_0xaa93('0x9'),'type',_0xaa93('0xa')],'as':'CloudProvider'}]},{'model':_0xaa93('0xb'),'as':_0xaa93('0xc'),'include':[{'model':'CloudProvider','attributes':['id','name','service',_0xaa93('0xd'),'data5'],'as':_0xaa93('0xe')}]}]},'log':_0xaa93('0xf')});};};exports[_0xaa93('0x10')]=function(_0x4ded52,_0x5e72fe){return client[_0xaa93('0x0')]('NotifyMailAccount',{'account':{'id':_0x4ded52},'body':_0x5e72fe,'log':_0xaa93('0x11')});}; \ No newline at end of file +var _0x2f3d=['Request','GetMailAccount','name','provider','active','key','ListId','MailServerIn','Imap','CloudProvider','service','type','data5','MailServerOut','Smtp','NotifyMailAccount','getMailAccounts'];(function(_0x4599d7,_0x3fa5d1){var _0x5c89d3=function(_0x4577d1){while(--_0x4577d1){_0x4599d7['push'](_0x4599d7['shift']());}};_0x5c89d3(++_0x3fa5d1);}(_0x2f3d,0x1a8));var _0xd2f3=function(_0x288adc,_0x46f0ce){_0x288adc=_0x288adc-0x0;var _0x5a690a=_0x2f3d[_0x288adc];return _0x5a690a;};'use strict';var client=require('../client');exports[_0xd2f3('0x0')]=function(){return function(){return client[_0xd2f3('0x1')](_0xd2f3('0x2'),{'options':{'attributes':['id',_0xd2f3('0x3'),_0xd2f3('0x4'),'service','email',_0xd2f3('0x5'),_0xd2f3('0x6'),_0xd2f3('0x7'),'TemplateId'],'raw':![],'include':[{'model':_0xd2f3('0x8'),'as':_0xd2f3('0x9'),'include':[{'model':_0xd2f3('0xa'),'attributes':['id',_0xd2f3('0x3'),_0xd2f3('0xb'),_0xd2f3('0xc'),_0xd2f3('0xd')],'as':'CloudProvider'}]},{'model':_0xd2f3('0xe'),'as':_0xd2f3('0xf'),'include':[{'model':'CloudProvider','attributes':['id',_0xd2f3('0x3'),_0xd2f3('0xb'),_0xd2f3('0xc'),_0xd2f3('0xd')],'as':_0xd2f3('0xa')}]}]},'log':'getMailAccount'});};};exports['notify']=function(_0x49fba6,_0x44509e){return client[_0xd2f3('0x1')]('NotifyMailAccount',{'account':{'id':_0x49fba6},'body':_0x44509e,'log':_0xd2f3('0x10')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 59d37f2..1fcc1fc 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 _0xa4ed=['../client','getSettings','Request','loginMailFrequency','GetSettings'];(function(_0x198446,_0x119c8f){var _0x38d7b7=function(_0x293752){while(--_0x293752){_0x198446['push'](_0x198446['shift']());}};_0x38d7b7(++_0x119c8f);}(_0xa4ed,0xdc));var _0xda4e=function(_0x13bc97,_0x4a945e){_0x13bc97=_0x13bc97-0x0;var _0x5acc0f=_0xa4ed[_0x13bc97];return _0x5acc0f;};'use strict';var client=require(_0xda4e('0x0'));exports[_0xda4e('0x1')]=function(){return client[_0xda4e('0x2')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xda4e('0x3')]},'log':_0xda4e('0x4')});}; \ No newline at end of file +var _0xf4f0=['../client','getSettings','ShowSetting','loginMailFrequency','GetSettings'];(function(_0x1142f8,_0x13b4c0){var _0x506352=function(_0x21ecb5){while(--_0x21ecb5){_0x1142f8['push'](_0x1142f8['shift']());}};_0x506352(++_0x13b4c0);}(_0xf4f0,0x113));var _0x0f4f=function(_0x10aa73,_0xc744f4){_0x10aa73=_0x10aa73-0x0;var _0x3496d9=_0xf4f0[_0x10aa73];return _0x3496d9;};'use strict';var client=require(_0x0f4f('0x0'));exports[_0x0f4f('0x1')]=function(){return client['Request'](_0x0f4f('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x0f4f('0x3')]},'log':_0x0f4f('0x4')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 7d42ea3..7c62af3 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(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'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(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file diff --git a/server/services/express/index.js b/server/services/express/index.js index e4aae73..372f3c5 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 _0xc864=['../../config/express','../../routes','once','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','http','express','sticky-session','../../config/environment','timeout','listen','port','polling','defaults','redis','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio'];(function(_0x124f88,_0x3ad501){var _0xed0e3b=function(_0x43a67d){while(--_0x43a67d){_0x124f88['push'](_0x124f88['shift']());}};_0xed0e3b(++_0x3ad501);}(_0xc864,0x1aa));var _0x4c86=function(_0x590381,_0x5c3948){_0x590381=_0x590381-0x0;var _0xe300df=_0xc864[_0x590381];return _0xe300df;};'use strict';var _=require('lodash');var http=require(_0x4c86('0x0'));var express=require(_0x4c86('0x1'));var sticky=require(_0x4c86('0x2'));var Redis=require('ioredis');var config=require(_0x4c86('0x3'));var app=express();var server=http['createServer'](app);server[_0x4c86('0x4')]=0xdbba0;if(sticky[_0x4c86('0x5')](server,config[_0x4c86('0x6')])){var socketio=require('socket.io')(server,{'transports':['websocket',_0x4c86('0x7')]});config['redis']=_[_0x4c86('0x8')](config[_0x4c86('0x9')],{'host':'localhost','port':0x18eb});socketio[_0x4c86('0xa')](require(_0x4c86('0xb'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config['redis'])}));require(_0x4c86('0xc'))[_0x4c86('0xd')]();require(_0x4c86('0xe'))[_0x4c86('0xd')](socketio);require(_0x4c86('0xf'))[_0x4c86('0xd')](app);require(_0x4c86('0x10'))[_0x4c86('0xd')](app);}else{server[_0x4c86('0x11')]('listening',function(){console[_0x4c86('0x12')](_0x4c86('0x13'),config[_0x4c86('0x6')]);});}exports=module[_0x4c86('0x14')]=app; \ No newline at end of file +var _0x8d86=['listen','port','websocket','redis','defaults','localhost','socket.io-redis','../../config/socketio','default','once','listening','log','exports','lodash','express','../../config/environment','createServer','timeout'];(function(_0x4bf83e,_0x429223){var _0x5647c9=function(_0x195bae){while(--_0x195bae){_0x4bf83e['push'](_0x4bf83e['shift']());}};_0x5647c9(++_0x429223);}(_0x8d86,0x163));var _0x68d8=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x8d86[_0x13b8f3];return _0x1a6d06;};'use strict';var _=require(_0x68d8('0x0'));var http=require('http');var express=require(_0x68d8('0x1'));var sticky=require('sticky-session');var Redis=require('ioredis');var config=require(_0x68d8('0x2'));var app=express();var server=http[_0x68d8('0x3')](app);server[_0x68d8('0x4')]=0xdbba0;if(sticky[_0x68d8('0x5')](server,config[_0x68d8('0x6')])){var socketio=require('socket.io')(server,{'transports':[_0x68d8('0x7'),'polling']});config[_0x68d8('0x8')]=_[_0x68d8('0x9')](config[_0x68d8('0x8')],{'host':_0x68d8('0xa'),'port':0x18eb});socketio['adapter'](require(_0x68d8('0xb'))({'pubClient':new Redis(config[_0x68d8('0x8')]),'subClient':new Redis(config[_0x68d8('0x8')])}));require('../../config/triggers')['default']();require(_0x68d8('0xc'))['default'](socketio);require('../../config/express')[_0x68d8('0xd')](app);require('../../routes')['default'](app);}else{server[_0x68d8('0xe')](_0x68d8('0xf'),function(){console[_0x68d8('0x10')]('Express\x20server\x20listening\x20on\x20port\x20%d!',config['port']);});}exports=module[_0x68d8('0x11')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 5059251..b4162a9 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 _0xdeda=['message','result','catch','exports','bluebird','client','http','Request','request','then','debug','rpc','routing','error'];(function(_0x3f4a45,_0xc4d0a2){var _0x145272=function(_0xad27fc){while(--_0xad27fc){_0x3f4a45['push'](_0x3f4a45['shift']());}};_0x145272(++_0xc4d0a2);}(_0xdeda,0xd6));var _0xaded=function(_0x1e4896,_0x566ad7){_0x1e4896=_0x1e4896-0x0;var _0x50978a=_0xdeda[_0x1e4896];return _0x50978a;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xaded('0x0'));var logger=require('../../config/logger')('routing');var client=jayson[_0xaded('0x1')][_0xaded('0x2')]({'port':0x2329});client[_0xaded('0x3')]=function(_0x4edf95,_0x5721c7){return new BPromise(function(_0x14187d,_0x37cfec){return client[_0xaded('0x4')](_0x4edf95,_0x5721c7)[_0xaded('0x5')](function(_0x3cc331){logger[_0xaded('0x6')](_0xaded('0x7'),_0xaded('0x8'),_0x4edf95,_0x5721c7,_0x3cc331);if(_0x3cc331[_0xaded('0x9')]){logger[_0xaded('0x9')](_0xaded('0x7'),_0xaded('0x8'),_0x4edf95,_0x3cc331['error']['message'],_0x5721c7);return _0x37cfec(_0x3cc331[_0xaded('0x9')][_0xaded('0xa')]);}else{return _0x14187d(_0x3cc331[_0xaded('0xb')]);}})[_0xaded('0xc')](function(_0x3ca436){logger['error'](_0xaded('0x7'),'routing',_0x4edf95,_0x3ca436,_0x5721c7);return _0x37cfec(_0x3ca436);});});};module[_0xaded('0xd')]=client; \ No newline at end of file +var _0x2490=['http','then','debug','rpc','error','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','routing','client'];(function(_0x52cc84,_0x54793e){var _0x4cea2f=function(_0x41eb1f){while(--_0x41eb1f){_0x52cc84['push'](_0x52cc84['shift']());}};_0x4cea2f(++_0x54793e);}(_0x2490,0xb1));var _0x0249=function(_0x48011a,_0x30afc0){_0x48011a=_0x48011a-0x0;var _0x53a661=_0x2490[_0x48011a];return _0x53a661;};'use strict';var jayson=require(_0x0249('0x0'));var BPromise=require(_0x0249('0x1'));var logger=require(_0x0249('0x2'))(_0x0249('0x3'));var client=jayson[_0x0249('0x4')][_0x0249('0x5')]({'port':0x2329});client['Request']=function(_0x49fb3a,_0x176e62){return new BPromise(function(_0x58020b,_0x54b395){return client['request'](_0x49fb3a,_0x176e62)[_0x0249('0x6')](function(_0x175864){logger[_0x0249('0x7')](_0x0249('0x8'),'routing',_0x49fb3a,_0x176e62,_0x175864);if(_0x175864['error']){logger['error'](_0x0249('0x8'),_0x0249('0x3'),_0x49fb3a,_0x175864[_0x0249('0x9')][_0x0249('0xa')],_0x176e62);return _0x54b395(_0x175864[_0x0249('0x9')][_0x0249('0xa')]);}else{return _0x58020b(_0x175864[_0x0249('0xb')]);}})[_0x0249('0xc')](function(_0x5525b6){logger[_0x0249('0x9')]('rpc',_0x0249('0x3'),_0x49fb3a,_0x5525b6,_0x176e62);return _0x54b395(_0x5525b6);});});};module[_0x0249('0xd')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 688a83a..f5b20ac 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 _0xec98=['./realtime','./rpc/user','./rpc/interval','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','getAgents','initAgents','then','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','listen','catch','log','bluebird','./server'];(function(_0x1981ad,_0x1dfd88){var _0x2a4f55=function(_0x29bfba){while(--_0x29bfba){_0x1981ad['push'](_0x1981ad['shift']());}};_0x2a4f55(++_0x1dfd88);}(_0xec98,0xf1));var _0x8ec9=function(_0x1491fd,_0x2ff71f){_0x1491fd=_0x1491fd-0x0;var _0x141686=_0xec98[_0x1491fd];return _0x141686;};'use strict';var BPromise=require(_0x8ec9('0x0'));var server=require(_0x8ec9('0x1'));var Realtime=require(_0x8ec9('0x2'));var user=require(_0x8ec9('0x3'));var interval=require(_0x8ec9('0x4'));var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require(_0x8ec9('0x5'));var smsQueue=require(_0x8ec9('0x6'));var mailQueue=require(_0x8ec9('0x7'));var faxQueue=require(_0x8ec9('0x8'));var whatsappQueue=require(_0x8ec9('0x9'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x8ec9('0xa')]()['then'](user[_0x8ec9('0xb')]())['then'](realtime[_0x8ec9('0xc')]())['then'](interval['getIntervals']())[_0x8ec9('0xd')](realtime[_0x8ec9('0xe')]())[_0x8ec9('0xd')](openchannelQueue[_0x8ec9('0xf')]())[_0x8ec9('0xd')](realtime[_0x8ec9('0x10')]())[_0x8ec9('0xd')](chatQueue[_0x8ec9('0x11')]())[_0x8ec9('0xd')](realtime[_0x8ec9('0x12')]())[_0x8ec9('0xd')](smsQueue[_0x8ec9('0x13')]())[_0x8ec9('0xd')](realtime['initSmsQueues']())[_0x8ec9('0xd')](mailQueue[_0x8ec9('0x14')]())[_0x8ec9('0xd')](realtime[_0x8ec9('0x15')]())['then'](faxQueue[_0x8ec9('0x16')]())[_0x8ec9('0xd')](realtime[_0x8ec9('0x17')]())[_0x8ec9('0xd')](whatsappQueue['getWhatsappQueues']())[_0x8ec9('0xd')](realtime['initWhatsappQueues']())[_0x8ec9('0xd')](function(){return realtime;});}function main(){return server[_0x8ec9('0x18')](realtime)[_0x8ec9('0xd')](function(_0x2cf1ee){return initRealtime();})['then'](function(_0x12a2d6){return setInterval(initRealtime,0x1388);})[_0x8ec9('0x19')](function(_0xadc275){console[_0x8ec9('0x1a')](_0xadc275);});}main(); \ No newline at end of file +var _0xe1cd=['listen','log','bluebird','./server','./realtime','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getSmsQueues','initSmsQueues','getMailQueues','getFaxQueues','initFaxQueues'];(function(_0x3990fa,_0x4d8071){var _0x297cac=function(_0x36e918){while(--_0x36e918){_0x3990fa['push'](_0x3990fa['shift']());}};_0x297cac(++_0x4d8071);}(_0xe1cd,0x1e5));var _0xde1c=function(_0x50afc6,_0x7908ee){_0x50afc6=_0x50afc6-0x0;var _0x1fafa1=_0xe1cd[_0x50afc6];return _0x1fafa1;};'use strict';var BPromise=require(_0xde1c('0x0'));var server=require(_0xde1c('0x1'));var Realtime=require(_0xde1c('0x2'));var user=require('./rpc/user');var interval=require(_0xde1c('0x3'));var openchannelQueue=require(_0xde1c('0x4'));var chatQueue=require(_0xde1c('0x5'));var smsQueue=require(_0xde1c('0x6'));var mailQueue=require(_0xde1c('0x7'));var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require(_0xde1c('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xde1c('0x9')]()[_0xde1c('0xa')](user[_0xde1c('0xb')]())[_0xde1c('0xa')](realtime[_0xde1c('0xc')]())[_0xde1c('0xa')](interval['getIntervals']())['then'](realtime[_0xde1c('0xd')]())[_0xde1c('0xa')](openchannelQueue[_0xde1c('0xe')]())[_0xde1c('0xa')](realtime[_0xde1c('0xf')]())['then'](chatQueue['getChatQueues']())[_0xde1c('0xa')](realtime['initChatQueues']())[_0xde1c('0xa')](smsQueue[_0xde1c('0x10')]())[_0xde1c('0xa')](realtime[_0xde1c('0x11')]())[_0xde1c('0xa')](mailQueue[_0xde1c('0x12')]())[_0xde1c('0xa')](realtime['initMailQueues']())[_0xde1c('0xa')](faxQueue[_0xde1c('0x13')]())['then'](realtime[_0xde1c('0x14')]())['then'](whatsappQueue['getWhatsappQueues']())[_0xde1c('0xa')](realtime['initWhatsappQueues']())[_0xde1c('0xa')](function(){return realtime;});}function main(){return server[_0xde1c('0x15')](realtime)[_0xde1c('0xa')](function(_0x4874b2){return initRealtime();})['then'](function(_0x23dd33){return setInterval(initRealtime,0x1388);})['catch'](function(_0x115715){console[_0xde1c('0x16')](_0x115715);});}main(); \ No newline at end of file diff --git a/server/services/routing/lib/rule-engine.js b/server/services/routing/lib/rule-engine.js index e1107e4..402dd37 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 _0x7a54=['turn','prioritize','priority','toJSON','map','toString','fromJSON','isString','object','exports','lodash','util','events','isNil','register','ignoreFactChanges','inherits','init','rules','activeRules','concat','prototype','sync','filter','orderBy','asc','execute','clone','consequence','ruleRef','name','index_','nextTick','push','call','isEqual','restart','length','condition','matchPath','noop','findRules'];(function(_0x58f097,_0x2749e4){var _0x4f11b1=function(_0x1ea528){while(--_0x1ea528){_0x58f097['push'](_0x58f097['shift']());}};_0x4f11b1(++_0x2749e4);}(_0x7a54,0x106));var _0x47a5=function(_0x485913,_0x163e36){_0x485913=_0x485913-0x0;var _0x576918=_0x7a54[_0x485913];return _0x576918;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var EventEmitter=require(_0x47a5('0x2'))['EventEmitter'];function RuleEngine(_0x1d33e,_0x4086cd){this['init']();if(!_[_0x47a5('0x3')](_0x1d33e)){this[_0x47a5('0x4')](_0x1d33e);}if(_0x4086cd){this[_0x47a5('0x5')]=_0x4086cd[_0x47a5('0x5')];}return this;}util[_0x47a5('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x47a5('0x7')]=function(_0x59199c){this[_0x47a5('0x8')]=[];this[_0x47a5('0x9')]=[];};RuleEngine['prototype'][_0x47a5('0x4')]=function(_0x5077f3){if(Array['isArray'](_0x5077f3)){this['rules']=this[_0x47a5('0x8')][_0x47a5('0xa')](_0x5077f3);}else if(_0x5077f3!==null&&_['isObject'](_0x5077f3)){this[_0x47a5('0x8')]['push'](_0x5077f3);}this['sync']();};RuleEngine[_0x47a5('0xb')][_0x47a5('0xc')]=function(){this[_0x47a5('0x9')]=this[_0x47a5('0x8')][_0x47a5('0xd')](function(_0xd308b8){if(_[_0x47a5('0x3')](_0xd308b8['on'])){_0xd308b8['on']=!![];}if(_0xd308b8['on']===!![]){return _0xd308b8;}});this['activeRules']=_[_0x47a5('0xe')](this[_0x47a5('0x9')],['p'],[_0x47a5('0xf')]);};RuleEngine[_0x47a5('0xb')][_0x47a5('0x10')]=function(_0x620ee9,_0x3c6c46){var _0x190faa=![];_0x620ee9['result']=!![];var _0x362359=_[_0x47a5('0x11')](_0x620ee9);var _0x3b001e=_[_0x47a5('0x11')](_0x620ee9);var _0x1ef44c=this['activeRules'];var _0x549de3=[];var _0x138bc0=this['ignoreFactChanges'];(function FnRuleLoop(_0x5247fd){var _0x423a81={'rules':function(){return _0x1ef44c;},'rule':function(){return _0x1ef44c[_0x5247fd];},'when':function(_0xaf70a6){if(_0xaf70a6){var _0x2ce454=_0x1ef44c[_0x5247fd][_0x47a5('0x12')];_0x2ce454[_0x47a5('0x13')]=_0x1ef44c[_0x5247fd]['id']||_0x1ef44c[_0x5247fd][_0x47a5('0x14')]||_0x47a5('0x15')+_0x5247fd;process[_0x47a5('0x16')](function(){_0x549de3[_0x47a5('0x17')](_0x2ce454['ruleRef']);_0x2ce454[_0x47a5('0x18')](_0x362359,_0x423a81);});}else{process[_0x47a5('0x16')](function(){_0x423a81['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190faa=!![];return FnRuleLoop(0x0);},'next':function(_0x2b0360){if(!_0x138bc0&&!_[_0x47a5('0x19')](_0x3b001e,_0x362359)){_0x3b001e=_[_0x47a5('0x11')](_0x362359);process['nextTick'](function(){_0x423a81[_0x47a5('0x1a')]();});}else{process[_0x47a5('0x16')](function(){if(_[_0x47a5('0x3')](_0x2b0360)){return FnRuleLoop(_0x5247fd+0x1);}else{return FnRuleLoop(_0x2b0360);}});}}};if(_0x5247fd<_0x1ef44c[_0x47a5('0x1b')]&&_0x190faa===![]){var _0x5ef1b1=_0x1ef44c[_0x5247fd][_0x47a5('0x1c')];_0x5ef1b1[_0x47a5('0x18')](_0x362359,_0x423a81);}else{process['nextTick'](function(){_0x362359[_0x47a5('0x1d')]=_0x549de3;return _0x3c6c46?_0x3c6c46(_0x362359):_[_0x47a5('0x1e')]();});}}(0x0));};RuleEngine[_0x47a5('0xb')][_0x47a5('0x1f')]=function(_0x3abd6a){if(_['isNil'](_0x3abd6a)){return this['rules'];}else{var _0x136745=_['matches'](_0x3abd6a);return _[_0x47a5('0xd')](this['rules'],_0x136745);}};RuleEngine[_0x47a5('0xb')][_0x47a5('0x20')]=function(_0x36ad34,_0x1dac65){var _0x21f296=_0x36ad34==='on'||_0x36ad34==='ON'?!![]:![];var _0x3ba0b7=this[_0x47a5('0x1f')](_0x1dac65);for(var _0x136b14=0x0,_0x16631f=_0x3ba0b7[_0x47a5('0x1b')];_0x136b14<_0x16631f;_0x136b14+=0x1){_0x3ba0b7[_0x136b14]['on']=_0x21f296;}this[_0x47a5('0xc')]();};RuleEngine[_0x47a5('0xb')][_0x47a5('0x21')]=function(_0x528582,_0x243210){_0x528582=parseInt(_0x528582,0xa);var _0x51833b=this[_0x47a5('0x1f')](_0x243210);for(var _0x9ac908=0x0,_0x16901f=_0x51833b['length'];_0x9ac908<_0x16901f;_0x9ac908+=0x1){_0x51833b[_0x9ac908][_0x47a5('0x22')]=_0x528582;}this[_0x47a5('0xc')]();};RuleEngine[_0x47a5('0xb')][_0x47a5('0x23')]=function(){var _0x51cc81=this['rules'];if(_0x51cc81 instanceof Array){_0x51cc81=_0x51cc81[_0x47a5('0x24')](function(_0xfb5ddb){_0xfb5ddb['condition']=_0xfb5ddb['condition'][_0x47a5('0x25')]();_0xfb5ddb[_0x47a5('0x12')]=_0xfb5ddb['consequence'][_0x47a5('0x25')]();return _0xfb5ddb;});}else if(!_['isNil'](_0x51cc81)){_0x51cc81[_0x47a5('0x1c')]=_0x51cc81[_0x47a5('0x1c')]['toString']();_0x51cc81['consequence']=_0x51cc81[_0x47a5('0x12')]['toString']();}return _0x51cc81;};RuleEngine[_0x47a5('0xb')][_0x47a5('0x26')]=function(_0xf269a8){this['init']();if(_[_0x47a5('0x27')](_0xf269a8)){_0xf269a8=JSON['parse'](_0xf269a8);}if(_0xf269a8 instanceof Array){_0xf269a8=_0xf269a8['map'](function(_0x65542e){_0x65542e['condition']=eval('('+_0x65542e[_0x47a5('0x1c')]+')');_0x65542e['consequence']=eval('('+_0x65542e[_0x47a5('0x12')]+')');return _0x65542e;});}else if(_0xf269a8!==null&&typeof _0xf269a8==_0x47a5('0x28')){_0xf269a8[_0x47a5('0x1c')]=eval('('+_0xf269a8[_0x47a5('0x1c')]+')');_0xf269a8[_0x47a5('0x12')]=eval('('+_0xf269a8[_0x47a5('0x12')]+')');}this[_0x47a5('0x4')](_0xf269a8);};module[_0x47a5('0x29')]=RuleEngine; \ No newline at end of file +var _0x814b=['init','parse','map','object','lodash','util','events','EventEmitter','isNil','register','ignoreFactChanges','inherits','prototype','rules','isArray','concat','isObject','push','sync','filter','activeRules','orderBy','asc','execute','result','clone','name','ruleRef','call','next','isEqual','nextTick','restart','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','consequence','fromJSON'];(function(_0x3b7f91,_0x260ad7){var _0x34c1cc=function(_0x1fe6f1){while(--_0x1fe6f1){_0x3b7f91['push'](_0x3b7f91['shift']());}};_0x34c1cc(++_0x260ad7);}(_0x814b,0x1a2));var _0xb814=function(_0x1b8e60,_0x21b885){_0x1b8e60=_0x1b8e60-0x0;var _0x363363=_0x814b[_0x1b8e60];return _0x363363;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var EventEmitter=require(_0xb814('0x2'))[_0xb814('0x3')];function RuleEngine(_0xfbb64b,_0x477725){this['init']();if(!_[_0xb814('0x4')](_0xfbb64b)){this[_0xb814('0x5')](_0xfbb64b);}if(_0x477725){this[_0xb814('0x6')]=_0x477725[_0xb814('0x6')];}return this;}util[_0xb814('0x7')](RuleEngine,EventEmitter);RuleEngine[_0xb814('0x8')]['init']=function(_0x3b0829){this[_0xb814('0x9')]=[];this['activeRules']=[];};RuleEngine[_0xb814('0x8')][_0xb814('0x5')]=function(_0x186d5a){if(Array[_0xb814('0xa')](_0x186d5a)){this[_0xb814('0x9')]=this[_0xb814('0x9')][_0xb814('0xb')](_0x186d5a);}else if(_0x186d5a!==null&&_[_0xb814('0xc')](_0x186d5a)){this[_0xb814('0x9')][_0xb814('0xd')](_0x186d5a);}this[_0xb814('0xe')]();};RuleEngine['prototype'][_0xb814('0xe')]=function(){this['activeRules']=this[_0xb814('0x9')][_0xb814('0xf')](function(_0x35b10d){if(_[_0xb814('0x4')](_0x35b10d['on'])){_0x35b10d['on']=!![];}if(_0x35b10d['on']===!![]){return _0x35b10d;}});this[_0xb814('0x10')]=_[_0xb814('0x11')](this[_0xb814('0x10')],['p'],[_0xb814('0x12')]);};RuleEngine[_0xb814('0x8')][_0xb814('0x13')]=function(_0x3f4881,_0x44fb96){var _0x17f5bd=![];_0x3f4881[_0xb814('0x14')]=!![];var _0x303aca=_[_0xb814('0x15')](_0x3f4881);var _0x45e0d0=_[_0xb814('0x15')](_0x3f4881);var _0x125ce2=this[_0xb814('0x10')];var _0x7a21ef=[];var _0x48c9df=this[_0xb814('0x6')];(function FnRuleLoop(_0x55ba16){var _0x270598={'rules':function(){return _0x125ce2;},'rule':function(){return _0x125ce2[_0x55ba16];},'when':function(_0xfac75b){if(_0xfac75b){var _0x4c3007=_0x125ce2[_0x55ba16]['consequence'];_0x4c3007['ruleRef']=_0x125ce2[_0x55ba16]['id']||_0x125ce2[_0x55ba16][_0xb814('0x16')]||'index_'+_0x55ba16;process['nextTick'](function(){_0x7a21ef[_0xb814('0xd')](_0x4c3007[_0xb814('0x17')]);_0x4c3007[_0xb814('0x18')](_0x303aca,_0x270598);});}else{process['nextTick'](function(){_0x270598[_0xb814('0x19')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x17f5bd=!![];return FnRuleLoop(0x0);},'next':function(_0x531032){if(!_0x48c9df&&!_[_0xb814('0x1a')](_0x45e0d0,_0x303aca)){_0x45e0d0=_[_0xb814('0x15')](_0x303aca);process[_0xb814('0x1b')](function(){_0x270598[_0xb814('0x1c')]();});}else{process[_0xb814('0x1b')](function(){if(_[_0xb814('0x4')](_0x531032)){return FnRuleLoop(_0x55ba16+0x1);}else{return FnRuleLoop(_0x531032);}});}}};if(_0x55ba16<_0x125ce2[_0xb814('0x1d')]&&_0x17f5bd===![]){var _0x594470=_0x125ce2[_0x55ba16][_0xb814('0x1e')];_0x594470['call'](_0x303aca,_0x270598);}else{process[_0xb814('0x1b')](function(){_0x303aca[_0xb814('0x1f')]=_0x7a21ef;return _0x44fb96?_0x44fb96(_0x303aca):_[_0xb814('0x20')]();});}}(0x0));};RuleEngine[_0xb814('0x8')][_0xb814('0x21')]=function(_0xb9e57d){if(_[_0xb814('0x4')](_0xb9e57d)){return this['rules'];}else{var _0x392222=_[_0xb814('0x22')](_0xb9e57d);return _[_0xb814('0xf')](this[_0xb814('0x9')],_0x392222);}};RuleEngine[_0xb814('0x8')][_0xb814('0x23')]=function(_0x3f0150,_0x1e4e89){var _0x5a6291=_0x3f0150==='on'||_0x3f0150==='ON'?!![]:![];var _0x271aa8=this[_0xb814('0x21')](_0x1e4e89);for(var _0x52ed64=0x0,_0x9008b2=_0x271aa8[_0xb814('0x1d')];_0x52ed64<_0x9008b2;_0x52ed64+=0x1){_0x271aa8[_0x52ed64]['on']=_0x5a6291;}this[_0xb814('0xe')]();};RuleEngine['prototype'][_0xb814('0x24')]=function(_0x2051d0,_0x58c3ca){_0x2051d0=parseInt(_0x2051d0,0xa);var _0x338a28=this['findRules'](_0x58c3ca);for(var _0x6efe9a=0x0,_0x5f3e9b=_0x338a28['length'];_0x6efe9a<_0x5f3e9b;_0x6efe9a+=0x1){_0x338a28[_0x6efe9a][_0xb814('0x25')]=_0x2051d0;}this['sync']();};RuleEngine[_0xb814('0x8')][_0xb814('0x26')]=function(){var _0x2b91bd=this['rules'];if(_0x2b91bd instanceof Array){_0x2b91bd=_0x2b91bd['map'](function(_0x26d3a9){_0x26d3a9[_0xb814('0x1e')]=_0x26d3a9['condition'][_0xb814('0x27')]();_0x26d3a9[_0xb814('0x28')]=_0x26d3a9[_0xb814('0x28')][_0xb814('0x27')]();return _0x26d3a9;});}else if(!_[_0xb814('0x4')](_0x2b91bd)){_0x2b91bd[_0xb814('0x1e')]=_0x2b91bd[_0xb814('0x1e')]['toString']();_0x2b91bd[_0xb814('0x28')]=_0x2b91bd[_0xb814('0x28')][_0xb814('0x27')]();}return _0x2b91bd;};RuleEngine[_0xb814('0x8')][_0xb814('0x29')]=function(_0x4ff31a){this[_0xb814('0x2a')]();if(_['isString'](_0x4ff31a)){_0x4ff31a=JSON[_0xb814('0x2b')](_0x4ff31a);}if(_0x4ff31a instanceof Array){_0x4ff31a=_0x4ff31a[_0xb814('0x2c')](function(_0xe0f509){_0xe0f509['condition']=eval('('+_0xe0f509[_0xb814('0x1e')]+')');_0xe0f509[_0xb814('0x28')]=eval('('+_0xe0f509['consequence']+')');return _0xe0f509;});}else if(_0x4ff31a!==null&&typeof _0x4ff31a==_0xb814('0x2d')){_0x4ff31a[_0xb814('0x1e')]=eval('('+_0x4ff31a[_0xb814('0x1e')]+')');_0x4ff31a[_0xb814('0x28')]=eval('('+_0x4ff31a[_0xb814('0x28')]+')');}this[_0xb814('0x5')](_0x4ff31a);};module['exports']=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index c786bee..04ecdb7 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 _0x796c=['SendMail','jayson/promise','client','http','then','error','message','catch','sendMailMessage'];(function(_0x52c8aa,_0x3e5d62){var _0x112f05=function(_0x4347dd){while(--_0x4347dd){_0x52c8aa['push'](_0x52c8aa['shift']());}};_0x112f05(++_0x3e5d62);}(_0x796c,0xfd));var _0xc796=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x796c[_0x4243a3];return _0x1b2a33;};'use strict';var BPromise=require('bluebird');var jayson=require(_0xc796('0x0'));var client=jayson[_0xc796('0x1')][_0xc796('0x2')]({'port':0x232b});function request(_0x44f7ed,_0x203900){return new BPromise(function(_0x1bdca3,_0xdd549d){return client['request'](_0x44f7ed,_0x203900)[_0xc796('0x3')](function(_0x4a1be1){if(_0x4a1be1[_0xc796('0x4')]){return _0xdd549d(_0x4a1be1['error'][_0xc796('0x5')]);}else{return _0x1bdca3(_0x4a1be1['result']);}})[_0xc796('0x6')](function(_0x2ad4fd){return _0xdd549d(_0x2ad4fd);});});}exports[_0xc796('0x7')]=function(_0x5eaaf2,_0xe7ee29){return request(_0xc796('0x8'),{'account':_0x5eaaf2,'message':_0xe7ee29});}; \ No newline at end of file +var _0x9fc9=['request','then','message','sendMailMessage','SendMail','jayson/promise','client','http'];(function(_0x3621d2,_0x57a5e7){var _0x3ff0e9=function(_0x5b1b97){while(--_0x5b1b97){_0x3621d2['push'](_0x3621d2['shift']());}};_0x3ff0e9(++_0x57a5e7);}(_0x9fc9,0x6d));var _0x99fc=function(_0x27f4d8,_0x13ca36){_0x27f4d8=_0x27f4d8-0x0;var _0x181c9b=_0x9fc9[_0x27f4d8];return _0x181c9b;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x99fc('0x0'));var client=jayson[_0x99fc('0x1')][_0x99fc('0x2')]({'port':0x232b});function request(_0xfedff0,_0xa9799b){return new BPromise(function(_0x1dbabb,_0x5c0c52){return client[_0x99fc('0x3')](_0xfedff0,_0xa9799b)[_0x99fc('0x4')](function(_0x49012d){if(_0x49012d['error']){return _0x5c0c52(_0x49012d['error'][_0x99fc('0x5')]);}else{return _0x1dbabb(_0x49012d['result']);}})['catch'](function(_0x45a874){return _0x5c0c52(_0x45a874);});});}exports[_0x99fc('0x6')]=function(_0xa4b7da,_0x558b12){return request(_0x99fc('0x7'),{'account':_0xa4b7da,'message':_0x558b12});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index bfc83e4..b40009f 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 _0x323f=['chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','working','idle','mail','openchannel','sms','whatsapp','length','Status','StatusTime','format','faxStatusTime','stringify','emit','exports','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause'];(function(_0x589aee,_0x140a03){var _0x2f5ed4=function(_0x3d224f){while(--_0x3d224f){_0x589aee['push'](_0x589aee['shift']());}};_0x2f5ed4(++_0x140a03);}(_0x323f,0x1ee));var _0xf323=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x323f[_0x484e36];return _0xafc85d;};'use strict';var _=require('lodash');var md5=require(_0xf323('0x0'));var moment=require('moment');var Redis=require(_0xf323('0x1'));var config=require(_0xf323('0x2'));config[_0xf323('0x3')]=_[_0xf323('0x4')](config[_0xf323('0x3')],{'host':_0xf323('0x5'),'port':0x18eb});var io=require(_0xf323('0x6'))(new Redis(config[_0xf323('0x3')]));function Agent(_0x3cfee3){this['id']=_0x3cfee3['id']||0x0;this[_0xf323('0x7')]=_0x3cfee3['name']||'';this[_0xf323('0x8')]=_0x3cfee3[_0xf323('0x8')]||!![];this[_0xf323('0x9')]=_0x3cfee3[_0xf323('0x9')]||![];this[_0xf323('0xa')]=_0x3cfee3[_0xf323('0xa')]||![];this[_0xf323('0xb')]=_0x3cfee3[_0xf323('0xb')]||![];this[_0xf323('0xc')]=_0x3cfee3[_0xf323('0xc')]||![];this[_0xf323('0xd')]=_0x3cfee3[_0xf323('0xd')]||![];this[_0xf323('0xe')]=_0x3cfee3[_0xf323('0xe')]||![];this[_0xf323('0xf')]=_0xf323('0x10');this[_0xf323('0x11')]=0x0;this['chatCapacity']=_0x3cfee3[_0xf323('0x12')]||0x0;this[_0xf323('0x13')]=0x0;this[_0xf323('0x14')]='unknown';this[_0xf323('0x15')]=0x0;this[_0xf323('0x16')]=_0x3cfee3[_0xf323('0x16')]||0x0;this[_0xf323('0x17')]=0x0;this[_0xf323('0x18')]=_0xf323('0x10');this['faxStatusTime']=0x0;this['faxCapacity']=_0x3cfee3[_0xf323('0x19')]||0x0;this[_0xf323('0x1a')]=0x0;this[_0xf323('0x1b')]=_0xf323('0x10');this[_0xf323('0x1c')]=0x0;this['smsCapacity']=_0x3cfee3[_0xf323('0x1d')]||0x0;this[_0xf323('0x1e')]=0x0;this[_0xf323('0x1f')]=_0xf323('0x10');this['whatsappStatusTime']=0x0;this[_0xf323('0x20')]=_0x3cfee3[_0xf323('0x20')]||0x0;this[_0xf323('0x21')]=0x0;this[_0xf323('0x22')]='unknown';this[_0xf323('0x23')]=0x0;this[_0xf323('0x24')]=_0x3cfee3['openchannelCapacity']||0x0;this[_0xf323('0x25')]=0x0;this[_0xf323('0x26')]=![];this[_0xf323('0x27')]=undefined;this[_0xf323('0x0')]='';this['chatWaitingInteractions']={};this[_0xf323('0x28')]={};this[_0xf323('0x29')]={};this[_0xf323('0x2a')]={};this['smsWaitingInteractions']={};this[_0xf323('0x2b')]={};this[_0xf323('0x2c')]();}Agent[_0xf323('0x2d')][_0xf323('0x2e')]=function(_0x13ec1f){if(this[_0x13ec1f+_0xf323('0x2f')]>0x0){if(this[_0x13ec1f+_0xf323('0x30')]>0x0&&this[_0x13ec1f+_0xf323('0x2f')]>=this[_0x13ec1f+_0xf323('0x30')]){return'maxcapacity';}else{return _0xf323('0x31');}}else{return _0xf323('0x32');}};Agent[_0xf323('0x2d')][_0xf323('0x2c')]=function(){var _0x87ec45=[_0xf323('0x33'),'chat',_0xf323('0x34'),'fax',_0xf323('0x35'),_0xf323('0x36')];for(var _0x56be0c=0x0;_0x56be0c<_0x87ec45[_0xf323('0x37')];_0x56be0c+=0x1){var _0x3c95ce=this[_0xf323('0x2e')](_0x87ec45[_0x56be0c]);if(this[_0x87ec45[_0x56be0c]+_0xf323('0x38')]!==_0x3c95ce){this[_0x87ec45[_0x56be0c]+_0xf323('0x39')]=_['toNumber'](moment()[_0xf323('0x3a')]('x'));}this[_0x87ec45[_0x56be0c]+_0xf323('0x38')]=_0x3c95ce;}var _0x12c7d5={'id':this['id'],'name':this[_0xf323('0x7')],'online':this[_0xf323('0x8')],'voicePause':this[_0xf323('0x9')],'chatPause':this[_0xf323('0xa')],'mailPause':this[_0xf323('0xb')],'smsPause':this[_0xf323('0xd')],'faxPause':this['faxPause'],'openchannelPause':this[_0xf323('0xe')],'chatStatus':this[_0xf323('0xf')],'chatStatusTime':this[_0xf323('0x11')],'chatCapacity':this[_0xf323('0x12')],'chatCurrentCapacity':this[_0xf323('0x13')],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0xf323('0x15')],'mailCapacity':this[_0xf323('0x16')],'mailCurrentCapacity':this[_0xf323('0x17')],'faxStatus':this[_0xf323('0x18')],'faxStatusTime':this[_0xf323('0x3b')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0xf323('0x1a')],'smsStatus':this[_0xf323('0x1b')],'smsStatusTime':this[_0xf323('0x1c')],'smsCapacity':this[_0xf323('0x1d')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0xf323('0x1f')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this[_0xf323('0x20')],'whatsappCurrentCapacity':this[_0xf323('0x21')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0xf323('0x23')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0xf323('0x25')],'busy':this['busy'],'busyQueue':this[_0xf323('0x27')],'chatWaitingInteractions':this['chatWaitingInteractions'],'faxWaitingInteractions':this[_0xf323('0x28')],'mailWaitingInteractions':this[_0xf323('0x29')],'openchannelWaitingInteractions':this['openchannelWaitingInteractions'],'smsWaitingInteractions':this['smsWaitingInteractions'],'whatsappWaitingInteractions':this['whatsappWaitingInteractions']};var _0x8b24f2=md5(JSON[_0xf323('0x3c')](_0x12c7d5));if(this[_0xf323('0x0')]!==_0x8b24f2){this[_0xf323('0x0')]=_0x8b24f2;io[_0xf323('0x3d')]('user:routing:update',_['omit'](_0x12c7d5,['online']));}};module[_0xf323('0x3e')]=Agent; \ No newline at end of file +var _0xa30a=['sms','length','getChannelStatus','Status','StatusTime','toNumber','format','smsPause','mailStatusTime','smsCapacity','whatsappStatusTime','whatsappCapacity','openchannelStatus','openchannelCapacity','mailWaitingInteractions','user:routing:update','omit','lodash','md5','moment','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCurrentCapacity','whatsappStatus','whatsappCurrentCapacity','openchannelStatusTime','busy','busyQueue','chatWaitingInteractions','faxWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','CurrentCapacity','Capacity','maxcapacity','working','idle','chat','openchannel'];(function(_0x16bbb7,_0x1f5d6e){var _0x573d4e=function(_0x5f0840){while(--_0x5f0840){_0x16bbb7['push'](_0x16bbb7['shift']());}};_0x573d4e(++_0x1f5d6e);}(_0xa30a,0xd7));var _0xaa30=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa30a[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xaa30('0x0'));var md5=require(_0xaa30('0x1'));var moment=require(_0xaa30('0x2'));var Redis=require('ioredis');var config=require(_0xaa30('0x3'));config[_0xaa30('0x4')]=_[_0xaa30('0x5')](config[_0xaa30('0x4')],{'host':_0xaa30('0x6'),'port':0x18eb});var io=require(_0xaa30('0x7'))(new Redis(config[_0xaa30('0x4')]));function Agent(_0x555947){this['id']=_0x555947['id']||0x0;this[_0xaa30('0x8')]=_0x555947['name']||'';this[_0xaa30('0x9')]=_0x555947[_0xaa30('0x9')]||!![];this[_0xaa30('0xa')]=_0x555947['voicePause']||![];this[_0xaa30('0xb')]=_0x555947[_0xaa30('0xb')]||![];this[_0xaa30('0xc')]=_0x555947[_0xaa30('0xc')]||![];this[_0xaa30('0xd')]=_0x555947[_0xaa30('0xd')]||![];this['smsPause']=_0x555947['smsPause']||![];this[_0xaa30('0xe')]=_0x555947['openchannelPause']||![];this[_0xaa30('0xf')]=_0xaa30('0x10');this[_0xaa30('0x11')]=0x0;this[_0xaa30('0x12')]=_0x555947['chatCapacity']||0x0;this[_0xaa30('0x13')]=0x0;this[_0xaa30('0x14')]=_0xaa30('0x10');this['mailStatusTime']=0x0;this[_0xaa30('0x15')]=_0x555947[_0xaa30('0x15')]||0x0;this[_0xaa30('0x16')]=0x0;this[_0xaa30('0x17')]=_0xaa30('0x10');this[_0xaa30('0x18')]=0x0;this[_0xaa30('0x19')]=_0x555947[_0xaa30('0x19')]||0x0;this[_0xaa30('0x1a')]=0x0;this[_0xaa30('0x1b')]='unknown';this[_0xaa30('0x1c')]=0x0;this['smsCapacity']=_0x555947['smsCapacity']||0x0;this[_0xaa30('0x1d')]=0x0;this[_0xaa30('0x1e')]=_0xaa30('0x10');this['whatsappStatusTime']=0x0;this['whatsappCapacity']=_0x555947['whatsappCapacity']||0x0;this[_0xaa30('0x1f')]=0x0;this['openchannelStatus']=_0xaa30('0x10');this[_0xaa30('0x20')]=0x0;this['openchannelCapacity']=_0x555947['openchannelCapacity']||0x0;this['openchannelCurrentCapacity']=0x0;this[_0xaa30('0x21')]=![];this[_0xaa30('0x22')]=undefined;this[_0xaa30('0x1')]='';this[_0xaa30('0x23')]={};this[_0xaa30('0x24')]={};this['mailWaitingInteractions']={};this[_0xaa30('0x25')]={};this[_0xaa30('0x26')]={};this[_0xaa30('0x27')]={};this[_0xaa30('0x28')]();}Agent[_0xaa30('0x29')]['getChannelStatus']=function(_0x325b42){if(this[_0x325b42+_0xaa30('0x2a')]>0x0){if(this[_0x325b42+_0xaa30('0x2b')]>0x0&&this[_0x325b42+_0xaa30('0x2a')]>=this[_0x325b42+'Capacity']){return _0xaa30('0x2c');}else{return _0xaa30('0x2d');}}else{return _0xaa30('0x2e');}};Agent[_0xaa30('0x29')][_0xaa30('0x28')]=function(){var _0x2a59ce=['mail',_0xaa30('0x2f'),_0xaa30('0x30'),'fax',_0xaa30('0x31'),'whatsapp'];for(var _0x2da4da=0x0;_0x2da4da<_0x2a59ce[_0xaa30('0x32')];_0x2da4da+=0x1){var _0x2aabf8=this[_0xaa30('0x33')](_0x2a59ce[_0x2da4da]);if(this[_0x2a59ce[_0x2da4da]+_0xaa30('0x34')]!==_0x2aabf8){this[_0x2a59ce[_0x2da4da]+_0xaa30('0x35')]=_[_0xaa30('0x36')](moment()[_0xaa30('0x37')]('x'));}this[_0x2a59ce[_0x2da4da]+_0xaa30('0x34')]=_0x2aabf8;}var _0x43fb30={'id':this['id'],'name':this[_0xaa30('0x8')],'online':this[_0xaa30('0x9')],'voicePause':this[_0xaa30('0xa')],'chatPause':this[_0xaa30('0xb')],'mailPause':this[_0xaa30('0xc')],'smsPause':this[_0xaa30('0x38')],'faxPause':this[_0xaa30('0xd')],'openchannelPause':this[_0xaa30('0xe')],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0xaa30('0x11')],'chatCapacity':this[_0xaa30('0x12')],'chatCurrentCapacity':this[_0xaa30('0x13')],'mailStatus':this[_0xaa30('0x14')],'mailStatusTime':this[_0xaa30('0x39')],'mailCapacity':this[_0xaa30('0x15')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this['faxStatus'],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0xaa30('0x19')],'faxCurrentCapacity':this[_0xaa30('0x1a')],'smsStatus':this[_0xaa30('0x1b')],'smsStatusTime':this[_0xaa30('0x1c')],'smsCapacity':this[_0xaa30('0x3a')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0xaa30('0x3b')],'whatsappCapacity':this[_0xaa30('0x3c')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0xaa30('0x3d')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0xaa30('0x3e')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0xaa30('0x21')],'busyQueue':this[_0xaa30('0x22')],'chatWaitingInteractions':this['chatWaitingInteractions'],'faxWaitingInteractions':this[_0xaa30('0x24')],'mailWaitingInteractions':this[_0xaa30('0x3f')],'openchannelWaitingInteractions':this[_0xaa30('0x25')],'smsWaitingInteractions':this[_0xaa30('0x26')],'whatsappWaitingInteractions':this[_0xaa30('0x27')]};var _0x61c959=md5(JSON['stringify'](_0x43fb30));if(this[_0xaa30('0x1')]!==_0x61c959){this[_0xaa30('0x1')]=_0x61c959;io['emit'](_0xaa30('0x40'),_[_0xaa30('0x41')](_0x43fb30,[_0xaa30('0x9')]));}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index f8e8be1..fbf7050 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 _0x56ca=['updateRealtime','loggedIn','paused','online','chatPause','available','stringify','chat:queue:%s','chat_queue:save','exports','lodash','ioredis','redis','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','prototype','_rr','map'];(function(_0x2456b3,_0x4153a8){var _0x53bad2=function(_0x4fd383){while(--_0x4fd383){_0x2456b3['push'](_0x2456b3['shift']());}};_0x53bad2(++_0x4153a8);}(_0x56ca,0x1aa));var _0xa56c=function(_0x3891fa,_0x131e9a){_0x3891fa=_0x3891fa-0x0;var _0x4db281=_0x56ca[_0x3891fa];return _0x4db281;};'use strict';var _=require(_0xa56c('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0xa56c('0x1'));var config=require('../../../config/environment');config['redis']=_['defaults'](config[_0xa56c('0x2')],{'host':_0xa56c('0x3'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa56c('0x2')]));function ChatQueue(_0x3bd907){this['id']=_0x3bd907['id']||0x0;this[_0xa56c('0x4')]=_0x3bd907[_0xa56c('0x4')]||'';this['timeout']=_0x3bd907[_0xa56c('0x5')]||0xa;this[_0xa56c('0x6')]=_0x3bd907['strategy']||_0xa56c('0x7');this[_0xa56c('0x8')]=_0x3bd907[_0xa56c('0x8')];this[_0xa56c('0x9')]={};this[_0xa56c('0xa')]=0x0;this[_0xa56c('0xb')]='';this[_0xa56c('0xc')]();this['updateRealtime']();}ChatQueue[_0xa56c('0xd')][_0xa56c('0xc')]=function(){var _0x5ef478=this[_0xa56c('0x9')][_0xa56c('0xe')];this[_0xa56c('0x9')]=_[_0xa56c('0xf')](this[_0xa56c('0x8')],'id');this['mapAgentsId']['_rr']=_0x5ef478;};ChatQueue[_0xa56c('0xd')][_0xa56c('0x10')]=function(){this[_0xa56c('0x11')]=0x0;this[_0xa56c('0x12')]=0x0;for(var _0x29a388=0x0;_0x29a388=0x0?this[_0xa56c('0x15')]:0x0;var _0x2fc537={'id':this['id'],'available':this[_0xa56c('0x15')],'loggedIn':this[_0xa56c('0x11')],'name':this[_0xa56c('0x4')],'paused':this[_0xa56c('0x12')],'waiting':this[_0xa56c('0xa')]};var _0x553d47=md5(JSON[_0xa56c('0x16')](_0x2fc537));if(this['md5']!==_0x553d47){this[_0xa56c('0xb')]=_0x553d47;io['to'](util['format'](_0xa56c('0x17'),_0x2fc537[_0xa56c('0x4')]))['emit'](_0xa56c('0x18'),_0x2fc537);}};module[_0xa56c('0x19')]=ChatQueue; \ No newline at end of file +var _0x646d=['prototype','_rr','map','loggedIn','length','online','paused','available','waiting','stringify','format','chat:queue:%s','emit','exports','md5','ioredis','redis','name','timeout','strategy','Agents','mapAgentsId','updateRouting'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x646d,0x167));var _0xd646=function(_0x382b00,_0x2f4e63){_0x382b00=_0x382b00-0x0;var _0x4e66ff=_0x646d[_0x382b00];return _0x4e66ff;};'use strict';var _=require('lodash');var md5=require(_0xd646('0x0'));var util=require('util');var Redis=require(_0xd646('0x1'));var config=require('../../../config/environment');config[_0xd646('0x2')]=_['defaults'](config[_0xd646('0x2')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd646('0x2')]));function ChatQueue(_0x598a91){this['id']=_0x598a91['id']||0x0;this[_0xd646('0x3')]=_0x598a91['name']||'';this[_0xd646('0x4')]=_0x598a91[_0xd646('0x4')]||0xa;this[_0xd646('0x5')]=_0x598a91[_0xd646('0x5')]||'beepall';this['Agents']=_0x598a91[_0xd646('0x6')];this[_0xd646('0x7')]={};this['waiting']=0x0;this[_0xd646('0x0')]='';this[_0xd646('0x8')]();this['updateRealtime']();}ChatQueue[_0xd646('0x9')]['updateRouting']=function(){var _0x59f984=this[_0xd646('0x7')][_0xd646('0xa')];this[_0xd646('0x7')]=_[_0xd646('0xb')](this[_0xd646('0x6')],'id');this[_0xd646('0x7')][_0xd646('0xa')]=_0x59f984;};ChatQueue[_0xd646('0x9')]['updateRealtime']=function(){this[_0xd646('0xc')]=0x0;this['paused']=0x0;for(var _0x3e5c65=0x0;_0x3e5c65=0x0?this[_0xd646('0x10')]:0x0;var _0x1f36a3={'id':this['id'],'available':this[_0xd646('0x10')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0xd646('0xf')],'waiting':this[_0xd646('0x11')]};var _0xe00803=md5(JSON[_0xd646('0x12')](_0x1f36a3));if(this[_0xd646('0x0')]!==_0xe00803){this[_0xd646('0x0')]=_0xe00803;io['to'](util[_0xd646('0x13')](_0xd646('0x14'),_0x1f36a3[_0xd646('0x3')]))[_0xd646('0x15')]('chat_queue:save',_0x1f36a3);}};module[_0xd646('0x16')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index b4c5956..d5011ef 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 _0x1b92=['prototype','map','_rr','loggedIn','paused','length','online','available','stringify','emit','fax_queue:save','exports','lodash','md5','util','ioredis','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x47f719,_0x2e559d){var _0x407f4e=function(_0x2be03a){while(--_0x2be03a){_0x47f719['push'](_0x47f719['shift']());}};_0x407f4e(++_0x2e559d);}(_0x1b92,0x140));var _0x21b9=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x1b92[_0x1d1779];return _0x2377e9;};'use strict';var _=require(_0x21b9('0x0'));var md5=require(_0x21b9('0x1'));var util=require(_0x21b9('0x2'));var Redis=require(_0x21b9('0x3'));var config=require('../../../config/environment');config['redis']=_['defaults'](config[_0x21b9('0x4')],{'host':_0x21b9('0x5'),'port':0x18eb});var io=require(_0x21b9('0x6'))(new Redis(config['redis']));function FaxQueue(_0x4caced){this['id']=_0x4caced['id']||0x0;this[_0x21b9('0x7')]=_0x4caced[_0x21b9('0x7')]||'';this[_0x21b9('0x8')]=_0x4caced[_0x21b9('0x8')]||0xa;this[_0x21b9('0x9')]=_0x4caced[_0x21b9('0x9')]||_0x21b9('0xa');this[_0x21b9('0xb')]=_0x4caced[_0x21b9('0xb')];this[_0x21b9('0xc')]={};this[_0x21b9('0xd')]=0x0;this[_0x21b9('0x1')]='';this[_0x21b9('0xe')]();this[_0x21b9('0xf')]();}FaxQueue[_0x21b9('0x10')][_0x21b9('0xe')]=function(){var _0x57fca9=this['mapAgentsId']['_rr'];this[_0x21b9('0xc')]=_[_0x21b9('0x11')](this[_0x21b9('0xb')],'id');this[_0x21b9('0xc')][_0x21b9('0x12')]=_0x57fca9;};FaxQueue[_0x21b9('0x10')][_0x21b9('0xf')]=function(){this[_0x21b9('0x13')]=0x0;this[_0x21b9('0x14')]=0x0;for(var _0x391823=0x0;_0x391823=0x0?this[_0x21b9('0x17')]:0x0;var _0x3c73aa={'id':this['id'],'available':this[_0x21b9('0x17')],'loggedIn':this[_0x21b9('0x13')],'name':this['name'],'paused':this[_0x21b9('0x14')],'waiting':this['waiting']};var _0x2f8cb4=md5(JSON[_0x21b9('0x18')](_0x3c73aa));if(this[_0x21b9('0x1')]!==_0x2f8cb4){this[_0x21b9('0x1')]=_0x2f8cb4;io['to'](util['format']('fax:queue:%s',_0x3c73aa[_0x21b9('0x7')]))[_0x21b9('0x19')](_0x21b9('0x1a'),_0x3c73aa);}};module[_0x21b9('0x1b')]=FaxQueue; \ No newline at end of file +var _0x88af=['beepall','Agents','mapAgentsId','updateRouting','updateRealtime','_rr','map','prototype','loggedIn','paused','length','online','faxPause','available','waiting','stringify','fax:queue:%s','emit','fax_queue:save','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0x88af,0xfb));var _0xf88a=function(_0x5fe69a,_0x5484f5){_0x5fe69a=_0x5fe69a-0x0;var _0x3f1aee=_0x88af[_0x5fe69a];return _0x3f1aee;};'use strict';var _=require('lodash');var md5=require(_0xf88a('0x0'));var util=require(_0xf88a('0x1'));var Redis=require(_0xf88a('0x2'));var config=require(_0xf88a('0x3'));config[_0xf88a('0x4')]=_['defaults'](config[_0xf88a('0x4')],{'host':_0xf88a('0x5'),'port':0x18eb});var io=require(_0xf88a('0x6'))(new Redis(config[_0xf88a('0x4')]));function FaxQueue(_0x464a99){this['id']=_0x464a99['id']||0x0;this['name']=_0x464a99[_0xf88a('0x7')]||'';this[_0xf88a('0x8')]=_0x464a99[_0xf88a('0x8')]||0xa;this[_0xf88a('0x9')]=_0x464a99[_0xf88a('0x9')]||_0xf88a('0xa');this[_0xf88a('0xb')]=_0x464a99['Agents'];this[_0xf88a('0xc')]={};this['waiting']=0x0;this[_0xf88a('0x0')]='';this[_0xf88a('0xd')]();this[_0xf88a('0xe')]();}FaxQueue['prototype'][_0xf88a('0xd')]=function(){var _0x206a1a=this[_0xf88a('0xc')][_0xf88a('0xf')];this[_0xf88a('0xc')]=_[_0xf88a('0x10')](this[_0xf88a('0xb')],'id');this[_0xf88a('0xc')]['_rr']=_0x206a1a;};FaxQueue[_0xf88a('0x11')][_0xf88a('0xe')]=function(){this[_0xf88a('0x12')]=0x0;this[_0xf88a('0x13')]=0x0;for(var _0x22472d=0x0;_0x22472d=0x0?this[_0xf88a('0x17')]:0x0;var _0x44915a={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xf88a('0x7')],'paused':this['paused'],'waiting':this[_0xf88a('0x18')]};var _0x1f7fdd=md5(JSON[_0xf88a('0x19')](_0x44915a));if(this[_0xf88a('0x0')]!==_0x1f7fdd){this['md5']=_0x1f7fdd;io['to'](util['format'](_0xf88a('0x1a'),_0x44915a[_0xf88a('0x7')]))[_0xf88a('0x1b')](_0xf88a('0x1c'),_0x44915a);}};module['exports']=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index afd7aa9..832df7c 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 _0xc14e=['exports','name'];(function(_0x175bc6,_0xd90ea1){var _0x47cfc8=function(_0x1e4635){while(--_0x1e4635){_0x175bc6['push'](_0x175bc6['shift']());}};_0x47cfc8(++_0xd90ea1);}(_0xc14e,0x1e7));var _0xec14=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc14e[_0x3dd15e];return _0x231fd0;};'use strict';function Interval(_0x3dea88){this['id']=_0x3dea88['id']||0x0;this[_0xec14('0x0')]=_0x3dea88['name']||'';this['Intervals']=_0x3dea88['Intervals']||{};}module[_0xec14('0x1')]=Interval; \ No newline at end of file +var _0x23e8=['name','Intervals'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x23e8,0xb4));var _0x823e=function(_0x3f0f26,_0x1b9712){_0x3f0f26=_0x3f0f26-0x0;var _0x10aa73=_0x23e8[_0x3f0f26];return _0x10aa73;};'use strict';function Interval(_0x585053){this['id']=_0x585053['id']||0x0;this[_0x823e('0x0')]=_0x585053[_0x823e('0x0')]||'';this[_0x823e('0x1')]=_0x585053[_0x823e('0x1')]||{};}module['exports']=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 96f8771..4cdf5c4 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 _0x3149=['redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','length','online','mailPause','paused','available','format','mail:queue:%s','mail_queue:save','exports','md5'];(function(_0xb03acb,_0x2e9075){var _0x2e3fff=function(_0x14a82e){while(--_0x14a82e){_0xb03acb['push'](_0xb03acb['shift']());}};_0x2e3fff(++_0x2e9075);}(_0x3149,0xf9));var _0x9314=function(_0x4d869a,_0x24b078){_0x4d869a=_0x4d869a-0x0;var _0x3cbd66=_0x3149[_0x4d869a];return _0x3cbd66;};'use strict';var _=require('lodash');var md5=require(_0x9314('0x0'));var util=require('util');var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x9314('0x1')]=_['defaults'](config['redis'],{'host':_0x9314('0x2'),'port':0x18eb});var io=require(_0x9314('0x3'))(new Redis(config[_0x9314('0x1')]));function MailQueue(_0x57b8ff){this['id']=_0x57b8ff['id']||0x0;this[_0x9314('0x4')]=_0x57b8ff[_0x9314('0x4')]||'';this['timeout']=_0x57b8ff[_0x9314('0x5')]||0xa;this['strategy']=_0x57b8ff[_0x9314('0x6')]||'beepall';this[_0x9314('0x7')]=_0x57b8ff[_0x9314('0x7')];this[_0x9314('0x8')]={};this[_0x9314('0x9')]=0x0;this['md5']='';this[_0x9314('0xa')]();this[_0x9314('0xb')]();}MailQueue[_0x9314('0xc')][_0x9314('0xa')]=function(){var _0x186fdd=this[_0x9314('0x8')][_0x9314('0xd')];this[_0x9314('0x8')]=_[_0x9314('0xe')](this[_0x9314('0x7')],'id');this['mapAgentsId'][_0x9314('0xd')]=_0x186fdd;};MailQueue[_0x9314('0xc')]['updateRealtime']=function(){this[_0x9314('0xf')]=0x0;this['paused']=0x0;for(var _0x2ebc28=0x0;_0x2ebc28=0x0?this[_0x9314('0x14')]:0x0;var _0x1c0b19={'id':this['id'],'available':this[_0x9314('0x14')],'loggedIn':this[_0x9314('0xf')],'name':this[_0x9314('0x4')],'paused':this['paused'],'waiting':this[_0x9314('0x9')]};var _0x486ffd=md5(JSON['stringify'](_0x1c0b19));if(this['md5']!==_0x486ffd){this[_0x9314('0x0')]=_0x486ffd;io['to'](util[_0x9314('0x15')](_0x9314('0x16'),_0x1c0b19[_0x9314('0x4')]))['emit'](_0x9314('0x17'),_0x1c0b19);}};module[_0x9314('0x18')]=MailQueue; \ No newline at end of file +var _0x15d1=['socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','mailPause','available','stringify','mail:queue:%s','emit','mail_queue:save','exports','lodash','util','ioredis','../../../config/environment','redis','localhost'];(function(_0x50b9be,_0x557d57){var _0x3a2456=function(_0x4cf756){while(--_0x4cf756){_0x50b9be['push'](_0x50b9be['shift']());}};_0x3a2456(++_0x557d57);}(_0x15d1,0x1e7));var _0x115d=function(_0x44d40e,_0x385d76){_0x44d40e=_0x44d40e-0x0;var _0x49fa79=_0x15d1[_0x44d40e];return _0x49fa79;};'use strict';var _=require(_0x115d('0x0'));var md5=require('md5');var util=require(_0x115d('0x1'));var Redis=require(_0x115d('0x2'));var config=require(_0x115d('0x3'));config[_0x115d('0x4')]=_['defaults'](config[_0x115d('0x4')],{'host':_0x115d('0x5'),'port':0x18eb});var io=require(_0x115d('0x6'))(new Redis(config[_0x115d('0x4')]));function MailQueue(_0x552524){this['id']=_0x552524['id']||0x0;this[_0x115d('0x7')]=_0x552524[_0x115d('0x7')]||'';this[_0x115d('0x8')]=_0x552524[_0x115d('0x8')]||0xa;this[_0x115d('0x9')]=_0x552524[_0x115d('0x9')]||'beepall';this['Agents']=_0x552524[_0x115d('0xa')];this[_0x115d('0xb')]={};this[_0x115d('0xc')]=0x0;this[_0x115d('0xd')]='';this[_0x115d('0xe')]();this[_0x115d('0xf')]();}MailQueue[_0x115d('0x10')][_0x115d('0xe')]=function(){var _0x27b663=this[_0x115d('0xb')][_0x115d('0x11')];this[_0x115d('0xb')]=_[_0x115d('0x12')](this[_0x115d('0xa')],'id');this[_0x115d('0xb')][_0x115d('0x11')]=_0x27b663;};MailQueue[_0x115d('0x10')]['updateRealtime']=function(){this[_0x115d('0x13')]=0x0;this[_0x115d('0x14')]=0x0;for(var _0x3eedcd=0x0;_0x3eedcd=0x0?this['available']:0x0;var _0x6f16fc={'id':this['id'],'available':this[_0x115d('0x17')],'loggedIn':this[_0x115d('0x13')],'name':this[_0x115d('0x7')],'paused':this[_0x115d('0x14')],'waiting':this['waiting']};var _0x1cd994=md5(JSON[_0x115d('0x18')](_0x6f16fc));if(this[_0x115d('0xd')]!==_0x1cd994){this[_0x115d('0xd')]=_0x1cd994;io['to'](util['format'](_0x115d('0x19'),_0x6f16fc[_0x115d('0x7')]))[_0x115d('0x1a')](_0x115d('0x1b'),_0x6f16fc);}};module[_0x115d('0x1c')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index b51209a..ac45f34 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 _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(_0x22c0b9,_0x34d306){var _0x3e7ef8=function(_0x162e4b){while(--_0x162e4b){_0x22c0b9['push'](_0x22c0b9['shift']());}};_0x3e7ef8(++_0x34d306);}(_0x5fc3,0xa8));var _0x35fc=function(_0x2eac4f,_0x5173f9){_0x2eac4f=_0x2eac4f-0x0;var _0x58f73b=_0x5fc3[_0x2eac4f];return _0x58f73b;};'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 +var _0x2ef3=['stringify','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','timeout','strategy','beepall','Agents','mapAgentsId','waiting','prototype','updateRouting','_rr','paused','length','online','available','loggedIn','name'];(function(_0x33593e,_0x22ddd3){var _0x53db1a=function(_0x499ee5){while(--_0x499ee5){_0x33593e['push'](_0x33593e['shift']());}};_0x53db1a(++_0x22ddd3);}(_0x2ef3,0xba));var _0x32ef=function(_0x5a2a79,_0x1864b7){_0x5a2a79=_0x5a2a79-0x0;var _0x44fd9a=_0x2ef3[_0x5a2a79];return _0x44fd9a;};'use strict';var _=require(_0x32ef('0x0'));var md5=require(_0x32ef('0x1'));var util=require(_0x32ef('0x2'));var Redis=require(_0x32ef('0x3'));var config=require(_0x32ef('0x4'));config[_0x32ef('0x5')]=_['defaults'](config[_0x32ef('0x5')],{'host':_0x32ef('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x32ef('0x5')]));function OpenchannelQueue(_0x37dd1d){this['id']=_0x37dd1d['id']||0x0;this['name']=_0x37dd1d['name']||'';this[_0x32ef('0x7')]=_0x37dd1d[_0x32ef('0x7')]||0xa;this[_0x32ef('0x8')]=_0x37dd1d[_0x32ef('0x8')]||_0x32ef('0x9');this[_0x32ef('0xa')]=_0x37dd1d[_0x32ef('0xa')];this[_0x32ef('0xb')]={};this[_0x32ef('0xc')]=0x0;this[_0x32ef('0x1')]='';this['updateRouting']();this['updateRealtime']();}OpenchannelQueue[_0x32ef('0xd')][_0x32ef('0xe')]=function(){var _0x45bfd5=this[_0x32ef('0xb')]['_rr'];this[_0x32ef('0xb')]=_['map'](this[_0x32ef('0xa')],'id');this['mapAgentsId'][_0x32ef('0xf')]=_0x45bfd5;};OpenchannelQueue[_0x32ef('0xd')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x32ef('0x10')]=0x0;for(var _0x4d8009=0x0;_0x4d8009=0x0?this[_0x32ef('0x13')]:0x0;var _0x286bfb={'id':this['id'],'available':this['available'],'loggedIn':this[_0x32ef('0x14')],'name':this[_0x32ef('0x15')],'paused':this['paused'],'waiting':this[_0x32ef('0xc')]};var _0x314ef1=md5(JSON[_0x32ef('0x16')](_0x286bfb));if(this[_0x32ef('0x1')]!==_0x314ef1){this[_0x32ef('0x1')]=_0x314ef1;io['to'](util[_0x32ef('0x17')]('openchannel:queue:%s',_0x286bfb[_0x32ef('0x15')]))['emit'](_0x32ef('0x18'),_0x286bfb);}};module[_0x32ef('0x19')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 3e68cc0..d0850f4 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 _0xa8eb=['md5','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','available','stringify','format','sms:queue:%s','emit','sms_queue:save','exports','lodash','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting'];(function(_0x38e60c,_0x47ee30){var _0x24e3c4=function(_0x211397){while(--_0x211397){_0x38e60c['push'](_0x38e60c['shift']());}};_0x24e3c4(++_0x47ee30);}(_0xa8eb,0x179));var _0xba8e=function(_0x5773a7,_0x281e07){_0x5773a7=_0x5773a7-0x0;var _0x3f0cb4=_0xa8eb[_0x5773a7];return _0x3f0cb4;};'use strict';var _=require(_0xba8e('0x0'));var md5=require('md5');var util=require(_0xba8e('0x1'));var Redis=require('ioredis');var config=require(_0xba8e('0x2'));config[_0xba8e('0x3')]=_[_0xba8e('0x4')](config['redis'],{'host':_0xba8e('0x5'),'port':0x18eb});var io=require(_0xba8e('0x6'))(new Redis(config['redis']));function SmsQueue(_0x18a4d0){this['id']=_0x18a4d0['id']||0x0;this['name']=_0x18a4d0[_0xba8e('0x7')]||'';this['timeout']=_0x18a4d0[_0xba8e('0x8')]||0xa;this[_0xba8e('0x9')]=_0x18a4d0['strategy']||'beepall';this[_0xba8e('0xa')]=_0x18a4d0[_0xba8e('0xa')];this[_0xba8e('0xb')]={};this[_0xba8e('0xc')]=0x0;this[_0xba8e('0xd')]='';this[_0xba8e('0xe')]();this[_0xba8e('0xf')]();}SmsQueue[_0xba8e('0x10')][_0xba8e('0xe')]=function(){var _0x5142b1=this[_0xba8e('0xb')][_0xba8e('0x11')];this[_0xba8e('0xb')]=_[_0xba8e('0x12')](this[_0xba8e('0xa')],'id');this['mapAgentsId']['_rr']=_0x5142b1;};SmsQueue[_0xba8e('0x10')][_0xba8e('0xf')]=function(){this[_0xba8e('0x13')]=0x0;this[_0xba8e('0x14')]=0x0;for(var _0xec4952=0x0;_0xec4952=0x0?this[_0xba8e('0x17')]:0x0;var _0xbe34dc={'id':this['id'],'available':this[_0xba8e('0x17')],'loggedIn':this[_0xba8e('0x13')],'name':this[_0xba8e('0x7')],'paused':this[_0xba8e('0x14')],'waiting':this[_0xba8e('0xc')]};var _0x16284d=md5(JSON[_0xba8e('0x18')](_0xbe34dc));if(this[_0xba8e('0xd')]!==_0x16284d){this[_0xba8e('0xd')]=_0x16284d;io['to'](util[_0xba8e('0x19')](_0xba8e('0x1a'),_0xbe34dc[_0xba8e('0x7')]))[_0xba8e('0x1b')](_0xba8e('0x1c'),_0xbe34dc);}};module[_0xba8e('0x1d')]=SmsQueue; \ No newline at end of file +var _0x4746=['sms_queue:save','exports','lodash','md5','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','map','prototype','loggedIn','paused','length','online','available','waiting','format','sms:queue:%s','emit'];(function(_0xd85410,_0x28d0e5){var _0x472d4b=function(_0x3750b0){while(--_0x3750b0){_0xd85410['push'](_0xd85410['shift']());}};_0x472d4b(++_0x28d0e5);}(_0x4746,0xc6));var _0x6474=function(_0x5b910b,_0x446887){_0x5b910b=_0x5b910b-0x0;var _0x57d142=_0x4746[_0x5b910b];return _0x57d142;};'use strict';var _=require(_0x6474('0x0'));var md5=require(_0x6474('0x1'));var util=require('util');var Redis=require(_0x6474('0x2'));var config=require('../../../config/environment');config[_0x6474('0x3')]=_[_0x6474('0x4')](config[_0x6474('0x3')],{'host':_0x6474('0x5'),'port':0x18eb});var io=require(_0x6474('0x6'))(new Redis(config['redis']));function SmsQueue(_0x317100){this['id']=_0x317100['id']||0x0;this[_0x6474('0x7')]=_0x317100['name']||'';this[_0x6474('0x8')]=_0x317100[_0x6474('0x8')]||0xa;this[_0x6474('0x9')]=_0x317100[_0x6474('0x9')]||_0x6474('0xa');this[_0x6474('0xb')]=_0x317100['Agents'];this[_0x6474('0xc')]={};this['waiting']=0x0;this['md5']='';this[_0x6474('0xd')]();this[_0x6474('0xe')]();}SmsQueue['prototype'][_0x6474('0xd')]=function(){var _0x5867ab=this[_0x6474('0xc')]['_rr'];this[_0x6474('0xc')]=_[_0x6474('0xf')](this['Agents'],'id');this['mapAgentsId']['_rr']=_0x5867ab;};SmsQueue[_0x6474('0x10')][_0x6474('0xe')]=function(){this[_0x6474('0x11')]=0x0;this[_0x6474('0x12')]=0x0;for(var _0x113aba=0x0;_0x113aba=0x0?this[_0x6474('0x15')]:0x0;var _0x7585ed={'id':this['id'],'available':this[_0x6474('0x15')],'loggedIn':this[_0x6474('0x11')],'name':this[_0x6474('0x7')],'paused':this[_0x6474('0x12')],'waiting':this[_0x6474('0x16')]};var _0x47029c=md5(JSON['stringify'](_0x7585ed));if(this[_0x6474('0x1')]!==_0x47029c){this['md5']=_0x47029c;io['to'](util[_0x6474('0x17')](_0x6474('0x18'),_0x7585ed[_0x6474('0x7')]))[_0x6474('0x19')](_0x6474('0x1a'),_0x7585ed);}};module[_0x6474('0x1b')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index fe1bdb5..036a7b1 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 _0x54ca=['updateRouting','updateRealtime','prototype','_rr','loggedIn','length','online','paused','available','format','whatsapp_queue:save','exports','lodash','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','md5'];(function(_0x51a3bd,_0x1cc5ec){var _0x250def=function(_0x5bc0e6){while(--_0x5bc0e6){_0x51a3bd['push'](_0x51a3bd['shift']());}};_0x250def(++_0x1cc5ec);}(_0x54ca,0x1ac));var _0xa54c=function(_0x1627ae,_0x2aaa24){_0x1627ae=_0x1627ae-0x0;var _0x34b38f=_0x54ca[_0x1627ae];return _0x34b38f;};'use strict';var _=require(_0xa54c('0x0'));var md5=require('md5');var util=require(_0xa54c('0x1'));var Redis=require(_0xa54c('0x2'));var config=require(_0xa54c('0x3'));config[_0xa54c('0x4')]=_[_0xa54c('0x5')](config[_0xa54c('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xa54c('0x6'))(new Redis(config[_0xa54c('0x4')]));function WhatsappQueue(_0x29d9b1){this['id']=_0x29d9b1['id']||0x0;this['name']=_0x29d9b1[_0xa54c('0x7')]||'';this['timeout']=_0x29d9b1[_0xa54c('0x8')]||0xa;this[_0xa54c('0x9')]=_0x29d9b1[_0xa54c('0x9')]||_0xa54c('0xa');this[_0xa54c('0xb')]=_0x29d9b1[_0xa54c('0xb')];this[_0xa54c('0xc')]={};this['waiting']=0x0;this[_0xa54c('0xd')]='';this[_0xa54c('0xe')]();this[_0xa54c('0xf')]();}WhatsappQueue[_0xa54c('0x10')][_0xa54c('0xe')]=function(){var _0x4e3d9f=this[_0xa54c('0xc')][_0xa54c('0x11')];this[_0xa54c('0xc')]=_['map'](this[_0xa54c('0xb')],'id');this[_0xa54c('0xc')][_0xa54c('0x11')]=_0x4e3d9f;};WhatsappQueue['prototype'][_0xa54c('0xf')]=function(){this[_0xa54c('0x12')]=0x0;this['paused']=0x0;for(var _0x143d01=0x0;_0x143d01=0x0?this[_0xa54c('0x16')]:0x0;var _0x4a2367={'id':this['id'],'available':this[_0xa54c('0x16')],'loggedIn':this[_0xa54c('0x12')],'name':this['name'],'paused':this[_0xa54c('0x15')],'waiting':this['waiting']};var _0x4db205=md5(JSON['stringify'](_0x4a2367));if(this[_0xa54c('0xd')]!==_0x4db205){this[_0xa54c('0xd')]=_0x4db205;io['to'](util[_0xa54c('0x17')]('whatsapp:queue:%s',_0x4a2367[_0xa54c('0x7')]))['emit'](_0xa54c('0x18'),_0x4a2367);}};module[_0xa54c('0x19')]=WhatsappQueue; \ No newline at end of file +var _0x6b57=['redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','length','online','loggedIn','whatsappPause','paused','available','stringify','whatsapp:queue:%s','emit','exports','lodash','md5','ioredis','../../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6b57,0x1a0));var _0x76b5=function(_0x5e6cea,_0x47c539){_0x5e6cea=_0x5e6cea-0x0;var _0x450fd5=_0x6b57[_0x5e6cea];return _0x450fd5;};'use strict';var _=require(_0x76b5('0x0'));var md5=require(_0x76b5('0x1'));var util=require('util');var Redis=require(_0x76b5('0x2'));var config=require(_0x76b5('0x3'));config[_0x76b5('0x4')]=_[_0x76b5('0x5')](config['redis'],{'host':_0x76b5('0x6'),'port':0x18eb});var io=require(_0x76b5('0x7'))(new Redis(config['redis']));function WhatsappQueue(_0x77d616){this['id']=_0x77d616['id']||0x0;this[_0x76b5('0x8')]=_0x77d616[_0x76b5('0x8')]||'';this[_0x76b5('0x9')]=_0x77d616[_0x76b5('0x9')]||0xa;this[_0x76b5('0xa')]=_0x77d616[_0x76b5('0xa')]||_0x76b5('0xb');this['Agents']=_0x77d616[_0x76b5('0xc')];this[_0x76b5('0xd')]={};this[_0x76b5('0xe')]=0x0;this[_0x76b5('0x1')]='';this[_0x76b5('0xf')]();this[_0x76b5('0x10')]();}WhatsappQueue[_0x76b5('0x11')][_0x76b5('0xf')]=function(){var _0x328abe=this['mapAgentsId']['_rr'];this[_0x76b5('0xd')]=_['map'](this[_0x76b5('0xc')],'id');this[_0x76b5('0xd')]['_rr']=_0x328abe;};WhatsappQueue[_0x76b5('0x11')][_0x76b5('0x10')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x58a3aa=0x0;_0x58a3aa=0x0?this['available']:0x0;var _0x57e30b={'id':this['id'],'available':this[_0x76b5('0x17')],'loggedIn':this[_0x76b5('0x14')],'name':this[_0x76b5('0x8')],'paused':this[_0x76b5('0x16')],'waiting':this[_0x76b5('0xe')]};var _0x2a561e=md5(JSON[_0x76b5('0x18')](_0x57e30b));if(this[_0x76b5('0x1')]!==_0x2a561e){this[_0x76b5('0x1')]=_0x2a561e;io['to'](util['format'](_0x76b5('0x19'),_0x57e30b['name']))[_0x76b5('0x1a')]('whatsapp_queue:save',_0x57e30b);}};module[_0x76b5('0x1b')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 2ea93cf..2ae5819 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x49ca9a,_0x242175){var _0x2cebb6=function(_0x154fb9){while(--_0x154fb9){_0x49ca9a['push'](_0x49ca9a['shift']());}};_0x2cebb6(++_0x242175);}(_0xb10b,0x12a));var _0xbb10=function(_0x18fd21,_0x4af3d1){_0x18fd21=_0x18fd21-0x0;var _0x113f67=_0xb10b[_0x18fd21];return _0x113f67;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 690ded3..e3ff629 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 _0x9346=['UpdateChatInteraction','addTags','../client','update','Request'];(function(_0x3fd500,_0x47f5ef){var _0xe9d738=function(_0xc70dd2){while(--_0xc70dd2){_0x3fd500['push'](_0x3fd500['shift']());}};_0xe9d738(++_0x47f5ef);}(_0x9346,0x147));var _0x6934=function(_0x9e4ef2,_0x23d81b){_0x9e4ef2=_0x9e4ef2-0x0;var _0x2c9662=_0x9346[_0x9e4ef2];return _0x2c9662;};'use strict';var client=require(_0x6934('0x0'));exports[_0x6934('0x1')]=function(_0x19a9d6,_0x3680f6){return client[_0x6934('0x2')](_0x6934('0x3'),{'body':_0x3680f6,'options':{'where':{'id':_0x19a9d6}},'log':'updateChatInteraction'});};exports[_0x6934('0x4')]=function(_0x28168c,_0x16b5ab){return client['Request']('AddTagsToChatInteraction',{'body':_0x16b5ab,'options':{'where':{'id':_0x28168c}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x22d1=['Request','UpdateChatInteraction','addTags','addTagsToChatInteraction','../client','update'];(function(_0x4518e2,_0xdfa81a){var _0x565409=function(_0x1d8f8c){while(--_0x1d8f8c){_0x4518e2['push'](_0x4518e2['shift']());}};_0x565409(++_0xdfa81a);}(_0x22d1,0x1d8));var _0x122d=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x22d1[_0x3947c9];return _0x2e7871;};'use strict';var client=require(_0x122d('0x0'));exports[_0x122d('0x1')]=function(_0x12bb64,_0x4eadda){return client[_0x122d('0x2')](_0x122d('0x3'),{'body':_0x4eadda,'options':{'where':{'id':_0x12bb64}},'log':'updateChatInteraction'});};exports[_0x122d('0x4')]=function(_0x31d724,_0x1f3ab5){return client[_0x122d('0x2')]('AddTagsToChatInteraction',{'body':_0x1f3ab5,'options':{'where':{'id':_0x31d724}},'log':_0x122d('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 7613fae..8af00fc 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 _0xaa0a=['../client','create','Request','createChatMessage'];(function(_0x592ebe,_0x299ff7){var _0x58948d=function(_0x2cced2){while(--_0x2cced2){_0x592ebe['push'](_0x592ebe['shift']());}};_0x58948d(++_0x299ff7);}(_0xaa0a,0x68));var _0xaaa0=function(_0x5bfff8,_0x54b6d1){_0x5bfff8=_0x5bfff8-0x0;var _0x36567d=_0xaa0a[_0x5bfff8];return _0x36567d;};'use strict';var client=require(_0xaaa0('0x0'));exports[_0xaaa0('0x1')]=function(_0x1e76b9){return client[_0xaaa0('0x2')]('CreateChatMessage',{'body':_0x1e76b9,'log':_0xaaa0('0x3')});}; \ No newline at end of file +var _0x8e92=['create','Request','createChatMessage','../client'];(function(_0x3aeb8e,_0x1ed93b){var _0x18a3b8=function(_0x5f57fb){while(--_0x5f57fb){_0x3aeb8e['push'](_0x3aeb8e['shift']());}};_0x18a3b8(++_0x1ed93b);}(_0x8e92,0x1df));var _0x28e9=function(_0x4255a7,_0x3e1d08){_0x4255a7=_0x4255a7-0x0;var _0x2d0394=_0x8e92[_0x4255a7];return _0x2d0394;};'use strict';var client=require(_0x28e9('0x0'));exports[_0x28e9('0x1')]=function(_0x1c2cf1){return client[_0x28e9('0x2')]('CreateChatMessage',{'body':_0x1c2cf1,'log':_0x28e9('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 0dafbb4..ddaf963 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 _0xf483=['timeout','strategy','User','Agents','getChatQueues','GetChatQueue','name'];(function(_0x311788,_0x40476e){var _0xafa7b0=function(_0x33532b){while(--_0x33532b){_0x311788['push'](_0x311788['shift']());}};_0xafa7b0(++_0x40476e);}(_0xf483,0xf2));var _0x3f48=function(_0x1494fa,_0x266393){_0x1494fa=_0x1494fa-0x0;var _0x12a560=_0xf483[_0x1494fa];return _0x12a560;};'use strict';var client=require('../client');exports[_0x3f48('0x0')]=function(){return function(){return client['Request'](_0x3f48('0x1'),{'options':{'raw':![],'attributes':['id',_0x3f48('0x2'),_0x3f48('0x3'),_0x3f48('0x4')],'include':[{'model':_0x3f48('0x5'),'as':_0x3f48('0x6'),'attributes':['id','name','online','chatPause']}]},'log':_0x3f48('0x0')});};}; \ No newline at end of file +var _0xb458=['User','Agents','online','../client','getChatQueues','Request','timeout','strategy'];(function(_0x8f2ef8,_0x120371){var _0x59c8fd=function(_0xc5a001){while(--_0xc5a001){_0x8f2ef8['push'](_0x8f2ef8['shift']());}};_0x59c8fd(++_0x120371);}(_0xb458,0x103));var _0x8b45=function(_0xb98937,_0x5c2fec){_0xb98937=_0xb98937-0x0;var _0x6c1af7=_0xb458[_0xb98937];return _0x6c1af7;};'use strict';var client=require(_0x8b45('0x0'));exports[_0x8b45('0x1')]=function(){return function(){return client[_0x8b45('0x2')]('GetChatQueue',{'options':{'raw':![],'attributes':['id','name',_0x8b45('0x3'),_0x8b45('0x4')],'include':[{'model':_0x8b45('0x5'),'as':_0x8b45('0x6'),'attributes':['id','name',_0x8b45('0x7'),'chatPause']}]},'log':'getChatQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 8e6c958..2f742d8 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 _0x1d5b=['CreateChatQueueReport','update','Request','UpdateChatQueueReport','../client','create'];(function(_0x4022dc,_0x34bc6f){var _0x2d7f3e=function(_0x5aff0b){while(--_0x5aff0b){_0x4022dc['push'](_0x4022dc['shift']());}};_0x2d7f3e(++_0x34bc6f);}(_0x1d5b,0x13c));var _0xb1d5=function(_0x1ebd76,_0x2d62ec){_0x1ebd76=_0x1ebd76-0x0;var _0x31ad91=_0x1d5b[_0x1ebd76];return _0x31ad91;};'use strict';var client=require(_0xb1d5('0x0'));exports[_0xb1d5('0x1')]=function(_0x1a1089){return client['Request'](_0xb1d5('0x2'),{'body':_0x1a1089,'log':'CreateChatQueueReport'});};exports[_0xb1d5('0x3')]=function(_0x1a673c,_0xa12a1e){return client[_0xb1d5('0x4')]('UpdateChatQueueReport',{'body':_0xa12a1e,'options':{'where':{'uniqueid':_0x1a673c},'order':[['id','DESC']],'limit':0x1},'log':_0xb1d5('0x5')});}; \ No newline at end of file +var _0xfb3f=['DESC','../client','create','Request','update','UpdateChatQueueReport'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0xfb3f,0xd9));var _0xffb3=function(_0x89418c,_0x143e2d){_0x89418c=_0x89418c-0x0;var _0x5a2706=_0xfb3f[_0x89418c];return _0x5a2706;};'use strict';var client=require(_0xffb3('0x0'));exports[_0xffb3('0x1')]=function(_0x555a2b){return client[_0xffb3('0x2')]('CreateChatQueueReport',{'body':_0x555a2b,'log':'CreateChatQueueReport'});};exports[_0xffb3('0x3')]=function(_0x49acbf,_0x39dd2c){return client[_0xffb3('0x2')](_0xffb3('0x4'),{'body':_0x39dd2c,'options':{'where':{'uniqueid':_0x49acbf},'order':[['id',_0xffb3('0x5')]],'limit':0x1},'log':_0xffb3('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 49267fa..8adfb03 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x521929,_0x479be5){var _0x632436=function(_0x288290){while(--_0x288290){_0x521929['push'](_0x521929['shift']());}};_0x632436(++_0x479be5);}(_0x7a54,0x106));var _0x47a5=function(_0x39e61d,_0x3e1ffa){_0x39e61d=_0x39e61d-0x0;var _0x569e15=_0x7a54[_0x39e61d];return _0x569e15;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x3b5250,_0x7a0b2c){var _0xc844a1=function(_0x2fbc98){while(--_0x2fbc98){_0x3b5250['push'](_0x3b5250['shift']());}};_0xc844a1(++_0x7a0b2c);}(_0x7a54,0x106));var _0x47a5=function(_0x174bbe,_0x5629b1){_0x174bbe=_0x174bbe-0x0;var _0x5ad65b=_0x7a54[_0x174bbe];return _0x5ad65b;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 702f205..db4fb4e 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 _0x2b01=['CreateFaxMessage','../client'];(function(_0x561cfe,_0xd4fee3){var _0x4e2325=function(_0x17c610){while(--_0x17c610){_0x561cfe['push'](_0x561cfe['shift']());}};_0x4e2325(++_0xd4fee3);}(_0x2b01,0x19f));var _0x12b0=function(_0x49df75,_0xe598c0){_0x49df75=_0x49df75-0x0;var _0x40173c=_0x2b01[_0x49df75];return _0x40173c;};'use strict';var client=require(_0x12b0('0x0'));exports['create']=function(_0x49bb29){return client['Request'](_0x12b0('0x1'),{'body':_0x49bb29,'log':'createFaxMessage'});}; \ No newline at end of file +var _0xd721=['createFaxMessage','../client','create','Request','CreateFaxMessage'];(function(_0x50efbe,_0xab1fc){var _0x506cbc=function(_0x3a99c8){while(--_0x3a99c8){_0x50efbe['push'](_0x50efbe['shift']());}};_0x506cbc(++_0xab1fc);}(_0xd721,0x97));var _0x1d72=function(_0x691ee1,_0x236247){_0x691ee1=_0x691ee1-0x0;var _0x58ec13=_0xd721[_0x691ee1];return _0x58ec13;};'use strict';var client=require(_0x1d72('0x0'));exports[_0x1d72('0x1')]=function(_0x5e6a9d){return client[_0x1d72('0x2')](_0x1d72('0x3'),{'body':_0x5e6a9d,'log':_0x1d72('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 906f62c..df0e95c 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 _0x8bcb=['../client','getFaxQueues','GetFaxQueue','name','timeout','strategy','User','online'];(function(_0x94cd8,_0x80691a){var _0x5572f4=function(_0x2cae9b){while(--_0x2cae9b){_0x94cd8['push'](_0x94cd8['shift']());}};_0x5572f4(++_0x80691a);}(_0x8bcb,0x150));var _0xb8bc=function(_0x306ae0,_0x2dcabd){_0x306ae0=_0x306ae0-0x0;var _0x510d7c=_0x8bcb[_0x306ae0];return _0x510d7c;};'use strict';var client=require(_0xb8bc('0x0'));exports[_0xb8bc('0x1')]=function(){return function(){return client['Request'](_0xb8bc('0x2'),{'options':{'raw':![],'attributes':['id',_0xb8bc('0x3'),_0xb8bc('0x4'),_0xb8bc('0x5')],'include':[{'model':_0xb8bc('0x6'),'as':'Agents','attributes':['id',_0xb8bc('0x3'),_0xb8bc('0x7'),'faxPause']}]},'log':'getFaxQueues'});};}; \ No newline at end of file +var _0xc29e=['faxPause','Request','GetFaxQueue','name','timeout','strategy','User','online'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc29e,0x1c9));var _0xec29=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0xc29e[_0x16d10f];return _0x50c823;};'use strict';var client=require('../client');exports['getFaxQueues']=function(){return function(){return client[_0xec29('0x0')](_0xec29('0x1'),{'options':{'raw':![],'attributes':['id',_0xec29('0x2'),_0xec29('0x3'),_0xec29('0x4')],'include':[{'model':_0xec29('0x5'),'as':'Agents','attributes':['id',_0xec29('0x2'),_0xec29('0x6'),_0xec29('0x7')]}]},'log':'getFaxQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 4b2677a..fc223e2 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 _0x7a6f=['CreateFaxQueueReport','UpdateFaxQueueReport','DESC','../client','Request'];(function(_0x34e752,_0x32e2a2){var _0x7c6347=function(_0x4db671){while(--_0x4db671){_0x34e752['push'](_0x34e752['shift']());}};_0x7c6347(++_0x32e2a2);}(_0x7a6f,0x148));var _0xf7a6=function(_0x4e49f3,_0x2c29a4){_0x4e49f3=_0x4e49f3-0x0;var _0x4b3bc9=_0x7a6f[_0x4e49f3];return _0x4b3bc9;};'use strict';var client=require(_0xf7a6('0x0'));exports['create']=function(_0x559dac){return client[_0xf7a6('0x1')](_0xf7a6('0x2'),{'body':_0x559dac,'log':_0xf7a6('0x2')});};exports['update']=function(_0x1932f9,_0x408067){return client[_0xf7a6('0x1')](_0xf7a6('0x3'),{'body':_0x408067,'options':{'where':{'uniqueid':_0x1932f9},'order':[['id',_0xf7a6('0x4')]],'limit':0x1},'log':_0xf7a6('0x3')});}; \ No newline at end of file +var _0x0d70=['UpdateFaxQueueReport','DESC','../client','CreateFaxQueueReport','update'];(function(_0x3ca7a7,_0xc351ba){var _0x437609=function(_0x4f48ff){while(--_0x4f48ff){_0x3ca7a7['push'](_0x3ca7a7['shift']());}};_0x437609(++_0xc351ba);}(_0x0d70,0x6b));var _0x00d7=function(_0x499357,_0x585ed0){_0x499357=_0x499357-0x0;var _0x4e704c=_0x0d70[_0x499357];return _0x4e704c;};'use strict';var client=require(_0x00d7('0x0'));exports['create']=function(_0x2665f3){return client['Request'](_0x00d7('0x1'),{'body':_0x2665f3,'log':_0x00d7('0x1')});};exports[_0x00d7('0x2')]=function(_0x3351c5,_0x4aabf3){return client['Request'](_0x00d7('0x3'),{'body':_0x4aabf3,'options':{'where':{'uniqueid':_0x3351c5},'order':[['id',_0x00d7('0x4')]],'limit':0x1},'log':_0x00d7('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 71c4202..2acf4bd 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 _0x7f1e=['Request','Interval','Intervals','interval','../client','getIntervals'];(function(_0x26b08d,_0xa50004){var _0x1711e6=function(_0x28a79c){while(--_0x28a79c){_0x26b08d['push'](_0x26b08d['shift']());}};_0x1711e6(++_0xa50004);}(_0x7f1e,0xf4));var _0xe7f1=function(_0x34c096,_0x2a5764){_0x34c096=_0x34c096-0x0;var _0x112660=_0x7f1e[_0x34c096];return _0x112660;};'use strict';var client=require(_0xe7f1('0x0'));exports[_0xe7f1('0x1')]=function(){return function(){return client[_0xe7f1('0x2')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0xe7f1('0x3'),'as':_0xe7f1('0x4'),'attributes':['id','name',_0xe7f1('0x5')]}]},'log':_0xe7f1('0x1')});};}; \ No newline at end of file +var _0x498f=['name','Interval','Intervals','interval','../client','getIntervals'];(function(_0xd4e198,_0x23428c){var _0x10d780=function(_0x5c7b22){while(--_0x5c7b22){_0xd4e198['push'](_0xd4e198['shift']());}};_0x10d780(++_0x23428c);}(_0x498f,0x130));var _0xf498=function(_0x15fada,_0x340afc){_0x15fada=_0x15fada-0x0;var _0x231c64=_0x498f[_0x15fada];return _0x231c64;};'use strict';var client=require(_0xf498('0x0'));exports[_0xf498('0x1')]=function(){return function(){return client['Request']('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xf498('0x2')],'include':[{'model':_0xf498('0x3'),'as':_0xf498('0x4'),'attributes':['id',_0xf498('0x2'),_0xf498('0x5')]}]},'log':'getIntervals'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index d54c3dc..de939de 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 _0x7708=['update','AddTagsToMailInteraction','../client'];(function(_0x2c5d58,_0x2b7f72){var _0x2b42c1=function(_0x5a121b){while(--_0x5a121b){_0x2c5d58['push'](_0x2c5d58['shift']());}};_0x2b42c1(++_0x2b7f72);}(_0x7708,0x188));var _0x8770=function(_0x195577,_0x5de53a){_0x195577=_0x195577-0x0;var _0x13c367=_0x7708[_0x195577];return _0x13c367;};'use strict';var client=require(_0x8770('0x0'));exports[_0x8770('0x1')]=function(_0x5ce108,_0x141ddf){return client['Request']('UpdateMailInteraction',{'body':_0x141ddf,'options':{'where':{'id':_0x5ce108}},'log':'updateMailInteraction'});};exports['addTags']=function(_0x182d52,_0x1a796d){return client['Request'](_0x8770('0x2'),{'body':_0x1a796d,'options':{'where':{'id':_0x182d52}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0xdd4f=['../client','Request','UpdateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction'];(function(_0x36dfbd,_0x5bfe2d){var _0x4ecad9=function(_0x5230da){while(--_0x5230da){_0x36dfbd['push'](_0x36dfbd['shift']());}};_0x4ecad9(++_0x5bfe2d);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x133a8a,_0x33f10c){_0x133a8a=_0x133a8a-0x0;var _0x10c682=_0xdd4f[_0x133a8a];return _0x10c682;};'use strict';var client=require(_0xfdd4('0x0'));exports['update']=function(_0x5656ab,_0x55d8f9){return client[_0xfdd4('0x1')](_0xfdd4('0x2'),{'body':_0x55d8f9,'options':{'where':{'id':_0x5656ab}},'log':'updateMailInteraction'});};exports[_0xfdd4('0x3')]=function(_0x3175f6,_0x6b2b0d){return client['Request'](_0xfdd4('0x4'),{'body':_0x6b2b0d,'options':{'where':{'id':_0x3175f6}},'log':_0xfdd4('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index f2b4996..329b0e5 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 _0xe456=['create','createMailMessage','../client'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xe456,0x16d));var _0x6e45=function(_0x3c9829,_0x176af1){_0x3c9829=_0x3c9829-0x0;var _0x27d67c=_0xe456[_0x3c9829];return _0x27d67c;};'use strict';var client=require(_0x6e45('0x0'));exports[_0x6e45('0x1')]=function(_0xbc1fd9){return client['Request']('CreateMailMessage',{'body':_0xbc1fd9,'log':_0x6e45('0x2')});}; \ No newline at end of file +var _0xd4d1=['CreateMailMessage','createMailMessage','../client','create'];(function(_0x44a455,_0x1abf78){var _0x240ec8=function(_0xdfd446){while(--_0xdfd446){_0x44a455['push'](_0x44a455['shift']());}};_0x240ec8(++_0x1abf78);}(_0xd4d1,0xfa));var _0x1d4d=function(_0x34cd14,_0x173ccd){_0x34cd14=_0x34cd14-0x0;var _0x519497=_0xd4d1[_0x34cd14];return _0x519497;};'use strict';var client=require(_0x1d4d('0x0'));exports[_0x1d4d('0x1')]=function(_0x3b4612){return client['Request'](_0x1d4d('0x2'),{'body':_0x3b4612,'log':_0x1d4d('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 7b55d4c..045f617 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 _0xdd66=['GetMailQueue','timeout','strategy','Agents','name','online','mailPause','getMailQueues','Request'];(function(_0x21f5e6,_0xa4a81b){var _0x181163=function(_0x2337e8){while(--_0x2337e8){_0x21f5e6['push'](_0x21f5e6['shift']());}};_0x181163(++_0xa4a81b);}(_0xdd66,0xd6));var _0x6dd6=function(_0x655298,_0x5ca950){_0x655298=_0x655298-0x0;var _0x3c5bb8=_0xdd66[_0x655298];return _0x3c5bb8;};'use strict';var client=require('../client');exports[_0x6dd6('0x0')]=function(){return function(){return client[_0x6dd6('0x1')](_0x6dd6('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x6dd6('0x3'),_0x6dd6('0x4')],'include':[{'model':'User','as':_0x6dd6('0x5'),'attributes':['id',_0x6dd6('0x6'),_0x6dd6('0x7'),_0x6dd6('0x8')]}]},'log':'getMailQueues'});};}; \ No newline at end of file +var _0x8412=['getMailQueues','Request','GetMailQueue','name','timeout','strategy','online','mailPause','../client'];(function(_0xe15270,_0x227d06){var _0x1e813b=function(_0x1d590d){while(--_0x1d590d){_0xe15270['push'](_0xe15270['shift']());}};_0x1e813b(++_0x227d06);}(_0x8412,0xbc));var _0x2841=function(_0xb0fe92,_0x147e42){_0xb0fe92=_0xb0fe92-0x0;var _0x41787f=_0x8412[_0xb0fe92];return _0x41787f;};'use strict';var client=require(_0x2841('0x0'));exports[_0x2841('0x1')]=function(){return function(){return client[_0x2841('0x2')](_0x2841('0x3'),{'options':{'raw':![],'attributes':['id',_0x2841('0x4'),_0x2841('0x5'),_0x2841('0x6')],'include':[{'model':'User','as':'Agents','attributes':['id',_0x2841('0x4'),_0x2841('0x7'),_0x2841('0x8')]}]},'log':_0x2841('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 4e383f5..86987cb 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 _0xac5d=['update','UpdateMailQueueReport','DESC','create','CreateMailQueueReport'];(function(_0x19b84f,_0x48765e){var _0x18067b=function(_0x1c69aa){while(--_0x1c69aa){_0x19b84f['push'](_0x19b84f['shift']());}};_0x18067b(++_0x48765e);}(_0xac5d,0xf8));var _0xdac5=function(_0x1dcbc6,_0x219d61){_0x1dcbc6=_0x1dcbc6-0x0;var _0x1a0893=_0xac5d[_0x1dcbc6];return _0x1a0893;};'use strict';var client=require('../client');exports[_0xdac5('0x0')]=function(_0x326554){return client['Request'](_0xdac5('0x1'),{'body':_0x326554,'log':_0xdac5('0x1')});};exports[_0xdac5('0x2')]=function(_0xf273f7,_0x1ca712){return client['Request'](_0xdac5('0x3'),{'body':_0x1ca712,'options':{'where':{'uniqueid':_0xf273f7},'order':[['id',_0xdac5('0x4')]],'limit':0x1},'log':_0xdac5('0x3')});}; \ No newline at end of file +var _0x4b56=['CreateMailQueueReport','update','UpdateMailQueueReport','DESC','../client','create','Request'];(function(_0x119629,_0x246787){var _0x49a771=function(_0x23624c){while(--_0x23624c){_0x119629['push'](_0x119629['shift']());}};_0x49a771(++_0x246787);}(_0x4b56,0xc8));var _0x64b5=function(_0x34d275,_0x5d84ee){_0x34d275=_0x34d275-0x0;var _0x1379cc=_0x4b56[_0x34d275];return _0x1379cc;};'use strict';var client=require(_0x64b5('0x0'));exports[_0x64b5('0x1')]=function(_0x4231e6){return client[_0x64b5('0x2')](_0x64b5('0x3'),{'body':_0x4231e6,'log':_0x64b5('0x3')});};exports[_0x64b5('0x4')]=function(_0x3b51be,_0x3db2f9){return client[_0x64b5('0x2')](_0x64b5('0x5'),{'body':_0x3db2f9,'options':{'where':{'uniqueid':_0x3b51be},'order':[['id',_0x64b5('0x6')]],'limit':0x1},'log':_0x64b5('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index b6b70c5..ccbee95 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 _0xec70=['AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','Request','UpdateOpenchannelInteraction'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xec70,0x66));var _0x0ec7=function(_0x1442aa,_0x43f8c4){_0x1442aa=_0x1442aa-0x0;var _0x4f2d0d=_0xec70[_0x1442aa];return _0x4f2d0d;};'use strict';var client=require(_0x0ec7('0x0'));exports['update']=function(_0x4c15a9,_0x1512ec){return client[_0x0ec7('0x1')](_0x0ec7('0x2'),{'body':_0x1512ec,'options':{'where':{'id':_0x4c15a9}},'log':'updateOpenchannelInteraction'});};exports['addTags']=function(_0x5cbc0c,_0x42b951){return client[_0x0ec7('0x1')](_0x0ec7('0x3'),{'body':_0x42b951,'options':{'where':{'id':_0x5cbc0c}},'log':_0x0ec7('0x4')});}; \ No newline at end of file +var _0x76f8=['Request','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','update','UpdateOpenchannelInteraction','updateOpenchannelInteraction'];(function(_0x4ec612,_0x57dfd6){var _0x52a015=function(_0x2771d1){while(--_0x2771d1){_0x4ec612['push'](_0x4ec612['shift']());}};_0x52a015(++_0x57dfd6);}(_0x76f8,0x147));var _0x876f=function(_0x47855d,_0x513af3){_0x47855d=_0x47855d-0x0;var _0x177bf9=_0x76f8[_0x47855d];return _0x177bf9;};'use strict';var client=require('../client');exports[_0x876f('0x0')]=function(_0x402311,_0x48d36a){return client['Request'](_0x876f('0x1'),{'body':_0x48d36a,'options':{'where':{'id':_0x402311}},'log':_0x876f('0x2')});};exports['addTags']=function(_0x25ed82,_0xb5638b){return client[_0x876f('0x3')](_0x876f('0x4'),{'body':_0xb5638b,'options':{'where':{'id':_0x25ed82}},'log':_0x876f('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 702bdd9..6f734b1 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 _0xeb15=['Request','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xeb15,0x111));var _0x5eb1=function(_0x5a558e,_0x2c0473){_0x5a558e=_0x5a558e-0x0;var _0x44eb26=_0xeb15[_0x5a558e];return _0x44eb26;};'use strict';var client=require('../client');exports[_0x5eb1('0x0')]=function(_0x69cd4f){return client[_0x5eb1('0x1')]('CreateOpenchannelMessage',{'body':_0x69cd4f,'log':'createOpenchannelMessage'});}; \ No newline at end of file +var _0x1ec7=['createOpenchannelMessage','create','Request','CreateOpenchannelMessage'];(function(_0x3dcbdf,_0x5ce48d){var _0x434ae3=function(_0x4e593f){while(--_0x4e593f){_0x3dcbdf['push'](_0x3dcbdf['shift']());}};_0x434ae3(++_0x5ce48d);}(_0x1ec7,0x169));var _0x71ec=function(_0x32621d,_0x41ad8f){_0x32621d=_0x32621d-0x0;var _0xd71a95=_0x1ec7[_0x32621d];return _0xd71a95;};'use strict';var client=require('../client');exports[_0x71ec('0x0')]=function(_0x450771){return client[_0x71ec('0x1')](_0x71ec('0x2'),{'body':_0x450771,'log':_0x71ec('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index fe6140e..60a3785 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 _0x0fa4=['getOpenchannelQueues','Request','GetOpenchannelQueue','timeout','strategy','User','online','openchannelPause'];(function(_0x336a86,_0x27579d){var _0x362a97=function(_0x2074cf){while(--_0x2074cf){_0x336a86['push'](_0x336a86['shift']());}};_0x362a97(++_0x27579d);}(_0x0fa4,0x150));var _0x40fa=function(_0x3a4a61,_0x1cd102){_0x3a4a61=_0x3a4a61-0x0;var _0x252887=_0x0fa4[_0x3a4a61];return _0x252887;};'use strict';var client=require('../client');exports[_0x40fa('0x0')]=function(){return function(){return client[_0x40fa('0x1')](_0x40fa('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x40fa('0x3'),_0x40fa('0x4')],'include':[{'model':_0x40fa('0x5'),'as':'Agents','attributes':['id','name',_0x40fa('0x6'),_0x40fa('0x7')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file +var _0x2b60=['online','openchannelPause','getOpenchannelQueues','../client','Request','GetOpenchannelQueue','name','timeout','strategy','User'];(function(_0x3b5683,_0x15891d){var _0x4142b2=function(_0x514971){while(--_0x514971){_0x3b5683['push'](_0x3b5683['shift']());}};_0x4142b2(++_0x15891d);}(_0x2b60,0x189));var _0x02b6=function(_0x36d0d0,_0x3b69e6){_0x36d0d0=_0x36d0d0-0x0;var _0xedf304=_0x2b60[_0x36d0d0];return _0xedf304;};'use strict';var client=require(_0x02b6('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client[_0x02b6('0x1')](_0x02b6('0x2'),{'options':{'raw':![],'attributes':['id',_0x02b6('0x3'),_0x02b6('0x4'),_0x02b6('0x5')],'include':[{'model':_0x02b6('0x6'),'as':'Agents','attributes':['id','name',_0x02b6('0x7'),_0x02b6('0x8')]}]},'log':_0x02b6('0x9')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 95a421e..c74ae17 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 _0x61d7=['Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC','../client'];(function(_0x3a42a5,_0x2d364a){var _0x3d2051=function(_0x3a1478){while(--_0x3a1478){_0x3a42a5['push'](_0x3a42a5['shift']());}};_0x3d2051(++_0x2d364a);}(_0x61d7,0xef));var _0x761d=function(_0x3c45a9,_0x2ac708){_0x3c45a9=_0x3c45a9-0x0;var _0x1ed498=_0x61d7[_0x3c45a9];return _0x1ed498;};'use strict';var client=require(_0x761d('0x0'));exports['create']=function(_0x107634){return client[_0x761d('0x1')]('CreateOpenchannelQueueReport',{'body':_0x107634,'log':_0x761d('0x2')});};exports[_0x761d('0x3')]=function(_0xd64796,_0x18feea){return client['Request'](_0x761d('0x4'),{'body':_0x18feea,'options':{'where':{'uniqueid':_0xd64796},'order':[['id',_0x761d('0x5')]],'limit':0x1},'log':_0x761d('0x4')});}; \ No newline at end of file +var _0xbafb=['Request','CreateOpenchannelQueueReport','update','DESC'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbafb,0xf0));var _0xbbaf=function(_0x102a94,_0x3039ff){_0x102a94=_0x102a94-0x0;var _0x24405a=_0xbafb[_0x102a94];return _0x24405a;};'use strict';var client=require('../client');exports['create']=function(_0x5c6764){return client[_0xbbaf('0x0')](_0xbbaf('0x1'),{'body':_0x5c6764,'log':_0xbbaf('0x1')});};exports[_0xbbaf('0x2')]=function(_0x20beb6,_0x288a3f){return client[_0xbbaf('0x0')]('UpdateOpenchannelQueueReport',{'body':_0x288a3f,'options':{'where':{'uniqueid':_0x20beb6},'order':[['id',_0xbbaf('0x3')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 1960b67..8bca116 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 _0xca8d=['update','Request','UpdateSmsInteraction','updateSmsInteraction','addTags','AddTagsToSmsInteraction','../client'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0xca8d,0x172));var _0xdca8=function(_0x5d19f8,_0x56a7bb){_0x5d19f8=_0x5d19f8-0x0;var _0x42e896=_0xca8d[_0x5d19f8];return _0x42e896;};'use strict';var client=require(_0xdca8('0x0'));exports[_0xdca8('0x1')]=function(_0xeea658,_0x14a797){return client[_0xdca8('0x2')](_0xdca8('0x3'),{'body':_0x14a797,'options':{'where':{'id':_0xeea658}},'log':_0xdca8('0x4')});};exports[_0xdca8('0x5')]=function(_0x9e965e,_0x3bae79){return client[_0xdca8('0x2')](_0xdca8('0x6'),{'body':_0x3bae79,'options':{'where':{'id':_0x9e965e}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file +var _0xe107=['Request','updateSmsInteraction','AddTagsToSmsInteraction','../client'];(function(_0x3973fc,_0x2846a6){var _0x233b35=function(_0x3f9d0b){while(--_0x3f9d0b){_0x3973fc['push'](_0x3973fc['shift']());}};_0x233b35(++_0x2846a6);}(_0xe107,0xb3));var _0x7e10=function(_0x5ca5db,_0x37feae){_0x5ca5db=_0x5ca5db-0x0;var _0xd6bfa7=_0xe107[_0x5ca5db];return _0xd6bfa7;};'use strict';var client=require(_0x7e10('0x0'));exports['update']=function(_0x2ae2a8,_0x73dc05){return client[_0x7e10('0x1')]('UpdateSmsInteraction',{'body':_0x73dc05,'options':{'where':{'id':_0x2ae2a8}},'log':_0x7e10('0x2')});};exports['addTags']=function(_0x4db676,_0x2bdf3c){return client[_0x7e10('0x1')](_0x7e10('0x3'),{'body':_0x2bdf3c,'options':{'where':{'id':_0x4db676}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 7ecf6bd..e342362 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 _0x6067=['create','createSmsMessage','../client'];(function(_0x30fa87,_0x3433b5){var _0x49e5eb=function(_0x565757){while(--_0x565757){_0x30fa87['push'](_0x30fa87['shift']());}};_0x49e5eb(++_0x3433b5);}(_0x6067,0x6b));var _0x7606=function(_0x2be466,_0x532c10){_0x2be466=_0x2be466-0x0;var _0x22f9d3=_0x6067[_0x2be466];return _0x22f9d3;};'use strict';var client=require(_0x7606('0x0'));exports[_0x7606('0x1')]=function(_0x2e3783){return client['Request']('CreateSmsMessage',{'body':_0x2e3783,'log':_0x7606('0x2')});}; \ No newline at end of file +var _0xbe5f=['CreateSmsMessage','create','Request'];(function(_0xaf8aee,_0x1c2c89){var _0x56e697=function(_0x140265){while(--_0x140265){_0xaf8aee['push'](_0xaf8aee['shift']());}};_0x56e697(++_0x1c2c89);}(_0xbe5f,0xee));var _0xfbe5=function(_0x142108,_0x4d62e1){_0x142108=_0x142108-0x0;var _0x5f09ec=_0xbe5f[_0x142108];return _0x5f09ec;};'use strict';var client=require('../client');exports[_0xfbe5('0x0')]=function(_0xf9febc){return client[_0xfbe5('0x1')](_0xfbe5('0x2'),{'body':_0xf9febc,'log':'createSmsMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index c2bf3ed..17840da 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 _0x0713=['getSmsQueues','Request','GetSmsQueue','name','timeout','strategy','Agents','online','smsPause'];(function(_0x4c445a,_0x4ee80f){var _0x2f611c=function(_0x4f3699){while(--_0x4f3699){_0x4c445a['push'](_0x4c445a['shift']());}};_0x2f611c(++_0x4ee80f);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':![],'attributes':['id',_0x3071('0x2'),_0x3071('0x3'),_0x3071('0x4')],'include':[{'model':'User','as':_0x3071('0x5'),'attributes':['id',_0x3071('0x2'),_0x3071('0x6'),_0x3071('0x7')]}]},'log':_0x3071('0x8')});};}; \ No newline at end of file +var _0xcb91=['smsPause','Request','GetSmsQueue','name','timeout','User','Agents','online'];(function(_0xdae954,_0x4669c6){var _0x336619=function(_0x1500eb){while(--_0x1500eb){_0xdae954['push'](_0xdae954['shift']());}};_0x336619(++_0x4669c6);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x476c7,_0x298ee0){_0x476c7=_0x476c7-0x0;var _0x47ae56=_0xcb91[_0x476c7];return _0x47ae56;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x1cb9('0x0')](_0x1cb9('0x1'),{'options':{'raw':![],'attributes':['id',_0x1cb9('0x2'),_0x1cb9('0x3'),'strategy'],'include':[{'model':_0x1cb9('0x4'),'as':_0x1cb9('0x5'),'attributes':['id','name',_0x1cb9('0x6'),_0x1cb9('0x7')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index e8de6b2..4114213 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(_0x67c910,_0x47114d){var _0x4085f0=function(_0x5165f7){while(--_0x5165f7){_0x67c910['push'](_0x67c910['shift']());}};_0x4085f0(++_0x47114d);}(_0x9c44,0x178));var _0x49c4=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x9c44[_0x167cc1];return _0x10bc4b;};'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 _0x34e8=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC','../client'];(function(_0x590515,_0x21f8c7){var _0x58e255=function(_0x4a2766){while(--_0x4a2766){_0x590515['push'](_0x590515['shift']());}};_0x58e255(++_0x21f8c7);}(_0x34e8,0x12c));var _0x834e=function(_0x301392,_0x356074){_0x301392=_0x301392-0x0;var _0x1e62ab=_0x34e8[_0x301392];return _0x1e62ab;};'use strict';var client=require(_0x834e('0x0'));exports[_0x834e('0x1')]=function(_0x8b339){return client[_0x834e('0x2')]('CreateSmsQueueReport',{'body':_0x8b339,'log':_0x834e('0x3')});};exports[_0x834e('0x4')]=function(_0x472111,_0x31bf20){return client[_0x834e('0x2')](_0x834e('0x5'),{'body':_0x31bf20,'options':{'where':{'uniqueid':_0x472111},'order':[['id',_0x834e('0x6')]],'limit':0x1},'log':'UpdateSmsQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index ca52bb8..d5c199a 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(_0xc5a3cd,_0x1009df){var _0x3b02d7=function(_0x4f3ebc){while(--_0x4f3ebc){_0xc5a3cd['push'](_0xc5a3cd['shift']());}};_0x3b02d7(++_0x1009df);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'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(_0x1ad279,_0x42d157){var _0x272861=function(_0x3cb41f){while(--_0x3cb41f){_0x1ad279['push'](_0x1ad279['shift']());}};_0x272861(++_0x42d157);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'online',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'faxPause',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'chatCapacity','mailCapacity',_0x0a9e('0xc'),'smsCapacity','whatsappCapacity',_0x0a9e('0xd')]},'log':_0x0a9e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index ddf4f3c..b68dbc8 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 _0x6d38=['updateWhatsappInteraction','Request','addTagsToWhatsappInteraction','update'];(function(_0x5e895f,_0x3167d7){var _0x1a6d33=function(_0x1a2c4c){while(--_0x1a2c4c){_0x5e895f['push'](_0x5e895f['shift']());}};_0x1a6d33(++_0x3167d7);}(_0x6d38,0x1ef));var _0x86d3=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x6d38[_0x580576];return _0x3f55a0;};'use strict';var client=require('../client');exports[_0x86d3('0x0')]=function(_0x4c9c06,_0x3db243){return client['Request']('UpdateWhatsappInteraction',{'body':_0x3db243,'options':{'where':{'id':_0x4c9c06}},'log':_0x86d3('0x1')});};exports['addTags']=function(_0xe9198a,_0x455b9d){return client[_0x86d3('0x2')]('AddTagsToWhatsappInteraction',{'body':_0x455b9d,'options':{'where':{'id':_0xe9198a}},'log':_0x86d3('0x3')});}; \ No newline at end of file +var _0xc6ac=['addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction'];(function(_0x2b1c17,_0x5c370a){var _0x4eabd7=function(_0x288095){while(--_0x288095){_0x2b1c17['push'](_0x2b1c17['shift']());}};_0x4eabd7(++_0x5c370a);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x4534d8,_0x212ff8){_0x4534d8=_0x4534d8-0x0;var _0x328b85=_0xc6ac[_0x4534d8];return _0x328b85;};'use strict';var client=require(_0xcc6a('0x0'));exports[_0xcc6a('0x1')]=function(_0x1b6e92,_0x46fcd5){return client[_0xcc6a('0x2')](_0xcc6a('0x3'),{'body':_0x46fcd5,'options':{'where':{'id':_0x1b6e92}},'log':_0xcc6a('0x4')});};exports[_0xcc6a('0x5')]=function(_0x297643,_0x22ee99){return client[_0xcc6a('0x2')](_0xcc6a('0x6'),{'body':_0x22ee99,'options':{'where':{'id':_0x297643}},'log':_0xcc6a('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index b519f07..3c890a5 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 _0x9c3c=['../client','create','Request','CreateWhatsappMessage','createWhatsappMessage'];(function(_0x57beaf,_0x165fb5){var _0x1f23c6=function(_0x240790){while(--_0x240790){_0x57beaf['push'](_0x57beaf['shift']());}};_0x1f23c6(++_0x165fb5);}(_0x9c3c,0x7d));var _0xc9c3=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x9c3c[_0x17d9e3];return _0x14192d;};'use strict';var client=require(_0xc9c3('0x0'));exports[_0xc9c3('0x1')]=function(_0x17fa97){return client[_0xc9c3('0x2')](_0xc9c3('0x3'),{'body':_0x17fa97,'log':_0xc9c3('0x4')});}; \ No newline at end of file +var _0xa5e7=['../client','create','Request','createWhatsappMessage'];(function(_0x3d773f,_0x3462b3){var _0x22bf3a=function(_0x2d295e){while(--_0x2d295e){_0x3d773f['push'](_0x3d773f['shift']());}};_0x22bf3a(++_0x3462b3);}(_0xa5e7,0x168));var _0x7a5e=function(_0x24ec8c,_0x4e7091){_0x24ec8c=_0x24ec8c-0x0;var _0x54fb42=_0xa5e7[_0x24ec8c];return _0x54fb42;};'use strict';var client=require(_0x7a5e('0x0'));exports[_0x7a5e('0x1')]=function(_0x4a3a36){return client[_0x7a5e('0x2')]('CreateWhatsappMessage',{'body':_0x4a3a36,'log':_0x7a5e('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 74832d6..e4b57d8 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 _0x9ffb=['timeout','strategy','User','Agents','online','whatsappPause','../client','getWhatsappQueues','GetWhatsappQueue','name'];(function(_0x58da8d,_0x9dfa17){var _0x1b1682=function(_0x3e9ad4){while(--_0x3e9ad4){_0x58da8d['push'](_0x58da8d['shift']());}};_0x1b1682(++_0x9dfa17);}(_0x9ffb,0x146));var _0xb9ff=function(_0x36b511,_0x15c472){_0x36b511=_0x36b511-0x0;var _0x537915=_0x9ffb[_0x36b511];return _0x537915;};'use strict';var client=require(_0xb9ff('0x0'));exports[_0xb9ff('0x1')]=function(){return function(){return client['Request'](_0xb9ff('0x2'),{'options':{'raw':![],'attributes':['id',_0xb9ff('0x3'),_0xb9ff('0x4'),_0xb9ff('0x5')],'include':[{'model':_0xb9ff('0x6'),'as':_0xb9ff('0x7'),'attributes':['id',_0xb9ff('0x3'),_0xb9ff('0x8'),_0xb9ff('0x9')]}]},'log':_0xb9ff('0x1')});};}; \ No newline at end of file +var _0xd4eb=['whatsappPause','../client','getWhatsappQueues','Request','name','timeout','User','Agents','online'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xd4eb,0xc7));var _0xbd4e=function(_0xe7b7be,_0x1efdab){_0xe7b7be=_0xe7b7be-0x0;var _0x3bf3be=_0xd4eb[_0xe7b7be];return _0x3bf3be;};'use strict';var client=require(_0xbd4e('0x0'));exports[_0xbd4e('0x1')]=function(){return function(){return client[_0xbd4e('0x2')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0xbd4e('0x3'),_0xbd4e('0x4'),'strategy'],'include':[{'model':_0xbd4e('0x5'),'as':_0xbd4e('0x6'),'attributes':['id','name',_0xbd4e('0x7'),_0xbd4e('0x8')]}]},'log':_0xbd4e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index f7d5658..f54822e 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 _0x6c7c=['update','UpdateWhatsappQueueReport','DESC','../client','create','Request','CreateWhatsappQueueReport'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x6c7c,0xc0));var _0xc6c7=function(_0x11d91a,_0x3e0b6c){_0x11d91a=_0x11d91a-0x0;var _0x4373d5=_0x6c7c[_0x11d91a];return _0x4373d5;};'use strict';var client=require(_0xc6c7('0x0'));exports[_0xc6c7('0x1')]=function(_0x23947b){return client[_0xc6c7('0x2')](_0xc6c7('0x3'),{'body':_0x23947b,'log':_0xc6c7('0x3')});};exports[_0xc6c7('0x4')]=function(_0x3f50c8,_0x35a50c){return client[_0xc6c7('0x2')](_0xc6c7('0x5'),{'body':_0x35a50c,'options':{'where':{'uniqueid':_0x3f50c8},'order':[['id',_0xc6c7('0x6')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file +var _0x98cb=['DESC','UpdateWhatsappQueueReport','CreateWhatsappQueueReport','Request'];(function(_0x5b91ef,_0x94645f){var _0x2b1599=function(_0x34bb2b){while(--_0x34bb2b){_0x5b91ef['push'](_0x5b91ef['shift']());}};_0x2b1599(++_0x94645f);}(_0x98cb,0x1ca));var _0xb98c=function(_0x57e860,_0x2c00b2){_0x57e860=_0x57e860-0x0;var _0x2a11b8=_0x98cb[_0x57e860];return _0x2a11b8;};'use strict';var client=require('../client');exports['create']=function(_0x3135f5){return client['Request'](_0xb98c('0x0'),{'body':_0x3135f5,'log':_0xb98c('0x0')});};exports['update']=function(_0x482b4e,_0x5bc804){return client[_0xb98c('0x1')]('UpdateWhatsappQueueReport',{'body':_0x5bc804,'options':{'where':{'uniqueid':_0x482b4e},'order':[['id',_0xb98c('0x2')]],'limit':0x1},'log':_0xb98c('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index 04d4dd7..7dc7be8 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 _0xa7df=['find','agents','createQueue','atimeout','channel','START:%s','rules','end','info','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','next','error','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','validate','lodash','util','seq-queue','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','length','[%s][AGENT]\x20%s','map','message','join','stop'];(function(_0x3c7822,_0x2feaa6){var _0x42c512=function(_0x119304){while(--_0x119304){_0x3c7822['push'](_0x3c7822['shift']());}};_0x42c512(++_0x2feaa6);}(_0xa7df,0x198));var _0xfa7d=function(_0x49d07c,_0x2ef765){_0x49d07c=_0x49d07c-0x0;var _0x46217a=_0xa7df[_0x49d07c];return _0x46217a;};'use strict';var schema=require(_0xfa7d('0x0'));var _=require(_0xfa7d('0x1'));var util=require(_0xfa7d('0x2'));var seqqueue=require(_0xfa7d('0x3'));var logger=require(_0xfa7d('0x4'))(_0xfa7d('0x5'));var strategy=require(_0xfa7d('0x6'));var queue=schema({'name':{'type':_0xfa7d('0x7'),'required':!![],'message':_0xfa7d('0x8')},'timeout':{'type':_0xfa7d('0x9'),'message':_0xfa7d('0xa')}});function writeLog(_0x1374cd,_0x2c8462,_0x3cebd2){return logger['info'](util[_0xfa7d('0xb')](_0xfa7d('0xc'),_0x1374cd,_0x2c8462['name'],_0x3cebd2));}function handleFindAgent(_0x49db0c){return function(_0x43e14c){return _0x43e14c[_0xfa7d('0xd')][_0xfa7d('0xe')]()===_0x49db0c[_0xfa7d('0xe')]();};}exports['consequence']=function(_0x154998,_0x13e9ef,_0x3f65a9,_0x490452){return function(_0x4a3e2b){try{var _0x1476e2={'name':_0x13e9ef[0x0],'timeout':_0x13e9ef[0x1]};var _0x31cda2=queue[_0xfa7d('0x0')](_0x1476e2,{'typecast':!![]});if(_0x31cda2[_0xfa7d('0xf')]){logger['error'](_0xfa7d('0x10'),_0x154998,_[_0xfa7d('0x11')](_0x31cda2,_0xfa7d('0x12'))[_0xfa7d('0x13')](',\x20'));_0x4a3e2b[_0xfa7d('0x14')]();}else{var _0x279fd0=_[_0xfa7d('0x15')](_0x3f65a9[_0xfa7d('0x16')],handleFindAgent(_0x1476e2[_0xfa7d('0xd')]));if(_0x279fd0){var _0xe742c2=(_0x1476e2['timeout']||0xa)*0x3e8;var _0x1962a3,_0x40263f;var _0x523ca6=seqqueue[_0xfa7d('0x17')](_0xe742c2);_0x523ca6['id']=_0x154998;_0x523ca6[_0xfa7d('0x18')]=_0xe742c2;_0x523ca6[_0xfa7d('0x19')]=_0x490452['channel'];writeLog(_0x154998,_0x279fd0,util[_0xfa7d('0xb')](_0xfa7d('0x1a'),_0xe742c2));_0x3f65a9[_0xfa7d('0x1b')][_0x154998]['on'](_0xfa7d('0x1c'),function(){logger[_0xfa7d('0x1d')](_0xfa7d('0x1e'),_0x154998);clearTimeout(_0x40263f);_0x40263f=undefined;_0x523ca6[_0xfa7d('0x1f')]();if(_0x3f65a9[_0xfa7d('0x1b')][_0x154998]){delete _0x3f65a9[_0xfa7d('0x1b')][_0x154998];}_0x4a3e2b[_0xfa7d('0x14')]();});_0x3f65a9[_0xfa7d('0x1b')][_0x154998]['on'](_0xfa7d('0x20'),function(){if(_0x3f65a9[_0xfa7d('0x1b')][_0x154998]){delete _0x3f65a9[_0xfa7d('0x1b')][_0x154998];}});_0x40263f=setTimeout(function(){logger[_0xfa7d('0x1d')](_0xfa7d('0x21'),_0x154998);clearTimeout(_0x40263f);_0x523ca6['close']();_0x4a3e2b[_0xfa7d('0x22')]();},_0xe742c2);strategy['agent'](_0x523ca6,_0x279fd0,_0x3f65a9,_0x490452);}else{logger[_0xfa7d('0x23')](_0xfa7d('0x24'),_0x154998,_0x1476e2[_0xfa7d('0xd')]);_0x4a3e2b[_0xfa7d('0x14')]();}}}catch(_0x3233c7){console[_0xfa7d('0x25')](_0x3233c7);logger[_0xfa7d('0x23')](_0xfa7d('0x26'),_0x154998,_0x3233c7['stack']);_0x4a3e2b[_0xfa7d('0x14')]();}};}; \ No newline at end of file +var _0x73a6=['end','close','stop','[%s][AGENT]\x20ROUTING\x20END','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','validate','lodash','util','seq-queue','routing','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','map','message','createQueue','atimeout','channel','rules'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x73a6,0x180));var _0x673a=function(_0x43077b,_0x2e8274){_0x43077b=_0x43077b-0x0;var _0x429348=_0x73a6[_0x43077b];return _0x429348;};'use strict';var schema=require(_0x673a('0x0'));var _=require(_0x673a('0x1'));var util=require(_0x673a('0x2'));var seqqueue=require(_0x673a('0x3'));var logger=require('../../../../config/logger')(_0x673a('0x4'));var strategy=require('./strategy');var queue=schema({'name':{'type':'string','required':!![],'message':_0x673a('0x5')},'timeout':{'type':_0x673a('0x6'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x29ed46,_0x20738d,_0x28cf00){return logger[_0x673a('0x7')](util[_0x673a('0x8')](_0x673a('0x9'),_0x29ed46,_0x20738d[_0x673a('0xa')],_0x28cf00));}function handleFindAgent(_0x442076){return function(_0x28d745){return _0x28d745[_0x673a('0xa')][_0x673a('0xb')]()===_0x442076['toLowerCase']();};}exports[_0x673a('0xc')]=function(_0x34a8ad,_0x4060fd,_0x147f0c,_0x472664){return function(_0x39f656){try{var _0x5a3e91={'name':_0x4060fd[0x0],'timeout':_0x4060fd[0x1]};var _0x50f5fd=queue[_0x673a('0x0')](_0x5a3e91,{'typecast':!![]});if(_0x50f5fd[_0x673a('0xd')]){logger[_0x673a('0xe')](_0x673a('0xf'),_0x34a8ad,_[_0x673a('0x10')](_0x50f5fd,_0x673a('0x11'))['join'](',\x20'));_0x39f656['stop']();}else{var _0x45f441=_['find'](_0x147f0c['agents'],handleFindAgent(_0x5a3e91[_0x673a('0xa')]));if(_0x45f441){var _0x24ab84=(_0x5a3e91['timeout']||0xa)*0x3e8;var _0x54fb7b,_0x3aac47;var _0x530f97=seqqueue[_0x673a('0x12')](_0x24ab84);_0x530f97['id']=_0x34a8ad;_0x530f97[_0x673a('0x13')]=_0x24ab84;_0x530f97[_0x673a('0x14')]=_0x472664[_0x673a('0x14')];writeLog(_0x34a8ad,_0x45f441,util[_0x673a('0x8')]('START:%s',_0x24ab84));_0x147f0c[_0x673a('0x15')][_0x34a8ad]['on'](_0x673a('0x16'),function(){logger[_0x673a('0x7')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x34a8ad);clearTimeout(_0x3aac47);_0x3aac47=undefined;_0x530f97[_0x673a('0x17')]();if(_0x147f0c[_0x673a('0x15')][_0x34a8ad]){delete _0x147f0c[_0x673a('0x15')][_0x34a8ad];}_0x39f656[_0x673a('0x18')]();});_0x147f0c[_0x673a('0x15')][_0x34a8ad]['on']('complete',function(){if(_0x147f0c['rules'][_0x34a8ad]){delete _0x147f0c[_0x673a('0x15')][_0x34a8ad];}});_0x3aac47=setTimeout(function(){logger['info'](_0x673a('0x19'),_0x34a8ad);clearTimeout(_0x3aac47);_0x530f97[_0x673a('0x17')]();_0x39f656['next']();},_0x24ab84);strategy['agent'](_0x530f97,_0x45f441,_0x147f0c,_0x472664);}else{logger[_0x673a('0xe')](_0x673a('0x1a'),_0x34a8ad,_0x5a3e91[_0x673a('0xa')]);_0x39f656[_0x673a('0x18')]();}}}catch(_0x1406e4){console[_0x673a('0x1b')](_0x1406e4);logger[_0x673a('0xe')](_0x673a('0x1c'),_0x34a8ad,_0x1406e4['stack']);_0x39f656['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index 3cf065c..137a64f 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 _0x4f85=['moment','aws-sdk','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','YYYY-MM-DD\x20HH:mm:ss','sms','whatsapp','phone','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','body','getMustacheRender','Message','create','then','catch','error','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','$LATEST','message','postText','amazonlex','providerName','dialogState','Failed','stringify','next','lodash'];(function(_0x59daf9,_0x539360){var _0x186b62=function(_0x421499){while(--_0x421499){_0x59daf9['push'](_0x59daf9['shift']());}};_0x186b62(++_0x539360);}(_0x4f85,0x187));var _0x54f8=function(_0x3ad1ab,_0x3c8799){_0x3ad1ab=_0x3ad1ab-0x0;var _0x26d4c9=_0x4f85[_0x3ad1ab];return _0x26d4c9;};'use strict';var _=require(_0x54f8('0x0'));var moment=require(_0x54f8('0x1'));var AWS=require(_0x54f8('0x2'));var utils=require('./utils');var logger=require(_0x54f8('0x3'))(_0x54f8('0x4'));var rpc={'chatMessage':require(_0x54f8('0x5')),'openchannelMessage':require(_0x54f8('0x6')),'mailMessage':require(_0x54f8('0x7')),'smsMessage':require(_0x54f8('0x8')),'faxMessage':require(_0x54f8('0x9')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x54f8('0xa')]=function(_0x4429f4,_0x48000f){return function(_0x392723){try{if(!_[_0x54f8('0xb')](this[_0x54f8('0xc')][_0x54f8('0xd')])){logger[_0x54f8('0xe')](_0x54f8('0xf'),_0x4429f4,_0x54f8('0x10'));return _0x392723['next']();}var _0x47e6e9={'ContactId':this[_0x54f8('0x11')]['id'],'sentAt':moment()['format'](_0x54f8('0x12')),'direction':'out'};if(this['channel']===_0x54f8('0x13')||this['channel']===_0x54f8('0x14')){_0x47e6e9[_0x54f8('0x15')]=this[_0x54f8('0xc')]['phone'];}var _0x6f2b25=this[_0x54f8('0x16')];if(_0x6f2b25===_0x54f8('0x17')){_0x47e6e9[_0x54f8('0x18')]=this[_0x54f8('0x19')]['id'];}else{_0x47e6e9[_[_0x54f8('0x1a')](_0x6f2b25)+_0x54f8('0x1b')]=this[_0x54f8('0x19')]['id'];}_0x47e6e9[_[_0x54f8('0x1a')](_0x6f2b25)+_0x54f8('0x1c')]=this['interaction']['id'];if(this[_0x54f8('0xc')][_0x54f8('0x1d')]){var _0x4bd527=_0x48000f[0x4];if(!_['isEmpty'](_0x4bd527)){_0x47e6e9[_0x54f8('0x1e')]=utils[_0x54f8('0x1f')](_0x4bd527,this);return rpc[_0x6f2b25+_0x54f8('0x20')][_0x54f8('0x21')](_0x47e6e9)[_0x54f8('0x22')](function(_0x30fd43){logger[_0x54f8('0xe')](_0x54f8('0xf'),_0x4429f4,_0x47e6e9[_0x54f8('0x1e')]);})[_0x54f8('0x23')](function(_0x59abc0){logger[_0x54f8('0x24')](_0x54f8('0xf'),_0x4429f4,JSON['stringify'](_0x59abc0));})['finally'](function(){logger[_0x54f8('0xe')](_0x54f8('0x25'),_0x4429f4);_0x392723[_0x54f8('0x26')]();});}else{logger[_0x54f8('0xe')](_0x54f8('0x27'),_0x4429f4);_0x392723[_0x54f8('0x26')]();}}else{var _0xfd392f=this;var _0x199e35=new AWS['LexRuntime']({'accessKeyId':_0x48000f[0x0],'secretAccessKey':_0x48000f[0x1],'region':_0x48000f[0x2]});var _0xec5b48={'botAlias':_0x54f8('0x28'),'botName':_0x48000f[0x3],'inputText':this[_0x54f8('0x29')][_0x54f8('0x1e')],'userId':this[_0x54f8('0x16')]+':'+this[_0x54f8('0xc')]['id']['toString']()};_0x199e35[_0x54f8('0x2a')](_0xec5b48,function(_0x196d14,_0x203a93){if(_0x196d14){logger['error']('[%s][AMAZONLEX]\x20%s',_0x4429f4,_0x196d14[_0x54f8('0x29')]);_0x392723['next']();}else if(_0x203a93&&_0x203a93[_0x54f8('0x29')]){_0xfd392f['body'][_0x54f8('0x2b')]=_0x203a93;_0x47e6e9['body']=_0x203a93[_0x54f8('0x29')];_0x47e6e9[_0x54f8('0x2c')]=_0x54f8('0x2b');_0x47e6e9['providerResponse']=JSON['stringify'](_0x203a93);return rpc[_0x6f2b25+_0x54f8('0x20')][_0x54f8('0x21')](_0x47e6e9)[_0x54f8('0x22')](function(_0x5b1cc2){logger[_0x54f8('0xe')](_0x54f8('0xf'),_0x4429f4,_0x47e6e9[_0x54f8('0x1e')]);if(_0x203a93[_0x54f8('0x2d')]==_0x54f8('0x2e')){_0x392723['next']();}else{_0x392723[_0x54f8('0x26')]();}})[_0x54f8('0x23')](function(_0xfe3de0){logger[_0x54f8('0x24')]('[%s][AMAZONLEX]\x20%s',_0x4429f4,JSON[_0x54f8('0x2f')](_0xfe3de0));_0x392723[_0x54f8('0x30')]();});}else{_0x392723['next']();}});}}catch(_0x4fb56c){logger[_0x54f8('0x24')]('[%s][AMAZONLEX]\x20%s',_0x4429f4,JSON[_0x54f8('0x2f')](_0x4fb56c));_0x392723[_0x54f8('0x26')]();}};}; \ No newline at end of file +var _0xd4f4=['providerResponse','dialogState','Failed','lodash','moment','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','phone','chat','ChatWebsiteId','account','upperFirst','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','[%s][AMAZONLEX]\x20%s','catch','stringify','finally','info','stop','$LATEST','message','toString','postText','error','amazonlex','providerName'];(function(_0x1de344,_0x33f3a7){var _0x5a082f=function(_0x179d0f){while(--_0x179d0f){_0x1de344['push'](_0x1de344['shift']());}};_0x5a082f(++_0x33f3a7);}(_0xd4f4,0x93));var _0x4d4f=function(_0x432b24,_0x35d9f2){_0x432b24=_0x432b24-0x0;var _0x3ba6ad=_0xd4f4[_0x432b24];return _0x3ba6ad;};'use strict';var _=require(_0x4d4f('0x0'));var moment=require(_0x4d4f('0x1'));var AWS=require('aws-sdk');var utils=require('./utils');var logger=require('../../../../config/logger')(_0x4d4f('0x2'));var rpc={'chatMessage':require(_0x4d4f('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x4d4f('0x4')),'smsMessage':require(_0x4d4f('0x5')),'faxMessage':require(_0x4d4f('0x6')),'whatsappMessage':require(_0x4d4f('0x7'))};exports[_0x4d4f('0x8')]=function(_0x2589d9,_0x588249){return function(_0x567250){try{if(!_[_0x4d4f('0x9')](this[_0x4d4f('0xa')][_0x4d4f('0xb')])){logger['info']('[%s][AMAZONLEX]\x20%s',_0x2589d9,_0x4d4f('0xc'));return _0x567250[_0x4d4f('0xd')]();}var _0x38d8f6={'ContactId':this[_0x4d4f('0xe')]['id'],'sentAt':moment()[_0x4d4f('0xf')](_0x4d4f('0x10')),'direction':_0x4d4f('0x11')};if(this[_0x4d4f('0x12')]===_0x4d4f('0x13')||this[_0x4d4f('0x12')]==='whatsapp'){_0x38d8f6[_0x4d4f('0x14')]=this['interaction'][_0x4d4f('0x14')];}var _0x5c6777=this['channel'];if(_0x5c6777===_0x4d4f('0x15')){_0x38d8f6[_0x4d4f('0x16')]=this[_0x4d4f('0x17')]['id'];}else{_0x38d8f6[_['upperFirst'](_0x5c6777)+'AccountId']=this[_0x4d4f('0x17')]['id'];}_0x38d8f6[_[_0x4d4f('0x18')](_0x5c6777)+_0x4d4f('0x19')]=this[_0x4d4f('0xa')]['id'];if(this[_0x4d4f('0xa')][_0x4d4f('0x1a')]){var _0x23a71c=_0x588249[0x4];if(!_[_0x4d4f('0x1b')](_0x23a71c)){_0x38d8f6[_0x4d4f('0x1c')]=utils[_0x4d4f('0x1d')](_0x23a71c,this);return rpc[_0x5c6777+_0x4d4f('0x1e')][_0x4d4f('0x1f')](_0x38d8f6)['then'](function(_0x506073){logger['info'](_0x4d4f('0x20'),_0x2589d9,_0x38d8f6[_0x4d4f('0x1c')]);})[_0x4d4f('0x21')](function(_0x145d4a){logger['error'](_0x4d4f('0x20'),_0x2589d9,JSON[_0x4d4f('0x22')](_0x145d4a));})[_0x4d4f('0x23')](function(){logger[_0x4d4f('0x24')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x2589d9);_0x567250[_0x4d4f('0x25')]();});}else{logger[_0x4d4f('0x24')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x2589d9);_0x567250[_0x4d4f('0x25')]();}}else{var _0x35fbf7=this;var _0x5bca60=new AWS['LexRuntime']({'accessKeyId':_0x588249[0x0],'secretAccessKey':_0x588249[0x1],'region':_0x588249[0x2]});var _0x5c0926={'botAlias':_0x4d4f('0x26'),'botName':_0x588249[0x3],'inputText':this[_0x4d4f('0x27')][_0x4d4f('0x1c')],'userId':this[_0x4d4f('0x12')]+':'+this[_0x4d4f('0xa')]['id'][_0x4d4f('0x28')]()};_0x5bca60[_0x4d4f('0x29')](_0x5c0926,function(_0x3fa0d9,_0x17c6ab){if(_0x3fa0d9){logger[_0x4d4f('0x2a')](_0x4d4f('0x20'),_0x2589d9,_0x3fa0d9[_0x4d4f('0x27')]);_0x567250[_0x4d4f('0xd')]();}else if(_0x17c6ab&&_0x17c6ab[_0x4d4f('0x27')]){_0x35fbf7[_0x4d4f('0x1c')][_0x4d4f('0x2b')]=_0x17c6ab;_0x38d8f6['body']=_0x17c6ab[_0x4d4f('0x27')];_0x38d8f6[_0x4d4f('0x2c')]=_0x4d4f('0x2b');_0x38d8f6[_0x4d4f('0x2d')]=JSON['stringify'](_0x17c6ab);return rpc[_0x5c6777+_0x4d4f('0x1e')][_0x4d4f('0x1f')](_0x38d8f6)['then'](function(_0x2d1a6a){logger[_0x4d4f('0x24')](_0x4d4f('0x20'),_0x2589d9,_0x38d8f6[_0x4d4f('0x1c')]);if(_0x17c6ab[_0x4d4f('0x2e')]==_0x4d4f('0x2f')){_0x567250['next']();}else{_0x567250[_0x4d4f('0x25')]();}})[_0x4d4f('0x21')](function(_0xc15ff6){logger['error'](_0x4d4f('0x20'),_0x2589d9,JSON[_0x4d4f('0x22')](_0xc15ff6));_0x567250[_0x4d4f('0xd')]();});}else{_0x567250[_0x4d4f('0xd')]();}});}}catch(_0x243602){logger[_0x4d4f('0x2a')](_0x4d4f('0x20'),_0x2589d9,JSON[_0x4d4f('0x22')](_0x243602));_0x567250[_0x4d4f('0x25')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index 4b88825..79c510a 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 _0x8790=['[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','interaction','created','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','out','mail','getMustacheRender','message','from','phone','read','subject','startsWith','Re:\x20','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','inReplyTo','html','','','auto-replied','All','auto_reply','sendMailMessage','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','create','stringify','catch','error','finally','autoreplyExecuted','Interaction','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','Message','stop','lodash','moment','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','channel','body','isAutoreply','info'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x8790,0x74));var _0x0879=function(_0x9bbba1,_0x226ad9){_0x9bbba1=_0x9bbba1-0x0;var _0x66fbf4=_0x8790[_0x9bbba1];return _0x66fbf4;};'use strict';var _=require(_0x0879('0x0'));var moment=require(_0x0879('0x1'));var utils=require(_0x0879('0x2'));var logger=require('../../../../config/logger')(_0x0879('0x3'));var rpc={'chatMessage':require(_0x0879('0x4')),'openchannelMessage':require(_0x0879('0x5')),'mailMessage':require(_0x0879('0x6')),'smsMessage':require(_0x0879('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x0879('0x8')),'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x0879('0x9')),'mailInteraction':require(_0x0879('0xa')),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require(_0x0879('0xb')),'whatsappInteraction':require(_0x0879('0xc'))};var mailRpc=require(_0x0879('0xd'));exports['consequence']=function(_0x21a8c7,_0x4b2a17,_0x430800,_0x14188c){return function(_0x1857f6){try{var _0xb80de4=this[_0x0879('0xe')];if(_0xb80de4==='mail'&&_0x14188c[_0x0879('0xf')][_0x0879('0x10')]){logger[_0x0879('0x11')](_0x0879('0x12'),_0x21a8c7,_0x0879('0x13'));return _0x1857f6[_0x0879('0x14')]();}if(_0x4b2a17[0x0]==='1'&&(_['isNil'](this[_0x0879('0x15')][_0x0879('0x16')])||!this[_0x0879('0x15')][_0x0879('0x16')])){logger[_0x0879('0x11')](_0x0879('0x12'),_0x21a8c7,'Autoreply\x20already\x20sent');return _0x1857f6[_0x0879('0x14')]();}if(_0x4b2a17[0x0]==='2'&&this[_0x0879('0x15')]['autoreplyExecuted']){logger['info'](_0x0879('0x17'),_0x21a8c7,_0x0879('0x18'));return _0x1857f6[_0x0879('0x14')]();}var _0xcb2f67={'ContactId':this[_0x0879('0x19')]['id'],'sentAt':moment()[_0x0879('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x0879('0x1b')};if(this[_0x0879('0xe')]===_0x0879('0x1c')){_0xcb2f67[_0x0879('0xf')]=utils[_0x0879('0x1d')](_0x4b2a17[0x2],this);}else{_0xcb2f67[_0x0879('0xf')]=utils[_0x0879('0x1d')](_0x4b2a17[0x1],this);}if(this[_0x0879('0x1e')]){_0xcb2f67['to']=this[_0x0879('0x1e')][_0x0879('0x1f')]||'';if(this[_0x0879('0xe')]===_0x0879('0x1c')&&_0x4b2a17[0x1]==='1'){_0xcb2f67['cc']=this[_0x0879('0x1e')]['cc']||'';}_0xcb2f67[_0x0879('0x1f')]=this[_0x0879('0x1e')]['to']||'';_0xcb2f67['phone']=this['message'][_0x0879('0x20')]||'';_0xcb2f67[_0x0879('0x21')]=!![];if(this[_0x0879('0x1e')]['subject']){_0xcb2f67[_0x0879('0x22')]='';_0xcb2f67[_0x0879('0x22')]+=_[_0x0879('0x23')](this[_0x0879('0x1e')][_0x0879('0x22')],'Re:')?'':_0x0879('0x24');_0xcb2f67[_0x0879('0x22')]+=this[_0x0879('0x1e')][_0x0879('0x22')];}}if(this[_0x0879('0xe')]===_0x0879('0x25')){_0xcb2f67[_0x0879('0x26')]=this['account']['id'];}else{_0xcb2f67[_[_0x0879('0x27')](this[_0x0879('0xe')])+_0x0879('0x28')]=this[_0x0879('0x29')]['id'];}_0xcb2f67[_[_0x0879('0x27')](this[_0x0879('0xe')])+_0x0879('0x2a')]=this[_0x0879('0x15')]['id'];var _0x278899=this[_0x0879('0x15')];if(rpc[this[_0x0879('0xe')]+'Message']){if(this['channel']==='mail'){_0xcb2f67[_0x0879('0x2b')]=this[_0x0879('0x1e')]['messageId'];_0xcb2f67[_0x0879('0x2c')]=_0x0879('0x2d')+_['replace'](_0xcb2f67[_0x0879('0xf')],'','replace','','headers','All','auto_reply','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','resolve','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','finally','autoreplyExecuted','Interaction','update','stop','lodash','moment','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction'];(function(_0x426711,_0x12264c){var _0x592991=function(_0x564614){while(--_0x564614){_0x426711['push'](_0x426711['shift']());}};_0x592991(++_0x12264c);}(_0x96f0,0x1e6));var _0x096f=function(_0x102ff9,_0x907658){_0x102ff9=_0x102ff9-0x0;var _0x24fa97=_0x96f0[_0x102ff9];return _0x24fa97;};'use strict';var _=require(_0x096f('0x0'));var moment=require(_0x096f('0x1'));var utils=require('./utils');var logger=require(_0x096f('0x2'))(_0x096f('0x3'));var rpc={'chatMessage':require(_0x096f('0x4')),'openchannelMessage':require(_0x096f('0x5')),'mailMessage':require(_0x096f('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x096f('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require(_0x096f('0x8')),'openchannelInteraction':require(_0x096f('0x9')),'mailInteraction':require('../../rpc/mailInteraction'),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x096f('0xa'))};var mailRpc=require(_0x096f('0xb'));exports[_0x096f('0xc')]=function(_0x52bf4c,_0x2063d5,_0x43e38e,_0xe71e58){return function(_0x466c95){try{var _0x5a5916=this[_0x096f('0xd')];if(_0x5a5916===_0x096f('0xe')&&_0xe71e58[_0x096f('0xf')][_0x096f('0x10')]){logger[_0x096f('0x11')](_0x096f('0x12'),_0x52bf4c,_0x096f('0x13'));return _0x466c95[_0x096f('0x14')]();}if(_0x2063d5[0x0]==='1'&&(_['isNil'](this[_0x096f('0x15')][_0x096f('0x16')])||!this[_0x096f('0x15')][_0x096f('0x16')])){logger[_0x096f('0x11')](_0x096f('0x12'),_0x52bf4c,'Autoreply\x20already\x20sent');return _0x466c95[_0x096f('0x14')]();}if(_0x2063d5[0x0]==='2'&&this[_0x096f('0x15')]['autoreplyExecuted']){logger[_0x096f('0x11')](_0x096f('0x17'),_0x52bf4c,'One\x20Time\x20already\x20sent');return _0x466c95[_0x096f('0x14')]();}var _0x5c362e={'ContactId':this['contact']['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x096f('0x18')};if(this[_0x096f('0xd')]===_0x096f('0xe')){_0x5c362e[_0x096f('0xf')]=utils[_0x096f('0x19')](_0x2063d5[0x2],this);}else{_0x5c362e[_0x096f('0xf')]=utils[_0x096f('0x19')](_0x2063d5[0x1],this);}if(this[_0x096f('0x1a')]){_0x5c362e['to']=this[_0x096f('0x1a')]['from']||'';if(this[_0x096f('0xd')]===_0x096f('0xe')&&_0x2063d5[0x1]==='1'){_0x5c362e['cc']=this['message']['cc']||'';}_0x5c362e[_0x096f('0x1b')]=this[_0x096f('0x1a')]['to']||'';_0x5c362e[_0x096f('0x1c')]=this[_0x096f('0x1a')][_0x096f('0x1c')]||'';_0x5c362e[_0x096f('0x1d')]=!![];if(this[_0x096f('0x1a')][_0x096f('0x1e')]){_0x5c362e['subject']='';_0x5c362e['subject']+=_[_0x096f('0x1f')](this[_0x096f('0x1a')][_0x096f('0x1e')],_0x096f('0x20'))?'':'Re:\x20';_0x5c362e[_0x096f('0x1e')]+=this[_0x096f('0x1a')][_0x096f('0x1e')];}}if(this[_0x096f('0xd')]===_0x096f('0x21')){_0x5c362e[_0x096f('0x22')]=this[_0x096f('0x23')]['id'];}else{_0x5c362e[_[_0x096f('0x24')](this[_0x096f('0xd')])+'AccountId']=this[_0x096f('0x23')]['id'];}_0x5c362e[_[_0x096f('0x24')](this[_0x096f('0xd')])+'InteractionId']=this['interaction']['id'];var _0x41575c=this['interaction'];if(rpc[this[_0x096f('0xd')]+_0x096f('0x25')]){if(this['channel']===_0x096f('0xe')){_0x5c362e['inReplyTo']=this[_0x096f('0x1a')][_0x096f('0x26')];_0x5c362e[_0x096f('0x27')]=_0x096f('0x28')+_[_0x096f('0x29')](_0x5c362e[_0x096f('0xf')],_0x096f('0x2a'),']+(>|$)/g,''),'priorityTrue':_0x316d32[0x1],'priorityFalse':_0x316d32[0x2]};var _0x5df3ce=gotoif[_0xe59a('0x0')](_0x42bc1d,{'typecast':!![]});if(_0x5df3ce[_0xe59a('0xb')]){logger[_0xe59a('0xc')]('[%s][GOTOIF]\x20%s',_0x42d820,_['map'](_0x5df3ce,_0xe59a('0xd'))[_0xe59a('0xe')](',\x20'));_0x1950fd[_0xe59a('0xf')]();}else{try{var _0x240c04=eval('('+_0x42bc1d[_0xe59a('0x10')]+')');var _0x38d517=_0x240c04?_0x42bc1d[_0xe59a('0x11')]:_0x42bc1d[_0xe59a('0x12')];logger[_0xe59a('0x13')](_0xe59a('0x14'),_0x42d820,_0x42bc1d[_0xe59a('0x10')],_0x240c04,_0x38d517||_0xe59a('0x15'));if(_0x38d517){var _0x57ea46=_[_0xe59a('0x16')](_0x1950fd[_0xe59a('0x17')](),{'p':_0x38d517});if(_0x57ea46>=0x0){logger['info']('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x42d820,_0x38d517||_0xe59a('0x15'),_0x57ea46);_0x1950fd[_0xe59a('0x15')](_0x57ea46);}else{logger[_0xe59a('0x13')](_0xe59a('0x18'),_0x42d820,_0x38d517||_0xe59a('0x15'));_0x1950fd[_0xe59a('0xf')]();}}else{_0x1950fd[_0xe59a('0x15')]();}}catch(_0x39780c){logger[_0xe59a('0xc')](_0xe59a('0x19'),_0x42d820,_0x39780c['message']);_0x1950fd['stop']();}}}catch(_0x400358){logger[_0xe59a('0xc')](_0xe59a('0x1a'),_0x42d820,JSON[_0xe59a('0x1b')](_0x400358));_0x1950fd[_0xe59a('0xf')]();}};}; \ No newline at end of file +var _0x4250=['error','[%s][GOTOIF]\x20%s','map','join','stop','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','message','stringify','validate','lodash','html-to-text','./utils','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20false\x20is\x20a\x20number','consequence','fromString'];(function(_0x2b4a59,_0x4dfbd6){var _0x84b9c1=function(_0x12a486){while(--_0x12a486){_0x2b4a59['push'](_0x2b4a59['shift']());}};_0x84b9c1(++_0x4dfbd6);}(_0x4250,0x1b5));var _0x0425=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x4250[_0x28947d];return _0x12d2ee;};'use strict';var schema=require(_0x0425('0x0'));var _=require(_0x0425('0x1'));var htmlToText=require(_0x0425('0x2'));var utils=require(_0x0425('0x3'));var logger=require('../../../../config/logger')(_0x0425('0x4'));var gotoif=schema({'condition':{'type':_0x0425('0x5'),'required':!![],'message':_0x0425('0x6')},'priorityTrue':{'type':_0x0425('0x7'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0x0425('0x7'),'message':_0x0425('0x8')}});exports[_0x0425('0x9')]=function(_0x2eb03a,_0x28ed84){return function(_0x9932b){try{var _0x1dbd99={'condition':htmlToText[_0x0425('0xa')](utils['getMustacheRender'](_0x28ed84[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x28ed84[0x1],'priorityFalse':_0x28ed84[0x2]};var _0xbd92e6=gotoif[_0x0425('0x0')](_0x1dbd99,{'typecast':!![]});if(_0xbd92e6['length']){logger[_0x0425('0xb')](_0x0425('0xc'),_0x2eb03a,_[_0x0425('0xd')](_0xbd92e6,'message')[_0x0425('0xe')](',\x20'));_0x9932b[_0x0425('0xf')]();}else{try{var _0xff9682=eval('('+_0x1dbd99['condition']+')');var _0x2d0c1=_0xff9682?_0x1dbd99[_0x0425('0x10')]:_0x1dbd99[_0x0425('0x11')];logger[_0x0425('0x12')](_0x0425('0x13'),_0x2eb03a,_0x1dbd99['condition'],_0xff9682,_0x2d0c1||_0x0425('0x14'));if(_0x2d0c1){var _0x7844fd=_[_0x0425('0x15')](_0x9932b[_0x0425('0x16')](),{'p':_0x2d0c1});if(_0x7844fd>=0x0){logger[_0x0425('0x12')](_0x0425('0x17'),_0x2eb03a,_0x2d0c1||_0x0425('0x14'),_0x7844fd);_0x9932b['next'](_0x7844fd);}else{logger[_0x0425('0x12')](_0x0425('0x18'),_0x2eb03a,_0x2d0c1||'next');_0x9932b[_0x0425('0xf')]();}}else{_0x9932b[_0x0425('0x14')]();}}catch(_0x49f8ce){logger[_0x0425('0xb')](_0x0425('0x19'),_0x2eb03a,_0x49f8ce[_0x0425('0x1a')]);_0x9932b[_0x0425('0xf')]();}}}catch(_0xd14765){logger[_0x0425('0xb')](_0x0425('0xc'),_0x2eb03a,JSON[_0x0425('0x1b')](_0xd14765));_0x9932b[_0x0425('0xf')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index 18fc450..7b1f416 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 _0x843f=['number','consequence','validate','error','[%s][GOTOP]\x20%s','map','message','join','info','[%s][GOTOP]\x20priority\x20%s','priority','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x843f,0xef));var _0xf843=function(_0x53fb6,_0x86681b){_0x53fb6=_0x53fb6-0x0;var _0x2bdcf9=_0x843f[_0x53fb6];return _0x2bdcf9;};'use strict';var schema=require('validate');var _=require(_0xf843('0x0'));var logger=require('../../../../config/logger')('routing');var gotop=schema({'priority':{'type':_0xf843('0x1'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0xf843('0x2')]=function(_0x12cb5d,_0x2e68f1){return function(_0x1c7f59){try{var _0x383996={'priority':_0x2e68f1[0x0]};var _0x306f67=gotop[_0xf843('0x3')](_0x383996,{'typecast':!![]});if(_0x306f67['length']){logger[_0xf843('0x4')](_0xf843('0x5'),_0x12cb5d,_[_0xf843('0x6')](_0x306f67,_0xf843('0x7'))[_0xf843('0x8')](',\x20'));_0x1c7f59['stop']();}else{logger[_0xf843('0x9')](_0xf843('0xa'),_0x12cb5d,_0x383996[_0xf843('0xb')]);if(_0x383996[_0xf843('0xb')]){var _0x3b8bad=_['findIndex'](_0x1c7f59[_0xf843('0xc')](),{'p':_0x383996[_0xf843('0xb')]});if(_0x3b8bad>=0x0){logger['info'](_0xf843('0xd'),_0x12cb5d,_0x383996[_0xf843('0xb')]||_0xf843('0xe'),_0x3b8bad);_0x1c7f59[_0xf843('0xe')](_0x3b8bad);}else{logger[_0xf843('0x9')](_0xf843('0xf'),_0x12cb5d,_0x383996['priority']||_0xf843('0xe'));_0x1c7f59['stop']();}}else{_0x1c7f59['next']();}}}catch(_0x596f8e){logger[_0xf843('0x4')](_0xf843('0x5'),_0x12cb5d,JSON['stringify'](_0x596f8e));_0x1c7f59['stop']();}};}; \ No newline at end of file +var _0xc063=['stop','error','[%s][GOTOP]\x20%s','stringify','validate','lodash','../../../../config/logger','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','length','map','message','join','info','priority','findIndex','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found'];(function(_0x32eb20,_0x3366c2){var _0x1492b5=function(_0x17b654){while(--_0x17b654){_0x32eb20['push'](_0x32eb20['shift']());}};_0x1492b5(++_0x3366c2);}(_0xc063,0x1cc));var _0x3c06=function(_0x460ae8,_0x3f0ee9){_0x460ae8=_0x460ae8-0x0;var _0x4d2a87=_0xc063[_0x460ae8];return _0x4d2a87;};'use strict';var schema=require(_0x3c06('0x0'));var _=require(_0x3c06('0x1'));var logger=require(_0x3c06('0x2'))('routing');var gotop=schema({'priority':{'type':_0x3c06('0x3'),'required':!![],'message':_0x3c06('0x4')}});exports['consequence']=function(_0x555710,_0x5b7c20){return function(_0x47ae30){try{var _0x597086={'priority':_0x5b7c20[0x0]};var _0xd66893=gotop[_0x3c06('0x0')](_0x597086,{'typecast':!![]});if(_0xd66893[_0x3c06('0x5')]){logger['error']('[%s][GOTOP]\x20%s',_0x555710,_[_0x3c06('0x6')](_0xd66893,_0x3c06('0x7'))[_0x3c06('0x8')](',\x20'));_0x47ae30['stop']();}else{logger[_0x3c06('0x9')]('[%s][GOTOP]\x20priority\x20%s',_0x555710,_0x597086['priority']);if(_0x597086[_0x3c06('0xa')]){var _0x4a4435=_[_0x3c06('0xb')](_0x47ae30['rules'](),{'p':_0x597086[_0x3c06('0xa')]});if(_0x4a4435>=0x0){logger['info'](_0x3c06('0xc'),_0x555710,_0x597086['priority']||_0x3c06('0xd'),_0x4a4435);_0x47ae30[_0x3c06('0xd')](_0x4a4435);}else{logger[_0x3c06('0x9')](_0x3c06('0xe'),_0x555710,_0x597086[_0x3c06('0xa')]||_0x3c06('0xd'));_0x47ae30[_0x3c06('0xf')]();}}else{_0x47ae30[_0x3c06('0xd')]();}}}catch(_0x29e721){logger[_0x3c06('0x10')](_0x3c06('0x11'),_0x555710,JSON[_0x3c06('0x12')](_0x29e721));_0x47ae30['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index cedb210..7a2acf2 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 _0xceb0=['../../rpc/faxMessage','getMustacheRender','contact','chat','account','upperFirst','channel','InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body','catch','stringify','stop','error','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage'];(function(_0xd8fefd,_0x2ddbe6){var _0x20b1c6=function(_0x746e55){while(--_0x746e55){_0xd8fefd['push'](_0xd8fefd['shift']());}};_0x20b1c6(++_0x2ddbe6);}(_0xceb0,0x173));var _0x0ceb=function(_0x380ed4,_0x57ed1e){_0x380ed4=_0x380ed4-0x0;var _0x25afed=_0xceb0[_0x380ed4];return _0x25afed;};'use strict';var _=require('lodash');var utils=require('./utils');var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require(_0x0ceb('0x0')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x0ceb('0x1')),'smsMessage':require(_0x0ceb('0x2')),'faxMessage':require(_0x0ceb('0x3')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x2b4f6b,_0x218237){return function(_0x3f650d){try{var _0x52e6bb={'body':utils[_0x0ceb('0x4')](_0x218237[0x0],this),'ContactId':this[_0x0ceb('0x5')]['id']};if(this['channel']===_0x0ceb('0x6')){_0x52e6bb['ChatWebsiteId']=this[_0x0ceb('0x7')]['id'];}else{_0x52e6bb[_[_0x0ceb('0x8')](this[_0x0ceb('0x9')])+'AccountId']=this['account']['id'];}_0x52e6bb[_[_0x0ceb('0x8')](this[_0x0ceb('0x9')])+_0x0ceb('0xa')]=this[_0x0ceb('0xb')]['id'];if(rpc[this[_0x0ceb('0x9')]+_0x0ceb('0xc')]){return rpc[this['channel']+_0x0ceb('0xc')][_0x0ceb('0xd')](_0x52e6bb)[_0x0ceb('0xe')](function(_0x26cb7a){logger[_0x0ceb('0xf')](_0x0ceb('0x10'),_0x2b4f6b,_0x52e6bb[_0x0ceb('0x11')]);_0x3f650d['next']();})[_0x0ceb('0x12')](function(_0x54a173){logger['error'](_0x0ceb('0x10'),_0x2b4f6b,JSON[_0x0ceb('0x13')](_0x54a173));_0x3f650d[_0x0ceb('0x14')]();});}}catch(_0x536bdd){logger[_0x0ceb('0x15')](_0x0ceb('0x10'),_0x2b4f6b,JSON['stringify'](_0x536bdd));_0x3f650d[_0x0ceb('0x14')]();}};}; \ No newline at end of file +var _0x73f5=['lodash','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','channel','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','Message','create','then','info','catch','error','stringify','[%s][MESSAGE]\x20%s','stop'];(function(_0x32efcb,_0x55523f){var _0x1dae88=function(_0x11c606){while(--_0x11c606){_0x32efcb['push'](_0x32efcb['shift']());}};_0x1dae88(++_0x55523f);}(_0x73f5,0x1cb));var _0x573f=function(_0x16e874,_0x154da0){_0x16e874=_0x16e874-0x0;var _0x5460d4=_0x73f5[_0x16e874];return _0x5460d4;};'use strict';var _=require(_0x573f('0x0'));var utils=require(_0x573f('0x1'));var logger=require(_0x573f('0x2'))(_0x573f('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x573f('0x4')),'mailMessage':require(_0x573f('0x5')),'smsMessage':require(_0x573f('0x6')),'faxMessage':require(_0x573f('0x7')),'whatsappMessage':require(_0x573f('0x8'))};exports[_0x573f('0x9')]=function(_0x242662,_0x511645){return function(_0x2e7512){try{var _0x507ca6={'body':utils[_0x573f('0xa')](_0x511645[0x0],this),'ContactId':this['contact']['id']};if(this[_0x573f('0xb')]==='chat'){_0x507ca6[_0x573f('0xc')]=this[_0x573f('0xd')]['id'];}else{_0x507ca6[_[_0x573f('0xe')](this['channel'])+_0x573f('0xf')]=this['account']['id'];}_0x507ca6[_[_0x573f('0xe')](this[_0x573f('0xb')])+_0x573f('0x10')]=this[_0x573f('0x11')]['id'];if(rpc[this['channel']+'Message']){return rpc[this['channel']+_0x573f('0x12')][_0x573f('0x13')](_0x507ca6)[_0x573f('0x14')](function(_0x322304){logger[_0x573f('0x15')]('[%s][MESSAGE]\x20%s',_0x242662,_0x507ca6['body']);_0x2e7512['next']();})[_0x573f('0x16')](function(_0x149144){logger[_0x573f('0x17')]('[%s][MESSAGE]\x20%s',_0x242662,JSON[_0x573f('0x18')](_0x149144));_0x2e7512['stop']();});}}catch(_0x55d73f){logger['error'](_0x573f('0x19'),_0x242662,JSON[_0x573f('0x18')](_0x55d73f));_0x2e7512[_0x573f('0x1a')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index 69c9f73..844a9ba 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 _0xbfe3=['../../../../config/logger','routing','consequence','[%s][NOOP]\x20%s','getMustacheRender','error','stringify','./utils'];(function(_0x57f2fe,_0x7f4668){var _0x2b759e=function(_0x3743e6){while(--_0x3743e6){_0x57f2fe['push'](_0x57f2fe['shift']());}};_0x2b759e(++_0x7f4668);}(_0xbfe3,0x197));var _0x3bfe=function(_0xae145e,_0x47cca9){_0xae145e=_0xae145e-0x0;var _0x4c6903=_0xbfe3[_0xae145e];return _0x4c6903;};'use strict';var utils=require(_0x3bfe('0x0'));var logger=require(_0x3bfe('0x1'))(_0x3bfe('0x2'));exports[_0x3bfe('0x3')]=function(_0x276838,_0x4385c7){return function(_0x496c55){try{logger['info'](_0x3bfe('0x4'),_0x276838,utils[_0x3bfe('0x5')](_0x4385c7[0x0],this));_0x496c55['next']();}catch(_0x2a35d8){logger[_0x3bfe('0x6')](_0x3bfe('0x4'),_0x276838,JSON[_0x3bfe('0x7')](_0x2a35d8));_0x496c55['stop']();}};}; \ No newline at end of file +var _0x9306=['next','stringify','stop','./utils','consequence','info','[%s][NOOP]\x20%s','getMustacheRender'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x9306,0x17b));var _0x6930=function(_0xcc4bfe,_0x20bbc1){_0xcc4bfe=_0xcc4bfe-0x0;var _0x3b9903=_0x9306[_0xcc4bfe];return _0x3b9903;};'use strict';var utils=require(_0x6930('0x0'));var logger=require('../../../../config/logger')('routing');exports[_0x6930('0x1')]=function(_0x314597,_0x236536){return function(_0x383a3a){try{logger[_0x6930('0x2')](_0x6930('0x3'),_0x314597,utils[_0x6930('0x4')](_0x236536[0x0],this));_0x383a3a[_0x6930('0x5')]();}catch(_0x59bde5){logger['error'](_0x6930('0x3'),_0x314597,JSON[_0x6930('0x6')](_0x59bde5));_0x383a3a[_0x6930('0x7')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index ce8f941..f727b71 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 _0x1171=['../../rpc/chatInteraction','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','contact','list','channel','interaction','MessageId','message','upperFirst','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','YYYY-MM-DD\x20HH:mm:ss','accepted','body','Interaction','then','update','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','[%s][QUEUE]\x20%s','map','join','find','atimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','rules','stop','complete','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','validate','lodash','util','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','queue_id','account','from','joinAt','emit','clone','queue','push','capitalize','InteractionId','%sQueuesWaitingInteractions','format','%s:queue:%s','%s_queue_waiting_interaction:%s','remove','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x1171,0x129));var _0x1117=function(_0x5a2d3f,_0x27b04e){_0x5a2d3f=_0x5a2d3f-0x0;var _0x5c65d8=_0x1171[_0x5a2d3f];return _0x5c65d8;};'use strict';var schema=require(_0x1117('0x0'));var _=require(_0x1117('0x1'));var util=require(_0x1117('0x2'));var seqqueue=require('seq-queue');var moment=require('moment');var Redis=require(_0x1117('0x3'));var config=require(_0x1117('0x4'));var logger=require(_0x1117('0x5'))(_0x1117('0x6'));var strategy=require(_0x1117('0x7'));config[_0x1117('0x8')]=_[_0x1117('0x9')](config[_0x1117('0x8')],{'host':_0x1117('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var attributes=['id',_0x1117('0xb'),_0x1117('0xc'),'queue',_0x1117('0xd'),_0x1117('0xe')];function emit(_0x31df26,_0x4fdde9,_0x2aee54){io['to'](_0x31df26)[_0x1117('0xf')](_0x4fdde9,_0x2aee54);}function emitChannelQueueInteraction(_0x51619d,_0x8a2cd,_0x2b8f78,_0x15fc38,_0x367bde,_0x4d1cf3,_0x585387,_0x798b0e){var _0x45f7f5=_[_0x1117('0x10')](_0x2b8f78);_0x45f7f5['queue_id']=_0x798b0e;_0x45f7f5[_0x1117('0x11')]=_0x8a2cd;_0x45f7f5[_0x1117('0xc')]=_0x15fc38;_0x45f7f5['id']=_0x367bde;if(_0x4d1cf3){attributes[_0x1117('0x12')](_[_0x1117('0x13')](_0x51619d)+_0x1117('0x14'));_0x585387[util['format'](_0x1117('0x15'),_0x51619d)][_0x367bde]=_['pick'](_0x45f7f5,attributes);}else{delete _0x585387[util['format'](_0x1117('0x15'),_0x51619d)][_0x367bde];}emit(util[_0x1117('0x16')](_0x1117('0x17'),_0x51619d,_0x8a2cd),util['format'](_0x1117('0x18'),_0x51619d,_0x4d1cf3?'save':_0x1117('0x19')),_['pick'](_0x45f7f5,attributes));}var rpc={'openchannelQueueReport':require(_0x1117('0x1a')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0x1117('0x1b')),'smsQueueReport':require(_0x1117('0x1c')),'faxQueueReport':require(_0x1117('0x1d')),'whatsappQueueReport':require(_0x1117('0x1e')),'chatInteraction':require(_0x1117('0x1f')),'faxInteraction':require(_0x1117('0x20')),'mailInteraction':require(_0x1117('0x21')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x1117('0x22')),'whatsappInteraction':require(_0x1117('0x23'))};var queue=schema({'name':{'type':_0x1117('0x24'),'required':!![],'message':_0x1117('0x25')},'timeout':{'type':_0x1117('0x26'),'message':_0x1117('0x27')}});function startRouting(_0x4fe77b,_0xc89b1e,_0x283e53,_0x67a7b7){if(_0x4fe77b&&_0xc89b1e&&_0x283e53){_0xc89b1e['waiting']+=0x1;var _0x352d54={'uniqueid':_0x4fe77b,'from':_0x283e53['body']?_0x283e53['body'][_0x1117('0xd')]:'','joinAt':moment()[_0x1117('0x16')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x283e53['contact']?_0x283e53[_0x1117('0x28')]['id']:null,'ListId':_0x283e53[_0x1117('0x29')]?_0x283e53[_0x1117('0x29')]['id']:null};_0x352d54[_['upperFirst'](_0x283e53[_0x1117('0x2a')])+'QueueId']=_0xc89b1e['id']||null;_0x352d54[_['upperFirst'](_0x283e53[_0x1117('0x2a')])+_0x1117('0x14')]=_0x283e53[_0x1117('0x2b')]?_0x283e53[_0x1117('0x2b')]['id']:null;_0x352d54[_['upperFirst'](_0x283e53[_0x1117('0x2a')])+_0x1117('0x2c')]=_0x283e53[_0x1117('0x2d')]?_0x283e53[_0x1117('0x2d')]['id']:null;_0x352d54[_[_0x1117('0x2e')](_0x283e53[_0x1117('0x2a')])+(_0x283e53[_0x1117('0x2a')]!==_0x1117('0x2f')?_0x1117('0x30'):_0x1117('0x31'))]=_0x283e53[_0x1117('0xc')]?_0x283e53[_0x1117('0xc')]['id']:null;logger[_0x1117('0x32')](util[_0x1117('0x16')](_0x1117('0x33'),_0x4fe77b,_0xc89b1e['name']));emitChannelQueueInteraction(_0x283e53[_0x1117('0x2a')],_0xc89b1e[_0x1117('0x34')],_0x352d54,_0x283e53[_0x1117('0xc')][_0x1117('0x34')],_0x283e53[_0x1117('0x2d')]['id'],!![],_0x67a7b7,_0xc89b1e['id']);if(rpc[_0x283e53[_0x1117('0x2a')]+'QueueReport']){return rpc[_0x283e53[_0x1117('0x2a')]+_0x1117('0x35')][_0x1117('0x36')](_0x352d54)[_0x1117('0x37')](function(_0x2298f2){logger[_0x1117('0x38')]('create\x20queue\x20report',_0x2298f2);});}}}function stopRouting(_0x135957,_0x1eaf56,_0x25fd87,_0x133d8d){if(_0x135957&&_0x1eaf56){_0x1eaf56['waiting']-=0x1;var _0x5424cb={'leaveAt':moment()[_0x1117('0x16')](_0x1117('0x39')),'acceptAt':moment()[_0x1117('0x16')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x1117('0x3a')};logger[_0x1117('0x32')](util[_0x1117('0x16')]('[%s][STOP:QUEUE][NAME:%s]',_0x135957,_0x1eaf56[_0x1117('0x34')]));emitChannelQueueInteraction(_0x25fd87[_0x1117('0x2a')],_0x1eaf56[_0x1117('0x34')],_0x25fd87[_0x1117('0x3b')],_0x25fd87[_0x1117('0xc')][_0x1117('0x34')],_0x25fd87[_0x1117('0x2d')]['id'],![],_0x133d8d,_0x1eaf56['id']);return rpc[_0x25fd87['channel']+_0x1117('0x3c')]['update'](_0x25fd87[_0x1117('0x2b')]['id'],{'queueId':_0x1eaf56['id']})[_0x1117('0x3d')](function(){if(rpc[_0x25fd87[_0x1117('0x2a')]+_0x1117('0x35')]){return rpc[_0x25fd87[_0x1117('0x2a')]+_0x1117('0x35')][_0x1117('0x3e')](_0x135957,_0x5424cb)['catch'](function(_0x2a14e5){logger[_0x1117('0x38')](_0x1117('0x3f'),_0x2a14e5);});}});}}function endRouting(_0x546852,_0x41a500,_0x193588,_0x2a5293){if(_0x546852&&_0x41a500){_0x41a500['waiting']-=0x1;var _0x368e78={'leaveAt':moment()[_0x1117('0x16')](_0x1117('0x39')),'exitAt':moment()[_0x1117('0x16')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x1117('0x40')};logger[_0x1117('0x32')](util[_0x1117('0x16')](_0x1117('0x41'),_0x546852,_0x41a500['name']));emitChannelQueueInteraction(_0x193588[_0x1117('0x2a')],_0x41a500['name'],_0x193588['body'],_0x193588[_0x1117('0xc')][_0x1117('0x34')],_0x193588[_0x1117('0x2d')]['id'],![],_0x2a5293);if(rpc[_0x193588['channel']+_0x1117('0x35')]){return rpc[_0x193588[_0x1117('0x2a')]+_0x1117('0x35')][_0x1117('0x3e')](_0x546852,_0x368e78)['catch'](function(_0x54caa4){logger[_0x1117('0x38')]('update\x20queue\x20report',_0x54caa4);});}}}function handleFindQueue(_0x413406){return function(_0x571c94){return _0x571c94[_0x1117('0x34')][_0x1117('0x42')]()===_0x413406[_0x1117('0x42')]();};}exports[_0x1117('0x43')]=function(_0x28f5c6,_0x4e27d2,_0x28e4b2,_0x22543e){return function(_0x4ef0f4){try{var _0x255e6d={'name':_0x4e27d2[0x0],'timeout':_0x4e27d2[0x1]};var _0x194afd=queue[_0x1117('0x0')](_0x255e6d,{'typecast':!![]});if(_0x194afd['length']){logger['error'](_0x1117('0x44'),_0x28f5c6,_[_0x1117('0x45')](_0x194afd,'message')[_0x1117('0x46')](',\x20'));_0x4ef0f4['stop']();}else{var _0x510125=_[_0x1117('0x47')](_0x28e4b2[_0x22543e['channel']+'Queues'],handleFindQueue(_0x255e6d[_0x1117('0x34')]));if(_0x510125){startRouting(_0x28f5c6,_0x510125,_0x22543e,_0x28e4b2);var _0x367542=(_0x510125[_0x1117('0x40')]||0xa)*0x3e8;var _0x25f3a6=(_0x255e6d[_0x1117('0x40')]||0x14)*0x3e8;var _0x3c67f2;if(_0x367542>_0x25f3a6){_0x25f3a6=_0x367542;}var _0x4e8d49=seqqueue['createQueue'](_0x367542);_0x4e8d49['id']=_0x28f5c6;_0x4e8d49[_0x1117('0x48')]=_0x367542;_0x4e8d49['qtimeout']=_0x25f3a6;_0x4e8d49[_0x1117('0x2a')]=_0x22543e['channel'];_0x28e4b2['rules'][_0x28f5c6]['on'](_0x1117('0x49'),function(){logger[_0x1117('0x32')](_0x1117('0x4a'),_0x28f5c6);stopRouting(_0x28f5c6,_0x510125,_0x22543e,_0x28e4b2);clearTimeout(_0x3c67f2);_0x3c67f2=undefined;_0x4e8d49['close'](!![]);if(_0x28e4b2[_0x1117('0x4b')][_0x28f5c6]){delete _0x28e4b2[_0x1117('0x4b')][_0x28f5c6];}_0x4ef0f4[_0x1117('0x4c')]();});_0x28e4b2[_0x1117('0x4b')][_0x28f5c6]['on'](_0x1117('0x4d'),function(){if(_0x28e4b2[_0x1117('0x4b')][_0x28f5c6]){delete _0x28e4b2[_0x1117('0x4b')][_0x28f5c6];}});_0x3c67f2=setTimeout(function(){logger[_0x1117('0x32')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x28f5c6);endRouting(_0x28f5c6,_0x510125,_0x22543e,_0x28e4b2);clearTimeout(_0x3c67f2);_0x4e8d49['close'](!![]);_0x4ef0f4['next']();},_0x25f3a6);switch(_0x510125['strategy']){case'rrmemory':strategy[_0x1117('0x4e')](_0x4e8d49,_0x510125,_0x28e4b2,_0x22543e);break;default:strategy[_0x1117('0x4f')](_0x4e8d49,_0x510125,_0x28e4b2,_0x22543e);}}else{logger[_0x1117('0x38')](_0x1117('0x50'),_0x28f5c6,_0x255e6d[_0x1117('0x34')]);_0x4ef0f4[_0x1117('0x4c')]();}}}catch(_0x2fbc93){logger[_0x1117('0x38')]('[%s][QUEUE]\x20%s',_0x28f5c6,_0x2fbc93[_0x1117('0x51')]);_0x4ef0f4[_0x1117('0x4c')]();}};}; \ No newline at end of file +var _0x3c45=['../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','channel','upperFirst','interaction','message','WebsiteId','account','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','Interaction','update','then','error','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','length','[%s][QUEUE]\x20%s','join','find','Queues','atimeout','qtimeout','rules','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','stop','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','validate','util','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue','from','joinAt','emit','queue_id','push','InteractionId','format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','pick','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport'];(function(_0x1fc122,_0x5e2c17){var _0xa2cb13=function(_0x263b13){while(--_0x263b13){_0x1fc122['push'](_0x1fc122['shift']());}};_0xa2cb13(++_0x5e2c17);}(_0x3c45,0x1d5));var _0x53c4=function(_0x207a0a,_0x10eceb){_0x207a0a=_0x207a0a-0x0;var _0x50445c=_0x3c45[_0x207a0a];return _0x50445c;};'use strict';var schema=require(_0x53c4('0x0'));var _=require('lodash');var util=require(_0x53c4('0x1'));var seqqueue=require('seq-queue');var moment=require(_0x53c4('0x2'));var Redis=require(_0x53c4('0x3'));var config=require(_0x53c4('0x4'));var logger=require(_0x53c4('0x5'))(_0x53c4('0x6'));var strategy=require(_0x53c4('0x7'));config[_0x53c4('0x8')]=_[_0x53c4('0x9')](config[_0x53c4('0x8')],{'host':_0x53c4('0xa'),'port':0x18eb});var io=require(_0x53c4('0xb'))(new Redis(config[_0x53c4('0x8')]));var attributes=['id','queue_id','account',_0x53c4('0xc'),_0x53c4('0xd'),_0x53c4('0xe')];function emit(_0xdc93ea,_0x3c312c,_0x1eeb2a){io['to'](_0xdc93ea)[_0x53c4('0xf')](_0x3c312c,_0x1eeb2a);}function emitChannelQueueInteraction(_0xae9de5,_0x2a4719,_0x5074ce,_0x49d832,_0x8cd175,_0x8eb2a1,_0x167ff0,_0x59b062){var _0x365e21=_['clone'](_0x5074ce);_0x365e21[_0x53c4('0x10')]=_0x59b062;_0x365e21[_0x53c4('0xc')]=_0x2a4719;_0x365e21['account']=_0x49d832;_0x365e21['id']=_0x8cd175;if(_0x8eb2a1){attributes[_0x53c4('0x11')](_['capitalize'](_0xae9de5)+_0x53c4('0x12'));_0x167ff0[util[_0x53c4('0x13')](_0x53c4('0x14'),_0xae9de5)][_0x8cd175]=_['pick'](_0x365e21,attributes);}else{delete _0x167ff0[util[_0x53c4('0x13')](_0x53c4('0x14'),_0xae9de5)][_0x8cd175];}emit(util[_0x53c4('0x13')](_0x53c4('0x15'),_0xae9de5,_0x2a4719),util['format'](_0x53c4('0x16'),_0xae9de5,_0x8eb2a1?_0x53c4('0x17'):_0x53c4('0x18')),_[_0x53c4('0x19')](_0x365e21,attributes));}var rpc={'openchannelQueueReport':require(_0x53c4('0x1a')),'mailQueueReport':require(_0x53c4('0x1b')),'chatQueueReport':require(_0x53c4('0x1c')),'smsQueueReport':require(_0x53c4('0x1d')),'faxQueueReport':require(_0x53c4('0x1e')),'whatsappQueueReport':require(_0x53c4('0x1f')),'chatInteraction':require('../../rpc/chatInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'mailInteraction':require(_0x53c4('0x20')),'openchannelInteraction':require(_0x53c4('0x21')),'smsInteraction':require(_0x53c4('0x22')),'whatsappInteraction':require(_0x53c4('0x23'))};var queue=schema({'name':{'type':'string','required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x53c4('0x24'),'message':_0x53c4('0x25')}});function startRouting(_0x3ead91,_0x31edc4,_0x3d45c8,_0x6fe425){if(_0x3ead91&&_0x31edc4&&_0x3d45c8){_0x31edc4[_0x53c4('0x26')]+=0x1;var _0x343d3f={'uniqueid':_0x3ead91,'from':_0x3d45c8[_0x53c4('0x27')]?_0x3d45c8[_0x53c4('0x27')][_0x53c4('0xd')]:'','joinAt':moment()[_0x53c4('0x13')](_0x53c4('0x28')),'ContactId':_0x3d45c8[_0x53c4('0x29')]?_0x3d45c8['contact']['id']:null,'ListId':_0x3d45c8[_0x53c4('0x2a')]?_0x3d45c8[_0x53c4('0x2a')]['id']:null};_0x343d3f[_['upperFirst'](_0x3d45c8[_0x53c4('0x2b')])+'QueueId']=_0x31edc4['id']||null;_0x343d3f[_[_0x53c4('0x2c')](_0x3d45c8[_0x53c4('0x2b')])+'InteractionId']=_0x3d45c8[_0x53c4('0x2d')]?_0x3d45c8[_0x53c4('0x2d')]['id']:null;_0x343d3f[_[_0x53c4('0x2c')](_0x3d45c8[_0x53c4('0x2b')])+'MessageId']=_0x3d45c8[_0x53c4('0x2e')]?_0x3d45c8['message']['id']:null;_0x343d3f[_['upperFirst'](_0x3d45c8[_0x53c4('0x2b')])+(_0x3d45c8[_0x53c4('0x2b')]!=='chat'?'AccountId':_0x53c4('0x2f'))]=_0x3d45c8[_0x53c4('0x30')]?_0x3d45c8[_0x53c4('0x30')]['id']:null;logger[_0x53c4('0x31')](util[_0x53c4('0x13')](_0x53c4('0x32'),_0x3ead91,_0x31edc4[_0x53c4('0x33')]));emitChannelQueueInteraction(_0x3d45c8['channel'],_0x31edc4[_0x53c4('0x33')],_0x343d3f,_0x3d45c8[_0x53c4('0x30')]['name'],_0x3d45c8[_0x53c4('0x2e')]['id'],!![],_0x6fe425,_0x31edc4['id']);if(rpc[_0x3d45c8[_0x53c4('0x2b')]+'QueueReport']){return rpc[_0x3d45c8[_0x53c4('0x2b')]+_0x53c4('0x34')][_0x53c4('0x35')](_0x343d3f)[_0x53c4('0x36')](function(_0x1722c8){logger['error'](_0x53c4('0x37'),_0x1722c8);});}}}function stopRouting(_0x1fef8d,_0xbc23a6,_0x1f510d,_0x19f3d4){if(_0x1fef8d&&_0xbc23a6){_0xbc23a6['waiting']-=0x1;var _0x5a09f6={'leaveAt':moment()[_0x53c4('0x13')](_0x53c4('0x28')),'acceptAt':moment()[_0x53c4('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x53c4('0x38')};logger[_0x53c4('0x31')](util['format'](_0x53c4('0x39'),_0x1fef8d,_0xbc23a6[_0x53c4('0x33')]));emitChannelQueueInteraction(_0x1f510d['channel'],_0xbc23a6[_0x53c4('0x33')],_0x1f510d[_0x53c4('0x27')],_0x1f510d['account'][_0x53c4('0x33')],_0x1f510d[_0x53c4('0x2e')]['id'],![],_0x19f3d4,_0xbc23a6['id']);return rpc[_0x1f510d[_0x53c4('0x2b')]+_0x53c4('0x3a')][_0x53c4('0x3b')](_0x1f510d['interaction']['id'],{'queueId':_0xbc23a6['id']})[_0x53c4('0x3c')](function(){if(rpc[_0x1f510d['channel']+_0x53c4('0x34')]){return rpc[_0x1f510d[_0x53c4('0x2b')]+_0x53c4('0x34')][_0x53c4('0x3b')](_0x1fef8d,_0x5a09f6)[_0x53c4('0x36')](function(_0x567281){logger[_0x53c4('0x3d')](_0x53c4('0x3e'),_0x567281);});}});}}function endRouting(_0x42349b,_0x5b557e,_0x9bd394,_0xb18a0f){if(_0x42349b&&_0x5b557e){_0x5b557e[_0x53c4('0x26')]-=0x1;var _0x1b2ba6={'leaveAt':moment()[_0x53c4('0x13')](_0x53c4('0x28')),'exitAt':moment()[_0x53c4('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x53c4('0x3f')};logger[_0x53c4('0x31')](util['format'](_0x53c4('0x40'),_0x42349b,_0x5b557e[_0x53c4('0x33')]));emitChannelQueueInteraction(_0x9bd394[_0x53c4('0x2b')],_0x5b557e[_0x53c4('0x33')],_0x9bd394['body'],_0x9bd394['account'][_0x53c4('0x33')],_0x9bd394[_0x53c4('0x2e')]['id'],![],_0xb18a0f);if(rpc[_0x9bd394[_0x53c4('0x2b')]+_0x53c4('0x34')]){return rpc[_0x9bd394[_0x53c4('0x2b')]+_0x53c4('0x34')][_0x53c4('0x3b')](_0x42349b,_0x1b2ba6)[_0x53c4('0x36')](function(_0x4da9f2){logger['error']('update\x20queue\x20report',_0x4da9f2);});}}}function handleFindQueue(_0x24ffe4){return function(_0x542572){return _0x542572['name'][_0x53c4('0x41')]()===_0x24ffe4[_0x53c4('0x41')]();};}exports['consequence']=function(_0x5784d7,_0x3453ed,_0x3141de,_0x478222){return function(_0x5ecd46){try{var _0xced003={'name':_0x3453ed[0x0],'timeout':_0x3453ed[0x1]};var _0x12c397=queue[_0x53c4('0x0')](_0xced003,{'typecast':!![]});if(_0x12c397[_0x53c4('0x42')]){logger[_0x53c4('0x3d')](_0x53c4('0x43'),_0x5784d7,_['map'](_0x12c397,_0x53c4('0x2e'))[_0x53c4('0x44')](',\x20'));_0x5ecd46['stop']();}else{var _0x3747ae=_[_0x53c4('0x45')](_0x3141de[_0x478222[_0x53c4('0x2b')]+_0x53c4('0x46')],handleFindQueue(_0xced003[_0x53c4('0x33')]));if(_0x3747ae){startRouting(_0x5784d7,_0x3747ae,_0x478222,_0x3141de);var _0x6b948d=(_0x3747ae[_0x53c4('0x3f')]||0xa)*0x3e8;var _0x22637b=(_0xced003['timeout']||0x14)*0x3e8;var _0x57b1e4;if(_0x6b948d>_0x22637b){_0x22637b=_0x6b948d;}var _0x32b6b6=seqqueue['createQueue'](_0x6b948d);_0x32b6b6['id']=_0x5784d7;_0x32b6b6[_0x53c4('0x47')]=_0x6b948d;_0x32b6b6[_0x53c4('0x48')]=_0x22637b;_0x32b6b6['channel']=_0x478222[_0x53c4('0x2b')];_0x3141de[_0x53c4('0x49')][_0x5784d7]['on']('end',function(){logger[_0x53c4('0x31')](_0x53c4('0x4a'),_0x5784d7);stopRouting(_0x5784d7,_0x3747ae,_0x478222,_0x3141de);clearTimeout(_0x57b1e4);_0x57b1e4=undefined;_0x32b6b6[_0x53c4('0x4b')](!![]);if(_0x3141de['rules'][_0x5784d7]){delete _0x3141de[_0x53c4('0x49')][_0x5784d7];}_0x5ecd46[_0x53c4('0x4c')]();});_0x3141de[_0x53c4('0x49')][_0x5784d7]['on'](_0x53c4('0x4d'),function(){if(_0x3141de['rules'][_0x5784d7]){delete _0x3141de['rules'][_0x5784d7];}});_0x57b1e4=setTimeout(function(){logger[_0x53c4('0x31')](_0x53c4('0x4e'),_0x5784d7);endRouting(_0x5784d7,_0x3747ae,_0x478222,_0x3141de);clearTimeout(_0x57b1e4);_0x32b6b6[_0x53c4('0x4b')](!![]);_0x5ecd46[_0x53c4('0x4f')]();},_0x22637b);switch(_0x3747ae['strategy']){case _0x53c4('0x50'):strategy['rrmemory'](_0x32b6b6,_0x3747ae,_0x3141de,_0x478222);break;default:strategy[_0x53c4('0x51')](_0x32b6b6,_0x3747ae,_0x3141de,_0x478222);}}else{logger[_0x53c4('0x3d')](_0x53c4('0x52'),_0x5784d7,_0xced003[_0x53c4('0x33')]);_0x5ecd46[_0x53c4('0x4c')]();}}}catch(_0x42f009){logger[_0x53c4('0x3d')]('[%s][QUEUE]\x20%s',_0x5784d7,_0x42f009['stack']);_0x5ecd46[_0x53c4('0x4c')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/agent.js b/server/services/routing/server/applications/strategy/agent.js index 5b22092..1d40d11 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 _0x34e8=['busy','busyQueue','showNotification','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','removeWaitingNotification','STOP','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','notificationId','squeue','agent','routing','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','debug','[%s][AGENT]\x20try\x20with\x20%s','realtime','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel'];(function(_0x46cf00,_0x457a43){var _0x3974dc=function(_0x4b5d0a){while(--_0x4b5d0a){_0x46cf00['push'](_0x46cf00['shift']());}};_0x3974dc(++_0x457a43);}(_0x34e8,0x12c));var _0x834e=function(_0x7fe28e,_0x296bb0){_0x7fe28e=_0x7fe28e-0x0;var _0xedfeec=_0x34e8[_0x7fe28e];return _0xedfeec;};'use strict';var _=require(_0x834e('0x0'));var uuid=require(_0x834e('0x1'));var util=require(_0x834e('0x2'));var logger=require(_0x834e('0x3'))('routing');var Agent=function(_0x832422,_0x21e2e0,_0x472111,_0x31bf20){this[_0x834e('0x4')]=uuid['v4']();this[_0x834e('0x5')]=_0x832422;this[_0x834e('0x6')]=_0x21e2e0;this['realtime']=_0x472111;this[_0x834e('0x7')]=_0x31bf20;this['squeue'][_0x834e('0x8')](this[_0x834e('0x9')][_0x834e('0xa')](this),this[_0x834e('0xb')][_0x834e('0xa')](this));this[_0x834e('0x5')]['on'](_0x834e('0xc'),this[_0x834e('0xb')][_0x834e('0xa')](this));this[_0x834e('0x5')]['on'](_0x834e('0xd'),this[_0x834e('0xe')][_0x834e('0xa')](this));};Agent[_0x834e('0xf')][_0x834e('0x8')]=function(){this[_0x834e('0x5')][_0x834e('0x8')](this['handleRun'][_0x834e('0xa')](this),this[_0x834e('0xb')]['bind'](this));};Agent[_0x834e('0xf')][_0x834e('0xe')]=function(){this[_0x834e('0xb')](!![]);};Agent[_0x834e('0xf')]['handleRun']=function(){logger[_0x834e('0x10')](_0x834e('0x11'),this['squeue']['id'],this[_0x834e('0x6')]['id']);if(_['isNil'](this[_0x834e('0x12')][_0x834e('0x13')][this['agent']['id']])){logger[_0x834e('0x10')](_0x834e('0x14'),this[_0x834e('0x5')]['id'],this['agent']['id']);setTimeout(this[_0x834e('0x8')][_0x834e('0xa')](this),0x3e8);}else{if(this[_0x834e('0x7')][_0x834e('0x15')]||util[_0x834e('0x16')](this[_0x834e('0x5')]['id'],this[_0x834e('0x12')]['agents'][this[_0x834e('0x6')]['id']],this[_0x834e('0x5')][_0x834e('0x17')],![])){this[_0x834e('0x12')]['agents'][this[_0x834e('0x6')]['id']][_0x834e('0x18')]=!![];this['realtime'][_0x834e('0x13')][this[_0x834e('0x6')]['id']][_0x834e('0x19')]=undefined;util['saveWaitingNotification'](this['realtime'],this[_0x834e('0x7')],this[_0x834e('0x6')],this['squeue'][_0x834e('0x17')]);util[_0x834e('0x1a')](this['notificationId'],this[_0x834e('0x5')]['id'],this[_0x834e('0x12')][_0x834e('0x13')][this['agent']['id']],null,this[_0x834e('0x7')]);util[_0x834e('0x1b')](this['squeue']['id'],this['realtime'][_0x834e('0x13')][this['agent']['id']],_0x834e('0x1c')+(this[_0x834e('0x7')][_0x834e('0x15')]?_0x834e('0x1d'):''));}else{logger[_0x834e('0x10')](_0x834e('0x1e'),this['squeue']['id'],this['agent']['id']);setTimeout(this['push']['bind'](this),0x3e8);}}};Agent[_0x834e('0xf')][_0x834e('0xb')]=function(_0x106d6a){if(_['isNil'](this[_0x834e('0x12')][_0x834e('0x13')][this[_0x834e('0x6')]['id']])){return logger[_0x834e('0x10')](_0x834e('0x14'),this[_0x834e('0x5')]['id'],this[_0x834e('0x6')]['id']);}else{logger[_0x834e('0x10')](_0x834e('0x1f'),this['squeue']['id'],this[_0x834e('0x6')]['id']);util['hideNotification'](this[_0x834e('0x4')],this[_0x834e('0x5')]['id'],this[_0x834e('0x12')][_0x834e('0x13')][this[_0x834e('0x6')]['id']],null,this[_0x834e('0x7')]);this[_0x834e('0x12')][_0x834e('0x13')][this[_0x834e('0x6')]['id']][_0x834e('0x18')]=![];this['realtime'][_0x834e('0x13')][this[_0x834e('0x6')]['id']][_0x834e('0x19')]=undefined;util[_0x834e('0x20')](this['realtime'],this[_0x834e('0x7')],this[_0x834e('0x6')],this['squeue']['channel']);util['writeLog'](this[_0x834e('0x5')]['id'],this[_0x834e('0x12')][_0x834e('0x13')][this[_0x834e('0x6')]['id']],_0x106d6a?_0x834e('0x21'):_0x834e('0x22'));}if(!_0x106d6a){setTimeout(this['push'][_0x834e('0xa')](this),0x3e8);}};function agent(_0x513f36,_0xe103fe,_0x6a3ac,_0x47abed){return new Agent(_0x513f36,_0xe103fe,_0x6a3ac,_0x47abed);}module[_0x834e('0x23')]=agent; \ No newline at end of file +var _0xb458=['[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busyQueue','writeLog','STOP','TIMEOUT','exports','lodash','uuid','./util','squeue','routing','push','handleRun','bind','timeout','handleTimeout','drained','handleDrained','prototype','agent','isNil','realtime','agents','debug','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busy','saveWaitingNotification','showNotification','notificationId','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available'];(function(_0x564390,_0x309f73){var _0x1c740f=function(_0x52b076){while(--_0x52b076){_0x564390['push'](_0x564390['shift']());}};_0x1c740f(++_0x309f73);}(_0xb458,0x103));var _0x8b45=function(_0x9e1984,_0xb2f245){_0x9e1984=_0x9e1984-0x0;var _0x1b0b0b=_0xb458[_0x9e1984];return _0x1b0b0b;};'use strict';var _=require(_0x8b45('0x0'));var uuid=require(_0x8b45('0x1'));var util=require(_0x8b45('0x2'));var logger=require('../../../../../config/logger')('routing');var Agent=function(_0xdf89d4,_0x93d9cd,_0x141a44,_0x13a8c6){this['notificationId']=uuid['v4']();this[_0x8b45('0x3')]=_0xdf89d4;this['agent']=_0x93d9cd;this['realtime']=_0x141a44;this[_0x8b45('0x4')]=_0x13a8c6;this[_0x8b45('0x3')][_0x8b45('0x5')](this[_0x8b45('0x6')][_0x8b45('0x7')](this),this['handleTimeout'][_0x8b45('0x7')](this));this[_0x8b45('0x3')]['on'](_0x8b45('0x8'),this[_0x8b45('0x9')][_0x8b45('0x7')](this));this['squeue']['on'](_0x8b45('0xa'),this[_0x8b45('0xb')]['bind'](this));};Agent['prototype']['push']=function(){this['squeue'][_0x8b45('0x5')](this[_0x8b45('0x6')][_0x8b45('0x7')](this),this['handleTimeout'][_0x8b45('0x7')](this));};Agent[_0x8b45('0xc')][_0x8b45('0xb')]=function(){this[_0x8b45('0x9')](!![]);};Agent[_0x8b45('0xc')][_0x8b45('0x6')]=function(){logger['debug']('[%s][AGENT]\x20try\x20with\x20%s',this[_0x8b45('0x3')]['id'],this[_0x8b45('0xd')]['id']);if(_[_0x8b45('0xe')](this[_0x8b45('0xf')][_0x8b45('0x10')][this[_0x8b45('0xd')]['id']])){logger[_0x8b45('0x11')](_0x8b45('0x12'),this[_0x8b45('0x3')]['id'],this[_0x8b45('0xd')]['id']);setTimeout(this[_0x8b45('0x5')][_0x8b45('0x7')](this),0x3e8);}else{if(this[_0x8b45('0x4')][_0x8b45('0x13')]||util[_0x8b45('0x14')](this[_0x8b45('0x3')]['id'],this[_0x8b45('0xf')][_0x8b45('0x10')][this['agent']['id']],this[_0x8b45('0x3')][_0x8b45('0x15')],![])){this[_0x8b45('0xf')][_0x8b45('0x10')][this[_0x8b45('0xd')]['id']][_0x8b45('0x16')]=!![];this[_0x8b45('0xf')][_0x8b45('0x10')][this['agent']['id']]['busyQueue']=undefined;util[_0x8b45('0x17')](this['realtime'],this[_0x8b45('0x4')],this[_0x8b45('0xd')],this[_0x8b45('0x3')][_0x8b45('0x15')]);util[_0x8b45('0x18')](this[_0x8b45('0x19')],this[_0x8b45('0x3')]['id'],this['realtime']['agents'][this[_0x8b45('0xd')]['id']],null,this[_0x8b45('0x4')]);util['writeLog'](this['squeue']['id'],this[_0x8b45('0xf')][_0x8b45('0x10')][this[_0x8b45('0xd')]['id']],_0x8b45('0x1a')+(this['routing'][_0x8b45('0x13')]?_0x8b45('0x1b'):''));}else{logger[_0x8b45('0x11')](_0x8b45('0x1c'),this[_0x8b45('0x3')]['id'],this[_0x8b45('0xd')]['id']);setTimeout(this[_0x8b45('0x5')][_0x8b45('0x7')](this),0x3e8);}}};Agent[_0x8b45('0xc')][_0x8b45('0x9')]=function(_0x339c73){if(_[_0x8b45('0xe')](this[_0x8b45('0xf')]['agents'][this[_0x8b45('0xd')]['id']])){return logger[_0x8b45('0x11')](_0x8b45('0x12'),this[_0x8b45('0x3')]['id'],this[_0x8b45('0xd')]['id']);}else{logger[_0x8b45('0x11')](_0x8b45('0x1d'),this[_0x8b45('0x3')]['id'],this['agent']['id']);util[_0x8b45('0x1e')](this[_0x8b45('0x19')],this[_0x8b45('0x3')]['id'],this[_0x8b45('0xf')][_0x8b45('0x10')][this['agent']['id']],null,this[_0x8b45('0x4')]);this['realtime']['agents'][this[_0x8b45('0xd')]['id']][_0x8b45('0x16')]=![];this[_0x8b45('0xf')][_0x8b45('0x10')][this[_0x8b45('0xd')]['id']][_0x8b45('0x1f')]=undefined;util['removeWaitingNotification'](this[_0x8b45('0xf')],this[_0x8b45('0x4')],this[_0x8b45('0xd')],this[_0x8b45('0x3')]['channel']);util[_0x8b45('0x20')](this[_0x8b45('0x3')]['id'],this[_0x8b45('0xf')]['agents'][this[_0x8b45('0xd')]['id']],_0x339c73?_0x8b45('0x21'):_0x8b45('0x22'));}if(!_0x339c73){setTimeout(this['push'][_0x8b45('0x7')](this),0x3e8);}};function agent(_0x348a13,_0x3452fb,_0x4016b7,_0x58d94f){return new Agent(_0x348a13,_0x3452fb,_0x4016b7,_0x58d94f);}module[_0x8b45('0x23')]=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index a3b7349..7ef4b9b 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 _0x5c0b=['RINGING','busy','busyQueue','name','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','STOP','TIMEOUT','removeWaitingNotification','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','queue','push','handleRun','bind','handleTimeout','drained','handleDrained','prototype','isNil','Agents','length','realtime','agents','debug','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','channel','writeLog'];(function(_0x217c2e,_0x358f06){var _0x22b7d8=function(_0x111c48){while(--_0x111c48){_0x217c2e['push'](_0x217c2e['shift']());}};_0x22b7d8(++_0x358f06);}(_0x5c0b,0x1a2));var _0xb5c0=function(_0x18435a,_0x1332ad){_0x18435a=_0x18435a-0x0;var _0x16cb98=_0x5c0b[_0x18435a];return _0x16cb98;};'use strict';var _=require(_0xb5c0('0x0'));var uuid=require(_0xb5c0('0x1'));var util=require(_0xb5c0('0x2'));var logger=require(_0xb5c0('0x3'))(_0xb5c0('0x4'));var Beepall=function(_0x2b3ab0,_0x4add66,_0x1bf222,_0x107665){this[_0xb5c0('0x5')]=uuid['v4']();this[_0xb5c0('0x6')]=_0x2b3ab0;this[_0xb5c0('0x7')]=_0x4add66;this['realtime']=_0x1bf222;this[_0xb5c0('0x4')]=_0x107665;this[_0xb5c0('0x6')][_0xb5c0('0x8')](this[_0xb5c0('0x9')][_0xb5c0('0xa')](this),this[_0xb5c0('0xb')][_0xb5c0('0xa')](this));this[_0xb5c0('0x6')]['on']('timeout',this[_0xb5c0('0xb')]['bind'](this));this[_0xb5c0('0x6')]['on'](_0xb5c0('0xc'),this[_0xb5c0('0xd')][_0xb5c0('0xa')](this));};Beepall[_0xb5c0('0xe')][_0xb5c0('0x8')]=function(){this[_0xb5c0('0x6')][_0xb5c0('0x8')](this[_0xb5c0('0x9')][_0xb5c0('0xa')](this),this[_0xb5c0('0xb')][_0xb5c0('0xa')](this));};Beepall['prototype'][_0xb5c0('0xd')]=function(){this[_0xb5c0('0xb')](!![]);};Beepall['prototype'][_0xb5c0('0x9')]=function(){var _0x3bc009=!![];if(!_[_0xb5c0('0xf')](this['queue'])&&!_['isNil'](this[_0xb5c0('0x7')][_0xb5c0('0x10')])&&this[_0xb5c0('0x7')]['Agents'][_0xb5c0('0x11')]>0x0){for(var _0xa23338=0x0,_0x3d4563;_0xa233380x0){for(var _0x433c3a=0x0,_0x55b1f7;_0x433c3a0x0&&_0x4703e7[_0x4bc201+_0x0a77('0x25')]>=_0x4703e7[_0x4bc201+_0x0a77('0x24')]){writeLog(_0x8a84ff,_0x4703e7,_0x4bc201['toUpperCase']()+_0x0a77('0x26'));return![];}}return!![];};exports['showNotification']=function(_0x31143d,_0x21ad75,_0x2e1ee8,_0x2459dc,_0x40afc5){return sendNotification(!![],_0x31143d,_0x21ad75,_0x2e1ee8,_0x2459dc,_0x40afc5);};exports['hideNotification']=function(_0x53262a,_0x359da7,_0x2e758d,_0x2264c7,_0x12828a){return sendNotification(![],_0x53262a,_0x359da7,_0x2e758d,_0x2264c7,_0x12828a);};exports['checkWaitingNotifications']=function(_0x3278f1,_0x385d84,_0x1bfcc9){var _0x274c74=_0x385d84[_0x0a77('0x27')]['UserId'];if(!_0x274c74&&_0x1bfcc9){_0x274c74=_0x1bfcc9['id'];}var _0x111f6d=_[_0x0a77('0x28')](_0x3278f1[_0x385d84[_0x0a77('0x29')]+_0x0a77('0x2a')],function(_0x22eee9){var _0x1fcb67=_[_0x0a77('0x2b')](_0x385d84['channel'])+_0x0a77('0x2c');return _0x22eee9[_0x1fcb67]===_0x385d84[_0x0a77('0x27')]['id'];});if(!_0x111f6d&&_0x274c74&&_0x3278f1['agents'][_0x274c74]){_0x111f6d=_[_0x0a77('0x28')](_0x3278f1[_0x0a77('0x2d')][_0x274c74][_0x385d84['channel']+_0x0a77('0x2e')],function(_0x3a27e5){return _0x3a27e5['id']===_0x385d84[_0x0a77('0x27')]['id'];});}return _0x111f6d;};exports[_0x0a77('0x2f')]=function(_0x5d2cc4,_0x42b823,_0x32e404,_0x2d63ea){if(_0x32e404&&_0x32e404['id']&&_0x5d2cc4[_0x0a77('0x2d')]&&_0x5d2cc4[_0x0a77('0x2d')][_0x32e404['id']]){_0x5d2cc4['agents'][_0x32e404['id']][_0x2d63ea+'WaitingInteractions'][_0x42b823[_0x0a77('0x16')]['id']]={'id':_0x42b823['interaction']['id']};}};exports[_0x0a77('0x30')]=function(_0xc5106c,_0x51cbbc,_0x5f5c12,_0x13fb8f){if(_0x5f5c12&&_0x5f5c12['id']&&_0xc5106c[_0x0a77('0x2d')]&&_0xc5106c[_0x0a77('0x2d')][_0x5f5c12['id']]){delete _0xc5106c[_0x0a77('0x2d')][_0x5f5c12['id']][_0x13fb8f+_0x0a77('0x2e')][_0x51cbbc[_0x0a77('0x16')]['id']];}};exports[_0x0a77('0x31')]=writeLog; \ No newline at end of file +var _0xdeff=['some','QueuesWaitingInteractions','channel','InteractionId','interaction','agents','saveWaitingNotification','WaitingInteractions','lodash','../utils','../../../../../config/environment','routing','defaults','redis','localhost','socket.io-emitter','split','name','account','notificationSound','notificationShake','body','queue','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','format','[%s][QUEUE]\x20%s','message','user:%s','notification:%s','remove','debug','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','OFFLINE','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','showNotification','checkWaitingNotifications','UserId'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdeff,0x151));var _0xfdef=function(_0x4cd21c,_0x35fa45){_0x4cd21c=_0x4cd21c-0x0;var _0x5d8e5e=_0xdeff[_0x4cd21c];return _0x5d8e5e;};'use strict';var _=require(_0xfdef('0x0'));var util=require('util');var utils=require(_0xfdef('0x1'));var Redis=require('ioredis');var config=require(_0xfdef('0x2'));var logger=require('../../../../../config/logger')(_0xfdef('0x3'));config['redis']=_[_0xfdef('0x4')](config[_0xfdef('0x5')],{'host':_0xfdef('0x6'),'port':0x18eb});var io=require(_0xfdef('0x7'))(new Redis(config[_0xfdef('0x5')]));function sendNotification(_0x6f6779,_0x4f064c,_0x2662f,_0x12831d,_0x43df93,_0x5249d0){var _0x2dfdbe=_0x5249d0||{};var _0x55bb5f=_0x2662f[_0xfdef('0x8')]('.');var _0x330d10={'uniqueid':_0x4f064c,'channel':_0x55bb5f[0x0],'id':_0x55bb5f[0x1],'title':_0x55bb5f[0x0]+'\x20interaction','interactionId':_0x55bb5f[0x2],'queue':_0x43df93?_0x43df93[_0xfdef('0x9')]:null,'sound':_0x2dfdbe[_0xfdef('0xa')][_0xfdef('0xb')],'shake':_0x2dfdbe[_0xfdef('0xa')][_0xfdef('0xc')]};try{if(!_0x2dfdbe['body']){_0x2dfdbe[_0xfdef('0xd')]={};}if(_0x43df93){_0x2dfdbe[_0xfdef('0xd')]['queue']=_0x43df93;}else if(_0x2dfdbe['body'][_0xfdef('0xe')]){delete _0x2dfdbe[_0xfdef('0xd')][_0xfdef('0xe')];}_0x330d10[_0xfdef('0xf')]=utils[_0xfdef('0x10')](_0x2dfdbe[_0xfdef('0xa')][_0xfdef('0x11')],_0x2dfdbe);}catch(_0x1dcf30){_0x330d10[_0xfdef('0xf')]=_0xfdef('0x12');logger[_0xfdef('0x13')](util[_0xfdef('0x14')](_0xfdef('0x15'),_0x4f064c,_0x1dcf30[_0xfdef('0x16')]));}io['to'](util['format'](_0xfdef('0x17'),_0x12831d[_0xfdef('0x9')]))['emit'](util[_0xfdef('0x14')](_0xfdef('0x18'),_0x6f6779?'save':_0xfdef('0x19')),_0x330d10);}function writeLog(_0x4d27cb,_0x2f5d27,_0x443543){return logger[_0xfdef('0x1a')](util[_0xfdef('0x14')](_0xfdef('0x1b'),_0x4d27cb,_0x2f5d27[_0xfdef('0x9')],_0x443543));}exports[_0xfdef('0x1c')]=function(_0x237819,_0x10bfe8,_0x1abbdf,_0x24dba4){if(_0x10bfe8[_0xfdef('0x1d')]){writeLog(_0x237819,_0x10bfe8,'BUSY');return![];}if(!_0x10bfe8['online']){writeLog(_0x237819,_0x10bfe8,_0xfdef('0x1e'));return![];}if(_0x10bfe8[_0x1abbdf+_0xfdef('0x1f')]){writeLog(_0x237819,_0x10bfe8,_0xfdef('0x20'));return![];}if(_0x24dba4&&_0x10bfe8[_0xfdef('0x21')](_0x1abbdf+_0xfdef('0x22'))&&_0x10bfe8['hasOwnProperty'](_0x1abbdf+_0xfdef('0x23'))){if(_0x10bfe8[_0x1abbdf+_0xfdef('0x22')]>0x0&&_0x10bfe8[_0x1abbdf+'CurrentCapacity']>=_0x10bfe8[_0x1abbdf+_0xfdef('0x22')]){writeLog(_0x237819,_0x10bfe8,_0x1abbdf['toUpperCase']()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0xfdef('0x24')]=function(_0x5a9f4c,_0x40361f,_0x1fdca3,_0x362c58,_0x355fec){return sendNotification(!![],_0x5a9f4c,_0x40361f,_0x1fdca3,_0x362c58,_0x355fec);};exports['hideNotification']=function(_0xfe4a40,_0x20648e,_0x138647,_0xb67935,_0x20c895){return sendNotification(![],_0xfe4a40,_0x20648e,_0x138647,_0xb67935,_0x20c895);};exports[_0xfdef('0x25')]=function(_0x51fc9b,_0x88c145,_0x5ed5c0){var _0x59f831=_0x88c145['interaction'][_0xfdef('0x26')];if(!_0x59f831&&_0x5ed5c0){_0x59f831=_0x5ed5c0['id'];}var _0x3448a1=_[_0xfdef('0x27')](_0x51fc9b[_0x88c145['channel']+_0xfdef('0x28')],function(_0x406214){var _0x1d852d=_['capitalize'](_0x88c145[_0xfdef('0x29')])+_0xfdef('0x2a');return _0x406214[_0x1d852d]===_0x88c145[_0xfdef('0x2b')]['id'];});if(!_0x3448a1&&_0x59f831&&_0x51fc9b[_0xfdef('0x2c')][_0x59f831]){_0x3448a1=_[_0xfdef('0x27')](_0x51fc9b['agents'][_0x59f831][_0x88c145[_0xfdef('0x29')]+'WaitingInteractions'],function(_0x2ddacd){return _0x2ddacd['id']===_0x88c145[_0xfdef('0x2b')]['id'];});}return _0x3448a1;};exports[_0xfdef('0x2d')]=function(_0x1a2c92,_0x352ee5,_0x24dd44,_0x569572){if(_0x24dd44&&_0x24dd44['id']&&_0x1a2c92['agents']&&_0x1a2c92[_0xfdef('0x2c')][_0x24dd44['id']]){_0x1a2c92[_0xfdef('0x2c')][_0x24dd44['id']][_0x569572+_0xfdef('0x2e')][_0x352ee5[_0xfdef('0x16')]['id']]={'id':_0x352ee5['interaction']['id']};}};exports['removeWaitingNotification']=function(_0x5aaaa3,_0x9d6c80,_0x2a49f9,_0x37a3eb){if(_0x2a49f9&&_0x2a49f9['id']&&_0x5aaaa3[_0xfdef('0x2c')]&&_0x5aaaa3[_0xfdef('0x2c')][_0x2a49f9['id']]){delete _0x5aaaa3[_0xfdef('0x2c')][_0x2a49f9['id']][_0x37a3eb+_0xfdef('0x2e')][_0x9d6c80[_0xfdef('0x16')]['id']];}};exports['writeLog']=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index 09c1848..73db976 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 _0xdb95=['../../../../config/logger','routing','string','consequence','validate','error','[%s][SYSTEM]\x20%s','map','message','join','info','next','getMustacheRender','exec','trim','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','stringify','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','shelljs','lodash','./utils'];(function(_0x2577c8,_0x579967){var _0x273700=function(_0x36136e){while(--_0x36136e){_0x2577c8['push'](_0x2577c8['shift']());}};_0x273700(++_0x579967);}(_0xdb95,0x1d1));var _0x5db9=function(_0x10cff8,_0x5e9134){_0x10cff8=_0x10cff8-0x0;var _0x1ee5de=_0xdb95[_0x10cff8];return _0x1ee5de;};'use strict';var schema=require('validate');var sh=require(_0x5db9('0x0'));var _=require(_0x5db9('0x1'));var utils=require(_0x5db9('0x2'));var logger=require(_0x5db9('0x3'))(_0x5db9('0x4'));var system=schema({'command':{'type':_0x5db9('0x5'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x5db9('0x6')]=function(_0x22bfd4,_0x1b821f){return function(_0x5f1902){try{var _0x9bcc70={'command':_0x1b821f[0x0]};var _0x28d12b=system[_0x5db9('0x7')](_0x9bcc70,{'typecast':!![]});if(_0x28d12b['length']){logger[_0x5db9('0x8')](_0x5db9('0x9'),_0x22bfd4,_[_0x5db9('0xa')](_0x28d12b,_0x5db9('0xb'))[_0x5db9('0xc')](',\x20'));logger[_0x5db9('0xd')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x22bfd4);_0x5f1902[_0x5db9('0xe')]();}else{var _0x43e397=this;var _0x994c59=utils[_0x5db9('0xf')](_0x1b821f[0x0],this);logger['info']('[%s][SYSTEM]\x20commnad:\x20%s',_0x22bfd4,_0x994c59);sh[_0x5db9('0x10')](_[_0x5db9('0x11')](_0x994c59),function(_0x30d55d,_0x4c4849){logger[_0x5db9('0xd')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x22bfd4,_0x30d55d);if(_0x30d55d==0x0){var _0x379019=_0x4c4849[_0x5db9('0x12')](/(\r\n|\n|\r)/gm,'');if(_[_0x5db9('0x13')](_0x1b821f[0x1])||_[_0x5db9('0x14')](_0x1b821f[0x1])){logger[_0x5db9('0xd')](_0x5db9('0x15'),_0x22bfd4);_0x43e397[_0x5db9('0x16')][_0x1b821f[0x1]]=_0x379019;}else{logger[_0x5db9('0xd')](_0x5db9('0x17'),_0x22bfd4,_0x1b821f[0x1],_0x379019);_0x43e397[_0x5db9('0x16')][_0x1b821f[0x1]]=_0x379019;}}_0x5f1902[_0x5db9('0xe')]();});}}catch(_0x3771e2){logger[_0x5db9('0x8')](_0x5db9('0x9'),_0x22bfd4,_['isObject'](_0x3771e2)?JSON[_0x5db9('0x18')](_0x3771e2):_0x3771e2);logger[_0x5db9('0xd')](_0x5db9('0x19'),_0x22bfd4);_0x5f1902[_0x5db9('0xe')]();}};}; \ No newline at end of file +var _0x79f9=['command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map','message','join','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','getMustacheRender','info','[%s][SYSTEM]\x20commnad:\x20%s','exec','replace','isEmpty','[%s][SYSTEM]\x20no\x20variable','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','body','next','isObject','stringify','validate','shelljs','lodash','./utils','../../../../config/logger','routing','string'];(function(_0x1faec5,_0x4208cd){var _0x5851e5=function(_0x1f3ff8){while(--_0x1f3ff8){_0x1faec5['push'](_0x1faec5['shift']());}};_0x5851e5(++_0x4208cd);}(_0x79f9,0xbd));var _0x979f=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x79f9[_0x57b54c];return _0x59cc19;};'use strict';var schema=require(_0x979f('0x0'));var sh=require(_0x979f('0x1'));var _=require(_0x979f('0x2'));var utils=require(_0x979f('0x3'));var logger=require(_0x979f('0x4'))(_0x979f('0x5'));var system=schema({'command':{'type':_0x979f('0x6'),'required':!![],'message':_0x979f('0x7')}});exports[_0x979f('0x8')]=function(_0x2ab8fe,_0x56913f){return function(_0xbcf116){try{var _0x192820={'command':_0x56913f[0x0]};var _0xc4e47=system['validate'](_0x192820,{'typecast':!![]});if(_0xc4e47[_0x979f('0x9')]){logger[_0x979f('0xa')](_0x979f('0xb'),_0x2ab8fe,_[_0x979f('0xc')](_0xc4e47,_0x979f('0xd'))[_0x979f('0xe')](',\x20'));logger['info'](_0x979f('0xf'),_0x2ab8fe);_0xbcf116['next']();}else{var _0x5d1815=this;var _0xdb2bfa=utils[_0x979f('0x10')](_0x56913f[0x0],this);logger[_0x979f('0x11')](_0x979f('0x12'),_0x2ab8fe,_0xdb2bfa);sh[_0x979f('0x13')](_['trim'](_0xdb2bfa),function(_0x310804,_0x44a586){logger[_0x979f('0x11')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x2ab8fe,_0x310804);if(_0x310804==0x0){var _0x204c0f=_0x44a586[_0x979f('0x14')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x56913f[0x1])||_[_0x979f('0x15')](_0x56913f[0x1])){logger[_0x979f('0x11')](_0x979f('0x16'),_0x2ab8fe);_0x5d1815['body'][_0x56913f[0x1]]=_0x204c0f;}else{logger[_0x979f('0x11')](_0x979f('0x17'),_0x2ab8fe,_0x56913f[0x1],_0x204c0f);_0x5d1815[_0x979f('0x18')][_0x56913f[0x1]]=_0x204c0f;}}_0xbcf116[_0x979f('0x19')]();});}}catch(_0x2de146){logger[_0x979f('0xa')](_0x979f('0xb'),_0x2ab8fe,_[_0x979f('0x1a')](_0x2de146)?JSON[_0x979f('0x1b')](_0x2de146):_0x2de146);logger['info'](_0x979f('0xf'),_0x2ab8fe);_0xbcf116[_0x979f('0x19')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index 9890d83..efdcb22 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 _0x53c9=['../../rpc/mailInteraction','../../rpc/faxInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','length','error','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','addTags','interaction','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','[%s][TAG]\x20%s','finally','stringify','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction'];(function(_0x132d9e,_0x4a0839){var _0x40b733=function(_0x30c113){while(--_0x30c113){_0x132d9e['push'](_0x132d9e['shift']());}};_0x40b733(++_0x4a0839);}(_0x53c9,0x1f4));var _0x953c=function(_0x32083e,_0x130a41){_0x32083e=_0x32083e-0x0;var _0x1efcc7=_0x53c9[_0x32083e];return _0x1efcc7;};'use strict';var schema=require('validate');var _=require(_0x953c('0x0'));var rpc={'chatInteraction':require(_0x953c('0x1')),'openchannelInteraction':require(_0x953c('0x2')),'smsInteraction':require(_0x953c('0x3')),'mailInteraction':require(_0x953c('0x4')),'faxInteraction':require(_0x953c('0x5')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0x953c('0x6'))(_0x953c('0x7'));var tag=schema({'tag':{'type':_0x953c('0x8'),'required':!![],'message':_0x953c('0x9')}});exports[_0x953c('0xa')]=function(_0x1a72e8,_0x1a78a1,_0x395fd7,_0x4f3cb6){return function(_0x3f23ac){try{var _0x111f8d={'tag':_0x1a78a1[0x0]};var _0x555bb6=tag[_0x953c('0xb')](_0x111f8d,{'typecast':!![]});if(_0x555bb6[_0x953c('0xc')]){logger[_0x953c('0xd')]('[%s][TAG]\x20%s',_0x1a72e8,_[_0x953c('0xe')](_0x555bb6,_0x953c('0xf'))[_0x953c('0x10')](',\x20'));logger[_0x953c('0x11')](_0x953c('0x12'),_0x1a72e8);_0x3f23ac[_0x953c('0x13')]();}else{var _0x24cb02={'ids':[_0x1a78a1[0x0]]};if(rpc[_0x4f3cb6[_0x953c('0x14')]+'Interaction']){rpc[_0x4f3cb6[_0x953c('0x14')]+'Interaction'][_0x953c('0x15')](_0x4f3cb6[_0x953c('0x16')]['id'],_0x24cb02)['then'](function(_0x3a8c87){logger[_0x953c('0x11')](_0x953c('0x17'),_0x1a72e8,_0x1a78a1[0x1],_0x4f3cb6[_0x953c('0x14')],_0x4f3cb6[_0x953c('0x16')]['id']);})[_0x953c('0x18')](function(_0x5b1518){logger[_0x953c('0xd')](_0x953c('0x19'),_0x1a72e8,JSON['stringify'](_0x5b1518));logger[_0x953c('0x11')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x1a72e8);})[_0x953c('0x1a')](function(){_0x3f23ac[_0x953c('0x13')]();});}}}catch(_0x4cd691){logger[_0x953c('0xd')](_0x953c('0x19'),_0x1a72e8,_['isObject'](_0x4cd691)?JSON[_0x953c('0x1b')](_0x4cd691):_0x4cd691);logger[_0x953c('0x11')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x1a72e8);_0x3f23ac[_0x953c('0x13')]();}};}; \ No newline at end of file +var _0xa157=['isObject','stringify','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','error','[%s][TAG]\x20%s','map','message','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','addTags','interaction','then','catch','next'];(function(_0x2f238e,_0x21b4ee){var _0x497caa=function(_0x2fa9f5){while(--_0x2fa9f5){_0x2f238e['push'](_0x2f238e['shift']());}};_0x497caa(++_0x21b4ee);}(_0xa157,0x1e2));var _0x7a15=function(_0x3e90ab,_0x3f4826){_0x3e90ab=_0x3e90ab-0x0;var _0x1b52f9=_0xa157[_0x3e90ab];return _0x1b52f9;};'use strict';var schema=require(_0x7a15('0x0'));var _=require(_0x7a15('0x1'));var rpc={'chatInteraction':require(_0x7a15('0x2')),'openchannelInteraction':require(_0x7a15('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x7a15('0x4')),'whatsappInteraction':require(_0x7a15('0x5'))};var logger=require('../../../../config/logger')('routing');var tag=schema({'tag':{'type':_0x7a15('0x6'),'required':!![],'message':_0x7a15('0x7')}});exports[_0x7a15('0x8')]=function(_0x243a32,_0xfe13fa,_0x5fbca2,_0x495806){return function(_0xaf856d){try{var _0x462765={'tag':_0xfe13fa[0x0]};var _0x26fdd0=tag[_0x7a15('0x0')](_0x462765,{'typecast':!![]});if(_0x26fdd0['length']){logger[_0x7a15('0x9')](_0x7a15('0xa'),_0x243a32,_[_0x7a15('0xb')](_0x26fdd0,_0x7a15('0xc'))['join'](',\x20'));logger[_0x7a15('0xd')](_0x7a15('0xe'),_0x243a32);_0xaf856d['next']();}else{var _0x49e0cd={'ids':[_0xfe13fa[0x0]]};if(rpc[_0x495806[_0x7a15('0xf')]+_0x7a15('0x10')]){rpc[_0x495806[_0x7a15('0xf')]+_0x7a15('0x10')][_0x7a15('0x11')](_0x495806[_0x7a15('0x12')]['id'],_0x49e0cd)[_0x7a15('0x13')](function(_0x35ecdb){logger['info']('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x243a32,_0xfe13fa[0x1],_0x495806[_0x7a15('0xf')],_0x495806[_0x7a15('0x12')]['id']);})[_0x7a15('0x14')](function(_0x51744f){logger['error'](_0x7a15('0xa'),_0x243a32,JSON['stringify'](_0x51744f));logger[_0x7a15('0xd')](_0x7a15('0xe'),_0x243a32);})['finally'](function(){_0xaf856d[_0x7a15('0x15')]();});}}}catch(_0x42fdd9){logger[_0x7a15('0x9')]('[%s][TAG]\x20%s',_0x243a32,_[_0x7a15('0x16')](_0x42fdd9)?JSON[_0x7a15('0x17')](_0x42fdd9):_0x42fdd9);logger[_0x7a15('0xd')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x243a32);_0xaf856d[_0x7a15('0x15')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tvox.js b/server/services/routing/server/applications/tvox.js index 541bc13..1ebbc6c 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 _0x68f6=['?params=','title','jsonrpc','method','login','params','then','parse','result','channelId=','&serviceId=','&data=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','isObject','stringify','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','routing','lodash','replace','\x20-\x20','push','urlOnAnswer'];(function(_0x2aad02,_0x556ae7){var _0x546e5b=function(_0x129356){while(--_0x129356){_0x2aad02['push'](_0x2aad02['shift']());}};_0x546e5b(++_0x556ae7);}(_0x68f6,0x7f));var _0x668f=function(_0x28392e,_0x4ddc7f){_0x28392e=_0x28392e-0x0;var _0x381c3a=_0x68f6[_0x28392e];return _0x381c3a;};'use strict';var rp=require(_0x668f('0x0'));var logger=require(_0x668f('0x1'))(_0x668f('0x2'));var _=require(_0x668f('0x3'));var arr=[];exports['consequence']=function(_0x12e42f,_0x513a32){return function(_0x2e960e){var _0x1131fa=_0x513a32[0xa];var _0x54638d=_0x513a32[0xb];var _0x68ca1=_0x513a32[0xc];var _0x131adf=_0x513a32[0xd];var _0x2385f8=_0x513a32[0xe];var _0x32a8f4=_0x513a32[0xf][_0x668f('0x4')](/\n/g,_0x668f('0x5'));var _0xfcd51d=_0x513a32[0x10]['replace'](/\n/g,'\x20');if(!arr['includes'](_0x54638d)){arr[_0x668f('0x6')](_0x54638d);var _0x2b4e78=_0x513a32[0x3];var _0x1f0ce0=_0x513a32[0x4];var _0x2673d3=_0x513a32[0x1];var _0x14f0c4=_0x513a32[0x0];var _0x41bbf2={};_0x41bbf2[_0x668f('0x7')]=_0x513a32[0x8]+_0x668f('0x8')+_0x68ca1+'|'+_0x1131fa+'|'+_0x131adf+'|'+_0x54638d+'|'+_0x2385f8;_0x41bbf2['urlOnRing']=_0x513a32[0x7]+_0x668f('0x8')+_0x68ca1+'|'+_0x1131fa+'|'+_0x131adf+'|'+_0x54638d+'|'+_0x2385f8+'|'+_0x32a8f4+'|'+_0xfcd51d;_0x41bbf2[_0x668f('0x9')]=_0x513a32[0x9];var _0x4b11da={};_0x4b11da[_0x668f('0xa')]='2.0';_0x4b11da[_0x668f('0xb')]=_0x668f('0xc');var _0x3a28c3=[];_0x3a28c3[_0x668f('0x6')](_0x513a32[0x2]);_0x3a28c3['push'](_0x513a32[0x5]);_0x3a28c3[_0x668f('0x6')](_0x513a32[0x6]);_0x4b11da[_0x668f('0xd')]=_0x3a28c3;_0x4b11da['id']=0x1;var _0x22cccf=JSON['stringify'](_0x4b11da);var _0x343330={'encoding':'utf8','method':'POST','timeout':0x2710,'url':_0x2b4e78,'headers':{'Content-Type':'application/json-rpc'},'body':_0x22cccf};return rp(_0x343330)[_0x668f('0xe')](function(_0x529ac9){const _0x2c11ea=JSON[_0x668f('0xf')](_0x529ac9);if(!_0x2c11ea[_0x668f('0x10')]['logged']){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x4590d4=_0x54638d;var _0x5f05eb=_0x668f('0x11')+_0x2673d3+_0x668f('0x12')+_0x14f0c4+'&sessionId='+_0x4590d4+_0x668f('0x13')+JSON['stringify'](_0x41bbf2);var _0x34f9ad=_0x1f0ce0+'?'+_0x5f05eb;return rp(_0x34f9ad);})[_0x668f('0xe')](function(_0x5556a7){logger[_0x668f('0x14')](_0x668f('0x15'),_0x12e42f,_0x5556a7);_0x2e960e[_0x668f('0x16')]();})['catch'](function(_0x15fdb0){logger['error']('[%s][TVOX]\x20%s',_0x12e42f,_[_0x668f('0x17')](_0x15fdb0)?JSON[_0x668f('0x18')](_0x15fdb0):_0x15fdb0);_0x2e960e[_0x668f('0x16')]();});}else{logger[_0x668f('0x14')](_0x668f('0x19'),_0x12e42f);_0x2e960e[_0x668f('0x1a')]();}};}; \ No newline at end of file +var _0x4a68=['then','parse','result','Unable\x20to\x20login\x20with\x20TVox\x20application','&sessionId=','&data=','info','stop','catch','error','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','lodash','consequence','replace','\x20-\x20','push','urlOnAnswer','urlOnRing','?params=','title','2.0','login','params','stringify','utf8','POST','application/json-rpc'];(function(_0x20a086,_0x15cef2){var _0x379cc3=function(_0xe4c176){while(--_0xe4c176){_0x20a086['push'](_0x20a086['shift']());}};_0x379cc3(++_0x15cef2);}(_0x4a68,0xfc));var _0x84a6=function(_0x425540,_0x97a491){_0x425540=_0x425540-0x0;var _0x117693=_0x4a68[_0x425540];return _0x117693;};'use strict';var rp=require(_0x84a6('0x0'));var logger=require(_0x84a6('0x1'))('routing');var _=require(_0x84a6('0x2'));var arr=[];exports[_0x84a6('0x3')]=function(_0x5300b6,_0x1b528e){return function(_0x206fd3){var _0xd1278a=_0x1b528e[0xa];var _0x615bf5=_0x1b528e[0xb];var _0x4c943a=_0x1b528e[0xc];var _0x11a24a=_0x1b528e[0xd];var _0x1adfb9=_0x1b528e[0xe];var _0x212d38=_0x1b528e[0xf][_0x84a6('0x4')](/\n/g,_0x84a6('0x5'));var _0x169047=_0x1b528e[0x10][_0x84a6('0x4')](/\n/g,'\x20');if(!arr['includes'](_0x615bf5)){arr[_0x84a6('0x6')](_0x615bf5);var _0x2d0ab6=_0x1b528e[0x3];var _0x233217=_0x1b528e[0x4];var _0x3c9c4d=_0x1b528e[0x1];var _0xb6b21f=_0x1b528e[0x0];var _0x19531b={};_0x19531b[_0x84a6('0x7')]=_0x1b528e[0x8]+'?params='+_0x4c943a+'|'+_0xd1278a+'|'+_0x11a24a+'|'+_0x615bf5+'|'+_0x1adfb9;_0x19531b[_0x84a6('0x8')]=_0x1b528e[0x7]+_0x84a6('0x9')+_0x4c943a+'|'+_0xd1278a+'|'+_0x11a24a+'|'+_0x615bf5+'|'+_0x1adfb9+'|'+_0x212d38+'|'+_0x169047;_0x19531b[_0x84a6('0xa')]=_0x1b528e[0x9];var _0x5b4838={};_0x5b4838['jsonrpc']=_0x84a6('0xb');_0x5b4838['method']=_0x84a6('0xc');var _0x174768=[];_0x174768[_0x84a6('0x6')](_0x1b528e[0x2]);_0x174768['push'](_0x1b528e[0x5]);_0x174768['push'](_0x1b528e[0x6]);_0x5b4838[_0x84a6('0xd')]=_0x174768;_0x5b4838['id']=0x1;var _0x3468e6=JSON[_0x84a6('0xe')](_0x5b4838);var _0x3f9dec={'encoding':_0x84a6('0xf'),'method':_0x84a6('0x10'),'timeout':0x2710,'url':_0x2d0ab6,'headers':{'Content-Type':_0x84a6('0x11')},'body':_0x3468e6};return rp(_0x3f9dec)[_0x84a6('0x12')](function(_0x2a4f73){const _0x22a964=JSON[_0x84a6('0x13')](_0x2a4f73);if(!_0x22a964[_0x84a6('0x14')]['logged']){throw new Error(_0x84a6('0x15'));}var _0x2f54df=_0x615bf5;var _0x22441c='channelId='+_0x3c9c4d+'&serviceId='+_0xb6b21f+_0x84a6('0x16')+_0x2f54df+_0x84a6('0x17')+JSON[_0x84a6('0xe')](_0x19531b);var _0x2f25c9=_0x233217+'?'+_0x22441c;return rp(_0x2f25c9);})[_0x84a6('0x12')](function(_0x451f8e){logger[_0x84a6('0x18')]('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x5300b6,_0x451f8e);_0x206fd3[_0x84a6('0x19')]();})[_0x84a6('0x1a')](function(_0x44aa23){logger[_0x84a6('0x1b')]('[%s][TVOX]\x20%s',_0x5300b6,_['isObject'](_0x44aa23)?JSON[_0x84a6('0xe')](_0x44aa23):_0x44aa23);_0x206fd3[_0x84a6('0x19')]();});}else{logger['info'](_0x84a6('0x1c'),_0x5300b6);_0x206fd3[_0x84a6('0x1d')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index 246e2eb..41a1424 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x240386,_0x303d98){var _0x1b1f21=function(_0x837d2f){while(--_0x837d2f){_0x240386['push'](_0x240386['shift']());}};_0x1b1f21(++_0x303d98);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file +var _0xbaf0=['list','lodash','exports','render','merge','contact','message','account','interaction'];(function(_0x2603a7,_0x487e7e){var _0x43ecca=function(_0x2c082c){while(--_0x2c082c){_0x2603a7['push'](_0x2603a7['shift']());}};_0x43ecca(++_0x487e7e);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xbaf0[_0x6131cd];return _0x47e916;};'use strict';var Mustache=require('mustache');var _=require(_0x0baf('0x0'));module[_0x0baf('0x1')]={'getMustacheRender':function(_0x1e212d,_0x263f79){return Mustache[_0x0baf('0x2')](_0x1e212d,_[_0x0baf('0x3')](_0x263f79['body'],{'contact':_0x263f79[_0x0baf('0x4')],'message':_0x263f79[_0x0baf('0x5')],'account':_0x263f79[_0x0baf('0x6')],'interaction':_0x263f79[_0x0baf('0x7')],'list':_0x263f79[_0x0baf('0x8')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 63386ba..65dba43 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 _0xeb9a=['join','app','.js','toLowerCase','appdata','split','push','slice','dialogflow','dialogflowv2','tag','TagId','getMustacheRender','account','notificationTemplate','ChatWebsiteId','ContactId','body','format','%s:%s:%s','./interval','condition','intervals','priority','Push\x20new\x20rule','\x20|\x20','error','execute','info','Applications\x20executed','stringify','matchPath','rules','emit','complete','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','end','QueueReport','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','capacity','hasOwnProperty','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','find','chatQueues','available','loggedIn','name','mailQueues','paused','waiting','openchannelQueues','smsQueues','faxQueues','whatsappQueues','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','path','jayson/promise','./applications/utils','./applications/strategy/util','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','isNil','IntervalId','Intervals','map','interval','listen','channel','message','interaction','transfer','applications','isArray','length','existsSync'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xeb9a,0x178));var _0xaeb9=function(_0x616290,_0x280b7f){_0x616290=_0x616290-0x0;var _0x453879=_0xeb9a[_0x616290];return _0x453879;};'use strict';var _=require(_0xaeb9('0x0'));var util=require(_0xaeb9('0x1'));var path=require(_0xaeb9('0x2'));var fs=require('fs');var jayson=require(_0xaeb9('0x3'));var BPromise=require('bluebird');var utils=require(_0xaeb9('0x4'));var sUtils=require(_0xaeb9('0x5'));var logger=require('../../../config/logger')(_0xaeb9('0x6'));var rpc={'openchannelQueueReport':require(_0xaeb9('0x7')),'mailQueueReport':require(_0xaeb9('0x8')),'chatQueueReport':require(_0xaeb9('0x9')),'smsQueueReport':require(_0xaeb9('0xa')),'faxQueueReport':require(_0xaeb9('0xb')),'whatsappQueueReport':require(_0xaeb9('0xc'))};var RuleEngine=require(_0xaeb9('0xd'));function getId(_0x4729a5,_0x4a135f,_0x4cf057){return util['format']('%s.%s.%s',_0x4729a5,_0x4a135f||0x0,_0x4cf057||0x0);}function getIntervals(_0x312623,_0x30ba14){var _0x314597=[];if(!_[_0xaeb9('0xe')](_0x30ba14[_0xaeb9('0xf')])&&!_[_0xaeb9('0xe')](_0x312623[_0x30ba14['IntervalId']])&&!_['isNil'](_0x312623[_0x30ba14[_0xaeb9('0xf')]][_0xaeb9('0x10')])){_0x314597=_[_0xaeb9('0x11')](_0x312623[_0x30ba14[_0xaeb9('0xf')]][_0xaeb9('0x10')],'interval');}else if(!_[_0xaeb9('0xe')](_0x30ba14[_0xaeb9('0x12')])){_0x314597=[_0x30ba14['interval']];}return _0x314597;}exports[_0xaeb9('0x13')]=function(_0x3749bf){_0x3749bf['rules']={};return new BPromise(function(_0x2962b8,_0x226c07){var _0x4d3249={'Start':function(_0xe2d32c){var _0x5589ba=this;return new Promise(function(_0x2c1be9,_0x585f05){if(_0xe2d32c){try{var _0x4cee45=[];var _0x21148e=getId(_0xe2d32c[_0xaeb9('0x14')],_0xe2d32c[_0xaeb9('0x15')]?_0xe2d32c['message']['id']:0x0,_0xe2d32c[_0xaeb9('0x16')]?_0xe2d32c[_0xaeb9('0x16')]['id']:0x0);var _0x4196cf=sUtils['checkWaitingNotifications'](_0x3749bf,_0xe2d32c);if(_0xe2d32c[_0xaeb9('0x17')]||!_0x4196cf&&_0xe2d32c[_0xaeb9('0x18')]&&_[_0xaeb9('0x19')](_0xe2d32c[_0xaeb9('0x18')])&&_0xe2d32c[_0xaeb9('0x18')][_0xaeb9('0x1a')]){for(var _0x7bd45f=0x0;_0x7bd45f<_0xe2d32c[_0xaeb9('0x18')]['length'];_0x7bd45f+=0x1){var _0x187a6c=_0xe2d32c[_0xaeb9('0x18')][_0x7bd45f];if(fs[_0xaeb9('0x1b')](path[_0xaeb9('0x1c')](__dirname,'applications',_0x187a6c[_0xaeb9('0x1d')]+_0xaeb9('0x1e')))){var _0x4c672e=[];switch(_0x187a6c['app'][_0xaeb9('0x1f')]()){case'autoreply':var _0x1e5485=_0x187a6c[_0xaeb9('0x20')][_0xaeb9('0x21')](',');if(_0xe2d32c[_0xaeb9('0x14')]==='mail'){_0x4c672e[_0xaeb9('0x22')](_0x1e5485[0x0]);_0x4c672e[_0xaeb9('0x22')](_0x1e5485[0x1]);_0x4c672e[_0xaeb9('0x22')](_0x1e5485[_0xaeb9('0x23')](0x2,_0x1e5485[_0xaeb9('0x1a')])[_0xaeb9('0x1c')](','));}else{_0x4c672e['push'](_0x1e5485[0x0]);_0x4c672e[_0xaeb9('0x22')](_0x1e5485[_0xaeb9('0x23')](0x1,_0x1e5485[_0xaeb9('0x1a')])[_0xaeb9('0x1c')](','));}break;case _0xaeb9('0x24'):var _0x11833f=_0x187a6c[_0xaeb9('0x20')][_0xaeb9('0x21')](',');_0x4c672e[_0xaeb9('0x22')](_0x11833f[0x0]);_0x4c672e[_0xaeb9('0x22')](_0x11833f[0x1]);_0x4c672e[_0xaeb9('0x22')](_0x11833f['slice'](0x2,_0x11833f[_0xaeb9('0x1a')])['join'](','));break;case _0xaeb9('0x25'):var _0x332e7f=_0x187a6c[_0xaeb9('0x20')][_0xaeb9('0x21')](',');_0x4c672e[_0xaeb9('0x22')](_0x332e7f[0x0]);_0x4c672e[_0xaeb9('0x22')](_0x332e7f[0x1]);_0x4c672e[_0xaeb9('0x22')](_0x332e7f[0x2]);_0x4c672e[_0xaeb9('0x22')](_0x332e7f[0x3]);_0x4c672e['push'](_0x332e7f[_0xaeb9('0x23')](0x4,_0x332e7f[_0xaeb9('0x1a')])[_0xaeb9('0x1c')](','));break;case'amazonlex':var _0x358c83=_0x187a6c[_0xaeb9('0x20')][_0xaeb9('0x21')](',');_0x4c672e['push'](_0x358c83[0x0]);_0x4c672e[_0xaeb9('0x22')](_0x358c83[0x1]);_0x4c672e[_0xaeb9('0x22')](_0x358c83[0x2]);_0x4c672e[_0xaeb9('0x22')](_0x358c83[0x3]);_0x4c672e[_0xaeb9('0x22')](_0x358c83[_0xaeb9('0x23')](0x4,_0x358c83['length'])[_0xaeb9('0x1c')](','));break;case _0xaeb9('0x15'):_0x4c672e[_0xaeb9('0x22')](_0x187a6c[_0xaeb9('0x20')]);break;case _0xaeb9('0x26'):_0x4c672e[_0xaeb9('0x22')](_0x187a6c[_0xaeb9('0x27')]);_0x4c672e[_0xaeb9('0x22')](_0x187a6c[_0xaeb9('0x20')]);break;case'tvox':var _0x5bbf20=utils[_0xaeb9('0x28')](_0xe2d32c[_0xaeb9('0x29')][_0xaeb9('0x2a')],_0xe2d32c);var _0x415446=_0x187a6c[_0xaeb9('0x20')][_0xaeb9('0x21')](',');_0x4c672e['push'](_0x415446[0x0]);_0x4c672e[_0xaeb9('0x22')](_0x415446[0x1]);_0x4c672e[_0xaeb9('0x22')](_0x415446[0x2]);_0x4c672e[_0xaeb9('0x22')](_0x415446[0x3]);_0x4c672e['push'](_0x415446[0x4]);_0x4c672e[_0xaeb9('0x22')](_0x415446[0x5]);_0x4c672e[_0xaeb9('0x22')](_0x415446[0x6]);_0x4c672e[_0xaeb9('0x22')](_0x415446[0x7]);_0x4c672e[_0xaeb9('0x22')](_0x415446[0x8]);_0x4c672e[_0xaeb9('0x22')](_0x415446[0x9]);_0x4c672e[_0xaeb9('0x22')](_0x415446[0xa]);_0x4c672e[_0xaeb9('0x22')](_0xe2d32c[_0xaeb9('0x16')]['id']);_0x4c672e[_0xaeb9('0x22')](_0xe2d32c['message']['id']);_0x4c672e[_0xaeb9('0x22')](_0x187a6c[_0xaeb9('0x2b')]);_0x4c672e[_0xaeb9('0x22')](_0xe2d32c['interaction'][_0xaeb9('0x2c')]);_0x4c672e['push'](_0xe2d32c[_0xaeb9('0x2d')][_0xaeb9('0x2d')]);_0x4c672e['push'](_0x5bbf20);break;default:_0x4c672e=_['isNil'](_0x187a6c[_0xaeb9('0x20')])?[]:_0x187a6c[_0xaeb9('0x20')][_0xaeb9('0x21')](',');}var _0x32296c={'id':util[_0xaeb9('0x2e')](_0xaeb9('0x2f'),_0x21148e,_0x187a6c['id'],_0x187a6c['app']),'condition':require(_0xaeb9('0x30'))[_0xaeb9('0x31')](_0x21148e,getIntervals(_0x3749bf[_0xaeb9('0x32')],_0x187a6c),_0x3749bf),'consequence':require('./applications/'+_0x187a6c[_0xaeb9('0x1d')])['consequence'](_0x21148e,_0x4c672e,_0x3749bf,_0xe2d32c),'p':_0x187a6c[_0xaeb9('0x33')]||0x0};logger['info'](_0xaeb9('0x34'),_0x32296c['id'],'on\x20interval',getIntervals(_0x3749bf[_0xaeb9('0x32')],_0x187a6c)['join'](_0xaeb9('0x35')));_0x4cee45[_0xaeb9('0x22')](_0x32296c);}else{logger[_0xaeb9('0x36')]('Please\x20create\x20a\x20new\x20file\x20under',path[_0xaeb9('0x1c')](__dirname,'applications',_0x187a6c[_0xaeb9('0x1d')]+_0xaeb9('0x1e')));}}_0x3749bf['rules'][_0x21148e]=new RuleEngine(_0x4cee45);_0x3749bf['rules'][_0x21148e][_0xaeb9('0x37')](_0xe2d32c,function(_0x26cab2){logger[_0xaeb9('0x38')](_0xaeb9('0x39'),JSON[_0xaeb9('0x3a')](_0x26cab2[_0xaeb9('0x3b')]));if(_0x3749bf['rules'][_0x21148e]){_0x3749bf[_0xaeb9('0x3c')][_0x21148e][_0xaeb9('0x3d')](_0xaeb9('0x3e'));}});return _0x2c1be9({'code':0xc8,'message':_0xe2d32c});}else{if(_0x4196cf){logger[_0xaeb9('0x38')](util[_0xaeb9('0x2e')](_0xaeb9('0x3f'),_0x21148e));}else{logger[_0xaeb9('0x38')](_0xaeb9('0x40'));}return _0x2c1be9({'code':0xc8,'message':_0xe2d32c});}}catch(_0x4c329){logger[_0xaeb9('0x36')](_0x4c329[_0xaeb9('0x41')]);return _0x585f05(_0x5589ba[_0xaeb9('0x36')](0x1f4,_0x4c329));}}return _0x585f05(_0xaeb9('0x42'));});},'AcceptMessage':function(_0x5a8bea){var _0x5cf34f=this;return new Promise(function(_0x53c8c6,_0x436dea){if(_0x5a8bea[_0xaeb9('0x43')]&&_0x5a8bea[_0xaeb9('0x43')]['id']){if(_0x3749bf[_0xaeb9('0x44')][_0x5a8bea[_0xaeb9('0x43')]['id']]){_0x3749bf[_0xaeb9('0x44')][_0x5a8bea[_0xaeb9('0x43')]['id']][_0xaeb9('0x45')]=![];_0x3749bf[_0xaeb9('0x44')][_0x5a8bea['agent']['id']][_0xaeb9('0x46')]=undefined;}}if(_0x5a8bea[_0xaeb9('0x15')]&&_0x5a8bea[_0xaeb9('0x15')]['id']){try{var _0x995fc4=getId(_0x5a8bea[_0xaeb9('0x14')],_0x5a8bea[_0xaeb9('0x15')]?_0x5a8bea[_0xaeb9('0x15')]['id']:0x0,_0x5a8bea[_0xaeb9('0x16')]?_0x5a8bea[_0xaeb9('0x16')]['id']:0x0);if(_0x3749bf[_0xaeb9('0x3c')][_0x995fc4]){_0x3749bf['rules'][_0x995fc4]['emit'](_0xaeb9('0x47'));if(rpc[_0x5a8bea['channel']+_0xaeb9('0x48')]){rpc[_0x5a8bea[_0xaeb9('0x14')]+_0xaeb9('0x48')]['update'](_0x995fc4,{'UserId':_0x5a8bea[_0xaeb9('0x15')][_0xaeb9('0x49')]})[_0xaeb9('0x4a')](function(){logger['error'](_0xaeb9('0x4b'));});}}return _0x53c8c6({'code':0xc8,'message':_0x5a8bea});}catch(_0x7c8123){logger[_0xaeb9('0x36')](_0x7c8123['stack']);return _0x436dea(_0x5cf34f['error'](0x1f4,_0x7c8123));}}logger[_0xaeb9('0x36')](_0xaeb9('0x4c'));return _0x436dea(_0x5cf34f[_0xaeb9('0x36')](0x1f4,_0xaeb9('0x4c')));});},'RejectMessage':function(_0x5ea5ce){var _0x1e97f8=this;return new Promise(function(_0x48db92,_0x24c0a1){if(_0x5ea5ce['agent']&&_0x5ea5ce[_0xaeb9('0x43')]['id']){try{if(_0x3749bf[_0xaeb9('0x44')][_0x5ea5ce[_0xaeb9('0x43')]['id']]){_0x3749bf['agents'][_0x5ea5ce['agent']['id']][_0xaeb9('0x45')]=![];_0x3749bf[_0xaeb9('0x44')][_0x5ea5ce[_0xaeb9('0x43')]['id']]['busyQueue']=undefined;}return _0x48db92({'code':0xc8,'message':_0x5ea5ce});}catch(_0x2cca19){logger[_0xaeb9('0x36')](_0x2cca19['stack']);return _0x24c0a1(_0x1e97f8['error'](0x1f4,_0x2cca19));}}logger[_0xaeb9('0x36')](_0xaeb9('0x4c'));return _0x24c0a1(_0x1e97f8[_0xaeb9('0x36')](0x1f4,_0xaeb9('0x4c')));});},'AbandonInteraction':function(_0x47c6b5){var _0xc185b0=this;return new Promise(function(_0x14a050,_0x1c1256){if(_0x47c6b5[_0xaeb9('0x14')]&&_0x47c6b5[_0xaeb9('0x16')]&&_0x47c6b5[_0xaeb9('0x16')]['id']){try{var _0x2f96d5=getId(_0x47c6b5[_0xaeb9('0x14')],_0x47c6b5[_0xaeb9('0x15')]?_0x47c6b5[_0xaeb9('0x15')]['id']:0x0,_0x47c6b5['interaction']?_0x47c6b5['interaction']['id']:0x0);if(_0x3749bf[_0xaeb9('0x3c')][_0x2f96d5]){_0x3749bf[_0xaeb9('0x3c')][_0x2f96d5][_0xaeb9('0x3d')](_0xaeb9('0x47'));}return _0x14a050({'code':0xc8,'message':_0x47c6b5});}catch(_0x40eb18){logger[_0xaeb9('0x36')](_0x40eb18[_0xaeb9('0x41')]);return _0x1c1256(_0xc185b0[_0xaeb9('0x36')](0x1f4,_0x40eb18));}}logger[_0xaeb9('0x36')](_0xaeb9('0x4c'));return _0x1c1256(_0xc185b0['error'](0x1f4,_0xaeb9('0x4c')));});},'AgentCapacity':function(_0xb169db){var _0x556791=this;return new Promise(function(_0x43bb11,_0x19f853){if(_0x3749bf[_0xaeb9('0x44')]['hasOwnProperty'](_0xb169db['id'])){for(var _0x2958a3 in _0xb169db[_0xaeb9('0x4d')]){if(_0xb169db[_0xaeb9('0x4d')]['hasOwnProperty'](_0x2958a3)){if(_0x3749bf[_0xaeb9('0x44')][_0xb169db['id']][_0xaeb9('0x4e')](_0x2958a3+_0xaeb9('0x4f'))){_0x3749bf[_0xaeb9('0x44')][_0xb169db['id']][_0x2958a3+_0xaeb9('0x4f')]=parseInt(_0xb169db[_0xaeb9('0x4d')][_0x2958a3],0xa);}}}_0x3749bf[_0xaeb9('0x44')][_0xb169db['id']][_0xaeb9('0x50')]();return _0x43bb11({'code':0xc8,'message':_0x3749bf[_0xaeb9('0x44')][_0xb169db['id']]});}else{return _0x19f853(_0x556791[_0xaeb9('0x36')](0x1f4,_0xaeb9('0x51')));}});},'Agents':function(_0x1fae18){return new Promise(function(_0x1a40e9){var _0x295475=_[_0xaeb9('0x52')](_0x3749bf[_0xaeb9('0x44')]);if(_0x1fae18&&_0x1fae18['id']){var _0x5c44cb=_[_0xaeb9('0x53')](_0x295475,function(_0x2e1704){return _0x2e1704['id']===_0x1fae18['id'];});_0x1a40e9(_0x5c44cb);}else{_0x1a40e9({'count':_0x295475[_0xaeb9('0x1a')],'rows':_0x295475});}});},'ChatQueues':function(){return new Promise(function(_0x585d66){var _0x552a57=[];for(var _0x22db2d in _0x3749bf[_0xaeb9('0x54')]){if(_0x3749bf[_0xaeb9('0x54')][_0xaeb9('0x4e')](_0x22db2d)){var _0x4b3890=_0x3749bf[_0xaeb9('0x54')][_0x22db2d];var _0x53caeb={'id':_0x4b3890['id'],'available':_0x4b3890[_0xaeb9('0x55')],'loggedIn':_0x4b3890[_0xaeb9('0x56')],'name':_0x4b3890[_0xaeb9('0x57')],'paused':_0x4b3890['paused'],'waiting':_0x4b3890['waiting']};_0x552a57['push'](_0x53caeb);}}_0x585d66({'count':_0x552a57['length'],'rows':_0x552a57});});},'MailQueues':function(){return new Promise(function(_0x56d56b){var _0x41df21=[];for(var _0x386174 in _0x3749bf[_0xaeb9('0x58')]){if(_0x3749bf['mailQueues']['hasOwnProperty'](_0x386174)){var _0x3e10ab=_0x3749bf[_0xaeb9('0x58')][_0x386174];var _0x134123={'id':_0x3e10ab['id'],'available':_0x3e10ab[_0xaeb9('0x55')],'loggedIn':_0x3e10ab[_0xaeb9('0x56')],'name':_0x3e10ab['name'],'paused':_0x3e10ab[_0xaeb9('0x59')],'waiting':_0x3e10ab[_0xaeb9('0x5a')]};_0x41df21[_0xaeb9('0x22')](_0x134123);}}_0x56d56b({'count':_0x41df21['length'],'rows':_0x41df21});});},'OpenchannelQueues':function(){return new Promise(function(_0x364568){var _0xeb388f=[];for(var _0x7d52da in _0x3749bf['openchannelQueues']){if(_0x3749bf[_0xaeb9('0x5b')][_0xaeb9('0x4e')](_0x7d52da)){var _0x40853b=_0x3749bf[_0xaeb9('0x5b')][_0x7d52da];var _0x195488={'id':_0x40853b['id'],'available':_0x40853b[_0xaeb9('0x55')],'loggedIn':_0x40853b[_0xaeb9('0x56')],'name':_0x40853b[_0xaeb9('0x57')],'paused':_0x40853b['paused'],'waiting':_0x40853b[_0xaeb9('0x5a')]};_0xeb388f[_0xaeb9('0x22')](_0x195488);}}_0x364568({'count':_0xeb388f[_0xaeb9('0x1a')],'rows':_0xeb388f});});},'SmsQueues':function(){return new Promise(function(_0x363b17){var _0x46d4d5=[];for(var _0x4f3c5e in _0x3749bf[_0xaeb9('0x5c')]){if(_0x3749bf[_0xaeb9('0x5c')][_0xaeb9('0x4e')](_0x4f3c5e)){var _0x78e882=_0x3749bf[_0xaeb9('0x5c')][_0x4f3c5e];var _0xd39b73={'id':_0x78e882['id'],'available':_0x78e882[_0xaeb9('0x55')],'loggedIn':_0x78e882[_0xaeb9('0x56')],'name':_0x78e882['name'],'paused':_0x78e882[_0xaeb9('0x59')],'waiting':_0x78e882['waiting']};_0x46d4d5['push'](_0xd39b73);}}_0x363b17({'count':_0x46d4d5[_0xaeb9('0x1a')],'rows':_0x46d4d5});});},'FaxQueues':function(){return new Promise(function(_0xa315f9){var _0x191b98=[];for(var _0x36e5c3 in _0x3749bf[_0xaeb9('0x5d')]){if(_0x3749bf[_0xaeb9('0x5d')][_0xaeb9('0x4e')](_0x36e5c3)){var _0xb5a726=_0x3749bf[_0xaeb9('0x5d')][_0x36e5c3];var _0x657c55={'id':_0xb5a726['id'],'available':_0xb5a726[_0xaeb9('0x55')],'loggedIn':_0xb5a726[_0xaeb9('0x56')],'name':_0xb5a726['name'],'paused':_0xb5a726[_0xaeb9('0x59')],'waiting':_0xb5a726[_0xaeb9('0x5a')]};_0x191b98['push'](_0x657c55);}}_0xa315f9({'count':_0x191b98[_0xaeb9('0x1a')],'rows':_0x191b98});});},'WhatsappQueues':function(){return new Promise(function(_0xaf07aa){var _0x279a18=[];for(var _0x36e78a in _0x3749bf[_0xaeb9('0x5e')]){if(_0x3749bf[_0xaeb9('0x5e')][_0xaeb9('0x4e')](_0x36e78a)){var _0x723443=_0x3749bf[_0xaeb9('0x5e')][_0x36e78a];var _0x517912={'id':_0x723443['id'],'available':_0x723443[_0xaeb9('0x55')],'loggedIn':_0x723443[_0xaeb9('0x56')],'name':_0x723443[_0xaeb9('0x57')],'paused':_0x723443[_0xaeb9('0x59')],'waiting':_0x723443['waiting']};_0x279a18[_0xaeb9('0x22')](_0x517912);}}_0xaf07aa({'count':_0x279a18[_0xaeb9('0x1a')],'rows':_0x279a18});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x2237c9){var _0x1bd1a7=_[_0xaeb9('0x52')](_0x3749bf['chatQueuesWaitingInteractions']);_0x2237c9({'count':_0x1bd1a7[_0xaeb9('0x1a')],'rows':_0x1bd1a7});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0xf19ad7){var _0x5e547d=_[_0xaeb9('0x52')](_0x3749bf['mailQueuesWaitingInteractions']);_0xf19ad7({'count':_0x5e547d[_0xaeb9('0x1a')],'rows':_0x5e547d});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x4206af){var _0x3bab28=_['values'](_0x3749bf[_0xaeb9('0x5f')]);_0x4206af({'count':_0x3bab28[_0xaeb9('0x1a')],'rows':_0x3bab28});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x3436eb){var _0x1b7c3b=_[_0xaeb9('0x52')](_0x3749bf[_0xaeb9('0x60')]);_0x3436eb({'count':_0x1b7c3b[_0xaeb9('0x1a')],'rows':_0x1b7c3b});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x581e95){var _0x290659=_[_0xaeb9('0x52')](_0x3749bf[_0xaeb9('0x61')]);_0x581e95({'count':_0x290659[_0xaeb9('0x1a')],'rows':_0x290659});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x36b403){var _0x55bd95=_[_0xaeb9('0x52')](_0x3749bf['whatsappQueuesWaitingInteractions']);_0x36b403({'count':_0x55bd95[_0xaeb9('0x1a')],'rows':_0x55bd95});});}};var _0x315198=jayson['server'](_0x4d3249)['http']();_0x315198['on']('error',function(_0x2c9af3){logger['error'](JSON[_0xaeb9('0x3a')](_0x2c9af3));return _0x226c07(_0x2c9af3);});_0x315198['listen'](0x232c,_0xaeb9('0x62'),function(){console[_0xaeb9('0x63')](_0xaeb9('0x64'),0x232c);return _0x2962b8('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file +var _0x7896=['routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','rules','channel','message','interaction','transfer','applications','isArray','length','existsSync','join','app','.js','appdata','split','mail','push','slice','dialogflowv2','tag','getMustacheRender','account','ChatWebsiteId','body','%s:%s:%s','./interval','condition','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','Applications\x20executed','stringify','complete','Skipped\x20routing\x20for\x20%s','error','routing\x20is\x20empty','agent','agents','busy','emit','end','update','UserId','error\x20update\x20queue\x20report','stack','busyQueue','message\x20is\x20empty','hasOwnProperty','CurrentCapacity','capacity','updateRealtime','agent\x20not\x20found','find','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','values','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','./applications/utils','./applications/strategy/util','../../../config/logger'];(function(_0x1ac41c,_0x1dacbf){var _0x561d64=function(_0x2654df){while(--_0x2654df){_0x1ac41c['push'](_0x1ac41c['shift']());}};_0x561d64(++_0x1dacbf);}(_0x7896,0x127));var _0x6789=function(_0x14a62c,_0x5c77e1){_0x14a62c=_0x14a62c-0x0;var _0x5bab14=_0x7896[_0x14a62c];return _0x5bab14;};'use strict';var _=require(_0x6789('0x0'));var util=require(_0x6789('0x1'));var path=require(_0x6789('0x2'));var fs=require('fs');var jayson=require(_0x6789('0x3'));var BPromise=require(_0x6789('0x4'));var utils=require(_0x6789('0x5'));var sUtils=require(_0x6789('0x6'));var logger=require(_0x6789('0x7'))(_0x6789('0x8'));var rpc={'openchannelQueueReport':require(_0x6789('0x9')),'mailQueueReport':require(_0x6789('0xa')),'chatQueueReport':require(_0x6789('0xb')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0x6789('0xc')),'whatsappQueueReport':require(_0x6789('0xd'))};var RuleEngine=require(_0x6789('0xe'));function getId(_0x4e3d8c,_0x19723d,_0x59ef90){return util[_0x6789('0xf')](_0x6789('0x10'),_0x4e3d8c,_0x19723d||0x0,_0x59ef90||0x0);}function getIntervals(_0x4d648e,_0x21864f){var _0x54aca8=[];if(!_[_0x6789('0x11')](_0x21864f['IntervalId'])&&!_[_0x6789('0x11')](_0x4d648e[_0x21864f['IntervalId']])&&!_[_0x6789('0x11')](_0x4d648e[_0x21864f[_0x6789('0x12')]][_0x6789('0x13')])){_0x54aca8=_[_0x6789('0x14')](_0x4d648e[_0x21864f[_0x6789('0x12')]][_0x6789('0x13')],_0x6789('0x15'));}else if(!_[_0x6789('0x11')](_0x21864f[_0x6789('0x15')])){_0x54aca8=[_0x21864f[_0x6789('0x15')]];}return _0x54aca8;}exports['listen']=function(_0x4343d2){_0x4343d2[_0x6789('0x16')]={};return new BPromise(function(_0x289e64,_0x3481ba){var _0x339798={'Start':function(_0x28cc02){var _0x53b1e7=this;return new Promise(function(_0x4da8a6,_0x35a190){if(_0x28cc02){try{var _0x19ae62=[];var _0x21e4f9=getId(_0x28cc02[_0x6789('0x17')],_0x28cc02[_0x6789('0x18')]?_0x28cc02[_0x6789('0x18')]['id']:0x0,_0x28cc02[_0x6789('0x19')]?_0x28cc02['interaction']['id']:0x0);var _0xef13e7=sUtils['checkWaitingNotifications'](_0x4343d2,_0x28cc02);if(_0x28cc02[_0x6789('0x1a')]||!_0xef13e7&&_0x28cc02[_0x6789('0x1b')]&&_[_0x6789('0x1c')](_0x28cc02[_0x6789('0x1b')])&&_0x28cc02[_0x6789('0x1b')]['length']){for(var _0x13a341=0x0;_0x13a341<_0x28cc02['applications'][_0x6789('0x1d')];_0x13a341+=0x1){var _0x41de66=_0x28cc02[_0x6789('0x1b')][_0x13a341];if(fs[_0x6789('0x1e')](path[_0x6789('0x1f')](__dirname,_0x6789('0x1b'),_0x41de66[_0x6789('0x20')]+_0x6789('0x21')))){var _0x592758=[];switch(_0x41de66[_0x6789('0x20')]['toLowerCase']()){case'autoreply':var _0x6b17f=_0x41de66[_0x6789('0x22')][_0x6789('0x23')](',');if(_0x28cc02[_0x6789('0x17')]===_0x6789('0x24')){_0x592758[_0x6789('0x25')](_0x6b17f[0x0]);_0x592758[_0x6789('0x25')](_0x6b17f[0x1]);_0x592758[_0x6789('0x25')](_0x6b17f['slice'](0x2,_0x6b17f[_0x6789('0x1d')])[_0x6789('0x1f')](','));}else{_0x592758[_0x6789('0x25')](_0x6b17f[0x0]);_0x592758[_0x6789('0x25')](_0x6b17f[_0x6789('0x26')](0x1,_0x6b17f[_0x6789('0x1d')])[_0x6789('0x1f')](','));}break;case'dialogflow':var _0x4389a2=_0x41de66[_0x6789('0x22')]['split'](',');_0x592758[_0x6789('0x25')](_0x4389a2[0x0]);_0x592758[_0x6789('0x25')](_0x4389a2[0x1]);_0x592758[_0x6789('0x25')](_0x4389a2['slice'](0x2,_0x4389a2[_0x6789('0x1d')])[_0x6789('0x1f')](','));break;case _0x6789('0x27'):var _0xc63bbd=_0x41de66[_0x6789('0x22')][_0x6789('0x23')](',');_0x592758[_0x6789('0x25')](_0xc63bbd[0x0]);_0x592758[_0x6789('0x25')](_0xc63bbd[0x1]);_0x592758[_0x6789('0x25')](_0xc63bbd[0x2]);_0x592758[_0x6789('0x25')](_0xc63bbd[0x3]);_0x592758[_0x6789('0x25')](_0xc63bbd[_0x6789('0x26')](0x4,_0xc63bbd[_0x6789('0x1d')])[_0x6789('0x1f')](','));break;case'amazonlex':var _0x1439f1=_0x41de66[_0x6789('0x22')][_0x6789('0x23')](',');_0x592758[_0x6789('0x25')](_0x1439f1[0x0]);_0x592758[_0x6789('0x25')](_0x1439f1[0x1]);_0x592758[_0x6789('0x25')](_0x1439f1[0x2]);_0x592758['push'](_0x1439f1[0x3]);_0x592758[_0x6789('0x25')](_0x1439f1[_0x6789('0x26')](0x4,_0x1439f1['length'])[_0x6789('0x1f')](','));break;case _0x6789('0x18'):_0x592758[_0x6789('0x25')](_0x41de66[_0x6789('0x22')]);break;case _0x6789('0x28'):_0x592758['push'](_0x41de66['TagId']);_0x592758[_0x6789('0x25')](_0x41de66['appdata']);break;case'tvox':var _0x31541e=utils[_0x6789('0x29')](_0x28cc02[_0x6789('0x2a')]['notificationTemplate'],_0x28cc02);var _0x190fc1=_0x41de66[_0x6789('0x22')][_0x6789('0x23')](',');_0x592758[_0x6789('0x25')](_0x190fc1[0x0]);_0x592758[_0x6789('0x25')](_0x190fc1[0x1]);_0x592758[_0x6789('0x25')](_0x190fc1[0x2]);_0x592758['push'](_0x190fc1[0x3]);_0x592758[_0x6789('0x25')](_0x190fc1[0x4]);_0x592758['push'](_0x190fc1[0x5]);_0x592758[_0x6789('0x25')](_0x190fc1[0x6]);_0x592758[_0x6789('0x25')](_0x190fc1[0x7]);_0x592758['push'](_0x190fc1[0x8]);_0x592758[_0x6789('0x25')](_0x190fc1[0x9]);_0x592758['push'](_0x190fc1[0xa]);_0x592758[_0x6789('0x25')](_0x28cc02['interaction']['id']);_0x592758[_0x6789('0x25')](_0x28cc02[_0x6789('0x18')]['id']);_0x592758[_0x6789('0x25')](_0x41de66[_0x6789('0x2b')]);_0x592758['push'](_0x28cc02[_0x6789('0x19')]['ContactId']);_0x592758[_0x6789('0x25')](_0x28cc02[_0x6789('0x2c')][_0x6789('0x2c')]);_0x592758['push'](_0x31541e);break;default:_0x592758=_[_0x6789('0x11')](_0x41de66[_0x6789('0x22')])?[]:_0x41de66[_0x6789('0x22')]['split'](',');}var _0x254cbd={'id':util['format'](_0x6789('0x2d'),_0x21e4f9,_0x41de66['id'],_0x41de66[_0x6789('0x20')]),'condition':require(_0x6789('0x2e'))[_0x6789('0x2f')](_0x21e4f9,getIntervals(_0x4343d2[_0x6789('0x30')],_0x41de66),_0x4343d2),'consequence':require(_0x6789('0x31')+_0x41de66[_0x6789('0x20')])[_0x6789('0x32')](_0x21e4f9,_0x592758,_0x4343d2,_0x28cc02),'p':_0x41de66[_0x6789('0x33')]||0x0};logger[_0x6789('0x34')](_0x6789('0x35'),_0x254cbd['id'],_0x6789('0x36'),getIntervals(_0x4343d2[_0x6789('0x30')],_0x41de66)[_0x6789('0x1f')](_0x6789('0x37')));_0x19ae62[_0x6789('0x25')](_0x254cbd);}else{logger['error'](_0x6789('0x38'),path[_0x6789('0x1f')](__dirname,'applications',_0x41de66[_0x6789('0x20')]+'.js'));}}_0x4343d2['rules'][_0x21e4f9]=new RuleEngine(_0x19ae62);_0x4343d2[_0x6789('0x16')][_0x21e4f9]['execute'](_0x28cc02,function(_0x244b04){logger['info'](_0x6789('0x39'),JSON[_0x6789('0x3a')](_0x244b04['matchPath']));if(_0x4343d2[_0x6789('0x16')][_0x21e4f9]){_0x4343d2['rules'][_0x21e4f9]['emit'](_0x6789('0x3b'));}});return _0x4da8a6({'code':0xc8,'message':_0x28cc02});}else{if(_0xef13e7){logger[_0x6789('0x34')](util[_0x6789('0xf')](_0x6789('0x3c'),_0x21e4f9));}else{logger['info']('No\x20applications\x20to\x20execute');}return _0x4da8a6({'code':0xc8,'message':_0x28cc02});}}catch(_0x2b6127){logger[_0x6789('0x3d')](_0x2b6127['stack']);return _0x35a190(_0x53b1e7['error'](0x1f4,_0x2b6127));}}return _0x35a190(_0x6789('0x3e'));});},'AcceptMessage':function(_0x90b80f){var _0x20eb14=this;return new Promise(function(_0x52ec58,_0x2911bc){if(_0x90b80f[_0x6789('0x3f')]&&_0x90b80f[_0x6789('0x3f')]['id']){if(_0x4343d2['agents'][_0x90b80f[_0x6789('0x3f')]['id']]){_0x4343d2[_0x6789('0x40')][_0x90b80f[_0x6789('0x3f')]['id']][_0x6789('0x41')]=![];_0x4343d2[_0x6789('0x40')][_0x90b80f[_0x6789('0x3f')]['id']]['busyQueue']=undefined;}}if(_0x90b80f['message']&&_0x90b80f[_0x6789('0x18')]['id']){try{var _0x5ca054=getId(_0x90b80f[_0x6789('0x17')],_0x90b80f['message']?_0x90b80f[_0x6789('0x18')]['id']:0x0,_0x90b80f[_0x6789('0x19')]?_0x90b80f[_0x6789('0x19')]['id']:0x0);if(_0x4343d2[_0x6789('0x16')][_0x5ca054]){_0x4343d2[_0x6789('0x16')][_0x5ca054][_0x6789('0x42')](_0x6789('0x43'));if(rpc[_0x90b80f[_0x6789('0x17')]+'QueueReport']){rpc[_0x90b80f[_0x6789('0x17')]+'QueueReport'][_0x6789('0x44')](_0x5ca054,{'UserId':_0x90b80f[_0x6789('0x18')][_0x6789('0x45')]})['catch'](function(){logger[_0x6789('0x3d')](_0x6789('0x46'));});}}return _0x52ec58({'code':0xc8,'message':_0x90b80f});}catch(_0x2b2199){logger['error'](_0x2b2199[_0x6789('0x47')]);return _0x2911bc(_0x20eb14[_0x6789('0x3d')](0x1f4,_0x2b2199));}}logger[_0x6789('0x3d')]('message\x20is\x20empty');return _0x2911bc(_0x20eb14['error'](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x1a0990){var _0x4d5f28=this;return new Promise(function(_0x456f2d,_0x78e799){if(_0x1a0990[_0x6789('0x3f')]&&_0x1a0990[_0x6789('0x3f')]['id']){try{if(_0x4343d2[_0x6789('0x40')][_0x1a0990[_0x6789('0x3f')]['id']]){_0x4343d2[_0x6789('0x40')][_0x1a0990['agent']['id']][_0x6789('0x41')]=![];_0x4343d2[_0x6789('0x40')][_0x1a0990[_0x6789('0x3f')]['id']][_0x6789('0x48')]=undefined;}return _0x456f2d({'code':0xc8,'message':_0x1a0990});}catch(_0x6cdec7){logger[_0x6789('0x3d')](_0x6cdec7[_0x6789('0x47')]);return _0x78e799(_0x4d5f28[_0x6789('0x3d')](0x1f4,_0x6cdec7));}}logger['error'](_0x6789('0x49'));return _0x78e799(_0x4d5f28[_0x6789('0x3d')](0x1f4,_0x6789('0x49')));});},'AbandonInteraction':function(_0x1e0ddc){var _0x3988aa=this;return new Promise(function(_0x2431e7,_0x4e1d05){if(_0x1e0ddc['channel']&&_0x1e0ddc['interaction']&&_0x1e0ddc[_0x6789('0x19')]['id']){try{var _0x5cb0d1=getId(_0x1e0ddc[_0x6789('0x17')],_0x1e0ddc[_0x6789('0x18')]?_0x1e0ddc['message']['id']:0x0,_0x1e0ddc[_0x6789('0x19')]?_0x1e0ddc[_0x6789('0x19')]['id']:0x0);if(_0x4343d2[_0x6789('0x16')][_0x5cb0d1]){_0x4343d2['rules'][_0x5cb0d1][_0x6789('0x42')](_0x6789('0x43'));}return _0x2431e7({'code':0xc8,'message':_0x1e0ddc});}catch(_0x50b870){logger[_0x6789('0x3d')](_0x50b870[_0x6789('0x47')]);return _0x4e1d05(_0x3988aa[_0x6789('0x3d')](0x1f4,_0x50b870));}}logger[_0x6789('0x3d')](_0x6789('0x49'));return _0x4e1d05(_0x3988aa[_0x6789('0x3d')](0x1f4,_0x6789('0x49')));});},'AgentCapacity':function(_0x232f88){var _0x5aff16=this;return new Promise(function(_0x1f3d1c,_0x22de63){if(_0x4343d2[_0x6789('0x40')]['hasOwnProperty'](_0x232f88['id'])){for(var _0x3cc11b in _0x232f88['capacity']){if(_0x232f88['capacity']['hasOwnProperty'](_0x3cc11b)){if(_0x4343d2[_0x6789('0x40')][_0x232f88['id']][_0x6789('0x4a')](_0x3cc11b+_0x6789('0x4b'))){_0x4343d2[_0x6789('0x40')][_0x232f88['id']][_0x3cc11b+'CurrentCapacity']=parseInt(_0x232f88[_0x6789('0x4c')][_0x3cc11b],0xa);}}}_0x4343d2[_0x6789('0x40')][_0x232f88['id']][_0x6789('0x4d')]();return _0x1f3d1c({'code':0xc8,'message':_0x4343d2['agents'][_0x232f88['id']]});}else{return _0x22de63(_0x5aff16[_0x6789('0x3d')](0x1f4,_0x6789('0x4e')));}});},'Agents':function(_0x4d65e5){return new Promise(function(_0x258472){var _0x37f20f=_['values'](_0x4343d2[_0x6789('0x40')]);if(_0x4d65e5&&_0x4d65e5['id']){var _0x34d9c5=_[_0x6789('0x4f')](_0x37f20f,function(_0xecf405){return _0xecf405['id']===_0x4d65e5['id'];});_0x258472(_0x34d9c5);}else{_0x258472({'count':_0x37f20f[_0x6789('0x1d')],'rows':_0x37f20f});}});},'ChatQueues':function(){return new Promise(function(_0x542f22){var _0x174e17=[];for(var _0x2da1a6 in _0x4343d2[_0x6789('0x50')]){if(_0x4343d2[_0x6789('0x50')][_0x6789('0x4a')](_0x2da1a6)){var _0x4acef1=_0x4343d2['chatQueues'][_0x2da1a6];var _0x373532={'id':_0x4acef1['id'],'available':_0x4acef1[_0x6789('0x51')],'loggedIn':_0x4acef1[_0x6789('0x52')],'name':_0x4acef1[_0x6789('0x53')],'paused':_0x4acef1[_0x6789('0x54')],'waiting':_0x4acef1[_0x6789('0x55')]};_0x174e17['push'](_0x373532);}}_0x542f22({'count':_0x174e17['length'],'rows':_0x174e17});});},'MailQueues':function(){return new Promise(function(_0x25dc0f){var _0x1c8e75=[];for(var _0x49d2c5 in _0x4343d2['mailQueues']){if(_0x4343d2[_0x6789('0x56')][_0x6789('0x4a')](_0x49d2c5)){var _0x1a2175=_0x4343d2['mailQueues'][_0x49d2c5];var _0x51a700={'id':_0x1a2175['id'],'available':_0x1a2175['available'],'loggedIn':_0x1a2175['loggedIn'],'name':_0x1a2175[_0x6789('0x53')],'paused':_0x1a2175[_0x6789('0x54')],'waiting':_0x1a2175['waiting']};_0x1c8e75['push'](_0x51a700);}}_0x25dc0f({'count':_0x1c8e75[_0x6789('0x1d')],'rows':_0x1c8e75});});},'OpenchannelQueues':function(){return new Promise(function(_0x4c5234){var _0x33d809=[];for(var _0x54aa6f in _0x4343d2[_0x6789('0x57')]){if(_0x4343d2['openchannelQueues'][_0x6789('0x4a')](_0x54aa6f)){var _0x2f42af=_0x4343d2[_0x6789('0x57')][_0x54aa6f];var _0x13625a={'id':_0x2f42af['id'],'available':_0x2f42af[_0x6789('0x51')],'loggedIn':_0x2f42af['loggedIn'],'name':_0x2f42af[_0x6789('0x53')],'paused':_0x2f42af['paused'],'waiting':_0x2f42af['waiting']};_0x33d809[_0x6789('0x25')](_0x13625a);}}_0x4c5234({'count':_0x33d809[_0x6789('0x1d')],'rows':_0x33d809});});},'SmsQueues':function(){return new Promise(function(_0x33dd13){var _0x4112ce=[];for(var _0x4cb947 in _0x4343d2[_0x6789('0x58')]){if(_0x4343d2[_0x6789('0x58')][_0x6789('0x4a')](_0x4cb947)){var _0x201411=_0x4343d2['smsQueues'][_0x4cb947];var _0x5b6f30={'id':_0x201411['id'],'available':_0x201411[_0x6789('0x51')],'loggedIn':_0x201411['loggedIn'],'name':_0x201411[_0x6789('0x53')],'paused':_0x201411[_0x6789('0x54')],'waiting':_0x201411[_0x6789('0x55')]};_0x4112ce[_0x6789('0x25')](_0x5b6f30);}}_0x33dd13({'count':_0x4112ce[_0x6789('0x1d')],'rows':_0x4112ce});});},'FaxQueues':function(){return new Promise(function(_0x3a48c8){var _0x1e71e8=[];for(var _0x4b1076 in _0x4343d2[_0x6789('0x59')]){if(_0x4343d2[_0x6789('0x59')]['hasOwnProperty'](_0x4b1076)){var _0x22656d=_0x4343d2[_0x6789('0x59')][_0x4b1076];var _0x44a725={'id':_0x22656d['id'],'available':_0x22656d[_0x6789('0x51')],'loggedIn':_0x22656d[_0x6789('0x52')],'name':_0x22656d[_0x6789('0x53')],'paused':_0x22656d[_0x6789('0x54')],'waiting':_0x22656d[_0x6789('0x55')]};_0x1e71e8[_0x6789('0x25')](_0x44a725);}}_0x3a48c8({'count':_0x1e71e8['length'],'rows':_0x1e71e8});});},'WhatsappQueues':function(){return new Promise(function(_0x191265){var _0x28960d=[];for(var _0x41b4a2 in _0x4343d2[_0x6789('0x5a')]){if(_0x4343d2['whatsappQueues'][_0x6789('0x4a')](_0x41b4a2)){var _0x229186=_0x4343d2[_0x6789('0x5a')][_0x41b4a2];var _0x1061bc={'id':_0x229186['id'],'available':_0x229186[_0x6789('0x51')],'loggedIn':_0x229186['loggedIn'],'name':_0x229186['name'],'paused':_0x229186['paused'],'waiting':_0x229186[_0x6789('0x55')]};_0x28960d['push'](_0x1061bc);}}_0x191265({'count':_0x28960d[_0x6789('0x1d')],'rows':_0x28960d});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x141a2d){var _0x2e9755=_[_0x6789('0x5b')](_0x4343d2[_0x6789('0x5c')]);_0x141a2d({'count':_0x2e9755[_0x6789('0x1d')],'rows':_0x2e9755});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x14a242){var _0x446efb=_[_0x6789('0x5b')](_0x4343d2[_0x6789('0x5d')]);_0x14a242({'count':_0x446efb[_0x6789('0x1d')],'rows':_0x446efb});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0xcdf72){var _0x5b0181=_[_0x6789('0x5b')](_0x4343d2['openchannelQueuesWaitingInteractions']);_0xcdf72({'count':_0x5b0181[_0x6789('0x1d')],'rows':_0x5b0181});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x395eff){var _0x4b91ce=_[_0x6789('0x5b')](_0x4343d2[_0x6789('0x5e')]);_0x395eff({'count':_0x4b91ce[_0x6789('0x1d')],'rows':_0x4b91ce});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x2f1e1e){var _0x53bfd3=_[_0x6789('0x5b')](_0x4343d2[_0x6789('0x5f')]);_0x2f1e1e({'count':_0x53bfd3[_0x6789('0x1d')],'rows':_0x53bfd3});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x59ee01){var _0x396ad7=_['values'](_0x4343d2[_0x6789('0x60')]);_0x59ee01({'count':_0x396ad7[_0x6789('0x1d')],'rows':_0x396ad7});});}};var _0x25bebf=jayson[_0x6789('0x61')](_0x339798)['http']();_0x25bebf['on'](_0x6789('0x3d'),function(_0x5da57f){logger[_0x6789('0x3d')](JSON[_0x6789('0x3a')](_0x5da57f));return _0x3481ba(_0x5da57f);});_0x25bebf['listen'](0x232c,_0x6789('0x62'),function(){console['log'](_0x6789('0x63'),0x232c);return _0x289e64(_0x6789('0x64')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index c4e0544..e37fa5e 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 _0x675d=['iftime\x20%s','indexOf','true','catch','[%s][INTERVAL]\x20%s','all','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','stack','util','bluebird','jayson/promise','lodash','../../../config/logger','routing','client','http','request','then','error','message','result','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','push','Command'];(function(_0x5eee9a,_0x39350c){var _0x10866d=function(_0x3fe86e){while(--_0x3fe86e){_0x5eee9a['push'](_0x5eee9a['shift']());}};_0x10866d(++_0x39350c);}(_0x675d,0x103));var _0xd675=function(_0x33a6f7,_0x34720c){_0x33a6f7=_0x33a6f7-0x0;var _0x4b0f0b=_0x675d[_0x33a6f7];return _0x4b0f0b;};'use strict';var util=require(_0xd675('0x0'));var BPromise=require(_0xd675('0x1'));var jayson=require(_0xd675('0x2'));var _=require(_0xd675('0x3'));var logger=require(_0xd675('0x4'))(_0xd675('0x5'));var client=jayson[_0xd675('0x6')][_0xd675('0x7')]({'port':0x232a});function request(_0x312bbd,_0x1721ae){return new BPromise(function(_0x3ebc8b,_0x9eab3e){return client[_0xd675('0x8')](_0x312bbd,_0x1721ae)[_0xd675('0x9')](function(_0x3f655a){if(_0x3f655a[_0xd675('0xa')]){return _0x9eab3e(_0x3f655a[_0xd675('0xa')][_0xd675('0xb')]);}else{return _0x3ebc8b(_0x3f655a[_0xd675('0xc')]);}})['catch'](function(_0x44ef37){return _0x9eab3e(_0x44ef37);});});}exports[_0xd675('0xd')]=function(_0x106194,_0x201322,_0xb4ff46){return function(_0x12a5c3){if(_0xb4ff46['rules']&&!_0xb4ff46[_0xd675('0xe')][_0x106194]){logger[_0xd675('0xf')](_0xd675('0x10'),_0x106194);return _0x12a5c3[_0xd675('0x11')]();}var _0x5886f7=[];for(var _0x25f89f=0x0;_0x25f89f<_0x201322['length'];_0x25f89f+=0x1){_0x5886f7[_0xd675('0x12')](request(_0xd675('0x13'),{'command':util['format'](_0xd675('0x14'),_0x201322[_0x25f89f])})[_0xd675('0x9')](function(_0x2b8b24){return _0x2b8b24&&_0x2b8b24[_0xd675('0xb')]&&_0x2b8b24[_0xd675('0xb')][_0xd675('0x15')](_0xd675('0x16'))>=0x0?!![]:![];})[_0xd675('0x17')](function(){logger[_0xd675('0xa')](_0xd675('0x18'),_0x106194,_0x201322[_0x25f89f]);}));}BPromise[_0xd675('0x19')](_0x5886f7)[_0xd675('0x9')](function(_0x8a8792){var _0x5df678=_['some'](_0x8a8792);logger['info'](_0xd675('0x1a'),_0x106194,_0x201322[_0xd675('0x1b')](_0xd675('0x1c')),_0x5df678);_0x12a5c3[_0xd675('0x1d')](_0x5df678);})['catch'](function(_0x28c22a){logger[_0xd675('0xa')](_0xd675('0x1a'),_0x106194,_0x201322[_0xd675('0x1b')](_0xd675('0x1c')),_0x28c22a[_0xd675('0x1e')]);_0x12a5c3[_0xd675('0x11')]();});};}; \ No newline at end of file +var _0x3e74=['then','error','condition','rules','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','push','Command','iftime\x20%s','message','indexOf','true','catch','[%s][INTERVAL]\x20%s','all','info','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','stack','util','bluebird','jayson/promise','../../../config/logger'];(function(_0xca247b,_0x2608f6){var _0x5ba66a=function(_0x27b243){while(--_0x27b243){_0xca247b['push'](_0xca247b['shift']());}};_0x5ba66a(++_0x2608f6);}(_0x3e74,0x1dc));var _0x43e7=function(_0x3be8a5,_0x3a68ae){_0x3be8a5=_0x3be8a5-0x0;var _0x36d8b7=_0x3e74[_0x3be8a5];return _0x36d8b7;};'use strict';var util=require(_0x43e7('0x0'));var BPromise=require(_0x43e7('0x1'));var jayson=require(_0x43e7('0x2'));var _=require('lodash');var logger=require(_0x43e7('0x3'))('routing');var client=jayson['client']['http']({'port':0x232a});function request(_0x3ef4c7,_0xca2162){return new BPromise(function(_0x37b3ff,_0x328aea){return client['request'](_0x3ef4c7,_0xca2162)[_0x43e7('0x4')](function(_0x540dae){if(_0x540dae[_0x43e7('0x5')]){return _0x328aea(_0x540dae[_0x43e7('0x5')]['message']);}else{return _0x37b3ff(_0x540dae['result']);}})['catch'](function(_0x11112f){return _0x328aea(_0x11112f);});});}exports[_0x43e7('0x6')]=function(_0x16f50e,_0x1e061d,_0x295e65){return function(_0x228550){if(_0x295e65[_0x43e7('0x7')]&&!_0x295e65[_0x43e7('0x7')][_0x16f50e]){logger['info'](_0x43e7('0x8'),_0x16f50e);return _0x228550[_0x43e7('0x9')]();}var _0x4aaf53=[];for(var _0x10a6a1=0x0;_0x10a6a1<_0x1e061d['length'];_0x10a6a1+=0x1){_0x4aaf53[_0x43e7('0xa')](request(_0x43e7('0xb'),{'command':util['format'](_0x43e7('0xc'),_0x1e061d[_0x10a6a1])})[_0x43e7('0x4')](function(_0x5233c3){return _0x5233c3&&_0x5233c3['message']&&_0x5233c3[_0x43e7('0xd')][_0x43e7('0xe')](_0x43e7('0xf'))>=0x0?!![]:![];})[_0x43e7('0x10')](function(){logger[_0x43e7('0x5')](_0x43e7('0x11'),_0x16f50e,_0x1e061d[_0x10a6a1]);}));}BPromise[_0x43e7('0x12')](_0x4aaf53)[_0x43e7('0x4')](function(_0x1e9e1e){var _0x1166da=_['some'](_0x1e9e1e);logger[_0x43e7('0x13')](_0x43e7('0x14'),_0x16f50e,_0x1e061d[_0x43e7('0x15')](_0x43e7('0x16')),_0x1166da);_0x228550['when'](_0x1166da);})['catch'](function(_0x2f4754){logger[_0x43e7('0x5')](_0x43e7('0x14'),_0x16f50e,_0x1e061d[_0x43e7('0x15')](_0x43e7('0x16')),_0x2f4754[_0x43e7('0x17')]);_0x228550[_0x43e7('0x9')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 7a1a99f..cd96ef3 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 _0x373d=['transfereruniqueid','transfer','blind','extension','transferuniqueid','[%s][agents][blindtransfer]','attendedtransfer','origtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','origtransfereruniqueid','secondtransfereruniqueid','transfertype','ATTENDED','transferexten','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','[%s][agents][attendedtransfer]','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','complete','lodash','./utils','info','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','type','agentcomplete','acw','acwTimeout','request','CreateVoiceAgentReport','agentcalled','format','[%s][agents][agentcalled]','destuniqueid','agentcalledAt','now','called','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','membername','error','agentringnoanswer','debug','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','holdtime','ringtime','talktime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','agentconnect','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connect','answered_elsewhere','answeredelsewheremembername','isNil','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','blindtransfer','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s'];(function(_0x227b64,_0x1c6f72){var _0xc84cb5=function(_0x12e690){while(--_0x12e690){_0x227b64['push'](_0x227b64['shift']());}};_0xc84cb5(++_0x1c6f72);}(_0x373d,0x1e2));var _0xd373=function(_0x3438e0,_0x140a7f){_0x3438e0=_0x3438e0-0x0;var _0x45cbba=_0x373d[_0x3438e0];return _0x45cbba;};'use strict';var _=require(_0xd373('0x0'));var util=require('util');var utils=require(_0xd373('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x53f3b7,_0x30e9ce){utils[_0xd373('0x2')](util['format'](_0xd373('0x3'),_0x53f3b7[_0xd373('0x4')],_0x53f3b7[_0xd373('0x5')],_0x53f3b7['queue'],_0x53f3b7['membername'],_0x53f3b7[_0xd373('0x6')],_0x53f3b7[_0xd373('0x7')],_0x53f3b7[_0xd373('0x8')],_0x53f3b7[_0xd373('0x9')]));if(_0x53f3b7['queue']){utils[_0xd373('0xa')](_0x53f3b7['queue'])['then'](function(_0x59ed5e){if(_0x59ed5e){_0x53f3b7[_0xd373('0xb')]=_0x59ed5e[_0xd373('0xb')];_0x53f3b7['agentacw']=_0x53f3b7[_0xd373('0xc')]?_0x59ed5e[_0xd373('0xd')]:![];_0x53f3b7['acwtime']=_0x53f3b7['agentacw']?_0x59ed5e[_0xd373('0xe')]:0x0;}utils[_0xd373('0xf')](_0xd373('0x10'),_0x53f3b7);});}else{utils[_0xd373('0xf')]('CreateVoiceAgentReport',_0x53f3b7);}if(_0x30e9ce){delete transfers[_0x53f3b7['uniqueid']];}else{delete agents[_0x53f3b7['destuniqueid']];}}exports[_0xd373('0x11')]=function(_0x14a0ee){try{utils['debug'](util[_0xd373('0x12')](_0xd373('0x13'),_0x14a0ee[_0xd373('0x4')]),_0x14a0ee);agents[_0x14a0ee[_0xd373('0x14')]]=_0x14a0ee;agents[_0x14a0ee[_0xd373('0x14')]][_0xd373('0x15')]=utils[_0xd373('0x16')]();agents[_0x14a0ee[_0xd373('0x14')]][_0xd373('0x9')]=_0xd373('0x17');agents[_0x14a0ee[_0xd373('0x14')]][_0xd373('0x8')]=null;agents[_0x14a0ee[_0xd373('0x14')]]['connectedlinename']=null;utils[_0xd373('0x2')](util['format'](_0xd373('0x18'),_0x14a0ee[_0xd373('0x4')],agents[_0x14a0ee['destuniqueid']][_0xd373('0x19')],_0x14a0ee['destuniqueid']));}catch(_0x4d7d72){utils[_0xd373('0x1a')](util[_0xd373('0x12')](_0xd373('0x13'),_0x14a0ee[_0xd373('0x4')]),_0x4d7d72);}};exports[_0xd373('0x1b')]=function(_0x181eb2){try{if(!_['isNil'](agents[_0x181eb2[_0xd373('0x14')]])){utils[_0xd373('0x1c')](util[_0xd373('0x12')](_0xd373('0x1d'),_0x181eb2[_0xd373('0x4')]),_0x181eb2);utils[_0xd373('0x2')](util['format'](_0xd373('0x1e'),_0x181eb2[_0xd373('0x4')],agents[_0x181eb2[_0xd373('0x14')]][_0xd373('0x19')],_0x181eb2[_0xd373('0x14')]));agents[_0x181eb2[_0xd373('0x14')]][_0xd373('0x1b')]=!![];agents[_0x181eb2[_0xd373('0x14')]][_0xd373('0x1f')]=utils[_0xd373('0x16')]();agents[_0x181eb2[_0xd373('0x14')]][_0xd373('0x9')]=_0xd373('0x20');agents[_0x181eb2[_0xd373('0x14')]][_0xd373('0x21')]=_0xd373('0x20');agents[_0x181eb2[_0xd373('0x14')]][_0xd373('0x22')]=_0x181eb2[_0xd373('0x23')]?parseInt(_0x181eb2[_0xd373('0x23')])/0x3e8:0x0;agents[_0x181eb2[_0xd373('0x14')]][_0xd373('0x24')]=0x0;unanswered[_0xd373('0x25')](_0x181eb2[_0xd373('0x14')]);}}catch(_0xf85ca8){utils[_0xd373('0x1a')](util[_0xd373('0x12')](_0xd373('0x1d'),_0x181eb2[_0xd373('0x4')]),_0xf85ca8);}};exports[_0xd373('0x26')]=function(_0x5287e7){try{_[_0xd373('0x27')](agents,function(_0x490842,_0x498aaa){if(_0x490842[_0xd373('0x4')]==_0x5287e7[_0xd373('0x4')]&&!_[_0xd373('0x28')](unanswered,_0x490842[_0xd373('0x14')])){utils[_0xd373('0x1c')](util['format'](_0xd373('0x29'),_0x5287e7[_0xd373('0x4')]),_0x5287e7);utils['info'](util[_0xd373('0x12')](_0xd373('0x2a'),_0x5287e7[_0xd373('0x4')],_0x490842[_0xd373('0x19')],_0x490842[_0xd373('0x14')]));_0x490842[_0xd373('0x1b')]=!![];_0x490842[_0xd373('0x1f')]=utils[_0xd373('0x16')]();_0x490842[_0xd373('0x9')]='abandoned';_0x490842[_0xd373('0x21')]=_0xd373('0x2b');_0x490842[_0xd373('0x22')]=_0x5287e7[_0xd373('0x22')];_0x490842[_0xd373('0x24')]=0x0;writeDB(_0x490842);}});}catch(_0x28da03){utils[_0xd373('0x1a')](util[_0xd373('0x12')](_0xd373('0x29'),_0x5287e7[_0xd373('0x4')]),_0x28da03);}};exports[_0xd373('0x2c')]=function(_0x13a1cd){try{if(agents[_0x13a1cd[_0xd373('0x14')]]){utils[_0xd373('0x1c')](util[_0xd373('0x12')]('[%s][agents][agentconnect]',_0x13a1cd[_0xd373('0x4')]),_0x13a1cd);utils[_0xd373('0x2')](util[_0xd373('0x12')](_0xd373('0x2d'),_0x13a1cd['uniqueid'],agents[_0x13a1cd[_0xd373('0x14')]][_0xd373('0x19')],_0x13a1cd[_0xd373('0x14')]));agents[_0x13a1cd[_0xd373('0x14')]][_0xd373('0x2e')]=utils[_0xd373('0x16')]();agents[_0x13a1cd['destuniqueid']]['connectedlinenum']=_0x13a1cd[_0xd373('0x8')];agents[_0x13a1cd['destuniqueid']][_0xd373('0x2f')]=_0x13a1cd[_0xd373('0x2f')];agents[_0x13a1cd[_0xd373('0x14')]]['holdtime']=_0x13a1cd[_0xd373('0x23')];agents[_0x13a1cd[_0xd373('0x14')]][_0xd373('0x9')]=_0xd373('0x30');_['forIn'](agents,function(_0x513038,_0x5de74e){if(_0x513038[_0xd373('0x14')]!=_0x13a1cd['destuniqueid']&&_0x513038[_0xd373('0x4')]==_0x13a1cd[_0xd373('0x4')]){_0x513038['talktime']=0x0;_0x513038['holdtime']=_0x13a1cd['ringtime'];_0x513038[_0xd373('0x1b')]=!![];_0x513038[_0xd373('0x1f')]=utils[_0xd373('0x16')]();_0x513038['lastevent']='answered_elsewhere';_0x513038[_0xd373('0x21')]=_0xd373('0x31');_0x513038['answeredelsewheredestinationuniqueid']=_0x13a1cd[_0xd373('0x14')];_0x513038[_0xd373('0x32')]=_0x13a1cd[_0xd373('0x19')];writeDB(_0x513038);}});}}catch(_0x9989e4){utils[_0xd373('0x1a')](util['format']('[%s][agents][agentconnect]',_0x13a1cd[_0xd373('0x4')]),_0x9989e4);}};exports[_0xd373('0xc')]=function(_0x30b423){try{if(!_[_0xd373('0x33')](agents[_0x30b423['destuniqueid']])){utils[_0xd373('0x1c')](util['format'](_0xd373('0x34'),_0x30b423[_0xd373('0x4')]),_0x30b423);utils[_0xd373('0x2')](util[_0xd373('0x12')](_0xd373('0x35'),_0x30b423['uniqueid'],agents[_0x30b423[_0xd373('0x14')]][_0xd373('0x19')],_0x30b423['destuniqueid']));agents[_0x30b423[_0xd373('0x14')]][_0xd373('0xc')]=!![];agents[_0x30b423[_0xd373('0x14')]][_0xd373('0x36')]=utils[_0xd373('0x16')]();agents[_0x30b423[_0xd373('0x14')]][_0xd373('0x24')]=utils[_0xd373('0x37')](agents[_0x30b423[_0xd373('0x14')]][_0xd373('0x36')],agents[_0x30b423['destuniqueid']]['agentconnectAt']);agents[_0x30b423[_0xd373('0x14')]]['reason']=_0x30b423[_0xd373('0x21')];agents[_0x30b423['destuniqueid']]['lastevent']='complete';writeDB(agents[_0x30b423[_0xd373('0x14')]]);}}catch(_0x39d995){utils[_0xd373('0x1a')](util[_0xd373('0x12')](_0xd373('0x34'),_0x30b423[_0xd373('0x4')]),_0x39d995);}};exports[_0xd373('0x38')]=function(_0x4d1088){try{if(!_[_0xd373('0x33')](agents[_0x4d1088['transfereruniqueid']])){utils[_0xd373('0x1c')](util[_0xd373('0x12')]('[%s][agents][blindtransfer]',_0x4d1088[_0xd373('0x4')]),_0x4d1088);utils['info'](util[_0xd373('0x12')](_0xd373('0x39'),_0x4d1088[_0xd373('0x4')],agents[_0x4d1088[_0xd373('0x3a')]][_0xd373('0x19')],agents[_0x4d1088['transfereruniqueid']]['uniqueid']));agents[_0x4d1088['transfereruniqueid']][_0xd373('0x3b')]=!![];agents[_0x4d1088[_0xd373('0x3a')]]['transfertype']=_0xd373('0x3c');agents[_0x4d1088[_0xd373('0x3a')]]['transferexten']=_0x4d1088[_0xd373('0x3d')];agents[_0x4d1088[_0xd373('0x3a')]][_0xd373('0x3e')]=agents[_0x4d1088[_0xd373('0x3a')]][_0xd373('0x4')];}}catch(_0xa2758){utils[_0xd373('0x1a')](util[_0xd373('0x12')](_0xd373('0x3f'),_0x4d1088[_0xd373('0x4')]),_0xa2758);}};exports[_0xd373('0x40')]=function(_0x5b88ea){try{utils['debug'](util['format']('[%s][agents][attendedtransfer]',_0x5b88ea['origtransfereruniqueid']),_0x5b88ea);if(_0x5b88ea['origtransfereruniqueid']==_0x5b88ea[_0xd373('0x41')]){if(!_[_0xd373('0x33')](agents[_0x5b88ea['secondtransfereruniqueid']])){utils['info'](util['format'](_0xd373('0x42'),_0x5b88ea[_0xd373('0x43')],agents[_0x5b88ea['secondtransfereruniqueid']]['membername']));agents[_0x5b88ea[_0xd373('0x44')]][_0xd373('0x3b')]=!![];agents[_0x5b88ea[_0xd373('0x44')]][_0xd373('0x45')]=_0xd373('0x46');agents[_0x5b88ea['secondtransfereruniqueid']][_0xd373('0x47')]=_0x5b88ea[_0xd373('0x48')];agents[_0x5b88ea[_0xd373('0x44')]][_0xd373('0x3e')]=_0x5b88ea[_0xd373('0x43')];}if(_0x5b88ea[_0xd373('0x49')]&&agents[_0x5b88ea[_0xd373('0x49')]]){agents[_0x5b88ea[_0xd373('0x49')]][_0xd373('0x4a')]=0x1;transfers[_0x5b88ea[_0xd373('0x49')]]=_[_0xd373('0x4b')](agents[_0x5b88ea[_0xd373('0x49')]]);transfers[_0x5b88ea[_0xd373('0x49')]][_0xd373('0x7')]=agents[_0x5b88ea[_0xd373('0x44')]]['calleridnum'];transfers[_0x5b88ea[_0xd373('0x49')]][_0xd373('0x4c')]=agents[_0x5b88ea[_0xd373('0x44')]]['calleridname'];transfers[_0x5b88ea[_0xd373('0x49')]]['agentcalledAt']=utils[_0xd373('0x16')]();transfers[_0x5b88ea['transfereeuniqueid']][_0xd373('0x2e')]=utils[_0xd373('0x16')]();transfers[_0x5b88ea[_0xd373('0x49')]][_0xd373('0x22')]=0x0;transfers[_0x5b88ea[_0xd373('0x49')]][_0xd373('0x4a')]=0x2;}}else if(_0x5b88ea[_0xd373('0x44')]==_0x5b88ea[_0xd373('0x4d')]){if(!_[_0xd373('0x33')](agents[_0x5b88ea[_0xd373('0x43')]])){utils[_0xd373('0x2')](util[_0xd373('0x12')](_0xd373('0x42'),_0x5b88ea[_0xd373('0x43')],agents[_0x5b88ea[_0xd373('0x43')]][_0xd373('0x19')]));agents[_0x5b88ea[_0xd373('0x43')]][_0xd373('0x3b')]=!![];agents[_0x5b88ea[_0xd373('0x43')]][_0xd373('0x45')]=_0xd373('0x46');agents[_0x5b88ea[_0xd373('0x43')]][_0xd373('0x47')]=_0x5b88ea[_0xd373('0x4e')];agents[_0x5b88ea[_0xd373('0x43')]][_0xd373('0x3e')]=_0x5b88ea['secondtransfereruniqueid'];}if(_0x5b88ea[_0xd373('0x4f')]&&agents[_0x5b88ea[_0xd373('0x4f')]]){agents[_0x5b88ea[_0xd373('0x4f')]]['agententerreason']=0x1;transfers[_0x5b88ea[_0xd373('0x4f')]]=_[_0xd373('0x4b')](agents[_0x5b88ea[_0xd373('0x4f')]]);transfers[_0x5b88ea[_0xd373('0x4f')]][_0xd373('0x7')]=agents[_0x5b88ea[_0xd373('0x43')]][_0xd373('0x7')];transfers[_0x5b88ea['transfertargetuniqueid']][_0xd373('0x4c')]=agents[_0x5b88ea[_0xd373('0x43')]][_0xd373('0x4c')];transfers[_0x5b88ea[_0xd373('0x4f')]][_0xd373('0x15')]=utils[_0xd373('0x16')]();transfers[_0x5b88ea[_0xd373('0x4f')]][_0xd373('0x2e')]=utils['now']();transfers[_0x5b88ea[_0xd373('0x4f')]]['holdtime']=0x0;transfers[_0x5b88ea[_0xd373('0x4f')]][_0xd373('0x4a')]=0x2;}}}catch(_0x1337c4){utils[_0xd373('0x1a')](util[_0xd373('0x12')](_0xd373('0x50'),_0x5b88ea[_0xd373('0x43')]),_0x1337c4);}};exports[_0xd373('0x51')]=function(_0x5f1bfd){try{utils[_0xd373('0x1c')](util['format'](_0xd373('0x52'),_0x5f1bfd[_0xd373('0x4')]),_0x5f1bfd);if(agents[_0x5f1bfd[_0xd373('0x4')]]&&agents[_0x5f1bfd[_0xd373('0x4')]][_0xd373('0x21')]===_0xd373('0x20')){if(_0x5f1bfd[_0xd373('0x53')]==='21'){agents[_0x5f1bfd['uniqueid']][_0xd373('0x21')]=_0xd373('0x54');agents[_0x5f1bfd[_0xd373('0x4')]]['lastevent']=_0xd373('0x54');}utils[_0xd373('0x2')](util[_0xd373('0x12')](_0xd373('0x55'),_0x5f1bfd[_0xd373('0x4')],agents[_0x5f1bfd[_0xd373('0x4')]][_0xd373('0x19')],agents[_0x5f1bfd[_0xd373('0x4')]][_0xd373('0x21')],agents[_0x5f1bfd[_0xd373('0x4')]][_0xd373('0x9')]));writeDB(agents[_0x5f1bfd[_0xd373('0x4')]]);var _0x5bbea5=unanswered[_0xd373('0x56')](_0x5f1bfd[_0xd373('0x4')]);if(_0x5bbea5>-0x1){unanswered[_0xd373('0x57')](_0x5bbea5,0x1);}}if(transfers[_0x5f1bfd['uniqueid']]){transfers[_0x5f1bfd[_0xd373('0x4')]][_0xd373('0xc')]=!![];transfers[_0x5f1bfd[_0xd373('0x4')]]['agentcompleteAt']=utils[_0xd373('0x16')]();transfers[_0x5f1bfd['uniqueid']][_0xd373('0x24')]=utils[_0xd373('0x37')](transfers[_0x5f1bfd[_0xd373('0x4')]][_0xd373('0x36')],transfers[_0x5f1bfd['uniqueid']][_0xd373('0x2e')]);transfers[_0x5f1bfd['uniqueid']][_0xd373('0x21')]=_0xd373('0x58');transfers[_0x5f1bfd[_0xd373('0x4')]][_0xd373('0x9')]=_0xd373('0x59');utils[_0xd373('0x2')](util['format'](_0xd373('0x55'),_0x5f1bfd['uniqueid'],transfers[_0x5f1bfd[_0xd373('0x4')]]['membername'],transfers[_0x5f1bfd['uniqueid']][_0xd373('0x21')],transfers[_0x5f1bfd[_0xd373('0x4')]][_0xd373('0x9')]));writeDB(transfers[_0x5f1bfd[_0xd373('0x4')]],!![]);}if(agents[_0x5f1bfd['uniqueid']]&&agents[_0x5f1bfd['uniqueid']][_0xd373('0x2e')]){agents[_0x5f1bfd[_0xd373('0x4')]][_0xd373('0xc')]=!![];agents[_0x5f1bfd[_0xd373('0x4')]][_0xd373('0x36')]=utils[_0xd373('0x16')]();agents[_0x5f1bfd[_0xd373('0x4')]][_0xd373('0x24')]=utils[_0xd373('0x37')](agents[_0x5f1bfd[_0xd373('0x4')]]['agentcompleteAt'],agents[_0x5f1bfd[_0xd373('0x4')]][_0xd373('0x2e')]);agents[_0x5f1bfd[_0xd373('0x4')]][_0xd373('0x21')]=agents[_0x5f1bfd[_0xd373('0x4')]][_0xd373('0x3b')]?_0xd373('0x3b'):'agent';agents[_0x5f1bfd[_0xd373('0x4')]]['lastevent']='complete';utils[_0xd373('0x2')](util[_0xd373('0x12')](_0xd373('0x55'),_0x5f1bfd[_0xd373('0x4')],agents[_0x5f1bfd[_0xd373('0x4')]][_0xd373('0x19')],agents[_0x5f1bfd['uniqueid']][_0xd373('0x21')],agents[_0x5f1bfd[_0xd373('0x4')]][_0xd373('0x9')]));writeDB(agents[_0x5f1bfd['uniqueid']]);}}catch(_0x467ac8){utils[_0xd373('0x1a')](util[_0xd373('0x12')]('[%s][agents][hangup]',_0x5f1bfd[_0xd373('0x4')]),_0x467ac8);}}; \ No newline at end of file +var _0xbb53=['agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','holdtime','connect','answered_elsewhere','answeredelsewheremembername','agentcompleteAt','diffTime','complete','[%s][agents][agentcomplete]','transfereruniqueid','transfer','transfertype','blind','transferexten','extension','transferuniqueid','[%s][agents][blindtransfer]','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','agentconnectAt','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','[%s][agents][hangup]','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','splice','agent','lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','interface','calleridnum','connectedlinenum','lastevent','queue','type','agentcomplete','agentacw','acwTimeout','CreateVoiceAgentReport','agentcalled','debug','[%s][agents][agentcalled]','destuniqueid','agentcalledAt','called','connectedlinename','membername','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','now','reason','timeout','ringtime','talktime','push','[%s][agents][agentringnoanswer]','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','agentringnoanswerAt','abandoned'];(function(_0x434be7,_0x3c46e6){var _0x3b420b=function(_0x118c41){while(--_0x118c41){_0x434be7['push'](_0x434be7['shift']());}};_0x3b420b(++_0x3c46e6);}(_0xbb53,0x121));var _0x3bb5=function(_0x232fad,_0x3481c5){_0x232fad=_0x232fad-0x0;var _0x4f82af=_0xbb53[_0x232fad];return _0x4f82af;};'use strict';var _=require(_0x3bb5('0x0'));var util=require(_0x3bb5('0x1'));var utils=require(_0x3bb5('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0xa71c15,_0x20c8b6){utils[_0x3bb5('0x3')](util[_0x3bb5('0x4')](_0x3bb5('0x5'),_0xa71c15[_0x3bb5('0x6')],_0xa71c15[_0x3bb5('0x7')],_0xa71c15['queue'],_0xa71c15['membername'],_0xa71c15[_0x3bb5('0x8')],_0xa71c15[_0x3bb5('0x9')],_0xa71c15[_0x3bb5('0xa')],_0xa71c15[_0x3bb5('0xb')]));if(_0xa71c15[_0x3bb5('0xc')]){utils['getVoiceQueueByName'](_0xa71c15['queue'])['then'](function(_0x10ddfb){if(_0x10ddfb){_0xa71c15[_0x3bb5('0xd')]=_0x10ddfb[_0x3bb5('0xd')];_0xa71c15['agentacw']=_0xa71c15[_0x3bb5('0xe')]?_0x10ddfb['acw']:![];_0xa71c15['acwtime']=_0xa71c15[_0x3bb5('0xf')]?_0x10ddfb[_0x3bb5('0x10')]:0x0;}utils['request'](_0x3bb5('0x11'),_0xa71c15);});}else{utils['request'](_0x3bb5('0x11'),_0xa71c15);}if(_0x20c8b6){delete transfers[_0xa71c15['uniqueid']];}else{delete agents[_0xa71c15['destuniqueid']];}}exports[_0x3bb5('0x12')]=function(_0x35a99b){try{utils[_0x3bb5('0x13')](util['format'](_0x3bb5('0x14'),_0x35a99b[_0x3bb5('0x6')]),_0x35a99b);agents[_0x35a99b['destuniqueid']]=_0x35a99b;agents[_0x35a99b[_0x3bb5('0x15')]][_0x3bb5('0x16')]=utils['now']();agents[_0x35a99b['destuniqueid']]['lastevent']=_0x3bb5('0x17');agents[_0x35a99b[_0x3bb5('0x15')]]['connectedlinenum']=null;agents[_0x35a99b[_0x3bb5('0x15')]][_0x3bb5('0x18')]=null;utils[_0x3bb5('0x3')](util[_0x3bb5('0x4')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x35a99b[_0x3bb5('0x6')],agents[_0x35a99b[_0x3bb5('0x15')]][_0x3bb5('0x19')],_0x35a99b['destuniqueid']));}catch(_0x5efea4){utils[_0x3bb5('0x1a')](util[_0x3bb5('0x4')](_0x3bb5('0x14'),_0x35a99b['uniqueid']),_0x5efea4);}};exports[_0x3bb5('0x1b')]=function(_0x2afe6e){try{if(!_[_0x3bb5('0x1c')](agents[_0x2afe6e[_0x3bb5('0x15')]])){utils[_0x3bb5('0x13')](util[_0x3bb5('0x4')]('[%s][agents][agentringnoanswer]',_0x2afe6e[_0x3bb5('0x6')]),_0x2afe6e);utils[_0x3bb5('0x3')](util[_0x3bb5('0x4')](_0x3bb5('0x1d'),_0x2afe6e[_0x3bb5('0x6')],agents[_0x2afe6e[_0x3bb5('0x15')]][_0x3bb5('0x19')],_0x2afe6e['destuniqueid']));agents[_0x2afe6e[_0x3bb5('0x15')]][_0x3bb5('0x1b')]=!![];agents[_0x2afe6e['destuniqueid']]['agentringnoanswerAt']=utils[_0x3bb5('0x1e')]();agents[_0x2afe6e[_0x3bb5('0x15')]]['lastevent']='timeout';agents[_0x2afe6e[_0x3bb5('0x15')]][_0x3bb5('0x1f')]=_0x3bb5('0x20');agents[_0x2afe6e[_0x3bb5('0x15')]]['holdtime']=_0x2afe6e['ringtime']?parseInt(_0x2afe6e[_0x3bb5('0x21')])/0x3e8:0x0;agents[_0x2afe6e['destuniqueid']][_0x3bb5('0x22')]=0x0;unanswered[_0x3bb5('0x23')](_0x2afe6e[_0x3bb5('0x15')]);}}catch(_0x534b15){utils['error'](util[_0x3bb5('0x4')](_0x3bb5('0x24'),_0x2afe6e[_0x3bb5('0x6')]),_0x534b15);}};exports[_0x3bb5('0x25')]=function(_0x311680){try{_[_0x3bb5('0x26')](agents,function(_0x3ed2cc,_0x5ce225){if(_0x3ed2cc[_0x3bb5('0x6')]==_0x311680[_0x3bb5('0x6')]&&!_[_0x3bb5('0x27')](unanswered,_0x3ed2cc[_0x3bb5('0x15')])){utils[_0x3bb5('0x13')](util[_0x3bb5('0x4')](_0x3bb5('0x28'),_0x311680['uniqueid']),_0x311680);utils[_0x3bb5('0x3')](util[_0x3bb5('0x4')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x311680[_0x3bb5('0x6')],_0x3ed2cc[_0x3bb5('0x19')],_0x3ed2cc[_0x3bb5('0x15')]));_0x3ed2cc[_0x3bb5('0x1b')]=!![];_0x3ed2cc[_0x3bb5('0x29')]=utils['now']();_0x3ed2cc[_0x3bb5('0xb')]=_0x3bb5('0x2a');_0x3ed2cc[_0x3bb5('0x1f')]=_0x3bb5('0x2a');_0x3ed2cc['holdtime']=_0x311680['holdtime'];_0x3ed2cc[_0x3bb5('0x22')]=0x0;writeDB(_0x3ed2cc);}});}catch(_0xeeb452){utils[_0x3bb5('0x1a')](util[_0x3bb5('0x4')](_0x3bb5('0x28'),_0x311680[_0x3bb5('0x6')]),_0xeeb452);}};exports[_0x3bb5('0x2b')]=function(_0x2a0a19){try{if(agents[_0x2a0a19[_0x3bb5('0x15')]]){utils['debug'](util[_0x3bb5('0x4')](_0x3bb5('0x2c'),_0x2a0a19['uniqueid']),_0x2a0a19);utils['info'](util[_0x3bb5('0x4')](_0x3bb5('0x2d'),_0x2a0a19[_0x3bb5('0x6')],agents[_0x2a0a19[_0x3bb5('0x15')]]['membername'],_0x2a0a19['destuniqueid']));agents[_0x2a0a19[_0x3bb5('0x15')]]['agentconnectAt']=utils[_0x3bb5('0x1e')]();agents[_0x2a0a19['destuniqueid']]['connectedlinenum']=_0x2a0a19[_0x3bb5('0xa')];agents[_0x2a0a19['destuniqueid']]['connectedlinename']=_0x2a0a19[_0x3bb5('0x18')];agents[_0x2a0a19[_0x3bb5('0x15')]][_0x3bb5('0x2e')]=_0x2a0a19['ringtime'];agents[_0x2a0a19[_0x3bb5('0x15')]]['lastevent']=_0x3bb5('0x2f');_['forIn'](agents,function(_0x235e3,_0x35bc81){if(_0x235e3[_0x3bb5('0x15')]!=_0x2a0a19[_0x3bb5('0x15')]&&_0x235e3[_0x3bb5('0x6')]==_0x2a0a19[_0x3bb5('0x6')]){_0x235e3['talktime']=0x0;_0x235e3[_0x3bb5('0x2e')]=_0x2a0a19[_0x3bb5('0x21')];_0x235e3['agentringnoanswer']=!![];_0x235e3[_0x3bb5('0x29')]=utils[_0x3bb5('0x1e')]();_0x235e3[_0x3bb5('0xb')]='answered_elsewhere';_0x235e3[_0x3bb5('0x1f')]=_0x3bb5('0x30');_0x235e3['answeredelsewheredestinationuniqueid']=_0x2a0a19[_0x3bb5('0x15')];_0x235e3[_0x3bb5('0x31')]=_0x2a0a19[_0x3bb5('0x19')];writeDB(_0x235e3);}});}}catch(_0x2291e9){utils[_0x3bb5('0x1a')](util[_0x3bb5('0x4')](_0x3bb5('0x2c'),_0x2a0a19[_0x3bb5('0x6')]),_0x2291e9);}};exports[_0x3bb5('0xe')]=function(_0x42676d){try{if(!_[_0x3bb5('0x1c')](agents[_0x42676d[_0x3bb5('0x15')]])){utils[_0x3bb5('0x13')](util[_0x3bb5('0x4')]('[%s][agents][agentcomplete]',_0x42676d[_0x3bb5('0x6')]),_0x42676d);utils[_0x3bb5('0x3')](util['format']('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x42676d[_0x3bb5('0x6')],agents[_0x42676d[_0x3bb5('0x15')]][_0x3bb5('0x19')],_0x42676d[_0x3bb5('0x15')]));agents[_0x42676d[_0x3bb5('0x15')]][_0x3bb5('0xe')]=!![];agents[_0x42676d[_0x3bb5('0x15')]][_0x3bb5('0x32')]=utils['now']();agents[_0x42676d['destuniqueid']][_0x3bb5('0x22')]=utils[_0x3bb5('0x33')](agents[_0x42676d[_0x3bb5('0x15')]]['agentcompleteAt'],agents[_0x42676d[_0x3bb5('0x15')]]['agentconnectAt']);agents[_0x42676d[_0x3bb5('0x15')]][_0x3bb5('0x1f')]=_0x42676d[_0x3bb5('0x1f')];agents[_0x42676d[_0x3bb5('0x15')]][_0x3bb5('0xb')]=_0x3bb5('0x34');writeDB(agents[_0x42676d['destuniqueid']]);}}catch(_0x2efd7c){utils[_0x3bb5('0x1a')](util['format'](_0x3bb5('0x35'),_0x42676d[_0x3bb5('0x6')]),_0x2efd7c);}};exports['blindtransfer']=function(_0x41edf7){try{if(!_[_0x3bb5('0x1c')](agents[_0x41edf7[_0x3bb5('0x36')]])){utils[_0x3bb5('0x13')](util[_0x3bb5('0x4')]('[%s][agents][blindtransfer]',_0x41edf7[_0x3bb5('0x6')]),_0x41edf7);utils[_0x3bb5('0x3')](util['format']('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x41edf7[_0x3bb5('0x6')],agents[_0x41edf7[_0x3bb5('0x36')]][_0x3bb5('0x19')],agents[_0x41edf7[_0x3bb5('0x36')]][_0x3bb5('0x6')]));agents[_0x41edf7['transfereruniqueid']][_0x3bb5('0x37')]=!![];agents[_0x41edf7[_0x3bb5('0x36')]][_0x3bb5('0x38')]=_0x3bb5('0x39');agents[_0x41edf7[_0x3bb5('0x36')]][_0x3bb5('0x3a')]=_0x41edf7[_0x3bb5('0x3b')];agents[_0x41edf7['transfereruniqueid']][_0x3bb5('0x3c')]=agents[_0x41edf7[_0x3bb5('0x36')]][_0x3bb5('0x6')];}}catch(_0x239a34){utils[_0x3bb5('0x1a')](util['format'](_0x3bb5('0x3d'),_0x41edf7[_0x3bb5('0x6')]),_0x239a34);}};exports[_0x3bb5('0x3e')]=function(_0x1ff862){try{utils[_0x3bb5('0x13')](util[_0x3bb5('0x4')](_0x3bb5('0x3f'),_0x1ff862[_0x3bb5('0x40')]),_0x1ff862);if(_0x1ff862['origtransfereruniqueid']==_0x1ff862[_0x3bb5('0x41')]){if(!_[_0x3bb5('0x1c')](agents[_0x1ff862[_0x3bb5('0x42')]])){utils[_0x3bb5('0x3')](util['format'](_0x3bb5('0x43'),_0x1ff862['origtransfereruniqueid'],agents[_0x1ff862[_0x3bb5('0x42')]][_0x3bb5('0x19')]));agents[_0x1ff862[_0x3bb5('0x42')]][_0x3bb5('0x37')]=!![];agents[_0x1ff862[_0x3bb5('0x42')]]['transfertype']=_0x3bb5('0x44');agents[_0x1ff862[_0x3bb5('0x42')]][_0x3bb5('0x3a')]=_0x1ff862[_0x3bb5('0x45')];agents[_0x1ff862['secondtransfereruniqueid']][_0x3bb5('0x3c')]=_0x1ff862[_0x3bb5('0x40')];}if(_0x1ff862[_0x3bb5('0x46')]&&agents[_0x1ff862[_0x3bb5('0x46')]]){agents[_0x1ff862[_0x3bb5('0x46')]][_0x3bb5('0x47')]=0x1;transfers[_0x1ff862[_0x3bb5('0x46')]]=_[_0x3bb5('0x48')](agents[_0x1ff862['transfereeuniqueid']]);transfers[_0x1ff862[_0x3bb5('0x46')]][_0x3bb5('0x9')]=agents[_0x1ff862[_0x3bb5('0x42')]]['calleridnum'];transfers[_0x1ff862['transfereeuniqueid']][_0x3bb5('0x49')]=agents[_0x1ff862[_0x3bb5('0x42')]][_0x3bb5('0x49')];transfers[_0x1ff862['transfereeuniqueid']][_0x3bb5('0x16')]=utils[_0x3bb5('0x1e')]();transfers[_0x1ff862[_0x3bb5('0x46')]][_0x3bb5('0x4a')]=utils[_0x3bb5('0x1e')]();transfers[_0x1ff862[_0x3bb5('0x46')]][_0x3bb5('0x2e')]=0x0;transfers[_0x1ff862['transfereeuniqueid']]['agententerreason']=0x2;}}else if(_0x1ff862[_0x3bb5('0x42')]==_0x1ff862[_0x3bb5('0x4b')]){if(!_[_0x3bb5('0x1c')](agents[_0x1ff862[_0x3bb5('0x40')]])){utils[_0x3bb5('0x3')](util[_0x3bb5('0x4')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x1ff862[_0x3bb5('0x40')],agents[_0x1ff862[_0x3bb5('0x40')]][_0x3bb5('0x19')]));agents[_0x1ff862[_0x3bb5('0x40')]]['transfer']=!![];agents[_0x1ff862[_0x3bb5('0x40')]][_0x3bb5('0x38')]=_0x3bb5('0x44');agents[_0x1ff862[_0x3bb5('0x40')]][_0x3bb5('0x3a')]=_0x1ff862[_0x3bb5('0x4c')];agents[_0x1ff862[_0x3bb5('0x40')]][_0x3bb5('0x3c')]=_0x1ff862['secondtransfereruniqueid'];}if(_0x1ff862[_0x3bb5('0x4d')]&&agents[_0x1ff862[_0x3bb5('0x4d')]]){agents[_0x1ff862[_0x3bb5('0x4d')]][_0x3bb5('0x47')]=0x1;transfers[_0x1ff862[_0x3bb5('0x4d')]]=_['clone'](agents[_0x1ff862[_0x3bb5('0x4d')]]);transfers[_0x1ff862['transfertargetuniqueid']][_0x3bb5('0x9')]=agents[_0x1ff862['origtransfereruniqueid']][_0x3bb5('0x9')];transfers[_0x1ff862[_0x3bb5('0x4d')]][_0x3bb5('0x49')]=agents[_0x1ff862['origtransfereruniqueid']][_0x3bb5('0x49')];transfers[_0x1ff862[_0x3bb5('0x4d')]][_0x3bb5('0x16')]=utils['now']();transfers[_0x1ff862[_0x3bb5('0x4d')]][_0x3bb5('0x4a')]=utils[_0x3bb5('0x1e')]();transfers[_0x1ff862['transfertargetuniqueid']][_0x3bb5('0x2e')]=0x0;transfers[_0x1ff862[_0x3bb5('0x4d')]][_0x3bb5('0x47')]=0x2;}}}catch(_0xc34441){utils[_0x3bb5('0x1a')](util[_0x3bb5('0x4')](_0x3bb5('0x3f'),_0x1ff862['origtransfereruniqueid']),_0xc34441);}};exports['hangup']=function(_0x2b3ed8){try{utils[_0x3bb5('0x13')](util['format'](_0x3bb5('0x4e'),_0x2b3ed8['uniqueid']),_0x2b3ed8);if(agents[_0x2b3ed8[_0x3bb5('0x6')]]&&agents[_0x2b3ed8[_0x3bb5('0x6')]][_0x3bb5('0x1f')]===_0x3bb5('0x20')){if(_0x2b3ed8['cause']==='21'){agents[_0x2b3ed8[_0x3bb5('0x6')]][_0x3bb5('0x1f')]=_0x3bb5('0x4f');agents[_0x2b3ed8['uniqueid']][_0x3bb5('0xb')]=_0x3bb5('0x4f');}utils['info'](util[_0x3bb5('0x4')](_0x3bb5('0x50'),_0x2b3ed8[_0x3bb5('0x6')],agents[_0x2b3ed8[_0x3bb5('0x6')]][_0x3bb5('0x19')],agents[_0x2b3ed8[_0x3bb5('0x6')]][_0x3bb5('0x1f')],agents[_0x2b3ed8['uniqueid']]['lastevent']));writeDB(agents[_0x2b3ed8['uniqueid']]);var _0x5bfdf2=unanswered['indexOf'](_0x2b3ed8[_0x3bb5('0x6')]);if(_0x5bfdf2>-0x1){unanswered[_0x3bb5('0x51')](_0x5bfdf2,0x1);}}if(transfers[_0x2b3ed8[_0x3bb5('0x6')]]){transfers[_0x2b3ed8[_0x3bb5('0x6')]][_0x3bb5('0xe')]=!![];transfers[_0x2b3ed8[_0x3bb5('0x6')]][_0x3bb5('0x32')]=utils[_0x3bb5('0x1e')]();transfers[_0x2b3ed8['uniqueid']][_0x3bb5('0x22')]=utils[_0x3bb5('0x33')](transfers[_0x2b3ed8[_0x3bb5('0x6')]][_0x3bb5('0x32')],transfers[_0x2b3ed8[_0x3bb5('0x6')]][_0x3bb5('0x4a')]);transfers[_0x2b3ed8[_0x3bb5('0x6')]]['reason']=_0x3bb5('0x52');transfers[_0x2b3ed8['uniqueid']][_0x3bb5('0xb')]=_0x3bb5('0x34');utils[_0x3bb5('0x3')](util['format'](_0x3bb5('0x50'),_0x2b3ed8[_0x3bb5('0x6')],transfers[_0x2b3ed8[_0x3bb5('0x6')]][_0x3bb5('0x19')],transfers[_0x2b3ed8['uniqueid']][_0x3bb5('0x1f')],transfers[_0x2b3ed8['uniqueid']]['lastevent']));writeDB(transfers[_0x2b3ed8[_0x3bb5('0x6')]],!![]);}if(agents[_0x2b3ed8[_0x3bb5('0x6')]]&&agents[_0x2b3ed8[_0x3bb5('0x6')]][_0x3bb5('0x4a')]){agents[_0x2b3ed8['uniqueid']][_0x3bb5('0xe')]=!![];agents[_0x2b3ed8['uniqueid']][_0x3bb5('0x32')]=utils[_0x3bb5('0x1e')]();agents[_0x2b3ed8[_0x3bb5('0x6')]][_0x3bb5('0x22')]=utils[_0x3bb5('0x33')](agents[_0x2b3ed8['uniqueid']][_0x3bb5('0x32')],agents[_0x2b3ed8['uniqueid']][_0x3bb5('0x4a')]);agents[_0x2b3ed8['uniqueid']][_0x3bb5('0x1f')]=agents[_0x2b3ed8[_0x3bb5('0x6')]][_0x3bb5('0x37')]?_0x3bb5('0x37'):_0x3bb5('0x52');agents[_0x2b3ed8[_0x3bb5('0x6')]][_0x3bb5('0xb')]='complete';utils['info'](util['format']('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x2b3ed8[_0x3bb5('0x6')],agents[_0x2b3ed8[_0x3bb5('0x6')]][_0x3bb5('0x19')],agents[_0x2b3ed8[_0x3bb5('0x6')]]['reason'],agents[_0x2b3ed8[_0x3bb5('0x6')]]['lastevent']));writeDB(agents[_0x2b3ed8[_0x3bb5('0x6')]]);}}catch(_0xb3572){utils[_0x3bb5('0x1a')](util[_0x3bb5('0x4')](_0x3bb5('0x4e'),_0x2b3ed8[_0x3bb5('0x6')]),_0xb3572);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index c19f3f4..a294d0e 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 _0xf623=['CreateVoiceCallReport','newchannel','debug','[%s][calls][newchannel]','linkedid','context','exten','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','ANSWERED','[%s][calls][hangup]','callerid','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','duration','diffTime','starttime','billableseconds','endtime','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','secondtransfererchannel','userfield','transfertargetchannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfererchannel','_attended','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstartAt','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstop]','mohtime','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','xmd-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','type','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','split','lastIndexOf','includes','hangup','noop','execif','util','./utils','FAILED','NO\x20ANSWER','BUSY','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','UserId','request'];(function(_0x565a40,_0x417e53){var _0x4e1e62=function(_0x1bc2d1){while(--_0x1bc2d1){_0x565a40['push'](_0x565a40['shift']());}};_0x4e1e62(++_0x417e53);}(_0xf623,0x1f4));var _0x3f62=function(_0x40e695,_0x366877){_0x40e695=_0x40e695-0x0;var _0x55a70e=_0xf623[_0x40e695];return _0x55a70e;};'use strict';var _=require('lodash');var util=require(_0x3f62('0x0'));var utils=require(_0x3f62('0x1'));var dispositions=['NO\x20ANSWER',_0x3f62('0x2'),'FAILED',_0x3f62('0x3'),_0x3f62('0x3'),'NO\x20ANSWER','ANSWERED',_0x3f62('0x4'),_0x3f62('0x2'),_0x3f62('0x2'),_0x3f62('0x2')];var channels={};function writeDB(_0x528f84){utils[_0x3f62('0x5')](util[_0x3f62('0x6')](_0x3f62('0x7'),_0x528f84[_0x3f62('0x8')],_0x528f84[_0x3f62('0x9')],_0x528f84[_0x3f62('0xa')],_0x528f84[_0x3f62('0xb')],_0x528f84[_0x3f62('0xc')],_0x528f84[_0x3f62('0xd')],_0x528f84[_0x3f62('0xe')],_0x528f84[_0x3f62('0xf')]));if(_0x528f84[_0x3f62('0x10')]){utils[_0x3f62('0x11')](_0x528f84[_0x3f62('0x10')])['then'](function(_0x324ba7){if(_0x324ba7){_0x528f84[_0x3f62('0x12')]=_0x324ba7['id'];}utils[_0x3f62('0x13')](_0x3f62('0x14'),_0x528f84);});}else{utils[_0x3f62('0x13')]('CreateVoiceCallReport',_0x528f84);}if(channels[_0x528f84[_0x3f62('0x8')]]){delete channels[_0x528f84[_0x3f62('0x8')]];}}exports[_0x3f62('0x15')]=function(_0x30668e){try{utils[_0x3f62('0x16')](util[_0x3f62('0x6')](_0x3f62('0x17'),_0x30668e[_0x3f62('0x8')]),_0x30668e);if(_0x30668e[_0x3f62('0x8')]==_0x30668e[_0x3f62('0x18')]&&_0x30668e[_0x3f62('0x9')]!='OutgoingSpoolFailed'){utils[_0x3f62('0x5')](util[_0x3f62('0x6')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x30668e[_0x3f62('0x8')],_0x30668e[_0x3f62('0x19')],_0x30668e[_0x3f62('0x1a')]));channels[_0x30668e[_0x3f62('0x8')]]={'uniqueid':_0x30668e[_0x3f62('0x8')],'accountcode':_0x30668e['accountcode'],'source':_0x30668e['calleridnum'],'destination':_0x30668e[_0x3f62('0x1a')],'destinationcontext':_0x30668e[_0x3f62('0x19')],'channel':_0x30668e[_0x3f62('0x9')],'starttime':utils[_0x3f62('0x1b')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x3f62('0x3'),'amaflags':_0x3f62('0x1c')};}}catch(_0x2b5bd6){utils[_0x3f62('0x1d')](util['format'](_0x3f62('0x17'),_0x30668e['uniqueid']),_0x2b5bd6);}};exports[_0x3f62('0x1e')]=function(_0x2f2994){try{utils[_0x3f62('0x16')](util[_0x3f62('0x6')](_0x3f62('0x1f'),_0x2f2994[_0x3f62('0x8')]),_0x2f2994);if(!_[_0x3f62('0x20')](channels[_0x2f2994[_0x3f62('0x8')]])&&_0x2f2994[_0x3f62('0x21')]==0x6){utils[_0x3f62('0x5')](util[_0x3f62('0x6')](_0x3f62('0x22'),_0x2f2994[_0x3f62('0x8')],_0x2f2994['context'],_0x2f2994[_0x3f62('0x9')]));if(_['isNil'](channels[_0x2f2994[_0x3f62('0x8')]][_0x3f62('0x23')])){channels[_0x2f2994['uniqueid']][_0x3f62('0x23')]=utils[_0x3f62('0x1b')]();}}else if(!_['isNil'](channels[_0x2f2994[_0x3f62('0x18')]])&&_0x2f2994['channelstate']==0x6&&_0x2f2994['context']!=_0x3f62('0x24')){utils['info'](util['format'](_0x3f62('0x25'),_0x2f2994[_0x3f62('0x8')],_0x2f2994['linkedid'],_0x2f2994[_0x3f62('0x19')],_0x2f2994[_0x3f62('0x9')]));channels[_0x2f2994[_0x3f62('0x18')]][_0x3f62('0x10')]=_0x2f2994[_0x3f62('0x10')];channels[_0x2f2994['linkedid']][_0x3f62('0x26')]=_0x2f2994[_0x3f62('0x9')];if(_[_0x3f62('0x20')](channels[_0x2f2994[_0x3f62('0x18')]][_0x3f62('0x27')])){channels[_0x2f2994[_0x3f62('0x18')]][_0x3f62('0x27')]=utils[_0x3f62('0x1b')]();}channels[_0x2f2994[_0x3f62('0x18')]][_0x3f62('0x28')]=dispositions[_['toNumber'](_0x2f2994[_0x3f62('0x21')])]||_0x3f62('0x29');}}catch(_0x125222){utils[_0x3f62('0x1d')](util[_0x3f62('0x6')](_0x3f62('0x1f'),_0x2f2994[_0x3f62('0x8')]),_0x125222);}};exports['hangup']=function(_0xb07eeb){try{if(!_['isNil'](channels[_0xb07eeb['uniqueid']])){utils[_0x3f62('0x16')](util[_0x3f62('0x6')](_0x3f62('0x2a'),_0xb07eeb[_0x3f62('0x8')]),_0xb07eeb);if(_[_0x3f62('0x20')](channels[_0xb07eeb[_0x3f62('0x8')]][_0x3f62('0x2b')])){channels[_0xb07eeb[_0x3f62('0x8')]][_0x3f62('0x2b')]=_0xb07eeb['calleridname']+'\x20<'+_0xb07eeb[_0x3f62('0xd')]+'>';}utils['info'](util['format'](_0x3f62('0x2c'),_0xb07eeb['uniqueid'],channels[_0xb07eeb['uniqueid']][_0x3f62('0x2b')],_0xb07eeb[_0x3f62('0x2d')]));channels[_0xb07eeb[_0x3f62('0x8')]]['endtime']=utils[_0x3f62('0x1b')]();channels[_0xb07eeb[_0x3f62('0x8')]][_0x3f62('0x2e')]=utils[_0x3f62('0x2f')](channels[_0xb07eeb[_0x3f62('0x8')]]['endtime'],channels[_0xb07eeb['uniqueid']][_0x3f62('0x30')]);channels[_0xb07eeb['uniqueid']][_0x3f62('0x31')]=channels[_0xb07eeb[_0x3f62('0x8')]][_0x3f62('0x27')]?utils[_0x3f62('0x2f')](channels[_0xb07eeb[_0x3f62('0x8')]][_0x3f62('0x32')],channels[_0xb07eeb[_0x3f62('0x8')]]['answertime']):0x0;writeDB(channels[_0xb07eeb[_0x3f62('0x8')]]);}}catch(_0x4fc5ca){utils[_0x3f62('0x1d')](util[_0x3f62('0x6')]('[%s][calls][hangup]',_0xb07eeb['uniqueid']),_0x4fc5ca);}};exports[_0x3f62('0x33')]=function(_0x168d8a){try{if(!_[_0x3f62('0x20')](channels[_0x168d8a[_0x3f62('0x34')]])){utils['debug'](util['format'](_0x3f62('0x35'),_0x168d8a[_0x3f62('0x36')]),_0x168d8a);if(channels[_0x168d8a[_0x3f62('0x34')]][_0x3f62('0x9')]==_0x168d8a[_0x3f62('0x37')]){utils[_0x3f62('0x5')](util[_0x3f62('0x6')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x168d8a[_0x3f62('0x36')],_0x168d8a['localtwolinkedid'],_0x168d8a[_0x3f62('0x38')]));channels[_0x168d8a['localtwolinkedid']][_0x3f62('0x26')]=_0x168d8a[_0x3f62('0x38')];channels[_0x168d8a[_0x3f62('0x34')]][_0x3f62('0x39')]='_attended';}else if(channels[_0x168d8a[_0x3f62('0x34')]][_0x3f62('0x9')]=_0x168d8a[_0x3f62('0x3a')]){utils[_0x3f62('0x5')](util['format'](_0x3f62('0x3b'),_0x168d8a[_0x3f62('0x36')],_0x168d8a[_0x3f62('0x34')],_0x168d8a[_0x3f62('0x3c')]));channels[_0x168d8a[_0x3f62('0x34')]]['destinationchannel']=_0x168d8a['origtransfererchannel'];channels[_0x168d8a['localtwolinkedid']][_0x3f62('0x39')]=_0x3f62('0x3d');}}}catch(_0x37acd0){utils[_0x3f62('0x1d')](util[_0x3f62('0x6')](_0x3f62('0x35'),_0x168d8a[_0x3f62('0x36')]),_0x37acd0);}};exports['musiconholdstart']=function(_0x6de81f){try{if(!_[_0x3f62('0x20')](channels[_0x6de81f[_0x3f62('0x8')]])){utils['debug'](util[_0x3f62('0x6')]('[%s][calls][musiconholdstart]',_0x6de81f[_0x3f62('0x8')]),_0x6de81f);channels[_0x6de81f[_0x3f62('0x8')]]['musiconholdstartAt']=utils['now']();utils[_0x3f62('0x5')](util[_0x3f62('0x6')](_0x3f62('0x3e'),_0x6de81f[_0x3f62('0x8')],channels[_0x6de81f[_0x3f62('0x8')]][_0x3f62('0x3f')]));}}catch(_0x5c4db1){utils[_0x3f62('0x1d')](util[_0x3f62('0x6')](_0x3f62('0x40'),_0x6de81f[_0x3f62('0x8')]),_0x5c4db1);}};exports['musiconholdstop']=function(_0x3923f3){try{if(!_[_0x3f62('0x20')](channels[_0x3923f3['uniqueid']])){utils['debug'](util[_0x3f62('0x6')](_0x3f62('0x41'),_0x3923f3[_0x3f62('0x8')]),_0x3923f3);if(!_[_0x3f62('0x20')](channels[_0x3923f3[_0x3f62('0x8')]]['musiconholdstartAt'])){channels[_0x3923f3[_0x3f62('0x8')]][_0x3f62('0x42')]+=utils[_0x3f62('0x2f')](utils['now'](),channels[_0x3923f3[_0x3f62('0x8')]][_0x3f62('0x3f')]);utils[_0x3f62('0x5')](util[_0x3f62('0x6')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x3923f3['uniqueid'],channels[_0x3923f3[_0x3f62('0x8')]][_0x3f62('0x42')]));delete channels[_0x3923f3['uniqueid']][_0x3f62('0x3f')];}}}catch(_0x17b219){utils[_0x3f62('0x1d')](util[_0x3f62('0x6')](_0x3f62('0x41'),_0x3923f3['uniqueid']),_0x17b219);}};exports['varset']=function(_0x266e99){try{if(!_[_0x3f62('0x20')](channels[_0x266e99[_0x3f62('0x8')]])){utils[_0x3f62('0x16')](util['format'](_0x3f62('0x43'),_0x266e99[_0x3f62('0x8')]),_0x266e99);if(!_[_0x3f62('0x20')](_0x266e99[_0x3f62('0x44')][_0x3f62('0x45')])){utils[_0x3f62('0x5')](util[_0x3f62('0x6')](_0x3f62('0x46'),_0x266e99[_0x3f62('0x8')],_0x266e99[_0x3f62('0x47')]));channels[_0x266e99[_0x3f62('0x8')]][_0x3f62('0x48')]=_0x266e99['value'];}if(!_['isNil'](_0x266e99[_0x3f62('0x44')][_0x3f62('0x49')])){utils['info'](util[_0x3f62('0x6')](_0x3f62('0x4a'),_0x266e99['uniqueid'],_0x266e99['value']));channels[_0x266e99['uniqueid']][_0x3f62('0x4b')]=_0x266e99[_0x3f62('0x47')];channels[_0x266e99[_0x3f62('0x8')]][_0x3f62('0x2b')]='\x22'+_0x266e99['value']+_0x3f62('0x4c')+_0x266e99[_0x3f62('0x47')]+'>';}if(!_['isNil'](_0x266e99[_0x3f62('0x44')][_0x3f62('0x4d')])||!_['isNil'](_0x266e99['variable'][_0x3f62('0x4e')])){utils['info'](util[_0x3f62('0x6')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x266e99['uniqueid'],!_['isNil'](_0x266e99[_0x3f62('0x44')]['xmd-callerid-preview'])?_0x3f62('0x4d'):'xmd-callerid',_0x266e99[_0x3f62('0x47')]));channels[_0x266e99[_0x3f62('0x8')]][_0x3f62('0x2b')]=_0x266e99[_0x3f62('0x47')];}if(!_[_0x3f62('0x20')](_0x266e99[_0x3f62('0x44')][_0x3f62('0x4f')])||!_[_0x3f62('0x20')](_0x266e99['variable']['xmcs-queue'])){utils['info'](util[_0x3f62('0x6')](_0x3f62('0x50'),_0x266e99['uniqueid'],!_['isNil'](_0x266e99['variable'][_0x3f62('0x4f')])?_0x3f62('0x4f'):_0x3f62('0x51'),_0x266e99[_0x3f62('0x47')]));channels[_0x266e99[_0x3f62('0x8')]][_0x3f62('0x52')]=_0x3f62('0x53');channels[_0x266e99[_0x3f62('0x8')]][_0x3f62('0x54')]=_0x266e99[_0x3f62('0x47')];channels[_0x266e99[_0x3f62('0x8')]]['queue']=!![];}if(!_['isNil'](_0x266e99[_0x3f62('0x44')][_0x3f62('0x55')])){utils[_0x3f62('0x5')](util[_0x3f62('0x6')](_0x3f62('0x56'),_0x266e99[_0x3f62('0x8')],_0x266e99[_0x3f62('0x47')]));channels[_0x266e99[_0x3f62('0x8')]][_0x3f62('0x57')]=_0x266e99['value'];}if(!_[_0x3f62('0x20')](_0x266e99[_0x3f62('0x44')]['xmd-cdrtype'])){utils[_0x3f62('0x5')](util[_0x3f62('0x6')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x266e99[_0x3f62('0x8')],_0x266e99[_0x3f62('0x47')]));channels[_0x266e99['uniqueid']][_0x3f62('0x58')]=_0x266e99['value'];}if(!_[_0x3f62('0x20')](_0x266e99[_0x3f62('0x44')]['outboundrouteid'])){utils['info'](util[_0x3f62('0x6')](_0x3f62('0x59'),_0x266e99[_0x3f62('0x8')],_0x266e99[_0x3f62('0x47')]));channels[_0x266e99['uniqueid']][_0x3f62('0x5a')]=_0x266e99[_0x3f62('0x47')];}if(!_[_0x3f62('0x20')](_0x266e99['variable'][_0x3f62('0x5b')])){utils[_0x3f62('0x5')](util[_0x3f62('0x6')](_0x3f62('0x5c'),_0x266e99[_0x3f62('0x8')],_0x266e99[_0x3f62('0x47')]));channels[_0x266e99['uniqueid']][_0x3f62('0x5b')]=_0x266e99[_0x3f62('0x47')];}}}catch(_0x214218){utils[_0x3f62('0x1d')](util[_0x3f62('0x6')](_0x3f62('0x43'),_0x266e99[_0x3f62('0x8')]),_0x214218);}};exports['newexten']=function(_0x3a9fee){try{if(!_[_0x3f62('0x20')](channels[_0x3a9fee[_0x3f62('0x8')]])){utils['debug'](util[_0x3f62('0x6')](_0x3f62('0x5d'),_0x3a9fee['uniqueid']),_0x3a9fee);utils[_0x3f62('0x5')](util[_0x3f62('0x6')](_0x3f62('0x5e'),_0x3a9fee['uniqueid'],_0x3a9fee[_0x3f62('0x5f')],_0x3a9fee[_0x3f62('0x60')]));if(_0x3a9fee[_0x3f62('0x5f')]['toLowerCase']()==_0x3f62('0x61')&&_['startsWith'](_0x3a9fee[_0x3f62('0x60')]['toLowerCase'](),'cdr')){var _0x365905=_0x3a9fee['appdata'][_0x3f62('0x62')]('=');var _0x281078=_0x365905[0x0]['substring'](_0x365905[0x0][_0x3f62('0x63')]('(')+0x1,_0x365905[0x0]['lastIndexOf'](')'));var _0x1b8dce=_0x365905[0x1];channels[_0x3a9fee[_0x3f62('0x8')]][_0x281078]=_0x1b8dce;}if(!_[_0x3f62('0x64')]([_0x3f62('0x65'),_0x3f62('0x66'),_0x3f62('0x67'),_0x3f62('0x61'),'gotoif'],_0x3a9fee['application']['toLowerCase']())){channels[_0x3a9fee[_0x3f62('0x8')]][_0x3f62('0x52')]=_0x3a9fee['application'];channels[_0x3a9fee[_0x3f62('0x8')]][_0x3f62('0x54')]=_0x3a9fee['appdata'];}}}catch(_0x4def4e){utils[_0x3f62('0x1d')](util[_0x3f62('0x6')](_0x3f62('0x5d'),_0x3a9fee[_0x3f62('0x8')]),_0x4def4e);}}; \ No newline at end of file +var _0x4089=['appdata','split','lastIndexOf','includes','noop','execif','gotoif','lodash','util','./utils','FAILED','NO\x20ANSWER','ANSWERED','BUSY','info','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','connectedlinenum','getUserByInternal','accountcode','then','UserId','request','CreateVoiceCallReport','newchannel','format','[%s][calls][newchannel]','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','calleridnum','exten','context','now','DOCUMENTATION','debug','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','linkedid','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','error','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','starttime','billableseconds','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','value','xmd-callerid','xmd-callerid-preview','xmd-queue','xmcs-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','type','outboundrouteid','routeid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','sipcallid','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','cdr'];(function(_0x392a4b,_0x3116ae){var _0x17c077=function(_0x3a5fc1){while(--_0x3a5fc1){_0x392a4b['push'](_0x392a4b['shift']());}};_0x17c077(++_0x3116ae);}(_0x4089,0xdd));var _0x9408=function(_0x26ac05,_0x5beb9d){_0x26ac05=_0x26ac05-0x0;var _0x2a09c4=_0x4089[_0x26ac05];return _0x2a09c4;};'use strict';var _=require(_0x9408('0x0'));var util=require(_0x9408('0x1'));var utils=require(_0x9408('0x2'));var dispositions=['NO\x20ANSWER',_0x9408('0x3'),_0x9408('0x3'),'NO\x20ANSWER','NO\x20ANSWER',_0x9408('0x4'),_0x9408('0x5'),_0x9408('0x6'),'FAILED','FAILED','FAILED'];var channels={};function writeDB(_0x37f454){utils[_0x9408('0x7')](util['format'](_0x9408('0x8'),_0x37f454[_0x9408('0x9')],_0x37f454[_0x9408('0xa')],_0x37f454[_0x9408('0xb')],_0x37f454[_0x9408('0xc')],_0x37f454[_0x9408('0xd')],_0x37f454['calleridnum'],_0x37f454[_0x9408('0xe')],_0x37f454['lastevent']));if(_0x37f454['accountcode']){utils[_0x9408('0xf')](_0x37f454[_0x9408('0x10')])[_0x9408('0x11')](function(_0x571aea){if(_0x571aea){_0x37f454[_0x9408('0x12')]=_0x571aea['id'];}utils[_0x9408('0x13')](_0x9408('0x14'),_0x37f454);});}else{utils[_0x9408('0x13')]('CreateVoiceCallReport',_0x37f454);}if(channels[_0x37f454[_0x9408('0x9')]]){delete channels[_0x37f454[_0x9408('0x9')]];}}exports[_0x9408('0x15')]=function(_0x112031){try{utils['debug'](util[_0x9408('0x16')](_0x9408('0x17'),_0x112031[_0x9408('0x9')]),_0x112031);if(_0x112031[_0x9408('0x9')]==_0x112031['linkedid']&&_0x112031[_0x9408('0xa')]!=_0x9408('0x18')){utils['info'](util[_0x9408('0x16')](_0x9408('0x19'),_0x112031[_0x9408('0x9')],_0x112031['context'],_0x112031['exten']));channels[_0x112031[_0x9408('0x9')]]={'uniqueid':_0x112031[_0x9408('0x9')],'accountcode':_0x112031[_0x9408('0x10')],'source':_0x112031[_0x9408('0x1a')],'destination':_0x112031[_0x9408('0x1b')],'destinationcontext':_0x112031[_0x9408('0x1c')],'channel':_0x112031['channel'],'starttime':utils[_0x9408('0x1d')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x9408('0x4'),'amaflags':_0x9408('0x1e')};}}catch(_0x44fbec){utils['error'](util['format'](_0x9408('0x17'),_0x112031[_0x9408('0x9')]),_0x44fbec);}};exports['newstate']=function(_0x531051){try{utils[_0x9408('0x1f')](util[_0x9408('0x16')](_0x9408('0x20'),_0x531051[_0x9408('0x9')]),_0x531051);if(!_[_0x9408('0x21')](channels[_0x531051['uniqueid']])&&_0x531051[_0x9408('0x22')]==0x6){utils[_0x9408('0x7')](util[_0x9408('0x16')](_0x9408('0x23'),_0x531051[_0x9408('0x9')],_0x531051[_0x9408('0x1c')],_0x531051[_0x9408('0xa')]));if(_[_0x9408('0x21')](channels[_0x531051[_0x9408('0x9')]][_0x9408('0x24')])){channels[_0x531051[_0x9408('0x9')]][_0x9408('0x24')]=utils['now']();}}else if(!_['isNil'](channels[_0x531051[_0x9408('0x25')]])&&_0x531051['channelstate']==0x6&&_0x531051[_0x9408('0x1c')]!=_0x9408('0x26')){utils['info'](util[_0x9408('0x16')](_0x9408('0x27'),_0x531051[_0x9408('0x9')],_0x531051['linkedid'],_0x531051[_0x9408('0x1c')],_0x531051[_0x9408('0xa')]));channels[_0x531051[_0x9408('0x25')]][_0x9408('0x10')]=_0x531051[_0x9408('0x10')];channels[_0x531051[_0x9408('0x25')]][_0x9408('0x28')]=_0x531051[_0x9408('0xa')];if(_[_0x9408('0x21')](channels[_0x531051['linkedid']][_0x9408('0x29')])){channels[_0x531051[_0x9408('0x25')]]['answertime']=utils[_0x9408('0x1d')]();}channels[_0x531051[_0x9408('0x25')]][_0x9408('0x2a')]=dispositions[_[_0x9408('0x2b')](_0x531051[_0x9408('0x22')])]||_0x9408('0x5');}}catch(_0xc25b7){utils[_0x9408('0x2c')](util['format'](_0x9408('0x20'),_0x531051[_0x9408('0x9')]),_0xc25b7);}};exports[_0x9408('0x2d')]=function(_0x171796){try{if(!_[_0x9408('0x21')](channels[_0x171796[_0x9408('0x9')]])){utils[_0x9408('0x1f')](util[_0x9408('0x16')](_0x9408('0x2e'),_0x171796[_0x9408('0x9')]),_0x171796);if(_['isNil'](channels[_0x171796[_0x9408('0x9')]][_0x9408('0x2f')])){channels[_0x171796[_0x9408('0x9')]][_0x9408('0x2f')]=_0x171796[_0x9408('0x30')]+'\x20<'+_0x171796['calleridnum']+'>';}utils[_0x9408('0x7')](util[_0x9408('0x16')](_0x9408('0x31'),_0x171796['uniqueid'],channels[_0x171796[_0x9408('0x9')]][_0x9408('0x2f')],_0x171796[_0x9408('0x32')]));channels[_0x171796['uniqueid']][_0x9408('0x33')]=utils[_0x9408('0x1d')]();channels[_0x171796[_0x9408('0x9')]][_0x9408('0x34')]=utils[_0x9408('0x35')](channels[_0x171796[_0x9408('0x9')]][_0x9408('0x33')],channels[_0x171796[_0x9408('0x9')]][_0x9408('0x36')]);channels[_0x171796[_0x9408('0x9')]][_0x9408('0x37')]=channels[_0x171796['uniqueid']]['answertime']?utils[_0x9408('0x35')](channels[_0x171796[_0x9408('0x9')]][_0x9408('0x33')],channels[_0x171796['uniqueid']][_0x9408('0x29')]):0x0;writeDB(channels[_0x171796[_0x9408('0x9')]]);}}catch(_0x7a04d8){utils[_0x9408('0x2c')](util['format']('[%s][calls][hangup]',_0x171796['uniqueid']),_0x7a04d8);}};exports['attendedtransfer']=function(_0x14bb74){try{if(!_['isNil'](channels[_0x14bb74[_0x9408('0x38')]])){utils[_0x9408('0x1f')](util[_0x9408('0x16')](_0x9408('0x39'),_0x14bb74[_0x9408('0x3a')]),_0x14bb74);if(channels[_0x14bb74[_0x9408('0x38')]][_0x9408('0xa')]==_0x14bb74['transfereechannel']){utils['info'](util[_0x9408('0x16')](_0x9408('0x3b'),_0x14bb74[_0x9408('0x3a')],_0x14bb74[_0x9408('0x38')],_0x14bb74[_0x9408('0x3c')]));channels[_0x14bb74[_0x9408('0x38')]][_0x9408('0x28')]=_0x14bb74[_0x9408('0x3c')];channels[_0x14bb74[_0x9408('0x38')]][_0x9408('0x3d')]=_0x9408('0x3e');}else if(channels[_0x14bb74['localtwolinkedid']][_0x9408('0xa')]=_0x14bb74['transfertargetchannel']){utils['info'](util[_0x9408('0x16')](_0x9408('0x3b'),_0x14bb74[_0x9408('0x3a')],_0x14bb74['localtwolinkedid'],_0x14bb74[_0x9408('0x3f')]));channels[_0x14bb74[_0x9408('0x38')]][_0x9408('0x28')]=_0x14bb74[_0x9408('0x3f')];channels[_0x14bb74['localtwolinkedid']][_0x9408('0x3d')]=_0x9408('0x3e');}}}catch(_0x705e26){utils['error'](util[_0x9408('0x16')](_0x9408('0x39'),_0x14bb74['origtransfereruniqueid']),_0x705e26);}};exports[_0x9408('0x40')]=function(_0x3cd97a){try{if(!_[_0x9408('0x21')](channels[_0x3cd97a['uniqueid']])){utils[_0x9408('0x1f')](util['format'](_0x9408('0x41'),_0x3cd97a[_0x9408('0x9')]),_0x3cd97a);channels[_0x3cd97a['uniqueid']][_0x9408('0x42')]=utils[_0x9408('0x1d')]();utils[_0x9408('0x7')](util['format'](_0x9408('0x43'),_0x3cd97a[_0x9408('0x9')],channels[_0x3cd97a[_0x9408('0x9')]][_0x9408('0x42')]));}}catch(_0x2a9eea){utils[_0x9408('0x2c')](util[_0x9408('0x16')](_0x9408('0x41'),_0x3cd97a[_0x9408('0x9')]),_0x2a9eea);}};exports[_0x9408('0x44')]=function(_0x1d026e){try{if(!_['isNil'](channels[_0x1d026e[_0x9408('0x9')]])){utils['debug'](util[_0x9408('0x16')](_0x9408('0x45'),_0x1d026e[_0x9408('0x9')]),_0x1d026e);if(!_[_0x9408('0x21')](channels[_0x1d026e['uniqueid']]['musiconholdstartAt'])){channels[_0x1d026e[_0x9408('0x9')]][_0x9408('0x46')]+=utils[_0x9408('0x35')](utils[_0x9408('0x1d')](),channels[_0x1d026e[_0x9408('0x9')]][_0x9408('0x42')]);utils[_0x9408('0x7')](util[_0x9408('0x16')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x1d026e['uniqueid'],channels[_0x1d026e[_0x9408('0x9')]][_0x9408('0x46')]));delete channels[_0x1d026e[_0x9408('0x9')]][_0x9408('0x42')];}}}catch(_0xdc9efd){utils[_0x9408('0x2c')](util[_0x9408('0x16')](_0x9408('0x45'),_0x1d026e[_0x9408('0x9')]),_0xdc9efd);}};exports[_0x9408('0x47')]=function(_0x508595){try{if(!_['isNil'](channels[_0x508595[_0x9408('0x9')]])){utils[_0x9408('0x1f')](util['format'](_0x9408('0x48'),_0x508595[_0x9408('0x9')]),_0x508595);if(!_['isNil'](_0x508595[_0x9408('0x49')][_0x9408('0x4a')])){utils['info'](util['format']('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x508595[_0x9408('0x9')],_0x508595[_0x9408('0x4b')]));channels[_0x508595[_0x9408('0x9')]]['source']=_0x508595[_0x9408('0x4b')];}if(!_['isNil'](_0x508595[_0x9408('0x49')]['xmd-phone'])){utils['info'](util[_0x9408('0x16')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x508595[_0x9408('0x9')],_0x508595[_0x9408('0x4b')]));channels[_0x508595[_0x9408('0x9')]]['destination']=_0x508595[_0x9408('0x4b')];channels[_0x508595['uniqueid']][_0x9408('0x2f')]='\x22'+_0x508595[_0x9408('0x4b')]+'\x22\x20<'+_0x508595[_0x9408('0x4b')]+'>';}if(!_[_0x9408('0x21')](_0x508595[_0x9408('0x49')]['xmd-callerid-preview'])||!_[_0x9408('0x21')](_0x508595['variable'][_0x9408('0x4c')])){utils[_0x9408('0x7')](util[_0x9408('0x16')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x508595[_0x9408('0x9')],!_['isNil'](_0x508595['variable'][_0x9408('0x4d')])?_0x9408('0x4d'):_0x9408('0x4c'),_0x508595['value']));channels[_0x508595[_0x9408('0x9')]][_0x9408('0x2f')]=_0x508595[_0x9408('0x4b')];}if(!_['isNil'](_0x508595[_0x9408('0x49')][_0x9408('0x4e')])||!_[_0x9408('0x21')](_0x508595['variable'][_0x9408('0x4f')])){utils[_0x9408('0x7')](util['format'](_0x9408('0x50'),_0x508595[_0x9408('0x9')],!_['isNil'](_0x508595['variable'][_0x9408('0x4e')])?_0x9408('0x4e'):_0x9408('0x4f'),_0x508595[_0x9408('0x4b')]));channels[_0x508595[_0x9408('0x9')]][_0x9408('0x51')]=_0x9408('0x52');channels[_0x508595[_0x9408('0x9')]][_0x9408('0x53')]=_0x508595['value'];channels[_0x508595[_0x9408('0x9')]][_0x9408('0xb')]=!![];}if(!_['isNil'](_0x508595[_0x9408('0x49')][_0x9408('0x54')])){utils[_0x9408('0x7')](util[_0x9408('0x16')](_0x9408('0x55'),_0x508595[_0x9408('0x9')],_0x508595['value']));channels[_0x508595[_0x9408('0x9')]][_0x9408('0x56')]=_0x508595['value'];}if(!_[_0x9408('0x21')](_0x508595['variable'][_0x9408('0x57')])){utils['info'](util[_0x9408('0x16')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x508595[_0x9408('0x9')],_0x508595['value']));channels[_0x508595[_0x9408('0x9')]][_0x9408('0x58')]=_0x508595[_0x9408('0x4b')];}if(!_[_0x9408('0x21')](_0x508595[_0x9408('0x49')][_0x9408('0x59')])){utils[_0x9408('0x7')](util['format']('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x508595[_0x9408('0x9')],_0x508595[_0x9408('0x4b')]));channels[_0x508595[_0x9408('0x9')]][_0x9408('0x5a')]=_0x508595[_0x9408('0x4b')];}if(!_[_0x9408('0x21')](_0x508595[_0x9408('0x49')]['sipcallid'])){utils[_0x9408('0x7')](util['format'](_0x9408('0x5b'),_0x508595[_0x9408('0x9')],_0x508595['value']));channels[_0x508595[_0x9408('0x9')]][_0x9408('0x5c')]=_0x508595[_0x9408('0x4b')];}}}catch(_0x2d9b9b){utils['error'](util['format'](_0x9408('0x48'),_0x508595[_0x9408('0x9')]),_0x2d9b9b);}};exports['newexten']=function(_0x3c2bea){try{if(!_['isNil'](channels[_0x3c2bea['uniqueid']])){utils[_0x9408('0x1f')](util[_0x9408('0x16')](_0x9408('0x5d'),_0x3c2bea[_0x9408('0x9')]),_0x3c2bea);utils[_0x9408('0x7')](util['format'](_0x9408('0x5e'),_0x3c2bea[_0x9408('0x9')],_0x3c2bea[_0x9408('0x5f')],_0x3c2bea['appdata']));if(_0x3c2bea[_0x9408('0x5f')][_0x9408('0x60')]()==_0x9408('0x61')&&_[_0x9408('0x62')](_0x3c2bea['appdata'][_0x9408('0x60')](),_0x9408('0x63'))){var _0x3f1067=_0x3c2bea[_0x9408('0x64')][_0x9408('0x65')]('=');var _0x52b84d=_0x3f1067[0x0]['substring'](_0x3f1067[0x0][_0x9408('0x66')]('(')+0x1,_0x3f1067[0x0]['lastIndexOf'](')'));var _0x3f60a1=_0x3f1067[0x1];channels[_0x3c2bea[_0x9408('0x9')]][_0x52b84d]=_0x3f60a1;}if(!_[_0x9408('0x67')]([_0x9408('0x2d'),_0x9408('0x68'),_0x9408('0x69'),'set',_0x9408('0x6a')],_0x3c2bea[_0x9408('0x5f')]['toLowerCase']())){channels[_0x3c2bea[_0x9408('0x9')]][_0x9408('0x51')]=_0x3c2bea[_0x9408('0x5f')];channels[_0x3c2bea[_0x9408('0x9')]][_0x9408('0x53')]=_0x3c2bea[_0x9408('0x64')];}}}catch(_0x15c1ed){utils[_0x9408('0x2c')](util['format']('[%s][calls][newexten]',_0x3c2bea[_0x9408('0x9')]),_0x15c1ed);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 958e07b..e419fa0 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 _0x37a2=['connect','[core]\x20connected','shutdown','fullybooted','info','[core]\x20fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent','./utils'];(function(_0x169dff,_0x57be0){var _0x91cf22=function(_0x527498){while(--_0x527498){_0x169dff['push'](_0x169dff['shift']());}};_0x91cf22(++_0x57be0);}(_0x37a2,0xe3));var _0x237a=function(_0x10ea5f,_0xca64dc){_0x10ea5f=_0x10ea5f-0x0;var _0x95532e=_0x37a2[_0x10ea5f];return _0x95532e;};'use strict';var utils=require(_0x237a('0x0'));exports[_0x237a('0x1')]=function(){utils['info'](_0x237a('0x2'));};exports[_0x237a('0x3')]=function(){utils['info']('[core]\x20shutdown');};exports[_0x237a('0x4')]=function(){utils[_0x237a('0x5')](_0x237a('0x6'));};exports[_0x237a('0x7')]=function(_0x13c483){utils[_0x237a('0x7')](_0x237a('0x8'),_0x13c483);};exports[_0x237a('0x9')]=function(){utils[_0x237a('0x5')](_0x237a('0xa'));};exports[_0x237a('0xb')]=function(_0x479303){}; \ No newline at end of file +var _0x4afd=['fullybooted','info','[core]\x20fullybooted','error','[core]\x20error','close','[core]\x20close','./utils','connect','[core]\x20connected','[core]\x20shutdown'];(function(_0x2d0669,_0x2a9c6e){var _0x1712e4=function(_0x4267fc){while(--_0x4267fc){_0x2d0669['push'](_0x2d0669['shift']());}};_0x1712e4(++_0x2a9c6e);}(_0x4afd,0x75));var _0xd4af=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x4afd[_0x2b4411];return _0x8e41ef;};'use strict';var utils=require(_0xd4af('0x0'));exports[_0xd4af('0x1')]=function(){utils['info'](_0xd4af('0x2'));};exports['shutdown']=function(){utils['info'](_0xd4af('0x3'));};exports[_0xd4af('0x4')]=function(){utils[_0xd4af('0x5')](_0xd4af('0x6'));};exports[_0xd4af('0x7')]=function(_0x20e077){utils[_0xd4af('0x7')](_0xd4af('0x8'),_0x20e077);};exports[_0xd4af('0x9')]=function(){utils[_0xd4af('0x5')](_0xd4af('0xa'));};exports['managerevent']=function(_0x5a212d){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 0b3fb9e..2007743 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 _0x9147=['[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','starttime','dialend','ANSWER','assign','answertime','now','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][dialend]','hangup','[%s][dials][hangup]','calleridname','cause-txt','complete','diffTime','holdtime','endtime','billableseconds','lodash','util','./utils','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','calleridnum','connectedlinenum','dialstatus','request','debug','[%s][dials][newexten]','info','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','toLowerCase','split','error','varset','[%s][dials][varset]','isNil','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','lastevent','called'];(function(_0x25a857,_0x3a8373){var _0x1866a8=function(_0x5cdf9e){while(--_0x5cdf9e){_0x25a857['push'](_0x25a857['shift']());}};_0x1866a8(++_0x3a8373);}(_0x9147,0x1a4));var _0x7914=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0x9147[_0x2bf141];return _0x48277b;};'use strict';var _=require(_0x7914('0x0'));var util=require(_0x7914('0x1'));var utils=require(_0x7914('0x2'));var dials={};function writeDB(_0x91fda7){utils['info'](util[_0x7914('0x3')](_0x7914('0x4'),_0x91fda7[_0x7914('0x5')],_0x91fda7[_0x7914('0x6')],_0x91fda7['dialstring'],_0x91fda7[_0x7914('0x7')],_0x91fda7[_0x7914('0x8')],_0x91fda7[_0x7914('0x9')]));utils[_0x7914('0xa')]('CreateVoiceDialReport',_0x91fda7);delete dials[_0x91fda7[_0x7914('0x5')]];}exports['newexten']=function(_0x3e629e){try{utils[_0x7914('0xb')](util[_0x7914('0x3')](_0x7914('0xc'),_0x3e629e[_0x7914('0x5')]),_0x3e629e);utils[_0x7914('0xd')](util[_0x7914('0x3')](_0x7914('0xe'),_0x3e629e[_0x7914('0x5')],_0x3e629e[_0x7914('0xf')],_0x3e629e[_0x7914('0x10')]));if(_0x3e629e[_0x7914('0xf')]['toLowerCase']()==_0x7914('0x11')&&_['startsWith'](_0x3e629e[_0x7914('0x10')][_0x7914('0x12')](),'cdr(routeid)')){var _0x210ce1=_0x3e629e[_0x7914('0x10')][_0x7914('0x13')]('=');dials[_0x3e629e[_0x7914('0x5')]]={'routeId':_0x210ce1[0x1]};}}catch(_0x36fb94){utils[_0x7914('0x14')](util[_0x7914('0x3')](_0x7914('0xc'),_0x3e629e[_0x7914('0x5')]),_0x36fb94);}};exports[_0x7914('0x15')]=function(_0x398b62){try{utils[_0x7914('0xb')](util[_0x7914('0x3')](_0x7914('0x16'),_0x398b62[_0x7914('0x5')]),_0x398b62);if(!_[_0x7914('0x17')](_0x398b62['variable'][_0x7914('0x18')])){utils[_0x7914('0xd')](util[_0x7914('0x3')](_0x7914('0x19'),_0x398b62['uniqueid'],_0x398b62[_0x7914('0x1a')]));dials[_0x398b62[_0x7914('0x5')]]={'routeId':_0x398b62[_0x7914('0x1a')]};}}catch(_0x3ac6fc){utils['error'](util[_0x7914('0x3')](_0x7914('0x16'),_0x398b62[_0x7914('0x5')]),_0x3ac6fc);}};exports[_0x7914('0x1b')]=function(_0x4a626a){try{if(!_[_0x7914('0x17')](dials[_0x4a626a[_0x7914('0x5')]])){utils[_0x7914('0xb')](util[_0x7914('0x3')]('[%s][dials][dialbegin]',_0x4a626a[_0x7914('0x5')]),_0x4a626a);dials[_0x4a626a[_0x7914('0x5')]]=_['assign'](dials[_0x4a626a[_0x7914('0x5')]],_0x4a626a);dials[_0x4a626a[_0x7914('0x5')]]['starttime']=utils['now']();dials[_0x4a626a['uniqueid']][_0x7914('0x1c')]=_0x7914('0x1d');utils[_0x7914('0xd')](util[_0x7914('0x3')](_0x7914('0x1e'),_0x4a626a[_0x7914('0x5')],dials[_0x4a626a[_0x7914('0x5')]][_0x7914('0x1f')]));}}catch(_0x1fcb39){utils['error'](util[_0x7914('0x3')]('[%s][dials][dialbegin]',_0x4a626a[_0x7914('0x5')]),_0x1fcb39);}};exports[_0x7914('0x20')]=function(_0x2ca68f){try{if(!_['isNil'](dials[_0x2ca68f[_0x7914('0x5')]])){utils[_0x7914('0xb')](util[_0x7914('0x3')]('[%s][dials][dialend]',_0x2ca68f['uniqueid']),_0x2ca68f);dials[_0x2ca68f['uniqueid']]['dialstatus']=_0x2ca68f['dialstatus'];if(_0x2ca68f['dialstatus']==_0x7914('0x21')){dials[_0x2ca68f[_0x7914('0x5')]]=_[_0x7914('0x22')](dials[_0x2ca68f[_0x7914('0x5')]],_0x2ca68f);dials[_0x2ca68f[_0x7914('0x5')]][_0x7914('0x23')]=utils[_0x7914('0x24')]();dials[_0x2ca68f[_0x7914('0x5')]][_0x7914('0x1c')]=_0x7914('0x25');utils[_0x7914('0xd')](util[_0x7914('0x3')](_0x7914('0x26'),_0x2ca68f[_0x7914('0x5')],_0x2ca68f[_0x7914('0x9')],dials[_0x2ca68f[_0x7914('0x5')]][_0x7914('0x23')]));}else{utils['info'](util[_0x7914('0x3')](_0x7914('0x27'),_0x2ca68f[_0x7914('0x5')],_0x2ca68f[_0x7914('0x9')]));}}}catch(_0x37d05b){utils[_0x7914('0x14')](util[_0x7914('0x3')](_0x7914('0x28'),_0x2ca68f['uniqueid']),_0x37d05b);}};exports[_0x7914('0x29')]=function(_0x3b5cf8){try{if(!_[_0x7914('0x17')](dials[_0x3b5cf8[_0x7914('0x5')]])){utils[_0x7914('0xb')](util['format'](_0x7914('0x2a'),_0x3b5cf8[_0x7914('0x5')]),_0x3b5cf8);utils[_0x7914('0xd')](util[_0x7914('0x3')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x3b5cf8['uniqueid'],_0x3b5cf8[_0x7914('0x7')],_0x3b5cf8[_0x7914('0x2b')],_0x3b5cf8[_0x7914('0x2c')]));dials[_0x3b5cf8[_0x7914('0x5')]]=_[_0x7914('0x22')](dials[_0x3b5cf8[_0x7914('0x5')]],{'endtime':utils[_0x7914('0x24')](),'lastevent':_0x7914('0x2d')});dials[_0x3b5cf8[_0x7914('0x5')]]['duration']=utils[_0x7914('0x2e')](dials[_0x3b5cf8['uniqueid']]['endtime'],dials[_0x3b5cf8[_0x7914('0x5')]][_0x7914('0x1f')]);dials[_0x3b5cf8[_0x7914('0x5')]][_0x7914('0x2f')]=utils['diffTime'](dials[_0x3b5cf8[_0x7914('0x5')]][_0x7914('0x23')]||dials[_0x3b5cf8[_0x7914('0x5')]][_0x7914('0x30')],dials[_0x3b5cf8[_0x7914('0x5')]][_0x7914('0x1f')]);dials[_0x3b5cf8[_0x7914('0x5')]][_0x7914('0x31')]=dials[_0x3b5cf8['uniqueid']][_0x7914('0x23')]?utils[_0x7914('0x2e')](dials[_0x3b5cf8[_0x7914('0x5')]][_0x7914('0x30')],dials[_0x3b5cf8[_0x7914('0x5')]][_0x7914('0x23')]):0x0;writeDB(dials[_0x3b5cf8[_0x7914('0x5')]]);}}catch(_0x429331){utils['error'](util[_0x7914('0x3')](_0x7914('0x2a'),_0x3b5cf8[_0x7914('0x5')]),_0x429331);}}; \ No newline at end of file +var _0x7158=['startsWith','toLowerCase','cdr(routeid)','split','error','varset','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','assign','starttime','lastevent','called','[%s][dials][dialend]','dialstatus','ANSWER','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','now','complete','duration','diffTime','endtime','billableseconds','[%s][dials][hangup]','lodash','util','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','dialstring','calleridnum','connectedlinenum','request','CreateVoiceDialReport','uniqueid','newexten','debug','[%s][dials][newexten]\x20application:%s\x20appdata:%s','appdata','set'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x7158,0x147));var _0x8715=function(_0x1e3671,_0x9ae4fc){_0x1e3671=_0x1e3671-0x0;var _0x48d5f5=_0x7158[_0x1e3671];return _0x48d5f5;};'use strict';var _=require(_0x8715('0x0'));var util=require(_0x8715('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x3105d3){utils[_0x8715('0x2')](util[_0x8715('0x3')](_0x8715('0x4'),_0x3105d3['uniqueid'],_0x3105d3['channel'],_0x3105d3[_0x8715('0x5')],_0x3105d3[_0x8715('0x6')],_0x3105d3[_0x8715('0x7')],_0x3105d3['dialstatus']));utils[_0x8715('0x8')](_0x8715('0x9'),_0x3105d3);delete dials[_0x3105d3[_0x8715('0xa')]];}exports[_0x8715('0xb')]=function(_0x5790a9){try{utils[_0x8715('0xc')](util[_0x8715('0x3')]('[%s][dials][newexten]',_0x5790a9[_0x8715('0xa')]),_0x5790a9);utils[_0x8715('0x2')](util[_0x8715('0x3')](_0x8715('0xd'),_0x5790a9[_0x8715('0xa')],_0x5790a9['application'],_0x5790a9[_0x8715('0xe')]));if(_0x5790a9['application']['toLowerCase']()==_0x8715('0xf')&&_[_0x8715('0x10')](_0x5790a9[_0x8715('0xe')][_0x8715('0x11')](),_0x8715('0x12'))){var _0x3d349f=_0x5790a9[_0x8715('0xe')][_0x8715('0x13')]('=');dials[_0x5790a9[_0x8715('0xa')]]={'routeId':_0x3d349f[0x1]};}}catch(_0x1b00c5){utils[_0x8715('0x14')](util['format']('[%s][dials][newexten]',_0x5790a9['uniqueid']),_0x1b00c5);}};exports[_0x8715('0x15')]=function(_0x11f9eb){try{utils[_0x8715('0xc')](util['format'](_0x8715('0x16'),_0x11f9eb['uniqueid']),_0x11f9eb);if(!_[_0x8715('0x17')](_0x11f9eb[_0x8715('0x18')][_0x8715('0x19')])){utils[_0x8715('0x2')](util[_0x8715('0x3')](_0x8715('0x1a'),_0x11f9eb[_0x8715('0xa')],_0x11f9eb['value']));dials[_0x11f9eb[_0x8715('0xa')]]={'routeId':_0x11f9eb[_0x8715('0x1b')]};}}catch(_0x4fc3c9){utils['error'](util[_0x8715('0x3')](_0x8715('0x16'),_0x11f9eb[_0x8715('0xa')]),_0x4fc3c9);}};exports[_0x8715('0x1c')]=function(_0x44c4d4){try{if(!_[_0x8715('0x17')](dials[_0x44c4d4[_0x8715('0xa')]])){utils[_0x8715('0xc')](util[_0x8715('0x3')](_0x8715('0x1d'),_0x44c4d4['uniqueid']),_0x44c4d4);dials[_0x44c4d4['uniqueid']]=_[_0x8715('0x1e')](dials[_0x44c4d4[_0x8715('0xa')]],_0x44c4d4);dials[_0x44c4d4[_0x8715('0xa')]][_0x8715('0x1f')]=utils['now']();dials[_0x44c4d4[_0x8715('0xa')]][_0x8715('0x20')]=_0x8715('0x21');utils[_0x8715('0x2')](util['format']('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x44c4d4[_0x8715('0xa')],dials[_0x44c4d4[_0x8715('0xa')]]['starttime']));}}catch(_0x315e1f){utils[_0x8715('0x14')](util['format'](_0x8715('0x1d'),_0x44c4d4['uniqueid']),_0x315e1f);}};exports['dialend']=function(_0x3214c3){try{if(!_['isNil'](dials[_0x3214c3[_0x8715('0xa')]])){utils[_0x8715('0xc')](util[_0x8715('0x3')](_0x8715('0x22'),_0x3214c3[_0x8715('0xa')]),_0x3214c3);dials[_0x3214c3['uniqueid']][_0x8715('0x23')]=_0x3214c3[_0x8715('0x23')];if(_0x3214c3[_0x8715('0x23')]==_0x8715('0x24')){dials[_0x3214c3['uniqueid']]=_['assign'](dials[_0x3214c3[_0x8715('0xa')]],_0x3214c3);dials[_0x3214c3[_0x8715('0xa')]][_0x8715('0x25')]=utils['now']();dials[_0x3214c3[_0x8715('0xa')]][_0x8715('0x20')]=_0x8715('0x26');utils[_0x8715('0x2')](util[_0x8715('0x3')](_0x8715('0x27'),_0x3214c3['uniqueid'],_0x3214c3[_0x8715('0x23')],dials[_0x3214c3['uniqueid']]['answertime']));}else{utils[_0x8715('0x2')](util[_0x8715('0x3')](_0x8715('0x28'),_0x3214c3[_0x8715('0xa')],_0x3214c3[_0x8715('0x23')]));}}}catch(_0x41f5bc){utils[_0x8715('0x14')](util[_0x8715('0x3')]('[%s][dials][dialend]',_0x3214c3[_0x8715('0xa')]),_0x41f5bc);}};exports[_0x8715('0x29')]=function(_0x3fe2c9){try{if(!_[_0x8715('0x17')](dials[_0x3fe2c9[_0x8715('0xa')]])){utils[_0x8715('0xc')](util[_0x8715('0x3')]('[%s][dials][hangup]',_0x3fe2c9[_0x8715('0xa')]),_0x3fe2c9);utils[_0x8715('0x2')](util[_0x8715('0x3')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x3fe2c9[_0x8715('0xa')],_0x3fe2c9[_0x8715('0x6')],_0x3fe2c9['calleridname'],_0x3fe2c9['cause-txt']));dials[_0x3fe2c9[_0x8715('0xa')]]=_['assign'](dials[_0x3fe2c9[_0x8715('0xa')]],{'endtime':utils[_0x8715('0x2a')](),'lastevent':_0x8715('0x2b')});dials[_0x3fe2c9['uniqueid']][_0x8715('0x2c')]=utils[_0x8715('0x2d')](dials[_0x3fe2c9[_0x8715('0xa')]][_0x8715('0x2e')],dials[_0x3fe2c9[_0x8715('0xa')]][_0x8715('0x1f')]);dials[_0x3fe2c9[_0x8715('0xa')]]['holdtime']=utils[_0x8715('0x2d')](dials[_0x3fe2c9[_0x8715('0xa')]][_0x8715('0x25')]||dials[_0x3fe2c9['uniqueid']][_0x8715('0x2e')],dials[_0x3fe2c9[_0x8715('0xa')]][_0x8715('0x1f')]);dials[_0x3fe2c9[_0x8715('0xa')]][_0x8715('0x2f')]=dials[_0x3fe2c9[_0x8715('0xa')]][_0x8715('0x25')]?utils[_0x8715('0x2d')](dials[_0x3fe2c9[_0x8715('0xa')]][_0x8715('0x2e')],dials[_0x3fe2c9[_0x8715('0xa')]]['answertime']):0x0;writeDB(dials[_0x3fe2c9['uniqueid']]);}}catch(_0x3c8c86){utils['error'](util['format'](_0x8715('0x30'),_0x3fe2c9[_0x8715('0xa')]),_0x3c8c86);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 9842f5f..7c4d0e7 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 _0x51b6=['connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','[%s][index][musiconholdstart]','musiconholdstart','musiconholdstop','[%s][index][musiconholdstop]','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','../../config/environment','util','xdr','disabled','env','production','local','asterisk','port','username','password','keepConnected','info','XDR\x20DISABLED','./queues.controller','./recordings.controller','./transfers.controller','./core.controller'];(function(_0x433cfe,_0x47ce1e){var _0x1843a8=function(_0x3685bb){while(--_0x3685bb){_0x433cfe['push'](_0x433cfe['shift']());}};_0x1843a8(++_0x47ce1e);}(_0x51b6,0x147));var _0x651b=function(_0x20e443,_0x45c3d6){_0x20e443=_0x20e443-0x0;var _0x5610f5=_0x51b6[_0x20e443];return _0x5610f5;};var AsteriskManager=require('asterisk-manager');var config=require(_0x651b('0x0'));var utils=require('./utils');var util=require(_0x651b('0x1'));var isXDREnabled=config[_0x651b('0x2')]&&config[_0x651b('0x2')][_0x651b('0x3')]?!config[_0x651b('0x2')][_0x651b('0x3')]:!![];var isProduction=config[_0x651b('0x4')]===_0x651b('0x5')||![];var isLocalAsterisk=config[_0x651b('0x2')]&&config['xdr'][_0x651b('0x6')]===!![]||![];var ami=new AsteriskManager(config[_0x651b('0x7')][_0x651b('0x8')],config[_0x651b('0x7')]['ip'],config['asterisk'][_0x651b('0x9')],config[_0x651b('0x7')][_0x651b('0xa')],!![]);ami[_0x651b('0xb')]();if(!isXDREnabled){utils[_0x651b('0xc')](_0x651b('0xd'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x651b('0xc')]('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require('./agents.controller');var calls=require('./calls.controller');var queues=require(_0x651b('0xe'));var recordings=require(_0x651b('0xf'));var members=require('./members.controller');var dials=require('./dials.controller');var transfers=require(_0x651b('0x10'));var core=require(_0x651b('0x11'));ami['on'](_0x651b('0x12'),core[_0x651b('0x12')]);ami['on'](_0x651b('0x13'),core[_0x651b('0x13')]);ami['on'](_0x651b('0x14'),core['fullybooted']);ami['on'](_0x651b('0x15'),core['error']);ami['on'](_0x651b('0x16'),core[_0x651b('0x16')]);ami['on'](_0x651b('0x17'),core[_0x651b('0x17')]);ami['on'](_0x651b('0x18'),function(_0x41a753){try{utils[_0x651b('0x19')](util[_0x651b('0x1a')](_0x651b('0x1b'),_0x41a753[_0x651b('0x1c')]),_0x41a753);members[_0x651b('0x18')](_0x41a753);}catch(_0x567914){utils['error'](util['format'](_0x651b('0x1b'),_0x41a753[_0x651b('0x1c')]),_0x567914);}});ami['on'](_0x651b('0x1d'),function(_0x2e5274){try{utils[_0x651b('0x19')](util[_0x651b('0x1a')](_0x651b('0x1e'),_0x2e5274[_0x651b('0x1f')]),_0x2e5274);agents['agentcalled'](_0x2e5274);}catch(_0x4efcd3){utils[_0x651b('0x15')](util[_0x651b('0x1a')](_0x651b('0x1e'),_0x2e5274['uniqueid']),_0x4efcd3);}});ami['on'](_0x651b('0x20'),function(_0x32d8c2){try{utils['debug'](util[_0x651b('0x1a')](_0x651b('0x21'),_0x32d8c2[_0x651b('0x1f')]),_0x32d8c2);agents[_0x651b('0x20')](_0x32d8c2);}catch(_0x2751b8){utils[_0x651b('0x15')](util[_0x651b('0x1a')](_0x651b('0x21'),_0x32d8c2['uniqueid']),_0x2751b8);}});ami['on'](_0x651b('0x22'),function(_0x46642e){try{utils[_0x651b('0x19')](util[_0x651b('0x1a')](_0x651b('0x23'),_0x46642e[_0x651b('0x1f')]),_0x46642e);agents[_0x651b('0x22')](_0x46642e);queues[_0x651b('0x22')](_0x46642e);}catch(_0x1b0f5c){utils[_0x651b('0x15')](util[_0x651b('0x1a')](_0x651b('0x23'),_0x46642e[_0x651b('0x1f')]),_0x1b0f5c);}});ami['on']('agentcomplete',function(_0x4bfd7f){try{utils[_0x651b('0x19')](util['format']('[%s][index][agentcomplete]',_0x4bfd7f[_0x651b('0x1f')]),_0x4bfd7f);agents[_0x651b('0x24')](_0x4bfd7f);queues[_0x651b('0x24')](_0x4bfd7f);members[_0x651b('0x24')](_0x4bfd7f);}catch(_0x30e9fd){utils[_0x651b('0x15')](util[_0x651b('0x1a')](_0x651b('0x25'),_0x4bfd7f[_0x651b('0x1f')]),_0x30e9fd);}});ami['on'](_0x651b('0x26'),function(_0x2a7020){try{utils[_0x651b('0x19')](util['format'](_0x651b('0x27'),_0x2a7020[_0x651b('0x1f')]),_0x2a7020);agents[_0x651b('0x26')](_0x2a7020);queues['queuecallerabandon'](_0x2a7020);}catch(_0xf65f5f){utils[_0x651b('0x15')](util[_0x651b('0x1a')](_0x651b('0x27'),_0x2a7020[_0x651b('0x1f')]),_0xf65f5f);}});ami['on'](_0x651b('0x28'),function(_0x36ba08){try{utils[_0x651b('0x19')](util['format'](_0x651b('0x29'),_0x36ba08[_0x651b('0x1f')]),_0x36ba08);queues[_0x651b('0x28')](_0x36ba08);recordings[_0x651b('0x28')](_0x36ba08);}catch(_0x4a1c7d){utils['error'](util[_0x651b('0x1a')](_0x651b('0x29'),_0x36ba08[_0x651b('0x1f')]),_0x4a1c7d);}});ami['on'](_0x651b('0x2a'),function(_0x593286){try{utils[_0x651b('0x19')](util[_0x651b('0x1a')](_0x651b('0x2b'),_0x593286[_0x651b('0x1f')]),_0x593286);queues[_0x651b('0x2a')](_0x593286);}catch(_0x5e850f){utils['error'](util[_0x651b('0x1a')](_0x651b('0x2b'),_0x593286[_0x651b('0x1f')]),_0x5e850f);}});ami['on']('musiconholdstart',function(_0x4777cb){try{utils['debug'](util[_0x651b('0x1a')](_0x651b('0x2c'),_0x4777cb[_0x651b('0x1f')]),_0x4777cb);queues[_0x651b('0x2d')](_0x4777cb);calls['musiconholdstart'](_0x4777cb);}catch(_0xd8701c){utils[_0x651b('0x15')](util[_0x651b('0x1a')](_0x651b('0x2c'),_0x4777cb['uniqueid']),_0xd8701c);}});ami['on'](_0x651b('0x2e'),function(_0x98005e){try{utils['debug'](util[_0x651b('0x1a')]('[%s][index][musiconholdstop]',_0x98005e[_0x651b('0x1f')]),_0x98005e);queues[_0x651b('0x2e')](_0x98005e);calls[_0x651b('0x2e')](_0x98005e);}catch(_0x3caa21){utils[_0x651b('0x15')](util[_0x651b('0x1a')](_0x651b('0x2f'),_0x98005e[_0x651b('0x1f')]),_0x3caa21);}});ami['on']('newstate',function(_0x371f63){try{utils['debug'](util[_0x651b('0x1a')](_0x651b('0x30'),_0x371f63['uniqueid']),_0x371f63);calls['newstate'](_0x371f63);recordings['newstate'](_0x371f63);}catch(_0x4158dc){utils['error'](util['format'](_0x651b('0x30'),_0x371f63[_0x651b('0x1f')]),_0x4158dc);}});ami['on'](_0x651b('0x31'),function(_0x41c25b){try{utils[_0x651b('0x19')](util[_0x651b('0x1a')](_0x651b('0x32'),_0x41c25b[_0x651b('0x1f')]),_0x41c25b);calls[_0x651b('0x31')](_0x41c25b);recordings[_0x651b('0x31')](_0x41c25b);dials['hangup'](_0x41c25b);agents['hangup'](_0x41c25b);queues['hangup'](_0x41c25b);}catch(_0x44ae6b){utils[_0x651b('0x15')](util['format'](_0x651b('0x32'),_0x41c25b[_0x651b('0x1f')]),_0x44ae6b);}});ami['on'](_0x651b('0x33'),function(_0x283933){try{utils[_0x651b('0x19')](util[_0x651b('0x1a')](_0x651b('0x34'),_0x283933[_0x651b('0x1f')]),_0x283933);members[_0x651b('0x33')](_0x283933);}catch(_0x14e72a){utils['error'](util['format'](_0x651b('0x34'),_0x283933[_0x651b('0x1f')]),_0x14e72a);}});ami['on'](_0x651b('0x35'),function(_0x4b55bb){try{utils['debug'](util[_0x651b('0x1a')]('[%s][index][blindtransfer]',_0x4b55bb[_0x651b('0x1f')]),_0x4b55bb);queues['blindtransfer'](_0x4b55bb);agents[_0x651b('0x35')](_0x4b55bb);transfers[_0x651b('0x35')](_0x4b55bb);}catch(_0x1eb87b){utils[_0x651b('0x15')](util[_0x651b('0x1a')](_0x651b('0x36'),_0x4b55bb['uniqueid']),_0x1eb87b);}});ami['on'](_0x651b('0x37'),function(_0x5c604a){try{utils[_0x651b('0x19')](util[_0x651b('0x1a')](_0x651b('0x38'),_0x5c604a['origtransfereruniqueid']),_0x5c604a);queues[_0x651b('0x37')](_0x5c604a);transfers[_0x651b('0x37')](_0x5c604a);agents['attendedtransfer'](_0x5c604a);calls[_0x651b('0x37')](_0x5c604a);}catch(_0x6afc61){utils[_0x651b('0x15')](util[_0x651b('0x1a')](_0x651b('0x38'),_0x5c604a[_0x651b('0x39')]),_0x6afc61);}});ami['on'](_0x651b('0x3a'),function(_0x131b25){try{utils[_0x651b('0x19')](util['format'](_0x651b('0x3b'),_0x131b25['uniqueid']),_0x131b25);queues[_0x651b('0x3a')](_0x131b25);recordings['varset'](_0x131b25);calls[_0x651b('0x3a')](_0x131b25);dials[_0x651b('0x3a')](_0x131b25);}catch(_0x39a568){utils[_0x651b('0x15')](util[_0x651b('0x1a')](_0x651b('0x3b'),_0x131b25[_0x651b('0x1f')]),_0x39a568);}});ami['on'](_0x651b('0x3c'),function(_0x3262a0){try{utils['debug'](util[_0x651b('0x1a')](_0x651b('0x3d'),_0x3262a0[_0x651b('0x1f')]),_0x3262a0);calls[_0x651b('0x3c')](_0x3262a0);recordings[_0x651b('0x3c')](_0x3262a0);dials[_0x651b('0x3c')](_0x3262a0);}catch(_0x338d94){utils[_0x651b('0x15')](util[_0x651b('0x1a')](_0x651b('0x3d'),_0x3262a0[_0x651b('0x1f')]),_0x338d94);}});ami['on'](_0x651b('0x3e'),function(_0x3a26e4){try{utils[_0x651b('0x19')](util[_0x651b('0x1a')](_0x651b('0x3f'),_0x3a26e4[_0x651b('0x1f')]),_0x3a26e4);calls['newchannel'](_0x3a26e4);recordings[_0x651b('0x3e')](_0x3a26e4);}catch(_0x54eed2){utils[_0x651b('0x15')](util[_0x651b('0x1a')](_0x651b('0x3f'),_0x3a26e4[_0x651b('0x1f')]),_0x54eed2);}});ami['on'](_0x651b('0x40'),function(_0x3e99cb){try{utils[_0x651b('0x19')](util[_0x651b('0x1a')](_0x651b('0x41'),_0x3e99cb[_0x651b('0x1f')]),_0x3e99cb);dials[_0x651b('0x40')](_0x3e99cb);}catch(_0x433a19){utils[_0x651b('0x15')](util[_0x651b('0x1a')](_0x651b('0x42'),_0x3e99cb[_0x651b('0x1f')]),_0x433a19);}});ami['on'](_0x651b('0x43'),function(_0x46a8c0){try{utils[_0x651b('0x19')](util[_0x651b('0x1a')](_0x651b('0x44'),_0x46a8c0['uniqueid']),_0x46a8c0);dials[_0x651b('0x43')](_0x46a8c0);}catch(_0x32242c){utils[_0x651b('0x15')](util[_0x651b('0x1a')](_0x651b('0x44'),_0x46a8c0[_0x651b('0x1f')]),_0x32242c);}});} \ No newline at end of file +var _0x0120=['origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','[%s][index][newchannel]','newchannel','dialbegin','[%s][index][dialbegin]','dialend','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','production','local','asterisk','port','username','password','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','[%s][index][agentconnect]','agentconnect','[%s][index][agentcomplete]','agentcomplete','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','[%s][index][musiconholdstop]','musiconholdstop','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','[%s][index][cdr]','cdr','blindtransfer','[%s][index][blindtransfer]','attendedtransfer'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x0120,0x172));var _0x0012=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x0120[_0x164eca];return _0x2ce562;};var AsteriskManager=require(_0x0012('0x0'));var config=require(_0x0012('0x1'));var utils=require(_0x0012('0x2'));var util=require(_0x0012('0x3'));var isXDREnabled=config[_0x0012('0x4')]&&config[_0x0012('0x4')][_0x0012('0x5')]?!config[_0x0012('0x4')][_0x0012('0x5')]:!![];var isProduction=config['env']===_0x0012('0x6')||![];var isLocalAsterisk=config[_0x0012('0x4')]&&config[_0x0012('0x4')][_0x0012('0x7')]===!![]||![];var ami=new AsteriskManager(config[_0x0012('0x8')][_0x0012('0x9')],config[_0x0012('0x8')]['ip'],config[_0x0012('0x8')][_0x0012('0xa')],config[_0x0012('0x8')][_0x0012('0xb')],!![]);ami[_0x0012('0xc')]();if(!isXDREnabled){utils[_0x0012('0xd')](_0x0012('0xe'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x0012('0xd')](_0x0012('0xf'));}else{var agents=require(_0x0012('0x10'));var calls=require('./calls.controller');var queues=require(_0x0012('0x11'));var recordings=require(_0x0012('0x12'));var members=require(_0x0012('0x13'));var dials=require(_0x0012('0x14'));var transfers=require(_0x0012('0x15'));var core=require(_0x0012('0x16'));ami['on'](_0x0012('0x17'),core[_0x0012('0x17')]);ami['on'](_0x0012('0x18'),core[_0x0012('0x18')]);ami['on'](_0x0012('0x19'),core[_0x0012('0x19')]);ami['on']('error',core[_0x0012('0x1a')]);ami['on'](_0x0012('0x1b'),core[_0x0012('0x1b')]);ami['on'](_0x0012('0x1c'),core[_0x0012('0x1c')]);ami['on'](_0x0012('0x1d'),function(_0x5c2dd7){try{utils[_0x0012('0x1e')](util[_0x0012('0x1f')](_0x0012('0x20'),_0x5c2dd7[_0x0012('0x21')]),_0x5c2dd7);members['devicestatechange'](_0x5c2dd7);}catch(_0x522a48){utils[_0x0012('0x1a')](util[_0x0012('0x1f')](_0x0012('0x20'),_0x5c2dd7['device']),_0x522a48);}});ami['on'](_0x0012('0x22'),function(_0x1d891b){try{utils[_0x0012('0x1e')](util['format'](_0x0012('0x23'),_0x1d891b['uniqueid']),_0x1d891b);agents[_0x0012('0x22')](_0x1d891b);}catch(_0x366db5){utils[_0x0012('0x1a')](util[_0x0012('0x1f')](_0x0012('0x23'),_0x1d891b[_0x0012('0x24')]),_0x366db5);}});ami['on'](_0x0012('0x25'),function(_0xb46c54){try{utils[_0x0012('0x1e')](util[_0x0012('0x1f')]('[%s][index][agentringnoanswer]',_0xb46c54[_0x0012('0x24')]),_0xb46c54);agents[_0x0012('0x25')](_0xb46c54);}catch(_0x9ea0ed){utils[_0x0012('0x1a')](util[_0x0012('0x1f')](_0x0012('0x26'),_0xb46c54[_0x0012('0x24')]),_0x9ea0ed);}});ami['on']('agentconnect',function(_0x1632c9){try{utils[_0x0012('0x1e')](util[_0x0012('0x1f')](_0x0012('0x27'),_0x1632c9[_0x0012('0x24')]),_0x1632c9);agents[_0x0012('0x28')](_0x1632c9);queues[_0x0012('0x28')](_0x1632c9);}catch(_0x1d7ad8){utils['error'](util[_0x0012('0x1f')](_0x0012('0x27'),_0x1632c9[_0x0012('0x24')]),_0x1d7ad8);}});ami['on']('agentcomplete',function(_0x2e52bb){try{utils[_0x0012('0x1e')](util[_0x0012('0x1f')](_0x0012('0x29'),_0x2e52bb[_0x0012('0x24')]),_0x2e52bb);agents['agentcomplete'](_0x2e52bb);queues[_0x0012('0x2a')](_0x2e52bb);members[_0x0012('0x2a')](_0x2e52bb);}catch(_0x2c6853){utils[_0x0012('0x1a')](util[_0x0012('0x1f')](_0x0012('0x29'),_0x2e52bb['uniqueid']),_0x2c6853);}});ami['on'](_0x0012('0x2b'),function(_0x4829f8){try{utils['debug'](util['format'](_0x0012('0x2c'),_0x4829f8[_0x0012('0x24')]),_0x4829f8);agents[_0x0012('0x2b')](_0x4829f8);queues[_0x0012('0x2b')](_0x4829f8);}catch(_0x3e56d8){utils[_0x0012('0x1a')](util['format'](_0x0012('0x2c'),_0x4829f8[_0x0012('0x24')]),_0x3e56d8);}});ami['on'](_0x0012('0x2d'),function(_0x508294){try{utils[_0x0012('0x1e')](util[_0x0012('0x1f')](_0x0012('0x2e'),_0x508294['uniqueid']),_0x508294);queues[_0x0012('0x2d')](_0x508294);recordings[_0x0012('0x2d')](_0x508294);}catch(_0x396d30){utils[_0x0012('0x1a')](util[_0x0012('0x1f')](_0x0012('0x2e'),_0x508294[_0x0012('0x24')]),_0x396d30);}});ami['on'](_0x0012('0x2f'),function(_0x3f1bce){try{utils[_0x0012('0x1e')](util[_0x0012('0x1f')](_0x0012('0x30'),_0x3f1bce[_0x0012('0x24')]),_0x3f1bce);queues['queuecallerleave'](_0x3f1bce);}catch(_0x556a90){utils[_0x0012('0x1a')](util[_0x0012('0x1f')](_0x0012('0x30'),_0x3f1bce['uniqueid']),_0x556a90);}});ami['on'](_0x0012('0x31'),function(_0x227cda){try{utils[_0x0012('0x1e')](util[_0x0012('0x1f')]('[%s][index][musiconholdstart]',_0x227cda[_0x0012('0x24')]),_0x227cda);queues[_0x0012('0x31')](_0x227cda);calls[_0x0012('0x31')](_0x227cda);}catch(_0x51e4d8){utils[_0x0012('0x1a')](util['format'](_0x0012('0x32'),_0x227cda[_0x0012('0x24')]),_0x51e4d8);}});ami['on']('musiconholdstop',function(_0xb9ad14){try{utils[_0x0012('0x1e')](util[_0x0012('0x1f')](_0x0012('0x33'),_0xb9ad14[_0x0012('0x24')]),_0xb9ad14);queues[_0x0012('0x34')](_0xb9ad14);calls['musiconholdstop'](_0xb9ad14);}catch(_0x24f1fe){utils[_0x0012('0x1a')](util[_0x0012('0x1f')](_0x0012('0x33'),_0xb9ad14[_0x0012('0x24')]),_0x24f1fe);}});ami['on'](_0x0012('0x35'),function(_0x129a22){try{utils[_0x0012('0x1e')](util['format']('[%s][index][newstate]',_0x129a22['uniqueid']),_0x129a22);calls['newstate'](_0x129a22);recordings['newstate'](_0x129a22);}catch(_0x4c24ca){utils[_0x0012('0x1a')](util[_0x0012('0x1f')](_0x0012('0x36'),_0x129a22[_0x0012('0x24')]),_0x4c24ca);}});ami['on'](_0x0012('0x37'),function(_0x46259a){try{utils[_0x0012('0x1e')](util[_0x0012('0x1f')](_0x0012('0x38'),_0x46259a[_0x0012('0x24')]),_0x46259a);calls[_0x0012('0x37')](_0x46259a);recordings[_0x0012('0x37')](_0x46259a);dials[_0x0012('0x37')](_0x46259a);agents[_0x0012('0x37')](_0x46259a);queues[_0x0012('0x37')](_0x46259a);}catch(_0x1ebb8d){utils[_0x0012('0x1a')](util[_0x0012('0x1f')](_0x0012('0x38'),_0x46259a[_0x0012('0x24')]),_0x1ebb8d);}});ami['on']('cdr',function(_0x5e6168){try{utils[_0x0012('0x1e')](util[_0x0012('0x1f')](_0x0012('0x39'),_0x5e6168[_0x0012('0x24')]),_0x5e6168);members[_0x0012('0x3a')](_0x5e6168);}catch(_0x130d5f){utils[_0x0012('0x1a')](util[_0x0012('0x1f')](_0x0012('0x39'),_0x5e6168['uniqueid']),_0x130d5f);}});ami['on'](_0x0012('0x3b'),function(_0x37ad8b){try{utils[_0x0012('0x1e')](util['format'](_0x0012('0x3c'),_0x37ad8b[_0x0012('0x24')]),_0x37ad8b);queues[_0x0012('0x3b')](_0x37ad8b);agents[_0x0012('0x3b')](_0x37ad8b);transfers[_0x0012('0x3b')](_0x37ad8b);}catch(_0x22c68a){utils[_0x0012('0x1a')](util['format'](_0x0012('0x3c'),_0x37ad8b[_0x0012('0x24')]),_0x22c68a);}});ami['on'](_0x0012('0x3d'),function(_0x2110dd){try{utils[_0x0012('0x1e')](util[_0x0012('0x1f')]('[%s][index][attendedtransfer]',_0x2110dd[_0x0012('0x3e')]),_0x2110dd);queues[_0x0012('0x3d')](_0x2110dd);transfers[_0x0012('0x3d')](_0x2110dd);agents['attendedtransfer'](_0x2110dd);calls[_0x0012('0x3d')](_0x2110dd);}catch(_0xbd8d85){utils['error'](util['format']('[%s][index][attendedtransfer]',_0x2110dd[_0x0012('0x3e')]),_0xbd8d85);}});ami['on'](_0x0012('0x3f'),function(_0x4a9b80){try{utils[_0x0012('0x1e')](util[_0x0012('0x1f')](_0x0012('0x40'),_0x4a9b80[_0x0012('0x24')]),_0x4a9b80);queues[_0x0012('0x3f')](_0x4a9b80);recordings['varset'](_0x4a9b80);calls[_0x0012('0x3f')](_0x4a9b80);dials['varset'](_0x4a9b80);}catch(_0x31a0b3){utils[_0x0012('0x1a')](util['format'](_0x0012('0x40'),_0x4a9b80['uniqueid']),_0x31a0b3);}});ami['on'](_0x0012('0x41'),function(_0x448063){try{utils['debug'](util['format']('[%s][index][newexten]',_0x448063[_0x0012('0x24')]),_0x448063);calls[_0x0012('0x41')](_0x448063);recordings[_0x0012('0x41')](_0x448063);dials[_0x0012('0x41')](_0x448063);}catch(_0x499be2){utils['error'](util['format'](_0x0012('0x42'),_0x448063[_0x0012('0x24')]),_0x499be2);}});ami['on']('newchannel',function(_0x1bf03f){try{utils[_0x0012('0x1e')](util[_0x0012('0x1f')](_0x0012('0x43'),_0x1bf03f[_0x0012('0x24')]),_0x1bf03f);calls[_0x0012('0x44')](_0x1bf03f);recordings[_0x0012('0x44')](_0x1bf03f);}catch(_0x1e909d){utils[_0x0012('0x1a')](util['format'](_0x0012('0x43'),_0x1bf03f[_0x0012('0x24')]),_0x1e909d);}});ami['on'](_0x0012('0x45'),function(_0x5bf175){try{utils['debug'](util[_0x0012('0x1f')](_0x0012('0x46'),_0x5bf175[_0x0012('0x24')]),_0x5bf175);dials['dialbegin'](_0x5bf175);}catch(_0x50c3dc){utils[_0x0012('0x1a')](util[_0x0012('0x1f')]('[%s]dialbegin',_0x5bf175[_0x0012('0x24')]),_0x50c3dc);}});ami['on'](_0x0012('0x47'),function(_0xa59f32){try{utils['debug'](util['format']('[%s][index][dialend]',_0xa59f32[_0x0012('0x24')]),_0xa59f32);dials[_0x0012('0x47')](_0xa59f32);}catch(_0x391a2c){utils[_0x0012('0x1a')](util[_0x0012('0x1f')]('[%s][index][dialend]',_0xa59f32['uniqueid']),_0x391a2c);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 550bc76..f5f8d27 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 _0x7868=['getUserByInterface','then','internal','request','name','CreateMemberReport','catch','error','format','devicestatechange','debug','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','TALKING','now','exitAt','duration','diffTime','[%s][members][devicestatechange]','isNil','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','assign','queue','cdr','[%s][members][cdr]','data1','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','split','lodash','./utils','Local/_attended@transfer','Queue:','info','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','membername','type'];(function(_0x1e51f4,_0x506f6d){var _0x223c1d=function(_0x46dd51){while(--_0x46dd51){_0x1e51f4['push'](_0x1e51f4['shift']());}};_0x223c1d(++_0x506f6d);}(_0x7868,0x1c0));var _0x8786=function(_0x4a1fe1,_0x5845a4){_0x4a1fe1=_0x4a1fe1-0x0;var _0x400a52=_0x7868[_0x4a1fe1];return _0x400a52;};'use strict';var _=require(_0x8786('0x0'));var util=require('util');var utils=require(_0x8786('0x1'));var members={};var exclude=[_0x8786('0x2'),_0x8786('0x3')];function writeDB(_0x229022){utils[_0x8786('0x4')](util['format'](_0x8786('0x5'),_0x229022[_0x8786('0x6')],_0x229022[_0x8786('0x7')],_0x229022[_0x8786('0x8')],_0x229022[_0x8786('0x9')],_0x229022[_0x8786('0xa')],_0x229022[_0x8786('0xb')]));if(_0x229022[_0x8786('0x7')]){utils[_0x8786('0xc')](_0x229022[_0x8786('0x7')])[_0x8786('0xd')](function(_0x34e86e){if(_0x34e86e){_0x229022['membername']=_0x34e86e['name'];_0x229022[_0x8786('0xe')]=_0x34e86e[_0x8786('0xe')];utils[_0x8786('0xf')]('CreateMemberReport',_0x229022);}else{utils['getUserByName'](_0x229022[_0x8786('0x7')]['split']('/')[0x1])[_0x8786('0xd')](function(_0x16f1f9){if(_0x16f1f9){_0x229022[_0x8786('0xa')]=_0x16f1f9[_0x8786('0x10')];_0x229022[_0x8786('0xe')]=_0x16f1f9[_0x8786('0xe')];utils['request'](_0x8786('0x11'),_0x229022);}});}})[_0x8786('0x12')](function(_0x50d09d){utils[_0x8786('0x13')](util[_0x8786('0x14')]('[%s][members][writeDB]',_0x229022[_0x8786('0x6')]),_0x50d09d);});}delete members[_0x229022[_0x8786('0x7')]];}function startsWith(_0x44e19a,_0x438bad){return _['some'](_0x44e19a,function(_0x54d9f6){return _['startsWith'](_0x438bad,_0x54d9f6);});}exports[_0x8786('0x15')]=function(_0x450606){try{utils[_0x8786('0x16')](util[_0x8786('0x14')]('[%s][members][devicestatechange]',members[_0x450606[_0x8786('0x17')]]?members[_0x450606[_0x8786('0x17')]][_0x8786('0x6')]:_0x450606[_0x8786('0x17')]),_0x450606);utils[_0x8786('0x4')](util[_0x8786('0x14')](_0x8786('0x18'),members[_0x450606[_0x8786('0x17')]]?members[_0x450606[_0x8786('0x17')]]['uniqueid']:_0x450606[_0x8786('0x17')],_0x450606[_0x8786('0x19')],_0x450606[_0x8786('0x17')]));switch(_0x450606[_0x8786('0x19')]){case _0x8786('0x1a'):case'BUSY':if(!startsWith(exclude,_0x450606[_0x8786('0x17')])){members[_0x450606[_0x8786('0x17')]]={'channel':'voice','interface':_0x450606[_0x8786('0x17')],'type':_0x8786('0x1b'),'enterAt':utils[_0x8786('0x1c')](),'role':'agent'};}break;case'NOT_INUSE':if(!_['isNil'](members[_0x450606[_0x8786('0x17')]])){members[_0x450606[_0x8786('0x17')]][_0x8786('0x1d')]=utils['now']();members[_0x450606[_0x8786('0x17')]][_0x8786('0x1e')]=utils[_0x8786('0x1f')](members[_0x450606[_0x8786('0x17')]][_0x8786('0x1d')],members[_0x450606['device']]['enterAt']);if(members[_0x450606[_0x8786('0x17')]][_0x8786('0x6')]){writeDB(members[_0x450606[_0x8786('0x17')]]);}}break;default:break;}}catch(_0x91ee61){utils[_0x8786('0x13')](util[_0x8786('0x14')](_0x8786('0x20'),members[_0x450606[_0x8786('0x17')]]?members[_0x450606[_0x8786('0x17')]][_0x8786('0x6')]:_0x450606['device']),_0x91ee61);}};exports['agentcomplete']=function(_0x5966cb){try{if(!_[_0x8786('0x21')](members[_0x5966cb['interface']])){utils[_0x8786('0x16')](util[_0x8786('0x14')]('[%s][members][agentcomplete]',_0x5966cb[_0x8786('0x6')]),_0x5966cb);utils['info'](util[_0x8786('0x14')](_0x8786('0x22'),_0x5966cb[_0x8786('0x6')],_0x5966cb['interface'],_0x5966cb['queue']));members[_0x5966cb[_0x8786('0x7')]]=_[_0x8786('0x23')](members[_0x5966cb[_0x8786('0x7')]],{'data4':_0x5966cb[_0x8786('0x24')],'uniqueid':_0x5966cb['uniqueid']});}}catch(_0x28c862){utils[_0x8786('0x13')](util['format']('[%s][members][agentcomplete]',_0x5966cb[_0x8786('0x6')]),_0x28c862);}};exports[_0x8786('0x25')]=function(_0x39270c){try{utils[_0x8786('0x16')](util['format'](_0x8786('0x26'),_0x39270c[_0x8786('0x6')]),_0x39270c);if(_0x39270c['channel']){var _0x3d38bd=_0x39270c['channel']['split']('-')[0x0];if(!_[_0x8786('0x21')](members[_0x3d38bd])){members[_0x3d38bd]=_[_0x8786('0x23')](members[_0x3d38bd],{'data1':members[_0x3d38bd][_0x8786('0x27')]||_0x39270c['type'],'data2':members[_0x3d38bd][_0x8786('0x9')]||_0x39270c[_0x8786('0x28')],'data3':members[_0x3d38bd][_0x8786('0x29')]||_0x39270c[_0x8786('0x2a')],'uniqueid':members[_0x3d38bd]['uniqueid']||_0x39270c['uniqueid']});utils[_0x8786('0x4')](util[_0x8786('0x14')](_0x8786('0x2b'),_0x39270c[_0x8786('0x6')],members[_0x3d38bd][_0x8786('0x27')],members[_0x3d38bd][_0x8786('0x9')],members[_0x3d38bd]['data3']));if(members[_0x3d38bd][_0x8786('0x1d')]){writeDB(members[_0x3d38bd]);}}}if(_0x39270c[_0x8786('0x2c')]){var _0x689343=_0x39270c[_0x8786('0x2c')][_0x8786('0x2d')]('-')[0x0];if(!_[_0x8786('0x21')](members[_0x689343])){members[_0x689343]=_[_0x8786('0x23')](members[_0x689343],{'data1':members[_0x689343][_0x8786('0x27')]||_0x39270c[_0x8786('0xb')],'data2':members[_0x689343][_0x8786('0x9')]||_0x39270c[_0x8786('0x28')],'data3':members[_0x689343][_0x8786('0x29')]||_0x39270c['destination'],'uniqueid':members[_0x689343][_0x8786('0x6')]||_0x39270c[_0x8786('0x6')]});utils[_0x8786('0x4')](util[_0x8786('0x14')](_0x8786('0x2b'),_0x39270c[_0x8786('0x6')],members[_0x689343]['data1'],members[_0x689343][_0x8786('0x9')],members[_0x689343][_0x8786('0x29')]));if(members[_0x689343]['exitAt']){writeDB(members[_0x689343]);}}}}catch(_0x180b82){utils[_0x8786('0x13')](util[_0x8786('0x14')](_0x8786('0x26'),_0x39270c[_0x8786('0x6')]),_0x180b82);}}; \ No newline at end of file +var _0x94b6=['isNil','duration','diffTime','exitAt','enterAt','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','assign','queue','cdr','[%s][members][cdr]','source','destination','data1','destinationchannel','data3','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','lodash','util','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','channel','data2','membername','type','interface','getUserByInterface','then','name','internal','request','CreateMemberReport','getUserByName','catch','error','[%s][members][writeDB]','some','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','now','agent','NOT_INUSE'];(function(_0x77e0eb,_0x18a068){var _0x1c7991=function(_0x235fc3){while(--_0x235fc3){_0x77e0eb['push'](_0x77e0eb['shift']());}};_0x1c7991(++_0x18a068);}(_0x94b6,0x143));var _0x694b=function(_0x291f8b,_0x3b5591){_0x291f8b=_0x291f8b-0x0;var _0x275171=_0x94b6[_0x291f8b];return _0x275171;};'use strict';var _=require(_0x694b('0x0'));var util=require(_0x694b('0x1'));var utils=require('./utils');var members={};var exclude=[_0x694b('0x2'),_0x694b('0x3')];function writeDB(_0x22f97c){utils[_0x694b('0x4')](util[_0x694b('0x5')](_0x694b('0x6'),_0x22f97c[_0x694b('0x7')],_0x22f97c['interface'],_0x22f97c[_0x694b('0x8')],_0x22f97c[_0x694b('0x9')],_0x22f97c[_0x694b('0xa')],_0x22f97c[_0x694b('0xb')]));if(_0x22f97c[_0x694b('0xc')]){utils[_0x694b('0xd')](_0x22f97c['interface'])[_0x694b('0xe')](function(_0x5be999){if(_0x5be999){_0x22f97c['membername']=_0x5be999[_0x694b('0xf')];_0x22f97c[_0x694b('0x10')]=_0x5be999[_0x694b('0x10')];utils[_0x694b('0x11')](_0x694b('0x12'),_0x22f97c);}else{utils[_0x694b('0x13')](_0x22f97c[_0x694b('0xc')]['split']('/')[0x1])[_0x694b('0xe')](function(_0x454a83){if(_0x454a83){_0x22f97c[_0x694b('0xa')]=_0x454a83[_0x694b('0xf')];_0x22f97c[_0x694b('0x10')]=_0x454a83['internal'];utils[_0x694b('0x11')](_0x694b('0x12'),_0x22f97c);}});}})[_0x694b('0x14')](function(_0x435706){utils[_0x694b('0x15')](util[_0x694b('0x5')](_0x694b('0x16'),_0x22f97c[_0x694b('0x7')]),_0x435706);});}delete members[_0x22f97c[_0x694b('0xc')]];}function startsWith(_0x21e6af,_0x257621){return _[_0x694b('0x17')](_0x21e6af,function(_0x199b16){return _['startsWith'](_0x257621,_0x199b16);});}exports['devicestatechange']=function(_0x42915c){try{utils[_0x694b('0x18')](util[_0x694b('0x5')](_0x694b('0x19'),members[_0x42915c[_0x694b('0x1a')]]?members[_0x42915c[_0x694b('0x1a')]][_0x694b('0x7')]:_0x42915c['device']),_0x42915c);utils[_0x694b('0x4')](util['format'](_0x694b('0x1b'),members[_0x42915c[_0x694b('0x1a')]]?members[_0x42915c['device']][_0x694b('0x7')]:_0x42915c[_0x694b('0x1a')],_0x42915c['state'],_0x42915c['device']));switch(_0x42915c[_0x694b('0x1c')]){case _0x694b('0x1d'):case _0x694b('0x1e'):if(!startsWith(exclude,_0x42915c['device'])){members[_0x42915c[_0x694b('0x1a')]]={'channel':'voice','interface':_0x42915c[_0x694b('0x1a')],'type':'TALKING','enterAt':utils[_0x694b('0x1f')](),'role':_0x694b('0x20')};}break;case _0x694b('0x21'):if(!_[_0x694b('0x22')](members[_0x42915c[_0x694b('0x1a')]])){members[_0x42915c[_0x694b('0x1a')]]['exitAt']=utils['now']();members[_0x42915c[_0x694b('0x1a')]][_0x694b('0x23')]=utils[_0x694b('0x24')](members[_0x42915c[_0x694b('0x1a')]][_0x694b('0x25')],members[_0x42915c[_0x694b('0x1a')]][_0x694b('0x26')]);if(members[_0x42915c[_0x694b('0x1a')]][_0x694b('0x7')]){writeDB(members[_0x42915c['device']]);}}break;default:break;}}catch(_0x1dd3cf){utils[_0x694b('0x15')](util[_0x694b('0x5')]('[%s][members][devicestatechange]',members[_0x42915c['device']]?members[_0x42915c[_0x694b('0x1a')]][_0x694b('0x7')]:_0x42915c[_0x694b('0x1a')]),_0x1dd3cf);}};exports['agentcomplete']=function(_0x28df30){try{if(!_[_0x694b('0x22')](members[_0x28df30[_0x694b('0xc')]])){utils[_0x694b('0x18')](util[_0x694b('0x5')](_0x694b('0x27'),_0x28df30[_0x694b('0x7')]),_0x28df30);utils['info'](util[_0x694b('0x5')](_0x694b('0x28'),_0x28df30[_0x694b('0x7')],_0x28df30[_0x694b('0xc')],_0x28df30['queue']));members[_0x28df30[_0x694b('0xc')]]=_[_0x694b('0x29')](members[_0x28df30[_0x694b('0xc')]],{'data4':_0x28df30[_0x694b('0x2a')],'uniqueid':_0x28df30[_0x694b('0x7')]});}}catch(_0x683205){utils[_0x694b('0x15')](util['format'](_0x694b('0x27'),_0x28df30[_0x694b('0x7')]),_0x683205);}};exports[_0x694b('0x2b')]=function(_0x246250){try{utils['debug'](util[_0x694b('0x5')](_0x694b('0x2c'),_0x246250[_0x694b('0x7')]),_0x246250);if(_0x246250[_0x694b('0x8')]){var _0x2c0220=_0x246250['channel']['split']('-')[0x0];if(!_[_0x694b('0x22')](members[_0x2c0220])){members[_0x2c0220]=_[_0x694b('0x29')](members[_0x2c0220],{'data1':members[_0x2c0220]['data1']||_0x246250[_0x694b('0xb')],'data2':members[_0x2c0220][_0x694b('0x9')]||_0x246250[_0x694b('0x2d')],'data3':members[_0x2c0220]['data3']||_0x246250[_0x694b('0x2e')],'uniqueid':members[_0x2c0220]['uniqueid']||_0x246250[_0x694b('0x7')]});utils[_0x694b('0x4')](util[_0x694b('0x5')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x246250[_0x694b('0x7')],members[_0x2c0220][_0x694b('0x2f')],members[_0x2c0220][_0x694b('0x9')],members[_0x2c0220]['data3']));if(members[_0x2c0220][_0x694b('0x25')]){writeDB(members[_0x2c0220]);}}}if(_0x246250[_0x694b('0x30')]){var _0x8f52a=_0x246250[_0x694b('0x30')]['split']('-')[0x0];if(!_[_0x694b('0x22')](members[_0x8f52a])){members[_0x8f52a]=_['assign'](members[_0x8f52a],{'data1':members[_0x8f52a]['data1']||_0x246250[_0x694b('0xb')],'data2':members[_0x8f52a][_0x694b('0x9')]||_0x246250[_0x694b('0x2d')],'data3':members[_0x8f52a][_0x694b('0x31')]||_0x246250[_0x694b('0x2e')],'uniqueid':members[_0x8f52a][_0x694b('0x7')]||_0x246250[_0x694b('0x7')]});utils[_0x694b('0x4')](util[_0x694b('0x5')](_0x694b('0x32'),_0x246250['uniqueid'],members[_0x8f52a]['data1'],members[_0x8f52a][_0x694b('0x9')],members[_0x8f52a][_0x694b('0x31')]));if(members[_0x8f52a][_0x694b('0x25')]){writeDB(members[_0x8f52a]);}}}}catch(_0x111972){utils['error'](util[_0x694b('0x5')]('[%s][members][cdr]',_0x246250[_0x694b('0x7')]),_0x111972);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 30d963c..21b611d 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 _0xb416=['transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','position','now','error','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','varset','[%s][queues][varset]','variable','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','connectedlinename','holdtime','diffTime','queuecallerjoinAt','count','connectedlinenum','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','extension','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererlinkedid','origtransfererexten','ATTENDED','transferuniqueid','ATTENDEDTRANSFER','transfereelinkedid','queuecallerenterreason','clone','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','transfertargetuniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','musiconholdstartAt','[%s][queues][musiconholdstart]','mohtime','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','[%s][queues][musiconholdstop]','lodash','util','./utils','info','format','uniqueid','channel','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','queue','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xb416,0x187));var _0x6b41=function(_0xc74a44,_0x14b7b9){_0xc74a44=_0xc74a44-0x0;var _0x1ba5c6=_0xb416[_0xc74a44];return _0x1ba5c6;};'use strict';var _=require(_0x6b41('0x0'));var util=require(_0x6b41('0x1'));var utils=require(_0x6b41('0x2'));var queues={};function writeDB(_0x39ee7e){utils[_0x6b41('0x3')](util[_0x6b41('0x4')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x39ee7e[_0x6b41('0x5')],_0x39ee7e[_0x6b41('0x6')],_0x39ee7e['queue'],_0x39ee7e[_0x6b41('0x7')],_0x39ee7e[_0x6b41('0x8')],_0x39ee7e[_0x6b41('0x9')],_0x39ee7e[_0x6b41('0xa')]));if(_0x39ee7e[_0x6b41('0xb')]){utils[_0x6b41('0xc')](_0x39ee7e[_0x6b41('0xb')])[_0x6b41('0xd')](function(_0x3ae7e1){if(_0x3ae7e1){_0x39ee7e[_0x6b41('0xe')]=_0x3ae7e1[_0x6b41('0xe')];}utils[_0x6b41('0xf')]('CreateVoiceQueueReport',_0x39ee7e);});}else{utils[_0x6b41('0xf')](_0x6b41('0x10'),_0x39ee7e);}if(_0x39ee7e[_0x6b41('0x11')]){delete queues[_0x39ee7e[_0x6b41('0x11')]];}else{delete queues[_0x39ee7e[_0x6b41('0x5')]];}}exports[_0x6b41('0x12')]=function(_0x352d8f){try{utils[_0x6b41('0x13')](util[_0x6b41('0x4')](_0x6b41('0x14'),_0x352d8f[_0x6b41('0x5')]),_0x352d8f);utils[_0x6b41('0x3')](util[_0x6b41('0x4')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x352d8f[_0x6b41('0x5')],_0x352d8f['queue'],_0x352d8f[_0x6b41('0x15')]));queues[_0x352d8f['uniqueid']]=_['assign'](_0x352d8f,{'originalposition':_0x352d8f[_0x6b41('0x15')],'queuecallerjoinAt':utils[_0x6b41('0x16')](),'mohtime':0x0});}catch(_0xbd0fba){utils[_0x6b41('0x17')](util[_0x6b41('0x4')](_0x6b41('0x14'),_0x352d8f['uniqueid']),_0xbd0fba);}};exports['hangup']=function(_0x4ab9ac){try{if(!_[_0x6b41('0x18')](queues[_0x4ab9ac['uniqueid']])){utils[_0x6b41('0x13')](util[_0x6b41('0x4')](_0x6b41('0x19'),_0x4ab9ac[_0x6b41('0x5')]),_0x4ab9ac);if(queues[_0x4ab9ac[_0x6b41('0x5')]][_0x6b41('0x1a')]){if(!queues[_0x4ab9ac['uniqueid']][_0x6b41('0x1b')]&&!queues[_0x4ab9ac[_0x6b41('0x5')]][_0x6b41('0x1c')]){queues[_0x4ab9ac['uniqueid']][_0x6b41('0x1d')]=!![];queues[_0x4ab9ac[_0x6b41('0x5')]][_0x6b41('0x1e')]=utils[_0x6b41('0x16')]();queues[_0x4ab9ac['uniqueid']]['queuecallerexitreason']=_0x6b41('0x1f');}utils[_0x6b41('0x3')](util[_0x6b41('0x4')](_0x6b41('0x20'),_0x4ab9ac[_0x6b41('0x5')],queues[_0x4ab9ac[_0x6b41('0x5')]]['name'],queues[_0x4ab9ac[_0x6b41('0x5')]][_0x6b41('0xa')]));writeDB(queues[_0x4ab9ac[_0x6b41('0x5')]]);}else if(queues[_0x4ab9ac[_0x6b41('0x5')]][_0x6b41('0x11')]){utils[_0x6b41('0x3')](util[_0x6b41('0x4')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x4ab9ac[_0x6b41('0x5')],queues[_0x4ab9ac[_0x6b41('0x5')]][_0x6b41('0x21')],queues[_0x4ab9ac[_0x6b41('0x5')]][_0x6b41('0x11')]));queues[queues[_0x4ab9ac[_0x6b41('0x5')]]['transfereduniqueid']]=queues[_0x4ab9ac[_0x6b41('0x5')]];queues[queues[_0x4ab9ac['uniqueid']][_0x6b41('0x11')]]['queuecallerenterreason']=0x2;delete queues[_0x4ab9ac[_0x6b41('0x5')]];}}}catch(_0x5611a1){utils['error'](util[_0x6b41('0x4')](_0x6b41('0x19'),_0x4ab9ac[_0x6b41('0x5')]),_0x5611a1);}};exports[_0x6b41('0x22')]=function(_0x23ed6e){try{utils[_0x6b41('0x13')](util[_0x6b41('0x4')](_0x6b41('0x23'),_0x23ed6e[_0x6b41('0x5')]),_0x23ed6e);if(!_[_0x6b41('0x18')](_0x23ed6e[_0x6b41('0x24')]['queuestatus'])&&_0x23ed6e[_0x6b41('0x25')][_0x6b41('0x26')]()!==_0x6b41('0x27')){if(!_[_0x6b41('0x18')](queues[_0x23ed6e[_0x6b41('0x5')]])){queues[_0x23ed6e[_0x6b41('0x5')]][_0x6b41('0x1b')]=![];queues[_0x23ed6e[_0x6b41('0x5')]][_0x6b41('0x28')]=null;queues[_0x23ed6e[_0x6b41('0x5')]][_0x6b41('0x1c')]=!![];queues[_0x23ed6e['uniqueid']][_0x6b41('0x29')]=utils[_0x6b41('0x16')]();queues[_0x23ed6e[_0x6b41('0x5')]][_0x6b41('0xa')]=_0x23ed6e[_0x6b41('0x25')]['toUpperCase']();utils['info'](util[_0x6b41('0x4')](_0x6b41('0x2a'),_0x23ed6e[_0x6b41('0x5')],queues[_0x23ed6e['uniqueid']]['name'],_0x23ed6e[_0x6b41('0x25')],queues[_0x23ed6e['uniqueid']][_0x6b41('0xa')]));writeDB(queues[_0x23ed6e[_0x6b41('0x5')]]);}}else if(!_['isNil'](_0x23ed6e['variable'][_0x6b41('0x2b')])){if(!_[_0x6b41('0x18')](queues[_0x23ed6e['uniqueid']])&&!queues[_0x23ed6e[_0x6b41('0x5')]]['queuecallerabandon']){queues[_0x23ed6e[_0x6b41('0x5')]][_0x6b41('0x1b')]=![];queues[_0x23ed6e[_0x6b41('0x5')]][_0x6b41('0x28')]=null;queues[_0x23ed6e[_0x6b41('0x5')]]['queuecallerexit']=!![];queues[_0x23ed6e[_0x6b41('0x5')]][_0x6b41('0x29')]=utils[_0x6b41('0x16')]();queues[_0x23ed6e['uniqueid']][_0x6b41('0xa')]='EXITWITHKEY';utils[_0x6b41('0x3')](util[_0x6b41('0x4')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x23ed6e[_0x6b41('0x5')],queues[_0x23ed6e['uniqueid']][_0x6b41('0x21')],_0x23ed6e[_0x6b41('0x25')],queues[_0x23ed6e[_0x6b41('0x5')]]['queuecallerexitreason']));}}}catch(_0x28781c){utils[_0x6b41('0x17')](util[_0x6b41('0x4')](_0x6b41('0x23'),_0x23ed6e['uniqueid']),_0x28781c);}};exports[_0x6b41('0x1b')]=function(_0x57335b){try{if(!_['isNil'](queues[_0x57335b['uniqueid']])){utils[_0x6b41('0x13')](util[_0x6b41('0x4')](_0x6b41('0x2c'),_0x57335b['uniqueid']),_0x57335b);queues[_0x57335b[_0x6b41('0x5')]][_0x6b41('0x1c')]=![];queues[_0x57335b[_0x6b41('0x5')]][_0x6b41('0x29')]=null;queues[_0x57335b['uniqueid']][_0x6b41('0x1b')]=!![];queues[_0x57335b[_0x6b41('0x5')]][_0x6b41('0x28')]=utils[_0x6b41('0x16')]();queues[_0x57335b[_0x6b41('0x5')]]['queuecallerexitreason']=_0x6b41('0x2d');utils[_0x6b41('0x3')](util[_0x6b41('0x4')](_0x6b41('0x2e'),_0x57335b[_0x6b41('0x5')],queues[_0x57335b[_0x6b41('0x5')]]['name'],queues[_0x57335b['uniqueid']][_0x6b41('0xa')]));}}catch(_0x108f35){utils[_0x6b41('0x17')](util['format']('[%s][queues][queuecallerabandon]',_0x57335b[_0x6b41('0x5')]),_0x108f35);}};exports[_0x6b41('0x2f')]=function(_0xeacf54){try{if(!_['isNil'](queues[_0xeacf54['uniqueid']])){utils[_0x6b41('0x13')](util[_0x6b41('0x4')](_0x6b41('0x30'),_0xeacf54[_0x6b41('0x5')]),_0xeacf54);utils[_0x6b41('0x3')](util['format']('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0xeacf54['uniqueid'],queues[_0xeacf54[_0x6b41('0x5')]][_0x6b41('0x21')],_0xeacf54['connectedlinenum'],_0xeacf54[_0x6b41('0x31')]));queues[_0xeacf54['uniqueid']][_0x6b41('0x2f')]=!![];queues[_0xeacf54['uniqueid']][_0x6b41('0x1a')]=utils[_0x6b41('0x16')]();queues[_0xeacf54[_0x6b41('0x5')]][_0x6b41('0x32')]=utils[_0x6b41('0x33')](queues[_0xeacf54[_0x6b41('0x5')]]['queuecallerleaveAt'],queues[_0xeacf54[_0x6b41('0x5')]][_0x6b41('0x34')]);queues[_0xeacf54[_0x6b41('0x5')]]['position']=_0xeacf54[_0x6b41('0x15')];queues[_0xeacf54[_0x6b41('0x5')]]['count']=_0xeacf54[_0x6b41('0x35')];queues[_0xeacf54[_0x6b41('0x5')]][_0x6b41('0x36')]=_0xeacf54['connectedlinenum'];queues[_0xeacf54[_0x6b41('0x5')]][_0x6b41('0x31')]=_0xeacf54[_0x6b41('0x31')];}}catch(_0x1ecd8c){utils[_0x6b41('0x17')](util['format'](_0x6b41('0x30'),_0xeacf54[_0x6b41('0x5')]),_0x1ecd8c);}};exports['agentconnect']=function(_0x2074c9){try{if(!_[_0x6b41('0x18')](queues[_0x2074c9[_0x6b41('0x5')]])){utils[_0x6b41('0x13')](util[_0x6b41('0x4')](_0x6b41('0x37'),_0x2074c9['uniqueid']),_0x2074c9);utils['info'](util[_0x6b41('0x4')](_0x6b41('0x38'),_0x2074c9[_0x6b41('0x5')],queues[_0x2074c9[_0x6b41('0x5')]][_0x6b41('0x21')],_0x2074c9[_0x6b41('0x39')],_0x2074c9[_0x6b41('0x3a')]));queues[_0x2074c9[_0x6b41('0x5')]]['queuecallerabandon']=![];queues[_0x2074c9[_0x6b41('0x5')]][_0x6b41('0x1b')]=![];queues[_0x2074c9[_0x6b41('0x5')]]['queuecallerabandonAt']=null;queues[_0x2074c9[_0x6b41('0x5')]][_0x6b41('0x1c')]=![];queues[_0x2074c9[_0x6b41('0x5')]][_0x6b41('0xa')]=null;queues[_0x2074c9['uniqueid']][_0x6b41('0x29')]=null;queues[_0x2074c9['uniqueid']][_0x6b41('0x3b')]=!![];queues[_0x2074c9[_0x6b41('0x5')]][_0x6b41('0x9')]=_0x2074c9['destaccountcode'];queues[_0x2074c9[_0x6b41('0x5')]]['lastAssignedTo']=_0x2074c9[_0x6b41('0x39')];}}catch(_0x320abc){utils[_0x6b41('0x17')](util[_0x6b41('0x4')](_0x6b41('0x37'),_0x2074c9[_0x6b41('0x5')]),_0x320abc);}};exports[_0x6b41('0x3c')]=function(_0xbf733c){try{if(!_['isNil'](queues[_0xbf733c[_0x6b41('0x5')]])){if(queues[_0xbf733c[_0x6b41('0x5')]][_0x6b41('0x1a')]){utils[_0x6b41('0x13')](util[_0x6b41('0x4')](_0x6b41('0x3d'),_0xbf733c[_0x6b41('0x5')]),_0xbf733c);queues[_0xbf733c['uniqueid']][_0x6b41('0x1b')]=![];queues[_0xbf733c[_0x6b41('0x5')]][_0x6b41('0x1b')]=![];queues[_0xbf733c['uniqueid']][_0x6b41('0x28')]=null;queues[_0xbf733c[_0x6b41('0x5')]]['queuecallerexit']=![];queues[_0xbf733c[_0x6b41('0x5')]][_0x6b41('0x29')]=null;queues[_0xbf733c[_0x6b41('0x5')]][_0x6b41('0x3b')]=!![];queues[_0xbf733c['uniqueid']][_0x6b41('0x7')]=_0xbf733c[_0x6b41('0x39')];queues[_0xbf733c[_0x6b41('0x5')]]['queuecallercomplete']=!![];queues[_0xbf733c['uniqueid']][_0x6b41('0x1e')]=utils['now']();if(_0xbf733c[_0x6b41('0x3e')]==_0x6b41('0x3f')){if(!queues[_0xbf733c[_0x6b41('0x5')]]['transfer']){queues[_0xbf733c[_0x6b41('0x5')]][_0x6b41('0xa')]=_0x6b41('0x40');}}else{queues[_0xbf733c[_0x6b41('0x5')]][_0x6b41('0xa')]=_0x6b41('0x41')+_0xbf733c[_0x6b41('0x3e')][_0x6b41('0x26')]();}utils['info'](util[_0x6b41('0x4')](_0x6b41('0x42'),_0xbf733c['uniqueid'],queues[_0xbf733c['uniqueid']]['name'],_0xbf733c[_0x6b41('0x39')],queues[_0xbf733c[_0x6b41('0x5')]][_0x6b41('0xa')]));writeDB(queues[_0xbf733c[_0x6b41('0x5')]]);}}}catch(_0x1ba6a1){utils[_0x6b41('0x17')](util['format'](_0x6b41('0x3d'),_0xbf733c[_0x6b41('0x5')]),_0x1ba6a1);}};exports[_0x6b41('0x43')]=function(_0x529683){try{if(!_[_0x6b41('0x18')](queues[_0x529683[_0x6b41('0x44')]])){utils[_0x6b41('0x13')](util[_0x6b41('0x4')](_0x6b41('0x45'),_0x529683['uniqueid']),_0x529683);queues[_0x529683['transfereeuniqueid']][_0x6b41('0x3f')]=!![];queues[_0x529683[_0x6b41('0x44')]][_0x6b41('0x46')]=_0x6b41('0x47');queues[_0x529683[_0x6b41('0x44')]][_0x6b41('0x48')]=_0x529683[_0x6b41('0x49')];queues[_0x529683[_0x6b41('0x44')]]['transferuniqueid']=_0x529683[_0x6b41('0x44')];queues[_0x529683[_0x6b41('0x44')]][_0x6b41('0xa')]='BLINDTRANSFER';utils[_0x6b41('0x3')](util['format'](_0x6b41('0x4a'),_0x529683[_0x6b41('0x5')],queues[_0x529683[_0x6b41('0x44')]]['name'],_0x529683['transfereeuniqueid'],_0x529683['extension']));}}catch(_0x1173c7){utils[_0x6b41('0x17')](util[_0x6b41('0x4')](_0x6b41('0x45'),_0x529683[_0x6b41('0x5')]),_0x1173c7);}};exports[_0x6b41('0x4b')]=function(_0x525dbc){try{utils[_0x6b41('0x13')](util[_0x6b41('0x4')](_0x6b41('0x4c'),_0x525dbc[_0x6b41('0x4d')]),_0x525dbc);if(_0x525dbc[_0x6b41('0x4d')]==_0x525dbc[_0x6b41('0x4e')]){if(!_[_0x6b41('0x18')](queues[_0x525dbc['secondtransfererlinkedid']])){utils['info'](util[_0x6b41('0x4')](_0x6b41('0x4f'),_0x525dbc['origtransfereruniqueid'],queues[_0x525dbc[_0x6b41('0x50')]][_0x6b41('0x21')],_0x525dbc[_0x6b41('0x51')]));queues[_0x525dbc[_0x6b41('0x50')]][_0x6b41('0x3f')]=!![];queues[_0x525dbc[_0x6b41('0x50')]][_0x6b41('0x46')]=_0x6b41('0x52');queues[_0x525dbc[_0x6b41('0x50')]][_0x6b41('0x48')]=_0x525dbc['origtransfererexten'];queues[_0x525dbc['secondtransfererlinkedid']][_0x6b41('0x53')]=_0x525dbc['origtransfereruniqueid'];queues[_0x525dbc[_0x6b41('0x50')]][_0x6b41('0xa')]=_0x6b41('0x54');}if(!_[_0x6b41('0x18')](queues[_0x525dbc[_0x6b41('0x4e')]])){if(_0x525dbc['transfereelinkedid']&&queues[_0x525dbc[_0x6b41('0x55')]]){queues[_0x525dbc['transfereelinkedid']][_0x6b41('0x56')]=0x1;queues[_0x525dbc[_0x6b41('0x44')]]=_[_0x6b41('0x57')](queues[_0x525dbc[_0x6b41('0x55')]]);queues[_0x525dbc['transfereeuniqueid']][_0x6b41('0x11')]=_0x525dbc['transfertargetuniqueid'];queues[_0x525dbc[_0x6b41('0x44')]]['queuecallerenterreason']=0x2;queues[_0x525dbc['transfereeuniqueid']]['calleridnum']=queues[_0x525dbc[_0x6b41('0x50')]][_0x6b41('0x8')];queues[_0x525dbc['transfereeuniqueid']][_0x6b41('0x58')]=queues[_0x525dbc[_0x6b41('0x50')]][_0x6b41('0x58')];queues[_0x525dbc[_0x6b41('0x44')]]['queuecallerjoinAt']=utils['now']();queues[_0x525dbc['transfereeuniqueid']]['queuecallerleaveAt']=utils[_0x6b41('0x16')]();queues[_0x525dbc['transfereeuniqueid']][_0x6b41('0x32')]=0x0;queues[_0x525dbc[_0x6b41('0x44')]]['mohtime']=0x0;utils[_0x6b41('0x3')](util[_0x6b41('0x4')](_0x6b41('0x59'),_0x525dbc[_0x6b41('0x4d')],queues[_0x525dbc[_0x6b41('0x44')]][_0x6b41('0x21')],queues[_0x525dbc['transfereeuniqueid']][_0x6b41('0x8')],queues[_0x525dbc[_0x6b41('0x44')]]['calleridname']));}else{utils[_0x6b41('0x3')](util['format'](_0x6b41('0x5a'),_0x525dbc[_0x6b41('0x4d')],queues[_0x525dbc[_0x6b41('0x4e')]]['name'],_0x525dbc[_0x6b41('0x50')]));queues[_0x525dbc[_0x6b41('0x4e')]]['transfereduniqueid']=_0x525dbc[_0x6b41('0x50')];}}}else if(_0x525dbc[_0x6b41('0x5b')]==_0x525dbc['secondtransfererlinkedid']){if(!_[_0x6b41('0x18')](queues[_0x525dbc[_0x6b41('0x4e')]])){utils[_0x6b41('0x3')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x525dbc[_0x6b41('0x4d')],queues[_0x525dbc[_0x6b41('0x4e')]][_0x6b41('0x21')],_0x525dbc[_0x6b41('0x5b')],_0x525dbc['secondtransfererexten']));queues[_0x525dbc[_0x6b41('0x4e')]][_0x6b41('0x3f')]=!![];queues[_0x525dbc[_0x6b41('0x4e')]][_0x6b41('0x46')]=_0x6b41('0x52');queues[_0x525dbc[_0x6b41('0x4e')]][_0x6b41('0x48')]=_0x525dbc[_0x6b41('0x5c')];queues[_0x525dbc[_0x6b41('0x4e')]][_0x6b41('0x53')]=_0x525dbc['secondtransfereruniqueid'];queues[_0x525dbc[_0x6b41('0x4e')]][_0x6b41('0xa')]=_0x6b41('0x54');}if(!_[_0x6b41('0x18')](queues[_0x525dbc[_0x6b41('0x50')]])){if(_0x525dbc['transfertargetlinkedid']&&queues[_0x525dbc[_0x6b41('0x5d')]]){queues[_0x525dbc[_0x6b41('0x5d')]][_0x6b41('0x56')]=0x1;queues[_0x525dbc[_0x6b41('0x5e')]]=_[_0x6b41('0x57')](queues[_0x525dbc[_0x6b41('0x5d')]]);queues[_0x525dbc[_0x6b41('0x5e')]]['transfereduniqueid']=_0x525dbc[_0x6b41('0x5e')];queues[_0x525dbc[_0x6b41('0x5e')]][_0x6b41('0x56')]=0x2;queues[_0x525dbc[_0x6b41('0x5e')]]['calleridnum']=queues[_0x525dbc[_0x6b41('0x4e')]]['calleridnum'];queues[_0x525dbc[_0x6b41('0x5e')]][_0x6b41('0x58')]=queues[_0x525dbc[_0x6b41('0x4e')]]['calleridname'];queues[_0x525dbc[_0x6b41('0x5e')]]['queuecallerjoinAt']=utils['now']();queues[_0x525dbc[_0x6b41('0x5e')]]['queuecallerleaveAt']=utils['now']();queues[_0x525dbc[_0x6b41('0x5e')]][_0x6b41('0x32')]=0x0;queues[_0x525dbc[_0x6b41('0x5e')]]['mohtime']=0x0;utils[_0x6b41('0x3')](util['format'](_0x6b41('0x5f'),_0x525dbc[_0x6b41('0x4d')],queues[_0x525dbc[_0x6b41('0x5e')]][_0x6b41('0x21')],queues[_0x525dbc[_0x6b41('0x5e')]][_0x6b41('0x11')],queues[_0x525dbc[_0x6b41('0x5e')]]['calleridnum'],queues[_0x525dbc['transfertargetuniqueid']][_0x6b41('0x58')]));}else{utils['info'](util[_0x6b41('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x525dbc[_0x6b41('0x4d')],queues[_0x525dbc[_0x6b41('0x50')]]['name'],_0x525dbc[_0x6b41('0x4e')]));queues[_0x525dbc[_0x6b41('0x50')]]['transfereduniqueid']=_0x525dbc[_0x6b41('0x4e')];}}}}catch(_0x425e80){utils['error'](util[_0x6b41('0x4')](_0x6b41('0x4c'),_0x525dbc[_0x6b41('0x4d')]),_0x425e80);}};exports[_0x6b41('0x60')]=function(_0xa616c8){try{if(!_[_0x6b41('0x18')](queues[_0xa616c8[_0x6b41('0x5')]])){utils[_0x6b41('0x13')](util['format']('[%s][queues][musiconholdstart]',_0xa616c8[_0x6b41('0x5')]),_0xa616c8);queues[_0xa616c8[_0x6b41('0x5')]][_0x6b41('0x61')]=utils[_0x6b41('0x16')]();utils[_0x6b41('0x3')](util['format']('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0xa616c8[_0x6b41('0x5')],queues[_0xa616c8[_0x6b41('0x5')]]['name'],queues[_0xa616c8[_0x6b41('0x5')]][_0x6b41('0x61')]));}}catch(_0x4fcc7b){utils[_0x6b41('0x17')](util[_0x6b41('0x4')](_0x6b41('0x62'),_0xa616c8[_0x6b41('0x5')]),_0x4fcc7b);}};exports['musiconholdstop']=function(_0x2b79b5){try{if(!_[_0x6b41('0x18')](queues[_0x2b79b5[_0x6b41('0x5')]])){if(!_['isNil'](queues[_0x2b79b5[_0x6b41('0x5')]]['musiconholdstartAt'])){utils[_0x6b41('0x13')](util['format']('[%s][queues][musiconholdstop]',_0x2b79b5[_0x6b41('0x5')]),_0x2b79b5);queues[_0x2b79b5[_0x6b41('0x5')]][_0x6b41('0x63')]+=utils[_0x6b41('0x33')](utils[_0x6b41('0x16')](),queues[_0x2b79b5[_0x6b41('0x5')]][_0x6b41('0x61')]);utils[_0x6b41('0x3')](util[_0x6b41('0x4')](_0x6b41('0x64'),_0x2b79b5['uniqueid'],queues[_0x2b79b5[_0x6b41('0x5')]]['name'],queues[_0x2b79b5['uniqueid']][_0x6b41('0x63')]));delete queues[_0x2b79b5[_0x6b41('0x5')]][_0x6b41('0x61')];}}}catch(_0x99045a){utils[_0x6b41('0x17')](util[_0x6b41('0x4')](_0x6b41('0x65'),_0x2b79b5[_0x6b41('0x5')]),_0x99045a);}}; \ No newline at end of file +var _0x4f43=['variable','queuestatus','value','CONTINUE','queuecallerabandonAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','queuecallerexitAt','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','diffTime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','agentcomplete','[%s][queues][agentcomplete]','queuecallercompleteAt','transfer','TRANSFER','COMPLETEDBY','reason','toUpperCase','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','[%s][queues][blindtransfer]','transfertype','BLIND','transfereeuniqueid','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfereruniqueid','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','origtransfererlinkedid','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','clone','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][musiconholdstart]','musiconholdstop','musiconholdstartAt','[%s][queues][musiconholdstop]','lodash','./utils','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','info','assign','position','now','error','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerenterreason','[%s][queues][varset]'];(function(_0x329a33,_0x585897){var _0x2bef80=function(_0x213b94){while(--_0x213b94){_0x329a33['push'](_0x329a33['shift']());}};_0x2bef80(++_0x585897);}(_0x4f43,0x187));var _0x34f4=function(_0x27dd43,_0x50ffba){_0x27dd43=_0x27dd43-0x0;var _0x46f8d7=_0x4f43[_0x27dd43];return _0x46f8d7;};'use strict';var _=require(_0x34f4('0x0'));var util=require('util');var utils=require(_0x34f4('0x1'));var queues={};function writeDB(_0x172e8f){utils['info'](util[_0x34f4('0x2')](_0x34f4('0x3'),_0x172e8f[_0x34f4('0x4')],_0x172e8f[_0x34f4('0x5')],_0x172e8f[_0x34f4('0x6')],_0x172e8f[_0x34f4('0x7')],_0x172e8f[_0x34f4('0x8')],_0x172e8f[_0x34f4('0x9')],_0x172e8f[_0x34f4('0xa')]));if(_0x172e8f[_0x34f4('0x6')]){utils[_0x34f4('0xb')](_0x172e8f[_0x34f4('0x6')])[_0x34f4('0xc')](function(_0x790c8){if(_0x790c8){_0x172e8f[_0x34f4('0xd')]=_0x790c8['type'];}utils[_0x34f4('0xe')](_0x34f4('0xf'),_0x172e8f);});}else{utils[_0x34f4('0xe')](_0x34f4('0xf'),_0x172e8f);}if(_0x172e8f[_0x34f4('0x10')]){delete queues[_0x172e8f[_0x34f4('0x10')]];}else{delete queues[_0x172e8f[_0x34f4('0x4')]];}}exports[_0x34f4('0x11')]=function(_0x5c0877){try{utils[_0x34f4('0x12')](util[_0x34f4('0x2')](_0x34f4('0x13'),_0x5c0877[_0x34f4('0x4')]),_0x5c0877);utils[_0x34f4('0x14')](util['format']('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x5c0877[_0x34f4('0x4')],_0x5c0877['queue'],_0x5c0877['position']));queues[_0x5c0877[_0x34f4('0x4')]]=_[_0x34f4('0x15')](_0x5c0877,{'originalposition':_0x5c0877[_0x34f4('0x16')],'queuecallerjoinAt':utils[_0x34f4('0x17')](),'mohtime':0x0});}catch(_0x146dd5){utils[_0x34f4('0x18')](util[_0x34f4('0x2')]('[%s][queues][queuecallerjoin]',_0x5c0877[_0x34f4('0x4')]),_0x146dd5);}};exports[_0x34f4('0x19')]=function(_0x441f2e){try{if(!_[_0x34f4('0x1a')](queues[_0x441f2e[_0x34f4('0x4')]])){utils[_0x34f4('0x12')](util[_0x34f4('0x2')](_0x34f4('0x1b'),_0x441f2e[_0x34f4('0x4')]),_0x441f2e);if(queues[_0x441f2e[_0x34f4('0x4')]][_0x34f4('0x1c')]){if(!queues[_0x441f2e['uniqueid']][_0x34f4('0x1d')]&&!queues[_0x441f2e[_0x34f4('0x4')]][_0x34f4('0x1e')]){queues[_0x441f2e[_0x34f4('0x4')]][_0x34f4('0x1f')]=!![];queues[_0x441f2e[_0x34f4('0x4')]]['queuecallercompleteAt']=utils[_0x34f4('0x17')]();queues[_0x441f2e[_0x34f4('0x4')]][_0x34f4('0xa')]=_0x34f4('0x20');}utils[_0x34f4('0x14')](util[_0x34f4('0x2')](_0x34f4('0x21'),_0x441f2e[_0x34f4('0x4')],queues[_0x441f2e['uniqueid']][_0x34f4('0x22')],queues[_0x441f2e[_0x34f4('0x4')]][_0x34f4('0xa')]));writeDB(queues[_0x441f2e[_0x34f4('0x4')]]);}else if(queues[_0x441f2e[_0x34f4('0x4')]][_0x34f4('0x10')]){utils[_0x34f4('0x14')](util[_0x34f4('0x2')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x441f2e['uniqueid'],queues[_0x441f2e[_0x34f4('0x4')]][_0x34f4('0x22')],queues[_0x441f2e[_0x34f4('0x4')]]['transfereduniqueid']));queues[queues[_0x441f2e[_0x34f4('0x4')]][_0x34f4('0x10')]]=queues[_0x441f2e['uniqueid']];queues[queues[_0x441f2e[_0x34f4('0x4')]][_0x34f4('0x10')]][_0x34f4('0x23')]=0x2;delete queues[_0x441f2e[_0x34f4('0x4')]];}}}catch(_0x12fd88){utils['error'](util[_0x34f4('0x2')]('[%s][queues][hangup]',_0x441f2e['uniqueid']),_0x12fd88);}};exports['varset']=function(_0x26fc3b){try{utils['debug'](util[_0x34f4('0x2')](_0x34f4('0x24'),_0x26fc3b['uniqueid']),_0x26fc3b);if(!_[_0x34f4('0x1a')](_0x26fc3b[_0x34f4('0x25')][_0x34f4('0x26')])&&_0x26fc3b[_0x34f4('0x27')]['toUpperCase']()!==_0x34f4('0x28')){if(!_[_0x34f4('0x1a')](queues[_0x26fc3b[_0x34f4('0x4')]])){queues[_0x26fc3b[_0x34f4('0x4')]][_0x34f4('0x1d')]=![];queues[_0x26fc3b[_0x34f4('0x4')]][_0x34f4('0x29')]=null;queues[_0x26fc3b[_0x34f4('0x4')]]['queuecallerexit']=!![];queues[_0x26fc3b[_0x34f4('0x4')]]['queuecallerexitAt']=utils[_0x34f4('0x17')]();queues[_0x26fc3b['uniqueid']][_0x34f4('0xa')]=_0x26fc3b[_0x34f4('0x27')]['toUpperCase']();utils['info'](util[_0x34f4('0x2')](_0x34f4('0x2a'),_0x26fc3b[_0x34f4('0x4')],queues[_0x26fc3b['uniqueid']][_0x34f4('0x22')],_0x26fc3b[_0x34f4('0x27')],queues[_0x26fc3b[_0x34f4('0x4')]][_0x34f4('0xa')]));writeDB(queues[_0x26fc3b[_0x34f4('0x4')]]);}}else if(!_[_0x34f4('0x1a')](_0x26fc3b[_0x34f4('0x25')][_0x34f4('0x2b')])){if(!_['isNil'](queues[_0x26fc3b[_0x34f4('0x4')]])&&!queues[_0x26fc3b[_0x34f4('0x4')]][_0x34f4('0x1d')]){queues[_0x26fc3b[_0x34f4('0x4')]]['queuecallerabandon']=![];queues[_0x26fc3b[_0x34f4('0x4')]][_0x34f4('0x29')]=null;queues[_0x26fc3b[_0x34f4('0x4')]]['queuecallerexit']=!![];queues[_0x26fc3b[_0x34f4('0x4')]][_0x34f4('0x2c')]=utils[_0x34f4('0x17')]();queues[_0x26fc3b['uniqueid']][_0x34f4('0xa')]=_0x34f4('0x2d');utils[_0x34f4('0x14')](util[_0x34f4('0x2')](_0x34f4('0x2e'),_0x26fc3b[_0x34f4('0x4')],queues[_0x26fc3b[_0x34f4('0x4')]][_0x34f4('0x22')],_0x26fc3b[_0x34f4('0x27')],queues[_0x26fc3b[_0x34f4('0x4')]][_0x34f4('0xa')]));}}}catch(_0x5311d9){utils[_0x34f4('0x18')](util[_0x34f4('0x2')]('[%s][queues][varset]',_0x26fc3b[_0x34f4('0x4')]),_0x5311d9);}};exports[_0x34f4('0x1d')]=function(_0x27bcff){try{if(!_[_0x34f4('0x1a')](queues[_0x27bcff[_0x34f4('0x4')]])){utils[_0x34f4('0x12')](util[_0x34f4('0x2')]('[%s][queues][queuecallerabandon]',_0x27bcff[_0x34f4('0x4')]),_0x27bcff);queues[_0x27bcff[_0x34f4('0x4')]]['queuecallerexit']=![];queues[_0x27bcff[_0x34f4('0x4')]][_0x34f4('0x2c')]=null;queues[_0x27bcff[_0x34f4('0x4')]][_0x34f4('0x1d')]=!![];queues[_0x27bcff[_0x34f4('0x4')]][_0x34f4('0x29')]=utils[_0x34f4('0x17')]();queues[_0x27bcff[_0x34f4('0x4')]][_0x34f4('0xa')]=_0x34f4('0x2f');utils['info'](util[_0x34f4('0x2')](_0x34f4('0x30'),_0x27bcff[_0x34f4('0x4')],queues[_0x27bcff[_0x34f4('0x4')]][_0x34f4('0x22')],queues[_0x27bcff['uniqueid']][_0x34f4('0xa')]));}}catch(_0xab2424){utils[_0x34f4('0x18')](util[_0x34f4('0x2')](_0x34f4('0x31'),_0x27bcff[_0x34f4('0x4')]),_0xab2424);}};exports[_0x34f4('0x32')]=function(_0x12353e){try{if(!_[_0x34f4('0x1a')](queues[_0x12353e[_0x34f4('0x4')]])){utils[_0x34f4('0x12')](util[_0x34f4('0x2')](_0x34f4('0x33'),_0x12353e['uniqueid']),_0x12353e);utils['info'](util[_0x34f4('0x2')](_0x34f4('0x34'),_0x12353e[_0x34f4('0x4')],queues[_0x12353e[_0x34f4('0x4')]][_0x34f4('0x22')],_0x12353e[_0x34f4('0x35')],_0x12353e[_0x34f4('0x36')]));queues[_0x12353e['uniqueid']][_0x34f4('0x32')]=!![];queues[_0x12353e[_0x34f4('0x4')]][_0x34f4('0x1c')]=utils['now']();queues[_0x12353e['uniqueid']][_0x34f4('0x37')]=utils[_0x34f4('0x38')](queues[_0x12353e[_0x34f4('0x4')]][_0x34f4('0x1c')],queues[_0x12353e[_0x34f4('0x4')]][_0x34f4('0x39')]);queues[_0x12353e['uniqueid']][_0x34f4('0x16')]=_0x12353e[_0x34f4('0x16')];queues[_0x12353e[_0x34f4('0x4')]][_0x34f4('0x3a')]=_0x12353e[_0x34f4('0x3a')];queues[_0x12353e['uniqueid']][_0x34f4('0x35')]=_0x12353e['connectedlinenum'];queues[_0x12353e['uniqueid']][_0x34f4('0x36')]=_0x12353e[_0x34f4('0x36')];}}catch(_0x2aadb8){utils[_0x34f4('0x18')](util[_0x34f4('0x2')]('[%s][queues][queuecallerleave]',_0x12353e[_0x34f4('0x4')]),_0x2aadb8);}};exports[_0x34f4('0x3b')]=function(_0x357765){try{if(!_[_0x34f4('0x1a')](queues[_0x357765['uniqueid']])){utils[_0x34f4('0x12')](util[_0x34f4('0x2')](_0x34f4('0x3c'),_0x357765[_0x34f4('0x4')]),_0x357765);utils[_0x34f4('0x14')](util['format'](_0x34f4('0x3d'),_0x357765[_0x34f4('0x4')],queues[_0x357765['uniqueid']][_0x34f4('0x22')],_0x357765[_0x34f4('0x3e')],_0x357765[_0x34f4('0x3f')]));queues[_0x357765[_0x34f4('0x4')]][_0x34f4('0x1d')]=![];queues[_0x357765[_0x34f4('0x4')]][_0x34f4('0x1d')]=![];queues[_0x357765[_0x34f4('0x4')]]['queuecallerabandonAt']=null;queues[_0x357765[_0x34f4('0x4')]]['queuecallerexit']=![];queues[_0x357765[_0x34f4('0x4')]][_0x34f4('0xa')]=null;queues[_0x357765['uniqueid']]['queuecallerexitAt']=null;queues[_0x357765[_0x34f4('0x4')]][_0x34f4('0x40')]=!![];queues[_0x357765[_0x34f4('0x4')]][_0x34f4('0x9')]=_0x357765[_0x34f4('0x3f')];queues[_0x357765[_0x34f4('0x4')]]['lastAssignedTo']=_0x357765[_0x34f4('0x3e')];}}catch(_0xe2d4b){utils[_0x34f4('0x18')](util[_0x34f4('0x2')](_0x34f4('0x3c'),_0x357765[_0x34f4('0x4')]),_0xe2d4b);}};exports[_0x34f4('0x41')]=function(_0x279eaa){try{if(!_[_0x34f4('0x1a')](queues[_0x279eaa[_0x34f4('0x4')]])){if(queues[_0x279eaa[_0x34f4('0x4')]][_0x34f4('0x1c')]){utils[_0x34f4('0x12')](util['format'](_0x34f4('0x42'),_0x279eaa[_0x34f4('0x4')]),_0x279eaa);queues[_0x279eaa['uniqueid']][_0x34f4('0x1d')]=![];queues[_0x279eaa['uniqueid']][_0x34f4('0x1d')]=![];queues[_0x279eaa[_0x34f4('0x4')]][_0x34f4('0x29')]=null;queues[_0x279eaa['uniqueid']][_0x34f4('0x1e')]=![];queues[_0x279eaa[_0x34f4('0x4')]]['queuecallerexitAt']=null;queues[_0x279eaa[_0x34f4('0x4')]]['assigned']=!![];queues[_0x279eaa['uniqueid']]['lastAssignedTo']=_0x279eaa[_0x34f4('0x3e')];queues[_0x279eaa[_0x34f4('0x4')]][_0x34f4('0x1f')]=!![];queues[_0x279eaa[_0x34f4('0x4')]][_0x34f4('0x43')]=utils[_0x34f4('0x17')]();if(_0x279eaa['reason']==_0x34f4('0x44')){if(!queues[_0x279eaa[_0x34f4('0x4')]][_0x34f4('0x44')]){queues[_0x279eaa['uniqueid']][_0x34f4('0xa')]=_0x34f4('0x45');}}else{queues[_0x279eaa['uniqueid']][_0x34f4('0xa')]=_0x34f4('0x46')+_0x279eaa[_0x34f4('0x47')][_0x34f4('0x48')]();}utils['info'](util[_0x34f4('0x2')](_0x34f4('0x49'),_0x279eaa[_0x34f4('0x4')],queues[_0x279eaa[_0x34f4('0x4')]][_0x34f4('0x22')],_0x279eaa[_0x34f4('0x3e')],queues[_0x279eaa[_0x34f4('0x4')]][_0x34f4('0xa')]));writeDB(queues[_0x279eaa[_0x34f4('0x4')]]);}}}catch(_0x1be7e8){utils[_0x34f4('0x18')](util[_0x34f4('0x2')](_0x34f4('0x42'),_0x279eaa[_0x34f4('0x4')]),_0x1be7e8);}};exports[_0x34f4('0x4a')]=function(_0x4e3529){try{if(!_[_0x34f4('0x1a')](queues[_0x4e3529['transfereeuniqueid']])){utils[_0x34f4('0x12')](util['format'](_0x34f4('0x4b'),_0x4e3529[_0x34f4('0x4')]),_0x4e3529);queues[_0x4e3529['transfereeuniqueid']][_0x34f4('0x44')]=!![];queues[_0x4e3529['transfereeuniqueid']][_0x34f4('0x4c')]=_0x34f4('0x4d');queues[_0x4e3529[_0x34f4('0x4e')]][_0x34f4('0x4f')]=_0x4e3529[_0x34f4('0x50')];queues[_0x4e3529[_0x34f4('0x4e')]][_0x34f4('0x51')]=_0x4e3529[_0x34f4('0x4e')];queues[_0x4e3529[_0x34f4('0x4e')]][_0x34f4('0xa')]=_0x34f4('0x52');utils[_0x34f4('0x14')](util['format'](_0x34f4('0x53'),_0x4e3529[_0x34f4('0x4')],queues[_0x4e3529[_0x34f4('0x4e')]][_0x34f4('0x22')],_0x4e3529[_0x34f4('0x4e')],_0x4e3529[_0x34f4('0x50')]));}}catch(_0x457434){utils[_0x34f4('0x18')](util[_0x34f4('0x2')](_0x34f4('0x4b'),_0x4e3529[_0x34f4('0x4')]),_0x457434);}};exports[_0x34f4('0x54')]=function(_0x3dfb4c){try{utils[_0x34f4('0x12')](util['format'](_0x34f4('0x55'),_0x3dfb4c['origtransfereruniqueid']),_0x3dfb4c);if(_0x3dfb4c['origtransfereruniqueid']==_0x3dfb4c['origtransfererlinkedid']){if(!_[_0x34f4('0x1a')](queues[_0x3dfb4c[_0x34f4('0x56')]])){utils['info'](util[_0x34f4('0x2')](_0x34f4('0x57'),_0x3dfb4c[_0x34f4('0x58')],queues[_0x3dfb4c[_0x34f4('0x56')]][_0x34f4('0x22')],_0x3dfb4c[_0x34f4('0x59')]));queues[_0x3dfb4c[_0x34f4('0x56')]][_0x34f4('0x44')]=!![];queues[_0x3dfb4c['secondtransfererlinkedid']][_0x34f4('0x4c')]=_0x34f4('0x5a');queues[_0x3dfb4c[_0x34f4('0x56')]][_0x34f4('0x4f')]=_0x3dfb4c['origtransfererexten'];queues[_0x3dfb4c[_0x34f4('0x56')]][_0x34f4('0x51')]=_0x3dfb4c[_0x34f4('0x58')];queues[_0x3dfb4c[_0x34f4('0x56')]][_0x34f4('0xa')]=_0x34f4('0x5b');}if(!_['isNil'](queues[_0x3dfb4c['origtransfererlinkedid']])){if(_0x3dfb4c['transfereelinkedid']&&queues[_0x3dfb4c[_0x34f4('0x5c')]]){queues[_0x3dfb4c[_0x34f4('0x5c')]][_0x34f4('0x23')]=0x1;queues[_0x3dfb4c['transfereeuniqueid']]=_['clone'](queues[_0x3dfb4c[_0x34f4('0x5c')]]);queues[_0x3dfb4c[_0x34f4('0x4e')]][_0x34f4('0x10')]=_0x3dfb4c[_0x34f4('0x5d')];queues[_0x3dfb4c[_0x34f4('0x4e')]][_0x34f4('0x23')]=0x2;queues[_0x3dfb4c[_0x34f4('0x4e')]]['calleridnum']=queues[_0x3dfb4c[_0x34f4('0x56')]]['calleridnum'];queues[_0x3dfb4c['transfereeuniqueid']]['calleridname']=queues[_0x3dfb4c[_0x34f4('0x56')]][_0x34f4('0x5e')];queues[_0x3dfb4c[_0x34f4('0x4e')]][_0x34f4('0x39')]=utils['now']();queues[_0x3dfb4c[_0x34f4('0x4e')]][_0x34f4('0x1c')]=utils['now']();queues[_0x3dfb4c[_0x34f4('0x4e')]]['holdtime']=0x0;queues[_0x3dfb4c[_0x34f4('0x4e')]][_0x34f4('0x5f')]=0x0;utils[_0x34f4('0x14')](util[_0x34f4('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x3dfb4c[_0x34f4('0x58')],queues[_0x3dfb4c[_0x34f4('0x4e')]][_0x34f4('0x22')],queues[_0x3dfb4c[_0x34f4('0x4e')]][_0x34f4('0x8')],queues[_0x3dfb4c[_0x34f4('0x4e')]][_0x34f4('0x5e')]));}else{utils[_0x34f4('0x14')](util['format'](_0x34f4('0x60'),_0x3dfb4c[_0x34f4('0x58')],queues[_0x3dfb4c['origtransfererlinkedid']][_0x34f4('0x22')],_0x3dfb4c['secondtransfererlinkedid']));queues[_0x3dfb4c[_0x34f4('0x61')]][_0x34f4('0x10')]=_0x3dfb4c[_0x34f4('0x56')];}}}else if(_0x3dfb4c[_0x34f4('0x62')]==_0x3dfb4c[_0x34f4('0x56')]){if(!_[_0x34f4('0x1a')](queues[_0x3dfb4c[_0x34f4('0x61')]])){utils[_0x34f4('0x14')](util[_0x34f4('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x3dfb4c[_0x34f4('0x58')],queues[_0x3dfb4c[_0x34f4('0x61')]][_0x34f4('0x22')],_0x3dfb4c['secondtransfereruniqueid'],_0x3dfb4c[_0x34f4('0x63')]));queues[_0x3dfb4c[_0x34f4('0x61')]]['transfer']=!![];queues[_0x3dfb4c[_0x34f4('0x61')]][_0x34f4('0x4c')]='ATTENDED';queues[_0x3dfb4c[_0x34f4('0x61')]][_0x34f4('0x4f')]=_0x3dfb4c['secondtransfererexten'];queues[_0x3dfb4c[_0x34f4('0x61')]]['transferuniqueid']=_0x3dfb4c[_0x34f4('0x62')];queues[_0x3dfb4c[_0x34f4('0x61')]][_0x34f4('0xa')]=_0x34f4('0x5b');}if(!_[_0x34f4('0x1a')](queues[_0x3dfb4c[_0x34f4('0x56')]])){if(_0x3dfb4c['transfertargetlinkedid']&&queues[_0x3dfb4c['transfertargetlinkedid']]){queues[_0x3dfb4c[_0x34f4('0x64')]][_0x34f4('0x23')]=0x1;queues[_0x3dfb4c[_0x34f4('0x5d')]]=_[_0x34f4('0x65')](queues[_0x3dfb4c['transfertargetlinkedid']]);queues[_0x3dfb4c[_0x34f4('0x5d')]]['transfereduniqueid']=_0x3dfb4c['transfertargetuniqueid'];queues[_0x3dfb4c['transfertargetuniqueid']][_0x34f4('0x23')]=0x2;queues[_0x3dfb4c[_0x34f4('0x5d')]][_0x34f4('0x8')]=queues[_0x3dfb4c['origtransfererlinkedid']][_0x34f4('0x8')];queues[_0x3dfb4c['transfertargetuniqueid']][_0x34f4('0x5e')]=queues[_0x3dfb4c['origtransfererlinkedid']][_0x34f4('0x5e')];queues[_0x3dfb4c[_0x34f4('0x5d')]][_0x34f4('0x39')]=utils['now']();queues[_0x3dfb4c[_0x34f4('0x5d')]][_0x34f4('0x1c')]=utils[_0x34f4('0x17')]();queues[_0x3dfb4c['transfertargetuniqueid']][_0x34f4('0x37')]=0x0;queues[_0x3dfb4c[_0x34f4('0x5d')]][_0x34f4('0x5f')]=0x0;utils['info'](util['format'](_0x34f4('0x66'),_0x3dfb4c[_0x34f4('0x58')],queues[_0x3dfb4c[_0x34f4('0x5d')]]['name'],queues[_0x3dfb4c['transfertargetuniqueid']][_0x34f4('0x10')],queues[_0x3dfb4c['transfertargetuniqueid']]['calleridnum'],queues[_0x3dfb4c[_0x34f4('0x5d')]]['calleridname']));}else{utils[_0x34f4('0x14')](util['format'](_0x34f4('0x60'),_0x3dfb4c['origtransfereruniqueid'],queues[_0x3dfb4c[_0x34f4('0x56')]][_0x34f4('0x22')],_0x3dfb4c[_0x34f4('0x61')]));queues[_0x3dfb4c[_0x34f4('0x56')]][_0x34f4('0x10')]=_0x3dfb4c[_0x34f4('0x61')];}}}}catch(_0x2a90ac){utils[_0x34f4('0x18')](util['format'](_0x34f4('0x55'),_0x3dfb4c[_0x34f4('0x58')]),_0x2a90ac);}};exports['musiconholdstart']=function(_0x514480){try{if(!_[_0x34f4('0x1a')](queues[_0x514480['uniqueid']])){utils[_0x34f4('0x12')](util[_0x34f4('0x2')](_0x34f4('0x67'),_0x514480[_0x34f4('0x4')]),_0x514480);queues[_0x514480[_0x34f4('0x4')]]['musiconholdstartAt']=utils[_0x34f4('0x17')]();utils[_0x34f4('0x14')](util['format']('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x514480[_0x34f4('0x4')],queues[_0x514480[_0x34f4('0x4')]][_0x34f4('0x22')],queues[_0x514480['uniqueid']]['musiconholdstartAt']));}}catch(_0xd39f2c){utils[_0x34f4('0x18')](util[_0x34f4('0x2')]('[%s][queues][musiconholdstart]',_0x514480[_0x34f4('0x4')]),_0xd39f2c);}};exports[_0x34f4('0x68')]=function(_0x5e4a96){try{if(!_[_0x34f4('0x1a')](queues[_0x5e4a96[_0x34f4('0x4')]])){if(!_['isNil'](queues[_0x5e4a96['uniqueid']][_0x34f4('0x69')])){utils['debug'](util['format'](_0x34f4('0x6a'),_0x5e4a96[_0x34f4('0x4')]),_0x5e4a96);queues[_0x5e4a96[_0x34f4('0x4')]][_0x34f4('0x5f')]+=utils[_0x34f4('0x38')](utils[_0x34f4('0x17')](),queues[_0x5e4a96[_0x34f4('0x4')]]['musiconholdstartAt']);utils['info'](util['format']('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x5e4a96['uniqueid'],queues[_0x5e4a96[_0x34f4('0x4')]][_0x34f4('0x22')],queues[_0x5e4a96[_0x34f4('0x4')]][_0x34f4('0x5f')]));delete queues[_0x5e4a96['uniqueid']]['musiconholdstartAt'];}}}catch(_0x5212c7){utils['error'](util[_0x34f4('0x2')](_0x34f4('0x6a'),_0x5e4a96[_0x34f4('0x4')]),_0x5212c7);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 178897c..681ba3f 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 _0x535d=['uniqueid','accountcode','getUserByInternal','then','membername','name','CreateVoiceRecording','request','newchannel','debug','format','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','variable','[%s][recordings][varset]','value','.wav49','replace','.WAV','find','monitors','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','clone','newexten','[%s][recordings][newexten]','application','appdata','set','startsWith','toLowerCase','cdr','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','info','[%s][recordings][writeDB]'];(function(_0x189b3b,_0x484de8){var _0x7c4721=function(_0x1ca32b){while(--_0x1ca32b){_0x189b3b['push'](_0x189b3b['shift']());}};_0x7c4721(++_0x484de8);}(_0x535d,0x1eb));var _0xd535=function(_0x1e90cb,_0x20466e){_0x1e90cb=_0x1e90cb-0x0;var _0x23d611=_0x535d[_0x1e90cb];return _0x23d611;};'use strict';var _=require(_0xd535('0x0'));var util=require(_0xd535('0x1'));var utils=require(_0xd535('0x2'));var recordings={};function writeDB(_0x288754){utils[_0xd535('0x3')](util['format'](_0xd535('0x4'),_0x288754[_0xd535('0x5')]));if(_0x288754[_0xd535('0x6')]){utils[_0xd535('0x7')](_0x288754[_0xd535('0x6')])[_0xd535('0x8')](function(_0x19126e){if(_0x19126e){_0x288754[_0xd535('0x9')]=_0x19126e[_0xd535('0xa')];_0x288754['UserId']=_0x19126e['id'];}utils['request'](_0xd535('0xb'),_0x288754);});}else{utils[_0xd535('0xc')](_0xd535('0xb'),_0x288754);}}exports[_0xd535('0xd')]=function(_0x349ba6){try{utils[_0xd535('0xe')](util[_0xd535('0xf')](_0xd535('0x10'),_0x349ba6[_0xd535('0x5')]),_0x349ba6);if(_0x349ba6[_0xd535('0x5')]==_0x349ba6[_0xd535('0x11')]){utils[_0xd535('0x3')](util[_0xd535('0xf')](_0xd535('0x12'),_0x349ba6[_0xd535('0x5')],_0x349ba6[_0xd535('0x13')],_0x349ba6[_0xd535('0x14')]));recordings[_0x349ba6[_0xd535('0x5')]]={'uniqueid':_0x349ba6[_0xd535('0x5')],'accountcode':_0x349ba6[_0xd535('0x6')],'exten':_0x349ba6[_0xd535('0x14')],'context':_0x349ba6[_0xd535('0x13')],'channel':_0x349ba6[_0xd535('0x15')],'monitors':[]};}}catch(_0x29f130){utils[_0xd535('0x16')](util[_0xd535('0xf')](_0xd535('0x10'),_0x349ba6[_0xd535('0x5')]),_0x29f130);}};exports[_0xd535('0x17')]=function(_0x35f5d0){try{utils['debug'](util['format'](_0xd535('0x18'),_0x35f5d0['uniqueid']),_0x35f5d0);if(!_[_0xd535('0x19')](recordings[_0x35f5d0['uniqueid']])&&_0x35f5d0[_0xd535('0x1a')]==0x6){utils[_0xd535('0x3')](util[_0xd535('0xf')](_0xd535('0x1b'),_0x35f5d0['uniqueid'],_0x35f5d0['context'],_0x35f5d0['channel']));}else if(!_[_0xd535('0x19')](recordings[_0x35f5d0['linkedid']])&&_0x35f5d0[_0xd535('0x1a')]==0x6&&_0x35f5d0[_0xd535('0x13')]!=_0xd535('0x1c')){utils['info'](util[_0xd535('0xf')](_0xd535('0x1d'),_0x35f5d0[_0xd535('0x5')],_0x35f5d0[_0xd535('0x11')],_0x35f5d0[_0xd535('0x13')],_0x35f5d0[_0xd535('0x15')]));recordings[_0x35f5d0['linkedid']][_0xd535('0x6')]=_0x35f5d0[_0xd535('0x6')];}}catch(_0x36c5f7){utils['error'](util[_0xd535('0xf')](_0xd535('0x18'),_0x35f5d0[_0xd535('0x5')]),_0x36c5f7);}};exports['varset']=function(_0x2f2a94){try{if(!_[_0xd535('0x19')](_0x2f2a94['variable'])&&!_[_0xd535('0x19')](_0x2f2a94[_0xd535('0x1e')]['mixmonitor_filename'])){utils[_0xd535('0xe')](util[_0xd535('0xf')](_0xd535('0x1f'),_0x2f2a94[_0xd535('0x5')]),_0x2f2a94);utils[_0xd535('0x3')](util[_0xd535('0xf')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x2f2a94[_0xd535('0x5')],_0x2f2a94['variable'],_0x2f2a94[_0xd535('0x20')]));if(_['endsWith'](_0x2f2a94[_0xd535('0x20')],_0xd535('0x21'))){_0x2f2a94[_0xd535('0x20')]=_0x2f2a94[_0xd535('0x20')][_0xd535('0x22')](_0xd535('0x21'),_0xd535('0x23'));}if(recordings[_0x2f2a94['linkedid']]){var _0x253c76=_[_0xd535('0x24')](recordings[_0x2f2a94[_0xd535('0x11')]][_0xd535('0x25')],{'value':_0x2f2a94['value']});if(_['isNil'](_0x253c76)){recordings[_0x2f2a94['linkedid']][_0xd535('0x25')]['push']({'value':_0x2f2a94[_0xd535('0x20')]});}}}}catch(_0x101846){utils['error'](util[_0xd535('0xf')]('[%s][recordings][varset]',_0x2f2a94[_0xd535('0x5')]),_0x101846);}};exports[_0xd535('0x26')]=function(_0x5cb6ff){try{if(!_[_0xd535('0x19')](recordings[_0x5cb6ff[_0xd535('0x5')]])){utils[_0xd535('0xe')](util[_0xd535('0xf')](_0xd535('0x27'),_0x5cb6ff[_0xd535('0x5')]),_0x5cb6ff);utils['info'](util[_0xd535('0xf')](_0xd535('0x28'),_0x5cb6ff[_0xd535('0x5')],_0x5cb6ff[_0xd535('0x29')],_0x5cb6ff[_0xd535('0x2a')],_0x5cb6ff[_0xd535('0x2b')]));recordings[_0x5cb6ff[_0xd535('0x5')]][_0xd535('0x29')]=_0x5cb6ff[_0xd535('0x29')];recordings[_0x5cb6ff[_0xd535('0x5')]][_0xd535('0x2a')]=_0x5cb6ff[_0xd535('0x2a')];recordings[_0x5cb6ff[_0xd535('0x5')]]['connectedlinenum']=_0x5cb6ff[_0xd535('0x2c')];recordings[_0x5cb6ff[_0xd535('0x5')]][_0xd535('0x2d')]=_0x5cb6ff[_0xd535('0x2d')];if(recordings[_0x5cb6ff[_0xd535('0x5')]][_0xd535('0x2e')]=='outbound'&&recordings[_0x5cb6ff[_0xd535('0x5')]][_0xd535('0x6')]){recordings[_0x5cb6ff[_0xd535('0x5')]][_0xd535('0x2c')]=recordings[_0x5cb6ff[_0xd535('0x5')]]['accountcode'];recordings[_0x5cb6ff[_0xd535('0x5')]][_0xd535('0x2d')]='';}recordings[_0x5cb6ff['uniqueid']][_0xd535('0x25')]['forEach'](function(_0x7f0a6e){var _0x52f658=_[_0xd535('0x2f')](recordings[_0x5cb6ff[_0xd535('0x5')]]);_0x52f658['value']=_0x7f0a6e[_0xd535('0x20')];writeDB(_0x52f658);});delete recordings[_0x5cb6ff[_0xd535('0x5')]];}}catch(_0x2f42df){utils[_0xd535('0x16')](util[_0xd535('0xf')](_0xd535('0x27'),_0x5cb6ff['uniqueid']),_0x2f42df);}};exports[_0xd535('0x30')]=function(_0x3358d3){try{if(!_[_0xd535('0x19')](recordings[_0x3358d3[_0xd535('0x5')]])){utils['debug'](util['format'](_0xd535('0x31'),_0x3358d3[_0xd535('0x5')]),_0x3358d3);utils[_0xd535('0x3')](util[_0xd535('0xf')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x3358d3[_0xd535('0x5')],_0x3358d3[_0xd535('0x32')],_0x3358d3[_0xd535('0x33')]));if(_0x3358d3[_0xd535('0x32')]['toLowerCase']()==_0xd535('0x34')&&_[_0xd535('0x35')](_0x3358d3['appdata'][_0xd535('0x36')](),_0xd535('0x37'))){var _0x4c3bc3=_0x3358d3[_0xd535('0x33')]['split']('=');var _0x5315b2=_0x4c3bc3[0x0][_0xd535('0x38')](_0x4c3bc3[0x0][_0xd535('0x39')]('(')+0x1,_0x4c3bc3[0x0][_0xd535('0x39')](')'));var _0x52a0ab=_0x4c3bc3[0x1];recordings[_0x3358d3['uniqueid']][_0x5315b2]=_0x52a0ab;}}}catch(_0x3df3f9){utils['error'](util[_0xd535('0xf')]('[%s][recordings][newexten]',_0x3358d3[_0xd535('0x5')]),_0x3df3f9);}};exports[_0xd535('0x3a')]=function(_0x3f25a8){try{if(!_['isNil'](recordings[_0x3f25a8[_0xd535('0x5')]])){utils[_0xd535('0xe')](util[_0xd535('0xf')](_0xd535('0x3b'),_0x3f25a8[_0xd535('0x5')]),_0x3f25a8);utils[_0xd535('0x3')](util[_0xd535('0xf')](_0xd535('0x3c'),_0x3f25a8[_0xd535('0x5')],_0x3f25a8[_0xd535('0x3d')]));recordings[_0x3f25a8[_0xd535('0x5')]][_0xd535('0x3d')]=_0x3f25a8[_0xd535('0x3d')];}}catch(_0x3a96ce){utils['error'](util[_0xd535('0xf')]('[%s][recordings][queuecallerjoin]',_0x3f25a8[_0xd535('0x5')]),_0x3a96ce);}}; \ No newline at end of file +var _0xfc88=['calleridname','cause-txt','connectedlinename','type','outbound','connectedlinenum','clone','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','startsWith','cdr','substring','lastIndexOf','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','info','accountcode','getUserByInternal','then','membername','UserId','CreateVoiceRecording','request','newchannel','debug','format','uniqueid','linkedid','context','exten','channel','error','[%s][recordings][newchannel]','newstate','[%s][recordings][newstate]','isNil','channelstate','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','.WAV','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum'];(function(_0x3c0df9,_0x1bd56e){var _0xc0bffe=function(_0x52e798){while(--_0x52e798){_0x3c0df9['push'](_0x3c0df9['shift']());}};_0xc0bffe(++_0x1bd56e);}(_0xfc88,0xca));var _0x8fc8=function(_0x19dd84,_0x21a62c){_0x19dd84=_0x19dd84-0x0;var _0x2c4682=_0xfc88[_0x19dd84];return _0x2c4682;};'use strict';var _=require(_0x8fc8('0x0'));var util=require(_0x8fc8('0x1'));var utils=require('./utils');var recordings={};function writeDB(_0x3fc4c9){utils[_0x8fc8('0x2')](util['format']('[%s][recordings][writeDB]',_0x3fc4c9['uniqueid']));if(_0x3fc4c9[_0x8fc8('0x3')]){utils[_0x8fc8('0x4')](_0x3fc4c9[_0x8fc8('0x3')])[_0x8fc8('0x5')](function(_0x3eaa32){if(_0x3eaa32){_0x3fc4c9[_0x8fc8('0x6')]=_0x3eaa32['name'];_0x3fc4c9[_0x8fc8('0x7')]=_0x3eaa32['id'];}utils['request'](_0x8fc8('0x8'),_0x3fc4c9);});}else{utils[_0x8fc8('0x9')]('CreateVoiceRecording',_0x3fc4c9);}}exports[_0x8fc8('0xa')]=function(_0x3f8518){try{utils[_0x8fc8('0xb')](util[_0x8fc8('0xc')]('[%s][recordings][newchannel]',_0x3f8518[_0x8fc8('0xd')]),_0x3f8518);if(_0x3f8518[_0x8fc8('0xd')]==_0x3f8518[_0x8fc8('0xe')]){utils[_0x8fc8('0x2')](util[_0x8fc8('0xc')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x3f8518['uniqueid'],_0x3f8518[_0x8fc8('0xf')],_0x3f8518[_0x8fc8('0x10')]));recordings[_0x3f8518[_0x8fc8('0xd')]]={'uniqueid':_0x3f8518[_0x8fc8('0xd')],'accountcode':_0x3f8518[_0x8fc8('0x3')],'exten':_0x3f8518[_0x8fc8('0x10')],'context':_0x3f8518[_0x8fc8('0xf')],'channel':_0x3f8518[_0x8fc8('0x11')],'monitors':[]};}}catch(_0x28d74d){utils[_0x8fc8('0x12')](util[_0x8fc8('0xc')](_0x8fc8('0x13'),_0x3f8518['uniqueid']),_0x28d74d);}};exports[_0x8fc8('0x14')]=function(_0x1e0211){try{utils[_0x8fc8('0xb')](util[_0x8fc8('0xc')](_0x8fc8('0x15'),_0x1e0211[_0x8fc8('0xd')]),_0x1e0211);if(!_[_0x8fc8('0x16')](recordings[_0x1e0211[_0x8fc8('0xd')]])&&_0x1e0211[_0x8fc8('0x17')]==0x6){utils['info'](util[_0x8fc8('0xc')]('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x1e0211[_0x8fc8('0xd')],_0x1e0211['context'],_0x1e0211[_0x8fc8('0x11')]));}else if(!_[_0x8fc8('0x16')](recordings[_0x1e0211['linkedid']])&&_0x1e0211['channelstate']==0x6&&_0x1e0211['context']!=_0x8fc8('0x18')){utils[_0x8fc8('0x2')](util[_0x8fc8('0xc')](_0x8fc8('0x19'),_0x1e0211[_0x8fc8('0xd')],_0x1e0211[_0x8fc8('0xe')],_0x1e0211[_0x8fc8('0xf')],_0x1e0211[_0x8fc8('0x11')]));recordings[_0x1e0211[_0x8fc8('0xe')]][_0x8fc8('0x3')]=_0x1e0211['accountcode'];}}catch(_0x4e9dbe){utils[_0x8fc8('0x12')](util[_0x8fc8('0xc')](_0x8fc8('0x15'),_0x1e0211[_0x8fc8('0xd')]),_0x4e9dbe);}};exports[_0x8fc8('0x1a')]=function(_0x2ec5a0){try{if(!_['isNil'](_0x2ec5a0['variable'])&&!_[_0x8fc8('0x16')](_0x2ec5a0[_0x8fc8('0x1b')][_0x8fc8('0x1c')])){utils[_0x8fc8('0xb')](util[_0x8fc8('0xc')](_0x8fc8('0x1d'),_0x2ec5a0[_0x8fc8('0xd')]),_0x2ec5a0);utils[_0x8fc8('0x2')](util[_0x8fc8('0xc')](_0x8fc8('0x1e'),_0x2ec5a0[_0x8fc8('0xd')],_0x2ec5a0[_0x8fc8('0x1b')],_0x2ec5a0[_0x8fc8('0x1f')]));if(_[_0x8fc8('0x20')](_0x2ec5a0['value'],_0x8fc8('0x21'))){_0x2ec5a0[_0x8fc8('0x1f')]=_0x2ec5a0[_0x8fc8('0x1f')][_0x8fc8('0x22')](_0x8fc8('0x21'),_0x8fc8('0x23'));}if(recordings[_0x2ec5a0[_0x8fc8('0xe')]]){var _0x4c3498=_['find'](recordings[_0x2ec5a0['linkedid']][_0x8fc8('0x24')],{'value':_0x2ec5a0['value']});if(_[_0x8fc8('0x16')](_0x4c3498)){recordings[_0x2ec5a0[_0x8fc8('0xe')]]['monitors'][_0x8fc8('0x25')]({'value':_0x2ec5a0[_0x8fc8('0x1f')]});}}}}catch(_0x16ac66){utils[_0x8fc8('0x12')](util[_0x8fc8('0xc')](_0x8fc8('0x1d'),_0x2ec5a0[_0x8fc8('0xd')]),_0x16ac66);}};exports[_0x8fc8('0x26')]=function(_0x13809a){try{if(!_[_0x8fc8('0x16')](recordings[_0x13809a['uniqueid']])){utils['debug'](util[_0x8fc8('0xc')](_0x8fc8('0x27'),_0x13809a['uniqueid']),_0x13809a);utils[_0x8fc8('0x2')](util['format'](_0x8fc8('0x28'),_0x13809a[_0x8fc8('0xd')],_0x13809a[_0x8fc8('0x29')],_0x13809a[_0x8fc8('0x2a')],_0x13809a[_0x8fc8('0x2b')]));recordings[_0x13809a[_0x8fc8('0xd')]][_0x8fc8('0x29')]=_0x13809a[_0x8fc8('0x29')];recordings[_0x13809a['uniqueid']][_0x8fc8('0x2a')]=_0x13809a[_0x8fc8('0x2a')];recordings[_0x13809a[_0x8fc8('0xd')]]['connectedlinenum']=_0x13809a['connectedlinenum'];recordings[_0x13809a[_0x8fc8('0xd')]][_0x8fc8('0x2c')]=_0x13809a[_0x8fc8('0x2c')];if(recordings[_0x13809a[_0x8fc8('0xd')]][_0x8fc8('0x2d')]==_0x8fc8('0x2e')&&recordings[_0x13809a[_0x8fc8('0xd')]][_0x8fc8('0x3')]){recordings[_0x13809a['uniqueid']][_0x8fc8('0x2f')]=recordings[_0x13809a[_0x8fc8('0xd')]][_0x8fc8('0x3')];recordings[_0x13809a[_0x8fc8('0xd')]]['connectedlinename']='';}recordings[_0x13809a['uniqueid']][_0x8fc8('0x24')]['forEach'](function(_0x17a066){var _0x4a3059=_[_0x8fc8('0x30')](recordings[_0x13809a[_0x8fc8('0xd')]]);_0x4a3059[_0x8fc8('0x1f')]=_0x17a066[_0x8fc8('0x1f')];writeDB(_0x4a3059);});delete recordings[_0x13809a[_0x8fc8('0xd')]];}}catch(_0x3684c8){utils['error'](util[_0x8fc8('0xc')](_0x8fc8('0x27'),_0x13809a['uniqueid']),_0x3684c8);}};exports['newexten']=function(_0x5c4f65){try{if(!_[_0x8fc8('0x16')](recordings[_0x5c4f65[_0x8fc8('0xd')]])){utils[_0x8fc8('0xb')](util[_0x8fc8('0xc')](_0x8fc8('0x31'),_0x5c4f65[_0x8fc8('0xd')]),_0x5c4f65);utils[_0x8fc8('0x2')](util[_0x8fc8('0xc')](_0x8fc8('0x32'),_0x5c4f65[_0x8fc8('0xd')],_0x5c4f65['application'],_0x5c4f65[_0x8fc8('0x33')]));if(_0x5c4f65[_0x8fc8('0x34')][_0x8fc8('0x35')]()=='set'&&_[_0x8fc8('0x36')](_0x5c4f65[_0x8fc8('0x33')][_0x8fc8('0x35')](),_0x8fc8('0x37'))){var _0x19d1d6=_0x5c4f65[_0x8fc8('0x33')]['split']('=');var _0x46f878=_0x19d1d6[0x0][_0x8fc8('0x38')](_0x19d1d6[0x0][_0x8fc8('0x39')]('(')+0x1,_0x19d1d6[0x0][_0x8fc8('0x39')](')'));var _0x5a4a1e=_0x19d1d6[0x1];recordings[_0x5c4f65[_0x8fc8('0xd')]][_0x46f878]=_0x5a4a1e;}}}catch(_0x351bb7){utils['error'](util['format'](_0x8fc8('0x31'),_0x5c4f65[_0x8fc8('0xd')]),_0x351bb7);}};exports['queuecallerjoin']=function(_0x2c7ab2){try{if(!_[_0x8fc8('0x16')](recordings[_0x2c7ab2[_0x8fc8('0xd')]])){utils[_0x8fc8('0xb')](util[_0x8fc8('0xc')](_0x8fc8('0x3a'),_0x2c7ab2[_0x8fc8('0xd')]),_0x2c7ab2);utils[_0x8fc8('0x2')](util[_0x8fc8('0xc')](_0x8fc8('0x3b'),_0x2c7ab2[_0x8fc8('0xd')],_0x2c7ab2[_0x8fc8('0x3c')]));recordings[_0x2c7ab2[_0x8fc8('0xd')]][_0x8fc8('0x3c')]=_0x2c7ab2[_0x8fc8('0x3c')];}}catch(_0x13d608){utils[_0x8fc8('0x12')](util[_0x8fc8('0xc')](_0x8fc8('0x3a'),_0x2c7ab2['uniqueid']),_0x13d608);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 2278309..a7efc9f 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 _0x3870=['./utils','info','[%s][transfers][writeDB]\x20type:%s','type','origtransfereruniqueid','uniqueid','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','error','format','origtransferercalleridnum','transfertargetcalleridnum','assign','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','attended','isNil','transfereechannel','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','[%s][transfers][attendedtransfer]','lodash','util'];(function(_0x597484,_0x199340){var _0x218e64=function(_0x390d55){while(--_0x390d55){_0x597484['push'](_0x597484['shift']());}};_0x218e64(++_0x199340);}(_0x3870,0x146));var _0x0387=function(_0x358aaa,_0x5c240a){_0x358aaa=_0x358aaa-0x0;var _0x11c141=_0x3870[_0x358aaa];return _0x11c141;};'use strict';var _=require(_0x0387('0x0'));var util=require(_0x0387('0x1'));var utils=require(_0x0387('0x2'));function writeDB(_0x4ef6bd){utils[_0x0387('0x3')](util['format'](_0x0387('0x4'),_0x4ef6bd[_0x0387('0x5')]==='attended'?_0x4ef6bd[_0x0387('0x6')]:_0x4ef6bd[_0x0387('0x7')],_0x4ef6bd[_0x0387('0x5')]));utils['request'](_0x0387('0x8'),_0x4ef6bd);}exports[_0x0387('0x9')]=function(_0x3169b6){try{utils[_0x0387('0xa')](util['format'](_0x0387('0xb'),_0x3169b6[_0x0387('0x7')]),_0x3169b6);utils[_0x0387('0x3')](util['format'](_0x0387('0xc'),_0x3169b6['uniqueid'],_0x3169b6['transferercalleridnum'],_0x3169b6[_0x0387('0xd')],_0x3169b6[_0x0387('0xe')],_0x3169b6[_0x0387('0xf')]));_0x3169b6[_0x0387('0x5')]=_0x0387('0x10');writeDB(_0x3169b6);}catch(_0x5092c0){utils[_0x0387('0x11')](util[_0x0387('0x12')](_0x0387('0xb'),_0x3169b6['uniqueid']),_0x5092c0);}};exports['attendedtransfer']=function(_0x30e2d5){try{utils[_0x0387('0xa')](util['format']('[%s][transfers][attendedtransfer]',_0x30e2d5[_0x0387('0x6')]),_0x30e2d5);utils[_0x0387('0x3')](util[_0x0387('0x12')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x30e2d5['origtransfereruniqueid'],_0x30e2d5[_0x0387('0x13')],_0x30e2d5['origtransferercalleridname'],_0x30e2d5[_0x0387('0x14')],_0x30e2d5['transfertargetcalleridname']));_0x30e2d5=_[_0x0387('0x15')](_0x30e2d5,{'transfererchannel':_0x30e2d5[_0x0387('0x16')],'transferercalleridnum':_0x30e2d5[_0x0387('0x13')],'transferercalleridname':_0x30e2d5[_0x0387('0x17')],'transfererconnectedlinenum':_0x30e2d5[_0x0387('0x18')],'transfererconnectedlinename':_0x30e2d5[_0x0387('0x19')],'transfereraccountcode':_0x30e2d5['origtransfereraccountcode'],'transferercontext':_0x30e2d5[_0x0387('0x1a')],'transfererexten':_0x30e2d5[_0x0387('0x1b')],'transfererlinkedid':_0x30e2d5[_0x0387('0x1c')],'context':_0x30e2d5[_0x0387('0x1d')],'extension':_0x30e2d5['origtransfererexten'],'type':_0x0387('0x1e')});if(_[_0x0387('0x1f')](_0x30e2d5[_0x0387('0x20')])){_0x30e2d5=_[_0x0387('0x15')](_0x30e2d5,{'transfereechannel':_0x30e2d5[_0x0387('0x21')],'transfereecalleridnum':_0x30e2d5[_0x0387('0x14')],'transfereecalleridname':_0x30e2d5[_0x0387('0x22')],'transfereeconnectedlinenum':_0x30e2d5[_0x0387('0x23')],'transfereeconnectedlinename':_0x30e2d5[_0x0387('0x24')],'transfereeaccountcode':_0x30e2d5[_0x0387('0x25')],'transfereecontext':_0x30e2d5[_0x0387('0x26')],'transfereeexten':_0x30e2d5['transfertargetexten'],'transfereelinkedid':_0x30e2d5[_0x0387('0x27')]});}writeDB(_0x30e2d5);}catch(_0x3c8331){utils[_0x0387('0x11')](util[_0x0387('0x12')](_0x0387('0x28'),_0x30e2d5['origtransfereruniqueid']),_0x3c8331);}}; \ No newline at end of file +var _0x9990=['secondtransferercontext','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetexten','transfertargetlinkedid','error','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','uniqueid','request','blindtransfer','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transfereecalleridnum','transfereecalleridname','attendedtransfer','[%s][transfers][attendedtransfer]','origtransfereruniqueid','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','origtransfereraccountcode'];(function(_0x488de1,_0x23eb71){var _0x12b10b=function(_0x599ee3){while(--_0x599ee3){_0x488de1['push'](_0x488de1['shift']());}};_0x12b10b(++_0x23eb71);}(_0x9990,0xf6));var _0x0999=function(_0x4d3a2b,_0x32a224){_0x4d3a2b=_0x4d3a2b-0x0;var _0xdd32c8=_0x9990[_0x4d3a2b];return _0xdd32c8;};'use strict';var _=require('lodash');var util=require(_0x0999('0x0'));var utils=require(_0x0999('0x1'));function writeDB(_0xbbb89f){utils[_0x0999('0x2')](util[_0x0999('0x3')](_0x0999('0x4'),_0xbbb89f[_0x0999('0x5')]===_0x0999('0x6')?_0xbbb89f['origtransfereruniqueid']:_0xbbb89f[_0x0999('0x7')],_0xbbb89f[_0x0999('0x5')]));utils[_0x0999('0x8')]('CreateVoiceTransferReport',_0xbbb89f);}exports[_0x0999('0x9')]=function(_0xb1d8f9){try{utils[_0x0999('0xa')](util[_0x0999('0x3')](_0x0999('0xb'),_0xb1d8f9[_0x0999('0x7')]),_0xb1d8f9);utils[_0x0999('0x2')](util['format'](_0x0999('0xc'),_0xb1d8f9[_0x0999('0x7')],_0xb1d8f9[_0x0999('0xd')],_0xb1d8f9['transferercalleridname'],_0xb1d8f9[_0x0999('0xe')],_0xb1d8f9[_0x0999('0xf')]));_0xb1d8f9[_0x0999('0x5')]='blind';writeDB(_0xb1d8f9);}catch(_0x43f15c){utils['error'](util[_0x0999('0x3')](_0x0999('0xb'),_0xb1d8f9[_0x0999('0x7')]),_0x43f15c);}};exports[_0x0999('0x10')]=function(_0x1a7598){try{utils['debug'](util[_0x0999('0x3')](_0x0999('0x11'),_0x1a7598[_0x0999('0x12')]),_0x1a7598);utils[_0x0999('0x2')](util[_0x0999('0x3')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x1a7598[_0x0999('0x12')],_0x1a7598[_0x0999('0x13')],_0x1a7598[_0x0999('0x14')],_0x1a7598[_0x0999('0x15')],_0x1a7598[_0x0999('0x16')]));_0x1a7598=_[_0x0999('0x17')](_0x1a7598,{'transfererchannel':_0x1a7598[_0x0999('0x18')],'transferercalleridnum':_0x1a7598['origtransferercalleridnum'],'transferercalleridname':_0x1a7598[_0x0999('0x14')],'transfererconnectedlinenum':_0x1a7598[_0x0999('0x19')],'transfererconnectedlinename':_0x1a7598['secondtransfererconnectedlinename'],'transfereraccountcode':_0x1a7598[_0x0999('0x1a')],'transferercontext':_0x1a7598[_0x0999('0x1b')],'transfererexten':_0x1a7598['secondtransfererexten'],'transfererlinkedid':_0x1a7598[_0x0999('0x1c')],'context':_0x1a7598[_0x0999('0x1d')],'extension':_0x1a7598[_0x0999('0x1e')],'type':_0x0999('0x6')});if(_[_0x0999('0x1f')](_0x1a7598[_0x0999('0x20')])){_0x1a7598=_[_0x0999('0x17')](_0x1a7598,{'transfereechannel':_0x1a7598[_0x0999('0x21')],'transfereecalleridnum':_0x1a7598[_0x0999('0x15')],'transfereecalleridname':_0x1a7598['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x1a7598[_0x0999('0x22')],'transfereeconnectedlinename':_0x1a7598[_0x0999('0x23')],'transfereeaccountcode':_0x1a7598['transfertargetaccountcode'],'transfereecontext':_0x1a7598['transfertargetcontext'],'transfereeexten':_0x1a7598[_0x0999('0x24')],'transfereelinkedid':_0x1a7598[_0x0999('0x25')]});}writeDB(_0x1a7598);}catch(_0x2404be){utils[_0x0999('0x26')](util[_0x0999('0x3')](_0x0999('0x11'),_0x1a7598['origtransfereruniqueid']),_0x2404be);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index fba8d22..0c67fa3 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 _0x7989=['sumTime','now','isAfter','isBefore','moment','util','http','../../config/logger','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','catch','GetUser','internal','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','found','notfound','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','name','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtract','diffTime','diff'];(function(_0x1e307a,_0x5f182b){var _0x1ec4a0=function(_0xcbb5b4){while(--_0xcbb5b4){_0x1e307a['push'](_0x1e307a['shift']());}};_0x1ec4a0(++_0x5f182b);}(_0x7989,0x82));var _0x9798=function(_0x68a0b0,_0x2bba91){_0x68a0b0=_0x68a0b0-0x0;var _0x4b4ee6=_0x7989[_0x68a0b0];return _0x4b4ee6;};'use strict';var BPromise=require('bluebird');var jayson=require('jayson/promise');var moment=require(_0x9798('0x0'));var util=require(_0x9798('0x1'));var client=jayson['client'][_0x9798('0x2')]({'port':0x2329});var logger=require(_0x9798('0x3'))('xdr');exports[_0x9798('0x4')]=function(_0x19e492,_0x93883e){logger[_0x9798('0x4')](_0x19e492,_0x93883e?util[_0x9798('0x5')](_0x93883e,{'showHidden':![],'depth':null}):'');};exports[_0x9798('0x6')]=function(_0x3d6486,_0x27ad3c){logger[_0x9798('0x6')](_0x3d6486,_0x27ad3c?util['inspect'](_0x27ad3c,{'showHidden':![],'depth':null}):'');};exports[_0x9798('0x7')]=function(_0x2551f2,_0x5b8eb7){logger[_0x9798('0x7')](_0x2551f2,_0x5b8eb7?util['inspect'](_0x5b8eb7,{'showHidden':![],'depth':null}):'');};exports[_0x9798('0x8')]=function(_0x4d2335,_0x3df4f1){return client[_0x9798('0x8')](_0x4d2335,{'body':_0x3df4f1})[_0x9798('0x9')](function(_0x27bb9e){logger[_0x9798('0x6')](_0x9798('0xa'),_0x4d2335,_0x27bb9e?util[_0x9798('0x5')](_0x27bb9e,{'showHidden':![],'depth':null}):'');})[_0x9798('0xb')](function(_0x5783bb){logger[_0x9798('0x7')]('[utils][request]\x20name:%s',_0x4d2335,_0x5783bb?util['inspect'](_0x5783bb,{'showHidden':![],'depth':null}):'');});};function getUser(_0x3348c7){return client[_0x9798('0x8')](_0x9798('0xc'),{'options':{'raw':!![],'attributes':['id',_0x9798('0xd'),'name','interface'],'where':_0x3348c7,'limit':0x1}})[_0x9798('0x9')](function(_0x2551d1){logger['debug'](_0x9798('0xe'),JSON[_0x9798('0xf')](_0x3348c7),_0x2551d1?util[_0x9798('0x5')](_0x2551d1,{'showHidden':![],'depth':null}):'');return _0x2551d1[_0x9798('0x10')][_0x9798('0x11')]?_0x2551d1[_0x9798('0x10')][0x0]:null;});}exports[_0x9798('0x12')]=function(_0x2e6251){return new BPromise(function(_0x55bd4f,_0x14fbb0){if(_0x2e6251){return getUser({'internal':_0x2e6251})[_0x9798('0x9')](function(_0x3d17aa){logger[_0x9798('0x4')]('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x2e6251,_0x3d17aa?_0x9798('0x13'):_0x9798('0x14'));return _0x55bd4f(_0x3d17aa);})[_0x9798('0xb')](function(_0x21d230){logger[_0x9798('0x7')](_0x9798('0x15'),_0x21d230?util[_0x9798('0x5')](_0x21d230,{'showHidden':![],'depth':null}):'');return _0x55bd4f(null);});}return _0x55bd4f(null);});};exports['getUserByInterface']=function(_0x48c6b3){return new BPromise(function(_0x40d600,_0x203823){if(_0x48c6b3){return getUser({'interface':_0x48c6b3})[_0x9798('0x9')](function(_0x2a26ed){logger['info'](_0x9798('0x16'),_0x48c6b3,_0x2a26ed?_0x9798('0x13'):_0x9798('0x14'));return _0x40d600(_0x2a26ed);})[_0x9798('0xb')](function(_0x327914){logger[_0x9798('0x7')]('[utils][getUserByInterface]',_0x327914?util['inspect'](_0x327914,{'showHidden':![],'depth':null}):'');return _0x40d600(null);});}return _0x40d600(null);});};exports['getUserByName']=function(_0x189ac3){return new BPromise(function(_0x34a9f7,_0x1a7f96){if(_0x189ac3){return getUser({'name':_0x189ac3})[_0x9798('0x9')](function(_0x149ba4){logger[_0x9798('0x4')]('[utils][getUserByName]\x20name:%s\x20%s',_0x189ac3,_0x149ba4?_0x9798('0x13'):'notfound');return _0x34a9f7(_0x149ba4);})[_0x9798('0xb')](function(_0x453fbb){logger['error'](_0x9798('0x17'),_0x453fbb?util[_0x9798('0x5')](_0x453fbb,{'showHidden':![],'depth':null}):'');return _0x34a9f7(null);});}return _0x34a9f7(null);});};exports[_0x9798('0x18')]=function(_0x251f33){return new BPromise(function(_0x53c917,_0x224c60){if(_0x251f33){return client['request']('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0x9798('0x19'),_0x9798('0x1a'),_0x9798('0x1b'),_0x9798('0x1c')],'where':{'name':_0x251f33},'limit':0x1}})[_0x9798('0x9')](function(_0x1cdf52){logger[_0x9798('0x6')](_0x9798('0x1d'),_0x251f33,_0x1cdf52?util['inspect'](_0x1cdf52,{'showHidden':![],'depth':null}):'');logger['info']('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x251f33,_0x1cdf52?_0x9798('0x13'):_0x9798('0x14'));return _0x53c917(_0x1cdf52[_0x9798('0x10')]['length']?_0x1cdf52['result'][0x0]:null);})[_0x9798('0xb')](function(_0x30dfe7){logger[_0x9798('0x7')]('[utils][getVoiceQueueByName]',_0x30dfe7?util[_0x9798('0x5')](_0x30dfe7,{'showHidden':![],'depth':null}):'');return _0x53c917(null);});}return _0x53c917(null);});};exports[_0x9798('0x1e')]=function(_0x1def83,_0x344de6){return moment(_0x1def83)[_0x9798('0x1f')](_0x344de6,_0x9798('0x20'))[_0x9798('0x21')](_0x9798('0x22'));};exports['subtractTime']=function(_0x5c759c,_0x3837b8){return moment(_0x5c759c)[_0x9798('0x23')](_0x3837b8,_0x9798('0x20'))[_0x9798('0x21')](_0x9798('0x22'));};exports[_0x9798('0x24')]=function(_0x406c1c,_0x2e114a){return moment(_0x406c1c)[_0x9798('0x25')](moment(_0x2e114a),'seconds');};exports[_0x9798('0x26')]=function(_0x537dd9,_0x23552e){return parseInt(_0x537dd9,0xa)+parseInt(_0x23552e,0xa);};exports[_0x9798('0x27')]=function(){return moment()[_0x9798('0x21')](_0x9798('0x22'));};exports[_0x9798('0x28')]=function(_0x348621,_0x26fe52){if(_0x26fe52){return moment(_0x348621)[_0x9798('0x28')](_0x26fe52);}return!![];};exports[_0x9798('0x29')]=function(_0x4b5620,_0x4fd6f4){if(_0x4fd6f4){return moment(_0x4b5620)[_0x9798('0x29')](_0x4fd6f4);}else if(_0x4b5620){return!![];}return![];}; \ No newline at end of file +var _0xe1e6=['getVoiceQueueByName','type','acw','[utils][getVoiceQueueByName]\x20name:%s','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','sumTime','now','isAfter','isBefore','bluebird','util','client','../../config/logger','info','inspect','debug','error','request','[utils][request]\x20name:%s','catch','GetUser','name','then','[utils][getUser]\x20where:%s','result','length','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]'];(function(_0x3ed6d5,_0x207bae){var _0x298086=function(_0x19f25d){while(--_0x19f25d){_0x3ed6d5['push'](_0x3ed6d5['shift']());}};_0x298086(++_0x207bae);}(_0xe1e6,0x67));var _0x6e1e=function(_0x19613b,_0x3350b7){_0x19613b=_0x19613b-0x0;var _0xa4c014=_0xe1e6[_0x19613b];return _0xa4c014;};'use strict';var BPromise=require(_0x6e1e('0x0'));var jayson=require('jayson/promise');var moment=require('moment');var util=require(_0x6e1e('0x1'));var client=jayson[_0x6e1e('0x2')]['http']({'port':0x2329});var logger=require(_0x6e1e('0x3'))('xdr');exports[_0x6e1e('0x4')]=function(_0x5f0abf,_0x69521c){logger[_0x6e1e('0x4')](_0x5f0abf,_0x69521c?util[_0x6e1e('0x5')](_0x69521c,{'showHidden':![],'depth':null}):'');};exports[_0x6e1e('0x6')]=function(_0x50e059,_0x4560da){logger['debug'](_0x50e059,_0x4560da?util[_0x6e1e('0x5')](_0x4560da,{'showHidden':![],'depth':null}):'');};exports[_0x6e1e('0x7')]=function(_0x55f776,_0x34d2ec){logger[_0x6e1e('0x7')](_0x55f776,_0x34d2ec?util[_0x6e1e('0x5')](_0x34d2ec,{'showHidden':![],'depth':null}):'');};exports[_0x6e1e('0x8')]=function(_0x43716a,_0x2fc20d){return client['request'](_0x43716a,{'body':_0x2fc20d})['then'](function(_0x32f5d9){logger['debug'](_0x6e1e('0x9'),_0x43716a,_0x32f5d9?util[_0x6e1e('0x5')](_0x32f5d9,{'showHidden':![],'depth':null}):'');})[_0x6e1e('0xa')](function(_0x38a84f){logger[_0x6e1e('0x7')](_0x6e1e('0x9'),_0x43716a,_0x38a84f?util[_0x6e1e('0x5')](_0x38a84f,{'showHidden':![],'depth':null}):'');});};function getUser(_0x3e54f1){return client['request'](_0x6e1e('0xb'),{'options':{'raw':!![],'attributes':['id','internal',_0x6e1e('0xc'),'interface'],'where':_0x3e54f1,'limit':0x1}})[_0x6e1e('0xd')](function(_0x1d4cb4){logger[_0x6e1e('0x6')](_0x6e1e('0xe'),JSON['stringify'](_0x3e54f1),_0x1d4cb4?util[_0x6e1e('0x5')](_0x1d4cb4,{'showHidden':![],'depth':null}):'');return _0x1d4cb4[_0x6e1e('0xf')][_0x6e1e('0x10')]?_0x1d4cb4[_0x6e1e('0xf')][0x0]:null;});}exports['getUserByInternal']=function(_0x328a2d){return new BPromise(function(_0x28108b,_0x2ae0ff){if(_0x328a2d){return getUser({'internal':_0x328a2d})['then'](function(_0x1f0349){logger['info'](_0x6e1e('0x11'),_0x328a2d,_0x1f0349?_0x6e1e('0x12'):_0x6e1e('0x13'));return _0x28108b(_0x1f0349);})['catch'](function(_0x56511e){logger['error'](_0x6e1e('0x14'),_0x56511e?util[_0x6e1e('0x5')](_0x56511e,{'showHidden':![],'depth':null}):'');return _0x28108b(null);});}return _0x28108b(null);});};exports[_0x6e1e('0x15')]=function(_0x174263){return new BPromise(function(_0x1d243e,_0xf4e164){if(_0x174263){return getUser({'interface':_0x174263})[_0x6e1e('0xd')](function(_0x43d15d){logger[_0x6e1e('0x4')](_0x6e1e('0x16'),_0x174263,_0x43d15d?_0x6e1e('0x12'):_0x6e1e('0x13'));return _0x1d243e(_0x43d15d);})[_0x6e1e('0xa')](function(_0x4f44e1){logger[_0x6e1e('0x7')](_0x6e1e('0x17'),_0x4f44e1?util[_0x6e1e('0x5')](_0x4f44e1,{'showHidden':![],'depth':null}):'');return _0x1d243e(null);});}return _0x1d243e(null);});};exports['getUserByName']=function(_0x26b7dc){return new BPromise(function(_0x5c5e29,_0x457456){if(_0x26b7dc){return getUser({'name':_0x26b7dc})[_0x6e1e('0xd')](function(_0x23caf5){logger[_0x6e1e('0x4')](_0x6e1e('0x18'),_0x26b7dc,_0x23caf5?_0x6e1e('0x12'):_0x6e1e('0x13'));return _0x5c5e29(_0x23caf5);})[_0x6e1e('0xa')](function(_0xbad71f){logger[_0x6e1e('0x7')](_0x6e1e('0x19'),_0xbad71f?util[_0x6e1e('0x5')](_0xbad71f,{'showHidden':![],'depth':null}):'');return _0x5c5e29(null);});}return _0x5c5e29(null);});};exports[_0x6e1e('0x1a')]=function(_0x2becfe){return new BPromise(function(_0x5e3a69,_0x5b7532){if(_0x2becfe){return client[_0x6e1e('0x8')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id','name',_0x6e1e('0x1b'),_0x6e1e('0x1c'),'acwTimeout'],'where':{'name':_0x2becfe},'limit':0x1}})['then'](function(_0x56d449){logger['debug'](_0x6e1e('0x1d'),_0x2becfe,_0x56d449?util[_0x6e1e('0x5')](_0x56d449,{'showHidden':![],'depth':null}):'');logger[_0x6e1e('0x4')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x2becfe,_0x56d449?_0x6e1e('0x12'):_0x6e1e('0x13'));return _0x5e3a69(_0x56d449[_0x6e1e('0xf')][_0x6e1e('0x10')]?_0x56d449[_0x6e1e('0xf')][0x0]:null);})[_0x6e1e('0xa')](function(_0xf22466){logger[_0x6e1e('0x7')]('[utils][getVoiceQueueByName]',_0xf22466?util['inspect'](_0xf22466,{'showHidden':![],'depth':null}):'');return _0x5e3a69(null);});}return _0x5e3a69(null);});};exports[_0x6e1e('0x1e')]=function(_0x53b294,_0x4e6dfb){return moment(_0x53b294)[_0x6e1e('0x1f')](_0x4e6dfb,_0x6e1e('0x20'))[_0x6e1e('0x21')](_0x6e1e('0x22'));};exports[_0x6e1e('0x23')]=function(_0xc18386,_0x1ec6f1){return moment(_0xc18386)[_0x6e1e('0x24')](_0x1ec6f1,_0x6e1e('0x20'))['format']('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x6e1e('0x25')]=function(_0x20b608,_0x296912){return moment(_0x20b608)[_0x6e1e('0x26')](moment(_0x296912),_0x6e1e('0x20'));};exports[_0x6e1e('0x27')]=function(_0x460ad0,_0x1b11c2){return parseInt(_0x460ad0,0xa)+parseInt(_0x1b11c2,0xa);};exports[_0x6e1e('0x28')]=function(){return moment()[_0x6e1e('0x21')](_0x6e1e('0x22'));};exports[_0x6e1e('0x29')]=function(_0x33c0e6,_0x51196f){if(_0x51196f){return moment(_0x33c0e6)['isAfter'](_0x51196f);}return!![];};exports[_0x6e1e('0x2a')]=function(_0x2bf842,_0x5d8510){if(_0x5d8510){return moment(_0x2bf842)[_0x6e1e('0x2a')](_0x5d8510);}else if(_0x2bf842){return!![];}return![];}; \ No newline at end of file diff --git a/server/utils/client-side-logger.js b/server/utils/client-side-logger.js index e93787a..32e9f7c 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 _0x197c=['api','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','format','method','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','inspect','device','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','other','agent_id','lodash','express-winston','path','util','./loggers','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','/var','log','client','role','name','then','user','no-user','data','timestamp','catch','error'];(function(_0x1fd2fa,_0x338bdb){var _0x3da635=function(_0x1c36ab){while(--_0x1c36ab){_0x1fd2fa['push'](_0x1fd2fa['shift']());}};_0x3da635(++_0x338bdb);}(_0x197c,0x132));var _0xc197=function(_0xb4430c,_0x44cc22){_0xb4430c=_0xb4430c-0x0;var _0x551977=_0x197c[_0xb4430c];return _0x551977;};var fs=require('fs-extra');var _=require(_0xc197('0x0'));var ewinston=require(_0xc197('0x1'));var path=require(_0xc197('0x2'));var util=require(_0xc197('0x3'));var fileLogger=require(_0xc197('0x4'))[_0xc197('0x5')];var safeTemplate=require(_0xc197('0x6'))[_0xc197('0x7')];var maskSensitiveData=require(_0xc197('0x8'))[_0xc197('0x9')];function ClientSideLogger(){function _0x63dc9c(_0x1be749){var _0x5f0c70=path[_0xc197('0xa')](_0xc197('0xb'),_0xc197('0xc'),'xcally');var _0x1de884=path['join'](_0xc197('0xd'),_0x1be749[_0xc197('0xe')]+'-'+_0x1be749[_0xc197('0xf')]);return fs['ensureDir'](path['join'](_0x5f0c70,_0x1de884))[_0xc197('0x10')](function(){var _0x2c1cb9=fileLogger(_0xc197('0xd'),path[_0xc197('0xa')](_0x5f0c70,_0x1de884));return _0x2c1cb9;})['catch'](function(_0x249ba9){throw _0x249ba9;});}this['log']=function(_0x1d29c7,_0xc4d1dd,_0x2f10b7,_0x5eea35){return _0x63dc9c(_0x1d29c7[_0xc197('0x11')])[_0xc197('0x10')](function(_0x4b80d8){var _0x425882=_0x4b80d8[_0xc4d1dd];return _0x425882;})['then'](function(_0xc94898){var _0x5fcc72=_0x1d29c7['user']?_0x1d29c7[_0xc197('0x11')]['id']:_0xc197('0x12');var _0x21c94b=_0x5eea35[_0xc197('0x13')];var _0x31da41=_0x5eea35[_0xc197('0x14')];var _0x40ca83=new Date(Number(_0x31da41));return _0xc94898(_0x5fcc72,_0x40ca83,_0x2f10b7,_0x21c94b);})[_0xc197('0x15')](function(_0x488eb4){fileLogger('client')[_0xc197('0x16')](_0x488eb4);});};}function setupLoggers(_0x1f13ac){return new Promise(function(_0x573dcf){var _0x51f68a=new ClientSideLogger();var _0x2218e3=fileLogger(_0xc197('0x17'));var _0x20c880=fileLogger(_0xc197('0x18'));_0x1f13ac[_0xc197('0x19')](_0xc197('0x1a'),_0x51f68a);_0x1f13ac[_0xc197('0x1b')](ewinston[_0xc197('0x1c')]({'winstonInstance':_0x2218e3,'meta':![],'statusLevels':!![],'msg':function(_0x5a26e2,_0x52a1f1){var _0x5a1d3f=_0xc197('0x1d');if(!_[_0xc197('0x1e')](_0x5a26e2[_0xc197('0x1f')])){_0x5a1d3f+=_0xc197('0x20');var _0x394530=_0x5a26e2[_0xc197('0x1f')];maskSensitiveData(_0x394530);}return safeTemplate(util[_0xc197('0x21')](_0x5a1d3f,_0x5a26e2[_0xc197('0x22')],_0x5a26e2[_0xc197('0x23')][_0xc197('0x24')]?_0x5a26e2[_0xc197('0x23')]['x-forwarded-for']:_0x5a26e2[_0xc197('0x25')][_0xc197('0x26')]||_0x5a26e2['ip'],_0x5a26e2[_0xc197('0x27')],_0x52a1f1[_0xc197('0x28')],_0x52a1f1[_0xc197('0x29')],_0x5a26e2[_0xc197('0x11')]?_0x5a26e2[_0xc197('0x11')]['id']:null,_0x5a26e2[_0xc197('0x11')]?_0x5a26e2[_0xc197('0x11')][_0xc197('0xf')]:null,_0x5a26e2[_0xc197('0x11')]?_0x5a26e2[_0xc197('0x11')][_0xc197('0xe')]:null,_0x394530?util[_0xc197('0x2a')](_0x394530,![],null):''));}}));_0x1f13ac[_0xc197('0x1b')](ewinston[_0xc197('0x1c')]({'winstonInstance':_0x20c880,'meta':![],'statusLevels':!![],'msg':function(_0xc86d58,_0x48101c){var _0x5f48fa='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0xc86d58[_0xc197('0x1f')]&&_0xc86d58['body'][_0xc197('0x2b')]&&_0xc86d58['body']['agent_id']){_0x5f48fa=_0xc197('0x2c');}return util[_0xc197('0x21')](_0x5f48fa,_0xc86d58[_0xc197('0x22')],_0xc86d58[_0xc197('0x23')][_0xc197('0x24')]?_0xc86d58[_0xc197('0x23')][_0xc197('0x24')]:_0xc86d58[_0xc197('0x25')][_0xc197('0x26')]||_0xc86d58['ip'],_0xc86d58[_0xc197('0x27')],_0x48101c[_0xc197('0x28')],_0x48101c[_0xc197('0x29')],_0xc86d58['user']?_0xc86d58[_0xc197('0x11')]['id']:null,_0xc86d58[_0xc197('0x11')]?_0xc86d58[_0xc197('0x11')][_0xc197('0xf')]:null,_0xc86d58[_0xc197('0x11')]?_0xc86d58[_0xc197('0x11')]['role']:null,_0xc86d58[_0xc197('0x1f')]&&_0xc86d58[_0xc197('0x1f')][_0xc197('0x2b')]?_0xc86d58[_0xc197('0x1f')][_0xc197('0x2b')]:_0xc197('0x2d'),_0xc86d58[_0xc197('0x1f')]&&_0xc86d58['body'][_0xc197('0x2e')]?_0xc86d58['body'][_0xc197('0x2e')]:'',_0xc86d58[_0xc197('0x1f')]&&_0xc86d58[_0xc197('0x1f')]['agent_name']?_0xc86d58['body']['agent_name']:'');},'ignoreRoute':function(_0x52dfe0){var _0x504173=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x504173['test'](_0x52dfe0[_0xc197('0x27')]);}}));return _0x573dcf();});}exports['setupLoggers']=setupLoggers; \ No newline at end of file +var _0xbc11=['user','no-user','data','timestamp','error','api','auth','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','body','\x20body=%s','format','method','headers','x-forwarded-for','connection','remoteAddress','statusCode','responseTime','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','agent_id','url','device','other','agent_name','setupLoggers','fs-extra','lodash','express-winston','path','util','./loggers','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','role','name','then','client','catch'];(function(_0x2233de,_0x505be1){var _0x10d4ba=function(_0x366db7){while(--_0x366db7){_0x2233de['push'](_0x2233de['shift']());}};_0x10d4ba(++_0x505be1);}(_0xbc11,0xa3));var _0x1bc1=function(_0x3ad1db,_0x5b36d9){_0x3ad1db=_0x3ad1db-0x0;var _0x4aa9bc=_0xbc11[_0x3ad1db];return _0x4aa9bc;};var fs=require(_0x1bc1('0x0'));var _=require(_0x1bc1('0x1'));var ewinston=require(_0x1bc1('0x2'));var path=require(_0x1bc1('0x3'));var util=require(_0x1bc1('0x4'));var fileLogger=require(_0x1bc1('0x5'))[_0x1bc1('0x6')];var safeTemplate=require(_0x1bc1('0x7'))[_0x1bc1('0x8')];var maskSensitiveData=require(_0x1bc1('0x9'))[_0x1bc1('0xa')];function ClientSideLogger(){function _0x306a6e(_0x121657){var _0x262a74=path[_0x1bc1('0xb')]('/var','log','xcally');var _0x227f46=path[_0x1bc1('0xb')]('client',_0x121657[_0x1bc1('0xc')]+'-'+_0x121657[_0x1bc1('0xd')]);return fs['ensureDir'](path[_0x1bc1('0xb')](_0x262a74,_0x227f46))[_0x1bc1('0xe')](function(){var _0x1f3d98=fileLogger(_0x1bc1('0xf'),path[_0x1bc1('0xb')](_0x262a74,_0x227f46));return _0x1f3d98;})[_0x1bc1('0x10')](function(_0x5d7c1c){throw _0x5d7c1c;});}this['log']=function(_0xda9180,_0x4d777c,_0x588787,_0x9069c2){return _0x306a6e(_0xda9180[_0x1bc1('0x11')])[_0x1bc1('0xe')](function(_0x46c3a5){var _0x552c7b=_0x46c3a5[_0x4d777c];return _0x552c7b;})['then'](function(_0x2b7509){var _0x974978=_0xda9180['user']?_0xda9180[_0x1bc1('0x11')]['id']:_0x1bc1('0x12');var _0x4c1493=_0x9069c2[_0x1bc1('0x13')];var _0xeeec02=_0x9069c2[_0x1bc1('0x14')];var _0x35a6d3=new Date(Number(_0xeeec02));return _0x2b7509(_0x974978,_0x35a6d3,_0x588787,_0x4c1493);})[_0x1bc1('0x10')](function(_0x5e765c){fileLogger(_0x1bc1('0xf'))[_0x1bc1('0x15')](_0x5e765c);});};}function setupLoggers(_0x2df203){return new Promise(function(_0x23bddb){var _0x1ab5f6=new ClientSideLogger();var _0x115107=fileLogger(_0x1bc1('0x16'));var _0x48d6cf=fileLogger(_0x1bc1('0x17'));_0x2df203['set']('client-side-logger',_0x1ab5f6);_0x2df203[_0x1bc1('0x18')](ewinston[_0x1bc1('0x19')]({'winstonInstance':_0x115107,'meta':![],'statusLevels':!![],'msg':function(_0x12eef0,_0x2c1316){var _0x3e87f3=_0x1bc1('0x1a');if(!_['isEmpty'](_0x12eef0[_0x1bc1('0x1b')])){_0x3e87f3+=_0x1bc1('0x1c');var _0x2221fc=_0x12eef0[_0x1bc1('0x1b')];maskSensitiveData(_0x2221fc);}return safeTemplate(util[_0x1bc1('0x1d')](_0x3e87f3,_0x12eef0[_0x1bc1('0x1e')],_0x12eef0[_0x1bc1('0x1f')][_0x1bc1('0x20')]?_0x12eef0[_0x1bc1('0x1f')][_0x1bc1('0x20')]:_0x12eef0[_0x1bc1('0x21')][_0x1bc1('0x22')]||_0x12eef0['ip'],_0x12eef0['url'],_0x2c1316[_0x1bc1('0x23')],_0x2c1316[_0x1bc1('0x24')],_0x12eef0['user']?_0x12eef0[_0x1bc1('0x11')]['id']:null,_0x12eef0[_0x1bc1('0x11')]?_0x12eef0[_0x1bc1('0x11')]['name']:null,_0x12eef0['user']?_0x12eef0['user'][_0x1bc1('0xc')]:null,_0x2221fc?util[_0x1bc1('0x25')](_0x2221fc,![],null):''));}}));_0x2df203[_0x1bc1('0x18')](ewinston['logger']({'winstonInstance':_0x48d6cf,'meta':![],'statusLevels':!![],'msg':function(_0x2ac2b9,_0x290e0d){var _0x3e87db=_0x1bc1('0x26');if(_0x2ac2b9[_0x1bc1('0x1b')]&&_0x2ac2b9[_0x1bc1('0x1b')]['device']&&_0x2ac2b9[_0x1bc1('0x1b')][_0x1bc1('0x27')]){_0x3e87db='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util['format'](_0x3e87db,_0x2ac2b9[_0x1bc1('0x1e')],_0x2ac2b9[_0x1bc1('0x1f')][_0x1bc1('0x20')]?_0x2ac2b9[_0x1bc1('0x1f')][_0x1bc1('0x20')]:_0x2ac2b9[_0x1bc1('0x21')][_0x1bc1('0x22')]||_0x2ac2b9['ip'],_0x2ac2b9[_0x1bc1('0x28')],_0x290e0d[_0x1bc1('0x23')],_0x290e0d['responseTime'],_0x2ac2b9[_0x1bc1('0x11')]?_0x2ac2b9[_0x1bc1('0x11')]['id']:null,_0x2ac2b9['user']?_0x2ac2b9['user'][_0x1bc1('0xd')]:null,_0x2ac2b9[_0x1bc1('0x11')]?_0x2ac2b9[_0x1bc1('0x11')]['role']:null,_0x2ac2b9['body']&&_0x2ac2b9[_0x1bc1('0x1b')][_0x1bc1('0x29')]?_0x2ac2b9['body'][_0x1bc1('0x29')]:_0x1bc1('0x2a'),_0x2ac2b9[_0x1bc1('0x1b')]&&_0x2ac2b9[_0x1bc1('0x1b')][_0x1bc1('0x27')]?_0x2ac2b9[_0x1bc1('0x1b')][_0x1bc1('0x27')]:'',_0x2ac2b9[_0x1bc1('0x1b')]&&_0x2ac2b9['body']['agent_name']?_0x2ac2b9[_0x1bc1('0x1b')][_0x1bc1('0x2b')]:'');},'ignoreRoute':function(_0x499d5d){var _0x1f8b1e=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x1f8b1e['test'](_0x499d5d[_0x1bc1('0x28')]);}}));return _0x23bddb();});}exports[_0x1bc1('0x2c')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index 1c977ba..8f5b18b 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb5e1=['startOf','day','endOf','isBetween','format','ddd','includes','dowCompare','date','daysInMonth','max','min','MMM','guess','test','split','padStart','length','iftime','lodash','moment-timezone','map','isValid','locale','toLowerCase','indexOf','slice','concat','exports','circularDoWInterval','monthsShort','circularMonthInterval','clone','hours','minutes'];(function(_0x536486,_0x45a3c9){var _0x54e087=function(_0x5b1de7){while(--_0x5b1de7){_0x536486['push'](_0x536486['shift']());}};_0x54e087(++_0x45a3c9);}(_0xb5e1,0x171));var _0x1b5e=function(_0x3bdcbb,_0x420a2c){_0x3bdcbb=_0x3bdcbb-0x0;var _0x2c90fc=_0xb5e1[_0x3bdcbb];return _0x2c90fc;};var _=require(_0x1b5e('0x0'));var moment=require(_0x1b5e('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][_0x1b5e('0x2')](function(_0x2b976d){return _0x2b976d['source'];})['join'](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING='Interval\x20string\x20not\x20valid';var EINVALID_DATE='Date\x20not\x20valid';function throwIfDateNotValid(_0x2a91e5){if(!_0x2a91e5[_0x1b5e('0x3')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x9924bb){var _0x5ba75a=_0x9924bb['split'](':')['map'](function(_0x434f78){return parseInt(_0x434f78,0xa);});var _0x36be96=_0x5ba75a[0x0];var _0x31e031=_0x5ba75a[0x1];if(_0x36be96<0x0||_0x36be96>0x17||_0x31e031<0x0||_0x31e031>0x3b){throw new Error(EINVALID_DATE);}return[_0x36be96,_0x31e031];}function circularDoWInterval(_0x23e64b,_0x233b50){if(_0x23e64b===_0x233b50){return[_0x23e64b];}else{var _0x4fdb5d=moment[_0x1b5e('0x4')]();moment['locale']('en');var _0x558812=moment['weekdaysShort']()[_0x1b5e('0x2')](function(_0x49eeb3){return _0x49eeb3[_0x1b5e('0x5')]();});moment['locale'](_0x4fdb5d);var _0x1f9e9c=_0x558812['indexOf'](_0x23e64b);var _0x150011=_0x558812[_0x1b5e('0x6')](_0x233b50);if(_0x150011>_0x1f9e9c){return _0x558812[_0x1b5e('0x7')](_0x1f9e9c,_0x150011+0x1);}else{var _0x29d252=_0x558812['slice'](0x0,_0x150011+0x1);var _0x1395ec=_0x558812[_0x1b5e('0x7')](_0x1f9e9c);return _0x1395ec[_0x1b5e('0x8')](_0x29d252);}}}module[_0x1b5e('0x9')][_0x1b5e('0xa')]=circularDoWInterval;function circularMonthInterval(_0x304033,_0x309e7d){if(_0x304033===_0x309e7d){return[_0x304033];}else{var _0x210571=moment['locale']();moment['locale']('en');var _0x44bc60=moment[_0x1b5e('0xb')]()[_0x1b5e('0x2')](function(_0xf7718e){return _0xf7718e[_0x1b5e('0x5')]();});moment[_0x1b5e('0x4')](_0x210571);var _0xfecf7e=_0x44bc60[_0x1b5e('0x6')](_0x304033);var _0x18d5b0=_0x44bc60[_0x1b5e('0x6')](_0x309e7d);if(_0x18d5b0>_0xfecf7e){return _0x44bc60[_0x1b5e('0x7')](_0xfecf7e,_0x18d5b0+0x1);}else{var _0x50de6f=_0x44bc60[_0x1b5e('0x7')](0x0,_0x18d5b0+0x1);var _0x4064ba=_0x44bc60['slice'](_0xfecf7e);return _0x4064ba[_0x1b5e('0x8')](_0x50de6f);}}}module['exports'][_0x1b5e('0xc')]=circularMonthInterval;function parseDom(_0x50de51){var _0x93000d=parseInt(_0x50de51,0xa);if(_0x93000d<0x1||_0x93000d>0x1f){throw new Error(EINVALID_DATE);}return _0x93000d;}function timeCompare(_0x4cbebb,_0x129d8a,_0x4a1e27){var _0x48a164=_0x4cbebb['clone']();var _0x1bc5a7=extractTime(_0x129d8a);var _0xb47095=_0x1bc5a7[0x0];var _0x18702d=_0x1bc5a7[0x1];var _0x2f63de=_0x4cbebb[_0x1b5e('0xd')]()[_0x1b5e('0xe')](_0xb47095)['minutes'](_0x18702d);throwIfDateNotValid(_0x2f63de);var _0x13ee73=extractTime(_0x4a1e27);var _0x12df23=_0x13ee73[0x0];var _0x38ce19=_0x13ee73[0x1];var _0x39e385=_0x4cbebb[_0x1b5e('0xd')]()[_0x1b5e('0xe')](_0x12df23)[_0x1b5e('0xf')](_0x38ce19);throwIfDateNotValid(_0x39e385);if(_0x39e385['isBefore'](_0x2f63de)){var _0x504550=_0x48a164[_0x1b5e('0xd')]()[_0x1b5e('0x10')](_0x1b5e('0x11'));var _0x561685=_0x48a164[_0x1b5e('0xd')]()[_0x1b5e('0x12')](_0x1b5e('0x11'));return _0x48a164[_0x1b5e('0x13')](_0x2f63de,_0x561685,undefined,'[]')||_0x48a164[_0x1b5e('0x13')](_0x504550,_0x39e385,undefined,'[]');}else{return _0x48a164[_0x1b5e('0x13')](_0x2f63de,_0x39e385,undefined,'[]');}}module[_0x1b5e('0x9')]['timeCompare']=timeCompare;function dowCompare(_0xc40274,_0xa392a5,_0x531797){var _0x520b6a=_0xc40274[_0x1b5e('0x4')]('en')[_0x1b5e('0x14')](_0x1b5e('0x15'))[_0x1b5e('0x5')]();return circularDoWInterval(_0xa392a5,_0x531797)[_0x1b5e('0x16')](_0x520b6a);}module['exports'][_0x1b5e('0x17')]=dowCompare;function domCompare(_0xcbb3cf,_0x485d2b,_0x2500ce){var _0x5132cb=_0xcbb3cf[_0x1b5e('0x18')]();if(_0x485d2b===_0x2500ce){return _0x5132cb===_0x485d2b;}else{var _0x336552=_0xcbb3cf[_0x1b5e('0x19')]();var _0x4eaf02=_0x485d2b<_0x2500ce;let _0x23be76=![];var _0x41bc8a=0x0;var _0x24644a=0x0;if(_0x4eaf02){_0x41bc8a=Math[_0x1b5e('0x1a')](0x1,_0x485d2b);_0x24644a=Math['min'](_0x2500ce,_0x336552);_0x23be76=_0x5132cb>=_0x41bc8a&&_0x5132cb<=_0x24644a;}else{_0x41bc8a=Math[_0x1b5e('0x1b')](_0x485d2b,_0x336552);_0x24644a=Math[_0x1b5e('0x1a')](0x1,_0x2500ce);_0x23be76=_0x5132cb>=_0x41bc8a||_0x5132cb<=_0x24644a;}return _0x23be76;}}module[_0x1b5e('0x9')]['domCompare']=domCompare;function monthCompare(_0x250702,_0x19bb86,_0x360d14){var _0x286c39=_0x250702[_0x1b5e('0x4')]('en')[_0x1b5e('0x14')](_0x1b5e('0x1c'))[_0x1b5e('0x5')]();return circularMonthInterval(_0x19bb86,_0x360d14)[_0x1b5e('0x16')](_0x286c39);}module['exports']['monthCompare']=monthCompare;function iftime(_0x1135c7,_0x2d67b9=moment['tz'][_0x1b5e('0x1d')](),_0x44ad94=moment()){if(!validateRx[_0x1b5e('0x1e')](_0x1135c7)){throw new Error(EINVALID_STRING);}else{var _0x519144=(moment['isMoment'](_0x44ad94)?_0x44ad94['clone']():moment(_0x44ad94))['tz'](_0x2d67b9)['locale']('en');throwIfDateNotValid(_0x519144);var _0x4e90bf=_0x1135c7['split'](',');var _0x14158f=_0x4e90bf[0x0];var _0x4740e2=_0x4e90bf[0x1];var _0x38df87=_0x4e90bf[0x2];var _0x33ae2a=_0x4e90bf[0x3];let _0x410942=!![];if(_0x14158f!=='*'){var _0x4b6684=_0x14158f[_0x1b5e('0x1f')]('-');var _0x1fd527=_[_0x1b5e('0x20')](_0x4b6684[0x0],0x5,'0');var _0x41b6a4=_0x4b6684[_0x1b5e('0x21')]===0x2?_['padStart'](_0x4b6684[0x1],0x5,'0'):_0x1fd527;_0x410942=timeCompare(_0x519144,_0x1fd527,_0x41b6a4);}let _0x5c9bb3=!![];if(_0x4740e2!=='*'){var _0xfd69d2=_0x4740e2[_0x1b5e('0x1f')]('-');var _0x52417a=_0xfd69d2[0x0];var _0x271bf2=_0xfd69d2[_0x1b5e('0x21')]===0x2?_0xfd69d2[0x1]:_0x52417a;_0x5c9bb3=dowCompare(_0x519144,_0x52417a,_0x271bf2);}let _0x39a474=!![];if(_0x38df87!=='*'){var _0x26e710=_0x38df87[_0x1b5e('0x1f')]('-');var _0x330fd2=parseDom(_0x26e710[0x0]);var _0x4c3879=_0x26e710[_0x1b5e('0x21')]===0x2?parseDom(_0x26e710[0x1]):_0x330fd2;_0x39a474=domCompare(_0x519144,_0x330fd2,_0x4c3879);}let _0x3a2f1e=!![];if(_0x33ae2a!=='*'){var _0x4d2311=_0x33ae2a[_0x1b5e('0x1f')]('-');var _0x20876e=_0x4d2311[0x0];var _0x172a05=_0x4d2311[_0x1b5e('0x21')]===0x2?_0x4d2311[0x1]:_0x4d2311[0x0];_0x3a2f1e=monthCompare(_0x519144,_0x20876e,_0x172a05);}return _0x410942&&_0x5c9bb3&&_0x39a474&&_0x3a2f1e;}}module[_0x1b5e('0x9')][_0x1b5e('0x22')]=iftime; \ No newline at end of file +var _0x93a6=['test','padStart','length','iftime','source','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','split','map','locale','weekdaysShort','toLowerCase','indexOf','slice','circularDoWInterval','concat','exports','circularMonthInterval','clone','hours','minutes','isBefore','startOf','day','endOf','isBetween','format','ddd','date','daysInMonth','max','min','MMM','includes','monthCompare','guess'];(function(_0xd54653,_0x101a89){var _0x5c1786=function(_0x390e22){while(--_0x390e22){_0xd54653['push'](_0xd54653['shift']());}};_0x5c1786(++_0x101a89);}(_0x93a6,0x1c0));var _0x693a=function(_0x56b891,_0x2f117e){_0x56b891=_0x56b891-0x0;var _0x41d994=_0x93a6[_0x56b891];return _0x41d994;};var _=require('lodash');var moment=require('moment-timezone');var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx]['map'](function(_0x34e18a){return _0x34e18a[_0x693a('0x0')];})['join'](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x693a('0x1');var EINVALID_DATE=_0x693a('0x2');function throwIfDateNotValid(_0x2cc022){if(!_0x2cc022[_0x693a('0x3')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x488380){var _0x26e799=_0x488380[_0x693a('0x4')](':')[_0x693a('0x5')](function(_0x1a8bda){return parseInt(_0x1a8bda,0xa);});var _0x12aad5=_0x26e799[0x0];var _0x30d498=_0x26e799[0x1];if(_0x12aad5<0x0||_0x12aad5>0x17||_0x30d498<0x0||_0x30d498>0x3b){throw new Error(EINVALID_DATE);}return[_0x12aad5,_0x30d498];}function circularDoWInterval(_0x4b7aad,_0x32e20a){if(_0x4b7aad===_0x32e20a){return[_0x4b7aad];}else{var _0x854937=moment[_0x693a('0x6')]();moment['locale']('en');var _0x212eb9=moment[_0x693a('0x7')]()[_0x693a('0x5')](function(_0x5843d2){return _0x5843d2[_0x693a('0x8')]();});moment[_0x693a('0x6')](_0x854937);var _0x2076f4=_0x212eb9[_0x693a('0x9')](_0x4b7aad);var _0x59f316=_0x212eb9[_0x693a('0x9')](_0x32e20a);if(_0x59f316>_0x2076f4){return _0x212eb9[_0x693a('0xa')](_0x2076f4,_0x59f316+0x1);}else{var _0x27bfaa=_0x212eb9['slice'](0x0,_0x59f316+0x1);var _0x14f593=_0x212eb9[_0x693a('0xa')](_0x2076f4);return _0x14f593['concat'](_0x27bfaa);}}}module['exports'][_0x693a('0xb')]=circularDoWInterval;function circularMonthInterval(_0x3eb4dc,_0x540a20){if(_0x3eb4dc===_0x540a20){return[_0x3eb4dc];}else{var _0x59fde4=moment['locale']();moment[_0x693a('0x6')]('en');var _0x1a61b6=moment['monthsShort']()[_0x693a('0x5')](function(_0x249cb1){return _0x249cb1[_0x693a('0x8')]();});moment[_0x693a('0x6')](_0x59fde4);var _0x59b18d=_0x1a61b6['indexOf'](_0x3eb4dc);var _0x23b784=_0x1a61b6[_0x693a('0x9')](_0x540a20);if(_0x23b784>_0x59b18d){return _0x1a61b6[_0x693a('0xa')](_0x59b18d,_0x23b784+0x1);}else{var _0x28419a=_0x1a61b6[_0x693a('0xa')](0x0,_0x23b784+0x1);var _0x221240=_0x1a61b6['slice'](_0x59b18d);return _0x221240[_0x693a('0xc')](_0x28419a);}}}module[_0x693a('0xd')][_0x693a('0xe')]=circularMonthInterval;function parseDom(_0x1a3b6){var _0x5f3aee=parseInt(_0x1a3b6,0xa);if(_0x5f3aee<0x1||_0x5f3aee>0x1f){throw new Error(EINVALID_DATE);}return _0x5f3aee;}function timeCompare(_0x52a903,_0x393755,_0x575ad6){var _0x4290b9=_0x52a903[_0x693a('0xf')]();var _0x19e6a4=extractTime(_0x393755);var _0x4994fd=_0x19e6a4[0x0];var _0x234df4=_0x19e6a4[0x1];var _0x21f818=_0x52a903[_0x693a('0xf')]()[_0x693a('0x10')](_0x4994fd)[_0x693a('0x11')](_0x234df4);throwIfDateNotValid(_0x21f818);var _0x2ce0ab=extractTime(_0x575ad6);var _0x3791b3=_0x2ce0ab[0x0];var _0x581fee=_0x2ce0ab[0x1];var _0x2fcaf4=_0x52a903[_0x693a('0xf')]()[_0x693a('0x10')](_0x3791b3)[_0x693a('0x11')](_0x581fee);throwIfDateNotValid(_0x2fcaf4);if(_0x2fcaf4[_0x693a('0x12')](_0x21f818)){var _0x9748fe=_0x4290b9[_0x693a('0xf')]()[_0x693a('0x13')](_0x693a('0x14'));var _0x15527f=_0x4290b9[_0x693a('0xf')]()[_0x693a('0x15')](_0x693a('0x14'));return _0x4290b9[_0x693a('0x16')](_0x21f818,_0x15527f,undefined,'[]')||_0x4290b9['isBetween'](_0x9748fe,_0x2fcaf4,undefined,'[]');}else{return _0x4290b9[_0x693a('0x16')](_0x21f818,_0x2fcaf4,undefined,'[]');}}module['exports']['timeCompare']=timeCompare;function dowCompare(_0x10eee4,_0x2c897c,_0x82a15d){var _0xdfb128=_0x10eee4[_0x693a('0x6')]('en')[_0x693a('0x17')](_0x693a('0x18'))[_0x693a('0x8')]();return circularDoWInterval(_0x2c897c,_0x82a15d)['includes'](_0xdfb128);}module[_0x693a('0xd')]['dowCompare']=dowCompare;function domCompare(_0x564ac6,_0x4117b6,_0x5b0c1f){var _0x5200ea=_0x564ac6[_0x693a('0x19')]();if(_0x4117b6===_0x5b0c1f){return _0x5200ea===_0x4117b6;}else{var _0x3c176a=_0x564ac6[_0x693a('0x1a')]();var _0x5b5e18=_0x4117b6<_0x5b0c1f;let _0x5a09f2=![];var _0x6fef69=0x0;var _0x497114=0x0;if(_0x5b5e18){_0x6fef69=Math[_0x693a('0x1b')](0x1,_0x4117b6);_0x497114=Math[_0x693a('0x1c')](_0x5b0c1f,_0x3c176a);_0x5a09f2=_0x5200ea>=_0x6fef69&&_0x5200ea<=_0x497114;}else{_0x6fef69=Math[_0x693a('0x1c')](_0x4117b6,_0x3c176a);_0x497114=Math['max'](0x1,_0x5b0c1f);_0x5a09f2=_0x5200ea>=_0x6fef69||_0x5200ea<=_0x497114;}return _0x5a09f2;}}module[_0x693a('0xd')]['domCompare']=domCompare;function monthCompare(_0x561195,_0x310867,_0x5a2574){var _0x1606a1=_0x561195[_0x693a('0x6')]('en')['format'](_0x693a('0x1d'))['toLowerCase']();return circularMonthInterval(_0x310867,_0x5a2574)[_0x693a('0x1e')](_0x1606a1);}module['exports'][_0x693a('0x1f')]=monthCompare;function iftime(_0x5ced6b,_0x5eec83=moment['tz'][_0x693a('0x20')](),_0x5f283d=moment()){if(!validateRx[_0x693a('0x21')](_0x5ced6b)){throw new Error(EINVALID_STRING);}else{var _0x32d88f=(moment['isMoment'](_0x5f283d)?_0x5f283d['clone']():moment(_0x5f283d))['tz'](_0x5eec83)[_0x693a('0x6')]('en');throwIfDateNotValid(_0x32d88f);var _0x4b9b55=_0x5ced6b[_0x693a('0x4')](',');var _0x37f127=_0x4b9b55[0x0];var _0x1015ff=_0x4b9b55[0x1];var _0x1cf8b4=_0x4b9b55[0x2];var _0x56f91f=_0x4b9b55[0x3];let _0x27816d=!![];if(_0x37f127!=='*'){var _0x18341e=_0x37f127['split']('-');var _0x205c33=_[_0x693a('0x22')](_0x18341e[0x0],0x5,'0');var _0xa80282=_0x18341e[_0x693a('0x23')]===0x2?_['padStart'](_0x18341e[0x1],0x5,'0'):_0x205c33;_0x27816d=timeCompare(_0x32d88f,_0x205c33,_0xa80282);}let _0x24aa34=!![];if(_0x1015ff!=='*'){var _0x2c6e4f=_0x1015ff[_0x693a('0x4')]('-');var _0x56ada1=_0x2c6e4f[0x0];var _0x21c89d=_0x2c6e4f[_0x693a('0x23')]===0x2?_0x2c6e4f[0x1]:_0x56ada1;_0x24aa34=dowCompare(_0x32d88f,_0x56ada1,_0x21c89d);}let _0x1698ee=!![];if(_0x1cf8b4!=='*'){var _0xdb22f6=_0x1cf8b4['split']('-');var _0x51bd3b=parseDom(_0xdb22f6[0x0]);var _0x2919db=_0xdb22f6[_0x693a('0x23')]===0x2?parseDom(_0xdb22f6[0x1]):_0x51bd3b;_0x1698ee=domCompare(_0x32d88f,_0x51bd3b,_0x2919db);}let _0x3ee6b4=!![];if(_0x56f91f!=='*'){var _0xd7d5=_0x56f91f[_0x693a('0x4')]('-');var _0x4a2a34=_0xd7d5[0x0];var _0x2f1c1e=_0xd7d5[_0x693a('0x23')]===0x2?_0xd7d5[0x1]:_0xd7d5[0x0];_0x3ee6b4=monthCompare(_0x32d88f,_0x4a2a34,_0x2f1c1e);}return _0x27816d&&_0x24aa34&&_0x1698ee&&_0x3ee6b4;}}module[_0x693a('0xd')][_0x693a('0x24')]=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 01ecce7..46f377b 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa1e2=['winston','../config/environment','debugLevel','toLowerCase','info','redBG\x20white','red','bold\x20yellow','white','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','join','format','message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','meta','keys','length','stringify','transports','Console','warn','Logger','error','%s-%s','consoleLogger','fileLogger','moment'];(function(_0x5d2ca1,_0x343504){var _0x484bbf=function(_0x4f5b03){while(--_0x4f5b03){_0x5d2ca1['push'](_0x5d2ca1['shift']());}};_0x484bbf(++_0x343504);}(_0xa1e2,0x9f));var _0x2a1e=function(_0x729eef,_0x4d37a8){_0x729eef=_0x729eef-0x0;var _0x413580=_0xa1e2[_0x729eef];return _0x413580;};'use strict';var path=require('path');var util=require('util');var moment=require(_0x2a1e('0x0'));var winston=require(_0x2a1e('0x1'));var config=require(_0x2a1e('0x2'));var debugLevel=config[_0x2a1e('0x3')]?config[_0x2a1e('0x3')][_0x2a1e('0x4')]():_0x2a1e('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':_0x2a1e('0x6'),'error':_0x2a1e('0x7'),'warn':_0x2a1e('0x8'),'info':_0x2a1e('0x9'),'print':_0x2a1e('0xa'),'success':_0x2a1e('0xb'),'http':_0x2a1e('0xc'),'verbose':_0x2a1e('0xd'),'debug':_0x2a1e('0xe'),'silly':_0x2a1e('0xf')};winston[_0x2a1e('0x10')](XC_LOG_COLORS);function getLogFileName(_0x3def4d,_0x209d41,_0x140b43){var _0x2086f2=_0x3def4d||_0x2a1e('0x11');return path[_0x2a1e('0x12')](_0x2086f2,util[_0x2a1e('0x13')]('%s-%s.log',_0x209d41,_0x140b43));}function formatter(_0x2861b9,_0x1c9e15){_0x1c9e15[_0x2a1e('0x14')]=_0x1c9e15['message'][_0x2a1e('0x15')](/@@{/g,_0x2a1e('0x16'))[_0x2a1e('0x15')](/}@@/g,_0x2a1e('0x17'))[_0x2a1e('0x15')](/@{/g,'{{')[_0x2a1e('0x15')](/}@/g,'}}');return util['format'](_0x2a1e('0x18'),moment()[_0x2a1e('0x13')](_0x2a1e('0x19')),_0x1c9e15[_0x2a1e('0x1a')][_0x2a1e('0x1b')](),_0x2861b9,_0x1c9e15[_0x2a1e('0x14')]);}function fileFormat(_0x248df2,_0x278882){_0x278882[_0x2a1e('0x14')]=_0x278882[_0x2a1e('0x14')][_0x2a1e('0x15')](/@@{/g,_0x2a1e('0x16'))['replace'](/}@@/g,_0x2a1e('0x17'))['replace'](/@{/g,'{{')['replace'](/}@/g,'}}');var _0x498ea2=_0x278882[_0x2a1e('0x1c')]&&Object[_0x2a1e('0x1d')](_0x278882['meta'])[_0x2a1e('0x1e')]?'\x0a\x09'+JSON[_0x2a1e('0x1f')](_0x278882[_0x2a1e('0x1c')]):'';return util[_0x2a1e('0x13')]('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()[_0x2a1e('0x13')](_0x2a1e('0x19')),_0x278882[_0x2a1e('0x1a')][_0x2a1e('0x1b')](),_0x248df2,_0x278882[_0x2a1e('0x14')],_0x498ea2);}function consoleLogger(){var _0x48014e=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x2a1e('0x20'))][(_0x2a1e('0x21'))]({'level':_0x2a1e('0x22'),'json':![],'formatter':function(_0xfdc7e4){return formatter('',_0xfdc7e4);}})]});return _0x48014e;}function fileLogger(_0x324ff1,_0x48713c){var _0x1334be=new winston[(_0x2a1e('0x23'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x2a1e('0x20'))]['File']({'name':util[_0x2a1e('0x13')]('%s-%s',_0x324ff1,_0x2a1e('0x24')),'filename':getLogFileName(_0x48713c,_0x324ff1,_0x2a1e('0x24')),'level':_0x2a1e('0x24'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x23d789){return fileFormat(_0x324ff1,_0x23d789);}}),new winston[(_0x2a1e('0x20'))]['File']({'name':util[_0x2a1e('0x13')](_0x2a1e('0x25'),_0x324ff1,debugLevel),'filename':getLogFileName(_0x48713c,_0x324ff1,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1554b1){return fileFormat(_0x324ff1,_0x1554b1);}}),new winston[(_0x2a1e('0x20'))][(_0x2a1e('0x21'))]({'level':_0x2a1e('0x22'),'json':![],'formatter':function(_0x1ea445){return fileFormat(_0x324ff1,_0x1ea445);}})]});return _0x1334be;}exports[_0x2a1e('0x26')]=consoleLogger;exports[_0x2a1e('0x27')]=fileLogger; \ No newline at end of file +var _0x272a=['winston','../config/environment','debugLevel','redBG\x20white','red','white','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20blue','bold\x20cyan','/var/log/xcally','join','format','%s-%s.log','message','replace','{{{','}}}','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','meta','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Logger','transports','Console','warn','File','%s-%s','error','consoleLogger','fileLogger','util','moment'];(function(_0x38736d,_0x5a54fc){var _0x56af43=function(_0x3fd4d7){while(--_0x3fd4d7){_0x38736d['push'](_0x38736d['shift']());}};_0x56af43(++_0x5a54fc);}(_0x272a,0xe2));var _0xa272=function(_0x5a66c5,_0x1c6773){_0x5a66c5=_0x5a66c5-0x0;var _0x385a9d=_0x272a[_0x5a66c5];return _0x385a9d;};'use strict';var path=require('path');var util=require(_0xa272('0x0'));var moment=require(_0xa272('0x1'));var winston=require(_0xa272('0x2'));var config=require(_0xa272('0x3'));var debugLevel=config[_0xa272('0x4')]?config[_0xa272('0x4')]['toLowerCase']():'info';var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0xa272('0x5'),'error':_0xa272('0x6'),'warn':'bold\x20yellow','info':_0xa272('0x7'),'print':_0xa272('0x8'),'success':_0xa272('0x9'),'http':_0xa272('0xa'),'verbose':_0xa272('0xb'),'debug':_0xa272('0xc'),'silly':_0xa272('0xd')};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0x2732a1,_0x1503e5,_0x71d6cc){var _0x33ee69=_0x2732a1||_0xa272('0xe');return path[_0xa272('0xf')](_0x33ee69,util[_0xa272('0x10')](_0xa272('0x11'),_0x1503e5,_0x71d6cc));}function formatter(_0x56a977,_0x581c37){_0x581c37['message']=_0x581c37[_0xa272('0x12')][_0xa272('0x13')](/@@{/g,_0xa272('0x14'))[_0xa272('0x13')](/}@@/g,_0xa272('0x15'))[_0xa272('0x13')](/@{/g,'{{')['replace'](/}@/g,'}}');return util[_0xa272('0x10')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0xa272('0x10')](_0xa272('0x16')),_0x581c37[_0xa272('0x17')][_0xa272('0x18')](),_0x56a977,_0x581c37['message']);}function fileFormat(_0x1b5feb,_0x1479b1){_0x1479b1[_0xa272('0x12')]=_0x1479b1[_0xa272('0x12')][_0xa272('0x13')](/@@{/g,_0xa272('0x14'))[_0xa272('0x13')](/}@@/g,'}}}')[_0xa272('0x13')](/@{/g,'{{')[_0xa272('0x13')](/}@/g,'}}');var _0x36237a=_0x1479b1[_0xa272('0x19')]&&Object['keys'](_0x1479b1[_0xa272('0x19')])[_0xa272('0x1a')]?'\x0a\x09'+JSON[_0xa272('0x1b')](_0x1479b1['meta']):'';return util['format'](_0xa272('0x1c'),moment()[_0xa272('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),_0x1479b1[_0xa272('0x17')][_0xa272('0x18')](),_0x1b5feb,_0x1479b1[_0xa272('0x12')],_0x36237a);}function consoleLogger(){var _0x2a7d5a=new winston[(_0xa272('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xa272('0x1e'))][(_0xa272('0x1f'))]({'level':_0xa272('0x20'),'json':![],'formatter':function(_0x28f578){return formatter('',_0x28f578);}})]});return _0x2a7d5a;}function fileLogger(_0x159566,_0x4eb3e1){var _0x13f548=new winston[(_0xa272('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xa272('0x1e'))][(_0xa272('0x21'))]({'name':util['format'](_0xa272('0x22'),_0x159566,_0xa272('0x23')),'filename':getLogFileName(_0x4eb3e1,_0x159566,_0xa272('0x23')),'level':_0xa272('0x23'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1db524){return fileFormat(_0x159566,_0x1db524);}}),new winston['transports'][(_0xa272('0x21'))]({'name':util[_0xa272('0x10')](_0xa272('0x22'),_0x159566,debugLevel),'filename':getLogFileName(_0x4eb3e1,_0x159566,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x48fbed){return fileFormat(_0x159566,_0x48fbed);}}),new winston[(_0xa272('0x1e'))][(_0xa272('0x1f'))]({'level':_0xa272('0x20'),'json':![],'formatter':function(_0x457149){return fileFormat(_0x159566,_0x457149);}})]});return _0x13f548;}exports[_0xa272('0x24')]=consoleLogger;exports[_0xa272('0x25')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index c1dba69..fa4cf94 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 _0x14a0=['membername','calleridnum','exten','clientEmail','privateKey','accesskeyid','secretaccesskey','key','user','pass','accountSid','localstationid','dsn','secret','registry','isArray','length','isPlainObject','isString','replace','@@{','}@@','includes','exports','maskSensitiveData','username','password','newPassword','apiKey','firstName','lastName','street','fax','email','clientId','code','accessKey','tenantId','accessToken'];(function(_0x547cbe,_0x5654fb){var _0x50a1c4=function(_0x4b0055){while(--_0x4b0055){_0x547cbe['push'](_0x547cbe['shift']());}};_0x50a1c4(++_0x5654fb);}(_0x14a0,0x8e));var _0x014a=function(_0x3d3b60,_0x5e644e){_0x3d3b60=_0x3d3b60-0x0;var _0x4fc990=_0x14a0[_0x3d3b60];return _0x4fc990;};var _=require('lodash');var sensitiveFields=[_0x014a('0x0'),_0x014a('0x1'),_0x014a('0x2'),_0x014a('0x3'),_0x014a('0x4'),_0x014a('0x5'),_0x014a('0x6'),'phone','mobile',_0x014a('0x7'),_0x014a('0x8'),_0x014a('0x9'),'clientSecret','securityToken',_0x014a('0xa'),_0x014a('0xb'),_0x014a('0xc'),'token','channelSecret',_0x014a('0xd'),'accessTokenSecret','authToken','consumerKey','consumerSecret',_0x014a('0xe'),'calleridname',_0x014a('0xf'),_0x014a('0x10'),'vidaooApiKey',_0x014a('0x11'),_0x014a('0x12'),_0x014a('0x13'),_0x014a('0x14'),_0x014a('0x15'),_0x014a('0x16'),_0x014a('0x17'),_0x014a('0x18'),_0x014a('0x19'),_0x014a('0x1a'),_0x014a('0x1b'),_0x014a('0x1c'),'oldPassword'];function maskSensitiveData(_0x130d13){const _0x3cf92f=/(?!^)[\s\S](?!$)/g;if(_['isPlainObject'](_0x130d13)){for(const _0x3a836f in _0x130d13){if(_[_0x014a('0x1d')](_0x130d13[_0x3a836f])){for(let _0x59a4ea=0x0;_0x59a4ea<_0x130d13[_0x3a836f][_0x014a('0x1e')];_0x59a4ea++){maskSensitiveData(_0x130d13[_0x3a836f][_0x59a4ea]);}}else if(_[_0x014a('0x1f')](_0x130d13[_0x3a836f])){maskSensitiveData(_0x130d13[_0x3a836f]);}else if(_[_0x014a('0x20')](_0x130d13[_0x3a836f])){_0x130d13[_0x3a836f]=_0x130d13[_0x3a836f][_0x014a('0x21')](/{{{/g,_0x014a('0x22'))[_0x014a('0x21')](/}}}/g,_0x014a('0x23'))[_0x014a('0x21')](/{{/g,'@{')[_0x014a('0x21')](/}}/g,'}@');if(_[_0x014a('0x24')](sensitiveFields,_0x3a836f)){_0x130d13[_0x3a836f]=_0x130d13[_0x3a836f][_0x014a('0x21')](_0x3cf92f,'*');}}}}}module[_0x014a('0x25')][_0x014a('0x26')]=maskSensitiveData; \ No newline at end of file +var _0x0295=['length','isString','replace','}@@','includes','exports','lodash','newPassword','lastName','street','phone','mobile','fax','email','clientId','clientSecret','securityToken','token','accessToken','authToken','consumerSecret','membername','calleridname','exten','vidaooApiKey','clientEmail','accesskeyid','secretaccesskey','localstationid','dsn','secret','registry','oldPassword','isPlainObject','isArray'];(function(_0x562f3b,_0x4c65ae){var _0x1edd55=function(_0xe67e06){while(--_0xe67e06){_0x562f3b['push'](_0x562f3b['shift']());}};_0x1edd55(++_0x4c65ae);}(_0x0295,0x1f0));var _0x5029=function(_0x24e3f0,_0x291458){_0x24e3f0=_0x24e3f0-0x0;var _0x36b770=_0x0295[_0x24e3f0];return _0x36b770;};var _=require(_0x5029('0x0'));var sensitiveFields=['username','password',_0x5029('0x1'),'apiKey','firstName',_0x5029('0x2'),_0x5029('0x3'),_0x5029('0x4'),_0x5029('0x5'),_0x5029('0x6'),_0x5029('0x7'),_0x5029('0x8'),_0x5029('0x9'),_0x5029('0xa'),'code','accessKey','tenantId',_0x5029('0xb'),'channelSecret',_0x5029('0xc'),'accessTokenSecret',_0x5029('0xd'),'consumerKey',_0x5029('0xe'),_0x5029('0xf'),_0x5029('0x10'),'calleridnum',_0x5029('0x11'),_0x5029('0x12'),_0x5029('0x13'),'privateKey',_0x5029('0x14'),_0x5029('0x15'),'key','user','pass','accountSid',_0x5029('0x16'),_0x5029('0x17'),_0x5029('0x18'),_0x5029('0x19'),_0x5029('0x1a')];function maskSensitiveData(_0x11c24b){const _0xe278b7=/(?!^)[\s\S](?!$)/g;if(_[_0x5029('0x1b')](_0x11c24b)){for(const _0x10bf55 in _0x11c24b){if(_[_0x5029('0x1c')](_0x11c24b[_0x10bf55])){for(let _0x457c73=0x0;_0x457c73<_0x11c24b[_0x10bf55][_0x5029('0x1d')];_0x457c73++){maskSensitiveData(_0x11c24b[_0x10bf55][_0x457c73]);}}else if(_[_0x5029('0x1b')](_0x11c24b[_0x10bf55])){maskSensitiveData(_0x11c24b[_0x10bf55]);}else if(_[_0x5029('0x1e')](_0x11c24b[_0x10bf55])){_0x11c24b[_0x10bf55]=_0x11c24b[_0x10bf55][_0x5029('0x1f')](/{{{/g,'@@{')[_0x5029('0x1f')](/}}}/g,_0x5029('0x20'))[_0x5029('0x1f')](/{{/g,'@{')[_0x5029('0x1f')](/}}/g,'}@');if(_[_0x5029('0x21')](sensitiveFields,_0x10bf55)){_0x11c24b[_0x10bf55]=_0x11c24b[_0x10bf55][_0x5029('0x1f')](_0xe278b7,'*');}}}}}module[_0x5029('0x22')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/misc.js b/server/utils/misc.js index 557dfad..091e4d2 100644 --- a/server/utils/misc.js +++ b/server/utils/misc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fab=['exports','replace','\x5c$&'];(function(_0x3fbb91,_0x5ec106){var _0x3eb213=function(_0x118b9f){while(--_0x118b9f){_0x3fbb91['push'](_0x3fbb91['shift']());}};_0x3eb213(++_0x5ec106);}(_0x5fab,0x177));var _0xb5fa=function(_0x30ac04,_0x365f1b){_0x30ac04=_0x30ac04-0x0;var _0x56b497=_0x5fab[_0x30ac04];return _0x56b497;};module[_0xb5fa('0x0')]={'escapeRegExp'(_0x1c67fb,_0x4c67f9=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x1c67fb[_0xb5fa('0x1')](_0x4c67f9,_0xb5fa('0x2'));}}; \ No newline at end of file +var _0x5fab=['exports','replace','\x5c$&'];(function(_0x1f3c56,_0x598757){var _0x569524=function(_0x345301){while(--_0x345301){_0x1f3c56['push'](_0x1f3c56['shift']());}};_0x569524(++_0x598757);}(_0x5fab,0x177));var _0xb5fa=function(_0x5c883f,_0x38f092){_0x5c883f=_0x5c883f-0x0;var _0x4210cc=_0x5fab[_0x5c883f];return _0x4210cc;};module[_0xb5fa('0x0')]={'escapeRegExp'(_0x1c67fb,_0x4c67f9=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x1c67fb[_0xb5fa('0x1')](_0x4c67f9,_0xb5fa('0x2'));}}; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 32f4b8b..0aee1f6 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 _0x757a=['isArray','map','isPlainObject','reduce','exports','safeTemplate','{\x20{\x20','string','replace'];(function(_0x2cddff,_0xf99e7){var _0x286d69=function(_0x433452){while(--_0x433452){_0x2cddff['push'](_0x2cddff['shift']());}};_0x286d69(++_0xf99e7);}(_0x757a,0xde));var _0xa757=function(_0x3ab899,_0x1db0f2){_0x3ab899=_0x3ab899-0x0;var _0x5c7880=_0x757a[_0x3ab899];return _0x5c7880;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x24afaf){return _0x24afaf==='{{'?_0xa757('0x0'):'\x20}\x20}';}function safeTemplate(_0x5c03c3){var _0x5709ed=_0x5c03c3;if(typeof _0x5c03c3===_0xa757('0x1')){_0x5709ed=_0x5c03c3[_0xa757('0x2')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xa757('0x3')](_0x5c03c3)){_0x5709ed=_0x5c03c3[_0xa757('0x4')](function(_0x32630d){return safeTemplate(_0x32630d);});}else if(_[_0xa757('0x5')](_0x5c03c3)){_0x5709ed=Object['keys'](_0x5c03c3)[_0xa757('0x6')](function(_0x4343b6,_0x53be0e){_0x4343b6[_0x53be0e]=safeTemplate(_0x5c03c3[_0x53be0e]);return _0x4343b6;},{});}return _0x5709ed;}module[_0xa757('0x7')][_0xa757('0x8')]=safeTemplate; \ No newline at end of file +var _0x9348=['isPlainObject','keys','reduce','exports','safeTemplate','lodash','{\x20{\x20','\x20}\x20}','string','replace','map'];(function(_0x3a5ef3,_0x10be0d){var _0x5e96fc=function(_0x430df4){while(--_0x430df4){_0x3a5ef3['push'](_0x3a5ef3['shift']());}};_0x5e96fc(++_0x10be0d);}(_0x9348,0x10d));var _0x8934=function(_0xfd400a,_0x5c1af3){_0xfd400a=_0xfd400a-0x0;var _0x48846a=_0x9348[_0xfd400a];return _0x48846a;};var _=require(_0x8934('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x23f716){return _0x23f716==='{{'?_0x8934('0x1'):_0x8934('0x2');}function safeTemplate(_0x46a231){var _0x4a2577=_0x46a231;if(typeof _0x46a231===_0x8934('0x3')){_0x4a2577=_0x46a231[_0x8934('0x4')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x46a231)){_0x4a2577=_0x46a231[_0x8934('0x5')](function(_0x923aa3){return safeTemplate(_0x923aa3);});}else if(_[_0x8934('0x6')](_0x46a231)){_0x4a2577=Object[_0x8934('0x7')](_0x46a231)[_0x8934('0x8')](function(_0x3ee9b9,_0x512f30){_0x3ee9b9[_0x512f30]=safeTemplate(_0x46a231[_0x512f30]);return _0x3ee9b9;},{});}return _0x4a2577;}module[_0x8934('0x9')][_0x8934('0xa')]=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index ece0c0d..1dff615 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 _0xb635=['then','readJSON','updated','Updating\x20app.json','writeJSON','exports','root','resolve','server/app.json','legacy-libs','isArray','apps','findIndex','name','motion2','NODE_PATH','string','env','pathExists'];(function(_0x389c80,_0x5977d5){var _0x3f643e=function(_0x56dcf6){while(--_0x56dcf6){_0x389c80['push'](_0x389c80['shift']());}};_0x3f643e(++_0x5977d5);}(_0xb635,0x195));var _0x5b63=function(_0x39a4a5,_0x336d77){_0x39a4a5=_0x39a4a5-0x0;var _0x358a51=_0xb635[_0x39a4a5];return _0x358a51;};var fs=require('fs-extra');var path=require('path');var config=require('../config/environment');var root=config[_0x5b63('0x0')];var APP_JSON_PATH=path[_0x5b63('0x1')](root,_0x5b63('0x2'));var NODEPATH=path[_0x5b63('0x1')](root,_0x5b63('0x3'));function setLegacyLibsNodeEnvPath(_0x4616d3){let _0x1fe8a2=![];if(Array[_0x5b63('0x4')](_0x4616d3[_0x5b63('0x5')])){var _0x385b8a=_0x4616d3[_0x5b63('0x5')][_0x5b63('0x6')](function(_0x3bcc75){return _0x3bcc75[_0x5b63('0x7')]===_0x5b63('0x8');});if(_0x385b8a>-0x1){var _0x3182af=_0x4616d3[_0x5b63('0x5')][_0x385b8a];if(typeof _0x3182af['env'][_0x5b63('0x9')]!==_0x5b63('0xa')){_0x3182af[_0x5b63('0xb')]['NODE_PATH']=NODEPATH;_0x1fe8a2=!![];}}return{'appConfig':_0x4616d3,'updated':_0x1fe8a2};}}function updateAppConfig(_0x5e06be){return fs[_0x5b63('0xc')](APP_JSON_PATH)[_0x5b63('0xd')](function(_0x4dfe51){if(_0x4dfe51){return fs[_0x5b63('0xe')](APP_JSON_PATH)[_0x5b63('0xd')](function(_0x15316f){var _0x109b54=setLegacyLibsNodeEnvPath(_0x15316f);if(_0x109b54[_0x5b63('0xf')]){_0x5e06be['info'](_0x5b63('0x10'));return fs[_0x5b63('0x11')](APP_JSON_PATH,_0x15316f,{'spaces':0x2});}else{return Promise[_0x5b63('0x1')]();}});}else{return Promise[_0x5b63('0x1')]();}});}module[_0x5b63('0x12')]=updateAppConfig; \ No newline at end of file +var _0x88a4=['env','NODE_PATH','string','pathExists','then','readJSON','updated','info','Updating\x20app.json','writeJSON','path','../config/environment','root','resolve','legacy-libs','isArray','apps','findIndex','motion2'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x88a4,0x1d2));var _0x488a=function(_0x248d88,_0x74b152){_0x248d88=_0x248d88-0x0;var _0x1da541=_0x88a4[_0x248d88];return _0x1da541;};var fs=require('fs-extra');var path=require(_0x488a('0x0'));var config=require(_0x488a('0x1'));var root=config[_0x488a('0x2')];var APP_JSON_PATH=path[_0x488a('0x3')](root,'server/app.json');var NODEPATH=path[_0x488a('0x3')](root,_0x488a('0x4'));function setLegacyLibsNodeEnvPath(_0x28cf6e){let _0x6abaa0=![];if(Array[_0x488a('0x5')](_0x28cf6e[_0x488a('0x6')])){var _0x44a740=_0x28cf6e['apps'][_0x488a('0x7')](function(_0x59243f){return _0x59243f['name']===_0x488a('0x8');});if(_0x44a740>-0x1){var _0x9f5708=_0x28cf6e[_0x488a('0x6')][_0x44a740];if(typeof _0x9f5708[_0x488a('0x9')][_0x488a('0xa')]!==_0x488a('0xb')){_0x9f5708['env'][_0x488a('0xa')]=NODEPATH;_0x6abaa0=!![];}}return{'appConfig':_0x28cf6e,'updated':_0x6abaa0};}}function updateAppConfig(_0x1a1d02){return fs[_0x488a('0xc')](APP_JSON_PATH)[_0x488a('0xd')](function(_0x365162){if(_0x365162){return fs[_0x488a('0xe')](APP_JSON_PATH)[_0x488a('0xd')](function(_0x247040){var _0xfa88f4=setLegacyLibsNodeEnvPath(_0x247040);if(_0xfa88f4[_0x488a('0xf')]){_0x1a1d02[_0x488a('0x10')](_0x488a('0x11'));return fs[_0x488a('0x12')](APP_JSON_PATH,_0x247040,{'spaces':0x2});}else{return Promise[_0x488a('0x3')]();}});}else{return Promise[_0x488a('0x3')]();}});}module['exports']=updateAppConfig; \ No newline at end of file